aboutsummaryrefslogtreecommitdiff
path: root/include/fwu.h
diff options
context:
space:
mode:
authorSughosh Ganu2024-03-22 16:27:21 +0530
committerTom Rini2024-05-24 13:40:04 -0600
commitac62e0b62e02be0bb8c5f0d0dd49fa9bda91d5c5 (patch)
treec6417ca97e421819ae35ecec17cbf95039028992 /include/fwu.h
parentfba5b3fa7c473fb356ce206ad2dbfe1c3917edfa (diff)
fwu: make changes to access version agnostic structure fields
With addition of support for version 2 of the FWU metadata structure, the metadata information is collected into a version agnostic structure. Make changes to the FWU functions so that the information that was earlier obtained by reading the metadata structure is now obtained through this version agnostic structure. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Tested-by: Michal Simek <michal.simek@amd.com>
Diffstat (limited to 'include/fwu.h')
-rw-r--r--include/fwu.h49
1 files changed, 48 insertions, 1 deletions
diff --git a/include/fwu.h b/include/fwu.h
index 082b5481d1e..77ec65e6180 100644
--- a/include/fwu.h
+++ b/include/fwu.h
@@ -79,9 +79,18 @@ struct fwu_mdata_ops {
bool primary, uint32_t size);
};
-#define FWU_MDATA_VERSION 0x1
#define FWU_IMAGE_ACCEPTED 0x1
+#define FWU_BANK_INVALID (uint8_t)0xFF
+#define FWU_BANK_VALID (uint8_t)0xFE
+#define FWU_BANK_ACCEPTED (uint8_t)0xFC
+
+enum {
+ PRIMARY_PART = 1,
+ SECONDARY_PART,
+ BOTH_PARTS,
+};
+
/*
* GUID value defined in the FWU specification for identification
* of the FWU metadata partition.
@@ -314,6 +323,44 @@ int fwu_gen_alt_info_from_mtd(char *buf, size_t len, struct mtd_info *mtd);
int fwu_mtd_get_alt_num(efi_guid_t *image_guid, u8 *alt_num, const char *mtd_dev);
/**
+ * fwu_mdata_copies_allocate() - Allocate memory for metadata
+ * @mdata_size: Size of the metadata structure
+ *
+ * Allocate memory for storing both the copies of the FWU metadata. The
+ * copies are then used as a cache for storing FWU metadata contents.
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int fwu_mdata_copies_allocate(u32 mdata_size);
+
+/**
+ * fwu_get_dev() - Return the FWU metadata device
+ *
+ * Return the pointer to the FWU metadata device.
+ *
+ * Return: Pointer to the FWU metadata dev
+ */
+struct udevice *fwu_get_dev(void);
+
+/**
+ * fwu_get_data() - Return the version agnostic FWU structure
+ *
+ * Return the pointer to the version agnostic FWU structure.
+ *
+ * Return: Pointer to the FWU data structure
+ */
+struct fwu_data *fwu_get_data(void);
+
+/**
+ * fwu_sync_mdata() - Update given meta-data partition(s) with the copy provided
+ * @data: FWU Data structure
+ * @part: Bitmask of FWU metadata partitions to be written to
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int fwu_sync_mdata(struct fwu_mdata *mdata, int part);
+
+/**
* fwu_populate_mdata_image_info() - Populate the image information
* of the metadata
* @data: Version agnostic FWU metadata information