linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] pci: Limit VPD length of Emulex adapters to the actual length supported.
@ 2014-10-16  8:46 Venkat Duvvuru
  2014-10-23 15:40 ` Bjorn Helgaas
  0 siblings, 1 reply; 11+ messages in thread
From: Venkat Duvvuru @ 2014-10-16  8:46 UTC (permalink / raw)
  To: linux-pci; +Cc: Venkat Duvvuru

By default pci utilities/subsystem tries to read 32k bytes of vpd data no matter
what the device supports. This can lead to unexpected behavior depending
on how each of the devices handle this condition. This patch fixes the
problem for Emulex adapter family.

v1:
Addressed Bjorn's comments
1. Removed Vendor id and Device id macros from pci_ids.h and
   using the Vendor and Device id values directly in DECLARE_PCI_FIXUP_FINAL() lines.

Signed-off-by: Venkat Duvvuru <VenkatKumar.Duvvuru@Emulex.com>
---
 drivers/pci/quirks.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 80c2d01..95d88f3 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -3832,3 +3832,36 @@ void pci_dev_specific_enable_acs(struct pci_dev *dev)
 		}
 	}
 }
+
+#define SLI_INTF_REG_OFFSET     0x58
+#define SLI_INTF_FT_MASK        0x00000001
+static void quirk_elx_limit_vpd(struct pci_dev *dev)
+{
+	int virtfn;
+	u32 sli_intf;
+
+	pci_read_config_dword(dev, SLI_INTF_REG_OFFSET, &sli_intf);
+	virtfn = (sli_intf & SLI_INTF_FT_MASK) ? 1 : 0;
+
+	if (dev->vpd) {
+		if (virtfn)
+			dev->vpd->len = 0x200;
+		else
+			dev->vpd->len = 0x400;
+	}
+}
+
+DECLARE_PCI_FIXUP_FINAL(0x19a2, 0x211, quirk_elx_limit_vpd);
+DECLARE_PCI_FIXUP_FINAL(0x19a2, 0x221, quirk_elx_limit_vpd);
+/* BE2 */
+DECLARE_PCI_FIXUP_FINAL(0x19a2, 0x700, quirk_elx_limit_vpd);
+/* BE3 */
+DECLARE_PCI_FIXUP_FINAL(0x19a2, 0x710, quirk_elx_limit_vpd);
+/* LANCER */
+DECLARE_PCI_FIXUP_FINAL(0x10df, 0xe220, quirk_elx_limit_vpd);
+/* LANCER VF */
+DECLARE_PCI_FIXUP_FINAL(0x10df, 0xe228, quirk_elx_limit_vpd);
+/* SKYHAWK */
+DECLARE_PCI_FIXUP_FINAL(0x10df, 0x720, quirk_elx_limit_vpd);
+/* SKYHAWK VF */
+DECLARE_PCI_FIXUP_FINAL(0x10df, 0x728, quirk_elx_limit_vpd);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-11-18 11:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-16  8:46 [PATCH v1] pci: Limit VPD length of Emulex adapters to the actual length supported Venkat Duvvuru
2014-10-23 15:40 ` Bjorn Helgaas
2014-10-30 13:38   ` Venkat Duvvuru
2014-10-30 15:32     ` Bjorn Helgaas
2014-11-03 12:18       ` Venkat Duvvuru
2014-11-04 17:34         ` Bjorn Helgaas
2014-11-17 15:12           ` Venkat Duvvuru
2014-11-17 23:32             ` Bjorn Helgaas
2014-11-18  0:06               ` Anish Bhatt
2014-11-18  0:35                 ` Casey Leedom
2014-11-18 11:26               ` Venkat Duvvuru

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).