alpha: fixes for specific machine types
[pv_ops_mirror.git] / include / asm-alpha / pgalloc.h
blob471864e8d4c370d17d3ff5a672c95cc71444087a
1 #ifndef _ALPHA_PGALLOC_H
2 #define _ALPHA_PGALLOC_H
4 #include <linux/mm.h>
5 #include <linux/mmzone.h>
7 /*
8 * Allocate and free page tables. The xxx_kernel() versions are
9 * used to allocate a kernel page table - this turns on ASN bits
10 * if any.
13 static inline void
14 pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte)
16 pmd_set(pmd, (pte_t *)(page_to_pa(pte) + PAGE_OFFSET));
19 static inline void
20 pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
22 pmd_set(pmd, pte);
25 static inline void
26 pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
28 pgd_set(pgd, pmd);
31 extern pgd_t *pgd_alloc(struct mm_struct *mm);
33 static inline void
34 pgd_free(pgd_t *pgd)
36 free_page((unsigned long)pgd);
39 static inline pmd_t *
40 pmd_alloc_one(struct mm_struct *mm, unsigned long address)
42 pmd_t *ret = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
43 return ret;
46 static inline void
47 pmd_free(pmd_t *pmd)
49 free_page((unsigned long)pmd);
52 extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr);
54 static inline void
55 pte_free_kernel(pte_t *pte)
57 free_page((unsigned long)pte);
60 static inline struct page *
61 pte_alloc_one(struct mm_struct *mm, unsigned long addr)
63 pte_t *pte = pte_alloc_one_kernel(mm, addr);
64 if (pte)
65 return virt_to_page(pte);
66 return NULL;
69 static inline void
70 pte_free(struct page *page)
72 __free_page(page);
75 #define check_pgt_cache() do { } while (0)
77 #endif /* _ALPHA_PGALLOC_H */