All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Lespiau <damien.lespiau@gmail.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 4/4] intel_reg_dumper: Add more information when dumping single registers
Date: Mon,  3 Sep 2012 16:16:29 +0100	[thread overview]
Message-ID: <1346685389-26198-4-git-send-email-damien.lespiau@gmail.com> (raw)
In-Reply-To: <1346685389-26198-1-git-send-email-damien.lespiau@gmail.com>

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

Now that we can dump registers giving a partial name, adding more
information about the dumped registers seems useful.

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

diff --git a/tools/intel_reg_dumper.c b/tools/intel_reg_dumper.c
index 0b40f58..f04702c 100644
--- a/tools/intel_reg_dumper.c
+++ b/tools/intel_reg_dumper.c
@@ -27,6 +27,7 @@
 
 #define _GNU_SOURCE
 #include <ctype.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -1970,20 +1971,37 @@ static struct reg_debug gen6_rp_debug_regs[] = {
 	DEFINEREG(GEN6_PMINTRMSK),
 };
 
-#define DECLARE_REGS(r)	{ .regs = r, .count = ARRAY_SIZE(r) }
+#define DECLARE_REGS(d,r)	\
+	{ .description = d, .regs = r, .count = ARRAY_SIZE(r) }
 static struct {
+	const char *description;
 	struct reg_debug *regs;
 	int count;
 } known_registers[] = {
-	DECLARE_REGS(ironlake_debug_regs),
-	DECLARE_REGS(i945gm_mi_regs),
-	DECLARE_REGS(intel_debug_regs),
-	DECLARE_REGS(gen6_rp_debug_regs),
-	DECLARE_REGS(haswell_debug_regs)
+	DECLARE_REGS("Gen5",   ironlake_debug_regs),
+	DECLARE_REGS("i945GM", i945gm_mi_regs),
+	DECLARE_REGS("Gen2",   intel_debug_regs),
+	DECLARE_REGS("Gen6",   gen6_rp_debug_regs),
+	DECLARE_REGS("Gen7.5", haswell_debug_regs)
 };
 #undef DECLARE_REGS
 
 static void
+dump_reg(struct reg_debug *reg, uint32_t val, const char *prefix)
+{
+	char debug[1024];
+
+	if (reg->debug_output != NULL) {
+		reg->debug_output(debug, sizeof(debug), reg->reg, val);
+		printf("%s: %s (0x%x): 0x%08x (%s)\n",
+		       prefix, reg->name, reg->reg, val, debug);
+	} else {
+		printf("%s: %s (0x%x): 0x%08x\n",
+		       prefix, reg->name, reg->reg, val);
+	}
+}
+
+static void
 str_to_upper(char *str)
 {
 	while(*str) {
@@ -2004,7 +2022,8 @@ decode_register_name(char *name, uint32_t val)
 
 		for (j = 0; j < known_registers[i].count; j++)
 			if (strstr(regs[j].name, name))
-				_intel_dump_reg(&regs[j], val);
+				dump_reg(&regs[j], val,
+					 known_registers[i].description);
 	}
 }
 
@@ -2018,7 +2037,8 @@ decode_register_address(int address, uint32_t val)
 
 		for (j = 0; j < known_registers[i].count; j++)
 			if (regs[j].reg == address)
-				_intel_dump_reg(&regs[j], val);
+				dump_reg(&regs[j], val,
+					 known_registers[i].description);
 	}
 }
 
-- 
1.7.7.5

  parent reply	other threads:[~2012-09-03 15:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-03 15:16 [PATCH 1/4] intel_reg_dumper: Add a single register decode mode Damien Lespiau
2012-09-03 15:16 ` [PATCH 2/4] intel_reg_dumper: Also decode registers given by address Damien Lespiau
2012-09-03 15:16 ` [PATCH 3/4] intel_reg_dumper: Allow partial register names on the command line Damien Lespiau
2012-09-03 15:16 ` Damien Lespiau [this message]
2012-09-04  8:11 ` [PATCH 1/4] intel_reg_dumper: Add a single register decode mode Jani Nikula
2012-09-04 11:57   ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1346685389-26198-4-git-send-email-damien.lespiau@gmail.com \
    --to=damien.lespiau@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.