Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _ASM_M32R_PGALLOC_H |
| 2 | #define _ASM_M32R_PGALLOC_H |
| 3 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | #include <linux/mm.h> |
| 5 | |
| 6 | #include <asm/io.h> |
| 7 | |
| 8 | #define pmd_populate_kernel(mm, pmd, pte) \ |
| 9 | set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) |
| 10 | |
| 11 | static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd, |
| 12 | struct page *pte) |
| 13 | { |
| 14 | set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte))); |
| 15 | } |
| 16 | |
| 17 | /* |
| 18 | * Allocate and free page tables. |
| 19 | */ |
| 20 | static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm) |
| 21 | { |
| 22 | pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO); |
| 23 | |
| 24 | return pgd; |
| 25 | } |
| 26 | |
Benjamin Herrenschmidt | 5e54197 | 2008-02-04 22:29:14 -0800 | [diff] [blame] | 27 | static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | { |
| 29 | free_page((unsigned long)pgd); |
| 30 | } |
| 31 | |
| 32 | static __inline__ pte_t *pte_alloc_one_kernel(struct mm_struct *mm, |
| 33 | unsigned long address) |
| 34 | { |
| 35 | pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO); |
| 36 | |
| 37 | return pte; |
| 38 | } |
| 39 | |
| 40 | static __inline__ struct page *pte_alloc_one(struct mm_struct *mm, |
| 41 | unsigned long address) |
| 42 | { |
| 43 | struct page *pte = alloc_page(GFP_KERNEL|__GFP_ZERO); |
| 44 | |
| 45 | |
| 46 | return pte; |
| 47 | } |
| 48 | |
Benjamin Herrenschmidt | 5e54197 | 2008-02-04 22:29:14 -0800 | [diff] [blame] | 49 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | { |
| 51 | free_page((unsigned long)pte); |
| 52 | } |
| 53 | |
Benjamin Herrenschmidt | 5e54197 | 2008-02-04 22:29:14 -0800 | [diff] [blame] | 54 | static inline void pte_free(struct mm_struct *mm, struct page *pte) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | { |
| 56 | __free_page(pte); |
| 57 | } |
| 58 | |
Benjamin Herrenschmidt | 5e54197 | 2008-02-04 22:29:14 -0800 | [diff] [blame] | 59 | #define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, (pte)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | |
| 61 | /* |
| 62 | * allocating and freeing a pmd is trivial: the 1-entry pmd is |
| 63 | * inside the pgd, so has no extra memory associated with it. |
| 64 | * (In the PAE case we free the pmds as part of the pgd.) |
| 65 | */ |
| 66 | |
| 67 | #define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); }) |
Benjamin Herrenschmidt | 5e54197 | 2008-02-04 22:29:14 -0800 | [diff] [blame] | 68 | #define pmd_free(mm, x) do { } while (0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | #define __pmd_free_tlb(tlb, x) do { } while (0) |
| 70 | #define pgd_populate(mm, pmd, pte) BUG() |
| 71 | |
| 72 | #define check_pgt_cache() do { } while (0) |
| 73 | |
| 74 | #endif /* _ASM_M32R_PGALLOC_H */ |