aboutsummaryrefslogtreecommitdiff
path: root/include/fwu.h
diff options
context:
space:
mode:
authorMasami Hiramatsu2023-05-31 00:29:14 -0500
committerTom Rini2023-06-09 13:52:40 -0400
commit4898679e190770ad19917dfc01bc192df0cdfdee (patch)
treec01fb2da03b2ad3790977e1a28aca7bc7f74ef88 /include/fwu.h
parent72168b929e0fb69aa0a133703ad9dee02c7aa561 (diff)
FWU: Add FWU metadata access driver for MTD storage regions
In the FWU Multi Bank Update feature, the information about the updatable images is stored as part of the metadata, on a separate region. Add a driver for reading from and writing to the metadata when the updatable images and the metadata are stored on a raw MTD region. The code is divided into core under drivers/fwu-mdata/ and some helper functions clubbed together under lib/fwu_updates/ Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Diffstat (limited to 'include/fwu.h')
-rw-r--r--include/fwu.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/fwu.h b/include/fwu.h
index 6affb73c4fb..ac5c5de8706 100644
--- a/include/fwu.h
+++ b/include/fwu.h
@@ -8,6 +8,8 @@
#include <blk.h>
#include <efi.h>
+#include <mtd.h>
+#include <uuid.h>
#include <linux/types.h>
@@ -18,6 +20,12 @@ struct fwu_mdata_gpt_blk_priv {
struct udevice *blk_dev;
};
+struct fwu_mtd_image_info {
+ u32 start, size;
+ int bank_num, image_num;
+ char uuidbuf[UUID_STR_LEN + 1];
+};
+
struct fwu_mdata_ops {
/**
* read_mdata() - Populate the asked FWU metadata copy
@@ -251,4 +259,28 @@ u8 fwu_empty_capsule_checks_pass(void);
*/
int fwu_trial_state_ctr_start(void);
+/**
+ * fwu_gen_alt_info_from_mtd() - Parse dfu_alt_info from metadata in mtd
+ * @buf: Buffer into which the dfu_alt_info is filled
+ * @len: Maximum characters that can be written in buf
+ * @mtd: Pointer to underlying MTD device
+ *
+ * Parse dfu_alt_info from metadata in mtd. Used for setting the env.
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int fwu_gen_alt_info_from_mtd(char *buf, size_t len, struct mtd_info *mtd);
+
+/**
+ * fwu_mtd_get_alt_num() - Mapping of fwu_plat_get_alt_num for MTD device
+ * @image_guid: Image GUID for which DFU alt number needs to be retrieved
+ * @alt_num: Pointer to the alt_num
+ * @mtd_dev: Name of mtd device instance
+ *
+ * To map fwu_plat_get_alt_num onto mtd based metadata implementation.
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int fwu_mtd_get_alt_num(efi_guid_t *image_guid, u8 *alt_num, const char *mtd_dev);
+
#endif /* _FWU_H_ */