L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
sigma0.h
Go to the documentation of this file.
1
7/*
8 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
9 * Alexander Warg <warg@os.inf.tu-dresden.de>,
10 * Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
11 * economic rights: Technische Universität Dresden (Germany)
12 * License: see LICENSE.spdx (in this directory or the directories above)
13 */
14#ifndef __L4_SIGMA0_SIGMA0_H
15#define __L4_SIGMA0_SIGMA0_H
16
24
25#include <l4/sys/compiler.h>
26#include <l4/sys/types.h>
27#include <l4/sys/kip.h>
28
35#undef SIGMA0_REQ_MAGIC
36#undef SIGMA0_REQ_MASK
37
38# define SIGMA0_REQ_MAGIC ~0xFFUL
39# define SIGMA0_REQ_MASK ~0xFFUL
40
41/* Starting with 0x60 allows to detect components which still use the old
42 * constants (0x00 ... 0x50) */
43#define SIGMA0_REQ_ID_MASK 0xF0
44#define SIGMA0_REQ_ID_FPAGE_RAM 0x60
45#define SIGMA0_REQ_ID_FPAGE_IOMEM 0x70
46#define SIGMA0_REQ_ID_FPAGE_IOMEM_CACHED 0x80
47#define SIGMA0_REQ_ID_FPAGE_ANY 0x90
48#define SIGMA0_REQ_ID_KIP 0xA0
49#define SIGMA0_REQ_ID_DEBUG_DUMP 0xC0
50#define SIGMA0_REQ_ID_COV 0xE0
51
52#define SIGMA0_IS_MAGIC_REQ(d1) \
53 ((d1 & SIGMA0_REQ_MASK) == SIGMA0_REQ_MAGIC)
54
55#define SIGMA0_REQ(x) \
56 (SIGMA0_REQ_MAGIC + SIGMA0_REQ_ID_ ## x)
57
58/* Use these constants in your code! */
59#define SIGMA0_REQ_FPAGE_RAM (SIGMA0_REQ(FPAGE_RAM))
60#define SIGMA0_REQ_FPAGE_IOMEM (SIGMA0_REQ(FPAGE_IOMEM))
61#define SIGMA0_REQ_FPAGE_IOMEM_CACHED (SIGMA0_REQ(FPAGE_IOMEM_CACHED))
62#define SIGMA0_REQ_FPAGE_ANY (SIGMA0_REQ(FPAGE_ANY))
63#define SIGMA0_REQ_KIP (SIGMA0_REQ(KIP))
64#define SIGMA0_REQ_DEBUG_DUMP (SIGMA0_REQ(DEBUG_DUMP))
65#define SIGMA0_REQ_COV (SIGMA0_REQ(COV))
67
72
85
87
98l4sigma0_map_kip(l4_cap_idx_t sigma0, void *addr, unsigned log2_size);
99
130 l4_addr_t phys, l4_addr_t virt, l4_addr_t size);
131
155 l4_addr_t virt, l4_addr_t size, int cached);
181 unsigned log2_map_size, l4_addr_t *base,
182 unsigned sz);
183
193
201L4_INLINE char const *l4sigma0_map_errstr(int err);
202
203L4_CV void l4sigma0_print_cov_data(l4_cap_idx_t pager);
204
206
207
208/* Implementations */
209
210L4_INLINE char const *l4sigma0_map_errstr(int err)
211{
212 switch (err)
213 {
214 case 0: return "No error";
215 case -1: return "Phys, virt or size not aligned";
216 case -2: return "IPC error";
217 case -3: return "No fpage received";
218#ifndef SIGMA0_REQ_MAGIC
219 case -4: return "Bad physical address (old protocol only)";
220#endif
221 case -6: return "Superpage requested but smaller flexpage received";
222 case -7: return "Cannot map I/O memory cacheable (old protocol only)";
223 default: return "Unknown error";
224 }
225}
226
227
229
230#endif /* ! __L4_SIGMA0_SIGMA0_H */
L4 compiler related defines.
unsigned long l4_addr_t
Address type.
Definition l4int.h:34
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:352
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.
char const * l4sigma0_map_errstr(int err)
Get user readable error messages for the return codes.
Definition sigma0.h:210
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.
l4sigma0_return_flags_t
Return flags of libsigma0 functions.
Definition sigma0.h:76
L4_BEGIN_DECLS l4_kernel_info_t * l4sigma0_map_kip(l4_cap_idx_t sigma0, void *addr, unsigned log2_size)
Map the kernel info page from sigma0 to addr.
void l4sigma0_debug_dump(l4_cap_idx_t sigma0)
Request sigma0 to dump internal debug information.
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.
@ L4SIGMA0_NOTALIGNED
Phys, virt or size not aligned.
Definition sigma0.h:78
@ L4SIGMA0_IPCERROR
IPC error.
Definition sigma0.h:79
@ L4SIGMA0_NOFPAGE
No fpage received.
Definition sigma0.h:80
@ L4SIGMA0_SMALLERFPAGE
Superpage requested but smaller flexpage received.
Definition sigma0.h:83
@ L4SIGMA0_OK
Ok.
Definition sigma0.h:77
#define L4_CV
Define calling convention.
Definition linkage.h:33
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
#define L4_BEGIN_DECLS
Start section with C types and functions.
Definition compiler.h:165
#define L4_END_DECLS
End section with C types and functions.
Definition compiler.h:166
Kernel Info Page access functions.
Common L4 ABI Data Types.
L4 Kernel Interface Page.
Definition kip.h:37