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

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_EVENTS
 

Functions

static void ACPI_SYSTEM_XFACE AcpiEvAsynchExecuteGpeMethod (void *Context)
 
static void ACPI_SYSTEM_XFACE AcpiEvAsynchEnableGpe (void *Context)
 
ACPI_STATUS AcpiEvUpdateGpeEnableMask (ACPI_GPE_EVENT_INFO *GpeEventInfo)
 
ACPI_STATUS AcpiEvEnableGpe (ACPI_GPE_EVENT_INFO *GpeEventInfo)
 
ACPI_STATUS AcpiEvMaskGpe (ACPI_GPE_EVENT_INFO *GpeEventInfo, BOOLEAN IsMasked)
 
ACPI_STATUS AcpiEvAddGpeReference (ACPI_GPE_EVENT_INFO *GpeEventInfo, BOOLEAN ClearOnEnable)
 
ACPI_STATUS AcpiEvRemoveGpeReference (ACPI_GPE_EVENT_INFO *GpeEventInfo)
 
ACPI_GPE_EVENT_INFOAcpiEvLowGetGpeInfo (UINT32 GpeNumber, ACPI_GPE_BLOCK_INFO *GpeBlock)
 
ACPI_GPE_EVENT_INFOAcpiEvGetGpeEventInfo (ACPI_HANDLE GpeDevice, UINT32 GpeNumber)
 
UINT32 AcpiEvGpeDetect (ACPI_GPE_XRUPT_INFO *GpeXruptList)
 
ACPI_STATUS AcpiEvFinishGpe (ACPI_GPE_EVENT_INFO *GpeEventInfo)
 
UINT32 AcpiEvDetectGpe (ACPI_NAMESPACE_NODE *GpeDevice, ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 GpeNumber)
 
UINT32 AcpiEvGpeDispatch (ACPI_NAMESPACE_NODE *GpeDevice, ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 GpeNumber)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_EVENTS

Definition at line 49 of file evgpe.c.

Function Documentation

◆ AcpiEvAddGpeReference()

ACPI_STATUS AcpiEvAddGpeReference ( ACPI_GPE_EVENT_INFO GpeEventInfo,
BOOLEAN  ClearOnEnable 
)

Definition at line 221 of file evgpe.c.

224 {
226 
227 
228  ACPI_FUNCTION_TRACE (EvAddGpeReference);
229 
230 
232  {
234  }
235 
237  if (GpeEventInfo->RuntimeCount == 1)
238  {
239  /* Enable on first reference */
240 
241  if (ClearOnEnable)
242  {
244  }
245 
247  if (ACPI_SUCCESS (Status))
248  {
250  }
251 
252  if (ACPI_FAILURE (Status))
253  {
255  }
256  }
257 
259 }
#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
ACPI_STATUS AcpiEvUpdateGpeEnableMask(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: evgpe.c:79
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define AE_LIMIT
Definition: acexcep.h:124
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_UINT8_MAX
Definition: actypes.h:64
ACPI_STATUS AcpiEvEnableGpe(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: evgpe.c:126
ACPI_STATUS AcpiHwClearGpe(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: hwgpe.c:190
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiEnableGpe(), AcpiEvInitializeGpeBlock(), and AcpiRemoveGpeHandler().

◆ AcpiEvAsynchEnableGpe()

static void ACPI_SYSTEM_XFACE AcpiEvAsynchEnableGpe ( void Context)
static

Definition at line 641 of file evgpe.c.

643 {
646 
647 
648  Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
650  AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
651 
652  return;
653 }
ACPI_CPU_FLAGS AcpiOsAcquireLock(ACPI_SPINLOCK Handle)
Definition: osl.c:498
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
#define ACPI_CPU_FLAGS
Definition: actypes.h:252
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
ACPI_STATUS AcpiEvFinishGpe(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: evgpe.c:670
void AcpiOsReleaseLock(ACPI_SPINLOCK Handle, ACPI_CPU_FLAGS Flags)
Definition: osl.c:516
struct tagContext Context
Definition: acpixf.h:1024

Referenced by AcpiEvAsynchExecuteGpeMethod().

◆ AcpiEvAsynchExecuteGpeMethod()

static void ACPI_SYSTEM_XFACE AcpiEvAsynchExecuteGpeMethod ( void Context)
static

Definition at line 538 of file evgpe.c.

540 {
545 
546 
547  ACPI_FUNCTION_TRACE (EvAsynchExecuteGpeMethod);
548 
549 
550  /* Do the correct dispatch - normal method or implicit notify */
551 
553  {
555  /*
556  * Implicit notify.
557  * Dispatch a DEVICE_WAKE notify to the appropriate handler.
558  * NOTE: the request is queued for execution after this method
559  * completes. The notify handlers are NOT invoked synchronously
560  * from this thread -- because handlers may in turn run other
561  * control methods.
562  *
563  * June 2012: Expand implicit notify mechanism to support
564  * notifies on multiple device objects.
565  */
567  while (ACPI_SUCCESS (Status) && Notify)
568  {
570  Notify->DeviceNode, ACPI_NOTIFY_DEVICE_WAKE);
571 
572  Notify = Notify->Next;
573  }
574  break;
575 
577 
578  /* Allocate the evaluation information block */
579 
581  if (!Info)
582  {
584  }
585  else
586  {
587  /*
588  * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the
589  * _Lxx/_Exx control method that corresponds to this GPE
590  */
591  Info->PrefixNode = GpeEventInfo->Dispatch.MethodNode;
593 
595  ACPI_FREE (Info);
596  }
597 
598  if (ACPI_FAILURE (Status))
599  {
601  "while evaluating GPE method [%4.4s]",
603  }
604  break;
605 
606  default:
607 
608  goto ErrorExit; /* Should never happen */
609  }
610 
611  /* Defer enabling of GPE until all notify handlers are done */
612 
615  if (ACPI_SUCCESS (Status))
616  {
617  return_VOID;
618  }
619 
620 ErrorExit:
622  return_VOID;
623 }
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
BOOL WINAPI SHIM_OBJ_NAME() Notify(DWORD fdwReason, PVOID ptr)
ACPI_GPE_NOTIFY_INFO * NotifyList
Definition: aclocal.h:544
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define ACPI_NOTIFY_DEVICE_WAKE
Definition: actypes.h:649
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_GPE_DISPATCH_TYPE(flags)
Definition: actypes.h:815
ACPI_STATUS AcpiNsEvaluate(ACPI_EVALUATE_INFO *Info)
Definition: nseval.c:82
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_GPE_DISPATCH_NOTIFY
Definition: actypes.h:812
union acpi_gpe_dispatch_info Dispatch
Definition: aclocal.h:554
#define ACPI_GPE_DISPATCH_METHOD
Definition: actypes.h:810
#define AE_INFO
Definition: acoutput.h:230
#define return_VOID
Definition: acoutput.h:495
Status
Definition: gdiplustypes.h:24
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
static VOID ErrorExit(LPTSTR lpszMessage)
Definition: telnetd.c:647
ACPI_STATUS AcpiEvQueueNotifyRequest(ACPI_NAMESPACE_NODE *Node, UINT32 NotifyValue)
Definition: evmisc.c:111
static void ACPI_SYSTEM_XFACE AcpiEvAsynchEnableGpe(void *Context)
Definition: evgpe.c:641
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:305
struct tagContext Context
Definition: acpixf.h:1024
#define ACPI_IGNORE_RETURN_VALUE
Definition: acstruct.h:231
ACPI_NAMESPACE_NODE * MethodNode
Definition: aclocal.h:542
ACPI_STATUS AcpiOsExecute(ACPI_EXECUTE_TYPE Type, ACPI_OSD_EXEC_CALLBACK Function, void *Context)
Definition: osl.c:224
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiEvGpeDispatch().

◆ AcpiEvDetectGpe()

UINT32 AcpiEvDetectGpe ( ACPI_NAMESPACE_NODE GpeDevice,
ACPI_GPE_EVENT_INFO GpeEventInfo,
UINT32  GpeNumber 
)

Definition at line 722 of file evgpe.c.

726 {
728  UINT8 EnabledStatusByte;
729  UINT64 StatusReg;
730  UINT64 EnableReg;
731  UINT32 RegisterBit;
732  ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
733  ACPI_GPE_HANDLER_INFO *GpeHandlerInfo;
736 
737 
738  ACPI_FUNCTION_TRACE (EvGpeDetect);
739 
740 
741  Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
742 
743  if (!GpeEventInfo)
744  {
746  if (!GpeEventInfo)
747  {
748  goto ErrorExit;
749  }
750  }
751 
752  /* Get the info block for the entire GPE register */
753 
754  GpeRegisterInfo = GpeEventInfo->RegisterInfo;
755 
756  /* Get the register bitmask for this GPE */
757 
758  RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
759 
760  /* GPE currently enabled (enable bit == 1)? */
761 
762  Status = AcpiHwRead (&EnableReg, &GpeRegisterInfo->EnableAddress);
763  if (ACPI_FAILURE (Status))
764  {
765  goto ErrorExit;
766  }
767 
768  /* GPE currently active (status bit == 1)? */
769 
770  Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress);
771  if (ACPI_FAILURE (Status))
772  {
773  goto ErrorExit;
774  }
775 
776  /* Check if there is anything active at all in this GPE */
777 
779  "Read registers for GPE %02X: Status=%02X, Enable=%02X, "
780  "RunEnable=%02X, WakeEnable=%02X\n",
781  GpeNumber,
782  (UINT32) (StatusReg & RegisterBit),
783  (UINT32) (EnableReg & RegisterBit),
784  GpeRegisterInfo->EnableForRun,
785  GpeRegisterInfo->EnableForWake));
786 
787  EnabledStatusByte = (UINT8) (StatusReg & EnableReg);
788  if (!(EnabledStatusByte & RegisterBit))
789  {
790  goto ErrorExit;
791  }
792 
793  /* Invoke global event handler if present */
794 
795  AcpiGpeCount++;
796  if (AcpiGbl_GlobalEventHandler)
797  {
798  AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_GPE,
799  GpeDevice, GpeNumber,
800  AcpiGbl_GlobalEventHandlerContext);
801  }
802 
803  /* Found an active GPE */
804 
807  {
808  /* Dispatch the event to a raw handler */
809 
810  GpeHandlerInfo = GpeEventInfo->Dispatch.Handler;
811 
812  /*
813  * There is no protection around the namespace node
814  * and the GPE handler to ensure a safe destruction
815  * because:
816  * 1. The namespace node is expected to always
817  * exist after loading a table.
818  * 2. The GPE handler is expected to be flushed by
819  * AcpiOsWaitEventsComplete() before the
820  * destruction.
821  */
822  AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
823  IntStatus |= GpeHandlerInfo->Address (
824  GpeDevice, GpeNumber, GpeHandlerInfo->Context);
825  Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
826  }
827  else
828  {
829  /* Dispatch the event to a standard handler or method. */
830 
831  IntStatus |= AcpiEvGpeDispatch (GpeDevice,
833  }
834 
835 ErrorExit:
836  AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
837  return (IntStatus);
838 }
ACPI_CPU_FLAGS AcpiOsAcquireLock(ACPI_SPINLOCK Handle)
Definition: osl.c:498
#define ACPI_GPE_DISPATCH_TYPE(flags)
Definition: actypes.h:815
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
#define ACPI_CPU_FLAGS
Definition: actypes.h:252
ACPI_GPE_EVENT_INFO * AcpiEvGetGpeEventInfo(ACPI_HANDLE GpeDevice, UINT32 GpeNumber)
Definition: evgpe.c:372
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_GPE_DISPATCH_RAW_HANDLER
Definition: actypes.h:813
ACPI_GPE_HANDLER_INFO * Handler
Definition: aclocal.h:543
#define ACPI_DB_INTERRUPTS
Definition: acoutput.h:178
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_GENERIC_ADDRESS EnableAddress
Definition: aclocal.h:568
unsigned int UINT32
union acpi_gpe_dispatch_info Dispatch
Definition: aclocal.h:554
UINT32 AcpiEvGpeDispatch(ACPI_NAMESPACE_NODE *GpeDevice, ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 GpeNumber)
Definition: evgpe.c:857
UINT32 AcpiHwGetGpeRegisterBit(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: hwgpe.c:81
ACPI_GPE_HANDLER Address
Definition: aclocal.h:519
struct acpi_gpe_register_info * RegisterInfo
Definition: aclocal.h:555
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
ACPI_GENERIC_ADDRESS StatusAddress
Definition: aclocal.h:567
ACPI_STATUS AcpiHwRead(UINT64 *Value, ACPI_GENERIC_ADDRESS *Reg)
Definition: hwregs.c:259
ACPI_GPE_EVENT_INFO UINT32 GpeNumber
Definition: acevents.h:195
#define ACPI_INTERRUPT_NOT_HANDLED
Definition: actypes.h:1238
#define ACPI_EVENT_TYPE_GPE
Definition: actypes.h:1132
Status
Definition: gdiplustypes.h:24
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
static VOID ErrorExit(LPTSTR lpszMessage)
Definition: telnetd.c:647
void AcpiOsReleaseLock(ACPI_SPINLOCK Handle, ACPI_CPU_FLAGS Flags)
Definition: osl.c:516
unsigned long long UINT64
unsigned char UINT8

Referenced by AcpiDispatchGpe(), AcpiEnableGpe(), AcpiEvGpeDetect(), and AcpiRemoveGpeHandler().

◆ AcpiEvEnableGpe()

ACPI_STATUS AcpiEvEnableGpe ( ACPI_GPE_EVENT_INFO GpeEventInfo)

Definition at line 126 of file evgpe.c.

128 {
130 
131 
132  ACPI_FUNCTION_TRACE (EvEnableGpe);
133 
134 
135  /* Enable the requested GPE */
136 
139 }
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_GPE_ENABLE
Definition: actypes.h:793
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 AcpiHwLowSetGpe(ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 Action)
Definition: hwgpe.c:106

Referenced by AcpiEvAddGpeReference().

◆ AcpiEvFinishGpe()

ACPI_STATUS AcpiEvFinishGpe ( ACPI_GPE_EVENT_INFO GpeEventInfo)

Definition at line 670 of file evgpe.c.

672 {
674 
675 
678  {
679  /*
680  * GPE is level-triggered, we clear the GPE status bit after
681  * handling the event.
682  */
684  if (ACPI_FAILURE (Status))
685  {
686  return (Status);
687  }
688  }
689 
690  /*
691  * Enable this GPE, conditionally. This means that the GPE will
692  * only be physically enabled if the EnableMask bit is set
693  * in the EventInfo.
694  */
697  return (AE_OK);
698 }
#define ACPI_GPE_CONDITIONAL_ENABLE
Definition: actypes.h:795
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
BOOLEAN DisableForDispatch
Definition: aclocal.h:559
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_GPE_XRUPT_TYPE_MASK
Definition: actypes.h:819
#define ACPI_GPE_LEVEL_TRIGGERED
Definition: actypes.h:817
ACPI_STATUS AcpiHwClearGpe(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: hwgpe.c:190
Status
Definition: gdiplustypes.h:24
#define AE_OK
Definition: acexcep.h:97
ACPI_STATUS AcpiHwLowSetGpe(ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 Action)
Definition: hwgpe.c:106

Referenced by AcpiEvAsynchEnableGpe(), AcpiEvGpeDispatch(), and AcpiFinishGpe().

◆ AcpiEvGetGpeEventInfo()

ACPI_GPE_EVENT_INFO* AcpiEvGetGpeEventInfo ( ACPI_HANDLE  GpeDevice,
UINT32  GpeNumber 
)

Definition at line 372 of file evgpe.c.

375 {
376  ACPI_OPERAND_OBJECT *ObjDesc;
377  ACPI_GPE_EVENT_INFO *GpeInfo;
378  UINT32 i;
379 
380 
382 
383 
384  /* A NULL GpeDevice means use the FADT-defined GPE block(s) */
385 
386  if (!GpeDevice)
387  {
388  /* Examine GPE Block 0 and 1 (These blocks are permanent) */
389 
390  for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++)
391  {
392  GpeInfo = AcpiEvLowGetGpeInfo (GpeNumber,
393  AcpiGbl_GpeFadtBlocks[i]);
394  if (GpeInfo)
395  {
396  return (GpeInfo);
397  }
398  }
399 
400  /* The GpeNumber was not in the range of either FADT GPE block */
401 
402  return (NULL);
403  }
404 
405  /* A Non-NULL GpeDevice means this is a GPE Block Device */
406 
407  ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) GpeDevice);
408  if (!ObjDesc ||
409  !ObjDesc->Device.GpeBlock)
410  {
411  return (NULL);
412  }
413 
414  return (AcpiEvLowGetGpeInfo (GpeNumber, ObjDesc->Device.GpeBlock));
415 }
#define ACPI_MAX_GPE_BLOCKS
Definition: actypes.h:403
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_EVENT_INFO * AcpiEvLowGetGpeInfo(UINT32 GpeNumber, ACPI_GPE_BLOCK_INFO *GpeBlock)
Definition: evgpe.c:327
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO ACPI_GPE_BLOCK_INFO * GpeBlock
Definition: acobject.h:270
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
ACPI_GPE_EVENT_INFO UINT32 GpeNumber
Definition: acevents.h:195
ACPI_OBJECT_DEVICE Device
Definition: acobject.h:526

Referenced by AcpiClearGpe(), AcpiDisableGpe(), AcpiEnableGpe(), AcpiEvDetectGpe(), AcpiEvInstallGpeHandler(), AcpiFinishGpe(), AcpiGetGpeStatus(), AcpiMarkGpeForWake(), AcpiMaskGpe(), AcpiRemoveGpeHandler(), AcpiSetGpe(), AcpiSetGpeWakeMask(), and AcpiSetupGpeForWake().

◆ AcpiEvGpeDetect()

UINT32 AcpiEvGpeDetect ( ACPI_GPE_XRUPT_INFO GpeXruptList)

Definition at line 433 of file evgpe.c.

435 {
436  ACPI_GPE_BLOCK_INFO *GpeBlock;
437  ACPI_NAMESPACE_NODE *GpeDevice;
438  ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
443  UINT32 i;
444  UINT32 j;
445 
446 
447  ACPI_FUNCTION_NAME (EvGpeDetect);
448 
449  /* Check for the case where there are no GPEs */
450 
451  if (!GpeXruptList)
452  {
453  return (IntStatus);
454  }
455 
456  /*
457  * We need to obtain the GPE lock for both the data structs and registers
458  * Note: Not necessary to obtain the hardware lock, since the GPE
459  * registers are owned by the GpeLock.
460  */
461  Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
462 
463  /* Examine all GPE blocks attached to this interrupt level */
464 
465  GpeBlock = GpeXruptList->GpeBlockListHead;
466  while (GpeBlock)
467  {
468  GpeDevice = GpeBlock->Node;
469 
470  /*
471  * Read all of the 8-bit GPE status and enable registers in this GPE
472  * block, saving all of them. Find all currently active GP events.
473  */
474  for (i = 0; i < GpeBlock->RegisterCount; i++)
475  {
476  /* Get the next status/enable pair */
477 
478  GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
479 
480  /*
481  * Optimization: If there are no GPEs enabled within this
482  * register, we can safely ignore the entire register.
483  */
484  if (!(GpeRegisterInfo->EnableForRun |
485  GpeRegisterInfo->EnableForWake))
486  {
488  "Ignore disabled registers for GPE %02X-%02X: "
489  "RunEnable=%02X, WakeEnable=%02X\n",
490  GpeRegisterInfo->BaseGpeNumber,
491  GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1),
492  GpeRegisterInfo->EnableForRun,
493  GpeRegisterInfo->EnableForWake));
494  continue;
495  }
496 
497  /* Now look at the individual GPEs in this byte register */
498 
499  for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
500  {
501  /* Detect and dispatch one GPE bit */
502 
503  GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
505  GpeNumber = j + GpeRegisterInfo->BaseGpeNumber;
506  AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
507  IntStatus |= AcpiEvDetectGpe (
508  GpeDevice, GpeEventInfo, GpeNumber);
509  Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
510  }
511  }
512 
513  GpeBlock = GpeBlock->Next;
514  }
515 
516  AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
517  return (IntStatus);
518 }
struct acpi_gpe_block_info * Next
Definition: aclocal.h:585
ACPI_CPU_FLAGS AcpiOsAcquireLock(ACPI_SPINLOCK Handle)
Definition: osl.c:498
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
#define ACPI_CPU_FLAGS
Definition: actypes.h:252
#define ACPI_DB_INTERRUPTS
Definition: acoutput.h:178
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
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
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 GLint GLint j
Definition: glfuncs.h:250
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
ACPI_GPE_BLOCK_INFO * GpeBlockListHead
Definition: aclocal.h:604
ACPI_GPE_EVENT_INFO UINT32 GpeNumber
Definition: acevents.h:195
#define ACPI_INTERRUPT_NOT_HANDLED
Definition: actypes.h:1238
ACPI_GPE_REGISTER_INFO * RegisterInfo
Definition: aclocal.h:587
UINT32 RegisterCount
Definition: aclocal.h:590
UINT32 AcpiEvDetectGpe(ACPI_NAMESPACE_NODE *GpeDevice, ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 GpeNumber)
Definition: evgpe.c:722
void AcpiOsReleaseLock(ACPI_SPINLOCK Handle, ACPI_CPU_FLAGS Flags)
Definition: osl.c:516
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479
#define ACPI_GPE_REGISTER_WIDTH
Definition: actypes.h:407
ACPI_GPE_EVENT_INFO * EventInfo
Definition: aclocal.h:588
ACPI_NAMESPACE_NODE * Node
Definition: aclocal.h:583

Referenced by AcpiEvGpeXruptHandler(), AcpiEvSciXruptHandler(), and AcpiUpdateAllGpes().

◆ AcpiEvGpeDispatch()

UINT32 AcpiEvGpeDispatch ( ACPI_NAMESPACE_NODE GpeDevice,
ACPI_GPE_EVENT_INFO GpeEventInfo,
UINT32  GpeNumber 
)

Definition at line 857 of file evgpe.c.

861 {
864 
865 
866  ACPI_FUNCTION_TRACE (EvGpeDispatch);
867 
868 
869  /*
870  * Always disable the GPE so that it does not keep firing before
871  * any asynchronous activity completes (either from the execution
872  * of a GPE method or an asynchronous GPE handler.)
873  *
874  * If there is no handler or method to run, just disable the
875  * GPE and leave it disabled permanently to prevent further such
876  * pointless events from firing.
877  */
879  if (ACPI_FAILURE (Status))
880  {
882  "Unable to disable GPE %02X", GpeNumber));
884  }
885 
886  /*
887  * If edge-triggered, clear the GPE status bit now. Note that
888  * level-triggered events are cleared after the GPE is serviced.
889  */
892  {
894  if (ACPI_FAILURE (Status))
895  {
897  "Unable to clear GPE %02X", GpeNumber));
901  }
902  }
903 
905 
906  /*
907  * Dispatch the GPE to either an installed handler or the control
908  * method associated with this GPE (_Lxx or _Exx). If a handler
909  * exists, we invoke it and do not attempt to run the method.
910  * If there is neither a handler nor a method, leave the GPE
911  * disabled.
912  */
914  {
916 
917  /* Invoke the installed handler (at interrupt level) */
918 
920  GpeDevice, GpeNumber,
922 
923  /* If requested, clear (if level-triggered) and re-enable the GPE */
924 
926  {
928  }
929  break;
930 
933  /*
934  * Execute the method associated with the GPE
935  * NOTE: Level-triggered GPEs are cleared after the method completes.
936  */
939  if (ACPI_FAILURE (Status))
940  {
942  "Unable to queue handler for GPE %02X - event disabled",
943  GpeNumber));
944  }
945  break;
946 
947  default:
948  /*
949  * No handler or method to run!
950  * 03/2010: This case should no longer be possible. We will not allow
951  * a GPE to be enabled if it has no handler or method.
952  */
954  "No handler or method for GPE %02X, disabling event",
955  GpeNumber));
956  break;
957  }
958 
960 }
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define ACPI_GPE_CONDITIONAL_ENABLE
Definition: actypes.h:795
#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
BOOLEAN DisableForDispatch
Definition: aclocal.h:559
#define return_UINT32(s)
Definition: acoutput.h:501
#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
ACPI_GPE_HANDLER_INFO * Handler
Definition: aclocal.h:543
static void ACPI_SYSTEM_XFACE AcpiEvAsynchExecuteGpeMethod(void *Context)
Definition: evgpe.c:538
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_GPE_DISPATCH_NOTIFY
Definition: actypes.h:812
UINT32 void void ** ReturnValue
Definition: acevents.h:214
unsigned int UINT32
union acpi_gpe_dispatch_info Dispatch
Definition: aclocal.h:554
#define ACPI_GPE_DISPATCH_HANDLER
Definition: actypes.h:811
#define ACPI_GPE_DISPATCH_METHOD
Definition: actypes.h:810
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_REENABLE_GPE
Definition: actypes.h:1243
ACPI_GPE_HANDLER Address
Definition: aclocal.h:519
#define ACPI_GPE_XRUPT_TYPE_MASK
Definition: actypes.h:819
#define ACPI_INTERRUPT_HANDLED
Definition: actypes.h:1239
ACPI_GPE_EVENT_INFO UINT32 GpeNumber
Definition: acevents.h:195
#define ACPI_INTERRUPT_NOT_HANDLED
Definition: actypes.h:1238
ACPI_STATUS AcpiHwClearGpe(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: hwgpe.c:190
Status
Definition: gdiplustypes.h:24
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_STATUS AcpiEvFinishGpe(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: evgpe.c:670
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_GPE_DISABLE
Definition: actypes.h:794
#define ACPI_GPE_EDGE_TRIGGERED
Definition: actypes.h:818
ACPI_STATUS AcpiOsExecute(ACPI_EXECUTE_TYPE Type, ACPI_OSD_EXEC_CALLBACK Function, void *Context)
Definition: osl.c:224
ACPI_STATUS AcpiHwLowSetGpe(ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 Action)
Definition: hwgpe.c:106

Referenced by AcpiEvDetectGpe().

◆ AcpiEvLowGetGpeInfo()

ACPI_GPE_EVENT_INFO* AcpiEvLowGetGpeInfo ( UINT32  GpeNumber,
ACPI_GPE_BLOCK_INFO GpeBlock 
)

Definition at line 327 of file evgpe.c.

330 {
331  UINT32 GpeIndex;
332 
333 
334  /*
335  * Validate that the GpeNumber is within the specified GpeBlock.
336  * (Two steps)
337  */
338  if (!GpeBlock ||
339  (GpeNumber < GpeBlock->BlockBaseNumber))
340  {
341  return (NULL);
342  }
343 
344  GpeIndex = GpeNumber - GpeBlock->BlockBaseNumber;
345  if (GpeIndex >= GpeBlock->GpeCount)
346  {
347  return (NULL);
348  }
349 
350  return (&GpeBlock->EventInfo[GpeIndex]);
351 }
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
ACPI_GPE_EVENT_INFO UINT32 GpeNumber
Definition: acevents.h:195
ACPI_GPE_EVENT_INFO * EventInfo
Definition: aclocal.h:588
UINT16 BlockBaseNumber
Definition: aclocal.h:592

Referenced by AcpiEvGetGpeEventInfo(), and AcpiEvMatchGpeMethod().

◆ AcpiEvMaskGpe()

ACPI_STATUS AcpiEvMaskGpe ( ACPI_GPE_EVENT_INFO GpeEventInfo,
BOOLEAN  IsMasked 
)

Definition at line 156 of file evgpe.c.

159 {
160  ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
161  UINT32 RegisterBit;
162 
163 
164  ACPI_FUNCTION_TRACE (EvMaskGpe);
165 
166 
167  GpeRegisterInfo = GpeEventInfo->RegisterInfo;
168  if (!GpeRegisterInfo)
169  {
171  }
172 
173  RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
174 
175  /* Perform the action */
176 
177  if (IsMasked)
178  {
179  if (RegisterBit & GpeRegisterInfo->MaskForRun)
180  {
182  }
183 
185  ACPI_SET_BIT (GpeRegisterInfo->MaskForRun, (UINT8) RegisterBit);
186  }
187  else
188  {
189  if (!(RegisterBit & GpeRegisterInfo->MaskForRun))
190  {
192  }
193 
194  ACPI_CLEAR_BIT (GpeRegisterInfo->MaskForRun, (UINT8) RegisterBit);
195  if (GpeEventInfo->RuntimeCount &&
197  {
199  }
200  }
201 
203 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
BOOLEAN DisableForDispatch
Definition: aclocal.h:559
#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
unsigned int UINT32
UINT32 AcpiHwGetGpeRegisterBit(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: hwgpe.c:81
struct acpi_gpe_register_info * RegisterInfo
Definition: aclocal.h:555
#define ACPI_CLEAR_BIT(target, bit)
Definition: actypes.h:534
#define AE_NOT_EXIST
Definition: acexcep.h:114
#define ACPI_GPE_ENABLE
Definition: actypes.h:793
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_GPE_DISABLE
Definition: actypes.h:794
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97
ACPI_STATUS AcpiHwLowSetGpe(ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 Action)
Definition: hwgpe.c:106

Referenced by AcpiMaskGpe().

◆ AcpiEvRemoveGpeReference()

ACPI_STATUS AcpiEvRemoveGpeReference ( ACPI_GPE_EVENT_INFO GpeEventInfo)

Definition at line 276 of file evgpe.c.

278 {
280 
281 
282  ACPI_FUNCTION_TRACE (EvRemoveGpeReference);
283 
284 
286  {
288  }
289 
292  {
293  /* Disable on last reference */
294 
296  if (ACPI_SUCCESS (Status))
297  {
299  }
300 
301  if (ACPI_FAILURE (Status))
302  {
304  }
305  }
306 
308 }
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
ACPI_STATUS AcpiEvUpdateGpeEnableMask(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: evgpe.c:79
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define AE_LIMIT
Definition: acexcep.h:124
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_GPE_DISABLE
Definition: actypes.h:794
#define AE_OK
Definition: acexcep.h:97
ACPI_STATUS AcpiHwLowSetGpe(ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 Action)
Definition: hwgpe.c:106

Referenced by AcpiDisableGpe(), AcpiEvInstallGpeHandler(), and AcpiSetupGpeForWake().

◆ AcpiEvUpdateGpeEnableMask()

ACPI_STATUS AcpiEvUpdateGpeEnableMask ( ACPI_GPE_EVENT_INFO GpeEventInfo)

Definition at line 79 of file evgpe.c.

81 {
82  ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
83  UINT32 RegisterBit;
84 
85 
86  ACPI_FUNCTION_TRACE (EvUpdateGpeEnableMask);
87 
88 
89  GpeRegisterInfo = GpeEventInfo->RegisterInfo;
90  if (!GpeRegisterInfo)
91  {
93  }
94 
95  RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
96 
97  /* Clear the run bit up front */
98 
99  ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
100 
101  /* Set the mask bit only if there are references to this GPE */
102 
104  {
105  ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, (UINT8) RegisterBit);
106  }
107 
108  GpeRegisterInfo->EnableMask = GpeRegisterInfo->EnableForRun;
110 }
#define ACPI_SET_BIT(target, bit)
Definition: actypes.h:533
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
unsigned int UINT32
UINT32 AcpiHwGetGpeRegisterBit(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: hwgpe.c:81
struct acpi_gpe_register_info * RegisterInfo
Definition: aclocal.h:555
#define ACPI_CLEAR_BIT(target, bit)
Definition: actypes.h:534
#define AE_NOT_EXIST
Definition: acexcep.h:114
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiEvAddGpeReference(), and AcpiEvRemoveGpeReference().