From bcasavan@angeltread.org  Wed Jul 30 22:14:23 2003
Return-Path: <bcasavan@angeltread.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 8E2BB37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 30 Jul 2003 22:14:23 -0700 (PDT)
Received: from sccrmhc12.comcast.net (sccrmhc12.comcast.net [204.127.202.56])
	by mx1.FreeBSD.org (Postfix) with ESMTP id C92F143FA3
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 30 Jul 2003 22:14:22 -0700 (PDT)
	(envelope-from bcasavan@angeltread.org)
Received: from abigail.msp.angeltread.org (c-24-245-17-149.mn.client2.attbi.com[24.245.17.149](untrusted sender))
          by comcast.net (sccrmhc12) with ESMTP
          id <2003073105142101200k2ft0e>; Thu, 31 Jul 2003 05:14:21 +0000
Received: by abigail.msp.angeltread.org (Postfix, from userid 49841)
	id CF92710; Thu, 31 Jul 2003 00:14:20 -0500 (CDT)
Message-Id: <20030731051420.CF92710@abigail.msp.angeltread.org>
Date: Thu, 31 Jul 2003 00:14:20 -0500 (CDT)
From: Brent Casavant <bcasavan@angeltread.org>
Reply-To: Brent Casavant <b.j.casavant@ieee.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Intel USB 2.0 unrecognized (partial patch provided)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         55094
>Category:       kern
>Synopsis:       [partial patch] Intel USB 2.0 unrecognized
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-usb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 30 22:20:13 PDT 2003
>Closed-Date:    Sun Mar 27 19:36:53 GMT 2005
>Last-Modified:  Sun Mar 27 19:36:53 GMT 2005
>Originator:     Brent Casavant
>Release:        FreeBSD 5.1-RELEASE i386
>Organization:
Angeltread Software Organization
>Environment:
System: FreeBSD abigail.msp.angeltread.org 5.1-RELEASE FreeBSD 5.1-RELEASE #7: Wed Jul 30 23:33:08 CDT 2003 bcasavan@abigail.msp.angeltread.org:/usr/home/bcasavan/Workarea/ac97/sys/i386/compile/abigail i386

Intel P4 2.4GHz on a Gigabyte GA-8IK1100 motherboard.

FreeBSD 5.1-RELEASE with local modifications to enable various hardware
not currently supported by -RELEASE (and maybe even by -CURRENT).

>Description:

One of the USB controllers on the Gigabyte GA-8IK1100 motherboard is not
recognized and a driver fails to attach.  This motherboard uses an
Intel ICH5R I/O controller.

The pciconf line for this device is:

--- cut here ---
none0@pci0:29:7:        class=0x0c0320 card=0x50061458 chip=0x24dd8086 rev=0x02 hdr=0x00
    vendor   = 'Intel Corporation'
    class    = serial bus
    subclass = USB
--- cut here ---

The BIOS identifies this device as a USB 2.0 controller.

With the modifications from the patch below, the following dmesg output
occurs:

--- cut here ---
uhci4: <Intel 82801EB (ICH5) USB controller USB-E> mem 0xf7000000-0xf70003ff irq 10 at device 29.7 on pci0
uhci4: failed to enable port mapping!
uhci4: Could not map ports
device_probe_and_attach: uhci4 attach returned 6
--- cut here ---

Note that I named the controller "USB-E" as it was the next sequentially
available description.  I'm not sure if this was proper or not, but is
sufficed for the moment.

For reference, here's the USB section of dmesg for all the succesfully
attached USB controllers:

--- cut here ---
uhci0: <Intel 82801EB (ICH5) USB controller USB-A> port 0xbc00-0xbc1f irq 2 at device 29.0 on pci0
usb0: <Intel 82801EB (ICH5) USB controller USB-A> on uhci0
usb0: USB revision 1.0
uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
uhci1: <Intel 82801EB (ICH5) USB controller USB-B> port 0xb000-0xb01f irq 5 at device 29.1 on pci0
usb1: <Intel 82801EB (ICH5) USB controller USB-B> on uhci1
usb1: USB revision 1.0
uhub1: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 2 ports with 2 removable, self powered
uhci2: <Intel 82801EB (ICH5) USB controller USB-C> port 0xb400-0xb41f irq 9 at device 29.2 on pci0
usb2: <Intel 82801EB (ICH5) USB controller USB-C> on uhci2
usb2: USB revision 1.0
uhub2: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub2: 2 ports with 2 removable, self powered
uhci3: <Intel 82801EB (ICH5) USB controller USB-D> port 0xb800-0xb81f irq 2 at device 29.3 on pci0
usb3: <Intel 82801EB (ICH5) USB controller USB-D> on uhci3
usb3: USB revision 1.0
uhub3: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub3: 2 ports with 2 removable, self powered
--- cut here ---

The only interesting thing I can see with regard to these that is not
present for the failing case is that the successful ones have a port
assignment, whereas the failing one has a memory assignment.

>How-To-Repeat:

Boot a Gigabyte GA-8IK1100 motherboard on FreeBSD 5.1-RELEASE with
the following patch applied.

>Fix:

This is a partial patch to enable support for this device.  I'm not
sure where to go from here to make this work, so hopefully one of
the maintainers will be able to take a look at it.  I'm more than
willing to run test code.

--- cut here ---
% cvs diff -u sys/dev/usb/uhci_pci.c
Index: sys/dev/usb/uhci_pci.c
===================================================================
RCS file: /usr/FreeBSDCVS/src/sys/dev/usb/uhci_pci.c,v
retrieving revision 1.46
diff -u -r1.46 uhci_pci.c
--- sys/dev/usb/uhci_pci.c      6 May 2003 19:30:41 -0000       1.46
+++ sys/dev/usb/uhci_pci.c      31 Jul 2003 03:39:40 -0000
@@ -126,6 +126,9 @@
 #define PCI_UHCI_DEVICEID_ICH5_D       0x24de8086
 static const char *uhci_device_ich5_d = "Intel 82801EB (ICH5) USB controller USB-D";
  
+#define PCI_UHCI_DEVICEID_ICH5_E       0x24dd8086
+static const char *uhci_device_ich5_e = "Intel 82801EB (ICH5) USB controller USB-E";
+
 #define PCI_UHCI_DEVICEID_440MX                0x719a8086
 static const char *uhci_device_440mx = "Intel 82443MX USB controller";
  
@@ -208,6 +211,8 @@
                return (uhci_device_ich5_c);
        } else if (device_id == PCI_UHCI_DEVICEID_ICH5_D) {
                return (uhci_device_ich5_d);
+       } else if (device_id == PCI_UHCI_DEVICEID_ICH5_E) {
+               return (uhci_device_ich5_e);
        } else if (device_id == PCI_UHCI_DEVICEID_440MX) {
                return (uhci_device_440mx);
        } else if (device_id == PCI_UHCI_DEVICEID_460GX) {
--- cut here ---

Thanks for your time and effort.

Brent Casavant
>Release-Note:
>Audit-Trail:

From: Craig Boston <craig@meoqu.gank.org>
To: freebsd-gnats-submit@FreeBSD.org, b.j.casavant@ieee.org
Cc: freebsd-stable@freebsd.org
Subject: Re: kern/55094: Intel USB 2.0 unrecognized (partial patch provided)
Date: Thu, 31 Jul 2003 23:40:45 -0500

 --Boundary-00=_N9eK/47zbbR/YX/
 Content-Type: text/plain;
   charset="us-ascii"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline
 
 Saw your post on -stable about this, and decided to take a look since I'm 
 about to get my hands on a similar (82801DB) motherboard.
 
 If it's the USB 2.0 controller that's isn't being detected, shouldn't ehci by 
 patched instead of uhci...?  You may want to give the attached, completely 
 untested, patch a try.  I.e. it compiles on my box, but I don't have any 
 hardware to actually test it on yet.  Might theoretically work depending on 
 how closely Intel followed the EHCI spec.  Note that the patch includes 
 entries for both the DB and EB variants of the chip.
 
 I'm not sure why the code to pick up generic EHCI devices didn't find it 
 though.
 
 Craig
 
 --Boundary-00=_N9eK/47zbbR/YX/
 Content-Type: text/plain;
   charset="us-ascii";
   name="intel-ehci.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment; filename="intel-ehci.patch"
 
 --- sys/dev/usb/ehci_pci.c.orig	Thu Jul 31 23:22:28 2003
 +++ sys/dev/usb/ehci_pci.c	Thu Jul 31 23:28:03 2003
 @@ -80,6 +80,7 @@
  #define PCI_EHCI_VENDORID_AMD		0x1022
  #define PCI_EHCI_VENDORID_APPLE		0x106b
  #define PCI_EHCI_VENDORID_CMDTECH	0x1095
 +#define PCI_EHCI_VENDORID_INTEL		0x8086
  #define PCI_EHCI_VENDORID_NEC		0x1033
  #define PCI_EHCI_VENDORID_OPTI		0x1045
  #define PCI_EHCI_VENDORID_SIS		0x1039
 @@ -87,6 +88,13 @@
  #define PCI_EHCI_DEVICEID_NEC		0x00e01033
  static const char *ehci_device_nec = "NEC uPD 720100 USB 2.0 controller";
  
 +#define PCI_EHCI_DEVICEID_INTEL_DB	0x24cd8086
 +static const char *ehci_device_ich5_db =
 +				"Intel 82801DB (ICH5) USB 2.0 controller";
 +#define PCI_EHCI_DEVICEID_INTEL_EB	0x24dd8086
 +static const char *ehci_device_ich5_eb =
 +				"Intel 82801EB (ICH5) USB 2.0 controller";
 +
  static const char *ehci_device_generic = "EHCI (generic) USB 2.0 controller";
  
  #define PCI_EHCI_BASE_REG	0x10
 @@ -103,6 +111,10 @@
  	switch (device_id) {
  	case PCI_EHCI_DEVICEID_NEC:
  		return (ehci_device_nec);
 +	case PCI_EHCI_DEVICEID_INTEL_DB:
 +		return (ehci_device_ich5_db);
 +	case PCI_EHCI_DEVICEID_INTEL_EB:
 +		return (ehci_device_ich5_eb);
  	default:
  		if (pci_get_class(self) == PCIC_SERIALBUS
  		    && pci_get_subclass(self) == PCIS_SERIALBUS_USB
 @@ -198,6 +210,9 @@
  		break;
  	case PCI_EHCI_VENDORID_CMDTECH:
  		sprintf(sc->sc_vendor, "CMDTECH");
 +		break;
 +	case PCI_EHCI_VENDORID_INTEL:
 +		sprintf(sc->sc_vendor, "Intel");
  		break;
  	case PCI_EHCI_VENDORID_NEC:
  		sprintf(sc->sc_vendor, "NEC");
 
 --Boundary-00=_N9eK/47zbbR/YX/--
 

From: Brent Casavant <b.j.casavant@ieee.org>
To: Craig Boston <craig@meoqu.gank.org>
Cc: freebsd-gnats-submit@FreeBSD.org, freebsd-stable@FreeBSD.org
Subject: Re: kern/55094: Intel USB 2.0 unrecognized (partial patch provided)
Date: Fri, 8 Aug 2003 22:27:33 -0500 (CDT)

 Craig,
 
 Sorry for the incredibly late response.  General busyness you know.
 
 On Thu, 31 Jul 2003, Craig Boston wrote:
 
 > If it's the USB 2.0 controller that's isn't being detected, shouldn't ehci by
 > patched instead of uhci...?  You may want to give the attached, completely
 > untested, patch a try.  I.e. it compiles on my box, but I don't have any
 > hardware to actually test it on yet.  Might theoretically work depending on
 > how closely Intel followed the EHCI spec.  Note that the patch includes
 > entries for both the DB and EB variants of the chip.
 
 You are of course correct sir.  See below.
 
 > I'm not sure why the code to pick up generic EHCI devices didn't find it
 > though.
 
 Ignorance mostly.  This being the first machine I've ever had with USB
 on it, I wasn't aware that USB 2.0 was handled by EHCI instead of the
 OHCI or UHCI drivers (EHCI doesn't appear in the NOTES file and I
 didn't think to make LINT until just a few minutes ago).  Once I
 configured EHCI into the kernel all was well, and with your patch
 it works swimmingly since it's even identified precisely.
 
 So I for one can confirm that the patch you gave does indeed work.
 Now if only I had the cash to buy a USB device to plug into the PC...
 
 Thanks,
 Brent Casavant
 
 -- 
 Brent Casavant			http://www.angeltread.org/
 KD5EMB				-.- -.. ..... . -- -...
 44 54'24"N 93 03'21"W 907FASL	EN34lv
Responsible-Changed-From-To: freebsd-bugs->ticso 
Responsible-Changed-By: njl 
Responsible-Changed-When: Sat Aug 30 11:58:05 PDT 2003 
Responsible-Changed-Why:  
Bernd Walter committed the original USB 2.0 support so he may be interested 
in this 

http://www.freebsd.org/cgi/query-pr.cgi?pr=55094 
State-Changed-From-To: open->feedback 
State-Changed-By: ticso 
State-Changed-When: Sat Aug 30 15:14:46 PDT 2003 
State-Changed-Why:  
The chip returns the correct class identification for the ehci driver. 
I see no reason why an unmodified ehci driver would not attach to this 
device. 
Can you please provide boot -v output from GENERIC + ehci using 
unmodified 5.1-RELEASE or later source. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=55094 
State-Changed-From-To: feedback->closed 
State-Changed-By: iedowse 
State-Changed-When: Sun Mar 27 19:35:55 GMT 2005 
State-Changed-Why:  

Feedback timed out 


Responsible-Changed-From-To: ticso->freebsd-usb 
Responsible-Changed-By: iedowse 
Responsible-Changed-When: Sun Mar 27 19:35:55 GMT 2005 
Responsible-Changed-Why:  

Reassign 

http://www.freebsd.org/cgi/query-pr.cgi?pr=55094 
>Unformatted:
