1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 /* 3 * Copyright(c) 2021-2023 Intel Corporation 4 */ 5 #ifndef __iwl_fw_uefi__ 6 #define __iwl_fw_uefi__ 7 8 #define IWL_UEFI_OEM_PNVM_NAME L"UefiCnvWlanOemSignedPnvm" 9 #define IWL_UEFI_REDUCED_POWER_NAME L"UefiCnvWlanReducedPower" 10 #define IWL_UEFI_SGOM_NAME L"UefiCnvWlanSarGeoOffsetMapping" 11 #define IWL_UEFI_STEP_NAME L"UefiCnvCommonSTEP" 12 13 #define IWL_SGOM_MAP_SIZE 339 14 15 struct pnvm_sku_package { 16 u8 rev; 17 u32 total_size; 18 u8 n_skus; 19 u32 reserved[2]; 20 u8 data[]; 21 } __packed; 22 23 struct uefi_cnv_wlan_sgom_data { 24 u8 revision; 25 u8 offset_map[IWL_SGOM_MAP_SIZE - 1]; 26 } __packed; 27 28 struct uefi_cnv_common_step_data { 29 u8 revision; 30 u8 step_mode; 31 u8 cnvi_eq_channel; 32 u8 cnvr_eq_channel; 33 u8 radio1; 34 u8 radio2; 35 } __packed; 36 37 /* 38 * This is known to be broken on v4.19 and to work on v5.4. Until we 39 * figure out why this is the case and how to make it work, simply 40 * disable the feature in old kernels. 41 */ 42 #ifdef CONFIG_EFI 43 void *iwl_uefi_get_pnvm(struct iwl_trans *trans, size_t *len); 44 u8 *iwl_uefi_get_reduced_power(struct iwl_trans *trans, size_t *len); 45 int iwl_uefi_reduce_power_parse(struct iwl_trans *trans, 46 const u8 *data, size_t len, 47 struct iwl_pnvm_image *pnvm_data); 48 void iwl_uefi_get_step_table(struct iwl_trans *trans); 49 #else /* CONFIG_EFI */ 50 static inline void *iwl_uefi_get_pnvm(struct iwl_trans *trans, size_t *len) 51 { 52 return ERR_PTR(-EOPNOTSUPP); 53 } 54 55 static inline int 56 iwl_uefi_reduce_power_parse(struct iwl_trans *trans, 57 const u8 *data, size_t len, 58 struct iwl_pnvm_image *pnvm_data) 59 { 60 return -EOPNOTSUPP; 61 } 62 63 static inline u8 * 64 iwl_uefi_get_reduced_power(struct iwl_trans *trans, size_t *len) 65 { 66 return ERR_PTR(-EOPNOTSUPP); 67 } 68 69 static inline void iwl_uefi_get_step_table(struct iwl_trans *trans) 70 { 71 } 72 #endif /* CONFIG_EFI */ 73 74 #if defined(CONFIG_EFI) && defined(CONFIG_ACPI) 75 void iwl_uefi_get_sgom_table(struct iwl_trans *trans, struct iwl_fw_runtime *fwrt); 76 #else 77 static inline 78 void iwl_uefi_get_sgom_table(struct iwl_trans *trans, struct iwl_fw_runtime *fwrt) 79 { 80 } 81 #endif 82 #endif /* __iwl_fw_uefi__ */ 83