Re: [RFC v2] USB: Fix handoff when BIOS disables host PCI device.

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

 



Hi Oliver,

Have you gotten a chance to test this patch on your test system?  I'd
like to get it out, but I want to make sure it fixes your problem.

Thanks,
Sarah Sharp

On Thu, Feb 09, 2012 at 12:13:54PM -0800, Sarah Sharp wrote:
> On some systems with an Intel Panther Point xHCI host controller, the
> BIOS disables the xHCI PCI device during boot, and switches the xHCI
> ports over to EHCI.  This allows the BIOS to access USB devices without
> having xHCI support.
> 
> The downside is that the xHCI BIOS handoff mechanism will fail because
> memory mapped I/O is not enabled for the disabled PCI device.
> Jesse Barnes says this is expected behavior.  The PCI core will enable
> BARs before quirks run, but it will leave it in an undefined state, and
> it may not have memory mapped I/O enabled.
> 
> Make the generic USB quirk handler call pci_enable_device() to re-enable
> MMIO, and call pci_disable_device() once the host-specific BIOS handoff
> is finished.  This will balance the ref counts in the PCI core.  When
> the PCI probe function is called, usb_hcd_pci_probe() will call
> pci_enable_device() again.
> 
> This should be backported to kernels as old as 2.6.32.  That was the
> first kernel with xHCI support, and no one has complained about BIOS
> handoffs failing due to memory mapped I/O being disabled on other hosts
> (EHCI, UHCI, or OHCI).
> 
> Signed-off-by: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx>
> Cc: Oliver Neukum <oneukum@xxxxxxx>
> Cc: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx>
> Cc: stable@xxxxxxxxxx
> ---
>  drivers/usb/host/pci-quirks.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
> index ac53a66..7732d69 100644
> --- a/drivers/usb/host/pci-quirks.c
> +++ b/drivers/usb/host/pci-quirks.c
> @@ -872,7 +872,17 @@ static void __devinit quirk_usb_early_handoff(struct pci_dev *pdev)
>  	 */
>  	if (pdev->vendor == 0x184e)	/* vendor Netlogic */
>  		return;
> +	if (pdev->class != PCI_CLASS_SERIAL_USB_UHCI &&
> +			pdev->class != PCI_CLASS_SERIAL_USB_OHCI &&
> +			pdev->class != PCI_CLASS_SERIAL_USB_EHCI &&
> +			pdev->class != PCI_CLASS_SERIAL_USB_XHCI)
> +		return;
>  
> +	if (pci_enable_device(pdev) < 0) {
> +		dev_warn(&pdev->dev, "Can't enable PCI device, "
> +				"BIOS handoff failed.\n");
> +		return;
> +	}
>  	if (pdev->class == PCI_CLASS_SERIAL_USB_UHCI)
>  		quirk_usb_handoff_uhci(pdev);
>  	else if (pdev->class == PCI_CLASS_SERIAL_USB_OHCI)
> @@ -881,5 +891,6 @@ static void __devinit quirk_usb_early_handoff(struct pci_dev *pdev)
>  		quirk_usb_disable_ehci(pdev);
>  	else if (pdev->class == PCI_CLASS_SERIAL_USB_XHCI)
>  		quirk_usb_handoff_xhci(pdev);
> +	pci_disable_device(pdev);
>  }
>  DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_usb_early_handoff);
> -- 
> 1.7.9
> 
> --
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux