* [PATCH] powerpc: fix warning when compiling immap_qe.h
@ 2010-10-14 20:15 Timur Tabi
2011-01-13 0:08 ` Kumar Gala
0 siblings, 1 reply; 2+ messages in thread
From: Timur Tabi @ 2010-10-14 20:15 UTC (permalink / raw)
To: linuxppc-dev, kumar.gala
Fix the warnings genereted by arch/powerpc/include/asm/immap_qe.h when
CONFIG_PHYS_ADDR_T_64BIT is defined:
immap_qe.h: In function 'immrbar_virt_to_phys':
immap_qe.h:472:8: warning: cast from pointer to integer of different size
immap_qe.h:472:24: warning: cast from pointer to integer of different size
immap_qe.h:473:5: warning: cast from pointer to integer of different size
immap_qe.h:473:21: warning: cast from pointer to integer of different size
immap_qe.h:474:36: warning: cast from pointer to integer of different size
Note that the QE does not support 36-bit physical addresses, so even when
CONFIG_PHYS_ADDR_T_64BIT is defined, the QE MURAM must be located below the
4GB boundary.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
arch/powerpc/include/asm/immap_qe.h | 21 +++++++++++++++------
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 4e10f50..0edb684 100644
--- a/arch/powerpc/include/asm/immap_qe.h
+++ b/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__ */
--
1.7.2.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] powerpc: fix warning when compiling immap_qe.h
2010-10-14 20:15 [PATCH] powerpc: fix warning when compiling immap_qe.h Timur Tabi
@ 2011-01-13 0:08 ` Kumar Gala
0 siblings, 0 replies; 2+ messages in thread
From: Kumar Gala @ 2011-01-13 0:08 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev
On Oct 14, 2010, at 3:15 PM, Timur Tabi wrote:
> Fix the warnings genereted by arch/powerpc/include/asm/immap_qe.h when
> CONFIG_PHYS_ADDR_T_64BIT is defined:
>
> immap_qe.h: In function 'immrbar_virt_to_phys':
> immap_qe.h:472:8: warning: cast from pointer to integer of different size
> immap_qe.h:472:24: warning: cast from pointer to integer of different size
> immap_qe.h:473:5: warning: cast from pointer to integer of different size
> immap_qe.h:473:21: warning: cast from pointer to integer of different size
> immap_qe.h:474:36: warning: cast from pointer to integer of different size
>
> Note that the QE does not support 36-bit physical addresses, so even when
> CONFIG_PHYS_ADDR_T_64BIT is defined, the QE MURAM must be located below the
> 4GB boundary.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
> arch/powerpc/include/asm/immap_qe.h | 21 +++++++++++++++------
> 1 files changed, 15 insertions(+), 6 deletions(-)
applied to next
- k
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-13 0:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-14 20:15 [PATCH] powerpc: fix warning when compiling immap_qe.h Timur Tabi
2011-01-13 0:08 ` Kumar Gala
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).