diff mbox series

[v3,08/22] bootm: Create a struct for argument information

Message ID 20231216031446.2222362-4-sjg@chromium.org
State Accepted
Commit c49216253d4357500a96b849bc3a02896093a9a9
Delegated to: Tom Rini
Headers show
Series Complete decoupling of bootm logic from commands | expand

Commit Message

Simon Glass Dec. 16, 2023, 3:14 a.m. UTC
Some OS functions require the arguments to the 'bootm' command. This is
inconvenient for two reasons.

Firstly, there may not be any actual command, if CMDLINE is not enabled
and programmatic boot is being used.

Secondly, most functions don't require the arguments, so it is
inefficient to pass them when not needed. For example it increases code
size.

Create a new struct which holds the arguments, which can be used if
needed.

Add the images pointer as well, since this is commonly needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
---

(no changes since v2)

Changes in v2:
- Split addition of struct bootm_info to its own patch

 include/bootm.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/include/bootm.h b/include/bootm.h
index f5229ea90b33..a6d5d5ceee8f 100644
--- a/include/bootm.h
+++ b/include/bootm.h
@@ -16,6 +16,20 @@  struct cmd_tbl;
 #define BOOTM_ERR_OVERLAP		(-2)
 #define BOOTM_ERR_UNIMPLEMENTED	(-3)
 
+/**
+ * struct bootm_info() - information used when processing images to boot
+ *
+ * @images: images information
+ * @argc: Number of arguments to the command (excluding the actual command).
+ *	This is 0 if there are no arguments
+ * @argv: NULL-terminated list of arguments, or NULL if there are no arguments
+ */
+struct bootm_info {
+	struct bootm_headers *images;
+	int argc;
+	char *const *argv;
+};
+
 /*
  *  Continue booting an OS image; caller already has:
  *  - copied image header to global variable `header'
@@ -39,7 +53,7 @@  typedef int boot_os_fn(int flag, int argc, char *const argv[],
 extern boot_os_fn do_bootm_linux;
 extern boot_os_fn do_bootm_vxworks;
 
-int do_bootelf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_bootelf(struct cmd_tbl *cmdtp, int fglag, int argc, char *const argv[]);
 
 boot_os_fn *bootm_os_get_boot_func(int os);