Path: blob/main/sys/contrib/dev/acpica/include/acdebug.h
48287 views
/******************************************************************************1*2* Name: acdebug.h - ACPI/AML debugger3*4*****************************************************************************/56/******************************************************************************7*8* 1. Copyright Notice9*10* Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.11* All rights reserved.12*13* 2. License14*15* 2.1. This is your license from Intel Corp. under its intellectual property16* rights. You may have additional license terms from the party that provided17* you this software, covering your right to use that party's intellectual18* property rights.19*20* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a21* copy of the source code appearing in this file ("Covered Code") an22* irrevocable, perpetual, worldwide license under Intel's copyrights in the23* base code distributed originally by Intel ("Original Intel Code") to copy,24* make derivatives, distribute, use and display any portion of the Covered25* Code in any form, with the right to sublicense such rights; and26*27* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent28* license (with the right to sublicense), under only those claims of Intel29* patents that are infringed by the Original Intel Code, to make, use, sell,30* offer to sell, and import the Covered Code and derivative works thereof31* solely to the minimum extent necessary to exercise the above copyright32* license, and in no event shall the patent license extend to any additions33* to or modifications of the Original Intel Code. No other license or right34* is granted directly or by implication, estoppel or otherwise;35*36* The above copyright and patent license is granted only if the following37* conditions are met:38*39* 3. Conditions40*41* 3.1. Redistribution of Source with Rights to Further Distribute Source.42* Redistribution of source code of any substantial portion of the Covered43* Code or modification with rights to further distribute source must include44* the above Copyright Notice, the above License, this list of Conditions,45* and the following Disclaimer and Export Compliance provision. In addition,46* Licensee must cause all Covered Code to which Licensee contributes to47* contain a file documenting the changes Licensee made to create that Covered48* Code and the date of any change. Licensee must include in that file the49* documentation of any changes made by any predecessor Licensee. Licensee50* must include a prominent statement that the modification is derived,51* directly or indirectly, from Original Intel Code.52*53* 3.2. Redistribution of Source with no Rights to Further Distribute Source.54* Redistribution of source code of any substantial portion of the Covered55* Code or modification without rights to further distribute source must56* include the following Disclaimer and Export Compliance provision in the57* documentation and/or other materials provided with distribution. In58* addition, Licensee may not authorize further sublicense of source of any59* portion of the Covered Code, and must include terms to the effect that the60* license from Licensee to its licensee is limited to the intellectual61* property embodied in the software Licensee provides to its licensee, and62* not to intellectual property embodied in modifications its licensee may63* make.64*65* 3.3. Redistribution of Executable. Redistribution in executable form of any66* substantial portion of the Covered Code or modification must reproduce the67* above Copyright Notice, and the following Disclaimer and Export Compliance68* provision in the documentation and/or other materials provided with the69* distribution.70*71* 3.4. Intel retains all right, title, and interest in and to the Original72* Intel Code.73*74* 3.5. Neither the name Intel nor any other trademark owned or controlled by75* Intel shall be used in advertising or otherwise to promote the sale, use or76* other dealings in products derived from or relating to the Covered Code77* without prior written authorization from Intel.78*79* 4. Disclaimer and Export Compliance80*81* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED82* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE83* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,84* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY85* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY86* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A87* PARTICULAR PURPOSE.88*89* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES90* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR91* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,92* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY93* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL94* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS95* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY96* LIMITED REMEDY.97*98* 4.3. Licensee shall not export, either directly or indirectly, any of this99* software or system incorporating such software without first obtaining any100* required license or other approval from the U. S. Department of Commerce or101* any other agency or department of the United States Government. In the102* event Licensee exports any such software from the United States or103* re-exports any such software from a foreign destination, Licensee shall104* ensure that the distribution and export/re-export of the software is in105* compliance with all laws, regulations, orders, or other restrictions of the106* U.S. Export Administration Regulations. Licensee agrees that neither it nor107* any of its subsidiaries will export/re-export any technical data, process,108* software, or service, directly or indirectly, to any country for which the109* United States government or any agency thereof requires an export license,110* other governmental approval, or letter of assurance, without first obtaining111* such license, approval or letter.112*113*****************************************************************************114*115* Alternatively, you may choose to be licensed under the terms of the116* following license:117*118* Redistribution and use in source and binary forms, with or without119* modification, are permitted provided that the following conditions120* are met:121* 1. Redistributions of source code must retain the above copyright122* notice, this list of conditions, and the following disclaimer,123* without modification.124* 2. Redistributions in binary form must reproduce at minimum a disclaimer125* substantially similar to the "NO WARRANTY" disclaimer below126* ("Disclaimer") and any redistribution must be conditioned upon127* including a substantially similar Disclaimer requirement for further128* binary redistribution.129* 3. Neither the names of the above-listed copyright holders nor the names130* of any contributors may be used to endorse or promote products derived131* from this software without specific prior written permission.132*133* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS134* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT135* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR136* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT137* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,138* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT139* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,140* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY141* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT142* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE143* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.144*145* Alternatively, you may choose to be licensed under the terms of the146* GNU General Public License ("GPL") version 2 as published by the Free147* Software Foundation.148*149*****************************************************************************/150151#ifndef __ACDEBUG_H__152#define __ACDEBUG_H__153154/* The debugger is used in conjunction with the disassembler most of time */155156#ifdef ACPI_DISASSEMBLER157#include <contrib/dev/acpica/include/acdisasm.h>158#endif159160161#define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */162#define ACPI_DEBUG_LENGTH_FORMAT " (%.4X bits, %.3X bytes)"163164typedef struct acpi_db_command_info165{166const char *Name; /* Command Name */167UINT8 MinArgs; /* Minimum arguments required */168169} ACPI_DB_COMMAND_INFO;170171typedef struct acpi_db_command_help172{173UINT8 LineCount; /* Number of help lines */174char *Invocation; /* Command Invocation */175char *Description; /* Command Description */176177} ACPI_DB_COMMAND_HELP;178179typedef struct acpi_db_argument_info180{181const char *Name; /* Argument Name */182183} ACPI_DB_ARGUMENT_INFO;184185typedef struct acpi_db_execute_walk186{187UINT32 Count;188UINT32 MaxCount;189char NameSeg[ACPI_NAMESEG_SIZE + 1];190191} ACPI_DB_EXECUTE_WALK;192193194#define PARAM_LIST(pl) pl195196#define EX_NO_SINGLE_STEP 1197#define EX_SINGLE_STEP 2198#define EX_ALL 4199200201/*202* dbxface - external debugger interfaces203*/204ACPI_DBR_DEPENDENT_RETURN_OK (205ACPI_STATUS206AcpiDbSingleStep (207ACPI_WALK_STATE *WalkState,208ACPI_PARSE_OBJECT *Op,209UINT32 OpType))210211ACPI_DBR_DEPENDENT_RETURN_VOID (212void213AcpiDbSignalBreakPoint (214ACPI_WALK_STATE *WalkState))215216217/*218* dbcmds - debug commands and output routines219*/220ACPI_NAMESPACE_NODE *221AcpiDbConvertToNode (222char *InString);223224void225AcpiDbDisplayTableInfo (226char *TableArg);227228void229AcpiDbDisplayTemplate (230char *BufferArg);231232void233AcpiDbUnloadAcpiTable (234char *Name);235236void237AcpiDbSendNotify (238char *Name,239UINT32 Value);240241void242AcpiDbDisplayInterfaces (243char *ActionArg,244char *InterfaceNameArg);245246ACPI_STATUS247AcpiDbSleep (248char *ObjectArg);249250void251AcpiDbTrace (252char *EnableArg,253char *MethodArg,254char *OnceArg);255256void257AcpiDbDisplayLocks (258void);259260void261AcpiDbDisplayResources (262char *ObjectArg);263264ACPI_HW_DEPENDENT_RETURN_VOID (265void266AcpiDbDisplayGpes (267void))268269void270AcpiDbDisplayHandlers (271void);272273ACPI_HW_DEPENDENT_RETURN_VOID (274void275AcpiDbGenerateGpe (276char *GpeArg,277char *BlockArg))278279ACPI_HW_DEPENDENT_RETURN_VOID (280void281AcpiDbGenerateSci (282void))283284void285AcpiDbExecuteTest (286char *TypeArg);287288289/*290* dbconvert - miscellaneous conversion routines291*/292ACPI_STATUS293AcpiDbHexCharToValue (294int HexChar,295UINT8 *ReturnValue);296297ACPI_STATUS298AcpiDbConvertToPackage (299char *String,300ACPI_OBJECT *Object);301302ACPI_STATUS303AcpiDbConvertToObject (304ACPI_OBJECT_TYPE Type,305char *String,306ACPI_OBJECT *Object);307308UINT8 *309AcpiDbEncodePldBuffer (310ACPI_PLD_INFO *PldInfo);311312void313AcpiDbDumpPldBuffer (314ACPI_OBJECT *ObjDesc);315316317/*318* dbmethod - control method commands319*/320void321AcpiDbSetMethodBreakpoint (322char *Location,323ACPI_WALK_STATE *WalkState,324ACPI_PARSE_OBJECT *Op);325326void327AcpiDbSetMethodCallBreakpoint (328ACPI_PARSE_OBJECT *Op);329330void331AcpiDbSetMethodData (332char *TypeArg,333char *IndexArg,334char *ValueArg);335336ACPI_STATUS337AcpiDbDisassembleMethod (338char *Name);339340void341AcpiDbDisassembleAml (342char *Statements,343ACPI_PARSE_OBJECT *Op);344345void346AcpiDbEvaluatePredefinedNames (347void);348349void350AcpiDbEvaluateAll (351char *NameSeg);352353354/*355* dbnames - namespace commands356*/357void358AcpiDbSetScope (359char *Name);360361void362AcpiDbDumpNamespace (363char *StartArg,364char *DepthArg);365366void367AcpiDbDumpNamespacePaths (368void);369370void371AcpiDbDumpNamespaceByOwner (372char *OwnerArg,373char *DepthArg);374375ACPI_STATUS376AcpiDbFindNameInNamespace (377char *NameArg);378379void380AcpiDbCheckPredefinedNames (381void);382383ACPI_STATUS384AcpiDbDisplayObjects (385char *ObjTypeArg,386char *DisplayCountArg);387388void389AcpiDbCheckIntegrity (390void);391392void393AcpiDbFindReferences (394char *ObjectArg);395396void397AcpiDbGetBusInfo (398void);399400ACPI_STATUS401AcpiDbDisplayFields (402UINT32 AddressSpaceId);403404405/*406* dbdisply - debug display commands407*/408void409AcpiDbDisplayMethodInfo (410ACPI_PARSE_OBJECT *Op);411412void413AcpiDbDecodeAndDisplayObject (414char *Target,415char *OutputType);416417ACPI_DBR_DEPENDENT_RETURN_VOID (418void419AcpiDbDisplayResultObject (420ACPI_OPERAND_OBJECT *ObjDesc,421ACPI_WALK_STATE *WalkState))422423ACPI_STATUS424AcpiDbDisplayAllMethods (425char *DisplayCountArg);426427void428AcpiDbDisplayArguments (429void);430431void432AcpiDbDisplayLocals (433void);434435void436AcpiDbDisplayResults (437void);438439void440AcpiDbDisplayCallingTree (441void);442443void444AcpiDbDisplayObjectType (445char *ObjectArg);446447ACPI_DBR_DEPENDENT_RETURN_VOID (448void449AcpiDbDisplayArgumentObject (450ACPI_OPERAND_OBJECT *ObjDesc,451ACPI_WALK_STATE *WalkState))452453454/*455* dbexec - debugger control method execution456*/457void458AcpiDbExecute (459char *Name,460char **Args,461ACPI_OBJECT_TYPE *Types,462UINT32 Flags);463464void465AcpiDbCreateExecutionThread (466char *MethodNameArg,467char **Arguments,468ACPI_OBJECT_TYPE *Types);469470void471AcpiDbCreateExecutionThreads (472char *NumThreadsArg,473char *NumLoopsArg,474char *MethodNameArg);475476void477AcpiDbDeleteObjects (478UINT32 Count,479ACPI_OBJECT *Objects);480481#ifdef ACPI_DBG_TRACK_ALLOCATIONS482UINT32483AcpiDbGetCacheInfo (484ACPI_MEMORY_LIST *Cache);485#endif486487488/*489* dbfileio - Debugger file I/O commands490*/491ACPI_OBJECT_TYPE492AcpiDbMatchArgument (493char *UserArgument,494ACPI_DB_ARGUMENT_INFO *Arguments);495496void497AcpiDbCloseDebugFile (498void);499500void501AcpiDbOpenDebugFile (502char *Name);503504ACPI_STATUS505AcpiDbLoadAcpiTable (506char *Filename);507508ACPI_STATUS509AcpiDbLoadTables (510ACPI_NEW_TABLE_DESC *ListHead);511512513/*514* dbhistry - debugger HISTORY command515*/516void517AcpiDbAddToHistory (518char *CommandLine);519520void521AcpiDbDisplayHistory (522void);523524char *525AcpiDbGetFromHistory (526char *CommandNumArg);527528char *529AcpiDbGetHistoryByIndex (530UINT32 CommanddNum);531532533/*534* dbinput - user front-end to the AML debugger535*/536ACPI_STATUS537AcpiDbCommandDispatch (538char *InputBuffer,539ACPI_WALK_STATE *WalkState,540ACPI_PARSE_OBJECT *Op);541542void ACPI_SYSTEM_XFACE543AcpiDbExecuteThread (544void *Context);545546ACPI_STATUS547AcpiDbUserCommands (548void);549550char *551AcpiDbGetNextToken (552char *String,553char **Next,554ACPI_OBJECT_TYPE *ReturnType);555556557/*558* dbobject559*/560void561AcpiDbDecodeInternalObject (562ACPI_OPERAND_OBJECT *ObjDesc);563564void565AcpiDbDisplayInternalObject (566ACPI_OPERAND_OBJECT *ObjDesc,567ACPI_WALK_STATE *WalkState);568569void570AcpiDbDecodeArguments (571ACPI_WALK_STATE *WalkState);572573void574AcpiDbDecodeLocals (575ACPI_WALK_STATE *WalkState);576577void578AcpiDbDumpMethodInfo (579ACPI_STATUS Status,580ACPI_WALK_STATE *WalkState);581582583/*584* dbstats - Generation and display of ACPI table statistics585*/586void587AcpiDbGenerateStatistics (588ACPI_PARSE_OBJECT *Root,589BOOLEAN IsMethod);590591ACPI_STATUS592AcpiDbDisplayStatistics (593char *TypeArg);594595596/*597* dbutils - AML debugger utilities598*/599void600AcpiDbSetOutputDestination (601UINT32 Where);602603void604AcpiDbDumpExternalObject (605ACPI_OBJECT *ObjDesc,606UINT32 Level);607608void609AcpiDbPrepNamestring (610char *Name);611612ACPI_NAMESPACE_NODE *613AcpiDbLocalNsLookup (614char *Name);615616void617AcpiDbUint32ToHexString (618UINT32 Value,619char *Buffer);620621void622AcpiDbGenerateInterrupt (623char *GsivArg);624625#endif /* __ACDEBUG_H__ */626627628