vbe: Move OS implementation into a separate file
[platform/kernel/u-boot.git] / common / event.c
index 9d67a06..3e34550 100644 (file)
@@ -17,6 +17,7 @@
 #include <malloc.h>
 #include <asm/global_data.h>
 #include <linux/list.h>
+#include <relocate.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -34,6 +35,9 @@ const char *const type_name[] = {
 
        /* init hooks */
        "misc_init_f",
+
+       /* fdt hooks */
+       "ft_fixup",
 };
 
 _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
@@ -148,6 +152,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)
 {
@@ -159,8 +177,6 @@ int event_register(const char *id, enum event_t type, event_handler_t func, void
        struct event_state *state = gd_event_state();
        struct event_spy *spy;
 
-       if (!CONFIG_IS_ENABLED(EVENT_DYNAMIC))
-               return -ENOSYS;
        spy = malloc(sizeof(*spy));
        if (!spy)
                return log_msg_ret("alloc", -ENOMEM);