blob: 57d9495e5933a1c410c696249c936466b64e0325 [file] [log] [blame]
Erik Schmauss95857632018-03-14 16:13:07 -07001/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/******************************************************************************
3 *
4 * Name: acdebug.h - ACPI/AML debugger
5 *
Bob Mooreda6f8322018-01-04 10:06:38 -08006 * Copyright (C) 2000 - 2018, Intel Corp.
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
Erik Schmauss95857632018-03-14 16:13:07 -07008 *****************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
10#ifndef __ACDEBUG_H__
11#define __ACDEBUG_H__
12
Bob Moore93556112015-10-19 10:24:26 +080013/* 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 Zhengf540fad2012-10-31 02:25:15 +000019#define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Lv Zhengf540fad2012-10-31 02:25:15 +000021struct acpi_db_command_info {
Bob Moore0dfaaa32016-03-24 09:40:40 +080022 const char *name; /* Command Name */
Len Brown4be44fc2005-08-05 00:44:28 -040023 u8 min_args; /* Minimum arguments required */
Linus Torvalds1da177e2005-04-16 15:20:36 -070024};
25
Lv Zhengf540fad2012-10-31 02:25:15 +000026struct acpi_db_command_help {
27 u8 line_count; /* Number of help lines */
28 char *invocation; /* Command Invocation */
29 char *description; /* Command Description */
30};
31
32struct acpi_db_argument_info {
Bob Moore0dfaaa32016-03-24 09:40:40 +080033 const char *name; /* Argument Name */
Linus Torvalds1da177e2005-04-16 15:20:36 -070034};
35
Lv Zhengf540fad2012-10-31 02:25:15 +000036struct acpi_db_execute_walk {
37 u32 count;
38 u32 max_count;
39};
40
Linus Torvalds1da177e2005-04-16 15:20:36 -070041#define PARAM_LIST(pl) pl
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
43#define EX_NO_SINGLE_STEP 1
44#define EX_SINGLE_STEP 2
45
Linus Torvalds1da177e2005-04-16 15:20:36 -070046/*
47 * dbxface - external debugger interfaces
48 */
Lv Zheng8a2a2502015-12-03 10:42:53 +080049ACPI_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 Torvalds1da177e2005-04-16 15:20:36 -070058
59/*
60 * dbcmds - debug commands and output routines
61 */
Lv Zhengf540fad2012-10-31 02:25:15 +000062struct acpi_namespace_node *acpi_db_convert_to_node(char *in_string);
Len Brown4be44fc2005-08-05 00:44:28 -040063
64void acpi_db_display_table_info(char *table_arg);
65
Lv Zhengf540fad2012-10-31 02:25:15 +000066void acpi_db_display_template(char *buffer_arg);
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
Lv Zhengf540fad2012-10-31 02:25:15 +000068void acpi_db_unload_acpi_table(char *name);
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
Len Brown4be44fc2005-08-05 00:44:28 -040070void acpi_db_send_notify(char *name, u32 value);
Linus Torvalds1da177e2005-04-16 15:20:36 -070071
Lin Mingb0ed7a92010-08-06 09:35:51 +080072void acpi_db_display_interfaces(char *action_arg, char *interface_name_arg);
73
Lv Zhengf540fad2012-10-31 02:25:15 +000074acpi_status acpi_db_sleep(char *object_arg);
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
Lv Zhengab6c5732015-07-23 12:52:59 +080076void acpi_db_trace(char *enable_arg, char *method_arg, char *once_arg);
77
Len Brown4be44fc2005-08-05 00:44:28 -040078void acpi_db_display_locks(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
Len Brown4be44fc2005-08-05 00:44:28 -040080void acpi_db_display_resources(char *object_arg);
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
Bob Moore33620c52012-02-14 18:14:27 +080082ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_display_gpes(void))
Linus Torvalds1da177e2005-04-16 15:20:36 -070083
Lv Zhengf540fad2012-10-31 02:25:15 +000084void acpi_db_display_handlers(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
Bob Moore33620c52012-02-14 18:14:27 +080086ACPI_HW_DEPENDENT_RETURN_VOID(void
87 acpi_db_generate_gpe(char *gpe_arg,
88 char *block_arg))
Lv Zhengcd27d792013-10-29 09:30:22 +080089ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_generate_sci(void))
Robert Moore44f6c012005-04-18 22:49:35 -040090
Bob Mooreeb60c4d2014-02-08 09:42:39 +080091void acpi_db_execute_test(char *type_arg);
92
Lv Zhengf540fad2012-10-31 02:25:15 +000093/*
Bob Moore42f8fb72013-01-11 13:08:51 +010094 * dbconvert - miscellaneous conversion routines
95 */
Lv Zhenga2fd4b42013-09-23 09:52:05 +080096acpi_status acpi_db_hex_char_to_value(int hex_char, u8 *return_value);
Bob Moore42f8fb72013-01-11 13:08:51 +010097
98acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object);
99
100acpi_status
101acpi_db_convert_to_object(acpi_object_type type,
102 char *string, union acpi_object *object);
103
104u8 *acpi_db_encode_pld_buffer(struct acpi_pld_info *pld_info);
105
106void acpi_db_dump_pld_buffer(union acpi_object *obj_desc);
107
108/*
Lv Zhengf540fad2012-10-31 02:25:15 +0000109 * dbmethod - control method commands
110 */
111void
112acpi_db_set_method_breakpoint(char *location,
113 struct acpi_walk_state *walk_state,
114 union acpi_parse_object *op);
115
116void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op);
117
118void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg);
119
120acpi_status acpi_db_disassemble_method(char *name);
121
122void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op);
123
Bob Moore60361b72016-09-07 14:05:41 +0800124void acpi_db_evaluate_predefined_names(void);
Lv Zhengf540fad2012-10-31 02:25:15 +0000125
126/*
127 * dbnames - namespace commands
128 */
129void acpi_db_set_scope(char *name);
130
131void acpi_db_dump_namespace(char *start_arg, char *depth_arg);
132
Bob Moore424deb32013-09-23 09:52:19 +0800133void acpi_db_dump_namespace_paths(void);
134
Lv Zhengf540fad2012-10-31 02:25:15 +0000135void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg);
136
137acpi_status acpi_db_find_name_in_namespace(char *name_arg);
138
Bob Moore1044f1f2008-09-27 11:08:41 +0800139void acpi_db_check_predefined_names(void);
140
Lv Zhengf540fad2012-10-31 02:25:15 +0000141acpi_status
142acpi_db_display_objects(char *obj_type_arg, char *display_count_arg);
143
144void acpi_db_check_integrity(void);
145
146void acpi_db_find_references(char *object_arg);
147
148void acpi_db_get_bus_info(void);
Bob Moore1044f1f2008-09-27 11:08:41 +0800149
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150/*
151 * dbdisply - debug display commands
152 */
Len Brown4be44fc2005-08-05 00:44:28 -0400153void acpi_db_display_method_info(union acpi_parse_object *op);
154
155void acpi_db_decode_and_display_object(char *target, char *output_type);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156
Lv Zheng8a2a2502015-12-03 10:42:53 +0800157ACPI_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 Brown4be44fc2005-08-05 00:44:28 -0400164
Lv Zhengf5c1e1c2016-05-05 12:57:53 +0800165acpi_status acpi_db_display_all_methods(char *display_count_arg);
Len Brown4be44fc2005-08-05 00:44:28 -0400166
167void acpi_db_display_arguments(void);
168
169void acpi_db_display_locals(void);
170
171void acpi_db_display_results(void);
172
173void acpi_db_display_calling_tree(void);
174
175void acpi_db_display_object_type(char *object_arg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176
Lv Zheng8a2a2502015-12-03 10:42:53 +0800177ACPI_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 Torvalds1da177e2005-04-16 15:20:36 -0700184
185/*
186 * dbexec - debugger control method execution
187 */
Lv Zhengf540fad2012-10-31 02:25:15 +0000188void
Lv Zhengf5c1e1c2016-05-05 12:57:53 +0800189acpi_db_execute(char *name, char **args, acpi_object_type *types, u32 flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190
191void
Bob Moore060c8592017-11-17 15:42:26 -0800192acpi_db_create_execution_thread(char *method_name_arg,
193 char **arguments, acpi_object_type *types);
194
195void
Len Brown4be44fc2005-08-05 00:44:28 -0400196acpi_db_create_execution_threads(char *num_threads_arg,
197 char *num_loops_arg, char *method_name_arg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198
Bob Moore42f8fb72013-01-11 13:08:51 +0100199void acpi_db_delete_objects(u32 count, union acpi_object *objects);
200
Valery A. Podrezovafbb9e62007-02-02 19:48:23 +0300201#ifdef ACPI_DBG_TRACK_ALLOCATIONS
202u32 acpi_db_get_cache_info(struct acpi_memory_list *cache);
203#endif
204
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205/*
206 * dbfileio - Debugger file I/O commands
207 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208acpi_object_type
Lv Zhengf540fad2012-10-31 02:25:15 +0000209acpi_db_match_argument(char *user_argument,
210 struct acpi_db_argument_info *arguments);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211
Len Brown4be44fc2005-08-05 00:44:28 -0400212void acpi_db_close_debug_file(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213
Len Brown4be44fc2005-08-05 00:44:28 -0400214void acpi_db_open_debug_file(char *name);
215
216acpi_status acpi_db_load_acpi_table(char *filename);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217
Bob Moore2ba73792015-12-29 13:54:58 +0800218acpi_status acpi_db_load_tables(struct acpi_new_table_desc *list_head);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220/*
221 * dbhistry - debugger HISTORY command
222 */
Len Brown4be44fc2005-08-05 00:44:28 -0400223void acpi_db_add_to_history(char *command_line);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224
Len Brown4be44fc2005-08-05 00:44:28 -0400225void acpi_db_display_history(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226
Len Brown4be44fc2005-08-05 00:44:28 -0400227char *acpi_db_get_from_history(char *command_num_arg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228
Bob Moore1d98e9e2013-10-29 09:29:09 +0800229char *acpi_db_get_history_by_index(u32 commandd_num);
230
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231/*
232 * dbinput - user front-end to the AML debugger
233 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400235acpi_db_command_dispatch(char *input_buffer,
236 struct acpi_walk_state *walk_state,
237 union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238
Len Brown4be44fc2005-08-05 00:44:28 -0400239void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240
Lv Zhengf8d31482015-12-03 10:42:46 +0800241acpi_status acpi_db_user_commands(void);
Lv Zhengf540fad2012-10-31 02:25:15 +0000242
243char *acpi_db_get_next_token(char *string,
Lv Zhengf5c1e1c2016-05-05 12:57:53 +0800244 char **next, acpi_object_type *return_type);
Lv Zhengf540fad2012-10-31 02:25:15 +0000245
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246/*
Lv Zhengfdd8d832015-07-23 12:54:17 +0800247 * dbobject
248 */
249void acpi_db_decode_internal_object(union acpi_operand_object *obj_desc);
250
251void
252acpi_db_display_internal_object(union acpi_operand_object *obj_desc,
253 struct acpi_walk_state *walk_state);
254
255void acpi_db_decode_arguments(struct acpi_walk_state *walk_state);
256
257void acpi_db_decode_locals(struct acpi_walk_state *walk_state);
258
259void
260acpi_db_dump_method_info(acpi_status status,
261 struct acpi_walk_state *walk_state);
262
263/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 * dbstats - Generation and display of ACPI table statistics
265 */
Len Brown4be44fc2005-08-05 00:44:28 -0400266void acpi_db_generate_statistics(union acpi_parse_object *root, u8 is_method);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267
Len Brown4be44fc2005-08-05 00:44:28 -0400268acpi_status acpi_db_display_statistics(char *type_arg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269
270/*
271 * dbutils - AML debugger utilities
272 */
Len Brown4be44fc2005-08-05 00:44:28 -0400273void acpi_db_set_output_destination(u32 where);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274
Len Brown4be44fc2005-08-05 00:44:28 -0400275void acpi_db_dump_external_object(union acpi_object *obj_desc, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276
Len Brown4be44fc2005-08-05 00:44:28 -0400277void acpi_db_prep_namestring(char *name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700278
Len Brown4be44fc2005-08-05 00:44:28 -0400279struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280
Bob Moore2e23f852007-02-02 19:48:23 +0300281void acpi_db_uint32_to_hex_string(u32 value, char *buffer);
282
Len Brown4be44fc2005-08-05 00:44:28 -0400283#endif /* __ACDEBUG_H__ */