aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-03-04 13:57:01 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-21 00:47:04 -0400
commitb81d988c04cacb1f7ffb76cbff2d150eb9f02948 (patch)
treeade4c270f2479c53d7bd8d35bdda050caaa82cc8 /arch
parent842de40d93e00a5c40a1a7f520a6fbe422994e99 (diff)
PCI: x86: use generic pci_enable_resources()
Use the generic pci_enable_resources() instead of the arch-specific code. Unlike this arch-specific code, the generic version: - checks for resource collisions with "!r->parent" Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/pci/common.c2
-rw-r--r--arch/x86/pci/i386.c38
-rw-r--r--arch/x86/pci/pci.h1
3 files changed, 1 insertions, 40 deletions
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 900e1a78c3e4..75fcc29ecf52 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -466,7 +466,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
466{ 466{
467 int err; 467 int err;
468 468
469 if ((err = pcibios_enable_resources(dev, mask)) < 0) 469 if ((err = pci_enable_resources(dev, mask)) < 0)
470 return err; 470 return err;
471 471
472 if (!dev->msi_enabled) 472 if (!dev->msi_enabled)
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 2ead72363077..94f6c73a53d0 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -241,44 +241,6 @@ void __init pcibios_resource_survey(void)
241 */ 241 */
242fs_initcall(pcibios_assign_resources); 242fs_initcall(pcibios_assign_resources);
243 243
244int pcibios_enable_resources(struct pci_dev *dev, int mask)
245{
246 u16 cmd, old_cmd;
247 int idx;
248 struct resource *r;
249
250 pci_read_config_word(dev, PCI_COMMAND, &cmd);
251 old_cmd = cmd;
252 for (idx = 0; idx < PCI_NUM_RESOURCES; idx++) {
253 /* Only set up the requested stuff */
254 if (!(mask & (1 << idx)))
255 continue;
256
257 r = &dev->resource[idx];
258 if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
259 continue;
260 if ((idx == PCI_ROM_RESOURCE) &&
261 (!(r->flags & IORESOURCE_ROM_ENABLE)))
262 continue;
263 if (!r->start && r->end) {
264 printk(KERN_ERR "PCI: Device %s not available "
265 "because of resource %d collisions\n",
266 pci_name(dev), idx);
267 return -EINVAL;
268 }
269 if (r->flags & IORESOURCE_IO)
270 cmd |= PCI_COMMAND_IO;
271 if (r->flags & IORESOURCE_MEM)
272 cmd |= PCI_COMMAND_MEMORY;
273 }
274 if (cmd != old_cmd) {
275 printk("PCI: Enabling device %s (%04x -> %04x)\n",
276 pci_name(dev), old_cmd, cmd);
277 pci_write_config_word(dev, PCI_COMMAND, cmd);
278 }
279 return 0;
280}
281
282/* 244/*
283 * If we set up a device for bus mastering, we need to check the latency 245 * If we set up a device for bus mastering, we need to check the latency
284 * timer as certain crappy BIOSes forget to set it properly. 246 * timer as certain crappy BIOSes forget to set it properly.
diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h
index 02b016a98423..c4bddaeff619 100644
--- a/arch/x86/pci/pci.h
+++ b/arch/x86/pci/pci.h
@@ -42,7 +42,6 @@ enum pci_bf_sort_state {
42extern unsigned int pcibios_max_latency; 42extern unsigned int pcibios_max_latency;
43 43
44void pcibios_resource_survey(void); 44void pcibios_resource_survey(void);
45int pcibios_enable_resources(struct pci_dev *, int);
46 45
47/* pci-pc.c */ 46/* pci-pc.c */
48 47