Patchwork [05/13] bmdma: move header definitions out

login
register
mail settings
Submitter Alexander Graf
Date Dec. 8, 2010, 12:13 p.m.
Message ID <1291810400-11309-6-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/74696/
State New
Headers show

Comments

Alexander Graf - Dec. 8, 2010, 12:13 p.m.
The bmdma header definitions currently reside in generic code, but only PCI
specific code should know about BMDMA internals. So let's move the definitions
and everything using them out to pci.h.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 hw/ide/internal.h |   27 ---------------------------
 hw/ide/pci.h      |   28 ++++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 27 deletions(-)

Patch

diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index af7e741..7e2ba1a 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -20,7 +20,6 @@  typedef struct IDEBus IDEBus;
 typedef struct IDEDevice IDEDevice;
 typedef struct IDEDeviceInfo IDEDeviceInfo;
 typedef struct IDEState IDEState;
-typedef struct BMDMAState BMDMAState;
 typedef struct IDEDMA IDEDMA;
 typedef struct IDEDMAOps IDEDMAOps;
 
@@ -512,37 +511,11 @@  struct IDEDeviceInfo {
 #define BM_CMD_START     0x01
 #define BM_CMD_READ      0x08
 
-struct BMDMAState {
-    uint8_t cmd;
-    uint8_t status;
-    uint32_t addr;
-
-    IDEBus *bus;
-    /* current transfer state */
-    uint32_t cur_addr;
-    uint32_t cur_prd_last;
-    uint32_t cur_prd_addr;
-    uint32_t cur_prd_len;
-    uint8_t unit;
-    BlockDriverCompletionFunc *dma_cb;
-    int64_t sector_num;
-    uint32_t nsector;
-    IORange addr_ioport;
-    QEMUBH *bh;
-    qemu_irq irq;
-};
-
 static inline IDEState *idebus_active_if(IDEBus *bus)
 {
     return bus->ifs + bus->unit;
 }
 
-static inline IDEState *bmdma_active_if(BMDMAState *bmdma)
-{
-    assert(bmdma->unit != (uint8_t)-1);
-    return bmdma->bus->ifs + bmdma->unit;
-}
-
 static inline void ide_set_irq(IDEBus *bus)
 {
     if (!(bus->cmd & IDE_CMD_DISABLE_IRQ)) {
diff --git a/hw/ide/pci.h b/hw/ide/pci.h
index 1cd7b06..0f96297 100644
--- a/hw/ide/pci.h
+++ b/hw/ide/pci.h
@@ -3,6 +3,26 @@ 
 
 #include <hw/ide/internal.h>
 
+typedef struct BMDMAState {
+    uint8_t cmd;
+    uint8_t status;
+    uint32_t addr;
+
+    IDEBus *bus;
+    /* current transfer state */
+    uint32_t cur_addr;
+    uint32_t cur_prd_last;
+    uint32_t cur_prd_addr;
+    uint32_t cur_prd_len;
+    uint8_t unit;
+    BlockDriverCompletionFunc *dma_cb;
+    int64_t sector_num;
+    uint32_t nsector;
+    IORange addr_ioport;
+    QEMUBH *bh;
+    qemu_irq irq;
+} BMDMAState;
+
 typedef struct PCIIDEState {
     PCIDevice dev;
     IDEBus bus[2];
@@ -10,6 +30,14 @@  typedef struct PCIIDEState {
     uint32_t secondary; /* used only for cmd646 */
 } PCIIDEState;
 
+
+static inline IDEState *bmdma_active_if(BMDMAState *bmdma)
+{
+    assert(bmdma->unit != (uint8_t)-1);
+    return bmdma->bus->ifs + bmdma->unit;
+}
+
+
 void bmdma_init(IDEBus *bus, BMDMAState *bm);
 void bmdma_cmd_writeb(void *opaque, uint32_t addr, uint32_t val);
 extern const IORangeOps bmdma_addr_ioport_ops;