[U-Boot] [PATCH 3/3] ppc: Use addrmap in virt_to_phys and map_physmem.
Scott Wood
scottwood at freescale.com
Mon Nov 24 18:11:39 CET 2008
On Mon, Nov 24, 2008 at 10:47:40AM -0600, Kumar Gala wrote:
> @@ -287,7 +291,11 @@ extern inline void out_be32(volatile unsigned __iomem *addr, int val)
> static inline void *
> map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
> {
> +#ifdef CONFIG_ADDR_MAP
> + return (void *)(addrmap_phys_to_virt(paddr));
> +#else
> return (void *)((unsigned long)paddr);
> +#endif
> }
>
> /*
> @@ -300,7 +308,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
>
> static inline phys_addr_t virt_to_phys(void * vaddr)
> {
> +#ifdef CONFIG_ADDR_MAP
> + return addrmap_phys_to_virt((unsigned int)vaddr);
> +#else
> return (phys_addr_t)(vaddr);
> +#endif
> }
Shouldn't phys_to_virt return, and virt_to_phys accept, a virtual address
without needing the caller to cast?
Also, don't treat virtual addresses as "unsigned int". Use unsigned long
or uintptr_t.
-Scott
More information about the U-Boot
mailing list