2000-10-28 05:01:06 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: pswalk - Parser routines to walk parsed op tree(s)
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2011-01-13 16:12:34 +00:00
|
|
|
/*
|
2012-01-11 21:25:42 +00:00
|
|
|
* Copyright (C) 2000 - 2012, Intel Corp.
|
2000-12-21 06:56:46 +00:00
|
|
|
* All rights reserved.
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2011-01-13 16:12:34 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions, and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
|
|
|
* substantially similar to the "NO WARRANTY" disclaimer below
|
|
|
|
* ("Disclaimer") and any redistribution must be conditioned upon
|
|
|
|
* including a substantially similar Disclaimer requirement for further
|
|
|
|
* binary redistribution.
|
|
|
|
* 3. Neither the names of the above-listed copyright holders nor the names
|
|
|
|
* of any contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of the
|
|
|
|
* GNU General Public License ("GPL") version 2 as published by the Free
|
|
|
|
* Software Foundation.
|
|
|
|
*
|
|
|
|
* NO WARRANTY
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGES.
|
|
|
|
*/
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2009-06-01 19:24:26 +00:00
|
|
|
#include "acpi.h"
|
2009-06-01 21:02:40 +00:00
|
|
|
#include "accommon.h"
|
2009-06-01 19:24:26 +00:00
|
|
|
#include "acparser.h"
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2001-05-29 19:52:40 +00:00
|
|
|
#define _COMPONENT ACPI_PARSER
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_MODULE_NAME ("pswalk")
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
2000-12-01 09:36:25 +00:00
|
|
|
* FUNCTION: AcpiPsDeleteParseTree
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2000-12-01 09:36:25 +00:00
|
|
|
* PARAMETERS: SubtreeRoot - Root of tree (or subtree) to delete
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2000-12-01 09:36:25 +00:00
|
|
|
* RETURN: None
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2000-12-01 09:36:25 +00:00
|
|
|
* DESCRIPTION: Delete a portion of or an entire parse tree.
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2000-12-01 09:36:25 +00:00
|
|
|
void
|
|
|
|
AcpiPsDeleteParseTree (
|
|
|
|
ACPI_PARSE_OBJECT *SubtreeRoot)
|
2000-10-28 05:01:06 +00:00
|
|
|
{
|
2005-11-01 22:11:18 +00:00
|
|
|
ACPI_PARSE_OBJECT *Op = SubtreeRoot;
|
|
|
|
ACPI_PARSE_OBJECT *Next = NULL;
|
|
|
|
ACPI_PARSE_OBJECT *Parent = NULL;
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2007-03-22 17:24:05 +00:00
|
|
|
ACPI_FUNCTION_TRACE_PTR (PsDeleteParseTree, SubtreeRoot);
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
/* Visit all nodes in the subtree */
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
while (Op)
|
2001-11-28 04:29:40 +00:00
|
|
|
{
|
2005-11-01 22:11:18 +00:00
|
|
|
/* Check if we are not ascending */
|
2001-05-29 19:52:40 +00:00
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
if (Op != Parent)
|
|
|
|
{
|
|
|
|
/* Look for an argument or child of the current op */
|
|
|
|
|
|
|
|
Next = AcpiPsGetArg (Op, 0);
|
|
|
|
if (Next)
|
|
|
|
{
|
|
|
|
/* Still going downward in tree (Op is not completed yet) */
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
Op = Next;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
/* No more children, this Op is complete. */
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
Next = Op->Common.Next;
|
|
|
|
Parent = Op->Common.Parent;
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
AcpiPsFreeOp (Op);
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
/* If we are back to the starting point, the walk is complete. */
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
if (Op == SubtreeRoot)
|
|
|
|
{
|
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
if (Next)
|
2002-07-09 17:51:31 +00:00
|
|
|
{
|
2005-11-01 22:11:18 +00:00
|
|
|
Op = Next;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Op = Parent;
|
2002-07-09 17:51:31 +00:00
|
|
|
}
|
2000-10-28 05:01:06 +00:00
|
|
|
}
|
|
|
|
|
2000-12-01 09:36:25 +00:00
|
|
|
return_VOID;
|
2000-10-28 05:01:06 +00:00
|
|
|
}
|