Linux 2.4.0-test8
[davej-history.git] / drivers / acpi / include / debugger.h
blob0d27d59b36feeb18c6bded3dd0ad539d35b145b8
2 /******************************************************************************
4 * Name: debugger.h - ACPI/AML debugger
6 *****************************************************************************/
8 /*
9 * Copyright (C) 2000 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
26 #ifndef __DEBUGGER_H__
27 #define __DEBUGGER_H__
30 #define DB_MAX_ARGS 8 /* Must be max method args + 1 */
32 #define DB_COMMAND_PROMPT '-'
33 #define DB_EXECUTE_PROMPT '%'
36 extern int optind;
37 extern char *optarg;
38 extern u8 *aml_ptr;
39 extern u32 acpi_aml_length;
41 extern u8 opt_tables;
42 extern u8 opt_disasm;
43 extern u8 opt_stats;
44 extern u8 opt_parse_jit;
45 extern u8 opt_verbose;
48 extern char *args[DB_MAX_ARGS];
49 extern char line_buf[80];
50 extern char scope_buf[40];
51 extern char debug_filename[40];
52 extern u8 output_to_file;
53 extern char *buffer;
54 extern char *filename;
55 extern char *INDENT_STRING;
56 extern u32 acpi_gbl_method_breakpoint;
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;
61 extern u32 num_names;
62 extern u32 num_methods;
63 extern u32 num_regions;
64 extern u32 num_packages;
65 extern u32 num_aliases;
66 extern u32 num_devices;
67 extern u32 num_field_defs;
68 extern u32 num_thermal_zones;
69 extern u32 num_named_objects;
70 extern u32 num_grammar_elements;
71 extern u32 num_method_elements ;
72 extern u32 num_mutexes;
73 extern u32 num_power_resources;
74 extern u32 num_bank_fields ;
75 extern u32 num_index_fields;
76 extern u32 num_events;
78 extern u32 size_of_parse_tree;
79 extern u32 size_of_method_trees;
80 extern u32 size_of_nTes;
81 extern u32 size_of_acpi_objects;
84 #define BUFFER_SIZE 4196
86 #define DB_REDIRECTABLE_OUTPUT 0x01
87 #define DB_CONSOLE_OUTPUT 0x02
88 #define DB_DUPLICATE_OUTPUT 0x03
91 typedef struct command_info
93 char *name; /* Command Name */
94 char min_args; /* Minimum arguments required */
96 } COMMAND_INFO;
99 typedef struct argument_info
101 char *name; /* Argument Name */
103 } ARGUMENT_INFO;
106 #define PARAM_LIST(pl) pl
108 #define DBTEST_OUTPUT_LEVEL(lvl) if (opt_verbose)
110 #define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\
111 acpi_os_printf PARAM_LIST(fp);}
113 #define EX_NO_SINGLE_STEP 1
114 #define EX_SINGLE_STEP 2
117 /* Prototypes */
121 * dbapi - external debugger interfaces
125 acpi_db_initialize (
126 void);
128 ACPI_STATUS
129 acpi_db_single_step (
130 ACPI_WALK_STATE *walk_state,
131 ACPI_GENERIC_OP *op,
132 u8 op_type);
136 * dbcmds - debug commands and output routines
140 void
141 acpi_db_display_table_info (
142 char *table_arg);
144 void
145 acpi_db_unload_acpi_table (
146 char *table_arg,
147 char *instance_arg);
149 void
150 acpi_db_set_method_breakpoint (
151 char *location,
152 ACPI_WALK_STATE *walk_state,
153 ACPI_GENERIC_OP *op);
155 void
156 acpi_db_set_method_call_breakpoint (
157 ACPI_GENERIC_OP *op);
159 void
160 acpi_db_disassemble_aml (
161 char *statements,
162 ACPI_GENERIC_OP *op);
164 void
165 acpi_db_dump_namespace (
166 char *start_arg,
167 char *depth_arg);
169 void
170 acpi_db_dump_namespace_by_owner (
171 char *owner_arg,
172 char *depth_arg);
174 void
175 acpi_db_send_notify (
176 char *name,
177 u32 value);
179 void
180 acpi_db_set_method_data (
181 char *type_arg,
182 char *index_arg,
183 char *value_arg);
185 ACPI_STATUS
186 acpi_db_display_objects (
187 char *obj_type_arg,
188 char *display_count_arg);
190 ACPI_STATUS
191 acpi_db_find_name_in_namespace (
192 char *name_arg);
194 void
195 acpi_db_set_scope (
196 char *name);
198 void
199 acpi_db_find_references (
200 char *object_arg);
204 * dbdisasm - AML disassembler
207 void
208 acpi_db_display_op (
209 ACPI_GENERIC_OP *origin,
210 u32 num_opcodes);
212 void
213 acpi_db_display_namestring (
214 char *name);
216 void
217 acpi_db_display_path (
218 ACPI_GENERIC_OP *op);
220 void
221 acpi_db_display_opcode (
222 ACPI_GENERIC_OP *op);
226 * dbdisply - debug display commands
230 void
231 acpi_db_display_method_info (
232 ACPI_GENERIC_OP *op);
234 void
235 acpi_db_decode_and_display_object (
236 char *target,
237 char *output_type);
239 void
240 acpi_db_display_result_object (
241 ACPI_OBJECT_INTERNAL *ret_desc);
243 ACPI_STATUS
244 acpi_db_display_all_methods (
245 char *display_count_arg);
247 void
248 acpi_db_display_internal_object (
249 ACPI_OBJECT_INTERNAL *obj_desc);
251 void
252 acpi_db_display_arguments (
253 void);
255 void
256 acpi_db_display_locals (
257 void);
259 void
260 acpi_db_display_results (
261 void);
263 void
264 acpi_db_display_calling_tree (
265 void);
267 void
268 acpi_db_display_argument_object (
269 ACPI_OBJECT_INTERNAL *obj_desc);
273 * dbexec - debugger control method execution
276 void
277 acpi_db_execute (
278 char *name,
279 char **args,
280 u32 flags);
282 void
283 acpi_db_create_execution_threads (
284 char *num_threads_arg,
285 char *num_loops_arg,
286 char *method_name_arg);
290 * dbfileio - Debugger file I/O commands
293 OBJECT_TYPE_INTERNAL
294 acpi_db_match_argument (
295 char *user_argument,
296 ARGUMENT_INFO *arguments);
299 void
300 acpi_db_close_debug_file (
301 void);
303 void
304 acpi_db_open_debug_file (
305 char *name);
307 ACPI_STATUS
308 acpi_db_load_acpi_table (
309 char *filename);
313 * dbhistry - debugger HISTORY command
316 void
317 acpi_db_add_to_history (
318 char *command_line);
320 void
321 acpi_db_display_history (void);
323 char *
324 acpi_db_get_from_history (
325 char *command_num_arg);
329 * dbinput - user front-end to the AML debugger
332 ACPI_STATUS
333 acpi_db_command_dispatch (
334 char *input_buffer,
335 ACPI_WALK_STATE *walk_state,
336 ACPI_GENERIC_OP *op);
338 void
339 acpi_db_execute_thread (
340 void *context);
342 ACPI_STATUS
343 acpi_db_user_commands (
344 char prompt,
345 ACPI_GENERIC_OP *op);
349 * dbstats - Generation and display of ACPI table statistics
352 void
353 acpi_db_generate_statistics (
354 ACPI_GENERIC_OP *root,
355 u8 is_method);
358 ACPI_STATUS
359 acpi_db_display_statistics (
360 char *type_arg);
364 * dbutils - AML debugger utilities
367 void
368 acpi_db_set_output_destination (
369 s32 where);
371 void
372 acpi_db_dump_buffer (
373 u32 address);
375 void
376 acpi_db_dump_object (
377 ACPI_OBJECT *obj_desc,
378 u32 level);
380 void
381 acpi_db_prep_namestring (
382 char *name);
385 ACPI_STATUS
386 acpi_db_second_pass_parse (
387 ACPI_GENERIC_OP *root);
389 ACPI_NAMED_OBJECT*
390 acpi_db_local_ns_lookup (
391 char *name);
394 #endif /* __DEBUGGER_H__ */