All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: linux-pci@vger.kernel.org
Cc: "Dexuan Cui" <dexuan.cui@intel.com>,
	"Matthew Wilcox" <matthew@wil.cx>,
	x86@kernel.org, "Felipe Balbi" <balbi@ti.com>,
	"Yu Zhao" <yu.zhao@intel.com>, "Huang Rui" <ray.huang@amd.com>,
	"Krzysztof Hałasa" <khalasa@piap.pl>,
	"Jason Chang" <jason.chang@amd.com>
Subject: [PATCH 2/6] PCI: Fix generic NCR 53c810 class code quirk
Date: Fri, 19 Jun 2015 17:42:30 -0500	[thread overview]
Message-ID: <20150619224230.14626.82853.stgit@bhelgaas-glaptop2.roam.corp.google.com> (raw)
In-Reply-To: <20150619223325.14626.66402.stgit@bhelgaas-glaptop2.roam.corp.google.com>

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 |   13 -------------
 drivers/pci/quirks.c |   14 +++++++++-----
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index 9a2b710..e585655 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -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)
 {
 	/*
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 2dab425..64177a6 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1997,14 +1997,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);
 

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in

  parent reply	other threads:[~2015-06-19 22:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19 22:42 [PATCH 0/6] PCI: Fix class code usage Bjorn Helgaas
2015-06-19 22:42 ` [PATCH 1/6] PCI: Use PCI_CLASS_SERIAL_USB instead of bare number Bjorn Helgaas
2015-06-23  2:07   ` Huang Rui
2015-06-19 22:42 ` Bjorn Helgaas [this message]
2015-06-19 22:58   ` [PATCH 2/6] PCI: Fix generic NCR 53c810 class code quirk Bjorn Helgaas
2015-06-19 22:42 ` [PATCH 3/6] PCI: Fix TI816X " Bjorn Helgaas
2015-06-19 22:42 ` [PATCH 4/6] PCI: Fix Intel generic reset quirk class code check Bjorn Helgaas
2015-06-19 23:06   ` Bjorn Helgaas
2015-06-24 20:46     ` Bjorn Helgaas
2015-06-19 22:42 ` [PATCH 5/6] PCI: Simplify reset_intel_generic_dev() Bjorn Helgaas
2015-06-19 22:42 ` [PATCH 6/6] PCI: Shift PCI_CLASS_NOT_DEFINED consistently with other classes Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150619224230.14626.82853.stgit@bhelgaas-glaptop2.roam.corp.google.com \
    --to=bhelgaas@google.com \
    --cc=balbi@ti.com \
    --cc=dexuan.cui@intel.com \
    --cc=jason.chang@amd.com \
    --cc=khalasa@piap.pl \
    --cc=linux-pci@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=ray.huang@amd.com \
    --cc=x86@kernel.org \
    --cc=yu.zhao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.