source: soft/giet_vm/giet_xml/mapping_info.h @ 559

Last change on this file since 559 was 559, checked in by alain, 9 years ago

Introducing support for MWMR coprocessors.

  • Property svn:executable set to *
File size: 10.7 KB
Line 
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, 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).
11// The number of processors per cluster is variable (can be zero).
12// The number of peripherals per cluster is variable (can be zero),
13// The number of physical memory bank 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). Each vspace contains a variable number
18// of virtual segments (called vsegs).
19//
20// 3/ the mapping directives: both tasks on processors, and software objects
21// (vsegs) on the physical memory banks (psegs).
22//
23// The mapping_info data structure is organised as the concatenation of
24// a fixed size header, and 8 variable size arrays:
25//
26// - mapping_cluster_t  cluster[] 
27// - mapping_pseg_t     pseg[]       
28// - mapping_vspace_t   vspace[] 
29// - mapping_vseg_t     vseg[]     
30// - mapping_task_t     task[] 
31// - mapping_proc_t     proc[] 
32// - mapping_irq_t      irq[]   
33// - mapping_periph_t   periph[]
34//
35// It is intended to be stored in memory in the seg_boot_mapping segment.
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)
45#define MAPPING_PSEG_SIZE     sizeof(mapping_pseg_t)
46#define MAPPING_TASK_SIZE     sizeof(mapping_task_t)
47#define MAPPING_PROC_SIZE     sizeof(mapping_proc_t)
48#define MAPPING_IRQ_SIZE      sizeof(mapping_irq_t)
49#define MAPPING_PERIPH_SIZE   sizeof(mapping_periph_t)
50
51#define C_MODE_MASK  0b1000   // cacheable
52#define X_MODE_MASK  0b0100   // executable
53#define W_MODE_MASK  0b0010   // writable
54#define U_MODE_MASK  0b0001   // user access
55
56#define IN_MAPPING_SIGNATURE    0xDACE2014
57#define OUT_MAPPING_SIGNATURE   0xBABEF00D
58
59typedef unsigned long long  paddr_t;
60
61enum vsegType
62{
63    VSEG_TYPE_ELF      = 0,  // loadable code/data object of elf files
64    VSEG_TYPE_BLOB     = 1,  // loadable blob object
65    VSEG_TYPE_PTAB     = 2,  // page table
66    VSEG_TYPE_PERI     = 3,  // hardware component
67    VSEG_TYPE_BUFFER   = 4,  // no initialization object (stacks...)
68    VSEG_TYPE_SCHED    = 5,  // scheduler
69    VSEG_TYPE_HEAP     = 6,  // heap
70};
71
72enum irqType
73{
74    IRQ_TYPE_HWI = 0,        // HARD in map.xml file
75    IRQ_TYPE_WTI = 1,        // SOFT in map.xml file,
76    IRQ_TYPE_PTI = 2,        // TIME in map.xml file,
77};
78
79
80enum psegType
81{
82    PSEG_TYPE_RAM  = 0,
83    PSEG_TYPE_PERI = 2,
84};
85
86
87////////////////////////////////////////////////////////////////////
88// These enum must be coherent with the values in
89// xml_driver.c / xml_parser.c / mapping.py
90///////////////////////////////////////////////////////////////////
91enum periphTypes
92{
93    PERIPH_TYPE_CMA       = 0,
94    PERIPH_TYPE_DMA       = 1,
95    PERIPH_TYPE_FBF       = 2,
96    PERIPH_TYPE_IOB       = 3,
97    PERIPH_TYPE_IOC       = 4,
98    PERIPH_TYPE_MMC       = 5,
99    PERIPH_TYPE_MWR       = 6,
100    PERIPH_TYPE_NIC       = 7,
101    PERIPH_TYPE_ROM       = 8,
102    PERIPH_TYPE_SIM       = 9,
103    PERIPH_TYPE_TIM       = 10,
104    PERIPH_TYPE_TTY       = 11,
105    PERIPH_TYPE_XCU       = 12,
106    PERIPH_TYPE_PIC       = 13,
107    PERIPH_TYPE_DROM      = 14,
108
109    PERIPH_TYPE_MAX_VALUE = 15,
110};
111
112enum iocTypes
113{
114    IOC_SUBTYPE_BDV    = 0,
115    IOC_SUBTYPE_HBA    = 1,
116    IOC_SUBTYPE_SDC    = 2,
117};
118
119enum mwrTypes
120{
121    MWR_SUBTYPE_GCD       = 0,
122    MWR_SUBTYPE_DCT       = 1,
123    MWR_SUBTYPE_CPY       = 2,
124};
125
126//////////////////////////////////////////////////////////
127// This enum must be coherent with the values in
128// mwr_driver.h               
129//////////////////////////////////////////////////////////
130enum MwmrDmaModes
131{
132    MODE_MWMR             = 0,
133    MODE_DMA_IRQ          = 1,
134    MODE_DMA_NO_IRQ       = 2,
135};
136
137////////////////////////////////////////////////////////
138typedef struct __attribute__((packed))  mapping_header_s
139{
140    unsigned int signature;          // must contain IN_MAPPING_SIGNATURE
141    unsigned int x_size;             // actual number of clusters in a row
142    unsigned int y_size;             // actual number of clusters in a column
143    unsigned int x_width;            // number of bits to encode x coordinate
144    unsigned int y_width;            // number of bits to encode y coordinate
145    unsigned int x_io;               // x coordinate for cluster_io_ext
146    unsigned int y_io;               // y coordinate for cluster_io_ext
147    unsigned int irq_per_proc;       // number of IRQ per processor
148    unsigned int use_ram_disk;       // does not use IOC peripheral if non zero
149    unsigned int globals;            // total number of global vsegs
150    unsigned int vspaces;            // total number of virtual spaces
151    unsigned int psegs;              // total number of physical segments
152    unsigned int vsegs;              // total number of virtual segments
153    unsigned int tasks;              // total number of tasks
154    unsigned int procs;              // total number of processors
155    unsigned int irqs;               // total number of irqs
156    unsigned int periphs;            // total number of peripherals
157    char name[64];                   // mapping name
158} mapping_header_t;
159
160
161/////////////////////////////////////////////////////////
162typedef struct __attribute__((packed))  mapping_cluster_s
163{
164    unsigned int    x;               // x coordinate
165    unsigned int    y;               // y coordinate
166
167    unsigned int    psegs;           // number of psegs in cluster
168    unsigned int    pseg_offset;     // global index of first pseg in cluster
169
170    unsigned int    procs;           // number of processors in cluster
171    unsigned int    proc_offset;     // global index of first proc in cluster
172 
173    unsigned int    periphs;         // number of peripherals in cluster
174    unsigned int    periph_offset;   // global index of first coproc in cluster
175} mapping_cluster_t;
176
177
178////////////////////////////////////////////////////////
179typedef struct __attribute__((packed))  mapping_vspace_s
180{
181    char            name[32];        // virtual space name
182    unsigned int    start_vseg_id;   // vseg containing start vector index
183    unsigned int    vsegs;           // number of vsegs in vspace
184    unsigned int    tasks;           // number of tasks in vspace
185    unsigned int    vseg_offset;     // global index of first vseg in vspace
186    unsigned int    task_offset;     // global index of first task in vspace
187} mapping_vspace_t;
188
189
190//////////////////////////////////////////////////////
191typedef struct __attribute__((packed))  mapping_vseg_s
192{
193    char            name[32];        // vseg name (unique in vspace)
194    char            binpath[64];     // path for the binary code (if required)
195    unsigned int    vbase;           // base address in virtual space
196    paddr_t         pbase;           // base address in physical space
197    unsigned int    length;          // size (bytes)
198    unsigned int    psegid;          // physical segment global index
199    unsigned int    mode;            // C-X-W-U flags
200    unsigned int    type;            // vseg type
201    char            mapped;          // mapped if non zero
202    char            ident;           // identity mapping if non zero
203    char            local;           // only mapped in the local PTAB
204    char            big;             // to be mapped in a big physical page
205} mapping_vseg_t;
206
207
208//////////////////////////////////////////////////////
209typedef struct __attribute__((packed))  mapping_pseg_s 
210{
211    char            name[32];        // pseg name (unique in a cluster)
212    paddr_t         base;            // base address in physical space
213    paddr_t         length;          // size (bytes)
214    unsigned int    type;            // RAM / PERI
215    unsigned int    clusterid;       // global index in clusters set
216    unsigned int    next_vseg;       // linked list of vsegs mapped on pseg
217} mapping_pseg_t;
218
219
220//////////////////////////////////////////////////////
221typedef struct __attribute__((packed))  mapping_task_s
222{
223    char            name[32];        // task name (unique in vspace)
224    unsigned int    clusterid;       // global index in clusters set
225    unsigned int    proclocid;       // processor local index (inside cluster)
226    unsigned int    trdid;           // thread index in vspace
227    unsigned int    stack_vseg_id;   // global index for vseg containing stack
228    unsigned int    heap_vseg_id;    // global index for vseg containing heap
229    unsigned int    startid;         // index in start_vector
230} mapping_task_t;
231
232
233//////////////////////////////////////////////////////
234typedef struct __attribute__((packed))  mapping_proc_s
235{
236    unsigned int    index;           // processor local index (in cluster)
237} mapping_proc_t;
238
239
240////////////////////////////////////////////////////////
241typedef struct __attribute__((packed))  mapping_periph_s
242{
243    unsigned int    type;            // legal values defined above
244    unsigned int    subtype;         // periph specialization
245    unsigned int    psegid;          // pseg index in cluster
246    unsigned int    channels;        // number of channels
247    unsigned int    arg0;            // semantic depends on peripheral type
248    unsigned int    arg1;            // semantic depends on peripheral type
249    unsigned int    arg2;            // semantic depends on peripheral type
250    unsigned int    arg3;            // semantic depends on peripheral type
251    unsigned int    irqs;            // number of input IRQs (for XCU or PIC)
252    unsigned int    irq_offset;      // index of first IRQ
253} mapping_periph_t;
254
255
256/////////////////////////////////////////////////////
257typedef struct __attribute__((packed))  mapping_irq_s
258{
259    unsigned int    srctype;         // source IRQ type (HWI / WTI / PTI)
260    unsigned int    srcid;           // source IRQ index (for XCU/PIC)
261    unsigned int    isr;             // ISR type (defined in irq_handler.h)
262    unsigned int    channel;         // channel index (for multi-channels ISR)
263    unsigned int    dest_xy;         // destination cluster (set by GIET_VM)
264    unsigned int    dest_id;         // destination port (set by GIET_VM)
265} mapping_irq_t; 
266
267
268#endif
269
270// Local Variables:
271// tab-width: 4
272// c-basic-offset: 4
273// c-file-offsets:((innamespace . 0)(inline-open . 0))
274// indent-tabs-mode: nil
275// End:
276
277// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
278
Note: See TracBrowser for help on using the repository browser.