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 * This file is part of TUD:OS and distributed under the terms of the
13 * GNU Lesser General Public License 2.1.
14 * Please see the COPYING-LGPL-2.1 file for details.
15 */
16#ifndef __L4_SIGMA0_SIGMA0_H
17#define __L4_SIGMA0_SIGMA0_H
18
27#include <l4/sys/compiler.h>
28#include <l4/sys/types.h>
29#include <l4/sys/kip.h>
30
37#undef SIGMA0_REQ_MAGIC
38#undef SIGMA0_REQ_MASK
39
40# define SIGMA0_REQ_MAGIC ~0xFFUL
41# define SIGMA0_REQ_MASK ~0xFFUL
43/* Starting with 0x60 allows to detect components which still use the old
44 * constants (0x00 ... 0x50) */
45#define SIGMA0_REQ_ID_MASK 0xF0
46#define SIGMA0_REQ_ID_FPAGE_RAM 0x60
47#define SIGMA0_REQ_ID_FPAGE_IOMEM 0x70
48#define SIGMA0_REQ_ID_FPAGE_IOMEM_CACHED 0x80
49#define SIGMA0_REQ_ID_FPAGE_ANY 0x90
50#define SIGMA0_REQ_ID_KIP 0xA0
51#define SIGMA0_REQ_ID_DEBUG_DUMP 0xC0
53#define SIGMA0_IS_MAGIC_REQ(d1) \
54 ((d1 & SIGMA0_REQ_MASK) == SIGMA0_REQ_MAGIC)
56#define SIGMA0_REQ(x) \
57 (SIGMA0_REQ_MAGIC + SIGMA0_REQ_ID_ ## x)
59/* Use these constants in your code! */
60#define SIGMA0_REQ_FPAGE_RAM (SIGMA0_REQ(FPAGE_RAM))
61#define SIGMA0_REQ_FPAGE_IOMEM (SIGMA0_REQ(FPAGE_IOMEM))
62#define SIGMA0_REQ_FPAGE_IOMEM_CACHED (SIGMA0_REQ(FPAGE_IOMEM_CACHED))
63#define SIGMA0_REQ_FPAGE_ANY (SIGMA0_REQ(FPAGE_ANY))
64#define SIGMA0_REQ_KIP (SIGMA0_REQ(KIP))
65#define SIGMA0_REQ_DEBUG_DUMP (SIGMA0_REQ(DEBUG_DUMP))
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);
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
206/* Implementations */
207
208L4_INLINE char const *l4sigma0_map_errstr(int err)
209{
210 switch (err)
211 {
212 case 0: return "No error";
213 case -1: return "Phys, virt or size not aligned";
214 case -2: return "IPC error";
215 case -3: return "No fpage received";
216#ifndef SIGMA0_REQ_MAGIC
217 case -4: return "Bad physical address (old protocol only)";
218#endif
219 case -6: return "Superpage requested but smaller flexpage received";
220 case -7: return "Cannot map I/O memory cacheable (old protocol only)";
221 default: return "Unknown error";
222 }
223}
224
225
227
228#endif /* ! __L4_SIGMA0_SIGMA0_H */
L4 compiler related defines.
unsigned long l4_addr_t
Address type.
Definition l4int.h:45
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:359
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.
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:78
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:80
@ L4SIGMA0_IPCERROR
IPC error.
Definition sigma0.h:81
@ L4SIGMA0_NOFPAGE
No fpage received.
Definition sigma0.h:82
@ L4SIGMA0_SMALLERFPAGE
Superpage requested but smaller flexpage received.
Definition sigma0.h:85
@ L4SIGMA0_OK
Ok.
Definition sigma0.h:79
#define L4_CV
Define calling convention.
Definition linkage.h:44
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:62
#define EXTERN_C_BEGIN
Start section with C types and functions.
Definition compiler.h:192
#define EXTERN_C_END
End section with C types and functions.
Definition compiler.h:193
Common L4 ABI Data Types.
L4 Kernel Interface Page.
Definition __kip-32bit.h:39
Kernel Info Page access functions.