[Intel-gfx] [PATCH 2/4] intel_reg_dumper: Also decode registers given by address

Damien Lespiau damien.lespiau at gmail.com
Mon Sep 3 17:16:27 CEST 2012


From: Damien Lespiau <damien.lespiau at intel.com>

One can now give an address instead of a register name to decode a
single register.

Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
 tools/intel_reg_dumper.c |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/tools/intel_reg_dumper.c b/tools/intel_reg_dumper.c
index cc68985..5bc47b6 100644
--- a/tools/intel_reg_dumper.c
+++ b/tools/intel_reg_dumper.c
@@ -1996,7 +1996,7 @@ find_register_by_name(struct reg_debug *regs, int count,
 }
 
 static void
-decode_register(const char *name, uint32_t val)
+decode_register_name(const char *name, uint32_t val)
 {
 	int i;
 	struct reg_debug *reg = NULL;
@@ -2018,6 +2018,35 @@ decode_register(const char *name, uint32_t val)
 }
 
 static void
+decode_register_address(int address, uint32_t val)
+{
+	int i, j;
+
+	for (i = 0; i < ARRAY_SIZE(known_registers); i++) {
+		struct reg_debug *regs = known_registers[i].regs;
+
+		for (j = 0; j < known_registers[i].count; j++)
+			if (regs[j].reg == address)
+				_intel_dump_reg(&regs[j], val);
+	}
+}
+
+static void
+decode_register(const char *name, uint32_t val)
+{
+	long int address;
+	char *end;
+
+	address = strtoul(name, &end, 0);
+
+	/* found a register address */
+	if (address && *end == '\0')
+		decode_register_address(address, val);
+	else
+		decode_register_name(name, val);
+}
+
+static void
 intel_dump_other_regs(void)
 {
 	int i;
-- 
1.7.7.5




More information about the Intel-gfx mailing list