diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2012-07-12 18:57:35 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-07-29 17:19:14 -0400 |
commit | a5d5f7daa744b34477c4a12728bde0a1694a1707 (patch) | |
tree | 386299b6bedc567d937d2d8a35a3ae618ec22a60 /arch | |
parent | ff081e05bfba3461119cd280201d163b6858eda2 (diff) |
ARM: 7465/1: Handle >4GB memory sizes in device tree and mem=size@start option
The memory regions which are passed to arm_add_memory() from
device tree blobs via early_init_dt_add_memory_arch() can
have sizes which are larger than will fit in a 32 bit integer,
so switch to using a phys_addr_t to hold them, to avoid
silently dropping the top 32 bits of the size. Similarly, use
phys_addr_t in early_mem() so that mem=size@start command line
options specifying more than 4GB behave sensibly.
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/include/asm/setup.h | 4 | ||||
-rw-r--r-- | arch/arm/kernel/setup.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h index 23ebc0c82a39..24d284a1bfc7 100644 --- a/arch/arm/include/asm/setup.h +++ b/arch/arm/include/asm/setup.h | |||
@@ -196,7 +196,7 @@ static const struct tagtable __tagtable_##fn __tag = { tag, fn } | |||
196 | 196 | ||
197 | struct membank { | 197 | struct membank { |
198 | phys_addr_t start; | 198 | phys_addr_t start; |
199 | unsigned long size; | 199 | phys_addr_t size; |
200 | unsigned int highmem; | 200 | unsigned int highmem; |
201 | }; | 201 | }; |
202 | 202 | ||
@@ -217,7 +217,7 @@ extern struct meminfo meminfo; | |||
217 | #define bank_phys_end(bank) ((bank)->start + (bank)->size) | 217 | #define bank_phys_end(bank) ((bank)->start + (bank)->size) |
218 | #define bank_phys_size(bank) (bank)->size | 218 | #define bank_phys_size(bank) (bank)->size |
219 | 219 | ||
220 | extern int arm_add_memory(phys_addr_t start, unsigned long size); | 220 | extern int arm_add_memory(phys_addr_t start, phys_addr_t size); |
221 | extern void early_print(const char *str, ...); | 221 | extern void early_print(const char *str, ...); |
222 | extern void dump_machine_table(void); | 222 | extern void dump_machine_table(void); |
223 | 223 | ||
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index e15d83bb4ea3..a81dcecc7343 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -508,7 +508,7 @@ void __init dump_machine_table(void) | |||
508 | /* can't use cpu_relax() here as it may require MMU setup */; | 508 | /* can't use cpu_relax() here as it may require MMU setup */; |
509 | } | 509 | } |
510 | 510 | ||
511 | int __init arm_add_memory(phys_addr_t start, unsigned long size) | 511 | int __init arm_add_memory(phys_addr_t start, phys_addr_t size) |
512 | { | 512 | { |
513 | struct membank *bank = &meminfo.bank[meminfo.nr_banks]; | 513 | struct membank *bank = &meminfo.bank[meminfo.nr_banks]; |
514 | 514 | ||
@@ -538,7 +538,7 @@ int __init arm_add_memory(phys_addr_t start, unsigned long size) | |||
538 | } | 538 | } |
539 | #endif | 539 | #endif |
540 | 540 | ||
541 | bank->size = size & PAGE_MASK; | 541 | bank->size = size & ~(phys_addr_t)(PAGE_SIZE - 1); |
542 | 542 | ||
543 | /* | 543 | /* |
544 | * Check whether this memory region has non-zero size or | 544 | * Check whether this memory region has non-zero size or |
@@ -558,7 +558,7 @@ int __init arm_add_memory(phys_addr_t start, unsigned long size) | |||
558 | static int __init early_mem(char *p) | 558 | static int __init early_mem(char *p) |
559 | { | 559 | { |
560 | static int usermem __initdata = 0; | 560 | static int usermem __initdata = 0; |
561 | unsigned long size; | 561 | phys_addr_t size; |
562 | phys_addr_t start; | 562 | phys_addr_t start; |
563 | char *endp; | 563 | char *endp; |
564 | 564 | ||