Re: USB4BSD release candidate number 3 - request for review

From: Paul B. Mahol <onemda_at_gmail.com>
Date: Sun, 9 Nov 2008 18:15:16 +0100
On 11/9/08, Hans Petter Selasky <hselasky_at_c2i.net> wrote:
> On Saturday 08 November 2008, Paul B. Mahol wrote:
>> On 11/7/08, Hans Petter Selasky <hselasky_at_c2i.net> wrote:
>> > On Friday 07 November 2008, Paul B. Mahol wrote:
>> >> On 11/7/08, M. Warner Losh <imp_at_bsdimp.com> wrote:
>> >> > : > After some time it will appear but will start attaching and
>> >> > : > dettaching all the time:
>> >
>> > How quick is this happening? There has been some changes to the
>> > sys/dev/usb2/core/uhub2.c file recently, which control how HUB is
>> > responding to events.
>>
>> ~3 seconds.
>>
>> I got also this messages:
>>
>> uhci1: LegSup = 0x2f00
>                    ^^^^ Legacy support is complaining about something!
>
>> uhci_interrupt: host controller halted
>> uhci_dumpregs:705: usbus1 regs: cmd=0000, sts=0020, intr=0000,
>> frnum=0000, flbase=3f7fa000, sof=0040, portsc1=0080, portsc2=0080
>> uhci_dump_qh:779: QH(0xc627e900) at 0x05a7e902: h_next=0x05a7db82
>> e_next=0x00000001
>> uhci_dump_qh:779: QH(0xc627db80) at 0x05a7db82: h_next=0x05a7dc02
>> e_next=0x00000001
>> uhci_dump_qh:779: QH(0xc627dc00) at 0x05a7dc02: h_next=0x05a7dc82
>> e_next=0x00000001
>> uhci_dump_qh:779: QH(0xc627dc80) at 0x05a7dc82: h_next=0x00000001
>> e_next=0x05a7dd00
>> uhci_interrupt: host controller halted
>> uhci_dumpregs:705: usbus1 regs: cmd=0000, sts=0020, intr=0000,
>> frnum=0000, flbase=3f7fa000, sof=0040, portsc1=0080, portsc2=0080
>> uhci_dump_qh:779: QH(0xc627e900) at 0x05a7e902: h_next=0x05a7db82
>> e_next=0x00000001
>> uhci_dump_qh:779: QH(0xc627db80) at 0x05a7db82: h_next=0x05a7dc02
>> e_next=0x00000001
>> uhci_dump_qh:779: QH(0xc627dc00) at 0x05a7dc02: h_next=0x05a7dc82
>> e_next=0x00000001
>> uhci_dump_qh:779: QH(0xc627dc80) at 0x05a7dc82: h_next=0x00000001
>> e_next=0x05a7dd00
>>
>> Doesnt looks like hub is source of fault, one from perforce with
>> 152460 comitt is not available
>> in CURRENT and with latest version of usb2_hub.c from perforce problem
>> is still there.
>>
>> > Maybe you can get the date of that file from the build where it works
>> > and
>> > the
>> > build where it doesn't work, and I will check the differences.
>>
>> Last time I tested usb2 from svn was before huge modularization.
>
> Yes, then it probably has something to do with Legacy USB support.
>
> Some suggestions:
>
> 0) Have you tried putting the USB modules in the kernel ?
>
> 1) Try not loading the EHCI driver. Does the UHCI driver work without the
> host 
> controller halted error?
>
> 2) sys/dev/usb2/controller/uhci2_pci.c
>
> Try moving the pci_read/pci_write lines before the IRQ is setup:
>
> #if (__FreeBSD_version >= 700031)
>         err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | 
> INTR_MPSAFE,
>             NULL, (void *)(void *)uhci_interrupt, sc, &sc->sc_intr_hdl);
> #else
>         err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | 
> INTR_MPSAFE,
>             (void *)(void *)uhci_interrupt, sc, &sc->sc_intr_hdl);
> #endif
>
>         if (err) {
>                 device_printf(self, "Could not setup irq, %d\n", err);
>                 sc->sc_intr_hdl = NULL;
>                 goto error;
>         }
>         /*
>          * Set the PIRQD enable bit and switch off all the others. We don't
>          * want legacy support to interfere with us XXX Does this also mean
>          * that the BIOS won't touch the keyboard anymore if it is connected
>          * to the ports of the root hub?
>          */
> #if USB_DEBUG
>         if (pci_read_config(self, PCI_LEGSUP, 2) != PCI_LEGSUP_USBPIRQDEN) {
>                 device_printf(self, "LegSup = 0x%04x\n",
>                     pci_read_config(self, PCI_LEGSUP, 2));
>         }
> #endif
>         pci_write_config(self, PCI_LEGSUP, PCI_LEGSUP_USBPIRQDEN, 2);
>
> 3) There has been some changes to the EHCI legacy support code recently. Try
> the same in EHCI: Move "ehci_pci_takecontroller" before the IRQ is setup:
>
> sys/dev/usb2/controller/ehci2_pci.c
>
> #if (__FreeBSD_version >= 700031)
>         err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | 
> INTR_MPSAFE,
>             NULL, (void *)(void *)ehci_interrupt, sc, &sc->sc_intr_hdl);
> #else
>         err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | 
> INTR_MPSAFE,
>             (void *)(void *)ehci_interrupt, sc, &sc->sc_intr_hdl);
> #endif
>         if (err) {
>                 device_printf(self, "Could not setup irq, %d\n", err);
>                 sc->sc_intr_hdl = NULL;
>                 goto error;
>         }
>         ehci_pci_takecontroller(self);
>
> You only need to recompile and reinstall the USB2 modules after these
> changes.
>
> Try one suggestion at a time so that we can do some elimination.

Real source of problem was card itself (similar errors were happening in oldusb, linux and windows)

Another card works fine. Sorry for the noise.
Received on Sun Nov 09 2008 - 16:15:17 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:37 UTC