hw_irq.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #ifndef _ASM_HW_IRQ_H
  2. #define _ASM_HW_IRQ_H
  3. /*
  4. * linux/include/asm/hw_irq.h
  5. *
  6. * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
  7. *
  8. * moved some of the old arch/i386/kernel/irq.h to here. VY
  9. *
  10. * IRQ/IPI changes taken from work by Thomas Radke
  11. * <tomsoft@informatik.tu-chemnitz.de>
  12. *
  13. * hacked by Andi Kleen for x86-64.
  14. *
  15. * $Id: hw_irq.h,v 1.24 2001/09/14 20:55:03 vojtech Exp $
  16. */
  17. #ifndef __ASSEMBLY__
  18. #include <linux/config.h>
  19. #include <asm/atomic.h>
  20. #include <asm/irq.h>
  21. #include <linux/profile.h>
  22. #include <linux/smp.h>
  23. struct hw_interrupt_type;
  24. #endif
  25. #define NMI_VECTOR 0x02
  26. /*
  27. * IDT vectors usable for external interrupt sources start
  28. * at 0x20:
  29. */
  30. #define FIRST_EXTERNAL_VECTOR 0x20
  31. #define IA32_SYSCALL_VECTOR 0x80
  32. /*
  33. * Vectors 0x20-0x2f are used for ISA interrupts.
  34. */
  35. /*
  36. * Special IRQ vectors used by the SMP architecture, 0xf0-0xff
  37. *
  38. * some of the following vectors are 'rare', they are merged
  39. * into a single vector (CALL_FUNCTION_VECTOR) to save vector space.
  40. * TLB, reschedule and local APIC vectors are performance-critical.
  41. *
  42. * Vectors 0xf0-0xf9 are free (reserved for future Linux use).
  43. */
  44. #define SPURIOUS_APIC_VECTOR 0xff
  45. #define ERROR_APIC_VECTOR 0xfe
  46. #define RESCHEDULE_VECTOR 0xfd
  47. #define CALL_FUNCTION_VECTOR 0xfc
  48. #define KDB_VECTOR 0xfb /* reserved for KDB */
  49. #define THERMAL_APIC_VECTOR 0xfa
  50. /* 0xf9 free */
  51. #define INVALIDATE_TLB_VECTOR_END 0xf8
  52. #define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f8 used for TLB flush */
  53. #define NUM_INVALIDATE_TLB_VECTORS 8
  54. /*
  55. * Local APIC timer IRQ vector is on a different priority level,
  56. * to work around the 'lost local interrupt if more than 2 IRQ
  57. * sources per level' errata.
  58. */
  59. #define LOCAL_TIMER_VECTOR 0xef
  60. /*
  61. * First APIC vector available to drivers: (vectors 0x30-0xee)
  62. * we start at 0x31 to spread out vectors evenly between priority
  63. * levels. (0x80 is the syscall vector)
  64. */
  65. #define FIRST_DEVICE_VECTOR 0x31
  66. #define FIRST_SYSTEM_VECTOR 0xef /* duplicated in irq.h */
  67. #ifndef __ASSEMBLY__
  68. extern u8 irq_vector[NR_IRQ_VECTORS];
  69. #define IO_APIC_VECTOR(irq) (irq_vector[irq])
  70. #define AUTO_ASSIGN -1
  71. /*
  72. * Various low-level irq details needed by irq.c, process.c,
  73. * time.c, io_apic.c and smp.c
  74. *
  75. * Interrupt entry/exit code at both C and assembly level
  76. */
  77. extern void disable_8259A_irq(unsigned int irq);
  78. extern void enable_8259A_irq(unsigned int irq);
  79. extern int i8259A_irq_pending(unsigned int irq);
  80. extern void make_8259A_irq(unsigned int irq);
  81. extern void init_8259A(int aeoi);
  82. extern void FASTCALL(send_IPI_self(int vector));
  83. extern void init_VISWS_APIC_irqs(void);
  84. extern void setup_IO_APIC(void);
  85. extern void disable_IO_APIC(void);
  86. extern void print_IO_APIC(void);
  87. extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn);
  88. extern void send_IPI(int dest, int vector);
  89. extern void setup_ioapic_dest(void);
  90. extern unsigned long io_apic_irqs;
  91. extern atomic_t irq_err_count;
  92. extern atomic_t irq_mis_count;
  93. #define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
  94. #define __STR(x) #x
  95. #define STR(x) __STR(x)
  96. #include <asm/ptrace.h>
  97. #define IRQ_NAME2(nr) nr##_interrupt(void)
  98. #define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
  99. /*
  100. * SMP has a few special interrupts for IPI messages
  101. */
  102. #define BUILD_IRQ(nr) \
  103. asmlinkage void IRQ_NAME(nr); \
  104. __asm__( \
  105. "\n.p2align\n" \
  106. "IRQ" #nr "_interrupt:\n\t" \
  107. "push $" #nr "-256 ; " \
  108. "jmp common_interrupt");
  109. #if defined(CONFIG_X86_IO_APIC)
  110. static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {
  111. if (IO_APIC_IRQ(i))
  112. send_IPI_self(IO_APIC_VECTOR(i));
  113. }
  114. #else
  115. static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
  116. #endif
  117. #define platform_legacy_irq(irq) ((irq) < 16)
  118. #endif
  119. #endif /* _ASM_HW_IRQ_H */