diff options
author | Dave McCracken <dmccr@us.ibm.com> | 2006-09-26 02:31:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-26 11:48:51 -0400 |
commit | 46a82b2d5591335277ed2930611f6acb4ce654ed (patch) | |
tree | e90bc1843701af2012bae92564f7109027a8244f /include/asm-alpha | |
parent | d2e7b7d0aa021847c59f882b066e7d3812902870 (diff) |
[PATCH] Standardize pxx_page macros
One of the changes necessary for shared page tables is to standardize the
pxx_page macros. pte_page and pmd_page have always returned the struct
page associated with their entry, while pte_page_kernel and pmd_page_kernel
have returned the kernel virtual address. pud_page and pgd_page, on the
other hand, return the kernel virtual address.
Shared page tables needs pud_page and pgd_page to return the actual page
structures. There are very few actual users of these functions, so it is
simple to standardize their usage.
Since this is basic cleanup, I am submitting these changes as a standalone
patch. Per Hugh Dickins' comments about it, I am also changing the
pxx_page_kernel macros to pxx_page_vaddr to clarify their meaning.
Signed-off-by: Dave McCracken <dmccr@us.ibm.com>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-alpha')
-rw-r--r-- | include/asm-alpha/mmzone.h | 1 | ||||
-rw-r--r-- | include/asm-alpha/pgtable.h | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/include/asm-alpha/mmzone.h b/include/asm-alpha/mmzone.h index 64d0ab98fcd8..8af56ce346ad 100644 --- a/include/asm-alpha/mmzone.h +++ b/include/asm-alpha/mmzone.h | |||
@@ -75,6 +75,7 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) | |||
75 | #define VALID_PAGE(page) (((page) - mem_map) < max_mapnr) | 75 | #define VALID_PAGE(page) (((page) - mem_map) < max_mapnr) |
76 | 76 | ||
77 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32)) | 77 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32)) |
78 | #define pgd_page(pgd) (pfn_to_page(pgd_val(pgd) >> 32)) | ||
78 | #define pte_pfn(pte) (pte_val(pte) >> 32) | 79 | #define pte_pfn(pte) (pte_val(pte) >> 32) |
79 | 80 | ||
80 | #define mk_pte(page, pgprot) \ | 81 | #define mk_pte(page, pgprot) \ |
diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h index 93eaa58b7961..49ac9bee7ced 100644 --- a/include/asm-alpha/pgtable.h +++ b/include/asm-alpha/pgtable.h | |||
@@ -230,16 +230,17 @@ extern inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp) | |||
230 | 230 | ||
231 | 231 | ||
232 | extern inline unsigned long | 232 | extern inline unsigned long |
233 | pmd_page_kernel(pmd_t pmd) | 233 | pmd_page_vaddr(pmd_t pmd) |
234 | { | 234 | { |
235 | return ((pmd_val(pmd) & _PFN_MASK) >> (32-PAGE_SHIFT)) + PAGE_OFFSET; | 235 | return ((pmd_val(pmd) & _PFN_MASK) >> (32-PAGE_SHIFT)) + PAGE_OFFSET; |
236 | } | 236 | } |
237 | 237 | ||
238 | #ifndef CONFIG_DISCONTIGMEM | 238 | #ifndef CONFIG_DISCONTIGMEM |
239 | #define pmd_page(pmd) (mem_map + ((pmd_val(pmd) & _PFN_MASK) >> 32)) | 239 | #define pmd_page(pmd) (mem_map + ((pmd_val(pmd) & _PFN_MASK) >> 32)) |
240 | #define pgd_page(pgd) (mem_map + ((pgd_val(pgd) & _PFN_MASK) >> 32)) | ||
240 | #endif | 241 | #endif |
241 | 242 | ||
242 | extern inline unsigned long pgd_page(pgd_t pgd) | 243 | extern inline unsigned long pgd_page_vaddr(pgd_t pgd) |
243 | { return PAGE_OFFSET + ((pgd_val(pgd) & _PFN_MASK) >> (32-PAGE_SHIFT)); } | 244 | { return PAGE_OFFSET + ((pgd_val(pgd) & _PFN_MASK) >> (32-PAGE_SHIFT)); } |
244 | 245 | ||
245 | extern inline int pte_none(pte_t pte) { return !pte_val(pte); } | 246 | extern inline int pte_none(pte_t pte) { return !pte_val(pte); } |
@@ -293,13 +294,13 @@ extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; retu | |||
293 | /* Find an entry in the second-level page table.. */ | 294 | /* Find an entry in the second-level page table.. */ |
294 | extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | 295 | extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) |
295 | { | 296 | { |
296 | return (pmd_t *) pgd_page(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1)); | 297 | return (pmd_t *) pgd_page_vaddr(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1)); |
297 | } | 298 | } |
298 | 299 | ||
299 | /* Find an entry in the third-level page table.. */ | 300 | /* Find an entry in the third-level page table.. */ |
300 | extern inline pte_t * pte_offset_kernel(pmd_t * dir, unsigned long address) | 301 | extern inline pte_t * pte_offset_kernel(pmd_t * dir, unsigned long address) |
301 | { | 302 | { |
302 | return (pte_t *) pmd_page_kernel(*dir) | 303 | return (pte_t *) pmd_page_vaddr(*dir) |
303 | + ((address >> PAGE_SHIFT) & (PTRS_PER_PAGE - 1)); | 304 | + ((address >> PAGE_SHIFT) & (PTRS_PER_PAGE - 1)); |
304 | } | 305 | } |
305 | 306 | ||