aboutsummaryrefslogtreecommitdiff
path: root/sys/pccard
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2001-10-30 15:31:49 +0000
committerWarner Losh <imp@FreeBSD.org>2001-10-30 15:31:49 +0000
commitd1cf40403a7567972b0321dfb8cc529210cd54a3 (patch)
tree0edc5eabfdc01aef3f0a61db9728f49ecd82fcae /sys/pccard
parentbb9fe9dd9ee82fac5fcd9f4154d8d775d8f3b50e (diff)
downloadsrc-d1cf40403a7567972b0321dfb8cc529210cd54a3.tar.gz
src-d1cf40403a7567972b0321dfb8cc529210cd54a3.zip
Restore the main BAR for the bridge on resume. Some machines don't save
this accross suspend/resume events and this was causing the dreaded false positive hit on my "static bug" test. Note: the PCI bus code should do this for us. Note2: We don't do the same for I/O based pci devices since it is more code and doesn't appear to be necessary. Submitted by: Toshiyuki Kawashima-san <tos@fa2.so-net.ne.jp> Obtained from: bsd-nomads:16012
Notes
Notes: svn path=/head/; revision=85737
Diffstat (limited to 'sys/pccard')
-rw-r--r--sys/pccard/pcic_pci.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/pccard/pcic_pci.c b/sys/pccard/pcic_pci.c
index f66edcaf3377..02b68f50413e 100644
--- a/sys/pccard/pcic_pci.c
+++ b/sys/pccard/pcic_pci.c
@@ -1412,13 +1412,33 @@ pcic_pci_teardown_intr(device_t dev, device_t child, struct resource *irq,
return (bus_generic_teardown_intr(dev, child, irq, cookie));
}
+static int
+pcic_pci_resume(device_t dev)
+{
+ struct pcic_softc *sc = device_get_softc(dev);
+
+ /*
+ * Some BIOSes will not save the BARs for the pci chips, so we
+ * must do it ourselves. If the BAR is reset to 0 for an I/O
+ * device, it will read back as 0x1, so no explicit test for
+ * memory devices are needed.
+ *
+ * Note: The PCI bus code should do this automatically for us on
+ * suspend/resume, but until it does, we have to cope.
+ */
+ if (pci_read_config(dev, CB_PCI_SOCKET_BASE, 4) == 0)
+ pci_write_config(dev, CB_PCI_SOCKET_BASE,
+ rman_get_start(sc->memres), 4);
+ return (bus_generic_resume(dev));
+}
+
static device_method_t pcic_pci_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, pcic_pci_probe),
DEVMETHOD(device_attach, pcic_pci_attach),
DEVMETHOD(device_detach, pcic_pci_detach),
DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
+ DEVMETHOD(device_resume, pcic_pci_resume),
DEVMETHOD(device_shutdown, pcic_pci_shutdown),
/* Bus interface */