67 #define iob_reserve( iobuf, len ) ( { \ 69 __result = iob_reserve ( (iobuf), (len) ); \ 70 assert ( (iobuf)->tail <= (iobuf)->end ); \ 84 #define iob_push( iobuf, len ) ( { \ 86 __result = iob_push ( (iobuf), (len) ); \ 87 assert ( (iobuf)->data >= (iobuf)->head ); \ 102 #define iob_pull( iobuf, len ) ( { \ 104 __result = iob_pull ( (iobuf), (len) ); \ 105 assert ( (iobuf)->data <= (iobuf)->tail ); \ 116 void *old_tail = iobuf->
tail;
120 #define iob_put( iobuf, len ) ( { \ 122 __result = iob_put ( (iobuf), (len) ); \ 123 assert ( (iobuf)->tail <= (iobuf)->end ); \ 135 #define iob_unput( iobuf, len ) do { \ 136 iob_unput ( (iobuf), (len) ); \ 137 assert ( (iobuf)->tail >= (iobuf)->data ); \ 156 return ( iobuf->
tail - iobuf->
data );
166 return ( iobuf->
data - iobuf->
head );
176 return ( iobuf->
end - iobuf->
tail );
191 void *
data,
size_t len,
size_t max_len ) {
194 iobuf->
end = (
data + max_len );
212 #define iob_disown( iobuf ) ( { \ 213 struct io_buffer *__iobuf = (iobuf); \ static __always_inline void struct dma_mapping size_t size_t align
#define iob_pull(iobuf, len)
#define iob_put(iobuf, len)
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
struct io_buffer *__malloc alloc_rx_iob(size_t len, struct dma_device *dma)
Allocate and map I/O buffer for receive DMA.
struct dma_mapping map
DMA mapping.
struct io_buffer * iob_concatenate(struct list_head *list)
Concatenate I/O buffers into a single buffer.
#define iob_push(iobuf, len)
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.
static void iob_populate(struct io_buffer *iobuf, void *data, size_t len, size_t max_len)
Create a temporary I/O buffer.
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
A doubly-linked list entry (or list head)
static __always_inline int iob_map_tx(struct io_buffer *iobuf, struct dma_device *dma)
Map I/O buffer for transmit DMA.
void free_rx_iob(struct io_buffer *iobuf)
Unmap and free I/O buffer for receive DMA.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static __always_inline void iob_unmap(struct io_buffer *iobuf)
Unmap I/O buffer for DMA.
static __always_inline physaddr_t iob_dma(struct io_buffer *iobuf)
Get I/O buffer DMA address.
#define DMA_TX
Device will read data from host memory.
void dma_unmap(struct dma_mapping *map)
Unmap buffer.
static void iob_empty(struct io_buffer *iobuf)
Empty an I/O buffer.
struct io_buffer *__malloc alloc_iob(size_t len)
Allocate I/O buffer.
#define iob_unput(iobuf, len)
struct io_buffer * iob_split(struct io_buffer *iobuf, size_t len)
Split I/O buffer.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define __always_inline
Declare a function to be always inline.
static size_t iob_tailroom(struct io_buffer *iobuf)
Calculate available space at end of an I/O buffer.
void * end
End of the buffer.
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.
#define DMA_RX
Device will write data to host memory.
#define iob_reserve(iobuf, len)
static size_t iob_headroom(struct io_buffer *iobuf)
Calculate available space at start of an I/O buffer.
struct list_head list
List of which this buffer is a member.
static __always_inline int iob_map_rx(struct io_buffer *iobuf, struct dma_device *dma)
Map empty I/O buffer for receive DMA.
#define __malloc
Declare a pointer returned by a function as a unique memory address as returned by malloc-type functi...
void * head
Start of the buffer.
void * data
Start of data.
uint8_t data[48]
Additional event data.
uint16_t offset
Offset to command line.
static __always_inline physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
int iob_ensure_headroom(struct io_buffer *iobuf, size_t len)
Ensure I/O buffer has sufficient headroom.
void iob_pad(struct io_buffer *iobuf, size_t min_len)
Pad I/O buffer.