From: Simon Glass <sjg@chromium.org> Add a bootmeth_id field to struct bootflow that bootmeths can use to store an identifier for this bootflow, e.g. an alist index for the PXE context used during scanning. Initialise it to -1 (not set) in bootflow_init(). Signed-off-by: Simon Glass <sjg@chromium.org> --- boot/bootflow.c | 1 + doc/develop/bootstd/overview.rst | 5 ++++- include/bootflow.h | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/boot/bootflow.c b/boot/bootflow.c index d6549b5ce9a..dbda50b8231 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -712,6 +712,7 @@ void bootflow_init(struct bootflow *bflow, struct udevice *bootdev, bflow->dev = bootdev; bflow->method = meth; bflow->state = BOOTFLOWST_BASE; + bflow->bootmeth_id = -1; alist_init_struct(&bflow->images, struct bootflow_img); } diff --git a/doc/develop/bootstd/overview.rst b/doc/develop/bootstd/overview.rst index 0ff4868ba44..049aec56931 100644 --- a/doc/develop/bootstd/overview.rst +++ b/doc/develop/bootstd/overview.rst @@ -853,7 +853,10 @@ Each bootdev device has its own `struct bootdev_uc_plat` which holds a list of scanned bootflows just for that device. The bootflow itself is documented in bootflow_h_. It includes various bits of -information about the bootflow and a buffer to hold the file. +information about the bootflow and a buffer to hold the file. The ``bootmeth_id`` +field allows a bootmeth to associate an identifier with each bootflow, such as +an index into a list of parsed configurations. It is initialised to -1 (not +set) and its interpretation is up to the bootmeth. The ``bootmeth_priv`` field allows a bootmeth to attach private data to each bootflow, such as parsed configuration state. When the bootflow is freed, diff --git a/include/bootflow.h b/include/bootflow.h index 65aebefd3b3..dbdbca96596 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -101,6 +101,9 @@ enum bootflow_flags_t { * @bootmeth_priv: Private data for the bootmeth (allocated). Freed by * bootmeth_free_bootflow() which calls the bootmeth's free_bootflow() op * for internal cleanup, then frees the pointer itself. + * @bootmeth_id: Bootmeth-specific identifier for this bootflow, e.g. an + * alist index for the PXE context used during scanning. Interpretation + * is up to the bootmeth. * @images: List of loaded images (struct bootstd_img) */ struct bootflow { @@ -127,6 +130,7 @@ struct bootflow { char *cmdline; void *x86_setup; void *bootmeth_priv; + int bootmeth_id; struct alist images; }; -- 2.43.0