Patchwork [5/5] Cleanup of pci_irq_levels belong to i440fx

login
register
mail settings
Submitter Juan Quintela
Date Aug. 21, 2009, 5:36 p.m.
Message ID <6f6a46b9e1677bc001e1ed7ec54cb7feb4b5f80d.1250875331.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/31844/
State Superseded
Headers show

Comments

Juan Quintela - Aug. 21, 2009, 5:36 p.m.
Do there in a new reset function.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/piix_pci.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

Patch

diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index d8aeeec..bd6ab9b 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -63,8 +63,6 @@  static int pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
     return (irq_num + slot_addend) & 3;
 }

-static int pci_irq_levels[4];
-
 static void update_pam(PCII440FXState *d, uint32_t start, uint32_t end, int r)
 {
     uint32_t addr;
@@ -177,6 +175,13 @@  static int i440fx_load(QEMUFile* f, void *opaque, int version_id)
     return 0;
 }

+static void i440fx_reset(void *opaque)
+{
+    PCII440FXState *d = opaque;
+
+    memset(d->pci_irq_levels, 0, sizeof(d->pci_irq_levels));
+}
+
 static void i440fx_pcihost_initfn(SysBusDevice *dev)
 {
     I440FXState *s = FROM_SYSBUS(I440FXState, dev);
@@ -205,6 +210,9 @@  static void i440fx_initfn(PCIDevice *dev)
     d->dev.config[0x72] = 0x02; /* SMRAM */

     register_savevm("I440FX", 0, 2, i440fx_save, i440fx_load, d);
+
+    i440fx_reset(d);
+    qemu_register_reset(i440fx_reset, d);
 }

 PCIBus *i440fx_init(PCII440FXState **pi440fx_state, qemu_irq *pic)
@@ -288,8 +296,6 @@  static void piix3_reset(void *opaque)
     pci_conf[0xab] = 0x00;
     pci_conf[0xac] = 0x00;
     pci_conf[0xae] = 0x00;
-
-    memset(pci_irq_levels, 0, sizeof(pci_irq_levels));
 }

 static void piix_save(QEMUFile* f, void *opaque)