Linux Audio

Check our new training course

Linux BSP development engineering services

Need help to port Linux and bootloaders to your hardware?
Loading...
v6.8
  1/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
  2/*
  3 * Copyright (C) 2014, 2018-2022 Intel Corporation
  4 * Copyright (C) 2014-2015 Intel Mobile Communications GmbH
  5 * Copyright (C) 2016-2017 Intel Deutschland GmbH
  6 */
  7#ifndef __fw_error_dump_h__
  8#define __fw_error_dump_h__
  9
 10#include <linux/types.h>
 11#include "fw/api/cmdhdr.h"
 12
 13#define IWL_FW_ERROR_DUMP_BARKER	0x14789632
 14#define IWL_FW_INI_ERROR_DUMP_BARKER	0x14789633
 15
 16/**
 17 * enum iwl_fw_error_dump_type - types of data in the dump file
 18 * @IWL_FW_ERROR_DUMP_CSR: Control Status Registers - from offset 0
 19 * @IWL_FW_ERROR_DUMP_RXF:
 20 * @IWL_FW_ERROR_DUMP_TXCMD: last TX command data, structured as
 21 *	&struct iwl_fw_error_dump_txcmd packets
 22 * @IWL_FW_ERROR_DUMP_DEV_FW_INFO:  struct %iwl_fw_error_dump_info
 23 *	info on the device / firmware.
 24 * @IWL_FW_ERROR_DUMP_FW_MONITOR: firmware monitor
 25 * @IWL_FW_ERROR_DUMP_PRPH: range of periphery registers - there can be several
 26 *	sections like this in a single file.
 
 27 * @IWL_FW_ERROR_DUMP_FH_REGS: range of FH registers
 28 * @IWL_FW_ERROR_DUMP_MEM: chunk of memory
 29 * @IWL_FW_ERROR_DUMP_ERROR_INFO: description of what triggered this dump.
 30 *	Structured as &struct iwl_fw_error_dump_trigger_desc.
 31 * @IWL_FW_ERROR_DUMP_RB: the content of an RB structured as
 32 *	&struct iwl_fw_error_dump_rb
 33 * @IWL_FW_ERROR_PAGING: UMAC's image memory segments which were
 34 *	paged to the DRAM.
 35 * @IWL_FW_ERROR_DUMP_RADIO_REG: Dump the radio registers.
 
 36 * @IWL_FW_ERROR_DUMP_EXTERNAL: used only by external code utilities, and
 37 *	for that reason is not in use in any other place in the Linux Wi-Fi
 38 *	stack.
 39 * @IWL_FW_ERROR_DUMP_MEM_CFG: the addresses and sizes of fifos in the smem,
 40 *	which we get from the fw after ALIVE. The content is structured as
 41 *	&struct iwl_fw_error_dump_smem_cfg.
 
 42 */
 43enum iwl_fw_error_dump_type {
 44	/* 0 is deprecated */
 45	IWL_FW_ERROR_DUMP_CSR = 1,
 46	IWL_FW_ERROR_DUMP_RXF = 2,
 47	IWL_FW_ERROR_DUMP_TXCMD = 3,
 48	IWL_FW_ERROR_DUMP_DEV_FW_INFO = 4,
 49	IWL_FW_ERROR_DUMP_FW_MONITOR = 5,
 50	IWL_FW_ERROR_DUMP_PRPH = 6,
 51	IWL_FW_ERROR_DUMP_TXF = 7,
 52	IWL_FW_ERROR_DUMP_FH_REGS = 8,
 53	IWL_FW_ERROR_DUMP_MEM = 9,
 54	IWL_FW_ERROR_DUMP_ERROR_INFO = 10,
 55	IWL_FW_ERROR_DUMP_RB = 11,
 56	IWL_FW_ERROR_DUMP_PAGING = 12,
 57	IWL_FW_ERROR_DUMP_RADIO_REG = 13,
 58	IWL_FW_ERROR_DUMP_INTERNAL_TXF = 14,
 59	IWL_FW_ERROR_DUMP_EXTERNAL = 15, /* Do not move */
 60	IWL_FW_ERROR_DUMP_MEM_CFG = 16,
 61	IWL_FW_ERROR_DUMP_D3_DEBUG_DATA = 17,
 62
 63	IWL_FW_ERROR_DUMP_MAX,
 64};
 65
 66/**
 67 * struct iwl_fw_error_dump_data - data for one type
 68 * @type: &enum iwl_fw_error_dump_type
 69 * @len: the length starting from %data
 70 * @data: the data itself
 71 */
 72struct iwl_fw_error_dump_data {
 73	__le32 type;
 74	__le32 len;
 75	__u8 data[];
 76} __packed;
 77
 78/**
 79 * struct iwl_dump_file_name_info - data for dump file name addition
 80 * @type: region type with reserved bits
 81 * @len: the length of file name string to be added to dump file
 82 * @data: the string need to be added to dump file
 83 */
 84struct iwl_dump_file_name_info {
 85	__le32 type;
 86	__le32 len;
 87	__u8 data[];
 88} __packed;
 89
 90/**
 91 * struct iwl_fw_error_dump_file - the layout of the header of the file
 92 * @barker: must be %IWL_FW_ERROR_DUMP_BARKER
 93 * @file_len: the length of all the file starting from %barker
 94 * @data: array of &struct iwl_fw_error_dump_data
 95 */
 96struct iwl_fw_error_dump_file {
 97	__le32 barker;
 98	__le32 file_len;
 99	u8 data[];
100} __packed;
101
102/**
103 * struct iwl_fw_error_dump_txcmd - TX command data
104 * @cmdlen: original length of command
105 * @caplen: captured length of command (may be less)
106 * @data: captured command data, @caplen bytes
107 */
108struct iwl_fw_error_dump_txcmd {
109	__le32 cmdlen;
110	__le32 caplen;
111	u8 data[];
112} __packed;
113
114/**
115 * struct iwl_fw_error_dump_fifo - RX/TX FIFO data
116 * @fifo_num: number of FIFO (starting from 0)
117 * @available_bytes: num of bytes available in FIFO (may be less than FIFO size)
118 * @wr_ptr: position of write pointer
119 * @rd_ptr: position of read pointer
120 * @fence_ptr: position of fence pointer
121 * @fence_mode: the current mode of the fence (before locking) -
122 *	0=follow RD pointer ; 1 = freeze
123 * @data: all of the FIFO's data
124 */
125struct iwl_fw_error_dump_fifo {
126	__le32 fifo_num;
127	__le32 available_bytes;
128	__le32 wr_ptr;
129	__le32 rd_ptr;
130	__le32 fence_ptr;
131	__le32 fence_mode;
132	u8 data[];
133} __packed;
134
135enum iwl_fw_error_dump_family {
136	IWL_FW_ERROR_DUMP_FAMILY_7 = 7,
137	IWL_FW_ERROR_DUMP_FAMILY_8 = 8,
138};
139
140#define MAX_NUM_LMAC 2
141
142/**
143 * struct iwl_fw_error_dump_info - info on the device / firmware
144 * @hw_type: the type of the device
145 * @hw_step: the step of the device
146 * @fw_human_readable: human readable FW version
147 * @dev_human_readable: name of the device
148 * @bus_human_readable: name of the bus used
149 * @num_of_lmacs: the number of lmacs
150 * @lmac_err_id: the lmac 0/1 error_id/rt_status that triggered the latest dump
151 *	if the dump collection was not initiated by an assert, the value is 0
152 * @umac_err_id: the umac error_id/rt_status that triggered the latest dump
153 *	if the dump collection was not initiated by an assert, the value is 0
154 */
155struct iwl_fw_error_dump_info {
156	__le32 hw_type;
157	__le32 hw_step;
158	u8 fw_human_readable[FW_VER_HUMAN_READABLE_SZ];
159	u8 dev_human_readable[64];
160	u8 bus_human_readable[8];
161	u8 num_of_lmacs;
162	__le32 umac_err_id;
163	__le32 lmac_err_id[MAX_NUM_LMAC];
164} __packed;
165
166/**
167 * struct iwl_fw_error_dump_fw_mon - FW monitor data
168 * @fw_mon_wr_ptr: the position of the write pointer in the cyclic buffer
169 * @fw_mon_base_ptr: base pointer of the data
170 * @fw_mon_cycle_cnt: number of wraparounds
171 * @fw_mon_base_high_ptr: used in AX210 devices, the base adderss is 64 bit
172 *	so fw_mon_base_ptr holds LSB 32 bits and fw_mon_base_high_ptr hold
173 *	MSB 32 bits
174 * @reserved: for future use
175 * @data: captured data
176 */
177struct iwl_fw_error_dump_fw_mon {
178	__le32 fw_mon_wr_ptr;
179	__le32 fw_mon_base_ptr;
180	__le32 fw_mon_cycle_cnt;
181	__le32 fw_mon_base_high_ptr;
182	__le32 reserved[2];
183	u8 data[];
184} __packed;
185
186#define MAX_NUM_LMAC 2
187#define TX_FIFO_INTERNAL_MAX_NUM	6
188#define TX_FIFO_MAX_NUM			15
189/**
190 * struct iwl_fw_error_dump_smem_cfg - Dump SMEM configuration
191 *	This must follow &struct iwl_fwrt_shared_mem_cfg.
192 * @num_lmacs: number of lmacs
193 * @num_txfifo_entries: number of tx fifos
194 * @lmac: sizes of lmacs txfifos and rxfifo1
195 * @rxfifo2_size: size of rxfifo2
196 * @internal_txfifo_addr: address of internal tx fifo
197 * @internal_txfifo_size: size of internal tx fifo
198 */
199struct iwl_fw_error_dump_smem_cfg {
200	__le32 num_lmacs;
201	__le32 num_txfifo_entries;
202	struct {
203		__le32 txfifo_size[TX_FIFO_MAX_NUM];
204		__le32 rxfifo1_size;
205	} lmac[MAX_NUM_LMAC];
206	__le32 rxfifo2_size;
207	__le32 internal_txfifo_addr;
208	__le32 internal_txfifo_size[TX_FIFO_INTERNAL_MAX_NUM];
209} __packed;
210/**
211 * struct iwl_fw_error_dump_prph - periphery registers data
212 * @prph_start: address of the first register in this chunk
213 * @data: the content of the registers
214 */
215struct iwl_fw_error_dump_prph {
216	__le32 prph_start;
217	__le32 data[];
218};
219
220enum iwl_fw_error_dump_mem_type {
221	IWL_FW_ERROR_DUMP_MEM_SRAM,
222	IWL_FW_ERROR_DUMP_MEM_SMEM,
223	IWL_FW_ERROR_DUMP_MEM_NAMED_MEM = 10,
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
238/* Dump version, used by the dump parser to differentiate between
239 * different dump formats
240 */
241#define IWL_INI_DUMP_VER 1
242
243/* Use bit 31 as dump info type to avoid colliding with region types */
244#define IWL_INI_DUMP_INFO_TYPE BIT(31)
245
246/* Use bit 31 and bit 24 as dump name type to avoid colliding with region types */
247#define IWL_INI_DUMP_NAME_TYPE (BIT(31) | BIT(24))
248
249/**
250 * struct iwl_fw_error_dump_data - data for one type
251 * @type: &enum iwl_fw_ini_region_type
252 * @sub_type: sub type id
253 * @sub_type_ver: sub type version
254 * @reserved: not in use
255 * @len: the length starting from %data
256 * @data: the data itself
257 */
258struct iwl_fw_ini_error_dump_data {
259	u8 type;
260	u8 sub_type;
261	u8 sub_type_ver;
262	u8 reserved;
263	__le32 len;
264	__u8 data[];
265} __packed;
266
267/**
268 * struct iwl_fw_ini_dump_entry
269 * @list: list of dump entries
270 * @size: size of the data
271 * @data: entry data
272 */
273struct iwl_fw_ini_dump_entry {
274	struct list_head list;
275	u32 size;
276	u8 data[];
277} __packed;
278
279/**
280 * struct iwl_fw_error_dump_file - header of dump file
281 * @barker: must be %IWL_FW_INI_ERROR_DUMP_BARKER
282 * @file_len: the length of all the file including the header
283 */
284struct iwl_fw_ini_dump_file_hdr {
285	__le32 barker;
286	__le32 file_len;
287} __packed;
288
289/**
290 * struct iwl_fw_ini_fifo_hdr - fifo range header
291 * @fifo_num: the fifo number. In case of umac rx fifo, set BIT(31) to
292 *	distinguish between lmac and umac rx fifos
293 * @num_of_registers: num of registers to dump, dword size each
294 */
295struct iwl_fw_ini_fifo_hdr {
296	__le32 fifo_num;
297	__le32 num_of_registers;
298} __packed;
299
300/**
301 * struct iwl_fw_ini_error_dump_range - range of memory
302 * @range_data_size: the size of this range, in bytes
303 * @internal_base_addr: base address of internal memory range
304 * @dram_base_addr: base address of dram monitor range
305 * @page_num: page number of memory range
306 * @fifo_hdr: fifo header of memory range
307 * @fw_pkt: FW packet header of memory range
308 * @data: the actual memory
309 */
310struct iwl_fw_ini_error_dump_range {
311	__le32 range_data_size;
312	union {
313		__le32 internal_base_addr __packed;
314		__le64 dram_base_addr __packed;
315		__le32 page_num __packed;
316		struct iwl_fw_ini_fifo_hdr fifo_hdr;
317		struct iwl_cmd_header fw_pkt_hdr;
318	};
319	__le32 data[];
320} __packed;
321
322/**
323 * struct iwl_fw_ini_error_dump_header - ini region dump header
324 * @version: dump version
325 * @region_id: id of the region
326 * @num_of_ranges: number of ranges in this region
327 * @name_len: number of bytes allocated to the name string of this region
328 * @name: name of the region
329 */
330struct iwl_fw_ini_error_dump_header {
331	__le32 version;
332	__le32 region_id;
333	__le32 num_of_ranges;
334	__le32 name_len;
335	u8 name[IWL_FW_INI_MAX_NAME];
336};
337
338/**
339 * struct iwl_fw_ini_error_dump - ini region dump
340 * @header: the header of this region
341 * @data: data of memory ranges in this region,
342 *	see &struct iwl_fw_ini_error_dump_range
343 */
344struct iwl_fw_ini_error_dump {
345	struct iwl_fw_ini_error_dump_header header;
346	u8 data[];
347} __packed;
348
349/* This bit is used to differentiate between lmac and umac rxf */
350#define IWL_RXF_UMAC_BIT BIT(31)
351
352/**
353 * struct iwl_fw_ini_error_dump_register - ini register dump
354 * @addr: address of the register
355 * @data: data of the register
356 */
357struct iwl_fw_ini_error_dump_register {
358	__le32 addr;
359	__le32 data;
360} __packed;
361
362/**
363 * struct iwl_fw_ini_dump_cfg_name - configuration name
364 * @image_type: image type the configuration is related to
365 * @cfg_name_len: length of the configuration name
366 * @cfg_name: name of the configuraiton
367 */
368struct iwl_fw_ini_dump_cfg_name {
369	__le32 image_type;
370	__le32 cfg_name_len;
371	u8 cfg_name[IWL_FW_INI_MAX_CFG_NAME];
372} __packed;
373
374/* AX210's HW type */
375#define IWL_AX210_HW_TYPE 0x42
376/* How many bits to roll when adding to the HW type of AX210 HW */
377#define IWL_AX210_HW_TYPE_ADDITION_SHIFT 12
378
379/* struct iwl_fw_ini_dump_info - ini dump information
380 * @version: dump version
381 * @time_point: time point that caused the dump collection
382 * @trigger_reason: reason of the trigger
383 * @external_cfg_state: &enum iwl_ini_cfg_state
384 * @ver_type: FW version type
385 * @ver_subtype: FW version subype
386 * @hw_step: HW step
387 * @hw_type: HW type
388 * @rf_id_flavor: HW RF id flavor
389 * @rf_id_dash: HW RF id dash
390 * @rf_id_step: HW RF id step
391 * @rf_id_type: HW RF id type
392 * @lmac_major: lmac major version
393 * @lmac_minor: lmac minor version
394 * @umac_major: umac major version
395 * @umac_minor: umac minor version
396 * @fw_mon_mode: FW monitor mode &enum iwl_fw_ini_buffer_location
397 * @regions_mask: bitmap mask of regions ids in the dump
398 * @build_tag_len: length of the build tag
399 * @build_tag: build tag string
400 * @num_of_cfg_names: number of configuration name structs
401 * @cfg_names: configuration names
402 */
403struct iwl_fw_ini_dump_info {
404	__le32 version;
405	__le32 time_point;
406	__le32 trigger_reason;
407	__le32 external_cfg_state;
408	__le32 ver_type;
409	__le32 ver_subtype;
410	__le32 hw_step;
411	__le32 hw_type;
412	__le32 rf_id_flavor;
413	__le32 rf_id_dash;
414	__le32 rf_id_step;
415	__le32 rf_id_type;
416	__le32 lmac_major;
417	__le32 lmac_minor;
418	__le32 umac_major;
419	__le32 umac_minor;
420	__le32 fw_mon_mode;
421	__le64 regions_mask;
422	__le32 build_tag_len;
423	u8 build_tag[FW_VER_HUMAN_READABLE_SZ];
424	__le32 num_of_cfg_names;
425	struct iwl_fw_ini_dump_cfg_name cfg_names[];
426} __packed;
427
428/**
429 * struct iwl_fw_ini_err_table_dump - ini error table dump
430 * @header: header of the region
431 * @version: error table version
432 * @data: data of memory ranges in this region,
433 *	see &struct iwl_fw_ini_error_dump_range
434 */
435struct iwl_fw_ini_err_table_dump {
436	struct iwl_fw_ini_error_dump_header header;
437	__le32 version;
438	u8 data[];
439} __packed;
440
441/**
442 * struct iwl_fw_error_dump_rb - content of an Receive Buffer
443 * @index: the index of the Receive Buffer in the Rx queue
444 * @rxq: the RB's Rx queue
445 * @reserved:
446 * @data: the content of the Receive Buffer
447 */
448struct iwl_fw_error_dump_rb {
449	__le32 index;
450	__le32 rxq;
451	__le32 reserved;
452	u8 data[];
453};
454
455/**
456 * struct iwl_fw_ini_monitor_dump - ini monitor dump
457 * @header: header of the region
458 * @write_ptr: write pointer position in the buffer
459 * @cycle_cnt: cycles count
460 * @cur_frag: current fragment in use
461 * @data: data of memory ranges in this region,
462 *	see &struct iwl_fw_ini_error_dump_range
463 */
464struct iwl_fw_ini_monitor_dump {
465	struct iwl_fw_ini_error_dump_header header;
466	__le32 write_ptr;
467	__le32 cycle_cnt;
468	__le32 cur_frag;
469	u8 data[];
470} __packed;
471
472/**
473 * struct iwl_fw_ini_special_device_memory - special device memory
474 * @header: header of the region
475 * @type: type of special memory
476 * @version: struct special memory version
477 * @data: data of memory ranges in this region,
478 *	see &struct iwl_fw_ini_error_dump_range
479 */
480struct iwl_fw_ini_special_device_memory {
481	struct iwl_fw_ini_error_dump_header header;
482	__le16 type;
483	__le16 version;
484	u8 data[];
485} __packed;
486
487/**
488 * struct iwl_fw_error_dump_paging - content of the UMAC's image page
489 *	block on DRAM
490 * @index: the index of the page block
491 * @reserved:
492 * @data: the content of the page block
493 */
494struct iwl_fw_error_dump_paging {
495	__le32 index;
496	__le32 reserved;
497	u8 data[];
498};
499
500/**
501 * iwl_fw_error_next_data - advance fw error dump data pointer
502 * @data: previous data block
503 * Returns: next data block
504 */
505static inline struct iwl_fw_error_dump_data *
506iwl_fw_error_next_data(struct iwl_fw_error_dump_data *data)
507{
508	return (void *)(data->data + le32_to_cpu(data->len));
509}
510
511/**
512 * enum iwl_fw_dbg_trigger - triggers available
513 *
 
514 * @FW_DBG_TRIGGER_USER: trigger log collection by user
515 *	This should not be defined as a trigger to the driver, but a value the
516 *	driver should set to indicate that the trigger was initiated by the
517 *	user.
518 * @FW_DBG_TRIGGER_FW_ASSERT: trigger log collection when the firmware asserts
519 * @FW_DBG_TRIGGER_MISSED_BEACONS: trigger log collection when beacons are
520 *	missed.
521 * @FW_DBG_TRIGGER_CHANNEL_SWITCH: trigger log collection upon channel switch.
522 * @FW_DBG_TRIGGER_FW_NOTIF: trigger log collection when the firmware sends a
523 *	command response or a notification.
524 * @FW_DBG_TRIGGER_MLME: trigger log collection upon MLME event.
525 * @FW_DBG_TRIGGER_STATS: trigger log collection upon statistics threshold.
526 * @FW_DBG_TRIGGER_RSSI: trigger log collection when the rssi of the beacon
527 *	goes below a threshold.
528 * @FW_DBG_TRIGGER_TXQ_TIMERS: configures the timers for the Tx queue hang
529 *	detection.
530 * @FW_DBG_TRIGGER_TIME_EVENT: trigger log collection upon time events related
531 *	events.
532 * @FW_DBG_TRIGGER_BA: trigger log collection upon BlockAck related events.
533 * @FW_DBG_TX_LATENCY: trigger log collection when the tx latency goes above a
534 *	threshold.
535 * @FW_DBG_TDLS: trigger log collection upon TDLS related events.
536 * @FW_DBG_TRIGGER_TX_STATUS: trigger log collection upon tx status when
537 *  the firmware sends a tx reply.
538 * @FW_DBG_TRIGGER_ALIVE_TIMEOUT: trigger log collection if alive flow timeouts
539 * @FW_DBG_TRIGGER_DRIVER: trigger log collection upon a flow failure
540 *	in the driver.
 
541 */
542enum iwl_fw_dbg_trigger {
543	FW_DBG_TRIGGER_INVALID = 0,
544	FW_DBG_TRIGGER_USER,
545	FW_DBG_TRIGGER_FW_ASSERT,
546	FW_DBG_TRIGGER_MISSED_BEACONS,
547	FW_DBG_TRIGGER_CHANNEL_SWITCH,
548	FW_DBG_TRIGGER_FW_NOTIF,
549	FW_DBG_TRIGGER_MLME,
550	FW_DBG_TRIGGER_STATS,
551	FW_DBG_TRIGGER_RSSI,
552	FW_DBG_TRIGGER_TXQ_TIMERS,
553	FW_DBG_TRIGGER_TIME_EVENT,
554	FW_DBG_TRIGGER_BA,
555	FW_DBG_TRIGGER_TX_LATENCY,
556	FW_DBG_TRIGGER_TDLS,
557	FW_DBG_TRIGGER_TX_STATUS,
558	FW_DBG_TRIGGER_ALIVE_TIMEOUT,
559	FW_DBG_TRIGGER_DRIVER,
560
561	/* must be last */
562	FW_DBG_TRIGGER_MAX,
563};
564
565/**
566 * struct iwl_fw_error_dump_trigger_desc - describes the trigger condition
567 * @type: &enum iwl_fw_dbg_trigger
568 * @data: raw data about what happened
569 */
570struct iwl_fw_error_dump_trigger_desc {
571	__le32 type;
572	u8 data[];
573};
574
575#endif /* __fw_error_dump_h__ */
v6.9.4
  1/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
  2/*
  3 * Copyright (C) 2014, 2018-2024 Intel Corporation
  4 * Copyright (C) 2014-2015 Intel Mobile Communications GmbH
  5 * Copyright (C) 2016-2017 Intel Deutschland GmbH
  6 */
  7#ifndef __fw_error_dump_h__
  8#define __fw_error_dump_h__
  9
 10#include <linux/types.h>
 11#include "fw/api/cmdhdr.h"
 12
 13#define IWL_FW_ERROR_DUMP_BARKER	0x14789632
 14#define IWL_FW_INI_ERROR_DUMP_BARKER	0x14789633
 15
 16/**
 17 * enum iwl_fw_error_dump_type - types of data in the dump file
 18 * @IWL_FW_ERROR_DUMP_CSR: Control Status Registers - from offset 0
 19 * @IWL_FW_ERROR_DUMP_RXF: RX FIFO contents
 20 * @IWL_FW_ERROR_DUMP_TXCMD: last TX command data, structured as
 21 *	&struct iwl_fw_error_dump_txcmd packets
 22 * @IWL_FW_ERROR_DUMP_DEV_FW_INFO:  struct %iwl_fw_error_dump_info
 23 *	info on the device / firmware.
 24 * @IWL_FW_ERROR_DUMP_FW_MONITOR: firmware monitor
 25 * @IWL_FW_ERROR_DUMP_PRPH: range of periphery registers - there can be several
 26 *	sections like this in a single file.
 27 * @IWL_FW_ERROR_DUMP_TXF: TX FIFO contents
 28 * @IWL_FW_ERROR_DUMP_FH_REGS: range of FH registers
 29 * @IWL_FW_ERROR_DUMP_MEM: chunk of memory
 30 * @IWL_FW_ERROR_DUMP_ERROR_INFO: description of what triggered this dump.
 31 *	Structured as &struct iwl_fw_error_dump_trigger_desc.
 32 * @IWL_FW_ERROR_DUMP_RB: the content of an RB structured as
 33 *	&struct iwl_fw_error_dump_rb
 34 * @IWL_FW_ERROR_DUMP_PAGING: UMAC's image memory segments which were
 35 *	paged to the DRAM.
 36 * @IWL_FW_ERROR_DUMP_RADIO_REG: Dump the radio registers.
 37 * @IWL_FW_ERROR_DUMP_INTERNAL_TXF: internal TX FIFO data
 38 * @IWL_FW_ERROR_DUMP_EXTERNAL: used only by external code utilities, and
 39 *	for that reason is not in use in any other place in the Linux Wi-Fi
 40 *	stack.
 41 * @IWL_FW_ERROR_DUMP_MEM_CFG: the addresses and sizes of fifos in the smem,
 42 *	which we get from the fw after ALIVE. The content is structured as
 43 *	&struct iwl_fw_error_dump_smem_cfg.
 44 * @IWL_FW_ERROR_DUMP_D3_DEBUG_DATA: D3 debug data
 45 */
 46enum iwl_fw_error_dump_type {
 47	/* 0 is deprecated */
 48	IWL_FW_ERROR_DUMP_CSR = 1,
 49	IWL_FW_ERROR_DUMP_RXF = 2,
 50	IWL_FW_ERROR_DUMP_TXCMD = 3,
 51	IWL_FW_ERROR_DUMP_DEV_FW_INFO = 4,
 52	IWL_FW_ERROR_DUMP_FW_MONITOR = 5,
 53	IWL_FW_ERROR_DUMP_PRPH = 6,
 54	IWL_FW_ERROR_DUMP_TXF = 7,
 55	IWL_FW_ERROR_DUMP_FH_REGS = 8,
 56	IWL_FW_ERROR_DUMP_MEM = 9,
 57	IWL_FW_ERROR_DUMP_ERROR_INFO = 10,
 58	IWL_FW_ERROR_DUMP_RB = 11,
 59	IWL_FW_ERROR_DUMP_PAGING = 12,
 60	IWL_FW_ERROR_DUMP_RADIO_REG = 13,
 61	IWL_FW_ERROR_DUMP_INTERNAL_TXF = 14,
 62	IWL_FW_ERROR_DUMP_EXTERNAL = 15, /* Do not move */
 63	IWL_FW_ERROR_DUMP_MEM_CFG = 16,
 64	IWL_FW_ERROR_DUMP_D3_DEBUG_DATA = 17,
 
 
 65};
 66
 67/**
 68 * struct iwl_fw_error_dump_data - data for one type
 69 * @type: &enum iwl_fw_error_dump_type
 70 * @len: the length starting from %data
 71 * @data: the data itself
 72 */
 73struct iwl_fw_error_dump_data {
 74	__le32 type;
 75	__le32 len;
 76	__u8 data[];
 77} __packed;
 78
 79/**
 80 * struct iwl_dump_file_name_info - data for dump file name addition
 81 * @type: region type with reserved bits
 82 * @len: the length of file name string to be added to dump file
 83 * @data: the string need to be added to dump file
 84 */
 85struct iwl_dump_file_name_info {
 86	__le32 type;
 87	__le32 len;
 88	__u8 data[];
 89} __packed;
 90
 91/**
 92 * struct iwl_fw_error_dump_file - the layout of the header of the file
 93 * @barker: must be %IWL_FW_ERROR_DUMP_BARKER
 94 * @file_len: the length of all the file starting from %barker
 95 * @data: array of &struct iwl_fw_error_dump_data
 96 */
 97struct iwl_fw_error_dump_file {
 98	__le32 barker;
 99	__le32 file_len;
100	u8 data[];
101} __packed;
102
103/**
104 * struct iwl_fw_error_dump_txcmd - TX command data
105 * @cmdlen: original length of command
106 * @caplen: captured length of command (may be less)
107 * @data: captured command data, @caplen bytes
108 */
109struct iwl_fw_error_dump_txcmd {
110	__le32 cmdlen;
111	__le32 caplen;
112	u8 data[];
113} __packed;
114
115/**
116 * struct iwl_fw_error_dump_fifo - RX/TX FIFO data
117 * @fifo_num: number of FIFO (starting from 0)
118 * @available_bytes: num of bytes available in FIFO (may be less than FIFO size)
119 * @wr_ptr: position of write pointer
120 * @rd_ptr: position of read pointer
121 * @fence_ptr: position of fence pointer
122 * @fence_mode: the current mode of the fence (before locking) -
123 *	0=follow RD pointer ; 1 = freeze
124 * @data: all of the FIFO's data
125 */
126struct iwl_fw_error_dump_fifo {
127	__le32 fifo_num;
128	__le32 available_bytes;
129	__le32 wr_ptr;
130	__le32 rd_ptr;
131	__le32 fence_ptr;
132	__le32 fence_mode;
133	u8 data[];
134} __packed;
135
136enum iwl_fw_error_dump_family {
137	IWL_FW_ERROR_DUMP_FAMILY_7 = 7,
138	IWL_FW_ERROR_DUMP_FAMILY_8 = 8,
139};
140
141#define MAX_NUM_LMAC 2
142
143/**
144 * struct iwl_fw_error_dump_info - info on the device / firmware
145 * @hw_type: the type of the device
146 * @hw_step: the step of the device
147 * @fw_human_readable: human readable FW version
148 * @dev_human_readable: name of the device
149 * @bus_human_readable: name of the bus used
150 * @num_of_lmacs: the number of lmacs
151 * @lmac_err_id: the lmac 0/1 error_id/rt_status that triggered the latest dump
152 *	if the dump collection was not initiated by an assert, the value is 0
153 * @umac_err_id: the umac error_id/rt_status that triggered the latest dump
154 *	if the dump collection was not initiated by an assert, the value is 0
155 */
156struct iwl_fw_error_dump_info {
157	__le32 hw_type;
158	__le32 hw_step;
159	u8 fw_human_readable[FW_VER_HUMAN_READABLE_SZ];
160	u8 dev_human_readable[64];
161	u8 bus_human_readable[8];
162	u8 num_of_lmacs;
163	__le32 umac_err_id;
164	__le32 lmac_err_id[MAX_NUM_LMAC];
165} __packed;
166
167/**
168 * struct iwl_fw_error_dump_fw_mon - FW monitor data
169 * @fw_mon_wr_ptr: the position of the write pointer in the cyclic buffer
170 * @fw_mon_base_ptr: base pointer of the data
171 * @fw_mon_cycle_cnt: number of wraparounds
172 * @fw_mon_base_high_ptr: used in AX210 devices, the base adderss is 64 bit
173 *	so fw_mon_base_ptr holds LSB 32 bits and fw_mon_base_high_ptr hold
174 *	MSB 32 bits
175 * @reserved: for future use
176 * @data: captured data
177 */
178struct iwl_fw_error_dump_fw_mon {
179	__le32 fw_mon_wr_ptr;
180	__le32 fw_mon_base_ptr;
181	__le32 fw_mon_cycle_cnt;
182	__le32 fw_mon_base_high_ptr;
183	__le32 reserved[2];
184	u8 data[];
185} __packed;
186
187#define MAX_NUM_LMAC 2
188#define TX_FIFO_INTERNAL_MAX_NUM	6
189#define TX_FIFO_MAX_NUM			15
190/**
191 * struct iwl_fw_error_dump_smem_cfg - Dump SMEM configuration
192 *	This must follow &struct iwl_fwrt_shared_mem_cfg.
193 * @num_lmacs: number of lmacs
194 * @num_txfifo_entries: number of tx fifos
195 * @lmac: sizes of lmacs txfifos and rxfifo1
196 * @rxfifo2_size: size of rxfifo2
197 * @internal_txfifo_addr: address of internal tx fifo
198 * @internal_txfifo_size: size of internal tx fifo
199 */
200struct iwl_fw_error_dump_smem_cfg {
201	__le32 num_lmacs;
202	__le32 num_txfifo_entries;
203	struct {
204		__le32 txfifo_size[TX_FIFO_MAX_NUM];
205		__le32 rxfifo1_size;
206	} lmac[MAX_NUM_LMAC];
207	__le32 rxfifo2_size;
208	__le32 internal_txfifo_addr;
209	__le32 internal_txfifo_size[TX_FIFO_INTERNAL_MAX_NUM];
210} __packed;
211/**
212 * 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
221enum iwl_fw_error_dump_mem_type {
222	IWL_FW_ERROR_DUMP_MEM_SRAM,
223	IWL_FW_ERROR_DUMP_MEM_SMEM,
224	IWL_FW_ERROR_DUMP_MEM_NAMED_MEM = 10,
225};
226
227/**
228 * struct iwl_fw_error_dump_mem - chunk of memory
229 * @type: &enum iwl_fw_error_dump_mem_type
230 * @offset: the offset from which the memory was read
231 * @data: the content of the memory
232 */
233struct iwl_fw_error_dump_mem {
234	__le32 type;
235	__le32 offset;
236	u8 data[];
237};
238
239/* Dump version, used by the dump parser to differentiate between
240 * different dump formats
241 */
242#define IWL_INI_DUMP_VER 1
243
244/* Use bit 31 as dump info type to avoid colliding with region types */
245#define IWL_INI_DUMP_INFO_TYPE BIT(31)
246
247/* Use bit 31 and bit 24 as dump name type to avoid colliding with region types */
248#define IWL_INI_DUMP_NAME_TYPE (BIT(31) | BIT(24))
249
250/**
251 * struct iwl_fw_error_dump_data - data for one type
252 * @type: &enum iwl_fw_ini_region_type
253 * @sub_type: sub type id
254 * @sub_type_ver: sub type version
255 * @reserved: not in use
256 * @len: the length starting from %data
257 * @data: the data itself
258 */
259struct iwl_fw_ini_error_dump_data {
260	u8 type;
261	u8 sub_type;
262	u8 sub_type_ver;
263	u8 reserved;
264	__le32 len;
265	__u8 data[];
266} __packed;
267
268/**
269 * struct iwl_fw_ini_dump_entry
270 * @list: list of dump entries
271 * @size: size of the data
272 * @data: entry data
273 */
274struct iwl_fw_ini_dump_entry {
275	struct list_head list;
276	u32 size;
277	u8 data[];
278} __packed;
279
280/**
281 * struct iwl_fw_error_dump_file - header of dump file
282 * @barker: must be %IWL_FW_INI_ERROR_DUMP_BARKER
283 * @file_len: the length of all the file including the header
284 */
285struct iwl_fw_ini_dump_file_hdr {
286	__le32 barker;
287	__le32 file_len;
288} __packed;
289
290/**
291 * struct iwl_fw_ini_fifo_hdr - fifo range header
292 * @fifo_num: the fifo number. In case of umac rx fifo, set BIT(31) to
293 *	distinguish between lmac and umac rx fifos
294 * @num_of_registers: num of registers to dump, dword size each
295 */
296struct iwl_fw_ini_fifo_hdr {
297	__le32 fifo_num;
298	__le32 num_of_registers;
299} __packed;
300
301/**
302 * struct iwl_fw_ini_error_dump_range - range of memory
303 * @range_data_size: the size of this range, in bytes
304 * @internal_base_addr: base address of internal memory range
305 * @dram_base_addr: base address of dram monitor range
306 * @page_num: page number of memory range
307 * @fifo_hdr: fifo header of memory range
308 * @fw_pkt: FW packet header of memory range
309 * @data: the actual memory
310 */
311struct iwl_fw_ini_error_dump_range {
312	__le32 range_data_size;
313	union {
314		__le32 internal_base_addr __packed;
315		__le64 dram_base_addr __packed;
316		__le32 page_num __packed;
317		struct iwl_fw_ini_fifo_hdr fifo_hdr;
318		struct iwl_cmd_header fw_pkt_hdr;
319	};
320	__le32 data[];
321} __packed;
322
323/**
324 * struct iwl_fw_ini_error_dump_header - ini region dump header
325 * @version: dump version
326 * @region_id: id of the region
327 * @num_of_ranges: number of ranges in this region
328 * @name_len: number of bytes allocated to the name string of this region
329 * @name: name of the region
330 */
331struct iwl_fw_ini_error_dump_header {
332	__le32 version;
333	__le32 region_id;
334	__le32 num_of_ranges;
335	__le32 name_len;
336	u8 name[IWL_FW_INI_MAX_NAME];
337};
338
339/**
340 * struct iwl_fw_ini_error_dump - ini region dump
341 * @header: the header of this region
342 * @data: data of memory ranges in this region,
343 *	see &struct iwl_fw_ini_error_dump_range
344 */
345struct iwl_fw_ini_error_dump {
346	struct iwl_fw_ini_error_dump_header header;
347	u8 data[];
348} __packed;
349
350/* This bit is used to differentiate between lmac and umac rxf */
351#define IWL_RXF_UMAC_BIT BIT(31)
352
353/**
354 * struct iwl_fw_ini_error_dump_register - ini register dump
355 * @addr: address of the register
356 * @data: data of the register
357 */
358struct iwl_fw_ini_error_dump_register {
359	__le32 addr;
360	__le32 data;
361} __packed;
362
363/**
364 * struct iwl_fw_ini_dump_cfg_name - configuration name
365 * @image_type: image type the configuration is related to
366 * @cfg_name_len: length of the configuration name
367 * @cfg_name: name of the configuraiton
368 */
369struct iwl_fw_ini_dump_cfg_name {
370	__le32 image_type;
371	__le32 cfg_name_len;
372	u8 cfg_name[IWL_FW_INI_MAX_CFG_NAME];
373} __packed;
374
375/* AX210's HW type */
376#define IWL_AX210_HW_TYPE 0x42
377/* How many bits to roll when adding to the HW type of AX210 HW */
378#define IWL_AX210_HW_TYPE_ADDITION_SHIFT 12
379
380/* struct iwl_fw_ini_dump_info - ini dump information
381 * @version: dump version
382 * @time_point: time point that caused the dump collection
383 * @trigger_reason: reason of the trigger
384 * @external_cfg_state: &enum iwl_ini_cfg_state
385 * @ver_type: FW version type
386 * @ver_subtype: FW version subype
387 * @hw_step: HW step
388 * @hw_type: HW type
389 * @rf_id_flavor: HW RF id flavor
390 * @rf_id_dash: HW RF id dash
391 * @rf_id_step: HW RF id step
392 * @rf_id_type: HW RF id type
393 * @lmac_major: lmac major version
394 * @lmac_minor: lmac minor version
395 * @umac_major: umac major version
396 * @umac_minor: umac minor version
397 * @fw_mon_mode: FW monitor mode &enum iwl_fw_ini_buffer_location
398 * @regions_mask: bitmap mask of regions ids in the dump
399 * @build_tag_len: length of the build tag
400 * @build_tag: build tag string
401 * @num_of_cfg_names: number of configuration name structs
402 * @cfg_names: configuration names
403 */
404struct iwl_fw_ini_dump_info {
405	__le32 version;
406	__le32 time_point;
407	__le32 trigger_reason;
408	__le32 external_cfg_state;
409	__le32 ver_type;
410	__le32 ver_subtype;
411	__le32 hw_step;
412	__le32 hw_type;
413	__le32 rf_id_flavor;
414	__le32 rf_id_dash;
415	__le32 rf_id_step;
416	__le32 rf_id_type;
417	__le32 lmac_major;
418	__le32 lmac_minor;
419	__le32 umac_major;
420	__le32 umac_minor;
421	__le32 fw_mon_mode;
422	__le64 regions_mask;
423	__le32 build_tag_len;
424	u8 build_tag[FW_VER_HUMAN_READABLE_SZ];
425	__le32 num_of_cfg_names;
426	struct iwl_fw_ini_dump_cfg_name cfg_names[];
427} __packed;
428
429/**
430 * struct iwl_fw_ini_err_table_dump - ini error table dump
431 * @header: header of the region
432 * @version: error table version
433 * @data: data of memory ranges in this region,
434 *	see &struct iwl_fw_ini_error_dump_range
435 */
436struct iwl_fw_ini_err_table_dump {
437	struct iwl_fw_ini_error_dump_header header;
438	__le32 version;
439	u8 data[];
440} __packed;
441
442/**
443 * struct iwl_fw_error_dump_rb - content of an Receive Buffer
444 * @index: the index of the Receive Buffer in the Rx queue
445 * @rxq: the RB's Rx queue
446 * @reserved: reserved
447 * @data: the content of the Receive Buffer
448 */
449struct iwl_fw_error_dump_rb {
450	__le32 index;
451	__le32 rxq;
452	__le32 reserved;
453	u8 data[];
454};
455
456/**
457 * struct iwl_fw_ini_monitor_dump - ini monitor dump
458 * @header: header of the region
459 * @write_ptr: write pointer position in the buffer
460 * @cycle_cnt: cycles count
461 * @cur_frag: current fragment in use
462 * @data: data of memory ranges in this region,
463 *	see &struct iwl_fw_ini_error_dump_range
464 */
465struct iwl_fw_ini_monitor_dump {
466	struct iwl_fw_ini_error_dump_header header;
467	__le32 write_ptr;
468	__le32 cycle_cnt;
469	__le32 cur_frag;
470	u8 data[];
471} __packed;
472
473/**
474 * struct iwl_fw_ini_special_device_memory - special device memory
475 * @header: header of the region
476 * @type: type of special memory
477 * @version: struct special memory version
478 * @data: data of memory ranges in this region,
479 *	see &struct iwl_fw_ini_error_dump_range
480 */
481struct iwl_fw_ini_special_device_memory {
482	struct iwl_fw_ini_error_dump_header header;
483	__le16 type;
484	__le16 version;
485	u8 data[];
486} __packed;
487
488/**
489 * struct iwl_fw_error_dump_paging - content of the UMAC's image page
490 *	block on DRAM
491 * @index: the index of the page block
492 * @reserved: reserved
493 * @data: the content of the page block
494 */
495struct iwl_fw_error_dump_paging {
496	__le32 index;
497	__le32 reserved;
498	u8 data[];
499};
500
501/**
502 * iwl_fw_error_next_data - advance fw error dump data pointer
503 * @data: previous data block
504 * Returns: next data block
505 */
506static inline struct iwl_fw_error_dump_data *
507iwl_fw_error_next_data(struct iwl_fw_error_dump_data *data)
508{
509	return (void *)(data->data + le32_to_cpu(data->len));
510}
511
512/**
513 * enum iwl_fw_dbg_trigger - triggers available
514 *
515 * @FW_DBG_TRIGGER_INVALID: invalid trigger value
516 * @FW_DBG_TRIGGER_USER: trigger log collection by user
517 *	This should not be defined as a trigger to the driver, but a value the
518 *	driver should set to indicate that the trigger was initiated by the
519 *	user.
520 * @FW_DBG_TRIGGER_FW_ASSERT: trigger log collection when the firmware asserts
521 * @FW_DBG_TRIGGER_MISSED_BEACONS: trigger log collection when beacons are
522 *	missed.
523 * @FW_DBG_TRIGGER_CHANNEL_SWITCH: trigger log collection upon channel switch.
524 * @FW_DBG_TRIGGER_FW_NOTIF: trigger log collection when the firmware sends a
525 *	command response or a notification.
526 * @FW_DBG_TRIGGER_MLME: trigger log collection upon MLME event.
527 * @FW_DBG_TRIGGER_STATS: trigger log collection upon statistics threshold.
528 * @FW_DBG_TRIGGER_RSSI: trigger log collection when the rssi of the beacon
529 *	goes below a threshold.
530 * @FW_DBG_TRIGGER_TXQ_TIMERS: configures the timers for the Tx queue hang
531 *	detection.
532 * @FW_DBG_TRIGGER_TIME_EVENT: trigger log collection upon time events related
533 *	events.
534 * @FW_DBG_TRIGGER_BA: trigger log collection upon BlockAck related events.
535 * @FW_DBG_TRIGGER_TX_LATENCY: trigger log collection when the tx latency
536 *	goes above a threshold.
537 * @FW_DBG_TRIGGER_TDLS: trigger log collection upon TDLS related events.
538 * @FW_DBG_TRIGGER_TX_STATUS: trigger log collection upon tx status when
539 *  the firmware sends a tx reply.
540 * @FW_DBG_TRIGGER_ALIVE_TIMEOUT: trigger log collection if alive flow timeouts
541 * @FW_DBG_TRIGGER_DRIVER: trigger log collection upon a flow failure
542 *	in the driver.
543 * @FW_DBG_TRIGGER_MAX: beyond triggers, number for sizing arrays etc.
544 */
545enum iwl_fw_dbg_trigger {
546	FW_DBG_TRIGGER_INVALID = 0,
547	FW_DBG_TRIGGER_USER,
548	FW_DBG_TRIGGER_FW_ASSERT,
549	FW_DBG_TRIGGER_MISSED_BEACONS,
550	FW_DBG_TRIGGER_CHANNEL_SWITCH,
551	FW_DBG_TRIGGER_FW_NOTIF,
552	FW_DBG_TRIGGER_MLME,
553	FW_DBG_TRIGGER_STATS,
554	FW_DBG_TRIGGER_RSSI,
555	FW_DBG_TRIGGER_TXQ_TIMERS,
556	FW_DBG_TRIGGER_TIME_EVENT,
557	FW_DBG_TRIGGER_BA,
558	FW_DBG_TRIGGER_TX_LATENCY,
559	FW_DBG_TRIGGER_TDLS,
560	FW_DBG_TRIGGER_TX_STATUS,
561	FW_DBG_TRIGGER_ALIVE_TIMEOUT,
562	FW_DBG_TRIGGER_DRIVER,
563
564	/* must be last */
565	FW_DBG_TRIGGER_MAX,
566};
567
568/**
569 * struct iwl_fw_error_dump_trigger_desc - describes the trigger condition
570 * @type: &enum iwl_fw_dbg_trigger
571 * @data: raw data about what happened
572 */
573struct iwl_fw_error_dump_trigger_desc {
574	__le32 type;
575	u8 data[];
576};
577
578#endif /* __fw_error_dump_h__ */