mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
bloblist: Support initing from multiple places
Typically the bloblist is set up after the devicetree is present. This makes sense because bloblist may use malloc() to allocate the space it needs. However sometimes the devicetree itself may be present in the bloblist. In that case it is at a known location in memory so we can init the bloblist very early, before devicetree. Add a flag to indicate whether the bloblist has been inited. Add a function to init it only if needed. Use that in the init sequence. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
ff6c708b99
commit
3d6531803e
4 changed files with 35 additions and 4 deletions
|
@ -476,6 +476,17 @@ int bloblist_init(void)
|
||||||
log_debug("Found existing bloblist size %lx at %lx\n", size,
|
log_debug("Found existing bloblist size %lx at %lx\n", size,
|
||||||
addr);
|
addr);
|
||||||
}
|
}
|
||||||
|
if (ret)
|
||||||
|
return log_msg_ret("ini", ret);
|
||||||
|
gd->flags |= GD_FLG_BLOBLIST_READY;
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bloblist_maybe_init(void)
|
||||||
|
{
|
||||||
|
if (CONFIG_IS_ENABLED(BLOBLIST) && !(gd->flags & GD_FLG_BLOBLIST_READY))
|
||||||
|
return bloblist_init();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -841,9 +841,7 @@ static const init_fnc_t init_sequence_f[] = {
|
||||||
log_init,
|
log_init,
|
||||||
initf_bootstage, /* uses its own timer, so does not need DM */
|
initf_bootstage, /* uses its own timer, so does not need DM */
|
||||||
event_init,
|
event_init,
|
||||||
#ifdef CONFIG_BLOBLIST
|
bloblist_maybe_init,
|
||||||
bloblist_init,
|
|
||||||
#endif
|
|
||||||
setup_spl_handoff,
|
setup_spl_handoff,
|
||||||
#if defined(CONFIG_CONSOLE_RECORD_INIT_F)
|
#if defined(CONFIG_CONSOLE_RECORD_INIT_F)
|
||||||
console_record_init,
|
console_record_init,
|
||||||
|
|
|
@ -693,6 +693,10 @@ enum gd_flags {
|
||||||
* the memory used to holds its tables has been mapped out.
|
* the memory used to holds its tables has been mapped out.
|
||||||
*/
|
*/
|
||||||
GD_FLG_DM_DEAD = 0x400000,
|
GD_FLG_DM_DEAD = 0x400000,
|
||||||
|
/**
|
||||||
|
* @GD_FLG_BLOBLIST_READY: bloblist is ready for use
|
||||||
|
*/
|
||||||
|
GD_FLG_BLOBLIST_READY = 0x800000,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
|
@ -413,8 +413,26 @@ void bloblist_reloc(void *to, uint to_size, void *from, uint from_size);
|
||||||
* standard passage. The size is detected automatically so CONFIG_BLOBLIST_SIZE
|
* standard passage. The size is detected automatically so CONFIG_BLOBLIST_SIZE
|
||||||
* can be 0.
|
* can be 0.
|
||||||
*
|
*
|
||||||
|
* Sets GD_FLG_BLOBLIST_READY in global_data flags on success
|
||||||
|
*
|
||||||
* Return: 0 if OK, -ve on error
|
* Return: 0 if OK, -ve on error
|
||||||
*/
|
*/
|
||||||
int bloblist_init(void);
|
int bloblist_init(void);
|
||||||
|
|
||||||
|
#if CONFIG_IS_ENABLED(BLOBLIST)
|
||||||
|
/**
|
||||||
|
* bloblist_maybe_init() - Init the bloblist system if not already done
|
||||||
|
*
|
||||||
|
* Calls bloblist_init() if the GD_FLG_BLOBLIST_READY flag is not et
|
||||||
|
*
|
||||||
|
* Return: 0 if OK, -ve on error
|
||||||
|
*/
|
||||||
|
int bloblist_maybe_init(void);
|
||||||
|
#else
|
||||||
|
static inline int bloblist_maybe_init(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* BLOBLIST */
|
||||||
|
|
||||||
#endif /* __BLOBLIST_H */
|
#endif /* __BLOBLIST_H */
|
||||||
|
|
Loading…
Reference in a new issue