summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/event.c3
-rw-r--r--include/event.h18
-rw-r--r--lib/of_live.c11
3 files changed, 32 insertions, 0 deletions
diff --git a/common/event.c b/common/event.c
index dda569d4478..8d7513eb10b 100644
--- a/common/event.c
+++ b/common/event.c
@@ -48,6 +48,9 @@ const char *const type_name[] = {
/* main loop events */
"main_loop",
+
+ /* livetree has been built */
+ "of_live_init",
};
_Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
diff --git a/include/event.h b/include/event.h
index 75141a192a4..1d267f1d105 100644
--- a/include/event.h
+++ b/include/event.h
@@ -154,6 +154,15 @@ enum event_t {
EVT_MAIN_LOOP,
/**
+ * @EVT_OF_LIVE_BUILT:
+ * This event is triggered immediately after the live device tree has been
+ * built. This allows for machine specific fixups to be done to the live tree
+ * (like disabling known-unsupported devices) before it is used. This
+ * event is only available if OF_LIVE is enabled and is only used after relocation.
+ */
+ EVT_OF_LIVE_BUILT,
+
+ /**
* @EVT_COUNT:
* This constants holds the maximum event number + 1 and is used when
* looping over all event classes.
@@ -203,6 +212,15 @@ union event_data {
oftree tree;
struct bootm_headers *images;
} ft_fixup;
+
+ /**
+ * struct event_of_live_built - livetree has been built
+ *
+ * @root: The root node of the live device tree
+ */
+ struct event_of_live_built {
+ struct device_node *root;
+ } of_live_built;
};
/**
diff --git a/lib/of_live.c b/lib/of_live.c
index 90b9459ede3..c1620616513 100644
--- a/lib/of_live.c
+++ b/lib/of_live.c
@@ -11,6 +11,7 @@
#define LOG_CATEGORY LOGC_DT
#include <abuf.h>
+#include <event.h>
#include <log.h>
#include <linux/libfdt.h>
#include <of_live.h>
@@ -321,6 +322,7 @@ int unflatten_device_tree(const void *blob, struct device_node **mynodes)
int of_live_build(const void *fdt_blob, struct device_node **rootp)
{
int ret;
+ union event_data evt;
debug("%s: start\n", __func__);
ret = unflatten_device_tree(fdt_blob, rootp);
@@ -335,6 +337,15 @@ int of_live_build(const void *fdt_blob, struct device_node **rootp)
}
debug("%s: stop\n", __func__);
+ if (CONFIG_IS_ENABLED(EVENT)) {
+ evt.of_live_built.root = *rootp;
+ ret = event_notify(EVT_OF_LIVE_BUILT, &evt, sizeof(evt));
+ if (ret) {
+ log_debug("Failed to notify livetree build event: err=%d\n", ret);
+ return ret;
+ }
+ }
+
return ret;
}