Ralf Baechle | 69f3a7d | 2009-11-24 01:24:58 +0000 | [diff] [blame] | 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 | |
Ralf Baechle | 4483b15 | 2010-08-05 13:25:59 +0100 | [diff] [blame] | 12 | #include <linux/notifier.h> |
| 13 | |
Jayachandran C | 2c952e0 | 2013-06-10 06:30:00 +0000 | [diff] [blame] | 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 | |
Ralf Baechle | 68c77d8 | 2014-08-25 19:35:53 +0200 | [diff] [blame] | 19 | #define cop2_save(r) octeon_cop2_save(&(r)->thread.cp2) |
| 20 | #define cop2_restore(r) octeon_cop2_restore(&(r)->thread.cp2) |
Jayachandran C | 2c952e0 | 2013-06-10 06:30:00 +0000 | [diff] [blame] | 21 | |
| 22 | #define cop2_present 1 |
| 23 | #define cop2_lazy_restore 1 |
| 24 | |
Jiaxun Yang | 268a2d6 | 2019-10-20 22:43:13 +0800 | [diff] [blame] | 25 | #elif defined(CONFIG_CPU_LOONGSON64) |
Huacai Chen | ef2f826 | 2014-06-26 11:41:31 +0800 | [diff] [blame] | 26 | |
Huacai Chen | ef2f826 | 2014-06-26 11:41:31 +0800 | [diff] [blame] | 27 | #define cop2_present 1 |
| 28 | #define cop2_lazy_restore 1 |
Paul Burton | b89f306 | 2014-09-25 10:26:15 +0100 | [diff] [blame] | 29 | #define cop2_save(r) do { (void)(r); } while (0) |
| 30 | #define cop2_restore(r) do { (void)(r); } while (0) |
Huacai Chen | ef2f826 | 2014-06-26 11:41:31 +0800 | [diff] [blame] | 31 | |
Jayachandran C | 2c952e0 | 2013-06-10 06:30:00 +0000 | [diff] [blame] | 32 | #else |
| 33 | |
| 34 | #define cop2_present 0 |
| 35 | #define cop2_lazy_restore 0 |
Paul Burton | b89f306 | 2014-09-25 10:26:15 +0100 | [diff] [blame] | 36 | #define cop2_save(r) do { (void)(r); } while (0) |
| 37 | #define cop2_restore(r) do { (void)(r); } while (0) |
Jayachandran C | 2c952e0 | 2013-06-10 06:30:00 +0000 | [diff] [blame] | 38 | #endif |
| 39 | |
Ralf Baechle | 69f3a7d | 2009-11-24 01:24:58 +0000 | [diff] [blame] | 40 | enum cu2_ops { |
| 41 | CU2_EXCEPTION, |
| 42 | CU2_LWC2_OP, |
| 43 | CU2_LDC2_OP, |
| 44 | CU2_SWC2_OP, |
| 45 | CU2_SDC2_OP, |
| 46 | }; |
| 47 | |
| 48 | extern int register_cu2_notifier(struct notifier_block *nb); |
| 49 | extern int cu2_notifier_call_chain(unsigned long val, void *v); |
| 50 | |
Ralf Baechle | 4483b15 | 2010-08-05 13:25:59 +0100 | [diff] [blame] | 51 | #define cu2_notifier(fn, pri) \ |
| 52 | ({ \ |
David Daney | 4c7106c | 2010-09-23 11:23:29 -0700 | [diff] [blame] | 53 | static struct notifier_block fn##_nb = { \ |
Ralf Baechle | 4483b15 | 2010-08-05 13:25:59 +0100 | [diff] [blame] | 54 | .notifier_call = fn, \ |
| 55 | .priority = pri \ |
| 56 | }; \ |
| 57 | \ |
| 58 | register_cu2_notifier(&fn##_nb); \ |
| 59 | }) |
| 60 | |
Ralf Baechle | 69f3a7d | 2009-11-24 01:24:58 +0000 | [diff] [blame] | 61 | #endif /* __ASM_COP2_H */ |