Module Name:    src
Committed By:   jmcneill
Date:           Sat Jul 30 13:19:21 UTC 2011

Modified Files:
        src/sys/dev/pci: ehci_pci.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/pci/ehci_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ehci_pci.c
diff -u src/sys/dev/pci/ehci_pci.c:1.52 src/sys/dev/pci/ehci_pci.c:1.53
--- src/sys/dev/pci/ehci_pci.c:1.52	Mon Apr  4 22:48:15 2011
+++ src/sys/dev/pci/ehci_pci.c	Sat Jul 30 13:19:21 2011
@@ -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) {

Reply via email to