Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LUi5C-0002xs-7M for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:46:26 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LUi5B-0002xW-II for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:46:25 -0500 Received: from [199.232.76.173] (port=37326 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LUi5B-0002xR-DS for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:46:25 -0500 Received: from mx2.redhat.com ([66.187.237.31]:34149) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LUi5A-0000hI-UH for qemu-devel@nongnu.org; Wed, 04 Feb 2009 08:46:25 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n14DkOt7010778 for ; Wed, 4 Feb 2009 08:46:24 -0500 Message-Id: <20090204133924.547490546@localhost.localdomain> References: <20090204133303.113145633@localhost.localdomain> Date: Wed, 04 Feb 2009 11:33:17 -0200 From: Marcelo Tosatti Content-Disposition: inline; filename=lsi-and-e1000-unregister Subject: [Qemu-devel] [patch 14/18] qemu: LSI SCSI and e1000 unregister callbacks Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Marcelo Tosatti Signed-off-by: Marcelo Tosatti Index: trunk/hw/e1000.c =================================================================== --- trunk.orig/hw/e1000.c +++ trunk/hw/e1000.c @@ -1034,6 +1034,16 @@ e1000_mmio_map(PCIDevice *pci_dev, int r excluded_regs[i] - 4); } +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) { @@ -1092,6 +1102,7 @@ pci_e1000_init(PCIBus *bus, NICInfo *nd, qemu_format_nic_info_str(d->vc, d->nd->macaddr); register_savevm(info_str, -1, 2, nic_save, nic_load, d); + d->dev.unregister = pci_e1000_uninit; return (PCIDevice *)d; } Index: trunk/hw/lsi53c895a.c =================================================================== --- trunk.orig/hw/lsi53c895a.c +++ trunk/hw/lsi53c895a.c @@ -1962,6 +1962,18 @@ void lsi_scsi_attach(void *opaque, Block bd->private = &s->pci_dev; } +static 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; @@ -2004,6 +2016,7 @@ void *lsi_scsi_init(PCIBus *bus, int dev 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); --