ReactOS 0.4.15-dev-8145-ga541a46
evxface.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acevents.h"
#include "acinterp.h"
Include dependency graph for evxface.c:

Go to the source code of this file.

Macros

#define EXPORT_ACPI_INTERFACES
 
#define _COMPONENT   ACPI_EVENTS
 

Functions

static ACPI_STATUS AcpiEvInstallGpeHandler (ACPI_HANDLE GpeDevice, UINT32 GpeNumber, UINT32 Type, BOOLEAN IsRawHandler, ACPI_GPE_HANDLER Address, void *Context)
 
ACPI_STATUS AcpiInstallNotifyHandler (ACPI_HANDLE Device, UINT32 HandlerType, ACPI_NOTIFY_HANDLER Handler, void *Context)
 
ACPI_STATUS AcpiRemoveNotifyHandler (ACPI_HANDLE Device, UINT32 HandlerType, ACPI_NOTIFY_HANDLER Handler)
 
ACPI_STATUS AcpiInstallExceptionHandler (ACPI_EXCEPTION_HANDLER Handler)
 
ACPI_STATUS AcpiInstallSciHandler (ACPI_SCI_HANDLER Address, void *Context)
 
ACPI_STATUS AcpiRemoveSciHandler (ACPI_SCI_HANDLER Address)
 
ACPI_STATUS AcpiInstallGlobalEventHandler (ACPI_GBL_EVENT_HANDLER Handler, void *Context)
 
ACPI_STATUS AcpiInstallFixedEventHandler (UINT32 Event, ACPI_EVENT_HANDLER Handler, void *Context)
 
ACPI_STATUS AcpiRemoveFixedEventHandler (UINT32 Event, ACPI_EVENT_HANDLER Handler)
 
ACPI_STATUS AcpiInstallGpeHandler (ACPI_HANDLE GpeDevice, UINT32 GpeNumber, UINT32 Type, ACPI_GPE_HANDLER Address, void *Context)
 
ACPI_STATUS AcpiInstallGpeRawHandler (ACPI_HANDLE GpeDevice, UINT32 GpeNumber, UINT32 Type, ACPI_GPE_HANDLER Address, void *Context)
 
ACPI_STATUS AcpiRemoveGpeHandler (ACPI_HANDLE GpeDevice, UINT32 GpeNumber, ACPI_GPE_HANDLER Address)
 
ACPI_STATUS AcpiAcquireGlobalLock (UINT16 Timeout, UINT32 *Handle)
 
ACPI_STATUS AcpiReleaseGlobalLock (UINT32 Handle)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_EVENTS

Definition at line 52 of file evxface.c.

◆ EXPORT_ACPI_INTERFACES

#define EXPORT_ACPI_INTERFACES

Definition at line 44 of file evxface.c.

Function Documentation

◆ AcpiAcquireGlobalLock()

ACPI_STATUS AcpiAcquireGlobalLock ( UINT16  Timeout,
UINT32 Handle 
)

Definition at line 1205 of file evxface.c.

1208{
1210
1211
1212 if (!Handle)
1213 {
1214 return (AE_BAD_PARAMETER);
1215 }
1216
1217 /* Must lock interpreter to prevent race conditions */
1218
1220
1222 AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ());
1223
1224 if (ACPI_SUCCESS (Status))
1225 {
1226 /* Return the global lock handle (updated in AcpiEvAcquireGlobalLock) */
1227
1228 *Handle = AcpiGbl_GlobalLockHandle;
1229 }
1230
1232 return (Status);
1233}
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
ACPI_THREAD_ID AcpiOsGetThreadId(void)
Definition: osl.c:217
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_STATUS AcpiExAcquireMutexObject(UINT16 Timeout, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_THREAD_ID ThreadId)
Definition: exmutex.c:176
void AcpiExExitInterpreter(void)
Definition: exutils.c:139
void AcpiExEnterInterpreter(void)
Definition: exutils.c:91
ULONG Handle
Definition: gdb_input.c:15
Status
Definition: gdiplustypes.h:25
static ULONG Timeout
Definition: ping.c:61

◆ AcpiEvInstallGpeHandler()

static ACPI_STATUS AcpiEvInstallGpeHandler ( ACPI_HANDLE  GpeDevice,
UINT32  GpeNumber,
UINT32  Type,
BOOLEAN  IsRawHandler,
ACPI_GPE_HANDLER  Address,
void Context 
)
static

Definition at line 860 of file evxface.c.

867{
872
873
874 ACPI_FUNCTION_TRACE (EvInstallGpeHandler);
875
876
877 /* Parameter validation */
878
880 {
882 }
883
885 if (ACPI_FAILURE (Status))
886 {
888 }
889
890 /* Allocate and init handler object (before lock) */
891
893 if (!Handler)
894 {
896 goto UnlockAndExit;
897 }
898
899 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
900
901 /* Ensure that we have a valid GPE number */
902
904 if (!GpeEventInfo)
905 {
907 goto FreeAndExit;
908 }
909
910 /* Make sure that there isn't a handler there already */
911
916 {
918 goto FreeAndExit;
919 }
920
921 Handler->Address = Address;
922 Handler->Context = Context;
924 Handler->OriginalFlags = (UINT8) (GpeEventInfo->Flags &
926
927 /*
928 * If the GPE is associated with a method, it may have been enabled
929 * automatically during initialization, in which case it has to be
930 * disabled now to avoid spurious execution of the handler.
931 */
932 if (((ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) ==
934 (ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) ==
937 {
938 Handler->OriginallyEnabled = TRUE;
940
941 /* Sanity check of original type against new type */
942
944 {
945 ACPI_WARNING ((AE_INFO, "GPE type mismatch (level/edge)"));
946 }
947 }
948
949 /* Install the handler */
950
952
953 /* Setup up dispatch flags to indicate handler (vs. method/notify) */
954
956 GpeEventInfo->Flags |= (UINT8) (Type | (IsRawHandler ?
958
959 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
960
961
962UnlockAndExit:
965
966FreeAndExit:
967 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
969 goto UnlockAndExit;
970}
unsigned char UINT8
unsigned int UINT32
Type
Definition: Type.h:7
ACPI_GPE_EVENT_INFO * GpeEventInfo
Definition: acevents.h:195
ACPI_GPE_EVENT_INFO UINT32 GpeNumber
Definition: acevents.h:196
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_ALREADY_EXISTS
Definition: acexcep.h:115
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_MTX_EVENTS
Definition: aclocal.h:87
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define AE_INFO
Definition: acoutput.h:230
void AcpiOsReleaseLock(ACPI_SPINLOCK Handle, ACPI_CPU_FLAGS Flags)
Definition: osl.c:516
ACPI_CPU_FLAGS AcpiOsAcquireLock(ACPI_SPINLOCK Handle)
Definition: osl.c:498
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_GPE_DISPATCH_MASK
Definition: actypes.h:824
#define ACPI_CPU_FLAGS
Definition: actypes.h:252
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_GPE_DISPATCH_TYPE(flags)
Definition: actypes.h:825
#define ACPI_GPE_DISPATCH_METHOD
Definition: actypes.h:820
#define ACPI_GPE_DISPATCH_NOTIFY
Definition: actypes.h:822
#define ACPI_GPE_DISPATCH_RAW_HANDLER
Definition: actypes.h:823
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define ACPI_GPE_XRUPT_TYPE_MASK
Definition: actypes.h:829
#define ACPI_GPE_DISPATCH_HANDLER
Definition: actypes.h:821
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
#define TRUE
Definition: types.h:120
ACPI_GPE_EVENT_INFO * AcpiEvGetGpeEventInfo(ACPI_HANDLE GpeDevice, UINT32 GpeNumber)
Definition: evgpe.c:372
ACPI_STATUS AcpiEvRemoveGpeReference(ACPI_GPE_EVENT_INFO *GpeEventInfo)
Definition: evgpe.c:276
static WCHAR Address[46]
Definition: ping.c:68
union acpi_gpe_dispatch_info Dispatch
Definition: aclocal.h:554
ACPI_GPE_HANDLER_INFO * Handler
Definition: aclocal.h:543
ACPI_NAMESPACE_NODE * MethodNode
Definition: aclocal.h:542
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by AcpiInstallGpeHandler(), and AcpiInstallGpeRawHandler().

◆ AcpiInstallExceptionHandler()

ACPI_STATUS AcpiInstallExceptionHandler ( ACPI_EXCEPTION_HANDLER  Handler)

Definition at line 427 of file evxface.c.

429{
431
432
434
435
437 if (ACPI_FAILURE (Status))
438 {
440 }
441
442 /* Don't allow two handlers. */
443
444 if (AcpiGbl_ExceptionHandler)
445 {
447 goto Cleanup;
448 }
449
450 /* Install the handler */
451
452 AcpiGbl_ExceptionHandler = Handler;
453
454Cleanup:
457}
static const WCHAR Cleanup[]
Definition: register.c:80
ACPI_STATUS AcpiInstallExceptionHandler(ACPI_EXCEPTION_HANDLER Handler)
Definition: evxface.c:427

Referenced by AcpiInstallExceptionHandler().

◆ AcpiInstallFixedEventHandler()

ACPI_STATUS AcpiInstallFixedEventHandler ( UINT32  Event,
ACPI_EVENT_HANDLER  Handler,
void Context 
)

Definition at line 707 of file evxface.c.

711{
713
714
716
717
718 /* Parameter validation */
719
720 if (Event > ACPI_EVENT_MAX)
721 {
723 }
724
726 if (ACPI_FAILURE (Status))
727 {
729 }
730
731 /* Do not allow multiple handlers */
732
733 if (AcpiGbl_FixedEventHandlers[Event].Handler)
734 {
736 goto Cleanup;
737 }
738
739 /* Install the handler before enabling the event */
740
741 AcpiGbl_FixedEventHandlers[Event].Handler = Handler;
742 AcpiGbl_FixedEventHandlers[Event].Context = Context;
743
745 if (ACPI_FAILURE (Status))
746 {
748 "Could not enable fixed event - %s (%u)",
750
751 /* Remove the handler */
752
753 AcpiGbl_FixedEventHandlers[Event].Handler = NULL;
754 AcpiGbl_FixedEventHandlers[Event].Context = NULL;
755 }
756 else
757 {
759 "Enabled fixed event %s (%X), Handler=%p\n",
761 }
762
763
764Cleanup:
767}
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_DB_INFO
Definition: acoutput.h:153
#define ACPI_EVENT_MAX
Definition: actypes.h:769
const char * AcpiUtGetEventName(UINT32 EventId)
Definition: utdecode.c:175
#define NULL
Definition: types.h:112
ACPI_STATUS AcpiInstallFixedEventHandler(UINT32 Event, ACPI_EVENT_HANDLER Handler, void *Context)
Definition: evxface.c:707
ACPI_STATUS AcpiEnableEvent(UINT32 Event, UINT32 Flags)
Definition: evxfevnt.c:190

Referenced by acpi_button_add(), AcpiEvInitGlobalLockHandler(), and AcpiInstallFixedEventHandler().

◆ AcpiInstallGlobalEventHandler()

ACPI_STATUS AcpiInstallGlobalEventHandler ( ACPI_GBL_EVENT_HANDLER  Handler,
void Context 
)

Definition at line 647 of file evxface.c.

650{
652
653
655
656
657 /* Parameter validation */
658
659 if (!Handler)
660 {
662 }
663
665 if (ACPI_FAILURE (Status))
666 {
668 }
669
670 /* Don't allow two handlers. */
671
672 if (AcpiGbl_GlobalEventHandler)
673 {
675 goto Cleanup;
676 }
677
678 AcpiGbl_GlobalEventHandler = Handler;
679 AcpiGbl_GlobalEventHandlerContext = Context;
680
681
682Cleanup:
685}
ACPI_STATUS AcpiInstallGlobalEventHandler(ACPI_GBL_EVENT_HANDLER Handler, void *Context)
Definition: evxface.c:647

Referenced by AcpiInstallGlobalEventHandler().

◆ AcpiInstallGpeHandler()

ACPI_STATUS AcpiInstallGpeHandler ( ACPI_HANDLE  GpeDevice,
UINT32  GpeNumber,
UINT32  Type,
ACPI_GPE_HANDLER  Address,
void Context 
)

Definition at line 992 of file evxface.c.

998{
1000
1001
1003
1004
1007
1009}
#define FALSE
Definition: types.h:117
ACPI_STATUS AcpiInstallGpeHandler(ACPI_HANDLE GpeDevice, UINT32 GpeNumber, UINT32 Type, ACPI_GPE_HANDLER Address, void *Context)
Definition: evxface.c:992
static ACPI_STATUS AcpiEvInstallGpeHandler(ACPI_HANDLE GpeDevice, UINT32 GpeNumber, UINT32 Type, BOOLEAN IsRawHandler, ACPI_GPE_HANDLER Address, void *Context)
Definition: evxface.c:860

Referenced by AcpiInstallGpeHandler().

◆ AcpiInstallGpeRawHandler()

ACPI_STATUS AcpiInstallGpeRawHandler ( ACPI_HANDLE  GpeDevice,
UINT32  GpeNumber,
UINT32  Type,
ACPI_GPE_HANDLER  Address,
void Context 
)

Definition at line 1033 of file evxface.c.

1039{
1041
1042
1044
1045
1047 TRUE, Address, Context);
1048
1050}
ACPI_STATUS AcpiInstallGpeRawHandler(ACPI_HANDLE GpeDevice, UINT32 GpeNumber, UINT32 Type, ACPI_GPE_HANDLER Address, void *Context)
Definition: evxface.c:1033

Referenced by AcpiInstallGpeRawHandler().

◆ AcpiInstallNotifyHandler()

ACPI_STATUS AcpiInstallNotifyHandler ( ACPI_HANDLE  Device,
UINT32  HandlerType,
ACPI_NOTIFY_HANDLER  Handler,
void Context 
)

Definition at line 96 of file evxface.c.

101{
103 ACPI_OPERAND_OBJECT *ObjDesc;
104 ACPI_OPERAND_OBJECT *HandlerObj;
106 UINT32 i;
107
108
110
111
112 /* Parameter validation */
113
114 if ((!Device) || (!Handler) || (!HandlerType) ||
116 {
118 }
119
121 if (ACPI_FAILURE (Status))
122 {
124 }
125
126 /*
127 * Root Object:
128 * Registering a notify handler on the root object indicates that the
129 * caller wishes to receive notifications for all objects. Note that
130 * only one global handler can be registered per notify type.
131 * Ensure that a handler is not already installed.
132 */
134 {
135 for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
136 {
137 if (HandlerType & (i+1))
138 {
139 if (AcpiGbl_GlobalNotify[i].Handler)
140 {
142 goto UnlockAndExit;
143 }
144
145 AcpiGbl_GlobalNotify[i].Handler = Handler;
146 AcpiGbl_GlobalNotify[i].Context = Context;
147 }
148 }
149
150 goto UnlockAndExit; /* Global notify handler installed, all done */
151 }
152
153 /*
154 * All Other Objects:
155 * Caller will only receive notifications specific to the target
156 * object. Note that only certain object types are allowed to
157 * receive notifications.
158 */
159
160 /* Are Notifies allowed on this object? */
161
163 {
164 Status = AE_TYPE;
165 goto UnlockAndExit;
166 }
167
168 /* Check for an existing internal object, might not exist */
169
170 ObjDesc = AcpiNsGetAttachedObject (Node);
171 if (!ObjDesc)
172 {
173 /* Create a new object */
174
175 ObjDesc = AcpiUtCreateInternalObject (Node->Type);
176 if (!ObjDesc)
177 {
179 goto UnlockAndExit;
180 }
181
182 /* Attach new object to the Node, remove local reference */
183
184 Status = AcpiNsAttachObject (Device, ObjDesc, Node->Type);
185 AcpiUtRemoveReference (ObjDesc);
186 if (ACPI_FAILURE (Status))
187 {
188 goto UnlockAndExit;
189 }
190 }
191
192 /* Ensure that the handler is not already installed in the lists */
193
194 for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
195 {
196 if (HandlerType & (i+1))
197 {
198 HandlerObj = ObjDesc->CommonNotify.NotifyList[i];
199 while (HandlerObj)
200 {
201 if (HandlerObj->Notify.Handler == Handler)
202 {
204 goto UnlockAndExit;
205 }
206
207 HandlerObj = HandlerObj->Notify.Next[i];
208 }
209 }
210 }
211
212 /* Create and populate a new notify handler object */
213
215 if (!HandlerObj)
216 {
218 goto UnlockAndExit;
219 }
220
221 HandlerObj->Notify.Node = Node;
222 HandlerObj->Notify.HandlerType = HandlerType;
223 HandlerObj->Notify.Handler = Handler;
224 HandlerObj->Notify.Context = Context;
225
226 /* Install the handler at the list head(s) */
227
228 for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
229 {
230 if (HandlerType & (i+1))
231 {
232 HandlerObj->Notify.Next[i] =
233 ObjDesc->CommonNotify.NotifyList[i];
234
235 ObjDesc->CommonNotify.NotifyList[i] = HandlerObj;
236 }
237 }
238
239 /* Add an extra reference if handler was installed in both lists */
240
242 {
243 AcpiUtAddReference (HandlerObj);
244 }
245
246
247UnlockAndExit:
250}
#define AE_TYPE
Definition: acexcep.h:116
#define ACPI_MTX_NAMESPACE
Definition: aclocal.h:85
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
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 HandlerType
Definition: acpixf.h:817
#define ACPI_MAX_NOTIFY_HANDLER_TYPE
Definition: actypes.h:847
#define ACPI_TYPE_LOCAL_NOTIFY
Definition: actypes.h:722
#define ACPI_NUM_NOTIFY_TYPES
Definition: actypes.h:848
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define ACPI_ALL_NOTIFY
Definition: actypes.h:846
#define ACPI_ROOT_OBJECT
Definition: actypes.h:500
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:681
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:790
void AcpiUtAddReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:752
union node Node
Definition: types.h:1255
BOOLEAN AcpiEvIsNotifyObject(ACPI_NAMESPACE_NODE *Node)
Definition: evmisc.c:75
ACPI_STATUS AcpiInstallNotifyHandler(ACPI_HANDLE Device, UINT32 HandlerType, ACPI_NOTIFY_HANDLER Handler, void *Context)
Definition: evxface.c:96
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ACPI_OBJECT_COMMON_HEADER ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:400
ACPI_NOTIFY_HANDLER Handler
Definition: acobject.h:402
union acpi_operand_object * Next[2]
Definition: acobject.h:404
ACPI_OBJECT_NOTIFY_HANDLER Notify
Definition: acobject.h:538
ACPI_OBJECT_NOTIFY_COMMON CommonNotify
Definition: acobject.h:528
Definition: dlist.c:348
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474

Referenced by acpi_bus_init(), acpi_button_add(), and AcpiInstallNotifyHandler().

◆ AcpiInstallSciHandler()

ACPI_STATUS AcpiInstallSciHandler ( ACPI_SCI_HANDLER  Address,
void Context 
)

Definition at line 477 of file evxface.c.

480{
481 ACPI_SCI_HANDLER_INFO *NewSciHandler;
482 ACPI_SCI_HANDLER_INFO *SciHandler;
485
486
488
489
490 if (!Address)
491 {
493 }
494
495 /* Allocate and init a handler object */
496
497 NewSciHandler = ACPI_ALLOCATE (sizeof (ACPI_SCI_HANDLER_INFO));
498 if (!NewSciHandler)
499 {
501 }
502
503 NewSciHandler->Address = Address;
504 NewSciHandler->Context = Context;
505
507 if (ACPI_FAILURE (Status))
508 {
509 goto Exit;
510 }
511
512 /* Lock list during installation */
513
514 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
515 SciHandler = AcpiGbl_SciHandlerList;
516
517 /* Ensure handler does not already exist */
518
519 while (SciHandler)
520 {
521 if (Address == SciHandler->Address)
522 {
524 goto UnlockAndExit;
525 }
526
527 SciHandler = SciHandler->Next;
528 }
529
530 /* Install the new handler into the global list (at head) */
531
532 NewSciHandler->Next = AcpiGbl_SciHandlerList;
533 AcpiGbl_SciHandlerList = NewSciHandler;
534
535
536UnlockAndExit:
537
538 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
540
541Exit:
542 if (ACPI_FAILURE (Status))
543 {
544 ACPI_FREE (NewSciHandler);
545 }
547}
#define ACPI_ALLOCATE(a)
Definition: actypes.h:384
ACPI_STATUS AcpiInstallSciHandler(ACPI_SCI_HANDLER Address, void *Context)
Definition: evxface.c:477
static void Exit(void)
Definition: sock.c:1330
struct acpi_sci_handler_info * Next
Definition: aclocal.h:509
ACPI_SCI_HANDLER Address
Definition: aclocal.h:510

Referenced by AcpiInstallSciHandler().

◆ AcpiReleaseGlobalLock()

ACPI_STATUS AcpiReleaseGlobalLock ( UINT32  Handle)

Definition at line 1251 of file evxface.c.

1253{
1255
1256
1257 if (!Handle || (Handle != AcpiGbl_GlobalLockHandle))
1258 {
1259 return (AE_NOT_ACQUIRED);
1260 }
1261
1262 Status = AcpiExReleaseMutexObject (AcpiGbl_GlobalLockMutex);
1263 return (Status);
1264}
#define AE_NOT_ACQUIRED
Definition: acexcep.h:128
ACPI_STATUS AcpiExReleaseMutexObject(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: exmutex.c:344

◆ AcpiRemoveFixedEventHandler()

ACPI_STATUS AcpiRemoveFixedEventHandler ( UINT32  Event,
ACPI_EVENT_HANDLER  Handler 
)

Definition at line 786 of file evxface.c.

789{
791
792
794
795
796 /* Parameter validation */
797
798 if (Event > ACPI_EVENT_MAX)
799 {
801 }
802
804 if (ACPI_FAILURE (Status))
805 {
807 }
808
809 /* Disable the event before removing the handler */
810
812
813 /* Always Remove the handler */
814
815 AcpiGbl_FixedEventHandlers[Event].Handler = NULL;
816 AcpiGbl_FixedEventHandlers[Event].Context = NULL;
817
818 if (ACPI_FAILURE (Status))
819 {
821 "Could not disable fixed event - %s (%u)",
823 }
824 else
825 {
827 "Disabled fixed event - %s (%X)\n",
829 }
830
833}
#define AE_OK
Definition: acexcep.h:97
ACPI_STATUS AcpiRemoveFixedEventHandler(UINT32 Event, ACPI_EVENT_HANDLER Handler)
Definition: evxface.c:786
ACPI_STATUS AcpiDisableEvent(UINT32 Event, UINT32 Flags)
Definition: evxfevnt.c:263

Referenced by acpi_button_remove(), AcpiEvRemoveGlobalLockHandler(), and AcpiRemoveFixedEventHandler().

◆ AcpiRemoveGpeHandler()

ACPI_STATUS AcpiRemoveGpeHandler ( ACPI_HANDLE  GpeDevice,
UINT32  GpeNumber,
ACPI_GPE_HANDLER  Address 
)

Definition at line 1071 of file evxface.c.

1075{
1080
1081
1083
1084
1085 /* Parameter validation */
1086
1087 if (!Address)
1088 {
1090 }
1091
1093 if (ACPI_FAILURE (Status))
1094 {
1096 }
1097
1098 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
1099
1100 /* Ensure that we have a valid GPE number */
1101
1103 if (!GpeEventInfo)
1104 {
1106 goto UnlockAndExit;
1107 }
1108
1109 /* Make sure that a handler is indeed installed */
1110
1115 {
1117 goto UnlockAndExit;
1118 }
1119
1120 /* Make sure that the installed handler is the same */
1121
1123 {
1125 goto UnlockAndExit;
1126 }
1127
1128 /* Remove the handler */
1129
1132
1133 /* Restore Method node (if any), set dispatch flags */
1134
1135 GpeEventInfo->Dispatch.MethodNode = Handler->MethodNode;
1138 GpeEventInfo->Flags |= Handler->OriginalFlags;
1139
1140 /*
1141 * If the GPE was previously associated with a method and it was
1142 * enabled, it should be enabled at this point to restore the
1143 * post-initialization configuration.
1144 */
1145 if (((ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) ==
1147 (ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) ==
1149 Handler->OriginallyEnabled)
1150 {
1153 {
1154 /* Poll edge triggered GPEs to handle existing events */
1155
1156 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
1158 GpeDevice, GpeEventInfo, GpeNumber);
1159 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
1160 }
1161 }
1162
1163 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
1165
1166 /* Make sure all deferred GPE tasks are completed */
1167
1169
1170 /* Now we can free the handler object */
1171
1174
1175UnlockAndExit:
1176 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
1179}
#define ACPI_GPE_IS_POLLING_NEEDED(__gpe__)
Definition: acevents.h:59
#define AE_NOT_EXIST
Definition: acexcep.h:114
void AcpiOsWaitEventsComplete(void)
Definition: osl.c:894
UINT32 AcpiEvDetectGpe(ACPI_NAMESPACE_NODE *GpeDevice, ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 GpeNumber)
Definition: evgpe.c:722
ACPI_STATUS AcpiEvAddGpeReference(ACPI_GPE_EVENT_INFO *GpeEventInfo, BOOLEAN ClearOnEnable)
Definition: evgpe.c:221
ACPI_STATUS AcpiRemoveGpeHandler(ACPI_HANDLE GpeDevice, UINT32 GpeNumber, ACPI_GPE_HANDLER Address)
Definition: evxface.c:1071
ACPI_GPE_HANDLER Address
Definition: aclocal.h:519

Referenced by AcpiRemoveGpeHandler().

◆ AcpiRemoveNotifyHandler()

ACPI_STATUS AcpiRemoveNotifyHandler ( ACPI_HANDLE  Device,
UINT32  HandlerType,
ACPI_NOTIFY_HANDLER  Handler 
)

Definition at line 273 of file evxface.c.

277{
279 ACPI_OPERAND_OBJECT *ObjDesc;
280 ACPI_OPERAND_OBJECT *HandlerObj;
281 ACPI_OPERAND_OBJECT *PreviousHandlerObj;
283 UINT32 i;
284
285
287
288
289 /* Parameter validation */
290
291 if ((!Device) || (!Handler) || (!HandlerType) ||
293 {
295 }
296
297 /* Root Object. Global handlers are removed here */
298
300 {
301 for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
302 {
303 if (HandlerType & (i+1))
304 {
306 if (ACPI_FAILURE (Status))
307 {
309 }
310
311 if (!AcpiGbl_GlobalNotify[i].Handler ||
312 (AcpiGbl_GlobalNotify[i].Handler != Handler))
313 {
315 goto UnlockAndExit;
316 }
317
319 "Removing global notify handler\n"));
320
321 AcpiGbl_GlobalNotify[i].Handler = NULL;
322 AcpiGbl_GlobalNotify[i].Context = NULL;
323
325
326 /* Make sure all deferred notify tasks are completed */
327
329 }
330 }
331
333 }
334
335 /* All other objects: Are Notifies allowed on this object? */
336
338 {
340 }
341
342 /* Must have an existing internal object */
343
344 ObjDesc = AcpiNsGetAttachedObject (Node);
345 if (!ObjDesc)
346 {
348 }
349
350 /* Internal object exists. Find the handler and remove it */
351
352 for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
353 {
354 if (HandlerType & (i+1))
355 {
357 if (ACPI_FAILURE (Status))
358 {
360 }
361
362 HandlerObj = ObjDesc->CommonNotify.NotifyList[i];
363 PreviousHandlerObj = NULL;
364
365 /* Attempt to find the handler in the handler list */
366
367 while (HandlerObj &&
368 (HandlerObj->Notify.Handler != Handler))
369 {
370 PreviousHandlerObj = HandlerObj;
371 HandlerObj = HandlerObj->Notify.Next[i];
372 }
373
374 if (!HandlerObj)
375 {
377 goto UnlockAndExit;
378 }
379
380 /* Remove the handler object from the list */
381
382 if (PreviousHandlerObj) /* Handler is not at the list head */
383 {
384 PreviousHandlerObj->Notify.Next[i] =
385 HandlerObj->Notify.Next[i];
386 }
387 else /* Handler is at the list head */
388 {
389 ObjDesc->CommonNotify.NotifyList[i] =
390 HandlerObj->Notify.Next[i];
391 }
392
394
395 /* Make sure all deferred notify tasks are completed */
396
398 AcpiUtRemoveReference (HandlerObj);
399 }
400 }
401
403
404
405UnlockAndExit:
408}
ACPI_STATUS AcpiRemoveNotifyHandler(ACPI_HANDLE Device, UINT32 HandlerType, ACPI_NOTIFY_HANDLER Handler)
Definition: evxface.c:273

Referenced by acpi_bus_exit(), acpi_bus_init(), acpi_button_remove(), and AcpiRemoveNotifyHandler().

◆ AcpiRemoveSciHandler()

ACPI_STATUS AcpiRemoveSciHandler ( ACPI_SCI_HANDLER  Address)

Definition at line 565 of file evxface.c.

567{
568 ACPI_SCI_HANDLER_INFO *PrevSciHandler;
569 ACPI_SCI_HANDLER_INFO *NextSciHandler;
572
573
575
576
577 if (!Address)
578 {
580 }
581
583 if (ACPI_FAILURE (Status))
584 {
586 }
587
588 /* Remove the SCI handler with lock */
589
590 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
591
592 PrevSciHandler = NULL;
593 NextSciHandler = AcpiGbl_SciHandlerList;
594 while (NextSciHandler)
595 {
596 if (NextSciHandler->Address == Address)
597 {
598 /* Unlink and free the SCI handler info block */
599
600 if (PrevSciHandler)
601 {
602 PrevSciHandler->Next = NextSciHandler->Next;
603 }
604 else
605 {
606 AcpiGbl_SciHandlerList = NextSciHandler->Next;
607 }
608
609 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
610 ACPI_FREE (NextSciHandler);
611 goto UnlockAndExit;
612 }
613
614 PrevSciHandler = NextSciHandler;
615 NextSciHandler = NextSciHandler->Next;
616 }
617
618 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
620
621
622UnlockAndExit:
625}
ACPI_STATUS AcpiRemoveSciHandler(ACPI_SCI_HANDLER Address)
Definition: evxface.c:565

Referenced by AcpiRemoveSciHandler().