Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a2a2501 authored by Lv Zheng's avatar Lv Zheng Committed by Rafael J. Wysocki
Browse files

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: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent f8d31489
Loading
Loading
Loading
Loading
+24 −10
Original line number Diff line number Diff line
@@ -80,9 +80,15 @@ struct acpi_db_execute_walk {
/*
 * dbxface - external debugger interfaces
 */
acpi_status
acpi_db_single_step(struct acpi_walk_state *walk_state,
		    union acpi_parse_object *op, u32 op_type);
ACPI_DBR_DEPENDENT_RETURN_OK(acpi_status
			     acpi_db_single_step(struct acpi_walk_state
						 *walk_state,
						 union acpi_parse_object *op,
						 u32 op_type))
 ACPI_DBR_DEPENDENT_RETURN_VOID(void
				acpi_db_signal_break_point(struct
							   acpi_walk_state
							   *walk_state))

/*
 * dbcmds - debug commands and output routines
@@ -182,9 +188,13 @@ void acpi_db_display_method_info(union acpi_parse_object *op);

void acpi_db_decode_and_display_object(char *target, char *output_type);

void
acpi_db_display_result_object(union acpi_operand_object *obj_desc,
			      struct acpi_walk_state *walk_state);
ACPI_DBR_DEPENDENT_RETURN_VOID(void
			       acpi_db_display_result_object(union
							     acpi_operand_object
							     *obj_desc,
							     struct
							     acpi_walk_state
							     *walk_state))

 acpi_status acpi_db_display_all_methods(char *display_count_arg);

@@ -198,9 +208,13 @@ void acpi_db_display_calling_tree(void);

void acpi_db_display_object_type(char *object_arg);

void
acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
				struct acpi_walk_state *walk_state);
ACPI_DBR_DEPENDENT_RETURN_VOID(void
			       acpi_db_display_argument_object(union
							       acpi_operand_object
							       *obj_desc,
							       struct
							       acpi_walk_state
							       *walk_state))

/*
 * dbexec - debugger control method execution
+0 −11
Original line number Diff line number Diff line
@@ -400,17 +400,6 @@
#define ACPI_HW_OPTIONAL_FUNCTION(addr)     NULL
#endif

/*
 * Some code only gets executed when the debugger is built in.
 * Note that this is entirely independent of whether the
 * DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not.
 */
#ifdef ACPI_DEBUGGER
#define ACPI_DEBUGGER_EXEC(a)           a
#else
#define ACPI_DEBUGGER_EXEC(a)
#endif

/*
 * Macros used for ACPICA utilities only
 */
+12 −0
Original line number Diff line number Diff line
@@ -679,6 +679,12 @@ acpi_db_display_result_object(union acpi_operand_object *obj_desc,
			      struct acpi_walk_state *walk_state)
{

#ifndef ACPI_APPLICATION
	if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) {
		return;
	}
#endif

	/* Only display if single stepping */

	if (!acpi_gbl_cm_single_step) {
@@ -708,6 +714,12 @@ acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
				struct acpi_walk_state *walk_state)
{

#ifndef ACPI_APPLICATION
	if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) {
		return;
	}
#endif

	if (!acpi_gbl_cm_single_step) {
		return;
	}
+30 −0
Original line number Diff line number Diff line
@@ -117,6 +117,36 @@ acpi_db_start_command(struct acpi_walk_state *walk_state,
	return (status);
}

/*******************************************************************************
 *
 * FUNCTION:    acpi_db_signal_break_point
 *
 * PARAMETERS:  walk_state      - Current walk
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Called for AML_BREAK_POINT_OP
 *
 ******************************************************************************/

void acpi_db_signal_break_point(struct acpi_walk_state *walk_state)
{

#ifndef ACPI_APPLICATION
	if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) {
		return;
	}
#endif

	/*
	 * Set the single-step flag. This will cause the debugger (if present)
	 * to break to the console within the AML debugger at the start of the
	 * next AML instruction.
	 */
	acpi_gbl_cm_single_step = TRUE;
	acpi_os_printf("**break** Executed AML BreakPoint opcode\n");
}

/*******************************************************************************
 *
 * FUNCTION:    acpi_db_single_step
+2 −8
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@
#include "amlcode.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acdebug.h"

#define _COMPONENT          ACPI_DISPATCHER
ACPI_MODULE_NAME("dscontrol")
@@ -348,14 +349,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,

	case AML_BREAK_POINT_OP:

		/*
		 * Set the single-step flag. This will cause the debugger (if present)
		 * to break to the console within the AML debugger at the start of the
		 * next AML instruction.
		 */
		ACPI_DEBUGGER_EXEC(acpi_gbl_cm_single_step = TRUE);
		ACPI_DEBUGGER_EXEC(acpi_os_printf
				   ("**break** Executed AML BreakPoint opcode\n"));
		acpi_db_signal_break_point(walk_state);

		/* Call to the OSL in case OS wants a piece of the action */

Loading