1 /******************************************************************************
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.
8 * Copyright(c) 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
26 * The full GNU General Public License is included in this distribution
27 * in the file called COPYING.
29 * Contact Information:
30 * Intel Linux Wireless <linuxwifi@intel.com>
31 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
35 * Copyright(c) 2014 Intel Corporation. All rights reserved.
36 * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
37 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
38 * All rights reserved.
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions
44 * * Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 * * Redistributions in binary form must reproduce the above copyright
47 * notice, this list of conditions and the following disclaimer in
48 * the documentation and/or other materials provided with the
50 * * Neither the name Intel Corporation nor the names of its
51 * contributors may be used to endorse or promote products derived
52 * from this software without specific prior written permission.
54 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
55 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
56 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
57 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
58 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
59 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
60 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
61 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
62 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
63 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
64 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65 *****************************************************************************/
67 #ifndef __fw_error_dump_h__
68 #define __fw_error_dump_h__
70 #include <linux/types.h>
72 #define IWL_FW_ERROR_DUMP_BARKER 0x14789632
75 * enum iwl_fw_error_dump_type - types of data in the dump file
76 * @IWL_FW_ERROR_DUMP_CSR: Control Status Registers - from offset 0
77 * @IWL_FW_ERROR_DUMP_RXF:
78 * @IWL_FW_ERROR_DUMP_TXCMD: last TX command data, structured as
79 * &struct iwl_fw_error_dump_txcmd packets
80 * @IWL_FW_ERROR_DUMP_DEV_FW_INFO: struct %iwl_fw_error_dump_info
81 * info on the device / firmware.
82 * @IWL_FW_ERROR_DUMP_FW_MONITOR: firmware monitor
83 * @IWL_FW_ERROR_DUMP_PRPH: range of periphery registers - there can be several
84 * sections like this in a single file.
85 * @IWL_FW_ERROR_DUMP_FH_REGS: range of FH registers
86 * @IWL_FW_ERROR_DUMP_MEM: chunk of memory
87 * @IWL_FW_ERROR_DUMP_ERROR_INFO: description of what triggered this dump.
88 * Structured as &struct iwl_fw_error_dump_trigger_desc.
89 * @IWL_FW_ERROR_DUMP_RB: the content of an RB structured as
90 * &struct iwl_fw_error_dump_rb
91 * @IWL_FW_ERROR_PAGING: UMAC's image memory segments which were
93 * @IWL_FW_ERROR_DUMP_RADIO_REG: Dump the radio registers.
94 * @IWL_FW_ERROR_DUMP_EXTERNAL: used only by external code utilities, and
95 * for that reason is not in use in any other place in the Linux Wi-Fi
97 * @IWL_FW_ERROR_DUMP_MEM_CFG: the addresses and sizes of fifos in the smem,
98 * which we get from the fw after ALIVE. The content is structured as
99 * &struct iwl_fw_error_dump_smem_cfg.
101 enum iwl_fw_error_dump_type
{
102 /* 0 is deprecated */
103 IWL_FW_ERROR_DUMP_CSR
= 1,
104 IWL_FW_ERROR_DUMP_RXF
= 2,
105 IWL_FW_ERROR_DUMP_TXCMD
= 3,
106 IWL_FW_ERROR_DUMP_DEV_FW_INFO
= 4,
107 IWL_FW_ERROR_DUMP_FW_MONITOR
= 5,
108 IWL_FW_ERROR_DUMP_PRPH
= 6,
109 IWL_FW_ERROR_DUMP_TXF
= 7,
110 IWL_FW_ERROR_DUMP_FH_REGS
= 8,
111 IWL_FW_ERROR_DUMP_MEM
= 9,
112 IWL_FW_ERROR_DUMP_ERROR_INFO
= 10,
113 IWL_FW_ERROR_DUMP_RB
= 11,
114 IWL_FW_ERROR_DUMP_PAGING
= 12,
115 IWL_FW_ERROR_DUMP_RADIO_REG
= 13,
116 IWL_FW_ERROR_DUMP_INTERNAL_TXF
= 14,
117 IWL_FW_ERROR_DUMP_EXTERNAL
= 15, /* Do not move */
118 IWL_FW_ERROR_DUMP_MEM_CFG
= 16,
120 IWL_FW_ERROR_DUMP_MAX
,
124 * struct iwl_fw_error_dump_data - data for one type
125 * @type: &enum iwl_fw_error_dump_type
126 * @len: the length starting from %data
127 * @data: the data itself
129 struct iwl_fw_error_dump_data
{
136 * struct iwl_fw_error_dump_file - the layout of the header of the file
137 * @barker: must be %IWL_FW_ERROR_DUMP_BARKER
138 * @file_len: the length of all the file starting from %barker
139 * @data: array of &struct iwl_fw_error_dump_data
141 struct iwl_fw_error_dump_file
{
148 * struct iwl_fw_error_dump_txcmd - TX command data
149 * @cmdlen: original length of command
150 * @caplen: captured length of command (may be less)
151 * @data: captured command data, @caplen bytes
153 struct iwl_fw_error_dump_txcmd
{
160 * struct iwl_fw_error_dump_fifo - RX/TX FIFO data
161 * @fifo_num: number of FIFO (starting from 0)
162 * @available_bytes: num of bytes available in FIFO (may be less than FIFO size)
163 * @wr_ptr: position of write pointer
164 * @rd_ptr: position of read pointer
165 * @fence_ptr: position of fence pointer
166 * @fence_mode: the current mode of the fence (before locking) -
167 * 0=follow RD pointer ; 1 = freeze
168 * @data: all of the FIFO's data
170 struct iwl_fw_error_dump_fifo
{
172 __le32 available_bytes
;
180 enum iwl_fw_error_dump_family
{
181 IWL_FW_ERROR_DUMP_FAMILY_7
= 7,
182 IWL_FW_ERROR_DUMP_FAMILY_8
= 8,
186 * struct iwl_fw_error_dump_info - info on the device / firmware
187 * @device_family: the family of the device (7 / 8)
188 * @hw_step: the step of the device
189 * @fw_human_readable: human readable FW version
190 * @dev_human_readable: name of the device
191 * @bus_human_readable: name of the bus used
193 struct iwl_fw_error_dump_info
{
194 __le32 device_family
;
196 u8 fw_human_readable
[FW_VER_HUMAN_READABLE_SZ
];
197 u8 dev_human_readable
[64];
198 u8 bus_human_readable
[8];
202 * struct iwl_fw_error_dump_fw_mon - FW monitor data
203 * @fw_mon_wr_ptr: the position of the write pointer in the cyclic buffer
204 * @fw_mon_base_ptr: base pointer of the data
205 * @fw_mon_cycle_cnt: number of wraparounds
206 * @reserved: for future use
207 * @data: captured data
209 struct iwl_fw_error_dump_fw_mon
{
210 __le32 fw_mon_wr_ptr
;
211 __le32 fw_mon_base_ptr
;
212 __le32 fw_mon_cycle_cnt
;
217 #define MAX_NUM_LMAC 2
218 #define TX_FIFO_INTERNAL_MAX_NUM 6
219 #define TX_FIFO_MAX_NUM 15
221 * struct iwl_fw_error_dump_smem_cfg - Dump SMEM configuration
222 * This must follow &struct iwl_fwrt_shared_mem_cfg.
223 * @num_lmacs: number of lmacs
224 * @num_txfifo_entries: number of tx fifos
225 * @lmac: sizes of lmacs txfifos and rxfifo1
226 * @rxfifo2_size: size of rxfifo2
227 * @internal_txfifo_addr: address of internal tx fifo
228 * @internal_txfifo_size: size of internal tx fifo
230 struct iwl_fw_error_dump_smem_cfg
{
232 __le32 num_txfifo_entries
;
234 __le32 txfifo_size
[TX_FIFO_MAX_NUM
];
236 } lmac
[MAX_NUM_LMAC
];
238 __le32 internal_txfifo_addr
;
239 __le32 internal_txfifo_size
[TX_FIFO_INTERNAL_MAX_NUM
];
242 * struct iwl_fw_error_dump_prph - periphery registers data
243 * @prph_start: address of the first register in this chunk
244 * @data: the content of the registers
246 struct iwl_fw_error_dump_prph
{
251 enum iwl_fw_error_dump_mem_type
{
252 IWL_FW_ERROR_DUMP_MEM_SRAM
,
253 IWL_FW_ERROR_DUMP_MEM_SMEM
,
257 * struct iwl_fw_error_dump_mem - chunk of memory
258 * @type: &enum iwl_fw_error_dump_mem_type
259 * @offset: the offset from which the memory was read
260 * @data: the content of the memory
262 struct iwl_fw_error_dump_mem
{
269 * struct iwl_fw_error_dump_rb - content of an Receive Buffer
270 * @index: the index of the Receive Buffer in the Rx queue
271 * @rxq: the RB's Rx queue
273 * @data: the content of the Receive Buffer
275 struct iwl_fw_error_dump_rb
{
283 * struct iwl_fw_error_dump_paging - content of the UMAC's image page
285 * @index: the index of the page block
287 * @data: the content of the page block
289 struct iwl_fw_error_dump_paging
{
296 * iwl_fw_error_next_data - advance fw error dump data pointer
297 * @data: previous data block
298 * Returns: next data block
300 static inline struct iwl_fw_error_dump_data
*
301 iwl_fw_error_next_data(struct iwl_fw_error_dump_data
*data
)
303 return (void *)(data
->data
+ le32_to_cpu(data
->len
));
307 * enum iwl_fw_dbg_trigger - triggers available
309 * @FW_DBG_TRIGGER_USER: trigger log collection by user
310 * This should not be defined as a trigger to the driver, but a value the
311 * driver should set to indicate that the trigger was initiated by the
313 * @FW_DBG_TRIGGER_FW_ASSERT: trigger log collection when the firmware asserts
314 * @FW_DBG_TRIGGER_MISSED_BEACONS: trigger log collection when beacons are
316 * @FW_DBG_TRIGGER_CHANNEL_SWITCH: trigger log collection upon channel switch.
317 * @FW_DBG_TRIGGER_FW_NOTIF: trigger log collection when the firmware sends a
318 * command response or a notification.
319 * @FW_DBG_TRIGGER_MLME: trigger log collection upon MLME event.
320 * @FW_DBG_TRIGGER_STATS: trigger log collection upon statistics threshold.
321 * @FW_DBG_TRIGGER_RSSI: trigger log collection when the rssi of the beacon
322 * goes below a threshold.
323 * @FW_DBG_TRIGGER_TXQ_TIMERS: configures the timers for the Tx queue hang
325 * @FW_DBG_TRIGGER_TIME_EVENT: trigger log collection upon time events related
327 * @FW_DBG_TRIGGER_BA: trigger log collection upon BlockAck related events.
328 * @FW_DBG_TX_LATENCY: trigger log collection when the tx latency goes above a
330 * @FW_DBG_TDLS: trigger log collection upon TDLS related events.
331 * @FW_DBG_TRIGGER_TX_STATUS: trigger log collection upon tx status when
332 * the firmware sends a tx reply.
334 enum iwl_fw_dbg_trigger
{
335 FW_DBG_TRIGGER_INVALID
= 0,
337 FW_DBG_TRIGGER_FW_ASSERT
,
338 FW_DBG_TRIGGER_MISSED_BEACONS
,
339 FW_DBG_TRIGGER_CHANNEL_SWITCH
,
340 FW_DBG_TRIGGER_FW_NOTIF
,
342 FW_DBG_TRIGGER_STATS
,
344 FW_DBG_TRIGGER_TXQ_TIMERS
,
345 FW_DBG_TRIGGER_TIME_EVENT
,
347 FW_DBG_TRIGGER_TX_LATENCY
,
349 FW_DBG_TRIGGER_TX_STATUS
,
356 * struct iwl_fw_error_dump_trigger_desc - describes the trigger condition
357 * @type: &enum iwl_fw_dbg_trigger
358 * @data: raw data about what happened
360 struct iwl_fw_error_dump_trigger_desc
{
365 #endif /* __fw_error_dump_h__ */