qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/3] Add pci_bus_reset() function.
@ 2009-06-17 16:32 Gleb Natapov
  2009-06-17 16:32 ` [Qemu-devel] [PATCH 2/3] Call piix3_reset() on system reset Gleb Natapov
  2009-06-17 16:32 ` [Qemu-devel] [PATCH 3/3] Register usb-uhci reset function Gleb Natapov
  0 siblings, 2 replies; 6+ messages in thread
From: Gleb Natapov @ 2009-06-17 16:32 UTC (permalink / raw)
  To: qemu-devel

To reset internal irq handling data structures.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Yaniv Kamay <ykamay@redhat.com>
---
 hw/pci.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index 0a738db..140cdba 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -87,6 +87,21 @@ static int  pcibus_load(QEMUFile *f, void *opaque, int version_id)
     return 0;
 }
 
+static void pci_bus_reset(void *opaque)
+{
+    PCIBus *bus = (PCIBus *)opaque;
+    int i;
+
+    for (i = 0; i < bus->nirq; i++) {
+        bus->irq_count[i] = 0;
+    }
+    for (i = 0; i < 256; i++) {
+        if (bus->devices[i])
+            memset(bus->devices[i]->irq_state, 0,
+                   sizeof(bus->devices[i]->irq_state));
+    }
+}
+
 PCIBus *pci_register_bus(DeviceState *parent, const char *name,
                          pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
                          qemu_irq *pic, int devfn_min, int nirq)
@@ -105,6 +120,7 @@ PCIBus *pci_register_bus(DeviceState *parent, const char *name,
     bus->next = first_bus;
     first_bus = bus;
     register_savevm("PCIBUS", nbus++, 1, pcibus_save, pcibus_load, bus);
+    qemu_register_reset(pci_bus_reset, 0, bus);
     return bus;
 }
 
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-06-18  6:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-17 16:32 [Qemu-devel] [PATCH 1/3] Add pci_bus_reset() function Gleb Natapov
2009-06-17 16:32 ` [Qemu-devel] [PATCH 2/3] Call piix3_reset() on system reset Gleb Natapov
2009-06-17 17:10   ` Blue Swirl
2009-06-18  6:02     ` Gleb Natapov
2009-06-17 16:32 ` [Qemu-devel] [PATCH 3/3] Register usb-uhci reset function Gleb Natapov
2009-06-17 17:11   ` Blue Swirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).