diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2010-12-08 17:46:28 +0900 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2010-12-09 12:48:31 +0200 |
commit | 513691b7ff20262efe9aafb85c8dd4615588ad48 (patch) | |
tree | 3d8ced30209ae066638ae8b5a2f1f626bf4b12e5 /hw/pcie_aer.c | |
parent | 5f47c187d992d5147397ddd5323c732d3d39cb8f (diff) | |
download | qemu-513691b7ff20262efe9aafb85c8dd4615588ad48.zip |
pci/aer: factor out common code
Same logic is used to assert interrupts
and send msix messages, so add a static functin for this.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pcie_aer.c')
-rw-r--r-- | hw/pcie_aer.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/hw/pcie_aer.c b/hw/pcie_aer.c index f24784ac98..cb97a95d61 100644 --- a/hw/pcie_aer.c +++ b/hw/pcie_aer.c @@ -273,6 +273,17 @@ static uint32_t pcie_aer_status_to_cmd(uint32_t status) return cmd; } +static void pcie_aer_root_notify(PCIDevice *dev) +{ + if (msix_enabled(dev)) { + msix_notify(dev, pcie_aer_root_get_vector(dev)); + } else if (msi_enabled(dev)) { + msi_notify(dev, pcie_aer_root_get_vector(dev)); + } else { + qemu_set_irq(dev->irq[dev->exp.aer_intx], 1); + } +} + /* * 6.2.6 Error Message Control * Figure 6-3 @@ -344,13 +355,7 @@ static void pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg) return; } - if (msix_enabled(dev)) { - msix_notify(dev, pcie_aer_root_get_vector(dev)); - } else if (msi_enabled(dev)) { - msi_notify(dev, pcie_aer_root_get_vector(dev)); - } else { - qemu_set_irq(dev->irq[dev->exp.aer_intx], 1); - } + pcie_aer_root_notify(dev); } /* @@ -760,13 +765,7 @@ void pcie_aer_root_write_config(PCIDevice *dev, return; } - if (msix_enabled(dev)) { - msix_notify(dev, pcie_aer_root_get_vector(dev)); - } else if (msi_enabled(dev)) { - msi_notify(dev, pcie_aer_root_get_vector(dev)); - } else { - abort(); - } + pcie_aer_root_notify(dev); } static const VMStateDescription vmstate_pcie_aer_err = { |