aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/chelsio
diff options
context:
space:
mode:
authorHariprasad Shenai <hariprasad@chelsio.com>2014-09-01 10:24:56 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-02 02:00:41 -0400
commit63a92fe6f7e40069086be21bf9fbcfbe8d001345 (patch)
tree8f16985a0db625b82634620cf960af19e947f07b /drivers/net/ethernet/chelsio
parent444018a7f1f46d588328498777cab5a9f4d29105 (diff)
cxgb4: Fixed the code to use correct length for part number
Previously it was using the length value of serial number. Also added macro for VPD unique identifier (0x82). Signed-off-by: Casey Leedom <leedom@chelsio.com> Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/chelsio')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_hw.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 6b92c4c5a241..adf16a54da26 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -566,6 +566,7 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr,
566#define VPD_BASE 0x400 566#define VPD_BASE 0x400
567#define VPD_BASE_OLD 0 567#define VPD_BASE_OLD 0
568#define VPD_LEN 1024 568#define VPD_LEN 1024
569#define CHELSIO_VPD_UNIQUE_ID 0x82
569 570
570/** 571/**
571 * t4_seeprom_wp - enable/disable EEPROM write protection 572 * t4_seeprom_wp - enable/disable EEPROM write protection
@@ -603,7 +604,14 @@ int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
603 ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(u32), vpd); 604 ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(u32), vpd);
604 if (ret < 0) 605 if (ret < 0)
605 goto out; 606 goto out;
606 addr = *vpd == 0x82 ? VPD_BASE : VPD_BASE_OLD; 607
608 /* The VPD shall have a unique identifier specified by the PCI SIG.
609 * For chelsio adapters, the identifier is 0x82. The first byte of a VPD
610 * shall be CHELSIO_VPD_UNIQUE_ID (0x82). The VPD programming software
611 * is expected to automatically put this entry at the
612 * beginning of the VPD.
613 */
614 addr = *vpd == CHELSIO_VPD_UNIQUE_ID ? VPD_BASE : VPD_BASE_OLD;
607 615
608 ret = pci_read_vpd(adapter->pdev, addr, VPD_LEN, vpd); 616 ret = pci_read_vpd(adapter->pdev, addr, VPD_LEN, vpd);
609 if (ret < 0) 617 if (ret < 0)
@@ -667,6 +675,7 @@ int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
667 i = pci_vpd_info_field_size(vpd + sn - PCI_VPD_INFO_FLD_HDR_SIZE); 675 i = pci_vpd_info_field_size(vpd + sn - PCI_VPD_INFO_FLD_HDR_SIZE);
668 memcpy(p->sn, vpd + sn, min(i, SERNUM_LEN)); 676 memcpy(p->sn, vpd + sn, min(i, SERNUM_LEN));
669 strim(p->sn); 677 strim(p->sn);
678 i = pci_vpd_info_field_size(vpd + pn - PCI_VPD_INFO_FLD_HDR_SIZE);
670 memcpy(p->pn, vpd + pn, min(i, PN_LEN)); 679 memcpy(p->pn, vpd + pn, min(i, PN_LEN));
671 strim(p->pn); 680 strim(p->pn);
672 681