summaryrefslogtreecommitdiff
path: root/hw/pcie.c
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2010-12-22 15:14:35 +0900
committerMichael S. Tsirkin <mst@redhat.com>2010-12-22 09:01:53 +0200
commit0ead87c8debaf12bf4e8cf5130e4e7fb83dbf126 (patch)
tree851fbd24dd47cfa05405ac732ccb31fcc3384fe7 /hw/pcie.c
parent362dd48c16728a656c1ef75f8160838127fd76d5 (diff)
downloadqemu-0ead87c8debaf12bf4e8cf5130e4e7fb83dbf126.tar.gz
pcie: add flr support
Support flr: trigger device reset on flr config write. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pcie.c')
-rw-r--r--hw/pcie.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/hw/pcie.c b/hw/pcie.c
index d1f0086559..6a113a9327 100644
--- a/hw/pcie.c
+++ b/hw/pcie.c
@@ -380,10 +380,6 @@ void pcie_cap_root_reset(PCIDevice *dev)
pci_set_word(dev->config + dev->exp.exp_cap + PCI_EXP_RTCTL, 0);
}
-/*
- * TODO: implement FLR:
- * Right now sets the bit which indicates FLR is supported.
- */
/* function level reset(FLR) */
void pcie_cap_flr_init(PCIDevice *dev)
{
@@ -403,8 +399,11 @@ void pcie_cap_flr_write_config(PCIDevice *dev,
uint32_t addr, uint32_t val, int len)
{
uint8_t *devctl = dev->config + dev->exp.exp_cap + PCI_EXP_DEVCTL;
- if (pci_word_test_and_clear_mask(devctl, PCI_EXP_DEVCTL_BCR_FLR)) {
- /* TODO: implement FLR */
+ if (pci_get_word(devctl) & PCI_EXP_DEVCTL_BCR_FLR) {
+ /* Clear PCI_EXP_DEVCTL_BCR_FLR after invoking the reset handler
+ so the handler can detect FLR by looking at this bit. */
+ pci_device_reset(dev);
+ pci_word_test_and_clear_mask(devctl, PCI_EXP_DEVCTL_BCR_FLR);
}
}