diff options
| author | Michael Brown | 2020-11-25 12:24:41 +0100 |
|---|---|---|
| committer | Michael Brown | 2020-11-29 12:25:40 +0100 |
| commit | 13a6d172964667646b1b3ad382470aca141c2d42 (patch) | |
| tree | 9df2b4911c21adb7a3de48abb52019833680ac5e /src/include/ipxe | |
| parent | [dma] Provide dma_umalloc() for allocating large DMA-coherent buffers (diff) | |
| download | ipxe-13a6d172964667646b1b3ad382470aca141c2d42.tar.gz ipxe-13a6d172964667646b1b3ad382470aca141c2d42.tar.xz ipxe-13a6d172964667646b1b3ad382470aca141c2d42.zip | |
[xhci] Update driver to use DMA API
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe')
| -rw-r--r-- | src/include/ipxe/iobuf.h | 22 |
1 files changed, 18 insertions, 4 deletions
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 @@ -215,6 +215,22 @@ static inline void iob_populate ( struct io_buffer *iobuf, __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 * * @v iobuf I/O buffer @@ -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 ); } /** |
