[flashrom] [commit] r1871 - trunk

repository service svn at flashrom.org
Sat Jan 24 16:16:14 CET 2015


Author: stefanct
Date: Sat Jan 24 16:16:14 2015
New Revision: 1871
URL: http://flashrom.org/trac/flashrom/changeset/1871

Log:
Fix the --mainboard parameter that controls board enables.

We refactored board_match_name()/--mainboard handling in r1577 and
apparently broke it because since then we were always comparing to
the respective coreboot values of board and vendor names instead of
the user-supplied strings.

Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner at alumni.tuwien.ac.at>

Modified:
   trunk/board_enable.c

Modified: trunk/board_enable.c
==============================================================================
--- trunk/board_enable.c	Sat Jan 24 16:06:27 2015	(r1870)
+++ trunk/board_enable.c	Sat Jan 24 16:16:14 2015	(r1871)
@@ -2524,20 +2524,24 @@
 
 /*
  * Match boards on vendor and model name.
- * Hint: the parameters can come either from the coreboot table or the command line (i.e. the user).
+ * The string parameters can come either from the coreboot table or the command line (i.e. the user).
+ * The boolean needs to be set accordingly to compare them to the right entries of the board enables table.
  * Require main PCI IDs to match too as extra safety.
- * vendor and model must be non-NULL!
+ * Parameters vendor and model must be non-NULL!
  */
-static const struct board_match *board_match_name(const char *vendor, const char *model)
+static const struct board_match *board_match_name(const char *vendor, const char *model, bool cb)
 {
 	const struct board_match *board = board_matches;
 	const struct board_match *partmatch = NULL;
 
 	for (; board->vendor_name; board++) {
-		if (!board->lb_vendor || strcasecmp(board->lb_vendor, vendor))
+		const char *cur_vendor = cb ? board->lb_vendor : board->vendor_name;
+		const char *cur_model = cb ? board->lb_part : board->board_name;
+
+		if (!cur_vendor || strcasecmp(cur_vendor, vendor))
 			continue;
 
-		if (!board->lb_part || strcasecmp(board->lb_part, model))
+		if (!cur_model || strcasecmp(cur_model, model))
 			continue;
 
 		if (!pci_dev_find(board->first_vendor, board->first_device)) {
@@ -2680,7 +2684,7 @@
 	int ret = 0;
 
 	if (vendor != NULL  && model != NULL) {
-		board = board_match_name(vendor, model);
+		board = board_match_name(vendor, model, false);
 		if (!board) { /* If a board was given by the user it has to match, else we abort here. */
 			msg_perr("No suitable board enable found for vendor=\"%s\", model=\"%s\".\n",
 				 vendor, model);
@@ -2688,7 +2692,7 @@
 		}
 	}
 	if (board == NULL && cb_vendor != NULL && cb_model != NULL) {
-		board = board_match_name(cb_vendor, cb_model);
+		board = board_match_name(cb_vendor, cb_model, true);
 		if (!board) { /* Failure is an option here, because many cb boards don't require an enable. */
 			msg_pdbg2("No board enable found matching coreboot IDs vendor=\"%s\", model=\"%s\".\n",
 				  cb_vendor, cb_model);




More information about the flashrom mailing list