xref: /linux/drivers/net/ethernet/qlogic/qed/qed_dbg_hsi.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1ee824f4bSOmkar Kulkarni /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2ee824f4bSOmkar Kulkarni /* QLogic qed NIC Driver
3ee824f4bSOmkar Kulkarni  * Copyright (c) 2019-2021 Marvell International Ltd.
4ee824f4bSOmkar Kulkarni  */
5ee824f4bSOmkar Kulkarni #ifndef _QED_DBG_HSI_H
6ee824f4bSOmkar Kulkarni #define _QED_DBG_HSI_H
7ee824f4bSOmkar Kulkarni 
8ee824f4bSOmkar Kulkarni #include <linux/types.h>
9ee824f4bSOmkar Kulkarni #include <linux/io.h>
10ee824f4bSOmkar Kulkarni #include <linux/bitops.h>
11ee824f4bSOmkar Kulkarni #include <linux/delay.h>
12ee824f4bSOmkar Kulkarni #include <linux/kernel.h>
13ee824f4bSOmkar Kulkarni #include <linux/list.h>
14ee824f4bSOmkar Kulkarni #include <linux/slab.h>
15ee824f4bSOmkar Kulkarni 
16ee824f4bSOmkar Kulkarni /****************************************/
17ee824f4bSOmkar Kulkarni /* Debug Tools HSI constants and macros */
18ee824f4bSOmkar Kulkarni /****************************************/
19ee824f4bSOmkar Kulkarni 
20ee824f4bSOmkar Kulkarni enum block_id {
21ee824f4bSOmkar Kulkarni 	BLOCK_GRC,
22ee824f4bSOmkar Kulkarni 	BLOCK_MISCS,
23ee824f4bSOmkar Kulkarni 	BLOCK_MISC,
24ee824f4bSOmkar Kulkarni 	BLOCK_DBU,
25ee824f4bSOmkar Kulkarni 	BLOCK_PGLUE_B,
26ee824f4bSOmkar Kulkarni 	BLOCK_CNIG,
27ee824f4bSOmkar Kulkarni 	BLOCK_CPMU,
28ee824f4bSOmkar Kulkarni 	BLOCK_NCSI,
29ee824f4bSOmkar Kulkarni 	BLOCK_OPTE,
30ee824f4bSOmkar Kulkarni 	BLOCK_BMB,
31ee824f4bSOmkar Kulkarni 	BLOCK_PCIE,
32ee824f4bSOmkar Kulkarni 	BLOCK_MCP,
33ee824f4bSOmkar Kulkarni 	BLOCK_MCP2,
34ee824f4bSOmkar Kulkarni 	BLOCK_PSWHST,
35ee824f4bSOmkar Kulkarni 	BLOCK_PSWHST2,
36ee824f4bSOmkar Kulkarni 	BLOCK_PSWRD,
37ee824f4bSOmkar Kulkarni 	BLOCK_PSWRD2,
38ee824f4bSOmkar Kulkarni 	BLOCK_PSWWR,
39ee824f4bSOmkar Kulkarni 	BLOCK_PSWWR2,
40ee824f4bSOmkar Kulkarni 	BLOCK_PSWRQ,
41ee824f4bSOmkar Kulkarni 	BLOCK_PSWRQ2,
42ee824f4bSOmkar Kulkarni 	BLOCK_PGLCS,
43ee824f4bSOmkar Kulkarni 	BLOCK_DMAE,
44ee824f4bSOmkar Kulkarni 	BLOCK_PTU,
45ee824f4bSOmkar Kulkarni 	BLOCK_TCM,
46ee824f4bSOmkar Kulkarni 	BLOCK_MCM,
47ee824f4bSOmkar Kulkarni 	BLOCK_UCM,
48ee824f4bSOmkar Kulkarni 	BLOCK_XCM,
49ee824f4bSOmkar Kulkarni 	BLOCK_YCM,
50ee824f4bSOmkar Kulkarni 	BLOCK_PCM,
51ee824f4bSOmkar Kulkarni 	BLOCK_QM,
52ee824f4bSOmkar Kulkarni 	BLOCK_TM,
53ee824f4bSOmkar Kulkarni 	BLOCK_DORQ,
54ee824f4bSOmkar Kulkarni 	BLOCK_BRB,
55ee824f4bSOmkar Kulkarni 	BLOCK_SRC,
56ee824f4bSOmkar Kulkarni 	BLOCK_PRS,
57ee824f4bSOmkar Kulkarni 	BLOCK_TSDM,
58ee824f4bSOmkar Kulkarni 	BLOCK_MSDM,
59ee824f4bSOmkar Kulkarni 	BLOCK_USDM,
60ee824f4bSOmkar Kulkarni 	BLOCK_XSDM,
61ee824f4bSOmkar Kulkarni 	BLOCK_YSDM,
62ee824f4bSOmkar Kulkarni 	BLOCK_PSDM,
63ee824f4bSOmkar Kulkarni 	BLOCK_TSEM,
64ee824f4bSOmkar Kulkarni 	BLOCK_MSEM,
65ee824f4bSOmkar Kulkarni 	BLOCK_USEM,
66ee824f4bSOmkar Kulkarni 	BLOCK_XSEM,
67ee824f4bSOmkar Kulkarni 	BLOCK_YSEM,
68ee824f4bSOmkar Kulkarni 	BLOCK_PSEM,
69ee824f4bSOmkar Kulkarni 	BLOCK_RSS,
70ee824f4bSOmkar Kulkarni 	BLOCK_TMLD,
71ee824f4bSOmkar Kulkarni 	BLOCK_MULD,
72ee824f4bSOmkar Kulkarni 	BLOCK_YULD,
73ee824f4bSOmkar Kulkarni 	BLOCK_XYLD,
74ee824f4bSOmkar Kulkarni 	BLOCK_PRM,
75ee824f4bSOmkar Kulkarni 	BLOCK_PBF_PB1,
76ee824f4bSOmkar Kulkarni 	BLOCK_PBF_PB2,
77ee824f4bSOmkar Kulkarni 	BLOCK_RPB,
78ee824f4bSOmkar Kulkarni 	BLOCK_BTB,
79ee824f4bSOmkar Kulkarni 	BLOCK_PBF,
80ee824f4bSOmkar Kulkarni 	BLOCK_RDIF,
81ee824f4bSOmkar Kulkarni 	BLOCK_TDIF,
82ee824f4bSOmkar Kulkarni 	BLOCK_CDU,
83ee824f4bSOmkar Kulkarni 	BLOCK_CCFC,
84ee824f4bSOmkar Kulkarni 	BLOCK_TCFC,
85ee824f4bSOmkar Kulkarni 	BLOCK_IGU,
86ee824f4bSOmkar Kulkarni 	BLOCK_CAU,
87ee824f4bSOmkar Kulkarni 	BLOCK_UMAC,
88ee824f4bSOmkar Kulkarni 	BLOCK_XMAC,
89ee824f4bSOmkar Kulkarni 	BLOCK_MSTAT,
90ee824f4bSOmkar Kulkarni 	BLOCK_DBG,
91ee824f4bSOmkar Kulkarni 	BLOCK_NIG,
92ee824f4bSOmkar Kulkarni 	BLOCK_WOL,
93ee824f4bSOmkar Kulkarni 	BLOCK_BMBN,
94ee824f4bSOmkar Kulkarni 	BLOCK_IPC,
95ee824f4bSOmkar Kulkarni 	BLOCK_NWM,
96ee824f4bSOmkar Kulkarni 	BLOCK_NWS,
97ee824f4bSOmkar Kulkarni 	BLOCK_MS,
98ee824f4bSOmkar Kulkarni 	BLOCK_PHY_PCIE,
99ee824f4bSOmkar Kulkarni 	BLOCK_LED,
100ee824f4bSOmkar Kulkarni 	BLOCK_AVS_WRAP,
101ee824f4bSOmkar Kulkarni 	BLOCK_PXPREQBUS,
102ee824f4bSOmkar Kulkarni 	BLOCK_BAR0_MAP,
103ee824f4bSOmkar Kulkarni 	BLOCK_MCP_FIO,
104ee824f4bSOmkar Kulkarni 	BLOCK_LAST_INIT,
105ee824f4bSOmkar Kulkarni 	BLOCK_PRS_FC,
106ee824f4bSOmkar Kulkarni 	BLOCK_PBF_FC,
107ee824f4bSOmkar Kulkarni 	BLOCK_NIG_LB_FC,
108ee824f4bSOmkar Kulkarni 	BLOCK_NIG_LB_FC_PLLH,
109ee824f4bSOmkar Kulkarni 	BLOCK_NIG_TX_FC_PLLH,
110ee824f4bSOmkar Kulkarni 	BLOCK_NIG_TX_FC,
111ee824f4bSOmkar Kulkarni 	BLOCK_NIG_RX_FC_PLLH,
112ee824f4bSOmkar Kulkarni 	BLOCK_NIG_RX_FC,
113ee824f4bSOmkar Kulkarni 	MAX_BLOCK_ID
114ee824f4bSOmkar Kulkarni };
115ee824f4bSOmkar Kulkarni 
116ee824f4bSOmkar Kulkarni /* binary debug buffer types */
117ee824f4bSOmkar Kulkarni enum bin_dbg_buffer_type {
118ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_MODE_TREE,
119ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_DUMP_REG,
120ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_DUMP_MEM,
121ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_IDLE_CHK_REGS,
122ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_IDLE_CHK_IMMS,
123ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_IDLE_CHK_RULES,
124ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_IDLE_CHK_PARSING_DATA,
125ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_ATTN_BLOCKS,
126ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_ATTN_REGS,
127ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_ATTN_INDEXES,
128ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_ATTN_NAME_OFFSETS,
129ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_BLOCKS,
130ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_BLOCKS_CHIP_DATA,
131ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_BUS_LINES,
132ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_BLOCKS_USER_DATA,
133ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_BLOCKS_CHIP_USER_DATA,
134ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_BUS_LINE_NAME_OFFSETS,
135ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_RESET_REGS,
136ee824f4bSOmkar Kulkarni 	BIN_BUF_DBG_PARSING_STRINGS,
137ee824f4bSOmkar Kulkarni 	MAX_BIN_DBG_BUFFER_TYPE
138ee824f4bSOmkar Kulkarni };
139ee824f4bSOmkar Kulkarni 
140ee824f4bSOmkar Kulkarni /* Attention bit mapping */
141ee824f4bSOmkar Kulkarni struct dbg_attn_bit_mapping {
142ee824f4bSOmkar Kulkarni 	u16 data;
143ee824f4bSOmkar Kulkarni #define DBG_ATTN_BIT_MAPPING_VAL_MASK			0x7FFF
144ee824f4bSOmkar Kulkarni #define DBG_ATTN_BIT_MAPPING_VAL_SHIFT			0
145ee824f4bSOmkar Kulkarni #define DBG_ATTN_BIT_MAPPING_IS_UNUSED_BIT_CNT_MASK	0x1
146ee824f4bSOmkar Kulkarni #define DBG_ATTN_BIT_MAPPING_IS_UNUSED_BIT_CNT_SHIFT	15
147ee824f4bSOmkar Kulkarni };
148ee824f4bSOmkar Kulkarni 
149ee824f4bSOmkar Kulkarni /* Attention block per-type data */
150ee824f4bSOmkar Kulkarni struct dbg_attn_block_type_data {
151ee824f4bSOmkar Kulkarni 	u16 names_offset;
152ee824f4bSOmkar Kulkarni 	u16 reserved1;
153ee824f4bSOmkar Kulkarni 	u8 num_regs;
154ee824f4bSOmkar Kulkarni 	u8 reserved2;
155ee824f4bSOmkar Kulkarni 	u16 regs_offset;
156ee824f4bSOmkar Kulkarni 
157ee824f4bSOmkar Kulkarni };
158ee824f4bSOmkar Kulkarni 
159ee824f4bSOmkar Kulkarni /* Block attentions */
160ee824f4bSOmkar Kulkarni struct dbg_attn_block {
161ee824f4bSOmkar Kulkarni 	struct dbg_attn_block_type_data per_type_data[2];
162ee824f4bSOmkar Kulkarni };
163ee824f4bSOmkar Kulkarni 
164ee824f4bSOmkar Kulkarni /* Attention register result */
165ee824f4bSOmkar Kulkarni struct dbg_attn_reg_result {
166ee824f4bSOmkar Kulkarni 	u32 data;
167ee824f4bSOmkar Kulkarni #define DBG_ATTN_REG_RESULT_STS_ADDRESS_MASK	0xFFFFFF
168ee824f4bSOmkar Kulkarni #define DBG_ATTN_REG_RESULT_STS_ADDRESS_SHIFT	0
169ee824f4bSOmkar Kulkarni #define DBG_ATTN_REG_RESULT_NUM_REG_ATTN_MASK	0xFF
170ee824f4bSOmkar Kulkarni #define DBG_ATTN_REG_RESULT_NUM_REG_ATTN_SHIFT	24
171ee824f4bSOmkar Kulkarni 	u16 block_attn_offset;
172ee824f4bSOmkar Kulkarni 	u16 reserved;
173ee824f4bSOmkar Kulkarni 	u32 sts_val;
174ee824f4bSOmkar Kulkarni 	u32 mask_val;
175ee824f4bSOmkar Kulkarni };
176ee824f4bSOmkar Kulkarni 
177ee824f4bSOmkar Kulkarni /* Attention block result */
178ee824f4bSOmkar Kulkarni struct dbg_attn_block_result {
179ee824f4bSOmkar Kulkarni 	u8 block_id;
180ee824f4bSOmkar Kulkarni 	u8 data;
181ee824f4bSOmkar Kulkarni #define DBG_ATTN_BLOCK_RESULT_ATTN_TYPE_MASK	0x3
182ee824f4bSOmkar Kulkarni #define DBG_ATTN_BLOCK_RESULT_ATTN_TYPE_SHIFT	0
183ee824f4bSOmkar Kulkarni #define DBG_ATTN_BLOCK_RESULT_NUM_REGS_MASK	0x3F
184ee824f4bSOmkar Kulkarni #define DBG_ATTN_BLOCK_RESULT_NUM_REGS_SHIFT	2
185ee824f4bSOmkar Kulkarni 	u16 names_offset;
186ee824f4bSOmkar Kulkarni 	struct dbg_attn_reg_result reg_results[15];
187ee824f4bSOmkar Kulkarni };
188ee824f4bSOmkar Kulkarni 
189ee824f4bSOmkar Kulkarni /* Mode header */
190ee824f4bSOmkar Kulkarni struct dbg_mode_hdr {
191ee824f4bSOmkar Kulkarni 	u16 data;
192ee824f4bSOmkar Kulkarni #define DBG_MODE_HDR_EVAL_MODE_MASK		0x1
193ee824f4bSOmkar Kulkarni #define DBG_MODE_HDR_EVAL_MODE_SHIFT		0
194ee824f4bSOmkar Kulkarni #define DBG_MODE_HDR_MODES_BUF_OFFSET_MASK	0x7FFF
195ee824f4bSOmkar Kulkarni #define DBG_MODE_HDR_MODES_BUF_OFFSET_SHIFT	1
196ee824f4bSOmkar Kulkarni };
197ee824f4bSOmkar Kulkarni 
198ee824f4bSOmkar Kulkarni /* Attention register */
199ee824f4bSOmkar Kulkarni struct dbg_attn_reg {
200ee824f4bSOmkar Kulkarni 	struct dbg_mode_hdr mode;
201ee824f4bSOmkar Kulkarni 	u16 block_attn_offset;
202ee824f4bSOmkar Kulkarni 	u32 data;
203ee824f4bSOmkar Kulkarni #define DBG_ATTN_REG_STS_ADDRESS_MASK	0xFFFFFF
204ee824f4bSOmkar Kulkarni #define DBG_ATTN_REG_STS_ADDRESS_SHIFT	0
205ee824f4bSOmkar Kulkarni #define DBG_ATTN_REG_NUM_REG_ATTN_MASK	0xFF
206ee824f4bSOmkar Kulkarni #define DBG_ATTN_REG_NUM_REG_ATTN_SHIFT 24
207ee824f4bSOmkar Kulkarni 	u32 sts_clr_address;
208ee824f4bSOmkar Kulkarni 	u32 mask_address;
209ee824f4bSOmkar Kulkarni };
210ee824f4bSOmkar Kulkarni 
211ee824f4bSOmkar Kulkarni /* Attention types */
212ee824f4bSOmkar Kulkarni enum dbg_attn_type {
213ee824f4bSOmkar Kulkarni 	ATTN_TYPE_INTERRUPT,
214ee824f4bSOmkar Kulkarni 	ATTN_TYPE_PARITY,
215ee824f4bSOmkar Kulkarni 	MAX_DBG_ATTN_TYPE
216ee824f4bSOmkar Kulkarni };
217ee824f4bSOmkar Kulkarni 
218ee824f4bSOmkar Kulkarni /* Block debug data */
219ee824f4bSOmkar Kulkarni struct dbg_block {
220ee824f4bSOmkar Kulkarni 	u8 name[15];
221ee824f4bSOmkar Kulkarni 	u8 associated_storm_letter;
222ee824f4bSOmkar Kulkarni };
223ee824f4bSOmkar Kulkarni 
224ee824f4bSOmkar Kulkarni /* Chip-specific block debug data */
225ee824f4bSOmkar Kulkarni struct dbg_block_chip {
226ee824f4bSOmkar Kulkarni 	u8 flags;
227ee824f4bSOmkar Kulkarni #define DBG_BLOCK_CHIP_IS_REMOVED_MASK		 0x1
228ee824f4bSOmkar Kulkarni #define DBG_BLOCK_CHIP_IS_REMOVED_SHIFT		 0
229ee824f4bSOmkar Kulkarni #define DBG_BLOCK_CHIP_HAS_RESET_REG_MASK	 0x1
230ee824f4bSOmkar Kulkarni #define DBG_BLOCK_CHIP_HAS_RESET_REG_SHIFT	 1
231ee824f4bSOmkar Kulkarni #define DBG_BLOCK_CHIP_UNRESET_BEFORE_DUMP_MASK  0x1
232ee824f4bSOmkar Kulkarni #define DBG_BLOCK_CHIP_UNRESET_BEFORE_DUMP_SHIFT 2
233ee824f4bSOmkar Kulkarni #define DBG_BLOCK_CHIP_HAS_DBG_BUS_MASK		 0x1
234ee824f4bSOmkar Kulkarni #define DBG_BLOCK_CHIP_HAS_DBG_BUS_SHIFT	 3
235ee824f4bSOmkar Kulkarni #define DBG_BLOCK_CHIP_HAS_LATENCY_EVENTS_MASK	 0x1
236ee824f4bSOmkar Kulkarni #define DBG_BLOCK_CHIP_HAS_LATENCY_EVENTS_SHIFT  4
237ee824f4bSOmkar Kulkarni #define DBG_BLOCK_CHIP_RESERVED0_MASK		 0x7
238ee824f4bSOmkar Kulkarni #define DBG_BLOCK_CHIP_RESERVED0_SHIFT		 5
239ee824f4bSOmkar Kulkarni 	u8 dbg_client_id;
240ee824f4bSOmkar Kulkarni 	u8 reset_reg_id;
241ee824f4bSOmkar Kulkarni 	u8 reset_reg_bit_offset;
242ee824f4bSOmkar Kulkarni 	struct dbg_mode_hdr dbg_bus_mode;
243ee824f4bSOmkar Kulkarni 	u16 reserved1;
244ee824f4bSOmkar Kulkarni 	u8 reserved2;
245ee824f4bSOmkar Kulkarni 	u8 num_of_dbg_bus_lines;
246ee824f4bSOmkar Kulkarni 	u16 dbg_bus_lines_offset;
247ee824f4bSOmkar Kulkarni 	u32 dbg_select_reg_addr;
248ee824f4bSOmkar Kulkarni 	u32 dbg_dword_enable_reg_addr;
249ee824f4bSOmkar Kulkarni 	u32 dbg_shift_reg_addr;
250ee824f4bSOmkar Kulkarni 	u32 dbg_force_valid_reg_addr;
251ee824f4bSOmkar Kulkarni 	u32 dbg_force_frame_reg_addr;
252ee824f4bSOmkar Kulkarni };
253ee824f4bSOmkar Kulkarni 
254ee824f4bSOmkar Kulkarni /* Chip-specific block user debug data */
255ee824f4bSOmkar Kulkarni struct dbg_block_chip_user {
256ee824f4bSOmkar Kulkarni 	u8 num_of_dbg_bus_lines;
257ee824f4bSOmkar Kulkarni 	u8 has_latency_events;
258ee824f4bSOmkar Kulkarni 	u16 names_offset;
259ee824f4bSOmkar Kulkarni };
260ee824f4bSOmkar Kulkarni 
261ee824f4bSOmkar Kulkarni /* Block user debug data */
262ee824f4bSOmkar Kulkarni struct dbg_block_user {
263ee824f4bSOmkar Kulkarni 	u8 name[16];
264ee824f4bSOmkar Kulkarni };
265ee824f4bSOmkar Kulkarni 
266ee824f4bSOmkar Kulkarni /* Block Debug line data */
267ee824f4bSOmkar Kulkarni struct dbg_bus_line {
268ee824f4bSOmkar Kulkarni 	u8 data;
269ee824f4bSOmkar Kulkarni #define DBG_BUS_LINE_NUM_OF_GROUPS_MASK		0xF
270ee824f4bSOmkar Kulkarni #define DBG_BUS_LINE_NUM_OF_GROUPS_SHIFT	0
271ee824f4bSOmkar Kulkarni #define DBG_BUS_LINE_IS_256B_MASK		0x1
272ee824f4bSOmkar Kulkarni #define DBG_BUS_LINE_IS_256B_SHIFT		4
273ee824f4bSOmkar Kulkarni #define DBG_BUS_LINE_RESERVED_MASK		0x7
274ee824f4bSOmkar Kulkarni #define DBG_BUS_LINE_RESERVED_SHIFT		5
275ee824f4bSOmkar Kulkarni 	u8 group_sizes;
276ee824f4bSOmkar Kulkarni };
277ee824f4bSOmkar Kulkarni 
278ee824f4bSOmkar Kulkarni /* Condition header for registers dump */
279ee824f4bSOmkar Kulkarni struct dbg_dump_cond_hdr {
280ee824f4bSOmkar Kulkarni 	struct dbg_mode_hdr mode; /* Mode header */
281ee824f4bSOmkar Kulkarni 	u8 block_id; /* block ID */
282ee824f4bSOmkar Kulkarni 	u8 data_size; /* size in dwords of the data following this header */
283ee824f4bSOmkar Kulkarni };
284ee824f4bSOmkar Kulkarni 
285ee824f4bSOmkar Kulkarni /* Memory data for registers dump */
286ee824f4bSOmkar Kulkarni struct dbg_dump_mem {
287ee824f4bSOmkar Kulkarni 	u32 dword0;
288ee824f4bSOmkar Kulkarni #define DBG_DUMP_MEM_ADDRESS_MASK	0xFFFFFF
289ee824f4bSOmkar Kulkarni #define DBG_DUMP_MEM_ADDRESS_SHIFT	0
290ee824f4bSOmkar Kulkarni #define DBG_DUMP_MEM_MEM_GROUP_ID_MASK	0xFF
291ee824f4bSOmkar Kulkarni #define DBG_DUMP_MEM_MEM_GROUP_ID_SHIFT	24
292ee824f4bSOmkar Kulkarni 	u32 dword1;
293ee824f4bSOmkar Kulkarni #define DBG_DUMP_MEM_LENGTH_MASK	0xFFFFFF
294ee824f4bSOmkar Kulkarni #define DBG_DUMP_MEM_LENGTH_SHIFT	0
295ee824f4bSOmkar Kulkarni #define DBG_DUMP_MEM_WIDE_BUS_MASK	0x1
296ee824f4bSOmkar Kulkarni #define DBG_DUMP_MEM_WIDE_BUS_SHIFT	24
297ee824f4bSOmkar Kulkarni #define DBG_DUMP_MEM_RESERVED_MASK	0x7F
298ee824f4bSOmkar Kulkarni #define DBG_DUMP_MEM_RESERVED_SHIFT	25
299ee824f4bSOmkar Kulkarni };
300ee824f4bSOmkar Kulkarni 
301ee824f4bSOmkar Kulkarni /* Register data for registers dump */
302ee824f4bSOmkar Kulkarni struct dbg_dump_reg {
303ee824f4bSOmkar Kulkarni 	u32 data;
304ee824f4bSOmkar Kulkarni #define DBG_DUMP_REG_ADDRESS_MASK	0x7FFFFF
305ee824f4bSOmkar Kulkarni #define DBG_DUMP_REG_ADDRESS_SHIFT	0
306ee824f4bSOmkar Kulkarni #define DBG_DUMP_REG_WIDE_BUS_MASK	0x1
307ee824f4bSOmkar Kulkarni #define DBG_DUMP_REG_WIDE_BUS_SHIFT	23
308ee824f4bSOmkar Kulkarni #define DBG_DUMP_REG_LENGTH_MASK	0xFF
309ee824f4bSOmkar Kulkarni #define DBG_DUMP_REG_LENGTH_SHIFT	24
310ee824f4bSOmkar Kulkarni };
311ee824f4bSOmkar Kulkarni 
312ee824f4bSOmkar Kulkarni /* Split header for registers dump */
313ee824f4bSOmkar Kulkarni struct dbg_dump_split_hdr {
314ee824f4bSOmkar Kulkarni 	u32 hdr;
315ee824f4bSOmkar Kulkarni #define DBG_DUMP_SPLIT_HDR_DATA_SIZE_MASK	0xFFFFFF
316ee824f4bSOmkar Kulkarni #define DBG_DUMP_SPLIT_HDR_DATA_SIZE_SHIFT	0
317ee824f4bSOmkar Kulkarni #define DBG_DUMP_SPLIT_HDR_SPLIT_TYPE_ID_MASK	0xFF
318ee824f4bSOmkar Kulkarni #define DBG_DUMP_SPLIT_HDR_SPLIT_TYPE_ID_SHIFT	24
319ee824f4bSOmkar Kulkarni };
320ee824f4bSOmkar Kulkarni 
321ee824f4bSOmkar Kulkarni /* Condition header for idle check */
322ee824f4bSOmkar Kulkarni struct dbg_idle_chk_cond_hdr {
323ee824f4bSOmkar Kulkarni 	struct dbg_mode_hdr mode; /* Mode header */
324ee824f4bSOmkar Kulkarni 	u16 data_size; /* size in dwords of the data following this header */
325ee824f4bSOmkar Kulkarni };
326ee824f4bSOmkar Kulkarni 
327ee824f4bSOmkar Kulkarni /* Idle Check condition register */
328ee824f4bSOmkar Kulkarni struct dbg_idle_chk_cond_reg {
329ee824f4bSOmkar Kulkarni 	u32 data;
330ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_COND_REG_ADDRESS_MASK	0x7FFFFF
331ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_COND_REG_ADDRESS_SHIFT	0
332ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_COND_REG_WIDE_BUS_MASK	0x1
333ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_COND_REG_WIDE_BUS_SHIFT	23
334ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_COND_REG_BLOCK_ID_MASK	0xFF
335ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_COND_REG_BLOCK_ID_SHIFT	24
336ee824f4bSOmkar Kulkarni 	u16 num_entries;
337ee824f4bSOmkar Kulkarni 	u8 entry_size;
338ee824f4bSOmkar Kulkarni 	u8 start_entry;
339ee824f4bSOmkar Kulkarni };
340ee824f4bSOmkar Kulkarni 
341ee824f4bSOmkar Kulkarni /* Idle Check info register */
342ee824f4bSOmkar Kulkarni struct dbg_idle_chk_info_reg {
343ee824f4bSOmkar Kulkarni 	u32 data;
344ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_INFO_REG_ADDRESS_MASK	0x7FFFFF
345ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_INFO_REG_ADDRESS_SHIFT	0
346ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_INFO_REG_WIDE_BUS_MASK	0x1
347ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_INFO_REG_WIDE_BUS_SHIFT	23
348ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_INFO_REG_BLOCK_ID_MASK	0xFF
349ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_INFO_REG_BLOCK_ID_SHIFT	24
350ee824f4bSOmkar Kulkarni 	u16 size; /* register size in dwords */
351ee824f4bSOmkar Kulkarni 	struct dbg_mode_hdr mode; /* Mode header */
352ee824f4bSOmkar Kulkarni };
353ee824f4bSOmkar Kulkarni 
354ee824f4bSOmkar Kulkarni /* Idle Check register */
355ee824f4bSOmkar Kulkarni union dbg_idle_chk_reg {
356ee824f4bSOmkar Kulkarni 	struct dbg_idle_chk_cond_reg cond_reg; /* condition register */
357ee824f4bSOmkar Kulkarni 	struct dbg_idle_chk_info_reg info_reg; /* info register */
358ee824f4bSOmkar Kulkarni };
359ee824f4bSOmkar Kulkarni 
360ee824f4bSOmkar Kulkarni /* Idle Check result header */
361ee824f4bSOmkar Kulkarni struct dbg_idle_chk_result_hdr {
362ee824f4bSOmkar Kulkarni 	u16 rule_id; /* Failing rule index */
363ee824f4bSOmkar Kulkarni 	u16 mem_entry_id; /* Failing memory entry index */
364ee824f4bSOmkar Kulkarni 	u8 num_dumped_cond_regs; /* number of dumped condition registers */
365ee824f4bSOmkar Kulkarni 	u8 num_dumped_info_regs; /* number of dumped condition registers */
366ee824f4bSOmkar Kulkarni 	u8 severity; /* from dbg_idle_chk_severity_types enum */
367ee824f4bSOmkar Kulkarni 	u8 reserved;
368ee824f4bSOmkar Kulkarni };
369ee824f4bSOmkar Kulkarni 
370ee824f4bSOmkar Kulkarni /* Idle Check result register header */
371ee824f4bSOmkar Kulkarni struct dbg_idle_chk_result_reg_hdr {
372ee824f4bSOmkar Kulkarni 	u8 data;
373ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_RESULT_REG_HDR_IS_MEM_MASK  0x1
374ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_RESULT_REG_HDR_IS_MEM_SHIFT 0
375ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_RESULT_REG_HDR_REG_ID_MASK  0x7F
376ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_RESULT_REG_HDR_REG_ID_SHIFT 1
377ee824f4bSOmkar Kulkarni 	u8 start_entry; /* index of the first checked entry */
378ee824f4bSOmkar Kulkarni 	u16 size; /* register size in dwords */
379ee824f4bSOmkar Kulkarni };
380ee824f4bSOmkar Kulkarni 
381ee824f4bSOmkar Kulkarni /* Idle Check rule */
382ee824f4bSOmkar Kulkarni struct dbg_idle_chk_rule {
383ee824f4bSOmkar Kulkarni 	u16 rule_id; /* Idle Check rule ID */
384ee824f4bSOmkar Kulkarni 	u8 severity; /* value from dbg_idle_chk_severity_types enum */
385ee824f4bSOmkar Kulkarni 	u8 cond_id; /* Condition ID */
386ee824f4bSOmkar Kulkarni 	u8 num_cond_regs; /* number of condition registers */
387ee824f4bSOmkar Kulkarni 	u8 num_info_regs; /* number of info registers */
388ee824f4bSOmkar Kulkarni 	u8 num_imms; /* number of immediates in the condition */
389ee824f4bSOmkar Kulkarni 	u8 reserved1;
390ee824f4bSOmkar Kulkarni 	u16 reg_offset; /* offset of this rules registers in the idle check
391ee824f4bSOmkar Kulkarni 			 * register array (in dbg_idle_chk_reg units).
392ee824f4bSOmkar Kulkarni 			 */
393ee824f4bSOmkar Kulkarni 	u16 imm_offset; /* offset of this rules immediate values in the
394ee824f4bSOmkar Kulkarni 			 * immediate values array (in dwords).
395ee824f4bSOmkar Kulkarni 			 */
396ee824f4bSOmkar Kulkarni };
397ee824f4bSOmkar Kulkarni 
398ee824f4bSOmkar Kulkarni /* Idle Check rule parsing data */
399ee824f4bSOmkar Kulkarni struct dbg_idle_chk_rule_parsing_data {
400ee824f4bSOmkar Kulkarni 	u32 data;
401ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_RULE_PARSING_DATA_HAS_FW_MSG_MASK	0x1
402ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_RULE_PARSING_DATA_HAS_FW_MSG_SHIFT	0
403ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_RULE_PARSING_DATA_STR_OFFSET_MASK	0x7FFFFFFF
404ee824f4bSOmkar Kulkarni #define DBG_IDLE_CHK_RULE_PARSING_DATA_STR_OFFSET_SHIFT	1
405ee824f4bSOmkar Kulkarni };
406ee824f4bSOmkar Kulkarni 
407ee824f4bSOmkar Kulkarni /* Idle check severity types */
408ee824f4bSOmkar Kulkarni enum dbg_idle_chk_severity_types {
409ee824f4bSOmkar Kulkarni 	/* idle check failure should cause an error */
410ee824f4bSOmkar Kulkarni 	IDLE_CHK_SEVERITY_ERROR,
411ee824f4bSOmkar Kulkarni 	/* idle check failure should cause an error only if theres no traffic */
412ee824f4bSOmkar Kulkarni 	IDLE_CHK_SEVERITY_ERROR_NO_TRAFFIC,
413ee824f4bSOmkar Kulkarni 	/* idle check failure should cause a warning */
414ee824f4bSOmkar Kulkarni 	IDLE_CHK_SEVERITY_WARNING,
415ee824f4bSOmkar Kulkarni 	MAX_DBG_IDLE_CHK_SEVERITY_TYPES
416ee824f4bSOmkar Kulkarni };
417ee824f4bSOmkar Kulkarni 
418ee824f4bSOmkar Kulkarni /* Reset register */
419ee824f4bSOmkar Kulkarni struct dbg_reset_reg {
420ee824f4bSOmkar Kulkarni 	u32 data;
421ee824f4bSOmkar Kulkarni #define DBG_RESET_REG_ADDR_MASK        0xFFFFFF
422ee824f4bSOmkar Kulkarni #define DBG_RESET_REG_ADDR_SHIFT       0
423ee824f4bSOmkar Kulkarni #define DBG_RESET_REG_IS_REMOVED_MASK  0x1
424ee824f4bSOmkar Kulkarni #define DBG_RESET_REG_IS_REMOVED_SHIFT 24
425ee824f4bSOmkar Kulkarni #define DBG_RESET_REG_RESERVED_MASK    0x7F
426ee824f4bSOmkar Kulkarni #define DBG_RESET_REG_RESERVED_SHIFT   25
427ee824f4bSOmkar Kulkarni };
428ee824f4bSOmkar Kulkarni 
429ee824f4bSOmkar Kulkarni /* Debug Bus block data */
430ee824f4bSOmkar Kulkarni struct dbg_bus_block_data {
431ee824f4bSOmkar Kulkarni 	u8 enable_mask;
432ee824f4bSOmkar Kulkarni 	u8 right_shift;
433ee824f4bSOmkar Kulkarni 	u8 force_valid_mask;
434ee824f4bSOmkar Kulkarni 	u8 force_frame_mask;
435ee824f4bSOmkar Kulkarni 	u8 dword_mask;
436ee824f4bSOmkar Kulkarni 	u8 line_num;
437ee824f4bSOmkar Kulkarni 	u8 hw_id;
438ee824f4bSOmkar Kulkarni 	u8 flags;
439ee824f4bSOmkar Kulkarni #define DBG_BUS_BLOCK_DATA_IS_256B_LINE_MASK  0x1
440ee824f4bSOmkar Kulkarni #define DBG_BUS_BLOCK_DATA_IS_256B_LINE_SHIFT 0
441ee824f4bSOmkar Kulkarni #define DBG_BUS_BLOCK_DATA_RESERVED_MASK      0x7F
442ee824f4bSOmkar Kulkarni #define DBG_BUS_BLOCK_DATA_RESERVED_SHIFT     1
443ee824f4bSOmkar Kulkarni };
444ee824f4bSOmkar Kulkarni 
445ee824f4bSOmkar Kulkarni enum dbg_bus_clients {
446ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCN,
447ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCP,
448ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCR,
449ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCT,
450ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCU,
451ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCF,
452ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCX,
453ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCS,
454ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCH,
455ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCZ,
456ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_OTHER_ENGINE,
457ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_TIMESTAMP,
458ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_CPU,
459ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCY,
460ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCQ,
461ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCM,
462ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCB,
463ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCW,
464ee824f4bSOmkar Kulkarni 	DBG_BUS_CLIENT_RBCV,
465ee824f4bSOmkar Kulkarni 	MAX_DBG_BUS_CLIENTS
466ee824f4bSOmkar Kulkarni };
467ee824f4bSOmkar Kulkarni 
468ee824f4bSOmkar Kulkarni /* Debug Bus constraint operation types */
469ee824f4bSOmkar Kulkarni enum dbg_bus_constraint_ops {
470ee824f4bSOmkar Kulkarni 	DBG_BUS_CONSTRAINT_OP_EQ,
471ee824f4bSOmkar Kulkarni 	DBG_BUS_CONSTRAINT_OP_NE,
472ee824f4bSOmkar Kulkarni 	DBG_BUS_CONSTRAINT_OP_LT,
473ee824f4bSOmkar Kulkarni 	DBG_BUS_CONSTRAINT_OP_LTC,
474ee824f4bSOmkar Kulkarni 	DBG_BUS_CONSTRAINT_OP_LE,
475ee824f4bSOmkar Kulkarni 	DBG_BUS_CONSTRAINT_OP_LEC,
476ee824f4bSOmkar Kulkarni 	DBG_BUS_CONSTRAINT_OP_GT,
477ee824f4bSOmkar Kulkarni 	DBG_BUS_CONSTRAINT_OP_GTC,
478ee824f4bSOmkar Kulkarni 	DBG_BUS_CONSTRAINT_OP_GE,
479ee824f4bSOmkar Kulkarni 	DBG_BUS_CONSTRAINT_OP_GEC,
480ee824f4bSOmkar Kulkarni 	MAX_DBG_BUS_CONSTRAINT_OPS
481ee824f4bSOmkar Kulkarni };
482ee824f4bSOmkar Kulkarni 
483ee824f4bSOmkar Kulkarni /* Debug Bus trigger state data */
484ee824f4bSOmkar Kulkarni struct dbg_bus_trigger_state_data {
485ee824f4bSOmkar Kulkarni 	u8 msg_len;
486ee824f4bSOmkar Kulkarni 	u8 constraint_dword_mask;
487ee824f4bSOmkar Kulkarni 	u8 storm_id;
488ee824f4bSOmkar Kulkarni 	u8 reserved;
489ee824f4bSOmkar Kulkarni };
490ee824f4bSOmkar Kulkarni 
491ee824f4bSOmkar Kulkarni /* Debug Bus memory address */
492ee824f4bSOmkar Kulkarni struct dbg_bus_mem_addr {
493ee824f4bSOmkar Kulkarni 	u32 lo;
494ee824f4bSOmkar Kulkarni 	u32 hi;
495ee824f4bSOmkar Kulkarni };
496ee824f4bSOmkar Kulkarni 
497ee824f4bSOmkar Kulkarni /* Debug Bus PCI buffer data */
498ee824f4bSOmkar Kulkarni struct dbg_bus_pci_buf_data {
499ee824f4bSOmkar Kulkarni 	struct dbg_bus_mem_addr phys_addr; /* PCI buffer physical address */
500ee824f4bSOmkar Kulkarni 	struct dbg_bus_mem_addr virt_addr; /* PCI buffer virtual address */
501ee824f4bSOmkar Kulkarni 	u32 size; /* PCI buffer size in bytes */
502ee824f4bSOmkar Kulkarni };
503ee824f4bSOmkar Kulkarni 
504ee824f4bSOmkar Kulkarni /* Debug Bus Storm EID range filter params */
505ee824f4bSOmkar Kulkarni struct dbg_bus_storm_eid_range_params {
506ee824f4bSOmkar Kulkarni 	u8 min; /* Minimal event ID to filter on */
507ee824f4bSOmkar Kulkarni 	u8 max; /* Maximal event ID to filter on */
508ee824f4bSOmkar Kulkarni };
509ee824f4bSOmkar Kulkarni 
510ee824f4bSOmkar Kulkarni /* Debug Bus Storm EID mask filter params */
511ee824f4bSOmkar Kulkarni struct dbg_bus_storm_eid_mask_params {
512ee824f4bSOmkar Kulkarni 	u8 val; /* Event ID value */
513ee824f4bSOmkar Kulkarni 	u8 mask; /* Event ID mask. 1s in the mask = dont care bits. */
514ee824f4bSOmkar Kulkarni };
515ee824f4bSOmkar Kulkarni 
516ee824f4bSOmkar Kulkarni /* Debug Bus Storm EID filter params */
517ee824f4bSOmkar Kulkarni union dbg_bus_storm_eid_params {
518ee824f4bSOmkar Kulkarni 	struct dbg_bus_storm_eid_range_params range;
519ee824f4bSOmkar Kulkarni 	struct dbg_bus_storm_eid_mask_params mask;
520ee824f4bSOmkar Kulkarni };
521ee824f4bSOmkar Kulkarni 
522ee824f4bSOmkar Kulkarni /* Debug Bus Storm data */
523ee824f4bSOmkar Kulkarni struct dbg_bus_storm_data {
524ee824f4bSOmkar Kulkarni 	u8 enabled;
525ee824f4bSOmkar Kulkarni 	u8 mode;
526ee824f4bSOmkar Kulkarni 	u8 hw_id;
527ee824f4bSOmkar Kulkarni 	u8 eid_filter_en;
528ee824f4bSOmkar Kulkarni 	u8 eid_range_not_mask;
529ee824f4bSOmkar Kulkarni 	u8 cid_filter_en;
530ee824f4bSOmkar Kulkarni 	union dbg_bus_storm_eid_params eid_filter_params;
531ee824f4bSOmkar Kulkarni 	u32 cid;
532ee824f4bSOmkar Kulkarni };
533ee824f4bSOmkar Kulkarni 
534ee824f4bSOmkar Kulkarni /* Debug Bus data */
535ee824f4bSOmkar Kulkarni struct dbg_bus_data {
536ee824f4bSOmkar Kulkarni 	u32 app_version;
537ee824f4bSOmkar Kulkarni 	u8 state;
538ee824f4bSOmkar Kulkarni 	u8 mode_256b_en;
539ee824f4bSOmkar Kulkarni 	u8 num_enabled_blocks;
540ee824f4bSOmkar Kulkarni 	u8 num_enabled_storms;
541ee824f4bSOmkar Kulkarni 	u8 target;
542ee824f4bSOmkar Kulkarni 	u8 one_shot_en;
543ee824f4bSOmkar Kulkarni 	u8 grc_input_en;
544ee824f4bSOmkar Kulkarni 	u8 timestamp_input_en;
545ee824f4bSOmkar Kulkarni 	u8 filter_en;
546ee824f4bSOmkar Kulkarni 	u8 adding_filter;
547ee824f4bSOmkar Kulkarni 	u8 filter_pre_trigger;
548ee824f4bSOmkar Kulkarni 	u8 filter_post_trigger;
549ee824f4bSOmkar Kulkarni 	u8 trigger_en;
550ee824f4bSOmkar Kulkarni 	u8 filter_constraint_dword_mask;
551ee824f4bSOmkar Kulkarni 	u8 next_trigger_state;
552ee824f4bSOmkar Kulkarni 	u8 next_constraint_id;
553ee824f4bSOmkar Kulkarni 	struct dbg_bus_trigger_state_data trigger_states[3];
554ee824f4bSOmkar Kulkarni 	u8 filter_msg_len;
555ee824f4bSOmkar Kulkarni 	u8 rcv_from_other_engine;
556ee824f4bSOmkar Kulkarni 	u8 blocks_dword_mask;
557ee824f4bSOmkar Kulkarni 	u8 blocks_dword_overlap;
558ee824f4bSOmkar Kulkarni 	u32 hw_id_mask;
559ee824f4bSOmkar Kulkarni 	struct dbg_bus_pci_buf_data pci_buf;
560ee824f4bSOmkar Kulkarni 	struct dbg_bus_block_data blocks[132];
561ee824f4bSOmkar Kulkarni 	struct dbg_bus_storm_data storms[6];
562ee824f4bSOmkar Kulkarni };
563ee824f4bSOmkar Kulkarni 
564ee824f4bSOmkar Kulkarni /* Debug bus states */
565ee824f4bSOmkar Kulkarni enum dbg_bus_states {
566ee824f4bSOmkar Kulkarni 	DBG_BUS_STATE_IDLE,
567ee824f4bSOmkar Kulkarni 	DBG_BUS_STATE_READY,
568ee824f4bSOmkar Kulkarni 	DBG_BUS_STATE_RECORDING,
569ee824f4bSOmkar Kulkarni 	DBG_BUS_STATE_STOPPED,
570ee824f4bSOmkar Kulkarni 	MAX_DBG_BUS_STATES
571ee824f4bSOmkar Kulkarni };
572ee824f4bSOmkar Kulkarni 
573ee824f4bSOmkar Kulkarni /* Debug Bus Storm modes */
574ee824f4bSOmkar Kulkarni enum dbg_bus_storm_modes {
575ee824f4bSOmkar Kulkarni 	DBG_BUS_STORM_MODE_PRINTF,
576ee824f4bSOmkar Kulkarni 	DBG_BUS_STORM_MODE_PRAM_ADDR,
577ee824f4bSOmkar Kulkarni 	DBG_BUS_STORM_MODE_DRA_RW,
578ee824f4bSOmkar Kulkarni 	DBG_BUS_STORM_MODE_DRA_W,
579ee824f4bSOmkar Kulkarni 	DBG_BUS_STORM_MODE_LD_ST_ADDR,
580ee824f4bSOmkar Kulkarni 	DBG_BUS_STORM_MODE_DRA_FSM,
581ee824f4bSOmkar Kulkarni 	DBG_BUS_STORM_MODE_FAST_DBGMUX,
582ee824f4bSOmkar Kulkarni 	DBG_BUS_STORM_MODE_RH,
583ee824f4bSOmkar Kulkarni 	DBG_BUS_STORM_MODE_RH_WITH_STORE,
584ee824f4bSOmkar Kulkarni 	DBG_BUS_STORM_MODE_FOC,
585ee824f4bSOmkar Kulkarni 	DBG_BUS_STORM_MODE_EXT_STORE,
586ee824f4bSOmkar Kulkarni 	MAX_DBG_BUS_STORM_MODES
587ee824f4bSOmkar Kulkarni };
588ee824f4bSOmkar Kulkarni 
589ee824f4bSOmkar Kulkarni /* Debug bus target IDs */
590ee824f4bSOmkar Kulkarni enum dbg_bus_targets {
591ee824f4bSOmkar Kulkarni 	DBG_BUS_TARGET_ID_INT_BUF,
592ee824f4bSOmkar Kulkarni 	DBG_BUS_TARGET_ID_NIG,
593ee824f4bSOmkar Kulkarni 	DBG_BUS_TARGET_ID_PCI,
594ee824f4bSOmkar Kulkarni 	MAX_DBG_BUS_TARGETS
595ee824f4bSOmkar Kulkarni };
596ee824f4bSOmkar Kulkarni 
597ee824f4bSOmkar Kulkarni /* GRC Dump data */
598ee824f4bSOmkar Kulkarni struct dbg_grc_data {
599ee824f4bSOmkar Kulkarni 	u8 params_initialized;
600ee824f4bSOmkar Kulkarni 	u8 reserved1;
601ee824f4bSOmkar Kulkarni 	u16 reserved2;
602ee824f4bSOmkar Kulkarni 	u32 param_val[48];
603ee824f4bSOmkar Kulkarni };
604ee824f4bSOmkar Kulkarni 
605ee824f4bSOmkar Kulkarni /* Debug GRC params */
606ee824f4bSOmkar Kulkarni enum dbg_grc_params {
607ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_TSTORM,
608ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_MSTORM,
609ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_USTORM,
610ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_XSTORM,
611ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_YSTORM,
612ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_PSTORM,
613ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_REGS,
614ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_RAM,
615ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_PBUF,
616ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_IOR,
617ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_VFC,
618ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_CM_CTX,
619ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_PXP,
620ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_RSS,
621ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_CAU,
622ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_QM,
623ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_MCP,
624ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_DORQ,
625ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_CFC,
626ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_IGU,
627ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_BRB,
628ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_BTB,
629ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_BMB,
630ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_RESERVD1,
631ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_MULD,
632ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_PRS,
633ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_DMAE,
634ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_TM,
635ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_SDM,
636ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_DIF,
637ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_STATIC,
638ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_UNSTALL,
639ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_RESERVED2,
640ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_MCP_TRACE_META_SIZE,
641ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_EXCLUDE_ALL,
642ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_CRASH,
643ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_PARITY_SAFE,
644ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_CM,
645ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_PHY,
646ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_NO_MCP,
647ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_NO_FW_VER,
648ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_RESERVED3,
649ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_MCP_HW_DUMP,
650ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_ILT_CDUC,
651ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_ILT_CDUT,
652ee824f4bSOmkar Kulkarni 	DBG_GRC_PARAM_DUMP_CAU_EXT,
653ee824f4bSOmkar Kulkarni 	MAX_DBG_GRC_PARAMS
654ee824f4bSOmkar Kulkarni };
655ee824f4bSOmkar Kulkarni 
656ee824f4bSOmkar Kulkarni /* Debug status codes */
657ee824f4bSOmkar Kulkarni enum dbg_status {
658ee824f4bSOmkar Kulkarni 	DBG_STATUS_OK,
659ee824f4bSOmkar Kulkarni 	DBG_STATUS_APP_VERSION_NOT_SET,
660ee824f4bSOmkar Kulkarni 	DBG_STATUS_UNSUPPORTED_APP_VERSION,
661ee824f4bSOmkar Kulkarni 	DBG_STATUS_DBG_BLOCK_NOT_RESET,
662ee824f4bSOmkar Kulkarni 	DBG_STATUS_INVALID_ARGS,
663ee824f4bSOmkar Kulkarni 	DBG_STATUS_OUTPUT_ALREADY_SET,
664ee824f4bSOmkar Kulkarni 	DBG_STATUS_INVALID_PCI_BUF_SIZE,
665ee824f4bSOmkar Kulkarni 	DBG_STATUS_PCI_BUF_ALLOC_FAILED,
666ee824f4bSOmkar Kulkarni 	DBG_STATUS_PCI_BUF_NOT_ALLOCATED,
667ee824f4bSOmkar Kulkarni 	DBG_STATUS_INVALID_FILTER_TRIGGER_DWORDS,
668ee824f4bSOmkar Kulkarni 	DBG_STATUS_NO_MATCHING_FRAMING_MODE,
669ee824f4bSOmkar Kulkarni 	DBG_STATUS_VFC_READ_ERROR,
670ee824f4bSOmkar Kulkarni 	DBG_STATUS_STORM_ALREADY_ENABLED,
671ee824f4bSOmkar Kulkarni 	DBG_STATUS_STORM_NOT_ENABLED,
672ee824f4bSOmkar Kulkarni 	DBG_STATUS_BLOCK_ALREADY_ENABLED,
673ee824f4bSOmkar Kulkarni 	DBG_STATUS_BLOCK_NOT_ENABLED,
674ee824f4bSOmkar Kulkarni 	DBG_STATUS_NO_INPUT_ENABLED,
675ee824f4bSOmkar Kulkarni 	DBG_STATUS_NO_FILTER_TRIGGER_256B,
676ee824f4bSOmkar Kulkarni 	DBG_STATUS_FILTER_ALREADY_ENABLED,
677ee824f4bSOmkar Kulkarni 	DBG_STATUS_TRIGGER_ALREADY_ENABLED,
678ee824f4bSOmkar Kulkarni 	DBG_STATUS_TRIGGER_NOT_ENABLED,
679ee824f4bSOmkar Kulkarni 	DBG_STATUS_CANT_ADD_CONSTRAINT,
680ee824f4bSOmkar Kulkarni 	DBG_STATUS_TOO_MANY_TRIGGER_STATES,
681ee824f4bSOmkar Kulkarni 	DBG_STATUS_TOO_MANY_CONSTRAINTS,
682ee824f4bSOmkar Kulkarni 	DBG_STATUS_RECORDING_NOT_STARTED,
683ee824f4bSOmkar Kulkarni 	DBG_STATUS_DATA_DIDNT_TRIGGER,
684ee824f4bSOmkar Kulkarni 	DBG_STATUS_NO_DATA_RECORDED,
685ee824f4bSOmkar Kulkarni 	DBG_STATUS_DUMP_BUF_TOO_SMALL,
686ee824f4bSOmkar Kulkarni 	DBG_STATUS_DUMP_NOT_CHUNK_ALIGNED,
687ee824f4bSOmkar Kulkarni 	DBG_STATUS_UNKNOWN_CHIP,
688ee824f4bSOmkar Kulkarni 	DBG_STATUS_VIRT_MEM_ALLOC_FAILED,
689ee824f4bSOmkar Kulkarni 	DBG_STATUS_BLOCK_IN_RESET,
690ee824f4bSOmkar Kulkarni 	DBG_STATUS_INVALID_TRACE_SIGNATURE,
691ee824f4bSOmkar Kulkarni 	DBG_STATUS_INVALID_NVRAM_BUNDLE,
692ee824f4bSOmkar Kulkarni 	DBG_STATUS_NVRAM_GET_IMAGE_FAILED,
693ee824f4bSOmkar Kulkarni 	DBG_STATUS_NON_ALIGNED_NVRAM_IMAGE,
694ee824f4bSOmkar Kulkarni 	DBG_STATUS_NVRAM_READ_FAILED,
695ee824f4bSOmkar Kulkarni 	DBG_STATUS_IDLE_CHK_PARSE_FAILED,
696ee824f4bSOmkar Kulkarni 	DBG_STATUS_MCP_TRACE_BAD_DATA,
697ee824f4bSOmkar Kulkarni 	DBG_STATUS_MCP_TRACE_NO_META,
698ee824f4bSOmkar Kulkarni 	DBG_STATUS_MCP_COULD_NOT_HALT,
699ee824f4bSOmkar Kulkarni 	DBG_STATUS_MCP_COULD_NOT_RESUME,
700ee824f4bSOmkar Kulkarni 	DBG_STATUS_RESERVED0,
701ee824f4bSOmkar Kulkarni 	DBG_STATUS_SEMI_FIFO_NOT_EMPTY,
702ee824f4bSOmkar Kulkarni 	DBG_STATUS_IGU_FIFO_BAD_DATA,
703ee824f4bSOmkar Kulkarni 	DBG_STATUS_MCP_COULD_NOT_MASK_PRTY,
704ee824f4bSOmkar Kulkarni 	DBG_STATUS_FW_ASSERTS_PARSE_FAILED,
705ee824f4bSOmkar Kulkarni 	DBG_STATUS_REG_FIFO_BAD_DATA,
706ee824f4bSOmkar Kulkarni 	DBG_STATUS_PROTECTION_OVERRIDE_BAD_DATA,
707ee824f4bSOmkar Kulkarni 	DBG_STATUS_DBG_ARRAY_NOT_SET,
708ee824f4bSOmkar Kulkarni 	DBG_STATUS_RESERVED1,
709ee824f4bSOmkar Kulkarni 	DBG_STATUS_NON_MATCHING_LINES,
710ee824f4bSOmkar Kulkarni 	DBG_STATUS_INSUFFICIENT_HW_IDS,
711ee824f4bSOmkar Kulkarni 	DBG_STATUS_DBG_BUS_IN_USE,
712ee824f4bSOmkar Kulkarni 	DBG_STATUS_INVALID_STORM_DBG_MODE,
713ee824f4bSOmkar Kulkarni 	DBG_STATUS_OTHER_ENGINE_BB_ONLY,
714ee824f4bSOmkar Kulkarni 	DBG_STATUS_FILTER_SINGLE_HW_ID,
715ee824f4bSOmkar Kulkarni 	DBG_STATUS_TRIGGER_SINGLE_HW_ID,
716ee824f4bSOmkar Kulkarni 	DBG_STATUS_MISSING_TRIGGER_STATE_STORM,
717ee824f4bSOmkar Kulkarni 	MAX_DBG_STATUS
718ee824f4bSOmkar Kulkarni };
719ee824f4bSOmkar Kulkarni 
720ee824f4bSOmkar Kulkarni /* Debug Storms IDs */
721ee824f4bSOmkar Kulkarni enum dbg_storms {
722ee824f4bSOmkar Kulkarni 	DBG_TSTORM_ID,
723ee824f4bSOmkar Kulkarni 	DBG_MSTORM_ID,
724ee824f4bSOmkar Kulkarni 	DBG_USTORM_ID,
725ee824f4bSOmkar Kulkarni 	DBG_XSTORM_ID,
726ee824f4bSOmkar Kulkarni 	DBG_YSTORM_ID,
727ee824f4bSOmkar Kulkarni 	DBG_PSTORM_ID,
728ee824f4bSOmkar Kulkarni 	MAX_DBG_STORMS
729ee824f4bSOmkar Kulkarni };
730ee824f4bSOmkar Kulkarni 
731ee824f4bSOmkar Kulkarni /* Idle Check data */
732ee824f4bSOmkar Kulkarni struct idle_chk_data {
733ee824f4bSOmkar Kulkarni 	u32 buf_size;
734ee824f4bSOmkar Kulkarni 	u8 buf_size_set;
735ee824f4bSOmkar Kulkarni 	u8 reserved1;
736ee824f4bSOmkar Kulkarni 	u16 reserved2;
737ee824f4bSOmkar Kulkarni };
738ee824f4bSOmkar Kulkarni 
739ee824f4bSOmkar Kulkarni struct pretend_params {
740ee824f4bSOmkar Kulkarni 	u8 split_type;
741ee824f4bSOmkar Kulkarni 	u8 reserved;
742ee824f4bSOmkar Kulkarni 	u16 split_id;
743ee824f4bSOmkar Kulkarni };
744ee824f4bSOmkar Kulkarni 
745ee824f4bSOmkar Kulkarni /* Debug Tools data (per HW function)
746ee824f4bSOmkar Kulkarni  */
747ee824f4bSOmkar Kulkarni struct dbg_tools_data {
748ee824f4bSOmkar Kulkarni 	struct dbg_grc_data grc;
749ee824f4bSOmkar Kulkarni 	struct dbg_bus_data bus;
750ee824f4bSOmkar Kulkarni 	struct idle_chk_data idle_chk;
751ee824f4bSOmkar Kulkarni 	u8 mode_enable[40];
752ee824f4bSOmkar Kulkarni 	u8 block_in_reset[132];
753ee824f4bSOmkar Kulkarni 	u8 chip_id;
754ee824f4bSOmkar Kulkarni 	u8 hw_type;
755ee824f4bSOmkar Kulkarni 	u8 num_ports;
756ee824f4bSOmkar Kulkarni 	u8 num_pfs_per_port;
757ee824f4bSOmkar Kulkarni 	u8 num_vfs;
758ee824f4bSOmkar Kulkarni 	u8 initialized;
759ee824f4bSOmkar Kulkarni 	u8 use_dmae;
760ee824f4bSOmkar Kulkarni 	u8 reserved;
761ee824f4bSOmkar Kulkarni 	struct pretend_params pretend;
762ee824f4bSOmkar Kulkarni 	u32 num_regs_read;
763ee824f4bSOmkar Kulkarni };
764ee824f4bSOmkar Kulkarni 
765ee824f4bSOmkar Kulkarni /* ILT Clients */
766ee824f4bSOmkar Kulkarni enum ilt_clients {
767ee824f4bSOmkar Kulkarni 	ILT_CLI_CDUC,
768ee824f4bSOmkar Kulkarni 	ILT_CLI_CDUT,
769ee824f4bSOmkar Kulkarni 	ILT_CLI_QM,
770ee824f4bSOmkar Kulkarni 	ILT_CLI_TM,
771ee824f4bSOmkar Kulkarni 	ILT_CLI_SRC,
772ee824f4bSOmkar Kulkarni 	ILT_CLI_TSDM,
773ee824f4bSOmkar Kulkarni 	ILT_CLI_RGFS,
774ee824f4bSOmkar Kulkarni 	ILT_CLI_TGFS,
775ee824f4bSOmkar Kulkarni 	MAX_ILT_CLIENTS
776ee824f4bSOmkar Kulkarni };
777ee824f4bSOmkar Kulkarni 
778ee824f4bSOmkar Kulkarni /***************************** Public Functions *******************************/
779ee824f4bSOmkar Kulkarni 
780ee824f4bSOmkar Kulkarni /**
781ee824f4bSOmkar Kulkarni  * qed_dbg_set_bin_ptr(): Sets a pointer to the binary data with debug
782ee824f4bSOmkar Kulkarni  *                        arrays.
783ee824f4bSOmkar Kulkarni  *
784ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
785ee824f4bSOmkar Kulkarni  * @bin_ptr: A pointer to the binary data with debug arrays.
786ee824f4bSOmkar Kulkarni  *
787ee824f4bSOmkar Kulkarni  * Return: enum dbg status.
788ee824f4bSOmkar Kulkarni  */
789ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_set_bin_ptr(struct qed_hwfn *p_hwfn,
790ee824f4bSOmkar Kulkarni 				    const u8 * const bin_ptr);
791ee824f4bSOmkar Kulkarni 
792ee824f4bSOmkar Kulkarni /**
793ee824f4bSOmkar Kulkarni  * qed_read_regs(): Reads registers into a buffer (using GRC).
794ee824f4bSOmkar Kulkarni  *
795ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
796ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
797ee824f4bSOmkar Kulkarni  * @buf: Destination buffer.
798ee824f4bSOmkar Kulkarni  * @addr: Source GRC address in dwords.
799ee824f4bSOmkar Kulkarni  * @len: Number of registers to read.
800ee824f4bSOmkar Kulkarni  *
801ee824f4bSOmkar Kulkarni  * Return: Void.
802ee824f4bSOmkar Kulkarni  */
803ee824f4bSOmkar Kulkarni void qed_read_regs(struct qed_hwfn *p_hwfn,
804ee824f4bSOmkar Kulkarni 		   struct qed_ptt *p_ptt, u32 *buf, u32 addr, u32 len);
805ee824f4bSOmkar Kulkarni 
806ee824f4bSOmkar Kulkarni /**
807ee824f4bSOmkar Kulkarni  * qed_read_fw_info(): Reads FW info from the chip.
808ee824f4bSOmkar Kulkarni  *
809ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
810ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
811ee824f4bSOmkar Kulkarni  * @fw_info: (Out) a pointer to write the FW info into.
812ee824f4bSOmkar Kulkarni  *
813ee824f4bSOmkar Kulkarni  * Return: True if the FW info was read successfully from one of the Storms,
814ee824f4bSOmkar Kulkarni  * or false if all Storms are in reset.
815ee824f4bSOmkar Kulkarni  *
816ee824f4bSOmkar Kulkarni  * The FW info contains FW-related information, such as the FW version,
817ee824f4bSOmkar Kulkarni  * FW image (main/L2B/kuku), FW timestamp, etc.
818ee824f4bSOmkar Kulkarni  * The FW info is read from the internal RAM of the first Storm that is not in
819ee824f4bSOmkar Kulkarni  * reset.
820ee824f4bSOmkar Kulkarni  */
821ee824f4bSOmkar Kulkarni bool qed_read_fw_info(struct qed_hwfn *p_hwfn,
822ee824f4bSOmkar Kulkarni 		      struct qed_ptt *p_ptt, struct fw_info *fw_info);
823ee824f4bSOmkar Kulkarni /**
824ee824f4bSOmkar Kulkarni  * qed_dbg_grc_config(): Sets the value of a GRC parameter.
825ee824f4bSOmkar Kulkarni  *
826ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
827ee824f4bSOmkar Kulkarni  * @grc_param: GRC parameter.
828ee824f4bSOmkar Kulkarni  * @val: Value to set.
829ee824f4bSOmkar Kulkarni  *
830ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
831ee824f4bSOmkar Kulkarni  *         - The version wasn't set.
832ee824f4bSOmkar Kulkarni  *         - Grc_param is invalid.
833ee824f4bSOmkar Kulkarni  *         - Val is outside the allowed boundaries.
834ee824f4bSOmkar Kulkarni  */
835ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_grc_config(struct qed_hwfn *p_hwfn,
836ee824f4bSOmkar Kulkarni 				   enum dbg_grc_params grc_param, u32 val);
837ee824f4bSOmkar Kulkarni 
838ee824f4bSOmkar Kulkarni /**
839ee824f4bSOmkar Kulkarni  * qed_dbg_grc_set_params_default(): Reverts all GRC parameters to their
840ee824f4bSOmkar Kulkarni  *                                   default value.
841ee824f4bSOmkar Kulkarni  *
842ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
843ee824f4bSOmkar Kulkarni  *
844ee824f4bSOmkar Kulkarni  * Return: Void.
845ee824f4bSOmkar Kulkarni  */
846ee824f4bSOmkar Kulkarni void qed_dbg_grc_set_params_default(struct qed_hwfn *p_hwfn);
847ee824f4bSOmkar Kulkarni /**
848ee824f4bSOmkar Kulkarni  * qed_dbg_grc_get_dump_buf_size(): Returns the required buffer size for
849ee824f4bSOmkar Kulkarni  *                                  GRC Dump.
850ee824f4bSOmkar Kulkarni  *
851ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
852ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
853ee824f4bSOmkar Kulkarni  * @buf_size: (OUT) required buffer size (in dwords) for the GRC Dump
854ee824f4bSOmkar Kulkarni  *             data.
855ee824f4bSOmkar Kulkarni  *
856ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
857ee824f4bSOmkar Kulkarni  *         - The version wasn't set
858ee824f4bSOmkar Kulkarni  *           Otherwise, returns ok.
859ee824f4bSOmkar Kulkarni  */
860ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_grc_get_dump_buf_size(struct qed_hwfn *p_hwfn,
861ee824f4bSOmkar Kulkarni 					      struct qed_ptt *p_ptt,
862ee824f4bSOmkar Kulkarni 					      u32 *buf_size);
863ee824f4bSOmkar Kulkarni 
864ee824f4bSOmkar Kulkarni /**
865ee824f4bSOmkar Kulkarni  * qed_dbg_grc_dump(): Dumps GRC data into the specified buffer.
866ee824f4bSOmkar Kulkarni  *
867ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
868ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
869ee824f4bSOmkar Kulkarni  * @dump_buf: Pointer to write the collected GRC data into.
870ee824f4bSOmkar Kulkarni  * @buf_size_in_dwords:Size of the specified buffer in dwords.
871ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: (OUT) number of dumped dwords.
872ee824f4bSOmkar Kulkarni  *
873ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
874ee824f4bSOmkar Kulkarni  *        - The version wasn't set.
875ee824f4bSOmkar Kulkarni  *        - The specified dump buffer is too small.
876ee824f4bSOmkar Kulkarni  *          Otherwise, returns ok.
877ee824f4bSOmkar Kulkarni  */
878ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_grc_dump(struct qed_hwfn *p_hwfn,
879ee824f4bSOmkar Kulkarni 				 struct qed_ptt *p_ptt,
880ee824f4bSOmkar Kulkarni 				 u32 *dump_buf,
881ee824f4bSOmkar Kulkarni 				 u32 buf_size_in_dwords,
882ee824f4bSOmkar Kulkarni 				 u32 *num_dumped_dwords);
883ee824f4bSOmkar Kulkarni 
884ee824f4bSOmkar Kulkarni /**
885ee824f4bSOmkar Kulkarni  * qed_dbg_idle_chk_get_dump_buf_size(): Returns the required buffer size
886ee824f4bSOmkar Kulkarni  *                                       for idle check results.
887ee824f4bSOmkar Kulkarni  *
888ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
889ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
890ee824f4bSOmkar Kulkarni  * @buf_size: (OUT) required buffer size (in dwords) for the idle check
891ee824f4bSOmkar Kulkarni  *             data.
892ee824f4bSOmkar Kulkarni  *
893ee824f4bSOmkar Kulkarni  * return: Error if one of the following holds:
894ee824f4bSOmkar Kulkarni  *        - The version wasn't set.
895ee824f4bSOmkar Kulkarni  *          Otherwise, returns ok.
896ee824f4bSOmkar Kulkarni  */
897ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_idle_chk_get_dump_buf_size(struct qed_hwfn *p_hwfn,
898ee824f4bSOmkar Kulkarni 						   struct qed_ptt *p_ptt,
899ee824f4bSOmkar Kulkarni 						   u32 *buf_size);
900ee824f4bSOmkar Kulkarni 
901ee824f4bSOmkar Kulkarni /**
902ee824f4bSOmkar Kulkarni  * qed_dbg_idle_chk_dump: Performs idle check and writes the results
903ee824f4bSOmkar Kulkarni  *                        into the specified buffer.
904ee824f4bSOmkar Kulkarni  *
905ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
906ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
907ee824f4bSOmkar Kulkarni  * @dump_buf: Pointer to write the idle check data into.
908ee824f4bSOmkar Kulkarni  * @buf_size_in_dwords: Size of the specified buffer in dwords.
909ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: (OUT) number of dumped dwords.
910ee824f4bSOmkar Kulkarni  *
911ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
912ee824f4bSOmkar Kulkarni  *         - The version wasn't set.
913ee824f4bSOmkar Kulkarni  *         - The specified buffer is too small.
914ee824f4bSOmkar Kulkarni  *           Otherwise, returns ok.
915ee824f4bSOmkar Kulkarni  */
916ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_idle_chk_dump(struct qed_hwfn *p_hwfn,
917ee824f4bSOmkar Kulkarni 				      struct qed_ptt *p_ptt,
918ee824f4bSOmkar Kulkarni 				      u32 *dump_buf,
919ee824f4bSOmkar Kulkarni 				      u32 buf_size_in_dwords,
920ee824f4bSOmkar Kulkarni 				      u32 *num_dumped_dwords);
921ee824f4bSOmkar Kulkarni 
922ee824f4bSOmkar Kulkarni /**
923ee824f4bSOmkar Kulkarni  * qed_dbg_mcp_trace_get_dump_buf_size(): Returns the required buffer size
924ee824f4bSOmkar Kulkarni  *                                        for mcp trace results.
925ee824f4bSOmkar Kulkarni  *
926ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
927ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
928ee824f4bSOmkar Kulkarni  * @buf_size: (OUT) Required buffer size (in dwords) for mcp trace data.
929ee824f4bSOmkar Kulkarni  *
930ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
931ee824f4bSOmkar Kulkarni  *         - The version wasn't set.
932ee824f4bSOmkar Kulkarni  *         - The trace data in MCP scratchpad contain an invalid signature.
933ee824f4bSOmkar Kulkarni  *         - The bundle ID in NVRAM is invalid.
934ee824f4bSOmkar Kulkarni  *         - The trace meta data cannot be found (in NVRAM or image file).
935ee824f4bSOmkar Kulkarni  *           Otherwise, returns ok.
936ee824f4bSOmkar Kulkarni  */
937ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_mcp_trace_get_dump_buf_size(struct qed_hwfn *p_hwfn,
938ee824f4bSOmkar Kulkarni 						    struct qed_ptt *p_ptt,
939ee824f4bSOmkar Kulkarni 						    u32 *buf_size);
940ee824f4bSOmkar Kulkarni 
941ee824f4bSOmkar Kulkarni /**
942ee824f4bSOmkar Kulkarni  * qed_dbg_mcp_trace_dump(): Performs mcp trace and writes the results
943ee824f4bSOmkar Kulkarni  *                           into the specified buffer.
944ee824f4bSOmkar Kulkarni  *
945ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
946ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
947ee824f4bSOmkar Kulkarni  * @dump_buf: Pointer to write the mcp trace data into.
948ee824f4bSOmkar Kulkarni  * @buf_size_in_dwords: Size of the specified buffer in dwords.
949ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: (OUT) number of dumped dwords.
950ee824f4bSOmkar Kulkarni  *
951ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
952ee824f4bSOmkar Kulkarni  *        - The version wasn't set.
953ee824f4bSOmkar Kulkarni  *        - The specified buffer is too small.
954ee824f4bSOmkar Kulkarni  *        - The trace data in MCP scratchpad contain an invalid signature.
955ee824f4bSOmkar Kulkarni  *        - The bundle ID in NVRAM is invalid.
956ee824f4bSOmkar Kulkarni  *        - The trace meta data cannot be found (in NVRAM or image file).
957ee824f4bSOmkar Kulkarni  *        - The trace meta data cannot be read (from NVRAM or image file).
958ee824f4bSOmkar Kulkarni  *          Otherwise, returns ok.
959ee824f4bSOmkar Kulkarni  */
960ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_mcp_trace_dump(struct qed_hwfn *p_hwfn,
961ee824f4bSOmkar Kulkarni 				       struct qed_ptt *p_ptt,
962ee824f4bSOmkar Kulkarni 				       u32 *dump_buf,
963ee824f4bSOmkar Kulkarni 				       u32 buf_size_in_dwords,
964ee824f4bSOmkar Kulkarni 				       u32 *num_dumped_dwords);
965ee824f4bSOmkar Kulkarni 
966ee824f4bSOmkar Kulkarni /**
967ee824f4bSOmkar Kulkarni  * qed_dbg_reg_fifo_get_dump_buf_size(): Returns the required buffer size
968ee824f4bSOmkar Kulkarni  *                                       for grc trace fifo results.
969ee824f4bSOmkar Kulkarni  *
970ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
971ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
972ee824f4bSOmkar Kulkarni  * @buf_size: (OUT) Required buffer size (in dwords) for reg fifo data.
973ee824f4bSOmkar Kulkarni  *
974ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
975ee824f4bSOmkar Kulkarni  *         - The version wasn't set
976ee824f4bSOmkar Kulkarni  *           Otherwise, returns ok.
977ee824f4bSOmkar Kulkarni  */
978ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_reg_fifo_get_dump_buf_size(struct qed_hwfn *p_hwfn,
979ee824f4bSOmkar Kulkarni 						   struct qed_ptt *p_ptt,
980ee824f4bSOmkar Kulkarni 						   u32 *buf_size);
981ee824f4bSOmkar Kulkarni 
982ee824f4bSOmkar Kulkarni /**
983ee824f4bSOmkar Kulkarni  * qed_dbg_reg_fifo_dump(): Reads the reg fifo and writes the results into
984ee824f4bSOmkar Kulkarni  *                          the specified buffer.
985ee824f4bSOmkar Kulkarni  *
986ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
987ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
988ee824f4bSOmkar Kulkarni  * @dump_buf: Pointer to write the reg fifo data into.
989ee824f4bSOmkar Kulkarni  * @buf_size_in_dwords: Size of the specified buffer in dwords.
990ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: (OUT) number of dumped dwords.
991ee824f4bSOmkar Kulkarni  *
992ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
993ee824f4bSOmkar Kulkarni  *        - The version wasn't set.
994ee824f4bSOmkar Kulkarni  *        - The specified buffer is too small.
995ee824f4bSOmkar Kulkarni  *        - DMAE transaction failed.
996ee824f4bSOmkar Kulkarni  *           Otherwise, returns ok.
997ee824f4bSOmkar Kulkarni  */
998ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_reg_fifo_dump(struct qed_hwfn *p_hwfn,
999ee824f4bSOmkar Kulkarni 				      struct qed_ptt *p_ptt,
1000ee824f4bSOmkar Kulkarni 				      u32 *dump_buf,
1001ee824f4bSOmkar Kulkarni 				      u32 buf_size_in_dwords,
1002ee824f4bSOmkar Kulkarni 				      u32 *num_dumped_dwords);
1003ee824f4bSOmkar Kulkarni 
1004ee824f4bSOmkar Kulkarni /**
1005ee824f4bSOmkar Kulkarni  * qed_dbg_igu_fifo_get_dump_buf_size(): Returns the required buffer size
1006ee824f4bSOmkar Kulkarni  *                                       for the IGU fifo results.
1007ee824f4bSOmkar Kulkarni  *
1008ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1009ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
1010ee824f4bSOmkar Kulkarni  * @buf_size: (OUT) Required buffer size (in dwords) for the IGU fifo
1011ee824f4bSOmkar Kulkarni  *            data.
1012ee824f4bSOmkar Kulkarni  *
1013ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
1014ee824f4bSOmkar Kulkarni  *         - The version wasn't set.
1015ee824f4bSOmkar Kulkarni  *           Otherwise, returns ok.
1016ee824f4bSOmkar Kulkarni  */
1017ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_igu_fifo_get_dump_buf_size(struct qed_hwfn *p_hwfn,
1018ee824f4bSOmkar Kulkarni 						   struct qed_ptt *p_ptt,
1019ee824f4bSOmkar Kulkarni 						   u32 *buf_size);
1020ee824f4bSOmkar Kulkarni 
1021ee824f4bSOmkar Kulkarni /**
1022ee824f4bSOmkar Kulkarni  * qed_dbg_igu_fifo_dump(): Reads the IGU fifo and writes the results into
1023ee824f4bSOmkar Kulkarni  *                          the specified buffer.
1024ee824f4bSOmkar Kulkarni  *
1025ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1026ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
1027ee824f4bSOmkar Kulkarni  * @dump_buf: Pointer to write the IGU fifo data into.
1028ee824f4bSOmkar Kulkarni  * @buf_size_in_dwords: Size of the specified buffer in dwords.
1029ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: (OUT) number of dumped dwords.
1030ee824f4bSOmkar Kulkarni  *
1031ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
1032ee824f4bSOmkar Kulkarni  *         - The version wasn't set
1033ee824f4bSOmkar Kulkarni  *         - The specified buffer is too small
1034ee824f4bSOmkar Kulkarni  *         - DMAE transaction failed
1035ee824f4bSOmkar Kulkarni  *           Otherwise, returns ok.
1036ee824f4bSOmkar Kulkarni  */
1037ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_igu_fifo_dump(struct qed_hwfn *p_hwfn,
1038ee824f4bSOmkar Kulkarni 				      struct qed_ptt *p_ptt,
1039ee824f4bSOmkar Kulkarni 				      u32 *dump_buf,
1040ee824f4bSOmkar Kulkarni 				      u32 buf_size_in_dwords,
1041ee824f4bSOmkar Kulkarni 				      u32 *num_dumped_dwords);
1042ee824f4bSOmkar Kulkarni 
1043ee824f4bSOmkar Kulkarni /**
1044ee824f4bSOmkar Kulkarni  * qed_dbg_protection_override_get_dump_buf_size(): Returns the required
1045ee824f4bSOmkar Kulkarni  *        buffer size for protection override window results.
1046ee824f4bSOmkar Kulkarni  *
1047ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1048ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
1049ee824f4bSOmkar Kulkarni  * @buf_size: (OUT) Required buffer size (in dwords) for protection
1050ee824f4bSOmkar Kulkarni  *             override data.
1051ee824f4bSOmkar Kulkarni  *
1052ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
1053ee824f4bSOmkar Kulkarni  *         - The version wasn't set
1054ee824f4bSOmkar Kulkarni  *           Otherwise, returns ok.
1055ee824f4bSOmkar Kulkarni  */
1056ee824f4bSOmkar Kulkarni enum dbg_status
1057ee824f4bSOmkar Kulkarni qed_dbg_protection_override_get_dump_buf_size(struct qed_hwfn *p_hwfn,
1058ee824f4bSOmkar Kulkarni 					      struct qed_ptt *p_ptt,
1059ee824f4bSOmkar Kulkarni 					      u32 *buf_size);
1060ee824f4bSOmkar Kulkarni /**
1061ee824f4bSOmkar Kulkarni  * qed_dbg_protection_override_dump(): Reads protection override window
1062ee824f4bSOmkar Kulkarni  *       entries and writes the results into the specified buffer.
1063ee824f4bSOmkar Kulkarni  *
1064ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1065ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
1066ee824f4bSOmkar Kulkarni  * @dump_buf: Pointer to write the protection override data into.
1067ee824f4bSOmkar Kulkarni  * @buf_size_in_dwords: Size of the specified buffer in dwords.
1068ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: (OUT) number of dumped dwords.
1069ee824f4bSOmkar Kulkarni  *
1070ee824f4bSOmkar Kulkarni  * @return: Error if one of the following holds:
1071ee824f4bSOmkar Kulkarni  *          - The version wasn't set.
1072ee824f4bSOmkar Kulkarni  *          - The specified buffer is too small.
1073ee824f4bSOmkar Kulkarni  *          - DMAE transaction failed.
1074ee824f4bSOmkar Kulkarni  *             Otherwise, returns ok.
1075ee824f4bSOmkar Kulkarni  */
1076ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_protection_override_dump(struct qed_hwfn *p_hwfn,
1077ee824f4bSOmkar Kulkarni 						 struct qed_ptt *p_ptt,
1078ee824f4bSOmkar Kulkarni 						 u32 *dump_buf,
1079ee824f4bSOmkar Kulkarni 						 u32 buf_size_in_dwords,
1080ee824f4bSOmkar Kulkarni 						 u32 *num_dumped_dwords);
1081ee824f4bSOmkar Kulkarni /**
1082ee824f4bSOmkar Kulkarni  * qed_dbg_fw_asserts_get_dump_buf_size(): Returns the required buffer
1083ee824f4bSOmkar Kulkarni  *                                         size for FW Asserts results.
1084ee824f4bSOmkar Kulkarni  *
1085ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1086ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
1087ee824f4bSOmkar Kulkarni  * @buf_size: (OUT) Required buffer size (in dwords) for FW Asserts data.
1088ee824f4bSOmkar Kulkarni  *
1089ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
1090ee824f4bSOmkar Kulkarni  *         - The version wasn't set.
1091ee824f4bSOmkar Kulkarni  *           Otherwise, returns ok.
1092ee824f4bSOmkar Kulkarni  */
1093ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_fw_asserts_get_dump_buf_size(struct qed_hwfn *p_hwfn,
1094ee824f4bSOmkar Kulkarni 						     struct qed_ptt *p_ptt,
1095ee824f4bSOmkar Kulkarni 						     u32 *buf_size);
1096ee824f4bSOmkar Kulkarni /**
1097ee824f4bSOmkar Kulkarni  * qed_dbg_fw_asserts_dump(): Reads the FW Asserts and writes the results
1098ee824f4bSOmkar Kulkarni  *                            into the specified buffer.
1099ee824f4bSOmkar Kulkarni  *
1100ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1101ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
1102ee824f4bSOmkar Kulkarni  * @dump_buf: Pointer to write the FW Asserts data into.
1103ee824f4bSOmkar Kulkarni  * @buf_size_in_dwords: Size of the specified buffer in dwords.
1104ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: (OUT) number of dumped dwords.
1105ee824f4bSOmkar Kulkarni  *
1106ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
1107ee824f4bSOmkar Kulkarni  *         - The version wasn't set.
1108ee824f4bSOmkar Kulkarni  *         - The specified buffer is too small.
1109ee824f4bSOmkar Kulkarni  *           Otherwise, returns ok.
1110ee824f4bSOmkar Kulkarni  */
1111ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_fw_asserts_dump(struct qed_hwfn *p_hwfn,
1112ee824f4bSOmkar Kulkarni 					struct qed_ptt *p_ptt,
1113ee824f4bSOmkar Kulkarni 					u32 *dump_buf,
1114ee824f4bSOmkar Kulkarni 					u32 buf_size_in_dwords,
1115ee824f4bSOmkar Kulkarni 					u32 *num_dumped_dwords);
1116ee824f4bSOmkar Kulkarni 
1117ee824f4bSOmkar Kulkarni /**
1118ee824f4bSOmkar Kulkarni  * qed_dbg_read_attn(): Reads the attention registers of the specified
1119ee824f4bSOmkar Kulkarni  * block and type, and writes the results into the specified buffer.
1120ee824f4bSOmkar Kulkarni  *
1121ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1122ee824f4bSOmkar Kulkarni  * @p_ptt: Ptt window used for writing the registers.
1123ee824f4bSOmkar Kulkarni  * @block: Block ID.
1124ee824f4bSOmkar Kulkarni  * @attn_type: Attention type.
1125ee824f4bSOmkar Kulkarni  * @clear_status: Indicates if the attention status should be cleared.
1126ee824f4bSOmkar Kulkarni  * @results:  (OUT) Pointer to write the read results into.
1127ee824f4bSOmkar Kulkarni  *
1128ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
1129ee824f4bSOmkar Kulkarni  *         - The version wasn't set
1130ee824f4bSOmkar Kulkarni  *          Otherwise, returns ok.
1131ee824f4bSOmkar Kulkarni  */
1132ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_read_attn(struct qed_hwfn *p_hwfn,
1133ee824f4bSOmkar Kulkarni 				  struct qed_ptt *p_ptt,
1134ee824f4bSOmkar Kulkarni 				  enum block_id block,
1135ee824f4bSOmkar Kulkarni 				  enum dbg_attn_type attn_type,
1136ee824f4bSOmkar Kulkarni 				  bool clear_status,
1137ee824f4bSOmkar Kulkarni 				  struct dbg_attn_block_result *results);
1138ee824f4bSOmkar Kulkarni 
1139ee824f4bSOmkar Kulkarni /**
1140ee824f4bSOmkar Kulkarni  * qed_dbg_print_attn(): Prints attention registers values in the
1141ee824f4bSOmkar Kulkarni  *                       specified results struct.
1142ee824f4bSOmkar Kulkarni  *
1143ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1144ee824f4bSOmkar Kulkarni  * @results: Pointer to the attention read results
1145ee824f4bSOmkar Kulkarni  *
1146ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
1147ee824f4bSOmkar Kulkarni  *        - The version wasn't set
1148ee824f4bSOmkar Kulkarni  *          Otherwise, returns ok.
1149ee824f4bSOmkar Kulkarni  */
1150ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_print_attn(struct qed_hwfn *p_hwfn,
1151ee824f4bSOmkar Kulkarni 				   struct dbg_attn_block_result *results);
1152ee824f4bSOmkar Kulkarni 
1153ee824f4bSOmkar Kulkarni /******************************* Data Types **********************************/
1154ee824f4bSOmkar Kulkarni 
1155ee824f4bSOmkar Kulkarni struct mcp_trace_format {
1156ee824f4bSOmkar Kulkarni 	u32 data;
1157ee824f4bSOmkar Kulkarni #define MCP_TRACE_FORMAT_MODULE_MASK	0x0000ffff
1158ee824f4bSOmkar Kulkarni #define MCP_TRACE_FORMAT_MODULE_OFFSET	0
1159ee824f4bSOmkar Kulkarni #define MCP_TRACE_FORMAT_LEVEL_MASK	0x00030000
1160ee824f4bSOmkar Kulkarni #define MCP_TRACE_FORMAT_LEVEL_OFFSET	16
1161ee824f4bSOmkar Kulkarni #define MCP_TRACE_FORMAT_P1_SIZE_MASK	0x000c0000
1162ee824f4bSOmkar Kulkarni #define MCP_TRACE_FORMAT_P1_SIZE_OFFSET 18
1163ee824f4bSOmkar Kulkarni #define MCP_TRACE_FORMAT_P2_SIZE_MASK	0x00300000
1164ee824f4bSOmkar Kulkarni #define MCP_TRACE_FORMAT_P2_SIZE_OFFSET 20
1165ee824f4bSOmkar Kulkarni #define MCP_TRACE_FORMAT_P3_SIZE_MASK	0x00c00000
1166ee824f4bSOmkar Kulkarni #define MCP_TRACE_FORMAT_P3_SIZE_OFFSET 22
1167ee824f4bSOmkar Kulkarni #define MCP_TRACE_FORMAT_LEN_MASK	0xff000000
1168ee824f4bSOmkar Kulkarni #define MCP_TRACE_FORMAT_LEN_OFFSET	24
1169ee824f4bSOmkar Kulkarni 
1170ee824f4bSOmkar Kulkarni 	char *format_str;
1171ee824f4bSOmkar Kulkarni };
1172ee824f4bSOmkar Kulkarni 
1173ee824f4bSOmkar Kulkarni /* MCP Trace Meta data structure */
1174ee824f4bSOmkar Kulkarni struct mcp_trace_meta {
1175ee824f4bSOmkar Kulkarni 	u32 modules_num;
1176ee824f4bSOmkar Kulkarni 	char **modules;
1177ee824f4bSOmkar Kulkarni 	u32 formats_num;
1178ee824f4bSOmkar Kulkarni 	struct mcp_trace_format *formats;
1179ee824f4bSOmkar Kulkarni 	bool is_allocated;
1180ee824f4bSOmkar Kulkarni };
1181ee824f4bSOmkar Kulkarni 
1182ee824f4bSOmkar Kulkarni /* Debug Tools user data */
1183ee824f4bSOmkar Kulkarni struct dbg_tools_user_data {
1184ee824f4bSOmkar Kulkarni 	struct mcp_trace_meta mcp_trace_meta;
1185ee824f4bSOmkar Kulkarni 	const u32 *mcp_trace_user_meta_buf;
1186ee824f4bSOmkar Kulkarni };
1187ee824f4bSOmkar Kulkarni 
1188ee824f4bSOmkar Kulkarni /******************************** Constants **********************************/
1189ee824f4bSOmkar Kulkarni 
1190ee824f4bSOmkar Kulkarni #define MAX_NAME_LEN	16
1191ee824f4bSOmkar Kulkarni 
1192ee824f4bSOmkar Kulkarni /***************************** Public Functions *******************************/
1193ee824f4bSOmkar Kulkarni 
1194ee824f4bSOmkar Kulkarni /**
1195ee824f4bSOmkar Kulkarni  * qed_dbg_user_set_bin_ptr(): Sets a pointer to the binary data with
1196ee824f4bSOmkar Kulkarni  *                             debug arrays.
1197ee824f4bSOmkar Kulkarni  *
1198ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1199ee824f4bSOmkar Kulkarni  * @bin_ptr: a pointer to the binary data with debug arrays.
1200ee824f4bSOmkar Kulkarni  *
1201ee824f4bSOmkar Kulkarni  * Return: dbg_status.
1202ee824f4bSOmkar Kulkarni  */
1203ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_user_set_bin_ptr(struct qed_hwfn *p_hwfn,
1204ee824f4bSOmkar Kulkarni 					 const u8 * const bin_ptr);
1205ee824f4bSOmkar Kulkarni 
1206ee824f4bSOmkar Kulkarni /**
1207ee824f4bSOmkar Kulkarni  * qed_dbg_alloc_user_data(): Allocates user debug data.
1208ee824f4bSOmkar Kulkarni  *
1209ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1210ee824f4bSOmkar Kulkarni  * @user_data_ptr: (OUT) a pointer to the allocated memory.
1211ee824f4bSOmkar Kulkarni  *
1212ee824f4bSOmkar Kulkarni  * Return: dbg_status.
1213ee824f4bSOmkar Kulkarni  */
1214ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_alloc_user_data(struct qed_hwfn *p_hwfn,
1215ee824f4bSOmkar Kulkarni 					void **user_data_ptr);
1216ee824f4bSOmkar Kulkarni 
1217ee824f4bSOmkar Kulkarni /**
1218ee824f4bSOmkar Kulkarni  * qed_dbg_get_status_str(): Returns a string for the specified status.
1219ee824f4bSOmkar Kulkarni  *
1220ee824f4bSOmkar Kulkarni  * @status: A debug status code.
1221ee824f4bSOmkar Kulkarni  *
1222ee824f4bSOmkar Kulkarni  * Return: A string for the specified status.
1223ee824f4bSOmkar Kulkarni  */
1224ee824f4bSOmkar Kulkarni const char *qed_dbg_get_status_str(enum dbg_status status);
1225ee824f4bSOmkar Kulkarni 
1226ee824f4bSOmkar Kulkarni /**
1227ee824f4bSOmkar Kulkarni  * qed_get_idle_chk_results_buf_size(): Returns the required buffer size
1228ee824f4bSOmkar Kulkarni  *                                      for idle check results (in bytes).
1229ee824f4bSOmkar Kulkarni  *
1230ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1231ee824f4bSOmkar Kulkarni  * @dump_buf: idle check dump buffer.
1232ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: number of dwords that were dumped.
1233ee824f4bSOmkar Kulkarni  * @results_buf_size: (OUT) required buffer size (in bytes) for the parsed
1234ee824f4bSOmkar Kulkarni  *                    results.
1235ee824f4bSOmkar Kulkarni  *
1236ee824f4bSOmkar Kulkarni  * Return: Error if the parsing fails, ok otherwise.
1237ee824f4bSOmkar Kulkarni  */
1238ee824f4bSOmkar Kulkarni enum dbg_status qed_get_idle_chk_results_buf_size(struct qed_hwfn *p_hwfn,
1239ee824f4bSOmkar Kulkarni 						  u32 *dump_buf,
1240ee824f4bSOmkar Kulkarni 						  u32  num_dumped_dwords,
1241ee824f4bSOmkar Kulkarni 						  u32 *results_buf_size);
1242ee824f4bSOmkar Kulkarni /**
1243ee824f4bSOmkar Kulkarni  * qed_print_idle_chk_results(): Prints idle check results
1244ee824f4bSOmkar Kulkarni  *
1245ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1246ee824f4bSOmkar Kulkarni  * @dump_buf: idle check dump buffer.
1247ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: number of dwords that were dumped.
1248ee824f4bSOmkar Kulkarni  * @results_buf: buffer for printing the idle check results.
1249ee824f4bSOmkar Kulkarni  * @num_errors: (OUT) number of errors found in idle check.
1250ee824f4bSOmkar Kulkarni  * @num_warnings: (OUT) number of warnings found in idle check.
1251ee824f4bSOmkar Kulkarni  *
1252ee824f4bSOmkar Kulkarni  * Return: Error if the parsing fails, ok otherwise.
1253ee824f4bSOmkar Kulkarni  */
1254ee824f4bSOmkar Kulkarni enum dbg_status qed_print_idle_chk_results(struct qed_hwfn *p_hwfn,
1255ee824f4bSOmkar Kulkarni 					   u32 *dump_buf,
1256ee824f4bSOmkar Kulkarni 					   u32 num_dumped_dwords,
1257ee824f4bSOmkar Kulkarni 					   char *results_buf,
1258ee824f4bSOmkar Kulkarni 					   u32 *num_errors,
1259ee824f4bSOmkar Kulkarni 					   u32 *num_warnings);
1260ee824f4bSOmkar Kulkarni 
1261ee824f4bSOmkar Kulkarni /**
1262ee824f4bSOmkar Kulkarni  * qed_dbg_mcp_trace_set_meta_data(): Sets the MCP Trace meta data.
1263ee824f4bSOmkar Kulkarni  *
1264ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1265ee824f4bSOmkar Kulkarni  * @meta_buf: Meta buffer.
1266ee824f4bSOmkar Kulkarni  *
1267ee824f4bSOmkar Kulkarni  * Return: Void.
1268ee824f4bSOmkar Kulkarni  *
1269ee824f4bSOmkar Kulkarni  * Needed in case the MCP Trace dump doesn't contain the meta data (e.g. due to
1270ee824f4bSOmkar Kulkarni  * no NVRAM access).
1271ee824f4bSOmkar Kulkarni  */
1272ee824f4bSOmkar Kulkarni void qed_dbg_mcp_trace_set_meta_data(struct qed_hwfn *p_hwfn,
1273ee824f4bSOmkar Kulkarni 				     const u32 *meta_buf);
1274ee824f4bSOmkar Kulkarni 
1275ee824f4bSOmkar Kulkarni /**
1276ee824f4bSOmkar Kulkarni  * qed_get_mcp_trace_results_buf_size(): Returns the required buffer size
1277ee824f4bSOmkar Kulkarni  *                                       for MCP Trace results (in bytes).
1278ee824f4bSOmkar Kulkarni  *
1279ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1280ee824f4bSOmkar Kulkarni  * @dump_buf: MCP Trace dump buffer.
1281ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: number of dwords that were dumped.
1282ee824f4bSOmkar Kulkarni  * @results_buf_size: (OUT) required buffer size (in bytes) for the parsed
1283ee824f4bSOmkar Kulkarni  *                    results.
1284ee824f4bSOmkar Kulkarni  *
1285*60f243adSJulia Lawall  * Return: Error if the parsing fails, ok otherwise.
1286ee824f4bSOmkar Kulkarni  */
1287ee824f4bSOmkar Kulkarni enum dbg_status qed_get_mcp_trace_results_buf_size(struct qed_hwfn *p_hwfn,
1288ee824f4bSOmkar Kulkarni 						   u32 *dump_buf,
1289ee824f4bSOmkar Kulkarni 						   u32 num_dumped_dwords,
1290ee824f4bSOmkar Kulkarni 						   u32 *results_buf_size);
1291ee824f4bSOmkar Kulkarni 
1292ee824f4bSOmkar Kulkarni /**
1293ee824f4bSOmkar Kulkarni  * qed_print_mcp_trace_results(): Prints MCP Trace results
1294ee824f4bSOmkar Kulkarni  *
1295ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1296ee824f4bSOmkar Kulkarni  * @dump_buf: MCP trace dump buffer, starting from the header.
1297ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: Member of dwords that were dumped.
1298ee824f4bSOmkar Kulkarni  * @results_buf: Buffer for printing the mcp trace results.
1299ee824f4bSOmkar Kulkarni  *
1300ee824f4bSOmkar Kulkarni  * Return: Error if the parsing fails, ok otherwise.
1301ee824f4bSOmkar Kulkarni  */
1302ee824f4bSOmkar Kulkarni enum dbg_status qed_print_mcp_trace_results(struct qed_hwfn *p_hwfn,
1303ee824f4bSOmkar Kulkarni 					    u32 *dump_buf,
1304ee824f4bSOmkar Kulkarni 					    u32 num_dumped_dwords,
1305ee824f4bSOmkar Kulkarni 					    char *results_buf);
1306ee824f4bSOmkar Kulkarni 
1307ee824f4bSOmkar Kulkarni /**
1308ee824f4bSOmkar Kulkarni  * qed_print_mcp_trace_results_cont(): Prints MCP Trace results, and
1309ee824f4bSOmkar Kulkarni  * keeps the MCP trace meta data allocated, to support continuous MCP Trace
1310ee824f4bSOmkar Kulkarni  * parsing. After the continuous parsing ends, mcp_trace_free_meta_data should
1311ee824f4bSOmkar Kulkarni  * be called to free the meta data.
1312ee824f4bSOmkar Kulkarni  *
1313ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1314ee824f4bSOmkar Kulkarni  * @dump_buf: MVP trace dump buffer, starting from the header.
1315ee824f4bSOmkar Kulkarni  * @results_buf: Buffer for printing the mcp trace results.
1316ee824f4bSOmkar Kulkarni  *
1317ee824f4bSOmkar Kulkarni  * Return: Error if the parsing fails, ok otherwise.
1318ee824f4bSOmkar Kulkarni  */
1319ee824f4bSOmkar Kulkarni enum dbg_status qed_print_mcp_trace_results_cont(struct qed_hwfn *p_hwfn,
1320ee824f4bSOmkar Kulkarni 						 u32 *dump_buf,
1321ee824f4bSOmkar Kulkarni 						 char *results_buf);
1322ee824f4bSOmkar Kulkarni 
1323ee824f4bSOmkar Kulkarni /**
1324ee824f4bSOmkar Kulkarni  * qed_print_mcp_trace_line(): Prints MCP Trace results for a single line
1325ee824f4bSOmkar Kulkarni  *
1326ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1327ee824f4bSOmkar Kulkarni  * @dump_buf: MCP trace dump buffer, starting from the header.
1328ee824f4bSOmkar Kulkarni  * @num_dumped_bytes: Number of bytes that were dumped.
1329ee824f4bSOmkar Kulkarni  * @results_buf: Buffer for printing the mcp trace results.
1330ee824f4bSOmkar Kulkarni  *
1331ee824f4bSOmkar Kulkarni  * Return: Error if the parsing fails, ok otherwise.
1332ee824f4bSOmkar Kulkarni  */
1333ee824f4bSOmkar Kulkarni enum dbg_status qed_print_mcp_trace_line(struct qed_hwfn *p_hwfn,
1334ee824f4bSOmkar Kulkarni 					 u8 *dump_buf,
1335ee824f4bSOmkar Kulkarni 					 u32 num_dumped_bytes,
1336ee824f4bSOmkar Kulkarni 					 char *results_buf);
1337ee824f4bSOmkar Kulkarni 
1338ee824f4bSOmkar Kulkarni /**
1339ee824f4bSOmkar Kulkarni  * qed_mcp_trace_free_meta_data(): Frees the MCP Trace meta data.
1340ee824f4bSOmkar Kulkarni  * Should be called after continuous MCP Trace parsing.
1341ee824f4bSOmkar Kulkarni  *
1342ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1343ee824f4bSOmkar Kulkarni  *
1344ee824f4bSOmkar Kulkarni  * Return: Void.
1345ee824f4bSOmkar Kulkarni  */
1346ee824f4bSOmkar Kulkarni void qed_mcp_trace_free_meta_data(struct qed_hwfn *p_hwfn);
1347ee824f4bSOmkar Kulkarni 
1348ee824f4bSOmkar Kulkarni /**
1349ee824f4bSOmkar Kulkarni  * qed_get_reg_fifo_results_buf_size(): Returns the required buffer size
1350ee824f4bSOmkar Kulkarni  *                                      for reg_fifo results (in bytes).
1351ee824f4bSOmkar Kulkarni  *
1352ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1353ee824f4bSOmkar Kulkarni  * @dump_buf: Reg fifo dump buffer.
1354ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: Number of dwords that were dumped.
1355ee824f4bSOmkar Kulkarni  * @results_buf_size: (OUT) required buffer size (in bytes) for the parsed
1356ee824f4bSOmkar Kulkarni  *                     results.
1357ee824f4bSOmkar Kulkarni  *
1358ee824f4bSOmkar Kulkarni  * Return: Error if the parsing fails, ok otherwise.
1359ee824f4bSOmkar Kulkarni  */
1360ee824f4bSOmkar Kulkarni enum dbg_status qed_get_reg_fifo_results_buf_size(struct qed_hwfn *p_hwfn,
1361ee824f4bSOmkar Kulkarni 						  u32 *dump_buf,
1362ee824f4bSOmkar Kulkarni 						  u32 num_dumped_dwords,
1363ee824f4bSOmkar Kulkarni 						  u32 *results_buf_size);
1364ee824f4bSOmkar Kulkarni 
1365ee824f4bSOmkar Kulkarni /**
1366ee824f4bSOmkar Kulkarni  * qed_print_reg_fifo_results(): Prints reg fifo results.
1367ee824f4bSOmkar Kulkarni  *
1368ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1369ee824f4bSOmkar Kulkarni  * @dump_buf: Reg fifo dump buffer, starting from the header.
1370ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: Number of dwords that were dumped.
1371ee824f4bSOmkar Kulkarni  * @results_buf: Buffer for printing the reg fifo results.
1372ee824f4bSOmkar Kulkarni  *
1373ee824f4bSOmkar Kulkarni  * Return: Error if the parsing fails, ok otherwise.
1374ee824f4bSOmkar Kulkarni  */
1375ee824f4bSOmkar Kulkarni enum dbg_status qed_print_reg_fifo_results(struct qed_hwfn *p_hwfn,
1376ee824f4bSOmkar Kulkarni 					   u32 *dump_buf,
1377ee824f4bSOmkar Kulkarni 					   u32 num_dumped_dwords,
1378ee824f4bSOmkar Kulkarni 					   char *results_buf);
1379ee824f4bSOmkar Kulkarni 
1380ee824f4bSOmkar Kulkarni /**
1381ee824f4bSOmkar Kulkarni  * qed_get_igu_fifo_results_buf_size(): Returns the required buffer size
1382ee824f4bSOmkar Kulkarni  *                                      for igu_fifo results (in bytes).
1383ee824f4bSOmkar Kulkarni  *
1384ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1385ee824f4bSOmkar Kulkarni  * @dump_buf: IGU fifo dump buffer.
1386ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: number of dwords that were dumped.
1387ee824f4bSOmkar Kulkarni  * @results_buf_size: (OUT) required buffer size (in bytes) for the parsed
1388ee824f4bSOmkar Kulkarni  *                    results.
1389ee824f4bSOmkar Kulkarni  *
1390ee824f4bSOmkar Kulkarni  * Return: Error if the parsing fails, ok otherwise.
1391ee824f4bSOmkar Kulkarni  */
1392ee824f4bSOmkar Kulkarni enum dbg_status qed_get_igu_fifo_results_buf_size(struct qed_hwfn *p_hwfn,
1393ee824f4bSOmkar Kulkarni 						  u32 *dump_buf,
1394ee824f4bSOmkar Kulkarni 						  u32 num_dumped_dwords,
1395ee824f4bSOmkar Kulkarni 						  u32 *results_buf_size);
1396ee824f4bSOmkar Kulkarni 
1397ee824f4bSOmkar Kulkarni /**
1398ee824f4bSOmkar Kulkarni  * qed_print_igu_fifo_results(): Prints IGU fifo results
1399ee824f4bSOmkar Kulkarni  *
1400ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1401ee824f4bSOmkar Kulkarni  * @dump_buf: IGU fifo dump buffer, starting from the header.
1402ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: Number of dwords that were dumped.
1403ee824f4bSOmkar Kulkarni  * @results_buf: Buffer for printing the IGU fifo results.
1404ee824f4bSOmkar Kulkarni  *
1405ee824f4bSOmkar Kulkarni  * Return: Error if the parsing fails, ok otherwise.
1406ee824f4bSOmkar Kulkarni  */
1407ee824f4bSOmkar Kulkarni enum dbg_status qed_print_igu_fifo_results(struct qed_hwfn *p_hwfn,
1408ee824f4bSOmkar Kulkarni 					   u32 *dump_buf,
1409ee824f4bSOmkar Kulkarni 					   u32 num_dumped_dwords,
1410ee824f4bSOmkar Kulkarni 					   char *results_buf);
1411ee824f4bSOmkar Kulkarni 
1412ee824f4bSOmkar Kulkarni /**
1413ee824f4bSOmkar Kulkarni  * qed_get_protection_override_results_buf_size(): Returns the required
1414ee824f4bSOmkar Kulkarni  *         buffer size for protection override results (in bytes).
1415ee824f4bSOmkar Kulkarni  *
1416ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1417ee824f4bSOmkar Kulkarni  * @dump_buf: Protection override dump buffer.
1418ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: Number of dwords that were dumped.
1419ee824f4bSOmkar Kulkarni  * @results_buf_size: (OUT) required buffer size (in bytes) for the parsed
1420ee824f4bSOmkar Kulkarni  *                    results.
1421ee824f4bSOmkar Kulkarni  *
1422ee824f4bSOmkar Kulkarni  * Return: Error if the parsing fails, ok otherwise.
1423ee824f4bSOmkar Kulkarni  */
1424ee824f4bSOmkar Kulkarni enum dbg_status
1425ee824f4bSOmkar Kulkarni qed_get_protection_override_results_buf_size(struct qed_hwfn *p_hwfn,
1426ee824f4bSOmkar Kulkarni 					     u32 *dump_buf,
1427ee824f4bSOmkar Kulkarni 					     u32 num_dumped_dwords,
1428ee824f4bSOmkar Kulkarni 					     u32 *results_buf_size);
1429ee824f4bSOmkar Kulkarni 
1430ee824f4bSOmkar Kulkarni /**
1431ee824f4bSOmkar Kulkarni  * qed_print_protection_override_results(): Prints protection override
1432ee824f4bSOmkar Kulkarni  *                                          results.
1433ee824f4bSOmkar Kulkarni  *
1434ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1435ee824f4bSOmkar Kulkarni  * @dump_buf: Protection override dump buffer, starting from the header.
1436ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: Number of dwords that were dumped.
1437ee824f4bSOmkar Kulkarni  * @results_buf: Buffer for printing the reg fifo results.
1438ee824f4bSOmkar Kulkarni  *
1439ee824f4bSOmkar Kulkarni  * Return: Error if the parsing fails, ok otherwise.
1440ee824f4bSOmkar Kulkarni  */
1441ee824f4bSOmkar Kulkarni enum dbg_status qed_print_protection_override_results(struct qed_hwfn *p_hwfn,
1442ee824f4bSOmkar Kulkarni 						      u32 *dump_buf,
1443ee824f4bSOmkar Kulkarni 						      u32 num_dumped_dwords,
1444ee824f4bSOmkar Kulkarni 						      char *results_buf);
1445ee824f4bSOmkar Kulkarni 
1446ee824f4bSOmkar Kulkarni /**
1447ee824f4bSOmkar Kulkarni  * qed_get_fw_asserts_results_buf_size(): Returns the required buffer size
1448ee824f4bSOmkar Kulkarni  *                                        for FW Asserts results (in bytes).
1449ee824f4bSOmkar Kulkarni  *
1450ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1451ee824f4bSOmkar Kulkarni  * @dump_buf: FW Asserts dump buffer.
1452ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: number of dwords that were dumped.
1453ee824f4bSOmkar Kulkarni  * @results_buf_size: (OUT) required buffer size (in bytes) for the parsed
1454ee824f4bSOmkar Kulkarni  *                    results.
1455ee824f4bSOmkar Kulkarni  *
1456ee824f4bSOmkar Kulkarni  * Return: Error if the parsing fails, ok otherwise.
1457ee824f4bSOmkar Kulkarni  */
1458ee824f4bSOmkar Kulkarni enum dbg_status qed_get_fw_asserts_results_buf_size(struct qed_hwfn *p_hwfn,
1459ee824f4bSOmkar Kulkarni 						    u32 *dump_buf,
1460ee824f4bSOmkar Kulkarni 						    u32 num_dumped_dwords,
1461ee824f4bSOmkar Kulkarni 						    u32 *results_buf_size);
1462ee824f4bSOmkar Kulkarni 
1463ee824f4bSOmkar Kulkarni /**
1464ee824f4bSOmkar Kulkarni  * qed_print_fw_asserts_results(): Prints FW Asserts results.
1465ee824f4bSOmkar Kulkarni  *
1466ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1467ee824f4bSOmkar Kulkarni  * @dump_buf: FW Asserts dump buffer, starting from the header.
1468ee824f4bSOmkar Kulkarni  * @num_dumped_dwords: number of dwords that were dumped.
1469ee824f4bSOmkar Kulkarni  * @results_buf: buffer for printing the FW Asserts results.
1470ee824f4bSOmkar Kulkarni  *
1471ee824f4bSOmkar Kulkarni  * Return: Error if the parsing fails, ok otherwise.
1472ee824f4bSOmkar Kulkarni  */
1473ee824f4bSOmkar Kulkarni enum dbg_status qed_print_fw_asserts_results(struct qed_hwfn *p_hwfn,
1474ee824f4bSOmkar Kulkarni 					     u32 *dump_buf,
1475ee824f4bSOmkar Kulkarni 					     u32 num_dumped_dwords,
1476ee824f4bSOmkar Kulkarni 					     char *results_buf);
1477ee824f4bSOmkar Kulkarni 
1478ee824f4bSOmkar Kulkarni /**
1479ee824f4bSOmkar Kulkarni  * qed_dbg_parse_attn(): Parses and prints attention registers values in
1480ee824f4bSOmkar Kulkarni  *                      the specified results struct.
1481ee824f4bSOmkar Kulkarni  *
1482ee824f4bSOmkar Kulkarni  * @p_hwfn: HW device data.
1483ee824f4bSOmkar Kulkarni  * @results: Pointer to the attention read results
1484ee824f4bSOmkar Kulkarni  *
1485ee824f4bSOmkar Kulkarni  * Return: Error if one of the following holds:
1486ee824f4bSOmkar Kulkarni  *         - The version wasn't set.
1487ee824f4bSOmkar Kulkarni  *           Otherwise, returns ok.
1488ee824f4bSOmkar Kulkarni  */
1489ee824f4bSOmkar Kulkarni enum dbg_status qed_dbg_parse_attn(struct qed_hwfn *p_hwfn,
1490ee824f4bSOmkar Kulkarni 				   struct dbg_attn_block_result *results);
1491ee824f4bSOmkar Kulkarni #endif
1492