aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/tick14.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/sparc/kernel/tick14.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/sparc/kernel/tick14.c')
-rw-r--r--arch/sparc/kernel/tick14.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/arch/sparc/kernel/tick14.c b/arch/sparc/kernel/tick14.c
new file mode 100644
index 000000000000..fd8005a3e6bd
--- /dev/null
+++ b/arch/sparc/kernel/tick14.c
@@ -0,0 +1,85 @@
1/* tick14.c
2 * linux/arch/sparc/kernel/tick14.c
3 *
4 * Copyright (C) 1996 David Redman (djhr@tadpole.co.uk)
5 *
6 * This file handles the Sparc specific level14 ticker
7 * This is really useful for profiling OBP uses it for keyboard
8 * aborts and other stuff.
9 *
10 *
11 */
12#include <linux/errno.h>
13#include <linux/sched.h>
14#include <linux/kernel.h>
15#include <linux/param.h>
16#include <linux/string.h>
17#include <linux/mm.h>
18#include <linux/timex.h>
19#include <linux/interrupt.h>
20
21#include <asm/oplib.h>
22#include <asm/segment.h>
23#include <asm/timer.h>
24#include <asm/mostek.h>
25#include <asm/system.h>
26#include <asm/irq.h>
27#include <asm/io.h>
28
29extern unsigned long lvl14_save[5];
30static unsigned long *linux_lvl14 = NULL;
31static unsigned long obp_lvl14[4];
32
33/*
34 * Call with timer IRQ closed.
35 * First time we do it with disable_irq, later prom code uses spin_lock_irq().
36 */
37void install_linux_ticker(void)
38{
39
40 if (!linux_lvl14)
41 return;
42 linux_lvl14[0] = lvl14_save[0];
43 linux_lvl14[1] = lvl14_save[1];
44 linux_lvl14[2] = lvl14_save[2];
45 linux_lvl14[3] = lvl14_save[3];
46}
47
48void install_obp_ticker(void)
49{
50
51 if (!linux_lvl14)
52 return;
53 linux_lvl14[0] = obp_lvl14[0];
54 linux_lvl14[1] = obp_lvl14[1];
55 linux_lvl14[2] = obp_lvl14[2];
56 linux_lvl14[3] = obp_lvl14[3];
57}
58
59void claim_ticker14(irqreturn_t (*handler)(int, void *, struct pt_regs *),
60 int irq_nr, unsigned int timeout )
61{
62 int cpu = smp_processor_id();
63
64 /* first we copy the obp handler instructions
65 */
66 disable_irq(irq_nr);
67 if (!handler)
68 return;
69
70 linux_lvl14 = (unsigned long *)lvl14_save[4];
71 obp_lvl14[0] = linux_lvl14[0];
72 obp_lvl14[1] = linux_lvl14[1];
73 obp_lvl14[2] = linux_lvl14[2];
74 obp_lvl14[3] = linux_lvl14[3];
75
76 if (!request_irq(irq_nr,
77 handler,
78 (SA_INTERRUPT | SA_STATIC_ALLOC),
79 "counter14",
80 NULL)) {
81 install_linux_ticker();
82 load_profile_irq(cpu, timeout);
83 enable_irq(irq_nr);
84 }
85}