source: soft/giet_vm/xml/mapping_info.h @ 172

Last change on this file since 172 was 167, checked in by alain, 12 years ago

Fix several bugs to use the vci_block_device with MMU activated

File size: 6.9 KB
RevLine 
[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
[160]57enum 
58{
[165]59    VOBJ_TYPE_ELF     = 0,     // loadable code object
60    VOBJ_TYPE_PTAB    = 1,     // page table
61    VOBJ_TYPE_PERI    = 2,     // hardware component
62    VOBJ_TYPE_MWMR    = 3,     // MWMR channel
63    VOBJ_TYPE_LOCK    = 4,     // Lock
64    VOBJ_TYPE_BUFFER  = 5,     // Any "no intialiasation needed" objects (stacks...)
65    VOBJ_TYPE_BARRIER = 6,     // Barrier
[160]66};
67
68
[158]69///////////////////////////////
70typedef struct mapping_header_s
71{
72    unsigned int    signature;      // must contain MAPPING_SIGNATURE
73        unsigned int    clusters;           // number of clusters
74        unsigned int    psegs;          // number of psegs
75    unsigned int    ttys;           // number of TTY terminals
[165]76    unsigned int    fbs;            // number of Frame Buffer DMA channels
[158]77        unsigned int    globals;                // number of vsegs mapped in all vspaces
78        unsigned int    vspaces;                // number of virtual spaces
[160]79        unsigned int    vsegs;                  // total number of virtual segments (for all vspaces)
[165]80        unsigned int    vobjs;                  // total number of virtual objects (for all vspaces)
[158]81        unsigned int    tasks;                  // total number of tasks (for all vspaces)
82    char            name[32];       // mapping name
83} mapping_header_t;
84
85////////////////////////////////
86typedef struct mapping_cluster_s
87{
88    unsigned int    procs;          // number of processors in cluster
89} mapping_cluster_t;
90
91/////////////////////////////
92typedef struct mapping_pseg_s
93{
94    char            name[32];       // pseg name (unique in a cluster)
95        unsigned int    base;           // base address in physical space
96        unsigned int    length;         // size (bytes)
[167]97    unsigned int    next_base;      // first free page base address
[158]98} mapping_pseg_t;
99
100///////////////////////////////
101typedef struct mapping_vspace_s
102{
103    char            name[32];       // virtual space name
[165]104    unsigned int    start_offset;   // offset of the vobj containing the start vector
105        unsigned int    vsegs;              // number of vsegs in vspace
106        unsigned int    vobjs;              // number of vobjs in vspace
107        unsigned int    tasks;              // number of tasks in vspace
[158]108    unsigned int    vseg_offset;    // index of first vseg in vspace
[160]109    unsigned int    vobj_offset;    // index of first vobjs in vspace
[158]110    unsigned int    task_offset;    // index of first task in vspace
111} mapping_vspace_t;
112
113/////////////////////////////
114typedef struct mapping_vseg_s
115{
116        char            name[32];       // vseg name (unique in vspace)
117        unsigned int    vbase;          // base address in virtual space (hexa)
118        unsigned int    pbase;          // base address in physical space (hexa)
119        unsigned int    length;         // size (bytes)
120        unsigned int    psegid;         // physical segment index
[165]121        unsigned int    mode;           // C-X-W-U flags
122    unsigned int    ident;          // identity mapping if non zero
123        unsigned int    vobjs;              // number of vobjs in vseg
124    unsigned int    vobj_offset;    // index of first vobjs in vseg
[158]125} mapping_vseg_t;
126
127/////////////////////////////
128typedef struct mapping_task_s
129{
130        char            name[32];       // task name (unique in vspace)
131        unsigned int    clusterid;          // physical cluster index
132        unsigned int    proclocid;      // processor local index (inside cluster)
[160]133    unsigned int    vobjlocid;      // stack vobj index in vspace
[165]134    unsigned int    startid;        // index in start_vector
135    unsigned int    use_tty;        // TTY terminal required
136    unsigned int    use_fb;         // DMA channel to frame buffer required
[158]137} mapping_task_t;
138
[160]139/////////////////////////////
140typedef struct mapping_vobj_s
141{
142    char            name[32];       // vobj name (unique in a vspace)
[165]143    char            binpath[64];    // path for the binary code ("*.elf")
[160]144        unsigned int    type;           // type of vobj
145        unsigned int    length;         // size (bytes)
146        unsigned int    align;          // required alignement (logarithm of 2)
[165]147        unsigned int    vaddr;          // virtual base addresse of the vobj
148        unsigned int    paddr;          // physical base addresse of the vobj
149        unsigned int    init;           // init value (number of participants for a barrier)
[160]150} mapping_vobj_t;
151
[158]152#endif
153
154// Local Variables:
155// tab-width: 4
156// c-basic-offset: 4
157// c-file-offsets:((innamespace . 0)(inline-open . 0))
158// indent-tabs-mode: nil
159// End:
160
161// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
162
Note: See TracBrowser for help on using the repository browser.