aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2020-11-25 11:24:41 +0000
committerMichael Brown <mcb30@ipxe.org>2020-11-29 11:25:40 +0000
commit13a6d172964667646b1b3ad382470aca141c2d42 (patch)
tree9df2b4911c21adb7a3de48abb52019833680ac5e /src/include
parent6e01b74a8ac6a3c3c6806ae286df033f71962f9a (diff)
downloadipxe-13a6d172964667646b1b3ad382470aca141c2d42.zip
ipxe-13a6d172964667646b1b3ad382470aca141c2d42.tar.gz
ipxe-13a6d172964667646b1b3ad382470aca141c2d42.tar.bz2
[xhci] Update driver to use DMA API
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ipxe/iobuf.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/include/ipxe/iobuf.h b/src/include/ipxe/iobuf.h
index 630a775..3e079c0 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 );
}
/**