summaryrefslogtreecommitdiff
path: root/boot/image-fdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'boot/image-fdt.c')
-rw-r--r--boot/image-fdt.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/boot/image-fdt.c b/boot/image-fdt.c
index 5e4aa9de0d2..2b92bdaff16 100644
--- a/boot/image-fdt.c
+++ b/boot/image-fdt.c
@@ -160,9 +160,11 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
{
void *fdt_blob = *of_flat_tree;
void *of_start = NULL;
- u64 start, size, usable;
+ phys_addr_t start, size, usable;
char *fdt_high;
- ulong mapsize, low;
+ phys_addr_t addr;
+ phys_addr_t low;
+ phys_size_t mapsize;
ulong of_len = 0;
int bank;
int err;
@@ -185,7 +187,6 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
fdt_high = env_get("fdt_high");
if (fdt_high) {
ulong desired_addr = hextoul(fdt_high, NULL);
- ulong addr;
if (desired_addr == ~0UL) {
/* All ones means use fdt in place */
@@ -217,14 +218,14 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
if (start + size < low)
continue;
- usable = min(start + size, (u64)(low + mapsize));
-
/*
* At least part of this DRAM bank is usable, try
- * using it for LMB allocation.
+ * using the DRAM bank up to 'usable' address limit
+ * for LMB allocation.
*/
- of_start = map_sysmem((ulong)lmb_alloc_base(lmb,
- of_len, 0x1000, usable), of_len);
+ usable = min(start + size, low + mapsize);
+ addr = lmb_alloc_base(lmb, of_len, 0x1000, usable);
+ of_start = map_sysmem(addr, of_len);
/* Allocation succeeded, use this block. */
if (of_start != NULL)
break;
@@ -233,7 +234,7 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
* Reduce the mapping size in the next bank
* by the size of attempt in current bank.
*/
- mapsize -= usable - max(start, (u64)low);
+ mapsize -= usable - max(start, low);
if (!mapsize)
break;
}