root/arch/sparc/kernel/tick14.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. install_linux_ticker
  2. install_obp_ticker
  3. claim_ticker14

   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 
  20 #include <asm/oplib.h>
  21 #include <asm/segment.h>
  22 #include <asm/timer.h>
  23 #include <asm/mostek.h>
  24 #include <asm/system.h>
  25 #include <asm/irq.h>
  26 #include <asm/io.h>
  27 
  28 extern unsigned long lvl14_save[5];
  29 static unsigned long *linux_lvl14 = NULL;
  30 static unsigned long obp_lvl14[4];
  31  
  32 void install_linux_ticker(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  33 {
  34         unsigned long flags;
  35 
  36         if (!linux_lvl14)
  37                 return;
  38         save_flags(flags); cli();
  39         linux_lvl14[0] =  lvl14_save[0];
  40         linux_lvl14[1] =  lvl14_save[1];
  41         linux_lvl14[2] =  lvl14_save[2];
  42         linux_lvl14[3] =  lvl14_save[3];
  43         restore_flags(flags);
  44 }
  45 
  46 void install_obp_ticker(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  47 {
  48         unsigned long flags;
  49     
  50         if (!linux_lvl14)
  51                 return;
  52         save_flags(flags); cli();
  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         restore_flags(flags);
  58 }
  59 
  60 void claim_ticker14(void (*handler)(int, void *, struct pt_regs *),
     /* [previous][next][first][last][top][bottom][index][help] */
  61                     int irq_nr, unsigned int timeout )
  62 {
  63         /* first we copy the obp handler instructions
  64          */
  65         disable_irq(irq_nr);
  66         if (!handler)
  67                 return;
  68     
  69         linux_lvl14 = (unsigned long *)lvl14_save[4];
  70         obp_lvl14[0] = linux_lvl14[0];
  71         obp_lvl14[1] = linux_lvl14[1];
  72         obp_lvl14[2] = linux_lvl14[2];
  73         obp_lvl14[3] = linux_lvl14[3];
  74 
  75         if (!request_irq(irq_nr,
  76                          handler,
  77                          (SA_INTERRUPT | SA_STATIC_ALLOC),
  78                          "counter14",
  79                          NULL)) {
  80                 install_linux_ticker();
  81                 load_profile_irq(timeout);
  82                 enable_irq(irq_nr);
  83         }
  84 }

/* [previous][next][first][last][top][bottom][index][help] */