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 */
90 __u32 __reserved_3
: 24,
92 } __attribute__ ((packed
));
94 struct IR_IO_APIC_route_entry
{
106 } __attribute__ ((packed
));
108 #ifdef CONFIG_X86_IO_APIC
111 * # of IO-APICs and # of IRQ routing registers
113 extern int nr_ioapics
;
114 extern int nr_ioapic_registers
[MAX_IO_APICS
];
117 * MP-BIOS irq configuration table structures:
120 #define MP_MAX_IOAPIC_PIN 127
122 struct mp_config_ioapic
{
123 unsigned long mp_apicaddr
;
124 unsigned int mp_apicid
;
125 unsigned char mp_type
;
126 unsigned char mp_apicver
;
127 unsigned char mp_flags
;
130 struct mp_config_intsrc
{
131 unsigned int mp_dstapic
;
132 unsigned char mp_type
;
133 unsigned char mp_irqtype
;
134 unsigned short mp_irqflag
;
135 unsigned char mp_srcbus
;
136 unsigned char mp_srcbusirq
;
137 unsigned char mp_dstirq
;
140 /* I/O APIC entries */
141 extern struct mp_config_ioapic mp_ioapics
[MAX_IO_APICS
];
143 /* # of MP IRQ source entries */
144 extern int mp_irq_entries
;
146 /* MP IRQ source entries */
147 extern struct mp_config_intsrc mp_irqs
[MAX_IRQ_SOURCES
];
149 /* non-0 if default (table-less) MP configuration */
150 extern int mpc_default_type
;
152 /* Older SiS APIC requires we rewrite the index register */
153 extern int sis_apic_bug
;
155 /* 1 if "noapic" boot option passed */
156 extern int skip_ioapic_setup
;
158 /* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */
159 extern int timer_through_8259
;
161 static inline void disable_ioapic_setup(void)
163 skip_ioapic_setup
= 1;
167 * If we use the IO-APIC for IRQ routing, disable automatic
168 * assignment of PCI IRQ's.
170 #define io_apic_assign_pci_irqs \
171 (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs)
174 extern int io_apic_get_unique_id(int ioapic
, int apic_id
);
175 extern int io_apic_get_version(int ioapic
);
176 extern int io_apic_get_redir_entries(int ioapic
);
177 extern int io_apic_set_pci_routing(int ioapic
, int pin
, int irq
,
178 int edge_level
, int active_high_low
);
179 #endif /* CONFIG_ACPI */
181 extern int (*ioapic_renumber_irq
)(int ioapic
, int irq
);
182 extern void ioapic_init_mappings(void);
185 extern int save_mask_IO_APIC_setup(void);
186 extern void restore_IO_APIC_setup(void);
187 extern void reinit_intr_remapped_IO_APIC(int);
190 #else /* !CONFIG_X86_IO_APIC */
191 #define io_apic_assign_pci_irqs 0
192 static const int timer_through_8259
= 0;
193 static inline void ioapic_init_mappings(void) { }
196 #endif /* ASM_X86__IO_APIC_H */