mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 07:37:31 -04:00
qcacld-3.0: Rearrange hdd_wlan_get_version out of wext files
To keep non-wext function out of wext.[c|h], rearrange it to main.[c|h] And in order to make the interface more generic, change the interface to take the buffer and length directly. Change-Id: I1f64cc235b9dee6c574f871b020b0b61c8b427c8 CRs-fixed: 2228717
This commit is contained in:
parent
73bab848ab
commit
aadba074fa
6 changed files with 74 additions and 76 deletions
|
|
@ -3197,4 +3197,32 @@ void hdd_set_disconnect_status(struct hdd_adapter *adapter, bool disconnecting);
|
|||
int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
|
||||
uint32_t bandwidth);
|
||||
|
||||
/**
|
||||
* hdd_wlan_get_version() - Get version information
|
||||
* @hdd_ctx: Global HDD context
|
||||
* @version_len: length of the version buffer size
|
||||
* @version: the buffer to the version string
|
||||
*
|
||||
* This function is used to get Wlan Driver, Firmware, Hardware Version
|
||||
* & the Board related information.
|
||||
*
|
||||
* Return: the length of the version string
|
||||
*/
|
||||
uint32_t hdd_wlan_get_version(struct hdd_context *hdd_ctx,
|
||||
const size_t version_len, uint8_t *version);
|
||||
|
||||
/**
|
||||
* hdd_update_hw_sw_info() - API to update the HW/SW information
|
||||
* @hdd_ctx: Global HDD context
|
||||
*
|
||||
* API to update the HW and SW information in the driver
|
||||
*
|
||||
* Note:
|
||||
* All the version/revision information would only be retrieved after
|
||||
* firmware download
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void hdd_update_hw_sw_info(struct hdd_context *hdd_ctx);
|
||||
|
||||
#endif /* end #if !defined(WLAN_HDD_MAIN_H) */
|
||||
|
|
|
|||
|
|
@ -197,9 +197,6 @@ void hdd_unregister_wext(struct net_device *dev);
|
|||
*/
|
||||
void hdd_register_wext(struct net_device *dev);
|
||||
|
||||
void hdd_wlan_get_version(struct hdd_context *hdd_ctx,
|
||||
union iwreq_data *wrqu, char *extra);
|
||||
|
||||
void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length,
|
||||
char *buffer, uint16_t buf_len);
|
||||
void hdd_wlan_list_fw_profile(uint16_t *length,
|
||||
|
|
|
|||
|
|
@ -4983,7 +4983,8 @@ __iw_softap_version(struct net_device *dev,
|
|||
if (0 != ret)
|
||||
return ret;
|
||||
|
||||
hdd_wlan_get_version(hdd_ctx, wrqu, extra);
|
||||
wrqu->data.length = hdd_wlan_get_version(hdd_ctx, WE_MAX_STR_LEN,
|
||||
extra);
|
||||
hdd_exit();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2354,18 +2354,13 @@ static void hdd_disable_power_management(void)
|
|||
hif_disable_power_management(hif_ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_update_hw_sw_info() - API to update the HW/SW information
|
||||
*
|
||||
* API to update the HW and SW information in the driver
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
static void hdd_update_hw_sw_info(struct hdd_context *hdd_ctx)
|
||||
void hdd_update_hw_sw_info(struct hdd_context *hdd_ctx)
|
||||
{
|
||||
void *hif_sc;
|
||||
size_t target_hw_name_len;
|
||||
const char *target_hw_name;
|
||||
uint8_t *buf;
|
||||
uint32_t buf_len;
|
||||
|
||||
hif_sc = cds_get_context(QDF_MODULE_ID_HIF);
|
||||
if (!hif_sc) {
|
||||
|
|
@ -2373,12 +2368,7 @@ static void hdd_update_hw_sw_info(struct hdd_context *hdd_ctx)
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* target hw version/revision would only be retrieved after firmware
|
||||
* download
|
||||
*/
|
||||
hif_get_hw_info(hif_sc,
|
||||
&hdd_ctx->target_hw_version,
|
||||
hif_get_hw_info(hif_sc, &hdd_ctx->target_hw_version,
|
||||
&hdd_ctx->target_hw_revision,
|
||||
&target_hw_name);
|
||||
|
||||
|
|
@ -2391,8 +2381,12 @@ static void hdd_update_hw_sw_info(struct hdd_context *hdd_ctx)
|
|||
qdf_mem_copy(hdd_ctx->target_hw_name, target_hw_name,
|
||||
target_hw_name_len);
|
||||
|
||||
/* Get the wlan hw/fw version */
|
||||
hdd_wlan_get_version(hdd_ctx, NULL, NULL);
|
||||
buf = qdf_mem_malloc(WE_MAX_STR_LEN);
|
||||
if (buf) {
|
||||
buf_len = hdd_wlan_get_version(hdd_ctx, WE_MAX_STR_LEN, buf);
|
||||
hdd_info("%s", buf);
|
||||
qdf_mem_free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2467,6 +2461,37 @@ hdd_update_cds_ac_specs_params(struct hdd_context *hdd_ctx)
|
|||
}
|
||||
}
|
||||
|
||||
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");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!version && version_len == 0) {
|
||||
hdd_err("Invalid buffer pointr or buffer len\n");
|
||||
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",
|
||||
QWLAN_VERSIONSTR,
|
||||
msp_id, mspid, siid, crmid, sub_id,
|
||||
hdd_ctx->target_hw_name);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
#ifdef IPA_OFFLOAD
|
||||
/**
|
||||
* hdd_update_ipa_component_config() - update ipa config
|
||||
|
|
|
|||
|
|
@ -1386,7 +1386,7 @@ QDF_STATUS hdd_wlan_re_init(void)
|
|||
goto err_re_init;
|
||||
}
|
||||
|
||||
hdd_wlan_get_version(hdd_ctx, NULL, NULL);
|
||||
hdd_update_hw_sw_info(hdd_ctx);
|
||||
|
||||
wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index,
|
||||
WLAN_SVC_FW_CRASHED_IND, NULL, 0);
|
||||
|
|
|
|||
|
|
@ -3288,60 +3288,6 @@ int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_wlan_get_version() - Get driver version information
|
||||
* @hdd_ctx: Global HDD context
|
||||
* @wrqu: Pointer to IOCTL REQUEST Data.
|
||||
* @extra: Pointer to destination buffer
|
||||
*
|
||||
* This function is used to get Wlan Driver, Firmware, & Hardware
|
||||
* Version information. If @wrqu and @extra are specified, then the
|
||||
* version string is returned. Otherwise it is simply printed to the
|
||||
* kernel log.
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void hdd_wlan_get_version(struct hdd_context *hdd_ctx, union iwreq_data *wrqu,
|
||||
char *extra)
|
||||
{
|
||||
tSirVersionString wcnss_sw_version;
|
||||
const char *swversion;
|
||||
const char *hwversion;
|
||||
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");
|
||||
goto error;
|
||||
}
|
||||
|
||||
snprintf(wcnss_sw_version, sizeof(wcnss_sw_version), "%08x",
|
||||
hdd_ctx->target_fw_version);
|
||||
|
||||
swversion = wcnss_sw_version;
|
||||
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;
|
||||
|
||||
hwversion = hdd_ctx->target_hw_name;
|
||||
|
||||
if (wrqu && extra) {
|
||||
wrqu->data.length =
|
||||
scnprintf(extra, WE_MAX_STR_LEN,
|
||||
"Host SW:%s, FW:%d.%d.%d.%d.%d, HW:%s",
|
||||
QWLAN_VERSIONSTR,
|
||||
msp_id, mspid, siid, crmid,
|
||||
sub_id, hwversion);
|
||||
} else {
|
||||
pr_info("Host SW:%s, FW:%d.%d.%d.%d.%d, HW:%s\n",
|
||||
QWLAN_VERSIONSTR,
|
||||
msp_id, mspid, siid, crmid, sub_id, hwversion);
|
||||
}
|
||||
error:
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_wlan_get_ibss_peer_info() - Print IBSS peer information
|
||||
* @adapter: Adapter upon which the IBSS client is active
|
||||
|
|
@ -6358,7 +6304,8 @@ static int __iw_get_char_setnone(struct net_device *dev,
|
|||
switch (sub_cmd) {
|
||||
case WE_WLAN_VERSION:
|
||||
{
|
||||
hdd_wlan_get_version(hdd_ctx, wrqu, extra);
|
||||
wrqu->data.length = hdd_wlan_get_version(hdd_ctx,
|
||||
WE_MAX_STR_LEN, extra);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue