]> Git Repo - J-u-boot.git/blobdiff - common/event.c
Merge tag 'v2023.10-rc4' into next
[J-u-boot.git] / common / event.c
index 9d67a060a021f73763a3dbc75b9c44602446ba75..d11b37a1d802a9d1480d2211a70a07ed7f4b08ea 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;
 
@@ -26,7 +27,8 @@ const char *const type_name[] = {
        "test",
 
        /* Events related to driver model */
-       "dm_post_init",
+       "dm_post_init_f",
+       "dm_post_init_r",
        "dm_pre_probe",
        "dm_post_probe",
        "dm_pre_remove",
@@ -34,12 +36,23 @@ const char *const type_name[] = {
 
        /* init hooks */
        "misc_init_f",
+       "fsp_init_r",
+       "last_stage_init",
+
+       /* Fpga load hook */
+       "fpga_load",
+
+       /* fdt hooks */
+       "ft_fixup",
+
+       /* main loop events */
+       "main_loop",
 };
 
 _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
 #endif
 
-static const char *event_type_name(enum event_t type)
+const char *event_type_name(enum event_t type)
 {
 #if CONFIG_IS_ENABLED(EVENT_DEBUG)
        return type_name[type];
@@ -61,7 +74,14 @@ static int notify_static(struct event *ev)
 
                        log_debug("Sending event %x/%s to spy '%s'\n", ev->type,
                                  event_type_name(ev->type), event_spy_id(spy));
-                       ret = spy->func(NULL, ev);
+                       if (spy->flags & EVSPYF_SIMPLE) {
+                               const struct evspy_info_simple *simple;
+
+                               simple = (struct evspy_info_simple *)spy;
+                               ret = simple->func();
+                       } else {
+                               ret = spy->func(NULL, ev);
+                       }
 
                        /*
                         * TODO: Handle various return codes to
@@ -116,7 +136,7 @@ int event_notify(enum event_t type, void *data, int size)
 
        ret = notify_static(&event);
        if (ret)
-               return log_msg_ret("dyn", ret);
+               return log_msg_ret("sta", ret);
 
        if (CONFIG_IS_ENABLED(EVENT_DYNAMIC)) {
                ret = notify_dynamic(&event);
@@ -148,6 +168,20 @@ void event_show_spy_list(void)
        }
 }
 
+#if IS_ENABLED(CONFIG_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 +193,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);
This page took 0.035954 seconds and 4 git commands to generate.