[PATCH] PCI: add MSI INTX_DISABLE quirks for AR8161/AR8162/AR8171/AR8172

Wei Yang weiyang at linux.vnet.ibm.com
Thu Mar 7 04:42:14 EST 2013


On Wed, Mar 06, 2013 at 01:59:07PM +0800, xiong wrote:
>From: "Huang,Xiong" <xiong at qca.qualcomm.com>
>
>PCI devices of AR8161/AR8162/AR8171/AR8172 which revision lower than
>0x18 have this bug.
>
>Signed-off-by: Huang,Xiong <xiong at qca.qualcomm.com>
>---
> drivers/pci/quirks.c    | 35 +++++++++++++++++++++++++++++++++++
> include/linux/pci_ids.h |  4 ++++
> 2 files changed, 39 insertions(+)
>
>diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
>index 0369fb6..bf31d72 100644
>--- a/drivers/pci/quirks.c
>+++ b/drivers/pci/quirks.c
>@@ -2594,6 +2594,29 @@ static void quirk_msi_intx_disable_ati_bug(struct pci_dev *dev)
> 		dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
> 	pci_dev_put(p);
> }
>+static void quirk_msi_intx_disable_qca_bug(struct pci_dev *dev)
>+{
>+	static u16 qca_eth_devid[] = {
>+			PCI_DEVICE_ID_AR8161,
>+			PCI_DEVICE_ID_AR8162,
>+			PCI_DEVICE_ID_AR8171,
>+			PCI_DEVICE_ID_AR8172};
>+	struct pci_dev *p;
>+	int i;
>+
>+	/* AR816X/AR817X MSI is fixed at HW level from revision 0x18 */
>+	for (i = 0; i < ARRAY_SIZE(qca_eth_devid); i++) {
>+		p = pci_get_device(PCI_VENDOR_ID_ATTANSIC,
>+				   qca_eth_devid[i],

xiong,

The "FINAL" fixup is called just in pci_apply_final_quirks(), if I am correct. 

In this function, it will go through all the pci devices which are registered
in the system. And try to invoke the fixup hook.

Also, before invode the hook, in function pci_do_fixups() it will make sure
the hook just apply to the devices whose VendorID and DeviceID match what you
defined in DECLARE_PCI_FIXUP_FINAL.

So I think there is no need to iterate on all those pci device, before you
want to change the pci_dev->dev_flags.

>+				   NULL);
>+		if (!p)
>+			return;
>+
>+		if (p->revision < 0x18)
>+			dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
>+		pci_dev_put(p);
>+	}
>+}
> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
> 			PCI_DEVICE_ID_TIGON3_5780,
> 			quirk_msi_intx_disable_bug);
>@@ -2643,6 +2666,18 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, 0x1073,
> 			quirk_msi_intx_disable_bug);
> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, 0x1083,
> 			quirk_msi_intx_disable_bug);
>+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC,
>+			PCI_DEVICE_ID_AR8161,
>+			quirk_msi_intx_disable_qca_bug);
>+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC,
>+			PCI_DEVICE_ID_AR8162,
>+			quirk_msi_intx_disable_qca_bug);
>+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC,
>+			PCI_DEVICE_ID_AR8171,
>+			quirk_msi_intx_disable_qca_bug);
>+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC,
>+			PCI_DEVICE_ID_AR8172,
>+			quirk_msi_intx_disable_qca_bug);
> #endif /* CONFIG_PCI_MSI */
>
> /* Allow manual resource allocation for PCI hotplug bridges
>diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
>index f11c1c2..7e171fb 100644
>--- a/include/linux/pci_ids.h
>+++ b/include/linux/pci_ids.h
>@@ -2438,6 +2438,10 @@
> #define PCI_VENDOR_ID_ATTANSIC		0x1969
> #define PCI_DEVICE_ID_ATTANSIC_L1	0x1048
> #define PCI_DEVICE_ID_ATTANSIC_L2	0x2048
>+#define PCI_DEVICE_ID_AR8161		0x1091
>+#define PCI_DEVICE_ID_AR8162		0x1090
>+#define PCI_DEVICE_ID_AR8171		0x10A1
>+#define PCI_DEVICE_ID_AR8172		0x10A0
>
> #define PCI_VENDOR_ID_JMICRON		0x197B
> #define PCI_DEVICE_ID_JMICRON_JMB360	0x2360
>-- 
>1.7.11.7
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-pci" in
>the body of a message to majordomo at vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Richard Yang
Help you, Help me




More information about the unified-drivers mailing list