ReactOS 0.4.15-dev-7842-g558ab78
evmisc.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#include "acnamesp.h"
Include dependency graph for evmisc.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_EVENTS
 

Functions

static void ACPI_SYSTEM_XFACE AcpiEvNotifyDispatch (void *Context)
 
BOOLEAN AcpiEvIsNotifyObject (ACPI_NAMESPACE_NODE *Node)
 
ACPI_STATUS AcpiEvQueueNotifyRequest (ACPI_NAMESPACE_NODE *Node, UINT32 NotifyValue)
 
void AcpiEvTerminate (void)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_EVENTS

Definition at line 49 of file evmisc.c.

Function Documentation

◆ 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}
#define ACPI_TYPE_PROCESSOR
Definition: actypes.h:699
#define ACPI_TYPE_DEVICE
Definition: actypes.h:693
#define ACPI_TYPE_THERMAL
Definition: actypes.h:700
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
Definition: dlist.c:348

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

◆ AcpiEvNotifyDispatch()

static void ACPI_SYSTEM_XFACE AcpiEvNotifyDispatch ( void Context)
static

Definition at line 212 of file evmisc.c.

214{
216 ACPI_OPERAND_OBJECT *HandlerObj;
217
218
220
221
222 /* Invoke a global notify handler if installed */
223
224 if (Info->Notify.Global->Handler)
225 {
226 Info->Notify.Global->Handler (Info->Notify.Node,
227 Info->Notify.Value,
228 Info->Notify.Global->Context);
229 }
230
231 /* Now invoke the local notify handler(s) if any are installed */
232
233 HandlerObj = Info->Notify.HandlerListHead;
234 while (HandlerObj)
235 {
236 HandlerObj->Notify.Handler (Info->Notify.Node,
237 Info->Notify.Value,
238 HandlerObj->Notify.Context);
239
240 HandlerObj = HandlerObj->Notify.Next[Info->Notify.HandlerListId];
241 }
242
243 /* All done with the info object */
244
246}
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
void AcpiUtDeleteGenericState(ACPI_GENERIC_STATE *State)
Definition: utstate.c:340
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
_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 AcpiEvQueueNotifyRequest().

◆ 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}
unsigned short UINT16
unsigned char UINT8
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_TYPE
Definition: acexcep.h:116
#define AE_OK
Definition: acexcep.h:97
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
#define ACPI_DESC_TYPE_STATE_NOTIFY
Definition: acobject.h:572
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_DB_INFO
Definition: acoutput.h:153
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479
@ 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
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_SYSTEM_HANDLER_LIST
Definition: actypes.h:853
#define ACPI_TYPE_ANY
Definition: actypes.h:687
UINT32 ACPI_STATUS
Definition: actypes.h:460
#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
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:306
#define NULL
Definition: types.h:112
union node Node
Definition: types.h:1255
static void ACPI_SYSTEM_XFACE AcpiEvNotifyDispatch(void *Context)
Definition: evmisc.c:212
BOOLEAN AcpiEvIsNotifyObject(ACPI_NAMESPACE_NODE *Node)
Definition: evmisc.c:75
Status
Definition: gdiplustypes.h:25
ACPI_OBJECT_NOTIFY_COMMON CommonNotify
Definition: acobject.h:528

Referenced by AcpiEvAsynchExecuteGpeMethod(), and AcpiExOpcode_2A_0T_0R().

◆ AcpiEvTerminate()

void AcpiEvTerminate ( void  )

Definition at line 263 of file evmisc.c.

265{
266 UINT32 i;
268
269
270 ACPI_FUNCTION_TRACE (EvTerminate);
271
272
273 if (AcpiGbl_EventsInitialized)
274 {
275 /*
276 * Disable all event-related functionality. In all cases, on error,
277 * print a message but obviously we don't abort.
278 */
279
280 /* Disable all fixed events */
281
282 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
283 {
285 if (ACPI_FAILURE (Status))
286 {
288 "Could not disable fixed event %u", (UINT32) i));
289 }
290 }
291
292 /* Disable all GPEs in all GPE blocks */
293
295 if (ACPI_FAILURE (Status))
296 {
298 "Could not disable GPEs in GPE block"));
299 }
300
302 if (ACPI_FAILURE (Status))
303 {
305 "Could not remove Global Lock handler"));
306 }
307
308 AcpiGbl_EventsInitialized = FALSE;
309 }
310
311 /* Remove SCI handlers */
312
314 if (ACPI_FAILURE (Status))
315 {
317 "Could not remove SCI handler"));
318 }
319
320 /* Deallocate all handler objects installed within GPE info structs */
321
323 if (ACPI_FAILURE (Status))
324 {
326 "Could not delete GPE handlers"));
327 }
328
329
330 /* Return to original mode if necessary */
331
332 if (AcpiGbl_OriginalMode == ACPI_SYS_MODE_LEGACY)
333 {
334 Status = AcpiDisable ();
335 if (ACPI_FAILURE (Status))
336 {
337 ACPI_WARNING ((AE_INFO, "AcpiDisable failed"));
338 }
339 }
341}
unsigned int UINT32
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
#define return_VOID
Definition: acoutput.h:495
#define ACPI_NUM_FIXED_EVENTS
Definition: actypes.h:770
#define ACPI_SYS_MODE_LEGACY
Definition: actypes.h:1085
ACPI_STATUS AcpiEvRemoveGlobalLockHandler(void)
Definition: evglock.c:135
ACPI_STATUS AcpiEvDeleteGpeHandlers(ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock, void *Context)
Definition: evgpeutil.c:339
ACPI_STATUS AcpiEvWalkGpeList(ACPI_GPE_CALLBACK GpeWalkCallback, void *Context)
Definition: evgpeutil.c:67
ACPI_STATUS AcpiEvRemoveAllSciHandlers(void)
Definition: evsci.c:246
ACPI_STATUS AcpiDisable(void)
Definition: evxfevnt.c:132
ACPI_STATUS AcpiDisableEvent(UINT32 Event, UINT32 Flags)
Definition: evxfevnt.c:263
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_STATUS AcpiHwDisableGpeBlock(ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock, void *Context)
Definition: hwgpe.c:364

Referenced by AcpiUtSubsystemShutdown().