提交 c0b1905b 编写于 作者: M Michael S. Tsirkin 提交者: Anthony Liguori

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: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 5330de09
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册