L4Re Operating System Framework
Interface and Usage Documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
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
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
51#define SIGMA0_IS_MAGIC_REQ(d1) \
52 ((d1 & SIGMA0_REQ_MASK) == SIGMA0_REQ_MAGIC)
54#define SIGMA0_REQ(x) \
55 (SIGMA0_REQ_MAGIC + SIGMA0_REQ_ID_ ## x)
57/* Use these constants in your code! */
58#define SIGMA0_REQ_FPAGE_RAM (SIGMA0_REQ(FPAGE_RAM))
59#define SIGMA0_REQ_FPAGE_IOMEM (SIGMA0_REQ(FPAGE_IOMEM))
60#define SIGMA0_REQ_FPAGE_IOMEM_CACHED (SIGMA0_REQ(FPAGE_IOMEM_CACHED))
61#define SIGMA0_REQ_FPAGE_ANY (SIGMA0_REQ(FPAGE_ANY))
62#define SIGMA0_REQ_KIP (SIGMA0_REQ(KIP))
63#define SIGMA0_REQ_DEBUG_DUMP (SIGMA0_REQ(DEBUG_DUMP))
85
96l4sigma0_map_kip(l4_cap_idx_t sigma0, void *addr, unsigned log2_size);
97
128 l4_addr_t phys, l4_addr_t virt, l4_addr_t size);
153 l4_addr_t virt, l4_addr_t size, int cached);
179 unsigned log2_map_size, l4_addr_t *base,
180 unsigned sz);
181
191
199L4_INLINE char const *l4sigma0_map_errstr(int err);
200
204/* Implementations */
205
206L4_INLINE char const *l4sigma0_map_errstr(int err)
207{
208 switch (err)
209 {
210 case 0: return "No error";
211 case -1: return "Phys, virt or size not aligned";
212 case -2: return "IPC error";
213 case -3: return "No fpage received";
214#ifndef SIGMA0_REQ_MAGIC
215 case -4: return "Bad physical address (old protocol only)";
216#endif
217 case -6: return "Superpage requested but smaller flexpage received";
218 case -7: return "Cannot map I/O memory cacheable (old protocol only)";
219 default: return "Unknown error";
220 }
221}
222
223
225
226#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:335
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:208
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_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.
l4sigma0_return_flags_t
Return flags of libsigma0 functions.
Definition sigma0.h:76
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 __END_DECLS
End section with C types and functions.
Definition compiler.h:167
#define L4_CV
Define calling convention.
Definition linkage.h:33
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
#define __BEGIN_DECLS
Start section with C types and functions.
Definition compiler.h:164
Common L4 ABI Data Types.
L4 Kernel Interface Page.
Definition __kip-32bit.h:28
Kernel Info Page access functions.