Erik Schmauss | 9585763 | 2018-03-14 16:13:07 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /****************************************************************************** |
| 3 | * |
| 4 | * Name: acdebug.h - ACPI/AML debugger |
| 5 | * |
Bob Moore | da6f832 | 2018-01-04 10:06:38 -0800 | [diff] [blame] | 6 | * Copyright (C) 2000 - 2018, Intel Corp. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * |
Erik Schmauss | 9585763 | 2018-03-14 16:13:07 -0700 | [diff] [blame] | 8 | *****************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
| 10 | #ifndef __ACDEBUG_H__ |
| 11 | #define __ACDEBUG_H__ |
| 12 | |
Bob Moore | 9355611 | 2015-10-19 10:24:26 +0800 | [diff] [blame] | 13 | /* The debugger is used in conjunction with the disassembler most of time */ |
| 14 | |
| 15 | #ifdef ACPI_DISASSEMBLER |
| 16 | #include "acdisasm.h" |
| 17 | #endif |
| 18 | |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 19 | #define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 21 | struct acpi_db_command_info { |
Bob Moore | 0dfaaa3 | 2016-03-24 09:40:40 +0800 | [diff] [blame] | 22 | const char *name; /* Command Name */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 23 | u8 min_args; /* Minimum arguments required */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | }; |
| 25 | |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 26 | struct acpi_db_command_help { |
| 27 | u8 line_count; /* Number of help lines */ |
| 28 | char *invocation; /* Command Invocation */ |
| 29 | char *description; /* Command Description */ |
| 30 | }; |
| 31 | |
| 32 | struct acpi_db_argument_info { |
Bob Moore | 0dfaaa3 | 2016-03-24 09:40:40 +0800 | [diff] [blame] | 33 | const char *name; /* Argument Name */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | }; |
| 35 | |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 36 | struct acpi_db_execute_walk { |
| 37 | u32 count; |
| 38 | u32 max_count; |
| 39 | }; |
| 40 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | #define PARAM_LIST(pl) pl |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | |
| 43 | #define EX_NO_SINGLE_STEP 1 |
| 44 | #define EX_SINGLE_STEP 2 |
| 45 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | /* |
| 47 | * dbxface - external debugger interfaces |
| 48 | */ |
Lv Zheng | 8a2a250 | 2015-12-03 10:42:53 +0800 | [diff] [blame] | 49 | ACPI_DBR_DEPENDENT_RETURN_OK(acpi_status |
| 50 | acpi_db_single_step(struct acpi_walk_state |
| 51 | *walk_state, |
| 52 | union acpi_parse_object *op, |
| 53 | u32 op_type)) |
| 54 | ACPI_DBR_DEPENDENT_RETURN_VOID(void |
| 55 | acpi_db_signal_break_point(struct |
| 56 | acpi_walk_state |
| 57 | *walk_state)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
| 59 | /* |
| 60 | * dbcmds - debug commands and output routines |
| 61 | */ |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 62 | struct acpi_namespace_node *acpi_db_convert_to_node(char *in_string); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 63 | |
| 64 | void acpi_db_display_table_info(char *table_arg); |
| 65 | |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 66 | void acpi_db_display_template(char *buffer_arg); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 68 | void acpi_db_unload_acpi_table(char *name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 70 | void acpi_db_send_notify(char *name, u32 value); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | |
Lin Ming | b0ed7a9 | 2010-08-06 09:35:51 +0800 | [diff] [blame] | 72 | void acpi_db_display_interfaces(char *action_arg, char *interface_name_arg); |
| 73 | |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 74 | acpi_status acpi_db_sleep(char *object_arg); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | |
Lv Zheng | ab6c573 | 2015-07-23 12:52:59 +0800 | [diff] [blame] | 76 | void acpi_db_trace(char *enable_arg, char *method_arg, char *once_arg); |
| 77 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 78 | void acpi_db_display_locks(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 80 | void acpi_db_display_resources(char *object_arg); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 82 | ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_display_gpes(void)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 84 | void acpi_db_display_handlers(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | |
Bob Moore | 33620c5 | 2012-02-14 18:14:27 +0800 | [diff] [blame] | 86 | ACPI_HW_DEPENDENT_RETURN_VOID(void |
| 87 | acpi_db_generate_gpe(char *gpe_arg, |
| 88 | char *block_arg)) |
Lv Zheng | cd27d79 | 2013-10-29 09:30:22 +0800 | [diff] [blame] | 89 | ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_generate_sci(void)) |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 90 | |
Bob Moore | eb60c4d | 2014-02-08 09:42:39 +0800 | [diff] [blame] | 91 | void acpi_db_execute_test(char *type_arg); |
| 92 | |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 93 | /* |
Bob Moore | 42f8fb7 | 2013-01-11 13:08:51 +0100 | [diff] [blame] | 94 | * dbconvert - miscellaneous conversion routines |
| 95 | */ |
Lv Zheng | a2fd4b4 | 2013-09-23 09:52:05 +0800 | [diff] [blame] | 96 | acpi_status acpi_db_hex_char_to_value(int hex_char, u8 *return_value); |
Bob Moore | 42f8fb7 | 2013-01-11 13:08:51 +0100 | [diff] [blame] | 97 | |
| 98 | acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object); |
| 99 | |
| 100 | acpi_status |
| 101 | acpi_db_convert_to_object(acpi_object_type type, |
| 102 | char *string, union acpi_object *object); |
| 103 | |
| 104 | u8 *acpi_db_encode_pld_buffer(struct acpi_pld_info *pld_info); |
| 105 | |
| 106 | void acpi_db_dump_pld_buffer(union acpi_object *obj_desc); |
| 107 | |
| 108 | /* |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 109 | * dbmethod - control method commands |
| 110 | */ |
| 111 | void |
| 112 | acpi_db_set_method_breakpoint(char *location, |
| 113 | struct acpi_walk_state *walk_state, |
| 114 | union acpi_parse_object *op); |
| 115 | |
| 116 | void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op); |
| 117 | |
| 118 | void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg); |
| 119 | |
| 120 | acpi_status acpi_db_disassemble_method(char *name); |
| 121 | |
| 122 | void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op); |
| 123 | |
Bob Moore | 60361b7 | 2016-09-07 14:05:41 +0800 | [diff] [blame] | 124 | void acpi_db_evaluate_predefined_names(void); |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 125 | |
| 126 | /* |
| 127 | * dbnames - namespace commands |
| 128 | */ |
| 129 | void acpi_db_set_scope(char *name); |
| 130 | |
| 131 | void acpi_db_dump_namespace(char *start_arg, char *depth_arg); |
| 132 | |
Bob Moore | 424deb3 | 2013-09-23 09:52:19 +0800 | [diff] [blame] | 133 | void acpi_db_dump_namespace_paths(void); |
| 134 | |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 135 | void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg); |
| 136 | |
| 137 | acpi_status acpi_db_find_name_in_namespace(char *name_arg); |
| 138 | |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 139 | void acpi_db_check_predefined_names(void); |
| 140 | |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 141 | acpi_status |
| 142 | acpi_db_display_objects(char *obj_type_arg, char *display_count_arg); |
| 143 | |
| 144 | void acpi_db_check_integrity(void); |
| 145 | |
| 146 | void acpi_db_find_references(char *object_arg); |
| 147 | |
| 148 | void acpi_db_get_bus_info(void); |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 149 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | /* |
| 151 | * dbdisply - debug display commands |
| 152 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 153 | void acpi_db_display_method_info(union acpi_parse_object *op); |
| 154 | |
| 155 | void acpi_db_decode_and_display_object(char *target, char *output_type); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | |
Lv Zheng | 8a2a250 | 2015-12-03 10:42:53 +0800 | [diff] [blame] | 157 | ACPI_DBR_DEPENDENT_RETURN_VOID(void |
| 158 | acpi_db_display_result_object(union |
| 159 | acpi_operand_object |
| 160 | *obj_desc, |
| 161 | struct |
| 162 | acpi_walk_state |
| 163 | *walk_state)) |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 164 | |
Lv Zheng | f5c1e1c | 2016-05-05 12:57:53 +0800 | [diff] [blame] | 165 | acpi_status acpi_db_display_all_methods(char *display_count_arg); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 166 | |
| 167 | void acpi_db_display_arguments(void); |
| 168 | |
| 169 | void acpi_db_display_locals(void); |
| 170 | |
| 171 | void acpi_db_display_results(void); |
| 172 | |
| 173 | void acpi_db_display_calling_tree(void); |
| 174 | |
| 175 | void acpi_db_display_object_type(char *object_arg); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | |
Lv Zheng | 8a2a250 | 2015-12-03 10:42:53 +0800 | [diff] [blame] | 177 | ACPI_DBR_DEPENDENT_RETURN_VOID(void |
| 178 | acpi_db_display_argument_object(union |
| 179 | acpi_operand_object |
| 180 | *obj_desc, |
| 181 | struct |
| 182 | acpi_walk_state |
| 183 | *walk_state)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | |
| 185 | /* |
| 186 | * dbexec - debugger control method execution |
| 187 | */ |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 188 | void |
Lv Zheng | f5c1e1c | 2016-05-05 12:57:53 +0800 | [diff] [blame] | 189 | acpi_db_execute(char *name, char **args, acpi_object_type *types, u32 flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | |
| 191 | void |
Bob Moore | 060c859 | 2017-11-17 15:42:26 -0800 | [diff] [blame] | 192 | acpi_db_create_execution_thread(char *method_name_arg, |
| 193 | char **arguments, acpi_object_type *types); |
| 194 | |
| 195 | void |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 196 | acpi_db_create_execution_threads(char *num_threads_arg, |
| 197 | char *num_loops_arg, char *method_name_arg); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | |
Bob Moore | 42f8fb7 | 2013-01-11 13:08:51 +0100 | [diff] [blame] | 199 | void acpi_db_delete_objects(u32 count, union acpi_object *objects); |
| 200 | |
Valery A. Podrezov | afbb9e6 | 2007-02-02 19:48:23 +0300 | [diff] [blame] | 201 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
| 202 | u32 acpi_db_get_cache_info(struct acpi_memory_list *cache); |
| 203 | #endif |
| 204 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | /* |
| 206 | * dbfileio - Debugger file I/O commands |
| 207 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | acpi_object_type |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 209 | acpi_db_match_argument(char *user_argument, |
| 210 | struct acpi_db_argument_info *arguments); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 212 | void acpi_db_close_debug_file(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 214 | void acpi_db_open_debug_file(char *name); |
| 215 | |
| 216 | acpi_status acpi_db_load_acpi_table(char *filename); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | |
Bob Moore | 2ba7379 | 2015-12-29 13:54:58 +0800 | [diff] [blame] | 218 | acpi_status acpi_db_load_tables(struct acpi_new_table_desc *list_head); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | /* |
| 221 | * dbhistry - debugger HISTORY command |
| 222 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 223 | void acpi_db_add_to_history(char *command_line); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 225 | void acpi_db_display_history(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 227 | char *acpi_db_get_from_history(char *command_num_arg); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | |
Bob Moore | 1d98e9e | 2013-10-29 09:29:09 +0800 | [diff] [blame] | 229 | char *acpi_db_get_history_by_index(u32 commandd_num); |
| 230 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | /* |
| 232 | * dbinput - user front-end to the AML debugger |
| 233 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 235 | acpi_db_command_dispatch(char *input_buffer, |
| 236 | struct acpi_walk_state *walk_state, |
| 237 | union acpi_parse_object *op); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 239 | void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | |
Lv Zheng | f8d3148 | 2015-12-03 10:42:46 +0800 | [diff] [blame] | 241 | acpi_status acpi_db_user_commands(void); |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 242 | |
| 243 | char *acpi_db_get_next_token(char *string, |
Lv Zheng | f5c1e1c | 2016-05-05 12:57:53 +0800 | [diff] [blame] | 244 | char **next, acpi_object_type *return_type); |
Lv Zheng | f540fad | 2012-10-31 02:25:15 +0000 | [diff] [blame] | 245 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | /* |
Lv Zheng | fdd8d83 | 2015-07-23 12:54:17 +0800 | [diff] [blame] | 247 | * dbobject |
| 248 | */ |
| 249 | void acpi_db_decode_internal_object(union acpi_operand_object *obj_desc); |
| 250 | |
| 251 | void |
| 252 | acpi_db_display_internal_object(union acpi_operand_object *obj_desc, |
| 253 | struct acpi_walk_state *walk_state); |
| 254 | |
| 255 | void acpi_db_decode_arguments(struct acpi_walk_state *walk_state); |
| 256 | |
| 257 | void acpi_db_decode_locals(struct acpi_walk_state *walk_state); |
| 258 | |
| 259 | void |
| 260 | acpi_db_dump_method_info(acpi_status status, |
| 261 | struct acpi_walk_state *walk_state); |
| 262 | |
| 263 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | * dbstats - Generation and display of ACPI table statistics |
| 265 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 266 | void acpi_db_generate_statistics(union acpi_parse_object *root, u8 is_method); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 268 | acpi_status acpi_db_display_statistics(char *type_arg); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | |
| 270 | /* |
| 271 | * dbutils - AML debugger utilities |
| 272 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 273 | void acpi_db_set_output_destination(u32 where); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 275 | void acpi_db_dump_external_object(union acpi_object *obj_desc, u32 level); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 277 | void acpi_db_prep_namestring(char *name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 279 | struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | |
Bob Moore | 2e23f85 | 2007-02-02 19:48:23 +0300 | [diff] [blame] | 281 | void acpi_db_uint32_to_hex_string(u32 value, char *buffer); |
| 282 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 283 | #endif /* __ACDEBUG_H__ */ |