All of lore.kernel.org
 help / color / mirror / Atom feed
From: York Sun <york.sun@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 9/9] mpc85xx: add casts for ram size in min() calculation.
Date: Thu, 26 Jul 2018 16:12:24 +0000	[thread overview]
Message-ID: <VI1PR04MB2078D46F6243BF470CAD175C9A2B0@VI1PR04MB2078.eurprd04.prod.outlook.com> (raw)
In-Reply-To: 1532613591-8444-10-git-send-email-philipp.tomsich@theobroma-systems.com

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>

  reply	other threads:[~2018-07-26 16:12 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-26 13:59 [U-Boot] [PATCH 0/9] Support 4GB of memory on 32bit systems Philipp Tomsich
2018-07-26 13:59 ` [U-Boot] [PATCH 1/9] dm: allow 4GB of DRAM " Philipp Tomsich
2018-08-02 20:36   ` Simon Glass
2018-08-02 21:31     ` Dr. Philipp Tomsich
2018-09-02 11:10       ` Alexander Graf
2018-09-02 16:04         ` Vagrant Cascadian
2018-09-02 17:49           ` Alexander Graf
2018-09-03 14:29             ` Lokesh Vutla
2018-09-14 10:53               ` Simon Glass
2018-09-14 11:03                 ` Philipp Tomsich
2019-01-19 15:21               ` Rask Ingemann Lambertsen
2018-07-26 13:59 ` [U-Boot] [PATCH 2/9] rockchip: support 4GB " Philipp Tomsich
2018-07-26 20:05   ` Carlo Caione
2018-07-26 20:08     ` Dr. Philipp Tomsich
2018-07-26 20:09     ` Dr. Philipp Tomsich
2018-07-26 22:54     ` Dr. Philipp Tomsich
2018-07-27  7:50       ` Carlo Caione
2018-07-27  9:12         ` Dr. Philipp Tomsich
2018-07-26 13:59 ` [U-Boot] [PATCH 3/9] common: include <inttypes.h> always Philipp Tomsich
2018-07-31  1:41   ` Masahiro Yamada
2018-08-02 16:56     ` Simon Glass
2018-08-03 15:01       ` Tom Rini
2018-08-06  2:54         ` Masahiro Yamada
2018-08-02  8:46   ` Patrick DELAUNAY
2018-07-26 13:59 ` [U-Boot] [PATCH 4/9] MIPS: use PRIx64 macros for printing ram size Philipp Tomsich
2018-08-02 20:36   ` Simon Glass
2018-08-07 14:41   ` Daniel Schwierzeck
2018-07-26 13:59 ` [U-Boot] [PATCH 5/9] rockchip: rk3368: change type of ram-size field for a min()-calculation Philipp Tomsich
2018-08-02 20:36   ` Simon Glass
2018-07-26 13:59 ` [U-Boot] [PATCH 6/9] ram: stm32mp1: use PRIx64 macros for printing ram size Philipp Tomsich
2018-08-02  8:52   ` Patrick DELAUNAY
2018-08-02 16:56   ` Simon Glass
2018-07-26 13:59 ` [U-Boot] [PATCH 7/9] board: keymile: add explicit cast to truncate the 64bit ram size field Philipp Tomsich
2018-08-02 20:36   ` Simon Glass
2018-07-26 13:59 ` [U-Boot] [PATCH 8/9] board: cm_fx6: use PRIx64 macros for printing ram size Philipp Tomsich
2018-07-31  1:42   ` Masahiro Yamada
2018-08-02 20:36     ` Simon Glass
2018-07-26 13:59 ` [U-Boot] [PATCH 9/9] mpc85xx: add casts for ram size in min() calculation Philipp Tomsich
2018-07-26 16:12   ` York Sun [this message]
2018-08-11  1:44 ` [U-Boot] [PATCH 0/9] Support 4GB of memory on 32bit systems Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=VI1PR04MB2078D46F6243BF470CAD175C9A2B0@VI1PR04MB2078.eurprd04.prod.outlook.com \
    --to=york.sun@nxp.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.