aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/kernel
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-03-04 13:56:55 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-21 00:47:06 -0400
commitc9e9e0bfc52ae93c246149c3b9d3a1e11677ca1a (patch)
tree77167d1e6dc8cd9659539f6130c219a9eed23aa7 /arch/parisc/kernel
parente789920d0497bb3d7eb146382b9ca8137662fabb (diff)
PCI: parisc: 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 PCI_NUM_RESOURCES (11), not DEVICE_COUNT_RESOURCE (12), resources - skips resources that have neither IORESOURCE_IO nor IORESOURCE_MEM set - skips ROM resources unless IORESOURCE_ROM_ENABLE is set - checks for resource collisions with "!r->parent" Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Acked-by: Kyle McMartin <kyle@mcmartin.ca> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch/parisc/kernel')
-rw-r--r--arch/parisc/kernel/pci.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/arch/parisc/kernel/pci.c b/arch/parisc/kernel/pci.c
index 507d0ac99f66..6936386c9861 100644
--- a/arch/parisc/kernel/pci.c
+++ b/arch/parisc/kernel/pci.c
@@ -287,23 +287,15 @@ void pcibios_align_resource(void *data, struct resource *res,
287 */ 287 */
288int pcibios_enable_device(struct pci_dev *dev, int mask) 288int pcibios_enable_device(struct pci_dev *dev, int mask)
289{ 289{
290 u16 cmd; 290 int err;
291 int idx; 291 u16 cmd, old_cmd;
292 292
293 pci_read_config_word(dev, PCI_COMMAND, &cmd); 293 err = pci_enable_resources(dev, mask);
294 294 if (err < 0)
295 for (idx = 0; idx < DEVICE_COUNT_RESOURCE; idx++) { 295 return err;
296 struct resource *r = &dev->resource[idx];
297 296
298 /* only setup requested resources */ 297 pci_read_config_word(dev, PCI_COMMAND, &cmd);
299 if (!(mask & (1<<idx))) 298 old_cmd = cmd;
300 continue;
301
302 if (r->flags & IORESOURCE_IO)
303 cmd |= PCI_COMMAND_IO;
304 if (r->flags & IORESOURCE_MEM)
305 cmd |= PCI_COMMAND_MEMORY;
306 }
307 299
308 cmd |= (PCI_COMMAND_SERR | PCI_COMMAND_PARITY); 300 cmd |= (PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
309 301
@@ -312,8 +304,12 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
312 if (dev->bus->bridge_ctl & PCI_BRIDGE_CTL_FAST_BACK) 304 if (dev->bus->bridge_ctl & PCI_BRIDGE_CTL_FAST_BACK)
313 cmd |= PCI_COMMAND_FAST_BACK; 305 cmd |= PCI_COMMAND_FAST_BACK;
314#endif 306#endif
315 DBGC("PCIBIOS: Enabling device %s cmd 0x%04x\n", pci_name(dev), cmd); 307
316 pci_write_config_word(dev, PCI_COMMAND, cmd); 308 if (cmd != old_cmd) {
309 dev_info(&dev->dev, "enabling SERR and PARITY (%04x -> %04x)\n",
310 old_cmd, cmd);
311 pci_write_config_word(dev, PCI_COMMAND, cmd);
312 }
317 return 0; 313 return 0;
318} 314}
319 315