psargs.c revision 7b1019a6d29ccb7999dc76cba3dde1c627e8e609
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay/******************************************************************************
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * Module Name: psargs - Parse AML opcode arguments
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay *****************************************************************************/
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * Copyright (C) 2000 - 2016, Intel Corp.
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * All rights reserved.
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * Redistribution and use in source and binary forms, with or without
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * modification, are permitted provided that the following conditions
088fa5d9eaa83bf4b3d59a64c0519f42a143aaa9Alin Brici * 1. Redistributions of source code must retain the above copyright
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * notice, this list of conditions, and the following disclaimer,
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * without modification.
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * 2. Redistributions in binary form must reproduce at minimum a disclaimer
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * substantially similar to the "NO WARRANTY" disclaimer below
4d154727feb7fbe69dd1451fa5462f558e7165c7Brendan Mmiller * ("Disclaimer") and any redistribution must be conditioned upon
088fa5d9eaa83bf4b3d59a64c0519f42a143aaa9Alin Brici * including a substantially similar Disclaimer requirement for further
088fa5d9eaa83bf4b3d59a64c0519f42a143aaa9Alin Brici * binary redistribution.
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * 3. Neither the names of the above-listed copyright holders nor the names
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * of any contributors may be used to endorse or promote products derived
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * from this software without specific prior written permission.
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * Alternatively, this software may be distributed under the terms of the
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * GNU General Public License ("GPL") version 2 as published by the Free
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * Software Foundation.
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * NO WARRANTY
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * POSSIBILITY OF SUCH DAMAGES.
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay/* Local prototypes */
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay/*******************************************************************************
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * FUNCTION: AcpiPsGetNextPackageLength
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * PARAMETERS: ParserState - Current parser state object
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * RETURN: Decoded package length. On completion, the AML pointer points
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * past the length byte or bytes.
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * DESCRIPTION: Decode and return a package length field.
4d154727feb7fbe69dd1451fa5462f558e7165c7Brendan Mmiller * Note: Largest package length is 28 bits, from ACPI specification
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay ******************************************************************************/
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * Byte 0 bits [6:7] contain the number of additional bytes
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * used to encode the package length, either 0,1,2, or 3
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay ParserState->Aml += ((ACPI_SIZE) ByteCount + 1);
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay /* Get bytes 3, 2, 1 as needed */
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * Final bit positions for the package length bytes:
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * Byte3->[20:27]
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * Byte2->[12:19]
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * Byte1->[04:11]
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay * Byte0->[00:03]
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay PackageLength |= (Aml[ByteCount] << ((ByteCount << 3) - 4));
102cd62c1b6b55d0dee627930d058a8cc36e2b4fJason Lemay ByteZeroMask = 0x0F; /* Use bits [0:3] of byte 0 */
ByteCount--;
UINT8 *
End++;
switch (*End)
End++;
case AML_DUAL_NAME_PREFIX:
case AML_MULTI_NAME_PREFIX_OP:
char *Path;
if (!Path)
if (!NameOp)
/* Point METHODCALL/NAME to the METHOD Node */
if (!MethodDesc)
Node));
switch (ArgType)
case ARGP_BYTEDATA:
case ARGP_WORDDATA:
case ARGP_DWORDDATA:
case ARGP_QWORDDATA:
case ARGP_CHARLIST:
Length = 0;
Length++;
Length++;
case ARGP_NAME:
case ARGP_NAMESTRING:
static ACPI_PARSE_OBJECT *
case AML_FIELD_OFFSET_OP:
case AML_FIELD_ACCESS_OP:
case AML_FIELD_CONNECTION_OP:
case AML_FIELD_EXT_ACCESS_OP:
if (!Field)
switch (Opcode)
case AML_INT_NAMEDFIELD_OP:
case AML_INT_RESERVEDFIELD_OP:
case AML_INT_ACCESSFIELD_OP:
case AML_INT_CONNECTION_OP:
if (!Arg)
switch (Opcode)
BufferLength = 0;
if (!Arg)
/* Link the buffer/namestring to parent (CONNECTION_OP) */
switch (ArgType)
case ARGP_BYTEDATA:
case ARGP_WORDDATA:
case ARGP_DWORDDATA:
case ARGP_CHARLIST:
case ARGP_NAME:
case ARGP_NAMESTRING:
if (!Arg)
case ARGP_PKGLENGTH:
case ARGP_FIELDLIST:
if (!Field)
if (Prev)
case ARGP_BYTELIST:
if (!Arg)
case ARGP_TARGET:
case ARGP_SUPERNAME:
case ARGP_SIMPLENAME:
case ARGP_NAME_OR_REF:
if (Subop == 0 ||
if (!Arg)
case ARGP_DATAOBJ:
case ARGP_TERMARG:
case ARGP_DATAOBJLIST:
case ARGP_TERMLIST:
case ARGP_OBJLIST: