]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
boot: Pass the correct FDT to the EVT_FT_FIXUP event
authorSimon Glass <sjg@chromium.org>
Tue, 11 Oct 2022 15:47:15 +0000 (09:47 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 18 Oct 2022 03:17:13 +0000 (21:17 -0600)
Now that we support multiple device trees with the ofnode interface, we
can pass the correct FDT to this event. This allows the 'working' FDT to
be fixed up, as expected, so long as OFNODE_MULTI_TREE is enabled.

Also make sure we don't try to do this with livetree, which does not
support fixups yet.

Signed-off-by: Simon Glass <sjg@chromium.org>
boot/image-fdt.c

index f651940d9b461dc08b3f8d6aa3bfbb1202e85174..b830a0ab4187bd3e265167f712e9a7941c0b45cd 100644 (file)
@@ -665,15 +665,18 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob,
                        goto err;
                }
        }
-       if (CONFIG_IS_ENABLED(EVENT)) {
+       if (!of_live_active() && CONFIG_IS_ENABLED(EVENT)) {
                struct event_ft_fixup fixup;
 
-               fixup.tree = oftree_default();
+               fixup.tree = oftree_from_fdt(blob);
                fixup.images = images;
-               ret = event_notify(EVT_FT_FIXUP, &fixup, sizeof(fixup));
-               if (ret) {
-                       printf("ERROR: fdt fixup event failed: %d\n", ret);
-                       goto err;
+               if (oftree_valid(fixup.tree)) {
+                       ret = event_notify(EVT_FT_FIXUP, &fixup, sizeof(fixup));
+                       if (ret) {
+                               printf("ERROR: fdt fixup event failed: %d\n",
+                                      ret);
+                               goto err;
+                       }
                }
        }