lmb: replace the lmb_alloc() and lmb_alloc_base() API's
There currently are two API's for requesting memory from the LMB
module, lmb_alloc() and lmb_alloc_base(). The function which does the
actual allocation is the same. Use the earlier introduced API
lmb_alloc_mem() for both types of allocation requests.
Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff --git a/arch/arm/mach-apple/board.c b/arch/arm/mach-apple/board.c
index 2604c5a..4cd8979 100644
--- a/arch/arm/mach-apple/board.c
+++ b/arch/arm/mach-apple/board.c
@@ -773,22 +773,31 @@
#define KERNEL_COMP_SIZE SZ_128M
+#define lmb_alloc(size, addr) lmb_alloc_mem(LMB_MEM_ALLOC_ANY, SZ_2M, addr, size, LMB_NONE)
+
int board_late_init(void)
{
u32 status = 0;
+ phys_addr_t addr;
/* somewhat based on the Linux Kernel boot requirements:
* align by 2M and maximal FDT size 2M
*/
- status |= env_set_hex("loadaddr", lmb_alloc(SZ_1G, SZ_2M));
- status |= env_set_hex("fdt_addr_r", lmb_alloc(SZ_2M, SZ_2M));
- status |= env_set_hex("kernel_addr_r", lmb_alloc(SZ_128M, SZ_2M));
- status |= env_set_hex("ramdisk_addr_r", lmb_alloc(SZ_1G, SZ_2M));
- status |= env_set_hex("kernel_comp_addr_r",
- lmb_alloc(KERNEL_COMP_SIZE, SZ_2M));
- status |= env_set_hex("kernel_comp_size", KERNEL_COMP_SIZE);
- status |= env_set_hex("scriptaddr", lmb_alloc(SZ_4M, SZ_2M));
- status |= env_set_hex("pxefile_addr_r", lmb_alloc(SZ_4M, SZ_2M));
+ status |= !lmb_alloc(SZ_1G, &addr) ? env_set_hex("loadaddr", addr) : 1;
+ status |= !lmb_alloc(SZ_2M, &addr) ?
+ env_set_hex("fdt_addr_r", addr) : 1;
+ status |= !lmb_alloc(SZ_128M, &addr) ?
+ env_set_hex("kernel_addr_r", addr) : 1;
+ status |= !lmb_alloc(SZ_1G, &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 (status)
log_warning("late_init: Failed to set run time variables\n");