diff options
author | Nicolai Hähnle <[email protected]> | 2017-08-04 18:55:39 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-08-22 09:50:46 +0200 |
commit | fbbb5f71cd02e33a4dc7bb1be5b468e638df7670 (patch) | |
tree | 76934fdcb5f8d88f8e574ab710add335a278089a /src/amd | |
parent | 81d7577d4855c9016e5e138ba95c7c69b03966e0 (diff) |
amd/common: split out ac_parse_ib_chunk from ac_parse_ib
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/common/ac_debug.c | 37 | ||||
-rw-r--r-- | src/amd/common/ac_debug.h | 3 |
2 files changed, 32 insertions, 8 deletions
diff --git a/src/amd/common/ac_debug.c b/src/amd/common/ac_debug.c index 79473ecb8d0..42a72c086b1 100644 --- a/src/amd/common/ac_debug.c +++ b/src/amd/common/ac_debug.c @@ -390,12 +390,10 @@ static uint32_t *ac_parse_packet3(FILE *f, uint32_t *ib, int *num_dw, * be NULL. * \param addr_callback_data user data for addr_callback */ -void ac_parse_ib(FILE *f, uint32_t *ib, int num_dw, int trace_id, - const char *name, enum chip_class chip_class, - ac_debug_addr_callback addr_callback, void *addr_callback_data) +void ac_parse_ib_chunk(FILE *f, uint32_t *ib, int num_dw, int trace_id, + enum chip_class chip_class, + ac_debug_addr_callback addr_callback, void *addr_callback_data) { - fprintf(f, "------------------ %s begin ------------------\n", name); - while (num_dw > 0) { unsigned type = PKT_TYPE_G(ib[0]); @@ -420,10 +418,33 @@ void ac_parse_ib(FILE *f, uint32_t *ib, int num_dw, int trace_id, } } - fprintf(f, "------------------- %s end -------------------\n", name); if (num_dw < 0) { - printf("Packet ends after the end of IB.\n"); + printf("\nPacket ends after the end of IB.\n"); exit(0); } - fprintf(f, "\n"); +} + +/** + * Parse and print an IB into a file. + * + * \param f file + * \param ib IB + * \param num_dw size of the IB + * \param chip_class chip class + * \param trace_id the last trace ID that is known to have been reached + * and executed by the CP, typically read from a buffer + * \param addr_callback Get a mapped pointer of the IB at a given address. Can + * be NULL. + * \param addr_callback_data user data for addr_callback + */ +void ac_parse_ib(FILE *f, uint32_t *ib, int num_dw, int trace_id, + const char *name, enum chip_class chip_class, + ac_debug_addr_callback addr_callback, void *addr_callback_data) +{ + fprintf(f, "------------------ %s begin ------------------\n", name); + + ac_parse_ib_chunk(f, ib, num_dw, trace_id, chip_class, addr_callback, + addr_callback_data); + + fprintf(f, "------------------- %s end -------------------\n\n", name); } diff --git a/src/amd/common/ac_debug.h b/src/amd/common/ac_debug.h index 63ac4fa84d1..872420d2b9d 100644 --- a/src/amd/common/ac_debug.h +++ b/src/amd/common/ac_debug.h @@ -39,6 +39,9 @@ typedef void *(*ac_debug_addr_callback)(void *data, uint64_t addr); void ac_dump_reg(FILE *file, unsigned offset, uint32_t value, uint32_t field_mask); +void ac_parse_ib_chunk(FILE *f, uint32_t *ib, int num_dw, int trace_id, + enum chip_class chip_class, + ac_debug_addr_callback addr_callback, void *addr_callback_data); void ac_parse_ib(FILE *f, uint32_t *ib, int num_dw, int trace_id, const char *name, enum chip_class chip_class, ac_debug_addr_callback addr_callback, void *addr_callback_data); |