qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 1/4] SCSI-hotdel: Add detach method to LSI SCSI driv


From: Wolfgang Mauerer
Subject: [Qemu-devel] [PATCH 1/4] SCSI-hotdel: Add detach method to LSI SCSI driver
Date: Fri, 18 Sep 2009 17:26:31 +0200

Introduce lsi_scsi_detach, which destroys and de-registers
a device from the LSI SCSI host

Signed-off-by: Wolfgang Mauerer <address@hidden>
Signed-off-by: Jan Kiszka <address@hidden>
---
 hw/lsi53c895a.c |   16 ++++++++++++++++
 hw/pci.h        |    1 +
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index 62bdca8..7e975b4 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -1959,6 +1959,22 @@ static void lsi_mmio_mapfunc(PCIDevice *pci_dev, int 
region_num,
     cpu_register_physical_memory(addr + 0, 0x400, s->mmio_io_addr);
 }
 
+void lsi_scsi_detach(DeviceState *host, BlockDriverState *bd, int id)
+{
+    LSIState *s = (LSIState *)host;
+
+    if (id >= LSI_MAX_DEVS || id < 0) {
+        BADF("Bad Device ID %d\n", id);
+        return;
+    }
+
+    if (s->bus->devs[id]) {
+        DPRINTF("Destroying device %d\n", id);
+        s->bus->devs[id]->info->destroy(s->bus->devs[id]);
+    }
+    s->bus->devs[id] = NULL;
+}
+
 static void lsi_scsi_save(QEMUFile *f, void *opaque)
 {
     LSIState *s = opaque;
diff --git a/hw/pci.h b/hw/pci.h
index 4e901be..1127c87 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -382,6 +382,7 @@ PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const 
char *name);
 
 /* lsi53c895a.c */
 #define LSI_MAX_DEVS 7
+void lsi_scsi_detach(DeviceState *host, BlockDriverState *bd, int id);
 
 /* vmware_vga.c */
 void pci_vmsvga_init(PCIBus *bus);
-- 
1.6.4





reply via email to

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