nvm-reg.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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 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 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. #ifndef __iwl_fw_api_nvm_reg_h__
  65. #define __iwl_fw_api_nvm_reg_h__
  66. /**
  67. * enum iwl_regulatory_and_nvm_subcmd_ids - regulatory/NVM commands
  68. */
  69. enum iwl_regulatory_and_nvm_subcmd_ids {
  70. /**
  71. * @NVM_ACCESS_COMPLETE: &struct iwl_nvm_access_complete_cmd
  72. */
  73. NVM_ACCESS_COMPLETE = 0x0,
  74. /**
  75. * @NVM_GET_INFO:
  76. * Command is &struct iwl_nvm_get_info,
  77. * response is &struct iwl_nvm_get_info_rsp
  78. */
  79. NVM_GET_INFO = 0x2,
  80. };
  81. /**
  82. * enum iwl_nvm_access_op - NVM access opcode
  83. * @IWL_NVM_READ: read NVM
  84. * @IWL_NVM_WRITE: write NVM
  85. */
  86. enum iwl_nvm_access_op {
  87. IWL_NVM_READ = 0,
  88. IWL_NVM_WRITE = 1,
  89. };
  90. /**
  91. * enum iwl_nvm_access_target - target of the NVM_ACCESS_CMD
  92. * @NVM_ACCESS_TARGET_CACHE: access the cache
  93. * @NVM_ACCESS_TARGET_OTP: access the OTP
  94. * @NVM_ACCESS_TARGET_EEPROM: access the EEPROM
  95. */
  96. enum iwl_nvm_access_target {
  97. NVM_ACCESS_TARGET_CACHE = 0,
  98. NVM_ACCESS_TARGET_OTP = 1,
  99. NVM_ACCESS_TARGET_EEPROM = 2,
  100. };
  101. /**
  102. * enum iwl_nvm_section_type - section types for NVM_ACCESS_CMD
  103. * @NVM_SECTION_TYPE_SW: software section
  104. * @NVM_SECTION_TYPE_REGULATORY: regulatory section
  105. * @NVM_SECTION_TYPE_CALIBRATION: calibration section
  106. * @NVM_SECTION_TYPE_PRODUCTION: production section
  107. * @NVM_SECTION_TYPE_REGULATORY_SDP: regulatory section used by 3168 series
  108. * @NVM_SECTION_TYPE_MAC_OVERRIDE: MAC override section
  109. * @NVM_SECTION_TYPE_PHY_SKU: PHY SKU section
  110. * @NVM_MAX_NUM_SECTIONS: number of sections
  111. */
  112. enum iwl_nvm_section_type {
  113. NVM_SECTION_TYPE_SW = 1,
  114. NVM_SECTION_TYPE_REGULATORY = 3,
  115. NVM_SECTION_TYPE_CALIBRATION = 4,
  116. NVM_SECTION_TYPE_PRODUCTION = 5,
  117. NVM_SECTION_TYPE_REGULATORY_SDP = 8,
  118. NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
  119. NVM_SECTION_TYPE_PHY_SKU = 12,
  120. NVM_MAX_NUM_SECTIONS = 13,
  121. };
  122. /**
  123. * struct iwl_nvm_access_cmd - Request the device to send an NVM section
  124. * @op_code: &enum iwl_nvm_access_op
  125. * @target: &enum iwl_nvm_access_target
  126. * @type: &enum iwl_nvm_section_type
  127. * @offset: offset in bytes into the section
  128. * @length: in bytes, to read/write
  129. * @data: if write operation, the data to write. On read its empty
  130. */
  131. struct iwl_nvm_access_cmd {
  132. u8 op_code;
  133. u8 target;
  134. __le16 type;
  135. __le16 offset;
  136. __le16 length;
  137. u8 data[];
  138. } __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */
  139. /**
  140. * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD
  141. * @offset: offset in bytes into the section
  142. * @length: in bytes, either how much was written or read
  143. * @type: NVM_SECTION_TYPE_*
  144. * @status: 0 for success, fail otherwise
  145. * @data: if read operation, the data returned. Empty on write.
  146. */
  147. struct iwl_nvm_access_resp {
  148. __le16 offset;
  149. __le16 length;
  150. __le16 type;
  151. __le16 status;
  152. u8 data[];
  153. } __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */
  154. /*
  155. * struct iwl_nvm_get_info - request to get NVM data
  156. */
  157. struct iwl_nvm_get_info {
  158. __le32 reserved;
  159. } __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_S_VER_1 */
  160. /**
  161. * enum iwl_nvm_info_general_flags - flags in NVM_GET_INFO resp
  162. * @NVM_GENERAL_FLAGS_EMPTY_OTP: 1 if OTP is empty
  163. */
  164. enum iwl_nvm_info_general_flags {
  165. NVM_GENERAL_FLAGS_EMPTY_OTP = BIT(0),
  166. };
  167. /**
  168. * struct iwl_nvm_get_info_general - general NVM data
  169. * @flags: bit 0: 1 - empty, 0 - non-empty
  170. * @nvm_version: nvm version
  171. * @board_type: board type
  172. * @reserved: reserved
  173. */
  174. struct iwl_nvm_get_info_general {
  175. __le32 flags;
  176. __le16 nvm_version;
  177. u8 board_type;
  178. u8 reserved;
  179. } __packed; /* GRP_REGULATORY_NVM_GET_INFO_GENERAL_S_VER_1 */
  180. /**
  181. * enum iwl_nvm_mac_sku_flags - flags in &iwl_nvm_get_info_sku
  182. * @NVM_MAC_SKU_FLAGS_BAND_2_4_ENABLED: true if 2.4 band enabled
  183. * @NVM_MAC_SKU_FLAGS_BAND_5_2_ENABLED: true if 5.2 band enabled
  184. * @NVM_MAC_SKU_FLAGS_802_11N_ENABLED: true if 11n enabled
  185. * @NVM_MAC_SKU_FLAGS_802_11AC_ENABLED: true if 11ac enabled
  186. * @NVM_MAC_SKU_FLAGS_802_11AX_ENABLED: true if 11ax enabled
  187. * @NVM_MAC_SKU_FLAGS_MIMO_DISABLED: true if MIMO disabled
  188. * @NVM_MAC_SKU_FLAGS_WAPI_ENABLED: true if WAPI enabled
  189. * @NVM_MAC_SKU_FLAGS_REG_CHECK_ENABLED: true if regulatory checker enabled
  190. * @NVM_MAC_SKU_FLAGS_API_LOCK_ENABLED: true if API lock enabled
  191. */
  192. enum iwl_nvm_mac_sku_flags {
  193. NVM_MAC_SKU_FLAGS_BAND_2_4_ENABLED = BIT(0),
  194. NVM_MAC_SKU_FLAGS_BAND_5_2_ENABLED = BIT(1),
  195. NVM_MAC_SKU_FLAGS_802_11N_ENABLED = BIT(2),
  196. NVM_MAC_SKU_FLAGS_802_11AC_ENABLED = BIT(3),
  197. NVM_MAC_SKU_FLAGS_802_11AX_ENABLED = BIT(4),
  198. NVM_MAC_SKU_FLAGS_MIMO_DISABLED = BIT(5),
  199. NVM_MAC_SKU_FLAGS_WAPI_ENABLED = BIT(8),
  200. NVM_MAC_SKU_FLAGS_REG_CHECK_ENABLED = BIT(14),
  201. NVM_MAC_SKU_FLAGS_API_LOCK_ENABLED = BIT(15),
  202. };
  203. /**
  204. * struct iwl_nvm_get_info_sku - mac information
  205. * @mac_sku_flags: flags for SKU, see &enum iwl_nvm_mac_sku_flags
  206. */
  207. struct iwl_nvm_get_info_sku {
  208. __le32 mac_sku_flags;
  209. } __packed; /* REGULATORY_NVM_GET_INFO_MAC_SKU_SECTION_S_VER_2 */
  210. /**
  211. * struct iwl_nvm_get_info_phy - phy information
  212. * @tx_chains: BIT 0 chain A, BIT 1 chain B
  213. * @rx_chains: BIT 0 chain A, BIT 1 chain B
  214. */
  215. struct iwl_nvm_get_info_phy {
  216. __le32 tx_chains;
  217. __le32 rx_chains;
  218. } __packed; /* GRP_REGULATORY_NVM_GET_INFO_PHY_SKU_SECTION_S_VER_1 */
  219. #define IWL_NUM_CHANNELS (51)
  220. /**
  221. * struct iwl_nvm_get_info_regulatory - regulatory information
  222. * @lar_enabled: is LAR enabled
  223. * @channel_profile: regulatory data of this channel
  224. * @reserved: reserved
  225. */
  226. struct iwl_nvm_get_info_regulatory {
  227. __le32 lar_enabled;
  228. __le16 channel_profile[IWL_NUM_CHANNELS];
  229. __le16 reserved;
  230. } __packed; /* GRP_REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */
  231. /**
  232. * struct iwl_nvm_get_info_rsp - response to get NVM data
  233. * @general: general NVM data
  234. * @mac_sku: data relating to MAC sku
  235. * @phy_sku: data relating to PHY sku
  236. * @regulatory: regulatory data
  237. */
  238. struct iwl_nvm_get_info_rsp {
  239. struct iwl_nvm_get_info_general general;
  240. struct iwl_nvm_get_info_sku mac_sku;
  241. struct iwl_nvm_get_info_phy phy_sku;
  242. struct iwl_nvm_get_info_regulatory regulatory;
  243. } __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_RSP_S_VER_2 */
  244. /**
  245. * struct iwl_nvm_access_complete_cmd - NVM_ACCESS commands are completed
  246. * @reserved: reserved
  247. */
  248. struct iwl_nvm_access_complete_cmd {
  249. __le32 reserved;
  250. } __packed; /* NVM_ACCESS_COMPLETE_CMD_API_S_VER_1 */
  251. /**
  252. * struct iwl_mcc_update_cmd_v1 - Request the device to update geographic
  253. * regulatory profile according to the given MCC (Mobile Country Code).
  254. * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
  255. * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
  256. * MCC in the cmd response will be the relevant MCC in the NVM.
  257. * @mcc: given mobile country code
  258. * @source_id: the source from where we got the MCC, see iwl_mcc_source
  259. * @reserved: reserved for alignment
  260. */
  261. struct iwl_mcc_update_cmd_v1 {
  262. __le16 mcc;
  263. u8 source_id;
  264. u8 reserved;
  265. } __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_1 */
  266. /**
  267. * struct iwl_mcc_update_cmd - Request the device to update geographic
  268. * regulatory profile according to the given MCC (Mobile Country Code).
  269. * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
  270. * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
  271. * MCC in the cmd response will be the relevant MCC in the NVM.
  272. * @mcc: given mobile country code
  273. * @source_id: the source from where we got the MCC, see iwl_mcc_source
  274. * @reserved: reserved for alignment
  275. * @key: integrity key for MCC API OEM testing
  276. * @reserved2: reserved
  277. */
  278. struct iwl_mcc_update_cmd {
  279. __le16 mcc;
  280. u8 source_id;
  281. u8 reserved;
  282. __le32 key;
  283. u8 reserved2[20];
  284. } __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_2 */
  285. /**
  286. * struct iwl_mcc_update_resp_v1 - response to MCC_UPDATE_CMD.
  287. * Contains the new channel control profile map, if changed, and the new MCC
  288. * (mobile country code).
  289. * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
  290. * @status: see &enum iwl_mcc_update_status
  291. * @mcc: the new applied MCC
  292. * @cap: capabilities for all channels which matches the MCC
  293. * @source_id: the MCC source, see iwl_mcc_source
  294. * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
  295. * channels, depending on platform)
  296. * @channels: channel control data map, DWORD for each channel. Only the first
  297. * 16bits are used.
  298. */
  299. struct iwl_mcc_update_resp_v1 {
  300. __le32 status;
  301. __le16 mcc;
  302. u8 cap;
  303. u8 source_id;
  304. __le32 n_channels;
  305. __le32 channels[0];
  306. } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_1 */
  307. /**
  308. * enum iwl_geo_information - geographic information.
  309. * @GEO_NO_INFO: no special info for this geo profile.
  310. * @GEO_WMM_ETSI_5GHZ_INFO: this geo profile limits the WMM params
  311. * for the 5 GHz band.
  312. */
  313. enum iwl_geo_information {
  314. GEO_NO_INFO = 0,
  315. GEO_WMM_ETSI_5GHZ_INFO = BIT(0),
  316. };
  317. /**
  318. * struct iwl_mcc_update_resp - response to MCC_UPDATE_CMD.
  319. * Contains the new channel control profile map, if changed, and the new MCC
  320. * (mobile country code).
  321. * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
  322. * @status: see &enum iwl_mcc_update_status
  323. * @mcc: the new applied MCC
  324. * @cap: capabilities for all channels which matches the MCC
  325. * @source_id: the MCC source, see iwl_mcc_source
  326. * @time: time elapsed from the MCC test start (in 30 seconds TU)
  327. * @geo_info: geographic specific profile information
  328. * see &enum iwl_geo_information.
  329. * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
  330. * channels, depending on platform)
  331. * @channels: channel control data map, DWORD for each channel. Only the first
  332. * 16bits are used.
  333. */
  334. struct iwl_mcc_update_resp {
  335. __le32 status;
  336. __le16 mcc;
  337. u8 cap;
  338. u8 source_id;
  339. __le16 time;
  340. __le16 geo_info;
  341. __le32 n_channels;
  342. __le32 channels[0];
  343. } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_3 */
  344. /**
  345. * struct iwl_mcc_chub_notif - chub notifies of mcc change
  346. * (MCC_CHUB_UPDATE_CMD = 0xc9)
  347. * The Chub (Communication Hub, CommsHUB) is a HW component that connects to
  348. * the cellular and connectivity cores that gets updates of the mcc, and
  349. * notifies the ucode directly of any mcc change.
  350. * The ucode requests the driver to request the device to update geographic
  351. * regulatory profile according to the given MCC (Mobile Country Code).
  352. * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
  353. * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
  354. * MCC in the cmd response will be the relevant MCC in the NVM.
  355. * @mcc: given mobile country code
  356. * @source_id: identity of the change originator, see iwl_mcc_source
  357. * @reserved1: reserved for alignment
  358. */
  359. struct iwl_mcc_chub_notif {
  360. __le16 mcc;
  361. u8 source_id;
  362. u8 reserved1;
  363. } __packed; /* LAR_MCC_NOTIFY_S */
  364. enum iwl_mcc_update_status {
  365. MCC_RESP_NEW_CHAN_PROFILE,
  366. MCC_RESP_SAME_CHAN_PROFILE,
  367. MCC_RESP_INVALID,
  368. MCC_RESP_NVM_DISABLED,
  369. MCC_RESP_ILLEGAL,
  370. MCC_RESP_LOW_PRIORITY,
  371. MCC_RESP_TEST_MODE_ACTIVE,
  372. MCC_RESP_TEST_MODE_NOT_ACTIVE,
  373. MCC_RESP_TEST_MODE_DENIAL_OF_SERVICE,
  374. };
  375. enum iwl_mcc_source {
  376. MCC_SOURCE_OLD_FW = 0,
  377. MCC_SOURCE_ME = 1,
  378. MCC_SOURCE_BIOS = 2,
  379. MCC_SOURCE_3G_LTE_HOST = 3,
  380. MCC_SOURCE_3G_LTE_DEVICE = 4,
  381. MCC_SOURCE_WIFI = 5,
  382. MCC_SOURCE_RESERVED = 6,
  383. MCC_SOURCE_DEFAULT = 7,
  384. MCC_SOURCE_UNINITIALIZED = 8,
  385. MCC_SOURCE_MCC_API = 9,
  386. MCC_SOURCE_GET_CURRENT = 0x10,
  387. MCC_SOURCE_GETTING_MCC_TEST_MODE = 0x11,
  388. };
  389. #endif /* __iwl_fw_api_nvm_reg_h__ */