diff options
91 files changed, 2213 insertions, 1300 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index f7923a42e769..a82a113b4a4b 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX | |||
@@ -25,8 +25,6 @@ DMA-API.txt | |||
25 | - DMA API, pci_ API & extensions for non-consistent memory machines. | 25 | - DMA API, pci_ API & extensions for non-consistent memory machines. |
26 | DMA-ISA-LPC.txt | 26 | DMA-ISA-LPC.txt |
27 | - How to do DMA with ISA (and LPC) devices. | 27 | - How to do DMA with ISA (and LPC) devices. |
28 | DMA-mapping.txt | ||
29 | - info for PCI drivers using DMA portably across all platforms. | ||
30 | DocBook/ | 28 | DocBook/ |
31 | - directory with DocBook templates etc. for kernel documentation. | 29 | - directory with DocBook templates etc. for kernel documentation. |
32 | HOWTO | 30 | HOWTO |
@@ -43,8 +41,6 @@ ManagementStyle | |||
43 | - how to (attempt to) manage kernel hackers. | 41 | - how to (attempt to) manage kernel hackers. |
44 | MSI-HOWTO.txt | 42 | MSI-HOWTO.txt |
45 | - the Message Signaled Interrupts (MSI) Driver Guide HOWTO and FAQ. | 43 | - the Message Signaled Interrupts (MSI) Driver Guide HOWTO and FAQ. |
46 | PCIEBUS-HOWTO.txt | ||
47 | - a guide describing the PCI Express Port Bus driver. | ||
48 | RCU/ | 44 | RCU/ |
49 | - directory with info on RCU (read-copy update). | 45 | - directory with info on RCU (read-copy update). |
50 | README.DAC960 | 46 | README.DAC960 |
@@ -285,12 +281,6 @@ parport.txt | |||
285 | - how to use the parallel-port driver. | 281 | - how to use the parallel-port driver. |
286 | parport-lowlevel.txt | 282 | parport-lowlevel.txt |
287 | - description and usage of the low level parallel port functions. | 283 | - description and usage of the low level parallel port functions. |
288 | pci-error-recovery.txt | ||
289 | - info on PCI error recovery. | ||
290 | pci.txt | ||
291 | - info on the PCI subsystem for device driver authors. | ||
292 | pcieaer-howto.txt | ||
293 | - the PCI Express Advanced Error Reporting Driver Guide HOWTO. | ||
294 | pcmcia/ | 284 | pcmcia/ |
295 | - info on the Linux PCMCIA driver. | 285 | - info on the Linux PCMCIA driver. |
296 | pi-futex.txt | 286 | pi-futex.txt |
diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci new file mode 100644 index 000000000000..ceddcff4082a --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-pci | |||
@@ -0,0 +1,11 @@ | |||
1 | What: /sys/bus/pci/devices/.../vpd | ||
2 | Date: February 2008 | ||
3 | Contact: Ben Hutchings <bhutchings@solarflare.com> | ||
4 | Description: | ||
5 | A file named vpd in a device directory will be a | ||
6 | binary file containing the Vital Product Data for the | ||
7 | device. It should follow the VPD format defined in | ||
8 | PCI Specification 2.1 or 2.2, but users should consider | ||
9 | that some devices may have malformatted data. If the | ||
10 | underlying VPD has a writable section then the | ||
11 | corresponding section of this file will be writable. | ||
diff --git a/Documentation/PCI/00-INDEX b/Documentation/PCI/00-INDEX new file mode 100644 index 000000000000..49f43946c6b6 --- /dev/null +++ b/Documentation/PCI/00-INDEX | |||
@@ -0,0 +1,12 @@ | |||
1 | 00-INDEX | ||
2 | - this file | ||
3 | PCI-DMA-mapping.txt | ||
4 | - info for PCI drivers using DMA portably across all platforms | ||
5 | PCIEBUS-HOWTO.txt | ||
6 | - a guide describing the PCI Express Port Bus driver | ||
7 | pci-error-recovery.txt | ||
8 | - info on PCI error recovery | ||
9 | pci.txt | ||
10 | - info on the PCI subsystem for device driver authors | ||
11 | pcieaer-howto.txt | ||
12 | - the PCI Express Advanced Error Reporting Driver Guide HOWTO | ||
diff --git a/Documentation/PCIEBUS-HOWTO.txt b/Documentation/PCI/PCIEBUS-HOWTO.txt index c93f42a74d7e..9a07e38631b0 100644 --- a/Documentation/PCIEBUS-HOWTO.txt +++ b/Documentation/PCI/PCIEBUS-HOWTO.txt | |||
@@ -56,9 +56,9 @@ advantages of using the PCI Express Port Bus driver are listed below: | |||
56 | 56 | ||
57 | - Allow service drivers implemented in an independent | 57 | - Allow service drivers implemented in an independent |
58 | staged approach. | 58 | staged approach. |
59 | 59 | ||
60 | - Allow one service driver to run on multiple PCI-PCI Bridge | 60 | - Allow one service driver to run on multiple PCI-PCI Bridge |
61 | Port devices. | 61 | Port devices. |
62 | 62 | ||
63 | - Manage and distribute resources of a PCI-PCI Bridge Port | 63 | - Manage and distribute resources of a PCI-PCI Bridge Port |
64 | device to requested service drivers. | 64 | device to requested service drivers. |
@@ -82,7 +82,7 @@ Model requires some minimal changes on existing service drivers that | |||
82 | imposes no impact on the functionality of existing service drivers. | 82 | imposes no impact on the functionality of existing service drivers. |
83 | 83 | ||
84 | A service driver is required to use the two APIs shown below to | 84 | A service driver is required to use the two APIs shown below to |
85 | register its service with the PCI Express Port Bus driver (see | 85 | register its service with the PCI Express Port Bus driver (see |
86 | section 5.2.1 & 5.2.2). It is important that a service driver | 86 | section 5.2.1 & 5.2.2). It is important that a service driver |
87 | initializes the pcie_port_service_driver data structure, included in | 87 | initializes the pcie_port_service_driver data structure, included in |
88 | header file /include/linux/pcieport_if.h, before calling these APIs. | 88 | header file /include/linux/pcieport_if.h, before calling these APIs. |
@@ -137,7 +137,7 @@ driver. | |||
137 | static int __init aerdrv_service_init(void) | 137 | static int __init aerdrv_service_init(void) |
138 | { | 138 | { |
139 | int retval = 0; | 139 | int retval = 0; |
140 | 140 | ||
141 | retval = pcie_port_service_register(&root_aerdrv); | 141 | retval = pcie_port_service_register(&root_aerdrv); |
142 | if (!retval) { | 142 | if (!retval) { |
143 | /* | 143 | /* |
@@ -147,7 +147,7 @@ static int __init aerdrv_service_init(void) | |||
147 | return retval; | 147 | return retval; |
148 | } | 148 | } |
149 | 149 | ||
150 | static void __exit aerdrv_service_exit(void) | 150 | static void __exit aerdrv_service_exit(void) |
151 | { | 151 | { |
152 | pcie_port_service_unregister(&root_aerdrv); | 152 | pcie_port_service_unregister(&root_aerdrv); |
153 | } | 153 | } |
@@ -175,7 +175,7 @@ same physical Root Port. Both service drivers call pci_enable_msi to | |||
175 | request MSI based interrupts. A service driver may not know whether | 175 | request MSI based interrupts. A service driver may not know whether |
176 | any other service drivers have run on this Root Port. If either one | 176 | any other service drivers have run on this Root Port. If either one |
177 | of them calls pci_disable_msi, it puts the other service driver | 177 | of them calls pci_disable_msi, it puts the other service driver |
178 | in a wrong interrupt mode. | 178 | in a wrong interrupt mode. |
179 | 179 | ||
180 | To avoid this situation all service drivers are not permitted to | 180 | To avoid this situation all service drivers are not permitted to |
181 | switch interrupt mode on its device. The PCI Express Port Bus driver | 181 | switch interrupt mode on its device. The PCI Express Port Bus driver |
diff --git a/Documentation/pci-error-recovery.txt b/Documentation/PCI/pci-error-recovery.txt index 6650af432523..6650af432523 100644 --- a/Documentation/pci-error-recovery.txt +++ b/Documentation/PCI/pci-error-recovery.txt | |||
diff --git a/Documentation/pci.txt b/Documentation/PCI/pci.txt index d2c2e6e2b224..8d4dc6250c58 100644 --- a/Documentation/pci.txt +++ b/Documentation/PCI/pci.txt | |||
@@ -119,7 +119,7 @@ initialization with a pointer to a structure describing the driver | |||
119 | the power state of a device before reboot. | 119 | the power state of a device before reboot. |
120 | e.g. drivers/net/e100.c. | 120 | e.g. drivers/net/e100.c. |
121 | 121 | ||
122 | err_handler See Documentation/pci-error-recovery.txt | 122 | err_handler See Documentation/PCI/pci-error-recovery.txt |
123 | 123 | ||
124 | 124 | ||
125 | The ID table is an array of struct pci_device_id entries ending with an | 125 | The ID table is an array of struct pci_device_id entries ending with an |
diff --git a/Documentation/pcieaer-howto.txt b/Documentation/PCI/pcieaer-howto.txt index d5da86170106..16c251230c82 100644 --- a/Documentation/pcieaer-howto.txt +++ b/Documentation/PCI/pcieaer-howto.txt | |||
@@ -13,7 +13,7 @@ Reporting (AER) driver and provides information on how to use it, as | |||
13 | well as how to enable the drivers of endpoint devices to conform with | 13 | well as how to enable the drivers of endpoint devices to conform with |
14 | PCI Express AER driver. | 14 | PCI Express AER driver. |
15 | 15 | ||
16 | 1.2 Copyright © Intel Corporation 2006. | 16 | 1.2 Copyright © Intel Corporation 2006. |
17 | 17 | ||
18 | 1.3 What is the PCI Express AER Driver? | 18 | 1.3 What is the PCI Express AER Driver? |
19 | 19 | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index dfb5bef24013..bf6303ec0bde 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -847,6 +847,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
847 | than 32 bit addressing. The default is to look | 847 | than 32 bit addressing. The default is to look |
848 | for translation below 32 bit and if not available | 848 | for translation below 32 bit and if not available |
849 | then look in the higher range. | 849 | then look in the higher range. |
850 | strict [Default Off] | ||
851 | With this option on every unmap_single operation will | ||
852 | result in a hardware IOTLB flush operation as opposed | ||
853 | to batching them for performance. | ||
850 | 854 | ||
851 | io_delay= [X86-32,X86-64] I/O delay method | 855 | io_delay= [X86-32,X86-64] I/O delay method |
852 | 0x80 | 856 | 0x80 |
@@ -1471,10 +1475,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1471 | nomsi [MSI] If the PCI_MSI kernel config parameter is | 1475 | nomsi [MSI] If the PCI_MSI kernel config parameter is |
1472 | enabled, this kernel boot option can be used to | 1476 | enabled, this kernel boot option can be used to |
1473 | disable the use of MSI interrupts system-wide. | 1477 | disable the use of MSI interrupts system-wide. |
1474 | nosort [X86-32] Don't sort PCI devices according to | ||
1475 | order given by the PCI BIOS. This sorting is | ||
1476 | done to get a device order compatible with | ||
1477 | older kernels. | ||
1478 | biosirq [X86-32] Use PCI BIOS calls to get the interrupt | 1478 | biosirq [X86-32] Use PCI BIOS calls to get the interrupt |
1479 | routing table. These calls are known to be buggy | 1479 | routing table. These calls are known to be buggy |
1480 | on several machines and they hang the machine | 1480 | on several machines and they hang the machine |
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt index 1f506f7830ec..e5a819a4f0c9 100644 --- a/Documentation/memory-barriers.txt +++ b/Documentation/memory-barriers.txt | |||
@@ -430,8 +430,8 @@ There are certain things that the Linux kernel memory barriers do not guarantee: | |||
430 | 430 | ||
431 | [*] For information on bus mastering DMA and coherency please read: | 431 | [*] For information on bus mastering DMA and coherency please read: |
432 | 432 | ||
433 | Documentation/pci.txt | 433 | Documentation/PCI/pci.txt |
434 | Documentation/DMA-mapping.txt | 434 | Documentation/PCI/PCI-DMA-mapping.txt |
435 | Documentation/DMA-API.txt | 435 | Documentation/DMA-API.txt |
436 | 436 | ||
437 | 437 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index a46ec689f0ac..525d09b48801 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -3065,11 +3065,10 @@ L: linux-pci@atrey.karlin.mff.cuni.cz | |||
3065 | S: Supported | 3065 | S: Supported |
3066 | 3066 | ||
3067 | PCI SUBSYSTEM | 3067 | PCI SUBSYSTEM |
3068 | P: Greg Kroah-Hartman | 3068 | P: Jesse Barnes |
3069 | M: gregkh@suse.de | 3069 | M: jbarnes@virtuousgeek.org |
3070 | L: linux-kernel@vger.kernel.org | 3070 | L: linux-kernel@vger.kernel.org |
3071 | L: linux-pci@atrey.karlin.mff.cuni.cz | 3071 | L: linux-pci@atrey.karlin.mff.cuni.cz |
3072 | T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ | ||
3073 | S: Supported | 3072 | S: Supported |
3074 | 3073 | ||
3075 | PCI HOTPLUG CORE | 3074 | PCI HOTPLUG CORE |
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); | |||
372 | int | 372 | int |
373 | pcibios_enable_device(struct pci_dev *dev, int mask) | 373 | pcibios_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 | |||
208 | static 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 | ||
507 | static inline int | ||
508 | pcibios_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 | |||
549 | int | 507 | int |
550 | pcibios_enable_device (struct pci_dev *dev, int mask) | 508 | pcibios_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 | */ |
288 | int pcibios_enable_device(struct pci_dev *dev, int mask) | 288 | int 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 | ||
1162 | int pcibios_enable_device(struct pci_dev *dev, int mask) | 1162 | int 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 | ||
581 | int | ||
582 | pcibios_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 | |||
614 | static int next_controller_index; | 581 | static int next_controller_index; |
615 | 582 | ||
616 | struct pci_controller * __init | 583 | struct pci_controller * __init |
@@ -785,33 +752,11 @@ pcibios_update_irq(struct pci_dev *dev, int irq) | |||
785 | 752 | ||
786 | int pcibios_enable_device(struct pci_dev *dev, int mask) | 753 | int 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 | ||
817 | struct pci_controller* | 762 | struct 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 | ||
1234 | error: | 1234 | error: |
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 | ||
152 | static void | 152 | static void |
153 | get_current_resources(struct acpi_device *device, int busnum, | 153 | get_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 | */ |
78 | DEFINE_SPINLOCK(pci_config_lock); | 78 | DEFINE_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 | |||
87 | static 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 | |||
133 | static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) | 80 | static 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 | */ |
242 | fs_initcall(pcibios_assign_resources); | 242 | fs_initcall(pcibios_assign_resources); |
243 | 243 | ||
244 | int 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 | ||
155 | static 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 | |||
177 | static int pci_bios_read(unsigned int seg, unsigned int bus, | 155 | static 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 | |||
373 | void __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 { | |||
44 | extern unsigned int pcibios_max_latency; | 42 | extern unsigned int pcibios_max_latency; |
45 | 43 | ||
46 | void pcibios_resource_survey(void); | 44 | void pcibios_resource_survey(void); |
47 | int 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); | |||
101 | extern void pci_direct_init(int type); | 98 | extern void pci_direct_init(int type); |
102 | extern void pci_pcbios_init(void); | 99 | extern void pci_pcbios_init(void); |
103 | extern void pci_mmcfg_init(int type); | 100 | extern void pci_mmcfg_init(int type); |
104 | extern void pcibios_sort(void); | ||
105 | 101 | ||
106 | /* pci-mmconfig.c */ | 102 | /* pci-mmconfig.c */ |
107 | 103 | ||
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index 03c763c2d0e0..d9c6322a721b 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c | |||
@@ -496,7 +496,6 @@ dino_card_setup(struct pci_bus *bus, void __iomem *base_addr) | |||
496 | list_for_each_safe(ln, tmp_ln, &bus->devices) { | 496 | list_for_each_safe(ln, tmp_ln, &bus->devices) { |
497 | struct pci_dev *dev = pci_dev_b(ln); | 497 | struct pci_dev *dev = pci_dev_b(ln); |
498 | 498 | ||
499 | list_del(&dev->global_list); | ||
500 | list_del(&dev->bus_list); | 499 | list_del(&dev->bus_list); |
501 | } | 500 | } |
502 | 501 | ||
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index fc405f0165d9..ec8f7002b09d 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/delay.h> | ||
1 | #include <linux/pci.h> | 2 | #include <linux/pci.h> |
2 | #include <linux/module.h> | 3 | #include <linux/module.h> |
3 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
@@ -126,6 +127,171 @@ PCI_USER_WRITE_CONFIG(byte, u8) | |||
126 | PCI_USER_WRITE_CONFIG(word, u16) | 127 | PCI_USER_WRITE_CONFIG(word, u16) |
127 | PCI_USER_WRITE_CONFIG(dword, u32) | 128 | PCI_USER_WRITE_CONFIG(dword, u32) |
128 | 129 | ||
130 | /* VPD access through PCI 2.2+ VPD capability */ | ||
131 | |||
132 | #define PCI_VPD_PCI22_SIZE (PCI_VPD_ADDR_MASK + 1) | ||
133 | |||
134 | struct pci_vpd_pci22 { | ||
135 | struct pci_vpd base; | ||
136 | spinlock_t lock; /* controls access to hardware and the flags */ | ||
137 | u8 cap; | ||
138 | bool busy; | ||
139 | bool flag; /* value of F bit to wait for */ | ||
140 | }; | ||
141 | |||
142 | /* Wait for last operation to complete */ | ||
143 | static int pci_vpd_pci22_wait(struct pci_dev *dev) | ||
144 | { | ||
145 | struct pci_vpd_pci22 *vpd = | ||
146 | container_of(dev->vpd, struct pci_vpd_pci22, base); | ||
147 | u16 flag, status; | ||
148 | int wait; | ||
149 | int ret; | ||
150 | |||
151 | if (!vpd->busy) | ||
152 | return 0; | ||
153 | |||
154 | flag = vpd->flag ? PCI_VPD_ADDR_F : 0; | ||
155 | wait = vpd->flag ? 10 : 1000; /* read: 100 us; write: 10 ms */ | ||
156 | for (;;) { | ||
157 | ret = pci_user_read_config_word(dev, | ||
158 | vpd->cap + PCI_VPD_ADDR, | ||
159 | &status); | ||
160 | if (ret < 0) | ||
161 | return ret; | ||
162 | if ((status & PCI_VPD_ADDR_F) == flag) { | ||
163 | vpd->busy = false; | ||
164 | return 0; | ||
165 | } | ||
166 | if (wait-- == 0) | ||
167 | return -ETIMEDOUT; | ||
168 | udelay(10); | ||
169 | } | ||
170 | } | ||
171 | |||
172 | static int pci_vpd_pci22_read(struct pci_dev *dev, int pos, int size, | ||
173 | char *buf) | ||
174 | { | ||
175 | struct pci_vpd_pci22 *vpd = | ||
176 | container_of(dev->vpd, struct pci_vpd_pci22, base); | ||
177 | u32 val; | ||
178 | int ret; | ||
179 | int begin, end, i; | ||
180 | |||
181 | if (pos < 0 || pos > PCI_VPD_PCI22_SIZE || | ||
182 | size > PCI_VPD_PCI22_SIZE - pos) | ||
183 | return -EINVAL; | ||
184 | if (size == 0) | ||
185 | return 0; | ||
186 | |||
187 | spin_lock_irq(&vpd->lock); | ||
188 | ret = pci_vpd_pci22_wait(dev); | ||
189 | if (ret < 0) | ||
190 | goto out; | ||
191 | ret = pci_user_write_config_word(dev, vpd->cap + PCI_VPD_ADDR, | ||
192 | pos & ~3); | ||
193 | if (ret < 0) | ||
194 | goto out; | ||
195 | vpd->busy = true; | ||
196 | vpd->flag = 1; | ||
197 | ret = pci_vpd_pci22_wait(dev); | ||
198 | if (ret < 0) | ||
199 | goto out; | ||
200 | ret = pci_user_read_config_dword(dev, vpd->cap + PCI_VPD_DATA, | ||
201 | &val); | ||
202 | out: | ||
203 | spin_unlock_irq(&vpd->lock); | ||
204 | if (ret < 0) | ||
205 | return ret; | ||
206 | |||
207 | /* Convert to bytes */ | ||
208 | begin = pos & 3; | ||
209 | end = min(4, begin + size); | ||
210 | for (i = 0; i < end; ++i) { | ||
211 | if (i >= begin) | ||
212 | *buf++ = val; | ||
213 | val >>= 8; | ||
214 | } | ||
215 | return end - begin; | ||
216 | } | ||
217 | |||
218 | static int pci_vpd_pci22_write(struct pci_dev *dev, int pos, int size, | ||
219 | const char *buf) | ||
220 | { | ||
221 | struct pci_vpd_pci22 *vpd = | ||
222 | container_of(dev->vpd, struct pci_vpd_pci22, base); | ||
223 | u32 val; | ||
224 | int ret; | ||
225 | |||
226 | if (pos < 0 || pos > PCI_VPD_PCI22_SIZE || pos & 3 || | ||
227 | size > PCI_VPD_PCI22_SIZE - pos || size < 4) | ||
228 | return -EINVAL; | ||
229 | |||
230 | val = (u8) *buf++; | ||
231 | val |= ((u8) *buf++) << 8; | ||
232 | val |= ((u8) *buf++) << 16; | ||
233 | val |= ((u32)(u8) *buf++) << 24; | ||
234 | |||
235 | spin_lock_irq(&vpd->lock); | ||
236 | ret = pci_vpd_pci22_wait(dev); | ||
237 | if (ret < 0) | ||
238 | goto out; | ||
239 | ret = pci_user_write_config_dword(dev, vpd->cap + PCI_VPD_DATA, | ||
240 | val); | ||
241 | if (ret < 0) | ||
242 | goto out; | ||
243 | ret = pci_user_write_config_word(dev, vpd->cap + PCI_VPD_ADDR, | ||
244 | pos | PCI_VPD_ADDR_F); | ||
245 | if (ret < 0) | ||
246 | goto out; | ||
247 | vpd->busy = true; | ||
248 | vpd->flag = 0; | ||
249 | ret = pci_vpd_pci22_wait(dev); | ||
250 | out: | ||
251 | spin_unlock_irq(&vpd->lock); | ||
252 | if (ret < 0) | ||
253 | return ret; | ||
254 | |||
255 | return 4; | ||
256 | } | ||
257 | |||
258 | static int pci_vpd_pci22_get_size(struct pci_dev *dev) | ||
259 | { | ||
260 | return PCI_VPD_PCI22_SIZE; | ||
261 | } | ||
262 | |||
263 | static void pci_vpd_pci22_release(struct pci_dev *dev) | ||
264 | { | ||
265 | kfree(container_of(dev->vpd, struct pci_vpd_pci22, base)); | ||
266 | } | ||
267 | |||
268 | static struct pci_vpd_ops pci_vpd_pci22_ops = { | ||
269 | .read = pci_vpd_pci22_read, | ||
270 | .write = pci_vpd_pci22_write, | ||
271 | .get_size = pci_vpd_pci22_get_size, | ||
272 | .release = pci_vpd_pci22_release, | ||
273 | }; | ||
274 | |||
275 | int pci_vpd_pci22_init(struct pci_dev *dev) | ||
276 | { | ||
277 | struct pci_vpd_pci22 *vpd; | ||
278 | u8 cap; | ||
279 | |||
280 | cap = pci_find_capability(dev, PCI_CAP_ID_VPD); | ||
281 | if (!cap) | ||
282 | return -ENODEV; | ||
283 | vpd = kzalloc(sizeof(*vpd), GFP_ATOMIC); | ||
284 | if (!vpd) | ||
285 | return -ENOMEM; | ||
286 | |||
287 | vpd->base.ops = &pci_vpd_pci22_ops; | ||
288 | spin_lock_init(&vpd->lock); | ||
289 | vpd->cap = cap; | ||
290 | vpd->busy = false; | ||
291 | dev->vpd = &vpd->base; | ||
292 | return 0; | ||
293 | } | ||
294 | |||
129 | /** | 295 | /** |
130 | * pci_block_user_cfg_access - Block userspace PCI config reads/writes | 296 | * pci_block_user_cfg_access - Block userspace PCI config reads/writes |
131 | * @dev: pci device struct | 297 | * @dev: pci device struct |
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index d708358326e5..529d9d7727b0 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -84,10 +84,7 @@ int pci_bus_add_device(struct pci_dev *dev) | |||
84 | if (retval) | 84 | if (retval) |
85 | return retval; | 85 | return retval; |
86 | 86 | ||
87 | down_write(&pci_bus_sem); | 87 | dev->is_added = 1; |
88 | list_add_tail(&dev->global_list, &pci_devices); | ||
89 | up_write(&pci_bus_sem); | ||
90 | |||
91 | pci_proc_attach_device(dev); | 88 | pci_proc_attach_device(dev); |
92 | pci_create_sysfs_dev_files(dev); | 89 | pci_create_sysfs_dev_files(dev); |
93 | return 0; | 90 | return 0; |
@@ -112,11 +109,8 @@ void pci_bus_add_devices(struct pci_bus *bus) | |||
112 | int retval; | 109 | int retval; |
113 | 110 | ||
114 | list_for_each_entry(dev, &bus->devices, bus_list) { | 111 | list_for_each_entry(dev, &bus->devices, bus_list) { |
115 | /* | 112 | /* Skip already-added devices */ |
116 | * Skip already-present devices (which are on the | 113 | if (dev->is_added) |
117 | * global device list.) | ||
118 | */ | ||
119 | if (!list_empty(&dev->global_list)) | ||
120 | continue; | 114 | continue; |
121 | retval = pci_bus_add_device(dev); | 115 | retval = pci_bus_add_device(dev); |
122 | if (retval) | 116 | if (retval) |
@@ -124,8 +118,7 @@ void pci_bus_add_devices(struct pci_bus *bus) | |||
124 | } | 118 | } |
125 | 119 | ||
126 | list_for_each_entry(dev, &bus->devices, bus_list) { | 120 | list_for_each_entry(dev, &bus->devices, bus_list) { |
127 | 121 | BUG_ON(!dev->is_added); | |
128 | BUG_ON(list_empty(&dev->global_list)); | ||
129 | 122 | ||
130 | /* | 123 | /* |
131 | * If there is an unattached subordinate bus, attach | 124 | * If there is an unattached subordinate bus, attach |
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig index 2cdd8326f136..eacfb13998bb 100644 --- a/drivers/pci/hotplug/Kconfig +++ b/drivers/pci/hotplug/Kconfig | |||
@@ -63,7 +63,7 @@ config HOTPLUG_PCI_COMPAQ_NVRAM | |||
63 | 63 | ||
64 | config HOTPLUG_PCI_IBM | 64 | config HOTPLUG_PCI_IBM |
65 | tristate "IBM PCI Hotplug driver" | 65 | tristate "IBM PCI Hotplug driver" |
66 | depends on X86_IO_APIC && X86 && PCI_BIOS && PCI_LEGACY | 66 | depends on X86_IO_APIC && X86 && PCI_BIOS |
67 | help | 67 | help |
68 | Say Y here if you have a motherboard with a IBM PCI Hotplug | 68 | Say Y here if you have a motherboard with a IBM PCI Hotplug |
69 | controller. | 69 | controller. |
@@ -119,7 +119,7 @@ config HOTPLUG_PCI_CPCI_ZT5550 | |||
119 | 119 | ||
120 | config HOTPLUG_PCI_CPCI_GENERIC | 120 | config HOTPLUG_PCI_CPCI_GENERIC |
121 | tristate "Generic port I/O CompactPCI Hotplug driver" | 121 | tristate "Generic port I/O CompactPCI Hotplug driver" |
122 | depends on HOTPLUG_PCI_CPCI && X86 && PCI_LEGACY | 122 | depends on HOTPLUG_PCI_CPCI && X86 |
123 | help | 123 | help |
124 | Say Y here if you have a CompactPCI system card that exposes the #ENUM | 124 | Say Y here if you have a CompactPCI system card that exposes the #ENUM |
125 | hotswap signal as a bit in a system register that can be read through | 125 | hotswap signal as a bit in a system register that can be read through |
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c index 270a33cc08f6..f8c187a763bd 100644 --- a/drivers/pci/hotplug/acpi_pcihp.c +++ b/drivers/pci/hotplug/acpi_pcihp.c | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #define MY_NAME "acpi_pcihp" | 37 | #define MY_NAME "acpi_pcihp" |
38 | 38 | ||
39 | #define dbg(fmt, arg...) do { if (debug_acpi) printk(KERN_DEBUG "%s: %s: " fmt , MY_NAME , __FUNCTION__ , ## arg); } while (0) | 39 | #define dbg(fmt, arg...) do { if (debug_acpi) printk(KERN_DEBUG "%s: %s: " fmt , MY_NAME , __func__ , ## arg); } while (0) |
40 | #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) | 40 | #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) |
41 | #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) | 41 | #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) |
42 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg) | 42 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg) |
@@ -71,7 +71,7 @@ decode_type0_hpx_record(union acpi_object *record, struct hotplug_params *hpx) | |||
71 | default: | 71 | default: |
72 | printk(KERN_WARNING | 72 | printk(KERN_WARNING |
73 | "%s: Type 0 Revision %d record not supported\n", | 73 | "%s: Type 0 Revision %d record not supported\n", |
74 | __FUNCTION__, revision); | 74 | __func__, revision); |
75 | return AE_ERROR; | 75 | return AE_ERROR; |
76 | } | 76 | } |
77 | return AE_OK; | 77 | return AE_OK; |
@@ -100,7 +100,7 @@ decode_type1_hpx_record(union acpi_object *record, struct hotplug_params *hpx) | |||
100 | default: | 100 | default: |
101 | printk(KERN_WARNING | 101 | printk(KERN_WARNING |
102 | "%s: Type 1 Revision %d record not supported\n", | 102 | "%s: Type 1 Revision %d record not supported\n", |
103 | __FUNCTION__, revision); | 103 | __func__, revision); |
104 | return AE_ERROR; | 104 | return AE_ERROR; |
105 | } | 105 | } |
106 | return AE_OK; | 106 | return AE_OK; |
@@ -142,7 +142,7 @@ decode_type2_hpx_record(union acpi_object *record, struct hotplug_params *hpx) | |||
142 | default: | 142 | default: |
143 | printk(KERN_WARNING | 143 | printk(KERN_WARNING |
144 | "%s: Type 2 Revision %d record not supported\n", | 144 | "%s: Type 2 Revision %d record not supported\n", |
145 | __FUNCTION__, revision); | 145 | __func__, revision); |
146 | return AE_ERROR; | 146 | return AE_ERROR; |
147 | } | 147 | } |
148 | return AE_OK; | 148 | return AE_OK; |
@@ -203,7 +203,7 @@ acpi_run_hpx(acpi_handle handle, struct hotplug_params *hpx) | |||
203 | break; | 203 | break; |
204 | default: | 204 | default: |
205 | printk(KERN_ERR "%s: Type %d record not supported\n", | 205 | printk(KERN_ERR "%s: Type %d record not supported\n", |
206 | __FUNCTION__, type); | 206 | __func__, type); |
207 | status = AE_ERROR; | 207 | status = AE_ERROR; |
208 | goto exit; | 208 | goto exit; |
209 | } | 209 | } |
@@ -235,7 +235,7 @@ acpi_run_hpp(acpi_handle handle, struct hotplug_params *hpp) | |||
235 | ret_buf.pointer = kmalloc (ret_buf.length, GFP_KERNEL); | 235 | ret_buf.pointer = kmalloc (ret_buf.length, GFP_KERNEL); |
236 | if (!ret_buf.pointer) { | 236 | if (!ret_buf.pointer) { |
237 | printk(KERN_ERR "%s:%s alloc for _HPP fail\n", | 237 | printk(KERN_ERR "%s:%s alloc for _HPP fail\n", |
238 | __FUNCTION__, (char *)string.pointer); | 238 | __func__, (char *)string.pointer); |
239 | kfree(string.pointer); | 239 | kfree(string.pointer); |
240 | return AE_NO_MEMORY; | 240 | return AE_NO_MEMORY; |
241 | } | 241 | } |
@@ -245,7 +245,7 @@ acpi_run_hpp(acpi_handle handle, struct hotplug_params *hpp) | |||
245 | break; | 245 | break; |
246 | default: | 246 | default: |
247 | if (ACPI_FAILURE(status)) { | 247 | if (ACPI_FAILURE(status)) { |
248 | pr_debug("%s:%s _HPP fail=0x%x\n", __FUNCTION__, | 248 | pr_debug("%s:%s _HPP fail=0x%x\n", __func__, |
249 | (char *)string.pointer, status); | 249 | (char *)string.pointer, status); |
250 | kfree(string.pointer); | 250 | kfree(string.pointer); |
251 | return status; | 251 | return status; |
@@ -254,7 +254,7 @@ acpi_run_hpp(acpi_handle handle, struct hotplug_params *hpp) | |||
254 | 254 | ||
255 | ext_obj = (union acpi_object *) ret_buf.pointer; | 255 | ext_obj = (union acpi_object *) ret_buf.pointer; |
256 | if (ext_obj->type != ACPI_TYPE_PACKAGE) { | 256 | if (ext_obj->type != ACPI_TYPE_PACKAGE) { |
257 | printk(KERN_ERR "%s:%s _HPP obj not a package\n", __FUNCTION__, | 257 | printk(KERN_ERR "%s:%s _HPP obj not a package\n", __func__, |
258 | (char *)string.pointer); | 258 | (char *)string.pointer); |
259 | status = AE_ERROR; | 259 | status = AE_ERROR; |
260 | goto free_and_return; | 260 | goto free_and_return; |
@@ -270,7 +270,7 @@ acpi_run_hpp(acpi_handle handle, struct hotplug_params *hpp) | |||
270 | break; | 270 | break; |
271 | default: | 271 | default: |
272 | printk(KERN_ERR "%s:%s _HPP obj type incorrect\n", | 272 | printk(KERN_ERR "%s:%s _HPP obj type incorrect\n", |
273 | __FUNCTION__, (char *)string.pointer); | 273 | __func__, (char *)string.pointer); |
274 | status = AE_ERROR; | 274 | status = AE_ERROR; |
275 | goto free_and_return; | 275 | goto free_and_return; |
276 | } | 276 | } |
@@ -311,12 +311,12 @@ acpi_status acpi_run_oshp(acpi_handle handle) | |||
311 | if (ACPI_FAILURE(status)) | 311 | if (ACPI_FAILURE(status)) |
312 | if (status != AE_NOT_FOUND) | 312 | if (status != AE_NOT_FOUND) |
313 | printk(KERN_ERR "%s:%s OSHP fails=0x%x\n", | 313 | printk(KERN_ERR "%s:%s OSHP fails=0x%x\n", |
314 | __FUNCTION__, (char *)string.pointer, status); | 314 | __func__, (char *)string.pointer, status); |
315 | else | 315 | else |
316 | dbg("%s:%s OSHP not found\n", | 316 | dbg("%s:%s OSHP not found\n", |
317 | __FUNCTION__, (char *)string.pointer); | 317 | __func__, (char *)string.pointer); |
318 | else | 318 | else |
319 | pr_debug("%s:%s OSHP passes\n", __FUNCTION__, | 319 | pr_debug("%s:%s OSHP passes\n", __func__, |
320 | (char *)string.pointer); | 320 | (char *)string.pointer); |
321 | 321 | ||
322 | kfree(string.pointer); | 322 | kfree(string.pointer); |
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c index 9279d5ba62e6..7af68ba27903 100644 --- a/drivers/pci/hotplug/acpiphp_core.c +++ b/drivers/pci/hotplug/acpiphp_core.c | |||
@@ -138,7 +138,7 @@ static int enable_slot(struct hotplug_slot *hotplug_slot) | |||
138 | { | 138 | { |
139 | struct slot *slot = hotplug_slot->private; | 139 | struct slot *slot = hotplug_slot->private; |
140 | 140 | ||
141 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 141 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
142 | 142 | ||
143 | /* enable the specified slot */ | 143 | /* enable the specified slot */ |
144 | return acpiphp_enable_slot(slot->acpi_slot); | 144 | return acpiphp_enable_slot(slot->acpi_slot); |
@@ -156,7 +156,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) | |||
156 | struct slot *slot = hotplug_slot->private; | 156 | struct slot *slot = hotplug_slot->private; |
157 | int retval; | 157 | int retval; |
158 | 158 | ||
159 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 159 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
160 | 160 | ||
161 | /* disable the specified slot */ | 161 | /* disable the specified slot */ |
162 | retval = acpiphp_disable_slot(slot->acpi_slot); | 162 | retval = acpiphp_disable_slot(slot->acpi_slot); |
@@ -179,7 +179,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) | |||
179 | { | 179 | { |
180 | int retval = -ENODEV; | 180 | int retval = -ENODEV; |
181 | 181 | ||
182 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 182 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
183 | 183 | ||
184 | if (attention_info && try_module_get(attention_info->owner)) { | 184 | if (attention_info && try_module_get(attention_info->owner)) { |
185 | retval = attention_info->set_attn(hotplug_slot, status); | 185 | retval = attention_info->set_attn(hotplug_slot, status); |
@@ -202,7 +202,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
202 | { | 202 | { |
203 | struct slot *slot = hotplug_slot->private; | 203 | struct slot *slot = hotplug_slot->private; |
204 | 204 | ||
205 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 205 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
206 | 206 | ||
207 | *value = acpiphp_get_power_status(slot->acpi_slot); | 207 | *value = acpiphp_get_power_status(slot->acpi_slot); |
208 | 208 | ||
@@ -224,7 +224,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
224 | { | 224 | { |
225 | int retval = -EINVAL; | 225 | int retval = -EINVAL; |
226 | 226 | ||
227 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 227 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
228 | 228 | ||
229 | if (attention_info && try_module_get(attention_info->owner)) { | 229 | if (attention_info && try_module_get(attention_info->owner)) { |
230 | retval = attention_info->get_attn(hotplug_slot, value); | 230 | retval = attention_info->get_attn(hotplug_slot, value); |
@@ -247,7 +247,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
247 | { | 247 | { |
248 | struct slot *slot = hotplug_slot->private; | 248 | struct slot *slot = hotplug_slot->private; |
249 | 249 | ||
250 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 250 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
251 | 251 | ||
252 | *value = acpiphp_get_latch_status(slot->acpi_slot); | 252 | *value = acpiphp_get_latch_status(slot->acpi_slot); |
253 | 253 | ||
@@ -267,7 +267,7 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
267 | { | 267 | { |
268 | struct slot *slot = hotplug_slot->private; | 268 | struct slot *slot = hotplug_slot->private; |
269 | 269 | ||
270 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 270 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
271 | 271 | ||
272 | *value = acpiphp_get_adapter_status(slot->acpi_slot); | 272 | *value = acpiphp_get_adapter_status(slot->acpi_slot); |
273 | 273 | ||
@@ -284,7 +284,7 @@ static int get_address(struct hotplug_slot *hotplug_slot, u32 *value) | |||
284 | { | 284 | { |
285 | struct slot *slot = hotplug_slot->private; | 285 | struct slot *slot = hotplug_slot->private; |
286 | 286 | ||
287 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 287 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
288 | 288 | ||
289 | *value = acpiphp_get_address(slot->acpi_slot); | 289 | *value = acpiphp_get_address(slot->acpi_slot); |
290 | 290 | ||
@@ -318,7 +318,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
318 | { | 318 | { |
319 | struct slot *slot = hotplug_slot->private; | 319 | struct slot *slot = hotplug_slot->private; |
320 | 320 | ||
321 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 321 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
322 | 322 | ||
323 | kfree(slot->hotplug_slot); | 323 | kfree(slot->hotplug_slot); |
324 | kfree(slot); | 324 | kfree(slot); |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 5e50008d1181..648596d469f6 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -352,7 +352,7 @@ static void decode_hpp(struct acpiphp_bridge *bridge) | |||
352 | /* use default numbers */ | 352 | /* use default numbers */ |
353 | printk(KERN_WARNING | 353 | printk(KERN_WARNING |
354 | "%s: Could not get hotplug parameters. Use defaults\n", | 354 | "%s: Could not get hotplug parameters. Use defaults\n", |
355 | __FUNCTION__); | 355 | __func__); |
356 | bridge->hpp.t0 = &bridge->hpp.type0_data; | 356 | bridge->hpp.t0 = &bridge->hpp.type0_data; |
357 | bridge->hpp.t0->revision = 0; | 357 | bridge->hpp.t0->revision = 0; |
358 | bridge->hpp.t0->cache_line_size = 0x10; | 358 | bridge->hpp.t0->cache_line_size = 0x10; |
@@ -534,7 +534,7 @@ find_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
534 | 534 | ||
535 | status = acpi_evaluate_integer(handle, "_ADR", NULL, &tmp); | 535 | status = acpi_evaluate_integer(handle, "_ADR", NULL, &tmp); |
536 | if (ACPI_FAILURE(status)) { | 536 | if (ACPI_FAILURE(status)) { |
537 | dbg("%s: _ADR evaluation failure\n", __FUNCTION__); | 537 | dbg("%s: _ADR evaluation failure\n", __func__); |
538 | return AE_OK; | 538 | return AE_OK; |
539 | } | 539 | } |
540 | 540 | ||
@@ -578,7 +578,7 @@ static int add_bridge(acpi_handle handle) | |||
578 | if (ACPI_SUCCESS(status)) { | 578 | if (ACPI_SUCCESS(status)) { |
579 | status = acpi_evaluate_integer(handle, "_STA", NULL, &tmp); | 579 | status = acpi_evaluate_integer(handle, "_STA", NULL, &tmp); |
580 | if (ACPI_FAILURE(status)) { | 580 | if (ACPI_FAILURE(status)) { |
581 | dbg("%s: _STA evaluation failure\n", __FUNCTION__); | 581 | dbg("%s: _STA evaluation failure\n", __func__); |
582 | return 0; | 582 | return 0; |
583 | } | 583 | } |
584 | if ((tmp & ACPI_STA_FUNCTIONING) == 0) | 584 | if ((tmp & ACPI_STA_FUNCTIONING) == 0) |
@@ -928,10 +928,10 @@ static int power_on_slot(struct acpiphp_slot *slot) | |||
928 | func = list_entry(l, struct acpiphp_func, sibling); | 928 | func = list_entry(l, struct acpiphp_func, sibling); |
929 | 929 | ||
930 | if (func->flags & FUNC_HAS_PS0) { | 930 | if (func->flags & FUNC_HAS_PS0) { |
931 | dbg("%s: executing _PS0\n", __FUNCTION__); | 931 | dbg("%s: executing _PS0\n", __func__); |
932 | status = acpi_evaluate_object(func->handle, "_PS0", NULL, NULL); | 932 | status = acpi_evaluate_object(func->handle, "_PS0", NULL, NULL); |
933 | if (ACPI_FAILURE(status)) { | 933 | if (ACPI_FAILURE(status)) { |
934 | warn("%s: _PS0 failed\n", __FUNCTION__); | 934 | warn("%s: _PS0 failed\n", __func__); |
935 | retval = -1; | 935 | retval = -1; |
936 | goto err_exit; | 936 | goto err_exit; |
937 | } else | 937 | } else |
@@ -966,7 +966,7 @@ static int power_off_slot(struct acpiphp_slot *slot) | |||
966 | if (func->flags & FUNC_HAS_PS3) { | 966 | if (func->flags & FUNC_HAS_PS3) { |
967 | status = acpi_evaluate_object(func->handle, "_PS3", NULL, NULL); | 967 | status = acpi_evaluate_object(func->handle, "_PS3", NULL, NULL); |
968 | if (ACPI_FAILURE(status)) { | 968 | if (ACPI_FAILURE(status)) { |
969 | warn("%s: _PS3 failed\n", __FUNCTION__); | 969 | warn("%s: _PS3 failed\n", __func__); |
970 | retval = -1; | 970 | retval = -1; |
971 | goto err_exit; | 971 | goto err_exit; |
972 | } else | 972 | } else |
@@ -1300,7 +1300,7 @@ int acpiphp_eject_slot(struct acpiphp_slot *slot) | |||
1300 | 1300 | ||
1301 | status = acpi_evaluate_object(func->handle, "_EJ0", &arg_list, NULL); | 1301 | status = acpi_evaluate_object(func->handle, "_EJ0", &arg_list, NULL); |
1302 | if (ACPI_FAILURE(status)) { | 1302 | if (ACPI_FAILURE(status)) { |
1303 | warn("%s: _EJ0 failed\n", __FUNCTION__); | 1303 | warn("%s: _EJ0 failed\n", __func__); |
1304 | return -1; | 1304 | return -1; |
1305 | } else | 1305 | } else |
1306 | break; | 1306 | break; |
@@ -1349,7 +1349,7 @@ static int acpiphp_check_bridge(struct acpiphp_bridge *bridge) | |||
1349 | } | 1349 | } |
1350 | } | 1350 | } |
1351 | 1351 | ||
1352 | dbg("%s: %d enabled, %d disabled\n", __FUNCTION__, enabled, disabled); | 1352 | dbg("%s: %d enabled, %d disabled\n", __func__, enabled, disabled); |
1353 | 1353 | ||
1354 | err_exit: | 1354 | err_exit: |
1355 | return retval; | 1355 | return retval; |
@@ -1527,7 +1527,7 @@ check_sub_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
1527 | if (bridge) { | 1527 | if (bridge) { |
1528 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | 1528 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); |
1529 | dbg("%s: re-enumerating slots under %s\n", | 1529 | dbg("%s: re-enumerating slots under %s\n", |
1530 | __FUNCTION__, objname); | 1530 | __func__, objname); |
1531 | acpiphp_check_bridge(bridge); | 1531 | acpiphp_check_bridge(bridge); |
1532 | } | 1532 | } |
1533 | return AE_OK ; | 1533 | return AE_OK ; |
@@ -1572,10 +1572,10 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont | |||
1572 | switch (type) { | 1572 | switch (type) { |
1573 | case ACPI_NOTIFY_BUS_CHECK: | 1573 | case ACPI_NOTIFY_BUS_CHECK: |
1574 | /* bus re-enumerate */ | 1574 | /* bus re-enumerate */ |
1575 | dbg("%s: Bus check notify on %s\n", __FUNCTION__, objname); | 1575 | dbg("%s: Bus check notify on %s\n", __func__, objname); |
1576 | if (bridge) { | 1576 | if (bridge) { |
1577 | dbg("%s: re-enumerating slots under %s\n", | 1577 | dbg("%s: re-enumerating slots under %s\n", |
1578 | __FUNCTION__, objname); | 1578 | __func__, objname); |
1579 | acpiphp_check_bridge(bridge); | 1579 | acpiphp_check_bridge(bridge); |
1580 | } | 1580 | } |
1581 | if (num_sub_bridges) | 1581 | if (num_sub_bridges) |
@@ -1585,18 +1585,18 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont | |||
1585 | 1585 | ||
1586 | case ACPI_NOTIFY_DEVICE_CHECK: | 1586 | case ACPI_NOTIFY_DEVICE_CHECK: |
1587 | /* device check */ | 1587 | /* device check */ |
1588 | dbg("%s: Device check notify on %s\n", __FUNCTION__, objname); | 1588 | dbg("%s: Device check notify on %s\n", __func__, objname); |
1589 | acpiphp_check_bridge(bridge); | 1589 | acpiphp_check_bridge(bridge); |
1590 | break; | 1590 | break; |
1591 | 1591 | ||
1592 | case ACPI_NOTIFY_DEVICE_WAKE: | 1592 | case ACPI_NOTIFY_DEVICE_WAKE: |
1593 | /* wake event */ | 1593 | /* wake event */ |
1594 | dbg("%s: Device wake notify on %s\n", __FUNCTION__, objname); | 1594 | dbg("%s: Device wake notify on %s\n", __func__, objname); |
1595 | break; | 1595 | break; |
1596 | 1596 | ||
1597 | case ACPI_NOTIFY_EJECT_REQUEST: | 1597 | case ACPI_NOTIFY_EJECT_REQUEST: |
1598 | /* request device eject */ | 1598 | /* request device eject */ |
1599 | dbg("%s: Device eject notify on %s\n", __FUNCTION__, objname); | 1599 | dbg("%s: Device eject notify on %s\n", __func__, objname); |
1600 | if ((bridge->type != BRIDGE_TYPE_HOST) && | 1600 | if ((bridge->type != BRIDGE_TYPE_HOST) && |
1601 | (bridge->flags & BRIDGE_HAS_EJ0)) { | 1601 | (bridge->flags & BRIDGE_HAS_EJ0)) { |
1602 | struct acpiphp_slot *slot; | 1602 | struct acpiphp_slot *slot; |
@@ -1649,24 +1649,24 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *contex | |||
1649 | switch (type) { | 1649 | switch (type) { |
1650 | case ACPI_NOTIFY_BUS_CHECK: | 1650 | case ACPI_NOTIFY_BUS_CHECK: |
1651 | /* bus re-enumerate */ | 1651 | /* bus re-enumerate */ |
1652 | dbg("%s: Bus check notify on %s\n", __FUNCTION__, objname); | 1652 | dbg("%s: Bus check notify on %s\n", __func__, objname); |
1653 | acpiphp_enable_slot(func->slot); | 1653 | acpiphp_enable_slot(func->slot); |
1654 | break; | 1654 | break; |
1655 | 1655 | ||
1656 | case ACPI_NOTIFY_DEVICE_CHECK: | 1656 | case ACPI_NOTIFY_DEVICE_CHECK: |
1657 | /* device check : re-enumerate from parent bus */ | 1657 | /* device check : re-enumerate from parent bus */ |
1658 | dbg("%s: Device check notify on %s\n", __FUNCTION__, objname); | 1658 | dbg("%s: Device check notify on %s\n", __func__, objname); |
1659 | acpiphp_check_bridge(func->slot->bridge); | 1659 | acpiphp_check_bridge(func->slot->bridge); |
1660 | break; | 1660 | break; |
1661 | 1661 | ||
1662 | case ACPI_NOTIFY_DEVICE_WAKE: | 1662 | case ACPI_NOTIFY_DEVICE_WAKE: |
1663 | /* wake event */ | 1663 | /* wake event */ |
1664 | dbg("%s: Device wake notify on %s\n", __FUNCTION__, objname); | 1664 | dbg("%s: Device wake notify on %s\n", __func__, objname); |
1665 | break; | 1665 | break; |
1666 | 1666 | ||
1667 | case ACPI_NOTIFY_EJECT_REQUEST: | 1667 | case ACPI_NOTIFY_EJECT_REQUEST: |
1668 | /* request device eject */ | 1668 | /* request device eject */ |
1669 | dbg("%s: Device eject notify on %s\n", __FUNCTION__, objname); | 1669 | dbg("%s: Device eject notify on %s\n", __func__, objname); |
1670 | if (!(acpiphp_disable_slot(func->slot))) | 1670 | if (!(acpiphp_disable_slot(func->slot))) |
1671 | acpiphp_eject_slot(func->slot); | 1671 | acpiphp_eject_slot(func->slot); |
1672 | break; | 1672 | break; |
@@ -1796,7 +1796,7 @@ int acpiphp_enable_slot(struct acpiphp_slot *slot) | |||
1796 | if (retval) | 1796 | if (retval) |
1797 | power_off_slot(slot); | 1797 | power_off_slot(slot); |
1798 | } else { | 1798 | } else { |
1799 | dbg("%s: Slot status is not ACPI_STA_ALL\n", __FUNCTION__); | 1799 | dbg("%s: Slot status is not ACPI_STA_ALL\n", __func__); |
1800 | power_off_slot(slot); | 1800 | power_off_slot(slot); |
1801 | } | 1801 | } |
1802 | 1802 | ||
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c index b0a22b92717e..ede9051fdb5d 100644 --- a/drivers/pci/hotplug/acpiphp_ibm.c +++ b/drivers/pci/hotplug/acpiphp_ibm.c | |||
@@ -186,7 +186,7 @@ static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status) | |||
186 | 186 | ||
187 | ibm_slot = ibm_slot_from_id(hpslot_to_sun(slot)); | 187 | ibm_slot = ibm_slot_from_id(hpslot_to_sun(slot)); |
188 | 188 | ||
189 | dbg("%s: set slot %d (%d) attention status to %d\n", __FUNCTION__, | 189 | dbg("%s: set slot %d (%d) attention status to %d\n", __func__, |
190 | ibm_slot->slot.slot_num, ibm_slot->slot.slot_id, | 190 | ibm_slot->slot.slot_num, ibm_slot->slot.slot_id, |
191 | (status ? 1 : 0)); | 191 | (status ? 1 : 0)); |
192 | 192 | ||
@@ -231,7 +231,7 @@ static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status) | |||
231 | else | 231 | else |
232 | *status = 0; | 232 | *status = 0; |
233 | 233 | ||
234 | dbg("%s: get slot %d (%d) attention status is %d\n", __FUNCTION__, | 234 | dbg("%s: get slot %d (%d) attention status is %d\n", __func__, |
235 | ibm_slot->slot.slot_num, ibm_slot->slot.slot_id, | 235 | ibm_slot->slot.slot_num, ibm_slot->slot.slot_id, |
236 | *status); | 236 | *status); |
237 | 237 | ||
@@ -263,10 +263,10 @@ static void ibm_handle_events(acpi_handle handle, u32 event, void *context) | |||
263 | u8 subevent = event & 0xf0; | 263 | u8 subevent = event & 0xf0; |
264 | struct notification *note = context; | 264 | struct notification *note = context; |
265 | 265 | ||
266 | dbg("%s: Received notification %02x\n", __FUNCTION__, event); | 266 | dbg("%s: Received notification %02x\n", __func__, event); |
267 | 267 | ||
268 | if (subevent == 0x80) { | 268 | if (subevent == 0x80) { |
269 | dbg("%s: generationg bus event\n", __FUNCTION__); | 269 | dbg("%s: generationg bus event\n", __func__); |
270 | acpi_bus_generate_proc_event(note->device, note->event, detail); | 270 | acpi_bus_generate_proc_event(note->device, note->event, detail); |
271 | acpi_bus_generate_netlink_event(note->device->pnp.device_class, | 271 | acpi_bus_generate_netlink_event(note->device->pnp.device_class, |
272 | note->device->dev.bus_id, | 272 | note->device->dev.bus_id, |
@@ -299,7 +299,7 @@ static int ibm_get_table_from_acpi(char **bufp) | |||
299 | 299 | ||
300 | status = acpi_evaluate_object(ibm_acpi_handle, "APCI", NULL, &buffer); | 300 | status = acpi_evaluate_object(ibm_acpi_handle, "APCI", NULL, &buffer); |
301 | if (ACPI_FAILURE(status)) { | 301 | if (ACPI_FAILURE(status)) { |
302 | err("%s: APCI evaluation failed\n", __FUNCTION__); | 302 | err("%s: APCI evaluation failed\n", __func__); |
303 | return -ENODEV; | 303 | return -ENODEV; |
304 | } | 304 | } |
305 | 305 | ||
@@ -307,13 +307,13 @@ static int ibm_get_table_from_acpi(char **bufp) | |||
307 | if (!(package) || | 307 | if (!(package) || |
308 | (package->type != ACPI_TYPE_PACKAGE) || | 308 | (package->type != ACPI_TYPE_PACKAGE) || |
309 | !(package->package.elements)) { | 309 | !(package->package.elements)) { |
310 | err("%s: Invalid APCI object\n", __FUNCTION__); | 310 | err("%s: Invalid APCI object\n", __func__); |
311 | goto read_table_done; | 311 | goto read_table_done; |
312 | } | 312 | } |
313 | 313 | ||
314 | for(size = 0, i = 0; i < package->package.count; i++) { | 314 | for(size = 0, i = 0; i < package->package.count; i++) { |
315 | if (package->package.elements[i].type != ACPI_TYPE_BUFFER) { | 315 | if (package->package.elements[i].type != ACPI_TYPE_BUFFER) { |
316 | err("%s: Invalid APCI element %d\n", __FUNCTION__, i); | 316 | err("%s: Invalid APCI element %d\n", __func__, i); |
317 | goto read_table_done; | 317 | goto read_table_done; |
318 | } | 318 | } |
319 | size += package->package.elements[i].buffer.length; | 319 | size += package->package.elements[i].buffer.length; |
@@ -324,7 +324,7 @@ static int ibm_get_table_from_acpi(char **bufp) | |||
324 | 324 | ||
325 | lbuf = kzalloc(size, GFP_KERNEL); | 325 | lbuf = kzalloc(size, GFP_KERNEL); |
326 | dbg("%s: element count: %i, ASL table size: %i, &table = 0x%p\n", | 326 | dbg("%s: element count: %i, ASL table size: %i, &table = 0x%p\n", |
327 | __FUNCTION__, package->package.count, size, lbuf); | 327 | __func__, package->package.count, size, lbuf); |
328 | 328 | ||
329 | if (lbuf) { | 329 | if (lbuf) { |
330 | *bufp = lbuf; | 330 | *bufp = lbuf; |
@@ -368,7 +368,7 @@ static ssize_t ibm_read_apci_table(struct kobject *kobj, | |||
368 | int bytes_read = -EINVAL; | 368 | int bytes_read = -EINVAL; |
369 | char *table = NULL; | 369 | char *table = NULL; |
370 | 370 | ||
371 | dbg("%s: pos = %d, size = %zd\n", __FUNCTION__, (int)pos, size); | 371 | dbg("%s: pos = %d, size = %zd\n", __func__, (int)pos, size); |
372 | 372 | ||
373 | if (pos == 0) { | 373 | if (pos == 0) { |
374 | bytes_read = ibm_get_table_from_acpi(&table); | 374 | bytes_read = ibm_get_table_from_acpi(&table); |
@@ -402,7 +402,7 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle, | |||
402 | status = acpi_get_object_info(handle, &info_buffer); | 402 | status = acpi_get_object_info(handle, &info_buffer); |
403 | if (ACPI_FAILURE(status)) { | 403 | if (ACPI_FAILURE(status)) { |
404 | err("%s: Failed to get device information status=0x%x\n", | 404 | err("%s: Failed to get device information status=0x%x\n", |
405 | __FUNCTION__, status); | 405 | __func__, status); |
406 | return retval; | 406 | return retval; |
407 | } | 407 | } |
408 | info = info_buffer.pointer; | 408 | info = info_buffer.pointer; |
@@ -432,18 +432,18 @@ static int __init ibm_acpiphp_init(void) | |||
432 | struct acpi_device *device; | 432 | struct acpi_device *device; |
433 | struct kobject *sysdir = &pci_hotplug_slots_kset->kobj; | 433 | struct kobject *sysdir = &pci_hotplug_slots_kset->kobj; |
434 | 434 | ||
435 | dbg("%s\n", __FUNCTION__); | 435 | dbg("%s\n", __func__); |
436 | 436 | ||
437 | if (acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | 437 | if (acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
438 | ACPI_UINT32_MAX, ibm_find_acpi_device, | 438 | ACPI_UINT32_MAX, ibm_find_acpi_device, |
439 | &ibm_acpi_handle, NULL) != FOUND_APCI) { | 439 | &ibm_acpi_handle, NULL) != FOUND_APCI) { |
440 | err("%s: acpi_walk_namespace failed\n", __FUNCTION__); | 440 | err("%s: acpi_walk_namespace failed\n", __func__); |
441 | retval = -ENODEV; | 441 | retval = -ENODEV; |
442 | goto init_return; | 442 | goto init_return; |
443 | } | 443 | } |
444 | dbg("%s: found IBM aPCI device\n", __FUNCTION__); | 444 | dbg("%s: found IBM aPCI device\n", __func__); |
445 | if (acpi_bus_get_device(ibm_acpi_handle, &device)) { | 445 | if (acpi_bus_get_device(ibm_acpi_handle, &device)) { |
446 | err("%s: acpi_bus_get_device failed\n", __FUNCTION__); | 446 | err("%s: acpi_bus_get_device failed\n", __func__); |
447 | retval = -ENODEV; | 447 | retval = -ENODEV; |
448 | goto init_return; | 448 | goto init_return; |
449 | } | 449 | } |
@@ -458,7 +458,7 @@ static int __init ibm_acpiphp_init(void) | |||
458 | &ibm_note); | 458 | &ibm_note); |
459 | if (ACPI_FAILURE(status)) { | 459 | if (ACPI_FAILURE(status)) { |
460 | err("%s: Failed to register notification handler\n", | 460 | err("%s: Failed to register notification handler\n", |
461 | __FUNCTION__); | 461 | __func__); |
462 | retval = -EBUSY; | 462 | retval = -EBUSY; |
463 | goto init_cleanup; | 463 | goto init_cleanup; |
464 | } | 464 | } |
@@ -479,17 +479,17 @@ static void __exit ibm_acpiphp_exit(void) | |||
479 | acpi_status status; | 479 | acpi_status status; |
480 | struct kobject *sysdir = &pci_hotplug_slots_kset->kobj; | 480 | struct kobject *sysdir = &pci_hotplug_slots_kset->kobj; |
481 | 481 | ||
482 | dbg("%s\n", __FUNCTION__); | 482 | dbg("%s\n", __func__); |
483 | 483 | ||
484 | if (acpiphp_unregister_attention(&ibm_attention_info)) | 484 | if (acpiphp_unregister_attention(&ibm_attention_info)) |
485 | err("%s: attention info deregistration failed", __FUNCTION__); | 485 | err("%s: attention info deregistration failed", __func__); |
486 | 486 | ||
487 | status = acpi_remove_notify_handler( | 487 | status = acpi_remove_notify_handler( |
488 | ibm_acpi_handle, | 488 | ibm_acpi_handle, |
489 | ACPI_DEVICE_NOTIFY, | 489 | ACPI_DEVICE_NOTIFY, |
490 | ibm_handle_events); | 490 | ibm_handle_events); |
491 | if (ACPI_FAILURE(status)) | 491 | if (ACPI_FAILURE(status)) |
492 | err("%s: Notification handler removal failed\n", __FUNCTION__); | 492 | err("%s: Notification handler removal failed\n", __func__); |
493 | /* remove the /sys entries */ | 493 | /* remove the /sys entries */ |
494 | sysfs_remove_bin_file(sysdir, &ibm_apci_table_attr); | 494 | sysfs_remove_bin_file(sysdir, &ibm_apci_table_attr); |
495 | } | 495 | } |
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c index ed4d44e3332c..d8a6b80ab42a 100644 --- a/drivers/pci/hotplug/cpci_hotplug_core.c +++ b/drivers/pci/hotplug/cpci_hotplug_core.c | |||
@@ -108,7 +108,7 @@ enable_slot(struct hotplug_slot *hotplug_slot) | |||
108 | struct slot *slot = hotplug_slot->private; | 108 | struct slot *slot = hotplug_slot->private; |
109 | int retval = 0; | 109 | int retval = 0; |
110 | 110 | ||
111 | dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name); | 111 | dbg("%s - physical_slot = %s", __func__, hotplug_slot->name); |
112 | 112 | ||
113 | if (controller->ops->set_power) | 113 | if (controller->ops->set_power) |
114 | retval = controller->ops->set_power(slot, 1); | 114 | retval = controller->ops->set_power(slot, 1); |
@@ -121,25 +121,25 @@ disable_slot(struct hotplug_slot *hotplug_slot) | |||
121 | struct slot *slot = hotplug_slot->private; | 121 | struct slot *slot = hotplug_slot->private; |
122 | int retval = 0; | 122 | int retval = 0; |
123 | 123 | ||
124 | dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name); | 124 | dbg("%s - physical_slot = %s", __func__, hotplug_slot->name); |
125 | 125 | ||
126 | down_write(&list_rwsem); | 126 | down_write(&list_rwsem); |
127 | 127 | ||
128 | /* Unconfigure device */ | 128 | /* Unconfigure device */ |
129 | dbg("%s - unconfiguring slot %s", | 129 | dbg("%s - unconfiguring slot %s", |
130 | __FUNCTION__, slot->hotplug_slot->name); | 130 | __func__, slot->hotplug_slot->name); |
131 | if ((retval = cpci_unconfigure_slot(slot))) { | 131 | if ((retval = cpci_unconfigure_slot(slot))) { |
132 | err("%s - could not unconfigure slot %s", | 132 | err("%s - could not unconfigure slot %s", |
133 | __FUNCTION__, slot->hotplug_slot->name); | 133 | __func__, slot->hotplug_slot->name); |
134 | goto disable_error; | 134 | goto disable_error; |
135 | } | 135 | } |
136 | dbg("%s - finished unconfiguring slot %s", | 136 | dbg("%s - finished unconfiguring slot %s", |
137 | __FUNCTION__, slot->hotplug_slot->name); | 137 | __func__, slot->hotplug_slot->name); |
138 | 138 | ||
139 | /* Clear EXT (by setting it) */ | 139 | /* Clear EXT (by setting it) */ |
140 | if (cpci_clear_ext(slot)) { | 140 | if (cpci_clear_ext(slot)) { |
141 | err("%s - could not clear EXT for slot %s", | 141 | err("%s - could not clear EXT for slot %s", |
142 | __FUNCTION__, slot->hotplug_slot->name); | 142 | __func__, slot->hotplug_slot->name); |
143 | retval = -ENODEV; | 143 | retval = -ENODEV; |
144 | goto disable_error; | 144 | goto disable_error; |
145 | } | 145 | } |
@@ -372,7 +372,7 @@ init_slots(int clear_ins) | |||
372 | struct slot *slot; | 372 | struct slot *slot; |
373 | struct pci_dev* dev; | 373 | struct pci_dev* dev; |
374 | 374 | ||
375 | dbg("%s - enter", __FUNCTION__); | 375 | dbg("%s - enter", __func__); |
376 | down_read(&list_rwsem); | 376 | down_read(&list_rwsem); |
377 | if (!slots) { | 377 | if (!slots) { |
378 | up_read(&list_rwsem); | 378 | up_read(&list_rwsem); |
@@ -380,10 +380,10 @@ init_slots(int clear_ins) | |||
380 | } | 380 | } |
381 | list_for_each_entry(slot, &slot_list, slot_list) { | 381 | list_for_each_entry(slot, &slot_list, slot_list) { |
382 | dbg("%s - looking at slot %s", | 382 | dbg("%s - looking at slot %s", |
383 | __FUNCTION__, slot->hotplug_slot->name); | 383 | __func__, slot->hotplug_slot->name); |
384 | if (clear_ins && cpci_check_and_clear_ins(slot)) | 384 | if (clear_ins && cpci_check_and_clear_ins(slot)) |
385 | dbg("%s - cleared INS for slot %s", | 385 | dbg("%s - cleared INS for slot %s", |
386 | __FUNCTION__, slot->hotplug_slot->name); | 386 | __func__, slot->hotplug_slot->name); |
387 | dev = pci_get_slot(slot->bus, PCI_DEVFN(slot->number, 0)); | 387 | dev = pci_get_slot(slot->bus, PCI_DEVFN(slot->number, 0)); |
388 | if (dev) { | 388 | if (dev) { |
389 | if (update_adapter_status(slot->hotplug_slot, 1)) | 389 | if (update_adapter_status(slot->hotplug_slot, 1)) |
@@ -394,7 +394,7 @@ init_slots(int clear_ins) | |||
394 | } | 394 | } |
395 | } | 395 | } |
396 | up_read(&list_rwsem); | 396 | up_read(&list_rwsem); |
397 | dbg("%s - exit", __FUNCTION__); | 397 | dbg("%s - exit", __func__); |
398 | return 0; | 398 | return 0; |
399 | } | 399 | } |
400 | 400 | ||
@@ -415,7 +415,7 @@ check_slots(void) | |||
415 | extracted = inserted = 0; | 415 | extracted = inserted = 0; |
416 | list_for_each_entry(slot, &slot_list, slot_list) { | 416 | list_for_each_entry(slot, &slot_list, slot_list) { |
417 | dbg("%s - looking at slot %s", | 417 | dbg("%s - looking at slot %s", |
418 | __FUNCTION__, slot->hotplug_slot->name); | 418 | __func__, slot->hotplug_slot->name); |
419 | if (cpci_check_and_clear_ins(slot)) { | 419 | if (cpci_check_and_clear_ins(slot)) { |
420 | /* | 420 | /* |
421 | * Some broken hardware (e.g. PLX 9054AB) asserts | 421 | * Some broken hardware (e.g. PLX 9054AB) asserts |
@@ -430,28 +430,28 @@ check_slots(void) | |||
430 | 430 | ||
431 | /* Process insertion */ | 431 | /* Process insertion */ |
432 | dbg("%s - slot %s inserted", | 432 | dbg("%s - slot %s inserted", |
433 | __FUNCTION__, slot->hotplug_slot->name); | 433 | __func__, slot->hotplug_slot->name); |
434 | 434 | ||
435 | /* GSM, debug */ | 435 | /* GSM, debug */ |
436 | hs_csr = cpci_get_hs_csr(slot); | 436 | hs_csr = cpci_get_hs_csr(slot); |
437 | dbg("%s - slot %s HS_CSR (1) = %04x", | 437 | dbg("%s - slot %s HS_CSR (1) = %04x", |
438 | __FUNCTION__, slot->hotplug_slot->name, hs_csr); | 438 | __func__, slot->hotplug_slot->name, hs_csr); |
439 | 439 | ||
440 | /* Configure device */ | 440 | /* Configure device */ |
441 | dbg("%s - configuring slot %s", | 441 | dbg("%s - configuring slot %s", |
442 | __FUNCTION__, slot->hotplug_slot->name); | 442 | __func__, slot->hotplug_slot->name); |
443 | if (cpci_configure_slot(slot)) { | 443 | if (cpci_configure_slot(slot)) { |
444 | err("%s - could not configure slot %s", | 444 | err("%s - could not configure slot %s", |
445 | __FUNCTION__, slot->hotplug_slot->name); | 445 | __func__, slot->hotplug_slot->name); |
446 | continue; | 446 | continue; |
447 | } | 447 | } |
448 | dbg("%s - finished configuring slot %s", | 448 | dbg("%s - finished configuring slot %s", |
449 | __FUNCTION__, slot->hotplug_slot->name); | 449 | __func__, slot->hotplug_slot->name); |
450 | 450 | ||
451 | /* GSM, debug */ | 451 | /* GSM, debug */ |
452 | hs_csr = cpci_get_hs_csr(slot); | 452 | hs_csr = cpci_get_hs_csr(slot); |
453 | dbg("%s - slot %s HS_CSR (2) = %04x", | 453 | dbg("%s - slot %s HS_CSR (2) = %04x", |
454 | __FUNCTION__, slot->hotplug_slot->name, hs_csr); | 454 | __func__, slot->hotplug_slot->name, hs_csr); |
455 | 455 | ||
456 | if (update_latch_status(slot->hotplug_slot, 1)) | 456 | if (update_latch_status(slot->hotplug_slot, 1)) |
457 | warn("failure to update latch file"); | 457 | warn("failure to update latch file"); |
@@ -464,18 +464,18 @@ check_slots(void) | |||
464 | /* GSM, debug */ | 464 | /* GSM, debug */ |
465 | hs_csr = cpci_get_hs_csr(slot); | 465 | hs_csr = cpci_get_hs_csr(slot); |
466 | dbg("%s - slot %s HS_CSR (3) = %04x", | 466 | dbg("%s - slot %s HS_CSR (3) = %04x", |
467 | __FUNCTION__, slot->hotplug_slot->name, hs_csr); | 467 | __func__, slot->hotplug_slot->name, hs_csr); |
468 | 468 | ||
469 | inserted++; | 469 | inserted++; |
470 | } else if (cpci_check_ext(slot)) { | 470 | } else if (cpci_check_ext(slot)) { |
471 | /* Process extraction request */ | 471 | /* Process extraction request */ |
472 | dbg("%s - slot %s extracted", | 472 | dbg("%s - slot %s extracted", |
473 | __FUNCTION__, slot->hotplug_slot->name); | 473 | __func__, slot->hotplug_slot->name); |
474 | 474 | ||
475 | /* GSM, debug */ | 475 | /* GSM, debug */ |
476 | hs_csr = cpci_get_hs_csr(slot); | 476 | hs_csr = cpci_get_hs_csr(slot); |
477 | dbg("%s - slot %s HS_CSR = %04x", | 477 | dbg("%s - slot %s HS_CSR = %04x", |
478 | __FUNCTION__, slot->hotplug_slot->name, hs_csr); | 478 | __func__, slot->hotplug_slot->name, hs_csr); |
479 | 479 | ||
480 | if (!slot->extracting) { | 480 | if (!slot->extracting) { |
481 | if (update_latch_status(slot->hotplug_slot, 0)) { | 481 | if (update_latch_status(slot->hotplug_slot, 0)) { |
@@ -519,7 +519,7 @@ event_thread(void *data) | |||
519 | { | 519 | { |
520 | int rc; | 520 | int rc; |
521 | 521 | ||
522 | dbg("%s - event thread started", __FUNCTION__); | 522 | dbg("%s - event thread started", __func__); |
523 | while (1) { | 523 | while (1) { |
524 | dbg("event thread sleeping"); | 524 | dbg("event thread sleeping"); |
525 | set_current_state(TASK_INTERRUPTIBLE); | 525 | set_current_state(TASK_INTERRUPTIBLE); |
@@ -532,7 +532,7 @@ event_thread(void *data) | |||
532 | /* Give userspace a chance to handle extraction */ | 532 | /* Give userspace a chance to handle extraction */ |
533 | msleep(500); | 533 | msleep(500); |
534 | } else if (rc < 0) { | 534 | } else if (rc < 0) { |
535 | dbg("%s - error checking slots", __FUNCTION__); | 535 | dbg("%s - error checking slots", __func__); |
536 | thread_finished = 1; | 536 | thread_finished = 1; |
537 | goto out; | 537 | goto out; |
538 | } | 538 | } |
@@ -541,7 +541,7 @@ event_thread(void *data) | |||
541 | break; | 541 | break; |
542 | 542 | ||
543 | /* Re-enable ENUM# interrupt */ | 543 | /* Re-enable ENUM# interrupt */ |
544 | dbg("%s - re-enabling irq", __FUNCTION__); | 544 | dbg("%s - re-enabling irq", __func__); |
545 | controller->ops->enable_irq(); | 545 | controller->ops->enable_irq(); |
546 | } | 546 | } |
547 | out: | 547 | out: |
@@ -564,7 +564,7 @@ poll_thread(void *data) | |||
564 | /* Give userspace a chance to handle extraction */ | 564 | /* Give userspace a chance to handle extraction */ |
565 | msleep(500); | 565 | msleep(500); |
566 | } else if (rc < 0) { | 566 | } else if (rc < 0) { |
567 | dbg("%s - error checking slots", __FUNCTION__); | 567 | dbg("%s - error checking slots", __func__); |
568 | thread_finished = 1; | 568 | thread_finished = 1; |
569 | goto out; | 569 | goto out; |
570 | } | 570 | } |
@@ -621,7 +621,7 @@ cpci_hp_register_controller(struct cpci_hp_controller *new_controller) | |||
621 | status = -ENODEV; | 621 | status = -ENODEV; |
622 | } | 622 | } |
623 | dbg("%s - acquired controller irq %d", | 623 | dbg("%s - acquired controller irq %d", |
624 | __FUNCTION__, new_controller->irq); | 624 | __func__, new_controller->irq); |
625 | } | 625 | } |
626 | if (!status) | 626 | if (!status) |
627 | controller = new_controller; | 627 | controller = new_controller; |
@@ -673,7 +673,7 @@ cpci_hp_start(void) | |||
673 | static int first = 1; | 673 | static int first = 1; |
674 | int status; | 674 | int status; |
675 | 675 | ||
676 | dbg("%s - enter", __FUNCTION__); | 676 | dbg("%s - enter", __func__); |
677 | if (!controller) | 677 | if (!controller) |
678 | return -ENODEV; | 678 | return -ENODEV; |
679 | 679 | ||
@@ -693,14 +693,14 @@ cpci_hp_start(void) | |||
693 | status = cpci_start_thread(); | 693 | status = cpci_start_thread(); |
694 | if (status) | 694 | if (status) |
695 | return status; | 695 | return status; |
696 | dbg("%s - thread started", __FUNCTION__); | 696 | dbg("%s - thread started", __func__); |
697 | 697 | ||
698 | if (controller->irq) { | 698 | if (controller->irq) { |
699 | /* Start enum interrupt processing */ | 699 | /* Start enum interrupt processing */ |
700 | dbg("%s - enabling irq", __FUNCTION__); | 700 | dbg("%s - enabling irq", __func__); |
701 | controller->ops->enable_irq(); | 701 | controller->ops->enable_irq(); |
702 | } | 702 | } |
703 | dbg("%s - exit", __FUNCTION__); | 703 | dbg("%s - exit", __func__); |
704 | return 0; | 704 | return 0; |
705 | } | 705 | } |
706 | 706 | ||
@@ -711,7 +711,7 @@ cpci_hp_stop(void) | |||
711 | return -ENODEV; | 711 | return -ENODEV; |
712 | if (controller->irq) { | 712 | if (controller->irq) { |
713 | /* Stop enum interrupt processing */ | 713 | /* Stop enum interrupt processing */ |
714 | dbg("%s - disabling irq", __FUNCTION__); | 714 | dbg("%s - disabling irq", __func__); |
715 | controller->ops->disable_irq(); | 715 | controller->ops->disable_irq(); |
716 | } | 716 | } |
717 | cpci_stop_thread(); | 717 | cpci_stop_thread(); |
diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c index b3515fc4cd38..df82b95e2874 100644 --- a/drivers/pci/hotplug/cpci_hotplug_pci.c +++ b/drivers/pci/hotplug/cpci_hotplug_pci.c | |||
@@ -255,7 +255,7 @@ int __ref cpci_configure_slot(struct slot *slot) | |||
255 | struct pci_bus *parent; | 255 | struct pci_bus *parent; |
256 | int fn; | 256 | int fn; |
257 | 257 | ||
258 | dbg("%s - enter", __FUNCTION__); | 258 | dbg("%s - enter", __func__); |
259 | 259 | ||
260 | if (slot->dev == NULL) { | 260 | if (slot->dev == NULL) { |
261 | dbg("pci_dev null, finding %02x:%02x:%x", | 261 | dbg("pci_dev null, finding %02x:%02x:%x", |
@@ -273,7 +273,7 @@ int __ref cpci_configure_slot(struct slot *slot) | |||
273 | * we will only call this case when lookup fails. | 273 | * we will only call this case when lookup fails. |
274 | */ | 274 | */ |
275 | n = pci_scan_slot(slot->bus, slot->devfn); | 275 | n = pci_scan_slot(slot->bus, slot->devfn); |
276 | dbg("%s: pci_scan_slot returned %d", __FUNCTION__, n); | 276 | dbg("%s: pci_scan_slot returned %d", __func__, n); |
277 | slot->dev = pci_get_slot(slot->bus, slot->devfn); | 277 | slot->dev = pci_get_slot(slot->bus, slot->devfn); |
278 | if (slot->dev == NULL) { | 278 | if (slot->dev == NULL) { |
279 | err("Could not find PCI device for slot %02x", slot->number); | 279 | err("Could not find PCI device for slot %02x", slot->number); |
@@ -322,7 +322,7 @@ int __ref cpci_configure_slot(struct slot *slot) | |||
322 | pci_bus_add_devices(parent); | 322 | pci_bus_add_devices(parent); |
323 | pci_enable_bridges(parent); | 323 | pci_enable_bridges(parent); |
324 | 324 | ||
325 | dbg("%s - exit", __FUNCTION__); | 325 | dbg("%s - exit", __func__); |
326 | return 0; | 326 | return 0; |
327 | } | 327 | } |
328 | 328 | ||
@@ -331,7 +331,7 @@ int cpci_unconfigure_slot(struct slot* slot) | |||
331 | int i; | 331 | int i; |
332 | struct pci_dev *dev; | 332 | struct pci_dev *dev; |
333 | 333 | ||
334 | dbg("%s - enter", __FUNCTION__); | 334 | dbg("%s - enter", __func__); |
335 | if (!slot->dev) { | 335 | if (!slot->dev) { |
336 | err("No device for slot %02x\n", slot->number); | 336 | err("No device for slot %02x\n", slot->number); |
337 | return -ENODEV; | 337 | return -ENODEV; |
@@ -348,6 +348,6 @@ int cpci_unconfigure_slot(struct slot* slot) | |||
348 | pci_dev_put(slot->dev); | 348 | pci_dev_put(slot->dev); |
349 | slot->dev = NULL; | 349 | slot->dev = NULL; |
350 | 350 | ||
351 | dbg("%s - exit", __FUNCTION__); | 351 | dbg("%s - exit", __func__); |
352 | return 0; | 352 | return 0; |
353 | } | 353 | } |
diff --git a/drivers/pci/hotplug/cpcihp_generic.c b/drivers/pci/hotplug/cpcihp_generic.c index f3852a6b74ea..148fb463b81c 100644 --- a/drivers/pci/hotplug/cpcihp_generic.c +++ b/drivers/pci/hotplug/cpcihp_generic.c | |||
@@ -154,12 +154,18 @@ static int __init cpcihp_generic_init(void) | |||
154 | if(!r) | 154 | if(!r) |
155 | return -EBUSY; | 155 | return -EBUSY; |
156 | 156 | ||
157 | dev = pci_find_slot(bridge_busnr, PCI_DEVFN(bridge_slot, 0)); | 157 | bus = pci_find_bus(0, bridge_busnr); |
158 | if (!bus) { | ||
159 | err("Invalid bus number %d", bridge_busnr); | ||
160 | return -EINVAL; | ||
161 | } | ||
162 | dev = pci_get_slot(bus, PCI_DEVFN(bridge_slot, 0)); | ||
158 | if(!dev || dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { | 163 | if(!dev || dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { |
159 | err("Invalid bridge device %s", bridge); | 164 | err("Invalid bridge device %s", bridge); |
160 | return -EINVAL; | 165 | return -EINVAL; |
161 | } | 166 | } |
162 | bus = dev->subordinate; | 167 | bus = dev->subordinate; |
168 | pci_dev_put(dev); | ||
163 | 169 | ||
164 | memset(&generic_hpc, 0, sizeof (struct cpci_hp_controller)); | 170 | memset(&generic_hpc, 0, sizeof (struct cpci_hp_controller)); |
165 | generic_hpc_ops.query_enum = query_enum; | 171 | generic_hpc_ops.query_enum = query_enum; |
diff --git a/drivers/pci/hotplug/cpqphp.h b/drivers/pci/hotplug/cpqphp.h index 298ad7f3f4f4..b1decfa88b7a 100644 --- a/drivers/pci/hotplug/cpqphp.h +++ b/drivers/pci/hotplug/cpqphp.h | |||
@@ -674,7 +674,7 @@ static inline int cpq_get_latch_status(struct controller *ctrl, struct slot *slo | |||
674 | 674 | ||
675 | hp_slot = slot->device - ctrl->slot_device_offset; | 675 | hp_slot = slot->device - ctrl->slot_device_offset; |
676 | dbg("%s: slot->device = %d, ctrl->slot_device_offset = %d \n", | 676 | dbg("%s: slot->device = %d, ctrl->slot_device_offset = %d \n", |
677 | __FUNCTION__, slot->device, ctrl->slot_device_offset); | 677 | __func__, slot->device, ctrl->slot_device_offset); |
678 | 678 | ||
679 | status = (readl(ctrl->hpc_reg + INT_INPUT_CLEAR) & (0x01L << hp_slot)); | 679 | status = (readl(ctrl->hpc_reg + INT_INPUT_CLEAR) & (0x01L << hp_slot)); |
680 | 680 | ||
@@ -709,7 +709,7 @@ static inline int wait_for_ctrl_irq(struct controller *ctrl) | |||
709 | DECLARE_WAITQUEUE(wait, current); | 709 | DECLARE_WAITQUEUE(wait, current); |
710 | int retval = 0; | 710 | int retval = 0; |
711 | 711 | ||
712 | dbg("%s - start\n", __FUNCTION__); | 712 | dbg("%s - start\n", __func__); |
713 | add_wait_queue(&ctrl->queue, &wait); | 713 | add_wait_queue(&ctrl->queue, &wait); |
714 | /* Sleep for up to 1 second to wait for the LED to change. */ | 714 | /* Sleep for up to 1 second to wait for the LED to change. */ |
715 | msleep_interruptible(1000); | 715 | msleep_interruptible(1000); |
@@ -717,7 +717,7 @@ static inline int wait_for_ctrl_irq(struct controller *ctrl) | |||
717 | if (signal_pending(current)) | 717 | if (signal_pending(current)) |
718 | retval = -EINTR; | 718 | retval = -EINTR; |
719 | 719 | ||
720 | dbg("%s - end\n", __FUNCTION__); | 720 | dbg("%s - end\n", __func__); |
721 | return retval; | 721 | return retval; |
722 | } | 722 | } |
723 | 723 | ||
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index 74178875b949..36b115b27b0b 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c | |||
@@ -315,7 +315,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
315 | { | 315 | { |
316 | struct slot *slot = hotplug_slot->private; | 316 | struct slot *slot = hotplug_slot->private; |
317 | 317 | ||
318 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 318 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
319 | 319 | ||
320 | kfree(slot->hotplug_slot->info); | 320 | kfree(slot->hotplug_slot->info); |
321 | kfree(slot->hotplug_slot->name); | 321 | kfree(slot->hotplug_slot->name); |
@@ -338,7 +338,7 @@ static int ctrl_slot_setup(struct controller *ctrl, | |||
338 | void __iomem *slot_entry= NULL; | 338 | void __iomem *slot_entry= NULL; |
339 | int result = -ENOMEM; | 339 | int result = -ENOMEM; |
340 | 340 | ||
341 | dbg("%s\n", __FUNCTION__); | 341 | dbg("%s\n", __func__); |
342 | 342 | ||
343 | tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR); | 343 | tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR); |
344 | 344 | ||
@@ -513,7 +513,7 @@ get_slot_mapping(struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *slot) | |||
513 | 513 | ||
514 | u8 tbus, tdevice, tslot, bridgeSlot; | 514 | u8 tbus, tdevice, tslot, bridgeSlot; |
515 | 515 | ||
516 | dbg("%s: %p, %d, %d, %p\n", __FUNCTION__, bus, bus_num, dev_num, slot); | 516 | dbg("%s: %p, %d, %d, %p\n", __func__, bus, bus_num, dev_num, slot); |
517 | 517 | ||
518 | bridgeSlot = 0xFF; | 518 | bridgeSlot = 0xFF; |
519 | 519 | ||
@@ -636,7 +636,7 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) | |||
636 | u8 device; | 636 | u8 device; |
637 | u8 function; | 637 | u8 function; |
638 | 638 | ||
639 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 639 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
640 | 640 | ||
641 | if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) | 641 | if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) |
642 | return -ENODEV; | 642 | return -ENODEV; |
@@ -663,7 +663,7 @@ static int process_SI(struct hotplug_slot *hotplug_slot) | |||
663 | u8 device; | 663 | u8 device; |
664 | u8 function; | 664 | u8 function; |
665 | 665 | ||
666 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 666 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
667 | 667 | ||
668 | if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) | 668 | if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) |
669 | return -ENODEV; | 669 | return -ENODEV; |
@@ -695,7 +695,7 @@ static int process_SS(struct hotplug_slot *hotplug_slot) | |||
695 | u8 device; | 695 | u8 device; |
696 | u8 function; | 696 | u8 function; |
697 | 697 | ||
698 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 698 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
699 | 699 | ||
700 | if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) | 700 | if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) |
701 | return -ENODEV; | 701 | return -ENODEV; |
@@ -708,7 +708,7 @@ static int process_SS(struct hotplug_slot *hotplug_slot) | |||
708 | if (!slot_func) | 708 | if (!slot_func) |
709 | return -ENODEV; | 709 | return -ENODEV; |
710 | 710 | ||
711 | dbg("In %s, slot_func = %p, ctrl = %p\n", __FUNCTION__, slot_func, ctrl); | 711 | dbg("In %s, slot_func = %p, ctrl = %p\n", __func__, slot_func, ctrl); |
712 | return cpqhp_process_SS(ctrl, slot_func); | 712 | return cpqhp_process_SS(ctrl, slot_func); |
713 | } | 713 | } |
714 | 714 | ||
@@ -718,7 +718,7 @@ static int hardware_test(struct hotplug_slot *hotplug_slot, u32 value) | |||
718 | struct slot *slot = hotplug_slot->private; | 718 | struct slot *slot = hotplug_slot->private; |
719 | struct controller *ctrl = slot->ctrl; | 719 | struct controller *ctrl = slot->ctrl; |
720 | 720 | ||
721 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 721 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
722 | 722 | ||
723 | return cpqhp_hardware_test(ctrl, value); | 723 | return cpqhp_hardware_test(ctrl, value); |
724 | } | 724 | } |
@@ -729,7 +729,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
729 | struct slot *slot = hotplug_slot->private; | 729 | struct slot *slot = hotplug_slot->private; |
730 | struct controller *ctrl = slot->ctrl; | 730 | struct controller *ctrl = slot->ctrl; |
731 | 731 | ||
732 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 732 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
733 | 733 | ||
734 | *value = get_slot_enabled(ctrl, slot); | 734 | *value = get_slot_enabled(ctrl, slot); |
735 | return 0; | 735 | return 0; |
@@ -740,7 +740,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
740 | struct slot *slot = hotplug_slot->private; | 740 | struct slot *slot = hotplug_slot->private; |
741 | struct controller *ctrl = slot->ctrl; | 741 | struct controller *ctrl = slot->ctrl; |
742 | 742 | ||
743 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 743 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
744 | 744 | ||
745 | *value = cpq_get_attention_status(ctrl, slot); | 745 | *value = cpq_get_attention_status(ctrl, slot); |
746 | return 0; | 746 | return 0; |
@@ -751,7 +751,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
751 | struct slot *slot = hotplug_slot->private; | 751 | struct slot *slot = hotplug_slot->private; |
752 | struct controller *ctrl = slot->ctrl; | 752 | struct controller *ctrl = slot->ctrl; |
753 | 753 | ||
754 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 754 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
755 | 755 | ||
756 | *value = cpq_get_latch_status(ctrl, slot); | 756 | *value = cpq_get_latch_status(ctrl, slot); |
757 | 757 | ||
@@ -763,7 +763,7 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
763 | struct slot *slot = hotplug_slot->private; | 763 | struct slot *slot = hotplug_slot->private; |
764 | struct controller *ctrl = slot->ctrl; | 764 | struct controller *ctrl = slot->ctrl; |
765 | 765 | ||
766 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 766 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
767 | 767 | ||
768 | *value = get_presence_status(ctrl, slot); | 768 | *value = get_presence_status(ctrl, slot); |
769 | 769 | ||
@@ -775,7 +775,7 @@ static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp | |||
775 | struct slot *slot = hotplug_slot->private; | 775 | struct slot *slot = hotplug_slot->private; |
776 | struct controller *ctrl = slot->ctrl; | 776 | struct controller *ctrl = slot->ctrl; |
777 | 777 | ||
778 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 778 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
779 | 779 | ||
780 | *value = ctrl->speed_capability; | 780 | *value = ctrl->speed_capability; |
781 | 781 | ||
@@ -787,7 +787,7 @@ static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp | |||
787 | struct slot *slot = hotplug_slot->private; | 787 | struct slot *slot = hotplug_slot->private; |
788 | struct controller *ctrl = slot->ctrl; | 788 | struct controller *ctrl = slot->ctrl; |
789 | 789 | ||
790 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 790 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
791 | 791 | ||
792 | *value = ctrl->speed; | 792 | *value = ctrl->speed; |
793 | 793 | ||
@@ -841,7 +841,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
841 | // TODO: This code can be made to support non-Compaq or Intel subsystem IDs | 841 | // TODO: This code can be made to support non-Compaq or Intel subsystem IDs |
842 | rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vid); | 842 | rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vid); |
843 | if (rc) { | 843 | if (rc) { |
844 | err("%s : pci_read_config_word failed\n", __FUNCTION__); | 844 | err("%s : pci_read_config_word failed\n", __func__); |
845 | goto err_disable_device; | 845 | goto err_disable_device; |
846 | } | 846 | } |
847 | dbg("Subsystem Vendor ID: %x\n", subsystem_vid); | 847 | dbg("Subsystem Vendor ID: %x\n", subsystem_vid); |
@@ -853,14 +853,14 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
853 | 853 | ||
854 | ctrl = kzalloc(sizeof(struct controller), GFP_KERNEL); | 854 | ctrl = kzalloc(sizeof(struct controller), GFP_KERNEL); |
855 | if (!ctrl) { | 855 | if (!ctrl) { |
856 | err("%s : out of memory\n", __FUNCTION__); | 856 | err("%s : out of memory\n", __func__); |
857 | rc = -ENOMEM; | 857 | rc = -ENOMEM; |
858 | goto err_disable_device; | 858 | goto err_disable_device; |
859 | } | 859 | } |
860 | 860 | ||
861 | rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &subsystem_deviceid); | 861 | rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &subsystem_deviceid); |
862 | if (rc) { | 862 | if (rc) { |
863 | err("%s : pci_read_config_word failed\n", __FUNCTION__); | 863 | err("%s : pci_read_config_word failed\n", __func__); |
864 | goto err_free_ctrl; | 864 | goto err_free_ctrl; |
865 | } | 865 | } |
866 | 866 | ||
@@ -1142,7 +1142,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1142 | rc = cpqhp_save_config(ctrl, ctrl->bus, readb(ctrl->hpc_reg + SLOT_MASK)); | 1142 | rc = cpqhp_save_config(ctrl, ctrl->bus, readb(ctrl->hpc_reg + SLOT_MASK)); |
1143 | if (rc) { | 1143 | if (rc) { |
1144 | err("%s: unable to save PCI configuration data, error %d\n", | 1144 | err("%s: unable to save PCI configuration data, error %d\n", |
1145 | __FUNCTION__, rc); | 1145 | __func__, rc); |
1146 | goto err_iounmap; | 1146 | goto err_iounmap; |
1147 | } | 1147 | } |
1148 | 1148 | ||
@@ -1180,7 +1180,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1180 | if (rc) { | 1180 | if (rc) { |
1181 | err(msg_initialization_err, 6); | 1181 | err(msg_initialization_err, 6); |
1182 | err("%s: unable to save PCI configuration data, error %d\n", | 1182 | err("%s: unable to save PCI configuration data, error %d\n", |
1183 | __FUNCTION__, rc); | 1183 | __func__, rc); |
1184 | goto err_iounmap; | 1184 | goto err_iounmap; |
1185 | } | 1185 | } |
1186 | 1186 | ||
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 4018420c6f95..ef041ca91c27 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c | |||
@@ -737,12 +737,12 @@ static struct pci_resource *get_resource(struct pci_resource **head, u32 size) | |||
737 | 737 | ||
738 | for (node = *head; node; node = node->next) { | 738 | for (node = *head; node; node = node->next) { |
739 | dbg("%s: req_size =%x node=%p, base=%x, length=%x\n", | 739 | dbg("%s: req_size =%x node=%p, base=%x, length=%x\n", |
740 | __FUNCTION__, size, node, node->base, node->length); | 740 | __func__, size, node, node->base, node->length); |
741 | if (node->length < size) | 741 | if (node->length < size) |
742 | continue; | 742 | continue; |
743 | 743 | ||
744 | if (node->base & (size - 1)) { | 744 | if (node->base & (size - 1)) { |
745 | dbg("%s: not aligned\n", __FUNCTION__); | 745 | dbg("%s: not aligned\n", __func__); |
746 | /* this one isn't base aligned properly | 746 | /* this one isn't base aligned properly |
747 | * so we'll make a new entry and split it up */ | 747 | * so we'll make a new entry and split it up */ |
748 | temp_dword = (node->base | (size-1)) + 1; | 748 | temp_dword = (node->base | (size-1)) + 1; |
@@ -767,7 +767,7 @@ static struct pci_resource *get_resource(struct pci_resource **head, u32 size) | |||
767 | 767 | ||
768 | /* Don't need to check if too small since we already did */ | 768 | /* Don't need to check if too small since we already did */ |
769 | if (node->length > size) { | 769 | if (node->length > size) { |
770 | dbg("%s: too big\n", __FUNCTION__); | 770 | dbg("%s: too big\n", __func__); |
771 | /* this one is longer than we need | 771 | /* this one is longer than we need |
772 | * so we'll make a new entry and split it up */ | 772 | * so we'll make a new entry and split it up */ |
773 | split_node = kmalloc(sizeof(*split_node), GFP_KERNEL); | 773 | split_node = kmalloc(sizeof(*split_node), GFP_KERNEL); |
@@ -784,7 +784,7 @@ static struct pci_resource *get_resource(struct pci_resource **head, u32 size) | |||
784 | node->next = split_node; | 784 | node->next = split_node; |
785 | } /* End of too big on top end */ | 785 | } /* End of too big on top end */ |
786 | 786 | ||
787 | dbg("%s: got one!!!\n", __FUNCTION__); | 787 | dbg("%s: got one!!!\n", __func__); |
788 | /* If we got here, then it is the right size | 788 | /* If we got here, then it is the right size |
789 | * Now take it out of the list */ | 789 | * Now take it out of the list */ |
790 | if (*head == node) { | 790 | if (*head == node) { |
@@ -819,7 +819,7 @@ int cpqhp_resource_sort_and_combine(struct pci_resource **head) | |||
819 | struct pci_resource *node2; | 819 | struct pci_resource *node2; |
820 | int out_of_order = 1; | 820 | int out_of_order = 1; |
821 | 821 | ||
822 | dbg("%s: head = %p, *head = %p\n", __FUNCTION__, head, *head); | 822 | dbg("%s: head = %p, *head = %p\n", __func__, head, *head); |
823 | 823 | ||
824 | if (!(*head)) | 824 | if (!(*head)) |
825 | return 1; | 825 | return 1; |
@@ -907,7 +907,7 @@ irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data) | |||
907 | /* Read to clear posted writes */ | 907 | /* Read to clear posted writes */ |
908 | misc = readw(ctrl->hpc_reg + MISC); | 908 | misc = readw(ctrl->hpc_reg + MISC); |
909 | 909 | ||
910 | dbg ("%s - waking up\n", __FUNCTION__); | 910 | dbg ("%s - waking up\n", __func__); |
911 | wake_up_interruptible(&ctrl->queue); | 911 | wake_up_interruptible(&ctrl->queue); |
912 | } | 912 | } |
913 | 913 | ||
@@ -1421,7 +1421,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1421 | 1421 | ||
1422 | hp_slot = func->device - ctrl->slot_device_offset; | 1422 | hp_slot = func->device - ctrl->slot_device_offset; |
1423 | dbg("%s: func->device, slot_offset, hp_slot = %d, %d ,%d\n", | 1423 | dbg("%s: func->device, slot_offset, hp_slot = %d, %d ,%d\n", |
1424 | __FUNCTION__, func->device, ctrl->slot_device_offset, hp_slot); | 1424 | __func__, func->device, ctrl->slot_device_offset, hp_slot); |
1425 | 1425 | ||
1426 | mutex_lock(&ctrl->crit_sect); | 1426 | mutex_lock(&ctrl->crit_sect); |
1427 | 1427 | ||
@@ -1466,55 +1466,55 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1466 | 1466 | ||
1467 | /* turn on board and blink green LED */ | 1467 | /* turn on board and blink green LED */ |
1468 | 1468 | ||
1469 | dbg("%s: before down\n", __FUNCTION__); | 1469 | dbg("%s: before down\n", __func__); |
1470 | mutex_lock(&ctrl->crit_sect); | 1470 | mutex_lock(&ctrl->crit_sect); |
1471 | dbg("%s: after down\n", __FUNCTION__); | 1471 | dbg("%s: after down\n", __func__); |
1472 | 1472 | ||
1473 | dbg("%s: before slot_enable\n", __FUNCTION__); | 1473 | dbg("%s: before slot_enable\n", __func__); |
1474 | slot_enable (ctrl, hp_slot); | 1474 | slot_enable (ctrl, hp_slot); |
1475 | 1475 | ||
1476 | dbg("%s: before green_LED_blink\n", __FUNCTION__); | 1476 | dbg("%s: before green_LED_blink\n", __func__); |
1477 | green_LED_blink (ctrl, hp_slot); | 1477 | green_LED_blink (ctrl, hp_slot); |
1478 | 1478 | ||
1479 | dbg("%s: before amber_LED_blink\n", __FUNCTION__); | 1479 | dbg("%s: before amber_LED_blink\n", __func__); |
1480 | amber_LED_off (ctrl, hp_slot); | 1480 | amber_LED_off (ctrl, hp_slot); |
1481 | 1481 | ||
1482 | dbg("%s: before set_SOGO\n", __FUNCTION__); | 1482 | dbg("%s: before set_SOGO\n", __func__); |
1483 | set_SOGO(ctrl); | 1483 | set_SOGO(ctrl); |
1484 | 1484 | ||
1485 | /* Wait for SOBS to be unset */ | 1485 | /* Wait for SOBS to be unset */ |
1486 | dbg("%s: before wait_for_ctrl_irq\n", __FUNCTION__); | 1486 | dbg("%s: before wait_for_ctrl_irq\n", __func__); |
1487 | wait_for_ctrl_irq (ctrl); | 1487 | wait_for_ctrl_irq (ctrl); |
1488 | dbg("%s: after wait_for_ctrl_irq\n", __FUNCTION__); | 1488 | dbg("%s: after wait_for_ctrl_irq\n", __func__); |
1489 | 1489 | ||
1490 | dbg("%s: before up\n", __FUNCTION__); | 1490 | dbg("%s: before up\n", __func__); |
1491 | mutex_unlock(&ctrl->crit_sect); | 1491 | mutex_unlock(&ctrl->crit_sect); |
1492 | dbg("%s: after up\n", __FUNCTION__); | 1492 | dbg("%s: after up\n", __func__); |
1493 | 1493 | ||
1494 | /* Wait for ~1 second because of hot plug spec */ | 1494 | /* Wait for ~1 second because of hot plug spec */ |
1495 | dbg("%s: before long_delay\n", __FUNCTION__); | 1495 | dbg("%s: before long_delay\n", __func__); |
1496 | long_delay(1*HZ); | 1496 | long_delay(1*HZ); |
1497 | dbg("%s: after long_delay\n", __FUNCTION__); | 1497 | dbg("%s: after long_delay\n", __func__); |
1498 | 1498 | ||
1499 | dbg("%s: func status = %x\n", __FUNCTION__, func->status); | 1499 | dbg("%s: func status = %x\n", __func__, func->status); |
1500 | /* Check for a power fault */ | 1500 | /* Check for a power fault */ |
1501 | if (func->status == 0xFF) { | 1501 | if (func->status == 0xFF) { |
1502 | /* power fault occurred, but it was benign */ | 1502 | /* power fault occurred, but it was benign */ |
1503 | temp_register = 0xFFFFFFFF; | 1503 | temp_register = 0xFFFFFFFF; |
1504 | dbg("%s: temp register set to %x by power fault\n", __FUNCTION__, temp_register); | 1504 | dbg("%s: temp register set to %x by power fault\n", __func__, temp_register); |
1505 | rc = POWER_FAILURE; | 1505 | rc = POWER_FAILURE; |
1506 | func->status = 0; | 1506 | func->status = 0; |
1507 | } else { | 1507 | } else { |
1508 | /* Get vendor/device ID u32 */ | 1508 | /* Get vendor/device ID u32 */ |
1509 | ctrl->pci_bus->number = func->bus; | 1509 | ctrl->pci_bus->number = func->bus; |
1510 | rc = pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(func->device, func->function), PCI_VENDOR_ID, &temp_register); | 1510 | rc = pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(func->device, func->function), PCI_VENDOR_ID, &temp_register); |
1511 | dbg("%s: pci_read_config_dword returns %d\n", __FUNCTION__, rc); | 1511 | dbg("%s: pci_read_config_dword returns %d\n", __func__, rc); |
1512 | dbg("%s: temp_register is %x\n", __FUNCTION__, temp_register); | 1512 | dbg("%s: temp_register is %x\n", __func__, temp_register); |
1513 | 1513 | ||
1514 | if (rc != 0) { | 1514 | if (rc != 0) { |
1515 | /* Something's wrong here */ | 1515 | /* Something's wrong here */ |
1516 | temp_register = 0xFFFFFFFF; | 1516 | temp_register = 0xFFFFFFFF; |
1517 | dbg("%s: temp register set to %x by error\n", __FUNCTION__, temp_register); | 1517 | dbg("%s: temp register set to %x by error\n", __func__, temp_register); |
1518 | } | 1518 | } |
1519 | /* Preset return code. It will be changed later if things go okay. */ | 1519 | /* Preset return code. It will be changed later if things go okay. */ |
1520 | rc = NO_ADAPTER_PRESENT; | 1520 | rc = NO_ADAPTER_PRESENT; |
@@ -1530,7 +1530,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1530 | 1530 | ||
1531 | rc = configure_new_device(ctrl, func, 0, &res_lists); | 1531 | rc = configure_new_device(ctrl, func, 0, &res_lists); |
1532 | 1532 | ||
1533 | dbg("%s: back from configure_new_device\n", __FUNCTION__); | 1533 | dbg("%s: back from configure_new_device\n", __func__); |
1534 | ctrl->io_head = res_lists.io_head; | 1534 | ctrl->io_head = res_lists.io_head; |
1535 | ctrl->mem_head = res_lists.mem_head; | 1535 | ctrl->mem_head = res_lists.mem_head; |
1536 | ctrl->p_mem_head = res_lists.p_mem_head; | 1536 | ctrl->p_mem_head = res_lists.p_mem_head; |
@@ -1566,7 +1566,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1566 | 1566 | ||
1567 | /* next, we will instantiate the linux pci_dev structures (with | 1567 | /* next, we will instantiate the linux pci_dev structures (with |
1568 | * appropriate driver notification, if already present) */ | 1568 | * appropriate driver notification, if already present) */ |
1569 | dbg("%s: configure linux pci_dev structure\n", __FUNCTION__); | 1569 | dbg("%s: configure linux pci_dev structure\n", __func__); |
1570 | index = 0; | 1570 | index = 0; |
1571 | do { | 1571 | do { |
1572 | new_slot = cpqhp_slot_find(ctrl->bus, func->device, index++); | 1572 | new_slot = cpqhp_slot_find(ctrl->bus, func->device, index++); |
@@ -1628,7 +1628,7 @@ static u32 remove_board(struct pci_func * func, u32 replace_flag, struct control | |||
1628 | device = func->device; | 1628 | device = func->device; |
1629 | 1629 | ||
1630 | hp_slot = func->device - ctrl->slot_device_offset; | 1630 | hp_slot = func->device - ctrl->slot_device_offset; |
1631 | dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); | 1631 | dbg("In %s, hp_slot = %d\n", __func__, hp_slot); |
1632 | 1632 | ||
1633 | /* When we get here, it is safe to change base address registers. | 1633 | /* When we get here, it is safe to change base address registers. |
1634 | * We will attempt to save the base address register lengths */ | 1634 | * We will attempt to save the base address register lengths */ |
@@ -1928,7 +1928,7 @@ void cpqhp_pushbutton_thread(unsigned long slot) | |||
1928 | func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0); | 1928 | func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0); |
1929 | dbg("In power_down_board, func = %p, ctrl = %p\n", func, ctrl); | 1929 | dbg("In power_down_board, func = %p, ctrl = %p\n", func, ctrl); |
1930 | if (!func) { | 1930 | if (!func) { |
1931 | dbg("Error! func NULL in %s\n", __FUNCTION__); | 1931 | dbg("Error! func NULL in %s\n", __func__); |
1932 | return ; | 1932 | return ; |
1933 | } | 1933 | } |
1934 | 1934 | ||
@@ -1950,7 +1950,7 @@ void cpqhp_pushbutton_thread(unsigned long slot) | |||
1950 | func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0); | 1950 | func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0); |
1951 | dbg("In add_board, func = %p, ctrl = %p\n", func, ctrl); | 1951 | dbg("In add_board, func = %p, ctrl = %p\n", func, ctrl); |
1952 | if (!func) { | 1952 | if (!func) { |
1953 | dbg("Error! func NULL in %s\n", __FUNCTION__); | 1953 | dbg("Error! func NULL in %s\n", __func__); |
1954 | return ; | 1954 | return ; |
1955 | } | 1955 | } |
1956 | 1956 | ||
@@ -2058,7 +2058,7 @@ int cpqhp_process_SI(struct controller *ctrl, struct pci_func *func) | |||
2058 | } | 2058 | } |
2059 | 2059 | ||
2060 | if (rc) { | 2060 | if (rc) { |
2061 | dbg("%s: rc = %d\n", __FUNCTION__, rc); | 2061 | dbg("%s: rc = %d\n", __func__, rc); |
2062 | } | 2062 | } |
2063 | 2063 | ||
2064 | if (p_slot) | 2064 | if (p_slot) |
@@ -2269,12 +2269,12 @@ static u32 configure_new_device(struct controller * ctrl, struct pci_func * func | |||
2269 | 2269 | ||
2270 | new_slot = func; | 2270 | new_slot = func; |
2271 | 2271 | ||
2272 | dbg("%s\n", __FUNCTION__); | 2272 | dbg("%s\n", __func__); |
2273 | /* Check for Multi-function device */ | 2273 | /* Check for Multi-function device */ |
2274 | ctrl->pci_bus->number = func->bus; | 2274 | ctrl->pci_bus->number = func->bus; |
2275 | rc = pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(func->device, func->function), 0x0E, &temp_byte); | 2275 | rc = pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(func->device, func->function), 0x0E, &temp_byte); |
2276 | if (rc) { | 2276 | if (rc) { |
2277 | dbg("%s: rc = %d\n", __FUNCTION__, rc); | 2277 | dbg("%s: rc = %d\n", __func__, rc); |
2278 | return rc; | 2278 | return rc; |
2279 | } | 2279 | } |
2280 | 2280 | ||
diff --git a/drivers/pci/hotplug/cpqphp_nvram.c b/drivers/pci/hotplug/cpqphp_nvram.c index ae5e974c45a7..cb174888002b 100644 --- a/drivers/pci/hotplug/cpqphp_nvram.c +++ b/drivers/pci/hotplug/cpqphp_nvram.c | |||
@@ -160,7 +160,7 @@ static int check_for_compaq_ROM (void __iomem *rom_start) | |||
160 | (temp6 == 'Q')) { | 160 | (temp6 == 'Q')) { |
161 | result = 1; | 161 | result = 1; |
162 | } | 162 | } |
163 | dbg ("%s - returned %d\n", __FUNCTION__, result); | 163 | dbg ("%s - returned %d\n", __func__, result); |
164 | return result; | 164 | return result; |
165 | } | 165 | } |
166 | 166 | ||
diff --git a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c index 3f6cd20e95d2..09021930589f 100644 --- a/drivers/pci/hotplug/cpqphp_pci.c +++ b/drivers/pci/hotplug/cpqphp_pci.c | |||
@@ -120,7 +120,7 @@ int cpqhp_unconfigure_device(struct pci_func* func) | |||
120 | { | 120 | { |
121 | int j; | 121 | int j; |
122 | 122 | ||
123 | dbg("%s: bus/dev/func = %x/%x/%x\n", __FUNCTION__, func->bus, func->device, func->function); | 123 | dbg("%s: bus/dev/func = %x/%x/%x\n", __func__, func->bus, func->device, func->function); |
124 | 124 | ||
125 | for (j=0; j<8 ; j++) { | 125 | for (j=0; j<8 ; j++) { |
126 | struct pci_dev* temp = pci_find_slot(func->bus, PCI_DEVFN(func->device, j)); | 126 | struct pci_dev* temp = pci_find_slot(func->bus, PCI_DEVFN(func->device, j)); |
@@ -170,11 +170,11 @@ int cpqhp_set_irq (u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num) | |||
170 | fakedev->bus = fakebus; | 170 | fakedev->bus = fakebus; |
171 | fakebus->number = bus_num; | 171 | fakebus->number = bus_num; |
172 | dbg("%s: dev %d, bus %d, pin %d, num %d\n", | 172 | dbg("%s: dev %d, bus %d, pin %d, num %d\n", |
173 | __FUNCTION__, dev_num, bus_num, int_pin, irq_num); | 173 | __func__, dev_num, bus_num, int_pin, irq_num); |
174 | rc = pcibios_set_irq_routing(fakedev, int_pin - 0x0a, irq_num); | 174 | rc = pcibios_set_irq_routing(fakedev, int_pin - 0x0a, irq_num); |
175 | kfree(fakedev); | 175 | kfree(fakedev); |
176 | kfree(fakebus); | 176 | kfree(fakebus); |
177 | dbg("%s: rc %d\n", __FUNCTION__, rc); | 177 | dbg("%s: rc %d\n", __func__, rc); |
178 | if (!rc) | 178 | if (!rc) |
179 | return !rc; | 179 | return !rc; |
180 | 180 | ||
@@ -1423,7 +1423,7 @@ int cpqhp_return_board_resources(struct pci_func * func, struct resource_lists * | |||
1423 | int rc = 0; | 1423 | int rc = 0; |
1424 | struct pci_resource *node; | 1424 | struct pci_resource *node; |
1425 | struct pci_resource *t_node; | 1425 | struct pci_resource *t_node; |
1426 | dbg("%s\n", __FUNCTION__); | 1426 | dbg("%s\n", __func__); |
1427 | 1427 | ||
1428 | if (!func) | 1428 | if (!func) |
1429 | return 1; | 1429 | return 1; |
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c index 94b640146d44..7e9a827c2687 100644 --- a/drivers/pci/hotplug/fakephp.c +++ b/drivers/pci/hotplug/fakephp.c | |||
@@ -293,7 +293,7 @@ static int enable_slot(struct hotplug_slot *hotplug_slot) | |||
293 | /* mis-use enable_slot for rescanning of the pci bus */ | 293 | /* mis-use enable_slot for rescanning of the pci bus */ |
294 | cancel_work_sync(&pci_rescan_work); | 294 | cancel_work_sync(&pci_rescan_work); |
295 | queue_work(dummyphp_wq, &pci_rescan_work); | 295 | queue_work(dummyphp_wq, &pci_rescan_work); |
296 | return -ENODEV; | 296 | return 0; |
297 | } | 297 | } |
298 | 298 | ||
299 | /* find the hotplug_slot for the pci_dev */ | 299 | /* find the hotplug_slot for the pci_dev */ |
@@ -320,7 +320,7 @@ static int disable_slot(struct hotplug_slot *slot) | |||
320 | return -ENODEV; | 320 | return -ENODEV; |
321 | dslot = slot->private; | 321 | dslot = slot->private; |
322 | 322 | ||
323 | dbg("%s - physical_slot = %s\n", __FUNCTION__, slot->name); | 323 | dbg("%s - physical_slot = %s\n", __func__, slot->name); |
324 | 324 | ||
325 | /* don't disable bridged devices just yet, we can't handle them easily... */ | 325 | /* don't disable bridged devices just yet, we can't handle them easily... */ |
326 | if (dslot->dev->subordinate) { | 326 | if (dslot->dev->subordinate) { |
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c index 87b6b8b280e6..c892daae74d6 100644 --- a/drivers/pci/hotplug/ibmphp_core.c +++ b/drivers/pci/hotplug/ibmphp_core.c | |||
@@ -148,8 +148,10 @@ int ibmphp_init_devno(struct slot **cur_slot) | |||
148 | len = (rtable->size - sizeof(struct irq_routing_table)) / | 148 | len = (rtable->size - sizeof(struct irq_routing_table)) / |
149 | sizeof(struct irq_info); | 149 | sizeof(struct irq_info); |
150 | 150 | ||
151 | if (!len) | 151 | if (!len) { |
152 | kfree(rtable); | ||
152 | return -1; | 153 | return -1; |
154 | } | ||
153 | for (loop = 0; loop < len; loop++) { | 155 | for (loop = 0; loop < len; loop++) { |
154 | if ((*cur_slot)->number == rtable->slots[loop].slot) { | 156 | if ((*cur_slot)->number == rtable->slots[loop].slot) { |
155 | if ((*cur_slot)->bus == rtable->slots[loop].bus) { | 157 | if ((*cur_slot)->bus == rtable->slots[loop].bus) { |
@@ -187,11 +189,13 @@ int ibmphp_init_devno(struct slot **cur_slot) | |||
187 | debug("rtable->slots[loop].irq[3].link = %x\n", | 189 | debug("rtable->slots[loop].irq[3].link = %x\n", |
188 | rtable->slots[loop].irq[3].link); | 190 | rtable->slots[loop].irq[3].link); |
189 | debug("end of init_devno\n"); | 191 | debug("end of init_devno\n"); |
192 | kfree(rtable); | ||
190 | return 0; | 193 | return 0; |
191 | } | 194 | } |
192 | } | 195 | } |
193 | } | 196 | } |
194 | 197 | ||
198 | kfree(rtable); | ||
195 | return -1; | 199 | return -1; |
196 | } | 200 | } |
197 | 201 | ||
@@ -395,7 +399,7 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe | |||
395 | struct slot *pslot; | 399 | struct slot *pslot; |
396 | u8 mode = 0; | 400 | u8 mode = 0; |
397 | 401 | ||
398 | debug("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __FUNCTION__, | 402 | debug("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __func__, |
399 | hotplug_slot, value); | 403 | hotplug_slot, value); |
400 | 404 | ||
401 | ibmphp_lock_operations(); | 405 | ibmphp_lock_operations(); |
@@ -425,7 +429,7 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe | |||
425 | } | 429 | } |
426 | 430 | ||
427 | ibmphp_unlock_operations(); | 431 | ibmphp_unlock_operations(); |
428 | debug("%s - Exit rc[%d] value[%x]\n", __FUNCTION__, rc, *value); | 432 | debug("%s - Exit rc[%d] value[%x]\n", __func__, rc, *value); |
429 | return rc; | 433 | return rc; |
430 | } | 434 | } |
431 | 435 | ||
@@ -435,7 +439,7 @@ static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe | |||
435 | struct slot *pslot; | 439 | struct slot *pslot; |
436 | u8 mode = 0; | 440 | u8 mode = 0; |
437 | 441 | ||
438 | debug("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __FUNCTION__, | 442 | debug("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __func__, |
439 | hotplug_slot, value); | 443 | hotplug_slot, value); |
440 | 444 | ||
441 | ibmphp_lock_operations(); | 445 | ibmphp_lock_operations(); |
@@ -471,7 +475,7 @@ static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe | |||
471 | } | 475 | } |
472 | 476 | ||
473 | ibmphp_unlock_operations(); | 477 | ibmphp_unlock_operations(); |
474 | debug("%s - Exit rc[%d] value[%x]\n", __FUNCTION__, rc, *value); | 478 | debug("%s - Exit rc[%d] value[%x]\n", __func__, rc, *value); |
475 | return rc; | 479 | return rc; |
476 | } | 480 | } |
477 | 481 | ||
@@ -741,13 +745,13 @@ static void free_slots(void) | |||
741 | struct list_head * tmp; | 745 | struct list_head * tmp; |
742 | struct list_head * next; | 746 | struct list_head * next; |
743 | 747 | ||
744 | debug("%s -- enter\n", __FUNCTION__); | 748 | debug("%s -- enter\n", __func__); |
745 | 749 | ||
746 | list_for_each_safe(tmp, next, &ibmphp_slot_head) { | 750 | list_for_each_safe(tmp, next, &ibmphp_slot_head) { |
747 | slot_cur = list_entry(tmp, struct slot, ibm_slot_list); | 751 | slot_cur = list_entry(tmp, struct slot, ibm_slot_list); |
748 | pci_hp_deregister(slot_cur->hotplug_slot); | 752 | pci_hp_deregister(slot_cur->hotplug_slot); |
749 | } | 753 | } |
750 | debug("%s -- exit\n", __FUNCTION__); | 754 | debug("%s -- exit\n", __func__); |
751 | } | 755 | } |
752 | 756 | ||
753 | static void ibm_unconfigure_device(struct pci_func *func) | 757 | static void ibm_unconfigure_device(struct pci_func *func) |
@@ -755,7 +759,7 @@ static void ibm_unconfigure_device(struct pci_func *func) | |||
755 | struct pci_dev *temp; | 759 | struct pci_dev *temp; |
756 | u8 j; | 760 | u8 j; |
757 | 761 | ||
758 | debug("inside %s\n", __FUNCTION__); | 762 | debug("inside %s\n", __func__); |
759 | debug("func->device = %x, func->function = %x\n", | 763 | debug("func->device = %x, func->function = %x\n", |
760 | func->device, func->function); | 764 | func->device, func->function); |
761 | debug("func->device << 3 | 0x0 = %x\n", func->device << 3 | 0x0); | 765 | debug("func->device << 3 | 0x0 = %x\n", func->device << 3 | 0x0); |
@@ -786,13 +790,13 @@ static u8 bus_structure_fixup(u8 busno) | |||
786 | 790 | ||
787 | bus = kmalloc(sizeof(*bus), GFP_KERNEL); | 791 | bus = kmalloc(sizeof(*bus), GFP_KERNEL); |
788 | if (!bus) { | 792 | if (!bus) { |
789 | err("%s - out of memory\n", __FUNCTION__); | 793 | err("%s - out of memory\n", __func__); |
790 | return 1; | 794 | return 1; |
791 | } | 795 | } |
792 | dev = kmalloc(sizeof(*dev), GFP_KERNEL); | 796 | dev = kmalloc(sizeof(*dev), GFP_KERNEL); |
793 | if (!dev) { | 797 | if (!dev) { |
794 | kfree(bus); | 798 | kfree(bus); |
795 | err("%s - out of memory\n", __FUNCTION__); | 799 | err("%s - out of memory\n", __func__); |
796 | return 1; | 800 | return 1; |
797 | } | 801 | } |
798 | 802 | ||
@@ -803,7 +807,7 @@ static u8 bus_structure_fixup(u8 busno) | |||
803 | if (!pci_read_config_word(dev, PCI_VENDOR_ID, &l) && | 807 | if (!pci_read_config_word(dev, PCI_VENDOR_ID, &l) && |
804 | (l != 0x0000) && (l != 0xffff)) { | 808 | (l != 0x0000) && (l != 0xffff)) { |
805 | debug("%s - Inside bus_struture_fixup()\n", | 809 | debug("%s - Inside bus_struture_fixup()\n", |
806 | __FUNCTION__); | 810 | __func__); |
807 | pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL); | 811 | pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL); |
808 | break; | 812 | break; |
809 | } | 813 | } |
@@ -900,7 +904,7 @@ static int set_bus(struct slot * slot_cur) | |||
900 | { }, | 904 | { }, |
901 | }; | 905 | }; |
902 | 906 | ||
903 | debug("%s - entry slot # %d\n", __FUNCTION__, slot_cur->number); | 907 | debug("%s - entry slot # %d\n", __func__, slot_cur->number); |
904 | if (SET_BUS_STATUS(slot_cur->ctrl) && is_bus_empty(slot_cur)) { | 908 | if (SET_BUS_STATUS(slot_cur->ctrl) && is_bus_empty(slot_cur)) { |
905 | rc = slot_update(&slot_cur); | 909 | rc = slot_update(&slot_cur); |
906 | if (rc) | 910 | if (rc) |
@@ -975,7 +979,7 @@ static int set_bus(struct slot * slot_cur) | |||
975 | /* This is for x440, once Brandon fixes the firmware, | 979 | /* This is for x440, once Brandon fixes the firmware, |
976 | will not need this delay */ | 980 | will not need this delay */ |
977 | msleep(1000); | 981 | msleep(1000); |
978 | debug("%s -Exit\n", __FUNCTION__); | 982 | debug("%s -Exit\n", __func__); |
979 | return 0; | 983 | return 0; |
980 | } | 984 | } |
981 | 985 | ||
diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c index bbccde9f228f..dca7efc14be2 100644 --- a/drivers/pci/hotplug/ibmphp_ebda.c +++ b/drivers/pci/hotplug/ibmphp_ebda.c | |||
@@ -127,18 +127,18 @@ static void __init print_bus_info (void) | |||
127 | 127 | ||
128 | list_for_each (ptr1, &bus_info_head) { | 128 | list_for_each (ptr1, &bus_info_head) { |
129 | ptr = list_entry (ptr1, struct bus_info, bus_info_list); | 129 | ptr = list_entry (ptr1, struct bus_info, bus_info_list); |
130 | debug ("%s - slot_min = %x\n", __FUNCTION__, ptr->slot_min); | 130 | debug ("%s - slot_min = %x\n", __func__, ptr->slot_min); |
131 | debug ("%s - slot_max = %x\n", __FUNCTION__, ptr->slot_max); | 131 | debug ("%s - slot_max = %x\n", __func__, ptr->slot_max); |
132 | debug ("%s - slot_count = %x\n", __FUNCTION__, ptr->slot_count); | 132 | debug ("%s - slot_count = %x\n", __func__, ptr->slot_count); |
133 | debug ("%s - bus# = %x\n", __FUNCTION__, ptr->busno); | 133 | debug ("%s - bus# = %x\n", __func__, ptr->busno); |
134 | debug ("%s - current_speed = %x\n", __FUNCTION__, ptr->current_speed); | 134 | debug ("%s - current_speed = %x\n", __func__, ptr->current_speed); |
135 | debug ("%s - controller_id = %x\n", __FUNCTION__, ptr->controller_id); | 135 | debug ("%s - controller_id = %x\n", __func__, ptr->controller_id); |
136 | 136 | ||
137 | debug ("%s - slots_at_33_conv = %x\n", __FUNCTION__, ptr->slots_at_33_conv); | 137 | debug ("%s - slots_at_33_conv = %x\n", __func__, ptr->slots_at_33_conv); |
138 | debug ("%s - slots_at_66_conv = %x\n", __FUNCTION__, ptr->slots_at_66_conv); | 138 | debug ("%s - slots_at_66_conv = %x\n", __func__, ptr->slots_at_66_conv); |
139 | debug ("%s - slots_at_66_pcix = %x\n", __FUNCTION__, ptr->slots_at_66_pcix); | 139 | debug ("%s - slots_at_66_pcix = %x\n", __func__, ptr->slots_at_66_pcix); |
140 | debug ("%s - slots_at_100_pcix = %x\n", __FUNCTION__, ptr->slots_at_100_pcix); | 140 | debug ("%s - slots_at_100_pcix = %x\n", __func__, ptr->slots_at_100_pcix); |
141 | debug ("%s - slots_at_133_pcix = %x\n", __FUNCTION__, ptr->slots_at_133_pcix); | 141 | debug ("%s - slots_at_133_pcix = %x\n", __func__, ptr->slots_at_133_pcix); |
142 | 142 | ||
143 | } | 143 | } |
144 | } | 144 | } |
@@ -150,12 +150,12 @@ static void print_lo_info (void) | |||
150 | debug ("print_lo_info ----\n"); | 150 | debug ("print_lo_info ----\n"); |
151 | list_for_each (ptr1, &rio_lo_head) { | 151 | list_for_each (ptr1, &rio_lo_head) { |
152 | ptr = list_entry (ptr1, struct rio_detail, rio_detail_list); | 152 | ptr = list_entry (ptr1, struct rio_detail, rio_detail_list); |
153 | debug ("%s - rio_node_id = %x\n", __FUNCTION__, ptr->rio_node_id); | 153 | debug ("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); |
154 | debug ("%s - rio_type = %x\n", __FUNCTION__, ptr->rio_type); | 154 | debug ("%s - rio_type = %x\n", __func__, ptr->rio_type); |
155 | debug ("%s - owner_id = %x\n", __FUNCTION__, ptr->owner_id); | 155 | debug ("%s - owner_id = %x\n", __func__, ptr->owner_id); |
156 | debug ("%s - first_slot_num = %x\n", __FUNCTION__, ptr->first_slot_num); | 156 | debug ("%s - first_slot_num = %x\n", __func__, ptr->first_slot_num); |
157 | debug ("%s - wpindex = %x\n", __FUNCTION__, ptr->wpindex); | 157 | debug ("%s - wpindex = %x\n", __func__, ptr->wpindex); |
158 | debug ("%s - chassis_num = %x\n", __FUNCTION__, ptr->chassis_num); | 158 | debug ("%s - chassis_num = %x\n", __func__, ptr->chassis_num); |
159 | 159 | ||
160 | } | 160 | } |
161 | } | 161 | } |
@@ -164,15 +164,15 @@ static void print_vg_info (void) | |||
164 | { | 164 | { |
165 | struct rio_detail *ptr; | 165 | struct rio_detail *ptr; |
166 | struct list_head *ptr1; | 166 | struct list_head *ptr1; |
167 | debug ("%s ---\n", __FUNCTION__); | 167 | debug ("%s ---\n", __func__); |
168 | list_for_each (ptr1, &rio_vg_head) { | 168 | list_for_each (ptr1, &rio_vg_head) { |
169 | ptr = list_entry (ptr1, struct rio_detail, rio_detail_list); | 169 | ptr = list_entry (ptr1, struct rio_detail, rio_detail_list); |
170 | debug ("%s - rio_node_id = %x\n", __FUNCTION__, ptr->rio_node_id); | 170 | debug ("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); |
171 | debug ("%s - rio_type = %x\n", __FUNCTION__, ptr->rio_type); | 171 | debug ("%s - rio_type = %x\n", __func__, ptr->rio_type); |
172 | debug ("%s - owner_id = %x\n", __FUNCTION__, ptr->owner_id); | 172 | debug ("%s - owner_id = %x\n", __func__, ptr->owner_id); |
173 | debug ("%s - first_slot_num = %x\n", __FUNCTION__, ptr->first_slot_num); | 173 | debug ("%s - first_slot_num = %x\n", __func__, ptr->first_slot_num); |
174 | debug ("%s - wpindex = %x\n", __FUNCTION__, ptr->wpindex); | 174 | debug ("%s - wpindex = %x\n", __func__, ptr->wpindex); |
175 | debug ("%s - chassis_num = %x\n", __FUNCTION__, ptr->chassis_num); | 175 | debug ("%s - chassis_num = %x\n", __func__, ptr->chassis_num); |
176 | 176 | ||
177 | } | 177 | } |
178 | } | 178 | } |
@@ -185,7 +185,7 @@ static void __init print_ebda_pci_rsrc (void) | |||
185 | list_for_each (ptr1, &ibmphp_ebda_pci_rsrc_head) { | 185 | list_for_each (ptr1, &ibmphp_ebda_pci_rsrc_head) { |
186 | ptr = list_entry (ptr1, struct ebda_pci_rsrc, ebda_pci_rsrc_list); | 186 | ptr = list_entry (ptr1, struct ebda_pci_rsrc, ebda_pci_rsrc_list); |
187 | debug ("%s - rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", | 187 | debug ("%s - rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", |
188 | __FUNCTION__, ptr->rsrc_type ,ptr->bus_num, ptr->dev_fun,ptr->start_addr, ptr->end_addr); | 188 | __func__, ptr->rsrc_type ,ptr->bus_num, ptr->dev_fun,ptr->start_addr, ptr->end_addr); |
189 | } | 189 | } |
190 | } | 190 | } |
191 | 191 | ||
@@ -196,7 +196,7 @@ static void __init print_ibm_slot (void) | |||
196 | 196 | ||
197 | list_for_each (ptr1, &ibmphp_slot_head) { | 197 | list_for_each (ptr1, &ibmphp_slot_head) { |
198 | ptr = list_entry (ptr1, struct slot, ibm_slot_list); | 198 | ptr = list_entry (ptr1, struct slot, ibm_slot_list); |
199 | debug ("%s - slot_number: %x\n", __FUNCTION__, ptr->number); | 199 | debug ("%s - slot_number: %x\n", __func__, ptr->number); |
200 | } | 200 | } |
201 | } | 201 | } |
202 | 202 | ||
@@ -204,13 +204,13 @@ static void __init print_opt_vg (void) | |||
204 | { | 204 | { |
205 | struct opt_rio *ptr; | 205 | struct opt_rio *ptr; |
206 | struct list_head *ptr1; | 206 | struct list_head *ptr1; |
207 | debug ("%s ---\n", __FUNCTION__); | 207 | debug ("%s ---\n", __func__); |
208 | list_for_each (ptr1, &opt_vg_head) { | 208 | list_for_each (ptr1, &opt_vg_head) { |
209 | ptr = list_entry (ptr1, struct opt_rio, opt_rio_list); | 209 | ptr = list_entry (ptr1, struct opt_rio, opt_rio_list); |
210 | debug ("%s - rio_type %x\n", __FUNCTION__, ptr->rio_type); | 210 | debug ("%s - rio_type %x\n", __func__, ptr->rio_type); |
211 | debug ("%s - chassis_num: %x\n", __FUNCTION__, ptr->chassis_num); | 211 | debug ("%s - chassis_num: %x\n", __func__, ptr->chassis_num); |
212 | debug ("%s - first_slot_num: %x\n", __FUNCTION__, ptr->first_slot_num); | 212 | debug ("%s - first_slot_num: %x\n", __func__, ptr->first_slot_num); |
213 | debug ("%s - middle_num: %x\n", __FUNCTION__, ptr->middle_num); | 213 | debug ("%s - middle_num: %x\n", __func__, ptr->middle_num); |
214 | } | 214 | } |
215 | } | 215 | } |
216 | 216 | ||
@@ -225,35 +225,35 @@ static void __init print_ebda_hpc (void) | |||
225 | hpc_ptr = list_entry (ptr1, struct controller, ebda_hpc_list); | 225 | hpc_ptr = list_entry (ptr1, struct controller, ebda_hpc_list); |
226 | 226 | ||
227 | for (index = 0; index < hpc_ptr->slot_count; index++) { | 227 | for (index = 0; index < hpc_ptr->slot_count; index++) { |
228 | debug ("%s - physical slot#: %x\n", __FUNCTION__, hpc_ptr->slots[index].slot_num); | 228 | debug ("%s - physical slot#: %x\n", __func__, hpc_ptr->slots[index].slot_num); |
229 | debug ("%s - pci bus# of the slot: %x\n", __FUNCTION__, hpc_ptr->slots[index].slot_bus_num); | 229 | debug ("%s - pci bus# of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_bus_num); |
230 | debug ("%s - index into ctlr addr: %x\n", __FUNCTION__, hpc_ptr->slots[index].ctl_index); | 230 | debug ("%s - index into ctlr addr: %x\n", __func__, hpc_ptr->slots[index].ctl_index); |
231 | debug ("%s - cap of the slot: %x\n", __FUNCTION__, hpc_ptr->slots[index].slot_cap); | 231 | debug ("%s - cap of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_cap); |
232 | } | 232 | } |
233 | 233 | ||
234 | for (index = 0; index < hpc_ptr->bus_count; index++) { | 234 | for (index = 0; index < hpc_ptr->bus_count; index++) { |
235 | debug ("%s - bus# of each bus controlled by this ctlr: %x\n", __FUNCTION__, hpc_ptr->buses[index].bus_num); | 235 | debug ("%s - bus# of each bus controlled by this ctlr: %x\n", __func__, hpc_ptr->buses[index].bus_num); |
236 | } | 236 | } |
237 | 237 | ||
238 | debug ("%s - type of hpc: %x\n", __FUNCTION__, hpc_ptr->ctlr_type); | 238 | debug ("%s - type of hpc: %x\n", __func__, hpc_ptr->ctlr_type); |
239 | switch (hpc_ptr->ctlr_type) { | 239 | switch (hpc_ptr->ctlr_type) { |
240 | case 1: | 240 | case 1: |
241 | debug ("%s - bus: %x\n", __FUNCTION__, hpc_ptr->u.pci_ctlr.bus); | 241 | debug ("%s - bus: %x\n", __func__, hpc_ptr->u.pci_ctlr.bus); |
242 | debug ("%s - dev_fun: %x\n", __FUNCTION__, hpc_ptr->u.pci_ctlr.dev_fun); | 242 | debug ("%s - dev_fun: %x\n", __func__, hpc_ptr->u.pci_ctlr.dev_fun); |
243 | debug ("%s - irq: %x\n", __FUNCTION__, hpc_ptr->irq); | 243 | debug ("%s - irq: %x\n", __func__, hpc_ptr->irq); |
244 | break; | 244 | break; |
245 | 245 | ||
246 | case 0: | 246 | case 0: |
247 | debug ("%s - io_start: %x\n", __FUNCTION__, hpc_ptr->u.isa_ctlr.io_start); | 247 | debug ("%s - io_start: %x\n", __func__, hpc_ptr->u.isa_ctlr.io_start); |
248 | debug ("%s - io_end: %x\n", __FUNCTION__, hpc_ptr->u.isa_ctlr.io_end); | 248 | debug ("%s - io_end: %x\n", __func__, hpc_ptr->u.isa_ctlr.io_end); |
249 | debug ("%s - irq: %x\n", __FUNCTION__, hpc_ptr->irq); | 249 | debug ("%s - irq: %x\n", __func__, hpc_ptr->irq); |
250 | break; | 250 | break; |
251 | 251 | ||
252 | case 2: | 252 | case 2: |
253 | case 4: | 253 | case 4: |
254 | debug ("%s - wpegbbar: %lx\n", __FUNCTION__, hpc_ptr->u.wpeg_ctlr.wpegbbar); | 254 | debug ("%s - wpegbbar: %lx\n", __func__, hpc_ptr->u.wpeg_ctlr.wpegbbar); |
255 | debug ("%s - i2c_addr: %x\n", __FUNCTION__, hpc_ptr->u.wpeg_ctlr.i2c_addr); | 255 | debug ("%s - i2c_addr: %x\n", __func__, hpc_ptr->u.wpeg_ctlr.i2c_addr); |
256 | debug ("%s - irq: %x\n", __FUNCTION__, hpc_ptr->irq); | 256 | debug ("%s - irq: %x\n", __func__, hpc_ptr->irq); |
257 | break; | 257 | break; |
258 | } | 258 | } |
259 | } | 259 | } |
diff --git a/drivers/pci/hotplug/ibmphp_hpc.c b/drivers/pci/hotplug/ibmphp_hpc.c index c31e7bf34502..83f337c891a9 100644 --- a/drivers/pci/hotplug/ibmphp_hpc.c +++ b/drivers/pci/hotplug/ibmphp_hpc.c | |||
@@ -129,14 +129,14 @@ static int hpc_wait_ctlr_notworking (int, struct controller *, void __iomem *, u | |||
129 | *---------------------------------------------------------------------*/ | 129 | *---------------------------------------------------------------------*/ |
130 | void __init ibmphp_hpc_initvars (void) | 130 | void __init ibmphp_hpc_initvars (void) |
131 | { | 131 | { |
132 | debug ("%s - Entry\n", __FUNCTION__); | 132 | debug ("%s - Entry\n", __func__); |
133 | 133 | ||
134 | mutex_init(&sem_hpcaccess); | 134 | mutex_init(&sem_hpcaccess); |
135 | init_MUTEX (&semOperations); | 135 | init_MUTEX (&semOperations); |
136 | init_MUTEX_LOCKED (&sem_exit); | 136 | init_MUTEX_LOCKED (&sem_exit); |
137 | to_debug = 0; | 137 | to_debug = 0; |
138 | 138 | ||
139 | debug ("%s - Exit\n", __FUNCTION__); | 139 | debug ("%s - Exit\n", __func__); |
140 | } | 140 | } |
141 | 141 | ||
142 | /*---------------------------------------------------------------------- | 142 | /*---------------------------------------------------------------------- |
@@ -154,7 +154,7 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 | |||
154 | unsigned long ultemp; | 154 | unsigned long ultemp; |
155 | unsigned long data; // actual data HILO format | 155 | unsigned long data; // actual data HILO format |
156 | 156 | ||
157 | debug_polling ("%s - Entry WPGBbar[%p] index[%x] \n", __FUNCTION__, WPGBbar, index); | 157 | debug_polling ("%s - Entry WPGBbar[%p] index[%x] \n", __func__, WPGBbar, index); |
158 | 158 | ||
159 | //-------------------------------------------------------------------- | 159 | //-------------------------------------------------------------------- |
160 | // READ - step 1 | 160 | // READ - step 1 |
@@ -213,7 +213,7 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 | |||
213 | i--; | 213 | i--; |
214 | } | 214 | } |
215 | if (i == 0) { | 215 | if (i == 0) { |
216 | debug ("%s - Error : WPG timeout\n", __FUNCTION__); | 216 | debug ("%s - Error : WPG timeout\n", __func__); |
217 | return HPC_ERROR; | 217 | return HPC_ERROR; |
218 | } | 218 | } |
219 | //-------------------------------------------------------------------- | 219 | //-------------------------------------------------------------------- |
@@ -241,7 +241,7 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 | |||
241 | 241 | ||
242 | status = (u8) data; | 242 | status = (u8) data; |
243 | 243 | ||
244 | debug_polling ("%s - Exit index[%x] status[%x]\n", __FUNCTION__, index, status); | 244 | debug_polling ("%s - Exit index[%x] status[%x]\n", __func__, index, status); |
245 | 245 | ||
246 | return (status); | 246 | return (status); |
247 | } | 247 | } |
@@ -262,7 +262,7 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 | |||
262 | unsigned long data; // actual data HILO format | 262 | unsigned long data; // actual data HILO format |
263 | int i; | 263 | int i; |
264 | 264 | ||
265 | debug_polling ("%s - Entry WPGBbar[%p] index[%x] cmd[%x]\n", __FUNCTION__, WPGBbar, index, cmd); | 265 | debug_polling ("%s - Entry WPGBbar[%p] index[%x] cmd[%x]\n", __func__, WPGBbar, index, cmd); |
266 | 266 | ||
267 | rc = 0; | 267 | rc = 0; |
268 | //-------------------------------------------------------------------- | 268 | //-------------------------------------------------------------------- |
@@ -324,7 +324,7 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 | |||
324 | i--; | 324 | i--; |
325 | } | 325 | } |
326 | if (i == 0) { | 326 | if (i == 0) { |
327 | debug ("%s - Exit Error:WPG timeout\n", __FUNCTION__); | 327 | debug ("%s - Exit Error:WPG timeout\n", __func__); |
328 | rc = HPC_ERROR; | 328 | rc = HPC_ERROR; |
329 | } | 329 | } |
330 | 330 | ||
@@ -345,7 +345,7 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 | |||
345 | rc = HPC_ERROR; | 345 | rc = HPC_ERROR; |
346 | } | 346 | } |
347 | 347 | ||
348 | debug_polling ("%s Exit rc[%x]\n", __FUNCTION__, rc); | 348 | debug_polling ("%s Exit rc[%x]\n", __func__, rc); |
349 | return (rc); | 349 | return (rc); |
350 | } | 350 | } |
351 | 351 | ||
@@ -541,12 +541,12 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus) | |||
541 | int rc = 0; | 541 | int rc = 0; |
542 | int busindex; | 542 | int busindex; |
543 | 543 | ||
544 | debug_polling ("%s - Entry pslot[%p] cmd[%x] pstatus[%p]\n", __FUNCTION__, pslot, cmd, pstatus); | 544 | debug_polling ("%s - Entry pslot[%p] cmd[%x] pstatus[%p]\n", __func__, pslot, cmd, pstatus); |
545 | 545 | ||
546 | if ((pslot == NULL) | 546 | if ((pslot == NULL) |
547 | || ((pstatus == NULL) && (cmd != READ_ALLSTAT) && (cmd != READ_BUSSTATUS))) { | 547 | || ((pstatus == NULL) && (cmd != READ_ALLSTAT) && (cmd != READ_BUSSTATUS))) { |
548 | rc = -EINVAL; | 548 | rc = -EINVAL; |
549 | err ("%s - Error invalid pointer, rc[%d]\n", __FUNCTION__, rc); | 549 | err ("%s - Error invalid pointer, rc[%d]\n", __func__, rc); |
550 | return rc; | 550 | return rc; |
551 | } | 551 | } |
552 | 552 | ||
@@ -554,7 +554,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus) | |||
554 | busindex = ibmphp_get_bus_index (pslot->bus); | 554 | busindex = ibmphp_get_bus_index (pslot->bus); |
555 | if (busindex < 0) { | 555 | if (busindex < 0) { |
556 | rc = -EINVAL; | 556 | rc = -EINVAL; |
557 | err ("%s - Exit Error:invalid bus, rc[%d]\n", __FUNCTION__, rc); | 557 | err ("%s - Exit Error:invalid bus, rc[%d]\n", __func__, rc); |
558 | return rc; | 558 | return rc; |
559 | } else | 559 | } else |
560 | index = (u8) busindex; | 560 | index = (u8) busindex; |
@@ -565,7 +565,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus) | |||
565 | 565 | ||
566 | if (index == HPC_ERROR) { | 566 | if (index == HPC_ERROR) { |
567 | rc = -EINVAL; | 567 | rc = -EINVAL; |
568 | err ("%s - Exit Error:invalid index, rc[%d]\n", __FUNCTION__, rc); | 568 | err ("%s - Exit Error:invalid index, rc[%d]\n", __func__, rc); |
569 | return rc; | 569 | return rc; |
570 | } | 570 | } |
571 | 571 | ||
@@ -641,7 +641,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus) | |||
641 | ctrl_read (ctlr_ptr, wpg_bbar, | 641 | ctrl_read (ctlr_ptr, wpg_bbar, |
642 | index + WPG_1ST_EXTSLOT_INDEX); | 642 | index + WPG_1ST_EXTSLOT_INDEX); |
643 | } else { | 643 | } else { |
644 | err ("%s - Error ctrl_read failed\n", __FUNCTION__); | 644 | err ("%s - Error ctrl_read failed\n", __func__); |
645 | rc = -EINVAL; | 645 | rc = -EINVAL; |
646 | break; | 646 | break; |
647 | } | 647 | } |
@@ -662,7 +662,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus) | |||
662 | 662 | ||
663 | free_hpc_access (); | 663 | free_hpc_access (); |
664 | 664 | ||
665 | debug_polling ("%s - Exit rc[%d]\n", __FUNCTION__, rc); | 665 | debug_polling ("%s - Exit rc[%d]\n", __func__, rc); |
666 | return rc; | 666 | return rc; |
667 | } | 667 | } |
668 | 668 | ||
@@ -681,10 +681,10 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd) | |||
681 | int rc = 0; | 681 | int rc = 0; |
682 | int timeout; | 682 | int timeout; |
683 | 683 | ||
684 | debug_polling ("%s - Entry pslot[%p] cmd[%x]\n", __FUNCTION__, pslot, cmd); | 684 | debug_polling ("%s - Entry pslot[%p] cmd[%x]\n", __func__, pslot, cmd); |
685 | if (pslot == NULL) { | 685 | if (pslot == NULL) { |
686 | rc = -EINVAL; | 686 | rc = -EINVAL; |
687 | err ("%s - Error Exit rc[%d]\n", __FUNCTION__, rc); | 687 | err ("%s - Error Exit rc[%d]\n", __func__, rc); |
688 | return rc; | 688 | return rc; |
689 | } | 689 | } |
690 | 690 | ||
@@ -694,7 +694,7 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd) | |||
694 | busindex = ibmphp_get_bus_index (pslot->bus); | 694 | busindex = ibmphp_get_bus_index (pslot->bus); |
695 | if (busindex < 0) { | 695 | if (busindex < 0) { |
696 | rc = -EINVAL; | 696 | rc = -EINVAL; |
697 | err ("%s - Exit Error:invalid bus, rc[%d]\n", __FUNCTION__, rc); | 697 | err ("%s - Exit Error:invalid bus, rc[%d]\n", __func__, rc); |
698 | return rc; | 698 | return rc; |
699 | } else | 699 | } else |
700 | index = (u8) busindex; | 700 | index = (u8) busindex; |
@@ -705,7 +705,7 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd) | |||
705 | 705 | ||
706 | if (index == HPC_ERROR) { | 706 | if (index == HPC_ERROR) { |
707 | rc = -EINVAL; | 707 | rc = -EINVAL; |
708 | err ("%s - Error Exit rc[%d]\n", __FUNCTION__, rc); | 708 | err ("%s - Error Exit rc[%d]\n", __func__, rc); |
709 | return rc; | 709 | return rc; |
710 | } | 710 | } |
711 | 711 | ||
@@ -719,7 +719,7 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd) | |||
719 | if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) { | 719 | if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) { |
720 | wpg_bbar = ioremap (ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE); | 720 | wpg_bbar = ioremap (ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE); |
721 | 721 | ||
722 | debug ("%s - ctlr id[%x] physical[%lx] logical[%lx] i2c[%x]\n", __FUNCTION__, | 722 | debug ("%s - ctlr id[%x] physical[%lx] logical[%lx] i2c[%x]\n", __func__, |
723 | ctlr_ptr->ctlr_id, (ulong) (ctlr_ptr->u.wpeg_ctlr.wpegbbar), (ulong) wpg_bbar, | 723 | ctlr_ptr->ctlr_id, (ulong) (ctlr_ptr->u.wpeg_ctlr.wpegbbar), (ulong) wpg_bbar, |
724 | ctlr_ptr->u.wpeg_ctlr.i2c_addr); | 724 | ctlr_ptr->u.wpeg_ctlr.i2c_addr); |
725 | } | 725 | } |
@@ -750,7 +750,7 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd) | |||
750 | msleep(1000); | 750 | msleep(1000); |
751 | if (timeout < 1) { | 751 | if (timeout < 1) { |
752 | done = 1; | 752 | done = 1; |
753 | err ("%s - Error command complete timeout\n", __FUNCTION__); | 753 | err ("%s - Error command complete timeout\n", __func__); |
754 | rc = -EFAULT; | 754 | rc = -EFAULT; |
755 | } else | 755 | } else |
756 | timeout--; | 756 | timeout--; |
@@ -765,7 +765,7 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd) | |||
765 | iounmap (wpg_bbar); | 765 | iounmap (wpg_bbar); |
766 | free_hpc_access (); | 766 | free_hpc_access (); |
767 | 767 | ||
768 | debug_polling ("%s - Exit rc[%d]\n", __FUNCTION__, rc); | 768 | debug_polling ("%s - Exit rc[%d]\n", __func__, rc); |
769 | return rc; | 769 | return rc; |
770 | } | 770 | } |
771 | 771 | ||
@@ -803,10 +803,10 @@ void ibmphp_lock_operations (void) | |||
803 | *---------------------------------------------------------------------*/ | 803 | *---------------------------------------------------------------------*/ |
804 | void ibmphp_unlock_operations (void) | 804 | void ibmphp_unlock_operations (void) |
805 | { | 805 | { |
806 | debug ("%s - Entry\n", __FUNCTION__); | 806 | debug ("%s - Entry\n", __func__); |
807 | up (&semOperations); | 807 | up (&semOperations); |
808 | to_debug = 0; | 808 | to_debug = 0; |
809 | debug ("%s - Exit\n", __FUNCTION__); | 809 | debug ("%s - Exit\n", __func__); |
810 | } | 810 | } |
811 | 811 | ||
812 | /*---------------------------------------------------------------------- | 812 | /*---------------------------------------------------------------------- |
@@ -827,7 +827,7 @@ static int poll_hpc(void *data) | |||
827 | int poll_count = 0; | 827 | int poll_count = 0; |
828 | u8 ctrl_count = 0x00; | 828 | u8 ctrl_count = 0x00; |
829 | 829 | ||
830 | debug ("%s - Entry\n", __FUNCTION__); | 830 | debug ("%s - Entry\n", __func__); |
831 | 831 | ||
832 | while (!kthread_should_stop()) { | 832 | while (!kthread_should_stop()) { |
833 | /* try to get the lock to do some kind of hardware access */ | 833 | /* try to get the lock to do some kind of hardware access */ |
@@ -907,7 +907,7 @@ static int poll_hpc(void *data) | |||
907 | msleep(100); | 907 | msleep(100); |
908 | } | 908 | } |
909 | up (&sem_exit); | 909 | up (&sem_exit); |
910 | debug ("%s - Exit\n", __FUNCTION__); | 910 | debug ("%s - Exit\n", __func__); |
911 | return 0; | 911 | return 0; |
912 | } | 912 | } |
913 | 913 | ||
@@ -999,7 +999,7 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot) | |||
999 | ibmphp_update_slot_info (pslot); | 999 | ibmphp_update_slot_info (pslot); |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | debug ("%s - Exit rc[%d] disable[%x] update[%x]\n", __FUNCTION__, rc, disable, update); | 1002 | debug ("%s - Exit rc[%d] disable[%x] update[%x]\n", __func__, rc, disable, update); |
1003 | 1003 | ||
1004 | return rc; | 1004 | return rc; |
1005 | } | 1005 | } |
@@ -1021,7 +1021,7 @@ static int process_changeinlatch (u8 old, u8 new, struct controller *ctrl) | |||
1021 | u8 mask; | 1021 | u8 mask; |
1022 | int rc = 0; | 1022 | int rc = 0; |
1023 | 1023 | ||
1024 | debug ("%s - Entry old[%x], new[%x]\n", __FUNCTION__, old, new); | 1024 | debug ("%s - Entry old[%x], new[%x]\n", __func__, old, new); |
1025 | // bit 0 reserved, 0 is LSB, check bit 1-6 for 6 slots | 1025 | // bit 0 reserved, 0 is LSB, check bit 1-6 for 6 slots |
1026 | 1026 | ||
1027 | for (i = ctrl->starting_slot_num; i <= ctrl->ending_slot_num; i++) { | 1027 | for (i = ctrl->starting_slot_num; i <= ctrl->ending_slot_num; i++) { |
@@ -1031,15 +1031,15 @@ static int process_changeinlatch (u8 old, u8 new, struct controller *ctrl) | |||
1031 | if (pslot) { | 1031 | if (pslot) { |
1032 | memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot)); | 1032 | memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot)); |
1033 | rc = ibmphp_hpc_readslot (pslot, READ_ALLSTAT, NULL); | 1033 | rc = ibmphp_hpc_readslot (pslot, READ_ALLSTAT, NULL); |
1034 | debug ("%s - call process_changeinstatus for slot[%d]\n", __FUNCTION__, i); | 1034 | debug ("%s - call process_changeinstatus for slot[%d]\n", __func__, i); |
1035 | process_changeinstatus (pslot, &myslot); | 1035 | process_changeinstatus (pslot, &myslot); |
1036 | } else { | 1036 | } else { |
1037 | rc = -EINVAL; | 1037 | rc = -EINVAL; |
1038 | err ("%s - Error bad pointer for slot[%d]\n", __FUNCTION__, i); | 1038 | err ("%s - Error bad pointer for slot[%d]\n", __func__, i); |
1039 | } | 1039 | } |
1040 | } | 1040 | } |
1041 | } | 1041 | } |
1042 | debug ("%s - Exit rc[%d]\n", __FUNCTION__, rc); | 1042 | debug ("%s - Exit rc[%d]\n", __func__, rc); |
1043 | return rc; | 1043 | return rc; |
1044 | } | 1044 | } |
1045 | 1045 | ||
@@ -1050,11 +1050,11 @@ static int process_changeinlatch (u8 old, u8 new, struct controller *ctrl) | |||
1050 | *---------------------------------------------------------------------*/ | 1050 | *---------------------------------------------------------------------*/ |
1051 | int __init ibmphp_hpc_start_poll_thread (void) | 1051 | int __init ibmphp_hpc_start_poll_thread (void) |
1052 | { | 1052 | { |
1053 | debug ("%s - Entry\n", __FUNCTION__); | 1053 | debug ("%s - Entry\n", __func__); |
1054 | 1054 | ||
1055 | ibmphp_poll_thread = kthread_run(poll_hpc, NULL, "hpc_poll"); | 1055 | ibmphp_poll_thread = kthread_run(poll_hpc, NULL, "hpc_poll"); |
1056 | if (IS_ERR(ibmphp_poll_thread)) { | 1056 | if (IS_ERR(ibmphp_poll_thread)) { |
1057 | err ("%s - Error, thread not started\n", __FUNCTION__); | 1057 | err ("%s - Error, thread not started\n", __func__); |
1058 | return PTR_ERR(ibmphp_poll_thread); | 1058 | return PTR_ERR(ibmphp_poll_thread); |
1059 | } | 1059 | } |
1060 | return 0; | 1060 | return 0; |
@@ -1067,7 +1067,7 @@ int __init ibmphp_hpc_start_poll_thread (void) | |||
1067 | *---------------------------------------------------------------------*/ | 1067 | *---------------------------------------------------------------------*/ |
1068 | void __exit ibmphp_hpc_stop_poll_thread (void) | 1068 | void __exit ibmphp_hpc_stop_poll_thread (void) |
1069 | { | 1069 | { |
1070 | debug ("%s - Entry\n", __FUNCTION__); | 1070 | debug ("%s - Entry\n", __func__); |
1071 | 1071 | ||
1072 | kthread_stop(ibmphp_poll_thread); | 1072 | kthread_stop(ibmphp_poll_thread); |
1073 | debug ("before locking operations \n"); | 1073 | debug ("before locking operations \n"); |
@@ -1088,7 +1088,7 @@ void __exit ibmphp_hpc_stop_poll_thread (void) | |||
1088 | up (&sem_exit); | 1088 | up (&sem_exit); |
1089 | debug ("after sem exit up\n"); | 1089 | debug ("after sem exit up\n"); |
1090 | 1090 | ||
1091 | debug ("%s - Exit\n", __FUNCTION__); | 1091 | debug ("%s - Exit\n", __func__); |
1092 | } | 1092 | } |
1093 | 1093 | ||
1094 | /*---------------------------------------------------------------------- | 1094 | /*---------------------------------------------------------------------- |
diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c index d8f05d7a3c72..7b09e16173ad 100644 --- a/drivers/pci/hotplug/ibmphp_pci.c +++ b/drivers/pci/hotplug/ibmphp_pci.c | |||
@@ -364,7 +364,7 @@ static int configure_device (struct pci_func *func) | |||
364 | struct resource_node *pfmem[6]; | 364 | struct resource_node *pfmem[6]; |
365 | unsigned int devfn; | 365 | unsigned int devfn; |
366 | 366 | ||
367 | debug ("%s - inside\n", __FUNCTION__); | 367 | debug ("%s - inside\n", __func__); |
368 | 368 | ||
369 | devfn = PCI_DEVFN(func->device, func->function); | 369 | devfn = PCI_DEVFN(func->device, func->function); |
370 | ibmphp_pci_bus->number = func->busno; | 370 | ibmphp_pci_bus->number = func->busno; |
@@ -595,7 +595,7 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) | |||
595 | u8 irq; | 595 | u8 irq; |
596 | int retval; | 596 | int retval; |
597 | 597 | ||
598 | debug ("%s - enter\n", __FUNCTION__); | 598 | debug ("%s - enter\n", __func__); |
599 | 599 | ||
600 | devfn = PCI_DEVFN(func->function, func->device); | 600 | devfn = PCI_DEVFN(func->function, func->device); |
601 | ibmphp_pci_bus->number = func->busno; | 601 | ibmphp_pci_bus->number = func->busno; |
@@ -1234,7 +1234,7 @@ static int unconfigure_boot_device (u8 busno, u8 device, u8 function) | |||
1234 | u32 tmp_address; | 1234 | u32 tmp_address; |
1235 | unsigned int devfn; | 1235 | unsigned int devfn; |
1236 | 1236 | ||
1237 | debug ("%s - enter\n", __FUNCTION__); | 1237 | debug ("%s - enter\n", __func__); |
1238 | 1238 | ||
1239 | bus = ibmphp_find_res_bus (busno); | 1239 | bus = ibmphp_find_res_bus (busno); |
1240 | if (!bus) { | 1240 | if (!bus) { |
@@ -1351,7 +1351,7 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) | |||
1351 | bus_no = (int) busno; | 1351 | bus_no = (int) busno; |
1352 | debug ("busno is %x\n", busno); | 1352 | debug ("busno is %x\n", busno); |
1353 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_PRIMARY_BUS, &pri_number); | 1353 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_PRIMARY_BUS, &pri_number); |
1354 | debug ("%s - busno = %x, primary_number = %x\n", __FUNCTION__, busno, pri_number); | 1354 | debug ("%s - busno = %x, primary_number = %x\n", __func__, busno, pri_number); |
1355 | 1355 | ||
1356 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); | 1356 | pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); |
1357 | debug ("sec_number is %x\n", sec_number); | 1357 | debug ("sec_number is %x\n", sec_number); |
@@ -1437,7 +1437,7 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) | |||
1437 | } | 1437 | } |
1438 | } /* end of mem */ | 1438 | } /* end of mem */ |
1439 | } /* end of for */ | 1439 | } /* end of for */ |
1440 | debug ("%s - exiting, returning success\n", __FUNCTION__); | 1440 | debug ("%s - exiting, returning success\n", __func__); |
1441 | return 0; | 1441 | return 0; |
1442 | } | 1442 | } |
1443 | 1443 | ||
@@ -1453,7 +1453,7 @@ static int unconfigure_boot_card (struct slot *slot_cur) | |||
1453 | unsigned int devfn; | 1453 | unsigned int devfn; |
1454 | u8 valid_device = 0x00; /* To see if we are ever able to find valid device and read it */ | 1454 | u8 valid_device = 0x00; /* To see if we are ever able to find valid device and read it */ |
1455 | 1455 | ||
1456 | debug ("%s - enter\n", __FUNCTION__); | 1456 | debug ("%s - enter\n", __func__); |
1457 | 1457 | ||
1458 | device = slot_cur->device; | 1458 | device = slot_cur->device; |
1459 | busno = slot_cur->bus; | 1459 | busno = slot_cur->bus; |
@@ -1470,7 +1470,7 @@ static int unconfigure_boot_card (struct slot *slot_cur) | |||
1470 | /* found correct device!!! */ | 1470 | /* found correct device!!! */ |
1471 | ++valid_device; | 1471 | ++valid_device; |
1472 | 1472 | ||
1473 | debug ("%s - found correct device\n", __FUNCTION__); | 1473 | debug ("%s - found correct device\n", __func__); |
1474 | 1474 | ||
1475 | /* header: x x x x x x x x | 1475 | /* header: x x x x x x x x |
1476 | * | |___________|=> 1=PPB bridge, 0=normal device, 2=CardBus Bridge | 1476 | * | |___________|=> 1=PPB bridge, 0=normal device, 2=CardBus Bridge |
@@ -1573,7 +1573,7 @@ int ibmphp_unconfigure_card (struct slot **slot_cur, int the_end) | |||
1573 | struct pci_func *cur_func = NULL; | 1573 | struct pci_func *cur_func = NULL; |
1574 | struct pci_func *temp_func; | 1574 | struct pci_func *temp_func; |
1575 | 1575 | ||
1576 | debug ("%s - enter\n", __FUNCTION__); | 1576 | debug ("%s - enter\n", __func__); |
1577 | 1577 | ||
1578 | if (!the_end) { | 1578 | if (!the_end) { |
1579 | /* Need to unconfigure the card */ | 1579 | /* Need to unconfigure the card */ |
@@ -1624,7 +1624,7 @@ int ibmphp_unconfigure_card (struct slot **slot_cur, int the_end) | |||
1624 | 1624 | ||
1625 | sl->func = NULL; | 1625 | sl->func = NULL; |
1626 | *slot_cur = sl; | 1626 | *slot_cur = sl; |
1627 | debug ("%s - exit\n", __FUNCTION__); | 1627 | debug ("%s - exit\n", __func__); |
1628 | return 0; | 1628 | return 0; |
1629 | } | 1629 | } |
1630 | 1630 | ||
diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c index 5636b1ac2a2e..ec73294d1fa6 100644 --- a/drivers/pci/hotplug/ibmphp_res.c +++ b/drivers/pci/hotplug/ibmphp_res.c | |||
@@ -563,7 +563,7 @@ static void fix_resources (struct bus_node *bus_cur) | |||
563 | struct range_node *range; | 563 | struct range_node *range; |
564 | struct resource_node *res; | 564 | struct resource_node *res; |
565 | 565 | ||
566 | debug ("%s - bus_cur->busno = %d\n", __FUNCTION__, bus_cur->busno); | 566 | debug ("%s - bus_cur->busno = %d\n", __func__, bus_cur->busno); |
567 | 567 | ||
568 | if (bus_cur->needIOUpdate) { | 568 | if (bus_cur->needIOUpdate) { |
569 | res = bus_cur->firstIO; | 569 | res = bus_cur->firstIO; |
@@ -599,7 +599,7 @@ int ibmphp_add_resource (struct resource_node *res) | |||
599 | struct range_node *range_cur = NULL; | 599 | struct range_node *range_cur = NULL; |
600 | struct resource_node *res_start = NULL; | 600 | struct resource_node *res_start = NULL; |
601 | 601 | ||
602 | debug ("%s - enter\n", __FUNCTION__); | 602 | debug ("%s - enter\n", __func__); |
603 | 603 | ||
604 | if (!res) { | 604 | if (!res) { |
605 | err ("NULL passed to add\n"); | 605 | err ("NULL passed to add\n"); |
@@ -762,7 +762,7 @@ int ibmphp_add_resource (struct resource_node *res) | |||
762 | } | 762 | } |
763 | } | 763 | } |
764 | 764 | ||
765 | debug ("%s - exit\n", __FUNCTION__); | 765 | debug ("%s - exit\n", __func__); |
766 | return 0; | 766 | return 0; |
767 | } | 767 | } |
768 | 768 | ||
@@ -1001,7 +1001,7 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) | |||
1001 | return -EINVAL; | 1001 | return -EINVAL; |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | debug ("%s - enter\n", __FUNCTION__); | 1004 | debug ("%s - enter\n", __func__); |
1005 | debug ("bus_cur->busno is %d\n", bus_cur->busno); | 1005 | debug ("bus_cur->busno is %d\n", bus_cur->busno); |
1006 | 1006 | ||
1007 | /* This is a quick fix to not mess up with the code very much. i.e., | 1007 | /* This is a quick fix to not mess up with the code very much. i.e., |
@@ -1029,7 +1029,7 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge) | |||
1029 | 1029 | ||
1030 | while (res_cur) { | 1030 | while (res_cur) { |
1031 | range = find_range (bus_cur, res_cur); | 1031 | range = find_range (bus_cur, res_cur); |
1032 | debug ("%s - rangeno = %d\n", __FUNCTION__, res_cur->rangeno); | 1032 | debug ("%s - rangeno = %d\n", __func__, res_cur->rangeno); |
1033 | 1033 | ||
1034 | if (!range) { | 1034 | if (!range) { |
1035 | err ("no range for the device exists... bailing out...\n"); | 1035 | err ("no range for the device exists... bailing out...\n"); |
@@ -1942,7 +1942,7 @@ static int __init update_bridge_ranges (struct bus_node **bus) | |||
1942 | return -ENODEV; | 1942 | return -ENODEV; |
1943 | ibmphp_pci_bus->number = bus_cur->busno; | 1943 | ibmphp_pci_bus->number = bus_cur->busno; |
1944 | 1944 | ||
1945 | debug ("inside %s\n", __FUNCTION__); | 1945 | debug ("inside %s\n", __func__); |
1946 | debug ("bus_cur->busno = %x\n", bus_cur->busno); | 1946 | debug ("bus_cur->busno = %x\n", bus_cur->busno); |
1947 | 1947 | ||
1948 | for (device = 0; device < 32; device++) { | 1948 | for (device = 0; device < 32; device++) { |
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index dd59a050260f..925ba16355ce 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c | |||
@@ -43,7 +43,7 @@ | |||
43 | 43 | ||
44 | #define MY_NAME "pci_hotplug" | 44 | #define MY_NAME "pci_hotplug" |
45 | 45 | ||
46 | #define dbg(fmt, arg...) do { if (debug) printk(KERN_DEBUG "%s: %s: " fmt , MY_NAME , __FUNCTION__ , ## arg); } while (0) | 46 | #define dbg(fmt, arg...) do { if (debug) printk(KERN_DEBUG "%s: %s: " fmt , MY_NAME , __func__ , ## arg); } while (0) |
47 | #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) | 47 | #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) |
48 | #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) | 48 | #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) |
49 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg) | 49 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg) |
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index ca656b27a500..f14267e197dd 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -168,7 +168,7 @@ static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) | |||
168 | return slot; | 168 | return slot; |
169 | } | 169 | } |
170 | 170 | ||
171 | err("%s: slot (device=0x%x) not found\n", __FUNCTION__, device); | 171 | err("%s: slot (device=0x%x) not found\n", __func__, device); |
172 | return NULL; | 172 | return NULL; |
173 | } | 173 | } |
174 | 174 | ||
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 5fa4ba0d9934..aee19f013d84 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -184,7 +184,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
184 | { | 184 | { |
185 | struct slot *slot = hotplug_slot->private; | 185 | struct slot *slot = hotplug_slot->private; |
186 | 186 | ||
187 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 187 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
188 | 188 | ||
189 | kfree(slot->hotplug_slot->info); | 189 | kfree(slot->hotplug_slot->info); |
190 | kfree(slot->hotplug_slot); | 190 | kfree(slot->hotplug_slot); |
@@ -301,7 +301,7 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) | |||
301 | { | 301 | { |
302 | struct slot *slot = hotplug_slot->private; | 302 | struct slot *slot = hotplug_slot->private; |
303 | 303 | ||
304 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 304 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
305 | 305 | ||
306 | hotplug_slot->info->attention_status = status; | 306 | hotplug_slot->info->attention_status = status; |
307 | 307 | ||
@@ -316,7 +316,7 @@ static int enable_slot(struct hotplug_slot *hotplug_slot) | |||
316 | { | 316 | { |
317 | struct slot *slot = hotplug_slot->private; | 317 | struct slot *slot = hotplug_slot->private; |
318 | 318 | ||
319 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 319 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
320 | 320 | ||
321 | return pciehp_sysfs_enable_slot(slot); | 321 | return pciehp_sysfs_enable_slot(slot); |
322 | } | 322 | } |
@@ -326,7 +326,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) | |||
326 | { | 326 | { |
327 | struct slot *slot = hotplug_slot->private; | 327 | struct slot *slot = hotplug_slot->private; |
328 | 328 | ||
329 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 329 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
330 | 330 | ||
331 | return pciehp_sysfs_disable_slot(slot); | 331 | return pciehp_sysfs_disable_slot(slot); |
332 | } | 332 | } |
@@ -336,7 +336,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
336 | struct slot *slot = hotplug_slot->private; | 336 | struct slot *slot = hotplug_slot->private; |
337 | int retval; | 337 | int retval; |
338 | 338 | ||
339 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 339 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
340 | 340 | ||
341 | retval = slot->hpc_ops->get_power_status(slot, value); | 341 | retval = slot->hpc_ops->get_power_status(slot, value); |
342 | if (retval < 0) | 342 | if (retval < 0) |
@@ -350,7 +350,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
350 | struct slot *slot = hotplug_slot->private; | 350 | struct slot *slot = hotplug_slot->private; |
351 | int retval; | 351 | int retval; |
352 | 352 | ||
353 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 353 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
354 | 354 | ||
355 | retval = slot->hpc_ops->get_attention_status(slot, value); | 355 | retval = slot->hpc_ops->get_attention_status(slot, value); |
356 | if (retval < 0) | 356 | if (retval < 0) |
@@ -364,7 +364,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
364 | struct slot *slot = hotplug_slot->private; | 364 | struct slot *slot = hotplug_slot->private; |
365 | int retval; | 365 | int retval; |
366 | 366 | ||
367 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 367 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
368 | 368 | ||
369 | retval = slot->hpc_ops->get_latch_status(slot, value); | 369 | retval = slot->hpc_ops->get_latch_status(slot, value); |
370 | if (retval < 0) | 370 | if (retval < 0) |
@@ -378,7 +378,7 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
378 | struct slot *slot = hotplug_slot->private; | 378 | struct slot *slot = hotplug_slot->private; |
379 | int retval; | 379 | int retval; |
380 | 380 | ||
381 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 381 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
382 | 382 | ||
383 | retval = slot->hpc_ops->get_adapter_status(slot, value); | 383 | retval = slot->hpc_ops->get_adapter_status(slot, value); |
384 | if (retval < 0) | 384 | if (retval < 0) |
@@ -392,7 +392,7 @@ static int get_address(struct hotplug_slot *hotplug_slot, u32 *value) | |||
392 | struct slot *slot = hotplug_slot->private; | 392 | struct slot *slot = hotplug_slot->private; |
393 | struct pci_bus *bus = slot->ctrl->pci_dev->subordinate; | 393 | struct pci_bus *bus = slot->ctrl->pci_dev->subordinate; |
394 | 394 | ||
395 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 395 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
396 | 396 | ||
397 | *value = (pci_domain_nr(bus) << 16) | (slot->bus << 8) | slot->device; | 397 | *value = (pci_domain_nr(bus) << 16) | (slot->bus << 8) | slot->device; |
398 | 398 | ||
@@ -404,7 +404,7 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe | |||
404 | struct slot *slot = hotplug_slot->private; | 404 | struct slot *slot = hotplug_slot->private; |
405 | int retval; | 405 | int retval; |
406 | 406 | ||
407 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 407 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
408 | 408 | ||
409 | retval = slot->hpc_ops->get_max_bus_speed(slot, value); | 409 | retval = slot->hpc_ops->get_max_bus_speed(slot, value); |
410 | if (retval < 0) | 410 | if (retval < 0) |
@@ -418,7 +418,7 @@ static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe | |||
418 | struct slot *slot = hotplug_slot->private; | 418 | struct slot *slot = hotplug_slot->private; |
419 | int retval; | 419 | int retval; |
420 | 420 | ||
421 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 421 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
422 | 422 | ||
423 | retval = slot->hpc_ops->get_cur_bus_speed(slot, value); | 423 | retval = slot->hpc_ops->get_cur_bus_speed(slot, value); |
424 | if (retval < 0) | 424 | if (retval < 0) |
@@ -437,7 +437,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
437 | 437 | ||
438 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); | 438 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); |
439 | if (!ctrl) { | 439 | if (!ctrl) { |
440 | err("%s : out of memory\n", __FUNCTION__); | 440 | err("%s : out of memory\n", __func__); |
441 | goto err_out_none; | 441 | goto err_out_none; |
442 | } | 442 | } |
443 | INIT_LIST_HEAD(&ctrl->slot_list); | 443 | INIT_LIST_HEAD(&ctrl->slot_list); |
@@ -454,7 +454,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
454 | pci_set_drvdata(pdev, ctrl); | 454 | pci_set_drvdata(pdev, ctrl); |
455 | 455 | ||
456 | dbg("%s: ctrl bus=0x%x, device=%x, function=%x, irq=%x\n", | 456 | dbg("%s: ctrl bus=0x%x, device=%x, function=%x, irq=%x\n", |
457 | __FUNCTION__, pdev->bus->number, PCI_SLOT(pdev->devfn), | 457 | __func__, pdev->bus->number, PCI_SLOT(pdev->devfn), |
458 | PCI_FUNC(pdev->devfn), pdev->irq); | 458 | PCI_FUNC(pdev->devfn), pdev->irq); |
459 | 459 | ||
460 | /* Setup the slot information structures */ | 460 | /* Setup the slot information structures */ |
@@ -503,13 +503,13 @@ static void pciehp_remove (struct pcie_device *dev) | |||
503 | #ifdef CONFIG_PM | 503 | #ifdef CONFIG_PM |
504 | static int pciehp_suspend (struct pcie_device *dev, pm_message_t state) | 504 | static int pciehp_suspend (struct pcie_device *dev, pm_message_t state) |
505 | { | 505 | { |
506 | printk("%s ENTRY\n", __FUNCTION__); | 506 | printk("%s ENTRY\n", __func__); |
507 | return 0; | 507 | return 0; |
508 | } | 508 | } |
509 | 509 | ||
510 | static int pciehp_resume (struct pcie_device *dev) | 510 | static int pciehp_resume (struct pcie_device *dev) |
511 | { | 511 | { |
512 | printk("%s ENTRY\n", __FUNCTION__); | 512 | printk("%s ENTRY\n", __func__); |
513 | if (pciehp_force) { | 513 | if (pciehp_force) { |
514 | struct pci_dev *pdev = dev->port; | 514 | struct pci_dev *pdev = dev->port; |
515 | struct controller *ctrl = pci_get_drvdata(pdev); | 515 | struct controller *ctrl = pci_get_drvdata(pdev); |
@@ -563,7 +563,7 @@ static int __init pcied_init(void) | |||
563 | dbg("pcie_port_service_register = %d\n", retval); | 563 | dbg("pcie_port_service_register = %d\n", retval); |
564 | info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); | 564 | info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); |
565 | if (retval) | 565 | if (retval) |
566 | dbg("%s: Failure to register service\n", __FUNCTION__); | 566 | dbg("%s: Failure to register service\n", __func__); |
567 | return retval; | 567 | return retval; |
568 | } | 568 | } |
569 | 569 | ||
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index b23061c56115..0c481f7d2ab3 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -181,7 +181,7 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
181 | if (POWER_CTRL(ctrl->ctrlcap)) { | 181 | if (POWER_CTRL(ctrl->ctrlcap)) { |
182 | if (pslot->hpc_ops->power_off_slot(pslot)) { | 182 | if (pslot->hpc_ops->power_off_slot(pslot)) { |
183 | err("%s: Issue of Slot Power Off command failed\n", | 183 | err("%s: Issue of Slot Power Off command failed\n", |
184 | __FUNCTION__); | 184 | __func__); |
185 | return; | 185 | return; |
186 | } | 186 | } |
187 | } | 187 | } |
@@ -192,7 +192,7 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
192 | if (ATTN_LED(ctrl->ctrlcap)) { | 192 | if (ATTN_LED(ctrl->ctrlcap)) { |
193 | if (pslot->hpc_ops->set_attention_status(pslot, 1)) { | 193 | if (pslot->hpc_ops->set_attention_status(pslot, 1)) { |
194 | err("%s: Issue of Set Attention Led command failed\n", | 194 | err("%s: Issue of Set Attention Led command failed\n", |
195 | __FUNCTION__); | 195 | __func__); |
196 | return; | 196 | return; |
197 | } | 197 | } |
198 | } | 198 | } |
@@ -211,7 +211,7 @@ static int board_added(struct slot *p_slot) | |||
211 | struct controller *ctrl = p_slot->ctrl; | 211 | struct controller *ctrl = p_slot->ctrl; |
212 | 212 | ||
213 | dbg("%s: slot device, slot offset, hp slot = %d, %d ,%d\n", | 213 | dbg("%s: slot device, slot offset, hp slot = %d, %d ,%d\n", |
214 | __FUNCTION__, p_slot->device, | 214 | __func__, p_slot->device, |
215 | ctrl->slot_device_offset, p_slot->hp_slot); | 215 | ctrl->slot_device_offset, p_slot->hp_slot); |
216 | 216 | ||
217 | if (POWER_CTRL(ctrl->ctrlcap)) { | 217 | if (POWER_CTRL(ctrl->ctrlcap)) { |
@@ -230,14 +230,14 @@ static int board_added(struct slot *p_slot) | |||
230 | /* Check link training status */ | 230 | /* Check link training status */ |
231 | retval = p_slot->hpc_ops->check_lnk_status(ctrl); | 231 | retval = p_slot->hpc_ops->check_lnk_status(ctrl); |
232 | if (retval) { | 232 | if (retval) { |
233 | err("%s: Failed to check link status\n", __FUNCTION__); | 233 | err("%s: Failed to check link status\n", __func__); |
234 | set_slot_off(ctrl, p_slot); | 234 | set_slot_off(ctrl, p_slot); |
235 | return retval; | 235 | return retval; |
236 | } | 236 | } |
237 | 237 | ||
238 | /* Check for a power fault */ | 238 | /* Check for a power fault */ |
239 | if (p_slot->hpc_ops->query_power_fault(p_slot)) { | 239 | if (p_slot->hpc_ops->query_power_fault(p_slot)) { |
240 | dbg("%s: power fault detected\n", __FUNCTION__); | 240 | dbg("%s: power fault detected\n", __func__); |
241 | retval = POWER_FAILURE; | 241 | retval = POWER_FAILURE; |
242 | goto err_exit; | 242 | goto err_exit; |
243 | } | 243 | } |
@@ -277,14 +277,14 @@ static int remove_board(struct slot *p_slot) | |||
277 | if (retval) | 277 | if (retval) |
278 | return retval; | 278 | return retval; |
279 | 279 | ||
280 | dbg("In %s, hp_slot = %d\n", __FUNCTION__, p_slot->hp_slot); | 280 | dbg("In %s, hp_slot = %d\n", __func__, p_slot->hp_slot); |
281 | 281 | ||
282 | if (POWER_CTRL(ctrl->ctrlcap)) { | 282 | if (POWER_CTRL(ctrl->ctrlcap)) { |
283 | /* power off slot */ | 283 | /* power off slot */ |
284 | retval = p_slot->hpc_ops->power_off_slot(p_slot); | 284 | retval = p_slot->hpc_ops->power_off_slot(p_slot); |
285 | if (retval) { | 285 | if (retval) { |
286 | err("%s: Issue of Slot Disable command failed\n", | 286 | err("%s: Issue of Slot Disable command failed\n", |
287 | __FUNCTION__); | 287 | __func__); |
288 | return retval; | 288 | return retval; |
289 | } | 289 | } |
290 | } | 290 | } |
@@ -319,7 +319,7 @@ static void pciehp_power_thread(struct work_struct *work) | |||
319 | case POWEROFF_STATE: | 319 | case POWEROFF_STATE: |
320 | mutex_unlock(&p_slot->lock); | 320 | mutex_unlock(&p_slot->lock); |
321 | dbg("%s: disabling bus:device(%x:%x)\n", | 321 | dbg("%s: disabling bus:device(%x:%x)\n", |
322 | __FUNCTION__, p_slot->bus, p_slot->device); | 322 | __func__, p_slot->bus, p_slot->device); |
323 | pciehp_disable_slot(p_slot); | 323 | pciehp_disable_slot(p_slot); |
324 | mutex_lock(&p_slot->lock); | 324 | mutex_lock(&p_slot->lock); |
325 | p_slot->state = STATIC_STATE; | 325 | p_slot->state = STATIC_STATE; |
@@ -347,7 +347,7 @@ void pciehp_queue_pushbutton_work(struct work_struct *work) | |||
347 | 347 | ||
348 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 348 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
349 | if (!info) { | 349 | if (!info) { |
350 | err("%s: Cannot allocate memory\n", __FUNCTION__); | 350 | err("%s: Cannot allocate memory\n", __func__); |
351 | return; | 351 | return; |
352 | } | 352 | } |
353 | info->p_slot = p_slot; | 353 | info->p_slot = p_slot; |
@@ -424,7 +424,7 @@ static void handle_button_press_event(struct slot *p_slot) | |||
424 | * expires to cancel hot-add or hot-remove | 424 | * expires to cancel hot-add or hot-remove |
425 | */ | 425 | */ |
426 | info("Button cancel on Slot(%s)\n", p_slot->name); | 426 | info("Button cancel on Slot(%s)\n", p_slot->name); |
427 | dbg("%s: button cancel\n", __FUNCTION__); | 427 | dbg("%s: button cancel\n", __func__); |
428 | cancel_delayed_work(&p_slot->work); | 428 | cancel_delayed_work(&p_slot->work); |
429 | if (p_slot->state == BLINKINGOFF_STATE) { | 429 | if (p_slot->state == BLINKINGOFF_STATE) { |
430 | if (PWR_LED(ctrl->ctrlcap)) | 430 | if (PWR_LED(ctrl->ctrlcap)) |
@@ -465,7 +465,7 @@ static void handle_surprise_event(struct slot *p_slot) | |||
465 | 465 | ||
466 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 466 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
467 | if (!info) { | 467 | if (!info) { |
468 | err("%s: Cannot allocate memory\n", __FUNCTION__); | 468 | err("%s: Cannot allocate memory\n", __func__); |
469 | return; | 469 | return; |
470 | } | 470 | } |
471 | info->p_slot = p_slot; | 471 | info->p_slot = p_slot; |
@@ -526,7 +526,7 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
526 | 526 | ||
527 | rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); | 527 | rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); |
528 | if (rc || !getstatus) { | 528 | if (rc || !getstatus) { |
529 | info("%s: no adapter on slot(%s)\n", __FUNCTION__, | 529 | info("%s: no adapter on slot(%s)\n", __func__, |
530 | p_slot->name); | 530 | p_slot->name); |
531 | mutex_unlock(&p_slot->ctrl->crit_sect); | 531 | mutex_unlock(&p_slot->ctrl->crit_sect); |
532 | return -ENODEV; | 532 | return -ENODEV; |
@@ -534,7 +534,7 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
534 | if (MRL_SENS(p_slot->ctrl->ctrlcap)) { | 534 | if (MRL_SENS(p_slot->ctrl->ctrlcap)) { |
535 | rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 535 | rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
536 | if (rc || getstatus) { | 536 | if (rc || getstatus) { |
537 | info("%s: latch open on slot(%s)\n", __FUNCTION__, | 537 | info("%s: latch open on slot(%s)\n", __func__, |
538 | p_slot->name); | 538 | p_slot->name); |
539 | mutex_unlock(&p_slot->ctrl->crit_sect); | 539 | mutex_unlock(&p_slot->ctrl->crit_sect); |
540 | return -ENODEV; | 540 | return -ENODEV; |
@@ -544,7 +544,7 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
544 | if (POWER_CTRL(p_slot->ctrl->ctrlcap)) { | 544 | if (POWER_CTRL(p_slot->ctrl->ctrlcap)) { |
545 | rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 545 | rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
546 | if (rc || getstatus) { | 546 | if (rc || getstatus) { |
547 | info("%s: already enabled on slot(%s)\n", __FUNCTION__, | 547 | info("%s: already enabled on slot(%s)\n", __func__, |
548 | p_slot->name); | 548 | p_slot->name); |
549 | mutex_unlock(&p_slot->ctrl->crit_sect); | 549 | mutex_unlock(&p_slot->ctrl->crit_sect); |
550 | return -EINVAL; | 550 | return -EINVAL; |
@@ -579,7 +579,7 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
579 | if (!HP_SUPR_RM(p_slot->ctrl->ctrlcap)) { | 579 | if (!HP_SUPR_RM(p_slot->ctrl->ctrlcap)) { |
580 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); | 580 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); |
581 | if (ret || !getstatus) { | 581 | if (ret || !getstatus) { |
582 | info("%s: no adapter on slot(%s)\n", __FUNCTION__, | 582 | info("%s: no adapter on slot(%s)\n", __func__, |
583 | p_slot->name); | 583 | p_slot->name); |
584 | mutex_unlock(&p_slot->ctrl->crit_sect); | 584 | mutex_unlock(&p_slot->ctrl->crit_sect); |
585 | return -ENODEV; | 585 | return -ENODEV; |
@@ -589,7 +589,7 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
589 | if (MRL_SENS(p_slot->ctrl->ctrlcap)) { | 589 | if (MRL_SENS(p_slot->ctrl->ctrlcap)) { |
590 | ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 590 | ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
591 | if (ret || getstatus) { | 591 | if (ret || getstatus) { |
592 | info("%s: latch open on slot(%s)\n", __FUNCTION__, | 592 | info("%s: latch open on slot(%s)\n", __func__, |
593 | p_slot->name); | 593 | p_slot->name); |
594 | mutex_unlock(&p_slot->ctrl->crit_sect); | 594 | mutex_unlock(&p_slot->ctrl->crit_sect); |
595 | return -ENODEV; | 595 | return -ENODEV; |
@@ -599,7 +599,7 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
599 | if (POWER_CTRL(p_slot->ctrl->ctrlcap)) { | 599 | if (POWER_CTRL(p_slot->ctrl->ctrlcap)) { |
600 | ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 600 | ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
601 | if (ret || !getstatus) { | 601 | if (ret || !getstatus) { |
602 | info("%s: already disabled slot(%s)\n", __FUNCTION__, | 602 | info("%s: already disabled slot(%s)\n", __func__, |
603 | p_slot->name); | 603 | p_slot->name); |
604 | mutex_unlock(&p_slot->ctrl->crit_sect); | 604 | mutex_unlock(&p_slot->ctrl->crit_sect); |
605 | return -EINVAL; | 605 | return -EINVAL; |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 698975a6a21c..b4bbd07d1e39 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -258,7 +258,7 @@ static int pcie_write_cmd(struct slot *slot, u16 cmd, u16 mask) | |||
258 | 258 | ||
259 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 259 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
260 | if (retval) { | 260 | if (retval) { |
261 | err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); | 261 | err("%s: Cannot read SLOTSTATUS register\n", __func__); |
262 | goto out; | 262 | goto out; |
263 | } | 263 | } |
264 | 264 | ||
@@ -267,13 +267,13 @@ static int pcie_write_cmd(struct slot *slot, u16 cmd, u16 mask) | |||
267 | proceed forward to issue the next command according | 267 | proceed forward to issue the next command according |
268 | to spec. Just print out the error message */ | 268 | to spec. Just print out the error message */ |
269 | dbg("%s: CMD_COMPLETED not clear after 1 sec.\n", | 269 | dbg("%s: CMD_COMPLETED not clear after 1 sec.\n", |
270 | __FUNCTION__); | 270 | __func__); |
271 | } | 271 | } |
272 | 272 | ||
273 | spin_lock_irqsave(&ctrl->lock, flags); | 273 | spin_lock_irqsave(&ctrl->lock, flags); |
274 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); | 274 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); |
275 | if (retval) { | 275 | if (retval) { |
276 | err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); | 276 | err("%s: Cannot read SLOTCTRL register\n", __func__); |
277 | goto out_spin_unlock; | 277 | goto out_spin_unlock; |
278 | } | 278 | } |
279 | 279 | ||
@@ -283,7 +283,7 @@ static int pcie_write_cmd(struct slot *slot, u16 cmd, u16 mask) | |||
283 | ctrl->cmd_busy = 1; | 283 | ctrl->cmd_busy = 1; |
284 | retval = pciehp_writew(ctrl, SLOTCTRL, slot_ctrl); | 284 | retval = pciehp_writew(ctrl, SLOTCTRL, slot_ctrl); |
285 | if (retval) | 285 | if (retval) |
286 | err("%s: Cannot write to SLOTCTRL register\n", __FUNCTION__); | 286 | err("%s: Cannot write to SLOTCTRL register\n", __func__); |
287 | 287 | ||
288 | out_spin_unlock: | 288 | out_spin_unlock: |
289 | spin_unlock_irqrestore(&ctrl->lock, flags); | 289 | spin_unlock_irqrestore(&ctrl->lock, flags); |
@@ -305,14 +305,14 @@ static int hpc_check_lnk_status(struct controller *ctrl) | |||
305 | 305 | ||
306 | retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); | 306 | retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); |
307 | if (retval) { | 307 | if (retval) { |
308 | err("%s: Cannot read LNKSTATUS register\n", __FUNCTION__); | 308 | err("%s: Cannot read LNKSTATUS register\n", __func__); |
309 | return retval; | 309 | return retval; |
310 | } | 310 | } |
311 | 311 | ||
312 | dbg("%s: lnk_status = %x\n", __FUNCTION__, lnk_status); | 312 | dbg("%s: lnk_status = %x\n", __func__, lnk_status); |
313 | if ( (lnk_status & LNK_TRN) || (lnk_status & LNK_TRN_ERR) || | 313 | if ( (lnk_status & LNK_TRN) || (lnk_status & LNK_TRN_ERR) || |
314 | !(lnk_status & NEG_LINK_WD)) { | 314 | !(lnk_status & NEG_LINK_WD)) { |
315 | err("%s : Link Training Error occurs \n", __FUNCTION__); | 315 | err("%s : Link Training Error occurs \n", __func__); |
316 | retval = -1; | 316 | retval = -1; |
317 | return retval; | 317 | return retval; |
318 | } | 318 | } |
@@ -329,12 +329,12 @@ static int hpc_get_attention_status(struct slot *slot, u8 *status) | |||
329 | 329 | ||
330 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); | 330 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); |
331 | if (retval) { | 331 | if (retval) { |
332 | err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); | 332 | err("%s: Cannot read SLOTCTRL register\n", __func__); |
333 | return retval; | 333 | return retval; |
334 | } | 334 | } |
335 | 335 | ||
336 | dbg("%s: SLOTCTRL %x, value read %x\n", | 336 | dbg("%s: SLOTCTRL %x, value read %x\n", |
337 | __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_ctrl); | 337 | __func__, ctrl->cap_base + SLOTCTRL, slot_ctrl); |
338 | 338 | ||
339 | atten_led_state = (slot_ctrl & ATTN_LED_CTRL) >> 6; | 339 | atten_led_state = (slot_ctrl & ATTN_LED_CTRL) >> 6; |
340 | 340 | ||
@@ -368,11 +368,11 @@ static int hpc_get_power_status(struct slot *slot, u8 *status) | |||
368 | 368 | ||
369 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); | 369 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); |
370 | if (retval) { | 370 | if (retval) { |
371 | err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); | 371 | err("%s: Cannot read SLOTCTRL register\n", __func__); |
372 | return retval; | 372 | return retval; |
373 | } | 373 | } |
374 | dbg("%s: SLOTCTRL %x value read %x\n", | 374 | dbg("%s: SLOTCTRL %x value read %x\n", |
375 | __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_ctrl); | 375 | __func__, ctrl->cap_base + SLOTCTRL, slot_ctrl); |
376 | 376 | ||
377 | pwr_state = (slot_ctrl & PWR_CTRL) >> 10; | 377 | pwr_state = (slot_ctrl & PWR_CTRL) >> 10; |
378 | 378 | ||
@@ -399,7 +399,7 @@ static int hpc_get_latch_status(struct slot *slot, u8 *status) | |||
399 | 399 | ||
400 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 400 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
401 | if (retval) { | 401 | if (retval) { |
402 | err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); | 402 | err("%s: Cannot read SLOTSTATUS register\n", __func__); |
403 | return retval; | 403 | return retval; |
404 | } | 404 | } |
405 | 405 | ||
@@ -417,7 +417,7 @@ static int hpc_get_adapter_status(struct slot *slot, u8 *status) | |||
417 | 417 | ||
418 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 418 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
419 | if (retval) { | 419 | if (retval) { |
420 | err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); | 420 | err("%s: Cannot read SLOTSTATUS register\n", __func__); |
421 | return retval; | 421 | return retval; |
422 | } | 422 | } |
423 | card_state = (u8)((slot_status & PRSN_STATE) >> 6); | 423 | card_state = (u8)((slot_status & PRSN_STATE) >> 6); |
@@ -435,7 +435,7 @@ static int hpc_query_power_fault(struct slot *slot) | |||
435 | 435 | ||
436 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 436 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
437 | if (retval) { | 437 | if (retval) { |
438 | err("%s: Cannot check for power fault\n", __FUNCTION__); | 438 | err("%s: Cannot check for power fault\n", __func__); |
439 | return retval; | 439 | return retval; |
440 | } | 440 | } |
441 | pwr_fault = (u8)((slot_status & PWR_FAULT_DETECTED) >> 1); | 441 | pwr_fault = (u8)((slot_status & PWR_FAULT_DETECTED) >> 1); |
@@ -451,7 +451,7 @@ static int hpc_get_emi_status(struct slot *slot, u8 *status) | |||
451 | 451 | ||
452 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 452 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
453 | if (retval) { | 453 | if (retval) { |
454 | err("%s : Cannot check EMI status\n", __FUNCTION__); | 454 | err("%s : Cannot check EMI status\n", __func__); |
455 | return retval; | 455 | return retval; |
456 | } | 456 | } |
457 | *status = (slot_status & EMI_STATE) >> EMI_STATUS_BIT; | 457 | *status = (slot_status & EMI_STATE) >> EMI_STATUS_BIT; |
@@ -506,7 +506,7 @@ static int hpc_set_attention_status(struct slot *slot, u8 value) | |||
506 | 506 | ||
507 | rc = pcie_write_cmd(slot, slot_cmd, cmd_mask); | 507 | rc = pcie_write_cmd(slot, slot_cmd, cmd_mask); |
508 | dbg("%s: SLOTCTRL %x write cmd %x\n", | 508 | dbg("%s: SLOTCTRL %x write cmd %x\n", |
509 | __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); | 509 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); |
510 | 510 | ||
511 | return rc; | 511 | return rc; |
512 | } | 512 | } |
@@ -527,7 +527,7 @@ static void hpc_set_green_led_on(struct slot *slot) | |||
527 | pcie_write_cmd(slot, slot_cmd, cmd_mask); | 527 | pcie_write_cmd(slot, slot_cmd, cmd_mask); |
528 | 528 | ||
529 | dbg("%s: SLOTCTRL %x write cmd %x\n", | 529 | dbg("%s: SLOTCTRL %x write cmd %x\n", |
530 | __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); | 530 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); |
531 | } | 531 | } |
532 | 532 | ||
533 | static void hpc_set_green_led_off(struct slot *slot) | 533 | static void hpc_set_green_led_off(struct slot *slot) |
@@ -545,7 +545,7 @@ static void hpc_set_green_led_off(struct slot *slot) | |||
545 | 545 | ||
546 | pcie_write_cmd(slot, slot_cmd, cmd_mask); | 546 | pcie_write_cmd(slot, slot_cmd, cmd_mask); |
547 | dbg("%s: SLOTCTRL %x write cmd %x\n", | 547 | dbg("%s: SLOTCTRL %x write cmd %x\n", |
548 | __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); | 548 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); |
549 | } | 549 | } |
550 | 550 | ||
551 | static void hpc_set_green_led_blink(struct slot *slot) | 551 | static void hpc_set_green_led_blink(struct slot *slot) |
@@ -564,7 +564,7 @@ static void hpc_set_green_led_blink(struct slot *slot) | |||
564 | pcie_write_cmd(slot, slot_cmd, cmd_mask); | 564 | pcie_write_cmd(slot, slot_cmd, cmd_mask); |
565 | 565 | ||
566 | dbg("%s: SLOTCTRL %x write cmd %x\n", | 566 | dbg("%s: SLOTCTRL %x write cmd %x\n", |
567 | __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); | 567 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); |
568 | } | 568 | } |
569 | 569 | ||
570 | static void hpc_release_ctlr(struct controller *ctrl) | 570 | static void hpc_release_ctlr(struct controller *ctrl) |
@@ -590,12 +590,12 @@ static int hpc_power_on_slot(struct slot * slot) | |||
590 | u16 slot_status; | 590 | u16 slot_status; |
591 | int retval = 0; | 591 | int retval = 0; |
592 | 592 | ||
593 | dbg("%s: slot->hp_slot %x\n", __FUNCTION__, slot->hp_slot); | 593 | dbg("%s: slot->hp_slot %x\n", __func__, slot->hp_slot); |
594 | 594 | ||
595 | /* Clear sticky power-fault bit from previous power failures */ | 595 | /* Clear sticky power-fault bit from previous power failures */ |
596 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 596 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
597 | if (retval) { | 597 | if (retval) { |
598 | err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); | 598 | err("%s: Cannot read SLOTSTATUS register\n", __func__); |
599 | return retval; | 599 | return retval; |
600 | } | 600 | } |
601 | slot_status &= PWR_FAULT_DETECTED; | 601 | slot_status &= PWR_FAULT_DETECTED; |
@@ -603,7 +603,7 @@ static int hpc_power_on_slot(struct slot * slot) | |||
603 | retval = pciehp_writew(ctrl, SLOTSTATUS, slot_status); | 603 | retval = pciehp_writew(ctrl, SLOTSTATUS, slot_status); |
604 | if (retval) { | 604 | if (retval) { |
605 | err("%s: Cannot write to SLOTSTATUS register\n", | 605 | err("%s: Cannot write to SLOTSTATUS register\n", |
606 | __FUNCTION__); | 606 | __func__); |
607 | return retval; | 607 | return retval; |
608 | } | 608 | } |
609 | } | 609 | } |
@@ -627,11 +627,11 @@ static int hpc_power_on_slot(struct slot * slot) | |||
627 | retval = pcie_write_cmd(slot, slot_cmd, cmd_mask); | 627 | retval = pcie_write_cmd(slot, slot_cmd, cmd_mask); |
628 | 628 | ||
629 | if (retval) { | 629 | if (retval) { |
630 | err("%s: Write %x command failed!\n", __FUNCTION__, slot_cmd); | 630 | err("%s: Write %x command failed!\n", __func__, slot_cmd); |
631 | return -1; | 631 | return -1; |
632 | } | 632 | } |
633 | dbg("%s: SLOTCTRL %x write cmd %x\n", | 633 | dbg("%s: SLOTCTRL %x write cmd %x\n", |
634 | __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); | 634 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); |
635 | 635 | ||
636 | return retval; | 636 | return retval; |
637 | } | 637 | } |
@@ -677,7 +677,7 @@ static int hpc_power_off_slot(struct slot * slot) | |||
677 | int retval = 0; | 677 | int retval = 0; |
678 | int changed; | 678 | int changed; |
679 | 679 | ||
680 | dbg("%s: slot->hp_slot %x\n", __FUNCTION__, slot->hp_slot); | 680 | dbg("%s: slot->hp_slot %x\n", __func__, slot->hp_slot); |
681 | 681 | ||
682 | /* | 682 | /* |
683 | * Set Bad DLLP Mask bit in Correctable Error Mask | 683 | * Set Bad DLLP Mask bit in Correctable Error Mask |
@@ -710,12 +710,12 @@ static int hpc_power_off_slot(struct slot * slot) | |||
710 | 710 | ||
711 | retval = pcie_write_cmd(slot, slot_cmd, cmd_mask); | 711 | retval = pcie_write_cmd(slot, slot_cmd, cmd_mask); |
712 | if (retval) { | 712 | if (retval) { |
713 | err("%s: Write command failed!\n", __FUNCTION__); | 713 | err("%s: Write command failed!\n", __func__); |
714 | retval = -1; | 714 | retval = -1; |
715 | goto out; | 715 | goto out; |
716 | } | 716 | } |
717 | dbg("%s: SLOTCTRL %x write cmd %x\n", | 717 | dbg("%s: SLOTCTRL %x write cmd %x\n", |
718 | __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); | 718 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); |
719 | 719 | ||
720 | /* | 720 | /* |
721 | * After turning power off, we must wait for at least 1 second | 721 | * After turning power off, we must wait for at least 1 second |
@@ -741,7 +741,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
741 | 741 | ||
742 | rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 742 | rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
743 | if (rc) { | 743 | if (rc) { |
744 | err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); | 744 | err("%s: Cannot read SLOTSTATUS register\n", __func__); |
745 | return IRQ_NONE; | 745 | return IRQ_NONE; |
746 | } | 746 | } |
747 | 747 | ||
@@ -754,26 +754,26 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
754 | if ( !intr_loc ) | 754 | if ( !intr_loc ) |
755 | return IRQ_NONE; | 755 | return IRQ_NONE; |
756 | 756 | ||
757 | dbg("%s: intr_loc %x\n", __FUNCTION__, intr_loc); | 757 | dbg("%s: intr_loc %x\n", __func__, intr_loc); |
758 | /* Mask Hot-plug Interrupt Enable */ | 758 | /* Mask Hot-plug Interrupt Enable */ |
759 | if (!pciehp_poll_mode) { | 759 | if (!pciehp_poll_mode) { |
760 | spin_lock_irqsave(&ctrl->lock, flags); | 760 | spin_lock_irqsave(&ctrl->lock, flags); |
761 | rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); | 761 | rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); |
762 | if (rc) { | 762 | if (rc) { |
763 | err("%s: Cannot read SLOT_CTRL register\n", | 763 | err("%s: Cannot read SLOT_CTRL register\n", |
764 | __FUNCTION__); | 764 | __func__); |
765 | spin_unlock_irqrestore(&ctrl->lock, flags); | 765 | spin_unlock_irqrestore(&ctrl->lock, flags); |
766 | return IRQ_NONE; | 766 | return IRQ_NONE; |
767 | } | 767 | } |
768 | 768 | ||
769 | dbg("%s: pciehp_readw(SLOTCTRL) with value %x\n", | 769 | dbg("%s: pciehp_readw(SLOTCTRL) with value %x\n", |
770 | __FUNCTION__, temp_word); | 770 | __func__, temp_word); |
771 | temp_word = (temp_word & ~HP_INTR_ENABLE & | 771 | temp_word = (temp_word & ~HP_INTR_ENABLE & |
772 | ~CMD_CMPL_INTR_ENABLE) | 0x00; | 772 | ~CMD_CMPL_INTR_ENABLE) | 0x00; |
773 | rc = pciehp_writew(ctrl, SLOTCTRL, temp_word); | 773 | rc = pciehp_writew(ctrl, SLOTCTRL, temp_word); |
774 | if (rc) { | 774 | if (rc) { |
775 | err("%s: Cannot write to SLOTCTRL register\n", | 775 | err("%s: Cannot write to SLOTCTRL register\n", |
776 | __FUNCTION__); | 776 | __func__); |
777 | spin_unlock_irqrestore(&ctrl->lock, flags); | 777 | spin_unlock_irqrestore(&ctrl->lock, flags); |
778 | return IRQ_NONE; | 778 | return IRQ_NONE; |
779 | } | 779 | } |
@@ -782,18 +782,18 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
782 | rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 782 | rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
783 | if (rc) { | 783 | if (rc) { |
784 | err("%s: Cannot read SLOT_STATUS register\n", | 784 | err("%s: Cannot read SLOT_STATUS register\n", |
785 | __FUNCTION__); | 785 | __func__); |
786 | return IRQ_NONE; | 786 | return IRQ_NONE; |
787 | } | 787 | } |
788 | dbg("%s: pciehp_readw(SLOTSTATUS) with value %x\n", | 788 | dbg("%s: pciehp_readw(SLOTSTATUS) with value %x\n", |
789 | __FUNCTION__, slot_status); | 789 | __func__, slot_status); |
790 | 790 | ||
791 | /* Clear command complete interrupt caused by this write */ | 791 | /* Clear command complete interrupt caused by this write */ |
792 | temp_word = 0x1f; | 792 | temp_word = 0x1f; |
793 | rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word); | 793 | rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word); |
794 | if (rc) { | 794 | if (rc) { |
795 | err("%s: Cannot write to SLOTSTATUS register\n", | 795 | err("%s: Cannot write to SLOTSTATUS register\n", |
796 | __FUNCTION__); | 796 | __func__); |
797 | return IRQ_NONE; | 797 | return IRQ_NONE; |
798 | } | 798 | } |
799 | } | 799 | } |
@@ -822,7 +822,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
822 | temp_word = 0x1F; | 822 | temp_word = 0x1F; |
823 | rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word); | 823 | rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word); |
824 | if (rc) { | 824 | if (rc) { |
825 | err("%s: Cannot write to SLOTSTATUS register\n", __FUNCTION__); | 825 | err("%s: Cannot write to SLOTSTATUS register\n", __func__); |
826 | return IRQ_NONE; | 826 | return IRQ_NONE; |
827 | } | 827 | } |
828 | /* Unmask Hot-plug Interrupt Enable */ | 828 | /* Unmask Hot-plug Interrupt Enable */ |
@@ -831,18 +831,18 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
831 | rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); | 831 | rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); |
832 | if (rc) { | 832 | if (rc) { |
833 | err("%s: Cannot read SLOTCTRL register\n", | 833 | err("%s: Cannot read SLOTCTRL register\n", |
834 | __FUNCTION__); | 834 | __func__); |
835 | spin_unlock_irqrestore(&ctrl->lock, flags); | 835 | spin_unlock_irqrestore(&ctrl->lock, flags); |
836 | return IRQ_NONE; | 836 | return IRQ_NONE; |
837 | } | 837 | } |
838 | 838 | ||
839 | dbg("%s: Unmask Hot-plug Interrupt Enable\n", __FUNCTION__); | 839 | dbg("%s: Unmask Hot-plug Interrupt Enable\n", __func__); |
840 | temp_word = (temp_word & ~HP_INTR_ENABLE) | HP_INTR_ENABLE; | 840 | temp_word = (temp_word & ~HP_INTR_ENABLE) | HP_INTR_ENABLE; |
841 | 841 | ||
842 | rc = pciehp_writew(ctrl, SLOTCTRL, temp_word); | 842 | rc = pciehp_writew(ctrl, SLOTCTRL, temp_word); |
843 | if (rc) { | 843 | if (rc) { |
844 | err("%s: Cannot write to SLOTCTRL register\n", | 844 | err("%s: Cannot write to SLOTCTRL register\n", |
845 | __FUNCTION__); | 845 | __func__); |
846 | spin_unlock_irqrestore(&ctrl->lock, flags); | 846 | spin_unlock_irqrestore(&ctrl->lock, flags); |
847 | return IRQ_NONE; | 847 | return IRQ_NONE; |
848 | } | 848 | } |
@@ -851,7 +851,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
851 | rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 851 | rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
852 | if (rc) { | 852 | if (rc) { |
853 | err("%s: Cannot read SLOT_STATUS register\n", | 853 | err("%s: Cannot read SLOT_STATUS register\n", |
854 | __FUNCTION__); | 854 | __func__); |
855 | return IRQ_NONE; | 855 | return IRQ_NONE; |
856 | } | 856 | } |
857 | 857 | ||
@@ -860,11 +860,11 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
860 | rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word); | 860 | rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word); |
861 | if (rc) { | 861 | if (rc) { |
862 | err("%s: Cannot write to SLOTSTATUS failed\n", | 862 | err("%s: Cannot write to SLOTSTATUS failed\n", |
863 | __FUNCTION__); | 863 | __func__); |
864 | return IRQ_NONE; | 864 | return IRQ_NONE; |
865 | } | 865 | } |
866 | dbg("%s: pciehp_writew(SLOTSTATUS) with value %x\n", | 866 | dbg("%s: pciehp_writew(SLOTSTATUS) with value %x\n", |
867 | __FUNCTION__, temp_word); | 867 | __func__, temp_word); |
868 | } | 868 | } |
869 | 869 | ||
870 | return IRQ_HANDLED; | 870 | return IRQ_HANDLED; |
@@ -879,7 +879,7 @@ static int hpc_get_max_lnk_speed(struct slot *slot, enum pci_bus_speed *value) | |||
879 | 879 | ||
880 | retval = pciehp_readl(ctrl, LNKCAP, &lnk_cap); | 880 | retval = pciehp_readl(ctrl, LNKCAP, &lnk_cap); |
881 | if (retval) { | 881 | if (retval) { |
882 | err("%s: Cannot read LNKCAP register\n", __FUNCTION__); | 882 | err("%s: Cannot read LNKCAP register\n", __func__); |
883 | return retval; | 883 | return retval; |
884 | } | 884 | } |
885 | 885 | ||
@@ -908,7 +908,7 @@ static int hpc_get_max_lnk_width(struct slot *slot, | |||
908 | 908 | ||
909 | retval = pciehp_readl(ctrl, LNKCAP, &lnk_cap); | 909 | retval = pciehp_readl(ctrl, LNKCAP, &lnk_cap); |
910 | if (retval) { | 910 | if (retval) { |
911 | err("%s: Cannot read LNKCAP register\n", __FUNCTION__); | 911 | err("%s: Cannot read LNKCAP register\n", __func__); |
912 | return retval; | 912 | return retval; |
913 | } | 913 | } |
914 | 914 | ||
@@ -957,7 +957,7 @@ static int hpc_get_cur_lnk_speed(struct slot *slot, enum pci_bus_speed *value) | |||
957 | 957 | ||
958 | retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); | 958 | retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); |
959 | if (retval) { | 959 | if (retval) { |
960 | err("%s: Cannot read LNKSTATUS register\n", __FUNCTION__); | 960 | err("%s: Cannot read LNKSTATUS register\n", __func__); |
961 | return retval; | 961 | return retval; |
962 | } | 962 | } |
963 | 963 | ||
@@ -986,7 +986,7 @@ static int hpc_get_cur_lnk_width(struct slot *slot, | |||
986 | 986 | ||
987 | retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); | 987 | retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); |
988 | if (retval) { | 988 | if (retval) { |
989 | err("%s: Cannot read LNKSTATUS register\n", __FUNCTION__); | 989 | err("%s: Cannot read LNKSTATUS register\n", __func__); |
990 | return retval; | 990 | return retval; |
991 | } | 991 | } |
992 | 992 | ||
@@ -1130,38 +1130,38 @@ static int pcie_init_hardware_part1(struct controller *ctrl, | |||
1130 | 1130 | ||
1131 | rc = pciehp_readl(ctrl, SLOTCAP, &slot_cap); | 1131 | rc = pciehp_readl(ctrl, SLOTCAP, &slot_cap); |
1132 | if (rc) { | 1132 | if (rc) { |
1133 | err("%s: Cannot read SLOTCAP register\n", __FUNCTION__); | 1133 | err("%s: Cannot read SLOTCAP register\n", __func__); |
1134 | return -1; | 1134 | return -1; |
1135 | } | 1135 | } |
1136 | 1136 | ||
1137 | /* Mask Hot-plug Interrupt Enable */ | 1137 | /* Mask Hot-plug Interrupt Enable */ |
1138 | rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); | 1138 | rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); |
1139 | if (rc) { | 1139 | if (rc) { |
1140 | err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); | 1140 | err("%s: Cannot read SLOTCTRL register\n", __func__); |
1141 | return -1; | 1141 | return -1; |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | dbg("%s: SLOTCTRL %x value read %x\n", | 1144 | dbg("%s: SLOTCTRL %x value read %x\n", |
1145 | __FUNCTION__, ctrl->cap_base + SLOTCTRL, temp_word); | 1145 | __func__, ctrl->cap_base + SLOTCTRL, temp_word); |
1146 | temp_word = (temp_word & ~HP_INTR_ENABLE & ~CMD_CMPL_INTR_ENABLE) | | 1146 | temp_word = (temp_word & ~HP_INTR_ENABLE & ~CMD_CMPL_INTR_ENABLE) | |
1147 | 0x00; | 1147 | 0x00; |
1148 | 1148 | ||
1149 | rc = pciehp_writew(ctrl, SLOTCTRL, temp_word); | 1149 | rc = pciehp_writew(ctrl, SLOTCTRL, temp_word); |
1150 | if (rc) { | 1150 | if (rc) { |
1151 | err("%s: Cannot write to SLOTCTRL register\n", __FUNCTION__); | 1151 | err("%s: Cannot write to SLOTCTRL register\n", __func__); |
1152 | return -1; | 1152 | return -1; |
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 1155 | rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
1156 | if (rc) { | 1156 | if (rc) { |
1157 | err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); | 1157 | err("%s: Cannot read SLOTSTATUS register\n", __func__); |
1158 | return -1; | 1158 | return -1; |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | temp_word = 0x1F; /* Clear all events */ | 1161 | temp_word = 0x1F; /* Clear all events */ |
1162 | rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word); | 1162 | rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word); |
1163 | if (rc) { | 1163 | if (rc) { |
1164 | err("%s: Cannot write to SLOTSTATUS register\n", __FUNCTION__); | 1164 | err("%s: Cannot write to SLOTSTATUS register\n", __func__); |
1165 | return -1; | 1165 | return -1; |
1166 | } | 1166 | } |
1167 | return 0; | 1167 | return 0; |
@@ -1177,7 +1177,7 @@ int pcie_init_hardware_part2(struct controller *ctrl, struct pcie_device *dev) | |||
1177 | 1177 | ||
1178 | rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); | 1178 | rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); |
1179 | if (rc) { | 1179 | if (rc) { |
1180 | err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); | 1180 | err("%s: Cannot read SLOTCTRL register\n", __func__); |
1181 | goto abort; | 1181 | goto abort; |
1182 | } | 1182 | } |
1183 | 1183 | ||
@@ -1185,7 +1185,7 @@ int pcie_init_hardware_part2(struct controller *ctrl, struct pcie_device *dev) | |||
1185 | 1185 | ||
1186 | rc = pciehp_readl(ctrl, SLOTCAP, &slot_cap); | 1186 | rc = pciehp_readl(ctrl, SLOTCAP, &slot_cap); |
1187 | if (rc) { | 1187 | if (rc) { |
1188 | err("%s: Cannot read SLOTCAP register\n", __FUNCTION__); | 1188 | err("%s: Cannot read SLOTCAP register\n", __func__); |
1189 | goto abort; | 1189 | goto abort; |
1190 | } | 1190 | } |
1191 | 1191 | ||
@@ -1212,19 +1212,19 @@ int pcie_init_hardware_part2(struct controller *ctrl, struct pcie_device *dev) | |||
1212 | */ | 1212 | */ |
1213 | rc = pciehp_writew(ctrl, SLOTCTRL, temp_word); | 1213 | rc = pciehp_writew(ctrl, SLOTCTRL, temp_word); |
1214 | if (rc) { | 1214 | if (rc) { |
1215 | err("%s: Cannot write to SLOTCTRL register\n", __FUNCTION__); | 1215 | err("%s: Cannot write to SLOTCTRL register\n", __func__); |
1216 | goto abort; | 1216 | goto abort; |
1217 | } | 1217 | } |
1218 | rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 1218 | rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
1219 | if (rc) { | 1219 | if (rc) { |
1220 | err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); | 1220 | err("%s: Cannot read SLOTSTATUS register\n", __func__); |
1221 | goto abort_disable_intr; | 1221 | goto abort_disable_intr; |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | temp_word = 0x1F; /* Clear all events */ | 1224 | temp_word = 0x1F; /* Clear all events */ |
1225 | rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word); | 1225 | rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word); |
1226 | if (rc) { | 1226 | if (rc) { |
1227 | err("%s: Cannot write to SLOTSTATUS register\n", __FUNCTION__); | 1227 | err("%s: Cannot write to SLOTSTATUS register\n", __func__); |
1228 | goto abort_disable_intr; | 1228 | goto abort_disable_intr; |
1229 | } | 1229 | } |
1230 | 1230 | ||
@@ -1247,7 +1247,7 @@ abort_disable_intr: | |||
1247 | rc = pciehp_writew(ctrl, SLOTCTRL, temp_word); | 1247 | rc = pciehp_writew(ctrl, SLOTCTRL, temp_word); |
1248 | } | 1248 | } |
1249 | if (rc) | 1249 | if (rc) |
1250 | err("%s : disabling interrupts failed\n", __FUNCTION__); | 1250 | err("%s : disabling interrupts failed\n", __func__); |
1251 | abort: | 1251 | abort: |
1252 | return -1; | 1252 | return -1; |
1253 | } | 1253 | } |
@@ -1265,62 +1265,62 @@ int pcie_init(struct controller *ctrl, struct pcie_device *dev) | |||
1265 | ctrl->pci_dev = pdev; /* save pci_dev in context */ | 1265 | ctrl->pci_dev = pdev; /* save pci_dev in context */ |
1266 | 1266 | ||
1267 | dbg("%s: hotplug controller vendor id 0x%x device id 0x%x\n", | 1267 | dbg("%s: hotplug controller vendor id 0x%x device id 0x%x\n", |
1268 | __FUNCTION__, pdev->vendor, pdev->device); | 1268 | __func__, pdev->vendor, pdev->device); |
1269 | 1269 | ||
1270 | cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP); | 1270 | cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP); |
1271 | if (cap_base == 0) { | 1271 | if (cap_base == 0) { |
1272 | dbg("%s: Can't find PCI_CAP_ID_EXP (0x10)\n", __FUNCTION__); | 1272 | dbg("%s: Can't find PCI_CAP_ID_EXP (0x10)\n", __func__); |
1273 | goto abort; | 1273 | goto abort; |
1274 | } | 1274 | } |
1275 | 1275 | ||
1276 | ctrl->cap_base = cap_base; | 1276 | ctrl->cap_base = cap_base; |
1277 | 1277 | ||
1278 | dbg("%s: pcie_cap_base %x\n", __FUNCTION__, cap_base); | 1278 | dbg("%s: pcie_cap_base %x\n", __func__, cap_base); |
1279 | 1279 | ||
1280 | rc = pciehp_readw(ctrl, CAPREG, &cap_reg); | 1280 | rc = pciehp_readw(ctrl, CAPREG, &cap_reg); |
1281 | if (rc) { | 1281 | if (rc) { |
1282 | err("%s: Cannot read CAPREG register\n", __FUNCTION__); | 1282 | err("%s: Cannot read CAPREG register\n", __func__); |
1283 | goto abort; | 1283 | goto abort; |
1284 | } | 1284 | } |
1285 | dbg("%s: CAPREG offset %x cap_reg %x\n", | 1285 | dbg("%s: CAPREG offset %x cap_reg %x\n", |
1286 | __FUNCTION__, ctrl->cap_base + CAPREG, cap_reg); | 1286 | __func__, ctrl->cap_base + CAPREG, cap_reg); |
1287 | 1287 | ||
1288 | if (((cap_reg & SLOT_IMPL) == 0) || | 1288 | if (((cap_reg & SLOT_IMPL) == 0) || |
1289 | (((cap_reg & DEV_PORT_TYPE) != 0x0040) | 1289 | (((cap_reg & DEV_PORT_TYPE) != 0x0040) |
1290 | && ((cap_reg & DEV_PORT_TYPE) != 0x0060))) { | 1290 | && ((cap_reg & DEV_PORT_TYPE) != 0x0060))) { |
1291 | dbg("%s : This is not a root port or the port is not " | 1291 | dbg("%s : This is not a root port or the port is not " |
1292 | "connected to a slot\n", __FUNCTION__); | 1292 | "connected to a slot\n", __func__); |
1293 | goto abort; | 1293 | goto abort; |
1294 | } | 1294 | } |
1295 | 1295 | ||
1296 | rc = pciehp_readl(ctrl, SLOTCAP, &slot_cap); | 1296 | rc = pciehp_readl(ctrl, SLOTCAP, &slot_cap); |
1297 | if (rc) { | 1297 | if (rc) { |
1298 | err("%s: Cannot read SLOTCAP register\n", __FUNCTION__); | 1298 | err("%s: Cannot read SLOTCAP register\n", __func__); |
1299 | goto abort; | 1299 | goto abort; |
1300 | } | 1300 | } |
1301 | dbg("%s: SLOTCAP offset %x slot_cap %x\n", | 1301 | dbg("%s: SLOTCAP offset %x slot_cap %x\n", |
1302 | __FUNCTION__, ctrl->cap_base + SLOTCAP, slot_cap); | 1302 | __func__, ctrl->cap_base + SLOTCAP, slot_cap); |
1303 | 1303 | ||
1304 | if (!(slot_cap & HP_CAP)) { | 1304 | if (!(slot_cap & HP_CAP)) { |
1305 | dbg("%s : This slot is not hot-plug capable\n", __FUNCTION__); | 1305 | dbg("%s : This slot is not hot-plug capable\n", __func__); |
1306 | goto abort; | 1306 | goto abort; |
1307 | } | 1307 | } |
1308 | /* For debugging purpose */ | 1308 | /* For debugging purpose */ |
1309 | rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 1309 | rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
1310 | if (rc) { | 1310 | if (rc) { |
1311 | err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); | 1311 | err("%s: Cannot read SLOTSTATUS register\n", __func__); |
1312 | goto abort; | 1312 | goto abort; |
1313 | } | 1313 | } |
1314 | dbg("%s: SLOTSTATUS offset %x slot_status %x\n", | 1314 | dbg("%s: SLOTSTATUS offset %x slot_status %x\n", |
1315 | __FUNCTION__, ctrl->cap_base + SLOTSTATUS, slot_status); | 1315 | __func__, ctrl->cap_base + SLOTSTATUS, slot_status); |
1316 | 1316 | ||
1317 | rc = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); | 1317 | rc = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); |
1318 | if (rc) { | 1318 | if (rc) { |
1319 | err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); | 1319 | err("%s: Cannot read SLOTCTRL register\n", __func__); |
1320 | goto abort; | 1320 | goto abort; |
1321 | } | 1321 | } |
1322 | dbg("%s: SLOTCTRL offset %x slot_ctrl %x\n", | 1322 | dbg("%s: SLOTCTRL offset %x slot_ctrl %x\n", |
1323 | __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_ctrl); | 1323 | __func__, ctrl->cap_base + SLOTCTRL, slot_ctrl); |
1324 | 1324 | ||
1325 | for (rc = 0; rc < DEVICE_COUNT_RESOURCE; rc++) | 1325 | for (rc = 0; rc < DEVICE_COUNT_RESOURCE; rc++) |
1326 | if (pci_resource_len(pdev, rc) > 0) | 1326 | if (pci_resource_len(pdev, rc) > 0) |
@@ -1358,7 +1358,7 @@ int pcie_init(struct controller *ctrl, struct pcie_device *dev) | |||
1358 | rc = request_irq(ctrl->pci_dev->irq, pcie_isr, IRQF_SHARED, | 1358 | rc = request_irq(ctrl->pci_dev->irq, pcie_isr, IRQF_SHARED, |
1359 | MY_NAME, (void *)ctrl); | 1359 | MY_NAME, (void *)ctrl); |
1360 | dbg("%s: request_irq %d for hpc%d (returns %d)\n", | 1360 | dbg("%s: request_irq %d for hpc%d (returns %d)\n", |
1361 | __FUNCTION__, ctrl->pci_dev->irq, | 1361 | __func__, ctrl->pci_dev->irq, |
1362 | atomic_read(&pciehp_num_controllers), rc); | 1362 | atomic_read(&pciehp_num_controllers), rc); |
1363 | if (rc) { | 1363 | if (rc) { |
1364 | err("Can't get irq %d for the hotplug controller\n", | 1364 | err("Can't get irq %d for the hotplug controller\n", |
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index 9372a840b63d..6040dcceb256 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c | |||
@@ -40,7 +40,7 @@ static void program_hpp_type0(struct pci_dev *dev, struct hpp_type0 *hpp) | |||
40 | 40 | ||
41 | if (hpp->revision > 1) { | 41 | if (hpp->revision > 1) { |
42 | printk(KERN_WARNING "%s: Rev.%d type0 record not supported\n", | 42 | printk(KERN_WARNING "%s: Rev.%d type0 record not supported\n", |
43 | __FUNCTION__, hpp->revision); | 43 | __func__, hpp->revision); |
44 | return; | 44 | return; |
45 | } | 45 | } |
46 | 46 | ||
@@ -82,7 +82,7 @@ static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp) | |||
82 | 82 | ||
83 | if (hpp->revision > 1) { | 83 | if (hpp->revision > 1) { |
84 | printk(KERN_WARNING "%s: Rev.%d type2 record not supported\n", | 84 | printk(KERN_WARNING "%s: Rev.%d type2 record not supported\n", |
85 | __FUNCTION__, hpp->revision); | 85 | __func__, hpp->revision); |
86 | return; | 86 | return; |
87 | } | 87 | } |
88 | 88 | ||
@@ -150,7 +150,7 @@ static void program_fw_provided_values(struct pci_dev *dev) | |||
150 | 150 | ||
151 | if (pciehp_get_hp_params_from_firmware(dev, &hpp)) { | 151 | if (pciehp_get_hp_params_from_firmware(dev, &hpp)) { |
152 | printk(KERN_WARNING "%s: Could not get hotplug parameters\n", | 152 | printk(KERN_WARNING "%s: Could not get hotplug parameters\n", |
153 | __FUNCTION__); | 153 | __func__); |
154 | return; | 154 | return; |
155 | } | 155 | } |
156 | 156 | ||
@@ -245,7 +245,7 @@ int pciehp_unconfigure_device(struct slot *p_slot) | |||
245 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; | 245 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; |
246 | u16 command; | 246 | u16 command; |
247 | 247 | ||
248 | dbg("%s: bus/dev = %x/%x\n", __FUNCTION__, p_slot->bus, | 248 | dbg("%s: bus/dev = %x/%x\n", __func__, p_slot->bus, |
249 | p_slot->device); | 249 | p_slot->device); |
250 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence); | 250 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence); |
251 | if (ret) | 251 | if (ret) |
diff --git a/drivers/pci/hotplug/pcihp_skeleton.c b/drivers/pci/hotplug/pcihp_skeleton.c index 50bcd3fe61da..e3dd6cf9e89f 100644 --- a/drivers/pci/hotplug/pcihp_skeleton.c +++ b/drivers/pci/hotplug/pcihp_skeleton.c | |||
@@ -98,7 +98,7 @@ static int enable_slot(struct hotplug_slot *hotplug_slot) | |||
98 | struct slot *slot = hotplug_slot->private; | 98 | struct slot *slot = hotplug_slot->private; |
99 | int retval = 0; | 99 | int retval = 0; |
100 | 100 | ||
101 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 101 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * Fill in code here to enable the specified slot | 104 | * Fill in code here to enable the specified slot |
@@ -112,7 +112,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) | |||
112 | struct slot *slot = hotplug_slot->private; | 112 | struct slot *slot = hotplug_slot->private; |
113 | int retval = 0; | 113 | int retval = 0; |
114 | 114 | ||
115 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 115 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
116 | 116 | ||
117 | /* | 117 | /* |
118 | * Fill in code here to disable the specified slot | 118 | * Fill in code here to disable the specified slot |
@@ -126,7 +126,7 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) | |||
126 | struct slot *slot = hotplug_slot->private; | 126 | struct slot *slot = hotplug_slot->private; |
127 | int retval = 0; | 127 | int retval = 0; |
128 | 128 | ||
129 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 129 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
130 | 130 | ||
131 | switch (status) { | 131 | switch (status) { |
132 | case 0: | 132 | case 0: |
@@ -151,7 +151,7 @@ static int hardware_test(struct hotplug_slot *hotplug_slot, u32 value) | |||
151 | struct slot *slot = hotplug_slot->private; | 151 | struct slot *slot = hotplug_slot->private; |
152 | int retval = 0; | 152 | int retval = 0; |
153 | 153 | ||
154 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 154 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
155 | 155 | ||
156 | switch (value) { | 156 | switch (value) { |
157 | case 0: | 157 | case 0: |
@@ -170,7 +170,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
170 | struct slot *slot = hotplug_slot->private; | 170 | struct slot *slot = hotplug_slot->private; |
171 | int retval = 0; | 171 | int retval = 0; |
172 | 172 | ||
173 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 173 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
174 | 174 | ||
175 | /* | 175 | /* |
176 | * Fill in logic to get the current power status of the specific | 176 | * Fill in logic to get the current power status of the specific |
@@ -185,7 +185,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
185 | struct slot *slot = hotplug_slot->private; | 185 | struct slot *slot = hotplug_slot->private; |
186 | int retval = 0; | 186 | int retval = 0; |
187 | 187 | ||
188 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 188 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
189 | 189 | ||
190 | /* | 190 | /* |
191 | * Fill in logic to get the current attention status of the specific | 191 | * Fill in logic to get the current attention status of the specific |
@@ -200,7 +200,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
200 | struct slot *slot = hotplug_slot->private; | 200 | struct slot *slot = hotplug_slot->private; |
201 | int retval = 0; | 201 | int retval = 0; |
202 | 202 | ||
203 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 203 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
204 | 204 | ||
205 | /* | 205 | /* |
206 | * Fill in logic to get the current latch status of the specific | 206 | * Fill in logic to get the current latch status of the specific |
@@ -215,7 +215,7 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
215 | struct slot *slot = hotplug_slot->private; | 215 | struct slot *slot = hotplug_slot->private; |
216 | int retval = 0; | 216 | int retval = 0; |
217 | 217 | ||
218 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 218 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
219 | 219 | ||
220 | /* | 220 | /* |
221 | * Fill in logic to get the current adapter status of the specific | 221 | * Fill in logic to get the current adapter status of the specific |
@@ -229,7 +229,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
229 | { | 229 | { |
230 | struct slot *slot = hotplug_slot->private; | 230 | struct slot *slot = hotplug_slot->private; |
231 | 231 | ||
232 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 232 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
233 | kfree(slot->hotplug_slot->info); | 233 | kfree(slot->hotplug_slot->info); |
234 | kfree(slot->hotplug_slot); | 234 | kfree(slot->hotplug_slot); |
235 | kfree(slot); | 235 | kfree(slot); |
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c index 191954bc8e5b..9c2a22fed18b 100644 --- a/drivers/pci/hotplug/rpadlpar_core.c +++ b/drivers/pci/hotplug/rpadlpar_core.c | |||
@@ -147,7 +147,7 @@ static void dlpar_pci_add_bus(struct device_node *dn) | |||
147 | dev = of_create_pci_dev(dn, phb->bus, pdn->devfn); | 147 | dev = of_create_pci_dev(dn, phb->bus, pdn->devfn); |
148 | if (!dev) { | 148 | if (!dev) { |
149 | printk(KERN_ERR "%s: failed to create pci dev for %s\n", | 149 | printk(KERN_ERR "%s: failed to create pci dev for %s\n", |
150 | __FUNCTION__, dn->full_name); | 150 | __func__, dn->full_name); |
151 | return; | 151 | return; |
152 | } | 152 | } |
153 | 153 | ||
@@ -183,21 +183,21 @@ static int dlpar_add_pci_slot(char *drc_name, struct device_node *dn) | |||
183 | dev = dlpar_find_new_dev(phb->bus, dn); | 183 | dev = dlpar_find_new_dev(phb->bus, dn); |
184 | 184 | ||
185 | if (!dev) { | 185 | if (!dev) { |
186 | printk(KERN_ERR "%s: unable to add bus %s\n", __FUNCTION__, | 186 | printk(KERN_ERR "%s: unable to add bus %s\n", __func__, |
187 | drc_name); | 187 | drc_name); |
188 | return -EIO; | 188 | return -EIO; |
189 | } | 189 | } |
190 | 190 | ||
191 | if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { | 191 | if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { |
192 | printk(KERN_ERR "%s: unexpected header type %d, unable to add bus %s\n", | 192 | printk(KERN_ERR "%s: unexpected header type %d, unable to add bus %s\n", |
193 | __FUNCTION__, dev->hdr_type, drc_name); | 193 | __func__, dev->hdr_type, drc_name); |
194 | return -EIO; | 194 | return -EIO; |
195 | } | 195 | } |
196 | 196 | ||
197 | /* Add hotplug slot */ | 197 | /* Add hotplug slot */ |
198 | if (rpaphp_add_slot(dn)) { | 198 | if (rpaphp_add_slot(dn)) { |
199 | printk(KERN_ERR "%s: unable to add hotplug slot %s\n", | 199 | printk(KERN_ERR "%s: unable to add hotplug slot %s\n", |
200 | __FUNCTION__, drc_name); | 200 | __func__, drc_name); |
201 | return -EIO; | 201 | return -EIO; |
202 | } | 202 | } |
203 | return 0; | 203 | return 0; |
@@ -239,7 +239,7 @@ static int dlpar_remove_phb(char *drc_name, struct device_node *dn) | |||
239 | if (rpaphp_deregister_slot(slot)) { | 239 | if (rpaphp_deregister_slot(slot)) { |
240 | printk(KERN_ERR | 240 | printk(KERN_ERR |
241 | "%s: unable to remove hotplug slot %s\n", | 241 | "%s: unable to remove hotplug slot %s\n", |
242 | __FUNCTION__, drc_name); | 242 | __func__, drc_name); |
243 | return -EIO; | 243 | return -EIO; |
244 | } | 244 | } |
245 | } | 245 | } |
@@ -270,7 +270,7 @@ static int dlpar_add_phb(char *drc_name, struct device_node *dn) | |||
270 | 270 | ||
271 | if (rpaphp_add_slot(dn)) { | 271 | if (rpaphp_add_slot(dn)) { |
272 | printk(KERN_ERR "%s: unable to add hotplug slot %s\n", | 272 | printk(KERN_ERR "%s: unable to add hotplug slot %s\n", |
273 | __FUNCTION__, drc_name); | 273 | __func__, drc_name); |
274 | return -EIO; | 274 | return -EIO; |
275 | } | 275 | } |
276 | return 0; | 276 | return 0; |
@@ -284,7 +284,7 @@ static int dlpar_add_vio_slot(char *drc_name, struct device_node *dn) | |||
284 | if (!vio_register_device_node(dn)) { | 284 | if (!vio_register_device_node(dn)) { |
285 | printk(KERN_ERR | 285 | printk(KERN_ERR |
286 | "%s: failed to register vio node %s\n", | 286 | "%s: failed to register vio node %s\n", |
287 | __FUNCTION__, drc_name); | 287 | __func__, drc_name); |
288 | return -EIO; | 288 | return -EIO; |
289 | } | 289 | } |
290 | return 0; | 290 | return 0; |
@@ -384,7 +384,7 @@ int dlpar_remove_pci_slot(char *drc_name, struct device_node *dn) | |||
384 | if (rpaphp_deregister_slot(slot)) { | 384 | if (rpaphp_deregister_slot(slot)) { |
385 | printk(KERN_ERR | 385 | printk(KERN_ERR |
386 | "%s: unable to remove hotplug slot %s\n", | 386 | "%s: unable to remove hotplug slot %s\n", |
387 | __FUNCTION__, drc_name); | 387 | __func__, drc_name); |
388 | return -EIO; | 388 | return -EIO; |
389 | } | 389 | } |
390 | } else | 390 | } else |
@@ -392,7 +392,7 @@ int dlpar_remove_pci_slot(char *drc_name, struct device_node *dn) | |||
392 | 392 | ||
393 | if (pcibios_unmap_io_space(bus)) { | 393 | if (pcibios_unmap_io_space(bus)) { |
394 | printk(KERN_ERR "%s: failed to unmap bus range\n", | 394 | printk(KERN_ERR "%s: failed to unmap bus range\n", |
395 | __FUNCTION__); | 395 | __func__); |
396 | return -ERANGE; | 396 | return -ERANGE; |
397 | } | 397 | } |
398 | 398 | ||
@@ -458,7 +458,7 @@ int __init rpadlpar_io_init(void) | |||
458 | 458 | ||
459 | if (!is_dlpar_capable()) { | 459 | if (!is_dlpar_capable()) { |
460 | printk(KERN_WARNING "%s: partition not DLPAR capable\n", | 460 | printk(KERN_WARNING "%s: partition not DLPAR capable\n", |
461 | __FUNCTION__); | 461 | __func__); |
462 | return -EPERM; | 462 | return -EPERM; |
463 | } | 463 | } |
464 | 464 | ||
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c index 58f1a9927709..1f84f402acdb 100644 --- a/drivers/pci/hotplug/rpaphp_core.c +++ b/drivers/pci/hotplug/rpaphp_core.c | |||
@@ -317,7 +317,7 @@ int rpaphp_add_slot(struct device_node *dn) | |||
317 | if (!is_php_dn(dn, &indexes, &names, &types, &power_domains)) | 317 | if (!is_php_dn(dn, &indexes, &names, &types, &power_domains)) |
318 | return 0; | 318 | return 0; |
319 | 319 | ||
320 | dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name); | 320 | dbg("Entry %s: dn->full_name=%s\n", __func__, dn->full_name); |
321 | 321 | ||
322 | /* register PCI devices */ | 322 | /* register PCI devices */ |
323 | name = (char *) &names[1]; | 323 | name = (char *) &names[1]; |
@@ -343,7 +343,7 @@ int rpaphp_add_slot(struct device_node *dn) | |||
343 | name += strlen(name) + 1; | 343 | name += strlen(name) + 1; |
344 | type += strlen(type) + 1; | 344 | type += strlen(type) + 1; |
345 | } | 345 | } |
346 | dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); | 346 | dbg("%s - Exit: rc[%d]\n", __func__, retval); |
347 | 347 | ||
348 | /* XXX FIXME: reports a failure only if last entry in loop failed */ | 348 | /* XXX FIXME: reports a failure only if last entry in loop failed */ |
349 | return retval; | 349 | return retval; |
@@ -404,7 +404,7 @@ static int enable_slot(struct hotplug_slot *hotplug_slot) | |||
404 | } else if (state == EMPTY) { | 404 | } else if (state == EMPTY) { |
405 | slot->state = EMPTY; | 405 | slot->state = EMPTY; |
406 | } else { | 406 | } else { |
407 | err("%s: slot[%s] is in invalid state\n", __FUNCTION__, slot->name); | 407 | err("%s: slot[%s] is in invalid state\n", __func__, slot->name); |
408 | slot->state = NOT_VALID; | 408 | slot->state = NOT_VALID; |
409 | return -EINVAL; | 409 | return -EINVAL; |
410 | } | 410 | } |
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c index 6571e9b4c2ec..5acfd4f3d4cb 100644 --- a/drivers/pci/hotplug/rpaphp_pci.c +++ b/drivers/pci/hotplug/rpaphp_pci.c | |||
@@ -42,7 +42,7 @@ int rpaphp_get_sensor_state(struct slot *slot, int *state) | |||
42 | if (rc < 0) { | 42 | if (rc < 0) { |
43 | if (rc == -EFAULT || rc == -EEXIST) { | 43 | if (rc == -EFAULT || rc == -EEXIST) { |
44 | dbg("%s: slot must be power up to get sensor-state\n", | 44 | dbg("%s: slot must be power up to get sensor-state\n", |
45 | __FUNCTION__); | 45 | __func__); |
46 | 46 | ||
47 | /* some slots have to be powered up | 47 | /* some slots have to be powered up |
48 | * before get-sensor will succeed. | 48 | * before get-sensor will succeed. |
@@ -51,15 +51,15 @@ int rpaphp_get_sensor_state(struct slot *slot, int *state) | |||
51 | &setlevel); | 51 | &setlevel); |
52 | if (rc < 0) { | 52 | if (rc < 0) { |
53 | dbg("%s: power on slot[%s] failed rc=%d.\n", | 53 | dbg("%s: power on slot[%s] failed rc=%d.\n", |
54 | __FUNCTION__, slot->name, rc); | 54 | __func__, slot->name, rc); |
55 | } else { | 55 | } else { |
56 | rc = rtas_get_sensor(DR_ENTITY_SENSE, | 56 | rc = rtas_get_sensor(DR_ENTITY_SENSE, |
57 | slot->index, state); | 57 | slot->index, state); |
58 | } | 58 | } |
59 | } else if (rc == -ENODEV) | 59 | } else if (rc == -ENODEV) |
60 | info("%s: slot is unusable\n", __FUNCTION__); | 60 | info("%s: slot is unusable\n", __func__); |
61 | else | 61 | else |
62 | err("%s failed to get sensor state\n", __FUNCTION__); | 62 | err("%s failed to get sensor state\n", __func__); |
63 | } | 63 | } |
64 | return rc; | 64 | return rc; |
65 | } | 65 | } |
@@ -95,7 +95,7 @@ int rpaphp_enable_slot(struct slot *slot) | |||
95 | 95 | ||
96 | bus = pcibios_find_pci_bus(slot->dn); | 96 | bus = pcibios_find_pci_bus(slot->dn); |
97 | if (!bus) { | 97 | if (!bus) { |
98 | err("%s: no pci_bus for dn %s\n", __FUNCTION__, slot->dn->full_name); | 98 | err("%s: no pci_bus for dn %s\n", __func__, slot->dn->full_name); |
99 | return -EINVAL; | 99 | return -EINVAL; |
100 | } | 100 | } |
101 | 101 | ||
@@ -111,7 +111,7 @@ int rpaphp_enable_slot(struct slot *slot) | |||
111 | /* non-empty slot has to have child */ | 111 | /* non-empty slot has to have child */ |
112 | if (!slot->dn->child) { | 112 | if (!slot->dn->child) { |
113 | err("%s: slot[%s]'s device_node doesn't have child for adapter\n", | 113 | err("%s: slot[%s]'s device_node doesn't have child for adapter\n", |
114 | __FUNCTION__, slot->name); | 114 | __func__, slot->name); |
115 | return -EINVAL; | 115 | return -EINVAL; |
116 | } | 116 | } |
117 | 117 | ||
@@ -125,7 +125,7 @@ int rpaphp_enable_slot(struct slot *slot) | |||
125 | 125 | ||
126 | if (debug) { | 126 | if (debug) { |
127 | struct pci_dev *dev; | 127 | struct pci_dev *dev; |
128 | dbg("%s: pci_devs of slot[%s]\n", __FUNCTION__, slot->dn->full_name); | 128 | dbg("%s: pci_devs of slot[%s]\n", __func__, slot->dn->full_name); |
129 | list_for_each_entry (dev, &bus->devices, bus_list) | 129 | list_for_each_entry (dev, &bus->devices, bus_list) |
130 | dbg("\t%s\n", pci_name(dev)); | 130 | dbg("\t%s\n", pci_name(dev)); |
131 | } | 131 | } |
diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c index 8ad3debb3794..56197b600d36 100644 --- a/drivers/pci/hotplug/rpaphp_slot.c +++ b/drivers/pci/hotplug/rpaphp_slot.c | |||
@@ -131,7 +131,7 @@ int rpaphp_deregister_slot(struct slot *slot) | |||
131 | struct hotplug_slot *php_slot = slot->hotplug_slot; | 131 | struct hotplug_slot *php_slot = slot->hotplug_slot; |
132 | 132 | ||
133 | dbg("%s - Entry: deregistering slot=%s\n", | 133 | dbg("%s - Entry: deregistering slot=%s\n", |
134 | __FUNCTION__, slot->name); | 134 | __func__, slot->name); |
135 | 135 | ||
136 | list_del(&slot->rpaphp_slot_list); | 136 | list_del(&slot->rpaphp_slot_list); |
137 | 137 | ||
@@ -142,7 +142,7 @@ int rpaphp_deregister_slot(struct slot *slot) | |||
142 | if (retval) | 142 | if (retval) |
143 | err("Problem unregistering a slot %s\n", slot->name); | 143 | err("Problem unregistering a slot %s\n", slot->name); |
144 | 144 | ||
145 | dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); | 145 | dbg("%s - Exit: rc[%d]\n", __func__, retval); |
146 | return retval; | 146 | return retval; |
147 | } | 147 | } |
148 | EXPORT_SYMBOL_GPL(rpaphp_deregister_slot); | 148 | EXPORT_SYMBOL_GPL(rpaphp_deregister_slot); |
@@ -153,7 +153,7 @@ int rpaphp_register_slot(struct slot *slot) | |||
153 | int retval; | 153 | int retval; |
154 | 154 | ||
155 | dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n", | 155 | dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n", |
156 | __FUNCTION__, slot->dn->full_name, slot->index, slot->name, | 156 | __func__, slot->dn->full_name, slot->index, slot->name, |
157 | slot->power_domain, slot->type); | 157 | slot->power_domain, slot->type); |
158 | 158 | ||
159 | /* should not try to register the same slot twice */ | 159 | /* should not try to register the same slot twice */ |
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c index ef07c36bccf7..2fe37cd85b69 100644 --- a/drivers/pci/hotplug/sgi_hotplug.c +++ b/drivers/pci/hotplug/sgi_hotplug.c | |||
@@ -367,7 +367,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
367 | ret = acpi_load_table((struct acpi_table_header *)ssdt); | 367 | ret = acpi_load_table((struct acpi_table_header *)ssdt); |
368 | if (ACPI_FAILURE(ret)) { | 368 | if (ACPI_FAILURE(ret)) { |
369 | printk(KERN_ERR "%s: acpi_load_table failed (0x%x)\n", | 369 | printk(KERN_ERR "%s: acpi_load_table failed (0x%x)\n", |
370 | __FUNCTION__, ret); | 370 | __func__, ret); |
371 | /* try to continue on */ | 371 | /* try to continue on */ |
372 | } | 372 | } |
373 | } | 373 | } |
@@ -459,7 +459,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
459 | if (ACPI_FAILURE(ret)) { | 459 | if (ACPI_FAILURE(ret)) { |
460 | printk(KERN_ERR "%s: acpi_bus_add " | 460 | printk(KERN_ERR "%s: acpi_bus_add " |
461 | "failed (0x%x) for slot %d " | 461 | "failed (0x%x) for slot %d " |
462 | "func %d\n", __FUNCTION__, | 462 | "func %d\n", __func__, |
463 | ret, (int)(adr>>16), | 463 | ret, (int)(adr>>16), |
464 | (int)(adr&0xffff)); | 464 | (int)(adr&0xffff)); |
465 | /* try to continue on */ | 465 | /* try to continue on */ |
@@ -570,7 +570,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
570 | if (ACPI_FAILURE(ret)) { | 570 | if (ACPI_FAILURE(ret)) { |
571 | printk(KERN_ERR "%s: acpi_unload_table_id " | 571 | printk(KERN_ERR "%s: acpi_unload_table_id " |
572 | "failed (0x%x) for id %d\n", | 572 | "failed (0x%x) for id %d\n", |
573 | __FUNCTION__, ret, ssdt_id); | 573 | __func__, ret, ssdt_id); |
574 | /* try to continue on */ | 574 | /* try to continue on */ |
575 | } | 575 | } |
576 | } | 576 | } |
@@ -689,7 +689,7 @@ static int sn_pci_hotplug_init(void) | |||
689 | 689 | ||
690 | if (!sn_prom_feature_available(PRF_HOTPLUG_SUPPORT)) { | 690 | if (!sn_prom_feature_available(PRF_HOTPLUG_SUPPORT)) { |
691 | printk(KERN_ERR "%s: PROM version does not support hotplug.\n", | 691 | printk(KERN_ERR "%s: PROM version does not support hotplug.\n", |
692 | __FUNCTION__); | 692 | __func__); |
693 | return -EPERM; | 693 | return -EPERM; |
694 | } | 694 | } |
695 | 695 | ||
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h index 37ed0884b972..f66e8d6315ab 100644 --- a/drivers/pci/hotplug/shpchp.h +++ b/drivers/pci/hotplug/shpchp.h | |||
@@ -234,7 +234,7 @@ static inline struct slot *shpchp_find_slot(struct controller *ctrl, u8 device) | |||
234 | return slot; | 234 | return slot; |
235 | } | 235 | } |
236 | 236 | ||
237 | err("%s: slot (device=0x%x) not found\n", __FUNCTION__, device); | 237 | err("%s: slot (device=0x%x) not found\n", __func__, device); |
238 | return NULL; | 238 | return NULL; |
239 | } | 239 | } |
240 | 240 | ||
@@ -268,7 +268,7 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot) | |||
268 | pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, &pcix_bridge_errors_reg); | 268 | pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, &pcix_bridge_errors_reg); |
269 | perr_set = pcix_bridge_errors_reg & PERR_OBSERVED_MASK; | 269 | perr_set = pcix_bridge_errors_reg & PERR_OBSERVED_MASK; |
270 | if (perr_set) { | 270 | if (perr_set) { |
271 | dbg ("%s W1C: Bridge_Errors[ PERR_OBSERVED = %08X]\n",__FUNCTION__ , perr_set); | 271 | dbg ("%s W1C: Bridge_Errors[ PERR_OBSERVED = %08X]\n",__func__ , perr_set); |
272 | 272 | ||
273 | pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, perr_set); | 273 | pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, perr_set); |
274 | } | 274 | } |
@@ -277,7 +277,7 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot) | |||
277 | pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, &pcix_mem_base_reg); | 277 | pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, &pcix_mem_base_reg); |
278 | rse_set = pcix_mem_base_reg & RSE_MASK; | 278 | rse_set = pcix_mem_base_reg & RSE_MASK; |
279 | if (rse_set) { | 279 | if (rse_set) { |
280 | dbg ("%s W1C: Memory_Base_Limit[ RSE ]\n",__FUNCTION__ ); | 280 | dbg ("%s W1C: Memory_Base_Limit[ RSE ]\n",__func__ ); |
281 | 281 | ||
282 | pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set); | 282 | pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set); |
283 | } | 283 | } |
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index 80dec9796b31..43816d4b3c43 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c | |||
@@ -91,7 +91,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
91 | { | 91 | { |
92 | struct slot *slot = hotplug_slot->private; | 92 | struct slot *slot = hotplug_slot->private; |
93 | 93 | ||
94 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 94 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
95 | 95 | ||
96 | kfree(slot->hotplug_slot->info); | 96 | kfree(slot->hotplug_slot->info); |
97 | kfree(slot->hotplug_slot); | 97 | kfree(slot->hotplug_slot); |
@@ -195,7 +195,7 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) | |||
195 | { | 195 | { |
196 | struct slot *slot = get_slot(hotplug_slot); | 196 | struct slot *slot = get_slot(hotplug_slot); |
197 | 197 | ||
198 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 198 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
199 | 199 | ||
200 | hotplug_slot->info->attention_status = status; | 200 | hotplug_slot->info->attention_status = status; |
201 | slot->hpc_ops->set_attention_status(slot, status); | 201 | slot->hpc_ops->set_attention_status(slot, status); |
@@ -207,7 +207,7 @@ static int enable_slot (struct hotplug_slot *hotplug_slot) | |||
207 | { | 207 | { |
208 | struct slot *slot = get_slot(hotplug_slot); | 208 | struct slot *slot = get_slot(hotplug_slot); |
209 | 209 | ||
210 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 210 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
211 | 211 | ||
212 | return shpchp_sysfs_enable_slot(slot); | 212 | return shpchp_sysfs_enable_slot(slot); |
213 | } | 213 | } |
@@ -216,7 +216,7 @@ static int disable_slot (struct hotplug_slot *hotplug_slot) | |||
216 | { | 216 | { |
217 | struct slot *slot = get_slot(hotplug_slot); | 217 | struct slot *slot = get_slot(hotplug_slot); |
218 | 218 | ||
219 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 219 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
220 | 220 | ||
221 | return shpchp_sysfs_disable_slot(slot); | 221 | return shpchp_sysfs_disable_slot(slot); |
222 | } | 222 | } |
@@ -226,7 +226,7 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value) | |||
226 | struct slot *slot = get_slot(hotplug_slot); | 226 | struct slot *slot = get_slot(hotplug_slot); |
227 | int retval; | 227 | int retval; |
228 | 228 | ||
229 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 229 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
230 | 230 | ||
231 | retval = slot->hpc_ops->get_power_status(slot, value); | 231 | retval = slot->hpc_ops->get_power_status(slot, value); |
232 | if (retval < 0) | 232 | if (retval < 0) |
@@ -240,7 +240,7 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value) | |||
240 | struct slot *slot = get_slot(hotplug_slot); | 240 | struct slot *slot = get_slot(hotplug_slot); |
241 | int retval; | 241 | int retval; |
242 | 242 | ||
243 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 243 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
244 | 244 | ||
245 | retval = slot->hpc_ops->get_attention_status(slot, value); | 245 | retval = slot->hpc_ops->get_attention_status(slot, value); |
246 | if (retval < 0) | 246 | if (retval < 0) |
@@ -254,7 +254,7 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value) | |||
254 | struct slot *slot = get_slot(hotplug_slot); | 254 | struct slot *slot = get_slot(hotplug_slot); |
255 | int retval; | 255 | int retval; |
256 | 256 | ||
257 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 257 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
258 | 258 | ||
259 | retval = slot->hpc_ops->get_latch_status(slot, value); | 259 | retval = slot->hpc_ops->get_latch_status(slot, value); |
260 | if (retval < 0) | 260 | if (retval < 0) |
@@ -268,7 +268,7 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value) | |||
268 | struct slot *slot = get_slot(hotplug_slot); | 268 | struct slot *slot = get_slot(hotplug_slot); |
269 | int retval; | 269 | int retval; |
270 | 270 | ||
271 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 271 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
272 | 272 | ||
273 | retval = slot->hpc_ops->get_adapter_status(slot, value); | 273 | retval = slot->hpc_ops->get_adapter_status(slot, value); |
274 | if (retval < 0) | 274 | if (retval < 0) |
@@ -282,7 +282,7 @@ static int get_address (struct hotplug_slot *hotplug_slot, u32 *value) | |||
282 | struct slot *slot = get_slot(hotplug_slot); | 282 | struct slot *slot = get_slot(hotplug_slot); |
283 | struct pci_bus *bus = slot->ctrl->pci_dev->subordinate; | 283 | struct pci_bus *bus = slot->ctrl->pci_dev->subordinate; |
284 | 284 | ||
285 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 285 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
286 | 286 | ||
287 | *value = (pci_domain_nr(bus) << 16) | (slot->bus << 8) | slot->device; | 287 | *value = (pci_domain_nr(bus) << 16) | (slot->bus << 8) | slot->device; |
288 | 288 | ||
@@ -294,7 +294,7 @@ static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp | |||
294 | struct slot *slot = get_slot(hotplug_slot); | 294 | struct slot *slot = get_slot(hotplug_slot); |
295 | int retval; | 295 | int retval; |
296 | 296 | ||
297 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 297 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
298 | 298 | ||
299 | retval = slot->hpc_ops->get_max_bus_speed(slot, value); | 299 | retval = slot->hpc_ops->get_max_bus_speed(slot, value); |
300 | if (retval < 0) | 300 | if (retval < 0) |
@@ -308,7 +308,7 @@ static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp | |||
308 | struct slot *slot = get_slot(hotplug_slot); | 308 | struct slot *slot = get_slot(hotplug_slot); |
309 | int retval; | 309 | int retval; |
310 | 310 | ||
311 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 311 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
312 | 312 | ||
313 | retval = slot->hpc_ops->get_cur_bus_speed(slot, value); | 313 | retval = slot->hpc_ops->get_cur_bus_speed(slot, value); |
314 | if (retval < 0) | 314 | if (retval < 0) |
@@ -338,7 +338,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
338 | 338 | ||
339 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); | 339 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); |
340 | if (!ctrl) { | 340 | if (!ctrl) { |
341 | err("%s : out of memory\n", __FUNCTION__); | 341 | err("%s : out of memory\n", __func__); |
342 | goto err_out_none; | 342 | goto err_out_none; |
343 | } | 343 | } |
344 | INIT_LIST_HEAD(&ctrl->slot_list); | 344 | INIT_LIST_HEAD(&ctrl->slot_list); |
@@ -402,7 +402,7 @@ static int __init shpcd_init(void) | |||
402 | int retval = 0; | 402 | int retval = 0; |
403 | 403 | ||
404 | retval = pci_register_driver(&shpc_driver); | 404 | retval = pci_register_driver(&shpc_driver); |
405 | dbg("%s: pci_register_driver = %d\n", __FUNCTION__, retval); | 405 | dbg("%s: pci_register_driver = %d\n", __func__, retval); |
406 | info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); | 406 | info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); |
407 | return retval; | 407 | return retval; |
408 | } | 408 | } |
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c index eb5cac6f08ae..dfb53932dfbc 100644 --- a/drivers/pci/hotplug/shpchp_ctrl.c +++ b/drivers/pci/hotplug/shpchp_ctrl.c | |||
@@ -91,7 +91,7 @@ u8 shpchp_handle_switch_change(u8 hp_slot, struct controller *ctrl) | |||
91 | p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | 91 | p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); |
92 | p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); | 92 | p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); |
93 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 93 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
94 | dbg("%s: Card present %x Power status %x\n", __FUNCTION__, | 94 | dbg("%s: Card present %x Power status %x\n", __func__, |
95 | p_slot->presence_save, p_slot->pwr_save); | 95 | p_slot->presence_save, p_slot->pwr_save); |
96 | 96 | ||
97 | if (getstatus) { | 97 | if (getstatus) { |
@@ -191,10 +191,10 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot, | |||
191 | { | 191 | { |
192 | int rc = 0; | 192 | int rc = 0; |
193 | 193 | ||
194 | dbg("%s: change to speed %d\n", __FUNCTION__, speed); | 194 | dbg("%s: change to speed %d\n", __func__, speed); |
195 | if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) { | 195 | if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) { |
196 | err("%s: Issue of set bus speed mode command failed\n", | 196 | err("%s: Issue of set bus speed mode command failed\n", |
197 | __FUNCTION__); | 197 | __func__); |
198 | return WRONG_BUS_FREQUENCY; | 198 | return WRONG_BUS_FREQUENCY; |
199 | } | 199 | } |
200 | return rc; | 200 | return rc; |
@@ -213,7 +213,7 @@ static int fix_bus_speed(struct controller *ctrl, struct slot *pslot, | |||
213 | if (flag) { | 213 | if (flag) { |
214 | if (asp < bsp) { | 214 | if (asp < bsp) { |
215 | err("%s: speed of bus %x and adapter %x mismatch\n", | 215 | err("%s: speed of bus %x and adapter %x mismatch\n", |
216 | __FUNCTION__, bsp, asp); | 216 | __func__, bsp, asp); |
217 | rc = WRONG_BUS_FREQUENCY; | 217 | rc = WRONG_BUS_FREQUENCY; |
218 | } | 218 | } |
219 | return rc; | 219 | return rc; |
@@ -247,13 +247,13 @@ static int board_added(struct slot *p_slot) | |||
247 | hp_slot = p_slot->device - ctrl->slot_device_offset; | 247 | hp_slot = p_slot->device - ctrl->slot_device_offset; |
248 | 248 | ||
249 | dbg("%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n", | 249 | dbg("%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n", |
250 | __FUNCTION__, p_slot->device, | 250 | __func__, p_slot->device, |
251 | ctrl->slot_device_offset, hp_slot); | 251 | ctrl->slot_device_offset, hp_slot); |
252 | 252 | ||
253 | /* Power on slot without connecting to bus */ | 253 | /* Power on slot without connecting to bus */ |
254 | rc = p_slot->hpc_ops->power_on_slot(p_slot); | 254 | rc = p_slot->hpc_ops->power_on_slot(p_slot); |
255 | if (rc) { | 255 | if (rc) { |
256 | err("%s: Failed to power on slot\n", __FUNCTION__); | 256 | err("%s: Failed to power on slot\n", __func__); |
257 | return -1; | 257 | return -1; |
258 | } | 258 | } |
259 | 259 | ||
@@ -262,13 +262,13 @@ static int board_added(struct slot *p_slot) | |||
262 | return WRONG_BUS_FREQUENCY; | 262 | return WRONG_BUS_FREQUENCY; |
263 | 263 | ||
264 | if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) { | 264 | if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) { |
265 | err("%s: Issue of set bus speed mode command failed\n", __FUNCTION__); | 265 | err("%s: Issue of set bus speed mode command failed\n", __func__); |
266 | return WRONG_BUS_FREQUENCY; | 266 | return WRONG_BUS_FREQUENCY; |
267 | } | 267 | } |
268 | 268 | ||
269 | /* turn on board, blink green LED, turn off Amber LED */ | 269 | /* turn on board, blink green LED, turn off Amber LED */ |
270 | if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { | 270 | if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { |
271 | err("%s: Issue of Slot Enable command failed\n", __FUNCTION__); | 271 | err("%s: Issue of Slot Enable command failed\n", __func__); |
272 | return rc; | 272 | return rc; |
273 | } | 273 | } |
274 | } | 274 | } |
@@ -276,19 +276,19 @@ static int board_added(struct slot *p_slot) | |||
276 | rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp); | 276 | rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp); |
277 | if (rc) { | 277 | if (rc) { |
278 | err("%s: Can't get adapter speed or bus mode mismatch\n", | 278 | err("%s: Can't get adapter speed or bus mode mismatch\n", |
279 | __FUNCTION__); | 279 | __func__); |
280 | return WRONG_BUS_FREQUENCY; | 280 | return WRONG_BUS_FREQUENCY; |
281 | } | 281 | } |
282 | 282 | ||
283 | rc = p_slot->hpc_ops->get_cur_bus_speed(p_slot, &bsp); | 283 | rc = p_slot->hpc_ops->get_cur_bus_speed(p_slot, &bsp); |
284 | if (rc) { | 284 | if (rc) { |
285 | err("%s: Can't get bus operation speed\n", __FUNCTION__); | 285 | err("%s: Can't get bus operation speed\n", __func__); |
286 | return WRONG_BUS_FREQUENCY; | 286 | return WRONG_BUS_FREQUENCY; |
287 | } | 287 | } |
288 | 288 | ||
289 | rc = p_slot->hpc_ops->get_max_bus_speed(p_slot, &msp); | 289 | rc = p_slot->hpc_ops->get_max_bus_speed(p_slot, &msp); |
290 | if (rc) { | 290 | if (rc) { |
291 | err("%s: Can't get max bus operation speed\n", __FUNCTION__); | 291 | err("%s: Can't get max bus operation speed\n", __func__); |
292 | msp = bsp; | 292 | msp = bsp; |
293 | } | 293 | } |
294 | 294 | ||
@@ -297,7 +297,7 @@ static int board_added(struct slot *p_slot) | |||
297 | slots_not_empty = 1; | 297 | slots_not_empty = 1; |
298 | 298 | ||
299 | dbg("%s: slots_not_empty %d, adapter_speed %d, bus_speed %d, " | 299 | dbg("%s: slots_not_empty %d, adapter_speed %d, bus_speed %d, " |
300 | "max_bus_speed %d\n", __FUNCTION__, slots_not_empty, asp, | 300 | "max_bus_speed %d\n", __func__, slots_not_empty, asp, |
301 | bsp, msp); | 301 | bsp, msp); |
302 | 302 | ||
303 | rc = fix_bus_speed(ctrl, p_slot, slots_not_empty, asp, bsp, msp); | 303 | rc = fix_bus_speed(ctrl, p_slot, slots_not_empty, asp, bsp, msp); |
@@ -306,18 +306,18 @@ static int board_added(struct slot *p_slot) | |||
306 | 306 | ||
307 | /* turn on board, blink green LED, turn off Amber LED */ | 307 | /* turn on board, blink green LED, turn off Amber LED */ |
308 | if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { | 308 | if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { |
309 | err("%s: Issue of Slot Enable command failed\n", __FUNCTION__); | 309 | err("%s: Issue of Slot Enable command failed\n", __func__); |
310 | return rc; | 310 | return rc; |
311 | } | 311 | } |
312 | 312 | ||
313 | /* Wait for ~1 second */ | 313 | /* Wait for ~1 second */ |
314 | msleep(1000); | 314 | msleep(1000); |
315 | 315 | ||
316 | dbg("%s: slot status = %x\n", __FUNCTION__, p_slot->status); | 316 | dbg("%s: slot status = %x\n", __func__, p_slot->status); |
317 | /* Check for a power fault */ | 317 | /* Check for a power fault */ |
318 | if (p_slot->status == 0xFF) { | 318 | if (p_slot->status == 0xFF) { |
319 | /* power fault occurred, but it was benign */ | 319 | /* power fault occurred, but it was benign */ |
320 | dbg("%s: power fault\n", __FUNCTION__); | 320 | dbg("%s: power fault\n", __func__); |
321 | rc = POWER_FAILURE; | 321 | rc = POWER_FAILURE; |
322 | p_slot->status = 0; | 322 | p_slot->status = 0; |
323 | goto err_exit; | 323 | goto err_exit; |
@@ -341,7 +341,7 @@ err_exit: | |||
341 | /* turn off slot, turn on Amber LED, turn off Green LED */ | 341 | /* turn off slot, turn on Amber LED, turn off Green LED */ |
342 | rc = p_slot->hpc_ops->slot_disable(p_slot); | 342 | rc = p_slot->hpc_ops->slot_disable(p_slot); |
343 | if (rc) { | 343 | if (rc) { |
344 | err("%s: Issue of Slot Disable command failed\n", __FUNCTION__); | 344 | err("%s: Issue of Slot Disable command failed\n", __func__); |
345 | return rc; | 345 | return rc; |
346 | } | 346 | } |
347 | 347 | ||
@@ -365,7 +365,7 @@ static int remove_board(struct slot *p_slot) | |||
365 | hp_slot = p_slot->device - ctrl->slot_device_offset; | 365 | hp_slot = p_slot->device - ctrl->slot_device_offset; |
366 | p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | 366 | p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); |
367 | 367 | ||
368 | dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); | 368 | dbg("In %s, hp_slot = %d\n", __func__, hp_slot); |
369 | 369 | ||
370 | /* Change status to shutdown */ | 370 | /* Change status to shutdown */ |
371 | if (p_slot->is_a_board) | 371 | if (p_slot->is_a_board) |
@@ -374,13 +374,13 @@ static int remove_board(struct slot *p_slot) | |||
374 | /* turn off slot, turn on Amber LED, turn off Green LED */ | 374 | /* turn off slot, turn on Amber LED, turn off Green LED */ |
375 | rc = p_slot->hpc_ops->slot_disable(p_slot); | 375 | rc = p_slot->hpc_ops->slot_disable(p_slot); |
376 | if (rc) { | 376 | if (rc) { |
377 | err("%s: Issue of Slot Disable command failed\n", __FUNCTION__); | 377 | err("%s: Issue of Slot Disable command failed\n", __func__); |
378 | return rc; | 378 | return rc; |
379 | } | 379 | } |
380 | 380 | ||
381 | rc = p_slot->hpc_ops->set_attention_status(p_slot, 0); | 381 | rc = p_slot->hpc_ops->set_attention_status(p_slot, 0); |
382 | if (rc) { | 382 | if (rc) { |
383 | err("%s: Issue of Set Attention command failed\n", __FUNCTION__); | 383 | err("%s: Issue of Set Attention command failed\n", __func__); |
384 | return rc; | 384 | return rc; |
385 | } | 385 | } |
386 | 386 | ||
@@ -439,7 +439,7 @@ void shpchp_queue_pushbutton_work(struct work_struct *work) | |||
439 | 439 | ||
440 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 440 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
441 | if (!info) { | 441 | if (!info) { |
442 | err("%s: Cannot allocate memory\n", __FUNCTION__); | 442 | err("%s: Cannot allocate memory\n", __func__); |
443 | return; | 443 | return; |
444 | } | 444 | } |
445 | info->p_slot = p_slot; | 445 | info->p_slot = p_slot; |
@@ -513,7 +513,7 @@ static void handle_button_press_event(struct slot *p_slot) | |||
513 | * expires to cancel hot-add or hot-remove | 513 | * expires to cancel hot-add or hot-remove |
514 | */ | 514 | */ |
515 | info("Button cancel on Slot(%s)\n", p_slot->name); | 515 | info("Button cancel on Slot(%s)\n", p_slot->name); |
516 | dbg("%s: button cancel\n", __FUNCTION__); | 516 | dbg("%s: button cancel\n", __func__); |
517 | cancel_delayed_work(&p_slot->work); | 517 | cancel_delayed_work(&p_slot->work); |
518 | if (p_slot->state == BLINKINGOFF_STATE) | 518 | if (p_slot->state == BLINKINGOFF_STATE) |
519 | p_slot->hpc_ops->green_led_on(p_slot); | 519 | p_slot->hpc_ops->green_led_on(p_slot); |
@@ -551,7 +551,7 @@ static void interrupt_event_handler(struct work_struct *work) | |||
551 | handle_button_press_event(p_slot); | 551 | handle_button_press_event(p_slot); |
552 | break; | 552 | break; |
553 | case INT_POWER_FAULT: | 553 | case INT_POWER_FAULT: |
554 | dbg("%s: power fault\n", __FUNCTION__); | 554 | dbg("%s: power fault\n", __func__); |
555 | p_slot->hpc_ops->set_attention_status(p_slot, 1); | 555 | p_slot->hpc_ops->set_attention_status(p_slot, 1); |
556 | p_slot->hpc_ops->green_led_off(p_slot); | 556 | p_slot->hpc_ops->green_led_off(p_slot); |
557 | break; | 557 | break; |
@@ -593,7 +593,7 @@ static int shpchp_enable_slot (struct slot *p_slot) | |||
593 | /* We have to save the presence info for these slots */ | 593 | /* We have to save the presence info for these slots */ |
594 | p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); | 594 | p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); |
595 | p_slot->hpc_ops->get_power_status(p_slot, &(p_slot->pwr_save)); | 595 | p_slot->hpc_ops->get_power_status(p_slot, &(p_slot->pwr_save)); |
596 | dbg("%s: p_slot->pwr_save %x\n", __FUNCTION__, p_slot->pwr_save); | 596 | dbg("%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save); |
597 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 597 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
598 | 598 | ||
599 | if(((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD) || | 599 | if(((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD) || |
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c index e8aa138128ce..7d770b2cd889 100644 --- a/drivers/pci/hotplug/shpchp_hpc.c +++ b/drivers/pci/hotplug/shpchp_hpc.c | |||
@@ -321,14 +321,14 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd) | |||
321 | if (!shpc_poll_ctrl_busy(ctrl)) { | 321 | if (!shpc_poll_ctrl_busy(ctrl)) { |
322 | /* After 1 sec and and the controller is still busy */ | 322 | /* After 1 sec and and the controller is still busy */ |
323 | err("%s : Controller is still busy after 1 sec.\n", | 323 | err("%s : Controller is still busy after 1 sec.\n", |
324 | __FUNCTION__); | 324 | __func__); |
325 | retval = -EBUSY; | 325 | retval = -EBUSY; |
326 | goto out; | 326 | goto out; |
327 | } | 327 | } |
328 | 328 | ||
329 | ++t_slot; | 329 | ++t_slot; |
330 | temp_word = (t_slot << 8) | (cmd & 0xFF); | 330 | temp_word = (t_slot << 8) | (cmd & 0xFF); |
331 | dbg("%s: t_slot %x cmd %x\n", __FUNCTION__, t_slot, cmd); | 331 | dbg("%s: t_slot %x cmd %x\n", __func__, t_slot, cmd); |
332 | 332 | ||
333 | /* To make sure the Controller Busy bit is 0 before we send out the | 333 | /* To make sure the Controller Busy bit is 0 before we send out the |
334 | * command. | 334 | * command. |
@@ -345,7 +345,7 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd) | |||
345 | cmd_status = hpc_check_cmd_status(slot->ctrl); | 345 | cmd_status = hpc_check_cmd_status(slot->ctrl); |
346 | if (cmd_status) { | 346 | if (cmd_status) { |
347 | err("%s: Failed to issued command 0x%x (error code = %d)\n", | 347 | err("%s: Failed to issued command 0x%x (error code = %d)\n", |
348 | __FUNCTION__, cmd, cmd_status); | 348 | __func__, cmd, cmd_status); |
349 | retval = -EIO; | 349 | retval = -EIO; |
350 | } | 350 | } |
351 | out: | 351 | out: |
@@ -364,15 +364,15 @@ static int hpc_check_cmd_status(struct controller *ctrl) | |||
364 | break; | 364 | break; |
365 | case 1: | 365 | case 1: |
366 | retval = SWITCH_OPEN; | 366 | retval = SWITCH_OPEN; |
367 | err("%s: Switch opened!\n", __FUNCTION__); | 367 | err("%s: Switch opened!\n", __func__); |
368 | break; | 368 | break; |
369 | case 2: | 369 | case 2: |
370 | retval = INVALID_CMD; | 370 | retval = INVALID_CMD; |
371 | err("%s: Invalid HPC command!\n", __FUNCTION__); | 371 | err("%s: Invalid HPC command!\n", __func__); |
372 | break; | 372 | break; |
373 | case 4: | 373 | case 4: |
374 | retval = INVALID_SPEED_MODE; | 374 | retval = INVALID_SPEED_MODE; |
375 | err("%s: Invalid bus speed/mode!\n", __FUNCTION__); | 375 | err("%s: Invalid bus speed/mode!\n", __func__); |
376 | break; | 376 | break; |
377 | default: | 377 | default: |
378 | retval = cmd_status; | 378 | retval = cmd_status; |
@@ -484,7 +484,7 @@ static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value) | |||
484 | } | 484 | } |
485 | 485 | ||
486 | dbg("%s: slot_reg = %x, pcix_cap = %x, m66_cap = %x\n", | 486 | dbg("%s: slot_reg = %x, pcix_cap = %x, m66_cap = %x\n", |
487 | __FUNCTION__, slot_reg, pcix_cap, m66_cap); | 487 | __func__, slot_reg, pcix_cap, m66_cap); |
488 | 488 | ||
489 | switch (pcix_cap) { | 489 | switch (pcix_cap) { |
490 | case 0x0: | 490 | case 0x0: |
@@ -629,7 +629,7 @@ static int hpc_power_on_slot(struct slot * slot) | |||
629 | 629 | ||
630 | retval = shpc_write_cmd(slot, slot->hp_slot, SET_SLOT_PWR); | 630 | retval = shpc_write_cmd(slot, slot->hp_slot, SET_SLOT_PWR); |
631 | if (retval) | 631 | if (retval) |
632 | err("%s: Write command failed!\n", __FUNCTION__); | 632 | err("%s: Write command failed!\n", __func__); |
633 | 633 | ||
634 | return retval; | 634 | return retval; |
635 | } | 635 | } |
@@ -642,7 +642,7 @@ static int hpc_slot_enable(struct slot * slot) | |||
642 | retval = shpc_write_cmd(slot, slot->hp_slot, | 642 | retval = shpc_write_cmd(slot, slot->hp_slot, |
643 | SET_SLOT_ENABLE | SET_PWR_BLINK | SET_ATTN_OFF); | 643 | SET_SLOT_ENABLE | SET_PWR_BLINK | SET_ATTN_OFF); |
644 | if (retval) | 644 | if (retval) |
645 | err("%s: Write command failed!\n", __FUNCTION__); | 645 | err("%s: Write command failed!\n", __func__); |
646 | 646 | ||
647 | return retval; | 647 | return retval; |
648 | } | 648 | } |
@@ -655,7 +655,7 @@ static int hpc_slot_disable(struct slot * slot) | |||
655 | retval = shpc_write_cmd(slot, slot->hp_slot, | 655 | retval = shpc_write_cmd(slot, slot->hp_slot, |
656 | SET_SLOT_DISABLE | SET_PWR_OFF | SET_ATTN_ON); | 656 | SET_SLOT_DISABLE | SET_PWR_OFF | SET_ATTN_ON); |
657 | if (retval) | 657 | if (retval) |
658 | err("%s: Write command failed!\n", __FUNCTION__); | 658 | err("%s: Write command failed!\n", __func__); |
659 | 659 | ||
660 | return retval; | 660 | return retval; |
661 | } | 661 | } |
@@ -719,7 +719,7 @@ static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value) | |||
719 | 719 | ||
720 | retval = shpc_write_cmd(slot, 0, cmd); | 720 | retval = shpc_write_cmd(slot, 0, cmd); |
721 | if (retval) | 721 | if (retval) |
722 | err("%s: Write command failed!\n", __FUNCTION__); | 722 | err("%s: Write command failed!\n", __func__); |
723 | 723 | ||
724 | return retval; | 724 | return retval; |
725 | } | 725 | } |
@@ -735,7 +735,7 @@ static irqreturn_t shpc_isr(int irq, void *dev_id) | |||
735 | if (!intr_loc) | 735 | if (!intr_loc) |
736 | return IRQ_NONE; | 736 | return IRQ_NONE; |
737 | 737 | ||
738 | dbg("%s: intr_loc = %x\n",__FUNCTION__, intr_loc); | 738 | dbg("%s: intr_loc = %x\n",__func__, intr_loc); |
739 | 739 | ||
740 | if(!shpchp_poll_mode) { | 740 | if(!shpchp_poll_mode) { |
741 | /* | 741 | /* |
@@ -748,7 +748,7 @@ static irqreturn_t shpc_isr(int irq, void *dev_id) | |||
748 | shpc_writel(ctrl, SERR_INTR_ENABLE, serr_int); | 748 | shpc_writel(ctrl, SERR_INTR_ENABLE, serr_int); |
749 | 749 | ||
750 | intr_loc2 = shpc_readl(ctrl, INTR_LOC); | 750 | intr_loc2 = shpc_readl(ctrl, INTR_LOC); |
751 | dbg("%s: intr_loc2 = %x\n",__FUNCTION__, intr_loc2); | 751 | dbg("%s: intr_loc2 = %x\n",__func__, intr_loc2); |
752 | } | 752 | } |
753 | 753 | ||
754 | if (intr_loc & CMD_INTR_PENDING) { | 754 | if (intr_loc & CMD_INTR_PENDING) { |
@@ -774,7 +774,7 @@ static irqreturn_t shpc_isr(int irq, void *dev_id) | |||
774 | 774 | ||
775 | slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); | 775 | slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); |
776 | dbg("%s: Slot %x with intr, slot register = %x\n", | 776 | dbg("%s: Slot %x with intr, slot register = %x\n", |
777 | __FUNCTION__, hp_slot, slot_reg); | 777 | __func__, hp_slot, slot_reg); |
778 | 778 | ||
779 | if (slot_reg & MRL_CHANGE_DETECTED) | 779 | if (slot_reg & MRL_CHANGE_DETECTED) |
780 | shpchp_handle_switch_change(hp_slot, ctrl); | 780 | shpchp_handle_switch_change(hp_slot, ctrl); |
@@ -958,33 +958,33 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) | |||
958 | } else { | 958 | } else { |
959 | ctrl->cap_offset = pci_find_capability(pdev, PCI_CAP_ID_SHPC); | 959 | ctrl->cap_offset = pci_find_capability(pdev, PCI_CAP_ID_SHPC); |
960 | if (!ctrl->cap_offset) { | 960 | if (!ctrl->cap_offset) { |
961 | err("%s : cap_offset == 0\n", __FUNCTION__); | 961 | err("%s : cap_offset == 0\n", __func__); |
962 | goto abort; | 962 | goto abort; |
963 | } | 963 | } |
964 | dbg("%s: cap_offset = %x\n", __FUNCTION__, ctrl->cap_offset); | 964 | dbg("%s: cap_offset = %x\n", __func__, ctrl->cap_offset); |
965 | 965 | ||
966 | rc = shpc_indirect_read(ctrl, 0, &shpc_base_offset); | 966 | rc = shpc_indirect_read(ctrl, 0, &shpc_base_offset); |
967 | if (rc) { | 967 | if (rc) { |
968 | err("%s: cannot read base_offset\n", __FUNCTION__); | 968 | err("%s: cannot read base_offset\n", __func__); |
969 | goto abort; | 969 | goto abort; |
970 | } | 970 | } |
971 | 971 | ||
972 | rc = shpc_indirect_read(ctrl, 3, &tempdword); | 972 | rc = shpc_indirect_read(ctrl, 3, &tempdword); |
973 | if (rc) { | 973 | if (rc) { |
974 | err("%s: cannot read slot config\n", __FUNCTION__); | 974 | err("%s: cannot read slot config\n", __func__); |
975 | goto abort; | 975 | goto abort; |
976 | } | 976 | } |
977 | num_slots = tempdword & SLOT_NUM; | 977 | num_slots = tempdword & SLOT_NUM; |
978 | dbg("%s: num_slots (indirect) %x\n", __FUNCTION__, num_slots); | 978 | dbg("%s: num_slots (indirect) %x\n", __func__, num_slots); |
979 | 979 | ||
980 | for (i = 0; i < 9 + num_slots; i++) { | 980 | for (i = 0; i < 9 + num_slots; i++) { |
981 | rc = shpc_indirect_read(ctrl, i, &tempdword); | 981 | rc = shpc_indirect_read(ctrl, i, &tempdword); |
982 | if (rc) { | 982 | if (rc) { |
983 | err("%s: cannot read creg (index = %d)\n", | 983 | err("%s: cannot read creg (index = %d)\n", |
984 | __FUNCTION__, i); | 984 | __func__, i); |
985 | goto abort; | 985 | goto abort; |
986 | } | 986 | } |
987 | dbg("%s: offset %d: value %x\n", __FUNCTION__,i, | 987 | dbg("%s: offset %d: value %x\n", __func__,i, |
988 | tempdword); | 988 | tempdword); |
989 | } | 989 | } |
990 | 990 | ||
@@ -998,25 +998,25 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) | |||
998 | 998 | ||
999 | rc = pci_enable_device(pdev); | 999 | rc = pci_enable_device(pdev); |
1000 | if (rc) { | 1000 | if (rc) { |
1001 | err("%s: pci_enable_device failed\n", __FUNCTION__); | 1001 | err("%s: pci_enable_device failed\n", __func__); |
1002 | goto abort; | 1002 | goto abort; |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | if (!request_mem_region(ctrl->mmio_base, ctrl->mmio_size, MY_NAME)) { | 1005 | if (!request_mem_region(ctrl->mmio_base, ctrl->mmio_size, MY_NAME)) { |
1006 | err("%s: cannot reserve MMIO region\n", __FUNCTION__); | 1006 | err("%s: cannot reserve MMIO region\n", __func__); |
1007 | rc = -1; | 1007 | rc = -1; |
1008 | goto abort; | 1008 | goto abort; |
1009 | } | 1009 | } |
1010 | 1010 | ||
1011 | ctrl->creg = ioremap(ctrl->mmio_base, ctrl->mmio_size); | 1011 | ctrl->creg = ioremap(ctrl->mmio_base, ctrl->mmio_size); |
1012 | if (!ctrl->creg) { | 1012 | if (!ctrl->creg) { |
1013 | err("%s: cannot remap MMIO region %lx @ %lx\n", __FUNCTION__, | 1013 | err("%s: cannot remap MMIO region %lx @ %lx\n", __func__, |
1014 | ctrl->mmio_size, ctrl->mmio_base); | 1014 | ctrl->mmio_size, ctrl->mmio_base); |
1015 | release_mem_region(ctrl->mmio_base, ctrl->mmio_size); | 1015 | release_mem_region(ctrl->mmio_base, ctrl->mmio_size); |
1016 | rc = -1; | 1016 | rc = -1; |
1017 | goto abort; | 1017 | goto abort; |
1018 | } | 1018 | } |
1019 | dbg("%s: ctrl->creg %p\n", __FUNCTION__, ctrl->creg); | 1019 | dbg("%s: ctrl->creg %p\n", __func__, ctrl->creg); |
1020 | 1020 | ||
1021 | mutex_init(&ctrl->crit_sect); | 1021 | mutex_init(&ctrl->crit_sect); |
1022 | mutex_init(&ctrl->cmd_lock); | 1022 | mutex_init(&ctrl->cmd_lock); |
@@ -1035,20 +1035,20 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) | |||
1035 | 1035 | ||
1036 | /* Mask Global Interrupt Mask & Command Complete Interrupt Mask */ | 1036 | /* Mask Global Interrupt Mask & Command Complete Interrupt Mask */ |
1037 | tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); | 1037 | tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); |
1038 | dbg("%s: SERR_INTR_ENABLE = %x\n", __FUNCTION__, tempdword); | 1038 | dbg("%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword); |
1039 | tempdword |= (GLOBAL_INTR_MASK | GLOBAL_SERR_MASK | | 1039 | tempdword |= (GLOBAL_INTR_MASK | GLOBAL_SERR_MASK | |
1040 | COMMAND_INTR_MASK | ARBITER_SERR_MASK); | 1040 | COMMAND_INTR_MASK | ARBITER_SERR_MASK); |
1041 | tempdword &= ~SERR_INTR_RSVDZ_MASK; | 1041 | tempdword &= ~SERR_INTR_RSVDZ_MASK; |
1042 | shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword); | 1042 | shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword); |
1043 | tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); | 1043 | tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); |
1044 | dbg("%s: SERR_INTR_ENABLE = %x\n", __FUNCTION__, tempdword); | 1044 | dbg("%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword); |
1045 | 1045 | ||
1046 | /* Mask the MRL sensor SERR Mask of individual slot in | 1046 | /* Mask the MRL sensor SERR Mask of individual slot in |
1047 | * Slot SERR-INT Mask & clear all the existing event if any | 1047 | * Slot SERR-INT Mask & clear all the existing event if any |
1048 | */ | 1048 | */ |
1049 | for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) { | 1049 | for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) { |
1050 | slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); | 1050 | slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); |
1051 | dbg("%s: Default Logical Slot Register %d value %x\n", __FUNCTION__, | 1051 | dbg("%s: Default Logical Slot Register %d value %x\n", __func__, |
1052 | hp_slot, slot_reg); | 1052 | hp_slot, slot_reg); |
1053 | slot_reg |= (PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK | | 1053 | slot_reg |= (PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK | |
1054 | BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK | | 1054 | BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK | |
@@ -1073,7 +1073,7 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) | |||
1073 | rc = request_irq(ctrl->pci_dev->irq, shpc_isr, IRQF_SHARED, | 1073 | rc = request_irq(ctrl->pci_dev->irq, shpc_isr, IRQF_SHARED, |
1074 | MY_NAME, (void *)ctrl); | 1074 | MY_NAME, (void *)ctrl); |
1075 | dbg("%s: request_irq %d for hpc%d (returns %d)\n", | 1075 | dbg("%s: request_irq %d for hpc%d (returns %d)\n", |
1076 | __FUNCTION__, ctrl->pci_dev->irq, | 1076 | __func__, ctrl->pci_dev->irq, |
1077 | atomic_read(&shpchp_num_controllers), rc); | 1077 | atomic_read(&shpchp_num_controllers), rc); |
1078 | if (rc) { | 1078 | if (rc) { |
1079 | err("Can't get irq %d for the hotplug controller\n", | 1079 | err("Can't get irq %d for the hotplug controller\n", |
@@ -1081,7 +1081,7 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) | |||
1081 | goto abort_iounmap; | 1081 | goto abort_iounmap; |
1082 | } | 1082 | } |
1083 | } | 1083 | } |
1084 | dbg("%s: HPC at b:d:f:irq=0x%x:%x:%x:%x\n", __FUNCTION__, | 1084 | dbg("%s: HPC at b:d:f:irq=0x%x:%x:%x:%x\n", __func__, |
1085 | pdev->bus->number, PCI_SLOT(pdev->devfn), | 1085 | pdev->bus->number, PCI_SLOT(pdev->devfn), |
1086 | PCI_FUNC(pdev->devfn), pdev->irq); | 1086 | PCI_FUNC(pdev->devfn), pdev->irq); |
1087 | get_hp_hw_control_from_firmware(pdev); | 1087 | get_hp_hw_control_from_firmware(pdev); |
@@ -1103,7 +1103,7 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) | |||
1103 | */ | 1103 | */ |
1104 | for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) { | 1104 | for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) { |
1105 | slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); | 1105 | slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); |
1106 | dbg("%s: Default Logical Slot Register %d value %x\n", __FUNCTION__, | 1106 | dbg("%s: Default Logical Slot Register %d value %x\n", __func__, |
1107 | hp_slot, slot_reg); | 1107 | hp_slot, slot_reg); |
1108 | slot_reg &= ~(PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK | | 1108 | slot_reg &= ~(PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK | |
1109 | BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK | | 1109 | BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK | |
@@ -1117,7 +1117,7 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) | |||
1117 | SERR_INTR_RSVDZ_MASK); | 1117 | SERR_INTR_RSVDZ_MASK); |
1118 | shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword); | 1118 | shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword); |
1119 | tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); | 1119 | tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); |
1120 | dbg("%s: SERR_INTR_ENABLE = %x\n", __FUNCTION__, tempdword); | 1120 | dbg("%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword); |
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | return 0; | 1123 | return 0; |
diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c index a69a21520895..3fc4ec0eea0b 100644 --- a/drivers/pci/hotplug/shpchp_pci.c +++ b/drivers/pci/hotplug/shpchp_pci.c | |||
@@ -51,7 +51,7 @@ static void program_fw_provided_values(struct pci_dev *dev) | |||
51 | !hpp.t0 || (hpp.t0->revision > 1)) { | 51 | !hpp.t0 || (hpp.t0->revision > 1)) { |
52 | printk(KERN_WARNING | 52 | printk(KERN_WARNING |
53 | "%s: Could not get hotplug parameters. Use defaults\n", | 53 | "%s: Could not get hotplug parameters. Use defaults\n", |
54 | __FUNCTION__); | 54 | __func__); |
55 | hpp.t0 = &hpp.type0_data; | 55 | hpp.t0 = &hpp.type0_data; |
56 | hpp.t0->revision = 0; | 56 | hpp.t0->revision = 0; |
57 | hpp.t0->cache_line_size = 8; | 57 | hpp.t0->cache_line_size = 8; |
@@ -169,7 +169,7 @@ int shpchp_unconfigure_device(struct slot *p_slot) | |||
169 | u8 bctl = 0; | 169 | u8 bctl = 0; |
170 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; | 170 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; |
171 | 171 | ||
172 | dbg("%s: bus/dev = %x/%x\n", __FUNCTION__, p_slot->bus, p_slot->device); | 172 | dbg("%s: bus/dev = %x/%x\n", __func__, p_slot->bus, p_slot->device); |
173 | 173 | ||
174 | for (j=0; j<8 ; j++) { | 174 | for (j=0; j<8 ; j++) { |
175 | struct pci_dev* temp = pci_get_slot(parent, | 175 | struct pci_dev* temp = pci_get_slot(parent, |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 4cb949f0ebd9..301c68fab03b 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/bitmap.h> | 24 | #include <linux/bitmap.h> |
25 | #include <linux/debugfs.h> | ||
25 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
26 | #include <linux/irq.h> | 27 | #include <linux/irq.h> |
27 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
@@ -31,6 +32,7 @@ | |||
31 | #include <linux/dmar.h> | 32 | #include <linux/dmar.h> |
32 | #include <linux/dma-mapping.h> | 33 | #include <linux/dma-mapping.h> |
33 | #include <linux/mempool.h> | 34 | #include <linux/mempool.h> |
35 | #include <linux/timer.h> | ||
34 | #include "iova.h" | 36 | #include "iova.h" |
35 | #include "intel-iommu.h" | 37 | #include "intel-iommu.h" |
36 | #include <asm/proto.h> /* force_iommu in this header in x86-64*/ | 38 | #include <asm/proto.h> /* force_iommu in this header in x86-64*/ |
@@ -51,11 +53,37 @@ | |||
51 | 53 | ||
52 | #define DOMAIN_MAX_ADDR(gaw) ((((u64)1) << gaw) - 1) | 54 | #define DOMAIN_MAX_ADDR(gaw) ((((u64)1) << gaw) - 1) |
53 | 55 | ||
56 | |||
57 | static void flush_unmaps_timeout(unsigned long data); | ||
58 | |||
59 | DEFINE_TIMER(unmap_timer, flush_unmaps_timeout, 0, 0); | ||
60 | |||
61 | static struct intel_iommu *g_iommus; | ||
62 | |||
63 | #define HIGH_WATER_MARK 250 | ||
64 | struct deferred_flush_tables { | ||
65 | int next; | ||
66 | struct iova *iova[HIGH_WATER_MARK]; | ||
67 | struct dmar_domain *domain[HIGH_WATER_MARK]; | ||
68 | }; | ||
69 | |||
70 | static struct deferred_flush_tables *deferred_flush; | ||
71 | |||
72 | /* bitmap for indexing intel_iommus */ | ||
73 | static int g_num_of_iommus; | ||
74 | |||
75 | static DEFINE_SPINLOCK(async_umap_flush_lock); | ||
76 | static LIST_HEAD(unmaps_to_do); | ||
77 | |||
78 | static int timer_on; | ||
79 | static long list_size; | ||
80 | |||
54 | static void domain_remove_dev_info(struct dmar_domain *domain); | 81 | static void domain_remove_dev_info(struct dmar_domain *domain); |
55 | 82 | ||
56 | static int dmar_disabled; | 83 | static int dmar_disabled; |
57 | static int __initdata dmar_map_gfx = 1; | 84 | static int __initdata dmar_map_gfx = 1; |
58 | static int dmar_forcedac; | 85 | static int dmar_forcedac; |
86 | static int intel_iommu_strict; | ||
59 | 87 | ||
60 | #define DUMMY_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-1)) | 88 | #define DUMMY_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-1)) |
61 | static DEFINE_SPINLOCK(device_domain_lock); | 89 | static DEFINE_SPINLOCK(device_domain_lock); |
@@ -74,9 +102,13 @@ static int __init intel_iommu_setup(char *str) | |||
74 | printk(KERN_INFO | 102 | printk(KERN_INFO |
75 | "Intel-IOMMU: disable GFX device mapping\n"); | 103 | "Intel-IOMMU: disable GFX device mapping\n"); |
76 | } else if (!strncmp(str, "forcedac", 8)) { | 104 | } else if (!strncmp(str, "forcedac", 8)) { |
77 | printk (KERN_INFO | 105 | printk(KERN_INFO |
78 | "Intel-IOMMU: Forcing DAC for PCI devices\n"); | 106 | "Intel-IOMMU: Forcing DAC for PCI devices\n"); |
79 | dmar_forcedac = 1; | 107 | dmar_forcedac = 1; |
108 | } else if (!strncmp(str, "strict", 6)) { | ||
109 | printk(KERN_INFO | ||
110 | "Intel-IOMMU: disable batched IOTLB flush\n"); | ||
111 | intel_iommu_strict = 1; | ||
80 | } | 112 | } |
81 | 113 | ||
82 | str += strcspn(str, ","); | 114 | str += strcspn(str, ","); |
@@ -966,17 +998,13 @@ static int iommu_init_domains(struct intel_iommu *iommu) | |||
966 | set_bit(0, iommu->domain_ids); | 998 | set_bit(0, iommu->domain_ids); |
967 | return 0; | 999 | return 0; |
968 | } | 1000 | } |
969 | 1001 | static struct intel_iommu *alloc_iommu(struct intel_iommu *iommu, | |
970 | static struct intel_iommu *alloc_iommu(struct dmar_drhd_unit *drhd) | 1002 | struct dmar_drhd_unit *drhd) |
971 | { | 1003 | { |
972 | struct intel_iommu *iommu; | ||
973 | int ret; | 1004 | int ret; |
974 | int map_size; | 1005 | int map_size; |
975 | u32 ver; | 1006 | u32 ver; |
976 | 1007 | ||
977 | iommu = kzalloc(sizeof(*iommu), GFP_KERNEL); | ||
978 | if (!iommu) | ||
979 | return NULL; | ||
980 | iommu->reg = ioremap(drhd->reg_base_addr, PAGE_SIZE_4K); | 1008 | iommu->reg = ioremap(drhd->reg_base_addr, PAGE_SIZE_4K); |
981 | if (!iommu->reg) { | 1009 | if (!iommu->reg) { |
982 | printk(KERN_ERR "IOMMU: can't map the region\n"); | 1010 | printk(KERN_ERR "IOMMU: can't map the region\n"); |
@@ -1404,7 +1432,7 @@ static int dmar_pci_device_match(struct pci_dev *devices[], int cnt, | |||
1404 | int index; | 1432 | int index; |
1405 | 1433 | ||
1406 | while (dev) { | 1434 | while (dev) { |
1407 | for (index = 0; index < cnt; index ++) | 1435 | for (index = 0; index < cnt; index++) |
1408 | if (dev == devices[index]) | 1436 | if (dev == devices[index]) |
1409 | return 1; | 1437 | return 1; |
1410 | 1438 | ||
@@ -1669,7 +1697,7 @@ int __init init_dmars(void) | |||
1669 | struct dmar_rmrr_unit *rmrr; | 1697 | struct dmar_rmrr_unit *rmrr; |
1670 | struct pci_dev *pdev; | 1698 | struct pci_dev *pdev; |
1671 | struct intel_iommu *iommu; | 1699 | struct intel_iommu *iommu; |
1672 | int ret, unit = 0; | 1700 | int i, ret, unit = 0; |
1673 | 1701 | ||
1674 | /* | 1702 | /* |
1675 | * for each drhd | 1703 | * for each drhd |
@@ -1680,7 +1708,34 @@ int __init init_dmars(void) | |||
1680 | for_each_drhd_unit(drhd) { | 1708 | for_each_drhd_unit(drhd) { |
1681 | if (drhd->ignored) | 1709 | if (drhd->ignored) |
1682 | continue; | 1710 | continue; |
1683 | iommu = alloc_iommu(drhd); | 1711 | g_num_of_iommus++; |
1712 | /* | ||
1713 | * lock not needed as this is only incremented in the single | ||
1714 | * threaded kernel __init code path all other access are read | ||
1715 | * only | ||
1716 | */ | ||
1717 | } | ||
1718 | |||
1719 | g_iommus = kzalloc(g_num_of_iommus * sizeof(*iommu), GFP_KERNEL); | ||
1720 | if (!g_iommus) { | ||
1721 | ret = -ENOMEM; | ||
1722 | goto error; | ||
1723 | } | ||
1724 | |||
1725 | deferred_flush = kzalloc(g_num_of_iommus * | ||
1726 | sizeof(struct deferred_flush_tables), GFP_KERNEL); | ||
1727 | if (!deferred_flush) { | ||
1728 | kfree(g_iommus); | ||
1729 | ret = -ENOMEM; | ||
1730 | goto error; | ||
1731 | } | ||
1732 | |||
1733 | i = 0; | ||
1734 | for_each_drhd_unit(drhd) { | ||
1735 | if (drhd->ignored) | ||
1736 | continue; | ||
1737 | iommu = alloc_iommu(&g_iommus[i], drhd); | ||
1738 | i++; | ||
1684 | if (!iommu) { | 1739 | if (!iommu) { |
1685 | ret = -ENOMEM; | 1740 | ret = -ENOMEM; |
1686 | goto error; | 1741 | goto error; |
@@ -1713,7 +1768,6 @@ int __init init_dmars(void) | |||
1713 | * endfor | 1768 | * endfor |
1714 | */ | 1769 | */ |
1715 | for_each_rmrr_units(rmrr) { | 1770 | for_each_rmrr_units(rmrr) { |
1716 | int i; | ||
1717 | for (i = 0; i < rmrr->devices_cnt; i++) { | 1771 | for (i = 0; i < rmrr->devices_cnt; i++) { |
1718 | pdev = rmrr->devices[i]; | 1772 | pdev = rmrr->devices[i]; |
1719 | /* some BIOS lists non-exist devices in DMAR table */ | 1773 | /* some BIOS lists non-exist devices in DMAR table */ |
@@ -1769,6 +1823,7 @@ error: | |||
1769 | iommu = drhd->iommu; | 1823 | iommu = drhd->iommu; |
1770 | free_iommu(iommu); | 1824 | free_iommu(iommu); |
1771 | } | 1825 | } |
1826 | kfree(g_iommus); | ||
1772 | return ret; | 1827 | return ret; |
1773 | } | 1828 | } |
1774 | 1829 | ||
@@ -1917,6 +1972,59 @@ error: | |||
1917 | return 0; | 1972 | return 0; |
1918 | } | 1973 | } |
1919 | 1974 | ||
1975 | static void flush_unmaps(void) | ||
1976 | { | ||
1977 | int i, j; | ||
1978 | |||
1979 | timer_on = 0; | ||
1980 | |||
1981 | /* just flush them all */ | ||
1982 | for (i = 0; i < g_num_of_iommus; i++) { | ||
1983 | if (deferred_flush[i].next) { | ||
1984 | iommu_flush_iotlb_global(&g_iommus[i], 0); | ||
1985 | for (j = 0; j < deferred_flush[i].next; j++) { | ||
1986 | __free_iova(&deferred_flush[i].domain[j]->iovad, | ||
1987 | deferred_flush[i].iova[j]); | ||
1988 | } | ||
1989 | deferred_flush[i].next = 0; | ||
1990 | } | ||
1991 | } | ||
1992 | |||
1993 | list_size = 0; | ||
1994 | } | ||
1995 | |||
1996 | static void flush_unmaps_timeout(unsigned long data) | ||
1997 | { | ||
1998 | unsigned long flags; | ||
1999 | |||
2000 | spin_lock_irqsave(&async_umap_flush_lock, flags); | ||
2001 | flush_unmaps(); | ||
2002 | spin_unlock_irqrestore(&async_umap_flush_lock, flags); | ||
2003 | } | ||
2004 | |||
2005 | static void add_unmap(struct dmar_domain *dom, struct iova *iova) | ||
2006 | { | ||
2007 | unsigned long flags; | ||
2008 | int next, iommu_id; | ||
2009 | |||
2010 | spin_lock_irqsave(&async_umap_flush_lock, flags); | ||
2011 | if (list_size == HIGH_WATER_MARK) | ||
2012 | flush_unmaps(); | ||
2013 | |||
2014 | iommu_id = dom->iommu - g_iommus; | ||
2015 | next = deferred_flush[iommu_id].next; | ||
2016 | deferred_flush[iommu_id].domain[next] = dom; | ||
2017 | deferred_flush[iommu_id].iova[next] = iova; | ||
2018 | deferred_flush[iommu_id].next++; | ||
2019 | |||
2020 | if (!timer_on) { | ||
2021 | mod_timer(&unmap_timer, jiffies + msecs_to_jiffies(10)); | ||
2022 | timer_on = 1; | ||
2023 | } | ||
2024 | list_size++; | ||
2025 | spin_unlock_irqrestore(&async_umap_flush_lock, flags); | ||
2026 | } | ||
2027 | |||
1920 | static void intel_unmap_single(struct device *dev, dma_addr_t dev_addr, | 2028 | static void intel_unmap_single(struct device *dev, dma_addr_t dev_addr, |
1921 | size_t size, int dir) | 2029 | size_t size, int dir) |
1922 | { | 2030 | { |
@@ -1944,13 +2052,19 @@ static void intel_unmap_single(struct device *dev, dma_addr_t dev_addr, | |||
1944 | dma_pte_clear_range(domain, start_addr, start_addr + size); | 2052 | dma_pte_clear_range(domain, start_addr, start_addr + size); |
1945 | /* free page tables */ | 2053 | /* free page tables */ |
1946 | dma_pte_free_pagetable(domain, start_addr, start_addr + size); | 2054 | dma_pte_free_pagetable(domain, start_addr, start_addr + size); |
1947 | 2055 | if (intel_iommu_strict) { | |
1948 | if (iommu_flush_iotlb_psi(domain->iommu, domain->id, start_addr, | 2056 | if (iommu_flush_iotlb_psi(domain->iommu, |
1949 | size >> PAGE_SHIFT_4K, 0)) | 2057 | domain->id, start_addr, size >> PAGE_SHIFT_4K, 0)) |
1950 | iommu_flush_write_buffer(domain->iommu); | 2058 | iommu_flush_write_buffer(domain->iommu); |
1951 | 2059 | /* free iova */ | |
1952 | /* free iova */ | 2060 | __free_iova(&domain->iovad, iova); |
1953 | __free_iova(&domain->iovad, iova); | 2061 | } else { |
2062 | add_unmap(domain, iova); | ||
2063 | /* | ||
2064 | * queue up the release of the unmap to save the 1/6th of the | ||
2065 | * cpu used up by the iotlb flush operation... | ||
2066 | */ | ||
2067 | } | ||
1954 | } | 2068 | } |
1955 | 2069 | ||
1956 | static void * intel_alloc_coherent(struct device *hwdev, size_t size, | 2070 | static void * intel_alloc_coherent(struct device *hwdev, size_t size, |
@@ -2289,6 +2403,7 @@ int __init intel_iommu_init(void) | |||
2289 | printk(KERN_INFO | 2403 | printk(KERN_INFO |
2290 | "PCI-DMA: Intel(R) Virtualization Technology for Directed I/O\n"); | 2404 | "PCI-DMA: Intel(R) Virtualization Technology for Directed I/O\n"); |
2291 | 2405 | ||
2406 | init_timer(&unmap_timer); | ||
2292 | force_iommu = 1; | 2407 | force_iommu = 1; |
2293 | dma_ops = &intel_dma_ops; | 2408 | dma_ops = &intel_dma_ops; |
2294 | return 0; | 2409 | return 0; |
diff --git a/drivers/pci/iova.c b/drivers/pci/iova.c index dbcdd6bfa63a..3ef4ac064315 100644 --- a/drivers/pci/iova.c +++ b/drivers/pci/iova.c | |||
@@ -73,10 +73,11 @@ iova_get_pad_size(int size, unsigned int limit_pfn) | |||
73 | return pad_size; | 73 | return pad_size; |
74 | } | 74 | } |
75 | 75 | ||
76 | static int __alloc_iova_range(struct iova_domain *iovad, unsigned long size, | 76 | static int __alloc_and_insert_iova_range(struct iova_domain *iovad, |
77 | unsigned long limit_pfn, struct iova *new, bool size_aligned) | 77 | unsigned long size, unsigned long limit_pfn, |
78 | struct iova *new, bool size_aligned) | ||
78 | { | 79 | { |
79 | struct rb_node *curr = NULL; | 80 | struct rb_node *prev, *curr = NULL; |
80 | unsigned long flags; | 81 | unsigned long flags; |
81 | unsigned long saved_pfn; | 82 | unsigned long saved_pfn; |
82 | unsigned int pad_size = 0; | 83 | unsigned int pad_size = 0; |
@@ -85,8 +86,10 @@ static int __alloc_iova_range(struct iova_domain *iovad, unsigned long size, | |||
85 | spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); | 86 | spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); |
86 | saved_pfn = limit_pfn; | 87 | saved_pfn = limit_pfn; |
87 | curr = __get_cached_rbnode(iovad, &limit_pfn); | 88 | curr = __get_cached_rbnode(iovad, &limit_pfn); |
89 | prev = curr; | ||
88 | while (curr) { | 90 | while (curr) { |
89 | struct iova *curr_iova = container_of(curr, struct iova, node); | 91 | struct iova *curr_iova = container_of(curr, struct iova, node); |
92 | |||
90 | if (limit_pfn < curr_iova->pfn_lo) | 93 | if (limit_pfn < curr_iova->pfn_lo) |
91 | goto move_left; | 94 | goto move_left; |
92 | else if (limit_pfn < curr_iova->pfn_hi) | 95 | else if (limit_pfn < curr_iova->pfn_hi) |
@@ -100,6 +103,7 @@ static int __alloc_iova_range(struct iova_domain *iovad, unsigned long size, | |||
100 | adjust_limit_pfn: | 103 | adjust_limit_pfn: |
101 | limit_pfn = curr_iova->pfn_lo - 1; | 104 | limit_pfn = curr_iova->pfn_lo - 1; |
102 | move_left: | 105 | move_left: |
106 | prev = curr; | ||
103 | curr = rb_prev(curr); | 107 | curr = rb_prev(curr); |
104 | } | 108 | } |
105 | 109 | ||
@@ -116,7 +120,33 @@ move_left: | |||
116 | new->pfn_lo = limit_pfn - (size + pad_size) + 1; | 120 | new->pfn_lo = limit_pfn - (size + pad_size) + 1; |
117 | new->pfn_hi = new->pfn_lo + size - 1; | 121 | new->pfn_hi = new->pfn_lo + size - 1; |
118 | 122 | ||
123 | /* Insert the new_iova into domain rbtree by holding writer lock */ | ||
124 | /* Add new node and rebalance tree. */ | ||
125 | { | ||
126 | struct rb_node **entry = &((prev)), *parent = NULL; | ||
127 | /* Figure out where to put new node */ | ||
128 | while (*entry) { | ||
129 | struct iova *this = container_of(*entry, | ||
130 | struct iova, node); | ||
131 | parent = *entry; | ||
132 | |||
133 | if (new->pfn_lo < this->pfn_lo) | ||
134 | entry = &((*entry)->rb_left); | ||
135 | else if (new->pfn_lo > this->pfn_lo) | ||
136 | entry = &((*entry)->rb_right); | ||
137 | else | ||
138 | BUG(); /* this should not happen */ | ||
139 | } | ||
140 | |||
141 | /* Add new node and rebalance tree. */ | ||
142 | rb_link_node(&new->node, parent, entry); | ||
143 | rb_insert_color(&new->node, &iovad->rbroot); | ||
144 | } | ||
145 | __cached_rbnode_insert_update(iovad, saved_pfn, new); | ||
146 | |||
119 | spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); | 147 | spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); |
148 | |||
149 | |||
120 | return 0; | 150 | return 0; |
121 | } | 151 | } |
122 | 152 | ||
@@ -172,23 +202,15 @@ alloc_iova(struct iova_domain *iovad, unsigned long size, | |||
172 | size = __roundup_pow_of_two(size); | 202 | size = __roundup_pow_of_two(size); |
173 | 203 | ||
174 | spin_lock_irqsave(&iovad->iova_alloc_lock, flags); | 204 | spin_lock_irqsave(&iovad->iova_alloc_lock, flags); |
175 | ret = __alloc_iova_range(iovad, size, limit_pfn, new_iova, | 205 | ret = __alloc_and_insert_iova_range(iovad, size, limit_pfn, |
176 | size_aligned); | 206 | new_iova, size_aligned); |
177 | 207 | ||
208 | spin_unlock_irqrestore(&iovad->iova_alloc_lock, flags); | ||
178 | if (ret) { | 209 | if (ret) { |
179 | spin_unlock_irqrestore(&iovad->iova_alloc_lock, flags); | ||
180 | free_iova_mem(new_iova); | 210 | free_iova_mem(new_iova); |
181 | return NULL; | 211 | return NULL; |
182 | } | 212 | } |
183 | 213 | ||
184 | /* Insert the new_iova into domain rbtree by holding writer lock */ | ||
185 | spin_lock(&iovad->iova_rbtree_lock); | ||
186 | iova_insert_rbtree(&iovad->rbroot, new_iova); | ||
187 | __cached_rbnode_insert_update(iovad, limit_pfn, new_iova); | ||
188 | spin_unlock(&iovad->iova_rbtree_lock); | ||
189 | |||
190 | spin_unlock_irqrestore(&iovad->iova_alloc_lock, flags); | ||
191 | |||
192 | return new_iova; | 214 | return new_iova; |
193 | } | 215 | } |
194 | 216 | ||
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 8d9d648daeba..271d41cc05ab 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/topology.h> | 21 | #include <linux/topology.h> |
22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
23 | #include <linux/capability.h> | 23 | #include <linux/capability.h> |
24 | #include <linux/pci-aspm.h> | ||
24 | #include "pci.h" | 25 | #include "pci.h" |
25 | 26 | ||
26 | static int sysfs_initialized; /* = 0 */ | 27 | static int sysfs_initialized; /* = 0 */ |
@@ -358,6 +359,58 @@ pci_write_config(struct kobject *kobj, struct bin_attribute *bin_attr, | |||
358 | return count; | 359 | return count; |
359 | } | 360 | } |
360 | 361 | ||
362 | static ssize_t | ||
363 | pci_read_vpd(struct kobject *kobj, struct bin_attribute *bin_attr, | ||
364 | char *buf, loff_t off, size_t count) | ||
365 | { | ||
366 | struct pci_dev *dev = | ||
367 | to_pci_dev(container_of(kobj, struct device, kobj)); | ||
368 | int end; | ||
369 | int ret; | ||
370 | |||
371 | if (off > bin_attr->size) | ||
372 | count = 0; | ||
373 | else if (count > bin_attr->size - off) | ||
374 | count = bin_attr->size - off; | ||
375 | end = off + count; | ||
376 | |||
377 | while (off < end) { | ||
378 | ret = dev->vpd->ops->read(dev, off, end - off, buf); | ||
379 | if (ret < 0) | ||
380 | return ret; | ||
381 | buf += ret; | ||
382 | off += ret; | ||
383 | } | ||
384 | |||
385 | return count; | ||
386 | } | ||
387 | |||
388 | static ssize_t | ||
389 | pci_write_vpd(struct kobject *kobj, struct bin_attribute *bin_attr, | ||
390 | char *buf, loff_t off, size_t count) | ||
391 | { | ||
392 | struct pci_dev *dev = | ||
393 | to_pci_dev(container_of(kobj, struct device, kobj)); | ||
394 | int end; | ||
395 | int ret; | ||
396 | |||
397 | if (off > bin_attr->size) | ||
398 | count = 0; | ||
399 | else if (count > bin_attr->size - off) | ||
400 | count = bin_attr->size - off; | ||
401 | end = off + count; | ||
402 | |||
403 | while (off < end) { | ||
404 | ret = dev->vpd->ops->write(dev, off, end - off, buf); | ||
405 | if (ret < 0) | ||
406 | return ret; | ||
407 | buf += ret; | ||
408 | off += ret; | ||
409 | } | ||
410 | |||
411 | return count; | ||
412 | } | ||
413 | |||
361 | #ifdef HAVE_PCI_LEGACY | 414 | #ifdef HAVE_PCI_LEGACY |
362 | /** | 415 | /** |
363 | * pci_read_legacy_io - read byte(s) from legacy I/O port space | 416 | * pci_read_legacy_io - read byte(s) from legacy I/O port space |
@@ -626,7 +679,7 @@ int __attribute__ ((weak)) pcibios_add_platform_entries(struct pci_dev *dev) | |||
626 | 679 | ||
627 | int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | 680 | int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) |
628 | { | 681 | { |
629 | struct bin_attribute *rom_attr = NULL; | 682 | struct bin_attribute *attr = NULL; |
630 | int retval; | 683 | int retval; |
631 | 684 | ||
632 | if (!sysfs_initialized) | 685 | if (!sysfs_initialized) |
@@ -639,22 +692,41 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | |||
639 | if (retval) | 692 | if (retval) |
640 | goto err; | 693 | goto err; |
641 | 694 | ||
695 | /* If the device has VPD, try to expose it in sysfs. */ | ||
696 | if (pdev->vpd) { | ||
697 | attr = kzalloc(sizeof(*attr), GFP_ATOMIC); | ||
698 | if (attr) { | ||
699 | pdev->vpd->attr = attr; | ||
700 | attr->size = pdev->vpd->ops->get_size(pdev); | ||
701 | attr->attr.name = "vpd"; | ||
702 | attr->attr.mode = S_IRUGO | S_IWUSR; | ||
703 | attr->read = pci_read_vpd; | ||
704 | attr->write = pci_write_vpd; | ||
705 | retval = sysfs_create_bin_file(&pdev->dev.kobj, attr); | ||
706 | if (retval) | ||
707 | goto err_vpd; | ||
708 | } else { | ||
709 | retval = -ENOMEM; | ||
710 | goto err_config_file; | ||
711 | } | ||
712 | } | ||
713 | |||
642 | retval = pci_create_resource_files(pdev); | 714 | retval = pci_create_resource_files(pdev); |
643 | if (retval) | 715 | if (retval) |
644 | goto err_bin_file; | 716 | goto err_vpd_file; |
645 | 717 | ||
646 | /* If the device has a ROM, try to expose it in sysfs. */ | 718 | /* If the device has a ROM, try to expose it in sysfs. */ |
647 | if (pci_resource_len(pdev, PCI_ROM_RESOURCE) || | 719 | if (pci_resource_len(pdev, PCI_ROM_RESOURCE) || |
648 | (pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW)) { | 720 | (pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW)) { |
649 | rom_attr = kzalloc(sizeof(*rom_attr), GFP_ATOMIC); | 721 | attr = kzalloc(sizeof(*attr), GFP_ATOMIC); |
650 | if (rom_attr) { | 722 | if (attr) { |
651 | pdev->rom_attr = rom_attr; | 723 | pdev->rom_attr = attr; |
652 | rom_attr->size = pci_resource_len(pdev, PCI_ROM_RESOURCE); | 724 | attr->size = pci_resource_len(pdev, PCI_ROM_RESOURCE); |
653 | rom_attr->attr.name = "rom"; | 725 | attr->attr.name = "rom"; |
654 | rom_attr->attr.mode = S_IRUSR; | 726 | attr->attr.mode = S_IRUSR; |
655 | rom_attr->read = pci_read_rom; | 727 | attr->read = pci_read_rom; |
656 | rom_attr->write = pci_write_rom; | 728 | attr->write = pci_write_rom; |
657 | retval = sysfs_create_bin_file(&pdev->dev.kobj, rom_attr); | 729 | retval = sysfs_create_bin_file(&pdev->dev.kobj, attr); |
658 | if (retval) | 730 | if (retval) |
659 | goto err_rom; | 731 | goto err_rom; |
660 | } else { | 732 | } else { |
@@ -666,16 +738,24 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | |||
666 | if (pcibios_add_platform_entries(pdev)) | 738 | if (pcibios_add_platform_entries(pdev)) |
667 | goto err_rom_file; | 739 | goto err_rom_file; |
668 | 740 | ||
741 | pcie_aspm_create_sysfs_dev_files(pdev); | ||
742 | |||
669 | return 0; | 743 | return 0; |
670 | 744 | ||
671 | err_rom_file: | 745 | err_rom_file: |
672 | if (pci_resource_len(pdev, PCI_ROM_RESOURCE)) | 746 | if (pci_resource_len(pdev, PCI_ROM_RESOURCE)) |
673 | sysfs_remove_bin_file(&pdev->dev.kobj, rom_attr); | 747 | sysfs_remove_bin_file(&pdev->dev.kobj, pdev->rom_attr); |
674 | err_rom: | 748 | err_rom: |
675 | kfree(rom_attr); | 749 | kfree(pdev->rom_attr); |
676 | err_resource_files: | 750 | err_resource_files: |
677 | pci_remove_resource_files(pdev); | 751 | pci_remove_resource_files(pdev); |
678 | err_bin_file: | 752 | err_vpd_file: |
753 | if (pdev->vpd) { | ||
754 | sysfs_remove_bin_file(&pdev->dev.kobj, pdev->vpd->attr); | ||
755 | err_vpd: | ||
756 | kfree(pdev->vpd->attr); | ||
757 | } | ||
758 | err_config_file: | ||
679 | if (pdev->cfg_size < 4096) | 759 | if (pdev->cfg_size < 4096) |
680 | sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); | 760 | sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); |
681 | else | 761 | else |
@@ -695,6 +775,12 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev) | |||
695 | if (!sysfs_initialized) | 775 | if (!sysfs_initialized) |
696 | return; | 776 | return; |
697 | 777 | ||
778 | pcie_aspm_remove_sysfs_dev_files(pdev); | ||
779 | |||
780 | if (pdev->vpd) { | ||
781 | sysfs_remove_bin_file(&pdev->dev.kobj, pdev->vpd->attr); | ||
782 | kfree(pdev->vpd->attr); | ||
783 | } | ||
698 | if (pdev->cfg_size < 4096) | 784 | if (pdev->cfg_size < 4096) |
699 | sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); | 785 | sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); |
700 | else | 786 | else |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index a4445b7210bf..e4548ab2a93c 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
19 | #include <linux/string.h> | 19 | #include <linux/string.h> |
20 | #include <linux/log2.h> | 20 | #include <linux/log2.h> |
21 | #include <linux/pci-aspm.h> | ||
21 | #include <asm/dma.h> /* isa_dma_bridge_buggy */ | 22 | #include <asm/dma.h> /* isa_dma_bridge_buggy */ |
22 | #include "pci.h" | 23 | #include "pci.h" |
23 | 24 | ||
@@ -424,7 +425,7 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
424 | */ | 425 | */ |
425 | if (state != PCI_D0 && dev->current_state > state) { | 426 | if (state != PCI_D0 && dev->current_state > state) { |
426 | printk(KERN_ERR "%s(): %s: state=%d, current state=%d\n", | 427 | printk(KERN_ERR "%s(): %s: state=%d, current state=%d\n", |
427 | __FUNCTION__, pci_name(dev), state, dev->current_state); | 428 | __func__, pci_name(dev), state, dev->current_state); |
428 | return -EINVAL; | 429 | return -EINVAL; |
429 | } else if (dev->current_state == state) | 430 | } else if (dev->current_state == state) |
430 | return 0; /* we're already there */ | 431 | return 0; /* we're already there */ |
@@ -501,6 +502,9 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
501 | if (need_restore) | 502 | if (need_restore) |
502 | pci_restore_bars(dev); | 503 | pci_restore_bars(dev); |
503 | 504 | ||
505 | if (dev->bus->self) | ||
506 | pcie_aspm_pm_state_change(dev->bus->self); | ||
507 | |||
504 | return 0; | 508 | return 0; |
505 | } | 509 | } |
506 | 510 | ||
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index eabeb1f2ec99..0a497c1b4227 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -18,6 +18,25 @@ extern int pci_user_write_config_byte(struct pci_dev *dev, int where, u8 val); | |||
18 | extern int pci_user_write_config_word(struct pci_dev *dev, int where, u16 val); | 18 | extern int pci_user_write_config_word(struct pci_dev *dev, int where, u16 val); |
19 | extern int pci_user_write_config_dword(struct pci_dev *dev, int where, u32 val); | 19 | extern int pci_user_write_config_dword(struct pci_dev *dev, int where, u32 val); |
20 | 20 | ||
21 | struct pci_vpd_ops { | ||
22 | int (*read)(struct pci_dev *dev, int pos, int size, char *buf); | ||
23 | int (*write)(struct pci_dev *dev, int pos, int size, const char *buf); | ||
24 | int (*get_size)(struct pci_dev *dev); | ||
25 | void (*release)(struct pci_dev *dev); | ||
26 | }; | ||
27 | |||
28 | struct pci_vpd { | ||
29 | struct pci_vpd_ops *ops; | ||
30 | struct bin_attribute *attr; /* descriptor for sysfs VPD entry */ | ||
31 | }; | ||
32 | |||
33 | extern int pci_vpd_pci22_init(struct pci_dev *dev); | ||
34 | static inline void pci_vpd_release(struct pci_dev *dev) | ||
35 | { | ||
36 | if (dev->vpd) | ||
37 | dev->vpd->ops->release(dev); | ||
38 | } | ||
39 | |||
21 | /* PCI /proc functions */ | 40 | /* PCI /proc functions */ |
22 | #ifdef CONFIG_PROC_FS | 41 | #ifdef CONFIG_PROC_FS |
23 | extern int pci_proc_attach_device(struct pci_dev *dev); | 42 | extern int pci_proc_attach_device(struct pci_dev *dev); |
diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig index 287a9311716c..25b04fb2517d 100644 --- a/drivers/pci/pcie/Kconfig +++ b/drivers/pci/pcie/Kconfig | |||
@@ -26,3 +26,23 @@ config HOTPLUG_PCI_PCIE | |||
26 | When in doubt, say N. | 26 | When in doubt, say N. |
27 | 27 | ||
28 | source "drivers/pci/pcie/aer/Kconfig" | 28 | source "drivers/pci/pcie/aer/Kconfig" |
29 | |||
30 | # | ||
31 | # PCI Express ASPM | ||
32 | # | ||
33 | config PCIEASPM | ||
34 | bool "PCI Express ASPM support(Experimental)" | ||
35 | depends on PCI && EXPERIMENTAL && PCIEPORTBUS | ||
36 | default y | ||
37 | help | ||
38 | This enables PCI Express ASPM (Active State Power Management) and | ||
39 | Clock Power Management. ASPM supports state L0/L0s/L1. | ||
40 | |||
41 | When in doubt, say N. | ||
42 | config PCIEASPM_DEBUG | ||
43 | bool "Debug PCI Express ASPM" | ||
44 | depends on PCIEASPM | ||
45 | default n | ||
46 | help | ||
47 | This enables PCI Express ASPM debug support. It will add per-device | ||
48 | interface to control ASPM. | ||
diff --git a/drivers/pci/pcie/Makefile b/drivers/pci/pcie/Makefile index e00fb99acf44..11f6bb1eae24 100644 --- a/drivers/pci/pcie/Makefile +++ b/drivers/pci/pcie/Makefile | |||
@@ -2,6 +2,9 @@ | |||
2 | # Makefile for PCI-Express PORT Driver | 2 | # Makefile for PCI-Express PORT Driver |
3 | # | 3 | # |
4 | 4 | ||
5 | # Build PCI Express ASPM if needed | ||
6 | obj-$(CONFIG_PCIEASPM) += aspm.o | ||
7 | |||
5 | pcieportdrv-y := portdrv_core.o portdrv_pci.o portdrv_bus.o | 8 | pcieportdrv-y := portdrv_core.o portdrv_pci.o portdrv_bus.o |
6 | 9 | ||
7 | obj-$(CONFIG_PCIEPORTBUS) += pcieportdrv.o | 10 | obj-$(CONFIG_PCIEPORTBUS) += pcieportdrv.o |
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c index 7a62f7dd9009..07c3bdb6edc2 100644 --- a/drivers/pci/pcie/aer/aerdrv.c +++ b/drivers/pci/pcie/aer/aerdrv.c | |||
@@ -220,7 +220,7 @@ static int __devinit aer_probe (struct pcie_device *dev, | |||
220 | /* Alloc rpc data structure */ | 220 | /* Alloc rpc data structure */ |
221 | if (!(rpc = aer_alloc_rpc(dev))) { | 221 | if (!(rpc = aer_alloc_rpc(dev))) { |
222 | printk(KERN_DEBUG "%s: Alloc rpc fails on PCIE device[%s]\n", | 222 | printk(KERN_DEBUG "%s: Alloc rpc fails on PCIE device[%s]\n", |
223 | __FUNCTION__, device->bus_id); | 223 | __func__, device->bus_id); |
224 | aer_remove(dev); | 224 | aer_remove(dev); |
225 | return -ENOMEM; | 225 | return -ENOMEM; |
226 | } | 226 | } |
@@ -229,7 +229,7 @@ static int __devinit aer_probe (struct pcie_device *dev, | |||
229 | if ((status = request_irq(dev->irq, aer_irq, IRQF_SHARED, "aerdrv", | 229 | if ((status = request_irq(dev->irq, aer_irq, IRQF_SHARED, "aerdrv", |
230 | dev))) { | 230 | dev))) { |
231 | printk(KERN_DEBUG "%s: Request ISR fails on PCIE device[%s]\n", | 231 | printk(KERN_DEBUG "%s: Request ISR fails on PCIE device[%s]\n", |
232 | __FUNCTION__, device->bus_id); | 232 | __func__, device->bus_id); |
233 | aer_remove(dev); | 233 | aer_remove(dev); |
234 | return status; | 234 | return status; |
235 | } | 235 | } |
diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c index 8c199ae84f6d..96ac54072f6f 100644 --- a/drivers/pci/pcie/aer/aerdrv_acpi.c +++ b/drivers/pci/pcie/aer/aerdrv_acpi.c | |||
@@ -33,8 +33,11 @@ int aer_osc_setup(struct pcie_device *pciedev) | |||
33 | struct pci_dev *pdev = pciedev->port; | 33 | struct pci_dev *pdev = pciedev->port; |
34 | acpi_handle handle = 0; | 34 | acpi_handle handle = 0; |
35 | 35 | ||
36 | if (acpi_pci_disabled) | ||
37 | return -1; | ||
38 | |||
36 | /* Find root host bridge */ | 39 | /* Find root host bridge */ |
37 | while (pdev->bus && pdev->bus->self) | 40 | while (pdev->bus->self) |
38 | pdev = pdev->bus->self; | 41 | pdev = pdev->bus->self; |
39 | handle = acpi_get_pci_rootbridge_handle( | 42 | handle = acpi_get_pci_rootbridge_handle( |
40 | pci_domain_nr(pdev->bus), pdev->bus->number); | 43 | pci_domain_nr(pdev->bus), pdev->bus->number); |
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 3c0d8d138f5a..aaa82392d1dc 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c | |||
@@ -117,6 +117,7 @@ int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) | |||
117 | return 0; | 117 | return 0; |
118 | } | 118 | } |
119 | 119 | ||
120 | #if 0 | ||
120 | int pci_cleanup_aer_correct_error_status(struct pci_dev *dev) | 121 | int pci_cleanup_aer_correct_error_status(struct pci_dev *dev) |
121 | { | 122 | { |
122 | int pos; | 123 | int pos; |
@@ -131,6 +132,7 @@ int pci_cleanup_aer_correct_error_status(struct pci_dev *dev) | |||
131 | 132 | ||
132 | return 0; | 133 | return 0; |
133 | } | 134 | } |
135 | #endif /* 0 */ | ||
134 | 136 | ||
135 | static int find_device_iter(struct device *device, void *data) | 137 | static int find_device_iter(struct device *device, void *data) |
136 | { | 138 | { |
@@ -689,7 +691,7 @@ static void aer_isr_one_error(struct pcie_device *p_device, | |||
689 | e_info.flags |= AER_MULTI_ERROR_VALID_FLAG; | 691 | e_info.flags |= AER_MULTI_ERROR_VALID_FLAG; |
690 | if (!(s_device = find_source_device(p_device->port, id))) { | 692 | if (!(s_device = find_source_device(p_device->port, id))) { |
691 | printk(KERN_DEBUG "%s->can't find device of ID%04x\n", | 693 | printk(KERN_DEBUG "%s->can't find device of ID%04x\n", |
692 | __FUNCTION__, id); | 694 | __func__, id); |
693 | continue; | 695 | continue; |
694 | } | 696 | } |
695 | if (get_device_error_info(to_pci_dev(s_device), &e_info) == | 697 | if (get_device_error_info(to_pci_dev(s_device), &e_info) == |
@@ -757,5 +759,4 @@ EXPORT_SYMBOL_GPL(pci_find_aer_capability); | |||
757 | EXPORT_SYMBOL_GPL(pci_enable_pcie_error_reporting); | 759 | EXPORT_SYMBOL_GPL(pci_enable_pcie_error_reporting); |
758 | EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting); | 760 | EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting); |
759 | EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status); | 761 | EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status); |
760 | EXPORT_SYMBOL_GPL(pci_cleanup_aer_correct_error_status); | ||
761 | 762 | ||
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c new file mode 100644 index 000000000000..61fedb2448b6 --- /dev/null +++ b/drivers/pci/pcie/aspm.c | |||
@@ -0,0 +1,811 @@ | |||
1 | /* | ||
2 | * File: drivers/pci/pcie/aspm.c | ||
3 | * Enabling PCIE link L0s/L1 state and Clock Power Management | ||
4 | * | ||
5 | * Copyright (C) 2007 Intel | ||
6 | * Copyright (C) Zhang Yanmin (yanmin.zhang@intel.com) | ||
7 | * Copyright (C) Shaohua Li (shaohua.li@intel.com) | ||
8 | */ | ||
9 | |||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/moduleparam.h> | ||
13 | #include <linux/pci.h> | ||
14 | #include <linux/pci_regs.h> | ||
15 | #include <linux/errno.h> | ||
16 | #include <linux/pm.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/slab.h> | ||
19 | #include <linux/pci-aspm.h> | ||
20 | #include "../pci.h" | ||
21 | |||
22 | #ifdef MODULE_PARAM_PREFIX | ||
23 | #undef MODULE_PARAM_PREFIX | ||
24 | #endif | ||
25 | #define MODULE_PARAM_PREFIX "pcie_aspm." | ||
26 | |||
27 | struct endpoint_state { | ||
28 | unsigned int l0s_acceptable_latency; | ||
29 | unsigned int l1_acceptable_latency; | ||
30 | }; | ||
31 | |||
32 | struct pcie_link_state { | ||
33 | struct list_head sibiling; | ||
34 | struct pci_dev *pdev; | ||
35 | |||
36 | /* ASPM state */ | ||
37 | unsigned int support_state; | ||
38 | unsigned int enabled_state; | ||
39 | unsigned int bios_aspm_state; | ||
40 | /* upstream component */ | ||
41 | unsigned int l0s_upper_latency; | ||
42 | unsigned int l1_upper_latency; | ||
43 | /* downstream component */ | ||
44 | unsigned int l0s_down_latency; | ||
45 | unsigned int l1_down_latency; | ||
46 | /* Clock PM state*/ | ||
47 | unsigned int clk_pm_capable; | ||
48 | unsigned int clk_pm_enabled; | ||
49 | unsigned int bios_clk_state; | ||
50 | |||
51 | /* | ||
52 | * A pcie downstream port only has one slot under it, so at most there | ||
53 | * are 8 functions | ||
54 | */ | ||
55 | struct endpoint_state endpoints[8]; | ||
56 | }; | ||
57 | |||
58 | static int aspm_disabled; | ||
59 | static DEFINE_MUTEX(aspm_lock); | ||
60 | static LIST_HEAD(link_list); | ||
61 | |||
62 | #define POLICY_DEFAULT 0 /* BIOS default setting */ | ||
63 | #define POLICY_PERFORMANCE 1 /* high performance */ | ||
64 | #define POLICY_POWERSAVE 2 /* high power saving */ | ||
65 | static int aspm_policy; | ||
66 | static const char *policy_str[] = { | ||
67 | [POLICY_DEFAULT] = "default", | ||
68 | [POLICY_PERFORMANCE] = "performance", | ||
69 | [POLICY_POWERSAVE] = "powersave" | ||
70 | }; | ||
71 | |||
72 | static int policy_to_aspm_state(struct pci_dev *pdev) | ||
73 | { | ||
74 | struct pcie_link_state *link_state = pdev->link_state; | ||
75 | |||
76 | switch (aspm_policy) { | ||
77 | case POLICY_PERFORMANCE: | ||
78 | /* Disable ASPM and Clock PM */ | ||
79 | return 0; | ||
80 | case POLICY_POWERSAVE: | ||
81 | /* Enable ASPM L0s/L1 */ | ||
82 | return PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1; | ||
83 | case POLICY_DEFAULT: | ||
84 | return link_state->bios_aspm_state; | ||
85 | } | ||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | static int policy_to_clkpm_state(struct pci_dev *pdev) | ||
90 | { | ||
91 | struct pcie_link_state *link_state = pdev->link_state; | ||
92 | |||
93 | switch (aspm_policy) { | ||
94 | case POLICY_PERFORMANCE: | ||
95 | /* Disable ASPM and Clock PM */ | ||
96 | return 0; | ||
97 | case POLICY_POWERSAVE: | ||
98 | /* Disable Clock PM */ | ||
99 | return 1; | ||
100 | case POLICY_DEFAULT: | ||
101 | return link_state->bios_clk_state; | ||
102 | } | ||
103 | return 0; | ||
104 | } | ||
105 | |||
106 | static void pcie_set_clock_pm(struct pci_dev *pdev, int enable) | ||
107 | { | ||
108 | struct pci_dev *child_dev; | ||
109 | int pos; | ||
110 | u16 reg16; | ||
111 | struct pcie_link_state *link_state = pdev->link_state; | ||
112 | |||
113 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { | ||
114 | pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); | ||
115 | if (!pos) | ||
116 | return; | ||
117 | pci_read_config_word(child_dev, pos + PCI_EXP_LNKCTL, ®16); | ||
118 | if (enable) | ||
119 | reg16 |= PCI_EXP_LNKCTL_CLKREQ_EN; | ||
120 | else | ||
121 | reg16 &= ~PCI_EXP_LNKCTL_CLKREQ_EN; | ||
122 | pci_write_config_word(child_dev, pos + PCI_EXP_LNKCTL, reg16); | ||
123 | } | ||
124 | link_state->clk_pm_enabled = !!enable; | ||
125 | } | ||
126 | |||
127 | static void pcie_check_clock_pm(struct pci_dev *pdev) | ||
128 | { | ||
129 | int pos; | ||
130 | u32 reg32; | ||
131 | u16 reg16; | ||
132 | int capable = 1, enabled = 1; | ||
133 | struct pci_dev *child_dev; | ||
134 | struct pcie_link_state *link_state = pdev->link_state; | ||
135 | |||
136 | /* All functions should have the same cap and state, take the worst */ | ||
137 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { | ||
138 | pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); | ||
139 | if (!pos) | ||
140 | return; | ||
141 | pci_read_config_dword(child_dev, pos + PCI_EXP_LNKCAP, ®32); | ||
142 | if (!(reg32 & PCI_EXP_LNKCAP_CLKPM)) { | ||
143 | capable = 0; | ||
144 | enabled = 0; | ||
145 | break; | ||
146 | } | ||
147 | pci_read_config_word(child_dev, pos + PCI_EXP_LNKCTL, ®16); | ||
148 | if (!(reg16 & PCI_EXP_LNKCTL_CLKREQ_EN)) | ||
149 | enabled = 0; | ||
150 | } | ||
151 | link_state->clk_pm_capable = capable; | ||
152 | link_state->clk_pm_enabled = enabled; | ||
153 | link_state->bios_clk_state = enabled; | ||
154 | pcie_set_clock_pm(pdev, policy_to_clkpm_state(pdev)); | ||
155 | } | ||
156 | |||
157 | /* | ||
158 | * pcie_aspm_configure_common_clock: check if the 2 ends of a link | ||
159 | * could use common clock. If they are, configure them to use the | ||
160 | * common clock. That will reduce the ASPM state exit latency. | ||
161 | */ | ||
162 | static void pcie_aspm_configure_common_clock(struct pci_dev *pdev) | ||
163 | { | ||
164 | int pos, child_pos; | ||
165 | u16 reg16 = 0; | ||
166 | struct pci_dev *child_dev; | ||
167 | int same_clock = 1; | ||
168 | |||
169 | /* | ||
170 | * all functions of a slot should have the same Slot Clock | ||
171 | * Configuration, so just check one function | ||
172 | * */ | ||
173 | child_dev = list_entry(pdev->subordinate->devices.next, struct pci_dev, | ||
174 | bus_list); | ||
175 | BUG_ON(!child_dev->is_pcie); | ||
176 | |||
177 | /* Check downstream component if bit Slot Clock Configuration is 1 */ | ||
178 | child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); | ||
179 | pci_read_config_word(child_dev, child_pos + PCI_EXP_LNKSTA, ®16); | ||
180 | if (!(reg16 & PCI_EXP_LNKSTA_SLC)) | ||
181 | same_clock = 0; | ||
182 | |||
183 | /* Check upstream component if bit Slot Clock Configuration is 1 */ | ||
184 | pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); | ||
185 | pci_read_config_word(pdev, pos + PCI_EXP_LNKSTA, ®16); | ||
186 | if (!(reg16 & PCI_EXP_LNKSTA_SLC)) | ||
187 | same_clock = 0; | ||
188 | |||
189 | /* Configure downstream component, all functions */ | ||
190 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { | ||
191 | child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); | ||
192 | pci_read_config_word(child_dev, child_pos + PCI_EXP_LNKCTL, | ||
193 | ®16); | ||
194 | if (same_clock) | ||
195 | reg16 |= PCI_EXP_LNKCTL_CCC; | ||
196 | else | ||
197 | reg16 &= ~PCI_EXP_LNKCTL_CCC; | ||
198 | pci_write_config_word(child_dev, child_pos + PCI_EXP_LNKCTL, | ||
199 | reg16); | ||
200 | } | ||
201 | |||
202 | /* Configure upstream component */ | ||
203 | pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16); | ||
204 | if (same_clock) | ||
205 | reg16 |= PCI_EXP_LNKCTL_CCC; | ||
206 | else | ||
207 | reg16 &= ~PCI_EXP_LNKCTL_CCC; | ||
208 | pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16); | ||
209 | |||
210 | /* retrain link */ | ||
211 | reg16 |= PCI_EXP_LNKCTL_RL; | ||
212 | pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16); | ||
213 | |||
214 | /* Wait for link training end */ | ||
215 | while (1) { | ||
216 | pci_read_config_word(pdev, pos + PCI_EXP_LNKSTA, ®16); | ||
217 | if (!(reg16 & PCI_EXP_LNKSTA_LT)) | ||
218 | break; | ||
219 | cpu_relax(); | ||
220 | } | ||
221 | } | ||
222 | |||
223 | /* | ||
224 | * calc_L0S_latency: Convert L0s latency encoding to ns | ||
225 | */ | ||
226 | static unsigned int calc_L0S_latency(unsigned int latency_encoding, int ac) | ||
227 | { | ||
228 | unsigned int ns = 64; | ||
229 | |||
230 | if (latency_encoding == 0x7) { | ||
231 | if (ac) | ||
232 | ns = -1U; | ||
233 | else | ||
234 | ns = 5*1000; /* > 4us */ | ||
235 | } else | ||
236 | ns *= (1 << latency_encoding); | ||
237 | return ns; | ||
238 | } | ||
239 | |||
240 | /* | ||
241 | * calc_L1_latency: Convert L1 latency encoding to ns | ||
242 | */ | ||
243 | static unsigned int calc_L1_latency(unsigned int latency_encoding, int ac) | ||
244 | { | ||
245 | unsigned int ns = 1000; | ||
246 | |||
247 | if (latency_encoding == 0x7) { | ||
248 | if (ac) | ||
249 | ns = -1U; | ||
250 | else | ||
251 | ns = 65*1000; /* > 64us */ | ||
252 | } else | ||
253 | ns *= (1 << latency_encoding); | ||
254 | return ns; | ||
255 | } | ||
256 | |||
257 | static void pcie_aspm_get_cap_device(struct pci_dev *pdev, u32 *state, | ||
258 | unsigned int *l0s, unsigned int *l1, unsigned int *enabled) | ||
259 | { | ||
260 | int pos; | ||
261 | u16 reg16; | ||
262 | u32 reg32; | ||
263 | unsigned int latency; | ||
264 | |||
265 | pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); | ||
266 | pci_read_config_dword(pdev, pos + PCI_EXP_LNKCAP, ®32); | ||
267 | *state = (reg32 & PCI_EXP_LNKCAP_ASPMS) >> 10; | ||
268 | if (*state != PCIE_LINK_STATE_L0S && | ||
269 | *state != (PCIE_LINK_STATE_L1|PCIE_LINK_STATE_L0S)) | ||
270 | *state = 0; | ||
271 | if (*state == 0) | ||
272 | return; | ||
273 | |||
274 | latency = (reg32 & PCI_EXP_LNKCAP_L0SEL) >> 12; | ||
275 | *l0s = calc_L0S_latency(latency, 0); | ||
276 | if (*state & PCIE_LINK_STATE_L1) { | ||
277 | latency = (reg32 & PCI_EXP_LNKCAP_L1EL) >> 15; | ||
278 | *l1 = calc_L1_latency(latency, 0); | ||
279 | } | ||
280 | pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16); | ||
281 | *enabled = reg16 & (PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1); | ||
282 | } | ||
283 | |||
284 | static void pcie_aspm_cap_init(struct pci_dev *pdev) | ||
285 | { | ||
286 | struct pci_dev *child_dev; | ||
287 | u32 state, tmp; | ||
288 | struct pcie_link_state *link_state = pdev->link_state; | ||
289 | |||
290 | /* upstream component states */ | ||
291 | pcie_aspm_get_cap_device(pdev, &link_state->support_state, | ||
292 | &link_state->l0s_upper_latency, | ||
293 | &link_state->l1_upper_latency, | ||
294 | &link_state->enabled_state); | ||
295 | /* downstream component states, all functions have the same setting */ | ||
296 | child_dev = list_entry(pdev->subordinate->devices.next, struct pci_dev, | ||
297 | bus_list); | ||
298 | pcie_aspm_get_cap_device(child_dev, &state, | ||
299 | &link_state->l0s_down_latency, | ||
300 | &link_state->l1_down_latency, | ||
301 | &tmp); | ||
302 | link_state->support_state &= state; | ||
303 | if (!link_state->support_state) | ||
304 | return; | ||
305 | link_state->enabled_state &= link_state->support_state; | ||
306 | link_state->bios_aspm_state = link_state->enabled_state; | ||
307 | |||
308 | /* ENDPOINT states*/ | ||
309 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { | ||
310 | int pos; | ||
311 | u32 reg32; | ||
312 | unsigned int latency; | ||
313 | struct endpoint_state *ep_state = | ||
314 | &link_state->endpoints[PCI_FUNC(child_dev->devfn)]; | ||
315 | |||
316 | if (child_dev->pcie_type != PCI_EXP_TYPE_ENDPOINT && | ||
317 | child_dev->pcie_type != PCI_EXP_TYPE_LEG_END) | ||
318 | continue; | ||
319 | |||
320 | pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); | ||
321 | pci_read_config_dword(child_dev, pos + PCI_EXP_DEVCAP, ®32); | ||
322 | latency = (reg32 & PCI_EXP_DEVCAP_L0S) >> 6; | ||
323 | latency = calc_L0S_latency(latency, 1); | ||
324 | ep_state->l0s_acceptable_latency = latency; | ||
325 | if (link_state->support_state & PCIE_LINK_STATE_L1) { | ||
326 | latency = (reg32 & PCI_EXP_DEVCAP_L1) >> 9; | ||
327 | latency = calc_L1_latency(latency, 1); | ||
328 | ep_state->l1_acceptable_latency = latency; | ||
329 | } | ||
330 | } | ||
331 | } | ||
332 | |||
333 | static unsigned int __pcie_aspm_check_state_one(struct pci_dev *pdev, | ||
334 | unsigned int state) | ||
335 | { | ||
336 | struct pci_dev *parent_dev, *tmp_dev; | ||
337 | unsigned int latency, l1_latency = 0; | ||
338 | struct pcie_link_state *link_state; | ||
339 | struct endpoint_state *ep_state; | ||
340 | |||
341 | parent_dev = pdev->bus->self; | ||
342 | link_state = parent_dev->link_state; | ||
343 | state &= link_state->support_state; | ||
344 | if (state == 0) | ||
345 | return 0; | ||
346 | ep_state = &link_state->endpoints[PCI_FUNC(pdev->devfn)]; | ||
347 | |||
348 | /* | ||
349 | * Check latency for endpoint device. | ||
350 | * TBD: The latency from the endpoint to root complex vary per | ||
351 | * switch's upstream link state above the device. Here we just do a | ||
352 | * simple check which assumes all links above the device can be in L1 | ||
353 | * state, that is we just consider the worst case. If switch's upstream | ||
354 | * link can't be put into L0S/L1, then our check is too strictly. | ||
355 | */ | ||
356 | tmp_dev = pdev; | ||
357 | while (state & (PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1)) { | ||
358 | parent_dev = tmp_dev->bus->self; | ||
359 | link_state = parent_dev->link_state; | ||
360 | if (state & PCIE_LINK_STATE_L0S) { | ||
361 | latency = max_t(unsigned int, | ||
362 | link_state->l0s_upper_latency, | ||
363 | link_state->l0s_down_latency); | ||
364 | if (latency > ep_state->l0s_acceptable_latency) | ||
365 | state &= ~PCIE_LINK_STATE_L0S; | ||
366 | } | ||
367 | if (state & PCIE_LINK_STATE_L1) { | ||
368 | latency = max_t(unsigned int, | ||
369 | link_state->l1_upper_latency, | ||
370 | link_state->l1_down_latency); | ||
371 | if (latency + l1_latency > | ||
372 | ep_state->l1_acceptable_latency) | ||
373 | state &= ~PCIE_LINK_STATE_L1; | ||
374 | } | ||
375 | if (!parent_dev->bus->self) /* parent_dev is a root port */ | ||
376 | break; | ||
377 | else { | ||
378 | /* | ||
379 | * parent_dev is the downstream port of a switch, make | ||
380 | * tmp_dev the upstream port of the switch | ||
381 | */ | ||
382 | tmp_dev = parent_dev->bus->self; | ||
383 | /* | ||
384 | * every switch on the path to root complex need 1 more | ||
385 | * microsecond for L1. Spec doesn't mention L0S. | ||
386 | */ | ||
387 | if (state & PCIE_LINK_STATE_L1) | ||
388 | l1_latency += 1000; | ||
389 | } | ||
390 | } | ||
391 | return state; | ||
392 | } | ||
393 | |||
394 | static unsigned int pcie_aspm_check_state(struct pci_dev *pdev, | ||
395 | unsigned int state) | ||
396 | { | ||
397 | struct pci_dev *child_dev; | ||
398 | |||
399 | /* If no child, disable the link */ | ||
400 | if (list_empty(&pdev->subordinate->devices)) | ||
401 | return 0; | ||
402 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { | ||
403 | if (child_dev->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) { | ||
404 | /* | ||
405 | * If downstream component of a link is pci bridge, we | ||
406 | * disable ASPM for now for the link | ||
407 | * */ | ||
408 | state = 0; | ||
409 | break; | ||
410 | } | ||
411 | if ((child_dev->pcie_type != PCI_EXP_TYPE_ENDPOINT && | ||
412 | child_dev->pcie_type != PCI_EXP_TYPE_LEG_END)) | ||
413 | continue; | ||
414 | /* Device not in D0 doesn't need check latency */ | ||
415 | if (child_dev->current_state == PCI_D1 || | ||
416 | child_dev->current_state == PCI_D2 || | ||
417 | child_dev->current_state == PCI_D3hot || | ||
418 | child_dev->current_state == PCI_D3cold) | ||
419 | continue; | ||
420 | state = __pcie_aspm_check_state_one(child_dev, state); | ||
421 | } | ||
422 | return state; | ||
423 | } | ||
424 | |||
425 | static void __pcie_aspm_config_one_dev(struct pci_dev *pdev, unsigned int state) | ||
426 | { | ||
427 | u16 reg16; | ||
428 | int pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); | ||
429 | |||
430 | pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16); | ||
431 | reg16 &= ~0x3; | ||
432 | reg16 |= state; | ||
433 | pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16); | ||
434 | } | ||
435 | |||
436 | static void __pcie_aspm_config_link(struct pci_dev *pdev, unsigned int state) | ||
437 | { | ||
438 | struct pci_dev *child_dev; | ||
439 | int valid = 1; | ||
440 | struct pcie_link_state *link_state = pdev->link_state; | ||
441 | |||
442 | /* | ||
443 | * if the downstream component has pci bridge function, don't do ASPM | ||
444 | * now | ||
445 | */ | ||
446 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { | ||
447 | if (child_dev->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) { | ||
448 | valid = 0; | ||
449 | break; | ||
450 | } | ||
451 | } | ||
452 | if (!valid) | ||
453 | return; | ||
454 | |||
455 | /* | ||
456 | * spec 2.0 suggests all functions should be configured the same | ||
457 | * setting for ASPM. Enabling ASPM L1 should be done in upstream | ||
458 | * component first and then downstream, and vice versa for disabling | ||
459 | * ASPM L1. Spec doesn't mention L0S. | ||
460 | */ | ||
461 | if (state & PCIE_LINK_STATE_L1) | ||
462 | __pcie_aspm_config_one_dev(pdev, state); | ||
463 | |||
464 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) | ||
465 | __pcie_aspm_config_one_dev(child_dev, state); | ||
466 | |||
467 | if (!(state & PCIE_LINK_STATE_L1)) | ||
468 | __pcie_aspm_config_one_dev(pdev, state); | ||
469 | |||
470 | link_state->enabled_state = state; | ||
471 | } | ||
472 | |||
473 | static void __pcie_aspm_configure_link_state(struct pci_dev *pdev, | ||
474 | unsigned int state) | ||
475 | { | ||
476 | struct pcie_link_state *link_state = pdev->link_state; | ||
477 | |||
478 | if (link_state->support_state == 0) | ||
479 | return; | ||
480 | state &= PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1; | ||
481 | |||
482 | /* state 0 means disabling aspm */ | ||
483 | state = pcie_aspm_check_state(pdev, state); | ||
484 | if (link_state->enabled_state == state) | ||
485 | return; | ||
486 | __pcie_aspm_config_link(pdev, state); | ||
487 | } | ||
488 | |||
489 | /* | ||
490 | * pcie_aspm_configure_link_state: enable/disable PCI express link state | ||
491 | * @pdev: the root port or switch downstream port | ||
492 | */ | ||
493 | static void pcie_aspm_configure_link_state(struct pci_dev *pdev, | ||
494 | unsigned int state) | ||
495 | { | ||
496 | down_read(&pci_bus_sem); | ||
497 | mutex_lock(&aspm_lock); | ||
498 | __pcie_aspm_configure_link_state(pdev, state); | ||
499 | mutex_unlock(&aspm_lock); | ||
500 | up_read(&pci_bus_sem); | ||
501 | } | ||
502 | |||
503 | static void free_link_state(struct pci_dev *pdev) | ||
504 | { | ||
505 | kfree(pdev->link_state); | ||
506 | pdev->link_state = NULL; | ||
507 | } | ||
508 | |||
509 | /* | ||
510 | * pcie_aspm_init_link_state: Initiate PCI express link state. | ||
511 | * It is called after the pcie and its children devices are scaned. | ||
512 | * @pdev: the root port or switch downstream port | ||
513 | */ | ||
514 | void pcie_aspm_init_link_state(struct pci_dev *pdev) | ||
515 | { | ||
516 | unsigned int state; | ||
517 | struct pcie_link_state *link_state; | ||
518 | int error = 0; | ||
519 | |||
520 | if (aspm_disabled || !pdev->is_pcie || pdev->link_state) | ||
521 | return; | ||
522 | if (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && | ||
523 | pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) | ||
524 | return; | ||
525 | down_read(&pci_bus_sem); | ||
526 | if (list_empty(&pdev->subordinate->devices)) | ||
527 | goto out; | ||
528 | |||
529 | mutex_lock(&aspm_lock); | ||
530 | |||
531 | link_state = kzalloc(sizeof(*link_state), GFP_KERNEL); | ||
532 | if (!link_state) | ||
533 | goto unlock_out; | ||
534 | pdev->link_state = link_state; | ||
535 | |||
536 | pcie_aspm_configure_common_clock(pdev); | ||
537 | |||
538 | pcie_aspm_cap_init(pdev); | ||
539 | |||
540 | /* config link state to avoid BIOS error */ | ||
541 | state = pcie_aspm_check_state(pdev, policy_to_aspm_state(pdev)); | ||
542 | __pcie_aspm_config_link(pdev, state); | ||
543 | |||
544 | pcie_check_clock_pm(pdev); | ||
545 | |||
546 | link_state->pdev = pdev; | ||
547 | list_add(&link_state->sibiling, &link_list); | ||
548 | |||
549 | unlock_out: | ||
550 | if (error) | ||
551 | free_link_state(pdev); | ||
552 | mutex_unlock(&aspm_lock); | ||
553 | out: | ||
554 | up_read(&pci_bus_sem); | ||
555 | } | ||
556 | |||
557 | /* @pdev: the endpoint device */ | ||
558 | void pcie_aspm_exit_link_state(struct pci_dev *pdev) | ||
559 | { | ||
560 | struct pci_dev *parent = pdev->bus->self; | ||
561 | struct pcie_link_state *link_state = parent->link_state; | ||
562 | |||
563 | if (aspm_disabled || !pdev->is_pcie || !parent || !link_state) | ||
564 | return; | ||
565 | if (parent->pcie_type != PCI_EXP_TYPE_ROOT_PORT && | ||
566 | parent->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) | ||
567 | return; | ||
568 | down_read(&pci_bus_sem); | ||
569 | mutex_lock(&aspm_lock); | ||
570 | |||
571 | /* | ||
572 | * All PCIe functions are in one slot, remove one function will remove | ||
573 | * the the whole slot, so just wait | ||
574 | */ | ||
575 | if (!list_empty(&parent->subordinate->devices)) | ||
576 | goto out; | ||
577 | |||
578 | /* All functions are removed, so just disable ASPM for the link */ | ||
579 | __pcie_aspm_config_one_dev(parent, 0); | ||
580 | list_del(&link_state->sibiling); | ||
581 | /* Clock PM is for endpoint device */ | ||
582 | |||
583 | free_link_state(parent); | ||
584 | out: | ||
585 | mutex_unlock(&aspm_lock); | ||
586 | up_read(&pci_bus_sem); | ||
587 | } | ||
588 | |||
589 | /* @pdev: the root port or switch downstream port */ | ||
590 | void pcie_aspm_pm_state_change(struct pci_dev *pdev) | ||
591 | { | ||
592 | struct pcie_link_state *link_state = pdev->link_state; | ||
593 | |||
594 | if (aspm_disabled || !pdev->is_pcie || !pdev->link_state) | ||
595 | return; | ||
596 | if (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && | ||
597 | pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) | ||
598 | return; | ||
599 | /* | ||
600 | * devices changed PM state, we should recheck if latency meets all | ||
601 | * functions' requirement | ||
602 | */ | ||
603 | pcie_aspm_configure_link_state(pdev, link_state->enabled_state); | ||
604 | } | ||
605 | |||
606 | /* | ||
607 | * pci_disable_link_state - disable pci device's link state, so the link will | ||
608 | * never enter specific states | ||
609 | */ | ||
610 | void pci_disable_link_state(struct pci_dev *pdev, int state) | ||
611 | { | ||
612 | struct pci_dev *parent = pdev->bus->self; | ||
613 | struct pcie_link_state *link_state; | ||
614 | |||
615 | if (aspm_disabled || !pdev->is_pcie) | ||
616 | return; | ||
617 | if (pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT || | ||
618 | pdev->pcie_type == PCI_EXP_TYPE_DOWNSTREAM) | ||
619 | parent = pdev; | ||
620 | if (!parent || !parent->link_state) | ||
621 | return; | ||
622 | |||
623 | down_read(&pci_bus_sem); | ||
624 | mutex_lock(&aspm_lock); | ||
625 | link_state = parent->link_state; | ||
626 | link_state->support_state &= | ||
627 | ~(state & (PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1)); | ||
628 | if (state & PCIE_LINK_STATE_CLKPM) | ||
629 | link_state->clk_pm_capable = 0; | ||
630 | |||
631 | __pcie_aspm_configure_link_state(parent, link_state->enabled_state); | ||
632 | if (!link_state->clk_pm_capable && link_state->clk_pm_enabled) | ||
633 | pcie_set_clock_pm(parent, 0); | ||
634 | mutex_unlock(&aspm_lock); | ||
635 | up_read(&pci_bus_sem); | ||
636 | } | ||
637 | EXPORT_SYMBOL(pci_disable_link_state); | ||
638 | |||
639 | static int pcie_aspm_set_policy(const char *val, struct kernel_param *kp) | ||
640 | { | ||
641 | int i; | ||
642 | struct pci_dev *pdev; | ||
643 | struct pcie_link_state *link_state; | ||
644 | |||
645 | for (i = 0; i < ARRAY_SIZE(policy_str); i++) | ||
646 | if (!strncmp(val, policy_str[i], strlen(policy_str[i]))) | ||
647 | break; | ||
648 | if (i >= ARRAY_SIZE(policy_str)) | ||
649 | return -EINVAL; | ||
650 | if (i == aspm_policy) | ||
651 | return 0; | ||
652 | |||
653 | down_read(&pci_bus_sem); | ||
654 | mutex_lock(&aspm_lock); | ||
655 | aspm_policy = i; | ||
656 | list_for_each_entry(link_state, &link_list, sibiling) { | ||
657 | pdev = link_state->pdev; | ||
658 | __pcie_aspm_configure_link_state(pdev, | ||
659 | policy_to_aspm_state(pdev)); | ||
660 | if (link_state->clk_pm_capable && | ||
661 | link_state->clk_pm_enabled != policy_to_clkpm_state(pdev)) | ||
662 | pcie_set_clock_pm(pdev, policy_to_clkpm_state(pdev)); | ||
663 | |||
664 | } | ||
665 | mutex_unlock(&aspm_lock); | ||
666 | up_read(&pci_bus_sem); | ||
667 | return 0; | ||
668 | } | ||
669 | |||
670 | static int pcie_aspm_get_policy(char *buffer, struct kernel_param *kp) | ||
671 | { | ||
672 | int i, cnt = 0; | ||
673 | for (i = 0; i < ARRAY_SIZE(policy_str); i++) | ||
674 | if (i == aspm_policy) | ||
675 | cnt += sprintf(buffer + cnt, "[%s] ", policy_str[i]); | ||
676 | else | ||
677 | cnt += sprintf(buffer + cnt, "%s ", policy_str[i]); | ||
678 | return cnt; | ||
679 | } | ||
680 | |||
681 | module_param_call(policy, pcie_aspm_set_policy, pcie_aspm_get_policy, | ||
682 | NULL, 0644); | ||
683 | |||
684 | #ifdef CONFIG_PCIEASPM_DEBUG | ||
685 | static ssize_t link_state_show(struct device *dev, | ||
686 | struct device_attribute *attr, | ||
687 | char *buf) | ||
688 | { | ||
689 | struct pci_dev *pci_device = to_pci_dev(dev); | ||
690 | struct pcie_link_state *link_state = pci_device->link_state; | ||
691 | |||
692 | return sprintf(buf, "%d\n", link_state->enabled_state); | ||
693 | } | ||
694 | |||
695 | static ssize_t link_state_store(struct device *dev, | ||
696 | struct device_attribute *attr, | ||
697 | const char *buf, | ||
698 | size_t n) | ||
699 | { | ||
700 | struct pci_dev *pci_device = to_pci_dev(dev); | ||
701 | int state; | ||
702 | |||
703 | if (n < 1) | ||
704 | return -EINVAL; | ||
705 | state = buf[0]-'0'; | ||
706 | if (state >= 0 && state <= 3) { | ||
707 | /* setup link aspm state */ | ||
708 | pcie_aspm_configure_link_state(pci_device, state); | ||
709 | return n; | ||
710 | } | ||
711 | |||
712 | return -EINVAL; | ||
713 | } | ||
714 | |||
715 | static ssize_t clk_ctl_show(struct device *dev, | ||
716 | struct device_attribute *attr, | ||
717 | char *buf) | ||
718 | { | ||
719 | struct pci_dev *pci_device = to_pci_dev(dev); | ||
720 | struct pcie_link_state *link_state = pci_device->link_state; | ||
721 | |||
722 | return sprintf(buf, "%d\n", link_state->clk_pm_enabled); | ||
723 | } | ||
724 | |||
725 | static ssize_t clk_ctl_store(struct device *dev, | ||
726 | struct device_attribute *attr, | ||
727 | const char *buf, | ||
728 | size_t n) | ||
729 | { | ||
730 | struct pci_dev *pci_device = to_pci_dev(dev); | ||
731 | int state; | ||
732 | |||
733 | if (n < 1) | ||
734 | return -EINVAL; | ||
735 | state = buf[0]-'0'; | ||
736 | |||
737 | down_read(&pci_bus_sem); | ||
738 | mutex_lock(&aspm_lock); | ||
739 | pcie_set_clock_pm(pci_device, !!state); | ||
740 | mutex_unlock(&aspm_lock); | ||
741 | up_read(&pci_bus_sem); | ||
742 | |||
743 | return n; | ||
744 | } | ||
745 | |||
746 | static DEVICE_ATTR(link_state, 0644, link_state_show, link_state_store); | ||
747 | static DEVICE_ATTR(clk_ctl, 0644, clk_ctl_show, clk_ctl_store); | ||
748 | |||
749 | static char power_group[] = "power"; | ||
750 | void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) | ||
751 | { | ||
752 | struct pcie_link_state *link_state = pdev->link_state; | ||
753 | |||
754 | if (!pdev->is_pcie || (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && | ||
755 | pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) || !link_state) | ||
756 | return; | ||
757 | |||
758 | if (link_state->support_state) | ||
759 | sysfs_add_file_to_group(&pdev->dev.kobj, | ||
760 | &dev_attr_link_state.attr, power_group); | ||
761 | if (link_state->clk_pm_capable) | ||
762 | sysfs_add_file_to_group(&pdev->dev.kobj, | ||
763 | &dev_attr_clk_ctl.attr, power_group); | ||
764 | } | ||
765 | |||
766 | void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev) | ||
767 | { | ||
768 | struct pcie_link_state *link_state = pdev->link_state; | ||
769 | |||
770 | if (!pdev->is_pcie || (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && | ||
771 | pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) || !link_state) | ||
772 | return; | ||
773 | |||
774 | if (link_state->support_state) | ||
775 | sysfs_remove_file_from_group(&pdev->dev.kobj, | ||
776 | &dev_attr_link_state.attr, power_group); | ||
777 | if (link_state->clk_pm_capable) | ||
778 | sysfs_remove_file_from_group(&pdev->dev.kobj, | ||
779 | &dev_attr_clk_ctl.attr, power_group); | ||
780 | } | ||
781 | #endif | ||
782 | |||
783 | static int __init pcie_aspm_disable(char *str) | ||
784 | { | ||
785 | aspm_disabled = 1; | ||
786 | return 1; | ||
787 | } | ||
788 | |||
789 | __setup("pcie_noaspm", pcie_aspm_disable); | ||
790 | |||
791 | #ifdef CONFIG_ACPI | ||
792 | #include <acpi/acpi_bus.h> | ||
793 | #include <linux/pci-acpi.h> | ||
794 | static void pcie_aspm_platform_init(void) | ||
795 | { | ||
796 | pcie_osc_support_set(OSC_ACTIVE_STATE_PWR_SUPPORT| | ||
797 | OSC_CLOCK_PWR_CAPABILITY_SUPPORT); | ||
798 | } | ||
799 | #else | ||
800 | static inline void pcie_aspm_platform_init(void) { } | ||
801 | #endif | ||
802 | |||
803 | static int __init pcie_aspm_init(void) | ||
804 | { | ||
805 | if (aspm_disabled) | ||
806 | return 0; | ||
807 | pcie_aspm_platform_init(); | ||
808 | return 0; | ||
809 | } | ||
810 | |||
811 | fs_initcall(pcie_aspm_init); | ||
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 23d9eb073296..fb0abfa508dc 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c | |||
@@ -150,7 +150,7 @@ static int assign_interrupt_mode(struct pci_dev *dev, int *vectors, int mask) | |||
150 | if (pos) { | 150 | if (pos) { |
151 | struct msix_entry msix_entries[PCIE_PORT_DEVICE_MAXSERVICES] = | 151 | struct msix_entry msix_entries[PCIE_PORT_DEVICE_MAXSERVICES] = |
152 | {{0, 0}, {0, 1}, {0, 2}, {0, 3}}; | 152 | {{0, 0}, {0, 1}, {0, 2}, {0, 3}}; |
153 | printk("%s Found MSIX capability\n", __FUNCTION__); | 153 | printk("%s Found MSIX capability\n", __func__); |
154 | status = pci_enable_msix(dev, msix_entries, nvec); | 154 | status = pci_enable_msix(dev, msix_entries, nvec); |
155 | if (!status) { | 155 | if (!status) { |
156 | int j = 0; | 156 | int j = 0; |
@@ -165,7 +165,7 @@ static int assign_interrupt_mode(struct pci_dev *dev, int *vectors, int mask) | |||
165 | if (status) { | 165 | if (status) { |
166 | pos = pci_find_capability(dev, PCI_CAP_ID_MSI); | 166 | pos = pci_find_capability(dev, PCI_CAP_ID_MSI); |
167 | if (pos) { | 167 | if (pos) { |
168 | printk("%s Found MSI capability\n", __FUNCTION__); | 168 | printk("%s Found MSI capability\n", __func__); |
169 | status = pci_enable_msi(dev); | 169 | status = pci_enable_msi(dev); |
170 | if (!status) { | 170 | if (!status) { |
171 | interrupt_mode = PCIE_PORT_MSI_MODE; | 171 | interrupt_mode = PCIE_PORT_MSI_MODE; |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index 26057f98f72e..51d163238d93 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
@@ -93,7 +93,7 @@ static int __devinit pcie_portdrv_probe (struct pci_dev *dev, | |||
93 | if (!dev->irq && dev->pin) { | 93 | if (!dev->irq && dev->pin) { |
94 | printk(KERN_WARNING | 94 | printk(KERN_WARNING |
95 | "%s->Dev[%04x:%04x] has invalid IRQ. Check vendor BIOS\n", | 95 | "%s->Dev[%04x:%04x] has invalid IRQ. Check vendor BIOS\n", |
96 | __FUNCTION__, dev->vendor, dev->device); | 96 | __func__, dev->vendor, dev->device); |
97 | } | 97 | } |
98 | if (pcie_port_device_register(dev)) { | 98 | if (pcie_port_device_register(dev)) { |
99 | pci_disable_device(dev); | 99 | pci_disable_device(dev); |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 4b3011a23eff..f991359f0c36 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/cpumask.h> | 11 | #include <linux/cpumask.h> |
12 | #include <linux/pci-aspm.h> | ||
12 | #include "pci.h" | 13 | #include "pci.h" |
13 | 14 | ||
14 | #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ | 15 | #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ |
@@ -20,18 +21,27 @@ | |||
20 | LIST_HEAD(pci_root_buses); | 21 | LIST_HEAD(pci_root_buses); |
21 | EXPORT_SYMBOL(pci_root_buses); | 22 | EXPORT_SYMBOL(pci_root_buses); |
22 | 23 | ||
23 | LIST_HEAD(pci_devices); | 24 | |
25 | static int find_anything(struct device *dev, void *data) | ||
26 | { | ||
27 | return 1; | ||
28 | } | ||
24 | 29 | ||
25 | /* | 30 | /* |
26 | * Some device drivers need know if pci is initiated. | 31 | * Some device drivers need know if pci is initiated. |
27 | * Basically, we think pci is not initiated when there | 32 | * Basically, we think pci is not initiated when there |
28 | * is no device in list of pci_devices. | 33 | * is no device to be found on the pci_bus_type. |
29 | */ | 34 | */ |
30 | int no_pci_devices(void) | 35 | int no_pci_devices(void) |
31 | { | 36 | { |
32 | return list_empty(&pci_devices); | 37 | struct device *dev; |
33 | } | 38 | int no_devices; |
34 | 39 | ||
40 | dev = bus_find_device(&pci_bus_type, NULL, NULL, find_anything); | ||
41 | no_devices = (dev == NULL); | ||
42 | put_device(dev); | ||
43 | return no_devices; | ||
44 | } | ||
35 | EXPORT_SYMBOL(no_pci_devices); | 45 | EXPORT_SYMBOL(no_pci_devices); |
36 | 46 | ||
37 | #ifdef HAVE_PCI_LEGACY | 47 | #ifdef HAVE_PCI_LEGACY |
@@ -244,7 +254,7 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) | |||
244 | res->flags |= l & ~PCI_BASE_ADDRESS_IO_MASK; | 254 | res->flags |= l & ~PCI_BASE_ADDRESS_IO_MASK; |
245 | } | 255 | } |
246 | res->end = res->start + (unsigned long) sz; | 256 | res->end = res->start + (unsigned long) sz; |
247 | res->flags |= pci_calc_resource_flags(l); | 257 | res->flags |= pci_calc_resource_flags(l) | IORESOURCE_SIZEALIGN; |
248 | if (is_64bit_memory(l)) { | 258 | if (is_64bit_memory(l)) { |
249 | u32 szhi, lhi; | 259 | u32 szhi, lhi; |
250 | 260 | ||
@@ -297,7 +307,8 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) | |||
297 | if (sz) { | 307 | if (sz) { |
298 | res->flags = (l & IORESOURCE_ROM_ENABLE) | | 308 | res->flags = (l & IORESOURCE_ROM_ENABLE) | |
299 | IORESOURCE_MEM | IORESOURCE_PREFETCH | | 309 | IORESOURCE_MEM | IORESOURCE_PREFETCH | |
300 | IORESOURCE_READONLY | IORESOURCE_CACHEABLE; | 310 | IORESOURCE_READONLY | IORESOURCE_CACHEABLE | |
311 | IORESOURCE_SIZEALIGN; | ||
301 | res->start = l & PCI_ROM_ADDRESS_MASK; | 312 | res->start = l & PCI_ROM_ADDRESS_MASK; |
302 | res->end = res->start + (unsigned long) sz; | 313 | res->end = res->start + (unsigned long) sz; |
303 | } | 314 | } |
@@ -407,8 +418,8 @@ static struct pci_bus * pci_alloc_bus(void) | |||
407 | return b; | 418 | return b; |
408 | } | 419 | } |
409 | 420 | ||
410 | static struct pci_bus * __devinit | 421 | static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, |
411 | pci_alloc_child_bus(struct pci_bus *parent, struct pci_dev *bridge, int busnr) | 422 | struct pci_dev *bridge, int busnr) |
412 | { | 423 | { |
413 | struct pci_bus *child; | 424 | struct pci_bus *child; |
414 | int i; | 425 | int i; |
@@ -641,7 +652,9 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, | |||
641 | pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max); | 652 | pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max); |
642 | } | 653 | } |
643 | 654 | ||
644 | sprintf(child->name, (is_cardbus ? "PCI CardBus #%02x" : "PCI Bus #%02x"), child->number); | 655 | sprintf(child->name, |
656 | (is_cardbus ? "PCI CardBus %04x:%02x" : "PCI Bus %04x:%02x"), | ||
657 | pci_domain_nr(bus), child->number); | ||
645 | 658 | ||
646 | /* Has only triggered on CardBus, fixup is in yenta_socket */ | 659 | /* Has only triggered on CardBus, fixup is in yenta_socket */ |
647 | while (bus->parent) { | 660 | while (bus->parent) { |
@@ -801,6 +814,7 @@ static void pci_release_dev(struct device *dev) | |||
801 | struct pci_dev *pci_dev; | 814 | struct pci_dev *pci_dev; |
802 | 815 | ||
803 | pci_dev = to_pci_dev(dev); | 816 | pci_dev = to_pci_dev(dev); |
817 | pci_vpd_release(pci_dev); | ||
804 | kfree(pci_dev); | 818 | kfree(pci_dev); |
805 | } | 819 | } |
806 | 820 | ||
@@ -868,7 +882,6 @@ struct pci_dev *alloc_pci_dev(void) | |||
868 | if (!dev) | 882 | if (!dev) |
869 | return NULL; | 883 | return NULL; |
870 | 884 | ||
871 | INIT_LIST_HEAD(&dev->global_list); | ||
872 | INIT_LIST_HEAD(&dev->bus_list); | 885 | INIT_LIST_HEAD(&dev->bus_list); |
873 | 886 | ||
874 | pci_msi_init_pci_dev(dev); | 887 | pci_msi_init_pci_dev(dev); |
@@ -881,8 +894,7 @@ EXPORT_SYMBOL(alloc_pci_dev); | |||
881 | * Read the config data for a PCI device, sanity-check it | 894 | * Read the config data for a PCI device, sanity-check it |
882 | * and fill in the dev structure... | 895 | * and fill in the dev structure... |
883 | */ | 896 | */ |
884 | static struct pci_dev * __devinit | 897 | static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn) |
885 | pci_scan_device(struct pci_bus *bus, int devfn) | ||
886 | { | 898 | { |
887 | struct pci_dev *dev; | 899 | struct pci_dev *dev; |
888 | u32 l; | 900 | u32 l; |
@@ -941,6 +953,8 @@ pci_scan_device(struct pci_bus *bus, int devfn) | |||
941 | return NULL; | 953 | return NULL; |
942 | } | 954 | } |
943 | 955 | ||
956 | pci_vpd_pci22_init(dev); | ||
957 | |||
944 | return dev; | 958 | return dev; |
945 | } | 959 | } |
946 | 960 | ||
@@ -965,7 +979,6 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) | |||
965 | * Add the device to our list of discovered devices | 979 | * Add the device to our list of discovered devices |
966 | * and the bus list for fixup functions, etc. | 980 | * and the bus list for fixup functions, etc. |
967 | */ | 981 | */ |
968 | INIT_LIST_HEAD(&dev->global_list); | ||
969 | down_write(&pci_bus_sem); | 982 | down_write(&pci_bus_sem); |
970 | list_add_tail(&dev->bus_list, &bus->devices); | 983 | list_add_tail(&dev->bus_list, &bus->devices); |
971 | up_write(&pci_bus_sem); | 984 | up_write(&pci_bus_sem); |
@@ -992,7 +1005,7 @@ EXPORT_SYMBOL(pci_scan_single_device); | |||
992 | * | 1005 | * |
993 | * Scan a PCI slot on the specified PCI bus for devices, adding | 1006 | * Scan a PCI slot on the specified PCI bus for devices, adding |
994 | * discovered devices to the @bus->devices list. New devices | 1007 | * discovered devices to the @bus->devices list. New devices |
995 | * will have an empty dev->global_list head. | 1008 | * will not have is_added set. |
996 | */ | 1009 | */ |
997 | int pci_scan_slot(struct pci_bus *bus, int devfn) | 1010 | int pci_scan_slot(struct pci_bus *bus, int devfn) |
998 | { | 1011 | { |
@@ -1024,6 +1037,10 @@ int pci_scan_slot(struct pci_bus *bus, int devfn) | |||
1024 | break; | 1037 | break; |
1025 | } | 1038 | } |
1026 | } | 1039 | } |
1040 | |||
1041 | if (bus->self) | ||
1042 | pcie_aspm_init_link_state(bus->self); | ||
1043 | |||
1027 | return nr; | 1044 | return nr; |
1028 | } | 1045 | } |
1029 | 1046 | ||
@@ -1194,7 +1211,7 @@ static void __init pci_insertion_sort_klist(struct pci_dev *a, struct list_head | |||
1194 | list_move_tail(&a->dev.knode_bus.n_node, list); | 1211 | list_move_tail(&a->dev.knode_bus.n_node, list); |
1195 | } | 1212 | } |
1196 | 1213 | ||
1197 | static void __init pci_sort_breadthfirst_klist(void) | 1214 | void __init pci_sort_breadthfirst(void) |
1198 | { | 1215 | { |
1199 | LIST_HEAD(sorted_devices); | 1216 | LIST_HEAD(sorted_devices); |
1200 | struct list_head *pos, *tmp; | 1217 | struct list_head *pos, *tmp; |
@@ -1215,36 +1232,3 @@ static void __init pci_sort_breadthfirst_klist(void) | |||
1215 | list_splice(&sorted_devices, &device_klist->k_list); | 1232 | list_splice(&sorted_devices, &device_klist->k_list); |
1216 | spin_unlock(&device_klist->k_lock); | 1233 | spin_unlock(&device_klist->k_lock); |
1217 | } | 1234 | } |
1218 | |||
1219 | static void __init pci_insertion_sort_devices(struct pci_dev *a, struct list_head *list) | ||
1220 | { | ||
1221 | struct pci_dev *b; | ||
1222 | |||
1223 | list_for_each_entry(b, list, global_list) { | ||
1224 | if (pci_sort_bf_cmp(a, b) <= 0) { | ||
1225 | list_move_tail(&a->global_list, &b->global_list); | ||
1226 | return; | ||
1227 | } | ||
1228 | } | ||
1229 | list_move_tail(&a->global_list, list); | ||
1230 | } | ||
1231 | |||
1232 | static void __init pci_sort_breadthfirst_devices(void) | ||
1233 | { | ||
1234 | LIST_HEAD(sorted_devices); | ||
1235 | struct pci_dev *dev, *tmp; | ||
1236 | |||
1237 | down_write(&pci_bus_sem); | ||
1238 | list_for_each_entry_safe(dev, tmp, &pci_devices, global_list) { | ||
1239 | pci_insertion_sort_devices(dev, &sorted_devices); | ||
1240 | } | ||
1241 | list_splice(&sorted_devices, &pci_devices); | ||
1242 | up_write(&pci_bus_sem); | ||
1243 | } | ||
1244 | |||
1245 | void __init pci_sort_breadthfirst(void) | ||
1246 | { | ||
1247 | pci_sort_breadthfirst_devices(); | ||
1248 | pci_sort_breadthfirst_klist(); | ||
1249 | } | ||
1250 | |||
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index e887aa45c9cd..afd914ebe215 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1502,8 +1502,8 @@ static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_f | |||
1502 | if ((f->vendor == dev->vendor || f->vendor == (u16) PCI_ANY_ID) && | 1502 | if ((f->vendor == dev->vendor || f->vendor == (u16) PCI_ANY_ID) && |
1503 | (f->device == dev->device || f->device == (u16) PCI_ANY_ID)) { | 1503 | (f->device == dev->device || f->device == (u16) PCI_ANY_ID)) { |
1504 | #ifdef DEBUG | 1504 | #ifdef DEBUG |
1505 | dev_dbg(&dev->dev, "calling quirk 0x%p", f->hook); | 1505 | dev_dbg(&dev->dev, "calling "); |
1506 | print_fn_descriptor_symbol(": %s()\n", | 1506 | print_fn_descriptor_symbol("%s()\n", |
1507 | (unsigned long) f->hook); | 1507 | (unsigned long) f->hook); |
1508 | #endif | 1508 | #endif |
1509 | f->hook(dev); | 1509 | f->hook(dev); |
@@ -1648,13 +1648,24 @@ static void __devinit quirk_via_cx700_pci_parking_caching(struct pci_dev *dev) | |||
1648 | /* Turn off PCI Bus Parking */ | 1648 | /* Turn off PCI Bus Parking */ |
1649 | pci_write_config_byte(dev, 0x76, b ^ 0x40); | 1649 | pci_write_config_byte(dev, 0x76, b ^ 0x40); |
1650 | 1650 | ||
1651 | dev_info(&dev->dev, | ||
1652 | "Disabling VIA CX700 PCI parking\n"); | ||
1653 | } | ||
1654 | } | ||
1655 | |||
1656 | if (pci_read_config_byte(dev, 0x72, &b) == 0) { | ||
1657 | if (b != 0) { | ||
1651 | /* Turn off PCI Master read caching */ | 1658 | /* Turn off PCI Master read caching */ |
1652 | pci_write_config_byte(dev, 0x72, 0x0); | 1659 | pci_write_config_byte(dev, 0x72, 0x0); |
1660 | |||
1661 | /* Set PCI Master Bus time-out to "1x16 PCLK" */ | ||
1653 | pci_write_config_byte(dev, 0x75, 0x1); | 1662 | pci_write_config_byte(dev, 0x75, 0x1); |
1663 | |||
1664 | /* Disable "Read FIFO Timer" */ | ||
1654 | pci_write_config_byte(dev, 0x77, 0x0); | 1665 | pci_write_config_byte(dev, 0x77, 0x0); |
1655 | 1666 | ||
1656 | dev_info(&dev->dev, | 1667 | dev_info(&dev->dev, |
1657 | "Disabling VIA CX700 PCI parking/caching\n"); | 1668 | "Disabling VIA CX700 PCI caching\n"); |
1658 | } | 1669 | } |
1659 | } | 1670 | } |
1660 | } | 1671 | } |
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index 9684e1bde277..bdc2a44d68e1 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include <linux/pci.h> | 1 | #include <linux/pci.h> |
2 | #include <linux/module.h> | 2 | #include <linux/module.h> |
3 | #include <linux/pci-aspm.h> | ||
3 | #include "pci.h" | 4 | #include "pci.h" |
4 | 5 | ||
5 | static void pci_free_resources(struct pci_dev *dev) | 6 | static void pci_free_resources(struct pci_dev *dev) |
@@ -18,18 +19,15 @@ static void pci_free_resources(struct pci_dev *dev) | |||
18 | 19 | ||
19 | static void pci_stop_dev(struct pci_dev *dev) | 20 | static void pci_stop_dev(struct pci_dev *dev) |
20 | { | 21 | { |
21 | if (!dev->global_list.next) | 22 | if (dev->is_added) { |
22 | return; | ||
23 | |||
24 | if (!list_empty(&dev->global_list)) { | ||
25 | pci_proc_detach_device(dev); | 23 | pci_proc_detach_device(dev); |
26 | pci_remove_sysfs_dev_files(dev); | 24 | pci_remove_sysfs_dev_files(dev); |
27 | device_unregister(&dev->dev); | 25 | device_unregister(&dev->dev); |
28 | down_write(&pci_bus_sem); | 26 | dev->is_added = 0; |
29 | list_del(&dev->global_list); | ||
30 | dev->global_list.next = dev->global_list.prev = NULL; | ||
31 | up_write(&pci_bus_sem); | ||
32 | } | 27 | } |
28 | |||
29 | if (dev->bus->self) | ||
30 | pcie_aspm_exit_link_state(dev); | ||
33 | } | 31 | } |
34 | 32 | ||
35 | static void pci_destroy_dev(struct pci_dev *dev) | 33 | static void pci_destroy_dev(struct pci_dev *dev) |
diff --git a/drivers/pci/search.c b/drivers/pci/search.c index 8541034021f0..217814fef4ef 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c | |||
@@ -114,31 +114,63 @@ pci_find_next_bus(const struct pci_bus *from) | |||
114 | } | 114 | } |
115 | 115 | ||
116 | #ifdef CONFIG_PCI_LEGACY | 116 | #ifdef CONFIG_PCI_LEGACY |
117 | |||
118 | /** | 117 | /** |
119 | * pci_find_slot - locate PCI device from a given PCI slot | 118 | * pci_find_slot - locate PCI device from a given PCI slot |
120 | * @bus: number of PCI bus on which desired PCI device resides | 119 | * @bus: number of PCI bus on which desired PCI device resides |
121 | * @devfn: encodes number of PCI slot in which the desired PCI | 120 | * @devfn: encodes number of PCI slot in which the desired PCI |
122 | * device resides and the logical device number within that slot | 121 | * device resides and the logical device number within that slot |
123 | * in case of multi-function devices. | 122 | * in case of multi-function devices. |
124 | * | 123 | * |
125 | * Given a PCI bus and slot/function number, the desired PCI device | 124 | * Given a PCI bus and slot/function number, the desired PCI device |
126 | * is located in system global list of PCI devices. If the device | 125 | * is located in system global list of PCI devices. If the device |
127 | * is found, a pointer to its data structure is returned. If no | 126 | * is found, a pointer to its data structure is returned. If no |
128 | * device is found, %NULL is returned. | 127 | * device is found, %NULL is returned. |
128 | * | ||
129 | * NOTE: Do not use this function any more; use pci_get_slot() instead, as | ||
130 | * the PCI device returned by this function can disappear at any moment in | ||
131 | * time. | ||
129 | */ | 132 | */ |
130 | struct pci_dev * | 133 | struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn) |
131 | pci_find_slot(unsigned int bus, unsigned int devfn) | ||
132 | { | 134 | { |
133 | struct pci_dev *dev = NULL; | 135 | struct pci_dev *dev = NULL; |
134 | 136 | ||
135 | while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { | 137 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { |
136 | if (dev->bus->number == bus && dev->devfn == devfn) | 138 | if (dev->bus->number == bus && dev->devfn == devfn) { |
139 | pci_dev_put(dev); | ||
137 | return dev; | 140 | return dev; |
141 | } | ||
138 | } | 142 | } |
139 | return NULL; | 143 | return NULL; |
140 | } | 144 | } |
145 | EXPORT_SYMBOL(pci_find_slot); | ||
146 | |||
147 | /** | ||
148 | * pci_find_device - begin or continue searching for a PCI device by vendor/device id | ||
149 | * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids | ||
150 | * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids | ||
151 | * @from: Previous PCI device found in search, or %NULL for new search. | ||
152 | * | ||
153 | * Iterates through the list of known PCI devices. If a PCI device is found | ||
154 | * with a matching @vendor and @device, a pointer to its device structure is | ||
155 | * returned. Otherwise, %NULL is returned. | ||
156 | * A new search is initiated by passing %NULL as the @from argument. | ||
157 | * Otherwise if @from is not %NULL, searches continue from next device | ||
158 | * on the global list. | ||
159 | * | ||
160 | * NOTE: Do not use this function any more; use pci_get_device() instead, as | ||
161 | * the PCI device returned by this function can disappear at any moment in | ||
162 | * time. | ||
163 | */ | ||
164 | struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, | ||
165 | const struct pci_dev *from) | ||
166 | { | ||
167 | struct pci_dev *pdev; | ||
141 | 168 | ||
169 | pdev = pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from); | ||
170 | pci_dev_put(pdev); | ||
171 | return pdev; | ||
172 | } | ||
173 | EXPORT_SYMBOL(pci_find_device); | ||
142 | #endif /* CONFIG_PCI_LEGACY */ | 174 | #endif /* CONFIG_PCI_LEGACY */ |
143 | 175 | ||
144 | /** | 176 | /** |
@@ -204,86 +236,52 @@ struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn) | |||
204 | return NULL; | 236 | return NULL; |
205 | } | 237 | } |
206 | 238 | ||
207 | #ifdef CONFIG_PCI_LEGACY | 239 | static int match_pci_dev_by_id(struct device *dev, void *data) |
208 | /** | ||
209 | * pci_find_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id | ||
210 | * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids | ||
211 | * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids | ||
212 | * @ss_vendor: PCI subsystem vendor id to match, or %PCI_ANY_ID to match all vendor ids | ||
213 | * @ss_device: PCI subsystem device id to match, or %PCI_ANY_ID to match all device ids | ||
214 | * @from: Previous PCI device found in search, or %NULL for new search. | ||
215 | * | ||
216 | * Iterates through the list of known PCI devices. If a PCI device is | ||
217 | * found with a matching @vendor, @device, @ss_vendor and @ss_device, a | ||
218 | * pointer to its device structure is returned. Otherwise, %NULL is returned. | ||
219 | * A new search is initiated by passing %NULL as the @from argument. | ||
220 | * Otherwise if @from is not %NULL, searches continue from next device | ||
221 | * on the global list. | ||
222 | * | ||
223 | * NOTE: Do not use this function any more; use pci_get_subsys() instead, as | ||
224 | * the PCI device returned by this function can disappear at any moment in | ||
225 | * time. | ||
226 | */ | ||
227 | static struct pci_dev * pci_find_subsys(unsigned int vendor, | ||
228 | unsigned int device, | ||
229 | unsigned int ss_vendor, | ||
230 | unsigned int ss_device, | ||
231 | const struct pci_dev *from) | ||
232 | { | 240 | { |
233 | struct list_head *n; | 241 | struct pci_dev *pdev = to_pci_dev(dev); |
234 | struct pci_dev *dev; | 242 | struct pci_device_id *id = data; |
235 | |||
236 | WARN_ON(in_interrupt()); | ||
237 | 243 | ||
238 | /* | 244 | if (pci_match_one_device(id, pdev)) |
239 | * pci_find_subsys() can be called on the ide_setup() path, super-early | 245 | return 1; |
240 | * in boot. But the down_read() will enable local interrupts, which | 246 | return 0; |
241 | * can cause some machines to crash. So here we detect and flag that | ||
242 | * situation and bail out early. | ||
243 | */ | ||
244 | if (unlikely(no_pci_devices())) | ||
245 | return NULL; | ||
246 | down_read(&pci_bus_sem); | ||
247 | n = from ? from->global_list.next : pci_devices.next; | ||
248 | |||
249 | while (n && (n != &pci_devices)) { | ||
250 | dev = pci_dev_g(n); | ||
251 | if ((vendor == PCI_ANY_ID || dev->vendor == vendor) && | ||
252 | (device == PCI_ANY_ID || dev->device == device) && | ||
253 | (ss_vendor == PCI_ANY_ID || dev->subsystem_vendor == ss_vendor) && | ||
254 | (ss_device == PCI_ANY_ID || dev->subsystem_device == ss_device)) | ||
255 | goto exit; | ||
256 | n = n->next; | ||
257 | } | ||
258 | dev = NULL; | ||
259 | exit: | ||
260 | up_read(&pci_bus_sem); | ||
261 | return dev; | ||
262 | } | 247 | } |
263 | 248 | ||
264 | /** | 249 | /* |
265 | * pci_find_device - begin or continue searching for a PCI device by vendor/device id | 250 | * pci_get_dev_by_id - begin or continue searching for a PCI device by id |
266 | * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids | 251 | * @id: pointer to struct pci_device_id to match for the device |
267 | * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids | ||
268 | * @from: Previous PCI device found in search, or %NULL for new search. | 252 | * @from: Previous PCI device found in search, or %NULL for new search. |
269 | * | 253 | * |
270 | * Iterates through the list of known PCI devices. If a PCI device is found | 254 | * Iterates through the list of known PCI devices. If a PCI device is found |
271 | * with a matching @vendor and @device, a pointer to its device structure is | 255 | * with a matching id a pointer to its device structure is returned, and the |
272 | * returned. Otherwise, %NULL is returned. | 256 | * reference count to the device is incremented. Otherwise, %NULL is returned. |
273 | * A new search is initiated by passing %NULL as the @from argument. | 257 | * A new search is initiated by passing %NULL as the @from argument. Otherwise |
274 | * Otherwise if @from is not %NULL, searches continue from next device | 258 | * if @from is not %NULL, searches continue from next device on the global |
275 | * on the global list. | 259 | * list. The reference count for @from is always decremented if it is not |
276 | * | 260 | * %NULL. |
277 | * NOTE: Do not use this function any more; use pci_get_device() instead, as | 261 | * |
278 | * the PCI device returned by this function can disappear at any moment in | 262 | * This is an internal function for use by the other search functions in |
279 | * time. | 263 | * this file. |
280 | */ | 264 | */ |
281 | struct pci_dev * | 265 | static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id, |
282 | pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *from) | 266 | const struct pci_dev *from) |
283 | { | 267 | { |
284 | return pci_find_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from); | 268 | struct device *dev; |
269 | struct device *dev_start = NULL; | ||
270 | struct pci_dev *pdev = NULL; | ||
271 | |||
272 | WARN_ON(in_interrupt()); | ||
273 | if (from) { | ||
274 | /* FIXME | ||
275 | * take the cast off, when bus_find_device is made const. | ||
276 | */ | ||
277 | dev_start = (struct device *)&from->dev; | ||
278 | } | ||
279 | dev = bus_find_device(&pci_bus_type, dev_start, (void *)id, | ||
280 | match_pci_dev_by_id); | ||
281 | if (dev) | ||
282 | pdev = to_pci_dev(dev); | ||
283 | return pdev; | ||
285 | } | 284 | } |
286 | #endif /* CONFIG_PCI_LEGACY */ | ||
287 | 285 | ||
288 | /** | 286 | /** |
289 | * pci_get_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id | 287 | * pci_get_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id |
@@ -301,42 +299,34 @@ pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev * | |||
301 | * searches continue from next device on the global list. | 299 | * searches continue from next device on the global list. |
302 | * The reference count for @from is always decremented if it is not %NULL. | 300 | * The reference count for @from is always decremented if it is not %NULL. |
303 | */ | 301 | */ |
304 | struct pci_dev * | 302 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, |
305 | pci_get_subsys(unsigned int vendor, unsigned int device, | 303 | unsigned int ss_vendor, unsigned int ss_device, |
306 | unsigned int ss_vendor, unsigned int ss_device, | 304 | const struct pci_dev *from) |
307 | struct pci_dev *from) | ||
308 | { | 305 | { |
309 | struct list_head *n; | 306 | struct pci_dev *pdev; |
310 | struct pci_dev *dev; | 307 | struct pci_device_id *id; |
311 | |||
312 | WARN_ON(in_interrupt()); | ||
313 | 308 | ||
314 | /* | 309 | /* |
315 | * pci_get_subsys() can potentially be called by drivers super-early | 310 | * pci_find_subsys() can be called on the ide_setup() path, |
316 | * in boot. But the down_read() will enable local interrupts, which | 311 | * super-early in boot. But the down_read() will enable local |
317 | * can cause some machines to crash. So here we detect and flag that | 312 | * interrupts, which can cause some machines to crash. So here we |
318 | * situation and bail out early. | 313 | * detect and flag that situation and bail out early. |
319 | */ | 314 | */ |
320 | if (unlikely(no_pci_devices())) | 315 | if (unlikely(no_pci_devices())) |
321 | return NULL; | 316 | return NULL; |
322 | down_read(&pci_bus_sem); | 317 | |
323 | n = from ? from->global_list.next : pci_devices.next; | 318 | id = kzalloc(sizeof(*id), GFP_KERNEL); |
324 | 319 | if (!id) | |
325 | while (n && (n != &pci_devices)) { | 320 | return NULL; |
326 | dev = pci_dev_g(n); | 321 | id->vendor = vendor; |
327 | if ((vendor == PCI_ANY_ID || dev->vendor == vendor) && | 322 | id->device = device; |
328 | (device == PCI_ANY_ID || dev->device == device) && | 323 | id->subvendor = ss_vendor; |
329 | (ss_vendor == PCI_ANY_ID || dev->subsystem_vendor == ss_vendor) && | 324 | id->subdevice = ss_device; |
330 | (ss_device == PCI_ANY_ID || dev->subsystem_device == ss_device)) | 325 | |
331 | goto exit; | 326 | pdev = pci_get_dev_by_id(id, from); |
332 | n = n->next; | 327 | kfree(id); |
333 | } | 328 | |
334 | dev = NULL; | 329 | return pdev; |
335 | exit: | ||
336 | dev = pci_dev_get(dev); | ||
337 | up_read(&pci_bus_sem); | ||
338 | pci_dev_put(from); | ||
339 | return dev; | ||
340 | } | 330 | } |
341 | 331 | ||
342 | /** | 332 | /** |
@@ -360,46 +350,6 @@ pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from) | |||
360 | } | 350 | } |
361 | 351 | ||
362 | /** | 352 | /** |
363 | * pci_get_device_reverse - begin or continue searching for a PCI device by vendor/device id | ||
364 | * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids | ||
365 | * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids | ||
366 | * @from: Previous PCI device found in search, or %NULL for new search. | ||
367 | * | ||
368 | * Iterates through the list of known PCI devices in the reverse order of | ||
369 | * pci_get_device. | ||
370 | * If a PCI device is found with a matching @vendor and @device, the reference | ||
371 | * count to the device is incremented and a pointer to its device structure | ||
372 | * is returned Otherwise, %NULL is returned. A new search is initiated by | ||
373 | * passing %NULL as the @from argument. Otherwise if @from is not %NULL, | ||
374 | * searches continue from next device on the global list. The reference | ||
375 | * count for @from is always decremented if it is not %NULL. | ||
376 | */ | ||
377 | struct pci_dev * | ||
378 | pci_get_device_reverse(unsigned int vendor, unsigned int device, struct pci_dev *from) | ||
379 | { | ||
380 | struct list_head *n; | ||
381 | struct pci_dev *dev; | ||
382 | |||
383 | WARN_ON(in_interrupt()); | ||
384 | down_read(&pci_bus_sem); | ||
385 | n = from ? from->global_list.prev : pci_devices.prev; | ||
386 | |||
387 | while (n && (n != &pci_devices)) { | ||
388 | dev = pci_dev_g(n); | ||
389 | if ((vendor == PCI_ANY_ID || dev->vendor == vendor) && | ||
390 | (device == PCI_ANY_ID || dev->device == device)) | ||
391 | goto exit; | ||
392 | n = n->prev; | ||
393 | } | ||
394 | dev = NULL; | ||
395 | exit: | ||
396 | dev = pci_dev_get(dev); | ||
397 | up_read(&pci_bus_sem); | ||
398 | pci_dev_put(from); | ||
399 | return dev; | ||
400 | } | ||
401 | |||
402 | /** | ||
403 | * pci_get_class - begin or continue searching for a PCI device by class | 353 | * pci_get_class - begin or continue searching for a PCI device by class |
404 | * @class: search for a PCI device with this class designation | 354 | * @class: search for a PCI device with this class designation |
405 | * @from: Previous PCI device found in search, or %NULL for new search. | 355 | * @from: Previous PCI device found in search, or %NULL for new search. |
@@ -415,46 +365,21 @@ exit: | |||
415 | */ | 365 | */ |
416 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from) | 366 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from) |
417 | { | 367 | { |
418 | struct list_head *n; | ||
419 | struct pci_dev *dev; | 368 | struct pci_dev *dev; |
369 | struct pci_device_id *id; | ||
420 | 370 | ||
421 | WARN_ON(in_interrupt()); | 371 | id = kzalloc(sizeof(*id), GFP_KERNEL); |
422 | down_read(&pci_bus_sem); | 372 | if (!id) |
423 | n = from ? from->global_list.next : pci_devices.next; | 373 | return NULL; |
374 | id->vendor = id->device = id->subvendor = id->subdevice = PCI_ANY_ID; | ||
375 | id->class_mask = PCI_ANY_ID; | ||
376 | id->class = class; | ||
424 | 377 | ||
425 | while (n && (n != &pci_devices)) { | 378 | dev = pci_get_dev_by_id(id, from); |
426 | dev = pci_dev_g(n); | 379 | kfree(id); |
427 | if (dev->class == class) | ||
428 | goto exit; | ||
429 | n = n->next; | ||
430 | } | ||
431 | dev = NULL; | ||
432 | exit: | ||
433 | dev = pci_dev_get(dev); | ||
434 | up_read(&pci_bus_sem); | ||
435 | pci_dev_put(from); | ||
436 | return dev; | 380 | return dev; |
437 | } | 381 | } |
438 | 382 | ||
439 | const struct pci_device_id *pci_find_present(const struct pci_device_id *ids) | ||
440 | { | ||
441 | struct pci_dev *dev; | ||
442 | const struct pci_device_id *found = NULL; | ||
443 | |||
444 | WARN_ON(in_interrupt()); | ||
445 | down_read(&pci_bus_sem); | ||
446 | while (ids->vendor || ids->subvendor || ids->class_mask) { | ||
447 | list_for_each_entry(dev, &pci_devices, global_list) { | ||
448 | if ((found = pci_match_one_device(ids, dev)) != NULL) | ||
449 | goto exit; | ||
450 | } | ||
451 | ids++; | ||
452 | } | ||
453 | exit: | ||
454 | up_read(&pci_bus_sem); | ||
455 | return found; | ||
456 | } | ||
457 | |||
458 | /** | 383 | /** |
459 | * pci_dev_present - Returns 1 if device matching the device list is present, 0 if not. | 384 | * pci_dev_present - Returns 1 if device matching the device list is present, 0 if not. |
460 | * @ids: A pointer to a null terminated list of struct pci_device_id structures | 385 | * @ids: A pointer to a null terminated list of struct pci_device_id structures |
@@ -468,23 +393,27 @@ exit: | |||
468 | */ | 393 | */ |
469 | int pci_dev_present(const struct pci_device_id *ids) | 394 | int pci_dev_present(const struct pci_device_id *ids) |
470 | { | 395 | { |
471 | return pci_find_present(ids) == NULL ? 0 : 1; | 396 | struct pci_dev *found = NULL; |
472 | } | ||
473 | 397 | ||
398 | WARN_ON(in_interrupt()); | ||
399 | while (ids->vendor || ids->subvendor || ids->class_mask) { | ||
400 | found = pci_get_dev_by_id(ids, NULL); | ||
401 | if (found) | ||
402 | goto exit; | ||
403 | ids++; | ||
404 | } | ||
405 | exit: | ||
406 | if (found) | ||
407 | return 1; | ||
408 | return 0; | ||
409 | } | ||
474 | EXPORT_SYMBOL(pci_dev_present); | 410 | EXPORT_SYMBOL(pci_dev_present); |
475 | EXPORT_SYMBOL(pci_find_present); | ||
476 | |||
477 | #ifdef CONFIG_PCI_LEGACY | ||
478 | EXPORT_SYMBOL(pci_find_device); | ||
479 | EXPORT_SYMBOL(pci_find_slot); | ||
480 | #endif /* CONFIG_PCI_LEGACY */ | ||
481 | 411 | ||
482 | /* For boot time work */ | 412 | /* For boot time work */ |
483 | EXPORT_SYMBOL(pci_find_bus); | 413 | EXPORT_SYMBOL(pci_find_bus); |
484 | EXPORT_SYMBOL(pci_find_next_bus); | 414 | EXPORT_SYMBOL(pci_find_next_bus); |
485 | /* For everyone */ | 415 | /* For everyone */ |
486 | EXPORT_SYMBOL(pci_get_device); | 416 | EXPORT_SYMBOL(pci_get_device); |
487 | EXPORT_SYMBOL(pci_get_device_reverse); | ||
488 | EXPORT_SYMBOL(pci_get_subsys); | 417 | EXPORT_SYMBOL(pci_get_subsys); |
489 | EXPORT_SYMBOL(pci_get_slot); | 418 | EXPORT_SYMBOL(pci_get_slot); |
490 | EXPORT_SYMBOL(pci_get_bus_and_slot); | 419 | EXPORT_SYMBOL(pci_get_bus_and_slot); |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index f7cb8e0758b4..f9b7bdd27829 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -65,6 +65,7 @@ static void pbus_assign_resources_sorted(struct pci_bus *bus) | |||
65 | res = list->res; | 65 | res = list->res; |
66 | idx = res - &list->dev->resource[0]; | 66 | idx = res - &list->dev->resource[0]; |
67 | if (pci_assign_resource(list->dev, idx)) { | 67 | if (pci_assign_resource(list->dev, idx)) { |
68 | /* FIXME: get rid of this */ | ||
68 | res->start = 0; | 69 | res->start = 0; |
69 | res->end = 0; | 70 | res->end = 0; |
70 | res->flags = 0; | 71 | res->flags = 0; |
@@ -144,8 +145,7 @@ EXPORT_SYMBOL(pci_setup_cardbus); | |||
144 | config space writes, so it's quite possible that an I/O window of | 145 | config space writes, so it's quite possible that an I/O window of |
145 | the bridge will have some undesirable address (e.g. 0) after the | 146 | the bridge will have some undesirable address (e.g. 0) after the |
146 | first write. Ditto 64-bit prefetchable MMIO. */ | 147 | first write. Ditto 64-bit prefetchable MMIO. */ |
147 | static void __devinit | 148 | static void pci_setup_bridge(struct pci_bus *bus) |
148 | pci_setup_bridge(struct pci_bus *bus) | ||
149 | { | 149 | { |
150 | struct pci_dev *bridge = bus->self; | 150 | struct pci_dev *bridge = bus->self; |
151 | struct pci_bus_region region; | 151 | struct pci_bus_region region; |
@@ -327,6 +327,7 @@ static void pbus_size_io(struct pci_bus *bus) | |||
327 | /* Alignment of the IO window is always 4K */ | 327 | /* Alignment of the IO window is always 4K */ |
328 | b_res->start = 4096; | 328 | b_res->start = 4096; |
329 | b_res->end = b_res->start + size - 1; | 329 | b_res->end = b_res->start + size - 1; |
330 | b_res->flags |= IORESOURCE_STARTALIGN; | ||
330 | } | 331 | } |
331 | 332 | ||
332 | /* Calculate the size of the bus and minimal alignment which | 333 | /* Calculate the size of the bus and minimal alignment which |
@@ -401,11 +402,11 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long | |||
401 | } | 402 | } |
402 | b_res->start = min_align; | 403 | b_res->start = min_align; |
403 | b_res->end = size + min_align - 1; | 404 | b_res->end = size + min_align - 1; |
405 | b_res->flags |= IORESOURCE_STARTALIGN; | ||
404 | return 1; | 406 | return 1; |
405 | } | 407 | } |
406 | 408 | ||
407 | static void __devinit | 409 | static void pci_bus_size_cardbus(struct pci_bus *bus) |
408 | pci_bus_size_cardbus(struct pci_bus *bus) | ||
409 | { | 410 | { |
410 | struct pci_dev *bridge = bus->self; | 411 | struct pci_dev *bridge = bus->self; |
411 | struct resource *b_res = &bridge->resource[PCI_BRIDGE_RESOURCES]; | 412 | struct resource *b_res = &bridge->resource[PCI_BRIDGE_RESOURCES]; |
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index 4be7ccf7e3ae..7d35cdf4579f 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c | |||
@@ -137,10 +137,16 @@ int pci_assign_resource(struct pci_dev *dev, int resno) | |||
137 | 137 | ||
138 | size = res->end - res->start + 1; | 138 | size = res->end - res->start + 1; |
139 | min = (res->flags & IORESOURCE_IO) ? PCIBIOS_MIN_IO : PCIBIOS_MIN_MEM; | 139 | min = (res->flags & IORESOURCE_IO) ? PCIBIOS_MIN_IO : PCIBIOS_MIN_MEM; |
140 | /* The bridge resources are special, as their | 140 | |
141 | size != alignment. Sizing routines return | 141 | align = resource_alignment(res); |
142 | required alignment in the "start" field. */ | 142 | if (!align) { |
143 | align = (resno < PCI_BRIDGE_RESOURCES) ? size : res->start; | 143 | printk(KERN_ERR "PCI: Cannot allocate resource (bogus " |
144 | "alignment) %d [%llx:%llx] (flags %lx) of %s\n", | ||
145 | resno, (unsigned long long)res->start, | ||
146 | (unsigned long long)res->end, res->flags, | ||
147 | pci_name(dev)); | ||
148 | return -EINVAL; | ||
149 | } | ||
144 | 150 | ||
145 | /* First, try exact prefetching match.. */ | 151 | /* First, try exact prefetching match.. */ |
146 | ret = pci_bus_alloc_resource(bus, res, size, align, min, | 152 | ret = pci_bus_alloc_resource(bus, res, size, align, min, |
@@ -164,14 +170,16 @@ int pci_assign_resource(struct pci_dev *dev, int resno) | |||
164 | res->flags & IORESOURCE_IO ? "I/O" : "mem", | 170 | res->flags & IORESOURCE_IO ? "I/O" : "mem", |
165 | resno, (unsigned long long)size, | 171 | resno, (unsigned long long)size, |
166 | (unsigned long long)res->start, pci_name(dev)); | 172 | (unsigned long long)res->start, pci_name(dev)); |
167 | } else if (resno < PCI_BRIDGE_RESOURCES) { | 173 | } else { |
168 | pci_update_resource(dev, res, resno); | 174 | res->flags &= ~IORESOURCE_STARTALIGN; |
175 | if (resno < PCI_BRIDGE_RESOURCES) | ||
176 | pci_update_resource(dev, res, resno); | ||
169 | } | 177 | } |
170 | 178 | ||
171 | return ret; | 179 | return ret; |
172 | } | 180 | } |
173 | 181 | ||
174 | #ifdef CONFIG_EMBEDDED | 182 | #if 0 |
175 | int pci_assign_resource_fixed(struct pci_dev *dev, int resno) | 183 | int pci_assign_resource_fixed(struct pci_dev *dev, int resno) |
176 | { | 184 | { |
177 | struct pci_bus *bus = dev->bus; | 185 | struct pci_bus *bus = dev->bus; |
@@ -226,29 +234,25 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) | |||
226 | if (r->flags & IORESOURCE_PCI_FIXED) | 234 | if (r->flags & IORESOURCE_PCI_FIXED) |
227 | continue; | 235 | continue; |
228 | 236 | ||
229 | r_align = r->end - r->start; | ||
230 | |||
231 | if (!(r->flags) || r->parent) | 237 | if (!(r->flags) || r->parent) |
232 | continue; | 238 | continue; |
239 | |||
240 | r_align = resource_alignment(r); | ||
233 | if (!r_align) { | 241 | if (!r_align) { |
234 | printk(KERN_WARNING "PCI: Ignore bogus resource %d " | 242 | printk(KERN_WARNING "PCI: bogus alignment of resource " |
235 | "[%llx:%llx] of %s\n", | 243 | "%d [%llx:%llx] (flags %lx) of %s\n", |
236 | i, (unsigned long long)r->start, | 244 | i, (unsigned long long)r->start, |
237 | (unsigned long long)r->end, pci_name(dev)); | 245 | (unsigned long long)r->end, r->flags, |
246 | pci_name(dev)); | ||
238 | continue; | 247 | continue; |
239 | } | 248 | } |
240 | r_align = (i < PCI_BRIDGE_RESOURCES) ? r_align + 1 : r->start; | ||
241 | for (list = head; ; list = list->next) { | 249 | for (list = head; ; list = list->next) { |
242 | resource_size_t align = 0; | 250 | resource_size_t align = 0; |
243 | struct resource_list *ln = list->next; | 251 | struct resource_list *ln = list->next; |
244 | int idx; | ||
245 | 252 | ||
246 | if (ln) { | 253 | if (ln) |
247 | idx = ln->res - &ln->dev->resource[0]; | 254 | align = resource_alignment(ln->res); |
248 | align = (idx < PCI_BRIDGE_RESOURCES) ? | 255 | |
249 | ln->res->end - ln->res->start + 1 : | ||
250 | ln->res->start; | ||
251 | } | ||
252 | if (r_align > align) { | 256 | if (r_align > align) { |
253 | tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); | 257 | tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); |
254 | if (!tmp) | 258 | if (!tmp) |
@@ -263,3 +267,46 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) | |||
263 | } | 267 | } |
264 | } | 268 | } |
265 | } | 269 | } |
270 | |||
271 | int pci_enable_resources(struct pci_dev *dev, int mask) | ||
272 | { | ||
273 | u16 cmd, old_cmd; | ||
274 | int i; | ||
275 | struct resource *r; | ||
276 | |||
277 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | ||
278 | old_cmd = cmd; | ||
279 | |||
280 | for (i = 0; i < PCI_NUM_RESOURCES; i++) { | ||
281 | if (!(mask & (1 << i))) | ||
282 | continue; | ||
283 | |||
284 | r = &dev->resource[i]; | ||
285 | |||
286 | if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM))) | ||
287 | continue; | ||
288 | if ((i == PCI_ROM_RESOURCE) && | ||
289 | (!(r->flags & IORESOURCE_ROM_ENABLE))) | ||
290 | continue; | ||
291 | |||
292 | if (!r->parent) { | ||
293 | dev_err(&dev->dev, "device not available because of " | ||
294 | "BAR %d [%llx:%llx] collisions\n", i, | ||
295 | (unsigned long long) r->start, | ||
296 | (unsigned long long) r->end); | ||
297 | return -EINVAL; | ||
298 | } | ||
299 | |||
300 | if (r->flags & IORESOURCE_IO) | ||
301 | cmd |= PCI_COMMAND_IO; | ||
302 | if (r->flags & IORESOURCE_MEM) | ||
303 | cmd |= PCI_COMMAND_MEMORY; | ||
304 | } | ||
305 | |||
306 | if (cmd != old_cmd) { | ||
307 | dev_info(&dev->dev, "enabling device (%04x -> %04x)\n", | ||
308 | old_cmd, cmd); | ||
309 | pci_write_config_word(dev, PCI_COMMAND, cmd); | ||
310 | } | ||
311 | return 0; | ||
312 | } | ||
diff --git a/include/asm-sh/mpc1211/pci.h b/include/asm-sh/mpc1211/pci.h index 5d3712c3a701..d9162c5ed76a 100644 --- a/include/asm-sh/mpc1211/pci.h +++ b/include/asm-sh/mpc1211/pci.h | |||
@@ -24,8 +24,6 @@ | |||
24 | #define PCI_PROBE_BIOS 1 | 24 | #define PCI_PROBE_BIOS 1 |
25 | #define PCI_PROBE_CONF1 2 | 25 | #define PCI_PROBE_CONF1 2 |
26 | #define PCI_PROBE_CONF2 4 | 26 | #define PCI_PROBE_CONF2 4 |
27 | #define PCI_NO_SORT 0x100 | ||
28 | #define PCI_BIOS_SORT 0x200 | ||
29 | #define PCI_NO_CHECKS 0x400 | 27 | #define PCI_NO_CHECKS 0x400 |
30 | #define PCI_ASSIGN_ROMS 0x1000 | 28 | #define PCI_ASSIGN_ROMS 0x1000 |
31 | #define PCI_BIOS_IRQ_SCAN 0x2000 | 29 | #define PCI_BIOS_IRQ_SCAN 0x2000 |
diff --git a/include/linux/aer.h b/include/linux/aer.h index bcf236d825e8..f2518141de88 100644 --- a/include/linux/aer.h +++ b/include/linux/aer.h | |||
@@ -13,7 +13,6 @@ extern int pci_enable_pcie_error_reporting(struct pci_dev *dev); | |||
13 | extern int pci_find_aer_capability(struct pci_dev *dev); | 13 | extern int pci_find_aer_capability(struct pci_dev *dev); |
14 | extern int pci_disable_pcie_error_reporting(struct pci_dev *dev); | 14 | extern int pci_disable_pcie_error_reporting(struct pci_dev *dev); |
15 | extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); | 15 | extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); |
16 | extern int pci_cleanup_aer_correct_error_status(struct pci_dev *dev); | ||
17 | #else | 16 | #else |
18 | static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev) | 17 | static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev) |
19 | { | 18 | { |
@@ -31,10 +30,6 @@ static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) | |||
31 | { | 30 | { |
32 | return -EINVAL; | 31 | return -EINVAL; |
33 | } | 32 | } |
34 | static inline int pci_cleanup_aer_correct_error_status(struct pci_dev *dev) | ||
35 | { | ||
36 | return -EINVAL; | ||
37 | } | ||
38 | #endif | 33 | #endif |
39 | 34 | ||
40 | #endif //_AER_H_ | 35 | #endif //_AER_H_ |
diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 605d237364d2..d5d40a9f7929 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h | |||
@@ -44,7 +44,9 @@ struct resource_list { | |||
44 | #define IORESOURCE_CACHEABLE 0x00004000 | 44 | #define IORESOURCE_CACHEABLE 0x00004000 |
45 | #define IORESOURCE_RANGELENGTH 0x00008000 | 45 | #define IORESOURCE_RANGELENGTH 0x00008000 |
46 | #define IORESOURCE_SHADOWABLE 0x00010000 | 46 | #define IORESOURCE_SHADOWABLE 0x00010000 |
47 | #define IORESOURCE_BUS_HAS_VGA 0x00080000 | 47 | |
48 | #define IORESOURCE_SIZEALIGN 0x00020000 /* size indicates alignment */ | ||
49 | #define IORESOURCE_STARTALIGN 0x00040000 /* start field is alignment */ | ||
48 | 50 | ||
49 | #define IORESOURCE_DISABLED 0x10000000 | 51 | #define IORESOURCE_DISABLED 0x10000000 |
50 | #define IORESOURCE_UNSET 0x20000000 | 52 | #define IORESOURCE_UNSET 0x20000000 |
@@ -110,6 +112,7 @@ extern int allocate_resource(struct resource *root, struct resource *new, | |||
110 | void *alignf_data); | 112 | void *alignf_data); |
111 | int adjust_resource(struct resource *res, resource_size_t start, | 113 | int adjust_resource(struct resource *res, resource_size_t start, |
112 | resource_size_t size); | 114 | resource_size_t size); |
115 | resource_size_t resource_alignment(struct resource *res); | ||
113 | 116 | ||
114 | /* Convenience shorthand with allocation */ | 117 | /* Convenience shorthand with allocation */ |
115 | #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) | 118 | #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) |
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h new file mode 100644 index 000000000000..a1a1e618e996 --- /dev/null +++ b/include/linux/pci-aspm.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * aspm.h | ||
3 | * | ||
4 | * PCI Express ASPM defines and function prototypes | ||
5 | * | ||
6 | * Copyright (C) 2007 Intel Corp. | ||
7 | * Zhang Yanmin (yanmin.zhang@intel.com) | ||
8 | * Shaohua Li (shaohua.li@intel.com) | ||
9 | * | ||
10 | * For more information, please consult the following manuals (look at | ||
11 | * http://www.pcisig.com/ for how to get them): | ||
12 | * | ||
13 | * PCI Express Specification | ||
14 | */ | ||
15 | |||
16 | #ifndef LINUX_ASPM_H | ||
17 | #define LINUX_ASPM_H | ||
18 | |||
19 | #include <linux/pci.h> | ||
20 | |||
21 | #define PCIE_LINK_STATE_L0S 1 | ||
22 | #define PCIE_LINK_STATE_L1 2 | ||
23 | #define PCIE_LINK_STATE_CLKPM 4 | ||
24 | |||
25 | #ifdef CONFIG_PCIEASPM | ||
26 | extern void pcie_aspm_init_link_state(struct pci_dev *pdev); | ||
27 | extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); | ||
28 | extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); | ||
29 | extern void pci_disable_link_state(struct pci_dev *pdev, int state); | ||
30 | #else | ||
31 | static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) | ||
32 | { | ||
33 | } | ||
34 | static inline void pcie_aspm_exit_link_state(struct pci_dev *pdev) | ||
35 | { | ||
36 | } | ||
37 | static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) | ||
38 | { | ||
39 | } | ||
40 | static inline void pci_disable_link_state(struct pci_dev *pdev, int state) | ||
41 | { | ||
42 | } | ||
43 | #endif | ||
44 | |||
45 | #ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */ | ||
46 | extern void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev); | ||
47 | extern void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev); | ||
48 | #else | ||
49 | static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) | ||
50 | { | ||
51 | } | ||
52 | static inline void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev) | ||
53 | { | ||
54 | } | ||
55 | #endif | ||
56 | #endif /* LINUX_ASPM_H */ | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index ea760e519c46..292491324b01 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -20,6 +20,8 @@ | |||
20 | /* Include the pci register defines */ | 20 | /* Include the pci register defines */ |
21 | #include <linux/pci_regs.h> | 21 | #include <linux/pci_regs.h> |
22 | 22 | ||
23 | struct pci_vpd; | ||
24 | |||
23 | /* | 25 | /* |
24 | * The PCI interface treats multi-function devices as independent | 26 | * The PCI interface treats multi-function devices as independent |
25 | * devices. The slot/function address of each device is encoded | 27 | * devices. The slot/function address of each device is encoded |
@@ -128,11 +130,11 @@ struct pci_cap_saved_state { | |||
128 | u32 data[0]; | 130 | u32 data[0]; |
129 | }; | 131 | }; |
130 | 132 | ||
133 | struct pcie_link_state; | ||
131 | /* | 134 | /* |
132 | * The pci_dev structure is used to describe PCI devices. | 135 | * The pci_dev structure is used to describe PCI devices. |
133 | */ | 136 | */ |
134 | struct pci_dev { | 137 | struct pci_dev { |
135 | struct list_head global_list; /* node in list of all PCI devices */ | ||
136 | struct list_head bus_list; /* node in per-bus list */ | 138 | struct list_head bus_list; /* node in per-bus list */ |
137 | struct pci_bus *bus; /* bus this device is on */ | 139 | struct pci_bus *bus; /* bus this device is on */ |
138 | struct pci_bus *subordinate; /* bus this device bridges to */ | 140 | struct pci_bus *subordinate; /* bus this device bridges to */ |
@@ -165,6 +167,10 @@ struct pci_dev { | |||
165 | this is D0-D3, D0 being fully functional, | 167 | this is D0-D3, D0 being fully functional, |
166 | and D3 being off. */ | 168 | and D3 being off. */ |
167 | 169 | ||
170 | #ifdef CONFIG_PCIEASPM | ||
171 | struct pcie_link_state *link_state; /* ASPM link state. */ | ||
172 | #endif | ||
173 | |||
168 | pci_channel_state_t error_state; /* current connectivity state */ | 174 | pci_channel_state_t error_state; /* current connectivity state */ |
169 | struct device dev; /* Generic device interface */ | 175 | struct device dev; /* Generic device interface */ |
170 | 176 | ||
@@ -181,6 +187,7 @@ struct pci_dev { | |||
181 | unsigned int transparent:1; /* Transparent PCI bridge */ | 187 | unsigned int transparent:1; /* Transparent PCI bridge */ |
182 | unsigned int multifunction:1;/* Part of multi-function device */ | 188 | unsigned int multifunction:1;/* Part of multi-function device */ |
183 | /* keep track of device state */ | 189 | /* keep track of device state */ |
190 | unsigned int is_added:1; | ||
184 | unsigned int is_busmaster:1; /* device is busmaster */ | 191 | unsigned int is_busmaster:1; /* device is busmaster */ |
185 | unsigned int no_msi:1; /* device may not use msi */ | 192 | unsigned int no_msi:1; /* device may not use msi */ |
186 | unsigned int no_d1d2:1; /* only allow d0 or d3 */ | 193 | unsigned int no_d1d2:1; /* only allow d0 or d3 */ |
@@ -201,11 +208,11 @@ struct pci_dev { | |||
201 | #ifdef CONFIG_PCI_MSI | 208 | #ifdef CONFIG_PCI_MSI |
202 | struct list_head msi_list; | 209 | struct list_head msi_list; |
203 | #endif | 210 | #endif |
211 | struct pci_vpd *vpd; | ||
204 | }; | 212 | }; |
205 | 213 | ||
206 | extern struct pci_dev *alloc_pci_dev(void); | 214 | extern struct pci_dev *alloc_pci_dev(void); |
207 | 215 | ||
208 | #define pci_dev_g(n) list_entry(n, struct pci_dev, global_list) | ||
209 | #define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list) | 216 | #define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list) |
210 | #define to_pci_dev(n) container_of(n, struct pci_dev, dev) | 217 | #define to_pci_dev(n) container_of(n, struct pci_dev, dev) |
211 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) | 218 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) |
@@ -449,7 +456,6 @@ extern struct bus_type pci_bus_type; | |||
449 | /* Do NOT directly access these two variables, unless you are arch specific pci | 456 | /* Do NOT directly access these two variables, unless you are arch specific pci |
450 | * code, or pci core code. */ | 457 | * code, or pci core code. */ |
451 | extern struct list_head pci_root_buses; /* list of all known PCI buses */ | 458 | extern struct list_head pci_root_buses; /* list of all known PCI buses */ |
452 | extern struct list_head pci_devices; /* list of all devices */ | ||
453 | /* Some device drivers need know if pci is initiated */ | 459 | /* Some device drivers need know if pci is initiated */ |
454 | extern int no_pci_devices(void); | 460 | extern int no_pci_devices(void); |
455 | 461 | ||
@@ -517,17 +523,13 @@ struct pci_bus *pci_find_next_bus(const struct pci_bus *from); | |||
517 | 523 | ||
518 | struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, | 524 | struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, |
519 | struct pci_dev *from); | 525 | struct pci_dev *from); |
520 | struct pci_dev *pci_get_device_reverse(unsigned int vendor, unsigned int device, | ||
521 | struct pci_dev *from); | ||
522 | |||
523 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, | 526 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, |
524 | unsigned int ss_vendor, unsigned int ss_device, | 527 | unsigned int ss_vendor, unsigned int ss_device, |
525 | struct pci_dev *from); | 528 | const struct pci_dev *from); |
526 | struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); | 529 | struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); |
527 | struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); | 530 | struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); |
528 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); | 531 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); |
529 | int pci_dev_present(const struct pci_device_id *ids); | 532 | int pci_dev_present(const struct pci_device_id *ids); |
530 | const struct pci_device_id *pci_find_present(const struct pci_device_id *ids); | ||
531 | 533 | ||
532 | int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn, | 534 | int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn, |
533 | int where, u8 *val); | 535 | int where, u8 *val); |
@@ -601,7 +603,6 @@ int pcie_get_readrq(struct pci_dev *dev); | |||
601 | int pcie_set_readrq(struct pci_dev *dev, int rq); | 603 | int pcie_set_readrq(struct pci_dev *dev, int rq); |
602 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); | 604 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); |
603 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); | 605 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
604 | int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i); | ||
605 | int pci_select_bars(struct pci_dev *dev, unsigned long flags); | 606 | int pci_select_bars(struct pci_dev *dev, unsigned long flags); |
606 | 607 | ||
607 | /* ROM control related routines */ | 608 | /* ROM control related routines */ |
@@ -626,6 +627,7 @@ int pci_claim_resource(struct pci_dev *, int); | |||
626 | void pci_assign_unassigned_resources(void); | 627 | void pci_assign_unassigned_resources(void); |
627 | void pdev_enable_device(struct pci_dev *); | 628 | void pdev_enable_device(struct pci_dev *); |
628 | void pdev_sort_resources(struct pci_dev *, struct resource_list *); | 629 | void pdev_sort_resources(struct pci_dev *, struct resource_list *); |
630 | int pci_enable_resources(struct pci_dev *, int mask); | ||
629 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), | 631 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), |
630 | int (*)(struct pci_dev *, u8, u8)); | 632 | int (*)(struct pci_dev *, u8, u8)); |
631 | #define HAVE_PCI_REQ_REGIONS 2 | 633 | #define HAVE_PCI_REQ_REGIONS 2 |
@@ -793,18 +795,11 @@ static inline struct pci_dev *pci_get_device(unsigned int vendor, | |||
793 | return NULL; | 795 | return NULL; |
794 | } | 796 | } |
795 | 797 | ||
796 | static inline struct pci_dev *pci_get_device_reverse(unsigned int vendor, | ||
797 | unsigned int device, | ||
798 | struct pci_dev *from) | ||
799 | { | ||
800 | return NULL; | ||
801 | } | ||
802 | |||
803 | static inline struct pci_dev *pci_get_subsys(unsigned int vendor, | 798 | static inline struct pci_dev *pci_get_subsys(unsigned int vendor, |
804 | unsigned int device, | 799 | unsigned int device, |
805 | unsigned int ss_vendor, | 800 | unsigned int ss_vendor, |
806 | unsigned int ss_device, | 801 | unsigned int ss_device, |
807 | struct pci_dev *from) | 802 | const struct pci_dev *from) |
808 | { | 803 | { |
809 | return NULL; | 804 | return NULL; |
810 | } | 805 | } |
@@ -817,7 +812,6 @@ static inline struct pci_dev *pci_get_class(unsigned int class, | |||
817 | 812 | ||
818 | #define pci_dev_present(ids) (0) | 813 | #define pci_dev_present(ids) (0) |
819 | #define no_pci_devices() (1) | 814 | #define no_pci_devices() (1) |
820 | #define pci_find_present(ids) (NULL) | ||
821 | #define pci_dev_put(dev) do { } while (0) | 815 | #define pci_dev_put(dev) do { } while (0) |
822 | 816 | ||
823 | static inline void pci_set_master(struct pci_dev *dev) | 817 | static inline void pci_set_master(struct pci_dev *dev) |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index c1914a8b94a9..c0c1223c9194 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -395,9 +395,17 @@ | |||
395 | #define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ | 395 | #define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ |
396 | #define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ | 396 | #define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ |
397 | #define PCI_EXP_LNKCAP 12 /* Link Capabilities */ | 397 | #define PCI_EXP_LNKCAP 12 /* Link Capabilities */ |
398 | #define PCI_EXP_LNKCAP_ASPMS 0xc00 /* ASPM Support */ | ||
399 | #define PCI_EXP_LNKCAP_L0SEL 0x7000 /* L0s Exit Latency */ | ||
400 | #define PCI_EXP_LNKCAP_L1EL 0x38000 /* L1 Exit Latency */ | ||
401 | #define PCI_EXP_LNKCAP_CLKPM 0x40000 /* L1 Clock Power Management */ | ||
398 | #define PCI_EXP_LNKCTL 16 /* Link Control */ | 402 | #define PCI_EXP_LNKCTL 16 /* Link Control */ |
403 | #define PCI_EXP_LNKCTL_RL 0x20 /* Retrain Link */ | ||
404 | #define PCI_EXP_LNKCTL_CCC 0x40 /* Common Clock COnfiguration */ | ||
399 | #define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ | 405 | #define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ |
400 | #define PCI_EXP_LNKSTA 18 /* Link Status */ | 406 | #define PCI_EXP_LNKSTA 18 /* Link Status */ |
407 | #define PCI_EXP_LNKSTA_LT 0x800 /* Link Training */ | ||
408 | #define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */ | ||
401 | #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ | 409 | #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ |
402 | #define PCI_EXP_SLTCTL 24 /* Slot Control */ | 410 | #define PCI_EXP_SLTCTL 24 /* Slot Control */ |
403 | #define PCI_EXP_SLTSTA 26 /* Slot Status */ | 411 | #define PCI_EXP_SLTSTA 26 /* Slot Status */ |
diff --git a/kernel/resource.c b/kernel/resource.c index 82aea814d409..cee12cc47cab 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
@@ -486,6 +486,24 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t | |||
486 | 486 | ||
487 | EXPORT_SYMBOL(adjust_resource); | 487 | EXPORT_SYMBOL(adjust_resource); |
488 | 488 | ||
489 | /** | ||
490 | * resource_alignment - calculate resource's alignment | ||
491 | * @res: resource pointer | ||
492 | * | ||
493 | * Returns alignment on success, 0 (invalid alignment) on failure. | ||
494 | */ | ||
495 | resource_size_t resource_alignment(struct resource *res) | ||
496 | { | ||
497 | switch (res->flags & (IORESOURCE_SIZEALIGN | IORESOURCE_STARTALIGN)) { | ||
498 | case IORESOURCE_SIZEALIGN: | ||
499 | return res->end - res->start + 1; | ||
500 | case IORESOURCE_STARTALIGN: | ||
501 | return res->start; | ||
502 | default: | ||
503 | return 0; | ||
504 | } | ||
505 | } | ||
506 | |||
489 | /* | 507 | /* |
490 | * This is compatibility stuff for IO resources. | 508 | * This is compatibility stuff for IO resources. |
491 | * | 509 | * |