diff options
author | Benjamin Li <benli@broadcom.com> | 2008-07-02 13:59:04 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2008-07-02 14:25:54 -0400 |
commit | 99cb233d60cbe644203f19938c729ea2bb004d70 (patch) | |
tree | 20fb5b9194982ff50d6795dc435dd8e09264233e /drivers/pci/quirks.c | |
parent | a94c248113b86bbbc47d027a4004b70f2be298b1 (diff) |
PCI: Limit VPD read/write lengths for Broadcom 5706, 5708, 5709 rev.
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 limit the read/write length.
A majority of this patch is from Matthew Wilcox who gave code for
reworking the PCI vpd size information. A PCI quirk added for the
Broadcom NIC's to limit the read/write's.
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/quirks.c')
-rw-r--r-- | drivers/pci/quirks.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index dabb563f51d9..a3497dc6ebcf 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1670,6 +1670,48 @@ static void __devinit quirk_via_cx700_pci_parking_caching(struct pci_dev *dev) | |||
1670 | } | 1670 | } |
1671 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_VIA, 0x324e, quirk_via_cx700_pci_parking_caching); | 1671 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_VIA, 0x324e, quirk_via_cx700_pci_parking_caching); |
1672 | 1672 | ||
1673 | /* | ||
1674 | * For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the | ||
1675 | * VPD end tag will hang the device. This problem was initially | ||
1676 | * observed when a vpd entry was created in sysfs | ||
1677 | * ('/sys/bus/pci/devices/<id>/vpd'). A read to this sysfs entry | ||
1678 | * will dump 32k of data. Reading a full 32k will cause an access | ||
1679 | * beyond the VPD end tag causing the device to hang. Once the device | ||
1680 | * is hung, the bnx2 driver will not be able to reset the device. | ||
1681 | * We believe that it is legal to read beyond the end tag and | ||
1682 | * therefore the solution is to limit the read/write length. | ||
1683 | */ | ||
1684 | static void __devinit quirk_brcm_570x_limit_vpd(struct pci_dev *dev) | ||
1685 | { | ||
1686 | /* Only disable the VPD capability for 5706, 5708, and 5709 rev. A */ | ||
1687 | if ((dev->device == PCI_DEVICE_ID_NX2_5706) || | ||
1688 | (dev->device == PCI_DEVICE_ID_NX2_5708) || | ||
1689 | ((dev->device == PCI_DEVICE_ID_NX2_5709) && | ||
1690 | (dev->revision & 0xf0) == 0x0)) { | ||
1691 | if (dev->vpd) | ||
1692 | dev->vpd->len = 0x80; | ||
1693 | } | ||
1694 | } | ||
1695 | |||
1696 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, | ||
1697 | PCI_DEVICE_ID_NX2_5706, | ||
1698 | quirk_brcm_570x_limit_vpd); | ||
1699 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, | ||
1700 | PCI_DEVICE_ID_NX2_5706S, | ||
1701 | quirk_brcm_570x_limit_vpd); | ||
1702 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, | ||
1703 | PCI_DEVICE_ID_NX2_5708, | ||
1704 | quirk_brcm_570x_limit_vpd); | ||
1705 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, | ||
1706 | PCI_DEVICE_ID_NX2_5708S, | ||
1707 | quirk_brcm_570x_limit_vpd); | ||
1708 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, | ||
1709 | PCI_DEVICE_ID_NX2_5709, | ||
1710 | quirk_brcm_570x_limit_vpd); | ||
1711 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, | ||
1712 | PCI_DEVICE_ID_NX2_5709S, | ||
1713 | quirk_brcm_570x_limit_vpd); | ||
1714 | |||
1673 | #ifdef CONFIG_PCI_MSI | 1715 | #ifdef CONFIG_PCI_MSI |
1674 | /* Some chipsets do not support MSI. We cannot easily rely on setting | 1716 | /* Some chipsets do not support MSI. We cannot easily rely on setting |
1675 | * PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually | 1717 | * PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually |