Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Mar 2018 04:42:29 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r331342 - head/sys/dev/cxgbe/common
Message-ID:  <201803220442.w2M4gTDM021154@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Thu Mar 22 04:42:29 2018
New Revision: 331342
URL: https://svnweb.freebsd.org/changeset/base/331342

Log:
  cxgbe(4): Do not read MFG diags information from custom boards.
  
  MFC after:	1 week
  Sponsored by:	Chelsio Communications

Modified:
  head/sys/dev/cxgbe/common/t4_hw.c

Modified: head/sys/dev/cxgbe/common/t4_hw.c
==============================================================================
--- head/sys/dev/cxgbe/common/t4_hw.c	Thu Mar 22 04:16:14 2018	(r331341)
+++ head/sys/dev/cxgbe/common/t4_hw.c	Thu Mar 22 04:42:29 2018	(r331342)
@@ -2960,7 +2960,7 @@ static int get_vpd_keyword_val(const u8 *vpd, const ch
  *	Reads card parameters stored in VPD EEPROM.
  */
 static int get_vpd_params(struct adapter *adapter, struct vpd_params *p,
-    u32 *buf)
+    uint16_t device_id, u32 *buf)
 {
 	int i, ret, addr;
 	int ec, sn, pn, na, md;
@@ -3028,12 +3028,16 @@ static int get_vpd_params(struct adapter *adapter, str
 	memcpy(p->na, vpd + na, min(i, MACADDR_LEN));
 	strstrip((char *)p->na);
 
+	if (device_id & 0x80)
+		return 0;	/* Custom card */
+
 	md = get_vpd_keyword_val(vpd, "VF", 1);
 	if (md < 0) {
 		snprintf(p->md, sizeof(p->md), "unknown");
 	} else {
 		i = vpd[md - VPD_INFO_FLD_HDR_SIZE + 2];
 		memcpy(p->md, vpd + md, min(i, MD_LEN));
+		strstrip((char *)p->md);
 	}
 
 	return 0;
@@ -8053,10 +8057,6 @@ int t4_prep_adapter(struct adapter *adapter, u32 *buf)
 	if (ret < 0)
 		return ret;
 
-	ret = get_vpd_params(adapter, &adapter->params.vpd, buf);
-	if (ret < 0)
-		return ret;
-
 	/* Cards with real ASICs have the chipid in the PCIe device id */
 	t4_os_pci_read_cfg2(adapter, PCI_DEVICE_ID, &device_id);
 	if (device_id >> 12 == chip_id(adapter))
@@ -8066,6 +8066,10 @@ int t4_prep_adapter(struct adapter *adapter, u32 *buf)
 		adapter->params.fpga = 1;
 		adapter->params.cim_la_size = 2 * CIMLA_SIZE;
 	}
+
+	ret = get_vpd_params(adapter, &adapter->params.vpd, device_id, buf);
+	if (ret < 0)
+		return ret;
 
 	init_cong_ctrl(adapter->params.a_wnd, adapter->params.b_wnd);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803220442.w2M4gTDM021154>