ACPI: PCI: always use the PCI INTx pin values, not the _PRT ones
[linux-2.6-block.git] / drivers / acpi / pci_irq.c
CommitLineData
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 27
391df5dc 28#include <linux/dmi.h>
1da177e4
LT
29#include <linux/kernel.h>
30#include <linux/module.h>
31#include <linux/init.h>
32#include <linux/types.h>
33#include <linux/proc_fs.h>
34#include <linux/spinlock.h>
35#include <linux/pm.h>
36#include <linux/pci.h>
37#include <linux/acpi.h>
38#include <acpi/acpi_bus.h>
39#include <acpi/acpi_drivers.h>
40
1da177e4 41#define _COMPONENT ACPI_PCI_COMPONENT
f52fd66d 42ACPI_MODULE_NAME("pci_irq");
1da177e4 43
f748bafa
BH
44struct acpi_prt_entry {
45 struct list_head node;
46 struct acpi_pci_id id;
47 u8 pin;
48 struct {
49 acpi_handle handle;
50 u32 index;
51 } link;
52 u32 irq;
53};
54
55struct acpi_prt_list {
56 int count;
57 struct list_head entries;
58};
59
4be44fcd 60static struct acpi_prt_list acpi_prt;
1da177e4
LT
61static DEFINE_SPINLOCK(acpi_prt_lock);
62
cf68b80b
BH
63static inline char pin_name(int pin)
64{
e64e9db5 65 return 'A' + pin - 1;
cf68b80b
BH
66}
67
1da177e4
LT
68/* --------------------------------------------------------------------------
69 PCI IRQ Routing Table (PRT) Support
70 -------------------------------------------------------------------------- */
71
4be44fcd
LB
72static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment,
73 int bus,
74 int device, int pin)
1da177e4 75{
4be44fcd 76 struct acpi_prt_entry *entry = NULL;
1da177e4 77
1da177e4 78 if (!acpi_prt.count)
d550d98d 79 return NULL;
1da177e4
LT
80
81 /*
82 * Parse through all PRT entries looking for a match on the specified
83 * PCI device's segment, bus, device, and pin (don't care about func).
84 *
85 */
86 spin_lock(&acpi_prt_lock);
1a3b77ae 87 list_for_each_entry(entry, &acpi_prt.entries, node) {
4be44fcd
LB
88 if ((segment == entry->id.segment)
89 && (bus == entry->id.bus)
90 && (device == entry->id.device)
91 && (pin == entry->pin)) {
1da177e4 92 spin_unlock(&acpi_prt_lock);
d550d98d 93 return entry;
1da177e4
LT
94 }
95 }
96
97 spin_unlock(&acpi_prt_lock);
d550d98d 98 return NULL;
1da177e4
LT
99}
100
391df5dc
BH
101/* http://bugzilla.kernel.org/show_bug.cgi?id=4773 */
102static struct dmi_system_id medion_md9580[] = {
103 {
104 .ident = "Medion MD9580-F laptop",
105 .matches = {
106 DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"),
107 DMI_MATCH(DMI_PRODUCT_NAME, "A555"),
108 },
109 },
110 { }
111};
112
113/* http://bugzilla.kernel.org/show_bug.cgi?id=5044 */
114static struct dmi_system_id dell_optiplex[] = {
115 {
116 .ident = "Dell Optiplex GX1",
117 .matches = {
118 DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
119 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex GX1 600S+"),
120 },
121 },
122 { }
123};
124
125/* http://bugzilla.kernel.org/show_bug.cgi?id=10138 */
126static struct dmi_system_id hp_t5710[] = {
127 {
128 .ident = "HP t5710",
129 .matches = {
130 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
131 DMI_MATCH(DMI_PRODUCT_NAME, "hp t5000 series"),
132 DMI_MATCH(DMI_BOARD_NAME, "098Ch"),
133 },
134 },
135 { }
136};
137
138struct prt_quirk {
139 struct dmi_system_id *system;
140 unsigned int segment;
141 unsigned int bus;
142 unsigned int device;
143 unsigned char pin;
144 char *source; /* according to BIOS */
145 char *actual_source;
146};
147
148/*
149 * These systems have incorrect _PRT entries. The BIOS claims the PCI
150 * interrupt at the listed segment/bus/device/pin is connected to the first
151 * link device, but it is actually connected to the second.
152 */
153static struct prt_quirk prt_quirks[] = {
154 { medion_md9580, 0, 0, 9, 'A',
b97d4803
BH
155 "\\_SB_.PCI0.ISA_.LNKA",
156 "\\_SB_.PCI0.ISA_.LNKB"},
391df5dc
BH
157 { dell_optiplex, 0, 0, 0xd, 'A',
158 "\\_SB_.LNKB",
159 "\\_SB_.LNKA"},
160 { hp_t5710, 0, 0, 1, 'A',
161 "\\_SB_.PCI0.LNK1",
162 "\\_SB_.PCI0.LNK3"},
163};
164
165static void
166do_prt_fixups(struct acpi_prt_entry *entry, struct acpi_pci_routing_table *prt)
167{
168 int i;
169 struct prt_quirk *quirk;
170
171 for (i = 0; i < ARRAY_SIZE(prt_quirks); i++) {
172 quirk = &prt_quirks[i];
173
174 /* All current quirks involve link devices, not GSIs */
175 if (!prt->source)
176 continue;
177
178 if (dmi_check_system(quirk->system) &&
179 entry->id.segment == quirk->segment &&
180 entry->id.bus == quirk->bus &&
181 entry->id.device == quirk->device &&
cf68b80b 182 pin_name(entry->pin) == quirk->pin &&
391df5dc
BH
183 !strcmp(prt->source, quirk->source) &&
184 strlen(prt->source) >= strlen(quirk->actual_source)) {
185 printk(KERN_WARNING PREFIX "firmware reports "
c83642d5 186 "%04x:%02x:%02x PCI INT %c connected to %s; "
391df5dc
BH
187 "changing to %s\n",
188 entry->id.segment, entry->id.bus,
cf68b80b 189 entry->id.device, pin_name(entry->pin),
391df5dc
BH
190 prt->source, quirk->actual_source);
191 strcpy(prt->source, quirk->actual_source);
192 }
193 }
194}
195
1da177e4 196static int
4be44fcd
LB
197acpi_pci_irq_add_entry(acpi_handle handle,
198 int segment, int bus, struct acpi_pci_routing_table *prt)
1da177e4 199{
4be44fcd 200 struct acpi_prt_entry *entry = NULL;
1da177e4 201
36bcbec7 202 entry = kzalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL);
1da177e4 203 if (!entry)
d550d98d 204 return -ENOMEM;
1da177e4 205
e64e9db5
BH
206 /*
207 * Note that the _PRT uses 0=INTA, 1=INTB, etc, while PCI uses
208 * 1=INTA, 2=INTB. We use the PCI encoding throughout, so convert
209 * it here.
210 */
1da177e4
LT
211 entry->id.segment = segment;
212 entry->id.bus = bus;
213 entry->id.device = (prt->address >> 16) & 0xFFFF;
e64e9db5 214 entry->pin = prt->pin + 1;
1da177e4 215
391df5dc
BH
216 do_prt_fixups(entry, prt);
217
1da177e4
LT
218 /*
219 * Type 1: Dynamic
220 * ---------------
221 * The 'source' field specifies the PCI interrupt link device used to
222 * configure the IRQ assigned to this slot|dev|pin. The 'source_index'
223 * indicates which resource descriptor in the resource template (of
224 * the link device) this interrupt is allocated from.
225 *
226 * NOTE: Don't query the Link Device for IRQ information at this time
227 * because Link Device enumeration may not have occurred yet
228 * (e.g. exists somewhere 'below' this _PRT entry in the ACPI
229 * namespace).
230 */
231 if (prt->source[0]) {
232 acpi_get_handle(handle, prt->source, &entry->link.handle);
233 entry->link.index = prt->source_index;
234 }
235 /*
236 * Type 2: Static
237 * --------------
238 * The 'source' field is NULL, and the 'source_index' field specifies
239 * the IRQ value, which is hardwired to specific interrupt inputs on
240 * the interrupt controller.
241 */
242 else
243 entry->link.index = prt->source_index;
244
245 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO,
21a53283 246 " %04x:%02x:%02x[%c] -> %s[%d]\n",
4be44fcd 247 entry->id.segment, entry->id.bus,
cf68b80b
BH
248 entry->id.device, pin_name(entry->pin),
249 prt->source, entry->link.index));
1da177e4
LT
250
251 spin_lock(&acpi_prt_lock);
252 list_add_tail(&entry->node, &acpi_prt.entries);
253 acpi_prt.count++;
254 spin_unlock(&acpi_prt_lock);
255
d550d98d 256 return 0;
1da177e4
LT
257}
258
1da177e4 259static void
4be44fcd 260acpi_pci_irq_del_entry(int segment, int bus, struct acpi_prt_entry *entry)
1da177e4 261{
4be44fcd 262 if (segment == entry->id.segment && bus == entry->id.bus) {
1da177e4
LT
263 acpi_prt.count--;
264 list_del(&entry->node);
265 kfree(entry);
266 }
267}
268
4be44fcd 269int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
1da177e4 270{
2320ac6c
BH
271 acpi_status status;
272 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
273 struct acpi_pci_routing_table *entry;
4be44fcd 274 static int first_time = 1;
1da177e4 275
1da177e4
LT
276 if (first_time) {
277 acpi_prt.count = 0;
278 INIT_LIST_HEAD(&acpi_prt.entries);
279 first_time = 0;
280 }
281
2320ac6c
BH
282 /* 'handle' is the _PRT's parent (root bridge or PCI-PCI bridge) */
283 status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
284 if (ACPI_FAILURE(status))
285 return -ENODEV;
1da177e4
LT
286
287 printk(KERN_DEBUG "ACPI: PCI Interrupt Routing Table [%s._PRT]\n",
2320ac6c 288 (char *) buffer.pointer);
1da177e4 289
2320ac6c 290 kfree(buffer.pointer);
1da177e4 291
2320ac6c 292 buffer.length = ACPI_ALLOCATE_BUFFER;
1da177e4 293 buffer.pointer = NULL;
1da177e4
LT
294
295 status = acpi_get_irq_routing_table(handle, &buffer);
296 if (ACPI_FAILURE(status)) {
a6fc6720
TR
297 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]",
298 acpi_format_exception(status)));
1da177e4 299 kfree(buffer.pointer);
d550d98d 300 return -ENODEV;
1da177e4
LT
301 }
302
2320ac6c 303 entry = buffer.pointer;
1da177e4
LT
304 while (entry && (entry->length > 0)) {
305 acpi_pci_irq_add_entry(handle, segment, bus, entry);
306 entry = (struct acpi_pci_routing_table *)
4be44fcd 307 ((unsigned long)entry + entry->length);
1da177e4
LT
308 }
309
2320ac6c 310 kfree(buffer.pointer);
d550d98d 311 return 0;
1da177e4
LT
312}
313
4be44fcd 314void acpi_pci_irq_del_prt(int segment, int bus)
1da177e4 315{
4be44fcd
LB
316 struct list_head *node = NULL, *n = NULL;
317 struct acpi_prt_entry *entry = NULL;
1da177e4 318
4be44fcd 319 if (!acpi_prt.count) {
1da177e4
LT
320 return;
321 }
322
4be44fcd 323 printk(KERN_DEBUG
21a53283
BH
324 "ACPI: Delete PCI Interrupt Routing Table for %04x:%02x\n",
325 segment, bus);
1da177e4
LT
326 spin_lock(&acpi_prt_lock);
327 list_for_each_safe(node, n, &acpi_prt.entries) {
328 entry = list_entry(node, struct acpi_prt_entry, node);
329
330 acpi_pci_irq_del_entry(segment, bus, entry);
331 }
332 spin_unlock(&acpi_prt_lock);
333}
4be44fcd 334
1da177e4
LT
335/* --------------------------------------------------------------------------
336 PCI Interrupt Routing Support
337 -------------------------------------------------------------------------- */
4be44fcd 338typedef int (*irq_lookup_func) (struct acpi_prt_entry *, int *, int *, char **);
1da177e4 339
87bec66b
DSL
340static int
341acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
50eca3eb 342 int *triggering, int *polarity, char **link)
87bec66b 343{
4be44fcd 344 int irq;
87bec66b 345
87bec66b
DSL
346
347 if (entry->link.handle) {
348 irq = acpi_pci_link_allocate_irq(entry->link.handle,
50eca3eb
BM
349 entry->link.index, triggering,
350 polarity, link);
87bec66b 351 if (irq < 0) {
cece9296
LB
352 printk(KERN_WARNING PREFIX
353 "Invalid IRQ link routing entry\n");
d550d98d 354 return -1;
87bec66b
DSL
355 }
356 } else {
357 irq = entry->link.index;
50eca3eb
BM
358 *triggering = ACPI_LEVEL_SENSITIVE;
359 *polarity = ACPI_ACTIVE_LOW;
87bec66b
DSL
360 }
361
c13f889a 362 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found GSI %d\n", irq));
d550d98d 363 return irq;
87bec66b
DSL
364}
365
366static int
367acpi_pci_free_irq(struct acpi_prt_entry *entry,
50eca3eb 368 int *triggering, int *polarity, char **link)
87bec66b 369{
4be44fcd 370 int irq;
87bec66b 371
87bec66b
DSL
372 if (entry->link.handle) {
373 irq = acpi_pci_link_free_irq(entry->link.handle);
374 } else {
375 irq = entry->link.index;
376 }
d550d98d 377 return irq;
87bec66b 378}
4be44fcd 379
1da177e4
LT
380/*
381 * acpi_pci_irq_lookup
382 * success: return IRQ >= 0
383 * failure: return -1
384 */
385static int
4be44fcd
LB
386acpi_pci_irq_lookup(struct pci_bus *bus,
387 int device,
388 int pin,
50eca3eb
BM
389 int *triggering,
390 int *polarity, char **link, irq_lookup_func func)
1da177e4 391{
4be44fcd 392 struct acpi_prt_entry *entry = NULL;
1da177e4
LT
393 int segment = pci_domain_nr(bus);
394 int bus_nr = bus->number;
87bec66b 395 int ret;
1da177e4 396
1da177e4 397
4be44fcd 398 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
21a53283 399 "Searching for _PRT entry for %04x:%02x:%02x[%c]\n",
cf68b80b 400 segment, bus_nr, device, pin_name(pin)));
1da177e4 401
4be44fcd 402 entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin);
1da177e4 403 if (!entry) {
21a53283 404 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_PRT entry not found\n"));
d550d98d 405 return -1;
1da177e4 406 }
4be44fcd 407
50eca3eb 408 ret = func(entry, triggering, polarity, link);
d550d98d 409 return ret;
1da177e4
LT
410}
411
412/*
413 * acpi_pci_irq_derive
414 * success: return IRQ >= 0
415 * failure: return < 0
416 */
417static int
4be44fcd
LB
418acpi_pci_irq_derive(struct pci_dev *dev,
419 int pin,
50eca3eb
BM
420 int *triggering,
421 int *polarity, char **link, irq_lookup_func func)
1da177e4 422{
4be44fcd
LB
423 struct pci_dev *bridge = dev;
424 int irq = -1;
c83642d5 425 u8 bridge_pin = 0, orig_pin = pin;
1da177e4 426
1da177e4 427
1da177e4
LT
428 /*
429 * Attempt to derive an IRQ for this device from a parent bridge's
430 * PCI interrupt routing entry (eg. yenta bridge and add-in card bridge).
431 */
432 while (irq < 0 && bridge->bus->self) {
e64e9db5 433 pin = (((pin - 1) + PCI_SLOT(bridge->devfn)) % 4) + 1;
1da177e4
LT
434 bridge = bridge->bus->self;
435
436 if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) {
437 /* PC card has the same IRQ as its cardbridge */
8015a014 438 bridge_pin = bridge->pin;
1da177e4 439 if (!bridge_pin) {
4be44fcd
LB
440 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
441 "No interrupt pin configured for device %s\n",
442 pci_name(bridge)));
d550d98d 443 return -1;
1da177e4 444 }
1da177e4
LT
445 pin = bridge_pin;
446 }
447
448 irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn),
50eca3eb 449 pin, triggering, polarity,
4be44fcd 450 link, func);
1da177e4
LT
451 }
452
453 if (irq < 0) {
c83642d5 454 dev_warn(&dev->dev, "can't derive routing for PCI INT %c\n",
cf68b80b 455 pin_name(orig_pin));
d550d98d 456 return -1;
1da177e4
LT
457 }
458
c13f889a 459 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive GSI %d for device %s from %s\n",
4be44fcd 460 irq, pci_name(dev), pci_name(bridge)));
1da177e4 461
d550d98d 462 return irq;
1da177e4
LT
463}
464
465/*
466 * acpi_pci_irq_enable
467 * success: return 0
468 * failure: return < 0
469 */
470
4be44fcd 471int acpi_pci_irq_enable(struct pci_dev *dev)
1da177e4 472{
c13f889a 473 int gsi = 0;
4be44fcd 474 u8 pin = 0;
50eca3eb
BM
475 int triggering = ACPI_LEVEL_SENSITIVE;
476 int polarity = ACPI_ACTIVE_LOW;
4be44fcd 477 char *link = NULL;
c83642d5 478 char link_desc[16];
4be44fcd 479 int rc;
1da177e4 480
1da177e4 481
8015a014 482 pin = dev->pin;
1da177e4 483 if (!pin) {
4be44fcd
LB
484 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
485 "No interrupt pin configured for device %s\n",
486 pci_name(dev)));
d550d98d 487 return 0;
1da177e4 488 }
1da177e4 489
1da177e4
LT
490 /*
491 * First we check the PCI IRQ routing table (PRT) for an IRQ. PRT
492 * values override any BIOS-assigned IRQs set during boot.
493 */
c13f889a 494 gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
50eca3eb 495 &triggering, &polarity, &link,
4be44fcd 496 acpi_pci_allocate_irq);
1da177e4
LT
497
498 /*
499 * If no PRT entry was found, we'll try to derive an IRQ from the
500 * device's parent bridge.
501 */
c13f889a
BH
502 if (gsi < 0)
503 gsi = acpi_pci_irq_derive(dev, pin, &triggering,
50eca3eb 504 &polarity, &link,
4be44fcd
LB
505 acpi_pci_allocate_irq);
506
c13f889a 507 if (gsi < 0) {
96c2a876
AC
508 /*
509 * IDE legacy mode controller IRQs are magic. Why do compat
510 * extensions always make such a nasty mess.
511 */
512 if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE &&
513 (dev->class & 0x05) == 0)
514 return 0;
515 }
1da177e4
LT
516 /*
517 * No IRQ known to the ACPI subsystem - maybe the BIOS /
518 * driver reported one, then use it. Exit in any case.
519 */
c13f889a 520 if (gsi < 0) {
cf68b80b 521 dev_warn(&dev->dev, "PCI INT %c: no GSI", pin_name(pin));
1da177e4 522 /* Interrupt Line values above 0xF are forbidden */
44f8e1a2 523 if (dev->irq > 0 && (dev->irq <= 0xF)) {
1da177e4 524 printk(" - using IRQ %d\n", dev->irq);
4be44fcd
LB
525 acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE,
526 ACPI_ACTIVE_LOW);
d550d98d 527 return 0;
4be44fcd 528 } else {
1da177e4 529 printk("\n");
d550d98d 530 return 0;
1da177e4 531 }
4be44fcd 532 }
1da177e4 533
c13f889a 534 rc = acpi_register_gsi(gsi, triggering, polarity);
349f0d56 535 if (rc < 0) {
c83642d5 536 dev_warn(&dev->dev, "PCI INT %c: failed to register GSI\n",
cf68b80b 537 pin_name(pin));
d550d98d 538 return rc;
349f0d56
KK
539 }
540 dev->irq = rc;
1da177e4 541
1da177e4 542 if (link)
c83642d5
BH
543 snprintf(link_desc, sizeof(link_desc), " -> Link[%s]", link);
544 else
545 link_desc[0] = '\0';
1da177e4 546
c83642d5 547 dev_info(&dev->dev, "PCI INT %c%s -> GSI %u (%s, %s) -> IRQ %d\n",
cf68b80b 548 pin_name(pin), link_desc, gsi,
c83642d5
BH
549 (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
550 (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
1da177e4 551
d550d98d 552 return 0;
1da177e4 553}
1da177e4 554
87bec66b 555/* FIXME: implement x86/x86_64 version */
4be44fcd
LB
556void __attribute__ ((weak)) acpi_unregister_gsi(u32 i)
557{
558}
87bec66b 559
4be44fcd 560void acpi_pci_irq_disable(struct pci_dev *dev)
1da177e4 561{
4be44fcd
LB
562 int gsi = 0;
563 u8 pin = 0;
50eca3eb
BM
564 int triggering = ACPI_LEVEL_SENSITIVE;
565 int polarity = ACPI_ACTIVE_LOW;
1da177e4 566
1da177e4 567
8015a014 568 pin = dev->pin;
1da177e4 569 if (!pin)
d550d98d 570 return;
1da177e4 571
1da177e4
LT
572 /*
573 * First we check the PCI IRQ routing table (PRT) for an IRQ.
574 */
4be44fcd 575 gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
50eca3eb 576 &triggering, &polarity, NULL,
4be44fcd 577 acpi_pci_free_irq);
1da177e4
LT
578 /*
579 * If no PRT entry was found, we'll try to derive an IRQ from the
580 * device's parent bridge.
581 */
582 if (gsi < 0)
4be44fcd 583 gsi = acpi_pci_irq_derive(dev, pin,
50eca3eb 584 &triggering, &polarity, NULL,
4be44fcd 585 acpi_pci_free_irq);
1da177e4 586 if (gsi < 0)
d550d98d 587 return;
1da177e4
LT
588
589 /*
590 * TBD: It might be worth clearing dev->irq by magic constant
591 * (e.g. PCI_UNDEFINED_IRQ).
592 */
593
cf68b80b 594 dev_info(&dev->dev, "PCI INT %c disabled\n", pin_name(pin));
1da177e4 595 acpi_unregister_gsi(gsi);
1da177e4 596}