import of ftp.dlink.com/GPL/DSMG-600_reB/ppclinux.tar.gz
[linux-2.4.21-pre4.git] / drivers / acpi / include / acdebug.h
1 /******************************************************************************
2  *
3  * Name: acdebug.h - ACPI/AML debugger
4  *       $Revision: 1.1.1.1 $
5  *
6  *****************************************************************************/
7
8 /*
9  *  Copyright (C) 2000, 2001 R. Byron Moore
10  *
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.
15  *
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.
20  *
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
24  */
25
26 #ifndef __ACDEBUG_H__
27 #define __ACDEBUG_H__
28
29
30 #define DB_MAX_ARGS             8  /* Must be max method args + 1 */
31
32 #define DB_COMMAND_PROMPT      '-'
33 #define DB_EXECUTE_PROMPT      '%'
34
35
36 extern int                      optind;
37 extern NATIVE_CHAR              *optarg;
38 extern u8                       *aml_start;
39 extern u32                      aml_length;
40
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;
47
48
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;
61
62 /*
63  * Statistic globals
64  */
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;
71
72
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;
77
78
79 #define ACPI_DEBUG_BUFFER_SIZE  4196
80
81 #define DB_REDIRECTABLE_OUTPUT  0x01
82 #define DB_CONSOLE_OUTPUT       0x02
83 #define DB_DUPLICATE_OUTPUT     0x03
84
85
86 typedef struct command_info
87 {
88         NATIVE_CHAR             *name;          /* Command Name */
89         u8                      min_args;       /* Minimum arguments required */
90
91 } COMMAND_INFO;
92
93
94 typedef struct argument_info
95 {
96         NATIVE_CHAR             *name;          /* Argument Name */
97
98 } ARGUMENT_INFO;
99
100
101 #define PARAM_LIST(pl)                  pl
102
103 #define DBTEST_OUTPUT_LEVEL(lvl)        if (acpi_gbl_db_opt_verbose)
104
105 #define VERBOSE_PRINT(fp)               DBTEST_OUTPUT_LEVEL(lvl) {\
106                           acpi_os_printf PARAM_LIST(fp);}
107
108 #define EX_NO_SINGLE_STEP       1
109 #define EX_SINGLE_STEP          2
110
111
112 /* Prototypes */
113
114
115 /*
116  * dbapi - external debugger interfaces
117  */
118
119 int
120 acpi_db_initialize (
121         void);
122
123 void
124 acpi_db_terminate (
125         void);
126
127 acpi_status
128 acpi_db_single_step (
129         acpi_walk_state         *walk_state,
130         acpi_parse_object       *op,
131         u32                     op_type);
132
133
134 /*
135  * dbcmds - debug commands and output routines
136  */
137
138
139 void
140 acpi_db_display_table_info (
141         NATIVE_CHAR             *table_arg);
142
143 void
144 acpi_db_unload_acpi_table (
145         NATIVE_CHAR             *table_arg,
146         NATIVE_CHAR             *instance_arg);
147
148 void
149 acpi_db_set_method_breakpoint (
150         NATIVE_CHAR             *location,
151         acpi_walk_state         *walk_state,
152         acpi_parse_object       *op);
153
154 void
155 acpi_db_set_method_call_breakpoint (
156         acpi_parse_object       *op);
157
158 void
159 acpi_db_disassemble_aml (
160         NATIVE_CHAR             *statements,
161         acpi_parse_object       *op);
162
163 void
164 acpi_db_dump_namespace (
165         NATIVE_CHAR             *start_arg,
166         NATIVE_CHAR             *depth_arg);
167
168 void
169 acpi_db_dump_namespace_by_owner (
170         NATIVE_CHAR             *owner_arg,
171         NATIVE_CHAR             *depth_arg);
172
173 void
174 acpi_db_send_notify (
175         NATIVE_CHAR             *name,
176         u32                     value);
177
178 void
179 acpi_db_set_method_data (
180         NATIVE_CHAR             *type_arg,
181         NATIVE_CHAR             *index_arg,
182         NATIVE_CHAR             *value_arg);
183
184 acpi_status
185 acpi_db_display_objects (
186         NATIVE_CHAR             *obj_type_arg,
187         NATIVE_CHAR             *display_count_arg);
188
189 acpi_status
190 acpi_db_find_name_in_namespace (
191         NATIVE_CHAR             *name_arg);
192
193 void
194 acpi_db_set_scope (
195         NATIVE_CHAR             *name);
196
197 void
198 acpi_db_find_references (
199         NATIVE_CHAR             *object_arg);
200
201 void
202 acpi_db_display_locks (void);
203
204
205 void
206 acpi_db_display_resources (
207         NATIVE_CHAR             *object_arg);
208
209
210 /*
211  * dbdisasm - AML disassembler
212  */
213
214 void
215 acpi_db_display_op (
216         acpi_walk_state         *walk_state,
217         acpi_parse_object       *origin,
218         u32                     num_opcodes);
219
220 void
221 acpi_db_display_namestring (
222         NATIVE_CHAR             *name);
223
224 void
225 acpi_db_display_path (
226         acpi_parse_object       *op);
227
228 void
229 acpi_db_display_opcode (
230         acpi_walk_state         *walk_state,
231         acpi_parse_object       *op);
232
233 void
234 acpi_db_decode_internal_object (
235         acpi_operand_object     *obj_desc);
236
237
238 /*
239  * dbdisply - debug display commands
240  */
241
242
243 void
244 acpi_db_display_method_info (
245         acpi_parse_object       *op);
246
247 void
248 acpi_db_decode_and_display_object (
249         NATIVE_CHAR             *target,
250         NATIVE_CHAR             *output_type);
251
252 void
253 acpi_db_display_result_object (
254         acpi_operand_object     *obj_desc,
255         acpi_walk_state         *walk_state);
256
257 acpi_status
258 acpi_db_display_all_methods (
259         NATIVE_CHAR             *display_count_arg);
260
261 void
262 acpi_db_display_internal_object (
263         acpi_operand_object     *obj_desc,
264         acpi_walk_state         *walk_state);
265
266 void
267 acpi_db_display_arguments (
268         void);
269
270 void
271 acpi_db_display_locals (
272         void);
273
274 void
275 acpi_db_display_results (
276         void);
277
278 void
279 acpi_db_display_calling_tree (
280         void);
281
282 void
283 acpi_db_display_argument_object (
284         acpi_operand_object     *obj_desc,
285         acpi_walk_state         *walk_state);
286
287
288 /*
289  * dbexec - debugger control method execution
290  */
291
292 void
293 acpi_db_execute (
294         NATIVE_CHAR             *name,
295         NATIVE_CHAR             **args,
296         u32                     flags);
297
298 void
299 acpi_db_create_execution_threads (
300         NATIVE_CHAR             *num_threads_arg,
301         NATIVE_CHAR             *num_loops_arg,
302         NATIVE_CHAR             *method_name_arg);
303
304
305 /*
306  * dbfileio - Debugger file I/O commands
307  */
308
309 acpi_object_type8
310 acpi_db_match_argument (
311         NATIVE_CHAR             *user_argument,
312         ARGUMENT_INFO           *arguments);
313
314
315 void
316 acpi_db_close_debug_file (
317         void);
318
319 void
320 acpi_db_open_debug_file (
321         NATIVE_CHAR             *name);
322
323 acpi_status
324 acpi_db_load_acpi_table (
325         NATIVE_CHAR             *filename);
326
327
328 /*
329  * dbhistry - debugger HISTORY command
330  */
331
332 void
333 acpi_db_add_to_history (
334         NATIVE_CHAR             *command_line);
335
336 void
337 acpi_db_display_history (void);
338
339 NATIVE_CHAR *
340 acpi_db_get_from_history (
341         NATIVE_CHAR             *command_num_arg);
342
343
344 /*
345  * dbinput - user front-end to the AML debugger
346  */
347
348 acpi_status
349 acpi_db_command_dispatch (
350         NATIVE_CHAR             *input_buffer,
351         acpi_walk_state         *walk_state,
352         acpi_parse_object       *op);
353
354 void
355 acpi_db_execute_thread (
356         void                    *context);
357
358 acpi_status
359 acpi_db_user_commands (
360         NATIVE_CHAR             prompt,
361         acpi_parse_object       *op);
362
363
364 /*
365  * dbstats - Generation and display of ACPI table statistics
366  */
367
368 void
369 acpi_db_generate_statistics (
370         acpi_parse_object       *root,
371         u8                      is_method);
372
373
374 acpi_status
375 acpi_db_display_statistics (
376         NATIVE_CHAR             *type_arg);
377
378
379 /*
380  * dbutils - AML debugger utilities
381  */
382
383 void
384 acpi_db_set_output_destination (
385         u32                     where);
386
387 void
388 acpi_db_dump_buffer (
389         u32                     address);
390
391 void
392 acpi_db_dump_object (
393         acpi_object             *obj_desc,
394         u32                     level);
395
396 void
397 acpi_db_prep_namestring (
398         NATIVE_CHAR             *name);
399
400
401 acpi_status
402 acpi_db_second_pass_parse (
403         acpi_parse_object       *root);
404
405 acpi_namespace_node *
406 acpi_db_local_ns_lookup (
407         NATIVE_CHAR             *name);
408
409
410 #endif  /* __ACDEBUG_H__ */