iwl-context-info.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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) 2017 Intel Deutschland GmbH
  9. * Copyright(c) 2018 Intel Corporation
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of version 2 of the GNU General Public License as
  13. * published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * BSD LICENSE
  21. *
  22. * Copyright(c) 2017 Intel Deutschland GmbH
  23. * Copyright(c) 2018 Intel Corporation
  24. * All rights reserved.
  25. *
  26. * Redistribution and use in source and binary forms, with or without
  27. * modification, are permitted provided that the following conditions
  28. * are met:
  29. *
  30. * * Redistributions of source code must retain the above copyright
  31. * notice, this list of conditions and the following disclaimer.
  32. * * Redistributions in binary form must reproduce the above copyright
  33. * notice, this list of conditions and the following disclaimer in
  34. * the documentation and/or other materials provided with the
  35. * distribution.
  36. * * Neither the name Intel Corporation nor the names of its
  37. * contributors may be used to endorse or promote products derived
  38. * from this software without specific prior written permission.
  39. *
  40. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  41. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  42. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  43. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  44. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  45. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  46. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  47. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  48. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  49. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  50. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  51. *
  52. *****************************************************************************/
  53. #ifndef __iwl_context_info_file_h__
  54. #define __iwl_context_info_file_h__
  55. /* maximmum number of DRAM map entries supported by FW */
  56. #define IWL_MAX_DRAM_ENTRY 64
  57. #define CSR_CTXT_INFO_BA 0x40
  58. /**
  59. * enum iwl_context_info_flags - Context information control flags
  60. * @IWL_CTXT_INFO_AUTO_FUNC_INIT: If set, FW will not wait before interrupting
  61. * the init done for driver command that configures several system modes
  62. * @IWL_CTXT_INFO_EARLY_DEBUG: enable early debug
  63. * @IWL_CTXT_INFO_ENABLE_CDMP: enable core dump
  64. * @IWL_CTXT_INFO_RB_SIZE_4K: Use 4K RB size (the default is 2K)
  65. * @IWL_CTXT_INFO_RB_CB_SIZE_POS: position of the RBD Cyclic Buffer Size
  66. * exponent, the actual size is 2**value, valid sizes are 8-2048.
  67. * The value is four bits long. Maximum valid exponent is 12
  68. * @IWL_CTXT_INFO_TFD_FORMAT_LONG: use long TFD Format (the
  69. * default is short format - not supported by the driver)
  70. */
  71. enum iwl_context_info_flags {
  72. IWL_CTXT_INFO_AUTO_FUNC_INIT = BIT(0),
  73. IWL_CTXT_INFO_EARLY_DEBUG = BIT(1),
  74. IWL_CTXT_INFO_ENABLE_CDMP = BIT(2),
  75. IWL_CTXT_INFO_RB_SIZE_4K = BIT(3),
  76. IWL_CTXT_INFO_RB_CB_SIZE_POS = 4,
  77. IWL_CTXT_INFO_TFD_FORMAT_LONG = BIT(8),
  78. };
  79. /*
  80. * struct iwl_context_info_version - version structure
  81. * @mac_id: SKU and revision id
  82. * @version: context information version id
  83. * @size: the size of the context information in DWs
  84. */
  85. struct iwl_context_info_version {
  86. __le16 mac_id;
  87. __le16 version;
  88. __le16 size;
  89. __le16 reserved;
  90. } __packed;
  91. /*
  92. * struct iwl_context_info_control - version structure
  93. * @control_flags: context information flags see &enum iwl_context_info_flags
  94. */
  95. struct iwl_context_info_control {
  96. __le32 control_flags;
  97. __le32 reserved;
  98. } __packed;
  99. /*
  100. * struct iwl_context_info_dram - images DRAM map
  101. * each entry in the map represents a DRAM chunk of up to 32 KB
  102. * @umac_img: UMAC image DRAM map
  103. * @lmac_img: LMAC image DRAM map
  104. * @virtual_img: paged image DRAM map
  105. */
  106. struct iwl_context_info_dram {
  107. __le64 umac_img[IWL_MAX_DRAM_ENTRY];
  108. __le64 lmac_img[IWL_MAX_DRAM_ENTRY];
  109. __le64 virtual_img[IWL_MAX_DRAM_ENTRY];
  110. } __packed;
  111. /*
  112. * struct iwl_context_info_rbd_cfg - RBDs configuration
  113. * @free_rbd_addr: default queue free RB CB base address
  114. * @used_rbd_addr: default queue used RB CB base address
  115. * @status_wr_ptr: default queue used RB status write pointer
  116. */
  117. struct iwl_context_info_rbd_cfg {
  118. __le64 free_rbd_addr;
  119. __le64 used_rbd_addr;
  120. __le64 status_wr_ptr;
  121. } __packed;
  122. /*
  123. * struct iwl_context_info_hcmd_cfg - command queue configuration
  124. * @cmd_queue_addr: address of command queue
  125. * @cmd_queue_size: number of entries
  126. */
  127. struct iwl_context_info_hcmd_cfg {
  128. __le64 cmd_queue_addr;
  129. u8 cmd_queue_size;
  130. u8 reserved[7];
  131. } __packed;
  132. /*
  133. * struct iwl_context_info_dump_cfg - Core Dump configuration
  134. * @core_dump_addr: core dump (debug DRAM address) start address
  135. * @core_dump_size: size, in DWs
  136. */
  137. struct iwl_context_info_dump_cfg {
  138. __le64 core_dump_addr;
  139. __le32 core_dump_size;
  140. __le32 reserved;
  141. } __packed;
  142. /*
  143. * struct iwl_context_info_pnvm_cfg - platform NVM data configuration
  144. * @platform_nvm_addr: Platform NVM data start address
  145. * @platform_nvm_size: size in DWs
  146. */
  147. struct iwl_context_info_pnvm_cfg {
  148. __le64 platform_nvm_addr;
  149. __le32 platform_nvm_size;
  150. __le32 reserved;
  151. } __packed;
  152. /*
  153. * struct iwl_context_info_early_dbg_cfg - early debug configuration for
  154. * dumping DRAM addresses
  155. * @early_debug_addr: early debug start address
  156. * @early_debug_size: size in DWs
  157. */
  158. struct iwl_context_info_early_dbg_cfg {
  159. __le64 early_debug_addr;
  160. __le32 early_debug_size;
  161. __le32 reserved;
  162. } __packed;
  163. /*
  164. * struct iwl_context_info - device INIT configuration
  165. * @version: version information of context info and HW
  166. * @control: control flags of FH configurations
  167. * @rbd_cfg: default RX queue configuration
  168. * @hcmd_cfg: command queue configuration
  169. * @dump_cfg: core dump data
  170. * @edbg_cfg: early debug configuration
  171. * @pnvm_cfg: platform nvm configuration
  172. * @dram: firmware image addresses in DRAM
  173. */
  174. struct iwl_context_info {
  175. struct iwl_context_info_version version;
  176. struct iwl_context_info_control control;
  177. __le64 reserved0;
  178. struct iwl_context_info_rbd_cfg rbd_cfg;
  179. struct iwl_context_info_hcmd_cfg hcmd_cfg;
  180. __le32 reserved1[4];
  181. struct iwl_context_info_dump_cfg dump_cfg;
  182. struct iwl_context_info_early_dbg_cfg edbg_cfg;
  183. struct iwl_context_info_pnvm_cfg pnvm_cfg;
  184. __le32 reserved2[16];
  185. struct iwl_context_info_dram dram;
  186. __le32 reserved3[16];
  187. } __packed;
  188. int iwl_pcie_ctxt_info_init(struct iwl_trans *trans, const struct fw_img *fw);
  189. void iwl_pcie_ctxt_info_free(struct iwl_trans *trans);
  190. void iwl_pcie_ctxt_info_free_paging(struct iwl_trans *trans);
  191. int iwl_pcie_init_fw_sec(struct iwl_trans *trans,
  192. const struct fw_img *fw,
  193. struct iwl_context_info_dram *ctxt_dram);
  194. #endif /* __iwl_context_info_file_h__ */