55 unsigned int align_log2;
66 padding = ( headroom + tailroom );
75 align_log2 =
fls ( align - 1 );
76 if ( align_log2 >= ( 8 *
sizeof ( align ) ) )
78 align = ( 1UL << align_log2 );
81 assert ( align >=
sizeof ( *iobuf ) );
82 threshold = ( align -
sizeof ( *iobuf ) );
88 if (
len <= threshold ) {
105 iobuf =
malloc (
sizeof ( *iobuf ) );
168 if ( iobuf->
end == iobuf ) {
271 if ( ! concatenated )
#define NULL
NULL pointer (VOID *)
struct arbelprm_rc_send_wqe rc
#define assert(condition)
Assert a condition at run-time.
uint16_t offset
Offset to command line.
uint8_t data[48]
Additional event data.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define ENOBUFS
No buffer space available.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
#define PAGE_SIZE
Page size.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * memset(void *dest, int character, size_t len) __nonnull
#define fls(x)
Find last (i.e.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct io_buffer * alloc_rx_iob(size_t len, struct dma_device *dma)
Allocate and map I/O buffer for receive DMA.
int iob_ensure_headroom(struct io_buffer *iobuf, size_t len)
Ensure I/O buffer has sufficient headroom.
struct io_buffer * alloc_iob_raw(size_t len, size_t align, size_t offset)
Allocate I/O buffer with specified alignment and offset.
void free_rx_iob(struct io_buffer *iobuf)
Unmap and free I/O buffer for receive DMA.
struct io_buffer * iob_concatenate(struct list_head *list)
Concatenate I/O buffers into a single buffer.
struct io_buffer * iob_split(struct io_buffer *iobuf, size_t len)
Split I/O buffer.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
static size_t iob_headroom(struct io_buffer *iobuf)
Calculate available space at start of an I/O buffer.
#define IOB_ZLEN
Minimum I/O buffer length and alignment.
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.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define iob_pull(iobuf, len)
static __always_inline int dma_mapped(struct dma_mapping *map)
Check if DMA unmapping is required.
physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
#define list_first_entry(list, type, member)
Get the container of the first entry in a list.
#define list_for_each_entry_safe(pos, tmp, head, member)
Iterate over entries in a list, safe against deletion of the current entry.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
#define list_del(list)
Delete an entry from a list.
#define INIT_LIST_HEAD(list)
Initialise a list head.
#define list_is_singular(list)
Test whether a list has just one entry.
void * malloc(size_t size)
Allocate memory.
void * malloc_phys_offset(size_t size, size_t phys_align, size_t offset)
Allocate memory with specified physical alignment and offset.
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Dynamic memory allocation.
static void(* free)(struct refcnt *refcnt))
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)