⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbutils.c

📁 acpi tools for linux include acpiexec and acpixtract
💻 C
📖 第 1 页 / 共 2 页
字号:
    case ACPI_TYPE_LOCAL_REFERENCE:        AcpiOsPrintf ("[Object Reference] = %p ", ObjDesc->Reference.Handle);        AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL);        break;    case ACPI_TYPE_PROCESSOR:        AcpiOsPrintf ("[Processor]\n");        break;    case ACPI_TYPE_POWER:        AcpiOsPrintf ("[Power Resource]\n");        break;    default:        AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Type);        break;    }}/******************************************************************************* * * FUNCTION:    AcpiDbPrepNamestring * * PARAMETERS:  Name            - String to prepare * * RETURN:      None * * DESCRIPTION: Translate all forward slashes and dots to backslashes. * ******************************************************************************/voidAcpiDbPrepNamestring (    char                    *Name){    if (!Name)    {        return;    }    AcpiUtStrupr (Name);    /* Convert a leading forward slash to a backslash */    if (*Name == '/')    {        *Name = '\\';    }    /* Ignore a leading backslash, this is the root prefix */    if (*Name == '\\')    {        Name++;    }    /* Convert all slash path separators to dots */    while (*Name)    {        if ((*Name == '/') ||            (*Name == '\\'))        {            *Name = '.';        }        Name++;    }}/******************************************************************************* * * FUNCTION:    AcpiDbLocalNsLookup * * PARAMETERS:  Name            - Name to lookup * * RETURN:      Pointer to a namespace node, null on failure * * DESCRIPTION: Lookup a name in the ACPI namespace * * Note: Currently begins search from the root.  Could be enhanced to use * the current prefix (scope) node as the search beginning point. * ******************************************************************************/ACPI_NAMESPACE_NODE *AcpiDbLocalNsLookup (    char                    *Name){    char                    *InternalPath;    ACPI_STATUS             Status;    ACPI_NAMESPACE_NODE     *Node = NULL;    AcpiDbPrepNamestring (Name);    /* Build an internal namestring */    Status = AcpiNsInternalizeName (Name, &InternalPath);    if (ACPI_FAILURE (Status))    {        AcpiOsPrintf ("Invalid namestring: %s\n", Name);        return (NULL);    }    /*     * Lookup the name.     * (Uses root node as the search starting point)     */    Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,                    ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);    if (ACPI_FAILURE (Status))    {        AcpiOsPrintf ("Could not locate name: %s, %s\n",                Name, AcpiFormatException (Status));    }    ACPI_FREE (InternalPath);    return (Node);}/******************************************************************************* * * FUNCTION:    AcpiDbUInt32ToHexString * * PARAMETERS:  Value           - The value to be converted to string *              Buffer          - Buffer for result (not less than 11 bytes) * * RETURN:      None * * DESCRIPTION: Convert the unsigned 32-bit value to the hexadecimal image * * NOTE: It is the caller's responsibility to ensure that the length of buffer *       is sufficient. * ******************************************************************************/voidAcpiDbUInt32ToHexString (    UINT32                  Value,    char                    *Buffer){    UINT8                   i;    if (Value == 0)    {        ACPI_STRCPY (Buffer, "0");        return;    }    ACPI_STRCPY (Buffer, "0x");    Buffer[10] = '\0';    for (i = 9; i > 1; i--)    {        Buffer[i] = Converter [Value & 0x0F];        Value = Value >> 4;    }}#ifdef ACPI_OBSOLETE_FUNCTIONS/******************************************************************************* * * FUNCTION:    AcpiDbSecondPassParse * * PARAMETERS:  Root            - Root of the parse tree * * RETURN:      Status * * DESCRIPTION: Second pass parse of the ACPI tables.  We need to wait until *              second pass to parse the control methods * ******************************************************************************/ACPI_STATUSAcpiDbSecondPassParse (    ACPI_PARSE_OBJECT       *Root){    ACPI_PARSE_OBJECT       *Op = Root;    ACPI_PARSE_OBJECT       *Method;    ACPI_PARSE_OBJECT       *SearchOp;    ACPI_PARSE_OBJECT       *StartOp;    ACPI_STATUS             Status = AE_OK;    UINT32                  BaseAmlOffset;    ACPI_WALK_STATE         *WalkState;    ACPI_FUNCTION_ENTRY ();    AcpiOsPrintf ("Pass two parse ....\n");    while (Op)    {        if (Op->Common.AmlOpcode == AML_METHOD_OP)        {            Method = Op;            /* Create a new walk state for the parse */            WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);            if (!WalkState)            {                return (AE_NO_MEMORY);            }            /* Init the Walk State */            WalkState->ParserState.Aml          =            WalkState->ParserState.AmlStart     = Method->Named.Data;            WalkState->ParserState.AmlEnd       =            WalkState->ParserState.PkgEnd       = Method->Named.Data +                                                  Method->Named.Length;            WalkState->ParserState.StartScope   = Op;            WalkState->DescendingCallback       = AcpiDsLoad1BeginOp;            WalkState->AscendingCallback        = AcpiDsLoad1EndOp;            /* Perform the AML parse */            Status = AcpiPsParseAml (WalkState);            BaseAmlOffset = (Method->Common.Value.Arg)->Common.AmlOffset + 1;            StartOp = (Method->Common.Value.Arg)->Common.Next;            SearchOp = StartOp;            while (SearchOp)            {                SearchOp->Common.AmlOffset += BaseAmlOffset;                SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);            }        }        if (Op->Common.AmlOpcode == AML_REGION_OP)        {            /* TBD: [Investigate] this isn't quite the right thing to do! */            /*             *             * Method = (ACPI_DEFERRED_OP *) Op;             * Status = AcpiPsParseAml (Op, Method->Body, Method->BodyLength);             */        }        if (ACPI_FAILURE (Status))        {            break;        }        Op = AcpiPsGetDepthNext (Root, Op);    }    return (Status);}/******************************************************************************* * * FUNCTION:    AcpiDbDumpBuffer * * PARAMETERS:  Address             - Pointer to the buffer * * RETURN:      None * * DESCRIPTION: Print a portion of a buffer * ******************************************************************************/voidAcpiDbDumpBuffer (    UINT32                  Address){    AcpiOsPrintf ("\nLocation %X:\n", Address);    AcpiDbgLevel |= ACPI_LV_TABLES;    AcpiUtDumpBuffer (ACPI_TO_POINTER (Address), 64, DB_BYTE_DISPLAY,            ACPI_UINT32_MAX);}#endif#endif /* ACPI_DEBUGGER */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -