diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index bac6072fbbde..6d429700a4fc 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1597,6 +1597,25 @@ struct hdd_dynamic_mac { uint8_t bit_position; }; +/** + * hdd_fw_ver_info - FW version info structure + * @major_spid: FW version - major spid. + * @minor_spid: FW version - minor spid + * @siid: FW version - siid + * @sub_id: FW version - sub id + * @rel_id: FW version - release id + * @crmid: FW version - crmid + */ + +struct hdd_fw_ver_info { + uint32_t major_spid; + uint32_t minor_spid; + uint32_t siid; + uint32_t sub_id; + uint32_t rel_id; + uint32_t crmid; +}; + /** * struct hdd_context - hdd shared driver and psoc/device context * @psoc: object manager psoc context @@ -1691,6 +1710,7 @@ struct hdd_context { /* defining the firmware version */ uint32_t target_fw_version; uint32_t target_fw_vers_ext; + struct hdd_fw_ver_info fw_version_info; /* defining the chip/rom version */ uint32_t target_hw_version; @@ -2450,12 +2470,9 @@ static inline bool hdd_scan_random_mac_addr_supported(void) */ int hdd_start_vendor_acs(struct hdd_adapter *adapter); -void hdd_get_fw_version(struct hdd_context *hdd_ctx, - uint32_t *major_spid, uint32_t *minor_spid, - uint32_t *siid, uint32_t *crmid); /** * hdd_acs_response_timeout_handler() - timeout handler for acs_timer - * @context : timeout handler context + * @context: timeout handler context * * Return: None */ diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 1753f1a69d2a..b61cfe51c19b 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -4858,9 +4858,6 @@ __wlan_hdd_cfg80211_get_wifi_info(struct wiphy *wiphy, struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX + 1]; tSirVersionString driver_version; tSirVersionString firmware_version; - const char *hw_version; - uint32_t major_spid = 0, minor_spid = 0, siid = 0, crmid = 0; - uint32_t sub_id = 0; int status; struct sk_buff *reply_skb; uint32_t skb_len = 0, count = 0; @@ -4894,13 +4891,15 @@ __wlan_hdd_cfg80211_get_wifi_info(struct wiphy *wiphy, if (tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION]) { hdd_debug("Rcvd req for FW version"); - hdd_get_fw_version(hdd_ctx, &major_spid, &minor_spid, &siid, - &crmid); - sub_id = (hdd_ctx->target_fw_vers_ext & 0xf0000000) >> 28; - hw_version = hdd_ctx->target_hw_name; snprintf(firmware_version, sizeof(firmware_version), - "FW:%d.%d.%d.%d.%d HW:%s", major_spid, minor_spid, - siid, crmid, sub_id, hw_version); + "FW:%d.%d.%d.%d.%d.%d HW:%s", + hdd_ctx->fw_version_info.major_spid, + hdd_ctx->fw_version_info.minor_spid, + hdd_ctx->fw_version_info.siid, + hdd_ctx->fw_version_info.rel_id, + hdd_ctx->fw_version_info.crmid, + hdd_ctx->fw_version_info.sub_id, + hdd_ctx->target_hw_name); skb_len += strlen(firmware_version) + 1; count++; } diff --git a/core/hdd/src/wlan_hdd_debugfs_connect.c b/core/hdd/src/wlan_hdd_debugfs_connect.c index d80f4188dcd7..f673b14c1dd9 100644 --- a/core/hdd/src/wlan_hdd_debugfs_connect.c +++ b/core/hdd/src/wlan_hdd_debugfs_connect.c @@ -42,13 +42,9 @@ static ssize_t wlan_hdd_version_info_debugfs(struct hdd_context *hdd_ctx, uint8_t *buf, ssize_t buf_avail_len) { - uint32_t major_spid = 0, minor_spid = 0, siid = 0, crmid = 0, sub_id; ssize_t length = 0; int ret_val; - hdd_get_fw_version(hdd_ctx, &major_spid, &minor_spid, &siid, &crmid); - sub_id = (hdd_ctx->target_fw_vers_ext & 0xf0000000) >> 28; - ret_val = scnprintf(buf, buf_avail_len, "\nVERSION DETAILS\n"); if (ret_val <= 0) @@ -62,10 +58,15 @@ wlan_hdd_version_info_debugfs(struct hdd_context *hdd_ctx, uint8_t *buf, ret_val = scnprintf(buf + length, buf_avail_len - length, "Host Driver Version: %s\n" - "Firmware Version: %d.%d.%d.%d.%d\n" + "Firmware Version: %d.%d.%d.%d.%d.%d\n" "Hardware Version: %s\n", QWLAN_VERSIONSTR, - major_spid, minor_spid, siid, crmid, sub_id, + hdd_ctx->fw_version_info.major_spid, + hdd_ctx->fw_version_info.minor_spid, + hdd_ctx->fw_version_info.siid, + hdd_ctx->fw_version_info.rel_id, + hdd_ctx->fw_version_info.crmid, + hdd_ctx->fw_version_info.sub_id, hdd_ctx->target_hw_name); if (ret_val <= 0) return length; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index bc89e46c2c64..9efe83e49bb3 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -257,6 +257,15 @@ static qdf_wake_lock_t wlan_wake_lock; #define IS_IDLE_STOP (!cds_is_driver_unloading() && \ !cds_is_driver_recovering() && !cds_is_driver_loading()) +#define HDD_FW_VER_MAJOR_SPID(tgt_fw_ver) ((tgt_fw_ver & 0xf0000000) >> 28) +#define HDD_FW_VER_MINOR_SPID(tgt_fw_ver) ((tgt_fw_ver & 0xf000000) >> 24) +#define HDD_FW_VER_SIID(tgt_fw_ver) ((tgt_fw_ver & 0xf00000) >> 20) +#define HDD_FW_VER_CRM_ID(tgt_fw_ver) (tgt_fw_ver & 0x7fff) +#define HDD_FW_VER_SUB_ID(tgt_fw_ver_ext) \ +((tgt_fw_ver_ext & 0xf0000000) >> 28) +#define HDD_FW_VER_REL_ID(tgt_fw_ver_ext) \ +((tgt_fw_ver_ext & 0xf800000) >> 23) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) static const struct wiphy_wowlan_support wowlan_support_reg_init = { .flags = WIPHY_WOWLAN_ANY | @@ -1770,6 +1779,22 @@ static void hdd_update_vhtcap_2g(struct hdd_context *hdd_ctx) } } +static void hdd_extract_fw_version_info(struct hdd_context *hdd_ctx) +{ + hdd_ctx->fw_version_info.major_spid = + HDD_FW_VER_MAJOR_SPID(hdd_ctx->target_fw_version); + hdd_ctx->fw_version_info.minor_spid = + HDD_FW_VER_MINOR_SPID(hdd_ctx->target_fw_version); + hdd_ctx->fw_version_info.siid = + HDD_FW_VER_SIID(hdd_ctx->target_fw_version); + hdd_ctx->fw_version_info.crmid = + HDD_FW_VER_CRM_ID(hdd_ctx->target_fw_version); + hdd_ctx->fw_version_info.sub_id = + HDD_FW_VER_SUB_ID(hdd_ctx->target_fw_vers_ext); + hdd_ctx->fw_version_info.rel_id = + HDD_FW_VER_REL_ID(hdd_ctx->target_fw_vers_ext); +} + int hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg) { int ret; @@ -1911,6 +1936,7 @@ int hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg) hdd_ctx->target_fw_version = cfg->target_fw_version; hdd_ctx->target_fw_vers_ext = cfg->target_fw_vers_ext; + hdd_extract_fw_version_info(hdd_ctx); hdd_ctx->hw_bd_id = cfg->hw_bd_id; qdf_mem_copy(&hdd_ctx->hw_bd_info, &cfg->hw_bd_info, @@ -2539,7 +2565,6 @@ uint32_t hdd_wlan_get_version(struct hdd_context *hdd_ctx, const size_t version_len, uint8_t *version) { uint32_t size; - uint32_t msp_id = 0, mspid = 0, siid = 0, crmid = 0, sub_id = 0; if (!hdd_ctx) { hdd_err("Invalid context, HDD context is null"); @@ -2551,16 +2576,15 @@ uint32_t hdd_wlan_get_version(struct hdd_context *hdd_ctx, return 0; } - msp_id = (hdd_ctx->target_fw_version & 0xf0000000) >> 28; - mspid = (hdd_ctx->target_fw_version & 0xf000000) >> 24; - siid = (hdd_ctx->target_fw_version & 0xf00000) >> 20; - crmid = hdd_ctx->target_fw_version & 0x7fff; - sub_id = (hdd_ctx->target_fw_vers_ext & 0xf0000000) >> 28; - size = scnprintf(version, version_len, - "Host SW:%s, FW:%d.%d.%d.%d.%d, HW:%s, Board ver: %x Ref design id: %x, Customer id: %x, Project id: %x, Board Data Rev: %x", + "Host SW:%s, FW:%d.%d.%d.%d.%d.%d, HW:%s, Board ver: %x Ref design id: %x, Customer id: %x, Project id: %x, Board Data Rev: %x", QWLAN_VERSIONSTR, - msp_id, mspid, siid, crmid, sub_id, + hdd_ctx->fw_version_info.major_spid, + hdd_ctx->fw_version_info.minor_spid, + hdd_ctx->fw_version_info.siid, + hdd_ctx->fw_version_info.rel_id, + hdd_ctx->fw_version_info.crmid, + hdd_ctx->fw_version_info.sub_id, hdd_ctx->target_hw_name, hdd_ctx->hw_bd_info.bdf_version, hdd_ctx->hw_bd_info.ref_design_id, @@ -12924,29 +12948,6 @@ end: } -/** - * hdd_get_fw_version() - Get FW version - * @hdd_ctx: pointer to HDD context. - * @major_spid: FW version - major spid. - * @minor_spid: FW version - minor spid - * @ssid: FW version - ssid - * @crmid: FW version - crmid - * - * This function is called to get the firmware build version stored - * as part of the HDD context - * - * Return: None - */ -void hdd_get_fw_version(struct hdd_context *hdd_ctx, - uint32_t *major_spid, uint32_t *minor_spid, - uint32_t *siid, uint32_t *crmid) -{ - *major_spid = (hdd_ctx->target_fw_version & 0xf0000000) >> 28; - *minor_spid = (hdd_ctx->target_fw_version & 0xf000000) >> 24; - *siid = (hdd_ctx->target_fw_version & 0xf00000) >> 20; - *crmid = hdd_ctx->target_fw_version & 0x7fff; -} - #ifdef QCA_CONFIG_SMP /** * wlan_hdd_get_cpu() - get cpu_index diff --git a/core/hdd/src/wlan_hdd_sysfs.c b/core/hdd/src/wlan_hdd_sysfs.c index a9cc226777e4..bc722beca6ad 100644 --- a/core/hdd/src/wlan_hdd_sysfs.c +++ b/core/hdd/src/wlan_hdd_sysfs.c @@ -81,17 +81,16 @@ static ssize_t show_driver_version(struct kobject *kobj, static ssize_t __show_fw_version(struct hdd_context *hdd_ctx, char *buf) { - uint32_t major_spid = 0, minor_spid = 0, siid = 0, crmid = 0; - uint32_t sub_id = 0; - hdd_debug("Rcvd req for FW version"); - hdd_get_fw_version(hdd_ctx, &major_spid, &minor_spid, &siid, - &crmid); - sub_id = (hdd_ctx->target_fw_vers_ext & 0xf0000000) >> 28; return scnprintf(buf, PAGE_SIZE, - "FW:%d.%d.%d.%d.%d HW:%s Board version: %x Ref design id: %x Customer id: %x Project id: %x Board Data Rev: %x\n", - major_spid, minor_spid, siid, crmid, sub_id, + "FW:%d.%d.%d.%d.%d.%d HW:%s Board version: %x Ref design id: %x Customer id: %x Project id: %x Board Data Rev: %x\n", + hdd_ctx->fw_version_info.major_spid, + hdd_ctx->fw_version_info.minor_spid, + hdd_ctx->fw_version_info.siid, + hdd_ctx->fw_version_info.rel_id, + hdd_ctx->fw_version_info.crmid, + hdd_ctx->fw_version_info.sub_id, hdd_ctx->target_hw_name, hdd_ctx->hw_bd_info.bdf_version, hdd_ctx->hw_bd_info.ref_design_id,