iwlwifi: mvm: add support for version 3 of LARI_CONFIG_CHANGE command.
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Sun, 11 Apr 2021 09:46:28 +0000 (12:46 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 14 Apr 2021 09:07:20 +0000 (12:07 +0300)
Add support for version 3 of the LARI_CONFIG_CHANGE command.
This is needed to support FW API change which is needed
to support 11ax enablement in Russia.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411124418.7e68856c8a95.I83acdbe39b63c363cabc04ad42d1d0b9ce98901c@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/acpi.c
drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
drivers/net/wireless/intel/iwlwifi/mvm/fw.c

index eecc76a..e31bba8 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 /*
  * Copyright (C) 2017 Intel Deutschland GmbH
- * Copyright (C) 2019-2020 Intel Corporation
+ * Copyright (C) 2019-2021 Intel Corporation
  */
 #include <linux/uuid.h>
 #include "iwl-drv.h"
@@ -759,14 +759,6 @@ __le32 iwl_acpi_get_lari_config_bitmap(struct iwl_fw_runtime *fwrt)
                config_bitmap |=
                        cpu_to_le32(LARI_CONFIG_CHANGE_ETSI_TO_DISABLED_MSK);
 
-       /*
-        ** Evaluate func 'DSM_FUNC_11AX_ENABLEMENT'
-        */
-       ret = iwl_acpi_eval_dsm_func(fwrt->dev, DSM_FUNC_11AX_ENABLEMENT);
-
-       config_bitmap |=
-               cpu_to_le32((ret &= IWL_11AX_UKRAINE_MASK) << IWL_11AX_UKRAINE_SHIFT);
-
        return config_bitmap;
 }
 IWL_EXPORT_SYMBOL(iwl_acpi_get_lari_config_bitmap);
index 3a358bb..dc8f277 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
 /*
- * Copyright (C) 2012-2014, 2018-2020 Intel Corporation
+ * Copyright (C) 2012-2014, 2018-2021 Intel Corporation
  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
  * Copyright (C) 2016-2017 Intel Deutschland GmbH
  */
@@ -438,6 +438,21 @@ struct iwl_lari_config_change_cmd_v2 {
 } __packed; /* LARI_CHANGE_CONF_CMD_S_VER_2 */
 
 /**
+ * struct iwl_lari_config_change_cmd_v3 - change LARI configuration
+ * @config_bitmap: bit map 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.
+ * For each supported country, a pair of regulatory override bit and 11ax mode exist
+ * in the bit field.
+ */
+struct iwl_lari_config_change_cmd_v3 {
+       __le32 config_bitmap;
+       __le32 oem_uhb_allow_bitmap;
+       __le32 oem_11ax_allow_bitmap;
+} __packed; /* LARI_CHANGE_CONF_CMD_S_VER_3 */
+
+/**
  * struct iwl_pnvm_init_complete_ntfy - PNVM initialization complete
  * @status: PNVM image loading status
  */
index 9a3981f..8aa5f1a 100644 (file)
@@ -1140,18 +1140,24 @@ static u8 iwl_mvm_eval_dsm_rfi(struct iwl_mvm *mvm)
 static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
 {
        int cmd_ret;
-       struct iwl_lari_config_change_cmd_v2 cmd = {};
+       struct iwl_lari_config_change_cmd_v3 cmd = {};
 
        cmd.config_bitmap = iwl_acpi_get_lari_config_bitmap(&mvm->fwrt);
 
        /* apply more config masks here */
 
        if (cmd.config_bitmap) {
-               size_t cmd_size = iwl_fw_lookup_cmd_ver(mvm->fw,
-                                                       REGULATORY_AND_NVM_GROUP,
-                                                       LARI_CONFIG_CHANGE, 1) == 2 ?
-                       sizeof(struct iwl_lari_config_change_cmd_v2) :
-                       sizeof(struct iwl_lari_config_change_cmd_v1);
+               size_t cmd_size;
+               u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw,
+                                                  REGULATORY_AND_NVM_GROUP,
+                                                  LARI_CONFIG_CHANGE, 1);
+               if (cmd_ver == 3)
+                       cmd_size = sizeof(struct iwl_lari_config_change_cmd_v3);
+               else if (cmd_ver == 2)
+                       cmd_size = sizeof(struct iwl_lari_config_change_cmd_v2);
+               else
+                       cmd_size = sizeof(struct iwl_lari_config_change_cmd_v1);
+
                IWL_DEBUG_RADIO(mvm,
                                "sending LARI_CONFIG_CHANGE, config_bitmap=0x%x\n",
                                le32_to_cpu(cmd.config_bitmap));