acdebug.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. /******************************************************************************
  2. *
  3. * Name: acdebug.h - ACPI/AML debugger
  4. *
  5. *****************************************************************************/
  6. /******************************************************************************
  7. *
  8. * 1. Copyright Notice
  9. *
  10. * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
  11. * All rights reserved.
  12. *
  13. * 2. License
  14. *
  15. * 2.1. This is your license from Intel Corp. under its intellectual property
  16. * rights. You may have additional license terms from the party that provided
  17. * you this software, covering your right to use that party's intellectual
  18. * property rights.
  19. *
  20. * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
  21. * copy of the source code appearing in this file ("Covered Code") an
  22. * irrevocable, perpetual, worldwide license under Intel's copyrights in the
  23. * base code distributed originally by Intel ("Original Intel Code") to copy,
  24. * make derivatives, distribute, use and display any portion of the Covered
  25. * Code in any form, with the right to sublicense such rights; and
  26. *
  27. * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
  28. * license (with the right to sublicense), under only those claims of Intel
  29. * 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 thereof
  31. * solely to the minimum extent necessary to exercise the above copyright
  32. * license, and in no event shall the patent license extend to any additions
  33. * to or modifications of the Original Intel Code. No other license or right
  34. * is granted directly or by implication, estoppel or otherwise;
  35. *
  36. * The above copyright and patent license is granted only if the following
  37. * conditions are met:
  38. *
  39. * 3. Conditions
  40. *
  41. * 3.1. Redistribution of Source with Rights to Further Distribute Source.
  42. * Redistribution of source code of any substantial portion of the Covered
  43. * Code or modification with rights to further distribute source must include
  44. * 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 to
  47. * contain a file documenting the changes Licensee made to create that Covered
  48. * Code and the date of any change. Licensee must include in that file the
  49. * documentation of any changes made by any predecessor Licensee. Licensee
  50. * 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 Covered
  55. * Code or modification without rights to further distribute source must
  56. * include the following Disclaimer and Export Compliance provision in the
  57. * documentation and/or other materials provided with distribution. In
  58. * addition, Licensee may not authorize further sublicense of source of any
  59. * portion of the Covered Code, and must include terms to the effect that the
  60. * license from Licensee to its licensee is limited to the intellectual
  61. * property embodied in the software Licensee provides to its licensee, and
  62. * not to intellectual property embodied in modifications its licensee may
  63. * make.
  64. *
  65. * 3.3. Redistribution of Executable. Redistribution in executable form of any
  66. * substantial portion of the Covered Code or modification must reproduce the
  67. * above Copyright Notice, and the following Disclaimer and Export Compliance
  68. * provision in the documentation and/or other materials provided with the
  69. * distribution.
  70. *
  71. * 3.4. Intel retains all right, title, and interest in and to the Original
  72. * Intel Code.
  73. *
  74. * 3.5. Neither the name Intel nor any other trademark owned or controlled by
  75. * Intel shall be used in advertising or otherwise to promote the sale, use or
  76. * other dealings in products derived from or relating to the Covered Code
  77. * without prior written authorization from Intel.
  78. *
  79. * 4. Disclaimer and Export Compliance
  80. *
  81. * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
  82. * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
  83. * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
  84. * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
  85. * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
  86. * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
  87. * PARTICULAR PURPOSE.
  88. *
  89. * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
  90. * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
  91. * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
  92. * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
  93. * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
  94. * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
  95. * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
  96. * LIMITED REMEDY.
  97. *
  98. * 4.3. Licensee shall not export, either directly or indirectly, any of this
  99. * software or system incorporating such software without first obtaining any
  100. * required license or other approval from the U. S. Department of Commerce or
  101. * any other agency or department of the United States Government. In the
  102. * event Licensee exports any such software from the United States or
  103. * re-exports any such software from a foreign destination, Licensee shall
  104. * ensure that the distribution and export/re-export of the software is in
  105. * compliance with all laws, regulations, orders, or other restrictions of the
  106. * U.S. Export Administration Regulations. Licensee agrees that neither it nor
  107. * any of its subsidiaries will export/re-export any technical data, process,
  108. * software, or service, directly or indirectly, to any country for which the
  109. * United States government or any agency thereof requires an export license,
  110. * other governmental approval, or letter of assurance, without first obtaining
  111. * such license, approval or letter.
  112. *
  113. *****************************************************************************
  114. *
  115. * Alternatively, you may choose to be licensed under the terms of the
  116. * following license:
  117. *
  118. * Redistribution and use in source and binary forms, with or without
  119. * modification, are permitted provided that the following conditions
  120. * are met:
  121. * 1. Redistributions of source code must retain the above copyright
  122. * notice, this list of conditions, and the following disclaimer,
  123. * without modification.
  124. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  125. * substantially similar to the "NO WARRANTY" disclaimer below
  126. * ("Disclaimer") and any redistribution must be conditioned upon
  127. * including a substantially similar Disclaimer requirement for further
  128. * binary redistribution.
  129. * 3. Neither the names of the above-listed copyright holders nor the names
  130. * of any contributors may be used to endorse or promote products derived
  131. * from this software without specific prior written permission.
  132. *
  133. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  134. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  135. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  136. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  137. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  138. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  139. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  140. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  141. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  142. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  143. * 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 the
  146. * GNU General Public License ("GPL") version 2 as published by the Free
  147. * Software Foundation.
  148. *
  149. *****************************************************************************/
  150. #ifndef __ACDEBUG_H__
  151. #define __ACDEBUG_H__
  152. /* The debugger is used in conjunction with the disassembler most of time */
  153. #ifdef ACPI_DISASSEMBLER
  154. #include "acdisasm.h"
  155. #endif
  156. #define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */
  157. typedef struct acpi_db_command_info
  158. {
  159. const char *Name; /* Command Name */
  160. UINT8 MinArgs; /* Minimum arguments required */
  161. } ACPI_DB_COMMAND_INFO;
  162. typedef struct acpi_db_command_help
  163. {
  164. UINT8 LineCount; /* Number of help lines */
  165. char *Invocation; /* Command Invocation */
  166. char *Description; /* Command Description */
  167. } ACPI_DB_COMMAND_HELP;
  168. typedef struct acpi_db_argument_info
  169. {
  170. const char *Name; /* Argument Name */
  171. } ACPI_DB_ARGUMENT_INFO;
  172. typedef struct acpi_db_execute_walk
  173. {
  174. UINT32 Count;
  175. UINT32 MaxCount;
  176. } ACPI_DB_EXECUTE_WALK;
  177. #define PARAM_LIST(pl) pl
  178. #define EX_NO_SINGLE_STEP 1
  179. #define EX_SINGLE_STEP 2
  180. /*
  181. * dbxface - external debugger interfaces
  182. */
  183. ACPI_DBR_DEPENDENT_RETURN_OK (
  184. ACPI_STATUS
  185. AcpiDbSingleStep (
  186. ACPI_WALK_STATE *WalkState,
  187. ACPI_PARSE_OBJECT *Op,
  188. UINT32 OpType))
  189. ACPI_DBR_DEPENDENT_RETURN_VOID (
  190. void
  191. AcpiDbSignalBreakPoint (
  192. ACPI_WALK_STATE *WalkState))
  193. /*
  194. * dbcmds - debug commands and output routines
  195. */
  196. ACPI_NAMESPACE_NODE *
  197. AcpiDbConvertToNode (
  198. char *InString);
  199. void
  200. AcpiDbDisplayTableInfo (
  201. char *TableArg);
  202. void
  203. AcpiDbDisplayTemplate (
  204. char *BufferArg);
  205. void
  206. AcpiDbUnloadAcpiTable (
  207. char *Name);
  208. void
  209. AcpiDbSendNotify (
  210. char *Name,
  211. UINT32 Value);
  212. void
  213. AcpiDbDisplayInterfaces (
  214. char *ActionArg,
  215. char *InterfaceNameArg);
  216. ACPI_STATUS
  217. AcpiDbSleep (
  218. char *ObjectArg);
  219. void
  220. AcpiDbTrace (
  221. char *EnableArg,
  222. char *MethodArg,
  223. char *OnceArg);
  224. void
  225. AcpiDbDisplayLocks (
  226. void);
  227. void
  228. AcpiDbDisplayResources (
  229. char *ObjectArg);
  230. ACPI_HW_DEPENDENT_RETURN_VOID (
  231. void
  232. AcpiDbDisplayGpes (
  233. void))
  234. void
  235. AcpiDbDisplayHandlers (
  236. void);
  237. ACPI_HW_DEPENDENT_RETURN_VOID (
  238. void
  239. AcpiDbGenerateGpe (
  240. char *GpeArg,
  241. char *BlockArg))
  242. ACPI_HW_DEPENDENT_RETURN_VOID (
  243. void
  244. AcpiDbGenerateSci (
  245. void))
  246. void
  247. AcpiDbExecuteTest (
  248. char *TypeArg);
  249. /*
  250. * dbconvert - miscellaneous conversion routines
  251. */
  252. ACPI_STATUS
  253. AcpiDbHexCharToValue (
  254. int HexChar,
  255. UINT8 *ReturnValue);
  256. ACPI_STATUS
  257. AcpiDbConvertToPackage (
  258. char *String,
  259. ACPI_OBJECT *Object);
  260. ACPI_STATUS
  261. AcpiDbConvertToObject (
  262. ACPI_OBJECT_TYPE Type,
  263. char *String,
  264. ACPI_OBJECT *Object);
  265. UINT8 *
  266. AcpiDbEncodePldBuffer (
  267. ACPI_PLD_INFO *PldInfo);
  268. void
  269. AcpiDbDumpPldBuffer (
  270. ACPI_OBJECT *ObjDesc);
  271. /*
  272. * dbmethod - control method commands
  273. */
  274. void
  275. AcpiDbSetMethodBreakpoint (
  276. char *Location,
  277. ACPI_WALK_STATE *WalkState,
  278. ACPI_PARSE_OBJECT *Op);
  279. void
  280. AcpiDbSetMethodCallBreakpoint (
  281. ACPI_PARSE_OBJECT *Op);
  282. void
  283. AcpiDbSetMethodData (
  284. char *TypeArg,
  285. char *IndexArg,
  286. char *ValueArg);
  287. ACPI_STATUS
  288. AcpiDbDisassembleMethod (
  289. char *Name);
  290. void
  291. AcpiDbDisassembleAml (
  292. char *Statements,
  293. ACPI_PARSE_OBJECT *Op);
  294. void
  295. AcpiDbEvaluatePredefinedNames (
  296. void);
  297. /*
  298. * dbnames - namespace commands
  299. */
  300. void
  301. AcpiDbSetScope (
  302. char *Name);
  303. void
  304. AcpiDbDumpNamespace (
  305. char *StartArg,
  306. char *DepthArg);
  307. void
  308. AcpiDbDumpNamespacePaths (
  309. void);
  310. void
  311. AcpiDbDumpNamespaceByOwner (
  312. char *OwnerArg,
  313. char *DepthArg);
  314. ACPI_STATUS
  315. AcpiDbFindNameInNamespace (
  316. char *NameArg);
  317. void
  318. AcpiDbCheckPredefinedNames (
  319. void);
  320. ACPI_STATUS
  321. AcpiDbDisplayObjects (
  322. char *ObjTypeArg,
  323. char *DisplayCountArg);
  324. void
  325. AcpiDbCheckIntegrity (
  326. void);
  327. void
  328. AcpiDbFindReferences (
  329. char *ObjectArg);
  330. void
  331. AcpiDbGetBusInfo (
  332. void);
  333. /*
  334. * dbdisply - debug display commands
  335. */
  336. void
  337. AcpiDbDisplayMethodInfo (
  338. ACPI_PARSE_OBJECT *Op);
  339. void
  340. AcpiDbDecodeAndDisplayObject (
  341. char *Target,
  342. char *OutputType);
  343. ACPI_DBR_DEPENDENT_RETURN_VOID (
  344. void
  345. AcpiDbDisplayResultObject (
  346. ACPI_OPERAND_OBJECT *ObjDesc,
  347. ACPI_WALK_STATE *WalkState))
  348. ACPI_STATUS
  349. AcpiDbDisplayAllMethods (
  350. char *DisplayCountArg);
  351. void
  352. AcpiDbDisplayArguments (
  353. void);
  354. void
  355. AcpiDbDisplayLocals (
  356. void);
  357. void
  358. AcpiDbDisplayResults (
  359. void);
  360. void
  361. AcpiDbDisplayCallingTree (
  362. void);
  363. void
  364. AcpiDbDisplayObjectType (
  365. char *ObjectArg);
  366. ACPI_DBR_DEPENDENT_RETURN_VOID (
  367. void
  368. AcpiDbDisplayArgumentObject (
  369. ACPI_OPERAND_OBJECT *ObjDesc,
  370. ACPI_WALK_STATE *WalkState))
  371. /*
  372. * dbexec - debugger control method execution
  373. */
  374. void
  375. AcpiDbExecute (
  376. char *Name,
  377. char **Args,
  378. ACPI_OBJECT_TYPE *Types,
  379. UINT32 Flags);
  380. void
  381. AcpiDbCreateExecutionThread (
  382. char *MethodNameArg,
  383. char **Arguments,
  384. ACPI_OBJECT_TYPE *Types);
  385. void
  386. AcpiDbCreateExecutionThreads (
  387. char *NumThreadsArg,
  388. char *NumLoopsArg,
  389. char *MethodNameArg);
  390. void
  391. AcpiDbDeleteObjects (
  392. UINT32 Count,
  393. ACPI_OBJECT *Objects);
  394. #ifdef ACPI_DBG_TRACK_ALLOCATIONS
  395. UINT32
  396. AcpiDbGetCacheInfo (
  397. ACPI_MEMORY_LIST *Cache);
  398. #endif
  399. /*
  400. * dbfileio - Debugger file I/O commands
  401. */
  402. ACPI_OBJECT_TYPE
  403. AcpiDbMatchArgument (
  404. char *UserArgument,
  405. ACPI_DB_ARGUMENT_INFO *Arguments);
  406. void
  407. AcpiDbCloseDebugFile (
  408. void);
  409. void
  410. AcpiDbOpenDebugFile (
  411. char *Name);
  412. ACPI_STATUS
  413. AcpiDbLoadAcpiTable (
  414. char *Filename);
  415. ACPI_STATUS
  416. AcpiDbLoadTables (
  417. ACPI_NEW_TABLE_DESC *ListHead);
  418. /*
  419. * dbhistry - debugger HISTORY command
  420. */
  421. void
  422. AcpiDbAddToHistory (
  423. char *CommandLine);
  424. void
  425. AcpiDbDisplayHistory (
  426. void);
  427. char *
  428. AcpiDbGetFromHistory (
  429. char *CommandNumArg);
  430. char *
  431. AcpiDbGetHistoryByIndex (
  432. UINT32 CommanddNum);
  433. /*
  434. * dbinput - user front-end to the AML debugger
  435. */
  436. ACPI_STATUS
  437. AcpiDbCommandDispatch (
  438. char *InputBuffer,
  439. ACPI_WALK_STATE *WalkState,
  440. ACPI_PARSE_OBJECT *Op);
  441. void ACPI_SYSTEM_XFACE
  442. AcpiDbExecuteThread (
  443. void *Context);
  444. ACPI_STATUS
  445. AcpiDbUserCommands (
  446. void);
  447. char *
  448. AcpiDbGetNextToken (
  449. char *String,
  450. char **Next,
  451. ACPI_OBJECT_TYPE *ReturnType);
  452. /*
  453. * dbobject
  454. */
  455. void
  456. AcpiDbDecodeInternalObject (
  457. ACPI_OPERAND_OBJECT *ObjDesc);
  458. void
  459. AcpiDbDisplayInternalObject (
  460. ACPI_OPERAND_OBJECT *ObjDesc,
  461. ACPI_WALK_STATE *WalkState);
  462. void
  463. AcpiDbDecodeArguments (
  464. ACPI_WALK_STATE *WalkState);
  465. void
  466. AcpiDbDecodeLocals (
  467. ACPI_WALK_STATE *WalkState);
  468. void
  469. AcpiDbDumpMethodInfo (
  470. ACPI_STATUS Status,
  471. ACPI_WALK_STATE *WalkState);
  472. /*
  473. * dbstats - Generation and display of ACPI table statistics
  474. */
  475. void
  476. AcpiDbGenerateStatistics (
  477. ACPI_PARSE_OBJECT *Root,
  478. BOOLEAN IsMethod);
  479. ACPI_STATUS
  480. AcpiDbDisplayStatistics (
  481. char *TypeArg);
  482. /*
  483. * dbutils - AML debugger utilities
  484. */
  485. void
  486. AcpiDbSetOutputDestination (
  487. UINT32 Where);
  488. void
  489. AcpiDbDumpExternalObject (
  490. ACPI_OBJECT *ObjDesc,
  491. UINT32 Level);
  492. void
  493. AcpiDbPrepNamestring (
  494. char *Name);
  495. ACPI_NAMESPACE_NODE *
  496. AcpiDbLocalNsLookup (
  497. char *Name);
  498. void
  499. AcpiDbUint32ToHexString (
  500. UINT32 Value,
  501. char *Buffer);
  502. #endif /* __ACDEBUG_H__ */