linux-old/include/asm-x86_64/hw_irq.h
<<
>>
Prefs
   1#ifndef _ASM_HW_IRQ_H
   2#define _ASM_HW_IRQ_H
   3
   4#ifndef __ASSEMBLY__
   5/*
   6 *      linux/include/asm/hw_irq.h
   7 *
   8 *      (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
   9 *
  10 *      moved some of the old arch/i386/kernel/irq.h to here. VY
  11 *
  12 *      IRQ/IPI changes taken from work by Thomas Radke
  13 *      <tomsoft@informatik.tu-chemnitz.de>
  14 *
  15 *      hacked by Andi Kleen for x86-64.
  16 * 
  17 *  $Id: hw_irq.h,v 1.31 2003/02/18 18:35:55 ak Exp $
  18 */
  19
  20#include <linux/config.h>
  21#include <linux/stddef.h>
  22#include <asm/atomic.h>
  23#include <asm/irq.h>
  24
  25#endif
  26
  27/*
  28 * IDT vectors usable for external interrupt sources start
  29 * at 0x20:
  30 */
  31#define FIRST_EXTERNAL_VECTOR   0x20
  32
  33#define IA32_SYSCALL_VECTOR     0x80
  34
  35
  36/*
  37 * Vectors 0x20-0x2f are used for ISA interrupts.
  38 */
  39
  40/*
  41 * Special IRQ vectors used by the SMP architecture, 0xf0-0xff
  42 *
  43 *  some of the following vectors are 'rare', they are merged
  44 *  into a single vector (CALL_FUNCTION_VECTOR) to save vector space.
  45 *  TLB, reschedule and local APIC vectors are performance-critical.
  46 *
  47 *  Vectors 0xf0-0xf9 are free (reserved for future Linux use).
  48 */
  49#define SPURIOUS_APIC_VECTOR    0xff
  50#define ERROR_APIC_VECTOR       0xfe
  51#define INVALIDATE_TLB_VECTOR   0xfd
  52#define RESCHEDULE_VECTOR       0xfc
  53/* 0xfa free */
  54#define CALL_FUNCTION_VECTOR    0xfb
  55
  56/*
  57 * Local APIC timer IRQ vector is on a different priority level,
  58 * to work around the 'lost local interrupt if more than 2 IRQ
  59 * sources per level' errata.
  60 */
  61#define LOCAL_TIMER_VECTOR      0xef
  62
  63/*
  64 * First APIC vector available to drivers: (vectors 0x30-0xee)
  65 * we start at 0x31 to spread out vectors evenly between priority
  66 * levels. (0x80 is the syscall vector)
  67 */
  68#define FIRST_DEVICE_VECTOR     0x31
  69#define FIRST_SYSTEM_VECTOR     0xef
  70
  71#ifndef __ASSEMBLY__
  72extern int irq_vector[NR_IRQS];
  73#define IO_APIC_VECTOR(irq)     irq_vector[irq]
  74
  75/*
  76 * Various low-level irq details needed by irq.c, process.c,
  77 * time.c, io_apic.c and smp.c
  78 *
  79 * Interrupt entry/exit code at both C and assembly level
  80 */
  81
  82extern void mask_irq(unsigned int irq);
  83extern void unmask_irq(unsigned int irq);
  84extern void disable_8259A_irq(unsigned int irq);
  85extern void enable_8259A_irq(unsigned int irq);
  86extern int i8259A_irq_pending(unsigned int irq);
  87extern void make_8259A_irq(unsigned int irq);
  88extern void init_8259A(int aeoi);
  89extern void FASTCALL(send_IPI_self(int vector));
  90extern void init_VISWS_APIC_irqs(void);
  91extern void setup_IO_APIC(void);
  92extern void disable_IO_APIC(void);
  93extern void print_IO_APIC(void);
  94extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn);
  95extern void send_IPI(int dest, int vector);
  96
  97extern unsigned long io_apic_irqs;
  98
  99extern atomic_t irq_err_count;
 100extern atomic_t irq_mis_count;
 101
 102extern char _stext, _etext;
 103
 104#define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
 105
 106#include <asm/ptrace.h>
 107
 108extern void reschedule_interrupt(void);
 109extern void invalidate_interrupt(void);
 110extern void call_function_interrupt(void);
 111extern void apic_timer_interrupt(void);
 112extern void spurious_interrupt(void);
 113extern void error_interrupt(void);
 114
 115#define IRQ_NAME2(nr) nr##_interrupt(void)
 116#define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
 117
 118#define BUILD_IRQ(nr) \
 119asmlinkage void IRQ_NAME(nr); \
 120__asm__( \
 121"\n"__ALIGN_STR "\n" \
 122SYMBOL_NAME_STR(IRQ) #nr "_interrupt:\n\t" \
 123        "push $" #nr "-256 ; " \
 124        "jmp common_interrupt");
 125
 126extern unsigned long prof_cpu_mask;
 127extern unsigned int * prof_buffer;
 128extern unsigned long prof_len;
 129extern unsigned long prof_shift;
 130
 131/*
 132 * x86 profiling function, SMP safe. We might want to do this in
 133 * assembly totally?
 134 */
 135static inline void x86_do_profile (unsigned long eip)
 136{
 137        if (!prof_buffer)
 138                return;
 139
 140        /*
 141         * Only measure the CPUs specified by /proc/irq/prof_cpu_mask.
 142         * (default is all CPUs.)
 143         */
 144        if (!((1<<smp_processor_id()) & prof_cpu_mask))
 145                return;
 146
 147        eip -= (unsigned long) &_stext;
 148        eip >>= prof_shift;
 149        /*
 150         * Don't ignore out-of-bounds EIP values silently,
 151         * put them into the last histogram slot, so if
 152         * present, they will show up as a sharp peak.
 153         */
 154        if (eip > prof_len-1)
 155                eip = prof_len-1;
 156        atomic_inc((atomic_t *)&prof_buffer[eip]);
 157}
 158
 159#ifdef CONFIG_SMP /*more of this file should probably be ifdefed SMP */
 160static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {
 161        if (IO_APIC_IRQ(i))
 162                send_IPI_self(IO_APIC_VECTOR(i));
 163}
 164#else
 165static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
 166#endif
 167
 168#endif
 169
 170#endif /* _ASM_HW_IRQ_H */
 171
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.