1 #ifndef __ASM_IO_APIC_H
2 #define __ASM_IO_APIC_H
4 #include <linux/config.h>
8 * Intel IO-APIC support for SMP and UP systems.
10 * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar
13 #ifdef CONFIG_X86_IO_APIC
15 #define APIC_MISMATCH_DEBUG
17 #define IO_APIC_BASE(idx) \
18 ((volatile int *)(__fix_to_virt(FIX_IO_APIC_BASE_0 + idx) \
19 + (mp_ioapics[idx].mpc_apicaddr & ~PAGE_MASK)))
22 * The structure of the IO-APIC:
24 struct IO_APIC_reg_00 {
25 __u32 __reserved_2 : 24,
28 } __attribute__ ((packed));
30 struct IO_APIC_reg_01 {
36 } __attribute__ ((packed));
38 struct IO_APIC_reg_02 {
39 __u32 __reserved_2 : 24,
42 } __attribute__ ((packed));
45 * # of IO-APICs and # of IRQ routing registers
47 extern int nr_ioapics;
48 extern int nr_ioapic_registers[MAX_IO_APICS];
50 enum ioapic_irq_destination_types {
61 struct IO_APIC_route_entry {
63 delivery_mode : 3, /* 000: FIXED
67 dest_mode : 1, /* 0: physical, 1: logical */
71 trigger : 1, /* 0: edge, 1: level */
72 mask : 1, /* 0: enabled, 1: disabled */
75 union { struct { __u32
87 } __attribute__ ((packed));
90 * MP-BIOS irq configuration table structures:
93 /* I/O APIC entries */
94 extern struct mpc_config_ioapic mp_ioapics[MAX_IO_APICS];
96 /* # of MP IRQ source entries */
97 extern int mp_irq_entries;
99 /* MP IRQ source entries */
100 extern struct mpc_config_intsrc *mp_irqs;
102 /* non-0 if default (table-less) MP configuration */
103 extern int mpc_default_type;
105 static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg)
107 *IO_APIC_BASE(apic) = reg;
108 return *(IO_APIC_BASE(apic)+4);
111 static inline void io_apic_write(unsigned int apic, unsigned int reg, unsigned int value)
113 *IO_APIC_BASE(apic) = reg;
114 *(IO_APIC_BASE(apic)+4) = value;
118 * Re-write a value: to be used for read-modify-write
119 * cycles where the read already set up the index register.
121 static inline void io_apic_modify(unsigned int apic, unsigned int value)
123 *(IO_APIC_BASE(apic)+4) = value;
127 * Synchronize the IO-APIC and the CPU by doing
128 * a dummy read from the IO-APIC
130 static inline void io_apic_sync(unsigned int apic)
132 (void) *(IO_APIC_BASE(apic)+4);
135 /* 1 if "noapic" boot option passed */
136 extern int skip_ioapic_setup;
139 * If we use the IO-APIC for IRQ routing, disable automatic
140 * assignment of PCI IRQ's.
142 #define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup)
144 #else /* !CONFIG_X86_IO_APIC */
145 #define io_apic_assign_pci_irqs 0