blob: 420c31dab26373b0f05cb50c7c9b0143171c6f4a [file] [log] [blame]
Emmanuel Grumbach1bd3cbc2014-03-18 21:15:06 +02001/******************************************************************************
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.
Emmanuel Grumbach42032632015-04-15 12:43:46 +03009 * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
Emmanuel Grumbach1bd3cbc2014-03-18 21:15:06 +020010 *
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:
Emmanuel Grumbachd01c5362015-11-17 15:39:56 +020029 * Intel Linux Wireless <linuxwifi@intel.com>
Emmanuel Grumbach1bd3cbc2014-03-18 21:15:06 +020030 * 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.
Emmanuel Grumbach42032632015-04-15 12:43:46 +030035 * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
Emmanuel Grumbach1bd3cbc2014-03-18 21:15:06 +020036 * 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
65#ifndef __fw_error_dump_h__
66#define __fw_error_dump_h__
67
68#include <linux/types.h>
69
70#define IWL_FW_ERROR_DUMP_BARKER 0x14789632
71
72/**
73 * enum iwl_fw_error_dump_type - types of data in the dump file
Emmanuel Grumbach473ad712014-07-08 19:44:25 +030074 * @IWL_FW_ERROR_DUMP_CSR: Control Status Registers - from offset 0
Emmanuel Grumbach7b445f32014-03-20 11:08:19 +020075 * @IWL_FW_ERROR_DUMP_RXF:
Johannes Berg4d075002014-04-24 10:41:31 +020076 * @IWL_FW_ERROR_DUMP_TXCMD: last TX command data, structured as
77 * &struct iwl_fw_error_dump_txcmd packets
Emmanuel Grumbach06ddbf52014-06-02 08:34:53 +030078 * @IWL_FW_ERROR_DUMP_DEV_FW_INFO: struct %iwl_fw_error_dump_info
79 * info on the device / firmware.
Emmanuel Grumbachc2d20202014-06-01 08:05:52 +030080 * @IWL_FW_ERROR_DUMP_FW_MONITOR: firmware monitor
Emmanuel Grumbach67c65f22014-06-26 11:27:51 +030081 * @IWL_FW_ERROR_DUMP_PRPH: range of periphery registers - there can be several
82 * sections like this in a single file.
Liad Kaufman06d51e02014-11-23 13:56:21 +020083 * @IWL_FW_ERROR_DUMP_FH_REGS: range of FH registers
Emmanuel Grumbache06d8432014-12-09 14:36:41 +020084 * @IWL_FW_ERROR_DUMP_MEM: chunk of memory
Emmanuel Grumbachb6eaa452015-01-29 14:58:20 +020085 * @IWL_FW_ERROR_DUMP_ERROR_INFO: description of what triggered this dump.
86 * Structured as &struct iwl_fw_error_dump_trigger_desc.
Emmanuel Grumbachbd7fc612015-07-15 23:15:08 +030087 * @IWL_FW_ERROR_DUMP_RB: the content of an RB structured as
88 * &struct iwl_fw_error_dump_rb
Matti Gottliebf0afea52015-07-20 17:55:51 +030089 * @IWL_FW_ERROR_PAGING: UMAC's image memory segments which were
90 * paged to the DRAM.
Emmanuel Grumbach976f15a2015-12-28 15:22:28 +020091 * @IWL_FW_ERROR_DUMP_RADIO_REG: Dump the radio registers.
Golan Ben-Ami9c07e9a2016-05-19 07:46:20 +030092 * @IWL_FW_ERROR_DUMP_EXTERNAL: used only by external code utilities, and
93 * for that reason is not in use in any other place in the Linux Wi-Fi
94 * stack.
Emmanuel Grumbach1bd3cbc2014-03-18 21:15:06 +020095 */
96enum iwl_fw_error_dump_type {
Emmanuel Grumbacha549b292014-12-09 14:47:57 +020097 /* 0 is deprecated */
Emmanuel Grumbach473ad712014-07-08 19:44:25 +030098 IWL_FW_ERROR_DUMP_CSR = 1,
Emmanuel Grumbach7b445f32014-03-20 11:08:19 +020099 IWL_FW_ERROR_DUMP_RXF = 2,
Johannes Berg4d075002014-04-24 10:41:31 +0200100 IWL_FW_ERROR_DUMP_TXCMD = 3,
Emmanuel Grumbach06ddbf52014-06-02 08:34:53 +0300101 IWL_FW_ERROR_DUMP_DEV_FW_INFO = 4,
Emmanuel Grumbachc2d20202014-06-01 08:05:52 +0300102 IWL_FW_ERROR_DUMP_FW_MONITOR = 5,
Emmanuel Grumbach67c65f22014-06-26 11:27:51 +0300103 IWL_FW_ERROR_DUMP_PRPH = 6,
Liad Kaufman06d51e02014-11-23 13:56:21 +0200104 IWL_FW_ERROR_DUMP_TXF = 7,
105 IWL_FW_ERROR_DUMP_FH_REGS = 8,
Emmanuel Grumbache06d8432014-12-09 14:36:41 +0200106 IWL_FW_ERROR_DUMP_MEM = 9,
Emmanuel Grumbachb6eaa452015-01-29 14:58:20 +0200107 IWL_FW_ERROR_DUMP_ERROR_INFO = 10,
Emmanuel Grumbachbd7fc612015-07-15 23:15:08 +0300108 IWL_FW_ERROR_DUMP_RB = 11,
Matti Gottliebf0afea52015-07-20 17:55:51 +0300109 IWL_FW_ERROR_DUMP_PAGING = 12,
Emmanuel Grumbach976f15a2015-12-28 15:22:28 +0200110 IWL_FW_ERROR_DUMP_RADIO_REG = 13,
Golan Ben-Ami5b086412016-02-09 12:57:16 +0200111 IWL_FW_ERROR_DUMP_INTERNAL_TXF = 14,
Golan Ben-Ami9c07e9a2016-05-19 07:46:20 +0300112 IWL_FW_ERROR_DUMP_EXTERNAL = 15, /* Do not move */
Emmanuel Grumbach1bd3cbc2014-03-18 21:15:06 +0200113
114 IWL_FW_ERROR_DUMP_MAX,
115};
116
117/**
118 * struct iwl_fw_error_dump_data - data for one type
119 * @type: %enum iwl_fw_error_dump_type
Emmanuel Grumbachd4849272014-06-24 14:34:28 +0300120 * @len: the length starting from %data
121 * @data: the data itself
Emmanuel Grumbach1bd3cbc2014-03-18 21:15:06 +0200122 */
123struct iwl_fw_error_dump_data {
124 __le32 type;
125 __le32 len;
126 __u8 data[];
Emmanuel Grumbach7b445f32014-03-20 11:08:19 +0200127} __packed;
Emmanuel Grumbach1bd3cbc2014-03-18 21:15:06 +0200128
129/**
130 * struct iwl_fw_error_dump_file - the layout of the header of the file
131 * @barker: must be %IWL_FW_ERROR_DUMP_BARKER
132 * @file_len: the length of all the file starting from %barker
133 * @data: array of %struct iwl_fw_error_dump_data
134 */
135struct iwl_fw_error_dump_file {
136 __le32 barker;
137 __le32 file_len;
138 u8 data[0];
Emmanuel Grumbach7b445f32014-03-20 11:08:19 +0200139} __packed;
Emmanuel Grumbach1bd3cbc2014-03-18 21:15:06 +0200140
Johannes Berg4d075002014-04-24 10:41:31 +0200141/**
142 * struct iwl_fw_error_dump_txcmd - TX command data
143 * @cmdlen: original length of command
144 * @caplen: captured length of command (may be less)
145 * @data: captured command data, @caplen bytes
146 */
147struct iwl_fw_error_dump_txcmd {
148 __le32 cmdlen;
149 __le32 caplen;
150 u8 data[];
151} __packed;
152
Liad Kaufman04fd2c22014-12-15 17:54:16 +0200153/**
154 * struct iwl_fw_error_dump_fifo - RX/TX FIFO data
155 * @fifo_num: number of FIFO (starting from 0)
156 * @available_bytes: num of bytes available in FIFO (may be less than FIFO size)
157 * @wr_ptr: position of write pointer
158 * @rd_ptr: position of read pointer
159 * @fence_ptr: position of fence pointer
160 * @fence_mode: the current mode of the fence (before locking) -
161 * 0=follow RD pointer ; 1 = freeze
162 * @data: all of the FIFO's data
163 */
164struct iwl_fw_error_dump_fifo {
165 __le32 fifo_num;
166 __le32 available_bytes;
167 __le32 wr_ptr;
168 __le32 rd_ptr;
169 __le32 fence_ptr;
170 __le32 fence_mode;
171 u8 data[];
172} __packed;
173
Emmanuel Grumbach06ddbf52014-06-02 08:34:53 +0300174enum iwl_fw_error_dump_family {
175 IWL_FW_ERROR_DUMP_FAMILY_7 = 7,
176 IWL_FW_ERROR_DUMP_FAMILY_8 = 8,
177};
178
179/**
180 * struct iwl_fw_error_dump_info - info on the device / firmware
181 * @device_family: the family of the device (7 / 8)
182 * @hw_step: the step of the device
183 * @fw_human_readable: human readable FW version
184 * @dev_human_readable: name of the device
185 * @bus_human_readable: name of the bus used
186 */
187struct iwl_fw_error_dump_info {
188 __le32 device_family;
189 __le32 hw_step;
190 u8 fw_human_readable[FW_VER_HUMAN_READABLE_SZ];
191 u8 dev_human_readable[64];
192 u8 bus_human_readable[8];
193} __packed;
194
Johannes Berg4d075002014-04-24 10:41:31 +0200195/**
Emmanuel Grumbachc544e9c2014-06-26 09:54:23 +0300196 * struct iwl_fw_error_dump_fw_mon - FW monitor data
Emmanuel Grumbachc2d20202014-06-01 08:05:52 +0300197 * @fw_mon_wr_ptr: the position of the write pointer in the cyclic buffer
198 * @fw_mon_base_ptr: base pointer of the data
Sara Sharon0d365ae2015-03-31 12:24:05 +0300199 * @fw_mon_cycle_cnt: number of wraparounds
Emmanuel Grumbachc2d20202014-06-01 08:05:52 +0300200 * @reserved: for future use
201 * @data: captured data
202 */
Emmanuel Grumbachc544e9c2014-06-26 09:54:23 +0300203struct iwl_fw_error_dump_fw_mon {
Emmanuel Grumbachc2d20202014-06-01 08:05:52 +0300204 __le32 fw_mon_wr_ptr;
205 __le32 fw_mon_base_ptr;
206 __le32 fw_mon_cycle_cnt;
207 __le32 reserved[3];
208 u8 data[];
209} __packed;
210
211/**
Emmanuel Grumbach67c65f22014-06-26 11:27:51 +0300212 * struct iwl_fw_error_dump_prph - periphery registers data
213 * @prph_start: address of the first register in this chunk
214 * @data: the content of the registers
215 */
216struct iwl_fw_error_dump_prph {
217 __le32 prph_start;
218 __le32 data[];
219};
220
Emmanuel Grumbache06d8432014-12-09 14:36:41 +0200221enum iwl_fw_error_dump_mem_type {
222 IWL_FW_ERROR_DUMP_MEM_SRAM,
223 IWL_FW_ERROR_DUMP_MEM_SMEM,
224};
225
226/**
227 * struct iwl_fw_error_dump_mem - chunk of memory
228 * @type: %enum iwl_fw_error_dump_mem_type
229 * @offset: the offset from which the memory was read
230 * @data: the content of the memory
231 */
232struct iwl_fw_error_dump_mem {
233 __le32 type;
234 __le32 offset;
235 u8 data[];
236};
237
Emmanuel Grumbach67c65f22014-06-26 11:27:51 +0300238/**
Emmanuel Grumbachbd7fc612015-07-15 23:15:08 +0300239 * struct iwl_fw_error_dump_rb - content of an Receive Buffer
240 * @index: the index of the Receive Buffer in the Rx queue
241 * @rxq: the RB's Rx queue
242 * @reserved:
243 * @data: the content of the Receive Buffer
244 */
245struct iwl_fw_error_dump_rb {
246 __le32 index;
247 __le32 rxq;
248 __le32 reserved;
249 u8 data[];
250};
251
252/**
Matti Gottliebf0afea52015-07-20 17:55:51 +0300253 * struct iwl_fw_error_dump_paging - content of the UMAC's image page
254 * block on DRAM
255 * @index: the index of the page block
256 * @reserved:
257 * @data: the content of the page block
258 */
259struct iwl_fw_error_dump_paging {
260 __le32 index;
261 __le32 reserved;
262 u8 data[];
263};
264
265/**
Emmanuel Grumbach1fa16052014-06-05 13:50:31 +0300266 * iwl_fw_error_next_data - advance fw error dump data pointer
Johannes Berg4d075002014-04-24 10:41:31 +0200267 * @data: previous data block
268 * Returns: next data block
269 */
270static inline struct iwl_fw_error_dump_data *
Emmanuel Grumbach1fa16052014-06-05 13:50:31 +0300271iwl_fw_error_next_data(struct iwl_fw_error_dump_data *data)
Johannes Berg4d075002014-04-24 10:41:31 +0200272{
273 return (void *)(data->data + le32_to_cpu(data->len));
274}
275
Emmanuel Grumbachd2709ad2015-01-29 14:58:06 +0200276/**
277 * enum iwl_fw_dbg_trigger - triggers available
278 *
279 * @FW_DBG_TRIGGER_USER: trigger log collection by user
280 * This should not be defined as a trigger to the driver, but a value the
281 * driver should set to indicate that the trigger was initiated by the
282 * user.
283 * @FW_DBG_TRIGGER_FW_ASSERT: trigger log collection when the firmware asserts
Emmanuel Grumbach9d761fd2015-02-02 12:44:23 +0200284 * @FW_DBG_TRIGGER_MISSED_BEACONS: trigger log collection when beacons are
285 * missed.
Emmanuel Grumbachf35d9c52015-02-10 10:49:51 +0200286 * @FW_DBG_TRIGGER_CHANNEL_SWITCH: trigger log collection upon channel switch.
Emmanuel Grumbach917f39b2015-02-10 10:49:20 +0200287 * @FW_DBG_TRIGGER_FW_NOTIF: trigger log collection when the firmware sends a
288 * command response or a notification.
Emmanuel Grumbachd42f5352015-02-10 14:29:48 +0200289 * @FW_DBG_TRIGGER_MLME: trigger log collection upon MLME event.
Emmanuel Grumbach5a756c22015-02-10 15:26:57 +0200290 * @FW_DBG_TRIGGER_STATS: trigger log collection upon statistics threshold.
Emmanuel Grumbach3ec50b5e2015-02-03 14:29:36 +0200291 * @FW_DBG_TRIGGER_RSSI: trigger log collection when the rssi of the beacon
292 * goes below a threshold.
Emmanuel Grumbach5d42e7b2015-03-19 20:04:51 +0200293 * @FW_DBG_TRIGGER_TXQ_TIMERS: configures the timers for the Tx queue hang
294 * detection.
Emmanuel Grumbach874c1742015-03-25 22:40:47 +0200295 * @FW_DBG_TRIGGER_TIME_EVENT: trigger log collection upon time events related
296 * events.
Emmanuel Grumbach42032632015-04-15 12:43:46 +0300297 * @FW_DBG_TRIGGER_BA: trigger log collection upon BlockAck related events.
Golan Ben-Ami1e8f1322015-08-23 17:57:33 +0300298 * @FW_DBG_TX_LATENCY: trigger log collection when the tx latency goes above a
299 * threshold.
300 * @FW_DBG_TDLS: trigger log collection upon TDLS related events.
Golan Ben-Ami25657fe2015-09-02 12:34:23 +0300301 * @FW_DBG_TRIGGER_TX_STATUS: trigger log collection upon tx status when
302 * the firmware sends a tx reply.
Emmanuel Grumbachd2709ad2015-01-29 14:58:06 +0200303 */
304enum iwl_fw_dbg_trigger {
305 FW_DBG_TRIGGER_INVALID = 0,
306 FW_DBG_TRIGGER_USER,
307 FW_DBG_TRIGGER_FW_ASSERT,
Emmanuel Grumbach9d761fd2015-02-02 12:44:23 +0200308 FW_DBG_TRIGGER_MISSED_BEACONS,
Emmanuel Grumbachf35d9c52015-02-10 10:49:51 +0200309 FW_DBG_TRIGGER_CHANNEL_SWITCH,
Emmanuel Grumbach917f39b2015-02-10 10:49:20 +0200310 FW_DBG_TRIGGER_FW_NOTIF,
Emmanuel Grumbachd42f5352015-02-10 14:29:48 +0200311 FW_DBG_TRIGGER_MLME,
Emmanuel Grumbach5a756c22015-02-10 15:26:57 +0200312 FW_DBG_TRIGGER_STATS,
Emmanuel Grumbach3ec50b5e2015-02-03 14:29:36 +0200313 FW_DBG_TRIGGER_RSSI,
Emmanuel Grumbach5d42e7b2015-03-19 20:04:51 +0200314 FW_DBG_TRIGGER_TXQ_TIMERS,
Emmanuel Grumbach874c1742015-03-25 22:40:47 +0200315 FW_DBG_TRIGGER_TIME_EVENT,
Emmanuel Grumbach42032632015-04-15 12:43:46 +0300316 FW_DBG_TRIGGER_BA,
Golan Ben-Ami1e8f1322015-08-23 17:57:33 +0300317 FW_DBG_TRIGGER_TX_LATENCY,
318 FW_DBG_TRIGGER_TDLS,
Golan Ben-Ami25657fe2015-09-02 12:34:23 +0300319 FW_DBG_TRIGGER_TX_STATUS,
Emmanuel Grumbachd2709ad2015-01-29 14:58:06 +0200320
321 /* must be last */
322 FW_DBG_TRIGGER_MAX,
323};
324
Emmanuel Grumbachb6eaa452015-01-29 14:58:20 +0200325/**
326 * struct iwl_fw_error_dump_trigger_desc - describes the trigger condition
327 * @type: %enum iwl_fw_dbg_trigger
328 * @data: raw data about what happened
329 */
330struct iwl_fw_error_dump_trigger_desc {
331 __le32 type;
332 u8 data[];
333};
334
Emmanuel Grumbach1bd3cbc2014-03-18 21:15:06 +0200335#endif /* __fw_error_dump_h__ */