ReactOS  0.4.15-dev-1070-ge1a01de
exresnte.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
Include dependency graph for exresnte.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_EXECUTER
 

Functions

ACPI_STATUS AcpiExResolveNodeToValue (ACPI_NAMESPACE_NODE **ObjectPtr, ACPI_WALK_STATE *WalkState)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_EXECUTER

Definition at line 51 of file exresnte.c.

Function Documentation

◆ AcpiExResolveNodeToValue()

ACPI_STATUS AcpiExResolveNodeToValue ( ACPI_NAMESPACE_NODE **  ObjectPtr,
ACPI_WALK_STATE WalkState 
)

Definition at line 82 of file exresnte.c.

86 {
88  ACPI_OPERAND_OBJECT *SourceDesc;
89  ACPI_OPERAND_OBJECT *ObjDesc = NULL;
91  ACPI_OBJECT_TYPE EntryType;
92 
93 
94  ACPI_FUNCTION_TRACE (ExResolveNodeToValue);
95 
96 
97  /*
98  * The stack pointer points to a ACPI_NAMESPACE_NODE (Node). Get the
99  * object that is attached to the Node.
100  */
101  Node = *ObjectPtr;
102  SourceDesc = AcpiNsGetAttachedObject (Node);
103  EntryType = AcpiNsGetType ((ACPI_HANDLE) Node);
104 
105  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n",
106  Node, SourceDesc, AcpiUtGetTypeName (EntryType)));
107 
108  if ((EntryType == ACPI_TYPE_LOCAL_ALIAS) ||
109  (EntryType == ACPI_TYPE_LOCAL_METHOD_ALIAS))
110  {
111  /* There is always exactly one level of indirection */
112 
114  SourceDesc = AcpiNsGetAttachedObject (Node);
115  EntryType = AcpiNsGetType ((ACPI_HANDLE) Node);
116  *ObjectPtr = Node;
117  }
118 
119  /*
120  * Several object types require no further processing:
121  * 1) Device/Thermal objects don't have a "real" subobject, return Node
122  * 2) Method locals and arguments have a pseudo-Node
123  * 3) 10/2007: Added method type to assist with Package construction.
124  */
125  if ((EntryType == ACPI_TYPE_DEVICE) ||
126  (EntryType == ACPI_TYPE_THERMAL) ||
127  (EntryType == ACPI_TYPE_METHOD) ||
129  {
131  }
132 
133  if (!SourceDesc)
134  {
135  ACPI_ERROR ((AE_INFO, "No object attached to node [%4.4s] %p",
136  Node->Name.Ascii, Node));
138  }
139 
140  /*
141  * Action is based on the type of the Node, which indicates the type
142  * of the attached object or pointer
143  */
144  switch (EntryType)
145  {
146  case ACPI_TYPE_PACKAGE:
147 
148  if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE)
149  {
150  ACPI_ERROR ((AE_INFO, "Object not a Package, type %s",
151  AcpiUtGetObjectTypeName (SourceDesc)));
153  }
154 
155  Status = AcpiDsGetPackageArguments (SourceDesc);
156  if (ACPI_SUCCESS (Status))
157  {
158  /* Return an additional reference to the object */
159 
160  ObjDesc = SourceDesc;
161  AcpiUtAddReference (ObjDesc);
162  }
163  break;
164 
165  case ACPI_TYPE_BUFFER:
166 
167  if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)
168  {
169  ACPI_ERROR ((AE_INFO, "Object not a Buffer, type %s",
170  AcpiUtGetObjectTypeName (SourceDesc)));
172  }
173 
174  Status = AcpiDsGetBufferArguments (SourceDesc);
175  if (ACPI_SUCCESS (Status))
176  {
177  /* Return an additional reference to the object */
178 
179  ObjDesc = SourceDesc;
180  AcpiUtAddReference (ObjDesc);
181  }
182  break;
183 
184  case ACPI_TYPE_STRING:
185 
186  if (SourceDesc->Common.Type != ACPI_TYPE_STRING)
187  {
188  ACPI_ERROR ((AE_INFO, "Object not a String, type %s",
189  AcpiUtGetObjectTypeName (SourceDesc)));
191  }
192 
193  /* Return an additional reference to the object */
194 
195  ObjDesc = SourceDesc;
196  AcpiUtAddReference (ObjDesc);
197  break;
198 
199  case ACPI_TYPE_INTEGER:
200 
201  if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER)
202  {
203  ACPI_ERROR ((AE_INFO, "Object not a Integer, type %s",
204  AcpiUtGetObjectTypeName (SourceDesc)));
206  }
207 
208  /* Return an additional reference to the object */
209 
210  ObjDesc = SourceDesc;
211  AcpiUtAddReference (ObjDesc);
212  break;
213 
218 
220  "FieldRead Node=%p SourceDesc=%p Type=%X\n",
221  Node, SourceDesc, EntryType));
222 
223  Status = AcpiExReadDataFromField (WalkState, SourceDesc, &ObjDesc);
224  break;
225 
226  /* For these objects, just return the object attached to the Node */
227 
228  case ACPI_TYPE_MUTEX:
229  case ACPI_TYPE_POWER:
230  case ACPI_TYPE_PROCESSOR:
231  case ACPI_TYPE_EVENT:
232  case ACPI_TYPE_REGION:
233 
234  /* Return an additional reference to the object */
235 
236  ObjDesc = SourceDesc;
237  AcpiUtAddReference (ObjDesc);
238  break;
239 
240  /* TYPE_ANY is untyped, and thus there is no object associated with it */
241 
242  case ACPI_TYPE_ANY:
243 
245  "Untyped entry %p, no attached object!", Node));
246 
247  return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
248 
250 
251  switch (SourceDesc->Reference.Class)
252  {
253  case ACPI_REFCLASS_TABLE: /* This is a DdbHandle */
254  case ACPI_REFCLASS_REFOF:
255  case ACPI_REFCLASS_INDEX:
256 
257  /* Return an additional reference to the object */
258 
259  ObjDesc = SourceDesc;
260  AcpiUtAddReference (ObjDesc);
261  break;
262 
263  default:
264 
265  /* No named references are allowed here */
266 
268  "Unsupported Reference type 0x%X",
269  SourceDesc->Reference.Class));
270 
272  }
273  break;
274 
275  default:
276 
277  /* Default case is for unknown types */
278 
280  "Node %p - Unknown object type 0x%X",
281  Node, EntryType));
282 
284 
285  } /* switch (EntryType) */
286 
287 
288  /* Return the object descriptor */
289 
290  *ObjectPtr = (void *) ObjDesc;
292 }
void AcpiUtAddReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:747
#define ACPI_TYPE_EVENT
Definition: actypes.h:686
#define ACPI_TYPE_LOCAL_ALIAS
Definition: actypes.h:712
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define ACPI_TYPE_THERMAL
Definition: actypes.h:692
#define ACPI_TYPE_BUFFER
Definition: actypes.h:682
#define ACPI_TYPE_INTEGER
Definition: actypes.h:680
#define ACPI_TYPE_POWER
Definition: actypes.h:690
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:711
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_STATUS AcpiDsGetBufferArguments(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: dsargs.c:294
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
#define ACPI_TYPE_LOCAL_INDEX_FIELD
Definition: actypes.h:710
ACPI_OBJECT_TYPE AcpiNsGetType(ACPI_NAMESPACE_NODE *Node)
Definition: nsutils.c:120
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:683
ACPI_OBJECT_COMMON_HEADER UINT8 Class
Definition: acobject.h:441
union node Node
Definition: types.h:1255
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_TYPE_LOCAL_METHOD_ALIAS
Definition: actypes.h:713
UINT32 ACPI_OBJECT_TYPE
Definition: actypes.h:677
ACPI_OBJECT_REFERENCE Reference
Definition: acobject.h:538
#define ANOBJ_METHOD_ARG
Definition: aclocal.h:217
#define ACPI_TYPE_METHOD
Definition: actypes.h:687
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
#define ACPI_TYPE_LOCAL_REGION_FIELD
Definition: actypes.h:708
Status
Definition: gdiplustypes.h:24
#define ACPI_TYPE_ANY
Definition: actypes.h:679
#define AE_AML_UNINITIALIZED_NODE
Definition: acexcep.h:213
#define ACPI_TYPE_DEVICE
Definition: actypes.h:685
#define ACPI_TYPE_PROCESSOR
Definition: actypes.h:691
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define ANOBJ_METHOD_LOCAL
Definition: aclocal.h:218
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_TYPE_BUFFER_FIELD
Definition: actypes.h:693
ACPI_OBJECT_COMMON Common
Definition: acobject.h:517
const char * AcpiUtGetTypeName(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:250
ACPI_STATUS AcpiDsGetPackageArguments(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: dsargs.c:344
#define ACPI_TYPE_MUTEX
Definition: actypes.h:688
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_TYPE_REGION
Definition: actypes.h:689
#define ACPI_TYPE_LOCAL_BANK_FIELD
Definition: actypes.h:709
#define ACPI_TYPE_STRING
Definition: actypes.h:681
ACPI_STATUS AcpiExReadDataFromField(ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **RetBufferDesc)
Definition: exfield.c:147
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
const char * AcpiUtGetObjectTypeName(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: utdecode.c:264
#define AE_OK
Definition: acexcep.h:97
Definition: dlist.c:348

Referenced by AcpiDsResolvePackageElement(), AcpiExOpcode_1A_0T_1R(), AcpiExResolveToValue(), and AcpiNsEvaluate().