169f3a7deSRalf Baechle /* 269f3a7deSRalf Baechle * This file is subject to the terms and conditions of the GNU General Public 369f3a7deSRalf Baechle * License. See the file "COPYING" in the main directory of this archive 469f3a7deSRalf Baechle * for more details. 569f3a7deSRalf Baechle * 669f3a7deSRalf Baechle * Copyright (C) 2009 Wind River Systems, 769f3a7deSRalf Baechle * written by Ralf Baechle <ralf@linux-mips.org> 869f3a7deSRalf Baechle */ 969f3a7deSRalf Baechle #ifndef __ASM_COP2_H 1069f3a7deSRalf Baechle #define __ASM_COP2_H 1169f3a7deSRalf Baechle 124483b159SRalf Baechle #include <linux/notifier.h> 134483b159SRalf Baechle 142c952e06SJayachandran C #if defined(CONFIG_CPU_CAVIUM_OCTEON) 152c952e06SJayachandran C 162c952e06SJayachandran C extern void octeon_cop2_save(struct octeon_cop2_state *); 172c952e06SJayachandran C extern void octeon_cop2_restore(struct octeon_cop2_state *); 182c952e06SJayachandran C 1968c77d8aSRalf Baechle #define cop2_save(r) octeon_cop2_save(&(r)->thread.cp2) 2068c77d8aSRalf Baechle #define cop2_restore(r) octeon_cop2_restore(&(r)->thread.cp2) 212c952e06SJayachandran C 222c952e06SJayachandran C #define cop2_present 1 232c952e06SJayachandran C #define cop2_lazy_restore 1 242c952e06SJayachandran C 25*268a2d60SJiaxun Yang #elif defined(CONFIG_CPU_LOONGSON64) 26ef2f826cSHuacai Chen 27ef2f826cSHuacai Chen #define cop2_present 1 28ef2f826cSHuacai Chen #define cop2_lazy_restore 1 29b89f3068SPaul Burton #define cop2_save(r) do { (void)(r); } while (0) 30b89f3068SPaul Burton #define cop2_restore(r) do { (void)(r); } while (0) 31ef2f826cSHuacai Chen 322c952e06SJayachandran C #else 332c952e06SJayachandran C 342c952e06SJayachandran C #define cop2_present 0 352c952e06SJayachandran C #define cop2_lazy_restore 0 36b89f3068SPaul Burton #define cop2_save(r) do { (void)(r); } while (0) 37b89f3068SPaul Burton #define cop2_restore(r) do { (void)(r); } while (0) 382c952e06SJayachandran C #endif 392c952e06SJayachandran C 4069f3a7deSRalf Baechle enum cu2_ops { 4169f3a7deSRalf Baechle CU2_EXCEPTION, 4269f3a7deSRalf Baechle CU2_LWC2_OP, 4369f3a7deSRalf Baechle CU2_LDC2_OP, 4469f3a7deSRalf Baechle CU2_SWC2_OP, 4569f3a7deSRalf Baechle CU2_SDC2_OP, 4669f3a7deSRalf Baechle }; 4769f3a7deSRalf Baechle 4869f3a7deSRalf Baechle extern int register_cu2_notifier(struct notifier_block *nb); 4969f3a7deSRalf Baechle extern int cu2_notifier_call_chain(unsigned long val, void *v); 5069f3a7deSRalf Baechle 514483b159SRalf Baechle #define cu2_notifier(fn, pri) \ 524483b159SRalf Baechle ({ \ 534c7106c4SDavid Daney static struct notifier_block fn##_nb = { \ 544483b159SRalf Baechle .notifier_call = fn, \ 554483b159SRalf Baechle .priority = pri \ 564483b159SRalf Baechle }; \ 574483b159SRalf Baechle \ 584483b159SRalf Baechle register_cu2_notifier(&fn##_nb); \ 594483b159SRalf Baechle }) 604483b159SRalf Baechle 6169f3a7deSRalf Baechle #endif /* __ASM_COP2_H */ 62