2 * Copyright (C) 2006 Semihalf, Rafal Jaworowski <raj@semihalf.com>
3 * Copyright 2002 by Peter Grehan.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * Interrupts are dispatched to here from locore asm
35 #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
36 __FBSDID("$FreeBSD$");
38 #include <sys/param.h>
39 #include <sys/systm.h>
41 #include <sys/interrupt.h>
42 #include <sys/kernel.h>
43 #include <sys/kthread.h>
46 #include <sys/malloc.h>
47 #include <sys/mutex.h>
50 #include <sys/unistd.h>
51 #include <sys/vmmeter.h>
53 #include <machine/cpu.h>
54 #include <machine/db_machdep.h>
55 #include <machine/frame.h>
56 #include <machine/intr_machdep.h>
57 #include <machine/md_var.h>
58 #include <machine/pcb.h>
59 #include <machine/psl.h>
60 #include <machine/trap.h>
64 extern void decr_intr(struct trapframe *);
66 void powerpc_decr_interrupt(struct trapframe *);
67 void powerpc_extr_interrupt(struct trapframe *);
68 void powerpc_crit_interrupt(struct trapframe *);
69 void powerpc_mchk_interrupt(struct trapframe *);
71 static void dump_frame(struct trapframe *framep);
74 dump_frame(struct trapframe *frame)
78 printf("\n*** *** STACK FRAME DUMP *** ***\n");
79 printf(" exc = 0x%x\n", frame->exc);
80 printf(" srr0 = 0x%08x\n", frame->srr0);
81 printf(" srr1 = 0x%08x\n", frame->srr1);
82 printf(" dear = 0x%08x\n", frame->cpu.booke.dear);
83 printf(" esr = 0x%08x\n", frame->cpu.booke.esr);
84 printf(" lr = 0x%08x\n", frame->lr);
85 printf(" cr = 0x%08x\n", frame->cr);
86 printf(" sp = 0x%08x\n", frame->fixreg[1]);
88 for (i = 0; i < 32; i++) {
89 printf(" R%02d = 0x%08x", i, frame->fixreg[i]);
96 void powerpc_crit_interrupt(struct trapframe *framep)
99 printf("powerpc_crit_interrupt: critical interrupt!\n");
104 void powerpc_mchk_interrupt(struct trapframe *framep)
107 printf("powerpc_mchk_interrupt: machine check interrupt!\n");
113 * Decrementer interrupt routine
116 powerpc_decr_interrupt(struct trapframe *framep)
119 struct trapframe *oldframe;
123 atomic_add_int(&td->td_intr_nesting_level, 1);
124 oldframe = td->td_intr_frame;
125 td->td_intr_frame = framep;
127 td->td_intr_frame = oldframe;
128 atomic_subtract_int(&td->td_intr_nesting_level, 1);
130 framep->srr1 &= ~PSL_WE;
134 * External input interrupt routine
137 powerpc_extr_interrupt(struct trapframe *framep)
141 PIC_DISPATCH(root_pic, framep);
143 framep->srr1 &= ~PSL_WE;