From: Eric Anholt <eric@anholt.net>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 3/5] reg_dumper: Refactor duplicated reg-dumping code.
Date: Mon, 20 Feb 2012 10:04:00 -0800 [thread overview]
Message-ID: <1329761042-9648-3-git-send-email-eric@anholt.net> (raw)
In-Reply-To: <1329761042-9648-1-git-send-email-eric@anholt.net>
---
tools/intel_reg_dumper.c | 73 +++++++++++-----------------------------------
1 files changed, 17 insertions(+), 56 deletions(-)
diff --git a/tools/intel_reg_dumper.c b/tools/intel_reg_dumper.c
index ee0ca75..c5249cb 100644
--- a/tools/intel_reg_dumper.c
+++ b/tools/intel_reg_dumper.c
@@ -1803,58 +1803,32 @@ static struct reg_debug i945gm_mi_regs[] = {
DEFINEREG(ECOSKPD),
};
-static void
-i945_dump_mi_regs(void)
-{
- char debug[1024];
- int i;
-
- for (i = 0; i < ARRAY_SIZE(i945gm_mi_regs); i++) {
- uint32_t val = INREG(i945gm_mi_regs[i].reg);
-
- if (i945gm_mi_regs[i].debug_output != NULL) {
- i945gm_mi_regs[i].debug_output(debug, sizeof(debug),
- i945gm_mi_regs
- [i].reg,
- val);
- printf("%30.30s: 0x%08x (%s)\n",
- i945gm_mi_regs[i].name,
- (unsigned int)val, debug);
- } else {
- printf("%30.30s: 0x%08x\n", i945gm_mi_regs[i].name,
- (unsigned int)val);
- }
- }
-}
+#define intel_dump_regs(regs) _intel_dump_regs(regs, ARRAY_SIZE(regs))
static void
-ironlake_dump_regs(void)
+_intel_dump_regs(struct reg_debug *regs, int count)
{
char debug[1024];
int i;
- for (i = 0; i < ARRAY_SIZE(ironlake_debug_regs); i++) {
- uint32_t val = INREG(ironlake_debug_regs[i].reg);
+ for (i = 0; i < count; i++) {
+ uint32_t val = INREG(regs[i].reg);
- if (ironlake_debug_regs[i].debug_output != NULL) {
- ironlake_debug_regs[i].debug_output(debug, sizeof(debug),
- ironlake_debug_regs
- [i].reg,
- val);
+ if (regs[i].debug_output != NULL) {
+ regs[i].debug_output(debug, sizeof(debug), regs[i].reg, val);
printf("%30.30s: 0x%08x (%s)\n",
- ironlake_debug_regs[i].name,
+ regs[i].name,
(unsigned int)val, debug);
} else {
- printf("%30.30s: 0x%08x\n", ironlake_debug_regs[i].name,
+ printf("%30.30s: 0x%08x\n", regs[i].name,
(unsigned int)val);
}
}
}
static void
-intel_dump_regs(void)
+intel_dump_other_regs(void)
{
- char debug[1024];
int i;
int fp, dpll;
int disp_pipe;
@@ -1867,22 +1841,6 @@ intel_dump_regs(void)
int crt;
#endif
- for (i = 0; i < ARRAY_SIZE(intel_debug_regs); i++) {
- uint32_t val = INREG(intel_debug_regs[i].reg);
-
- if (intel_debug_regs[i].debug_output != NULL) {
- intel_debug_regs[i].debug_output(debug, sizeof(debug),
- intel_debug_regs[i].reg,
- val);
- printf("%20.20s: 0x%08x (%s)\n",
- intel_debug_regs[i].name,
- (unsigned int)val, debug);
- } else {
- printf("%20.20s: 0x%08x\n",
- intel_debug_regs[i].name,
- (unsigned int)val);
- }
- }
#if 0
i830DumpIndexed(pScrn, "SR", 0x3c4, 0x3c5, 0, 7);
msr = INREG8(0x3cc);
@@ -2128,13 +2086,16 @@ int main(int argc, char** argv)
}
if (HAS_PCH_SPLIT(devid)) {
- ironlake_dump_regs();
+ intel_dump_regs(ironlake_debug_regs);
}
else if (IS_945GM(devid)) {
- i945_dump_mi_regs();
- intel_dump_regs();
- } else
- intel_dump_regs();
+ intel_dump_regs(i945gm_mi_regs);
+ intel_dump_regs(intel_debug_regs);
+ intel_dump_other_regs();
+ } else {
+ intel_dump_regs(intel_debug_regs);
+ intel_dump_other_regs();
+ }
return 0;
}
--
1.7.9
next prev parent reply other threads:[~2012-02-20 18:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-20 18:03 [PATCH 1/5] instdone: Fix fallthroughs to invalid instdone bits on newer hardware Eric Anholt
2012-02-20 18:03 ` [PATCH 2/5] instdone: Add support for one of the IVB instdone regs Eric Anholt
2012-02-20 18:04 ` Eric Anholt [this message]
2012-02-20 18:04 ` [PATCH 4/5] intel_reg_dumper: Add dumping of GPU turbo regs Eric Anholt
2012-02-20 22:53 ` Paul Menzel
2012-02-21 18:50 ` Eric Anholt
2012-02-20 18:04 ` [PATCH 5/5] gem_ringfill: Make this actually test that all the batches executed Eric Anholt
2012-02-20 21:22 ` Chris Wilson
2012-02-20 22:05 ` Chris Wilson
2012-02-22 9:53 ` 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=1329761042-9648-3-git-send-email-eric@anholt.net \
--to=eric@anholt.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox