[158] | 1 | //////////////////////////////////////////////////////////////////////////// |
---|
| 2 | // File : mapping_info.h |
---|
| 3 | // Date : 01/04/2012 |
---|
| 4 | // Author : alain greiner |
---|
| 5 | // Copyright (c) UPMC-LIP6 |
---|
| 6 | //////////////////////////////////////////////////////////////////////////// |
---|
[253] | 7 | // The MAPPING_INFO data structure, used by the GIET_VM kernel contains: |
---|
| 8 | // |
---|
| 9 | // 1) a description of a clusterized hardware architecture. |
---|
| 10 | // The number of cluster is variable (can be one). The number of processors |
---|
| 11 | // per cluster is variable (can be one). The number of peripherals per cluser |
---|
| 12 | // and coprocessor per cluster is variable. The number of physical memory |
---|
| 13 | // banks per cluster is variable. |
---|
| 14 | // |
---|
| 15 | // 2/ a description of the applications (called vspaces) to be - statically - |
---|
| 16 | // launched on the platform. The number of parallel tasks per application is |
---|
| 17 | // variable (can be one). Multi-Writer/Multi-Reader communication channels |
---|
| 18 | // betwwen tasks are supported. Each vspace contains a variable number |
---|
| 19 | // of virtual segments (called vsegs). |
---|
| 20 | // |
---|
| 21 | // 3/ the mapping directives: both tasks on processors, and software objects |
---|
| 22 | // (vobjs and vsegs) on the physical memory banks (called psegs). |
---|
[158] | 23 | // and a variable number of tasks. The number of virtual space can be one. |
---|
| 24 | // |
---|
[253] | 25 | // The mapping_info data structure is organised as the concatenation of |
---|
| 26 | // a fixed size header, and 11 variable size arrays: |
---|
[158] | 27 | // |
---|
[189] | 28 | // - mapping_cluster_t cluster[] |
---|
| 29 | // - mapping_pseg_t pseg[] |
---|
| 30 | // - mapping_vspace_t vspace[] |
---|
| 31 | // - mapping_vseg_t vseg[] |
---|
| 32 | // - mapping_vseg_t vobj[] |
---|
| 33 | // - mapping_task_t task[] |
---|
[253] | 34 | // - mapping_proc_t proc[] |
---|
| 35 | // - mapping_irq_t irq[] |
---|
[189] | 36 | // - mapping_coproc_t coproc[] |
---|
| 37 | // - mapping_cp_port_t cp_port[] |
---|
| 38 | // - mapping_periph_t periph[] |
---|
[158] | 39 | // |
---|
[253] | 40 | // It is intended to be stored in memory at address MAPPING_BOOT_BASE. |
---|
[158] | 41 | //////////////////////////////////////////////////////////////////////////// |
---|
| 42 | |
---|
| 43 | #ifndef _MAPPING_INFO_H_ |
---|
| 44 | #define _MAPPING_INFO_H_ |
---|
| 45 | |
---|
[228] | 46 | #define MAPPING_HEADER_SIZE sizeof(mapping_header_t) |
---|
| 47 | #define MAPPING_CLUSTER_SIZE sizeof(mapping_cluster_t) |
---|
| 48 | #define MAPPING_VSPACE_SIZE sizeof(mapping_vspace_t) |
---|
| 49 | #define MAPPING_VSEG_SIZE sizeof(mapping_vseg_t) |
---|
| 50 | #define MAPPING_VOBJ_SIZE sizeof(mapping_vobj_t) |
---|
| 51 | #define MAPPING_PSEG_SIZE sizeof(mapping_pseg_t) |
---|
| 52 | #define MAPPING_TASK_SIZE sizeof(mapping_task_t) |
---|
| 53 | #define MAPPING_PROC_SIZE sizeof(mapping_proc_t) |
---|
| 54 | #define MAPPING_IRQ_SIZE sizeof(mapping_irq_t) |
---|
| 55 | #define MAPPING_COPROC_SIZE sizeof(mapping_coproc_t) |
---|
| 56 | #define MAPPING_CP_PORT_SIZE sizeof(mapping_cp_port_t) |
---|
[158] | 57 | |
---|
[228] | 58 | #define C_MODE_MASK 0b1000 // cacheable |
---|
| 59 | #define X_MODE_MASK 0b0100 // executable |
---|
| 60 | #define W_MODE_MASK 0b0010 // writable |
---|
| 61 | #define U_MODE_MASK 0b0001 // user access |
---|
[158] | 62 | |
---|
| 63 | #define IN_MAPPING_SIGNATURE 0xDEADBEEF |
---|
| 64 | #define OUT_MAPPING_SIGNATURE 0xBABEF00D |
---|
| 65 | |
---|
[238] | 66 | typedef unsigned long long paddr_t; |
---|
| 67 | |
---|
| 68 | enum vobjType |
---|
| 69 | { |
---|
| 70 | VOBJ_TYPE_ELF = 0, // loadable code/data object of elf files |
---|
| 71 | VOBJ_TYPE_BLOB = 1, // loadable blob object |
---|
| 72 | VOBJ_TYPE_PTAB = 2, // page table |
---|
| 73 | VOBJ_TYPE_PERI = 3, // hardware component |
---|
| 74 | VOBJ_TYPE_MWMR = 4, // MWMR channel |
---|
| 75 | VOBJ_TYPE_LOCK = 5, // Lock |
---|
| 76 | VOBJ_TYPE_BUFFER = 6, // Any "no initialization" objects (stacks...) |
---|
| 77 | VOBJ_TYPE_BARRIER = 7, // Barrier |
---|
| 78 | VOBJ_TYPE_CONST = 8, // Constant |
---|
| 79 | VOBJ_TYPE_MEMSPACE = 9, // Memspace (descriptor must be initialised) |
---|
| 80 | VOBJ_TYPE_SCHED = 10, // Array of schedulers (one per cluster) |
---|
[160] | 81 | }; |
---|
| 82 | |
---|
[228] | 83 | |
---|
[238] | 84 | enum psegType |
---|
| 85 | { |
---|
[228] | 86 | PSEG_TYPE_RAM = 0, |
---|
| 87 | PSEG_TYPE_ROM = 1, |
---|
| 88 | PSEG_TYPE_PERI = 2, |
---|
[181] | 89 | }; |
---|
[160] | 90 | |
---|
[253] | 91 | // The enum definitions for psegType and periphType must be kept |
---|
| 92 | // consistent with the definitions in the xml_driver.c file... |
---|
[228] | 93 | |
---|
[238] | 94 | enum periphType |
---|
| 95 | { |
---|
| 96 | PERIPH_TYPE_ICU = 0, |
---|
| 97 | PERIPH_TYPE_TIM = 1, |
---|
| 98 | PERIPH_TYPE_DMA = 2, |
---|
[249] | 99 | PERIPH_TYPE_MMC = 3, |
---|
| 100 | PERIPH_TYPE_CMA = 4, |
---|
| 101 | PERIPH_TYPE_IOC = 5, |
---|
| 102 | PERIPH_TYPE_TTY = 6, |
---|
| 103 | PERIPH_TYPE_FBF = 7, |
---|
| 104 | PERIPH_TYPE_NIC = 8, |
---|
| 105 | PERIPH_TYPE_IOB = 9, |
---|
| 106 | PERIPH_TYPE_GCD = 10, |
---|
[253] | 107 | PERIPH_TYPE_XCU = 11, |
---|
[249] | 108 | |
---|
[253] | 109 | PERIPH_TYPE_MAX_VALUE = 12, |
---|
[181] | 110 | }; |
---|
| 111 | |
---|
[228] | 112 | |
---|
[238] | 113 | enum mwmrPortDirection |
---|
| 114 | { |
---|
[228] | 115 | PORT_TO_COPROC = 0, // status register |
---|
| 116 | PORT_FROM_COPROC = 1, // config register |
---|
[181] | 117 | }; |
---|
| 118 | |
---|
[228] | 119 | |
---|
[158] | 120 | /////////////////////////////// |
---|
[189] | 121 | |
---|
[244] | 122 | typedef struct __attribute__((packed)) mapping_header_s |
---|
[238] | 123 | { |
---|
| 124 | unsigned int signature; // must contain MAPPING_SIGNATURE |
---|
| 125 | unsigned int clusters; // number of clusters |
---|
| 126 | unsigned int cluster_x; // number of cluster in a row |
---|
| 127 | unsigned int cluster_y; // number of cluster in a column |
---|
| 128 | unsigned int globals; // number of vsegs mapped in all vspaces |
---|
| 129 | unsigned int vspaces; // number of virtual spaces |
---|
[253] | 130 | unsigned int increment; // vseg cluster increment for replicated periphs |
---|
[189] | 131 | |
---|
[238] | 132 | unsigned int tty_cluster; // index of cluster containing TTY controler |
---|
| 133 | unsigned int tty_cluster_bis; // index of cluster containing second TTY controler |
---|
| 134 | unsigned int ioc_cluster; // index of cluster containing IOC controler |
---|
| 135 | unsigned int ioc_cluster_bis; // index of cluster containing second IOC controler |
---|
| 136 | unsigned int nic_cluster; // index of cluster containing NIC controler |
---|
| 137 | unsigned int nic_cluster_bis; // index of cluster containing second NIC controler |
---|
| 138 | unsigned int fbf_cluster; // index of cluster containing FBF controler |
---|
| 139 | unsigned int fbf_cluster_bis; // index of cluster containing second FBF controler |
---|
| 140 | unsigned int cma_cluster; // index of cluster containing CMA controler |
---|
| 141 | unsigned int cma_cluster_bis; // index of cluster containing second CMA controler |
---|
| 142 | unsigned int iob_cluster; // index of cluster containing IOB controler |
---|
| 143 | unsigned int iob_cluster_bis; // index of cluster containing second IOB controler |
---|
[189] | 144 | |
---|
[238] | 145 | unsigned int psegs; // total number of physical segments (for all clusters) |
---|
| 146 | unsigned int vsegs; // total number of virtual segments (for all vspaces) |
---|
| 147 | unsigned int vobjs; // total number of virtual objects (for all vspaces) |
---|
| 148 | unsigned int tasks; // total number of tasks (for all vspaces) |
---|
| 149 | unsigned int procs; // total number of procs (for all clusters) |
---|
| 150 | unsigned int irqs; // total number of irqs (for all processors) |
---|
| 151 | unsigned int coprocs; // total number of coprocs (for all clusters) |
---|
| 152 | unsigned int cp_ports; // total number of cp_ports (for all coprocs) |
---|
| 153 | unsigned int periphs; // total number of peripherals (for all clusters) |
---|
[189] | 154 | |
---|
[238] | 155 | char name[32]; // mapping name |
---|
[158] | 156 | } mapping_header_t; |
---|
| 157 | |
---|
[228] | 158 | |
---|
[158] | 159 | //////////////////////////////// |
---|
[244] | 160 | typedef struct __attribute__((packed)) mapping_cluster_s |
---|
[238] | 161 | { |
---|
[228] | 162 | unsigned int psegs; // number of psegs in cluster |
---|
| 163 | unsigned int pseg_offset; // index of first pseg in pseg set |
---|
[189] | 164 | |
---|
[228] | 165 | unsigned int procs; // number of processors in cluster |
---|
| 166 | unsigned int proc_offset; // index of first proc in proc set |
---|
[189] | 167 | |
---|
[228] | 168 | unsigned int coprocs; // number of coprocessors in cluster |
---|
| 169 | unsigned int coproc_offset; // index of first coproc in coproc set |
---|
[189] | 170 | |
---|
[228] | 171 | unsigned int periphs; // number of peripherals in cluster |
---|
| 172 | unsigned int periph_offset; // index of first coproc in coproc set |
---|
[158] | 173 | } mapping_cluster_t; |
---|
| 174 | |
---|
[228] | 175 | |
---|
[158] | 176 | ///////////////////////////// |
---|
[244] | 177 | typedef struct __attribute__((packed)) mapping_pseg_s |
---|
[238] | 178 | { |
---|
| 179 | char name[32]; // pseg name (unique in a cluster) |
---|
| 180 | paddr_t base; // base address in physical space |
---|
| 181 | paddr_t length; // size (bytes) |
---|
[228] | 182 | unsigned int type; // RAM / ROM / PERI |
---|
| 183 | unsigned int cluster; // index of cluster containing pseg |
---|
[238] | 184 | paddr_t next_base; // first free page base address |
---|
[158] | 185 | } mapping_pseg_t; |
---|
| 186 | |
---|
[228] | 187 | |
---|
[158] | 188 | /////////////////////////////// |
---|
[244] | 189 | typedef struct __attribute__((packed)) mapping_vspace_s |
---|
[238] | 190 | { |
---|
| 191 | char name[32]; // virtual space name |
---|
[228] | 192 | unsigned int start_offset; // offset of the vobj containing the start vector |
---|
| 193 | unsigned int vsegs; // number of vsegs in vspace |
---|
| 194 | unsigned int vobjs; // number of vobjs in vspace |
---|
| 195 | unsigned int tasks; // number of tasks in vspace |
---|
| 196 | unsigned int vseg_offset; // index of first vseg in vspace |
---|
| 197 | unsigned int vobj_offset; // index of first vobjs in vspace |
---|
| 198 | unsigned int task_offset; // index of first task in vspace |
---|
[158] | 199 | } mapping_vspace_t; |
---|
| 200 | |
---|
[228] | 201 | |
---|
[158] | 202 | ///////////////////////////// |
---|
[244] | 203 | typedef struct __attribute__((packed)) mapping_vseg_s |
---|
[238] | 204 | { |
---|
| 205 | char name[32]; // vseg name (unique in vspace) |
---|
| 206 | unsigned int vbase; // base address in virtual space |
---|
| 207 | paddr_t pbase; // base address in physical space |
---|
[228] | 208 | unsigned int length; // size (bytes) |
---|
| 209 | unsigned int psegid; // physical segment global index |
---|
| 210 | unsigned int mode; // C-X-W-U flags |
---|
| 211 | unsigned int ident; // identity mapping if non zero |
---|
| 212 | unsigned int vobjs; // number of vobjs in vseg |
---|
[238] | 213 | unsigned int vobj_offset; // index of first vobj in vseg |
---|
[158] | 214 | } mapping_vseg_t; |
---|
| 215 | |
---|
[228] | 216 | |
---|
[158] | 217 | ///////////////////////////// |
---|
[244] | 218 | typedef struct __attribute__((packed)) mapping_task_s |
---|
[238] | 219 | { |
---|
| 220 | char name[32]; // task name (unique in vspace) |
---|
[228] | 221 | unsigned int clusterid; // physical cluster index |
---|
| 222 | unsigned int proclocid; // processor local index (inside cluster) |
---|
[232] | 223 | unsigned int stack_vobjid; // stack vobj index in vspace |
---|
| 224 | unsigned int heap_vobjid; // heap vobj index in vspace |
---|
[228] | 225 | unsigned int startid; // index in start_vector |
---|
[238] | 226 | unsigned int use_tty; // TTY channel required (global) |
---|
[228] | 227 | unsigned int use_nic; // NIC channel required (global) |
---|
[238] | 228 | unsigned int use_cma; // CMA channel required (global) |
---|
| 229 | unsigned int use_ioc; // IOC channel required (global) |
---|
| 230 | unsigned int use_tim; // user timer required (local) |
---|
| 231 | unsigned int use_dma; // DMA channel required (local) |
---|
[158] | 232 | } mapping_task_t; |
---|
| 233 | |
---|
[228] | 234 | |
---|
[160] | 235 | ///////////////////////////// |
---|
[244] | 236 | typedef struct __attribute__((packed)) mapping_vobj_s |
---|
[238] | 237 | { |
---|
| 238 | char name[32]; // vobj name (unique in a vspace) |
---|
| 239 | char binpath[64]; // path for the binary code ("*.elf") |
---|
[228] | 240 | unsigned int type; // type of vobj |
---|
| 241 | unsigned int length; // size (bytes) |
---|
| 242 | unsigned int align; // required alignement (logarithm of 2) |
---|
| 243 | unsigned int vaddr; // virtual base addresse of the vobj |
---|
[238] | 244 | paddr_t paddr; // physical base addresse of the vobj |
---|
[228] | 245 | unsigned int init; // init value (used by barrier or mwmr channel) |
---|
[160] | 246 | } mapping_vobj_t; |
---|
| 247 | |
---|
[228] | 248 | |
---|
[181] | 249 | ///////////////////////////// |
---|
[244] | 250 | typedef struct __attribute__((packed)) mapping_proc_s |
---|
[238] | 251 | { |
---|
[228] | 252 | unsigned int irqs; // number of IRQs allocated to processor |
---|
| 253 | unsigned int irq_offset; // index of first IRQ allocated to processor |
---|
[181] | 254 | } mapping_proc_t; |
---|
| 255 | |
---|
[228] | 256 | |
---|
[181] | 257 | ///////////////////////////// |
---|
[244] | 258 | typedef struct __attribute__((packed)) mapping_irq_s |
---|
[238] | 259 | { |
---|
[228] | 260 | unsigned int type; // 0 => HW_IRQ / 1 => SW_IRQ |
---|
| 261 | unsigned int icuid; // IRQ Index for the ICU component |
---|
[238] | 262 | unsigned int isr; // ISR Index (defined in irq_handler.h) |
---|
| 263 | unsigned int channel; // Channel Index (for multi-channels peripherals) |
---|
[181] | 264 | } mapping_irq_t; |
---|
| 265 | |
---|
[228] | 266 | |
---|
[181] | 267 | /////////////////////////////// |
---|
[244] | 268 | typedef struct __attribute__((packed)) mapping_coproc_s |
---|
[238] | 269 | { |
---|
| 270 | char name[32]; // coprocessor name |
---|
[228] | 271 | unsigned int psegid; // global pseg index |
---|
| 272 | unsigned int ports; // number of MWMR ports used by coprocessor |
---|
| 273 | unsigned int port_offset; // index of first MWMR port used by coprocessor |
---|
[181] | 274 | } mapping_coproc_t; |
---|
| 275 | |
---|
[228] | 276 | |
---|
[189] | 277 | //////////////////////////////// |
---|
[244] | 278 | typedef struct __attribute__((packed)) mapping_cp_port_s |
---|
[238] | 279 | { |
---|
[228] | 280 | unsigned int direction; // TO_COPROC == 0 / FROM_COPROC == 1 |
---|
| 281 | unsigned int vspaceid; // index of the vspace containing the MWMR channel |
---|
[238] | 282 | unsigned int mwmr_vobjid; // local index of the vobj containing the MWMR channel |
---|
[189] | 283 | } mapping_cp_port_t; |
---|
[181] | 284 | |
---|
[228] | 285 | |
---|
[189] | 286 | /////////////////////////////// |
---|
[244] | 287 | typedef struct __attribute__((packed)) mapping_periph_s |
---|
[238] | 288 | { |
---|
[253] | 289 | unsigned int type; |
---|
[228] | 290 | unsigned int psegid; // pseg index in cluster |
---|
| 291 | unsigned int channels; // number of channels |
---|
[189] | 292 | } mapping_periph_t; |
---|
[181] | 293 | |
---|
[189] | 294 | |
---|
[158] | 295 | #endif |
---|
| 296 | |
---|
| 297 | // Local Variables: |
---|
| 298 | // tab-width: 4 |
---|
| 299 | // c-basic-offset: 4 |
---|
| 300 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 301 | // indent-tabs-mode: nil |
---|
| 302 | // End: |
---|
| 303 | |
---|
[228] | 304 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
[158] | 305 | |
---|