ReactOS 0.4.16-dev-122-g325d74c
evxfregn.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acevents.h"
Include dependency graph for evxfregn.c:

Go to the source code of this file.

Macros

#define EXPORT_ACPI_INTERFACES
 
#define _COMPONENT   ACPI_EVENTS
 

Functions

ACPI_STATUS AcpiInstallAddressSpaceHandler (ACPI_HANDLE Device, ACPI_ADR_SPACE_TYPE SpaceId, ACPI_ADR_SPACE_HANDLER Handler, ACPI_ADR_SPACE_SETUP Setup, void *Context)
 
ACPI_STATUS AcpiRemoveAddressSpaceHandler (ACPI_HANDLE Device, ACPI_ADR_SPACE_TYPE SpaceId, ACPI_ADR_SPACE_HANDLER Handler)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_EVENTS

Definition at line 52 of file evxfregn.c.

◆ EXPORT_ACPI_INTERFACES

#define EXPORT_ACPI_INTERFACES

Definition at line 45 of file evxfregn.c.

Function Documentation

◆ AcpiInstallAddressSpaceHandler()

ACPI_STATUS AcpiInstallAddressSpaceHandler ( ACPI_HANDLE  Device,
ACPI_ADR_SPACE_TYPE  SpaceId,
ACPI_ADR_SPACE_HANDLER  Handler,
ACPI_ADR_SPACE_SETUP  Setup,
void Context 
)

Definition at line 79 of file evxfregn.c.

85{
88
89
91
92
93 /* Parameter validation */
94
95 if (!Device)
96 {
98 }
99
101 if (ACPI_FAILURE (Status))
102 {
104 }
105
106 /* Convert and validate the device handle */
107
109 if (!Node)
110 {
112 goto UnlockAndExit;
113 }
114
115 /* Install the handler for all Regions for this Space ID */
116
119 if (ACPI_FAILURE (Status))
120 {
121 goto UnlockAndExit;
122 }
123
124 /* Run all _REG methods for this address space */
125
127
128
129UnlockAndExit:
132}
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define ACPI_MTX_NAMESPACE
Definition: aclocal.h:85
ACPI_NAMESPACE_NODE * AcpiNsValidateHandle(ACPI_HANDLE Handle)
Definition: nsutils.c:655
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
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
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
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_REG_CONNECT
Definition: actypes.h:890
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
union node Node
Definition: types.h:1255
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
void AcpiEvExecuteRegMethods(ACPI_NAMESPACE_NODE *Node, ACPI_ADR_SPACE_TYPE SpaceId, UINT32 Function)
Definition: evregion.c:761
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
Status
Definition: gdiplustypes.h:25
Definition: dlist.c:348
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474

Referenced by AcpiEvPciConfigRegionSetup(), and AcpiInstallAddressSpaceHandler().

◆ AcpiRemoveAddressSpaceHandler()

ACPI_STATUS AcpiRemoveAddressSpaceHandler ( ACPI_HANDLE  Device,
ACPI_ADR_SPACE_TYPE  SpaceId,
ACPI_ADR_SPACE_HANDLER  Handler 
)

Definition at line 152 of file evxfregn.c.

156{
157 ACPI_OPERAND_OBJECT *ObjDesc;
158 ACPI_OPERAND_OBJECT *HandlerObj;
159 ACPI_OPERAND_OBJECT *RegionObj;
160 ACPI_OPERAND_OBJECT **LastObjPtr;
163
164
166
167
168 /* Parameter validation */
169
170 if (!Device)
171 {
173 }
174
176 if (ACPI_FAILURE (Status))
177 {
179 }
180
181 /* Convert and validate the device handle */
182
184 if (!Node ||
185 ((Node->Type != ACPI_TYPE_DEVICE) &&
186 (Node->Type != ACPI_TYPE_PROCESSOR) &&
187 (Node->Type != ACPI_TYPE_THERMAL) &&
188 (Node != AcpiGbl_RootNode)))
189 {
191 goto UnlockAndExit;
192 }
193
194 /* Make sure the internal object exists */
195
196 ObjDesc = AcpiNsGetAttachedObject (Node);
197 if (!ObjDesc)
198 {
200 goto UnlockAndExit;
201 }
202
203 /* Find the address handler the user requested */
204
205 HandlerObj = ObjDesc->CommonNotify.Handler;
206 LastObjPtr = &ObjDesc->CommonNotify.Handler;
207 while (HandlerObj)
208 {
209 /* We have a handler, see if user requested this one */
210
211 if (HandlerObj->AddressSpace.SpaceId == SpaceId)
212 {
213 /* Handler must be the same as the installed handler */
214
215 if (HandlerObj->AddressSpace.Handler != Handler)
216 {
218 goto UnlockAndExit;
219 }
220
221 /* Matched SpaceId, first dereference this in the Regions */
222
224 "Removing address handler %p(%p) for region %s "
225 "on Device %p(%p)\n",
226 HandlerObj, Handler, AcpiUtGetRegionName (SpaceId),
227 Node, ObjDesc));
228
229 RegionObj = HandlerObj->AddressSpace.RegionList;
230
231 /* Walk the handler's region list */
232
233 while (RegionObj)
234 {
235 /*
236 * First disassociate the handler from the region.
237 *
238 * NOTE: this doesn't mean that the region goes away
239 * The region is just inaccessible as indicated to
240 * the _REG method
241 */
242 AcpiEvDetachRegion (RegionObj, TRUE);
243
244 /*
245 * Walk the list: Just grab the head because the
246 * DetachRegion removed the previous head.
247 */
248 RegionObj = HandlerObj->AddressSpace.RegionList;
249 }
250
251 /* Remove this Handler object from the list */
252
253 *LastObjPtr = HandlerObj->AddressSpace.Next;
254
255 /* Now we can delete the handler object */
256
258 AcpiUtRemoveReference (HandlerObj);
259 goto UnlockAndExit;
260 }
261
262 /* Walk the linked list of handlers */
263
264 LastObjPtr = &HandlerObj->AddressSpace.Next;
265 HandlerObj = HandlerObj->AddressSpace.Next;
266 }
267
268 /* The handler does not exist */
269
271 "Unable to remove address handler %p for %s(%X), DevNode %p, obj %p\n",
273
275
276UnlockAndExit:
279}
#define AE_NOT_EXIST
Definition: acexcep.h:114
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_DB_OPREGION
Definition: acoutput.h:167
#define ACPI_TYPE_PROCESSOR
Definition: actypes.h:699
#define AcpiOsReleaseMutex(Handle)
Definition: actypes.h:277
#define ACPI_TYPE_DEVICE
Definition: actypes.h:693
#define ACPI_TYPE_THERMAL
Definition: actypes.h:700
const char * AcpiUtGetRegionName(UINT8 SpaceId)
Definition: utdecode.c:125
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:790
#define TRUE
Definition: types.h:120
void AcpiEvDetachRegion(ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsIsLocked)
Definition: evregion.c:398
ACPI_STATUS AcpiRemoveAddressSpaceHandler(ACPI_HANDLE Device, ACPI_ADR_SPACE_TYPE SpaceId, ACPI_ADR_SPACE_HANDLER Handler)
Definition: evxfregn.c:152
union acpi_operand_object * RegionList
Definition: acobject.h:419
ACPI_OBJECT_COMMON_HEADER UINT8 SpaceId
Definition: acobject.h:412
ACPI_ADR_SPACE_HANDLER Handler
Definition: acobject.h:414
ACPI_MUTEX ContextMutex
Definition: acobject.h:417
union acpi_operand_object * Next
Definition: acobject.h:420
ACPI_OBJECT_ADDR_HANDLER AddressSpace
Definition: acobject.h:539
ACPI_OBJECT_NOTIFY_COMMON CommonNotify
Definition: acobject.h:528

Referenced by AcpiRemoveAddressSpaceHandler().