Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci ehci_get_ownership: clear BIOS semaphore when se...



details:   https://anonhg.NetBSD.org/src/rev/830a42025f4d
branches:  trunk
changeset: 767785:830a42025f4d
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Jul 30 13:19:21 2011 +0000

description:
ehci_get_ownership: clear BIOS semaphore when setting OS semaphore, slow
down poll rate, and make sure to clear all SMI bits when we're done

diffstat:

 sys/dev/pci/ehci_pci.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (61 lines):

diff -r 43ed9bb0d013 -r 830a42025f4d sys/dev/pci/ehci_pci.c
--- a/sys/dev/pci/ehci_pci.c    Sat Jul 30 12:19:12 2011 +0000
+++ b/sys/dev/pci/ehci_pci.c    Sat Jul 30 13:19:21 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci_pci.c,v 1.52 2011/04/04 22:48:15 dyoung Exp $     */
+/*     $NetBSD: ehci_pci.c,v 1.53 2011/07/30 13:19:21 jmcneill Exp $   */
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.52 2011/04/04 22:48:15 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.53 2011/07/30 13:19:21 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -91,7 +91,7 @@
 enum ehci_pci_quirk_flags ehci_pci_lookup_quirkdata(pci_vendor_id_t,
        pci_product_id_t);
 
-#define EHCI_MAX_BIOS_WAIT             1000 /* ms */
+#define EHCI_MAX_BIOS_WAIT             100 /* ms*10 */
 #define EHCI_SBx00_WORKAROUND_REG      0x50
 #define EHCI_SBx00_WORKAROUND_ENABLE   __BIT(27)
 
@@ -389,16 +389,18 @@
                if (EHCI_CAP_GET_ID(cap) != EHCI_CAP_ID_LEGACY)
                        goto next;
                legsup = pci_conf_read(pc, tag, addr + PCI_EHCI_USBLEGSUP);
-               /* Ask BIOS to give up ownership */
-               pci_conf_write(pc, tag, addr + PCI_EHCI_USBLEGSUP,
-                   legsup | EHCI_LEG_HC_OS_OWNED);
                if (legsup & EHCI_LEG_HC_BIOS_OWNED) {
+                       /* Ask BIOS to give up ownership */
+                       legsup &= ~EHCI_LEG_HC_BIOS_OWNED;
+                       legsup |= EHCI_LEG_HC_OS_OWNED;
+                       pci_conf_write(pc, tag, addr + PCI_EHCI_USBLEGSUP,
+                           legsup);
                        for (ms = 0; ms < EHCI_MAX_BIOS_WAIT; ms++) {
                                legsup = pci_conf_read(pc, tag,
                                    addr + PCI_EHCI_USBLEGSUP);
                                if (!(legsup & EHCI_LEG_HC_BIOS_OWNED))
                                        break;
-                               delay(1000);
+                               delay(10000);
                        }
                        if (ms == EHCI_MAX_BIOS_WAIT) {
                                aprint_normal("%s: BIOS refuses to give up "
@@ -411,9 +413,7 @@
                }
 
                /* Disable SMIs */
-               pci_conf_write(pc, tag, addr + PCI_EHCI_USBLEGCTLSTS,
-                   EHCI_LEG_EXT_SMI_BAR | EHCI_LEG_EXT_SMI_PCICMD |
-                   EHCI_LEG_EXT_SMI_OS_CHANGE);
+               pci_conf_write(pc, tag, addr + PCI_EHCI_USBLEGCTLSTS, 0);
 
 next:
                if (--maxcap < 0) {



Home | Main Index | Thread Index | Old Index