Commit 15a1956af94e36105494f782a752698103addf63

Authored by Gleb Natapov
Committed by Blue Swirl
1 parent c8075ac3

Call piix3_reset() on system reset.

Also zero pci_irq_levels on reset to avoid stuck irq after reset.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Yaniv Kamay <ykamay@redhat.com>
Showing 1 changed file with 5 additions and 1 deletions
hw/piix_pci.c
... ... @@ -232,8 +232,9 @@ static void piix3_set_irq(qemu_irq *pic, int irq_num, int level)
232 232 }
233 233 }
234 234  
235   -static void piix3_reset(PCIDevice *d)
  235 +static void piix3_reset(void *opaque)
236 236 {
  237 + PCIDevice *d = opaque;
237 238 uint8_t *pci_conf = d->config;
238 239  
239 240 pci_conf[0x04] = 0x07; // master, memory and I/O
... ... @@ -267,6 +268,8 @@ static void piix3_reset(PCIDevice *d)
267 268 pci_conf[0xab] = 0x00;
268 269 pci_conf[0xac] = 0x00;
269 270 pci_conf[0xae] = 0x00;
  271 +
  272 + memset(pci_irq_levels, 0, sizeof(pci_irq_levels));
270 273 }
271 274  
272 275 static void piix4_reset(PCIDevice *d)
... ... @@ -339,6 +342,7 @@ int piix3_init(PCIBus *bus, int devfn)
339 342 PCI_HEADER_TYPE_NORMAL | PCI_HEADER_TYPE_MULTI_FUNCTION; // header_type = PCI_multifunction, generic
340 343  
341 344 piix3_reset(d);
  345 + qemu_register_reset(piix3_reset, 0, d);
342 346 return d->devfn;
343 347 }
344 348  
... ...