Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
cnss2: Structure bdwlan firmware loading into nested switch case
Browse files Browse the repository at this point in the history
For the sake of visibility and consistency

Change-Id: If52ba61a48ceb5ca2f446282b655c2012486dd93
Signed-off-by: UtsavBalar1231 <[email protected]>
  • Loading branch information
UtsavBalar1231 committed Sep 22, 2022
1 parent 17a8c15 commit bd774ed
Showing 1 changed file with 91 additions and 84 deletions.
175 changes: 91 additions & 84 deletions drivers/net/wireless/cnss2/qmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,32 @@
#define ELF_BDF_FILE_NAME "bdwlan.elf"

#define ELF_BDF_FILE_NAME_J11 "bd_j11.elf"
#define ELF_BDF_FILE_NAME_J11_B_BOM "bd_j11_b.elf"
#define ELF_BDF_FILE_NAME_J11_INDIA "bd_j11in.elf"
#define ELF_BDF_FILE_NAME_J11_GLOBAL "bd_j11gl.elf"
#define ELF_BDF_FILE_NAME_J11_B_BOM "bd_j11_b.elf"
#define ELF_BDF_FILE_NAME_J11_INDIA "bd_j11in.elf"
#define ELF_BDF_FILE_NAME_J11_GLOBAL "bd_j11gl.elf"

#define ELF_BDF_FILE_NAME_GLOBAL "bd_j1gl.elf"
#define ELF_BDF_FILE_NAME_INDIA "bd_j1in.elf"
#define ELF_BDF_FILE_NAME_B_BOM "bd_j1_b.elf"
#define ELF_BDF_FILE_NAME_J1_GLOBAL "bd_j1gl.elf"
#define ELF_BDF_FILE_NAME_J1_INDIA "bd_j1in.elf"
#define ELF_BDF_FILE_NAME_J1_B_BOM "bd_j1_b.elf"

#define ELF_BDF_FILE_NAME_J1S "bd_j1s.elf"
#define ELF_BDF_FILE_NAME_J1S "bd_j1s.elf"

#define ELF_BDF_FILE_NAME_J2S "bd_j2s.elf"
#define ELF_BDF_FILE_NAME_J2S "bd_j2s.elf"

#define ELF_BDF_FILE_NAME_J3S "bd_j3s.elf"
#define ELF_BDF_FILE_NAME_J3S_GLOBAL "bd_j3sgl.elf"
#define ELF_BDF_FILE_NAME_J3S_INDIA "bd_j3sin.elf"
#define ELF_BDF_FILE_NAME_J3S "bd_j3s.elf"
#define ELF_BDF_FILE_NAME_J3S_GLOBAL "bd_j3sgl.elf"
#define ELF_BDF_FILE_NAME_J3S_INDIA "bd_j3sin.elf"

#define ELF_BDF_FILE_NAME_K11A "bd_k11a.elf"
#define ELF_BDF_FILE_NAME_K11A_GLOBAL "bd_k11agl.elf"
#define ELF_BDF_FILE_NAME_K11A_INDIA "bd_k11ain.elf"
#define ELF_BDF_FILE_NAME_K11A "bd_k11a.elf"
#define ELF_BDF_FILE_NAME_K11A_GLOBAL "bd_k11agl.elf"
#define ELF_BDF_FILE_NAME_K11A_INDIA "bd_k11ain.elf"

#define ELF_BDF_FILE_NAME_L11R "bd_l11r.elf"
#define ELF_BDF_FILE_NAME_L11R_GLOBAL "bd_l11rgl.elf"
#define ELF_BDF_FILE_NAME_L11R_INDIA "bd_l11rin.elf"
#define ELF_BDF_FILE_NAME_K81 "bd_k81.elf"
#define ELF_BDF_FILE_NAME_K81A "bd_k81a.elf"

#define ELF_BDF_FILE_NAME_K81 "bd_k81.elf"
#define ELF_BDF_FILE_NAME_K81A "bd_k81a.elf"
#define ELF_BDF_FILE_NAME_L11R "bd_l11r.elf"
#define ELF_BDF_FILE_NAME_L11R_GLOBAL "bd_l11rgl.elf"
#define ELF_BDF_FILE_NAME_L11R_INDIA "bd_l11rin.elf"

#define ELF_BDF_FILE_NAME_GF "bdwlang.elf"

Expand Down Expand Up @@ -567,80 +567,87 @@ static int cnss_get_bdf_file_name(struct cnss_plat_data *plat_priv,
hw_platform_ver = get_hw_version_platform();
hw_country_ver = get_hw_country_version();

cnss_pr_dbg("hw_platform_ver is %d\n", hw_platform_ver);
cnss_pr_dbg("hw_platform_ver is %d\n", hw_platform_ver);
switch (bdf_type) {
case CNSS_BDF_ELF:
/* Board ID will be equal or less than 0xFF in GF mask case */
if (plat_priv->board_info.board_id == 0xFF) {
if (hw_platform_ver == HARDWARE_PLATFORM_LMI) {
if (get_hw_country_version() == (uint32_t)CountryGlobal)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J11_GLOBAL);
else if (get_hw_country_version() == (uint32_t)CountryIndia)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J11_INDIA);
else {
if ((get_hw_version_minor() == (uint32_t)HW_MINOR_VERSION_B) &&
(get_hw_version_major() == (uint32_t)HW_MAJOR_VERSION_B))
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J11_B_BOM);
else
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J11);
}
} else if (hw_platform_ver == HARDWARE_PLATFORM_CAS) {
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J1S);
} else if (hw_platform_ver == HARDWARE_PLATFORM_THYME) {
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J2S);
} else if (hw_platform_ver == HARDWARE_PLATFORM_APOLLO) {
if (get_hw_country_version() == (uint32_t)CountryGlobal)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J3S_GLOBAL);
else if (get_hw_country_version() == (uint32_t)CountryIndia)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J3S_INDIA);
else
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J3S);
} else if (hw_platform_ver == HARDWARE_PLATFORM_ALIOTH) {
if (get_hw_country_version() == (uint32_t)CountryGlobal)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_K11A_GLOBAL);
else if (get_hw_country_version() == (uint32_t)CountryIndia)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_K11A_INDIA);
else
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_K11A);
} else if (hw_platform_ver == HARDWARE_PLATFORM_ENUMA) {
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_K81);
} else if (hw_platform_ver == HARDWARE_PLATFORM_ELISH) {
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_K81A);
} else if (hw_platform_ver == HARDWARE_PLATFORM_MUNCH) {
if (get_hw_country_version() == (uint32_t)CountryGlobal)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_L11R_GLOBAL);
else if (get_hw_country_version() == (uint32_t)CountryIndia)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_L11R_INDIA);
else
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_L11R);
if (plat_priv->chip_info.chip_id & CHIP_ID_GF_MASK) {
snprintf(filename_tmp, filename_len,
ELF_BDF_FILE_NAME_GF);
} else {
if (hw_country_ver == (uint32_t)CountryGlobal)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_GLOBAL);
else if (hw_country_ver == (uint32_t)CountryIndia)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_INDIA);
else {
if ((get_hw_version_minor() == (uint32_t)HW_MINOR_VERSION_B) &&
(get_hw_version_major() == (uint32_t)HW_MAJOR_VERSION_B))
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_B_BOM);
else {
if (plat_priv->chip_info.chip_id & CHIP_ID_GF_MASK)
snprintf(filename_tmp, filename_len,
ELF_BDF_FILE_NAME_GF);
switch (hw_platform_ver) {
case HARDWARE_PLATFORM_LMI:
if (hw_country_ver == (uint32_t)CountryGlobal) {
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J11_GLOBAL);
} else if (hw_country_ver == (uint32_t)CountryIndia) {
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J11_INDIA);
} else {
if ((get_hw_version_minor() == (uint32_t)HW_MINOR_VERSION_B) &&
(get_hw_version_major() == (uint32_t)HW_MAJOR_VERSION_B))
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J11_B_BOM);
else
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J11);
}
break;
case HARDWARE_PLATFORM_CAS:
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J1S);
break;
case HARDWARE_PLATFORM_THYME:
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J2S);
break;
case HARDWARE_PLATFORM_APOLLO:
if (hw_country_ver == (uint32_t)CountryGlobal)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J3S_GLOBAL);
else if (hw_country_ver == (uint32_t)CountryIndia)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J3S_INDIA);
else
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J3S);
break;
case HARDWARE_PLATFORM_ALIOTH:
if (hw_country_ver == (uint32_t)CountryGlobal)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_K11A_GLOBAL);
else if (hw_country_ver == (uint32_t)CountryIndia)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_K11A_INDIA);
else
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_K11A);
break;
case HARDWARE_PLATFORM_CMI:
if (hw_country_ver == (uint32_t)CountryGlobal) {
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J1_GLOBAL);
} else if (hw_country_ver == (uint32_t)CountryIndia) {
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J1_INDIA);
} else {
if ((get_hw_version_minor() == (uint32_t)HW_MINOR_VERSION_B) &&
(get_hw_version_major() == (uint32_t)HW_MAJOR_VERSION_B))
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J1_B_BOM);
else
snprintf(filename_tmp, filename_len,
ELF_BDF_FILE_NAME);
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME);
}
break;
case HARDWARE_PLATFORM_ENUMA:
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_K81);
break;
case HARDWARE_PLATFORM_ELISH:
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_K81A);
break;
case HARDWARE_PLATFORM_MUNCH:
if (hw_country_ver == (uint32_t)CountryGlobal)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_L11R_GLOBAL);
else if (hw_country_ver == (uint32_t)CountryIndia)
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_L11R_INDIA);
else
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_L11R);
break;
default:
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME);
break;
}
}
} else if (plat_priv->board_info.board_id < 0xFF) {
if (plat_priv->chip_info.chip_id & CHIP_ID_GF_MASK)
snprintf(filename_tmp, filename_len,
ELF_BDF_FILE_NAME_GF_PREFIX "%02x",
plat_priv->board_info.board_id);
else
snprintf(filename_tmp, filename_len,
ELF_BDF_FILE_NAME_PREFIX "%02x",
plat_priv->board_info.board_id);
} else if (plat_priv->board_info.board_id < 0xFF) {
snprintf(filename_tmp, filename_len,
ELF_BDF_FILE_NAME_PREFIX "%02x",
plat_priv->board_info.board_id);
} else {
snprintf(filename_tmp, filename_len,
BDF_FILE_NAME_PREFIX "%02x.e%02x",
Expand Down

0 comments on commit bd774ed

Please sign in to comment.