]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/ppc/interrupt.c
3895c380044345616640a204b81ddcf9b42e7217
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
29 * @APPLE_FREE_COPYRIGHT@
31 #include <kern/misc_protos.h>
32 #include <kern/assert.h>
33 #include <kern/thread.h>
34 #include <kern/counters.h>
35 #include <ppc/misc_protos.h>
36 #include <ppc/proc_reg.h>
37 #include <ppc/exception.h>
38 #include <ppc/savearea.h>
39 #include <pexpert/pexpert.h>
41 #include <ppc/POWERMAC/mp/MPPlugIn.h>
42 #endif /* NCPUS > 1 */
43 #include <sys/kdebug.h>
45 struct savearea
* interrupt(
51 int current_cpu
, tmpr
, targtemp
;
52 unsigned int throttle
;
60 extern void fctx_text(void);
66 current_cpu
= cpu_number();
70 case T_THERMAL
: /* Fix the air conditioning, I'm dripping with sweat, or freezing, whatever... */
73 * Note that this code is just a hackification until we have a real thermal plan.
76 tmpr
= ml_read_temp(); /* Find out just how hot it is */
77 targtemp
= (dar
>> 23) & 0x7F; /* Get the temprature we were looking for */
78 if(dar
& 4) { /* Did the temprature drop down? */
80 kprintf("THERMAL below (cpu %d) target = %d; actual = %d; thrm = %08X\n", current_cpu
, targtemp
, tmpr
, dar
);
83 throttle
= ml_throttle(0); /* Set throttle off */
85 kprintf("THERMAL (cpu %d) throttle set off; last = %d\n", current_cpu
, throttle
);
88 ml_thrm_set(0, per_proc_info
[current_cpu
].thrm
.throttleTemp
); /* Set no low temp and max allowable as max */
91 kprintf("THERMAL (cpu %d) temp set to: off min, %d max\n", current_cpu
, per_proc_info
[current_cpu
].thrm
.throttleTemp
);
96 kprintf("THERMAL above (cpu %d) target = %d; actual = %d; thrm = %08X\n", current_cpu
, targtemp
, tmpr
, dar
);
99 throttle
= ml_throttle(32); /* Set throttle on about 1/8th */
101 kprintf("THERMAL (cpu %d) throttle set to 32; last = %d\n", current_cpu
, throttle
);
104 ml_thrm_set(per_proc_info
[current_cpu
].thrm
.throttleTemp
- 4, 0); /* Set low temp to max - 4 and max off */
106 kprintf("THERMAL (cpu %d) temp set to: %d min, off max\n", current_cpu
, per_proc_info
[current_cpu
].thrm
.throttleTemp
- 4);
113 KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_EXCP_DECI
, 0) | DBG_FUNC_NONE
,
114 isync_mfdec(), ssp
->save_srr0
, 0, 0, 0);
117 if (pcsample_enable
) {
118 if (find_user_regs(current_act()))
119 add_pcsamples (user_pc(current_act()));
123 act
= current_act(); /* Find ourselves */
124 if(act
->mact
.qactTimer
!= 0) { /* Is the timer set? */
125 clock_get_uptime(&now
); /* Find out what time it is */
126 if (act
->mact
.qactTimer
<= now
) { /* It is set, has it popped? */
127 act
->mact
.qactTimer
= 0; /* Clear single shot timer */
128 if((unsigned int)act
->mact
.vmmControl
& 0xFFFFFFFE) { /* Are there any virtual machines? */
129 vmm_timer_pop(act
); /* Yes, check out them out... */
134 rtclock_intr(0, ssp
, 0);
138 /* Call the platform interrupt routine */
139 counter_always(c_incoming_interrupts
++);
141 KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_EXCP_INTR
, 0) | DBG_FUNC_START
,
142 current_cpu
, ssp
->save_srr0
, 0, 0, 0);
144 per_proc_info
[current_cpu
].interrupt_handler(
145 per_proc_info
[current_cpu
].interrupt_target
,
146 per_proc_info
[current_cpu
].interrupt_refCon
,
147 per_proc_info
[current_cpu
].interrupt_nub
,
148 per_proc_info
[current_cpu
].interrupt_source
);
150 KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_EXCP_INTR
, 0) | DBG_FUNC_END
,
156 /* Did the other processor signal us? */
157 cpu_signal_handler();
162 panic("returning from cpu_doshutdown()\n");
167 #if MACH_KDP || MACH_KDB
168 (void)Call_Debugger(type
, ssp
);
170 panic("Invalid interrupt type %x\n", type
);