ACPI: PCI: lookup _PRT entry by PCI dev and pin, not segment/bus/dev/pin

There's no reason to pass around segment, bus, and device independently
when we can just pass the pci_dev pointer, which carries all those
already.

The pci_dev contains an interrupt pin, too, but we still have to pass both
the pci_dev and the pin because when we use a bridge to derive an IRQ, we
need the pin from the downstream device, not the bridge.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
Bjorn Helgaas 2008-12-08 21:30:51 -07:00 коммит произвёл Len Brown
Родитель c458033c9b
Коммит 063563b4b8
1 изменённых файлов: 12 добавлений и 15 удалений

Просмотреть файл

@ -69,11 +69,13 @@ static inline char pin_name(int pin)
PCI IRQ Routing Table (PRT) Support PCI IRQ Routing Table (PRT) Support
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(struct pci_dev *dev,
int bus, int pin)
int device, int pin)
{ {
struct acpi_prt_entry *entry = NULL; struct acpi_prt_entry *entry = NULL;
int segment = pci_domain_nr(dev->bus);
int bus = dev->bus->number;
int device = PCI_SLOT(dev->devfn);
if (!acpi_prt.count) if (!acpi_prt.count)
return NULL; return NULL;
@ -385,23 +387,18 @@ acpi_pci_free_irq(struct acpi_prt_entry *entry,
* failure: return -1 * failure: return -1
*/ */
static int static int
acpi_pci_irq_lookup(struct pci_bus *bus, acpi_pci_irq_lookup(struct pci_dev *dev, int pin,
int device,
int pin,
int *triggering, int *triggering,
int *polarity, char **link, irq_lookup_func func) int *polarity, char **link, irq_lookup_func func)
{ {
struct acpi_prt_entry *entry = NULL; struct acpi_prt_entry *entry = NULL;
int segment = pci_domain_nr(bus);
int bus_nr = bus->number;
int ret; int ret;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Searching for _PRT entry for %s[%c]\n",
"Searching for _PRT entry for %04x:%02x:%02x[%c]\n", pci_name(dev), pin_name(pin)));
segment, bus_nr, device, pin_name(pin)));
entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); entry = acpi_pci_irq_find_prt_entry(dev, pin);
if (!entry) { if (!entry) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_PRT entry not found\n")); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_PRT entry not found\n"));
return -1; return -1;
@ -447,7 +444,7 @@ acpi_pci_irq_derive(struct pci_dev *dev,
pin = bridge_pin; pin = bridge_pin;
} }
irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), irq = acpi_pci_irq_lookup(bridge,
pin, triggering, polarity, pin, triggering, polarity,
link, func); link, func);
} }
@ -493,7 +490,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
* First we check the PCI IRQ routing table (PRT) for an IRQ. PRT * First we check the PCI IRQ routing table (PRT) for an IRQ. PRT
* values override any BIOS-assigned IRQs set during boot. * values override any BIOS-assigned IRQs set during boot.
*/ */
gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, gsi = acpi_pci_irq_lookup(dev, pin,
&triggering, &polarity, &link, &triggering, &polarity, &link,
acpi_pci_allocate_irq); acpi_pci_allocate_irq);
@ -574,7 +571,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
/* /*
* First we check the PCI IRQ routing table (PRT) for an IRQ. * First we check the PCI IRQ routing table (PRT) for an IRQ.
*/ */
gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, gsi = acpi_pci_irq_lookup(dev, pin,
&triggering, &polarity, NULL, &triggering, &polarity, NULL,
acpi_pci_free_irq); acpi_pci_free_irq);
/* /*