Blame view

arch/mips/cavium-octeon/cpu.c 1.2 KB
69f3a7de1   Ralf Baechle   MIPS: Modularize ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  /*
   * This file is subject to the terms and conditions of the GNU General Public
   * License.  See the file "COPYING" in the main directory of this archive
   * for more details.
   *
   * Copyright (C) 2009 Wind River Systems,
   *   written by Ralf Baechle <ralf@linux-mips.org>
   */
  #include <linux/init.h>
  #include <linux/irqflags.h>
  #include <linux/notifier.h>
  #include <linux/prefetch.h>
  #include <linux/sched.h>
  
  #include <asm/cop2.h>
  #include <asm/current.h>
  #include <asm/mipsregs.h>
  #include <asm/page.h>
  #include <asm/octeon/octeon.h>
  
  static int cnmips_cu2_call(struct notifier_block *nfb, unsigned long action,
  	void *data)
  {
  	unsigned long flags;
  	unsigned int status;
  
  	switch (action) {
  	case CU2_EXCEPTION:
  		prefetch(&current->thread.cp2);
  		local_irq_save(flags);
  		KSTK_STATUS(current) |= ST0_CU2;
  		status = read_c0_status();
  		write_c0_status(status | ST0_CU2);
  		octeon_cop2_restore(&(current->thread.cp2));
  		write_c0_status(status & ~ST0_CU2);
  		local_irq_restore(flags);
  
  		return NOTIFY_BAD;	/* Don't call default notifier */
  	}
  
  	return NOTIFY_OK;		/* Let default notifier send signals */
  }
158d6742b   David Daney   MIPS: Octeon: Pla...
43
  static int __init cnmips_cu2_setup(void)
69f3a7de1   Ralf Baechle   MIPS: Modularize ...
44
  {
4483b1591   Ralf Baechle   MIPS: Provide mor...
45
  	return cu2_notifier(cnmips_cu2_call, 0);
69f3a7de1   Ralf Baechle   MIPS: Modularize ...
46
47
  }
  early_initcall(cnmips_cu2_setup);