diff options
Diffstat (limited to 'include/fwu.h')
-rw-r--r-- | include/fwu.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/include/fwu.h b/include/fwu.h index 0919ced812c..e3bede18433 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -25,6 +25,26 @@ struct fwu_mdata_gpt_blk_priv { */ struct fwu_mdata_ops { /** + * read_mdata() - Populate the asked FWU metadata copy + * @dev: FWU metadata device + * @mdata: Output FWU mdata read + * @primary: If primary or secondary copy of metadata is to be read + * + * Return: 0 if OK, -ve on error + */ + int (*read_mdata)(struct udevice *dev, struct fwu_mdata *mdata, bool primary); + + /** + * write_mdata() - Write the given FWU metadata copy + * @dev: FWU metadata device + * @mdata: Copy of the FWU metadata to write + * @primary: If primary or secondary copy of metadata is to be written + * + * Return: 0 if OK, -ve on error + */ + int (*write_mdata)(struct udevice *dev, struct fwu_mdata *mdata, bool primary); + + /** * check_mdata() - Check if the FWU metadata is valid * @dev: FWU device * @@ -127,6 +147,27 @@ struct fwu_mdata_ops { 0xe1, 0xfc, 0xed, 0xf1, 0xc6, 0xf8) /** + * fwu_read_mdata() - Wrapper around fwu_mdata_ops.read_mdata() + */ +int fwu_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary); + +/** + * fwu_write_mdata() - Wrapper around fwu_mdata_ops.write_mdata() + */ +int fwu_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary); + +/** + * fwu_get_verified_mdata() - Read, verify and return the FWU metadata + * + * Read both the metadata copies from the storage media, verify their checksum, + * and ascertain that both copies match. If one of the copies has gone bad, + * restore it from the good copy. + * + * Return: 0 if OK, -ve on error + */ +int fwu_get_verified_mdata(struct fwu_mdata *mdata); + +/** * fwu_check_mdata_validity() - Check for validity of the FWU metadata copies * * Read both the metadata copies from the storage media, verify their |