From a5d02e6972a6813d4fac5a86fb37bc3d97986b19 Mon Sep 17 00:00:00 2001 From: Timur Tabi Date: Thu, 14 Oct 2010 15:15:30 -0500 Subject: [PATCH] --- yaml --- r: 232040 b: refs/heads/master c: b49d81ded47e9d01f7128fce50d224ccc2150960 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/powerpc/include/asm/immap_qe.h | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index ccc6d2838699..17987248ae4b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b2e0861e51f2961954330dcafe6d148ee3ab5cff +refs/heads/master: b49d81ded47e9d01f7128fce50d224ccc2150960 diff --git a/trunk/arch/powerpc/include/asm/immap_qe.h b/trunk/arch/powerpc/include/asm/immap_qe.h index 4e10f508570a..0edb6842b13d 100644 --- a/trunk/arch/powerpc/include/asm/immap_qe.h +++ b/trunk/arch/powerpc/include/asm/immap_qe.h @@ -467,13 +467,22 @@ struct qe_immap { extern struct qe_immap __iomem *qe_immr; extern phys_addr_t get_qe_base(void); -static inline unsigned long immrbar_virt_to_phys(void *address) +/* + * Returns the offset within the QE address space of the given pointer. + * + * Note that the QE does not support 36-bit physical addresses, so if + * get_qe_base() returns a number above 4GB, the caller will probably fail. + */ +static inline phys_addr_t immrbar_virt_to_phys(void *address) { - if ( ((u32)address >= (u32)qe_immr) && - ((u32)address < ((u32)qe_immr + QE_IMMAP_SIZE)) ) - return (unsigned long)(address - (u32)qe_immr + - (u32)get_qe_base()); - return (unsigned long)virt_to_phys(address); + void *q = (void *)qe_immr; + + /* Is it a MURAM address? */ + if ((address >= q) && (address < (q + QE_IMMAP_SIZE))) + return get_qe_base() + (address - q); + + /* It's an address returned by kmalloc */ + return virt_to_phys(address); } #endif /* __KERNEL__ */