Re: [RFC 2/4] Intel xhci: Support EHCI/xHCI port switching.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 26, 2011 at 01:46:34PM -0400, Alan Stern wrote:
> On Thu, 26 May 2011, Sarah Sharp wrote:
> 
> > On Thu, May 26, 2011 at 10:21:23AM -0400, Alan Stern wrote:
> > > On Wed, 25 May 2011, Sarah Sharp wrote:
> > > > Instead, the solution I came up was to make the EHCI driver switch over
> > > > the ports in its PCI probe function.  It's not pretty, since the EHCI
> > > > driver has to search for the xHCI PCI device and then write into its
> > > > PCI configuration space, but I think it's the simplest solution.
> > > 
> > > Logically, the right place to do this is in pci-quirks.c.  Add whatever 
> > > you need to quirk_usb_handoff_xhci().
> > 
> > How can you be sure the xHCI PCI quirks will be run before the EHCI
> > driver's PCI probe function gets called?  Do the quirks get run before
> > any PCI devices get probed?
> 
> I think so, but I'm not sure.  PCI device initialization takes place in
> two stages: detection and probing.  I think detection runs through all
> devices before probing starts, and I think the quirks get applied at
> various times but all before probing starts.  Or maybe this holds only 
> on a per-bus basis, but that should be okay since the EHCI and xHCI 
> controllers you're talking about will be on the same bus, right?
> 
> Hopefully Jesse can tell us for sure if this is correct.

At least Matthew Wilcox confirmed that the PCI quirks that are
initialized with the DECLARE_PCI_FIXUP_FINAL will be called for all PCI
devices before any PCI probe functions are called.  I added some
debugging to the USB PCI quirks and booted with initcall_debug on, and
it seems to be true:


[    5.565870] calling  pci_apply_final_quirks+0x0/0x106 @ 1
[    5.571269] xHCI PCI quirk
[    5.574024] EHCI PCI quirk
[    5.576721] pci 0000:00:1a.0: EHCI: BIOS handoff
[    5.600912] EHCI PCI quirk
[    5.603611] pci 0000:00:1d.0: EHCI: BIOS handoff
[    5.620888] pci 0000:01:00.0: Boot video device
...
[   16.678369] usbcore: registered new interface driver usbfs
[   16.700312] usbcore: registered new interface driver hub
[   16.720904] calling  ahci_init+0x0/0x1000 [ahci] @ 210
[   16.727336] usbcore: registered new device driver usb
[   16.727344] initcall usb_init+0x0/0x16d [usbcore] returned 0 after 48192 usecs
[   16.786418] calling  ehci_hcd_init+0x0/0x1000 [ehci_hcd] @ 205
[   16.808746] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   16.831011] ehci_hcd: block sizes: qh 104 qtd 96 itd 192 sitd 96

So I'll rework this patchset to move the PCI ID to the correctly ordered
spot and then move the switchover into the xHCI PCI quirk.  I think if I
want to switchover the ports after the system resumes (because the BIOS
might be stupid and switch them back under EHCI when it takes control in
the pre-OS resume path), then I should also define a PCI quirk for that,
using DECLARE_PCI_FIXUP_RESUME.  Does that sound correct?

Sarah Sharp
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux