diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-12-08 23:30:36 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-12-30 21:22:07 -0500 |
commit | cf68b80b0e0cbc6a0d7bbb36b07ce94779ef5f1f (patch) | |
tree | ba8e2e507a701a2785481006b3f40e49be8f1ace /drivers/acpi | |
parent | f748bafa3ca1fb056e63afdeecacc1c68d8104df (diff) |
ACPI: PCI: add a helper to convert _PRT INTx pin number to name
This adds a helper function to convert INTx pin numbers from the _PRT
(0, 1, 2, 3) to the pin name ('A', 'B', 'C', 'D').
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.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index ea003bab7ecd..5ce1fcf77455 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -60,6 +60,11 @@ struct acpi_prt_list { | |||
60 | static struct acpi_prt_list acpi_prt; | 60 | static struct acpi_prt_list acpi_prt; |
61 | static DEFINE_SPINLOCK(acpi_prt_lock); | 61 | static DEFINE_SPINLOCK(acpi_prt_lock); |
62 | 62 | ||
63 | static inline char pin_name(int pin) | ||
64 | { | ||
65 | return 'A' + pin; | ||
66 | } | ||
67 | |||
63 | /* -------------------------------------------------------------------------- | 68 | /* -------------------------------------------------------------------------- |
64 | PCI IRQ Routing Table (PRT) Support | 69 | PCI IRQ Routing Table (PRT) Support |
65 | -------------------------------------------------------------------------- */ | 70 | -------------------------------------------------------------------------- */ |
@@ -174,14 +179,14 @@ do_prt_fixups(struct acpi_prt_entry *entry, struct acpi_pci_routing_table *prt) | |||
174 | entry->id.segment == quirk->segment && | 179 | entry->id.segment == quirk->segment && |
175 | entry->id.bus == quirk->bus && | 180 | entry->id.bus == quirk->bus && |
176 | entry->id.device == quirk->device && | 181 | entry->id.device == quirk->device && |
177 | entry->pin + 'A' == quirk->pin && | 182 | pin_name(entry->pin) == quirk->pin && |
178 | !strcmp(prt->source, quirk->source) && | 183 | !strcmp(prt->source, quirk->source) && |
179 | strlen(prt->source) >= strlen(quirk->actual_source)) { | 184 | strlen(prt->source) >= strlen(quirk->actual_source)) { |
180 | printk(KERN_WARNING PREFIX "firmware reports " | 185 | printk(KERN_WARNING PREFIX "firmware reports " |
181 | "%04x:%02x:%02x PCI INT %c connected to %s; " | 186 | "%04x:%02x:%02x PCI INT %c connected to %s; " |
182 | "changing to %s\n", | 187 | "changing to %s\n", |
183 | entry->id.segment, entry->id.bus, | 188 | entry->id.segment, entry->id.bus, |
184 | entry->id.device, 'A' + entry->pin, | 189 | entry->id.device, pin_name(entry->pin), |
185 | prt->source, quirk->actual_source); | 190 | prt->source, quirk->actual_source); |
186 | strcpy(prt->source, quirk->actual_source); | 191 | strcpy(prt->source, quirk->actual_source); |
187 | } | 192 | } |
@@ -235,8 +240,8 @@ acpi_pci_irq_add_entry(acpi_handle handle, | |||
235 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, | 240 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, |
236 | " %04x:%02x:%02x[%c] -> %s[%d]\n", | 241 | " %04x:%02x:%02x[%c] -> %s[%d]\n", |
237 | entry->id.segment, entry->id.bus, | 242 | entry->id.segment, entry->id.bus, |
238 | entry->id.device, ('A' + entry->pin), prt->source, | 243 | entry->id.device, pin_name(entry->pin), |
239 | entry->link.index)); | 244 | prt->source, entry->link.index)); |
240 | 245 | ||
241 | spin_lock(&acpi_prt_lock); | 246 | spin_lock(&acpi_prt_lock); |
242 | list_add_tail(&entry->node, &acpi_prt.entries); | 247 | list_add_tail(&entry->node, &acpi_prt.entries); |
@@ -387,7 +392,7 @@ acpi_pci_irq_lookup(struct pci_bus *bus, | |||
387 | 392 | ||
388 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 393 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
389 | "Searching for _PRT entry for %04x:%02x:%02x[%c]\n", | 394 | "Searching for _PRT entry for %04x:%02x:%02x[%c]\n", |
390 | segment, bus_nr, device, ('A' + pin))); | 395 | segment, bus_nr, device, pin_name(pin))); |
391 | 396 | ||
392 | entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); | 397 | entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); |
393 | if (!entry) { | 398 | if (!entry) { |
@@ -444,7 +449,7 @@ acpi_pci_irq_derive(struct pci_dev *dev, | |||
444 | 449 | ||
445 | if (irq < 0) { | 450 | if (irq < 0) { |
446 | dev_warn(&dev->dev, "can't derive routing for PCI INT %c\n", | 451 | dev_warn(&dev->dev, "can't derive routing for PCI INT %c\n", |
447 | 'A' + orig_pin); | 452 | pin_name(orig_pin)); |
448 | return -1; | 453 | return -1; |
449 | } | 454 | } |
450 | 455 | ||
@@ -511,7 +516,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
511 | * driver reported one, then use it. Exit in any case. | 516 | * driver reported one, then use it. Exit in any case. |
512 | */ | 517 | */ |
513 | if (gsi < 0) { | 518 | if (gsi < 0) { |
514 | dev_warn(&dev->dev, "PCI INT %c: no GSI", 'A' + pin); | 519 | dev_warn(&dev->dev, "PCI INT %c: no GSI", pin_name(pin)); |
515 | /* Interrupt Line values above 0xF are forbidden */ | 520 | /* Interrupt Line values above 0xF are forbidden */ |
516 | if (dev->irq > 0 && (dev->irq <= 0xF)) { | 521 | if (dev->irq > 0 && (dev->irq <= 0xF)) { |
517 | printk(" - using IRQ %d\n", dev->irq); | 522 | printk(" - using IRQ %d\n", dev->irq); |
@@ -527,7 +532,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
527 | rc = acpi_register_gsi(gsi, triggering, polarity); | 532 | rc = acpi_register_gsi(gsi, triggering, polarity); |
528 | if (rc < 0) { | 533 | if (rc < 0) { |
529 | dev_warn(&dev->dev, "PCI INT %c: failed to register GSI\n", | 534 | dev_warn(&dev->dev, "PCI INT %c: failed to register GSI\n", |
530 | 'A' + pin); | 535 | pin_name(pin)); |
531 | return rc; | 536 | return rc; |
532 | } | 537 | } |
533 | dev->irq = rc; | 538 | dev->irq = rc; |
@@ -538,7 +543,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
538 | link_desc[0] = '\0'; | 543 | link_desc[0] = '\0'; |
539 | 544 | ||
540 | dev_info(&dev->dev, "PCI INT %c%s -> GSI %u (%s, %s) -> IRQ %d\n", | 545 | dev_info(&dev->dev, "PCI INT %c%s -> GSI %u (%s, %s) -> IRQ %d\n", |
541 | 'A' + pin, link_desc, gsi, | 546 | pin_name(pin), link_desc, gsi, |
542 | (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", | 547 | (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", |
543 | (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); | 548 | (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); |
544 | 549 | ||
@@ -585,6 +590,6 @@ void acpi_pci_irq_disable(struct pci_dev *dev) | |||
585 | * (e.g. PCI_UNDEFINED_IRQ). | 590 | * (e.g. PCI_UNDEFINED_IRQ). |
586 | */ | 591 | */ |
587 | 592 | ||
588 | dev_info(&dev->dev, "PCI INT %c disabled\n", 'A' + pin); | 593 | dev_info(&dev->dev, "PCI INT %c disabled\n", pin_name(pin)); |
589 | acpi_unregister_gsi(gsi); | 594 | acpi_unregister_gsi(gsi); |
590 | } | 595 | } |