spi-topcliff-pch: supports a spi mode setup and bit order setup by IO control
[zen-stable.git] / arch / sh / include / asm / pgalloc.h
blob8c00785c60d5b2517dd83c3b75b7ac50b0d10e1d
1 #ifndef __ASM_SH_PGALLOC_H
2 #define __ASM_SH_PGALLOC_H
4 #include <linux/quicklist.h>
5 #include <asm/page.h>
7 #define QUICK_PT 0 /* Other page table pages that are zero on free */
9 extern pgd_t *pgd_alloc(struct mm_struct *);
10 extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
12 #if PAGETABLE_LEVELS > 2
13 extern void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd);
14 extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address);
15 extern void pmd_free(struct mm_struct *mm, pmd_t *pmd);
16 #endif
18 static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
19 pte_t *pte)
21 set_pmd(pmd, __pmd((unsigned long)pte));
24 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
25 pgtable_t pte)
27 set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
29 #define pmd_pgtable(pmd) pmd_page(pmd)
32 * Allocate and free page tables.
34 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
35 unsigned long address)
37 return quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL);
40 static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
41 unsigned long address)
43 struct page *page;
44 void *pg;
46 pg = quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL);
47 if (!pg)
48 return NULL;
49 page = virt_to_page(pg);
50 pgtable_page_ctor(page);
51 return page;
54 static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
56 quicklist_free(QUICK_PT, NULL, pte);
59 static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
61 pgtable_page_dtor(pte);
62 quicklist_free_page(QUICK_PT, NULL, pte);
65 #define __pte_free_tlb(tlb,pte,addr) \
66 do { \
67 pgtable_page_dtor(pte); \
68 tlb_remove_page((tlb), (pte)); \
69 } while (0)
71 static inline void check_pgt_cache(void)
73 quicklist_trim(QUICK_PT, NULL, 25, 16);
76 #endif /* __ASM_SH_PGALLOC_H */