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