Commit 79c44122 authored by Bjorn Helgaas's avatar Bjorn Helgaas

ACPI: Pass segment/bus to _PRT add/del so they don't depend on pci_bus

This effectively reverts 859a3f86 ("ACPI: simplify
acpi_pci_irq_add_prt() API") and d9efae36 ("ACPI: simplify
acpi_pci_irq_del_prt() API").

The reason is to disentangle these routines from the struct pci_bus.
We want to be able to add the _PRT before the struct pci_bus
exists, and delete the _PRT after we've removed the pci_bus.
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Signed-off-by: default avatarTaku Izumi <izumi.taku@jp.fujitsu.com>
parent f426cef3
...@@ -49,7 +49,7 @@ static int acpi_pci_unbind(struct acpi_device *device) ...@@ -49,7 +49,7 @@ static int acpi_pci_unbind(struct acpi_device *device)
if (!dev->subordinate) if (!dev->subordinate)
goto out; goto out;
acpi_pci_irq_del_prt(dev->subordinate); acpi_pci_irq_del_prt(pci_domain_nr(dev->bus), dev->subordinate->number);
device->ops.bind = NULL; device->ops.bind = NULL;
device->ops.unbind = NULL; device->ops.unbind = NULL;
...@@ -63,7 +63,7 @@ static int acpi_pci_bind(struct acpi_device *device) ...@@ -63,7 +63,7 @@ static int acpi_pci_bind(struct acpi_device *device)
{ {
acpi_status status; acpi_status status;
acpi_handle handle; acpi_handle handle;
struct pci_bus *bus; unsigned char bus;
struct pci_dev *dev; struct pci_dev *dev;
dev = acpi_get_pci_dev(device->handle); dev = acpi_get_pci_dev(device->handle);
...@@ -100,11 +100,11 @@ static int acpi_pci_bind(struct acpi_device *device) ...@@ -100,11 +100,11 @@ static int acpi_pci_bind(struct acpi_device *device)
goto out; goto out;
if (dev->subordinate) if (dev->subordinate)
bus = dev->subordinate; bus = dev->subordinate->number;
else else
bus = dev->bus; bus = dev->bus->number;
acpi_pci_irq_add_prt(device->handle, bus); acpi_pci_irq_add_prt(device->handle, pci_domain_nr(dev->bus), bus);
out: out:
pci_dev_put(dev); pci_dev_put(dev);
......
...@@ -184,7 +184,7 @@ static void do_prt_fixups(struct acpi_prt_entry *entry, ...@@ -184,7 +184,7 @@ static void do_prt_fixups(struct acpi_prt_entry *entry,
} }
} }
static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus, static int acpi_pci_irq_add_entry(acpi_handle handle, int segment, int bus,
struct acpi_pci_routing_table *prt) struct acpi_pci_routing_table *prt)
{ {
struct acpi_prt_entry *entry; struct acpi_prt_entry *entry;
...@@ -198,8 +198,8 @@ static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus, ...@@ -198,8 +198,8 @@ static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus,
* 1=INTA, 2=INTB. We use the PCI encoding throughout, so convert * 1=INTA, 2=INTB. We use the PCI encoding throughout, so convert
* it here. * it here.
*/ */
entry->id.segment = pci_domain_nr(bus); entry->id.segment = segment;
entry->id.bus = bus->number; entry->id.bus = bus;
entry->id.device = (prt->address >> 16) & 0xFFFF; entry->id.device = (prt->address >> 16) & 0xFFFF;
entry->pin = prt->pin + 1; entry->pin = prt->pin + 1;
...@@ -244,7 +244,7 @@ static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus, ...@@ -244,7 +244,7 @@ static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus,
return 0; return 0;
} }
int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus) int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
{ {
acpi_status status; acpi_status status;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
...@@ -273,7 +273,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus) ...@@ -273,7 +273,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus)
entry = buffer.pointer; entry = buffer.pointer;
while (entry && (entry->length > 0)) { while (entry && (entry->length > 0)) {
acpi_pci_irq_add_entry(handle, bus, entry); acpi_pci_irq_add_entry(handle, segment, bus, entry);
entry = (struct acpi_pci_routing_table *) entry = (struct acpi_pci_routing_table *)
((unsigned long)entry + entry->length); ((unsigned long)entry + entry->length);
} }
...@@ -282,17 +282,16 @@ int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus) ...@@ -282,17 +282,16 @@ int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus)
return 0; return 0;
} }
void acpi_pci_irq_del_prt(struct pci_bus *bus) void acpi_pci_irq_del_prt(int segment, int bus)
{ {
struct acpi_prt_entry *entry, *tmp; struct acpi_prt_entry *entry, *tmp;
printk(KERN_DEBUG printk(KERN_DEBUG
"ACPI: Delete PCI Interrupt Routing Table for %04x:%02x\n", "ACPI: Delete PCI Interrupt Routing Table for %04x:%02x\n",
pci_domain_nr(bus), bus->number); segment, bus);
spin_lock(&acpi_prt_lock); spin_lock(&acpi_prt_lock);
list_for_each_entry_safe(entry, tmp, &acpi_prt_list, list) { list_for_each_entry_safe(entry, tmp, &acpi_prt_list, list) {
if (pci_domain_nr(bus) == entry->id.segment if (segment == entry->id.segment && bus == entry->id.bus) {
&& bus->number == entry->id.bus) {
list_del(&entry->list); list_del(&entry->list);
kfree(entry); kfree(entry);
} }
......
...@@ -554,7 +554,8 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device) ...@@ -554,7 +554,8 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
*/ */
status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
if (ACPI_SUCCESS(status)) if (ACPI_SUCCESS(status))
result = acpi_pci_irq_add_prt(device->handle, root->bus); result = acpi_pci_irq_add_prt(device->handle, root->segment,
root->secondary.start);
/* /*
* Scan and bind all _ADR-Based Devices * Scan and bind all _ADR-Based Devices
...@@ -682,7 +683,7 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type) ...@@ -682,7 +683,7 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type)
status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
if (ACPI_SUCCESS(status)) if (ACPI_SUCCESS(status))
acpi_pci_irq_del_prt(root->bus); acpi_pci_irq_del_prt(root->segment, root->secondary.start);
pci_remove_root_bus(root->bus); pci_remove_root_bus(root->bus);
......
...@@ -92,8 +92,8 @@ int acpi_pci_link_free_irq(acpi_handle handle); ...@@ -92,8 +92,8 @@ int acpi_pci_link_free_irq(acpi_handle handle);
/* ACPI PCI Interrupt Routing (pci_irq.c) */ /* ACPI PCI Interrupt Routing (pci_irq.c) */
int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus); int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus);
void acpi_pci_irq_del_prt(struct pci_bus *bus); void acpi_pci_irq_del_prt(int segment, int bus);
/* ACPI PCI Device Binding (pci_bind.c) */ /* ACPI PCI Device Binding (pci_bind.c) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment