File: /usr/src/linux/drivers/acpi/include/acdebug.h

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