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

📄 dbcmds.c

📁 acpi tools for linux include acpiexec and acpixtract
💻 C
📖 第 1 页 / 共 4 页
字号:
 * * PARAMETERS:  TableArg        - Name of the table to be unloaded *              InstanceArg     - Which instance of the table to unload (if *                                there are multiple tables of the same type) * * RETURN:      Nonde * * DESCRIPTION: Unload an ACPI table. *              Instance is not implemented * ******************************************************************************/voidAcpiDbUnloadAcpiTable (    char                    *TableArg,    char                    *InstanceArg){/* TBD: Need to reimplement for new data structures */#if 0    UINT32                  i;    ACPI_STATUS             Status;    /* Search all tables for the target type */    for (i = 0; i < (ACPI_TABLE_ID_MAX+1); i++)    {        if (!ACPI_STRNCMP (TableArg, AcpiGbl_TableData[i].Signature,                AcpiGbl_TableData[i].SigLength))        {            /* Found the table, unload it */            Status = AcpiUnloadTable (i);            if (ACPI_SUCCESS (Status))            {                AcpiOsPrintf ("[%s] unloaded and uninstalled\n", TableArg);            }            else            {                AcpiOsPrintf ("%s, while unloading [%s]\n",                    AcpiFormatException (Status), TableArg);            }            return;        }    }    AcpiOsPrintf ("Unknown table type [%s]\n", TableArg);#endif}/******************************************************************************* * * FUNCTION:    AcpiDbSetMethodBreakpoint * * PARAMETERS:  Location            - AML offset of breakpoint *              WalkState           - Current walk info *              Op                  - Current Op (from parse walk) * * RETURN:      None * * DESCRIPTION: Set a breakpoint in a control method at the specified *              AML offset * ******************************************************************************/voidAcpiDbSetMethodBreakpoint (    char                    *Location,    ACPI_WALK_STATE         *WalkState,    ACPI_PARSE_OBJECT       *Op){    UINT32                  Address;    if (!Op)    {        AcpiOsPrintf ("There is no method currently executing\n");        return;    }    /* Get and verify the breakpoint address */    Address = ACPI_STRTOUL (Location, NULL, 16);    if (Address <= Op->Common.AmlOffset)    {        AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n",            Address, Op->Common.AmlOffset);    }    /* Save breakpoint in current walk */    WalkState->UserBreakpoint = Address;    AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address);}/******************************************************************************* * * FUNCTION:    AcpiDbSetMethodCallBreakpoint * * PARAMETERS:  Op                  - Current Op (from parse walk) * * RETURN:      None * * DESCRIPTION: Set a breakpoint in a control method at the specified *              AML offset * ******************************************************************************/voidAcpiDbSetMethodCallBreakpoint (    ACPI_PARSE_OBJECT       *Op){    if (!Op)    {        AcpiOsPrintf ("There is no method currently executing\n");        return;    }    AcpiGbl_StepToNextCall = TRUE;}/******************************************************************************* * * FUNCTION:    AcpiDbDisassembleAml * * PARAMETERS:  Statements          - Number of statements to disassemble *              Op                  - Current Op (from parse walk) * * RETURN:      None * * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number *              of statements specified. * ******************************************************************************/voidAcpiDbDisassembleAml (    char                    *Statements,    ACPI_PARSE_OBJECT       *Op){    UINT32                  NumStatements = 8;    if (!Op)    {        AcpiOsPrintf ("There is no method currently executing\n");        return;    }    if (Statements)    {        NumStatements = ACPI_STRTOUL (Statements, NULL, 0);    }    AcpiDmDisassemble (NULL, Op, NumStatements);}/******************************************************************************* * * FUNCTION:    AcpiDbDisassembleMethod * * PARAMETERS:  Name            - Name of control method * * RETURN:      None * * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number *              of statements specified. * ******************************************************************************/ACPI_STATUSAcpiDbDisassembleMethod (    char                    *Name){    ACPI_STATUS             Status;    ACPI_PARSE_OBJECT       *Op;    ACPI_WALK_STATE         *WalkState;    ACPI_OPERAND_OBJECT     *ObjDesc;    ACPI_NAMESPACE_NODE     *Method;    Method = AcpiDbConvertToNode (Name);    if (!Method)    {        return (AE_BAD_PARAMETER);    }    ObjDesc = Method->Object;    Op = AcpiPsCreateScopeOp ();    if (!Op)    {        return (AE_NO_MEMORY);    }    /* Create and initialize a new walk state */    WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL);    if (!WalkState)    {        return (AE_NO_MEMORY);    }    Status = AcpiDsInitAmlWalk (WalkState, Op, NULL,                    ObjDesc->Method.AmlStart,                    ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);    if (ACPI_FAILURE (Status))    {        return (Status);    }    /* Parse the AML */    WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;    WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;    Status = AcpiPsParseAml (WalkState);    AcpiDmDisassemble (NULL, Op, 0);    AcpiPsDeleteParseTree (Op);    return (AE_OK);}/******************************************************************************* * * FUNCTION:    AcpiDbDumpNamespace * * PARAMETERS:  StartArg        - Node to begin namespace dump *              DepthArg        - Maximum tree depth to be dumped * * RETURN:      None * * DESCRIPTION: Dump entire namespace or a subtree.  Each node is displayed *              with type and other information. * ******************************************************************************/voidAcpiDbDumpNamespace (    char                    *StartArg,    char                    *DepthArg){    ACPI_HANDLE             SubtreeEntry = AcpiGbl_RootNode;    UINT32                  MaxDepth = ACPI_UINT32_MAX;    /* No argument given, just start at the root and dump entire namespace */    if (StartArg)    {        SubtreeEntry = AcpiDbConvertToNode (StartArg);        if (!SubtreeEntry)        {            return;        }        /* Now we can check for the depth argument */        if (DepthArg)        {            MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);        }    }    AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);    AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n",        ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry);    /* Display the subtree */    AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);    AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth,        ACPI_OWNER_ID_MAX, SubtreeEntry);    AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);}/******************************************************************************* * * FUNCTION:    AcpiDbDumpNamespaceByOwner * * PARAMETERS:  OwnerArg        - Owner ID whose nodes will be displayed *              DepthArg        - Maximum tree depth to be dumped * * RETURN:      None * * DESCRIPTION: Dump elements of the namespace that are owned by the OwnerId. * ******************************************************************************/voidAcpiDbDumpNamespaceByOwner (    char                    *OwnerArg,    char                    *DepthArg){    ACPI_HANDLE             SubtreeEntry = AcpiGbl_RootNode;    UINT32                  MaxDepth = ACPI_UINT32_MAX;    ACPI_OWNER_ID           OwnerId;    OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0);    /* Now we can check for the depth argument */    if (DepthArg)    {        MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);    }    AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);    AcpiOsPrintf ("ACPI Namespace by owner %X:\n", OwnerId);    /* Display the subtree */    AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);    AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId,        SubtreeEntry);    AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);}/******************************************************************************* * * FUNCTION:    AcpiDbSendNotify * * PARAMETERS:  Name            - Name of ACPI object to send the notify to *              Value           - Value of the notify to send. * * RETURN:      None * * DESCRIPTION: Send an ACPI notification.  The value specified is sent to the *              named object as an ACPI notify. * ******************************************************************************/voidAcpiDbSendNotify (    char                    *Name,    UINT32                  Value){    ACPI_NAMESPACE_NODE     *Node;    ACPI_STATUS             Status;    /* Translate name to an Named object */    Node = AcpiDbConvertToNode (Name);    if (!Node)    {        return;    }    /* Decode Named object type */    switch (Node->Type)    {    case ACPI_TYPE_DEVICE:    case ACPI_TYPE_THERMAL:         /* Send the notify */        Status = AcpiEvQueueNotifyRequest (Node, Value);        if (ACPI_FAILURE (Status))        {            AcpiOsPrintf ("Could not queue notify\n");        }        break;    default:        AcpiOsPrintf ("Named object is not a device or a thermal object\n");        break;    }}/******************************************************************************* * * FUNCTION:    AcpiDbSetMethodData * * PARAMETERS:  TypeArg         - L for local, A for argument *              IndexArg        - which one *              ValueArg        - Value to set. * * RETURN:      None * * DESCRIPTION: Set a local or argument for the running control method. *              NOTE: only object supported is Number. * ******************************************************************************/voidAcpiDbSetMethodData (    char                    *TypeArg,    char                    *IndexArg,    char                    *ValueArg){    char                    Type;    UINT32                  Index;    UINT32                  Value;    ACPI_WALK_STATE         *WalkState;    ACPI_OPERAND_OBJECT     *ObjDesc;    ACPI_STATUS             Status;    ACPI_NAMESPACE_NODE     *Node;    /* Validate TypeArg */    AcpiUtStrupr (TypeArg);    Type = TypeArg[0];    if ((Type != 'L') &&        (Type != 'A') &&        (Type != 'N'))    {        AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg);        return;    }    Value = ACPI_STRTOUL (ValueArg, NULL, 16);    if (Type == 'N')    {        Node = AcpiDbConvertToNode (IndexArg);        if (Node->Type != ACPI_TYPE_INTEGER)        {            AcpiOsPrintf ("Can only set Integer nodes\n");            return;        }        ObjDesc = Node->Object;        ObjDesc->Integer.Value = Value;        return;    }    /* Get the index and value */    Index = ACPI_STRTOUL (IndexArg, NULL, 16);    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);    if (!WalkState)    {        AcpiOsPrintf ("There is no method currently executing\n");        return;    }    /* Create and initialize the new object */    ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);    if (!ObjDesc)    {        AcpiOsPrintf ("Could not create an internal object\n");        return;    }    ObjDesc->Integer.Value = Value;    /* Store the new object into the target */

⌨️ 快捷键说明

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