From 13a6d172964667646b1b3ad382470aca141c2d42 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 25 Nov 2020 11:24:41 +0000 Subject: [xhci] Update driver to use DMA API Signed-off-by: Michael Brown --- src/include/ipxe/iobuf.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/include/ipxe') diff --git a/src/include/ipxe/iobuf.h b/src/include/ipxe/iobuf.h index 630a7753c..3e079c064 100644 --- a/src/include/ipxe/iobuf.h +++ b/src/include/ipxe/iobuf.h @@ -214,6 +214,22 @@ static inline void iob_populate ( struct io_buffer *iobuf, (iobuf) = NULL; \ __iobuf; } ) +/** + * Map I/O buffer for DMA + * + * @v iobuf I/O buffer + * @v dma DMA device + * @v len Length to map + * @v flags Mapping flags + * @ret rc Return status code + */ +static inline __always_inline int iob_map ( struct io_buffer *iobuf, + struct dma_device *dma, + size_t len, int flags ) { + return dma_map ( dma, &iobuf->map, virt_to_phys ( iobuf->data ), + len, flags ); +} + /** * Map I/O buffer for transmit DMA * @@ -223,8 +239,7 @@ static inline void iob_populate ( struct io_buffer *iobuf, */ static inline __always_inline int iob_map_tx ( struct io_buffer *iobuf, struct dma_device *dma ) { - return dma_map ( dma, &iobuf->map, virt_to_phys ( iobuf->data ), - iob_len ( iobuf ), DMA_TX ); + return iob_map ( iobuf, dma, iob_len ( iobuf ), DMA_TX ); } /** @@ -237,8 +252,7 @@ static inline __always_inline int iob_map_tx ( struct io_buffer *iobuf, static inline __always_inline int iob_map_rx ( struct io_buffer *iobuf, struct dma_device *dma ) { assert ( iob_len ( iobuf ) == 0 ); - return dma_map ( dma, &iobuf->map, virt_to_phys ( iobuf->data ), - iob_tailroom ( iobuf ), DMA_RX ); + return iob_map ( iobuf, dma, iob_tailroom ( iobuf ), DMA_RX ); } /** -- cgit v1.2.3-55-g7522