ReactOS  0.4.14-dev-297-g23e575c
hwesleep.c File Reference
#include "acpi.h"
#include "accommon.h"
Include dependency graph for hwesleep.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_HARDWARE
 

Functions

void AcpiHwExecuteSleepMethod (char *MethodPathname, UINT32 IntegerArgument)
 
ACPI_STATUS AcpiHwExtendedSleep (UINT8 SleepState)
 
ACPI_STATUS AcpiHwExtendedWakePrep (UINT8 SleepState)
 
ACPI_STATUS AcpiHwExtendedWake (UINT8 SleepState)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_HARDWARE

Definition at line 48 of file hwesleep.c.

Function Documentation

◆ AcpiHwExecuteSleepMethod()

void AcpiHwExecuteSleepMethod ( char MethodPathname,
UINT32  IntegerArgument 
)

Definition at line 67 of file hwesleep.c.

70 {
71  ACPI_OBJECT_LIST ArgList;
72  ACPI_OBJECT Arg;
74 
75 
76  ACPI_FUNCTION_TRACE (HwExecuteSleepMethod);
77 
78 
79  /* One argument, IntegerArgument; No return value expected */
80 
81  ArgList.Count = 1;
82  ArgList.Pointer = &Arg;
83  Arg.Type = ACPI_TYPE_INTEGER;
84  Arg.Integer.Value = (UINT64) IntegerArgument;
85 
86  Status = AcpiEvaluateObject (NULL, MethodPathname, &ArgList, NULL);
88  {
89  ACPI_EXCEPTION ((AE_INFO, Status, "While executing method %s",
90  MethodPathname));
91  }
92 
94 }
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define ACPI_TYPE_INTEGER
Definition: actypes.h:679
struct acpi_object::@600 Integer
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
#define AE_NOT_FOUND
Definition: acexcep.h:113
#define return_VOID
Definition: acoutput.h:495
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiEvaluateObject(ACPI_HANDLE Handle, ACPI_STRING Pathname, ACPI_OBJECT_LIST *ExternalParams, ACPI_BUFFER *ReturnBuffer)
Definition: nsxfeval.c:217
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_OBJECT * Pointer
Definition: actypes.h:1018
unsigned long long UINT64
ACPI_OBJECT_TYPE Type
Definition: actypes.h:959

Referenced by AcpiEnterSleepStatePrep(), AcpiHwExtendedWake(), and AcpiHwLegacyWake().

◆ AcpiHwExtendedSleep()

ACPI_STATUS AcpiHwExtendedSleep ( UINT8  SleepState)

Definition at line 112 of file hwesleep.c.

114 {
116  UINT8 SleepControl;
117  UINT64 SleepStatus;
118 
119 
120  ACPI_FUNCTION_TRACE (HwExtendedSleep);
121 
122 
123  /* Extended sleep registers must be valid */
124 
125  if (!AcpiGbl_FADT.SleepControl.Address ||
126  !AcpiGbl_FADT.SleepStatus.Address)
127  {
129  }
130 
131  /* Clear wake status (WAK_STS) */
132 
134  &AcpiGbl_FADT.SleepStatus);
135  if (ACPI_FAILURE (Status))
136  {
138  }
139 
140  AcpiGbl_SystemAwakeAndRunning = FALSE;
141 
142  /*
143  * Set the SLP_TYP and SLP_EN bits.
144  *
145  * Note: We only use the first value returned by the \_Sx method
146  * (AcpiGbl_SleepTypeA) - As per ACPI specification.
147  */
149  "Entering sleep state [S%u]\n", SleepState));
150 
151  SleepControl = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) &
153 
154  /* Flush caches, as per ACPI specification */
155 
157 
158  Status = AcpiOsEnterSleep (SleepState, SleepControl, 0);
159  if (Status == AE_CTRL_TERMINATE)
160  {
162  }
163  if (ACPI_FAILURE (Status))
164  {
166  }
167 
168  Status = AcpiWrite ((UINT64) SleepControl, &AcpiGbl_FADT.SleepControl);
169  if (ACPI_FAILURE (Status))
170  {
172  }
173 
174  /* Wait for transition back to Working State */
175 
176  do
177  {
178  Status = AcpiRead (&SleepStatus, &AcpiGbl_FADT.SleepStatus);
179  if (ACPI_FAILURE (Status))
180  {
182  }
183 
184  } while (!(((UINT8) SleepStatus) & ACPI_X_WAKE_STATUS));
185 
187 }
#define ACPI_X_WAKE_STATUS
Definition: actbl.h:377
ACPI_STATUS AcpiOsEnterSleep(UINT8 SleepState, UINT32 RegaValue, UINT32 RegbValue)
Definition: osl.c:932
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_CTRL_TERMINATE
Definition: acexcep.h:226
#define ACPI_X_SLEEP_ENABLE
Definition: actbl.h:380
#define ACPI_X_SLEEP_TYPE_POSITION
Definition: actbl.h:379
#define ACPI_FLUSH_CPU_CACHE()
Definition: accygwin.h:53
#define ACPI_X_SLEEP_TYPE_MASK
Definition: actbl.h:378
ACPI_STATUS AcpiWrite(UINT64 Value, ACPI_GENERIC_ADDRESS *Reg)
Definition: hwxface.c:169
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define AE_NOT_EXIST
Definition: acexcep.h:114
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_INIT
Definition: acoutput.h:151
ACPI_STATUS AcpiRead(UINT64 *ReturnValue, ACPI_GENERIC_ADDRESS *Reg)
Definition: hwxface.c:138
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
unsigned long long UINT64
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97

◆ AcpiHwExtendedWake()

ACPI_STATUS AcpiHwExtendedWake ( UINT8  SleepState)

Definition at line 243 of file hwesleep.c.

245 {
246  ACPI_FUNCTION_TRACE (HwExtendedWake);
247 
248 
249  /* Ensure EnterSleepStatePrep -> EnterSleepState ordering */
250 
251  AcpiGbl_SleepTypeA = ACPI_SLEEP_TYPE_INVALID;
252 
253  /* Execute the wake methods */
254 
257 
258  /*
259  * Some BIOS code assumes that WAK_STS will be cleared on resume
260  * and use it to determine whether the system is rebooting or
261  * resuming. Clear WAK_STS for compatibility.
262  */
263  (void) AcpiWrite ((UINT64) ACPI_X_WAKE_STATUS, &AcpiGbl_FADT.SleepStatus);
264  AcpiGbl_SystemAwakeAndRunning = TRUE;
265 
268 }
#define ACPI_X_WAKE_STATUS
Definition: actbl.h:377
#define TRUE
Definition: types.h:120
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
void AcpiHwExecuteSleepMethod(char *MethodPathname, UINT32 IntegerArgument)
Definition: hwesleep.c:67
#define METHOD_PATHNAME__WAK
Definition: acnames.h:81
#define ACPI_SST_WORKING
Definition: achware.h:51
ACPI_STATUS AcpiWrite(UINT64 Value, ACPI_GENERIC_ADDRESS *Reg)
Definition: hwxface.c:169
#define ACPI_SST_WAKING
Definition: achware.h:52
#define METHOD_PATHNAME__SST
Definition: acnames.h:80
#define ACPI_SLEEP_TYPE_INVALID
Definition: actypes.h:642
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
unsigned long long UINT64
#define AE_OK
Definition: acexcep.h:97

◆ AcpiHwExtendedWakePrep()

ACPI_STATUS AcpiHwExtendedWakePrep ( UINT8  SleepState)

Definition at line 204 of file hwesleep.c.

206 {
208  UINT8 SleepTypeValue;
209 
210 
211  ACPI_FUNCTION_TRACE (HwExtendedWakePrep);
212 
213 
215  &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB);
216  if (ACPI_SUCCESS (Status))
217  {
218  SleepTypeValue = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) &
220 
221  (void) AcpiWrite ((UINT64) (SleepTypeValue | ACPI_X_SLEEP_ENABLE),
222  &AcpiGbl_FADT.SleepControl);
223  }
224 
226 }
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_STATUS AcpiGetSleepTypeData(UINT8 SleepState, UINT8 *SleepTypeA, UINT8 *SleepTypeB)
Definition: hwxface.c:411
#define ACPI_X_SLEEP_ENABLE
Definition: actbl.h:380
#define ACPI_X_SLEEP_TYPE_POSITION
Definition: actbl.h:379
#define ACPI_X_SLEEP_TYPE_MASK
Definition: actbl.h:378
ACPI_STATUS AcpiWrite(UINT64 Value, ACPI_GENERIC_ADDRESS *Reg)
Definition: hwxface.c:169
#define ACPI_STATE_S0
Definition: actypes.h:615
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
unsigned long long UINT64
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97