efivars: Refactor sanity checking code into separate function
[linux/fpc-iii.git] / arch / score / include / asm / tlbflush.h
blob9cce978367d5ff2ca375a32e02d52d0ef7beee68
1 #ifndef _ASM_SCORE_TLBFLUSH_H
2 #define _ASM_SCORE_TLBFLUSH_H
4 #include <linux/mm.h>
6 /*
7 * TLB flushing:
9 * - flush_tlb_all() flushes all processes TLB entries
10 * - flush_tlb_mm(mm) flushes the specified mm context TLB entries
11 * - flush_tlb_page(vma, vmaddr) flushes one page
12 * - flush_tlb_range(vma, start, end) flushes a range of pages
13 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
15 extern void local_flush_tlb_all(void);
16 extern void local_flush_tlb_mm(struct mm_struct *mm);
17 extern void local_flush_tlb_range(struct vm_area_struct *vma,
18 unsigned long start, unsigned long end);
19 extern void local_flush_tlb_kernel_range(unsigned long start,
20 unsigned long end);
21 extern void local_flush_tlb_page(struct vm_area_struct *vma,
22 unsigned long page);
23 extern void local_flush_tlb_one(unsigned long vaddr);
25 #define flush_tlb_all() local_flush_tlb_all()
26 #define flush_tlb_mm(mm) local_flush_tlb_mm(mm)
27 #define flush_tlb_range(vma, vmaddr, end) \
28 local_flush_tlb_range(vma, vmaddr, end)
29 #define flush_tlb_kernel_range(vmaddr, end) \
30 local_flush_tlb_kernel_range(vmaddr, end)
31 #define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page)
32 #define flush_tlb_one(vaddr) local_flush_tlb_one(vaddr)
34 #ifndef __ASSEMBLY__
36 static inline unsigned long pevn_get(void)
38 unsigned long val;
40 __asm__ __volatile__(
41 "mfcr %0, cr11\n"
42 "nop\nnop\n"
43 : "=r" (val));
45 return val;
48 static inline void pevn_set(unsigned long val)
50 __asm__ __volatile__(
51 "mtcr %0, cr11\n"
52 "nop\nnop\nnop\nnop\nnop\n"
53 : : "r" (val));
56 static inline void pectx_set(unsigned long val)
58 __asm__ __volatile__(
59 "mtcr %0, cr12\n"
60 "nop\nnop\nnop\nnop\nnop\n"
61 : : "r" (val));
64 static inline unsigned long pectx_get(void)
66 unsigned long val;
67 __asm__ __volatile__(
68 "mfcr %0, cr12\n"
69 "nop\nnop\n"
70 : "=r" (val));
71 return val;
73 static inline unsigned long tlblock_get(void)
75 unsigned long val;
77 __asm__ __volatile__(
78 "mfcr %0, cr7\n"
79 "nop\nnop\n"
80 : "=r" (val));
81 return val;
83 static inline void tlblock_set(unsigned long val)
85 __asm__ __volatile__(
86 "mtcr %0, cr7\n"
87 "nop\nnop\nnop\nnop\nnop\n"
88 : : "r" (val));
91 static inline void tlbpt_set(unsigned long val)
93 __asm__ __volatile__(
94 "mtcr %0, cr8\n"
95 "nop\nnop\nnop\nnop\nnop\n"
96 : : "r" (val));
99 static inline long tlbpt_get(void)
101 long val;
103 __asm__ __volatile__(
104 "mfcr %0, cr8\n"
105 "nop\nnop\n"
106 : "=r" (val));
108 return val;
111 static inline void peaddr_set(unsigned long val)
113 __asm__ __volatile__(
114 "mtcr %0, cr9\n"
115 "nop\nnop\nnop\nnop\nnop\n"
116 : : "r" (val));
119 /* TLB operations. */
120 static inline void tlb_probe(void)
122 __asm__ __volatile__("stlb;nop;nop;nop;nop;nop");
125 static inline void tlb_read(void)
127 __asm__ __volatile__("mftlb;nop;nop;nop;nop;nop");
130 static inline void tlb_write_indexed(void)
132 __asm__ __volatile__("mtptlb;nop;nop;nop;nop;nop");
135 static inline void tlb_write_random(void)
137 __asm__ __volatile__("mtrtlb;nop;nop;nop;nop;nop");
140 #endif /* Not __ASSEMBLY__ */
142 #endif /* _ASM_SCORE_TLBFLUSH_H */