iwl-context-info.h 6.9 KB

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