diff options
Diffstat (limited to 'include/asm-mips/pgtable-32.h')
-rw-r--r-- | include/asm-mips/pgtable-32.h | 61 |
1 files changed, 40 insertions, 21 deletions
diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h index e1c0e88f03f5..4b26d8528133 100644 --- a/include/asm-mips/pgtable-32.h +++ b/include/asm-mips/pgtable-32.h | |||
@@ -176,48 +176,67 @@ pfn_pte(unsigned long pfn, pgprot_t prot) | |||
176 | ((swp_entry_t) { ((type) << 10) | ((offset) << 15) }) | 176 | ((swp_entry_t) { ((type) << 10) | ((offset) << 15) }) |
177 | 177 | ||
178 | /* | 178 | /* |
179 | * Bits 0, 1, 2, 9 and 10 are taken, split up the 27 bits of offset | 179 | * Bits 0, 4, 8, and 9 are taken, split up 28 bits of offset into this range: |
180 | * into this range: | ||
181 | */ | 180 | */ |
182 | #define PTE_FILE_MAX_BITS 27 | 181 | #define PTE_FILE_MAX_BITS 28 |
183 | 182 | ||
184 | #define pte_to_pgoff(_pte) \ | 183 | #define pte_to_pgoff(_pte) ((((_pte).pte >> 1 ) & 0x07) | \ |
185 | ((((_pte).pte >> 3) & 0x3f ) + (((_pte).pte >> 11) << 8 )) | 184 | (((_pte).pte >> 2 ) & 0x38) | \ |
185 | (((_pte).pte >> 10) << 6 )) | ||
186 | 186 | ||
187 | #define pgoff_to_pte(off) \ | 187 | #define pgoff_to_pte(off) ((pte_t) { (((off) & 0x07) << 1 ) | \ |
188 | ((pte_t) { (((off) & 0x3f) << 3) + (((off) >> 8) << 11) + _PAGE_FILE }) | 188 | (((off) & 0x38) << 2 ) | \ |
189 | (((off) >> 6 ) << 10) | \ | ||
190 | _PAGE_FILE }) | ||
189 | 191 | ||
190 | #else | 192 | #else |
191 | 193 | ||
192 | /* Swap entries must have VALID and GLOBAL bits cleared. */ | 194 | /* Swap entries must have VALID and GLOBAL bits cleared. */ |
195 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) | ||
196 | #define __swp_type(x) (((x).val >> 2) & 0x1f) | ||
197 | #define __swp_offset(x) ((x).val >> 7) | ||
198 | #define __swp_entry(type,offset) \ | ||
199 | ((swp_entry_t) { ((type) << 2) | ((offset) << 7) }) | ||
200 | #else | ||
193 | #define __swp_type(x) (((x).val >> 8) & 0x1f) | 201 | #define __swp_type(x) (((x).val >> 8) & 0x1f) |
194 | #define __swp_offset(x) ((x).val >> 13) | 202 | #define __swp_offset(x) ((x).val >> 13) |
195 | #define __swp_entry(type,offset) \ | 203 | #define __swp_entry(type,offset) \ |
196 | ((swp_entry_t) { ((type) << 8) | ((offset) << 13) }) | 204 | ((swp_entry_t) { ((type) << 8) | ((offset) << 13) }) |
205 | #endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */ | ||
197 | 206 | ||
207 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) | ||
198 | /* | 208 | /* |
199 | * Bits 0, 1, 2, 7 and 8 are taken, split up the 27 bits of offset | 209 | * Bits 0 and 1 of pte_high are taken, use the rest for the page offset... |
200 | * into this range: | ||
201 | */ | 210 | */ |
202 | #define PTE_FILE_MAX_BITS 27 | 211 | #define PTE_FILE_MAX_BITS 30 |
203 | 212 | ||
204 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) | 213 | #define pte_to_pgoff(_pte) ((_pte).pte_high >> 2) |
205 | /* fixme */ | 214 | #define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) << 2 }) |
206 | #define pte_to_pgoff(_pte) (((_pte).pte_high >> 6) + ((_pte).pte_high & 0x3f)) | ||
207 | #define pgoff_to_pte(off) \ | ||
208 | ((pte_t){(((off) & 0x3f) + ((off) << 6) + _PAGE_FILE)}) | ||
209 | 215 | ||
210 | #else | 216 | #else |
211 | #define pte_to_pgoff(_pte) \ | 217 | /* |
212 | ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 )) | 218 | * Bits 0, 4, 6, and 7 are taken, split up 28 bits of offset into this range: |
219 | */ | ||
220 | #define PTE_FILE_MAX_BITS 28 | ||
221 | |||
222 | #define pte_to_pgoff(_pte) ((((_pte).pte >> 1) & 0x7) | \ | ||
223 | (((_pte).pte >> 2) & 0x8) | \ | ||
224 | (((_pte).pte >> 8) << 4)) | ||
213 | 225 | ||
214 | #define pgoff_to_pte(off) \ | 226 | #define pgoff_to_pte(off) ((pte_t) { (((off) & 0x7) << 1) | \ |
215 | ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE }) | 227 | (((off) & 0x8) << 2) | \ |
228 | (((off) >> 4) << 8) | \ | ||
229 | _PAGE_FILE }) | ||
216 | #endif | 230 | #endif |
217 | 231 | ||
218 | #endif | 232 | #endif |
219 | 233 | ||
234 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) | ||
235 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_high }) | ||
236 | #define __swp_entry_to_pte(x) ((pte_t) { 0, (x).val }) | ||
237 | #else | ||
220 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) | 238 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) |
221 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | 239 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) |
240 | #endif | ||
222 | 241 | ||
223 | #endif /* _ASM_PGTABLE_32_H */ | 242 | #endif /* _ASM_PGTABLE_32_H */ |