cp6.c 956 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * IOP Coprocessor-6 access handler
  4. * Copyright (c) 2006, Intel Corporation.
  5. */
  6. #include <linux/init.h>
  7. #include <asm/traps.h>
  8. #include <asm/ptrace.h>
  9. #include "iop3xx.h"
  10. void iop_enable_cp6(void)
  11. {
  12. u32 temp;
  13. /* enable cp6 access */
  14. asm volatile (
  15. "mrc p15, 0, %0, c15, c1, 0\n\t"
  16. "orr %0, %0, #(1 << 6)\n\t"
  17. "mcr p15, 0, %0, c15, c1, 0\n\t"
  18. "mrc p15, 0, %0, c15, c1, 0\n\t"
  19. "mov %0, %0\n\t"
  20. "sub pc, pc, #4 @ cp_wait\n\t"
  21. : "=r"(temp));
  22. }
  23. static int cp6_trap(struct pt_regs *regs, unsigned int instr)
  24. {
  25. iop_enable_cp6();
  26. return 0;
  27. }
  28. /* permit kernel space cp6 access
  29. * deny user space cp6 access
  30. */
  31. static struct undef_hook cp6_hook = {
  32. .instr_mask = 0x0f000ff0,
  33. .instr_val = 0x0e000610,
  34. .cpsr_mask = MODE_MASK,
  35. .cpsr_val = SVC_MODE,
  36. .fn = cp6_trap,
  37. };
  38. void __init iop_init_cp6_handler(void)
  39. {
  40. register_undef_hook(&cp6_hook);
  41. }