Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Name: hwxfsleep.c - ACPI Hardware Sleep/Wake External Interfaces |
| 4 | * |
| 5 | *****************************************************************************/ |
| 6 | |
| 7 | /* |
Bob Moore | 25f044e | 2013-01-25 05:38:56 +0000 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 9 | * All rights reserved. |
| 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without |
| 12 | * modification, are permitted provided that the following conditions |
| 13 | * are met: |
| 14 | * 1. Redistributions of source code must retain the above copyright |
| 15 | * notice, this list of conditions, and the following disclaimer, |
| 16 | * without modification. |
| 17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer |
| 18 | * substantially similar to the "NO WARRANTY" disclaimer below |
| 19 | * ("Disclaimer") and any redistribution must be conditioned upon |
| 20 | * including a substantially similar Disclaimer requirement for further |
| 21 | * binary redistribution. |
| 22 | * 3. Neither the names of the above-listed copyright holders nor the names |
| 23 | * of any contributors may be used to endorse or promote products derived |
| 24 | * from this software without specific prior written permission. |
| 25 | * |
| 26 | * Alternatively, this software may be distributed under the terms of the |
| 27 | * GNU General Public License ("GPL") version 2 as published by the Free |
| 28 | * Software Foundation. |
| 29 | * |
| 30 | * NO WARRANTY |
| 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR |
| 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 41 | * POSSIBILITY OF SUCH DAMAGES. |
| 42 | */ |
| 43 | |
Lv Zheng | 739dcbb | 2012-12-20 01:07:26 +0000 | [diff] [blame] | 44 | #include <linux/export.h> |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 45 | #include <acpi/acpi.h> |
| 46 | #include "accommon.h" |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 47 | |
| 48 | #define _COMPONENT ACPI_HARDWARE |
| 49 | ACPI_MODULE_NAME("hwxfsleep") |
| 50 | |
Bob Moore | 72a8887 | 2012-02-14 18:57:13 +0800 | [diff] [blame] | 51 | /* Local prototypes */ |
Lv Zheng | 1f86e8c | 2012-10-31 02:25:45 +0000 | [diff] [blame] | 52 | static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id); |
Bob Moore | 72a8887 | 2012-02-14 18:57:13 +0800 | [diff] [blame] | 53 | |
| 54 | /* |
| 55 | * Dispatch table used to efficiently branch to the various sleep |
| 56 | * functions. |
| 57 | */ |
Lin Ming | 8a73b17 | 2012-03-21 10:01:49 +0800 | [diff] [blame] | 58 | #define ACPI_SLEEP_FUNCTION_ID 0 |
| 59 | #define ACPI_WAKE_PREP_FUNCTION_ID 1 |
| 60 | #define ACPI_WAKE_FUNCTION_ID 2 |
Bob Moore | 72a8887 | 2012-02-14 18:57:13 +0800 | [diff] [blame] | 61 | |
| 62 | /* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */ |
| 63 | |
| 64 | static struct acpi_sleep_functions acpi_sleep_dispatch[] = { |
| 65 | {ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_sleep), |
| 66 | acpi_hw_extended_sleep}, |
| 67 | {ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake_prep), |
| 68 | acpi_hw_extended_wake_prep}, |
| 69 | {ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake), acpi_hw_extended_wake} |
| 70 | }; |
| 71 | |
| 72 | /* |
| 73 | * These functions are removed for the ACPI_REDUCED_HARDWARE case: |
| 74 | * acpi_set_firmware_waking_vector |
| 75 | * acpi_set_firmware_waking_vector64 |
| 76 | * acpi_enter_sleep_state_s4bios |
| 77 | */ |
| 78 | |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 79 | #if (!ACPI_REDUCED_HARDWARE) |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 80 | /******************************************************************************* |
| 81 | * |
| 82 | * FUNCTION: acpi_set_firmware_waking_vector |
| 83 | * |
| 84 | * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode |
| 85 | * entry point. |
| 86 | * |
| 87 | * RETURN: Status |
| 88 | * |
| 89 | * DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS |
| 90 | * |
| 91 | ******************************************************************************/ |
Bob Moore | 72a8887 | 2012-02-14 18:57:13 +0800 | [diff] [blame] | 92 | |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 93 | acpi_status acpi_set_firmware_waking_vector(u32 physical_address) |
| 94 | { |
| 95 | ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); |
| 96 | |
| 97 | |
| 98 | /* |
| 99 | * According to the ACPI specification 2.0c and later, the 64-bit |
| 100 | * waking vector should be cleared and the 32-bit waking vector should |
| 101 | * be used, unless we want the wake-up code to be called by the BIOS in |
| 102 | * Protected Mode. Some systems (for example HP dv5-1004nr) are known |
| 103 | * to fail to resume if the 64-bit vector is used. |
| 104 | */ |
| 105 | |
| 106 | /* Set the 32-bit vector */ |
| 107 | |
| 108 | acpi_gbl_FACS->firmware_waking_vector = physical_address; |
| 109 | |
| 110 | /* Clear the 64-bit vector if it exists */ |
| 111 | |
| 112 | if ((acpi_gbl_FACS->length > 32) && (acpi_gbl_FACS->version >= 1)) { |
| 113 | acpi_gbl_FACS->xfirmware_waking_vector = 0; |
| 114 | } |
| 115 | |
| 116 | return_ACPI_STATUS(AE_OK); |
| 117 | } |
| 118 | |
| 119 | ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) |
| 120 | |
| 121 | #if ACPI_MACHINE_WIDTH == 64 |
| 122 | /******************************************************************************* |
| 123 | * |
| 124 | * FUNCTION: acpi_set_firmware_waking_vector64 |
| 125 | * |
| 126 | * PARAMETERS: physical_address - 64-bit physical address of ACPI protected |
| 127 | * mode entry point. |
| 128 | * |
| 129 | * RETURN: Status |
| 130 | * |
| 131 | * DESCRIPTION: Sets the 64-bit X_firmware_waking_vector field of the FACS, if |
| 132 | * it exists in the table. This function is intended for use with |
| 133 | * 64-bit host operating systems. |
| 134 | * |
| 135 | ******************************************************************************/ |
| 136 | acpi_status acpi_set_firmware_waking_vector64(u64 physical_address) |
| 137 | { |
| 138 | ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64); |
| 139 | |
| 140 | |
| 141 | /* Determine if the 64-bit vector actually exists */ |
| 142 | |
| 143 | if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) { |
| 144 | return_ACPI_STATUS(AE_NOT_EXIST); |
| 145 | } |
| 146 | |
| 147 | /* Clear 32-bit vector, set the 64-bit X_ vector */ |
| 148 | |
| 149 | acpi_gbl_FACS->firmware_waking_vector = 0; |
| 150 | acpi_gbl_FACS->xfirmware_waking_vector = physical_address; |
| 151 | return_ACPI_STATUS(AE_OK); |
| 152 | } |
| 153 | |
| 154 | ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64) |
| 155 | #endif |
| 156 | |
| 157 | /******************************************************************************* |
| 158 | * |
| 159 | * FUNCTION: acpi_enter_sleep_state_s4bios |
| 160 | * |
| 161 | * PARAMETERS: None |
| 162 | * |
| 163 | * RETURN: Status |
| 164 | * |
| 165 | * DESCRIPTION: Perform a S4 bios request. |
| 166 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED |
| 167 | * |
| 168 | ******************************************************************************/ |
| 169 | acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) |
| 170 | { |
| 171 | u32 in_value; |
| 172 | acpi_status status; |
| 173 | |
| 174 | ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_s4bios); |
| 175 | |
| 176 | /* Clear the wake status bit (PM1) */ |
| 177 | |
| 178 | status = |
| 179 | acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS); |
| 180 | if (ACPI_FAILURE(status)) { |
| 181 | return_ACPI_STATUS(status); |
| 182 | } |
| 183 | |
| 184 | status = acpi_hw_clear_acpi_status(); |
| 185 | if (ACPI_FAILURE(status)) { |
| 186 | return_ACPI_STATUS(status); |
| 187 | } |
| 188 | |
| 189 | /* |
| 190 | * 1) Disable/Clear all GPEs |
| 191 | * 2) Enable all wakeup GPEs |
| 192 | */ |
| 193 | status = acpi_hw_disable_all_gpes(); |
| 194 | if (ACPI_FAILURE(status)) { |
| 195 | return_ACPI_STATUS(status); |
| 196 | } |
| 197 | acpi_gbl_system_awake_and_running = FALSE; |
| 198 | |
| 199 | status = acpi_hw_enable_all_wakeup_gpes(); |
| 200 | if (ACPI_FAILURE(status)) { |
| 201 | return_ACPI_STATUS(status); |
| 202 | } |
| 203 | |
| 204 | ACPI_FLUSH_CPU_CACHE(); |
| 205 | |
| 206 | status = acpi_hw_write_port(acpi_gbl_FADT.smi_command, |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 207 | (u32)acpi_gbl_FADT.s4_bios_request, 8); |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 208 | |
| 209 | do { |
Bob Moore | c41679a | 2012-12-31 00:05:46 +0000 | [diff] [blame] | 210 | acpi_os_stall(ACPI_USEC_PER_MSEC); |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 211 | status = |
| 212 | acpi_read_bit_register(ACPI_BITREG_WAKE_STATUS, &in_value); |
| 213 | if (ACPI_FAILURE(status)) { |
| 214 | return_ACPI_STATUS(status); |
| 215 | } |
| 216 | } while (!in_value); |
| 217 | |
| 218 | return_ACPI_STATUS(AE_OK); |
| 219 | } |
| 220 | |
| 221 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios) |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 222 | #endif /* !ACPI_REDUCED_HARDWARE */ |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 223 | /******************************************************************************* |
| 224 | * |
Bob Moore | 72a8887 | 2012-02-14 18:57:13 +0800 | [diff] [blame] | 225 | * FUNCTION: acpi_hw_sleep_dispatch |
| 226 | * |
| 227 | * PARAMETERS: sleep_state - Which sleep state to enter/exit |
| 228 | * function_id - Sleep, wake_prep, or Wake |
| 229 | * |
| 230 | * RETURN: Status from the invoked sleep handling function. |
| 231 | * |
| 232 | * DESCRIPTION: Dispatch a sleep/wake request to the appropriate handling |
| 233 | * function. |
| 234 | * |
| 235 | ******************************************************************************/ |
Lv Zheng | 1f86e8c | 2012-10-31 02:25:45 +0000 | [diff] [blame] | 236 | static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id) |
Bob Moore | 72a8887 | 2012-02-14 18:57:13 +0800 | [diff] [blame] | 237 | { |
| 238 | acpi_status status; |
| 239 | struct acpi_sleep_functions *sleep_functions = |
| 240 | &acpi_sleep_dispatch[function_id]; |
| 241 | |
| 242 | #if (!ACPI_REDUCED_HARDWARE) |
| 243 | |
| 244 | /* |
| 245 | * If the Hardware Reduced flag is set (from the FADT), we must |
| 246 | * use the extended sleep registers |
| 247 | */ |
| 248 | if (acpi_gbl_reduced_hardware || acpi_gbl_FADT.sleep_control.address) { |
Len Brown | 3f6f49c | 2012-07-26 20:08:54 -0400 | [diff] [blame] | 249 | status = sleep_functions->extended_function(sleep_state); |
Bob Moore | 72a8887 | 2012-02-14 18:57:13 +0800 | [diff] [blame] | 250 | } else { |
| 251 | /* Legacy sleep */ |
| 252 | |
Len Brown | 3f6f49c | 2012-07-26 20:08:54 -0400 | [diff] [blame] | 253 | status = sleep_functions->legacy_function(sleep_state); |
Bob Moore | 72a8887 | 2012-02-14 18:57:13 +0800 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | return (status); |
| 257 | |
| 258 | #else |
| 259 | /* |
| 260 | * For the case where reduced-hardware-only code is being generated, |
| 261 | * we know that only the extended sleep registers are available |
| 262 | */ |
Len Brown | 3f6f49c | 2012-07-26 20:08:54 -0400 | [diff] [blame] | 263 | status = sleep_functions->extended_function(sleep_state); |
Bob Moore | 72a8887 | 2012-02-14 18:57:13 +0800 | [diff] [blame] | 264 | return (status); |
| 265 | |
| 266 | #endif /* !ACPI_REDUCED_HARDWARE */ |
| 267 | } |
| 268 | |
| 269 | /******************************************************************************* |
| 270 | * |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 271 | * FUNCTION: acpi_enter_sleep_state_prep |
| 272 | * |
| 273 | * PARAMETERS: sleep_state - Which sleep state to enter |
| 274 | * |
| 275 | * RETURN: Status |
| 276 | * |
Bob Moore | 72a8887 | 2012-02-14 18:57:13 +0800 | [diff] [blame] | 277 | * DESCRIPTION: Prepare to enter a system sleep state. |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 278 | * This function must execute with interrupts enabled. |
| 279 | * We break sleeping into 2 stages so that OSPM can handle |
| 280 | * various OS-specific tasks between the two steps. |
| 281 | * |
| 282 | ******************************************************************************/ |
Bob Moore | 72a8887 | 2012-02-14 18:57:13 +0800 | [diff] [blame] | 283 | |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 284 | acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) |
| 285 | { |
| 286 | acpi_status status; |
| 287 | struct acpi_object_list arg_list; |
| 288 | union acpi_object arg; |
| 289 | u32 sst_value; |
| 290 | |
| 291 | ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_prep); |
| 292 | |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 293 | status = acpi_get_sleep_type_data(sleep_state, |
| 294 | &acpi_gbl_sleep_type_a, |
| 295 | &acpi_gbl_sleep_type_b); |
| 296 | if (ACPI_FAILURE(status)) { |
| 297 | return_ACPI_STATUS(status); |
| 298 | } |
| 299 | |
| 300 | /* Execute the _PTS method (Prepare To Sleep) */ |
| 301 | |
| 302 | arg_list.count = 1; |
| 303 | arg_list.pointer = &arg; |
| 304 | arg.type = ACPI_TYPE_INTEGER; |
| 305 | arg.integer.value = sleep_state; |
| 306 | |
Bob Moore | 4efeeec | 2012-03-21 09:42:45 +0800 | [diff] [blame] | 307 | status = |
| 308 | acpi_evaluate_object(NULL, METHOD_PATHNAME__PTS, &arg_list, NULL); |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 309 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { |
| 310 | return_ACPI_STATUS(status); |
| 311 | } |
| 312 | |
| 313 | /* Setup the argument to the _SST method (System STatus) */ |
| 314 | |
| 315 | switch (sleep_state) { |
| 316 | case ACPI_STATE_S0: |
Chao Guan | 1d1ea1b | 2013-06-08 00:58:14 +0000 | [diff] [blame^] | 317 | |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 318 | sst_value = ACPI_SST_WORKING; |
| 319 | break; |
| 320 | |
| 321 | case ACPI_STATE_S1: |
| 322 | case ACPI_STATE_S2: |
| 323 | case ACPI_STATE_S3: |
Chao Guan | 1d1ea1b | 2013-06-08 00:58:14 +0000 | [diff] [blame^] | 324 | |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 325 | sst_value = ACPI_SST_SLEEPING; |
| 326 | break; |
| 327 | |
| 328 | case ACPI_STATE_S4: |
Chao Guan | 1d1ea1b | 2013-06-08 00:58:14 +0000 | [diff] [blame^] | 329 | |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 330 | sst_value = ACPI_SST_SLEEP_CONTEXT; |
| 331 | break; |
| 332 | |
| 333 | default: |
Chao Guan | 1d1ea1b | 2013-06-08 00:58:14 +0000 | [diff] [blame^] | 334 | |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 335 | sst_value = ACPI_SST_INDICATOR_OFF; /* Default is off */ |
| 336 | break; |
| 337 | } |
| 338 | |
| 339 | /* |
| 340 | * Set the system indicators to show the desired sleep state. |
| 341 | * _SST is an optional method (return no error if not found) |
| 342 | */ |
Bob Moore | 4efeeec | 2012-03-21 09:42:45 +0800 | [diff] [blame] | 343 | acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, sst_value); |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 344 | return_ACPI_STATUS(AE_OK); |
| 345 | } |
| 346 | |
| 347 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) |
| 348 | |
| 349 | /******************************************************************************* |
| 350 | * |
| 351 | * FUNCTION: acpi_enter_sleep_state |
| 352 | * |
| 353 | * PARAMETERS: sleep_state - Which sleep state to enter |
| 354 | * |
| 355 | * RETURN: Status |
| 356 | * |
Lv Zheng | 75c8044 | 2012-12-19 05:36:49 +0000 | [diff] [blame] | 357 | * DESCRIPTION: Enter a system sleep state |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 358 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED |
| 359 | * |
| 360 | ******************************************************************************/ |
Len Brown | 3f6f49c | 2012-07-26 20:08:54 -0400 | [diff] [blame] | 361 | acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 362 | { |
| 363 | acpi_status status; |
| 364 | |
| 365 | ACPI_FUNCTION_TRACE(acpi_enter_sleep_state); |
| 366 | |
| 367 | if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) || |
| 368 | (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) { |
| 369 | ACPI_ERROR((AE_INFO, "Sleep values out of range: A=0x%X B=0x%X", |
| 370 | acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b)); |
| 371 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); |
| 372 | } |
| 373 | |
Lv Zheng | 1f86e8c | 2012-10-31 02:25:45 +0000 | [diff] [blame] | 374 | status = acpi_hw_sleep_dispatch(sleep_state, ACPI_SLEEP_FUNCTION_ID); |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 375 | return_ACPI_STATUS(status); |
| 376 | } |
| 377 | |
| 378 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state) |
| 379 | |
| 380 | /******************************************************************************* |
| 381 | * |
| 382 | * FUNCTION: acpi_leave_sleep_state_prep |
| 383 | * |
| 384 | * PARAMETERS: sleep_state - Which sleep state we are exiting |
| 385 | * |
| 386 | * RETURN: Status |
| 387 | * |
| 388 | * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a |
Lv Zheng | 75c8044 | 2012-12-19 05:36:49 +0000 | [diff] [blame] | 389 | * sleep. Called with interrupts DISABLED. |
| 390 | * We break wake/resume into 2 stages so that OSPM can handle |
| 391 | * various OS-specific tasks between the two steps. |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 392 | * |
| 393 | ******************************************************************************/ |
Len Brown | 3f6f49c | 2012-07-26 20:08:54 -0400 | [diff] [blame] | 394 | acpi_status acpi_leave_sleep_state_prep(u8 sleep_state) |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 395 | { |
| 396 | acpi_status status; |
| 397 | |
Bob Moore | 72a8887 | 2012-02-14 18:57:13 +0800 | [diff] [blame] | 398 | ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep); |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 399 | |
Lin Ming | 8a73b17 | 2012-03-21 10:01:49 +0800 | [diff] [blame] | 400 | status = |
Lv Zheng | 1f86e8c | 2012-10-31 02:25:45 +0000 | [diff] [blame] | 401 | acpi_hw_sleep_dispatch(sleep_state, ACPI_WAKE_PREP_FUNCTION_ID); |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 402 | return_ACPI_STATUS(status); |
| 403 | } |
| 404 | |
| 405 | ACPI_EXPORT_SYMBOL(acpi_leave_sleep_state_prep) |
| 406 | |
| 407 | /******************************************************************************* |
| 408 | * |
| 409 | * FUNCTION: acpi_leave_sleep_state |
| 410 | * |
Bob Moore | 72a8887 | 2012-02-14 18:57:13 +0800 | [diff] [blame] | 411 | * PARAMETERS: sleep_state - Which sleep state we are exiting |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 412 | * |
| 413 | * RETURN: Status |
| 414 | * |
| 415 | * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep |
| 416 | * Called with interrupts ENABLED. |
| 417 | * |
| 418 | ******************************************************************************/ |
| 419 | acpi_status acpi_leave_sleep_state(u8 sleep_state) |
| 420 | { |
| 421 | acpi_status status; |
| 422 | |
| 423 | ACPI_FUNCTION_TRACE(acpi_leave_sleep_state); |
| 424 | |
Len Brown | 3f6f49c | 2012-07-26 20:08:54 -0400 | [diff] [blame] | 425 | status = acpi_hw_sleep_dispatch(sleep_state, ACPI_WAKE_FUNCTION_ID); |
Bob Moore | 2feec47 | 2012-02-14 15:00:53 +0800 | [diff] [blame] | 426 | return_ACPI_STATUS(status); |
| 427 | } |
| 428 | |
| 429 | ACPI_EXPORT_SYMBOL(acpi_leave_sleep_state) |