image: android: Add functions for handling dtb field
[oweals/u-boot.git] / common / image-fdt.c
index 4247dcee0c4f71d6626ffa31337c9313ff45b335..dbb1e6e131c8e06c745320a6b27eb8d9b435b462 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/libfdt.h>
 #include <mapmem.h>
 #include <asm/io.h>
+#include <tee/optee.h>
 
 #ifndef CONFIG_SYS_FDT_PAD
 #define CONFIG_SYS_FDT_PAD 0x3000
@@ -284,7 +285,8 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
        *of_flat_tree = NULL;
        *of_size = 0;
 
-       img_addr = (argc == 0) ? load_addr : simple_strtoul(argv[0], NULL, 16);
+       img_addr = (argc == 0) ? image_load_addr :
+                       simple_strtoul(argv[0], NULL, 16);
        buf = map_sysmem(img_addr, 0);
 
        if (argc > 2)
@@ -303,7 +305,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
                        else if (images->fit_uname_os)
                                default_addr = (ulong)images->fit_hdr_os;
                        else
-                               default_addr = load_addr;
+                               default_addr = image_load_addr;
 
                        if (fit_parse_conf(select, default_addr,
                                           &fdt_addr, &fit_uname_config)) {
@@ -561,6 +563,13 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
                }
        }
 
+       fdt_ret = optee_copy_fdt_nodes(gd->fdt_blob, blob);
+       if (fdt_ret) {
+               printf("ERROR: transfer of optee nodes to new fdt failed: %s\n",
+                      fdt_strerror(fdt_ret));
+               goto err;
+       }
+
        /* Delete the old LMB reservation */
        if (lmb)
                lmb_free(lmb, (phys_addr_t)(u32)(uintptr_t)blob,