io_apic.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. #ifndef ASM_X86__IO_APIC_H
  2. #define ASM_X86__IO_APIC_H
  3. #include <linux/types.h>
  4. #include <asm/mpspec.h>
  5. #include <asm/apicdef.h>
  6. /*
  7. * Intel IO-APIC support for SMP and UP systems.
  8. *
  9. * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar
  10. */
  11. /* I/O Unit Redirection Table */
  12. #define IO_APIC_REDIR_VECTOR_MASK 0x000FF
  13. #define IO_APIC_REDIR_DEST_LOGICAL 0x00800
  14. #define IO_APIC_REDIR_DEST_PHYSICAL 0x00000
  15. #define IO_APIC_REDIR_SEND_PENDING (1 << 12)
  16. #define IO_APIC_REDIR_REMOTE_IRR (1 << 14)
  17. #define IO_APIC_REDIR_LEVEL_TRIGGER (1 << 15)
  18. #define IO_APIC_REDIR_MASKED (1 << 16)
  19. /*
  20. * The structure of the IO-APIC:
  21. */
  22. union IO_APIC_reg_00 {
  23. u32 raw;
  24. struct {
  25. u32 __reserved_2 : 14,
  26. LTS : 1,
  27. delivery_type : 1,
  28. __reserved_1 : 8,
  29. ID : 8;
  30. } __attribute__ ((packed)) bits;
  31. };
  32. union IO_APIC_reg_01 {
  33. u32 raw;
  34. struct {
  35. u32 version : 8,
  36. __reserved_2 : 7,
  37. PRQ : 1,
  38. entries : 8,
  39. __reserved_1 : 8;
  40. } __attribute__ ((packed)) bits;
  41. };
  42. union IO_APIC_reg_02 {
  43. u32 raw;
  44. struct {
  45. u32 __reserved_2 : 24,
  46. arbitration : 4,
  47. __reserved_1 : 4;
  48. } __attribute__ ((packed)) bits;
  49. };
  50. union IO_APIC_reg_03 {
  51. u32 raw;
  52. struct {
  53. u32 boot_DT : 1,
  54. __reserved_1 : 31;
  55. } __attribute__ ((packed)) bits;
  56. };
  57. enum ioapic_irq_destination_types {
  58. dest_Fixed = 0,
  59. dest_LowestPrio = 1,
  60. dest_SMI = 2,
  61. dest__reserved_1 = 3,
  62. dest_NMI = 4,
  63. dest_INIT = 5,
  64. dest__reserved_2 = 6,
  65. dest_ExtINT = 7
  66. };
  67. struct IO_APIC_route_entry {
  68. __u32 vector : 8,
  69. delivery_mode : 3, /* 000: FIXED
  70. * 001: lowest prio
  71. * 111: ExtINT
  72. */
  73. dest_mode : 1, /* 0: physical, 1: logical */
  74. delivery_status : 1,
  75. polarity : 1,
  76. irr : 1,
  77. trigger : 1, /* 0: edge, 1: level */
  78. mask : 1, /* 0: enabled, 1: disabled */
  79. __reserved_2 : 15;
  80. #ifdef CONFIG_X86_32
  81. union {
  82. struct {
  83. __u32 __reserved_1 : 24,
  84. physical_dest : 4,
  85. __reserved_2 : 4;
  86. } physical;
  87. struct {
  88. __u32 __reserved_1 : 24,
  89. logical_dest : 8;
  90. } logical;
  91. } dest;
  92. #else
  93. __u32 __reserved_3 : 24,
  94. dest : 8;
  95. #endif
  96. } __attribute__ ((packed));
  97. #ifdef CONFIG_X86_IO_APIC
  98. /*
  99. * # of IO-APICs and # of IRQ routing registers
  100. */
  101. extern int nr_ioapics;
  102. extern int nr_ioapic_registers[MAX_IO_APICS];
  103. /*
  104. * MP-BIOS irq configuration table structures:
  105. */
  106. #define MP_MAX_IOAPIC_PIN 127
  107. struct mp_config_ioapic {
  108. unsigned long mp_apicaddr;
  109. unsigned int mp_apicid;
  110. unsigned char mp_type;
  111. unsigned char mp_apicver;
  112. unsigned char mp_flags;
  113. };
  114. struct mp_config_intsrc {
  115. unsigned int mp_dstapic;
  116. unsigned char mp_type;
  117. unsigned char mp_irqtype;
  118. unsigned short mp_irqflag;
  119. unsigned char mp_srcbus;
  120. unsigned char mp_srcbusirq;
  121. unsigned char mp_dstirq;
  122. };
  123. /* I/O APIC entries */
  124. extern struct mp_config_ioapic mp_ioapics[MAX_IO_APICS];
  125. /* # of MP IRQ source entries */
  126. extern int mp_irq_entries;
  127. /* MP IRQ source entries */
  128. extern struct mp_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
  129. /* non-0 if default (table-less) MP configuration */
  130. extern int mpc_default_type;
  131. /* Older SiS APIC requires we rewrite the index register */
  132. extern int sis_apic_bug;
  133. /* 1 if "noapic" boot option passed */
  134. extern int skip_ioapic_setup;
  135. /* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */
  136. extern int timer_through_8259;
  137. static inline void disable_ioapic_setup(void)
  138. {
  139. skip_ioapic_setup = 1;
  140. }
  141. /*
  142. * If we use the IO-APIC for IRQ routing, disable automatic
  143. * assignment of PCI IRQ's.
  144. */
  145. #define io_apic_assign_pci_irqs \
  146. (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs)
  147. #ifdef CONFIG_ACPI
  148. extern int io_apic_get_unique_id(int ioapic, int apic_id);
  149. extern int io_apic_get_version(int ioapic);
  150. extern int io_apic_get_redir_entries(int ioapic);
  151. extern int io_apic_set_pci_routing(int ioapic, int pin, int irq,
  152. int edge_level, int active_high_low);
  153. #endif /* CONFIG_ACPI */
  154. extern int (*ioapic_renumber_irq)(int ioapic, int irq);
  155. extern void ioapic_init_mappings(void);
  156. #else /* !CONFIG_X86_IO_APIC */
  157. #define io_apic_assign_pci_irqs 0
  158. static const int timer_through_8259 = 0;
  159. static inline void ioapic_init_mappings(void) { }
  160. #endif
  161. #endif /* ASM_X86__IO_APIC_H */