hwsleep.c (128245) | hwsleep.c (129684) |
---|---|
1 2/****************************************************************************** 3 * 4 * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface | 1 2/****************************************************************************** 3 * 4 * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface |
5 * $Revision: 66 $ | 5 * $Revision: 69 $ |
6 * 7 *****************************************************************************/ 8 9/****************************************************************************** 10 * 11 * 1. Copyright Notice 12 * 13 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. --- 338 unchanged lines hidden (view full) --- 352 /* Clear wake status */ 353 354 Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); 355 if (ACPI_FAILURE (Status)) 356 { 357 return_ACPI_STATUS (Status); 358 } 359 | 6 * 7 *****************************************************************************/ 8 9/****************************************************************************** 10 * 11 * 1. Copyright Notice 12 * 13 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. --- 338 unchanged lines hidden (view full) --- 352 /* Clear wake status */ 353 354 Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); 355 if (ACPI_FAILURE (Status)) 356 { 357 return_ACPI_STATUS (Status); 358 } 359 |
360 /* Clear all fixed and general purpose status bits */ 361 |
|
360 Status = AcpiHwClearAcpiStatus (ACPI_MTX_DO_NOT_LOCK); 361 if (ACPI_FAILURE (Status)) 362 { 363 return_ACPI_STATUS (Status); 364 } 365 366 if (SleepState != ACPI_STATE_S5) 367 { 368 /* Disable BM arbitration */ 369 370 Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK); 371 if (ACPI_FAILURE (Status)) 372 { 373 return_ACPI_STATUS (Status); 374 } 375 } 376 377 /* | 362 Status = AcpiHwClearAcpiStatus (ACPI_MTX_DO_NOT_LOCK); 363 if (ACPI_FAILURE (Status)) 364 { 365 return_ACPI_STATUS (Status); 366 } 367 368 if (SleepState != ACPI_STATE_S5) 369 { 370 /* Disable BM arbitration */ 371 372 Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK); 373 if (ACPI_FAILURE (Status)) 374 { 375 return_ACPI_STATUS (Status); 376 } 377 } 378 379 /* |
378 * 1) Disable all runtime GPEs | 380 * 1) Disable/Clear all GPEs |
379 * 2) Enable all wakeup GPEs 380 */ | 381 * 2) Enable all wakeup GPEs 382 */ |
381 Status = AcpiHwPrepareGpesForSleep (); | 383 Status = AcpiHwDisableAllGpes (); |
382 if (ACPI_FAILURE (Status)) 383 { 384 return_ACPI_STATUS (Status); 385 } | 384 if (ACPI_FAILURE (Status)) 385 { 386 return_ACPI_STATUS (Status); 387 } |
388 AcpiGbl_SystemAwakeAndRunning = FALSE; |
|
386 | 389 |
390 Status = AcpiHwEnableAllWakeupGpes (); 391 if (ACPI_FAILURE (Status)) 392 { 393 return_ACPI_STATUS (Status); 394 } 395 |
|
387 /* Get current value of PM1A control */ 388 389 Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, &PM1AControl); 390 if (ACPI_FAILURE (Status)) 391 { 392 return_ACPI_STATUS (Status); 393 } 394 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Entering sleep state [S%d]\n", SleepState)); --- 120 unchanged lines hidden (view full) --- 515 516 Status = AcpiHwClearAcpiStatus (ACPI_MTX_DO_NOT_LOCK); 517 if (ACPI_FAILURE (Status)) 518 { 519 return_ACPI_STATUS (Status); 520 } 521 522 /* | 396 /* Get current value of PM1A control */ 397 398 Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, &PM1AControl); 399 if (ACPI_FAILURE (Status)) 400 { 401 return_ACPI_STATUS (Status); 402 } 403 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Entering sleep state [S%d]\n", SleepState)); --- 120 unchanged lines hidden (view full) --- 524 525 Status = AcpiHwClearAcpiStatus (ACPI_MTX_DO_NOT_LOCK); 526 if (ACPI_FAILURE (Status)) 527 { 528 return_ACPI_STATUS (Status); 529 } 530 531 /* |
523 * 1) Disable all runtime GPEs | 532 * 1) Disable/Clear all GPEs |
524 * 2) Enable all wakeup GPEs 525 */ | 533 * 2) Enable all wakeup GPEs 534 */ |
526 Status = AcpiHwPrepareGpesForSleep (); | 535 Status = AcpiHwDisableAllGpes (); |
527 if (ACPI_FAILURE (Status)) 528 { 529 return_ACPI_STATUS (Status); 530 } | 536 if (ACPI_FAILURE (Status)) 537 { 538 return_ACPI_STATUS (Status); 539 } |
540 AcpiGbl_SystemAwakeAndRunning = FALSE; |
|
531 | 541 |
542 Status = AcpiHwEnableAllWakeupGpes (); 543 if (ACPI_FAILURE (Status)) 544 { 545 return_ACPI_STATUS (Status); 546 } 547 |
|
532 ACPI_FLUSH_CPU_CACHE (); 533 534 Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, (UINT32) AcpiGbl_FADT->S4BiosReq, 8); 535 536 do { 537 AcpiOsStall(1000); 538 Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue, ACPI_MTX_DO_NOT_LOCK); 539 if (ACPI_FAILURE (Status)) --- 102 unchanged lines hidden (view full) --- 642 if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) 643 { 644 ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", AcpiFormatException (Status))); 645 } 646 /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ 647 648 /* 649 * Restore the GPEs: | 548 ACPI_FLUSH_CPU_CACHE (); 549 550 Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, (UINT32) AcpiGbl_FADT->S4BiosReq, 8); 551 552 do { 553 AcpiOsStall(1000); 554 Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue, ACPI_MTX_DO_NOT_LOCK); 555 if (ACPI_FAILURE (Status)) --- 102 unchanged lines hidden (view full) --- 658 if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) 659 { 660 ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", AcpiFormatException (Status))); 661 } 662 /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ 663 664 /* 665 * Restore the GPEs: |
650 * 1) Disable all wakeup GPEs | 666 * 1) Disable/Clear all GPEs |
651 * 2) Enable all runtime GPEs 652 */ | 667 * 2) Enable all runtime GPEs 668 */ |
653 Status = AcpiHwRestoreGpesOnWake (); | 669 Status = AcpiHwDisableAllGpes (); |
654 if (ACPI_FAILURE (Status)) 655 { 656 return_ACPI_STATUS (Status); 657 } | 670 if (ACPI_FAILURE (Status)) 671 { 672 return_ACPI_STATUS (Status); 673 } |
674 AcpiGbl_SystemAwakeAndRunning = TRUE; |
|
658 | 675 |
676 Status = AcpiHwEnableAllRuntimeGpes (); 677 if (ACPI_FAILURE (Status)) 678 { 679 return_ACPI_STATUS (Status); 680 } 681 |
|
659 /* Enable power button */ 660 | 682 /* Enable power button */ 683 |
661 AcpiSetRegister(AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId, | 684 (void) AcpiSetRegister(AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId, |
662 1, ACPI_MTX_DO_NOT_LOCK); | 685 1, ACPI_MTX_DO_NOT_LOCK); |
663 AcpiSetRegister(AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId, | 686 (void) AcpiSetRegister(AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId, |
664 1, ACPI_MTX_DO_NOT_LOCK); 665 666 /* Enable BM arbitration */ 667 668 Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_LOCK); 669 if (ACPI_FAILURE (Status)) 670 { 671 return_ACPI_STATUS (Status); 672 } 673 674 Arg.Integer.Value = ACPI_SST_WORKING; 675 Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL); 676 if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) 677 { 678 ACPI_REPORT_ERROR (("Method _SST failed, %s\n", AcpiFormatException (Status))); 679 } 680 681 return_ACPI_STATUS (Status); 682} | 687 1, ACPI_MTX_DO_NOT_LOCK); 688 689 /* Enable BM arbitration */ 690 691 Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_LOCK); 692 if (ACPI_FAILURE (Status)) 693 { 694 return_ACPI_STATUS (Status); 695 } 696 697 Arg.Integer.Value = ACPI_SST_WORKING; 698 Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL); 699 if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) 700 { 701 ACPI_REPORT_ERROR (("Method _SST failed, %s\n", AcpiFormatException (Status))); 702 } 703 704 return_ACPI_STATUS (Status); 705} |