FreeBSD/sys/contrib/dev/acpica/components/parser/psargs.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiPsGetNextPackageLength
 *
 * PARAMETERS:  ParserState         - Current parser state object
 *
 * RETURN:      Decoded package length. On completion, the AML pointer points
 *              past the length byte or bytes.
 *
 * DESCRIPTION: Decode and return a package length field.
 *              Note: Largest package length is 28 bits, from ACPI specification
 *
 ******************************************************************************/
AcpiPsGetNextPackageLength
PARAMETERS:  ParserState         - Current parser state object

Decoded package length. On completion, the AML pointer points
past the length byte or bytes.

Decode and return a package length field.
Note: Largest package length is 28 bits, from ACPI specification
AcpiPsGetNextPackageLength PARAMETERS : ParserState - Current parser state object Decoded package length . On completion the AML pointer points past the length byte or bytes . Decode and return a package length field . Note : Largest package length is 28 bits from ACPI specification
static UINT32
AcpiPsGetNextPackageLength (
    ACPI_PARSE_STATE        *ParserState)
{
    UINT8                   *Aml = ParserState->Aml;
    UINT32                  PackageLength = 0;
    UINT32                  ByteCount;
    UINT8                   ByteZeroMask = 0x3F; 
    ACPI_FUNCTION_TRACE (PsGetNextPackageLength);
    ByteCount = (Aml[0] >> 6);
    ParserState->Aml += ((ACPI_SIZE) ByteCount + 1);
    while (ByteCount)
    {
        PackageLength |= (Aml[ByteCount] << ((ByteCount << 3) - 4));
        ByteZeroMask = 0x0F; 
        ByteCount--;
    }
    PackageLength |= (Aml[0] & ByteZeroMask);
    return_UINT32 (PackageLength);
}
static UINT32 AcpiPsGetNextPackageLength ( ACPI_PARSE_STATE * ParserState ) { UINT8 * Aml = ParserState -> Aml ; UINT32 PackageLength = 0 ; UINT32 ByteCount ; UINT8 ByteZeroMask = 0x3F ; ACPI_FUNCTION_TRACE ( PsGetNextPackageLength ) ; ByteCount = ( Aml [ 0 ] >> 6 ) ; ParserState -> Aml += ( ( ACPI_SIZE ) ByteCount + 1 ) ; while ( ByteCount ) { PackageLength |= ( Aml [ ByteCount ] << ( ( ByteCount << 3 ) - 4 ) ) ; ByteZeroMask = 0x0F ; ByteCount -- ; } PackageLength |= ( Aml [ 0 ] & ByteZeroMask ) ; return_UINT32 ( PackageLength ) ; }
FUNCTION:    AcpiPsGetNextPackageLength
 PARAMETERS:  ParserState         - Current parser state object
FUNCTION : AcpiPsGetNextPackageLength PARAMETERS : ParserState - Current parser state object
/* Default [0:5] */ /*
     * Byte 0 bits [6:7] contain the number of additional bytes
     * used to encode the package length, either 0,1,2, or 3
     */ /* Get bytes 3, 2, 1 as needed */ /*
         * Final bit positions for the package length bytes:
         *      Byte3->[20:27]
         *      Byte2->[12:19]
         *      Byte1->[04:11]
         *      Byte0->[00:03]
         */ /* Use bits [0:3] of byte 0 */ /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */