Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
| 50 | struct command_info |
| 51 | { |
| 52 | char *name; /* Command Name */ |
| 53 | u8 min_args; /* Minimum arguments required */ |
| 54 | }; |
| 55 | |
| 56 | |
| 57 | struct 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 | |
| 81 | acpi_status |
| 82 | acpi_db_initialize ( |
| 83 | void); |
| 84 | |
| 85 | void |
| 86 | acpi_db_terminate ( |
| 87 | void); |
| 88 | |
| 89 | acpi_status |
| 90 | acpi_db_single_step ( |
| 91 | struct acpi_walk_state *walk_state, |
| 92 | union acpi_parse_object *op, |
| 93 | u32 op_type); |
| 94 | |
| 95 | acpi_status |
| 96 | acpi_db_start_command ( |
| 97 | struct acpi_walk_state *walk_state, |
| 98 | union acpi_parse_object *op); |
| 99 | |
| 100 | void |
| 101 | acpi_db_method_end ( |
| 102 | struct acpi_walk_state *walk_state); |
| 103 | |
| 104 | |
| 105 | /* |
| 106 | * dbcmds - debug commands and output routines |
| 107 | */ |
| 108 | |
| 109 | acpi_status |
| 110 | acpi_db_disassemble_method ( |
| 111 | char *name); |
| 112 | |
| 113 | void |
| 114 | acpi_db_display_table_info ( |
| 115 | char *table_arg); |
| 116 | |
| 117 | void |
| 118 | acpi_db_unload_acpi_table ( |
| 119 | char *table_arg, |
| 120 | char *instance_arg); |
| 121 | |
| 122 | void |
| 123 | acpi_db_set_method_breakpoint ( |
| 124 | char *location, |
| 125 | struct acpi_walk_state *walk_state, |
| 126 | union acpi_parse_object *op); |
| 127 | |
| 128 | void |
| 129 | acpi_db_set_method_call_breakpoint ( |
| 130 | union acpi_parse_object *op); |
| 131 | |
| 132 | void |
| 133 | acpi_db_disassemble_aml ( |
| 134 | char *statements, |
| 135 | union acpi_parse_object *op); |
| 136 | |
| 137 | void |
| 138 | acpi_db_dump_namespace ( |
| 139 | char *start_arg, |
| 140 | char *depth_arg); |
| 141 | |
| 142 | void |
| 143 | acpi_db_dump_namespace_by_owner ( |
| 144 | char *owner_arg, |
| 145 | char *depth_arg); |
| 146 | |
| 147 | void |
| 148 | acpi_db_send_notify ( |
| 149 | char *name, |
| 150 | u32 value); |
| 151 | |
| 152 | void |
| 153 | acpi_db_set_method_data ( |
| 154 | char *type_arg, |
| 155 | char *index_arg, |
| 156 | char *value_arg); |
| 157 | |
| 158 | acpi_status |
| 159 | acpi_db_display_objects ( |
| 160 | char *obj_type_arg, |
| 161 | char *display_count_arg); |
| 162 | |
| 163 | acpi_status |
| 164 | acpi_db_find_name_in_namespace ( |
| 165 | char *name_arg); |
| 166 | |
| 167 | void |
| 168 | acpi_db_set_scope ( |
| 169 | char *name); |
| 170 | |
| 171 | acpi_status |
| 172 | acpi_db_sleep ( |
| 173 | char *object_arg); |
| 174 | |
| 175 | void |
| 176 | acpi_db_find_references ( |
| 177 | char *object_arg); |
| 178 | |
| 179 | void |
| 180 | acpi_db_display_locks (void); |
| 181 | |
| 182 | |
| 183 | void |
| 184 | acpi_db_display_resources ( |
| 185 | char *object_arg); |
| 186 | |
| 187 | void |
| 188 | acpi_db_display_gpes (void); |
| 189 | |
| 190 | void |
| 191 | acpi_db_check_integrity ( |
| 192 | void); |
| 193 | |
| 194 | acpi_status |
| 195 | acpi_db_integrity_walk ( |
| 196 | acpi_handle obj_handle, |
| 197 | u32 nesting_level, |
| 198 | void *context, |
| 199 | void **return_value); |
| 200 | |
| 201 | acpi_status |
| 202 | acpi_db_walk_and_match_name ( |
| 203 | acpi_handle obj_handle, |
| 204 | u32 nesting_level, |
| 205 | void *context, |
| 206 | void **return_value); |
| 207 | |
| 208 | acpi_status |
| 209 | acpi_db_walk_for_references ( |
| 210 | acpi_handle obj_handle, |
| 211 | u32 nesting_level, |
| 212 | void *context, |
| 213 | void **return_value); |
| 214 | |
| 215 | acpi_status |
| 216 | acpi_db_walk_for_specific_objects ( |
| 217 | acpi_handle obj_handle, |
| 218 | u32 nesting_level, |
| 219 | void *context, |
| 220 | void **return_value); |
| 221 | |
| 222 | void |
| 223 | acpi_db_generate_gpe ( |
| 224 | char *gpe_arg, |
| 225 | char *block_arg); |
| 226 | |
| 227 | /* |
| 228 | * dbdisply - debug display commands |
| 229 | */ |
| 230 | |
| 231 | void |
| 232 | acpi_db_display_method_info ( |
| 233 | union acpi_parse_object *op); |
| 234 | |
| 235 | void |
| 236 | acpi_db_decode_and_display_object ( |
| 237 | char *target, |
| 238 | char *output_type); |
| 239 | |
| 240 | void |
| 241 | acpi_db_display_result_object ( |
| 242 | union acpi_operand_object *obj_desc, |
| 243 | struct acpi_walk_state *walk_state); |
| 244 | |
| 245 | acpi_status |
| 246 | acpi_db_display_all_methods ( |
| 247 | char *display_count_arg); |
| 248 | |
| 249 | void |
| 250 | acpi_db_display_arguments ( |
| 251 | void); |
| 252 | |
| 253 | void |
| 254 | acpi_db_display_locals ( |
| 255 | void); |
| 256 | |
| 257 | void |
| 258 | acpi_db_display_results ( |
| 259 | void); |
| 260 | |
| 261 | void |
| 262 | acpi_db_display_calling_tree ( |
| 263 | void); |
| 264 | |
| 265 | void |
| 266 | acpi_db_display_object_type ( |
| 267 | char *object_arg); |
| 268 | |
| 269 | void |
| 270 | acpi_db_display_argument_object ( |
| 271 | union acpi_operand_object *obj_desc, |
| 272 | struct acpi_walk_state *walk_state); |
| 273 | |
| 274 | void |
| 275 | acpi_db_dump_parser_descriptor ( |
| 276 | union acpi_parse_object *op); |
| 277 | |
| 278 | void * |
| 279 | acpi_db_get_pointer ( |
| 280 | void *target); |
| 281 | |
| 282 | |
| 283 | /* |
| 284 | * dbexec - debugger control method execution |
| 285 | */ |
| 286 | |
| 287 | void |
| 288 | acpi_db_execute ( |
| 289 | char *name, |
| 290 | char **args, |
| 291 | u32 flags); |
| 292 | |
| 293 | void |
| 294 | acpi_db_create_execution_threads ( |
| 295 | char *num_threads_arg, |
| 296 | char *num_loops_arg, |
| 297 | char *method_name_arg); |
| 298 | |
| 299 | acpi_status |
| 300 | acpi_db_execute_method ( |
| 301 | struct acpi_db_method_info *info, |
| 302 | struct acpi_buffer *return_obj); |
| 303 | |
| 304 | void |
| 305 | acpi_db_execute_setup ( |
| 306 | struct acpi_db_method_info *info); |
| 307 | |
| 308 | u32 |
| 309 | acpi_db_get_outstanding_allocations ( |
| 310 | void); |
| 311 | |
| 312 | void ACPI_SYSTEM_XFACE |
| 313 | acpi_db_method_thread ( |
| 314 | void *context); |
| 315 | |
| 316 | acpi_status |
| 317 | acpi_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 | |
| 328 | acpi_object_type |
| 329 | acpi_db_match_argument ( |
| 330 | char *user_argument, |
| 331 | struct argument_info *arguments); |
| 332 | |
| 333 | acpi_status |
| 334 | ae_local_load_table ( |
| 335 | struct acpi_table_header *table_ptr); |
| 336 | |
| 337 | void |
| 338 | acpi_db_close_debug_file ( |
| 339 | void); |
| 340 | |
| 341 | void |
| 342 | acpi_db_open_debug_file ( |
| 343 | char *name); |
| 344 | |
| 345 | acpi_status |
| 346 | acpi_db_load_acpi_table ( |
| 347 | char *filename); |
| 348 | |
| 349 | acpi_status |
| 350 | acpi_db_get_table_from_file ( |
| 351 | char *filename, |
| 352 | struct acpi_table_header **table); |
| 353 | |
| 354 | acpi_status |
| 355 | acpi_db_read_table_from_file ( |
| 356 | char *filename, |
| 357 | struct acpi_table_header **table); |
| 358 | |
| 359 | /* |
| 360 | * dbhistry - debugger HISTORY command |
| 361 | */ |
| 362 | |
| 363 | void |
| 364 | acpi_db_add_to_history ( |
| 365 | char *command_line); |
| 366 | |
| 367 | void |
| 368 | acpi_db_display_history (void); |
| 369 | |
| 370 | char * |
| 371 | acpi_db_get_from_history ( |
| 372 | char *command_num_arg); |
| 373 | |
| 374 | |
| 375 | /* |
| 376 | * dbinput - user front-end to the AML debugger |
| 377 | */ |
| 378 | |
| 379 | acpi_status |
| 380 | acpi_db_command_dispatch ( |
| 381 | char *input_buffer, |
| 382 | struct acpi_walk_state *walk_state, |
| 383 | union acpi_parse_object *op); |
| 384 | |
| 385 | void ACPI_SYSTEM_XFACE |
| 386 | acpi_db_execute_thread ( |
| 387 | void *context); |
| 388 | |
| 389 | void |
| 390 | acpi_db_display_help ( |
| 391 | char *help_type); |
| 392 | |
| 393 | char * |
| 394 | acpi_db_get_next_token ( |
| 395 | char *string, |
| 396 | char **next); |
| 397 | |
| 398 | u32 |
| 399 | acpi_db_get_line ( |
| 400 | char *input_buffer); |
| 401 | |
| 402 | u32 |
| 403 | acpi_db_match_command ( |
| 404 | char *user_command); |
| 405 | |
| 406 | void |
| 407 | acpi_db_single_thread ( |
| 408 | void); |
| 409 | |
| 410 | |
| 411 | /* |
| 412 | * dbstats - Generation and display of ACPI table statistics |
| 413 | */ |
| 414 | |
| 415 | void |
| 416 | acpi_db_generate_statistics ( |
| 417 | union acpi_parse_object *root, |
| 418 | u8 is_method); |
| 419 | |
| 420 | |
| 421 | acpi_status |
| 422 | acpi_db_display_statistics ( |
| 423 | char *type_arg); |
| 424 | |
| 425 | acpi_status |
| 426 | acpi_db_classify_one_object ( |
| 427 | acpi_handle obj_handle, |
| 428 | u32 nesting_level, |
| 429 | void *context, |
| 430 | void **return_value); |
| 431 | |
| 432 | void |
| 433 | acpi_db_count_namespace_objects ( |
| 434 | void); |
| 435 | |
| 436 | void |
| 437 | acpi_db_enumerate_object ( |
| 438 | union acpi_operand_object *obj_desc); |
| 439 | |
| 440 | |
| 441 | /* |
| 442 | * dbutils - AML debugger utilities |
| 443 | */ |
| 444 | |
| 445 | void |
| 446 | acpi_db_set_output_destination ( |
| 447 | u32 where); |
| 448 | |
| 449 | void |
| 450 | acpi_db_dump_buffer ( |
| 451 | u32 address); |
| 452 | |
| 453 | void |
| 454 | acpi_db_dump_object ( |
| 455 | union acpi_object *obj_desc, |
| 456 | u32 level); |
| 457 | |
| 458 | void |
| 459 | acpi_db_prep_namestring ( |
| 460 | char *name); |
| 461 | |
| 462 | |
| 463 | acpi_status |
| 464 | acpi_db_second_pass_parse ( |
| 465 | union acpi_parse_object *root); |
| 466 | |
| 467 | struct acpi_namespace_node * |
| 468 | acpi_db_local_ns_lookup ( |
| 469 | char *name); |
| 470 | |
| 471 | |
| 472 | #endif /* __ACDEBUG_H__ */ |