aboutsummaryrefslogtreecommitdiff
path: root/include/asm-generic/global_data.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-03-04 08:43:00 -0700
committerTom Rini <trini@konsulko.com>2022-03-10 08:28:36 -0500
commit87a5d1b5d012b0663517bfa36f5e01c8028f121a (patch)
tree4512a25b7200e1c84cb07aa64a17f98c46a1a13f /include/asm-generic/global_data.h
parent64defba4ea55736926c5152a245164ace58fa04e (diff)
downloadu-boot-87a5d1b5d012b0663517bfa36f5e01c8028f121a.zip
u-boot-87a5d1b5d012b0663517bfa36f5e01c8028f121a.tar.gz
u-boot-87a5d1b5d012b0663517bfa36f5e01c8028f121a.tar.bz2
event: Add basic support for events
Add a way to create and dispatch events without needing to allocate memory. Also add a way to 'spy' on events, thus allowing 'hooks' to be created. Use a linker list for static events, which we can use to replace functions like arch_cpu_init_f(). Allow an EVENT_DEBUG option which makes it easier to see what is going on at runtime, but uses more code space. Dynamic events allow the creation of a spy at runtime. This is not always necessary, but can be enabled with EVENT_DYNAMIC if needed. A 'test' event is the only option for now. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/asm-generic/global_data.h')
-rw-r--r--include/asm-generic/global_data.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index c2f8fad..e49f5bf 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -20,6 +20,7 @@
*/
#ifndef __ASSEMBLY__
+#include <event_internal.h>
#include <fdtdec.h>
#include <membuff.h>
#include <linux/list.h>
@@ -467,6 +468,12 @@ struct global_data {
*/
char *smbios_version;
#endif
+#if CONFIG_IS_ENABLED(EVENT)
+ /**
+ * @event_state: Points to the current state of events
+ */
+ struct event_state event_state;
+#endif
};
#ifndef DO_DEPS_ONLY
static_assert(sizeof(struct global_data) == GD_SIZE);
@@ -532,6 +539,12 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
#define gd_set_multi_dtb_fit(_dtb)
#endif
+#if CONFIG_IS_ENABLED(EVENT_DYNAMIC)
+#define gd_event_state() ((struct event_state *)&gd->event_state)
+#else
+#define gd_event_state() NULL
+#endif
+
/**
* enum gd_flags - global data flags
*