1 /* $Id: pgalloc.h,v 1.15 2001/10/18 09:06:37 davem Exp $ */
2 #ifndef _SPARC_PGALLOC_H
3 #define _SPARC_PGALLOC_H
5 #include <linux/config.h>
6 #include <linux/kernel.h>
7 #include <linux/sched.h>
10 #include <asm/btfixup.h>
12 /* Fine grained cache/tlb flushing. */
14 BTFIXUPDEF_CALL(void, local_flush_cache_all, void)
15 BTFIXUPDEF_CALL(void, local_flush_cache_mm, struct mm_struct *)
16 BTFIXUPDEF_CALL(void, local_flush_cache_range, struct mm_struct *, unsigned long, unsigned long)
17 BTFIXUPDEF_CALL(void, local_flush_cache_page, struct vm_area_struct *, unsigned long)
19 #define local_flush_cache_all() BTFIXUP_CALL(local_flush_cache_all)()
20 #define local_flush_cache_mm(mm) BTFIXUP_CALL(local_flush_cache_mm)(mm)
21 #define local_flush_cache_range(mm,start,end) BTFIXUP_CALL(local_flush_cache_range)(mm,start,end)
22 #define local_flush_cache_page(vma,addr) BTFIXUP_CALL(local_flush_cache_page)(vma,addr)
24 BTFIXUPDEF_CALL(void, local_flush_tlb_all, void)
25 BTFIXUPDEF_CALL(void, local_flush_tlb_mm, struct mm_struct *)
26 BTFIXUPDEF_CALL(void, local_flush_tlb_range, struct mm_struct *, unsigned long, unsigned long)
27 BTFIXUPDEF_CALL(void, local_flush_tlb_page, struct vm_area_struct *, unsigned long)
29 #define local_flush_tlb_all() BTFIXUP_CALL(local_flush_tlb_all)()
30 #define local_flush_tlb_mm(mm) BTFIXUP_CALL(local_flush_tlb_mm)(mm)
31 #define local_flush_tlb_range(mm,start,end) BTFIXUP_CALL(local_flush_tlb_range)(mm,start,end)
32 #define local_flush_tlb_page(vma,addr) BTFIXUP_CALL(local_flush_tlb_page)(vma,addr)
34 BTFIXUPDEF_CALL(void, local_flush_page_to_ram, unsigned long)
35 BTFIXUPDEF_CALL(void, local_flush_sig_insns, struct mm_struct *, unsigned long)
37 #define local_flush_page_to_ram(addr) BTFIXUP_CALL(local_flush_page_to_ram)(addr)
38 #define local_flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(local_flush_sig_insns)(mm,insn_addr)
40 extern void smp_flush_cache_all(void);
41 extern void smp_flush_cache_mm(struct mm_struct *mm);
42 extern void smp_flush_cache_range(struct mm_struct *mm,
45 extern void smp_flush_cache_page(struct vm_area_struct *vma, unsigned long page);
47 extern void smp_flush_tlb_all(void);
48 extern void smp_flush_tlb_mm(struct mm_struct *mm);
49 extern void smp_flush_tlb_range(struct mm_struct *mm,
52 extern void smp_flush_tlb_page(struct vm_area_struct *mm, unsigned long page);
53 extern void smp_flush_page_to_ram(unsigned long page);
54 extern void smp_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr);
57 BTFIXUPDEF_CALL(void, flush_cache_all, void)
58 BTFIXUPDEF_CALL(void, flush_cache_mm, struct mm_struct *)
59 BTFIXUPDEF_CALL(void, flush_cache_range, struct mm_struct *, unsigned long, unsigned long)
60 BTFIXUPDEF_CALL(void, flush_cache_page, struct vm_area_struct *, unsigned long)
62 #define flush_cache_all() BTFIXUP_CALL(flush_cache_all)()
63 #define flush_cache_mm(mm) BTFIXUP_CALL(flush_cache_mm)(mm)
64 #define flush_cache_range(mm,start,end) BTFIXUP_CALL(flush_cache_range)(mm,start,end)
65 #define flush_cache_page(vma,addr) BTFIXUP_CALL(flush_cache_page)(vma,addr)
66 #define flush_icache_range(start, end) do { } while (0)
68 BTFIXUPDEF_CALL(void, flush_tlb_all, void)
69 BTFIXUPDEF_CALL(void, flush_tlb_mm, struct mm_struct *)
70 BTFIXUPDEF_CALL(void, flush_tlb_range, struct mm_struct *, unsigned long, unsigned long)
71 BTFIXUPDEF_CALL(void, flush_tlb_page, struct vm_area_struct *, unsigned long)
73 extern __inline__ void flush_tlb_pgtables(struct mm_struct *mm, unsigned long start, unsigned long end)
77 #define flush_tlb_all() BTFIXUP_CALL(flush_tlb_all)()
78 #define flush_tlb_mm(mm) BTFIXUP_CALL(flush_tlb_mm)(mm)
79 #define flush_tlb_range(mm,start,end) BTFIXUP_CALL(flush_tlb_range)(mm,start,end)
80 #define flush_tlb_page(vma,addr) BTFIXUP_CALL(flush_tlb_page)(vma,addr)
82 BTFIXUPDEF_CALL(void, __flush_page_to_ram, unsigned long)
83 BTFIXUPDEF_CALL(void, flush_sig_insns, struct mm_struct *, unsigned long)
85 #define __flush_page_to_ram(addr) BTFIXUP_CALL(__flush_page_to_ram)(addr)
86 #define flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(flush_sig_insns)(mm,insn_addr)
88 extern void flush_page_to_ram(struct page *page);
90 #define flush_dcache_page(page) do { } while (0)
92 extern struct pgtable_cache_struct {
93 unsigned long *pgd_cache;
94 unsigned long *pte_cache;
95 unsigned long pgtable_cache_sz;
96 unsigned long pgd_cache_sz;
98 #define pgd_quicklist (pgt_quicklists.pgd_cache)
99 #define pmd_quicklist ((unsigned long *)0)
100 #define pte_quicklist (pgt_quicklists.pte_cache)
101 #define pgtable_cache_size (pgt_quicklists.pgtable_cache_sz)
102 #define pgd_cache_size (pgt_quicklists.pgd_cache_sz)
104 BTFIXUPDEF_CALL(int, do_check_pgt_cache, int, int)
105 #define do_check_pgt_cache(low,high) BTFIXUP_CALL(do_check_pgt_cache)(low,high)
107 BTFIXUPDEF_CALL(pgd_t *, get_pgd_fast, void)
108 #define get_pgd_fast() BTFIXUP_CALL(get_pgd_fast)()
110 BTFIXUPDEF_CALL(void, free_pgd_fast, pgd_t *)
111 #define free_pgd_fast(pgd) BTFIXUP_CALL(free_pgd_fast)(pgd)
113 #define pgd_free(pgd) free_pgd_fast(pgd)
114 #define pgd_alloc(mm) get_pgd_fast()
116 #define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD)
118 static __inline__ pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
123 BTFIXUPDEF_CALL(pmd_t *, pmd_alloc_one_fast, struct mm_struct *, unsigned long)
124 #define pmd_alloc_one_fast(mm, address) BTFIXUP_CALL(pmd_alloc_one_fast)(mm, address)
126 BTFIXUPDEF_CALL(void, free_pmd_fast, pmd_t *)
127 #define free_pmd_fast(pmd) BTFIXUP_CALL(free_pmd_fast)(pmd)
129 #define pmd_free(pmd) free_pmd_fast(pmd)
131 #define pmd_populate(MM, PMD, PTE) pmd_set(PMD, PTE)
133 BTFIXUPDEF_CALL(pte_t *, pte_alloc_one, struct mm_struct *, unsigned long)
134 #define pte_alloc_one(mm, address) BTFIXUP_CALL(pte_alloc_one)(mm, address)
136 BTFIXUPDEF_CALL(pte_t *, pte_alloc_one_fast, struct mm_struct *, unsigned long)
137 #define pte_alloc_one_fast(mm, address) BTFIXUP_CALL(pte_alloc_one_fast)(mm, address)
139 BTFIXUPDEF_CALL(void, free_pte_fast, pte_t *)
140 #define free_pte_fast(pte) BTFIXUP_CALL(free_pte_fast)(pte)
142 #define pte_free(pte) free_pte_fast(pte)
144 #endif /* _SPARC_PGALLOC_H */