Commit 8f323d06 authored by Ayala Barazani's avatar Ayala Barazani Committed by Luca Coelho

iwlwifi: mvm: Disable WiFi bands selectively with BIOS

The BIOS can contain data about sets of disabled channels.
Pass the bitmap to the firmware if present.
Signed-off-by: default avatarAyala Barazani <ayala.barazani@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220205112029.9e6d9209293d.If5b22a9afe5f9dac9c7c45e68e494ffce4df8910@changeidSigned-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent a7de31d5
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/* /*
* Copyright (C) 2017 Intel Deutschland GmbH * Copyright (C) 2017 Intel Deutschland GmbH
* Copyright (C) 2018-2021 Intel Corporation * Copyright (C) 2018-2022 Intel Corporation
*/ */
#ifndef __iwl_fw_acpi__ #ifndef __iwl_fw_acpi__
#define __iwl_fw_acpi__ #define __iwl_fw_acpi__
...@@ -128,7 +128,8 @@ enum iwl_dsm_funcs_rev_0 { ...@@ -128,7 +128,8 @@ enum iwl_dsm_funcs_rev_0 {
DSM_FUNC_ENABLE_6E = 3, DSM_FUNC_ENABLE_6E = 3,
DSM_FUNC_11AX_ENABLEMENT = 6, DSM_FUNC_11AX_ENABLEMENT = 6,
DSM_FUNC_ENABLE_UNII4_CHAN = 7, DSM_FUNC_ENABLE_UNII4_CHAN = 7,
DSM_FUNC_ACTIVATE_CHANNEL = 8 DSM_FUNC_ACTIVATE_CHANNEL = 8,
DSM_FUNC_FORCE_DISABLE_CHANNELS = 9
}; };
enum iwl_dsm_values_srd { enum iwl_dsm_values_srd {
......
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/* /*
* Copyright (C) 2012-2014, 2018-2021 Intel Corporation * Copyright (C) 2012-2014, 2018-2022 Intel Corporation
* Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
* Copyright (C) 2016-2017 Intel Deutschland GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH
*/ */
...@@ -538,6 +538,32 @@ struct iwl_lari_config_change_cmd_v5 { ...@@ -538,6 +538,32 @@ struct iwl_lari_config_change_cmd_v5 {
__le32 chan_state_active_bitmap; __le32 chan_state_active_bitmap;
} __packed; /* LARI_CHANGE_CONF_CMD_S_VER_5 */ } __packed; /* LARI_CHANGE_CONF_CMD_S_VER_5 */
/**
* struct iwl_lari_config_change_cmd_v6 - change LARI configuration
* @config_bitmap: Bitmap of the config commands. Each bit will trigger a
* different predefined FW config operation.
* @oem_uhb_allow_bitmap: Bitmap of UHB enabled MCC sets.
* @oem_11ax_allow_bitmap: Bitmap of 11ax allowed MCCs. There are two bits
* per country, one to indicate whether to override and the other to
* indicate the value to use.
* @oem_unii4_allow_bitmap: Bitmap of unii4 allowed MCCs.There are two bits
* per country, one to indicate whether to override and the other to
* indicate allow/disallow unii4 channels.
* @chan_state_active_bitmap: Bitmap for overriding channel state to active.
* Each bit represents a country or region to activate, according to the BIOS
* definitions.
* @force_disable_channels_bitmap: Bitmap of disabled bands/channels.
* Each bit represents a set of channels in a specific band that should be disabled
*/
struct iwl_lari_config_change_cmd_v6 {
__le32 config_bitmap;
__le32 oem_uhb_allow_bitmap;
__le32 oem_11ax_allow_bitmap;
__le32 oem_unii4_allow_bitmap;
__le32 chan_state_active_bitmap;
__le32 force_disable_channels_bitmap;
} __packed; /* LARI_CHANGE_CONF_CMD_S_VER_6 */
/** /**
* struct iwl_pnvm_init_complete_ntfy - PNVM initialization complete * struct iwl_pnvm_init_complete_ntfy - PNVM initialization complete
* @status: PNVM image loading status * @status: PNVM image loading status
......
...@@ -1313,7 +1313,7 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm) ...@@ -1313,7 +1313,7 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
{ {
int ret; int ret;
u32 value; u32 value;
struct iwl_lari_config_change_cmd_v5 cmd = {}; struct iwl_lari_config_change_cmd_v6 cmd = {};
cmd.config_bitmap = iwl_acpi_get_lari_config_bitmap(&mvm->fwrt); cmd.config_bitmap = iwl_acpi_get_lari_config_bitmap(&mvm->fwrt);
...@@ -1340,26 +1340,43 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm) ...@@ -1340,26 +1340,43 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
if (!ret) if (!ret)
cmd.oem_uhb_allow_bitmap = cpu_to_le32(value); cmd.oem_uhb_allow_bitmap = cpu_to_le32(value);
ret = iwl_acpi_get_dsm_u32(mvm->fwrt.dev, 0,
DSM_FUNC_FORCE_DISABLE_CHANNELS,
&iwl_guid, &value);
if (!ret)
cmd.force_disable_channels_bitmap = cpu_to_le32(value);
if (cmd.config_bitmap || if (cmd.config_bitmap ||
cmd.oem_uhb_allow_bitmap || cmd.oem_uhb_allow_bitmap ||
cmd.oem_11ax_allow_bitmap || cmd.oem_11ax_allow_bitmap ||
cmd.oem_unii4_allow_bitmap || cmd.oem_unii4_allow_bitmap ||
cmd.chan_state_active_bitmap) { cmd.chan_state_active_bitmap ||
cmd.force_disable_channels_bitmap) {
size_t cmd_size; size_t cmd_size;
u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw,
WIDE_ID(REGULATORY_AND_NVM_GROUP, WIDE_ID(REGULATORY_AND_NVM_GROUP,
LARI_CONFIG_CHANGE), LARI_CONFIG_CHANGE),
1); 1);
if (cmd_ver == 5) switch (cmd_ver) {
case 6:
cmd_size = sizeof(struct iwl_lari_config_change_cmd_v6);
break;
case 5:
cmd_size = sizeof(struct iwl_lari_config_change_cmd_v5); cmd_size = sizeof(struct iwl_lari_config_change_cmd_v5);
else if (cmd_ver == 4) break;
case 4:
cmd_size = sizeof(struct iwl_lari_config_change_cmd_v4); cmd_size = sizeof(struct iwl_lari_config_change_cmd_v4);
else if (cmd_ver == 3) break;
case 3:
cmd_size = sizeof(struct iwl_lari_config_change_cmd_v3); cmd_size = sizeof(struct iwl_lari_config_change_cmd_v3);
else if (cmd_ver == 2) break;
case 2:
cmd_size = sizeof(struct iwl_lari_config_change_cmd_v2); cmd_size = sizeof(struct iwl_lari_config_change_cmd_v2);
else break;
default:
cmd_size = sizeof(struct iwl_lari_config_change_cmd_v1); cmd_size = sizeof(struct iwl_lari_config_change_cmd_v1);
break;
}
IWL_DEBUG_RADIO(mvm, IWL_DEBUG_RADIO(mvm,
"sending LARI_CONFIG_CHANGE, config_bitmap=0x%x, oem_11ax_allow_bitmap=0x%x\n", "sending LARI_CONFIG_CHANGE, config_bitmap=0x%x, oem_11ax_allow_bitmap=0x%x\n",
...@@ -1371,8 +1388,9 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm) ...@@ -1371,8 +1388,9 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
le32_to_cpu(cmd.chan_state_active_bitmap), le32_to_cpu(cmd.chan_state_active_bitmap),
cmd_ver); cmd_ver);
IWL_DEBUG_RADIO(mvm, IWL_DEBUG_RADIO(mvm,
"sending LARI_CONFIG_CHANGE, oem_uhb_allow_bitmap=0x%x\n", "sending LARI_CONFIG_CHANGE, oem_uhb_allow_bitmap=0x%x, force_disable_channels_bitmap=0x%x\n",
le32_to_cpu(cmd.oem_uhb_allow_bitmap)); le32_to_cpu(cmd.oem_uhb_allow_bitmap),
le32_to_cpu(cmd.force_disable_channels_bitmap));
ret = iwl_mvm_send_cmd_pdu(mvm, ret = iwl_mvm_send_cmd_pdu(mvm,
WIDE_ID(REGULATORY_AND_NVM_GROUP, WIDE_ID(REGULATORY_AND_NVM_GROUP,
LARI_CONFIG_CHANGE), LARI_CONFIG_CHANGE),
......
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