|
XenevaOS
|


Go to the source code of this file.
Classes | |
| struct | iosys_map |
Macros | |
| #define | IOSYS_MAP_INIT_VADDR(vaddr_) |
| #define | IOSYS_MAP_INIT_VADDR_IOMEM(vaddr_iomem_) |
| #define | IOSYS_MAP_INIT_OFFSET(map_, offset_) |
| #define | __iosys_map_rd_io_u64_case(val_, vaddr_iomem_) u64: memcpy_fromio(&(val_), vaddr_iomem_, sizeof(u64)) |
| #define | __iosys_map_wr_io_u64_case(val_, vaddr_iomem_) u64: memcpy_toio(vaddr_iomem_, &(val_), sizeof(u64)) |
| #define | __iosys_map_rd_io(val__, vaddr_iomem__, type__) |
| #define | __iosys_map_rd_sys(val__, vaddr__, type__) val__ = READ_ONCE(*(type__ *)(vaddr__)) |
| #define | __iosys_map_wr_io(val__, vaddr_iomem__, type__) |
| #define | __iosys_map_wr_sys(val__, vaddr__, type__) WRITE_ONCE(*(type__ *)(vaddr__), val__) |
| #define | iosys_map_rd(map__, offset__, type__) |
| #define | iosys_map_wr(map__, offset__, type__, val__) |
| #define | iosys_map_rd_field(map__, struct_offset__, struct_type__, field__) |
| #define | iosys_map_wr_field(map__, struct_offset__, struct_type__, field__, val__) |
| #define __iosys_map_rd_io | ( | val__, | |
| vaddr_iomem__, | |||
| type__ | |||
| ) |
| #define __iosys_map_rd_io_u64_case | ( | val_, | |
| vaddr_iomem_ | |||
| ) | u64: memcpy_fromio(&(val_), vaddr_iomem_, sizeof(u64)) |
| #define __iosys_map_rd_sys | ( | val__, | |
| vaddr__, | |||
| type__ | |||
| ) | val__ = READ_ONCE(*(type__ *)(vaddr__)) |
| #define __iosys_map_wr_io | ( | val__, | |
| vaddr_iomem__, | |||
| type__ | |||
| ) |
| #define __iosys_map_wr_io_u64_case | ( | val_, | |
| vaddr_iomem_ | |||
| ) | u64: memcpy_toio(vaddr_iomem_, &(val_), sizeof(u64)) |
| #define __iosys_map_wr_sys | ( | val__, | |
| vaddr__, | |||
| type__ | |||
| ) | WRITE_ONCE(*(type__ *)(vaddr__), val__) |
| #define IOSYS_MAP_INIT_OFFSET | ( | map_, | |
| offset_ | |||
| ) |
IOSYS_MAP_INIT_OFFSET - Initializes struct iosys_map from another iosys_map @map_: The dma-buf mapping structure to copy from @offset_: Offset to add to the other mapping
Initializes a new iosys_map struct based on another passed as argument. It does a shallow copy of the struct so it's possible to update the back storage without changing where the original map points to. It is the equivalent of doing:
.. code-block:: c
iosys_map map = other_map; iosys_map_incr(&map, &offset);
Example usage:
.. code-block:: c
void foo(struct device *dev, struct iosys_map *base_map) { ... struct iosys_map map = IOSYS_MAP_INIT_OFFSET(base_map, FIELD_OFFSET); ... }
The advantage of using the initializer over just increasing the offset with iosys_map_incr() like above is that the new map will always point to the right place of the buffer during its scope. It reduces the risk of updating the wrong part of the buffer and having no compiler warning about that. If the assignment to IOSYS_MAP_INIT_OFFSET() is forgotten, the compiler can warn about the use of uninitialized variable.
| #define IOSYS_MAP_INIT_VADDR | ( | vaddr_ | ) |
IOSYS_MAP_INIT_VADDR - Initializes struct iosys_map to an address in system memory @vaddr_: A system-memory address
| #define IOSYS_MAP_INIT_VADDR_IOMEM | ( | vaddr_iomem_ | ) |
IOSYS_MAP_INIT_VADDR_IOMEM - Initializes struct iosys_map to an address in I/O memory @vaddr_iomem_: An I/O-memory address
| #define iosys_map_rd | ( | map__, | |
| offset__, | |||
| type__ | |||
| ) |
iosys_map_rd - Read a C-type value from the iosys_map
@map__: The iosys_map structure @offset__: The offset from which to read @type__: Type of the value being read
Read a C type value (u8, u16, u32 and u64) from iosys_map. For other types or if pointer may be unaligned (and problematic for the architecture supported), use iosys_map_memcpy_from().
Returns: The value read from the mapping.
| #define iosys_map_rd_field | ( | map__, | |
| struct_offset__, | |||
| struct_type__, | |||
| field__ | |||
| ) |
| #define iosys_map_wr | ( | map__, | |
| offset__, | |||
| type__, | |||
| val__ | |||
| ) |
iosys_map_wr - Write a C-type value to the iosys_map
@map__: The iosys_map structure @offset__: The offset from the mapping to write to @type__: Type of the value being written @val__: Value to write
Write a C type value (u8, u16, u32 and u64) to the iosys_map. For other types or if pointer may be unaligned (and problematic for the architecture supported), use iosys_map_memcpy_to()
| #define iosys_map_wr_field | ( | map__, | |
| struct_offset__, | |||
| struct_type__, | |||
| field__, | |||
| val__ | |||
| ) |
iosys_map_wr_field - Write to a member of a struct in the iosys_map
@map__: The iosys_map structure @struct_offset__: Offset from the beginning of the map, where the struct is located @struct_type__: The struct describing the layout of the mapping @field__: Member of the struct to read @val__: Value to write
Write a value to the iosys_map considering its layout is described by a C struct starting at @struct_offset__. The field offset and size is calculated and the @val__ is written. If the field access would incur in un-aligned access, then either iosys_map_memcpy_to() needs to be used or the architecture must support it. Refer to iosys_map_rd_field() for expected usage and memory layout.