diff options
Diffstat (limited to 'include/asm-mips/hazards.h')
-rw-r--r-- | include/asm-mips/hazards.h | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h index 7e843b5fee92..2de638f84c86 100644 --- a/include/asm-mips/hazards.h +++ b/include/asm-mips/hazards.h | |||
@@ -10,11 +10,12 @@ | |||
10 | #ifndef _ASM_HAZARDS_H | 10 | #ifndef _ASM_HAZARDS_H |
11 | #define _ASM_HAZARDS_H | 11 | #define _ASM_HAZARDS_H |
12 | 12 | ||
13 | |||
14 | #ifdef __ASSEMBLY__ | 13 | #ifdef __ASSEMBLY__ |
15 | #define ASMMACRO(name, code...) .macro name; code; .endm | 14 | #define ASMMACRO(name, code...) .macro name; code; .endm |
16 | #else | 15 | #else |
17 | 16 | ||
17 | #include <asm/cpu-features.h> | ||
18 | |||
18 | #define ASMMACRO(name, code...) \ | 19 | #define ASMMACRO(name, code...) \ |
19 | __asm__(".macro " #name "; " #code "; .endm"); \ | 20 | __asm__(".macro " #name "; " #code "; .endm"); \ |
20 | \ | 21 | \ |
@@ -86,6 +87,57 @@ do { \ | |||
86 | : "=r" (tmp)); \ | 87 | : "=r" (tmp)); \ |
87 | } while (0) | 88 | } while (0) |
88 | 89 | ||
90 | #elif defined(CONFIG_CPU_MIPSR1) | ||
91 | |||
92 | /* | ||
93 | * These are slightly complicated by the fact that we guarantee R1 kernels to | ||
94 | * run fine on R2 processors. | ||
95 | */ | ||
96 | ASMMACRO(mtc0_tlbw_hazard, | ||
97 | _ssnop; _ssnop; _ehb | ||
98 | ) | ||
99 | ASMMACRO(tlbw_use_hazard, | ||
100 | _ssnop; _ssnop; _ssnop; _ehb | ||
101 | ) | ||
102 | ASMMACRO(tlb_probe_hazard, | ||
103 | _ssnop; _ssnop; _ssnop; _ehb | ||
104 | ) | ||
105 | ASMMACRO(irq_enable_hazard, | ||
106 | _ssnop; _ssnop; _ssnop; _ehb | ||
107 | ) | ||
108 | ASMMACRO(irq_disable_hazard, | ||
109 | _ssnop; _ssnop; _ssnop; _ehb | ||
110 | ) | ||
111 | ASMMACRO(back_to_back_c0_hazard, | ||
112 | _ssnop; _ssnop; _ssnop; _ehb | ||
113 | ) | ||
114 | /* | ||
115 | * gcc has a tradition of misscompiling the previous construct using the | ||
116 | * address of a label as argument to inline assembler. Gas otoh has the | ||
117 | * annoying difference between la and dla which are only usable for 32-bit | ||
118 | * rsp. 64-bit code, so can't be used without conditional compilation. | ||
119 | * The alterantive is switching the assembler to 64-bit code which happens | ||
120 | * to work right even for 32-bit code ... | ||
121 | */ | ||
122 | #define __instruction_hazard() \ | ||
123 | do { \ | ||
124 | unsigned long tmp; \ | ||
125 | \ | ||
126 | __asm__ __volatile__( \ | ||
127 | " .set mips64r2 \n" \ | ||
128 | " dla %0, 1f \n" \ | ||
129 | " jr.hb %0 \n" \ | ||
130 | " .set mips0 \n" \ | ||
131 | "1: \n" \ | ||
132 | : "=r" (tmp)); \ | ||
133 | } while (0) | ||
134 | |||
135 | #define instruction_hazard() \ | ||
136 | do { \ | ||
137 | if (cpu_has_mips_r2) \ | ||
138 | __instruction_hazard(); \ | ||
139 | } while (0) | ||
140 | |||
89 | #elif defined(CONFIG_CPU_R10000) | 141 | #elif defined(CONFIG_CPU_R10000) |
90 | 142 | ||
91 | /* | 143 | /* |