Path: blob/main/sys/contrib/dev/iwlwifi/fw/uefi.h
109246 views
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */1/*2* Copyright(c) 2021-2025 Intel Corporation3*/4#ifndef __iwl_fw_uefi__5#define __iwl_fw_uefi__67#include "fw/regulatory.h"89#define IWL_UEFI_OEM_PNVM_NAME L"UefiCnvWlanOemSignedPnvm"10#define IWL_UEFI_REDUCED_POWER_NAME L"UefiCnvWlanReducedPower"11#define IWL_UEFI_SGOM_NAME L"UefiCnvWlanSarGeoOffsetMapping"12#define IWL_UEFI_STEP_NAME L"UefiCnvCommonSTEP"13#define IWL_UEFI_UATS_NAME L"CnvUefiWlanUATS"14#define IWL_UEFI_WRDS_NAME L"UefiCnvWlanWRDS"15#define IWL_UEFI_EWRD_NAME L"UefiCnvWlanEWRD"16#define IWL_UEFI_WGDS_NAME L"UefiCnvWlanWGDS"17#define IWL_UEFI_PPAG_NAME L"UefiCnvWlanPPAG"18#define IWL_UEFI_WTAS_NAME L"UefiCnvWlanWTAS"19#define IWL_UEFI_SPLC_NAME L"UefiCnvWlanSPLC"20#define IWL_UEFI_WRDD_NAME L"UefiCnvWlanWRDD"21#define IWL_UEFI_ECKV_NAME L"UefiCnvCommonECKV"22#define IWL_UEFI_DSM_NAME L"UefiCnvWlanGeneralCfg"23#define IWL_UEFI_WBEM_NAME L"UefiCnvWlanWBEM"24#define IWL_UEFI_PUNCTURING_NAME L"UefiCnvWlanPuncturing"25#define IWL_UEFI_DSBR_NAME L"UefiCnvCommonDSBR"26#define IWL_UEFI_WPFC_NAME L"WPFC"272829#define IWL_SGOM_MAP_SIZE 33930#define IWL_UATS_MAP_SIZE 3393132#define IWL_UEFI_WRDS_REVISION 233#define IWL_UEFI_EWRD_REVISION 234#define IWL_UEFI_WGDS_REVISION 335#define IWL_UEFI_MIN_PPAG_REV 136#define IWL_UEFI_MAX_PPAG_REV 437#define IWL_UEFI_MIN_WTAS_REVISION 138#define IWL_UEFI_MAX_WTAS_REVISION 239#define IWL_UEFI_SPLC_REVISION 040#define IWL_UEFI_WRDD_REVISION 041#define IWL_UEFI_ECKV_REVISION 042#define IWL_UEFI_WBEM_REVISION 043#define IWL_UEFI_DSM_REVISION 444#define IWL_UEFI_PUNCTURING_REVISION 045#define IWL_UEFI_DSBR_REVISION 14647struct pnvm_sku_package {48u8 rev;49u32 total_size;50u8 n_skus;51u32 reserved[2];52u8 data[];53} __packed;5455struct uefi_cnv_wlan_sgom_data {56u8 revision;57u8 offset_map[IWL_SGOM_MAP_SIZE - 1];58} __packed;5960struct uefi_cnv_wlan_uats_data {61u8 revision;62u8 offset_map[IWL_UATS_MAP_SIZE - 1];63} __packed;6465struct uefi_cnv_common_step_data {66u8 revision;67u8 step_mode;68u8 cnvi_eq_channel;69u8 cnvr_eq_channel;70u8 radio1;71u8 radio2;72} __packed;7374/*75* struct uefi_sar_profile - a SAR profile as defined in UEFI76*77* @chains: a per-chain table of SAR values78*/79struct uefi_sar_profile {80struct iwl_sar_profile_chain chains[BIOS_SAR_MAX_CHAINS_PER_PROFILE];81} __packed;8283/*84* struct uefi_cnv_var_wrds - WRDS table as defined in UEFI85*86* @revision: the revision of the table87* @mode: is WRDS enbaled/disabled88* @sar_profile: sar profile #189*/90struct uefi_cnv_var_wrds {91u8 revision;92u32 mode;93struct uefi_sar_profile sar_profile;94} __packed;9596/*97* struct uefi_cnv_var_ewrd - EWRD table as defined in UEFI98* @revision: the revision of the table99* @mode: is WRDS enbaled/disabled100* @num_profiles: how many additional profiles we have in this table (0-3)101* @sar_profiles: the additional SAR profiles (#2-#4)102*/103struct uefi_cnv_var_ewrd {104u8 revision;105u32 mode;106u32 num_profiles;107struct uefi_sar_profile sar_profiles[BIOS_SAR_MAX_PROFILE_NUM - 1];108} __packed;109110/*111* struct uefi_cnv_var_wgds - WGDS table as defined in UEFI112* @revision: the revision of the table113* @num_profiles: the number of geo profiles we have in the table.114* The first 3 are mandatory, and can have up to 8.115* @geo_profiles: a per-profile table of the offsets to add to SAR values.116*/117struct uefi_cnv_var_wgds {118u8 revision;119u8 num_profiles;120struct iwl_geo_profile geo_profiles[BIOS_GEO_MAX_PROFILE_NUM];121} __packed;122123/*124* struct uefi_cnv_var_ppag - PPAG table as defined in UEFI125* @revision: the revision of the table126* @ppag_modes: values from &enum iwl_ppag_flags127* @ppag_chains: the PPAG values per chain and band128*/129struct uefi_cnv_var_ppag {130u8 revision;131u32 ppag_modes;132struct iwl_ppag_chain ppag_chains[IWL_NUM_CHAIN_LIMITS];133} __packed;134135/* struct uefi_cnv_var_wtas - WTAS tabled as defined in UEFI136* @revision: the revision of the table137* @tas_selection: different options of TAS enablement.138* @black_list_size: the number of defined entried in the black list139* @black_list: a list of countries that are not allowed to use the TAS feature140*/141struct uefi_cnv_var_wtas {142u8 revision;143u32 tas_selection;144u8 black_list_size;145u16 black_list[IWL_WTAS_BLACK_LIST_MAX];146} __packed;147148/* struct uefi_cnv_var_splc - SPLC tabled as defined in UEFI149* @revision: the revision of the table150* @default_pwr_limit: The default maximum power per device151*/152struct uefi_cnv_var_splc {153u8 revision;154u32 default_pwr_limit;155} __packed;156157/* struct uefi_cnv_var_wrdd - WRDD table as defined in UEFI158* @revision: the revision of the table159* @mcc: country identifier as defined in ISO/IEC 3166-1 Alpha 2 code160*/161struct uefi_cnv_var_wrdd {162u8 revision;163u32 mcc;164} __packed;165166/* struct uefi_cnv_var_eckv - ECKV table as defined in UEFI167* @revision: the revision of the table168* @ext_clock_valid: indicates if external 32KHz clock is valid169*/170struct uefi_cnv_var_eckv {171u8 revision;172u32 ext_clock_valid;173} __packed;174175#define UEFI_MAX_DSM_FUNCS 32176177/* struct uefi_cnv_var_general_cfg - DSM-like table as defined in UEFI178* @revision: the revision of the table179* @functions: payload of the different DSM functions180*/181struct uefi_cnv_var_general_cfg {182u8 revision;183u32 functions[UEFI_MAX_DSM_FUNCS];184} __packed;185186#define IWL_UEFI_WBEM_REV0_MASK (BIT(0) | BIT(1))187/* struct uefi_cnv_wlan_wbem_data - Bandwidth enablement per MCC as defined188* in UEFI189* @revision: the revision of the table190* @wbem_320mhz_per_mcc: enablement of 320MHz bandwidth per MCC191* bit 0 - if set, 320MHz is enabled for Japan192* bit 1 - if set, 320MHz is enabled for South Korea193* bit 2- 31, Reserved194*/195struct uefi_cnv_wlan_wbem_data {196u8 revision;197u32 wbem_320mhz_per_mcc;198} __packed;199200enum iwl_uefi_cnv_puncturing_flags {201IWL_UEFI_CNV_PUNCTURING_USA_EN_MSK = BIT(0),202IWL_UEFI_CNV_PUNCTURING_CANADA_EN_MSK = BIT(1),203};204205#define IWL_UEFI_PUNCTURING_REV0_MASK (IWL_UEFI_CNV_PUNCTURING_USA_EN_MSK | \206IWL_UEFI_CNV_PUNCTURING_CANADA_EN_MSK)207/**208* struct uefi_cnv_var_puncturing_data - controlling channel209* puncturing for few countries.210* @revision: the revision of the table211* @puncturing: enablement of channel puncturing per mcc212* see &enum iwl_uefi_cnv_puncturing_flags.213*/214struct uefi_cnv_var_puncturing_data {215u8 revision;216u32 puncturing;217} __packed;218219/**220* struct uefi_cnv_wlan_dsbr_data - BIOS STEP configuration information221* @revision: the revision of the table222* @config: STEP configuration flags:223* bit 8, switch to URM depending on FW setting224* bit 9, switch to URM225*226* Platform information for STEP configuration/workarounds.227*/228struct uefi_cnv_wlan_dsbr_data {229u8 revision;230u32 config;231} __packed;232233/**234* struct uefi_cnv_wpfc_data - BIOS Wi-Fi PHY filter Configuration235* @revision: the revision of the table236* @chains: configuration of each of the chains (a-d)237*238* specific PHY filter configuration239*/240struct uefi_cnv_wpfc_data {241u8 revision;242u32 chains[4];243} __packed;244245/*246* This is known to be broken on v4.19 and to work on v5.4. Until we247* figure out why this is the case and how to make it work, simply248* disable the feature in old kernels.249*/250#ifdef CONFIG_EFI251void *iwl_uefi_get_pnvm(struct iwl_trans *trans, size_t *len);252u8 *iwl_uefi_get_reduced_power(struct iwl_trans *trans, size_t *len);253int iwl_uefi_reduce_power_parse(struct iwl_trans *trans,254const u8 *data, size_t len,255struct iwl_pnvm_image *pnvm_data,256__le32 sku_id[3]);257void iwl_uefi_get_step_table(struct iwl_trans *trans);258int iwl_uefi_handle_tlv_mem_desc(struct iwl_trans *trans, const u8 *data,259u32 tlv_len, struct iwl_pnvm_image *pnvm_data);260int iwl_uefi_get_wrds_table(struct iwl_fw_runtime *fwrt);261int iwl_uefi_get_ewrd_table(struct iwl_fw_runtime *fwrt);262int iwl_uefi_get_wgds_table(struct iwl_fw_runtime *fwrt);263int iwl_uefi_get_ppag_table(struct iwl_fw_runtime *fwrt);264int iwl_uefi_get_tas_table(struct iwl_fw_runtime *fwrt,265struct iwl_tas_data *data);266int iwl_uefi_get_pwr_limit(struct iwl_fw_runtime *fwrt,267u64 *dflt_pwr_limit);268int iwl_uefi_get_mcc(struct iwl_fw_runtime *fwrt, char *mcc);269int iwl_uefi_get_eckv(struct iwl_fw_runtime *fwrt, u32 *extl_clk);270int iwl_uefi_get_wbem(struct iwl_fw_runtime *fwrt, u32 *value);271int iwl_uefi_get_dsm(struct iwl_fw_runtime *fwrt, enum iwl_dsm_funcs func,272u32 *value);273void iwl_uefi_get_sgom_table(struct iwl_trans *trans, struct iwl_fw_runtime *fwrt);274void iwl_uefi_get_uats_table(struct iwl_trans *trans,275struct iwl_fw_runtime *fwrt);276int iwl_uefi_get_puncturing(struct iwl_fw_runtime *fwrt);277int iwl_uefi_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value);278int iwl_uefi_get_phy_filters(struct iwl_fw_runtime *fwrt);279#else /* CONFIG_EFI */280static inline void *iwl_uefi_get_pnvm(struct iwl_trans *trans, size_t *len)281{282return ERR_PTR(-EOPNOTSUPP);283}284285static inline int286iwl_uefi_reduce_power_parse(struct iwl_trans *trans,287const u8 *data, size_t len,288struct iwl_pnvm_image *pnvm_data,289__le32 sku_id[3])290{291return -EOPNOTSUPP;292}293294static inline u8 *295iwl_uefi_get_reduced_power(struct iwl_trans *trans, size_t *len)296{297return ERR_PTR(-EOPNOTSUPP);298}299300static inline void iwl_uefi_get_step_table(struct iwl_trans *trans)301{302}303304static inline int305iwl_uefi_handle_tlv_mem_desc(struct iwl_trans *trans, const u8 *data,306u32 tlv_len, struct iwl_pnvm_image *pnvm_data)307{308return 0;309}310311static inline int iwl_uefi_get_wrds_table(struct iwl_fw_runtime *fwrt)312{313return -ENOENT;314}315316static inline int iwl_uefi_get_ewrd_table(struct iwl_fw_runtime *fwrt)317{318return -ENOENT;319}320321static inline int iwl_uefi_get_wgds_table(struct iwl_fw_runtime *fwrt)322{323return -ENOENT;324}325326static inline int iwl_uefi_get_ppag_table(struct iwl_fw_runtime *fwrt)327{328return -ENOENT;329}330331static inline int iwl_uefi_get_tas_table(struct iwl_fw_runtime *fwrt,332struct iwl_tas_data *data)333{334return -ENOENT;335}336337static inline int iwl_uefi_get_pwr_limit(struct iwl_fw_runtime *fwrt,338u64 *dflt_pwr_limit)339{340*dflt_pwr_limit = 0;341return 0;342}343344static inline int iwl_uefi_get_mcc(struct iwl_fw_runtime *fwrt, char *mcc)345{346return -ENOENT;347}348349static inline int iwl_uefi_get_eckv(struct iwl_fw_runtime *fwrt, u32 *extl_clk)350{351return -ENOENT;352}353354static inline int iwl_uefi_get_wbem(struct iwl_fw_runtime *fwrt, u32 *value)355{356return -ENOENT;357}358359static inline int iwl_uefi_get_dsm(struct iwl_fw_runtime *fwrt,360enum iwl_dsm_funcs func, u32 *value)361{362return -ENOENT;363}364365static inline366void iwl_uefi_get_sgom_table(struct iwl_trans *trans, struct iwl_fw_runtime *fwrt)367{368}369370static inline void371iwl_uefi_get_uats_table(struct iwl_trans *trans, struct iwl_fw_runtime *fwrt)372{373}374375static inline376int iwl_uefi_get_puncturing(struct iwl_fw_runtime *fwrt)377{378#if defined(__linux__)379return 0;380#elif defined(__FreeBSD__)381return -ENOENT;382#endif383}384385static inline386int iwl_uefi_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value)387{388return -ENOENT;389}390391static inline int iwl_uefi_get_phy_filters(struct iwl_fw_runtime *fwrt)392{393return -ENOENT;394}395#endif /* CONFIG_EFI */396#endif /* __iwl_fw_uefi__ */397398399