at v2.6.12 472 lines 11 kB view raw
1/****************************************************************************** 2 * 3 * Name: acdebug.h - ACPI/AML debugger 4 * 5 *****************************************************************************/ 6 7/* 8 * Copyright (C) 2000 - 2005, R. Byron Moore 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 * substantially similar to the "NO WARRANTY" disclaimer below 19 * ("Disclaimer") and any redistribution must be conditioned upon 20 * including a substantially similar Disclaimer requirement for further 21 * binary redistribution. 22 * 3. Neither the names of the above-listed copyright holders nor the names 23 * of any contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * Alternatively, this software may be distributed under the terms of the 27 * GNU General Public License ("GPL") version 2 as published by the Free 28 * Software Foundation. 29 * 30 * NO WARRANTY 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44#ifndef __ACDEBUG_H__ 45#define __ACDEBUG_H__ 46 47 48#define ACPI_DEBUG_BUFFER_SIZE 4196 49 50struct command_info 51{ 52 char *name; /* Command Name */ 53 u8 min_args; /* Minimum arguments required */ 54}; 55 56 57struct argument_info 58{ 59 char *name; /* Argument Name */ 60}; 61 62 63#define PARAM_LIST(pl) pl 64 65#define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose) 66 67#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ 68 acpi_os_printf PARAM_LIST(fp);} 69 70#define EX_NO_SINGLE_STEP 1 71#define EX_SINGLE_STEP 2 72 73 74/* Prototypes */ 75 76 77/* 78 * dbxface - external debugger interfaces 79 */ 80 81acpi_status 82acpi_db_initialize ( 83 void); 84 85void 86acpi_db_terminate ( 87 void); 88 89acpi_status 90acpi_db_single_step ( 91 struct acpi_walk_state *walk_state, 92 union acpi_parse_object *op, 93 u32 op_type); 94 95acpi_status 96acpi_db_start_command ( 97 struct acpi_walk_state *walk_state, 98 union acpi_parse_object *op); 99 100void 101acpi_db_method_end ( 102 struct acpi_walk_state *walk_state); 103 104 105/* 106 * dbcmds - debug commands and output routines 107 */ 108 109acpi_status 110acpi_db_disassemble_method ( 111 char *name); 112 113void 114acpi_db_display_table_info ( 115 char *table_arg); 116 117void 118acpi_db_unload_acpi_table ( 119 char *table_arg, 120 char *instance_arg); 121 122void 123acpi_db_set_method_breakpoint ( 124 char *location, 125 struct acpi_walk_state *walk_state, 126 union acpi_parse_object *op); 127 128void 129acpi_db_set_method_call_breakpoint ( 130 union acpi_parse_object *op); 131 132void 133acpi_db_disassemble_aml ( 134 char *statements, 135 union acpi_parse_object *op); 136 137void 138acpi_db_dump_namespace ( 139 char *start_arg, 140 char *depth_arg); 141 142void 143acpi_db_dump_namespace_by_owner ( 144 char *owner_arg, 145 char *depth_arg); 146 147void 148acpi_db_send_notify ( 149 char *name, 150 u32 value); 151 152void 153acpi_db_set_method_data ( 154 char *type_arg, 155 char *index_arg, 156 char *value_arg); 157 158acpi_status 159acpi_db_display_objects ( 160 char *obj_type_arg, 161 char *display_count_arg); 162 163acpi_status 164acpi_db_find_name_in_namespace ( 165 char *name_arg); 166 167void 168acpi_db_set_scope ( 169 char *name); 170 171acpi_status 172acpi_db_sleep ( 173 char *object_arg); 174 175void 176acpi_db_find_references ( 177 char *object_arg); 178 179void 180acpi_db_display_locks (void); 181 182 183void 184acpi_db_display_resources ( 185 char *object_arg); 186 187void 188acpi_db_display_gpes (void); 189 190void 191acpi_db_check_integrity ( 192 void); 193 194acpi_status 195acpi_db_integrity_walk ( 196 acpi_handle obj_handle, 197 u32 nesting_level, 198 void *context, 199 void **return_value); 200 201acpi_status 202acpi_db_walk_and_match_name ( 203 acpi_handle obj_handle, 204 u32 nesting_level, 205 void *context, 206 void **return_value); 207 208acpi_status 209acpi_db_walk_for_references ( 210 acpi_handle obj_handle, 211 u32 nesting_level, 212 void *context, 213 void **return_value); 214 215acpi_status 216acpi_db_walk_for_specific_objects ( 217 acpi_handle obj_handle, 218 u32 nesting_level, 219 void *context, 220 void **return_value); 221 222void 223acpi_db_generate_gpe ( 224 char *gpe_arg, 225 char *block_arg); 226 227/* 228 * dbdisply - debug display commands 229 */ 230 231void 232acpi_db_display_method_info ( 233 union acpi_parse_object *op); 234 235void 236acpi_db_decode_and_display_object ( 237 char *target, 238 char *output_type); 239 240void 241acpi_db_display_result_object ( 242 union acpi_operand_object *obj_desc, 243 struct acpi_walk_state *walk_state); 244 245acpi_status 246acpi_db_display_all_methods ( 247 char *display_count_arg); 248 249void 250acpi_db_display_arguments ( 251 void); 252 253void 254acpi_db_display_locals ( 255 void); 256 257void 258acpi_db_display_results ( 259 void); 260 261void 262acpi_db_display_calling_tree ( 263 void); 264 265void 266acpi_db_display_object_type ( 267 char *object_arg); 268 269void 270acpi_db_display_argument_object ( 271 union acpi_operand_object *obj_desc, 272 struct acpi_walk_state *walk_state); 273 274void 275acpi_db_dump_parser_descriptor ( 276 union acpi_parse_object *op); 277 278void * 279acpi_db_get_pointer ( 280 void *target); 281 282 283/* 284 * dbexec - debugger control method execution 285 */ 286 287void 288acpi_db_execute ( 289 char *name, 290 char **args, 291 u32 flags); 292 293void 294acpi_db_create_execution_threads ( 295 char *num_threads_arg, 296 char *num_loops_arg, 297 char *method_name_arg); 298 299acpi_status 300acpi_db_execute_method ( 301 struct acpi_db_method_info *info, 302 struct acpi_buffer *return_obj); 303 304void 305acpi_db_execute_setup ( 306 struct acpi_db_method_info *info); 307 308u32 309acpi_db_get_outstanding_allocations ( 310 void); 311 312void ACPI_SYSTEM_XFACE 313acpi_db_method_thread ( 314 void *context); 315 316acpi_status 317acpi_db_execution_walk ( 318 acpi_handle obj_handle, 319 u32 nesting_level, 320 void *context, 321 void **return_value); 322 323 324/* 325 * dbfileio - Debugger file I/O commands 326 */ 327 328acpi_object_type 329acpi_db_match_argument ( 330 char *user_argument, 331 struct argument_info *arguments); 332 333acpi_status 334ae_local_load_table ( 335 struct acpi_table_header *table_ptr); 336 337void 338acpi_db_close_debug_file ( 339 void); 340 341void 342acpi_db_open_debug_file ( 343 char *name); 344 345acpi_status 346acpi_db_load_acpi_table ( 347 char *filename); 348 349acpi_status 350acpi_db_get_table_from_file ( 351 char *filename, 352 struct acpi_table_header **table); 353 354acpi_status 355acpi_db_read_table_from_file ( 356 char *filename, 357 struct acpi_table_header **table); 358 359/* 360 * dbhistry - debugger HISTORY command 361 */ 362 363void 364acpi_db_add_to_history ( 365 char *command_line); 366 367void 368acpi_db_display_history (void); 369 370char * 371acpi_db_get_from_history ( 372 char *command_num_arg); 373 374 375/* 376 * dbinput - user front-end to the AML debugger 377 */ 378 379acpi_status 380acpi_db_command_dispatch ( 381 char *input_buffer, 382 struct acpi_walk_state *walk_state, 383 union acpi_parse_object *op); 384 385void ACPI_SYSTEM_XFACE 386acpi_db_execute_thread ( 387 void *context); 388 389void 390acpi_db_display_help ( 391 char *help_type); 392 393char * 394acpi_db_get_next_token ( 395 char *string, 396 char **next); 397 398u32 399acpi_db_get_line ( 400 char *input_buffer); 401 402u32 403acpi_db_match_command ( 404 char *user_command); 405 406void 407acpi_db_single_thread ( 408 void); 409 410 411/* 412 * dbstats - Generation and display of ACPI table statistics 413 */ 414 415void 416acpi_db_generate_statistics ( 417 union acpi_parse_object *root, 418 u8 is_method); 419 420 421acpi_status 422acpi_db_display_statistics ( 423 char *type_arg); 424 425acpi_status 426acpi_db_classify_one_object ( 427 acpi_handle obj_handle, 428 u32 nesting_level, 429 void *context, 430 void **return_value); 431 432void 433acpi_db_count_namespace_objects ( 434 void); 435 436void 437acpi_db_enumerate_object ( 438 union acpi_operand_object *obj_desc); 439 440 441/* 442 * dbutils - AML debugger utilities 443 */ 444 445void 446acpi_db_set_output_destination ( 447 u32 where); 448 449void 450acpi_db_dump_buffer ( 451 u32 address); 452 453void 454acpi_db_dump_object ( 455 union acpi_object *obj_desc, 456 u32 level); 457 458void 459acpi_db_prep_namestring ( 460 char *name); 461 462 463acpi_status 464acpi_db_second_pass_parse ( 465 union acpi_parse_object *root); 466 467struct acpi_namespace_node * 468acpi_db_local_ns_lookup ( 469 char *name); 470 471 472#endif /* __ACDEBUG_H__ */