diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2015-11-25 21:04:42 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2015-11-25 21:04:42 +0000 |
commit | b9098066cd6284319bca922f13e59517f774a103 (patch) | |
tree | f01fd6c9053cb01ed84c00cb42ee789adafceaf5 /source/components/namespace | |
parent | 1e24cf365bc9c8df179b145c90d52852724e54ee (diff) |
Notes
Diffstat (limited to 'source/components/namespace')
21 files changed, 174 insertions, 157 deletions
diff --git a/source/components/namespace/nsaccess.c b/source/components/namespace/nsaccess.c index 615257aefee41..774d7c0b74bb6 100644 --- a/source/components/namespace/nsaccess.c +++ b/source/components/namespace/nsaccess.c @@ -117,8 +117,8 @@ AcpiNsRootInitialize ( } Status = AcpiNsLookup (NULL, InitVal->Name, InitVal->Type, - ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, - NULL, &NewNode); + ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, + NULL, &NewNode); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, @@ -219,7 +219,7 @@ AcpiNsRootInitialize ( /* Create additional counting semaphore for global lock */ Status = AcpiOsCreateSemaphore ( - 1, 0, &AcpiGbl_GlobalLockSemaphore); + 1, 0, &AcpiGbl_GlobalLockSemaphore); if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ObjDesc); @@ -240,7 +240,7 @@ AcpiNsRootInitialize ( /* Store pointer to value descriptor in the Node */ Status = AcpiNsAttachObject (NewNode, ObjDesc, - ObjDesc->Common.Type); + ObjDesc->Common.Type); /* Remove local reference to the object */ @@ -257,7 +257,7 @@ UnlockAndExit: if (ACPI_SUCCESS (Status)) { Status = AcpiNsGetNode (NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH, - &AcpiGbl_FadtGpeDevice); + &AcpiGbl_FadtGpeDevice); } return_ACPI_STATUS (Status); @@ -589,7 +589,7 @@ AcpiNsLookup ( /* Try to find the single (4 character) ACPI name */ Status = AcpiNsSearchAndEnter (SimpleName, WalkState, CurrentNode, - InterpreterMode, ThisSearchType, LocalFlags, &ThisNode); + InterpreterMode, ThisSearchType, LocalFlags, &ThisNode); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) diff --git a/source/components/namespace/nsalloc.c b/source/components/namespace/nsalloc.c index 1939cac6f4dfe..f42fe2653a12f 100644 --- a/source/components/namespace/nsalloc.c +++ b/source/components/namespace/nsalloc.c @@ -85,7 +85,7 @@ AcpiNsCreateNode ( #ifdef ACPI_DBG_TRACK_ALLOCATIONS Temp = AcpiGbl_NsNodeList->TotalAllocated - - AcpiGbl_NsNodeList->TotalFreed; + AcpiGbl_NsNodeList->TotalFreed; if (Temp > AcpiGbl_NsNodeList->MaxOccupied) { AcpiGbl_NsNodeList->MaxOccupied = Temp; @@ -277,7 +277,8 @@ AcpiNsInstallNode ( * modified the namespace. This is used for cleanup when the * method exits. */ - WalkState->MethodDesc->Method.InfoFlags |= ACPI_METHOD_MODIFIED_NAMESPACE; + WalkState->MethodDesc->Method.InfoFlags |= + ACPI_METHOD_MODIFIED_NAMESPACE; } } diff --git a/source/components/namespace/nsarguments.c b/source/components/namespace/nsarguments.c index 93cf7a02e0f2a..054150d256250 100644 --- a/source/components/namespace/nsarguments.c +++ b/source/components/namespace/nsarguments.c @@ -137,7 +137,8 @@ AcpiNsCheckAcpiCompliance ( /* Get the ACPI-required arg count from the predefined info table */ - RequiredParamCount = METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList); + RequiredParamCount = + METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList); /* * If this object is not a control method, we can check if the ACPI @@ -283,7 +284,8 @@ AcpiNsCheckArgumentCount ( * Some methods are allowed to have a "minimum" number of args (_SCP) * because their definition in ACPI has changed over time. */ - RequiredParamCount = METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList); + RequiredParamCount = + METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList); if (UserParamCount < RequiredParamCount) { diff --git a/source/components/namespace/nsconvert.c b/source/components/namespace/nsconvert.c index c3ca5b8679be2..84eeec1fa48a4 100644 --- a/source/components/namespace/nsconvert.c +++ b/source/components/namespace/nsconvert.c @@ -84,7 +84,7 @@ AcpiNsConvertToInteger ( /* String-to-Integer conversion */ Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer, - ACPI_ANY_BASE, &Value); + ACPI_ANY_BASE, &Value); if (ACPI_FAILURE (Status)) { return (Status); @@ -104,7 +104,8 @@ AcpiNsConvertToInteger ( for (i = 0; i < OriginalObject->Buffer.Length; i++) { - Value |= ((UINT64) OriginalObject->Buffer.Pointer[i] << (i * 8)); + Value |= ((UINT64) + OriginalObject->Buffer.Pointer[i] << (i * 8)); } break; @@ -167,8 +168,8 @@ AcpiNsConvertToString ( } else { - Status = AcpiExConvertToString (OriginalObject, &NewObject, - ACPI_IMPLICIT_CONVERT_HEX); + Status = AcpiExConvertToString (OriginalObject, + &NewObject, ACPI_IMPLICIT_CONVERT_HEX); if (ACPI_FAILURE (Status)) { return (Status); @@ -263,7 +264,8 @@ AcpiNsConvertToBuffer ( /* String-to-Buffer conversion. Simple data copy */ - NewObject = AcpiUtCreateBufferObject (OriginalObject->String.Length); + NewObject = AcpiUtCreateBufferObject + (OriginalObject->String.Length); if (!NewObject) { return (AE_NO_MEMORY); diff --git a/source/components/namespace/nsdump.c b/source/components/namespace/nsdump.c index 0e692baf3f960..93e24df4c1d36 100644 --- a/source/components/namespace/nsdump.c +++ b/source/components/namespace/nsdump.c @@ -258,7 +258,8 @@ AcpiNsDumpOneObject ( if (Type > ACPI_TYPE_LOCAL_MAX) { - ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type 0x%08X", Type)); + ACPI_WARNING ((AE_INFO, + "Invalid ACPI Object Type 0x%08X", Type)); } AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode)); @@ -267,7 +268,7 @@ AcpiNsDumpOneObject ( /* Now we can print out the pertinent information */ AcpiOsPrintf (" %-12s %p %2.2X ", - AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId); + AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId); DbgLevel = AcpiDbgLevel; AcpiDbgLevel = 0; @@ -354,7 +355,7 @@ AcpiNsDumpOneObject ( if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf ("Len %.2X", - ObjDesc->Buffer.Length); + ObjDesc->Buffer.Length); /* Dump some of the buffer */ @@ -535,9 +536,9 @@ AcpiNsDumpOneObject ( /* If there is an attached object, display it */ - DbgLevel = AcpiDbgLevel; + DbgLevel = AcpiDbgLevel; AcpiDbgLevel = 0; - ObjDesc = AcpiNsGetAttachedObject (ThisNode); + ObjDesc = AcpiNsGetAttachedObject (ThisNode); AcpiDbgLevel = DbgLevel; /* Dump attached objects */ @@ -564,14 +565,18 @@ AcpiNsDumpOneObject ( if (ObjType > ACPI_TYPE_LOCAL_MAX) { - AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n", + AcpiOsPrintf ( + "(Pointer to ACPI Object type %.2X [UNKNOWN])\n", ObjType); + BytesToDump = 32; } else { - AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [%s])\n", + AcpiOsPrintf ( + "(Pointer to ACPI Object type %.2X [%s])\n", ObjType, AcpiUtGetTypeName (ObjType)); + BytesToDump = sizeof (ACPI_OPERAND_OBJECT); } @@ -601,7 +606,8 @@ AcpiNsDumpOneObject ( */ BytesToDump = ObjDesc->String.Length; ObjDesc = (void *) ObjDesc->String.Pointer; - AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n", + + AcpiOsPrintf ("(Buffer/String pointer %p length %X)\n", ObjDesc, BytesToDump); ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); goto Cleanup; @@ -702,8 +708,8 @@ AcpiNsDumpObjects ( Info.DisplayType = DisplayType; (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, - ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, - AcpiNsDumpOneObject, NULL, (void *) &Info, NULL); + ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, + AcpiNsDumpOneObject, NULL, (void *) &Info, NULL); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); } @@ -753,7 +759,7 @@ AcpiNsDumpOneObjectPath ( return (AE_OK); } - Pathname = AcpiNsGetExternalPathname (Node); + Pathname = AcpiNsGetNormalizedPathname (Node, TRUE); PathIndent = 1; if (Level <= MaxLevel) @@ -839,14 +845,14 @@ AcpiNsDumpObjectPaths ( /* Get the max depth of the namespace tree, for formatting later */ (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, - ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, - AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL); + ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, + AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL); /* Now dump the entire namespace */ (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, - ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, - AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL); + ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, + AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); } @@ -917,7 +923,8 @@ AcpiNsDumpTables ( * If the name space has not been initialized, * there is nothing to dump. */ - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, + "namespace not initialized!\n")); return_VOID; } @@ -930,7 +937,7 @@ AcpiNsDumpTables ( } AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth, - ACPI_OWNER_ID_MAX, SearchHandle); + ACPI_OWNER_ID_MAX, SearchHandle); return_VOID; } #endif diff --git a/source/components/namespace/nsdumpdv.c b/source/components/namespace/nsdumpdv.c index 0bfc029e7cc7a..818694e5c1be1 100644 --- a/source/components/namespace/nsdumpdv.c +++ b/source/components/namespace/nsdumpdv.c @@ -149,8 +149,8 @@ AcpiNsDumpRootDevices ( "Display of all devices in the namespace:\n")); Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, - ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, - AcpiNsDumpOneDevice, NULL, NULL, NULL); + ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, + AcpiNsDumpOneDevice, NULL, NULL, NULL); } #endif diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index bc7cdcfcc688f..0509c80e7a0c7 100644 --- a/source/components/namespace/nseval.c +++ b/source/components/namespace/nseval.c @@ -144,7 +144,7 @@ AcpiNsEvaluate ( /* Get the full pathname to the object, for use in warning messages */ - Info->FullPathname = AcpiNsGetExternalPathname (Info->Node); + Info->FullPathname = AcpiNsGetNormalizedPathname (Info->Node, TRUE); if (!Info->FullPathname) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -441,7 +441,7 @@ AcpiNsExecModuleCode ( * of the method object descriptor. */ ParentNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, - MethodObj->Method.NextObject); + MethodObj->Method.NextObject); Type = AcpiNsGetType (ParentNode); /* @@ -480,7 +480,7 @@ AcpiNsExecModuleCode ( /* Install the method (module-level code) in the parent node */ Status = AcpiNsAttachObject (ParentNode, MethodObj, - ACPI_TYPE_METHOD); + ACPI_TYPE_METHOD); if (ACPI_FAILURE (Status)) { goto Exit; diff --git a/source/components/namespace/nsinit.c b/source/components/namespace/nsinit.c index c80d2c88255a5..b2e2be324a0bd 100644 --- a/source/components/namespace/nsinit.c +++ b/source/components/namespace/nsinit.c @@ -110,8 +110,8 @@ AcpiNsInitializeObjects ( /* Walk entire namespace from the supplied root */ Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, - &Info, NULL); + ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, + &Info, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace")); @@ -173,7 +173,7 @@ AcpiNsInitializeDevices ( /* Tree analysis: find all subtrees that contain _INI methods */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, NULL, &Info, NULL); + ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, NULL, &Info, NULL); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -207,7 +207,7 @@ AcpiNsInitializeDevices ( /* Walk namespace to execute all _INIs on present devices */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL); + ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL); /* * Any _OSI requests should be completed by now. If the BIOS has @@ -631,7 +631,7 @@ AcpiNsInitOneDevice ( { /* Ignore error and move on to next device */ - char *ScopeName = AcpiNsGetExternalPathname (Info->Node); + char *ScopeName = AcpiNsGetNormalizedPathname (DeviceNode, TRUE); ACPI_EXCEPTION ((AE_INFO, Status, "during %s._INI execution", ScopeName)); diff --git a/source/components/namespace/nsload.c b/source/components/namespace/nsload.c index f893348e9670b..b1b6afa70615c 100644 --- a/source/components/namespace/nsload.c +++ b/source/components/namespace/nsload.c @@ -259,8 +259,8 @@ AcpiNsDeleteSubtree ( ParentHandle = StartHandle; - ChildHandle = NULL; - Level = 1; + ChildHandle = NULL; + Level = 1; /* * Traverse the tree of objects until we bubble back up @@ -271,7 +271,7 @@ AcpiNsDeleteSubtree ( /* Attempt to get the next object in this scope */ Status = AcpiGetNextObject (ACPI_TYPE_ANY, ParentHandle, - ChildHandle, &NextChildHandle); + ChildHandle, &NextChildHandle); ChildHandle = NextChildHandle; @@ -282,7 +282,7 @@ AcpiNsDeleteSubtree ( /* Check if this object has any children */ if (ACPI_SUCCESS (AcpiGetNextObject (ACPI_TYPE_ANY, ChildHandle, - NULL, &Dummy))) + NULL, &Dummy))) { /* * There is at least one child of this object, @@ -360,7 +360,6 @@ AcpiNsUnloadNamespace ( /* This function does the real work */ Status = AcpiNsDeleteSubtree (Handle); - return_ACPI_STATUS (Status); } #endif diff --git a/source/components/namespace/nsnames.c b/source/components/namespace/nsnames.c index ea10930d1e4ba..d132d9e1c4cda 100644 --- a/source/components/namespace/nsnames.c +++ b/source/components/namespace/nsnames.c @@ -77,7 +77,6 @@ AcpiNsGetExternalPathname ( NameBuffer = AcpiNsGetNormalizedPathname (Node, FALSE); - return_PTR (NameBuffer); } @@ -105,7 +104,6 @@ AcpiNsGetPathnameLength ( Size = AcpiNsBuildNormalizedPath (Node, NULL, 0, FALSE); - return (Size); } @@ -165,7 +163,7 @@ AcpiNsHandleToPathname ( /* Build the path in the caller buffer */ (void) AcpiNsBuildNormalizedPath (Node, Buffer->Pointer, - RequiredSize, NoTrailing); + RequiredSize, NoTrailing); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -246,6 +244,7 @@ AcpiNsBuildNormalizedPath ( { ACPI_PATH_PUT8(FullPath, PathSize, AML_DUAL_NAME_PREFIX, Length); } + ACPI_MOVE_32_TO_32 (Name, &NextNode->Name); DoNoTrailing = NoTrailing; for (i = 0; i < 4; i++) @@ -260,8 +259,10 @@ AcpiNsBuildNormalizedPath ( ACPI_PATH_PUT8(FullPath, PathSize, c, Length); } } + NextNode = NextNode->Parent; } + ACPI_PATH_PUT8(FullPath, PathSize, AML_ROOT_PREFIX, Length); /* Reverse the path string */ @@ -269,7 +270,8 @@ AcpiNsBuildNormalizedPath ( if (Length <= PathSize) { Left = FullPath; - Right = FullPath+Length-1; + Right = FullPath+Length - 1; + while (Left < Right) { c = *Left; @@ -281,7 +283,7 @@ AcpiNsBuildNormalizedPath ( /* Append the trailing null */ BuildTrailingNull: - ACPI_PATH_PUT8(FullPath, PathSize, '\0', Length); + ACPI_PATH_PUT8 (FullPath, PathSize, '\0', Length); #undef ACPI_PATH_PUT8 @@ -331,7 +333,8 @@ AcpiNsGetNormalizedPathname ( NameBuffer = ACPI_ALLOCATE_ZEROED (Size); if (!NameBuffer) { - ACPI_ERROR ((AE_INFO, "Could not allocate %u bytes", (UINT32) Size)); + ACPI_ERROR ((AE_INFO, + "Could not allocate %u bytes", (UINT32) Size)); return_PTR (NULL); } diff --git a/source/components/namespace/nsobject.c b/source/components/namespace/nsobject.c index a72fc93e4b52c..3bac53e3be019 100644 --- a/source/components/namespace/nsobject.c +++ b/source/components/namespace/nsobject.c @@ -145,7 +145,7 @@ AcpiNsAttachObject ( * Value passed is a name handle and that name has a * non-null value. Use that name's value and type. */ - ObjDesc = ((ACPI_NAMESPACE_NODE *) Object)->Object; + ObjDesc = ((ACPI_NAMESPACE_NODE *) Object)->Object; ObjectType = ((ACPI_NAMESPACE_NODE *) Object)->Type; } @@ -195,8 +195,8 @@ AcpiNsAttachObject ( LastObjDesc->Common.NextObject = Node->Object; } - Node->Type = (UINT8) ObjectType; - Node->Object = ObjDesc; + Node->Type = (UINT8) ObjectType; + Node->Object = ObjDesc; return_ACPI_STATUS (AE_OK); } diff --git a/source/components/namespace/nsparse.c b/source/components/namespace/nsparse.c index 996db01747fb0..331be76da6939 100644 --- a/source/components/namespace/nsparse.c +++ b/source/components/namespace/nsparse.c @@ -124,7 +124,7 @@ AcpiNsOneCompleteParse ( } Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, - AmlStart, AmlLength, NULL, (UINT8) PassNumber); + AmlStart, AmlLength, NULL, (UINT8) PassNumber); if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); @@ -143,7 +143,8 @@ AcpiNsOneCompleteParse ( if (StartNode && StartNode != AcpiGbl_RootNode) { - Status = AcpiDsScopeStackPush (StartNode, ACPI_TYPE_METHOD, WalkState); + Status = AcpiDsScopeStackPush ( + StartNode, ACPI_TYPE_METHOD, WalkState); if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); @@ -153,7 +154,8 @@ AcpiNsOneCompleteParse ( /* Parse the AML */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %u parse\n", PassNumber)); + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "*PARSE* pass %u parse\n", PassNumber)); Status = AcpiPsParseAml (WalkState); Cleanup: @@ -197,8 +199,9 @@ AcpiNsParseTable ( * performs another complete parse of the AML. */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n")); + Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1, - TableIndex, StartNode); + TableIndex, StartNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -215,7 +218,7 @@ AcpiNsParseTable ( */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n")); Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, - TableIndex, StartNode); + TableIndex, StartNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/source/components/namespace/nsprepkg.c b/source/components/namespace/nsprepkg.c index 599af7e6a563c..beec84de88fa2 100644 --- a/source/components/namespace/nsprepkg.c +++ b/source/components/namespace/nsprepkg.c @@ -171,8 +171,8 @@ AcpiNsCheckPackage ( /* Validate all elements of the returned package */ Status = AcpiNsCheckPackageElements (Info, Elements, - Package->RetInfo.ObjectType1, Package->RetInfo.Count1, - Package->RetInfo.ObjectType2, Package->RetInfo.Count2, 0); + Package->RetInfo.ObjectType1, Package->RetInfo.Count1, + Package->RetInfo.ObjectType2, Package->RetInfo.Count2, 0); break; case ACPI_PTYPE1_VAR: @@ -183,7 +183,7 @@ AcpiNsCheckPackage ( for (i = 0; i < Count; i++) { Status = AcpiNsCheckObjectType (Info, Elements, - Package->RetInfo.ObjectType1, i); + Package->RetInfo.ObjectType1, i); if (ACPI_FAILURE (Status)) { return (Status); @@ -215,7 +215,7 @@ AcpiNsCheckPackage ( /* These are the required package elements (0, 1, or 2) */ Status = AcpiNsCheckObjectType (Info, Elements, - Package->RetInfo3.ObjectType[i], i); + Package->RetInfo3.ObjectType[i], i); if (ACPI_FAILURE (Status)) { return (Status); @@ -226,7 +226,7 @@ AcpiNsCheckPackage ( /* These are the optional package elements */ Status = AcpiNsCheckObjectType (Info, Elements, - Package->RetInfo3.TailObjectType, i); + Package->RetInfo3.TailObjectType, i); if (ACPI_FAILURE (Status)) { return (Status); @@ -240,8 +240,8 @@ AcpiNsCheckPackage ( /* First element is the (Integer) revision */ - Status = AcpiNsCheckObjectType (Info, Elements, - ACPI_RTYPE_INTEGER, 0); + Status = AcpiNsCheckObjectType ( + Info, Elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { return (Status); @@ -259,8 +259,8 @@ AcpiNsCheckPackage ( /* First element is the (Integer) count of subpackages to follow */ - Status = AcpiNsCheckObjectType (Info, Elements, - ACPI_RTYPE_INTEGER, 0); + Status = AcpiNsCheckObjectType ( + Info, Elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { return (Status); @@ -303,7 +303,8 @@ AcpiNsCheckPackage ( { /* Create the new outer package and populate it */ - Status = AcpiNsWrapWithPackage (Info, ReturnObject, ReturnObjectPtr); + Status = AcpiNsWrapWithPackage ( + Info, ReturnObject, ReturnObjectPtr); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/source/components/namespace/nsrepair.c b/source/components/namespace/nsrepair.c index 160d84308561b..d98e11022eefa 100644 --- a/source/components/namespace/nsrepair.c +++ b/source/components/namespace/nsrepair.c @@ -222,7 +222,7 @@ AcpiNsSimpleRepair ( ACPI_WARN_ALWAYS, "Found unexpected NULL package element")); Status = AcpiNsRepairNullElement (Info, ExpectedBtypes, - PackageIndex, ReturnObjectPtr); + PackageIndex, ReturnObjectPtr); if (ACPI_SUCCESS (Status)) { return (AE_OK); /* Repair was successful */ @@ -380,6 +380,7 @@ AcpiNsMatchSimpleRepair ( return (NULL); } + ThisName++; } @@ -464,11 +465,13 @@ AcpiNsRepairNullElement ( /* Set the reference count according to the parent Package object */ - NewObject->Common.ReferenceCount = Info->ParentPackage->Common.ReferenceCount; + NewObject->Common.ReferenceCount = + Info->ParentPackage->Common.ReferenceCount; ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, "%s: Converted NULL package element to expected %s at index %u\n", - Info->FullPathname, AcpiUtGetObjectTypeName (NewObject), PackageIndex)); + Info->FullPathname, AcpiUtGetObjectTypeName (NewObject), + PackageIndex)); *ReturnObjectPtr = NewObject; Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; @@ -551,6 +554,7 @@ AcpiNsRemoveNullElements ( *Dest = *Source; Dest++; } + Source++; } @@ -607,8 +611,8 @@ AcpiNsWrapWithPackage ( /* - * Create the new outer package and populate it. The new package will - * have a single element, the lone sub-object. + * Create the new outer package and populate it. The new + * package will have a single element, the lone sub-object. */ PkgObjDesc = AcpiUtCreatePackageObject (1); if (!PkgObjDesc) diff --git a/source/components/namespace/nsrepair2.c b/source/components/namespace/nsrepair2.c index f68f8bcced320..17c3ce5c5e108 100644 --- a/source/components/namespace/nsrepair2.c +++ b/source/components/namespace/nsrepair2.c @@ -254,6 +254,7 @@ AcpiNsMatchComplexRepair ( { return (ThisName); } + ThisName++; } @@ -286,7 +287,7 @@ AcpiNsRepair_ALR ( Status = AcpiNsCheckSortedList (Info, ReturnObject, 0, 2, 1, - ACPI_SORT_ASCENDING, "AmbientIlluminance"); + ACPI_SORT_ASCENDING, "AmbientIlluminance"); return (Status); } @@ -339,7 +340,8 @@ AcpiNsRepair_FDE ( if (ReturnObject->Buffer.Length != ACPI_FDE_BYTE_BUFFER_SIZE) { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, + Info->FullPathname, Info->NodeFlags, "Incorrect return buffer length %u, expected %u", ReturnObject->Buffer.Length, ACPI_FDE_DWORD_BUFFER_SIZE)); @@ -348,7 +350,8 @@ AcpiNsRepair_FDE ( /* Create the new (larger) buffer object */ - BufferObject = AcpiUtCreateBufferObject (ACPI_FDE_DWORD_BUFFER_SIZE); + BufferObject = AcpiUtCreateBufferObject ( + ACPI_FDE_DWORD_BUFFER_SIZE); if (!BufferObject) { return (AE_NO_MEMORY); @@ -357,7 +360,8 @@ AcpiNsRepair_FDE ( /* Expand each byte to a DWORD */ ByteBuffer = ReturnObject->Buffer.Pointer; - DwordBuffer = ACPI_CAST_PTR (UINT32, BufferObject->Buffer.Pointer); + DwordBuffer = ACPI_CAST_PTR (UINT32, + BufferObject->Buffer.Pointer); for (i = 0; i < ACPI_FDE_FIELD_COUNT; i++) { @@ -510,7 +514,8 @@ AcpiNsRepair_CST ( if ((*OuterElements)->Package.Count == 0) { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, + Info->FullPathname, Info->NodeFlags, "SubPackage[%u] - removing entry due to zero count", i)); Removing = TRUE; goto RemoveElement; @@ -519,7 +524,8 @@ AcpiNsRepair_CST ( ObjDesc = (*OuterElements)->Package.Elements[1]; /* Index1 = Type */ if ((UINT32) ObjDesc->Integer.Value == 0) { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, + Info->FullPathname, Info->NodeFlags, "SubPackage[%u] - removing entry due to invalid Type(0)", i)); Removing = TRUE; } @@ -546,7 +552,7 @@ RemoveElement: * C-state type, in ascending order. */ Status = AcpiNsCheckSortedList (Info, ReturnObject, 1, 4, 1, - ACPI_SORT_ASCENDING, "C-State Type"); + ACPI_SORT_ASCENDING, "C-State Type"); if (ACPI_FAILURE (Status)) { return (Status); @@ -594,7 +600,8 @@ AcpiNsRepair_HID ( if (ReturnObject->String.Length == 0) { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, + Info->FullPathname, Info->NodeFlags, "Invalid zero-length _HID or _CID string")); /* Return AE_OK anyway, let driver handle it */ @@ -756,8 +763,8 @@ AcpiNsRepair_PSS ( * incorrectly sorted, sort it. We sort by CpuFrequency, since this * should be proportional to the power. */ - Status =AcpiNsCheckSortedList (Info, ReturnObject, 0, 6, 0, - ACPI_SORT_DESCENDING, "CpuFrequency"); + Status = AcpiNsCheckSortedList (Info, ReturnObject, 0, 6, 0, + ACPI_SORT_DESCENDING, "CpuFrequency"); if (ACPI_FAILURE (Status)) { return (Status); @@ -778,7 +785,8 @@ AcpiNsRepair_PSS ( if ((UINT32) ObjDesc->Integer.Value > PreviousValue) { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, + Info->FullPathname, Info->NodeFlags, "SubPackage[%u,%u] - suspicious power dissipation values", i-1, i)); } @@ -832,7 +840,7 @@ AcpiNsRepair_TSS ( } Status = AcpiNsCheckSortedList (Info, ReturnObject, 0, 5, 1, - ACPI_SORT_DESCENDING, "PowerDissipation"); + ACPI_SORT_DESCENDING, "PowerDissipation"); return (Status); } @@ -1064,6 +1072,7 @@ AcpiNsRemoveElement ( *Dest = *Source; Dest++; } + Source++; } diff --git a/source/components/namespace/nssearch.c b/source/components/namespace/nssearch.c index bdd4e8684e1a5..fa6fc87806d3b 100644 --- a/source/components/namespace/nssearch.c +++ b/source/components/namespace/nssearch.c @@ -112,7 +112,7 @@ AcpiNsSearchOneScope ( { char *ScopeName; - ScopeName = AcpiNsGetExternalPathname (ParentNode); + ScopeName = AcpiNsGetNormalizedPathname (ParentNode, TRUE); if (ScopeName) { ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, @@ -248,7 +248,7 @@ AcpiNsSearchParentTree ( * the actual name we are searching for. Typechecking comes later. */ Status = AcpiNsSearchOneScope ( - TargetName, ParentNode, ACPI_TYPE_ANY, ReturnNode); + TargetName, ParentNode, ACPI_TYPE_ANY, ReturnNode); if (ACPI_SUCCESS (Status)) { return_ACPI_STATUS (Status); diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index 35a96c1b4b027..126794fde5d45 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -196,9 +196,10 @@ AcpiNsGetInternalNameLength ( Info->FullyQualified = FALSE; /* - * For the internal name, the required length is 4 bytes per segment, plus - * 1 each for RootPrefix, MultiNamePrefixOp, segment count, trailing null - * (which is not really needed, but no there's harm in putting it there) + * For the internal name, the required length is 4 bytes per segment, + * plus 1 each for RootPrefix, MultiNamePrefixOp, segment count, + * trailing null (which is not really needed, but no there's harm in + * putting it there) * * strlen() + 1 covers the first NameSeg, which has no path separator */ @@ -243,7 +244,7 @@ AcpiNsGetInternalNameLength ( } Info->Length = (ACPI_NAME_SIZE * Info->NumSegments) + - 4 + Info->NumCarats; + 4 + Info->NumCarats; Info->NextExternalChar = NextExternalChar; } @@ -574,7 +575,7 @@ AcpiNsExternalizeName ( * punctuation ('.') between object names, plus the NULL terminator. */ RequiredLength = PrefixLength + (4 * NumSegments) + - ((NumSegments > 0) ? (NumSegments - 1) : 0) + 1; + ((NumSegments > 0) ? (NumSegments - 1) : 0) + 1; /* * Check to see if we're still in bounds. If not, there's a problem @@ -612,7 +613,8 @@ AcpiNsExternalizeName ( /* Copy and validate the 4-char name segment */ - ACPI_MOVE_NAME (&(*ConvertedName)[j], &InternalName[NamesIndex]); + ACPI_MOVE_NAME (&(*ConvertedName)[j], + &InternalName[NamesIndex]); AcpiUtRepairName (&(*ConvertedName)[j]); j += ACPI_NAME_SIZE; @@ -813,6 +815,7 @@ AcpiNsGetNode ( { *ReturnNode = AcpiGbl_RootNode; } + return_ACPI_STATUS (AE_OK); } @@ -847,12 +850,12 @@ AcpiNsGetNode ( /* Lookup the name in the namespace */ Status = AcpiNsLookup (&ScopeInfo, InternalPath, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, (Flags | ACPI_NS_DONT_OPEN_SCOPE), - NULL, ReturnNode); + ACPI_IMODE_EXECUTE, (Flags | ACPI_NS_DONT_OPEN_SCOPE), + NULL, ReturnNode); if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s, %s\n", - Pathname, AcpiFormatException (Status))); + Pathname, AcpiFormatException (Status))); } (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); diff --git a/source/components/namespace/nswalk.c b/source/components/namespace/nswalk.c index c1cec4347697b..2deee0eb3827f 100644 --- a/source/components/namespace/nswalk.c +++ b/source/components/namespace/nswalk.c @@ -218,10 +218,10 @@ AcpiNsWalkNamespace ( /* Null child means "get first node" */ - ParentNode = StartNode; - ChildNode = AcpiNsGetNextNode (ParentNode, NULL); - ChildType = ACPI_TYPE_ANY; - Level = 1; + ParentNode = StartNode; + ChildNode = AcpiNsGetNextNode (ParentNode, NULL); + ChildType = ACPI_TYPE_ANY; + Level = 1; /* * Traverse the tree of nodes until we bubble back up to where we @@ -279,7 +279,7 @@ AcpiNsWalkNamespace ( if (DescendingCallback) { Status = DescendingCallback (ChildNode, Level, - Context, ReturnValue); + Context, ReturnValue); } } else @@ -287,7 +287,7 @@ AcpiNsWalkNamespace ( if (AscendingCallback) { Status = AscendingCallback (ChildNode, Level, - Context, ReturnValue); + Context, ReturnValue); } } diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c index 1a867bda8366c..e279f40959c52 100644 --- a/source/components/namespace/nsxfeval.c +++ b/source/components/namespace/nsxfeval.c @@ -432,13 +432,13 @@ AcpiEvaluateObject ( /* Get the size of the returned object */ Status = AcpiUtGetObjectSize (Info->ReturnObject, - &BufferSpaceNeeded); + &BufferSpaceNeeded); if (ACPI_SUCCESS (Status)) { /* Validate/Allocate/Clear caller buffer */ Status = AcpiUtInitializeBuffer (ReturnBuffer, - BufferSpaceNeeded); + BufferSpaceNeeded); if (ACPI_FAILURE (Status)) { /* @@ -454,8 +454,8 @@ AcpiEvaluateObject ( { /* We have enough space for the object, build it */ - Status = AcpiUtCopyIobjectToEobject (Info->ReturnObject, - ReturnBuffer); + Status = AcpiUtCopyIobjectToEobject ( + Info->ReturnObject, ReturnBuffer); } } } @@ -668,8 +668,8 @@ AcpiWalkNamespace ( } Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth, - ACPI_NS_WALK_UNLOCK, DescendingCallback, - AscendingCallback, Context, ReturnValue); + ACPI_NS_WALK_UNLOCK, DescendingCallback, + AscendingCallback, Context, ReturnValue); UnlockAndExit2: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); @@ -820,8 +820,8 @@ AcpiNsGetDeviceCallback ( /* We have a valid device, invoke the user function */ - Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context, - ReturnValue); + Status = Info->UserFunction (ObjHandle, NestingLevel, + Info->Context, ReturnValue); return (Status); } @@ -876,8 +876,8 @@ AcpiGetDevices ( * We're going to call their callback from OUR callback, so we need * to know what it is, and their context parameter. */ - Info.Hid = HID; - Info.Context = Context; + Info.Hid = HID; + Info.Context = Context; Info.UserFunction = UserFunction; /* @@ -893,8 +893,8 @@ AcpiGetDevices ( } Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, - AcpiNsGetDeviceCallback, NULL, &Info, ReturnValue); + ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, + AcpiNsGetDeviceCallback, NULL, &Info, ReturnValue); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); diff --git a/source/components/namespace/nsxfname.c b/source/components/namespace/nsxfname.c index 311431b2de842..757e6bc7675a7 100644 --- a/source/components/namespace/nsxfname.c +++ b/source/components/namespace/nsxfname.c @@ -177,7 +177,7 @@ AcpiGetName ( { ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; - char *NodeName; + const char *NodeName; /* Parameter validation */ @@ -199,7 +199,7 @@ AcpiGetName ( /* Get the full pathname (From the namespace root) */ Status = AcpiNsHandleToPathname (Handle, Buffer, - NameType == ACPI_FULL_PATHNAME ? FALSE : TRUE); + NameType == ACPI_FULL_PATHNAME ? FALSE : TRUE); return (Status); } @@ -265,7 +265,6 @@ AcpiNsCopyDeviceId ( ACPI_PNP_DEVICE_ID *Source, char *StringArea) { - /* Create the destination PNP_DEVICE_ID */ Dest->String = StringArea; @@ -291,11 +290,18 @@ AcpiNsCopyDeviceId ( * namespace node and possibly by running several standard * control methods (Such as in the case of a device.) * - * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB, - * _CLS, _STA, _ADR, _SxW, and _SxD methods. + * For Device and Processor objects, run the Device _HID, _UID, _CID, _STA, + * _CLS, _ADR, _SxW, and _SxD methods. * * Note: Allocates the return buffer, must be freed by the caller. * + * Note: This interface is intended to be used during the initial device + * discovery namespace traversal. Therefore, no complex methods can be + * executed, especially those that access operation regions. Therefore, do + * not add any additional methods that could cause problems in this area. + * this was the fate of the _SUB method which was found to cause such + * problems and was removed (11/2015). + * ******************************************************************************/ ACPI_STATUS @@ -308,7 +314,6 @@ AcpiGetObjectInfo ( ACPI_PNP_DEVICE_ID_LIST *CidList = NULL; ACPI_PNP_DEVICE_ID *Hid = NULL; ACPI_PNP_DEVICE_ID *Uid = NULL; - ACPI_PNP_DEVICE_ID *Sub = NULL; ACPI_PNP_DEVICE_ID *Cls = NULL; char *NextIdString; ACPI_OBJECT_TYPE Type; @@ -362,7 +367,7 @@ AcpiGetObjectInfo ( { /* * Get extra info for ACPI Device/Processor objects only: - * Run the Device _HID, _UID, _SUB, _CID, and _CLS methods. + * Run the Device _HID, _UID, _CLS, and _CID methods. * * Note: none of these methods are required, so they may or may * not be present for this device. The Info->Valid bitfield is used @@ -387,15 +392,6 @@ AcpiGetObjectInfo ( Valid |= ACPI_VALID_UID; } - /* Execute the Device._SUB method */ - - Status = AcpiUtExecute_SUB (Node, &Sub); - if (ACPI_SUCCESS (Status)) - { - InfoSize += Sub->Length; - Valid |= ACPI_VALID_SUB; - } - /* Execute the Device._CID method */ Status = AcpiUtExecute_CID (Node, &CidList); @@ -458,7 +454,7 @@ AcpiGetObjectInfo ( /* Execute the Device._ADR method */ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, - &Info->Address); + &Info->Address); if (ACPI_SUCCESS (Status)) { Valid |= ACPI_VALID_ADR; @@ -467,8 +463,8 @@ AcpiGetObjectInfo ( /* Execute the Device._SxW methods */ Status = AcpiUtExecutePowerMethods (Node, - AcpiGbl_LowestDstateNames, ACPI_NUM_SxW_METHODS, - Info->LowestDstates); + AcpiGbl_LowestDstateNames, ACPI_NUM_SxW_METHODS, + Info->LowestDstates); if (ACPI_SUCCESS (Status)) { Valid |= ACPI_VALID_SXWS; @@ -477,8 +473,8 @@ AcpiGetObjectInfo ( /* Execute the Device._SxD methods */ Status = AcpiUtExecutePowerMethods (Node, - AcpiGbl_HighestDstateNames, ACPI_NUM_SxD_METHODS, - Info->HighestDstates); + AcpiGbl_HighestDstateNames, ACPI_NUM_SxD_METHODS, + Info->HighestDstates); if (ACPI_SUCCESS (Status)) { Valid |= ACPI_VALID_SXDS; @@ -498,9 +494,8 @@ AcpiGetObjectInfo ( } /* - * Copy the HID, UID, SUB, and CIDs to the return buffer. - * The variable-length strings are copied to the reserved area - * at the end of the buffer. + * Copy the HID, UID, and CIDs to the return buffer. The variable-length + * strings are copied to the reserved area at the end of the buffer. * * For HID and CID, check if the ID is a PCI Root Bridge. */ @@ -521,12 +516,6 @@ AcpiGetObjectInfo ( Uid, NextIdString); } - if (Sub) - { - NextIdString = AcpiNsCopyDeviceId (&Info->SubsystemId, - Sub, NextIdString); - } - if (CidList) { Info->CompatibleIdList.Count = CidList->Count; @@ -573,10 +562,6 @@ Cleanup: { ACPI_FREE (Uid); } - if (Sub) - { - ACPI_FREE (Sub); - } if (CidList) { ACPI_FREE (CidList); @@ -652,6 +637,7 @@ AcpiInstallMethod ( ParserState.Aml += AcpiPsGetOpcodeSize (Opcode); ParserState.PkgEnd = AcpiPsGetNextPackageEnd (&ParserState); Path = AcpiPsGetNextNamestring (&ParserState); + MethodFlags = *ParserState.Aml++; AmlStart = ParserState.Aml; AmlLength = ACPI_PTR_DIFF (ParserState.PkgEnd, AmlStart); @@ -684,7 +670,7 @@ AcpiInstallMethod ( /* The lookup either returns an existing node or creates a new one */ Status = AcpiNsLookup (NULL, Path, ACPI_TYPE_METHOD, ACPI_IMODE_LOAD_PASS1, - ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, NULL, &Node); + ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, NULL, &Node); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); diff --git a/source/components/namespace/nsxfobj.c b/source/components/namespace/nsxfobj.c index 6fed2b8709c3d..b23c32e02d36f 100644 --- a/source/components/namespace/nsxfobj.c +++ b/source/components/namespace/nsxfobj.c @@ -81,10 +81,8 @@ AcpiGetType ( return (AE_BAD_PARAMETER); } - /* - * Special case for the predefined Root Node - * (return type ANY) - */ + /* Special case for the predefined Root Node (return type ANY) */ + if (Handle == ACPI_ROOT_OBJECT) { *RetType = ACPI_TYPE_ANY; @@ -108,7 +106,6 @@ AcpiGetType ( *RetType = Node->Type; - Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (Status); } |