@@ -3076,6 +3076,179 @@ int t4_get_exprom_version(struct adapter *adap, u32 *vers)
30763076 return 0 ;
30773077}
30783078
3079+ /**
3080+ * t4_get_vpd_version - return the VPD version
3081+ * @adapter: the adapter
3082+ * @vers: where to place the version
3083+ *
3084+ * Reads the VPD via the Firmware interface (thus this can only be called
3085+ * once we're ready to issue Firmware commands). The format of the
3086+ * VPD version is adapter specific. Returns 0 on success, an error on
3087+ * failure.
3088+ *
3089+ * Note that early versions of the Firmware didn't include the ability
3090+ * to retrieve the VPD version, so we zero-out the return-value parameter
3091+ * in that case to avoid leaving it with garbage in it.
3092+ *
3093+ * Also note that the Firmware will return its cached copy of the VPD
3094+ * Revision ID, not the actual Revision ID as written in the Serial
3095+ * EEPROM. This is only an issue if a new VPD has been written and the
3096+ * Firmware/Chip haven't yet gone through a RESET sequence. So it's best
3097+ * to defer calling this routine till after a FW_RESET_CMD has been issued
3098+ * if the Host Driver will be performing a full adapter initialization.
3099+ */
3100+ int t4_get_vpd_version (struct adapter * adapter , u32 * vers )
3101+ {
3102+ u32 vpdrev_param ;
3103+ int ret ;
3104+
3105+ vpdrev_param = (FW_PARAMS_MNEM_V (FW_PARAMS_MNEM_DEV ) |
3106+ FW_PARAMS_PARAM_X_V (FW_PARAMS_PARAM_DEV_VPDREV ));
3107+ ret = t4_query_params (adapter , adapter -> mbox , adapter -> pf , 0 ,
3108+ 1 , & vpdrev_param , vers );
3109+ if (ret )
3110+ * vers = 0 ;
3111+ return ret ;
3112+ }
3113+
3114+ /**
3115+ * t4_get_scfg_version - return the Serial Configuration version
3116+ * @adapter: the adapter
3117+ * @vers: where to place the version
3118+ *
3119+ * Reads the Serial Configuration Version via the Firmware interface
3120+ * (thus this can only be called once we're ready to issue Firmware
3121+ * commands). The format of the Serial Configuration version is
3122+ * adapter specific. Returns 0 on success, an error on failure.
3123+ *
3124+ * Note that early versions of the Firmware didn't include the ability
3125+ * to retrieve the Serial Configuration version, so we zero-out the
3126+ * return-value parameter in that case to avoid leaving it with
3127+ * garbage in it.
3128+ *
3129+ * Also note that the Firmware will return its cached copy of the Serial
3130+ * Initialization Revision ID, not the actual Revision ID as written in
3131+ * the Serial EEPROM. This is only an issue if a new VPD has been written
3132+ * and the Firmware/Chip haven't yet gone through a RESET sequence. So
3133+ * it's best to defer calling this routine till after a FW_RESET_CMD has
3134+ * been issued if the Host Driver will be performing a full adapter
3135+ * initialization.
3136+ */
3137+ int t4_get_scfg_version (struct adapter * adapter , u32 * vers )
3138+ {
3139+ u32 scfgrev_param ;
3140+ int ret ;
3141+
3142+ scfgrev_param = (FW_PARAMS_MNEM_V (FW_PARAMS_MNEM_DEV ) |
3143+ FW_PARAMS_PARAM_X_V (FW_PARAMS_PARAM_DEV_SCFGREV ));
3144+ ret = t4_query_params (adapter , adapter -> mbox , adapter -> pf , 0 ,
3145+ 1 , & scfgrev_param , vers );
3146+ if (ret )
3147+ * vers = 0 ;
3148+ return ret ;
3149+ }
3150+
3151+ /**
3152+ * t4_get_version_info - extract various chip/firmware version information
3153+ * @adapter: the adapter
3154+ *
3155+ * Reads various chip/firmware version numbers and stores them into the
3156+ * adapter Adapter Parameters structure. If any of the efforts fails
3157+ * the first failure will be returned, but all of the version numbers
3158+ * will be read.
3159+ */
3160+ int t4_get_version_info (struct adapter * adapter )
3161+ {
3162+ int ret = 0 ;
3163+
3164+ #define FIRST_RET (__getvinfo ) \
3165+ do { \
3166+ int __ret = __getvinfo; \
3167+ if (__ret && !ret) \
3168+ ret = __ret; \
3169+ } while (0)
3170+
3171+ FIRST_RET (t4_get_fw_version (adapter , & adapter -> params .fw_vers ));
3172+ FIRST_RET (t4_get_bs_version (adapter , & adapter -> params .bs_vers ));
3173+ FIRST_RET (t4_get_tp_version (adapter , & adapter -> params .tp_vers ));
3174+ FIRST_RET (t4_get_exprom_version (adapter , & adapter -> params .er_vers ));
3175+ FIRST_RET (t4_get_scfg_version (adapter , & adapter -> params .scfg_vers ));
3176+ FIRST_RET (t4_get_vpd_version (adapter , & adapter -> params .vpd_vers ));
3177+
3178+ #undef FIRST_RET
3179+ return ret ;
3180+ }
3181+
3182+ /**
3183+ * t4_dump_version_info - dump all of the adapter configuration IDs
3184+ * @adapter: the adapter
3185+ *
3186+ * Dumps all of the various bits of adapter configuration version/revision
3187+ * IDs information. This is typically called at some point after
3188+ * t4_get_version_info() has been called.
3189+ */
3190+ void t4_dump_version_info (struct adapter * adapter )
3191+ {
3192+ /* Device information */
3193+ dev_info (adapter -> pdev_dev , "Chelsio %s rev %d\n" ,
3194+ adapter -> params .vpd .id ,
3195+ CHELSIO_CHIP_RELEASE (adapter -> params .chip ));
3196+ dev_info (adapter -> pdev_dev , "S/N: %s, P/N: %s\n" ,
3197+ adapter -> params .vpd .sn , adapter -> params .vpd .pn );
3198+
3199+ /* Firmware Version */
3200+ if (!adapter -> params .fw_vers )
3201+ dev_warn (adapter -> pdev_dev , "No firmware loaded\n" );
3202+ else
3203+ dev_info (adapter -> pdev_dev , "Firmware version: %u.%u.%u.%u\n" ,
3204+ FW_HDR_FW_VER_MAJOR_G (adapter -> params .fw_vers ),
3205+ FW_HDR_FW_VER_MINOR_G (adapter -> params .fw_vers ),
3206+ FW_HDR_FW_VER_MICRO_G (adapter -> params .fw_vers ),
3207+ FW_HDR_FW_VER_BUILD_G (adapter -> params .fw_vers ));
3208+
3209+ /* Bootstrap Firmware Version. (Some adapters don't have Bootstrap
3210+ * Firmware, so dev_info() is more appropriate here.)
3211+ */
3212+ if (!adapter -> params .bs_vers )
3213+ dev_info (adapter -> pdev_dev , "No bootstrap loaded\n" );
3214+ else
3215+ dev_info (adapter -> pdev_dev , "Bootstrap version: %u.%u.%u.%u\n" ,
3216+ FW_HDR_FW_VER_MAJOR_G (adapter -> params .bs_vers ),
3217+ FW_HDR_FW_VER_MINOR_G (adapter -> params .bs_vers ),
3218+ FW_HDR_FW_VER_MICRO_G (adapter -> params .bs_vers ),
3219+ FW_HDR_FW_VER_BUILD_G (adapter -> params .bs_vers ));
3220+
3221+ /* TP Microcode Version */
3222+ if (!adapter -> params .tp_vers )
3223+ dev_warn (adapter -> pdev_dev , "No TP Microcode loaded\n" );
3224+ else
3225+ dev_info (adapter -> pdev_dev ,
3226+ "TP Microcode version: %u.%u.%u.%u\n" ,
3227+ FW_HDR_FW_VER_MAJOR_G (adapter -> params .tp_vers ),
3228+ FW_HDR_FW_VER_MINOR_G (adapter -> params .tp_vers ),
3229+ FW_HDR_FW_VER_MICRO_G (adapter -> params .tp_vers ),
3230+ FW_HDR_FW_VER_BUILD_G (adapter -> params .tp_vers ));
3231+
3232+ /* Expansion ROM version */
3233+ if (!adapter -> params .er_vers )
3234+ dev_info (adapter -> pdev_dev , "No Expansion ROM loaded\n" );
3235+ else
3236+ dev_info (adapter -> pdev_dev ,
3237+ "Expansion ROM version: %u.%u.%u.%u\n" ,
3238+ FW_HDR_FW_VER_MAJOR_G (adapter -> params .er_vers ),
3239+ FW_HDR_FW_VER_MINOR_G (adapter -> params .er_vers ),
3240+ FW_HDR_FW_VER_MICRO_G (adapter -> params .er_vers ),
3241+ FW_HDR_FW_VER_BUILD_G (adapter -> params .er_vers ));
3242+
3243+ /* Serial Configuration version */
3244+ dev_info (adapter -> pdev_dev , "Serial Configuration version: %#x\n" ,
3245+ adapter -> params .scfg_vers );
3246+
3247+ /* VPD Version */
3248+ dev_info (adapter -> pdev_dev , "VPD version: %#x\n" ,
3249+ adapter -> params .vpd_vers );
3250+ }
3251+
30793252/**
30803253 * t4_check_fw_version - check if the FW is supported with this driver
30813254 * @adap: the adapter
0 commit comments