Path: blob/main/sys/contrib/dev/iwlwifi/fw/api/debug.h
48427 views
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */1/*2* Copyright (C) 2005-2014, 2018-2025 Intel Corporation3* Copyright (C) 2013-2015 Intel Mobile Communications GmbH4* Copyright (C) 2016-2017 Intel Deutschland GmbH5*/6#ifndef __iwl_fw_api_debug_h__7#define __iwl_fw_api_debug_h__8#include "dbg-tlv.h"910/**11* enum iwl_debug_cmds - debug commands12*/13enum iwl_debug_cmds {14/**15* @LMAC_RD_WR:16* LMAC memory read/write, using &struct iwl_dbg_mem_access_cmd and17* &struct iwl_dbg_mem_access_rsp18*/19LMAC_RD_WR = 0x0,20/**21* @UMAC_RD_WR:22* UMAC memory read/write, using &struct iwl_dbg_mem_access_cmd and23* &struct iwl_dbg_mem_access_rsp24*/25UMAC_RD_WR = 0x1,26/**27* @HOST_EVENT_CFG:28* updates the enabled event severities29* &struct iwl_dbg_host_event_cfg_cmd30*/31HOST_EVENT_CFG = 0x3,32/**33* @INVALID_WR_PTR_CMD: invalid write pointer, set in the TFD34* when it's not in use35*/36INVALID_WR_PTR_CMD = 0x6,37/**38* @DBGC_SUSPEND_RESUME:39* DBGC suspend/resume commad. Uses a single dword as data:40* 0 - resume DBGC recording41* 1 - suspend DBGC recording42*/43DBGC_SUSPEND_RESUME = 0x7,44/**45* @BUFFER_ALLOCATION:46* passes DRAM buffers to a DBGC47* &struct iwl_buf_alloc_cmd48*/49BUFFER_ALLOCATION = 0x8,50/**51* @GET_TAS_STATUS:52* sends command to fw to get TAS status53* the response is &struct iwl_tas_status_resp54*/55GET_TAS_STATUS = 0xA,56/**57* @FW_DUMP_COMPLETE_CMD:58* sends command to fw once dump collection completed59* &struct iwl_dbg_dump_complete_cmd60*/61FW_DUMP_COMPLETE_CMD = 0xB,62/**63* @FW_CLEAR_BUFFER:64* clears the firmware's internal buffer65* no payload66*/67FW_CLEAR_BUFFER = 0xD,68/**69* @MFU_ASSERT_DUMP_NTF:70* &struct iwl_mfu_assert_dump_notif71*/72MFU_ASSERT_DUMP_NTF = 0xFE,73};7475/* Error response/notification */76enum {77FW_ERR_UNKNOWN_CMD = 0x0,78FW_ERR_INVALID_CMD_PARAM = 0x1,79FW_ERR_SERVICE = 0x2,80FW_ERR_ARC_MEMORY = 0x3,81FW_ERR_ARC_CODE = 0x4,82FW_ERR_WATCH_DOG = 0x5,83FW_ERR_WEP_GRP_KEY_INDX = 0x10,84FW_ERR_WEP_KEY_SIZE = 0x11,85FW_ERR_OBSOLETE_FUNC = 0x12,86FW_ERR_UNEXPECTED = 0xFE,87FW_ERR_FATAL = 0xFF88};8990/** enum iwl_dbg_suspend_resume_cmds - dbgc suspend resume operations91* dbgc suspend resume command operations92* @DBGC_RESUME_CMD: resume dbgc recording93* @DBGC_SUSPEND_CMD: stop dbgc recording94*/95enum iwl_dbg_suspend_resume_cmds {96DBGC_RESUME_CMD,97DBGC_SUSPEND_CMD,98};99100/**101* struct iwl_error_resp - FW error indication102* ( REPLY_ERROR = 0x2 )103* @error_type: one of FW_ERR_*104* @cmd_id: the command ID for which the error occurred105* @reserved1: reserved106* @bad_cmd_seq_num: sequence number of the erroneous command107* @error_service: which service created the error, applicable only if108* error_type = 2, otherwise 0109* @timestamp: TSF in usecs.110*/111struct iwl_error_resp {112__le32 error_type;113u8 cmd_id;114u8 reserved1;115__le16 bad_cmd_seq_num;116__le32 error_service;117__le64 timestamp;118} __packed;119120#define TX_FIFO_MAX_NUM_9000 8121#define TX_FIFO_MAX_NUM 15122#define RX_FIFO_MAX_NUM 2123#define TX_FIFO_INTERNAL_MAX_NUM 6124125/**126* struct iwl_shared_mem_cfg_v2 - Shared memory configuration information127*128* @shared_mem_addr: shared memory addr (pre 8000 HW set to 0x0 as MARBH is not129* accessible)130* @shared_mem_size: shared memory size131* @sample_buff_addr: internal sample (mon/adc) buff addr (pre 8000 HW set to132* 0x0 as accessible only via DBGM RDAT)133* @sample_buff_size: internal sample buff size134* @txfifo_addr: start addr of TXF0 (excluding the context table 0.5KB), (pre135* 8000 HW set to 0x0 as not accessible)136* @txfifo_size: size of TXF0 ... TXF7137* @rxfifo_size: RXF1, RXF2 sizes. If there is no RXF2, it'll have a value of 0138* @page_buff_addr: used by UMAC and performance debug (page miss analysis),139* when paging is not supported this should be 0140* @page_buff_size: size of %page_buff_addr141* @rxfifo_addr: Start address of rxFifo142* @internal_txfifo_addr: start address of internalFifo143* @internal_txfifo_size: internal fifos' size144*145* NOTE: on firmware that don't have IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG146* set, the last 3 members don't exist.147*/148struct iwl_shared_mem_cfg_v2 {149__le32 shared_mem_addr;150__le32 shared_mem_size;151__le32 sample_buff_addr;152__le32 sample_buff_size;153__le32 txfifo_addr;154__le32 txfifo_size[TX_FIFO_MAX_NUM_9000];155__le32 rxfifo_size[RX_FIFO_MAX_NUM];156__le32 page_buff_addr;157__le32 page_buff_size;158__le32 rxfifo_addr;159__le32 internal_txfifo_addr;160__le32 internal_txfifo_size[TX_FIFO_INTERNAL_MAX_NUM];161} __packed; /* SHARED_MEM_ALLOC_API_S_VER_2 */162163/**164* struct iwl_shared_mem_lmac_cfg - LMAC shared memory configuration165*166* @txfifo_addr: start addr of TXF0 (excluding the context table 0.5KB)167* @txfifo_size: size of TX FIFOs168* @rxfifo1_addr: RXF1 addr169* @rxfifo1_size: RXF1 size170*/171struct iwl_shared_mem_lmac_cfg {172__le32 txfifo_addr;173__le32 txfifo_size[TX_FIFO_MAX_NUM];174__le32 rxfifo1_addr;175__le32 rxfifo1_size;176177} __packed; /* SHARED_MEM_ALLOC_LMAC_API_S_VER_1 */178179/**180* struct iwl_shared_mem_cfg - Shared memory configuration information181*182* @shared_mem_addr: shared memory address183* @shared_mem_size: shared memory size184* @sample_buff_addr: internal sample (mon/adc) buff addr185* @sample_buff_size: internal sample buff size186* @rxfifo2_addr: start addr of RXF2187* @rxfifo2_size: size of RXF2188* @page_buff_addr: used by UMAC and performance debug (page miss analysis),189* when paging is not supported this should be 0190* @page_buff_size: size of %page_buff_addr191* @lmac_num: number of LMACs (1 or 2)192* @lmac_smem: per - LMAC smem data193* @rxfifo2_control_addr: start addr of RXF2C194* @rxfifo2_control_size: size of RXF2C195*/196struct iwl_shared_mem_cfg {197__le32 shared_mem_addr;198__le32 shared_mem_size;199__le32 sample_buff_addr;200__le32 sample_buff_size;201__le32 rxfifo2_addr;202__le32 rxfifo2_size;203__le32 page_buff_addr;204__le32 page_buff_size;205__le32 lmac_num;206struct iwl_shared_mem_lmac_cfg lmac_smem[3];207__le32 rxfifo2_control_addr;208__le32 rxfifo2_control_size;209} __packed; /* SHARED_MEM_ALLOC_API_S_VER_4 */210211/**212* struct iwl_mfuart_load_notif_v1 - mfuart image version & status213* ( MFUART_LOAD_NOTIFICATION = 0xb1 )214* @installed_ver: installed image version215* @external_ver: external image version216* @status: MFUART loading status217* @duration: MFUART loading time218*/219struct iwl_mfuart_load_notif_v1 {220__le32 installed_ver;221__le32 external_ver;222__le32 status;223__le32 duration;224} __packed; /* MFU_LOADER_NTFY_API_S_VER_1 */225226/**227* struct iwl_mfuart_load_notif - mfuart image version & status228* ( MFUART_LOAD_NOTIFICATION = 0xb1 )229* @installed_ver: installed image version230* @external_ver: external image version231* @status: MFUART loading status232* @duration: MFUART loading time233* @image_size: MFUART image size in bytes234*/235struct iwl_mfuart_load_notif {236__le32 installed_ver;237__le32 external_ver;238__le32 status;239__le32 duration;240/* image size valid only in v2 of the command */241__le32 image_size;242} __packed; /* MFU_LOADER_NTFY_API_S_VER_2 */243244/**245* struct iwl_mfu_assert_dump_notif - mfuart dump logs246* ( MFU_ASSERT_DUMP_NTF = 0xfe )247* @assert_id: mfuart assert id that cause the notif248* @curr_reset_num: number of asserts since uptime249* @index_num: current chunk id250* @parts_num: total number of chunks251* @data_size: number of data bytes sent252* @data: data buffer253*/254struct iwl_mfu_assert_dump_notif {255__le32 assert_id;256__le32 curr_reset_num;257__le16 index_num;258__le16 parts_num;259__le32 data_size;260__le32 data[];261} __packed; /* MFU_DUMP_ASSERT_API_S_VER_1 */262263/**264* enum iwl_mvm_marker_id - marker ids265*266* The ids for different type of markers to insert into the usniffer logs267*268* @MARKER_ID_TX_FRAME_LATENCY: TX latency marker269* @MARKER_ID_SYNC_CLOCK: sync FW time and systime270*/271enum iwl_mvm_marker_id {272MARKER_ID_TX_FRAME_LATENCY = 1,273MARKER_ID_SYNC_CLOCK = 2,274}; /* MARKER_ID_API_E_VER_2 */275276/**277* struct iwl_mvm_marker - mark info into the usniffer logs278*279* (MARKER_CMD = 0xcb)280*281* Mark the UTC time stamp into the usniffer logs together with additional282* metadata, so the usniffer output can be parsed.283* In the command response the ucode will return the GP2 time.284*285* @dw_len: The amount of dwords following this byte including this byte.286* @marker_id: A unique marker id (iwl_mvm_marker_id).287* @reserved: reserved.288* @timestamp: in milliseconds since 1970-01-01 00:00:00 UTC289* @metadata: additional meta data that will be written to the unsiffer log290*/291struct iwl_mvm_marker {292u8 dw_len;293u8 marker_id;294__le16 reserved;295__le64 timestamp;296__le32 metadata[];297} __packed; /* MARKER_API_S_VER_1 */298299/**300* struct iwl_mvm_marker_rsp - Response to marker cmd301*302* @gp2: The gp2 clock value in the FW303*/304struct iwl_mvm_marker_rsp {305__le32 gp2;306} __packed;307308/* Operation types for the debug mem access */309enum {310DEBUG_MEM_OP_READ = 0,311DEBUG_MEM_OP_WRITE = 1,312DEBUG_MEM_OP_WRITE_BYTES = 2,313};314315#define DEBUG_MEM_MAX_SIZE_DWORDS 32316317/**318* struct iwl_dbg_mem_access_cmd - Request the device to read/write memory319* @op: DEBUG_MEM_OP_*320* @addr: address to read/write from/to321* @len: in dwords, to read/write322* @data: for write opeations, contains the source buffer323*/324struct iwl_dbg_mem_access_cmd {325__le32 op;326__le32 addr;327__le32 len;328__le32 data[];329} __packed; /* DEBUG_(U|L)MAC_RD_WR_CMD_API_S_VER_1 */330331/* Status responses for the debug mem access */332enum {333DEBUG_MEM_STATUS_SUCCESS = 0x0,334DEBUG_MEM_STATUS_FAILED = 0x1,335DEBUG_MEM_STATUS_LOCKED = 0x2,336DEBUG_MEM_STATUS_HIDDEN = 0x3,337DEBUG_MEM_STATUS_LENGTH = 0x4,338};339340/**341* struct iwl_dbg_mem_access_rsp - Response to debug mem commands342* @status: DEBUG_MEM_STATUS_*343* @len: read dwords (0 for write operations)344* @data: contains the read DWs345*/346struct iwl_dbg_mem_access_rsp {347__le32 status;348__le32 len;349__le32 data[];350} __packed; /* DEBUG_(U|L)MAC_RD_WR_RSP_API_S_VER_1 */351352/**353* struct iwl_dbg_suspend_resume_cmd - dbgc suspend resume command354* @operation: suspend or resume operation, uses355* &enum iwl_dbg_suspend_resume_cmds356*/357struct iwl_dbg_suspend_resume_cmd {358__le32 operation;359} __packed;360361#define BUF_ALLOC_MAX_NUM_FRAGS 16362363/**364* struct iwl_buf_alloc_frag - a DBGC fragment365* @addr: base address of the fragment366* @size: size of the fragment367*/368struct iwl_buf_alloc_frag {369__le64 addr;370__le32 size;371} __packed; /* FRAGMENT_STRUCTURE_API_S_VER_1 */372373/**374* struct iwl_buf_alloc_cmd - buffer allocation command375* @alloc_id: &enum iwl_fw_ini_allocation_id376* @buf_location: &enum iwl_fw_ini_buffer_location377* @num_frags: number of fragments378* @frags: fragments array379*/380struct iwl_buf_alloc_cmd {381__le32 alloc_id;382__le32 buf_location;383__le32 num_frags;384struct iwl_buf_alloc_frag frags[BUF_ALLOC_MAX_NUM_FRAGS];385} __packed; /* BUFFER_ALLOCATION_CMD_API_S_VER_2 */386387#define DRAM_INFO_FIRST_MAGIC_WORD 0x76543210388#define DRAM_INFO_SECOND_MAGIC_WORD 0x89ABCDEF389390/**391* struct iwl_dram_info - DRAM fragments allocation struct392*393* Driver will fill in the first 1K(+) of the pointed DRAM fragment394*395* @first_word: magic word value396* @second_word: magic word value397* @dram_frags: DRAM fragmentaion detail398*/399struct iwl_dram_info {400__le32 first_word;401__le32 second_word;402struct iwl_buf_alloc_cmd dram_frags[IWL_FW_INI_ALLOCATION_NUM - 1];403} __packed; /* INIT_DRAM_FRAGS_ALLOCATIONS_S_VER_1 */404405/**406* struct iwl_dbgc1_info - DBGC1 address and size407*408* Driver will fill the dbcg1 address and size at address based on config TLV.409*410* @first_word: all 0 set as identifier411* @dbgc1_add_lsb: LSB bits of DBGC1 physical address412* @dbgc1_add_msb: MSB bits of DBGC1 physical address413* @dbgc1_size: DBGC1 size414*/415struct iwl_dbgc1_info {416__le32 first_word;417__le32 dbgc1_add_lsb;418__le32 dbgc1_add_msb;419__le32 dbgc1_size;420} __packed; /* INIT_DRAM_FRAGS_ALLOCATIONS_S_VER_1 */421422/**423* struct iwl_dbg_host_event_cfg_cmd424* @enabled_severities: enabled severities425*/426struct iwl_dbg_host_event_cfg_cmd {427__le32 enabled_severities;428} __packed; /* DEBUG_HOST_EVENT_CFG_CMD_API_S_VER_1 */429430/**431* struct iwl_dbg_dump_complete_cmd - dump complete cmd432*433* @tp: timepoint whose dump has completed434* @tp_data: timepoint data435*/436struct iwl_dbg_dump_complete_cmd {437__le32 tp;438__le32 tp_data;439} __packed; /* FW_DUMP_COMPLETE_CMD_API_S_VER_1 */440441/**442* struct iwl_tas_status_per_mac - tas status per lmac443* @static_status: tas statically enabled or disabled per lmac - TRUE/FALSE444* @static_dis_reason: TAS static disable reason, uses445* &enum iwl_tas_statically_disabled_reason446* @dynamic_status: Current TAS status. uses447* &enum iwl_tas_dyna_status448* @near_disconnection: is TAS currently near disconnection per lmac? - TRUE/FALSE449* @max_reg_pwr_limit: Regulatory power limits in dBm450* @sar_limit: SAR limits per lmac in dBm451* @band: Band per lmac452* @reserved: reserved453*/454struct iwl_tas_status_per_mac {455u8 static_status;456u8 static_dis_reason;457u8 dynamic_status;458u8 near_disconnection;459__le16 max_reg_pwr_limit;460__le16 sar_limit;461u8 band;462u8 reserved[3];463} __packed; /* DEBUG_GET_TAS_STATUS_PER_MAC_S_VER_1 */464465/**466* struct iwl_tas_status_resp - Response to GET_TAS_STATUS467* @tas_fw_version: TAS FW version468* @is_uhb_for_usa_enable: is UHB enabled in USA? - TRUE/FALSE469* @curr_mcc: current mcc470* @block_list: country block list471* @tas_status_mac: TAS status per lmac, uses472* &struct iwl_tas_status_per_mac473* @in_dual_radio: is TAS in dual radio? - TRUE/FALSE474* @uhb_allowed_flags: see &enum iwl_tas_uhb_allowed_flags.475* This member is valid only when fw has476* %IWL_UCODE_TLV_CAPA_UHB_CANADA_TAS_SUPPORT capability.477* @reserved: reserved478*/479struct iwl_tas_status_resp {480u8 tas_fw_version;481u8 is_uhb_for_usa_enable;482__le16 curr_mcc;483__le16 block_list[16];484struct iwl_tas_status_per_mac tas_status_mac[2];485u8 in_dual_radio;486u8 uhb_allowed_flags;487u8 reserved[2];488} __packed; /* DEBUG_GET_TAS_STATUS_RSP_API_S_VER_3 */489490/**491* enum iwl_tas_dyna_status - TAS current running status492* @TAS_DYNA_INACTIVE: TAS status is inactive493* @TAS_DYNA_INACTIVE_MVM_MODE: TAS is disabled due because FW is in MVM mode494* or is in softap mode.495* @TAS_DYNA_INACTIVE_TRIGGER_MODE: TAS is disabled because FW is in496* multi user trigger mode497* @TAS_DYNA_INACTIVE_BLOCK_LISTED: TAS is disabled because current mcc498* is blocklisted mcc499* @TAS_DYNA_INACTIVE_UHB_NON_US: TAS is disabled because current band is UHB500* and current mcc is USA501* @TAS_DYNA_ACTIVE: TAS is currently active502* @TAS_DYNA_STATUS_MAX: TAS status max value503*/504enum iwl_tas_dyna_status {505TAS_DYNA_INACTIVE,506TAS_DYNA_INACTIVE_MVM_MODE,507TAS_DYNA_INACTIVE_TRIGGER_MODE,508TAS_DYNA_INACTIVE_BLOCK_LISTED,509TAS_DYNA_INACTIVE_UHB_NON_US,510TAS_DYNA_ACTIVE,511512TAS_DYNA_STATUS_MAX,513};514515/**516* enum iwl_tas_statically_disabled_reason - TAS statically disabled reason517* @TAS_DISABLED_DUE_TO_BIOS: TAS is disabled because TAS is disabled in BIOS518* @TAS_DISABLED_DUE_TO_SAR_6DBM: TAS is disabled because SAR limit is less than 6 Dbm519* @TAS_DISABLED_REASON_INVALID: TAS disable reason is invalid520* @TAS_DISABLED_DUE_TO_TABLE_SOURCE_INVALID: TAS is disabled due to521* table source invalid522* @TAS_DISABLED_REASON_MAX: TAS disable reason max value523*/524enum iwl_tas_statically_disabled_reason {525TAS_DISABLED_DUE_TO_BIOS,526TAS_DISABLED_DUE_TO_SAR_6DBM,527TAS_DISABLED_REASON_INVALID,528TAS_DISABLED_DUE_TO_TABLE_SOURCE_INVALID,529530TAS_DISABLED_REASON_MAX,531}; /*_TAS_STATICALLY_DISABLED_REASON_E*/532533/**534* enum iwl_fw_dbg_config_cmd_type - types of FW debug config command535* @DEBUG_TOKEN_CONFIG_TYPE: token config type536*/537enum iwl_fw_dbg_config_cmd_type {538DEBUG_TOKEN_CONFIG_TYPE = 0x2B,539}; /* LDBG_CFG_CMD_TYPE_API_E_VER_1 */540541/* this token disables debug asserts in the firmware */542#define IWL_FW_DBG_CONFIG_TOKEN 0x00010001543544/**545* struct iwl_fw_dbg_config_cmd - configure FW debug546*547* @type: according to &enum iwl_fw_dbg_config_cmd_type548* @conf: FW configuration549*/550struct iwl_fw_dbg_config_cmd {551__le32 type;552__le32 conf;553} __packed; /* LDBG_CFG_CMD_API_S_VER_7 */554555#endif /* __iwl_fw_api_debug_h__ */556557558