]> git.proxmox.com Git - mirror_qemu.git/commitdiff
Use dma_addr_t type for scatter/gather code
authorDavid Gibson <david@gibson.dropbear.id.au>
Mon, 31 Oct 2011 06:06:46 +0000 (17:06 +1100)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 1 Nov 2011 21:52:05 +0000 (16:52 -0500)
This patch uses the newly created dma_addr_t type throughout the
scatter/gather handling code in dma-helpers.c whenever we need to
represent a dma bus address.  This makes a better distinction as to
what is a bus address and what is a cpu physical address.  Since we
don't support IOMMUs yet, they can't be very different for now, but
that will change in future, and this preliminary helps clarify what's
going on.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
dma-helpers.c
dma.h

index 86d2d0a9970bae0f8895d309a738f7cc0b3ff950..bdcd38cd271d4a4af0fb531da7cdbbaacb0019c9 100644 (file)
@@ -18,8 +18,7 @@ void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint)
     qsg->size = 0;
 }
 
-void qemu_sglist_add(QEMUSGList *qsg, target_phys_addr_t base,
-                     target_phys_addr_t len)
+void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len)
 {
     if (qsg->nsg == qsg->nalloc) {
         qsg->nalloc = 2 * qsg->nalloc + 1;
@@ -45,7 +44,7 @@ typedef struct {
     bool to_dev;
     bool in_cancel;
     int sg_cur_index;
-    target_phys_addr_t sg_cur_byte;
+    dma_addr_t sg_cur_byte;
     QEMUIOVector iov;
     QEMUBH *bh;
     DMAIOFunc *io_func;
diff --git a/dma.h b/dma.h
index 56e163a58f088b25d0d5bc7539fa5710edac9b54..a13209d7eb55531d7801acc32dbaa6f5e1d5420a 100644 (file)
--- a/dma.h
+++ b/dma.h
@@ -28,20 +28,19 @@ typedef enum {
 } DMADirection;
 
 struct ScatterGatherEntry {
-    target_phys_addr_t base;
-    target_phys_addr_t len;
+    dma_addr_t base;
+    dma_addr_t len;
 };
 
 struct QEMUSGList {
     ScatterGatherEntry *sg;
     int nsg;
     int nalloc;
-    target_phys_addr_t size;
+    dma_addr_t size;
 };
 
 void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint);
-void qemu_sglist_add(QEMUSGList *qsg, target_phys_addr_t base,
-                     target_phys_addr_t len);
+void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len);
 void qemu_sglist_destroy(QEMUSGList *qsg);
 #endif