summaryrefslogtreecommitdiff
path: root/src/lib/fit.c
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2020-05-21 10:39:58 -0700
committerJulius Werner <jwerner@chromium.org>2020-05-29 20:47:54 +0000
commit11217de375598c7a6f6288d0bc04dec115e41df5 (patch)
tree5dd1fd8566739e93af194ee23e60c47d00cb63de /src/lib/fit.c
parentc3063c556702defc0401d7d82280ee20af8300d0 (diff)
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 <jwerner@chromium.org> Change-Id: Ia3cf7cbb165170e2ab0bba633fec01f9f509b874 Reviewed-on: https://review.coreboot.org/c/coreboot/+/41633 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'src/lib/fit.c')
-rw-r--r--src/lib/fit.c12
1 files 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);
}