diff options
author | Simon Glass <sjg@chromium.org> | 2023-08-10 19:33:18 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2023-08-11 07:33:38 -0600 |
commit | c279224ea6686a992b258b01e07fcadb7f0c7ecb (patch) | |
tree | 48273b66cf481b328b6a8871e14cafaedaf87123 /include | |
parent | cbb607d2d9be44a5ded7a652e8e7646925adc1e0 (diff) |
bootstd: Add a command to read all files for a bootflow
Some bootflows (such as EFI and ChromiumOS) delay reading the kernel until
it is needed to boot. This saves time when scanning and avoids needing to
allocate memory for something that may never be used.
To permit reading of these files, add a new 'bootflow read' command.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/bootflow.h | 11 | ||||
-rw-r--r-- | include/bootmeth.h | 25 |
2 files changed, 35 insertions, 1 deletions
diff --git a/include/bootflow.h b/include/bootflow.h index fdcfeddc1a..44d3741eac 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -353,6 +353,17 @@ void bootflow_free(struct bootflow *bflow); int bootflow_boot(struct bootflow *bflow); /** + * bootflow_read_all() - Read all bootflow files + * + * Some bootmeths delay reading of large files until booting is requested. This + * causes those files to be read. + * + * @bflow: Bootflow to read + * Return: result of trying to read + */ +int bootflow_read_all(struct bootflow *bflow); + +/** * bootflow_run_boot() - Try to boot a bootflow * * @iter: Current iteration (or NULL if none). Used to disable a bootmeth if the diff --git a/include/bootmeth.h b/include/bootmeth.h index 7cb7da33de..d3d8d608cd 100644 --- a/include/bootmeth.h +++ b/include/bootmeth.h @@ -119,7 +119,16 @@ struct bootmeth_ops { */ int (*read_file)(struct udevice *dev, struct bootflow *bflow, const char *file_path, ulong addr, ulong *sizep); - +#if CONFIG_IS_ENABLED(BOOTSTD_FULL) + /** + * readall() - read all files for a bootflow + * + * @dev: Bootmethod device to boot + * @bflow: Bootflow to read + * Return: 0 if OK, -EIO on I/O error, other -ve on other error + */ + int (*read_all)(struct udevice *dev, struct bootflow *bflow); +#endif /* BOOTSTD_FULL */ /** * boot() - boot a bootflow * @@ -224,6 +233,20 @@ int bootmeth_read_file(struct udevice *dev, struct bootflow *bflow, const char *file_path, ulong addr, ulong *sizep); /** + * bootmeth_read_all() - read all bootflow files + * + * Some bootmeths delay reading of large files until booting is requested. This + * causes those files to be read. + * + * @dev: Bootmethod device to use + * @bflow: Bootflow to read + * Return: does not return on success, since it should boot the + * Operating Systemn. Returns -EFAULT if that fails, other -ve on + * other error + */ +int bootmeth_read_all(struct udevice *dev, struct bootflow *bflow); + +/** * bootmeth_boot() - boot a bootflow * * @dev: Bootmethod device to boot |