diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-04-06 22:04:44 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-04-06 22:22:45 +0100 |
commit | bceec7e1d8a160226b783c6344eae8cbf4ece144 (patch) | |
tree | 7a613b68066618f572ae9c406191cf8e62993c7b /tools/intel_error_decode.c | |
parent | 38dc15857c4da2b5bb6d6ffaf9bafaa0bfbe215a (diff) |
tools/intel_error_decode: Do ascii85 decode first
The dashes "---" may occur within an ascii85 block, but only an ascii85
block starts with ':' or '~'.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tools/intel_error_decode.c')
-rw-r--r-- | tools/intel_error_decode.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/tools/intel_error_decode.c b/tools/intel_error_decode.c index 8cbbe846..004b6c81 100644 --- a/tools/intel_error_decode.c +++ b/tools/intel_error_decode.c @@ -554,7 +554,7 @@ read_data_file(FILE *file) int head_idx = 0; int num_rings = 0; long long unsigned fence; - int data_size = 0, count = 0, line_number = 0, matched; + int data_size = 0, count = 0, matched; char *line = NULL; size_t line_size; uint32_t offset, value, ring_length = 0; @@ -565,7 +565,19 @@ read_data_file(FILE *file) while (getline(&line, &line_size, file) > 0) { char *dashes; - line_number++; + + if (line[0] == ':' || line[0] == '~') { + count = ascii85_decode(line+1, &data, line[0] == ':'); + if (count == 0) { + fprintf(stderr, "ASCII85 decode failed.\n"); + exit(1); + } + decode(decode_ctx, + buffer_name, ring_name, + gtt_offset, head_offset, + data, &count); + continue; + } dashes = strstr(line, "---"); if (dashes) { @@ -641,19 +653,6 @@ read_data_file(FILE *file) } } - if (line[0] == ':' || line[0] == '~') { - count = ascii85_decode(line+1, &data, line[0] == ':'); - if (count == 0) { - fprintf(stderr, "ASCII85 decode failed.\n"); - exit(1); - } - decode(decode_ctx, - buffer_name, ring_name, - gtt_offset, head_offset, - data, &count); - continue; - } - matched = sscanf(line, "%08x : %08x", &offset, &value); if (matched != 2) { unsigned int reg, reg2; |