summaryrefslogtreecommitdiff
path: root/arch/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/pci-common.c26
-rw-r--r--arch/powerpc/kernel/pci_64.c18
-rw-r--r--arch/powerpc/kernel/pci_of_scan.c7
-rw-r--r--arch/powerpc/platforms/fsl_uli1575.c15
4 files changed, 26 insertions, 40 deletions
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index d75546eb15ec..e640810e813f 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1042,15 +1042,14 @@ static int __devinit pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
/* Fixup resources of a PCI<->PCI bridge */
static void __devinit pcibios_fixup_bridge(struct pci_bus *bus)
{
- struct pci_bus_resource *bus_res;
struct resource *res;
- int i = -1;
+ int i;
struct pci_dev *dev = bus->self;
- list_for_each_entry(bus_res, &bus->resources, list) {
- i++;
- res = bus_res->res;
+ for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) {
+ if ((res = bus->resource[i]) == NULL)
+ continue;
if (!res->flags)
continue;
if (i >= 3 && bus->self->transparent)
@@ -1272,17 +1271,15 @@ static int reparent_resources(struct resource *parent,
void pcibios_allocate_bus_resources(struct pci_bus *bus)
{
struct pci_bus *b;
- int i = -1;
- struct pci_bus_resource *bus_res;
+ int i;
struct resource *res, *pr;
pr_debug("PCI: Allocating bus resources for %04x:%02x...\n",
pci_domain_nr(bus), bus->number);
- list_for_each_entry(bus_res, &bus->resources, list) {
- i++;
- res = bus_res->res;
- if (!res->flags || res->start > res->end || res->parent)
+ for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) {
+ if ((res = bus->resource[i]) == NULL || !res->flags
+ || res->start > res->end || res->parent)
continue;
if (bus->parent == NULL)
pr = (res->flags & IORESOURCE_IO) ?
@@ -1582,11 +1579,8 @@ void __devinit pcibios_setup_phb_resources(struct pci_controller *hose)
struct resource *res;
int i;
- pci_bus_remove_resources(bus);
-
/* Hookup PHB IO resource */
- res = &hose->io_resource;
- pci_bus_add_resource(bus, res, 0);
+ bus->resource[0] = res = &hose->io_resource;
if (!res->flags) {
printk(KERN_WARNING "PCI: I/O resource not set for host"
@@ -1621,7 +1615,7 @@ void __devinit pcibios_setup_phb_resources(struct pci_controller *hose)
res->flags = IORESOURCE_MEM;
#endif /* CONFIG_PPC32 */
}
- pci_bus_add_resource(bus, res, 0);
+ bus->resource[i+1] = res;
pr_debug("PCI: PHB MEM resource %d = %016llx-%016llx [%lx]\n", i,
(unsigned long long)res->start,
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 1bd881b613bd..d43fc65749c1 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -82,7 +82,6 @@ subsys_initcall(pcibios_init);
int pcibios_unmap_io_space(struct pci_bus *bus)
{
- struct pci_dev *bridge = bus->self;
struct pci_controller *hose;
WARN_ON(bus == NULL);
@@ -97,13 +96,13 @@ int pcibios_unmap_io_space(struct pci_bus *bus)
* Note: If we ever support P2P hotplug on Book3E, we'll have
* to do an appropriate TLB flush here too
*/
- if (bridge) {
+ if (bus->self) {
#ifdef CONFIG_PPC_STD_MMU_64
- struct resource *res = &bridge->resource[PCI_BRIDGE_RESOURCES + 0];
+ struct resource *res = bus->resource[0];
#endif
pr_debug("IO unmapping for PCI-PCI bridge %s\n",
- pci_name(bridge));
+ pci_name(bus->self));
#ifdef CONFIG_PPC_STD_MMU_64
__flush_hash_table_range(&init_mm, res->start + _IO_BASE,
@@ -133,7 +132,6 @@ EXPORT_SYMBOL_GPL(pcibios_unmap_io_space);
int __devinit pcibios_map_io_space(struct pci_bus *bus)
{
- struct pci_dev *bridge = bus->self;
struct vm_struct *area;
unsigned long phys_page;
unsigned long size_page;
@@ -145,14 +143,12 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
/* If this not a PHB, nothing to do, page tables still exist and
* thus HPTEs will be faulted in when needed
*/
- if (bridge) {
- struct resource *res = &bridge->resource[PCI_BRIDGE_RESOURCES + 0];
-
+ if (bus->self) {
pr_debug("IO mapping for PCI-PCI bridge %s\n",
- pci_name(bridge));
+ pci_name(bus->self));
pr_debug(" virt=0x%016llx...0x%016llx\n",
- res->start + _IO_BASE,
- res->end + _IO_BASE);
+ bus->resource[0]->start + _IO_BASE,
+ bus->resource[0]->end + _IO_BASE);
return 0;
}
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index a4f8b68bb2ef..cd11d5ca80df 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -242,11 +242,10 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
/* parse ranges property */
/* PCI #address-cells == 3 and #size-cells == 2 always */
- pci_bus_remove_resources(bus);
res = &dev->resource[PCI_BRIDGE_RESOURCES];
for (i = 0; i < PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES; ++i) {
res->flags = 0;
- pci_bus_add_resource(bus, res, PCI_POSITIVE_DECODE);
+ bus->resource[i] = res;
++res;
}
i = 1;
@@ -256,7 +255,7 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
if (flags == 0 || size == 0)
continue;
if (flags & IORESOURCE_IO) {
- res = &dev->resource[PCI_BRIDGE_RESOURCES + 0];
+ res = bus->resource[0];
if (res->flags) {
printk(KERN_ERR "PCI: ignoring extra I/O range"
" for bridge %s\n", node->full_name);
@@ -268,7 +267,7 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
" for bridge %s\n", node->full_name);
continue;
}
- res = &dev->resource[PCI_BRIDGE_RESOURCES + i];
+ res = bus->resource[i];
++i;
}
res->start = of_read_number(&ranges[1], 2);
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
index 04c546f67e02..fd23a1d4b39d 100644
--- a/arch/powerpc/platforms/fsl_uli1575.c
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -222,8 +222,6 @@ static void __devinit quirk_final_uli5249(struct pci_dev *dev)
int i;
u8 *dummy;
struct pci_bus *bus = dev->bus;
- struct pci_bus_resource *bus_res;
- struct resource *res;
resource_size_t end = 0;
for (i = PCI_BRIDGE_RESOURCES; i < PCI_BRIDGE_RESOURCES+3; i++) {
@@ -232,14 +230,13 @@ static void __devinit quirk_final_uli5249(struct pci_dev *dev)
end = pci_resource_end(dev, i);
}
- list_for_each_entry(bus_res, &bus->resources, list) {
- res = bus_res->res;
-
- if (res->flags & IORESOURCE_MEM) {
- if (res->end == end)
- dummy = ioremap(res->start, 0x4);
+ for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
+ if ((bus->resource[i]) &&
+ (bus->resource[i]->flags & IORESOURCE_MEM)) {
+ if (bus->resource[i]->end == end)
+ dummy = ioremap(bus->resource[i]->start, 0x4);
else
- dummy = ioremap(res->end - 3, 0x4);
+ dummy = ioremap(bus->resource[i]->end - 3, 0x4);
if (dummy) {
in_8(dummy);
iounmap(dummy);