NetBSD Problem Report #23128

Received: (qmail 8211 invoked by uid 605); 11 Oct 2003 01:45:14 -0000
Message-Id: <200310110145.h9B1jCW10586@vixen.snipe444.org>
Date: Fri, 10 Oct 2003 18:45:12 -0700 (PDT)
From: Cliff Wright <cliff@vixen.snipe444.org>
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: cliff@vixen.snipe444.org
To: gnats-bugs@gnats.netbsd.org
Subject: usb ehci "controller halted" fix
X-Send-Pr-Version: 3.95

>Number:         23128
>Category:       kern
>Synopsis:       usb ehci "controller halted" fix
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    mycroft
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 11 01:46:00 +0000 2003
>Closed-Date:    Sun Oct 12 18:06:06 +0000 2003
>Last-Modified:  Mon Oct 13 00:06:01 +0000 2003
>Originator:     Cliff Wright
>Release:        NetBSD 1.6.1
>Organization:

>Environment:


System: NetBSD vixen 1.6.1 NetBSD 1.6.1 (vixen) #0: Wed Jul 9 15:37:19 PDT 2003 cliff@vixen:/usr/src/sys/arch/i386/compile/vixen i386
Architecture: i386
Machine: i386
>Description:

	When the ehci usb driver is enabled on a machine where
	the controller is 64bit address capable, a
	"unrecoverable error, controller halted" message occurs.
>How-To-Repeat:

>Fix:

	Although the dma descriptors are limited to any 4G address range,
	the data is not, using extra area in the dma descriptors to
	define a 64 bit address. This is described in appendix B
	of the EHCI 1.0 spec from the URL in the file dev/usb/ehci.c.
	With a 64 bit address capable controller these upper address
	values must be set, the current driver does not do this.
	The below patches(to dir sys/dev/usb) add this,
	and a good halt ignore line.

--- ehci.c.orig	Wed Jun 18 20:09:00 2003
+++ ehci.c	Fri Oct 10 09:41:58 2003
@@ -719,6 +719,10 @@
 			break;

 		status = nstatus;
+		/* halt is ok if descriptor is last, and complete */
+		if(sqtd->qtd.qtd_next == EHCI_NULL
+			&& EHCI_QTD_GET_BYTES(status) == 0)
+			status &= ~EHCI_QTD_HALTED;
 		if (EHCI_QTD_GET_PID(status) !=	EHCI_QTD_PID_SETUP)
 			actlen += sqtd->len - EHCI_QTD_GET_BYTES(status);
 	}
@@ -2156,6 +2160,7 @@
 			if (i != 0) /* use offset only in first buffer */
 				a = EHCI_PAGE(a);
 			cur->qtd.qtd_buffer[i] = htole32(a);
+			cur->qtd.qtd_buffer_hi[i] = 0;
 #ifdef DIAGNOSTIC
 			if (i >= EHCI_QTD_NBUFFERS) {
 				printf("ehci_alloc_sqtd_chain: i=%d\n", i);
@@ -2536,6 +2541,7 @@
 	    EHCI_QTD_SET_BYTES(sizeof *req)
 	    );
 	setup->qtd.qtd_buffer[0] = htole32(DMAADDR(&epipe->u.ctl.reqdma) + 0);
+	setup->qtd.qtd_buffer_hi[0] = 0;
 	setup->nextqtd = next;
 	setup->qtd.qtd_next = setup->qtd.qtd_altnext = htole32(next->physaddr);
 	setup->xfer = xfer;
@@ -2548,6 +2554,7 @@
 	    EHCI_QTD_IOC
 	    );
 	stat->qtd.qtd_buffer[0] = 0; /* XXX not needed? */
+	stat->qtd.qtd_buffer_hi[0] = 0; /* XXX not needed? */
 	stat->nextqtd = NULL;
 	stat->qtd.qtd_next = stat->qtd.qtd_altnext = EHCI_NULL;
 	stat->xfer = xfer;
--- ehcireg.h.orig	Thu Nov 22 17:16:27 2001
+++ ehcireg.h	Thu Oct  9 19:32:59 2003
@@ -231,6 +231,7 @@
 #define EHCI_QTD_GET_TOGGLE(x)	(((x) >> 31) &  0x1)
 #define EHCI_QTD_TOGGLE		0x80000000
 	ehci_physaddr_t	qtd_buffer[EHCI_QTD_NBUFFERS];
+	ehci_physaddr_t	qtd_buffer_hi[EHCI_QTD_NBUFFERS];
 } ehci_qtd_t;
 #define EHCI_QTD_ALIGN 32

>Release-Note:
>Audit-Trail:

From: "Charles M. Hannum" <mycroft@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:  
Subject: pr/23128 CVS commit: src/sys/dev/usb
Date: Sun, 12 Oct 2003 18:04:28 +0000 (UTC)

 Module Name:	src
 Committed By:	mycroft
 Date:		Sun Oct 12 18:04:28 UTC 2003

 Modified Files:
 	src/sys/dev/usb: ehci.c

 Log Message:
 Fix problems with ehci on controllers that support 64-bit addressing.  From
 Cliff Wright, PR 23128.  Thanks!


 To generate a diff of this commit:
 cvs rdiff -r1.47 -r1.48 src/sys/dev/usb/ehci.c

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

State-Changed-From-To: open->closed 
State-Changed-By: mycroft 
State-Changed-When: Sun Oct 12 18:05:14 UTC 2003 
State-Changed-Why:  
Patch committed.  Works on my Dell I8500, too.  Thanks! 


Responsible-Changed-From-To: kern-bug-people->mycroft 
Responsible-Changed-By: mycroft 
Responsible-Changed-When: Sun Oct 12 18:05:14 UTC 2003 
Responsible-Changed-Why:  
. 

From: enami tsugutomo <enami@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:  
Subject: pr/23128 CVS commit: src/sys/dev/usb
Date: Mon, 13 Oct 2003 00:05:10 +0000 (UTC)

 Module Name:	src
 Committed By:	enami
 Date:		Mon Oct 13 00:05:10 UTC 2003

 Modified Files:
 	src/sys/dev/usb: ehcireg.h

 Log Message:
 Rest of PR23128, so that ehci.c compiles again.


 To generate a diff of this commit:
 cvs rdiff -r1.13 -r1.14 src/sys/dev/usb/ehcireg.h

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

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.