From b3ffe9c05a5ecf13d4857859a15c51b02b338ac7 Mon Sep 17 00:00:00 2001 From: kfx Date: Fri, 5 Jul 2013 09:15:55 +0800 Subject: [PATCH] memory reserved: size align: 1M --- arch/arm/plat-rk/mem_reserve.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/arm/plat-rk/mem_reserve.c b/arch/arm/plat-rk/mem_reserve.c index c022ae6afca5..4806d7954e65 100644 --- a/arch/arm/plat-rk/mem_reserve.c +++ b/arch/arm/plat-rk/mem_reserve.c @@ -1,6 +1,9 @@ #include #include #include +/* Macros for Data Alignment : size */ +#define ALIGN_SZ(p, a) \ + (((p) + ((a) - 1)) & ~((a) - 1)) static size_t reserved_size = 0; static phys_addr_t reserved_base_end = 0; @@ -8,14 +11,15 @@ static phys_addr_t reserved_base_end = 0; phys_addr_t __init board_mem_reserve_add(char *name, size_t size) { phys_addr_t base = 0; + size_t align_size = ALIGN_SZ(size, SZ_1M); if(reserved_base_end == 0) reserved_base_end = meminfo.bank[0].start + meminfo.bank[0].size; - reserved_size += size; + reserved_size += align_size; base = reserved_base_end - reserved_size; pr_info("memory reserve: Memory(base:0x%x size:%dM) reserved for <%s>\n", - base, size/SZ_1M, name); + base, align_size/SZ_1M, name); return base; } -- 2.34.1