1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
3 * Copyright (C) 2005-2014, 2018-2024 Intel Corporation
4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5 * Copyright (C) 2016-2017 Intel Deutschland GmbH
7 #ifndef __iwl_fw_api_debug_h__
8 #define __iwl_fw_api_debug_h__
12 * enum iwl_debug_cmds - debug commands
17 * LMAC memory read/write, using &struct iwl_dbg_mem_access_cmd and
18 * &struct iwl_dbg_mem_access_rsp
23 * UMAC memory read/write, using &struct iwl_dbg_mem_access_cmd and
24 * &struct iwl_dbg_mem_access_rsp
29 * updates the enabled event severities
30 * &struct iwl_dbg_host_event_cfg_cmd
34 * @INVALID_WR_PTR_CMD: invalid write pointer, set in the TFD
35 * when it's not in use
37 INVALID_WR_PTR_CMD = 0x6,
39 * @DBGC_SUSPEND_RESUME:
40 * DBGC suspend/resume commad. Uses a single dword as data:
41 * 0 - resume DBGC recording
42 * 1 - suspend DBGC recording
44 DBGC_SUSPEND_RESUME = 0x7,
47 * passes DRAM buffers to a DBGC
48 * &struct iwl_buf_alloc_cmd
50 BUFFER_ALLOCATION = 0x8,
53 * sends command to fw to get TAS status
54 * the response is &struct iwl_mvm_tas_status_resp
58 * @FW_DUMP_COMPLETE_CMD:
59 * sends command to fw once dump collection completed
60 * &struct iwl_dbg_dump_complete_cmd
62 FW_DUMP_COMPLETE_CMD = 0xB,
65 * clears the firmware's internal buffer
68 FW_CLEAR_BUFFER = 0xD,
70 * @MFU_ASSERT_DUMP_NTF:
71 * &struct iwl_mfu_assert_dump_notif
73 MFU_ASSERT_DUMP_NTF = 0xFE,
76 /* Error response/notification */
78 FW_ERR_UNKNOWN_CMD = 0x0,
79 FW_ERR_INVALID_CMD_PARAM = 0x1,
81 FW_ERR_ARC_MEMORY = 0x3,
82 FW_ERR_ARC_CODE = 0x4,
83 FW_ERR_WATCH_DOG = 0x5,
84 FW_ERR_WEP_GRP_KEY_INDX = 0x10,
85 FW_ERR_WEP_KEY_SIZE = 0x11,
86 FW_ERR_OBSOLETE_FUNC = 0x12,
87 FW_ERR_UNEXPECTED = 0xFE,
91 /** enum iwl_dbg_suspend_resume_cmds - dbgc suspend resume operations
92 * dbgc suspend resume command operations
93 * @DBGC_RESUME_CMD: resume dbgc recording
94 * @DBGC_SUSPEND_CMD: stop dbgc recording
96 enum iwl_dbg_suspend_resume_cmds {
102 * struct iwl_error_resp - FW error indication
103 * ( REPLY_ERROR = 0x2 )
104 * @error_type: one of FW_ERR_*
105 * @cmd_id: the command ID for which the error occurred
106 * @reserved1: reserved
107 * @bad_cmd_seq_num: sequence number of the erroneous command
108 * @error_service: which service created the error, applicable only if
109 * error_type = 2, otherwise 0
110 * @timestamp: TSF in usecs.
112 struct iwl_error_resp {
116 __le16 bad_cmd_seq_num;
117 __le32 error_service;
121 #define TX_FIFO_MAX_NUM_9000 8
122 #define TX_FIFO_MAX_NUM 15
123 #define RX_FIFO_MAX_NUM 2
124 #define TX_FIFO_INTERNAL_MAX_NUM 6
127 * struct iwl_shared_mem_cfg_v2 - Shared memory configuration information
129 * @shared_mem_addr: shared memory addr (pre 8000 HW set to 0x0 as MARBH is not
131 * @shared_mem_size: shared memory size
132 * @sample_buff_addr: internal sample (mon/adc) buff addr (pre 8000 HW set to
133 * 0x0 as accessible only via DBGM RDAT)
134 * @sample_buff_size: internal sample buff size
135 * @txfifo_addr: start addr of TXF0 (excluding the context table 0.5KB), (pre
136 * 8000 HW set to 0x0 as not accessible)
137 * @txfifo_size: size of TXF0 ... TXF7
138 * @rxfifo_size: RXF1, RXF2 sizes. If there is no RXF2, it'll have a value of 0
139 * @page_buff_addr: used by UMAC and performance debug (page miss analysis),
140 * when paging is not supported this should be 0
141 * @page_buff_size: size of %page_buff_addr
142 * @rxfifo_addr: Start address of rxFifo
143 * @internal_txfifo_addr: start address of internalFifo
144 * @internal_txfifo_size: internal fifos' size
146 * NOTE: on firmware that don't have IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG
147 * set, the last 3 members don't exist.
149 struct iwl_shared_mem_cfg_v2 {
150 __le32 shared_mem_addr;
151 __le32 shared_mem_size;
152 __le32 sample_buff_addr;
153 __le32 sample_buff_size;
155 __le32 txfifo_size[TX_FIFO_MAX_NUM_9000];
156 __le32 rxfifo_size[RX_FIFO_MAX_NUM];
157 __le32 page_buff_addr;
158 __le32 page_buff_size;
160 __le32 internal_txfifo_addr;
161 __le32 internal_txfifo_size[TX_FIFO_INTERNAL_MAX_NUM];
162 } __packed; /* SHARED_MEM_ALLOC_API_S_VER_2 */
165 * struct iwl_shared_mem_lmac_cfg - LMAC shared memory configuration
167 * @txfifo_addr: start addr of TXF0 (excluding the context table 0.5KB)
168 * @txfifo_size: size of TX FIFOs
169 * @rxfifo1_addr: RXF1 addr
170 * @rxfifo1_size: RXF1 size
172 struct iwl_shared_mem_lmac_cfg {
174 __le32 txfifo_size[TX_FIFO_MAX_NUM];
178 } __packed; /* SHARED_MEM_ALLOC_LMAC_API_S_VER_1 */
181 * struct iwl_shared_mem_cfg - Shared memory configuration information
183 * @shared_mem_addr: shared memory address
184 * @shared_mem_size: shared memory size
185 * @sample_buff_addr: internal sample (mon/adc) buff addr
186 * @sample_buff_size: internal sample buff size
187 * @rxfifo2_addr: start addr of RXF2
188 * @rxfifo2_size: size of RXF2
189 * @page_buff_addr: used by UMAC and performance debug (page miss analysis),
190 * when paging is not supported this should be 0
191 * @page_buff_size: size of %page_buff_addr
192 * @lmac_num: number of LMACs (1 or 2)
193 * @lmac_smem: per - LMAC smem data
194 * @rxfifo2_control_addr: start addr of RXF2C
195 * @rxfifo2_control_size: size of RXF2C
197 struct iwl_shared_mem_cfg {
198 __le32 shared_mem_addr;
199 __le32 shared_mem_size;
200 __le32 sample_buff_addr;
201 __le32 sample_buff_size;
204 __le32 page_buff_addr;
205 __le32 page_buff_size;
207 struct iwl_shared_mem_lmac_cfg lmac_smem[3];
208 __le32 rxfifo2_control_addr;
209 __le32 rxfifo2_control_size;
210 } __packed; /* SHARED_MEM_ALLOC_API_S_VER_4 */
213 * struct iwl_mfuart_load_notif_v1 - mfuart image version & status
214 * ( MFUART_LOAD_NOTIFICATION = 0xb1 )
215 * @installed_ver: installed image version
216 * @external_ver: external image version
217 * @status: MFUART loading status
218 * @duration: MFUART loading time
220 struct iwl_mfuart_load_notif_v1 {
221 __le32 installed_ver;
225 } __packed; /* MFU_LOADER_NTFY_API_S_VER_1 */
228 * struct iwl_mfuart_load_notif - mfuart image version & status
229 * ( MFUART_LOAD_NOTIFICATION = 0xb1 )
230 * @installed_ver: installed image version
231 * @external_ver: external image version
232 * @status: MFUART loading status
233 * @duration: MFUART loading time
234 * @image_size: MFUART image size in bytes
236 struct iwl_mfuart_load_notif {
237 __le32 installed_ver;
241 /* image size valid only in v2 of the command */
243 } __packed; /* MFU_LOADER_NTFY_API_S_VER_2 */
246 * struct iwl_mfu_assert_dump_notif - mfuart dump logs
247 * ( MFU_ASSERT_DUMP_NTF = 0xfe )
248 * @assert_id: mfuart assert id that cause the notif
249 * @curr_reset_num: number of asserts since uptime
250 * @index_num: current chunk id
251 * @parts_num: total number of chunks
252 * @data_size: number of data bytes sent
255 struct iwl_mfu_assert_dump_notif {
257 __le32 curr_reset_num;
262 } __packed; /* MFU_DUMP_ASSERT_API_S_VER_1 */
265 * enum iwl_mvm_marker_id - marker ids
267 * The ids for different type of markers to insert into the usniffer logs
269 * @MARKER_ID_TX_FRAME_LATENCY: TX latency marker
270 * @MARKER_ID_SYNC_CLOCK: sync FW time and systime
272 enum iwl_mvm_marker_id {
273 MARKER_ID_TX_FRAME_LATENCY = 1,
274 MARKER_ID_SYNC_CLOCK = 2,
275 }; /* MARKER_ID_API_E_VER_2 */
278 * struct iwl_mvm_marker - mark info into the usniffer logs
280 * (MARKER_CMD = 0xcb)
282 * Mark the UTC time stamp into the usniffer logs together with additional
283 * metadata, so the usniffer output can be parsed.
284 * In the command response the ucode will return the GP2 time.
286 * @dw_len: The amount of dwords following this byte including this byte.
287 * @marker_id: A unique marker id (iwl_mvm_marker_id).
288 * @reserved: reserved.
289 * @timestamp: in milliseconds since 1970-01-01 00:00:00 UTC
290 * @metadata: additional meta data that will be written to the unsiffer log
292 struct iwl_mvm_marker {
298 } __packed; /* MARKER_API_S_VER_1 */
301 * struct iwl_mvm_marker_rsp - Response to marker cmd
303 * @gp2: The gp2 clock value in the FW
305 struct iwl_mvm_marker_rsp {
309 /* Operation types for the debug mem access */
311 DEBUG_MEM_OP_READ = 0,
312 DEBUG_MEM_OP_WRITE = 1,
313 DEBUG_MEM_OP_WRITE_BYTES = 2,
316 #define DEBUG_MEM_MAX_SIZE_DWORDS 32
319 * struct iwl_dbg_mem_access_cmd - Request the device to read/write memory
320 * @op: DEBUG_MEM_OP_*
321 * @addr: address to read/write from/to
322 * @len: in dwords, to read/write
323 * @data: for write opeations, contains the source buffer
325 struct iwl_dbg_mem_access_cmd {
330 } __packed; /* DEBUG_(U|L)MAC_RD_WR_CMD_API_S_VER_1 */
332 /* Status responses for the debug mem access */
334 DEBUG_MEM_STATUS_SUCCESS = 0x0,
335 DEBUG_MEM_STATUS_FAILED = 0x1,
336 DEBUG_MEM_STATUS_LOCKED = 0x2,
337 DEBUG_MEM_STATUS_HIDDEN = 0x3,
338 DEBUG_MEM_STATUS_LENGTH = 0x4,
342 * struct iwl_dbg_mem_access_rsp - Response to debug mem commands
343 * @status: DEBUG_MEM_STATUS_*
344 * @len: read dwords (0 for write operations)
345 * @data: contains the read DWs
347 struct iwl_dbg_mem_access_rsp {
351 } __packed; /* DEBUG_(U|L)MAC_RD_WR_RSP_API_S_VER_1 */
354 * struct iwl_dbg_suspend_resume_cmd - dbgc suspend resume command
355 * @operation: suspend or resume operation, uses
356 * &enum iwl_dbg_suspend_resume_cmds
358 struct iwl_dbg_suspend_resume_cmd {
362 #define BUF_ALLOC_MAX_NUM_FRAGS 16
365 * struct iwl_buf_alloc_frag - a DBGC fragment
366 * @addr: base address of the fragment
367 * @size: size of the fragment
369 struct iwl_buf_alloc_frag {
372 } __packed; /* FRAGMENT_STRUCTURE_API_S_VER_1 */
375 * struct iwl_buf_alloc_cmd - buffer allocation command
376 * @alloc_id: &enum iwl_fw_ini_allocation_id
377 * @buf_location: &enum iwl_fw_ini_buffer_location
378 * @num_frags: number of fragments
379 * @frags: fragments array
381 struct iwl_buf_alloc_cmd {
385 struct iwl_buf_alloc_frag frags[BUF_ALLOC_MAX_NUM_FRAGS];
386 } __packed; /* BUFFER_ALLOCATION_CMD_API_S_VER_2 */
388 #define DRAM_INFO_FIRST_MAGIC_WORD 0x76543210
389 #define DRAM_INFO_SECOND_MAGIC_WORD 0x89ABCDEF
392 * struct iwl_dram_info - DRAM fragments allocation struct
394 * Driver will fill in the first 1K(+) of the pointed DRAM fragment
396 * @first_word: magic word value
397 * @second_word: magic word value
398 * @dram_frags: DRAM fragmentaion detail
400 struct iwl_dram_info {
403 struct iwl_buf_alloc_cmd dram_frags[IWL_FW_INI_ALLOCATION_NUM - 1];
404 } __packed; /* INIT_DRAM_FRAGS_ALLOCATIONS_S_VER_1 */
407 * struct iwl_dbgc1_info - DBGC1 address and size
409 * Driver will fill the dbcg1 address and size at address based on config TLV.
411 * @first_word: all 0 set as identifier
412 * @dbgc1_add_lsb: LSB bits of DBGC1 physical address
413 * @dbgc1_add_msb: MSB bits of DBGC1 physical address
414 * @dbgc1_size: DBGC1 size
416 struct iwl_dbgc1_info {
418 __le32 dbgc1_add_lsb;
419 __le32 dbgc1_add_msb;
421 } __packed; /* INIT_DRAM_FRAGS_ALLOCATIONS_S_VER_1 */
424 * struct iwl_dbg_host_event_cfg_cmd
425 * @enabled_severities: enabled severities
427 struct iwl_dbg_host_event_cfg_cmd {
428 __le32 enabled_severities;
429 } __packed; /* DEBUG_HOST_EVENT_CFG_CMD_API_S_VER_1 */
432 * struct iwl_dbg_dump_complete_cmd - dump complete cmd
434 * @tp: timepoint whose dump has completed
435 * @tp_data: timepoint data
437 struct iwl_dbg_dump_complete_cmd {
440 } __packed; /* FW_DUMP_COMPLETE_CMD_API_S_VER_1 */
442 #define TAS_LMAC_BAND_HB 0
443 #define TAS_LMAC_BAND_LB 1
444 #define TAS_LMAC_BAND_UHB 2
445 #define TAS_LMAC_BAND_INVALID 3
448 * struct iwl_mvm_tas_status_per_mac - tas status per lmac
449 * @static_status: tas statically enabled or disabled per lmac - TRUE/FALSE
450 * @static_dis_reason: TAS static disable reason, uses
451 * &enum iwl_mvm_tas_statically_disabled_reason
452 * @dynamic_status: Current TAS status. uses
453 * &enum iwl_mvm_tas_dyna_status
454 * @near_disconnection: is TAS currently near disconnection per lmac? - TRUE/FALSE
455 * @max_reg_pwr_limit: Regulatory power limits in dBm
456 * @sar_limit: SAR limits per lmac in dBm
457 * @band: Band per lmac
458 * @reserved: reserved
460 struct iwl_mvm_tas_status_per_mac {
462 u8 static_dis_reason;
464 u8 near_disconnection;
465 __le16 max_reg_pwr_limit;
469 } __packed; /*DEBUG_GET_TAS_STATUS_PER_MAC_S_VER_1*/
472 * struct iwl_mvm_tas_status_resp - Response to GET_TAS_STATUS
473 * @tas_fw_version: TAS FW version
474 * @is_uhb_for_usa_enable: is UHB enabled in USA? - TRUE/FALSE
475 * @curr_mcc: current mcc
476 * @block_list: country block list
477 * @tas_status_mac: TAS status per lmac, uses
478 * &struct iwl_mvm_tas_status_per_mac
479 * @in_dual_radio: is TAS in dual radio? - TRUE/FALSE
480 * @reserved: reserved
482 struct iwl_mvm_tas_status_resp {
484 u8 is_uhb_for_usa_enable;
486 __le16 block_list[16];
487 struct iwl_mvm_tas_status_per_mac tas_status_mac[2];
490 } __packed; /*DEBUG_GET_TAS_STATUS_RSP_API_S_VER_3*/
493 * enum iwl_mvm_tas_dyna_status - TAS current running status
494 * @TAS_DYNA_INACTIVE: TAS status is inactive
495 * @TAS_DYNA_INACTIVE_MVM_MODE: TAS is disabled due because FW is in MVM mode
496 * or is in softap mode.
497 * @TAS_DYNA_INACTIVE_TRIGGER_MODE: TAS is disabled because FW is in
498 * multi user trigger mode
499 * @TAS_DYNA_INACTIVE_BLOCK_LISTED: TAS is disabled because current mcc
501 * @TAS_DYNA_INACTIVE_UHB_NON_US: TAS is disabled because current band is UHB
502 * and current mcc is USA
503 * @TAS_DYNA_ACTIVE: TAS is currently active
504 * @TAS_DYNA_STATUS_MAX: TAS status max value
506 enum iwl_mvm_tas_dyna_status {
508 TAS_DYNA_INACTIVE_MVM_MODE,
509 TAS_DYNA_INACTIVE_TRIGGER_MODE,
510 TAS_DYNA_INACTIVE_BLOCK_LISTED,
511 TAS_DYNA_INACTIVE_UHB_NON_US,
515 }; /*_TAS_DYNA_STATUS_E*/
518 * enum iwl_mvm_tas_statically_disabled_reason - TAS statically disabled reason
519 * @TAS_DISABLED_DUE_TO_BIOS: TAS is disabled because TAS is disabled in BIOS
520 * @TAS_DISABLED_DUE_TO_SAR_6DBM: TAS is disabled because SAR limit is less than 6 Dbm
521 * @TAS_DISABLED_REASON_INVALID: TAS disable reason is invalid
522 * @TAS_DISABLED_REASON_MAX: TAS disable reason max value
524 enum iwl_mvm_tas_statically_disabled_reason {
525 TAS_DISABLED_DUE_TO_BIOS,
526 TAS_DISABLED_DUE_TO_SAR_6DBM,
527 TAS_DISABLED_REASON_INVALID,
529 TAS_DISABLED_REASON_MAX,
530 }; /*_TAS_STATICALLY_DISABLED_REASON_E*/
533 * enum iwl_fw_dbg_config_cmd_type - types of FW debug config command
534 * @DEBUG_TOKEN_CONFIG_TYPE: token config type
536 enum iwl_fw_dbg_config_cmd_type {
537 DEBUG_TOKEN_CONFIG_TYPE = 0x2B,
538 }; /* LDBG_CFG_CMD_TYPE_API_E_VER_1 */
540 /* this token disables debug asserts in the firmware */
541 #define IWL_FW_DBG_CONFIG_TOKEN 0x00010001
544 * struct iwl_fw_dbg_config_cmd - configure FW debug
546 * @type: according to &enum iwl_fw_dbg_config_cmd_type
547 * @conf: FW configuration
549 struct iwl_fw_dbg_config_cmd {
552 } __packed; /* LDBG_CFG_CMD_API_S_VER_7 */
554 #endif /* __iwl_fw_api_debug_h__ */