|
L4Re Operating System Framework
Interface and Usage Documentation
|
A privileged interface to manage Dma_space associations for the clients. More...
#include <dma_space>
Public Types | |
| enum | Space_attrib : unsigned { Identity_map = 1U << 0 } |
| Attributes assigned to the DMA space when associated with a specific device. More... | |
| enum | Block_flag : unsigned { Search_addr = 1U << 0 } |
| Attributes used when blocking an area. More... | |
| using | Space_attribs = L4::Types::Flags_t<Space_attrib, unsigned> |
| Attributes used when associating the DMA space. | |
| using | Block_flags = L4::Types::Flags_t<Block_flag, unsigned> |
| Attributes used when blocking an area. | |
Public Member Functions | |
| l4_ret_t | associate (L4::Ipc::Cap< Dma_space > dma_space, L4::Ipc::Cap< L4::Task > dma_task, Space_attribs attr) |
| Associate a (kernel) DMA space for a device to a Dma_space. | |
| l4_ret_t | associate_phys (L4::Ipc::Cap< Dma_space > dma_space, Space_attribs attr) |
| Register a Dma_space to use for DMA. | |
| l4_ret_t | disassociate (L4::Ipc::Cap< Dma_space > dma_space) |
| Disassociate the (kernel) DMA space from this Dma_space. | |
| l4_ret_t | block_area (L4::Ipc::Cap< Dma_space > dma_space, L4::Ipc::In_out< Dma_addr * > addr, Dma_size size, Dma_addr max_addr=-1, Block_flags flags=Block_flags(), unsigned char align=L4_SUPERPAGESHIFT) |
| Block an area in a Dma_space. | |
| l4_ret_t | set_limits (L4::Ipc::Cap< Dma_space > dma_space, Dma_addr min_addr, Dma_addr max_addr) |
| Set lower and upper bound of DMA addresses. | |
A privileged interface to manage Dma_space associations for the clients.
This interface is provided as a singleton by Moe.
| enum L4Re::Dma_space_mgr::Block_flag : unsigned |
Attributes used when blocking an area.
| Enumerator | |
|---|---|
| Search_addr | Search suitable address. With this flag, the start address is taken as a lower bound. Without the flag, start and size are taken literally. |
| enum L4Re::Dma_space_mgr::Space_attrib : unsigned |
Attributes assigned to the DMA space when associated with a specific device.
| Enumerator | |
|---|---|
| Identity_map | Request identity mappings. This is needed if some devices are not connected to an IOMMU and need physical addresses. |
| l4_ret_t L4Re::Dma_space_mgr::associate | ( | L4::Ipc::Cap< Dma_space > | dma_space, |
| L4::Ipc::Cap< L4::Task > | dma_task, | ||
| Space_attribs | attr ) |
Associate a (kernel) DMA space for a device to a Dma_space.
| [in] | dma_space | The Dma_space to associate the (kernel) DMA space with. |
| [in] | dma_task | The (kernel) DMA space used for the device that shall be associated with this DMA space. |
| [in] | attr | Attributes for this DMA space. See L4Re::Dma_space::Space_attrib. |
| L4_EOK | Operation successful. |
| -L4_EBUSY | The Dma_space is already associated. |
| -L4_EINVAL | Invalid arguments, e.g. no dma_task capability passed. In particular, when Space_attrib::Identity_map is requested, the Dma_space must not have any pre-existing blockings (see Dma_space_mgr::block_area()) and must not have custom address limits set (see Dma_space_mgr::set_limits()). |
| -L4_ENOENT | Invalid dma_space was passed. |
| -L4_ENOMEM | Not enough memory to allocate internal datastructures. |
| -L4_EPERM | Insufficient permissions; see precondition. |
References associate_phys().
| l4_ret_t L4Re::Dma_space_mgr::associate_phys | ( | L4::Ipc::Cap< Dma_space > | dma_space, |
| Space_attribs | attr ) |
Register a Dma_space to use for DMA.
This function should be used, in case no IOMMU is present or configured. The CPU's physical memory is used as DMA address space.
| [in] | dma_space | The Dma_space to register. |
| [in] | attr | Attributes for the provided DMA space. Currently not used; must be the default-constructed Space_attribs() value. |
| L4_EOK | Operation successful. |
| -L4_EBUSY | The Dma_space is already associated. |
| -L4_EINVAL | Invalid arguments, for example a non-zero attr, pre-existing blockings on dma_space (see Dma_space_mgr::block_area()), or custom address limits set on dma_space (see Dma_space_mgr::set_limits()). |
| -L4_ENOENT | Invalid dma_space was passed. |
| -L4_ENOMEM | Not enough memory to allocate internal datastructures. |
| -L4_EPERM | Insufficient permissions; see precondition. |
Referenced by associate().
|
inline |
Block an area in a Dma_space.
The blocked area cannot be used for mappings in the given dma_space after the call. The call will fail if there are already mappings in the requested range. It is allowed to add block areas before associate() or associate_phys() has been called.
Blocked areas are allowed to overlap.
| [in] | dma_space | The Dma_space to add blocked areas. |
| [in,out] | addr | The DMA address of the blocked area. Either taken literally (in which case it must be page aligned) or as start address if Block_flag::Search_addr is passed. |
| [in] | size | Size of the blocked region. Must be page aligned. |
| [in] | max_addr | Highest allowed DMA address of the region (inclusive). |
| [in] | flags | The attributes used for this blocking (a combination of Dma_space_mgr::Block_flag values). |
| [in] | align | The log2 alignment of the blocked area. Only used if Block_flag::Search_addr is passed. |
| L4_EOK | Operation successful. |
| -L4_EADDRNOTAVAIL | The specified region overlaps an existing mapping or no space left for the blocking. |
| -L4_EINVAL | Invalid address, alignment or flag passed. Block_flag::Search_addr passed but dma_space is not associated yet. |
| -L4_EPERM | Dma_space is associated with physical DMA domain or insufficient permissions; see precondition. |
| -L4_ENOMEM | There is not enough memory to allocate internal data structures. |
Definition at line 542 of file dma_space.
References L4::Kobject_t< Derived, L4::Kobject, L4::PROTO_ANY, Type_info::Demand_t<> >::c(), and L4_SUPERPAGESHIFT.
| l4_ret_t L4Re::Dma_space_mgr::disassociate | ( | L4::Ipc::Cap< Dma_space > | dma_space | ) |
Disassociate the (kernel) DMA space from this Dma_space.
| [in] | dma_space | The Dma_space to de-register. |
| L4_EOK | Operation successful. |
| -L4_ENOENT | Invalid dma_space was passed or disassociate() called without prior calling associate()/associate_phys(). |
| -L4_EPERM | Insufficient permissions; see precondition. |
References disassociate().
Referenced by disassociate().
| l4_ret_t L4Re::Dma_space_mgr::set_limits | ( | L4::Ipc::Cap< Dma_space > | dma_space, |
| Dma_addr | min_addr, | ||
| Dma_addr | max_addr ) |
Set lower and upper bound of DMA addresses.
Mappings and blockings are only allowed in the given range.
If multiple Dma_spaces share the same kernel DMA space (i.e., were associated by passing the same dma_task to associate()), all DMA address allocations, reservations and blockings performed through any of these Dma_spaces use the intersection of all their individual limits. Tightening the limits on one Dma_space therefore also constrains all other Dma_spaces sharing the same DMA task; loosening the limits on one Dma_space has no effect beyond what the most-restrictive peer Dma_space allows.
| [in] | dma_space | The Dma_space whose limits shall be changed. |
| [in] | min_addr | The lowest usable address in the Dma_space. |
| [in] | max_addr | The highest usable address in the Dma_space (inclusive). |
| L4_EOK | Operation successful. |
| -L4_EADDRNOTAVAIL | There are existing mappings or blocking outside the bounds. |
| -L4_EPERM | Dma_space is associated with physical DMA domain or insufficient permissions; see precondition. |
| -L4_EINVAL | Invalid address passed. |