aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2020-05-29 07:50:55 +0000
committerAndriy Gapon <avg@FreeBSD.org>2020-05-29 07:50:55 +0000
commitcffd37da23ff34c4353e17a3a785b7a40168e20a (patch)
tree801435cc559cdd14f1be086029ba8897b8cfb86a /sys/dev/pci
parente298466ee2f5c73ca859933e790d6c56150a42ac (diff)
Notes
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/pci.c4
-rw-r--r--sys/dev/pci/pci_pci.c6
2 files changed, 9 insertions, 1 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 7673fcddc11af..e2da392fed75d 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -5932,7 +5932,6 @@ pci_cfg_restore(device_t dev, struct pci_devinfo *dinfo)
*/
if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0)
pci_set_powerstate(dev, PCI_POWERSTATE_D0);
- pci_write_config(dev, PCIR_COMMAND, dinfo->cfg.cmdreg, 2);
pci_write_config(dev, PCIR_INTLINE, dinfo->cfg.intline, 1);
pci_write_config(dev, PCIR_INTPIN, dinfo->cfg.intpin, 1);
pci_write_config(dev, PCIR_CACHELNSZ, dinfo->cfg.cachelnsz, 1);
@@ -5971,6 +5970,9 @@ pci_cfg_restore(device_t dev, struct pci_devinfo *dinfo)
}
pci_restore_bars(dev);
+ if ((dinfo->cfg.hdrtype & PCIM_HDRTYPE) != PCIM_HDRTYPE_BRIDGE)
+ pci_write_config(dev, PCIR_COMMAND, dinfo->cfg.cmdreg, 2);
+
/*
* Restore extended capabilities for PCI-Express and PCI-X
*/
diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c
index cb21672705dda..4b9aa08057e15 100644
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -1792,6 +1792,12 @@ pcib_resume(device_t dev)
{
pcib_cfg_restore(device_get_softc(dev));
+
+ /*
+ * Restore the Command register only after restoring the windows.
+ * The bridge should not be claiming random windows.
+ */
+ pci_write_config(dev, PCIR_COMMAND, pci_get_cmdreg(dev), 2);
return (bus_generic_resume(dev));
}