1 /******************************************************************************
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright(C) 2018 - 2020 Intel Corporation
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as
15 * published by the Free Software Foundation.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
22 * The full GNU General Public License is included in this distribution
23 * in the file called COPYING.
25 * Contact Information:
26 * Intel Linux Wireless <linuxwifi@intel.com>
27 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright(C) 2018 - 2020 Intel Corporation
35 * All rights reserved.
37 * Redistribution and use in source and binary forms, with or without
38 * modification, are permitted provided that the following conditions
41 * * Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * * Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in
45 * the documentation and/or other materials provided with the
47 * * Neither the name Intel Corporation nor the names of its
48 * contributors may be used to endorse or promote products derived
49 * from this software without specific prior written permission.
51 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
52 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
53 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
54 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
55 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
56 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
57 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
58 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
59 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
61 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 *****************************************************************************/
65 #ifndef __iwl_fw_api_nvm_reg_h__
66 #define __iwl_fw_api_nvm_reg_h__
69 * enum iwl_regulatory_and_nvm_subcmd_ids - regulatory/NVM commands
71 enum iwl_regulatory_and_nvm_subcmd_ids {
73 * @NVM_ACCESS_COMPLETE: &struct iwl_nvm_access_complete_cmd
75 NVM_ACCESS_COMPLETE = 0x0,
78 * @LARI_CONFIG_CHANGE: &struct iwl_lari_config_change_cmd
80 LARI_CONFIG_CHANGE = 0x1,
84 * Command is &struct iwl_nvm_get_info,
85 * response is &struct iwl_nvm_get_info_rsp
90 * @TAS_CONFIG: &struct iwl_tas_config_cmd
96 * enum iwl_nvm_access_op - NVM access opcode
97 * @IWL_NVM_READ: read NVM
98 * @IWL_NVM_WRITE: write NVM
100 enum iwl_nvm_access_op {
106 * enum iwl_nvm_access_target - target of the NVM_ACCESS_CMD
107 * @NVM_ACCESS_TARGET_CACHE: access the cache
108 * @NVM_ACCESS_TARGET_OTP: access the OTP
109 * @NVM_ACCESS_TARGET_EEPROM: access the EEPROM
111 enum iwl_nvm_access_target {
112 NVM_ACCESS_TARGET_CACHE = 0,
113 NVM_ACCESS_TARGET_OTP = 1,
114 NVM_ACCESS_TARGET_EEPROM = 2,
118 * enum iwl_nvm_section_type - section types for NVM_ACCESS_CMD
119 * @NVM_SECTION_TYPE_SW: software section
120 * @NVM_SECTION_TYPE_REGULATORY: regulatory section
121 * @NVM_SECTION_TYPE_CALIBRATION: calibration section
122 * @NVM_SECTION_TYPE_PRODUCTION: production section
123 * @NVM_SECTION_TYPE_REGULATORY_SDP: regulatory section used by 3168 series
124 * @NVM_SECTION_TYPE_MAC_OVERRIDE: MAC override section
125 * @NVM_SECTION_TYPE_PHY_SKU: PHY SKU section
126 * @NVM_MAX_NUM_SECTIONS: number of sections
128 enum iwl_nvm_section_type {
129 NVM_SECTION_TYPE_SW = 1,
130 NVM_SECTION_TYPE_REGULATORY = 3,
131 NVM_SECTION_TYPE_CALIBRATION = 4,
132 NVM_SECTION_TYPE_PRODUCTION = 5,
133 NVM_SECTION_TYPE_REGULATORY_SDP = 8,
134 NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
135 NVM_SECTION_TYPE_PHY_SKU = 12,
136 NVM_MAX_NUM_SECTIONS = 13,
140 * struct iwl_nvm_access_cmd - Request the device to send an NVM section
141 * @op_code: &enum iwl_nvm_access_op
142 * @target: &enum iwl_nvm_access_target
143 * @type: &enum iwl_nvm_section_type
144 * @offset: offset in bytes into the section
145 * @length: in bytes, to read/write
146 * @data: if write operation, the data to write. On read its empty
148 struct iwl_nvm_access_cmd {
155 } __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */
158 * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD
159 * @offset: offset in bytes into the section
160 * @length: in bytes, either how much was written or read
161 * @type: NVM_SECTION_TYPE_*
162 * @status: 0 for success, fail otherwise
163 * @data: if read operation, the data returned. Empty on write.
165 struct iwl_nvm_access_resp {
171 } __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */
174 * struct iwl_nvm_get_info - request to get NVM data
176 struct iwl_nvm_get_info {
178 } __packed; /* REGULATORY_NVM_GET_INFO_CMD_API_S_VER_1 */
181 * enum iwl_nvm_info_general_flags - flags in NVM_GET_INFO resp
182 * @NVM_GENERAL_FLAGS_EMPTY_OTP: 1 if OTP is empty
184 enum iwl_nvm_info_general_flags {
185 NVM_GENERAL_FLAGS_EMPTY_OTP = BIT(0),
189 * struct iwl_nvm_get_info_general - general NVM data
190 * @flags: bit 0: 1 - empty, 0 - non-empty
191 * @nvm_version: nvm version
192 * @board_type: board type
193 * @n_hw_addrs: number of reserved MAC addresses
195 struct iwl_nvm_get_info_general {
200 } __packed; /* REGULATORY_NVM_GET_INFO_GENERAL_S_VER_2 */
203 * enum iwl_nvm_mac_sku_flags - flags in &iwl_nvm_get_info_sku
204 * @NVM_MAC_SKU_FLAGS_BAND_2_4_ENABLED: true if 2.4 band enabled
205 * @NVM_MAC_SKU_FLAGS_BAND_5_2_ENABLED: true if 5.2 band enabled
206 * @NVM_MAC_SKU_FLAGS_802_11N_ENABLED: true if 11n enabled
207 * @NVM_MAC_SKU_FLAGS_802_11AC_ENABLED: true if 11ac enabled
208 * @NVM_MAC_SKU_FLAGS_MIMO_DISABLED: true if MIMO disabled
209 * @NVM_MAC_SKU_FLAGS_WAPI_ENABLED: true if WAPI enabled
210 * @NVM_MAC_SKU_FLAGS_REG_CHECK_ENABLED: true if regulatory checker enabled
211 * @NVM_MAC_SKU_FLAGS_API_LOCK_ENABLED: true if API lock enabled
213 enum iwl_nvm_mac_sku_flags {
214 NVM_MAC_SKU_FLAGS_BAND_2_4_ENABLED = BIT(0),
215 NVM_MAC_SKU_FLAGS_BAND_5_2_ENABLED = BIT(1),
216 NVM_MAC_SKU_FLAGS_802_11N_ENABLED = BIT(2),
217 NVM_MAC_SKU_FLAGS_802_11AC_ENABLED = BIT(3),
219 * @NVM_MAC_SKU_FLAGS_802_11AX_ENABLED: true if 11ax enabled
221 NVM_MAC_SKU_FLAGS_802_11AX_ENABLED = BIT(4),
222 NVM_MAC_SKU_FLAGS_MIMO_DISABLED = BIT(5),
223 NVM_MAC_SKU_FLAGS_WAPI_ENABLED = BIT(8),
224 NVM_MAC_SKU_FLAGS_REG_CHECK_ENABLED = BIT(14),
225 NVM_MAC_SKU_FLAGS_API_LOCK_ENABLED = BIT(15),
229 * struct iwl_nvm_get_info_sku - mac information
230 * @mac_sku_flags: flags for SKU, see &enum iwl_nvm_mac_sku_flags
232 struct iwl_nvm_get_info_sku {
233 __le32 mac_sku_flags;
234 } __packed; /* REGULATORY_NVM_GET_INFO_MAC_SKU_SECTION_S_VER_2 */
237 * struct iwl_nvm_get_info_phy - phy information
238 * @tx_chains: BIT 0 chain A, BIT 1 chain B
239 * @rx_chains: BIT 0 chain A, BIT 1 chain B
241 struct iwl_nvm_get_info_phy {
244 } __packed; /* REGULATORY_NVM_GET_INFO_PHY_SKU_SECTION_S_VER_1 */
246 #define IWL_NUM_CHANNELS_V1 51
247 #define IWL_NUM_CHANNELS 110
250 * struct iwl_nvm_get_info_regulatory - regulatory information
251 * @lar_enabled: is LAR enabled
252 * @channel_profile: regulatory data of this channel
253 * @reserved: reserved
255 struct iwl_nvm_get_info_regulatory_v1 {
257 __le16 channel_profile[IWL_NUM_CHANNELS_V1];
259 } __packed; /* REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */
262 * struct iwl_nvm_get_info_regulatory - regulatory information
263 * @lar_enabled: is LAR enabled
264 * @n_channels: number of valid channels in the array
265 * @channel_profile: regulatory data of this channel
267 struct iwl_nvm_get_info_regulatory {
270 __le32 channel_profile[IWL_NUM_CHANNELS];
271 } __packed; /* REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_2 */
274 * struct iwl_nvm_get_info_rsp_v3 - response to get NVM data
275 * @general: general NVM data
276 * @mac_sku: data relating to MAC sku
277 * @phy_sku: data relating to PHY sku
278 * @regulatory: regulatory data
280 struct iwl_nvm_get_info_rsp_v3 {
281 struct iwl_nvm_get_info_general general;
282 struct iwl_nvm_get_info_sku mac_sku;
283 struct iwl_nvm_get_info_phy phy_sku;
284 struct iwl_nvm_get_info_regulatory_v1 regulatory;
285 } __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_3 */
288 * struct iwl_nvm_get_info_rsp - response to get NVM data
289 * @general: general NVM data
290 * @mac_sku: data relating to MAC sku
291 * @phy_sku: data relating to PHY sku
292 * @regulatory: regulatory data
294 struct iwl_nvm_get_info_rsp {
295 struct iwl_nvm_get_info_general general;
296 struct iwl_nvm_get_info_sku mac_sku;
297 struct iwl_nvm_get_info_phy phy_sku;
298 struct iwl_nvm_get_info_regulatory regulatory;
299 } __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_4 */
302 * struct iwl_nvm_access_complete_cmd - NVM_ACCESS commands are completed
303 * @reserved: reserved
305 struct iwl_nvm_access_complete_cmd {
307 } __packed; /* NVM_ACCESS_COMPLETE_CMD_API_S_VER_1 */
310 * struct iwl_mcc_update_cmd - Request the device to update geographic
311 * regulatory profile according to the given MCC (Mobile Country Code).
312 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
313 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
314 * MCC in the cmd response will be the relevant MCC in the NVM.
315 * @mcc: given mobile country code
316 * @source_id: the source from where we got the MCC, see iwl_mcc_source
317 * @reserved: reserved for alignment
318 * @key: integrity key for MCC API OEM testing
319 * @reserved2: reserved
321 struct iwl_mcc_update_cmd {
327 } __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_2 */
330 * enum iwl_geo_information - geographic information.
331 * @GEO_NO_INFO: no special info for this geo profile.
332 * @GEO_WMM_ETSI_5GHZ_INFO: this geo profile limits the WMM params
333 * for the 5 GHz band.
335 enum iwl_geo_information {
337 GEO_WMM_ETSI_5GHZ_INFO = BIT(0),
341 * struct iwl_mcc_update_resp_v3 - response to MCC_UPDATE_CMD.
342 * Contains the new channel control profile map, if changed, and the new MCC
343 * (mobile country code).
344 * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
345 * @status: see &enum iwl_mcc_update_status
346 * @mcc: the new applied MCC
347 * @cap: capabilities for all channels which matches the MCC
348 * @source_id: the MCC source, see iwl_mcc_source
349 * @time: time elapsed from the MCC test start (in units of 30 seconds)
350 * @geo_info: geographic specific profile information
351 * see &enum iwl_geo_information.
352 * @n_channels: number of channels in @channels_data.
353 * @channels: channel control data map, DWORD for each channel. Only the first
356 struct iwl_mcc_update_resp_v3 {
365 } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_3 */
368 * struct iwl_mcc_update_resp - response to MCC_UPDATE_CMD.
369 * Contains the new channel control profile map, if changed, and the new MCC
370 * (mobile country code).
371 * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
372 * @status: see &enum iwl_mcc_update_status
373 * @mcc: the new applied MCC
374 * @cap: capabilities for all channels which matches the MCC
375 * @time: time elapsed from the MCC test start (in units of 30 seconds)
376 * @geo_info: geographic specific profile information
377 * see &enum iwl_geo_information.
378 * @source_id: the MCC source, see iwl_mcc_source
379 * @reserved: for four bytes alignment.
380 * @n_channels: number of channels in @channels_data.
381 * @channels: channel control data map, DWORD for each channel. Only the first
384 struct iwl_mcc_update_resp {
394 } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_4 */
397 * struct iwl_mcc_chub_notif - chub notifies of mcc change
398 * (MCC_CHUB_UPDATE_CMD = 0xc9)
399 * The Chub (Communication Hub, CommsHUB) is a HW component that connects to
400 * the cellular and connectivity cores that gets updates of the mcc, and
401 * notifies the ucode directly of any mcc change.
402 * The ucode requests the driver to request the device to update geographic
403 * regulatory profile according to the given MCC (Mobile Country Code).
404 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
405 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
406 * MCC in the cmd response will be the relevant MCC in the NVM.
407 * @mcc: given mobile country code
408 * @source_id: identity of the change originator, see iwl_mcc_source
409 * @reserved1: reserved for alignment
411 struct iwl_mcc_chub_notif {
415 } __packed; /* LAR_MCC_NOTIFY_S */
417 enum iwl_mcc_update_status {
418 MCC_RESP_NEW_CHAN_PROFILE,
419 MCC_RESP_SAME_CHAN_PROFILE,
421 MCC_RESP_NVM_DISABLED,
423 MCC_RESP_LOW_PRIORITY,
424 MCC_RESP_TEST_MODE_ACTIVE,
425 MCC_RESP_TEST_MODE_NOT_ACTIVE,
426 MCC_RESP_TEST_MODE_DENIAL_OF_SERVICE,
429 enum iwl_mcc_source {
430 MCC_SOURCE_OLD_FW = 0,
433 MCC_SOURCE_3G_LTE_HOST = 3,
434 MCC_SOURCE_3G_LTE_DEVICE = 4,
436 MCC_SOURCE_RESERVED = 6,
437 MCC_SOURCE_DEFAULT = 7,
438 MCC_SOURCE_UNINITIALIZED = 8,
439 MCC_SOURCE_MCC_API = 9,
440 MCC_SOURCE_GET_CURRENT = 0x10,
441 MCC_SOURCE_GETTING_MCC_TEST_MODE = 0x11,
444 #define IWL_TAS_BLACK_LIST_MAX 16
446 * struct iwl_tas_config_cmd - configures the TAS
447 * @black_list_size: size of relevant field in black_list_array
448 * @black_list_array: black list countries (without TAS)
450 struct iwl_tas_config_cmd {
451 __le32 black_list_size;
452 __le32 black_list_array[IWL_TAS_BLACK_LIST_MAX];
453 } __packed; /* TAS_CONFIG_CMD_API_S_VER_2 */
456 * enum iwl_lari_configs - bit masks for the various LARI config operations
457 * @LARI_CONFIG_DISABLE_11AC_UKRAINE_MSK: disable 11ac in ukraine
458 * @LARI_CONFIG_CHANGE_ETSI_TO_PASSIVE_MSK: ETSI 5.8GHz SRD passive scan
459 * @LARI_CONFIG_CHANGE_ETSI_TO_DISABLED_MSK: ETSI 5.8GHz SRD disabled
460 * @LARI_CONFIG_ENABLE_5G2_IN_INDONESIA_MSK: enable 5.15/5.35GHz bands in
463 enum iwl_lari_config_masks {
464 LARI_CONFIG_DISABLE_11AC_UKRAINE_MSK = BIT(0),
465 LARI_CONFIG_CHANGE_ETSI_TO_PASSIVE_MSK = BIT(1),
466 LARI_CONFIG_CHANGE_ETSI_TO_DISABLED_MSK = BIT(2),
467 LARI_CONFIG_ENABLE_5G2_IN_INDONESIA_MSK = BIT(3),
471 * struct iwl_lari_config_change_cmd - change LARI configuration
472 * @config_bitmap: bit map of the config commands. each bit will trigger a
473 * different predefined FW config operation
475 struct iwl_lari_config_change_cmd {
476 __le32 config_bitmap;
477 } __packed; /* LARI_CHANGE_CONF_CMD_S_VER_1 */
479 #endif /* __iwl_fw_api_nvm_reg_h__ */