iwlwifi: mvm: support dumping UMAC internal txfifos
[deliverable/linux.git] / drivers / net / wireless / intel / iwlwifi / iwl-fw-error-dump.h
CommitLineData
1bd3cbc1
EG
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.
4203263d 9 * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
1bd3cbc1
EG
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:
d01c5366 29 * Intel Linux Wireless <linuxwifi@intel.com>
1bd3cbc1
EG
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.
4203263d 35 * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
1bd3cbc1
EG
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
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
473ad712 74 * @IWL_FW_ERROR_DUMP_CSR: Control Status Registers - from offset 0
7b445f35 75 * @IWL_FW_ERROR_DUMP_RXF:
4d075007
JB
76 * @IWL_FW_ERROR_DUMP_TXCMD: last TX command data, structured as
77 * &struct iwl_fw_error_dump_txcmd packets
06ddbf5a
EG
78 * @IWL_FW_ERROR_DUMP_DEV_FW_INFO: struct %iwl_fw_error_dump_info
79 * info on the device / firmware.
c2d20201 80 * @IWL_FW_ERROR_DUMP_FW_MONITOR: firmware monitor
67c65f2c
EG
81 * @IWL_FW_ERROR_DUMP_PRPH: range of periphery registers - there can be several
82 * sections like this in a single file.
06d51e0d 83 * @IWL_FW_ERROR_DUMP_FH_REGS: range of FH registers
e06d8437 84 * @IWL_FW_ERROR_DUMP_MEM: chunk of memory
b6eaa45a
EG
85 * @IWL_FW_ERROR_DUMP_ERROR_INFO: description of what triggered this dump.
86 * Structured as &struct iwl_fw_error_dump_trigger_desc.
bd7fc617
EG
87 * @IWL_FW_ERROR_DUMP_RB: the content of an RB structured as
88 * &struct iwl_fw_error_dump_rb
f0afea54
MG
89 * @IWL_FW_ERROR_PAGING: UMAC's image memory segments which were
90 * paged to the DRAM.
976f15a8 91 * @IWL_FW_ERROR_DUMP_RADIO_REG: Dump the radio registers.
1bd3cbc1
EG
92 */
93enum iwl_fw_error_dump_type {
a549b296 94 /* 0 is deprecated */
473ad712 95 IWL_FW_ERROR_DUMP_CSR = 1,
7b445f35 96 IWL_FW_ERROR_DUMP_RXF = 2,
4d075007 97 IWL_FW_ERROR_DUMP_TXCMD = 3,
06ddbf5a 98 IWL_FW_ERROR_DUMP_DEV_FW_INFO = 4,
c2d20201 99 IWL_FW_ERROR_DUMP_FW_MONITOR = 5,
67c65f2c 100 IWL_FW_ERROR_DUMP_PRPH = 6,
06d51e0d
LK
101 IWL_FW_ERROR_DUMP_TXF = 7,
102 IWL_FW_ERROR_DUMP_FH_REGS = 8,
e06d8437 103 IWL_FW_ERROR_DUMP_MEM = 9,
b6eaa45a 104 IWL_FW_ERROR_DUMP_ERROR_INFO = 10,
bd7fc617 105 IWL_FW_ERROR_DUMP_RB = 11,
f0afea54 106 IWL_FW_ERROR_DUMP_PAGING = 12,
976f15a8 107 IWL_FW_ERROR_DUMP_RADIO_REG = 13,
5b086414 108 IWL_FW_ERROR_DUMP_INTERNAL_TXF = 14,
1bd3cbc1
EG
109
110 IWL_FW_ERROR_DUMP_MAX,
111};
112
113/**
114 * struct iwl_fw_error_dump_data - data for one type
115 * @type: %enum iwl_fw_error_dump_type
d4849277
EG
116 * @len: the length starting from %data
117 * @data: the data itself
1bd3cbc1
EG
118 */
119struct iwl_fw_error_dump_data {
120 __le32 type;
121 __le32 len;
122 __u8 data[];
7b445f35 123} __packed;
1bd3cbc1
EG
124
125/**
126 * struct iwl_fw_error_dump_file - the layout of the header of the file
127 * @barker: must be %IWL_FW_ERROR_DUMP_BARKER
128 * @file_len: the length of all the file starting from %barker
129 * @data: array of %struct iwl_fw_error_dump_data
130 */
131struct iwl_fw_error_dump_file {
132 __le32 barker;
133 __le32 file_len;
134 u8 data[0];
7b445f35 135} __packed;
1bd3cbc1 136
4d075007
JB
137/**
138 * struct iwl_fw_error_dump_txcmd - TX command data
139 * @cmdlen: original length of command
140 * @caplen: captured length of command (may be less)
141 * @data: captured command data, @caplen bytes
142 */
143struct iwl_fw_error_dump_txcmd {
144 __le32 cmdlen;
145 __le32 caplen;
146 u8 data[];
147} __packed;
148
04fd2c28
LK
149/**
150 * struct iwl_fw_error_dump_fifo - RX/TX FIFO data
151 * @fifo_num: number of FIFO (starting from 0)
152 * @available_bytes: num of bytes available in FIFO (may be less than FIFO size)
153 * @wr_ptr: position of write pointer
154 * @rd_ptr: position of read pointer
155 * @fence_ptr: position of fence pointer
156 * @fence_mode: the current mode of the fence (before locking) -
157 * 0=follow RD pointer ; 1 = freeze
158 * @data: all of the FIFO's data
159 */
160struct iwl_fw_error_dump_fifo {
161 __le32 fifo_num;
162 __le32 available_bytes;
163 __le32 wr_ptr;
164 __le32 rd_ptr;
165 __le32 fence_ptr;
166 __le32 fence_mode;
167 u8 data[];
168} __packed;
169
06ddbf5a
EG
170enum iwl_fw_error_dump_family {
171 IWL_FW_ERROR_DUMP_FAMILY_7 = 7,
172 IWL_FW_ERROR_DUMP_FAMILY_8 = 8,
173};
174
175/**
176 * struct iwl_fw_error_dump_info - info on the device / firmware
177 * @device_family: the family of the device (7 / 8)
178 * @hw_step: the step of the device
179 * @fw_human_readable: human readable FW version
180 * @dev_human_readable: name of the device
181 * @bus_human_readable: name of the bus used
182 */
183struct iwl_fw_error_dump_info {
184 __le32 device_family;
185 __le32 hw_step;
186 u8 fw_human_readable[FW_VER_HUMAN_READABLE_SZ];
187 u8 dev_human_readable[64];
188 u8 bus_human_readable[8];
189} __packed;
190
c2d20201 191/**
c544e9c4 192 * struct iwl_fw_error_dump_fw_mon - FW monitor data
c2d20201
EG
193 * @fw_mon_wr_ptr: the position of the write pointer in the cyclic buffer
194 * @fw_mon_base_ptr: base pointer of the data
0d365ae5 195 * @fw_mon_cycle_cnt: number of wraparounds
c2d20201
EG
196 * @reserved: for future use
197 * @data: captured data
198 */
c544e9c4 199struct iwl_fw_error_dump_fw_mon {
c2d20201
EG
200 __le32 fw_mon_wr_ptr;
201 __le32 fw_mon_base_ptr;
202 __le32 fw_mon_cycle_cnt;
203 __le32 reserved[3];
204 u8 data[];
205} __packed;
206
67c65f2c
EG
207/**
208 * struct iwl_fw_error_dump_prph - periphery registers data
209 * @prph_start: address of the first register in this chunk
210 * @data: the content of the registers
211 */
212struct iwl_fw_error_dump_prph {
213 __le32 prph_start;
214 __le32 data[];
215};
216
e06d8437
EG
217enum iwl_fw_error_dump_mem_type {
218 IWL_FW_ERROR_DUMP_MEM_SRAM,
219 IWL_FW_ERROR_DUMP_MEM_SMEM,
220};
221
222/**
223 * struct iwl_fw_error_dump_mem - chunk of memory
224 * @type: %enum iwl_fw_error_dump_mem_type
225 * @offset: the offset from which the memory was read
226 * @data: the content of the memory
227 */
228struct iwl_fw_error_dump_mem {
229 __le32 type;
230 __le32 offset;
231 u8 data[];
232};
233
bd7fc617
EG
234/**
235 * struct iwl_fw_error_dump_rb - content of an Receive Buffer
236 * @index: the index of the Receive Buffer in the Rx queue
237 * @rxq: the RB's Rx queue
238 * @reserved:
239 * @data: the content of the Receive Buffer
240 */
241struct iwl_fw_error_dump_rb {
242 __le32 index;
243 __le32 rxq;
244 __le32 reserved;
245 u8 data[];
246};
247
f0afea54
MG
248/**
249 * struct iwl_fw_error_dump_paging - content of the UMAC's image page
250 * block on DRAM
251 * @index: the index of the page block
252 * @reserved:
253 * @data: the content of the page block
254 */
255struct iwl_fw_error_dump_paging {
256 __le32 index;
257 __le32 reserved;
258 u8 data[];
259};
260
4d075007 261/**
1fa16056 262 * iwl_fw_error_next_data - advance fw error dump data pointer
4d075007
JB
263 * @data: previous data block
264 * Returns: next data block
265 */
266static inline struct iwl_fw_error_dump_data *
1fa16056 267iwl_fw_error_next_data(struct iwl_fw_error_dump_data *data)
4d075007
JB
268{
269 return (void *)(data->data + le32_to_cpu(data->len));
270}
271
d2709ad7
EG
272/**
273 * enum iwl_fw_dbg_trigger - triggers available
274 *
275 * @FW_DBG_TRIGGER_USER: trigger log collection by user
276 * This should not be defined as a trigger to the driver, but a value the
277 * driver should set to indicate that the trigger was initiated by the
278 * user.
279 * @FW_DBG_TRIGGER_FW_ASSERT: trigger log collection when the firmware asserts
9d761fd8
EG
280 * @FW_DBG_TRIGGER_MISSED_BEACONS: trigger log collection when beacons are
281 * missed.
f35d9c55 282 * @FW_DBG_TRIGGER_CHANNEL_SWITCH: trigger log collection upon channel switch.
917f39bb
EG
283 * @FW_DBG_TRIGGER_FW_NOTIF: trigger log collection when the firmware sends a
284 * command response or a notification.
d42f5350 285 * @FW_DBG_TRIGGER_MLME: trigger log collection upon MLME event.
5a756c20 286 * @FW_DBG_TRIGGER_STATS: trigger log collection upon statistics threshold.
3ec50b5e
EG
287 * @FW_DBG_TRIGGER_RSSI: trigger log collection when the rssi of the beacon
288 * goes below a threshold.
5d42e7b2
EG
289 * @FW_DBG_TRIGGER_TXQ_TIMERS: configures the timers for the Tx queue hang
290 * detection.
874c174e
EG
291 * @FW_DBG_TRIGGER_TIME_EVENT: trigger log collection upon time events related
292 * events.
4203263d 293 * @FW_DBG_TRIGGER_BA: trigger log collection upon BlockAck related events.
1e8f1329
GBA
294 * @FW_DBG_TX_LATENCY: trigger log collection when the tx latency goes above a
295 * threshold.
296 * @FW_DBG_TDLS: trigger log collection upon TDLS related events.
25657fec
GBA
297 * @FW_DBG_TRIGGER_TX_STATUS: trigger log collection upon tx status when
298 * the firmware sends a tx reply.
d2709ad7
EG
299 */
300enum iwl_fw_dbg_trigger {
301 FW_DBG_TRIGGER_INVALID = 0,
302 FW_DBG_TRIGGER_USER,
303 FW_DBG_TRIGGER_FW_ASSERT,
9d761fd8 304 FW_DBG_TRIGGER_MISSED_BEACONS,
f35d9c55 305 FW_DBG_TRIGGER_CHANNEL_SWITCH,
917f39bb 306 FW_DBG_TRIGGER_FW_NOTIF,
d42f5350 307 FW_DBG_TRIGGER_MLME,
5a756c20 308 FW_DBG_TRIGGER_STATS,
3ec50b5e 309 FW_DBG_TRIGGER_RSSI,
5d42e7b2 310 FW_DBG_TRIGGER_TXQ_TIMERS,
874c174e 311 FW_DBG_TRIGGER_TIME_EVENT,
4203263d 312 FW_DBG_TRIGGER_BA,
1e8f1329
GBA
313 FW_DBG_TRIGGER_TX_LATENCY,
314 FW_DBG_TRIGGER_TDLS,
25657fec 315 FW_DBG_TRIGGER_TX_STATUS,
d2709ad7
EG
316
317 /* must be last */
318 FW_DBG_TRIGGER_MAX,
319};
320
b6eaa45a
EG
321/**
322 * struct iwl_fw_error_dump_trigger_desc - describes the trigger condition
323 * @type: %enum iwl_fw_dbg_trigger
324 * @data: raw data about what happened
325 */
326struct iwl_fw_error_dump_trigger_desc {
327 __le32 type;
328 u8 data[];
329};
330
1bd3cbc1 331#endif /* __fw_error_dump_h__ */
This page took 0.1207 seconds and 5 git commands to generate.