Print this page
update to acpica-unix2-20131115
acpica-unix2-20130823
PANKOVs restructure

*** 4,14 **** * parents and siblings and Scope manipulation * *****************************************************************************/ /* ! * Copyright (C) 2000 - 2011, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: --- 4,14 ---- * parents and siblings and Scope manipulation * *****************************************************************************/ /* ! * Copyright (C) 2000 - 2013, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met:
*** 52,65 **** #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsutils") /* Local prototypes */ - static BOOLEAN - AcpiNsValidPathSeparator ( - char Sep); - #ifdef ACPI_OBSOLETE_FUNCTIONS ACPI_NAME AcpiNsFindParentName ( ACPI_NAMESPACE_NODE *NodeToSearch); #endif --- 52,61 ----
*** 110,161 **** } /******************************************************************************* * - * FUNCTION: AcpiNsValidRootPrefix - * - * PARAMETERS: Prefix - Character to be checked - * - * RETURN: TRUE if a valid prefix - * - * DESCRIPTION: Check if a character is a valid ACPI Root prefix - * - ******************************************************************************/ - - BOOLEAN - AcpiNsValidRootPrefix ( - char Prefix) - { - - return ((BOOLEAN) (Prefix == '\\')); - } - - - /******************************************************************************* - * - * FUNCTION: AcpiNsValidPathSeparator - * - * PARAMETERS: Sep - Character to be checked - * - * RETURN: TRUE if a valid path separator - * - * DESCRIPTION: Check if a character is a valid ACPI path separator - * - ******************************************************************************/ - - static BOOLEAN - AcpiNsValidPathSeparator ( - char Sep) - { - - return ((BOOLEAN) (Sep == '.')); - } - - - /******************************************************************************* - * * FUNCTION: AcpiNsGetType * * PARAMETERS: Node - Parent Node to be examined * * RETURN: Type field from Node whose handle is passed --- 106,115 ----
*** 172,185 **** if (!Node) { ACPI_WARNING ((AE_INFO, "Null Node parameter")); ! return_UINT32 (ACPI_TYPE_ANY); } ! return_UINT32 ((ACPI_OBJECT_TYPE) Node->Type); } /******************************************************************************* * --- 126,139 ---- if (!Node) { ACPI_WARNING ((AE_INFO, "Null Node parameter")); ! return_UINT8 (ACPI_TYPE_ANY); } ! return_UINT8 (Node->Type); } /******************************************************************************* *
*** 207,217 **** ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type)); return_UINT32 (ACPI_NS_NORMAL); } ! return_UINT32 ((UINT32) AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL); } /******************************************************************************* * --- 161,171 ---- ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type)); return_UINT32 (ACPI_NS_NORMAL); } ! return_UINT32 (AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL); } /******************************************************************************* *
*** 248,274 **** * 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 */ ! if (AcpiNsValidRootPrefix (*NextExternalChar)) { Info->FullyQualified = TRUE; NextExternalChar++; /* Skip redundant RootPrefix, like \\_SB.PCI0.SBRG.EC0 */ ! while (AcpiNsValidRootPrefix (*NextExternalChar)) { NextExternalChar++; } } else { /* Handle Carat prefixes */ ! while (*NextExternalChar == '^') { Info->NumCarats++; NextExternalChar++; } } --- 202,228 ---- * 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 */ ! if (ACPI_IS_ROOT_PREFIX (*NextExternalChar)) { Info->FullyQualified = TRUE; NextExternalChar++; /* Skip redundant RootPrefix, like \\_SB.PCI0.SBRG.EC0 */ ! while (ACPI_IS_ROOT_PREFIX (*NextExternalChar)) { NextExternalChar++; } } else { /* Handle Carat prefixes */ ! while (ACPI_IS_PARENT_PREFIX (*NextExternalChar)) { Info->NumCarats++; NextExternalChar++; } }
*** 281,291 **** if (*NextExternalChar) { Info->NumSegments = 1; for (i = 0; NextExternalChar[i]; i++) { ! if (AcpiNsValidPathSeparator (NextExternalChar[i])) { Info->NumSegments++; } } } --- 235,245 ---- if (*NextExternalChar) { Info->NumSegments = 1; for (i = 0; NextExternalChar[i]; i++) { ! if (ACPI_IS_PATH_SEPARATOR (NextExternalChar[i])) { Info->NumSegments++; } } }
*** 326,336 **** /* Setup the correct prefixes, counts, and pointers */ if (Info->FullyQualified) { ! InternalName[0] = '\\'; if (NumSegments <= 1) { Result = &InternalName[1]; } --- 280,290 ---- /* Setup the correct prefixes, counts, and pointers */ if (Info->FullyQualified) { ! InternalName[0] = AML_ROOT_PREFIX; if (NumSegments <= 1) { Result = &InternalName[1]; }
*** 355,365 **** i = 0; if (Info->NumCarats) { for (i = 0; i < Info->NumCarats; i++) { ! InternalName[i] = '^'; } } if (NumSegments <= 1) { --- 309,319 ---- i = 0; if (Info->NumCarats) { for (i = 0; i < Info->NumCarats; i++) { ! InternalName[i] = AML_PARENT_PREFIX; } } if (NumSegments <= 1) {
*** 382,392 **** for (; NumSegments; NumSegments--) { for (i = 0; i < ACPI_NAME_SIZE; i++) { ! if (AcpiNsValidPathSeparator (*ExternalName) || (*ExternalName == 0)) { /* Pad the segment with underscore(s) if segment is short */ Result[i] = '_'; --- 336,346 ---- for (; NumSegments; NumSegments--) { for (i = 0; i < ACPI_NAME_SIZE; i++) { ! if (ACPI_IS_PATH_SEPARATOR (*ExternalName) || (*ExternalName == 0)) { /* Pad the segment with underscore(s) if segment is short */ Result[i] = '_';
*** 400,413 **** } } /* Now we must have a path separator, or the pathname is bad */ ! if (!AcpiNsValidPathSeparator (*ExternalName) && (*ExternalName != 0)) { ! return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Move on the next segment */ ExternalName++; --- 354,367 ---- } } /* Now we must have a path separator, or the pathname is bad */ ! if (!ACPI_IS_PATH_SEPARATOR (*ExternalName) && (*ExternalName != 0)) { ! return_ACPI_STATUS (AE_BAD_PATHNAME); } /* Move on the next segment */ ExternalName++;
*** 540,557 **** /* Check for a prefix (one '\' | one or more '^') */ switch (InternalName[0]) { ! case '\\': PrefixLength = 1; break; ! case '^': for (i = 0; i < InternalNameLength; i++) { ! if (InternalName[i] == '^') { PrefixLength = i + 1; } else { --- 494,513 ---- /* Check for a prefix (one '\' | one or more '^') */ switch (InternalName[0]) { ! case AML_ROOT_PREFIX: ! PrefixLength = 1; break; ! case AML_PARENT_PREFIX: ! for (i = 0; i < InternalNameLength; i++) { ! if (ACPI_IS_PARENT_PREFIX (InternalName[i])) { PrefixLength = i + 1; } else {
*** 565,574 **** --- 521,531 ---- } break; default: + break; } /* * Check for object names. Note that there could be 0-255 of these
*** 653,666 **** if (i > 0) { (*ConvertedName)[j++] = '.'; } ! (*ConvertedName)[j++] = InternalName[NamesIndex++]; ! (*ConvertedName)[j++] = InternalName[NamesIndex++]; ! (*ConvertedName)[j++] = InternalName[NamesIndex++]; ! (*ConvertedName)[j++] = InternalName[NamesIndex++]; } } if (ConvertedNameLength) { --- 610,626 ---- if (i > 0) { (*ConvertedName)[j++] = '.'; } ! /* Copy and validate the 4-char name segment */ ! ! ACPI_MOVE_NAME (&(*ConvertedName)[j], &InternalName[NamesIndex]); ! AcpiUtRepairName (&(*ConvertedName)[j]); ! ! j += ACPI_NAME_SIZE; ! NamesIndex += ACPI_NAME_SIZE; } } if (ConvertedNameLength) {
*** 731,761 **** void AcpiNsTerminate ( void) { ! ACPI_OPERAND_OBJECT *ObjDesc; ACPI_FUNCTION_TRACE (NsTerminate); /* ! * 1) Free the entire namespace -- all nodes and objects ! * ! * Delete all object descriptors attached to namepsace nodes */ AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode); ! /* Detach any objects attached to the root */ ! ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); ! if (ObjDesc) { ! AcpiNsDetachObject (AcpiGbl_RootNode); } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n")); return_VOID; } --- 691,723 ---- void AcpiNsTerminate ( void) { ! ACPI_STATUS Status; ACPI_FUNCTION_TRACE (NsTerminate); /* ! * Free the entire namespace -- all nodes and all objects ! * attached to the nodes */ AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode); ! /* Delete any objects attached to the root node */ ! Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); ! if (ACPI_FAILURE (Status)) { ! return_VOID; } + AcpiNsDeleteNode (AcpiGbl_RootNode); + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n")); return_VOID; }
*** 772,793 **** UINT32 AcpiNsOpensScope ( ACPI_OBJECT_TYPE Type) { ! ACPI_FUNCTION_TRACE_STR (NsOpensScope, AcpiUtGetTypeName (Type)); ! if (!AcpiUtValidObjectType (Type)) { /* type code out of range */ ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type)); ! return_UINT32 (ACPI_NS_NORMAL); } ! return_UINT32 (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE); } /******************************************************************************* * --- 734,755 ---- UINT32 AcpiNsOpensScope ( ACPI_OBJECT_TYPE Type) { ! ACPI_FUNCTION_ENTRY (); ! if (Type > ACPI_TYPE_LOCAL_MAX) { /* type code out of range */ ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type)); ! return (ACPI_NS_NORMAL); } ! return (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE); } /******************************************************************************* *
*** 824,842 **** --- 786,814 ---- ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname)); + /* Simplest case is a null pathname */ + if (!Pathname) { *ReturnNode = PrefixNode; if (!PrefixNode) { *ReturnNode = AcpiGbl_RootNode; } return_ACPI_STATUS (AE_OK); } + + /* Quick check for a reference to the root */ + + if (ACPI_IS_ROOT_PREFIX (Pathname[0]) && (!Pathname[1])) + { + *ReturnNode = AcpiGbl_RootNode; + return_ACPI_STATUS (AE_OK); + } /* Convert path to internal representation */ Status = AcpiNsInternalizeName (Pathname, &InternalPath); if (ACPI_FAILURE (Status))