MAINTAINERS/s390x: add terminal3270.c
[qemu.git] / include / hw / misc / mips_itu.h
blobb3a45320368859a5159ce311453324a3a68c9236
1 /*
2 * Inter-Thread Communication Unit emulation.
4 * Copyright (c) 2016 Imagination Technologies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef MIPS_ITU_H
21 #define MIPS_ITU_H
23 #define TYPE_MIPS_ITU "mips-itu"
24 #define MIPS_ITU(obj) OBJECT_CHECK(MIPSITUState, (obj), TYPE_MIPS_ITU)
26 #define ITC_CELL_DEPTH_SHIFT 2
27 #define ITC_CELL_DEPTH (1u << ITC_CELL_DEPTH_SHIFT)
29 typedef struct ITCStorageCell {
30 struct {
31 uint8_t FIFODepth; /* Log2 of the cell depth */
32 uint8_t FIFOPtr; /* Number of elements in a FIFO cell */
33 uint8_t FIFO; /* 1 - FIFO cell, 0 - Semaphore cell */
34 uint8_t T; /* Trap Bit */
35 uint8_t F; /* Full Bit */
36 uint8_t E; /* Empty Bit */
37 } tag;
39 /* Index of the oldest element in the queue */
40 uint8_t fifo_out;
42 /* Circular buffer for FIFO. Semaphore cells use index 0 only */
43 uint64_t data[ITC_CELL_DEPTH];
45 /* Bitmap tracking blocked threads on the cell.
46 TODO: support >64 threads ? */
47 uint64_t blocked_threads;
48 } ITCStorageCell;
50 #define ITC_ADDRESSMAP_NUM 2
52 typedef struct MIPSITUState {
53 /*< private >*/
54 SysBusDevice parent_obj;
55 /*< public >*/
57 int32_t num_fifo;
58 int32_t num_semaphores;
60 /* ITC Storage */
61 ITCStorageCell *cell;
62 MemoryRegion storage_io;
64 /* ITC Configuration Tags */
65 uint64_t ITCAddressMap[ITC_ADDRESSMAP_NUM];
66 MemoryRegion tag_io;
67 } MIPSITUState;
69 /* Get ITC Configuration Tag memory region. */
70 MemoryRegion *mips_itu_get_tag_region(MIPSITUState *itu);
72 #endif /* MIPS_ITU_H */