-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Away with the daemons of ifdef; get ready for future COP2 users. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Patchwork: http://patchwork.linux-mips.org/patch/708/
- Loading branch information
Ralf Baechle
committed
Dec 17, 2009
1 parent
4dd92e1
commit 69f3a7d
Showing
6 changed files
with
140 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* 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(¤t->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 */ | ||
} | ||
|
||
static struct notifier_block cnmips_cu2_notifier = { | ||
.notifier_call = cnmips_cu2_call, | ||
}; | ||
|
||
static int cnmips_cu2_setup(void) | ||
{ | ||
return register_cu2_notifier(&cnmips_cu2_notifier); | ||
} | ||
early_initcall(cnmips_cu2_setup); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* 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> | ||
*/ | ||
#ifndef __ASM_COP2_H | ||
#define __ASM_COP2_H | ||
|
||
enum cu2_ops { | ||
CU2_EXCEPTION, | ||
CU2_LWC2_OP, | ||
CU2_LDC2_OP, | ||
CU2_SWC2_OP, | ||
CU2_SDC2_OP, | ||
}; | ||
|
||
extern int register_cu2_notifier(struct notifier_block *nb); | ||
extern int cu2_notifier_call_chain(unsigned long val, void *v); | ||
|
||
#endif /* __ASM_COP2_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters