diff options
Diffstat (limited to 'arch/sh/drivers/pci/pci.c')
-rw-r--r-- | arch/sh/drivers/pci/pci.c | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c index 1e9598d2bbf4..60ee09a4e121 100644 --- a/arch/sh/drivers/pci/pci.c +++ b/arch/sh/drivers/pci/pci.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/dma-debug.h> | 19 | #include <linux/dma-debug.h> |
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/mutex.h> | 21 | #include <linux/mutex.h> |
22 | #include <linux/spinlock.h> | ||
22 | 23 | ||
23 | unsigned long PCIBIOS_MIN_IO = 0x0000; | 24 | unsigned long PCIBIOS_MIN_IO = 0x0000; |
24 | unsigned long PCIBIOS_MIN_MEM = 0; | 25 | unsigned long PCIBIOS_MIN_MEM = 0; |
@@ -56,6 +57,11 @@ static void __devinit pcibios_scanbus(struct pci_channel *hose) | |||
56 | } | 57 | } |
57 | } | 58 | } |
58 | 59 | ||
60 | /* | ||
61 | * This interrupt-safe spinlock protects all accesses to PCI | ||
62 | * configuration space. | ||
63 | */ | ||
64 | DEFINE_RAW_SPINLOCK(pci_config_lock); | ||
59 | static DEFINE_MUTEX(pci_scan_mutex); | 65 | static DEFINE_MUTEX(pci_scan_mutex); |
60 | 66 | ||
61 | int __devinit register_pci_controller(struct pci_channel *hose) | 67 | int __devinit register_pci_controller(struct pci_channel *hose) |
@@ -233,40 +239,7 @@ void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | |||
233 | 239 | ||
234 | int pcibios_enable_device(struct pci_dev *dev, int mask) | 240 | int pcibios_enable_device(struct pci_dev *dev, int mask) |
235 | { | 241 | { |
236 | u16 cmd, old_cmd; | 242 | return pci_enable_resources(dev, mask); |
237 | int idx; | ||
238 | struct resource *r; | ||
239 | |||
240 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | ||
241 | old_cmd = cmd; | ||
242 | for (idx=0; idx < PCI_NUM_RESOURCES; idx++) { | ||
243 | /* Only set up the requested stuff */ | ||
244 | if (!(mask & (1<<idx))) | ||
245 | continue; | ||
246 | |||
247 | r = &dev->resource[idx]; | ||
248 | if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM))) | ||
249 | continue; | ||
250 | if ((idx == PCI_ROM_RESOURCE) && | ||
251 | (!(r->flags & IORESOURCE_ROM_ENABLE))) | ||
252 | continue; | ||
253 | if (!r->start && r->end) { | ||
254 | printk(KERN_ERR "PCI: Device %s not available " | ||
255 | "because of resource collisions\n", | ||
256 | pci_name(dev)); | ||
257 | return -EINVAL; | ||
258 | } | ||
259 | if (r->flags & IORESOURCE_IO) | ||
260 | cmd |= PCI_COMMAND_IO; | ||
261 | if (r->flags & IORESOURCE_MEM) | ||
262 | cmd |= PCI_COMMAND_MEMORY; | ||
263 | } | ||
264 | if (cmd != old_cmd) { | ||
265 | printk("PCI: Enabling device %s (%04x -> %04x)\n", | ||
266 | pci_name(dev), old_cmd, cmd); | ||
267 | pci_write_config_word(dev, PCI_COMMAND, cmd); | ||
268 | } | ||
269 | return 0; | ||
270 | } | 243 | } |
271 | 244 | ||
272 | /* | 245 | /* |
@@ -295,7 +268,7 @@ void __init pcibios_update_irq(struct pci_dev *dev, int irq) | |||
295 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); | 268 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); |
296 | } | 269 | } |
297 | 270 | ||
298 | char * __devinit pcibios_setup(char *str) | 271 | char * __devinit __weak pcibios_setup(char *str) |
299 | { | 272 | { |
300 | return str; | 273 | return str; |
301 | } | 274 | } |