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.
Corresponding to flashrom svn r1871.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
diff --git a/board_enable.c b/board_enable.c
index 966c490..456e206 100644
--- a/board_enable.c
+++ b/board_enable.c
@@ -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);