1 #ifndef __ASM_IO_APIC_H
2 #define __ASM_IO_APIC_H
4 #include <linux/config.h>
6 #include <asm/mpspec.h>
9 * Intel IO-APIC support for SMP and UP systems.
11 * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar
14 #ifdef CONFIG_X86_IO_APIC
16 #define APIC_MISMATCH_DEBUG
18 #define IO_APIC_BASE(idx) \
19 ((volatile int *)(__fix_to_virt(FIX_IO_APIC_BASE_0 + idx) \
20 + (mp_ioapics[idx].mpc_apicaddr & ~PAGE_MASK)))
23 * The structure of the IO-APIC:
25 union IO_APIC_reg_00
{
28 u32 __reserved_2
: 14,
33 } __attribute__ ((packed
)) bits
;
36 union IO_APIC_reg_01
{
44 } __attribute__ ((packed
)) bits
;
47 union IO_APIC_reg_02
{
50 u32 __reserved_2
: 24,
53 } __attribute__ ((packed
)) bits
;
56 union IO_APIC_reg_03
{
61 } __attribute__ ((packed
)) bits
;
65 * # of IO-APICs and # of IRQ routing registers
67 extern int nr_ioapics
;
68 extern int nr_ioapic_registers
[MAX_IO_APICS
];
70 enum ioapic_irq_destination_types
{
81 struct IO_APIC_route_entry
{
83 delivery_mode
: 3, /* 000: FIXED
87 dest_mode
: 1, /* 0: physical, 1: logical */
91 trigger
: 1, /* 0: edge, 1: level */
92 mask
: 1, /* 0: enabled, 1: disabled */
95 union { struct { __u32
107 } __attribute__ ((packed
));
110 * MP-BIOS irq configuration table structures:
113 /* I/O APIC entries */
114 extern struct mpc_config_ioapic mp_ioapics
[MAX_IO_APICS
];
116 /* # of MP IRQ source entries */
117 extern int mp_irq_entries
;
119 /* MP IRQ source entries */
120 extern struct mpc_config_intsrc mp_irqs
[MAX_IRQ_SOURCES
];
122 /* non-0 if default (table-less) MP configuration */
123 extern int mpc_default_type
;
125 static inline unsigned int io_apic_read(unsigned int apic
, unsigned int reg
)
127 *IO_APIC_BASE(apic
) = reg
;
128 return *(IO_APIC_BASE(apic
)+4);
131 static inline void io_apic_write(unsigned int apic
, unsigned int reg
, unsigned int value
)
133 *IO_APIC_BASE(apic
) = reg
;
134 *(IO_APIC_BASE(apic
)+4) = value
;
138 * Re-write a value: to be used for read-modify-write
139 * cycles where the read already set up the index register.
141 static inline void io_apic_modify(unsigned int apic
, unsigned int value
)
143 *(IO_APIC_BASE(apic
)+4) = value
;
147 * Synchronize the IO-APIC and the CPU by doing
148 * a dummy read from the IO-APIC
150 static inline void io_apic_sync(unsigned int apic
)
152 (void) *(IO_APIC_BASE(apic
)+4);
155 /* 1 if "noapic" boot option passed */
156 extern int skip_ioapic_setup
;
159 * If we use the IO-APIC for IRQ routing, disable automatic
160 * assignment of PCI IRQ's.
162 #define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup)
164 #ifdef CONFIG_ACPI_BOOT
165 extern int io_apic_get_unique_id (int ioapic
, int apic_id
);
166 extern int io_apic_get_version (int ioapic
);
167 extern int io_apic_get_redir_entries (int ioapic
);
168 extern int io_apic_set_pci_routing (int ioapic
, int pin
, int irq
);
171 #ifdef CONFIG_ACPI_BOOT
172 extern int io_apic_get_unique_id (int ioapic
, int apic_id
);
173 extern int io_apic_get_version (int ioapic
);
174 extern int io_apic_get_redir_entries (int ioapic
);
175 extern int io_apic_set_pci_routing (int ioapic
, int pin
, int irq
);
178 extern int sis_apic_bug
; /* dummy */
181 #else /* !CONFIG_X86_IO_APIC */
182 #define io_apic_assign_pci_irqs 0
185 void enable_NMI_through_LVT0 (void * dummy
);