aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2012-02-23 22:19:04 -0500
committerBjorn Helgaas <bhelgaas@google.com>2012-02-23 22:19:04 -0500
commitfb127cb9de791d62fb393d6e65fa9869bddd2460 (patch)
tree5cb45ac2fd5139cfc9165fead210a3ad2bb3b2a5 /drivers/pci/probe.c
parent4ba2aef3157f483fd67ac2616f14dbc32a3f751d (diff)
PCI: collapse pcibios_resource_to_bus
Everybody uses the generic pcibios_resource_to_bus() supplied by the core now, so remove the ARCH_HAS_GENERIC_PCI_OFFSETS used during conversion. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c44
1 files changed, 15 insertions, 29 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index a677b1e995de..36c22032ea14 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -66,8 +66,8 @@ static bool resource_contains(struct resource *res1, struct resource *res2)
66 return res1->start <= res2->start && res1->end >= res2->end; 66 return res1->start <= res2->start && res1->end >= res2->end;
67} 67}
68 68
69void pci_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 69void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
70 struct resource *res) 70 struct resource *res)
71{ 71{
72 struct pci_host_bridge *bridge = pci_host_bridge(dev); 72 struct pci_host_bridge *bridge = pci_host_bridge(dev);
73 struct pci_host_bridge_window *window; 73 struct pci_host_bridge_window *window;
@@ -86,6 +86,7 @@ void pci_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
86 region->start = res->start - offset; 86 region->start = res->start - offset;
87 region->end = res->end - offset; 87 region->end = res->end - offset;
88} 88}
89EXPORT_SYMBOL(pcibios_resource_to_bus);
89 90
90static bool region_contains(struct pci_bus_region *region1, 91static bool region_contains(struct pci_bus_region *region1,
91 struct pci_bus_region *region2) 92 struct pci_bus_region *region2)
@@ -93,8 +94,8 @@ static bool region_contains(struct pci_bus_region *region1,
93 return region1->start <= region2->start && region1->end >= region2->end; 94 return region1->start <= region2->start && region1->end >= region2->end;
94} 95}
95 96
96void pci_bus_to_resource(struct pci_dev *dev, struct resource *res, 97void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
97 struct pci_bus_region *region) 98 struct pci_bus_region *region)
98{ 99{
99 struct pci_host_bridge *bridge = pci_host_bridge(dev); 100 struct pci_host_bridge *bridge = pci_host_bridge(dev);
100 struct pci_host_bridge_window *window; 101 struct pci_host_bridge_window *window;
@@ -117,22 +118,7 @@ void pci_bus_to_resource(struct pci_dev *dev, struct resource *res,
117 res->start = region->start + offset; 118 res->start = region->start + offset;
118 res->end = region->end + offset; 119 res->end = region->end + offset;
119} 120}
120
121#ifdef ARCH_HAS_GENERIC_PCI_OFFSETS
122void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
123 struct resource *res)
124{
125 pci_resource_to_bus(dev, region, res);
126}
127EXPORT_SYMBOL(pcibios_resource_to_bus);
128
129void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
130 struct pci_bus_region *region)
131{
132 pci_bus_to_resource(dev, res, region);
133}
134EXPORT_SYMBOL(pcibios_bus_to_resource); 121EXPORT_SYMBOL(pcibios_bus_to_resource);
135#endif
136 122
137/* 123/*
138 * PCI Bus Class 124 * PCI Bus Class
@@ -309,11 +295,11 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
309 pci_write_config_dword(dev, pos + 4, 0); 295 pci_write_config_dword(dev, pos + 4, 0);
310 region.start = 0; 296 region.start = 0;
311 region.end = sz64; 297 region.end = sz64;
312 pci_bus_to_resource(dev, res, &region); 298 pcibios_bus_to_resource(dev, res, &region);
313 } else { 299 } else {
314 region.start = l64; 300 region.start = l64;
315 region.end = l64 + sz64; 301 region.end = l64 + sz64;
316 pci_bus_to_resource(dev, res, &region); 302 pcibios_bus_to_resource(dev, res, &region);
317 dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pR\n", 303 dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pR\n",
318 pos, res); 304 pos, res);
319 } 305 }
@@ -325,7 +311,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
325 311
326 region.start = l; 312 region.start = l;
327 region.end = l + sz; 313 region.end = l + sz;
328 pci_bus_to_resource(dev, res, &region); 314 pcibios_bus_to_resource(dev, res, &region);
329 315
330 dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pR\n", pos, res); 316 dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pR\n", pos, res);
331 } 317 }
@@ -383,7 +369,7 @@ static void __devinit pci_read_bridge_io(struct pci_bus *child)
383 res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO; 369 res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO;
384 region.start = base; 370 region.start = base;
385 region.end = limit + 0xfff; 371 region.end = limit + 0xfff;
386 pci_bus_to_resource(dev, &res2, &region); 372 pcibios_bus_to_resource(dev, &res2, &region);
387 if (!res->start) 373 if (!res->start)
388 res->start = res2.start; 374 res->start = res2.start;
389 if (!res->end) 375 if (!res->end)
@@ -409,7 +395,7 @@ static void __devinit pci_read_bridge_mmio(struct pci_bus *child)
409 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; 395 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
410 region.start = base; 396 region.start = base;
411 region.end = limit + 0xfffff; 397 region.end = limit + 0xfffff;
412 pci_bus_to_resource(dev, res, &region); 398 pcibios_bus_to_resource(dev, res, &region);
413 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); 399 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res);
414 } 400 }
415} 401}
@@ -458,7 +444,7 @@ static void __devinit pci_read_bridge_mmio_pref(struct pci_bus *child)
458 res->flags |= IORESOURCE_MEM_64; 444 res->flags |= IORESOURCE_MEM_64;
459 region.start = base; 445 region.start = base;
460 region.end = limit + 0xfffff; 446 region.end = limit + 0xfffff;
461 pci_bus_to_resource(dev, res, &region); 447 pcibios_bus_to_resource(dev, res, &region);
462 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); 448 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res);
463 } 449 }
464} 450}
@@ -1071,24 +1057,24 @@ int pci_setup_device(struct pci_dev *dev)
1071 region.end = 0x1F7; 1057 region.end = 0x1F7;
1072 res = &dev->resource[0]; 1058 res = &dev->resource[0];
1073 res->flags = LEGACY_IO_RESOURCE; 1059 res->flags = LEGACY_IO_RESOURCE;
1074 pci_bus_to_resource(dev, res, &region); 1060 pcibios_bus_to_resource(dev, res, &region);
1075 region.start = 0x3F6; 1061 region.start = 0x3F6;
1076 region.end = 0x3F6; 1062 region.end = 0x3F6;
1077 res = &dev->resource[1]; 1063 res = &dev->resource[1];
1078 res->flags = LEGACY_IO_RESOURCE; 1064 res->flags = LEGACY_IO_RESOURCE;
1079 pci_bus_to_resource(dev, res, &region); 1065 pcibios_bus_to_resource(dev, res, &region);
1080 } 1066 }
1081 if ((progif & 4) == 0) { 1067 if ((progif & 4) == 0) {
1082 region.start = 0x170; 1068 region.start = 0x170;
1083 region.end = 0x177; 1069 region.end = 0x177;
1084 res = &dev->resource[2]; 1070 res = &dev->resource[2];
1085 res->flags = LEGACY_IO_RESOURCE; 1071 res->flags = LEGACY_IO_RESOURCE;
1086 pci_bus_to_resource(dev, res, &region); 1072 pcibios_bus_to_resource(dev, res, &region);
1087 region.start = 0x376; 1073 region.start = 0x376;
1088 region.end = 0x376; 1074 region.end = 0x376;
1089 res = &dev->resource[3]; 1075 res = &dev->resource[3];
1090 res->flags = LEGACY_IO_RESOURCE; 1076 res->flags = LEGACY_IO_RESOURCE;
1091 pci_bus_to_resource(dev, res, &region); 1077 pcibios_bus_to_resource(dev, res, &region);
1092 } 1078 }
1093 } 1079 }
1094 break; 1080 break;