fix/workaround for usb probe lockups on nForce2 mbs

Andrew Atrens atrens at nortelnetworks.com
Wed Sep 24 20:47:36 PDT 2003


All,

The attached patch fixes the boot lockups I've been experiencing on my 
nForce2 (A7N8X-Deluxe) motherboards when usb devices are on the bus at 
boot time.

Looks like something in usb_explore is (inadvertently?) enabling 
interrupts if it detects a device on a port. The fix is, during hub 
attach, to not assume that interrupts are off when we access the hub in 
'polling' mode.

Not sure if this is a fix or a workaround. I'll leave that to the usb 
gods to decide ...

At any rate, I'd appreciate some feedback ... nForce2 users, does this 
work for you ?


Cheers,

Andrew.

-------------- next part --------------
--- ../usb.good/usb.c	Mon Aug 25 21:22:33 2003
+++ usb.c	Wed Sep 24 23:22:56 2003
@@ -243,11 +243,24 @@
 		 * Turning this code off will delay attachment of USB devices
 		 * until the USB event thread is running, which means that
 		 * the keyboard will not work until after cold boot.
+		 *
+		 * On nForce2/ohci interrupts get enabled while use_polling
+		 * is set to true. When this happens the cpu spins servicing
+		 * the interrupt routine repeatedly and the restart locks
+		 * solid. This appears to be a race condition as it only
+		 * happens when devices are connected prior to boot - indeed
+		 * with no devices attached the lockup doesn't happen.
+		 *
+		 * Don't take any chances and use splusb() to make sure we
+		 * don't start receiving interrupts before we are ready for
+		 * them ...
 		 */
 		if (cold) {
+	                int s = splusb();
 			sc->sc_bus->use_polling++;
 			dev->hub->explore(sc->sc_bus->root_hub);
 			sc->sc_bus->use_polling--;
+			splx( s );
 		}
 #endif
 	} else {


More information about the freebsd-stable mailing list