qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 11/26] ahci: add ide device initialization helper


From: Isaku Yamahata
Subject: [Qemu-devel] [PATCH 11/26] ahci: add ide device initialization helper
Date: Wed, 16 Mar 2011 18:29:22 +0900

Introduce a helper function which initialize ahci port with ide device
It will be used by q35 support later.

Cc: Alexander Graf <address@hidden>
Signed-off-by: Isaku Yamahata <address@hidden>
---
 hw/ide.h      |    3 +++
 hw/ide/ahci.c |   15 +++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/hw/ide.h b/hw/ide.h
index 73fb550..e90f557 100644
--- a/hw/ide.h
+++ b/hw/ide.h
@@ -28,4 +28,7 @@ void mmio_ide_init (target_phys_addr_t membase, 
target_phys_addr_t membase2,
 
 void ide_get_bs(BlockDriverState *bs[], BusState *qbus);
 
+/* ide/ahci.c */
+void pci_ahci_ide_create_devs(PCIDevice *pci_dev, DriveInfo **hd_table);
+
 #endif /* HW_IDE_H */
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 98bdf70..5597885 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1150,3 +1150,18 @@ void ahci_reset(void *opaque)
         ahci_reset_port(&d->ahci, i);
     }
 }
+
+void pci_ahci_ide_create_devs(PCIDevice *pci_dev, DriveInfo **hd_table)
+{
+    struct AHCIPCIState *dev = DO_UPCAST(struct AHCIPCIState, card, pci_dev);
+    int i;
+
+    for (i = 0; i < dev->ahci.ports; i++) {
+        /* master device only, ignore slaves */
+        if (hd_table[i * MAX_IDE_DEVS] == NULL) {
+            continue;
+        }
+        ide_create_drive(&dev->ahci.dev[i].port, 0,
+                         hd_table[i * MAX_IDE_DEVS]);
+    }
+}
-- 
1.7.1.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]