x86/mm/pat: Don't report PAT on CPUs that don't support it
[linux/fpc-iii.git] / arch / m68k / include / asm / motorola_pgalloc.h
blobc895b987202cd07fbc9f38ad727bf79b53587a29
1 #ifndef _MOTOROLA_PGALLOC_H
2 #define _MOTOROLA_PGALLOC_H
4 #include <asm/tlb.h>
5 #include <asm/tlbflush.h>
7 extern pmd_t *get_pointer_table(void);
8 extern int free_pointer_table(pmd_t *);
10 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
12 pte_t *pte;
14 pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
15 if (pte) {
16 __flush_page_to_ram(pte);
17 flush_tlb_kernel_page(pte);
18 nocache_page(pte);
21 return pte;
24 static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
26 cache_page(pte);
27 free_page((unsigned long) pte);
30 static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
32 struct page *page;
33 pte_t *pte;
35 page = alloc_pages(GFP_KERNEL|__GFP_ZERO, 0);
36 if(!page)
37 return NULL;
38 if (!pgtable_page_ctor(page)) {
39 __free_page(page);
40 return NULL;
43 pte = kmap(page);
44 __flush_page_to_ram(pte);
45 flush_tlb_kernel_page(pte);
46 nocache_page(pte);
47 kunmap(page);
48 return page;
51 static inline void pte_free(struct mm_struct *mm, pgtable_t page)
53 pgtable_page_dtor(page);
54 cache_page(kmap(page));
55 kunmap(page);
56 __free_page(page);
59 static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page,
60 unsigned long address)
62 pgtable_page_dtor(page);
63 cache_page(kmap(page));
64 kunmap(page);
65 __free_page(page);
69 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
71 return get_pointer_table();
74 static inline int pmd_free(struct mm_struct *mm, pmd_t *pmd)
76 return free_pointer_table(pmd);
79 static inline int __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
80 unsigned long address)
82 return free_pointer_table(pmd);
86 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
88 pmd_free(mm, (pmd_t *)pgd);
91 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
93 return (pgd_t *)get_pointer_table();
97 static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
99 pmd_set(pmd, pte);
102 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t page)
104 pmd_set(pmd, page_address(page));
106 #define pmd_pgtable(pmd) pmd_page(pmd)
108 static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
110 pgd_set(pgd, pmd);
113 #endif /* _MOTOROLA_PGALLOC_H */