Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
mem = fdt_getprop(blob, config_node, prop_name, NULL);
if (!mem) {
debug("%s: No memory type for '%s', using /memory\n", __func__,
prop_name);
mem = "/memory";
}
node = fdt_path_offset(blob, mem);
if (node < 0) {
debug("%s: Failed to find node '%s': %s\n", __func__, mem,
fdt_strerror(node));
return -ENOENT;
}
/*
* Not strictly correct - the memory may have multiple banks. We just
* use the first
*/
if (fdtdec_decode_region(blob, node, "reg", &base, &size)) {
debug("%s: Failed to decode memory region %s\n", __func__,
mem);
return -EINVAL;
}
snprintf(prop_name, sizeof(prop_name), "%s-offset%s", mem_type,
suffix);
if (fdtdec_decode_region(blob, config_node, prop_name, &offset,
&offset_size)) {
debug("%s: Failed to decode memory region '%s'\n", __func__,
prop_name);
return -EINVAL;
}
*basep = base + offset;
*sizep = offset_size;
return 0;
}
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
{
#ifdef CONFIG_OF_CONTROL
# ifdef CONFIG_OF_EMBED
/* Get a pointer to the FDT */
gd->fdt_blob = __dtb_dt_begin;
# elif defined CONFIG_OF_SEPARATE
# ifdef CONFIG_SPL_BUILD
/* FDT is at end of BSS */
gd->fdt_blob = (ulong *)&__bss_end;
# else
/* FDT is at end of image */
gd->fdt_blob = (ulong *)&_end;
#endif
# elif defined(CONFIG_OF_HOSTFILE)
if (sandbox_read_fdt_from_file()) {
puts("Failed to read control FDT\n");
return -1;
}
# endif
# ifndef CONFIG_SPL_BUILD
/* Allow the early environment to override the fdt address */
gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,
(uintptr_t)gd->fdt_blob);
# endif
return fdtdec_prepare_fdt();
}
#endif /* !USE_HOSTCC */