diff options
| author | Jassi Brar <[email protected]> | 2023-03-06 17:18:28 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2023-06-09 13:49:55 -0400 |
| commit | 167994f295e29de417bdb7b05e02fe5fd9b0d054 (patch) | |
| tree | e9b37032867069a33c68f418207c96a9f90e2dd0 /drivers | |
| 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 <[email protected]>
Reviewed-by: Ilias Apalodimas <[email protected]>
Tested-by: Sughosh Ganu <[email protected]>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/fwu-mdata/fwu-mdata-uclass.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/fwu-mdata/fwu-mdata-uclass.c b/drivers/fwu-mdata/fwu-mdata-uclass.c index b477e9603fb..e03773c584a 100644 --- a/drivers/fwu-mdata/fwu-mdata-uclass.c +++ b/drivers/fwu-mdata/fwu-mdata-uclass.c @@ -17,6 +17,40 @@ #include <u-boot/crc.h> /** + * fwu_read_mdata() - Wrapper around fwu_mdata_ops.read_mdata() + * + * Return: 0 if OK, -ve on error + */ +int fwu_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary) +{ + const struct fwu_mdata_ops *ops = device_get_ops(dev); + + if (!ops->read_mdata) { + log_debug("read_mdata() method not defined\n"); + return -ENOSYS; + } + + return ops->read_mdata(dev, mdata, primary); +} + +/** + * fwu_write_mdata() - Wrapper around fwu_mdata_ops.write_mdata() + * + * Return: 0 if OK, -ve on error + */ +int fwu_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary) +{ + const struct fwu_mdata_ops *ops = device_get_ops(dev); + + if (!ops->write_mdata) { + log_debug("write_mdata() method not defined\n"); + return -ENOSYS; + } + + return ops->write_mdata(dev, mdata, primary); +} + +/** * fwu_get_mdata_part_num() - Get the FWU metadata partition numbers * @dev: FWU metadata device * @mdata_parts: array for storing the metadata partition numbers |
