]>
Commit | Line | Data |
---|---|---|
69f3a7de RB |
1 | /* |
2 | * This file is subject to the terms and conditions of the GNU General Public | |
3 | * License. See the file "COPYING" in the main directory of this archive | |
4 | * for more details. | |
5 | * | |
6 | * Copyright (C) 2009 Wind River Systems, | |
7 | * written by Ralf Baechle <ralf@linux-mips.org> | |
8 | */ | |
9 | #ifndef __ASM_COP2_H | |
10 | #define __ASM_COP2_H | |
11 | ||
4483b159 RB |
12 | #include <linux/notifier.h> |
13 | ||
2c952e06 J |
14 | #if defined(CONFIG_CPU_CAVIUM_OCTEON) |
15 | ||
16 | extern void octeon_cop2_save(struct octeon_cop2_state *); | |
17 | extern void octeon_cop2_restore(struct octeon_cop2_state *); | |
18 | ||
68c77d8a RB |
19 | #define cop2_save(r) octeon_cop2_save(&(r)->thread.cp2) |
20 | #define cop2_restore(r) octeon_cop2_restore(&(r)->thread.cp2) | |
2c952e06 J |
21 | |
22 | #define cop2_present 1 | |
23 | #define cop2_lazy_restore 1 | |
24 | ||
5649d37c J |
25 | #elif defined(CONFIG_CPU_XLP) |
26 | ||
27 | extern void nlm_cop2_save(struct nlm_cop2_state *); | |
28 | extern void nlm_cop2_restore(struct nlm_cop2_state *); | |
68c77d8a RB |
29 | |
30 | #define cop2_save(r) nlm_cop2_save(&(r)->thread.cp2) | |
31 | #define cop2_restore(r) nlm_cop2_restore(&(r)->thread.cp2) | |
5649d37c J |
32 | |
33 | #define cop2_present 1 | |
34 | #define cop2_lazy_restore 0 | |
35 | ||
ef2f826c HC |
36 | #elif defined(CONFIG_CPU_LOONGSON3) |
37 | ||
ef2f826c HC |
38 | #define cop2_present 1 |
39 | #define cop2_lazy_restore 1 | |
b89f3068 PB |
40 | #define cop2_save(r) do { (void)(r); } while (0) |
41 | #define cop2_restore(r) do { (void)(r); } while (0) | |
ef2f826c | 42 | |
2c952e06 J |
43 | #else |
44 | ||
45 | #define cop2_present 0 | |
46 | #define cop2_lazy_restore 0 | |
b89f3068 PB |
47 | #define cop2_save(r) do { (void)(r); } while (0) |
48 | #define cop2_restore(r) do { (void)(r); } while (0) | |
2c952e06 J |
49 | #endif |
50 | ||
69f3a7de RB |
51 | enum cu2_ops { |
52 | CU2_EXCEPTION, | |
53 | CU2_LWC2_OP, | |
54 | CU2_LDC2_OP, | |
55 | CU2_SWC2_OP, | |
56 | CU2_SDC2_OP, | |
57 | }; | |
58 | ||
59 | extern int register_cu2_notifier(struct notifier_block *nb); | |
60 | extern int cu2_notifier_call_chain(unsigned long val, void *v); | |
61 | ||
4483b159 RB |
62 | #define cu2_notifier(fn, pri) \ |
63 | ({ \ | |
4c7106c4 | 64 | static struct notifier_block fn##_nb = { \ |
4483b159 RB |
65 | .notifier_call = fn, \ |
66 | .priority = pri \ | |
67 | }; \ | |
68 | \ | |
69 | register_cu2_notifier(&fn##_nb); \ | |
70 | }) | |
71 | ||
69f3a7de | 72 | #endif /* __ASM_COP2_H */ |