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 IO_APIC_BASE(idx) \
16 ((volatile int *)__fix_to_virt(FIX_IO_APIC_BASE_0 + idx))
19 * The structure of the IO-APIC:
21 struct IO_APIC_reg_00
{
22 __u32 __reserved_2
: 24,
25 } __attribute__ ((packed
));
27 struct IO_APIC_reg_01
{
32 } __attribute__ ((packed
));
34 struct IO_APIC_reg_02
{
35 __u32 __reserved_2
: 24,
38 } __attribute__ ((packed
));
41 * # of IO-APICs and # of IRQ routing registers
43 extern int nr_ioapics
;
44 extern int nr_ioapic_registers
[MAX_IO_APICS
];
46 enum ioapic_irq_destination_types
{
57 struct IO_APIC_route_entry
{
59 delivery_mode
: 3, /* 000: FIXED
63 dest_mode
: 1, /* 0: physical, 1: logical */
67 trigger
: 1, /* 0: edge, 1: level */
68 mask
: 1, /* 0: enabled, 1: disabled */
71 union { struct { __u32
83 } __attribute__ ((packed
));
86 * MP-BIOS irq configuration table structures:
89 /* I/O APIC entries */
90 extern struct mpc_config_ioapic mp_ioapics
[MAX_IO_APICS
];
92 /* # of MP IRQ source entries */
93 extern int mp_irq_entries
;
95 /* MP IRQ source entries */
96 extern struct mpc_config_intsrc mp_irqs
[MAX_IRQ_SOURCES
];
98 /* non-0 if default (table-less) MP configuration */
99 extern int mpc_default_type
;
101 static inline unsigned int io_apic_read(unsigned int apic
, unsigned int reg
)
103 *IO_APIC_BASE(apic
) = reg
;
104 return *(IO_APIC_BASE(apic
)+4);
107 static inline void io_apic_write(unsigned int apic
, unsigned int reg
, unsigned int value
)
109 *IO_APIC_BASE(apic
) = reg
;
110 *(IO_APIC_BASE(apic
)+4) = value
;
114 * Re-write a value: to be used for read-modify-write
115 * cycles where the read already set up the index register.
117 static inline void io_apic_modify(unsigned int apic
, unsigned int value
)
119 *(IO_APIC_BASE(apic
)+4) = value
;
123 * Synchronize the IO-APIC and the CPU by doing
124 * a dummy read from the IO-APIC
126 static inline void io_apic_sync(unsigned int apic
)
128 (void) *(IO_APIC_BASE(apic
)+4);
131 extern int nmi_watchdog
;
132 /* 1 if "noapic" boot option passed */
133 extern int skip_ioapic_setup
;
134 extern void IO_APIC_init_uniprocessor (void);
137 * If we use the IO-APIC for IRQ routing, disable automatic
138 * assignment of PCI IRQ's.
140 #define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup)
142 #else /* !CONFIG_X86_IO_APIC */
143 #define io_apic_assign_pci_irqs 0