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

Last change on this file since 238 was 238, checked in by alain, 11 years ago

Major evolution to support physical addresses larger than 32 bits.
The map.xml format has been modified: the vsegs associated to schedulers
are now explicitely defined and mapped in the page tables.

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