ReactOS 0.4.15-dev-7953-g1f49173
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)
 
void AcpiNsNormalizePathname (char *OriginalPath)
 
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_ALREADY_EXISTS
Definition: acexcep.h:115
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_OK
Definition: acexcep.h:97
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:672
#define ACPI_TYPE_LOCAL_DATA
Definition: actypes.h:736
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:681
#define NULL
Definition: types.h:112
ACPI_OBJECT_COMMON_HEADER ACPI_OBJECT_HANDLER Handler
Definition: acobject.h:495
void * Pointer
Definition: acobject.h:496
ACPI_OBJECT_COMMON Common
Definition: acobject.h:519
ACPI_OBJECT_DATA Data
Definition: acobject.h:542
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;
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
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}
unsigned char UINT8
Type
Definition: Type.h:7
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414
#define ACPI_DESC_TYPE_NAMED
Definition: acobject.h:577
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#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 ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
UINT32 ACPI_OBJECT_TYPE
Definition: actypes.h:685
#define ACPI_TYPE_ANY
Definition: actypes.h:687
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:306
void AcpiUtAddReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:752
const char * AcpiUtGetDescriptorName(void *Object)
Definition: utdecode.c:382
ObjectType
Definition: metafile.c:81
void AcpiNsDetachObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:220
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object

Referenced by AcpiDsCreateBufferField(), AcpiDsCreateNode(), AcpiDsLoad2EndOp(), 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}
unsigned int UINT32
int toupper(int c)
Definition: utclib.c:881
#define AE_BAD_PATHNAME
Definition: acexcep.h:153
#define ACPI_IS_PATH_SEPARATOR(c)
Definition: acmacros.h:403
#define ACPI_NAMESEG_SIZE
Definition: actypes.h:415
#define AML_PARENT_PREFIX
Definition: amlcode.h:70
#define AML_DUAL_NAME_PREFIX
Definition: amlcode.h:66
#define AML_MULTI_NAME_PREFIX
Definition: amlcode.h:67
#define AML_ROOT_PREFIX
Definition: amlcode.h:69
unsigned char
Definition: typeof.h:29
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
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_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:409

Referenced by AcpiNsInternalizeName().

◆ AcpiNsBuildNormalizedPath()

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

Definition at line 256 of file nsnames.c.

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

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

◆ AcpiNsBuildPrefixedPathname()

char * AcpiNsBuildPrefixedPathname ( ACPI_GENERIC_STATE PrefixScope,
const char InternalPath 
)

Definition at line 423 of file nsnames.c.

426{
428 char *FullPath = NULL;
429 char *ExternalPath = NULL;
430 char *PrefixPath = NULL;
431 ACPI_SIZE PrefixPathLength = 0;
432
433
434 /* If there is a prefix, get the pathname to it */
435
436 if (PrefixScope && PrefixScope->Scope.Node)
437 {
438 PrefixPath = AcpiNsGetNormalizedPathname (PrefixScope->Scope.Node, TRUE);
439 if (PrefixPath)
440 {
441 PrefixPathLength = strlen (PrefixPath);
442 }
443 }
444
446 NULL, &ExternalPath);
447 if (ACPI_FAILURE (Status))
448 {
449 goto Cleanup;
450 }
451
452 /* Merge the prefix path and the path. 2 is for one dot and trailing null */
453
454 FullPath = ACPI_ALLOCATE_ZEROED (
455 PrefixPathLength + strlen (ExternalPath) + 2);
456 if (!FullPath)
457 {
458 goto Cleanup;
459 }
460
461 /* Don't merge if the External path is already fully qualified */
462
463 if (PrefixPath &&
464 (*ExternalPath != '\\') &&
465 (*ExternalPath != '^'))
466 {
467 strcat (FullPath, PrefixPath);
468 if (PrefixPath[1])
469 {
470 strcat (FullPath, ".");
471 }
472 }
473
474 AcpiNsNormalizePathname (ExternalPath);
475 strcat (FullPath, ExternalPath);
476
477Cleanup:
478 if (PrefixPath)
479 {
480 ACPI_FREE (PrefixPath);
481 }
482 if (ExternalPath)
483 {
484 ACPI_FREE (ExternalPath);
485 }
486
487 return (FullPath);
488}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiNsExternalizeName(UINT32 InternalNameLength, const char *InternalName, UINT32 *ConvertedNameLength, char **ConvertedName)
Definition: nsutils.c:470
#define ACPI_FREE(a)
Definition: actypes.h:386
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_UINT32_MAX
Definition: actypes.h:66
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
@ InternalPath
Definition: bl.h:284
#define TRUE
Definition: types.h:120
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:25
void AcpiNsNormalizePathname(char *OriginalPath)
Definition: nsnames.c:506
char * AcpiNsGetNormalizedPathname(ACPI_NAMESPACE_NODE *Node, BOOLEAN NoTrailing)
Definition: nsnames.c:367
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 135 of file nsarguments.c.

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

Referenced by AcpiNsEvaluate().

◆ AcpiNsCheckArgumentCount()

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

Definition at line 228 of file nsarguments.c.

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

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 /* No typechecking for ACPI_TYPE_ANY */
101
102 if ((UserArgType != ArgType) && (ArgType != ACPI_TYPE_ANY))
103 {
105 "Argument #%u type mismatch - "
106 "Found [%s], ACPI requires [%s]", (i + 1),
107 AcpiUtGetTypeName (UserArgType),
108 AcpiUtGetTypeName (ArgType)));
109
110 /* Prevent any additional typechecking for this method */
111
112 Info->Node->Flags |= ANOBJ_EVALUATED;
113 }
114 }
115}
unsigned short UINT16
#define METHOD_GET_NEXT_TYPE(ArgList)
Definition: acpredef.h:148

Referenced by AcpiNsEvaluate().

◆ AcpiNsCheckObjectType()

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

Definition at line 245 of file nspredef.c.

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

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;
106 UINT32 i;
107
108
109 ACPI_FUNCTION_TRACE (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 {
141 }
142
143 ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
144 "Return Package has no elements (empty)"));
145
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 {
158
159 Status = AcpiNsCustomPackage (Info, Elements, Count);
160 break;
161
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 {
201 }
202
203 Elements++;
204 }
205 break;
206
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 {
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 {
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 {
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 {
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:
302 case ACPI_PTYPE2_MIN:
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 {
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
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 {
358 Package->RetInfo.ObjectType1, 0);
359 if (ACPI_FAILURE(Status))
360 {
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"));
371 }
372
373 Status = AcpiNsCheckObjectType(Info, Elements + 1,
374 Package->RetInfo.ObjectType2, 0);
375 if (ACPI_FAILURE(Status))
376 {
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
394 }
395
397
398
399PackageTooSmall:
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
408}
#define AE_AML_INTERNAL
Definition: acexcep.h:194
#define AE_AML_OPERAND_VALUE
Definition: acexcep.h:183
#define ACPI_RTYPE_INTEGER
Definition: aclocal.h:478
ACPI_STATUS AcpiNsWrapWithPackage(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ObjDescPtr)
Definition: nsrepair.c:597
ACPI_STATUS AcpiNsCheckObjectType(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr, UINT32 ExpectedBtypes, UINT32 PackageIndex)
Definition: nspredef.c:245
void AcpiNsRemoveNullElements(ACPI_EVALUATE_INFO *Info, UINT8 PackageType, ACPI_OPERAND_OBJECT *ObjDesc)
Definition: nsrepair.c:494
#define ACPI_DB_REPAIR
Definition: acoutput.h:154
#define ACPI_DB_NAMES
Definition: acoutput.h:166
@ ACPI_PTYPE2_FIX_VAR
Definition: acpredef.h:132
@ ACPI_PTYPE2_UUID_PAIR
Definition: acpredef.h:134
@ ACPI_PTYPE2_REV_FIXED
Definition: acpredef.h:131
@ ACPI_PTYPE1_VAR
Definition: acpredef.h:124
@ ACPI_PTYPE2_FIXED
Definition: acpredef.h:129
@ ACPI_PTYPE2_PKG_COUNT
Definition: acpredef.h:128
@ ACPI_PTYPE_CUSTOM
Definition: acpredef.h:135
@ ACPI_PTYPE1_FIXED
Definition: acpredef.h:123
@ ACPI_PTYPE2_MIN
Definition: acpredef.h:130
@ ACPI_PTYPE2
Definition: acpredef.h:126
@ ACPI_PTYPE2_COUNT
Definition: acpredef.h:127
@ ACPI_PTYPE1_OPTION
Definition: acpredef.h:125
@ ACPI_PTYPE2_VAR_VAR
Definition: acpredef.h:133
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:691
if(dx< 0)
Definition: linetemp.h:194
int Count
Definition: noreturn.cpp:7
static ACPI_STATUS AcpiNsCheckPackageList(ACPI_EVALUATE_INFO *Info, const ACPI_PREDEFINED_INFO *Package, ACPI_OPERAND_OBJECT **Elements, UINT32 Count)
Definition: nsprepkg.c:428
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
static ACPI_STATUS AcpiNsCustomPackage(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **Elements, UINT32 Count)
Definition: nsprepkg.c:659
union acpi_operand_object ** Elements
Definition: acobject.h:161
UINT8 ObjectType[2]
Definition: aclocal.h:422
UINT8 TailObjectType
Definition: aclocal.h:423
UINT8 ObjectType2
Definition: aclocal.h:399
UINT8 ObjectType1
Definition: aclocal.h:397
ACPI_OBJECT_PACKAGE Package
Definition: acobject.h:523
ACPI_PACKAGE_INFO RetInfo
Definition: aclocal.h:442
ACPI_PACKAGE_INFO3 RetInfo3
Definition: aclocal.h:444

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

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 ACPI_FUNCTION_TRACE (NsComplexRepairs);
217
218 /* Check if this name is in the list of repairable names */
219
220 Predefined = AcpiNsMatchComplexRepair (Node);
221 if (!Predefined)
222 {
223 return_ACPI_STATUS (ValidateStatus);
224 }
225
226 Status = Predefined->RepairFunction (Info, ReturnObjectPtr);
228}
static const ACPI_REPAIR_INFO * AcpiNsMatchComplexRepair(ACPI_NAMESPACE_NODE *Node)
Definition: nsrepair2.c:244
ACPI_REPAIR_FUNCTION RepairFunction
Definition: nsrepair2.c:65

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;
242 UINT32 i;
243
244
245 switch (OriginalObject->Common.Type)
246 {
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
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 ACPI_MUL_4(a)
Definition: acmacros.h:211
#define ACPI_TYPE_STRING
Definition: actypes.h:689
#define ACPI_TYPE_INTEGER
Definition: actypes.h:688
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
ACPI_OPERAND_OBJECT * AcpiUtCreateBufferObject(ACPI_SIZE BufferSize)
Definition: utobject.c:258
ACPI_STATUS AcpiExConvertToBuffer(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc)
Definition: exconvrt.c:224
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ACPI_OBJECT_STRING String
Definition: acobject.h:521
_Inout_opt_ PACCESS_STATE _In_opt_ ACCESS_MASK _In_ ULONG _Out_opt_ PVOID * NewObject
Definition: obfuncs.h:74

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 {
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
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}
unsigned long long UINT64
#define ACPI_TYPE_BUFFER
Definition: actypes.h:690
ACPI_OPERAND_OBJECT * AcpiUtCreateIntegerObject(UINT64 Value)
Definition: utobject.c:223
ACPI_STATUS AcpiUtStrtoul64(char *String, UINT64 *RetInteger)
Definition: utstrtoul64.c:121
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:522
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

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
563 ACPI_FREE (Name);
564 *ReturnObject = NewObject;
565 return (Status);
566}
@ ACPI_IMODE_EXECUTE
Definition: aclocal.h:169
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
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:328
ACPI_STATUS AcpiNsInternalizeName(const char *DottedName, char **ConvertedName)
Definition: nsutils.c:405
#define ACPI_NS_DONT_OPEN_SCOPE
Definition: acnamesp.h:64
#define ACPI_NS_SEARCH_PARENT
Definition: acnamesp.h:63
@ ACPI_REFCLASS_NAME
Definition: acobject.h:464
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:719
struct NameRec_ * Name
Definition: cdprocs.h:460
static VOID ErrorExit(LPTSTR lpszMessage)
Definition: telnetd.c:647

◆ 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 {
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 ASL_RDESC_END_TAG_SIZE
Definition: amlresrc.h:119
Definition: bufpool.h:45
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:520

◆ 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 {
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 ACPI_IMPLICIT_CONVERT_HEX
Definition: acinterp.h:126
ACPI_OPERAND_OBJECT * AcpiUtCreateStringObject(ACPI_SIZE StringSize)
Definition: utobject.c:320
ACPI_STATUS AcpiExConvertToString(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, UINT32 Type)
Definition: exconvrt.c:440

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}

◆ 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 {
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;
98}
#define ACPI_SET_DESCRIPTOR_TYPE(d, t)
Definition: acmacros.h:415
#define return_PTR(s)
Definition: acoutput.h:497
void * AcpiOsAcquireObject(ACPI_CACHE_T *Cache)
#define ACPI_MEM_TRACKING(a)
Definition: actypes.h:387

Referenced by AcpiNsRootInitialize(), and 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 {
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;
382}
#define return_VOID
Definition: acoutput.h:495
void AcpiNsDeleteNode(ACPI_NAMESPACE_NODE *Node)
Definition: nsalloc.c:117
struct acpi_namespace_node * Child
Definition: aclocal.h:193
struct acpi_namespace_node * Peer
Definition: aclocal.h:194

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;
505
506
507 ACPI_FUNCTION_TRACE_U32 (NsDeleteNamespaceByOwner, OwnerId);
508
509
510 if (OwnerId == 0)
511 {
513 }
514
515 /* Lock namespace for possible update */
516
518 if (ACPI_FAILURE (Status))
519 {
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
600}
#define ACPI_MTX_NAMESPACE
Definition: aclocal.h:85
void AcpiNsDetachObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:220
ACPI_NAMESPACE_NODE * AcpiNsGetNextNode(ACPI_NAMESPACE_NODE *Parent, ACPI_NAMESPACE_NODE *Child)
Definition: nswalk.c:72
#define ACPI_FUNCTION_TRACE_U32(a, b)
Definition: acoutput.h:482
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
_Must_inspect_result_ _In_opt_ PVOID OwnerId
Definition: fsrtlfuncs.h:907
void AcpiNsDeleteChildren(ACPI_NAMESPACE_NODE *ParentNode)
Definition: nsalloc.c:341
void AcpiNsRemoveNode(ACPI_NAMESPACE_NODE *Node)
Definition: nsalloc.c:188
ACPI_OWNER_ID OwnerId
Definition: aclocal.h:195
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:56

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 {
413 }
414
415 /* Lock namespace for possible update */
416
418 if (ACPI_FAILURE (Status))
419 {
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
477}

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 {
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}
#define ACPI_DB_ALLOCATIONS
Definition: acoutput.h:175
ACPI_STATUS AcpiOsReleaseObject(ACPI_CACHE_T *Cache, void *Object)
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:790

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}
#define AE_NOT_FOUND
Definition: acexcep.h:113

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 {
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);
291}
#define ANOBJ_ALLOCATED_BUFFER
Definition: aclocal.h:221
#define ACPI_DESC_TYPE_OPERAND
Definition: acobject.h:576
#define ACPI_TYPE_REGION
Definition: actypes.h:697
void AcpiUtRemoveAddressRange(ACPI_ADR_SPACE_TYPE SpaceId, ACPI_NAMESPACE_NODE *RegionNode)
Definition: utaddress.c:139
UINT8 * AmlStart
Definition: acobject.h:221
ACPI_OBJECT_COMMON_HEADER UINT8 SpaceId
Definition: acobject.h:202
ACPI_OBJECT_METHOD Method
Definition: acobject.h:525
ACPI_OBJECT_REGION Region
Definition: acobject.h:527

Referenced by AcpiDsLoad2EndOp(), 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 (
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,
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:
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
337Cleanup:
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 AE_NULL_OBJECT
Definition: acexcep.h:117
#define AE_TYPE
Definition: acexcep.h:116
char * AcpiNsGetNormalizedPathname(ACPI_NAMESPACE_NODE *Node, BOOLEAN NoTrailing)
Definition: nsnames.c:367
void AcpiNsCheckArgumentTypes(ACPI_EVALUATE_INFO *Info)
Definition: nsarguments.c:68
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
void AcpiNsCheckArgumentCount(char *Pathname, ACPI_NAMESPACE_NODE *Node, UINT32 UserParamCount, const ACPI_PREDEFINED_INFO *Info)
Definition: nsarguments.c:228
ACPI_OBJECT_TYPE AcpiNsGetType(ACPI_NAMESPACE_NODE *Node)
Definition: nsutils.c:120
ACPI_STATUS AcpiNsGetNode(ACPI_NAMESPACE_NODE *PrefixNode, const char *ExternalPathname, UINT32 Flags, ACPI_NAMESPACE_NODE **OutNode)
Definition: nsutils.c:863
void AcpiNsCheckAcpiCompliance(char *Pathname, ACPI_NAMESPACE_NODE *Node, const ACPI_PREDEFINED_INFO *Predefined)
Definition: nsarguments.c:135
#define ACPI_NS_NO_UPSEARCH
Definition: acnamesp.h:62
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 ACPI_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
#define ACPI_DB_EVALUATION
Definition: acoutput.h:181
ACPI_STATUS AcpiPsExecuteMethod(ACPI_EVALUATE_INFO *Info)
Definition: psxface.c:131
#define ACPI_IGNORE_RETURN_VALUE
Definition: acstruct.h:231
#define ACPI_CAST_INDIRECT_PTR(t, p)
Definition: actypes.h:545
#define ACPI_TYPE_EVENT
Definition: actypes.h:694
#define ACPI_TYPE_MUTEX
Definition: actypes.h:696
#define ACPI_TYPE_DEVICE
Definition: actypes.h:693
#define ACPI_TYPE_LOCAL_METHOD_ALIAS
Definition: actypes.h:721
#define ACPI_TYPE_LOCAL_SCOPE
Definition: actypes.h:726
#define ACPI_TYPE_THERMAL
Definition: actypes.h:700
const ACPI_PREDEFINED_INFO * AcpiUtMatchPredefinedMethod(char *Name)
Definition: utpredef.c:114
#define ACPI_METHOD_NUM_ARGS
Definition: acconfig.h:166
ACPI_STATUS AcpiExResolveNodeToValue(ACPI_NAMESPACE_NODE **ObjectPtr, ACPI_WALK_STATE *WalkState)
Definition: exresnte.c:82
void AcpiExExitInterpreter(void)
Definition: exutils.c:139
void AcpiExEnterInterpreter(void)
Definition: exutils.c:91
union acpi_operand_object * Object
Definition: aclocal.h:187

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
168Cleanup:
169 if (Info)
170 {
171 ACPI_FREE (Info->FullPathname);
172 Info->FullPathname = NULL;
173 }
174 ACPI_FREE (Info);
175 AcpiUtRemoveReference (MethodObj);
177}
#define AE_BAD_HEADER
Definition: acexcep.h:168
#define ACPI_GET_FUNCTION_NAME
Definition: acgcc.h:67
#define ACPI_METHOD_MODULE_LEVEL
Definition: acobject.h:236
#define ACPI_DB_PARSE
Definition: acoutput.h:162
ACPI_STATUS AcpiPsExecuteTable(ACPI_EVALUATE_INFO *Info)
Definition: psxface.c:297
ACPI_STATUS AcpiTbGetOwnerId(UINT32 TableIndex, ACPI_OWNER_ID *OwnerId)
Definition: tbdata.c:993
struct acpi_table_header ACPI_TABLE_HEADER
UINT16 ACPI_OWNER_ID
Definition: actypes.h:486
ASMGENDATA Table[]
Definition: genincdata.c:61
ACPI_OWNER_ID OwnerId
Definition: acobject.h:229
ACPI_OBJECT_COMMON_HEADER UINT8 InfoFlags
Definition: acobject.h:216
ACPI_STATUS AcpiGetTableByIndex(UINT32 TableIndex, ACPI_TABLE_HEADER **OutTable)
Definition: tbxface.c:491
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

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
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
621 NamesIndex += ACPI_NAMESEG_SIZE;
622 }
623 }
624
625 if (ConvertedNameLength)
626 {
627 *ConvertedNameLength = (UINT32) RequiredLength;
628 }
629
631}
#define ACPI_IS_PARENT_PREFIX(c)
Definition: acmacros.h:402
#define ACPI_COPY_NAMESEG(dest, src)
Definition: actypes.h:565
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 GLint GLint j
Definition: glfuncs.h:250
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:30

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}

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"));
318 }
319
320 if (!Node->Object ||
323 ((Node->Object)->Common.Type == ACPI_TYPE_LOCAL_DATA))
324 {
326 }
327
328 return_PTR (Node->Object);
329}
#define ACPI_WARNING(plist)
Definition: acoutput.h:238

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(), AcpiExLoadOp(), 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 70 of file nsnames.c.

72{
73 char *NameBuffer;
74
75
76 ACPI_FUNCTION_TRACE_PTR (NsGetExternalPathname, Node);
77
78
80 return_PTR (NameBuffer);
81}

Referenced by AcpiDsExecEndOp(), AcpiDsGetFieldNames(), AcpiDsLoad2EndOp(), 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 ACPI_IS_ROOT_PREFIX(c)
Definition: acmacros.h:401
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484

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}

Referenced by AcpiEvExecuteOrphanRegMethod(), 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}
ACPI_NAMESPACE_NODE * AcpiNsGetNextNode(ACPI_NAMESPACE_NODE *ParentNode, ACPI_NAMESPACE_NODE *ChildNode)
Definition: nswalk.c:72

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
873
874
876 if (ACPI_FAILURE (Status))
877 {
879 }
880
882 Flags, ReturnNode);
883
886}
ACPI_STATUS AcpiNsGetNodeUnlocked(ACPI_NAMESPACE_NODE *PrefixNode, const char *Pathname, UINT32 Flags, ACPI_NAMESPACE_NODE **ReturnNode)
Definition: nsutils.c:777
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

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
const char * AcpiFormatException(ACPI_STATUS Status)
Definition: utexcep.c:70

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

◆ AcpiNsGetNormalizedPathname()

char * AcpiNsGetNormalizedPathname ( ACPI_NAMESPACE_NODE Node,
BOOLEAN  NoTrailing 
)

Definition at line 367 of file nsnames.c.

370{
371 char *NameBuffer;
372 ACPI_SIZE Size;
373
374
375 ACPI_FUNCTION_TRACE_PTR (NsGetNormalizedPathname, Node);
376
377
378 /* Calculate required buffer size based on depth below root */
379
380 Size = AcpiNsBuildNormalizedPath (Node, NULL, 0, NoTrailing);
381 if (!Size)
382 {
384 }
385
386 /* Allocate a buffer to be returned to caller */
387
388 NameBuffer = ACPI_ALLOCATE_ZEROED (Size);
389 if (!NameBuffer)
390 {
392 "Could not allocate %u bytes", (UINT32) Size));
394 }
395
396 /* Build the path in the allocated buffer */
397
398 (void) AcpiNsBuildNormalizedPath (Node, NameBuffer, (UINT32) Size, NoTrailing);
399
400 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "%s: Path \"%s\"\n",
401 ACPI_GET_FUNCTION_NAME, NameBuffer));
402
403 return_PTR (NameBuffer);
404}
UINT32 AcpiNsBuildNormalizedPath(ACPI_NAMESPACE_NODE *Node, char *FullPath, UINT32 PathSize, BOOLEAN NoTrailing)
Definition: nsnames.c:256
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

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

◆ AcpiNsGetPathnameLength()

ACPI_SIZE AcpiNsGetPathnameLength ( ACPI_NAMESPACE_NODE Node)

Definition at line 97 of file nsnames.c.

99{
100 ACPI_SIZE Size;
101
102
103 /* Validate the Node */
104
106 {
108 "Invalid/cached reference target node: %p, descriptor type %d",
110 return (0);
111 }
112
114 return (Size);
115}

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 {
358 }
359
360 return_PTR (ObjDesc->Common.NextObject);
361}

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

◆ AcpiNsGetType()

ACPI_OBJECT_TYPE AcpiNsGetType ( ACPI_NAMESPACE_NODE Node)

◆ AcpiNsHandleToName()

ACPI_STATUS AcpiNsHandleToName ( ACPI_HANDLE  TargetHandle,
ACPI_BUFFER Buffer 
)

Definition at line 133 of file nsnames.c.

136{
139 const char *NodeName;
140
141
142 ACPI_FUNCTION_TRACE_PTR (NsHandleToName, TargetHandle);
143
144
146 if (!Node)
147 {
149 }
150
151 /* Validate/Allocate/Clear caller buffer */
152
154 if (ACPI_FAILURE (Status))
155 {
157 }
158
159 /* Just copy the ACPI name from the Node and zero terminate it */
160
161 NodeName = AcpiUtGetNodeName (Node);
162 ACPI_COPY_NAMESEG (Buffer->Pointer, NodeName);
163 ((char *) Buffer->Pointer) [ACPI_NAMESEG_SIZE] = 0;
164
165 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%4.4s\n", (char *) Buffer->Pointer));
167}
ACPI_NAMESPACE_NODE * AcpiNsValidateHandle(ACPI_HANDLE Handle)
Definition: nsutils.c:655
#define ACPI_PATH_SEGMENT_LENGTH
Definition: actypes.h:416
ACPI_STATUS AcpiUtInitializeBuffer(ACPI_BUFFER *Buffer, ACPI_SIZE RequiredLength)
Definition: utalloc.c:336
_In_ HANDLE _In_opt_ HANDLE _Out_opt_ PHANDLE TargetHandle
Definition: obfuncs.h:431

Referenced by AcpiGetName().

◆ AcpiNsHandleToPathname()

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

Definition at line 187 of file nsnames.c.

191{
194 ACPI_SIZE RequiredSize;
195
196
197 ACPI_FUNCTION_TRACE_PTR (NsHandleToPathname, TargetHandle);
198
199
201 if (!Node)
202 {
204 }
205
206 /* Determine size required for the caller buffer */
207
209 if (!RequiredSize)
210 {
212 }
213
214 /* Validate/Allocate/Clear caller buffer */
215
217 if (ACPI_FAILURE (Status))
218 {
220 }
221
222 /* Build the path in the caller buffer */
223
225 (UINT32) RequiredSize, NoTrailing);
226
227 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X]\n",
228 (char *) Buffer->Pointer, (UINT32) RequiredSize));
230}
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4439

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
297 ACPI_EXCEPTION ((AE_INFO, Status, "During device initialization"));
299}
#define METHOD_NAME__INI
Definition: acnames.h:60
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
ACPI_STATUS AcpiNsEvaluate(ACPI_EVALUATE_INFO *Info)
Definition: nseval.c:82
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define ACPI_DB_INIT
Definition: acoutput.h:151
#define ACPI_NO_ADDRESS_SPACE_INIT
Definition: actypes.h:611
#define ACPI_NO_DEVICE_INIT
Definition: actypes.h:610
#define ACPI_OSI_WIN_2000
Definition: actypes.h:1435
#define ACPI_ROOT_OBJECT
Definition: actypes.h:500
ACPI_STATUS AcpiEvInitializeOpRegions(void)
Definition: evregion.c:86
ULONG Handle
Definition: gdb_input.c:15
static ACPI_STATUS AcpiNsInitOneDevice(ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue)
Definition: nsinit.c:595
static ACPI_STATUS AcpiNsFindIniMethods(ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue)
Definition: nsinit.c:522
ACPI_STATUS AcpiGetHandle(ACPI_HANDLE Parent, ACPI_STRING Pathname, ACPI_HANDLE *RetHandle)
Definition: nsxfname.c:85
#define memset(x, y, z)
Definition: compat.h:39

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_DB_DISPATCH
Definition: acoutput.h:163
static ACPI_STATUS AcpiNsInitOneObject(ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue)
Definition: nsinit.c:382
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

Referenced by AcpiExLoadOp(), AcpiExLoadTableOp(), AcpiInitializeObjects(), AcpiLoadTable(), and AcpiLoadTables().

◆ AcpiNsInitOnePackage()

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

Definition at line 319 of file nsinit.c.

324{
326 ACPI_OPERAND_OBJECT *ObjDesc;
328
329
330 ObjDesc = AcpiNsGetAttachedObject (Node);
331 if (!ObjDesc)
332 {
333 return (AE_OK);
334 }
335
336 /* Exit if package is already initialized */
337
338 if (ObjDesc->Package.Flags & AOPOBJ_DATA_VALID)
339 {
340 return (AE_OK);
341 }
342
344 if (ACPI_FAILURE (Status))
345 {
346 return (AE_OK);
347 }
348
350 NULL);
351 if (ACPI_FAILURE (Status))
352 {
353 return (AE_OK);
354 }
355
356 ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID;
357 return (AE_OK);
358}
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
ACPI_STATUS AcpiUtWalkPackageTree(ACPI_OPERAND_OBJECT *SourceObject, void *TargetObject, ACPI_PKG_CALLBACK WalkCallback, void *Context)
Definition: utmisc.c:264
ACPI_STATUS AcpiDsGetPackageArguments(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: dsargs.c:344
ACPI_STATUS AcpiDsInitPackageElement(UINT8 ObjectType, ACPI_OPERAND_OBJECT *SourceObject, ACPI_GENERIC_STATE *State, void *Context)
Definition: dspkginit.c:369

Referenced by AcpiNsInitOneObject().

◆ AcpiNsInstallNode()

void AcpiNsInstallNode ( ACPI_WALK_STATE WalkState,
ACPI_NAMESPACE_NODE ParentNode,
ACPI_NAMESPACE_NODE Node,
ACPI_OBJECT_TYPE  Type 
)

Definition at line 255 of file nsalloc.c.

260{
262 ACPI_NAMESPACE_NODE *ChildNode;
263
264
265 ACPI_FUNCTION_TRACE (NsInstallNode);
266
267
268 if (WalkState)
269 {
270 /*
271 * Get the owner ID from the Walk state. The owner ID is used to
272 * track table deletion and deletion of objects created by methods.
273 */
274 OwnerId = WalkState->OwnerId;
275
276 if ((WalkState->MethodDesc) &&
277 (ParentNode != WalkState->MethodNode))
278 {
279 /*
280 * A method is creating a new node that is not a child of the
281 * method (it is non-local). Mark the executing method as having
282 * modified the namespace. This is used for cleanup when the
283 * method exits.
284 */
285 WalkState->MethodDesc->Method.InfoFlags |=
287 }
288 }
289
290 /* Link the new entry into the parent and existing children */
291
292 Node->Peer = NULL;
293 Node->Parent = ParentNode;
294 ChildNode = ParentNode->Child;
295
296 if (!ChildNode)
297 {
298 ParentNode->Child = Node;
299 }
300 else
301 {
302 /* Add node to the end of the peer list */
303
304 while (ChildNode->Peer)
305 {
306 ChildNode = ChildNode->Peer;
307 }
308
309 ChildNode->Peer = Node;
310 }
311
312 /* Init the new entry */
313
314 Node->OwnerId = OwnerId;
315 Node->Type = (UINT8) Type;
316
318 "%4.4s (%s) [Node %p Owner %3.3X] added to %4.4s (%s) [Node %p]\n",
320 AcpiUtGetNodeName (ParentNode), AcpiUtGetTypeName (ParentNode->Type),
321 ParentNode));
322
324}
#define ACPI_METHOD_MODIFIED_NAMESPACE
Definition: acobject.h:241
union acpi_operand_object * MethodDesc
Definition: acstruct.h:115
struct acpi_namespace_node * MethodNode
Definition: acstruct.h:116
ACPI_OWNER_ID OwnerId
Definition: acstruct.h:82

Referenced by AcpiNsSearchAndEnter().

◆ AcpiNsInternalizeName()

ACPI_STATUS AcpiNsInternalizeName ( const char DottedName,
char **  ConvertedName 
)

Definition at line 405 of file nsutils.c.

408{
409 char *InternalName;
412
413
414 ACPI_FUNCTION_TRACE (NsInternalizeName);
415
416
417 if ((!ExternalName) ||
418 (*ExternalName == 0) ||
419 (!ConvertedName))
420 {
422 }
423
424 /* Get the length of the new internal name */
425
426 Info.ExternalName = ExternalName;
428
429 /* We need a segment to store the internal name */
430
431 InternalName = ACPI_ALLOCATE_ZEROED (Info.Length);
432 if (!InternalName)
433 {
435 }
436
437 /* Build the name */
438
439 Info.InternalName = InternalName;
441 if (ACPI_FAILURE (Status))
442 {
443 ACPI_FREE (InternalName);
445 }
446
447 *ConvertedName = InternalName;
449}
void AcpiNsGetInternalNameLength(ACPI_NAMESTRING_INFO *Info)
Definition: nsutils.c:183
ACPI_STATUS AcpiNsBuildInternalName(ACPI_NAMESTRING_INFO *Info)
Definition: nsutils.c:267

Referenced by AcpiNsConvertToReference(), and AcpiNsGetNodeUnlocked().

◆ AcpiNsLoadNamespace()

ACPI_STATUS AcpiNsLoadNamespace ( void  )

◆ AcpiNsLoadTable()

ACPI_STATUS AcpiNsLoadTable ( UINT32  TableIndex,
ACPI_NAMESPACE_NODE Node 
)

Definition at line 82 of file nsload.c.

85{
87
88
89 ACPI_FUNCTION_TRACE (NsLoadTable);
90
91
92 /* If table already loaded into namespace, just return */
93
94 if (AcpiTbIsTableLoaded (TableIndex))
95 {
97 goto Unlock;
98 }
99
101 "**** Loading table into namespace ****\n"));
102
103 Status = AcpiTbAllocateOwnerId (TableIndex);
104 if (ACPI_FAILURE (Status))
105 {
106 goto Unlock;
107 }
108
109 /*
110 * Parse the table and load the namespace with all named
111 * objects found within. Control methods are NOT parsed
112 * at this time. In fact, the control methods cannot be
113 * parsed until the entire namespace is loaded, because
114 * if a control method makes a forward reference (call)
115 * to another control method, we can't continue parsing
116 * because we don't know how many arguments to parse next!
117 */
118 Status = AcpiNsParseTable (TableIndex, Node);
119 if (ACPI_SUCCESS (Status))
120 {
121 AcpiTbSetTableLoadedFlag (TableIndex, TRUE);
122 }
123 else
124 {
125 /*
126 * On error, delete any namespace objects created by this table.
127 * We cannot initialize these objects, so delete them. There are
128 * a couple of especially bad cases:
129 * AE_ALREADY_EXISTS - namespace collision.
130 * AE_NOT_FOUND - the target of a Scope operator does not
131 * exist. This target of Scope must already exist in the
132 * namespace, as per the ACPI specification.
133 */
135 AcpiGbl_RootTableList.Tables[TableIndex].OwnerId);
136
137 AcpiTbReleaseOwnerId (TableIndex);
139 }
140
141Unlock:
142 if (ACPI_FAILURE (Status))
143 {
145 }
146
147 /*
148 * Now we can parse the control methods. We always parse
149 * them here for a sanity check, and if configured for
150 * just-in-time parsing, we delete the control method
151 * parse trees.
152 */
154 "**** Begin Table Object Initialization\n"));
155
157 Status = AcpiDsInitializeObjects (TableIndex, Node);
159
161 "**** Completed Table Object Initialization\n"));
162
164}
ACPI_STATUS AcpiNsParseTable(UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode)
Definition: nsparse.c:307
void AcpiNsDeleteNamespaceByOwner(ACPI_OWNER_ID OwnerId)
Definition: nsalloc.c:497
#define ACPI_DB_INFO
Definition: acoutput.h:153
void AcpiTbSetTableLoadedFlag(UINT32 TableIndex, BOOLEAN IsLoaded)
Definition: tbdata.c:1059
ACPI_STATUS AcpiTbAllocateOwnerId(UINT32 TableIndex)
Definition: tbdata.c:923
BOOLEAN AcpiTbIsTableLoaded(UINT32 TableIndex)
Definition: tbdata.c:1026
ACPI_STATUS AcpiTbReleaseOwnerId(UINT32 TableIndex)
Definition: tbdata.c:957
ACPI_STATUS AcpiDsInitializeObjects(UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode)
Definition: dsinit.c:204
@ Unlock
Definition: ntsecapi.h:294

Referenced by AcpiTbLoadNamespace(), and AcpiTbLoadTable().

◆ AcpiNsLocal()

UINT32 AcpiNsLocal ( ACPI_OBJECT_TYPE  Type)

Definition at line 150 of file nsutils.c.

152{
153 ACPI_FUNCTION_TRACE (NsLocal);
154
155
157 {
158 /* Type code out of range */
159
160 ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type));
162 }
163
165}
const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES]
Definition: utdecode.c:57
#define ACPI_NS_NORMAL
Definition: acnamesp.h:56
#define ACPI_NS_LOCAL
Definition: acnamesp.h:58
BOOLEAN AcpiUtValidObjectType(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:681

Referenced by AcpiNsSearchParentTree().

◆ AcpiNsLookup()

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 at line 328 of file nsaccess.c.

336{
338 char *Path = Pathname;
339 char *ExternalPath;
340 ACPI_NAMESPACE_NODE *PrefixNode;
341 ACPI_NAMESPACE_NODE *CurrentNode = NULL;
342 ACPI_NAMESPACE_NODE *ThisNode = NULL;
343 UINT32 NumSegments;
344 UINT32 NumCarats;
345 ACPI_NAME SimpleName;
346 ACPI_OBJECT_TYPE TypeToCheckFor;
347 ACPI_OBJECT_TYPE ThisSearchType;
348 UINT32 SearchParentFlag = ACPI_NS_SEARCH_PARENT;
350 ACPI_INTERPRETER_MODE LocalInterpreterMode;
351
352
353 ACPI_FUNCTION_TRACE (NsLookup);
354
355
356 if (!ReturnNode)
357 {
359 }
360
361 LocalFlags = Flags &
364 *ReturnNode = ACPI_ENTRY_NOT_FOUND;
365 AcpiGbl_NsLookupCount++;
366
367 if (!AcpiGbl_RootNode)
368 {
370 }
371
372 /* Get the prefix scope. A null scope means use the root scope */
373
374 if ((!ScopeInfo) ||
375 (!ScopeInfo->Scope.Node))
376 {
378 "Null scope prefix, using root node (%p)\n",
379 AcpiGbl_RootNode));
380
381 PrefixNode = AcpiGbl_RootNode;
382 }
383 else
384 {
385 PrefixNode = ScopeInfo->Scope.Node;
387 {
388 ACPI_ERROR ((AE_INFO, "%p is not a namespace node [%s]",
389 PrefixNode, AcpiUtGetDescriptorName (PrefixNode)));
391 }
392
394 {
395 /*
396 * This node might not be a actual "scope" node (such as a
397 * Device/Method, etc.) It could be a Package or other object
398 * node. Backup up the tree to find the containing scope node.
399 */
400 while (!AcpiNsOpensScope (PrefixNode->Type) &&
401 PrefixNode->Type != ACPI_TYPE_ANY)
402 {
403 PrefixNode = PrefixNode->Parent;
404 }
405 }
406 }
407
408 /* Save type. TBD: may be no longer necessary */
409
410 TypeToCheckFor = Type;
411
412 /*
413 * Begin examination of the actual pathname
414 */
415 if (!Pathname)
416 {
417 /* A Null NamePath is allowed and refers to the root */
418
419 NumSegments = 0;
420 ThisNode = AcpiGbl_RootNode;
421 Path = "";
422
424 "Null Pathname (Zero segments), Flags=%X\n", Flags));
425 }
426 else
427 {
428 /*
429 * Name pointer is valid (and must be in internal name format)
430 *
431 * Check for scope prefixes:
432 *
433 * As represented in the AML stream, a namepath consists of an
434 * optional scope prefix followed by a name segment part.
435 *
436 * If present, the scope prefix is either a Root Prefix (in
437 * which case the name is fully qualified), or one or more
438 * Parent Prefixes (in which case the name's scope is relative
439 * to the current scope).
440 */
441 if (*Path == (UINT8) AML_ROOT_PREFIX)
442 {
443 /* Pathname is fully qualified, start from the root */
444
445 ThisNode = AcpiGbl_RootNode;
446 SearchParentFlag = ACPI_NS_NO_UPSEARCH;
447
448 /* Point to name segment part */
449
450 Path++;
451
453 "Path is absolute from root [%p]\n", ThisNode));
454 }
455 else
456 {
457 /* Pathname is relative to current scope, start there */
458
460 "Searching relative to prefix scope [%4.4s] (%p)\n",
461 AcpiUtGetNodeName (PrefixNode), PrefixNode));
462
463 /*
464 * Handle multiple Parent Prefixes (carat) by just getting
465 * the parent node for each prefix instance.
466 */
467 ThisNode = PrefixNode;
468 NumCarats = 0;
469 while (*Path == (UINT8) AML_PARENT_PREFIX)
470 {
471 /* Name is fully qualified, no search rules apply */
472
473 SearchParentFlag = ACPI_NS_NO_UPSEARCH;
474
475 /*
476 * Point past this prefix to the name segment
477 * part or the next Parent Prefix
478 */
479 Path++;
480
481 /* Backup to the parent node */
482
483 NumCarats++;
484 ThisNode = ThisNode->Parent;
485 if (!ThisNode)
486 {
487 /*
488 * Current scope has no parent scope. Externalize
489 * the internal path for error message.
490 */
492 NULL, &ExternalPath);
493 if (ACPI_SUCCESS (Status))
494 {
496 "%s: Path has too many parent prefixes (^)",
497 ExternalPath));
498
499 ACPI_FREE (ExternalPath);
500 }
501
503 }
504 }
505
506 if (SearchParentFlag == ACPI_NS_NO_UPSEARCH)
507 {
509 "Search scope is [%4.4s], path has %u carat(s)\n",
510 AcpiUtGetNodeName (ThisNode), NumCarats));
511 }
512 }
513
514 /*
515 * Determine the number of ACPI name segments in this pathname.
516 *
517 * The segment part consists of either:
518 * - A Null name segment (0)
519 * - A DualNamePrefix followed by two 4-byte name segments
520 * - A MultiNamePrefix followed by a byte indicating the
521 * number of segments and the segments themselves.
522 * - A single 4-byte name segment
523 *
524 * Examine the name prefix opcode, if any, to determine the number of
525 * segments.
526 */
527 switch (*Path)
528 {
529 case 0:
530 /*
531 * Null name after a root or parent prefixes. We already
532 * have the correct target node and there are no name segments.
533 */
534 NumSegments = 0;
535 Type = ThisNode->Type;
536
538 "Prefix-only Pathname (Zero name segments), Flags=%X\n",
539 Flags));
540 break;
541
543
544 /* More than one NameSeg, search rules do not apply */
545
546 SearchParentFlag = ACPI_NS_NO_UPSEARCH;
547
548 /* Two segments, point to first name segment */
549
550 NumSegments = 2;
551 Path++;
552
554 "Dual Pathname (2 segments, Flags=%X)\n", Flags));
555 break;
556
558
559 /* More than one NameSeg, search rules do not apply */
560
561 SearchParentFlag = ACPI_NS_NO_UPSEARCH;
562
563 /* Extract segment count, point to first name segment */
564
565 Path++;
566 NumSegments = (UINT32) (UINT8) *Path;
567 Path++;
568
570 "Multi Pathname (%u Segments, Flags=%X)\n",
571 NumSegments, Flags));
572 break;
573
574 default:
575 /*
576 * Not a Null name, no Dual or Multi prefix, hence there is
577 * only one name segment and Pathname is already pointing to it.
578 */
579 NumSegments = 1;
580
582 "Simple Pathname (1 segment, Flags=%X)\n", Flags));
583 break;
584 }
585
587 }
588
589
590 /*
591 * Search namespace for each segment of the name. Loop through and
592 * verify (or add to the namespace) each name segment.
593 *
594 * The object type is significant only at the last name
595 * segment. (We don't care about the types along the path, only
596 * the type of the final target object.)
597 */
598 ThisSearchType = ACPI_TYPE_ANY;
599 CurrentNode = ThisNode;
600
601 while (NumSegments && CurrentNode)
602 {
603 NumSegments--;
604 if (!NumSegments)
605 {
606 /* This is the last segment, enable typechecking */
607
608 ThisSearchType = Type;
609
610 /*
611 * Only allow automatic parent search (search rules) if the caller
612 * requested it AND we have a single, non-fully-qualified NameSeg
613 */
614 if ((SearchParentFlag != ACPI_NS_NO_UPSEARCH) &&
616 {
618 }
619
620 /* Set error flag according to caller */
621
623 {
625 }
626
627 /* Set override flag according to caller */
628
630 {
632 }
633 }
634
635 /* Handle opcodes that create a new NameSeg via a full NamePath */
636
637 LocalInterpreterMode = InterpreterMode;
638 if ((Flags & ACPI_NS_PREFIX_MUST_EXIST) && (NumSegments > 0))
639 {
640 /* Every element of the path must exist (except for the final NameSeg) */
641
642 LocalInterpreterMode = ACPI_IMODE_EXECUTE;
643 }
644
645 /* Extract one ACPI name from the front of the pathname */
646
647 ACPI_MOVE_32_TO_32 (&SimpleName, Path);
648
649 /* Try to find the single (4 character) ACPI name */
650
651 Status = AcpiNsSearchAndEnter (SimpleName, WalkState, CurrentNode,
652 LocalInterpreterMode, ThisSearchType, LocalFlags, &ThisNode);
653 if (ACPI_FAILURE (Status))
654 {
655 if (Status == AE_NOT_FOUND)
656 {
657#if !defined ACPI_ASL_COMPILER /* Note: iASL reports this error by itself, not needed here */
659 {
661 "Object does not exist: %4.4s\n", (char *) &SimpleName);
662 }
663#endif
664 /* Name not found in ACPI namespace */
665
667 "Name [%4.4s] not found in scope [%4.4s] %p\n",
668 (char *) &SimpleName, (char *) &CurrentNode->Name,
669 CurrentNode));
670 }
671
672#ifdef ACPI_EXEC_APP
673 if ((Status == AE_ALREADY_EXISTS) &&
674 (ThisNode->Flags & ANOBJ_NODE_EARLY_INIT))
675 {
676 ThisNode->Flags &= ~ANOBJ_NODE_EARLY_INIT;
677 Status = AE_OK;
678 }
679#endif
680
681#ifdef ACPI_ASL_COMPILER
682 /*
683 * If this ACPI name already exists within the namespace as an
684 * external declaration, then mark the external as a conflicting
685 * declaration and proceed to process the current node as if it did
686 * not exist in the namespace. If this node is not processed as
687 * normal, then it could cause improper namespace resolution
688 * by failing to open a new scope.
689 */
690 if (AcpiGbl_DisasmFlag &&
692 ((ThisNode->Flags & ANOBJ_IS_EXTERNAL) ||
693 (WalkState && WalkState->Opcode == AML_EXTERNAL_OP)))
694 {
695 ThisNode->Flags &= ~ANOBJ_IS_EXTERNAL;
696 ThisNode->Type = (UINT8)ThisSearchType;
697 if (WalkState->Opcode != AML_EXTERNAL_OP)
698 {
700 }
701 break;
702 }
703#endif
704
705 *ReturnNode = ThisNode;
707 }
708
709 /* More segments to follow? */
710
711 if (NumSegments > 0)
712 {
713 /*
714 * If we have an alias to an object that opens a scope (such as a
715 * device or processor), we need to dereference the alias here so
716 * that we can access any children of the original node (via the
717 * remaining segments).
718 */
719 if (ThisNode->Type == ACPI_TYPE_LOCAL_ALIAS)
720 {
721 if (!ThisNode->Object)
722 {
724 }
725
727 ThisNode->Object)->Type))
728 {
729 ThisNode = (ACPI_NAMESPACE_NODE *) ThisNode->Object;
730 }
731 }
732 }
733
734 /* Special handling for the last segment (NumSegments == 0) */
735
736 else
737 {
738 /*
739 * Sanity typecheck of the target object:
740 *
741 * If 1) This is the last segment (NumSegments == 0)
742 * 2) And we are looking for a specific type
743 * (Not checking for TYPE_ANY)
744 * 3) Which is not an alias
745 * 4) Which is not a local type (TYPE_SCOPE)
746 * 5) And the type of target object is known (not TYPE_ANY)
747 * 6) And target object does not match what we are looking for
748 *
749 * Then we have a type mismatch. Just warn and ignore it.
750 */
751 if ((TypeToCheckFor != ACPI_TYPE_ANY) &&
752 (TypeToCheckFor != ACPI_TYPE_LOCAL_ALIAS) &&
753 (TypeToCheckFor != ACPI_TYPE_LOCAL_METHOD_ALIAS) &&
754 (TypeToCheckFor != ACPI_TYPE_LOCAL_SCOPE) &&
755 (ThisNode->Type != ACPI_TYPE_ANY) &&
756 (ThisNode->Type != TypeToCheckFor))
757 {
758 /* Complain about a type mismatch */
759
761 "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)",
762 ACPI_CAST_PTR (char, &SimpleName),
763 AcpiUtGetTypeName (ThisNode->Type),
764 AcpiUtGetTypeName (TypeToCheckFor)));
765 }
766
767 /*
768 * If this is the last name segment and we are not looking for a
769 * specific type, but the type of found object is known, use that
770 * type to (later) see if it opens a scope.
771 */
772 if (Type == ACPI_TYPE_ANY)
773 {
774 Type = ThisNode->Type;
775 }
776 }
777
778 /* Point to next name segment and make this node current */
779
781 CurrentNode = ThisNode;
782 }
783
784 /* Always check if we need to open a new scope */
785
786 if (!(Flags & ACPI_NS_DONT_OPEN_SCOPE) && (WalkState))
787 {
788 /*
789 * If entry is a type which opens a scope, push the new scope on the
790 * scope stack.
791 */
793 {
794 Status = AcpiDsScopeStackPush (ThisNode, Type, WalkState);
795 if (ACPI_FAILURE (Status))
796 {
798 }
799 }
800 }
801
802#ifdef ACPI_EXEC_APP
804 {
805 ThisNode->Flags |= ANOBJ_NODE_EARLY_INIT;
806 }
807#endif
808
809 *ReturnNode = ThisNode;
811}
PRTL_UNICODE_STRING_BUFFER Path
void AcpiDmMarkExternalConflict(ACPI_NAMESPACE_NODE *Node)
#define AE_NOT_EXIST
Definition: acexcep.h:114
#define AE_NO_NAMESPACE
Definition: acexcep.h:111
#define ANOBJ_IS_EXTERNAL
Definition: aclocal.h:224
ACPI_INTERPRETER_MODE
Definition: aclocal.h:166
#define ANOBJ_NODE_EARLY_INIT
Definition: aclocal.h:222
#define ACPI_ENTRY_NOT_FOUND
Definition: aclocal.h:154
#define ACPI_NS_OVERRIDE_IF_FOUND
Definition: acnamesp.h:70
#define ACPI_NS_EARLY_INIT
Definition: acnamesp.h:71
#define ACPI_NS_ERROR_IF_FOUND
Definition: acnamesp.h:66
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)
Definition: nssearch.c:294
#define ACPI_NS_PREFIX_IS_SCOPE
Definition: acnamesp.h:67
void AcpiNsPrintPathname(UINT32 NumSegments, const char *Pathname)
#define ACPI_NS_PREFIX_MUST_EXIST
Definition: acnamesp.h:72
UINT32 AcpiNsOpensScope(ACPI_OBJECT_TYPE Type)
Definition: nsutils.c:736
#define ACPI_DEBUG_EXEC(a)
Definition: acoutput.h:477
void ACPI_INTERNAL_VAR_XFACE AcpiOsPrintf(const char *Format,...)
Definition: osl.c:851
#define ACPI_TYPE_LOCAL_ALIAS
Definition: actypes.h:720
UINT32 ACPI_NAME
Definition: actypes.h:461
#define ACPI_MSG_BIOS_ERROR
Definition: acutils.h:131
#define AML_EXTERNAL_OP
Definition: amlcode.h:65
ACPI_STATUS AcpiDsScopeStackPush(ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_TYPE Type, ACPI_WALK_STATE *WalkState)
Definition: dswscope.c:107
UINT NTAPI LocalFlags(HLOCAL hMem)
Definition: heapmem.c:1520
UINT16 Opcode
Definition: acstruct.h:78

Referenced by AcpiDsBuildInternalObject(), AcpiDsCreateBankField(), AcpiDsCreateBufferField(), AcpiDsCreateField(), AcpiDsCreateIndexField(), AcpiDsCreateOperand(), AcpiDsGetFieldNames(), AcpiDsInitFieldObjects(), AcpiDsLoad1BeginOp(), AcpiDsLoad2BeginOp(), AcpiDsLoad2EndOp(), AcpiDsResolvePackageElement(), AcpiInstallMethod(), AcpiNsConvertToReference(), AcpiNsGetNodeUnlocked(), and AcpiPsGetNextNamepath().

◆ AcpiNsNameOfCurrentScope()

char * AcpiNsNameOfCurrentScope ( ACPI_WALK_STATE WalkState)

◆ AcpiNsNormalizePathname()

void AcpiNsNormalizePathname ( char OriginalPath)

Definition at line 506 of file nsnames.c.

508{
509 char *InputPath = OriginalPath;
510 char *NewPathBuffer;
511 char *NewPath;
512 UINT32 i;
513
514
515 /* Allocate a temp buffer in which to construct the new path */
516
517 NewPathBuffer = ACPI_ALLOCATE_ZEROED (strlen (InputPath) + 1);
518 NewPath = NewPathBuffer;
519 if (!NewPathBuffer)
520 {
521 return;
522 }
523
524 /* Special characters may appear at the beginning of the path */
525
526 if (*InputPath == '\\')
527 {
528 *NewPath = *InputPath;
529 NewPath++;
530 InputPath++;
531 }
532
533 while (*InputPath == '^')
534 {
535 *NewPath = *InputPath;
536 NewPath++;
537 InputPath++;
538 }
539
540 /* Remainder of the path */
541
542 while (*InputPath)
543 {
544 /* Do one nameseg at a time */
545
546 for (i = 0; (i < ACPI_NAMESEG_SIZE) && *InputPath; i++)
547 {
548 if ((i == 0) || (*InputPath != '_')) /* First char is allowed to be underscore */
549 {
550 *NewPath = *InputPath;
551 NewPath++;
552 }
553
554 InputPath++;
555 }
556
557 /* Dot means that there are more namesegs to come */
558
559 if (*InputPath == '.')
560 {
561 *NewPath = *InputPath;
562 NewPath++;
563 InputPath++;
564 }
565 }
566
567 *NewPath = 0;
568 strcpy (OriginalPath, NewPathBuffer);
569 ACPI_FREE (NewPathBuffer);
570}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by AcpiNsBuildPrefixedPathname().

◆ AcpiNsOneCompleteParse()

ACPI_STATUS AcpiNsOneCompleteParse ( UINT32  PassNumber,
UINT32  TableIndex,
ACPI_NAMESPACE_NODE StartNode 
)

Definition at line 194 of file nsparse.c.

198{
199 ACPI_PARSE_OBJECT *ParseRoot;
201 UINT32 AmlLength;
202 UINT8 *AmlStart;
203 ACPI_WALK_STATE *WalkState;
206
207
208 ACPI_FUNCTION_TRACE (NsOneCompleteParse);
209
210
211 Status = AcpiGetTableByIndex (TableIndex, &Table);
212 if (ACPI_FAILURE (Status))
213 {
215 }
216
217 /* Table must consist of at least a complete header */
218
219 if (Table->Length < sizeof (ACPI_TABLE_HEADER))
220 {
222 }
223
224 AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
225 AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
226
227 Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
228 if (ACPI_FAILURE (Status))
229 {
231 }
232
233 /* Create and init a Root Node */
234
235 ParseRoot = AcpiPsCreateScopeOp (AmlStart);
236 if (!ParseRoot)
237 {
239 }
240
241 /* Create and initialize a new walk state */
242
243 WalkState = AcpiDsCreateWalkState (OwnerId, NULL, NULL, NULL);
244 if (!WalkState)
245 {
246 AcpiPsFreeOp (ParseRoot);
248 }
249
250 Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL,
251 AmlStart, AmlLength, NULL, (UINT8) PassNumber);
252 if (ACPI_FAILURE (Status))
253 {
254 AcpiDsDeleteWalkState (WalkState);
255 goto Cleanup;
256 }
257
258 /* Found OSDT table, enable the namespace override feature */
259
260 if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_OSDT) &&
261 PassNumber == ACPI_IMODE_LOAD_PASS1)
262 {
263 WalkState->NamespaceOverride = TRUE;
264 }
265
266 /* StartNode is the default location to load the table */
267
268 if (StartNode && StartNode != AcpiGbl_RootNode)
269 {
271 StartNode, ACPI_TYPE_METHOD, WalkState);
272 if (ACPI_FAILURE (Status))
273 {
274 AcpiDsDeleteWalkState (WalkState);
275 goto Cleanup;
276 }
277 }
278
279 /* Parse the AML */
280
282 "*PARSE* pass %u parse\n", PassNumber));
284 Status = AcpiPsParseAml (WalkState);
286
287Cleanup:
288 AcpiPsDeleteParseTree (ParseRoot);
290}
@ ACPI_IMODE_LOAD_PASS1
Definition: aclocal.h:167
void AcpiPsDeleteParseTree(ACPI_PARSE_OBJECT *root)
Definition: pswalk.c:67
void AcpiPsFreeOp(ACPI_PARSE_OBJECT *Op)
Definition: psutils.c:212
ACPI_STATUS AcpiPsParseAml(ACPI_WALK_STATE *WalkState)
Definition: psparse.c:453
ACPI_PARSE_OBJECT * AcpiPsCreateScopeOp(UINT8 *Aml)
Definition: psutils.c:67
#define ACPI_SIG_OSDT
Definition: actbl.h:70
#define ACPI_COMPARE_NAMESEG(a, b)
Definition: actypes.h:564
ACPI_WALK_STATE * AcpiDsCreateWalkState(ACPI_OWNER_ID OwnerId, ACPI_PARSE_OBJECT *Origin, ACPI_OPERAND_OBJECT *MethodDesc, ACPI_THREAD_STATE *Thread)
Definition: dswstate.c:600
ACPI_STATUS AcpiDsInitAmlWalk(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *MethodNode, UINT8 *AmlStart, UINT32 AmlLength, ACPI_EVALUATE_INFO *Info, UINT8 PassNumber)
Definition: dswstate.c:662
void AcpiDsDeleteWalkState(ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:780
BOOLEAN NamespaceOverride
Definition: acstruct.h:88

◆ AcpiNsOpensScope()

UINT32 AcpiNsOpensScope ( ACPI_OBJECT_TYPE  Type)

Definition at line 736 of file nsutils.c.

738{
740
741
743 {
744 /* type code out of range */
745
746 ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type));
747 return (ACPI_NS_NORMAL);
748 }
749
751}
#define ACPI_NS_NEWSCOPE
Definition: acnamesp.h:57
#define ACPI_TYPE_LOCAL_MAX
Definition: actypes.h:738

Referenced by AcpiDsExecBeginOp(), AcpiDsLoad1BeginOp(), AcpiDsLoad1EndOp(), AcpiDsLoad2BeginOp(), AcpiDsLoad2EndOp(), AcpiNsLookup(), and AcpiPsParseLoop().

◆ AcpiNsParseTable()

ACPI_STATUS AcpiNsParseTable ( UINT32  TableIndex,
ACPI_NAMESPACE_NODE StartNode 
)

Definition at line 307 of file nsparse.c.

310{
312
313
314 ACPI_FUNCTION_TRACE (NsParseTable);
315
316
317 /*
318 * Executes the AML table as one large control method.
319 * The point of this is to execute any module-level code in-place
320 * as the table is parsed. Some AML code depends on this behavior.
321 *
322 * Note: This causes the table to only have a single-pass parse.
323 * However, this is compatible with other ACPI implementations.
324 */
326 "%s: **** Start table execution pass\n", ACPI_GET_FUNCTION_NAME));
327
328 Status = AcpiNsExecuteTable (TableIndex, StartNode);
329
331}
ACPI_STATUS AcpiNsExecuteTable(UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode)
Definition: nsparse.c:81

Referenced by AcpiNsLoadTable().

◆ AcpiNsPatternMatch()

BOOLEAN AcpiNsPatternMatch ( ACPI_NAMESPACE_NODE ObjNode,
char SearchFor 
)

◆ AcpiNsPrintNodePathname()

void AcpiNsPrintNodePathname ( ACPI_NAMESPACE_NODE Node,
const char Msg 
)

Definition at line 75 of file nsutils.c.

78{
81
82
83 if (!Node)
84 {
85 AcpiOsPrintf ("[NULL NAME]");
86 return;
87 }
88
89 /* Convert handle to full pathname and print it (with supplied message) */
90
92
94 if (ACPI_SUCCESS (Status))
95 {
96 if (Message)
97 {
98 AcpiOsPrintf ("%s ", Message);
99 }
100
101 AcpiOsPrintf ("%s", (char *) Buffer.Pointer);
102 ACPI_FREE (Buffer.Pointer);
103 }
104}
ACPI_STATUS AcpiNsHandleToPathname(ACPI_HANDLE TargetHandle, ACPI_BUFFER *Buffer, BOOLEAN NoTrailing)
Definition: nsnames.c:187
#define ACPI_ALLOCATE_LOCAL_BUFFER
Definition: actypes.h:1047
static const WCHAR Message[]
Definition: register.c:74

Referenced by AcpiPsParseAml(), and AcpiUtMethodError().

◆ AcpiNsPrintPathname()

void AcpiNsPrintPathname ( UINT32  NumSegments,
const char Pathname 
)

Referenced by AcpiNsLookup().

◆ AcpiNsRemoveNode()

void AcpiNsRemoveNode ( ACPI_NAMESPACE_NODE Node)

Definition at line 188 of file nsalloc.c.

190{
191 ACPI_NAMESPACE_NODE *ParentNode;
192 ACPI_NAMESPACE_NODE *PrevNode;
193 ACPI_NAMESPACE_NODE *NextNode;
194
195
196 ACPI_FUNCTION_TRACE_PTR (NsRemoveNode, Node);
197
198
199 ParentNode = Node->Parent;
200
201 PrevNode = NULL;
202 NextNode = ParentNode->Child;
203
204 /* Find the node that is the previous peer in the parent's child list */
205
206 while (NextNode != Node)
207 {
208 PrevNode = NextNode;
209 NextNode = NextNode->Peer;
210 }
211
212 if (PrevNode)
213 {
214 /* Node is not first child, unlink it */
215
216 PrevNode->Peer = Node->Peer;
217 }
218 else
219 {
220 /*
221 * Node is first child (has no previous peer).
222 * Link peer list to parent
223 */
224 ParentNode->Child = Node->Peer;
225 }
226
227 /* Delete the node and any attached objects */
228
231}

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

◆ AcpiNsRemoveNullElements()

void AcpiNsRemoveNullElements ( ACPI_EVALUATE_INFO Info,
UINT8  PackageType,
ACPI_OPERAND_OBJECT ObjDesc 
)

Definition at line 494 of file nsrepair.c.

498{
500 ACPI_OPERAND_OBJECT **Dest;
502 UINT32 NewCount;
503 UINT32 i;
504
505
506 ACPI_FUNCTION_NAME (NsRemoveNullElements);
507
508
509 /*
510 * We can safely remove all NULL elements from these package types:
511 * PTYPE1_VAR packages contain a variable number of simple data types.
512 * PTYPE2 packages contain a variable number of subpackages.
513 */
514 switch (PackageType)
515 {
516 case ACPI_PTYPE1_VAR:
517 case ACPI_PTYPE2:
521 case ACPI_PTYPE2_MIN:
524 break;
525
526 default:
530 return;
531 }
532
533 Count = ObjDesc->Package.Count;
534 NewCount = Count;
535
536 Source = ObjDesc->Package.Elements;
537 Dest = Source;
538
539 /* Examine all elements of the package object, remove nulls */
540
541 for (i = 0; i < Count; i++)
542 {
543 if (!*Source)
544 {
545 NewCount--;
546 }
547 else
548 {
549 *Dest = *Source;
550 Dest++;
551 }
552
553 Source++;
554 }
555
556 /* Update parent package if any null elements were removed */
557
558 if (NewCount < Count)
559 {
561 "%s: Found and removed %u NULL elements\n",
562 Info->FullPathname, (Count - NewCount)));
563
564 /* NULL terminate list and update the package count */
565
566 *Dest = NULL;
567 ObjDesc->Package.Count = NewCount;
568 }
569}
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169

Referenced by AcpiNsCheckPackage().

◆ AcpiNsRepairNullElement()

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

Definition at line 405 of file nsrepair.c.

410{
411 ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
413
414
415 ACPI_FUNCTION_NAME (NsRepairNullElement);
416
417
418 /* No repair needed if return object is non-NULL */
419
420 if (ReturnObject)
421 {
422 return (AE_OK);
423 }
424
425 /*
426 * Attempt to repair a NULL element of a Package object. This applies to
427 * predefined names that return a fixed-length package and each element
428 * is required. It does not apply to variable-length packages where NULL
429 * elements are allowed, especially at the end of the package.
430 */
431 if (ExpectedBtypes & ACPI_RTYPE_INTEGER)
432 {
433 /* Need an Integer - create a zero-value integer */
434
436 }
437 else if (ExpectedBtypes & ACPI_RTYPE_STRING)
438 {
439 /* Need a String - create a NULL string */
440
442 }
443 else if (ExpectedBtypes & ACPI_RTYPE_BUFFER)
444 {
445 /* Need a Buffer - create a zero-length buffer */
446
448 }
449 else
450 {
451 /* Error for all other expected types */
452
453 return (AE_AML_OPERAND_TYPE);
454 }
455
456 if (!NewObject)
457 {
458 return (AE_NO_MEMORY);
459 }
460
461 /* Set the reference count according to the parent Package object */
462
463 NewObject->Common.ReferenceCount =
464 Info->ParentPackage->Common.ReferenceCount;
465
467 "%s: Converted NULL package element to expected %s at index %u\n",
468 Info->FullPathname, AcpiUtGetObjectTypeName (NewObject),
469 PackageIndex));
470
471 *ReturnObjectPtr = NewObject;
472 Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
473 return (AE_OK);
474}
#define ACPI_RTYPE_STRING
Definition: aclocal.h:479
#define ACPI_RTYPE_BUFFER
Definition: aclocal.h:480

Referenced by AcpiNsSimpleRepair().

◆ AcpiNsRootInitialize()

ACPI_STATUS AcpiNsRootInitialize ( void  )

Definition at line 73 of file nsaccess.c.

75{
77 const ACPI_PREDEFINED_NAMES *InitVal = NULL;
78 ACPI_NAMESPACE_NODE *NewNode;
79 ACPI_NAMESPACE_NODE *PrevNode = NULL;
80 ACPI_OPERAND_OBJECT *ObjDesc;
81 ACPI_STRING Val = NULL;
82
83
84 ACPI_FUNCTION_TRACE (NsRootInitialize);
85
86
88 if (ACPI_FAILURE (Status))
89 {
91 }
92
93 /*
94 * The global root ptr is initially NULL, so a non-NULL value indicates
95 * that AcpiNsRootInitialize() has already been called; just return.
96 */
97 if (AcpiGbl_RootNode)
98 {
99 Status = AE_OK;
100 goto UnlockAndExit;
101 }
102
103 /*
104 * Tell the rest of the subsystem that the root is initialized
105 * (This is OK because the namespace is locked)
106 */
107 AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct;
108
109 /* Enter the predefined names in the name table */
110
112 "Entering predefined entries into namespace\n"));
113
114 /*
115 * Create the initial (default) namespace.
116 * This namespace looks like something similar to this:
117 *
118 * ACPI Namespace (from Namespace Root):
119 * 0 _GPE Scope 00203160 00
120 * 0 _PR_ Scope 002031D0 00
121 * 0 _SB_ Device 00203240 00 Notify Object: 0020ADD8
122 * 0 _SI_ Scope 002032B0 00
123 * 0 _TZ_ Device 00203320 00
124 * 0 _REV Integer 00203390 00 = 0000000000000002
125 * 0 _OS_ String 00203488 00 Len 14 "Microsoft Windows NT"
126 * 0 _GL_ Mutex 00203580 00 Object 002035F0
127 * 0 _OSI Method 00203678 00 Args 1 Len 0000 Aml 00000000
128 */
129 for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++)
130 {
131 Status = AE_OK;
132
133 /* _OSI is optional for now, will be permanent later */
134
135 if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod)
136 {
137 continue;
138 }
139
140 /*
141 * Create, init, and link the new predefined name
142 * Note: No need to use AcpiNsLookup here because all the
143 * predefined names are at the root level. It is much easier to
144 * just create and link the new node(s) here.
145 */
146 NewNode = AcpiNsCreateNode (*ACPI_CAST_PTR (UINT32, InitVal->Name));
147 if (!NewNode)
148 {
150 goto UnlockAndExit;
151 }
152
154 NewNode->Type = InitVal->Type;
155
156 if (!PrevNode)
157 {
158 AcpiGbl_RootNodeStruct.Child = NewNode;
159 }
160 else
161 {
162 PrevNode->Peer = NewNode;
163 }
164
165 NewNode->Parent = &AcpiGbl_RootNodeStruct;
166 PrevNode = NewNode;
167
168 /*
169 * Name entered successfully. If entry in PreDefinedNames[] specifies
170 * an initial value, create the initial value.
171 */
172 if (InitVal->Val)
173 {
174 Status = AcpiOsPredefinedOverride (InitVal, &Val);
175 if (ACPI_FAILURE (Status))
176 {
178 "Could not override predefined %s",
179 InitVal->Name));
180 }
181
182 if (!Val)
183 {
184 Val = InitVal->Val;
185 }
186
187 /*
188 * Entry requests an initial value, allocate a
189 * descriptor for it.
190 */
191 ObjDesc = AcpiUtCreateInternalObject (InitVal->Type);
192 if (!ObjDesc)
193 {
195 goto UnlockAndExit;
196 }
197
198 /*
199 * Convert value string from table entry to
200 * internal representation. Only types actually
201 * used for initial values are implemented here.
202 */
203 switch (InitVal->Type)
204 {
205 case ACPI_TYPE_METHOD:
206
207 ObjDesc->Method.ParamCount = (UINT8) ACPI_TO_INTEGER (Val);
208 ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID;
209
210#if defined (ACPI_ASL_COMPILER)
211
212 /* Save the parameter count for the iASL compiler */
213
214 NewNode->Value = ObjDesc->Method.ParamCount;
215#else
216 /* Mark this as a very SPECIAL method (_OSI) */
217
220#endif
221 break;
222
224
225 ObjDesc->Integer.Value = ACPI_TO_INTEGER (Val);
226 break;
227
228 case ACPI_TYPE_STRING:
229
230 /* Build an object around the static string */
231
232 ObjDesc->String.Length = (UINT32) strlen (Val);
233 ObjDesc->String.Pointer = Val;
234 ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
235 break;
236
237 case ACPI_TYPE_MUTEX:
238
239 ObjDesc->Mutex.Node = NewNode;
240 ObjDesc->Mutex.SyncLevel = (UINT8) (ACPI_TO_INTEGER (Val) - 1);
241
242 /* Create a mutex */
243
245 if (ACPI_FAILURE (Status))
246 {
247 AcpiUtRemoveReference (ObjDesc);
248 goto UnlockAndExit;
249 }
250
251 /* Special case for ACPI Global Lock */
252
253 if (strcmp (InitVal->Name, "_GL_") == 0)
254 {
255 AcpiGbl_GlobalLockMutex = ObjDesc;
256
257 /* Create additional counting semaphore for global lock */
258
260 1, 0, &AcpiGbl_GlobalLockSemaphore);
261 if (ACPI_FAILURE (Status))
262 {
263 AcpiUtRemoveReference (ObjDesc);
264 goto UnlockAndExit;
265 }
266 }
267 break;
268
269 default:
270
271 ACPI_ERROR ((AE_INFO, "Unsupported initial type value 0x%X",
272 InitVal->Type));
273 AcpiUtRemoveReference (ObjDesc);
274 ObjDesc = NULL;
275 continue;
276 }
277
278 /* Store pointer to value descriptor in the Node */
279
280 Status = AcpiNsAttachObject (NewNode, ObjDesc,
281 ObjDesc->Common.Type);
282
283 /* Remove local reference to the object */
284
285 AcpiUtRemoveReference (ObjDesc);
286 }
287 }
288
289UnlockAndExit:
291
292 /* Save a handle to "_GPE", it is always present */
293
294 if (ACPI_SUCCESS (Status))
295 {
297 &AcpiGbl_FadtGpeDevice);
298 }
299
301}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[NUM_PREDEFINED_NAMES]
Definition: utglobal.c:113
ACPI_STATUS AcpiNsAttachObject(ACPI_NAMESPACE_NODE *Node, ACPI_OPERAND_OBJECT *Object, ACPI_OBJECT_TYPE Type)
Definition: nsobject.c:76
ACPI_NAMESPACE_NODE * AcpiNsCreateNode(UINT32 Name)
Definition: nsalloc.c:66
#define AOPOBJ_STATIC_POINTER
Definition: acobject.h:95
#define ACPI_METHOD_INTERNAL_ONLY
Definition: acobject.h:237
ACPI_STATUS AcpiOsPredefinedOverride(const ACPI_PREDEFINED_NAMES *InitVal, ACPI_STRING *NewVal)
Definition: osl.c:55
ACPI_STATUS AcpiOsCreateSemaphore(UINT32 MaxUnits, UINT32 InitialUnits, ACPI_SEMAPHORE *OutHandle)
Definition: osl.c:352
#define ACPI_TO_INTEGER(p)
Definition: actypes.h:554
char * ACPI_STRING
Definition: actypes.h:462
#define AcpiOsCreateMutex(OutHandle)
Definition: actypes.h:274
ACPI_STATUS AcpiUtOsiImplementation(ACPI_WALK_STATE *WalkState)
Definition: utosi.c:472
UINT8 DescriptorType
Definition: aclocal.h:188
union acpi_object_method::@610 Dispatch
ACPI_INTERNAL_METHOD Implementation
Definition: acobject.h:224
ACPI_OBJECT_COMMON_HEADER UINT8 SyncLevel
Definition: acobject.h:186
ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:193
ACPI_MUTEX OsMutex
Definition: acobject.h:188
const char * Name
Definition: actypes.h:1073
ACPI_OBJECT_MUTEX Mutex
Definition: acobject.h:526

Referenced by AcpiInitializeSubsystem().

◆ AcpiNsSearchAndEnter()

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 
)

Definition at line 294 of file nssearch.c.

302{
304 ACPI_NAMESPACE_NODE *NewNode;
305
306
307 ACPI_FUNCTION_TRACE (NsSearchAndEnter);
308
309
310 /* Parameter validation */
311
312 if (!Node || !TargetName || !ReturnNode)
313 {
315 "Null parameter: Node %p Name 0x%X ReturnNode %p",
316 Node, TargetName, ReturnNode));
318 }
319
320 /*
321 * Name must consist of valid ACPI characters. We will repair the name if
322 * necessary because we don't want to abort because of this, but we want
323 * all namespace names to be printable. A warning message is appropriate.
324 *
325 * This issue came up because there are in fact machines that exhibit
326 * this problem, and we want to be able to enable ACPI support for them,
327 * even though there are a few bad names.
328 */
330
331 /* Try to find the name in the namespace level specified by the caller */
332
333 *ReturnNode = ACPI_ENTRY_NOT_FOUND;
335 if (Status != AE_NOT_FOUND)
336 {
337 /*
338 * If we found it AND the request specifies that a find is an error,
339 * return the error
340 */
341 if (Status == AE_OK)
342 {
343 /* The node was found in the namespace */
344
345 /*
346 * If the namespace override feature is enabled for this node,
347 * delete any existing attached sub-object and make the node
348 * look like a new node that is owned by the override table.
349 */
351 {
353 "Namespace override: %4.4s pass %u type %X Owner %X\n",
354 ACPI_CAST_PTR(char, &TargetName), InterpreterMode,
355 (*ReturnNode)->Type, WalkState->OwnerId));
356
357 AcpiNsDeleteChildren (*ReturnNode);
358 if (AcpiGbl_RuntimeNamespaceOverride)
359 {
360 AcpiUtRemoveReference ((*ReturnNode)->Object);
361 (*ReturnNode)->Object = NULL;
362 (*ReturnNode)->OwnerId = WalkState->OwnerId;
363 }
364 else
365 {
366 AcpiNsRemoveNode (*ReturnNode);
367 *ReturnNode = ACPI_ENTRY_NOT_FOUND;
368 }
369 }
370
371 /* Return an error if we don't expect to find the object */
372
373 else if (Flags & ACPI_NS_ERROR_IF_FOUND)
374 {
376 }
377 }
378
379#ifdef ACPI_ASL_COMPILER
380 if (*ReturnNode && (*ReturnNode)->Type == ACPI_TYPE_ANY)
381 {
382 (*ReturnNode)->Flags |= ANOBJ_IS_EXTERNAL;
383 }
384#endif
385
386 /* Either found it or there was an error: finished either way */
387
389 }
390
391 /*
392 * The name was not found. If we are NOT performing the first pass
393 * (name entry) of loading the namespace, search the parent tree (all the
394 * way to the root if necessary.) We don't want to perform the parent
395 * search when the namespace is actually being loaded. We want to perform
396 * the search when namespace references are being resolved (load pass 2)
397 * and during the execution phase.
398 */
399 if ((InterpreterMode != ACPI_IMODE_LOAD_PASS1) &&
401 {
402 /*
403 * Not found at this level - search parent tree according to the
404 * ACPI specification
405 */
407 if (ACPI_SUCCESS (Status))
408 {
410 }
411 }
412
413 /* In execute mode, just search, never add names. Exit now */
414
415 if (InterpreterMode == ACPI_IMODE_EXECUTE)
416 {
418 "%4.4s Not found in %p [Not adding]\n",
419 ACPI_CAST_PTR (char, &TargetName), Node));
420
422 }
423
424 /* Create the new named object */
425
426 NewNode = AcpiNsCreateNode (TargetName);
427 if (!NewNode)
428 {
430 }
431
432#ifdef ACPI_ASL_COMPILER
433
434 /* Node is an object defined by an External() statement */
435
436 if (Flags & ACPI_NS_EXTERNAL ||
437 (WalkState && WalkState->Opcode == AML_SCOPE_OP))
438 {
439 NewNode->Flags |= ANOBJ_IS_EXTERNAL;
440 }
441#endif
442
444 {
445 NewNode->Flags |= ANOBJ_TEMPORARY;
446 }
447
448 /* Install the new object into the parent's list of children */
449
450 AcpiNsInstallNode (WalkState, Node, NewNode, Type);
451 *ReturnNode = NewNode;
453}
#define ANOBJ_TEMPORARY
Definition: aclocal.h:216
void AcpiNsDeleteChildren(ACPI_NAMESPACE_NODE *Parent)
Definition: nsalloc.c:341
#define ACPI_NS_EXTERNAL
Definition: acnamesp.h:68
void AcpiNsInstallNode(ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE *ParentNode, ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_TYPE Type)
Definition: nsalloc.c:255
#define ACPI_NS_TEMPORARY
Definition: acnamesp.h:69
void AcpiNsRemoveNode(ACPI_NAMESPACE_NODE *Node)
Definition: nsalloc.c:188
#define AML_SCOPE_OP
Definition: amlcode.h:60
ACPI_STATUS AcpiNsSearchOneScope(UINT32 TargetName, ACPI_NAMESPACE_NODE *ParentNode, ACPI_OBJECT_TYPE Type, ACPI_NAMESPACE_NODE **ReturnNode)
Definition: nssearch.c:98
static ACPI_STATUS AcpiNsSearchParentTree(UINT32 TargetName, ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_TYPE Type, ACPI_NAMESPACE_NODE **ReturnNode)
Definition: nssearch.c:201
static PCWSTR TargetName
Definition: ping.c:67

Referenced by AcpiNsLookup().

◆ AcpiNsSearchOneScope()

ACPI_STATUS AcpiNsSearchOneScope ( UINT32  EntryName,
ACPI_NAMESPACE_NODE Node,
ACPI_OBJECT_TYPE  Type,
ACPI_NAMESPACE_NODE **  RetNode 
)

Definition at line 98 of file nssearch.c.

103{
105
106
107 ACPI_FUNCTION_TRACE (NsSearchOneScope);
108
109
110#ifdef ACPI_DEBUG_OUTPUT
111 if (ACPI_LV_NAMES & AcpiDbgLevel)
112 {
113 char *ScopeName;
114
115 ScopeName = AcpiNsGetNormalizedPathname (ParentNode, TRUE);
116 if (ScopeName)
117 {
119 "Searching %s (%p) For [%4.4s] (%s)\n",
120 ScopeName, ParentNode, ACPI_CAST_PTR (char, &TargetName),
122
123 ACPI_FREE (ScopeName);
124 }
125 }
126#endif
127
128 /*
129 * Search for name at this namespace level, which is to say that we
130 * must search for the name among the children of this object
131 */
132 Node = ParentNode->Child;
133 while (Node)
134 {
135 /* Check for match against the name */
136
137 if (Node->Name.Integer == TargetName)
138 {
139 /* Resolve a control method alias if any */
140
142 {
144 }
145
146 /* Found matching entry */
147
149 "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
150 ACPI_CAST_PTR (char, &TargetName),
151 AcpiUtGetTypeName (Node->Type),
152 Node, AcpiUtGetNodeName (ParentNode), ParentNode));
153
154 *ReturnNode = Node;
156 }
157
158 /* Didn't match name, move on to the next peer object */
159
160 Node = Node->Peer;
161 }
162
163 /* Searched entire namespace level, not found */
164
166 "Name [%4.4s] (%s) not found in search in scope [%4.4s] "
167 "%p first child %p\n",
169 AcpiUtGetNodeName (ParentNode), ParentNode, ParentNode->Child));
170
172}
#define ACPI_LV_NAMES
Definition: acoutput.h:102

Referenced by AcpiEvExecuteRegMethod(), AcpiNsSearchAndEnter(), and AcpiNsSearchParentTree().

◆ AcpiNsSimpleRepair()

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

Definition at line 153 of file nsrepair.c.

158{
159 ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
162 const ACPI_SIMPLE_REPAIR_INFO *Predefined;
163
164
165 ACPI_FUNCTION_NAME (NsSimpleRepair);
166
167
168 /*
169 * Special repairs for certain names that are in the repair table.
170 * Check if this name is in the list of repairable names.
171 */
172 Predefined = AcpiNsMatchSimpleRepair (Info->Node,
173 Info->ReturnBtype, PackageIndex);
174 if (Predefined)
175 {
176 if (!ReturnObject)
177 {
178 ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,
179 ACPI_WARN_ALWAYS, "Missing expected return value"));
180 }
181
182 Status = Predefined->ObjectConverter (Info->Node, ReturnObject,
183 &NewObject);
184 if (ACPI_FAILURE (Status))
185 {
186 /* A fatal error occurred during a conversion */
187
189 "During return object analysis"));
190 return (Status);
191 }
192 if (NewObject)
193 {
194 goto ObjectRepaired;
195 }
196 }
197
198 /*
199 * Do not perform simple object repair unless the return type is not
200 * expected.
201 */
202 if (Info->ReturnBtype & ExpectedBtypes)
203 {
204 return (AE_OK);
205 }
206
207 /*
208 * At this point, we know that the type of the returned object was not
209 * one of the expected types for this predefined name. Attempt to
210 * repair the object by converting it to one of the expected object
211 * types for this predefined name.
212 */
213
214 /*
215 * If there is no return value, check if we require a return value for
216 * this predefined name. Either one return value is expected, or none,
217 * for both methods and other objects.
218 *
219 * Try to fix if there was no return object. Warning if failed to fix.
220 */
221 if (!ReturnObject)
222 {
223 if (ExpectedBtypes && (!(ExpectedBtypes & ACPI_RTYPE_NONE)))
224 {
225 if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT)
226 {
227 ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,
228 ACPI_WARN_ALWAYS, "Found unexpected NULL package element"));
229
230 Status = AcpiNsRepairNullElement (Info, ExpectedBtypes,
231 PackageIndex, ReturnObjectPtr);
232 if (ACPI_SUCCESS (Status))
233 {
234 return (AE_OK); /* Repair was successful */
235 }
236 }
237 else
238 {
239 ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,
240 ACPI_WARN_ALWAYS, "Missing expected return value"));
241 }
242
243 return (AE_AML_NO_RETURN_VALUE);
244 }
245 }
246
247 if (ExpectedBtypes & ACPI_RTYPE_INTEGER)
248 {
249 Status = AcpiNsConvertToInteger (ReturnObject, &NewObject);
250 if (ACPI_SUCCESS (Status))
251 {
252 goto ObjectRepaired;
253 }
254 }
255 if (ExpectedBtypes & ACPI_RTYPE_STRING)
256 {
257 Status = AcpiNsConvertToString (ReturnObject, &NewObject);
258 if (ACPI_SUCCESS (Status))
259 {
260 goto ObjectRepaired;
261 }
262 }
263 if (ExpectedBtypes & ACPI_RTYPE_BUFFER)
264 {
265 Status = AcpiNsConvertToBuffer (ReturnObject, &NewObject);
266 if (ACPI_SUCCESS (Status))
267 {
268 goto ObjectRepaired;
269 }
270 }
271 if (ExpectedBtypes & ACPI_RTYPE_PACKAGE)
272 {
273 /*
274 * A package is expected. We will wrap the existing object with a
275 * new package object. It is often the case that if a variable-length
276 * package is required, but there is only a single object needed, the
277 * BIOS will return that object instead of wrapping it with a Package
278 * object. Note: after the wrapping, the package will be validated
279 * for correct contents (expected object type or types).
280 */
281 Status = AcpiNsWrapWithPackage (Info, ReturnObject, &NewObject);
282 if (ACPI_SUCCESS (Status))
283 {
284 /*
285 * The original object just had its reference count
286 * incremented for being inserted into the new package.
287 */
288 *ReturnObjectPtr = NewObject; /* New Package object */
289 Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
290 return (AE_OK);
291 }
292 }
293
294 /* We cannot repair this object */
295
296 return (AE_AML_OPERAND_TYPE);
297
298
299ObjectRepaired:
300
301 /* Object was successfully repaired */
302
303 if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT)
304 {
305 /* Update reference count of new object */
306
307 if (!(Info->ReturnFlags & ACPI_OBJECT_WRAPPED))
308 {
309 NewObject->Common.ReferenceCount =
310 ReturnObject->Common.ReferenceCount;
311 }
312
314 "%s: Converted %s to expected %s at Package index %u\n",
315 Info->FullPathname, AcpiUtGetObjectTypeName (ReturnObject),
316 AcpiUtGetObjectTypeName (NewObject), PackageIndex));
317 }
318 else
319 {
321 "%s: Converted %s to expected %s\n",
322 Info->FullPathname, AcpiUtGetObjectTypeName (ReturnObject),
324 }
325
326 /* Delete old object, install the new return object */
327
328 AcpiUtRemoveReference (ReturnObject);
329 *ReturnObjectPtr = NewObject;
330 Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
331 return (AE_OK);
332}
#define AE_AML_NO_RETURN_VALUE
Definition: acexcep.h:197
#define ACPI_RTYPE_PACKAGE
Definition: aclocal.h:481
#define ACPI_RTYPE_NONE
Definition: aclocal.h:477
ACPI_STATUS AcpiNsConvertToString(ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ReturnObject)
Definition: nsconvert.c:141
ACPI_STATUS AcpiNsConvertToBuffer(ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ReturnObject)
Definition: nsconvert.c:233
ACPI_STATUS AcpiNsConvertToInteger(ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ReturnObject)
Definition: nsconvert.c:70
#define ACPI_OBJECT_WRAPPED
Definition: acstruct.h:236
ACPI_STATUS AcpiNsWrapWithPackage(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ObjDescPtr)
Definition: nsrepair.c:597
static const ACPI_SIMPLE_REPAIR_INFO * AcpiNsMatchSimpleRepair(ACPI_NAMESPACE_NODE *Node, UINT32 ReturnBtype, UINT32 PackageIndex)
Definition: nsrepair.c:352
ACPI_STATUS AcpiNsRepairNullElement(ACPI_EVALUATE_INFO *Info, UINT32 ExpectedBtypes, UINT32 PackageIndex, ACPI_OPERAND_OBJECT **ReturnObjectPtr)
Definition: nsrepair.c:405
ACPI_OBJECT_CONVERTER ObjectConverter
Definition: aclocal.h:466

Referenced by AcpiNsCheckObjectType().

◆ AcpiNsTerminate()

void AcpiNsTerminate ( void  )

Definition at line 693 of file nsutils.c.

695{
697
698
699 ACPI_FUNCTION_TRACE (NsTerminate);
700
701
702 /*
703 * Free the entire namespace -- all nodes and all objects
704 * attached to the nodes
705 */
706 AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode);
707
708 /* Delete any objects attached to the root node */
709
711 if (ACPI_FAILURE (Status))
712 {
714 }
715
716 AcpiNsDeleteNode (AcpiGbl_RootNode);
718
719 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n"));
721}
void AcpiNsDeleteNamespaceSubtree(ACPI_NAMESPACE_NODE *ParentHandle)
Definition: nsalloc.c:399
void AcpiNsDeleteNode(ACPI_NAMESPACE_NODE *Node)
Definition: nsalloc.c:117

Referenced by AcpiUtSubsystemShutdown().

◆ AcpiNsValidateHandle()

ACPI_NAMESPACE_NODE * AcpiNsValidateHandle ( ACPI_HANDLE  Handle)

◆ AcpiNsWalkNamespace()

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 at line 190 of file nswalk.c.

199{
201 ACPI_STATUS MutexStatus;
202 ACPI_NAMESPACE_NODE *ChildNode;
203 ACPI_NAMESPACE_NODE *ParentNode;
204 ACPI_OBJECT_TYPE ChildType;
206 BOOLEAN NodePreviouslyVisited = FALSE;
207
208
209 ACPI_FUNCTION_TRACE (NsWalkNamespace);
210
211
212 /* Special case for the namespace Root Node */
213
214 if (StartNode == ACPI_ROOT_OBJECT)
215 {
216 StartNode = AcpiGbl_RootNode;
217 if (!StartNode)
218 {
220 }
221 }
222
223 /* Null child means "get first node" */
224
225 ParentNode = StartNode;
226 ChildNode = AcpiNsGetNextNode (ParentNode, NULL);
227 ChildType = ACPI_TYPE_ANY;
228 Level = 1;
229
230 /*
231 * Traverse the tree of nodes until we bubble back up to where we
232 * started. When Level is zero, the loop is done because we have
233 * bubbled up to (and passed) the original parent handle (StartEntry)
234 */
235 while (Level > 0 && ChildNode)
236 {
237 Status = AE_OK;
238
239 /* Found next child, get the type if we are not searching for ANY */
240
241 if (Type != ACPI_TYPE_ANY)
242 {
243 ChildType = ChildNode->Type;
244 }
245
246 /*
247 * Ignore all temporary namespace nodes (created during control
248 * method execution) unless told otherwise. These temporary nodes
249 * can cause a race condition because they can be deleted during
250 * the execution of the user function (if the namespace is
251 * unlocked before invocation of the user function.) Only the
252 * debugger namespace dump will examine the temporary nodes.
253 */
254 if ((ChildNode->Flags & ANOBJ_TEMPORARY) &&
256 {
258 }
259
260 /* Type must match requested type */
261
262 else if (ChildType == Type)
263 {
264 /*
265 * Found a matching node, invoke the user callback function.
266 * Unlock the namespace if flag is set.
267 */
269 {
271 if (ACPI_FAILURE (MutexStatus))
272 {
273 return_ACPI_STATUS (MutexStatus);
274 }
275 }
276
277 /*
278 * Invoke the user function, either descending, ascending,
279 * or both.
280 */
281 if (!NodePreviouslyVisited)
282 {
284 {
285 Status = DescendingCallback (ChildNode, Level,
287 }
288 }
289 else
290 {
292 {
293 Status = AscendingCallback (ChildNode, Level,
295 }
296 }
297
299 {
301 if (ACPI_FAILURE (MutexStatus))
302 {
303 return_ACPI_STATUS (MutexStatus);
304 }
305 }
306
307 switch (Status)
308 {
309 case AE_OK:
310 case AE_CTRL_DEPTH:
311
312 /* Just keep going */
313 break;
314
316
317 /* Exit now, with OK status */
318
320
321 default:
322
323 /* All others are valid exceptions */
324
326 }
327 }
328
329 /*
330 * Depth first search: Attempt to go down another level in the
331 * namespace if we are allowed to. Don't go any further if we have
332 * reached the caller specified maximum depth or if the user
333 * function has specified that the maximum depth has been reached.
334 */
335 if (!NodePreviouslyVisited &&
336 (Level < MaxDepth) &&
338 {
339 if (ChildNode->Child)
340 {
341 /* There is at least one child of this node, visit it */
342
343 Level++;
344 ParentNode = ChildNode;
345 ChildNode = AcpiNsGetNextNode (ParentNode, NULL);
346 continue;
347 }
348 }
349
350 /* No more children, re-visit this node */
351
352 if (!NodePreviouslyVisited)
353 {
354 NodePreviouslyVisited = TRUE;
355 continue;
356 }
357
358 /* No more children, visit peers */
359
360 ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode);
361 if (ChildNode)
362 {
363 NodePreviouslyVisited = FALSE;
364 }
365
366 /* No peers, re-visit parent */
367
368 else
369 {
370 /*
371 * No more children of this node (AcpiNsGetNextNode failed), go
372 * back upwards in the namespace tree to the node's parent.
373 */
374 Level--;
375 ChildNode = ParentNode;
376 ParentNode = ParentNode->Parent;
377
378 NodePreviouslyVisited = TRUE;
379 }
380 }
381
382 /* Complete walk, not terminated by user function */
383
385}
UINT32 void void ** ReturnValue
Definition: acevents.h:216
#define AE_CTRL_TERMINATE
Definition: acexcep.h:226
#define AE_CTRL_DEPTH
Definition: acexcep.h:229
#define ACPI_NS_WALK_TEMP_NODES
Definition: acnamesp.h:78
#define ACPI_NS_WALK_UNLOCK
Definition: acnamesp.h:77
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK DescendingCallback
Definition: acpixf.h:641
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK AscendingCallback
Definition: acpixf.h:642
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 MaxDepth
Definition: acpixf.h:640

Referenced by AcpiDsInitializeObjects(), AcpiEvCreateGpeBlock(), AcpiEvExecuteRegMethods(), AcpiEvInstallSpaceHandler(), AcpiEvUpdateGpes(), AcpiGetDevices(), AcpiNsInitializeDevices(), and AcpiWalkNamespace().

◆ AcpiNsWrapWithPackage()

ACPI_STATUS AcpiNsWrapWithPackage ( ACPI_EVALUATE_INFO Info,
ACPI_OPERAND_OBJECT OriginalObject,
ACPI_OPERAND_OBJECT **  ObjDescPtr 
)

Definition at line 597 of file nsrepair.c.

601{
602 ACPI_OPERAND_OBJECT *PkgObjDesc;
603
604
605 ACPI_FUNCTION_NAME (NsWrapWithPackage);
606
607
608 /*
609 * Create the new outer package and populate it. The new
610 * package will have a single element, the lone sub-object.
611 */
612 PkgObjDesc = AcpiUtCreatePackageObject (1);
613 if (!PkgObjDesc)
614 {
615 return (AE_NO_MEMORY);
616 }
617
618 PkgObjDesc->Package.Elements[0] = OriginalObject;
619
621 "%s: Wrapped %s with expected Package object\n",
622 Info->FullPathname, AcpiUtGetObjectTypeName (OriginalObject)));
623
624 /* Return the new object in the object pointer */
625
626 *ObjDescPtr = PkgObjDesc;
628 return (AE_OK);
629}
ACPI_OPERAND_OBJECT * AcpiUtCreatePackageObject(UINT32 Count)
Definition: utobject.c:174

Referenced by AcpiNsCheckPackage(), and AcpiNsSimpleRepair().