diff options
author | Bob Moore <robert.moore@intel.com> | 2018-08-10 17:42:59 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-08-14 17:49:13 -0400 |
commit | fb2ef998af44fb94214f3cf1c0e85d7a4e642fcb (patch) | |
tree | de7e1bc7d60d548c80618e67886b1f9239959a8a | |
parent | 4a7c94c721074eafb27298d93dbcc339aa28e745 (diff) |
ACPICA: Debugger: Cleanup interface to the AML disassembler
If the disassembler is configured out (such as when the debugger
is part of a kernel), these debugger commands are disabled:
List
Disassemble
Further, the Debug (single-step) command is simplified because
each line of code cannot be disassembled.
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/acpica/dbinput.c | 10 | ||||
-rw-r--r-- | drivers/acpi/acpica/dbmethod.c | 8 | ||||
-rw-r--r-- | drivers/acpi/acpica/dbxface.c | 10 |
3 files changed, 22 insertions, 6 deletions
diff --git a/drivers/acpi/acpica/dbinput.c b/drivers/acpi/acpica/dbinput.c index 556ff59bbbfc..3e5f95390f0d 100644 --- a/drivers/acpi/acpica/dbinput.c +++ b/drivers/acpi/acpica/dbinput.c | |||
@@ -763,7 +763,12 @@ acpi_db_command_dispatch(char *input_buffer, | |||
763 | case CMD_DISASSEMBLE: | 763 | case CMD_DISASSEMBLE: |
764 | case CMD_DISASM: | 764 | case CMD_DISASM: |
765 | 765 | ||
766 | #ifdef ACPI_DISASSEMBLER | ||
766 | (void)acpi_db_disassemble_method(acpi_gbl_db_args[1]); | 767 | (void)acpi_db_disassemble_method(acpi_gbl_db_args[1]); |
768 | #else | ||
769 | acpi_os_printf | ||
770 | ("The AML Disassembler is not configured/present\n"); | ||
771 | #endif | ||
767 | break; | 772 | break; |
768 | 773 | ||
769 | case CMD_DUMP: | 774 | case CMD_DUMP: |
@@ -872,7 +877,12 @@ acpi_db_command_dispatch(char *input_buffer, | |||
872 | 877 | ||
873 | case CMD_LIST: | 878 | case CMD_LIST: |
874 | 879 | ||
880 | #ifdef ACPI_DISASSEMBLER | ||
875 | acpi_db_disassemble_aml(acpi_gbl_db_args[1], op); | 881 | acpi_db_disassemble_aml(acpi_gbl_db_args[1], op); |
882 | #else | ||
883 | acpi_os_printf | ||
884 | ("The AML Disassembler is not configured/present\n"); | ||
885 | #endif | ||
876 | break; | 886 | break; |
877 | 887 | ||
878 | case CMD_LOCKS: | 888 | case CMD_LOCKS: |
diff --git a/drivers/acpi/acpica/dbmethod.c b/drivers/acpi/acpica/dbmethod.c index 9fcecf104ba0..d8b7a0fe92ec 100644 --- a/drivers/acpi/acpica/dbmethod.c +++ b/drivers/acpi/acpica/dbmethod.c | |||
@@ -216,6 +216,7 @@ cleanup: | |||
216 | acpi_ut_remove_reference(obj_desc); | 216 | acpi_ut_remove_reference(obj_desc); |
217 | } | 217 | } |
218 | 218 | ||
219 | #ifdef ACPI_DISASSEMBLER | ||
219 | /******************************************************************************* | 220 | /******************************************************************************* |
220 | * | 221 | * |
221 | * FUNCTION: acpi_db_disassemble_aml | 222 | * FUNCTION: acpi_db_disassemble_aml |
@@ -242,9 +243,8 @@ void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op) | |||
242 | if (statements) { | 243 | if (statements) { |
243 | num_statements = strtoul(statements, NULL, 0); | 244 | num_statements = strtoul(statements, NULL, 0); |
244 | } | 245 | } |
245 | #ifdef ACPI_DISASSEMBLER | 246 | |
246 | acpi_dm_disassemble(NULL, op, num_statements); | 247 | acpi_dm_disassemble(NULL, op, num_statements); |
247 | #endif | ||
248 | } | 248 | } |
249 | 249 | ||
250 | /******************************************************************************* | 250 | /******************************************************************************* |
@@ -317,8 +317,6 @@ acpi_status acpi_db_disassemble_method(char *name) | |||
317 | walk_state->parse_flags |= ACPI_PARSE_DISASSEMBLE; | 317 | walk_state->parse_flags |= ACPI_PARSE_DISASSEMBLE; |
318 | 318 | ||
319 | status = acpi_ps_parse_aml(walk_state); | 319 | status = acpi_ps_parse_aml(walk_state); |
320 | |||
321 | #ifdef ACPI_DISASSEMBLER | ||
322 | (void)acpi_dm_parse_deferred_ops(op); | 320 | (void)acpi_dm_parse_deferred_ops(op); |
323 | 321 | ||
324 | /* Now we can disassemble the method */ | 322 | /* Now we can disassemble the method */ |
@@ -326,7 +324,6 @@ acpi_status acpi_db_disassemble_method(char *name) | |||
326 | acpi_gbl_dm_opt_verbose = FALSE; | 324 | acpi_gbl_dm_opt_verbose = FALSE; |
327 | acpi_dm_disassemble(NULL, op, 0); | 325 | acpi_dm_disassemble(NULL, op, 0); |
328 | acpi_gbl_dm_opt_verbose = TRUE; | 326 | acpi_gbl_dm_opt_verbose = TRUE; |
329 | #endif | ||
330 | 327 | ||
331 | acpi_ps_delete_parse_tree(op); | 328 | acpi_ps_delete_parse_tree(op); |
332 | 329 | ||
@@ -337,6 +334,7 @@ acpi_status acpi_db_disassemble_method(char *name) | |||
337 | acpi_ut_release_owner_id(&obj_desc->method.owner_id); | 334 | acpi_ut_release_owner_id(&obj_desc->method.owner_id); |
338 | return (AE_OK); | 335 | return (AE_OK); |
339 | } | 336 | } |
337 | #endif | ||
340 | 338 | ||
341 | /******************************************************************************* | 339 | /******************************************************************************* |
342 | * | 340 | * |
diff --git a/drivers/acpi/acpica/dbxface.c b/drivers/acpi/acpica/dbxface.c index 4647aa8efecb..f2526726daf6 100644 --- a/drivers/acpi/acpica/dbxface.c +++ b/drivers/acpi/acpica/dbxface.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include "amlcode.h" | 10 | #include "amlcode.h" |
11 | #include "acdebug.h" | 11 | #include "acdebug.h" |
12 | #include "acinterp.h" | 12 | #include "acinterp.h" |
13 | #include "acparser.h" | ||
13 | 14 | ||
14 | #define _COMPONENT ACPI_CA_DEBUGGER | 15 | #define _COMPONENT ACPI_CA_DEBUGGER |
15 | ACPI_MODULE_NAME("dbxface") | 16 | ACPI_MODULE_NAME("dbxface") |
@@ -262,10 +263,17 @@ acpi_db_single_step(struct acpi_walk_state *walk_state, | |||
262 | } | 263 | } |
263 | } | 264 | } |
264 | 265 | ||
265 | /* Now we can display it */ | 266 | /* Now we can disassemble and display it */ |
266 | 267 | ||
267 | #ifdef ACPI_DISASSEMBLER | 268 | #ifdef ACPI_DISASSEMBLER |
268 | acpi_dm_disassemble(walk_state, display_op, ACPI_UINT32_MAX); | 269 | acpi_dm_disassemble(walk_state, display_op, ACPI_UINT32_MAX); |
270 | #else | ||
271 | /* | ||
272 | * The AML Disassembler is not configured - at least we can | ||
273 | * display the opcode value and name | ||
274 | */ | ||
275 | acpi_os_printf("AML Opcode: %4.4X %s\n", op->common.aml_opcode, | ||
276 | acpi_ps_get_opcode_name(op->common.aml_opcode)); | ||
269 | #endif | 277 | #endif |
270 | 278 | ||
271 | if ((op->common.aml_opcode == AML_IF_OP) || | 279 | if ((op->common.aml_opcode == AML_IF_OP) || |