bootstd: Allow bootmeths to be marked as global

The current way of handling things like EFI bootmgr is a bit odd, since
that bootmeth handles selection of the bootdev itself. VBE needs to work
the same way, so we should support it properly.

Add a flag that indicates that the bootmeth is global, rather than being
invoked on each bootdev. Provide a helper to read a bootflow from the
bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2022-07-30 15:52:21 -06:00
committed by Tom Rini
parent a18686cda1
commit bc06aa035d
6 changed files with 50 additions and 2 deletions

View File

@@ -12,13 +12,24 @@ struct bootflow;
struct bootflow_iter;
struct udevice;
/**
* enum bootmeth_flags - Flags for bootmeths
*
* @BOOTMETHF_GLOBAL: bootmeth handles bootdev selection automatically
*/
enum bootmeth_flags {
BOOTMETHF_GLOBAL = BIT(0),
};
/**
* struct bootmeth_uc_plat - information the uclass keeps about each bootmeth
*
* @desc: A long description of the bootmeth
* @flags: Flags for this bootmeth (enum bootmeth_flags)
*/
struct bootmeth_uc_plat {
const char *desc;
int flags;
};
/** struct bootmeth_ops - Operations for boot methods */
@@ -267,4 +278,16 @@ int bootmeth_alloc_file(struct bootflow *bflow, uint size_limit, uint align);
int bootmeth_common_read_file(struct udevice *dev, struct bootflow *bflow,
const char *file_path, ulong addr, ulong *sizep);
/**
* bootmeth_get_bootflow() - Get a bootflow from a global bootmeth
*
* Check the bootmeth for a bootflow which can be used. In this case the
* bootmeth handles all bootdev selection, etc.
*
* @dev: bootmeth device to read from
* @bflow: Bootflow information
* @return 0 on success, -ve if a bootflow could not be found or had an error
*/
int bootmeth_get_bootflow(struct udevice *dev, struct bootflow *bflow);
#endif