From: Ovidiu Panait Date: Sun, 15 May 2022 18:40:29 +0000 (+0300) Subject: event: fix static events for CONFIG_NEEDS_MANUAL_RELOC X-Git-Tag: v2022.10~89^2~25^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cebc8161708e357758c407eaa79a8cd66ee68fde;p=platform%2Fkernel%2Fu-boot.git event: fix static events for CONFIG_NEEDS_MANUAL_RELOC Static events do not currently work post-relocation for boards that enable CONFIG_NEEDS_MANUAL_RELOC. Relocate event handler pointers for all event spies to fix this. Tested on Microblaze. Signed-off-by: Ovidiu Panait --- diff --git a/common/board_r.c b/common/board_r.c index 22b5dea..4e3cf1f 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -612,6 +612,9 @@ static init_fnc_t init_sequence_r[] = { */ #endif initr_reloc_global_data, +#if CONFIG_IS_ENABLED(NEEDS_MANUAL_RELOC) && CONFIG_IS_ENABLED(EVENT) + event_manual_reloc, +#endif #if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500) initr_unlock_ram_in_cache, #endif diff --git a/common/event.c b/common/event.c index 0636474..af1ed41 100644 --- a/common/event.c +++ b/common/event.c @@ -17,6 +17,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -148,6 +149,20 @@ void event_show_spy_list(void) } } +#if CONFIG_IS_ENABLED(NEEDS_MANUAL_RELOC) +int event_manual_reloc(void) +{ + struct evspy_info *spy, *end; + + spy = ll_entry_start(struct evspy_info, evspy_info); + end = ll_entry_end(struct evspy_info, evspy_info); + for (; spy < end; spy++) + MANUAL_RELOC(spy->func); + + return 0; +} +#endif + #if CONFIG_IS_ENABLED(EVENT_DYNAMIC) static void spy_free(struct event_spy *spy) { diff --git a/include/event.h b/include/event.h index 7765f07..c00c4fb 100644 --- a/include/event.h +++ b/include/event.h @@ -145,6 +145,16 @@ int event_register(const char *id, enum event_t type, event_handler_t func, void event_show_spy_list(void); /** + * event_manual_reloc() - Relocate event handler pointers + * + * Relocate event handler pointers for all static event spies. It is called + * during the generic board init sequence, after relocation. + * + * Return: 0 if OK + */ +int event_manual_reloc(void); + +/** * event_notify() - notify spies about an event * * It is possible to pass in union event_data here but that may not be