summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2022-07-30 15:52:19 -0600
committerTom Rini <[email protected]>2022-08-12 08:14:24 -0400
commit988cacaeedae920c13741c9ab2fc580f63a06c3a (patch)
tree5b2d7bc4a9a821179fd89658252469405f0cc747 /include
parent10d16faa436c9f06bbcdeb6da35871a1b329b6b0 (diff)
bootstd: Provide a bootmeth method to obtain state info
Some bootmeths can provide information about what is available to boot. For example, VBE simple provides access to the firmware state. Add a new method for this, along with a sandbox test. Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/bootmeth.h38
1 files changed, 37 insertions, 1 deletions
diff --git a/include/bootmeth.h b/include/bootmeth.h
index 484e503e338..4967031a0a8 100644
--- a/include/bootmeth.h
+++ b/include/bootmeth.h
@@ -24,7 +24,25 @@ struct bootmeth_uc_plat {
/** struct bootmeth_ops - Operations for boot methods */
struct bootmeth_ops {
/**
- * check_supported() - check if a bootmeth supports this bootflow
+ * get_state_desc() - get detailed state information
+ *
+ * Prodecues a textual description of the state of the bootmeth. This
+ * can include newline characters if it extends to multiple lines. It
+ * must be a nul-terminated string.
+ *
+ * This may involve reading state from the system, e.g. some data in
+ * the firmware area.
+ *
+ * @dev: Bootmethod device to check
+ * @buf: Buffer to place the info in (terminator must fit)
+ * @maxsize: Size of buffer
+ * Returns: 0 if OK, -ENOSPC is buffer is too small, other -ve error if
+ * something else went wrong
+ */
+ int (*get_state_desc)(struct udevice *dev, char *buf, int maxsize);
+
+ /**
+ * check_supported() - check if a bootmeth supports this bootdev
*
* This is optional. If not provided, the bootdev is assumed to be
* supported
@@ -92,6 +110,24 @@ struct bootmeth_ops {
#define bootmeth_get_ops(dev) ((struct bootmeth_ops *)(dev)->driver->ops)
/**
+ * bootmeth_get_state_desc() - get detailed state information
+ *
+ * Prodecues a textual description of the state of the bootmeth. This
+ * can include newline characters if it extends to multiple lines. It
+ * must be a nul-terminated string.
+ *
+ * This may involve reading state from the system, e.g. some data in
+ * the firmware area.
+ *
+ * @dev: Bootmethod device to check
+ * @buf: Buffer to place the info in (terminator must fit)
+ * @maxsize: Size of buffer
+ * Returns: 0 if OK, -ENOSPC is buffer is too small, other -ve error if
+ * something else went wrong
+ */
+int bootmeth_get_state_desc(struct udevice *dev, char *buf, int maxsize);
+
+/**
* bootmeth_check() - check if a bootmeth supports this bootflow
*
* This is optional. If not provided, the bootdev is assumed to be