From owner-freebsd-stable@FreeBSD.ORG Wed Sep 24 20:47:36 2003 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6C54E16A4B3 for ; Wed, 24 Sep 2003 20:47:36 -0700 (PDT) Received: from zcars04f.nortelnetworks.com (zcars04f.nortelnetworks.com [47.129.242.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id D459643FBF for ; Wed, 24 Sep 2003 20:47:33 -0700 (PDT) (envelope-from atrens@nortelnetworks.com) Received: from zcard309.ca.nortel.com (zcard309.ca.nortel.com [47.129.242.69]) id h8P3lVL05372 for ; Wed, 24 Sep 2003 23:47:31 -0400 (EDT) Received: from zcard031.ca.nortel.com ([47.129.242.121]) by zcard309.ca.nortel.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id SZX2XGYH; Wed, 24 Sep 2003 23:47:31 -0400 Received: from nortelnetworks.com (artpt4x3.us.nortel.com [47.140.42.25]) by zcard031.ca.nortel.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id SZYBKQ2S; Wed, 24 Sep 2003 23:46:42 -0400 Message-ID: <3F72659E.8090809@nortelnetworks.com> Date: Wed, 24 Sep 2003 23:48:46 -0400 X-Sybari-Trust: 58188b05 aee23e9e 3fcd0116 00000104 From: Andrew Atrens User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4) Gecko/20030807 X-Accept-Language: en-us, en MIME-Version: 1.0 To: stable@freebsd.org Content-Type: multipart/mixed; boundary="------------030403060902050201080906" Subject: fix/workaround for usb probe lockups on nForce2 mbs X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Sep 2003 03:47:36 -0000 This is a multi-part message in MIME format. --------------030403060902050201080906 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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. --------------030403060902050201080906 Content-Type: text/plain; name="usb.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="usb.c.patch" --- ../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 { --------------030403060902050201080906--