From 6a6638f0939dca65c7d1cd0d766957d3d3adc519 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 17 Jan 2023 10:47:15 -0700 Subject: bootstd: Remove special-case code for boot_targets Rather than implement this as its own case in build_order(), process the boot_targets environment variable in the bootstd_get_bootdev_order() function. This allows build_order() to be simplified. Signed-off-by: Simon Glass --- include/bootstd.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'include/bootstd.h') diff --git a/include/bootstd.h b/include/bootstd.h index 4fa0d531001..bd305094fdc 100644 --- a/include/bootstd.h +++ b/include/bootstd.h @@ -22,7 +22,10 @@ struct udevice; * @prefixes: NULL-terminated list of prefixes to use for bootflow filenames, * e.g. "/", "/boot/"; NULL if none * @bootdev_order: Order to use for bootdevs (or NULL if none), with each item - * being a bootdev label, e.g. "mmc2", "mmc1"; + * being a bootdev label, e.g. "mmc2", "mmc1" (NULL terminated) + * @env_order: Order as specified by the boot_targets env var (or NULL if none), + * with each item being a bootdev label, e.g. "mmc2", "mmc1" (NULL + * terminated) * @cur_bootdev: Currently selected bootdev (for commands) * @cur_bootflow: Currently selected bootflow (for commands) * @glob_head: Head for the global list of all bootflows across all bootdevs @@ -34,6 +37,7 @@ struct udevice; struct bootstd_priv { const char **prefixes; const char **bootdev_order; + const char **env_order; struct udevice *cur_bootdev; struct bootflow *cur_bootflow; struct list_head glob_head; @@ -51,9 +55,13 @@ struct bootstd_priv { * The list is alloced by the bootstd driver so should not be freed. That is the * reason for all the const stuff in the function signature * - * Return: list of string points, terminated by NULL; or NULL if no boot order + * @dev: bootstd device + * @okp: returns true if OK, false if out of memory + * Return: list of string pointers, terminated by NULL; or NULL if no boot + * order. Note that this returns NULL in the case of an empty list */ -const char *const *const bootstd_get_bootdev_order(struct udevice *dev); +const char *const *const bootstd_get_bootdev_order(struct udevice *dev, + bool *okp); /** * bootstd_get_prefixes() - Get the filename-prefixes list -- cgit v1.2.3 From bd90b092882099afa3786829036c82d6a4241fc8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 17 Jan 2023 10:47:33 -0700 Subject: bootstd: Add the concept of a bootdev hunter Some bootdevs must be enumerated before they appear. For example, USB bootdevs are not visible until USB is enumerated. With standard boot this needs to happen automatically, since we only want to enumerate a bus if it is needed. Add a way to define bootdev 'hunters' which can be used to hunt for bootdevs of a given type. Track which ones have been used and add a command to list them. Include a clang work-around which seems to be needed. Signed-off-by: Simon Glass --- include/bootstd.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/bootstd.h') diff --git a/include/bootstd.h b/include/bootstd.h index bd305094fdc..dddb3e15384 100644 --- a/include/bootstd.h +++ b/include/bootstd.h @@ -33,6 +33,8 @@ struct udevice; * @bootmeth_order: List of bootmeth devices to use, in order, NULL-terminated * @vbe_bootmeth: Currently selected VBE bootmeth, NULL if none * @theme: Node containing the theme information + * @hunters_used: Bitmask of used hunters, indexed by their position in the + * linker list. The bit is set if the hunter has been used already */ struct bootstd_priv { const char **prefixes; @@ -45,6 +47,7 @@ struct bootstd_priv { struct udevice **bootmeth_order; struct udevice *vbe_bootmeth; ofnode theme; + uint hunters_used; }; /** -- cgit v1.2.3