1*7851SDana.Myers@Sun.COM /****************************************************************************** 2*7851SDana.Myers@Sun.COM * 3*7851SDana.Myers@Sun.COM * Module Name: pswalk - Parser routines to walk parsed op tree(s) 4*7851SDana.Myers@Sun.COM * $Revision: 1.79 $ 5*7851SDana.Myers@Sun.COM * 6*7851SDana.Myers@Sun.COM *****************************************************************************/ 7*7851SDana.Myers@Sun.COM 8*7851SDana.Myers@Sun.COM /****************************************************************************** 9*7851SDana.Myers@Sun.COM * 10*7851SDana.Myers@Sun.COM * 1. Copyright Notice 11*7851SDana.Myers@Sun.COM * 12*7851SDana.Myers@Sun.COM * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. 13*7851SDana.Myers@Sun.COM * All rights reserved. 14*7851SDana.Myers@Sun.COM * 15*7851SDana.Myers@Sun.COM * 2. License 16*7851SDana.Myers@Sun.COM * 17*7851SDana.Myers@Sun.COM * 2.1. This is your license from Intel Corp. under its intellectual property 18*7851SDana.Myers@Sun.COM * rights. You may have additional license terms from the party that provided 19*7851SDana.Myers@Sun.COM * you this software, covering your right to use that party's intellectual 20*7851SDana.Myers@Sun.COM * property rights. 21*7851SDana.Myers@Sun.COM * 22*7851SDana.Myers@Sun.COM * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23*7851SDana.Myers@Sun.COM * copy of the source code appearing in this file ("Covered Code") an 24*7851SDana.Myers@Sun.COM * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25*7851SDana.Myers@Sun.COM * base code distributed originally by Intel ("Original Intel Code") to copy, 26*7851SDana.Myers@Sun.COM * make derivatives, distribute, use and display any portion of the Covered 27*7851SDana.Myers@Sun.COM * Code in any form, with the right to sublicense such rights; and 28*7851SDana.Myers@Sun.COM * 29*7851SDana.Myers@Sun.COM * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30*7851SDana.Myers@Sun.COM * license (with the right to sublicense), under only those claims of Intel 31*7851SDana.Myers@Sun.COM * patents that are infringed by the Original Intel Code, to make, use, sell, 32*7851SDana.Myers@Sun.COM * offer to sell, and import the Covered Code and derivative works thereof 33*7851SDana.Myers@Sun.COM * solely to the minimum extent necessary to exercise the above copyright 34*7851SDana.Myers@Sun.COM * license, and in no event shall the patent license extend to any additions 35*7851SDana.Myers@Sun.COM * to or modifications of the Original Intel Code. No other license or right 36*7851SDana.Myers@Sun.COM * is granted directly or by implication, estoppel or otherwise; 37*7851SDana.Myers@Sun.COM * 38*7851SDana.Myers@Sun.COM * The above copyright and patent license is granted only if the following 39*7851SDana.Myers@Sun.COM * conditions are met: 40*7851SDana.Myers@Sun.COM * 41*7851SDana.Myers@Sun.COM * 3. Conditions 42*7851SDana.Myers@Sun.COM * 43*7851SDana.Myers@Sun.COM * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44*7851SDana.Myers@Sun.COM * Redistribution of source code of any substantial portion of the Covered 45*7851SDana.Myers@Sun.COM * Code or modification with rights to further distribute source must include 46*7851SDana.Myers@Sun.COM * the above Copyright Notice, the above License, this list of Conditions, 47*7851SDana.Myers@Sun.COM * and the following Disclaimer and Export Compliance provision. In addition, 48*7851SDana.Myers@Sun.COM * Licensee must cause all Covered Code to which Licensee contributes to 49*7851SDana.Myers@Sun.COM * contain a file documenting the changes Licensee made to create that Covered 50*7851SDana.Myers@Sun.COM * Code and the date of any change. Licensee must include in that file the 51*7851SDana.Myers@Sun.COM * documentation of any changes made by any predecessor Licensee. Licensee 52*7851SDana.Myers@Sun.COM * must include a prominent statement that the modification is derived, 53*7851SDana.Myers@Sun.COM * directly or indirectly, from Original Intel Code. 54*7851SDana.Myers@Sun.COM * 55*7851SDana.Myers@Sun.COM * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56*7851SDana.Myers@Sun.COM * Redistribution of source code of any substantial portion of the Covered 57*7851SDana.Myers@Sun.COM * Code or modification without rights to further distribute source must 58*7851SDana.Myers@Sun.COM * include the following Disclaimer and Export Compliance provision in the 59*7851SDana.Myers@Sun.COM * documentation and/or other materials provided with distribution. In 60*7851SDana.Myers@Sun.COM * addition, Licensee may not authorize further sublicense of source of any 61*7851SDana.Myers@Sun.COM * portion of the Covered Code, and must include terms to the effect that the 62*7851SDana.Myers@Sun.COM * license from Licensee to its licensee is limited to the intellectual 63*7851SDana.Myers@Sun.COM * property embodied in the software Licensee provides to its licensee, and 64*7851SDana.Myers@Sun.COM * not to intellectual property embodied in modifications its licensee may 65*7851SDana.Myers@Sun.COM * make. 66*7851SDana.Myers@Sun.COM * 67*7851SDana.Myers@Sun.COM * 3.3. Redistribution of Executable. Redistribution in executable form of any 68*7851SDana.Myers@Sun.COM * substantial portion of the Covered Code or modification must reproduce the 69*7851SDana.Myers@Sun.COM * above Copyright Notice, and the following Disclaimer and Export Compliance 70*7851SDana.Myers@Sun.COM * provision in the documentation and/or other materials provided with the 71*7851SDana.Myers@Sun.COM * distribution. 72*7851SDana.Myers@Sun.COM * 73*7851SDana.Myers@Sun.COM * 3.4. Intel retains all right, title, and interest in and to the Original 74*7851SDana.Myers@Sun.COM * Intel Code. 75*7851SDana.Myers@Sun.COM * 76*7851SDana.Myers@Sun.COM * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77*7851SDana.Myers@Sun.COM * Intel shall be used in advertising or otherwise to promote the sale, use or 78*7851SDana.Myers@Sun.COM * other dealings in products derived from or relating to the Covered Code 79*7851SDana.Myers@Sun.COM * without prior written authorization from Intel. 80*7851SDana.Myers@Sun.COM * 81*7851SDana.Myers@Sun.COM * 4. Disclaimer and Export Compliance 82*7851SDana.Myers@Sun.COM * 83*7851SDana.Myers@Sun.COM * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84*7851SDana.Myers@Sun.COM * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85*7851SDana.Myers@Sun.COM * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86*7851SDana.Myers@Sun.COM * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87*7851SDana.Myers@Sun.COM * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88*7851SDana.Myers@Sun.COM * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89*7851SDana.Myers@Sun.COM * PARTICULAR PURPOSE. 90*7851SDana.Myers@Sun.COM * 91*7851SDana.Myers@Sun.COM * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92*7851SDana.Myers@Sun.COM * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93*7851SDana.Myers@Sun.COM * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94*7851SDana.Myers@Sun.COM * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95*7851SDana.Myers@Sun.COM * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96*7851SDana.Myers@Sun.COM * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97*7851SDana.Myers@Sun.COM * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98*7851SDana.Myers@Sun.COM * LIMITED REMEDY. 99*7851SDana.Myers@Sun.COM * 100*7851SDana.Myers@Sun.COM * 4.3. Licensee shall not export, either directly or indirectly, any of this 101*7851SDana.Myers@Sun.COM * software or system incorporating such software without first obtaining any 102*7851SDana.Myers@Sun.COM * required license or other approval from the U. S. Department of Commerce or 103*7851SDana.Myers@Sun.COM * any other agency or department of the United States Government. In the 104*7851SDana.Myers@Sun.COM * event Licensee exports any such software from the United States or 105*7851SDana.Myers@Sun.COM * re-exports any such software from a foreign destination, Licensee shall 106*7851SDana.Myers@Sun.COM * ensure that the distribution and export/re-export of the software is in 107*7851SDana.Myers@Sun.COM * compliance with all laws, regulations, orders, or other restrictions of the 108*7851SDana.Myers@Sun.COM * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109*7851SDana.Myers@Sun.COM * any of its subsidiaries will export/re-export any technical data, process, 110*7851SDana.Myers@Sun.COM * software, or service, directly or indirectly, to any country for which the 111*7851SDana.Myers@Sun.COM * United States government or any agency thereof requires an export license, 112*7851SDana.Myers@Sun.COM * other governmental approval, or letter of assurance, without first obtaining 113*7851SDana.Myers@Sun.COM * such license, approval or letter. 114*7851SDana.Myers@Sun.COM * 115*7851SDana.Myers@Sun.COM *****************************************************************************/ 116*7851SDana.Myers@Sun.COM 117*7851SDana.Myers@Sun.COM 118*7851SDana.Myers@Sun.COM #include "acpi.h" 119*7851SDana.Myers@Sun.COM #include "acparser.h" 120*7851SDana.Myers@Sun.COM 121*7851SDana.Myers@Sun.COM #define _COMPONENT ACPI_PARSER 122*7851SDana.Myers@Sun.COM ACPI_MODULE_NAME ("pswalk") 123*7851SDana.Myers@Sun.COM 124*7851SDana.Myers@Sun.COM 125*7851SDana.Myers@Sun.COM /******************************************************************************* 126*7851SDana.Myers@Sun.COM * 127*7851SDana.Myers@Sun.COM * FUNCTION: AcpiPsDeleteParseTree 128*7851SDana.Myers@Sun.COM * 129*7851SDana.Myers@Sun.COM * PARAMETERS: SubtreeRoot - Root of tree (or subtree) to delete 130*7851SDana.Myers@Sun.COM * 131*7851SDana.Myers@Sun.COM * RETURN: None 132*7851SDana.Myers@Sun.COM * 133*7851SDana.Myers@Sun.COM * DESCRIPTION: Delete a portion of or an entire parse tree. 134*7851SDana.Myers@Sun.COM * 135*7851SDana.Myers@Sun.COM ******************************************************************************/ 136*7851SDana.Myers@Sun.COM 137*7851SDana.Myers@Sun.COM void 138*7851SDana.Myers@Sun.COM AcpiPsDeleteParseTree ( 139*7851SDana.Myers@Sun.COM ACPI_PARSE_OBJECT *SubtreeRoot) 140*7851SDana.Myers@Sun.COM { 141*7851SDana.Myers@Sun.COM ACPI_PARSE_OBJECT *Op = SubtreeRoot; 142*7851SDana.Myers@Sun.COM ACPI_PARSE_OBJECT *Next = NULL; 143*7851SDana.Myers@Sun.COM ACPI_PARSE_OBJECT *Parent = NULL; 144*7851SDana.Myers@Sun.COM 145*7851SDana.Myers@Sun.COM 146*7851SDana.Myers@Sun.COM ACPI_FUNCTION_TRACE_PTR (PsDeleteParseTree, SubtreeRoot); 147*7851SDana.Myers@Sun.COM 148*7851SDana.Myers@Sun.COM 149*7851SDana.Myers@Sun.COM /* Visit all nodes in the subtree */ 150*7851SDana.Myers@Sun.COM 151*7851SDana.Myers@Sun.COM while (Op) 152*7851SDana.Myers@Sun.COM { 153*7851SDana.Myers@Sun.COM /* Check if we are not ascending */ 154*7851SDana.Myers@Sun.COM 155*7851SDana.Myers@Sun.COM if (Op != Parent) 156*7851SDana.Myers@Sun.COM { 157*7851SDana.Myers@Sun.COM /* Look for an argument or child of the current op */ 158*7851SDana.Myers@Sun.COM 159*7851SDana.Myers@Sun.COM Next = AcpiPsGetArg (Op, 0); 160*7851SDana.Myers@Sun.COM if (Next) 161*7851SDana.Myers@Sun.COM { 162*7851SDana.Myers@Sun.COM /* Still going downward in tree (Op is not completed yet) */ 163*7851SDana.Myers@Sun.COM 164*7851SDana.Myers@Sun.COM Op = Next; 165*7851SDana.Myers@Sun.COM continue; 166*7851SDana.Myers@Sun.COM } 167*7851SDana.Myers@Sun.COM } 168*7851SDana.Myers@Sun.COM 169*7851SDana.Myers@Sun.COM /* No more children, this Op is complete. */ 170*7851SDana.Myers@Sun.COM 171*7851SDana.Myers@Sun.COM Next = Op->Common.Next; 172*7851SDana.Myers@Sun.COM Parent = Op->Common.Parent; 173*7851SDana.Myers@Sun.COM 174*7851SDana.Myers@Sun.COM AcpiPsFreeOp (Op); 175*7851SDana.Myers@Sun.COM 176*7851SDana.Myers@Sun.COM /* If we are back to the starting point, the walk is complete. */ 177*7851SDana.Myers@Sun.COM 178*7851SDana.Myers@Sun.COM if (Op == SubtreeRoot) 179*7851SDana.Myers@Sun.COM { 180*7851SDana.Myers@Sun.COM return_VOID; 181*7851SDana.Myers@Sun.COM } 182*7851SDana.Myers@Sun.COM if (Next) 183*7851SDana.Myers@Sun.COM { 184*7851SDana.Myers@Sun.COM Op = Next; 185*7851SDana.Myers@Sun.COM } 186*7851SDana.Myers@Sun.COM else 187*7851SDana.Myers@Sun.COM { 188*7851SDana.Myers@Sun.COM Op = Parent; 189*7851SDana.Myers@Sun.COM } 190*7851SDana.Myers@Sun.COM } 191*7851SDana.Myers@Sun.COM 192*7851SDana.Myers@Sun.COM return_VOID; 193*7851SDana.Myers@Sun.COM } 194