diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bzip2/Makefile | 4 | ||||
-rw-r--r-- | lib/fdtdec.c | 22 | ||||
-rw-r--r-- | lib/fdtdec_common.c | 18 | ||||
-rw-r--r-- | lib/libfdt/fdt_region.c | 2 |
4 files changed, 38 insertions, 8 deletions
diff --git a/lib/bzip2/Makefile b/lib/bzip2/Makefile index 929c24e..f0b81ad 100644 --- a/lib/bzip2/Makefile +++ b/lib/bzip2/Makefile @@ -1,2 +1,6 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# + obj-y += bzlib.o bzlib_crctable.o bzlib_decompress.o \ bzlib_randtable.o bzlib_huffman.o diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 9db033a..c1b5177 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -601,16 +601,21 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int offset, return -ENOENT; } -int fdtdec_get_chosen_node(const void *blob, const char *name) +const char *fdtdec_get_chosen_prop(const void *blob, const char *name) { - const char *prop; int chosen_node; - int len; if (!blob) - return -FDT_ERR_NOTFOUND; + return NULL; chosen_node = fdt_path_offset(blob, "/chosen"); - prop = fdt_getprop(blob, chosen_node, name, &len); + return fdt_getprop(blob, chosen_node, name, NULL); +} + +int fdtdec_get_chosen_node(const void *blob, const char *name) +{ + const char *prop; + + prop = fdtdec_get_chosen_prop(blob, name); if (!prop) return -FDT_ERR_NOTFOUND; return fdt_path_offset(blob, prop); @@ -1217,8 +1222,11 @@ int fdtdec_setup(void) 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; + /* FDT is at end of BSS unless it is in a different memory region */ + if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS)) + gd->fdt_blob = (ulong *)&_image_binary_end; + else + gd->fdt_blob = (ulong *)&__bss_end; # else /* FDT is at end of image */ gd->fdt_blob = (ulong *)&_end; diff --git a/lib/fdtdec_common.c b/lib/fdtdec_common.c index 757931a..63b704a 100644 --- a/lib/fdtdec_common.c +++ b/lib/fdtdec_common.c @@ -36,3 +36,21 @@ int fdtdec_get_int(const void *blob, int node, const char *prop_name, debug("(not found)\n"); return default_val; } + +unsigned int fdtdec_get_uint(const void *blob, int node, const char *prop_name, + unsigned int default_val) +{ + const int *cell; + int len; + + debug("%s: %s: ", __func__, prop_name); + cell = fdt_getprop(blob, node, prop_name, &len); + if (cell && len >= sizeof(unsigned int)) { + unsigned int val = fdt32_to_cpu(cell[0]); + + debug("%#x (%d)\n", val, val); + return val; + } + debug("(not found)\n"); + return default_val; +} diff --git a/lib/libfdt/fdt_region.c b/lib/libfdt/fdt_region.c index 9fea775..747d8bb 100644 --- a/lib/libfdt/fdt_region.c +++ b/lib/libfdt/fdt_region.c @@ -101,7 +101,7 @@ int fdt_add_alias_regions(const void *fdt, struct fdt_region *region, int count, continue; next = fdt_next_property_offset(fdt, offset); if (next < 0) - next = node_end - sizeof(fdt32_t); + next = node_end; if (!did_alias_header) { fdt_add_region(info, base + node, 12); |