Path: blob/main/sys/contrib/dev/acpica/compiler/aslanalyze.c
48373 views
/******************************************************************************1*2* Module Name: aslanalyze.c - Support functions for parse tree walks3*4*****************************************************************************/56/******************************************************************************7*8* 1. Copyright Notice9*10* Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.11* All rights reserved.12*13* 2. License14*15* 2.1. This is your license from Intel Corp. under its intellectual property16* rights. You may have additional license terms from the party that provided17* you this software, covering your right to use that party's intellectual18* property rights.19*20* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a21* copy of the source code appearing in this file ("Covered Code") an22* irrevocable, perpetual, worldwide license under Intel's copyrights in the23* base code distributed originally by Intel ("Original Intel Code") to copy,24* make derivatives, distribute, use and display any portion of the Covered25* Code in any form, with the right to sublicense such rights; and26*27* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent28* license (with the right to sublicense), under only those claims of Intel29* patents that are infringed by the Original Intel Code, to make, use, sell,30* offer to sell, and import the Covered Code and derivative works thereof31* solely to the minimum extent necessary to exercise the above copyright32* license, and in no event shall the patent license extend to any additions33* to or modifications of the Original Intel Code. No other license or right34* is granted directly or by implication, estoppel or otherwise;35*36* The above copyright and patent license is granted only if the following37* conditions are met:38*39* 3. Conditions40*41* 3.1. Redistribution of Source with Rights to Further Distribute Source.42* Redistribution of source code of any substantial portion of the Covered43* Code or modification with rights to further distribute source must include44* the above Copyright Notice, the above License, this list of Conditions,45* and the following Disclaimer and Export Compliance provision. In addition,46* Licensee must cause all Covered Code to which Licensee contributes to47* contain a file documenting the changes Licensee made to create that Covered48* Code and the date of any change. Licensee must include in that file the49* documentation of any changes made by any predecessor Licensee. Licensee50* must include a prominent statement that the modification is derived,51* directly or indirectly, from Original Intel Code.52*53* 3.2. Redistribution of Source with no Rights to Further Distribute Source.54* Redistribution of source code of any substantial portion of the Covered55* Code or modification without rights to further distribute source must56* include the following Disclaimer and Export Compliance provision in the57* documentation and/or other materials provided with distribution. In58* addition, Licensee may not authorize further sublicense of source of any59* portion of the Covered Code, and must include terms to the effect that the60* license from Licensee to its licensee is limited to the intellectual61* property embodied in the software Licensee provides to its licensee, and62* not to intellectual property embodied in modifications its licensee may63* make.64*65* 3.3. Redistribution of Executable. Redistribution in executable form of any66* substantial portion of the Covered Code or modification must reproduce the67* above Copyright Notice, and the following Disclaimer and Export Compliance68* provision in the documentation and/or other materials provided with the69* distribution.70*71* 3.4. Intel retains all right, title, and interest in and to the Original72* Intel Code.73*74* 3.5. Neither the name Intel nor any other trademark owned or controlled by75* Intel shall be used in advertising or otherwise to promote the sale, use or76* other dealings in products derived from or relating to the Covered Code77* without prior written authorization from Intel.78*79* 4. Disclaimer and Export Compliance80*81* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED82* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE83* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,84* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY85* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY86* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A87* PARTICULAR PURPOSE.88*89* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES90* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR91* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,92* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY93* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL94* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS95* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY96* LIMITED REMEDY.97*98* 4.3. Licensee shall not export, either directly or indirectly, any of this99* software or system incorporating such software without first obtaining any100* required license or other approval from the U. S. Department of Commerce or101* any other agency or department of the United States Government. In the102* event Licensee exports any such software from the United States or103* re-exports any such software from a foreign destination, Licensee shall104* ensure that the distribution and export/re-export of the software is in105* compliance with all laws, regulations, orders, or other restrictions of the106* U.S. Export Administration Regulations. Licensee agrees that neither it nor107* any of its subsidiaries will export/re-export any technical data, process,108* software, or service, directly or indirectly, to any country for which the109* United States government or any agency thereof requires an export license,110* other governmental approval, or letter of assurance, without first obtaining111* such license, approval or letter.112*113*****************************************************************************114*115* Alternatively, you may choose to be licensed under the terms of the116* following license:117*118* Redistribution and use in source and binary forms, with or without119* modification, are permitted provided that the following conditions120* are met:121* 1. Redistributions of source code must retain the above copyright122* notice, this list of conditions, and the following disclaimer,123* without modification.124* 2. Redistributions in binary form must reproduce at minimum a disclaimer125* substantially similar to the "NO WARRANTY" disclaimer below126* ("Disclaimer") and any redistribution must be conditioned upon127* including a substantially similar Disclaimer requirement for further128* binary redistribution.129* 3. Neither the names of the above-listed copyright holders nor the names130* of any contributors may be used to endorse or promote products derived131* from this software without specific prior written permission.132*133* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS134* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT135* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR136* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT137* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,138* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT139* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,140* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY141* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT142* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE143* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.144*145* Alternatively, you may choose to be licensed under the terms of the146* GNU General Public License ("GPL") version 2 as published by the Free147* Software Foundation.148*149*****************************************************************************/150151#include <contrib/dev/acpica/compiler/aslcompiler.h>152#include "aslcompiler.y.h"153#include <contrib/dev/acpica/include/acnamesp.h>154#include <string.h>155156157#define _COMPONENT ACPI_COMPILER158ACPI_MODULE_NAME ("aslanalyze")159160161/* Local Prototypes */162163static ACPI_STATUS164ApDeviceSubtreeWalk (165ACPI_PARSE_OBJECT *Op,166UINT32 Level,167void *Context);168169170/*******************************************************************************171*172* FUNCTION: AnIsInternalMethod173*174* PARAMETERS: Op - Current op175*176* RETURN: Boolean177*178* DESCRIPTION: Check for an internal control method.179*180******************************************************************************/181182BOOLEAN183AnIsInternalMethod (184ACPI_PARSE_OBJECT *Op)185{186187if ((!strcmp (Op->Asl.ExternalName, "\\_OSI")) ||188(!strcmp (Op->Asl.ExternalName, "_OSI")))189{190return (TRUE);191}192193return (FALSE);194}195196197/*******************************************************************************198*199* FUNCTION: AnGetInternalMethodReturnType200*201* PARAMETERS: Op - Current op202*203* RETURN: Btype204*205* DESCRIPTION: Get the return type of an internal method206*207******************************************************************************/208209UINT32210AnGetInternalMethodReturnType (211ACPI_PARSE_OBJECT *Op)212{213214if ((!strcmp (Op->Asl.ExternalName, "\\_OSI")) ||215(!strcmp (Op->Asl.ExternalName, "_OSI")))216{217return (ACPI_BTYPE_STRING);218}219220return (0);221}222223224/*******************************************************************************225*226* FUNCTION: AnCheckId227*228* PARAMETERS: Op - Current parse op229* Type - HID or CID230*231* RETURN: None232*233* DESCRIPTION: Perform various checks on _HID and _CID strings. Only limited234* checks can be performed on _CID strings.235*236******************************************************************************/237238void239AnCheckId (240ACPI_PARSE_OBJECT *Op,241ACPI_NAME Type)242{243UINT32 i;244ACPI_SIZE Length;245246247/* Only care about string versions of _HID/_CID (integers are legal) */248249if (Op->Asl.ParseOpcode != PARSEOP_STRING_LITERAL)250{251return;252}253254/* For both _HID and _CID, the string must be non-null */255256Length = strlen (Op->Asl.Value.String);257if (!Length)258{259AslError (ASL_ERROR, ASL_MSG_NULL_STRING, Op, NULL);260return;261}262263/*264* One of the things we want to catch here is the use of a leading265* asterisk in the string -- an odd construct that certain platform266* manufacturers are fond of. Technically, a leading asterisk is OK267* for _CID, but a valid use of this has not been seen.268*/269if (*Op->Asl.Value.String == '*')270{271AslError (ASL_ERROR, ASL_MSG_LEADING_ASTERISK,272Op, Op->Asl.Value.String);273return;274}275276/* _CID strings are bus-specific, no more checks can be performed */277278if (Type == ASL_TYPE_CID)279{280return;281}282283/* For _HID, all characters must be alphanumeric */284285for (i = 0; Op->Asl.Value.String[i]; i++)286{287if (!isalnum ((int) Op->Asl.Value.String[i]))288{289AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING,290Op, Op->Asl.Value.String);291return;292}293}294295/*296* _HID String must be one of these forms:297*298* "AAA####" A is an uppercase letter and # is a hex digit299* "ACPI####" # is a hex digit300* "NNNN####" N is an uppercase letter or decimal digit (0-9)301* # is a hex digit (ACPI 5.0)302*/303if ((Length < 7) || (Length > 8))304{305AslError (ASL_ERROR, ASL_MSG_HID_LENGTH,306Op, Op->Asl.Value.String);307return;308}309310/* _HID Length is valid (7 or 8), now check prefix (first 3 or 4 chars) */311312if (Length == 7)313{314/* AAA####: Ensure the alphabetic prefix is all uppercase */315316for (i = 0; i < 3; i++)317{318if (!isupper ((int) Op->Asl.Value.String[i]))319{320AslError (ASL_ERROR, ASL_MSG_UPPER_CASE,321Op, &Op->Asl.Value.String[i]);322return;323}324}325}326else /* Length == 8 */327{328/*329* ACPI#### or NNNN####:330* Ensure the prefix contains only uppercase alpha or decimal digits331*/332for (i = 0; i < 4; i++)333{334if (!isupper ((int) Op->Asl.Value.String[i]) &&335!isdigit ((int) Op->Asl.Value.String[i]))336{337AslError (ASL_ERROR, ASL_MSG_HID_PREFIX,338Op, &Op->Asl.Value.String[i]);339return;340}341}342}343344/* Remaining characters (suffix) must be hex digits */345346for (; i < Length; i++)347{348if (!isxdigit ((int) Op->Asl.Value.String[i]))349{350AslError (ASL_ERROR, ASL_MSG_HID_SUFFIX,351Op, &Op->Asl.Value.String[i]);352break;353}354}355}356357358/*******************************************************************************359*360* FUNCTION: AnLastStatementIsReturn361*362* PARAMETERS: Op - A method parse node363*364* RETURN: TRUE if last statement is an ASL RETURN. False otherwise365*366* DESCRIPTION: Walk down the list of top level statements within a method367* to find the last one. Check if that last statement is in368* fact a RETURN statement.369*370******************************************************************************/371372BOOLEAN373AnLastStatementIsReturn (374ACPI_PARSE_OBJECT *Op)375{376ACPI_PARSE_OBJECT *Next;377378379/* Check if last statement is a return */380381Next = ASL_GET_CHILD_NODE (Op);382while (Next)383{384if ((!Next->Asl.Next) &&385(Next->Asl.ParseOpcode == PARSEOP_RETURN))386{387return (TRUE);388}389390Next = ASL_GET_PEER_NODE (Next);391}392393return (FALSE);394}395396397/*******************************************************************************398*399* FUNCTION: AnCheckMethodReturnValue400*401* PARAMETERS: Op - Parent402* OpInfo - Parent info403* ArgOp - Method invocation op404* RequiredBtypes - What caller requires405* ThisNodeBtype - What this node returns (if anything)406*407* RETURN: None408*409* DESCRIPTION: Check a method invocation for 1) A return value and if it does410* in fact return a value, 2) check the type of the return value.411*412******************************************************************************/413414void415AnCheckMethodReturnValue (416ACPI_PARSE_OBJECT *Op,417const ACPI_OPCODE_INFO *OpInfo,418ACPI_PARSE_OBJECT *ArgOp,419UINT32 RequiredBtypes,420UINT32 ThisNodeBtype)421{422ACPI_PARSE_OBJECT *OwningOp;423ACPI_NAMESPACE_NODE *Node;424char *ExternalPath;425426427Node = ArgOp->Asl.Node;428429if (!Node)430{431/* No error message, this can happen and is OK */432433return;434}435436/* Examine the parent op of this method */437438OwningOp = Node->Op;439ExternalPath = AcpiNsGetNormalizedPathname (Node, TRUE);440441if (OwningOp->Asl.CompileFlags & OP_METHOD_NO_RETVAL)442{443/* Method NEVER returns a value */444445AslError (ASL_ERROR, ASL_MSG_NO_RETVAL, Op, ExternalPath);446}447else if (OwningOp->Asl.CompileFlags & OP_METHOD_SOME_NO_RETVAL)448{449/* Method SOMETIMES returns a value, SOMETIMES not */450451AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, Op, ExternalPath);452}453else if (!(ThisNodeBtype & RequiredBtypes))454{455/* Method returns a value, but the type is wrong */456457AnFormatBtype (AslGbl_StringBuffer, ThisNodeBtype);458AnFormatBtype (AslGbl_StringBuffer2, RequiredBtypes);459460/*461* The case where the method does not return any value at all462* was already handled in the namespace cross reference463* -- Only issue an error if the method in fact returns a value,464* but it is of the wrong type465*/466if (ThisNodeBtype != 0)467{468sprintf (AslGbl_MsgBuffer,469"Method returns [%s], %s operator requires [%s]",470AslGbl_StringBuffer, OpInfo->Name, AslGbl_StringBuffer2);471472AslError (ASL_WARNING, ASL_MSG_INVALID_TYPE, ArgOp, AslGbl_MsgBuffer);473}474}475476if (ExternalPath)477{478ACPI_FREE (ExternalPath);479}480}481482483/*******************************************************************************484*485* FUNCTION: AnIsResultUsed486*487* PARAMETERS: Op - Parent op for the operator488*489* RETURN: TRUE if result from this operation is actually consumed490*491* DESCRIPTION: Determine if the function result value from an operator is492* used.493*494******************************************************************************/495496BOOLEAN497AnIsResultUsed (498ACPI_PARSE_OBJECT *Op)499{500ACPI_PARSE_OBJECT *Parent;501502503switch (Op->Asl.ParseOpcode)504{505case PARSEOP_INCREMENT:506case PARSEOP_DECREMENT:507508/* These are standalone operators, no return value */509510return (TRUE);511512default:513514break;515}516517/* Examine parent to determine if the return value is used */518519Parent = Op->Asl.Parent;520switch (Parent->Asl.ParseOpcode)521{522/* If/While - check if the operator is the predicate */523524case PARSEOP_IF:525case PARSEOP_WHILE:526527/* First child is the predicate */528529if (Parent->Asl.Child == Op)530{531return (TRUE);532}533534return (FALSE);535536/* Not used if one of these is the parent */537538case PARSEOP_METHOD:539case PARSEOP_DEFINITION_BLOCK:540case PARSEOP_ELSE:541542return (FALSE);543544default:545546/* Any other type of parent means that the result is used */547548return (TRUE);549}550}551552553/*******************************************************************************554*555* FUNCTION: ApCheckForGpeNameConflict556*557* PARAMETERS: Op - Current parse op558*559* RETURN: None560*561* DESCRIPTION: Check for a conflict between GPE names within this scope.562* Conflict means two GPE names with the same GPE number, but563* different types -- such as _L1C and _E1C.564*565******************************************************************************/566567void568ApCheckForGpeNameConflict (569ACPI_PARSE_OBJECT *Op)570{571ACPI_PARSE_OBJECT *NextOp;572UINT32 GpeNumber;573char Name[ACPI_NAMESEG_SIZE + 1];574char Target[ACPI_NAMESEG_SIZE] ACPI_NONSTRING;575576577/**578* Need a null-terminated string version of NameSeg579*580* NOTE: during a review on Name[ACPI_NAMESEG_SIZE + 1] having an extra581* byte[1], compiler testing exhibited a difference in behavior between582* GCC and Clang[2] (at least; MSVC may also exhibit the same) in583* how optimization is done. The extra byte is needed to ensure584* the signature does not get mangled, subsequently avoiding585* GpeNumber being a completely different return value from strtoul.586*587* [1] https://github.com/acpica/acpica/pull/1019#discussion_r2058687704588* [2] https://github.com/acpica/acpica/pull/1019#discussion_r2061953039589*/590591ACPI_MOVE_32_TO_32 (Name, Op->Asl.NameSeg);592Name[ACPI_NAMESEG_SIZE] = 0;593594/*595* For a GPE method:596* 1st char must be underscore597* 2nd char must be L or E598* 3rd/4th chars must be a hex number599*/600if ((Name[0] != '_') ||601((Name[1] != 'L') && (Name[1] != 'E')))602{603return;604}605606/* Verify 3rd/4th chars are a valid hex value */607608GpeNumber = strtoul (&Name[2], NULL, 16);609if (GpeNumber == ACPI_UINT32_MAX)610{611return;612}613614/*615* We are now sure we have an _Lxx or _Exx.616* Create the target name that would cause collision (Flip E/L)617*/618ACPI_MOVE_32_TO_32 (Target, Name);619620/* Inject opposite letter ("L" versus "E") */621622if (Name[1] == 'L')623{624Target[1] = 'E';625}626else /* Name[1] == 'E' */627{628Target[1] = 'L';629}630631/* Search all peers (objects within this scope) for target match */632633NextOp = Op->Asl.Next;634while (NextOp)635{636/*637* We mostly care about methods, but check Name() constructs also,638* even though they will get another error for not being a method.639* All GPE names must be defined as control methods.640*/641if ((NextOp->Asl.ParseOpcode == PARSEOP_METHOD) ||642(NextOp->Asl.ParseOpcode == PARSEOP_NAME))643{644if (ACPI_COMPARE_NAMESEG (Target, NextOp->Asl.NameSeg))645{646/* Found both _Exy and _Lxy in the same scope, error */647648AslError (ASL_ERROR, ASL_MSG_GPE_NAME_CONFLICT, NextOp,649Name);650return;651}652}653654NextOp = NextOp->Asl.Next;655}656657/* OK, no conflict found */658659return;660}661662663/*******************************************************************************664*665* FUNCTION: ApCheckRegMethod666*667* PARAMETERS: Op - Current parse op668*669* RETURN: None670*671* DESCRIPTION: Ensure that a _REG method has a corresponding Operation672* Region declaration within the same scope. Note: _REG is defined673* to have two arguments and must therefore be defined as a674* control method.675*676******************************************************************************/677678void679ApCheckRegMethod (680ACPI_PARSE_OBJECT *Op)681{682ACPI_PARSE_OBJECT *Next;683ACPI_PARSE_OBJECT *Parent;684685686/* We are only interested in _REG methods */687688if (!ACPI_COMPARE_NAMESEG (METHOD_NAME__REG, &Op->Asl.NameSeg))689{690return;691}692693/* Get the start of the current scope */694695Parent = Op->Asl.Parent;696Next = Parent->Asl.Child;697698/* Search entire scope for an operation region declaration */699700while (Next)701{702if (Next->Asl.ParseOpcode == PARSEOP_OPERATIONREGION)703{704return; /* Found region, OK */705}706707Next = Next->Asl.Next;708}709710/* No region found, issue warning */711712AslError (ASL_WARNING, ASL_MSG_NO_REGION, Op, NULL);713}714715716/*******************************************************************************717*718* FUNCTION: ApFindNameInDeviceTree719*720* PARAMETERS: Name - Name to search for721* Op - Current parse op722*723* RETURN: TRUE if name found in the same scope as Op.724*725* DESCRIPTION: Determine if a name appears in the same scope as Op, as either726* a Method() or a Name(). "Same scope" can mean under an If or727* Else statement.728*729* NOTE: Detects _HID/_ADR in this type of construct (legal in ACPI 6.1+)730*731* Scope (\_SB.PCI0)732* {733* Device (I2C0)734* {735* If (SMD0 != 4) {736* Name (_HID, "INT3442")737* } Else {738* Name (_ADR, 0x400)739* }740* }741* }742******************************************************************************/743744BOOLEAN745ApFindNameInDeviceTree (746char *Name,747ACPI_PARSE_OBJECT *Op)748{749ACPI_STATUS Status;750751752Status = TrWalkParseTree (Op, ASL_WALK_VISIT_DOWNWARD,753ApDeviceSubtreeWalk, NULL, Name);754755if (Status == AE_CTRL_TRUE)756{757return (TRUE); /* Found a match */758}759760return (FALSE);761}762763764/* Callback function for interface above */765766static ACPI_STATUS767ApDeviceSubtreeWalk (768ACPI_PARSE_OBJECT *Op,769UINT32 Level,770void *Context)771{772char *Name = ACPI_CAST_PTR (char, Context);773774775switch (Op->Asl.ParseOpcode)776{777case PARSEOP_DEVICE:778779/* Level 0 is the starting device, ignore it */780781if (Level > 0)782{783/* Ignore sub-devices */784785return (AE_CTRL_DEPTH);786}787break;788789case PARSEOP_NAME:790case PARSEOP_METHOD:791792/* These are what we are looking for */793794if (ACPI_COMPARE_NAMESEG (Name, Op->Asl.NameSeg))795{796return (AE_CTRL_TRUE);797}798return (AE_CTRL_DEPTH);799800case PARSEOP_SCOPE:801case PARSEOP_FIELD:802case PARSEOP_OPERATIONREGION:803804/*805* We want to ignore these, because either they can be large806* subtrees or open a scope to somewhere else.807*/808return (AE_CTRL_DEPTH);809810default:811break;812}813814return (AE_OK);815}816817818/*******************************************************************************819*820* FUNCTION: ApFindNameInScope821*822* PARAMETERS: Name - Name to search for823* Op - Current parse op824*825* RETURN: TRUE if name found in the same scope as Op.826*827* DESCRIPTION: Determine if a name appears in the same scope as Op, as either828* a Method() or a Name().829*830******************************************************************************/831832BOOLEAN833ApFindNameInScope (834char *Name,835ACPI_PARSE_OBJECT *Op)836{837ACPI_PARSE_OBJECT *Next;838ACPI_PARSE_OBJECT *Parent;839840841/* Get the start of the current scope */842843Parent = Op->Asl.Parent;844Next = Parent->Asl.Child;845846/* Search entire scope for a match to the name */847848while (Next)849{850if ((Next->Asl.ParseOpcode == PARSEOP_METHOD) ||851(Next->Asl.ParseOpcode == PARSEOP_NAME))852{853if (ACPI_COMPARE_NAMESEG (Name, Next->Asl.NameSeg))854{855return (TRUE);856}857}858859Next = Next->Asl.Next;860}861862return (FALSE);863}864865866