FWU: Add platform hook support for fwu metata
FWU metadata information is unavailable for platform-specific operations since FWU initialization has not yet occurred. The initialization function is invoked as part of the main loop event. To address this, the FWU platform hook function is introduced during FWU initialization, allowing metadata processing with platform-specific operations. Signed-off-by: Padmarao Begari <padmarao.begari@amd.com> Link: https://lore.kernel.org/r/20250912100539.4127378-2-padmarao.begari@amd.com Signed-off-by: Michal Simek <michal.simek@amd.com>
This commit is contained in:
committed by
Michal Simek
parent
9b68682d1c
commit
aa4e7f7083
@@ -128,6 +128,17 @@ int fwu_read_mdata(struct udevice *dev, struct fwu_mdata *mdata,
|
||||
int fwu_write_mdata(struct udevice *dev, struct fwu_mdata *mdata,
|
||||
bool primary, uint32_t size);
|
||||
|
||||
/**
|
||||
* fwu_platform_hook() - Platform specific processing with FWU metadata
|
||||
* @dev: FWU metadata device
|
||||
* @data: FWU metadata
|
||||
*
|
||||
* Provide a platform specific function for processing with the FWU metadata.
|
||||
*
|
||||
* Return: 0 if OK, -ve on error
|
||||
*/
|
||||
int fwu_platform_hook(struct udevice *dev, struct fwu_data *data);
|
||||
|
||||
/**
|
||||
* fwu_get_mdata() - Read, verify and return the FWU metadata
|
||||
*
|
||||
|
||||
@@ -655,6 +655,16 @@ __weak void fwu_plat_get_bootidx(uint *boot_idx)
|
||||
*boot_idx = 0; /* Dummy value */
|
||||
}
|
||||
|
||||
/**
|
||||
* fwu_platform_hook() - Platform specific processing with FWU metadata
|
||||
*
|
||||
* Return: 0 if OK, -ve on error
|
||||
*/
|
||||
__weak int fwu_platform_hook(struct udevice *dev, struct fwu_data *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* fwu_update_checks_pass() - Check if FWU update can be done
|
||||
*
|
||||
@@ -712,6 +722,7 @@ static int fwu_boottime_checks(void)
|
||||
{
|
||||
int ret;
|
||||
u32 boot_idx, active_idx;
|
||||
struct fwu_data *data;
|
||||
|
||||
ret = uclass_first_device_err(UCLASS_FWU_MDATA, &g_dev);
|
||||
if (ret) {
|
||||
@@ -770,6 +781,13 @@ static int fwu_boottime_checks(void)
|
||||
if (!ret)
|
||||
boottime_check = 1;
|
||||
|
||||
data = fwu_get_data();
|
||||
ret = fwu_platform_hook(g_dev, data);
|
||||
if (ret) {
|
||||
log_err("fwu_platform_hook() failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EVENT_SPY_SIMPLE(EVT_MAIN_LOOP, fwu_boottime_checks);
|
||||
|
||||
Reference in New Issue
Block a user