nvm-reg.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  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. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of version 2 of the GNU General Public License as
  14. * published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful, but
  17. * WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * General Public License for more details.
  20. *
  21. * The full GNU General Public License is included in this distribution
  22. * in the file called COPYING.
  23. *
  24. * Contact Information:
  25. * Intel Linux Wireless <linuxwifi@intel.com>
  26. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  27. *
  28. * BSD LICENSE
  29. *
  30. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  31. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  32. * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
  33. * All rights reserved.
  34. *
  35. * Redistribution and use in source and binary forms, with or without
  36. * modification, are permitted provided that the following conditions
  37. * are met:
  38. *
  39. * * Redistributions of source code must retain the above copyright
  40. * notice, this list of conditions and the following disclaimer.
  41. * * Redistributions in binary form must reproduce the above copyright
  42. * notice, this list of conditions and the following disclaimer in
  43. * the documentation and/or other materials provided with the
  44. * distribution.
  45. * * Neither the name Intel Corporation nor the names of its
  46. * contributors may be used to endorse or promote products derived
  47. * from this software without specific prior written permission.
  48. *
  49. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  50. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  51. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  52. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  53. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  54. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  55. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  56. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  57. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  58. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  59. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  60. *
  61. *****************************************************************************/
  62. #ifndef __iwl_fw_api_nvm_reg_h__
  63. #define __iwl_fw_api_nvm_reg_h__
  64. /**
  65. * enum iwl_regulatory_and_nvm_subcmd_ids - regulatory/NVM commands
  66. */
  67. enum iwl_regulatory_and_nvm_subcmd_ids {
  68. /**
  69. * @NVM_ACCESS_COMPLETE: &struct iwl_nvm_access_complete_cmd
  70. */
  71. NVM_ACCESS_COMPLETE = 0x0,
  72. /**
  73. * @NVM_GET_INFO:
  74. * Command is &struct iwl_nvm_get_info,
  75. * response is &struct iwl_nvm_get_info_rsp
  76. */
  77. NVM_GET_INFO = 0x2,
  78. };
  79. /**
  80. * enum iwl_nvm_access_op - NVM access opcode
  81. * @IWL_NVM_READ: read NVM
  82. * @IWL_NVM_WRITE: write NVM
  83. */
  84. enum iwl_nvm_access_op {
  85. IWL_NVM_READ = 0,
  86. IWL_NVM_WRITE = 1,
  87. };
  88. /**
  89. * enum iwl_nvm_access_target - target of the NVM_ACCESS_CMD
  90. * @NVM_ACCESS_TARGET_CACHE: access the cache
  91. * @NVM_ACCESS_TARGET_OTP: access the OTP
  92. * @NVM_ACCESS_TARGET_EEPROM: access the EEPROM
  93. */
  94. enum iwl_nvm_access_target {
  95. NVM_ACCESS_TARGET_CACHE = 0,
  96. NVM_ACCESS_TARGET_OTP = 1,
  97. NVM_ACCESS_TARGET_EEPROM = 2,
  98. };
  99. /**
  100. * enum iwl_nvm_section_type - section types for NVM_ACCESS_CMD
  101. * @NVM_SECTION_TYPE_SW: software section
  102. * @NVM_SECTION_TYPE_REGULATORY: regulatory section
  103. * @NVM_SECTION_TYPE_CALIBRATION: calibration section
  104. * @NVM_SECTION_TYPE_PRODUCTION: production section
  105. * @NVM_SECTION_TYPE_MAC_OVERRIDE: MAC override section
  106. * @NVM_SECTION_TYPE_PHY_SKU: PHY SKU section
  107. * @NVM_MAX_NUM_SECTIONS: number of sections
  108. */
  109. enum iwl_nvm_section_type {
  110. NVM_SECTION_TYPE_SW = 1,
  111. NVM_SECTION_TYPE_REGULATORY = 3,
  112. NVM_SECTION_TYPE_CALIBRATION = 4,
  113. NVM_SECTION_TYPE_PRODUCTION = 5,
  114. NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
  115. NVM_SECTION_TYPE_PHY_SKU = 12,
  116. NVM_MAX_NUM_SECTIONS = 13,
  117. };
  118. /**
  119. * struct iwl_nvm_access_cmd - Request the device to send an NVM section
  120. * @op_code: &enum iwl_nvm_access_op
  121. * @target: &enum iwl_nvm_access_target
  122. * @type: &enum iwl_nvm_section_type
  123. * @offset: offset in bytes into the section
  124. * @length: in bytes, to read/write
  125. * @data: if write operation, the data to write. On read its empty
  126. */
  127. struct iwl_nvm_access_cmd {
  128. u8 op_code;
  129. u8 target;
  130. __le16 type;
  131. __le16 offset;
  132. __le16 length;
  133. u8 data[];
  134. } __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */
  135. /**
  136. * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD
  137. * @offset: offset in bytes into the section
  138. * @length: in bytes, either how much was written or read
  139. * @type: NVM_SECTION_TYPE_*
  140. * @status: 0 for success, fail otherwise
  141. * @data: if read operation, the data returned. Empty on write.
  142. */
  143. struct iwl_nvm_access_resp {
  144. __le16 offset;
  145. __le16 length;
  146. __le16 type;
  147. __le16 status;
  148. u8 data[];
  149. } __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */
  150. /*
  151. * struct iwl_nvm_get_info - request to get NVM data
  152. */
  153. struct iwl_nvm_get_info {
  154. __le32 reserved;
  155. } __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_S_VER_1 */
  156. /**
  157. * enum iwl_nvm_info_general_flags - flags in NVM_GET_INFO resp
  158. * @NVM_GENERAL_FLAGS_EMPTY_OTP: 1 if OTP is empty
  159. */
  160. enum iwl_nvm_info_general_flags {
  161. NVM_GENERAL_FLAGS_EMPTY_OTP = BIT(0),
  162. };
  163. /**
  164. * struct iwl_nvm_get_info_general - general NVM data
  165. * @flags: bit 0: 1 - empty, 0 - non-empty
  166. * @nvm_version: nvm version
  167. * @board_type: board type
  168. * @reserved: reserved
  169. */
  170. struct iwl_nvm_get_info_general {
  171. __le32 flags;
  172. __le16 nvm_version;
  173. u8 board_type;
  174. u8 reserved;
  175. } __packed; /* GRP_REGULATORY_NVM_GET_INFO_GENERAL_S_VER_1 */
  176. /**
  177. * struct iwl_nvm_get_info_sku - mac information
  178. * @enable_24g: band 2.4G enabled
  179. * @enable_5g: band 5G enabled
  180. * @enable_11n: 11n enabled
  181. * @enable_11ac: 11ac enabled
  182. * @mimo_disable: MIMO enabled
  183. * @ext_crypto: Extended crypto enabled
  184. */
  185. struct iwl_nvm_get_info_sku {
  186. __le32 enable_24g;
  187. __le32 enable_5g;
  188. __le32 enable_11n;
  189. __le32 enable_11ac;
  190. __le32 mimo_disable;
  191. __le32 ext_crypto;
  192. } __packed; /* GRP_REGULATORY_NVM_GET_INFO_MAC_SKU_SECTION_S_VER_1 */
  193. /**
  194. * struct iwl_nvm_get_info_phy - phy information
  195. * @tx_chains: BIT 0 chain A, BIT 1 chain B
  196. * @rx_chains: BIT 0 chain A, BIT 1 chain B
  197. */
  198. struct iwl_nvm_get_info_phy {
  199. __le32 tx_chains;
  200. __le32 rx_chains;
  201. } __packed; /* GRP_REGULATORY_NVM_GET_INFO_PHY_SKU_SECTION_S_VER_1 */
  202. #define IWL_NUM_CHANNELS (51)
  203. /**
  204. * struct iwl_nvm_get_info_regulatory - regulatory information
  205. * @lar_enabled: is LAR enabled
  206. * @channel_profile: regulatory data of this channel
  207. * @reserved: reserved
  208. */
  209. struct iwl_nvm_get_info_regulatory {
  210. __le32 lar_enabled;
  211. __le16 channel_profile[IWL_NUM_CHANNELS];
  212. __le16 reserved;
  213. } __packed; /* GRP_REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */
  214. /**
  215. * struct iwl_nvm_get_info_rsp - response to get NVM data
  216. * @general: general NVM data
  217. * @mac_sku: data relating to MAC sku
  218. * @phy_sku: data relating to PHY sku
  219. * @regulatory: regulatory data
  220. */
  221. struct iwl_nvm_get_info_rsp {
  222. struct iwl_nvm_get_info_general general;
  223. struct iwl_nvm_get_info_sku mac_sku;
  224. struct iwl_nvm_get_info_phy phy_sku;
  225. struct iwl_nvm_get_info_regulatory regulatory;
  226. } __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_RSP_S_VER_1 */
  227. /**
  228. * struct iwl_nvm_access_complete_cmd - NVM_ACCESS commands are completed
  229. * @reserved: reserved
  230. */
  231. struct iwl_nvm_access_complete_cmd {
  232. __le32 reserved;
  233. } __packed; /* NVM_ACCESS_COMPLETE_CMD_API_S_VER_1 */
  234. /**
  235. * struct iwl_mcc_update_cmd_v1 - Request the device to update geographic
  236. * regulatory profile according to the given MCC (Mobile Country Code).
  237. * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
  238. * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
  239. * MCC in the cmd response will be the relevant MCC in the NVM.
  240. * @mcc: given mobile country code
  241. * @source_id: the source from where we got the MCC, see iwl_mcc_source
  242. * @reserved: reserved for alignment
  243. */
  244. struct iwl_mcc_update_cmd_v1 {
  245. __le16 mcc;
  246. u8 source_id;
  247. u8 reserved;
  248. } __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_1 */
  249. /**
  250. * struct iwl_mcc_update_cmd - Request the device to update geographic
  251. * regulatory profile according to the given MCC (Mobile Country Code).
  252. * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
  253. * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
  254. * MCC in the cmd response will be the relevant MCC in the NVM.
  255. * @mcc: given mobile country code
  256. * @source_id: the source from where we got the MCC, see iwl_mcc_source
  257. * @reserved: reserved for alignment
  258. * @key: integrity key for MCC API OEM testing
  259. * @reserved2: reserved
  260. */
  261. struct iwl_mcc_update_cmd {
  262. __le16 mcc;
  263. u8 source_id;
  264. u8 reserved;
  265. __le32 key;
  266. u8 reserved2[20];
  267. } __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_2 */
  268. /**
  269. * struct iwl_mcc_update_resp_v1 - response to MCC_UPDATE_CMD.
  270. * Contains the new channel control profile map, if changed, and the new MCC
  271. * (mobile country code).
  272. * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
  273. * @status: see &enum iwl_mcc_update_status
  274. * @mcc: the new applied MCC
  275. * @cap: capabilities for all channels which matches the MCC
  276. * @source_id: the MCC source, see iwl_mcc_source
  277. * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
  278. * channels, depending on platform)
  279. * @channels: channel control data map, DWORD for each channel. Only the first
  280. * 16bits are used.
  281. */
  282. struct iwl_mcc_update_resp_v1 {
  283. __le32 status;
  284. __le16 mcc;
  285. u8 cap;
  286. u8 source_id;
  287. __le32 n_channels;
  288. __le32 channels[0];
  289. } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_1 */
  290. /**
  291. * struct iwl_mcc_update_resp - response to MCC_UPDATE_CMD.
  292. * Contains the new channel control profile map, if changed, and the new MCC
  293. * (mobile country code).
  294. * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
  295. * @status: see &enum iwl_mcc_update_status
  296. * @mcc: the new applied MCC
  297. * @cap: capabilities for all channels which matches the MCC
  298. * @source_id: the MCC source, see iwl_mcc_source
  299. * @time: time elapsed from the MCC test start (in 30 seconds TU)
  300. * @reserved: reserved.
  301. * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
  302. * channels, depending on platform)
  303. * @channels: channel control data map, DWORD for each channel. Only the first
  304. * 16bits are used.
  305. */
  306. struct iwl_mcc_update_resp {
  307. __le32 status;
  308. __le16 mcc;
  309. u8 cap;
  310. u8 source_id;
  311. __le16 time;
  312. __le16 reserved;
  313. __le32 n_channels;
  314. __le32 channels[0];
  315. } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_2 */
  316. /**
  317. * struct iwl_mcc_chub_notif - chub notifies of mcc change
  318. * (MCC_CHUB_UPDATE_CMD = 0xc9)
  319. * The Chub (Communication Hub, CommsHUB) is a HW component that connects to
  320. * the cellular and connectivity cores that gets updates of the mcc, and
  321. * notifies the ucode directly of any mcc change.
  322. * The ucode requests the driver to request the device to update geographic
  323. * regulatory profile according to the given MCC (Mobile Country Code).
  324. * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
  325. * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
  326. * MCC in the cmd response will be the relevant MCC in the NVM.
  327. * @mcc: given mobile country code
  328. * @source_id: identity of the change originator, see iwl_mcc_source
  329. * @reserved1: reserved for alignment
  330. */
  331. struct iwl_mcc_chub_notif {
  332. __le16 mcc;
  333. u8 source_id;
  334. u8 reserved1;
  335. } __packed; /* LAR_MCC_NOTIFY_S */
  336. enum iwl_mcc_update_status {
  337. MCC_RESP_NEW_CHAN_PROFILE,
  338. MCC_RESP_SAME_CHAN_PROFILE,
  339. MCC_RESP_INVALID,
  340. MCC_RESP_NVM_DISABLED,
  341. MCC_RESP_ILLEGAL,
  342. MCC_RESP_LOW_PRIORITY,
  343. MCC_RESP_TEST_MODE_ACTIVE,
  344. MCC_RESP_TEST_MODE_NOT_ACTIVE,
  345. MCC_RESP_TEST_MODE_DENIAL_OF_SERVICE,
  346. };
  347. enum iwl_mcc_source {
  348. MCC_SOURCE_OLD_FW = 0,
  349. MCC_SOURCE_ME = 1,
  350. MCC_SOURCE_BIOS = 2,
  351. MCC_SOURCE_3G_LTE_HOST = 3,
  352. MCC_SOURCE_3G_LTE_DEVICE = 4,
  353. MCC_SOURCE_WIFI = 5,
  354. MCC_SOURCE_RESERVED = 6,
  355. MCC_SOURCE_DEFAULT = 7,
  356. MCC_SOURCE_UNINITIALIZED = 8,
  357. MCC_SOURCE_MCC_API = 9,
  358. MCC_SOURCE_GET_CURRENT = 0x10,
  359. MCC_SOURCE_GETTING_MCC_TEST_MODE = 0x11,
  360. };
  361. #endif /* __iwl_fw_api_nvm_reg_h__ */