From 750e08f17000d9ce28802a5a81bdb26d783bd098 Mon Sep 17 00:00:00 2001 From: Marcelo Tosatti Date: Tue, 11 Mar 2008 17:12:13 -0300 Subject: [PATCH] LSI SCSI and e1000 unregister callbacks Signed-off-by: Marcelo Tosatti Signed-off-by: Avi Kivity --- hw/e1000.c | 11 +++++++++++ hw/lsi53c895a.c | 13 +++++++++++++ 2 files changed, 24 insertions(+) diff --git a/hw/e1000.c b/hw/e1000.c index 1eda9f3214..db2777edec 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -930,6 +930,16 @@ e1000_mmio_map(PCIDevice *pci_dev, int region_num, cpu_register_physical_memory(addr, PNPMMIO_SIZE, d->mmio_index); } +static int +pci_e1000_uninit(PCIDevice *dev) +{ + E1000State *d = (E1000State *) dev; + + cpu_unregister_io_memory(d->mmio_index); + + return 0; +} + PCIDevice * pci_e1000_init(PCIBus *bus, NICInfo *nd, int devfn) { @@ -994,6 +1004,7 @@ pci_e1000_init(PCIBus *bus, NICInfo *nd, int devfn) d->nd->macaddr[3], d->nd->macaddr[4], d->nd->macaddr[5]); register_savevm(info_str, d->instance, 1, nic_save, nic_load, d); + d->dev.unregister = pci_e1000_uninit; return (PCIDevice *)d; } diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c index 52bfc2092c..72ed5c3ca0 100644 --- a/hw/lsi53c895a.c +++ b/hw/lsi53c895a.c @@ -1849,6 +1849,18 @@ void lsi_scsi_attach(void *opaque, BlockDriverState *bd, int id) bd->devfn = s->pci_dev.devfn; } +int lsi_scsi_uninit(PCIDevice *d) +{ + LSIState *s = (LSIState *) d; + + cpu_unregister_io_memory(s->mmio_io_addr); + cpu_unregister_io_memory(s->ram_io_addr); + + qemu_free(s->queue); + + return 0; +} + void *lsi_scsi_init(PCIBus *bus, int devfn) { LSIState *s; @@ -1881,6 +1893,7 @@ void *lsi_scsi_init(PCIBus *bus, int devfn) s->queue = qemu_malloc(sizeof(lsi_queue)); s->queue_len = 1; s->active_commands = 0; + s->pci_dev.unregister = lsi_scsi_uninit; lsi_soft_reset(s); -- 2.11.4.GIT