aboutsummaryrefslogtreecommitdiff
path: root/dma.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2012-03-27 13:42:23 +1100
committerKevin Wolf <kwolf@redhat.com>2012-04-05 14:54:40 +0200
commit43cf8ae69ba8510e45d7bd42dd67bc8ae13c48ec (patch)
tree0fc8d3f2f4b0f75034c8b00d42897d2ea14e88a0 /dma.h
parenteb9566d13e30dd7e20d978632a13915cbdb9a668 (diff)
Use DMADirection type for dma_bdrv_io
Currently dma_bdrv_io() takes a 'to_dev' boolean parameter to determine the direction of DMA it is emulating. We already have a DMADirection enum designed specifically to encode DMA directions. This patch uses it for dma_bdrv_io() as well. This involves removing the DMADirection definition from the #ifdef it was inside, but since that only existed to protect the definition of dma_addr_t from places where config.h is not included, there wasn't any reason for it to be there in the first place. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'dma.h')
-rw-r--r--dma.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/dma.h b/dma.h
index 20e86d28ee..05ac325e27 100644
--- a/dma.h
+++ b/dma.h
@@ -17,6 +17,11 @@
typedef struct ScatterGatherEntry ScatterGatherEntry;
+typedef enum {
+ DMA_DIRECTION_TO_DEVICE = 0,
+ DMA_DIRECTION_FROM_DEVICE = 1,
+} DMADirection;
+
struct QEMUSGList {
ScatterGatherEntry *sg;
int nsg;
@@ -29,11 +34,6 @@ typedef target_phys_addr_t dma_addr_t;
#define DMA_ADDR_FMT TARGET_FMT_plx
-typedef enum {
- DMA_DIRECTION_TO_DEVICE = 0,
- DMA_DIRECTION_FROM_DEVICE = 1,
-} DMADirection;
-
struct ScatterGatherEntry {
dma_addr_t base;
dma_addr_t len;
@@ -51,7 +51,7 @@ typedef BlockDriverAIOCB *DMAIOFunc(BlockDriverState *bs, int64_t sector_num,
BlockDriverAIOCB *dma_bdrv_io(BlockDriverState *bs,
QEMUSGList *sg, uint64_t sector_num,
DMAIOFunc *io_func, BlockDriverCompletionFunc *cb,
- void *opaque, bool to_dev);
+ void *opaque, DMADirection dir);
BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs,
QEMUSGList *sg, uint64_t sector,
BlockDriverCompletionFunc *cb, void *opaque);