示例#1
0
void
AcpiDmNamestring (
    char                    *Name)
{
    UINT32                  SegCount;


    if (!Name)
    {
        return;
    }

    /* Handle all Scope Prefix operators */

    while (AcpiPsIsPrefixChar (ACPI_GET8 (Name)))
    {
        /* Append prefix character */

        AcpiOsPrintf ("%1c", ACPI_GET8 (Name));
        Name++;
    }

    switch (ACPI_GET8 (Name))
    {
    case 0:
        SegCount = 0;
        break;

    case AML_DUAL_NAME_PREFIX:
        SegCount = 2;
        Name++;
        break;

    case AML_MULTI_NAME_PREFIX_OP:
        SegCount = (UINT32) ACPI_GET8 (Name + 1);
        Name += 2;
        break;

    default:
        SegCount = 1;
        break;
    }

    while (SegCount)
    {
        /* Append Name segment */

        AcpiDmDumpName ((char *) Name);

        SegCount--;
        if (SegCount)
        {
            /* Not last name, append dot separator */

            AcpiOsPrintf (".");
        }
        Name += ACPI_NAME_SIZE;
    }
}
示例#2
0
文件: psargs.c 项目: MarginC/kame
ACPI_PARSE_OBJECT *
AcpiPsGetNextArg (
    ACPI_PARSE_STATE        *ParserState,
    UINT32                  ArgType,
    UINT32                  *ArgCount)
{
    ACPI_PARSE_OBJECT       *Arg = NULL;
    ACPI_PARSE_OBJECT       *Prev = NULL;
    ACPI_PARSE_OBJECT       *Field;
    UINT32                  Subop;


    FUNCTION_TRACE_PTR ("PsGetNextArg", ParserState);


    switch (ArgType)
    {
    case ARGP_BYTEDATA:
    case ARGP_WORDDATA:
    case ARGP_DWORDDATA:
    case ARGP_CHARLIST:
    case ARGP_NAME:
    case ARGP_NAMESTRING:

        /* constants, strings, and namestrings are all the same size */

        Arg = AcpiPsAllocOp (AML_BYTE_OP);
        if (Arg)
        {
            AcpiPsGetNextSimpleArg (ParserState, ArgType, Arg);
        }
        break;


    case ARGP_PKGLENGTH:

        /* package length, nothing returned */

        ParserState->PkgEnd = AcpiPsGetNextPackageEnd (ParserState);
        break;


    case ARGP_FIELDLIST:

        if (ParserState->Aml < ParserState->PkgEnd)
        {
            /* non-empty list */

            while (ParserState->Aml < ParserState->PkgEnd)
            {
                Field = AcpiPsGetNextField (ParserState);
                if (!Field)
                {
                    break;
                }

                if (Prev)
                {
                    Prev->Next = Field;
                }

                else
                {
                    Arg = Field;
                }

                Prev = Field;
            }

            /* skip to End of byte data */

            ParserState->Aml = ParserState->PkgEnd;
        }
        break;


    case ARGP_BYTELIST:

        if (ParserState->Aml < ParserState->PkgEnd)
        {
            /* non-empty list */

            Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP);
            if (Arg)
            {
                /* fill in bytelist data */

                Arg->Value.Size = (ParserState->PkgEnd - ParserState->Aml);
                ((ACPI_PARSE2_OBJECT *) Arg)->Data = ParserState->Aml;
            }

            /* skip to End of byte data */

            ParserState->Aml = ParserState->PkgEnd;
        }
        break;


    case ARGP_TARGET:
    case ARGP_SUPERNAME:
        {
            Subop = AcpiPsPeekOpcode (ParserState);
            if (Subop == 0              ||
                AcpiPsIsLeadingChar (Subop) ||
                AcpiPsIsPrefixChar (Subop))
            {
                /* NullName or NameString */

                Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
                if (Arg)
                {
                    AcpiPsGetNextNamepath (ParserState, Arg, ArgCount, 0);
                }
            }

            else
            {
                /* single complex argument, nothing returned */

                *ArgCount = 1;
            }
        }
        break;


    case ARGP_DATAOBJ:
    case ARGP_TERMARG:

        /* single complex argument, nothing returned */

        *ArgCount = 1;
        break;


    case ARGP_DATAOBJLIST:
    case ARGP_TERMLIST:
    case ARGP_OBJLIST:

        if (ParserState->Aml < ParserState->PkgEnd)
        {
            /* non-empty list of variable arguments, nothing returned */

            *ArgCount = ACPI_VAR_ARGS;
        }
        break;
    }

    return_PTR (Arg);
}
示例#3
0
文件: psargs.c 项目: MarginC/kame
NATIVE_CHAR *
AcpiPsGetNextNamestring (
    ACPI_PARSE_STATE        *ParserState)
{
    UINT8                    *Start = ParserState->Aml;
    UINT8                    *End = ParserState->Aml;
    UINT32                  Length;


    FUNCTION_TRACE ("PsGetNextNamestring");


    /* Handle multiple prefix characters */

    while (AcpiPsIsPrefixChar (GET8 (End)))
    {
        /* include prefix '\\' or '^' */

        End++;
    }

    /* Decode the path */

    switch (GET8 (End))
    {
    case 0:

        /* NullName */

        if (End == Start)
        {
            Start = NULL;
        }
        End++;
        break;


    case AML_DUAL_NAME_PREFIX:

        /* two name segments */

        End += 9;
        break;


    case AML_MULTI_NAME_PREFIX_OP:

        /* multiple name segments */

        Length = (UINT32) GET8 (End + 1) * 4;
        End += 2 + Length;
        break;


    default:

        /* single name segment */
        /* assert (AcpiPsIsLead (GET8 (End))); */

        End += 4;
        break;
    }

    ParserState->Aml = (UINT8*) End;

    return_PTR ((NATIVE_CHAR *) Start);
}