Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
0002 /*
0003  * Copyright(c) 2021 Intel Corporation
0004  */
0005 #ifndef __iwl_fw_uefi__
0006 #define __iwl_fw_uefi__
0007 
0008 #define IWL_UEFI_OEM_PNVM_NAME      L"UefiCnvWlanOemSignedPnvm"
0009 #define IWL_UEFI_REDUCED_POWER_NAME L"UefiCnvWlanReducedPower"
0010 #define IWL_UEFI_SGOM_NAME      L"UefiCnvWlanSarGeoOffsetMapping"
0011 
0012 /*
0013  * TODO: we have these hardcoded values that the caller must pass,
0014  * because reading from the UEFI is not working.  To implement this
0015  * properly, we have to change iwl_pnvm_get_from_uefi() to call
0016  * efivar_entry_size() and return the value to the caller instead.
0017  */
0018 #define IWL_HARDCODED_PNVM_SIZE     4096
0019 #define IWL_HARDCODED_REDUCE_POWER_SIZE 32768
0020 #define IWL_HARDCODED_SGOM_SIZE     339
0021 
0022 struct pnvm_sku_package {
0023     u8 rev;
0024     u32 total_size;
0025     u8 n_skus;
0026     u32 reserved[2];
0027     u8 data[];
0028 } __packed;
0029 
0030 struct uefi_cnv_wlan_sgom_data {
0031     u8 revision;
0032     u8 offset_map[IWL_HARDCODED_SGOM_SIZE - 1];
0033 } __packed;
0034 
0035 /*
0036  * This is known to be broken on v4.19 and to work on v5.4.  Until we
0037  * figure out why this is the case and how to make it work, simply
0038  * disable the feature in old kernels.
0039  */
0040 #ifdef CONFIG_EFI
0041 void *iwl_uefi_get_pnvm(struct iwl_trans *trans, size_t *len);
0042 void *iwl_uefi_get_reduced_power(struct iwl_trans *trans, size_t *len);
0043 #else /* CONFIG_EFI */
0044 static inline
0045 void *iwl_uefi_get_pnvm(struct iwl_trans *trans, size_t *len)
0046 {
0047     return ERR_PTR(-EOPNOTSUPP);
0048 }
0049 
0050 static inline
0051 void *iwl_uefi_get_reduced_power(struct iwl_trans *trans, size_t *len)
0052 {
0053     return ERR_PTR(-EOPNOTSUPP);
0054 }
0055 #endif /* CONFIG_EFI */
0056 
0057 #if defined(CONFIG_EFI) && defined(CONFIG_ACPI)
0058 void iwl_uefi_get_sgom_table(struct iwl_trans *trans, struct iwl_fw_runtime *fwrt);
0059 #else
0060 static inline
0061 void iwl_uefi_get_sgom_table(struct iwl_trans *trans, struct iwl_fw_runtime *fwrt)
0062 {
0063 }
0064 #endif
0065 #endif /* __iwl_fw_uefi__ */