diff options
author | Gleb Natapov <gleb@redhat.com> | 2009-06-17 19:32:00 +0300 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-06-22 10:10:50 -0500 |
commit | 15a7d71f146e186e90fcacd6a04ad334d04e6236 (patch) | |
tree | 52f15614592bac2193bcc788091b8f691cf59c02 /hw | |
parent | a43c2b0bdfba2ad77d978f55130682c07d7fa6b3 (diff) | |
download | qemu-15a7d71f146e186e90fcacd6a04ad334d04e6236.tar.gz qemu-15a7d71f146e186e90fcacd6a04ad334d04e6236.tar.bz2 qemu-15a7d71f146e186e90fcacd6a04ad334d04e6236.zip |
Add pci_bus_reset() function.
To reset internal irq handling data structures.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Yaniv Kamay <ykamay@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/pci.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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; } |