From 4f806f31fc29b30f06bd13abe44a1d3649d480e5 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 22 Feb 2023 12:17:03 -0700 Subject: bootflow: Rename bootflow_flags_t These flags actually relate to the iterator, not the bootflow struct itself. Rename them. Signed-off-by: Simon Glass --- include/bootflow.h | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'include') diff --git a/include/bootflow.h b/include/bootflow.h index f516bf8dea4..e5fdf5f29d1 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -93,36 +93,36 @@ struct bootflow { }; /** - * enum bootflow_flags_t - flags for the bootflow iterator + * enum bootflow_iter_flags_t - flags for the bootflow iterator * - * @BOOTFLOWF_FIXED: Only used fixed/internal media - * @BOOTFLOWF_SHOW: Show each bootdev before scanning it; show each hunter + * @BOOTFLOWIF_FIXED: Only used fixed/internal media + * @BOOTFLOWIF_SHOW: Show each bootdev before scanning it; show each hunter * before using it - * @BOOTFLOWF_ALL: Return bootflows with errors as well - * @BOOTFLOWF_HUNT: Hunt for new bootdevs using the bootdrv hunters + * @BOOTFLOWIF_ALL: Return bootflows with errors as well + * @BOOTFLOWIF_HUNT: Hunt for new bootdevs using the bootdrv hunters * * Internal flags: - * @BOOTFLOWF_SINGLE_DEV: (internal) Just scan one bootdev - * @BOOTFLOWF_SKIP_GLOBAL: (internal) Don't scan global bootmeths - * @BOOTFLOWF_SINGLE_UCLASS: (internal) Keep scanning through all devices in + * @BOOTFLOWIF_SINGLE_DEV: (internal) Just scan one bootdev + * @BOOTFLOWIF_SKIP_GLOBAL: (internal) Don't scan global bootmeths + * @BOOTFLOWIF_SINGLE_UCLASS: (internal) Keep scanning through all devices in * this uclass (used with things like "mmc") - * @BOOTFLOWF_SINGLE_MEDIA: (internal) Scan one media device in the uclass (used + * @BOOTFLOWIF_SINGLE_MEDIA: (internal) Scan one media device in the uclass (used * with things like "mmc1") */ -enum bootflow_flags_t { - BOOTFLOWF_FIXED = 1 << 0, - BOOTFLOWF_SHOW = 1 << 1, - BOOTFLOWF_ALL = 1 << 2, - BOOTFLOWF_HUNT = 1 << 3, +enum bootflow_iter_flags_t { + BOOTFLOWIF_FIXED = 1 << 0, + BOOTFLOWIF_SHOW = 1 << 1, + BOOTFLOWIF_ALL = 1 << 2, + BOOTFLOWIF_HUNT = 1 << 3, /* * flags used internally by standard boot - do not set these when * calling bootflow_scan_bootdev() etc. */ - BOOTFLOWF_SINGLE_DEV = 1 << 16, - BOOTFLOWF_SKIP_GLOBAL = 1 << 17, - BOOTFLOWF_SINGLE_UCLASS = 1 << 18, - BOOTFLOWF_SINGLE_MEDIA = 1 << 19, + BOOTFLOWIF_SINGLE_DEV = 1 << 16, + BOOTFLOWIF_SKIP_GLOBAL = 1 << 17, + BOOTFLOWIF_SINGLE_UCLASS = 1 << 18, + BOOTFLOWIF_SINGLE_MEDIA = 1 << 19, }; /** @@ -164,9 +164,9 @@ enum bootflow_meth_flags_t { * updated to a larger value, no less than the number of available partitions. * This ensures that iteration works through all partitions on the bootdev. * - * @flags: Flags to use (see enum bootflow_flags_t). If BOOTFLOWF_GLOBAL_FIRST is - * enabled then the global bootmeths are being scanned, otherwise we have - * moved onto the bootdevs + * @flags: Flags to use (see enum bootflow_iter_flags_t). If + * BOOTFLOWIF_GLOBAL_FIRST is enabled then the global bootmeths are being + * scanned, otherwise we have moved onto the bootdevs * @dev: Current bootdev, NULL if none. This is only ever updated in * bootflow_iter_set_dev() * @part: Current partition number (0 for whole device) @@ -233,7 +233,7 @@ void bootflow_init(struct bootflow *bflow, struct udevice *bootdev, * This sets everything to the starting point, ready for use. * * @iter: Place to store private info (inited by this call) - * @flags: Flags to use (see enum bootflow_flags_t) + * @flags: Flags to use (see enum bootflow_iter_flags_t) */ void bootflow_iter_init(struct bootflow_iter *iter, int flags); @@ -259,15 +259,16 @@ int bootflow_iter_drop_bootmeth(struct bootflow_iter *iter, /** * bootflow_scan_first() - find the first bootflow for a device or label * - * If @flags includes BOOTFLOWF_ALL then bootflows with errors are returned too + * If @flags includes BOOTFLOWIF_ALL then bootflows with errors are returned too * * @dev: Boot device to scan, NULL to work through all of them until it * finds one that can supply a bootflow * @label: Label to control the scan, NULL to work through all devices * until it finds one that can supply a bootflow * @iter: Place to store private info (inited by this call) - * @flags: Flags for iterator (enum bootflow_flags_t). Note that if @dev - * is NULL, then BOOTFLOWF_SKIP_GLOBAL is set automatically by this function + * @flags: Flags for iterator (enum bootflow_iter_flags_t). Note that if + * @dev is NULL, then BOOTFLOWIF_SKIP_GLOBAL is set automatically by this + * function * @bflow: Place to put the bootflow if found * Return: 0 if found, -ENODEV if no device, other -ve on other error * (iteration can continue) -- cgit v1.2.3 From 47dd6b4d7daba06a04bb612d0c19e350e6287fac Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 22 Feb 2023 12:17:04 -0700 Subject: bootstd: Replicate the dtb-filename quirks of distroboot For EFI, the distro boot scripts search in three different directories for the .dtb file. The SOC-based filename fallback is supported only for 32-bit ARM. Adjust the code to mirror this behaviour. Also some boards can use a prior-stage FDT if one is not found in the normal way. Support this and show a message in that case. Signed-off-by: Simon Glass Suggested-by: Mark Kettenis --- include/bootflow.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include') diff --git a/include/bootflow.h b/include/bootflow.h index e5fdf5f29d1..f20f575030f 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -36,6 +36,18 @@ enum bootflow_state_t { BOOTFLOWST_COUNT }; +/** + * enum bootflow_flags_t - flags for bootflows + * + * @BOOTFLOWF_USE_PRIOR_FDT: Indicates that an FDT was not found by the bootmeth + * and it is using the prior-stage FDT, which is the U-Boot control FDT. + * This is only possible with the EFI bootmeth (distro-efi) and only when + * CONFIG_OF_HAS_PRIOR_STAGE is enabled + */ +enum bootflow_flags_t { + BOOTFLOWF_USE_PRIOR_FDT = 1 << 0, +}; + /** * struct bootflow - information about a bootflow * @@ -68,6 +80,7 @@ enum bootflow_state_t { * @fdt_fname: Filename of FDT file * @fdt_size: Size of FDT file * @fdt_addr: Address of loaded fdt + * @flags: Flags for the bootflow (see enum bootflow_flags_t) */ struct bootflow { struct list_head bm_node; @@ -90,6 +103,7 @@ struct bootflow { char *fdt_fname; int fdt_size; ulong fdt_addr; + int flags; }; /** -- cgit v1.2.3 From 8f4c9993c05d22ec5ba86c9fb8526ea65b847281 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Thu, 2 Mar 2023 04:08:24 +0100 Subject: test: Add ut_assert_nextline_empty() empty line helper Add helper macro to test for empty lines, which is an inobvious wrapper around ut_assert_nextline("%s", "") . Signed-off-by: Marek Vasut Reviewed-by: Simon Glass --- include/test/ut.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/test/ut.h b/include/test/ut.h index 4d00b4eeca1..2b0dab32f68 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -334,6 +334,10 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); return CMD_RET_FAILURE; \ } \ +/* Assert that the next console output line is empty */ +#define ut_assert_nextline_empty() \ + ut_assert_nextline("%s", "") + /** * ut_check_free() - Return the number of bytes free in the malloc() pool * -- cgit v1.2.3