72#define iob_reserve( iobuf, len ) ( { \
74 __result = iob_reserve ( (iobuf), (len) ); \
75 assert ( (iobuf)->tail <= (iobuf)->end ); \
89#define iob_push( iobuf, len ) ( { \
91 __result = iob_push ( (iobuf), (len) ); \
92 assert ( (iobuf)->data >= (iobuf)->head ); \
107#define iob_pull( iobuf, len ) ( { \
109 __result = iob_pull ( (iobuf), (len) ); \
110 assert ( (iobuf)->data <= (iobuf)->tail ); \
121 void *old_tail = iobuf->
tail;
125#define iob_put( iobuf, len ) ( { \
127 __result = iob_put ( (iobuf), (len) ); \
128 assert ( (iobuf)->tail <= (iobuf)->end ); \
140#define iob_unput( iobuf, len ) do { \
141 iob_unput ( (iobuf), (len) ); \
142 assert ( (iobuf)->tail >= (iobuf)->data ); \
161 return ( iobuf->
tail - iobuf->
data );
171 return ( iobuf->
data - iobuf->
head );
181 return ( iobuf->
end - iobuf->
tail );
196 void *
data,
size_t len,
size_t max_len ) {
199 iobuf->
end = (
data + max_len );
217#define iob_disown( iobuf ) ( { \
218 struct io_buffer *__iobuf = (iobuf); \
#define assert(condition)
Assert a condition at run-time.
uint16_t offset
Offset to command line.
uint8_t data[48]
Additional event data.
#define __malloc
Declare a pointer returned by a function as a unique memory address as returned by malloc-type functi...
#define __always_inline
Declare a function to be always inline.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
static size_t iob_headroom(struct io_buffer *iobuf)
Calculate available space at start of an I/O buffer.
static void iob_empty(struct io_buffer *iobuf)
Empty an I/O buffer.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
#define iob_push(iobuf, len)
static void iob_populate(struct io_buffer *iobuf, void *data, size_t len, size_t max_len)
Create a temporary I/O buffer.
int iob_ensure_headroom(struct io_buffer *iobuf, size_t len)
Ensure I/O buffer has sufficient headroom.
static __always_inline void iob_unmap(struct io_buffer *iobuf)
Unmap I/O buffer for DMA.
#define iob_put(iobuf, len)
static __always_inline int iob_map_rx(struct io_buffer *iobuf, struct dma_device *dma)
Map empty I/O buffer for receive DMA.
struct io_buffer *__malloc alloc_iob(size_t len)
Allocate I/O buffer.
static __always_inline int iob_map_tx(struct io_buffer *iobuf, struct dma_device *dma)
Map I/O buffer for transmit DMA.
struct io_buffer *__malloc alloc_iob_raw(size_t len, size_t align, size_t offset)
Allocate I/O buffer with specified alignment and offset.
static __always_inline physaddr_t iob_dma(struct io_buffer *iobuf)
Get I/O buffer DMA address.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
void iob_pad(struct io_buffer *iobuf, size_t min_len)
Pad I/O buffer.
#define iob_reserve(iobuf, len)
void free_rx_iob(struct io_buffer *iobuf)
Unmap and free I/O buffer for receive DMA.
#define iob_pull(iobuf, len)
struct io_buffer *__malloc alloc_rx_iob(size_t len, struct dma_device *dma)
Allocate and map I/O buffer for receive DMA.
struct io_buffer * iob_concatenate(struct list_head *list)
Concatenate I/O buffers into a single buffer.
#define iob_unput(iobuf, len)
static size_t iob_tailroom(struct io_buffer *iobuf)
Calculate available space at end of an I/O buffer.
struct io_buffer * iob_split(struct io_buffer *iobuf, size_t len)
Split I/O buffer.
static __always_inline int iob_map(struct io_buffer *iobuf, struct dma_device *dma, size_t len, int flags)
Map I/O buffer for DMA.
#define DMA_TX
Device will read data from host memory.
#define DMA_RX
Device will write data to host memory.
void dma_unmap(struct dma_mapping *map, size_t len)
Unmap buffer.
physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
void * data
Start of data.
struct list_head list
List of which this buffer is a member.
void * end
End of the buffer.
void * head
Start of the buffer.
struct dma_mapping map
DMA mapping.
A doubly-linked list entry (or list head)