intel: Decode MI operands using specific length masks

The MI opcodes have different variable length masks, so use an operand
specific mask to decode the length.
(cherry picked from commit e92d97d75b)
This commit is contained in:
Chris Wilson 2009-02-04 20:59:22 +00:00 committed by Ian Romanick
parent 967345b497
commit fd1f65ba61

View file

@ -87,27 +87,28 @@ decode_mi(uint32_t *data, int count, uint32_t hw_offset, int *failures)
struct {
uint32_t opcode;
int len_mask;
int min_len;
int max_len;
char *name;
} opcodes_mi[] = {
{ 0x08, 1, 1, "MI_ARB_ON_OFF" },
{ 0x0a, 1, 1, "MI_BATCH_BUFFER_END" },
{ 0x31, 2, 2, "MI_BATCH_BUFFER_START" },
{ 0x14, 3, 3, "MI_DISPLAY_BUFFER_INFO" },
{ 0x04, 1, 1, "MI_FLUSH" },
{ 0x22, 3, 3, "MI_LOAD_REGISTER_IMM" },
{ 0x13, 2, 2, "MI_LOAD_SCAN_LINES_EXCL" },
{ 0x12, 2, 2, "MI_LOAD_SCAN_LINES_INCL" },
{ 0x00, 1, 1, "MI_NOOP" },
{ 0x11, 2, 2, "MI_OVERLAY_FLIP" },
{ 0x07, 1, 1, "MI_REPORT_HEAD" },
{ 0x18, 2, 2, "MI_SET_CONTEXT" },
{ 0x20, 3, 4, "MI_STORE_DATA_IMM" },
{ 0x21, 3, 4, "MI_STORE_DATA_INDEX" },
{ 0x24, 3, 3, "MI_STORE_REGISTER_MEM" },
{ 0x02, 1, 1, "MI_USER_INTERRUPT" },
{ 0x03, 1, 1, "MI_WAIT_FOR_EVENT" },
{ 0x08, 0, 1, 1, "MI_ARB_ON_OFF" },
{ 0x0a, 0, 1, 1, "MI_BATCH_BUFFER_END" },
{ 0x31, 0x3f, 2, 2, "MI_BATCH_BUFFER_START" },
{ 0x14, 0x3f, 3, 3, "MI_DISPLAY_BUFFER_INFO" },
{ 0x04, 0, 1, 1, "MI_FLUSH" },
{ 0x22, 0, 3, 3, "MI_LOAD_REGISTER_IMM" },
{ 0x13, 0x3f, 2, 2, "MI_LOAD_SCAN_LINES_EXCL" },
{ 0x12, 0x3f, 2, 2, "MI_LOAD_SCAN_LINES_INCL" },
{ 0x00, 0, 1, 1, "MI_NOOP" },
{ 0x11, 0x3f, 2, 2, "MI_OVERLAY_FLIP" },
{ 0x07, 0, 1, 1, "MI_REPORT_HEAD" },
{ 0x18, 0x3f, 2, 2, "MI_SET_CONTEXT" },
{ 0x20, 0x3f, 3, 4, "MI_STORE_DATA_IMM" },
{ 0x21, 0x3f, 3, 4, "MI_STORE_DATA_INDEX" },
{ 0x24, 0x3f, 3, 3, "MI_STORE_REGISTER_MEM" },
{ 0x02, 0, 1, 1, "MI_USER_INTERRUPT" },
{ 0x03, 0, 1, 1, "MI_WAIT_FOR_EVENT" },
};
@ -118,12 +119,14 @@ decode_mi(uint32_t *data, int count, uint32_t hw_offset, int *failures)
instr_out(data, hw_offset, 0, "%s\n", opcodes_mi[opcode].name);
if (opcodes_mi[opcode].max_len > 1) {
len = (data[0] & 0x000000ff) + 2;
len = (data[0] & opcodes_mi[opcode].len_mask) + 2;
if (len < opcodes_mi[opcode].min_len ||
len > opcodes_mi[opcode].max_len)
{
fprintf(out, "Bad length in %s\n",
opcodes_mi[opcode].name);
fprintf(out, "Bad length (%d) in %s, [%d, %d]\n",
len, opcodes_mi[opcode].name,
opcodes_mi[opcode].min_len,
opcodes_mi[opcode].max_len);
}
}