Message ID | 1532613591-8444-10-git-send-email-philipp.tomsich@theobroma-systems.com |
---|---|
State | Changes Requested |
Delegated to: | Tom Rini |
Headers | show |
Series | Support 4GB of memory on 32bit systems | expand |
On 07/26/2018 07:00 AM, Philipp Tomsich wrote: > With the change of the ram size fields to u64, we need to use explicit > casts to ensure that min()-implementation sees the same type for both > its arguments. > > Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> > --- > > arch/powerpc/cpu/mpc85xx/cpu.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c > index bf48836..5664872 100644 > --- a/arch/powerpc/cpu/mpc85xx/cpu.c > +++ b/arch/powerpc/cpu/mpc85xx/cpu.c > @@ -604,7 +604,8 @@ static int reset_tlb(phys_addr_t p_addr, u32 size, phys_addr_t *phys_offset) > int arch_memory_test_advance(u32 *vstart, u32 *size, phys_addr_t *phys_offset) > { > phys_addr_t test_cap, p_addr; > - phys_size_t p_size = min(gd->ram_size, CONFIG_MAX_MEM_MAPPED); > + phys_size_t p_size = min((phys_size_t)gd->ram_size, > + (phys_size_t)CONFIG_MAX_MEM_MAPPED); > > #if !defined(CONFIG_PHYS_64BIT) || \ > !defined(CONFIG_SYS_INIT_RAM_ADDR_PHYS) || \ > @@ -632,7 +633,8 @@ int arch_memory_test_advance(u32 *vstart, u32 *size, phys_addr_t *phys_offset) > /* initialization for testing area */ > int arch_memory_test_prepare(u32 *vstart, u32 *size, phys_addr_t *phys_offset) > { > - phys_size_t p_size = min(gd->ram_size, CONFIG_MAX_MEM_MAPPED); > + phys_size_t p_size = min((phys_size_t)gd->ram_size, > + (phys_size_t)CONFIG_MAX_MEM_MAPPED); > > *vstart = CONFIG_SYS_DDR_SDRAM_BASE; > *size = (u32) p_size; /* CONFIG_MAX_MEM_MAPPED < 4G */ > We didn't have any issue with 36-bit physical address on mpc85xx. I see this change is needed after you change gd->ram_size. Reviewed-by: York Sun <york.sun@nxp.com>
diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c index bf48836..5664872 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu.c +++ b/arch/powerpc/cpu/mpc85xx/cpu.c @@ -604,7 +604,8 @@ static int reset_tlb(phys_addr_t p_addr, u32 size, phys_addr_t *phys_offset) int arch_memory_test_advance(u32 *vstart, u32 *size, phys_addr_t *phys_offset) { phys_addr_t test_cap, p_addr; - phys_size_t p_size = min(gd->ram_size, CONFIG_MAX_MEM_MAPPED); + phys_size_t p_size = min((phys_size_t)gd->ram_size, + (phys_size_t)CONFIG_MAX_MEM_MAPPED); #if !defined(CONFIG_PHYS_64BIT) || \ !defined(CONFIG_SYS_INIT_RAM_ADDR_PHYS) || \ @@ -632,7 +633,8 @@ int arch_memory_test_advance(u32 *vstart, u32 *size, phys_addr_t *phys_offset) /* initialization for testing area */ int arch_memory_test_prepare(u32 *vstart, u32 *size, phys_addr_t *phys_offset) { - phys_size_t p_size = min(gd->ram_size, CONFIG_MAX_MEM_MAPPED); + phys_size_t p_size = min((phys_size_t)gd->ram_size, + (phys_size_t)CONFIG_MAX_MEM_MAPPED); *vstart = CONFIG_SYS_DDR_SDRAM_BASE; *size = (u32) p_size; /* CONFIG_MAX_MEM_MAPPED < 4G */
With the change of the ram size fields to u64, we need to use explicit casts to ensure that min()-implementation sees the same type for both its arguments. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> --- arch/powerpc/cpu/mpc85xx/cpu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)