summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/intel/iwlwifi/fw/uefi.c
diff options
context:
space:
mode:
authorMukesh Sisodiya <mukesh.sisodiya@intel.com>2023-10-22 17:55:50 +0300
committerJohannes Berg <johannes.berg@intel.com>2023-10-23 12:49:30 +0200
commit4a9bb5b4d94999af8a9156e7004cad28db8cde38 (patch)
tree06a57c7080524a7268fd39b732fe2739ad96cef4 /drivers/net/wireless/intel/iwlwifi/fw/uefi.c
parent48a25b5d05bba140e2b8bfa7f222f81080dbf80f (diff)
downloadlinux-4a9bb5b4d94999af8a9156e7004cad28db8cde38.tar.gz
linux-4a9bb5b4d94999af8a9156e7004cad28db8cde38.tar.bz2
linux-4a9bb5b4d94999af8a9156e7004cad28db8cde38.zip
wifi: iwlwifi: fw: Add support for UATS table in UHB
Driver need to provide details of VLP, AFC AP type supported for the specific MCC to firmware. Driver will read the UATS (UHB AP type support) table from BIOS and sent to firmware using UATS_TABLE_CMD. Add the support for the same in the driver. Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20231022173519.eb6cf7be17b2.I8977a660564412056d9fd383d57b236cd4b22d00@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/fw/uefi.c')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/uefi.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/uefi.c b/drivers/net/wireless/intel/iwlwifi/fw/uefi.c
index 9877988db0d2..2964c5fb11e9 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/uefi.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/uefi.c
@@ -388,4 +388,54 @@ void iwl_uefi_get_sgom_table(struct iwl_trans *trans,
kfree(data);
}
IWL_EXPORT_SYMBOL(iwl_uefi_get_sgom_table);
+
+static int iwl_uefi_uats_parse(struct uefi_cnv_wlan_uats_data *uats_data,
+ struct iwl_fw_runtime *fwrt)
+{
+ if (uats_data->revision != 1)
+ return -EINVAL;
+
+ memcpy(fwrt->uats_table.offset_map, uats_data->offset_map,
+ sizeof(fwrt->uats_table.offset_map));
+ return 0;
+}
+
+int iwl_uefi_get_uats_table(struct iwl_trans *trans,
+ struct iwl_fw_runtime *fwrt)
+{
+ struct uefi_cnv_wlan_uats_data *data;
+ unsigned long package_size;
+ int ret;
+
+ data = iwl_uefi_get_variable(IWL_UEFI_UATS_NAME, &IWL_EFI_VAR_GUID,
+ &package_size);
+ if (IS_ERR(data)) {
+ IWL_DEBUG_FW(trans,
+ "UATS UEFI variable not found 0x%lx\n",
+ PTR_ERR(data));
+ return -EINVAL;
+ }
+
+ if (package_size < sizeof(*data)) {
+ IWL_DEBUG_FW(trans,
+ "Invalid UATS table UEFI variable len (%lu)\n",
+ package_size);
+ kfree(data);
+ return -EINVAL;
+ }
+
+ IWL_DEBUG_FW(trans, "Read UATS from UEFI with size %lu\n",
+ package_size);
+
+ ret = iwl_uefi_uats_parse(data, fwrt);
+ if (ret < 0) {
+ IWL_DEBUG_FW(trans, "Cannot read UATS table. rev is invalid\n");
+ kfree(data);
+ return ret;
+ }
+
+ kfree(data);
+ return 0;
+}
+IWL_EXPORT_SYMBOL(iwl_uefi_get_uats_table);
#endif /* CONFIG_ACPI */