1139825Simp/* 21541Srgrimes * This file is subject to the terms and conditions of the GNU General Public 31541Srgrimes * License. See the file "COPYING" in the main directory of this archive 41541Srgrimes * for more details. 51541Srgrimes * 61541Srgrimes * Copyright (C) 2009 Wind River Systems, 71541Srgrimes * written by Ralf Baechle <ralf@linux-mips.org> 81541Srgrimes */ 91541Srgrimes#ifndef __ASM_COP2_H 101541Srgrimes#define __ASM_COP2_H 111541Srgrimes 121541Srgrimes#include <linux/notifier.h> 131541Srgrimes 141541Srgrimes#if defined(CONFIG_CPU_CAVIUM_OCTEON) 151541Srgrimes 161541Srgrimesextern void octeon_cop2_save(struct octeon_cop2_state *); 171541Srgrimesextern void octeon_cop2_restore(struct octeon_cop2_state *); 181541Srgrimes 191541Srgrimes#define cop2_save(r) octeon_cop2_save(&(r)->thread.cp2) 201541Srgrimes#define cop2_restore(r) octeon_cop2_restore(&(r)->thread.cp2) 211541Srgrimes 221541Srgrimes#define cop2_present 1 231541Srgrimes#define cop2_lazy_restore 1 241541Srgrimes 251541Srgrimes#elif defined(CONFIG_CPU_LOONGSON64) 261541Srgrimes 271541Srgrimes#define cop2_present 1 281541Srgrimes#define cop2_lazy_restore 1 291541Srgrimes#define cop2_save(r) do { (void)(r); } while (0) 3052635Sphk#define cop2_restore(r) do { (void)(r); } while (0) 3152635Sphk 3252635Sphk#else 3352635Sphk 3452635Sphk#define cop2_present 0 3552635Sphk#define cop2_lazy_restore 0 3652635Sphk#define cop2_save(r) do { (void)(r); } while (0) 3752635Sphk#define cop2_restore(r) do { (void)(r); } while (0) 3852635Sphk#endif 3952635Sphk 4052635Sphkenum cu2_ops { 4152635Sphk CU2_EXCEPTION, 4252635Sphk CU2_LWC2_OP, 4352635Sphk CU2_LDC2_OP, 4452635Sphk CU2_SWC2_OP, 4552635Sphk CU2_SDC2_OP, 4652635Sphk}; 4752635Sphk 4852635Sphkextern int register_cu2_notifier(struct notifier_block *nb); 4952635Sphkextern int cu2_notifier_call_chain(unsigned long val, void *v); 5052635Sphk 5152635Sphk#define cu2_notifier(fn, pri) \ 5252635Sphk({ \ 5352635Sphk static struct notifier_block fn##_nb = { \ 5452635Sphk .notifier_call = fn, \ 5552635Sphk .priority = pri \ 5652635Sphk }; \ 5752635Sphk \ 5850477Speter register_cu2_notifier(&fn##_nb); \ 591541Srgrimes}) 601541Srgrimes 611541Srgrimes#endif /* __ASM_COP2_H */ 621541Srgrimes