summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-08-07 22:33:06 +0200
committerWolfgang Denk <wd@denx.de>2010-08-07 22:33:06 +0200
commit3df4f46f3209c067dcadc969ed02d27c97fa3632 (patch)
tree4639307e5e9120b0c80c62da8376be3e406e84fb /common
parent9efac4a1eb99d9c5539aa6992025eeacab7980c6 (diff)
parentc519facc645812c6d174c2d5b60241d23e285642 (diff)
Merge branch 'master' of /home/wd/git/u-boot/master
Diffstat (limited to 'common')
-rw-r--r--common/cmd_bootm.c7
-rw-r--r--common/cmd_nvedit.c2
-rw-r--r--common/fdt_support.c18
-rw-r--r--common/image.c12
4 files changed, 33 insertions, 6 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index adfa6cd18a..594bccbbe0 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -386,12 +386,14 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
break;
#endif /* CONFIG_BZIP2 */
#ifdef CONFIG_LZMA
- case IH_COMP_LZMA:
+ case IH_COMP_LZMA: {
+ SizeT lzma_len = unc_len;
printf (" Uncompressing %s ... ", type_name);
int ret = lzmaBuffToBuffDecompress(
- (unsigned char *)load, &unc_len,
+ (unsigned char *)load, &lzma_len,
(unsigned char *)image_start, image_len);
+ unc_len = lzma_len;
if (ret != SZ_OK) {
printf ("LZMA: uncompress or overwrite error %d "
"- must RESET board to recover\n", ret);
@@ -400,6 +402,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
}
*load_end = load + unc_len;
break;
+ }
#endif /* CONFIG_LZMA */
#ifdef CONFIG_LZO
case IH_COMP_LZO:
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 1198954bb5..16d5ff74d9 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -543,7 +543,7 @@ char *getenv (char *name)
return (NULL);
}
-int getenv_r (char *name, char *buf, unsigned len)
+int getenv_f(char *name, char *buf, unsigned len)
{
int i, nxt;
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 718b635d99..166f5e145d 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1151,4 +1151,22 @@ int fdt_node_offset_by_compat_reg(void *blob, const char *compat,
return -FDT_ERR_NOTFOUND;
}
+/**
+ * fdt_alloc_phandle: Return next free phandle value
+ *
+ * @blob: ptr to device tree
+ */
+int fdt_alloc_phandle(void *blob)
+{
+ int offset, len, phandle = 0;
+ const u32 *val;
+
+ for (offset = fdt_next_node(blob, -1, NULL); offset >= 0;
+ offset = fdt_next_node(blob, offset, NULL)) {
+ val = fdt_getprop(blob, offset, "linux,phandle", &len);
+ if (val)
+ phandle = max(*val, phandle);
+ }
+ return phandle + 1;
+}
diff --git a/common/image.c b/common/image.c
index 6d8833e814..ea59730861 100644
--- a/common/image.c
+++ b/common/image.c
@@ -433,17 +433,23 @@ ulong getenv_bootm_low(void)
phys_size_t getenv_bootm_size(void)
{
+ phys_size_t tmp;
char *s = getenv ("bootm_size");
if (s) {
- phys_size_t tmp;
tmp = (phys_size_t)simple_strtoull (s, NULL, 16);
return tmp;
}
+ s = getenv("bootm_low");
+ if (s)
+ tmp = (phys_size_t)simple_strtoull (s, NULL, 16);
+ else
+ tmp = 0;
+
#if defined(CONFIG_ARM)
- return gd->bd->bi_dram[0].size;
+ return gd->bd->bi_dram[0].size - tmp;
#else
- return gd->bd->bi_memsize;
+ return gd->bd->bi_memsize - tmp;
#endif
}