[U-Boot] [PATCH 2/3][v3] Data types defined for 64 bit physical address

york sun york.sun at nxp.com
Wed Feb 10 03:30:45 CET 2016


On 09/17/2015 03:48 AM, Aneesh Bansal wrote:
> Data types and I/O functions have been defined for
> 64 bit physical addresses in arm.
> 
> Signed-off-by: Aneesh Bansal <aneesh.bansal at freescale.com>
> ---
> Changes in v3:
> Corrected the definition of virt_to_phys() and definition of phys_addr_t.
> 
>  arch/arm/include/asm/io.h    |  4 ++--
>  arch/arm/include/asm/types.h | 10 +++++++---
>  2 files changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
> index bfbe0a0..75773bd 100644
> --- a/arch/arm/include/asm/io.h
> +++ b/arch/arm/include/asm/io.h
> @@ -46,7 +46,7 @@ static inline void sync(void)
>  static inline void *
>  map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
>  {
> -	return (void *)paddr;
> +	return (void *)((unsigned long)paddr);
>  }
>  
>  /*
> @@ -59,7 +59,7 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
>  
>  static inline phys_addr_t virt_to_phys(void * vaddr)
>  {
> -	return (phys_addr_t)(vaddr);
> +	return (phys_addr_t)((unsigned long)vaddr);
>  }
>  
>  /*
> diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h
> index ee77c41..388058e 100644
> --- a/arch/arm/include/asm/types.h
> +++ b/arch/arm/include/asm/types.h
> @@ -45,12 +45,16 @@ typedef unsigned long long u64;
>  #define BITS_PER_LONG 32
>  #endif	/* CONFIG_ARM64 */
>  
> -/* Dma addresses are 32-bits wide.  */
> -
> +#ifdef CONFIG_PHYS_64BIT
> +typedef unsigned long long dma_addr_t;
> +typedef unsigned long long phys_addr_t;
> +typedef unsigned long long phys_size_t;
> +#else
> +/* DMA addresses are 32-bits wide */
>  typedef u32 dma_addr_t;
> -
>  typedef unsigned long phys_addr_t;
>  typedef unsigned long phys_size_t;
> +#endif
>  
>  #endif /* __KERNEL__ */
>  
> 

Aneesh and Scott,

I need to revisit this patch. Would it be better to change it as below?

+#if defined(CONFIG_PHYS_64BIT) && !defined(CONFIG_ARM64)
+typedef unsigned long long dma_addr_t;
+typedef unsigned long long phys_addr_t;
+typedef unsigned long long phys_size_t;
+#else
+/* DMA addresses are 32-bits wide */
 typedef u32 dma_addr_t;
-
 typedef unsigned long phys_addr_t;
 typedef unsigned long phys_size_t;
+#endif

I am debugging another patch and found changing phys_addr_t makes some trouble
for ARM64, especially to mix with ulong.

York


More information about the U-Boot mailing list