The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/osfmk/ppc/interrupt.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_LICENSE_HEADER_START@
    5  * 
    6  * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
    7  * 
    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
   13  * file.
   14  * 
   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.
   22  * 
   23  * @APPLE_LICENSE_HEADER_END@
   24  */
   25 /*
   26  * @OSF_COPYRIGHT@
   27  */
   28 /*
   29  * @APPLE_FREE_COPYRIGHT@
   30  */
   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/trap.h>
   37 #include <ppc/proc_reg.h>
   38 #include <ppc/exception.h>
   39 #include <ppc/savearea.h>
   40 #include <pexpert/pexpert.h>
   41 #include <sys/kdebug.h>
   42 
   43 perfTrap perfIntHook = 0;                                               /* Pointer to performance trap hook routine */
   44 
   45 struct savearea * interrupt(
   46         int type,
   47         struct savearea *ssp,
   48         unsigned int dsisr,
   49         unsigned int dar)
   50 {
   51         int     current_cpu, tmpr, targtemp;
   52         unsigned int    throttle;
   53         uint64_t                now;
   54         thread_act_t    act;
   55 
   56         disable_preemption();
   57 
   58         if(perfIntHook) {                                                       /* Is there a hook? */
   59                 if(perfIntHook(type, ssp, dsisr, dar) == KERN_SUCCESS) return ssp;      /* If it succeeds, we are done... */
   60         }
   61         
   62 #if 0
   63         {
   64                 extern void fctx_text(void);
   65                 fctx_test();
   66         }
   67 #endif
   68         
   69         
   70         current_cpu = cpu_number();
   71 
   72         switch (type) {
   73 
   74                 case T_THERMAL:                                         /* Fix the air conditioning, I'm dripping with sweat, or freezing, whatever... */
   75 
   76 /*
   77  *                      Note that this code is just a hackification until we have a real thermal plan.
   78  */
   79                         
   80                         tmpr = ml_read_temp();                  /* Find out just how hot it is */
   81                         targtemp = (dar >> 23) & 0x7F;  /* Get the temprature we were looking for */
   82                         if(dar & 4) {                                   /* Did the temprature drop down? */
   83 #if 1
   84                                 kprintf("THERMAL below (cpu %d) target = %d; actual = %d; thrm = %08X\n", current_cpu, targtemp, tmpr, dar);
   85 #endif  
   86 #if 0
   87                                 throttle = ml_throttle(0);      /* Set throttle off */
   88 #if 1
   89                                 kprintf("THERMAL (cpu %d) throttle set off; last = %d\n", current_cpu, throttle);
   90 #endif  
   91 #endif
   92                                 ml_thrm_set(0, per_proc_info[current_cpu].thrm.throttleTemp);   /* Set no low temp and max allowable as max */
   93 
   94 #if 1
   95                                 kprintf("THERMAL (cpu %d) temp set to: off min, %d max\n", current_cpu, per_proc_info[current_cpu].thrm.throttleTemp);
   96 #endif  
   97                         }
   98                         else {
   99 #if 1
  100                                 kprintf("THERMAL above (cpu %d) target = %d; actual = %d; thrm = %08X\n", current_cpu, targtemp, tmpr, dar);
  101 #endif  
  102 #if 0
  103                                 throttle = ml_throttle(32);     /* Set throttle on about 1/8th */
  104 #if 1
  105                                 kprintf("THERMAL (cpu %d) throttle set to 32; last = %d\n", current_cpu, throttle);
  106 #endif  
  107 #endif
  108                                 ml_thrm_set(per_proc_info[current_cpu].thrm.throttleTemp - 4, 0);       /* Set low temp to max - 4 and max off */
  109 #if 1
  110                                 kprintf("THERMAL (cpu %d) temp set to: %d min, off max\n", current_cpu, per_proc_info[current_cpu].thrm.throttleTemp - 4);
  111 #endif  
  112 
  113                         }
  114                         break;
  115                         
  116                 case T_DECREMENTER:
  117                         KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_EXCP_DECI, 0) | DBG_FUNC_NONE,
  118                                   isync_mfdec(), (unsigned int)ssp->save_srr0, 0, 0, 0);
  119         
  120 #if 0
  121                         if (pcsample_enable) {
  122                                 if (find_user_regs(current_act()))
  123                                   add_pcsamples (user_pc(current_act()));
  124                         }
  125 #endif
  126 
  127                         act = current_act();                                    /* Find ourselves */
  128                         if(act->mact.qactTimer != 0) {  /* Is the timer set? */
  129                                 clock_get_uptime(&now);                         /* Find out what time it is */
  130                                 if (act->mact.qactTimer <= now) {       /* It is set, has it popped? */
  131                                         act->mact.qactTimer = 0;                /* Clear single shot timer */
  132                                         if((unsigned int)act->mact.vmmControl & 0xFFFFFFFE) {   /* Are there any virtual machines? */
  133                                                 vmm_timer_pop(act);                     /* Yes, check out them out... */
  134                                         }
  135                                 }
  136                         }
  137 
  138                         rtclock_intr(0, ssp, 0);
  139                         break;
  140         
  141                 case T_INTERRUPT:
  142                         /* Call the platform interrupt routine */
  143                         counter_always(c_incoming_interrupts++);
  144         
  145                         KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_EXCP_INTR, 0) | DBG_FUNC_START,
  146                            current_cpu, (unsigned int)ssp->save_srr0, 0, 0, 0);
  147         
  148                         per_proc_info[current_cpu].interrupt_handler(
  149                                 per_proc_info[current_cpu].interrupt_target, 
  150                                 per_proc_info[current_cpu].interrupt_refCon,
  151                                 per_proc_info[current_cpu].interrupt_nub, 
  152                                 per_proc_info[current_cpu].interrupt_source);
  153         
  154                         KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_EXCP_INTR, 0) | DBG_FUNC_END,
  155                            0, 0, 0, 0, 0);
  156         
  157                         break;
  158         
  159                 case T_SIGP:
  160                         /* Did the other processor signal us? */ 
  161                         cpu_signal_handler();
  162                         break;
  163         
  164                 case T_SHUTDOWN:
  165                         cpu_doshutdown();
  166                         panic("returning from cpu_doshutdown()\n");
  167                         break;
  168         
  169                                 
  170                 default:
  171         #if     MACH_KDP || MACH_KDB
  172                         (void)Call_Debugger(type, ssp);
  173         #else
  174                         panic("Invalid interrupt type %x\n", type);
  175         #endif
  176                         break;
  177         }
  178 
  179         enable_preemption();
  180         return ssp;
  181 }

Cache object: baf8bde9fd18bc81a77ff9f76bb5cd45


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.