diff options
author | Jassi Brar | 2023-03-06 17:18:28 -0600 |
---|---|---|
committer | Tom Rini | 2023-06-09 13:49:55 -0400 |
commit | 167994f295e29de417bdb7b05e02fe5fd9b0d054 (patch) | |
tree | e9b37032867069a33c68f418207c96a9f90e2dd0 /include/fwu.h | |
parent | b042c705548da5a78f4144071a88083be60d331d (diff) |
fwu: move meta-data management in core
Instead of each i/f having to implement their own meta-data verification
and storage, move the logic in common code. This simplifies the i/f code
much simpler and compact.
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Sughosh Ganu <sughosh.ganu@linaro.org>
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 |