struct fdt_header *fdt_blob = (struct fdt_header *)gd->fdt_blob;
/* We need to be fairly conservative here as we support boards with just 1G of TOTAL RAM */
- addr = addr_alloc(SZ_128M);
+ status |= !lmb_alloc(SZ_128M, &addr) ?
+ env_set_hex("loadaddr", addr) : 1;
status |= env_set_hex("kernel_addr_r", addr);
- status |= env_set_hex("loadaddr", addr);
- status |= env_set_hex("ramdisk_addr_r", addr_alloc(SZ_128M));
- status |= env_set_hex("kernel_comp_addr_r", addr_alloc(KERNEL_COMP_SIZE));
- status |= env_set_hex("kernel_comp_size", KERNEL_COMP_SIZE);
+ status |= !lmb_alloc(SZ_128M, &addr) ?
+ env_set_hex("ramdisk_addr_r", addr) : 1;
+ status |= !lmb_alloc(KERNEL_COMP_SIZE, &addr) ?
+ env_set_hex("kernel_comp_addr_r", addr) : 1;
+ status |= !lmb_alloc(KERNEL_COMP_SIZE, &addr) ?
+ env_set_hex("kernel_comp_size", addr) : 1;
+ status |= !lmb_alloc(SZ_4M, &addr) ?
+ env_set_hex("scriptaddr", addr) : 1;
+ status |= !lmb_alloc(SZ_4M, &addr) ?
+ env_set_hex("pxefile_addr_r", addr) : 1;
+
- if (IS_ENABLED(CONFIG_FASTBOOT))
+ if (IS_ENABLED(CONFIG_FASTBOOT)) {
- addr = addr_alloc(FASTBOOT_BUF_SIZE);
- status |= env_set_hex("fastboot_addr_r", addr);
+ status |= !lmb_alloc(FASTBOOT_BUF_SIZE, &addr) ?
+ env_set_hex("fastboot_addr_r", addr) : 1;
+ /* override loadaddr for memory rich soc */
- status |= env_set_hex("loadaddr", addr);
++ status |= !lmb_alloc(SZ_128M, &addr) ?
++ env_set_hex("loadaddr", addr) : 1;
+ }
- status |= env_set_hex("scriptaddr", addr_alloc(SZ_4M));
- status |= env_set_hex("pxefile_addr_r", addr_alloc(SZ_4M));
- addr = addr_alloc(SZ_2M);
- status |= env_set_hex("fdt_addr_r", addr);
- if (status)
+ fdt_status |= !lmb_alloc(SZ_2M, &addr) ?
+ env_set_hex("fdt_addr_r", addr) : 1;
+
+ if (status || fdt_status)
log_warning("%s: Failed to set run time variables\n", __func__);
/* By default copy U-Boots FDT, it will be used as a fallback */