[PATCH] Don't touch USB controllers with MMIO disabled in quirks

From: Paul Mackerras
Date: Mon Oct 31 2005 - 23:04:05 EST


Recently a quirk was added which attempts to do usb-handoff on all USB
host controllers on all platforms. This is causing machine checks on
various machines such as my G4 powerbook, because the quirk code
attempts to do MMIO to the device without calling pci_enable_device,
or even checking that MMIO is enabled.

I still think that a FIXUP_HEADER header is the wrong place to be
doing this sort of thing, and that code that touches a device without
doing pci_enable_device is just asking for trouble; however, in order
to get my machine to be able to boot, this patch adds a check that
MMIO is enabled for the device, and if it isn't, leaves the device
alone. With this patch my powerbook will boot.

Signed-off-by: Paul Mackerras <paulus@xxxxxxxxx>
---

diff -urN powerpc-merge/drivers/usb/host/pci-quirks.c merge-hack/drivers/usb/host/pci-quirks.c
--- powerpc-merge/drivers/usb/host/pci-quirks.c 2005-10-31 13:15:27.000000000 +1100
+++ merge-hack/drivers/usb/host/pci-quirks.c 2005-11-01 14:47:47.000000000 +1100
@@ -286,6 +286,11 @@

static void __devinit quirk_usb_early_handoff(struct pci_dev *pdev)
{
+ u16 cmd;
+
+ if (pci_read_config_word(pdev, PCI_COMMAND, &cmd) ||
+ (cmd & PCI_COMMAND_MEMORY) == 0)
+ return;
if (pdev->class == PCI_CLASS_SERIAL_USB_UHCI)
quirk_usb_handoff_uhci(pdev);
else if (pdev->class == PCI_CLASS_SERIAL_USB_OHCI)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/