From a7e0548cea45ec60616936c536efbb2a34605093 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Wed, 9 May 2007 10:17:44 +0000 Subject: Fix coding style of flashrom by running indent on all files indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs *.[ch] Some minor fixups were required, and maybe a few more cosmetic changes are needed. Corresponding to flashrom svn r108 and coreboot v2 svn r2643. Signed-off-by: Uwe Hermann Acked-by: Uwe Hermann --- layout.c | 136 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 68 insertions(+), 68 deletions(-) (limited to 'layout.c') diff --git a/layout.c b/layout.c index 8ba2e4153..6dbbd9c0d 100644 --- a/layout.c +++ b/layout.c @@ -6,9 +6,9 @@ #include "lbtable.h" #include "debug.h" -char * mainboard_vendor=NULL; -char * mainboard_part=NULL; -int romimages=0; +char *mainboard_vendor = NULL; +char *mainboard_part = NULL; +int romimages = 0; extern int force; @@ -25,131 +25,132 @@ romlayout_t rom_entries[MAX_ROMLAYOUT]; static char *def_name = "DEFAULT"; - int show_id(uint8_t *bios, int size) { unsigned int *walk; + walk = (unsigned int *)(bios + size - 0x10); + walk--; - walk=(unsigned int *)(bios+size-0x10); - walk--; - - if((*walk)==0 || ((*walk)&0x3ff) != 0) { + if ((*walk) == 0 || ((*walk) & 0x3ff) != 0) { /* We might have an Nvidia chipset bios * which stores the id information at a * different location. */ - walk=(unsigned int *)(bios+size-0x80); - walk--; + walk = (unsigned int *)(bios + size - 0x80); + walk--; } - - if((*walk)==0 || ((*walk)&0x3ff) != 0) { + + if ((*walk) == 0 || ((*walk) & 0x3ff) != 0) { printf("Flash image seems to be a legacy BIOS. Disabling checks.\n"); - mainboard_vendor=def_name; - mainboard_part=def_name; + mainboard_vendor = def_name; + mainboard_part = def_name; return 0; } - + printf_debug("LinuxBIOS last image size " "(not rom size) is %d bytes.\n", *walk); - - walk--; mainboard_part=strdup((const char *)(bios+size-*walk)); - walk--; mainboard_vendor=strdup((const char *)(bios+size-*walk)); + + walk--; + mainboard_part = strdup((const char *)(bios + size - *walk)); + walk--; + mainboard_vendor = strdup((const char *)(bios + size - *walk)); printf_debug("MANUFACTURER: %s\n", mainboard_vendor); printf_debug("MAINBOARD ID: %s\n", mainboard_part); - /* * If lb_vendor is not set, the linuxbios table was * not found. Nor was -mVENDOR:PART specified */ - if(!lb_vendor || !lb_part) { + if (!lb_vendor || !lb_part) { printf("Note: If the following flash access fails, " - "you might need to specify -m :\n"); + "you might need to specify -m :\n"); return 0; } - + /* These comparisons are case insensitive to make things * a little less user^Werror prone. */ - if(!strcasecmp(mainboard_vendor, lb_vendor) && - !strcasecmp(mainboard_part, lb_part)) { + if (!strcasecmp(mainboard_vendor, lb_vendor) && + !strcasecmp(mainboard_part, lb_part)) { printf_debug("This firmware image matches " "this motherboard.\n"); } else { - if(force) { + if (force) { printf("WARNING: This firmware image does not " - "seem to fit to this machine - forcing it.\n"); + "seem to fit to this machine - forcing it.\n"); } else { printf("ERROR: Your firmware image (%s:%s) does not " - "appear to\n be correct for the detected " - "mainboard (%s:%s)\n\nOverride with --force if you " - "are absolutely sure that you\nare using a correct " - "image for this mainboard or override\nthe detected " - "values with --mainboard :.\n\n", - mainboard_vendor, mainboard_part, lb_vendor, lb_part); + "appear to\n be correct for the detected " + "mainboard (%s:%s)\n\nOverride with --force if you " + "are absolutely sure that you\nare using a correct " + "image for this mainboard or override\nthe detected " + "values with --mainboard :.\n\n", + mainboard_vendor, mainboard_part, lb_vendor, + lb_part); exit(1); } } - + return 0; } -int read_romlayout(char *name) +int read_romlayout(char *name) { FILE *romlayout; char tempstr[256]; int i; - romlayout=fopen (name, "r"); - - if(!romlayout) { - fprintf(stderr, "ERROR: Could not open rom layout (%s).\n", - name); + romlayout = fopen(name, "r"); + + if (!romlayout) { + fprintf(stderr, "ERROR: Could not open rom layout (%s).\n", + name); return -1; } - - while(!feof(romlayout)) { + + while (!feof(romlayout)) { char *tstr1, *tstr2; - fscanf(romlayout,"%s %s\n", tempstr, rom_entries[romimages].name); + fscanf(romlayout, "%s %s\n", tempstr, + rom_entries[romimages].name); #if 0 // fscanf does not like arbitrary comments like that :( later - if (tempstr[0]=='#') { + if (tempstr[0] == '#') { continue; } #endif - tstr1=strtok(tempstr,":"); - tstr2=strtok(NULL,":"); - rom_entries[romimages].start=strtol(tstr1, (char **)NULL, 16); - rom_entries[romimages].end=strtol(tstr2, (char **)NULL, 16); - rom_entries[romimages].included=0; + tstr1 = strtok(tempstr, ":"); + tstr2 = strtok(NULL, ":"); + rom_entries[romimages].start = strtol(tstr1, (char **)NULL, 16); + rom_entries[romimages].end = strtol(tstr2, (char **)NULL, 16); + rom_entries[romimages].included = 0; romimages++; } - - for(i=0; i