From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@intel.com
Subject: [PATCH i-g-t 2/3] tools/intel_bios_reader: clean up VBT/BDB header dumping
Date: Thu, 12 May 2016 15:37:59 +0300 [thread overview]
Message-ID: <1463056680-6642-2-git-send-email-jani.nikula@intel.com> (raw)
In-Reply-To: <1463056680-6642-1-git-send-email-jani.nikula@intel.com>
Make the output nicer. Do not print the header if a specific block is
requested.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
tools/intel_bios_reader.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/tools/intel_bios_reader.c b/tools/intel_bios_reader.c
index 25460cacd84c..59a90e234582 100644
--- a/tools/intel_bios_reader.c
+++ b/tools/intel_bios_reader.c
@@ -1408,28 +1408,34 @@ static bool dump_section(struct context *context, int section_id)
static void dump_headers(struct context *context)
{
- char signature[17];
- int i;
+ const struct vbt_header *vbt = context->vbt;
+ const struct bdb_header *bdb = context->bdb;
+ int i, j = 0;
- printf("VBT vers: %d.%d\n",
- context->vbt->version / 100, context->vbt->version % 100);
+ printf("VBT signature:\t\"%.*s\"\n",
+ (int)sizeof(vbt->signature), vbt->signature);
+ printf("VBT version:\t%d.%d\n", vbt->version / 100, vbt->version % 100);
- strncpy(signature, (char *)context->bdb->signature, 16);
- signature[16] = 0;
- printf("BDB sig: %s\n", signature);
- printf("BDB vers: %d\n", context->bdb->version);
+ printf("BDB signature:\t\"%.*s\"\n",
+ (int)sizeof(bdb->signature), bdb->signature);
+ printf("BDB version:\t%d\n", bdb->version);
- printf("Available sections: ");
+ printf("BDB blocks present:");
for (i = 0; i < 256; i++) {
struct bdb_block *block;
block = find_section(context, i);
if (!block)
continue;
- printf("%d ", i);
+
+ if (j++ % 16)
+ printf(" %3d", i);
+ else
+ printf("\n\t%3d", i);
+
free(block);
}
- printf("\n");
+ printf("\n\n");
}
enum opt {
@@ -1605,8 +1611,6 @@ int main(int argc, char **argv)
context.bdb = (const struct bdb_header *)(VBIOS + bdb_off);
context.size = size;
- dump_headers(&context);
-
if (!context.devid) {
const char *devid_string = getenv("DEVICE");
if (devid_string)
@@ -1631,6 +1635,8 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
} else {
+ dump_headers(&context);
+
/* dump all sections */
for (i = 0; i < 256; i++)
dump_section(&context, i);
--
2.1.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-05-12 12:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 12:37 [PATCH i-g-t 1/3] tools/intel_bios_reader: abstract header information dumping Jani Nikula
2016-05-12 12:37 ` Jani Nikula [this message]
2016-05-12 12:38 ` [PATCH i-g-t 3/3] tools/intel_bios_reader: print errors to stderr, return EXIT_FAILURE Jani Nikula
2016-05-13 13:52 ` [PATCH i-g-t 1/3] tools/intel_bios_reader: abstract header information dumping Jani Nikula
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=1463056680-6642-2-git-send-email-jani.nikula@intel.com \
--to=jani.nikula@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox