diff options
author | Michal Simek <michal.simek@amd.com> | 2023-01-06 09:38:52 +0100 |
---|---|---|
committer | Michal Simek <michal.simek@amd.com> | 2023-01-18 12:17:47 +0100 |
commit | 8174cd21163a4bc1095a50b6ac1a08a37f366c92 (patch) | |
tree | e376d2eadea197eab285ccad3756be793847c8b9 | |
parent | 724379d9afc850de2767094987a761f096af7718 (diff) | |
download | u-boot-8174cd21163a4bc1095a50b6ac1a08a37f366c92.tar.gz |
xilinx: common: Add support for partial string match in board_fit_config_name_match()
Board name in FIT image can use U-Boot regular expressions SLRE to instruct
U-Boot to handle all revisions for certain board.
For example when name (description property) is saying "zynqmp-zcu104-revA"
only description with this name is selected.
When zynqmp-zcu104.* is described then all board revisions will be handled
by this fragment.
Xilinx normally have some board revisions which are SW compatible to each
other. That's why make sense to define board name with revisions first
follow by generic description with '.*' at the end like this:
config_1 {
description = "zynqmp-zcu104-rev[AB]";
fdt = "zynqmp-zcu104-revA";
};
config_2 {
description = "zynqmp-zcu104.*";
fdt = "zynqmp-zcu104-revC";
};
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/d67683a3c5d0435a5070e622f7a9a38e19c64cf5.1672994329.git.michal.simek@amd.com
-rw-r--r-- | board/xilinx/common/board.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 59d87f2352..823d703ea9 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -1,7 +1,9 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * (C) Copyright 2014 - 2020 Xilinx, Inc. - * Michal Simek <michal.simek@xilinx.com> + * (C) Copyright 2014 - 2022, Xilinx, Inc. + * (C) Copyright 2022 - 2023, Advanced Micro Devices, Inc. + * + * Michal Simek <michal.simek@amd.com> */ #include <common.h> @@ -22,6 +24,7 @@ #include <i2c_eeprom.h> #include <net.h> #include <generated/dt.h> +#include <slre.h> #include <soc.h> #include <linux/ctype.h> #include <linux/kernel.h> @@ -468,6 +471,21 @@ int __maybe_unused board_fit_config_name_match(const char *name) { debug("%s: Check %s, default %s\n", __func__, name, board_name); +#if !defined(CONFIG_SPL_BUILD) + if (CONFIG_IS_ENABLED(REGEX)) { + struct slre slre; + int ret; + + ret = slre_compile(&slre, name); + if (ret) { + ret = slre_match(&slre, board_name, strlen(board_name), + NULL); + debug("%s: name match ret = %d\n", __func__, ret); + return !ret; + } + } +#endif + if (!strcmp(name, board_name)) return 0; |