diff options
author | Paul Brook <paul@codesourcery.com> | 2009-05-14 22:35:07 +0100 |
---|---|---|
committer | Paul Brook <paul@codesourcery.com> | 2009-05-14 22:35:07 +0100 |
commit | 9be5dafe488088bcff8f8365bc7dd35d3dac5186 (patch) | |
tree | 9c01abd9c63a4b34b9408a4a379d74d7dab13fc1 /hw/lsi53c895a.c | |
parent | 86394e969de181d95f2f03e9c93e31e0b3e6c90f (diff) |
LSI SCSI qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/lsi53c895a.c')
-rw-r--r-- | hw/lsi53c895a.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c index f4e57aedb5..39d8ea20fa 100644 --- a/hw/lsi53c895a.c +++ b/hw/lsi53c895a.c @@ -1939,9 +1939,9 @@ 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_attach(void *opaque, BlockDriverState *bd, int id) +void lsi_scsi_attach(DeviceState *host, BlockDriverState *bd, int id) { - LSIState *s = (LSIState *)opaque; + LSIState *s = (LSIState *)host; if (id < 0) { for (id = 0; id < LSI_MAX_DEVS; id++) { @@ -1976,18 +1976,11 @@ static int lsi_scsi_uninit(PCIDevice *d) return 0; } -void *lsi_scsi_init(PCIBus *bus, int devfn) +static void lsi_scsi_init(PCIDevice *dev) { - LSIState *s; + LSIState *s = (LSIState *)dev; uint8_t *pci_conf; - s = (LSIState *)pci_register_device(bus, "LSI53C895A SCSI HBA", - sizeof(*s), devfn, NULL, NULL); - if (s == NULL) { - fprintf(stderr, "lsi-scsi: Failed to register PCI device\n"); - return NULL; - } - pci_conf = s->pci_dev.config; /* PCI Vendor ID (word) */ @@ -2022,5 +2015,12 @@ void *lsi_scsi_init(PCIBus *bus, int devfn) lsi_soft_reset(s); - return s; + scsi_bus_new(&dev->qdev, lsi_scsi_attach); } + +static void lsi53c895a_register_devices(void) +{ + pci_qdev_register("lsi53c895a", sizeof(LSIState), lsi_scsi_init); +} + +device_init(lsi53c895a_register_devices); |