Commit 18f52365 authored by Miri Korenblit's avatar Miri Korenblit Committed by Johannes Berg

wifi: iwlwifi: read SPLC from UEFI

Try to read the SPLC table from UEFI first,
and if the WIFI UEFI tables are unlocked or the
table doesn't exist - try to read it from ACPI
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240201155157.3d9d835b6edb.I7ea262df9431ced787b77c87149c6d7bddb7e7d6@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent a51d1cf5
...@@ -385,7 +385,6 @@ int iwl_acpi_get_pwr_limit(struct iwl_fw_runtime *fwrt, u64 *dflt_pwr_limit) ...@@ -385,7 +385,6 @@ int iwl_acpi_get_pwr_limit(struct iwl_fw_runtime *fwrt, u64 *dflt_pwr_limit)
out: out:
return ret; return ret;
} }
IWL_EXPORT_SYMBOL(iwl_acpi_get_pwr_limit);
int iwl_acpi_get_eckv(struct device *dev, u32 *extl_clk) int iwl_acpi_get_eckv(struct device *dev, u32 *extl_clk)
{ {
......
...@@ -35,6 +35,8 @@ IWL_BIOS_TABLE_LOADER(ewrd_table); ...@@ -35,6 +35,8 @@ IWL_BIOS_TABLE_LOADER(ewrd_table);
IWL_BIOS_TABLE_LOADER(wgds_table); IWL_BIOS_TABLE_LOADER(wgds_table);
IWL_BIOS_TABLE_LOADER(ppag_table); IWL_BIOS_TABLE_LOADER(ppag_table);
IWL_BIOS_TABLE_LOADER_DATA(tas_table, struct iwl_tas_data); IWL_BIOS_TABLE_LOADER_DATA(tas_table, struct iwl_tas_data);
IWL_BIOS_TABLE_LOADER_DATA(pwr_limit, u64);
static const struct dmi_system_id dmi_ppag_approved_list[] = { static const struct dmi_system_id dmi_ppag_approved_list[] = {
{ .ident = "HP", { .ident = "HP",
......
...@@ -137,4 +137,6 @@ int iwl_bios_get_ppag_table(struct iwl_fw_runtime *fwrt); ...@@ -137,4 +137,6 @@ int iwl_bios_get_ppag_table(struct iwl_fw_runtime *fwrt);
int iwl_bios_get_tas_table(struct iwl_fw_runtime *fwrt, int iwl_bios_get_tas_table(struct iwl_fw_runtime *fwrt,
struct iwl_tas_data *data); struct iwl_tas_data *data);
int iwl_bios_get_pwr_limit(struct iwl_fw_runtime *fwrt,
u64 *dflt_pwr_limit);
#endif /* __fw_regulatory_h__ */ #endif /* __fw_regulatory_h__ */
...@@ -598,3 +598,26 @@ int iwl_uefi_get_tas_table(struct iwl_fw_runtime *fwrt, ...@@ -598,3 +598,26 @@ int iwl_uefi_get_tas_table(struct iwl_fw_runtime *fwrt,
kfree(uefi_tas); kfree(uefi_tas);
return ret; return ret;
} }
int iwl_uefi_get_pwr_limit(struct iwl_fw_runtime *fwrt,
u64 *dflt_pwr_limit)
{
struct uefi_cnv_var_splc *data;
int ret = 0;
data = iwl_uefi_get_verified_variable(fwrt->trans, IWL_UEFI_SPLC_NAME,
"SPLC", sizeof(*data), NULL);
if (IS_ERR(data))
return -EINVAL;
if (data->revision != IWL_UEFI_SPLC_REVISION) {
ret = -EINVAL;
IWL_DEBUG_RADIO(fwrt, "Unsupported UEFI SPLC revision:%d\n",
data->revision);
goto out;
}
*dflt_pwr_limit = data->default_pwr_limit;
out:
kfree(data);
return ret;
}
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#define IWL_UEFI_WGDS_NAME L"UefiCnvWlanWGDS" #define IWL_UEFI_WGDS_NAME L"UefiCnvWlanWGDS"
#define IWL_UEFI_PPAG_NAME L"UefiCnvWlanPPAG" #define IWL_UEFI_PPAG_NAME L"UefiCnvWlanPPAG"
#define IWL_UEFI_WTAS_NAME L"UefiCnvWlanWTAS" #define IWL_UEFI_WTAS_NAME L"UefiCnvWlanWTAS"
#define IWL_UEFI_SPLC_NAME L"UefiCnvWlanSPLC"
#define IWL_SGOM_MAP_SIZE 339 #define IWL_SGOM_MAP_SIZE 339
#define IWL_UATS_MAP_SIZE 339 #define IWL_UATS_MAP_SIZE 339
...@@ -27,6 +29,7 @@ ...@@ -27,6 +29,7 @@
#define IWL_UEFI_MIN_PPAG_REV 1 #define IWL_UEFI_MIN_PPAG_REV 1
#define IWL_UEFI_MAX_PPAG_REV 3 #define IWL_UEFI_MAX_PPAG_REV 3
#define IWL_UEFI_WTAS_REVISION 1 #define IWL_UEFI_WTAS_REVISION 1
#define IWL_UEFI_SPLC_REVISION 0
struct pnvm_sku_package { struct pnvm_sku_package {
u8 rev; u8 rev;
...@@ -130,6 +133,15 @@ struct uefi_cnv_var_wtas { ...@@ -130,6 +133,15 @@ struct uefi_cnv_var_wtas {
u16 black_list[IWL_WTAS_BLACK_LIST_MAX]; u16 black_list[IWL_WTAS_BLACK_LIST_MAX];
} __packed; } __packed;
/* struct uefi_cnv_var_splc - SPLC tabled as defined in UEFI
* @revision: the revision of the table
* @default_pwr_limit: The default maximum power per device
*/
struct uefi_cnv_var_splc {
u8 revision;
u32 default_pwr_limit;
} __packed;
/* /*
* This is known to be broken on v4.19 and to work on v5.4. Until we * This is known to be broken on v4.19 and to work on v5.4. Until we
* figure out why this is the case and how to make it work, simply * figure out why this is the case and how to make it work, simply
...@@ -150,6 +162,8 @@ int iwl_uefi_get_wgds_table(struct iwl_fw_runtime *fwrt); ...@@ -150,6 +162,8 @@ int iwl_uefi_get_wgds_table(struct iwl_fw_runtime *fwrt);
int iwl_uefi_get_ppag_table(struct iwl_fw_runtime *fwrt); int iwl_uefi_get_ppag_table(struct iwl_fw_runtime *fwrt);
int iwl_uefi_get_tas_table(struct iwl_fw_runtime *fwrt, int iwl_uefi_get_tas_table(struct iwl_fw_runtime *fwrt,
struct iwl_tas_data *data); struct iwl_tas_data *data);
int iwl_uefi_get_pwr_limit(struct iwl_fw_runtime *fwrt,
u64 *dflt_pwr_limit);
#else /* CONFIG_EFI */ #else /* CONFIG_EFI */
static inline void *iwl_uefi_get_pnvm(struct iwl_trans *trans, size_t *len) static inline void *iwl_uefi_get_pnvm(struct iwl_trans *trans, size_t *len)
{ {
...@@ -206,6 +220,13 @@ static inline int iwl_uefi_get_tas_table(struct iwl_fw_runtime *fwrt, ...@@ -206,6 +220,13 @@ static inline int iwl_uefi_get_tas_table(struct iwl_fw_runtime *fwrt,
{ {
return -ENOENT; return -ENOENT;
} }
static inline int iwl_uefi_get_pwr_limit(struct iwl_fw_runtime *fwrt,
u64 *dflt_pwr_limit)
{
*dflt_pwr_limit = 0;
return 0;
}
#endif /* CONFIG_EFI */ #endif /* CONFIG_EFI */
#if defined(CONFIG_EFI) && defined(CONFIG_ACPI) #if defined(CONFIG_EFI) && defined(CONFIG_ACPI)
......
...@@ -689,7 +689,7 @@ static u32 iwl_mvm_min_backoff(struct iwl_mvm *mvm) ...@@ -689,7 +689,7 @@ static u32 iwl_mvm_min_backoff(struct iwl_mvm *mvm)
if (!backoff) if (!backoff)
return 0; return 0;
iwl_acpi_get_pwr_limit(&mvm->fwrt, &dflt_pwr_limit); iwl_bios_get_pwr_limit(&mvm->fwrt, &dflt_pwr_limit);
while (backoff->pwr) { while (backoff->pwr) {
if (dflt_pwr_limit >= backoff->pwr) if (dflt_pwr_limit >= backoff->pwr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment