| [158] | 1 | //////////////////////////////////////////////////////////////////////////// | 
|---|
|  | 2 | // File     : mapping_info.h | 
|---|
|  | 3 | // Date     : 01/04/2012 | 
|---|
|  | 4 | // Author   : alain greiner | 
|---|
|  | 5 | // Copyright (c) UPMC-LIP6 | 
|---|
|  | 6 | //////////////////////////////////////////////////////////////////////////// | 
|---|
|  | 7 | // The MAPPING_INFO data structure can be used with the GIET. | 
|---|
|  | 8 | // It contains the mapping directive for one or several virtual spaces. | 
|---|
|  | 9 | // Ech virtual space contains a variable number of virtual segments | 
|---|
|  | 10 | // and a variable number of tasks. The number of virtual space can be one. | 
|---|
|  | 11 | // | 
|---|
|  | 12 | // The mapping table data structure is organised as the concatenation of | 
|---|
|  | 13 | // a fixed size header, and 6 variable size arrays: | 
|---|
|  | 14 | // | 
|---|
|  | 15 | // - mapping_header_t   header              (MAPPING_HEADER_SIZE) | 
|---|
|  | 16 | // - mapping_cluster_t  cluster[clusters]   (MAPPING_CLUSTER_SIZE * clusters) | 
|---|
|  | 17 | // - mapping_pseg_t     pseg[psegs]         (MAPPING_PSEG_SIZE * psegs) | 
|---|
|  | 18 | // - mapping_vspace_t   vspace[vspaces]     (MAPPING_VSPACE_SIZE * vspaces) | 
|---|
|  | 19 | // - mapping_vseg_t     vseg[vsegs]         (MAPPING_VSEG_SIZE * vsegs) | 
|---|
| [160] | 20 | // - mapping_vseg_t     vobj[vsegs]         (MAPPING_VOBJ_SIZE * vsegs) | 
|---|
| [158] | 21 | // - mapping_task_t     task[tasks]         (MAPPING_TASK_SIZE * tasks) | 
|---|
|  | 22 | // | 
|---|
|  | 23 | // The number of clusters and the number of vspaces are defined in the header. | 
|---|
|  | 24 | // The number of psegs are defined in each cluster. | 
|---|
|  | 25 | // The number of vsegs, tasks ans mwmrs are defined in each vspace. | 
|---|
|  | 26 | // | 
|---|
|  | 27 | // It is intended to be stored in the boot ROM at address MAPPING_BOOT_BASE. | 
|---|
|  | 28 | // For each cluster, the base address of the first pseg descriptor | 
|---|
|  | 29 | // is defined by a pseg_offset relative to MAPPING_BOOT_BASE. | 
|---|
|  | 30 | // For each vspace, the base address of the first vseg descriptor | 
|---|
|  | 31 | // is defined by a vseg_offset relative to MAPPING_BOOT_BASE. | 
|---|
|  | 32 | // For each vspace, the base address of the first task desciptor | 
|---|
|  | 33 | // is defined by a task_offset relative to MAPPING_BOOT_BASE. | 
|---|
|  | 34 | // For each vspace, the base address of the first mwmr desciptor | 
|---|
|  | 35 | // is defined by a mwmr_offset relative to MAPPING_BOOT_BASE. | 
|---|
|  | 36 | //////////////////////////////////////////////////////////////////////////// | 
|---|
|  | 37 |  | 
|---|
|  | 38 | #ifndef _MAPPING_INFO_H_ | 
|---|
|  | 39 | #define _MAPPING_INFO_H_ | 
|---|
|  | 40 |  | 
|---|
|  | 41 | #define MAPPING_HEADER_SIZE     sizeof(mapping_header_t) | 
|---|
|  | 42 | #define MAPPING_CLUSTER_SIZE    sizeof(mapping_cluster_t) | 
|---|
|  | 43 | #define MAPPING_VSPACE_SIZE     sizeof(mapping_vspace_t) | 
|---|
|  | 44 | #define MAPPING_VSEG_SIZE           sizeof(mapping_vseg_t) | 
|---|
| [160] | 45 | #define MAPPING_VOBJ_SIZE           sizeof(mapping_vobj_t) | 
|---|
| [158] | 46 | #define MAPPING_PSEG_SIZE           sizeof(mapping_pseg_t) | 
|---|
|  | 47 | #define MAPPING_TASK_SIZE           sizeof(mapping_task_t) | 
|---|
|  | 48 |  | 
|---|
|  | 49 | #define C_MODE_MASK     0b1000      // cacheable | 
|---|
|  | 50 | #define X_MODE_MASK     0b0100      // executable | 
|---|
|  | 51 | #define W_MODE_MASK     0b0010      // writable | 
|---|
|  | 52 | #define U_MODE_MASK     0b0001      // user access | 
|---|
|  | 53 |  | 
|---|
|  | 54 | #define IN_MAPPING_SIGNATURE    0xDEADBEEF | 
|---|
|  | 55 | #define OUT_MAPPING_SIGNATURE   0xBABEF00D | 
|---|
|  | 56 |  | 
|---|
| [173] | 57 | enum | 
|---|
| [160] | 58 | { | 
|---|
| [173] | 59 | VOBJ_TYPE_ELF     = 0,     // loadable code/data object of elf files | 
|---|
|  | 60 | VOBJ_TYPE_BLOB    = 1,     // loadable blob object | 
|---|
|  | 61 | VOBJ_TYPE_PTAB    = 2,     // page table | 
|---|
|  | 62 | VOBJ_TYPE_PERI    = 3,     // hardware component | 
|---|
|  | 63 | VOBJ_TYPE_MWMR    = 4,     // MWMR channel | 
|---|
|  | 64 | VOBJ_TYPE_LOCK    = 5,     // Lock | 
|---|
|  | 65 | VOBJ_TYPE_BUFFER  = 6,     // Any "no intialiasation needed" objects (stacks...) | 
|---|
|  | 66 | VOBJ_TYPE_BARRIER = 7,     // Barrier | 
|---|
| [160] | 67 | }; | 
|---|
|  | 68 |  | 
|---|
|  | 69 |  | 
|---|
| [158] | 70 | /////////////////////////////// | 
|---|
|  | 71 | typedef struct mapping_header_s | 
|---|
|  | 72 | { | 
|---|
|  | 73 | unsigned int    signature;      // must contain MAPPING_SIGNATURE | 
|---|
|  | 74 | unsigned int    clusters;           // number of clusters | 
|---|
|  | 75 | unsigned int    psegs;          // number of psegs | 
|---|
|  | 76 | unsigned int    ttys;           // number of TTY terminals | 
|---|
| [165] | 77 | unsigned int    fbs;            // number of Frame Buffer DMA channels | 
|---|
| [158] | 78 | unsigned int    globals;                // number of vsegs mapped in all vspaces | 
|---|
|  | 79 | unsigned int    vspaces;                // number of virtual spaces | 
|---|
| [160] | 80 | unsigned int    vsegs;                  // total number of virtual segments (for all vspaces) | 
|---|
| [165] | 81 | unsigned int    vobjs;                  // total number of virtual objects (for all vspaces) | 
|---|
| [158] | 82 | unsigned int    tasks;                  // total number of tasks (for all vspaces) | 
|---|
|  | 83 | char            name[32];       // mapping name | 
|---|
|  | 84 | } mapping_header_t; | 
|---|
|  | 85 |  | 
|---|
|  | 86 | //////////////////////////////// | 
|---|
|  | 87 | typedef struct mapping_cluster_s | 
|---|
|  | 88 | { | 
|---|
|  | 89 | unsigned int    procs;          // number of processors in cluster | 
|---|
|  | 90 | } mapping_cluster_t; | 
|---|
|  | 91 |  | 
|---|
|  | 92 | ///////////////////////////// | 
|---|
|  | 93 | typedef struct mapping_pseg_s | 
|---|
|  | 94 | { | 
|---|
|  | 95 | char            name[32];       // pseg name (unique in a cluster) | 
|---|
|  | 96 | unsigned int    base;           // base address in physical space | 
|---|
|  | 97 | unsigned int    length;         // size (bytes) | 
|---|
| [167] | 98 | unsigned int    next_base;      // first free page base address | 
|---|
| [158] | 99 | } mapping_pseg_t; | 
|---|
|  | 100 |  | 
|---|
|  | 101 | /////////////////////////////// | 
|---|
|  | 102 | typedef struct mapping_vspace_s | 
|---|
|  | 103 | { | 
|---|
|  | 104 | char            name[32];       // virtual space name | 
|---|
| [165] | 105 | unsigned int    start_offset;   // offset of the vobj containing the start vector | 
|---|
|  | 106 | unsigned int    vsegs;              // number of vsegs in vspace | 
|---|
|  | 107 | unsigned int    vobjs;              // number of vobjs in vspace | 
|---|
|  | 108 | unsigned int    tasks;              // number of tasks in vspace | 
|---|
| [158] | 109 | unsigned int    vseg_offset;    // index of first vseg in vspace | 
|---|
| [160] | 110 | unsigned int    vobj_offset;    // index of first vobjs in vspace | 
|---|
| [158] | 111 | unsigned int    task_offset;    // index of first task in vspace | 
|---|
|  | 112 | } mapping_vspace_t; | 
|---|
|  | 113 |  | 
|---|
|  | 114 | ///////////////////////////// | 
|---|
|  | 115 | typedef struct mapping_vseg_s | 
|---|
|  | 116 | { | 
|---|
|  | 117 | char            name[32];       // vseg name (unique in vspace) | 
|---|
|  | 118 | unsigned int    vbase;          // base address in virtual space (hexa) | 
|---|
|  | 119 | unsigned int    pbase;          // base address in physical space (hexa) | 
|---|
|  | 120 | unsigned int    length;         // size (bytes) | 
|---|
|  | 121 | unsigned int    psegid;         // physical segment index | 
|---|
| [165] | 122 | unsigned int    mode;           // C-X-W-U flags | 
|---|
|  | 123 | unsigned int    ident;          // identity mapping if non zero | 
|---|
|  | 124 | unsigned int    vobjs;              // number of vobjs in vseg | 
|---|
|  | 125 | unsigned int    vobj_offset;    // index of first vobjs in vseg | 
|---|
| [158] | 126 | } mapping_vseg_t; | 
|---|
|  | 127 |  | 
|---|
|  | 128 | ///////////////////////////// | 
|---|
|  | 129 | typedef struct mapping_task_s | 
|---|
|  | 130 | { | 
|---|
|  | 131 | char            name[32];       // task name (unique in vspace) | 
|---|
|  | 132 | unsigned int    clusterid;          // physical cluster index | 
|---|
|  | 133 | unsigned int    proclocid;      // processor local index (inside cluster) | 
|---|
| [160] | 134 | unsigned int    vobjlocid;      // stack vobj index in vspace | 
|---|
| [165] | 135 | unsigned int    startid;        // index in start_vector | 
|---|
|  | 136 | unsigned int    use_tty;        // TTY terminal required | 
|---|
|  | 137 | unsigned int    use_fb;         // DMA channel to frame buffer required | 
|---|
| [158] | 138 | } mapping_task_t; | 
|---|
|  | 139 |  | 
|---|
| [160] | 140 | ///////////////////////////// | 
|---|
|  | 141 | typedef struct mapping_vobj_s | 
|---|
|  | 142 | { | 
|---|
|  | 143 | char            name[32];       // vobj name (unique in a vspace) | 
|---|
| [165] | 144 | char            binpath[64];    // path for the binary code ("*.elf") | 
|---|
| [160] | 145 | unsigned int    type;           // type of vobj | 
|---|
|  | 146 | unsigned int    length;         // size (bytes) | 
|---|
|  | 147 | unsigned int    align;          // required alignement (logarithm of 2) | 
|---|
| [165] | 148 | unsigned int    vaddr;          // virtual base addresse of the vobj | 
|---|
|  | 149 | unsigned int    paddr;          // physical base addresse of the vobj | 
|---|
|  | 150 | unsigned int    init;           // init value (number of participants for a barrier) | 
|---|
| [160] | 151 | } mapping_vobj_t; | 
|---|
|  | 152 |  | 
|---|
| [158] | 153 | #endif | 
|---|
|  | 154 |  | 
|---|
|  | 155 | // Local Variables: | 
|---|
|  | 156 | // tab-width: 4 | 
|---|
|  | 157 | // c-basic-offset: 4 | 
|---|
|  | 158 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) | 
|---|
|  | 159 | // indent-tabs-mode: nil | 
|---|
|  | 160 | // End: | 
|---|
|  | 161 |  | 
|---|
|  | 162 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 | 
|---|
|  | 163 |  | 
|---|