mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
common/memsize.c: Check for overflow in get_effective_memsize() only for mpc85xx
This reverts commit777aaaa706
("common/memsize.c: Fix get_effective_memsize() to check for overflow") for non-mpc85xx platforms. The changes to this generic function, which is intended to help with 32bit platforms with large amounts of memory has unintended side effects (which in turn lead to boot failures) on other platforms which were previously functional. For now do overflow check only for powerpc mpc85xx platform. It is needed to prevent crashing of P1/P2 boards with 4GB DDR module in 32-bit mode. Fixes:777aaaa706
("common/memsize.c: Fix get_effective_memsize() to check for overflow") Signed-off-by: Pali Rohár <pali@kernel.org>
This commit is contained in:
parent
be914b00df
commit
d1f4b090dd
1 changed files with 2 additions and 0 deletions
|
@ -96,6 +96,7 @@ phys_size_t __weak get_effective_memsize(void)
|
|||
{
|
||||
phys_size_t ram_size = gd->ram_size;
|
||||
|
||||
#ifdef CONFIG_MPC85xx
|
||||
/*
|
||||
* Check for overflow and limit ram size to some representable value.
|
||||
* It is required that ram_base + ram_size must be representable by
|
||||
|
@ -105,6 +106,7 @@ phys_size_t __weak get_effective_memsize(void)
|
|||
*/
|
||||
if (gd->ram_base + ram_size < gd->ram_base)
|
||||
ram_size = ((phys_size_t)~0xfffULL) - gd->ram_base;
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_MAX_MEM_MAPPED
|
||||
return ram_size;
|
||||
|
|
Loading…
Reference in a new issue