cbfs: Add a function to wait for all CBFS preload operations to complete
Introduce cbfs_preload_wait_for_all() to guarantee that all CBFS preload contexts complete their tasks before moving forward. This function goes through each preload context and waits for the corresponding thread to finish by using thread_join(). If any preload thread runs into an issue, it records an error message along with the context name. This addition provides a synchronization point during the boot process which platform code can leverage, typically when the storage backend supporting asynchronous file transfer is about to be deactivated. Change-Id: I3ee27ef2fbfdc19bd75532713966f333ad975861 Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/88457 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
a7710ed8fd
commit
3b069d320c
2 changed files with 10 additions and 0 deletions
|
|
@ -126,6 +126,8 @@ static inline void *cbfs_unverified_area_cbmem_alloc(const char *area, const cha
|
|||
* method succeeds or fails.
|
||||
*/
|
||||
void cbfs_preload(const char *name);
|
||||
/* Wait for all preloaded CBFS contexts to complete their operations. */
|
||||
void cbfs_preload_wait_for_all(void);
|
||||
|
||||
/* Removes a previously allocated CBFS mapping. Should try to unmap mappings in strict LIFO
|
||||
order where possible, since mapping backends often don't support more complicated cases. */
|
||||
|
|
|
|||
|
|
@ -376,6 +376,14 @@ out:
|
|||
free_cbfs_preload_context(context);
|
||||
}
|
||||
|
||||
void cbfs_preload_wait_for_all(void)
|
||||
{
|
||||
struct cbfs_preload_context *context;
|
||||
|
||||
list_for_each(context, cbfs_preload_context_list, list_node)
|
||||
thread_join(&context->handle);
|
||||
}
|
||||
|
||||
static struct cbfs_preload_context *find_cbfs_preload_context(const char *name)
|
||||
{
|
||||
struct cbfs_preload_context *context;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue