xref: /openbmc/linux/drivers/acpi/acpica/acdebug.h (revision 0c874100)
1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2 /******************************************************************************
3  *
4  * Name: acdebug.h - ACPI/AML debugger
5  *
6  * Copyright (C) 2000 - 2018, Intel Corp.
7  *
8  *****************************************************************************/
9 
10 #ifndef __ACDEBUG_H__
11 #define __ACDEBUG_H__
12 
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 
19 #define ACPI_DEBUG_BUFFER_SIZE  0x4000	/* 16K buffer for return objects */
20 
21 struct acpi_db_command_info {
22 	const char *name;	/* Command Name */
23 	u8 min_args;		/* Minimum arguments required */
24 };
25 
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 {
33 	const char *name;	/* Argument Name */
34 };
35 
36 struct acpi_db_execute_walk {
37 	u32 count;
38 	u32 max_count;
39 };
40 
41 #define PARAM_LIST(pl)                  pl
42 
43 #define EX_NO_SINGLE_STEP               1
44 #define EX_SINGLE_STEP                  2
45 
46 /*
47  * dbxface - external debugger interfaces
48  */
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))
58 
59 /*
60  * dbcmds - debug commands and output routines
61  */
62 struct acpi_namespace_node *acpi_db_convert_to_node(char *in_string);
63 
64 void acpi_db_display_table_info(char *table_arg);
65 
66 void acpi_db_display_template(char *buffer_arg);
67 
68 void acpi_db_unload_acpi_table(char *name);
69 
70 void acpi_db_send_notify(char *name, u32 value);
71 
72 void acpi_db_display_interfaces(char *action_arg, char *interface_name_arg);
73 
74 acpi_status acpi_db_sleep(char *object_arg);
75 
76 void acpi_db_trace(char *enable_arg, char *method_arg, char *once_arg);
77 
78 void acpi_db_display_locks(void);
79 
80 void acpi_db_display_resources(char *object_arg);
81 
82 ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_display_gpes(void))
83 
84 void acpi_db_display_handlers(void);
85 
86 ACPI_HW_DEPENDENT_RETURN_VOID(void
87 			      acpi_db_generate_gpe(char *gpe_arg,
88 						   char *block_arg))
89 ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_generate_sci(void))
90 
91 void acpi_db_execute_test(char *type_arg);
92 
93 /*
94  * dbconvert - miscellaneous conversion routines
95  */
96 acpi_status acpi_db_hex_char_to_value(int hex_char, u8 *return_value);
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 /*
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 
124 void acpi_db_evaluate_predefined_names(void);
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 
133 void acpi_db_dump_namespace_paths(void);
134 
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 
139 void acpi_db_check_predefined_names(void);
140 
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);
149 
150 /*
151  * dbdisply - debug display commands
152  */
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);
156 
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))
164 
165 acpi_status acpi_db_display_all_methods(char *display_count_arg);
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);
176 
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))
184 
185 /*
186  * dbexec - debugger control method execution
187  */
188 void
189 acpi_db_execute(char *name, char **args, acpi_object_type *types, u32 flags);
190 
191 void
192 acpi_db_create_execution_thread(char *method_name_arg,
193 				char **arguments, acpi_object_type *types);
194 
195 void
196 acpi_db_create_execution_threads(char *num_threads_arg,
197 				 char *num_loops_arg, char *method_name_arg);
198 
199 void acpi_db_delete_objects(u32 count, union acpi_object *objects);
200 
201 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
202 u32 acpi_db_get_cache_info(struct acpi_memory_list *cache);
203 #endif
204 
205 /*
206  * dbfileio - Debugger file I/O commands
207  */
208 acpi_object_type
209 acpi_db_match_argument(char *user_argument,
210 		       struct acpi_db_argument_info *arguments);
211 
212 void acpi_db_close_debug_file(void);
213 
214 void acpi_db_open_debug_file(char *name);
215 
216 acpi_status acpi_db_load_acpi_table(char *filename);
217 
218 acpi_status acpi_db_load_tables(struct acpi_new_table_desc *list_head);
219 
220 /*
221  * dbhistry - debugger HISTORY command
222  */
223 void acpi_db_add_to_history(char *command_line);
224 
225 void acpi_db_display_history(void);
226 
227 char *acpi_db_get_from_history(char *command_num_arg);
228 
229 char *acpi_db_get_history_by_index(u32 commandd_num);
230 
231 /*
232  * dbinput - user front-end to the AML debugger
233  */
234 acpi_status
235 acpi_db_command_dispatch(char *input_buffer,
236 			 struct acpi_walk_state *walk_state,
237 			 union acpi_parse_object *op);
238 
239 void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context);
240 
241 acpi_status acpi_db_user_commands(void);
242 
243 char *acpi_db_get_next_token(char *string,
244 			     char **next, acpi_object_type *return_type);
245 
246 /*
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 /*
264  * dbstats - Generation and display of ACPI table statistics
265  */
266 void acpi_db_generate_statistics(union acpi_parse_object *root, u8 is_method);
267 
268 acpi_status acpi_db_display_statistics(char *type_arg);
269 
270 /*
271  * dbutils - AML debugger utilities
272  */
273 void acpi_db_set_output_destination(u32 where);
274 
275 void acpi_db_dump_external_object(union acpi_object *obj_desc, u32 level);
276 
277 void acpi_db_prep_namestring(char *name);
278 
279 struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name);
280 
281 void acpi_db_uint32_to_hex_string(u32 value, char *buffer);
282 
283 #endif				/* __ACDEBUG_H__ */
284