aboutsummaryrefslogtreecommitdiff
path: root/include/bootmeth.h
diff options
context:
space:
mode:
authorSimon Glass2023-01-17 10:48:01 -0700
committerTom Rini2023-01-23 18:11:41 -0500
commit22061d3d2ad10e1c67e36282a8c97f505a62c252 (patch)
treed46f11617a3b8ef265937b9c74c33f451046b6c2 /include/bootmeth.h
parent74ebfb60f6890ab46d5233d13941ff9d6eea2312 (diff)
bootstd: Add a new bootmeth method to set the bootflow
Normally the bootmeth driver reads the bootflow from the bootdev, since it knows the correct way to do it. However it is easier for some bootdevs to handle this themselves. For example, reading from SPI flash is quite different from other devices. Add a way for the bootdev to pass a bootflow to the bootmeth, so that this can be supported. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/bootmeth.h')
-rw-r--r--include/bootmeth.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/bootmeth.h b/include/bootmeth.h
index bdce301e925..b12dfd42c90 100644
--- a/include/bootmeth.h
+++ b/include/bootmeth.h
@@ -88,6 +88,22 @@ struct bootmeth_ops {
int (*read_bootflow)(struct udevice *dev, struct bootflow *bflow);
/**
+ * set_bootflow() - set the bootflow for a device
+ *
+ * This provides a bootflow file to the bootmeth, to see if it is valid.
+ * If it is, the bootflow is set up accordingly.
+ *
+ * @dev: Bootmethod device to use
+ * @bflow: On entry, provides bootdev.
+ * Returns updated bootflow if found
+ * @buf: Buffer containing the possible bootflow file
+ * @size: Size of file
+ * Return: 0 if OK, -ve on error
+ */
+ int (*set_bootflow)(struct udevice *dev, struct bootflow *bflow,
+ char *buf, int size);
+
+ /**
* read_file() - read a file needed for a bootflow
*
* Read a file from the same place as the bootflow came from
@@ -174,6 +190,23 @@ int bootmeth_check(struct udevice *dev, struct bootflow_iter *iter);
int bootmeth_read_bootflow(struct udevice *dev, struct bootflow *bflow);
/**
+ * bootmeth_set_bootflow() - set the bootflow for a device
+ *
+ * This provides a bootflow file to the bootmeth, to see if it is valid.
+ * If it is, the bootflow is set up accordingly.
+ *
+ * @dev: Bootmethod device to use
+ * @bflow: On entry, provides bootdev.
+ * Returns updated bootflow if found
+ * @buf: Buffer containing the possible bootflow file (must be allocated
+ * by caller to @size + 1 bytes)
+ * @size: Size of file
+ * Return: 0 if OK, -ve on error
+ */
+int bootmeth_set_bootflow(struct udevice *dev, struct bootflow *bflow,
+ char *buf, int size);
+
+/**
* bootmeth_read_file() - read a file needed for a bootflow
*
* Read a file from the same place as the bootflow came from