blob: c14a8c7267a69b4230ca0b92a68ffa9db5686b92 [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.
15 *
16 * $Id: hw_irq.h,v 1.24 2001/09/14 20:55:03 vojtech Exp $
17 */
18
19#ifndef __ASSEMBLY__
20#include <linux/config.h>
21#include <asm/atomic.h>
22#include <asm/irq.h>
23#include <linux/profile.h>
24#include <linux/smp.h>
25
26struct hw_interrupt_type;
27#endif
28
Jan Beulich1a426cb2005-09-12 18:49:24 +020029#define NMI_VECTOR 0x02
Linus Torvalds1da177e2005-04-16 15:20:36 -070030/*
31 * IDT vectors usable for external interrupt sources start
32 * at 0x20:
33 */
34#define FIRST_EXTERNAL_VECTOR 0x20
35
36#define IA32_SYSCALL_VECTOR 0x80
37
38
39/*
40 * Vectors 0x20-0x2f are used for ISA interrupts.
41 */
42
43/*
44 * Special IRQ vectors used by the SMP architecture, 0xf0-0xff
45 *
46 * some of the following vectors are 'rare', they are merged
47 * into a single vector (CALL_FUNCTION_VECTOR) to save vector space.
48 * TLB, reschedule and local APIC vectors are performance-critical.
49 *
50 * Vectors 0xf0-0xf9 are free (reserved for future Linux use).
51 */
52#define SPURIOUS_APIC_VECTOR 0xff
53#define ERROR_APIC_VECTOR 0xfe
Andi Kleene5bc8b62005-09-12 18:49:24 +020054#define RESCHEDULE_VECTOR 0xfd
55#define CALL_FUNCTION_VECTOR 0xfc
56#define KDB_VECTOR 0xfb /* reserved for KDB */
57#define THERMAL_APIC_VECTOR 0xfa
Jacob Shin89b831e2005-11-05 17:25:53 +010058#define THRESHOLD_APIC_VECTOR 0xf9
Andi Kleene5bc8b62005-09-12 18:49:24 +020059#define INVALIDATE_TLB_VECTOR_END 0xf8
60#define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f8 used for TLB flush */
Linus Torvalds1da177e2005-04-16 15:20:36 -070061
Andi Kleene5bc8b62005-09-12 18:49:24 +020062#define NUM_INVALIDATE_TLB_VECTORS 8
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
64/*
65 * Local APIC timer IRQ vector is on a different priority level,
66 * to work around the 'lost local interrupt if more than 2 IRQ
67 * sources per level' errata.
68 */
69#define LOCAL_TIMER_VECTOR 0xef
70
71/*
72 * First APIC vector available to drivers: (vectors 0x30-0xee)
73 * we start at 0x31 to spread out vectors evenly between priority
74 * levels. (0x80 is the syscall vector)
75 */
76#define FIRST_DEVICE_VECTOR 0x31
77#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in irq.h */
78
79
80#ifndef __ASSEMBLY__
81extern u8 irq_vector[NR_IRQ_VECTORS];
82#define IO_APIC_VECTOR(irq) (irq_vector[irq])
83#define AUTO_ASSIGN -1
84
85/*
86 * Various low-level irq details needed by irq.c, process.c,
87 * time.c, io_apic.c and smp.c
88 *
89 * Interrupt entry/exit code at both C and assembly level
90 */
91
92extern void disable_8259A_irq(unsigned int irq);
93extern void enable_8259A_irq(unsigned int irq);
94extern int i8259A_irq_pending(unsigned int irq);
95extern void make_8259A_irq(unsigned int irq);
96extern void init_8259A(int aeoi);
97extern void FASTCALL(send_IPI_self(int vector));
98extern void init_VISWS_APIC_irqs(void);
99extern void setup_IO_APIC(void);
100extern void disable_IO_APIC(void);
101extern void print_IO_APIC(void);
102extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn);
103extern void send_IPI(int dest, int vector);
104extern void setup_ioapic_dest(void);
105
106extern unsigned long io_apic_irqs;
107
108extern atomic_t irq_err_count;
109extern atomic_t irq_mis_count;
110
111#define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
112
113#define __STR(x) #x
114#define STR(x) __STR(x)
115
116#include <asm/ptrace.h>
117
118#define IRQ_NAME2(nr) nr##_interrupt(void)
119#define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
120
121/*
122 * SMP has a few special interrupts for IPI messages
123 */
124
125#define BUILD_IRQ(nr) \
126asmlinkage void IRQ_NAME(nr); \
127__asm__( \
128"\n.p2align\n" \
129"IRQ" #nr "_interrupt:\n\t" \
130 "push $" #nr "-256 ; " \
131 "jmp common_interrupt");
132
133#if defined(CONFIG_X86_IO_APIC)
134static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {
135 if (IO_APIC_IRQ(i))
136 send_IPI_self(IO_APIC_VECTOR(i));
137}
138#else
139static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
140#endif
141
142#define platform_legacy_irq(irq) ((irq) < 16)
143
144#endif
145
146#endif /* _ASM_HW_IRQ_H */