aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/pci-common.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-10-27 15:48:56 -0400
committerPaul Mackerras <paulus@samba.org>2008-11-05 17:41:52 -0500
commit7eef440a545c7f812ed10b49d4a10a351df9cad6 (patch)
treecc4d2af150f2f5c44547a711733ed0fbabe11487 /arch/powerpc/kernel/pci-common.c
parentfd6852c8fa060bd45c82a2593e18f933f6c6204f (diff)
powerpc/pci: Cosmetic cleanups of pci-common.c
This does a few cosmetic cleanups, moving a couple of things around but without actually changing what the code does. (There is a minor change in ordering of operations in pcibios_setup_bus_devices but it should have no impact). Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/pci-common.c')
-rw-r--r--arch/powerpc/kernel/pci-common.c77
1 files changed, 36 insertions, 41 deletions
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index f3fd7eb90a7b..91c3f52e33a8 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -203,25 +203,6 @@ char __devinit *pcibios_setup(char *str)
203 return str; 203 return str;
204} 204}
205 205
206static void __devinit pcibios_setup_new_device(struct pci_dev *dev)
207{
208 struct dev_archdata *sd = &dev->dev.archdata;
209
210 sd->of_node = pci_device_to_OF_node(dev);
211
212 pr_debug("PCI: device %s OF node: %s\n", pci_name(dev),
213 sd->of_node ? sd->of_node->full_name : "<none>");
214
215 sd->dma_ops = pci_dma_ops;
216#ifdef CONFIG_PPC32
217 sd->dma_data = (void *)PCI_DRAM_OFFSET;
218#endif
219 set_dev_node(&dev->dev, pcibus_to_node(dev->bus));
220
221 if (ppc_md.pci_dma_dev_setup)
222 ppc_md.pci_dma_dev_setup(dev);
223}
224
225/* 206/*
226 * Reads the interrupt pin to determine if interrupt is use by card. 207 * Reads the interrupt pin to determine if interrupt is use by card.
227 * If the interrupt is used, then gets the interrupt line from the 208 * If the interrupt is used, then gets the interrupt line from the
@@ -1074,33 +1055,14 @@ static void __devinit pcibios_fixup_bridge(struct pci_bus *bus)
1074 } 1055 }
1075} 1056}
1076 1057
1077void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
1078{
1079 struct pci_dev *dev;
1080
1081 pr_debug("PCI: Fixup bus %d (%s)\n",
1082 bus->number, bus->self ? pci_name(bus->self) : "PHB");
1083
1084 /* Setup DMA for all PCI devices on that bus */
1085 list_for_each_entry(dev, &bus->devices, bus_list)
1086 pcibios_setup_new_device(dev);
1087
1088 /* Read default IRQs and fixup if necessary */
1089 list_for_each_entry(dev, &bus->devices, bus_list) {
1090 pci_read_irq_line(dev);
1091 if (ppc_md.pci_irq_fixup)
1092 ppc_md.pci_irq_fixup(dev);
1093 }
1094}
1095
1096void __devinit pcibios_setup_bus_self(struct pci_bus *bus) 1058void __devinit pcibios_setup_bus_self(struct pci_bus *bus)
1097{ 1059{
1098 /* Fix up the bus resources */ 1060 /* Fix up the bus resources for P2P bridges */
1099 if (bus->self != NULL) 1061 if (bus->self != NULL)
1100 pcibios_fixup_bridge(bus); 1062 pcibios_fixup_bridge(bus);
1101 1063
1102 /* Platform specific bus fixups. This is currently only used 1064 /* Platform specific bus fixups. This is currently only used
1103 * by fsl_pci and I'm hoping getting rid of it at some point 1065 * by fsl_pci and I'm hoping to get rid of it at some point
1104 */ 1066 */
1105 if (ppc_md.pcibios_fixup_bus) 1067 if (ppc_md.pcibios_fixup_bus)
1106 ppc_md.pcibios_fixup_bus(bus); 1068 ppc_md.pcibios_fixup_bus(bus);
@@ -1110,10 +1072,43 @@ void __devinit pcibios_setup_bus_self(struct pci_bus *bus)
1110 ppc_md.pci_dma_bus_setup(bus); 1072 ppc_md.pci_dma_bus_setup(bus);
1111} 1073}
1112 1074
1075void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
1076{
1077 struct pci_dev *dev;
1078
1079 pr_debug("PCI: Fixup bus devices %d (%s)\n",
1080 bus->number, bus->self ? pci_name(bus->self) : "PHB");
1081
1082 list_for_each_entry(dev, &bus->devices, bus_list) {
1083 struct dev_archdata *sd = &dev->dev.archdata;
1084
1085 /* Setup OF node pointer in archdata */
1086 sd->of_node = pci_device_to_OF_node(dev);
1087
1088 /* Fixup NUMA node as it may not be setup yet by the generic
1089 * code and is needed by the DMA init
1090 */
1091 set_dev_node(&dev->dev, pcibus_to_node(dev->bus));
1092
1093 /* Hook up default DMA ops */
1094 sd->dma_ops = pci_dma_ops;
1095 sd->dma_data = (void *)PCI_DRAM_OFFSET;
1096
1097 /* Additional platform DMA/iommu setup */
1098 if (ppc_md.pci_dma_dev_setup)
1099 ppc_md.pci_dma_dev_setup(dev);
1100
1101 /* Read default IRQs and fixup if necessary */
1102 pci_read_irq_line(dev);
1103 if (ppc_md.pci_irq_fixup)
1104 ppc_md.pci_irq_fixup(dev);
1105 }
1106}
1107
1113void __devinit pcibios_fixup_bus(struct pci_bus *bus) 1108void __devinit pcibios_fixup_bus(struct pci_bus *bus)
1114{ 1109{
1115 /* When called from the generic PCI probe, read PCI<->PCI bridge 1110 /* When called from the generic PCI probe, read PCI<->PCI bridge
1116 * bases. This isn't called when generating the PCI tree from 1111 * bases. This is -not- called when generating the PCI tree from
1117 * the OF device-tree. 1112 * the OF device-tree.
1118 */ 1113 */
1119 if (bus->self != NULL) 1114 if (bus->self != NULL)