aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc64/mmu.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2005-07-13 04:11:42 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-13 14:25:25 -0400
commit96e2844999f99878fc5b03b81ccaa60580005b81 (patch)
tree353c1bc9a5602d556e6741f4a261010cde45e93b /include/asm-ppc64/mmu.h
parentf13487c66c75f5db004a0631047309d9e7c5aab7 (diff)
[PATCH] ppc64: kill bitfields in ppc64 hash code
This patch removes the use of bitfield types from the ppc64 hash table manipulation code. Signed-off-by: David Gibson <dwg@au1.ibm.com> Acked-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-ppc64/mmu.h')
-rw-r--r--include/asm-ppc64/mmu.h83
1 files changed, 29 insertions, 54 deletions
diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h
index f373de5e3dd9..3d07ddd11e3b 100644
--- a/include/asm-ppc64/mmu.h
+++ b/include/asm-ppc64/mmu.h
@@ -60,6 +60,22 @@
60 60
61#define HPTES_PER_GROUP 8 61#define HPTES_PER_GROUP 8
62 62
63#define HPTE_V_AVPN_SHIFT 7
64#define HPTE_V_AVPN ASM_CONST(0xffffffffffffff80)
65#define HPTE_V_AVPN_VAL(x) (((x) & HPTE_V_AVPN) >> HPTE_V_AVPN_SHIFT)
66#define HPTE_V_BOLTED ASM_CONST(0x0000000000000010)
67#define HPTE_V_LOCK ASM_CONST(0x0000000000000008)
68#define HPTE_V_LARGE ASM_CONST(0x0000000000000004)
69#define HPTE_V_SECONDARY ASM_CONST(0x0000000000000002)
70#define HPTE_V_VALID ASM_CONST(0x0000000000000001)
71
72#define HPTE_R_PP0 ASM_CONST(0x8000000000000000)
73#define HPTE_R_TS ASM_CONST(0x4000000000000000)
74#define HPTE_R_RPN_SHIFT 12
75#define HPTE_R_RPN ASM_CONST(0x3ffffffffffff000)
76#define HPTE_R_FLAGS ASM_CONST(0x00000000000003ff)
77#define HPTE_R_PP ASM_CONST(0x0000000000000003)
78
63/* Values for PP (assumes Ks=0, Kp=1) */ 79/* Values for PP (assumes Ks=0, Kp=1) */
64/* pp0 will always be 0 for linux */ 80/* pp0 will always be 0 for linux */
65#define PP_RWXX 0 /* Supervisor read/write, User none */ 81#define PP_RWXX 0 /* Supervisor read/write, User none */
@@ -69,54 +85,13 @@
69 85
70#ifndef __ASSEMBLY__ 86#ifndef __ASSEMBLY__
71 87
72/* Hardware Page Table Entry */
73typedef struct {
74 unsigned long avpn:57; /* vsid | api == avpn */
75 unsigned long : 2; /* Software use */
76 unsigned long bolted: 1; /* HPTE is "bolted" */
77 unsigned long lock: 1; /* lock on pSeries SMP */
78 unsigned long l: 1; /* Virtual page is large (L=1) or 4 KB (L=0) */
79 unsigned long h: 1; /* Hash function identifier */
80 unsigned long v: 1; /* Valid (v=1) or invalid (v=0) */
81} Hpte_dword0;
82
83typedef struct {
84 unsigned long pp0: 1; /* Page protection bit 0 */
85 unsigned long ts: 1; /* Tag set bit */
86 unsigned long rpn: 50; /* Real page number */
87 unsigned long : 2; /* Reserved */
88 unsigned long ac: 1; /* Address compare */
89 unsigned long r: 1; /* Referenced */
90 unsigned long c: 1; /* Changed */
91 unsigned long w: 1; /* Write-thru cache mode */
92 unsigned long i: 1; /* Cache inhibited */
93 unsigned long m: 1; /* Memory coherence required */
94 unsigned long g: 1; /* Guarded */
95 unsigned long n: 1; /* No-execute */
96 unsigned long pp: 2; /* Page protection bits 1:2 */
97} Hpte_dword1;
98
99typedef struct {
100 char padding[6]; /* padding */
101 unsigned long : 6; /* padding */
102 unsigned long flags: 10; /* HPTE flags */
103} Hpte_dword1_flags;
104
105typedef struct { 88typedef struct {
106 union { 89 unsigned long v;
107 unsigned long dword0; 90 unsigned long r;
108 Hpte_dword0 dw0; 91} hpte_t;
109 } dw0;
110
111 union {
112 unsigned long dword1;
113 Hpte_dword1 dw1;
114 Hpte_dword1_flags flags;
115 } dw1;
116} HPTE;
117 92
118extern HPTE * htab_address; 93extern hpte_t *htab_address;
119extern unsigned long htab_hash_mask; 94extern unsigned long htab_hash_mask;
120 95
121static inline unsigned long hpt_hash(unsigned long vpn, int large) 96static inline unsigned long hpt_hash(unsigned long vpn, int large)
122{ 97{
@@ -181,18 +156,18 @@ static inline void tlbiel(unsigned long va)
181 asm volatile("ptesync": : :"memory"); 156 asm volatile("ptesync": : :"memory");
182} 157}
183 158
184static inline unsigned long slot2va(unsigned long avpn, unsigned long large, 159static inline unsigned long slot2va(unsigned long hpte_v, unsigned long slot)
185 unsigned long secondary, unsigned long slot)
186{ 160{
161 unsigned long avpn = HPTE_V_AVPN_VAL(hpte_v);
187 unsigned long va; 162 unsigned long va;
188 163
189 va = avpn << 23; 164 va = avpn << 23;
190 165
191 if (!large) { 166 if (! (hpte_v & HPTE_V_LARGE)) {
192 unsigned long vpi, pteg; 167 unsigned long vpi, pteg;
193 168
194 pteg = slot / HPTES_PER_GROUP; 169 pteg = slot / HPTES_PER_GROUP;
195 if (secondary) 170 if (hpte_v & HPTE_V_SECONDARY)
196 pteg = ~pteg; 171 pteg = ~pteg;
197 172
198 vpi = ((va >> 28) ^ pteg) & htab_hash_mask; 173 vpi = ((va >> 28) ^ pteg) & htab_hash_mask;
@@ -219,11 +194,11 @@ extern void hpte_init_iSeries(void);
219 194
220extern long pSeries_lpar_hpte_insert(unsigned long hpte_group, 195extern long pSeries_lpar_hpte_insert(unsigned long hpte_group,
221 unsigned long va, unsigned long prpn, 196 unsigned long va, unsigned long prpn,
222 int secondary, unsigned long hpteflags, 197 unsigned long vflags,
223 int bolted, int large); 198 unsigned long rflags);
224extern long native_hpte_insert(unsigned long hpte_group, unsigned long va, 199extern long native_hpte_insert(unsigned long hpte_group, unsigned long va,
225 unsigned long prpn, int secondary, 200 unsigned long prpn,
226 unsigned long hpteflags, int bolted, int large); 201 unsigned long vflags, unsigned long rflags);
227 202
228#endif /* __ASSEMBLY__ */ 203#endif /* __ASSEMBLY__ */
229 204