xref: /linux/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h (revision 91ec2035134982b98fab0609a9fd8480e8217dc1)
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3  * Copyright (C) 2012-2014, 2018-2026 Intel Corporation
4  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5  * Copyright (C) 2016-2017 Intel Deutschland GmbH
6  */
7 #ifndef __iwl_fw_api_nvm_reg_h__
8 #define __iwl_fw_api_nvm_reg_h__
9 
10 /**
11  * enum iwl_regulatory_and_nvm_subcmd_ids - regulatory/NVM commands
12  */
13 enum iwl_regulatory_and_nvm_subcmd_ids {
14 	/**
15 	 * @NVM_ACCESS_COMPLETE: &struct iwl_nvm_access_complete_cmd
16 	 */
17 	NVM_ACCESS_COMPLETE = 0x0,
18 
19 	/**
20 	 * @LARI_CONFIG_CHANGE: &struct iwl_lari_config_change_cmd_v1,
21 	 *	&struct iwl_lari_config_change_cmd_v6,
22 	 *	&struct iwl_lari_config_change_cmd_v8,
23 	 *	&struct iwl_lari_config_change_cmd
24 	 */
25 	LARI_CONFIG_CHANGE = 0x1,
26 
27 	/**
28 	 * @NVM_GET_INFO:
29 	 * Command is &struct iwl_nvm_get_info,
30 	 * response is &struct iwl_nvm_get_info_rsp
31 	 */
32 	NVM_GET_INFO = 0x2,
33 
34 	/**
35 	 * @TAS_CONFIG: &union iwl_tas_config_cmd
36 	 */
37 	TAS_CONFIG = 0x3,
38 
39 	/**
40 	 * @SAR_OFFSET_MAPPING_TABLE_CMD: &struct iwl_sar_offset_mapping_cmd
41 	 */
42 	SAR_OFFSET_MAPPING_TABLE_CMD = 0x4,
43 
44 	/**
45 	 * @MCC_ALLOWED_AP_TYPE_CMD: &struct iwl_mcc_allowed_ap_type_cmd
46 	 */
47 	MCC_ALLOWED_AP_TYPE_CMD = 0x5,
48 
49 	/**
50 	 * @LARI_CONFIG_EXTENSION: &struct iwl_lari_config_extension_cmd
51 	 */
52 	LARI_CONFIG_EXTENSION = 0x8,
53 
54 	/**
55 	 * @PNVM_INIT_COMPLETE_NTFY: &struct iwl_pnvm_init_complete_ntfy
56 	 */
57 	PNVM_INIT_COMPLETE_NTFY = 0xFE,
58 };
59 
60 /**
61  * enum iwl_nvm_access_op - NVM access opcode
62  * @IWL_NVM_READ: read NVM
63  * @IWL_NVM_WRITE: write NVM
64  */
65 enum iwl_nvm_access_op {
66 	IWL_NVM_READ	= 0,
67 	IWL_NVM_WRITE	= 1,
68 };
69 
70 /**
71  * enum iwl_nvm_access_target - target of the NVM_ACCESS_CMD
72  * @NVM_ACCESS_TARGET_CACHE: access the cache
73  * @NVM_ACCESS_TARGET_OTP: access the OTP
74  * @NVM_ACCESS_TARGET_EEPROM: access the EEPROM
75  */
76 enum iwl_nvm_access_target {
77 	NVM_ACCESS_TARGET_CACHE = 0,
78 	NVM_ACCESS_TARGET_OTP = 1,
79 	NVM_ACCESS_TARGET_EEPROM = 2,
80 };
81 
82 /**
83  * enum iwl_nvm_section_type - section types for NVM_ACCESS_CMD
84  * @NVM_SECTION_TYPE_SW: software section
85  * @NVM_SECTION_TYPE_REGULATORY: regulatory section
86  * @NVM_SECTION_TYPE_CALIBRATION: calibration section
87  * @NVM_SECTION_TYPE_PRODUCTION: production section
88  * @NVM_SECTION_TYPE_REGULATORY_SDP: regulatory section used by 3168 series
89  * @NVM_SECTION_TYPE_MAC_OVERRIDE: MAC override section
90  * @NVM_SECTION_TYPE_PHY_SKU: PHY SKU section
91  * @NVM_MAX_NUM_SECTIONS: number of sections
92  */
93 enum iwl_nvm_section_type {
94 	NVM_SECTION_TYPE_SW = 1,
95 	NVM_SECTION_TYPE_REGULATORY = 3,
96 	NVM_SECTION_TYPE_CALIBRATION = 4,
97 	NVM_SECTION_TYPE_PRODUCTION = 5,
98 	NVM_SECTION_TYPE_REGULATORY_SDP = 8,
99 	NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
100 	NVM_SECTION_TYPE_PHY_SKU = 12,
101 	NVM_MAX_NUM_SECTIONS = 13,
102 };
103 
104 /**
105  * struct iwl_nvm_access_cmd - Request the device to send an NVM section
106  * @op_code: &enum iwl_nvm_access_op
107  * @target: &enum iwl_nvm_access_target
108  * @type: &enum iwl_nvm_section_type
109  * @offset: offset in bytes into the section
110  * @length: in bytes, to read/write
111  * @data: if write operation, the data to write. On read its empty
112  */
113 struct iwl_nvm_access_cmd {
114 	u8 op_code;
115 	u8 target;
116 	__le16 type;
117 	__le16 offset;
118 	__le16 length;
119 	u8 data[];
120 } __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */
121 
122 /**
123  * struct iwl_nvm_access_resp - response to NVM_ACCESS_CMD
124  * @offset: offset in bytes into the section
125  * @length: in bytes, either how much was written or read
126  * @type: NVM_SECTION_TYPE_*
127  * @status: 0 for success, fail otherwise
128  * @data: if read operation, the data returned. Empty on write.
129  */
130 struct iwl_nvm_access_resp {
131 	__le16 offset;
132 	__le16 length;
133 	__le16 type;
134 	__le16 status;
135 	u8 data[];
136 } __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */
137 
138 /*
139  * struct iwl_nvm_get_info - request to get NVM data
140  */
141 struct iwl_nvm_get_info {
142 	__le32 reserved;
143 } __packed; /* REGULATORY_NVM_GET_INFO_CMD_API_S_VER_1 */
144 
145 /**
146  * enum iwl_nvm_info_general_flags - flags in NVM_GET_INFO resp
147  * @NVM_GENERAL_FLAGS_EMPTY_OTP: 1 if OTP is empty
148  */
149 enum iwl_nvm_info_general_flags {
150 	NVM_GENERAL_FLAGS_EMPTY_OTP	= BIT(0),
151 };
152 
153 /**
154  * struct iwl_nvm_get_info_general - general NVM data
155  * @flags: bit 0: 1 - empty, 0 - non-empty
156  * @nvm_version: nvm version
157  * @board_type: board type
158  * @n_hw_addrs: number of reserved MAC addresses
159  */
160 struct iwl_nvm_get_info_general {
161 	__le32 flags;
162 	__le16 nvm_version;
163 	u8 board_type;
164 	u8 n_hw_addrs;
165 } __packed; /* REGULATORY_NVM_GET_INFO_GENERAL_S_VER_2 */
166 
167 /**
168  * enum iwl_nvm_mac_sku_flags - flags in &iwl_nvm_get_info_sku
169  * @NVM_MAC_SKU_FLAGS_BAND_2_4_ENABLED: true if 2.4 band enabled
170  * @NVM_MAC_SKU_FLAGS_BAND_5_2_ENABLED: true if 5.2 band enabled
171  * @NVM_MAC_SKU_FLAGS_802_11N_ENABLED: true if 11n enabled
172  * @NVM_MAC_SKU_FLAGS_802_11AC_ENABLED: true if 11ac enabled
173  * @NVM_MAC_SKU_FLAGS_MIMO_DISABLED: true if MIMO disabled
174  * @NVM_MAC_SKU_FLAGS_WAPI_ENABLED: true if WAPI enabled
175  * @NVM_MAC_SKU_FLAGS_REG_CHECK_ENABLED: true if regulatory checker enabled
176  * @NVM_MAC_SKU_FLAGS_API_LOCK_ENABLED: true if API lock enabled
177  */
178 enum iwl_nvm_mac_sku_flags {
179 	NVM_MAC_SKU_FLAGS_BAND_2_4_ENABLED	= BIT(0),
180 	NVM_MAC_SKU_FLAGS_BAND_5_2_ENABLED	= BIT(1),
181 	NVM_MAC_SKU_FLAGS_802_11N_ENABLED	= BIT(2),
182 	NVM_MAC_SKU_FLAGS_802_11AC_ENABLED	= BIT(3),
183 	/**
184 	 * @NVM_MAC_SKU_FLAGS_802_11AX_ENABLED: true if 11ax enabled
185 	 */
186 	NVM_MAC_SKU_FLAGS_802_11AX_ENABLED	= BIT(4),
187 	NVM_MAC_SKU_FLAGS_MIMO_DISABLED		= BIT(5),
188 	NVM_MAC_SKU_FLAGS_WAPI_ENABLED		= BIT(8),
189 	NVM_MAC_SKU_FLAGS_REG_CHECK_ENABLED	= BIT(14),
190 	NVM_MAC_SKU_FLAGS_API_LOCK_ENABLED	= BIT(15),
191 };
192 
193 /**
194  * struct iwl_nvm_get_info_sku - mac information
195  * @mac_sku_flags: flags for SKU, see &enum iwl_nvm_mac_sku_flags
196  */
197 struct iwl_nvm_get_info_sku {
198 	__le32 mac_sku_flags;
199 } __packed; /* REGULATORY_NVM_GET_INFO_MAC_SKU_SECTION_S_VER_2 */
200 
201 /**
202  * struct iwl_nvm_get_info_phy - phy information
203  * @tx_chains: BIT 0 chain A, BIT 1 chain B
204  * @rx_chains: BIT 0 chain A, BIT 1 chain B
205  */
206 struct iwl_nvm_get_info_phy {
207 	__le32 tx_chains;
208 	__le32 rx_chains;
209 } __packed; /* REGULATORY_NVM_GET_INFO_PHY_SKU_SECTION_S_VER_1 */
210 
211 #define IWL_NUM_CHANNELS_V1	51
212 #define IWL_NUM_CHANNELS_V2	110
213 #define IWL_NUM_CHANNELS_V3	115
214 
215 /**
216  * struct iwl_nvm_get_info_regulatory_v1 - regulatory information
217  * @lar_enabled: is LAR enabled
218  * @channel_profile: regulatory data of this channel
219  * @reserved: reserved
220  */
221 struct iwl_nvm_get_info_regulatory_v1 {
222 	__le32 lar_enabled;
223 	__le16 channel_profile[IWL_NUM_CHANNELS_V1];
224 	__le16 reserved;
225 } __packed; /* REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */
226 
227 /**
228  * struct iwl_nvm_get_info_regulatory_v2 - regulatory information
229  * @lar_enabled: is LAR enabled
230  * @n_channels: number of valid channels in the array
231  * @channel_profile: regulatory data of this channel
232  */
233 struct iwl_nvm_get_info_regulatory_v2 {
234 	__le32 lar_enabled;
235 	__le32 n_channels;
236 	__le32 channel_profile[IWL_NUM_CHANNELS_V2];
237 } __packed; /* REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_2 */
238 
239 /**
240  * struct iwl_nvm_get_info_rsp_v3 - response to get NVM data
241  * @general: general NVM data
242  * @mac_sku: data relating to MAC sku
243  * @phy_sku: data relating to PHY sku
244  * @regulatory: regulatory data
245  */
246 struct iwl_nvm_get_info_rsp_v3 {
247 	struct iwl_nvm_get_info_general general;
248 	struct iwl_nvm_get_info_sku mac_sku;
249 	struct iwl_nvm_get_info_phy phy_sku;
250 	struct iwl_nvm_get_info_regulatory_v1 regulatory;
251 } __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_3 */
252 
253 /**
254  * struct iwl_nvm_get_info_rsp_v4 - response to get NVM data
255  * @general: general NVM data
256  * @mac_sku: data relating to MAC sku
257  * @phy_sku: data relating to PHY sku
258  * @regulatory: regulatory data
259  */
260 struct iwl_nvm_get_info_rsp_v4 {
261 	struct iwl_nvm_get_info_general general;
262 	struct iwl_nvm_get_info_sku mac_sku;
263 	struct iwl_nvm_get_info_phy phy_sku;
264 	struct iwl_nvm_get_info_regulatory_v2 regulatory;
265 } __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_4 */
266 
267 /**
268  * struct iwl_nvm_get_info_regulatory - regulatory information
269  * @lar_enabled: is LAR enabled
270  * @n_channels: number of valid channels in the array
271  * @channel_profile: regulatory data of this channel
272  */
273 struct iwl_nvm_get_info_regulatory {
274 	__le32 lar_enabled;
275 	__le32 n_channels;
276 	__le32 channel_profile[IWL_NUM_CHANNELS_V3];
277 } __packed; /* REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_3 */
278 
279 /**
280  * struct iwl_nvm_get_info_rsp - response to get NVM data
281  * @general: general NVM data
282  * @mac_sku: data relating to MAC sku
283  * @phy_sku: data relating to PHY sku
284  * @regulatory: regulatory data
285  */
286 struct iwl_nvm_get_info_rsp {
287 	struct iwl_nvm_get_info_general general;
288 	struct iwl_nvm_get_info_sku mac_sku;
289 	struct iwl_nvm_get_info_phy phy_sku;
290 	struct iwl_nvm_get_info_regulatory regulatory;
291 } __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_5 */
292 
293 /**
294  * struct iwl_nvm_access_complete_cmd - NVM_ACCESS commands are completed
295  * @reserved: reserved
296  */
297 struct iwl_nvm_access_complete_cmd {
298 	__le32 reserved;
299 } __packed; /* NVM_ACCESS_COMPLETE_CMD_API_S_VER_1 */
300 
301 #define IWL_MCC_US	0x5553
302 #define IWL_MCC_CANADA	0x4341
303 
304 /**
305  * struct iwl_mcc_update_cmd - Request the device to update geographic
306  * regulatory profile according to the given MCC (Mobile Country Code).
307  * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
308  * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
309  * MCC in the cmd response will be the relevant MCC in the NVM.
310  * @mcc: given mobile country code
311  * @source_id: the source from where we got the MCC, see iwl_mcc_source
312  * @reserved: reserved for alignment
313  * @key: integrity key for MCC API OEM testing
314  * @reserved2: reserved
315  */
316 struct iwl_mcc_update_cmd {
317 	__le16 mcc;
318 	u8 source_id;
319 	u8 reserved;
320 	__le32 key;
321 	u8 reserved2[20];
322 } __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_2 */
323 
324 /**
325  * enum iwl_geo_information - geographic information.
326  * @GEO_NO_INFO: no special info for this geo profile.
327  * @GEO_WMM_ETSI_5GHZ_INFO: this geo profile limits the WMM params
328  *	for the 5 GHz band.
329  */
330 enum iwl_geo_information {
331 	GEO_NO_INFO =			0,
332 	GEO_WMM_ETSI_5GHZ_INFO =	BIT(0),
333 };
334 
335 /**
336  * struct iwl_mcc_update_resp_v3 - response to MCC_UPDATE_CMD.
337  * Contains the new channel control profile map, if changed, and the new MCC
338  * (mobile country code).
339  * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
340  * @status: see &enum iwl_mcc_update_status
341  * @mcc: the new applied MCC
342  * @cap: capabilities for all channels which matches the MCC
343  * @source_id: the MCC source, see iwl_mcc_source
344  * @time: time elapsed from the MCC test start (in units of 30 seconds)
345  * @geo_info: geographic specific profile information
346  *	see &enum iwl_geo_information.
347  * @n_channels: number of channels in @channels_data.
348  * @channels: channel control data map, DWORD for each channel. Only the first
349  *	16bits are used.
350  */
351 struct iwl_mcc_update_resp_v3 {
352 	__le32 status;
353 	__le16 mcc;
354 	u8 cap;
355 	u8 source_id;
356 	__le16 time;
357 	__le16 geo_info;
358 	__le32 n_channels;
359 	__le32 channels[];
360 } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_3 */
361 
362 /**
363  * struct iwl_mcc_update_resp_v4 - response to MCC_UPDATE_CMD.
364  * Contains the new channel control profile map, if changed, and the new MCC
365  * (mobile country code).
366  * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
367  * @status: see &enum iwl_mcc_update_status
368  * @mcc: the new applied MCC
369  * @cap: capabilities for all channels which matches the MCC
370  * @time: time elapsed from the MCC test start (in units of 30 seconds)
371  * @geo_info: geographic specific profile information
372  *	see &enum iwl_geo_information.
373  * @source_id: the MCC source, see iwl_mcc_source
374  * @reserved: for four bytes alignment.
375  * @n_channels: number of channels in @channels_data.
376  * @channels: channel control data map, DWORD for each channel. Only the first
377  *	16bits are used.
378  */
379 struct iwl_mcc_update_resp_v4 {
380 	__le32 status;
381 	__le16 mcc;
382 	__le16 cap;
383 	__le16 time;
384 	__le16 geo_info;
385 	u8 source_id;
386 	u8 reserved[3];
387 	__le32 n_channels;
388 	__le32 channels[];
389 } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_4 */
390 
391 /**
392  * struct iwl_mcc_update_resp_v8 - response to MCC_UPDATE_CMD.
393  * Contains the new channel control profile map, if changed, and the new MCC
394  * (mobile country code).
395  * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
396  * @status: see &enum iwl_mcc_update_status
397  * @mcc: the new applied MCC
398  * @padding: padding for 2 bytes.
399  * @cap: capabilities for all channels which matches the MCC
400  * @time: time elapsed from the MCC test start (in units of 30 seconds)
401  * @geo_info: geographic specific profile information
402  *     see &enum iwl_geo_information.
403  * @source_id: the MCC source, see iwl_mcc_source
404  * @reserved: for four bytes alignment.
405  * @n_channels: number of channels in @channels_data.
406  * @channels: channel control data map, DWORD for each channel. Only the first
407  *     16bits are used.
408  */
409 struct iwl_mcc_update_resp_v8 {
410 	__le32 status;
411 	__le16 mcc;
412 	u8 padding[2];
413 	__le32 cap;
414 	__le16 time;
415 	__le16 geo_info;
416 	u8 source_id;
417 	u8 reserved[3];
418 	__le32 n_channels;
419 	__le32 channels[];
420 } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_8 */
421 
422 /**
423  * struct iwl_mcc_chub_notif - chub notifies of mcc change
424  * (MCC_CHUB_UPDATE_CMD = 0xc9)
425  * The Chub (Communication Hub, CommsHUB) is a HW component that connects to
426  * the cellular and connectivity cores that gets updates of the mcc, and
427  * notifies the ucode directly of any mcc change.
428  * The ucode requests the driver to request the device to update geographic
429  * regulatory  profile according to the given MCC (Mobile Country Code).
430  * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
431  * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
432  * MCC in the cmd response will be the relevant MCC in the NVM.
433  * @mcc: given mobile country code
434  * @source_id: identity of the change originator, see iwl_mcc_source
435  * @reserved1: reserved for alignment
436  */
437 struct iwl_mcc_chub_notif {
438 	__le16 mcc;
439 	u8 source_id;
440 	u8 reserved1;
441 } __packed;
442 /* LAR_MCC_NOTIFY_S_VER_1
443  * LAR_MCC_NOTIFY_S_VER_2
444  */
445 
446 enum iwl_mcc_update_status {
447 	MCC_RESP_NEW_CHAN_PROFILE,
448 	MCC_RESP_SAME_CHAN_PROFILE,
449 	MCC_RESP_INVALID,
450 	MCC_RESP_NVM_DISABLED,
451 	MCC_RESP_ILLEGAL,
452 	MCC_RESP_LOW_PRIORITY,
453 	MCC_RESP_TEST_MODE_ACTIVE,
454 	MCC_RESP_TEST_MODE_NOT_ACTIVE,
455 	MCC_RESP_TEST_MODE_DENIAL_OF_SERVICE,
456 };
457 
458 enum iwl_mcc_source {
459 	MCC_SOURCE_OLD_FW = 0,
460 	MCC_SOURCE_ME = 1,
461 	MCC_SOURCE_BIOS = 2,
462 	MCC_SOURCE_3G_LTE_HOST = 3,
463 	MCC_SOURCE_3G_LTE_DEVICE = 4,
464 	MCC_SOURCE_WIFI = 5,
465 	MCC_SOURCE_RESERVED = 6,
466 	MCC_SOURCE_DEFAULT = 7,
467 	MCC_SOURCE_UNINITIALIZED = 8,
468 	MCC_SOURCE_MCC_API = 9,
469 	MCC_SOURCE_GET_CURRENT = 0x10,
470 	MCC_SOURCE_GETTING_MCC_TEST_MODE = 0x11,
471 };
472 
473 #define IWL_WTAS_BLACK_LIST_MAX		16
474 /**
475  * struct iwl_tas_config_cmd_common - configures the TAS.
476  * This is also the v2 structure.
477  * @block_list_size: size of relevant field in block_list_array
478  * @block_list_array: list of countries where TAS must be disabled
479  */
480 struct iwl_tas_config_cmd_common {
481 	__le32 block_list_size;
482 	__le32 block_list_array[IWL_WTAS_BLACK_LIST_MAX];
483 } __packed; /* TAS_CONFIG_CMD_API_S_VER_2 */
484 
485 /**
486  * struct iwl_tas_config_cmd_v3 - configures the TAS
487  * @override_tas_iec: indicates whether to override default value of IEC regulatory
488  * @enable_tas_iec: in case override_tas_iec is set -
489  *	indicates whether IEC regulatory is enabled or disabled
490  */
491 struct iwl_tas_config_cmd_v3 {
492 	__le16 override_tas_iec;
493 	__le16 enable_tas_iec;
494 } __packed; /* TAS_CONFIG_CMD_API_S_VER_3 */
495 
496 /**
497  * enum iwl_tas_uhb_allowed_flags - per country TAS UHB allowed flags.
498  * @TAS_UHB_ALLOWED_CANADA: TAS UHB is allowed in Canada. This flag is valid
499  *	only when fw has %IWL_UCODE_TLV_CAPA_UHB_CANADA_TAS_SUPPORT capability.
500  */
501 enum iwl_tas_uhb_allowed_flags {
502 	TAS_UHB_ALLOWED_CANADA	= BIT(0),
503 };
504 
505 /**
506  * struct iwl_tas_config_cmd_v4 - configures the TAS
507  * @override_tas_iec: indicates whether to override default value of IEC regulatory
508  * @enable_tas_iec: in case override_tas_iec is set -
509  *	indicates whether IEC regulatory is enabled or disabled
510  * @usa_tas_uhb_allowed: if set, allow TAS UHB in the USA
511  * @uhb_allowed_flags: see &enum iwl_tas_uhb_allowed_flags.
512  */
513 struct iwl_tas_config_cmd_v4 {
514 	u8 override_tas_iec;
515 	u8 enable_tas_iec;
516 	u8 usa_tas_uhb_allowed;
517 	u8 uhb_allowed_flags;
518 } __packed; /* TAS_CONFIG_CMD_API_S_VER_4 */
519 
520 struct iwl_tas_config_cmd_v2_v4 {
521 	struct iwl_tas_config_cmd_common common;
522 	union {
523 		struct iwl_tas_config_cmd_v3 v3;
524 		struct iwl_tas_config_cmd_v4 v4;
525 	};
526 };
527 
528 /**
529  * enum bios_source - source of bios data
530  * @BIOS_SOURCE_NONE: BIOS source is not defined
531  * @BIOS_SOURCE_ACPI: BIOS source is ACPI
532  * @BIOS_SOURCE_UEFI: BIOS source is UEFI
533  */
534 enum bios_source {
535 	BIOS_SOURCE_NONE,
536 	BIOS_SOURCE_ACPI,
537 	BIOS_SOURCE_UEFI,
538 };
539 
540 /**
541  * struct iwl_bios_config_hdr - BIOS configuration header
542  * @table_source: see &enum bios_source
543  * @table_revision: table revision.
544  * @reserved: reserved
545  */
546 struct iwl_bios_config_hdr {
547 	u8 table_source;
548 	u8 table_revision;
549 	u8 reserved[2];
550 } __packed; /* BIOS_CONFIG_HDR_API_S_VER_1 */
551 
552 /**
553  * struct iwl_lari_config_extension_cmd - extend LARI configuration
554  *
555  * LARI_CONFIG_CHANGE's version must remain stable for frozen firmware.
556  * Because the driver might not know this version but still load that
557  * frozen FW and then send some default old version of LARI, causing the FW to
558  * assert about the bad size of it. To handle this, we do the following:
559  * 1. For newer firmware: increase the LARI_CONFIG_CHANGE version to support the
560  *	new firmware API with extra UHB bits.
561  * 2. For frozen firmware: add a special alternative API that doesn't require
562  *	modifying the frozen LARI_CONFIG_CHANGE's version.
563  * @dsm_table_hdr: BIOS DSM table source and revision
564  * @oem_uhb_allow_extension_bitmap: extension bitmap for OEM UHB config
565  * @reserved: reserved
566  */
567 struct iwl_lari_config_extension_cmd {
568 	struct iwl_bios_config_hdr dsm_table_hdr;
569 	__le32 oem_uhb_allow_extension_bitmap;
570 	__le32 reserved[10];
571 } __packed; /* LARI_CONFIG_EXTENSION_CMD_API_S_VER_1 */
572 
573 /**
574  * struct bios_value_u32 - BIOS configuration.
575  * @hdr: bios config header
576  * @value: value in bios.
577  */
578 struct bios_value_u32 {
579 	struct iwl_bios_config_hdr hdr;
580 	__le32 value;
581 } __packed; /* BIOS_CONFIG_DATA_U32_API_S_VER_1 */
582 
583 /**
584  * struct iwl_tas_config_cmd - configures the TAS.
585  * @block_list_size: size of relevant field in block_list_array
586  * @block_list_array: list of countries where TAS must be disabled
587  * @reserved: reserved
588  * @tas_config_info: see @struct bios_value_u32
589  */
590 struct iwl_tas_config_cmd {
591 	__le16 block_list_size;
592 	__le16 block_list_array[IWL_WTAS_BLACK_LIST_MAX];
593 	u8 reserved[2];
594 	struct bios_value_u32 tas_config_info;
595 } __packed; /* TAS_CONFIG_CMD_API_S_VER_5 */
596 
597 /**
598  * enum iwl_lari_config_masks - bit masks for the various LARI config operations
599  * @LARI_CONFIG_DISABLE_11AC_UKRAINE_MSK: disable 11ac in ukraine
600  * @LARI_CONFIG_CHANGE_ETSI_TO_PASSIVE_MSK: ETSI 5.8GHz SRD passive scan
601  * @LARI_CONFIG_CHANGE_ETSI_TO_DISABLED_MSK: ETSI 5.8GHz SRD disabled
602  * @LARI_CONFIG_ENABLE_5G2_IN_INDONESIA_MSK: enable 5.15/5.35GHz bands in
603  * 	Indonesia
604  * @LARI_CONFIG_ENABLE_CHINA_22_REG_SUPPORT_MSK: enable 2022 china regulatory
605  */
606 enum iwl_lari_config_masks {
607 	LARI_CONFIG_DISABLE_11AC_UKRAINE_MSK		= BIT(0),
608 	LARI_CONFIG_CHANGE_ETSI_TO_PASSIVE_MSK		= BIT(1),
609 	LARI_CONFIG_CHANGE_ETSI_TO_DISABLED_MSK		= BIT(2),
610 	LARI_CONFIG_ENABLE_5G2_IN_INDONESIA_MSK		= BIT(3),
611 	LARI_CONFIG_ENABLE_CHINA_22_REG_SUPPORT_MSK	= BIT(7),
612 };
613 
614 #define IWL_11AX_UKRAINE_MASK 3
615 #define IWL_11AX_UKRAINE_SHIFT 8
616 
617 /**
618  * struct iwl_lari_config_change_cmd_v1 - change LARI configuration
619  * @config_bitmap: bit map of the config commands. each bit will trigger a
620  * different predefined FW config operation
621  */
622 struct iwl_lari_config_change_cmd_v1 {
623 	__le32 config_bitmap;
624 } __packed; /* LARI_CHANGE_CONF_CMD_S_VER_1 */
625 
626 /**
627  * struct iwl_lari_config_change_cmd_v6 - change LARI configuration
628  * @config_bitmap: Bitmap of the config commands. Each bit will trigger a
629  *     different predefined FW config operation.
630  * @oem_uhb_allow_bitmap: Bitmap of UHB enabled MCC sets.
631  * @oem_11ax_allow_bitmap: Bitmap of 11ax allowed MCCs. There are two bits
632  *     per country, one to indicate whether to override and the other to
633  *     indicate the value to use.
634  * @oem_unii4_allow_bitmap: Bitmap of unii4 allowed MCCs.There are two bits
635  *     per country, one to indicate whether to override and the other to
636  *     indicate allow/disallow unii4 channels.
637  * @chan_state_active_bitmap: Bitmap for overriding channel state to active.
638  *     Each bit represents a country or region to activate, according to the BIOS
639  *     definitions.
640  * @force_disable_channels_bitmap: Bitmap of disabled bands/channels.
641  *     Each bit represents a set of channels in a specific band that should be disabled
642  */
643 struct iwl_lari_config_change_cmd_v6 {
644 	__le32 config_bitmap;
645 	__le32 oem_uhb_allow_bitmap;
646 	__le32 oem_11ax_allow_bitmap;
647 	__le32 oem_unii4_allow_bitmap;
648 	__le32 chan_state_active_bitmap;
649 	__le32 force_disable_channels_bitmap;
650 } __packed; /* LARI_CHANGE_CONF_CMD_S_VER_6 */
651 
652 /**
653  * struct iwl_lari_config_change_cmd_v8 - change LARI configuration
654  * @config_bitmap: Bitmap of the config commands. Each bit will trigger a
655  *     different predefined FW config operation.
656  * @oem_uhb_allow_bitmap: Bitmap of UHB enabled MCC sets.
657  * @oem_11ax_allow_bitmap: Bitmap of 11ax allowed MCCs. There are two bits
658  *     per country, one to indicate whether to override and the other to
659  *     indicate the value to use.
660  * @oem_unii4_allow_bitmap: Bitmap of unii4 allowed MCCs.There are two bits
661  *     per country, one to indicate whether to override and the other to
662  *     indicate allow/disallow unii4 channels.
663  *     bit 0 - 3: supported.
664  * @chan_state_active_bitmap: Bitmap to enable different bands per country
665  *     or region.
666  *     Each bit represents a country or region, and a band to activate
667  *     according to the BIOS definitions.
668  *     bit 0 - 4: supported.
669  * @force_disable_channels_bitmap: Bitmap of disabled bands/channels.
670  *     Each bit represents a set of channels in a specific band that should be
671  *     disabled
672  * @edt_bitmap: Bitmap of energy detection threshold table.
673  *	Disable/enable the EDT optimization method for different band.
674  */
675 struct iwl_lari_config_change_cmd_v8 {
676 	__le32 config_bitmap;
677 	__le32 oem_uhb_allow_bitmap;
678 	__le32 oem_11ax_allow_bitmap;
679 	__le32 oem_unii4_allow_bitmap;
680 	__le32 chan_state_active_bitmap;
681 	__le32 force_disable_channels_bitmap;
682 	__le32 edt_bitmap;
683 } __packed;
684 /* LARI_CHANGE_CONF_CMD_S_VER_8 */
685 
686 
687 /**
688  * struct iwl_lari_config_change_cmd - change LARI configuration
689  * @config_bitmap: Bitmap of the config commands. Each bit will trigger a
690  *	different predefined FW config operation.
691  * @oem_uhb_allow_bitmap: Bitmap of UHB enabled MCC sets.
692  * @oem_11ax_allow_bitmap: Bitmap of 11ax allowed MCCs. There are two bits
693  *	per country, one to indicate whether to override and the other to
694  *	indicate the value to use.
695  * @oem_unii4_allow_bitmap: Bitmap of unii4 allowed MCCs.There are two bits
696  *	per country, one to indicate whether to override and the other to
697  *	indicate allow/disallow unii4 channels.
698  * @chan_state_active_bitmap: Bitmap to enable different bands per country
699  *	or region.
700  *	Each bit represents a country or region, and a band to activate
701  *	according to the BIOS definitions.
702  *	bit 0 - 6: supported.
703  * @force_disable_channels_bitmap: Bitmap of disabled bands/channels.
704  *	Each bit represents a set of channels in a specific band that should be
705  *	disabled
706  * @edt_bitmap: Bitmap of energy detection threshold table.
707  *	Disable/enable the EDT optimization method for different band.
708  * @oem_320mhz_allow_bitmap: 320Mhz bandwidth enablement bitmap per MCC.
709  *	bit0: enable 320Mhz in Japan.
710  *	bit1: enable 320Mhz in South Korea.
711  *	bit 2 - 31: reserved.
712  * @oem_11be_allow_bitmap: Bitmap of 11be allowed MCCs. No need to mask out the
713  *	unsupported bits
714  *	bit0: enable 11be in China(CB/CN).
715  *	bit1: enable 11be in South Korea.
716  *	bit 2 - 31: reserved.
717  * @oem_11bn_allow_bitmap: Bitmap of 11bn allowed MCCs. The firmware expects to
718  *	get the data from the BIOS.
719  * @oem_unii9_enable: UNII-9 enablement as read from the BIOS
720  * @bios_hdr: bios config header
721  * @oem_uhb_allow_extension_bitmap: DSM Function 4 data as an extension of UHB
722  *	enabled MCC sets
723  * @bios_wcpe_hdr: puncturing config header
724  * @wcpe_bitmap: bitmap of puncturing enablement per MCC
725  * @bios_wbem_hdr: 320 MHz per-MCC WBEM config header
726  * @reserved: reserved
727  * @oem_supported_dsm_bitmap: DSM function 0 bitmap describing supported
728  *	DSM function indices
729  */
730 struct iwl_lari_config_change_cmd {
731 	__le32 config_bitmap;
732 	__le32 oem_uhb_allow_bitmap;
733 	__le32 oem_11ax_allow_bitmap;
734 	__le32 oem_unii4_allow_bitmap;
735 	__le32 chan_state_active_bitmap;
736 	__le32 force_disable_channels_bitmap;
737 	__le32 edt_bitmap;
738 	__le32 oem_320mhz_allow_bitmap;
739 	__le32 oem_11be_allow_bitmap;
740 	/* since version 13 */
741 	__le32 oem_11bn_allow_bitmap;
742 	/* since version 13 */
743 	__le32 oem_unii9_enable;
744 	/* since version 13 */
745 	struct iwl_bios_config_hdr bios_hdr;
746 	/* All the below are since version 14 */
747 	__le32 oem_uhb_allow_extension_bitmap;
748 	struct iwl_bios_config_hdr bios_wcpe_hdr;
749 	__le32 wcpe_bitmap;
750 	struct iwl_bios_config_hdr bios_wbem_hdr;
751 	__le32 reserved[10];
752 	/* since version 15 */
753 	__le32 oem_supported_dsm_bitmap;
754 } __packed;
755 /* LARI_CHANGE_CONF_CMD_S_VER_12
756  * LARI_CHANGE_CONF_CMD_S_VER_13
757  * LARI_CHANGE_CONF_CMD_S_VER_14
758  * LARI_CHANGE_CONF_CMD_S_VER_15
759  */
760 
761 /* Activate UNII-1 (5.2GHz) for World Wide */
762 #define ACTIVATE_5G2_IN_WW_MASK			BIT(4)
763 #define CHAN_STATE_ACTIVE_BITMAP_CMD_V8		0x1F
764 #define CHAN_STATE_ACTIVE_BITMAP_CMD_V12	0x7F
765 
766 /**
767  * struct iwl_pnvm_init_complete_ntfy - PNVM initialization complete
768  * @status: PNVM image loading status
769  */
770 struct iwl_pnvm_init_complete_ntfy {
771 	__le32 status;
772 } __packed; /* PNVM_INIT_COMPLETE_NTFY_S_VER_1 */
773 
774 #define UATS_TABLE_ROW_SIZE	26
775 #define UATS_TABLE_COL_SIZE	13
776 
777 /**
778  * struct iwl_mcc_allowed_ap_type_cmd_v1 - struct for MCC_ALLOWED_AP_TYPE_CMD
779  * @mcc_to_ap_type_map: mapping an MCC to 6 GHz AP type support (UATS)
780  * @reserved: reserved
781  */
782 struct iwl_mcc_allowed_ap_type_cmd_v1 {
783 	u8 mcc_to_ap_type_map[UATS_TABLE_ROW_SIZE][UATS_TABLE_COL_SIZE];
784 	__le16 reserved;
785 } __packed; /* MCC_ALLOWED_AP_TYPE_CMD_API_S_VER_1 */
786 
787 /**
788  * struct iwl_mcc_allowed_ap_type_cmd - struct for MCC_ALLOWED_AP_TYPE_CMD
789  * @mcc_to_ap_type_map: mapping an MCC to 6 GHz AP type support (UATS)
790  * @mcc_to_ap_type_unii9_map: mapping an MCC to UNII-9 AP type support allowed
791  */
792 struct iwl_mcc_allowed_ap_type_cmd {
793 	u8 mcc_to_ap_type_map[UATS_TABLE_ROW_SIZE][UATS_TABLE_COL_SIZE];
794 	u8 mcc_to_ap_type_unii9_map[UATS_TABLE_ROW_SIZE][UATS_TABLE_COL_SIZE];
795 } __packed; /* MCC_ALLOWED_AP_TYPE_CMD_API_S_VER_2 */
796 
797 #endif /* __iwl_fw_api_nvm_reg_h__ */
798