summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2011-09-09 10:10:07 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2011-09-09 10:10:07 +0200
commit206e129af067b7a898515d8c26acc319e5c5f445 (patch)
tree84587aa3b26b39720a85695fb21b68f0e880f951 /tools
parent079f8390309d9dc59197f04cafbcbda6c711c346 (diff)
tools: decode MI_SEMAPHORE_MBOX
Juggle the length check up to avoid duplication. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tools')
-rw-r--r--tools/intel_decode.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/tools/intel_decode.c b/tools/intel_decode.c
index 40ad6a6..def5118 100644
--- a/tools/intel_decode.c
+++ b/tools/intel_decode.c
@@ -85,7 +85,7 @@ instr_out(uint32_t *data, uint32_t hw_offset, unsigned int index,
static int
decode_mi(uint32_t *data, int count, uint32_t hw_offset, int *failures)
{
- unsigned int opcode;
+ unsigned int opcode, len = -1;
struct {
uint32_t opcode;
@@ -117,18 +117,11 @@ decode_mi(uint32_t *data, int count, uint32_t hw_offset, int *failures)
{ 0x0b, 0, 1, 1, "MI_SUSPEND_FLUSH" },
};
- switch ((data[0] & 0x1f800000) >> 23) {
- case 0x0a:
- instr_out(data, hw_offset, 0, "MI_BATCH_BUFFER_END\n");
- return -1;
- }
-
+ /* check instruction length */
for (opcode = 0; opcode < sizeof(opcodes_mi) / sizeof(opcodes_mi[0]);
opcode++) {
if ((data[0] & 0x1f800000) >> 23 == opcodes_mi[opcode].opcode) {
- unsigned int len = 1, i;
-
- instr_out(data, hw_offset, 0, "%s\n", opcodes_mi[opcode].name);
+ len = 1;
if (opcodes_mi[opcode].max_len > 1) {
len = (data[0] & opcodes_mi[opcode].len_mask) + 2;
if (len < opcodes_mi[opcode].min_len ||
@@ -140,8 +133,32 @@ decode_mi(uint32_t *data, int count, uint32_t hw_offset, int *failures)
opcodes_mi[opcode].max_len);
}
}
+ break;
+ }
+ }
- for (i = 1; i < len; i++) {
+ switch ((data[0] & 0x1f800000) >> 23) {
+ case 0x0a:
+ instr_out(data, hw_offset, 0, "MI_BATCH_BUFFER_END\n");
+ return -1;
+ case 0x16:
+ instr_out(data, hw_offset, 0, "MI_SEMAPHORE_MBOX%s%s%s%s %u\n",
+ data[0] & (1<<22) ? " global gtt," : "",
+ data[0] & (1<<21) ? " update semaphore," : "",
+ data[0] & (1<<20) ? " compare semaphore," : "",
+ data[0] & (1<<18) ? " use compare reg" : "",
+ data[0] & (0x3<<16));
+ instr_out(data, hw_offset, 1, "value\n");
+ instr_out(data, hw_offset, 2, "address\n");
+ return len;
+ }
+
+ for (opcode = 0; opcode < sizeof(opcodes_mi) / sizeof(opcodes_mi[0]);
+ opcode++) {
+ if ((data[0] & 0x1f800000) >> 23 == opcodes_mi[opcode].opcode) {
+
+ instr_out(data, hw_offset, 0, "%s\n", opcodes_mi[opcode].name);
+ for (int i = 1; i < len; i++) {
if (i >= count)
BUFFER_FAIL(count, len, opcodes_mi[opcode].name);
instr_out(data, hw_offset, i, "dword %d\n", i);