ReactOS  0.4.14-dev-368-gfa26425
acnamesp.h File Reference

Go to the source code of this file.

Macros

#define ACPI_NS_ALL   ((ACPI_HANDLE)0)
 
#define ACPI_NS_NORMAL   0
 
#define ACPI_NS_NEWSCOPE   1 /* a definition of this type opens a name scope */
 
#define ACPI_NS_LOCAL   2 /* suppress search of enclosing scopes */
 
#define ACPI_NS_NO_UPSEARCH   0
 
#define ACPI_NS_SEARCH_PARENT   0x0001
 
#define ACPI_NS_DONT_OPEN_SCOPE   0x0002
 
#define ACPI_NS_NO_PEER_SEARCH   0x0004
 
#define ACPI_NS_ERROR_IF_FOUND   0x0008
 
#define ACPI_NS_PREFIX_IS_SCOPE   0x0010
 
#define ACPI_NS_EXTERNAL   0x0020
 
#define ACPI_NS_TEMPORARY   0x0040
 
#define ACPI_NS_OVERRIDE_IF_FOUND   0x0080
 
#define ACPI_NS_EARLY_INIT   0x0100
 
#define ACPI_NS_PREFIX_MUST_EXIST   0x0200
 
#define ACPI_NS_WALK_NO_UNLOCK   0
 
#define ACPI_NS_WALK_UNLOCK   0x01
 
#define ACPI_NS_WALK_TEMP_NODES   0x02
 
#define ACPI_NOT_PACKAGE_ELEMENT   ACPI_UINT32_MAX
 
#define ACPI_ALL_PACKAGE_ELEMENTS   (ACPI_UINT32_MAX-1)
 
#define ACPI_WARN_ALWAYS   0
 

Functions

ACPI_STATUS AcpiNsInitializeObjects (void)
 
ACPI_STATUS AcpiNsInitializeDevices (UINT32 Flags)
 
ACPI_STATUS AcpiNsInitOnePackage (ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue)
 
ACPI_STATUS AcpiNsLoadNamespace (void)
 
ACPI_STATUS AcpiNsLoadTable (UINT32 TableIndex, ACPI_NAMESPACE_NODE *Node)
 
ACPI_STATUS AcpiNsWalkNamespace (ACPI_OBJECT_TYPE Type, ACPI_HANDLE StartObject, UINT32 MaxDepth, UINT32 Flags, ACPI_WALK_CALLBACK DescendingCallback, ACPI_WALK_CALLBACK AscendingCallback, void *Context, void **ReturnValue)
 
ACPI_NAMESPACE_NODEAcpiNsGetNextNode (ACPI_NAMESPACE_NODE *Parent, ACPI_NAMESPACE_NODE *Child)
 
ACPI_NAMESPACE_NODEAcpiNsGetNextNodeTyped (ACPI_OBJECT_TYPE Type, ACPI_NAMESPACE_NODE *Parent, ACPI_NAMESPACE_NODE *Child)
 
ACPI_STATUS AcpiNsParseTable (UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode)
 
ACPI_STATUS AcpiNsExecuteTable (UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode)
 
ACPI_STATUS AcpiNsOneCompleteParse (UINT32 PassNumber, UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode)
 
ACPI_STATUS AcpiNsRootInitialize (void)
 
ACPI_STATUS AcpiNsLookup (ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
 
ACPI_NAMESPACE_NODEAcpiNsCreateNode (UINT32 Name)
 
void AcpiNsDeleteNode (ACPI_NAMESPACE_NODE *Node)
 
void AcpiNsRemoveNode (ACPI_NAMESPACE_NODE *Node)
 
void AcpiNsDeleteNamespaceSubtree (ACPI_NAMESPACE_NODE *ParentHandle)
 
void AcpiNsDeleteNamespaceByOwner (ACPI_OWNER_ID OwnerId)
 
void AcpiNsDetachObject (ACPI_NAMESPACE_NODE *Node)
 
void AcpiNsDeleteChildren (ACPI_NAMESPACE_NODE *Parent)
 
int AcpiNsCompareNames (char *Name1, char *Name2)
 
ACPI_STATUS AcpiNsConvertToInteger (ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ReturnObject)
 
ACPI_STATUS AcpiNsConvertToString (ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ReturnObject)
 
ACPI_STATUS AcpiNsConvertToBuffer (ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ReturnObject)
 
ACPI_STATUS AcpiNsConvertToUnicode (ACPI_NAMESPACE_NODE *Scope, ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ReturnObject)
 
ACPI_STATUS AcpiNsConvertToResource (ACPI_NAMESPACE_NODE *Scope, ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ReturnObject)
 
ACPI_STATUS AcpiNsConvertToReference (ACPI_NAMESPACE_NODE *Scope, ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ReturnObject)
 
void AcpiNsDumpTables (ACPI_HANDLE SearchBase, UINT32 MaxDepth)
 
void AcpiNsDumpEntry (ACPI_HANDLE Handle, UINT32 DebugLevel)
 
void AcpiNsDumpPathname (ACPI_HANDLE Handle, const char *Msg, UINT32 Level, UINT32 Component)
 
void AcpiNsPrintPathname (UINT32 NumSegments, const char *Pathname)
 
ACPI_STATUS AcpiNsDumpOneObject (ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue)
 
void AcpiNsDumpObjects (ACPI_OBJECT_TYPE Type, UINT8 DisplayType, UINT32 MaxDepth, ACPI_OWNER_ID OwnerId, ACPI_HANDLE StartHandle)
 
void AcpiNsDumpObjectPaths (ACPI_OBJECT_TYPE Type, UINT8 DisplayType, UINT32 MaxDepth, ACPI_OWNER_ID OwnerId, ACPI_HANDLE StartHandle)
 
ACPI_STATUS AcpiNsEvaluate (ACPI_EVALUATE_INFO *Info)
 
void AcpiNsCheckArgumentCount (char *Pathname, ACPI_NAMESPACE_NODE *Node, UINT32 UserParamCount, const ACPI_PREDEFINED_INFO *Info)
 
void AcpiNsCheckAcpiCompliance (char *Pathname, ACPI_NAMESPACE_NODE *Node, const ACPI_PREDEFINED_INFO *Predefined)
 
void AcpiNsCheckArgumentTypes (ACPI_EVALUATE_INFO *Info)
 
ACPI_STATUS AcpiNsCheckReturnValue (ACPI_NAMESPACE_NODE *Node, ACPI_EVALUATE_INFO *Info, UINT32 UserParamCount, ACPI_STATUS ReturnStatus, ACPI_OPERAND_OBJECT **ReturnObject)
 
ACPI_STATUS AcpiNsCheckObjectType (ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr, UINT32 ExpectedBtypes, UINT32 PackageIndex)
 
ACPI_STATUS AcpiNsCheckPackage (ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr)
 
UINT32 AcpiNsOpensScope (ACPI_OBJECT_TYPE Type)
 
charAcpiNsGetExternalPathname (ACPI_NAMESPACE_NODE *Node)
 
UINT32 AcpiNsBuildNormalizedPath (ACPI_NAMESPACE_NODE *Node, char *FullPath, UINT32 PathSize, BOOLEAN NoTrailing)
 
charAcpiNsGetNormalizedPathname (ACPI_NAMESPACE_NODE *Node, BOOLEAN NoTrailing)
 
charAcpiNsBuildPrefixedPathname (ACPI_GENERIC_STATE *PrefixScope, const char *InternalPath)
 
charAcpiNsNameOfCurrentScope (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiNsHandleToName (ACPI_HANDLE TargetHandle, ACPI_BUFFER *Buffer)
 
ACPI_STATUS AcpiNsHandleToPathname (ACPI_HANDLE TargetHandle, ACPI_BUFFER *Buffer, BOOLEAN NoTrailing)
 
BOOLEAN AcpiNsPatternMatch (ACPI_NAMESPACE_NODE *ObjNode, char *SearchFor)
 
ACPI_STATUS AcpiNsGetNodeUnlocked (ACPI_NAMESPACE_NODE *PrefixNode, const char *ExternalPathname, UINT32 Flags, ACPI_NAMESPACE_NODE **OutNode)
 
ACPI_STATUS AcpiNsGetNode (ACPI_NAMESPACE_NODE *PrefixNode, const char *ExternalPathname, UINT32 Flags, ACPI_NAMESPACE_NODE **OutNode)
 
ACPI_SIZE AcpiNsGetPathnameLength (ACPI_NAMESPACE_NODE *Node)
 
ACPI_STATUS AcpiNsAttachObject (ACPI_NAMESPACE_NODE *Node, ACPI_OPERAND_OBJECT *Object, ACPI_OBJECT_TYPE Type)
 
ACPI_OPERAND_OBJECTAcpiNsGetAttachedObject (ACPI_NAMESPACE_NODE *Node)
 
ACPI_OPERAND_OBJECTAcpiNsGetSecondaryObject (ACPI_OPERAND_OBJECT *ObjDesc)
 
ACPI_STATUS AcpiNsAttachData (ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_HANDLER Handler, void *Data)
 
ACPI_STATUS AcpiNsDetachData (ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_HANDLER Handler)
 
ACPI_STATUS AcpiNsGetAttachedData (ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_HANDLER Handler, void **Data)
 
ACPI_STATUS AcpiNsSimpleRepair (ACPI_EVALUATE_INFO *Info, UINT32 ExpectedBtypes, UINT32 PackageIndex, ACPI_OPERAND_OBJECT **ReturnObjectPtr)
 
ACPI_STATUS AcpiNsWrapWithPackage (ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ObjDescPtr)
 
ACPI_STATUS AcpiNsRepairNullElement (ACPI_EVALUATE_INFO *Info, UINT32 ExpectedBtypes, UINT32 PackageIndex, ACPI_OPERAND_OBJECT **ReturnObjectPtr)
 
void AcpiNsRemoveNullElements (ACPI_EVALUATE_INFO *Info, UINT8 PackageType, ACPI_OPERAND_OBJECT *ObjDesc)
 
ACPI_STATUS AcpiNsComplexRepairs (ACPI_EVALUATE_INFO *Info, ACPI_NAMESPACE_NODE *Node, ACPI_STATUS ValidateStatus, ACPI_OPERAND_OBJECT **ReturnObjectPtr)
 
ACPI_STATUS AcpiNsSearchAndEnter (UINT32 EntryName, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE *Node, ACPI_INTERPRETER_MODE InterpreterMode, ACPI_OBJECT_TYPE Type, UINT32 Flags, ACPI_NAMESPACE_NODE **RetNode)
 
ACPI_STATUS AcpiNsSearchOneScope (UINT32 EntryName, ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_TYPE Type, ACPI_NAMESPACE_NODE **RetNode)
 
void AcpiNsInstallNode (ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE *ParentNode, ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_TYPE Type)
 
ACPI_OBJECT_TYPE AcpiNsGetType (ACPI_NAMESPACE_NODE *Node)
 
UINT32 AcpiNsLocal (ACPI_OBJECT_TYPE Type)
 
void AcpiNsPrintNodePathname (ACPI_NAMESPACE_NODE *Node, const char *Msg)
 
ACPI_STATUS AcpiNsBuildInternalName (ACPI_NAMESTRING_INFO *Info)
 
void AcpiNsGetInternalNameLength (ACPI_NAMESTRING_INFO *Info)
 
ACPI_STATUS AcpiNsInternalizeName (const char *DottedName, char **ConvertedName)
 
ACPI_STATUS AcpiNsExternalizeName (UINT32 InternalNameLength, const char *InternalName, UINT32 *ConvertedNameLength, char **ConvertedName)
 
ACPI_NAMESPACE_NODEAcpiNsValidateHandle (ACPI_HANDLE Handle)
 
void AcpiNsTerminate (void)
 

Macro Definition Documentation

◆ ACPI_ALL_PACKAGE_ELEMENTS

#define ACPI_ALL_PACKAGE_ELEMENTS   (ACPI_UINT32_MAX-1)

Definition at line 83 of file acnamesp.h.

◆ ACPI_NOT_PACKAGE_ELEMENT

#define ACPI_NOT_PACKAGE_ELEMENT   ACPI_UINT32_MAX

Definition at line 82 of file acnamesp.h.

◆ ACPI_NS_ALL

#define ACPI_NS_ALL   ((ACPI_HANDLE)0)

Definition at line 50 of file acnamesp.h.

◆ ACPI_NS_DONT_OPEN_SCOPE

#define ACPI_NS_DONT_OPEN_SCOPE   0x0002

Definition at line 64 of file acnamesp.h.

◆ ACPI_NS_EARLY_INIT

#define ACPI_NS_EARLY_INIT   0x0100

Definition at line 71 of file acnamesp.h.

◆ ACPI_NS_ERROR_IF_FOUND

#define ACPI_NS_ERROR_IF_FOUND   0x0008

Definition at line 66 of file acnamesp.h.

◆ ACPI_NS_EXTERNAL

#define ACPI_NS_EXTERNAL   0x0020

Definition at line 68 of file acnamesp.h.

◆ ACPI_NS_LOCAL

#define ACPI_NS_LOCAL   2 /* suppress search of enclosing scopes */

Definition at line 58 of file acnamesp.h.

◆ ACPI_NS_NEWSCOPE

#define ACPI_NS_NEWSCOPE   1 /* a definition of this type opens a name scope */

Definition at line 57 of file acnamesp.h.

◆ ACPI_NS_NO_PEER_SEARCH

#define ACPI_NS_NO_PEER_SEARCH   0x0004

Definition at line 65 of file acnamesp.h.

◆ ACPI_NS_NO_UPSEARCH

#define ACPI_NS_NO_UPSEARCH   0

Definition at line 62 of file acnamesp.h.

◆ ACPI_NS_NORMAL

#define ACPI_NS_NORMAL   0

Definition at line 56 of file acnamesp.h.

◆ ACPI_NS_OVERRIDE_IF_FOUND

#define ACPI_NS_OVERRIDE_IF_FOUND   0x0080

Definition at line 70 of file acnamesp.h.

◆ ACPI_NS_PREFIX_IS_SCOPE

#define ACPI_NS_PREFIX_IS_SCOPE   0x0010

Definition at line 67 of file acnamesp.h.

◆ ACPI_NS_PREFIX_MUST_EXIST

#define ACPI_NS_PREFIX_MUST_EXIST   0x0200

Definition at line 72 of file acnamesp.h.

◆ ACPI_NS_SEARCH_PARENT

#define ACPI_NS_SEARCH_PARENT   0x0001

Definition at line 63 of file acnamesp.h.

◆ ACPI_NS_TEMPORARY

#define ACPI_NS_TEMPORARY   0x0040

Definition at line 69 of file acnamesp.h.

◆ ACPI_NS_WALK_NO_UNLOCK

#define ACPI_NS_WALK_NO_UNLOCK   0

Definition at line 76 of file acnamesp.h.

◆ ACPI_NS_WALK_TEMP_NODES

#define ACPI_NS_WALK_TEMP_NODES   0x02

Definition at line 78 of file acnamesp.h.

◆ ACPI_NS_WALK_UNLOCK

#define ACPI_NS_WALK_UNLOCK   0x01

Definition at line 77 of file acnamesp.h.

◆ ACPI_WARN_ALWAYS

#define ACPI_WARN_ALWAYS   0

Definition at line 87 of file acnamesp.h.

Function Documentation

◆ AcpiNsAttachData()

ACPI_STATUS AcpiNsAttachData ( ACPI_NAMESPACE_NODE Node,
ACPI_OBJECT_HANDLER  Handler,
void Data 
)

Definition at line 379 of file nsobject.c.

383 {
384  ACPI_OPERAND_OBJECT *PrevObjDesc;
385  ACPI_OPERAND_OBJECT *ObjDesc;
386  ACPI_OPERAND_OBJECT *DataDesc;
387 
388 
389  /* We only allow one attachment per handler */
390 
391  PrevObjDesc = NULL;
392  ObjDesc = Node->Object;
393  while (ObjDesc)
394  {
395  if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
396  (ObjDesc->Data.Handler == Handler))
397  {
398  return (AE_ALREADY_EXISTS);
399  }
400 
401  PrevObjDesc = ObjDesc;
402  ObjDesc = ObjDesc->Common.NextObject;
403  }
404 
405  /* Create an internal object for the data */
406 
408  if (!DataDesc)
409  {
410  return (AE_NO_MEMORY);
411  }
412 
413  DataDesc->Data.Handler = Handler;
414  DataDesc->Data.Pointer = Data;
415 
416  /* Install the data object */
417 
418  if (PrevObjDesc)
419  {
420  PrevObjDesc->Common.NextObject = DataDesc;
421  }
422  else
423  {
424  Node->Object = DataDesc;
425  }
426 
427  return (AE_OK);
428 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
ACPI_OBJECT_DATA Data
Definition: acobject.h:539
#define ACPI_TYPE_LOCAL_DATA
Definition: actypes.h:727
smooth NULL
Definition: ftsmooth.c:416
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
#define AE_ALREADY_EXISTS
Definition: acexcep.h:115
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:668
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:655
#define AE_OK
Definition: acexcep.h:97
ACPI_OBJECT_COMMON_HEADER ACPI_OBJECT_HANDLER Handler
Definition: acobject.h:492
void * Pointer
Definition: acobject.h:493
Definition: dlist.c:348

Referenced by AcpiAttachData().

◆ AcpiNsAttachObject()

ACPI_STATUS AcpiNsAttachObject ( ACPI_NAMESPACE_NODE Node,
ACPI_OPERAND_OBJECT Object,
ACPI_OBJECT_TYPE  Type 
)

Definition at line 76 of file nsobject.c.

80 {
81  ACPI_OPERAND_OBJECT *ObjDesc;
82  ACPI_OPERAND_OBJECT *LastObjDesc;
84 
85 
86  ACPI_FUNCTION_TRACE (NsAttachObject);
87 
88 
89  /*
90  * Parameter validation
91  */
92  if (!Node)
93  {
94  /* Invalid handle */
95 
96  ACPI_ERROR ((AE_INFO, "Null NamedObj handle"));
98  }
99 
100  if (!Object && (ACPI_TYPE_ANY != Type))
101  {
102  /* Null object */
103 
105  "Null object, but type not ACPI_TYPE_ANY"));
107  }
108 
110  {
111  /* Not a name handle */
112 
113  ACPI_ERROR ((AE_INFO, "Invalid handle %p [%s]",
116  }
117 
118  /* Check if this object is already attached */
119 
120  if (Node->Object == Object)
121  {
123  "Obj %p already installed in NameObj %p\n",
124  Object, Node));
125 
127  }
128 
129  /* If null object, we will just install it */
130 
131  if (!Object)
132  {
133  ObjDesc = NULL;
135  }
136 
137  /*
138  * If the source object is a namespace Node with an attached object,
139  * we will use that (attached) object
140  */
143  {
144  /*
145  * Value passed is a name handle and that name has a
146  * non-null value. Use that name's value and type.
147  */
148  ObjDesc = ((ACPI_NAMESPACE_NODE *) Object)->Object;
149  ObjectType = ((ACPI_NAMESPACE_NODE *) Object)->Type;
150  }
151 
152  /*
153  * Otherwise, we will use the parameter object, but we must type
154  * it first
155  */
156  else
157  {
158  ObjDesc = (ACPI_OPERAND_OBJECT *) Object;
159 
160  /* Use the given type */
161 
162  ObjectType = Type;
163  }
164 
165  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
166  ObjDesc, Node, AcpiUtGetNodeName (Node)));
167 
168  /* Detach an existing attached object if present */
169 
170  if (Node->Object)
171  {
173  }
174 
175  if (ObjDesc)
176  {
177  /*
178  * Must increment the new value's reference count
179  * (if it is an internal object)
180  */
181  AcpiUtAddReference (ObjDesc);
182 
183  /*
184  * Handle objects with multiple descriptors - walk
185  * to the end of the descriptor list
186  */
187  LastObjDesc = ObjDesc;
188  while (LastObjDesc->Common.NextObject)
189  {
190  LastObjDesc = LastObjDesc->Common.NextObject;
191  }
192 
193  /* Install the object at the front of the object list */
194 
195  LastObjDesc->Common.NextObject = Node->Object;
196  }
197 
198  Node->Type = (UINT8) ObjectType;
199  Node->Object = ObjDesc;
200 
202 }
ObjectType
Definition: metafile.c:80
const char * AcpiUtGetDescriptorName(void *Object)
Definition: utdecode.c:381
void AcpiUtAddReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:746
Type
Definition: Type.h:6
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
UINT32 ACPI_OBJECT_TYPE
Definition: actypes.h:676
void AcpiNsDetachObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:220
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
static IUnknown Object
Definition: main.c:512
#define ACPI_TYPE_ANY
Definition: actypes.h:678
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:305
#define ACPI_DESC_TYPE_NAMED
Definition: acobject.h:574
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97
Definition: dlist.c:348
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414

Referenced by AcpiDsCreateBufferField(), AcpiDsCreateNode(), AcpiEvInstallSpaceHandler(), AcpiExCreateEvent(), AcpiExCreateMethod(), AcpiExCreateMutex(), AcpiExCreatePowerResource(), AcpiExCreateProcessor(), AcpiExCreateRegion(), AcpiExPrepFieldValue(), AcpiExStoreDirectToNode(), AcpiExStoreObjectToNode(), AcpiInstallGpeBlock(), AcpiInstallMethod(), AcpiInstallNotifyHandler(), and AcpiNsRootInitialize().

◆ AcpiNsBuildInternalName()

ACPI_STATUS AcpiNsBuildInternalName ( ACPI_NAMESTRING_INFO Info)

Definition at line 267 of file nsutils.c.

269 {
270  UINT32 NumSegments = Info->NumSegments;
271  char *InternalName = Info->InternalName;
272  const char *ExternalName = Info->NextExternalChar;
273  char *Result = NULL;
274  UINT32 i;
275 
276 
277  ACPI_FUNCTION_TRACE (NsBuildInternalName);
278 
279 
280  /* Setup the correct prefixes, counts, and pointers */
281 
282  if (Info->FullyQualified)
283  {
284  InternalName[0] = AML_ROOT_PREFIX;
285 
286  if (NumSegments <= 1)
287  {
288  Result = &InternalName[1];
289  }
290  else if (NumSegments == 2)
291  {
292  InternalName[1] = AML_DUAL_NAME_PREFIX;
293  Result = &InternalName[2];
294  }
295  else
296  {
297  InternalName[1] = AML_MULTI_NAME_PREFIX;
298  InternalName[2] = (char) NumSegments;
299  Result = &InternalName[3];
300  }
301  }
302  else
303  {
304  /*
305  * Not fully qualified.
306  * Handle Carats first, then append the name segments
307  */
308  i = 0;
309  if (Info->NumCarats)
310  {
311  for (i = 0; i < Info->NumCarats; i++)
312  {
313  InternalName[i] = AML_PARENT_PREFIX;
314  }
315  }
316 
317  if (NumSegments <= 1)
318  {
319  Result = &InternalName[i];
320  }
321  else if (NumSegments == 2)
322  {
323  InternalName[i] = AML_DUAL_NAME_PREFIX;
324  Result = &InternalName[(ACPI_SIZE) i+1];
325  }
326  else
327  {
328  InternalName[i] = AML_MULTI_NAME_PREFIX;
329  InternalName[(ACPI_SIZE) i+1] = (char) NumSegments;
330  Result = &InternalName[(ACPI_SIZE) i+2];
331  }
332  }
333 
334  /* Build the name (minus path separators) */
335 
336  for (; NumSegments; NumSegments--)
337  {
338  for (i = 0; i < ACPI_NAMESEG_SIZE; i++)
339  {
340  if (ACPI_IS_PATH_SEPARATOR (*ExternalName) ||
341  (*ExternalName == 0))
342  {
343  /* Pad the segment with underscore(s) if segment is short */
344 
345  Result[i] = '_';
346  }
347  else
348  {
349  /* Convert the character to uppercase and save it */
350 
351  Result[i] = (char) toupper ((int) *ExternalName);
352  ExternalName++;
353  }
354  }
355 
356  /* Now we must have a path separator, or the pathname is bad */
357 
358  if (!ACPI_IS_PATH_SEPARATOR (*ExternalName) &&
359  (*ExternalName != 0))
360  {
362  }
363 
364  /* Move on the next segment */
365 
366  ExternalName++;
368  }
369 
370  /* Terminate the string */
371 
372  *Result = 0;
373 
374  if (Info->FullyQualified)
375  {
376  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (abs) \"\\%s\"\n",
377  InternalName, InternalName));
378  }
379  else
380  {
381  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n",
382  InternalName, InternalName));
383  }
384 
386 }
struct TraceInfo Info
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
#define ACPI_IS_PATH_SEPARATOR(c)
Definition: acmacros.h:403
unsigned int UINT32
#define AE_BAD_PATHNAME
Definition: acexcep.h:153
#define AML_DUAL_NAME_PREFIX
Definition: amlcode.h:66
smooth NULL
Definition: ftsmooth.c:416
unsigned char
Definition: typeof.h:29
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
int toupper(int c)
Definition: utclib.c:881
#define AML_PARENT_PREFIX
Definition: amlcode.h:70
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define AML_ROOT_PREFIX
Definition: amlcode.h:69
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define AML_MULTI_NAME_PREFIX
Definition: amlcode.h:67
#define ACPI_NAMESEG_SIZE
Definition: actypes.h:415
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiNsInternalizeName().

◆ AcpiNsBuildNormalizedPath()

UINT32 AcpiNsBuildNormalizedPath ( ACPI_NAMESPACE_NODE Node,
char FullPath,
UINT32  PathSize,
BOOLEAN  NoTrailing 
)

Definition at line 262 of file nsnames.c.

267 {
268  UINT32 Length = 0, i;
269  char Name[ACPI_NAMESEG_SIZE];
270  BOOLEAN DoNoTrailing;
271  char c, *Left, *Right;
272  ACPI_NAMESPACE_NODE *NextNode;
273 
274 
275  ACPI_FUNCTION_TRACE_PTR (NsBuildNormalizedPath, Node);
276 
277 
278 #define ACPI_PATH_PUT8(Path, Size, Byte, Length) \
279  do { \
280  if ((Length) < (Size)) \
281  { \
282  (Path)[(Length)] = (Byte); \
283  } \
284  (Length)++; \
285  } while (0)
286 
287  /*
288  * Make sure the PathSize is correct, so that we don't need to
289  * validate both FullPath and PathSize.
290  */
291  if (!FullPath)
292  {
293  PathSize = 0;
294  }
295 
296  if (!Node)
297  {
298  goto BuildTrailingNull;
299  }
300 
301  NextNode = Node;
302  while (NextNode && NextNode != AcpiGbl_RootNode)
303  {
304  if (NextNode != Node)
305  {
306  ACPI_PATH_PUT8(FullPath, PathSize, AML_DUAL_NAME_PREFIX, Length);
307  }
308 
309  ACPI_MOVE_32_TO_32 (Name, &NextNode->Name);
310  DoNoTrailing = NoTrailing;
311  for (i = 0; i < 4; i++)
312  {
313  c = Name[4-i-1];
314  if (DoNoTrailing && c != '_')
315  {
316  DoNoTrailing = FALSE;
317  }
318  if (!DoNoTrailing)
319  {
320  ACPI_PATH_PUT8(FullPath, PathSize, c, Length);
321  }
322  }
323 
324  NextNode = NextNode->Parent;
325  }
326 
327  ACPI_PATH_PUT8(FullPath, PathSize, AML_ROOT_PREFIX, Length);
328 
329  /* Reverse the path string */
330 
331  if (Length <= PathSize)
332  {
333  Left = FullPath;
334  Right = FullPath+Length - 1;
335 
336  while (Left < Right)
337  {
338  c = *Left;
339  *Left++ = *Right;
340  *Right-- = c;
341  }
342  }
343 
344  /* Append the trailing null */
345 
346 BuildTrailingNull:
347  ACPI_PATH_PUT8 (FullPath, PathSize, '\0', Length);
348 
349 #undef ACPI_PATH_PUT8
350 
352 }
#define return_UINT32(s)
Definition: acoutput.h:501
struct acpi_namespace_node * Parent
Definition: aclocal.h:192
#define ACPI_PATH_PUT8(Path, Size, Byte, Length)
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
unsigned int UINT32
union node Node
Definition: types.h:1255
#define AML_DUAL_NAME_PREFIX
Definition: amlcode.h:66
unsigned char BOOLEAN
ACPI_NAME_UNION Name
Definition: aclocal.h:191
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
const GLubyte * c
Definition: glext.h:8905
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define AML_ROOT_PREFIX
Definition: amlcode.h:69
#define ACPI_MOVE_32_TO_32(d, s)
Definition: acmacros.h:148
#define c
Definition: ke_i.h:80
#define ACPI_NAMESEG_SIZE
Definition: actypes.h:415
Definition: dlist.c:348

Referenced by AcpiNsGetNormalizedPathname(), AcpiNsGetPathnameLength(), and AcpiNsHandleToPathname().

◆ AcpiNsBuildPrefixedPathname()

char* AcpiNsBuildPrefixedPathname ( ACPI_GENERIC_STATE PrefixScope,
const char InternalPath 
)

Definition at line 429 of file nsnames.c.

432 {
434  char *FullPath = NULL;
435  char *ExternalPath = NULL;
436  char *PrefixPath = NULL;
437  SIZE_T PrefixPathLength = 0;
438 
439 
440  /* If there is a prefix, get the pathname to it */
441 
442  if (PrefixScope && PrefixScope->Scope.Node)
443  {
444  PrefixPath = AcpiNsGetNormalizedPathname (PrefixScope->Scope.Node, TRUE);
445  if (PrefixPath)
446  {
447  PrefixPathLength = strlen (PrefixPath);
448  }
449  }
450 
452  NULL, &ExternalPath);
453  if (ACPI_FAILURE (Status))
454  {
455  goto Cleanup;
456  }
457 
458  /* Merge the prefix path and the path. 2 is for one dot and trailing null */
459 
460  FullPath = ACPI_ALLOCATE_ZEROED (
461  PrefixPathLength + strlen (ExternalPath) + 2);
462  if (!FullPath)
463  {
464  goto Cleanup;
465  }
466 
467  /* Don't merge if the External path is already fully qualified */
468 
469  if (PrefixPath &&
470  (*ExternalPath != '\\') &&
471  (*ExternalPath != '^'))
472  {
473  strcat (FullPath, PrefixPath);
474  if (PrefixPath[1])
475  {
476  strcat (FullPath, ".");
477  }
478  }
479 
480  AcpiNsNormalizePathname (ExternalPath);
481  strcat (FullPath, ExternalPath);
482 
483 Cleanup:
484  if (PrefixPath)
485  {
486  ACPI_FREE (PrefixPath);
487  }
488  if (ExternalPath)
489  {
490  ACPI_FREE (ExternalPath);
491  }
492 
493  return (FullPath);
494 }
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define TRUE
Definition: types.h:120
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
UINT32 ACPI_STATUS
Definition: actypes.h:460
static void AcpiNsNormalizePathname(char *OriginalPath)
Definition: nsnames.c:512
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
smooth NULL
Definition: ftsmooth.c:416
ACPI_STATUS AcpiNsExternalizeName(UINT32 InternalNameLength, const char *InternalName, UINT32 *ConvertedNameLength, char **ConvertedName)
Definition: nsutils.c:470
#define ACPI_UINT32_MAX
Definition: actypes.h:66
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
char * AcpiNsGetNormalizedPathname(ACPI_NAMESPACE_NODE *Node, BOOLEAN NoTrailing)
Definition: nsnames.c:373
ULONG_PTR SIZE_T
Definition: typedefs.h:78
ACPI_STATE_COMMON ACPI_NAMESPACE_NODE * Node
Definition: aclocal.h:740
ACPI_SCOPE_STATE Scope
Definition: aclocal.h:825

Referenced by AcpiUtPrefixedNamespaceError().

◆ AcpiNsCheckAcpiCompliance()

void AcpiNsCheckAcpiCompliance ( char Pathname,
ACPI_NAMESPACE_NODE Node,
const ACPI_PREDEFINED_INFO Predefined 
)

Definition at line 133 of file nsarguments.c.

137 {
138  UINT32 AmlParamCount;
139  UINT32 RequiredParamCount;
140 
141 
142  if (!Predefined || (Node->Flags & ANOBJ_EVALUATED))
143  {
144  return;
145  }
146 
147  /* Get the ACPI-required arg count from the predefined info table */
148 
149  RequiredParamCount =
150  METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList);
151 
152  /*
153  * If this object is not a control method, we can check if the ACPI
154  * spec requires that it be a method.
155  */
156  if (Node->Type != ACPI_TYPE_METHOD)
157  {
158  if (RequiredParamCount > 0)
159  {
160  /* Object requires args, must be implemented as a method */
161 
163  "Object (%s) must be a control method with %u arguments",
164  AcpiUtGetTypeName (Node->Type), RequiredParamCount));
165  }
166  else if (!RequiredParamCount && !Predefined->Info.ExpectedBtypes)
167  {
168  /* Object requires no args and no return value, must be a method */
169 
171  "Object (%s) must be a control method "
172  "with no arguments and no return value",
173  AcpiUtGetTypeName (Node->Type)));
174  }
175 
176  return;
177  }
178 
179  /*
180  * This is a control method.
181  * Check that the ASL/AML-defined parameter count for this method
182  * matches the ACPI-required parameter count
183  *
184  * Some methods are allowed to have a "minimum" number of args (_SCP)
185  * because their definition in ACPI has changed over time.
186  *
187  * Note: These are BIOS errors in the declaration of the object
188  */
189  AmlParamCount = Node->Object->Method.ParamCount;
190 
191  if (AmlParamCount < RequiredParamCount)
192  {
194  "Insufficient arguments - "
195  "ASL declared %u, ACPI requires %u",
196  AmlParamCount, RequiredParamCount));
197  }
198  else if ((AmlParamCount > RequiredParamCount) &&
199  !(Predefined->Info.ArgumentList & ARG_COUNT_IS_MINIMUM))
200  {
202  "Excess arguments - "
203  "ASL declared %u, ACPI requires %u",
204  AmlParamCount, RequiredParamCount));
205  }
206 }
#define ACPI_WARN_ALWAYS
Definition: acnamesp.h:87
#define ANOBJ_EVALUATED
Definition: aclocal.h:220
#define METHOD_GET_ARG_COUNT(ArgList)
Definition: acpredef.h:147
#define ACPI_BIOS_ERROR_PREDEFINED(plist)
Definition: acmacros.h:466
unsigned int UINT32
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_TYPE_METHOD
Definition: actypes.h:686
UINT8 ExpectedBtypes
Definition: aclocal.h:377
#define ARG_COUNT_IS_MINIMUM
Definition: acpredef.h:144
UINT16 ArgumentList
Definition: aclocal.h:376
const char * AcpiUtGetTypeName(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:249
ACPI_NAME_INFO Info
Definition: aclocal.h:441
Definition: dlist.c:348
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 Pathname
Definition: acpixf.h:700

Referenced by AcpiNsEvaluate().

◆ AcpiNsCheckArgumentCount()

void AcpiNsCheckArgumentCount ( char Pathname,
ACPI_NAMESPACE_NODE Node,
UINT32  UserParamCount,
const ACPI_PREDEFINED_INFO Info 
)

Definition at line 226 of file nsarguments.c.

231 {
232  UINT32 AmlParamCount;
233  UINT32 RequiredParamCount;
234 
235 
236  if (Node->Flags & ANOBJ_EVALUATED)
237  {
238  return;
239  }
240 
241  if (!Predefined)
242  {
243  /*
244  * Not a predefined name. Check the incoming user argument count
245  * against the count that is specified in the method/object.
246  */
247  if (Node->Type != ACPI_TYPE_METHOD)
248  {
249  if (UserParamCount)
250  {
252  "%u arguments were passed to a non-method ACPI object (%s)",
253  UserParamCount, AcpiUtGetTypeName (Node->Type)));
254  }
255 
256  return;
257  }
258 
259  /*
260  * This is a control method. Check the parameter count.
261  * We can only check the incoming argument count against the
262  * argument count declared for the method in the ASL/AML.
263  *
264  * Emit a message if too few or too many arguments have been passed
265  * by the caller.
266  *
267  * Note: Too many arguments will not cause the method to
268  * fail. However, the method will fail if there are too few
269  * arguments and the method attempts to use one of the missing ones.
270  */
271  AmlParamCount = Node->Object->Method.ParamCount;
272 
273  if (UserParamCount < AmlParamCount)
274  {
276  "Insufficient arguments - "
277  "Caller passed %u, method requires %u",
278  UserParamCount, AmlParamCount));
279  }
280  else if (UserParamCount > AmlParamCount)
281  {
283  "Excess arguments - "
284  "Caller passed %u, method requires %u",
285  UserParamCount, AmlParamCount));
286  }
287 
288  return;
289  }
290 
291  /*
292  * This is a predefined name. Validate the user-supplied parameter
293  * count against the ACPI specification. We don't validate against
294  * the method itself because what is important here is that the
295  * caller is in conformance with the spec. (The arg count for the
296  * method was checked against the ACPI spec earlier.)
297  *
298  * Some methods are allowed to have a "minimum" number of args (_SCP)
299  * because their definition in ACPI has changed over time.
300  */
301  RequiredParamCount =
302  METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList);
303 
304  if (UserParamCount < RequiredParamCount)
305  {
307  "Insufficient arguments - "
308  "Caller passed %u, ACPI requires %u",
309  UserParamCount, RequiredParamCount));
310  }
311  else if ((UserParamCount > RequiredParamCount) &&
312  !(Predefined->Info.ArgumentList & ARG_COUNT_IS_MINIMUM))
313  {
315  "Excess arguments - "
316  "Caller passed %u, ACPI requires %u",
317  UserParamCount, RequiredParamCount));
318  }
319 }
#define ACPI_WARN_ALWAYS
Definition: acnamesp.h:87
#define ANOBJ_EVALUATED
Definition: aclocal.h:220
#define METHOD_GET_ARG_COUNT(ArgList)
Definition: acpredef.h:147
unsigned int UINT32
#define ACPI_WARN_PREDEFINED(plist)
Definition: acmacros.h:464
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_TYPE_METHOD
Definition: actypes.h:686
#define ACPI_INFO_PREDEFINED(plist)
Definition: acmacros.h:465
#define ARG_COUNT_IS_MINIMUM
Definition: acpredef.h:144
const char * AcpiUtGetTypeName(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:249
Definition: dlist.c:348
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 Pathname
Definition: acpixf.h:700

Referenced by AcpiNsEvaluate().

◆ AcpiNsCheckArgumentTypes()

void AcpiNsCheckArgumentTypes ( ACPI_EVALUATE_INFO Info)

Definition at line 68 of file nsarguments.c.

70 {
71  UINT16 ArgTypeList;
72  UINT8 ArgCount;
73  UINT8 ArgType;
74  UINT8 UserArgType;
75  UINT32 i;
76 
77 
78  /*
79  * If not a predefined name, cannot typecheck args, because
80  * we have no idea what argument types are expected.
81  * Also, ignore typecheck if warnings/errors if this method
82  * has already been evaluated at least once -- in order
83  * to suppress repetitive messages.
84  */
85  if (!Info->Predefined || (Info->Node->Flags & ANOBJ_EVALUATED))
86  {
87  return;
88  }
89 
90  ArgTypeList = Info->Predefined->Info.ArgumentList;
91  ArgCount = METHOD_GET_ARG_COUNT (ArgTypeList);
92 
93  /* Typecheck all arguments */
94 
95  for (i = 0; ((i < ArgCount) && (i < Info->ParamCount)); i++)
96  {
97  ArgType = METHOD_GET_NEXT_TYPE (ArgTypeList);
98  UserArgType = Info->Parameters[i]->Common.Type;
99 
100  if (UserArgType != ArgType)
101  {
103  "Argument #%u type mismatch - "
104  "Found [%s], ACPI requires [%s]", (i + 1),
105  AcpiUtGetTypeName (UserArgType),
106  AcpiUtGetTypeName (ArgType)));
107 
108  /* Prevent any additional typechecking for this method */
109 
110  Info->Node->Flags |= ANOBJ_EVALUATED;
111  }
112  }
113 }
#define ACPI_WARN_ALWAYS
Definition: acnamesp.h:87
#define ANOBJ_EVALUATED
Definition: aclocal.h:220
struct TraceInfo Info
#define METHOD_GET_ARG_COUNT(ArgList)
Definition: acpredef.h:147
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
unsigned int UINT32
#define ACPI_WARN_PREDEFINED(plist)
Definition: acmacros.h:464
#define AE_INFO
Definition: acoutput.h:230
unsigned short UINT16
const char * AcpiUtGetTypeName(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:249
#define METHOD_GET_NEXT_TYPE(ArgList)
Definition: acpredef.h:148
unsigned char UINT8

Referenced by AcpiNsEvaluate().

◆ AcpiNsCheckObjectType()

ACPI_STATUS AcpiNsCheckObjectType ( ACPI_EVALUATE_INFO Info,
ACPI_OPERAND_OBJECT **  ReturnObjectPtr,
UINT32  ExpectedBtypes,
UINT32  PackageIndex 
)

Definition at line 244 of file nspredef.c.

249 {
250  ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
252  char TypeBuffer[96]; /* Room for 10 types */
253 
254 
255  /* A Namespace node should not get here, but make sure */
256 
257  if (ReturnObject &&
259  {
260  ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
261  "Invalid return type - Found a Namespace node [%4.4s] type %s",
262  ReturnObject->Node.Name.Ascii,
263  AcpiUtGetTypeName (ReturnObject->Node.Type)));
264  return (AE_AML_OPERAND_TYPE);
265  }
266 
267  /*
268  * Convert the object type (ACPI_TYPE_xxx) to a bitmapped object type.
269  * The bitmapped type allows multiple possible return types.
270  *
271  * Note, the cases below must handle all of the possible types returned
272  * from all of the predefined names (including elements of returned
273  * packages)
274  */
275  Info->ReturnBtype = AcpiNsGetBitmappedType (ReturnObject);
276  if (Info->ReturnBtype == ACPI_RTYPE_ANY)
277  {
278  /* Not one of the supported objects, must be incorrect */
279  goto TypeErrorExit;
280  }
281 
282  /* For reference objects, check that the reference type is correct */
283 
284  if ((Info->ReturnBtype & ExpectedBtypes) == ACPI_RTYPE_REFERENCE)
285  {
286  Status = AcpiNsCheckReference (Info, ReturnObject);
287  return (Status);
288  }
289 
290  /* Attempt simple repair of the returned object if necessary */
291 
292  Status = AcpiNsSimpleRepair (Info, ExpectedBtypes,
293  PackageIndex, ReturnObjectPtr);
294  if (ACPI_SUCCESS (Status))
295  {
296  return (AE_OK); /* Successful repair */
297  }
298 
299 
300 TypeErrorExit:
301 
302  /* Create a string with all expected types for this predefined object */
303 
304  AcpiUtGetExpectedReturnTypes (TypeBuffer, ExpectedBtypes);
305 
306  if (!ReturnObject)
307  {
308  ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
309  "Expected return object of type %s",
310  TypeBuffer));
311  }
312  else if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT)
313  {
314  ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
315  "Return type mismatch - found %s, expected %s",
316  AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer));
317  }
318  else
319  {
320  ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
321  "Return Package type mismatch at index %u - "
322  "found %s, expected %s", PackageIndex,
323  AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer));
324  }
325 
326  return (AE_AML_OPERAND_TYPE);
327 }
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
ACPI_STATUS AcpiNsSimpleRepair(ACPI_EVALUATE_INFO *Info, UINT32 ExpectedBtypes, UINT32 PackageIndex, ACPI_OPERAND_OBJECT **ReturnObjectPtr)
Definition: nsrepair.c:153
static UINT32 AcpiNsGetBitmappedType(ACPI_OPERAND_OBJECT *ReturnObject)
Definition: nspredef.c:386
char Ascii[4]
Definition: actbl.h:394
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
#define ACPI_RTYPE_REFERENCE
Definition: aclocal.h:482
#define ACPI_WARN_PREDEFINED(plist)
Definition: acmacros.h:464
#define AE_INFO
Definition: acoutput.h:230
ACPI_NAME_UNION Name
Definition: aclocal.h:191
#define ACPI_NOT_PACKAGE_ELEMENT
Definition: acnamesp.h:82
#define ACPI_RTYPE_ANY
Definition: aclocal.h:476
Status
Definition: gdiplustypes.h:24
ACPI_NAMESPACE_NODE Node
Definition: acobject.h:547
const char * AcpiUtGetTypeName(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:249
#define ACPI_DESC_TYPE_NAMED
Definition: acobject.h:574
void AcpiUtGetExpectedReturnTypes(char *Buffer, UINT32 ExpectedBtypes)
Definition: utpredef.c:158
const char * AcpiUtGetObjectTypeName(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: utdecode.c:263
#define AE_OK
Definition: acexcep.h:97
static ACPI_STATUS AcpiNsCheckReference(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT *ReturnObject)
Definition: nspredef.c:347
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414

Referenced by AcpiNsCheckPackage(), AcpiNsCheckPackageElements(), AcpiNsCheckPackageList(), and AcpiNsCheckReturnValue().

◆ AcpiNsCheckPackage()

ACPI_STATUS AcpiNsCheckPackage ( ACPI_EVALUATE_INFO Info,
ACPI_OPERAND_OBJECT **  ReturnObjectPtr 
)

Definition at line 96 of file nsprepkg.c.

99 {
100  ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
101  const ACPI_PREDEFINED_INFO *Package;
102  ACPI_OPERAND_OBJECT **Elements;
104  UINT32 ExpectedCount;
105  UINT32 Count;
106  UINT32 i;
107 
108 
109  ACPI_FUNCTION_NAME (NsCheckPackage);
110 
111 
112  /* The package info for this name is in the next table entry */
113 
114  Package = Info->Predefined + 1;
115 
117  "%s Validating return Package of Type %X, Count %X\n",
118  Info->FullPathname, Package->RetInfo.Type,
119  ReturnObject->Package.Count));
120 
121  /*
122  * For variable-length Packages, we can safely remove all embedded
123  * and trailing NULL package elements
124  */
125  AcpiNsRemoveNullElements (Info, Package->RetInfo.Type, ReturnObject);
126 
127  /* Extract package count and elements array */
128 
129  Elements = ReturnObject->Package.Elements;
130  Count = ReturnObject->Package.Count;
131 
132  /*
133  * Most packages must have at least one element. The only exception
134  * is the variable-length package (ACPI_PTYPE1_VAR).
135  */
136  if (!Count)
137  {
138  if (Package->RetInfo.Type == ACPI_PTYPE1_VAR)
139  {
140  return (AE_OK);
141  }
142 
143  ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
144  "Return Package has no elements (empty)"));
145 
146  return (AE_AML_OPERAND_VALUE);
147  }
148 
149  /*
150  * Decode the type of the expected package contents
151  *
152  * PTYPE1 packages contain no subpackages
153  * PTYPE2 packages contain subpackages
154  */
155  switch (Package->RetInfo.Type)
156  {
157  case ACPI_PTYPE_CUSTOM:
158 
159  Status = AcpiNsCustomPackage (Info, Elements, Count);
160  break;
161 
162  case ACPI_PTYPE1_FIXED:
163  /*
164  * The package count is fixed and there are no subpackages
165  *
166  * If package is too small, exit.
167  * If package is larger than expected, issue warning but continue
168  */
169  ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
170  if (Count < ExpectedCount)
171  {
172  goto PackageTooSmall;
173  }
174  else if (Count > ExpectedCount)
175  {
177  "%s: Return Package is larger than needed - "
178  "found %u, expected %u\n",
179  Info->FullPathname, Count, ExpectedCount));
180  }
181 
182  /* Validate all elements of the returned package */
183 
185  Package->RetInfo.ObjectType1, Package->RetInfo.Count1,
186  Package->RetInfo.ObjectType2, Package->RetInfo.Count2, 0);
187  break;
188 
189  case ACPI_PTYPE1_VAR:
190  /*
191  * The package count is variable, there are no subpackages, and all
192  * elements must be of the same type
193  */
194  for (i = 0; i < Count; i++)
195  {
196  Status = AcpiNsCheckObjectType (Info, Elements,
197  Package->RetInfo.ObjectType1, i);
198  if (ACPI_FAILURE (Status))
199  {
200  return (Status);
201  }
202 
203  Elements++;
204  }
205  break;
206 
207  case ACPI_PTYPE1_OPTION:
208  /*
209  * The package count is variable, there are no subpackages. There are
210  * a fixed number of required elements, and a variable number of
211  * optional elements.
212  *
213  * Check if package is at least as large as the minimum required
214  */
215  ExpectedCount = Package->RetInfo3.Count;
216  if (Count < ExpectedCount)
217  {
218  goto PackageTooSmall;
219  }
220 
221  /* Variable number of sub-objects */
222 
223  for (i = 0; i < Count; i++)
224  {
225  if (i < Package->RetInfo3.Count)
226  {
227  /* These are the required package elements (0, 1, or 2) */
228 
229  Status = AcpiNsCheckObjectType (Info, Elements,
230  Package->RetInfo3.ObjectType[i], i);
231  if (ACPI_FAILURE (Status))
232  {
233  return (Status);
234  }
235  }
236  else
237  {
238  /* These are the optional package elements */
239 
240  Status = AcpiNsCheckObjectType (Info, Elements,
241  Package->RetInfo3.TailObjectType, i);
242  if (ACPI_FAILURE (Status))
243  {
244  return (Status);
245  }
246  }
247 
248  Elements++;
249  }
250  break;
251 
253 
254  /* First element is the (Integer) revision */
255 
257  Info, Elements, ACPI_RTYPE_INTEGER, 0);
258  if (ACPI_FAILURE (Status))
259  {
260  return (Status);
261  }
262 
263  Elements++;
264  Count--;
265 
266  /* Examine the subpackages */
267 
268  Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);
269  break;
270 
272 
273  /* First element is the (Integer) count of subpackages to follow */
274 
276  Info, Elements, ACPI_RTYPE_INTEGER, 0);
277  if (ACPI_FAILURE (Status))
278  {
279  return (Status);
280  }
281 
282  /*
283  * Count cannot be larger than the parent package length, but allow it
284  * to be smaller. The >= accounts for the Integer above.
285  */
286  ExpectedCount = (UINT32) (*Elements)->Integer.Value;
287  if (ExpectedCount >= Count)
288  {
289  goto PackageTooSmall;
290  }
291 
292  Count = ExpectedCount;
293  Elements++;
294 
295  /* Examine the subpackages */
296 
297  Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);
298  break;
299 
300  case ACPI_PTYPE2:
301  case ACPI_PTYPE2_FIXED:
302  case ACPI_PTYPE2_MIN:
303  case ACPI_PTYPE2_COUNT:
304  case ACPI_PTYPE2_FIX_VAR:
305  /*
306  * These types all return a single Package that consists of a
307  * variable number of subpackages.
308  *
309  * First, ensure that the first element is a subpackage. If not,
310  * the BIOS may have incorrectly returned the object as a single
311  * package instead of a Package of Packages (a common error if
312  * there is only one entry). We may be able to repair this by
313  * wrapping the returned Package with a new outer Package.
314  */
315  if (*Elements && ((*Elements)->Common.Type != ACPI_TYPE_PACKAGE))
316  {
317  /* Create the new outer package and populate it */
318 
320  Info, ReturnObject, ReturnObjectPtr);
321  if (ACPI_FAILURE (Status))
322  {
323  return (Status);
324  }
325 
326  /* Update locals to point to the new package (of 1 element) */
327 
328  ReturnObject = *ReturnObjectPtr;
329  Elements = ReturnObject->Package.Elements;
330  Count = 1;
331  }
332 
333  /* Examine the subpackages */
334 
335  Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);
336  break;
337 
338  case ACPI_PTYPE2_VAR_VAR:
339  /*
340  * Returns a variable list of packages, each with a variable list
341  * of objects.
342  */
343  break;
344 
346 
347  /* The package must contain pairs of (UUID + type) */
348 
349  if (Count & 1)
350  {
351  ExpectedCount = Count + 1;
352  goto PackageTooSmall;
353  }
354 
355  while (Count > 0)
356  {
357  Status = AcpiNsCheckObjectType(Info, Elements,
358  Package->RetInfo.ObjectType1, 0);
359  if (ACPI_FAILURE(Status))
360  {
361  return (Status);
362  }
363 
364  /* Validate length of the UUID buffer */
365 
366  if ((*Elements)->Buffer.Length != 16)
367  {
368  ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,
369  Info->NodeFlags, "Invalid length for UUID Buffer"));
370  return (AE_AML_OPERAND_VALUE);
371  }
372 
373  Status = AcpiNsCheckObjectType(Info, Elements + 1,
374  Package->RetInfo.ObjectType2, 0);
375  if (ACPI_FAILURE(Status))
376  {
377  return (Status);
378  }
379 
380  Elements += 2;
381  Count -= 2;
382  }
383  break;
384 
385  default:
386 
387  /* Should not get here if predefined info table is correct */
388 
389  ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
390  "Invalid internal return type in table entry: %X",
391  Package->RetInfo.Type));
392 
393  return (AE_AML_INTERNAL);
394  }
395 
396  return (Status);
397 
398 
399 PackageTooSmall:
400 
401  /* Error exit for the case with an incorrect package count */
402 
403  ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
404  "Return Package is too small - found %u elements, expected %u",
405  Count, ExpectedCount));
406 
407  return (AE_AML_OPERAND_VALUE);
408 }
#define ACPI_RTYPE_INTEGER
Definition: aclocal.h:478
ACPI_STATUS AcpiNsCheckObjectType(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr, UINT32 ExpectedBtypes, UINT32 PackageIndex)
Definition: nspredef.c:244
ACPI_OBJECT_PACKAGE Package
Definition: acobject.h:520
#define AE_AML_OPERAND_VALUE
Definition: acexcep.h:183
UINT8 TailObjectType
Definition: aclocal.h:423
#define AE_AML_INTERNAL
Definition: acexcep.h:194
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
void AcpiNsRemoveNullElements(ACPI_EVALUATE_INFO *Info, UINT8 PackageType, ACPI_OPERAND_OBJECT *ObjDesc)
Definition: nsrepair.c:494
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_DB_REPAIR
Definition: acoutput.h:154
ACPI_PACKAGE_INFO3 RetInfo3
Definition: aclocal.h:444
struct TraceInfo Info
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:682
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
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
unsigned int UINT32
static ACPI_STATUS AcpiNsCustomPackage(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **Elements, UINT32 Count)
Definition: nsprepkg.c:659
#define ACPI_WARN_PREDEFINED(plist)
Definition: acmacros.h:464
#define AE_INFO
Definition: acoutput.h:230
ACPI_STATUS AcpiNsWrapWithPackage(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ObjDescPtr)
Definition: nsrepair.c:597
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
UINT8 ObjectType2
Definition: aclocal.h:399
UINT8 ObjectType1
Definition: aclocal.h:397
Status
Definition: gdiplustypes.h:24
static ACPI_STATUS AcpiNsCheckPackageList(ACPI_EVALUATE_INFO *Info, const ACPI_PREDEFINED_INFO *Package, ACPI_OPERAND_OBJECT **Elements, UINT32 Count)
Definition: nsprepkg.c:428
#define ACPI_DB_NAMES
Definition: acoutput.h:166
static ACPI_STATUS AcpiNsCheckPackageElements(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **Elements, UINT8 Type1, UINT32 Count1, UINT8 Type2, UINT32 Count2, UINT32 StartIndex)
Definition: nsprepkg.c:746
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479
ACPI_PACKAGE_INFO RetInfo
Definition: aclocal.h:442
#define AE_OK
Definition: acexcep.h:97
UINT8 ObjectType[2]
Definition: aclocal.h:422
union acpi_operand_object ** Elements
Definition: acobject.h:161

Referenced by AcpiNsCheckReturnValue().

◆ AcpiNsCheckReturnValue()

ACPI_STATUS AcpiNsCheckReturnValue ( ACPI_NAMESPACE_NODE Node,
ACPI_EVALUATE_INFO Info,
UINT32  UserParamCount,
ACPI_STATUS  ReturnStatus,
ACPI_OPERAND_OBJECT **  ReturnObject 
)

Definition at line 108 of file nspredef.c.

114 {
116  const ACPI_PREDEFINED_INFO *Predefined;
117 
118 
119  /* If not a predefined name, we cannot validate the return object */
120 
121  Predefined = Info->Predefined;
122  if (!Predefined)
123  {
124  return (AE_OK);
125  }
126 
127  /*
128  * If the method failed or did not actually return an object, we cannot
129  * validate the return object
130  */
131  if ((ReturnStatus != AE_OK) &&
132  (ReturnStatus != AE_CTRL_RETURN_VALUE))
133  {
134  return (AE_OK);
135  }
136 
137  /*
138  * Return value validation and possible repair.
139  *
140  * 1) Don't perform return value validation/repair if this feature
141  * has been disabled via a global option.
142  *
143  * 2) We have a return value, but if one wasn't expected, just exit,
144  * this is not a problem. For example, if the "Implicit Return"
145  * feature is enabled, methods will always return a value.
146  *
147  * 3) If the return value can be of any type, then we cannot perform
148  * any validation, just exit.
149  */
150  if (AcpiGbl_DisableAutoRepair ||
151  (!Predefined->Info.ExpectedBtypes) ||
152  (Predefined->Info.ExpectedBtypes == ACPI_RTYPE_ALL))
153  {
154  return (AE_OK);
155  }
156 
157  /*
158  * Check that the type of the main return object is what is expected
159  * for this predefined name
160  */
161  Status = AcpiNsCheckObjectType (Info, ReturnObjectPtr,
163  if (ACPI_FAILURE (Status))
164  {
165  goto Exit;
166  }
167 
168  /*
169  *
170  * 4) If there is no return value and it is optional, just return
171  * AE_OK (_WAK).
172  */
173  if (!(*ReturnObjectPtr))
174  {
175  goto Exit;
176  }
177 
178  /*
179  * For returned Package objects, check the type of all sub-objects.
180  * Note: Package may have been newly created by call above.
181  */
182  if ((*ReturnObjectPtr)->Common.Type == ACPI_TYPE_PACKAGE)
183  {
184  Info->ParentPackage = *ReturnObjectPtr;
185  Status = AcpiNsCheckPackage (Info, ReturnObjectPtr);
186  if (ACPI_FAILURE (Status))
187  {
188  /* We might be able to fix some errors */
189 
190  if ((Status != AE_AML_OPERAND_TYPE) &&
192  {
193  goto Exit;
194  }
195  }
196  }
197 
198  /*
199  * The return object was OK, or it was successfully repaired above.
200  * Now make some additional checks such as verifying that package
201  * objects are sorted correctly (if required) or buffer objects have
202  * the correct data width (bytes vs. dwords). These repairs are
203  * performed on a per-name basis, i.e., the code is specific to
204  * particular predefined names.
205  */
206  Status = AcpiNsComplexRepairs (Info, Node, Status, ReturnObjectPtr);
207 
208 Exit:
209  /*
210  * If the object validation failed or if we successfully repaired one
211  * or more objects, mark the parent node to suppress further warning
212  * messages during the next evaluation of the same method/object.
213  */
214  if (ACPI_FAILURE (Status) ||
215  (Info->ReturnFlags & ACPI_OBJECT_REPAIRED))
216  {
217  Node->Flags |= ANOBJ_EVALUATED;
218  }
219 
220  return (Status);
221 }
ACPI_STATUS AcpiNsComplexRepairs(ACPI_EVALUATE_INFO *Info, ACPI_NAMESPACE_NODE *Node, ACPI_STATUS ValidateStatus, ACPI_OPERAND_OBJECT **ReturnObjectPtr)
Definition: nsrepair2.c:206
#define ANOBJ_EVALUATED
Definition: aclocal.h:220
#define AE_AML_OPERAND_VALUE
Definition: acexcep.h:183
#define AE_CTRL_RETURN_VALUE
Definition: acexcep.h:224
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:682
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_OBJECT_REPAIRED
Definition: acstruct.h:235
#define ACPI_NOT_PACKAGE_ELEMENT
Definition: acnamesp.h:82
static void Exit(void)
Definition: sock.c:1331
UINT8 ExpectedBtypes
Definition: aclocal.h:377
ACPI_STATUS AcpiNsCheckObjectType(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr, UINT32 ExpectedBtypes, UINT32 PackageIndex)
Definition: nspredef.c:244
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiNsCheckPackage(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr)
Definition: nsprepkg.c:96
#define ACPI_RTYPE_ALL
Definition: aclocal.h:483
#define AE_OK
Definition: acexcep.h:97
ACPI_NAME_INFO Info
Definition: aclocal.h:441
Definition: dlist.c:348

Referenced by AcpiNsEvaluate().

◆ AcpiNsCompareNames()

int AcpiNsCompareNames ( char Name1,
char Name2 
)

◆ AcpiNsComplexRepairs()

ACPI_STATUS AcpiNsComplexRepairs ( ACPI_EVALUATE_INFO Info,
ACPI_NAMESPACE_NODE Node,
ACPI_STATUS  ValidateStatus,
ACPI_OPERAND_OBJECT **  ReturnObjectPtr 
)

Definition at line 206 of file nsrepair2.c.

211 {
212  const ACPI_REPAIR_INFO *Predefined;
214 
215 
216  /* Check if this name is in the list of repairable names */
217 
218  Predefined = AcpiNsMatchComplexRepair (Node);
219  if (!Predefined)
220  {
221  return (ValidateStatus);
222  }
223 
224  Status = Predefined->RepairFunction (Info, ReturnObjectPtr);
225  return (Status);
226 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
static const ACPI_REPAIR_INFO * AcpiNsMatchComplexRepair(ACPI_NAMESPACE_NODE *Node)
Definition: nsrepair2.c:242
Status
Definition: gdiplustypes.h:24
ACPI_REPAIR_FUNCTION RepairFunction
Definition: nsrepair2.c:65
Definition: dlist.c:348

Referenced by AcpiNsCheckReturnValue().

◆ AcpiNsConvertToBuffer()

ACPI_STATUS AcpiNsConvertToBuffer ( ACPI_OPERAND_OBJECT OriginalObject,
ACPI_OPERAND_OBJECT **  ReturnObject 
)

Definition at line 233 of file nsconvert.c.

236 {
239  ACPI_OPERAND_OBJECT **Elements;
240  UINT32 *DwordBuffer;
241  UINT32 Count;
242  UINT32 i;
243 
244 
245  switch (OriginalObject->Common.Type)
246  {
247  case ACPI_TYPE_INTEGER:
248  /*
249  * Integer-to-Buffer conversion.
250  * Convert the Integer to a packed-byte buffer. _MAT and other
251  * objects need this sometimes, if a read has been performed on a
252  * Field object that is less than or equal to the global integer
253  * size (32 or 64 bits).
254  */
255  Status = AcpiExConvertToBuffer (OriginalObject, &NewObject);
256  if (ACPI_FAILURE (Status))
257  {
258  return (Status);
259  }
260  break;
261 
262  case ACPI_TYPE_STRING:
263 
264  /* String-to-Buffer conversion. Simple data copy */
265 
267  (OriginalObject->String.Length);
268  if (!NewObject)
269  {
270  return (AE_NO_MEMORY);
271  }
272 
273  memcpy (NewObject->Buffer.Pointer,
274  OriginalObject->String.Pointer, OriginalObject->String.Length);
275  break;
276 
277  case ACPI_TYPE_PACKAGE:
278  /*
279  * This case is often seen for predefined names that must return a
280  * Buffer object with multiple DWORD integers within. For example,
281  * _FDE and _GTM. The Package can be converted to a Buffer.
282  */
283 
284  /* All elements of the Package must be integers */
285 
286  Elements = OriginalObject->Package.Elements;
287  Count = OriginalObject->Package.Count;
288 
289  for (i = 0; i < Count; i++)
290  {
291  if ((!*Elements) ||
292  ((*Elements)->Common.Type != ACPI_TYPE_INTEGER))
293  {
294  return (AE_AML_OPERAND_TYPE);
295  }
296  Elements++;
297  }
298 
299  /* Create the new buffer object to replace the Package */
300 
302  if (!NewObject)
303  {
304  return (AE_NO_MEMORY);
305  }
306 
307  /* Copy the package elements (integers) to the buffer as DWORDs */
308 
309  Elements = OriginalObject->Package.Elements;
310  DwordBuffer = ACPI_CAST_PTR (UINT32, NewObject->Buffer.Pointer);
311 
312  for (i = 0; i < Count; i++)
313  {
314  *DwordBuffer = (UINT32) (*Elements)->Integer.Value;
315  DwordBuffer++;
316  Elements++;
317  }
318  break;
319 
320  default:
321 
322  return (AE_AML_OPERAND_TYPE);
323  }
324 
325  *ReturnObject = NewObject;
326  return (AE_OK);
327 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
ACPI_OBJECT_PACKAGE Package
Definition: acobject.h:520
#define ACPI_TYPE_INTEGER
Definition: actypes.h:679
ACPI_OPERAND_OBJECT * AcpiUtCreateBufferObject(ACPI_SIZE BufferSize)
Definition: utobject.c:258
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define ACPI_MUL_4(a)
Definition: acmacros.h:211
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:682
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
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
unsigned int UINT32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ACPI_OBJECT_STRING String
Definition: acobject.h:518
Status
Definition: gdiplustypes.h:24
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
ACPI_STATUS AcpiExConvertToBuffer(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc)
Definition: exconvrt.c:224
#define ACPI_TYPE_STRING
Definition: actypes.h:680
_Inout_opt_ PACCESS_STATE _In_opt_ ACCESS_MASK _In_ ULONG _Out_opt_ PVOID * NewObject
Definition: obfuncs.h:71
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define AE_OK
Definition: acexcep.h:97
union acpi_operand_object ** Elements
Definition: acobject.h:161

Referenced by AcpiNsSimpleRepair().

◆ AcpiNsConvertToInteger()

ACPI_STATUS AcpiNsConvertToInteger ( ACPI_OPERAND_OBJECT OriginalObject,
ACPI_OPERAND_OBJECT **  ReturnObject 
)

Definition at line 70 of file nsconvert.c.

73 {
76  UINT64 Value = 0;
77  UINT32 i;
78 
79 
80  switch (OriginalObject->Common.Type)
81  {
82  case ACPI_TYPE_STRING:
83 
84  /* String-to-Integer conversion */
85 
86  Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer, &Value);
87  if (ACPI_FAILURE (Status))
88  {
89  return (Status);
90  }
91  break;
92 
93  case ACPI_TYPE_BUFFER:
94 
95  /* Buffer-to-Integer conversion. Max buffer size is 64 bits. */
96 
97  if (OriginalObject->Buffer.Length > 8)
98  {
99  return (AE_AML_OPERAND_TYPE);
100  }
101 
102  /* Extract each buffer byte to create the integer */
103 
104  for (i = 0; i < OriginalObject->Buffer.Length; i++)
105  {
106  Value |= ((UINT64)
107  OriginalObject->Buffer.Pointer[i] << (i * 8));
108  }
109  break;
110 
111  default:
112 
113  return (AE_AML_OPERAND_TYPE);
114  }
115 
117  if (!NewObject)
118  {
119  return (AE_NO_MEMORY);
120  }
121 
122  *ReturnObject = NewObject;
123  return (AE_OK);
124 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_TYPE_BUFFER
Definition: actypes.h:681
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
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 AcpiUtStrtoul64(char *String, UINT64 *RetInteger)
Definition: utstrtoul64.c:121
unsigned int UINT32
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:519
ACPI_OPERAND_OBJECT * AcpiUtCreateIntegerObject(UINT64 Value)
Definition: utobject.c:223
ACPI_OBJECT_STRING String
Definition: acobject.h:518
Status
Definition: gdiplustypes.h:24
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
#define ACPI_TYPE_STRING
Definition: actypes.h:680
unsigned long long UINT64
_Inout_opt_ PACCESS_STATE _In_opt_ ACCESS_MASK _In_ ULONG _Out_opt_ PVOID * NewObject
Definition: obfuncs.h:71
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiNsSimpleRepair().

◆ AcpiNsConvertToReference()

ACPI_STATUS AcpiNsConvertToReference ( ACPI_NAMESPACE_NODE Scope,
ACPI_OPERAND_OBJECT OriginalObject,
ACPI_OPERAND_OBJECT **  ReturnObject 
)

Definition at line 506 of file nsconvert.c.

510 {
514  ACPI_GENERIC_STATE ScopeInfo;
515  char *Name;
516 
517 
518  ACPI_FUNCTION_NAME (NsConvertToReference);
519 
520 
521  /* Convert path into internal presentation */
522 
523  Status = AcpiNsInternalizeName (OriginalObject->String.Pointer, &Name);
524  if (ACPI_FAILURE (Status))
525  {
527  }
528 
529  /* Find the namespace node */
530 
531  ScopeInfo.Scope.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Scope);
532  Status = AcpiNsLookup (&ScopeInfo, Name,
535  if (ACPI_FAILURE (Status))
536  {
537  /* Check if we are resolving a named reference within a package */
538 
539  ACPI_ERROR_NAMESPACE (&ScopeInfo,
540  OriginalObject->String.Pointer, Status);
541  goto ErrorExit;
542  }
543 
544  /* Create and init a new internal ACPI object */
545 
547  if (!NewObject)
548  {
550  goto ErrorExit;
551  }
552  NewObject->Reference.Node = Node;
553  NewObject->Reference.Object = Node->Object;
554  NewObject->Reference.Class = ACPI_REFCLASS_NAME;
555 
556  /*
557  * Increase reference of the object if needed (the object is likely a
558  * null for device nodes).
559  */
560  AcpiUtAddReference (Node->Object);
561 
562 ErrorExit:
563  ACPI_FREE (Name);
564  *ReturnObject = NewObject;
565  return (Status);
566 }
#define ACPI_NS_SEARCH_PARENT
Definition: acnamesp.h:63
#define ACPI_FREE(a)
Definition: actypes.h:386
void AcpiUtAddReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:746
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:329
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:710
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
union node Node
Definition: types.h:1255
#define ACPI_NS_DONT_OPEN_SCOPE
Definition: acnamesp.h:64
struct NameRec_ * Name
Definition: cdprocs.h:464
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_TYPE_ANY
Definition: actypes.h:678
ACPI_OBJECT_STRING String
Definition: acobject.h:518
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
static VOID ErrorExit(LPTSTR lpszMessage)
Definition: telnetd.c:647
ACPI_STATE_COMMON ACPI_NAMESPACE_NODE * Node
Definition: aclocal.h:740
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:655
_Inout_opt_ PACCESS_STATE _In_opt_ ACCESS_MASK _In_ ULONG _Out_opt_ PVOID * NewObject
Definition: obfuncs.h:71
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
ACPI_STATUS AcpiNsInternalizeName(const char *DottedName, char **ConvertedName)
Definition: nsutils.c:405
ACPI_SCOPE_STATE Scope
Definition: aclocal.h:825
Definition: dlist.c:348

◆ AcpiNsConvertToResource()

ACPI_STATUS AcpiNsConvertToResource ( ACPI_NAMESPACE_NODE Scope,
ACPI_OPERAND_OBJECT OriginalObject,
ACPI_OPERAND_OBJECT **  ReturnObject 
)

Definition at line 420 of file nsconvert.c.

424 {
426  UINT8 *Buffer;
427 
428 
429  /*
430  * We can fix the following cases for an expected resource template:
431  * 1. No return value (interpreter slack mode is disabled)
432  * 2. A "Return (Zero)" statement
433  * 3. A "Return empty buffer" statement
434  *
435  * We will return a buffer containing a single EndTag
436  * resource descriptor.
437  */
438  if (OriginalObject)
439  {
440  switch (OriginalObject->Common.Type)
441  {
442  case ACPI_TYPE_INTEGER:
443 
444  /* We can only repair an Integer==0 */
445 
446  if (OriginalObject->Integer.Value)
447  {
448  return (AE_AML_OPERAND_TYPE);
449  }
450  break;
451 
452  case ACPI_TYPE_BUFFER:
453 
454  if (OriginalObject->Buffer.Length)
455  {
456  /* Additional checks can be added in the future */
457 
458  *ReturnObject = NULL;
459  return (AE_OK);
460  }
461  break;
462 
463  case ACPI_TYPE_STRING:
464  default:
465 
466  return (AE_AML_OPERAND_TYPE);
467  }
468  }
469 
470  /* Create the new buffer object for the resource descriptor */
471 
473  if (!NewObject)
474  {
475  return (AE_NO_MEMORY);
476  }
477 
478  Buffer = ACPI_CAST_PTR (UINT8, NewObject->Buffer.Pointer);
479 
480  /* Initialize the Buffer with a single EndTag descriptor */
481 
483  Buffer[1] = 0x00;
484 
485  *ReturnObject = NewObject;
486  return (AE_OK);
487 }
#define ACPI_RESOURCE_NAME_END_TAG
Definition: aclocal.h:1323
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ASL_RDESC_END_TAG_SIZE
Definition: amlresrc.h:117
#define ACPI_TYPE_BUFFER
Definition: actypes.h:681
#define ACPI_TYPE_INTEGER
Definition: actypes.h:679
ACPI_OPERAND_OBJECT * AcpiUtCreateBufferObject(ACPI_SIZE BufferSize)
Definition: utobject.c:258
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:519
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:517
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
#define ACPI_TYPE_STRING
Definition: actypes.h:680
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
_Inout_opt_ PACCESS_STATE _In_opt_ ACCESS_MASK _In_ ULONG _Out_opt_ PVOID * NewObject
Definition: obfuncs.h:71
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97

◆ AcpiNsConvertToString()

ACPI_STATUS AcpiNsConvertToString ( ACPI_OPERAND_OBJECT OriginalObject,
ACPI_OPERAND_OBJECT **  ReturnObject 
)

Definition at line 141 of file nsconvert.c.

144 {
146  ACPI_SIZE Length;
148 
149 
150  switch (OriginalObject->Common.Type)
151  {
152  case ACPI_TYPE_INTEGER:
153  /*
154  * Integer-to-String conversion. Commonly, convert
155  * an integer of value 0 to a NULL string. The last element of
156  * _BIF and _BIX packages occasionally need this fix.
157  */
158  if (OriginalObject->Integer.Value == 0)
159  {
160  /* Allocate a new NULL string object */
161 
163  if (!NewObject)
164  {
165  return (AE_NO_MEMORY);
166  }
167  }
168  else
169  {
170  Status = AcpiExConvertToString (OriginalObject,
172  if (ACPI_FAILURE (Status))
173  {
174  return (Status);
175  }
176  }
177  break;
178 
179  case ACPI_TYPE_BUFFER:
180  /*
181  * Buffer-to-String conversion. Use a ToString
182  * conversion, no transform performed on the buffer data. The best
183  * example of this is the _BIF method, where the string data from
184  * the battery is often (incorrectly) returned as buffer object(s).
185  */
186  Length = 0;
187  while ((Length < OriginalObject->Buffer.Length) &&
188  (OriginalObject->Buffer.Pointer[Length]))
189  {
190  Length++;
191  }
192 
193  /* Allocate a new string object */
194 
196  if (!NewObject)
197  {
198  return (AE_NO_MEMORY);
199  }
200 
201  /*
202  * Copy the raw buffer data with no transform. String is already NULL
203  * terminated at Length+1.
204  */
205  memcpy (NewObject->String.Pointer,
206  OriginalObject->Buffer.Pointer, Length);
207  break;
208 
209  default:
210 
211  return (AE_AML_OPERAND_TYPE);
212  }
213 
214  *ReturnObject = NewObject;
215  return (AE_OK);
216 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_TYPE_BUFFER
Definition: actypes.h:681
#define ACPI_TYPE_INTEGER
Definition: actypes.h:679
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
Definition: bufpool.h:45
ACPI_OPERAND_OBJECT * AcpiUtCreateStringObject(ACPI_SIZE StringSize)
Definition: utobject.c:320
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:519
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ACPI_STATUS AcpiExConvertToString(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, UINT32 Type)
Definition: exconvrt.c:440
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:517
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Status
Definition: gdiplustypes.h:24
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
_Inout_opt_ PACCESS_STATE _In_opt_ ACCESS_MASK _In_ ULONG _Out_opt_ PVOID * NewObject
Definition: obfuncs.h:71
#define AE_OK
Definition: acexcep.h:97
#define ACPI_IMPLICIT_CONVERT_HEX
Definition: acinterp.h:126

Referenced by AcpiNsSimpleRepair().

◆ AcpiNsConvertToUnicode()

ACPI_STATUS AcpiNsConvertToUnicode ( ACPI_NAMESPACE_NODE Scope,
ACPI_OPERAND_OBJECT OriginalObject,
ACPI_OPERAND_OBJECT **  ReturnObject 
)

Definition at line 345 of file nsconvert.c.

349 {
351  char *AsciiString;
352  UINT16 *UnicodeBuffer;
353  UINT32 UnicodeLength;
354  UINT32 i;
355 
356 
357  if (!OriginalObject)
358  {
359  return (AE_OK);
360  }
361 
362  /* If a Buffer was returned, it must be at least two bytes long */
363 
364  if (OriginalObject->Common.Type == ACPI_TYPE_BUFFER)
365  {
366  if (OriginalObject->Buffer.Length < 2)
367  {
368  return (AE_AML_OPERAND_VALUE);
369  }
370 
371  *ReturnObject = NULL;
372  return (AE_OK);
373  }
374 
375  /*
376  * The original object is an ASCII string. Convert this string to
377  * a unicode buffer.
378  */
379  AsciiString = OriginalObject->String.Pointer;
380  UnicodeLength = (OriginalObject->String.Length * 2) + 2;
381 
382  /* Create a new buffer object for the Unicode data */
383 
384  NewObject = AcpiUtCreateBufferObject (UnicodeLength);
385  if (!NewObject)
386  {
387  return (AE_NO_MEMORY);
388  }
389 
390  UnicodeBuffer = ACPI_CAST_PTR (UINT16, NewObject->Buffer.Pointer);
391 
392  /* Convert ASCII to Unicode */
393 
394  for (i = 0; i < OriginalObject->String.Length; i++)
395  {
396  UnicodeBuffer[i] = (UINT16) AsciiString[i];
397  }
398 
399  *ReturnObject = NewObject;
400  return (AE_OK);
401 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_TYPE_BUFFER
Definition: actypes.h:681
#define AE_AML_OPERAND_VALUE
Definition: acexcep.h:183
ACPI_OPERAND_OBJECT * AcpiUtCreateBufferObject(ACPI_SIZE BufferSize)
Definition: utobject.c:258
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
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:519
ACPI_OBJECT_STRING String
Definition: acobject.h:518
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
unsigned short UINT16
_Inout_opt_ PACCESS_STATE _In_opt_ ACCESS_MASK _In_ ULONG _Out_opt_ PVOID * NewObject
Definition: obfuncs.h:71
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define AE_OK
Definition: acexcep.h:97

◆ AcpiNsCreateNode()

ACPI_NAMESPACE_NODE* AcpiNsCreateNode ( UINT32  Name)

Definition at line 66 of file nsalloc.c.

68 {
70 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
71  UINT32 Temp;
72 #endif
73 
74 
75  ACPI_FUNCTION_TRACE (NsCreateNode);
76 
77 
78  Node = AcpiOsAcquireObject (AcpiGbl_NamespaceCache);
79  if (!Node)
80  {
81  return_PTR (NULL);
82  }
83 
84  ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalAllocated++);
85 
86 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
87  Temp = AcpiGbl_NsNodeList->TotalAllocated -
88  AcpiGbl_NsNodeList->TotalFreed;
89  if (Temp > AcpiGbl_NsNodeList->MaxOccupied)
90  {
91  AcpiGbl_NsNodeList->MaxOccupied = Temp;
92  }
93 #endif
94 
95  Node->Name.Integer = Name;
97  return_PTR (Node);
98 }
#define return_PTR(s)
Definition: acoutput.h:497
unsigned int UINT32
union node Node
Definition: types.h:1255
struct NameRec_ * Name
Definition: cdprocs.h:464
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_MEM_TRACKING(a)
Definition: actypes.h:387
#define ACPI_SET_DESCRIPTOR_TYPE(d, t)
Definition: acmacros.h:415
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
void * AcpiOsAcquireObject(ACPI_CACHE_T *Cache)
#define ACPI_DESC_TYPE_NAMED
Definition: acobject.h:574
Definition: dlist.c:348

Referenced by AcpiNsSearchAndEnter().

◆ AcpiNsDeleteChildren()

void AcpiNsDeleteChildren ( ACPI_NAMESPACE_NODE Parent)

Definition at line 341 of file nsalloc.c.

343 {
344  ACPI_NAMESPACE_NODE *NextNode;
345  ACPI_NAMESPACE_NODE *NodeToDelete;
346 
347 
348  ACPI_FUNCTION_TRACE_PTR (NsDeleteChildren, ParentNode);
349 
350 
351  if (!ParentNode)
352  {
353  return_VOID;
354  }
355 
356  /* Deallocate all children at this level */
357 
358  NextNode = ParentNode->Child;
359  while (NextNode)
360  {
361  /* Grandchildren should have all been deleted already */
362 
363  if (NextNode->Child)
364  {
365  ACPI_ERROR ((AE_INFO, "Found a grandchild! P=%p C=%p",
366  ParentNode, NextNode));
367  }
368 
369  /*
370  * Delete this child node and move on to the next child in the list.
371  * No need to unlink the node since we are deleting the entire branch.
372  */
373  NodeToDelete = NextNode;
374  NextNode = NextNode->Peer;
375  AcpiNsDeleteNode (NodeToDelete);
376  };
377 
378  /* Clear the parent's child pointer */
379 
380  ParentNode->Child = NULL;
381  return_VOID;
382 }
void AcpiNsDeleteNode(ACPI_NAMESPACE_NODE *Node)
Definition: nsalloc.c:117
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
struct acpi_namespace_node * Peer
Definition: aclocal.h:194
#define return_VOID
Definition: acoutput.h:495
struct acpi_namespace_node * Child
Definition: aclocal.h:193
#define ACPI_ERROR(plist)
Definition: acoutput.h:240

Referenced by AcpiNsDeleteNamespaceByOwner(), AcpiNsDeleteNamespaceSubtree(), AcpiNsSearchAndEnter(), and AcpiPsCompleteOp().

◆ AcpiNsDeleteNamespaceByOwner()

void AcpiNsDeleteNamespaceByOwner ( ACPI_OWNER_ID  OwnerId)

Definition at line 497 of file nsalloc.c.

499 {
500  ACPI_NAMESPACE_NODE *ChildNode;
501  ACPI_NAMESPACE_NODE *DeletionNode;
502  ACPI_NAMESPACE_NODE *ParentNode;
503  UINT32 Level;
505 
506 
507  ACPI_FUNCTION_TRACE_U32 (NsDeleteNamespaceByOwner, OwnerId);
508 
509 
510  if (OwnerId == 0)
511  {
512  return_VOID;
513  }
514 
515  /* Lock namespace for possible update */
516 
518  if (ACPI_FAILURE (Status))
519  {
520  return_VOID;
521  }
522 
523  DeletionNode = NULL;
524  ParentNode = AcpiGbl_RootNode;
525  ChildNode = NULL;
526  Level = 1;
527 
528  /*
529  * Traverse the tree of nodes until we bubble back up
530  * to where we started.
531  */
532  while (Level > 0)
533  {
534  /*
535  * Get the next child of this parent node. When ChildNode is NULL,
536  * the first child of the parent is returned
537  */
538  ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode);
539 
540  if (DeletionNode)
541  {
542  AcpiNsDeleteChildren (DeletionNode);
543  AcpiNsRemoveNode (DeletionNode);
544  DeletionNode = NULL;
545  }
546 
547  if (ChildNode)
548  {
549  if (ChildNode->OwnerId == OwnerId)
550  {
551  /* Found a matching child node - detach any attached object */
552 
553  AcpiNsDetachObject (ChildNode);
554  }
555 
556  /* Check if this node has any children */
557 
558  if (ChildNode->Child)
559  {
560  /*
561  * There is at least one child of this node,
562  * visit the node
563  */
564  Level++;
565  ParentNode = ChildNode;
566  ChildNode = NULL;
567  }
568  else if (ChildNode->OwnerId == OwnerId)
569  {
570  DeletionNode = ChildNode;
571  }
572  }
573  else
574  {
575  /*
576  * No more children of this parent node.
577  * Move up to the grandparent.
578  */
579  Level--;
580  if (Level != 0)
581  {
582  if (ParentNode->OwnerId == OwnerId)
583  {
584  DeletionNode = ParentNode;
585  }
586  }
587 
588  /* New "last child" is this parent node */
589 
590  ChildNode = ParentNode;
591 
592  /* Move up the tree to the grandparent */
593 
594  ParentNode = ParentNode->Parent;
595  }
596  }
597 
599  return_VOID;
600 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
void AcpiNsRemoveNode(ACPI_NAMESPACE_NODE *Node)
Definition: nsalloc.c:188
void AcpiNsDeleteChildren(ACPI_NAMESPACE_NODE *ParentNode)
Definition: nsalloc.c:341
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FUNCTION_TRACE_U32(a, b)
Definition: acoutput.h:482
struct acpi_namespace_node * Parent
Definition: aclocal.h:192
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
void AcpiNsDetachObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:220
ACPI_OWNER_ID OwnerId
Definition: aclocal.h:195
#define return_VOID
Definition: acoutput.h:495
Status
Definition: gdiplustypes.h:24
struct acpi_namespace_node * Child
Definition: aclocal.h:193
ACPI_NAMESPACE_NODE * AcpiNsGetNextNode(ACPI_NAMESPACE_NODE *Parent, ACPI_NAMESPACE_NODE *Child)
Definition: nswalk.c:72
#define ACPI_MTX_NAMESPACE
Definition: aclocal.h:85
_Must_inspect_result_ _In_opt_ PVOID OwnerId
Definition: fsrtlfuncs.h:907

Referenced by AcpiDsTerminateControlMethod(), AcpiNsLoadTable(), and AcpiTbDeleteNamespaceByOwner().

◆ AcpiNsDeleteNamespaceSubtree()

void AcpiNsDeleteNamespaceSubtree ( ACPI_NAMESPACE_NODE ParentHandle)

Definition at line 399 of file nsalloc.c.

401 {
402  ACPI_NAMESPACE_NODE *ChildNode = NULL;
403  UINT32 Level = 1;
405 
406 
407  ACPI_FUNCTION_TRACE (NsDeleteNamespaceSubtree);
408 
409 
410  if (!ParentNode)
411  {
412  return_VOID;
413  }
414 
415  /* Lock namespace for possible update */
416 
418  if (ACPI_FAILURE (Status))
419  {
420  return_VOID;
421  }
422 
423  /*
424  * Traverse the tree of objects until we bubble back up
425  * to where we started.
426  */
427  while (Level > 0)
428  {
429  /* Get the next node in this scope (NULL if none) */
430 
431  ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode);
432  if (ChildNode)
433  {
434  /* Found a child node - detach any attached object */
435 
436  AcpiNsDetachObject (ChildNode);
437 
438  /* Check if this node has any children */
439 
440  if (ChildNode->Child)
441  {
442  /*
443  * There is at least one child of this node,
444  * visit the node
445  */
446  Level++;
447  ParentNode = ChildNode;
448  ChildNode = NULL;
449  }
450  }
451  else
452  {
453  /*
454  * No more children of this parent node.
455  * Move up to the grandparent.
456  */
457  Level--;
458 
459  /*
460  * Now delete all of the children of this parent
461  * all at the same time.
462  */
463  AcpiNsDeleteChildren (ParentNode);
464 
465  /* New "last child" is this parent node */
466 
467  ChildNode = ParentNode;
468 
469  /* Move up the tree to the grandparent */
470 
471  ParentNode = ParentNode->Parent;
472  }
473  }
474 
476  return_VOID;
477 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
void AcpiNsDeleteChildren(ACPI_NAMESPACE_NODE *ParentNode)
Definition: nsalloc.c:341
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct acpi_namespace_node * Parent
Definition: aclocal.h:192
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
void AcpiNsDetachObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:220
#define return_VOID
Definition: acoutput.h:495
Status
Definition: gdiplustypes.h:24
struct acpi_namespace_node * Child
Definition: aclocal.h:193
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_NAMESPACE_NODE * AcpiNsGetNextNode(ACPI_NAMESPACE_NODE *Parent, ACPI_NAMESPACE_NODE *Child)
Definition: nswalk.c:72
#define ACPI_MTX_NAMESPACE
Definition: aclocal.h:85

Referenced by AcpiDsTerminateControlMethod(), and AcpiNsTerminate().

◆ AcpiNsDeleteNode()

void AcpiNsDeleteNode ( ACPI_NAMESPACE_NODE Node)

Definition at line 117 of file nsalloc.c.

119 {
120  ACPI_OPERAND_OBJECT *ObjDesc;
121  ACPI_OPERAND_OBJECT *NextDesc;
122 
123 
124  ACPI_FUNCTION_NAME (NsDeleteNode);
125 
126 
127  if (!Node)
128  {
129  return_VOID;
130  }
131 
132  /* Detach an object if there is one */
133 
135 
136  /*
137  * Delete an attached data object list if present (objects that were
138  * attached via AcpiAttachData). Note: After any normal object is
139  * detached above, the only possible remaining object(s) are data
140  * objects, in a linked list.
141  */
142  ObjDesc = Node->Object;
143  while (ObjDesc &&
144  (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA))
145  {
146  /* Invoke the attached data deletion handler if present */
147 
148  if (ObjDesc->Data.Handler)
149  {
150  ObjDesc->Data.Handler (Node, ObjDesc->Data.Pointer);
151  }
152 
153  NextDesc = ObjDesc->Common.NextObject;
154  AcpiUtRemoveReference (ObjDesc);
155  ObjDesc = NextDesc;
156  }
157 
158  /* Special case for the statically allocated root node */
159 
160  if (Node == AcpiGbl_RootNode)
161  {
162  return;
163  }
164 
165  /* Now we can delete the node */
166 
167  (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node);
168 
169  ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++);
170  ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Node %p, Remaining %X\n",
171  Node, AcpiGbl_CurrentNodeCount));
172 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
ACPI_OBJECT_DATA Data
Definition: acobject.h:539
#define ACPI_TYPE_LOCAL_DATA
Definition: actypes.h:727
void AcpiNsDetachObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:220
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_MEM_TRACKING(a)
Definition: actypes.h:387
#define return_VOID
Definition: acoutput.h:495
ACPI_STATUS AcpiOsReleaseObject(ACPI_CACHE_T *Cache, void *Object)
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479
#define ACPI_DB_ALLOCATIONS
Definition: acoutput.h:175
ACPI_OBJECT_COMMON_HEADER ACPI_OBJECT_HANDLER Handler
Definition: acobject.h:492
void * Pointer
Definition: acobject.h:493
Definition: dlist.c:348

Referenced by AcpiNsDeleteChildren(), AcpiNsRemoveNode(), and AcpiNsTerminate().

◆ AcpiNsDetachData()

ACPI_STATUS AcpiNsDetachData ( ACPI_NAMESPACE_NODE Node,
ACPI_OBJECT_HANDLER  Handler 
)

Definition at line 446 of file nsobject.c.

449 {
450  ACPI_OPERAND_OBJECT *ObjDesc;
451  ACPI_OPERAND_OBJECT *PrevObjDesc;
452 
453 
454  PrevObjDesc = NULL;
455  ObjDesc = Node->Object;
456  while (ObjDesc)
457  {
458  if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
459  (ObjDesc->Data.Handler == Handler))
460  {
461  if (PrevObjDesc)
462  {
463  PrevObjDesc->Common.NextObject = ObjDesc->Common.NextObject;
464  }
465  else
466  {
467  Node->Object = ObjDesc->Common.NextObject;
468  }
469 
470  AcpiUtRemoveReference (ObjDesc);
471  return (AE_OK);
472  }
473 
474  PrevObjDesc = ObjDesc;
475  ObjDesc = ObjDesc->Common.NextObject;
476  }
477 
478  return (AE_NOT_FOUND);
479 }
ACPI_OBJECT_DATA Data
Definition: acobject.h:539
#define ACPI_TYPE_LOCAL_DATA
Definition: actypes.h:727
smooth NULL
Definition: ftsmooth.c:416
#define AE_NOT_FOUND
Definition: acexcep.h:113
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:668
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define AE_OK
Definition: acexcep.h:97
ACPI_OBJECT_COMMON_HEADER ACPI_OBJECT_HANDLER Handler
Definition: acobject.h:492
Definition: dlist.c:348

Referenced by AcpiDetachData().

◆ AcpiNsDetachObject()

void AcpiNsDetachObject ( ACPI_NAMESPACE_NODE Node)

Definition at line 220 of file nsobject.c.

222 {
223  ACPI_OPERAND_OBJECT *ObjDesc;
224 
225 
226  ACPI_FUNCTION_TRACE (NsDetachObject);
227 
228 
229  ObjDesc = Node->Object;
230 
231  if (!ObjDesc ||
232  (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA))
233  {
234  return_VOID;
235  }
236 
237  if (Node->Flags & ANOBJ_ALLOCATED_BUFFER)
238  {
239  /* Free the dynamic aml buffer */
240 
241  if (ObjDesc->Common.Type == ACPI_TYPE_METHOD)
242  {
243  ACPI_FREE (ObjDesc->Method.AmlStart);
244  }
245  }
246 
247  if (ObjDesc->Common.Type == ACPI_TYPE_REGION)
248  {
250  }
251 
252  /* Clear the Node entry in all cases */
253 
254  Node->Object = NULL;
256  {
257  /* Unlink object from front of possible object list */
258 
259  Node->Object = ObjDesc->Common.NextObject;
260 
261  /* Handle possible 2-descriptor object */
262 
263  if (Node->Object &&
264  (Node->Object->Common.Type != ACPI_TYPE_LOCAL_DATA))
265  {
266  Node->Object = Node->Object->Common.NextObject;
267  }
268 
269  /*
270  * Detach the object from any data objects (which are still held by
271  * the namespace node)
272  */
273  if (ObjDesc->Common.NextObject &&
274  ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA))
275  {
276  ObjDesc->Common.NextObject = NULL;
277  }
278  }
279 
280  /* Reset the node type to untyped */
281 
282  Node->Type = ACPI_TYPE_ANY;
283 
284  ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n",
285  Node, AcpiUtGetNodeName (Node), ObjDesc));
286 
287  /* Remove one reference on the object (and all subobjects) */
288 
289  AcpiUtRemoveReference (ObjDesc);
290  return_VOID;
291 }
#define ACPI_FREE(a)
Definition: actypes.h:386
UINT8 * AmlStart
Definition: acobject.h:220
ACPI_OBJECT_COMMON_HEADER UINT8 SpaceId
Definition: acobject.h:202
#define ACPI_TYPE_LOCAL_DATA
Definition: actypes.h:727
smooth NULL
Definition: ftsmooth.c:416
ACPI_OBJECT_REGION Region
Definition: acobject.h:524
#define ACPI_DESC_TYPE_OPERAND
Definition: acobject.h:573
#define ACPI_TYPE_METHOD
Definition: actypes.h:686
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define return_VOID
Definition: acoutput.h:495
#define ACPI_TYPE_ANY
Definition: actypes.h:678
ACPI_OBJECT_METHOD Method
Definition: acobject.h:522
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_DB_NAMES
Definition: acoutput.h:166
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:305
#define ACPI_TYPE_REGION
Definition: actypes.h:688
#define ANOBJ_ALLOCATED_BUFFER
Definition: aclocal.h:221
void AcpiUtRemoveAddressRange(ACPI_ADR_SPACE_TYPE SpaceId, ACPI_NAMESPACE_NODE *RegionNode)
Definition: utaddress.c:139
Definition: dlist.c:348
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414

Referenced by AcpiDsMethodDataDeleteAll(), AcpiNsAttachObject(), AcpiNsDeleteNamespaceByOwner(), AcpiNsDeleteNamespaceSubtree(), and AcpiNsDeleteNode().

◆ AcpiNsDumpEntry()

void AcpiNsDumpEntry ( ACPI_HANDLE  Handle,
UINT32  DebugLevel 
)

◆ AcpiNsDumpObjectPaths()

void AcpiNsDumpObjectPaths ( ACPI_OBJECT_TYPE  Type,
UINT8  DisplayType,
UINT32  MaxDepth,
ACPI_OWNER_ID  OwnerId,
ACPI_HANDLE  StartHandle 
)

◆ AcpiNsDumpObjects()

void AcpiNsDumpObjects ( ACPI_OBJECT_TYPE  Type,
UINT8  DisplayType,
UINT32  MaxDepth,
ACPI_OWNER_ID  OwnerId,
ACPI_HANDLE  StartHandle 
)

◆ AcpiNsDumpOneObject()

ACPI_STATUS AcpiNsDumpOneObject ( ACPI_HANDLE  ObjHandle,
UINT32  Level,
void Context,
void **  ReturnValue 
)

◆ AcpiNsDumpPathname()

void AcpiNsDumpPathname ( ACPI_HANDLE  Handle,
const char Msg,
UINT32  Level,
UINT32  Component 
)

◆ AcpiNsDumpTables()

void AcpiNsDumpTables ( ACPI_HANDLE  SearchBase,
UINT32  MaxDepth 
)

◆ AcpiNsEvaluate()

ACPI_STATUS AcpiNsEvaluate ( ACPI_EVALUATE_INFO Info)

Definition at line 82 of file nseval.c.

84 {
86 
87 
88  ACPI_FUNCTION_TRACE (NsEvaluate);
89 
90 
91  if (!Info)
92  {
94  }
95 
96  if (!Info->Node)
97  {
98  /*
99  * Get the actual namespace node for the target object if we
100  * need to. Handles these cases:
101  *
102  * 1) Null node, valid pathname from root (absolute path)
103  * 2) Node and valid pathname (path relative to Node)
104  * 3) Node, Null pathname
105  */
106  Status = AcpiNsGetNode (Info->PrefixNode, Info->RelativePathname,
107  ACPI_NS_NO_UPSEARCH, &Info->Node);
108  if (ACPI_FAILURE (Status))
109  {
111  }
112  }
113 
114  /*
115  * For a method alias, we must grab the actual method node so that
116  * proper scoping context will be established before execution.
117  */
119  {
120  Info->Node = ACPI_CAST_PTR (
121  ACPI_NAMESPACE_NODE, Info->Node->Object);
122  }
123 
124  /* Complete the info block initialization */
125 
126  Info->ReturnObject = NULL;
127  Info->NodeFlags = Info->Node->Flags;
128  Info->ObjDesc = AcpiNsGetAttachedObject (Info->Node);
129 
130  ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
131  Info->RelativePathname, Info->Node,
132  AcpiNsGetAttachedObject (Info->Node)));
133 
134  /* Get info if we have a predefined name (_HID, etc.) */
135 
136  Info->Predefined = AcpiUtMatchPredefinedMethod (Info->Node->Name.Ascii);
137 
138  /* Get the full pathname to the object, for use in warning messages */
139 
140  Info->FullPathname = AcpiNsGetNormalizedPathname (Info->Node, TRUE);
141  if (!Info->FullPathname)
142  {
144  }
145 
146  /* Optional object evaluation log */
147 
149  "%-26s: %s (%s)\n", " Enter evaluation",
150  &Info->FullPathname[1], AcpiUtGetTypeName (Info->Node->Type)));
151 
152  /* Count the number of arguments being passed in */
153 
154  Info->ParamCount = 0;
155  if (Info->Parameters)
156  {
157  while (Info->Parameters[Info->ParamCount])
158  {
159  Info->ParamCount++;
160  }
161 
162  /* Warn on impossible argument count */
163 
164  if (Info->ParamCount > ACPI_METHOD_NUM_ARGS)
165  {
167  "Excess arguments (%u) - using only %u",
168  Info->ParamCount, ACPI_METHOD_NUM_ARGS));
169 
170  Info->ParamCount = ACPI_METHOD_NUM_ARGS;
171  }
172  }
173 
174  /*
175  * For predefined names: Check that the declared argument count
176  * matches the ACPI spec -- otherwise this is a BIOS error.
177  */
178  AcpiNsCheckAcpiCompliance (Info->FullPathname, Info->Node,
179  Info->Predefined);
180 
181  /*
182  * For all names: Check that the incoming argument count for
183  * this method/object matches the actual ASL/AML definition.
184  */
185  AcpiNsCheckArgumentCount (Info->FullPathname, Info->Node,
186  Info->ParamCount, Info->Predefined);
187 
188  /* For predefined names: Typecheck all incoming arguments */
189 
191 
192  /*
193  * Three major evaluation cases:
194  *
195  * 1) Object types that cannot be evaluated by definition
196  * 2) The object is a control method -- execute it
197  * 3) The object is not a method -- just return it's current value
198  */
199  switch (AcpiNsGetType (Info->Node))
200  {
201  case ACPI_TYPE_ANY:
202  case ACPI_TYPE_DEVICE:
203  case ACPI_TYPE_EVENT:
204  case ACPI_TYPE_MUTEX:
205  case ACPI_TYPE_REGION:
206  case ACPI_TYPE_THERMAL:
208  /*
209  * 1) Disallow evaluation of these object types. For these,
210  * object evaluation is undefined.
211  */
213  "%s: This object type [%s] "
214  "never contains data and cannot be evaluated",
215  Info->FullPathname, AcpiUtGetTypeName (Info->Node->Type)));
216 
217  Status = AE_TYPE;
218  goto Cleanup;
219 
220  case ACPI_TYPE_METHOD:
221  /*
222  * 2) Object is a control method - execute it
223  */
224 
225  /* Verify that there is a method object associated with this node */
226 
227  if (!Info->ObjDesc)
228  {
229  ACPI_ERROR ((AE_INFO, "%s: Method has no attached sub-object",
230  Info->FullPathname));
232  goto Cleanup;
233  }
234 
236  "**** Execute method [%s] at AML address %p length %X\n",
237  Info->FullPathname,
238  Info->ObjDesc->Method.AmlStart + 1,
239  Info->ObjDesc->Method.AmlLength - 1));
240 
241  /*
242  * Any namespace deletion must acquire both the namespace and
243  * interpreter locks to ensure that no thread is using the portion of
244  * the namespace that is being deleted.
245  *
246  * Execute the method via the interpreter. The interpreter is locked
247  * here before calling into the AML parser
248  */
252  break;
253 
254  default:
255  /*
256  * 3) All other non-method objects -- get the current object value
257  */
258 
259  /*
260  * Some objects require additional resolution steps (e.g., the Node
261  * may be a field that must be read, etc.) -- we can't just grab
262  * the object out of the node.
263  *
264  * Use ResolveNodeToValue() to get the associated value.
265  *
266  * NOTE: we can get away with passing in NULL for a walk state because
267  * the Node is guaranteed to not be a reference to either a method
268  * local or a method argument (because this interface is never called
269  * from a running method.)
270  *
271  * Even though we do not directly invoke the interpreter for object
272  * resolution, we must lock it because we could access an OpRegion.
273  * The OpRegion access code assumes that the interpreter is locked.
274  */
276 
277  /* TBD: ResolveNodeToValue has a strange interface, fix */
278 
279  Info->ReturnObject = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Info->Node);
280 
282  ACPI_NAMESPACE_NODE, &Info->ReturnObject), NULL);
284 
285  if (ACPI_FAILURE (Status))
286  {
287  Info->ReturnObject = NULL;
288  goto Cleanup;
289  }
290 
291  ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returned object %p [%s]\n",
292  Info->ReturnObject,
293  AcpiUtGetObjectTypeName (Info->ReturnObject)));
294 
295  Status = AE_CTRL_RETURN_VALUE; /* Always has a "return value" */
296  break;
297  }
298 
299  /*
300  * For predefined names, check the return value against the ACPI
301  * specification. Some incorrect return value types are repaired.
302  */
303  (void) AcpiNsCheckReturnValue (Info->Node, Info, Info->ParamCount,
304  Status, &Info->ReturnObject);
305 
306  /* Check if there is a return value that must be dealt with */
307 
309  {
310  /* If caller does not want the return value, delete it */
311 
312  if (Info->Flags & ACPI_IGNORE_RETURN_VALUE)
313  {
314  AcpiUtRemoveReference (Info->ReturnObject);
315  Info->ReturnObject = NULL;
316  }
317 
318  /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
319 
320  Status = AE_OK;
321  }
322  else if (ACPI_FAILURE(Status))
323  {
324  /* If ReturnObject exists, delete it */
325 
326  if (Info->ReturnObject)
327  {
328  AcpiUtRemoveReference (Info->ReturnObject);
329  Info->ReturnObject = NULL;
330  }
331  }
332 
334  "*** Completed evaluation of object %s ***\n",
335  Info->RelativePathname));
336 
337 Cleanup:
338  /* Optional object evaluation log */
339 
341  "%-26s: %s\n", " Exit evaluation",
342  &Info->FullPathname[1]));
343 
344  /*
345  * Namespace was unlocked by the handling AcpiNs* function, so we
346  * just free the pathname and return
347  */
348  ACPI_FREE (Info->FullPathname);
349  Info->FullPathname = NULL;
351 }
#define ACPI_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
#define AE_NULL_OBJECT
Definition: acexcep.h:117
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_WARN_ALWAYS
Definition: acnamesp.h:87
#define ACPI_TYPE_EVENT
Definition: actypes.h:685
#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
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
ACPI_STATUS AcpiNsCheckReturnValue(ACPI_NAMESPACE_NODE *Node, ACPI_EVALUATE_INFO *Info, UINT32 UserParamCount, ACPI_STATUS ReturnStatus, ACPI_OPERAND_OBJECT **ReturnObject)
Definition: nspredef.c:108
#define AE_CTRL_RETURN_VALUE
Definition: acexcep.h:224
void AcpiNsCheckArgumentCount(char *Pathname, ACPI_NAMESPACE_NODE *Node, UINT32 UserParamCount, const ACPI_PREDEFINED_INFO *Info)
Definition: nsarguments.c:226
void AcpiNsCheckAcpiCompliance(char *Pathname, ACPI_NAMESPACE_NODE *Node, const ACPI_PREDEFINED_INFO *Predefined)
Definition: nsarguments.c:133
UINT32 ACPI_STATUS
Definition: actypes.h:460
const ACPI_PREDEFINED_INFO * AcpiUtMatchPredefinedMethod(char *Name)
Definition: utpredef.c:114
struct TraceInfo Info
ACPI_OBJECT_TYPE AcpiNsGetType(ACPI_NAMESPACE_NODE *Node)
Definition: nsutils.c:120
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiNsGetNode(ACPI_NAMESPACE_NODE *PrefixNode, const char *ExternalPathname, UINT32 Flags, ACPI_NAMESPACE_NODE **OutNode)
Definition: nsutils.c:863
ACPI_STATUS AcpiExResolveNodeToValue(ACPI_NAMESPACE_NODE **ObjectPtr, ACPI_WALK_STATE *WalkState)
Definition: exresnte.c:82
ACPI_STATUS AcpiPsExecuteMethod(ACPI_EVALUATE_INFO *Info)
Definition: psxface.c:131
#define ACPI_WARN_PREDEFINED(plist)
Definition: acmacros.h:464
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_TYPE_LOCAL_METHOD_ALIAS
Definition: actypes.h:712
#define ACPI_TYPE_METHOD
Definition: actypes.h:686
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
#define ACPI_TYPE_ANY
Definition: actypes.h:678
#define ACPI_TYPE_DEVICE
Definition: actypes.h:684
#define AE_TYPE
Definition: acexcep.h:116
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
char * AcpiNsGetNormalizedPathname(ACPI_NAMESPACE_NODE *Node, BOOLEAN NoTrailing)
Definition: nsnames.c:373
#define ACPI_DB_EXEC
Definition: acoutput.h:165
void AcpiExExitInterpreter(void)
Definition: exutils.c:139
void AcpiNsCheckArgumentTypes(ACPI_EVALUATE_INFO *Info)
Definition: nsarguments.c:68
#define ACPI_CAST_INDIRECT_PTR(t, p)
Definition: actypes.h:545
void AcpiExEnterInterpreter(void)
Definition: exutils.c:91
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_NS_NO_UPSEARCH
Definition: acnamesp.h:62
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_DB_NAMES
Definition: acoutput.h:166
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
const char * AcpiUtGetTypeName(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:249
#define ACPI_TYPE_MUTEX
Definition: actypes.h:687
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_DB_EVALUATION
Definition: acoutput.h:181
#define ACPI_TYPE_REGION
Definition: actypes.h:688
#define ACPI_TYPE_LOCAL_SCOPE
Definition: actypes.h:717
#define ACPI_IGNORE_RETURN_VALUE
Definition: acstruct.h:231
#define ACPI_METHOD_NUM_ARGS
Definition: acconfig.h:166
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
const char * AcpiUtGetObjectTypeName(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: utdecode.c:263
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiEvaluateObject(), AcpiEvAsynchExecuteGpeMethod(), AcpiEvExecuteRegMethod(), AcpiGetSleepTypeData(), AcpiNsInitializeDevices(), AcpiNsInitOneDevice(), AcpiRsSetSrsMethodData(), and AcpiUtEvaluateObject().

◆ AcpiNsExecuteTable()

ACPI_STATUS AcpiNsExecuteTable ( UINT32  TableIndex,
ACPI_NAMESPACE_NODE StartNode 
)

Definition at line 81 of file nsparse.c.

84 {
89  UINT32 AmlLength;
90  UINT8 *AmlStart;
91  ACPI_OPERAND_OBJECT *MethodObj = NULL;
92 
93 
94  ACPI_FUNCTION_TRACE (NsExecuteTable);
95 
96 
97  Status = AcpiGetTableByIndex (TableIndex, &Table);
98  if (ACPI_FAILURE (Status))
99  {
101  }
102 
103  /* Table must consist of at least a complete header */
104 
105  if (Table->Length < sizeof (ACPI_TABLE_HEADER))
106  {
108  }
109 
110  AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
111  AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
112 
113  Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
114  if (ACPI_FAILURE (Status))
115  {
117  }
118 
119  /* Create, initialize, and link a new temporary method object */
120 
122  if (!MethodObj)
123  {
125  }
126 
127  /* Allocate the evaluation information block */
128 
130  if (!Info)
131  {
133  goto Cleanup;
134  }
135 
137  "%s: Create table pseudo-method for [%4.4s] @%p, method %p\n",
138  ACPI_GET_FUNCTION_NAME, Table->Signature, Table, MethodObj));
139 
140  MethodObj->Method.AmlStart = AmlStart;
141  MethodObj->Method.AmlLength = AmlLength;
142  MethodObj->Method.OwnerId = OwnerId;
144 
145  Info->PassNumber = ACPI_IMODE_EXECUTE;
146  Info->Node = StartNode;
147  Info->ObjDesc = MethodObj;
148  Info->NodeFlags = Info->Node->Flags;
149  Info->FullPathname = AcpiNsGetNormalizedPathname (Info->Node, TRUE);
150  if (!Info->FullPathname)
151  {
153  goto Cleanup;
154  }
155 
156  /* Optional object evaluation log */
157 
159  "%-26s: (Definition Block level)\n", "Module-level evaluation"));
160 
162 
163  /* Optional object evaluation log */
164 
166  "%-26s: (Definition Block level)\n", "Module-level complete"));
167 
168 Cleanup:
169  if (Info)
170  {
171  ACPI_FREE (Info->FullPathname);
172  Info->FullPathname = NULL;
173  }
174  ACPI_FREE (Info);
175  AcpiUtRemoveReference (MethodObj);
177 }
#define ACPI_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
#define ACPI_FREE(a)
Definition: actypes.h:386
UINT8 * AmlStart
Definition: acobject.h:220
ASMGENDATA Table[]
Definition: genincdata.c:61
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define TRUE
Definition: types.h:120
#define AE_NO_MEMORY
Definition: acexcep.h:112
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
ACPI_OBJECT_COMMON_HEADER UINT8 InfoFlags
Definition: acobject.h:215
ACPI_STATUS AcpiTbGetOwnerId(UINT32 TableIndex, ACPI_OWNER_ID *OwnerId)
Definition: tbdata.c:958
#define ACPI_DB_PARSE
Definition: acoutput.h:162
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
ACPI_STATUS AcpiPsExecuteTable(ACPI_EVALUATE_INFO *Info)
Definition: psxface.c:297
struct acpi_table_header ACPI_TABLE_HEADER
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiGetTableByIndex(UINT32 TableIndex, ACPI_TABLE_HEADER **OutTable)
Definition: tbxface.c:491
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_TYPE_METHOD
Definition: actypes.h:686
UINT16 ACPI_OWNER_ID
Definition: actypes.h:486
#define ACPI_METHOD_MODULE_LEVEL
Definition: acobject.h:235
static const WCHAR Cleanup[]
Definition: register.c:80
#define ACPI_GET_FUNCTION_NAME
Definition: acgcc.h:67
Status
Definition: gdiplustypes.h:24
ACPI_OBJECT_METHOD Method
Definition: acobject.h:522
#define AE_BAD_HEADER
Definition: acexcep.h:168
char * AcpiNsGetNormalizedPathname(ACPI_NAMESPACE_NODE *Node, BOOLEAN NoTrailing)
Definition: nsnames.c:373
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_DB_EVALUATION
Definition: acoutput.h:181
ACPI_OWNER_ID OwnerId
Definition: acobject.h:228
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:655
_Must_inspect_result_ _In_opt_ PVOID OwnerId
Definition: fsrtlfuncs.h:907
unsigned char UINT8

Referenced by AcpiNsParseTable().

◆ AcpiNsExternalizeName()

ACPI_STATUS AcpiNsExternalizeName ( UINT32  InternalNameLength,
const char InternalName,
UINT32 ConvertedNameLength,
char **  ConvertedName 
)

Definition at line 470 of file nsutils.c.

475 {
476  UINT32 NamesIndex = 0;
477  UINT32 NumSegments = 0;
479  UINT32 PrefixLength = 0;
480  UINT32 i = 0;
481  UINT32 j = 0;
482 
483 
484  ACPI_FUNCTION_TRACE (NsExternalizeName);
485 
486 
487  if (!InternalNameLength ||
488  !InternalName ||
489  !ConvertedName)
490  {
492  }
493 
494  /* Check for a prefix (one '\' | one or more '^') */
495 
496  switch (InternalName[0])
497  {
498  case AML_ROOT_PREFIX:
499 
500  PrefixLength = 1;
501  break;
502 
503  case AML_PARENT_PREFIX:
504 
505  for (i = 0; i < InternalNameLength; i++)
506  {
507  if (ACPI_IS_PARENT_PREFIX (InternalName[i]))
508  {
509  PrefixLength = i + 1;
510  }
511  else
512  {
513  break;
514  }
515  }
516 
517  if (i == InternalNameLength)
518  {
519  PrefixLength = i;
520  }
521 
522  break;
523 
524  default:
525 
526  break;
527  }
528 
529  /*
530  * Check for object names. Note that there could be 0-255 of these
531  * 4-byte elements.
532  */
533  if (PrefixLength < InternalNameLength)
534  {
535  switch (InternalName[PrefixLength])
536  {
538 
539  /* <count> 4-byte names */
540 
541  NamesIndex = PrefixLength + 2;
542  NumSegments = (UINT8)
543  InternalName[(ACPI_SIZE) PrefixLength + 1];
544  break;
545 
547 
548  /* Two 4-byte names */
549 
550  NamesIndex = PrefixLength + 1;
551  NumSegments = 2;
552  break;
553 
554  case 0:
555 
556  /* NullName */
557 
558  NamesIndex = 0;
559  NumSegments = 0;
560  break;
561 
562  default:
563 
564  /* one 4-byte name */
565 
566  NamesIndex = PrefixLength;
567  NumSegments = 1;
568  break;
569  }
570  }
571 
572  /*
573  * Calculate the length of ConvertedName, which equals the length
574  * of the prefix, length of all object names, length of any required
575  * punctuation ('.') between object names, plus the NULL terminator.
576  */
577  RequiredLength = PrefixLength + (4 * NumSegments) +
578  ((NumSegments > 0) ? (NumSegments - 1) : 0) + 1;
579 
580  /*
581  * Check to see if we're still in bounds. If not, there's a problem
582  * with InternalName (invalid format).
583  */
584  if (RequiredLength > InternalNameLength)
585  {
586  ACPI_ERROR ((AE_INFO, "Invalid internal name"));
588  }
589 
590  /* Build the ConvertedName */
591 
592  *ConvertedName = ACPI_ALLOCATE_ZEROED (RequiredLength);
593  if (!(*ConvertedName))
594  {
596  }
597 
598  j = 0;
599 
600  for (i = 0; i < PrefixLength; i++)
601  {
602  (*ConvertedName)[j++] = InternalName[i];
603  }
604 
605  if (NumSegments > 0)
606  {
607  for (i = 0; i < NumSegments; i++)
608  {
609  if (i > 0)
610  {
611  (*ConvertedName)[j++] = '.';
612  }
613 
614  /* Copy and validate the 4-char name segment */
615 
616  ACPI_COPY_NAMESEG (&(*ConvertedName)[j],
617  &InternalName[NamesIndex]);
618  AcpiUtRepairName (&(*ConvertedName)[j]);
619 
620  j += ACPI_NAMESEG_SIZE;
621  NamesIndex += ACPI_NAMESEG_SIZE;
622  }
623  }
624 
625  if (ConvertedNameLength)
626  {
627  *ConvertedNameLength = (UINT32) RequiredLength;
628  }
629 
631 }
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
void AcpiUtRepairName(char *Name)
Definition: utstring.c:183
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
unsigned int UINT32
#define AE_BAD_PATHNAME
Definition: acexcep.h:153
#define AML_DUAL_NAME_PREFIX
Definition: amlcode.h:66
#define AE_INFO
Definition: acoutput.h:230
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 GLint GLint j
Definition: glfuncs.h:250
#define AML_PARENT_PREFIX
Definition: amlcode.h:70
#define AML_ROOT_PREFIX
Definition: amlcode.h:69
#define ACPI_COPY_NAMESEG(dest, src)
Definition: actypes.h:562
#define ACPI_IS_PARENT_PREFIX(c)
Definition: acmacros.h:402
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:29
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AML_MULTI_NAME_PREFIX
Definition: amlcode.h:67
#define ACPI_NAMESEG_SIZE
Definition: actypes.h:415
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiDsResolvePackageElement(), AcpiNsBuildPrefixedPathname(), and AcpiNsLookup().

◆ AcpiNsGetAttachedData()

ACPI_STATUS AcpiNsGetAttachedData ( ACPI_NAMESPACE_NODE Node,
ACPI_OBJECT_HANDLER  Handler,
void **  Data 
)

Definition at line 498 of file nsobject.c.

502 {
503  ACPI_OPERAND_OBJECT *ObjDesc;
504 
505 
506  ObjDesc = Node->Object;
507  while (ObjDesc)
508  {
509  if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
510  (ObjDesc->Data.Handler == Handler))
511  {
512  *Data = ObjDesc->Data.Pointer;
513  return (AE_OK);
514  }
515 
516  ObjDesc = ObjDesc->Common.NextObject;
517  }
518 
519  return (AE_NOT_FOUND);
520 }
ACPI_OBJECT_DATA Data
Definition: acobject.h:539
#define ACPI_TYPE_LOCAL_DATA
Definition: actypes.h:727
#define AE_NOT_FOUND
Definition: acexcep.h:113
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:668
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
#define AE_OK
Definition: acexcep.h:97
ACPI_OBJECT_COMMON_HEADER ACPI_OBJECT_HANDLER Handler
Definition: acobject.h:492
void * Pointer
Definition: acobject.h:493
Definition: dlist.c:348

Referenced by AcpiGetData().

◆ AcpiNsGetAttachedObject()

ACPI_OPERAND_OBJECT* AcpiNsGetAttachedObject ( ACPI_NAMESPACE_NODE Node)

Definition at line 308 of file nsobject.c.

310 {
311  ACPI_FUNCTION_TRACE_PTR (NsGetAttachedObject, Node);
312 
313 
314  if (!Node)
315  {
316  ACPI_WARNING ((AE_INFO, "Null Node ptr"));
317  return_PTR (NULL);
318  }
319 
320  if (!Node->Object ||
323  ((Node->Object)->Common.Type == ACPI_TYPE_LOCAL_DATA))
324  {
325  return_PTR (NULL);
326  }
327 
328  return_PTR (Node->Object);
329 }
#define return_PTR(s)
Definition: acoutput.h:497
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
#define ACPI_TYPE_LOCAL_DATA
Definition: actypes.h:727
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_DESC_TYPE_OPERAND
Definition: acobject.h:573
#define ACPI_DESC_TYPE_NAMED
Definition: acobject.h:574
Definition: dlist.c:348
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414

Referenced by AcpiDsCallControlMethod(), AcpiDsCreateBufferField(), AcpiDsCreateNode(), AcpiDsEvalBankFieldOperands(), AcpiDsEvalBufferFieldOperands(), AcpiDsEvalRegionOperands(), AcpiDsEvalTableRegionOperands(), AcpiDsExecEndOp(), AcpiDsGetFieldNames(), AcpiDsInitAmlWalk(), AcpiDsInitializeRegion(), AcpiDsInitOneObject(), AcpiDsLoad1EndOp(), AcpiDsLoad2EndOp(), AcpiDsMethodDataDeleteValue(), AcpiDsStoreObjectToLocal(), AcpiEvGetGpeEventInfo(), AcpiEvHasDefaultHandler(), AcpiEvInitializeRegion(), AcpiEvInstallHandler(), AcpiEvInstallSpaceHandler(), AcpiEvQueueNotifyRequest(), AcpiEvRegRun(), AcpiExCreateRegion(), AcpiExOpcode_1A_0T_1R(), AcpiExPrepFieldValue(), AcpiExResolveMultiple(), AcpiExResolveNodeToValue(), AcpiExResolveOperands(), AcpiExStoreObjectToNode(), AcpiInstallGpeBlock(), AcpiInstallNotifyHandler(), AcpiNsEvaluate(), AcpiNsInitOneObject(), AcpiNsInitOnePackage(), AcpiPsGetNextNamepath(), AcpiRemoveAddressSpaceHandler(), AcpiRemoveGpeBlock(), AcpiRemoveNotifyHandler(), and AcpiUtGetMutexObject().

◆ AcpiNsGetExternalPathname()

char* AcpiNsGetExternalPathname ( ACPI_NAMESPACE_NODE Node)

Definition at line 76 of file nsnames.c.

78 {
79  char *NameBuffer;
80 
81 
82  ACPI_FUNCTION_TRACE_PTR (NsGetExternalPathname, Node);
83 
84 
85  NameBuffer = AcpiNsGetNormalizedPathname (Node, FALSE);
86  return_PTR (NameBuffer);
87 }
#define return_PTR(s)
Definition: acoutput.h:497
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
char * AcpiNsGetNormalizedPathname(ACPI_NAMESPACE_NODE *Node, BOOLEAN NoTrailing)
Definition: nsnames.c:373
Definition: dlist.c:348

Referenced by AcpiDsGetFieldNames(), and AcpiEvaluateObjectTyped().

◆ AcpiNsGetInternalNameLength()

void AcpiNsGetInternalNameLength ( ACPI_NAMESTRING_INFO Info)

Definition at line 183 of file nsutils.c.

185 {
186  const char *NextExternalChar;
187  UINT32 i;
188 
189 
191 
192 
193  NextExternalChar = Info->ExternalName;
194  Info->NumCarats = 0;
195  Info->NumSegments = 0;
196  Info->FullyQualified = FALSE;
197 
198  /*
199  * For the internal name, the required length is 4 bytes per segment,
200  * plus 1 each for RootPrefix, MultiNamePrefixOp, segment count,
201  * trailing null (which is not really needed, but no there's harm in
202  * putting it there)
203  *
204  * strlen() + 1 covers the first NameSeg, which has no path separator
205  */
206  if (ACPI_IS_ROOT_PREFIX (*NextExternalChar))
207  {
208  Info->FullyQualified = TRUE;
209  NextExternalChar++;
210 
211  /* Skip redundant RootPrefix, like \\_SB.PCI0.SBRG.EC0 */
212 
213  while (ACPI_IS_ROOT_PREFIX (*NextExternalChar))
214  {
215  NextExternalChar++;
216  }
217  }
218  else
219  {
220  /* Handle Carat prefixes */
221 
222  while (ACPI_IS_PARENT_PREFIX (*NextExternalChar))
223  {
224  Info->NumCarats++;
225  NextExternalChar++;
226  }
227  }
228 
229  /*
230  * Determine the number of ACPI name "segments" by counting the number of
231  * path separators within the string. Start with one segment since the
232  * segment count is [(# separators) + 1], and zero separators is ok.
233  */
234  if (*NextExternalChar)
235  {
236  Info->NumSegments = 1;
237  for (i = 0; NextExternalChar[i]; i++)
238  {
239  if (ACPI_IS_PATH_SEPARATOR (NextExternalChar[i]))
240  {
241  Info->NumSegments++;
242  }
243  }
244  }
245 
246  Info->Length = (ACPI_NAMESEG_SIZE * Info->NumSegments) +
247  4 + Info->NumCarats;
248 
249  Info->NextExternalChar = NextExternalChar;
250 }
#define TRUE
Definition: types.h:120
struct TraceInfo Info
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
#define ACPI_IS_PATH_SEPARATOR(c)
Definition: acmacros.h:403
unsigned int UINT32
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
#define ACPI_IS_PARENT_PREFIX(c)
Definition: acmacros.h:402
#define ACPI_IS_ROOT_PREFIX(c)
Definition: acmacros.h:401
#define ACPI_NAMESEG_SIZE
Definition: actypes.h:415

Referenced by AcpiNsInternalizeName().

◆ AcpiNsGetNextNode()

ACPI_NAMESPACE_NODE* AcpiNsGetNextNode ( ACPI_NAMESPACE_NODE Parent,
ACPI_NAMESPACE_NODE Child 
)

Definition at line 72 of file nswalk.c.

75 {
77 
78 
79  if (!ChildNode)
80  {
81  /* It's really the parent's _scope_ that we want */
82 
83  return (ParentNode->Child);
84  }
85 
86  /* Otherwise just return the next peer */
87 
88  return (ChildNode->Peer);
89 }
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484

Referenced by AcpiEvOrphanEcRegMethod(), AcpiNsDeleteNamespaceByOwner(), AcpiNsDeleteNamespaceSubtree(), AcpiNsGetNextNodeTyped(), and AcpiNsWalkNamespace().

◆ AcpiNsGetNextNodeTyped()

ACPI_NAMESPACE_NODE* AcpiNsGetNextNodeTyped ( ACPI_OBJECT_TYPE  Type,
ACPI_NAMESPACE_NODE Parent,
ACPI_NAMESPACE_NODE Child 
)

Definition at line 112 of file nswalk.c.

116 {
117  ACPI_NAMESPACE_NODE *NextNode = NULL;
118 
119 
121 
122 
123  NextNode = AcpiNsGetNextNode (ParentNode, ChildNode);
124 
125  /* If any type is OK, we are done */
126 
127  if (Type == ACPI_TYPE_ANY)
128  {
129  /* NextNode is NULL if we are at the end-of-list */
130 
131  return (NextNode);
132  }
133 
134  /* Must search for the node -- but within this scope only */
135 
136  while (NextNode)
137  {
138  /* If type matches, we are done */
139 
140  if (NextNode->Type == Type)
141  {
142  return (NextNode);
143  }
144 
145  /* Otherwise, move on to the next peer node */
146 
147  NextNode = NextNode->Peer;
148  }
149 
150  /* Not found */
151 
152  return (NULL);
153 }
Type
Definition: Type.h:6
ACPI_NAMESPACE_NODE * AcpiNsGetNextNode(ACPI_NAMESPACE_NODE *ParentNode, ACPI_NAMESPACE_NODE *ChildNode)
Definition: nswalk.c:72
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
struct acpi_namespace_node * Peer
Definition: aclocal.h:194
#define ACPI_TYPE_ANY
Definition: actypes.h:678

Referenced by AcpiGetNextObject().

◆ AcpiNsGetNode()

ACPI_STATUS AcpiNsGetNode ( ACPI_NAMESPACE_NODE PrefixNode,
const char ExternalPathname,
UINT32  Flags,
ACPI_NAMESPACE_NODE **  OutNode 
)

Definition at line 863 of file nsutils.c.

868 {
870 
871 
872  ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname));
873 
874 
876  if (ACPI_FAILURE (Status))
877  {
879  }
880 
881  Status = AcpiNsGetNodeUnlocked (PrefixNode, Pathname,
882  Flags, ReturnNode);
883 
886 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
UINT32 ACPI_STATUS
Definition: actypes.h:460
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
ACPI_STATUS AcpiNsGetNodeUnlocked(ACPI_NAMESPACE_NODE *PrefixNode, const char *Pathname, UINT32 Flags, ACPI_NAMESPACE_NODE **ReturnNode)
Definition: nsutils.c:777
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_MTX_NAMESPACE
Definition: aclocal.h:85
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
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 Pathname
Definition: acpixf.h:700

Referenced by AcpiGetHandle(), AcpiNsEvaluate(), AcpiNsRepair_TSS(), AcpiNsRootInitialize(), and AcpiUtMethodError().

◆ AcpiNsGetNodeUnlocked()

ACPI_STATUS AcpiNsGetNodeUnlocked ( ACPI_NAMESPACE_NODE PrefixNode,
const char ExternalPathname,
UINT32  Flags,
ACPI_NAMESPACE_NODE **  OutNode 
)

Definition at line 777 of file nsutils.c.

782 {
783  ACPI_GENERIC_STATE ScopeInfo;
785  char *InternalPath;
786 
787 
788  ACPI_FUNCTION_TRACE_PTR (NsGetNodeUnlocked, ACPI_CAST_PTR (char, Pathname));
789 
790 
791  /* Simplest case is a null pathname */
792 
793  if (!Pathname)
794  {
795  *ReturnNode = PrefixNode;
796  if (!PrefixNode)
797  {
798  *ReturnNode = AcpiGbl_RootNode;
799  }
800 
802  }
803 
804  /* Quick check for a reference to the root */
805 
806  if (ACPI_IS_ROOT_PREFIX (Pathname[0]) && (!Pathname[1]))
807  {
808  *ReturnNode = AcpiGbl_RootNode;
810  }
811 
812  /* Convert path to internal representation */
813 
815  if (ACPI_FAILURE (Status))
816  {
818  }
819 
820  /* Setup lookup scope (search starting point) */
821 
822  ScopeInfo.Scope.Node = PrefixNode;
823 
824  /* Lookup the name in the namespace */
825 
828  NULL, ReturnNode);
829  if (ACPI_FAILURE (Status))
830  {
831  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s, %s\n",
833  }
834 
837 }
ACPI_STATUS AcpiNsInternalizeName(const char *ExternalName, char **ConvertedName)
Definition: nsutils.c:405
#define ACPI_FREE(a)
Definition: actypes.h:386
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:329
UINT32 ACPI_STATUS
Definition: actypes.h:460
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
const char * AcpiFormatException(ACPI_STATUS Status)
Definition: utexcep.c:70
#define ACPI_NS_DONT_OPEN_SCOPE
Definition: acnamesp.h:64
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_TYPE_ANY
Definition: actypes.h:678
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_STATE_COMMON ACPI_NAMESPACE_NODE * Node
Definition: aclocal.h:740
#define ACPI_IS_ROOT_PREFIX(c)
Definition: acmacros.h:401
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define AE_OK
Definition: acexcep.h:97
ACPI_SCOPE_STATE Scope
Definition: aclocal.h:825
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 Pathname
Definition: acpixf.h:700

Referenced by AcpiExLoadTableOp(), AcpiExOpcode_1A_0T_1R(), and AcpiNsGetNode().

◆ AcpiNsGetNormalizedPathname()

char* AcpiNsGetNormalizedPathname ( ACPI_NAMESPACE_NODE Node,
BOOLEAN  NoTrailing 
)

Definition at line 373 of file nsnames.c.

376 {
377  char *NameBuffer;
378  ACPI_SIZE Size;
379 
380 
381  ACPI_FUNCTION_TRACE_PTR (NsGetNormalizedPathname, Node);
382 
383 
384  /* Calculate required buffer size based on depth below root */
385 
386  Size = AcpiNsBuildNormalizedPath (Node, NULL, 0, NoTrailing);
387  if (!Size)
388  {
389  return_PTR (NULL);
390  }
391 
392  /* Allocate a buffer to be returned to caller */
393 
394  NameBuffer = ACPI_ALLOCATE_ZEROED (Size);
395  if (!NameBuffer)
396  {
398  "Could not allocate %u bytes", (UINT32) Size));
399  return_PTR (NULL);
400  }
401 
402  /* Build the path in the allocated buffer */
403 
404  (void) AcpiNsBuildNormalizedPath (Node, NameBuffer, Size, NoTrailing);
405 
406  ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "%s: Path \"%s\"\n",
407  ACPI_GET_FUNCTION_NAME, NameBuffer));
408 
409  return_PTR (NameBuffer);
410 }
#define ACPI_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define return_PTR(s)
Definition: acoutput.h:497
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
unsigned int UINT32
UINT32 AcpiNsBuildNormalizedPath(ACPI_NAMESPACE_NODE *Node, char *FullPath, UINT32 PathSize, BOOLEAN NoTrailing)
Definition: nsnames.c:262
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define ACPI_GET_FUNCTION_NAME
Definition: acgcc.h:67
#define ACPI_DB_NAMES
Definition: acoutput.h:166
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
Definition: dlist.c:348

Referenced by AcpiDsCallControlMethod(), AcpiExStartTraceMethod(), AcpiExStopTraceMethod(), AcpiNsBuildPrefixedPathname(), AcpiNsEvaluate(), AcpiNsExecuteTable(), AcpiNsGetExternalPathname(), AcpiNsInitOneDevice(), AcpiNsSearchOneScope(), and AcpiUtCheckAddressRange().

◆ AcpiNsGetPathnameLength()

ACPI_SIZE AcpiNsGetPathnameLength ( ACPI_NAMESPACE_NODE Node)

Definition at line 103 of file nsnames.c.

105 {
106  ACPI_SIZE Size;
107 
108 
109  /* Validate the Node */
110 
112  {
114  "Invalid/cached reference target node: %p, descriptor type %d",
116  return (0);
117  }
118 
120  return (Size);
121 }
UINT32 AcpiNsBuildNormalizedPath(ACPI_NAMESPACE_NODE *Node, char *FullPath, UINT32 PathSize, BOOLEAN NoTrailing)
Definition: nsnames.c:262
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_DESC_TYPE_NAMED
Definition: acobject.h:574
Definition: dlist.c:348
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414

Referenced by AcpiRsGetPciRoutingTableLength(), and AcpiUtGetSimpleObjectSize().

◆ AcpiNsGetSecondaryObject()

ACPI_OPERAND_OBJECT* AcpiNsGetSecondaryObject ( ACPI_OPERAND_OBJECT ObjDesc)

Definition at line 346 of file nsobject.c.

348 {
349  ACPI_FUNCTION_TRACE_PTR (NsGetSecondaryObject, ObjDesc);
350 
351 
352  if ((!ObjDesc) ||
353  (ObjDesc->Common.Type== ACPI_TYPE_LOCAL_DATA) ||
354  (!ObjDesc->Common.NextObject) ||
355  ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA))
356  {
357  return_PTR (NULL);
358  }
359 
360  return_PTR (ObjDesc->Common.NextObject);
361 }
#define return_PTR(s)
Definition: acoutput.h:497
#define ACPI_TYPE_LOCAL_DATA
Definition: actypes.h:727
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516

Referenced by AcpiDsGetBankFieldArguments(), AcpiDsGetBufferFieldArguments(), AcpiDsGetRegionArguments(), AcpiEvAddressSpaceDispatch(), AcpiEvDetachRegion(), AcpiEvExecuteRegMethod(), AcpiExCreateRegion(), and AcpiUtDeleteInternalObj().

◆ AcpiNsGetType()

ACPI_OBJECT_TYPE AcpiNsGetType ( ACPI_NAMESPACE_NODE Node)

Definition at line 120 of file nsutils.c.

122 {
123  ACPI_FUNCTION_TRACE (NsGetType);
124 
125 
126  if (!Node)
127  {
128  ACPI_WARNING ((AE_INFO, "Null Node parameter"));
130  }
131 
132  return_UINT8 (Node->Type);
133 }
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_TYPE_ANY
Definition: actypes.h:678
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define return_UINT8(s)
Definition: acoutput.h:500
Definition: dlist.c:348

Referenced by AcpiDsInitOneObject(), AcpiEvaluateObject(), AcpiExPrepFieldValue(), AcpiExResolveMultiple(), AcpiExResolveNodeToValue(), AcpiExStoreObjectToNode(), AcpiNsEvaluate(), AcpiNsInitOneObject(), AcpiNsSearchOneScope(), and AcpiUtCopyIsimpleToEsimple().

◆ AcpiNsHandleToName()

ACPI_STATUS AcpiNsHandleToName ( ACPI_HANDLE  TargetHandle,
ACPI_BUFFER Buffer 
)

Definition at line 139 of file nsnames.c.

142 {
145  const char *NodeName;
146 
147 
148  ACPI_FUNCTION_TRACE_PTR (NsHandleToName, TargetHandle);
149 
150 
152  if (!Node)
153  {
155  }
156 
157  /* Validate/Allocate/Clear caller buffer */
158 
160  if (ACPI_FAILURE (Status))
161  {
163  }
164 
165  /* Just copy the ACPI name from the Node and zero terminate it */
166 
168  ACPI_COPY_NAMESEG (Buffer->Pointer, NodeName);
169  ((char *) Buffer->Pointer) [ACPI_NAMESEG_SIZE] = 0;
170 
171  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%4.4s\n", (char *) Buffer->Pointer));
173 }
ACPI_STATUS AcpiUtInitializeBuffer(ACPI_BUFFER *Buffer, ACPI_SIZE RequiredLength)
Definition: utalloc.c:336
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
union node Node
Definition: types.h:1255
Definition: bufpool.h:45
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
static const char * NodeName(const NOTIFICATIONLIST *item)
Definition: changenotify.c:145
#define ACPI_COPY_NAMESEG(dest, src)
Definition: actypes.h:562
#define ACPI_PATH_SEGMENT_LENGTH
Definition: actypes.h:416
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:305
ACPI_NAMESPACE_NODE * AcpiNsValidateHandle(ACPI_HANDLE Handle)
Definition: nsutils.c:655
#define ACPI_NAMESEG_SIZE
Definition: actypes.h:415
#define AE_OK
Definition: acexcep.h:97
_In_ HANDLE _In_opt_ HANDLE _Out_opt_ PHANDLE TargetHandle
Definition: obfuncs.h:429
Definition: dlist.c:348

Referenced by AcpiGetName().

◆ AcpiNsHandleToPathname()

ACPI_STATUS AcpiNsHandleToPathname ( ACPI_HANDLE  TargetHandle,
ACPI_BUFFER Buffer,
BOOLEAN  NoTrailing 
)

Definition at line 193 of file nsnames.c.

197 {
200  ACPI_SIZE RequiredSize;
201 
202 
203  ACPI_FUNCTION_TRACE_PTR (NsHandleToPathname, TargetHandle);
204 
205 
207  if (!Node)
208  {
210  }
211 
212  /* Determine size required for the caller buffer */
213 
214  RequiredSize = AcpiNsBuildNormalizedPath (Node, NULL, 0, NoTrailing);
215  if (!RequiredSize)
216  {
218  }
219 
220  /* Validate/Allocate/Clear caller buffer */
221 
223  if (ACPI_FAILURE (Status))
224  {
226  }
227 
228  /* Build the path in the caller buffer */
229 
231  RequiredSize, NoTrailing);
232 
233  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X]\n",
234  (char *) Buffer->Pointer, (UINT32) RequiredSize));
236 }
ACPI_STATUS AcpiUtInitializeBuffer(ACPI_BUFFER *Buffer, ACPI_SIZE RequiredLength)
Definition: utalloc.c:336
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
unsigned int UINT32
union node Node
Definition: types.h:1255
UINT32 AcpiNsBuildNormalizedPath(ACPI_NAMESPACE_NODE *Node, char *FullPath, UINT32 PathSize, BOOLEAN NoTrailing)
Definition: nsnames.c:262
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_NAMESPACE_NODE * AcpiNsValidateHandle(ACPI_HANDLE Handle)
Definition: nsutils.c:655
#define AE_OK
Definition: acexcep.h:97
_In_ HANDLE _In_opt_ HANDLE _Out_opt_ PHANDLE TargetHandle
Definition: obfuncs.h:429
Definition: dlist.c:348

Referenced by AcpiGetName(), AcpiNsPrintNodePathname(), and AcpiRsCreatePciRoutingTable().

◆ AcpiNsInitializeDevices()

ACPI_STATUS AcpiNsInitializeDevices ( UINT32  Flags)

Definition at line 157 of file nsinit.c.

159 {
163 
164 
165  ACPI_FUNCTION_TRACE (NsInitializeDevices);
166 
167 
168  if (!(Flags & ACPI_NO_DEVICE_INIT))
169  {
171  "[Init] Initializing ACPI Devices\n"));
172 
173  /* Init counters */
174 
175  Info.DeviceCount = 0;
176  Info.Num_STA = 0;
177  Info.Num_INI = 0;
178 
180  "Initializing Device/Processor/Thermal objects "
181  "and executing _INI/_STA methods:\n"));
182 
183  /* Tree analysis: find all subtrees that contain _INI methods */
184 
187  if (ACPI_FAILURE (Status))
188  {
189  goto ErrorExit;
190  }
191 
192  /* Allocate the evaluation information block */
193 
194  Info.EvaluateInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
195  if (!Info.EvaluateInfo)
196  {
198  goto ErrorExit;
199  }
200 
201  /*
202  * Execute the "global" _INI method that may appear at the root.
203  * This support is provided for Windows compatibility (Vista+) and
204  * is not part of the ACPI specification.
205  */
206  Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode;
207  Info.EvaluateInfo->RelativePathname = METHOD_NAME__INI;
208  Info.EvaluateInfo->Parameters = NULL;
209  Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE;
210 
211  Status = AcpiNsEvaluate (Info.EvaluateInfo);
212  if (ACPI_SUCCESS (Status))
213  {
214  Info.Num_INI++;
215  }
216 
217  /*
218  * Execute \_SB._INI.
219  * There appears to be a strict order requirement for \_SB._INI,
220  * which should be evaluated before any _REG evaluations.
221  */
222  Status = AcpiGetHandle (NULL, "\\_SB", &Handle);
223  if (ACPI_SUCCESS (Status))
224  {
225  memset (Info.EvaluateInfo, 0, sizeof (ACPI_EVALUATE_INFO));
226  Info.EvaluateInfo->PrefixNode = Handle;
227  Info.EvaluateInfo->RelativePathname = METHOD_NAME__INI;
228  Info.EvaluateInfo->Parameters = NULL;
229  Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE;
230 
231  Status = AcpiNsEvaluate (Info.EvaluateInfo);
232  if (ACPI_SUCCESS (Status))
233  {
234  Info.Num_INI++;
235  }
236  }
237  }
238 
239  /*
240  * Run all _REG methods
241  *
242  * Note: Any objects accessed by the _REG methods will be automatically
243  * initialized, even if they contain executable AML (see the call to
244  * AcpiNsInitializeObjects below).
245  *
246  * Note: According to the ACPI specification, we actually needn't execute
247  * _REG for SystemMemory/SystemIo operation regions, but for PCI_Config
248  * operation regions, it is required to evaluate _REG for those on a PCI
249  * root bus that doesn't contain _BBN object. So this code is kept here
250  * in order not to break things.
251  */
253  {
255  "[Init] Executing _REG OpRegion methods\n"));
256 
258  if (ACPI_FAILURE (Status))
259  {
260  goto ErrorExit;
261  }
262  }
263 
264  if (!(Flags & ACPI_NO_DEVICE_INIT))
265  {
266  /* Walk namespace to execute all _INIs on present devices */
267 
270 
271  /*
272  * Any _OSI requests should be completed by now. If the BIOS has
273  * requested any Windows OSI strings, we will always truncate
274  * I/O addresses to 16 bits -- for Windows compatibility.
275  */
276  if (AcpiGbl_OsiData >= ACPI_OSI_WIN_2000)
277  {
278  AcpiGbl_TruncateIoAddresses = TRUE;
279  }
280 
281  ACPI_FREE (Info.EvaluateInfo);
282  if (ACPI_FAILURE (Status))
283  {
284  goto ErrorExit;
285  }
286 
288  " Executed %u _INI methods requiring %u _STA executions "
289  "(examined %u objects)\n",
290  Info.Num_INI, Info.Num_STA, Info.DeviceCount));
291  }
292 
294 
295 
296 ErrorExit:
297  ACPI_EXCEPTION ((AE_INFO, Status, "During device initialization"));
299 }
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define ACPI_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define TRUE
Definition: types.h:120
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define AE_NO_MEMORY
Definition: acexcep.h:112
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
ACPI_STATUS AcpiNsEvaluate(ACPI_EVALUATE_INFO *Info)
Definition: nseval.c:82
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_NO_DEVICE_INIT
Definition: actypes.h:601
ACPI_STATUS AcpiNsWalkNamespace(ACPI_OBJECT_TYPE Type, ACPI_HANDLE StartObject, UINT32 MaxDepth, UINT32 Flags, ACPI_WALK_CALLBACK DescendingCallback, ACPI_WALK_CALLBACK AscendingCallback, void *Context, void **ReturnValue)
Definition: nswalk.c:190
static ACPI_STATUS AcpiNsFindIniMethods(ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue)
Definition: nsinit.c:522
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_OSI_WIN_2000
Definition: actypes.h:1396
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_ROOT_OBJECT
Definition: actypes.h:500
_In_ HANDLE Handle
Definition: extypes.h:390
#define ACPI_UINT32_MAX
Definition: actypes.h:66
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
ACPI_STATUS AcpiGetHandle(ACPI_HANDLE Parent, ACPI_STRING Pathname, ACPI_HANDLE *RetHandle)
Definition: nsxfname.c:85
#define ACPI_TYPE_ANY
Definition: actypes.h:678
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_INIT
Definition: acoutput.h:151
#define METHOD_NAME__INI
Definition: acnames.h:59
static ACPI_STATUS AcpiNsInitOneDevice(ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue)
Definition: nsinit.c:595
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
static VOID ErrorExit(LPTSTR lpszMessage)
Definition: telnetd.c:647
#define ACPI_NO_ADDRESS_SPACE_INIT
Definition: actypes.h:602
ACPI_STATUS AcpiEvInitializeOpRegions(void)
Definition: evregion.c:84
#define ACPI_IGNORE_RETURN_VALUE
Definition: acstruct.h:231
#define memset(x, y, z)
Definition: compat.h:39
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiInitializeObjects().

◆ AcpiNsInitializeObjects()

ACPI_STATUS AcpiNsInitializeObjects ( void  )

Definition at line 92 of file nsinit.c.

94 {
97 
98 
99  ACPI_FUNCTION_TRACE (NsInitializeObjects);
100 
101 
103  "[Init] Completing Initialization of ACPI Objects\n"));
105  "**** Starting initialization of namespace objects ****\n"));
107  "Final data object initialization: "));
108 
109  /* Clear the info block */
110 
111  memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
112 
113  /* Walk entire namespace from the supplied root */
114 
115  /*
116  * TBD: will become ACPI_TYPE_PACKAGE as this type object
117  * is now the only one that supports deferred initialization
118  * (forward references).
119  */
122  if (ACPI_FAILURE (Status))
123  {
124  ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
125  }
126 
128  "Namespace contains %u (0x%X) objects\n",
129  Info.ObjectCount,
130  Info.ObjectCount));
131 
133  "%u Control Methods found\n%u Op Regions found\n",
134  Info.MethodCount, Info.OpRegionCount));
135 
137 }
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define ACPI_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
ACPI_STATUS AcpiWalkNamespace(ACPI_OBJECT_TYPE Type, ACPI_HANDLE StartObject, UINT32 MaxDepth, ACPI_WALK_CALLBACK DescendingCallback, ACPI_WALK_CALLBACK AscendingCallback, void *Context, void **ReturnValue)
Definition: nsxfeval.c:640
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_ROOT_OBJECT
Definition: actypes.h:500
#define ACPI_DB_DISPATCH
Definition: acoutput.h:163