diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile | 8 | ||||
-rw-r--r-- | lib/bzip2/Makefile | 2 | ||||
-rw-r--r-- | lib/bzip2/bzlib.c (renamed from lib/bzlib.c) | 0 | ||||
-rw-r--r-- | lib/bzip2/bzlib_crctable.c (renamed from lib/bzlib_crctable.c) | 0 | ||||
-rw-r--r-- | lib/bzip2/bzlib_decompress.c (renamed from lib/bzlib_decompress.c) | 0 | ||||
-rw-r--r-- | lib/bzip2/bzlib_huffman.c (renamed from lib/bzlib_huffman.c) | 0 | ||||
-rw-r--r-- | lib/bzip2/bzlib_private.h (renamed from lib/bzlib_private.h) | 0 | ||||
-rw-r--r-- | lib/bzip2/bzlib_randtable.c (renamed from lib/bzlib_randtable.c) | 0 | ||||
-rw-r--r-- | lib/fdtdec.c | 106 | ||||
-rw-r--r-- | lib/libfdt/Makefile | 5 | ||||
-rw-r--r-- | lib/zlib/zlib.h | 2 |
11 files changed, 91 insertions, 32 deletions
diff --git a/lib/Makefile b/lib/Makefile index 320197a..3ceb697 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -11,14 +11,12 @@ obj-$(CONFIG_RSA) += rsa/ obj-$(CONFIG_LZMA) += lzma/ obj-$(CONFIG_LZO) += lzo/ obj-$(CONFIG_ZLIB) += zlib/ +obj-$(CONFIG_BZIP2) += bzip2/ obj-$(CONFIG_TIZEN) += tizen/ +obj-$(CONFIG_OF_LIBFDT) += libfdt/ +obj-$(CONFIG_FIT) += libfdt/ obj-$(CONFIG_AES) += aes.o -obj-$(CONFIG_BZIP2) += bzlib.o -obj-$(CONFIG_BZIP2) += bzlib_crctable.o -obj-$(CONFIG_BZIP2) += bzlib_decompress.o -obj-$(CONFIG_BZIP2) += bzlib_randtable.o -obj-$(CONFIG_BZIP2) += bzlib_huffman.o obj-$(CONFIG_USB_TTY) += circbuf.o obj-y += crc7.o obj-y += crc8.o diff --git a/lib/bzip2/Makefile b/lib/bzip2/Makefile new file mode 100644 index 0000000..929c24e --- /dev/null +++ b/lib/bzip2/Makefile @@ -0,0 +1,2 @@ +obj-y += bzlib.o bzlib_crctable.o bzlib_decompress.o \ + bzlib_randtable.o bzlib_huffman.o diff --git a/lib/bzlib.c b/lib/bzip2/bzlib.c index 5844e18..5844e18 100644 --- a/lib/bzlib.c +++ b/lib/bzip2/bzlib.c diff --git a/lib/bzlib_crctable.c b/lib/bzip2/bzlib_crctable.c index 325b966..325b966 100644 --- a/lib/bzlib_crctable.c +++ b/lib/bzip2/bzlib_crctable.c diff --git a/lib/bzlib_decompress.c b/lib/bzip2/bzlib_decompress.c index 4412b8a..4412b8a 100644 --- a/lib/bzlib_decompress.c +++ b/lib/bzip2/bzlib_decompress.c diff --git a/lib/bzlib_huffman.c b/lib/bzip2/bzlib_huffman.c index 801b8ec..801b8ec 100644 --- a/lib/bzlib_huffman.c +++ b/lib/bzip2/bzlib_huffman.c diff --git a/lib/bzlib_private.h b/lib/bzip2/bzlib_private.h index 87d8f94..87d8f94 100644 --- a/lib/bzlib_private.h +++ b/lib/bzip2/bzlib_private.h diff --git a/lib/bzlib_randtable.c b/lib/bzip2/bzlib_randtable.c index c3dc7e4..c3dc7e4 100644 --- a/lib/bzlib_randtable.c +++ b/lib/bzip2/bzlib_randtable.c diff --git a/lib/fdtdec.c b/lib/fdtdec.c index e8775df..9d86dba 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -75,6 +75,9 @@ static const char * const compat_names[COMPAT_COUNT] = { COMPAT(COMPAT_INTEL_LPC, "intel,lpc"), COMPAT(INTEL_MICROCODE, "intel,microcode"), COMPAT(MEMORY_SPD, "memory-spd"), + COMPAT(INTEL_PANTHERPOINT_AHCI, "intel,pantherpoint-ahci"), + COMPAT(INTEL_MODEL_206AX, "intel,model-206ax"), + COMPAT(INTEL_GMA, "intel,gma"), }; const char *fdtdec_get_compatible(enum fdt_compat_id id) @@ -370,21 +373,6 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int offset, return -ENOENT; } -int fdtdec_get_alias_node(const void *blob, const char *name) -{ - const char *prop; - int alias_node; - int len; - - if (!blob) - return -FDT_ERR_NOTFOUND; - alias_node = fdt_path_offset(blob, "/aliases"); - prop = fdt_getprop(blob, alias_node, name, &len); - if (!prop) - return -FDT_ERR_NOTFOUND; - return fdt_path_offset(blob, prop); -} - int fdtdec_get_chosen_node(const void *blob, const char *name) { const char *prop; @@ -691,20 +679,25 @@ char *fdtdec_get_config_string(const void *blob, const char *prop_name) return (char *)nodep; } -int fdtdec_decode_region(const void *blob, int node, - const char *prop_name, void **ptrp, size_t *size) +int fdtdec_decode_region(const void *blob, int node, const char *prop_name, + fdt_addr_t *basep, fdt_size_t *sizep) { const fdt_addr_t *cell; int len; - debug("%s: %s\n", __func__, prop_name); + debug("%s: %s: %s\n", __func__, fdt_get_name(blob, node, NULL), + prop_name); cell = fdt_getprop(blob, node, prop_name, &len); - if (!cell || (len != sizeof(fdt_addr_t) * 2)) + if (!cell || (len < sizeof(fdt_addr_t) * 2)) { + debug("cell=%p, len=%d\n", cell, len); return -1; + } + + *basep = fdt_addr_to_cpu(*cell); + *sizep = fdt_size_to_cpu(cell[1]); + debug("%s: base=%08lx, size=%lx\n", __func__, (ulong)*basep, + (ulong)*sizep); - *ptrp = map_sysmem(fdt_addr_to_cpu(*cell), *size); - *size = fdt_size_to_cpu(cell[1]); - debug("%s: size=%zx\n", __func__, *size); return 0; } @@ -720,6 +713,7 @@ int fdtdec_decode_region(const void *blob, int node, int fdtdec_read_fmap_entry(const void *blob, int node, const char *name, struct fmap_entry *entry) { + const char *prop; u32 reg[2]; if (fdtdec_get_int_array(blob, node, "reg", reg, 2)) { @@ -728,6 +722,13 @@ int fdtdec_read_fmap_entry(const void *blob, int node, const char *name, } entry->offset = reg[0]; entry->length = reg[1]; + entry->used = fdtdec_get_int(blob, node, "used", entry->length); + prop = fdt_getprop(blob, node, "compress", NULL); + entry->compress_algo = prop && !strcmp(prop, "lzo") ? + FMAP_COMPRESS_LZO : FMAP_COMPRESS_NONE; + prop = fdt_getprop(blob, node, "hash", &entry->hash_size); + entry->hash_algo = prop ? FMAP_HASH_SHA256 : FMAP_HASH_NONE; + entry->hash = (uint8_t *)prop; return 0; } @@ -802,4 +803,65 @@ int fdtdec_pci_get_bdf(const void *fdt, int node, int *bdf) return 0; } + +int fdtdec_decode_memory_region(const void *blob, int config_node, + const char *mem_type, const char *suffix, + fdt_addr_t *basep, fdt_size_t *sizep) +{ + char prop_name[50]; + const char *mem; + fdt_size_t size, offset_size; + fdt_addr_t base, offset; + int node; + + if (config_node == -1) { + config_node = fdt_path_offset(blob, "/config"); + if (config_node < 0) { + debug("%s: Cannot find /config node\n", __func__); + return -ENOENT; + } + } + if (!suffix) + suffix = ""; + + snprintf(prop_name, sizeof(prop_name), "%s-memory%s", mem_type, + suffix); + 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; +} #endif diff --git a/lib/libfdt/Makefile b/lib/libfdt/Makefile index 6fe79e0..2f5413f 100644 --- a/lib/libfdt/Makefile +++ b/lib/libfdt/Makefile @@ -5,8 +5,5 @@ # SPDX-License-Identifier: GPL-2.0+ # -COBJS-libfdt += fdt.o fdt_ro.o fdt_rw.o fdt_strerror.o fdt_sw.o fdt_wip.o \ +obj-y += fdt.o fdt_ro.o fdt_rw.o fdt_strerror.o fdt_sw.o fdt_wip.o \ fdt_empty_tree.o fdt_addresses.o - -obj-$(CONFIG_OF_LIBFDT) += $(COBJS-libfdt) -obj-$(CONFIG_FIT) += $(COBJS-libfdt) diff --git a/lib/zlib/zlib.h b/lib/zlib/zlib.h index 556be32..af3703e 100644 --- a/lib/zlib/zlib.h +++ b/lib/zlib/zlib.h @@ -3,7 +3,7 @@ #define __GLUE_ZLIB_H__ #include <common.h> -#include <compiler.h> +#include <linux/compiler.h> #include <asm/unaligned.h> #include <watchdog.h> #include "u-boot/zlib.h" |