change all functions of type ASL_WALK_CALLBACK to return ACPI_STATUS

instead of void. No functional change other than to silence gcc warnings


date	2001.04.19.21.01.00;	author agrover;	state Exp;
This commit is contained in:
aystarik 2005-06-29 15:58:18 +00:00
parent 3442e027d5
commit 91b712afcf

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asllength - Tree walk to determine package and opcode lengths
* $Revision: 1.7 $
* $Revision: 1.20 $
*
*****************************************************************************/
@ -10,8 +10,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -116,89 +116,102 @@
*****************************************************************************/
#include "AslCompiler.h"
#include "AslCompiler.y.h"
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include "amlcode.h"
#include "acnamesp.h"
#define _COMPONENT MISCELLANEOUS
#define _COMPONENT ACPI_COMPILER
MODULE_NAME ("asllength")
/*******************************************************************************
*
* FUNCTION:
* FUNCTION: LnInitLengthsWalk
*
* PARAMETERS:
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN:
* RETURN: None.
*
* DESCRIPTION:
* DESCRIPTION: Walk callback to initialize (and re-initialize) the node
* subtree length(s) to zero. The Subtree lengths are bubbled
* up to the root node in order to get a total AML length.
*
******************************************************************************/
void
ACPI_STATUS
LnInitLengthsWalk (
ASL_PARSE_NODE *Node,
UINT32 Level,
void *Context)
{
// Node->AmlLength = 0;
// Node->AmlOpcodeLength = 0;
Node->AmlSubtreeLength = 0;
// Node->AmlPkgLenBytes = 0;
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION:
* FUNCTION: LnPackageLengthWalk
*
* PARAMETERS:
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN:
* RETURN: None
*
* DESCRIPTION:
* DESCRIPTION: Walk callback to calculate the total AML length.
* 1) Calculate the AML lengths (opcode, package length, etc.) for
* THIS node.
* 2) Bubbble up all of these lengths to the parent node by summing
* them all into the parent subtree length.
*
* Note: The SubtreeLength represents the total AML length of all child nodes
* in all subtrees under a given node. Therefore, once this walk is
* complete, the Root Node subtree length is the AML length of the entire
* tree (and thus, the entire ACPI table)
*
******************************************************************************/
void
ACPI_STATUS
LnPackageLengthWalk (
ASL_PARSE_NODE *Node,
UINT32 Level,
void *Context)
{
/* Generate the AML lengths for this node */
/*
* generate the subtree length and
* bubble it up to the parent
*/
CgGenerateAmlLengths (Node);
/* Bubble up all lengths (this node and all below it) to the parent */
if ((Node->Parent) &&
(Node->ParseOpcode != DEFAULT_ARG))
{
Node->Parent->AmlSubtreeLength += (Node->AmlLength +
Node->Parent->AmlSubtreeLength += (Node->AmlLength +
Node->AmlOpcodeLength +
Node->AmlPkgLenBytes +
Node->AmlPkgLenBytes +
Node->AmlSubtreeLength);
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION:
* FUNCTION: LnAdjustLengthToRoot
*
* PARAMETERS:
* PARAMETERS: PsNode - Node whose Length was changed
*
* RETURN:
* RETURN: None.
*
* DESCRIPTION:
* DESCRIPTION: Change the Subtree length of the given node, and bubble the
* change all the way up to the root node. This allows for
* last second changes to a package length (for example, if the
* package length encoding gets shorter or longer.)
*
******************************************************************************/
@ -209,6 +222,7 @@ LnAdjustLengthToRoot (
{
ASL_PARSE_NODE *Node;
/* Adjust all subtree lengths up to the root */
Node = PsNode->Parent;
@ -226,13 +240,15 @@ LnAdjustLengthToRoot (
/*******************************************************************************
*
* FUNCTION:
* FUNCTION: CgGetPackageLenByteCount
*
* PARAMETERS:
* PARAMETERS: Node - Parse node
* PackageLength - Length to be encoded
*
* RETURN:
* RETURN: Required length of the package length encoding
*
* DESCRIPTION:
* DESCRIPTION: Calculate the number of bytes required to encode the given
* package length.
*
******************************************************************************/
@ -242,48 +258,54 @@ CgGetPackageLenByteCount (
UINT32 PackageLength)
{
/*
/*
* Determine the number of bytes required to encode the package length
* Note: the package length includes the number of bytes used to encode
* the package length, so we must account for this also.
*/
if (PackageLength <= (0x0000003F - 1))
if (PackageLength <= (0x0000003F - 1))
{
return (1);
}
else if (PackageLength <= (0x00000FFF - 2))
{
return (2);
}
else if (PackageLength <= (0x000FFFFF - 3))
{
return (3);
}
else if (PackageLength <= (0x0FFFFFFF - 4))
{
return (4);
}
else
{
/* Fatal error - the package length is too large to encode */
AslError (ASL_ERROR_ENCODING_LENGTH, Node->LineNumber);
AslError (ASL_ERROR, ASL_MSG_ENCODING_LENGTH, Node, NULL);
}
return (0);
}
/*******************************************************************************
*
* FUNCTION:
* FUNCTION: CgGenerateAmlOpcodeLength
*
* PARAMETERS:
* PARAMETERS: Node - Parse node whose AML opcode lengths will be
* calculated
*
* RETURN:
* RETURN: None.
*
* DESCRIPTION:
* DESCRIPTION: Calculate the AmlOpcodeLength, AmlPkgLenBytes, and AmlLength
* fields for this node.
*
******************************************************************************/
@ -313,6 +335,9 @@ CgGenerateAmlOpcodeLength (
Node->AmlPkgLenBytes = CgGetPackageLenByteCount (Node, Node->AmlSubtreeLength);
}
/* Data opcode lengths are easy */
switch (Node->AmlOpcode)
{
case AML_BYTE_OP:
@ -334,16 +359,16 @@ CgGenerateAmlOpcodeLength (
}
/*******************************************************************************
*
* FUNCTION:
* FUNCTION: CgGenerateAmlLengths
*
* PARAMETERS:
* PARAMETERS: Node - Parse node
*
* RETURN:
* RETURN: None.
*
* DESCRIPTION:
* DESCRIPTION: Generate internal length fields based on the AML opcode or
* parse opcode.
*
******************************************************************************/
@ -353,7 +378,6 @@ CgGenerateAmlLengths (
{
char *Buffer;
ACPI_STATUS Status;
switch (Node->AmlOpcode)
@ -362,17 +386,17 @@ CgGenerateAmlLengths (
Node->AmlOpcodeLength = 0;
Node->AmlLength = 1;
return;
case AML_RAW_DATA_WORD:
Node->AmlOpcodeLength = 0;
Node->AmlLength = 2;
return;
case AML_RAW_DATA_DWORD:
Node->AmlOpcodeLength = 0;
Node->AmlLength = 4;
return;
case AML_RAW_DATA_QWORD:
Node->AmlOpcodeLength = 0;
Node->AmlLength = 8;
@ -403,20 +427,28 @@ CgGenerateAmlLengths (
break;
case NAMESTRING:
case METHODCALL:
if (Node->Flags & NODE_NAME_INTERNALIZED)
{
break;
}
Node->AmlOpcodeLength = 0;
Status = AcpiNsInternalizeName (Node->Value.String, &Buffer);
if (ACPI_FAILURE (Status))
{
DbgPrint ("Failure from internalize name %X\n", Status);
DbgPrint (ASL_DEBUG_OUTPUT,
"Failure from internalize name %X\n", Status);
break;
}
Node->ExternalName = Node->Value.String;
Node->Value.String = Buffer;
Node->Flags |= NODE_NAME_INTERNALIZED;
Node->AmlLength = strlen (Buffer);
/*
/*
* Check for single backslash reference to root,
* make it a null terminated string in the AML
*/
@ -438,12 +470,14 @@ CgGenerateAmlLengths (
case RAW_DATA:
Node->AmlOpcodeLength = 0;
// Node->AmlLength = 1;
break;
/* Ignore the "default arg" nodes, they are extraneous at this point */
case DEFAULT_ARG:
case EXTERNAL:
case INCLUDE:
case INCLUDE_END:
break;
default:
@ -453,5 +487,3 @@ CgGenerateAmlLengths (
}