From 11217de375598c7a6f6288d0bc04dec115e41df5 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Thu, 21 May 2020 10:39:58 -0700 Subject: fit: Swap compat matching priorities for board-revX and board-skuY Matching the same behavior change in depthcharge's FIT image code (CL:2212466), this patch changes the order in which compat strings involving revision and SKU numbers are matched when looking for a compatible device tree. The most precise match (board-revX-skuY) is still the highest priority, but after that we will now first check for revision only (board-revX) and then for SKU only (board-skuY). The reason for this is that SKU differentiation is often added later to a project, so device trees for earlier revisions may not have SKU numbers defined. So if we have a rev0 board (with sku0 as the "default SKU", because the board only started having different SKUs with rev1) we want it to match the board-rev0 device tree, not board-sku0 which was added as an alias to board-rev1-sku0 to provide the best known default for potential later revisions of that SKU. Signed-off-by: Julius Werner Change-Id: Ia3cf7cbb165170e2ab0bba633fec01f9f509b874 Reviewed-on: https://review.coreboot.org/c/coreboot/+/41633 Tested-by: build bot (Jenkins) Reviewed-by: Hung-Te Lin --- src/lib/fit.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/fit.c b/src/lib/fit.c index 90cbfcacee..748cd611a4 100644 --- a/src/lib/fit.c +++ b/src/lib/fit.c @@ -50,18 +50,18 @@ static void fit_add_default_compat_strings(void) fit_add_compat_string(compat_string); } - if (sku_id() != UNDEFINED_STRAPPING_ID) { - snprintf(compat_string, sizeof(compat_string), "%s,%s-sku%u", + if (board_id() != UNDEFINED_STRAPPING_ID) { + snprintf(compat_string, sizeof(compat_string), "%s,%s-rev%u", CONFIG_MAINBOARD_VENDOR, CONFIG_MAINBOARD_PART_NUMBER, - sku_id()); + board_id()); fit_add_compat_string(compat_string); } - if (board_id() != UNDEFINED_STRAPPING_ID) { - snprintf(compat_string, sizeof(compat_string), "%s,%s-rev%u", + if (sku_id() != UNDEFINED_STRAPPING_ID) { + snprintf(compat_string, sizeof(compat_string), "%s,%s-sku%u", CONFIG_MAINBOARD_VENDOR, CONFIG_MAINBOARD_PART_NUMBER, - board_id()); + sku_id()); fit_add_compat_string(compat_string); } -- cgit v1.2.3