[coreboot-gerrit] Change in coreboot[master]: ifdtool: merge region_filenames with region_name(s)

Bill XIE (Code Review) gerrit at coreboot.org
Tue Sep 12 10:19:10 CEST 2017


Bill XIE has uploaded this change for review. ( https://review.coreboot.org/21509


Change subject: ifdtool: merge region_filenames with region_name(s)
......................................................................

ifdtool: merge region_filenames with region_name(s)

There is no reason to keep a separate region_filenames array,
so I merge it into region_name(s).

This commit is one separated from the original I6d05418c.

Change-Id: I38489c6d3b3c161e9b0281188e6cdd0b62e38335
Signed-off-by: Bill XIE <persmule at gmail.com>
---
M util/ifdtool/ifdtool.c
M util/ifdtool/ifdtool.h
2 files changed, 11 insertions(+), 22 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/21509/1

diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c
index e330494..03b28f4 100644
--- a/util/ifdtool/ifdtool.c
+++ b/util/ifdtool/ifdtool.c
@@ -33,15 +33,15 @@
 static int platform = -1;
 
 static const struct region_name region_names[MAX_REGIONS] = {
-	{ "Flash Descriptor", "fd" },
-	{ "BIOS", "bios" },
-	{ "Intel ME", "me" },
-	{ "GbE", "gbe" },
-	{ "Platform Data", "pd" },
-	{ "Reserved", "res1" },
-	{ "Reserved", "res2" },
-	{ "Reserved", "res3" },
-	{ "EC", "ec" },
+	{ "Flash Descriptor", "fd", "flashregion_0_flashdescriptor.bin" },
+	{ "BIOS", "bios", "flashregion_1_bios.bin" },
+	{ "Intel ME", "me", "flashregion_2_intel_me.bin" },
+	{ "GbE", "gbe", "flashregion_3_gbe.bin" },
+	{ "Platform Data", "pd", "flashregion_4_platform_data.bin" },
+	{ "Reserved", "res1", "flashregion_5_reserved.bin" },
+	{ "Reserved", "res2", "flashregion_6_reserved.bin" },
+	{ "Reserved", "res3", "flashregion_7_reserved.bin" },
+	{ "EC", "ec", "flashregion_8_ec.bin" }
 };
 
 static fdbar_t *find_fd(char *image, int size)
@@ -226,24 +226,12 @@
 
 static const char *region_filename(unsigned int region_type)
 {
-	static const char * const region_filenames[MAX_REGIONS] = {
-		"flashregion_0_flashdescriptor.bin",
-		"flashregion_1_bios.bin",
-		"flashregion_2_intel_me.bin",
-		"flashregion_3_gbe.bin",
-		"flashregion_4_platform_data.bin",
-		"flashregion_5_reserved.bin",
-		"flashregion_6_reserved.bin",
-		"flashregion_7_reserved.bin",
-		"flashregion_8_ec.bin",
-	};
-
 	if (region_type >= max_regions) {
 		fprintf(stderr, "Invalid region type %d.\n", region_type);
 		exit (EXIT_FAILURE);
 	}
 
-	return region_filenames[region_type];
+	return region_names[region_type].filename;
 }
 
 static void dump_region(unsigned int num, const frba_t *frba)
diff --git a/util/ifdtool/ifdtool.h b/util/ifdtool/ifdtool.h
index 1ebe629..f50f6be 100644
--- a/util/ifdtool/ifdtool.h
+++ b/util/ifdtool/ifdtool.h
@@ -142,4 +142,5 @@
 struct region_name {
 	const char *pretty;
 	const char *terse;
+	const char *filename;
 };

-- 
To view, visit https://review.coreboot.org/21509
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I38489c6d3b3c161e9b0281188e6cdd0b62e38335
Gerrit-Change-Number: 21509
Gerrit-PatchSet: 1
Gerrit-Owner: Bill XIE <persmule at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170912/da53b665/attachment.html>


More information about the coreboot-gerrit mailing list