Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * pci_irq.c - ACPI PCI Interrupt Routing ($Revision: 11 $) | |
3 | * | |
4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | |
5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | |
6 | * Copyright (C) 2002 Dominik Brodowski <devel@brodo.de> | |
7 | * | |
8 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License as published by | |
12 | * the Free Software Foundation; either version 2 of the License, or (at | |
13 | * your option) any later version. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, but | |
16 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | * General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License along | |
21 | * with this program; if not, write to the Free Software Foundation, Inc., | |
22 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
23 | * | |
24 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
25 | */ | |
26 | ||
1da177e4 LT |
27 | |
28 | #include <linux/kernel.h> | |
29 | #include <linux/module.h> | |
30 | #include <linux/init.h> | |
31 | #include <linux/types.h> | |
32 | #include <linux/proc_fs.h> | |
33 | #include <linux/spinlock.h> | |
34 | #include <linux/pm.h> | |
35 | #include <linux/pci.h> | |
36 | #include <linux/acpi.h> | |
37 | #include <acpi/acpi_bus.h> | |
38 | #include <acpi/acpi_drivers.h> | |
39 | ||
1da177e4 | 40 | #define _COMPONENT ACPI_PCI_COMPONENT |
f52fd66d | 41 | ACPI_MODULE_NAME("pci_irq"); |
1da177e4 | 42 | |
4be44fcd | 43 | static struct acpi_prt_list acpi_prt; |
1da177e4 LT |
44 | static DEFINE_SPINLOCK(acpi_prt_lock); |
45 | ||
46 | /* -------------------------------------------------------------------------- | |
47 | PCI IRQ Routing Table (PRT) Support | |
48 | -------------------------------------------------------------------------- */ | |
49 | ||
4be44fcd LB |
50 | static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, |
51 | int bus, | |
52 | int device, int pin) | |
1da177e4 | 53 | { |
4be44fcd LB |
54 | struct list_head *node = NULL; |
55 | struct acpi_prt_entry *entry = NULL; | |
1da177e4 | 56 | |
1da177e4 LT |
57 | |
58 | if (!acpi_prt.count) | |
d550d98d | 59 | return NULL; |
1da177e4 LT |
60 | |
61 | /* | |
62 | * Parse through all PRT entries looking for a match on the specified | |
63 | * PCI device's segment, bus, device, and pin (don't care about func). | |
64 | * | |
65 | */ | |
66 | spin_lock(&acpi_prt_lock); | |
67 | list_for_each(node, &acpi_prt.entries) { | |
68 | entry = list_entry(node, struct acpi_prt_entry, node); | |
4be44fcd LB |
69 | if ((segment == entry->id.segment) |
70 | && (bus == entry->id.bus) | |
71 | && (device == entry->id.device) | |
72 | && (pin == entry->pin)) { | |
1da177e4 | 73 | spin_unlock(&acpi_prt_lock); |
d550d98d | 74 | return entry; |
1da177e4 LT |
75 | } |
76 | } | |
77 | ||
78 | spin_unlock(&acpi_prt_lock); | |
d550d98d | 79 | return NULL; |
1da177e4 LT |
80 | } |
81 | ||
1da177e4 | 82 | static int |
4be44fcd LB |
83 | acpi_pci_irq_add_entry(acpi_handle handle, |
84 | int segment, int bus, struct acpi_pci_routing_table *prt) | |
1da177e4 | 85 | { |
4be44fcd | 86 | struct acpi_prt_entry *entry = NULL; |
1da177e4 | 87 | |
1da177e4 LT |
88 | |
89 | if (!prt) | |
d550d98d | 90 | return -EINVAL; |
1da177e4 | 91 | |
36bcbec7 | 92 | entry = kzalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL); |
1da177e4 | 93 | if (!entry) |
d550d98d | 94 | return -ENOMEM; |
1da177e4 LT |
95 | |
96 | entry->id.segment = segment; | |
97 | entry->id.bus = bus; | |
98 | entry->id.device = (prt->address >> 16) & 0xFFFF; | |
99 | entry->id.function = prt->address & 0xFFFF; | |
100 | entry->pin = prt->pin; | |
101 | ||
102 | /* | |
103 | * Type 1: Dynamic | |
104 | * --------------- | |
105 | * The 'source' field specifies the PCI interrupt link device used to | |
106 | * configure the IRQ assigned to this slot|dev|pin. The 'source_index' | |
107 | * indicates which resource descriptor in the resource template (of | |
108 | * the link device) this interrupt is allocated from. | |
109 | * | |
110 | * NOTE: Don't query the Link Device for IRQ information at this time | |
111 | * because Link Device enumeration may not have occurred yet | |
112 | * (e.g. exists somewhere 'below' this _PRT entry in the ACPI | |
113 | * namespace). | |
114 | */ | |
115 | if (prt->source[0]) { | |
116 | acpi_get_handle(handle, prt->source, &entry->link.handle); | |
117 | entry->link.index = prt->source_index; | |
118 | } | |
119 | /* | |
120 | * Type 2: Static | |
121 | * -------------- | |
122 | * The 'source' field is NULL, and the 'source_index' field specifies | |
123 | * the IRQ value, which is hardwired to specific interrupt inputs on | |
124 | * the interrupt controller. | |
125 | */ | |
126 | else | |
127 | entry->link.index = prt->source_index; | |
128 | ||
129 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, | |
4be44fcd LB |
130 | " %02X:%02X:%02X[%c] -> %s[%d]\n", |
131 | entry->id.segment, entry->id.bus, | |
132 | entry->id.device, ('A' + entry->pin), prt->source, | |
133 | entry->link.index)); | |
1da177e4 LT |
134 | |
135 | spin_lock(&acpi_prt_lock); | |
136 | list_add_tail(&entry->node, &acpi_prt.entries); | |
137 | acpi_prt.count++; | |
138 | spin_unlock(&acpi_prt_lock); | |
139 | ||
d550d98d | 140 | return 0; |
1da177e4 LT |
141 | } |
142 | ||
1da177e4 | 143 | static void |
4be44fcd | 144 | acpi_pci_irq_del_entry(int segment, int bus, struct acpi_prt_entry *entry) |
1da177e4 | 145 | { |
4be44fcd | 146 | if (segment == entry->id.segment && bus == entry->id.bus) { |
1da177e4 LT |
147 | acpi_prt.count--; |
148 | list_del(&entry->node); | |
149 | kfree(entry); | |
150 | } | |
151 | } | |
152 | ||
4be44fcd | 153 | int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) |
1da177e4 | 154 | { |
4be44fcd LB |
155 | acpi_status status = AE_OK; |
156 | char *pathname = NULL; | |
157 | struct acpi_buffer buffer = { 0, NULL }; | |
158 | struct acpi_pci_routing_table *prt = NULL; | |
159 | struct acpi_pci_routing_table *entry = NULL; | |
160 | static int first_time = 1; | |
1da177e4 | 161 | |
1da177e4 | 162 | |
36bcbec7 | 163 | pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); |
4be44fcd | 164 | if (!pathname) |
d550d98d | 165 | return -ENOMEM; |
1da177e4 LT |
166 | |
167 | if (first_time) { | |
168 | acpi_prt.count = 0; | |
169 | INIT_LIST_HEAD(&acpi_prt.entries); | |
170 | first_time = 0; | |
171 | } | |
172 | ||
173 | /* | |
174 | * NOTE: We're given a 'handle' to the _PRT object's parent device | |
175 | * (either a PCI root bridge or PCI-PCI bridge). | |
176 | */ | |
177 | ||
178 | buffer.length = ACPI_PATHNAME_MAX; | |
179 | buffer.pointer = pathname; | |
180 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | |
181 | ||
182 | printk(KERN_DEBUG "ACPI: PCI Interrupt Routing Table [%s._PRT]\n", | |
4be44fcd | 183 | pathname); |
1da177e4 LT |
184 | |
185 | /* | |
186 | * Evaluate this _PRT and add its entries to our global list (acpi_prt). | |
187 | */ | |
188 | ||
189 | buffer.length = 0; | |
190 | buffer.pointer = NULL; | |
191 | kfree(pathname); | |
192 | status = acpi_get_irq_routing_table(handle, &buffer); | |
193 | if (status != AE_BUFFER_OVERFLOW) { | |
a6fc6720 TR |
194 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", |
195 | acpi_format_exception(status))); | |
d550d98d | 196 | return -ENODEV; |
1da177e4 LT |
197 | } |
198 | ||
36bcbec7 | 199 | prt = kzalloc(buffer.length, GFP_KERNEL); |
4be44fcd | 200 | if (!prt) { |
d550d98d | 201 | return -ENOMEM; |
1da177e4 | 202 | } |
1da177e4 LT |
203 | buffer.pointer = prt; |
204 | ||
205 | status = acpi_get_irq_routing_table(handle, &buffer); | |
206 | if (ACPI_FAILURE(status)) { | |
a6fc6720 TR |
207 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", |
208 | acpi_format_exception(status))); | |
1da177e4 | 209 | kfree(buffer.pointer); |
d550d98d | 210 | return -ENODEV; |
1da177e4 LT |
211 | } |
212 | ||
213 | entry = prt; | |
214 | ||
215 | while (entry && (entry->length > 0)) { | |
216 | acpi_pci_irq_add_entry(handle, segment, bus, entry); | |
217 | entry = (struct acpi_pci_routing_table *) | |
4be44fcd | 218 | ((unsigned long)entry + entry->length); |
1da177e4 LT |
219 | } |
220 | ||
221 | kfree(prt); | |
222 | ||
d550d98d | 223 | return 0; |
1da177e4 LT |
224 | } |
225 | ||
4be44fcd | 226 | void acpi_pci_irq_del_prt(int segment, int bus) |
1da177e4 | 227 | { |
4be44fcd LB |
228 | struct list_head *node = NULL, *n = NULL; |
229 | struct acpi_prt_entry *entry = NULL; | |
1da177e4 | 230 | |
4be44fcd | 231 | if (!acpi_prt.count) { |
1da177e4 LT |
232 | return; |
233 | } | |
234 | ||
4be44fcd LB |
235 | printk(KERN_DEBUG |
236 | "ACPI: Delete PCI Interrupt Routing Table for %x:%x\n", segment, | |
237 | bus); | |
1da177e4 LT |
238 | spin_lock(&acpi_prt_lock); |
239 | list_for_each_safe(node, n, &acpi_prt.entries) { | |
240 | entry = list_entry(node, struct acpi_prt_entry, node); | |
241 | ||
242 | acpi_pci_irq_del_entry(segment, bus, entry); | |
243 | } | |
244 | spin_unlock(&acpi_prt_lock); | |
245 | } | |
4be44fcd | 246 | |
1da177e4 LT |
247 | /* -------------------------------------------------------------------------- |
248 | PCI Interrupt Routing Support | |
249 | -------------------------------------------------------------------------- */ | |
4be44fcd | 250 | typedef int (*irq_lookup_func) (struct acpi_prt_entry *, int *, int *, char **); |
1da177e4 | 251 | |
87bec66b DSL |
252 | static int |
253 | acpi_pci_allocate_irq(struct acpi_prt_entry *entry, | |
50eca3eb | 254 | int *triggering, int *polarity, char **link) |
87bec66b | 255 | { |
4be44fcd | 256 | int irq; |
87bec66b | 257 | |
87bec66b DSL |
258 | |
259 | if (entry->link.handle) { | |
260 | irq = acpi_pci_link_allocate_irq(entry->link.handle, | |
50eca3eb BM |
261 | entry->link.index, triggering, |
262 | polarity, link); | |
87bec66b | 263 | if (irq < 0) { |
cece9296 LB |
264 | printk(KERN_WARNING PREFIX |
265 | "Invalid IRQ link routing entry\n"); | |
d550d98d | 266 | return -1; |
87bec66b DSL |
267 | } |
268 | } else { | |
269 | irq = entry->link.index; | |
50eca3eb BM |
270 | *triggering = ACPI_LEVEL_SENSITIVE; |
271 | *polarity = ACPI_ACTIVE_LOW; | |
87bec66b DSL |
272 | } |
273 | ||
274 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); | |
d550d98d | 275 | return irq; |
87bec66b DSL |
276 | } |
277 | ||
278 | static int | |
279 | acpi_pci_free_irq(struct acpi_prt_entry *entry, | |
50eca3eb | 280 | int *triggering, int *polarity, char **link) |
87bec66b | 281 | { |
4be44fcd | 282 | int irq; |
87bec66b | 283 | |
87bec66b DSL |
284 | if (entry->link.handle) { |
285 | irq = acpi_pci_link_free_irq(entry->link.handle); | |
286 | } else { | |
287 | irq = entry->link.index; | |
288 | } | |
d550d98d | 289 | return irq; |
87bec66b | 290 | } |
4be44fcd | 291 | |
1da177e4 LT |
292 | /* |
293 | * acpi_pci_irq_lookup | |
294 | * success: return IRQ >= 0 | |
295 | * failure: return -1 | |
296 | */ | |
297 | static int | |
4be44fcd LB |
298 | acpi_pci_irq_lookup(struct pci_bus *bus, |
299 | int device, | |
300 | int pin, | |
50eca3eb BM |
301 | int *triggering, |
302 | int *polarity, char **link, irq_lookup_func func) | |
1da177e4 | 303 | { |
4be44fcd | 304 | struct acpi_prt_entry *entry = NULL; |
1da177e4 LT |
305 | int segment = pci_domain_nr(bus); |
306 | int bus_nr = bus->number; | |
87bec66b | 307 | int ret; |
1da177e4 | 308 | |
1da177e4 | 309 | |
4be44fcd LB |
310 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
311 | "Searching for PRT entry for %02x:%02x:%02x[%c]\n", | |
312 | segment, bus_nr, device, ('A' + pin))); | |
1da177e4 | 313 | |
4be44fcd | 314 | entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); |
1da177e4 LT |
315 | if (!entry) { |
316 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n")); | |
d550d98d | 317 | return -1; |
1da177e4 | 318 | } |
4be44fcd | 319 | |
50eca3eb | 320 | ret = func(entry, triggering, polarity, link); |
d550d98d | 321 | return ret; |
1da177e4 LT |
322 | } |
323 | ||
324 | /* | |
325 | * acpi_pci_irq_derive | |
326 | * success: return IRQ >= 0 | |
327 | * failure: return < 0 | |
328 | */ | |
329 | static int | |
4be44fcd LB |
330 | acpi_pci_irq_derive(struct pci_dev *dev, |
331 | int pin, | |
50eca3eb BM |
332 | int *triggering, |
333 | int *polarity, char **link, irq_lookup_func func) | |
1da177e4 | 334 | { |
4be44fcd LB |
335 | struct pci_dev *bridge = dev; |
336 | int irq = -1; | |
337 | u8 bridge_pin = 0; | |
1da177e4 | 338 | |
1da177e4 LT |
339 | |
340 | if (!dev) | |
d550d98d | 341 | return -EINVAL; |
1da177e4 LT |
342 | |
343 | /* | |
344 | * Attempt to derive an IRQ for this device from a parent bridge's | |
345 | * PCI interrupt routing entry (eg. yenta bridge and add-in card bridge). | |
346 | */ | |
347 | while (irq < 0 && bridge->bus->self) { | |
348 | pin = (pin + PCI_SLOT(bridge->devfn)) % 4; | |
349 | bridge = bridge->bus->self; | |
350 | ||
351 | if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) { | |
352 | /* PC card has the same IRQ as its cardbridge */ | |
8015a014 | 353 | bridge_pin = bridge->pin; |
1da177e4 | 354 | if (!bridge_pin) { |
4be44fcd LB |
355 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
356 | "No interrupt pin configured for device %s\n", | |
357 | pci_name(bridge))); | |
d550d98d | 358 | return -1; |
1da177e4 LT |
359 | } |
360 | /* Pin is from 0 to 3 */ | |
4be44fcd | 361 | bridge_pin--; |
1da177e4 LT |
362 | pin = bridge_pin; |
363 | } | |
364 | ||
365 | irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), | |
50eca3eb | 366 | pin, triggering, polarity, |
4be44fcd | 367 | link, func); |
1da177e4 LT |
368 | } |
369 | ||
370 | if (irq < 0) { | |
cece9296 LB |
371 | printk(KERN_WARNING PREFIX "Unable to derive IRQ for device %s\n", |
372 | pci_name(dev)); | |
d550d98d | 373 | return -1; |
1da177e4 LT |
374 | } |
375 | ||
376 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n", | |
4be44fcd | 377 | irq, pci_name(dev), pci_name(bridge))); |
1da177e4 | 378 | |
d550d98d | 379 | return irq; |
1da177e4 LT |
380 | } |
381 | ||
382 | /* | |
383 | * acpi_pci_irq_enable | |
384 | * success: return 0 | |
385 | * failure: return < 0 | |
386 | */ | |
387 | ||
4be44fcd | 388 | int acpi_pci_irq_enable(struct pci_dev *dev) |
1da177e4 | 389 | { |
4be44fcd LB |
390 | int irq = 0; |
391 | u8 pin = 0; | |
50eca3eb BM |
392 | int triggering = ACPI_LEVEL_SENSITIVE; |
393 | int polarity = ACPI_ACTIVE_LOW; | |
4be44fcd LB |
394 | char *link = NULL; |
395 | int rc; | |
1da177e4 | 396 | |
1da177e4 LT |
397 | |
398 | if (!dev) | |
d550d98d | 399 | return -EINVAL; |
4be44fcd | 400 | |
8015a014 | 401 | pin = dev->pin; |
1da177e4 | 402 | if (!pin) { |
4be44fcd LB |
403 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
404 | "No interrupt pin configured for device %s\n", | |
405 | pci_name(dev))); | |
d550d98d | 406 | return 0; |
1da177e4 LT |
407 | } |
408 | pin--; | |
409 | ||
410 | if (!dev->bus) { | |
6468463a | 411 | printk(KERN_ERR PREFIX "Invalid (NULL) 'bus' field\n"); |
d550d98d | 412 | return -ENODEV; |
1da177e4 LT |
413 | } |
414 | ||
415 | /* | |
416 | * First we check the PCI IRQ routing table (PRT) for an IRQ. PRT | |
417 | * values override any BIOS-assigned IRQs set during boot. | |
418 | */ | |
4be44fcd | 419 | irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, |
50eca3eb | 420 | &triggering, &polarity, &link, |
4be44fcd | 421 | acpi_pci_allocate_irq); |
1da177e4 LT |
422 | |
423 | /* | |
424 | * If no PRT entry was found, we'll try to derive an IRQ from the | |
425 | * device's parent bridge. | |
426 | */ | |
427 | if (irq < 0) | |
50eca3eb BM |
428 | irq = acpi_pci_irq_derive(dev, pin, &triggering, |
429 | &polarity, &link, | |
4be44fcd LB |
430 | acpi_pci_allocate_irq); |
431 | ||
1da177e4 LT |
432 | /* |
433 | * No IRQ known to the ACPI subsystem - maybe the BIOS / | |
434 | * driver reported one, then use it. Exit in any case. | |
435 | */ | |
436 | if (irq < 0) { | |
437 | printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI", | |
4be44fcd | 438 | pci_name(dev), ('A' + pin)); |
1da177e4 | 439 | /* Interrupt Line values above 0xF are forbidden */ |
44f8e1a2 | 440 | if (dev->irq > 0 && (dev->irq <= 0xF)) { |
1da177e4 | 441 | printk(" - using IRQ %d\n", dev->irq); |
4be44fcd LB |
442 | acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, |
443 | ACPI_ACTIVE_LOW); | |
d550d98d | 444 | return 0; |
4be44fcd | 445 | } else { |
1da177e4 | 446 | printk("\n"); |
d550d98d | 447 | return 0; |
1da177e4 | 448 | } |
4be44fcd | 449 | } |
1da177e4 | 450 | |
50eca3eb | 451 | rc = acpi_register_gsi(irq, triggering, polarity); |
349f0d56 KK |
452 | if (rc < 0) { |
453 | printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed " | |
454 | "to register GSI\n", pci_name(dev), ('A' + pin)); | |
d550d98d | 455 | return rc; |
349f0d56 KK |
456 | } |
457 | dev->irq = rc; | |
1da177e4 LT |
458 | |
459 | printk(KERN_INFO PREFIX "PCI Interrupt %s[%c] -> ", | |
4be44fcd | 460 | pci_name(dev), 'A' + pin); |
1da177e4 LT |
461 | |
462 | if (link) | |
463 | printk("Link [%s] -> ", link); | |
464 | ||
465 | printk("GSI %u (%s, %s) -> IRQ %d\n", irq, | |
50eca3eb BM |
466 | (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", |
467 | (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); | |
1da177e4 | 468 | |
d550d98d | 469 | return 0; |
1da177e4 | 470 | } |
1da177e4 | 471 | |
4be44fcd | 472 | EXPORT_SYMBOL(acpi_pci_irq_enable); |
1da177e4 | 473 | |
87bec66b | 474 | /* FIXME: implement x86/x86_64 version */ |
4be44fcd LB |
475 | void __attribute__ ((weak)) acpi_unregister_gsi(u32 i) |
476 | { | |
477 | } | |
87bec66b | 478 | |
4be44fcd | 479 | void acpi_pci_irq_disable(struct pci_dev *dev) |
1da177e4 | 480 | { |
4be44fcd LB |
481 | int gsi = 0; |
482 | u8 pin = 0; | |
50eca3eb BM |
483 | int triggering = ACPI_LEVEL_SENSITIVE; |
484 | int polarity = ACPI_ACTIVE_LOW; | |
1da177e4 | 485 | |
1da177e4 | 486 | |
5f0110f2 | 487 | if (!dev || !dev->bus) |
d550d98d | 488 | return; |
1da177e4 | 489 | |
8015a014 | 490 | pin = dev->pin; |
1da177e4 | 491 | if (!pin) |
d550d98d | 492 | return; |
1da177e4 LT |
493 | pin--; |
494 | ||
1da177e4 LT |
495 | /* |
496 | * First we check the PCI IRQ routing table (PRT) for an IRQ. | |
497 | */ | |
4be44fcd | 498 | gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, |
50eca3eb | 499 | &triggering, &polarity, NULL, |
4be44fcd | 500 | acpi_pci_free_irq); |
1da177e4 LT |
501 | /* |
502 | * If no PRT entry was found, we'll try to derive an IRQ from the | |
503 | * device's parent bridge. | |
504 | */ | |
505 | if (gsi < 0) | |
4be44fcd | 506 | gsi = acpi_pci_irq_derive(dev, pin, |
50eca3eb | 507 | &triggering, &polarity, NULL, |
4be44fcd | 508 | acpi_pci_free_irq); |
1da177e4 | 509 | if (gsi < 0) |
d550d98d | 510 | return; |
1da177e4 LT |
511 | |
512 | /* | |
513 | * TBD: It might be worth clearing dev->irq by magic constant | |
514 | * (e.g. PCI_UNDEFINED_IRQ). | |
515 | */ | |
516 | ||
517 | printk(KERN_INFO PREFIX "PCI interrupt for device %s disabled\n", | |
518 | pci_name(dev)); | |
519 | ||
520 | acpi_unregister_gsi(gsi); | |
521 | ||
d550d98d | 522 | return; |
1da177e4 | 523 | } |