diff options
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 56 | ||||
-rw-r--r-- | drivers/pci/hotplug/sgi_hotplug.c | 15 | ||||
-rw-r--r-- | drivers/pci/msi.c | 26 | ||||
-rw-r--r-- | drivers/pci/pci-acpi.c | 56 | ||||
-rw-r--r-- | drivers/pci/pci.c | 26 | ||||
-rw-r--r-- | drivers/pci/pci.h | 5 | ||||
-rw-r--r-- | drivers/pci/pcie/aer/aerdrv_errprint.c | 63 | ||||
-rw-r--r-- | drivers/pci/probe.c | 1 | ||||
-rw-r--r-- | drivers/pci/remove.c | 2 |
9 files changed, 148 insertions, 102 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 3d6d4fd1e3c5..a951c22921d1 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -734,34 +734,24 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus) | |||
734 | */ | 734 | */ |
735 | static int acpiphp_bus_add(struct acpiphp_func *func) | 735 | static int acpiphp_bus_add(struct acpiphp_func *func) |
736 | { | 736 | { |
737 | acpi_handle phandle; | 737 | struct acpi_device *device; |
738 | struct acpi_device *device, *pdevice; | ||
739 | int ret_val; | 738 | int ret_val; |
740 | 739 | ||
741 | acpi_get_parent(func->handle, &phandle); | ||
742 | if (acpi_bus_get_device(phandle, &pdevice)) { | ||
743 | dbg("no parent device, assuming NULL\n"); | ||
744 | pdevice = NULL; | ||
745 | } | ||
746 | if (!acpi_bus_get_device(func->handle, &device)) { | 740 | if (!acpi_bus_get_device(func->handle, &device)) { |
747 | dbg("bus exists... trim\n"); | 741 | dbg("bus exists... trim\n"); |
748 | /* this shouldn't be in here, so remove | 742 | /* this shouldn't be in here, so remove |
749 | * the bus then re-add it... | 743 | * the bus then re-add it... |
750 | */ | 744 | */ |
751 | ret_val = acpi_bus_trim(device, 1); | 745 | acpi_bus_trim(device); |
752 | dbg("acpi_bus_trim return %x\n", ret_val); | ||
753 | } | 746 | } |
754 | 747 | ||
755 | ret_val = acpi_bus_add(&device, pdevice, func->handle, | 748 | ret_val = acpi_bus_scan(func->handle); |
756 | ACPI_BUS_TYPE_DEVICE); | 749 | if (!ret_val) |
757 | if (ret_val) { | 750 | ret_val = acpi_bus_get_device(func->handle, &device); |
758 | dbg("error adding bus, %x\n", | 751 | |
759 | -ret_val); | 752 | if (ret_val) |
760 | goto acpiphp_bus_add_out; | 753 | dbg("error adding bus, %x\n", -ret_val); |
761 | } | ||
762 | ret_val = acpi_bus_start(device); | ||
763 | 754 | ||
764 | acpiphp_bus_add_out: | ||
765 | return ret_val; | 755 | return ret_val; |
766 | } | 756 | } |
767 | 757 | ||
@@ -781,11 +771,8 @@ static int acpiphp_bus_trim(acpi_handle handle) | |||
781 | return retval; | 771 | return retval; |
782 | } | 772 | } |
783 | 773 | ||
784 | retval = acpi_bus_trim(device, 1); | 774 | acpi_bus_trim(device); |
785 | if (retval) | 775 | return 0; |
786 | err("cannot remove from acpi list\n"); | ||
787 | |||
788 | return retval; | ||
789 | } | 776 | } |
790 | 777 | ||
791 | static void acpiphp_set_acpi_region(struct acpiphp_slot *slot) | 778 | static void acpiphp_set_acpi_region(struct acpiphp_slot *slot) |
@@ -1130,8 +1117,7 @@ static int acpiphp_configure_bridge (acpi_handle handle) | |||
1130 | 1117 | ||
1131 | static void handle_bridge_insertion(acpi_handle handle, u32 type) | 1118 | static void handle_bridge_insertion(acpi_handle handle, u32 type) |
1132 | { | 1119 | { |
1133 | struct acpi_device *device, *pdevice; | 1120 | struct acpi_device *device; |
1134 | acpi_handle phandle; | ||
1135 | 1121 | ||
1136 | if ((type != ACPI_NOTIFY_BUS_CHECK) && | 1122 | if ((type != ACPI_NOTIFY_BUS_CHECK) && |
1137 | (type != ACPI_NOTIFY_DEVICE_CHECK)) { | 1123 | (type != ACPI_NOTIFY_DEVICE_CHECK)) { |
@@ -1139,17 +1125,15 @@ static void handle_bridge_insertion(acpi_handle handle, u32 type) | |||
1139 | return; | 1125 | return; |
1140 | } | 1126 | } |
1141 | 1127 | ||
1142 | acpi_get_parent(handle, &phandle); | 1128 | if (acpi_bus_scan(handle)) { |
1143 | if (acpi_bus_get_device(phandle, &pdevice)) { | ||
1144 | dbg("no parent device, assuming NULL\n"); | ||
1145 | pdevice = NULL; | ||
1146 | } | ||
1147 | if (acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE)) { | ||
1148 | err("cannot add bridge to acpi list\n"); | 1129 | err("cannot add bridge to acpi list\n"); |
1149 | return; | 1130 | return; |
1150 | } | 1131 | } |
1151 | if (!acpiphp_configure_bridge(handle) && | 1132 | if (acpi_bus_get_device(handle, &device)) { |
1152 | !acpi_bus_start(device)) | 1133 | err("ACPI device object missing\n"); |
1134 | return; | ||
1135 | } | ||
1136 | if (!acpiphp_configure_bridge(handle)) | ||
1153 | add_bridge(handle); | 1137 | add_bridge(handle); |
1154 | else | 1138 | else |
1155 | err("cannot configure and start bridge\n"); | 1139 | err("cannot configure and start bridge\n"); |
@@ -1234,6 +1218,8 @@ static void _handle_hotplug_event_bridge(struct work_struct *work) | |||
1234 | handle = hp_work->handle; | 1218 | handle = hp_work->handle; |
1235 | type = hp_work->type; | 1219 | type = hp_work->type; |
1236 | 1220 | ||
1221 | acpi_scan_lock_acquire(); | ||
1222 | |||
1237 | if (acpi_bus_get_device(handle, &device)) { | 1223 | if (acpi_bus_get_device(handle, &device)) { |
1238 | /* This bridge must have just been physically inserted */ | 1224 | /* This bridge must have just been physically inserted */ |
1239 | handle_bridge_insertion(handle, type); | 1225 | handle_bridge_insertion(handle, type); |
@@ -1311,6 +1297,7 @@ static void _handle_hotplug_event_bridge(struct work_struct *work) | |||
1311 | } | 1297 | } |
1312 | 1298 | ||
1313 | out: | 1299 | out: |
1300 | acpi_scan_lock_release(); | ||
1314 | kfree(hp_work); /* allocated in handle_hotplug_event_bridge */ | 1301 | kfree(hp_work); /* allocated in handle_hotplug_event_bridge */ |
1315 | } | 1302 | } |
1316 | 1303 | ||
@@ -1357,6 +1344,8 @@ static void _handle_hotplug_event_func(struct work_struct *work) | |||
1357 | 1344 | ||
1358 | func = (struct acpiphp_func *)context; | 1345 | func = (struct acpiphp_func *)context; |
1359 | 1346 | ||
1347 | acpi_scan_lock_acquire(); | ||
1348 | |||
1360 | switch (type) { | 1349 | switch (type) { |
1361 | case ACPI_NOTIFY_BUS_CHECK: | 1350 | case ACPI_NOTIFY_BUS_CHECK: |
1362 | /* bus re-enumerate */ | 1351 | /* bus re-enumerate */ |
@@ -1387,6 +1376,7 @@ static void _handle_hotplug_event_func(struct work_struct *work) | |||
1387 | break; | 1376 | break; |
1388 | } | 1377 | } |
1389 | 1378 | ||
1379 | acpi_scan_lock_release(); | ||
1390 | kfree(hp_work); /* allocated in handle_hotplug_event_func */ | 1380 | kfree(hp_work); /* allocated in handle_hotplug_event_func */ |
1391 | } | 1381 | } |
1392 | 1382 | ||
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c index f64ca92253da..574421bc2fa6 100644 --- a/drivers/pci/hotplug/sgi_hotplug.c +++ b/drivers/pci/hotplug/sgi_hotplug.c | |||
@@ -412,7 +412,6 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
412 | if (SN_ACPI_BASE_SUPPORT() && ssdt) { | 412 | if (SN_ACPI_BASE_SUPPORT() && ssdt) { |
413 | unsigned long long adr; | 413 | unsigned long long adr; |
414 | struct acpi_device *pdevice; | 414 | struct acpi_device *pdevice; |
415 | struct acpi_device *device; | ||
416 | acpi_handle phandle; | 415 | acpi_handle phandle; |
417 | acpi_handle chandle = NULL; | 416 | acpi_handle chandle = NULL; |
418 | acpi_handle rethandle; | 417 | acpi_handle rethandle; |
@@ -426,6 +425,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
426 | pdevice = NULL; | 425 | pdevice = NULL; |
427 | } | 426 | } |
428 | 427 | ||
428 | acpi_scan_lock_acquire(); | ||
429 | /* | 429 | /* |
430 | * Walk the rootbus node's immediate children looking for | 430 | * Walk the rootbus node's immediate children looking for |
431 | * the slot's device node(s). There can be more than | 431 | * the slot's device node(s). There can be more than |
@@ -448,20 +448,18 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
448 | if (ACPI_SUCCESS(ret) && | 448 | if (ACPI_SUCCESS(ret) && |
449 | (adr>>16) == (slot->device_num + 1)) { | 449 | (adr>>16) == (slot->device_num + 1)) { |
450 | 450 | ||
451 | ret = acpi_bus_add(&device, pdevice, chandle, | 451 | ret = acpi_bus_scan(chandle); |
452 | ACPI_BUS_TYPE_DEVICE); | ||
453 | if (ACPI_FAILURE(ret)) { | 452 | if (ACPI_FAILURE(ret)) { |
454 | printk(KERN_ERR "%s: acpi_bus_add " | 453 | printk(KERN_ERR "%s: acpi_bus_scan " |
455 | "failed (0x%x) for slot %d " | 454 | "failed (0x%x) for slot %d " |
456 | "func %d\n", __func__, | 455 | "func %d\n", __func__, |
457 | ret, (int)(adr>>16), | 456 | ret, (int)(adr>>16), |
458 | (int)(adr&0xffff)); | 457 | (int)(adr&0xffff)); |
459 | /* try to continue on */ | 458 | /* try to continue on */ |
460 | } else { | ||
461 | acpi_bus_start(device); | ||
462 | } | 459 | } |
463 | } | 460 | } |
464 | } | 461 | } |
462 | acpi_scan_lock_release(); | ||
465 | } | 463 | } |
466 | 464 | ||
467 | /* Call the driver for the new device */ | 465 | /* Call the driver for the new device */ |
@@ -512,6 +510,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
512 | /* Get the rootbus node pointer */ | 510 | /* Get the rootbus node pointer */ |
513 | phandle = PCI_CONTROLLER(slot->pci_bus)->acpi_handle; | 511 | phandle = PCI_CONTROLLER(slot->pci_bus)->acpi_handle; |
514 | 512 | ||
513 | acpi_scan_lock_acquire(); | ||
515 | /* | 514 | /* |
516 | * Walk the rootbus node's immediate children looking for | 515 | * Walk the rootbus node's immediate children looking for |
517 | * the slot's device node(s). There can be more than | 516 | * the slot's device node(s). There can be more than |
@@ -539,10 +538,10 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
539 | ret = acpi_bus_get_device(chandle, | 538 | ret = acpi_bus_get_device(chandle, |
540 | &device); | 539 | &device); |
541 | if (ACPI_SUCCESS(ret)) | 540 | if (ACPI_SUCCESS(ret)) |
542 | acpi_bus_trim(device, 1); | 541 | acpi_bus_trim(device); |
543 | } | 542 | } |
544 | } | 543 | } |
545 | 544 | acpi_scan_lock_release(); | |
546 | } | 545 | } |
547 | 546 | ||
548 | /* Free the SN resources assigned to the Linux device.*/ | 547 | /* Free the SN resources assigned to the Linux device.*/ |
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 5099636a6e5f..00cc78c7aa04 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -845,6 +845,32 @@ int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec) | |||
845 | } | 845 | } |
846 | EXPORT_SYMBOL(pci_enable_msi_block); | 846 | EXPORT_SYMBOL(pci_enable_msi_block); |
847 | 847 | ||
848 | int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec) | ||
849 | { | ||
850 | int ret, pos, nvec; | ||
851 | u16 msgctl; | ||
852 | |||
853 | pos = pci_find_capability(dev, PCI_CAP_ID_MSI); | ||
854 | if (!pos) | ||
855 | return -EINVAL; | ||
856 | |||
857 | pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &msgctl); | ||
858 | ret = 1 << ((msgctl & PCI_MSI_FLAGS_QMASK) >> 1); | ||
859 | |||
860 | if (maxvec) | ||
861 | *maxvec = ret; | ||
862 | |||
863 | do { | ||
864 | nvec = ret; | ||
865 | ret = pci_enable_msi_block(dev, nvec); | ||
866 | } while (ret > 0); | ||
867 | |||
868 | if (ret < 0) | ||
869 | return ret; | ||
870 | return nvec; | ||
871 | } | ||
872 | EXPORT_SYMBOL(pci_enable_msi_block_auto); | ||
873 | |||
848 | void pci_msi_shutdown(struct pci_dev *dev) | 874 | void pci_msi_shutdown(struct pci_dev *dev) |
849 | { | 875 | { |
850 | struct msi_desc *desc; | 876 | struct msi_desc *desc; |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 1af4008182fd..e407c61559ca 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -283,7 +283,6 @@ static struct pci_platform_pm_ops acpi_pci_platform_pm = { | |||
283 | .is_manageable = acpi_pci_power_manageable, | 283 | .is_manageable = acpi_pci_power_manageable, |
284 | .set_state = acpi_pci_set_power_state, | 284 | .set_state = acpi_pci_set_power_state, |
285 | .choose_state = acpi_pci_choose_state, | 285 | .choose_state = acpi_pci_choose_state, |
286 | .can_wakeup = acpi_pci_can_wakeup, | ||
287 | .sleep_wake = acpi_pci_sleep_wake, | 286 | .sleep_wake = acpi_pci_sleep_wake, |
288 | .run_wake = acpi_pci_run_wake, | 287 | .run_wake = acpi_pci_run_wake, |
289 | }; | 288 | }; |
@@ -321,10 +320,65 @@ static int acpi_pci_find_root_bridge(struct device *dev, acpi_handle *handle) | |||
321 | return 0; | 320 | return 0; |
322 | } | 321 | } |
323 | 322 | ||
323 | static void pci_acpi_setup(struct device *dev) | ||
324 | { | ||
325 | struct pci_dev *pci_dev = to_pci_dev(dev); | ||
326 | acpi_handle handle = ACPI_HANDLE(dev); | ||
327 | struct acpi_device *adev; | ||
328 | acpi_status status; | ||
329 | acpi_handle dummy; | ||
330 | |||
331 | /* | ||
332 | * Evaluate and parse _PRT, if exists. This code allows parsing of | ||
333 | * _PRT objects within the scope of non-bridge devices. Note that | ||
334 | * _PRTs within the scope of a PCI bridge assume the bridge's | ||
335 | * subordinate bus number. | ||
336 | * | ||
337 | * TBD: Can _PRTs exist within the scope of non-bridge PCI devices? | ||
338 | */ | ||
339 | status = acpi_get_handle(handle, METHOD_NAME__PRT, &dummy); | ||
340 | if (ACPI_SUCCESS(status)) { | ||
341 | unsigned char bus; | ||
342 | |||
343 | bus = pci_dev->subordinate ? | ||
344 | pci_dev->subordinate->number : pci_dev->bus->number; | ||
345 | acpi_pci_irq_add_prt(handle, pci_domain_nr(pci_dev->bus), bus); | ||
346 | } | ||
347 | |||
348 | if (acpi_bus_get_device(handle, &adev) || !adev->wakeup.flags.valid) | ||
349 | return; | ||
350 | |||
351 | device_set_wakeup_capable(dev, true); | ||
352 | acpi_pci_sleep_wake(pci_dev, false); | ||
353 | |||
354 | pci_acpi_add_pm_notifier(adev, pci_dev); | ||
355 | if (adev->wakeup.flags.run_wake) | ||
356 | device_set_run_wake(dev, true); | ||
357 | } | ||
358 | |||
359 | static void pci_acpi_cleanup(struct device *dev) | ||
360 | { | ||
361 | struct pci_dev *pci_dev = to_pci_dev(dev); | ||
362 | acpi_handle handle = ACPI_HANDLE(dev); | ||
363 | struct acpi_device *adev; | ||
364 | |||
365 | if (!acpi_bus_get_device(handle, &adev) && adev->wakeup.flags.valid) { | ||
366 | device_set_wakeup_capable(dev, false); | ||
367 | device_set_run_wake(dev, false); | ||
368 | pci_acpi_remove_pm_notifier(adev); | ||
369 | } | ||
370 | |||
371 | if (pci_dev->subordinate) | ||
372 | acpi_pci_irq_del_prt(pci_domain_nr(pci_dev->bus), | ||
373 | pci_dev->subordinate->number); | ||
374 | } | ||
375 | |||
324 | static struct acpi_bus_type acpi_pci_bus = { | 376 | static struct acpi_bus_type acpi_pci_bus = { |
325 | .bus = &pci_bus_type, | 377 | .bus = &pci_bus_type, |
326 | .find_device = acpi_pci_find_device, | 378 | .find_device = acpi_pci_find_device, |
327 | .find_bridge = acpi_pci_find_root_bridge, | 379 | .find_bridge = acpi_pci_find_root_bridge, |
380 | .setup = pci_acpi_setup, | ||
381 | .cleanup = pci_acpi_cleanup, | ||
328 | }; | 382 | }; |
329 | 383 | ||
330 | static int __init acpi_pci_init(void) | 384 | static int __init acpi_pci_init(void) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 5cb5820fae40..0c4f641b7be1 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -450,7 +450,7 @@ static struct pci_platform_pm_ops *pci_platform_pm; | |||
450 | int pci_set_platform_pm(struct pci_platform_pm_ops *ops) | 450 | int pci_set_platform_pm(struct pci_platform_pm_ops *ops) |
451 | { | 451 | { |
452 | if (!ops->is_manageable || !ops->set_state || !ops->choose_state | 452 | if (!ops->is_manageable || !ops->set_state || !ops->choose_state |
453 | || !ops->sleep_wake || !ops->can_wakeup) | 453 | || !ops->sleep_wake) |
454 | return -EINVAL; | 454 | return -EINVAL; |
455 | pci_platform_pm = ops; | 455 | pci_platform_pm = ops; |
456 | return 0; | 456 | return 0; |
@@ -473,11 +473,6 @@ static inline pci_power_t platform_pci_choose_state(struct pci_dev *dev) | |||
473 | pci_platform_pm->choose_state(dev) : PCI_POWER_ERROR; | 473 | pci_platform_pm->choose_state(dev) : PCI_POWER_ERROR; |
474 | } | 474 | } |
475 | 475 | ||
476 | static inline bool platform_pci_can_wakeup(struct pci_dev *dev) | ||
477 | { | ||
478 | return pci_platform_pm ? pci_platform_pm->can_wakeup(dev) : false; | ||
479 | } | ||
480 | |||
481 | static inline int platform_pci_sleep_wake(struct pci_dev *dev, bool enable) | 476 | static inline int platform_pci_sleep_wake(struct pci_dev *dev, bool enable) |
482 | { | 477 | { |
483 | return pci_platform_pm ? | 478 | return pci_platform_pm ? |
@@ -1985,25 +1980,6 @@ void pci_pm_init(struct pci_dev *dev) | |||
1985 | } | 1980 | } |
1986 | } | 1981 | } |
1987 | 1982 | ||
1988 | /** | ||
1989 | * platform_pci_wakeup_init - init platform wakeup if present | ||
1990 | * @dev: PCI device | ||
1991 | * | ||
1992 | * Some devices don't have PCI PM caps but can still generate wakeup | ||
1993 | * events through platform methods (like ACPI events). If @dev supports | ||
1994 | * platform wakeup events, set the device flag to indicate as much. This | ||
1995 | * may be redundant if the device also supports PCI PM caps, but double | ||
1996 | * initialization should be safe in that case. | ||
1997 | */ | ||
1998 | void platform_pci_wakeup_init(struct pci_dev *dev) | ||
1999 | { | ||
2000 | if (!platform_pci_can_wakeup(dev)) | ||
2001 | return; | ||
2002 | |||
2003 | device_set_wakeup_capable(&dev->dev, true); | ||
2004 | platform_pci_sleep_wake(dev, false); | ||
2005 | } | ||
2006 | |||
2007 | static void pci_add_saved_cap(struct pci_dev *pci_dev, | 1983 | static void pci_add_saved_cap(struct pci_dev *pci_dev, |
2008 | struct pci_cap_saved_state *new_cap) | 1984 | struct pci_cap_saved_state *new_cap) |
2009 | { | 1985 | { |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index e8518292826f..adfd172c5b9b 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -43,9 +43,6 @@ int pci_probe_reset_function(struct pci_dev *dev); | |||
43 | * platform; to be used during system-wide transitions from a | 43 | * platform; to be used during system-wide transitions from a |
44 | * sleeping state to the working state and vice versa | 44 | * sleeping state to the working state and vice versa |
45 | * | 45 | * |
46 | * @can_wakeup: returns 'true' if given device is capable of waking up the | ||
47 | * system from a sleeping state | ||
48 | * | ||
49 | * @sleep_wake: enables/disables the system wake up capability of given device | 46 | * @sleep_wake: enables/disables the system wake up capability of given device |
50 | * | 47 | * |
51 | * @run_wake: enables/disables the platform to generate run-time wake-up events | 48 | * @run_wake: enables/disables the platform to generate run-time wake-up events |
@@ -59,7 +56,6 @@ struct pci_platform_pm_ops { | |||
59 | bool (*is_manageable)(struct pci_dev *dev); | 56 | bool (*is_manageable)(struct pci_dev *dev); |
60 | int (*set_state)(struct pci_dev *dev, pci_power_t state); | 57 | int (*set_state)(struct pci_dev *dev, pci_power_t state); |
61 | pci_power_t (*choose_state)(struct pci_dev *dev); | 58 | pci_power_t (*choose_state)(struct pci_dev *dev); |
62 | bool (*can_wakeup)(struct pci_dev *dev); | ||
63 | int (*sleep_wake)(struct pci_dev *dev, bool enable); | 59 | int (*sleep_wake)(struct pci_dev *dev, bool enable); |
64 | int (*run_wake)(struct pci_dev *dev, bool enable); | 60 | int (*run_wake)(struct pci_dev *dev, bool enable); |
65 | }; | 61 | }; |
@@ -74,7 +70,6 @@ extern void pci_wakeup_bus(struct pci_bus *bus); | |||
74 | extern void pci_config_pm_runtime_get(struct pci_dev *dev); | 70 | extern void pci_config_pm_runtime_get(struct pci_dev *dev); |
75 | extern void pci_config_pm_runtime_put(struct pci_dev *dev); | 71 | extern void pci_config_pm_runtime_put(struct pci_dev *dev); |
76 | extern void pci_pm_init(struct pci_dev *dev); | 72 | extern void pci_pm_init(struct pci_dev *dev); |
77 | extern void platform_pci_wakeup_init(struct pci_dev *dev); | ||
78 | extern void pci_allocate_cap_save_buffers(struct pci_dev *dev); | 73 | extern void pci_allocate_cap_save_buffers(struct pci_dev *dev); |
79 | void pci_free_cap_save_buffers(struct pci_dev *dev); | 74 | void pci_free_cap_save_buffers(struct pci_dev *dev); |
80 | 75 | ||
diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c index 3ea51736f18d..5ab14251839d 100644 --- a/drivers/pci/pcie/aer/aerdrv_errprint.c +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c | |||
@@ -23,6 +23,9 @@ | |||
23 | 23 | ||
24 | #include "aerdrv.h" | 24 | #include "aerdrv.h" |
25 | 25 | ||
26 | #define CREATE_TRACE_POINTS | ||
27 | #include <trace/events/ras.h> | ||
28 | |||
26 | #define AER_AGENT_RECEIVER 0 | 29 | #define AER_AGENT_RECEIVER 0 |
27 | #define AER_AGENT_REQUESTER 1 | 30 | #define AER_AGENT_REQUESTER 1 |
28 | #define AER_AGENT_COMPLETER 2 | 31 | #define AER_AGENT_COMPLETER 2 |
@@ -121,12 +124,11 @@ static const char *aer_agent_string[] = { | |||
121 | "Transmitter ID" | 124 | "Transmitter ID" |
122 | }; | 125 | }; |
123 | 126 | ||
124 | static void __aer_print_error(const char *prefix, | 127 | static void __aer_print_error(struct pci_dev *dev, |
125 | struct aer_err_info *info) | 128 | struct aer_err_info *info) |
126 | { | 129 | { |
127 | int i, status; | 130 | int i, status; |
128 | const char *errmsg = NULL; | 131 | const char *errmsg = NULL; |
129 | |||
130 | status = (info->status & ~info->mask); | 132 | status = (info->status & ~info->mask); |
131 | 133 | ||
132 | for (i = 0; i < 32; i++) { | 134 | for (i = 0; i < 32; i++) { |
@@ -141,26 +143,22 @@ static void __aer_print_error(const char *prefix, | |||
141 | aer_uncorrectable_error_string[i] : NULL; | 143 | aer_uncorrectable_error_string[i] : NULL; |
142 | 144 | ||
143 | if (errmsg) | 145 | if (errmsg) |
144 | printk("%s"" [%2d] %-22s%s\n", prefix, i, errmsg, | 146 | dev_err(&dev->dev, " [%2d] %-22s%s\n", i, errmsg, |
145 | info->first_error == i ? " (First)" : ""); | 147 | info->first_error == i ? " (First)" : ""); |
146 | else | 148 | else |
147 | printk("%s"" [%2d] Unknown Error Bit%s\n", prefix, i, | 149 | dev_err(&dev->dev, " [%2d] Unknown Error Bit%s\n", |
148 | info->first_error == i ? " (First)" : ""); | 150 | i, info->first_error == i ? " (First)" : ""); |
149 | } | 151 | } |
150 | } | 152 | } |
151 | 153 | ||
152 | void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) | 154 | void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) |
153 | { | 155 | { |
154 | int id = ((dev->bus->number << 8) | dev->devfn); | 156 | int id = ((dev->bus->number << 8) | dev->devfn); |
155 | char prefix[44]; | ||
156 | |||
157 | snprintf(prefix, sizeof(prefix), "%s%s %s: ", | ||
158 | (info->severity == AER_CORRECTABLE) ? KERN_WARNING : KERN_ERR, | ||
159 | dev_driver_string(&dev->dev), dev_name(&dev->dev)); | ||
160 | 157 | ||
161 | if (info->status == 0) { | 158 | if (info->status == 0) { |
162 | printk("%s""PCIe Bus Error: severity=%s, type=Unaccessible, " | 159 | dev_err(&dev->dev, |
163 | "id=%04x(Unregistered Agent ID)\n", prefix, | 160 | "PCIe Bus Error: severity=%s, type=Unaccessible, " |
161 | "id=%04x(Unregistered Agent ID)\n", | ||
164 | aer_error_severity_string[info->severity], id); | 162 | aer_error_severity_string[info->severity], id); |
165 | } else { | 163 | } else { |
166 | int layer, agent; | 164 | int layer, agent; |
@@ -168,22 +166,24 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) | |||
168 | layer = AER_GET_LAYER_ERROR(info->severity, info->status); | 166 | layer = AER_GET_LAYER_ERROR(info->severity, info->status); |
169 | agent = AER_GET_AGENT(info->severity, info->status); | 167 | agent = AER_GET_AGENT(info->severity, info->status); |
170 | 168 | ||
171 | printk("%s""PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n", | 169 | dev_err(&dev->dev, |
172 | prefix, aer_error_severity_string[info->severity], | 170 | "PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n", |
171 | aer_error_severity_string[info->severity], | ||
173 | aer_error_layer[layer], id, aer_agent_string[agent]); | 172 | aer_error_layer[layer], id, aer_agent_string[agent]); |
174 | 173 | ||
175 | printk("%s"" device [%04x:%04x] error status/mask=%08x/%08x\n", | 174 | dev_err(&dev->dev, |
176 | prefix, dev->vendor, dev->device, | 175 | " device [%04x:%04x] error status/mask=%08x/%08x\n", |
176 | dev->vendor, dev->device, | ||
177 | info->status, info->mask); | 177 | info->status, info->mask); |
178 | 178 | ||
179 | __aer_print_error(prefix, info); | 179 | __aer_print_error(dev, info); |
180 | 180 | ||
181 | if (info->tlp_header_valid) { | 181 | if (info->tlp_header_valid) { |
182 | unsigned char *tlp = (unsigned char *) &info->tlp; | 182 | unsigned char *tlp = (unsigned char *) &info->tlp; |
183 | printk("%s"" TLP Header:" | 183 | dev_err(&dev->dev, " TLP Header:" |
184 | " %02x%02x%02x%02x %02x%02x%02x%02x" | 184 | " %02x%02x%02x%02x %02x%02x%02x%02x" |
185 | " %02x%02x%02x%02x %02x%02x%02x%02x\n", | 185 | " %02x%02x%02x%02x %02x%02x%02x%02x\n", |
186 | prefix, *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, | 186 | *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, |
187 | *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), | 187 | *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), |
188 | *(tlp + 11), *(tlp + 10), *(tlp + 9), | 188 | *(tlp + 11), *(tlp + 10), *(tlp + 9), |
189 | *(tlp + 8), *(tlp + 15), *(tlp + 14), | 189 | *(tlp + 8), *(tlp + 15), *(tlp + 14), |
@@ -192,8 +192,11 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) | |||
192 | } | 192 | } |
193 | 193 | ||
194 | if (info->id && info->error_dev_num > 1 && info->id == id) | 194 | if (info->id && info->error_dev_num > 1 && info->id == id) |
195 | printk("%s"" Error of this Agent(%04x) is reported first\n", | 195 | dev_err(&dev->dev, |
196 | prefix, id); | 196 | " Error of this Agent(%04x) is reported first\n", |
197 | id); | ||
198 | trace_aer_event(dev_name(&dev->dev), (info->status & ~info->mask), | ||
199 | info->severity); | ||
197 | } | 200 | } |
198 | 201 | ||
199 | void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info) | 202 | void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info) |
@@ -217,7 +220,7 @@ int cper_severity_to_aer(int cper_severity) | |||
217 | } | 220 | } |
218 | EXPORT_SYMBOL_GPL(cper_severity_to_aer); | 221 | EXPORT_SYMBOL_GPL(cper_severity_to_aer); |
219 | 222 | ||
220 | void cper_print_aer(const char *prefix, int cper_severity, | 223 | void cper_print_aer(const char *prefix, struct pci_dev *dev, int cper_severity, |
221 | struct aer_capability_regs *aer) | 224 | struct aer_capability_regs *aer) |
222 | { | 225 | { |
223 | int aer_severity, layer, agent, status_strs_size, tlp_header_valid = 0; | 226 | int aer_severity, layer, agent, status_strs_size, tlp_header_valid = 0; |
@@ -239,25 +242,27 @@ void cper_print_aer(const char *prefix, int cper_severity, | |||
239 | } | 242 | } |
240 | layer = AER_GET_LAYER_ERROR(aer_severity, status); | 243 | layer = AER_GET_LAYER_ERROR(aer_severity, status); |
241 | agent = AER_GET_AGENT(aer_severity, status); | 244 | agent = AER_GET_AGENT(aer_severity, status); |
242 | printk("%s""aer_status: 0x%08x, aer_mask: 0x%08x\n", | 245 | dev_err(&dev->dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n", |
243 | prefix, status, mask); | 246 | status, mask); |
244 | cper_print_bits(prefix, status, status_strs, status_strs_size); | 247 | cper_print_bits(prefix, status, status_strs, status_strs_size); |
245 | printk("%s""aer_layer=%s, aer_agent=%s\n", prefix, | 248 | dev_err(&dev->dev, "aer_layer=%s, aer_agent=%s\n", |
246 | aer_error_layer[layer], aer_agent_string[agent]); | 249 | aer_error_layer[layer], aer_agent_string[agent]); |
247 | if (aer_severity != AER_CORRECTABLE) | 250 | if (aer_severity != AER_CORRECTABLE) |
248 | printk("%s""aer_uncor_severity: 0x%08x\n", | 251 | dev_err(&dev->dev, "aer_uncor_severity: 0x%08x\n", |
249 | prefix, aer->uncor_severity); | 252 | aer->uncor_severity); |
250 | if (tlp_header_valid) { | 253 | if (tlp_header_valid) { |
251 | const unsigned char *tlp; | 254 | const unsigned char *tlp; |
252 | tlp = (const unsigned char *)&aer->header_log; | 255 | tlp = (const unsigned char *)&aer->header_log; |
253 | printk("%s""aer_tlp_header:" | 256 | dev_err(&dev->dev, "aer_tlp_header:" |
254 | " %02x%02x%02x%02x %02x%02x%02x%02x" | 257 | " %02x%02x%02x%02x %02x%02x%02x%02x" |
255 | " %02x%02x%02x%02x %02x%02x%02x%02x\n", | 258 | " %02x%02x%02x%02x %02x%02x%02x%02x\n", |
256 | prefix, *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, | 259 | *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, |
257 | *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), | 260 | *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), |
258 | *(tlp + 11), *(tlp + 10), *(tlp + 9), | 261 | *(tlp + 11), *(tlp + 10), *(tlp + 9), |
259 | *(tlp + 8), *(tlp + 15), *(tlp + 14), | 262 | *(tlp + 8), *(tlp + 15), *(tlp + 14), |
260 | *(tlp + 13), *(tlp + 12)); | 263 | *(tlp + 13), *(tlp + 12)); |
261 | } | 264 | } |
265 | trace_aer_event(dev_name(&dev->dev), (status & ~mask), | ||
266 | aer_severity); | ||
262 | } | 267 | } |
263 | #endif | 268 | #endif |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 6186f03d84f3..2dcd22d9c816 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -1280,7 +1280,6 @@ static void pci_init_capabilities(struct pci_dev *dev) | |||
1280 | 1280 | ||
1281 | /* Power Management */ | 1281 | /* Power Management */ |
1282 | pci_pm_init(dev); | 1282 | pci_pm_init(dev); |
1283 | platform_pci_wakeup_init(dev); | ||
1284 | 1283 | ||
1285 | /* Vital Product Data */ | 1284 | /* Vital Product Data */ |
1286 | pci_vpd_pci22_init(dev); | 1285 | pci_vpd_pci22_init(dev); |
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index 7c0fd9252e6f..84954a726a94 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c | |||
@@ -19,6 +19,8 @@ static void pci_free_resources(struct pci_dev *dev) | |||
19 | 19 | ||
20 | static void pci_stop_dev(struct pci_dev *dev) | 20 | static void pci_stop_dev(struct pci_dev *dev) |
21 | { | 21 | { |
22 | pci_pme_active(dev, false); | ||
23 | |||
22 | if (dev->is_added) { | 24 | if (dev->is_added) { |
23 | pci_proc_detach_device(dev); | 25 | pci_proc_detach_device(dev); |
24 | pci_remove_sysfs_dev_files(dev); | 26 | pci_remove_sysfs_dev_files(dev); |