Hi, I get a complete lock-up while booting during initialisation of my SIS7002 EHCI controller.
When enabling USB2.0 support, but disabling 'legacy' mode everything is fine. I just can't use my usb keyboard to talk to the boot> prompt. When I enable legacy mode, but set USB2.0 to 'FullSpeed' I just get this: ehci0: timed out waiting for BIOS I had a look at the source, but don't really get it whether this is bad. I could not find corresponding code in the Linux kernel. It seems to be about handing over the host controler to the OS after the bios used it for 'legacy' mode. Why is this only needed for USB2.0? I thought my keyboard and mouse were USB1.0 devices!? When I enable legacy mode and set USB2.0 to 'HighSpeed' I get the above message and the kernel locks up completely. I added some DPRINTF()s to the relevant sections. (See below) The strange thing is that the last thing the kernel prints out is ehci: before loop so the kernel manages to do the printf, but doesn't manage to do the funtion call to usb_delay_ms and another printf. Now I had a look at the linux ehci driver, because with knoppix I have no problems using USB2.0. You can find the corresponding section of the linux driver below. The linux kernel protects itself by "write-locking" the call to ehci_writel, but I have no clue what this means and no clue how to achieve this in OpenBSD. The call to down_write() seems to lock a semaphore. Any help to fix this is appreciated. Christopher P.S. Another interesting observation: When removing my AGB graphics adaptor and using the onboard graphics chip I have no problems with USB at all. = LINUX ===================================================== drivers/usb/host/ehci-hcd.c:662 /* * Start, enabling full USB 2.0 functionality ... usb 1.1 devices * are explicitly handed to companion controller(s), so no TT is * involved with the root hub. (Except where one is integrated, * and there's no companion controller unless maybe for USB OTG.) * * Turning on the CF flag will transfer ownership of all ports * from the companions to the EHCI controller. If any of the * companions are in the middle of a port reset at the time, it * could cause trouble. Write-locking ehci_cf_port_reset_rwsem * guarantees that no resets are in progress. After we set CF, * a short delay lets the hardware catch up; new resets shouldn't * be started before the port switching actions could complete. */ down_write(&ehci_cf_port_reset_rwsem); hcd->state = HC_STATE_RUNNING; ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag); ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ msleep(5); up_write(&ehci_cf_port_reset_rwsem); ehci->last_periodic_enable = ktime_get_real(); = OpenBSD =================================================== dev/usb/ehci.c:505 /* Take over port ownership */ EOWRITE4(sc, EHCI_CONFIGFLAG, EHCI_CONF_CF); DPRINTFN(2, ("ehci: before loop\n")); /* LOCKUP HAPPENS HERE */ for (i = 0; i < 100; i++) { usb_delay_ms(&sc->sc_bus, 1); DPRINTFN(2, ("ehci: after sleep %d\n", i)); = OpenBSD ==================================================== dev/usb/usb_subr.c:336 /* Delay for a certain number of ms */ void usb_delay_ms(usbd_bus_handle bus, u_int ms) { /* Wait at least two clock ticks so we know the time has passed. */ if (bus->use_polling || cold) { DPRINTF(("usb_delay_ms: delaying for %u ms\n", ms)); delay((ms+1) * 1000); } else { DPRINTF(("usb_delay_ms: tsleeping for %u ms\n", ms)); tsleep(&ms, PRIBIO, "usbdly", (ms*hz+999)/1000 + 1); } } ============================================================== dmesg with 'legacy' turned on, but only 'FullSpeed': OpenBSD 4.7 (sys) #6: Sun Mar 7 16:14:48 CET 2010 madro...@pundit:/var/obj/sys real mem = 1071841280 (1022MB) avail mem = 1031872512 (984MB) mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.3 @ 0xf04b0 (57 entries) bios0: vendor American Megatrends Inc. version "0603" date 03/31/2006 bios0: ASUSTeK Computer INC. K8S-MV-P acpi0 at bios0: rev 2 acpi0: tables DSDT FACP APIC OEMB acpi0: wakeup devices PS2K(S4) PS2M(S4) EUSB(S4) USB_(S4) USB2(S4) USB3(S4) AC97(S4) MC97(S4) PCI1(S4) PCI2(S4) MAC_(S4) acpitimer0 at acpi0: 3579545 Hz, 24 bits acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: AMD Sempron(tm) Processor 3000+, 1795.72 MHz cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SSE3,NXE,MMXX,FFXSR,LONG,3DNOW2,3DNOW cpu0: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 128KB 64b/line 16-way L2 cache cpu0: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative cpu0: DTLB 32 4KB entries fully associative, 8 4MB entries fully associative cpu0: AMD erratum 89 present, BIOS upgrade may be required cpu0: apic clock running at 199MHz ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 14, 24 pins acpiprt0 at acpi0: bus 0 (PCI0) acpiprt1 at acpi0: bus 1 (P0P1) acpiprt2 at acpi0: bus 2 (P0P6) acpiprt3 at acpi0: bus 3 (P0P7) acpicpu0 at acpi0: PSS aibs0 at acpi0 acpibtn0 at acpi0: PWRB cpu0: Cool'n'Quiet K8 1795 MHz: speeds: 1800 1000 MHz pci0 at mainbus0 bus 0 pchb0 at pci0 dev 0 function 0 "SiS 760 PCI" rev 0x03 agp at pchb0 not configured ppb0 at pci0 dev 1 function 0 "SiS 86C202 VGA" rev 0x00 pci1 at ppb0 bus 1 vga1 at pci1 dev 0 function 0 "NVIDIA GeForce FX 5200" rev 0xa1 wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation) wsdisplay0: screen 1-5 added (80x25, vt100 emulation) pcib0 at pci0 dev 2 function 0 "SiS 965 ISA" rev 0x48 pciide0 at pci0 dev 2 function 5 "SiS 5513 EIDE" rev 0x01: 760: DMA, channel 0 wired to compatibility, channel 1 wired to compatibility atapiscsi0 at pciide0 channel 0 drive 0 scsibus0 at atapiscsi0: 2 targets cd0 at scsibus0 targ 0 lun 0: <TSSTcorp, DVD-ROM SH-D162C, TS04> ATAPI 5/cdrom removable cd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2 pciide0: channel 1 disabled (no drives) auich0 at pci0 dev 2 function 7 "SiS 7012 AC97" rev 0xa0: apic 1 int 18 (irq 11), SiS7012 AC97 ac97: codec id 0x41445368 (Analog Devices AD1888) ac97: codec features headphone, 20 bit DAC, No 3D Stereo audio0 at auich0 ohci0 at pci0 dev 3 function 0 "SiS 5597/5598 USB" rev 0x0f: apic 1 int 20 (irq 5), version 1.0, legacy support ohci1 at pci0 dev 3 function 1 "SiS 5597/5598 USB" rev 0x0f: apic 1 int 21 (irq 10), version 1.0, legacy support ohci2 at pci0 dev 3 function 2 "SiS 5597/5598 USB" rev 0x0f: apic 1 int 22 (irq 5), version 1.0, legacy support ehci0 at pci0 dev 3 function 3 "SiS 7002 USB" rev 0x00ehci0: offs=32 : apic 1 int 23 (irq 10) ehci0: waiting for BIOS to give up control ehci0: timed out waiting for BIOS ehci_init: start ehci0: EHCI version 1.0 ehci_init: sparams=0x103308 ehci_init: cparams=0x7070 ehci0: resetting ehci0: flsize=1024 ehci_alloc_sqh: allocating chunk ehci_alloc_sqh: allocating chunk ehci_alloc_sqh: allocating chunk ehci_alloc_sqh: allocating chunk ehci_alloc_sqh: allocating chunk ehci_alloc_sqh: allocating chunk ehci_alloc_sqh: allocating chunk ehci_alloc_sqh: allocating chunk QH(0xffff80000edc5000) at 0x02b58000: link=0x02b58002<QH> endp=0x0000a000 addr=0x00 inact=0 endpt=0 eps=2 dtc=0 hrecl=1 mpl=0x0 ctl=0 nrl=0 endphub=0x00000000 smask=0x00 cmask=0x00 huba=0x00 port=0 mult=0 curqtd=0x00000001<T> Overlay qTD: next=0x00000001<T> altnext=0x00000001<T> status=0x00000040: toggle=0 bytes=0x0 ioc=0 c_page=0x0 cerr=0 pid=0 stat=0x40<HALTED> buffer[0]=0x00000000 buffer[1]=0x00000000 buffer[2]=0x00000000 buffer[3]=0x00000000 buffer[4]=0x00000000 ehci: before loop ehci: after sleep 0 ehci: after EOREAD ehci: after loop usb0 at ehci0: USB revision 2.0 ehci_open: pipe=0xffff80000013ec00, addr=0, endpt=0 (0) ehci_root_ctrl_start: type=0x80 request=06 ehci_root_ctrl_start: wValue=0x0100 ehci_root_ctrl_start: type=0x80 request=06 ehci_root_ctrl_start: wValue=0x0100 ehci_root_ctrl_start: type=0x00 request=05 ehci_root_ctrl_start: type=0x80 request=06 ehci_root_ctrl_start: wValue=0x0300 ehci_root_ctrl_start: type=0x80 request=06 ehci_root_ctrl_start: wValue=0x0300 ehci_root_ctrl_start: type=0x80 request=06 ehci_root_ctrl_start: wValue=0x0301 ehci_root_ctrl_start: type=0x80 request=06 ehci_root_ctrl_start: wValue=0x0301 ehci_root_ctrl_start: type=0x80 request=06 ehci_root_ctrl_start: wValue=0x0302 ehci_root_ctrl_start: type=0x80 request=06 ehci_root_ctrl_start: wValue=0x0302 uhub0 at usb0ehci_root_ctrl_start: type=0x80 request=06 ehci_root_ctrl_start: wValue=0x0301 ehci_root_ctrl_start: type=0x80 request=06 ehci_root_ctrl_start: wValue=0x0301 ehci_root_ctrl_start: type=0x80 request=06 ehci_root_ctrl_start: wValue=0x0302 ehci_root_ctrl_start: type=0x80 request=06 ehci_root_ctrl_start: wValue=0x0302 "SiS EHCI root hub" rev 2.00/1.00 addr 1 ehci_root_ctrl_start: type=0x80 request=06 ehci_root_ctrl_start: wValue=0x0200 ehci_root_ctrl_start: type=0x80 request=06 ehci_root_ctrl_start: wValue=0x0200 ehci_root_ctrl_start: type=0x00 request=09 ehci_root_ctrl_start: type=0xa0 request=06 ehci_root_ctrl_start: type=0xa0 request=06 ehci_open: pipe=0xffff80000013fc00, addr=1, endpt=129 (1) ehci_root_ctrl_start: type=0x23 request=03 ehci_root_ctrl_start: set port power 1 ehci_root_ctrl_start: type=0x23 request=03 ehci_root_ctrl_start: set port power 2 ehci_root_ctrl_start: type=0x23 request=03 ehci_root_ctrl_start: set port power 3 ehci_root_ctrl_start: type=0x23 request=03 ehci_root_ctrl_start: set port power 4 ehci_root_ctrl_start: type=0x23 request=03 ehci_root_ctrl_start: set port power 5 ehci_root_ctrl_start: type=0x23 request=03 ehci_root_ctrl_start: set port power 6 ehci_root_ctrl_start: type=0x23 request=03 ehci_root_ctrl_start: set port power 7 ehci_root_ctrl_start: type=0x23 request=03 ehci_root_ctrl_start: set port power 8 sgb0 at pci0 dev 4 function 0 "SiS 190" rev 0x00invalid EEPROM signature (0) : apic 1 int 19 (irq 5), address 00:15:f2:64:0c:83 rlphy0 at sgb0 phy 1: RTL8201L 10/100 PHY, rev. 1 pciide1 at pci0 dev 5 function 0 "SiS 182 SATA" rev 0x01: DMA pciide1: using apic 1 int 17 (irq 10) for native-PCI interrupt wd0 at pciide1 channel 0 drive 0: <SAMSUNG SP2504C> wd0: 16-sector PIO, LBA48, 238475MB, 488397168 sectors wd0(pciide1:0:0): using PIO mode 4, Ultra-DMA mode 6 ppb1 at pci0 dev 6 function 0 "SiS PCI-PCI" rev 0x00 pci2 at ppb1 bus 2 ppb2 at pci0 dev 7 function 0 "SiS PCI-PCI" rev 0x00 pci3 at ppb2 bus 3 pchb1 at pci0 dev 24 function 0 "AMD AMD64 0Fh HyperTransport" rev 0x00 pchb2 at pci0 dev 24 function 1 "AMD AMD64 0Fh Address Map" rev 0x00 pchb3 at pci0 dev 24 function 2 "AMD AMD64 0Fh DRAM Cfg" rev 0x00 kate0 at pci0 dev 24 function 3 "AMD AMD64 0Fh Misc Cfg" rev 0x00 isa0 at pcib0 isadma0 at isa0 com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo pckbc0 at isa0 port 0x60/5 pcppi0 at isa0 port 0x61 midi0 at pcppi0: <PC speaker> spkr0 at pcppi0 lpt0 at isa0 port 0x378/4 irq 7 wbsio0 at isa0 port 0x2e/2: W83627EHF rev 0x54 lm1 at wbsio0 port 0x290/8: W83627EHF-A usb1 at ohci0: USB revision 1.0 uhub1 at usb1 "SiS OHCI root hub" rev 1.00/1.00 addr 1 usb2 at ohci1: USB revision 1.0 uhub2 at usb2 "SiS OHCI root hub" rev 1.00/1.00 addr 1 usb3 at ohci2: USB revision 1.0 uhub3 at usb3 "SiS OHCI root hub" rev 1.00/1.00 addr 1 ehci_intr1: enter ehci_intr1: sc=0xffff800000164000 intrs=0xc(0xc00c) eintrs=0x4 ehci_pcd: change=0x18 mtrr: Pentium Pro MTRR support ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=1 ehci_root_ctrl_start: port status=0x1000 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=2 ehci_root_ctrl_start: port status=0x1000 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=3 ehci_root_ctrl_start: port status=0x1403 ehci_root_ctrl_start: type=0x23 request=01 ehci_root_ctrl_start: UR_CLEAR_PORT_FEATURE port=3 feature=16 ehci_root_ctrl_start: type=0x23 request=03 ehci_root_ctrl_start: reset port 3 ehci_disown: index=3 lowspeed=1 ehci_intr1: enter ehci_intr1: sc=0xffff800000164000 intrs=0xc(0xc00c) eintrs=0x4 ehci_pcd: change=0x18 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=3 ehci_root_ctrl_start: port status=0x3002 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=3 ehci_root_ctrl_start: port status=0x3002 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=4 ehci_root_ctrl_start: port status=0x1403 ehci_root_ctrl_start: type=0x23 request=01 ehci_root_ctrl_start: UR_CLEAR_PORT_FEATURE port=4 feature=16 ehci_root_ctrl_start: type=0x23 request=03 ehci_root_ctrl_start: reset port 4 ehci_disown: index=4 lowspeed=1 ehci_intr1: enter ehci_intr1: sc=0xffff800000164000 intrs=0x4(0xc004) eintrs=0x4 ehci_pcd: change=0x18 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=4 ehci_root_ctrl_start: port status=0x3002 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=4 ehci_root_ctrl_start: port status=0x3002 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=5 ehci_root_ctrl_start: port status=0x1000 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=6 ehci_root_ctrl_start: port status=0x1000 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=7 ehci_root_ctrl_start: port status=0x1000 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=8 ehci_root_ctrl_start: port status=0x1000 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=1 ehci_root_ctrl_start: port status=0x1000 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=2 ehci_root_ctrl_start: port status=0x1000 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=3 ehci_root_ctrl_start: port status=0x3002 ehci_root_ctrl_start: type=0x23 request=01 ehci_root_ctrl_start: UR_CLEAR_PORT_FEATURE port=3 feature=16 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=4 ehci_root_ctrl_start: port status=0x3002 ehci_root_ctrl_start: type=0x23 request=01 ehci_root_ctrl_start: UR_CLEAR_PORT_FEATURE port=4 feature=16 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=5 ehci_root_ctrl_start: port status=0x1000 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=6 ehci_root_ctrl_start: port status=0x1000 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=7 ehci_root_ctrl_start: port status=0x1000 ehci_root_ctrl_start: type=0xa3 request=00 ehci_root_ctrl_start: get port status i=8 ehci_root_ctrl_start: port status=0x1000 uhidev0 at uhub1 port 2 configuration 1 interface 0 "Sun Microsystems Type 6 Keyboard" rev 1.10/2.00 addr 2 uhidev0: iclass 3/1 ukbd0 at uhidev0: 8 modifier keys, 6 key codes, country code 33 wskbd0 at ukbd0: console keyboard, using wsdisplay0 uhidev1 at uhub3 port 1 configuration 1 interface 0 "Logitech USB Optical Mouse" rev 2.00/43.01 addr 2 uhidev1: iclass 3/1 ums0 at uhidev1: 3 buttons, Z dir wsmouse0 at ums0 mux 0 vscsi0 at root scsibus1 at vscsi0: 256 targets softraid0 at root root on wd0a swap on wd0b dump on wd0b splassert: if_up: want 5 have 7