ReactOS 0.4.15-dev-6694-g4ba8af9
acevents.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ACPI_GPE_IS_POLLING_NEEDED(__gpe__)   FALSE
 

Functions

ACPI_STATUS AcpiEvInitializeEvents (void)
 
ACPI_STATUS AcpiEvInstallXruptHandlers (void)
 
UINT32 AcpiEvFixedEventDetect (void)
 
BOOLEAN AcpiEvIsNotifyObject (ACPI_NAMESPACE_NODE *Node)
 
UINT32 AcpiEvGetGpeNumberIndex (UINT32 GpeNumber)
 
ACPI_STATUS AcpiEvQueueNotifyRequest (ACPI_NAMESPACE_NODE *Node, UINT32 NotifyValue)
 
ACPI_STATUS AcpiEvInitGlobalLockHandler (void)
 
 ACPI_HW_DEPENDENT_RETURN_OK (ACPI_STATUS AcpiEvAcquireGlobalLock(UINT16 Timeout)) ACPI_HW_DEPENDENT_RETURN_OK(ACPI_STATUS AcpiEvReleaseGlobalLock(void)) ACPI_STATUS AcpiEvRemoveGlobalLockHandler(void)
 
UINT32 AcpiEvGpeDetect (ACPI_GPE_XRUPT_INFO *GpeXruptList)
 
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_INFOAcpiEvGetGpeEventInfo (ACPI_HANDLE GpeDevice, UINT32 GpeNumber)
 
ACPI_GPE_EVENT_INFOAcpiEvLowGetGpeInfo (UINT32 GpeNumber, ACPI_GPE_BLOCK_INFO *GpeBlock)
 
ACPI_STATUS AcpiEvFinishGpe (ACPI_GPE_EVENT_INFO *GpeEventInfo)
 
UINT32 AcpiEvDetectGpe (ACPI_NAMESPACE_NODE *GpeDevice, ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 GpeNumber)
 
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)
 
 ACPI_HW_DEPENDENT_RETURN_OK (ACPI_STATUS AcpiEvDeleteGpeBlock(ACPI_GPE_BLOCK_INFO *GpeBlock)) UINT32 AcpiEvGpeDispatch(ACPI_NAMESPACE_NODE *GpeDevice
 
ACPI_STATUS AcpiEvGpeInitialize (void)
 
 ACPI_HW_DEPENDENT_RETURN_VOID (void AcpiEvUpdateGpes(ACPI_OWNER_ID TableOwnerId)) ACPI_STATUS AcpiEvMatchGpeMethod(ACPI_HANDLE ObjHandle
 
ACPI_STATUS AcpiEvWalkGpeList (ACPI_GPE_CALLBACK GpeWalkCallback, void *Context)
 
ACPI_STATUS AcpiEvGetGpeDevice (ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock, void *Context)
 
ACPI_STATUS AcpiEvGetGpeXruptBlock (UINT32 InterruptNumber, ACPI_GPE_XRUPT_INFO **GpeXruptBlock)
 
ACPI_STATUS AcpiEvDeleteGpeXrupt (ACPI_GPE_XRUPT_INFO *GpeXrupt)
 
ACPI_STATUS AcpiEvDeleteGpeHandlers (ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock, void *Context)
 
ACPI_OPERAND_OBJECTAcpiEvFindRegionHandler (ACPI_ADR_SPACE_TYPE SpaceId, ACPI_OPERAND_OBJECT *HandlerObj)
 
BOOLEAN AcpiEvHasDefaultHandler (ACPI_NAMESPACE_NODE *Node, ACPI_ADR_SPACE_TYPE SpaceId)
 
ACPI_STATUS AcpiEvInstallRegionHandlers (void)
 
ACPI_STATUS AcpiEvInstallSpaceHandler (ACPI_NAMESPACE_NODE *Node, ACPI_ADR_SPACE_TYPE SpaceId, ACPI_ADR_SPACE_HANDLER Handler, ACPI_ADR_SPACE_SETUP Setup, void *Context)
 
ACPI_STATUS AcpiEvInitializeOpRegions (void)
 
ACPI_STATUS AcpiEvAddressSpaceDispatch (ACPI_OPERAND_OBJECT *RegionObj, ACPI_OPERAND_OBJECT *FieldObj, UINT32 Function, UINT32 RegionOffset, UINT32 BitWidth, UINT64 *Value)
 
ACPI_STATUS AcpiEvAttachRegion (ACPI_OPERAND_OBJECT *HandlerObj, ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsIsLocked)
 
void AcpiEvDetachRegion (ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsIsLocked)
 
void AcpiEvExecuteRegMethods (ACPI_NAMESPACE_NODE *Node, ACPI_ADR_SPACE_TYPE SpaceId, UINT32 Function)
 
ACPI_STATUS AcpiEvExecuteRegMethod (ACPI_OPERAND_OBJECT *RegionObj, UINT32 Function)
 
ACPI_STATUS AcpiEvSystemMemoryRegionSetup (ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext)
 
ACPI_STATUS AcpiEvIoSpaceRegionSetup (ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext)
 
ACPI_STATUS AcpiEvPciConfigRegionSetup (ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext)
 
ACPI_STATUS AcpiEvCmosRegionSetup (ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext)
 
ACPI_STATUS AcpiEvPciBarRegionSetup (ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext)
 
ACPI_STATUS AcpiEvDataTableRegionSetup (ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext)
 
ACPI_STATUS AcpiEvDefaultRegionSetup (ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext)
 
ACPI_STATUS AcpiEvInitializeRegion (ACPI_OPERAND_OBJECT *RegionObj)
 
BOOLEAN AcpiEvIsPciRootBridge (ACPI_NAMESPACE_NODE *Node)
 
UINT32 ACPI_SYSTEM_XFACE AcpiEvGpeXruptHandler (void *Context)
 
UINT32 AcpiEvSciDispatch (void)
 
UINT32 AcpiEvInstallSciHandler (void)
 
ACPI_STATUS AcpiEvRemoveAllSciHandlers (void)
 

Variables

ACPI_GPE_EVENT_INFOGpeEventInfo
 
ACPI_GPE_EVENT_INFO UINT32 GpeNumber
 
UINT32 Level
 
UINT32 voidContext
 
UINT32 void void ** ReturnValue
 

Macro Definition Documentation

◆ ACPI_GPE_IS_POLLING_NEEDED

#define ACPI_GPE_IS_POLLING_NEEDED (   __gpe__)    FALSE

Definition at line 59 of file acevents.h.

Function Documentation

◆ ACPI_HW_DEPENDENT_RETURN_OK() [1/2]

ACPI_HW_DEPENDENT_RETURN_OK ( ACPI_STATUS   AcpiEvAcquireGlobalLockUINT16 Timeout)

◆ ACPI_HW_DEPENDENT_RETURN_OK() [2/2]

ACPI_HW_DEPENDENT_RETURN_OK ( ACPI_STATUS   AcpiEvDeleteGpeBlock ACPI_GPE_BLOCK_INFO *GpeBlock)

◆ ACPI_HW_DEPENDENT_RETURN_VOID()

ACPI_HW_DEPENDENT_RETURN_VOID ( void   AcpiEvUpdateGpes ACPI_OWNER_ID TableOwnerId)

◆ 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}
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_LIMIT
Definition: acexcep.h:124
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define AE_OK
Definition: acexcep.h:97
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_UINT8_MAX
Definition: actypes.h:64
ACPI_STATUS AcpiEvUpdateGpeEnableMask(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: evgpe.c:79
ACPI_STATUS AcpiEvEnableGpe(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: evgpe.c:126
Status
Definition: gdiplustypes.h:25
ACPI_STATUS AcpiHwClearGpe(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: hwgpe.c:190

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

◆ AcpiEvAddressSpaceDispatch()

ACPI_STATUS AcpiEvAddressSpaceDispatch ( ACPI_OPERAND_OBJECT RegionObj,
ACPI_OPERAND_OBJECT FieldObj,
UINT32  Function,
UINT32  RegionOffset,
UINT32  BitWidth,
UINT64 Value 
)

Definition at line 150 of file evregion.c.

157{
160 ACPI_ADR_SPACE_SETUP RegionSetup;
161 ACPI_OPERAND_OBJECT *HandlerDesc;
162 ACPI_OPERAND_OBJECT *RegionObj2;
163 void *RegionContext = NULL;
165 ACPI_MUTEX ContextMutex;
166 BOOLEAN ContextLocked;
167 ACPI_PHYSICAL_ADDRESS Address;
168
169
170 ACPI_FUNCTION_TRACE (EvAddressSpaceDispatch);
171
172
173 RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
174 if (!RegionObj2)
175 {
177 }
178
179 /* Ensure that there is a handler associated with this region */
180
181 HandlerDesc = RegionObj->Region.Handler;
182 if (!HandlerDesc)
183 {
185 "No handler for Region [%4.4s] (%p) [%s]",
186 AcpiUtGetNodeName (RegionObj->Region.Node),
187 RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
188
190 }
191
192 Context = HandlerDesc->AddressSpace.Context;
193 ContextMutex = HandlerDesc->AddressSpace.ContextMutex;
194 ContextLocked = FALSE;
195
196 /*
197 * It may be the case that the region has never been initialized.
198 * Some types of regions require special init code
199 */
200 if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE))
201 {
202 /* This region has not been initialized yet, do it */
203
204 RegionSetup = HandlerDesc->AddressSpace.Setup;
205 if (!RegionSetup)
206 {
207 /* No initialization routine, exit with error */
208
210 "No init routine for region(%p) [%s]",
211 RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
213 }
214
216 {
217 ACPI_PCC_INFO *Ctx = HandlerDesc->AddressSpace.Context;
218
219 Ctx->InternalBuffer = FieldObj->Field.InternalPccBuffer;
220 Ctx->Length = (UINT16) RegionObj->Region.Length;
221 Ctx->SubspaceId = (UINT8) RegionObj->Region.Address;
222 }
223
225 {
226 ACPI_FFH_INFO *Ctx = HandlerDesc->AddressSpace.Context;
227
228 Ctx->Length = RegionObj->Region.Length;
229 Ctx->Offset = RegionObj->Region.Address;
230 }
231
232 /*
233 * We must exit the interpreter because the region setup will
234 * potentially execute control methods (for example, the _REG method
235 * for this region)
236 */
238
239 Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE,
240 Context, &RegionContext);
241
242 /* Re-enter the interpreter */
243
245
246 /* Check for failure of the Region Setup */
247
248 if (ACPI_FAILURE (Status))
249 {
251 "During region initialization: [%s]",
252 AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
254 }
255
256 /* Region initialization may have been completed by RegionSetup */
257
258 if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE))
259 {
260 RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
261
262 /*
263 * Save the returned context for use in all accesses to
264 * the handler for this particular region
265 */
266 if (!(RegionObj2->Extra.RegionContext))
267 {
268 RegionObj2->Extra.RegionContext = RegionContext;
269 }
270 }
271 }
272
273 /* We have everything we need, we can invoke the address space handler */
274
275 Handler = HandlerDesc->AddressSpace.Handler;
276 Address = (RegionObj->Region.Address + RegionOffset);
277
279 "Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
280 &RegionObj->Region.Handler->AddressSpace, Handler,
282 AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
283
284 if (!(HandlerDesc->AddressSpace.HandlerFlags &
286 {
287 /*
288 * For handlers other than the default (supplied) handlers, we must
289 * exit the interpreter because the handler *might* block -- we don't
290 * know what it will do, so we can't hold the lock on the interpreter.
291 */
293 }
294
295 /*
296 * Special handling for GenericSerialBus and GeneralPurposeIo:
297 * There are three extra parameters that must be passed to the
298 * handler via the context:
299 * 1) Connection buffer, a resource template from Connection() op
300 * 2) Length of the above buffer
301 * 3) Actual access length from the AccessAs() op
302 *
303 * Since we pass these extra parameters via the context, which is
304 * shared between threads, we must lock the context to avoid these
305 * parameters being changed from another thread before the handler
306 * has completed running.
307 *
308 * In addition, for GeneralPurposeIo, the Address and BitWidth fields
309 * are defined as follows:
310 * 1) Address is the pin number index of the field (bit offset from
311 * the previous Connection)
312 * 2) BitWidth is the actual bit length of the field (number of pins)
313 */
314 if ((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS ||
315 RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO) &&
316 Context &&
317 FieldObj)
318 {
319
321 if (ACPI_FAILURE (Status))
322 {
323 goto ReEnterInterpreter;
324 }
325
326 ContextLocked = TRUE;
327
328 /* Get the Connection (ResourceTemplate) buffer */
329
330 Context->Connection = FieldObj->Field.ResourceBuffer;
331 Context->Length = FieldObj->Field.ResourceLength;
332 Context->AccessLength = FieldObj->Field.AccessLength;
333
334 if (RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)
335 {
336 Address = FieldObj->Field.PinNumberIndex;
337 BitWidth = FieldObj->Field.BitLength;
338 }
339 }
340
341 /* Call the handler */
342
343 Status = Handler (Function, Address, BitWidth, Value, Context,
344 RegionObj2->Extra.RegionContext);
345
346 if (ContextLocked)
347 {
348 AcpiOsReleaseMutex (ContextMutex);
349 }
350
351 if (ACPI_FAILURE (Status))
352 {
353 ACPI_EXCEPTION ((AE_INFO, Status, "Returned by Handler for [%s]",
354 AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
355
356 /*
357 * Special case for an EC timeout. These are seen so frequently
358 * that an additional error message is helpful
359 */
360 if ((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) &&
361 (Status == AE_TIME))
362 {
364 "Timeout from EC hardware or EC device driver"));
365 }
366 }
367
368ReEnterInterpreter:
369 if (!(HandlerDesc->AddressSpace.HandlerFlags &
371 {
372 /*
373 * We just returned from a non-default handler, we must re-enter the
374 * interpreter
375 */
377 }
378
380}
unsigned short UINT16
unsigned char BOOLEAN
unsigned char UINT8
#define AE_NOT_EXIST
Definition: acexcep.h:114
#define AE_TIME
Definition: acexcep.h:125
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
ACPI_OPERAND_OBJECT * AcpiNsGetSecondaryObject(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: nsobject.c:346
#define AOPOBJ_SETUP_COMPLETE
Definition: acobject.h:99
#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED
Definition: acobject.h:426
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_DB_OPREGION
Definition: acoutput.h:167
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx 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 Handler
Definition: acpixf.h:672
#define ACPI_ADR_SPACE_EC
Definition: actypes.h:864
#define ACPI_MUTEX
Definition: actypes.h:273
#define ACPI_REGION_ACTIVATE
Definition: actypes.h:1245
#define AcpiOsAcquireMutex(Handle, Time)
Definition: actypes.h:276
#define ACPI_ADR_SPACE_PLATFORM_COMM
Definition: actypes.h:871
ACPI_STATUS(* ACPI_ADR_SPACE_SETUP)(ACPI_HANDLE RegionHandle, UINT32 Function, void *HandlerContext, void **RegionContext)
Definition: actypes.h:1239
#define ACPI_ADR_SPACE_GSBUS
Definition: actypes.h:870
#define AcpiOsReleaseMutex(Handle)
Definition: actypes.h:277
ACPI_STATUS(* ACPI_ADR_SPACE_HANDLER)(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext)
Definition: actypes.h:1203
#define ACPI_ADR_SPACE_FIXED_HARDWARE
Definition: actypes.h:885
#define ACPI_WAIT_FOREVER
Definition: actypes.h:501
#define ACPI_ADR_SPACE_GPIO
Definition: actypes.h:869
const char * AcpiUtGetRegionName(UINT8 SpaceId)
Definition: utdecode.c:125
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:306
_In_ CDROM_SCAN_FOR_SPECIAL_INFO _In_ PCDROM_SCAN_FOR_SPECIAL_HANDLER Function
Definition: cdrom.h:1156
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
void AcpiExExitInterpreter(void)
Definition: exutils.c:139
void AcpiExEnterInterpreter(void)
Definition: exutils.c:91
static WCHAR Address[46]
Definition: ping.c:68
UINT64 Offset
Definition: actypes.h:1234
UINT64 Length
Definition: actypes.h:1235
ACPI_ADR_SPACE_HANDLER Handler
Definition: acobject.h:414
ACPI_MUTEX ContextMutex
Definition: acobject.h:417
ACPI_ADR_SPACE_SETUP Setup
Definition: acobject.h:418
void * RegionContext
Definition: acobject.h:483
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO UINT16 ResourceLength
Definition: acobject.h:345
ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:203
ACPI_OBJECT_COMMON_HEADER UINT8 SpaceId
Definition: acobject.h:202
ACPI_PHYSICAL_ADDRESS Address
Definition: acobject.h:206
union acpi_operand_object * Handler
Definition: acobject.h:204
UINT16 Length
Definition: actypes.h:1227
UINT8 SubspaceId
Definition: actypes.h:1226
UINT8 * InternalBuffer
Definition: actypes.h:1228
ACPI_OBJECT_REGION_FIELD Field
Definition: acobject.h:534
ACPI_OBJECT_ADDR_HANDLER AddressSpace
Definition: acobject.h:539
ACPI_OBJECT_REGION Region
Definition: acobject.h:527
ACPI_OBJECT_EXTRA Extra
Definition: acobject.h:541
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by AcpiExAccessRegion(), and AcpiExRegionRead().

◆ AcpiEvAttachRegion()

ACPI_STATUS AcpiEvAttachRegion ( ACPI_OPERAND_OBJECT HandlerObj,
ACPI_OPERAND_OBJECT RegionObj,
BOOLEAN  AcpiNsIsLocked 
)

Definition at line 568 of file evregion.c.

572{
573
574 ACPI_FUNCTION_TRACE (EvAttachRegion);
575
576
577 /* Install the region's handler */
578
579 if (RegionObj->Region.Handler)
580 {
582 }
583
585 "Adding Region [%4.4s] %p to address handler %p [%s]\n",
586 AcpiUtGetNodeName (RegionObj->Region.Node),
587 RegionObj, HandlerObj,
588 AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
589
590 /* Link this region to the front of the handler's list */
591
592 RegionObj->Region.Next = HandlerObj->AddressSpace.RegionList;
593 HandlerObj->AddressSpace.RegionList = RegionObj;
594 RegionObj->Region.Handler = HandlerObj;
595 AcpiUtAddReference (HandlerObj);
596
598}
#define AE_ALREADY_EXISTS
Definition: acexcep.h:115
void AcpiUtAddReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:752
union acpi_operand_object * RegionList
Definition: acobject.h:419
union acpi_operand_object * Next
Definition: acobject.h:205

Referenced by AcpiEvInitializeRegion(), and AcpiEvInstallHandler().

◆ AcpiEvCmosRegionSetup()

ACPI_STATUS AcpiEvCmosRegionSetup ( ACPI_HANDLE  Handle,
UINT32  Function,
void HandlerContext,
void **  RegionContext 
)

Definition at line 481 of file evrgnini.c.

486{
487 ACPI_FUNCTION_TRACE (EvCmosRegionSetup);
488
489
491}

Referenced by AcpiEvInstallSpaceHandler().

◆ 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 */
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}
unsigned int UINT32
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_NS_WALK_NO_UNLOCK
Definition: acnamesp.h:76
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_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
#define ACPI_DB_INIT
Definition: acoutput.h:151
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx 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:832
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_UINT32_MAX
Definition: actypes.h:66
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define ACPI_GPE_REGISTER_WIDTH
Definition: actypes.h:407
#define ACPI_TYPE_METHOD
Definition: actypes.h:695
static ACPI_STATUS AcpiEvInstallGpeBlock(ACPI_GPE_BLOCK_INFO *GpeBlock, UINT32 InterruptNumber)
Definition: evgpeblk.c:81
static ACPI_STATUS AcpiEvCreateGpeInfoBlocks(ACPI_GPE_BLOCK_INFO *GpeBlock)
Definition: evgpeblk.c:231
ACPI_STATUS AcpiEvMatchGpeMethod(ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue)
Definition: evgpeinit.c:327
UINT16 BlockBaseNumber
Definition: aclocal.h:592
UINT32 RegisterCount
Definition: aclocal.h:590
BOOLEAN Initialized
Definition: aclocal.h:594
ACPI_GPE_REGISTER_INFO * RegisterInfo
Definition: aclocal.h:587
ACPI_NAMESPACE_NODE * Node
Definition: aclocal.h:583
ACPI_GPE_EVENT_INFO * EventInfo
Definition: aclocal.h:588
ACPI_GPE_BLOCK_INFO * GpeBlock
Definition: aclocal.h:612
ACPI_NAMESPACE_NODE * GpeDevice
Definition: aclocal.h:611
BOOLEAN ExecuteByOwnerId
Definition: aclocal.h:615
ACPI_NAME_UNION Name
Definition: aclocal.h:191
char Ascii[4]
Definition: actbl.h:394

Referenced by AcpiEvGpeInitialize(), and AcpiInstallGpeBlock().

◆ AcpiEvDataTableRegionSetup()

ACPI_STATUS AcpiEvDataTableRegionSetup ( ACPI_HANDLE  Handle,
UINT32  Function,
void HandlerContext,
void **  RegionContext 
)

Definition at line 512 of file evrgnini.c.

517{
519 ACPI_DATA_TABLE_MAPPING *LocalRegionContext;
520
521
522 ACPI_FUNCTION_TRACE (EvDataTableRegionSetup);
523
524
526 {
527 if (*RegionContext)
528 {
529 ACPI_FREE (*RegionContext);
530 *RegionContext = NULL;
531 }
533 }
534
535 /* Create a new context */
536
537 LocalRegionContext = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_DATA_TABLE_MAPPING));
538 if (!(LocalRegionContext))
539 {
541 }
542
543 /* Save the data table pointer for use in the handler */
544
545 LocalRegionContext->Pointer = RegionDesc->Region.Pointer;
546
547 *RegionContext = LocalRegionContext;
549}
#define ACPI_REGION_DEACTIVATE
Definition: actypes.h:1246
ULONG Handle
Definition: gdb_input.c:15

Referenced by AcpiEvInstallSpaceHandler().

◆ AcpiEvDefaultRegionSetup()

ACPI_STATUS AcpiEvDefaultRegionSetup ( ACPI_HANDLE  Handle,
UINT32  Function,
void HandlerContext,
void **  RegionContext 
)

Definition at line 568 of file evrgnini.c.

573{
574 ACPI_FUNCTION_TRACE (EvDefaultRegionSetup);
575
576
578 {
579 *RegionContext = NULL;
580 }
581 else
582 {
583 *RegionContext = HandlerContext;
584 }
585
587}

Referenced by AcpiEvInstallSpaceHandler().

◆ AcpiEvDeleteGpeHandlers()

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

Definition at line 339 of file evgpeutil.c.

343{
347 UINT32 i;
348 UINT32 j;
349
350
351 ACPI_FUNCTION_TRACE (EvDeleteGpeHandlers);
352
353
354 /* Examine each GPE Register within the block */
355
356 for (i = 0; i < GpeBlock->RegisterCount; i++)
357 {
358 /* Now look at the individual GPEs in this byte register */
359
360 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
361 {
362 GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
364
369 {
370 /* Delete an installed handler block */
371
374 GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK;
375 }
378 {
379 /* Delete the implicit notification device list */
380
382 while (Notify)
383 {
384 Next = Notify->Next;
386 Notify = Next;
387 }
388
390 GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK;
391 }
392 }
393 }
394
396}
#define ACPI_GPE_DISPATCH_TYPE(flags)
Definition: actypes.h:825
#define ACPI_GPE_DISPATCH_NOTIFY
Definition: actypes.h:822
#define ACPI_GPE_DISPATCH_RAW_HANDLER
Definition: actypes.h:823
#define ACPI_GPE_DISPATCH_HANDLER
Definition: actypes.h:821
BOOL WINAPI SHIM_OBJ_NAME() Notify(DWORD fdwReason, PVOID ptr)
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
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
union acpi_gpe_dispatch_info Dispatch
Definition: aclocal.h:554
ACPI_GPE_HANDLER_INFO * Handler
Definition: aclocal.h:543
ACPI_GPE_NOTIFY_INFO * NotifyList
Definition: aclocal.h:544

Referenced by AcpiEvTerminate().

◆ AcpiEvDeleteGpeXrupt()

ACPI_STATUS AcpiEvDeleteGpeXrupt ( ACPI_GPE_XRUPT_INFO GpeXrupt)

Definition at line 270 of file evgpeutil.c.

272{
275
276
277 ACPI_FUNCTION_TRACE (EvDeleteGpeXrupt);
278
279
280 /* We never want to remove the SCI interrupt handler */
281
282 if (GpeXrupt->InterruptNumber == AcpiGbl_FADT.SciInterrupt)
283 {
284 GpeXrupt->GpeBlockListHead = NULL;
286 }
287
288 /* Disable this interrupt */
289
292 if (ACPI_FAILURE (Status))
293 {
295 }
296
297 /* Unlink the interrupt block with lock */
298
299 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
300 if (GpeXrupt->Previous)
301 {
302 GpeXrupt->Previous->Next = GpeXrupt->Next;
303 }
304 else
305 {
306 /* No previous, update list head */
307
308 AcpiGbl_GpeXruptListHead = GpeXrupt->Next;
309 }
310
311 if (GpeXrupt->Next)
312 {
313 GpeXrupt->Next->Previous = GpeXrupt->Previous;
314 }
315 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
316
317 /* Free the block */
318
319 ACPI_FREE (GpeXrupt);
321}
ACPI_STATUS AcpiOsRemoveInterruptHandler(UINT32 InterruptNumber, ACPI_OSD_HANDLER ServiceRoutine)
Definition: osl.c:606
void AcpiOsReleaseLock(ACPI_SPINLOCK Handle, ACPI_CPU_FLAGS Flags)
Definition: osl.c:516
ACPI_CPU_FLAGS AcpiOsAcquireLock(ACPI_SPINLOCK Handle)
Definition: osl.c:498
#define ACPI_CPU_FLAGS
Definition: actypes.h:252
UINT32 ACPI_SYSTEM_XFACE AcpiEvGpeXruptHandler(void *Context)
Definition: evsci.c:176
HRESULT Next([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] STATPROPSETSTG *rgelt, [out] ULONG *pceltFetched)
UINT32 InterruptNumber
Definition: aclocal.h:605
struct acpi_gpe_xrupt_info * Previous
Definition: aclocal.h:602
struct acpi_gpe_xrupt_info * Next
Definition: aclocal.h:603
ACPI_GPE_BLOCK_INFO * GpeBlockListHead
Definition: aclocal.h:604
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by AcpiEvDeleteGpeBlock().

◆ AcpiEvDetachRegion()

void AcpiEvDetachRegion ( ACPI_OPERAND_OBJECT RegionObj,
BOOLEAN  AcpiNsIsLocked 
)

Definition at line 398 of file evregion.c.

401{
402 ACPI_OPERAND_OBJECT *HandlerObj;
403 ACPI_OPERAND_OBJECT *ObjDesc;
404 ACPI_OPERAND_OBJECT *StartDesc;
405 ACPI_OPERAND_OBJECT **LastObjPtr;
406 ACPI_ADR_SPACE_SETUP RegionSetup;
407 void **RegionContext;
408 ACPI_OPERAND_OBJECT *RegionObj2;
410
411
412 ACPI_FUNCTION_TRACE (EvDetachRegion);
413
414
415 RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
416 if (!RegionObj2)
417 {
419 }
420 RegionContext = &RegionObj2->Extra.RegionContext;
421
422 /* Get the address handler from the region object */
423
424 HandlerObj = RegionObj->Region.Handler;
425 if (!HandlerObj)
426 {
427 /* This region has no handler, all done */
428
430 }
431
432 /* Find this region in the handler's list */
433
434 ObjDesc = HandlerObj->AddressSpace.RegionList;
435 StartDesc = ObjDesc;
436 LastObjPtr = &HandlerObj->AddressSpace.RegionList;
437
438 while (ObjDesc)
439 {
440 /* Is this the correct Region? */
441
442 if (ObjDesc == RegionObj)
443 {
445 "Removing Region %p from address handler %p\n",
446 RegionObj, HandlerObj));
447
448 /* This is it, remove it from the handler's list */
449
450 *LastObjPtr = ObjDesc->Region.Next;
451 ObjDesc->Region.Next = NULL; /* Must clear field */
452
453 if (AcpiNsIsLocked)
454 {
456 if (ACPI_FAILURE (Status))
457 {
459 }
460 }
461
462 /* Now stop region accesses by executing the _REG method */
463
465 if (ACPI_FAILURE (Status))
466 {
467 ACPI_EXCEPTION ((AE_INFO, Status, "from region _REG, [%s]",
468 AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
469 }
470
471 if (AcpiNsIsLocked)
472 {
474 if (ACPI_FAILURE (Status))
475 {
477 }
478 }
479
480 /*
481 * If the region has been activated, call the setup handler with
482 * the deactivate notification
483 */
484 if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)
485 {
486 RegionSetup = HandlerObj->AddressSpace.Setup;
487 Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE,
488 HandlerObj->AddressSpace.Context, RegionContext);
489
490 /*
491 * RegionContext should have been released by the deactivate
492 * operation. We don't need access to it anymore here.
493 */
494 if (RegionContext)
495 {
496 *RegionContext = NULL;
497 }
498
499 /* Init routine may fail, Just ignore errors */
500
501 if (ACPI_FAILURE (Status))
502 {
504 "from region handler - deactivate, [%s]",
505 AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
506 }
507
508 RegionObj->Region.Flags &= ~(AOPOBJ_SETUP_COMPLETE);
509 }
510
511 /*
512 * Remove handler reference in the region
513 *
514 * NOTE: this doesn't mean that the region goes away, the region
515 * is just inaccessible as indicated to the _REG method
516 *
517 * If the region is on the handler's list, this must be the
518 * region's handler
519 */
520 RegionObj->Region.Handler = NULL;
521 AcpiUtRemoveReference (HandlerObj);
522
524 }
525
526 /* Walk the linked list of handlers */
527
528 LastObjPtr = &ObjDesc->Region.Next;
529 ObjDesc = ObjDesc->Region.Next;
530
531 /* Prevent infinite loop if list is corrupted */
532
533 if (ObjDesc == StartDesc)
534 {
536 "Circular handler list in region object %p",
537 RegionObj));
539 }
540 }
541
542 /* If we get here, the region was not in the handler's region list */
543
545 "Cannot remove region %p from address handler %p\n",
546 RegionObj, HandlerObj));
547
549}
#define ACPI_MTX_NAMESPACE
Definition: aclocal.h:85
#define return_VOID
Definition: acoutput.h:495
#define ACPI_REG_DISCONNECT
Definition: actypes.h:889
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:790
ACPI_STATUS AcpiEvExecuteRegMethod(ACPI_OPERAND_OBJECT *RegionObj, UINT32 Function)
Definition: evregion.c:615

Referenced by AcpiEvInstallHandler(), and AcpiRemoveAddressSpaceHandler().

◆ 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
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
836 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
837 return (IntStatus);
838}
unsigned long long UINT64
ACPI_GPE_EVENT_INFO UINT32 GpeNumber
Definition: acevents.h:196
#define ACPI_DB_INTERRUPTS
Definition: acoutput.h:178
#define ACPI_INTERRUPT_NOT_HANDLED
Definition: actypes.h:1263
#define ACPI_EVENT_TYPE_GPE
Definition: actypes.h:1143
UINT32 AcpiEvGpeDispatch(ACPI_NAMESPACE_NODE *GpeDevice, ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 GpeNumber)
Definition: evgpe.c:857
ACPI_GPE_EVENT_INFO * AcpiEvGetGpeEventInfo(ACPI_HANDLE GpeDevice, UINT32 GpeNumber)
Definition: evgpe.c:372
UINT32 AcpiHwGetGpeRegisterBit(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: hwgpe.c:81
ACPI_STATUS AcpiHwRead(UINT64 *Value, ACPI_GENERIC_ADDRESS *Reg)
Definition: hwregs.c:259
struct acpi_gpe_register_info * RegisterInfo
Definition: aclocal.h:555
ACPI_GPE_HANDLER Address
Definition: aclocal.h:519
ACPI_GENERIC_ADDRESS EnableAddress
Definition: aclocal.h:568
ACPI_GENERIC_ADDRESS StatusAddress
Definition: aclocal.h:567
static VOID ErrorExit(LPTSTR lpszMessage)
Definition: telnetd.c:647

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}
#define ACPI_GPE_ENABLE
Definition: actypes.h:803
ACPI_STATUS AcpiHwLowSetGpe(ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 Action)
Definition: hwgpe.c:106

Referenced by AcpiEvAddGpeReference().

◆ AcpiEvExecuteRegMethod()

ACPI_STATUS AcpiEvExecuteRegMethod ( ACPI_OPERAND_OBJECT RegionObj,
UINT32  Function 
)

Definition at line 615 of file evregion.c.

618{
621 ACPI_OPERAND_OBJECT *RegionObj2;
622 const ACPI_NAME *RegNamePtr = ACPI_CAST_PTR (ACPI_NAME, METHOD_NAME__REG);
623 ACPI_NAMESPACE_NODE *MethodNode;
626
627
628 ACPI_FUNCTION_TRACE (EvExecuteRegMethod);
629
630
631 if (!AcpiGbl_NamespaceInitialized ||
632 RegionObj->Region.Handler == NULL)
633 {
635 }
636
637 RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
638 if (!RegionObj2)
639 {
641 }
642
643 /*
644 * Find any "_REG" method associated with this region definition.
645 * The method should always be updated as this function may be
646 * invoked after a namespace change.
647 */
648 Node = RegionObj->Region.Node->Parent;
650 *RegNamePtr, Node, ACPI_TYPE_METHOD, &MethodNode);
651 if (ACPI_SUCCESS (Status))
652 {
653 /*
654 * The _REG method is optional and there can be only one per
655 * region definition. This will be executed when the handler is
656 * attached or removed.
657 */
658 RegionObj2->Extra.Method_REG = MethodNode;
659 }
660 if (RegionObj2->Extra.Method_REG == NULL)
661 {
663 }
664
665 /* _REG(DISCONNECT) should be paired with _REG(CONNECT) */
666
667 if ((Function == ACPI_REG_CONNECT &&
668 RegionObj->Common.Flags & AOPOBJ_REG_CONNECTED) ||
670 !(RegionObj->Common.Flags & AOPOBJ_REG_CONNECTED)))
671 {
673 }
674
675 /* Allocate and initialize the evaluation information block */
676
678 if (!Info)
679 {
681 }
682
683 Info->PrefixNode = RegionObj2->Extra.Method_REG;
684 Info->RelativePathname = NULL;
685 Info->Parameters = Args;
687
688 /*
689 * The _REG method has two arguments:
690 *
691 * Arg0 - Integer:
692 * Operation region space ID Same value as RegionObj->Region.SpaceId
693 *
694 * Arg1 - Integer:
695 * connection status 1 for connecting the handler, 0 for disconnecting
696 * the handler (Passed as a parameter)
697 */
699 if (!Args[0])
700 {
702 goto Cleanup1;
703 }
704
706 if (!Args[1])
707 {
709 goto Cleanup2;
710 }
711
712 Args[2] = NULL; /* Terminate list */
713
714 /* Execute the method, no return value */
715
717 AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Info->PrefixNode, NULL));
718
721
722 if (ACPI_FAILURE (Status))
723 {
724 goto Cleanup2;
725 }
726
728 {
729 RegionObj->Common.Flags |= AOPOBJ_REG_CONNECTED;
730 }
731 else
732 {
733 RegionObj->Common.Flags &= ~AOPOBJ_REG_CONNECTED;
734 }
735
736Cleanup2:
738
739Cleanup1:
740 ACPI_FREE (Info);
742}
char ** Args
Definition: acdebug.h:353
#define METHOD_NAME__REG
Definition: acnames.h:70
ACPI_STATUS AcpiNsSearchOneScope(UINT32 EntryName, ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_TYPE Type, ACPI_NAMESPACE_NODE **RetNode)
Definition: nssearch.c:98
ACPI_STATUS AcpiNsEvaluate(ACPI_EVALUATE_INFO *Info)
Definition: nseval.c:82
#define AOPOBJ_REG_CONNECTED
Definition: acobject.h:98
#define ACPI_DEBUG_EXEC(a)
Definition: acoutput.h:477
#define ACPI_IGNORE_RETURN_VALUE
Definition: acstruct.h:231
#define ACPI_REG_CONNECT
Definition: actypes.h:890
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
UINT32 ACPI_NAME
Definition: actypes.h:461
ACPI_OPERAND_OBJECT * AcpiUtCreateIntegerObject(UINT64 Value)
Definition: utobject.c:223
union node Node
Definition: types.h:1255
struct acpi_namespace_node * Parent
Definition: aclocal.h:192
ACPI_OBJECT_COMMON_HEADER ACPI_NAMESPACE_NODE * Method_REG
Definition: acobject.h:481
ACPI_OBJECT_COMMON Common
Definition: acobject.h:519
Definition: dlist.c:348
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690

Referenced by AcpiEvDetachRegion(), AcpiEvInitializeRegion(), and AcpiEvRegRun().

◆ AcpiEvExecuteRegMethods()

void AcpiEvExecuteRegMethods ( ACPI_NAMESPACE_NODE Node,
ACPI_ADR_SPACE_TYPE  SpaceId,
UINT32  Function 
)

Definition at line 761 of file evregion.c.

765{
767
768
769 ACPI_FUNCTION_TRACE (EvExecuteRegMethods);
770
771 /*
772 * These address spaces do not need a call to _REG, since the ACPI
773 * specification defines them as: "must always be accessible". Since
774 * they never change state (never become unavailable), no need to ever
775 * call _REG on them. Also, a DataTable is not a "real" address space,
776 * so do not call _REG. September 2018.
777 */
781 {
783 }
784
785 Info.SpaceId = SpaceId;
786 Info.Function = Function;
787 Info.RegRunCount = 0;
788
790 " Running _REG methods for SpaceId %s\n",
791 AcpiUtGetRegionName (Info.SpaceId)));
792
793 /*
794 * Run all _REG methods for all Operation Regions for this space ID. This
795 * is a separate walk in order to handle any interdependencies between
796 * regions and _REG methods. (i.e. handlers must be installed for all
797 * regions of this Space ID before we can run any _REG methods)
798 */
801
802 /*
803 * Special case for EC and GPIO: handle "orphan" _REG methods with
804 * no region.
805 */
807 {
809 }
810
812 " Executed %u _REG methods for SpaceId %s\n",
813 Info.RegRunCount, AcpiUtGetRegionName (Info.SpaceId)));
814
816}
#define ACPI_NS_WALK_UNLOCK
Definition: acnamesp.h:77
#define ACPI_DB_NAMES
Definition: acoutput.h:166
#define ACPI_ADR_SPACE_SYSTEM_IO
Definition: actypes.h:862
#define ACPI_ADR_SPACE_SYSTEM_MEMORY
Definition: actypes.h:861
#define ACPI_TYPE_ANY
Definition: actypes.h:687
#define ACPI_ADR_SPACE_DATA_TABLE
Definition: actypes.h:884
static void AcpiEvExecuteOrphanRegMethod(ACPI_NAMESPACE_NODE *DeviceNode, ACPI_ADR_SPACE_TYPE SpaceId)
Definition: evregion.c:909
static ACPI_STATUS AcpiEvRegRun(ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue)
Definition: evregion.c:830

Referenced by AcpiEvInitializeOpRegions(), and AcpiInstallAddressSpaceHandler().

◆ AcpiEvFindRegionHandler()

ACPI_OPERAND_OBJECT * AcpiEvFindRegionHandler ( ACPI_ADR_SPACE_TYPE  SpaceId,
ACPI_OPERAND_OBJECT HandlerObj 
)

Definition at line 346 of file evhandler.c.

349{
350
351 /* Walk the handler list for this device */
352
353 while (HandlerObj)
354 {
355 /* Same SpaceId indicates a handler is installed */
356
357 if (HandlerObj->AddressSpace.SpaceId == SpaceId)
358 {
359 return (HandlerObj);
360 }
361
362 /* Next handler object */
363
364 HandlerObj = HandlerObj->AddressSpace.Next;
365 }
366
367 return (NULL);
368}
ACPI_OBJECT_COMMON_HEADER UINT8 SpaceId
Definition: acobject.h:412
union acpi_operand_object * Next
Definition: acobject.h:420

Referenced by AcpiEvInitializeRegion(), AcpiEvInstallHandler(), and AcpiEvInstallSpaceHandler().

◆ 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_LEVEL_TRIGGERED
Definition: actypes.h:827
#define ACPI_GPE_CONDITIONAL_ENABLE
Definition: actypes.h:805
#define ACPI_GPE_XRUPT_TYPE_MASK
Definition: actypes.h:829
BOOLEAN DisableForDispatch
Definition: aclocal.h:559

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

◆ AcpiEvFixedEventDetect()

UINT32 AcpiEvFixedEventDetect ( void  )

Definition at line 233 of file evevent.c.

235{
237 UINT32 FixedStatus;
238 UINT32 FixedEnable;
239 UINT32 i;
241
242
243 ACPI_FUNCTION_NAME (EvFixedEventDetect);
244
245
246 /*
247 * Read the fixed feature status and enable registers, as all the cases
248 * depend on their values. Ignore errors here.
249 */
252 if (ACPI_FAILURE (Status))
253 {
254 return (IntStatus);
255 }
256
257 if (FixedEnable & ACPI_BITMASK_PCIEXP_WAKE_DISABLE)
258 FixedEnable &= ~ACPI_BITMASK_PCIEXP_WAKE_DISABLE;
259 else
261
263 "Fixed Event Block: Enable %08X Status %08X\n",
264 FixedEnable, FixedStatus));
265
266 /*
267 * Check for all possible Fixed Events and dispatch those that are active
268 */
269 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
270 {
271 /* Both the status and enable bits must be on for this event */
272
273 if ((FixedStatus & AcpiGbl_FixedEventInfo[i].StatusBitMask) &&
274 (FixedEnable & AcpiGbl_FixedEventInfo[i].EnableBitMask))
275 {
276 /*
277 * Found an active (signalled) event. Invoke global event
278 * handler if present.
279 */
280 AcpiFixedEventCount[i]++;
281 if (AcpiGbl_GlobalEventHandler)
282 {
283 AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_FIXED, NULL,
284 i, AcpiGbl_GlobalEventHandlerContext);
285 }
286
287 IntStatus |= AcpiEvFixedEventDispatch (i);
288 }
289 }
290
291 return (IntStatus);
292}
ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS]
Definition: utglobal.c:175
#define ACPI_REGISTER_PM1_ENABLE
Definition: aclocal.h:1185
#define ACPI_REGISTER_PM1_STATUS
Definition: aclocal.h:1184
#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE
Definition: aclocal.h:1219
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479
#define ACPI_NUM_FIXED_EVENTS
Definition: actypes.h:770
#define ACPI_EVENT_TYPE_FIXED
Definition: actypes.h:1144
static UINT32 AcpiEvFixedEventDispatch(UINT32 Event)
Definition: evevent.c:311
ACPI_STATUS AcpiHwRegisterRead(UINT32 RegisterId, UINT32 *ReturnValue)
Definition: hwregs.c:574

Referenced by AcpiEvSciXruptHandler().

◆ AcpiEvGetGpeDevice()

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

Definition at line 130 of file evgpeutil.c.

134{
136
137
138 /* Increment Index by the number of GPEs in this block */
139
140 Info->NextBlockBaseIndex += GpeBlock->GpeCount;
141
142 if (Info->Index < Info->NextBlockBaseIndex)
143 {
144 /*
145 * The GPE index is within this block, get the node. Leave the node
146 * NULL for the FADT-defined GPEs
147 */
148 if ((GpeBlock->Node)->Type == ACPI_TYPE_DEVICE)
149 {
150 Info->GpeDevice = GpeBlock->Node;
151 }
152
153 Info->Status = AE_OK;
154 return (AE_CTRL_END);
155 }
156
157 return (AE_OK);
158}
#define AE_CTRL_END
Definition: acexcep.h:230
#define ACPI_TYPE_DEVICE
Definition: actypes.h:693

Referenced by AcpiGetGpeDevice().

◆ 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 {
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}
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
#define ACPI_MAX_GPE_BLOCKS
Definition: actypes.h:403
ACPI_GPE_EVENT_INFO * AcpiEvLowGetGpeInfo(UINT32 GpeNumber, ACPI_GPE_BLOCK_INFO *GpeBlock)
Definition: evgpe.c:327
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO ACPI_GPE_BLOCK_INFO * GpeBlock
Definition: acobject.h:271
ACPI_OBJECT_DEVICE Device
Definition: acobject.h:529

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

◆ AcpiEvGetGpeNumberIndex()

UINT32 AcpiEvGetGpeNumberIndex ( UINT32  GpeNumber)

◆ AcpiEvGetGpeXruptBlock()

ACPI_STATUS AcpiEvGetGpeXruptBlock ( UINT32  InterruptNumber,
ACPI_GPE_XRUPT_INFO **  GpeXruptBlock 
)

Definition at line 178 of file evgpeutil.c.

181{
182 ACPI_GPE_XRUPT_INFO *NextGpeXrupt;
183 ACPI_GPE_XRUPT_INFO *GpeXrupt;
186
187
188 ACPI_FUNCTION_TRACE (EvGetGpeXruptBlock);
189
190
191 /* No need for lock since we are not changing any list elements here */
192
193 NextGpeXrupt = AcpiGbl_GpeXruptListHead;
194 while (NextGpeXrupt)
195 {
196 if (NextGpeXrupt->InterruptNumber == InterruptNumber)
197 {
198 *GpeXruptBlock = NextGpeXrupt;
200 }
201
202 NextGpeXrupt = NextGpeXrupt->Next;
203 }
204
205 /* Not found, must allocate a new xrupt descriptor */
206
207 GpeXrupt = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_XRUPT_INFO));
208 if (!GpeXrupt)
209 {
211 }
212
213 GpeXrupt->InterruptNumber = InterruptNumber;
214
215 /* Install new interrupt descriptor with spin lock */
216
217 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
218 if (AcpiGbl_GpeXruptListHead)
219 {
220 NextGpeXrupt = AcpiGbl_GpeXruptListHead;
221 while (NextGpeXrupt->Next)
222 {
223 NextGpeXrupt = NextGpeXrupt->Next;
224 }
225
226 NextGpeXrupt->Next = GpeXrupt;
227 GpeXrupt->Previous = NextGpeXrupt;
228 }
229 else
230 {
231 AcpiGbl_GpeXruptListHead = GpeXrupt;
232 }
233
234 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
235
236 /* Install new interrupt handler if not SCI_INT */
237
238 if (InterruptNumber != AcpiGbl_FADT.SciInterrupt)
239 {
240 Status = AcpiOsInstallInterruptHandler (InterruptNumber,
241 AcpiEvGpeXruptHandler, GpeXrupt);
242 if (ACPI_FAILURE (Status))
243 {
245 "Could not install GPE interrupt handler at level 0x%X",
246 InterruptNumber));
248 }
249 }
250
251 *GpeXruptBlock = GpeXrupt;
253}
ACPI_STATUS AcpiOsInstallInterruptHandler(UINT32 InterruptNumber, ACPI_OSD_HANDLER ServiceRoutine, void *Context)
Definition: osl.c:548

Referenced by AcpiEvInstallGpeBlock().

◆ 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}
UINT32 AcpiEvDetectGpe(ACPI_NAMESPACE_NODE *GpeDevice, ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 GpeNumber)
Definition: evgpe.c:722
struct acpi_gpe_block_info * Next
Definition: aclocal.h:585

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

◆ AcpiEvGpeInitialize()

ACPI_STATUS AcpiEvGpeInitialize ( void  )

Definition at line 84 of file evgpeinit.c.

86{
87 UINT32 RegisterCount0 = 0;
88 UINT32 RegisterCount1 = 0;
89 UINT32 GpeNumberMax = 0;
91
92
93 ACPI_FUNCTION_TRACE (EvGpeInitialize);
94
95
97 "Initializing General Purpose Events (GPEs):\n"));
98
100 if (ACPI_FAILURE (Status))
101 {
103 }
104
105 /*
106 * Initialize the GPE Block(s) defined in the FADT
107 *
108 * Why the GPE register block lengths are divided by 2: From the ACPI
109 * Spec, section "General-Purpose Event Registers", we have:
110 *
111 * "Each register block contains two registers of equal length
112 * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
113 * GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
114 * The length of the GPE1_STS and GPE1_EN registers is equal to
115 * half the GPE1_LEN. If a generic register block is not supported
116 * then its respective block pointer and block length values in the
117 * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
118 * to be the same size."
119 */
120
121 /*
122 * Determine the maximum GPE number for this machine.
123 *
124 * Note: both GPE0 and GPE1 are optional, and either can exist without
125 * the other.
126 *
127 * If EITHER the register length OR the block address are zero, then that
128 * particular block is not supported.
129 */
130 if (AcpiGbl_FADT.Gpe0BlockLength &&
131 AcpiGbl_FADT.XGpe0Block.Address)
132 {
133 /* GPE block 0 exists (has both length and address > 0) */
134
135 RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2);
136 GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
137
138 /* Install GPE Block 0 */
139
140 Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
141 AcpiGbl_FADT.XGpe0Block.Address,
142 AcpiGbl_FADT.XGpe0Block.SpaceId,
143 RegisterCount0, 0,
144 AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[0]);
145
146 if (ACPI_FAILURE (Status))
147 {
149 "Could not create GPE Block 0"));
150 }
151 }
152
153 if (AcpiGbl_FADT.Gpe1BlockLength &&
154 AcpiGbl_FADT.XGpe1Block.Address)
155 {
156 /* GPE block 1 exists (has both length and address > 0) */
157
158 RegisterCount1 = (UINT16) (AcpiGbl_FADT.Gpe1BlockLength / 2);
159
160 /* Check for GPE0/GPE1 overlap (if both banks exist) */
161
162 if ((RegisterCount0) &&
163 (GpeNumberMax >= AcpiGbl_FADT.Gpe1Base))
164 {
166 "GPE0 block (GPE 0 to %u) overlaps the GPE1 block "
167 "(GPE %u to %u) - Ignoring GPE1",
168 GpeNumberMax, AcpiGbl_FADT.Gpe1Base,
169 AcpiGbl_FADT.Gpe1Base +
170 ((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1)));
171
172 /* Ignore GPE1 block by setting the register count to zero */
173
174 RegisterCount1 = 0;
175 }
176 else
177 {
178 /* Install GPE Block 1 */
179
180 Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
181 AcpiGbl_FADT.XGpe1Block.Address,
182 AcpiGbl_FADT.XGpe1Block.SpaceId,
183 RegisterCount1,
184 AcpiGbl_FADT.Gpe1Base,
185 AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[1]);
186
187 if (ACPI_FAILURE (Status))
188 {
190 "Could not create GPE Block 1"));
191 }
192
193 /*
194 * GPE0 and GPE1 do not have to be contiguous in the GPE number
195 * space. However, GPE0 always starts at GPE number zero.
196 */
197 }
198 }
199
200 /* Exit if there are no GPE registers */
201
202 if ((RegisterCount0 + RegisterCount1) == 0)
203 {
204 /* GPEs are not required by ACPI, this is OK */
205
207 "There are no GPE blocks defined in the FADT\n"));
208 goto Cleanup;
209 }
210
211
212Cleanup:
215}
static const WCHAR Cleanup[]
Definition: register.c:80
ACPI_STATUS AcpiEvCreateGpeBlock(ACPI_NAMESPACE_NODE *GpeDevice, UINT64 Address, UINT8 SpaceId, UINT32 RegisterCount, UINT16 GpeBlockBaseNumber, UINT32 InterruptNumber, ACPI_GPE_BLOCK_INFO **ReturnGpeBlock)
Definition: evgpeblk.c:371

Referenced by AcpiEvInitializeEvents().

◆ AcpiEvGpeXruptHandler()

UINT32 ACPI_SYSTEM_XFACE AcpiEvGpeXruptHandler ( void Context)

Definition at line 176 of file evsci.c.

178{
179 ACPI_GPE_XRUPT_INFO *GpeXruptList = Context;
180 UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED;
181
182
183 ACPI_FUNCTION_TRACE (EvGpeXruptHandler);
184
185
186 /*
187 * We are guaranteed by the ACPICA initialization/shutdown code that
188 * if this interrupt handler is installed, ACPI is enabled.
189 */
190
191 /* GPEs: Check for and dispatch any GPEs that have occurred */
192
193 InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
194 return_UINT32 (InterruptHandled);
195}
#define return_UINT32(s)
Definition: acoutput.h:501
UINT32 AcpiEvGpeDetect(ACPI_GPE_XRUPT_INFO *GpeXruptList)
Definition: evgpe.c:433

Referenced by AcpiEvDeleteGpeXrupt(), and AcpiEvGetGpeXruptBlock().

◆ AcpiEvHasDefaultHandler()

BOOLEAN AcpiEvHasDefaultHandler ( ACPI_NAMESPACE_NODE Node,
ACPI_ADR_SPACE_TYPE  SpaceId 
)

Definition at line 166 of file evhandler.c.

169{
170 ACPI_OPERAND_OBJECT *ObjDesc;
171 ACPI_OPERAND_OBJECT *HandlerObj;
172
173
174 /* Must have an existing internal object */
175
176 ObjDesc = AcpiNsGetAttachedObject (Node);
177 if (ObjDesc)
178 {
179 HandlerObj = ObjDesc->CommonNotify.Handler;
180
181 /* Walk the linked list of handlers for this object */
182
183 while (HandlerObj)
184 {
185 if (HandlerObj->AddressSpace.SpaceId == SpaceId)
186 {
187 if (HandlerObj->AddressSpace.HandlerFlags &
189 {
190 return (TRUE);
191 }
192 }
193
194 HandlerObj = HandlerObj->AddressSpace.Next;
195 }
196 }
197
198 return (FALSE);
199}
ACPI_OBJECT_NOTIFY_COMMON CommonNotify
Definition: acobject.h:528

Referenced by AcpiEvInitializeOpRegions().

◆ AcpiEvInitGlobalLockHandler()

ACPI_STATUS AcpiEvInitGlobalLockHandler ( void  )

Definition at line 74 of file evglock.c.

76{
78
79
80 ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler);
81
82
83 /* If Hardware Reduced flag is set, there is no global lock */
84
85 if (AcpiGbl_ReducedHardware)
86 {
88 }
89
90 /* Attempt installation of the global lock handler */
91
94
95 /*
96 * If the global lock does not exist on this platform, the attempt to
97 * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick).
98 * Map to AE_OK, but mark global lock as not present. Any attempt to
99 * actually use the global lock will be flagged with an error.
100 */
101 AcpiGbl_GlobalLockPresent = FALSE;
103 {
105 "No response from Global Lock hardware, disabling lock"));
106
108 }
109
110 Status = AcpiOsCreateLock (&AcpiGbl_GlobalLockPendingLock);
111 if (ACPI_FAILURE (Status))
112 {
114 }
115
116 AcpiGbl_GlobalLockPending = FALSE;
117 AcpiGbl_GlobalLockPresent = TRUE;
119}
#define AE_NO_HARDWARE_RESPONSE
Definition: acexcep.h:130
ACPI_STATUS AcpiOsCreateLock(ACPI_SPINLOCK *OutHandle)
Definition: osl.c:463
#define ACPI_EVENT_GLOBAL
Definition: actypes.h:764
static UINT32 AcpiEvGlobalLockHandler(void *Context)
Definition: evglock.c:168
ACPI_STATUS AcpiInstallFixedEventHandler(UINT32 Event, ACPI_EVENT_HANDLER Handler, void *Context)
Definition: evxface.c:707

Referenced by AcpiEvInstallXruptHandlers().

◆ AcpiEvInitializeEvents()

ACPI_STATUS AcpiEvInitializeEvents ( void  )

Definition at line 77 of file evevent.c.

79{
81
82
83 ACPI_FUNCTION_TRACE (EvInitializeEvents);
84
85
86 /* If Hardware Reduced flag is set, there are no fixed events */
87
88 if (AcpiGbl_ReducedHardware)
89 {
91 }
92
93 /*
94 * Initialize the Fixed and General Purpose Events. This is done prior to
95 * enabling SCIs to prevent interrupts from occurring before the handlers
96 * are installed.
97 */
99 if (ACPI_FAILURE (Status))
100 {
102 "Unable to initialize fixed events"));
104 }
105
107 if (ACPI_FAILURE (Status))
108 {
110 "Unable to initialize general purpose events"));
112 }
113
115}
static ACPI_STATUS AcpiEvFixedEventInitialize(void)
Definition: evevent.c:185
ACPI_STATUS AcpiEvGpeInitialize(void)
Definition: evgpeinit.c:84

Referenced by AcpiEnableSubsystem().

◆ 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_GPE_IS_POLLING_NEEDED(__gpe__)
Definition: acevents.h:59
#define ACPI_ERROR_ONLY(s)
Definition: acmacros.h:467
#define ACPI_INFO(plist)
Definition: acoutput.h:237
#define ACPI_GPE_INITIALIZED
Definition: actypes.h:833
#define ACPI_GPE_AUTO_ENABLED
Definition: actypes.h:832
#define ACPI_GPE_CAN_WAKE
Definition: actypes.h:831
#define ACPI_GPE_DISPATCH_METHOD
Definition: actypes.h:820
ACPI_STATUS AcpiEvAddGpeReference(ACPI_GPE_EVENT_INFO *GpeEventInfo, BOOLEAN ClearOnEnable)
Definition: evgpe.c:221

Referenced by AcpiUpdateAllGpes().

◆ AcpiEvInitializeOpRegions()

ACPI_STATUS AcpiEvInitializeOpRegions ( void  )

Definition at line 86 of file evregion.c.

88{
90 UINT32 i;
91
92
93 ACPI_FUNCTION_TRACE (EvInitializeOpRegions);
94
95
97 if (ACPI_FAILURE (Status))
98 {
100 }
101
102 /* Run the _REG methods for OpRegions in each default address space */
103
104 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
105 {
106 /*
107 * Make sure the installed handler is the DEFAULT handler. If not the
108 * default, the _REG methods will have already been run (when the
109 * handler was installed)
110 */
111 if (AcpiEvHasDefaultHandler (AcpiGbl_RootNode,
113 {
114 AcpiEvExecuteRegMethods (AcpiGbl_RootNode,
116 }
117 }
118
121}
#define ACPI_NUM_DEFAULT_SPACES
Definition: acconfig.h:202
BOOLEAN AcpiEvHasDefaultHandler(ACPI_NAMESPACE_NODE *Node, ACPI_ADR_SPACE_TYPE SpaceId)
Definition: evhandler.c:166
void AcpiEvExecuteRegMethods(ACPI_NAMESPACE_NODE *Node, ACPI_ADR_SPACE_TYPE SpaceId, UINT32 Function)
Definition: evregion.c:761
UINT8 AcpiGbl_DefaultAddressSpaces[]
Definition: evhandler.c:66

Referenced by AcpiNsInitializeDevices().

◆ AcpiEvInitializeRegion()

ACPI_STATUS AcpiEvInitializeRegion ( ACPI_OPERAND_OBJECT RegionObj)

Definition at line 629 of file evrgnini.c.

631{
632 ACPI_OPERAND_OBJECT *HandlerObj;
633 ACPI_OPERAND_OBJECT *ObjDesc;
636
637
638 ACPI_FUNCTION_TRACE (EvInitializeRegion);
639
640
641 if (!RegionObj)
642 {
644 }
645
646 if (RegionObj->Common.Flags & AOPOBJ_OBJECT_INITIALIZED)
647 {
649 }
650
651 RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED;
652
653 Node = RegionObj->Region.Node->Parent;
654 SpaceId = RegionObj->Region.SpaceId;
655
656 /*
657 * The following loop depends upon the root Node having no parent
658 * ie: AcpiGbl_RootNode->Parent being set to NULL
659 */
660 while (Node)
661 {
662 /* Check to see if a handler exists */
663
664 HandlerObj = NULL;
665 ObjDesc = AcpiNsGetAttachedObject (Node);
666 if (ObjDesc)
667 {
668 /* Can only be a handler if the object exists */
669
670 switch (Node->Type)
671 {
672 case ACPI_TYPE_DEVICE:
675
676 HandlerObj = ObjDesc->CommonNotify.Handler;
677 break;
678
679 default:
680
681 /* Ignore other objects */
682
683 break;
684 }
685
686 HandlerObj = AcpiEvFindRegionHandler (SpaceId, HandlerObj);
687 if (HandlerObj)
688 {
689 /* Found correct handler */
690
692 "Found handler %p for region %p in obj %p\n",
693 HandlerObj, RegionObj, ObjDesc));
694
695 (void) AcpiEvAttachRegion (HandlerObj, RegionObj, FALSE);
696
697 /*
698 * Tell all users that this region is usable by
699 * running the _REG method
700 */
705 }
706 }
707
708 /* This node does not have the handler we need; Pop up one level */
709
710 Node = Node->Parent;
711 }
712
713 /*
714 * If we get here, there is no handler for this region. This is not
715 * fatal because many regions get created before a handler is installed
716 * for said region.
717 */
719 "No handler for RegionType %s(%X) (RegionObj %p)\n",
720 AcpiUtGetRegionName (SpaceId), SpaceId, RegionObj));
721
723}
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define AOPOBJ_OBJECT_INITIALIZED
Definition: acobject.h:97
#define ACPI_TYPE_PROCESSOR
Definition: actypes.h:699
UINT8 ACPI_ADR_SPACE_TYPE
Definition: actypes.h:859
#define ACPI_TYPE_THERMAL
Definition: actypes.h:700
ACPI_OPERAND_OBJECT * AcpiEvFindRegionHandler(ACPI_ADR_SPACE_TYPE SpaceId, ACPI_OPERAND_OBJECT *HandlerObj)
Definition: evhandler.c:346
ACPI_STATUS AcpiEvAttachRegion(ACPI_OPERAND_OBJECT *HandlerObj, ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsIsLocked)
Definition: evregion.c:568

Referenced by AcpiDsInitializeRegion(), and AcpiDsLoad2EndOp().

◆ AcpiEvInstallRegionHandlers()

ACPI_STATUS AcpiEvInstallRegionHandlers ( void  )

Definition at line 88 of file evhandler.c.

90{
92 UINT32 i;
93
94
95 ACPI_FUNCTION_TRACE (EvInstallRegionHandlers);
96
97
99 if (ACPI_FAILURE (Status))
100 {
102 }
103
104 /*
105 * All address spaces (PCI Config, EC, SMBus) are scope dependent and
106 * registration must occur for a specific device.
107 *
108 * In the case of the system memory and IO address spaces there is
109 * currently no device associated with the address space. For these we
110 * use the root.
111 *
112 * We install the default PCI config space handler at the root so that
113 * this space is immediately available even though the we have not
114 * enumerated all the PCI Root Buses yet. This is to conform to the ACPI
115 * specification which states that the PCI config space must be always
116 * available -- even though we are nowhere near ready to find the PCI root
117 * buses at this point.
118 *
119 * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler
120 * has already been installed (via AcpiInstallAddressSpaceHandler).
121 * Similar for AE_SAME_HANDLER.
122 */
123 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
124 {
125 Status = AcpiEvInstallSpaceHandler (AcpiGbl_RootNode,
128 switch (Status)
129 {
130 case AE_OK:
131 case AE_SAME_HANDLER:
133
134 /* These exceptions are all OK */
135
136 Status = AE_OK;
137 break;
138
139 default:
140
141 goto UnlockAndExit;
142 }
143 }
144
145UnlockAndExit:
148}
#define AE_SAME_HANDLER
Definition: acexcep.h:133
#define ACPI_DEFAULT_HANDLER
Definition: actypes.h:1211
ACPI_STATUS AcpiEvInstallSpaceHandler(ACPI_NAMESPACE_NODE *Node, ACPI_ADR_SPACE_TYPE SpaceId, ACPI_ADR_SPACE_HANDLER Handler, ACPI_ADR_SPACE_SETUP Setup, void *Context)
Definition: evhandler.c:389
UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES]
Definition: evhandler.c:66

Referenced by AcpiLoadTables().

◆ AcpiEvInstallSciHandler()

UINT32 AcpiEvInstallSciHandler ( void  )

Definition at line 211 of file evsci.c.

213{
215
216
217 ACPI_FUNCTION_TRACE (EvInstallSciHandler);
218
219
220 Status = AcpiOsInstallInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt,
221 AcpiEvSciXruptHandler, AcpiGbl_GpeXruptListHead);
223}
static UINT32 ACPI_SYSTEM_XFACE AcpiEvSciXruptHandler(void *Context)
Definition: evsci.c:127

Referenced by AcpiEvInstallXruptHandlers().

◆ AcpiEvInstallSpaceHandler()

ACPI_STATUS AcpiEvInstallSpaceHandler ( ACPI_NAMESPACE_NODE Node,
ACPI_ADR_SPACE_TYPE  SpaceId,
ACPI_ADR_SPACE_HANDLER  Handler,
ACPI_ADR_SPACE_SETUP  Setup,
void Context 
)

Definition at line 389 of file evhandler.c.

395{
396 ACPI_OPERAND_OBJECT *ObjDesc;
397 ACPI_OPERAND_OBJECT *HandlerObj;
400 UINT8 Flags = 0;
401
402
403 ACPI_FUNCTION_TRACE (EvInstallSpaceHandler);
404
405
406 /*
407 * This registration is valid for only the types below and the root.
408 * The root node is where the default handlers get installed.
409 */
410 if ((Node->Type != ACPI_TYPE_DEVICE) &&
411 (Node->Type != ACPI_TYPE_PROCESSOR) &&
412 (Node->Type != ACPI_TYPE_THERMAL) &&
413 (Node != AcpiGbl_RootNode))
414 {
416 goto UnlockAndExit;
417 }
418
420 {
422
423 switch (SpaceId)
424 {
426
429 break;
430
432
435 break;
436
438
441 break;
442
444
447 break;
448
450
453 break;
454
456
459 break;
460
461 default:
462
464 goto UnlockAndExit;
465 }
466 }
467
468 /* If the caller hasn't specified a setup routine, use the default */
469
470 if (!Setup)
471 {
473 }
474
475 /* Check for an existing internal object */
476
477 ObjDesc = AcpiNsGetAttachedObject (Node);
478 if (ObjDesc)
479 {
480 /*
481 * The attached device object already exists. Now make sure
482 * the handler is not already installed.
483 */
484 HandlerObj = AcpiEvFindRegionHandler (SpaceId,
485 ObjDesc->CommonNotify.Handler);
486
487 if (HandlerObj)
488 {
489 if (HandlerObj->AddressSpace.Handler == Handler)
490 {
491 /*
492 * It is (relatively) OK to attempt to install the SAME
493 * handler twice. This can easily happen with the
494 * PCI_Config space.
495 */
497 goto UnlockAndExit;
498 }
499 else
500 {
501 /* A handler is already installed */
502
504 }
505
506 goto UnlockAndExit;
507 }
508 }
509 else
510 {
512 "Creating object on Device %p while installing handler\n",
513 Node));
514
515 /* ObjDesc does not exist, create one */
516
517 if (Node->Type == ACPI_TYPE_ANY)
518 {
520 }
521 else
522 {
523 Type = Node->Type;
524 }
525
527 if (!ObjDesc)
528 {
530 goto UnlockAndExit;
531 }
532
533 /* Init new descriptor */
534
535 ObjDesc->Common.Type = (UINT8) Type;
536
537 /* Attach the new object to the Node */
538
539 Status = AcpiNsAttachObject (Node, ObjDesc, Type);
540
541 /* Remove local reference to the object */
542
543 AcpiUtRemoveReference (ObjDesc);
544
545 if (ACPI_FAILURE (Status))
546 {
547 goto UnlockAndExit;
548 }
549 }
550
552 "Installing address handler for region %s(%X) "
553 "on Device %4.4s %p(%p)\n",
555 AcpiUtGetNodeName (Node), Node, ObjDesc));
556
557 /*
558 * Install the handler
559 *
560 * At this point there is no existing handler. Just allocate the object
561 * for the handler and link it into the list.
562 */
564 if (!HandlerObj)
565 {
567 goto UnlockAndExit;
568 }
569
570 /* Init handler obj */
571
573 if (ACPI_FAILURE (Status))
574 {
575 AcpiUtRemoveReference (HandlerObj);
576 goto UnlockAndExit;
577 }
578
579 HandlerObj->AddressSpace.SpaceId = (UINT8) SpaceId;
580 HandlerObj->AddressSpace.HandlerFlags = Flags;
581 HandlerObj->AddressSpace.RegionList = NULL;
582 HandlerObj->AddressSpace.Node = Node;
583 HandlerObj->AddressSpace.Handler = Handler;
584 HandlerObj->AddressSpace.Context = Context;
585 HandlerObj->AddressSpace.Setup = Setup;
586
587 /* Install at head of Device.AddressSpace list */
588
589 HandlerObj->AddressSpace.Next = ObjDesc->CommonNotify.Handler;
590
591 /*
592 * The Device object is the first reference on the HandlerObj.
593 * Each region that uses the handler adds a reference.
594 */
595 ObjDesc->CommonNotify.Handler = HandlerObj;
596
597 /*
598 * Walk the namespace finding all of the regions this handler will
599 * manage.
600 *
601 * Start at the device and search the branch toward the leaf nodes
602 * until either the leaf is encountered or a device is detected that
603 * has an address handler of the same type.
604 *
605 * In either case, back up and search down the remainder of the branch
606 */
609 AcpiEvInstallHandler, NULL, HandlerObj, NULL);
610
611UnlockAndExit:
613}
Type
Definition: Type.h:7
ACPI_STATUS AcpiNsAttachObject(ACPI_NAMESPACE_NODE *Node, ACPI_OPERAND_OBJECT *Object, ACPI_OBJECT_TYPE Type)
Definition: nsobject.c:76
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx 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 ACPI_ADR_SPACE_HANDLER ACPI_ADR_SPACE_SETUP Setup
Definition: acpixf.h:834
UINT32 ACPI_OBJECT_TYPE
Definition: actypes.h:685
#define ACPI_ADR_SPACE_PCI_CONFIG
Definition: actypes.h:863
#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER
Definition: actypes.h:723
#define ACPI_ADR_SPACE_PCI_BAR_TARGET
Definition: actypes.h:867
#define AcpiOsCreateMutex(OutHandle)
Definition: actypes.h:274
#define ACPI_ADR_SPACE_CMOS
Definition: actypes.h:866
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:681
static ACPI_STATUS AcpiEvInstallHandler(ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue)
Definition: evhandler.c:220
ACPI_STATUS AcpiEvPciConfigRegionSetup(ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext)
Definition: evrgnini.c:179
ACPI_STATUS AcpiEvDefaultRegionSetup(ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext)
Definition: evrgnini.c:568
ACPI_STATUS AcpiEvPciBarRegionSetup(ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext)
Definition: evrgnini.c:450
ACPI_STATUS AcpiEvCmosRegionSetup(ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext)
Definition: evrgnini.c:481
ACPI_STATUS AcpiEvIoSpaceRegionSetup(ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext)
Definition: evrgnini.c:139
ACPI_STATUS AcpiEvDataTableRegionSetup(ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext)
Definition: evrgnini.c:512
ACPI_STATUS AcpiEvSystemMemoryRegionSetup(ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext)
Definition: evrgnini.c:70
ACPI_STATUS AcpiExSystemMemorySpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext)
Definition: exregion.c:72
ACPI_STATUS AcpiExPciBarSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext)
Definition: exregion.c:542
ACPI_STATUS AcpiExCmosSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext)
Definition: exregion.c:505
ACPI_STATUS AcpiExDataTableSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext)
Definition: exregion.c:579
ACPI_STATUS AcpiExPciConfigSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext)
Definition: exregion.c:424
ACPI_STATUS AcpiExSystemIoSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext)
Definition: exregion.c:359
ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:415

Referenced by AcpiEvInstallRegionHandlers(), and AcpiInstallAddressSpaceHandler().

◆ AcpiEvInstallXruptHandlers()

ACPI_STATUS AcpiEvInstallXruptHandlers ( void  )

Definition at line 131 of file evevent.c.

133{
135
136
137 ACPI_FUNCTION_TRACE (EvInstallXruptHandlers);
138
139
140 /* If Hardware Reduced flag is set, there is no ACPI h/w */
141
142 if (AcpiGbl_ReducedHardware)
143 {
145 }
146
147 /* Install the SCI handler */
148
150 if (ACPI_FAILURE (Status))
151 {
153 "Unable to install System Control Interrupt handler"));
155 }
156
157 /* Install the handler for the Global Lock */
158
160 if (ACPI_FAILURE (Status))
161 {
163 "Unable to initialize Global Lock handler"));
165 }
166
167 AcpiGbl_EventsInitialized = TRUE;
169}
ACPI_STATUS AcpiEvInitGlobalLockHandler(void)
Definition: evglock.c:74
UINT32 AcpiEvInstallSciHandler(void)
Definition: evsci.c:211

Referenced by AcpiEnableSubsystem().

◆ AcpiEvIoSpaceRegionSetup()

ACPI_STATUS AcpiEvIoSpaceRegionSetup ( ACPI_HANDLE  Handle,
UINT32  Function,
void HandlerContext,
void **  RegionContext 
)

Definition at line 139 of file evrgnini.c.

144{
145 ACPI_FUNCTION_TRACE (EvIoSpaceRegionSetup);
146
147
149 {
150 *RegionContext = NULL;
151 }
152 else
153 {
154 *RegionContext = HandlerContext;
155 }
156
158}

Referenced by AcpiEvInstallSpaceHandler().

◆ AcpiEvIsNotifyObject()

BOOLEAN AcpiEvIsNotifyObject ( ACPI_NAMESPACE_NODE Node)

Definition at line 75 of file evmisc.c.

77{
78
79 switch (Node->Type)
80 {
84 /*
85 * These are the ONLY objects that can receive ACPI notifications
86 */
87 return (TRUE);
88
89 default:
90
91 return (FALSE);
92 }
93}

Referenced by AcpiEvQueueNotifyRequest(), AcpiExOpcode_2A_0T_0R(), AcpiInstallNotifyHandler(), and AcpiRemoveNotifyHandler().

◆ AcpiEvIsPciRootBridge()

BOOLEAN AcpiEvIsPciRootBridge ( ACPI_NAMESPACE_NODE Node)

Definition at line 382 of file evrgnini.c.

384{
388 UINT32 i;
389 BOOLEAN Match;
390
391
392 /* Get the _HID and check for a PCI Root Bridge */
393
394 Status = AcpiUtExecute_HID (Node, &Hid);
395 if (ACPI_FAILURE (Status))
396 {
397 return (FALSE);
398 }
399
400 Match = AcpiUtIsPciRootBridge (Hid->String);
401 ACPI_FREE (Hid);
402
403 if (Match)
404 {
405 return (TRUE);
406 }
407
408 /* The _HID did not match. Get the _CID and check for a PCI Root Bridge */
409
410 Status = AcpiUtExecute_CID (Node, &Cid);
411 if (ACPI_FAILURE (Status))
412 {
413 return (FALSE);
414 }
415
416 /* Check all _CIDs in the returned list */
417
418 for (i = 0; i < Cid->Count; i++)
419 {
420 if (AcpiUtIsPciRootBridge (Cid->Ids[i].String))
421 {
422 ACPI_FREE (Cid);
423 return (TRUE);
424 }
425 }
426
427 ACPI_FREE (Cid);
428 return (FALSE);
429}
BOOLEAN AcpiUtIsPciRootBridge(char *Id)
Definition: utmisc.c:66
ACPI_STATUS AcpiUtExecute_CID(ACPI_NAMESPACE_NODE *DeviceNode, ACPI_PNP_DEVICE_ID_LIST **ReturnCidList)
Definition: utids.c:253
ACPI_STATUS AcpiUtExecute_HID(ACPI_NAMESPACE_NODE *DeviceNode, ACPI_PNP_DEVICE_ID **ReturnId)
Definition: utids.c:72
ACPI_PNP_DEVICE_ID Ids[]
Definition: actypes.h:1297

Referenced by AcpiEvPciConfigRegionSetup().

◆ 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}

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
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);
197 {
199 }
200 }
201
203}
#define ACPI_SET_BIT(target, bit)
Definition: actypes.h:533
#define ACPI_GPE_DISABLE
Definition: actypes.h:804
#define ACPI_CLEAR_BIT(target, bit)
Definition: actypes.h:534

Referenced by AcpiMaskGpe().

◆ AcpiEvPciBarRegionSetup()

ACPI_STATUS AcpiEvPciBarRegionSetup ( ACPI_HANDLE  Handle,
UINT32  Function,
void HandlerContext,
void **  RegionContext 
)

Definition at line 450 of file evrgnini.c.

455{
456 ACPI_FUNCTION_TRACE (EvPciBarRegionSetup);
457
458
460}

Referenced by AcpiEvInstallSpaceHandler().

◆ AcpiEvPciConfigRegionSetup()

ACPI_STATUS AcpiEvPciConfigRegionSetup ( ACPI_HANDLE  Handle,
UINT32  Function,
void HandlerContext,
void **  RegionContext 
)

Definition at line 179 of file evrgnini.c.

184{
186 UINT64 PciValue;
187 ACPI_PCI_ID *PciId = *RegionContext;
188 ACPI_OPERAND_OBJECT *HandlerObj;
189 ACPI_NAMESPACE_NODE *ParentNode;
190 ACPI_NAMESPACE_NODE *PciRootNode;
191 ACPI_NAMESPACE_NODE *PciDeviceNode;
193
194
195 ACPI_FUNCTION_TRACE (EvPciConfigRegionSetup);
196
197
198 HandlerObj = RegionObj->Region.Handler;
199 if (!HandlerObj)
200 {
201 /*
202 * No installed handler. This shouldn't happen because the dispatch
203 * routine checks before we get here, but we check again just in case.
204 */
206 "Attempting to init a region %p, with no handler\n", RegionObj));
208 }
209
210 *RegionContext = NULL;
212 {
213 if (PciId)
214 {
215 ACPI_FREE (PciId);
216 }
218 }
219
220 ParentNode = RegionObj->Region.Node->Parent;
221
222 /*
223 * Get the _SEG and _BBN values from the device upon which the handler
224 * is installed.
225 *
226 * We need to get the _SEG and _BBN objects relative to the PCI BUS device.
227 * This is the device the handler has been registered to handle.
228 */
229
230 /*
231 * If the AddressSpace.Node is still pointing to the root, we need
232 * to scan upward for a PCI Root bridge and re-associate the OpRegion
233 * handlers with that device.
234 */
235 if (HandlerObj->AddressSpace.Node == AcpiGbl_RootNode)
236 {
237 /* Start search from the parent object */
238
239 PciRootNode = ParentNode;
240 while (PciRootNode != AcpiGbl_RootNode)
241 {
242 /* Get the _HID/_CID in order to detect a RootBridge */
243
244 if (AcpiEvIsPciRootBridge (PciRootNode))
245 {
246 /* Install a handler for this PCI root bridge */
247
249 (ACPI_HANDLE) PciRootNode,
252 if (ACPI_FAILURE (Status))
253 {
254 if (Status == AE_SAME_HANDLER)
255 {
256 /*
257 * It is OK if the handler is already installed on the
258 * root bridge. Still need to return a context object
259 * for the new PCI_Config operation region, however.
260 */
261 }
262 else
263 {
265 "Could not install PciConfig handler "
266 "for Root Bridge %4.4s",
267 AcpiUtGetNodeName (PciRootNode)));
268 }
269 }
270 break;
271 }
272
273 PciRootNode = PciRootNode->Parent;
274 }
275
276 /* PCI root bridge not found, use namespace root node */
277 }
278 else
279 {
280 PciRootNode = HandlerObj->AddressSpace.Node;
281 }
282
283 /*
284 * If this region is now initialized, we are done.
285 * (InstallAddressSpaceHandler could have initialized it)
286 */
287 if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)
288 {
290 }
291
292 /* Region is still not initialized. Create a new context */
293
294 PciId = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PCI_ID));
295 if (!PciId)
296 {
298 }
299
300 /*
301 * For PCI_Config space access, we need the segment, bus, device and
302 * function numbers. Acquire them here.
303 *
304 * Find the parent device object. (This allows the operation region to be
305 * within a subscope under the device, such as a control method.)
306 */
307 PciDeviceNode = RegionObj->Region.Node;
308 while (PciDeviceNode && (PciDeviceNode->Type != ACPI_TYPE_DEVICE))
309 {
310 PciDeviceNode = PciDeviceNode->Parent;
311 }
312
313 if (!PciDeviceNode)
314 {
315 ACPI_FREE (PciId);
317 }
318
319 /*
320 * Get the PCI device and function numbers from the _ADR object
321 * contained in the parent's scope.
322 */
324 PciDeviceNode, &PciValue);
325
326 /*
327 * The default is zero, and since the allocation above zeroed the data,
328 * just do nothing on failure.
329 */
330 if (ACPI_SUCCESS (Status))
331 {
332 PciId->Device = ACPI_HIWORD (ACPI_LODWORD (PciValue));
333 PciId->Function = ACPI_LOWORD (ACPI_LODWORD (PciValue));
334 }
335
336 /* The PCI segment number comes from the _SEG method */
337
339 PciRootNode, &PciValue);
340 if (ACPI_SUCCESS (Status))
341 {
342 PciId->Segment = ACPI_LOWORD (PciValue);
343 }
344
345 /* The PCI bus number comes from the _BBN method */
346
348 PciRootNode, &PciValue);
349 if (ACPI_SUCCESS (Status))
350 {
351 PciId->Bus = ACPI_LOWORD (PciValue);
352 }
353
354 /* Complete/update the PCI ID for this device */
355
356 Status = AcpiHwDerivePciId (PciId, PciRootNode, RegionObj->Region.Node);
357 if (ACPI_FAILURE (Status))
358 {
359 ACPI_FREE (PciId);
361 }
362
363 *RegionContext = PciId;
365}
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
#define METHOD_NAME__SEG
Definition: acnames.h:72
#define METHOD_NAME__ADR
Definition: acnames.h:49
#define METHOD_NAME__BBN
Definition: acnames.h:51
#define ACPI_LOWORD(Integer)
Definition: actypes.h:528
#define ACPI_HIWORD(Integer)
Definition: actypes.h:529
#define ACPI_LODWORD(Integer64)
Definition: actypes.h:530
ACPI_STATUS AcpiUtEvaluateNumericObject(const char *ObjectName, ACPI_NAMESPACE_NODE *DeviceNode, UINT64 *Value)
Definition: uteval.c:221
ACPI_STATUS AcpiHwDerivePciId(ACPI_PCI_ID *PciId, ACPI_HANDLE RootPciDevice, ACPI_HANDLE PciRegion)
Definition: hwpci.c:137
BOOLEAN AcpiEvIsPciRootBridge(ACPI_NAMESPACE_NODE *Node)
Definition: evrgnini.c:382
ACPI_STATUS AcpiInstallAddressSpaceHandler(ACPI_HANDLE Device, ACPI_ADR_SPACE_TYPE SpaceId, ACPI_ADR_SPACE_HANDLER Handler, ACPI_ADR_SPACE_SETUP Setup, void *Context)
Definition: evxfregn.c:79
UINT16 Device
Definition: actypes.h:1353
UINT16 Function
Definition: actypes.h:1354
UINT16 Segment
Definition: actypes.h:1351
UINT16 Bus
Definition: actypes.h:1352

Referenced by AcpiEvInstallSpaceHandler().

◆ AcpiEvQueueNotifyRequest()

ACPI_STATUS AcpiEvQueueNotifyRequest ( ACPI_NAMESPACE_NODE Node,
UINT32  NotifyValue 
)

Definition at line 111 of file evmisc.c.

114{
115 ACPI_OPERAND_OBJECT *ObjDesc;
116 ACPI_OPERAND_OBJECT *HandlerListHead = NULL;
118 UINT8 HandlerListId = 0;
120
121
122 ACPI_FUNCTION_NAME (EvQueueNotifyRequest);
123
124
125 /* Are Notifies allowed on this object? */
126
128 {
129 return (AE_TYPE);
130 }
131
132 /* Get the correct notify list type (System or Device) */
133
134 if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
135 {
136 HandlerListId = ACPI_SYSTEM_HANDLER_LIST;
137 }
138 else
139 {
140 HandlerListId = ACPI_DEVICE_HANDLER_LIST;
141 }
142
143 /* Get the notify object attached to the namespace Node */
144
145 ObjDesc = AcpiNsGetAttachedObject (Node);
146 if (ObjDesc)
147 {
148 /* We have an attached object, Get the correct handler list */
149
150 HandlerListHead = ObjDesc->CommonNotify.NotifyList[HandlerListId];
151 }
152
153 /*
154 * If there is no notify handler (Global or Local)
155 * for this object, just ignore the notify
156 */
157 if (!AcpiGbl_GlobalNotify[HandlerListId].Handler && !HandlerListHead)
158 {
160 "No notify handler for Notify, ignoring (%4.4s, %X) node %p\n",
161 AcpiUtGetNodeName (Node), NotifyValue, Node));
162
163 return (AE_OK);
164 }
165
166 /* Setup notify info and schedule the notify dispatcher */
167
169 if (!Info)
170 {
171 return (AE_NO_MEMORY);
172 }
173
174 Info->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY;
175
176 Info->Notify.Node = Node;
177 Info->Notify.Value = (UINT16) NotifyValue;
178 Info->Notify.HandlerListId = HandlerListId;
179 Info->Notify.HandlerListHead = HandlerListHead;
180 Info->Notify.Global = &AcpiGbl_GlobalNotify[HandlerListId];
181
183 "Dispatching Notify on [%4.4s] (%s) Value 0x%2.2X (%s) Node %p\n",
185 NotifyValue, AcpiUtGetNotifyName (NotifyValue, ACPI_TYPE_ANY), Node));
186
189 if (ACPI_FAILURE (Status))
190 {
192 }
193
194 return (Status);
195}
#define AE_TYPE
Definition: acexcep.h:116
#define ACPI_DESC_TYPE_STATE_NOTIFY
Definition: acobject.h:572
#define ACPI_DB_INFO
Definition: acoutput.h:153
@ OSL_NOTIFY_HANDLER
Definition: acpiosxf.h:58
ACPI_STATUS AcpiOsExecute(ACPI_EXECUTE_TYPE Type, ACPI_OSD_EXEC_CALLBACK Function, void *Context)
Definition: osl.c:224
#define ACPI_SYSTEM_HANDLER_LIST
Definition: actypes.h:853
#define ACPI_MAX_SYS_NOTIFY
Definition: actypes.h:850
#define ACPI_DEVICE_HANDLER_LIST
Definition: actypes.h:854
const char * AcpiUtGetTypeName(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:250
ACPI_GENERIC_STATE * AcpiUtCreateGenericState(void)
Definition: utstate.c:130
void AcpiUtDeleteGenericState(ACPI_GENERIC_STATE *State)
Definition: utstate.c:340
static void ACPI_SYSTEM_XFACE AcpiEvNotifyDispatch(void *Context)
Definition: evmisc.c:212
BOOLEAN AcpiEvIsNotifyObject(ACPI_NAMESPACE_NODE *Node)
Definition: evmisc.c:75
ACPI_OBJECT_NOTIFY_HANDLER Notify
Definition: acobject.h:538

Referenced by AcpiEvAsynchExecuteGpeMethod(), and AcpiExOpcode_2A_0T_0R().

◆ AcpiEvRemoveAllSciHandlers()

ACPI_STATUS AcpiEvRemoveAllSciHandlers ( void  )

Definition at line 246 of file evsci.c.

248{
249 ACPI_SCI_HANDLER_INFO *SciHandler;
252
253
254 ACPI_FUNCTION_TRACE (EvRemoveAllSciHandlers);
255
256
257 /* Just let the OS remove the handler and disable the level */
258
259 Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt,
261
262 if (!AcpiGbl_SciHandlerList)
263 {
264 return (Status);
265 }
266
267 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
268
269 /* Free all host-installed SCI handlers */
270
271 while (AcpiGbl_SciHandlerList)
272 {
273 SciHandler = AcpiGbl_SciHandlerList;
274 AcpiGbl_SciHandlerList = SciHandler->Next;
275 ACPI_FREE (SciHandler);
276 }
277
278 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
280}
struct acpi_sci_handler_info * Next
Definition: aclocal.h:509

Referenced by AcpiEvTerminate().

◆ 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}

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

◆ AcpiEvSciDispatch()

UINT32 AcpiEvSciDispatch ( void  )

Definition at line 75 of file evsci.c.

77{
78 ACPI_SCI_HANDLER_INFO *SciHandler;
81
82
83 ACPI_FUNCTION_NAME (EvSciDispatch);
84
85
86 /* Are there any host-installed SCI handlers? */
87
88 if (!AcpiGbl_SciHandlerList)
89 {
90 return (IntStatus);
91 }
92
93 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
94
95 /* Invoke all host-installed SCI handlers */
96
97 SciHandler = AcpiGbl_SciHandlerList;
98 while (SciHandler)
99 {
100 /* Invoke the installed handler (at interrupt level) */
101
102 IntStatus |= SciHandler->Address (
103 SciHandler->Context);
104
105 SciHandler = SciHandler->Next;
106 }
107
108 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
109 return (IntStatus);
110}
ACPI_SCI_HANDLER Address
Definition: aclocal.h:510

Referenced by AcpiEvSciXruptHandler().

◆ AcpiEvSystemMemoryRegionSetup()

ACPI_STATUS AcpiEvSystemMemoryRegionSetup ( ACPI_HANDLE  Handle,
UINT32  Function,
void HandlerContext,
void **  RegionContext 
)

Definition at line 70 of file evrgnini.c.

75{
77 ACPI_MEM_SPACE_CONTEXT *LocalRegionContext;
79
80
81 ACPI_FUNCTION_TRACE (EvSystemMemoryRegionSetup);
82
83
85 {
86 if (*RegionContext)
87 {
88 LocalRegionContext = (ACPI_MEM_SPACE_CONTEXT *) *RegionContext;
89
90 /* Delete memory mappings if present */
91
92 while (LocalRegionContext->FirstMm)
93 {
94 Mm = LocalRegionContext->FirstMm;
95 LocalRegionContext->FirstMm = Mm->NextMm;
97 ACPI_FREE(Mm);
98 }
99 ACPI_FREE (LocalRegionContext);
100 *RegionContext = NULL;
101 }
103 }
104
105 /* Create a new context */
106
107 LocalRegionContext = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_MEM_SPACE_CONTEXT));
108 if (!(LocalRegionContext))
109 {
111 }
112
113 /* Save the region length and address for use in the handler */
114
115 LocalRegionContext->Length = RegionDesc->Region.Length;
116 LocalRegionContext->Address = RegionDesc->Region.Address;
117
118 *RegionContext = LocalRegionContext;
120}
void AcpiOsUnmapMemory(void *LogicalAddress, ACPI_SIZE Size)
Definition: osl.c:128
ACPI_SIZE Length
Definition: actypes.h:1362
struct acpi_mem_mapping * NextMm
Definition: actypes.h:1363
UINT8 * LogicalAddress
Definition: actypes.h:1361
ACPI_PHYSICAL_ADDRESS Address
Definition: actypes.h:1370
ACPI_MEM_MAPPING * FirstMm
Definition: actypes.h:1372

Referenced by AcpiEvInstallSpaceHandler().

◆ 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
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}

Referenced by AcpiEvAddGpeReference(), and AcpiEvRemoveGpeReference().

◆ AcpiEvWalkGpeList()

ACPI_STATUS AcpiEvWalkGpeList ( ACPI_GPE_CALLBACK  GpeWalkCallback,
void Context 
)

Definition at line 67 of file evgpeutil.c.

70{
71 ACPI_GPE_BLOCK_INFO *GpeBlock;
72 ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
75
76
77 ACPI_FUNCTION_TRACE (EvWalkGpeList);
78
79
80 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
81
82 /* Walk the interrupt level descriptor list */
83
84 GpeXruptInfo = AcpiGbl_GpeXruptListHead;
85 while (GpeXruptInfo)
86 {
87 /* Walk all Gpe Blocks attached to this interrupt level */
88
89 GpeBlock = GpeXruptInfo->GpeBlockListHead;
90 while (GpeBlock)
91 {
92 /* One callback per GPE block */
93
94 Status = GpeWalkCallback (GpeXruptInfo, GpeBlock, Context);
95 if (ACPI_FAILURE (Status))
96 {
97 if (Status == AE_CTRL_END) /* Callback abort */
98 {
99 Status = AE_OK;
100 }
101 goto UnlockAndExit;
102 }
103
104 GpeBlock = GpeBlock->Next;
105 }
106
107 GpeXruptInfo = GpeXruptInfo->Next;
108 }
109
110UnlockAndExit:
111 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
113}

Referenced by AcpiEvTerminate(), AcpiGetGpeDevice(), AcpiHwCheckAllGpes(), AcpiHwClearAcpiStatus(), AcpiHwDisableAllGpes(), AcpiHwEnableAllRuntimeGpes(), AcpiHwEnableAllWakeupGpes(), and AcpiUpdateAllGpes().

Variable Documentation

◆ Context

Definition at line 215 of file acevents.h.

◆ GpeEventInfo

◆ GpeNumber

◆ Level

UINT32 Level

Definition at line 214 of file acevents.h.

◆ ReturnValue