Message ID | 1253287594-12905-2-git-send-email-wolfgang.mauerer@siemens.com |
---|---|
State | Superseded |
Headers | show |
> 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; > +} > + Wrong place. It should go to scsi-bus.c, it is the reverse of the scsi_qdev_init function. cheers, Gerd
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);