summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2021-09-29 13:30:33 -0700
committerGitHub <noreply@github.com>2021-09-29 13:30:33 -0700
commit907b4ad5be5af5d85c918fba680808a1a7759ae9 (patch)
treece55f756f0104d89e84d87cf688c322a62fd8bb7
parentc15089b9ea6caa5b26d1a6bb66d25ed9b0bad871 (diff)
parent0762982923f95eb652cf7ded27356b247c9774de (diff)
downloadacpica-907b4ad5be5af5d85c918fba680808a1a7759ae9.tar.gz
Merge pull request #716 from rafaeljw/hardware
Hardware: Avoid evaluating methods too early during system resume
-rw-r--r--source/components/hardware/hwesleep.c7
-rw-r--r--source/components/hardware/hwsleep.c10
-rw-r--r--source/components/hardware/hwxfsleep.c6
-rw-r--r--source/include/acglobal.h2
4 files changed, 14 insertions, 11 deletions
diff --git a/source/components/hardware/hwesleep.c b/source/components/hardware/hwesleep.c
index fcc28581e..e8db4d26d 100644
--- a/source/components/hardware/hwesleep.c
+++ b/source/components/hardware/hwesleep.c
@@ -312,18 +312,15 @@ ACPI_STATUS
AcpiHwExtendedWakePrep (
UINT8 SleepState)
{
- ACPI_STATUS Status;
UINT8 SleepTypeValue;
ACPI_FUNCTION_TRACE (HwExtendedWakePrep);
- Status = AcpiGetSleepTypeData (ACPI_STATE_S0,
- &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB);
- if (ACPI_SUCCESS (Status))
+ if (AcpiGbl_SleepTypeAS0 != ACPI_SLEEP_TYPE_INVALID)
{
- SleepTypeValue = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) &
+ SleepTypeValue = ((AcpiGbl_SleepTypeAS0 << ACPI_X_SLEEP_TYPE_POSITION) &
ACPI_X_SLEEP_TYPE_MASK);
(void) AcpiWrite ((UINT64) (SleepTypeValue | ACPI_X_SLEEP_ENABLE),
diff --git a/source/components/hardware/hwsleep.c b/source/components/hardware/hwsleep.c
index d85d04785..2b857d970 100644
--- a/source/components/hardware/hwsleep.c
+++ b/source/components/hardware/hwsleep.c
@@ -339,7 +339,7 @@ ACPI_STATUS
AcpiHwLegacyWakePrep (
UINT8 SleepState)
{
- ACPI_STATUS Status;
+ ACPI_STATUS Status = AE_OK;
ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo;
ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo;
UINT32 Pm1aControl;
@@ -353,9 +353,7 @@ AcpiHwLegacyWakePrep (
* This is unclear from the ACPI Spec, but it is required
* by some machines.
*/
- Status = AcpiGetSleepTypeData (ACPI_STATE_S0,
- &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB);
- if (ACPI_SUCCESS (Status))
+ if (AcpiGbl_SleepTypeAS0 != ACPI_SLEEP_TYPE_INVALID)
{
SleepTypeRegInfo =
AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE);
@@ -376,9 +374,9 @@ AcpiHwLegacyWakePrep (
/* Insert the SLP_TYP bits */
- Pm1aControl |= (AcpiGbl_SleepTypeA <<
+ Pm1aControl |= (AcpiGbl_SleepTypeAS0 <<
SleepTypeRegInfo->BitPosition);
- Pm1bControl |= (AcpiGbl_SleepTypeB <<
+ Pm1aControl |= (AcpiGbl_SleepTypeBS0 <<
SleepTypeRegInfo->BitPosition);
/* Write the control registers and ignore any errors */
diff --git a/source/components/hardware/hwxfsleep.c b/source/components/hardware/hwxfsleep.c
index 26b48ccbe..f1a1344c7 100644
--- a/source/components/hardware/hwxfsleep.c
+++ b/source/components/hardware/hwxfsleep.c
@@ -471,6 +471,12 @@ AcpiEnterSleepStatePrep (
return_ACPI_STATUS (Status);
}
+ Status = AcpiGetSleepTypeData (ACPI_STATE_S0,
+ &AcpiGbl_SleepTypeAS0, &AcpiGbl_SleepTypeBS0);
+ if (ACPI_FAILURE (Status)) {
+ AcpiGbl_SleepTypeAS0 = ACPI_SLEEP_TYPE_INVALID;
+ }
+
/* Execute the _PTS method (Prepare To Sleep) */
ArgList.Count = 1;
diff --git a/source/include/acglobal.h b/source/include/acglobal.h
index c2107df0e..354268655 100644
--- a/source/include/acglobal.h
+++ b/source/include/acglobal.h
@@ -365,6 +365,8 @@ ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_LastListHead, NULL);
extern ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG];
ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeA);
ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeB);
+ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeAS0);
+ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeBS0);
/*****************************************************************************