diff options
author | Lv Zheng <lv.zheng@intel.com> | 2015-12-02 21:42:53 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-12-14 18:17:44 -0500 |
commit | 8a2a2501a893bfce65af7098a1b0a61f14f95626 (patch) | |
tree | ca2fbad37ca7097e75a96b829ad706f3130fa369 | |
parent | f8d31489629c125806ce4bf587c0c5c284d6d113 (diff) |
ACPICA: Debugger: Fix runtime stub issues of ACPI_DEBUGGER_EXEC using different stub mechanism
ACPICA commit 11522d6b894054fc4d62dd4f9863ec151296b386
The ACPI_DEBUGGER_EXEC is a problem now when the debugger code is compiled
but runtime disabled. They actually will get executed in this situation.
Although such executions are harmless if we can correctly make
acpi_db_single_step() a runtime stub, users may still do not want to see the
debugger print messages logged into OSPMs' kernel logs when a debugger
driver is not loaded to enable the debugger during runtime.
This patch fixes this issue by introducing new stub mechanism instead of
ACPI_DEBUGGER_EXEC. Lv Zheng.
Link: https://github.com/acpica/acpica/commit/11522d6b
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/acpica/acdebug.h | 34 | ||||
-rw-r--r-- | drivers/acpi/acpica/acmacros.h | 11 | ||||
-rw-r--r-- | drivers/acpi/acpica/dbdisply.c | 12 | ||||
-rw-r--r-- | drivers/acpi/acpica/dbxface.c | 30 | ||||
-rw-r--r-- | drivers/acpi/acpica/dscontrol.c | 10 | ||||
-rw-r--r-- | drivers/acpi/acpica/dsutils.c | 16 | ||||
-rw-r--r-- | drivers/acpi/acpica/dswexec.c | 16 | ||||
-rw-r--r-- | include/acpi/acpixf.h | 23 |
8 files changed, 106 insertions, 46 deletions
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h index 86474d891ce7..dcaa15d5fe27 100644 --- a/drivers/acpi/acpica/acdebug.h +++ b/drivers/acpi/acpica/acdebug.h | |||
@@ -80,9 +80,15 @@ struct acpi_db_execute_walk { | |||
80 | /* | 80 | /* |
81 | * dbxface - external debugger interfaces | 81 | * dbxface - external debugger interfaces |
82 | */ | 82 | */ |
83 | acpi_status | 83 | ACPI_DBR_DEPENDENT_RETURN_OK(acpi_status |
84 | acpi_db_single_step(struct acpi_walk_state *walk_state, | 84 | acpi_db_single_step(struct acpi_walk_state |
85 | union acpi_parse_object *op, u32 op_type); | 85 | *walk_state, |
86 | union acpi_parse_object *op, | ||
87 | u32 op_type)) | ||
88 | ACPI_DBR_DEPENDENT_RETURN_VOID(void | ||
89 | acpi_db_signal_break_point(struct | ||
90 | acpi_walk_state | ||
91 | *walk_state)) | ||
86 | 92 | ||
87 | /* | 93 | /* |
88 | * dbcmds - debug commands and output routines | 94 | * dbcmds - debug commands and output routines |
@@ -182,11 +188,15 @@ void acpi_db_display_method_info(union acpi_parse_object *op); | |||
182 | 188 | ||
183 | void acpi_db_decode_and_display_object(char *target, char *output_type); | 189 | void acpi_db_decode_and_display_object(char *target, char *output_type); |
184 | 190 | ||
185 | void | 191 | ACPI_DBR_DEPENDENT_RETURN_VOID(void |
186 | acpi_db_display_result_object(union acpi_operand_object *obj_desc, | 192 | acpi_db_display_result_object(union |
187 | struct acpi_walk_state *walk_state); | 193 | acpi_operand_object |
194 | *obj_desc, | ||
195 | struct | ||
196 | acpi_walk_state | ||
197 | *walk_state)) | ||
188 | 198 | ||
189 | acpi_status acpi_db_display_all_methods(char *display_count_arg); | 199 | acpi_status acpi_db_display_all_methods(char *display_count_arg); |
190 | 200 | ||
191 | void acpi_db_display_arguments(void); | 201 | void acpi_db_display_arguments(void); |
192 | 202 | ||
@@ -198,9 +208,13 @@ void acpi_db_display_calling_tree(void); | |||
198 | 208 | ||
199 | void acpi_db_display_object_type(char *object_arg); | 209 | void acpi_db_display_object_type(char *object_arg); |
200 | 210 | ||
201 | void | 211 | ACPI_DBR_DEPENDENT_RETURN_VOID(void |
202 | acpi_db_display_argument_object(union acpi_operand_object *obj_desc, | 212 | acpi_db_display_argument_object(union |
203 | struct acpi_walk_state *walk_state); | 213 | acpi_operand_object |
214 | *obj_desc, | ||
215 | struct | ||
216 | acpi_walk_state | ||
217 | *walk_state)) | ||
204 | 218 | ||
205 | /* | 219 | /* |
206 | * dbexec - debugger control method execution | 220 | * dbexec - debugger control method execution |
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index e85366ceb15a..bad5bca03acc 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
@@ -401,17 +401,6 @@ | |||
401 | #endif | 401 | #endif |
402 | 402 | ||
403 | /* | 403 | /* |
404 | * Some code only gets executed when the debugger is built in. | ||
405 | * Note that this is entirely independent of whether the | ||
406 | * DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not. | ||
407 | */ | ||
408 | #ifdef ACPI_DEBUGGER | ||
409 | #define ACPI_DEBUGGER_EXEC(a) a | ||
410 | #else | ||
411 | #define ACPI_DEBUGGER_EXEC(a) | ||
412 | #endif | ||
413 | |||
414 | /* | ||
415 | * Macros used for ACPICA utilities only | 404 | * Macros used for ACPICA utilities only |
416 | */ | 405 | */ |
417 | 406 | ||
diff --git a/drivers/acpi/acpica/dbdisply.c b/drivers/acpi/acpica/dbdisply.c index 672977ec7c7d..c42ce8aa9dfe 100644 --- a/drivers/acpi/acpica/dbdisply.c +++ b/drivers/acpi/acpica/dbdisply.c | |||
@@ -679,6 +679,12 @@ acpi_db_display_result_object(union acpi_operand_object *obj_desc, | |||
679 | struct acpi_walk_state *walk_state) | 679 | struct acpi_walk_state *walk_state) |
680 | { | 680 | { |
681 | 681 | ||
682 | #ifndef ACPI_APPLICATION | ||
683 | if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) { | ||
684 | return; | ||
685 | } | ||
686 | #endif | ||
687 | |||
682 | /* Only display if single stepping */ | 688 | /* Only display if single stepping */ |
683 | 689 | ||
684 | if (!acpi_gbl_cm_single_step) { | 690 | if (!acpi_gbl_cm_single_step) { |
@@ -708,6 +714,12 @@ acpi_db_display_argument_object(union acpi_operand_object *obj_desc, | |||
708 | struct acpi_walk_state *walk_state) | 714 | struct acpi_walk_state *walk_state) |
709 | { | 715 | { |
710 | 716 | ||
717 | #ifndef ACPI_APPLICATION | ||
718 | if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) { | ||
719 | return; | ||
720 | } | ||
721 | #endif | ||
722 | |||
711 | if (!acpi_gbl_cm_single_step) { | 723 | if (!acpi_gbl_cm_single_step) { |
712 | return; | 724 | return; |
713 | } | 725 | } |
diff --git a/drivers/acpi/acpica/dbxface.c b/drivers/acpi/acpica/dbxface.c index d95e91f7ce49..d7ff58e8c233 100644 --- a/drivers/acpi/acpica/dbxface.c +++ b/drivers/acpi/acpica/dbxface.c | |||
@@ -119,6 +119,36 @@ error_exit: | |||
119 | 119 | ||
120 | /******************************************************************************* | 120 | /******************************************************************************* |
121 | * | 121 | * |
122 | * FUNCTION: acpi_db_signal_break_point | ||
123 | * | ||
124 | * PARAMETERS: walk_state - Current walk | ||
125 | * | ||
126 | * RETURN: Status | ||
127 | * | ||
128 | * DESCRIPTION: Called for AML_BREAK_POINT_OP | ||
129 | * | ||
130 | ******************************************************************************/ | ||
131 | |||
132 | void acpi_db_signal_break_point(struct acpi_walk_state *walk_state) | ||
133 | { | ||
134 | |||
135 | #ifndef ACPI_APPLICATION | ||
136 | if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) { | ||
137 | return; | ||
138 | } | ||
139 | #endif | ||
140 | |||
141 | /* | ||
142 | * Set the single-step flag. This will cause the debugger (if present) | ||
143 | * to break to the console within the AML debugger at the start of the | ||
144 | * next AML instruction. | ||
145 | */ | ||
146 | acpi_gbl_cm_single_step = TRUE; | ||
147 | acpi_os_printf("**break** Executed AML BreakPoint opcode\n"); | ||
148 | } | ||
149 | |||
150 | /******************************************************************************* | ||
151 | * | ||
122 | * FUNCTION: acpi_db_single_step | 152 | * FUNCTION: acpi_db_single_step |
123 | * | 153 | * |
124 | * PARAMETERS: walk_state - Current walk | 154 | * PARAMETERS: walk_state - Current walk |
diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c index 435fc16e2f83..06a6f7f3af52 100644 --- a/drivers/acpi/acpica/dscontrol.c +++ b/drivers/acpi/acpica/dscontrol.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include "amlcode.h" | 47 | #include "amlcode.h" |
48 | #include "acdispat.h" | 48 | #include "acdispat.h" |
49 | #include "acinterp.h" | 49 | #include "acinterp.h" |
50 | #include "acdebug.h" | ||
50 | 51 | ||
51 | #define _COMPONENT ACPI_DISPATCHER | 52 | #define _COMPONENT ACPI_DISPATCHER |
52 | ACPI_MODULE_NAME("dscontrol") | 53 | ACPI_MODULE_NAME("dscontrol") |
@@ -348,14 +349,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
348 | 349 | ||
349 | case AML_BREAK_POINT_OP: | 350 | case AML_BREAK_POINT_OP: |
350 | 351 | ||
351 | /* | 352 | acpi_db_signal_break_point(walk_state); |
352 | * Set the single-step flag. This will cause the debugger (if present) | ||
353 | * to break to the console within the AML debugger at the start of the | ||
354 | * next AML instruction. | ||
355 | */ | ||
356 | ACPI_DEBUGGER_EXEC(acpi_gbl_cm_single_step = TRUE); | ||
357 | ACPI_DEBUGGER_EXEC(acpi_os_printf | ||
358 | ("**break** Executed AML BreakPoint opcode\n")); | ||
359 | 353 | ||
360 | /* Call to the OSL in case OS wants a piece of the action */ | 354 | /* Call to the OSL in case OS wants a piece of the action */ |
361 | 355 | ||
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c index ebc577baeaf9..e4293a8794ea 100644 --- a/drivers/acpi/acpica/dsutils.c +++ b/drivers/acpi/acpica/dsutils.c | |||
@@ -605,8 +605,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
605 | if (ACPI_FAILURE(status)) { | 605 | if (ACPI_FAILURE(status)) { |
606 | return_ACPI_STATUS(status); | 606 | return_ACPI_STATUS(status); |
607 | } | 607 | } |
608 | ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object | 608 | |
609 | (obj_desc, walk_state)); | 609 | acpi_db_display_argument_object(obj_desc, walk_state); |
610 | } else { | 610 | } else { |
611 | /* Check for null name case */ | 611 | /* Check for null name case */ |
612 | 612 | ||
@@ -638,10 +638,11 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
638 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 638 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
639 | "Argument previously created, already stacked\n")); | 639 | "Argument previously created, already stacked\n")); |
640 | 640 | ||
641 | ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object | 641 | acpi_db_display_argument_object(walk_state-> |
642 | (walk_state-> | 642 | operands[walk_state-> |
643 | operands[walk_state->num_operands - | 643 | num_operands - |
644 | 1], walk_state)); | 644 | 1], |
645 | walk_state); | ||
645 | 646 | ||
646 | /* | 647 | /* |
647 | * Use value that was already previously returned | 648 | * Use value that was already previously returned |
@@ -685,8 +686,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
685 | return_ACPI_STATUS(status); | 686 | return_ACPI_STATUS(status); |
686 | } | 687 | } |
687 | 688 | ||
688 | ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object | 689 | acpi_db_display_argument_object(obj_desc, walk_state); |
689 | (obj_desc, walk_state)); | ||
690 | } | 690 | } |
691 | 691 | ||
692 | return_ACPI_STATUS(AE_OK); | 692 | return_ACPI_STATUS(AE_OK); |
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c index df54d46225cd..9cc5761ef483 100644 --- a/drivers/acpi/acpica/dswexec.c +++ b/drivers/acpi/acpica/dswexec.c | |||
@@ -178,8 +178,7 @@ cleanup: | |||
178 | 178 | ||
179 | /* Break to debugger to display result */ | 179 | /* Break to debugger to display result */ |
180 | 180 | ||
181 | ACPI_DEBUGGER_EXEC(acpi_db_display_result_object | 181 | acpi_db_display_result_object(local_obj_desc, walk_state); |
182 | (local_obj_desc, walk_state)); | ||
183 | 182 | ||
184 | /* | 183 | /* |
185 | * Delete the predicate result object (we know that | 184 | * Delete the predicate result object (we know that |
@@ -386,11 +385,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
386 | 385 | ||
387 | /* Call debugger for single step support (DEBUG build only) */ | 386 | /* Call debugger for single step support (DEBUG build only) */ |
388 | 387 | ||
389 | ACPI_DEBUGGER_EXEC(status = | 388 | status = acpi_db_single_step(walk_state, op, op_class); |
390 | acpi_db_single_step(walk_state, op, op_class)); | 389 | if (ACPI_FAILURE(status)) { |
391 | ACPI_DEBUGGER_EXEC(if (ACPI_FAILURE(status)) { | 390 | return_ACPI_STATUS(status); |
392 | return_ACPI_STATUS(status);} | 391 | } |
393 | ) ; | ||
394 | 392 | ||
395 | /* Decode the Opcode Class */ | 393 | /* Decode the Opcode Class */ |
396 | 394 | ||
@@ -728,8 +726,8 @@ cleanup: | |||
728 | 726 | ||
729 | /* Break to debugger to display result */ | 727 | /* Break to debugger to display result */ |
730 | 728 | ||
731 | ACPI_DEBUGGER_EXEC(acpi_db_display_result_object | 729 | acpi_db_display_result_object(walk_state->result_obj, |
732 | (walk_state->result_obj, walk_state)); | 730 | walk_state); |
733 | 731 | ||
734 | /* | 732 | /* |
735 | * Delete the result op if and only if: | 733 | * Delete the result op if and only if: |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 95ebae38a951..5dfab9c2142e 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -375,6 +375,29 @@ ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running); | |||
375 | 375 | ||
376 | #endif /* ACPI_APPLICATION */ | 376 | #endif /* ACPI_APPLICATION */ |
377 | 377 | ||
378 | /* | ||
379 | * Debugger prototypes | ||
380 | * | ||
381 | * All interfaces used by debugger will be configured | ||
382 | * out of the ACPICA build unless the ACPI_DEBUGGER | ||
383 | * flag is defined. | ||
384 | */ | ||
385 | #ifdef ACPI_DEBUGGER | ||
386 | #define ACPI_DBR_DEPENDENT_RETURN_OK(prototype) \ | ||
387 | ACPI_EXTERNAL_RETURN_OK(prototype) | ||
388 | |||
389 | #define ACPI_DBR_DEPENDENT_RETURN_VOID(prototype) \ | ||
390 | ACPI_EXTERNAL_RETURN_VOID(prototype) | ||
391 | |||
392 | #else | ||
393 | #define ACPI_DBR_DEPENDENT_RETURN_OK(prototype) \ | ||
394 | static ACPI_INLINE prototype {return(AE_OK);} | ||
395 | |||
396 | #define ACPI_DBR_DEPENDENT_RETURN_VOID(prototype) \ | ||
397 | static ACPI_INLINE prototype {return;} | ||
398 | |||
399 | #endif /* ACPI_DEBUGGER */ | ||
400 | |||
378 | /***************************************************************************** | 401 | /***************************************************************************** |
379 | * | 402 | * |
380 | * ACPICA public interface prototypes | 403 | * ACPICA public interface prototypes |