acdebug.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:9k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /******************************************************************************
  2.  *
  3.  * Name: acdebug.h - ACPI/AML debugger
  4.  *       $Revision: 50 $
  5.  *
  6.  *****************************************************************************/
  7. /*
  8.  *  Copyright (C) 2000, 2001 R. Byron Moore
  9.  *
  10.  *  This program is free software; you can redistribute it and/or modify
  11.  *  it under the terms of the GNU General Public License as published by
  12.  *  the Free Software Foundation; either version 2 of the License, or
  13.  *  (at your option) any later version.
  14.  *
  15.  *  This program is distributed in the hope that it will be useful,
  16.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  *  GNU General Public License for more details.
  19.  *
  20.  *  You should have received a copy of the GNU General Public License
  21.  *  along with this program; if not, write to the Free Software
  22.  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  23.  */
  24. #ifndef __ACDEBUG_H__
  25. #define __ACDEBUG_H__
  26. #define DB_MAX_ARGS             8  /* Must be max method args + 1 */
  27. #define DB_COMMAND_PROMPT      '-'
  28. #define DB_EXECUTE_PROMPT      '%'
  29. extern int                      optind;
  30. extern NATIVE_CHAR              *optarg;
  31. extern u8                       *aml_start;
  32. extern u32                      aml_length;
  33. extern u8                       acpi_gbl_db_opt_tables;
  34. extern u8                       acpi_gbl_db_opt_disasm;
  35. extern u8                       acpi_gbl_db_opt_stats;
  36. extern u8                       acpi_gbl_db_opt_parse_jit;
  37. extern u8                       acpi_gbl_db_opt_verbose;
  38. extern u8                       acpi_gbl_db_opt_ini_methods;
  39. extern NATIVE_CHAR              *acpi_gbl_db_args[DB_MAX_ARGS];
  40. extern NATIVE_CHAR              acpi_gbl_db_line_buf[80];
  41. extern NATIVE_CHAR              acpi_gbl_db_scope_buf[40];
  42. extern NATIVE_CHAR              acpi_gbl_db_debug_filename[40];
  43. extern u8                       acpi_gbl_db_output_to_file;
  44. extern NATIVE_CHAR              *acpi_gbl_db_buffer;
  45. extern NATIVE_CHAR              *acpi_gbl_db_filename;
  46. extern NATIVE_CHAR              *acpi_gbl_db_disasm_indent;
  47. extern u8                       acpi_gbl_db_output_flags;
  48. extern u32                      acpi_gbl_db_debug_level;
  49. extern u32                      acpi_gbl_db_console_debug_level;
  50. extern acpi_table_header        *acpi_gbl_db_table_ptr;
  51. /*
  52.  * Statistic globals
  53.  */
  54. extern u16                      acpi_gbl_obj_type_count[INTERNAL_TYPE_NODE_MAX+1];
  55. extern u16                      acpi_gbl_node_type_count[INTERNAL_TYPE_NODE_MAX+1];
  56. extern u16                      acpi_gbl_obj_type_count_misc;
  57. extern u16                      acpi_gbl_node_type_count_misc;
  58. extern u32                      acpi_gbl_num_nodes;
  59. extern u32                      acpi_gbl_num_objects;
  60. extern u32                      acpi_gbl_size_of_parse_tree;
  61. extern u32                      acpi_gbl_size_of_method_trees;
  62. extern u32                      acpi_gbl_size_of_node_entries;
  63. extern u32                      acpi_gbl_size_of_acpi_objects;
  64. #define ACPI_DEBUG_BUFFER_SIZE  4196
  65. #define DB_REDIRECTABLE_OUTPUT  0x01
  66. #define DB_CONSOLE_OUTPUT       0x02
  67. #define DB_DUPLICATE_OUTPUT     0x03
  68. typedef struct command_info
  69. {
  70. NATIVE_CHAR             *name;          /* Command Name */
  71. u8                      min_args;       /* Minimum arguments required */
  72. } COMMAND_INFO;
  73. typedef struct argument_info
  74. {
  75. NATIVE_CHAR             *name;          /* Argument Name */
  76. } ARGUMENT_INFO;
  77. #define PARAM_LIST(pl)                  pl
  78. #define DBTEST_OUTPUT_LEVEL(lvl)        if (acpi_gbl_db_opt_verbose)
  79. #define VERBOSE_PRINT(fp)               DBTEST_OUTPUT_LEVEL(lvl) {
  80.   acpi_os_printf PARAM_LIST(fp);}
  81. #define EX_NO_SINGLE_STEP       1
  82. #define EX_SINGLE_STEP          2
  83. /* Prototypes */
  84. /*
  85.  * dbapi - external debugger interfaces
  86.  */
  87. int
  88. acpi_db_initialize (
  89. void);
  90. void
  91. acpi_db_terminate (
  92. void);
  93. acpi_status
  94. acpi_db_single_step (
  95. acpi_walk_state         *walk_state,
  96. acpi_parse_object       *op,
  97. u32                     op_type);
  98. /*
  99.  * dbcmds - debug commands and output routines
  100.  */
  101. void
  102. acpi_db_display_table_info (
  103. NATIVE_CHAR             *table_arg);
  104. void
  105. acpi_db_unload_acpi_table (
  106. NATIVE_CHAR             *table_arg,
  107. NATIVE_CHAR             *instance_arg);
  108. void
  109. acpi_db_set_method_breakpoint (
  110. NATIVE_CHAR             *location,
  111. acpi_walk_state         *walk_state,
  112. acpi_parse_object       *op);
  113. void
  114. acpi_db_set_method_call_breakpoint (
  115. acpi_parse_object       *op);
  116. void
  117. acpi_db_disassemble_aml (
  118. NATIVE_CHAR             *statements,
  119. acpi_parse_object       *op);
  120. void
  121. acpi_db_dump_namespace (
  122. NATIVE_CHAR             *start_arg,
  123. NATIVE_CHAR             *depth_arg);
  124. void
  125. acpi_db_dump_namespace_by_owner (
  126. NATIVE_CHAR             *owner_arg,
  127. NATIVE_CHAR             *depth_arg);
  128. void
  129. acpi_db_send_notify (
  130. NATIVE_CHAR             *name,
  131. u32                     value);
  132. void
  133. acpi_db_set_method_data (
  134. NATIVE_CHAR             *type_arg,
  135. NATIVE_CHAR             *index_arg,
  136. NATIVE_CHAR             *value_arg);
  137. acpi_status
  138. acpi_db_display_objects (
  139. NATIVE_CHAR             *obj_type_arg,
  140. NATIVE_CHAR             *display_count_arg);
  141. acpi_status
  142. acpi_db_find_name_in_namespace (
  143. NATIVE_CHAR             *name_arg);
  144. void
  145. acpi_db_set_scope (
  146. NATIVE_CHAR             *name);
  147. void
  148. acpi_db_find_references (
  149. NATIVE_CHAR             *object_arg);
  150. void
  151. acpi_db_display_locks (void);
  152. void
  153. acpi_db_display_resources (
  154. NATIVE_CHAR             *object_arg);
  155. /*
  156.  * dbdisasm - AML disassembler
  157.  */
  158. void
  159. acpi_db_display_op (
  160. acpi_walk_state         *walk_state,
  161. acpi_parse_object       *origin,
  162. u32                     num_opcodes);
  163. void
  164. acpi_db_display_namestring (
  165. NATIVE_CHAR             *name);
  166. void
  167. acpi_db_display_path (
  168. acpi_parse_object       *op);
  169. void
  170. acpi_db_display_opcode (
  171. acpi_walk_state         *walk_state,
  172. acpi_parse_object       *op);
  173. void
  174. acpi_db_decode_internal_object (
  175. acpi_operand_object     *obj_desc);
  176. /*
  177.  * dbdisply - debug display commands
  178.  */
  179. void
  180. acpi_db_display_method_info (
  181. acpi_parse_object       *op);
  182. void
  183. acpi_db_decode_and_display_object (
  184. NATIVE_CHAR             *target,
  185. NATIVE_CHAR             *output_type);
  186. void
  187. acpi_db_display_result_object (
  188. acpi_operand_object     *obj_desc,
  189. acpi_walk_state         *walk_state);
  190. acpi_status
  191. acpi_db_display_all_methods (
  192. NATIVE_CHAR             *display_count_arg);
  193. void
  194. acpi_db_display_internal_object (
  195. acpi_operand_object     *obj_desc,
  196. acpi_walk_state         *walk_state);
  197. void
  198. acpi_db_display_arguments (
  199. void);
  200. void
  201. acpi_db_display_locals (
  202. void);
  203. void
  204. acpi_db_display_results (
  205. void);
  206. void
  207. acpi_db_display_calling_tree (
  208. void);
  209. void
  210. acpi_db_display_argument_object (
  211. acpi_operand_object     *obj_desc,
  212. acpi_walk_state         *walk_state);
  213. /*
  214.  * dbexec - debugger control method execution
  215.  */
  216. void
  217. acpi_db_execute (
  218. NATIVE_CHAR             *name,
  219. NATIVE_CHAR             **args,
  220. u32                     flags);
  221. void
  222. acpi_db_create_execution_threads (
  223. NATIVE_CHAR             *num_threads_arg,
  224. NATIVE_CHAR             *num_loops_arg,
  225. NATIVE_CHAR             *method_name_arg);
  226. /*
  227.  * dbfileio - Debugger file I/O commands
  228.  */
  229. acpi_object_type8
  230. acpi_db_match_argument (
  231. NATIVE_CHAR             *user_argument,
  232. ARGUMENT_INFO           *arguments);
  233. void
  234. acpi_db_close_debug_file (
  235. void);
  236. void
  237. acpi_db_open_debug_file (
  238. NATIVE_CHAR             *name);
  239. acpi_status
  240. acpi_db_load_acpi_table (
  241. NATIVE_CHAR             *filename);
  242. /*
  243.  * dbhistry - debugger HISTORY command
  244.  */
  245. void
  246. acpi_db_add_to_history (
  247. NATIVE_CHAR             *command_line);
  248. void
  249. acpi_db_display_history (void);
  250. NATIVE_CHAR *
  251. acpi_db_get_from_history (
  252. NATIVE_CHAR             *command_num_arg);
  253. /*
  254.  * dbinput - user front-end to the AML debugger
  255.  */
  256. acpi_status
  257. acpi_db_command_dispatch (
  258. NATIVE_CHAR             *input_buffer,
  259. acpi_walk_state         *walk_state,
  260. acpi_parse_object       *op);
  261. void
  262. acpi_db_execute_thread (
  263. void                    *context);
  264. acpi_status
  265. acpi_db_user_commands (
  266. NATIVE_CHAR             prompt,
  267. acpi_parse_object       *op);
  268. /*
  269.  * dbstats - Generation and display of ACPI table statistics
  270.  */
  271. void
  272. acpi_db_generate_statistics (
  273. acpi_parse_object       *root,
  274. u8                      is_method);
  275. acpi_status
  276. acpi_db_display_statistics (
  277. NATIVE_CHAR             *type_arg);
  278. /*
  279.  * dbutils - AML debugger utilities
  280.  */
  281. void
  282. acpi_db_set_output_destination (
  283. u32                     where);
  284. void
  285. acpi_db_dump_buffer (
  286. u32                     address);
  287. void
  288. acpi_db_dump_object (
  289. acpi_object             *obj_desc,
  290. u32                     level);
  291. void
  292. acpi_db_prep_namestring (
  293. NATIVE_CHAR             *name);
  294. acpi_status
  295. acpi_db_second_pass_parse (
  296. acpi_parse_object       *root);
  297. acpi_namespace_node *
  298. acpi_db_local_ns_lookup (
  299. NATIVE_CHAR             *name);
  300. #endif  /* __ACDEBUG_H__ */