diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2014-08-20 11:10:31 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@linaro.org> | 2014-09-08 10:57:26 -0400 |
commit | 8f73d4b7011061f46ba6f46006b2848b412ff43f (patch) | |
tree | 7a0d70a3d0751a9ac7680c74f2a0772545d434da /drivers/of | |
parent | 7dbe5849fb50fc9b5b77a8f590c87a577ddc9bb6 (diff) |
of: Fix memory block alignment in early_init_dt_add_memory_arch()
If a memory block is not aligned to PAGE_SIZE, its base address must be
rounded up, not down, and its size must be reduced.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/fdt.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 79cb8313c7d8..2d34afb2647d 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -928,7 +928,11 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, | |||
928 | void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) | 928 | void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) |
929 | { | 929 | { |
930 | const u64 phys_offset = __pa(PAGE_OFFSET); | 930 | const u64 phys_offset = __pa(PAGE_OFFSET); |
931 | base &= PAGE_MASK; | 931 | |
932 | if (!PAGE_ALIGNED(base)) { | ||
933 | size -= PAGE_SIZE - (base & ~PAGE_MASK); | ||
934 | base = PAGE_ALIGN(base); | ||
935 | } | ||
932 | size &= PAGE_MASK; | 936 | size &= PAGE_MASK; |
933 | 937 | ||
934 | if (base > MAX_PHYS_ADDR) { | 938 | if (base > MAX_PHYS_ADDR) { |