aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/immap_qe.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/include/asm/immap_qe.h')
-rw-r--r--arch/powerpc/include/asm/immap_qe.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/arch/powerpc/include/asm/immap_qe.h b/arch/powerpc/include/asm/immap_qe.h
index 4e10f508570..0edb6842b13 100644
--- a/arch/powerpc/include/asm/immap_qe.h
+++ b/arch/powerpc/include/asm/immap_qe.h
@@ -467,13 +467,22 @@ struct qe_immap {
467extern struct qe_immap __iomem *qe_immr; 467extern struct qe_immap __iomem *qe_immr;
468extern phys_addr_t get_qe_base(void); 468extern phys_addr_t get_qe_base(void);
469 469
470static inline unsigned long immrbar_virt_to_phys(void *address) 470/*
471 * Returns the offset within the QE address space of the given pointer.
472 *
473 * Note that the QE does not support 36-bit physical addresses, so if
474 * get_qe_base() returns a number above 4GB, the caller will probably fail.
475 */
476static inline phys_addr_t immrbar_virt_to_phys(void *address)
471{ 477{
472 if ( ((u32)address >= (u32)qe_immr) && 478 void *q = (void *)qe_immr;
473 ((u32)address < ((u32)qe_immr + QE_IMMAP_SIZE)) ) 479
474 return (unsigned long)(address - (u32)qe_immr + 480 /* Is it a MURAM address? */
475 (u32)get_qe_base()); 481 if ((address >= q) && (address < (q + QE_IMMAP_SIZE)))
476 return (unsigned long)virt_to_phys(address); 482 return get_qe_base() + (address - q);
483
484 /* It's an address returned by kmalloc */
485 return virt_to_phys(address);
477} 486}
478 487
479#endif /* __KERNEL__ */ 488#endif /* __KERNEL__ */