io_apic.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. #ifndef __ASM_IO_APIC_H
  2. #define __ASM_IO_APIC_H
  3. #include <asm/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. /*
  12. * The structure of the IO-APIC:
  13. */
  14. union IO_APIC_reg_00 {
  15. u32 raw;
  16. struct {
  17. u32 __reserved_2 : 14,
  18. LTS : 1,
  19. delivery_type : 1,
  20. __reserved_1 : 8,
  21. ID : 8;
  22. } __attribute__ ((packed)) bits;
  23. };
  24. union IO_APIC_reg_01 {
  25. u32 raw;
  26. struct {
  27. u32 version : 8,
  28. __reserved_2 : 7,
  29. PRQ : 1,
  30. entries : 8,
  31. __reserved_1 : 8;
  32. } __attribute__ ((packed)) bits;
  33. };
  34. union IO_APIC_reg_02 {
  35. u32 raw;
  36. struct {
  37. u32 __reserved_2 : 24,
  38. arbitration : 4,
  39. __reserved_1 : 4;
  40. } __attribute__ ((packed)) bits;
  41. };
  42. union IO_APIC_reg_03 {
  43. u32 raw;
  44. struct {
  45. u32 boot_DT : 1,
  46. __reserved_1 : 31;
  47. } __attribute__ ((packed)) bits;
  48. };
  49. enum ioapic_irq_destination_types {
  50. dest_Fixed = 0,
  51. dest_LowestPrio = 1,
  52. dest_SMI = 2,
  53. dest__reserved_1 = 3,
  54. dest_NMI = 4,
  55. dest_INIT = 5,
  56. dest__reserved_2 = 6,
  57. dest_ExtINT = 7
  58. };
  59. struct IO_APIC_route_entry {
  60. __u32 vector : 8,
  61. delivery_mode : 3, /* 000: FIXED
  62. * 001: lowest prio
  63. * 111: ExtINT
  64. */
  65. dest_mode : 1, /* 0: physical, 1: logical */
  66. delivery_status : 1,
  67. polarity : 1,
  68. irr : 1,
  69. trigger : 1, /* 0: edge, 1: level */
  70. mask : 1, /* 0: enabled, 1: disabled */
  71. __reserved_2 : 15;
  72. #ifdef CONFIG_X86_32
  73. union {
  74. struct {
  75. __u32 __reserved_1 : 24,
  76. physical_dest : 4,
  77. __reserved_2 : 4;
  78. } physical;
  79. struct {
  80. __u32 __reserved_1 : 24,
  81. logical_dest : 8;
  82. } logical;
  83. } dest;
  84. #else
  85. __u32 __reserved_3 : 24,
  86. dest : 8;
  87. #endif
  88. } __attribute__ ((packed));
  89. #ifdef CONFIG_X86_IO_APIC
  90. /*
  91. * # of IO-APICs and # of IRQ routing registers
  92. */
  93. extern int nr_ioapics;
  94. extern int nr_ioapic_registers[MAX_IO_APICS];
  95. /*
  96. * MP-BIOS irq configuration table structures:
  97. */
  98. struct mp_ioapic_routing {
  99. int apic_id;
  100. int gsi_base;
  101. int gsi_end;
  102. u32 pin_programmed[4];
  103. };
  104. /* I/O APIC entries */
  105. extern struct mpc_config_ioapic mp_ioapics[MAX_IO_APICS];
  106. /* # of MP IRQ source entries */
  107. extern int mp_irq_entries;
  108. /* MP IRQ source entries */
  109. extern struct mpc_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
  110. /* non-0 if default (table-less) MP configuration */
  111. extern int mpc_default_type;
  112. /* Older SiS APIC requires we rewrite the index register */
  113. extern int sis_apic_bug;
  114. /* 1 if "noapic" boot option passed */
  115. extern int skip_ioapic_setup;
  116. static inline void disable_ioapic_setup(void)
  117. {
  118. skip_ioapic_setup = 1;
  119. }
  120. /*
  121. * If we use the IO-APIC for IRQ routing, disable automatic
  122. * assignment of PCI IRQ's.
  123. */
  124. #define io_apic_assign_pci_irqs \
  125. (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs)
  126. #ifdef CONFIG_ACPI
  127. extern int io_apic_get_unique_id(int ioapic, int apic_id);
  128. extern int io_apic_get_version(int ioapic);
  129. extern int io_apic_get_redir_entries(int ioapic);
  130. extern int io_apic_set_pci_routing(int ioapic, int pin, int irq,
  131. int edge_level, int active_high_low);
  132. #endif /* CONFIG_ACPI */
  133. extern int (*ioapic_renumber_irq)(int ioapic, int irq);
  134. extern void ioapic_init_mappings(void);
  135. #else /* !CONFIG_X86_IO_APIC */
  136. #define io_apic_assign_pci_irqs 0
  137. #endif
  138. #endif