]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
PCI: Fix generic NCR 53c810 class code quirk
authorBjorn Helgaas <bhelgaas@google.com>
Fri, 19 Jun 2015 20:36:45 +0000 (15:36 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 14 Jul 2015 18:39:44 +0000 (13:39 -0500)
In the generic quirk fixup_rev1_53c810(), added by a5312e28c195 ("[PATCH]
PCI: NCR 53c810 quirk"), we assigned "class = PCI_CLASS_STORAGE_SCSI".  But
PCI_CLASS_STORAGE_SCSI is only the two-byte base class/sub-class and needs
to be shifted to make space for the low-order interface byte.

Furthermore, we had a similar quirk, pci_fixup_ncr53c810(), for arch/x86,
which assigned class correctly.  The arch code is linked before the PCI
core, so arch quirks run before generic quirks.  Therefore, on x86, the x86
arch quirk ran first, and the generic quirk did nothing because it saw that
dev->class was already set.  But on other arches, the generic quirk set the
wrong class code.

Fix the generic quirk to set the correct class code and remove the
now-unnecessary x86-specific quirk.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Matthew Wilcox <matthew@wil.cx>
arch/x86/pci/fixup.c
drivers/pci/quirks.c

index 9a2b7101ae8af6d402f15c66831bcd15b7790325..e58565556703bfc781e29f4e387cbd0e2ea1ced8 100644 (file)
@@ -62,19 +62,6 @@ static void pci_fixup_umc_ide(struct pci_dev *d)
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF, pci_fixup_umc_ide);
 
-static void pci_fixup_ncr53c810(struct pci_dev *d)
-{
-       /*
-        * NCR 53C810 returns class code 0 (at least on some systems).
-        * Fix class to be PCI_CLASS_STORAGE_SCSI
-        */
-       if (!d->class) {
-               dev_warn(&d->dev, "Fixing NCR 53C810 class code\n");
-               d->class = PCI_CLASS_STORAGE_SCSI << 8;
-       }
-}
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, pci_fixup_ncr53c810);
-
 static void pci_fixup_latency(struct pci_dev *d)
 {
        /*
index ecaad8f39681d3757238b698981ac5ceb3e9e77d..afc8151f4ca5caeeb98c7633441a39b960762cdb 100644 (file)
@@ -1988,14 +1988,18 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s);
 
 static void fixup_rev1_53c810(struct pci_dev *dev)
 {
-       /* rev 1 ncr53c810 chips don't set the class at all which means
+       u32 class = dev->class;
+
+       /*
+        * rev 1 ncr53c810 chips don't set the class at all which means
         * they don't get their resources remapped. Fix that here.
         */
+       if (class)
+               return;
 
-       if (dev->class == PCI_CLASS_NOT_DEFINED) {
-               dev_info(&dev->dev, "NCR 53c810 rev 1 detected; setting PCI class\n");
-               dev->class = PCI_CLASS_STORAGE_SCSI;
-       }
+       dev->class = PCI_CLASS_STORAGE_SCSI << 8;
+       dev_info(&dev->dev, "NCR 53c810 rev 1 PCI class overridden (%#08x -> %#08x)\n",
+                class, dev->class);
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810);