L4Re Operating System Framework
Interface and Usage Documentation
|
Interface for memory-like address space accessible via IPC. More...
#include <mmio_space>
Public Types | |
enum | Access_width { Wd_8bit = 0 , Wd_16bit = 1 , Wd_32bit = 2 , Wd_64bit = 3 } |
Actual size of the value to read or write. More... | |
typedef l4_uint64_t | Addr |
Device address. | |
Public Member Functions | |
long | mmio_read (Addr addr, char width, l4_uint64_t *value) |
Read a value from the given address. | |
long | mmio_write (Addr addr, char width, l4_uint64_t value) |
Write a value to the given address. | |
Public Member Functions inherited from L4::Kobject | |
l4_msgtag_t | dec_refcnt (l4_mword_t diff, l4_utcb_t *utcb=l4_utcb()) |
Decrement the in kernel reference counter for the object. | |
Additional Inherited Members | |
Protected Types inherited from L4::Kobject_t< Mmio_space, L4::Kobject, L4RE_PROTO_MMIO_SPACE > | |
typedef Mmio_space | Class |
The target interface type (inheriting from Kobject_t) | |
typedef Typeid::Iface< PROTO, Mmio_space > | __Iface |
The interface description for the derived class. | |
typedef Typeid::Merge_list< Typeid::Iface_list< __Iface >, typename Base::__Iface_list > | __Iface_list |
The list of all RPC interfaces provided directly or through inheritance. | |
Protected Member Functions inherited from L4::Kobject_t< Mmio_space, L4::Kobject, L4RE_PROTO_MMIO_SPACE > | |
L4::Cap< Class > | c () const noexcept |
Get the capability to ourselves. | |
Protected Member Functions inherited from L4::Kobject | |
l4_cap_idx_t | cap () const noexcept |
Return capability selector. | |
Static Protected Member Functions inherited from L4::Kobject_t< Mmio_space, L4::Kobject, L4RE_PROTO_MMIO_SPACE > | |
static void | __check_protocols__ () noexcept |
Helper to check for protocol conflicts. | |
Interface for memory-like address space accessible via IPC.
This interface defines methods for indirect access to MMIO regions.
Memory mapped IO (MMIO) is used by device drivers to control hardware devices. Access to MMIO regions is assigned to user-level device drivers via mappings of memory pages.
However, there are hardware platforms where MMIO regions for different devices share the same memory page. With respect to security and safety, it is often not allowed to map a memory page to multiple device drivers because the driver of one device could then influence operation of another device, which violates security boundaries.
A solution to that problem is to implement a third (trusted) component that gets exclusive access to the shared memory page, and that drivers can access via IPC with the Mmio_space protocol. This proxy-component can then enforce an access policy.
Definition at line 46 of file mmio_space.
Actual size of the value to read or write.
Enumerator | |
---|---|
Wd_8bit | Value is a byte. |
Wd_16bit | Value is a 2-byte word. |
Wd_32bit | Value is a 4-byte word. |
Wd_64bit | Value is a 8-byte word. |
Definition at line 50 of file mmio_space.
long L4Re::Mmio_space::mmio_read | ( | Addr | addr, |
char | width, | ||
l4_uint64_t * | value | ||
) |
Read a value from the given address.
addr | Device virtual address to read from. The address must be aligned relative to the access width. | |
width | Access width of value to be read, see Access_width. | |
[out] | value | Return value. If width is smaller than 64 bit,the upper bits are guaranteed to be 0. |
L4_EOK | Success. |
-L4_EPERM | Insufficient read rights. |
-L4_EINVAL | Address does not exist or cannot be accessed with the given width. |
long L4Re::Mmio_space::mmio_write | ( | Addr | addr, |
char | width, | ||
l4_uint64_t | value | ||
) |
Write a value to the given address.
addr | Device virtual address to write to. The address must be aligned relative to the access width. |
width | Access width of value to write, see Access_width. |
value | Value to write. If width is smaller than 64 bit, the upper bits are ignored. |
L4_EOK | Success. |
-L4_EPERM | Insufficient write rights. |
-L4_EINVAL | Address does not exist or cannot be accessed with the given width. |