aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:58:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:58:35 -0400
commitbda0c0afa7a694bb1459fd023515aca681e4d79a (patch)
treecd8b9d9811463de2065cbe79d59689082d6c53cf /arch
parent904e0ab54b7591b9cb01cfc0dbbedcc8bc0d949b (diff)
parentaf40b485ea2d957ae2f237ab0e33539ae8f29562 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/pci-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/pci-2.6: (42 commits) PCI: Change PCI subsystem MAINTAINER PCI: pci-iommu-iotlb-flushing-speedup PCI: pci_setup_bridge() mustn't be __devinit PCI: pci_bus_size_cardbus() mustn't be __devinit PCI: pci_scan_device() mustn't be __devinit PCI: pci_alloc_child_bus() mustn't be __devinit PCI: replace remaining __FUNCTION__ occurrences PCI: Hotplug: fakephp: Return success, not ENODEV, when bus rescan is triggered PCI: Hotplug: Fix leaks in IBM Hot Plug Controller Driver - ibmphp_init_devno() PCI: clean up resource alignment management PCI: aerdrv_acpi.c: remove unneeded NULL check PCI: Update VIA CX700 quirk PCI: Expose PCI VPD through sysfs PCI: iommu: iotlb flushing PCI: simplify quirk debug output PCI: iova RB tree setup tweak PCI: parisc: use generic pci_enable_resources() PCI: ppc: use generic pci_enable_resources() PCI: powerpc: use generic pci_enable_resources() PCI: ia64: use generic pci_enable_resources() ...
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/pci.c23
-rw-r--r--arch/frv/mb93090-mb00/pci-frv.h2
-rw-r--r--arch/frv/mb93090-mb00/pci-vdk.c53
-rw-r--r--arch/ia64/pci/pci.c44
-rw-r--r--arch/mn10300/unit-asb2305/pci-asb2305.h2
-rw-r--r--arch/parisc/kernel/pci.c30
-rw-r--r--arch/powerpc/kernel/pci-common.c34
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c7
-rw-r--r--arch/ppc/kernel/pci.c59
-rw-r--r--arch/sh/drivers/pci/pci-sh4.h2
-rw-r--r--arch/x86/kernel/pci-calgary_64.c3
-rw-r--r--arch/x86/pci/acpi.c11
-rw-r--r--arch/x86/pci/common.c63
-rw-r--r--arch/x86/pci/i386.c38
-rw-r--r--arch/x86/pci/pcbios.c72
-rw-r--r--arch/x86/pci/pci.h4
16 files changed, 27 insertions, 420 deletions
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 9dc1cee43265..c107cc08daf4 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -372,28 +372,7 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
372int 372int
373pcibios_enable_device(struct pci_dev *dev, int mask) 373pcibios_enable_device(struct pci_dev *dev, int mask)
374{ 374{
375 u16 cmd, oldcmd; 375 return pci_enable_resources(dev, mask);
376 int i;
377
378 pci_read_config_word(dev, PCI_COMMAND, &cmd);
379 oldcmd = cmd;
380
381 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
382 struct resource *res = &dev->resource[i];
383
384 if (res->flags & IORESOURCE_IO)
385 cmd |= PCI_COMMAND_IO;
386 else if (res->flags & IORESOURCE_MEM)
387 cmd |= PCI_COMMAND_MEMORY;
388 }
389
390 if (cmd != oldcmd) {
391 printk(KERN_DEBUG "PCI: Enabling device: (%s), cmd %x\n",
392 pci_name(dev), cmd);
393 /* Enable the appropriate bits in the PCI command register. */
394 pci_write_config_word(dev, PCI_COMMAND, cmd);
395 }
396 return 0;
397} 376}
398 377
399/* 378/*
diff --git a/arch/frv/mb93090-mb00/pci-frv.h b/arch/frv/mb93090-mb00/pci-frv.h
index 7481797ab382..0c7bf39dc729 100644
--- a/arch/frv/mb93090-mb00/pci-frv.h
+++ b/arch/frv/mb93090-mb00/pci-frv.h
@@ -17,8 +17,6 @@
17#define PCI_PROBE_BIOS 0x0001 17#define PCI_PROBE_BIOS 0x0001
18#define PCI_PROBE_CONF1 0x0002 18#define PCI_PROBE_CONF1 0x0002
19#define PCI_PROBE_CONF2 0x0004 19#define PCI_PROBE_CONF2 0x0004
20#define PCI_NO_SORT 0x0100
21#define PCI_BIOS_SORT 0x0200
22#define PCI_NO_CHECKS 0x0400 20#define PCI_NO_CHECKS 0x0400
23#define PCI_ASSIGN_ROMS 0x1000 21#define PCI_ASSIGN_ROMS 0x1000
24#define PCI_BIOS_IRQ_SCAN 0x2000 22#define PCI_BIOS_IRQ_SCAN 0x2000
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index 6d51f133fb23..f003cfa68b7a 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -199,58 +199,6 @@ static struct pci_ops * __init pci_check_direct(void)
199} 199}
200 200
201/* 201/*
202 * Several buggy motherboards address only 16 devices and mirror
203 * them to next 16 IDs. We try to detect this `feature' on all
204 * primary buses (those containing host bridges as they are
205 * expected to be unique) and remove the ghost devices.
206 */
207
208static void __init pcibios_fixup_ghosts(struct pci_bus *b)
209{
210 struct list_head *ln, *mn;
211 struct pci_dev *d, *e;
212 int mirror = PCI_DEVFN(16,0);
213 int seen_host_bridge = 0;
214 int i;
215
216 for (ln=b->devices.next; ln != &b->devices; ln=ln->next) {
217 d = pci_dev_b(ln);
218 if ((d->class >> 8) == PCI_CLASS_BRIDGE_HOST)
219 seen_host_bridge++;
220 for (mn=ln->next; mn != &b->devices; mn=mn->next) {
221 e = pci_dev_b(mn);
222 if (e->devfn != d->devfn + mirror ||
223 e->vendor != d->vendor ||
224 e->device != d->device ||
225 e->class != d->class)
226 continue;
227 for(i=0; i<PCI_NUM_RESOURCES; i++)
228 if (e->resource[i].start != d->resource[i].start ||
229 e->resource[i].end != d->resource[i].end ||
230 e->resource[i].flags != d->resource[i].flags)
231 continue;
232 break;
233 }
234 if (mn == &b->devices)
235 return;
236 }
237 if (!seen_host_bridge)
238 return;
239 printk("PCI: Ignoring ghost devices on bus %02x\n", b->number);
240
241 ln = &b->devices;
242 while (ln->next != &b->devices) {
243 d = pci_dev_b(ln->next);
244 if (d->devfn >= mirror) {
245 list_del(&d->global_list);
246 list_del(&d->bus_list);
247 kfree(d);
248 } else
249 ln = ln->next;
250 }
251}
252
253/*
254 * Discover remaining PCI buses in case there are peer host bridges. 202 * Discover remaining PCI buses in case there are peer host bridges.
255 * We use the number of last PCI bus provided by the PCI BIOS. 203 * We use the number of last PCI bus provided by the PCI BIOS.
256 */ 204 */
@@ -356,7 +304,6 @@ void __init pcibios_fixup_bus(struct pci_bus *bus)
356#if 0 304#if 0
357 printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number); 305 printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number);
358#endif 306#endif
359 pcibios_fixup_ghosts(bus);
360 pci_read_bridge_bases(bus); 307 pci_read_bridge_bases(bus);
361 308
362 if (bus->number == 0) { 309 if (bus->number == 0) {
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 53d0a8ee35d7..77b15f80f101 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -504,54 +504,12 @@ pcibios_update_irq (struct pci_dev *dev, int irq)
504 /* ??? FIXME -- record old value for shutdown. */ 504 /* ??? FIXME -- record old value for shutdown. */
505} 505}
506 506
507static inline int
508pcibios_enable_resources (struct pci_dev *dev, int mask)
509{
510 u16 cmd, old_cmd;
511 int idx;
512 struct resource *r;
513 unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM;
514
515 if (!dev)
516 return -EINVAL;
517
518 pci_read_config_word(dev, PCI_COMMAND, &cmd);
519 old_cmd = cmd;
520 for (idx=0; idx<PCI_NUM_RESOURCES; idx++) {
521 /* Only set up the desired resources. */
522 if (!(mask & (1 << idx)))
523 continue;
524
525 r = &dev->resource[idx];
526 if (!(r->flags & type_mask))
527 continue;
528 if ((idx == PCI_ROM_RESOURCE) &&
529 (!(r->flags & IORESOURCE_ROM_ENABLE)))
530 continue;
531 if (!r->start && r->end) {
532 printk(KERN_ERR
533 "PCI: Device %s not available because of resource collisions\n",
534 pci_name(dev));
535 return -EINVAL;
536 }
537 if (r->flags & IORESOURCE_IO)
538 cmd |= PCI_COMMAND_IO;
539 if (r->flags & IORESOURCE_MEM)
540 cmd |= PCI_COMMAND_MEMORY;
541 }
542 if (cmd != old_cmd) {
543 printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
544 pci_write_config_word(dev, PCI_COMMAND, cmd);
545 }
546 return 0;
547}
548
549int 507int
550pcibios_enable_device (struct pci_dev *dev, int mask) 508pcibios_enable_device (struct pci_dev *dev, int mask)
551{ 509{
552 int ret; 510 int ret;
553 511
554 ret = pcibios_enable_resources(dev, mask); 512 ret = pci_enable_resources(dev, mask);
555 if (ret < 0) 513 if (ret < 0)
556 return ret; 514 return ret;
557 515
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.h b/arch/mn10300/unit-asb2305/pci-asb2305.h
index 84634fa3bce6..9763d1ce343a 100644
--- a/arch/mn10300/unit-asb2305/pci-asb2305.h
+++ b/arch/mn10300/unit-asb2305/pci-asb2305.h
@@ -23,8 +23,6 @@
23#define PCI_PROBE_BIOS 1 23#define PCI_PROBE_BIOS 1
24#define PCI_PROBE_CONF1 2 24#define PCI_PROBE_CONF1 2
25#define PCI_PROBE_CONF2 4 25#define PCI_PROBE_CONF2 4
26#define PCI_NO_SORT 0x100
27#define PCI_BIOS_SORT 0x200
28#define PCI_NO_CHECKS 0x400 26#define PCI_NO_CHECKS 0x400
29#define PCI_ASSIGN_ROMS 0x1000 27#define PCI_ASSIGN_ROMS 0x1000
30#define PCI_BIOS_IRQ_SCAN 0x2000 28#define PCI_BIOS_IRQ_SCAN 0x2000
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
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 89c83ccb85c1..063cdd413049 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1161,41 +1161,9 @@ EXPORT_SYMBOL_GPL(pcibios_claim_one_bus);
1161 1161
1162int pcibios_enable_device(struct pci_dev *dev, int mask) 1162int pcibios_enable_device(struct pci_dev *dev, int mask)
1163{ 1163{
1164 u16 cmd, old_cmd;
1165 int idx;
1166 struct resource *r;
1167
1168 if (ppc_md.pcibios_enable_device_hook) 1164 if (ppc_md.pcibios_enable_device_hook)
1169 if (ppc_md.pcibios_enable_device_hook(dev)) 1165 if (ppc_md.pcibios_enable_device_hook(dev))
1170 return -EINVAL; 1166 return -EINVAL;
1171 1167
1172 pci_read_config_word(dev, PCI_COMMAND, &cmd); 1168 return pci_enable_resources(dev, mask);
1173 old_cmd = cmd;
1174 for (idx = 0; idx < PCI_NUM_RESOURCES; idx++) {
1175 /* Only set up the requested stuff */
1176 if (!(mask & (1 << idx)))
1177 continue;
1178 r = &dev->resource[idx];
1179 if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
1180 continue;
1181 if ((idx == PCI_ROM_RESOURCE) &&
1182 (!(r->flags & IORESOURCE_ROM_ENABLE)))
1183 continue;
1184 if (r->parent == NULL) {
1185 printk(KERN_ERR "PCI: Device %s not available because"
1186 " of resource collisions\n", pci_name(dev));
1187 return -EINVAL;
1188 }
1189 if (r->flags & IORESOURCE_IO)
1190 cmd |= PCI_COMMAND_IO;
1191 if (r->flags & IORESOURCE_MEM)
1192 cmd |= PCI_COMMAND_MEMORY;
1193 }
1194 if (cmd != old_cmd) {
1195 printk("PCI: Enabling device %s (%04x -> %04x)\n",
1196 pci_name(dev), old_cmd, cmd);
1197 pci_write_config_word(dev, PCI_COMMAND, cmd);
1198 }
1199 return 0;
1200} 1169}
1201
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index 0d7229cde0e9..21a6d55418f1 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -88,11 +88,8 @@ pcibios_fixup_new_pci_devices(struct pci_bus *bus)
88 struct pci_dev *dev; 88 struct pci_dev *dev;
89 89
90 list_for_each_entry(dev, &bus->devices, bus_list) { 90 list_for_each_entry(dev, &bus->devices, bus_list) {
91 /* 91 /* Skip already-added devices */
92 * Skip already-present devices (which are on the 92 if (!dev->is_added) {
93 * global device list.)
94 */
95 if (list_empty(&dev->global_list)) {
96 int i; 93 int i;
97 94
98 /* Fill device archdata and setup iommu table */ 95 /* Fill device archdata and setup iommu table */
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c
index c2ec13bea006..50ce83f20adb 100644
--- a/arch/ppc/kernel/pci.c
+++ b/arch/ppc/kernel/pci.c
@@ -578,39 +578,6 @@ pcibios_assign_resources(void)
578} 578}
579 579
580 580
581int
582pcibios_enable_resources(struct pci_dev *dev, int mask)
583{
584 u16 cmd, old_cmd;
585 int idx;
586 struct resource *r;
587
588 pci_read_config_word(dev, PCI_COMMAND, &cmd);
589 old_cmd = cmd;
590 for (idx=0; idx<6; idx++) {
591 /* Only set up the requested stuff */
592 if (!(mask & (1<<idx)))
593 continue;
594
595 r = &dev->resource[idx];
596 if (r->flags & IORESOURCE_UNSET) {
597 printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
598 return -EINVAL;
599 }
600 if (r->flags & IORESOURCE_IO)
601 cmd |= PCI_COMMAND_IO;
602 if (r->flags & IORESOURCE_MEM)
603 cmd |= PCI_COMMAND_MEMORY;
604 }
605 if (dev->resource[PCI_ROM_RESOURCE].start)
606 cmd |= PCI_COMMAND_MEMORY;
607 if (cmd != old_cmd) {
608 printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
609 pci_write_config_word(dev, PCI_COMMAND, cmd);
610 }
611 return 0;
612}
613
614static int next_controller_index; 581static int next_controller_index;
615 582
616struct pci_controller * __init 583struct pci_controller * __init
@@ -785,33 +752,11 @@ pcibios_update_irq(struct pci_dev *dev, int irq)
785 752
786int pcibios_enable_device(struct pci_dev *dev, int mask) 753int pcibios_enable_device(struct pci_dev *dev, int mask)
787{ 754{
788 u16 cmd, old_cmd;
789 int idx;
790 struct resource *r;
791
792 if (ppc_md.pcibios_enable_device_hook) 755 if (ppc_md.pcibios_enable_device_hook)
793 if (ppc_md.pcibios_enable_device_hook(dev, 0)) 756 if (ppc_md.pcibios_enable_device_hook(dev, 0))
794 return -EINVAL; 757 return -EINVAL;
795 758
796 pci_read_config_word(dev, PCI_COMMAND, &cmd); 759 return pci_enable_resources(dev, mask);
797 old_cmd = cmd;
798 for (idx=0; idx<6; idx++) {
799 r = &dev->resource[idx];
800 if (r->flags & IORESOURCE_UNSET) {
801 printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
802 return -EINVAL;
803 }
804 if (r->flags & IORESOURCE_IO)
805 cmd |= PCI_COMMAND_IO;
806 if (r->flags & IORESOURCE_MEM)
807 cmd |= PCI_COMMAND_MEMORY;
808 }
809 if (cmd != old_cmd) {
810 printk("PCI: Enabling device %s (%04x -> %04x)\n",
811 pci_name(dev), old_cmd, cmd);
812 pci_write_config_word(dev, PCI_COMMAND, cmd);
813 }
814 return 0;
815} 760}
816 761
817struct pci_controller* 762struct pci_controller*
diff --git a/arch/sh/drivers/pci/pci-sh4.h b/arch/sh/drivers/pci/pci-sh4.h
index 07e29506080f..a83dcf70c13b 100644
--- a/arch/sh/drivers/pci/pci-sh4.h
+++ b/arch/sh/drivers/pci/pci-sh4.h
@@ -15,8 +15,6 @@
15#define PCI_PROBE_BIOS 1 15#define PCI_PROBE_BIOS 1
16#define PCI_PROBE_CONF1 2 16#define PCI_PROBE_CONF1 2
17#define PCI_PROBE_CONF2 4 17#define PCI_PROBE_CONF2 4
18#define PCI_NO_SORT 0x100
19#define PCI_BIOS_SORT 0x200
20#define PCI_NO_CHECKS 0x400 18#define PCI_NO_CHECKS 0x400
21#define PCI_ASSIGN_ROMS 0x1000 19#define PCI_ASSIGN_ROMS 0x1000
22#define PCI_BIOS_IRQ_SCAN 0x2000 20#define PCI_BIOS_IRQ_SCAN 0x2000
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index adb91e4b62da..2edee22e9c30 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -1233,8 +1233,7 @@ static int __init calgary_init(void)
1233 1233
1234error: 1234error:
1235 do { 1235 do {
1236 dev = pci_get_device_reverse(PCI_VENDOR_ID_IBM, 1236 dev = pci_get_device(PCI_VENDOR_ID_IBM, PCI_ANY_ID, dev);
1237 PCI_ANY_ID, dev);
1238 if (!dev) 1237 if (!dev)
1239 break; 1238 break;
1240 if (!is_cal_pci_dev(dev->device)) 1239 if (!is_cal_pci_dev(dev->device))
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 378136fb5044..2664cb3fc96c 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -151,7 +151,7 @@ adjust_transparent_bridge_resources(struct pci_bus *bus)
151 151
152static void 152static void
153get_current_resources(struct acpi_device *device, int busnum, 153get_current_resources(struct acpi_device *device, int busnum,
154 struct pci_bus *bus) 154 int domain, struct pci_bus *bus)
155{ 155{
156 struct pci_root_info info; 156 struct pci_root_info info;
157 size_t size; 157 size_t size;
@@ -168,10 +168,10 @@ get_current_resources(struct acpi_device *device, int busnum,
168 if (!info.res) 168 if (!info.res)
169 goto res_alloc_fail; 169 goto res_alloc_fail;
170 170
171 info.name = kmalloc(12, GFP_KERNEL); 171 info.name = kmalloc(16, GFP_KERNEL);
172 if (!info.name) 172 if (!info.name)
173 goto name_alloc_fail; 173 goto name_alloc_fail;
174 sprintf(info.name, "PCI Bus #%02x", busnum); 174 sprintf(info.name, "PCI Bus %04x:%02x", domain, busnum);
175 175
176 info.res_num = 0; 176 info.res_num = 0;
177 acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, 177 acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource,
@@ -247,7 +247,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
247#endif 247#endif
248 248
249 if (bus && (pci_probe & PCI_USE__CRS)) 249 if (bus && (pci_probe & PCI_USE__CRS))
250 get_current_resources(device, busnum, bus); 250 get_current_resources(device, busnum, domain, bus);
251 251
252 return bus; 252 return bus;
253} 253}
@@ -278,8 +278,7 @@ static int __init pci_acpi_init(void)
278 printk(KERN_INFO "PCI: Routing PCI interrupts for all devices because \"pci=routeirq\" specified\n"); 278 printk(KERN_INFO "PCI: Routing PCI interrupts for all devices because \"pci=routeirq\" specified\n");
279 for_each_pci_dev(dev) 279 for_each_pci_dev(dev)
280 acpi_pci_irq_enable(dev); 280 acpi_pci_irq_enable(dev);
281 } else 281 }
282 printk(KERN_INFO "PCI: If a device doesn't work, try \"pci=routeirq\". If it helps, post a report\n");
283 282
284#ifdef CONFIG_X86_IO_APIC 283#ifdef CONFIG_X86_IO_APIC
285 if (acpi_ioapic) 284 if (acpi_ioapic)
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 7b6e3bb9b28c..75fcc29ecf52 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -77,59 +77,6 @@ int pcibios_scanned;
77 */ 77 */
78DEFINE_SPINLOCK(pci_config_lock); 78DEFINE_SPINLOCK(pci_config_lock);
79 79
80/*
81 * Several buggy motherboards address only 16 devices and mirror
82 * them to next 16 IDs. We try to detect this `feature' on all
83 * primary buses (those containing host bridges as they are
84 * expected to be unique) and remove the ghost devices.
85 */
86
87static void __devinit pcibios_fixup_ghosts(struct pci_bus *b)
88{
89 struct list_head *ln, *mn;
90 struct pci_dev *d, *e;
91 int mirror = PCI_DEVFN(16,0);
92 int seen_host_bridge = 0;
93 int i;
94
95 DBG("PCI: Scanning for ghost devices on bus %d\n", b->number);
96 list_for_each(ln, &b->devices) {
97 d = pci_dev_b(ln);
98 if ((d->class >> 8) == PCI_CLASS_BRIDGE_HOST)
99 seen_host_bridge++;
100 for (mn=ln->next; mn != &b->devices; mn=mn->next) {
101 e = pci_dev_b(mn);
102 if (e->devfn != d->devfn + mirror ||
103 e->vendor != d->vendor ||
104 e->device != d->device ||
105 e->class != d->class)
106 continue;
107 for(i=0; i<PCI_NUM_RESOURCES; i++)
108 if (e->resource[i].start != d->resource[i].start ||
109 e->resource[i].end != d->resource[i].end ||
110 e->resource[i].flags != d->resource[i].flags)
111 continue;
112 break;
113 }
114 if (mn == &b->devices)
115 return;
116 }
117 if (!seen_host_bridge)
118 return;
119 printk(KERN_WARNING "PCI: Ignoring ghost devices on bus %02x\n", b->number);
120
121 ln = &b->devices;
122 while (ln->next != &b->devices) {
123 d = pci_dev_b(ln->next);
124 if (d->devfn >= mirror) {
125 list_del(&d->global_list);
126 list_del(&d->bus_list);
127 kfree(d);
128 } else
129 ln = ln->next;
130 }
131}
132
133static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) 80static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
134{ 81{
135 struct resource *rom_r = &dev->resource[PCI_ROM_RESOURCE]; 82 struct resource *rom_r = &dev->resource[PCI_ROM_RESOURCE];
@@ -152,7 +99,6 @@ void __devinit pcibios_fixup_bus(struct pci_bus *b)
152{ 99{
153 struct pci_dev *dev; 100 struct pci_dev *dev;
154 101
155 pcibios_fixup_ghosts(b);
156 pci_read_bridge_bases(b); 102 pci_read_bridge_bases(b);
157 list_for_each_entry(dev, &b->devices, bus_list) 103 list_for_each_entry(dev, &b->devices, bus_list)
158 pcibios_fixup_device_resources(dev); 104 pcibios_fixup_device_resources(dev);
@@ -427,10 +373,6 @@ static int __init pcibios_init(void)
427 373
428 if (pci_bf_sort >= pci_force_bf) 374 if (pci_bf_sort >= pci_force_bf)
429 pci_sort_breadthfirst(); 375 pci_sort_breadthfirst();
430#ifdef CONFIG_PCI_BIOS
431 if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT))
432 pcibios_sort();
433#endif
434 return 0; 376 return 0;
435} 377}
436 378
@@ -455,9 +397,6 @@ char * __devinit pcibios_setup(char *str)
455 } else if (!strcmp(str, "nobios")) { 397 } else if (!strcmp(str, "nobios")) {
456 pci_probe &= ~PCI_PROBE_BIOS; 398 pci_probe &= ~PCI_PROBE_BIOS;
457 return NULL; 399 return NULL;
458 } else if (!strcmp(str, "nosort")) {
459 pci_probe |= PCI_NO_SORT;
460 return NULL;
461 } else if (!strcmp(str, "biosirq")) { 400 } else if (!strcmp(str, "biosirq")) {
462 pci_probe |= PCI_BIOS_IRQ_SCAN; 401 pci_probe |= PCI_BIOS_IRQ_SCAN;
463 return NULL; 402 return NULL;
@@ -527,7 +466,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
527{ 466{
528 int err; 467 int err;
529 468
530 if ((err = pcibios_enable_resources(dev, mask)) < 0) 469 if ((err = pci_enable_resources(dev, mask)) < 0)
531 return err; 470 return err;
532 471
533 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/pcbios.c b/arch/x86/pci/pcbios.c
index 2f7109ac4c15..37472fc6f729 100644
--- a/arch/x86/pci/pcbios.c
+++ b/arch/x86/pci/pcbios.c
@@ -152,28 +152,6 @@ static int __devinit check_pcibios(void)
152 return 0; 152 return 0;
153} 153}
154 154
155static int __devinit pci_bios_find_device (unsigned short vendor, unsigned short device_id,
156 unsigned short index, unsigned char *bus, unsigned char *device_fn)
157{
158 unsigned short bx;
159 unsigned short ret;
160
161 __asm__("lcall *(%%edi); cld\n\t"
162 "jc 1f\n\t"
163 "xor %%ah, %%ah\n"
164 "1:"
165 : "=b" (bx),
166 "=a" (ret)
167 : "1" (PCIBIOS_FIND_PCI_DEVICE),
168 "c" (device_id),
169 "d" (vendor),
170 "S" ((int) index),
171 "D" (&pci_indirect));
172 *bus = (bx >> 8) & 0xff;
173 *device_fn = bx & 0xff;
174 return (int) (ret & 0xff00) >> 8;
175}
176
177static int pci_bios_read(unsigned int seg, unsigned int bus, 155static int pci_bios_read(unsigned int seg, unsigned int bus,
178 unsigned int devfn, int reg, int len, u32 *value) 156 unsigned int devfn, int reg, int len, u32 *value)
179{ 157{
@@ -364,55 +342,6 @@ static struct pci_raw_ops * __devinit pci_find_bios(void)
364} 342}
365 343
366/* 344/*
367 * Sort the device list according to PCI BIOS. Nasty hack, but since some
368 * fool forgot to define the `correct' device order in the PCI BIOS specs
369 * and we want to be (possibly bug-to-bug ;-]) compatible with older kernels
370 * which used BIOS ordering, we are bound to do this...
371 */
372
373void __devinit pcibios_sort(void)
374{
375 LIST_HEAD(sorted_devices);
376 struct list_head *ln;
377 struct pci_dev *dev, *d;
378 int idx, found;
379 unsigned char bus, devfn;
380
381 DBG("PCI: Sorting device list...\n");
382 while (!list_empty(&pci_devices)) {
383 ln = pci_devices.next;
384 dev = pci_dev_g(ln);
385 idx = found = 0;
386 while (pci_bios_find_device(dev->vendor, dev->device, idx, &bus, &devfn) == PCIBIOS_SUCCESSFUL) {
387 idx++;
388 list_for_each(ln, &pci_devices) {
389 d = pci_dev_g(ln);
390 if (d->bus->number == bus && d->devfn == devfn) {
391 list_move_tail(&d->global_list, &sorted_devices);
392 if (d == dev)
393 found = 1;
394 break;
395 }
396 }
397 if (ln == &pci_devices) {
398 printk(KERN_WARNING "PCI: BIOS reporting unknown device %02x:%02x\n", bus, devfn);
399 /*
400 * We must not continue scanning as several buggy BIOSes
401 * return garbage after the last device. Grr.
402 */
403 break;
404 }
405 }
406 if (!found) {
407 printk(KERN_WARNING "PCI: Device %s not found by BIOS\n",
408 pci_name(dev));
409 list_move_tail(&dev->global_list, &sorted_devices);
410 }
411 }
412 list_splice(&sorted_devices, &pci_devices);
413}
414
415/*
416 * BIOS Functions for IRQ Routing 345 * BIOS Functions for IRQ Routing
417 */ 346 */
418 347
@@ -495,7 +424,6 @@ void __init pci_pcbios_init(void)
495{ 424{
496 if ((pci_probe & PCI_PROBE_BIOS) 425 if ((pci_probe & PCI_PROBE_BIOS)
497 && ((raw_pci_ops = pci_find_bios()))) { 426 && ((raw_pci_ops = pci_find_bios()))) {
498 pci_probe |= PCI_BIOS_SORT;
499 pci_bios_present = 1; 427 pci_bios_present = 1;
500 } 428 }
501} 429}
diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h
index 3431518d921a..c4bddaeff619 100644
--- a/arch/x86/pci/pci.h
+++ b/arch/x86/pci/pci.h
@@ -19,8 +19,6 @@
19#define PCI_PROBE_MASK 0x000f 19#define PCI_PROBE_MASK 0x000f
20#define PCI_PROBE_NOEARLY 0x0010 20#define PCI_PROBE_NOEARLY 0x0010
21 21
22#define PCI_NO_SORT 0x0100
23#define PCI_BIOS_SORT 0x0200
24#define PCI_NO_CHECKS 0x0400 22#define PCI_NO_CHECKS 0x0400
25#define PCI_USE_PIRQ_MASK 0x0800 23#define PCI_USE_PIRQ_MASK 0x0800
26#define PCI_ASSIGN_ROMS 0x1000 24#define PCI_ASSIGN_ROMS 0x1000
@@ -44,7 +42,6 @@ enum pci_bf_sort_state {
44extern unsigned int pcibios_max_latency; 42extern unsigned int pcibios_max_latency;
45 43
46void pcibios_resource_survey(void); 44void pcibios_resource_survey(void);
47int pcibios_enable_resources(struct pci_dev *, int);
48 45
49/* pci-pc.c */ 46/* pci-pc.c */
50 47
@@ -101,7 +98,6 @@ extern int pci_direct_probe(void);
101extern void pci_direct_init(int type); 98extern void pci_direct_init(int type);
102extern void pci_pcbios_init(void); 99extern void pci_pcbios_init(void);
103extern void pci_mmcfg_init(int type); 100extern void pci_mmcfg_init(int type);
104extern void pcibios_sort(void);
105 101
106/* pci-mmconfig.c */ 102/* pci-mmconfig.c */
107 103