Path: blob/main/sys/contrib/dev/iwlwifi/fw/error-dump.h
48287 views
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */1/*2* Copyright (C) 2014, 2018-2025 Intel Corporation3* Copyright (C) 2014-2015 Intel Mobile Communications GmbH4* Copyright (C) 2016-2017 Intel Deutschland GmbH5*/6#ifndef __fw_error_dump_h__7#define __fw_error_dump_h__89#include <linux/types.h>10#include "fw/api/cmdhdr.h"1112#define IWL_FW_ERROR_DUMP_BARKER 0x1478963213#define IWL_FW_INI_ERROR_DUMP_BARKER 0x147896331415/**16* enum iwl_fw_error_dump_type - types of data in the dump file17* @IWL_FW_ERROR_DUMP_CSR: Control Status Registers - from offset 018* @IWL_FW_ERROR_DUMP_RXF: RX FIFO contents19* @IWL_FW_ERROR_DUMP_TXCMD: last TX command data, structured as20* &struct iwl_fw_error_dump_txcmd packets21* @IWL_FW_ERROR_DUMP_DEV_FW_INFO: struct %iwl_fw_error_dump_info22* info on the device / firmware.23* @IWL_FW_ERROR_DUMP_FW_MONITOR: firmware monitor24* @IWL_FW_ERROR_DUMP_PRPH: range of periphery registers - there can be several25* sections like this in a single file.26* @IWL_FW_ERROR_DUMP_TXF: TX FIFO contents27* @IWL_FW_ERROR_DUMP_FH_REGS: range of FH registers28* @IWL_FW_ERROR_DUMP_MEM: chunk of memory29* @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 as32* &struct iwl_fw_error_dump_rb33* @IWL_FW_ERROR_DUMP_PAGING: UMAC's image memory segments which were34* paged to the DRAM.35* @IWL_FW_ERROR_DUMP_RADIO_REG: Dump the radio registers.36* @IWL_FW_ERROR_DUMP_INTERNAL_TXF: internal TX FIFO data37* @IWL_FW_ERROR_DUMP_EXTERNAL: used only by external code utilities, and38* for that reason is not in use in any other place in the Linux Wi-Fi39* stack.40* @IWL_FW_ERROR_DUMP_MEM_CFG: the addresses and sizes of fifos in the smem,41* which we get from the fw after ALIVE. The content is structured as42* &struct iwl_fw_error_dump_smem_cfg.43* @IWL_FW_ERROR_DUMP_D3_DEBUG_DATA: D3 debug data44*/45enum iwl_fw_error_dump_type {46/* 0 is deprecated */47IWL_FW_ERROR_DUMP_CSR = 1,48IWL_FW_ERROR_DUMP_RXF = 2,49IWL_FW_ERROR_DUMP_TXCMD = 3,50IWL_FW_ERROR_DUMP_DEV_FW_INFO = 4,51IWL_FW_ERROR_DUMP_FW_MONITOR = 5,52IWL_FW_ERROR_DUMP_PRPH = 6,53IWL_FW_ERROR_DUMP_TXF = 7,54IWL_FW_ERROR_DUMP_FH_REGS = 8,55IWL_FW_ERROR_DUMP_MEM = 9,56IWL_FW_ERROR_DUMP_ERROR_INFO = 10,57IWL_FW_ERROR_DUMP_RB = 11,58IWL_FW_ERROR_DUMP_PAGING = 12,59IWL_FW_ERROR_DUMP_RADIO_REG = 13,60IWL_FW_ERROR_DUMP_INTERNAL_TXF = 14,61IWL_FW_ERROR_DUMP_EXTERNAL = 15, /* Do not move */62IWL_FW_ERROR_DUMP_MEM_CFG = 16,63IWL_FW_ERROR_DUMP_D3_DEBUG_DATA = 17,64};6566/**67* struct iwl_fw_error_dump_data - data for one type68* @type: &enum iwl_fw_error_dump_type69* @len: the length starting from %data70* @data: the data itself71*/72struct iwl_fw_error_dump_data {73__le32 type;74__le32 len;75__u8 data[];76} __packed;7778/**79* struct iwl_dump_file_name_info - data for dump file name addition80* @type: region type with reserved bits81* @len: the length of file name string to be added to dump file82* @data: the string need to be added to dump file83*/84struct iwl_dump_file_name_info {85__le32 type;86__le32 len;87__u8 data[];88} __packed;8990/**91* struct iwl_fw_error_dump_file - the layout of the header of the file92* @barker: must be %IWL_FW_ERROR_DUMP_BARKER93* @file_len: the length of all the file starting from %barker94* @data: array of &struct iwl_fw_error_dump_data95*/96struct iwl_fw_error_dump_file {97__le32 barker;98__le32 file_len;99u8 data[];100} __packed;101102/**103* struct iwl_fw_error_dump_txcmd - TX command data104* @cmdlen: original length of command105* @caplen: captured length of command (may be less)106* @data: captured command data, @caplen bytes107*/108struct iwl_fw_error_dump_txcmd {109__le32 cmdlen;110__le32 caplen;111u8 data[];112} __packed;113114/**115* struct iwl_fw_error_dump_fifo - RX/TX FIFO data116* @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 pointer119* @rd_ptr: position of read pointer120* @fence_ptr: position of fence pointer121* @fence_mode: the current mode of the fence (before locking) -122* 0=follow RD pointer ; 1 = freeze123* @data: all of the FIFO's data124*/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;132u8 data[];133} __packed;134135enum iwl_fw_error_dump_family {136IWL_FW_ERROR_DUMP_FAMILY_7 = 7,137IWL_FW_ERROR_DUMP_FAMILY_8 = 8,138};139140#define MAX_NUM_LMAC 2141142/**143* struct iwl_fw_error_dump_info - info on the device / firmware144* @hw_type: the type of the device145* @hw_step: the step of the device146* @fw_human_readable: human readable FW version147* @dev_human_readable: name of the device148* @bus_human_readable: name of the bus used149* @num_of_lmacs: the number of lmacs150* @lmac_err_id: the lmac 0/1 error_id/rt_status that triggered the latest dump151* if the dump collection was not initiated by an assert, the value is 0152* @umac_err_id: the umac error_id/rt_status that triggered the latest dump153* if the dump collection was not initiated by an assert, the value is 0154*/155struct iwl_fw_error_dump_info {156__le32 hw_type;157__le32 hw_step;158u8 fw_human_readable[FW_VER_HUMAN_READABLE_SZ];159u8 dev_human_readable[64];160u8 bus_human_readable[8];161u8 num_of_lmacs;162__le32 umac_err_id;163__le32 lmac_err_id[MAX_NUM_LMAC];164} __packed;165166/**167* struct iwl_fw_error_dump_fw_mon - FW monitor data168* @fw_mon_wr_ptr: the position of the write pointer in the cyclic buffer169* @fw_mon_base_ptr: base pointer of the data170* @fw_mon_cycle_cnt: number of wraparounds171* @fw_mon_base_high_ptr: used in AX210 devices, the base address is 64 bit172* so fw_mon_base_ptr holds LSB 32 bits and fw_mon_base_high_ptr hold173* MSB 32 bits174* @reserved: for future use175* @data: captured data176*/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];183u8 data[];184} __packed;185186#define MAX_NUM_LMAC 2187#define TX_FIFO_INTERNAL_MAX_NUM 6188#define TX_FIFO_MAX_NUM 15189/**190* struct iwl_fw_error_dump_smem_cfg - Dump SMEM configuration191* This must follow &struct iwl_fwrt_shared_mem_cfg.192* @num_lmacs: number of lmacs193* @num_txfifo_entries: number of tx fifos194* @lmac: sizes of lmacs txfifos and rxfifo1195* @rxfifo2_size: size of rxfifo2196* @internal_txfifo_addr: address of internal tx fifo197* @internal_txfifo_size: size of internal tx fifo198*/199struct iwl_fw_error_dump_smem_cfg {200__le32 num_lmacs;201__le32 num_txfifo_entries;202struct {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 data212* @prph_start: address of the first register in this chunk213* @data: the content of the registers214*/215struct iwl_fw_error_dump_prph {216__le32 prph_start;217__le32 data[];218};219220enum iwl_fw_error_dump_mem_type {221IWL_FW_ERROR_DUMP_MEM_SRAM,222IWL_FW_ERROR_DUMP_MEM_SMEM,223IWL_FW_ERROR_DUMP_MEM_NAMED_MEM = 10,224};225226/**227* struct iwl_fw_error_dump_mem - chunk of memory228* @type: &enum iwl_fw_error_dump_mem_type229* @offset: the offset from which the memory was read230* @data: the content of the memory231*/232struct iwl_fw_error_dump_mem {233__le32 type;234__le32 offset;235u8 data[];236};237238/* Dump version, used by the dump parser to differentiate between239* different dump formats240*/241#define IWL_INI_DUMP_VER 1242243/* Use bit 31 as dump info type to avoid colliding with region types */244#define IWL_INI_DUMP_INFO_TYPE BIT(31)245246/* 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))248249/**250* struct iwl_fw_ini_error_dump_data - data for one type251* @type: &enum iwl_fw_ini_region_type252* @sub_type: sub type id253* @sub_type_ver: sub type version254* @reserved: not in use255* @len: the length starting from %data256* @data: the data itself257*/258struct iwl_fw_ini_error_dump_data {259u8 type;260u8 sub_type;261u8 sub_type_ver;262u8 reserved;263__le32 len;264__u8 data[];265} __packed;266267/**268* struct iwl_fw_ini_dump_entry269* @list: list of dump entries270* @size: size of the data271* @data: entry data272*/273struct iwl_fw_ini_dump_entry {274struct list_head list;275u32 size;276u8 data[];277} __packed;278279/**280* struct iwl_fw_ini_dump_file_hdr - header of dump file281* @barker: must be %IWL_FW_INI_ERROR_DUMP_BARKER282* @file_len: the length of all the file including the header283*/284struct iwl_fw_ini_dump_file_hdr {285__le32 barker;286__le32 file_len;287} __packed;288289/**290* struct iwl_fw_ini_fifo_hdr - fifo range header291* @fifo_num: the fifo number. In case of umac rx fifo, set BIT(31) to292* distinguish between lmac and umac rx fifos293* @num_of_registers: num of registers to dump, dword size each294*/295struct iwl_fw_ini_fifo_hdr {296__le32 fifo_num;297__le32 num_of_registers;298} __packed;299300/**301* struct iwl_fw_ini_error_dump_range - range of memory302* @range_data_size: the size of this range, in bytes303* @internal_base_addr: base address of internal memory range304* @dram_base_addr: base address of dram monitor range305* @page_num: page number of memory range306* @fifo_hdr: fifo header of memory range307* @fw_pkt: FW packet header of memory range308* @data: the actual memory309*/310struct iwl_fw_ini_error_dump_range {311__le32 range_data_size;312union {313__le32 internal_base_addr __packed;314__le64 dram_base_addr __packed;315__le32 page_num __packed;316struct iwl_fw_ini_fifo_hdr fifo_hdr;317struct iwl_cmd_header fw_pkt_hdr;318};319__le32 data[];320} __packed;321322/**323* struct iwl_fw_ini_error_dump_header - ini region dump header324* @version: dump version325* @region_id: id of the region326* @num_of_ranges: number of ranges in this region327* @name_len: number of bytes allocated to the name string of this region328* @name: name of the region329*/330struct iwl_fw_ini_error_dump_header {331__le32 version;332__le32 region_id;333__le32 num_of_ranges;334__le32 name_len;335u8 name[IWL_FW_INI_MAX_NAME];336};337338/**339* struct iwl_fw_ini_error_dump - ini region dump340* @header: the header of this region341* @data: data of memory ranges in this region,342* see &struct iwl_fw_ini_error_dump_range343*/344struct iwl_fw_ini_error_dump {345struct iwl_fw_ini_error_dump_header header;346u8 data[];347} __packed;348349/* This bit is used to differentiate between lmac and umac rxf */350#define IWL_RXF_UMAC_BIT BIT(31)351352/**353* struct iwl_fw_ini_error_dump_register - ini register dump354* @addr: address of the register355* @data: data of the register356*/357struct iwl_fw_ini_error_dump_register {358__le32 addr;359__le32 data;360} __packed;361362/**363* struct iwl_fw_ini_dump_cfg_name - configuration name364* @image_type: image type the configuration is related to365* @cfg_name_len: length of the configuration name366* @cfg_name: name of the configuraiton367*/368struct iwl_fw_ini_dump_cfg_name {369__le32 image_type;370__le32 cfg_name_len;371u8 cfg_name[IWL_FW_INI_MAX_CFG_NAME];372} __packed;373374#define IWL_JACKET_CDB_SHIFT 12375376/* struct iwl_fw_ini_dump_info - ini dump information377* @version: dump version378* @time_point: time point that caused the dump collection379* @trigger_reason: reason of the trigger380* @external_cfg_state: &enum iwl_ini_cfg_state381* @ver_type: FW version type382* @ver_subtype: FW version subype383* @hw_step: HW step384* @hw_type: HW type385* @rf_id_flavor: HW RF id flavor386* @rf_id_dash: HW RF id dash387* @rf_id_step: HW RF id step388* @rf_id_type: HW RF id type389* @lmac_major: lmac major version390* @lmac_minor: lmac minor version391* @umac_major: umac major version392* @umac_minor: umac minor version393* @fw_mon_mode: FW monitor mode &enum iwl_fw_ini_buffer_location394* @regions_mask: bitmap mask of regions ids in the dump395* @build_tag_len: length of the build tag396* @build_tag: build tag string397* @num_of_cfg_names: number of configuration name structs398* @cfg_names: configuration names399*/400struct iwl_fw_ini_dump_info {401__le32 version;402__le32 time_point;403__le32 trigger_reason;404__le32 external_cfg_state;405__le32 ver_type;406__le32 ver_subtype;407__le32 hw_step;408__le32 hw_type;409__le32 rf_id_flavor;410__le32 rf_id_dash;411__le32 rf_id_step;412__le32 rf_id_type;413__le32 lmac_major;414__le32 lmac_minor;415__le32 umac_major;416__le32 umac_minor;417__le32 fw_mon_mode;418__le64 regions_mask;419__le32 build_tag_len;420u8 build_tag[FW_VER_HUMAN_READABLE_SZ];421__le32 num_of_cfg_names;422struct iwl_fw_ini_dump_cfg_name cfg_names[];423} __packed;424425/**426* struct iwl_fw_ini_err_table_dump - ini error table dump427* @header: header of the region428* @version: error table version429* @data: data of memory ranges in this region,430* see &struct iwl_fw_ini_error_dump_range431*/432struct iwl_fw_ini_err_table_dump {433struct iwl_fw_ini_error_dump_header header;434__le32 version;435u8 data[];436} __packed;437438/**439* struct iwl_fw_error_dump_rb - content of an Receive Buffer440* @index: the index of the Receive Buffer in the Rx queue441* @rxq: the RB's Rx queue442* @reserved: reserved443* @data: the content of the Receive Buffer444*/445struct iwl_fw_error_dump_rb {446__le32 index;447__le32 rxq;448__le32 reserved;449u8 data[];450};451452/**453* struct iwl_fw_ini_monitor_dump - ini monitor dump454* @header: header of the region455* @write_ptr: write pointer position in the buffer456* @cycle_cnt: cycles count457* @cur_frag: current fragment in use458* @data: data of memory ranges in this region,459* see &struct iwl_fw_ini_error_dump_range460*/461struct iwl_fw_ini_monitor_dump {462struct iwl_fw_ini_error_dump_header header;463__le32 write_ptr;464__le32 cycle_cnt;465__le32 cur_frag;466u8 data[];467} __packed;468469/**470* struct iwl_fw_ini_special_device_memory - special device memory471* @header: header of the region472* @type: type of special memory473* @version: struct special memory version474* @data: data of memory ranges in this region,475* see &struct iwl_fw_ini_error_dump_range476*/477struct iwl_fw_ini_special_device_memory {478struct iwl_fw_ini_error_dump_header header;479__le16 type;480__le16 version;481u8 data[];482} __packed;483484/**485* struct iwl_fw_error_dump_paging - content of the UMAC's image page486* block on DRAM487* @index: the index of the page block488* @reserved: reserved489* @data: the content of the page block490*/491struct iwl_fw_error_dump_paging {492__le32 index;493__le32 reserved;494u8 data[];495};496497/**498* iwl_fw_error_next_data - advance fw error dump data pointer499* @data: previous data block500* Returns: next data block501*/502static inline struct iwl_fw_error_dump_data *503iwl_fw_error_next_data(struct iwl_fw_error_dump_data *data)504{505return (void *)(data->data + le32_to_cpu(data->len));506}507508/**509* enum iwl_fw_dbg_trigger - triggers available510*511* @FW_DBG_TRIGGER_INVALID: invalid trigger value512* @FW_DBG_TRIGGER_USER: trigger log collection by user513* This should not be defined as a trigger to the driver, but a value the514* driver should set to indicate that the trigger was initiated by the515* user.516* @FW_DBG_TRIGGER_FW_ASSERT: trigger log collection when the firmware asserts517* @FW_DBG_TRIGGER_MISSED_BEACONS: trigger log collection when beacons are518* missed.519* @FW_DBG_TRIGGER_CHANNEL_SWITCH: trigger log collection upon channel switch.520* @FW_DBG_TRIGGER_FW_NOTIF: trigger log collection when the firmware sends a521* command response or a notification.522* @FW_DBG_TRIGGER_MLME: trigger log collection upon MLME event.523* @FW_DBG_TRIGGER_STATS: trigger log collection upon statistics threshold.524* @FW_DBG_TRIGGER_RSSI: trigger log collection when the rssi of the beacon525* goes below a threshold.526* @FW_DBG_TRIGGER_TXQ_TIMERS: configures the timers for the Tx queue hang527* detection.528* @FW_DBG_TRIGGER_TIME_EVENT: trigger log collection upon time events related529* events.530* @FW_DBG_TRIGGER_BA: trigger log collection upon BlockAck related events.531* @FW_DBG_TRIGGER_TX_LATENCY: trigger log collection when the tx latency532* goes above a threshold.533* @FW_DBG_TRIGGER_TDLS: trigger log collection upon TDLS related events.534* @FW_DBG_TRIGGER_TX_STATUS: trigger log collection upon tx status when535* the firmware sends a tx reply.536* @FW_DBG_TRIGGER_ALIVE_TIMEOUT: trigger log collection if alive flow timeouts537* @FW_DBG_TRIGGER_DRIVER: trigger log collection upon a flow failure538* in the driver.539* @FW_DBG_TRIGGER_MAX: beyond triggers, number for sizing arrays etc.540*/541enum iwl_fw_dbg_trigger {542FW_DBG_TRIGGER_INVALID = 0,543FW_DBG_TRIGGER_USER,544FW_DBG_TRIGGER_FW_ASSERT,545FW_DBG_TRIGGER_MISSED_BEACONS,546FW_DBG_TRIGGER_CHANNEL_SWITCH,547FW_DBG_TRIGGER_FW_NOTIF,548FW_DBG_TRIGGER_MLME,549FW_DBG_TRIGGER_STATS,550FW_DBG_TRIGGER_RSSI,551FW_DBG_TRIGGER_TXQ_TIMERS,552FW_DBG_TRIGGER_TIME_EVENT,553FW_DBG_TRIGGER_BA,554FW_DBG_TRIGGER_TX_LATENCY,555FW_DBG_TRIGGER_TDLS,556FW_DBG_TRIGGER_TX_STATUS,557FW_DBG_TRIGGER_ALIVE_TIMEOUT,558FW_DBG_TRIGGER_DRIVER,559560/* must be last */561FW_DBG_TRIGGER_MAX,562};563564/**565* struct iwl_fw_error_dump_trigger_desc - describes the trigger condition566* @type: &enum iwl_fw_dbg_trigger567* @data: raw data about what happened568*/569struct iwl_fw_error_dump_trigger_desc {570__le32 type;571u8 data[];572};573574#endif /* __fw_error_dump_h__ */575576577