public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 1/3] tools/intel_bios_reader: abstract header information dumping
Date: Fri, 13 May 2016 16:52:42 +0300	[thread overview]
Message-ID: <87lh3ef4k5.fsf@intel.com> (raw)
In-Reply-To: <1463056680-6642-1-git-send-email-jani.nikula@intel.com>


Fairly simple stuff, pushed the series to igt.

BR,
Jani.

On Thu, 12 May 2016, Jani Nikula <jani.nikula@intel.com> wrote:
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  tools/intel_bios_reader.c | 52 +++++++++++++++++++++++++++--------------------
>  1 file changed, 30 insertions(+), 22 deletions(-)
>
> diff --git a/tools/intel_bios_reader.c b/tools/intel_bios_reader.c
> index 5bad3f49690d..25460cacd84c 100644
> --- a/tools/intel_bios_reader.c
> +++ b/tools/intel_bios_reader.c
> @@ -62,6 +62,7 @@ struct bdb_block {
>  };
>  
>  struct context {
> +	const struct vbt_header *vbt;
>  	const struct bdb_header *bdb;
>  	int size;
>  
> @@ -1405,6 +1406,32 @@ static bool dump_section(struct context *context, int section_id)
>  	return true;
>  }
>  
> +static void dump_headers(struct context *context)
> +{
> +	char signature[17];
> +	int i;
> +
> +	printf("VBT vers: %d.%d\n",
> +	       context->vbt->version / 100, context->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("Available sections: ");
> +	for (i = 0; i < 256; i++) {
> +		struct bdb_block *block;
> +
> +		block = find_section(context, i);
> +		if (!block)
> +			continue;
> +		printf("%d ", i);
> +		free(block);
> +	}
> +	printf("\n");
> +}
> +
>  enum opt {
>  	OPT_UNKNOWN = '?',
>  	OPT_END = -1,
> @@ -1441,11 +1468,9 @@ int main(int argc, char **argv)
>  	const char *toolname = argv[0];
>  	struct stat finfo;
>  	int size;
> -	struct bdb_header *bdb;
>  	struct context context = {
>  		.panel_type = -1,
>  	};
> -	char signature[17];
>  	char *endp;
>  	int block_number = -1;
>  
> @@ -1570,34 +1595,17 @@ int main(int argc, char **argv)
>  		return 1;
>  	}
>  
> -	printf("VBT vers: %d.%d\n", vbt->version / 100, vbt->version % 100);
> -
>  	bdb_off = vbt_off + vbt->bdb_offset;
>  	if (bdb_off >= size - sizeof(struct bdb_header)) {
>  		printf("Invalid VBT found, BDB points beyond end of data block\n");
>  		return 1;
>  	}
>  
> -	bdb = (struct bdb_header *)(VBIOS + bdb_off);
> -	strncpy(signature, (char *)bdb->signature, 16);
> -	signature[16] = 0;
> -	printf("BDB sig: %s\n", signature);
> -	printf("BDB vers: %d\n", bdb->version);
> -
> -	context.bdb = bdb;
> +	context.vbt = vbt;
> +	context.bdb = (const struct bdb_header *)(VBIOS + bdb_off);
>  	context.size = size;
>  
> -	printf("Available sections: ");
> -	for (i = 0; i < 256; i++) {
> -		struct bdb_block *block;
> -
> -		block = find_section(&context, i);
> -		if (!block)
> -			continue;
> -		printf("%d ", i);
> -		free(block);
> -	}
> -	printf("\n");
> +	dump_headers(&context);
>  
>  	if (!context.devid) {
>  		const char *devid_string = getenv("DEVICE");

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2016-05-13 13:52 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 ` [PATCH i-g-t 2/3] tools/intel_bios_reader: clean up VBT/BDB header dumping Jani Nikula
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 ` Jani Nikula [this message]

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=87lh3ef4k5.fsf@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