initcall: Support manual relocation
Move the manual-relocation code to the initcall file. Make sure to avoid manually relocating event types. Only true function pointers should be relocated. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -813,10 +813,8 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
|
|||||||
#endif
|
#endif
|
||||||
gd->flags &= ~GD_FLG_LOG_READY;
|
gd->flags &= ~GD_FLG_LOG_READY;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) {
|
if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC))
|
||||||
for (int i = 0; i < ARRAY_SIZE(init_sequence_r); i++)
|
initcall_manual_reloc(init_sequence_r);
|
||||||
MANUAL_RELOC(init_sequence_r[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (initcall_run_list(init_sequence_r))
|
if (initcall_run_list(init_sequence_r))
|
||||||
hang();
|
hang();
|
||||||
|
@@ -35,4 +35,11 @@ typedef int (*init_fnc_t)(void);
|
|||||||
*/
|
*/
|
||||||
int initcall_run_list(const init_fnc_t init_sequence[]);
|
int initcall_run_list(const init_fnc_t init_sequence[]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* initcall_manual_reloc() - Do manual relocation on an initcall sequence
|
||||||
|
*
|
||||||
|
* @init_sequence: NULL-terminated init sequence to relocate
|
||||||
|
*/
|
||||||
|
void initcall_manual_reloc(init_fnc_t init_sequence[]);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -97,3 +97,13 @@ int initcall_run_list(const init_fnc_t init_sequence[])
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void initcall_manual_reloc(init_fnc_t init_sequence[])
|
||||||
|
{
|
||||||
|
init_fnc_t *ptr;
|
||||||
|
|
||||||
|
for (ptr = init_sequence; *ptr; ptr++) {
|
||||||
|
if (!initcall_is_event(*ptr))
|
||||||
|
MANUAL_RELOC(*ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user