acdebug.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. /******************************************************************************
  2. *
  3. * Name: acdebug.h - ACPI/AML debugger
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2015, Intel Corp.
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions, and the following disclaimer,
  15. * without modification.
  16. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  17. * substantially similar to the "NO WARRANTY" disclaimer below
  18. * ("Disclaimer") and any redistribution must be conditioned upon
  19. * including a substantially similar Disclaimer requirement for further
  20. * binary redistribution.
  21. * 3. Neither the names of the above-listed copyright holders nor the names
  22. * of any contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * Alternatively, this software may be distributed under the terms of the
  26. * GNU General Public License ("GPL") version 2 as published by the Free
  27. * Software Foundation.
  28. *
  29. * NO WARRANTY
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  31. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  32. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  33. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  34. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  36. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  38. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  39. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGES.
  41. */
  42. #ifndef __ACDEBUG_H__
  43. #define __ACDEBUG_H__
  44. /* The debugger is used in conjunction with the disassembler most of time */
  45. #ifdef ACPI_DISASSEMBLER
  46. #include "acdisasm.h"
  47. #endif
  48. #define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */
  49. typedef struct acpi_db_command_info
  50. {
  51. char *Name; /* Command Name */
  52. UINT8 MinArgs; /* Minimum arguments required */
  53. } ACPI_DB_COMMAND_INFO;
  54. typedef struct acpi_db_command_help
  55. {
  56. UINT8 LineCount; /* Number of help lines */
  57. char *Invocation; /* Command Invocation */
  58. char *Description; /* Command Description */
  59. } ACPI_DB_COMMAND_HELP;
  60. typedef struct acpi_db_argument_info
  61. {
  62. char *Name; /* Argument Name */
  63. } ACPI_DB_ARGUMENT_INFO;
  64. typedef struct acpi_db_execute_walk
  65. {
  66. UINT32 Count;
  67. UINT32 MaxCount;
  68. } ACPI_DB_EXECUTE_WALK;
  69. #define PARAM_LIST(pl) pl
  70. #define EX_NO_SINGLE_STEP 1
  71. #define EX_SINGLE_STEP 2
  72. /*
  73. * dbxface - external debugger interfaces
  74. */
  75. ACPI_DBR_DEPENDENT_RETURN_OK (
  76. ACPI_STATUS
  77. AcpiDbSingleStep (
  78. ACPI_WALK_STATE *WalkState,
  79. ACPI_PARSE_OBJECT *Op,
  80. UINT32 OpType))
  81. ACPI_DBR_DEPENDENT_RETURN_VOID (
  82. void
  83. AcpiDbSignalBreakPoint (
  84. ACPI_WALK_STATE *WalkState))
  85. /*
  86. * dbcmds - debug commands and output routines
  87. */
  88. ACPI_NAMESPACE_NODE *
  89. AcpiDbConvertToNode (
  90. char *InString);
  91. void
  92. AcpiDbDisplayTableInfo (
  93. char *TableArg);
  94. void
  95. AcpiDbDisplayTemplate (
  96. char *BufferArg);
  97. void
  98. AcpiDbUnloadAcpiTable (
  99. char *Name);
  100. void
  101. AcpiDbSendNotify (
  102. char *Name,
  103. UINT32 Value);
  104. void
  105. AcpiDbDisplayInterfaces (
  106. char *ActionArg,
  107. char *InterfaceNameArg);
  108. ACPI_STATUS
  109. AcpiDbSleep (
  110. char *ObjectArg);
  111. void
  112. AcpiDbTrace (
  113. char *EnableArg,
  114. char *MethodArg,
  115. char *OnceArg);
  116. void
  117. AcpiDbDisplayLocks (
  118. void);
  119. void
  120. AcpiDbDisplayResources (
  121. char *ObjectArg);
  122. ACPI_HW_DEPENDENT_RETURN_VOID (
  123. void
  124. AcpiDbDisplayGpes (
  125. void))
  126. void
  127. AcpiDbDisplayHandlers (
  128. void);
  129. ACPI_HW_DEPENDENT_RETURN_VOID (
  130. void
  131. AcpiDbGenerateGpe (
  132. char *GpeArg,
  133. char *BlockArg))
  134. ACPI_HW_DEPENDENT_RETURN_VOID (
  135. void
  136. AcpiDbGenerateSci (
  137. void))
  138. void
  139. AcpiDbExecuteTest (
  140. char *TypeArg);
  141. /*
  142. * dbconvert - miscellaneous conversion routines
  143. */
  144. ACPI_STATUS
  145. AcpiDbHexCharToValue (
  146. int HexChar,
  147. UINT8 *ReturnValue);
  148. ACPI_STATUS
  149. AcpiDbConvertToPackage (
  150. char *String,
  151. ACPI_OBJECT *Object);
  152. ACPI_STATUS
  153. AcpiDbConvertToObject (
  154. ACPI_OBJECT_TYPE Type,
  155. char *String,
  156. ACPI_OBJECT *Object);
  157. UINT8 *
  158. AcpiDbEncodePldBuffer (
  159. ACPI_PLD_INFO *PldInfo);
  160. void
  161. AcpiDbDumpPldBuffer (
  162. ACPI_OBJECT *ObjDesc);
  163. /*
  164. * dbmethod - control method commands
  165. */
  166. void
  167. AcpiDbSetMethodBreakpoint (
  168. char *Location,
  169. ACPI_WALK_STATE *WalkState,
  170. ACPI_PARSE_OBJECT *Op);
  171. void
  172. AcpiDbSetMethodCallBreakpoint (
  173. ACPI_PARSE_OBJECT *Op);
  174. void
  175. AcpiDbSetMethodData (
  176. char *TypeArg,
  177. char *IndexArg,
  178. char *ValueArg);
  179. ACPI_STATUS
  180. AcpiDbDisassembleMethod (
  181. char *Name);
  182. void
  183. AcpiDbDisassembleAml (
  184. char *Statements,
  185. ACPI_PARSE_OBJECT *Op);
  186. void
  187. AcpiDbBatchExecute (
  188. char *CountArg);
  189. /*
  190. * dbnames - namespace commands
  191. */
  192. void
  193. AcpiDbSetScope (
  194. char *Name);
  195. void
  196. AcpiDbDumpNamespace (
  197. char *StartArg,
  198. char *DepthArg);
  199. void
  200. AcpiDbDumpNamespacePaths (
  201. void);
  202. void
  203. AcpiDbDumpNamespaceByOwner (
  204. char *OwnerArg,
  205. char *DepthArg);
  206. ACPI_STATUS
  207. AcpiDbFindNameInNamespace (
  208. char *NameArg);
  209. void
  210. AcpiDbCheckPredefinedNames (
  211. void);
  212. ACPI_STATUS
  213. AcpiDbDisplayObjects (
  214. char *ObjTypeArg,
  215. char *DisplayCountArg);
  216. void
  217. AcpiDbCheckIntegrity (
  218. void);
  219. void
  220. AcpiDbFindReferences (
  221. char *ObjectArg);
  222. void
  223. AcpiDbGetBusInfo (
  224. void);
  225. /*
  226. * dbdisply - debug display commands
  227. */
  228. void
  229. AcpiDbDisplayMethodInfo (
  230. ACPI_PARSE_OBJECT *Op);
  231. void
  232. AcpiDbDecodeAndDisplayObject (
  233. char *Target,
  234. char *OutputType);
  235. ACPI_DBR_DEPENDENT_RETURN_VOID (
  236. void
  237. AcpiDbDisplayResultObject (
  238. ACPI_OPERAND_OBJECT *ObjDesc,
  239. ACPI_WALK_STATE *WalkState))
  240. ACPI_STATUS
  241. AcpiDbDisplayAllMethods (
  242. char *DisplayCountArg);
  243. void
  244. AcpiDbDisplayArguments (
  245. void);
  246. void
  247. AcpiDbDisplayLocals (
  248. void);
  249. void
  250. AcpiDbDisplayResults (
  251. void);
  252. void
  253. AcpiDbDisplayCallingTree (
  254. void);
  255. void
  256. AcpiDbDisplayObjectType (
  257. char *ObjectArg);
  258. ACPI_DBR_DEPENDENT_RETURN_VOID (
  259. void
  260. AcpiDbDisplayArgumentObject (
  261. ACPI_OPERAND_OBJECT *ObjDesc,
  262. ACPI_WALK_STATE *WalkState))
  263. /*
  264. * dbexec - debugger control method execution
  265. */
  266. void
  267. AcpiDbExecute (
  268. char *Name,
  269. char **Args,
  270. ACPI_OBJECT_TYPE *Types,
  271. UINT32 Flags);
  272. void
  273. AcpiDbCreateExecutionThreads (
  274. char *NumThreadsArg,
  275. char *NumLoopsArg,
  276. char *MethodNameArg);
  277. void
  278. AcpiDbDeleteObjects (
  279. UINT32 Count,
  280. ACPI_OBJECT *Objects);
  281. #ifdef ACPI_DBG_TRACK_ALLOCATIONS
  282. UINT32
  283. AcpiDbGetCacheInfo (
  284. ACPI_MEMORY_LIST *Cache);
  285. #endif
  286. /*
  287. * dbfileio - Debugger file I/O commands
  288. */
  289. ACPI_OBJECT_TYPE
  290. AcpiDbMatchArgument (
  291. char *UserArgument,
  292. ACPI_DB_ARGUMENT_INFO *Arguments);
  293. void
  294. AcpiDbCloseDebugFile (
  295. void);
  296. void
  297. AcpiDbOpenDebugFile (
  298. char *Name);
  299. ACPI_STATUS
  300. AcpiDbLoadAcpiTable (
  301. char *Filename);
  302. ACPI_STATUS
  303. AcpiDbLoadTables (
  304. ACPI_NEW_TABLE_DESC *ListHead);
  305. /*
  306. * dbhistry - debugger HISTORY command
  307. */
  308. void
  309. AcpiDbAddToHistory (
  310. char *CommandLine);
  311. void
  312. AcpiDbDisplayHistory (
  313. void);
  314. char *
  315. AcpiDbGetFromHistory (
  316. char *CommandNumArg);
  317. char *
  318. AcpiDbGetHistoryByIndex (
  319. UINT32 CommanddNum);
  320. /*
  321. * dbinput - user front-end to the AML debugger
  322. */
  323. ACPI_STATUS
  324. AcpiDbCommandDispatch (
  325. char *InputBuffer,
  326. ACPI_WALK_STATE *WalkState,
  327. ACPI_PARSE_OBJECT *Op);
  328. void ACPI_SYSTEM_XFACE
  329. AcpiDbExecuteThread (
  330. void *Context);
  331. ACPI_STATUS
  332. AcpiDbUserCommands (
  333. char Prompt,
  334. ACPI_PARSE_OBJECT *Op);
  335. char *
  336. AcpiDbGetNextToken (
  337. char *String,
  338. char **Next,
  339. ACPI_OBJECT_TYPE *ReturnType);
  340. /*
  341. * dbobject
  342. */
  343. void
  344. AcpiDbDecodeInternalObject (
  345. ACPI_OPERAND_OBJECT *ObjDesc);
  346. void
  347. AcpiDbDisplayInternalObject (
  348. ACPI_OPERAND_OBJECT *ObjDesc,
  349. ACPI_WALK_STATE *WalkState);
  350. void
  351. AcpiDbDecodeArguments (
  352. ACPI_WALK_STATE *WalkState);
  353. void
  354. AcpiDbDecodeLocals (
  355. ACPI_WALK_STATE *WalkState);
  356. void
  357. AcpiDbDumpMethodInfo (
  358. ACPI_STATUS Status,
  359. ACPI_WALK_STATE *WalkState);
  360. /*
  361. * dbstats - Generation and display of ACPI table statistics
  362. */
  363. void
  364. AcpiDbGenerateStatistics (
  365. ACPI_PARSE_OBJECT *Root,
  366. BOOLEAN IsMethod);
  367. ACPI_STATUS
  368. AcpiDbDisplayStatistics (
  369. char *TypeArg);
  370. /*
  371. * dbutils - AML debugger utilities
  372. */
  373. void
  374. AcpiDbSetOutputDestination (
  375. UINT32 Where);
  376. void
  377. AcpiDbDumpExternalObject (
  378. ACPI_OBJECT *ObjDesc,
  379. UINT32 Level);
  380. void
  381. AcpiDbPrepNamestring (
  382. char *Name);
  383. ACPI_NAMESPACE_NODE *
  384. AcpiDbLocalNsLookup (
  385. char *Name);
  386. void
  387. AcpiDbUint32ToHexString (
  388. UINT32 Value,
  389. char *Buffer);
  390. #endif /* __ACDEBUG_H__ */