All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@intel.com
Subject: [i-g-t PATCH 1/6] intel_bios_reader: pass bdb pointer around instead of having as global
Date: Thu, 14 Jan 2016 17:51:25 +0200	[thread overview]
Message-ID: <2e2fffa7a5e0debb1ea2cc70b46c4818b48b0d53.1452786403.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1452786403.git.jani.nikula@intel.com>
In-Reply-To: <cover.1452786403.git.jani.nikula@intel.com>

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_bios_reader.c | 88 ++++++++++++++++++++++++++++-------------------
 1 file changed, 52 insertions(+), 36 deletions(-)

diff --git a/tools/intel_bios_reader.c b/tools/intel_bios_reader.c
index b31f648f0607..7b525f220f16 100644
--- a/tools/intel_bios_reader.c
+++ b/tools/intel_bios_reader.c
@@ -71,13 +71,13 @@ struct bdb_block {
 	void *data;
 };
 
-struct bdb_header *bdb;
 struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs;
 static int tv_present;
 static int lvds_present;
 static int panel_type;
 
-static struct bdb_block *find_section(int section_id, int length)
+static struct bdb_block *find_section(const struct bdb_header *bdb,
+				      int section_id, int length)
 {
 	struct bdb_block *block;
 	unsigned char *base = (unsigned char *)bdb;
@@ -118,7 +118,8 @@ static struct bdb_block *find_section(int section_id, int length)
 	return NULL;
 }
 
-static void dump_general_features(const struct bdb_block *block)
+static void dump_general_features(const struct bdb_header *bdb,
+				  const struct bdb_block *block)
 {
 	struct bdb_general_features *features = block->data;
 
@@ -170,7 +171,8 @@ static void dump_general_features(const struct bdb_block *block)
 	lvds_present = 1;	/* should be based on IS_MOBILE() */
 }
 
-static void dump_backlight_info(const struct bdb_block *block)
+static void dump_backlight_info(const struct bdb_header *bdb,
+				const struct bdb_block *block)
 {
 	struct bdb_lvds_backlight *backlight = block->data;
 	struct blc_struct *blc;
@@ -352,7 +354,8 @@ static const char *efp_conn(uint8_t type)
 
 
 
-static void dump_child_device(struct child_device_config *child)
+static void dump_child_device(const struct bdb_header *bdb,
+			      struct child_device_config *child)
 {
 	char child_id[11];
 
@@ -390,7 +393,8 @@ static void dump_child_device(struct child_device_config *child)
 	}
 }
 
-static void dump_general_definitions(const struct bdb_block *block)
+static void dump_general_definitions(const struct bdb_header *bdb,
+				     const struct bdb_block *block)
 {
 	struct bdb_general_definitions *defs = block->data;
 	int i;
@@ -409,10 +413,11 @@ static void dump_general_definitions(const struct bdb_block *block)
 	child_device_num = (block->size - sizeof(*defs)) /
 		defs->child_dev_size;
 	for (i = 0; i < child_device_num; i++)
-		dump_child_device((void*)&defs->devices[i * defs->child_dev_size]);
+		dump_child_device(bdb,(void*)&defs->devices[i * defs->child_dev_size]);
 }
 
-static void dump_child_devices(const struct bdb_block *block)
+static void dump_child_devices(const struct bdb_header *bdb,
+			       const struct bdb_block *block)
 {
 	struct bdb_child_devices *child_devs = block->data;
 	struct child_device_config *child;
@@ -435,7 +440,8 @@ static void dump_child_devices(const struct bdb_block *block)
 	}
 }
 
-static void dump_lvds_options(const struct bdb_block *block)
+static void dump_lvds_options(const struct bdb_header *bdb,
+			      const struct bdb_block *block)
 {
 	struct bdb_lvds_options *options = block->data;
 
@@ -451,7 +457,8 @@ static void dump_lvds_options(const struct bdb_block *block)
 	printf("\tPFIT mode: %d\n", options->pfit_mode);
 }
 
-static void dump_lvds_ptr_data(const struct bdb_block *block)
+static void dump_lvds_ptr_data(const struct bdb_header *bdb,
+			       const struct bdb_block *block)
 {
 	struct bdb_lvds_lfp_data_ptrs *ptrs = block->data;
 
@@ -461,7 +468,8 @@ static void dump_lvds_ptr_data(const struct bdb_block *block)
 	lvds_lfp_data_ptrs = ptrs;
 }
 
-static void dump_lvds_data(const struct bdb_block *block)
+static void dump_lvds_data(const struct bdb_header *bdb,
+			   const struct bdb_block *block)
 {
 	struct bdb_lvds_lfp_data *lvds_data = block->data;
 	struct bdb_lvds_lfp_data_ptrs *ptrs = lvds_lfp_data_ptrs;
@@ -533,7 +541,8 @@ static void dump_lvds_data(const struct bdb_block *block)
 	}
 }
 
-static void dump_driver_feature(const struct bdb_block *block)
+static void dump_driver_feature(const struct bdb_header *bdb,
+				const struct bdb_block *block)
 {
 	struct bdb_driver_feature *feature = block->data;
 
@@ -599,7 +608,8 @@ static void dump_driver_feature(const struct bdb_block *block)
 	       feature->legacy_crt_max_refresh);
 }
 
-static void dump_edp(const struct bdb_block *block)
+static void dump_edp(const struct bdb_header *bdb,
+		     const struct bdb_block *block)
 {
 	struct bdb_edp *edp = block->data;
 	int bpp, msa;
@@ -728,7 +738,8 @@ print_detail_timing_data(struct lvds_dvo_timing2 *dvo_timing)
 	printf("\tclock: %d\n", dvo_timing->clock * 10);
 }
 
-static void dump_sdvo_panel_dtds(const struct bdb_block *block)
+static void dump_sdvo_panel_dtds(const struct bdb_header *bdb,
+				 const struct bdb_block *block)
 {
 	struct lvds_dvo_timing2 *dvo_timing = block->data;
 	int n, count;
@@ -740,7 +751,8 @@ static void dump_sdvo_panel_dtds(const struct bdb_block *block)
 	}
 }
 
-static void dump_sdvo_lvds_options(const struct bdb_block *block)
+static void dump_sdvo_lvds_options(const struct bdb_header *bdb,
+				   const struct bdb_block *block)
 {
 	struct bdb_sdvo_lvds_options *options = block->data;
 
@@ -761,7 +773,8 @@ static void dump_sdvo_lvds_options(const struct bdb_block *block)
 	printf("\tmisc[3]: %x\n", options->panel_misc_bits_4);
 }
 
-static void dump_mipi_config(const struct bdb_block *block)
+static void dump_mipi_config(const struct bdb_header *bdb,
+			     const struct bdb_block *block)
 {
 	struct bdb_mipi_config *start = block->data;
 	struct mipi_config *config;
@@ -989,7 +1002,8 @@ static uint16_t get_blocksize(void *p)
 	return block_size;
 }
 
-static void dump_mipi_sequence(const struct bdb_block *block)
+static void dump_mipi_sequence(const struct bdb_header *bdb,
+			       const struct bdb_block *block)
 {
 	struct bdb_mipi_sequence *sequence = block->data;
 	const uint8_t *data;
@@ -1075,7 +1089,8 @@ get_device_id(unsigned char *bios, int size)
 struct dumper {
 	uint8_t id;
 	const char *name;
-	void (*dump)(const struct bdb_block *block);
+	void (*dump)(const struct bdb_header *bdb,
+		     const struct bdb_block *block);
 };
 
 struct dumper dumpers[] = {
@@ -1167,7 +1182,7 @@ static void hex_dump(const struct bdb_block *block)
 	printf("\n\n");
 }
 
-static void dump_section(int section_id, int size)
+static void dump_section(const struct bdb_header *bdb, int section_id, int size)
 {
 	struct dumper *dumper = NULL;
 	const struct bdb_block *block;
@@ -1178,7 +1193,7 @@ static void dump_section(int section_id, int size)
 		return;
 	done[section_id] = 1;
 
-	block = find_section(section_id, size);
+	block = find_section(bdb, section_id, size);
 	if (!block)
 		return;
 
@@ -1196,7 +1211,7 @@ static void dump_section(int section_id, int size)
 
 	hex_dump(block);
 	if (dumper && dumper->dump)
-		dumper->dump(block);
+		dumper->dump(bdb, block);
 	printf("\n");
 }
 
@@ -1209,6 +1224,7 @@ int main(int argc, char **argv)
 	struct stat finfo;
 	int size;
 	struct bdb_block *block;
+	struct bdb_header *bdb;
 	char signature[17];
 	char *devid_string;
 
@@ -1291,7 +1307,7 @@ int main(int argc, char **argv)
 	printf("Available sections: ");
 
 	for (i = 0; i < 256; i++) {
-		block = find_section(i, size);
+		block = find_section(bdb, i, size);
 		if (!block)
 			continue;
 		printf("%d ", i);
@@ -1304,24 +1320,24 @@ int main(int argc, char **argv)
 	if (devid == -1)
 	    printf("Warning: could not find PCI device ID!\n");
 
-	dump_section(BDB_GENERAL_FEATURES, size);
-	dump_section(BDB_GENERAL_DEFINITIONS, size);
-	dump_section(BDB_CHILD_DEVICE_TABLE, size);
-	dump_section(BDB_LVDS_OPTIONS, size);
-	dump_section(BDB_LVDS_LFP_DATA_PTRS, size);
-	dump_section(BDB_LVDS_LFP_DATA, size);
-	dump_section(BDB_LVDS_BACKLIGHT, size);
+	dump_section(bdb, BDB_GENERAL_FEATURES, size);
+	dump_section(bdb, BDB_GENERAL_DEFINITIONS, size);
+	dump_section(bdb, BDB_CHILD_DEVICE_TABLE, size);
+	dump_section(bdb, BDB_LVDS_OPTIONS, size);
+	dump_section(bdb, BDB_LVDS_LFP_DATA_PTRS, size);
+	dump_section(bdb, BDB_LVDS_LFP_DATA, size);
+	dump_section(bdb, BDB_LVDS_BACKLIGHT, size);
 
-	dump_section(BDB_SDVO_LVDS_OPTIONS, size);
-	dump_section(BDB_SDVO_PANEL_DTDS, size);
+	dump_section(bdb, BDB_SDVO_LVDS_OPTIONS, size);
+	dump_section(bdb, BDB_SDVO_PANEL_DTDS, size);
 
-	dump_section(BDB_DRIVER_FEATURES, size);
-	dump_section(BDB_EDP, size);
-	dump_section(BDB_MIPI_CONFIG, size);
-	dump_section(BDB_MIPI_SEQUENCE, size);
+	dump_section(bdb, BDB_DRIVER_FEATURES, size);
+	dump_section(bdb, BDB_EDP, size);
+	dump_section(bdb, BDB_MIPI_CONFIG, size);
+	dump_section(bdb, BDB_MIPI_SEQUENCE, size);
 
 	for (i = 0; i < 256; i++)
-		dump_section(i, size);
+		dump_section(bdb, i, size);
 
 	return 0;
 }
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-01-14 15:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-14 15:51 [i-g-t PATCH 0/6] intel_bios_reader: support MIPI sequence block v3 Jani Nikula
2016-01-14 15:51 ` Jani Nikula [this message]
2016-01-14 15:51 ` [i-g-t PATCH 2/6] intel_bios_reader: fix size handling for 32-bit block size Jani Nikula
2016-01-14 15:51 ` [i-g-t PATCH 3/6] intel_bios_reader: make the VBT pointers more const Jani Nikula
2016-01-14 15:51 ` [i-g-t PATCH 4/6] intel_bios_reader: port find_panel_sequence_block from kernel Jani Nikula
2016-01-14 15:51 ` [i-g-t PATCH 5/6] intel_bios_reader: port the sequence block parsing " Jani Nikula
2016-01-14 15:51 ` [i-g-t PATCH 6/6] intel_bios_reader: dump MIPI sequence block v3 Jani Nikula
2016-01-14 15:57   ` [PATCH v2 " Jani Nikula
2016-01-15 13:26 ` [i-g-t PATCH 0/6] intel_bios_reader: support " 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=2e2fffa7a5e0debb1ea2cc70b46c4818b48b0d53.1452786403.git.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 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.