From owner-cvs-src@FreeBSD.ORG Sun Aug 12 18:45:25 2007 Return-Path: Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73A7A16A418; Sun, 12 Aug 2007 18:45:25 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 6308913C483; Sun, 12 Aug 2007 18:45:25 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l7CIjPAd010503; Sun, 12 Aug 2007 18:45:25 GMT (envelope-from truckman@repoman.freebsd.org) Received: (from truckman@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l7CIjPUu010502; Sun, 12 Aug 2007 18:45:25 GMT (envelope-from truckman) Message-Id: <200708121845.l7CIjPUu010502@repoman.freebsd.org> From: Don Lewis Date: Sun, 12 Aug 2007 18:45:25 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/dev/usb ehci.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Aug 2007 18:45:25 -0000 truckman 2007-08-12 18:45:25 UTC FreeBSD src repository Modified files: sys/dev/usb ehci.c Log: Replace three copies of the host controller reset sequence that differ in their details with calls to a new function, ehci_hcreset(), that performs the reset. The original sequences either had no delay or a 1ms delay between telling the controller to stop and asserting the controller reset bit. One instance of the original reset sequence waited for the controller to indicate that its reset was complete before continuing, but the other two immediately let the subsequent code execute. The latter is a problem on some hardware, because a read of the HCCPARAMS register returns an incorrect value while the reset is in progress, which triggers an infinite loop in ehci_pci_givecontroller(), which hangs the system on shutdown. The reset sequence in ehci_hcreset() starts with the most complete instance from the original code, which contains a loop to wait for the controller to indicate that its reset is complete. This appears to be the correct thing to do according to "Enhanced Host Controller Interface Specification for Universal Serial Bus" revision 1.0, section 2.3.1. Add another loop to wait for the controller to indicate that it has stopped before setting the HCRESET bit. This is required by the section 2.3.1 in the specification, which says that setting HCRESET before the controller has halted "will result in undefined behaviour". Reviewed by: imp (previous patch version without the extra wait loop) Tested by: se (previous patch version without the extra wait loop) Approved by: re (bmah) MFC after: 1 week Revision Changes Path 1.56 +38 -18 src/sys/dev/usb/ehci.c