aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-12-08 23:31:16 -0500
committerLen Brown <len.brown@intel.com>2008-12-30 21:40:35 -0500
commit5697b7ca406b4ee0afeef6d9a29b823767716cab (patch)
tree771e4bb3bdd351b2c6eb8e2518de2de9992107e2 /drivers/acpi
parentee40136313323db1096b17df7b436d22a24ef2be (diff)
ACPI: PCI: combine lookup and derive
This folds acpi_pci_irq_derive() into acpi_pci_irq_lookup() so it can be easily used by both acpi_pci_irq_enable() and acpi_pci_irq_disable(). Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/pci_irq.c55
1 files changed, 11 insertions, 44 deletions
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index b35e64d71409..b03bb84266b2 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -382,6 +382,8 @@ static struct acpi_prt_entry *
382acpi_pci_irq_lookup(struct pci_dev *dev, int pin) 382acpi_pci_irq_lookup(struct pci_dev *dev, int pin)
383{ 383{
384 struct acpi_prt_entry *entry; 384 struct acpi_prt_entry *entry;
385 struct pci_dev *bridge;
386 u8 bridge_pin, orig_pin = pin;
385 387
386 entry = acpi_pci_irq_find_prt_entry(dev, pin); 388 entry = acpi_pci_irq_find_prt_entry(dev, pin);
387 if (entry) { 389 if (entry) {
@@ -390,19 +392,6 @@ acpi_pci_irq_lookup(struct pci_dev *dev, int pin)
390 return entry; 392 return entry;
391 } 393 }
392 394
393 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No %s[%c] _PRT entry\n",
394 pci_name(dev), pin_name(pin)));
395 return NULL;
396}
397
398static struct acpi_prt_entry *
399acpi_pci_irq_derive(struct pci_dev *dev, int pin)
400{
401 struct acpi_prt_entry *entry = NULL;
402 struct pci_dev *bridge;
403 u8 bridge_pin = 0, orig_pin = pin;
404
405
406 /* 395 /*
407 * Attempt to derive an IRQ for this device from a parent bridge's 396 * Attempt to derive an IRQ for this device from a parent bridge's
408 * PCI interrupt routing entry (eg. yenta bridge and add-in card bridge). 397 * PCI interrupt routing entry (eg. yenta bridge and add-in card bridge).
@@ -423,7 +412,7 @@ acpi_pci_irq_derive(struct pci_dev *dev, int pin)
423 pin = bridge_pin; 412 pin = bridge_pin;
424 } 413 }
425 414
426 entry = acpi_pci_irq_lookup(bridge, pin); 415 entry = acpi_pci_irq_find_prt_entry(bridge, pin);
427 if (entry) { 416 if (entry) {
428 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 417 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
429 "Derived GSI for %s INT %c from %s\n", 418 "Derived GSI for %s INT %c from %s\n",
@@ -467,26 +456,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
467 return 0; 456 return 0;
468 } 457 }
469 458
470 /*
471 * First we check the PCI IRQ routing table (PRT) for an IRQ. PRT
472 * values override any BIOS-assigned IRQs set during boot.
473 */
474 entry = acpi_pci_irq_lookup(dev, pin); 459 entry = acpi_pci_irq_lookup(dev, pin);
475 460 if (!entry) {
476 /*
477 * If no PRT entry was found, we'll try to derive an IRQ from the
478 * device's parent bridge.
479 */
480 if (!entry)
481 entry = acpi_pci_irq_derive(dev, pin);
482
483 if (entry)
484 gsi = acpi_pci_allocate_irq(entry, &triggering, &polarity,
485 &link);
486 else
487 gsi = -1;
488
489 if (gsi < 0) {
490 /* 461 /*
491 * IDE legacy mode controller IRQs are magic. Why do compat 462 * IDE legacy mode controller IRQs are magic. Why do compat
492 * extensions always make such a nasty mess. 463 * extensions always make such a nasty mess.
@@ -495,6 +466,13 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
495 (dev->class & 0x05) == 0) 466 (dev->class & 0x05) == 0)
496 return 0; 467 return 0;
497 } 468 }
469
470 if (entry)
471 gsi = acpi_pci_allocate_irq(entry, &triggering, &polarity,
472 &link);
473 else
474 gsi = -1;
475
498 /* 476 /*
499 * No IRQ known to the ACPI subsystem - maybe the BIOS / 477 * No IRQ known to the ACPI subsystem - maybe the BIOS /
500 * driver reported one, then use it. Exit in any case. 478 * driver reported one, then use it. Exit in any case.
@@ -550,18 +528,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
550 if (!pin) 528 if (!pin)
551 return; 529 return;
552 530
553 /*
554 * First we check the PCI IRQ routing table (PRT) for an IRQ.
555 */
556 entry = acpi_pci_irq_lookup(dev, pin); 531 entry = acpi_pci_irq_lookup(dev, pin);
557
558 /*
559 * If no PRT entry was found, we'll try to derive an IRQ from the
560 * device's parent bridge.
561 */
562 if (!entry)
563 entry = acpi_pci_irq_derive(dev, pin);
564
565 if (!entry) 532 if (!entry)
566 return; 533 return;
567 534