ReactOS  0.4.14-dev-297-g23e575c
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 
129 UnlockAndExit:
132 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE ACPI_ADR_SPACE_HANDLER ACPI_ADR_SPACE_SETUP Setup
Definition: acpixf.h:822
#define ACPI_REG_CONNECT
Definition: actypes.h:879
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE SpaceId
Definition: acpixf.h:822
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
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
union node Node
Definition: types.h:1255
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
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:662
Status
Definition: gdiplustypes.h:24
void AcpiEvExecuteRegMethods(ACPI_NAMESPACE_NODE *Node, ACPI_ADR_SPACE_TYPE SpaceId, UINT32 Function)
Definition: evregion.c:723
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_NAMESPACE_NODE * AcpiNsValidateHandle(ACPI_HANDLE Handle)
Definition: nsutils.c:655
#define ACPI_MTX_NAMESPACE
Definition: aclocal.h:85
Definition: dlist.c:348

Referenced by AcpiEvPciConfigRegionSetup().

◆ 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 
257  AcpiUtRemoveReference (HandlerObj);
258  goto UnlockAndExit;
259  }
260 
261  /* Walk the linked list of handlers */
262 
263  LastObjPtr = &HandlerObj->AddressSpace.Next;
264  HandlerObj = HandlerObj->AddressSpace.Next;
265  }
266 
267  /* The handler does not exist */
268 
270  "Unable to remove address handler %p for %s(%X), DevNode %p, obj %p\n",
272 
274 
275 UnlockAndExit:
278 }
#define TRUE
Definition: types.h:120
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define ACPI_TYPE_THERMAL
Definition: actypes.h:691
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
union acpi_operand_object * RegionList
Definition: acobject.h:416
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE SpaceId
Definition: acpixf.h:822
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
const char * AcpiUtGetRegionName(UINT8 SpaceId)
Definition: utdecode.c:124
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
union node Node
Definition: types.h:1255
void AcpiEvDetachRegion(ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsIsLocked)
Definition: evregion.c:360
union acpi_operand_object * Next
Definition: acobject.h:417
#define ACPI_DB_OPREGION
Definition: acoutput.h:167
ACPI_ADR_SPACE_HANDLER Handler
Definition: acobject.h:412
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
ACPI_STATUS AcpiRemoveAddressSpaceHandler(ACPI_HANDLE Device, ACPI_ADR_SPACE_TYPE SpaceId, ACPI_ADR_SPACE_HANDLER Handler)
Definition: evxfregn.c:152
#define AE_NOT_EXIST
Definition: acexcep.h:114
ACPI_OBJECT_ADDR_HANDLER AddressSpace
Definition: acobject.h:536
#define ACPI_TYPE_DEVICE
Definition: actypes.h:684
#define ACPI_TYPE_PROCESSOR
Definition: actypes.h:690
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:662
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_OBJECT_COMMON_HEADER UINT8 SpaceId
Definition: acobject.h:410
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
ACPI_OBJECT_NOTIFY_COMMON CommonNotify
Definition: acobject.h:525
ACPI_NAMESPACE_NODE * AcpiNsValidateHandle(ACPI_HANDLE Handle)
Definition: nsutils.c:655
#define ACPI_MTX_NAMESPACE
Definition: aclocal.h:85
Definition: dlist.c:348