diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-28 06:58:30 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-28 06:58:30 -0400 |
commit | 3b4550e0e0cd24d8073dc571cecb0d4aa4ca3542 (patch) | |
tree | 44af05a1ac1c85621fa1d06d50d6b127a4cc83bb | |
parent | 8e9914d5efe460600f5948da7ae4c1b6c038a4c0 (diff) | |
parent | fa1675b56537651270e79967b7f1ee4202c83bf6 (diff) |
Merge branch 'acpi-pm'
* acpi-pm:
ACPI / PM: Rework and clean up acpi_dev_pm_get_state()
ACPI / PM: Replace ACPI_STATE_D3 with ACPI_STATE_D3_COLD in device_pm.c
ACPI / PM: Rename function acpi_device_power_state() and make it static
ACPI / PM: acpi_processor_suspend() can be static
xen / ACPI / sleep: Register an acpi_suspend_lowlevel callback.
x86 / ACPI / sleep: Provide registration for acpi_suspend_lowlevel.
-rw-r--r-- | arch/x86/include/asm/acpi.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/acpi/boot.c | 7 | ||||
-rw-r--r-- | arch/x86/kernel/acpi/sleep.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/acpi/sleep.h | 2 | ||||
-rw-r--r-- | drivers/acpi/device_pm.c | 165 | ||||
-rw-r--r-- | drivers/acpi/processor_idle.c | 4 | ||||
-rw-r--r-- | drivers/acpi/sleep.c | 2 | ||||
-rw-r--r-- | include/acpi/acpi_bus.h | 16 | ||||
-rw-r--r-- | include/xen/acpi.h | 16 |
9 files changed, 128 insertions, 90 deletions
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h index b31bf97775fc..2dfac58f3b11 100644 --- a/arch/x86/include/asm/acpi.h +++ b/arch/x86/include/asm/acpi.h | |||
@@ -111,7 +111,7 @@ static inline void acpi_disable_pci(void) | |||
111 | } | 111 | } |
112 | 112 | ||
113 | /* Low-level suspend routine. */ | 113 | /* Low-level suspend routine. */ |
114 | extern int acpi_suspend_lowlevel(void); | 114 | extern int (*acpi_suspend_lowlevel)(void); |
115 | 115 | ||
116 | /* Physical address to resume after wakeup */ | 116 | /* Physical address to resume after wakeup */ |
117 | #define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start)) | 117 | #define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start)) |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 230c8ea878e5..d81a972dd506 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <asm/mpspec.h> | 44 | #include <asm/mpspec.h> |
45 | #include <asm/smp.h> | 45 | #include <asm/smp.h> |
46 | 46 | ||
47 | #include "sleep.h" /* To include x86_acpi_suspend_lowlevel */ | ||
47 | static int __initdata acpi_force = 0; | 48 | static int __initdata acpi_force = 0; |
48 | u32 acpi_rsdt_forced; | 49 | u32 acpi_rsdt_forced; |
49 | int acpi_disabled; | 50 | int acpi_disabled; |
@@ -559,6 +560,12 @@ static int acpi_register_gsi_ioapic(struct device *dev, u32 gsi, | |||
559 | int (*__acpi_register_gsi)(struct device *dev, u32 gsi, | 560 | int (*__acpi_register_gsi)(struct device *dev, u32 gsi, |
560 | int trigger, int polarity) = acpi_register_gsi_pic; | 561 | int trigger, int polarity) = acpi_register_gsi_pic; |
561 | 562 | ||
563 | #ifdef CONFIG_ACPI_SLEEP | ||
564 | int (*acpi_suspend_lowlevel)(void) = x86_acpi_suspend_lowlevel; | ||
565 | #else | ||
566 | int (*acpi_suspend_lowlevel)(void); | ||
567 | #endif | ||
568 | |||
562 | /* | 569 | /* |
563 | * success: return IRQ number (>=0) | 570 | * success: return IRQ number (>=0) |
564 | * failure: return < 0 | 571 | * failure: return < 0 |
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c index b44577bc9744..2a34aaf3c8f1 100644 --- a/arch/x86/kernel/acpi/sleep.c +++ b/arch/x86/kernel/acpi/sleep.c | |||
@@ -26,12 +26,12 @@ static char temp_stack[4096]; | |||
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * acpi_suspend_lowlevel - save kernel state | 29 | * x86_acpi_suspend_lowlevel - save kernel state |
30 | * | 30 | * |
31 | * Create an identity mapped page table and copy the wakeup routine to | 31 | * Create an identity mapped page table and copy the wakeup routine to |
32 | * low memory. | 32 | * low memory. |
33 | */ | 33 | */ |
34 | int acpi_suspend_lowlevel(void) | 34 | int x86_acpi_suspend_lowlevel(void) |
35 | { | 35 | { |
36 | struct wakeup_header *header = | 36 | struct wakeup_header *header = |
37 | (struct wakeup_header *) __va(real_mode_header->wakeup_header); | 37 | (struct wakeup_header *) __va(real_mode_header->wakeup_header); |
diff --git a/arch/x86/kernel/acpi/sleep.h b/arch/x86/kernel/acpi/sleep.h index 67f59f8c6956..c9c2c982d5e4 100644 --- a/arch/x86/kernel/acpi/sleep.h +++ b/arch/x86/kernel/acpi/sleep.h | |||
@@ -15,3 +15,5 @@ extern unsigned long acpi_copy_wakeup_routine(unsigned long); | |||
15 | extern void wakeup_long64(void); | 15 | extern void wakeup_long64(void); |
16 | 16 | ||
17 | extern void do_suspend_lowlevel(void); | 17 | extern void do_suspend_lowlevel(void); |
18 | |||
19 | extern int x86_acpi_suspend_lowlevel(void); | ||
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 31c217a42839..5f3597b87f27 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
@@ -419,62 +419,73 @@ bool acpi_bus_can_wakeup(acpi_handle handle) | |||
419 | EXPORT_SYMBOL(acpi_bus_can_wakeup); | 419 | EXPORT_SYMBOL(acpi_bus_can_wakeup); |
420 | 420 | ||
421 | /** | 421 | /** |
422 | * acpi_device_power_state - Get preferred power state of ACPI device. | 422 | * acpi_dev_pm_get_state - Get preferred power state of ACPI device. |
423 | * @dev: Device whose preferred target power state to return. | 423 | * @dev: Device whose preferred target power state to return. |
424 | * @adev: ACPI device node corresponding to @dev. | 424 | * @adev: ACPI device node corresponding to @dev. |
425 | * @target_state: System state to match the resultant device state. | 425 | * @target_state: System state to match the resultant device state. |
426 | * @d_max_in: Deepest low-power state to take into consideration. | 426 | * @d_min_p: Location to store the highest power state available to the device. |
427 | * @d_min_p: Location to store the upper limit of the allowed states range. | 427 | * @d_max_p: Location to store the lowest power state available to the device. |
428 | * Return value: Preferred power state of the device on success, -ENODEV | ||
429 | * (if there's no 'struct acpi_device' for @dev) or -EINVAL on failure | ||
430 | * | 428 | * |
431 | * Find the lowest power (highest number) ACPI device power state that the | 429 | * Find the lowest power (highest number) and highest power (lowest number) ACPI |
432 | * device can be in while the system is in the state represented by | 430 | * device power states that the device can be in while the system is in the |
433 | * @target_state. If @d_min_p is set, the highest power (lowest number) device | 431 | * state represented by @target_state. Store the integer numbers representing |
434 | * power state that @dev can be in for the given system sleep state is stored | 432 | * those stats in the memory locations pointed to by @d_max_p and @d_min_p, |
435 | * at the location pointed to by it. | 433 | * respectively. |
436 | * | 434 | * |
437 | * Callers must ensure that @dev and @adev are valid pointers and that @adev | 435 | * Callers must ensure that @dev and @adev are valid pointers and that @adev |
438 | * actually corresponds to @dev before using this function. | 436 | * actually corresponds to @dev before using this function. |
437 | * | ||
438 | * Returns 0 on success or -ENODATA when one of the ACPI methods fails or | ||
439 | * returns a value that doesn't make sense. The memory locations pointed to by | ||
440 | * @d_max_p and @d_min_p are only modified on success. | ||
439 | */ | 441 | */ |
440 | int acpi_device_power_state(struct device *dev, struct acpi_device *adev, | 442 | static int acpi_dev_pm_get_state(struct device *dev, struct acpi_device *adev, |
441 | u32 target_state, int d_max_in, int *d_min_p) | 443 | u32 target_state, int *d_min_p, int *d_max_p) |
442 | { | 444 | { |
443 | char acpi_method[] = "_SxD"; | 445 | char method[] = { '_', 'S', '0' + target_state, 'D', '\0' }; |
444 | unsigned long long d_min, d_max; | 446 | acpi_handle handle = adev->handle; |
447 | unsigned long long ret; | ||
448 | int d_min, d_max; | ||
445 | bool wakeup = false; | 449 | bool wakeup = false; |
450 | acpi_status status; | ||
446 | 451 | ||
447 | if (d_max_in < ACPI_STATE_D0 || d_max_in > ACPI_STATE_D3) | ||
448 | return -EINVAL; | ||
449 | |||
450 | if (d_max_in > ACPI_STATE_D3_HOT) { | ||
451 | enum pm_qos_flags_status stat; | ||
452 | |||
453 | stat = dev_pm_qos_flags(dev, PM_QOS_FLAG_NO_POWER_OFF); | ||
454 | if (stat == PM_QOS_FLAGS_ALL) | ||
455 | d_max_in = ACPI_STATE_D3_HOT; | ||
456 | } | ||
457 | |||
458 | acpi_method[2] = '0' + target_state; | ||
459 | /* | 452 | /* |
460 | * If the sleep state is S0, the lowest limit from ACPI is D3, | 453 | * If the system state is S0, the lowest power state the device can be |
461 | * but if the device has _S0W, we will use the value from _S0W | 454 | * in is D3cold, unless the device has _S0W and is supposed to signal |
462 | * as the lowest limit from ACPI. Finally, we will constrain | 455 | * wakeup, in which case the return value of _S0W has to be used as the |
463 | * the lowest limit with the specified one. | 456 | * lowest power state available to the device. |
464 | */ | 457 | */ |
465 | d_min = ACPI_STATE_D0; | 458 | d_min = ACPI_STATE_D0; |
466 | d_max = ACPI_STATE_D3; | 459 | d_max = ACPI_STATE_D3_COLD; |
467 | 460 | ||
468 | /* | 461 | /* |
469 | * If present, _SxD methods return the minimum D-state (highest power | 462 | * If present, _SxD methods return the minimum D-state (highest power |
470 | * state) we can use for the corresponding S-states. Otherwise, the | 463 | * state) we can use for the corresponding S-states. Otherwise, the |
471 | * minimum D-state is D0 (ACPI 3.x). | 464 | * minimum D-state is D0 (ACPI 3.x). |
472 | * | ||
473 | * NOTE: We rely on acpi_evaluate_integer() not clobbering the integer | ||
474 | * provided -- that's our fault recovery, we ignore retval. | ||
475 | */ | 465 | */ |
476 | if (target_state > ACPI_STATE_S0) { | 466 | if (target_state > ACPI_STATE_S0) { |
477 | acpi_evaluate_integer(adev->handle, acpi_method, NULL, &d_min); | 467 | /* |
468 | * We rely on acpi_evaluate_integer() not clobbering the integer | ||
469 | * provided if AE_NOT_FOUND is returned. | ||
470 | */ | ||
471 | ret = d_min; | ||
472 | status = acpi_evaluate_integer(handle, method, NULL, &ret); | ||
473 | if ((ACPI_FAILURE(status) && status != AE_NOT_FOUND) | ||
474 | || ret > ACPI_STATE_D3_COLD) | ||
475 | return -ENODATA; | ||
476 | |||
477 | /* | ||
478 | * We need to handle legacy systems where D3hot and D3cold are | ||
479 | * the same and 3 is returned in both cases, so fall back to | ||
480 | * D3cold if D3hot is not a valid state. | ||
481 | */ | ||
482 | if (!adev->power.states[ret].flags.valid) { | ||
483 | if (ret == ACPI_STATE_D3_HOT) | ||
484 | ret = ACPI_STATE_D3_COLD; | ||
485 | else | ||
486 | return -ENODATA; | ||
487 | } | ||
488 | d_min = ret; | ||
478 | wakeup = device_may_wakeup(dev) && adev->wakeup.flags.valid | 489 | wakeup = device_may_wakeup(dev) && adev->wakeup.flags.valid |
479 | && adev->wakeup.sleep_state >= target_state; | 490 | && adev->wakeup.sleep_state >= target_state; |
480 | } else if (dev_pm_qos_flags(dev, PM_QOS_FLAG_REMOTE_WAKEUP) != | 491 | } else if (dev_pm_qos_flags(dev, PM_QOS_FLAG_REMOTE_WAKEUP) != |
@@ -490,38 +501,30 @@ int acpi_device_power_state(struct device *dev, struct acpi_device *adev, | |||
490 | * can wake the system. _S0W may be valid, too. | 501 | * can wake the system. _S0W may be valid, too. |
491 | */ | 502 | */ |
492 | if (wakeup) { | 503 | if (wakeup) { |
493 | acpi_status status; | 504 | method[3] = 'W'; |
494 | 505 | status = acpi_evaluate_integer(handle, method, NULL, &ret); | |
495 | acpi_method[3] = 'W'; | 506 | if (status == AE_NOT_FOUND) { |
496 | status = acpi_evaluate_integer(adev->handle, acpi_method, NULL, | 507 | if (target_state > ACPI_STATE_S0) |
497 | &d_max); | ||
498 | if (ACPI_FAILURE(status)) { | ||
499 | if (target_state != ACPI_STATE_S0 || | ||
500 | status != AE_NOT_FOUND) | ||
501 | d_max = d_min; | 508 | d_max = d_min; |
502 | } else if (d_max < d_min) { | 509 | } else if (ACPI_SUCCESS(status) && ret <= ACPI_STATE_D3_COLD) { |
503 | /* Warn the user of the broken DSDT */ | 510 | /* Fall back to D3cold if ret is not a valid state. */ |
504 | printk(KERN_WARNING "ACPI: Wrong value from %s\n", | 511 | if (!adev->power.states[ret].flags.valid) |
505 | acpi_method); | 512 | ret = ACPI_STATE_D3_COLD; |
506 | /* Sanitize it */ | 513 | |
507 | d_min = d_max; | 514 | d_max = ret > d_min ? ret : d_min; |
515 | } else { | ||
516 | return -ENODATA; | ||
508 | } | 517 | } |
509 | } | 518 | } |
510 | 519 | ||
511 | if (d_max_in < d_min) | ||
512 | return -EINVAL; | ||
513 | if (d_min_p) | 520 | if (d_min_p) |
514 | *d_min_p = d_min; | 521 | *d_min_p = d_min; |
515 | /* constrain d_max with specified lowest limit (max number) */ | 522 | |
516 | if (d_max > d_max_in) { | 523 | if (d_max_p) |
517 | for (d_max = d_max_in; d_max > d_min; d_max--) { | 524 | *d_max_p = d_max; |
518 | if (adev->power.states[d_max].flags.valid) | 525 | |
519 | break; | 526 | return 0; |
520 | } | ||
521 | } | ||
522 | return d_max; | ||
523 | } | 527 | } |
524 | EXPORT_SYMBOL_GPL(acpi_device_power_state); | ||
525 | 528 | ||
526 | /** | 529 | /** |
527 | * acpi_pm_device_sleep_state - Get preferred power state of ACPI device. | 530 | * acpi_pm_device_sleep_state - Get preferred power state of ACPI device. |
@@ -529,7 +532,8 @@ EXPORT_SYMBOL_GPL(acpi_device_power_state); | |||
529 | * @d_min_p: Location to store the upper limit of the allowed states range. | 532 | * @d_min_p: Location to store the upper limit of the allowed states range. |
530 | * @d_max_in: Deepest low-power state to take into consideration. | 533 | * @d_max_in: Deepest low-power state to take into consideration. |
531 | * Return value: Preferred power state of the device on success, -ENODEV | 534 | * Return value: Preferred power state of the device on success, -ENODEV |
532 | * (if there's no 'struct acpi_device' for @dev) or -EINVAL on failure | 535 | * if there's no 'struct acpi_device' for @dev, -EINVAL if @d_max_in is |
536 | * incorrect, or -ENODATA on ACPI method failure. | ||
533 | * | 537 | * |
534 | * The caller must ensure that @dev is valid before using this function. | 538 | * The caller must ensure that @dev is valid before using this function. |
535 | */ | 539 | */ |
@@ -537,14 +541,39 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in) | |||
537 | { | 541 | { |
538 | acpi_handle handle = DEVICE_ACPI_HANDLE(dev); | 542 | acpi_handle handle = DEVICE_ACPI_HANDLE(dev); |
539 | struct acpi_device *adev; | 543 | struct acpi_device *adev; |
544 | int ret, d_max; | ||
545 | |||
546 | if (d_max_in < ACPI_STATE_D0 || d_max_in > ACPI_STATE_D3_COLD) | ||
547 | return -EINVAL; | ||
548 | |||
549 | if (d_max_in > ACPI_STATE_D3_HOT) { | ||
550 | enum pm_qos_flags_status stat; | ||
551 | |||
552 | stat = dev_pm_qos_flags(dev, PM_QOS_FLAG_NO_POWER_OFF); | ||
553 | if (stat == PM_QOS_FLAGS_ALL) | ||
554 | d_max_in = ACPI_STATE_D3_HOT; | ||
555 | } | ||
540 | 556 | ||
541 | if (!handle || acpi_bus_get_device(handle, &adev)) { | 557 | if (!handle || acpi_bus_get_device(handle, &adev)) { |
542 | dev_dbg(dev, "ACPI handle without context in %s!\n", __func__); | 558 | dev_dbg(dev, "ACPI handle without context in %s!\n", __func__); |
543 | return -ENODEV; | 559 | return -ENODEV; |
544 | } | 560 | } |
545 | 561 | ||
546 | return acpi_device_power_state(dev, adev, acpi_target_system_state(), | 562 | ret = acpi_dev_pm_get_state(dev, adev, acpi_target_system_state(), |
547 | d_max_in, d_min_p); | 563 | d_min_p, &d_max); |
564 | if (ret) | ||
565 | return ret; | ||
566 | |||
567 | if (d_max_in < *d_min_p) | ||
568 | return -EINVAL; | ||
569 | |||
570 | if (d_max > d_max_in) { | ||
571 | for (d_max = d_max_in; d_max > *d_min_p; d_max--) { | ||
572 | if (adev->power.states[d_max].flags.valid) | ||
573 | break; | ||
574 | } | ||
575 | } | ||
576 | return d_max; | ||
548 | } | 577 | } |
549 | EXPORT_SYMBOL(acpi_pm_device_sleep_state); | 578 | EXPORT_SYMBOL(acpi_pm_device_sleep_state); |
550 | 579 | ||
@@ -695,17 +724,13 @@ struct acpi_device *acpi_dev_pm_get_node(struct device *dev) | |||
695 | static int acpi_dev_pm_low_power(struct device *dev, struct acpi_device *adev, | 724 | static int acpi_dev_pm_low_power(struct device *dev, struct acpi_device *adev, |
696 | u32 system_state) | 725 | u32 system_state) |
697 | { | 726 | { |
698 | int power_state; | 727 | int ret, state; |
699 | 728 | ||
700 | if (!acpi_device_power_manageable(adev)) | 729 | if (!acpi_device_power_manageable(adev)) |
701 | return 0; | 730 | return 0; |
702 | 731 | ||
703 | power_state = acpi_device_power_state(dev, adev, system_state, | 732 | ret = acpi_dev_pm_get_state(dev, adev, system_state, NULL, &state); |
704 | ACPI_STATE_D3, NULL); | 733 | return ret ? ret : acpi_device_set_power(adev, state); |
705 | if (power_state < ACPI_STATE_D0 || power_state > ACPI_STATE_D3) | ||
706 | return -EIO; | ||
707 | |||
708 | return acpi_device_set_power(adev, power_state); | ||
709 | } | 734 | } |
710 | 735 | ||
711 | /** | 736 | /** |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index eb133c77aadb..0461ccc92c54 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -214,13 +214,13 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr, | |||
214 | #ifdef CONFIG_PM_SLEEP | 214 | #ifdef CONFIG_PM_SLEEP |
215 | static u32 saved_bm_rld; | 215 | static u32 saved_bm_rld; |
216 | 216 | ||
217 | int acpi_processor_suspend(void) | 217 | static int acpi_processor_suspend(void) |
218 | { | 218 | { |
219 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld); | 219 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld); |
220 | return 0; | 220 | return 0; |
221 | } | 221 | } |
222 | 222 | ||
223 | void acpi_processor_resume(void) | 223 | static void acpi_processor_resume(void) |
224 | { | 224 | { |
225 | u32 resumed_bm_rld; | 225 | u32 resumed_bm_rld; |
226 | 226 | ||
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 9c1a435d10e6..187ab61889e6 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -494,6 +494,8 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
494 | break; | 494 | break; |
495 | 495 | ||
496 | case ACPI_STATE_S3: | 496 | case ACPI_STATE_S3: |
497 | if (!acpi_suspend_lowlevel) | ||
498 | return -ENOSYS; | ||
497 | error = acpi_suspend_lowlevel(); | 499 | error = acpi_suspend_lowlevel(); |
498 | if (error) | 500 | if (error) |
499 | return error; | 501 | return error; |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index cf0817a555e4..cac0dfb2a082 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -461,8 +461,6 @@ acpi_status acpi_add_pm_notifier(struct acpi_device *adev, | |||
461 | acpi_notify_handler handler, void *context); | 461 | acpi_notify_handler handler, void *context); |
462 | acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, | 462 | acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, |
463 | acpi_notify_handler handler); | 463 | acpi_notify_handler handler); |
464 | int acpi_device_power_state(struct device *dev, struct acpi_device *adev, | ||
465 | u32 target_state, int d_max_in, int *d_min_p); | ||
466 | int acpi_pm_device_sleep_state(struct device *, int *, int); | 464 | int acpi_pm_device_sleep_state(struct device *, int *, int); |
467 | void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev); | 465 | void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev); |
468 | void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev); | 466 | void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev); |
@@ -478,23 +476,13 @@ static inline acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, | |||
478 | { | 476 | { |
479 | return AE_SUPPORT; | 477 | return AE_SUPPORT; |
480 | } | 478 | } |
481 | static inline int __acpi_device_power_state(int m, int *p) | 479 | static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m) |
482 | { | 480 | { |
483 | if (p) | 481 | if (p) |
484 | *p = ACPI_STATE_D0; | 482 | *p = ACPI_STATE_D0; |
483 | |||
485 | return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3) ? m : ACPI_STATE_D0; | 484 | return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3) ? m : ACPI_STATE_D0; |
486 | } | 485 | } |
487 | static inline int acpi_device_power_state(struct device *dev, | ||
488 | struct acpi_device *adev, | ||
489 | u32 target_state, int d_max_in, | ||
490 | int *d_min_p) | ||
491 | { | ||
492 | return __acpi_device_power_state(d_max_in, d_min_p); | ||
493 | } | ||
494 | static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m) | ||
495 | { | ||
496 | return __acpi_device_power_state(m, p); | ||
497 | } | ||
498 | static inline void acpi_dev_pm_add_dependent(acpi_handle handle, | 486 | static inline void acpi_dev_pm_add_dependent(acpi_handle handle, |
499 | struct device *depdev) {} | 487 | struct device *depdev) {} |
500 | static inline void acpi_dev_pm_remove_dependent(acpi_handle handle, | 488 | static inline void acpi_dev_pm_remove_dependent(acpi_handle handle, |
diff --git a/include/xen/acpi.h b/include/xen/acpi.h index 68d73d09b770..46aa3d1c1654 100644 --- a/include/xen/acpi.h +++ b/include/xen/acpi.h | |||
@@ -78,11 +78,25 @@ static inline int xen_acpi_get_pxm(acpi_handle h) | |||
78 | int xen_acpi_notify_hypervisor_state(u8 sleep_state, | 78 | int xen_acpi_notify_hypervisor_state(u8 sleep_state, |
79 | u32 pm1a_cnt, u32 pm1b_cnd); | 79 | u32 pm1a_cnt, u32 pm1b_cnd); |
80 | 80 | ||
81 | static inline int xen_acpi_suspend_lowlevel(void) | ||
82 | { | ||
83 | /* | ||
84 | * Xen will save and restore CPU context, so | ||
85 | * we can skip that and just go straight to | ||
86 | * the suspend. | ||
87 | */ | ||
88 | acpi_enter_sleep_state(ACPI_STATE_S3); | ||
89 | return 0; | ||
90 | } | ||
91 | |||
81 | static inline void xen_acpi_sleep_register(void) | 92 | static inline void xen_acpi_sleep_register(void) |
82 | { | 93 | { |
83 | if (xen_initial_domain()) | 94 | if (xen_initial_domain()) { |
84 | acpi_os_set_prepare_sleep( | 95 | acpi_os_set_prepare_sleep( |
85 | &xen_acpi_notify_hypervisor_state); | 96 | &xen_acpi_notify_hypervisor_state); |
97 | |||
98 | acpi_suspend_lowlevel = xen_acpi_suspend_lowlevel; | ||
99 | } | ||
86 | } | 100 | } |
87 | #else | 101 | #else |
88 | static inline void xen_acpi_sleep_register(void) | 102 | static inline void xen_acpi_sleep_register(void) |