L4Re - L4 Runtime Environment
sigma0.h
Go to the documentation of this file.
1 
6 /*
7  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
8  * Alexander Warg <warg@os.inf.tu-dresden.de>,
9  * Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
10  * economic rights: Technische Universit├Ąt Dresden (Germany)
11  * This file is part of TUD:OS and distributed under the terms of the
12  * GNU Lesser General Public License 2.1.
13  * Please see the COPYING-LGPL-2.1 file for details.
14  */
15 #ifndef __L4_SIGMA0_SIGMA0_H
16 #define __L4_SIGMA0_SIGMA0_H
17 
26 #include <l4/sys/compiler.h>
27 #include <l4/sys/types.h>
28 #include <l4/sys/kip.h>
29 
36 #undef SIGMA0_REQ_MAGIC
37 #undef SIGMA0_REQ_MASK
38 
39 # define SIGMA0_REQ_MAGIC ~0xFFUL
40 # define SIGMA0_REQ_MASK ~0xFFUL
42 /* Starting with 0x60 allows to detect components which still use the old
43  * constants (0x00 ... 0x50) */
44 #define SIGMA0_REQ_ID_MASK 0xF0
45 #define SIGMA0_REQ_ID_FPAGE_RAM 0x60
46 #define SIGMA0_REQ_ID_FPAGE_IOMEM 0x70
47 #define SIGMA0_REQ_ID_FPAGE_IOMEM_CACHED 0x80
48 #define SIGMA0_REQ_ID_FPAGE_ANY 0x90
49 #define SIGMA0_REQ_ID_KIP 0xA0
50 #define SIGMA0_REQ_ID_TBUF 0xB0
51 #define SIGMA0_REQ_ID_DEBUG_DUMP 0xC0
52 #define SIGMA0_REQ_ID_NEW_CLIENT 0xD0
54 #define SIGMA0_IS_MAGIC_REQ(d1) \
55  ((d1 & SIGMA0_REQ_MASK) == SIGMA0_REQ_MAGIC)
57 #define SIGMA0_REQ(x) \
58  (SIGMA0_REQ_MAGIC + SIGMA0_REQ_ID_ ## x)
60 /* Use these constants in your code! */
61 #define SIGMA0_REQ_FPAGE_RAM (SIGMA0_REQ(FPAGE_RAM))
62 #define SIGMA0_REQ_FPAGE_IOMEM (SIGMA0_REQ(FPAGE_IOMEM))
63 #define SIGMA0_REQ_FPAGE_IOMEM_CACHED (SIGMA0_REQ(FPAGE_IOMEM_CACHED))
64 #define SIGMA0_REQ_FPAGE_ANY (SIGMA0_REQ(FPAGE_ANY))
65 #define SIGMA0_REQ_KIP (SIGMA0_REQ(KIP))
66 #define SIGMA0_REQ_TBUF (SIGMA0_REQ(TBUF))
67 #define SIGMA0_REQ_DEBUG_DUMP (SIGMA0_REQ(DEBUG_DUMP))
68 #define SIGMA0_REQ_NEW_CLIENT (SIGMA0_REQ(NEW_CLIENT))
70 
71 
75 
80  L4SIGMA0_OK,
84  L4SIGMA0_4,
85  L4SIGMA0_5,
87 };
88 
90 
100 l4sigma0_map_kip(l4_cap_idx_t sigma0, void *addr, unsigned log2_size);
101 
116  l4_addr_t phys, l4_addr_t virt, l4_addr_t size);
117 
142  l4_addr_t virt, l4_addr_t size, int cached);
163 L4_CV int l4sigma0_map_anypage(l4_cap_idx_t sigma0, l4_addr_t map_area,
164  unsigned log2_map_size, l4_addr_t *base,
165  unsigned sz);
166 
180 
190 
197 
204 L4_INLINE char const *l4sigma0_map_errstr(int err);
205 
209 /* Implementations */
210 
211 L4_INLINE char const *l4sigma0_map_errstr(int err)
212 {
213  switch (err)
214  {
215  case 0: return "No error";
216  case -1: return "Phys, virt or size not aligned";
217  case -2: return "IPC error";
218  case -3: return "No fpage received";
219 #ifndef SIGMA0_REQ_MAGIC
220  case -4: return "Bad physical address (old protocol only)";
221 #endif
222  case -6: return "Superpage requested but smaller flexpage received";
223  case -7: return "Cannot map I/O memory cacheable (old protocol only)";
224  default: return "Unknown error";
225  }
226 }
227 
228 
230 
231 #endif /* ! __L4_SIGMA0_SIGMA0_H */
Phys, virt or size not aligned.
Definition: sigma0.h:83
char const * l4sigma0_map_errstr(int err)
Get a user readable error messages for the return codes.
Definition: sigma0.h:213
Common L4 ABI Data Types.
IPC error.
Definition: sigma0.h:84
#define EXTERN_C_END
End section with C types and functions.
Definition: compiler.h:187
int l4sigma0_new_client(l4_cap_idx_t sigma0, l4_cap_idx_t gate)
Create a new IPC gate for a new Sigma0 client.
unsigned long l4_cap_idx_t
L4 Capability selector Type.
Definition: types.h:342
int l4sigma0_map_iomem(l4_cap_idx_t sigma0, l4_addr_t phys, l4_addr_t virt, l4_addr_t size, int cached)
Request IO memory from sigma0.
L4 compiler related defines.
int l4sigma0_map_mem(l4_cap_idx_t sigma0, l4_addr_t phys, l4_addr_t virt, l4_addr_t size)
Request a memory mapping from sigma0.
L4 Kernel Interface Page.
Definition: __kip-32bit.h:38
l4sigma0_return_flags_t
Return flags of libsigma0 functions.
Definition: sigma0.h:81
Kernel Info Page access functions.
#define EXTERN_C_BEGIN
Start section with C types and functions.
Definition: compiler.h:186
#define L4_CV
Define calling convention.
Definition: linkage.h:44
No fpage received.
Definition: sigma0.h:85
void l4sigma0_debug_dump(l4_cap_idx_t sigma0)
Request sigma0 to dump internal debug information.
int l4sigma0_map_tbuf(l4_cap_idx_t sigma0, l4_addr_t virt)
Request Fiasco trace buffer.
unsigned long l4_addr_t
Address type.
Definition: l4int.h:45
Ok.
Definition: sigma0.h:82
Superpage requested but smaller flexpage received.
Definition: sigma0.h:88
l4_kernel_info_t * l4sigma0_map_kip(l4_cap_idx_t sigma0, void *addr, unsigned log2_size)
Map the kernel info page from pager to addr.
int l4sigma0_map_anypage(l4_cap_idx_t sigma0, l4_addr_t map_area, unsigned log2_map_size, l4_addr_t *base, unsigned sz)
Request an arbitrary free page of RAM.