blob: 86d8c3bdcca42447f1375f4bf3b7967eac010558 [file] [log] [blame]
Thomas Gleixnere1d91972008-01-30 13:30:37 +01001#ifndef __ASM_IO_APIC_H
2#define __ASM_IO_APIC_H
3
Akinobu Mitaa1a33fa2008-04-19 23:55:13 +09004#include <linux/types.h>
Thomas Gleixnere1d91972008-01-30 13:30:37 +01005#include <asm/mpspec.h>
6#include <asm/apicdef.h>
7
8/*
9 * Intel IO-APIC support for SMP and UP systems.
10 *
11 * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar
12 */
13
14/*
15 * The structure of the IO-APIC:
16 */
17union IO_APIC_reg_00 {
18 u32 raw;
19 struct {
20 u32 __reserved_2 : 14,
21 LTS : 1,
22 delivery_type : 1,
23 __reserved_1 : 8,
24 ID : 8;
25 } __attribute__ ((packed)) bits;
26};
27
28union IO_APIC_reg_01 {
29 u32 raw;
30 struct {
31 u32 version : 8,
32 __reserved_2 : 7,
33 PRQ : 1,
34 entries : 8,
35 __reserved_1 : 8;
36 } __attribute__ ((packed)) bits;
37};
38
39union IO_APIC_reg_02 {
40 u32 raw;
41 struct {
42 u32 __reserved_2 : 24,
43 arbitration : 4,
44 __reserved_1 : 4;
45 } __attribute__ ((packed)) bits;
46};
47
48union IO_APIC_reg_03 {
49 u32 raw;
50 struct {
51 u32 boot_DT : 1,
52 __reserved_1 : 31;
53 } __attribute__ ((packed)) bits;
54};
55
56enum ioapic_irq_destination_types {
57 dest_Fixed = 0,
58 dest_LowestPrio = 1,
59 dest_SMI = 2,
60 dest__reserved_1 = 3,
61 dest_NMI = 4,
62 dest_INIT = 5,
63 dest__reserved_2 = 6,
64 dest_ExtINT = 7
65};
66
67struct IO_APIC_route_entry {
68 __u32 vector : 8,
69 delivery_mode : 3, /* 000: FIXED
70 * 001: lowest prio
71 * 111: ExtINT
72 */
73 dest_mode : 1, /* 0: physical, 1: logical */
74 delivery_status : 1,
75 polarity : 1,
76 irr : 1,
77 trigger : 1, /* 0: edge, 1: level */
78 mask : 1, /* 0: enabled, 1: disabled */
79 __reserved_2 : 15;
80
Thomas Gleixner96a388d2007-10-11 11:20:03 +020081#ifdef CONFIG_X86_32
Thomas Gleixnere1d91972008-01-30 13:30:37 +010082 union {
83 struct {
84 __u32 __reserved_1 : 24,
85 physical_dest : 4,
86 __reserved_2 : 4;
87 } physical;
88
89 struct {
90 __u32 __reserved_1 : 24,
91 logical_dest : 8;
92 } logical;
93 } dest;
Thomas Gleixner96a388d2007-10-11 11:20:03 +020094#else
Thomas Gleixnere1d91972008-01-30 13:30:37 +010095 __u32 __reserved_3 : 24,
96 dest : 8;
97#endif
98
99} __attribute__ ((packed));
100
101#ifdef CONFIG_X86_IO_APIC
102
103/*
104 * # of IO-APICs and # of IRQ routing registers
105 */
106extern int nr_ioapics;
107extern int nr_ioapic_registers[MAX_IO_APICS];
108
109/*
110 * MP-BIOS irq configuration table structures:
111 */
112
Akinobu Mitaa1a33fa2008-04-19 23:55:13 +0900113#define MP_MAX_IOAPIC_PIN 127
114
Alexey Starikovskiyec2cd0a2008-05-14 19:03:10 +0400115struct mp_config_ioapic {
116 unsigned long mp_apicaddr;
117 unsigned int mp_apicid;
118 unsigned char mp_type;
119 unsigned char mp_apicver;
120 unsigned char mp_flags;
121};
122
Alexey Starikovskiy2fddb6e282008-05-14 19:03:17 +0400123struct mp_config_intsrc {
124 unsigned int mp_dstapic;
125 unsigned char mp_type;
126 unsigned char mp_irqtype;
127 unsigned short mp_irqflag;
128 unsigned char mp_srcbus;
129 unsigned char mp_srcbusirq;
130 unsigned char mp_dstirq;
131};
132
Thomas Gleixnere1d91972008-01-30 13:30:37 +0100133/* I/O APIC entries */
Alexey Starikovskiyec2cd0a2008-05-14 19:03:10 +0400134extern struct mp_config_ioapic mp_ioapics[MAX_IO_APICS];
Thomas Gleixnere1d91972008-01-30 13:30:37 +0100135
136/* # of MP IRQ source entries */
137extern int mp_irq_entries;
138
139/* MP IRQ source entries */
Alexey Starikovskiy2fddb6e282008-05-14 19:03:17 +0400140extern struct mp_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
Thomas Gleixnere1d91972008-01-30 13:30:37 +0100141
142/* non-0 if default (table-less) MP configuration */
143extern int mpc_default_type;
144
145/* Older SiS APIC requires we rewrite the index register */
146extern int sis_apic_bug;
147
148/* 1 if "noapic" boot option passed */
149extern int skip_ioapic_setup;
150
151static inline void disable_ioapic_setup(void)
152{
153 skip_ioapic_setup = 1;
154}
155
156/*
157 * If we use the IO-APIC for IRQ routing, disable automatic
158 * assignment of PCI IRQ's.
159 */
160#define io_apic_assign_pci_irqs \
161 (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs)
162
163#ifdef CONFIG_ACPI
164extern int io_apic_get_unique_id(int ioapic, int apic_id);
165extern int io_apic_get_version(int ioapic);
166extern int io_apic_get_redir_entries(int ioapic);
167extern int io_apic_set_pci_routing(int ioapic, int pin, int irq,
168 int edge_level, int active_high_low);
Thomas Gleixnere1d91972008-01-30 13:30:37 +0100169#endif /* CONFIG_ACPI */
170
171extern int (*ioapic_renumber_irq)(int ioapic, int irq);
172extern void ioapic_init_mappings(void);
173
174#else /* !CONFIG_X86_IO_APIC */
175#define io_apic_assign_pci_irqs 0
176#endif
177
Thomas Gleixner96a388d2007-10-11 11:20:03 +0200178#endif