blob: d0352983b94d6f21f859bedc771a3dbcf5f1a757 [file] [log] [blame]
Ralf Baechle69f3a7d2009-11-24 01:24:58 +00001/*
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
Ralf Baechle4483b152010-08-05 13:25:59 +010012#include <linux/notifier.h>
13
Jayachandran C2c952e02013-06-10 06:30:00 +000014#if defined(CONFIG_CPU_CAVIUM_OCTEON)
15
16extern void octeon_cop2_save(struct octeon_cop2_state *);
17extern void octeon_cop2_restore(struct octeon_cop2_state *);
18
19#define cop2_save(r) octeon_cop2_save(r)
20#define cop2_restore(r) octeon_cop2_restore(r)
21
22#define cop2_present 1
23#define cop2_lazy_restore 1
24
Jayachandran C5649d372013-06-10 06:30:04 +000025#elif defined(CONFIG_CPU_XLP)
26
27extern void nlm_cop2_save(struct nlm_cop2_state *);
28extern void nlm_cop2_restore(struct nlm_cop2_state *);
29#define cop2_save(r) nlm_cop2_save(r)
30#define cop2_restore(r) nlm_cop2_restore(r)
31
32#define cop2_present 1
33#define cop2_lazy_restore 0
34
Huacai Chenef2f8262014-06-26 11:41:31 +080035#elif defined(CONFIG_CPU_LOONGSON3)
36
37#define cop2_save(r)
38#define cop2_restore(r)
39
40#define cop2_present 1
41#define cop2_lazy_restore 1
42
Jayachandran C2c952e02013-06-10 06:30:00 +000043#else
44
45#define cop2_present 0
46#define cop2_lazy_restore 0
47#define cop2_save(r)
48#define cop2_restore(r)
49#endif
50
Ralf Baechle69f3a7d2009-11-24 01:24:58 +000051enum cu2_ops {
52 CU2_EXCEPTION,
53 CU2_LWC2_OP,
54 CU2_LDC2_OP,
55 CU2_SWC2_OP,
56 CU2_SDC2_OP,
57};
58
59extern int register_cu2_notifier(struct notifier_block *nb);
60extern int cu2_notifier_call_chain(unsigned long val, void *v);
61
Ralf Baechle4483b152010-08-05 13:25:59 +010062#define cu2_notifier(fn, pri) \
63({ \
David Daney4c7106c2010-09-23 11:23:29 -070064 static struct notifier_block fn##_nb = { \
Ralf Baechle4483b152010-08-05 13:25:59 +010065 .notifier_call = fn, \
66 .priority = pri \
67 }; \
68 \
69 register_cu2_notifier(&fn##_nb); \
70})
71
Ralf Baechle69f3a7d2009-11-24 01:24:58 +000072#endif /* __ASM_COP2_H */