aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/pci-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/pci-common.c')
-rw-r--r--arch/powerpc/kernel/pci-common.c53
1 files changed, 24 insertions, 29 deletions
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index e8dfdbd9327a..0c0567e58409 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -26,6 +26,7 @@
26#include <linux/syscalls.h> 26#include <linux/syscalls.h>
27#include <linux/irq.h> 27#include <linux/irq.h>
28#include <linux/vmalloc.h> 28#include <linux/vmalloc.h>
29#include <linux/slab.h>
29 30
30#include <asm/processor.h> 31#include <asm/processor.h>
31#include <asm/io.h> 32#include <asm/io.h>
@@ -63,21 +64,6 @@ struct dma_map_ops *get_pci_dma_ops(void)
63} 64}
64EXPORT_SYMBOL(get_pci_dma_ops); 65EXPORT_SYMBOL(get_pci_dma_ops);
65 66
66int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
67{
68 return dma_set_mask(&dev->dev, mask);
69}
70
71int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
72{
73 int rc;
74
75 rc = dma_set_mask(&dev->dev, mask);
76 dev->dev.coherent_dma_mask = dev->dma_mask;
77
78 return rc;
79}
80
81struct pci_controller *pcibios_alloc_controller(struct device_node *dev) 67struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
82{ 68{
83 struct pci_controller *phb; 69 struct pci_controller *phb;
@@ -1047,10 +1033,8 @@ static void __devinit pcibios_fixup_bridge(struct pci_bus *bus)
1047 1033
1048 struct pci_dev *dev = bus->self; 1034 struct pci_dev *dev = bus->self;
1049 1035
1050 for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) { 1036 pci_bus_for_each_resource(bus, res, i) {
1051 if ((res = bus->resource[i]) == NULL) 1037 if (!res || !res->flags)
1052 continue;
1053 if (!res->flags)
1054 continue; 1038 continue;
1055 if (i >= 3 && bus->self->transparent) 1039 if (i >= 3 && bus->self->transparent)
1056 continue; 1040 continue;
@@ -1107,6 +1091,12 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
1107 list_for_each_entry(dev, &bus->devices, bus_list) { 1091 list_for_each_entry(dev, &bus->devices, bus_list) {
1108 struct dev_archdata *sd = &dev->dev.archdata; 1092 struct dev_archdata *sd = &dev->dev.archdata;
1109 1093
1094 /* Cardbus can call us to add new devices to a bus, so ignore
1095 * those who are already fully discovered
1096 */
1097 if (dev->is_added)
1098 continue;
1099
1110 /* Setup OF node pointer in archdata */ 1100 /* Setup OF node pointer in archdata */
1111 sd->of_node = pci_device_to_OF_node(dev); 1101 sd->of_node = pci_device_to_OF_node(dev);
1112 1102
@@ -1147,6 +1137,13 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
1147} 1137}
1148EXPORT_SYMBOL(pcibios_fixup_bus); 1138EXPORT_SYMBOL(pcibios_fixup_bus);
1149 1139
1140void __devinit pci_fixup_cardbus(struct pci_bus *bus)
1141{
1142 /* Now fixup devices on that bus */
1143 pcibios_setup_bus_devices(bus);
1144}
1145
1146
1150static int skip_isa_ioresource_align(struct pci_dev *dev) 1147static int skip_isa_ioresource_align(struct pci_dev *dev)
1151{ 1148{
1152 if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) && 1149 if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) &&
@@ -1168,21 +1165,20 @@ static int skip_isa_ioresource_align(struct pci_dev *dev)
1168 * but we want to try to avoid allocating at 0x2900-0x2bff 1165 * but we want to try to avoid allocating at 0x2900-0x2bff
1169 * which might have be mirrored at 0x0100-0x03ff.. 1166 * which might have be mirrored at 0x0100-0x03ff..
1170 */ 1167 */
1171void pcibios_align_resource(void *data, struct resource *res, 1168resource_size_t pcibios_align_resource(void *data, const struct resource *res,
1172 resource_size_t size, resource_size_t align) 1169 resource_size_t size, resource_size_t align)
1173{ 1170{
1174 struct pci_dev *dev = data; 1171 struct pci_dev *dev = data;
1172 resource_size_t start = res->start;
1175 1173
1176 if (res->flags & IORESOURCE_IO) { 1174 if (res->flags & IORESOURCE_IO) {
1177 resource_size_t start = res->start;
1178
1179 if (skip_isa_ioresource_align(dev)) 1175 if (skip_isa_ioresource_align(dev))
1180 return; 1176 return start;
1181 if (start & 0x300) { 1177 if (start & 0x300)
1182 start = (start + 0x3ff) & ~0x3ff; 1178 start = (start + 0x3ff) & ~0x3ff;
1183 res->start = start;
1184 }
1185 } 1179 }
1180
1181 return start;
1186} 1182}
1187EXPORT_SYMBOL(pcibios_align_resource); 1183EXPORT_SYMBOL(pcibios_align_resource);
1188 1184
@@ -1265,9 +1261,8 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus)
1265 pr_debug("PCI: Allocating bus resources for %04x:%02x...\n", 1261 pr_debug("PCI: Allocating bus resources for %04x:%02x...\n",
1266 pci_domain_nr(bus), bus->number); 1262 pci_domain_nr(bus), bus->number);
1267 1263
1268 for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) { 1264 pci_bus_for_each_resource(bus, res, i) {
1269 if ((res = bus->resource[i]) == NULL || !res->flags 1265 if (!res || !res->flags || res->start > res->end || res->parent)
1270 || res->start > res->end || res->parent)
1271 continue; 1266 continue;
1272 if (bus->parent == NULL) 1267 if (bus->parent == NULL)
1273 pr = (res->flags & IORESOURCE_IO) ? 1268 pr = (res->flags & IORESOURCE_IO) ?