diff options
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 40 | ||||
-rw-r--r-- | drivers/pci/hotplug/sgi_hotplug.c | 6 | ||||
-rw-r--r-- | drivers/pci/pci-acpi.c | 58 | ||||
-rw-r--r-- | drivers/pci/pci.c | 26 | ||||
-rw-r--r-- | drivers/pci/pci.h | 5 | ||||
-rw-r--r-- | drivers/pci/probe.c | 1 |
6 files changed, 73 insertions, 63 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 3d6d4fd1e3c5..91b5ad875c53 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -734,15 +734,9 @@ 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 |
@@ -752,16 +746,13 @@ static int acpiphp_bus_add(struct acpiphp_func *func) | |||
752 | dbg("acpi_bus_trim return %x\n", ret_val); | 746 | dbg("acpi_bus_trim return %x\n", ret_val); |
753 | } | 747 | } |
754 | 748 | ||
755 | ret_val = acpi_bus_add(&device, pdevice, func->handle, | 749 | ret_val = acpi_bus_add(func->handle); |
756 | ACPI_BUS_TYPE_DEVICE); | 750 | if (!ret_val) |
757 | if (ret_val) { | 751 | ret_val = acpi_bus_get_device(func->handle, &device); |
758 | dbg("error adding bus, %x\n", | 752 | |
759 | -ret_val); | 753 | if (ret_val) |
760 | goto acpiphp_bus_add_out; | 754 | dbg("error adding bus, %x\n", -ret_val); |
761 | } | ||
762 | ret_val = acpi_bus_start(device); | ||
763 | 755 | ||
764 | acpiphp_bus_add_out: | ||
765 | return ret_val; | 756 | return ret_val; |
766 | } | 757 | } |
767 | 758 | ||
@@ -1130,8 +1121,7 @@ static int acpiphp_configure_bridge (acpi_handle handle) | |||
1130 | 1121 | ||
1131 | static void handle_bridge_insertion(acpi_handle handle, u32 type) | 1122 | static void handle_bridge_insertion(acpi_handle handle, u32 type) |
1132 | { | 1123 | { |
1133 | struct acpi_device *device, *pdevice; | 1124 | struct acpi_device *device; |
1134 | acpi_handle phandle; | ||
1135 | 1125 | ||
1136 | if ((type != ACPI_NOTIFY_BUS_CHECK) && | 1126 | if ((type != ACPI_NOTIFY_BUS_CHECK) && |
1137 | (type != ACPI_NOTIFY_DEVICE_CHECK)) { | 1127 | (type != ACPI_NOTIFY_DEVICE_CHECK)) { |
@@ -1139,17 +1129,15 @@ static void handle_bridge_insertion(acpi_handle handle, u32 type) | |||
1139 | return; | 1129 | return; |
1140 | } | 1130 | } |
1141 | 1131 | ||
1142 | acpi_get_parent(handle, &phandle); | 1132 | if (acpi_bus_add(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"); | 1133 | err("cannot add bridge to acpi list\n"); |
1149 | return; | 1134 | return; |
1150 | } | 1135 | } |
1151 | if (!acpiphp_configure_bridge(handle) && | 1136 | if (acpi_bus_get_device(handle, &device)) { |
1152 | !acpi_bus_start(device)) | 1137 | err("ACPI device object missing\n"); |
1138 | return; | ||
1139 | } | ||
1140 | if (!acpiphp_configure_bridge(handle)) | ||
1153 | add_bridge(handle); | 1141 | add_bridge(handle); |
1154 | else | 1142 | else |
1155 | err("cannot configure and start bridge\n"); | 1143 | err("cannot configure and start bridge\n"); |
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c index f64ca92253da..f3c419256d2a 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; |
@@ -448,8 +447,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
448 | if (ACPI_SUCCESS(ret) && | 447 | if (ACPI_SUCCESS(ret) && |
449 | (adr>>16) == (slot->device_num + 1)) { | 448 | (adr>>16) == (slot->device_num + 1)) { |
450 | 449 | ||
451 | ret = acpi_bus_add(&device, pdevice, chandle, | 450 | ret = acpi_bus_add(chandle); |
452 | ACPI_BUS_TYPE_DEVICE); | ||
453 | if (ACPI_FAILURE(ret)) { | 451 | if (ACPI_FAILURE(ret)) { |
454 | printk(KERN_ERR "%s: acpi_bus_add " | 452 | printk(KERN_ERR "%s: acpi_bus_add " |
455 | "failed (0x%x) for slot %d " | 453 | "failed (0x%x) for slot %d " |
@@ -457,8 +455,6 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
457 | ret, (int)(adr>>16), | 455 | ret, (int)(adr>>16), |
458 | (int)(adr&0xffff)); | 456 | (int)(adr&0xffff)); |
459 | /* try to continue on */ | 457 | /* try to continue on */ |
460 | } else { | ||
461 | acpi_bus_start(device); | ||
462 | } | 458 | } |
463 | } | 459 | } |
464 | } | 460 | } |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 1af4008182fd..42736e213f25 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,67 @@ 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 | acpi_power_resource_register_device(dev, handle); | ||
349 | if (acpi_bus_get_device(handle, &adev) || !adev->wakeup.flags.valid) | ||
350 | return; | ||
351 | |||
352 | device_set_wakeup_capable(dev, true); | ||
353 | acpi_pci_sleep_wake(pci_dev, false); | ||
354 | |||
355 | pci_acpi_add_pm_notifier(adev, pci_dev); | ||
356 | if (adev->wakeup.flags.run_wake) | ||
357 | device_set_run_wake(dev, true); | ||
358 | } | ||
359 | |||
360 | static void pci_acpi_cleanup(struct device *dev) | ||
361 | { | ||
362 | struct pci_dev *pci_dev = to_pci_dev(dev); | ||
363 | acpi_handle handle = ACPI_HANDLE(dev); | ||
364 | struct acpi_device *adev; | ||
365 | |||
366 | if (!acpi_bus_get_device(handle, &adev) && adev->wakeup.flags.valid) { | ||
367 | device_set_wakeup_capable(dev, false); | ||
368 | device_set_run_wake(dev, false); | ||
369 | pci_acpi_remove_pm_notifier(adev); | ||
370 | } | ||
371 | acpi_power_resource_unregister_device(dev, handle); | ||
372 | |||
373 | if (pci_dev->subordinate) | ||
374 | acpi_pci_irq_del_prt(pci_domain_nr(pci_dev->bus), | ||
375 | pci_dev->subordinate->number); | ||
376 | } | ||
377 | |||
324 | static struct acpi_bus_type acpi_pci_bus = { | 378 | static struct acpi_bus_type acpi_pci_bus = { |
325 | .bus = &pci_bus_type, | 379 | .bus = &pci_bus_type, |
326 | .find_device = acpi_pci_find_device, | 380 | .find_device = acpi_pci_find_device, |
327 | .find_bridge = acpi_pci_find_root_bridge, | 381 | .find_bridge = acpi_pci_find_root_bridge, |
382 | .setup = pci_acpi_setup, | ||
383 | .cleanup = pci_acpi_cleanup, | ||
328 | }; | 384 | }; |
329 | 385 | ||
330 | static int __init acpi_pci_init(void) | 386 | static int __init acpi_pci_init(void) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index a2f30394c091..89dc8ac096ba 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 ? |
@@ -1984,25 +1979,6 @@ void pci_pm_init(struct pci_dev *dev) | |||
1984 | } | 1979 | } |
1985 | } | 1980 | } |
1986 | 1981 | ||
1987 | /** | ||
1988 | * platform_pci_wakeup_init - init platform wakeup if present | ||
1989 | * @dev: PCI device | ||
1990 | * | ||
1991 | * Some devices don't have PCI PM caps but can still generate wakeup | ||
1992 | * events through platform methods (like ACPI events). If @dev supports | ||
1993 | * platform wakeup events, set the device flag to indicate as much. This | ||
1994 | * may be redundant if the device also supports PCI PM caps, but double | ||
1995 | * initialization should be safe in that case. | ||
1996 | */ | ||
1997 | void platform_pci_wakeup_init(struct pci_dev *dev) | ||
1998 | { | ||
1999 | if (!platform_pci_can_wakeup(dev)) | ||
2000 | return; | ||
2001 | |||
2002 | device_set_wakeup_capable(&dev->dev, true); | ||
2003 | platform_pci_sleep_wake(dev, false); | ||
2004 | } | ||
2005 | |||
2006 | static void pci_add_saved_cap(struct pci_dev *pci_dev, | 1982 | static void pci_add_saved_cap(struct pci_dev *pci_dev, |
2007 | struct pci_cap_saved_state *new_cap) | 1983 | struct pci_cap_saved_state *new_cap) |
2008 | { | 1984 | { |
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/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); |