mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
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>
This commit is contained in:
parent
0a5ef7b914
commit
fc2798502f
17 changed files with 49 additions and 51 deletions
|
@ -475,7 +475,7 @@ void pci_setup_cardbus(struct pci_bus *bus)
|
|||
&bus->busn_res);
|
||||
|
||||
res = bus->resource[0];
|
||||
pcibios_resource_to_bus(bridge, ®ion, res);
|
||||
pcibios_resource_to_bus(bridge->bus, ®ion, res);
|
||||
if (res->flags & IORESOURCE_IO) {
|
||||
/*
|
||||
* The IO resource is allocated a range twice as large as it
|
||||
|
@ -489,7 +489,7 @@ void pci_setup_cardbus(struct pci_bus *bus)
|
|||
}
|
||||
|
||||
res = bus->resource[1];
|
||||
pcibios_resource_to_bus(bridge, ®ion, res);
|
||||
pcibios_resource_to_bus(bridge->bus, ®ion, res);
|
||||
if (res->flags & IORESOURCE_IO) {
|
||||
dev_info(&bridge->dev, " bridge window %pR\n", res);
|
||||
pci_write_config_dword(bridge, PCI_CB_IO_BASE_1,
|
||||
|
@ -499,7 +499,7 @@ void pci_setup_cardbus(struct pci_bus *bus)
|
|||
}
|
||||
|
||||
res = bus->resource[2];
|
||||
pcibios_resource_to_bus(bridge, ®ion, res);
|
||||
pcibios_resource_to_bus(bridge->bus, ®ion, res);
|
||||
if (res->flags & IORESOURCE_MEM) {
|
||||
dev_info(&bridge->dev, " bridge window %pR\n", res);
|
||||
pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0,
|
||||
|
@ -509,7 +509,7 @@ void pci_setup_cardbus(struct pci_bus *bus)
|
|||
}
|
||||
|
||||
res = bus->resource[3];
|
||||
pcibios_resource_to_bus(bridge, ®ion, res);
|
||||
pcibios_resource_to_bus(bridge->bus, ®ion, res);
|
||||
if (res->flags & IORESOURCE_MEM) {
|
||||
dev_info(&bridge->dev, " bridge window %pR\n", res);
|
||||
pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1,
|
||||
|
@ -546,7 +546,7 @@ static void pci_setup_bridge_io(struct pci_bus *bus)
|
|||
|
||||
/* Set up the top and bottom of the PCI I/O segment for this bus. */
|
||||
res = bus->resource[0];
|
||||
pcibios_resource_to_bus(bridge, ®ion, res);
|
||||
pcibios_resource_to_bus(bridge->bus, ®ion, res);
|
||||
if (res->flags & IORESOURCE_IO) {
|
||||
pci_read_config_dword(bridge, PCI_IO_BASE, &l);
|
||||
l &= 0xffff0000;
|
||||
|
@ -578,7 +578,7 @@ static void pci_setup_bridge_mmio(struct pci_bus *bus)
|
|||
|
||||
/* Set up the top and bottom of the PCI Memory segment for this bus. */
|
||||
res = bus->resource[1];
|
||||
pcibios_resource_to_bus(bridge, ®ion, res);
|
||||
pcibios_resource_to_bus(bridge->bus, ®ion, res);
|
||||
if (res->flags & IORESOURCE_MEM) {
|
||||
l = (region.start >> 16) & 0xfff0;
|
||||
l |= region.end & 0xfff00000;
|
||||
|
@ -604,7 +604,7 @@ static void pci_setup_bridge_mmio_pref(struct pci_bus *bus)
|
|||
/* Set up PREF base/limit. */
|
||||
bu = lu = 0;
|
||||
res = bus->resource[2];
|
||||
pcibios_resource_to_bus(bridge, ®ion, res);
|
||||
pcibios_resource_to_bus(bridge->bus, ®ion, res);
|
||||
if (res->flags & IORESOURCE_PREFETCH) {
|
||||
l = (region.start >> 16) & 0xfff0;
|
||||
l |= region.end & 0xfff00000;
|
||||
|
@ -1422,7 +1422,7 @@ static int iov_resources_unassigned(struct pci_dev *dev, void *data)
|
|||
if (!r->flags)
|
||||
continue;
|
||||
|
||||
pcibios_resource_to_bus(dev, ®ion, r);
|
||||
pcibios_resource_to_bus(dev->bus, ®ion, r);
|
||||
if (!region.start) {
|
||||
*unassigned = true;
|
||||
return 1; /* return early from pci_walk_bus() */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue