diff --git a/src/i830_debug.c b/src/i830_debug.c index 17ee40f..277a24a 100644 --- a/src/i830_debug.c +++ b/src/i830_debug.c @@ -45,6 +45,80 @@ #include "i810_reg.h" +struct debug_reg { + int bit; + char *name; +}; + +#define dump_debug_reg_fn(reg_name) \ +static void dump_##reg_name##_reg(unsigned long reg) { \ + int i; \ + ErrorF("%s register dump:\n", #reg_name); \ + for (i = 0; i < ARRAY_SIZE(reg_name##_reg); i++) { \ + if ((1 << reg_name##_reg[i].bit) & reg) \ + ErrorF("\t%s\n", reg_name##_reg[i].name); \ + } \ + } + +struct debug_reg esr_reg[] = { + { 0, "instruction error" }, + { 1, "memory refresh timing error" }, + { 2, "reserved (mbz)" }, + { 3, "display or overlay underrun" }, + { 4, "page table error (see PGTBL_ERR)" }, + { 5, "vertex max exceeded error" }, + { 6, "reserved (mbz)" }, + { 6, "reserved (mbz)" }, + { 7, "reserved (mbz)" }, + { 8, "reserved (mbz)" }, + { 9, "reserved (mbz)" }, + { 10, "reserved (mbz)" }, + { 11, "reserved (mbz)" }, + { 12, "reserved (mbz)" }, + { 13, "reserved (mbz)" }, + { 14, "reserved (mbz)" }, + { 15, "reserved (mbz)" }, +}; + +dump_debug_reg_fn(esr) + +struct debug_reg pgtbl_err_reg[] = { + { 0, "host GTT PTE invalid" }, + { 1, "host invalid PTE data" }, + { 2, "reserved (mbz)" }, + { 3, "reserved (mbz)" }, + { 4, "display A GTT PTE invalid" }, + { 5, "reserved (mbz)" }, + { 6, "display A invalid tiling" }, + { 7, "reserved (mbz)" }, + { 8, "display B GTT PTE invalid" }, + { 9, "reserved (mbz)" }, + { 10, "display B invalid tiling" }, + { 11, "reserved (mbz)" }, + { 12, "display C GTT PTE invalid" }, + { 13, "reserved (mbz)" }, + { 14, "display C invalid tiling" }, + { 15, "reserved (mbz)" }, + { 16, "overlay GTT PTE invalid" }, + { 17, "reserved (mbz)" }, + { 18, "overlay invalid tiling" }, + { 19, "command stream invalid GTT" }, + { 20, "command stream GTT PTE invalid" }, + { 21, "command stream vertex data GTT PTE invalid" }, + { 22, "command stream binary instruction GTT PTE invalid" }, + { 23, "command stream binary vertex data GTT PTE invalid" }, + { 24, "LC GTT PTE invalid" }, + { 25, "LC invalid tiling" }, + { 26, "MT GTT PTE invalid" }, + { 27, "reserved (mbz)" }, + { 28, "reserved (mbz)" }, + { 29, "reserved (mbz)" }, + { 30, "reserved (mbz)" }, + { 31, "reserved (mbz)" }, +}; + +dump_debug_reg_fn(pgtbl_err) + #define DEBUGSTRING(func) static char *func(I830Ptr pI830, int reg, \ uint32_t val) @@ -1570,10 +1644,19 @@ void i830_dump_error_state(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); + unsigned long esr = INREG16(ESR); + unsigned long pgtbl_err = INREG(PGTBL_ER); ErrorF("pgetbl_ctl: 0x%08x getbl_err: 0x%08x\n", INREG(PGETBL_CTL), INREG(PGE_ERR)); + dump_esr_reg(esr); + if (esr & ERR_PGTBL_ERROR) + dump_pgtbl_err_reg(pgtbl_err); + + if (esr & ERR_INSTRUCTION_ERROR) + ErrorF("bad instruction error\n"); + ErrorF("ipeir: 0x%08x iphdr: 0x%08x\n", INREG(IPEIR), INREG(IPEHR)); ErrorF("LP ring tail: 0x%08x head: 0x%08x len: 0x%08x start 0x%08x\n",