1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-10-04 08:51:43 +02:00

drivers: fwu: add the size parameter to the metadata access API's

In version 2 of the metadata structure, the size of the structure
cannot be determined statically at build time. The structure is now
broken into the top level structure which contains a field indicating
the total size of the structure.

Add a size parameter to the metadata access API functions to indicate
the number of bytes to be accessed. This is then used to either read
the entire structure, or only the top level structure.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Tested-by: Michal Simek <michal.simek@amd.com>
This commit is contained in:
Sughosh Ganu
2024-03-22 16:27:16 +05:30
committed by Tom Rini
parent d99127a69e
commit f42a61f57f
4 changed files with 35 additions and 22 deletions

View File

@@ -20,7 +20,8 @@
*
* Return: 0 if OK, -ve on error
*/
int fwu_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary)
int fwu_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary,
uint32_t size)
{
const struct fwu_mdata_ops *ops = device_get_ops(dev);
@@ -29,7 +30,7 @@ int fwu_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary)
return -ENOSYS;
}
return ops->read_mdata(dev, mdata, primary);
return ops->read_mdata(dev, mdata, primary, size);
}
/**
@@ -37,7 +38,8 @@ int fwu_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary)
*
* Return: 0 if OK, -ve on error
*/
int fwu_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary)
int fwu_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary,
uint32_t size)
{
const struct fwu_mdata_ops *ops = device_get_ops(dev);
@@ -46,7 +48,7 @@ int fwu_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary)
return -ENOSYS;
}
return ops->write_mdata(dev, mdata, primary);
return ops->write_mdata(dev, mdata, primary, size);
}
UCLASS_DRIVER(fwu_mdata) = {