1 #ifndef ASM_X86__IO_APIC_H
2 #define ASM_X86__IO_APIC_H
4 #include <linux/types.h>
5 #include <asm/mpspec.h>
6 #include <asm/apicdef.h>
9 * Intel IO-APIC support for SMP and UP systems.
11 * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar
14 /* I/O Unit Redirection Table */
15 #define IO_APIC_REDIR_VECTOR_MASK 0x000FF
16 #define IO_APIC_REDIR_DEST_LOGICAL 0x00800
17 #define IO_APIC_REDIR_DEST_PHYSICAL 0x00000
18 #define IO_APIC_REDIR_SEND_PENDING (1 << 12)
19 #define IO_APIC_REDIR_REMOTE_IRR (1 << 14)
20 #define IO_APIC_REDIR_LEVEL_TRIGGER (1 << 15)
21 #define IO_APIC_REDIR_MASKED (1 << 16)
24 * The structure of the IO-APIC:
26 union IO_APIC_reg_00 {
29 u32 __reserved_2 : 14,
34 } __attribute__ ((packed)) bits;
37 union IO_APIC_reg_01 {
45 } __attribute__ ((packed)) bits;
48 union IO_APIC_reg_02 {
51 u32 __reserved_2 : 24,
54 } __attribute__ ((packed)) bits;
57 union IO_APIC_reg_03 {
62 } __attribute__ ((packed)) bits;
65 enum ioapic_irq_destination_types {
76 struct IO_APIC_route_entry {
78 delivery_mode : 3, /* 000: FIXED
82 dest_mode : 1, /* 0: physical, 1: logical */
86 trigger : 1, /* 0: edge, 1: level */
87 mask : 1, /* 0: enabled, 1: disabled */
93 __u32 __reserved_1 : 24,
99 __u32 __reserved_1 : 24,
104 __u32 __reserved_3 : 24,
108 } __attribute__ ((packed));
110 struct IR_IO_APIC_route_entry {
122 } __attribute__ ((packed));
124 #ifdef CONFIG_X86_IO_APIC
127 * # of IO-APICs and # of IRQ routing registers
129 extern int nr_ioapics;
130 extern int nr_ioapic_registers[MAX_IO_APICS];
133 * MP-BIOS irq configuration table structures:
136 #define MP_MAX_IOAPIC_PIN 127
138 struct mp_config_ioapic {
139 unsigned long mp_apicaddr;
140 unsigned int mp_apicid;
141 unsigned char mp_type;
142 unsigned char mp_apicver;
143 unsigned char mp_flags;
146 struct mp_config_intsrc {
147 unsigned int mp_dstapic;
148 unsigned char mp_type;
149 unsigned char mp_irqtype;
150 unsigned short mp_irqflag;
151 unsigned char mp_srcbus;
152 unsigned char mp_srcbusirq;
153 unsigned char mp_dstirq;
156 /* I/O APIC entries */
157 extern struct mp_config_ioapic mp_ioapics[MAX_IO_APICS];
159 /* # of MP IRQ source entries */
160 extern int mp_irq_entries;
162 /* MP IRQ source entries */
163 extern struct mp_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
165 /* non-0 if default (table-less) MP configuration */
166 extern int mpc_default_type;
168 /* Older SiS APIC requires we rewrite the index register */
169 extern int sis_apic_bug;
171 /* 1 if "noapic" boot option passed */
172 extern int skip_ioapic_setup;
174 /* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */
175 extern int timer_through_8259;
177 static inline void disable_ioapic_setup(void)
179 skip_ioapic_setup = 1;
183 * If we use the IO-APIC for IRQ routing, disable automatic
184 * assignment of PCI IRQ's.
186 #define io_apic_assign_pci_irqs \
187 (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs)
190 extern int io_apic_get_unique_id(int ioapic, int apic_id);
191 extern int io_apic_get_version(int ioapic);
192 extern int io_apic_get_redir_entries(int ioapic);
193 extern int io_apic_set_pci_routing(int ioapic, int pin, int irq,
194 int edge_level, int active_high_low);
195 #endif /* CONFIG_ACPI */
197 extern int (*ioapic_renumber_irq)(int ioapic, int irq);
198 extern void ioapic_init_mappings(void);
201 extern int save_mask_IO_APIC_setup(void);
202 extern void restore_IO_APIC_setup(void);
203 extern void reinit_intr_remapped_IO_APIC(int);
206 #else /* !CONFIG_X86_IO_APIC */
207 #define io_apic_assign_pci_irqs 0
208 static const int timer_through_8259 = 0;
209 static inline void ioapic_init_mappings(void) { }
212 #endif /* ASM_X86__IO_APIC_H */