All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/5] powerpc/85xx: fix definition of MAS register macros
@ 2011-10-31 18:30 Timur Tabi
  2011-10-31 18:30 ` [U-Boot] [PATCH 2/5] powerpc/85xx: fix some comments in the CCSR relocation code Timur Tabi
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Timur Tabi @ 2011-10-31 18:30 UTC (permalink / raw)
  To: u-boot

Some of the MAS register macros do not protect the parameter with
parentheses, which could cause wrong values if the parameter includes
operators.

Also fix the definition of TSIZE_TO_BYTES() so that it actually uses
the parameter.  This hasn't caused any problems to date because the
parameter was always been 'tsize'.

Signed-off-by: Timur Tabi <timur@freescale.com>
---
 arch/powerpc/include/asm/mmu.h |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index ef5076b..209103e 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -392,17 +392,17 @@ extern void print_bats(void);
  */
 
 #define MAS0_TLBSEL_MSK	0x30000000
-#define MAS0_TLBSEL(x)	((x << 28) & MAS0_TLBSEL_MSK)
+#define MAS0_TLBSEL(x)	(((x) << 28) & MAS0_TLBSEL_MSK)
 #define MAS0_ESEL_MSK	0x0FFF0000
-#define MAS0_ESEL(x)	((x << 16) & MAS0_ESEL_MSK)
+#define MAS0_ESEL(x)	(((x) << 16) & MAS0_ESEL_MSK)
 #define MAS0_NV(x)	((x) & 0x00000FFF)
 
 #define MAS1_VALID	0x80000000
 #define MAS1_IPROT	0x40000000
-#define MAS1_TID(x)	((x << 16) & 0x3FFF0000)
+#define MAS1_TID(x)	(((x) << 16) & 0x3FFF0000)
 #define MAS1_TS		0x00001000
-#define MAS1_TSIZE(x)	((x << 8) & 0x00000F00)
-#define TSIZE_TO_BYTES(x) ((phys_addr_t)(1UL << ((tsize * 2) + 10)))
+#define MAS1_TSIZE(x)	(((x) << 8) & 0x00000F00)
+#define TSIZE_TO_BYTES(x) (1ULL << (((x) * 2) + 10))
 
 #define MAS2_EPN	0xFFFFF000
 #define MAS2_X0		0x00000040
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-11-08 14:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-31 18:30 [U-Boot] [PATCH 1/5] powerpc/85xx: fix definition of MAS register macros Timur Tabi
2011-10-31 18:30 ` [U-Boot] [PATCH 2/5] powerpc/85xx: fix some comments in the CCSR relocation code Timur Tabi
2011-11-08 14:31   ` Kumar Gala
2011-10-31 18:30 ` [U-Boot] [PATCH 3/5] powerpc/85xx: add some missing sync instructions " Timur Tabi
2011-11-08 14:32   ` Kumar Gala
2011-10-31 18:30 ` [U-Boot] [PATCH 4/5] powerpc/85xx: verify the current address of CCSR before relocating it Timur Tabi
2011-11-08 14:32   ` Kumar Gala
2011-10-31 18:30 ` [U-Boot] [PATCH 5/5] powerpc/85xx: resize the boot page TLB before relocating CCSR Timur Tabi
2011-11-08 14:32   ` Kumar Gala
2011-11-08 14:31 ` [U-Boot] [PATCH 1/5] powerpc/85xx: fix definition of MAS register macros Kumar Gala

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.