Loading...
Searching...
No Matches
sigma0.h
Go to the documentation of this file.
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@os.inf.tu-dresden.de>,
* Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#ifndef __L4_SIGMA0_SIGMA0_H
#define __L4_SIGMA0_SIGMA0_H
#include <l4/sys/compiler.h>
#include <l4/sys/types.h>
#include <l4/sys/kip.h>
#undef SIGMA0_REQ_MAGIC
#undef SIGMA0_REQ_MASK
# define SIGMA0_REQ_MAGIC ~0xFFUL
# define SIGMA0_REQ_MASK ~0xFFUL
/* Starting with 0x60 allows to detect components which still use the old
* constants (0x00 ... 0x50) */
#define SIGMA0_REQ_ID_MASK 0xF0
#define SIGMA0_REQ_ID_FPAGE_RAM 0x60
#define SIGMA0_REQ_ID_FPAGE_IOMEM 0x70
#define SIGMA0_REQ_ID_FPAGE_IOMEM_CACHED 0x80
#define SIGMA0_REQ_ID_FPAGE_ANY 0x90
#define SIGMA0_REQ_ID_KIP 0xA0
#define SIGMA0_REQ_ID_DEBUG_DUMP 0xC0
#define SIGMA0_IS_MAGIC_REQ(d1) \
((d1 & SIGMA0_REQ_MASK) == SIGMA0_REQ_MAGIC)
#define SIGMA0_REQ(x) \
(SIGMA0_REQ_MAGIC + SIGMA0_REQ_ID_ ## x)
/* Use these constants in your code! */
#define SIGMA0_REQ_FPAGE_RAM (SIGMA0_REQ(FPAGE_RAM))
#define SIGMA0_REQ_FPAGE_IOMEM (SIGMA0_REQ(FPAGE_IOMEM))
#define SIGMA0_REQ_FPAGE_IOMEM_CACHED (SIGMA0_REQ(FPAGE_IOMEM_CACHED))
#define SIGMA0_REQ_FPAGE_ANY (SIGMA0_REQ(FPAGE_ANY))
#define SIGMA0_REQ_KIP (SIGMA0_REQ(KIP))
#define SIGMA0_REQ_DEBUG_DUMP (SIGMA0_REQ(DEBUG_DUMP))
enum l4sigma0_return_flags_t {
L4SIGMA0_OK,
L4SIGMA0_NOTALIGNED,
L4SIGMA0_IPCERROR,
L4SIGMA0_NOFPAGE,
L4SIGMA0_4,
L4SIGMA0_5,
L4SIGMA0_SMALLERFPAGE,
};
L4_BEGIN_DECLS
L4_CV l4_kernel_info_t *
l4sigma0_map_kip(l4_cap_idx_t sigma0, void *addr, unsigned log2_size);
L4_CV int l4sigma0_map_mem(l4_cap_idx_t sigma0,
l4_addr_t phys, l4_addr_t virt, l4_addr_t size);
L4_CV int l4sigma0_map_iomem(l4_cap_idx_t sigma0, l4_addr_t phys,
l4_addr_t virt, l4_addr_t size, int cached);
L4_CV int l4sigma0_map_anypage(l4_cap_idx_t sigma0, l4_addr_t map_area,
unsigned log2_map_size, l4_addr_t *base,
unsigned sz);
L4_CV void l4sigma0_debug_dump(l4_cap_idx_t sigma0);
L4_INLINE char const *l4sigma0_map_errstr(int err);
/* Implementations */
L4_INLINE char const *l4sigma0_map_errstr(int err)
{
switch (err)
{
case 0: return "No error";
case -1: return "Phys, virt or size not aligned";
case -2: return "IPC error";
case -3: return "No fpage received";
#ifndef SIGMA0_REQ_MAGIC
case -4: return "Bad physical address (old protocol only)";
#endif
case -6: return "Superpage requested but smaller flexpage received";
case -7: return "Cannot map I/O memory cacheable (old protocol only)";
default: return "Unknown error";
}
}
L4_END_DECLS
#endif /* ! __L4_SIGMA0_SIGMA0_H */
compiler.h
L4 compiler related defines.
l4_addr_t
unsigned long l4_addr_t
Address type.
Definition l4int.h:34
l4_cap_idx_t
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:336
l4sigma0_map_mem
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.
l4sigma0_map_errstr
char const * l4sigma0_map_errstr(int err)
Get user readable error messages for the return codes.
Definition sigma0.h:206
l4sigma0_map_iomem
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
l4sigma0_return_flags_t
Return flags of libsigma0 functions.
Definition sigma0.h:74
l4sigma0_map_kip
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.
l4sigma0_debug_dump
void l4sigma0_debug_dump(l4_cap_idx_t sigma0)
Request sigma0 to dump internal debug information.
l4sigma0_map_anypage
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
@ L4SIGMA0_NOTALIGNED
Phys, virt or size not aligned.
Definition sigma0.h:76
L4SIGMA0_IPCERROR
@ L4SIGMA0_IPCERROR
IPC error.
Definition sigma0.h:77
L4SIGMA0_NOFPAGE
@ L4SIGMA0_NOFPAGE
No fpage received.
Definition sigma0.h:78
L4SIGMA0_SMALLERFPAGE
@ L4SIGMA0_SMALLERFPAGE
Superpage requested but smaller flexpage received.
Definition sigma0.h:81
L4SIGMA0_OK
@ L4SIGMA0_OK
Ok.
Definition sigma0.h:75
L4_CV
#define L4_CV
Define calling convention.
Definition linkage.h:33
L4_INLINE
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
L4_BEGIN_DECLS
#define L4_BEGIN_DECLS
Start section with C types and functions.
Definition compiler.h:165
L4_END_DECLS
#define L4_END_DECLS
End section with C types and functions.
Definition compiler.h:166
types.h
Common L4 ABI Data Types.
l4_kernel_info_t
L4 Kernel Interface Page.
Definition kip.h:37
kip.h
Kernel Info Page access functions.