Commit 7d89d780 authored by Somashekhar(Som)'s avatar Somashekhar(Som) Committed by Johannes Berg
Browse files

wifi: iwlwifi: interpret STEP URM BIOS configuration



For certain platforms, it may necessary to use the STEP in URM
(ultra reliable mode.) Read the necessary flags from the BIOS
(ACPI or UEFI) and indicate the chosen mode to the firmware in
the context info. Whether or not URM really was configured is
already read back later, to adjust capabilities accordingly.

Signed-off-by: default avatarSomashekhar(Som) <somashekhar.puttagangaiah@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Reviewed-by: default avatarDaniel Gabay <daniel.gabay@intel.com>
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241227095718.b30024905de3.If3c578af2c15f8005bbe71499bc4091348ed7bb0@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 80c2b651
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -1023,3 +1023,37 @@ int iwl_acpi_get_wbem(struct iwl_fw_runtime *fwrt, u32 *value)
	kfree(data);
	return ret;
}

int iwl_acpi_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value)
{
	union acpi_object *wifi_pkg, *data;
	int ret = -ENOENT;
	int tbl_rev;

	data = iwl_acpi_get_object(fwrt->dev, ACPI_DSBR_METHOD);
	if (IS_ERR(data))
		return ret;

	wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
					 ACPI_DSBR_WIFI_DATA_SIZE,
					 &tbl_rev);
	if (IS_ERR(wifi_pkg))
		goto out_free;

	if (tbl_rev != ACPI_DSBR_WIFI_DATA_REV) {
		IWL_DEBUG_RADIO(fwrt, "Unsupported ACPI DSBR revision:%d\n",
				tbl_rev);
		goto out_free;
	}

	if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER)
		goto out_free;

	*value = wifi_pkg->package.elements[1].integer.value;
	IWL_DEBUG_RADIO(fwrt, "Loaded DSBR config from ACPI value: 0x%x\n",
			*value);
	ret = 0;
out_free:
	kfree(data);
	return ret;
}
+16 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#define ACPI_WPFC_METHOD	"WPFC"
#define ACPI_GLAI_METHOD	"GLAI"
#define ACPI_WBEM_METHOD	"WBEM"
#define ACPI_DSBR_METHOD	"DSBR"

#define ACPI_WIFI_DOMAIN	(0x07)

@@ -74,6 +75,13 @@
 * and one for enablement of Wi-Fi 320MHz per MCC
 */
#define ACPI_WBEM_WIFI_DATA_SIZE	2
/*
 * One element for domain type,
 * and one for DSBR response data
 */
#define ACPI_DSBR_WIFI_DATA_SIZE	2
#define ACPI_DSBR_WIFI_DATA_REV		1

/*
 * One element for domain type,
 * and one for the status
@@ -153,6 +161,9 @@ int iwl_acpi_get_dsm(struct iwl_fw_runtime *fwrt,
		     enum iwl_dsm_funcs func, u32 *value);

int iwl_acpi_get_wbem(struct iwl_fw_runtime *fwrt, u32 *value);

int iwl_acpi_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value);

#else /* CONFIG_ACPI */

static inline void *iwl_acpi_get_dsm_object(struct device *dev, int rev,
@@ -221,6 +232,11 @@ static inline int iwl_acpi_get_wbem(struct iwl_fw_runtime *fwrt, u32 *value)
{
	return -ENOENT;
}

static inline int iwl_acpi_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value)
{
	return -ENOENT;
}
#endif /* CONFIG_ACPI */

#endif /* __iwl_fw_acpi__ */
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ IWL_BIOS_TABLE_LOADER_DATA(pwr_limit, u64);
IWL_BIOS_TABLE_LOADER_DATA(mcc, char);
IWL_BIOS_TABLE_LOADER_DATA(eckv, u32);
IWL_BIOS_TABLE_LOADER_DATA(wbem, u32);
IWL_BIOS_TABLE_LOADER_DATA(dsbr, u32);


static const struct dmi_system_id dmi_ppag_approved_list[] = {
+23 −0
Original line number Diff line number Diff line
@@ -222,4 +222,27 @@ static inline u32 iwl_bios_get_ppag_flags(const u32 ppag_modes,
}

bool iwl_puncturing_is_allowed_in_bios(u32 puncturing, u16 mcc);

#define IWL_DSBR_FW_MODIFIED_URM_MASK	BIT(8)
#define IWL_DSBR_PERMANENT_URM_MASK	BIT(9)

int iwl_bios_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value);

static inline void iwl_bios_setup_step(struct iwl_trans *trans,
				       struct iwl_fw_runtime *fwrt)
{
	u32 dsbr;

	if (!trans->trans_cfg->integrated)
		return;

	if (trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_BZ)
		return;

	if (iwl_bios_get_dsbr(fwrt, &dsbr))
		dsbr = 0;

	trans->dsbr_urm_fw_dependent = !!(dsbr & IWL_DSBR_FW_MODIFIED_URM_MASK);
	trans->dsbr_urm_permanent = !!(dsbr & IWL_DSBR_PERMANENT_URM_MASK);
}
#endif /* __fw_regulatory_h__ */
+26 −0
Original line number Diff line number Diff line
@@ -777,3 +777,29 @@ int iwl_uefi_get_puncturing(struct iwl_fw_runtime *fwrt)
	return puncturing;
}
IWL_EXPORT_SYMBOL(iwl_uefi_get_puncturing);

int iwl_uefi_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value)
{
	struct uefi_cnv_wlan_dsbr_data *data;
	int ret = 0;

	data = iwl_uefi_get_verified_variable_guid(fwrt->trans,
						   &IWL_EFI_WIFI_BT_GUID,
						   IWL_UEFI_DSBR_NAME, "DSBR",
						   sizeof(*data), NULL);
	if (IS_ERR(data))
		return -EINVAL;

	if (data->revision != IWL_UEFI_DSBR_REVISION) {
		ret = -EINVAL;
		IWL_DEBUG_RADIO(fwrt, "Unsupported UEFI DSBR revision:%d\n",
				data->revision);
		goto out;
	}
	*value = data->config;
	IWL_DEBUG_RADIO(fwrt, "Loaded DSBR config from UEFI value: 0x%x\n",
			*value);
out:
	kfree(data);
	return ret;
}
Loading