[coreboot-gerrit] New patch to review for coreboot: 9e3b273 ifdtool: fixed indentation to meet coding style requirement

Aaron Jin (jin.aaron@gmail.com) gerrit at coreboot.org
Sat Jan 24 23:47:21 CET 2015


Aaron Jin (jin.aaron at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8275

-gerrit

commit 9e3b2736e5fc0054889de91ba0df9bb8e79ab210
Author: Aaron Jin <jin.aaron at gmail.com>
Date:   Fri Jan 23 23:35:22 2015 -0800

    ifdtool: fixed indentation to meet coding style requirement
    
    Change-Id: Ibdf51c03cbd17b4a0e1cb526c6de8178920b5db7
    Signed-off-by: Aaron Jin <jin.aaron at gmail.com>
---
 util/ifdtool/ifdtool.c | 229 ++++++++++++++++++++++++-------------------------
 util/ifdtool/ifdtool.h |  24 +++---
 2 files changed, 124 insertions(+), 129 deletions(-)

diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c
index 9569dfa..9e2e561 100644
--- a/util/ifdtool/ifdtool.c
+++ b/util/ifdtool/ifdtool.c
@@ -34,11 +34,11 @@
 #define NUM_REGIONS 5
 
 static const struct region_name region_names[NUM_REGIONS] = {
-	{ "Flash Descriptor", "fd" },
-	{ "BIOS", "bios" },
-	{ "Intel ME", "me" },
-	{ "GbE", "gbe" },
-	{ "Platform Data", "pd" }
+	{"Flash Descriptor", "fd"},
+	{"BIOS", "bios"},
+	{"Intel ME", "me"},
+	{"GbE", "gbe"},
+	{"Platform Data", "pd"}
 };
 
 static fdbar_t *find_fd(char *image, int size)
@@ -63,7 +63,7 @@ static fdbar_t *find_fd(char *image, int size)
 	return (fdbar_t *) (image + i);
 }
 
-static region_t get_region(frba_t *frba, int region_type)
+static region_t get_region(frba_t * frba, int region_type)
 {
 	region_t region;
 	region.base = 0, region.limit = 0, region.size = 0;
@@ -91,7 +91,7 @@ static region_t get_region(frba_t *frba, int region_type)
 		break;
 	default:
 		fprintf(stderr, "Invalid region type.\n");
-		exit (EXIT_FAILURE);
+		exit(EXIT_FAILURE);
 	}
 
 	region.size = region.limit - region.base + 1;
@@ -101,32 +101,32 @@ static region_t get_region(frba_t *frba, int region_type)
 	return region;
 }
 
-static void set_region(frba_t *frba, int region_type, region_t region)
+static void set_region(frba_t * frba, int region_type, region_t region)
 {
 	switch (region_type) {
 	case 0:
 		frba->flreg0 = (((region.limit >> 12) & 0x7fff) << 16)
-			| ((region.base >> 12) & 0x7fff);
+		    | ((region.base >> 12) & 0x7fff);
 		break;
 	case 1:
 		frba->flreg1 = (((region.limit >> 12) & 0x7fff) << 16)
-			| ((region.base >> 12) & 0x7fff);
+		    | ((region.base >> 12) & 0x7fff);
 		break;
 	case 2:
 		frba->flreg2 = (((region.limit >> 12) & 0x7fff) << 16)
-			| ((region.base >> 12) & 0x7fff);
+		    | ((region.base >> 12) & 0x7fff);
 		break;
 	case 3:
 		frba->flreg3 = (((region.limit >> 12) & 0x7fff) << 16)
-			| ((region.base >> 12) & 0x7fff);
+		    | ((region.base >> 12) & 0x7fff);
 		break;
 	case 4:
 		frba->flreg4 = (((region.limit >> 12) & 0x7fff) << 16)
-			| ((region.base >> 12) & 0x7fff);
+		    | ((region.base >> 12) & 0x7fff);
 		break;
 	default:
 		fprintf(stderr, "Invalid region type.\n");
-		exit (EXIT_FAILURE);
+		exit(EXIT_FAILURE);
 	}
 }
 
@@ -134,7 +134,7 @@ static const char *region_name(int region_type)
 {
 	if (region_type < 0 || region_type >= NUM_REGIONS) {
 		fprintf(stderr, "Invalid region type.\n");
-		exit (EXIT_FAILURE);
+		exit(EXIT_FAILURE);
 	}
 
 	return region_names[region_type].pretty;
@@ -144,7 +144,7 @@ static const char *region_name_short(int region_type)
 {
 	if (region_type < 0 || region_type >= NUM_REGIONS) {
 		fprintf(stderr, "Invalid region type.\n");
-		exit (EXIT_FAILURE);
+		exit(EXIT_FAILURE);
 	}
 
 	return region_names[region_type].terse;
@@ -176,25 +176,26 @@ static const char *region_filename(int region_type)
 
 	if (region_type < 0 || region_type >= NUM_REGIONS) {
 		fprintf(stderr, "Invalid region type.\n");
-		exit (EXIT_FAILURE);
+		exit(EXIT_FAILURE);
 	}
 
 	return region_filenames[region_type];
 }
 
-static void dump_region(int num, frba_t *frba)
+static void dump_region(int num, frba_t * frba)
 {
 	region_t region = get_region(frba, num);
 	printf("  Flash Region %d (%s): %08x - %08x %s\n",
-		       num, region_name(num), region.base, region.limit,
-		       region.size < 1 ? "(unused)" : "");
+	       num, region_name(num), region.base, region.limit,
+	       region.size < 1 ? "(unused)" : "");
 }
 
-static void dump_region_layout(char *buf, size_t bufsize, int num, frba_t *frba)
+static void dump_region_layout(char *buf, size_t bufsize, int num,
+			       frba_t * frba)
 {
 	region_t region = get_region(frba, num);
 	snprintf(buf, bufsize, "%08x:%08x %s\n",
-		region.base, region.limit, region_name_short(num));
+		 region.base, region.limit, region_name_short(num));
 }
 
 static void dump_frba(frba_t * frba)
@@ -219,7 +220,7 @@ static void dump_frba_layout(frba_t * frba, char *layout_fname)
 	int i;
 
 	int layout_fd = open(layout_fname, O_WRONLY | O_CREAT | O_TRUNC,
-			S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+			     S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 	if (layout_fd == -1) {
 		perror("Could not open file");
 		exit(EXIT_FAILURE);
@@ -284,7 +285,7 @@ static void dump_fcba(fcba_t * fcba)
 	printf("\nFound Component Section\n");
 	printf("FLCOMP     0x%08x\n", fcba->flcomp);
 	printf("  Dual Output Fast Read Support:       %ssupported\n",
-		(fcba->flcomp & (1 << 30))?"":"not ");
+	       (fcba->flcomp & (1 << 30)) ? "" : "not ");
 	printf("  Read ID/Read Status Clock Frequency: ");
 	decode_spi_frequency((fcba->flcomp >> 27) & 7);
 	printf("\n  Write/Erase Clock Frequency:         ");
@@ -292,7 +293,7 @@ static void dump_fcba(fcba_t * fcba)
 	printf("\n  Fast Read Clock Frequency:           ");
 	decode_spi_frequency((fcba->flcomp >> 21) & 7);
 	printf("\n  Fast Read Support:                   %ssupported",
-		(fcba->flcomp & (1 << 20))?"":"not ");
+	       (fcba->flcomp & (1 << 20)) ? "" : "not ");
 	printf("\n  Read Clock Frequency:                ");
 	decode_spi_frequency((fcba->flcomp >> 17) & 7);
 	printf("\n  Component 2 Density:                 ");
@@ -301,17 +302,13 @@ static void dump_fcba(fcba_t * fcba)
 	decode_component_density(fcba->flcomp & 7);
 	printf("\n");
 	printf("FLILL      0x%08x\n", fcba->flill);
-	printf("  Invalid Instruction 3: 0x%02x\n",
-		(fcba->flill >> 24) & 0xff);
-	printf("  Invalid Instruction 2: 0x%02x\n",
-		(fcba->flill >> 16) & 0xff);
-	printf("  Invalid Instruction 1: 0x%02x\n",
-		(fcba->flill >> 8) & 0xff);
-	printf("  Invalid Instruction 0: 0x%02x\n",
-		fcba->flill & 0xff);
+	printf("  Invalid Instruction 3: 0x%02x\n", (fcba->flill >> 24) & 0xff);
+	printf("  Invalid Instruction 2: 0x%02x\n", (fcba->flill >> 16) & 0xff);
+	printf("  Invalid Instruction 1: 0x%02x\n", (fcba->flill >> 8) & 0xff);
+	printf("  Invalid Instruction 0: 0x%02x\n", fcba->flill & 0xff);
 	printf("FLPB       0x%08x\n", fcba->flpb);
 	printf("  Flash Partition Boundary Address: 0x%06x\n\n",
-		(fcba->flpb & 0xfff) << 12);
+	       (fcba->flpb & 0xfff) << 12);
 }
 
 static void dump_fpsba(fpsba_t * fpsba)
@@ -340,29 +337,29 @@ static void dump_fpsba(fpsba_t * fpsba)
 static void decode_flmstr(uint32_t flmstr)
 {
 	printf("  Platform Data Region Write Access: %s\n",
-		(flmstr & (1 << 28)) ? "enabled" : "disabled");
+	       (flmstr & (1 << 28)) ? "enabled" : "disabled");
 	printf("  GbE Region Write Access:           %s\n",
-		(flmstr & (1 << 27)) ? "enabled" : "disabled");
+	       (flmstr & (1 << 27)) ? "enabled" : "disabled");
 	printf("  Intel ME Region Write Access:      %s\n",
-		(flmstr & (1 << 26)) ? "enabled" : "disabled");
+	       (flmstr & (1 << 26)) ? "enabled" : "disabled");
 	printf("  Host CPU/BIOS Region Write Access: %s\n",
-		(flmstr & (1 << 25)) ? "enabled" : "disabled");
+	       (flmstr & (1 << 25)) ? "enabled" : "disabled");
 	printf("  Flash Descriptor Write Access:     %s\n",
-		(flmstr & (1 << 24)) ? "enabled" : "disabled");
+	       (flmstr & (1 << 24)) ? "enabled" : "disabled");
 
 	printf("  Platform Data Region Read Access:  %s\n",
-		(flmstr & (1 << 20)) ? "enabled" : "disabled");
+	       (flmstr & (1 << 20)) ? "enabled" : "disabled");
 	printf("  GbE Region Read Access:            %s\n",
-		(flmstr & (1 << 19)) ? "enabled" : "disabled");
+	       (flmstr & (1 << 19)) ? "enabled" : "disabled");
 	printf("  Intel ME Region Read Access:       %s\n",
-		(flmstr & (1 << 18)) ? "enabled" : "disabled");
+	       (flmstr & (1 << 18)) ? "enabled" : "disabled");
 	printf("  Host CPU/BIOS Region Read Access:  %s\n",
-		(flmstr & (1 << 17)) ? "enabled" : "disabled");
+	       (flmstr & (1 << 17)) ? "enabled" : "disabled");
 	printf("  Flash Descriptor Read Access:      %s\n",
-		(flmstr & (1 << 16)) ? "enabled" : "disabled");
+	       (flmstr & (1 << 16)) ? "enabled" : "disabled");
 
 	printf("  Requester ID:                      0x%04x\n\n",
-		flmstr & 0xffff);
+	       flmstr & 0xffff);
 }
 
 static void dump_fmba(fmba_t * fmba)
@@ -388,23 +385,21 @@ static void dump_fmsba(fmsba_t * fmsba)
 static void dump_jid(uint32_t jid)
 {
 	printf("    SPI Componend Device ID 1:          0x%02x\n",
-		(jid >> 16) & 0xff);
+	       (jid >> 16) & 0xff);
 	printf("    SPI Componend Device ID 0:          0x%02x\n",
-		(jid >> 8) & 0xff);
-	printf("    SPI Componend Vendor ID:            0x%02x\n",
-		jid & 0xff);
+	       (jid >> 8) & 0xff);
+	printf("    SPI Componend Vendor ID:            0x%02x\n", jid & 0xff);
 }
 
 static void dump_vscc(uint32_t vscc)
 {
-	printf("    Lower Erase Opcode:                 0x%02x\n",
-		vscc >> 24);
+	printf("    Lower Erase Opcode:                 0x%02x\n", vscc >> 24);
 	printf("    Lower Write Enable on Write Status: 0x%02x\n",
-		vscc & (1 << 20) ? 0x06 : 0x50);
+	       vscc & (1 << 20) ? 0x06 : 0x50);
 	printf("    Lower Write Status Required:        %s\n",
-		vscc & (1 << 19) ? "Yes" : "No");
+	       vscc & (1 << 19) ? "Yes" : "No");
 	printf("    Lower Write Granularity:            %d bytes\n",
-		vscc & (1 << 18) ? 64 : 1);
+	       vscc & (1 << 18) ? 64 : 1);
 	printf("    Lower Block / Sector Erase Size:    ");
 	switch ((vscc >> 16) & 0x3) {
 	case 0:
@@ -422,13 +417,13 @@ static void dump_vscc(uint32_t vscc)
 	}
 
 	printf("    Upper Erase Opcode:                 0x%02x\n",
-		(vscc >> 8) & 0xff);
+	       (vscc >> 8) & 0xff);
 	printf("    Upper Write Enable on Write Status: 0x%02x\n",
-		vscc & (1 << 4) ? 0x06 : 0x50);
+	       vscc & (1 << 4) ? 0x06 : 0x50);
 	printf("    Upper Write Status Required:        %s\n",
-		vscc & (1 << 3) ? "Yes" : "No");
+	       vscc & (1 << 3) ? "Yes" : "No");
 	printf("    Upper Write Granularity:            %d bytes\n",
-		vscc & (1 << 2) ? 64 : 1);
+	       vscc & (1 << 2) ? 64 : 1);
 	printf("    Upper Block / Sector Erase Size:    ");
 	switch (vscc & 0x3) {
 	case 0:
@@ -446,7 +441,7 @@ static void dump_vscc(uint32_t vscc)
 	}
 }
 
-static void dump_vtba(vtba_t *vtba, int vtl)
+static void dump_vtba(vtba_t * vtba, int vtl)
 {
 	int i;
 	int num = (vtl >> 1) < 8 ? (vtl >> 1) : 8;
@@ -461,17 +456,17 @@ static void dump_vtba(vtba_t *vtba, int vtl)
 	printf("\n");
 }
 
-static void dump_oem(uint8_t *oem)
+static void dump_oem(uint8_t * oem)
 {
 	int i, j;
 	printf("OEM Section:\n");
 	for (i = 0; i < 4; i++) {
 		printf("%02x:", i << 4);
 		for (j = 0; j < 16; j++)
-			printf(" %02x", oem[(i<<4)+j]);
-		printf ("\n");
+			printf(" %02x", oem[(i << 4) + j]);
+		printf("\n");
 	}
-	printf ("\n");
+	printf("\n");
 }
 
 static void dump_fd(char *image, int size)
@@ -498,18 +493,18 @@ static void dump_fd(char *image, int size)
 
 	printf("FLUMAP1:   0x%08x\n", fdb->flumap1);
 	printf("  Intel ME VSCC Table Length (VTL):        %d\n",
-		(fdb->flumap1 >> 8) & 0xff);
+	       (fdb->flumap1 >> 8) & 0xff);
 	printf("  Intel ME VSCC Table Base Address (VTBA): 0x%06x\n\n",
-		(fdb->flumap1 & 0xff) << 4);
+	       (fdb->flumap1 & 0xff) << 4);
 	dump_vtba((vtba_t *)
-			(image + ((fdb->flumap1 & 0xff) << 4)),
-			(fdb->flumap1 >> 8) & 0xff);
-	dump_oem((uint8_t *)image + 0xf00);
+		  (image + ((fdb->flumap1 & 0xff) << 4)),
+		  (fdb->flumap1 >> 8) & 0xff);
+	dump_oem((uint8_t *) image + 0xf00);
 	dump_frba((frba_t *)
-			(image + (((fdb->flmap0 >> 16) & 0xff) << 4)));
+		  (image + (((fdb->flmap0 >> 16) & 0xff) << 4)));
 	dump_fcba((fcba_t *) (image + (((fdb->flmap0) & 0xff) << 4)));
 	dump_fpsba((fpsba_t *)
-			(image + (((fdb->flmap1 >> 16) & 0xff) << 4)));
+		   (image + (((fdb->flmap1 >> 16) & 0xff) << 4)));
 	dump_fmba((fmba_t *) (image + (((fdb->flmap1) & 0xff) << 4)));
 	dump_fmsba((fmsba_t *) (image + (((fdb->flmap2) & 0xff) << 4)));
 }
@@ -521,8 +516,8 @@ static void dump_layout(char *image, int size, char *layout_fname)
 		exit(EXIT_FAILURE);
 
 	dump_frba_layout((frba_t *)
-			(image + (((fdb->flmap0 >> 16) & 0xff) << 4)),
-			layout_fname);
+			 (image + (((fdb->flmap0 >> 16) & 0xff) << 4)),
+			 layout_fname);
 }
 
 static void write_regions(char *image, int size)
@@ -533,8 +528,7 @@ static void write_regions(char *image, int size)
 	if (!fdb)
 		exit(EXIT_FAILURE);
 
-	frba_t *frba =
-	    (frba_t *) (image + (((fdb->flmap0 >> 16) & 0xff) << 4));
+	frba_t *frba = (frba_t *) (image + (((fdb->flmap0 >> 16) & 0xff) << 4));
 
 	for (i = 0; i < NUM_REGIONS; i++) {
 		region_t region = get_region(frba, i);
@@ -542,13 +536,15 @@ static void write_regions(char *image, int size)
 		if (region.size > 0) {
 			int region_fd;
 			region_fd = open(region_filename(i),
-					 O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
+					 O_WRONLY | O_CREAT | O_TRUNC |
+					 O_BINARY,
 					 S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 			if (region_fd < 0) {
 				perror("Error while trying to open file");
 				exit(EXIT_FAILURE);
 			}
-			if (write(region_fd, image + region.base, region.size) != region.size)
+			if (write(region_fd, image + region.base, region.size)
+			    != region.size)
 				perror("Error while writing");
 			close(region_fd);
 		}
@@ -557,7 +553,7 @@ static void write_regions(char *image, int size)
 
 static void write_image(char *filename, char *image, int size)
 {
-	char new_filename[FILENAME_MAX]; // allow long file names
+	char new_filename[FILENAME_MAX];	// allow long file names
 	int new_fd;
 
 	// - 5: leave room for ".new\0"
@@ -568,8 +564,8 @@ static void write_image(char *filename, char *image, int size)
 
 	// Now write out new image
 	new_fd = open(new_filename,
-			 O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
-			 S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+		      O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
+		      S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 	if (new_fd < 0) {
 		perror("Error while trying to open file");
 		exit(EXIT_FAILURE);
@@ -637,13 +633,13 @@ void inject_region(char *filename, char *image, int size, int region_type,
 	fdbar_t *fdb = find_fd(image, size);
 	if (!fdb)
 		exit(EXIT_FAILURE);
-	frba_t *frba =
-	    (frba_t *) (image + (((fdb->flmap0 >> 16) & 0xff) << 4));
+	frba_t *frba = (frba_t *) (image + (((fdb->flmap0 >> 16) & 0xff) << 4));
 
 	region_t region = get_region(frba, region_type);
 	if (region.size <= 0xfff) {
-		fprintf(stderr, "Region %s is disabled in target. Not injecting.\n",
-				region_name(region_type));
+		fprintf(stderr,
+			"Region %s is disabled in target. Not injecting.\n",
+			region_name(region_type));
 		exit(EXIT_FAILURE);
 	}
 
@@ -661,21 +657,21 @@ void inject_region(char *filename, char *image, int size, int region_type,
 
 	printf("File %s is %d bytes\n", region_fname, region_size);
 
-	if ( (region_size > region.size) || ((region_type != 1) &&
-		(region_size > region.size))) {
+	if ((region_size > region.size) || ((region_type != 1) &&
+					    (region_size > region.size))) {
 		fprintf(stderr, "Region %s is %d(0x%x) bytes. File is %d(0x%x)"
-				" bytes. Not injecting.\n",
-				region_name(region_type), region.size,
-				region.size, region_size, region_size);
+			" bytes. Not injecting.\n",
+			region_name(region_type), region.size,
+			region.size, region_size, region_size);
 		exit(EXIT_FAILURE);
 	}
 
 	int offset = 0;
 	if ((region_type == 1) && (region_size < region.size)) {
 		fprintf(stderr, "Region %s is %d(0x%x) bytes. File is %d(0x%x)"
-				" bytes. Padding before injecting.\n",
-				region_name(region_type), region.size,
-				region.size, region_size, region_size);
+			" bytes. Padding before injecting.\n",
+			region_name(region_type), region.size,
+			region.size, region_size, region_size);
 		offset = region.size - region_size;
 		memset(image + region.base, 0xff, offset);
 	}
@@ -687,7 +683,7 @@ void inject_region(char *filename, char *image, int size, int region_type,
 	}
 
 	if (read(region_fd, image + region.base + offset, region_size)
-							!= region_size) {
+	    != region_size) {
 		perror("Could not read file");
 		exit(EXIT_FAILURE);
 	}
@@ -722,8 +718,8 @@ static int regions_collide(region_t r1, region_t r2)
 	if ((r1.size == 0) || (r2.size == 0))
 		return 0;
 
-	if ( ((r1.base >= r2.base) && (r1.base <= r2.limit)) ||
-	     ((r1.limit >= r2.base) && (r1.limit <= r2.limit)) )
+	if (((r1.base >= r2.base) && (r1.base <= r2.limit)) ||
+	    ((r1.limit >= r2.base) && (r1.limit <= r2.limit)))
 		return 1;
 
 	return 0;
@@ -746,8 +742,7 @@ void new_layout(char *filename, char *image, int size, char *layout_fname)
 	if (!fdb)
 		exit(EXIT_FAILURE);
 
-	frba_t *frba =
-	    (frba_t *) (image + (((fdb->flmap0 >> 16) & 0xff) << 4));
+	frba_t *frba = (frba_t *) (image + (((fdb->flmap0 >> 16) & 0xff) << 4));
 
 	for (i = 0; i < NUM_REGIONS; i++) {
 		current_regions[i] = get_region(frba, i);
@@ -766,7 +761,7 @@ void new_layout(char *filename, char *image, int size, char *layout_fname)
 		char *tstr1, *tstr2;
 
 		if (2 != fscanf(romlayout, "%255s %255s\n", tempstr,
-					layout_region_name))
+				layout_region_name))
 			continue;
 
 		region_number = region_num(layout_region_name);
@@ -780,12 +775,12 @@ void new_layout(char *filename, char *image, int size, char *layout_fname)
 			exit(EXIT_FAILURE);
 		}
 		new_regions[region_number].base = strtol(tstr1,
-				(char **)NULL, 16);
+							 (char **)NULL, 16);
 		new_regions[region_number].limit = strtol(tstr2,
-				(char **)NULL, 16);
+							  (char **)NULL, 16);
 		new_regions[region_number].size =
-			new_regions[region_number].limit -
-			new_regions[region_number].base + 1;
+		    new_regions[region_number].limit -
+		    new_regions[region_number].base + 1;
 
 		if (new_regions[region_number].size < 0)
 			new_regions[region_number].size = 0;
@@ -799,7 +794,7 @@ void new_layout(char *filename, char *image, int size, char *layout_fname)
 
 		if (new_regions[i].size < current_regions[i].size) {
 			printf("DANGER: Region %s is shrinking.\n",
-					region_name(i));
+			       region_name(i));
 			printf("    The region will be truncated to fit.\n");
 			printf("    This may result in an unusable image.\n");
 		}
@@ -847,15 +842,14 @@ void new_layout(char *filename, char *image, int size, char *layout_fname)
 		}
 
 		printf("Copy Descriptor %d (%s) (%d bytes)\n", i,
-				region_name(i), copy_size);
+		       region_name(i), copy_size);
 		printf("   from %08x+%08x:%08x (%10d)\n", current.base,
-				offset_current, current.limit, current.size);
+		       offset_current, current.limit, current.size);
 		printf("     to %08x+%08x:%08x (%10d)\n", new.base,
-				offset_new, new.limit, new.size);
+		       offset_new, new.limit, new.size);
 
 		memcpy(new_image + new.base + offset_new,
-				image + current.base + offset_current,
-				copy_size);
+		       image + current.base + offset_current, copy_size);
 	}
 
 	/* update new descriptor regions */
@@ -904,8 +898,7 @@ static void print_usage(const char *name)
 	       "   -u | --unlock                     Unlock firmware descriptor and ME region\n"
 	       "   -v | --version:                   print the version\n"
 	       "   -h | --help:                      print this help\n\n"
-	       "<region> is one of Descriptor, BIOS, ME, GbE, Platform\n"
-	       "\n");
+	       "<region> is one of Descriptor, BIOS, ME, GbE, Platform\n" "\n");
 }
 
 int main(int argc, char *argv[])
@@ -914,7 +907,8 @@ int main(int argc, char *argv[])
 	int mode_dump = 0, mode_extract = 0, mode_inject = 0, mode_spifreq = 0;
 	int mode_em100 = 0, mode_locked = 0, mode_unlocked = 0;
 	int mode_layout = 0, mode_newlayout = 0;
-	char *region_type_string = NULL, *region_fname = NULL, *layout_fname = NULL;
+	char *region_type_string = NULL, *region_fname = NULL, *layout_fname =
+	    NULL;
 	int region_type = -1, inputfreq = 0;
 	enum spi_frequency spifreq = SPI_FREQUENCY_20MHZ;
 
@@ -1017,14 +1011,16 @@ int main(int argc, char *argv[])
 		case 'l':
 			mode_locked = 1;
 			if (mode_unlocked == 1) {
-				fprintf(stderr, "Locking/Unlocking FD and ME are mutually exclusive\n");
+				fprintf(stderr,
+					"Locking/Unlocking FD and ME are mutually exclusive\n");
 				exit(EXIT_FAILURE);
 			}
 			break;
 		case 'u':
 			mode_unlocked = 1;
 			if (mode_locked == 1) {
-				fprintf(stderr, "Locking/Unlocking FD and ME are mutually exclusive\n");
+				fprintf(stderr,
+					"Locking/Unlocking FD and ME are mutually exclusive\n");
 				exit(EXIT_FAILURE);
 			}
 			break;
@@ -1042,8 +1038,8 @@ int main(int argc, char *argv[])
 	}
 
 	if ((mode_dump + mode_layout + mode_extract + mode_inject +
-		mode_newlayout + (mode_spifreq | mode_em100 | mode_unlocked |
-		 mode_locked)) > 1) {
+	     mode_newlayout + (mode_spifreq | mode_em100 | mode_unlocked |
+			       mode_locked)) > 1) {
 		fprintf(stderr, "You may not specify more than one mode.\n\n");
 		print_usage(argv[0]);
 		exit(EXIT_FAILURE);
@@ -1101,8 +1097,7 @@ int main(int argc, char *argv[])
 		write_regions(image, size);
 
 	if (mode_inject)
-		inject_region(filename, image, size, region_type,
-				region_fname);
+		inject_region(filename, image, size, region_type, region_fname);
 
 	if (mode_newlayout)
 		new_layout(filename, image, size, layout_fname);
@@ -1113,7 +1108,7 @@ int main(int argc, char *argv[])
 	if (mode_em100)
 		set_em100_mode(filename, image, size);
 
-	if(mode_locked)
+	if (mode_locked)
 		lock_descriptor(filename, image, size);
 
 	if (mode_unlocked)
diff --git a/util/ifdtool/ifdtool.h b/util/ifdtool/ifdtool.h
index ed8f440..2b27381 100644
--- a/util/ifdtool/ifdtool.h
+++ b/util/ifdtool/ifdtool.h
@@ -30,11 +30,11 @@ enum spi_frequency {
 
 enum component_density {
 	COMPONENT_DENSITY_512KB = 0,
-	COMPONENT_DENSITY_1MB   = 1,
-	COMPONENT_DENSITY_2MB   = 2,
-	COMPONENT_DENSITY_4MB   = 3,
-	COMPONENT_DENSITY_8MB   = 4,
-	COMPONENT_DENSITY_16MB  = 5,
+	COMPONENT_DENSITY_1MB = 1,
+	COMPONENT_DENSITY_2MB = 2,
+	COMPONENT_DENSITY_4MB = 3,
+	COMPONENT_DENSITY_8MB = 4,
+	COMPONENT_DENSITY_16MB = 5,
 };
 
 // flash descriptor
@@ -43,9 +43,9 @@ typedef struct {
 	uint32_t flmap0;
 	uint32_t flmap1;
 	uint32_t flmap2;
-	uint8_t  reserved[0xefc - 0x20];
+	uint8_t reserved[0xefc - 0x20];
 	uint32_t flumap1;
-} __attribute__((packed)) fdbar_t;
+} __attribute__ ((packed)) fdbar_t;
 
 // regions
 typedef struct {
@@ -54,14 +54,14 @@ typedef struct {
 	uint32_t flreg2;
 	uint32_t flreg3;
 	uint32_t flreg4;
-} __attribute__((packed)) frba_t;
+} __attribute__ ((packed)) frba_t;
 
 // component section
 typedef struct {
 	uint32_t flcomp;
 	uint32_t flill;
 	uint32_t flpb;
-} __attribute__((packed)) fcba_t;
+} __attribute__ ((packed)) fcba_t;
 
 // pch strap
 typedef struct {
@@ -83,19 +83,19 @@ typedef struct {
 	uint32_t pchstrp15;
 	uint32_t pchstrp16;
 	uint32_t pchstrp17;
-} __attribute__((packed)) fpsba_t;
+} __attribute__ ((packed)) fpsba_t;
 
 // master
 typedef struct {
 	uint32_t flmstr1;
 	uint32_t flmstr2;
 	uint32_t flmstr3;
-} __attribute__((packed)) fmba_t;
+} __attribute__ ((packed)) fmba_t;
 
 // processor strap
 typedef struct {
 	uint32_t data[8];
-} __attribute__((packed)) fmsba_t;
+} __attribute__ ((packed)) fmsba_t;
 
 // ME VSCC
 typedef struct {



More information about the coreboot-gerrit mailing list