Re: SB drive not detected after reboot on PC Engines APU2

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: SB drive not detected after reboot on PC Engines APU2

Marfaba Stewart
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, February 20, 2021 4:51 AM, Marcus Glocker <[hidden email]> wrote:

> On Fri, Feb 19, 2021 at 04:48:11PM +0000, marfabastewart wrote:
>
> > Synopsis: USB drive not detected after reboot on PC Engines APU2
> > Category: amd64
> > Environment:
> > System : OpenBSD 6.9
> > Details : OpenBSD 6.9-beta (GENERIC.MP) #343: Thu Feb 18 23:09:55 MST 2021
> > [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> > Architecture: OpenBSD.amd64
> > Machine : amd64
> > Description:
> > After leaving USB drive plugged in and then rebooting on
> > PC Engines APU2, my USB drive isn't detected. If I unplug
> > and replug into the same USB port, it doesn't change console
> > output or dmesg, even though the USB drive does get power.
> > Plugging into a different port triggers detection and the
> > drive can then be mounted. The USB drive I've tested is a
> > Western Digital Elements drive. The same thing happens on
> > multiple PC Engines APU2 units running -current for a while,
> > but unfortunately I procrastinated on reporting this. I can
> > attach the same drive to a desktop and a laptop running
> > current, and they detect it after reboot. The usbdevs
> > output below is after switching USB ports.
> > How-To-Repeat:
> > Leave USB drive in port. Reboot. Even removing and putting
> > in same port doesn't detect drive. Only switching to other
> > USB port detects drives.
> > Fix:
> > work around is put USB drive in other USB port after reboot.
>
> Is this dmesg showing the boot while the USB disk is attached?
>
> On my APU2 I see something similar, but not exactly the same. When a
> USB device is attached, the controller sometimes comes up in a non-
> halted state, and then the halt attempt fails.
>
> Controller already halted at boot, all good:
>
> xhci0 at pci0 dev 16 function 0 "AMD Bolton xHCI" rev 0x11: msi, xHCI 1.0
> halted=1
> i=0
> usb0 at xhci0: USB revision 3.0
>
> Controller not halted at boot, halt request fails/timeouts:
>
> xhci0 at pci0 dev 16 function 0 "AMD Bolton xHCI" rev 0x11: msi, xHCI 1.0
> halted=0
> i=100
> xhci0: halt timeout
> xhci0: reset timeout
> xhci0: init failed, error=5
>
> But in my case the controller attachment entirely fails, so switching
> port won't help.
>
> It might be some quirk related to the AMD Bolton xHCI controller, but
> though it looks like not exactly the same issue.
>
> You could boot again with this diff compiled in, while your USB disk
> is attached so we can get more clarity.
>
> Index: sys/dev/usb/xhci.c
>
> =====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
>
> RCS file: /cvs/src/sys/dev/usb/xhci.c,v
> retrieving revision 1.120
> diff -u -p -u -p -r1.120 xhci.c
> --- sys/dev/usb/xhci.c 24 Dec 2020 14:11:38 -0000 1.120
> +++ sys/dev/usb/xhci.c 20 Feb 2021 10:48:57 -0000
> @@ -560,6 +560,9 @@ xhci_reset(struct xhci_softc *sc)
> uint32_t hcr;
> int i;
>
> -   hcr = XOREAD4(sc, XHCI_USBSTS) & XHCI_STS_HCH;
> -   printf("halted=%d\n", hcr);
> -   XOWRITE4(sc, XHCI_USBCMD, 0); /* Halt controller */
>     for (i = 0; i < 100; i++) {
>     usb_delay_ms(&sc->sc_bus, 1);
>
>
> @@ -567,6 +570,7 @@ xhci_reset(struct xhci_softc *sc)
> if (hcr)
> break;
> }
>
> -   printf("i=%d\n", i);
>
>     if (!hcr)
>     printf("%s: halt timeout\n", DEVNAME(sc));
>

Hi. The dmesg was with the USB drive attached. I
plugged it to the other USB port so it would
be detected and copied the output of sendbug.

I will apply the patch as soon as possible and
let you know. I hope to do it today.

Thanks!

(My subject line was a copy/paste fail -- I missed the
"U" in "USB" from the synopsis.)