|
@@ -3076,6 +3076,179 @@ int t4_get_exprom_version(struct adapter *adap, u32 *vers)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * t4_get_vpd_version - return the VPD version
|
|
|
+ * @adapter: the adapter
|
|
|
+ * @vers: where to place the version
|
|
|
+ *
|
|
|
+ * Reads the VPD via the Firmware interface (thus this can only be called
|
|
|
+ * once we're ready to issue Firmware commands). The format of the
|
|
|
+ * VPD version is adapter specific. Returns 0 on success, an error on
|
|
|
+ * failure.
|
|
|
+ *
|
|
|
+ * Note that early versions of the Firmware didn't include the ability
|
|
|
+ * to retrieve the VPD version, so we zero-out the return-value parameter
|
|
|
+ * in that case to avoid leaving it with garbage in it.
|
|
|
+ *
|
|
|
+ * Also note that the Firmware will return its cached copy of the VPD
|
|
|
+ * Revision ID, not the actual Revision ID as written in the Serial
|
|
|
+ * EEPROM. This is only an issue if a new VPD has been written and the
|
|
|
+ * Firmware/Chip haven't yet gone through a RESET sequence. So it's best
|
|
|
+ * to defer calling this routine till after a FW_RESET_CMD has been issued
|
|
|
+ * if the Host Driver will be performing a full adapter initialization.
|
|
|
+ */
|
|
|
+int t4_get_vpd_version(struct adapter *adapter, u32 *vers)
|
|
|
+{
|
|
|
+ u32 vpdrev_param;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ vpdrev_param = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
|
|
|
+ FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_VPDREV));
|
|
|
+ ret = t4_query_params(adapter, adapter->mbox, adapter->pf, 0,
|
|
|
+ 1, &vpdrev_param, vers);
|
|
|
+ if (ret)
|
|
|
+ *vers = 0;
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * t4_get_scfg_version - return the Serial Configuration version
|
|
|
+ * @adapter: the adapter
|
|
|
+ * @vers: where to place the version
|
|
|
+ *
|
|
|
+ * Reads the Serial Configuration Version via the Firmware interface
|
|
|
+ * (thus this can only be called once we're ready to issue Firmware
|
|
|
+ * commands). The format of the Serial Configuration version is
|
|
|
+ * adapter specific. Returns 0 on success, an error on failure.
|
|
|
+ *
|
|
|
+ * Note that early versions of the Firmware didn't include the ability
|
|
|
+ * to retrieve the Serial Configuration version, so we zero-out the
|
|
|
+ * return-value parameter in that case to avoid leaving it with
|
|
|
+ * garbage in it.
|
|
|
+ *
|
|
|
+ * Also note that the Firmware will return its cached copy of the Serial
|
|
|
+ * Initialization Revision ID, not the actual Revision ID as written in
|
|
|
+ * the Serial EEPROM. This is only an issue if a new VPD has been written
|
|
|
+ * and the Firmware/Chip haven't yet gone through a RESET sequence. So
|
|
|
+ * it's best to defer calling this routine till after a FW_RESET_CMD has
|
|
|
+ * been issued if the Host Driver will be performing a full adapter
|
|
|
+ * initialization.
|
|
|
+ */
|
|
|
+int t4_get_scfg_version(struct adapter *adapter, u32 *vers)
|
|
|
+{
|
|
|
+ u32 scfgrev_param;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ scfgrev_param = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
|
|
|
+ FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_SCFGREV));
|
|
|
+ ret = t4_query_params(adapter, adapter->mbox, adapter->pf, 0,
|
|
|
+ 1, &scfgrev_param, vers);
|
|
|
+ if (ret)
|
|
|
+ *vers = 0;
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * t4_get_version_info - extract various chip/firmware version information
|
|
|
+ * @adapter: the adapter
|
|
|
+ *
|
|
|
+ * Reads various chip/firmware version numbers and stores them into the
|
|
|
+ * adapter Adapter Parameters structure. If any of the efforts fails
|
|
|
+ * the first failure will be returned, but all of the version numbers
|
|
|
+ * will be read.
|
|
|
+ */
|
|
|
+int t4_get_version_info(struct adapter *adapter)
|
|
|
+{
|
|
|
+ int ret = 0;
|
|
|
+
|
|
|
+ #define FIRST_RET(__getvinfo) \
|
|
|
+ do { \
|
|
|
+ int __ret = __getvinfo; \
|
|
|
+ if (__ret && !ret) \
|
|
|
+ ret = __ret; \
|
|
|
+ } while (0)
|
|
|
+
|
|
|
+ FIRST_RET(t4_get_fw_version(adapter, &adapter->params.fw_vers));
|
|
|
+ FIRST_RET(t4_get_bs_version(adapter, &adapter->params.bs_vers));
|
|
|
+ FIRST_RET(t4_get_tp_version(adapter, &adapter->params.tp_vers));
|
|
|
+ FIRST_RET(t4_get_exprom_version(adapter, &adapter->params.er_vers));
|
|
|
+ FIRST_RET(t4_get_scfg_version(adapter, &adapter->params.scfg_vers));
|
|
|
+ FIRST_RET(t4_get_vpd_version(adapter, &adapter->params.vpd_vers));
|
|
|
+
|
|
|
+ #undef FIRST_RET
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * t4_dump_version_info - dump all of the adapter configuration IDs
|
|
|
+ * @adapter: the adapter
|
|
|
+ *
|
|
|
+ * Dumps all of the various bits of adapter configuration version/revision
|
|
|
+ * IDs information. This is typically called at some point after
|
|
|
+ * t4_get_version_info() has been called.
|
|
|
+ */
|
|
|
+void t4_dump_version_info(struct adapter *adapter)
|
|
|
+{
|
|
|
+ /* Device information */
|
|
|
+ dev_info(adapter->pdev_dev, "Chelsio %s rev %d\n",
|
|
|
+ adapter->params.vpd.id,
|
|
|
+ CHELSIO_CHIP_RELEASE(adapter->params.chip));
|
|
|
+ dev_info(adapter->pdev_dev, "S/N: %s, P/N: %s\n",
|
|
|
+ adapter->params.vpd.sn, adapter->params.vpd.pn);
|
|
|
+
|
|
|
+ /* Firmware Version */
|
|
|
+ if (!adapter->params.fw_vers)
|
|
|
+ dev_warn(adapter->pdev_dev, "No firmware loaded\n");
|
|
|
+ else
|
|
|
+ dev_info(adapter->pdev_dev, "Firmware version: %u.%u.%u.%u\n",
|
|
|
+ FW_HDR_FW_VER_MAJOR_G(adapter->params.fw_vers),
|
|
|
+ FW_HDR_FW_VER_MINOR_G(adapter->params.fw_vers),
|
|
|
+ FW_HDR_FW_VER_MICRO_G(adapter->params.fw_vers),
|
|
|
+ FW_HDR_FW_VER_BUILD_G(adapter->params.fw_vers));
|
|
|
+
|
|
|
+ /* Bootstrap Firmware Version. (Some adapters don't have Bootstrap
|
|
|
+ * Firmware, so dev_info() is more appropriate here.)
|
|
|
+ */
|
|
|
+ if (!adapter->params.bs_vers)
|
|
|
+ dev_info(adapter->pdev_dev, "No bootstrap loaded\n");
|
|
|
+ else
|
|
|
+ dev_info(adapter->pdev_dev, "Bootstrap version: %u.%u.%u.%u\n",
|
|
|
+ FW_HDR_FW_VER_MAJOR_G(adapter->params.bs_vers),
|
|
|
+ FW_HDR_FW_VER_MINOR_G(adapter->params.bs_vers),
|
|
|
+ FW_HDR_FW_VER_MICRO_G(adapter->params.bs_vers),
|
|
|
+ FW_HDR_FW_VER_BUILD_G(adapter->params.bs_vers));
|
|
|
+
|
|
|
+ /* TP Microcode Version */
|
|
|
+ if (!adapter->params.tp_vers)
|
|
|
+ dev_warn(adapter->pdev_dev, "No TP Microcode loaded\n");
|
|
|
+ else
|
|
|
+ dev_info(adapter->pdev_dev,
|
|
|
+ "TP Microcode version: %u.%u.%u.%u\n",
|
|
|
+ FW_HDR_FW_VER_MAJOR_G(adapter->params.tp_vers),
|
|
|
+ FW_HDR_FW_VER_MINOR_G(adapter->params.tp_vers),
|
|
|
+ FW_HDR_FW_VER_MICRO_G(adapter->params.tp_vers),
|
|
|
+ FW_HDR_FW_VER_BUILD_G(adapter->params.tp_vers));
|
|
|
+
|
|
|
+ /* Expansion ROM version */
|
|
|
+ if (!adapter->params.er_vers)
|
|
|
+ dev_info(adapter->pdev_dev, "No Expansion ROM loaded\n");
|
|
|
+ else
|
|
|
+ dev_info(adapter->pdev_dev,
|
|
|
+ "Expansion ROM version: %u.%u.%u.%u\n",
|
|
|
+ FW_HDR_FW_VER_MAJOR_G(adapter->params.er_vers),
|
|
|
+ FW_HDR_FW_VER_MINOR_G(adapter->params.er_vers),
|
|
|
+ FW_HDR_FW_VER_MICRO_G(adapter->params.er_vers),
|
|
|
+ FW_HDR_FW_VER_BUILD_G(adapter->params.er_vers));
|
|
|
+
|
|
|
+ /* Serial Configuration version */
|
|
|
+ dev_info(adapter->pdev_dev, "Serial Configuration version: %#x\n",
|
|
|
+ adapter->params.scfg_vers);
|
|
|
+
|
|
|
+ /* VPD Version */
|
|
|
+ dev_info(adapter->pdev_dev, "VPD version: %#x\n",
|
|
|
+ adapter->params.vpd_vers);
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* t4_check_fw_version - check if the FW is supported with this driver
|
|
|
* @adap: the adapter
|