Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5326400pxb; Sun, 6 Feb 2022 22:18:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDnYLIC6mywjZOA6E5OxIO7Hw2eLfa7ptvS28VXnl5bUq2dAOJJCy7YhDH8oSGKog9C5k9 X-Received: by 2002:a17:906:c82b:: with SMTP id dd11mr386807ejb.618.1644214725202; Sun, 06 Feb 2022 22:18:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644214725; cv=none; d=google.com; s=arc-20160816; b=0XfMrmk0YlJ7DWDZ/2Ckx7iudENLvLlnlQNvQ4d9w9gu4BAzkaH4HT4K9pDTSJ5ZH9 bEhx+eesvY+pTt8RucSHM+E7LpSb947Tu3xjb+M8fGCkArmkMFgdyij+8qF5C8aN3QK2 /FKn4vg+TJpS/1F7RhS2kUvsbCug7Ohj9lAlxFHVKRu0SSQnFAeNy2dzQR0DqAWDu4wl 4lgZNTFBIUcmc/MxzejMq3cSUcSqXdF+AHTv9W08Cy4vHBx4elZzQfO+T24ikbpsnoOm VXrPjuwvy/mj155/3F/GvSneCdLMKGveabhX8OV/pNxZRPT7RlLV58Ynfj6iNpGnLM0O xJiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from; bh=1bp1JfhTjzOHD/Qdoc4Q8B6ELuDx++uEV27LssRIxyY=; b=SD6DUmdXCxP6IqrSdRKy/3WarxvWIpda67wnMD+QyCA5jlD9eiTXuVezcjnSYC8eMd Fbt9dyKlxXJZ4FrjKbv007NrWGHFB6tcoK4OGhY/zxKH/AllwrkiMik6elL4aMB/yjYh l2pHmmySuRjD7rcTsp0RZLXcmAvp9rshbTzlI6r9pAPyI/5+1PhnNr93klkXa4iRon8R Xp92Ys5kTwZX2L97qbbJaiWSOhdpEdkbsHz59aoauKoy51eVDvXsLrHxF1Pk2v4qU6N+ szftSOkBUMkDFuKDIoE21MR88XjRE6YGOB3Iks+i6jggXtxzCHWcZMCp7joqFQZhX5EQ S+YQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc39si7371371ejc.945.2022.02.06.22.18.21; Sun, 06 Feb 2022 22:18:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348174AbiBEJVw (ORCPT + 72 others); Sat, 5 Feb 2022 04:21:52 -0500 Received: from paleale.coelho.fi ([176.9.41.70]:37996 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1345248AbiBEJVv (ORCPT ); Sat, 5 Feb 2022 04:21:51 -0500 Received: from 91-156-4-210.elisa-laajakaista.fi ([91.156.4.210] helo=kveik.lan) by farmhouse.coelho.fi with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1nGHGP-0006b7-L9; Sat, 05 Feb 2022 11:21:50 +0200 From: Luca Coelho To: kvalo@kernel.org Cc: luca@coelho.fi, linux-wireless@vger.kernel.org Date: Sat, 5 Feb 2022 11:21:35 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220205092140.751171-1-luca@coelho.fi> References: <20220205092140.751171-1-luca@coelho.fi> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on farmhouse.coelho.fi X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, TVD_RCVD_IP autolearn=ham autolearn_force=no version=3.4.6 Subject: [PATCH 07/12] iwlwifi: mvm: Disable WiFi bands selectively with BIOS Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ayala Barazani The BIOS can contain data about sets of disabled channels. Pass the bitmap to the firmware if present. Signed-off-by: Ayala Barazani Signed-off-by: Luca Coelho --- drivers/net/wireless/intel/iwlwifi/fw/acpi.h | 5 +-- .../wireless/intel/iwlwifi/fw/api/nvm-reg.h | 28 ++++++++++++++- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 36 ++++++++++++++----- 3 files changed, 57 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h index 5ac0979123fc..466c95c21aa9 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* * Copyright (C) 2017 Intel Deutschland GmbH - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation */ #ifndef __iwl_fw_acpi__ #define __iwl_fw_acpi__ @@ -128,7 +128,8 @@ enum iwl_dsm_funcs_rev_0 { DSM_FUNC_ENABLE_6E = 3, DSM_FUNC_11AX_ENABLEMENT = 6, 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 { diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h b/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h index fc85ec426f43..91bfde6d5367 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h @@ -1,6 +1,6 @@ /* 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) 2016-2017 Intel Deutschland GmbH */ @@ -538,6 +538,32 @@ struct iwl_lari_config_change_cmd_v5 { __le32 chan_state_active_bitmap; } __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 * @status: PNVM image loading status diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c index 135a715d924b..77953ee708d2 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c @@ -1313,7 +1313,7 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm) { int ret; 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); @@ -1340,26 +1340,43 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm) if (!ret) 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 || cmd.oem_uhb_allow_bitmap || cmd.oem_11ax_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; u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, WIDE_ID(REGULATORY_AND_NVM_GROUP, LARI_CONFIG_CHANGE), 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); - else if (cmd_ver == 4) + break; + case 4: 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); - else if (cmd_ver == 2) + break; + case 2: cmd_size = sizeof(struct iwl_lari_config_change_cmd_v2); - else + break; + default: cmd_size = sizeof(struct iwl_lari_config_change_cmd_v1); + break; + } IWL_DEBUG_RADIO(mvm, "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) le32_to_cpu(cmd.chan_state_active_bitmap), cmd_ver); IWL_DEBUG_RADIO(mvm, - "sending LARI_CONFIG_CHANGE, oem_uhb_allow_bitmap=0x%x\n", - le32_to_cpu(cmd.oem_uhb_allow_bitmap)); + "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.force_disable_channels_bitmap)); ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(REGULATORY_AND_NVM_GROUP, LARI_CONFIG_CHANGE), -- 2.34.1