]> pilppa.org Git - linux-2.6-omap-h63xx.git/blob - include/asm-x86_64/io_apic.h
[PATCH] genirq: x86_64 irq: Remove the msi assumption that irq == vector
[linux-2.6-omap-h63xx.git] / include / asm-x86_64 / io_apic.h
1 #ifndef __ASM_IO_APIC_H
2 #define __ASM_IO_APIC_H
3
4 #include <asm/types.h>
5 #include <asm/mpspec.h>
6
7 /*
8  * Intel IO-APIC support for SMP and UP systems.
9  *
10  * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar
11  */
12
13 static inline int use_pci_vector(void)  {return 0;}
14
15 #define APIC_MISMATCH_DEBUG
16
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)))
20
21 /*
22  * The structure of the IO-APIC:
23  */
24 union IO_APIC_reg_00 {
25         u32     raw;
26         struct {
27                 u32     __reserved_2    : 14,
28                         LTS             :  1,
29                         delivery_type   :  1,
30                         __reserved_1    :  8,
31                         ID              :  8;
32         } __attribute__ ((packed)) bits;
33 };
34
35 union IO_APIC_reg_01 {
36         u32     raw;
37         struct {
38                 u32     version         :  8,
39                 __reserved_2    :  7,
40                 PRQ             :  1,
41                 entries         :  8,
42                 __reserved_1    :  8;
43         } __attribute__ ((packed)) bits;
44 };
45
46 union IO_APIC_reg_02 {
47         u32     raw;
48         struct {
49                 u32     __reserved_2    : 24,
50                 arbitration     :  4,
51                 __reserved_1    :  4;
52         } __attribute__ ((packed)) bits;
53 };
54
55 union IO_APIC_reg_03 {
56         u32     raw;
57         struct {
58                 u32     boot_DT         :  1,
59                         __reserved_1    : 31;
60         } __attribute__ ((packed)) bits;
61 };
62
63 /*
64  * # of IO-APICs and # of IRQ routing registers
65  */
66 extern int nr_ioapics;
67 extern int nr_ioapic_registers[MAX_IO_APICS];
68
69 enum ioapic_irq_destination_types {
70         dest_Fixed = 0,
71         dest_LowestPrio = 1,
72         dest_SMI = 2,
73         dest__reserved_1 = 3,
74         dest_NMI = 4,
75         dest_INIT = 5,
76         dest__reserved_2 = 6,
77         dest_ExtINT = 7
78 };
79
80 struct IO_APIC_route_entry {
81         __u32   vector          :  8,
82                 delivery_mode   :  3,   /* 000: FIXED
83                                          * 001: lowest prio
84                                          * 111: ExtINT
85                                          */
86                 dest_mode       :  1,   /* 0: physical, 1: logical */
87                 delivery_status :  1,
88                 polarity        :  1,
89                 irr             :  1,
90                 trigger         :  1,   /* 0: edge, 1: level */
91                 mask            :  1,   /* 0: enabled, 1: disabled */
92                 __reserved_2    : 15;
93
94         union {         struct { __u32
95                                         __reserved_1    : 24,
96                                         physical_dest   :  4,
97                                         __reserved_2    :  4;
98                         } physical;
99
100                         struct { __u32
101                                         __reserved_1    : 24,
102                                         logical_dest    :  8;
103                         } logical;
104         } dest;
105
106 } __attribute__ ((packed));
107
108 /*
109  * MP-BIOS irq configuration table structures:
110  */
111
112 /* I/O APIC entries */
113 extern struct mpc_config_ioapic mp_ioapics[MAX_IO_APICS];
114
115 /* # of MP IRQ source entries */
116 extern int mp_irq_entries;
117
118 /* MP IRQ source entries */
119 extern struct mpc_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
120
121 /* non-0 if default (table-less) MP configuration */
122 extern int mpc_default_type;
123
124 static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg)
125 {
126         *IO_APIC_BASE(apic) = reg;
127         return *(IO_APIC_BASE(apic)+4);
128 }
129
130 static inline void io_apic_write(unsigned int apic, unsigned int reg, unsigned int value)
131 {
132         *IO_APIC_BASE(apic) = reg;
133         *(IO_APIC_BASE(apic)+4) = value;
134 }
135
136 /*
137  * Re-write a value: to be used for read-modify-write
138  * cycles where the read already set up the index register.
139  */
140 static inline void io_apic_modify(unsigned int apic, unsigned int value)
141 {
142         *(IO_APIC_BASE(apic)+4) = value;
143 }
144
145 /*
146  * Synchronize the IO-APIC and the CPU by doing
147  * a dummy read from the IO-APIC
148  */
149 static inline void io_apic_sync(unsigned int apic)
150 {
151         (void) *(IO_APIC_BASE(apic)+4);
152 }
153
154 /* 1 if "noapic" boot option passed */
155 extern int skip_ioapic_setup;
156
157 /*
158  * If we use the IO-APIC for IRQ routing, disable automatic
159  * assignment of PCI IRQ's.
160  */
161 #define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs)
162
163 #ifdef CONFIG_ACPI
164 extern int io_apic_get_version (int ioapic);
165 extern int io_apic_get_redir_entries (int ioapic);
166 extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int, int);
167 extern int timer_uses_ioapic_pin_0;
168 #endif
169
170 extern int sis_apic_bug; /* dummy */ 
171
172 void enable_NMI_through_LVT0 (void * dummy);
173
174 extern spinlock_t i8259A_lock;
175
176 #endif