Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #ifndef __ASSEMBLY__ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <asm/atomic.h> |
| 19 | #include <asm/irq.h> |
| 20 | #include <linux/profile.h> |
| 21 | #include <linux/smp.h> |
| 22 | |
| 23 | struct hw_interrupt_type; |
| 24 | #endif |
| 25 | |
Jan Beulich | 1a426cb | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 26 | #define NMI_VECTOR 0x02 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | */ |
| 47 | #define SPURIOUS_APIC_VECTOR 0xff |
| 48 | #define ERROR_APIC_VECTOR 0xfe |
Andi Kleen | e5bc8b6 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 49 | #define RESCHEDULE_VECTOR 0xfd |
| 50 | #define CALL_FUNCTION_VECTOR 0xfc |
Andi Kleen | 915f34e | 2006-01-11 22:45:54 +0100 | [diff] [blame] | 51 | /* fb free - please don't readd KDB here because it's useless |
| 52 | (hint - think what a NMI bit does to a vector) */ |
Andi Kleen | e5bc8b6 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 53 | #define THERMAL_APIC_VECTOR 0xfa |
Jacob Shin | 89b831e | 2005-11-05 17:25:53 +0100 | [diff] [blame] | 54 | #define THRESHOLD_APIC_VECTOR 0xf9 |
Jason Uhlenkott | e080e9d | 2006-01-11 22:45:51 +0100 | [diff] [blame] | 55 | /* f8 free */ |
| 56 | #define INVALIDATE_TLB_VECTOR_END 0xf7 |
| 57 | #define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f7 used for TLB flush */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
Andi Kleen | e5bc8b6 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 59 | #define NUM_INVALIDATE_TLB_VECTORS 8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | |
| 61 | /* |
| 62 | * Local APIC timer IRQ vector is on a different priority level, |
| 63 | * to work around the 'lost local interrupt if more than 2 IRQ |
| 64 | * sources per level' errata. |
| 65 | */ |
| 66 | #define LOCAL_TIMER_VECTOR 0xef |
| 67 | |
| 68 | /* |
| 69 | * First APIC vector available to drivers: (vectors 0x30-0xee) |
| 70 | * we start at 0x31 to spread out vectors evenly between priority |
| 71 | * levels. (0x80 is the syscall vector) |
| 72 | */ |
| 73 | #define FIRST_DEVICE_VECTOR 0x31 |
| 74 | #define FIRST_SYSTEM_VECTOR 0xef /* duplicated in irq.h */ |
| 75 | |
| 76 | |
| 77 | #ifndef __ASSEMBLY__ |
| 78 | extern u8 irq_vector[NR_IRQ_VECTORS]; |
| 79 | #define IO_APIC_VECTOR(irq) (irq_vector[irq]) |
| 80 | #define AUTO_ASSIGN -1 |
| 81 | |
| 82 | /* |
| 83 | * Various low-level irq details needed by irq.c, process.c, |
| 84 | * time.c, io_apic.c and smp.c |
| 85 | * |
| 86 | * Interrupt entry/exit code at both C and assembly level |
| 87 | */ |
| 88 | |
| 89 | extern void disable_8259A_irq(unsigned int irq); |
| 90 | extern void enable_8259A_irq(unsigned int irq); |
| 91 | extern int i8259A_irq_pending(unsigned int irq); |
| 92 | extern void make_8259A_irq(unsigned int irq); |
| 93 | extern void init_8259A(int aeoi); |
| 94 | extern void FASTCALL(send_IPI_self(int vector)); |
| 95 | extern void init_VISWS_APIC_irqs(void); |
| 96 | extern void setup_IO_APIC(void); |
| 97 | extern void disable_IO_APIC(void); |
| 98 | extern void print_IO_APIC(void); |
| 99 | extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn); |
| 100 | extern void send_IPI(int dest, int vector); |
| 101 | extern void setup_ioapic_dest(void); |
| 102 | |
| 103 | extern unsigned long io_apic_irqs; |
| 104 | |
| 105 | extern atomic_t irq_err_count; |
| 106 | extern atomic_t irq_mis_count; |
| 107 | |
| 108 | #define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs)) |
| 109 | |
| 110 | #define __STR(x) #x |
| 111 | #define STR(x) __STR(x) |
| 112 | |
| 113 | #include <asm/ptrace.h> |
| 114 | |
| 115 | #define IRQ_NAME2(nr) nr##_interrupt(void) |
| 116 | #define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr) |
| 117 | |
| 118 | /* |
| 119 | * SMP has a few special interrupts for IPI messages |
| 120 | */ |
| 121 | |
| 122 | #define BUILD_IRQ(nr) \ |
| 123 | asmlinkage void IRQ_NAME(nr); \ |
| 124 | __asm__( \ |
| 125 | "\n.p2align\n" \ |
| 126 | "IRQ" #nr "_interrupt:\n\t" \ |
Rusty Russell | 19eadf9 | 2006-06-27 02:53:44 -0700 | [diff] [blame^] | 127 | "push $~(" #nr ") ; " \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | "jmp common_interrupt"); |
| 129 | |
| 130 | #if defined(CONFIG_X86_IO_APIC) |
| 131 | static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) { |
| 132 | if (IO_APIC_IRQ(i)) |
| 133 | send_IPI_self(IO_APIC_VECTOR(i)); |
| 134 | } |
| 135 | #else |
| 136 | static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {} |
| 137 | #endif |
| 138 | |
| 139 | #define platform_legacy_irq(irq) ((irq) < 16) |
| 140 | |
| 141 | #endif |
| 142 | |
| 143 | #endif /* _ASM_HW_IRQ_H */ |