1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Standard U-Boot boot framework
5 * Copyright 2021 Google LLC
12 #include <dm/ofnode_decl.h>
13 #include <linux/list.h>
14 #include <linux/types.h>
19 * struct bootstd_priv - priv data for the bootstd driver
21 * This is attached to the (only) bootstd device, so there is only one instance
22 * of this struct. It provides overall information about bootdevs and bootflows.
24 * @prefixes: NULL-terminated list of prefixes to use for bootflow filenames,
25 * e.g. "/", "/boot/"; NULL if none
26 * @bootdev_order: Order to use for bootdevs (or NULL if none), with each item
27 * being a bootdev label, e.g. "mmc2", "mmc1" (NULL terminated)
28 * @env_order: Order as specified by the boot_targets env var (or NULL if none),
29 * with each item being a bootdev label, e.g. "mmc2", "mmc1" (NULL
31 * @cur_bootdev: Currently selected bootdev (for commands)
32 * @cur_bootflow: Currently selected bootflow (for commands)
33 * @glob_head: Head for the global list of all bootflows across all bootdevs
34 * @bootmeth_count: Number of bootmeth devices in @bootmeth_order
35 * @bootmeth_order: List of bootmeth devices to use, in order, NULL-terminated
36 * @vbe_bootmeth: Currently selected VBE bootmeth, NULL if none
37 * @theme: Node containing the theme information
38 * @hunters_used: Bitmask of used hunters, indexed by their position in the
39 * linker list. The bit is set if the hunter has been used already
42 const char **prefixes;
43 const char **bootdev_order;
44 const char **env_order;
45 struct udevice *cur_bootdev;
46 struct bootflow *cur_bootflow;
47 struct list_head glob_head;
49 struct udevice **bootmeth_order;
50 struct udevice *vbe_bootmeth;
56 * bootstd_get_bootdev_order() - Get the boot-order list
58 * This reads the boot order, e.g. {"mmc0", "mmc2", NULL}
60 * The list is alloced by the bootstd driver so should not be freed. That is the
61 * reason for all the const stuff in the function signature
63 * @dev: bootstd device
64 * @okp: returns true if OK, false if out of memory
65 * Return: list of string pointers, terminated by NULL; or NULL if no boot
66 * order. Note that this returns NULL in the case of an empty list
68 const char *const *const bootstd_get_bootdev_order(struct udevice *dev,
72 * bootstd_get_prefixes() - Get the filename-prefixes list
74 * This reads the prefixes, e.g. {"/", "/boot", NULL}
76 * The list is alloced by the bootstd driver so should not be freed. That is the
77 * reason for all the const stuff in the function signature
79 * Return: list of string points, terminated by NULL; or NULL if no boot order
81 const char *const *const bootstd_get_prefixes(struct udevice *dev);
84 * bootstd_get_priv() - Get the (single) state for the bootstd system
86 * The state holds a global list of all bootflows that have been found.
88 * Return: 0 if OK, -ve if the uclass does not exist
90 int bootstd_get_priv(struct bootstd_priv **stdp);
93 * bootstd_clear_glob() - Clear the global list of bootflows
95 * This removes all bootflows globally and across all bootdevs.
97 void bootstd_clear_glob(void);
100 * bootstd_prog_boot() - Run standard boot in a fully programmatic mode
102 * Attempts to boot without making any use of U-Boot commands
104 * Returns: -ve error value (does not return except on failure to boot)
106 int bootstd_prog_boot(void);