aboutsummaryrefslogtreecommitdiffstats
path: root/board_enable.c
diff options
context:
space:
mode:
authorPeter Stuge <peter@stuge.se>2008-01-27 16:21:21 +0000
committerPeter Stuge <peter@stuge.se>2008-01-27 16:21:21 +0000
commit6b53fed02d38d7d7a53afeac540d1c7e8ace4ec3 (patch)
treef93b1a792eec2ea04d1196a725fa4cbd796a7918 /board_enable.c
parent79fd6d21d2d41c74e03973a6be6851e9086de7eb (diff)
downloadflashrom-6b53fed02d38d7d7a53afeac540d1c7e8ace4ec3.tar.gz
flashrom-6b53fed02d38d7d7a53afeac540d1c7e8ace4ec3.tar.bz2
flashrom-6b53fed02d38d7d7a53afeac540d1c7e8ace4ec3.zip
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. Corresponding to flashrom svn r190 and coreboot v2 svn r3082. Signed-off-by: Peter Stuge <peter@stuge.se> Acked-by: Stefan Reinauer <stepan@coresystems.de>
Diffstat (limited to 'board_enable.c')
-rw-r--r--board_enable.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/board_enable.c b/board_enable.c
index 27f431f5..e23b9ead 100644
--- a/board_enable.c
+++ b/board_enable.c
@@ -413,9 +413,10 @@ struct board_pciid_enable board_pciid_enables[] = {
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 @@ static struct board_pciid_enable *board_match_coreboot_name(const char *vendor,
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 @@ int board_flash_enable(const char *vendor, const char *part)
struct board_pciid_enable *board = NULL;
int ret = 0;
- if (vendor && part)
+ if (part)
board = board_match_coreboot_name(vendor, part);
if (!board)