iwl-fw-error-dump.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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) 2014 Intel Corporation. All rights reserved.
  9. * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
  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. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  23. * USA
  24. *
  25. * The full GNU General Public License is included in this distribution
  26. * in the file called COPYING.
  27. *
  28. * Contact Information:
  29. * Intel Linux Wireless <linuxwifi@intel.com>
  30. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  31. *
  32. * BSD LICENSE
  33. *
  34. * Copyright(c) 2014 Intel Corporation. All rights reserved.
  35. * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
  36. * All rights reserved.
  37. *
  38. * Redistribution and use in source and binary forms, with or without
  39. * modification, are permitted provided that the following conditions
  40. * are met:
  41. *
  42. * * Redistributions of source code must retain the above copyright
  43. * notice, this list of conditions and the following disclaimer.
  44. * * Redistributions in binary form must reproduce the above copyright
  45. * notice, this list of conditions and the following disclaimer in
  46. * the documentation and/or other materials provided with the
  47. * distribution.
  48. * * Neither the name Intel Corporation nor the names of its
  49. * contributors may be used to endorse or promote products derived
  50. * from this software without specific prior written permission.
  51. *
  52. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  53. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  54. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  55. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  56. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  57. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  58. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  59. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  60. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  61. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  62. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  63. *****************************************************************************/
  64. #ifndef __fw_error_dump_h__
  65. #define __fw_error_dump_h__
  66. #include <linux/types.h>
  67. #define IWL_FW_ERROR_DUMP_BARKER 0x14789632
  68. /**
  69. * enum iwl_fw_error_dump_type - types of data in the dump file
  70. * @IWL_FW_ERROR_DUMP_CSR: Control Status Registers - from offset 0
  71. * @IWL_FW_ERROR_DUMP_RXF:
  72. * @IWL_FW_ERROR_DUMP_TXCMD: last TX command data, structured as
  73. * &struct iwl_fw_error_dump_txcmd packets
  74. * @IWL_FW_ERROR_DUMP_DEV_FW_INFO: struct %iwl_fw_error_dump_info
  75. * info on the device / firmware.
  76. * @IWL_FW_ERROR_DUMP_FW_MONITOR: firmware monitor
  77. * @IWL_FW_ERROR_DUMP_PRPH: range of periphery registers - there can be several
  78. * sections like this in a single file.
  79. * @IWL_FW_ERROR_DUMP_FH_REGS: range of FH registers
  80. * @IWL_FW_ERROR_DUMP_MEM: chunk of memory
  81. * @IWL_FW_ERROR_DUMP_ERROR_INFO: description of what triggered this dump.
  82. * Structured as &struct iwl_fw_error_dump_trigger_desc.
  83. * @IWL_FW_ERROR_DUMP_RB: the content of an RB structured as
  84. * &struct iwl_fw_error_dump_rb
  85. * @IWL_FW_ERROR_PAGING: UMAC's image memory segments which were
  86. * paged to the DRAM.
  87. * @IWL_FW_ERROR_DUMP_RADIO_REG: Dump the radio registers.
  88. */
  89. enum iwl_fw_error_dump_type {
  90. /* 0 is deprecated */
  91. IWL_FW_ERROR_DUMP_CSR = 1,
  92. IWL_FW_ERROR_DUMP_RXF = 2,
  93. IWL_FW_ERROR_DUMP_TXCMD = 3,
  94. IWL_FW_ERROR_DUMP_DEV_FW_INFO = 4,
  95. IWL_FW_ERROR_DUMP_FW_MONITOR = 5,
  96. IWL_FW_ERROR_DUMP_PRPH = 6,
  97. IWL_FW_ERROR_DUMP_TXF = 7,
  98. IWL_FW_ERROR_DUMP_FH_REGS = 8,
  99. IWL_FW_ERROR_DUMP_MEM = 9,
  100. IWL_FW_ERROR_DUMP_ERROR_INFO = 10,
  101. IWL_FW_ERROR_DUMP_RB = 11,
  102. IWL_FW_ERROR_DUMP_PAGING = 12,
  103. IWL_FW_ERROR_DUMP_RADIO_REG = 13,
  104. IWL_FW_ERROR_DUMP_MAX,
  105. };
  106. /**
  107. * struct iwl_fw_error_dump_data - data for one type
  108. * @type: %enum iwl_fw_error_dump_type
  109. * @len: the length starting from %data
  110. * @data: the data itself
  111. */
  112. struct iwl_fw_error_dump_data {
  113. __le32 type;
  114. __le32 len;
  115. __u8 data[];
  116. } __packed;
  117. /**
  118. * struct iwl_fw_error_dump_file - the layout of the header of the file
  119. * @barker: must be %IWL_FW_ERROR_DUMP_BARKER
  120. * @file_len: the length of all the file starting from %barker
  121. * @data: array of %struct iwl_fw_error_dump_data
  122. */
  123. struct iwl_fw_error_dump_file {
  124. __le32 barker;
  125. __le32 file_len;
  126. u8 data[0];
  127. } __packed;
  128. /**
  129. * struct iwl_fw_error_dump_txcmd - TX command data
  130. * @cmdlen: original length of command
  131. * @caplen: captured length of command (may be less)
  132. * @data: captured command data, @caplen bytes
  133. */
  134. struct iwl_fw_error_dump_txcmd {
  135. __le32 cmdlen;
  136. __le32 caplen;
  137. u8 data[];
  138. } __packed;
  139. /**
  140. * struct iwl_fw_error_dump_fifo - RX/TX FIFO data
  141. * @fifo_num: number of FIFO (starting from 0)
  142. * @available_bytes: num of bytes available in FIFO (may be less than FIFO size)
  143. * @wr_ptr: position of write pointer
  144. * @rd_ptr: position of read pointer
  145. * @fence_ptr: position of fence pointer
  146. * @fence_mode: the current mode of the fence (before locking) -
  147. * 0=follow RD pointer ; 1 = freeze
  148. * @data: all of the FIFO's data
  149. */
  150. struct iwl_fw_error_dump_fifo {
  151. __le32 fifo_num;
  152. __le32 available_bytes;
  153. __le32 wr_ptr;
  154. __le32 rd_ptr;
  155. __le32 fence_ptr;
  156. __le32 fence_mode;
  157. u8 data[];
  158. } __packed;
  159. enum iwl_fw_error_dump_family {
  160. IWL_FW_ERROR_DUMP_FAMILY_7 = 7,
  161. IWL_FW_ERROR_DUMP_FAMILY_8 = 8,
  162. };
  163. /**
  164. * struct iwl_fw_error_dump_info - info on the device / firmware
  165. * @device_family: the family of the device (7 / 8)
  166. * @hw_step: the step of the device
  167. * @fw_human_readable: human readable FW version
  168. * @dev_human_readable: name of the device
  169. * @bus_human_readable: name of the bus used
  170. */
  171. struct iwl_fw_error_dump_info {
  172. __le32 device_family;
  173. __le32 hw_step;
  174. u8 fw_human_readable[FW_VER_HUMAN_READABLE_SZ];
  175. u8 dev_human_readable[64];
  176. u8 bus_human_readable[8];
  177. } __packed;
  178. /**
  179. * struct iwl_fw_error_dump_fw_mon - FW monitor data
  180. * @fw_mon_wr_ptr: the position of the write pointer in the cyclic buffer
  181. * @fw_mon_base_ptr: base pointer of the data
  182. * @fw_mon_cycle_cnt: number of wraparounds
  183. * @reserved: for future use
  184. * @data: captured data
  185. */
  186. struct iwl_fw_error_dump_fw_mon {
  187. __le32 fw_mon_wr_ptr;
  188. __le32 fw_mon_base_ptr;
  189. __le32 fw_mon_cycle_cnt;
  190. __le32 reserved[3];
  191. u8 data[];
  192. } __packed;
  193. /**
  194. * struct iwl_fw_error_dump_prph - periphery registers data
  195. * @prph_start: address of the first register in this chunk
  196. * @data: the content of the registers
  197. */
  198. struct iwl_fw_error_dump_prph {
  199. __le32 prph_start;
  200. __le32 data[];
  201. };
  202. enum iwl_fw_error_dump_mem_type {
  203. IWL_FW_ERROR_DUMP_MEM_SRAM,
  204. IWL_FW_ERROR_DUMP_MEM_SMEM,
  205. };
  206. /**
  207. * struct iwl_fw_error_dump_mem - chunk of memory
  208. * @type: %enum iwl_fw_error_dump_mem_type
  209. * @offset: the offset from which the memory was read
  210. * @data: the content of the memory
  211. */
  212. struct iwl_fw_error_dump_mem {
  213. __le32 type;
  214. __le32 offset;
  215. u8 data[];
  216. };
  217. /**
  218. * struct iwl_fw_error_dump_rb - content of an Receive Buffer
  219. * @index: the index of the Receive Buffer in the Rx queue
  220. * @rxq: the RB's Rx queue
  221. * @reserved:
  222. * @data: the content of the Receive Buffer
  223. */
  224. struct iwl_fw_error_dump_rb {
  225. __le32 index;
  226. __le32 rxq;
  227. __le32 reserved;
  228. u8 data[];
  229. };
  230. /**
  231. * struct iwl_fw_error_dump_paging - content of the UMAC's image page
  232. * block on DRAM
  233. * @index: the index of the page block
  234. * @reserved:
  235. * @data: the content of the page block
  236. */
  237. struct iwl_fw_error_dump_paging {
  238. __le32 index;
  239. __le32 reserved;
  240. u8 data[];
  241. };
  242. /**
  243. * iwl_fw_error_next_data - advance fw error dump data pointer
  244. * @data: previous data block
  245. * Returns: next data block
  246. */
  247. static inline struct iwl_fw_error_dump_data *
  248. iwl_fw_error_next_data(struct iwl_fw_error_dump_data *data)
  249. {
  250. return (void *)(data->data + le32_to_cpu(data->len));
  251. }
  252. /**
  253. * enum iwl_fw_dbg_trigger - triggers available
  254. *
  255. * @FW_DBG_TRIGGER_USER: trigger log collection by user
  256. * This should not be defined as a trigger to the driver, but a value the
  257. * driver should set to indicate that the trigger was initiated by the
  258. * user.
  259. * @FW_DBG_TRIGGER_FW_ASSERT: trigger log collection when the firmware asserts
  260. * @FW_DBG_TRIGGER_MISSED_BEACONS: trigger log collection when beacons are
  261. * missed.
  262. * @FW_DBG_TRIGGER_CHANNEL_SWITCH: trigger log collection upon channel switch.
  263. * @FW_DBG_TRIGGER_FW_NOTIF: trigger log collection when the firmware sends a
  264. * command response or a notification.
  265. * @FW_DBG_TRIGGER_MLME: trigger log collection upon MLME event.
  266. * @FW_DBG_TRIGGER_STATS: trigger log collection upon statistics threshold.
  267. * @FW_DBG_TRIGGER_RSSI: trigger log collection when the rssi of the beacon
  268. * goes below a threshold.
  269. * @FW_DBG_TRIGGER_TXQ_TIMERS: configures the timers for the Tx queue hang
  270. * detection.
  271. * @FW_DBG_TRIGGER_TIME_EVENT: trigger log collection upon time events related
  272. * events.
  273. * @FW_DBG_TRIGGER_BA: trigger log collection upon BlockAck related events.
  274. * @FW_DBG_TX_LATENCY: trigger log collection when the tx latency goes above a
  275. * threshold.
  276. * @FW_DBG_TDLS: trigger log collection upon TDLS related events.
  277. * @FW_DBG_TRIGGER_TX_STATUS: trigger log collection upon tx status when
  278. * the firmware sends a tx reply.
  279. */
  280. enum iwl_fw_dbg_trigger {
  281. FW_DBG_TRIGGER_INVALID = 0,
  282. FW_DBG_TRIGGER_USER,
  283. FW_DBG_TRIGGER_FW_ASSERT,
  284. FW_DBG_TRIGGER_MISSED_BEACONS,
  285. FW_DBG_TRIGGER_CHANNEL_SWITCH,
  286. FW_DBG_TRIGGER_FW_NOTIF,
  287. FW_DBG_TRIGGER_MLME,
  288. FW_DBG_TRIGGER_STATS,
  289. FW_DBG_TRIGGER_RSSI,
  290. FW_DBG_TRIGGER_TXQ_TIMERS,
  291. FW_DBG_TRIGGER_TIME_EVENT,
  292. FW_DBG_TRIGGER_BA,
  293. FW_DBG_TRIGGER_TX_LATENCY,
  294. FW_DBG_TRIGGER_TDLS,
  295. FW_DBG_TRIGGER_TX_STATUS,
  296. /* must be last */
  297. FW_DBG_TRIGGER_MAX,
  298. };
  299. /**
  300. * struct iwl_fw_error_dump_trigger_desc - describes the trigger condition
  301. * @type: %enum iwl_fw_dbg_trigger
  302. * @data: raw data about what happened
  303. */
  304. struct iwl_fw_error_dump_trigger_desc {
  305. __le32 type;
  306. u8 data[];
  307. };
  308. #endif /* __fw_error_dump_h__ */