From patchwork Mon Sep 3 15:16:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Lespiau X-Patchwork-Id: 1400281 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 17EC1DF280 for ; Mon, 3 Sep 2012 15:19:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0BA439EEEF for ; Mon, 3 Sep 2012 08:19:16 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pb0-f49.google.com (mail-pb0-f49.google.com [209.85.160.49]) by gabe.freedesktop.org (Postfix) with ESMTP id 747EB9EB45 for ; Mon, 3 Sep 2012 08:16:41 -0700 (PDT) Received: by mail-pb0-f49.google.com with SMTP id rq8so8630458pbb.36 for ; Mon, 03 Sep 2012 08:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; bh=wdcFDPmb3HPat+pLwfVptRpFgAZThA3bk4CS3oN+7R4=; b=t7TygN7i8Jg80Wc6VzI6dJQHVSoftb4uNuEkT1Nwz7JCZ5ctAbf7x552x60ena9cex 746TBnk8ZmcxQk34WG/43gGigzRxpo9C2abM/TINLoCOuhUvNMgNMkKAmcYmoBE+zUzO L96RXyoignGa3MfhF4ci4eqhfy57RMYtHg1gBxsGZ6eCEPXsjaFgi+RYOFe1nE0U1cVL 1uUwJk4xxUNmwL5at9t21hb2C57/DMTHK8KsrjkfjCSWn7eDXBR8KbRpO4SAbbBFzouV dTzn3AONIMWirgVo3asxcGtKBWHnQG4LgAe9NlYquQZB9EHl+PiQMn2BwWLbiBsdhIQw 8PwA== Received: by 10.66.84.130 with SMTP id z2mr34690459pay.77.1346685401348; Mon, 03 Sep 2012 08:16:41 -0700 (PDT) Received: from dyon.amr.corp.intel.com ([83.217.123.106]) by mx.google.com with ESMTPS id gf7sm10095505pbc.65.2012.09.03.08.16.39 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 03 Sep 2012 08:16:40 -0700 (PDT) From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Mon, 3 Sep 2012 16:16:29 +0100 Message-Id: <1346685389-26198-4-git-send-email-damien.lespiau@gmail.com> X-Mailer: git-send-email 1.7.7.5 In-Reply-To: <1346685389-26198-1-git-send-email-damien.lespiau@gmail.com> References: <1346685389-26198-1-git-send-email-damien.lespiau@gmail.com> Subject: [Intel-gfx] [PATCH 4/4] intel_reg_dumper: Add more information when dumping single registers X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org From: Damien Lespiau Now that we can dump registers giving a partial name, adding more information about the dumped registers seems useful. Signed-off-by: Damien Lespiau --- 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 +#include #include #include #include @@ -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(®s[j], val); + dump_reg(®s[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(®s[j], val); + dump_reg(®s[j], val, + known_registers[i].description); } }