// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 /*
  * Copyright (C) 2017 Intel Deutschland GmbH
- * Copyright (C) 2019-2023 Intel Corporation
+ * Copyright (C) 2019-2024 Intel Corporation
  */
 #include <linux/uuid.h>
 #include "iwl-drv.h"
        kfree(data);
 }
 IWL_EXPORT_SYMBOL(iwl_acpi_get_guid_lock_status);
+
+int iwl_acpi_get_wbem(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_WBEM_METHOD);
+       if (IS_ERR(data))
+               return ret;
+
+       wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
+                                        ACPI_WBEM_WIFI_DATA_SIZE,
+                                        &tbl_rev);
+       if (IS_ERR(wifi_pkg))
+               goto out_free;
+
+       if (tbl_rev != IWL_ACPI_WBEM_REVISION) {
+               IWL_DEBUG_RADIO(fwrt, "Unsupported ACPI WBEM 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_ACPI_WBEM_REV0_MASK;
+       IWL_DEBUG_RADIO(fwrt, "Loaded WBEM config from ACPI\n");
+       ret = 0;
+out_free:
+       kfree(data);
+       return ret;
+}
 
 #define ACPI_WTAS_METHOD       "WTAS"
 #define ACPI_WPFC_METHOD       "WPFC"
 #define ACPI_GLAI_METHOD       "GLAI"
+#define ACPI_WBEM_METHOD       "WBEM"
 
 #define ACPI_WIFI_DOMAIN       (0x07)
 
 #define ACPI_WRDD_WIFI_DATA_SIZE       2
 #define ACPI_SPLC_WIFI_DATA_SIZE       2
 #define ACPI_ECKV_WIFI_DATA_SIZE       2
+
+/*
+ * One element for domain type,
+ * 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 the status
 
 #define ACPI_DSM_REV 0
 
+#define IWL_ACPI_WBEM_REV0_MASK (BIT(0) | BIT(1))
+#define IWL_ACPI_WBEM_REVISION 0
+
 #ifdef CONFIG_ACPI
 
 struct iwl_fw_runtime;
 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);
 #else /* CONFIG_ACPI */
 
 static inline void *iwl_acpi_get_dsm_object(struct device *dev, int rev,
 {
        return -ENOENT;
 }
+
+static inline int iwl_acpi_get_wbem(struct iwl_fw_runtime *fwrt, u32 *value)
+{
+       return -ENOENT;
+}
 #endif /* CONFIG_ACPI */
 
 #endif /* __iwl_fw_acpi__ */
 
         *      &struct iwl_lari_config_change_cmd_v3,
         *      &struct iwl_lari_config_change_cmd_v4,
         *      &struct iwl_lari_config_change_cmd_v5,
-        *      &struct iwl_lari_config_change_cmd_v6 or
-        *      &struct iwl_lari_config_change_cmd_v7
+        *      &struct iwl_lari_config_change_cmd_v6,
+        *      &struct iwl_lari_config_change_cmd_v7 or
+        *      &struct iwl_lari_config_change_cmd
         */
        LARI_CONFIG_CHANGE = 0x1,
 
 /* LARI_CHANGE_CONF_CMD_S_VER_8 */
 /* LARI_CHANGE_CONF_CMD_S_VER_9 */
 
+/**
+ * struct iwl_lari_config_change_cmd - 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.
+ *     For LARI cmd version 10 - bits 0:5 are supported.
+ * @chan_state_active_bitmap: Bitmap to enable different bands per country
+ *     or region.
+ *     Each bit represents a country or region, and a band to activate
+ *     according to the BIOS definitions.
+ *     For LARI cmd version 10 - bits 0:4 are supported.
+ * @force_disable_channels_bitmap: Bitmap of disabled bands/channels.
+ *     Each bit represents a set of channels in a specific band that should be
+ *     disabled
+ * @edt_bitmap: Bitmap of energy detection threshold table.
+ *     Disable/enable the EDT optimization method for different band.
+ * @oem_320mhz_allow_bitmap: 320Mhz bandwidth enablement bitmap per MCC.
+ *     bit0: enable 320Mhz in Japan.
+ *     bit1: enable 320Mhz in South Korea.
+ *     bit 2 - 31: reserved.
+ */
+struct iwl_lari_config_change_cmd {
+       __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;
+       __le32 edt_bitmap;
+       __le32 oem_320mhz_allow_bitmap;
+} __packed;
+/* LARI_CHANGE_CONF_CMD_S_VER_10 */
+
 /* Activate UNII-1 (5.2GHz) for World Wide */
 #define ACTIVATE_5G2_IN_WW_MASK        BIT(4)
 
 
 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);
 
 
 static const struct dmi_system_id dmi_ppag_approved_list[] = {
        size_t cmd_size;
 
        switch (cmd_ver) {
+       case 10:
+               cmd_size = sizeof(struct iwl_lari_config_change_cmd);
+               break;
        case 9:
        case 8:
        case 7:
 }
 
 int iwl_fill_lari_config(struct iwl_fw_runtime *fwrt,
-                        struct iwl_lari_config_change_cmd_v7 *cmd,
+                        struct iwl_lari_config_change_cmd *cmd,
                         size_t *cmd_size)
 {
        int ret;
        if (!ret)
                cmd->edt_bitmap = cpu_to_le32(value);
 
+       ret = iwl_bios_get_wbem(fwrt, &value);
+       if (!ret)
+               cmd->oem_320mhz_allow_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->force_disable_channels_bitmap ||
-           cmd->edt_bitmap) {
+           cmd->edt_bitmap ||
+           cmd->oem_320mhz_allow_bitmap) {
                IWL_DEBUG_RADIO(fwrt,
                                "sending LARI_CONFIG_CHANGE, config_bitmap=0x%x, oem_11ax_allow_bitmap=0x%x\n",
                                le32_to_cpu(cmd->config_bitmap),
                                le32_to_cpu(cmd->oem_uhb_allow_bitmap),
                                le32_to_cpu(cmd->force_disable_channels_bitmap));
                IWL_DEBUG_RADIO(fwrt,
-                               "sending LARI_CONFIG_CHANGE, edt_bitmap=0x%x\n",
-                               le32_to_cpu(cmd->edt_bitmap));
+                               "sending LARI_CONFIG_CHANGE, edt_bitmap=0x%x, oem_320mhz_allow_bitmap=0x%x\n",
+                               le32_to_cpu(cmd->edt_bitmap),
+                               le32_to_cpu(cmd->oem_320mhz_allow_bitmap));
        } else {
                return 1;
        }
 
 
 int iwl_bios_get_mcc(struct iwl_fw_runtime *fwrt, char *mcc);
 int iwl_bios_get_eckv(struct iwl_fw_runtime *fwrt, u32 *ext_clk);
+int iwl_bios_get_wbem(struct iwl_fw_runtime *fwrt, u32 *value);
 
 int iwl_fill_lari_config(struct iwl_fw_runtime *fwrt,
-                        struct iwl_lari_config_change_cmd_v7 *cmd,
+                        struct iwl_lari_config_change_cmd *cmd,
                         size_t *cmd_size);
 
 int iwl_bios_get_dsm(struct iwl_fw_runtime *fwrt, enum iwl_dsm_funcs func,
 
        return ret;
 }
 
+int iwl_uefi_get_wbem(struct iwl_fw_runtime *fwrt, u32 *value)
+{
+       struct uefi_cnv_wlan_wbem_data *data;
+       int ret = 0;
+
+       data = iwl_uefi_get_verified_variable(fwrt->trans, IWL_UEFI_WBEM_NAME,
+                                             "WBEM", sizeof(*data), NULL);
+       if (IS_ERR(data))
+               return -EINVAL;
+
+       if (data->revision != IWL_UEFI_WBEM_REVISION) {
+               ret = -EINVAL;
+               IWL_DEBUG_RADIO(fwrt, "Unsupported UEFI WBEM revision:%d\n",
+                               data->revision);
+               goto out;
+       }
+       *value = data->wbem_320mhz_per_mcc & IWL_UEFI_WBEM_REV0_MASK;
+       IWL_DEBUG_RADIO(fwrt, "Loaded WBEM config from UEFI\n");
+out:
+       kfree(data);
+       return ret;
+}
+
 int iwl_uefi_get_dsm(struct iwl_fw_runtime *fwrt, enum iwl_dsm_funcs func,
                     u32 *value)
 {
 
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
 /*
- * Copyright(c) 2021-2023 Intel Corporation
+ * Copyright(c) 2021-2024 Intel Corporation
  */
 #ifndef __iwl_fw_uefi__
 #define __iwl_fw_uefi__
 #define IWL_UEFI_WRDD_NAME             L"UefiCnvWlanWRDD"
 #define IWL_UEFI_ECKV_NAME             L"UefiCnvWlanECKV"
 #define IWL_UEFI_DSM_NAME              L"UefiCnvWlanGeneralCfg"
+#define IWL_UEFI_WBEM_NAME             L"UefiCnvWlanWBEM"
 
 
 #define IWL_SGOM_MAP_SIZE              339
 #define IWL_UEFI_SPLC_REVISION         0
 #define IWL_UEFI_WRDD_REVISION         0
 #define IWL_UEFI_ECKV_REVISION         0
+#define IWL_UEFI_WBEM_REVISION         0
 #define IWL_UEFI_DSM_REVISION          4
 
 struct pnvm_sku_package {
        u32 functions[UEFI_MAX_DSM_FUNCS];
 } __packed;
 
+#define IWL_UEFI_WBEM_REV0_MASK (BIT(0) | BIT(1))
+/* struct uefi_cnv_wlan_wbem_data - Bandwidth enablement per MCC as defined
+ *     in UEFI
+ * @revision: the revision of the table
+ * @wbem_320mhz_per_mcc: enablement of 320MHz bandwidth per MCC
+ *     bit 0 - if set, 320MHz is enabled for Japan
+ *     bit 1 - if set, 320MHz is enabled for South Korea
+ *     bit 2- 31, Reserved
+ */
+struct uefi_cnv_wlan_wbem_data {
+       u8 revision;
+       u32 wbem_320mhz_per_mcc;
+} __packed;
+
 /*
  * This is known to be broken on v4.19 and to work on v5.4.  Until we
  * figure out why this is the case and how to make it work, simply
                           u64 *dflt_pwr_limit);
 int iwl_uefi_get_mcc(struct iwl_fw_runtime *fwrt, char *mcc);
 int iwl_uefi_get_eckv(struct iwl_fw_runtime *fwrt, u32 *extl_clk);
+int iwl_uefi_get_wbem(struct iwl_fw_runtime *fwrt, u32 *value);
 int iwl_uefi_get_dsm(struct iwl_fw_runtime *fwrt, enum iwl_dsm_funcs func,
                     u32 *value);
 void iwl_uefi_get_sgom_table(struct iwl_trans *trans, struct iwl_fw_runtime *fwrt);
        return -ENOENT;
 }
 
+static inline int iwl_uefi_get_wbem(struct iwl_fw_runtime *fwrt, u32 *value)
+{
+       return -ENOENT;
+}
+
 static inline int iwl_uefi_get_dsm(struct iwl_fw_runtime *fwrt,
                                   enum iwl_dsm_funcs func, u32 *value)
 {
 
 
 static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
 {
-       int ret;
+       struct iwl_lari_config_change_cmd cmd;
        size_t cmd_size;
-       struct iwl_lari_config_change_cmd_v7 cmd;
+       int ret;
 
        ret = iwl_fill_lari_config(&mvm->fwrt, &cmd, &cmd_size);
        if (!ret) {