ReactOS  0.4.14-dev-358-gbef841c
evgpeblk.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#include "acnamesp.h"
Include dependency graph for evgpeblk.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_EVENTS
 

Functions

static ACPI_STATUS AcpiEvInstallGpeBlock (ACPI_GPE_BLOCK_INFO *GpeBlock, UINT32 InterruptNumber)
 
static ACPI_STATUS AcpiEvCreateGpeInfoBlocks (ACPI_GPE_BLOCK_INFO *GpeBlock)
 
ACPI_STATUS AcpiEvDeleteGpeBlock (ACPI_GPE_BLOCK_INFO *GpeBlock)
 
ACPI_STATUS AcpiEvCreateGpeBlock (ACPI_NAMESPACE_NODE *GpeDevice, UINT64 Address, UINT8 SpaceId, UINT32 RegisterCount, UINT16 GpeBlockBaseNumber, UINT32 InterruptNumber, ACPI_GPE_BLOCK_INFO **ReturnGpeBlock)
 
ACPI_STATUS AcpiEvInitializeGpeBlock (ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock, void *Context)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_EVENTS

Definition at line 49 of file evgpeblk.c.

Function Documentation

◆ AcpiEvCreateGpeBlock()

ACPI_STATUS AcpiEvCreateGpeBlock ( ACPI_NAMESPACE_NODE GpeDevice,
UINT64  Address,
UINT8  SpaceId,
UINT32  RegisterCount,
UINT16  GpeBlockBaseNumber,
UINT32  InterruptNumber,
ACPI_GPE_BLOCK_INFO **  ReturnGpeBlock 
)

Definition at line 371 of file evgpeblk.c.

379 {
381  ACPI_GPE_BLOCK_INFO *GpeBlock;
382  ACPI_GPE_WALK_INFO WalkInfo;
383 
384 
385  ACPI_FUNCTION_TRACE (EvCreateGpeBlock);
386 
387 
388  if (!RegisterCount)
389  {
391  }
392 
393  /* Allocate a new GPE block */
394 
395  GpeBlock = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_BLOCK_INFO));
396  if (!GpeBlock)
397  {
399  }
400 
401  /* Initialize the new GPE block */
402 
403  GpeBlock->Address = Address;
404  GpeBlock->SpaceId = SpaceId;
405  GpeBlock->Node = GpeDevice;
406  GpeBlock->GpeCount = (UINT16) (RegisterCount * ACPI_GPE_REGISTER_WIDTH);
407  GpeBlock->Initialized = FALSE;
408  GpeBlock->RegisterCount = RegisterCount;
409  GpeBlock->BlockBaseNumber = GpeBlockBaseNumber;
410 
411  /*
412  * Create the RegisterInfo and EventInfo sub-structures
413  * Note: disables and clears all GPEs in the block
414  */
415  Status = AcpiEvCreateGpeInfoBlocks (GpeBlock);
416  if (ACPI_FAILURE (Status))
417  {
418  ACPI_FREE (GpeBlock);
420  }
421 
422  /* Install the new block in the global lists */
423 
424  Status = AcpiEvInstallGpeBlock (GpeBlock, InterruptNumber);
425  if (ACPI_FAILURE (Status))
426  {
427  ACPI_FREE (GpeBlock->RegisterInfo);
428  ACPI_FREE (GpeBlock->EventInfo);
429  ACPI_FREE (GpeBlock);
431  }
432 
433  AcpiGbl_AllGpesInitialized = FALSE;
434 
435  /* Find all GPE methods (_Lxx or_Exx) for this block */
436 
437  WalkInfo.GpeBlock = GpeBlock;
438  WalkInfo.GpeDevice = GpeDevice;
439  WalkInfo.ExecuteByOwnerId = FALSE;
440 
443  AcpiEvMatchGpeMethod, NULL, &WalkInfo, NULL);
444 
445  /* Return the new block */
446 
447  if (ReturnGpeBlock)
448  {
449  (*ReturnGpeBlock) = GpeBlock;
450  }
451 
453  " Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X%s\n",
454  (UINT32) GpeBlock->BlockBaseNumber,
455  (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)),
456  GpeDevice->Name.Ascii, GpeBlock->RegisterCount, InterruptNumber,
457  InterruptNumber == AcpiGbl_FADT.SciInterrupt ? " (SCI)" : ""));
458 
459  /* Update global count of currently available GPEs */
460 
461  AcpiCurrentGpeCount += GpeBlock->GpeCount;
463 }
#define ACPI_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define AE_NO_MEMORY
Definition: acexcep.h:112
char Ascii[4]
Definition: actbl.h:394
ACPI_GPE_BLOCK_INFO * GpeBlock
Definition: aclocal.h:612
#define ACPI_NS_WALK_NO_UNLOCK
Definition: acnamesp.h:76
UINT32 ACPI_STATUS
Definition: actypes.h:460
static ACPI_STATUS AcpiEvCreateGpeInfoBlocks(ACPI_GPE_BLOCK_INFO *GpeBlock)
Definition: evgpeblk.c:231
ACPI_STATUS AcpiNsWalkNamespace(ACPI_OBJECT_TYPE Type, ACPI_HANDLE StartObject, UINT32 MaxDepth, UINT32 Flags, ACPI_WALK_CALLBACK DescendingCallback, ACPI_WALK_CALLBACK AscendingCallback, void *Context, void **ReturnValue)
Definition: nswalk.c:190
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE SpaceId
Definition: acpixf.h:828
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
ACPI_NAME_UNION Name
Definition: aclocal.h:191
ACPI_NAMESPACE_NODE * GpeDevice
Definition: aclocal.h:611
static ACPI_STATUS AcpiEvInstallGpeBlock(ACPI_GPE_BLOCK_INFO *GpeBlock, UINT32 InterruptNumber)
Definition: evgpeblk.c:81
#define ACPI_TYPE_METHOD
Definition: actypes.h:686
BOOLEAN ExecuteByOwnerId
Definition: aclocal.h:615
#define ACPI_UINT32_MAX
Definition: actypes.h:66
ACPI_GPE_REGISTER_INFO * RegisterInfo
Definition: aclocal.h:587
UINT32 RegisterCount
Definition: aclocal.h:590
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_INIT
Definition: acoutput.h:151
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
unsigned short UINT16
BOOLEAN Initialized
Definition: aclocal.h:594
ACPI_STATUS AcpiEvMatchGpeMethod(ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue)
Definition: evgpeinit.c:327
#define ACPI_GPE_REGISTER_WIDTH
Definition: actypes.h:407
#define AE_OK
Definition: acexcep.h:97
ACPI_GPE_EVENT_INFO * EventInfo
Definition: aclocal.h:588
ACPI_NAMESPACE_NODE * Node
Definition: aclocal.h:583
UINT16 BlockBaseNumber
Definition: aclocal.h:592

Referenced by AcpiEvGpeInitialize(), and AcpiInstallGpeBlock().

◆ AcpiEvCreateGpeInfoBlocks()

static ACPI_STATUS AcpiEvCreateGpeInfoBlocks ( ACPI_GPE_BLOCK_INFO GpeBlock)
static

Definition at line 231 of file evgpeblk.c.

233 {
234  ACPI_GPE_REGISTER_INFO *GpeRegisterInfo = NULL;
236  ACPI_GPE_EVENT_INFO *ThisEvent;
237  ACPI_GPE_REGISTER_INFO *ThisRegister;
238  UINT32 i;
239  UINT32 j;
241 
242 
243  ACPI_FUNCTION_TRACE (EvCreateGpeInfoBlocks);
244 
245 
246  /* Allocate the GPE register information block */
247 
248  GpeRegisterInfo = ACPI_ALLOCATE_ZEROED (
249  (ACPI_SIZE) GpeBlock->RegisterCount *
251  if (!GpeRegisterInfo)
252  {
254  "Could not allocate the GpeRegisterInfo table"));
256  }
257 
258  /*
259  * Allocate the GPE EventInfo block. There are eight distinct GPEs
260  * per register. Initialization to zeros is sufficient.
261  */
262  GpeEventInfo = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) GpeBlock->GpeCount *
264  if (!GpeEventInfo)
265  {
267  "Could not allocate the GpeEventInfo table"));
269  goto ErrorExit;
270  }
271 
272  /* Save the new Info arrays in the GPE block */
273 
274  GpeBlock->RegisterInfo = GpeRegisterInfo;
275  GpeBlock->EventInfo = GpeEventInfo;
276 
277  /*
278  * Initialize the GPE Register and Event structures. A goal of these
279  * tables is to hide the fact that there are two separate GPE register
280  * sets in a given GPE hardware block, the status registers occupy the
281  * first half, and the enable registers occupy the second half.
282  */
283  ThisRegister = GpeRegisterInfo;
284  ThisEvent = GpeEventInfo;
285 
286  for (i = 0; i < GpeBlock->RegisterCount; i++)
287  {
288  /* Init the RegisterInfo for this GPE register (8 GPEs) */
289 
290  ThisRegister->BaseGpeNumber = (UINT16)
291  (GpeBlock->BlockBaseNumber + (i * ACPI_GPE_REGISTER_WIDTH));
292 
293  ThisRegister->StatusAddress.Address =
294  GpeBlock->Address + i;
295 
296  ThisRegister->EnableAddress.Address =
297  GpeBlock->Address + i + GpeBlock->RegisterCount;
298 
299  ThisRegister->StatusAddress.SpaceId = GpeBlock->SpaceId;
300  ThisRegister->EnableAddress.SpaceId = GpeBlock->SpaceId;
303  ThisRegister->StatusAddress.BitOffset = 0;
304  ThisRegister->EnableAddress.BitOffset = 0;
305 
306  /* Init the EventInfo for each GPE within this register */
307 
308  for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
309  {
310  ThisEvent->GpeNumber = (UINT8) (ThisRegister->BaseGpeNumber + j);
311  ThisEvent->RegisterInfo = ThisRegister;
312  ThisEvent++;
313  }
314 
315  /* Disable all GPEs within this register */
316 
317  Status = AcpiHwWrite (0x00, &ThisRegister->EnableAddress);
318  if (ACPI_FAILURE (Status))
319  {
320  goto ErrorExit;
321  }
322 
323  /* Clear any pending GPE events within this register */
324 
325  Status = AcpiHwWrite (0xFF, &ThisRegister->StatusAddress);
326  if (ACPI_FAILURE (Status))
327  {
328  goto ErrorExit;
329  }
330 
331  ThisRegister++;
332  }
333 
335 
336 
337 ErrorExit:
338  if (GpeRegisterInfo)
339  {
340  ACPI_FREE (GpeRegisterInfo);
341  }
342  if (GpeEventInfo)
343  {
345  }
346 
348 }
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define AE_NO_MEMORY
Definition: acexcep.h:112
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
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
ACPI_GENERIC_ADDRESS EnableAddress
Definition: aclocal.h:568
unsigned int UINT32
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
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
struct acpi_gpe_register_info * RegisterInfo
Definition: aclocal.h:555
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
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
static VOID ErrorExit(LPTSTR lpszMessage)
Definition: telnetd.c:647
unsigned short UINT16
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_GPE_REGISTER_WIDTH
Definition: actypes.h:407
unsigned char UINT8
ACPI_STATUS AcpiHwWrite(UINT64 Value, ACPI_GENERIC_ADDRESS *Reg)
Definition: hwregs.c:357
#define AE_OK
Definition: acexcep.h:97
ACPI_GPE_EVENT_INFO * EventInfo
Definition: aclocal.h:588
UINT16 BlockBaseNumber
Definition: aclocal.h:592

Referenced by AcpiEvCreateGpeBlock().

◆ AcpiEvDeleteGpeBlock()

ACPI_STATUS AcpiEvDeleteGpeBlock ( ACPI_GPE_BLOCK_INFO GpeBlock)

Definition at line 148 of file evgpeblk.c.

150 {
153 
154 
155  ACPI_FUNCTION_TRACE (EvInstallGpeBlock);
156 
157 
159  if (ACPI_FAILURE (Status))
160  {
162  }
163 
164  /* Disable all GPEs in this block */
165 
166  Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock, NULL);
167  if (ACPI_FAILURE (Status))
168  {
170  }
171 
172  if (!GpeBlock->Previous && !GpeBlock->Next)
173  {
174  /* This is the last GpeBlock on this interrupt */
175 
176  Status = AcpiEvDeleteGpeXrupt (GpeBlock->XruptBlock);
177  if (ACPI_FAILURE (Status))
178  {
179  goto UnlockAndExit;
180  }
181  }
182  else
183  {
184  /* Remove the block on this interrupt with lock */
185 
186  Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
187  if (GpeBlock->Previous)
188  {
189  GpeBlock->Previous->Next = GpeBlock->Next;
190  }
191  else
192  {
193  GpeBlock->XruptBlock->GpeBlockListHead = GpeBlock->Next;
194  }
195 
196  if (GpeBlock->Next)
197  {
198  GpeBlock->Next->Previous = GpeBlock->Previous;
199  }
200 
201  AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
202  }
203 
204  AcpiCurrentGpeCount -= GpeBlock->GpeCount;
205 
206  /* Free the GpeBlock */
207 
208  ACPI_FREE (GpeBlock->RegisterInfo);
209  ACPI_FREE (GpeBlock->EventInfo);
210  ACPI_FREE (GpeBlock);
211 
212 UnlockAndExit:
215 }
struct acpi_gpe_block_info * Next
Definition: aclocal.h:585
#define ACPI_FREE(a)
Definition: actypes.h:386
ACPI_CPU_FLAGS AcpiOsAcquireLock(ACPI_SPINLOCK Handle)
Definition: osl.c:498
#define ACPI_CPU_FLAGS
Definition: actypes.h:252
UINT32 ACPI_STATUS
Definition: actypes.h:460
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
struct acpi_gpe_xrupt_info * XruptBlock
Definition: aclocal.h:586
smooth NULL
Definition: ftsmooth.c:416
HRESULT Next([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] STATPROPSETSTG *rgelt, [out] ULONG *pceltFetched)
struct acpi_gpe_block_info * Previous
Definition: aclocal.h:584
ACPI_GPE_REGISTER_INFO * RegisterInfo
Definition: aclocal.h:587
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiEvDeleteGpeXrupt(ACPI_GPE_XRUPT_INFO *GpeXrupt)
Definition: evgpeutil.c:270
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
#define ACPI_MTX_EVENTS
Definition: aclocal.h:87
void AcpiOsReleaseLock(ACPI_SPINLOCK Handle, ACPI_CPU_FLAGS Flags)
Definition: osl.c:516
ACPI_GPE_EVENT_INFO * EventInfo
Definition: aclocal.h:588

Referenced by AcpiRemoveGpeBlock(), and AcpiUtDeleteInternalObj().

◆ AcpiEvInitializeGpeBlock()

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

Definition at line 481 of file evgpeblk.c.

485 {
488  UINT32 GpeEnabledCount;
489  UINT32 GpeIndex;
490  UINT32 i;
491  UINT32 j;
492  BOOLEAN *IsPollingNeeded = Context;
494 
495 
496  ACPI_FUNCTION_TRACE (EvInitializeGpeBlock);
497 
498 
499  /*
500  * Ignore a null GPE block (e.g., if no GPE block 1 exists), and
501  * any GPE blocks that have been initialized already.
502  */
503  if (!GpeBlock || GpeBlock->Initialized)
504  {
506  }
507 
508  /*
509  * Enable all GPEs that have a corresponding method and have the
510  * ACPI_GPE_CAN_WAKE flag unset. Any other GPEs within this block
511  * must be enabled via the acpi_enable_gpe() interface.
512  */
513  GpeEnabledCount = 0;
514 
515  for (i = 0; i < GpeBlock->RegisterCount; i++)
516  {
517  for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
518  {
519  /* Get the info block for this particular GPE */
520 
521  GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
522  GpeEventInfo = &GpeBlock->EventInfo[GpeIndex];
523  ACPI_ERROR_ONLY(GpeNumber = GpeBlock->BlockBaseNumber + GpeIndex);
525 
526  /*
527  * Ignore GPEs that have no corresponding _Lxx/_Exx method
528  * and GPEs that are used to wake the system
529  */
532  {
533  continue;
534  }
535 
537  if (ACPI_FAILURE (Status))
538  {
540  "Could not enable GPE 0x%02X",
541  GpeNumber));
542  continue;
543  }
544 
546 
547  if (IsPollingNeeded &&
549  {
550  *IsPollingNeeded = TRUE;
551  }
552 
553  GpeEnabledCount++;
554  }
555  }
556 
557  if (GpeEnabledCount)
558  {
559  ACPI_INFO ((
560  "Enabled %u GPEs in block %02X to %02X", GpeEnabledCount,
561  (UINT32) GpeBlock->BlockBaseNumber,
562  (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1))));
563  }
564 
565  GpeBlock->Initialized = TRUE;
567 }
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define ACPI_GPE_INITIALIZED
Definition: actypes.h:823
#define TRUE
Definition: types.h:120
#define ACPI_ERROR_ONLY(s)
Definition: acmacros.h:467
#define ACPI_GPE_AUTO_ENABLED
Definition: actypes.h:822
#define ACPI_GPE_DISPATCH_TYPE(flags)
Definition: actypes.h:815
#define ACPI_GPE_CAN_WAKE
Definition: actypes.h:821
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
ACPI_STATUS AcpiEvAddGpeReference(ACPI_GPE_EVENT_INFO *GpeEventInfo, BOOLEAN ClearOnEnable)
Definition: evgpe.c:221
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
#define ACPI_GPE_DISPATCH_METHOD
Definition: actypes.h:810
unsigned char BOOLEAN
#define AE_INFO
Definition: acoutput.h:230
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_GPE_IS_POLLING_NEEDED(__gpe__)
Definition: acevents.h:59
ACPI_GPE_EVENT_INFO UINT32 GpeNumber
Definition: acevents.h:195
UINT32 RegisterCount
Definition: aclocal.h:590
#define ACPI_INFO(plist)
Definition: acoutput.h:237
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
struct tagContext Context
Definition: acpixf.h:1030
BOOLEAN Initialized
Definition: aclocal.h:594
#define ACPI_GPE_REGISTER_WIDTH
Definition: actypes.h:407
#define AE_OK
Definition: acexcep.h:97
ACPI_GPE_EVENT_INFO * EventInfo
Definition: aclocal.h:588
UINT16 BlockBaseNumber
Definition: aclocal.h:592

Referenced by AcpiUpdateAllGpes().

◆ AcpiEvInstallGpeBlock()

static ACPI_STATUS AcpiEvInstallGpeBlock ( ACPI_GPE_BLOCK_INFO GpeBlock,
UINT32  InterruptNumber 
)
static

Definition at line 81 of file evgpeblk.c.

84 {
85  ACPI_GPE_BLOCK_INFO *NextGpeBlock;
86  ACPI_GPE_XRUPT_INFO *GpeXruptBlock;
89 
90 
91  ACPI_FUNCTION_TRACE (EvInstallGpeBlock);
92 
93 
95  if (ACPI_FAILURE (Status))
96  {
98  }
99 
100  Status = AcpiEvGetGpeXruptBlock (InterruptNumber, &GpeXruptBlock);
101  if (ACPI_FAILURE (Status))
102  {
103  goto UnlockAndExit;
104  }
105 
106  /* Install the new block at the end of the list with lock */
107 
108  Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
109  if (GpeXruptBlock->GpeBlockListHead)
110  {
111  NextGpeBlock = GpeXruptBlock->GpeBlockListHead;
112  while (NextGpeBlock->Next)
113  {
114  NextGpeBlock = NextGpeBlock->Next;
115  }
116 
117  NextGpeBlock->Next = GpeBlock;
118  GpeBlock->Previous = NextGpeBlock;
119  }
120  else
121  {
122  GpeXruptBlock->GpeBlockListHead = GpeBlock;
123  }
124 
125  GpeBlock->XruptBlock = GpeXruptBlock;
126  AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
127 
128 
129 UnlockAndExit:
132 }
struct acpi_gpe_block_info * Next
Definition: aclocal.h:585
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
#define ACPI_CPU_FLAGS
Definition: actypes.h:252
UINT32 ACPI_STATUS
Definition: actypes.h:460
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
struct acpi_gpe_xrupt_info * XruptBlock
Definition: aclocal.h:586
ACPI_STATUS AcpiEvGetGpeXruptBlock(UINT32 InterruptNumber, ACPI_GPE_XRUPT_INFO **GpeXruptBlock)
Definition: evgpeutil.c:178
struct acpi_gpe_block_info * Previous
Definition: aclocal.h:584
ACPI_GPE_BLOCK_INFO * GpeBlockListHead
Definition: aclocal.h:604
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_MTX_EVENTS
Definition: aclocal.h:87
void AcpiOsReleaseLock(ACPI_SPINLOCK Handle, ACPI_CPU_FLAGS Flags)
Definition: osl.c:516

Referenced by AcpiEvCreateGpeBlock().