diff options
author | Chris Dearman <chris@mips.com> | 2007-05-08 11:09:13 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-05-11 09:28:31 -0400 |
commit | 0b6249567b4ecf6e9d5a8efcf149f3e7cf788cc0 (patch) | |
tree | dfb8d45357a9e8e3ad134f7eec87e7918132410e /include/asm-mips | |
parent | d725cf3818b12a17d78b87a2de19e8eec17126ae (diff) |
[MIPS] FPU hazard handling
Move FPU hazard handling to hazards.h and provide proper support for
MIPSR2 processors
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'include/asm-mips')
-rw-r--r-- | include/asm-mips/fpu.h | 23 | ||||
-rw-r--r-- | include/asm-mips/hazards.h | 32 |
2 files changed, 35 insertions, 20 deletions
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h index b414a7d9db43..483685b1592e 100644 --- a/include/asm-mips/fpu.h +++ b/include/asm-mips/fpu.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <asm/mipsregs.h> | 16 | #include <asm/mipsregs.h> |
17 | #include <asm/cpu.h> | 17 | #include <asm/cpu.h> |
18 | #include <asm/cpu-features.h> | 18 | #include <asm/cpu-features.h> |
19 | #include <asm/hazards.h> | ||
19 | #include <asm/bitops.h> | 20 | #include <asm/bitops.h> |
20 | #include <asm/processor.h> | 21 | #include <asm/processor.h> |
21 | #include <asm/current.h> | 22 | #include <asm/current.h> |
@@ -38,34 +39,16 @@ extern void _init_fpu(void); | |||
38 | extern void _save_fp(struct task_struct *); | 39 | extern void _save_fp(struct task_struct *); |
39 | extern void _restore_fp(struct task_struct *); | 40 | extern void _restore_fp(struct task_struct *); |
40 | 41 | ||
41 | #if defined(CONFIG_CPU_SB1) | ||
42 | #define __enable_fpu_hazard() \ | ||
43 | do { \ | ||
44 | asm(".set push \n\t" \ | ||
45 | ".set mips64 \n\t" \ | ||
46 | ".set noreorder \n\t" \ | ||
47 | "ssnop \n\t" \ | ||
48 | "bnezl $0, .+4 \n\t" \ | ||
49 | "ssnop \n\t" \ | ||
50 | ".set pop"); \ | ||
51 | } while (0) | ||
52 | #else | ||
53 | #define __enable_fpu_hazard() \ | ||
54 | do { \ | ||
55 | asm("nop;nop;nop;nop"); /* max. hazard */ \ | ||
56 | } while (0) | ||
57 | #endif | ||
58 | |||
59 | #define __enable_fpu() \ | 42 | #define __enable_fpu() \ |
60 | do { \ | 43 | do { \ |
61 | set_c0_status(ST0_CU1); \ | 44 | set_c0_status(ST0_CU1); \ |
62 | __enable_fpu_hazard(); \ | 45 | enable_fpu_hazard(); \ |
63 | } while (0) | 46 | } while (0) |
64 | 47 | ||
65 | #define __disable_fpu() \ | 48 | #define __disable_fpu() \ |
66 | do { \ | 49 | do { \ |
67 | clear_c0_status(ST0_CU1); \ | 50 | clear_c0_status(ST0_CU1); \ |
68 | /* We don't care about the c0 hazard here */ \ | 51 | disable_fpu_hazard(); \ |
69 | } while (0) | 52 | } while (0) |
70 | 53 | ||
71 | #define enable_fpu() \ | 54 | #define enable_fpu() \ |
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h index e50c77e69cb5..1542f23ab9d9 100644 --- a/include/asm-mips/hazards.h +++ b/include/asm-mips/hazards.h | |||
@@ -178,4 +178,36 @@ ASMMACRO(back_to_back_c0_hazard, | |||
178 | 178 | ||
179 | #endif | 179 | #endif |
180 | 180 | ||
181 | |||
182 | /* FPU hazards */ | ||
183 | |||
184 | #if defined(CONFIG_CPU_SB1) | ||
185 | ASMMACRO(enable_fpu_hazard, | ||
186 | .set push; | ||
187 | .set mips64; | ||
188 | .set noreorder; | ||
189 | _ssnop; | ||
190 | bnezl $0,.+4; | ||
191 | _ssnop | ||
192 | .set pop | ||
193 | ) | ||
194 | ASMMACRO(disable_fpu_hazard, | ||
195 | ) | ||
196 | |||
197 | #elif defined(CONFIG_CPU_MIPSR2) | ||
198 | ASMMACRO(enable_fpu_hazard, | ||
199 | _ehb | ||
200 | ) | ||
201 | ASMMACRO(disable_fpu_hazard, | ||
202 | _ehb | ||
203 | ) | ||
204 | #else | ||
205 | ASMMACRO(enable_fpu_hazard, | ||
206 | nop; nop; nop; nop | ||
207 | ) | ||
208 | ASMMACRO(disable_fpu_hazard, | ||
209 | _ehb | ||
210 | ) | ||
211 | #endif | ||
212 | |||
181 | #endif /* _ASM_HAZARDS_H */ | 213 | #endif /* _ASM_HAZARDS_H */ |