[U-Boot-Users] [PATCH] Use FSL Book-E MMU macros from Linux Kernel

Kumar Gala galak at kernel.crashing.org
Wed Dec 19 06:22:56 CET 2007


Grab the FSL Book-E MAS register macros from Linux.  Also added
defines for page sizes up to 4TB and removed SHAREN since it doesnt
really exist.

Signed-off-by: Kumar Gala <galak at kernel.crashing.org>
---
 include/asm-ppc/mmu.h |  100 ++++++++++++++++++++++++++-----------------------
 include/e500.h        |   12 +----
 2 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h
index 3d40332..b77cf8f 100644
--- a/include/asm-ppc/mmu.h
+++ b/include/asm-ppc/mmu.h
@@ -336,55 +336,57 @@ extern int write_bat(ppc_bat_t bat, unsigned long upper, unsigned long lower);
  */

 /*
- * e500 support
+ * FSL Book-E support
  */

-#define MAS0_TLBSEL     0x10000000
-#define MAS0_ESEL       0x000F0000
-#define MAS0_NV         0x00000001
-
-#define MAS1_VALID      0x80000000
-#define MAS1_IPROT      0x40000000
-#define MAS1_TID        0x00FF0000
-#define MAS1_TS         0x00001000
-#define MAS1_TSIZE   	0x00000F00
-
-#define MAS2_EPN        0xFFFFF000
-#define MAS2_SHAREN     0x00000200
-#define MAS2_X0         0x00000040
-#define MAS2_X1         0x00000020
-#define MAS2_W          0x00000010
-#define MAS2_I          0x00000008
-#define MAS2_M          0x00000004
-#define MAS2_G          0x00000002
-#define MAS2_E          0x00000001
-
-#define MAS3_RPN        0xFFFFF000
-#define MAS3_U0         0x00000200
-#define MAS3_U1         0x00000100
-#define MAS3_U2         0x00000080
-#define MAS3_U3         0x00000040
-#define MAS3_UX         0x00000020
-#define MAS3_SX         0x00000010
-#define MAS3_UW         0x00000008
-#define MAS3_SW         0x00000004
-#define MAS3_UR         0x00000002
-#define MAS3_SR         0x00000001
-
-#define MAS4_TLBSELD    0x10000000
-#define MAS4_TIDDSEL    0x00030000
-#define MAS4_DSHAREN    0x00001000
-#define MAS4_TSIZED(x)  (x << 8)
-#define MAS4_X0D        0x00000040
-#define MAS4_X1D        0x00000020
-#define MAS4_WD         0x00000010
-#define MAS4_ID         0x00000008
-#define MAS4_MD         0x00000004
-#define MAS4_GD         0x00000002
-#define MAS4_ED         0x00000001
-
-#define MAS6_SPID       0x00FF0000
-#define MAS6_SAS        0x00000001
+#define MAS0_TLBSEL(x)	((x << 28) & 0x30000000)
+#define MAS0_ESEL(x)	((x << 16) & 0x0FFF0000)
+#define MAS0_NV(x)	((x) & 0x00000FFF)
+
+#define MAS1_VALID 	0x80000000
+#define MAS1_IPROT	0x40000000
+#define MAS1_TID(x)	((x << 16) & 0x3FFF0000)
+#define MAS1_TS		0x00001000
+#define MAS1_TSIZE(x)	((x << 8) & 0x00000F00)
+
+#define MAS2_EPN	0xFFFFF000
+#define MAS2_X0		0x00000040
+#define MAS2_X1		0x00000020
+#define MAS2_W		0x00000010
+#define MAS2_I		0x00000008
+#define MAS2_M		0x00000004
+#define MAS2_G		0x00000002
+#define MAS2_E		0x00000001
+
+#define MAS3_RPN	0xFFFFF000
+#define MAS3_U0		0x00000200
+#define MAS3_U1		0x00000100
+#define MAS3_U2		0x00000080
+#define MAS3_U3		0x00000040
+#define MAS3_UX		0x00000020
+#define MAS3_SX		0x00000010
+#define MAS3_UW		0x00000008
+#define MAS3_SW		0x00000004
+#define MAS3_UR		0x00000002
+#define MAS3_SR		0x00000001
+
+#define MAS4_TLBSELD(x) MAS0_TLBSEL(x)
+#define MAS4_TIDDSEL	0x000F0000
+#define MAS4_TSIZED(x)	MAS1_TSIZE(x)
+#define MAS4_X0D	0x00000040
+#define MAS4_X1D	0x00000020
+#define MAS4_WD		0x00000010
+#define MAS4_ID		0x00000008
+#define MAS4_MD		0x00000004
+#define MAS4_GD		0x00000002
+#define MAS4_ED		0x00000001
+
+#define MAS6_SPID0	0x3FFF0000
+#define MAS6_SPID1	0x00007FFE
+#define MAS6_SAS	0x00000001
+#define MAS6_SPID	MAS6_SPID0
+
+#define MAS7_RPN	0xFFFFFFFF

 #define BOOKE_PAGESZ_1K         0
 #define BOOKE_PAGESZ_4K         1
@@ -398,6 +400,10 @@ extern int write_bat(ppc_bat_t bat, unsigned long upper, unsigned long lower);
 #define BOOKE_PAGESZ_256M       9
 #define BOOKE_PAGESZ_1G		10
 #define BOOKE_PAGESZ_4G		11
+#define BOOKE_PAGESZ_16GB	12
+#define BOOKE_PAGESZ_64GB	13
+#define BOOKE_PAGESZ_256GB	14
+#define BOOKE_PAGESZ_1TB	15

 #if defined(CONFIG_MPC86xx)
 #define LAWBAR_BASE_ADDR	0x00FFFFFF
diff --git a/include/e500.h b/include/e500.h
index 0d73260..983826d 100644
--- a/include/e500.h
+++ b/include/e500.h
@@ -50,10 +50,7 @@ typedef struct
  * nv(Next victim):0,1
  */
 #define TLB1_MAS0(tlbsel,esel,nv) \
-			((((tlbsel) << 28) & MAS0_TLBSEL)       |\
-			(((esel) << 16) & MAS0_ESEL )           |\
-			(nv) )
-
+			(MAS0_TLBSEL(tlbsel) | MAS0_ESEL(esel) | MAS0_NV(nv))

 /* MAS1
  * v(TLB valid bit):0,1
@@ -65,10 +62,9 @@ typedef struct
 #define TLB1_MAS1(v,iprot,tid,ts,tsize) \
 			((((v) << 31) & MAS1_VALID)             |\
 			(((iprot) << 30) & MAS1_IPROT)          |\
-			(((tid) << 16) & MAS1_TID)              |\
+			(MAS1_TID(tid))				|\
 			(((ts) << 12) & MAS1_TS)                |\
-			(((tsize) << 8) & MAS1_TSIZE) )
-
+			(MAS1_TSIZE(tsize)))

 /* MAS2
  * epn(effective page number):20bits
@@ -79,7 +75,6 @@ typedef struct
  */
 #define TLB1_MAS2(epn,sharen,x0,x1,w,i,m,g,e) \
 			((((epn) << 12) & MAS2_EPN)             |\
-			(((sharen) << 9) & MAS2_SHAREN)         |\
 			(((x0) << 6) & MAS2_X0)                 |\
 			(((x1) << 5) & MAS2_X1)                 |\
 			(((w) << 4) & MAS2_W)                   |\
@@ -88,7 +83,6 @@ typedef struct
 			(((g) << 1) & MAS2_G)                   |\
 			(e) )

-
 /* MAS3
  * rpn(real page number):20bits
  * u0-u3(user bits, useful for page table management in OS):0,1
-- 
1.5.3.6





More information about the U-Boot mailing list