[PATCH] PCI: Disable VPD capability in Broadcom 5706, 5708, 5709 rev. A nics

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

 



For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the
VPD end tag will hang the device.  This problem was initially
observed when a vpd entry was created in sysfs
('/sys/bus/pci/devices/<id>/vpd').   A read to this sysfs entry
will dump 32k of data.  Reading a full 32k will cause an access
beyond the VPD end tag causing the device to hang.  Once the device
is hung, the bnx2 driver will not be able to reset the device.
We believe that it is legal to read beyond the end tag and
therefore the solution is to disable the VPD capability and
not expose this data.

Signed-off-by: Benjamin Li <benli@xxxxxxxxxxxx>
Signed-off-by: Michael Chan <mchan@xxxxxxxxxxxx>
---
 drivers/pci/quirks.c |   68 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index dabb563..46b9f2f 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1670,6 +1670,74 @@ static void __devinit quirk_via_cx700_pci_parking_caching(struct pci_dev *dev)
 }
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_VIA, 0x324e, quirk_via_cx700_pci_parking_caching);
 
+
+/*
+ * For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the
+ * VPD end tag will hang the device.  This problem was initially
+ * observed when a vpd entry was created in sysfs
+ * ('/sys/bus/pci/devices/<id>/vpd').   A read to this sysfs entry
+ * will dump 32k of data.  Reading a full 32k will cause an access
+ * beyond the VPD end tag causing the device to hang.  Once the device
+ * is hung, the bnx2 driver will not be able to reset the device.
+ * We believe that it is legal to read beyond the end tag and
+ * therefore the solution is to disable the VPD capability and
+ * not expose this data.
+ */
+static void __devinit quirk_brcm_570x_disable_vpd(struct pci_dev *dev)
+{
+	u8 rev;
+	u16 device_id;
+
+	/*  Get PCI device ID and revision number */
+	pci_read_config_word(dev, PCI_DEVICE_ID, &device_id);
+	pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
+
+	/* Configure byte swap and enable write to the reg_window registers */
+	pci_write_config_dword(dev, 0x68, (1L<<7) /* enable reg_window reg */ |
+					  (1L<<3) /* configure byte swap */);
+
+	/*  Only disable the VPD capability for 5706, 5708, and 5709 rev. A */
+	if ((device_id == PCI_DEVICE_ID_NX2_5706) ||
+	    (device_id == PCI_DEVICE_ID_NX2_5708) ||
+	    ((device_id == PCI_DEVICE_ID_NX2_5709) &&
+	     (rev & 0xf0) == 0x0)) {
+		u32 cap_ena;
+
+		/*  set proper window to id_val4 */
+		pci_write_config_dword(dev, 0x78, 0x440);
+
+		/* Only enable PM, MSI, MSIX, PCIE */
+		pci_read_config_dword(dev, 0x80, &cap_ena);
+
+		if ((device_id == PCI_DEVICE_ID_NX2_5706) ||
+		    (device_id == PCI_DEVICE_ID_NX2_5708))
+			cap_ena = (cap_ena & 0xffffffff0) | 0x0e;
+		else
+			cap_ena = (cap_ena & 0xffffffff0) | 0x0b;
+
+		pci_write_config_dword(dev, 0x80, cap_ena);
+	}
+}
+
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM,
+			PCI_DEVICE_ID_NX2_5706,
+			quirk_brcm_570x_disable_vpd);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM,
+			PCI_DEVICE_ID_NX2_5706S,
+			quirk_brcm_570x_disable_vpd);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM,
+			PCI_DEVICE_ID_NX2_5708,
+			quirk_brcm_570x_disable_vpd);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM,
+			PCI_DEVICE_ID_NX2_5708S,
+			quirk_brcm_570x_disable_vpd);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM,
+			PCI_DEVICE_ID_NX2_5709,
+			quirk_brcm_570x_disable_vpd);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM,
+			PCI_DEVICE_ID_NX2_5709S,
+			quirk_brcm_570x_disable_vpd);
+
 #ifdef CONFIG_PCI_MSI
 /* Some chipsets do not support MSI. We cannot easily rely on setting
  * PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually
-- 
1.5.5.1


--
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