Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPICA: ACPI 5: Support for new FADT SleepStatus, SleepControl registers

Adds sleep and wake support for systems with these registers.
One new file, hwxfsleep.c

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>

authored by

Bob Moore and committed by
Len Brown
2feec47d 384fe875

+752 -320
+2 -1
drivers/acpi/acpica/Makefile
··· 73 73 hwregs.o \ 74 74 hwsleep.o \ 75 75 hwvalid.o \ 76 - hwxface.o 76 + hwxface.o \ 77 + hwxfsleep.o 77 78 78 79 acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o 79 80
+17
drivers/acpi/acpica/achware.h
··· 81 81 acpi_status acpi_hw_clear_acpi_status(void); 82 82 83 83 /* 84 + * hwsleep - sleep/wake support 85 + */ 86 + void acpi_hw_execute_SST(u32 value); 87 + 88 + acpi_status acpi_hw_extended_sleep(u8 sleep_state); 89 + 90 + acpi_status acpi_hw_legacy_sleep(u8 sleep_state); 91 + 92 + acpi_status acpi_hw_extended_wake_prep(u8 sleep_state); 93 + 94 + acpi_status acpi_hw_extended_wake(u8 sleep_state); 95 + 96 + acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state); 97 + 98 + acpi_status acpi_hw_legacy_wake(u8 sleep_state); 99 + 100 + /* 84 101 * hwvalid - Port I/O with validation 85 102 */ 86 103 acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width);
+349 -319
drivers/acpi/acpica/hwsleep.c
··· 1 - 2 1 /****************************************************************************** 3 2 * 4 - * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface 3 + * Name: hwsleep.c - ACPI Hardware Sleep/Wake Support Functions 5 4 * 6 5 *****************************************************************************/ 7 6 ··· 43 44 44 45 #include <acpi/acpi.h> 45 46 #include "accommon.h" 46 - #include "actables.h" 47 47 #include <linux/tboot.h> 48 48 #include <linux/module.h> 49 49 50 50 #define _COMPONENT ACPI_HARDWARE 51 51 ACPI_MODULE_NAME("hwsleep") 52 52 53 - /******************************************************************************* 54 - * 55 - * FUNCTION: acpi_set_firmware_waking_vector 56 - * 57 - * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode 58 - * entry point. 59 - * 60 - * RETURN: Status 61 - * 62 - * DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS 63 - * 64 - ******************************************************************************/ 65 - acpi_status 66 - acpi_set_firmware_waking_vector(u32 physical_address) 67 - { 68 - ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); 53 + /* Local prototypes */ 54 + static void acpi_hw_execute_GTS(u8 sleep_state); 69 55 56 + static void acpi_hw_execute_BFS(u8 sleep_state); 70 57 71 - /* 72 - * According to the ACPI specification 2.0c and later, the 64-bit 73 - * waking vector should be cleared and the 32-bit waking vector should 74 - * be used, unless we want the wake-up code to be called by the BIOS in 75 - * Protected Mode. Some systems (for example HP dv5-1004nr) are known 76 - * to fail to resume if the 64-bit vector is used. 77 - */ 78 - 79 - /* Set the 32-bit vector */ 80 - 81 - acpi_gbl_FACS->firmware_waking_vector = physical_address; 82 - 83 - /* Clear the 64-bit vector if it exists */ 84 - 85 - if ((acpi_gbl_FACS->length > 32) && (acpi_gbl_FACS->version >= 1)) { 86 - acpi_gbl_FACS->xfirmware_waking_vector = 0; 87 - } 88 - 89 - return_ACPI_STATUS(AE_OK); 90 - } 91 - 92 - ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) 93 - 94 - #if ACPI_MACHINE_WIDTH == 64 95 - /******************************************************************************* 96 - * 97 - * FUNCTION: acpi_set_firmware_waking_vector64 98 - * 99 - * PARAMETERS: physical_address - 64-bit physical address of ACPI protected 100 - * mode entry point. 101 - * 102 - * RETURN: Status 103 - * 104 - * DESCRIPTION: Sets the 64-bit X_firmware_waking_vector field of the FACS, if 105 - * it exists in the table. This function is intended for use with 106 - * 64-bit host operating systems. 107 - * 108 - ******************************************************************************/ 109 - acpi_status 110 - acpi_set_firmware_waking_vector64(u64 physical_address) 111 - { 112 - ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64); 113 - 114 - 115 - /* Determine if the 64-bit vector actually exists */ 116 - 117 - if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) { 118 - return_ACPI_STATUS(AE_NOT_EXIST); 119 - } 120 - 121 - /* Clear 32-bit vector, set the 64-bit X_ vector */ 122 - 123 - acpi_gbl_FACS->firmware_waking_vector = 0; 124 - acpi_gbl_FACS->xfirmware_waking_vector = physical_address; 125 - 126 - return_ACPI_STATUS(AE_OK); 127 - } 128 - 129 - ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64) 130 - #endif 131 - 132 - /******************************************************************************* 133 - * 134 - * FUNCTION: acpi_enter_sleep_state_prep 135 - * 136 - * PARAMETERS: sleep_state - Which sleep state to enter 137 - * 138 - * RETURN: Status 139 - * 140 - * DESCRIPTION: Prepare to enter a system sleep state (see ACPI 2.0 spec p 231) 141 - * This function must execute with interrupts enabled. 142 - * We break sleeping into 2 stages so that OSPM can handle 143 - * various OS-specific tasks between the two steps. 144 - * 145 - ******************************************************************************/ 146 - acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) 147 - { 148 - acpi_status status; 149 - struct acpi_object_list arg_list; 150 - union acpi_object arg; 151 - 152 - ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_prep); 153 - 154 - /* _PSW methods could be run here to enable wake-on keyboard, LAN, etc. */ 155 - 156 - status = acpi_get_sleep_type_data(sleep_state, 157 - &acpi_gbl_sleep_type_a, 158 - &acpi_gbl_sleep_type_b); 159 - if (ACPI_FAILURE(status)) { 160 - return_ACPI_STATUS(status); 161 - } 162 - 163 - /* Setup parameter object */ 164 - 165 - arg_list.count = 1; 166 - arg_list.pointer = &arg; 167 - 168 - arg.type = ACPI_TYPE_INTEGER; 169 - arg.integer.value = sleep_state; 170 - 171 - /* Run the _PTS method */ 172 - 173 - status = acpi_evaluate_object(NULL, METHOD_NAME__PTS, &arg_list, NULL); 174 - if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 175 - return_ACPI_STATUS(status); 176 - } 177 - 178 - /* Setup the argument to _SST */ 179 - 180 - switch (sleep_state) { 181 - case ACPI_STATE_S0: 182 - arg.integer.value = ACPI_SST_WORKING; 183 - break; 184 - 185 - case ACPI_STATE_S1: 186 - case ACPI_STATE_S2: 187 - case ACPI_STATE_S3: 188 - arg.integer.value = ACPI_SST_SLEEPING; 189 - break; 190 - 191 - case ACPI_STATE_S4: 192 - arg.integer.value = ACPI_SST_SLEEP_CONTEXT; 193 - break; 194 - 195 - default: 196 - arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is off */ 197 - break; 198 - } 199 - 200 - /* 201 - * Set the system indicators to show the desired sleep state. 202 - * _SST is an optional method (return no error if not found) 203 - */ 204 - status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL); 205 - if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 206 - ACPI_EXCEPTION((AE_INFO, status, 207 - "While executing method _SST")); 208 - } 209 - 210 - return_ACPI_STATUS(AE_OK); 211 - } 212 - 213 - ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) 58 + static void acpi_hw_execute_WAK(u8 sleep_state); 214 59 215 60 static unsigned int gts, bfs; 216 61 module_param(gts, uint, 0644); ··· 64 221 65 222 /******************************************************************************* 66 223 * 67 - * FUNCTION: acpi_enter_sleep_state 224 + * FUNCTION: acpi_hw_execute_GTS 225 + * 226 + * PARAMETERS: sleep_state - Sleep state that will be entered 227 + * 228 + * RETURN: None 229 + * 230 + * DESCRIPTION: Execute the optional _GTS method (Going To Sleep) 231 + * 232 + ******************************************************************************/ 233 + 234 + static void acpi_hw_execute_GTS(u8 sleep_state) 235 + { 236 + struct acpi_object_list arg_list; 237 + union acpi_object arg; 238 + acpi_status status; 239 + 240 + if (!gts) 241 + return; 242 + 243 + /* One argument, sleep_state */ 244 + 245 + arg_list.count = 1; 246 + arg_list.pointer = &arg; 247 + arg.type = ACPI_TYPE_INTEGER; 248 + arg.integer.value = sleep_state; 249 + 250 + status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL); 251 + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 252 + ACPI_EXCEPTION((AE_INFO, status, 253 + "While executing method _GTS")); 254 + } 255 + } 256 + 257 + /******************************************************************************* 258 + * 259 + * FUNCTION: acpi_hw_execute_BFS 260 + * 261 + * PARAMETERS: sleep_state - Which sleep state we just exited 262 + * 263 + * RETURN: None 264 + * 265 + * DESCRIPTION: Execute the optional _BFS method (Back From Sleep) 266 + * 267 + ******************************************************************************/ 268 + 269 + static void acpi_hw_execute_BFS(u8 sleep_state) 270 + { 271 + struct acpi_object_list arg_list; 272 + union acpi_object arg; 273 + acpi_status status; 274 + 275 + if (!bfs) 276 + return; 277 + 278 + /* One argument, sleep_state */ 279 + 280 + arg_list.count = 1; 281 + arg_list.pointer = &arg; 282 + arg.type = ACPI_TYPE_INTEGER; 283 + arg.integer.value = sleep_state; 284 + 285 + status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL); 286 + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 287 + ACPI_EXCEPTION((AE_INFO, status, 288 + "While executing method _BFS")); 289 + } 290 + } 291 + 292 + /******************************************************************************* 293 + * 294 + * FUNCTION: acpi_hw_execute_WAK 295 + * 296 + * PARAMETERS: sleep_state - Which sleep state we just exited 297 + * 298 + * RETURN: None 299 + * 300 + * DESCRIPTION: Execute the _WAK method (System Wake) 301 + * 302 + ******************************************************************************/ 303 + 304 + static void acpi_hw_execute_WAK(u8 sleep_state) 305 + { 306 + struct acpi_object_list arg_list; 307 + union acpi_object arg; 308 + acpi_status status; 309 + 310 + /* One argument, sleep_state */ 311 + 312 + arg_list.count = 1; 313 + arg_list.pointer = &arg; 314 + arg.type = ACPI_TYPE_INTEGER; 315 + arg.integer.value = sleep_state; 316 + 317 + status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL); 318 + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 319 + ACPI_EXCEPTION((AE_INFO, status, 320 + "While executing method _WAK")); 321 + } 322 + /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ 323 + } 324 + 325 + /******************************************************************************* 326 + * 327 + * FUNCTION: acpi_hw_execute_SST 328 + * 329 + * PARAMETERS: indicator_id - Value to be passed to the _SST method 330 + * 331 + * RETURN: None 332 + * 333 + * DESCRIPTION: Execute the optional _SST method (System Status) 334 + * 335 + ******************************************************************************/ 336 + 337 + void acpi_hw_execute_SST(u32 indicator_id) 338 + { 339 + struct acpi_object_list arg_list; 340 + union acpi_object arg; 341 + acpi_status status; 342 + 343 + /* One argument, status indicator ID */ 344 + 345 + arg_list.count = 1; 346 + arg_list.pointer = &arg; 347 + arg.type = ACPI_TYPE_INTEGER; 348 + 349 + arg.integer.value = indicator_id; 350 + status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL); 351 + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 352 + ACPI_EXCEPTION((AE_INFO, status, 353 + "While executing method _SST")); 354 + } 355 + } 356 + 357 + /******************************************************************************* 358 + * 359 + * FUNCTION: acpi_hw_legacy_sleep 68 360 * 69 361 * PARAMETERS: sleep_state - Which sleep state to enter 70 362 * 71 363 * RETURN: Status 72 364 * 73 - * DESCRIPTION: Enter a system sleep state (see ACPI 2.0 spec p 231) 365 + * DESCRIPTION: Enter a system sleep state via the legacy FADT PM registers 74 366 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED 75 367 * 76 368 ******************************************************************************/ 77 - acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) 369 + 370 + acpi_status acpi_hw_legacy_sleep(u8 sleep_state) 78 371 { 79 - u32 pm1a_control; 80 - u32 pm1b_control; 81 372 struct acpi_bit_register_info *sleep_type_reg_info; 82 373 struct acpi_bit_register_info *sleep_enable_reg_info; 374 + u32 pm1a_control; 375 + u32 pm1b_control; 83 376 u32 in_value; 84 - struct acpi_object_list arg_list; 85 - union acpi_object arg; 86 377 acpi_status status; 87 378 88 - ACPI_FUNCTION_TRACE(acpi_enter_sleep_state); 89 - 90 - if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) || 91 - (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) { 92 - ACPI_ERROR((AE_INFO, "Sleep values out of range: A=0x%X B=0x%X", 93 - acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b)); 94 - return_ACPI_STATUS(AE_AML_OPERAND_VALUE); 95 - } 379 + ACPI_FUNCTION_TRACE(hw_legacy_sleep); 96 380 97 381 sleep_type_reg_info = 98 382 acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE); ··· 241 271 return_ACPI_STATUS(status); 242 272 } 243 273 274 + if (sleep_state != ACPI_STATE_S5) { 275 + /* 276 + * Disable BM arbitration. This feature is contained within an 277 + * optional register (PM2 Control), so ignore a BAD_ADDRESS 278 + * exception. 279 + */ 280 + status = acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 1); 281 + if (ACPI_FAILURE(status) && (status != AE_BAD_ADDRESS)) { 282 + return_ACPI_STATUS(status); 283 + } 284 + } 285 + 244 286 /* 245 287 * 1) Disable/Clear all GPEs 246 288 * 2) Enable all wakeup GPEs ··· 268 286 return_ACPI_STATUS(status); 269 287 } 270 288 271 - if (gts) { 272 - /* Execute the _GTS method */ 289 + /* Execute the _GTS method (Going To Sleep) */ 273 290 274 - arg_list.count = 1; 275 - arg_list.pointer = &arg; 276 - arg.type = ACPI_TYPE_INTEGER; 277 - arg.integer.value = sleep_state; 278 - 279 - status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL); 280 - if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 281 - return_ACPI_STATUS(status); 282 - } 283 - } 291 + acpi_hw_execute_GTS(sleep_state); 284 292 285 293 /* Get current value of PM1A control */ 286 294 ··· 347 375 } 348 376 } 349 377 350 - /* Wait until we enter sleep state */ 378 + /* Wait for transition back to Working State */ 351 379 352 380 do { 353 - status = acpi_read_bit_register(ACPI_BITREG_WAKE_STATUS, 354 - &in_value); 355 - if (ACPI_FAILURE(status)) { 356 - return_ACPI_STATUS(status); 357 - } 358 - 359 - /* Spin until we wake */ 360 - 361 - } while (!in_value); 362 - 363 - return_ACPI_STATUS(AE_OK); 364 - } 365 - 366 - ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state) 367 - 368 - /******************************************************************************* 369 - * 370 - * FUNCTION: acpi_enter_sleep_state_s4bios 371 - * 372 - * PARAMETERS: None 373 - * 374 - * RETURN: Status 375 - * 376 - * DESCRIPTION: Perform a S4 bios request. 377 - * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED 378 - * 379 - ******************************************************************************/ 380 - acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) 381 - { 382 - u32 in_value; 383 - acpi_status status; 384 - 385 - ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_s4bios); 386 - 387 - /* Clear the wake status bit (PM1) */ 388 - 389 - status = 390 - acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS); 391 - if (ACPI_FAILURE(status)) { 392 - return_ACPI_STATUS(status); 393 - } 394 - 395 - status = acpi_hw_clear_acpi_status(); 396 - if (ACPI_FAILURE(status)) { 397 - return_ACPI_STATUS(status); 398 - } 399 - 400 - /* 401 - * 1) Disable/Clear all GPEs 402 - * 2) Enable all wakeup GPEs 403 - */ 404 - status = acpi_hw_disable_all_gpes(); 405 - if (ACPI_FAILURE(status)) { 406 - return_ACPI_STATUS(status); 407 - } 408 - acpi_gbl_system_awake_and_running = FALSE; 409 - 410 - status = acpi_hw_enable_all_wakeup_gpes(); 411 - if (ACPI_FAILURE(status)) { 412 - return_ACPI_STATUS(status); 413 - } 414 - 415 - ACPI_FLUSH_CPU_CACHE(); 416 - 417 - status = acpi_hw_write_port(acpi_gbl_FADT.smi_command, 418 - (u32) acpi_gbl_FADT.S4bios_request, 8); 419 - 420 - do { 421 - acpi_os_stall(1000); 422 381 status = 423 382 acpi_read_bit_register(ACPI_BITREG_WAKE_STATUS, &in_value); 424 383 if (ACPI_FAILURE(status)) { 425 384 return_ACPI_STATUS(status); 426 385 } 386 + 427 387 } while (!in_value); 428 388 429 389 return_ACPI_STATUS(AE_OK); 430 390 } 431 391 432 - ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios) 433 - 434 392 /******************************************************************************* 435 393 * 436 - * FUNCTION: acpi_leave_sleep_state_prep 394 + * FUNCTION: acpi_hw_legacy_wake_prep 437 395 * 438 - * PARAMETERS: sleep_state - Which sleep state we are exiting 396 + * PARAMETERS: sleep_state - Which sleep state we just exited 439 397 * 440 398 * RETURN: Status 441 399 * 442 400 * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a 443 401 * sleep. 444 - * Called with interrupts DISABLED. 402 + * Called with interrupts ENABLED. 445 403 * 446 404 ******************************************************************************/ 447 - acpi_status acpi_leave_sleep_state_prep(u8 sleep_state) 405 + 406 + acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state) 448 407 { 449 - struct acpi_object_list arg_list; 450 - union acpi_object arg; 451 408 acpi_status status; 452 409 struct acpi_bit_register_info *sleep_type_reg_info; 453 410 struct acpi_bit_register_info *sleep_enable_reg_info; 454 411 u32 pm1a_control; 455 412 u32 pm1b_control; 456 413 457 - ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep); 414 + ACPI_FUNCTION_TRACE(hw_legacy_wake_prep); 458 415 459 416 /* 460 417 * Set SLP_TYPE and SLP_EN to state S0. ··· 426 525 } 427 526 } 428 527 429 - if (bfs) { 430 - /* Execute the _BFS method */ 431 - 432 - arg_list.count = 1; 433 - arg_list.pointer = &arg; 434 - arg.type = ACPI_TYPE_INTEGER; 435 - arg.integer.value = sleep_state; 436 - 437 - status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL); 438 - if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 439 - ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS")); 440 - } 441 - } 528 + acpi_hw_execute_BFS(sleep_state); 442 529 return_ACPI_STATUS(status); 443 530 } 444 531 445 532 /******************************************************************************* 446 533 * 447 - * FUNCTION: acpi_leave_sleep_state 534 + * FUNCTION: acpi_hw_legacy_wake 448 535 * 449 536 * PARAMETERS: sleep_state - Which sleep state we just exited 450 537 * ··· 442 553 * Called with interrupts ENABLED. 443 554 * 444 555 ******************************************************************************/ 445 - acpi_status acpi_leave_sleep_state(u8 sleep_state) 556 + 557 + acpi_status acpi_hw_legacy_wake(u8 sleep_state) 446 558 { 447 - struct acpi_object_list arg_list; 448 - union acpi_object arg; 449 559 acpi_status status; 450 560 451 - ACPI_FUNCTION_TRACE(acpi_leave_sleep_state); 561 + ACPI_FUNCTION_TRACE(hw_legacy_wake); 452 562 453 563 /* Ensure enter_sleep_state_prep -> enter_sleep_state ordering */ 454 564 455 565 acpi_gbl_sleep_type_a = ACPI_SLEEP_TYPE_INVALID; 456 - 457 - /* Setup parameter object */ 458 - 459 - arg_list.count = 1; 460 - arg_list.pointer = &arg; 461 - arg.type = ACPI_TYPE_INTEGER; 462 - 463 - /* Ignore any errors from these methods */ 464 - 465 - arg.integer.value = ACPI_SST_WAKING; 466 - status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL); 467 - if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 468 - ACPI_EXCEPTION((AE_INFO, status, "During Method _SST")); 469 - } 566 + acpi_hw_execute_SST(ACPI_SST_WAKING); 470 567 471 568 /* 472 569 * GPEs must be enabled before _WAK is called as GPEs ··· 466 591 if (ACPI_FAILURE(status)) { 467 592 return_ACPI_STATUS(status); 468 593 } 594 + 469 595 status = acpi_hw_enable_all_runtime_gpes(); 470 596 if (ACPI_FAILURE(status)) { 471 597 return_ACPI_STATUS(status); 472 598 } 473 599 474 - arg.integer.value = sleep_state; 475 - status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL); 476 - if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 477 - ACPI_EXCEPTION((AE_INFO, status, "During Method _WAK")); 478 - } 479 - /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ 600 + /* 601 + * Now we can execute _WAK, etc. Some machines require that the GPEs 602 + * are enabled before the wake methods are executed. 603 + */ 604 + acpi_hw_execute_WAK(sleep_state); 480 605 481 606 /* 482 - * Some BIOSes assume that WAK_STS will be cleared on resume and use 483 - * it to determine whether the system is rebooting or resuming. Clear 484 - * it for compatibility. 607 + * Some BIOS code assumes that WAK_STS will be cleared on resume 608 + * and use it to determine whether the system is rebooting or 609 + * resuming. Clear WAK_STS for compatibility. 485 610 */ 486 611 acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, 1); 487 - 488 612 acpi_gbl_system_awake_and_running = TRUE; 489 613 490 614 /* Enable power button */ 491 615 492 616 (void) 493 617 acpi_write_bit_register(acpi_gbl_fixed_event_info 494 - [ACPI_EVENT_POWER_BUTTON]. 495 - enable_register_id, ACPI_ENABLE_EVENT); 618 + [ACPI_EVENT_POWER_BUTTON]. 619 + enable_register_id, ACPI_ENABLE_EVENT); 496 620 497 621 (void) 498 622 acpi_write_bit_register(acpi_gbl_fixed_event_info 499 - [ACPI_EVENT_POWER_BUTTON]. 500 - status_register_id, ACPI_CLEAR_STATUS); 623 + [ACPI_EVENT_POWER_BUTTON]. 624 + status_register_id, ACPI_CLEAR_STATUS); 501 625 502 - arg.integer.value = ACPI_SST_WORKING; 503 - status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL); 504 - if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 505 - ACPI_EXCEPTION((AE_INFO, status, "During Method _SST")); 626 + /* 627 + * Enable BM arbitration. This feature is contained within an 628 + * optional register (PM2 Control), so ignore a BAD_ADDRESS 629 + * exception. 630 + */ 631 + status = acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0); 632 + if (ACPI_FAILURE(status) && (status != AE_BAD_ADDRESS)) { 633 + return_ACPI_STATUS(status); 506 634 } 507 635 636 + acpi_hw_execute_SST(ACPI_SST_WORKING); 508 637 return_ACPI_STATUS(status); 509 638 } 510 639 511 - ACPI_EXPORT_SYMBOL(acpi_leave_sleep_state) 640 + 641 + /******************************************************************************* 642 + * 643 + * FUNCTION: acpi_hw_extended_sleep 644 + * 645 + * PARAMETERS: sleep_state - Which sleep state to enter 646 + * 647 + * RETURN: Status 648 + * 649 + * DESCRIPTION: Enter a system sleep state via the extended FADT sleep 650 + * registers (V5 FADT). 651 + * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED 652 + * 653 + ******************************************************************************/ 654 + 655 + acpi_status acpi_hw_extended_sleep(u8 sleep_state) 656 + { 657 + acpi_status status; 658 + u8 sleep_type_value; 659 + u64 sleep_status; 660 + 661 + ACPI_FUNCTION_TRACE(hw_extended_sleep); 662 + 663 + /* Extended sleep registers must be valid */ 664 + 665 + if (!acpi_gbl_FADT.sleep_control.address || 666 + !acpi_gbl_FADT.sleep_status.address) { 667 + return_ACPI_STATUS(AE_NOT_EXIST); 668 + } 669 + 670 + /* Clear wake status (WAK_STS) */ 671 + 672 + status = acpi_write(ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status); 673 + if (ACPI_FAILURE(status)) { 674 + return_ACPI_STATUS(status); 675 + } 676 + 677 + acpi_gbl_system_awake_and_running = FALSE; 678 + 679 + /* Execute the _GTS method (Going To Sleep) */ 680 + 681 + acpi_hw_execute_GTS(sleep_state); 682 + 683 + /* Flush caches, as per ACPI specification */ 684 + 685 + ACPI_FLUSH_CPU_CACHE(); 686 + 687 + /* 688 + * Set the SLP_TYP and SLP_EN bits. 689 + * 690 + * Note: We only use the first value returned by the \_Sx method 691 + * (acpi_gbl_sleep_type_a) - As per ACPI specification. 692 + */ 693 + ACPI_DEBUG_PRINT((ACPI_DB_INIT, 694 + "Entering sleep state [S%u]\n", sleep_state)); 695 + 696 + sleep_type_value = 697 + ((acpi_gbl_sleep_type_a << ACPI_X_SLEEP_TYPE_POSITION) & 698 + ACPI_X_SLEEP_TYPE_MASK); 699 + 700 + status = acpi_write((sleep_type_value | ACPI_X_SLEEP_ENABLE), 701 + &acpi_gbl_FADT.sleep_control); 702 + if (ACPI_FAILURE(status)) { 703 + return_ACPI_STATUS(status); 704 + } 705 + 706 + /* Wait for transition back to Working State */ 707 + 708 + do { 709 + status = acpi_read(&sleep_status, &acpi_gbl_FADT.sleep_status); 710 + if (ACPI_FAILURE(status)) { 711 + return_ACPI_STATUS(status); 712 + } 713 + 714 + } while (!(((u8)sleep_status) & ACPI_X_WAKE_STATUS)); 715 + 716 + return_ACPI_STATUS(AE_OK); 717 + } 718 + 719 + /******************************************************************************* 720 + * 721 + * FUNCTION: acpi_hw_extended_wake_prep 722 + * 723 + * PARAMETERS: sleep_state - Which sleep state we just exited 724 + * 725 + * RETURN: Status 726 + * 727 + * DESCRIPTION: Perform first part of OS-independent ACPI cleanup after 728 + * a sleep. Called with interrupts ENABLED. 729 + * 730 + ******************************************************************************/ 731 + 732 + acpi_status acpi_hw_extended_wake_prep(u8 sleep_state) 733 + { 734 + acpi_status status; 735 + u8 sleep_type_value; 736 + 737 + ACPI_FUNCTION_TRACE(hw_extended_wake_prep); 738 + 739 + status = acpi_get_sleep_type_data(ACPI_STATE_S0, 740 + &acpi_gbl_sleep_type_a, 741 + &acpi_gbl_sleep_type_b); 742 + if (ACPI_SUCCESS(status)) { 743 + sleep_type_value = 744 + ((acpi_gbl_sleep_type_a << ACPI_X_SLEEP_TYPE_POSITION) & 745 + ACPI_X_SLEEP_TYPE_MASK); 746 + 747 + (void)acpi_write((sleep_type_value | ACPI_X_SLEEP_ENABLE), 748 + &acpi_gbl_FADT.sleep_control); 749 + } 750 + 751 + acpi_hw_execute_BFS(sleep_state); 752 + return_ACPI_STATUS(AE_OK); 753 + } 754 + 755 + /******************************************************************************* 756 + * 757 + * FUNCTION: acpi_hw_extended_wake 758 + * 759 + * PARAMETERS: sleep_state - Which sleep state we just exited 760 + * 761 + * RETURN: Status 762 + * 763 + * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep 764 + * Called with interrupts ENABLED. 765 + * 766 + ******************************************************************************/ 767 + 768 + acpi_status acpi_hw_extended_wake(u8 sleep_state) 769 + { 770 + ACPI_FUNCTION_TRACE(hw_extended_wake); 771 + 772 + /* Ensure enter_sleep_state_prep -> enter_sleep_state ordering */ 773 + 774 + acpi_gbl_sleep_type_a = ACPI_SLEEP_TYPE_INVALID; 775 + 776 + /* Execute the wake methods */ 777 + 778 + acpi_hw_execute_SST(ACPI_SST_WAKING); 779 + acpi_hw_execute_WAK(sleep_state); 780 + 781 + /* 782 + * Some BIOS code assumes that WAK_STS will be cleared on resume 783 + * and use it to determine whether the system is rebooting or 784 + * resuming. Clear WAK_STS for compatibility. 785 + */ 786 + (void)acpi_write(ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status); 787 + acpi_gbl_system_awake_and_running = TRUE; 788 + 789 + acpi_hw_execute_SST(ACPI_SST_WORKING); 790 + return_ACPI_STATUS(AE_OK); 791 + }
+377
drivers/acpi/acpica/hwxfsleep.c
··· 1 + /****************************************************************************** 2 + * 3 + * Name: hwxfsleep.c - ACPI Hardware Sleep/Wake External Interfaces 4 + * 5 + *****************************************************************************/ 6 + 7 + /* 8 + * Copyright (C) 2000 - 2012, Intel Corp. 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 + 44 + #include <acpi/acpi.h> 45 + #include "accommon.h" 46 + #include <linux/module.h> 47 + 48 + #define _COMPONENT ACPI_HARDWARE 49 + ACPI_MODULE_NAME("hwxfsleep") 50 + 51 + /******************************************************************************* 52 + * 53 + * FUNCTION: acpi_set_firmware_waking_vector 54 + * 55 + * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode 56 + * entry point. 57 + * 58 + * RETURN: Status 59 + * 60 + * DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS 61 + * 62 + ******************************************************************************/ 63 + acpi_status acpi_set_firmware_waking_vector(u32 physical_address) 64 + { 65 + ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); 66 + 67 + 68 + /* 69 + * According to the ACPI specification 2.0c and later, the 64-bit 70 + * waking vector should be cleared and the 32-bit waking vector should 71 + * be used, unless we want the wake-up code to be called by the BIOS in 72 + * Protected Mode. Some systems (for example HP dv5-1004nr) are known 73 + * to fail to resume if the 64-bit vector is used. 74 + */ 75 + 76 + /* Set the 32-bit vector */ 77 + 78 + acpi_gbl_FACS->firmware_waking_vector = physical_address; 79 + 80 + /* Clear the 64-bit vector if it exists */ 81 + 82 + if ((acpi_gbl_FACS->length > 32) && (acpi_gbl_FACS->version >= 1)) { 83 + acpi_gbl_FACS->xfirmware_waking_vector = 0; 84 + } 85 + 86 + return_ACPI_STATUS(AE_OK); 87 + } 88 + 89 + ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) 90 + 91 + #if ACPI_MACHINE_WIDTH == 64 92 + /******************************************************************************* 93 + * 94 + * FUNCTION: acpi_set_firmware_waking_vector64 95 + * 96 + * PARAMETERS: physical_address - 64-bit physical address of ACPI protected 97 + * mode entry point. 98 + * 99 + * RETURN: Status 100 + * 101 + * DESCRIPTION: Sets the 64-bit X_firmware_waking_vector field of the FACS, if 102 + * it exists in the table. This function is intended for use with 103 + * 64-bit host operating systems. 104 + * 105 + ******************************************************************************/ 106 + acpi_status acpi_set_firmware_waking_vector64(u64 physical_address) 107 + { 108 + ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64); 109 + 110 + 111 + /* Determine if the 64-bit vector actually exists */ 112 + 113 + if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) { 114 + return_ACPI_STATUS(AE_NOT_EXIST); 115 + } 116 + 117 + /* Clear 32-bit vector, set the 64-bit X_ vector */ 118 + 119 + acpi_gbl_FACS->firmware_waking_vector = 0; 120 + acpi_gbl_FACS->xfirmware_waking_vector = physical_address; 121 + return_ACPI_STATUS(AE_OK); 122 + } 123 + 124 + ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64) 125 + #endif 126 + 127 + /******************************************************************************* 128 + * 129 + * FUNCTION: acpi_enter_sleep_state_s4bios 130 + * 131 + * PARAMETERS: None 132 + * 133 + * RETURN: Status 134 + * 135 + * DESCRIPTION: Perform a S4 bios request. 136 + * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED 137 + * 138 + ******************************************************************************/ 139 + acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) 140 + { 141 + u32 in_value; 142 + acpi_status status; 143 + 144 + ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_s4bios); 145 + 146 + /* Clear the wake status bit (PM1) */ 147 + 148 + status = 149 + acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS); 150 + if (ACPI_FAILURE(status)) { 151 + return_ACPI_STATUS(status); 152 + } 153 + 154 + status = acpi_hw_clear_acpi_status(); 155 + if (ACPI_FAILURE(status)) { 156 + return_ACPI_STATUS(status); 157 + } 158 + 159 + /* 160 + * 1) Disable/Clear all GPEs 161 + * 2) Enable all wakeup GPEs 162 + */ 163 + status = acpi_hw_disable_all_gpes(); 164 + if (ACPI_FAILURE(status)) { 165 + return_ACPI_STATUS(status); 166 + } 167 + acpi_gbl_system_awake_and_running = FALSE; 168 + 169 + status = acpi_hw_enable_all_wakeup_gpes(); 170 + if (ACPI_FAILURE(status)) { 171 + return_ACPI_STATUS(status); 172 + } 173 + 174 + ACPI_FLUSH_CPU_CACHE(); 175 + 176 + status = acpi_hw_write_port(acpi_gbl_FADT.smi_command, 177 + (u32)acpi_gbl_FADT.S4bios_request, 8); 178 + 179 + do { 180 + acpi_os_stall(1000); 181 + status = 182 + acpi_read_bit_register(ACPI_BITREG_WAKE_STATUS, &in_value); 183 + if (ACPI_FAILURE(status)) { 184 + return_ACPI_STATUS(status); 185 + } 186 + } while (!in_value); 187 + 188 + return_ACPI_STATUS(AE_OK); 189 + } 190 + 191 + ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios) 192 + 193 + /******************************************************************************* 194 + * 195 + * FUNCTION: acpi_enter_sleep_state_prep 196 + * 197 + * PARAMETERS: sleep_state - Which sleep state to enter 198 + * 199 + * RETURN: Status 200 + * 201 + * DESCRIPTION: Prepare to enter a system sleep state (see ACPI 2.0 spec p 231) 202 + * This function must execute with interrupts enabled. 203 + * We break sleeping into 2 stages so that OSPM can handle 204 + * various OS-specific tasks between the two steps. 205 + * 206 + ******************************************************************************/ 207 + acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) 208 + { 209 + acpi_status status; 210 + struct acpi_object_list arg_list; 211 + union acpi_object arg; 212 + u32 sst_value; 213 + 214 + ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_prep); 215 + 216 + /* _PSW methods could be run here to enable wake-on keyboard, LAN, etc. */ 217 + 218 + status = acpi_get_sleep_type_data(sleep_state, 219 + &acpi_gbl_sleep_type_a, 220 + &acpi_gbl_sleep_type_b); 221 + if (ACPI_FAILURE(status)) { 222 + return_ACPI_STATUS(status); 223 + } 224 + 225 + /* Execute the _PTS method (Prepare To Sleep) */ 226 + 227 + arg_list.count = 1; 228 + arg_list.pointer = &arg; 229 + arg.type = ACPI_TYPE_INTEGER; 230 + arg.integer.value = sleep_state; 231 + 232 + status = acpi_evaluate_object(NULL, METHOD_NAME__PTS, &arg_list, NULL); 233 + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 234 + return_ACPI_STATUS(status); 235 + } 236 + 237 + /* Setup the argument to the _SST method (System STatus) */ 238 + 239 + switch (sleep_state) { 240 + case ACPI_STATE_S0: 241 + sst_value = ACPI_SST_WORKING; 242 + break; 243 + 244 + case ACPI_STATE_S1: 245 + case ACPI_STATE_S2: 246 + case ACPI_STATE_S3: 247 + sst_value = ACPI_SST_SLEEPING; 248 + break; 249 + 250 + case ACPI_STATE_S4: 251 + sst_value = ACPI_SST_SLEEP_CONTEXT; 252 + break; 253 + 254 + default: 255 + sst_value = ACPI_SST_INDICATOR_OFF; /* Default is off */ 256 + break; 257 + } 258 + 259 + /* 260 + * Set the system indicators to show the desired sleep state. 261 + * _SST is an optional method (return no error if not found) 262 + */ 263 + acpi_hw_execute_SST(sst_value); 264 + return_ACPI_STATUS(AE_OK); 265 + } 266 + 267 + ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) 268 + 269 + /******************************************************************************* 270 + * 271 + * FUNCTION: acpi_enter_sleep_state 272 + * 273 + * PARAMETERS: sleep_state - Which sleep state to enter 274 + * 275 + * RETURN: Status 276 + * 277 + * DESCRIPTION: Enter a system sleep state (see ACPI 2.0 spec p 231) 278 + * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED 279 + * 280 + ******************************************************************************/ 281 + acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) 282 + { 283 + acpi_status status; 284 + 285 + ACPI_FUNCTION_TRACE(acpi_enter_sleep_state); 286 + 287 + if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) || 288 + (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) { 289 + ACPI_ERROR((AE_INFO, "Sleep values out of range: A=0x%X B=0x%X", 290 + acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b)); 291 + return_ACPI_STATUS(AE_AML_OPERAND_VALUE); 292 + } 293 + 294 + /* If Hardware Reduced flag is set, must use the extended sleep registers */ 295 + 296 + if (acpi_gbl_reduced_hardware || acpi_gbl_FADT.sleep_control.address) { 297 + status = acpi_hw_extended_sleep(sleep_state); 298 + } else { 299 + /* Legacy sleep */ 300 + 301 + status = acpi_hw_legacy_sleep(sleep_state); 302 + } 303 + 304 + return_ACPI_STATUS(status); 305 + } 306 + 307 + ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state) 308 + 309 + /******************************************************************************* 310 + * 311 + * FUNCTION: acpi_leave_sleep_state_prep 312 + * 313 + * PARAMETERS: sleep_state - Which sleep state we are exiting 314 + * 315 + * RETURN: Status 316 + * 317 + * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a 318 + * sleep. 319 + * Called with interrupts DISABLED. 320 + * 321 + ******************************************************************************/ 322 + acpi_status acpi_leave_sleep_state_prep(u8 sleep_state) 323 + { 324 + acpi_status status; 325 + 326 + ACPI_FUNCTION_TRACE(acpi_leave_sleep_state); 327 + 328 + 329 + /* If Hardware Reduced flag is set, must use the extended sleep registers */ 330 + 331 + if (acpi_gbl_reduced_hardware || acpi_gbl_FADT.sleep_control.address) { 332 + status = acpi_hw_extended_wake_prep(sleep_state); 333 + } else { 334 + /* Legacy sleep */ 335 + 336 + status = acpi_hw_legacy_wake_prep(sleep_state); 337 + } 338 + 339 + 340 + return_ACPI_STATUS(status); 341 + } 342 + 343 + ACPI_EXPORT_SYMBOL(acpi_leave_sleep_state_prep) 344 + 345 + /******************************************************************************* 346 + * 347 + * FUNCTION: acpi_leave_sleep_state 348 + * 349 + * PARAMETERS: sleep_state - Which sleep state we just exited 350 + * 351 + * RETURN: Status 352 + * 353 + * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep 354 + * Called with interrupts ENABLED. 355 + * 356 + ******************************************************************************/ 357 + acpi_status acpi_leave_sleep_state(u8 sleep_state) 358 + { 359 + acpi_status status; 360 + 361 + ACPI_FUNCTION_TRACE(acpi_leave_sleep_state); 362 + 363 + 364 + /* If Hardware Reduced flag is set, must use the extended sleep registers */ 365 + 366 + if (acpi_gbl_reduced_hardware || acpi_gbl_FADT.sleep_control.address) { 367 + status = acpi_hw_extended_wake(sleep_state); 368 + } else { 369 + /* Legacy sleep */ 370 + 371 + status = acpi_hw_legacy_wake(sleep_state); 372 + } 373 + 374 + return_ACPI_STATUS(status); 375 + } 376 + 377 + ACPI_EXPORT_SYMBOL(acpi_leave_sleep_state)
+7
include/acpi/actbl.h
··· 309 309 PM_TABLET = 8 310 310 }; 311 311 312 + /* Values for sleep_status and sleep_control registers (V5 FADT) */ 313 + 314 + #define ACPI_X_WAKE_STATUS 0x80 315 + #define ACPI_X_SLEEP_TYPE_MASK 0x1C 316 + #define ACPI_X_SLEEP_TYPE_POSITION 0x02 317 + #define ACPI_X_SLEEP_ENABLE 0x20 318 + 312 319 /* Reset to default packing */ 313 320 314 321 #pragma pack()