Ignore:
Timestamp:
Feb 12, 2013, 6:33:31 PM (11 years ago)
Author:
meunier
Message:

Added support for memspaces and const.
Added an interrupt masking to the "giet_context_switch" syscall
Corrected two bugs in boot/boot_init.c (one minor and one regarding barriers initialization)
Reformatted the code in all files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/xml/mapping_info.h

    r215 r228  
    3030#define _MAPPING_INFO_H_
    3131
    32 #define MAPPING_HEADER_SIZE     sizeof(mapping_header_t)
    33 #define MAPPING_CLUSTER_SIZE    sizeof(mapping_cluster_t)
    34 #define MAPPING_VSPACE_SIZE     sizeof(mapping_vspace_t)
    35 #define MAPPING_VSEG_SIZE           sizeof(mapping_vseg_t)
    36 #define MAPPING_VOBJ_SIZE           sizeof(mapping_vobj_t)
    37 #define MAPPING_PSEG_SIZE           sizeof(mapping_pseg_t)
    38 #define MAPPING_TASK_SIZE           sizeof(mapping_task_t)
    39 #define MAPPING_PROC_SIZE           sizeof(mapping_proc_t)
    40 #define MAPPING_IRQ_SIZE            sizeof(mapping_irq_t)
    41 #define MAPPING_COPROC_SIZE         sizeof(mapping_coproc_t)
    42 #define MAPPING_CP_PORT_SIZE    sizeof(mapping_cp_port_t)
    43 
    44 #define C_MODE_MASK     0b1000      // cacheable
    45 #define X_MODE_MASK     0b0100      // executable
    46 #define W_MODE_MASK     0b0010      // writable
    47 #define U_MODE_MASK     0b0001      // user access
     32#define MAPPING_HEADER_SIZE   sizeof(mapping_header_t)
     33#define MAPPING_CLUSTER_SIZE  sizeof(mapping_cluster_t)
     34#define MAPPING_VSPACE_SIZE   sizeof(mapping_vspace_t)
     35#define MAPPING_VSEG_SIZE     sizeof(mapping_vseg_t)
     36#define MAPPING_VOBJ_SIZE     sizeof(mapping_vobj_t)
     37#define MAPPING_PSEG_SIZE     sizeof(mapping_pseg_t)
     38#define MAPPING_TASK_SIZE     sizeof(mapping_task_t)
     39#define MAPPING_PROC_SIZE     sizeof(mapping_proc_t)
     40#define MAPPING_IRQ_SIZE      sizeof(mapping_irq_t)
     41#define MAPPING_COPROC_SIZE   sizeof(mapping_coproc_t)
     42#define MAPPING_CP_PORT_SIZE  sizeof(mapping_cp_port_t)
     43
     44#define C_MODE_MASK  0b1000 // cacheable
     45#define X_MODE_MASK  0b0100 // executable
     46#define W_MODE_MASK  0b0010 // writable
     47#define U_MODE_MASK  0b0001 // user access
    4848
    4949#define IN_MAPPING_SIGNATURE    0xDEADBEEF
    5050#define OUT_MAPPING_SIGNATURE   0xBABEF00D
    5151
    52 enum vobjType
    53 {
    54     VOBJ_TYPE_ELF     = 0,     // loadable code/data object of elf files
    55     VOBJ_TYPE_BLOB    = 1,     // loadable blob object
    56     VOBJ_TYPE_PTAB    = 2,     // page table
    57     VOBJ_TYPE_PERI    = 3,     // hardware component
    58     VOBJ_TYPE_MWMR    = 4,     // MWMR channel
    59     VOBJ_TYPE_LOCK    = 5,     // Lock
    60     VOBJ_TYPE_BUFFER  = 6,     // Any "no intialiasation needed" objects (stacks...)
    61     VOBJ_TYPE_BARRIER = 7,     // Barrier
    62 };
    63 
    64 enum psegType
    65 {
    66     PSEG_TYPE_RAM     = 0,
    67     PSEG_TYPE_ROM     = 1,
    68     PSEG_TYPE_PERI    = 2,
    69 };
    70 
    71 enum periphType
    72 {
    73     PERIPH_TYPE_ICU   = 0,
    74     PERIPH_TYPE_TIM   = 1,
    75     PERIPH_TYPE_XICU  = 2,
    76     PERIPH_TYPE_DMA   = 3,
    77     PERIPH_TYPE_IOC   = 4,
    78     PERIPH_TYPE_TTY   = 5,
    79     PERIPH_TYPE_FBF   = 6,
    80     PERIPH_TYPE_NIC   = 7,
    81     PERIPH_TYPE_IOB   = 8,
    82 };
    83 
    84 enum mwmrPortDirection
    85 {
    86     PORT_TO_COPROC    = 0,          // status register
    87     PORT_FROM_COPROC  = 1,          // config register
    88 };
    89 
    90 ///////////////////////////////
    91 
    92 typedef struct mapping_header_s
    93 {
    94     unsigned int    signature;      // must contain MAPPING_SIGNATURE
    95         unsigned int    clusters;           // number of clusters
    96         unsigned int    cluster_x;          // number of cluster on the abcsisse axe
    97         unsigned int    cluster_y;          // number of cluster on the ordinate axe
    98         unsigned int    globals;                // number of vsegs mapped in all vspaces
    99         unsigned int    vspaces;                // number of virtual spaces
    100 
    101     unsigned int    tty_clusterid;  // index of cluster containing TTY controler
    102     unsigned int    ioc_clusterid;  // index of cluster containing IOC controler
    103     unsigned int    nic_clusterid;  // index of cluster containing NIC controler
    104     unsigned int    fbf_clusterid;  // index of cluster containing FBF controler
    105 
    106     unsigned int    psegs;          // total number of physical segments (for all clusters)
    107         unsigned int    vsegs;                  // total number of virtual segments (for all vspaces)
    108         unsigned int    vobjs;                  // total number of virtual objects (for all vspaces)
    109         unsigned int    tasks;                  // total number of tasks (for all vspaces)
    110         unsigned int    procs;                  // total number of procs (for all clusters)
    111         unsigned int    irqs;           // total number of irqs (for all processors)
    112         unsigned int    coprocs;                // total number of coprocs (for all clusters)
    113         unsigned int    cp_ports;               // total number of cp_ports (for all coprocs)
    114     unsigned int    periphs;        // total number of peripherals (for all clusters)
    115 
    116     char            name[32];       // mapping name
     52enum vobjType {
     53    VOBJ_TYPE_ELF      = 0, // loadable code/data object of elf files
     54    VOBJ_TYPE_BLOB     = 1, // loadable blob object
     55    VOBJ_TYPE_PTAB     = 2, // page table
     56    VOBJ_TYPE_PERI     = 3, // hardware component
     57    VOBJ_TYPE_MWMR     = 4, // MWMR channel
     58    VOBJ_TYPE_LOCK     = 5, // Lock
     59    VOBJ_TYPE_BUFFER   = 6, // Any "no initialization needed" objects (stacks...)
     60    VOBJ_TYPE_BARRIER  = 7, // Barrier
     61    VOBJ_TYPE_CONST    = 8, // Constant
     62    VOBJ_TYPE_MEMSPACE = 9, // Memspace; different from buffer because we add infos at the beginning
     63};
     64
     65
     66enum psegType {
     67    PSEG_TYPE_RAM  = 0,
     68    PSEG_TYPE_ROM  = 1,
     69    PSEG_TYPE_PERI = 2,
     70};
     71
     72
     73enum periphType {
     74    PERIPH_TYPE_ICU  = 0,
     75    PERIPH_TYPE_TIM  = 1,
     76    PERIPH_TYPE_XICU = 2,
     77    PERIPH_TYPE_DMA  = 3,
     78    PERIPH_TYPE_IOC  = 4,
     79    PERIPH_TYPE_TTY  = 5,
     80    PERIPH_TYPE_FBF  = 6,
     81    PERIPH_TYPE_NIC  = 7,
     82    PERIPH_TYPE_IOB  = 8,
     83};
     84
     85
     86enum mwmrPortDirection {
     87    PORT_TO_COPROC   = 0, // status register
     88    PORT_FROM_COPROC = 1, // config register
     89};
     90
     91
     92///////////////////////////////
     93
     94typedef struct mapping_header_s {
     95    unsigned int signature;      // must contain MAPPING_SIGNATURE
     96    unsigned int clusters;       // number of clusters
     97    unsigned int cluster_x;      // number of cluster on the abcsisse axe
     98    unsigned int cluster_y;      // number of cluster on the ordinate axe
     99    unsigned int globals;        // number of vsegs mapped in all vspaces
     100    unsigned int vspaces;        // number of virtual spaces
     101
     102    unsigned int tty_clusterid;  // index of cluster containing TTY controler
     103    unsigned int ioc_clusterid;  // index of cluster containing IOC controler
     104    unsigned int nic_clusterid;  // index of cluster containing NIC controler
     105    unsigned int fbf_clusterid;  // index of cluster containing FBF controler
     106
     107    unsigned int psegs;          // total number of physical segments (for all clusters)
     108    unsigned int vsegs;          // total number of virtual segments (for all vspaces)
     109    unsigned int vobjs;          // total number of virtual objects (for all vspaces)
     110    unsigned int tasks;          // total number of tasks (for all vspaces)
     111    unsigned int procs;          // total number of procs (for all clusters)
     112    unsigned int irqs;           // total number of irqs (for all processors)
     113    unsigned int coprocs;        // total number of coprocs (for all clusters)
     114    unsigned int cp_ports;       // total number of cp_ports (for all coprocs)
     115    unsigned int periphs;        // total number of peripherals (for all clusters)
     116
     117    char name[32];    // mapping name
    117118} mapping_header_t;
    118119
     120
    119121////////////////////////////////
    120 typedef struct mapping_cluster_s
    121 {
    122     unsigned int    psegs;          // number of psegs in cluster
    123     unsigned int    pseg_offset;    // index of first pseg in pseg set
    124 
    125     unsigned int    procs;          // number of processors in cluster
    126     unsigned int    proc_offset;    // index of first proc in proc set
    127 
    128     unsigned int    coprocs;        // number of coprocessors in cluster
    129     unsigned int    coproc_offset;  // index of first coproc in coproc set
    130 
    131     unsigned int    periphs;        // number of peripherals in cluster
    132     unsigned int    periph_offset;  // index of first coproc in coproc set
     122typedef struct mapping_cluster_s {
     123    unsigned int psegs;          // number of psegs in cluster
     124    unsigned int pseg_offset;    // index of first pseg in pseg set
     125
     126    unsigned int procs;          // number of processors in cluster
     127    unsigned int proc_offset;    // index of first proc in proc set
     128
     129    unsigned int coprocs;        // number of coprocessors in cluster
     130    unsigned int coproc_offset;  // index of first coproc in coproc set
     131
     132    unsigned int periphs;        // number of peripherals in cluster
     133    unsigned int periph_offset;  // index of first coproc in coproc set
    133134} mapping_cluster_t;
    134135
    135 /////////////////////////////
    136 typedef struct mapping_pseg_s
    137 {
    138     char            name[32];       // pseg name (unique in a cluster)
    139         unsigned int    base;           // base address in physical space
    140         unsigned int    length;         // size (bytes)
    141     unsigned int    type;           // RAM / ROM / PERI
    142     unsigned int    cluster;        // index of cluster containing pseg
    143     unsigned int    next_base;      // first free page base address
     136
     137/////////////////////////////
     138typedef struct mapping_pseg_s  {
     139    char name[32];               // pseg name (unique in a cluster)
     140    unsigned int base;           // base address in physical space
     141    unsigned int length;         // size (bytes)
     142    unsigned int type;           // RAM / ROM / PERI
     143    unsigned int cluster;        // index of cluster containing pseg
     144    unsigned int next_base;      // first free page base address
    144145} mapping_pseg_t;
    145146
    146 ///////////////////////////////
    147 typedef struct mapping_vspace_s
    148 {
    149     char            name[32];       // virtual space name
    150     unsigned int    start_offset;   // offset of the vobj containing the start vector
    151         unsigned int    vsegs;              // number of vsegs in vspace
    152         unsigned int    vobjs;              // number of vobjs in vspace
    153         unsigned int    tasks;              // number of tasks in vspace
    154     unsigned int    vseg_offset;    // index of first vseg in vspace
    155     unsigned int    vobj_offset;    // index of first vobjs in vspace
    156     unsigned int    task_offset;    // index of first task in vspace
     147
     148///////////////////////////////
     149typedef struct mapping_vspace_s {
     150    char name[32];               // virtual space name
     151    unsigned int start_offset;   // offset of the vobj containing the start vector
     152    unsigned int vsegs;          // number of vsegs in vspace
     153    unsigned int vobjs;          // number of vobjs in vspace
     154    unsigned int tasks;          // number of tasks in vspace
     155    unsigned int vseg_offset;    // index of first vseg in vspace
     156    unsigned int vobj_offset;    // index of first vobjs in vspace
     157    unsigned int task_offset;    // index of first task in vspace
    157158} mapping_vspace_t;
    158159
    159 /////////////////////////////
    160 typedef struct mapping_vseg_s
    161 {
    162         char            name[32];       // vseg name (unique in vspace)
    163         unsigned int    vbase;          // base address in virtual space (hexa)
    164         unsigned int    pbase;          // base address in physical space (hexa)
    165         unsigned int    length;         // size (bytes)
    166         unsigned int    psegid;         // physical segment global index
    167         unsigned int    mode;           // C-X-W-U flags
    168     unsigned int    ident;          // identity mapping if non zero
    169         unsigned int    vobjs;              // number of vobjs in vseg
    170     unsigned int    vobj_offset;    // index of first vobjs in vseg
     160
     161/////////////////////////////
     162typedef struct mapping_vseg_s {
     163    char name[32];               // vseg name (unique in vspace)
     164    unsigned int vbase;          // base address in virtual space (hexa)
     165    unsigned int pbase;          // base address in physical space (hexa)
     166    unsigned int length;         // size (bytes)
     167    unsigned int psegid;         // physical segment global index
     168    unsigned int mode;           // C-X-W-U flags
     169    unsigned int ident;          // identity mapping if non zero
     170    unsigned int vobjs;          // number of vobjs in vseg
     171    unsigned int vobj_offset;    // index of first vobjs in vseg
    171172} mapping_vseg_t;
    172173
    173 /////////////////////////////
    174 typedef struct mapping_task_s
    175 {
    176         char            name[32];       // task name (unique in vspace)
    177         unsigned int    clusterid;          // physical cluster index
    178         unsigned int    proclocid;      // processor local index (inside cluster)
    179     unsigned int    vobjlocid;      // stack vobj index in vspace
    180     unsigned int    startid;        // index in start_vector
    181     unsigned int    use_tty;        // TTY terminal required (global)
    182     unsigned int    use_nic;        // NIC channel required (global)
    183     unsigned int    use_timer;      // user timer required (local)
    184     unsigned int    use_fbdma;      // DMA channel to frame buffer required (local)
     174
     175/////////////////////////////
     176typedef struct mapping_task_s {
     177    char name[32];               // task name (unique in vspace)
     178    unsigned int clusterid;      // physical cluster index
     179    unsigned int proclocid;      // processor local index (inside cluster)
     180    unsigned int vobjlocid;      // stack vobj index in vspace
     181    unsigned int startid;        // index in start_vector
     182    unsigned int use_tty;        // TTY terminal required (global)
     183    unsigned int use_nic;        // NIC channel required (global)
     184    unsigned int use_timer;      // user timer required (local)
     185    unsigned int use_fbdma;      // DMA channel to frame buffer required (local)
    185186} mapping_task_t;
    186187
    187 /////////////////////////////
    188 typedef struct mapping_vobj_s
    189 {
    190     char            name[32];       // vobj name (unique in a vspace)
    191     char            binpath[64];    // path for the binary code ("*.elf")
    192         unsigned int    type;           // type of vobj
    193         unsigned int    length;         // size (bytes)
    194         unsigned int    align;          // required alignement (logarithm of 2)
    195         unsigned int    vaddr;          // virtual base addresse of the vobj
    196         unsigned int    paddr;          // physical base addresse of the vobj
    197         unsigned int    init;           // init value (used by barrier or mwmr channel)
     188
     189/////////////////////////////
     190typedef struct mapping_vobj_s {
     191    char name[32];               // vobj name (unique in a vspace)
     192    char binpath[64];            // path for the binary code ("*.elf")
     193    unsigned int type;           // type of vobj
     194    unsigned int length;         // size (bytes)
     195    unsigned int align;          // required alignement (logarithm of 2)
     196    unsigned int vaddr;          // virtual base addresse of the vobj
     197    unsigned int paddr;          // physical base addresse of the vobj
     198    unsigned int init;           // init value (used by barrier or mwmr channel)
    198199} mapping_vobj_t;
    199200
    200 /////////////////////////////
    201 typedef struct mapping_proc_s
    202 {
    203     unsigned int    irqs;           // number of IRQs allocated to processor
    204     unsigned int    irq_offset;     // index of first IRQ allocated to processor
     201
     202/////////////////////////////
     203typedef struct mapping_proc_s {
     204    unsigned int irqs;           // number of IRQs allocated to processor
     205    unsigned int irq_offset;     // index of first IRQ allocated to processor
    205206} mapping_proc_t;
    206207
    207 /////////////////////////////
    208 typedef struct mapping_irq_s
    209 {
    210     unsigned int    type;           // 0 => HW_IRQ  / 1 => SW_IRQ
    211     unsigned int    icuid;          // IRQ Index for the ICU component
    212     unsigned int    isr;            // Interrupt Service Routine Index
    213     unsigned int    channel;        // Channel Index (for multi-cannels peripherals)
     208
     209/////////////////////////////
     210typedef struct mapping_irq_s {
     211    unsigned int type;           // 0 => HW_IRQ  / 1 => SW_IRQ
     212    unsigned int icuid;          // IRQ Index for the ICU component
     213    unsigned int isr;            // Interrupt Service Routine Index
     214    unsigned int channel;        // Channel Index (for multi-cannels peripherals)
    214215} mapping_irq_t;
    215216
    216 ///////////////////////////////
    217 typedef struct mapping_coproc_s
    218 {
    219     char            name[32];       // coprocessor name
    220     unsigned int    psegid;         // global pseg index
    221     unsigned int    ports;          // number of MWMR ports used by coprocessor
    222     unsigned int    port_offset;    // index of first MWMR port used by coprocessor
     217
     218///////////////////////////////
     219typedef struct mapping_coproc_s {
     220    char name[32];               // coprocessor name
     221    unsigned int psegid;         // global pseg index
     222    unsigned int ports;          // number of MWMR ports used by coprocessor
     223    unsigned int port_offset;    // index of first MWMR port used by coprocessor
    223224} mapping_coproc_t;
    224225
     226
    225227////////////////////////////////
    226 typedef struct mapping_cp_port_s
    227 {
    228     unsigned int    direction;      // TO_COPROC == 0 / FROM_COPROC == 1
    229     unsigned int    vspaceid;       // index of the vspace containing the MWMR channel
    230     unsigned int    vobjlocid;      // local index of the vobj containing the MWMR channel
     228typedef struct mapping_cp_port_s {
     229    unsigned int direction;      // TO_COPROC == 0 / FROM_COPROC == 1
     230    unsigned int vspaceid;       // index of the vspace containing the MWMR channel
     231    unsigned int vobjlocid;      // local index of the vobj containing the MWMR channel
    231232} mapping_cp_port_t;
    232233
    233 ///////////////////////////////
    234 typedef struct mapping_periph_s
    235 {
    236     unsigned int    type;           // IOC / TTY / TIM / DMA / FBF / NIC / IOB
    237     unsigned int    psegid;         // pseg index in cluster
    238     unsigned int    channels;       // number of channels
     234
     235///////////////////////////////
     236typedef struct mapping_periph_s {
     237    unsigned int type;           // IOC / TTY / TIM / DMA / FBF / NIC / IOB
     238    unsigned int psegid;         // pseg index in cluster
     239    unsigned int channels;       // number of channels
    239240} mapping_periph_t;
    240241
     
    249250// End:
    250251
    251 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
    252 
     252// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
     253
Note: See TracChangeset for help on using the changeset viewer.