cop2.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #include <linux/notifier.h>
  12. #if defined(CONFIG_CPU_CAVIUM_OCTEON)
  13. extern void octeon_cop2_save(struct octeon_cop2_state *);
  14. extern void octeon_cop2_restore(struct octeon_cop2_state *);
  15. #define cop2_save(r) octeon_cop2_save(&(r)->thread.cp2)
  16. #define cop2_restore(r) octeon_cop2_restore(&(r)->thread.cp2)
  17. #define cop2_present 1
  18. #define cop2_lazy_restore 1
  19. #elif defined(CONFIG_CPU_XLP)
  20. extern void nlm_cop2_save(struct nlm_cop2_state *);
  21. extern void nlm_cop2_restore(struct nlm_cop2_state *);
  22. #define cop2_save(r) nlm_cop2_save(&(r)->thread.cp2)
  23. #define cop2_restore(r) nlm_cop2_restore(&(r)->thread.cp2)
  24. #define cop2_present 1
  25. #define cop2_lazy_restore 0
  26. #elif defined(CONFIG_CPU_LOONGSON3)
  27. #define cop2_present 1
  28. #define cop2_lazy_restore 1
  29. #define cop2_save(r) do { (void)(r); } while (0)
  30. #define cop2_restore(r) do { (void)(r); } while (0)
  31. #else
  32. #define cop2_present 0
  33. #define cop2_lazy_restore 0
  34. #define cop2_save(r) do { (void)(r); } while (0)
  35. #define cop2_restore(r) do { (void)(r); } while (0)
  36. #endif
  37. enum cu2_ops {
  38. CU2_EXCEPTION,
  39. CU2_LWC2_OP,
  40. CU2_LDC2_OP,
  41. CU2_SWC2_OP,
  42. CU2_SDC2_OP,
  43. };
  44. extern int register_cu2_notifier(struct notifier_block *nb);
  45. extern int cu2_notifier_call_chain(unsigned long val, void *v);
  46. #define cu2_notifier(fn, pri) \
  47. ({ \
  48. static struct notifier_block fn##_nb = { \
  49. .notifier_call = fn, \
  50. .priority = pri \
  51. }; \
  52. \
  53. register_cu2_notifier(&fn##_nb); \
  54. })
  55. #endif /* __ASM_COP2_H */