1 /******************************************************************************
3 * Name: acdebug.h - ACPI/AML debugger
6 *****************************************************************************/
9 * Copyright (C) 2000, 2001 R. Byron Moore
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #define DB_MAX_ARGS 8 /* Must be max method args + 1 */
32 #define DB_COMMAND_PROMPT '-'
33 #define DB_EXECUTE_PROMPT '%'
37 extern NATIVE_CHAR *optarg;
39 extern u32 aml_length;
41 extern u8 acpi_gbl_db_opt_tables;
42 extern u8 acpi_gbl_db_opt_disasm;
43 extern u8 acpi_gbl_db_opt_stats;
44 extern u8 acpi_gbl_db_opt_parse_jit;
45 extern u8 acpi_gbl_db_opt_verbose;
46 extern u8 acpi_gbl_db_opt_ini_methods;
49 extern NATIVE_CHAR *acpi_gbl_db_args[DB_MAX_ARGS];
50 extern NATIVE_CHAR acpi_gbl_db_line_buf[80];
51 extern NATIVE_CHAR acpi_gbl_db_scope_buf[40];
52 extern NATIVE_CHAR acpi_gbl_db_debug_filename[40];
53 extern u8 acpi_gbl_db_output_to_file;
54 extern NATIVE_CHAR *acpi_gbl_db_buffer;
55 extern NATIVE_CHAR *acpi_gbl_db_filename;
56 extern NATIVE_CHAR *acpi_gbl_db_disasm_indent;
57 extern u8 acpi_gbl_db_output_flags;
58 extern u32 acpi_gbl_db_debug_level;
59 extern u32 acpi_gbl_db_console_debug_level;
60 extern acpi_table_header *acpi_gbl_db_table_ptr;
65 extern u16 acpi_gbl_obj_type_count[INTERNAL_TYPE_NODE_MAX+1];
66 extern u16 acpi_gbl_node_type_count[INTERNAL_TYPE_NODE_MAX+1];
67 extern u16 acpi_gbl_obj_type_count_misc;
68 extern u16 acpi_gbl_node_type_count_misc;
69 extern u32 acpi_gbl_num_nodes;
70 extern u32 acpi_gbl_num_objects;
73 extern u32 acpi_gbl_size_of_parse_tree;
74 extern u32 acpi_gbl_size_of_method_trees;
75 extern u32 acpi_gbl_size_of_node_entries;
76 extern u32 acpi_gbl_size_of_acpi_objects;
79 #define ACPI_DEBUG_BUFFER_SIZE 4196
81 #define DB_REDIRECTABLE_OUTPUT 0x01
82 #define DB_CONSOLE_OUTPUT 0x02
83 #define DB_DUPLICATE_OUTPUT 0x03
86 typedef struct command_info
88 NATIVE_CHAR *name; /* Command Name */
89 u8 min_args; /* Minimum arguments required */
94 typedef struct argument_info
96 NATIVE_CHAR *name; /* Argument Name */
101 #define PARAM_LIST(pl) pl
103 #define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose)
105 #define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\
106 acpi_os_printf PARAM_LIST(fp);}
108 #define EX_NO_SINGLE_STEP 1
109 #define EX_SINGLE_STEP 2
116 * dbapi - external debugger interfaces
128 acpi_db_single_step (
129 acpi_walk_state *walk_state,
130 acpi_parse_object *op,
135 * dbcmds - debug commands and output routines
140 acpi_db_display_table_info (
141 NATIVE_CHAR *table_arg);
144 acpi_db_unload_acpi_table (
145 NATIVE_CHAR *table_arg,
146 NATIVE_CHAR *instance_arg);
149 acpi_db_set_method_breakpoint (
150 NATIVE_CHAR *location,
151 acpi_walk_state *walk_state,
152 acpi_parse_object *op);
155 acpi_db_set_method_call_breakpoint (
156 acpi_parse_object *op);
159 acpi_db_disassemble_aml (
160 NATIVE_CHAR *statements,
161 acpi_parse_object *op);
164 acpi_db_dump_namespace (
165 NATIVE_CHAR *start_arg,
166 NATIVE_CHAR *depth_arg);
169 acpi_db_dump_namespace_by_owner (
170 NATIVE_CHAR *owner_arg,
171 NATIVE_CHAR *depth_arg);
174 acpi_db_send_notify (
179 acpi_db_set_method_data (
180 NATIVE_CHAR *type_arg,
181 NATIVE_CHAR *index_arg,
182 NATIVE_CHAR *value_arg);
185 acpi_db_display_objects (
186 NATIVE_CHAR *obj_type_arg,
187 NATIVE_CHAR *display_count_arg);
190 acpi_db_find_name_in_namespace (
191 NATIVE_CHAR *name_arg);
198 acpi_db_find_references (
199 NATIVE_CHAR *object_arg);
202 acpi_db_display_locks (void);
206 acpi_db_display_resources (
207 NATIVE_CHAR *object_arg);
211 * dbdisasm - AML disassembler
216 acpi_walk_state *walk_state,
217 acpi_parse_object *origin,
221 acpi_db_display_namestring (
225 acpi_db_display_path (
226 acpi_parse_object *op);
229 acpi_db_display_opcode (
230 acpi_walk_state *walk_state,
231 acpi_parse_object *op);
234 acpi_db_decode_internal_object (
235 acpi_operand_object *obj_desc);
239 * dbdisply - debug display commands
244 acpi_db_display_method_info (
245 acpi_parse_object *op);
248 acpi_db_decode_and_display_object (
250 NATIVE_CHAR *output_type);
253 acpi_db_display_result_object (
254 acpi_operand_object *obj_desc,
255 acpi_walk_state *walk_state);
258 acpi_db_display_all_methods (
259 NATIVE_CHAR *display_count_arg);
262 acpi_db_display_internal_object (
263 acpi_operand_object *obj_desc,
264 acpi_walk_state *walk_state);
267 acpi_db_display_arguments (
271 acpi_db_display_locals (
275 acpi_db_display_results (
279 acpi_db_display_calling_tree (
283 acpi_db_display_argument_object (
284 acpi_operand_object *obj_desc,
285 acpi_walk_state *walk_state);
289 * dbexec - debugger control method execution
299 acpi_db_create_execution_threads (
300 NATIVE_CHAR *num_threads_arg,
301 NATIVE_CHAR *num_loops_arg,
302 NATIVE_CHAR *method_name_arg);
306 * dbfileio - Debugger file I/O commands
310 acpi_db_match_argument (
311 NATIVE_CHAR *user_argument,
312 ARGUMENT_INFO *arguments);
316 acpi_db_close_debug_file (
320 acpi_db_open_debug_file (
324 acpi_db_load_acpi_table (
325 NATIVE_CHAR *filename);
329 * dbhistry - debugger HISTORY command
333 acpi_db_add_to_history (
334 NATIVE_CHAR *command_line);
337 acpi_db_display_history (void);
340 acpi_db_get_from_history (
341 NATIVE_CHAR *command_num_arg);
345 * dbinput - user front-end to the AML debugger
349 acpi_db_command_dispatch (
350 NATIVE_CHAR *input_buffer,
351 acpi_walk_state *walk_state,
352 acpi_parse_object *op);
355 acpi_db_execute_thread (
359 acpi_db_user_commands (
361 acpi_parse_object *op);
365 * dbstats - Generation and display of ACPI table statistics
369 acpi_db_generate_statistics (
370 acpi_parse_object *root,
375 acpi_db_display_statistics (
376 NATIVE_CHAR *type_arg);
380 * dbutils - AML debugger utilities
384 acpi_db_set_output_destination (
388 acpi_db_dump_buffer (
392 acpi_db_dump_object (
393 acpi_object *obj_desc,
397 acpi_db_prep_namestring (
402 acpi_db_second_pass_parse (
403 acpi_parse_object *root);
405 acpi_namespace_node *
406 acpi_db_local_ns_lookup (
410 #endif /* __ACDEBUG_H__ */