Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Nov 2008 18:15:16 +0100
From:      "Paul B. Mahol" <onemda@gmail.com>
To:        "Hans Petter Selasky" <hselasky@c2i.net>
Cc:        freebsd-current@freebsd.org, freebsd-usb@freebsd.org
Subject:   Re: USB4BSD release candidate number 3 - request for review
Message-ID:  <3a142e750811090915u389a3bfeqf4a13fc8b6c70c5d@mail.gmail.com>
In-Reply-To: <200811091039.55889.hselasky@c2i.net>
References:  <3a142e750811071154y5108f299h60bb7c1060f4567e@mail.gmail.com> <200811072236.38267.hselasky@c2i.net> <3a142e750811081442kc746a41j41d3d46e6688033f@mail.gmail.com> <200811091039.55889.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11/9/08, Hans Petter Selasky <hselasky@c2i.net> wrote:
> On Saturday 08 November 2008, Paul B. Mahol wrote:
>> On 11/7/08, Hans Petter Selasky <hselasky@c2i.net> wrote:
>> > On Friday 07 November 2008, Paul B. Mahol wrote:
>> >> On 11/7/08, M. Warner Losh <imp@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3a142e750811090915u389a3bfeqf4a13fc8b6c70c5d>