summaryrefslogtreecommitdiff
path: root/sys/dev/pci/ehci_pci.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-04-09 19:03:55 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-04-09 19:03:55 +0000
commite0f93117a5b4c3f6d40f132c73bc0170b9d6591a (patch)
treeecd347cf65fac3c1f3366963d2c19e86651f2561 /sys/dev/pci/ehci_pci.c
parentc8e71ecf1ee00eef9e894347b9557092b00849fa (diff)
from freebsd; tested in snaps for weeks
date: 2008/03/12 20:57:17; author: jhb; state: Exp; lines: +4 -1 Relax the BIOS/OS sempahore handoff code to workaround different hard hangs (one at boot, one at shutdown) in recent machines. First, only try to take ownership of the EHCI controller if the BIOS currently owns the controller. On a HP DL160 G5, the machine hangs when we try to take ownership. Second, don't bother trying to give up ownership of the controller during shutdown. It's not strictly required and a Dell DCS S29 hangs on shutdown after the config write. Both of these changes match the behavior of the Linux EHCI driver. I also think both of these hangs are caused by bugs in the BIOS' SMM handler causing it to get stuck in an infinite loop in SMM.
Diffstat (limited to 'sys/dev/pci/ehci_pci.c')
-rw-r--r--sys/dev/pci/ehci_pci.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/pci/ehci_pci.c b/sys/dev/pci/ehci_pci.c
index 195b29888ba..4f7f9a4cdbf 100644
--- a/sys/dev/pci/ehci_pci.c
+++ b/sys/dev/pci/ehci_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ehci_pci.c,v 1.12 2007/06/10 14:49:01 mbalmer Exp $ */
+/* $OpenBSD: ehci_pci.c,v 1.13 2008/04/09 19:03:54 deraadt Exp $ */
/* $NetBSD: ehci_pci.c,v 1.15 2004/04/23 21:13:06 itojun Exp $ */
/*
@@ -214,6 +214,7 @@ ehci_pci_detach(struct device *self, int flags)
return (0);
}
+#if 0 /* not used */
void
ehci_pci_givecontroller(struct ehci_pci_softc *sc)
{
@@ -231,6 +232,7 @@ ehci_pci_givecontroller(struct ehci_pci_softc *sc)
legsup & ~EHCI_LEGSUP_OSOWNED);
}
}
+#endif
void
ehci_pci_takecontroller(struct ehci_pci_softc *sc)
@@ -246,9 +248,9 @@ ehci_pci_takecontroller(struct ehci_pci_softc *sc)
if (EHCI_EECP_ID(eec) != EHCI_EC_LEGSUP)
continue;
legsup = eec;
- pci_conf_write(sc->sc_pc, sc->sc_tag, eecp,
- legsup | EHCI_LEGSUP_OSOWNED);
if (legsup & EHCI_LEGSUP_BIOSOWNED) {
+ pci_conf_write(sc->sc_pc, sc->sc_tag, eecp,
+ legsup | EHCI_LEGSUP_OSOWNED);
DPRINTF(("%s: waiting for BIOS to give up control\n",
sc->sc.sc_bus.bdev.dv_xname));
for (i = 0; i < 5000; i++) {
@@ -271,5 +273,8 @@ ehci_pci_shutdown(void *v)
struct ehci_pci_softc *sc = (struct ehci_pci_softc *)v;
ehci_shutdown(&sc->sc);
+#if 0
+ /* best not to do this anymore; BIOS SMM spins? */
ehci_pci_givecontroller(sc);
+#endif
}