ac/debug: annotate IB dumps with the raw values
[mesa.git] / src / amd / common / ac_debug.c
1 /*
2 * Copyright 2015 Advanced Micro Devices, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
22 *
23 * Authors:
24 * Marek Olšák <maraeo@gmail.com>
25 */
26
27 #include "ac_debug.h"
28
29 #include "sid.h"
30 #include "gfx9d.h"
31 #include "sid_tables.h"
32 #include "util/u_math.h"
33 #include "util/u_memory.h"
34
35 /* Parsed IBs are difficult to read without colors. Use "less -R file" to
36 * read them, or use "aha -b -f file" to convert them to html.
37 */
38 #define COLOR_RESET "\033[0m"
39 #define COLOR_RED "\033[31m"
40 #define COLOR_GREEN "\033[1;32m"
41 #define COLOR_YELLOW "\033[1;33m"
42 #define COLOR_CYAN "\033[1;36m"
43
44 #define INDENT_PKT 8
45
46 struct ac_ib_parser {
47 FILE *f;
48 uint32_t *ib;
49 unsigned num_dw;
50 int trace_id;
51 enum chip_class chip_class;
52 ac_debug_addr_callback addr_callback;
53 void *addr_callback_data;
54
55 unsigned cur_dw;
56 };
57
58 static void ac_do_parse_ib(FILE *f, struct ac_ib_parser *ib);
59
60 static void print_spaces(FILE *f, unsigned num)
61 {
62 fprintf(f, "%*s", num, "");
63 }
64
65 static void print_value(FILE *file, uint32_t value, int bits)
66 {
67 /* Guess if it's int or float */
68 if (value <= (1 << 15)) {
69 if (value <= 9)
70 fprintf(file, "%u\n", value);
71 else
72 fprintf(file, "%u (0x%0*x)\n", value, bits / 4, value);
73 } else {
74 float f = uif(value);
75
76 if (fabs(f) < 100000 && f*10 == floor(f*10))
77 fprintf(file, "%.1ff (0x%0*x)\n", f, bits / 4, value);
78 else
79 /* Don't print more leading zeros than there are bits. */
80 fprintf(file, "0x%0*x\n", bits / 4, value);
81 }
82 }
83
84 static void print_named_value(FILE *file, const char *name, uint32_t value,
85 int bits)
86 {
87 print_spaces(file, INDENT_PKT);
88 fprintf(file, COLOR_YELLOW "%s" COLOR_RESET " <- ", name);
89 print_value(file, value, bits);
90 }
91
92 void ac_dump_reg(FILE *file, unsigned offset, uint32_t value,
93 uint32_t field_mask)
94 {
95 int r, f;
96
97 for (r = 0; r < ARRAY_SIZE(sid_reg_table); r++) {
98 const struct si_reg *reg = &sid_reg_table[r];
99 const char *reg_name = sid_strings + reg->name_offset;
100
101 if (reg->offset == offset) {
102 bool first_field = true;
103
104 print_spaces(file, INDENT_PKT);
105 fprintf(file, COLOR_YELLOW "%s" COLOR_RESET " <- ",
106 reg_name);
107
108 if (!reg->num_fields) {
109 print_value(file, value, 32);
110 return;
111 }
112
113 for (f = 0; f < reg->num_fields; f++) {
114 const struct si_field *field = sid_fields_table + reg->fields_offset + f;
115 const int *values_offsets = sid_strings_offsets + field->values_offset;
116 uint32_t val = (value & field->mask) >>
117 (ffs(field->mask) - 1);
118
119 if (!(field->mask & field_mask))
120 continue;
121
122 /* Indent the field. */
123 if (!first_field)
124 print_spaces(file,
125 INDENT_PKT + strlen(reg_name) + 4);
126
127 /* Print the field. */
128 fprintf(file, "%s = ", sid_strings + field->name_offset);
129
130 if (val < field->num_values && values_offsets[val] >= 0)
131 fprintf(file, "%s\n", sid_strings + values_offsets[val]);
132 else
133 print_value(file, val,
134 util_bitcount(field->mask));
135
136 first_field = false;
137 }
138 return;
139 }
140 }
141
142 print_spaces(file, INDENT_PKT);
143 fprintf(file, COLOR_YELLOW "0x%05x" COLOR_RESET " <- 0x%08x\n", offset, value);
144 }
145
146 static uint32_t ac_ib_get(struct ac_ib_parser *ib)
147 {
148 uint32_t v = 0;
149
150 if (ib->cur_dw < ib->num_dw) {
151 v = ib->ib[ib->cur_dw];
152 fprintf(ib->f, "\n\035#%08x ", v);
153 } else {
154 fprintf(ib->f, "\n\035#???????? ");
155 }
156
157 ib->cur_dw++;
158 return v;
159 }
160
161 static void ac_parse_set_reg_packet(FILE *f, unsigned count, unsigned reg_offset,
162 struct ac_ib_parser *ib)
163 {
164 unsigned reg_dw = ac_ib_get(ib);
165 unsigned reg = ((reg_dw & 0xFFFF) << 2) + reg_offset;
166 unsigned index = reg_dw >> 28;
167 int i;
168
169 if (index != 0) {
170 print_spaces(f, INDENT_PKT);
171 fprintf(f, "INDEX = %u\n", index);
172 }
173
174 for (i = 0; i < count; i++)
175 ac_dump_reg(f, reg + i*4, ac_ib_get(ib), ~0);
176 }
177
178 static void ac_parse_packet3(FILE *f, uint32_t header, struct ac_ib_parser *ib)
179 {
180 unsigned first_dw = ib->cur_dw;
181 int count = PKT_COUNT_G(header);
182 unsigned op = PKT3_IT_OPCODE_G(header);
183 const char *predicate = PKT3_PREDICATE(header) ? "(predicate)" : "";
184 int i;
185
186 /* Print the name first. */
187 for (i = 0; i < ARRAY_SIZE(packet3_table); i++)
188 if (packet3_table[i].op == op)
189 break;
190
191 if (i < ARRAY_SIZE(packet3_table)) {
192 const char *name = sid_strings + packet3_table[i].name_offset;
193
194 if (op == PKT3_SET_CONTEXT_REG ||
195 op == PKT3_SET_CONFIG_REG ||
196 op == PKT3_SET_UCONFIG_REG ||
197 op == PKT3_SET_SH_REG)
198 fprintf(f, COLOR_CYAN "%s%s" COLOR_CYAN ":\n",
199 name, predicate);
200 else
201 fprintf(f, COLOR_GREEN "%s%s" COLOR_RESET ":\n",
202 name, predicate);
203 } else
204 fprintf(f, COLOR_RED "PKT3_UNKNOWN 0x%x%s" COLOR_RESET ":\n",
205 op, predicate);
206
207 /* Print the contents. */
208 switch (op) {
209 case PKT3_SET_CONTEXT_REG:
210 ac_parse_set_reg_packet(f, count, SI_CONTEXT_REG_OFFSET, ib);
211 break;
212 case PKT3_SET_CONFIG_REG:
213 ac_parse_set_reg_packet(f, count, SI_CONFIG_REG_OFFSET, ib);
214 break;
215 case PKT3_SET_UCONFIG_REG:
216 ac_parse_set_reg_packet(f, count, CIK_UCONFIG_REG_OFFSET, ib);
217 break;
218 case PKT3_SET_SH_REG:
219 ac_parse_set_reg_packet(f, count, SI_SH_REG_OFFSET, ib);
220 break;
221 case PKT3_ACQUIRE_MEM:
222 ac_dump_reg(f, R_0301F0_CP_COHER_CNTL, ac_ib_get(ib), ~0);
223 ac_dump_reg(f, R_0301F4_CP_COHER_SIZE, ac_ib_get(ib), ~0);
224 ac_dump_reg(f, R_030230_CP_COHER_SIZE_HI, ac_ib_get(ib), ~0);
225 ac_dump_reg(f, R_0301F8_CP_COHER_BASE, ac_ib_get(ib), ~0);
226 ac_dump_reg(f, R_0301E4_CP_COHER_BASE_HI, ac_ib_get(ib), ~0);
227 print_named_value(f, "POLL_INTERVAL", ac_ib_get(ib), 16);
228 break;
229 case PKT3_SURFACE_SYNC:
230 if (ib->chip_class >= CIK) {
231 ac_dump_reg(f, R_0301F0_CP_COHER_CNTL, ac_ib_get(ib), ~0);
232 ac_dump_reg(f, R_0301F4_CP_COHER_SIZE, ac_ib_get(ib), ~0);
233 ac_dump_reg(f, R_0301F8_CP_COHER_BASE, ac_ib_get(ib), ~0);
234 } else {
235 ac_dump_reg(f, R_0085F0_CP_COHER_CNTL, ac_ib_get(ib), ~0);
236 ac_dump_reg(f, R_0085F4_CP_COHER_SIZE, ac_ib_get(ib), ~0);
237 ac_dump_reg(f, R_0085F8_CP_COHER_BASE, ac_ib_get(ib), ~0);
238 }
239 print_named_value(f, "POLL_INTERVAL", ac_ib_get(ib), 16);
240 break;
241 case PKT3_EVENT_WRITE: {
242 uint32_t event_dw = ac_ib_get(ib);
243 ac_dump_reg(f, R_028A90_VGT_EVENT_INITIATOR, event_dw,
244 S_028A90_EVENT_TYPE(~0));
245 print_named_value(f, "EVENT_INDEX", (event_dw >> 8) & 0xf, 4);
246 print_named_value(f, "INV_L2", (event_dw >> 20) & 0x1, 1);
247 if (count > 0) {
248 print_named_value(f, "ADDRESS_LO", ac_ib_get(ib), 32);
249 print_named_value(f, "ADDRESS_HI", ac_ib_get(ib), 16);
250 }
251 break;
252 }
253 case PKT3_EVENT_WRITE_EOP: {
254 uint32_t event_dw = ac_ib_get(ib);
255 ac_dump_reg(f, R_028A90_VGT_EVENT_INITIATOR, event_dw,
256 S_028A90_EVENT_TYPE(~0));
257 print_named_value(f, "EVENT_INDEX", (event_dw >> 8) & 0xf, 4);
258 print_named_value(f, "TCL1_VOL_ACTION_ENA", (event_dw >> 12) & 0x1, 1);
259 print_named_value(f, "TC_VOL_ACTION_ENA", (event_dw >> 13) & 0x1, 1);
260 print_named_value(f, "TC_WB_ACTION_ENA", (event_dw >> 15) & 0x1, 1);
261 print_named_value(f, "TCL1_ACTION_ENA", (event_dw >> 16) & 0x1, 1);
262 print_named_value(f, "TC_ACTION_ENA", (event_dw >> 17) & 0x1, 1);
263 print_named_value(f, "ADDRESS_LO", ac_ib_get(ib), 32);
264 uint32_t addr_hi_dw = ac_ib_get(ib);
265 print_named_value(f, "ADDRESS_HI", addr_hi_dw, 16);
266 print_named_value(f, "DST_SEL", (addr_hi_dw >> 16) & 0x3, 2);
267 print_named_value(f, "INT_SEL", (addr_hi_dw >> 24) & 0x7, 3);
268 print_named_value(f, "DATA_SEL", addr_hi_dw >> 29, 3);
269 print_named_value(f, "DATA_LO", ac_ib_get(ib), 32);
270 print_named_value(f, "DATA_HI", ac_ib_get(ib), 32);
271 break;
272 }
273 case PKT3_RELEASE_MEM: {
274 uint32_t event_dw = ac_ib_get(ib);
275 ac_dump_reg(f, R_028A90_VGT_EVENT_INITIATOR, event_dw,
276 S_028A90_EVENT_TYPE(~0));
277 print_named_value(f, "EVENT_INDEX", (event_dw >> 8) & 0xf, 4);
278 print_named_value(f, "TCL1_VOL_ACTION_ENA", (event_dw >> 12) & 0x1, 1);
279 print_named_value(f, "TC_VOL_ACTION_ENA", (event_dw >> 13) & 0x1, 1);
280 print_named_value(f, "TC_WB_ACTION_ENA", (event_dw >> 15) & 0x1, 1);
281 print_named_value(f, "TCL1_ACTION_ENA", (event_dw >> 16) & 0x1, 1);
282 print_named_value(f, "TC_ACTION_ENA", (event_dw >> 17) & 0x1, 1);
283 print_named_value(f, "TC_NC_ACTION_ENA", (event_dw >> 19) & 0x1, 1);
284 print_named_value(f, "TC_WC_ACTION_ENA", (event_dw >> 20) & 0x1, 1);
285 print_named_value(f, "TC_MD_ACTION_ENA", (event_dw >> 21) & 0x1, 1);
286 uint32_t sel_dw = ac_ib_get(ib);
287 print_named_value(f, "DST_SEL", (sel_dw >> 16) & 0x3, 2);
288 print_named_value(f, "INT_SEL", (sel_dw >> 24) & 0x7, 3);
289 print_named_value(f, "DATA_SEL", sel_dw >> 29, 3);
290 print_named_value(f, "ADDRESS_LO", ac_ib_get(ib), 32);
291 print_named_value(f, "ADDRESS_HI", ac_ib_get(ib), 32);
292 print_named_value(f, "DATA_LO", ac_ib_get(ib), 32);
293 print_named_value(f, "DATA_HI", ac_ib_get(ib), 32);
294 print_named_value(f, "CTXID", ac_ib_get(ib), 32);
295 break;
296 }
297 case PKT3_WAIT_REG_MEM:
298 print_named_value(f, "OP", ac_ib_get(ib), 32);
299 print_named_value(f, "ADDRESS_LO", ac_ib_get(ib), 32);
300 print_named_value(f, "ADDRESS_HI", ac_ib_get(ib), 32);
301 print_named_value(f, "REF", ac_ib_get(ib), 32);
302 print_named_value(f, "MASK", ac_ib_get(ib), 32);
303 print_named_value(f, "POLL_INTERVAL", ac_ib_get(ib), 16);
304 break;
305 case PKT3_DRAW_INDEX_AUTO:
306 ac_dump_reg(f, R_030930_VGT_NUM_INDICES, ac_ib_get(ib), ~0);
307 ac_dump_reg(f, R_0287F0_VGT_DRAW_INITIATOR, ac_ib_get(ib), ~0);
308 break;
309 case PKT3_DRAW_INDEX_2:
310 ac_dump_reg(f, R_028A78_VGT_DMA_MAX_SIZE, ac_ib_get(ib), ~0);
311 ac_dump_reg(f, R_0287E8_VGT_DMA_BASE, ac_ib_get(ib), ~0);
312 ac_dump_reg(f, R_0287E4_VGT_DMA_BASE_HI, ac_ib_get(ib), ~0);
313 ac_dump_reg(f, R_030930_VGT_NUM_INDICES, ac_ib_get(ib), ~0);
314 ac_dump_reg(f, R_0287F0_VGT_DRAW_INITIATOR, ac_ib_get(ib), ~0);
315 break;
316 case PKT3_INDEX_TYPE:
317 ac_dump_reg(f, R_028A7C_VGT_DMA_INDEX_TYPE, ac_ib_get(ib), ~0);
318 break;
319 case PKT3_NUM_INSTANCES:
320 ac_dump_reg(f, R_030934_VGT_NUM_INSTANCES, ac_ib_get(ib), ~0);
321 break;
322 case PKT3_WRITE_DATA:
323 ac_dump_reg(f, R_370_CONTROL, ac_ib_get(ib), ~0);
324 ac_dump_reg(f, R_371_DST_ADDR_LO, ac_ib_get(ib), ~0);
325 ac_dump_reg(f, R_372_DST_ADDR_HI, ac_ib_get(ib), ~0);
326 /* The payload is written automatically */
327 break;
328 case PKT3_CP_DMA:
329 ac_dump_reg(f, R_410_CP_DMA_WORD0, ac_ib_get(ib), ~0);
330 ac_dump_reg(f, R_411_CP_DMA_WORD1, ac_ib_get(ib), ~0);
331 ac_dump_reg(f, R_412_CP_DMA_WORD2, ac_ib_get(ib), ~0);
332 ac_dump_reg(f, R_413_CP_DMA_WORD3, ac_ib_get(ib), ~0);
333 ac_dump_reg(f, R_414_COMMAND, ac_ib_get(ib), ~0);
334 break;
335 case PKT3_DMA_DATA:
336 ac_dump_reg(f, R_500_DMA_DATA_WORD0, ac_ib_get(ib), ~0);
337 ac_dump_reg(f, R_501_SRC_ADDR_LO, ac_ib_get(ib), ~0);
338 ac_dump_reg(f, R_502_SRC_ADDR_HI, ac_ib_get(ib), ~0);
339 ac_dump_reg(f, R_503_DST_ADDR_LO, ac_ib_get(ib), ~0);
340 ac_dump_reg(f, R_504_DST_ADDR_HI, ac_ib_get(ib), ~0);
341 ac_dump_reg(f, R_414_COMMAND, ac_ib_get(ib), ~0);
342 break;
343 case PKT3_INDIRECT_BUFFER_SI:
344 case PKT3_INDIRECT_BUFFER_CONST:
345 case PKT3_INDIRECT_BUFFER_CIK: {
346 uint32_t base_lo_dw = ac_ib_get(ib);
347 ac_dump_reg(f, R_3F0_IB_BASE_LO, base_lo_dw, ~0);
348 uint32_t base_hi_dw = ac_ib_get(ib);
349 ac_dump_reg(f, R_3F1_IB_BASE_HI, base_hi_dw, ~0);
350 uint32_t control_dw = ac_ib_get(ib);
351 ac_dump_reg(f, R_3F2_CONTROL, control_dw, ~0);
352
353 if (!ib->addr_callback)
354 break;
355
356 uint64_t addr = ((uint64_t)base_hi_dw << 32) | base_lo_dw;
357 void *data = ib->addr_callback(ib->addr_callback_data, addr);
358 if (!data)
359 break;
360
361 if (G_3F2_CHAIN(control_dw)) {
362 ib->ib = data;
363 ib->num_dw = G_3F2_IB_SIZE(control_dw);
364 ib->cur_dw = 0;
365 return;
366 }
367
368 struct ac_ib_parser ib_recurse;
369 memcpy(&ib_recurse, ib, sizeof(ib_recurse));
370 ib_recurse.ib = data;
371 ib_recurse.num_dw = G_3F2_IB_SIZE(control_dw);
372 ib_recurse.cur_dw = 0;
373
374 fprintf(f, "\n\035>------------------ nested begin ------------------\n");
375 ac_do_parse_ib(f, &ib_recurse);
376 fprintf(f, "\n\035<------------------- nested end -------------------\n");
377 break;
378 }
379 case PKT3_CLEAR_STATE:
380 case PKT3_INCREMENT_DE_COUNTER:
381 case PKT3_PFP_SYNC_ME:
382 break;
383 case PKT3_NOP:
384 if (header == 0xffff1000) {
385 count = -1; /* One dword NOP. */
386 } else if (count == 0 && ib->cur_dw < ib->num_dw &&
387 AC_IS_TRACE_POINT(ib->ib[ib->cur_dw])) {
388 unsigned packet_id = AC_GET_TRACE_POINT_ID(ib->ib[ib->cur_dw]);
389
390 print_spaces(f, INDENT_PKT);
391 fprintf(f, COLOR_RED "Trace point ID: %u\n", packet_id);
392
393 if (ib->trace_id == -1)
394 break; /* tracing was disabled */
395
396 print_spaces(f, INDENT_PKT);
397 if (packet_id < ib->trace_id)
398 fprintf(f, COLOR_RED
399 "This trace point was reached by the CP."
400 COLOR_RESET "\n");
401 else if (packet_id == ib->trace_id)
402 fprintf(f, COLOR_RED
403 "!!!!! This is the last trace point that "
404 "was reached by the CP !!!!!"
405 COLOR_RESET "\n");
406 else if (packet_id+1 == ib->trace_id)
407 fprintf(f, COLOR_RED
408 "!!!!! This is the first trace point that "
409 "was NOT been reached by the CP !!!!!"
410 COLOR_RESET "\n");
411 else
412 fprintf(f, COLOR_RED
413 "!!!!! This trace point was NOT reached "
414 "by the CP !!!!!"
415 COLOR_RESET "\n");
416 break;
417 }
418 break;
419 }
420
421 /* print additional dwords */
422 while (ib->cur_dw <= first_dw + count)
423 ac_ib_get(ib);
424
425 if (ib->cur_dw > first_dw + count + 1)
426 fprintf(f, COLOR_RED "\n!!!!! count in header too low !!!!!"
427 COLOR_RESET "\n");
428 }
429
430 /**
431 * Parse and print an IB into a file.
432 */
433 static void ac_do_parse_ib(FILE *f, struct ac_ib_parser *ib)
434 {
435 while (ib->cur_dw < ib->num_dw) {
436 uint32_t header = ac_ib_get(ib);
437 unsigned type = PKT_TYPE_G(header);
438
439 switch (type) {
440 case 3:
441 ac_parse_packet3(f, header, ib);
442 break;
443 case 2:
444 /* type-2 nop */
445 if (header == 0x80000000) {
446 fprintf(f, COLOR_GREEN "NOP (type 2)" COLOR_RESET "\n");
447 break;
448 }
449 /* fall through */
450 default:
451 fprintf(f, "Unknown packet type %i\n", type);
452 break;
453 }
454 }
455 }
456
457 static void format_ib_output(FILE *f, char *out)
458 {
459 unsigned depth = 0;
460
461 for (;;) {
462 char op = 0;
463
464 if (out[0] == '\n' && out[1] == '\035')
465 out++;
466 if (out[0] == '\035') {
467 op = out[1];
468 out += 2;
469 }
470
471 if (op == '<')
472 depth--;
473
474 unsigned indent = 4 * depth;
475 if (op != '#')
476 indent += 9;
477
478 if (indent)
479 print_spaces(f, indent);
480
481 char *end = strchrnul(out, '\n');
482 fwrite(out, end - out, 1, f);
483 fputc('\n', f); /* always end with a new line */
484 if (!*end)
485 break;
486
487 out = end + 1;
488
489 if (op == '>')
490 depth++;
491 }
492 }
493
494 /**
495 * Parse and print an IB into a file.
496 *
497 * \param f file
498 * \param ib_ptr IB
499 * \param num_dw size of the IB
500 * \param chip_class chip class
501 * \param trace_id the last trace ID that is known to have been reached
502 * and executed by the CP, typically read from a buffer
503 * \param addr_callback Get a mapped pointer of the IB at a given address. Can
504 * be NULL.
505 * \param addr_callback_data user data for addr_callback
506 */
507 void ac_parse_ib_chunk(FILE *f, uint32_t *ib_ptr, int num_dw, int trace_id,
508 enum chip_class chip_class,
509 ac_debug_addr_callback addr_callback, void *addr_callback_data)
510 {
511 struct ac_ib_parser ib = {};
512 ib.ib = ib_ptr;
513 ib.num_dw = num_dw;
514 ib.trace_id = trace_id;
515 ib.chip_class = chip_class;
516 ib.addr_callback = addr_callback;
517 ib.addr_callback_data = addr_callback_data;
518
519 char *out;
520 size_t outsize;
521 FILE *memf = open_memstream(&out, &outsize);
522 ib.f = memf;
523 ac_do_parse_ib(memf, &ib);
524 fclose(memf);
525
526 if (out) {
527 format_ib_output(f, out);
528 free(out);
529 }
530
531 if (ib.cur_dw > ib.num_dw) {
532 printf("\nPacket ends after the end of IB.\n");
533 exit(1);
534 }
535 }
536
537 /**
538 * Parse and print an IB into a file.
539 *
540 * \param f file
541 * \param ib IB
542 * \param num_dw size of the IB
543 * \param chip_class chip class
544 * \param trace_id the last trace ID that is known to have been reached
545 * and executed by the CP, typically read from a buffer
546 * \param addr_callback Get a mapped pointer of the IB at a given address. Can
547 * be NULL.
548 * \param addr_callback_data user data for addr_callback
549 */
550 void ac_parse_ib(FILE *f, uint32_t *ib, int num_dw, int trace_id,
551 const char *name, enum chip_class chip_class,
552 ac_debug_addr_callback addr_callback, void *addr_callback_data)
553 {
554 fprintf(f, "------------------ %s begin ------------------\n", name);
555
556 ac_parse_ib_chunk(f, ib, num_dw, trace_id, chip_class, addr_callback,
557 addr_callback_data);
558
559 fprintf(f, "------------------- %s end -------------------\n\n", name);
560 }