1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
3 * Copyright (C) 2018-2021 Intel Corporation
5 #ifndef __iwl_fw_dbg_tlv_h__
6 #define __iwl_fw_dbg_tlv_h__
8 #include <linux/bitops.h>
10 #define IWL_FW_INI_MAX_REGION_ID 64
11 #define IWL_FW_INI_MAX_NAME 32
12 #define IWL_FW_INI_MAX_CFG_NAME 64
13 #define IWL_FW_INI_DOMAIN_ALWAYS_ON 0
14 #define IWL_FW_INI_REGION_V2_MASK 0x0000FFFF
17 * struct iwl_fw_ini_hcmd
19 * @id: the debug configuration command type for instance: 0xf6 / 0xf5 / DHC
20 * @group: the desired cmd group
21 * @reserved: to align to FW struct
22 * @data: all of the relevant command data to be sent
24 struct iwl_fw_ini_hcmd {
29 } __packed; /* FW_DEBUG_TLV_HCMD_DATA_API_S_VER_1 */
32 * struct iwl_fw_ini_header - Common Header for all ini debug TLV's structures
34 * @version: TLV version
35 * @domain: domain of the TLV. One of &enum iwl_fw_ini_dbg_domain
38 struct iwl_fw_ini_header {
42 } __packed; /* FW_TLV_DEBUG_HEADER_S_VER_1 */
45 * struct iwl_fw_ini_region_dev_addr - Configuration to read device addresses
47 * @size: size of each memory chunk
48 * @offset: offset to add to the base address of each chunk
50 struct iwl_fw_ini_region_dev_addr {
53 } __packed; /* FW_TLV_DEBUG_DEVICE_ADDR_API_S_VER_1 */
56 * struct iwl_fw_ini_region_fifos - Configuration to read Tx/Rx fifos
58 * @fid: fifos ids array. Used to determine what fifos to collect
59 * @hdr_only: if non zero, collect only the registers
60 * @offset: offset to add to the registers addresses
62 struct iwl_fw_ini_region_fifos {
66 } __packed; /* FW_TLV_DEBUG_REGION_FIFOS_API_S_VER_1 */
69 * struct iwl_fw_ini_region_err_table - error table region data
71 * Configuration to read Umac/Lmac error table
73 * @version: version of the error table
74 * @base_addr: base address of the error table
75 * @size: size of the error table
76 * @offset: offset to add to &base_addr
78 struct iwl_fw_ini_region_err_table {
83 } __packed; /* FW_TLV_DEBUG_REGION_ERROR_TABLE_API_S_VER_1 */
86 * struct iwl_fw_ini_region_special_device_memory - special device memory
88 * Configuration to read a special memory
90 * @type: type of the special memory
91 * @version: version of the special memory
92 * @base_addr: base address of the error table
93 * @size: size of the error table
94 * @offset: offset to add to &base_addr
96 struct iwl_fw_ini_region_special_device_memory {
102 } __packed; /* FW_TLV_DEBUG_REGION_SPECIAL_DEVICE_ADDR_API_S_VER_1 */
105 * struct iwl_fw_ini_region_internal_buffer - internal buffer region data
107 * Configuration to read internal monitor buffer
109 * @alloc_id: allocation id one of &enum iwl_fw_ini_allocation_id
110 * @base_addr: internal buffer base address
111 * @size: size internal buffer size
113 struct iwl_fw_ini_region_internal_buffer {
117 } __packed; /* FW_TLV_DEBUG_REGION_INTERNAL_BUFFER_API_S_VER_1 */
120 * struct iwl_fw_ini_region_tlv - region TLV
122 * Configures parameters for region data collection
125 * @id: region id. Max id is &IWL_FW_INI_MAX_REGION_ID
126 * @type: region type. One of &enum iwl_fw_ini_region_type
128 * @dev_addr: device address configuration. Used by
129 * &IWL_FW_INI_REGION_DEVICE_MEMORY, &IWL_FW_INI_REGION_PERIPHERY_MAC,
130 * &IWL_FW_INI_REGION_PERIPHERY_PHY, &IWL_FW_INI_REGION_PERIPHERY_AUX,
131 * &IWL_FW_INI_REGION_PAGING, &IWL_FW_INI_REGION_CSR,
132 * &IWL_FW_INI_REGION_DRAM_IMR and &IWL_FW_INI_REGION_PCI_IOSF_CONFIG
133 * @fifos: fifos configuration. Used by &IWL_FW_INI_REGION_TXF and
134 * &IWL_FW_INI_REGION_RXF
135 * @err_table: error table configuration. Used by
136 * IWL_FW_INI_REGION_LMAC_ERROR_TABLE and
137 * IWL_FW_INI_REGION_UMAC_ERROR_TABLE
138 * @internal_buffer: internal monitor buffer configuration. Used by
139 * &IWL_FW_INI_REGION_INTERNAL_BUFFER
140 * @dram_alloc_id: dram allocation id. One of &enum iwl_fw_ini_allocation_id.
141 * Used by &IWL_FW_INI_REGION_DRAM_BUFFER
142 * @tlv_mask: tlv collection mask. Used by &IWL_FW_INI_REGION_TLV
143 * @addrs: array of addresses attached to the end of the region tlv
145 struct iwl_fw_ini_region_tlv {
146 struct iwl_fw_ini_header hdr;
149 u8 name[IWL_FW_INI_MAX_NAME];
151 struct iwl_fw_ini_region_dev_addr dev_addr;
152 struct iwl_fw_ini_region_fifos fifos;
153 struct iwl_fw_ini_region_err_table err_table;
154 struct iwl_fw_ini_region_internal_buffer internal_buffer;
155 struct iwl_fw_ini_region_special_device_memory special_mem;
156 __le32 dram_alloc_id;
158 }; /* FW_TLV_DEBUG_REGION_CONF_PARAMS_API_U_VER_1 */
160 } __packed; /* FW_TLV_DEBUG_REGION_API_S_VER_1 */
163 * struct iwl_fw_ini_debug_info_tlv
165 * debug configuration name for a specific image
168 * @image_type: image type
169 * @debug_cfg_name: debug configuration name
171 struct iwl_fw_ini_debug_info_tlv {
172 struct iwl_fw_ini_header hdr;
174 u8 debug_cfg_name[IWL_FW_INI_MAX_CFG_NAME];
175 } __packed; /* FW_TLV_DEBUG_INFO_API_S_VER_1 */
178 * struct iwl_fw_ini_allocation_tlv - Allocates DRAM buffers
181 * @alloc_id: allocation id. One of &enum iwl_fw_ini_allocation_id
182 * @buf_location: buffer location. One of &enum iwl_fw_ini_buffer_location
183 * @req_size: requested buffer size
184 * @max_frags_num: maximum number of fragments
185 * @min_size: minimum buffer size
187 struct iwl_fw_ini_allocation_tlv {
188 struct iwl_fw_ini_header hdr;
192 __le32 max_frags_num;
194 } __packed; /* FW_TLV_DEBUG_BUFFER_ALLOCATION_API_S_VER_1 */
197 * struct iwl_fw_ini_trigger_tlv - trigger TLV
199 * Trigger that upon firing, determines what regions to collect
202 * @time_point: time point. One of &enum iwl_fw_ini_time_point
203 * @trigger_reason: trigger reason
204 * @apply_policy: uses &enum iwl_fw_ini_trigger_apply_policy
205 * @dump_delay: delay from trigger fire to dump, in usec
206 * @occurrences: max trigger fire occurrences allowed
208 * @ignore_consec: ignore consecutive triggers, in usec
209 * @reset_fw: if non zero, will reset and reload the FW
210 * @multi_dut: initiate debug dump data on several DUTs
211 * @regions_mask: mask of regions to collect
212 * @data: trigger data
214 struct iwl_fw_ini_trigger_tlv {
215 struct iwl_fw_ini_header hdr;
217 __le32 trigger_reason;
222 __le32 ignore_consec;
227 } __packed; /* FW_TLV_DEBUG_TRIGGER_API_S_VER_1 */
230 * struct iwl_fw_ini_hcmd_tlv - Generic Host command pass through TLV
233 * @time_point: time point. One of &enum iwl_fw_ini_time_point
234 * @period_msec: interval at which the hcmd will be sent to the FW.
235 * Measured in msec (0 = one time command)
236 * @hcmd: a variable length host-command to be sent to apply the configuration
238 struct iwl_fw_ini_hcmd_tlv {
239 struct iwl_fw_ini_header hdr;
242 struct iwl_fw_ini_hcmd hcmd;
243 } __packed; /* FW_TLV_DEBUG_HCMD_API_S_VER_1 */
246 * enum iwl_fw_ini_allocation_id
248 * @IWL_FW_INI_ALLOCATION_INVALID: invalid
249 * @IWL_FW_INI_ALLOCATION_ID_DBGC1: allocation meant for DBGC1 configuration
250 * @IWL_FW_INI_ALLOCATION_ID_DBGC2: allocation meant for DBGC2 configuration
251 * @IWL_FW_INI_ALLOCATION_ID_DBGC3: allocation meant for DBGC3 configuration
252 * @IWL_FW_INI_ALLOCATION_ID_INTERNAL: allocation meant for Intreanl SMEM in D3
253 * @IWL_FW_INI_ALLOCATION_NUM: number of allocation ids
255 enum iwl_fw_ini_allocation_id {
256 IWL_FW_INI_ALLOCATION_INVALID,
257 IWL_FW_INI_ALLOCATION_ID_DBGC1,
258 IWL_FW_INI_ALLOCATION_ID_DBGC2,
259 IWL_FW_INI_ALLOCATION_ID_DBGC3,
260 IWL_FW_INI_ALLOCATION_ID_INTERNAL,
261 IWL_FW_INI_ALLOCATION_NUM,
262 }; /* FW_DEBUG_TLV_ALLOCATION_ID_E_VER_1 */
265 * enum iwl_fw_ini_buffer_location
267 * @IWL_FW_INI_LOCATION_INVALID: invalid
268 * @IWL_FW_INI_LOCATION_SRAM_PATH: SRAM location
269 * @IWL_FW_INI_LOCATION_DRAM_PATH: DRAM location
270 * @IWL_FW_INI_LOCATION_NPK_PATH: NPK location
272 enum iwl_fw_ini_buffer_location {
273 IWL_FW_INI_LOCATION_INVALID,
274 IWL_FW_INI_LOCATION_SRAM_PATH,
275 IWL_FW_INI_LOCATION_DRAM_PATH,
276 IWL_FW_INI_LOCATION_NPK_PATH,
277 IWL_FW_INI_LOCATION_NUM,
278 }; /* FW_DEBUG_TLV_BUFFER_LOCATION_E_VER_1 */
281 * enum iwl_fw_ini_region_type
283 * @IWL_FW_INI_REGION_INVALID: invalid
284 * @IWL_FW_INI_REGION_TLV: uCode and debug TLVs
285 * @IWL_FW_INI_REGION_INTERNAL_BUFFER: monitor SMEM buffer
286 * @IWL_FW_INI_REGION_DRAM_BUFFER: monitor DRAM buffer
287 * @IWL_FW_INI_REGION_TXF: TX fifos
288 * @IWL_FW_INI_REGION_RXF: RX fifo
289 * @IWL_FW_INI_REGION_LMAC_ERROR_TABLE: lmac error table
290 * @IWL_FW_INI_REGION_UMAC_ERROR_TABLE: umac error table
291 * @IWL_FW_INI_REGION_RSP_OR_NOTIF: FW response or notification data
292 * @IWL_FW_INI_REGION_DEVICE_MEMORY: device internal memory
293 * @IWL_FW_INI_REGION_PERIPHERY_MAC: periphery registers of MAC
294 * @IWL_FW_INI_REGION_PERIPHERY_PHY: periphery registers of PHY
295 * @IWL_FW_INI_REGION_PERIPHERY_AUX: periphery registers of AUX
296 * @IWL_FW_INI_REGION_PAGING: paging memory
297 * @IWL_FW_INI_REGION_CSR: CSR registers
298 * @IWL_FW_INI_REGION_DRAM_IMR: IMR memory
299 * @IWL_FW_INI_REGION_PCI_IOSF_CONFIG: PCI/IOSF config
300 * @IWL_FW_INI_REGION_SPECIAL_DEVICE_MEMORY: special device memory
301 * @IWL_FW_INI_REGION_NUM: number of region types
303 enum iwl_fw_ini_region_type {
304 IWL_FW_INI_REGION_INVALID,
305 IWL_FW_INI_REGION_TLV,
306 IWL_FW_INI_REGION_INTERNAL_BUFFER,
307 IWL_FW_INI_REGION_DRAM_BUFFER,
308 IWL_FW_INI_REGION_TXF,
309 IWL_FW_INI_REGION_RXF,
310 IWL_FW_INI_REGION_LMAC_ERROR_TABLE,
311 IWL_FW_INI_REGION_UMAC_ERROR_TABLE,
312 IWL_FW_INI_REGION_RSP_OR_NOTIF,
313 IWL_FW_INI_REGION_DEVICE_MEMORY,
314 IWL_FW_INI_REGION_PERIPHERY_MAC,
315 IWL_FW_INI_REGION_PERIPHERY_PHY,
316 IWL_FW_INI_REGION_PERIPHERY_AUX,
317 IWL_FW_INI_REGION_PAGING,
318 IWL_FW_INI_REGION_CSR,
319 IWL_FW_INI_REGION_DRAM_IMR,
320 IWL_FW_INI_REGION_PCI_IOSF_CONFIG,
321 IWL_FW_INI_REGION_SPECIAL_DEVICE_MEMORY,
322 IWL_FW_INI_REGION_NUM
323 }; /* FW_TLV_DEBUG_REGION_TYPE_API_E */
326 * enum iwl_fw_ini_time_point
328 * Hard coded time points in which the driver can send hcmd or perform dump
331 * @IWL_FW_INI_TIME_POINT_EARLY: pre loading the FW
332 * @IWL_FW_INI_TIME_POINT_AFTER_ALIVE: first cmd from host after alive notif
333 * @IWL_FW_INI_TIME_POINT_POST_INIT: last cmd in series of init sequence
334 * @IWL_FW_INI_TIME_POINT_FW_ASSERT: FW assert
335 * @IWL_FW_INI_TIME_POINT_FW_HW_ERROR: FW HW error
336 * @IWL_FW_INI_TIME_POINT_FW_TFD_Q_HANG: TFD queue hang
337 * @IWL_FW_INI_TIME_POINT_FW_DHC_NOTIFICATION: DHC cmd response and notif
338 * @IWL_FW_INI_TIME_POINT_FW_RSP_OR_NOTIF: FW response or notification.
339 * data field holds id and group
340 * @IWL_FW_INI_TIME_POINT_USER_TRIGGER: user trigger time point
341 * @IWL_FW_INI_TIME_POINT_PERIODIC: periodic timepoint that fires in constant
342 * intervals. data field holds the interval time in msec
343 * @IWL_FW_INI_TIME_POINT_RESERVED: reserved
344 * @IWL_FW_INI_TIME_POINT_HOST_ASSERT: Unused
345 * @IWL_FW_INI_TIME_POINT_HOST_ALIVE_TIMEOUT: alive timeout
346 * @IWL_FW_INI_TIME_POINT_HOST_DEVICE_ENABLE: device enable
347 * @IWL_FW_INI_TIME_POINT_HOST_DEVICE_DISABLE: device disable
348 * @IWL_FW_INI_TIME_POINT_HOST_D3_START: D3 start
349 * @IWL_FW_INI_TIME_POINT_HOST_D3_END: D3 end
350 * @IWL_FW_INI_TIME_POINT_MISSED_BEACONS: missed beacons
351 * @IWL_FW_INI_TIME_POINT_ASSOC_FAILED: association failure
352 * @IWL_FW_INI_TIME_POINT_TX_FAILED: Tx frame failed
353 * @IWL_FW_INI_TIME_POINT_TX_WFD_ACTION_FRAME_FAILED: wifi direct action
355 * @IWL_FW_INI_TIME_POINT_TX_LATENCY_THRESHOLD: Tx latency threshold
356 * @IWL_FW_INI_TIME_POINT_HANG_OCCURRED: hang occurred
357 * @IWL_FW_INI_TIME_POINT_EAPOL_FAILED: EAPOL failed
358 * @IWL_FW_INI_TIME_POINT_FAKE_TX: fake Tx
359 * @IWL_FW_INI_TIME_POINT_DEASSOC: de association
360 * @IWL_FW_INI_TIME_POINT_NUM: number of time points
362 enum iwl_fw_ini_time_point {
363 IWL_FW_INI_TIME_POINT_INVALID,
364 IWL_FW_INI_TIME_POINT_EARLY,
365 IWL_FW_INI_TIME_POINT_AFTER_ALIVE,
366 IWL_FW_INI_TIME_POINT_POST_INIT,
367 IWL_FW_INI_TIME_POINT_FW_ASSERT,
368 IWL_FW_INI_TIME_POINT_FW_HW_ERROR,
369 IWL_FW_INI_TIME_POINT_FW_TFD_Q_HANG,
370 IWL_FW_INI_TIME_POINT_FW_DHC_NOTIFICATION,
371 IWL_FW_INI_TIME_POINT_FW_RSP_OR_NOTIF,
372 IWL_FW_INI_TIME_POINT_USER_TRIGGER,
373 IWL_FW_INI_TIME_POINT_PERIODIC,
374 IWL_FW_INI_TIME_POINT_RESERVED,
375 IWL_FW_INI_TIME_POINT_HOST_ASSERT,
376 IWL_FW_INI_TIME_POINT_HOST_ALIVE_TIMEOUT,
377 IWL_FW_INI_TIME_POINT_HOST_DEVICE_ENABLE,
378 IWL_FW_INI_TIME_POINT_HOST_DEVICE_DISABLE,
379 IWL_FW_INI_TIME_POINT_HOST_D3_START,
380 IWL_FW_INI_TIME_POINT_HOST_D3_END,
381 IWL_FW_INI_TIME_POINT_MISSED_BEACONS,
382 IWL_FW_INI_TIME_POINT_ASSOC_FAILED,
383 IWL_FW_INI_TIME_POINT_TX_FAILED,
384 IWL_FW_INI_TIME_POINT_TX_WFD_ACTION_FRAME_FAILED,
385 IWL_FW_INI_TIME_POINT_TX_LATENCY_THRESHOLD,
386 IWL_FW_INI_TIME_POINT_HANG_OCCURRED,
387 IWL_FW_INI_TIME_POINT_EAPOL_FAILED,
388 IWL_FW_INI_TIME_POINT_FAKE_TX,
389 IWL_FW_INI_TIME_POINT_DEASSOC,
390 IWL_FW_INI_TIME_POINT_NUM,
391 }; /* FW_TLV_DEBUG_TIME_POINT_API_E */
394 * enum iwl_fw_ini_trigger_apply_policy - Determines how to apply triggers
396 * @IWL_FW_INI_APPLY_POLICY_MATCH_TIME_POINT: match by time point
397 * @IWL_FW_INI_APPLY_POLICY_MATCH_DATA: match by trigger data
398 * @IWL_FW_INI_APPLY_POLICY_OVERRIDE_REGIONS: override regions mask.
400 * @IWL_FW_INI_APPLY_POLICY_OVERRIDE_CFG: override trigger configuration
401 * @IWL_FW_INI_APPLY_POLICY_OVERRIDE_DATA: override trigger data.
404 enum iwl_fw_ini_trigger_apply_policy {
405 IWL_FW_INI_APPLY_POLICY_MATCH_TIME_POINT = BIT(0),
406 IWL_FW_INI_APPLY_POLICY_MATCH_DATA = BIT(1),
407 IWL_FW_INI_APPLY_POLICY_OVERRIDE_REGIONS = BIT(8),
408 IWL_FW_INI_APPLY_POLICY_OVERRIDE_CFG = BIT(9),
409 IWL_FW_INI_APPLY_POLICY_OVERRIDE_DATA = BIT(10),