[haiku-bugs] Re: [Haiku] #2083: EHCI bus hanging at boot.

  • From: "vegardw" <trac@xxxxxxxxxxxx>
  • Date: Sun, 07 Mar 2010 13:10:12 -0000

#2083: EHCI bus hanging at boot.
-------------------------+--------------------------------------------------
 Reporter:  bga          |       Owner:  mmlr         
     Type:  bug          |      Status:  in-progress  
 Priority:  blocker      |   Milestone:  R1           
Component:  Drivers/USB  |     Version:  R1/pre-alpha1
 Keywords:               |   Blockedby:               
 Platform:  All          |    Blocking:               
-------------------------+--------------------------------------------------

Comment(by vegardw):

 EHCI is still hanging at boot for me with r35770. Have done some
 investigating today, and it hangs at the ''sPCIModule->write_pci_config''
 at [http://dev.haiku-os.org/browser/haiku/trunk/src/add-
 ons/kernel/busses/usb/ehci.cpp#L188 line 188] in src/add-
 ons/kernel/busses/usb/ehci.cpp, which never returns. If I add a
 TRACE_ALWAYS on the next line it is never printed. Also, "the host
 controller is bios owned" at line 185 is not printed, so ''if
 (legacySupport & EHCI_LEGSUP_BIOSOWNED)'' returns 0.

 {{{
 #!cpp
 184             if (legacySupport & EHCI_LEGSUP_BIOSOWNED)
 185                     TRACE_ALWAYS("the host controller is bios
 owned\n");
 186
 187             TRACE_ALWAYS("claiming ownership of the host
 controller\n");
 188             sPCIModule->write_pci_config(fPCIInfo->bus,
 fPCIInfo->device,
 189                     fPCIInfo->function, extendedCapPointer + 3, 1, 1);
 }}}

 I then took a look at the freebsd source,
 [http://fxr.watson.org/fxr/source/dev/usb/controller/ehci_pci.c#L559
 dev/usb/controllerechi.c], and noticed that they
 [http://fxr.watson.org/fxr/source/dev/usb/controller/ehci_pci.c#L568 only
 do the write if the host controller is BIOS owned].

 I then changed the haiku driver so that the write is only done if the host
 controller is BIOS owned, and haiku boots fine on my computer with that
 change applied:

 {{{
 Index: src/add-ons/kernel/busses/usb/ehci.cpp
 ===================================================================
 --- src/add-ons/kernel/busses/usb/ehci.cpp      (revision 35770)
 +++ src/add-ons/kernel/busses/usb/ehci.cpp      (working copy)
 @@ -181,12 +181,13 @@
                 uint32 legacySupport =
 sPCIModule->read_pci_config(fPCIInfo->bus,
                         fPCIInfo->device, fPCIInfo->function,
 extendedCapPointer, 4);
                 if ((legacySupport & EHCI_LEGSUP_CAPID_MASK) ==
 EHCI_LEGSUP_CAPID) {
 -                       if (legacySupport & EHCI_LEGSUP_BIOSOWNED)
 +                       if (legacySupport & EHCI_LEGSUP_BIOSOWNED) {
                                 TRACE_ALWAYS("the host controller is bios
 owned\n");

 -                       TRACE_ALWAYS("claiming ownership of the host
 controller\n");
 -                       sPCIModule->write_pci_config(fPCIInfo->bus,
 fPCIInfo->device,
 -                               fPCIInfo->function, extendedCapPointer +
 3, 1, 1);
 +                               TRACE_ALWAYS("claiming ownership of the
 host controller\n");
 +
 sPCIModule->write_pci_config(fPCIInfo->bus, fPCIInfo->device,
 +                                       fPCIInfo->function,
 extendedCapPointer + 3, 1, 1);
 +                       }

                         for (int32 i = 0; i < 20; i++) {
                                 legacySupport =
 sPCIModule->read_pci_config(fPCIInfo->bus,
 }}}

 I don't know if the way I did it is the correct way to fix it, but it
 worked for me.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/2083#comment:34>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: