diff options
author | Yinghai Lu <yinghai@kernel.org> | 2013-12-10 01:54:40 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-12-21 12:06:10 -0500 |
commit | fc2798502f860b18f3c7121e4dc659d3d9d28d74 (patch) | |
tree | d15d6addb41d305e33c6f6d8e363b7272dc29a38 /drivers/pci/setup-bus.c | |
parent | 0a5ef7b914be91dd257ae4f35223dd822dd3703a (diff) |
PCI: Convert pcibios_resource_to_bus() to take a pci_bus, not a pci_dev
These interfaces:
pcibios_resource_to_bus(struct pci_dev *dev, *bus_region, *resource)
pcibios_bus_to_resource(struct pci_dev *dev, *resource, *bus_region)
took a pci_dev, but they really depend only on the pci_bus. And we want to
use them in resource allocation paths where we have the bus but not a
device, so this patch converts them to take the pci_bus instead of the
pci_dev:
pcibios_resource_to_bus(struct pci_bus *bus, *bus_region, *resource)
pcibios_bus_to_resource(struct pci_bus *bus, *resource, *bus_region)
In fact, with standard PCI-PCI bridges, they only depend on the host
bridge, because that's the only place address translation occurs, but
we aren't going that far yet.
[bhelgaas: changelog]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/setup-bus.c')
-rw-r--r-- | drivers/pci/setup-bus.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 219a4106480a..79339822d80e 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -475,7 +475,7 @@ void pci_setup_cardbus(struct pci_bus *bus) | |||
475 | &bus->busn_res); | 475 | &bus->busn_res); |
476 | 476 | ||
477 | res = bus->resource[0]; | 477 | res = bus->resource[0]; |
478 | pcibios_resource_to_bus(bridge, ®ion, res); | 478 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
479 | if (res->flags & IORESOURCE_IO) { | 479 | if (res->flags & IORESOURCE_IO) { |
480 | /* | 480 | /* |
481 | * The IO resource is allocated a range twice as large as it | 481 | * The IO resource is allocated a range twice as large as it |
@@ -489,7 +489,7 @@ void pci_setup_cardbus(struct pci_bus *bus) | |||
489 | } | 489 | } |
490 | 490 | ||
491 | res = bus->resource[1]; | 491 | res = bus->resource[1]; |
492 | pcibios_resource_to_bus(bridge, ®ion, res); | 492 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
493 | if (res->flags & IORESOURCE_IO) { | 493 | if (res->flags & IORESOURCE_IO) { |
494 | dev_info(&bridge->dev, " bridge window %pR\n", res); | 494 | dev_info(&bridge->dev, " bridge window %pR\n", res); |
495 | pci_write_config_dword(bridge, PCI_CB_IO_BASE_1, | 495 | pci_write_config_dword(bridge, PCI_CB_IO_BASE_1, |
@@ -499,7 +499,7 @@ void pci_setup_cardbus(struct pci_bus *bus) | |||
499 | } | 499 | } |
500 | 500 | ||
501 | res = bus->resource[2]; | 501 | res = bus->resource[2]; |
502 | pcibios_resource_to_bus(bridge, ®ion, res); | 502 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
503 | if (res->flags & IORESOURCE_MEM) { | 503 | if (res->flags & IORESOURCE_MEM) { |
504 | dev_info(&bridge->dev, " bridge window %pR\n", res); | 504 | dev_info(&bridge->dev, " bridge window %pR\n", res); |
505 | pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0, | 505 | pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0, |
@@ -509,7 +509,7 @@ void pci_setup_cardbus(struct pci_bus *bus) | |||
509 | } | 509 | } |
510 | 510 | ||
511 | res = bus->resource[3]; | 511 | res = bus->resource[3]; |
512 | pcibios_resource_to_bus(bridge, ®ion, res); | 512 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
513 | if (res->flags & IORESOURCE_MEM) { | 513 | if (res->flags & IORESOURCE_MEM) { |
514 | dev_info(&bridge->dev, " bridge window %pR\n", res); | 514 | dev_info(&bridge->dev, " bridge window %pR\n", res); |
515 | pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1, | 515 | pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1, |
@@ -546,7 +546,7 @@ static void pci_setup_bridge_io(struct pci_bus *bus) | |||
546 | 546 | ||
547 | /* Set up the top and bottom of the PCI I/O segment for this bus. */ | 547 | /* Set up the top and bottom of the PCI I/O segment for this bus. */ |
548 | res = bus->resource[0]; | 548 | res = bus->resource[0]; |
549 | pcibios_resource_to_bus(bridge, ®ion, res); | 549 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
550 | if (res->flags & IORESOURCE_IO) { | 550 | if (res->flags & IORESOURCE_IO) { |
551 | pci_read_config_dword(bridge, PCI_IO_BASE, &l); | 551 | pci_read_config_dword(bridge, PCI_IO_BASE, &l); |
552 | l &= 0xffff0000; | 552 | l &= 0xffff0000; |
@@ -578,7 +578,7 @@ static void pci_setup_bridge_mmio(struct pci_bus *bus) | |||
578 | 578 | ||
579 | /* Set up the top and bottom of the PCI Memory segment for this bus. */ | 579 | /* Set up the top and bottom of the PCI Memory segment for this bus. */ |
580 | res = bus->resource[1]; | 580 | res = bus->resource[1]; |
581 | pcibios_resource_to_bus(bridge, ®ion, res); | 581 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
582 | if (res->flags & IORESOURCE_MEM) { | 582 | if (res->flags & IORESOURCE_MEM) { |
583 | l = (region.start >> 16) & 0xfff0; | 583 | l = (region.start >> 16) & 0xfff0; |
584 | l |= region.end & 0xfff00000; | 584 | l |= region.end & 0xfff00000; |
@@ -604,7 +604,7 @@ static void pci_setup_bridge_mmio_pref(struct pci_bus *bus) | |||
604 | /* Set up PREF base/limit. */ | 604 | /* Set up PREF base/limit. */ |
605 | bu = lu = 0; | 605 | bu = lu = 0; |
606 | res = bus->resource[2]; | 606 | res = bus->resource[2]; |
607 | pcibios_resource_to_bus(bridge, ®ion, res); | 607 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
608 | if (res->flags & IORESOURCE_PREFETCH) { | 608 | if (res->flags & IORESOURCE_PREFETCH) { |
609 | l = (region.start >> 16) & 0xfff0; | 609 | l = (region.start >> 16) & 0xfff0; |
610 | l |= region.end & 0xfff00000; | 610 | l |= region.end & 0xfff00000; |
@@ -1422,7 +1422,7 @@ static int iov_resources_unassigned(struct pci_dev *dev, void *data) | |||
1422 | if (!r->flags) | 1422 | if (!r->flags) |
1423 | continue; | 1423 | continue; |
1424 | 1424 | ||
1425 | pcibios_resource_to_bus(dev, ®ion, r); | 1425 | pcibios_resource_to_bus(dev->bus, ®ion, r); |
1426 | if (!region.start) { | 1426 | if (!region.start) { |
1427 | *unassigned = true; | 1427 | *unassigned = true; |
1428 | return 1; /* return early from pci_walk_bus() */ | 1428 | return 1; /* return early from pci_walk_bus() */ |