iwl-context-info.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
  2. /*
  3. * Copyright (C) 2017 Intel Deutschland GmbH
  4. * Copyright (C) 2018-2020 Intel Corporation
  5. */
  6. #ifndef __iwl_context_info_file_h__
  7. #define __iwl_context_info_file_h__
  8. /* maximmum number of DRAM map entries supported by FW */
  9. #define IWL_MAX_DRAM_ENTRY 64
  10. #define CSR_CTXT_INFO_BA 0x40
  11. /**
  12. * enum iwl_context_info_flags - Context information control flags
  13. * @IWL_CTXT_INFO_AUTO_FUNC_INIT: If set, FW will not wait before interrupting
  14. * the init done for driver command that configures several system modes
  15. * @IWL_CTXT_INFO_EARLY_DEBUG: enable early debug
  16. * @IWL_CTXT_INFO_ENABLE_CDMP: enable core dump
  17. * @IWL_CTXT_INFO_RB_CB_SIZE: mask of the RBD Cyclic Buffer Size
  18. * exponent, the actual size is 2**value, valid sizes are 8-2048.
  19. * The value is four bits long. Maximum valid exponent is 12
  20. * @IWL_CTXT_INFO_TFD_FORMAT_LONG: use long TFD Format (the
  21. * default is short format - not supported by the driver)
  22. * @IWL_CTXT_INFO_RB_SIZE: RB size mask
  23. * (values are IWL_CTXT_INFO_RB_SIZE_*K)
  24. * @IWL_CTXT_INFO_RB_SIZE_1K: Value for 1K RB size
  25. * @IWL_CTXT_INFO_RB_SIZE_2K: Value for 2K RB size
  26. * @IWL_CTXT_INFO_RB_SIZE_4K: Value for 4K RB size
  27. * @IWL_CTXT_INFO_RB_SIZE_8K: Value for 8K RB size
  28. * @IWL_CTXT_INFO_RB_SIZE_12K: Value for 12K RB size
  29. * @IWL_CTXT_INFO_RB_SIZE_16K: Value for 16K RB size
  30. * @IWL_CTXT_INFO_RB_SIZE_20K: Value for 20K RB size
  31. * @IWL_CTXT_INFO_RB_SIZE_24K: Value for 24K RB size
  32. * @IWL_CTXT_INFO_RB_SIZE_28K: Value for 28K RB size
  33. * @IWL_CTXT_INFO_RB_SIZE_32K: Value for 32K RB size
  34. */
  35. enum iwl_context_info_flags {
  36. IWL_CTXT_INFO_AUTO_FUNC_INIT = 0x0001,
  37. IWL_CTXT_INFO_EARLY_DEBUG = 0x0002,
  38. IWL_CTXT_INFO_ENABLE_CDMP = 0x0004,
  39. IWL_CTXT_INFO_RB_CB_SIZE = 0x00f0,
  40. IWL_CTXT_INFO_TFD_FORMAT_LONG = 0x0100,
  41. IWL_CTXT_INFO_RB_SIZE = 0x1e00,
  42. IWL_CTXT_INFO_RB_SIZE_1K = 0x1,
  43. IWL_CTXT_INFO_RB_SIZE_2K = 0x2,
  44. IWL_CTXT_INFO_RB_SIZE_4K = 0x4,
  45. IWL_CTXT_INFO_RB_SIZE_8K = 0x8,
  46. IWL_CTXT_INFO_RB_SIZE_12K = 0x9,
  47. IWL_CTXT_INFO_RB_SIZE_16K = 0xa,
  48. IWL_CTXT_INFO_RB_SIZE_20K = 0xb,
  49. IWL_CTXT_INFO_RB_SIZE_24K = 0xc,
  50. IWL_CTXT_INFO_RB_SIZE_28K = 0xd,
  51. IWL_CTXT_INFO_RB_SIZE_32K = 0xe,
  52. };
  53. /*
  54. * struct iwl_context_info_version - version structure
  55. * @mac_id: SKU and revision id
  56. * @version: context information version id
  57. * @size: the size of the context information in DWs
  58. */
  59. struct iwl_context_info_version {
  60. __le16 mac_id;
  61. __le16 version;
  62. __le16 size;
  63. __le16 reserved;
  64. } __packed;
  65. /*
  66. * struct iwl_context_info_control - version structure
  67. * @control_flags: context information flags see &enum iwl_context_info_flags
  68. */
  69. struct iwl_context_info_control {
  70. __le32 control_flags;
  71. __le32 reserved;
  72. } __packed;
  73. /*
  74. * struct iwl_context_info_dram - images DRAM map
  75. * each entry in the map represents a DRAM chunk of up to 32 KB
  76. * @umac_img: UMAC image DRAM map
  77. * @lmac_img: LMAC image DRAM map
  78. * @virtual_img: paged image DRAM map
  79. */
  80. struct iwl_context_info_dram {
  81. __le64 umac_img[IWL_MAX_DRAM_ENTRY];
  82. __le64 lmac_img[IWL_MAX_DRAM_ENTRY];
  83. __le64 virtual_img[IWL_MAX_DRAM_ENTRY];
  84. } __packed;
  85. /*
  86. * struct iwl_context_info_rbd_cfg - RBDs configuration
  87. * @free_rbd_addr: default queue free RB CB base address
  88. * @used_rbd_addr: default queue used RB CB base address
  89. * @status_wr_ptr: default queue used RB status write pointer
  90. */
  91. struct iwl_context_info_rbd_cfg {
  92. __le64 free_rbd_addr;
  93. __le64 used_rbd_addr;
  94. __le64 status_wr_ptr;
  95. } __packed;
  96. /*
  97. * struct iwl_context_info_hcmd_cfg - command queue configuration
  98. * @cmd_queue_addr: address of command queue
  99. * @cmd_queue_size: number of entries
  100. */
  101. struct iwl_context_info_hcmd_cfg {
  102. __le64 cmd_queue_addr;
  103. u8 cmd_queue_size;
  104. u8 reserved[7];
  105. } __packed;
  106. /*
  107. * struct iwl_context_info_dump_cfg - Core Dump configuration
  108. * @core_dump_addr: core dump (debug DRAM address) start address
  109. * @core_dump_size: size, in DWs
  110. */
  111. struct iwl_context_info_dump_cfg {
  112. __le64 core_dump_addr;
  113. __le32 core_dump_size;
  114. __le32 reserved;
  115. } __packed;
  116. /*
  117. * struct iwl_context_info_pnvm_cfg - platform NVM data configuration
  118. * @platform_nvm_addr: Platform NVM data start address
  119. * @platform_nvm_size: size in DWs
  120. */
  121. struct iwl_context_info_pnvm_cfg {
  122. __le64 platform_nvm_addr;
  123. __le32 platform_nvm_size;
  124. __le32 reserved;
  125. } __packed;
  126. /*
  127. * struct iwl_context_info_early_dbg_cfg - early debug configuration for
  128. * dumping DRAM addresses
  129. * @early_debug_addr: early debug start address
  130. * @early_debug_size: size in DWs
  131. */
  132. struct iwl_context_info_early_dbg_cfg {
  133. __le64 early_debug_addr;
  134. __le32 early_debug_size;
  135. __le32 reserved;
  136. } __packed;
  137. /*
  138. * struct iwl_context_info - device INIT configuration
  139. * @version: version information of context info and HW
  140. * @control: control flags of FH configurations
  141. * @rbd_cfg: default RX queue configuration
  142. * @hcmd_cfg: command queue configuration
  143. * @dump_cfg: core dump data
  144. * @edbg_cfg: early debug configuration
  145. * @pnvm_cfg: platform nvm configuration
  146. * @dram: firmware image addresses in DRAM
  147. */
  148. struct iwl_context_info {
  149. struct iwl_context_info_version version;
  150. struct iwl_context_info_control control;
  151. __le64 reserved0;
  152. struct iwl_context_info_rbd_cfg rbd_cfg;
  153. struct iwl_context_info_hcmd_cfg hcmd_cfg;
  154. __le32 reserved1[4];
  155. struct iwl_context_info_dump_cfg dump_cfg;
  156. struct iwl_context_info_early_dbg_cfg edbg_cfg;
  157. struct iwl_context_info_pnvm_cfg pnvm_cfg;
  158. __le32 reserved2[16];
  159. struct iwl_context_info_dram dram;
  160. __le32 reserved3[16];
  161. } __packed;
  162. int iwl_pcie_ctxt_info_init(struct iwl_trans *trans, const struct fw_img *fw);
  163. void iwl_pcie_ctxt_info_free(struct iwl_trans *trans);
  164. void iwl_pcie_ctxt_info_free_paging(struct iwl_trans *trans);
  165. int iwl_pcie_init_fw_sec(struct iwl_trans *trans,
  166. const struct fw_img *fw,
  167. struct iwl_context_info_dram *ctxt_dram);
  168. int iwl_pcie_ctxt_info_alloc_dma(struct iwl_trans *trans,
  169. const void *data, u32 len,
  170. struct iwl_dram_data *dram);
  171. #endif /* __iwl_context_info_file_h__ */