aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/pci-common.c130
-rw-r--r--arch/powerpc/kernel/pci_32.c83
-rw-r--r--arch/powerpc/kernel/pci_64.c104
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c14
-rw-r--r--drivers/pci/hotplug/rpadlpar_core.c2
-rw-r--r--include/asm-powerpc/machdep.h14
-rw-r--r--include/asm-powerpc/pci-bridge.h2
-rw-r--r--include/asm-powerpc/pci.h6
8 files changed, 167 insertions, 188 deletions
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 0245c989d30a..c61e9324f770 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -691,3 +691,133 @@ void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
691 res->end = (region->end + offset) & mask; 691 res->end = (region->end + offset) & mask;
692} 692}
693EXPORT_SYMBOL(pcibios_bus_to_resource); 693EXPORT_SYMBOL(pcibios_bus_to_resource);
694
695/* Fixup a bus resource into a linux resource */
696static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev)
697{
698 struct pci_controller *hose = pci_bus_to_host(dev->bus);
699 resource_size_t offset = 0, mask = (resource_size_t)-1;
700
701 if (res->flags & IORESOURCE_IO) {
702 offset = (unsigned long)hose->io_base_virt - _IO_BASE;
703 mask = 0xffffffffu;
704 } else if (res->flags & IORESOURCE_MEM)
705 offset = hose->pci_mem_offset;
706
707 res->start = (res->start + offset) & mask;
708 res->end = (res->end + offset) & mask;
709
710 pr_debug("PCI:%s %016llx-%016llx\n",
711 pci_name(dev),
712 (unsigned long long)res->start,
713 (unsigned long long)res->end);
714}
715
716
717/* This header fixup will do the resource fixup for all devices as they are
718 * probed, but not for bridge ranges
719 */
720static void __devinit pcibios_fixup_resources(struct pci_dev *dev)
721{
722 struct pci_controller *hose = pci_bus_to_host(dev->bus);
723 int i;
724
725 if (!hose) {
726 printk(KERN_ERR "No host bridge for PCI dev %s !\n",
727 pci_name(dev));
728 return;
729 }
730 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
731 struct resource *res = dev->resource + i;
732 if (!res->flags)
733 continue;
734 if (res->end == 0xffffffff) {
735 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] is unassigned\n",
736 pci_name(dev), i,
737 (unsigned long long)res->start,
738 (unsigned long long)res->end,
739 (unsigned int)res->flags);
740 res->end -= res->start;
741 res->start = 0;
742 res->flags |= IORESOURCE_UNSET;
743 continue;
744 }
745
746 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] fixup...\n",
747 pci_name(dev), i,
748 (unsigned long long)res->start,\
749 (unsigned long long)res->end,
750 (unsigned int)res->flags);
751
752 fixup_resource(res, dev);
753 }
754
755 /* Call machine specific resource fixup */
756 if (ppc_md.pcibios_fixup_resources)
757 ppc_md.pcibios_fixup_resources(dev);
758}
759DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources);
760
761static void __devinit __pcibios_fixup_bus(struct pci_bus *bus)
762{
763 struct pci_dev *dev = bus->self;
764
765 pr_debug("PCI: Fixup bus %d (%s)\n", bus->number, dev ? pci_name(dev) : "PHB");
766
767 /* Fixup PCI<->PCI bridges. Host bridges are handled separately, for
768 * now differently between 32 and 64 bits.
769 */
770 if (dev != NULL) {
771 struct resource *res;
772 int i;
773
774 for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) {
775 if ((res = bus->resource[i]) == NULL)
776 continue;
777 if (!res->flags || bus->self->transparent)
778 continue;
779
780 pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x] fixup...\n",
781 pci_name(dev), i,
782 (unsigned long long)res->start,\
783 (unsigned long long)res->end,
784 (unsigned int)res->flags);
785
786 fixup_resource(res, dev);
787 }
788 }
789
790 /* Additional setup that is different between 32 and 64 bits for now */
791 pcibios_do_bus_setup(bus);
792
793 /* Platform specific bus fixups */
794 if (ppc_md.pcibios_fixup_bus)
795 ppc_md.pcibios_fixup_bus(bus);
796
797 /* Read default IRQs and fixup if necessary */
798 list_for_each_entry(dev, &bus->devices, bus_list) {
799 pci_read_irq_line(dev);
800 if (ppc_md.pci_irq_fixup)
801 ppc_md.pci_irq_fixup(dev);
802 }
803}
804
805void __devinit pcibios_fixup_bus(struct pci_bus *bus)
806{
807 /* When called from the generic PCI probe, read PCI<->PCI bridge
808 * bases before proceeding
809 */
810 if (bus->self != NULL)
811 pci_read_bridge_bases(bus);
812 __pcibios_fixup_bus(bus);
813}
814EXPORT_SYMBOL(pcibios_fixup_bus);
815
816/* When building a bus from the OF tree rather than probing, we need a
817 * slightly different version of the fixup which doesn't read the
818 * bridge bases using config space accesses
819 */
820void __devinit pcibios_fixup_of_probed_bus(struct pci_bus *bus)
821{
822 __pcibios_fixup_bus(bus);
823}
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index f05ef5b17892..717c554d4658 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -40,7 +40,6 @@ unsigned int ppc_pci_flags;
40 40
41void pcibios_make_OF_bus_map(void); 41void pcibios_make_OF_bus_map(void);
42 42
43static void pcibios_fixup_resources(struct pci_dev* dev);
44static void fixup_broken_pcnet32(struct pci_dev* dev); 43static void fixup_broken_pcnet32(struct pci_dev* dev);
45static int reparent_resources(struct resource *parent, struct resource *res); 44static int reparent_resources(struct resource *parent, struct resource *res);
46static void fixup_cpc710_pci64(struct pci_dev* dev); 45static void fixup_cpc710_pci64(struct pci_dev* dev);
@@ -98,53 +97,6 @@ fixup_cpc710_pci64(struct pci_dev* dev)
98} 97}
99DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CPC710_PCI64, fixup_cpc710_pci64); 98DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CPC710_PCI64, fixup_cpc710_pci64);
100 99
101static void
102pcibios_fixup_resources(struct pci_dev *dev)
103{
104 struct pci_controller* hose = (struct pci_controller *)dev->sysdata;
105 int i;
106 resource_size_t offset, mask;
107
108 if (!hose) {
109 printk(KERN_ERR "No hose for PCI dev %s!\n", pci_name(dev));
110 return;
111 }
112 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
113 struct resource *res = dev->resource + i;
114 if (!res->flags)
115 continue;
116 if (res->end == 0xffffffff) {
117 DBG("PCI:%s Resource %d [%016llx-%016llx] is unassigned\n",
118 pci_name(dev), i, (u64)res->start, (u64)res->end);
119 res->end -= res->start;
120 res->start = 0;
121 res->flags |= IORESOURCE_UNSET;
122 continue;
123 }
124 offset = 0;
125 mask = (resource_size_t)-1;
126 if (res->flags & IORESOURCE_MEM) {
127 offset = hose->pci_mem_offset;
128 } else if (res->flags & IORESOURCE_IO) {
129 offset = (unsigned long) hose->io_base_virt
130 - isa_io_base;
131 mask = 0xffffffffu;
132 }
133 if (offset != 0) {
134 res->start = (res->start + offset) & mask;
135 res->end = (res->end + offset) & mask;
136 DBG("PCI: Fixup res %d (0x%lx) of dev %s: %llx -> %llx\n",
137 i, res->flags, pci_name(dev),
138 (u64)res->start - offset, (u64)res->start);
139 }
140 }
141
142 /* Call machine specific resource fixup */
143 if (ppc_md.pcibios_fixup_resources)
144 ppc_md.pcibios_fixup_resources(dev);
145}
146DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources);
147
148static int skip_isa_ioresource_align(struct pci_dev *dev) 100static int skip_isa_ioresource_align(struct pci_dev *dev)
149{ 101{
150 if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) && 102 if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) &&
@@ -757,14 +709,14 @@ pcibios_init(void)
757 709
758subsys_initcall(pcibios_init); 710subsys_initcall(pcibios_init);
759 711
760void pcibios_fixup_bus(struct pci_bus *bus) 712void __devinit pcibios_do_bus_setup(struct pci_bus *bus)
761{ 713{
762 struct pci_controller *hose = (struct pci_controller *) bus->sysdata; 714 struct pci_controller *hose = (struct pci_controller *) bus->sysdata;
763 unsigned long io_offset; 715 unsigned long io_offset;
764 struct resource *res; 716 struct resource *res;
765 struct pci_dev *dev;
766 int i; 717 int i;
767 718
719 /* Hookup PHB resources */
768 io_offset = (unsigned long)hose->io_base_virt - isa_io_base; 720 io_offset = (unsigned long)hose->io_base_virt - isa_io_base;
769 if (bus->parent == NULL) { 721 if (bus->parent == NULL) {
770 /* This is a host bridge - fill in its resources */ 722 /* This is a host bridge - fill in its resources */
@@ -795,37 +747,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
795 } 747 }
796 bus->resource[i+1] = res; 748 bus->resource[i+1] = res;
797 } 749 }
798 } else {
799 /* This is a subordinate bridge */
800 pci_read_bridge_bases(bus);
801
802 for (i = 0; i < 4; ++i) {
803 if ((res = bus->resource[i]) == NULL)
804 continue;
805 if (!res->flags || bus->self->transparent)
806 continue;
807 if (io_offset && (res->flags & IORESOURCE_IO)) {
808 res->start = (res->start + io_offset) &
809 0xffffffffu;
810 res->end = (res->end + io_offset) &
811 0xffffffffu;
812 } else if (hose->pci_mem_offset
813 && (res->flags & IORESOURCE_MEM)) {
814 res->start += hose->pci_mem_offset;
815 res->end += hose->pci_mem_offset;
816 }
817 }
818 }
819
820 /* Platform specific bus fixups */
821 if (ppc_md.pcibios_fixup_bus)
822 ppc_md.pcibios_fixup_bus(bus);
823
824 /* Read default IRQs and fixup if necessary */
825 list_for_each_entry(dev, &bus->devices, bus_list) {
826 pci_read_irq_line(dev);
827 if (ppc_md.pci_irq_fixup)
828 ppc_md.pci_irq_fixup(dev);
829 } 750 }
830} 751}
831 752
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 6d1c28fc5e23..b9619b9e5e02 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -41,9 +41,6 @@
41 41
42unsigned long pci_probe_only = 1; 42unsigned long pci_probe_only = 1;
43 43
44static void fixup_resource(struct resource *res, struct pci_dev *dev);
45static void do_bus_setup(struct pci_bus *bus);
46
47/* pci_io_base -- the base address from which io bars are offsets. 44/* pci_io_base -- the base address from which io bars are offsets.
48 * This is the lowest I/O base address (so bar values are always positive), 45 * This is the lowest I/O base address (so bar values are always positive),
49 * and it *must* be the start of ISA space if an ISA bus exists because 46 * and it *must* be the start of ISA space if an ISA bus exists because
@@ -239,7 +236,6 @@ static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev)
239 res->end = base + size - 1; 236 res->end = base + size - 1;
240 res->flags = flags; 237 res->flags = flags;
241 res->name = pci_name(dev); 238 res->name = pci_name(dev);
242 fixup_resource(res, dev);
243 } 239 }
244} 240}
245 241
@@ -308,7 +304,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
308EXPORT_SYMBOL(of_create_pci_dev); 304EXPORT_SYMBOL(of_create_pci_dev);
309 305
310void __devinit of_scan_bus(struct device_node *node, 306void __devinit of_scan_bus(struct device_node *node,
311 struct pci_bus *bus) 307 struct pci_bus *bus)
312{ 308{
313 struct device_node *child = NULL; 309 struct device_node *child = NULL;
314 const u32 *reg; 310 const u32 *reg;
@@ -317,6 +313,7 @@ void __devinit of_scan_bus(struct device_node *node,
317 313
318 DBG("of_scan_bus(%s) bus no %d... \n", node->full_name, bus->number); 314 DBG("of_scan_bus(%s) bus no %d... \n", node->full_name, bus->number);
319 315
316 /* Scan direct children */
320 while ((child = of_get_next_child(node, child)) != NULL) { 317 while ((child = of_get_next_child(node, child)) != NULL) {
321 DBG(" * %s\n", child->full_name); 318 DBG(" * %s\n", child->full_name);
322 reg = of_get_property(child, "reg", &reglen); 319 reg = of_get_property(child, "reg", &reglen);
@@ -328,19 +325,26 @@ void __devinit of_scan_bus(struct device_node *node,
328 dev = of_create_pci_dev(child, bus, devfn); 325 dev = of_create_pci_dev(child, bus, devfn);
329 if (!dev) 326 if (!dev)
330 continue; 327 continue;
331 DBG("dev header type: %x\n", dev->hdr_type); 328 DBG(" dev header type: %x\n", dev->hdr_type);
329 }
330
331 /* Ally all fixups */
332 pcibios_fixup_of_probed_bus(bus);
332 333
334 /* Now scan child busses */
335 list_for_each_entry(dev, &bus->devices, bus_list) {
333 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || 336 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
334 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) 337 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
335 of_scan_pci_bridge(child, dev); 338 struct device_node *child = pci_device_to_OF_node(dev);
339 if (dev)
340 of_scan_pci_bridge(child, dev);
341 }
336 } 342 }
337
338 do_bus_setup(bus);
339} 343}
340EXPORT_SYMBOL(of_scan_bus); 344EXPORT_SYMBOL(of_scan_bus);
341 345
342void __devinit of_scan_pci_bridge(struct device_node *node, 346void __devinit of_scan_pci_bridge(struct device_node *node,
343 struct pci_dev *dev) 347 struct pci_dev *dev)
344{ 348{
345 struct pci_bus *bus; 349 struct pci_bus *bus;
346 const u32 *busrange, *ranges; 350 const u32 *busrange, *ranges;
@@ -410,7 +414,6 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
410 res->start = of_read_number(&ranges[1], 2); 414 res->start = of_read_number(&ranges[1], 2);
411 res->end = res->start + size - 1; 415 res->end = res->start + size - 1;
412 res->flags = flags; 416 res->flags = flags;
413 fixup_resource(res, dev);
414 } 417 }
415 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), 418 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
416 bus->number); 419 bus->number);
@@ -659,51 +662,13 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
659} 662}
660EXPORT_SYMBOL_GPL(pcibios_map_io_space); 663EXPORT_SYMBOL_GPL(pcibios_map_io_space);
661 664
662static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev)
663{
664 struct pci_controller *hose = pci_bus_to_host(dev->bus);
665 unsigned long offset;
666
667 if (res->flags & IORESOURCE_IO) {
668 offset = (unsigned long)hose->io_base_virt - _IO_BASE;
669 res->start += offset;
670 res->end += offset;
671 } else if (res->flags & IORESOURCE_MEM) {
672 res->start += hose->pci_mem_offset;
673 res->end += hose->pci_mem_offset;
674 }
675}
676
677void __devinit pcibios_fixup_device_resources(struct pci_dev *dev,
678 struct pci_bus *bus)
679{
680 /* Update device resources. */
681 int i;
682
683 DBG("%s: Fixup resources:\n", pci_name(dev));
684 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
685 struct resource *res = &dev->resource[i];
686 if (!res->flags)
687 continue;
688
689 DBG(" 0x%02x < %08lx:0x%016lx...0x%016lx\n",
690 i, res->flags, res->start, res->end);
691
692 fixup_resource(res, dev);
693
694 DBG(" > %08lx:0x%016lx...0x%016lx\n",
695 res->flags, res->start, res->end);
696 }
697}
698EXPORT_SYMBOL(pcibios_fixup_device_resources);
699
700void __devinit pcibios_setup_new_device(struct pci_dev *dev) 665void __devinit pcibios_setup_new_device(struct pci_dev *dev)
701{ 666{
702 struct dev_archdata *sd = &dev->dev.archdata; 667 struct dev_archdata *sd = &dev->dev.archdata;
703 668
704 sd->of_node = pci_device_to_OF_node(dev); 669 sd->of_node = pci_device_to_OF_node(dev);
705 670
706 DBG("PCI device %s OF node: %s\n", pci_name(dev), 671 DBG("PCI: device %s OF node: %s\n", pci_name(dev),
707 sd->of_node ? sd->of_node->full_name : "<none>"); 672 sd->of_node ? sd->of_node->full_name : "<none>");
708 673
709 sd->dma_ops = pci_dma_ops; 674 sd->dma_ops = pci_dma_ops;
@@ -717,7 +682,7 @@ void __devinit pcibios_setup_new_device(struct pci_dev *dev)
717} 682}
718EXPORT_SYMBOL(pcibios_setup_new_device); 683EXPORT_SYMBOL(pcibios_setup_new_device);
719 684
720static void __devinit do_bus_setup(struct pci_bus *bus) 685void __devinit pcibios_do_bus_setup(struct pci_bus *bus)
721{ 686{
722 struct pci_dev *dev; 687 struct pci_dev *dev;
723 688
@@ -726,42 +691,7 @@ static void __devinit do_bus_setup(struct pci_bus *bus)
726 691
727 list_for_each_entry(dev, &bus->devices, bus_list) 692 list_for_each_entry(dev, &bus->devices, bus_list)
728 pcibios_setup_new_device(dev); 693 pcibios_setup_new_device(dev);
729
730 /* Read default IRQs and fixup if necessary */
731 list_for_each_entry(dev, &bus->devices, bus_list) {
732 pci_read_irq_line(dev);
733 if (ppc_md.pci_irq_fixup)
734 ppc_md.pci_irq_fixup(dev);
735 }
736}
737
738void __devinit pcibios_fixup_bus(struct pci_bus *bus)
739{
740 struct pci_dev *dev = bus->self;
741 struct device_node *np;
742
743 np = pci_bus_to_OF_node(bus);
744
745 DBG("pcibios_fixup_bus(%s)\n", np ? np->full_name : "<???>");
746
747 if (dev && pci_probe_only &&
748 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
749 /* This is a subordinate bridge */
750
751 pci_read_bridge_bases(bus);
752 pcibios_fixup_device_resources(dev, bus);
753 }
754
755 do_bus_setup(bus);
756
757 if (!pci_probe_only)
758 return;
759
760 list_for_each_entry(dev, &bus->devices, bus_list)
761 if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
762 pcibios_fixup_device_resources(dev, bus);
763} 694}
764EXPORT_SYMBOL(pcibios_fixup_bus);
765 695
766unsigned long pci_address_to_pio(phys_addr_t address) 696unsigned long pci_address_to_pio(phys_addr_t address)
767{ 697{
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index 47f0e0857f0e..5a5a19e40bb4 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -83,7 +83,7 @@ EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices);
83 83
84/* Must be called before pci_bus_add_devices */ 84/* Must be called before pci_bus_add_devices */
85void 85void
86pcibios_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus) 86pcibios_fixup_new_pci_devices(struct pci_bus *bus)
87{ 87{
88 struct pci_dev *dev; 88 struct pci_dev *dev;
89 89
@@ -98,8 +98,6 @@ pcibios_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus)
98 /* Fill device archdata and setup iommu table */ 98 /* Fill device archdata and setup iommu table */
99 pcibios_setup_new_device(dev); 99 pcibios_setup_new_device(dev);
100 100
101 if(fix_bus)
102 pcibios_fixup_device_resources(dev, bus);
103 pci_read_irq_line(dev); 101 pci_read_irq_line(dev);
104 for (i = 0; i < PCI_NUM_RESOURCES; i++) { 102 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
105 struct resource *r = &dev->resource[i]; 103 struct resource *r = &dev->resource[i];
@@ -132,8 +130,8 @@ pcibios_pci_config_bridge(struct pci_dev *dev)
132 130
133 pci_scan_child_bus(child_bus); 131 pci_scan_child_bus(child_bus);
134 132
135 /* Fixup new pci devices without touching bus struct */ 133 /* Fixup new pci devices */
136 pcibios_fixup_new_pci_devices(child_bus, 0); 134 pcibios_fixup_new_pci_devices(child_bus);
137 135
138 /* Make the discovered devices available */ 136 /* Make the discovered devices available */
139 pci_bus_add_devices(child_bus); 137 pci_bus_add_devices(child_bus);
@@ -169,7 +167,7 @@ pcibios_add_pci_devices(struct pci_bus * bus)
169 /* use ofdt-based probe */ 167 /* use ofdt-based probe */
170 of_scan_bus(dn, bus); 168 of_scan_bus(dn, bus);
171 if (!list_empty(&bus->devices)) { 169 if (!list_empty(&bus->devices)) {
172 pcibios_fixup_new_pci_devices(bus, 0); 170 pcibios_fixup_new_pci_devices(bus);
173 pci_bus_add_devices(bus); 171 pci_bus_add_devices(bus);
174 eeh_add_device_tree_late(bus); 172 eeh_add_device_tree_late(bus);
175 } 173 }
@@ -178,7 +176,7 @@ pcibios_add_pci_devices(struct pci_bus * bus)
178 slotno = PCI_SLOT(PCI_DN(dn->child)->devfn); 176 slotno = PCI_SLOT(PCI_DN(dn->child)->devfn);
179 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); 177 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
180 if (num) { 178 if (num) {
181 pcibios_fixup_new_pci_devices(bus, 1); 179 pcibios_fixup_new_pci_devices(bus);
182 pci_bus_add_devices(bus); 180 pci_bus_add_devices(bus);
183 eeh_add_device_tree_late(bus); 181 eeh_add_device_tree_late(bus);
184 } 182 }
@@ -208,7 +206,7 @@ struct pci_controller * __devinit init_phb_dynamic(struct device_node *dn)
208 eeh_add_device_tree_early(dn); 206 eeh_add_device_tree_early(dn);
209 207
210 scan_phb(phb); 208 scan_phb(phb);
211 pcibios_fixup_new_pci_devices(phb->bus, 0); 209 pcibios_fixup_new_pci_devices(phb->bus);
212 pci_bus_add_devices(phb->bus); 210 pci_bus_add_devices(phb->bus);
213 eeh_add_device_tree_late(phb->bus); 211 eeh_add_device_tree_late(phb->bus);
214 212
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
index b169b0e2647f..191954bc8e5b 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -155,7 +155,7 @@ static void dlpar_pci_add_bus(struct device_node *dn)
155 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) 155 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
156 of_scan_pci_bridge(dn, dev); 156 of_scan_pci_bridge(dn, dev);
157 157
158 pcibios_fixup_new_pci_devices(dev->subordinate,0); 158 pcibios_fixup_new_pci_devices(dev->subordinate);
159 159
160 /* Claim new bus resources */ 160 /* Claim new bus resources */
161 pcibios_claim_one_bus(dev->bus); 161 pcibios_claim_one_bus(dev->bus);
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index d5cd98214fab..ed9103148690 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -205,13 +205,6 @@ struct machdep_calls {
205 * optional PCI "hooks" 205 * optional PCI "hooks"
206 */ 206 */
207 207
208 /* Called after PPC generic resource fixup to perform
209 machine specific fixups */
210 void (*pcibios_fixup_resources)(struct pci_dev *);
211
212 /* Called for each PCI bus in the system when it's probed */
213 void (*pcibios_fixup_bus)(struct pci_bus *);
214
215 /* Called when pci_enable_device() is called (initial=0) or 208 /* Called when pci_enable_device() is called (initial=0) or
216 * when a device with no assigned resource is found (initial=1). 209 * when a device with no assigned resource is found (initial=1).
217 * Returns 0 to allow assignment/enabling of the device. */ 210 * Returns 0 to allow assignment/enabling of the device. */
@@ -225,6 +218,13 @@ struct machdep_calls {
225 218
226#endif /* CONFIG_PPC32 */ 219#endif /* CONFIG_PPC32 */
227 220
221 /* Called after PPC generic resource fixup to perform
222 machine specific fixups */
223 void (*pcibios_fixup_resources)(struct pci_dev *);
224
225 /* Called for each PCI bus in the system when it's probed */
226 void (*pcibios_fixup_bus)(struct pci_bus *);
227
228 /* Called to shutdown machine specific hardware not already controlled 228 /* Called to shutdown machine specific hardware not already controlled
229 * by other drivers. 229 * by other drivers.
230 */ 230 */
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index fed8f52071f1..4aeef7f3d766 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -235,7 +235,7 @@ extern void pcibios_remove_pci_devices(struct pci_bus *bus);
235 235
236/** Discover new pci devices under this bus, and add them */ 236/** Discover new pci devices under this bus, and add them */
237extern void pcibios_add_pci_devices(struct pci_bus *bus); 237extern void pcibios_add_pci_devices(struct pci_bus *bus);
238extern void pcibios_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus); 238extern void pcibios_fixup_new_pci_devices(struct pci_bus *bus);
239 239
240extern int pcibios_remove_root_bus(struct pci_controller *phb); 240extern int pcibios_remove_root_bus(struct pci_controller *phb);
241 241
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h
index 2883f566709d..9899d893c162 100644
--- a/include/asm-powerpc/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -196,9 +196,6 @@ static inline struct resource *pcibios_select_root(struct pci_dev *pdev,
196 return root; 196 return root;
197} 197}
198 198
199extern void pcibios_fixup_device_resources(struct pci_dev *dev,
200 struct pci_bus *bus);
201
202extern void pcibios_setup_new_device(struct pci_dev *dev); 199extern void pcibios_setup_new_device(struct pci_dev *dev);
203 200
204extern void pcibios_claim_one_bus(struct pci_bus *b); 201extern void pcibios_claim_one_bus(struct pci_bus *b);
@@ -226,5 +223,8 @@ extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
226 const struct resource *rsrc, 223 const struct resource *rsrc,
227 resource_size_t *start, resource_size_t *end); 224 resource_size_t *start, resource_size_t *end);
228 225
226extern void pcibios_do_bus_setup(struct pci_bus *bus);
227extern void pcibios_fixup_of_probed_bus(struct pci_bus *bus);
228
229#endif /* __KERNEL__ */ 229#endif /* __KERNEL__ */
230#endif /* __ASM_POWERPC_PCI_H */ 230#endif /* __ASM_POWERPC_PCI_H */