From owner-freebsd-hackers@FreeBSD.ORG Mon Sep 29 20:27:03 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 769D016A4B3 for ; Mon, 29 Sep 2003 20:27:03 -0700 (PDT) Received: from dastardly.newsbastards.org.72.27.172.IN-addr.ARPA.NOSPAM.dyndns.dk (B77d2.pppool.de [213.7.119.210]) by mx1.FreeBSD.org (Postfix) with ESMTP id 593D343FE9 for ; Mon, 29 Sep 2003 20:26:51 -0700 (PDT) (envelope-from bounce@NOSPAM.dyndns.dk) Received: from Mail.NOSPAM.DynDNS.dK (ipv6.NOSPAM.dyndns.dk [2002:d507:77d2:0:220:afff:fed4:dbcb]) (8.11.6/8.11.6-SPAMMERS-DeLiGHt) with ESMTP id h8U3QYp12998 verified NO) for ; Tue, 30 Sep 2003 05:26:36 +0200 (CEST) (envelope-from bounce@NOSPAM.dyndns.dk) Received: (from beer@localhost) by Mail.NOSPAM.DynDNS.dK (8.11.6/FNORD) id h8U3QXx12997; Tue, 30 Sep 2003 05:26:33 +0200 (CEST) (envelope-from bounce@NOSPAM.dyndns.dk) Date: Tue, 30 Sep 2003 05:26:33 +0200 (CEST) Message-Id: <200309300326.h8U3QXx12997@Mail.NOSPAM.DynDNS.dK> X-Authentication-Warning: localhost.newsbastards.org.72.27.172.IN-addr.A: beer set sender to bounce@NOSPAM.dyndns.dk using -f X-Authentication-Warning: localhost.newsbastards.org.72.27.172.IN-addr.A: Processed from queue /tmp X-Authentication-Warning: localhost.newsbastards.org.72.27.172.IN-addr.A: Processed by beer with -C /etc/mail/sendmail.cf-LOCAL From: Barry Bouwsma To: FreeBSD Hacking Group Subject: USB2.0 external hub and ehci question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Sep 2003 03:27:03 -0000 [Drop hostname part of IPv6-only address above to obtain IPv4-capable e-mail, or just drop me from the recipients and I'll catch up from the archives] Hallo Hackers, I suppose I should post this to -current as the code in question is derived from there, but I'm running it on RELENG_4, so... I've ported the USB controller codes (uhci, ohci, and ehci) from -current to 4.9-PRERELEASE in order to try and add USB2.0 support to 4.x, and I see something that I also saw with the NetBSD ehci codes back last December; namely, that I can't attach an external hub, supposedly with USB2.0 capability, and have it be recognized. First, I seem to have no problems building just the uhci and ohci codes into the usb.ko kernel module, and using them, though I haven't thoroughly crash-tested them. I've mixed all three controller codes, with the result that the hub is not seen. Nor is the external drive. Which I attribute to my own incompetence more than anything. So to make things easier, I ditched all but the ehci code and ignored the check for companion controllers, to limit testing to just that. With an external USB2.0 drive connected, I am able to see and mount it. When I connect the external hub in its place, I get the error that the port was disabled, STALLED -- just as I saw under old NetBSD. I haven't built -current, or a more recent NetBSD, to see if their behaviour is any different when faced with this hub. Is it possible I need some sort of quirks entry for this device, which I can use as a USB1.x device fine? Or do I not even get that far? Here's the dmesg with uhubdebug and ehcidebug set to 1, with a few comments... (I may have added a few additional debug printf()s too) ehci0: mem 0xfdffdc00-0xfdffdcff irq 10 at device 8.2 on pci1 using shared irq10. ehci_init: start usb0: EHCI version 0.95 ehci_init: sparams=0x2395 usb0: wrong number of companions (2 != 0) This here is the PCI card, along with my hack mentioned. [ snip ... ] usb0: on ehci0 usb0: USB revision 2.0 usbd_new_device bus=0xc1728000 port=0 depth=0 speed=0 ehci_open: pipe=0xc1727580, addr=0, endpt=0 (0) usbd_new_device: adding unit addr=1, rev=200, class=9, subclass=0, protocol=1, maxpacket=64, len=18, speed=0 uhub0: NEC EHCI root hub, class 9/0, rev 2.00/1.00, addr 1 uhub0: 5 ports with 5 removable, self powered ehci_open: pipe=0xc1727400, addr=1, endpt=129 (1) usb_init_port: turn on port 1 power usb_init_port: turn on port 2 power usb_init_port: turn on port 3 power usb_init_port: turn on port 4 power usb_init_port: turn on port 5 power ehci_pcd: change=0x02 uhub_explore: port 1 status 0x0501 0x0001 uhub_explore: status change hub=1 port=1 ehci after reset, status=0x00001005 ehci port 1 reset, status = 0x00001005 uhub speed is 3 usbd_new_device bus=0xc1728000 port=1 depth=1 speed=3 ehci_open: pipe=0xc1727180, addr=0, endpt=0 (1) ehci_device_ctrl_close: pipe=0xc1727180 ehci_intr1: door bell uhub_explore: usb_new_device failed, error=STALLED uhub0: device problem, disabling port 1 I can provide a dmesg with a higher debug level, if it would be desired. This is the same regardless of which of two USB2.0 PCI cards that I have I am using. The external hub that causes problems is seen with the USB1.x codes as Sep 28 23:12:34 chubby /kernel: uhub2: Cypress Semiconductor product 0x6560, class 9/0, rev 2.00/0.07, addr 2 Sep 28 23:12:34 chubby /kernel: uhub2: 4 ports with 4 removable, self powered And I can provide a patch I've used to usbdevs* to make this a bit more descriptive... Under NetBSD of last year, I could unplug and somewhat quickly re-plug the external hub after the ehci port was disabled, and after a few tries, I'd get it to be attached as a functioning USB1.x hub while ehci was snoozing or something. Of course, the ehci support was clearly marked as beta then. Oh heck, below I've attached an echidebug=3 dmesg, as it includes a few and for anyone who can make sense out of it, with a failed attempt at trying a random quirk. I'll see about downloading some USB utilities while I'm online to nab more useful info. Thanks, Barry Bouwsma uhub_explore: port 1 status 0x0501 0x0001 uhub_explore: status change hub=1 port=1 ehci after reset, status=0x00001005 ehci port 1 reset, status = 0x00001005 uhub speed is 3 usbd_new_device bus=0xc1728000 port=1 depth=1 speed=3 ehci_open: pipe=0xc1727180, addr=0, endpt=0 (1) ehci_alloc_sqtd: allocating chunk ehci_alloc_sqtd_chain: start len=8 ehci_check_intr: ex=0xc1729400 ehci_idone: ex=0xc1729400 ehci_idone: xfer=0xc1729400, pipe=0xc1727180 ready ehci_idone: len=8, actlen=8, status=0x40 ehci_idone: error, addr=0, endpt=0x00, status 0x40 QH(0xc174af80) at 0x00fedf80: link=0x00fedfc2 endp=0x80082000 addr=0x00 inact=0 endpt=0 eps=2 dtc=0 hrecl=0 mpl=0x8 ctl=0 nrl=8 endphub=0x40000000 smask=0x00 cmask=0x00 huba=0x00 port=0 mult=1 curqtd=0x00f6ef80<> Overlay qTD: next=0x00000001 altnext=0x00000011 status=0x00008c40: toggle=0 bytes=0x0 ioc=1 c_page=0x0 cerr=3 pid=0 stat=0x40 buffer[0]=0x00000000 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bfc0) at 0x00f6efc0: next=0x00f6ef40<> altnext=0x00f6ef40<> status=0x80000e00: toggle=1 bytes=0x0 ioc=0 c_page=0x0 cerr=3 pid=2 stat=0x0 buffer[0]=0x045823a8 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bf40) at 0x00f6ef40: next=0x00f6ef80<> altnext=0x00f6ef80<> status=0x00008d00: toggle=0 bytes=0x0 ioc=1 c_page=0x0 cerr=3 pid=1 stat=0x0 buffer[0]=0x04582398 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bf80) at 0x00f6ef80: next=0x00000001 altnext=0x00000001 status=0x00008c40: toggle=0 bytes=0x0 ioc=1 c_page=0x0 cerr=3 pid=0 stat=0x40 buffer[0]=0x00000000 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 ehci_idone: ex=0xc1729400 done ehci_alloc_sqtd_chain: start len=2 ehci_check_intr: ex=0xc1729400 ehci_idone: ex=0xc1729400 ehci_idone: xfer=0xc1729400, pipe=0xc1727180 ready ehci_idone: len=2, actlen=0, status=0x40 ehci_idone: error, addr=0, endpt=0x00, status 0x40 QH(0xc174af80) at 0x00fedf80: link=0x00fedfc2 endp=0x80082000 addr=0x00 inact=0 endpt=0 eps=2 dtc=0 hrecl=0 mpl=0x8 ctl=0 nrl=8 endphub=0x40000000 smask=0x00 cmask=0x00 huba=0x00 port=0 mult=1 curqtd=0x00f6efc0<> Overlay qTD: next=0x00f6ef40<> altnext=0x00f6ef50<> status=0x80028d40: toggle=1 bytes=0x2 ioc=1 c_page=0x0 cerr=3 pid=1 stat=0x40 buffer[0]=0x04582390 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bf80) at 0x00f6ef80: next=0x00f6efc0<> altnext=0x00f6efc0<> status=0x80000e00: toggle=1 bytes=0x0 ioc=0 c_page=0x0 cerr=3 pid=2 stat=0x0 buffer[0]=0x045823a8 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bfc0) at 0x00f6efc0: next=0x00f6ef40<> altnext=0x00f6ef40<> status=0x80028d40: toggle=1 bytes=0x2 ioc=1 c_page=0x0 cerr=3 pid=1 stat=0x40 buffer[0]=0x04582390 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bf40) at 0x00f6ef40: next=0x00000001 altnext=0x00000001 status=0x00008c80: toggle=0 bytes=0x0 ioc=1 c_page=0x0 cerr=3 pid=0 stat=0x80 buffer[0]=0x00000000 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 ehci_idone: ex=0xc1729400 done ehci_alloc_sqtd_chain: start len=8 ehci_check_intr: ex=0xc1729400 ehci_idone: ex=0xc1729400 ehci_idone: xfer=0xc1729400, pipe=0xc1727180 ready ehci_idone: len=8, actlen=8, status=0x40 ehci_idone: error, addr=0, endpt=0x00, status 0x40 QH(0xc174af80) at 0x00fedf80: link=0x00fedfc2 endp=0x80082000 addr=0x00 inact=0 endpt=0 eps=2 dtc=0 hrecl=0 mpl=0x8 ctl=0 nrl=8 endphub=0x40000000 smask=0x00 cmask=0x00 huba=0x00 port=0 mult=1 curqtd=0x00f6efc0<> Overlay qTD: next=0x00000001 altnext=0x00000011 status=0x00008c40: toggle=0 bytes=0x0 ioc=1 c_page=0x0 cerr=3 pid=0 stat=0x40 buffer[0]=0x00000000 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bf40) at 0x00f6ef40: next=0x00f6ef80<> altnext=0x00f6ef80<> status=0x80000e00: toggle=1 bytes=0x0 ioc=0 c_page=0x0 cerr=3 pid=2 stat=0x0 buffer[0]=0x045823a8 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bf80) at 0x00f6ef80: next=0x00f6efc0<> altnext=0x00f6efc0<> status=0x00008d00: toggle=0 bytes=0x0 ioc=1 c_page=0x0 cerr=3 pid=1 stat=0x0 buffer[0]=0x04582398 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bfc0) at 0x00f6efc0: next=0x00000001 altnext=0x00000001 status=0x00008c40: toggle=0 bytes=0x0 ioc=1 c_page=0x0 cerr=3 pid=0 stat=0x40 buffer[0]=0x00000000 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 ehci_idone: ex=0xc1729400 done ehci_alloc_sqtd_chain: start len=2 ehci_check_intr: ex=0xc1729400 ehci_idone: ex=0xc1729400 ehci_idone: xfer=0xc1729400, pipe=0xc1727180 ready ehci_idone: len=2, actlen=0, status=0x40 ehci_idone: error, addr=0, endpt=0x00, status 0x40 QH(0xc174af80) at 0x00fedf80: link=0x00fedfc2 endp=0x80082000 addr=0x00 inact=0 endpt=0 eps=2 dtc=0 hrecl=0 mpl=0x8 ctl=0 nrl=8 endphub=0x40000000 smask=0x00 cmask=0x00 huba=0x00 port=0 mult=1 curqtd=0x00f6ef40<> Overlay qTD: next=0x00f6ef80<> altnext=0x00f6ef90<> status=0x80028d40: toggle=1 bytes=0x2 ioc=1 c_page=0x0 cerr=3 pid=1 stat=0x40 buffer[0]=0x04582390 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bfc0) at 0x00f6efc0: next=0x00f6ef40<> altnext=0x00f6ef40<> status=0x80000e00: toggle=1 bytes=0x0 ioc=0 c_page=0x0 cerr=3 pid=2 stat=0x0 buffer[0]=0x045823a8 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bf40) at 0x00f6ef40: next=0x00f6ef80<> altnext=0x00f6ef80<> status=0x80028d40: toggle=1 bytes=0x2 ioc=1 c_page=0x0 cerr=3 pid=1 stat=0x40 buffer[0]=0x04582390 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bf80) at 0x00f6ef80: next=0x00000001 altnext=0x00000001 status=0x00008c80: toggle=0 bytes=0x0 ioc=1 c_page=0x0 cerr=3 pid=0 stat=0x80 buffer[0]=0x00000000 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 ehci_idone: ex=0xc1729400 done ehci_alloc_sqtd_chain: start len=8 ehci_check_intr: ex=0xc1729400 ehci_idone: ex=0xc1729400 ehci_idone: xfer=0xc1729400, pipe=0xc1727180 ready ehci_idone: len=8, actlen=8, status=0x40 ehci_idone: error, addr=0, endpt=0x00, status 0x40 QH(0xc174af80) at 0x00fedf80: link=0x00fedfc2 endp=0x80082000 addr=0x00 inact=0 endpt=0 eps=2 dtc=0 hrecl=0 mpl=0x8 ctl=0 nrl=8 endphub=0x40000000 smask=0x00 cmask=0x00 huba=0x00 port=0 mult=1 curqtd=0x00f6ef40<> Overlay qTD: next=0x00000001 altnext=0x00000011 status=0x00008c40: toggle=0 bytes=0x0 ioc=1 c_page=0x0 cerr=3 pid=0 stat=0x40 buffer[0]=0x00000000 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bf80) at 0x00f6ef80: next=0x00f6efc0<> altnext=0x00f6efc0<> status=0x80000e00: toggle=1 bytes=0x0 ioc=0 c_page=0x0 cerr=3 pid=2 stat=0x0 buffer[0]=0x045823a8 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bfc0) at 0x00f6efc0: next=0x00f6ef40<> altnext=0x00f6ef40<> status=0x00008d00: toggle=0 bytes=0x0 ioc=1 c_page=0x0 cerr=3 pid=1 stat=0x0 buffer[0]=0x04582398 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bf40) at 0x00f6ef40: next=0x00000001 altnext=0x00000001 status=0x00008c40: toggle=0 bytes=0x0 ioc=1 c_page=0x0 cerr=3 pid=0 stat=0x40 buffer[0]=0x00000000 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 ehci_idone: ex=0xc1729400 done ehci_alloc_sqtd_chain: start len=2 ehci_check_intr: ex=0xc1729400 ehci_idone: ex=0xc1729400 ehci_idone: xfer=0xc1729400, pipe=0xc1727180 ready ehci_idone: len=2, actlen=0, status=0x40 ehci_idone: error, addr=0, endpt=0x00, status 0x40 QH(0xc174af80) at 0x00fedf80: link=0x00fedfc2 endp=0x80082000 addr=0x00 inact=0 endpt=0 eps=2 dtc=0 hrecl=0 mpl=0x8 ctl=0 nrl=8 endphub=0x40000000 smask=0x00 cmask=0x00 huba=0x00 port=0 mult=1 curqtd=0x00f6ef80<> Overlay qTD: next=0x00f6efc0<> altnext=0x00f6efd0<> status=0x80028d40: toggle=1 bytes=0x2 ioc=1 c_page=0x0 cerr=3 pid=1 stat=0x40 buffer[0]=0x04582390 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bf40) at 0x00f6ef40: next=0x00f6ef80<> altnext=0x00f6ef80<> status=0x80000e00: toggle=1 bytes=0x0 ioc=0 c_page=0x0 cerr=3 pid=2 stat=0x0 buffer[0]=0x045823a8 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bf80) at 0x00f6ef80: next=0x00f6efc0<> altnext=0x00f6efc0<> status=0x80028d40: toggle=1 bytes=0x2 ioc=1 c_page=0x0 cerr=3 pid=1 stat=0x40 buffer[0]=0x04582390 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 QTD(0xc174bfc0) at 0x00f6efc0: next=0x00000001 altnext=0x00000001 status=0x00008c80: toggle=0 bytes=0x0 ioc=1 c_page=0x0 cerr=3 pid=0 stat=0x80 buffer[0]=0x00000000 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 ehci_idone: ex=0xc1729400 done ehci_device_ctrl_close: pipe=0xc1727180 ehci_sync_hc: enter ehci_sync_hc: cmd=0x00080061 sts=0x00008000 ehci_intr1: door bell ehci_sync_hc: cmd=0x00080021 sts=0x00008000 ehci_sync_hc: exit uhub_explore: usb_new_device failed, error=STALLED uhub0: device problem, disabling port 1 uhub_explore: port 2 status 0x0500 0x0000 uhub_explore: port 3 status 0x0500 0x0000 uhub_explore: port 4 status 0x0500 0x0000 uhub_explore: port 5 status 0x0500 0x0000