summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2009-09-16 13:41:09 +0300
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-05 09:32:51 -0500
commitc0b1905b285800cfd1a797347efeac8338bfa655 (patch)
tree01613896ddd2c20b71d0fdc2c0eea69ec201111e /hw
parent5330de099adf22a41586525c7afed7d470df11cd (diff)
downloadqemu-c0b1905b285800cfd1a797347efeac8338bfa655.tar.gz
qemu/pci: reset device registers on bus reset
Reset BARs and a couple of other registers on bus reset, as per PCI spec. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/pci.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/hw/pci.c b/hw/pci.c
index 2dd72139d3..e2f88ff75a 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -92,7 +92,20 @@ static inline int pci_bar(int reg)
static void pci_device_reset(PCIDevice *dev)
{
+ int r;
+
memset(dev->irq_state, 0, sizeof dev->irq_state);
+ dev->config[PCI_COMMAND] &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
+ PCI_COMMAND_MASTER);
+ dev->config[PCI_CACHE_LINE_SIZE] = 0x0;
+ dev->config[PCI_INTERRUPT_LINE] = 0x0;
+ for (r = 0; r < PCI_NUM_REGIONS; ++r) {
+ if (!dev->io_regions[r].size) {
+ continue;
+ }
+ pci_set_long(dev->config + pci_bar(r), dev->io_regions[r].type);
+ }
+ pci_update_mappings(dev);
}
static void pci_bus_reset(void *opaque)