1 /****************************************************************************** 2 * 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. 5 * 6 * GPL LICENSE SUMMARY 7 * 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 12 * 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. 16 * 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. 21 * 22 * The full GNU General Public License is included in this distribution 23 * in the file called COPYING. 24 * 25 * Contact Information: 26 * Intel Linux Wireless <linuxwifi@intel.com> 27 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 28 * 29 * BSD LICENSE 30 * 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. 36 * 37 * Redistribution and use in source and binary forms, with or without 38 * modification, are permitted provided that the following conditions 39 * are met: 40 * 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 46 * distribution. 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. 50 * 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. 62 * 63 *****************************************************************************/ 64 65 #ifndef __iwl_fw_api_nvm_reg_h__ 66 #define __iwl_fw_api_nvm_reg_h__ 67 68 /** 69 * enum iwl_regulatory_and_nvm_subcmd_ids - regulatory/NVM commands 70 */ 71 enum iwl_regulatory_and_nvm_subcmd_ids { 72 /** 73 * @NVM_ACCESS_COMPLETE: &struct iwl_nvm_access_complete_cmd 74 */ 75 NVM_ACCESS_COMPLETE = 0x0, 76 77 /** 78 * @LARI_CONFIG_CHANGE: &struct iwl_lari_config_change_cmd 79 */ 80 LARI_CONFIG_CHANGE = 0x1, 81 82 /** 83 * @NVM_GET_INFO: 84 * Command is &struct iwl_nvm_get_info, 85 * response is &struct iwl_nvm_get_info_rsp 86 */ 87 NVM_GET_INFO = 0x2, 88 89 /** 90 * @TAS_CONFIG: &struct iwl_tas_config_cmd 91 */ 92 TAS_CONFIG = 0x3, 93 94 /** 95 * @PNVM_INIT_COMPLETE_NTFY: &struct iwl_pnvm_init_complete_ntfy 96 */ 97 PNVM_INIT_COMPLETE_NTFY = 0xFE, 98 }; 99 100 /** 101 * enum iwl_nvm_access_op - NVM access opcode 102 * @IWL_NVM_READ: read NVM 103 * @IWL_NVM_WRITE: write NVM 104 */ 105 enum iwl_nvm_access_op { 106 IWL_NVM_READ = 0, 107 IWL_NVM_WRITE = 1, 108 }; 109 110 /** 111 * enum iwl_nvm_access_target - target of the NVM_ACCESS_CMD 112 * @NVM_ACCESS_TARGET_CACHE: access the cache 113 * @NVM_ACCESS_TARGET_OTP: access the OTP 114 * @NVM_ACCESS_TARGET_EEPROM: access the EEPROM 115 */ 116 enum iwl_nvm_access_target { 117 NVM_ACCESS_TARGET_CACHE = 0, 118 NVM_ACCESS_TARGET_OTP = 1, 119 NVM_ACCESS_TARGET_EEPROM = 2, 120 }; 121 122 /** 123 * enum iwl_nvm_section_type - section types for NVM_ACCESS_CMD 124 * @NVM_SECTION_TYPE_SW: software section 125 * @NVM_SECTION_TYPE_REGULATORY: regulatory section 126 * @NVM_SECTION_TYPE_CALIBRATION: calibration section 127 * @NVM_SECTION_TYPE_PRODUCTION: production section 128 * @NVM_SECTION_TYPE_REGULATORY_SDP: regulatory section used by 3168 series 129 * @NVM_SECTION_TYPE_MAC_OVERRIDE: MAC override section 130 * @NVM_SECTION_TYPE_PHY_SKU: PHY SKU section 131 * @NVM_MAX_NUM_SECTIONS: number of sections 132 */ 133 enum iwl_nvm_section_type { 134 NVM_SECTION_TYPE_SW = 1, 135 NVM_SECTION_TYPE_REGULATORY = 3, 136 NVM_SECTION_TYPE_CALIBRATION = 4, 137 NVM_SECTION_TYPE_PRODUCTION = 5, 138 NVM_SECTION_TYPE_REGULATORY_SDP = 8, 139 NVM_SECTION_TYPE_MAC_OVERRIDE = 11, 140 NVM_SECTION_TYPE_PHY_SKU = 12, 141 NVM_MAX_NUM_SECTIONS = 13, 142 }; 143 144 /** 145 * struct iwl_nvm_access_cmd - Request the device to send an NVM section 146 * @op_code: &enum iwl_nvm_access_op 147 * @target: &enum iwl_nvm_access_target 148 * @type: &enum iwl_nvm_section_type 149 * @offset: offset in bytes into the section 150 * @length: in bytes, to read/write 151 * @data: if write operation, the data to write. On read its empty 152 */ 153 struct iwl_nvm_access_cmd { 154 u8 op_code; 155 u8 target; 156 __le16 type; 157 __le16 offset; 158 __le16 length; 159 u8 data[]; 160 } __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */ 161 162 /** 163 * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD 164 * @offset: offset in bytes into the section 165 * @length: in bytes, either how much was written or read 166 * @type: NVM_SECTION_TYPE_* 167 * @status: 0 for success, fail otherwise 168 * @data: if read operation, the data returned. Empty on write. 169 */ 170 struct iwl_nvm_access_resp { 171 __le16 offset; 172 __le16 length; 173 __le16 type; 174 __le16 status; 175 u8 data[]; 176 } __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */ 177 178 /* 179 * struct iwl_nvm_get_info - request to get NVM data 180 */ 181 struct iwl_nvm_get_info { 182 __le32 reserved; 183 } __packed; /* REGULATORY_NVM_GET_INFO_CMD_API_S_VER_1 */ 184 185 /** 186 * enum iwl_nvm_info_general_flags - flags in NVM_GET_INFO resp 187 * @NVM_GENERAL_FLAGS_EMPTY_OTP: 1 if OTP is empty 188 */ 189 enum iwl_nvm_info_general_flags { 190 NVM_GENERAL_FLAGS_EMPTY_OTP = BIT(0), 191 }; 192 193 /** 194 * struct iwl_nvm_get_info_general - general NVM data 195 * @flags: bit 0: 1 - empty, 0 - non-empty 196 * @nvm_version: nvm version 197 * @board_type: board type 198 * @n_hw_addrs: number of reserved MAC addresses 199 */ 200 struct iwl_nvm_get_info_general { 201 __le32 flags; 202 __le16 nvm_version; 203 u8 board_type; 204 u8 n_hw_addrs; 205 } __packed; /* REGULATORY_NVM_GET_INFO_GENERAL_S_VER_2 */ 206 207 /** 208 * enum iwl_nvm_mac_sku_flags - flags in &iwl_nvm_get_info_sku 209 * @NVM_MAC_SKU_FLAGS_BAND_2_4_ENABLED: true if 2.4 band enabled 210 * @NVM_MAC_SKU_FLAGS_BAND_5_2_ENABLED: true if 5.2 band enabled 211 * @NVM_MAC_SKU_FLAGS_802_11N_ENABLED: true if 11n enabled 212 * @NVM_MAC_SKU_FLAGS_802_11AC_ENABLED: true if 11ac enabled 213 * @NVM_MAC_SKU_FLAGS_MIMO_DISABLED: true if MIMO disabled 214 * @NVM_MAC_SKU_FLAGS_WAPI_ENABLED: true if WAPI enabled 215 * @NVM_MAC_SKU_FLAGS_REG_CHECK_ENABLED: true if regulatory checker enabled 216 * @NVM_MAC_SKU_FLAGS_API_LOCK_ENABLED: true if API lock enabled 217 */ 218 enum iwl_nvm_mac_sku_flags { 219 NVM_MAC_SKU_FLAGS_BAND_2_4_ENABLED = BIT(0), 220 NVM_MAC_SKU_FLAGS_BAND_5_2_ENABLED = BIT(1), 221 NVM_MAC_SKU_FLAGS_802_11N_ENABLED = BIT(2), 222 NVM_MAC_SKU_FLAGS_802_11AC_ENABLED = BIT(3), 223 /** 224 * @NVM_MAC_SKU_FLAGS_802_11AX_ENABLED: true if 11ax enabled 225 */ 226 NVM_MAC_SKU_FLAGS_802_11AX_ENABLED = BIT(4), 227 NVM_MAC_SKU_FLAGS_MIMO_DISABLED = BIT(5), 228 NVM_MAC_SKU_FLAGS_WAPI_ENABLED = BIT(8), 229 NVM_MAC_SKU_FLAGS_REG_CHECK_ENABLED = BIT(14), 230 NVM_MAC_SKU_FLAGS_API_LOCK_ENABLED = BIT(15), 231 }; 232 233 /** 234 * struct iwl_nvm_get_info_sku - mac information 235 * @mac_sku_flags: flags for SKU, see &enum iwl_nvm_mac_sku_flags 236 */ 237 struct iwl_nvm_get_info_sku { 238 __le32 mac_sku_flags; 239 } __packed; /* REGULATORY_NVM_GET_INFO_MAC_SKU_SECTION_S_VER_2 */ 240 241 /** 242 * struct iwl_nvm_get_info_phy - phy information 243 * @tx_chains: BIT 0 chain A, BIT 1 chain B 244 * @rx_chains: BIT 0 chain A, BIT 1 chain B 245 */ 246 struct iwl_nvm_get_info_phy { 247 __le32 tx_chains; 248 __le32 rx_chains; 249 } __packed; /* REGULATORY_NVM_GET_INFO_PHY_SKU_SECTION_S_VER_1 */ 250 251 #define IWL_NUM_CHANNELS_V1 51 252 #define IWL_NUM_CHANNELS 110 253 254 /** 255 * struct iwl_nvm_get_info_regulatory - regulatory information 256 * @lar_enabled: is LAR enabled 257 * @channel_profile: regulatory data of this channel 258 * @reserved: reserved 259 */ 260 struct iwl_nvm_get_info_regulatory_v1 { 261 __le32 lar_enabled; 262 __le16 channel_profile[IWL_NUM_CHANNELS_V1]; 263 __le16 reserved; 264 } __packed; /* REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */ 265 266 /** 267 * struct iwl_nvm_get_info_regulatory - regulatory information 268 * @lar_enabled: is LAR enabled 269 * @n_channels: number of valid channels in the array 270 * @channel_profile: regulatory data of this channel 271 */ 272 struct iwl_nvm_get_info_regulatory { 273 __le32 lar_enabled; 274 __le32 n_channels; 275 __le32 channel_profile[IWL_NUM_CHANNELS]; 276 } __packed; /* REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_2 */ 277 278 /** 279 * struct iwl_nvm_get_info_rsp_v3 - response to get NVM data 280 * @general: general NVM data 281 * @mac_sku: data relating to MAC sku 282 * @phy_sku: data relating to PHY sku 283 * @regulatory: regulatory data 284 */ 285 struct iwl_nvm_get_info_rsp_v3 { 286 struct iwl_nvm_get_info_general general; 287 struct iwl_nvm_get_info_sku mac_sku; 288 struct iwl_nvm_get_info_phy phy_sku; 289 struct iwl_nvm_get_info_regulatory_v1 regulatory; 290 } __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_3 */ 291 292 /** 293 * struct iwl_nvm_get_info_rsp - response to get NVM data 294 * @general: general NVM data 295 * @mac_sku: data relating to MAC sku 296 * @phy_sku: data relating to PHY sku 297 * @regulatory: regulatory data 298 */ 299 struct iwl_nvm_get_info_rsp { 300 struct iwl_nvm_get_info_general general; 301 struct iwl_nvm_get_info_sku mac_sku; 302 struct iwl_nvm_get_info_phy phy_sku; 303 struct iwl_nvm_get_info_regulatory regulatory; 304 } __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_4 */ 305 306 /** 307 * struct iwl_nvm_access_complete_cmd - NVM_ACCESS commands are completed 308 * @reserved: reserved 309 */ 310 struct iwl_nvm_access_complete_cmd { 311 __le32 reserved; 312 } __packed; /* NVM_ACCESS_COMPLETE_CMD_API_S_VER_1 */ 313 314 /** 315 * struct iwl_mcc_update_cmd - Request the device to update geographic 316 * regulatory profile according to the given MCC (Mobile Country Code). 317 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain. 318 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the 319 * MCC in the cmd response will be the relevant MCC in the NVM. 320 * @mcc: given mobile country code 321 * @source_id: the source from where we got the MCC, see iwl_mcc_source 322 * @reserved: reserved for alignment 323 * @key: integrity key for MCC API OEM testing 324 * @reserved2: reserved 325 */ 326 struct iwl_mcc_update_cmd { 327 __le16 mcc; 328 u8 source_id; 329 u8 reserved; 330 __le32 key; 331 u8 reserved2[20]; 332 } __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_2 */ 333 334 /** 335 * enum iwl_geo_information - geographic information. 336 * @GEO_NO_INFO: no special info for this geo profile. 337 * @GEO_WMM_ETSI_5GHZ_INFO: this geo profile limits the WMM params 338 * for the 5 GHz band. 339 */ 340 enum iwl_geo_information { 341 GEO_NO_INFO = 0, 342 GEO_WMM_ETSI_5GHZ_INFO = BIT(0), 343 }; 344 345 /** 346 * struct iwl_mcc_update_resp_v3 - response to MCC_UPDATE_CMD. 347 * Contains the new channel control profile map, if changed, and the new MCC 348 * (mobile country code). 349 * The new MCC may be different than what was requested in MCC_UPDATE_CMD. 350 * @status: see &enum iwl_mcc_update_status 351 * @mcc: the new applied MCC 352 * @cap: capabilities for all channels which matches the MCC 353 * @source_id: the MCC source, see iwl_mcc_source 354 * @time: time elapsed from the MCC test start (in units of 30 seconds) 355 * @geo_info: geographic specific profile information 356 * see &enum iwl_geo_information. 357 * @n_channels: number of channels in @channels_data. 358 * @channels: channel control data map, DWORD for each channel. Only the first 359 * 16bits are used. 360 */ 361 struct iwl_mcc_update_resp_v3 { 362 __le32 status; 363 __le16 mcc; 364 u8 cap; 365 u8 source_id; 366 __le16 time; 367 __le16 geo_info; 368 __le32 n_channels; 369 __le32 channels[]; 370 } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_3 */ 371 372 /** 373 * struct iwl_mcc_update_resp - response to MCC_UPDATE_CMD. 374 * Contains the new channel control profile map, if changed, and the new MCC 375 * (mobile country code). 376 * The new MCC may be different than what was requested in MCC_UPDATE_CMD. 377 * @status: see &enum iwl_mcc_update_status 378 * @mcc: the new applied MCC 379 * @cap: capabilities for all channels which matches the MCC 380 * @time: time elapsed from the MCC test start (in units of 30 seconds) 381 * @geo_info: geographic specific profile information 382 * see &enum iwl_geo_information. 383 * @source_id: the MCC source, see iwl_mcc_source 384 * @reserved: for four bytes alignment. 385 * @n_channels: number of channels in @channels_data. 386 * @channels: channel control data map, DWORD for each channel. Only the first 387 * 16bits are used. 388 */ 389 struct iwl_mcc_update_resp { 390 __le32 status; 391 __le16 mcc; 392 __le16 cap; 393 __le16 time; 394 __le16 geo_info; 395 u8 source_id; 396 u8 reserved[3]; 397 __le32 n_channels; 398 __le32 channels[]; 399 } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_4 */ 400 401 /** 402 * struct iwl_mcc_chub_notif - chub notifies of mcc change 403 * (MCC_CHUB_UPDATE_CMD = 0xc9) 404 * The Chub (Communication Hub, CommsHUB) is a HW component that connects to 405 * the cellular and connectivity cores that gets updates of the mcc, and 406 * notifies the ucode directly of any mcc change. 407 * The ucode requests the driver to request the device to update geographic 408 * regulatory profile according to the given MCC (Mobile Country Code). 409 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain. 410 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the 411 * MCC in the cmd response will be the relevant MCC in the NVM. 412 * @mcc: given mobile country code 413 * @source_id: identity of the change originator, see iwl_mcc_source 414 * @reserved1: reserved for alignment 415 */ 416 struct iwl_mcc_chub_notif { 417 __le16 mcc; 418 u8 source_id; 419 u8 reserved1; 420 } __packed; /* LAR_MCC_NOTIFY_S */ 421 422 enum iwl_mcc_update_status { 423 MCC_RESP_NEW_CHAN_PROFILE, 424 MCC_RESP_SAME_CHAN_PROFILE, 425 MCC_RESP_INVALID, 426 MCC_RESP_NVM_DISABLED, 427 MCC_RESP_ILLEGAL, 428 MCC_RESP_LOW_PRIORITY, 429 MCC_RESP_TEST_MODE_ACTIVE, 430 MCC_RESP_TEST_MODE_NOT_ACTIVE, 431 MCC_RESP_TEST_MODE_DENIAL_OF_SERVICE, 432 }; 433 434 enum iwl_mcc_source { 435 MCC_SOURCE_OLD_FW = 0, 436 MCC_SOURCE_ME = 1, 437 MCC_SOURCE_BIOS = 2, 438 MCC_SOURCE_3G_LTE_HOST = 3, 439 MCC_SOURCE_3G_LTE_DEVICE = 4, 440 MCC_SOURCE_WIFI = 5, 441 MCC_SOURCE_RESERVED = 6, 442 MCC_SOURCE_DEFAULT = 7, 443 MCC_SOURCE_UNINITIALIZED = 8, 444 MCC_SOURCE_MCC_API = 9, 445 MCC_SOURCE_GET_CURRENT = 0x10, 446 MCC_SOURCE_GETTING_MCC_TEST_MODE = 0x11, 447 }; 448 449 #define IWL_TAS_BLACK_LIST_MAX 16 450 /** 451 * struct iwl_tas_config_cmd - configures the TAS 452 * @block_list_size: size of relevant field in block_list_array 453 * @block_list_array: block list countries (without TAS) 454 */ 455 struct iwl_tas_config_cmd { 456 __le32 block_list_size; 457 __le32 block_list_array[IWL_TAS_BLACK_LIST_MAX]; 458 } __packed; /* TAS_CONFIG_CMD_API_S_VER_2 */ 459 460 /** 461 * enum iwl_lari_configs - bit masks for the various LARI config operations 462 * @LARI_CONFIG_DISABLE_11AC_UKRAINE_MSK: disable 11ac in ukraine 463 * @LARI_CONFIG_CHANGE_ETSI_TO_PASSIVE_MSK: ETSI 5.8GHz SRD passive scan 464 * @LARI_CONFIG_CHANGE_ETSI_TO_DISABLED_MSK: ETSI 5.8GHz SRD disabled 465 * @LARI_CONFIG_ENABLE_5G2_IN_INDONESIA_MSK: enable 5.15/5.35GHz bands in 466 * Indonesia 467 */ 468 enum iwl_lari_config_masks { 469 LARI_CONFIG_DISABLE_11AC_UKRAINE_MSK = BIT(0), 470 LARI_CONFIG_CHANGE_ETSI_TO_PASSIVE_MSK = BIT(1), 471 LARI_CONFIG_CHANGE_ETSI_TO_DISABLED_MSK = BIT(2), 472 LARI_CONFIG_ENABLE_5G2_IN_INDONESIA_MSK = BIT(3), 473 }; 474 475 /** 476 * struct iwl_lari_config_change_cmd - change LARI configuration 477 * @config_bitmap: bit map of the config commands. each bit will trigger a 478 * different predefined FW config operation 479 */ 480 struct iwl_lari_config_change_cmd { 481 __le32 config_bitmap; 482 } __packed; /* LARI_CHANGE_CONF_CMD_S_VER_1 */ 483 484 /** 485 * struct iwl_pnvm_init_complete_ntfy - PNVM initialization complete 486 * @status: PNVM image loading status 487 */ 488 struct iwl_pnvm_init_complete_ntfy { 489 __le32 status; 490 } __packed; /* PNVM_INIT_COMPLETE_NTFY_S_VER_1 */ 491 492 #endif /* __iwl_fw_api_nvm_reg_h__ */ 493