Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * IOP Coprocessor-6 access handler
0004  * Copyright (c) 2006, Intel Corporation.
0005  */
0006 #include <linux/init.h>
0007 #include <asm/traps.h>
0008 #include <asm/ptrace.h>
0009 
0010 #include "iop3xx.h"
0011 
0012 void iop_enable_cp6(void)
0013 {
0014     u32 temp;
0015 
0016         /* enable cp6 access */
0017         asm volatile (
0018         "mrc    p15, 0, %0, c15, c1, 0\n\t"
0019         "orr    %0, %0, #(1 << 6)\n\t"
0020         "mcr    p15, 0, %0, c15, c1, 0\n\t"
0021         "mrc    p15, 0, %0, c15, c1, 0\n\t"
0022         "mov    %0, %0\n\t"
0023         "sub    pc, pc, #4  @ cp_wait\n\t"
0024         : "=r"(temp));
0025 }
0026 
0027 static int cp6_trap(struct pt_regs *regs, unsigned int instr)
0028 {
0029     iop_enable_cp6();
0030 
0031     return 0;
0032 }
0033 
0034 /* permit kernel space cp6 access
0035  * deny user space cp6 access
0036  */
0037 static struct undef_hook cp6_hook = {
0038     .instr_mask     = 0x0f000ff0,
0039     .instr_val      = 0x0e000610,
0040     .cpsr_mask      = MODE_MASK,
0041     .cpsr_val       = SVC_MODE,
0042     .fn             = cp6_trap,
0043 };
0044 
0045 void __init iop_init_cp6_handler(void)
0046 {
0047     register_undef_hook(&cp6_hook);
0048 }