blob: 312a58d6dac65cc96e4b4e0fd519650143c6c58a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ASM_HW_IRQ_H
2#define _ASM_HW_IRQ_H
3
4/*
5 * linux/include/asm/hw_irq.h
6 *
7 * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
8 *
9 * moved some of the old arch/i386/kernel/irq.h to here. VY
10 *
11 * IRQ/IPI changes taken from work by Thomas Radke
12 * <tomsoft@informatik.tu-chemnitz.de>
13 *
14 * hacked by Andi Kleen for x86-64.
Linus Torvalds1da177e2005-04-16 15:20:36 -070015 */
16
17#ifndef __ASSEMBLY__
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <asm/atomic.h>
19#include <asm/irq.h>
20#include <linux/profile.h>
21#include <linux/smp.h>
Eric W. Biederman550f2292006-10-04 02:16:51 -070022#include <linux/percpu.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#endif
24
Jan Beulich1a426cb2005-09-12 18:49:24 +020025#define NMI_VECTOR 0x02
Linus Torvalds1da177e2005-04-16 15:20:36 -070026/*
27 * IDT vectors usable for external interrupt sources start
28 * at 0x20:
29 */
30#define FIRST_EXTERNAL_VECTOR 0x20
31
32#define IA32_SYSCALL_VECTOR 0x80
33
34
Eric W. Biederman61014292007-02-23 04:40:58 -070035/* Reserve the lowest usable priority level 0x20 - 0x2f for triggering
36 * cleanup after irq migration.
37 */
38#define IRQ_MOVE_CLEANUP_VECTOR FIRST_EXTERNAL_VECTOR
39
Linus Torvalds1da177e2005-04-16 15:20:36 -070040/*
Yinghai Luc97beb42007-03-28 23:10:29 -060041 * Vectors 0x30-0x3f are used for ISA interrupts.
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 */
Steven Rostedt3f4ed152007-10-17 18:04:38 +020043#define IRQ0_VECTOR (FIRST_EXTERNAL_VECTOR + 0x10)
44#define IRQ1_VECTOR (IRQ0_VECTOR + 1)
45#define IRQ2_VECTOR (IRQ0_VECTOR + 2)
46#define IRQ3_VECTOR (IRQ0_VECTOR + 3)
47#define IRQ4_VECTOR (IRQ0_VECTOR + 4)
48#define IRQ5_VECTOR (IRQ0_VECTOR + 5)
49#define IRQ6_VECTOR (IRQ0_VECTOR + 6)
50#define IRQ7_VECTOR (IRQ0_VECTOR + 7)
51#define IRQ8_VECTOR (IRQ0_VECTOR + 8)
52#define IRQ9_VECTOR (IRQ0_VECTOR + 9)
53#define IRQ10_VECTOR (IRQ0_VECTOR + 10)
54#define IRQ11_VECTOR (IRQ0_VECTOR + 11)
55#define IRQ12_VECTOR (IRQ0_VECTOR + 12)
56#define IRQ13_VECTOR (IRQ0_VECTOR + 13)
57#define IRQ14_VECTOR (IRQ0_VECTOR + 14)
58#define IRQ15_VECTOR (IRQ0_VECTOR + 15)
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
60/*
61 * Special IRQ vectors used by the SMP architecture, 0xf0-0xff
62 *
63 * some of the following vectors are 'rare', they are merged
64 * into a single vector (CALL_FUNCTION_VECTOR) to save vector space.
65 * TLB, reschedule and local APIC vectors are performance-critical.
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 */
67#define SPURIOUS_APIC_VECTOR 0xff
68#define ERROR_APIC_VECTOR 0xfe
Andi Kleene5bc8b62005-09-12 18:49:24 +020069#define RESCHEDULE_VECTOR 0xfd
70#define CALL_FUNCTION_VECTOR 0xfc
Andi Kleen915f34e2006-01-11 22:45:54 +010071/* fb free - please don't readd KDB here because it's useless
72 (hint - think what a NMI bit does to a vector) */
Andi Kleene5bc8b62005-09-12 18:49:24 +020073#define THERMAL_APIC_VECTOR 0xfa
Jacob Shin89b831e2005-11-05 17:25:53 +010074#define THRESHOLD_APIC_VECTOR 0xf9
Jason Uhlenkotte080e9d2006-01-11 22:45:51 +010075/* f8 free */
76#define INVALIDATE_TLB_VECTOR_END 0xf7
77#define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f7 used for TLB flush */
Linus Torvalds1da177e2005-04-16 15:20:36 -070078
Andi Kleene5bc8b62005-09-12 18:49:24 +020079#define NUM_INVALIDATE_TLB_VECTORS 8
Linus Torvalds1da177e2005-04-16 15:20:36 -070080
81/*
82 * Local APIC timer IRQ vector is on a different priority level,
83 * to work around the 'lost local interrupt if more than 2 IRQ
84 * sources per level' errata.
85 */
86#define LOCAL_TIMER_VECTOR 0xef
87
88/*
89 * First APIC vector available to drivers: (vectors 0x30-0xee)
Eric W. Biederman61014292007-02-23 04:40:58 -070090 * we start at 0x41 to spread out vectors evenly between priority
Linus Torvalds1da177e2005-04-16 15:20:36 -070091 * levels. (0x80 is the syscall vector)
92 */
Eric W. Biedermanbc5e81a2007-02-23 04:38:26 -070093#define FIRST_DEVICE_VECTOR (IRQ15_VECTOR + 2)
Linus Torvalds1da177e2005-04-16 15:20:36 -070094#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in irq.h */
95
96
97#ifndef __ASSEMBLY__
Glauber de Oliveira Costa99253b82007-07-21 17:11:16 +020098
99/* Interrupt handlers registered during init_IRQ */
100void apic_timer_interrupt(void);
101void spurious_interrupt(void);
102void error_interrupt(void);
103void reschedule_interrupt(void);
104void call_function_interrupt(void);
105void irq_move_cleanup_interrupt(void);
106void invalidate_interrupt0(void);
107void invalidate_interrupt1(void);
108void invalidate_interrupt2(void);
109void invalidate_interrupt3(void);
110void invalidate_interrupt4(void);
111void invalidate_interrupt5(void);
112void invalidate_interrupt6(void);
113void invalidate_interrupt7(void);
114void thermal_interrupt(void);
115void threshold_interrupt(void);
116void i8254_timer_resume(void);
117
Eric W. Biederman550f2292006-10-04 02:16:51 -0700118typedef int vector_irq_t[NR_VECTORS];
119DECLARE_PER_CPU(vector_irq_t, vector_irq);
Eric W. Biederman70a0a532006-10-25 01:00:23 +0200120extern void __setup_vector_irq(int cpu);
121extern spinlock_t vector_lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122
123/*
124 * Various low-level irq details needed by irq.c, process.c,
125 * time.c, io_apic.c and smp.c
126 *
127 * Interrupt entry/exit code at both C and assembly level
128 */
129
130extern void disable_8259A_irq(unsigned int irq);
131extern void enable_8259A_irq(unsigned int irq);
132extern int i8259A_irq_pending(unsigned int irq);
133extern void make_8259A_irq(unsigned int irq);
134extern void init_8259A(int aeoi);
Glauber de Oliveira Costac49c5332007-02-13 13:26:22 +0100135extern void send_IPI_self(int vector);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136extern void init_VISWS_APIC_irqs(void);
137extern void setup_IO_APIC(void);
Yinghai Lu1c695242008-01-30 13:30:39 +0100138extern void enable_IO_APIC(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139extern void disable_IO_APIC(void);
140extern void print_IO_APIC(void);
141extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn);
142extern void send_IPI(int dest, int vector);
143extern void setup_ioapic_dest(void);
Glauber de Oliveira Costab0387832008-01-30 13:33:19 +0100144extern void native_init_IRQ(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145
146extern unsigned long io_apic_irqs;
147
148extern atomic_t irq_err_count;
149extern atomic_t irq_mis_count;
150
151#define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
152
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153#include <asm/ptrace.h>
154
155#define IRQ_NAME2(nr) nr##_interrupt(void)
156#define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
157
158/*
159 * SMP has a few special interrupts for IPI messages
160 */
161
162#define BUILD_IRQ(nr) \
163asmlinkage void IRQ_NAME(nr); \
164__asm__( \
165"\n.p2align\n" \
166"IRQ" #nr "_interrupt:\n\t" \
Rusty Russell19eadf92006-06-27 02:53:44 -0700167 "push $~(" #nr ") ; " \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168 "jmp common_interrupt");
169
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170#define platform_legacy_irq(irq) ((irq) < 16)
171
172#endif
173
174#endif /* _ASM_HW_IRQ_H */