[coreboot] r3082 - trunk/util/flashrom

svn at coreboot.org svn at coreboot.org
Sun Jan 27 17:21:21 CET 2008


Author: stuge
Date: 2008-01-27 17:21:21 +0100 (Sun, 27 Jan 2008)
New Revision: 3082

Modified:
   trunk/util/flashrom/README
   trunk/util/flashrom/board_enable.c
   trunk/util/flashrom/flashrom.8
   trunk/util/flashrom/flashrom.c
Log:
Make the vendor name optional in the -m flashrom parameter when there's only
one board name that matches. The full syntax still works, and is required
when two vendors have boards with the same names.

Signed-off-by: Peter Stuge <peter at stuge.se>
Acked-by: Stefan Reinauer <stepan at coresystems.de>


Modified: trunk/util/flashrom/README
===================================================================
--- trunk/util/flashrom/README	2008-01-27 14:12:54 UTC (rev 3081)
+++ trunk/util/flashrom/README	2008-01-27 16:21:21 UTC (rev 3082)
@@ -23,20 +23,20 @@
 -----
 
  $ flashrom [-rwvEVfh] [-c chipname] [-s exclude_start] [-e exclude_end]
-            [-m vendor:part] [-l file.layout] [-i imagename] [file]
-   -r | --read:                    read flash and save into file
-   -w | --write:                   write file into flash (default when
-                                   file is specified)
-   -v | --verify:                  verify flash against file
-   -E | --erase:                   erase flash device
-   -V | --verbose:                 more verbose output
-   -c | --chip <chipname>:         probe only for specified flash chip
-   -s | --estart <addr>:           exclude start position
-   -e | --eend <addr>:             exclude end postion
-   -m | --mainboard <vendor:part>: override mainboard settings
-   -f | --force:                   force write without checking image
-   -l | --layout <file.layout>:    read rom layout from file
-   -i | --image <name>:            only flash image name from flash layout
+            [-m [vendor:]part] [-l file.layout] [-i imagename] [file]
+   -r | --read:                      read flash and save into file
+   -w | --write:                     write file into flash (default when
+                                     file is specified)
+   -v | --verify:                    verify flash against file
+   -E | --erase:                     erase flash device
+   -V | --verbose:                   more verbose output
+   -c | --chip <chipname>:           probe only for specified flash chip
+   -s | --estart <addr>:             exclude start position
+   -e | --eend <addr>:               exclude end postion
+   -m | --mainboard <[vendor:]part>: override mainboard settings
+   -f | --force:                     force write without checking image
+   -l | --layout <file.layout>:      read rom layout from file
+   -i | --image <name>:              only flash image name from flash layout
 
  If no file is specified, then all that happens
  is that flash info is dumped and the flash chip is set to writable.

Modified: trunk/util/flashrom/board_enable.c
===================================================================
--- trunk/util/flashrom/board_enable.c	2008-01-27 14:12:54 UTC (rev 3081)
+++ trunk/util/flashrom/board_enable.c	2008-01-27 16:21:21 UTC (rev 3082)
@@ -413,9 +413,10 @@
 static struct board_pciid_enable *board_match_coreboot_name(const char *vendor, const char *part)
 {
 	struct board_pciid_enable *board = board_pciid_enables;
+	struct board_pciid_enable *partmatch = NULL;
 
 	for (; board->name; board++) {
-		if (!board->lb_vendor || strcmp(board->lb_vendor, vendor))
+		if (vendor && (!board->lb_vendor || strcmp(board->lb_vendor, vendor)))
 			continue;
 
 		if (!board->lb_part || strcmp(board->lb_part, part))
@@ -427,9 +428,24 @@
 		if (board->second_vendor &&
 			!pci_dev_find(board->second_vendor, board->second_device))
 			continue;
-		return board;
+
+		if (vendor)
+			return board;
+
+		if (partmatch) {
+			/* a second entry has a matching part name */
+			printf("AMBIGUOUS BOARD NAME: %s\n", part);
+			printf("At least vendors '%s' and '%s' match.\n",
+				partmatch->lb_vendor, board->lb_vendor);
+			printf("Please use the full -m vendor:part syntax.\n");
+			return NULL;
+		}
+		partmatch = board;
 	}
 
+	if (partmatch)
+		return partmatch;
+
 	printf("NOT FOUND %s:%s\n", vendor, part);
 
 	return NULL;
@@ -477,7 +493,7 @@
 	struct board_pciid_enable *board = NULL;
 	int ret = 0;
 
-	if (vendor && part)
+	if (part)
 		board = board_match_coreboot_name(vendor, part);
 
 	if (!board)

Modified: trunk/util/flashrom/flashrom.8
===================================================================
--- trunk/util/flashrom/flashrom.8	2008-01-27 14:12:54 UTC (rev 3081)
+++ trunk/util/flashrom/flashrom.8	2008-01-27 16:21:21 UTC (rev 3082)
@@ -40,11 +40,11 @@
 .B "\-e, \-\-eend" <addr> 
 Exclude end postion (obsolete).
 .TP
-.B "\-m, \-\-mainboard" <vendor:part>
+.B "\-m, \-\-mainboard" <[vendor:]part>
 Override mainboard settings. This option is needed for some mainboards,
 see the
 .B flashrom
-README for a list.
+README for a list. The vendor is not required when the board name is unique.
 .TP
 .B "\-f, \-\-force"
 Force write without checking whether the ROM image file is really meant

Modified: trunk/util/flashrom/flashrom.c
===================================================================
--- trunk/util/flashrom/flashrom.c	2008-01-27 14:12:54 UTC (rev 3081)
+++ trunk/util/flashrom/flashrom.c	2008-01-27 16:21:21 UTC (rev 3082)
@@ -196,21 +196,21 @@
 void usage(const char *name)
 {
 	printf("usage: %s [-rwvEVfhR] [-c chipname] [-s exclude_start]\n", name);
-	printf("       [-e exclude_end] [-m vendor:part] [-l file.layout] [-i imagename] [file]\n");
+	printf("       [-e exclude_end] [-m [vendor:]part] [-l file.layout] [-i imagename] [file]\n");
 	printf
-	    ("   -r | --read:                    read flash and save into file\n"
-	     "   -w | --write:                   write file into flash\n"
-	     "   -v | --verify:                  verify flash against file\n"
-	     "   -E | --erase:                   erase flash device\n"
-	     "   -V | --verbose:                 more verbose output\n"
-	     "   -c | --chip <chipname>:         probe only for specified flash chip\n"
-	     "   -s | --estart <addr>:           exclude start position\n"
-	     "   -e | --eend <addr>:             exclude end postion\n"
-	     "   -m | --mainboard <vendor:part>: override mainboard settings\n"
-	     "   -f | --force:                   force write without checking image\n"
-	     "   -l | --layout <file.layout>:    read rom layout from file\n"
-	     "   -i | --image <name>:            only flash image name from flash layout\n"
-	     "   -R | --version:                 print the version (release)\n"
+	    ("   -r | --read:                      read flash and save into file\n"
+	     "   -w | --write:                     write file into flash\n"
+	     "   -v | --verify:                    verify flash against file\n"
+	     "   -E | --erase:                     erase flash device\n"
+	     "   -V | --verbose:                   more verbose output\n"
+	     "   -c | --chip <chipname>:           probe only for specified flash chip\n"
+	     "   -s | --estart <addr>:             exclude start position\n"
+	     "   -e | --eend <addr>:               exclude end postion\n"
+	     "   -m | --mainboard <[vendor:]part>: override mainboard settings\n"
+	     "   -f | --force:                     force write without checking image\n"
+	     "   -l | --layout <file.layout>:      read rom layout from file\n"
+	     "   -i | --image <name>:              only flash image name from flash layout\n"
+	     "   -R | --version:                   print the version (release)\n"
             "\n" " If no file is specified, then all that happens"
 	     " is that flash info is dumped.\n\n");
 	exit(1);
@@ -301,8 +301,8 @@
 				lb_vendor = tempstr;
 				lb_part = tempstr2;
 			} else {
-				printf("warning: ignored wrong format of"
-				       " mainboard: %s\n", tempstr);
+				lb_vendor = NULL;
+				lb_part = tempstr;
 			}
 			break;
 		case 'f':





More information about the coreboot mailing list