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/probe.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/probe.c')
-rw-r--r-- | drivers/pci/probe.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 38e403dddf6e..f049e3f53fcc 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -269,8 +269,8 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
269 | region.end = l + sz; | 269 | region.end = l + sz; |
270 | } | 270 | } |
271 | 271 | ||
272 | pcibios_bus_to_resource(dev, res, ®ion); | 272 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
273 | pcibios_resource_to_bus(dev, &inverted_region, res); | 273 | pcibios_resource_to_bus(dev->bus, &inverted_region, res); |
274 | 274 | ||
275 | /* | 275 | /* |
276 | * If "A" is a BAR value (a bus address), "bus_to_resource(A)" is | 276 | * If "A" is a BAR value (a bus address), "bus_to_resource(A)" is |
@@ -364,7 +364,7 @@ static void pci_read_bridge_io(struct pci_bus *child) | |||
364 | res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO; | 364 | res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO; |
365 | region.start = base; | 365 | region.start = base; |
366 | region.end = limit + io_granularity - 1; | 366 | region.end = limit + io_granularity - 1; |
367 | pcibios_bus_to_resource(dev, res, ®ion); | 367 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
368 | dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); | 368 | dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); |
369 | } | 369 | } |
370 | } | 370 | } |
@@ -386,7 +386,7 @@ static void pci_read_bridge_mmio(struct pci_bus *child) | |||
386 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; | 386 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; |
387 | region.start = base; | 387 | region.start = base; |
388 | region.end = limit + 0xfffff; | 388 | region.end = limit + 0xfffff; |
389 | pcibios_bus_to_resource(dev, res, ®ion); | 389 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
390 | dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); | 390 | dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); |
391 | } | 391 | } |
392 | } | 392 | } |
@@ -436,7 +436,7 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child) | |||
436 | res->flags |= IORESOURCE_MEM_64; | 436 | res->flags |= IORESOURCE_MEM_64; |
437 | region.start = base; | 437 | region.start = base; |
438 | region.end = limit + 0xfffff; | 438 | region.end = limit + 0xfffff; |
439 | pcibios_bus_to_resource(dev, res, ®ion); | 439 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
440 | dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); | 440 | dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); |
441 | } | 441 | } |
442 | } | 442 | } |
@@ -1084,24 +1084,24 @@ int pci_setup_device(struct pci_dev *dev) | |||
1084 | region.end = 0x1F7; | 1084 | region.end = 0x1F7; |
1085 | res = &dev->resource[0]; | 1085 | res = &dev->resource[0]; |
1086 | res->flags = LEGACY_IO_RESOURCE; | 1086 | res->flags = LEGACY_IO_RESOURCE; |
1087 | pcibios_bus_to_resource(dev, res, ®ion); | 1087 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
1088 | region.start = 0x3F6; | 1088 | region.start = 0x3F6; |
1089 | region.end = 0x3F6; | 1089 | region.end = 0x3F6; |
1090 | res = &dev->resource[1]; | 1090 | res = &dev->resource[1]; |
1091 | res->flags = LEGACY_IO_RESOURCE; | 1091 | res->flags = LEGACY_IO_RESOURCE; |
1092 | pcibios_bus_to_resource(dev, res, ®ion); | 1092 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
1093 | } | 1093 | } |
1094 | if ((progif & 4) == 0) { | 1094 | if ((progif & 4) == 0) { |
1095 | region.start = 0x170; | 1095 | region.start = 0x170; |
1096 | region.end = 0x177; | 1096 | region.end = 0x177; |
1097 | res = &dev->resource[2]; | 1097 | res = &dev->resource[2]; |
1098 | res->flags = LEGACY_IO_RESOURCE; | 1098 | res->flags = LEGACY_IO_RESOURCE; |
1099 | pcibios_bus_to_resource(dev, res, ®ion); | 1099 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
1100 | region.start = 0x376; | 1100 | region.start = 0x376; |
1101 | region.end = 0x376; | 1101 | region.end = 0x376; |
1102 | res = &dev->resource[3]; | 1102 | res = &dev->resource[3]; |
1103 | res->flags = LEGACY_IO_RESOURCE; | 1103 | res->flags = LEGACY_IO_RESOURCE; |
1104 | pcibios_bus_to_resource(dev, res, ®ion); | 1104 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
1105 | } | 1105 | } |
1106 | } | 1106 | } |
1107 | break; | 1107 | break; |