Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 1 | #ifndef _ASM_SCORE_TLBFLUSH_H |
| 2 | #define _ASM_SCORE_TLBFLUSH_H |
| 3 | |
| 4 | #include <linux/mm.h> |
| 5 | |
| 6 | /* |
| 7 | * TLB flushing: |
| 8 | * |
| 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 |
| 14 | */ |
| 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); |
| 24 | |
| 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) |
| 33 | |
| 34 | #ifndef __ASSEMBLY__ |
| 35 | |
| 36 | static inline unsigned long pevn_get(void) |
| 37 | { |
| 38 | unsigned long val; |
| 39 | |
| 40 | __asm__ __volatile__( |
| 41 | "mfcr %0, cr11\n" |
| 42 | "nop\nnop\n" |
| 43 | : "=r" (val)); |
| 44 | |
| 45 | return val; |
| 46 | } |
| 47 | |
| 48 | static inline void pevn_set(unsigned long val) |
| 49 | { |
| 50 | __asm__ __volatile__( |
| 51 | "mtcr %0, cr11\n" |
| 52 | "nop\nnop\nnop\nnop\nnop\n" |
| 53 | : : "r" (val)); |
| 54 | } |
| 55 | |
| 56 | static inline void pectx_set(unsigned long val) |
| 57 | { |
| 58 | __asm__ __volatile__( |
| 59 | "mtcr %0, cr12\n" |
| 60 | "nop\nnop\nnop\nnop\nnop\n" |
| 61 | : : "r" (val)); |
| 62 | } |
| 63 | |
| 64 | static inline unsigned long pectx_get(void) |
| 65 | { |
| 66 | unsigned long val; |
| 67 | __asm__ __volatile__( |
| 68 | "mfcr %0, cr12\n" |
| 69 | "nop\nnop\n" |
| 70 | : "=r" (val)); |
| 71 | return val; |
| 72 | } |
| 73 | static inline unsigned long tlblock_get(void) |
| 74 | { |
| 75 | unsigned long val; |
| 76 | |
| 77 | __asm__ __volatile__( |
| 78 | "mfcr %0, cr7\n" |
| 79 | "nop\nnop\n" |
| 80 | : "=r" (val)); |
| 81 | return val; |
| 82 | } |
| 83 | static inline void tlblock_set(unsigned long val) |
| 84 | { |
| 85 | __asm__ __volatile__( |
| 86 | "mtcr %0, cr7\n" |
| 87 | "nop\nnop\nnop\nnop\nnop\n" |
| 88 | : : "r" (val)); |
| 89 | } |
| 90 | |
| 91 | static inline void tlbpt_set(unsigned long val) |
| 92 | { |
| 93 | __asm__ __volatile__( |
| 94 | "mtcr %0, cr8\n" |
| 95 | "nop\nnop\nnop\nnop\nnop\n" |
| 96 | : : "r" (val)); |
| 97 | } |
| 98 | |
| 99 | static inline long tlbpt_get(void) |
| 100 | { |
| 101 | long val; |
| 102 | |
| 103 | __asm__ __volatile__( |
| 104 | "mfcr %0, cr8\n" |
| 105 | "nop\nnop\n" |
| 106 | : "=r" (val)); |
| 107 | |
| 108 | return val; |
| 109 | } |
| 110 | |
| 111 | static inline void peaddr_set(unsigned long val) |
| 112 | { |
| 113 | __asm__ __volatile__( |
| 114 | "mtcr %0, cr9\n" |
| 115 | "nop\nnop\nnop\nnop\nnop\n" |
| 116 | : : "r" (val)); |
| 117 | } |
| 118 | |
| 119 | /* TLB operations. */ |
| 120 | static inline void tlb_probe(void) |
| 121 | { |
| 122 | __asm__ __volatile__("stlb;nop;nop;nop;nop;nop"); |
| 123 | } |
| 124 | |
| 125 | static inline void tlb_read(void) |
| 126 | { |
| 127 | __asm__ __volatile__("mftlb;nop;nop;nop;nop;nop"); |
| 128 | } |
| 129 | |
| 130 | static inline void tlb_write_indexed(void) |
| 131 | { |
| 132 | __asm__ __volatile__("mtptlb;nop;nop;nop;nop;nop"); |
| 133 | } |
| 134 | |
| 135 | static inline void tlb_write_random(void) |
| 136 | { |
| 137 | __asm__ __volatile__("mtrtlb;nop;nop;nop;nop;nop"); |
| 138 | } |
| 139 | |
| 140 | #endif /* Not __ASSEMBLY__ */ |
| 141 | |
| 142 | #endif /* _ASM_SCORE_TLBFLUSH_H */ |