ReactOS  0.4.14-dev-599-g2d4d3f5
hwgpe.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
Include dependency graph for hwgpe.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_HARDWARE
 

Functions

static ACPI_STATUS AcpiHwEnableWakeupGpeBlock (ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock, void *Context)
 
static ACPI_STATUS AcpiHwGpeEnableWrite (UINT8 EnableMask, ACPI_GPE_REGISTER_INFO *GpeRegisterInfo)
 
UINT32 AcpiHwGetGpeRegisterBit (ACPI_GPE_EVENT_INFO *GpeEventInfo)
 
ACPI_STATUS AcpiHwLowSetGpe (ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 Action)
 
ACPI_STATUS AcpiHwClearGpe (ACPI_GPE_EVENT_INFO *GpeEventInfo)
 
ACPI_STATUS AcpiHwGetGpeStatus (ACPI_GPE_EVENT_INFO *GpeEventInfo, ACPI_EVENT_STATUS *EventStatus)
 
ACPI_STATUS AcpiHwDisableGpeBlock (ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock, void *Context)
 
ACPI_STATUS AcpiHwClearGpeBlock (ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock, void *Context)
 
ACPI_STATUS AcpiHwEnableRuntimeGpeBlock (ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock, void *Context)
 
ACPI_STATUS AcpiHwDisableAllGpes (void)
 
ACPI_STATUS AcpiHwEnableAllRuntimeGpes (void)
 
ACPI_STATUS AcpiHwEnableAllWakeupGpes (void)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_HARDWARE

Definition at line 48 of file hwgpe.c.

Function Documentation

◆ AcpiHwClearGpe()

ACPI_STATUS AcpiHwClearGpe ( ACPI_GPE_EVENT_INFO GpeEventInfo)

Definition at line 190 of file hwgpe.c.

192 {
193  ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
195  UINT32 RegisterBit;
196 
197 
199 
200  /* Get the info block for the entire GPE register */
201 
202  GpeRegisterInfo = GpeEventInfo->RegisterInfo;
203  if (!GpeRegisterInfo)
204  {
205  return (AE_NOT_EXIST);
206  }
207 
208  /*
209  * Write a one to the appropriate bit in the status register to
210  * clear this GPE.
211  */
212  RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
213 
214  Status = AcpiHwWrite (RegisterBit, &GpeRegisterInfo->StatusAddress);
215  return (Status);
216 }
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
UINT32 ACPI_STATUS
Definition: actypes.h:460
unsigned int UINT32
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
UINT32 AcpiHwGetGpeRegisterBit(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: hwgpe.c:81
struct acpi_gpe_register_info * RegisterInfo
Definition: aclocal.h:555
ACPI_GENERIC_ADDRESS StatusAddress
Definition: aclocal.h:567
#define AE_NOT_EXIST
Definition: acexcep.h:114
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiHwWrite(UINT64 Value, ACPI_GENERIC_ADDRESS *Reg)
Definition: hwregs.c:357

Referenced by AcpiClearGpe(), AcpiEvAddGpeReference(), AcpiEvFinishGpe(), and AcpiEvGpeDispatch().

◆ AcpiHwClearGpeBlock()

ACPI_STATUS AcpiHwClearGpeBlock ( ACPI_GPE_XRUPT_INFO GpeXruptInfo,
ACPI_GPE_BLOCK_INFO GpeBlock,
void Context 
)

Definition at line 404 of file hwgpe.c.

408 {
409  UINT32 i;
411 
412 
413  /* Examine each GPE Register within the block */
414 
415  for (i = 0; i < GpeBlock->RegisterCount; i++)
416  {
417  /* Clear status on all GPEs in this register */
418 
419  Status = AcpiHwWrite (0xFF, &GpeBlock->RegisterInfo[i].StatusAddress);
420  if (ACPI_FAILURE (Status))
421  {
422  return (Status);
423  }
424  }
425 
426  return (AE_OK);
427 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT32
ACPI_GENERIC_ADDRESS StatusAddress
Definition: aclocal.h:567
ACPI_GPE_REGISTER_INFO * RegisterInfo
Definition: aclocal.h:587
UINT32 RegisterCount
Definition: aclocal.h:590
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiHwWrite(UINT64 Value, ACPI_GENERIC_ADDRESS *Reg)
Definition: hwregs.c:357
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiHwClearAcpiStatus().

◆ AcpiHwDisableAllGpes()

ACPI_STATUS AcpiHwDisableAllGpes ( void  )

Definition at line 543 of file hwgpe.c.

545 {
547 
548 
549  ACPI_FUNCTION_TRACE (HwDisableAllGpes);
550 
551 
554 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
smooth NULL
Definition: ftsmooth.c:416
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiHwDisableGpeBlock(ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock, void *Context)
Definition: hwgpe.c:364
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_STATUS AcpiEvWalkGpeList(ACPI_GPE_CALLBACK GpeWalkCallback, void *Context)
Definition: evgpeutil.c:67

Referenced by AcpiDisableAllGpes(), AcpiEnterSleepStateS4bios(), AcpiHwLegacySleep(), and AcpiHwLegacyWake().

◆ AcpiHwDisableGpeBlock()

ACPI_STATUS AcpiHwDisableGpeBlock ( ACPI_GPE_XRUPT_INFO GpeXruptInfo,
ACPI_GPE_BLOCK_INFO GpeBlock,
void Context 
)

Definition at line 364 of file hwgpe.c.

368 {
369  UINT32 i;
371 
372 
373  /* Examine each GPE Register within the block */
374 
375  for (i = 0; i < GpeBlock->RegisterCount; i++)
376  {
377  /* Disable all GPEs in this register */
378 
379  Status = AcpiHwGpeEnableWrite (0x00, &GpeBlock->RegisterInfo[i]);
380  if (ACPI_FAILURE (Status))
381  {
382  return (Status);
383  }
384  }
385 
386  return (AE_OK);
387 }
static ACPI_STATUS AcpiHwGpeEnableWrite(UINT8 EnableMask, ACPI_GPE_REGISTER_INFO *GpeRegisterInfo)
Definition: hwgpe.c:336
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT32
ACPI_GPE_REGISTER_INFO * RegisterInfo
Definition: aclocal.h:587
UINT32 RegisterCount
Definition: aclocal.h:590
Status
Definition: gdiplustypes.h:24
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiEvDeleteGpeBlock(), AcpiEvTerminate(), and AcpiHwDisableAllGpes().

◆ AcpiHwEnableAllRuntimeGpes()

ACPI_STATUS AcpiHwEnableAllRuntimeGpes ( void  )

Definition at line 570 of file hwgpe.c.

572 {
574 
575 
576  ACPI_FUNCTION_TRACE (HwEnableAllRuntimeGpes);
577 
578 
581 }
ACPI_STATUS AcpiHwEnableRuntimeGpeBlock(ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock, void *Context)
Definition: hwgpe.c:445
UINT32 ACPI_STATUS
Definition: actypes.h:460
smooth NULL
Definition: ftsmooth.c:416
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_STATUS AcpiEvWalkGpeList(ACPI_GPE_CALLBACK GpeWalkCallback, void *Context)
Definition: evgpeutil.c:67

Referenced by AcpiEnableAllRuntimeGpes(), and AcpiHwLegacyWake().

◆ AcpiHwEnableAllWakeupGpes()

ACPI_STATUS AcpiHwEnableAllWakeupGpes ( void  )

Definition at line 597 of file hwgpe.c.

599 {
601 
602 
603  ACPI_FUNCTION_TRACE (HwEnableAllWakeupGpes);
604 
605 
608 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
smooth NULL
Definition: ftsmooth.c:416
static ACPI_STATUS AcpiHwEnableWakeupGpeBlock(ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock, void *Context)
Definition: hwgpe.c:498
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_STATUS AcpiEvWalkGpeList(ACPI_GPE_CALLBACK GpeWalkCallback, void *Context)
Definition: evgpeutil.c:67

Referenced by AcpiEnableAllWakeupGpes(), AcpiEnterSleepStateS4bios(), and AcpiHwLegacySleep().

◆ AcpiHwEnableRuntimeGpeBlock()

ACPI_STATUS AcpiHwEnableRuntimeGpeBlock ( ACPI_GPE_XRUPT_INFO GpeXruptInfo,
ACPI_GPE_BLOCK_INFO GpeBlock,
void Context 
)

Definition at line 445 of file hwgpe.c.

449 {
450  UINT32 i;
452  ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
453  UINT8 EnableMask;
454 
455 
456  /* NOTE: assumes that all GPEs are currently disabled */
457 
458  /* Examine each GPE Register within the block */
459 
460  for (i = 0; i < GpeBlock->RegisterCount; i++)
461  {
462  GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
463  if (!GpeRegisterInfo->EnableForRun)
464  {
465  continue;
466  }
467 
468  /* Enable all "runtime" GPEs in this register */
469 
470  EnableMask = GpeRegisterInfo->EnableForRun &
471  ~GpeRegisterInfo->MaskForRun;
472  Status = AcpiHwGpeEnableWrite (EnableMask, GpeRegisterInfo);
473  if (ACPI_FAILURE (Status))
474  {
475  return (Status);
476  }
477  }
478 
479  return (AE_OK);
480 }
static ACPI_STATUS AcpiHwGpeEnableWrite(UINT8 EnableMask, ACPI_GPE_REGISTER_INFO *GpeRegisterInfo)
Definition: hwgpe.c:336
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT32
ACPI_GPE_REGISTER_INFO * RegisterInfo
Definition: aclocal.h:587
UINT32 RegisterCount
Definition: aclocal.h:590
Status
Definition: gdiplustypes.h:24
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiHwEnableAllRuntimeGpes().

◆ AcpiHwEnableWakeupGpeBlock()

static ACPI_STATUS AcpiHwEnableWakeupGpeBlock ( ACPI_GPE_XRUPT_INFO GpeXruptInfo,
ACPI_GPE_BLOCK_INFO GpeBlock,
void Context 
)
static

Definition at line 498 of file hwgpe.c.

502 {
503  UINT32 i;
505  ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
506 
507 
508  /* Examine each GPE Register within the block */
509 
510  for (i = 0; i < GpeBlock->RegisterCount; i++)
511  {
512  GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
513 
514  /*
515  * Enable all "wake" GPEs in this register and disable the
516  * remaining ones.
517  */
518  Status = AcpiHwGpeEnableWrite (GpeRegisterInfo->EnableForWake,
519  GpeRegisterInfo);
520  if (ACPI_FAILURE (Status))
521  {
522  return (Status);
523  }
524  }
525 
526  return (AE_OK);
527 }
static ACPI_STATUS AcpiHwGpeEnableWrite(UINT8 EnableMask, ACPI_GPE_REGISTER_INFO *GpeRegisterInfo)
Definition: hwgpe.c:336
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT32
ACPI_GPE_REGISTER_INFO * RegisterInfo
Definition: aclocal.h:587
UINT32 RegisterCount
Definition: aclocal.h:590
Status
Definition: gdiplustypes.h:24
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiHwEnableAllWakeupGpes().

◆ AcpiHwGetGpeRegisterBit()

UINT32 AcpiHwGetGpeRegisterBit ( ACPI_GPE_EVENT_INFO GpeEventInfo)

Definition at line 81 of file hwgpe.c.

83 {
84 
85  return ((UINT32) 1 <<
86  (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
87 }
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
unsigned int UINT32
struct acpi_gpe_register_info * RegisterInfo
Definition: aclocal.h:555

Referenced by AcpiEvDetectGpe(), AcpiEvMaskGpe(), AcpiEvUpdateGpeEnableMask(), AcpiHwClearGpe(), AcpiHwGetGpeStatus(), AcpiHwLowSetGpe(), and AcpiSetGpeWakeMask().

◆ AcpiHwGetGpeStatus()

ACPI_STATUS AcpiHwGetGpeStatus ( ACPI_GPE_EVENT_INFO GpeEventInfo,
ACPI_EVENT_STATUS EventStatus 
)

Definition at line 233 of file hwgpe.c.

236 {
237  UINT64 InByte;
238  UINT32 RegisterBit;
239  ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
240  ACPI_EVENT_STATUS LocalEventStatus = 0;
242 
243 
245 
246 
247  if (!EventStatus)
248  {
249  return (AE_BAD_PARAMETER);
250  }
251 
252  /* GPE currently handled? */
253 
256  {
257  LocalEventStatus |= ACPI_EVENT_FLAG_HAS_HANDLER;
258  }
259 
260  /* Get the info block for the entire GPE register */
261 
262  GpeRegisterInfo = GpeEventInfo->RegisterInfo;
263 
264  /* Get the register bitmask for this GPE */
265 
266  RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
267 
268  /* GPE currently enabled? (enabled for runtime?) */
269 
270  if (RegisterBit & GpeRegisterInfo->EnableForRun)
271  {
272  LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED;
273  }
274 
275  /* GPE currently masked? (masked for runtime?) */
276 
277  if (RegisterBit & GpeRegisterInfo->MaskForRun)
278  {
279  LocalEventStatus |= ACPI_EVENT_FLAG_MASKED;
280  }
281 
282  /* GPE enabled for wake? */
283 
284  if (RegisterBit & GpeRegisterInfo->EnableForWake)
285  {
286  LocalEventStatus |= ACPI_EVENT_FLAG_WAKE_ENABLED;
287  }
288 
289  /* GPE currently enabled (enable bit == 1)? */
290 
291  Status = AcpiHwRead (&InByte, &GpeRegisterInfo->EnableAddress);
292  if (ACPI_FAILURE (Status))
293  {
294  return (Status);
295  }
296 
297  if (RegisterBit & InByte)
298  {
299  LocalEventStatus |= ACPI_EVENT_FLAG_ENABLE_SET;
300  }
301 
302  /* GPE currently active (status bit == 1)? */
303 
304  Status = AcpiHwRead (&InByte, &GpeRegisterInfo->StatusAddress);
305  if (ACPI_FAILURE (Status))
306  {
307  return (Status);
308  }
309 
310  if (RegisterBit & InByte)
311  {
312  LocalEventStatus |= ACPI_EVENT_FLAG_STATUS_SET;
313  }
314 
315  /* Set return value */
316 
317  (*EventStatus) = LocalEventStatus;
318  return (AE_OK);
319 }
#define ACPI_EVENT_FLAG_MASKED
Definition: actypes.h:788
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define ACPI_GPE_DISPATCH_NONE
Definition: actypes.h:809
#define ACPI_GPE_DISPATCH_TYPE(flags)
Definition: actypes.h:815
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_EVENT_FLAG_STATUS_SET
Definition: actypes.h:785
ACPI_GENERIC_ADDRESS EnableAddress
Definition: aclocal.h:568
unsigned int UINT32
#define ACPI_EVENT_FLAG_ENABLED
Definition: actypes.h:783
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
UINT32 AcpiHwGetGpeRegisterBit(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: hwgpe.c:81
#define ACPI_EVENT_FLAG_HAS_HANDLER
Definition: actypes.h:787
struct acpi_gpe_register_info * RegisterInfo
Definition: aclocal.h:555
UINT32 ACPI_EVENT_STATUS
Definition: actypes.h:780
ACPI_GENERIC_ADDRESS StatusAddress
Definition: aclocal.h:567
ACPI_STATUS AcpiHwRead(UINT64 *Value, ACPI_GENERIC_ADDRESS *Reg)
Definition: hwregs.c:259
#define ACPI_EVENT_FLAG_WAKE_ENABLED
Definition: actypes.h:784
Status
Definition: gdiplustypes.h:24
unsigned long long UINT64
#define AE_OK
Definition: acexcep.h:97
#define ACPI_EVENT_FLAG_ENABLE_SET
Definition: actypes.h:786

Referenced by AcpiGetGpeStatus().

◆ AcpiHwGpeEnableWrite()

static ACPI_STATUS AcpiHwGpeEnableWrite ( UINT8  EnableMask,
ACPI_GPE_REGISTER_INFO GpeRegisterInfo 
)
static

Definition at line 336 of file hwgpe.c.

339 {
341 
342 
343  GpeRegisterInfo->EnableMask = EnableMask;
344 
345  Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
346  return (Status);
347 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_GENERIC_ADDRESS EnableAddress
Definition: aclocal.h:568
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiHwWrite(UINT64 Value, ACPI_GENERIC_ADDRESS *Reg)
Definition: hwregs.c:357

Referenced by AcpiHwDisableGpeBlock(), AcpiHwEnableRuntimeGpeBlock(), and AcpiHwEnableWakeupGpeBlock().

◆ AcpiHwLowSetGpe()

ACPI_STATUS AcpiHwLowSetGpe ( ACPI_GPE_EVENT_INFO GpeEventInfo,
UINT32  Action 
)

Definition at line 106 of file hwgpe.c.

109 {
110  ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
112  UINT64 EnableMask;
113  UINT32 RegisterBit;
114 
115 
117 
118 
119  /* Get the info block for the entire GPE register */
120 
121  GpeRegisterInfo = GpeEventInfo->RegisterInfo;
122  if (!GpeRegisterInfo)
123  {
124  return (AE_NOT_EXIST);
125  }
126 
127  /* Get current value of the enable register that contains this GPE */
128 
129  Status = AcpiHwRead (&EnableMask, &GpeRegisterInfo->EnableAddress);
130  if (ACPI_FAILURE (Status))
131  {
132  return (Status);
133  }
134 
135  /* Set or clear just the bit that corresponds to this GPE */
136 
137  RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
138  switch (Action)
139  {
141 
142  /* Only enable if the corresponding EnableMask bit is set */
143 
144  if (!(RegisterBit & GpeRegisterInfo->EnableMask))
145  {
146  return (AE_BAD_PARAMETER);
147  }
148 
149  /*lint -fallthrough */
150 
151  case ACPI_GPE_ENABLE:
152 
153  ACPI_SET_BIT (EnableMask, RegisterBit);
154  break;
155 
156  case ACPI_GPE_DISABLE:
157 
158  ACPI_CLEAR_BIT (EnableMask, RegisterBit);
159  break;
160 
161  default:
162 
163  ACPI_ERROR ((AE_INFO, "Invalid GPE Action, %u", Action));
164  return (AE_BAD_PARAMETER);
165  }
166 
167  if (!(RegisterBit & GpeRegisterInfo->MaskForRun))
168  {
169  /* Write the updated enable mask */
170 
171  Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
172  }
173  return (Status);
174 }
#define ACPI_GPE_CONDITIONAL_ENABLE
Definition: actypes.h:795
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define ACPI_SET_BIT(target, bit)
Definition: actypes.h:533
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_GENERIC_ADDRESS EnableAddress
Definition: aclocal.h:568
unsigned int UINT32
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
UINT32 AcpiHwGetGpeRegisterBit(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: hwgpe.c:81
struct acpi_gpe_register_info * RegisterInfo
Definition: aclocal.h:555
_In_ PLIST_ENTRY _In_ PSTRING _In_ USHORT _In_opt_ PSTRING _In_opt_ PSTRING _In_ ULONG _In_ ULONG Action
Definition: fsrtlfuncs.h:738
#define ACPI_CLEAR_BIT(target, bit)
Definition: actypes.h:534
ACPI_STATUS AcpiHwRead(UINT64 *Value, ACPI_GENERIC_ADDRESS *Reg)
Definition: hwregs.c:259
#define AE_NOT_EXIST
Definition: acexcep.h:114
#define ACPI_GPE_ENABLE
Definition: actypes.h:793
Status
Definition: gdiplustypes.h:24
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_GPE_DISABLE
Definition: actypes.h:794
unsigned long long UINT64
ACPI_STATUS AcpiHwWrite(UINT64 Value, ACPI_GENERIC_ADDRESS *Reg)
Definition: hwregs.c:357
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiEvEnableGpe(), AcpiEvFinishGpe(), AcpiEvGpeDispatch(), AcpiEvMaskGpe(), AcpiEvMatchGpeMethod(), AcpiEvRemoveGpeReference(), and AcpiSetGpe().