blob: 792dd52fcd702b0ec45a719845d6da5e46c8deed [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
35/*
36 * Vectors 0x20-0x2f are used for ISA interrupts.
37 */
38
39/*
40 * Special IRQ vectors used by the SMP architecture, 0xf0-0xff
41 *
42 * some of the following vectors are 'rare', they are merged
43 * into a single vector (CALL_FUNCTION_VECTOR) to save vector space.
44 * TLB, reschedule and local APIC vectors are performance-critical.
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 */
46#define SPURIOUS_APIC_VECTOR 0xff
47#define ERROR_APIC_VECTOR 0xfe
Andi Kleene5bc8b62005-09-12 18:49:24 +020048#define RESCHEDULE_VECTOR 0xfd
49#define CALL_FUNCTION_VECTOR 0xfc
Andi Kleen915f34e2006-01-11 22:45:54 +010050/* fb free - please don't readd KDB here because it's useless
51 (hint - think what a NMI bit does to a vector) */
Andi Kleene5bc8b62005-09-12 18:49:24 +020052#define THERMAL_APIC_VECTOR 0xfa
Jacob Shin89b831e2005-11-05 17:25:53 +010053#define THRESHOLD_APIC_VECTOR 0xf9
Jason Uhlenkotte080e9d2006-01-11 22:45:51 +010054/* f8 free */
55#define INVALIDATE_TLB_VECTOR_END 0xf7
56#define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f7 used for TLB flush */
Linus Torvalds1da177e2005-04-16 15:20:36 -070057
Andi Kleene5bc8b62005-09-12 18:49:24 +020058#define NUM_INVALIDATE_TLB_VECTORS 8
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
60/*
61 * Local APIC timer IRQ vector is on a different priority level,
62 * to work around the 'lost local interrupt if more than 2 IRQ
63 * sources per level' errata.
64 */
65#define LOCAL_TIMER_VECTOR 0xef
66
67/*
68 * First APIC vector available to drivers: (vectors 0x30-0xee)
69 * we start at 0x31 to spread out vectors evenly between priority
70 * levels. (0x80 is the syscall vector)
71 */
72#define FIRST_DEVICE_VECTOR 0x31
73#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in irq.h */
74
75
76#ifndef __ASSEMBLY__
Eric W. Biederman550f2292006-10-04 02:16:51 -070077typedef int vector_irq_t[NR_VECTORS];
78DECLARE_PER_CPU(vector_irq_t, vector_irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
80/*
81 * Various low-level irq details needed by irq.c, process.c,
82 * time.c, io_apic.c and smp.c
83 *
84 * Interrupt entry/exit code at both C and assembly level
85 */
86
87extern void disable_8259A_irq(unsigned int irq);
88extern void enable_8259A_irq(unsigned int irq);
89extern int i8259A_irq_pending(unsigned int irq);
90extern void make_8259A_irq(unsigned int irq);
91extern void init_8259A(int aeoi);
92extern void FASTCALL(send_IPI_self(int vector));
93extern void init_VISWS_APIC_irqs(void);
94extern void setup_IO_APIC(void);
95extern void disable_IO_APIC(void);
96extern void print_IO_APIC(void);
97extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn);
98extern void send_IPI(int dest, int vector);
99extern void setup_ioapic_dest(void);
100
101extern unsigned long io_apic_irqs;
102
103extern atomic_t irq_err_count;
104extern atomic_t irq_mis_count;
105
106#define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
107
108#define __STR(x) #x
109#define STR(x) __STR(x)
110
111#include <asm/ptrace.h>
112
113#define IRQ_NAME2(nr) nr##_interrupt(void)
114#define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
115
116/*
117 * SMP has a few special interrupts for IPI messages
118 */
119
120#define BUILD_IRQ(nr) \
121asmlinkage void IRQ_NAME(nr); \
122__asm__( \
123"\n.p2align\n" \
124"IRQ" #nr "_interrupt:\n\t" \
Rusty Russell19eadf92006-06-27 02:53:44 -0700125 "push $~(" #nr ") ; " \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126 "jmp common_interrupt");
127
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128#define platform_legacy_irq(irq) ((irq) < 16)
129
130#endif
131
132#endif /* _ASM_HW_IRQ_H */