linux/drivers/acpi/acpica/dbxface.c

// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
/*******************************************************************************
 *
 * Module Name: dbxface - AML Debugger external interfaces
 *
 ******************************************************************************/

#include <acpi/acpi.h>
#include "accommon.h"
#include "amlcode.h"
#include "acdebug.h"
#include "acinterp.h"
#include "acparser.h"

#define _COMPONENT
ACPI_MODULE_NAME("dbxface")

/* Local prototypes */
static acpi_status
acpi_db_start_command(struct acpi_walk_state *walk_state,
		      union acpi_parse_object *op);

#ifdef ACPI_OBSOLETE_FUNCTIONS
void acpi_db_method_end(struct acpi_walk_state *walk_state);
#endif

#ifdef ACPI_DISASSEMBLER
static union acpi_parse_object *acpi_db_get_display_op(struct acpi_walk_state
						       *walk_state,
						       union acpi_parse_object
						       *op);
#endif

/*******************************************************************************
 *
 * FUNCTION:    acpi_db_start_command
 *
 * PARAMETERS:  walk_state      - Current walk
 *              op              - Current executing Op, from AML interpreter
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Enter debugger command loop
 *
 ******************************************************************************/

static acpi_status
acpi_db_start_command(struct acpi_walk_state *walk_state,
		      union acpi_parse_object *op)
{}

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

void acpi_db_signal_break_point(struct acpi_walk_state *walk_state)
{}

#ifdef ACPI_DISASSEMBLER
/*******************************************************************************
 *
 * FUNCTION:    acpi_db_get_display_op
 *
 * PARAMETERS:  walk_state      - Current walk
 *              op              - Current executing op (from aml interpreter)
 *
 * RETURN:      Opcode to display
 *
 * DESCRIPTION: Find the opcode to display during single stepping
 *
 ******************************************************************************/

static union acpi_parse_object *acpi_db_get_display_op(struct acpi_walk_state
						       *walk_state,
						       union acpi_parse_object
						       *op)
{
	union acpi_parse_object *display_op;
	union acpi_parse_object *parent_op;

	display_op = op;
	parent_op = op->common.parent;
	if (parent_op) {
		if ((walk_state->control_state) &&
		    (walk_state->control_state->common.state ==
		     ACPI_CONTROL_PREDICATE_EXECUTING)) {
			/*
			 * We are executing the predicate of an IF or WHILE statement
			 * Search upwards for the containing IF or WHILE so that the
			 * entire predicate can be displayed.
			 */
			while (parent_op) {
				if ((parent_op->common.aml_opcode == AML_IF_OP)
				    || (parent_op->common.aml_opcode ==
					AML_WHILE_OP)) {
					display_op = parent_op;
					break;
				}
				parent_op = parent_op->common.parent;
			}
		} else {
			while (parent_op) {
				if ((parent_op->common.aml_opcode == AML_IF_OP)
				    || (parent_op->common.aml_opcode ==
					AML_ELSE_OP)
				    || (parent_op->common.aml_opcode ==
					AML_SCOPE_OP)
				    || (parent_op->common.aml_opcode ==
					AML_METHOD_OP)
				    || (parent_op->common.aml_opcode ==
					AML_WHILE_OP)) {
					break;
				}
				display_op = parent_op;
				parent_op = parent_op->common.parent;
			}
		}
	}
	return display_op;
}
#endif

/*******************************************************************************
 *
 * FUNCTION:    acpi_db_single_step
 *
 * PARAMETERS:  walk_state      - Current walk
 *              op              - Current executing op (from aml interpreter)
 *              opcode_class    - Class of the current AML Opcode
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Called just before execution of an AML opcode.
 *
 ******************************************************************************/

acpi_status
acpi_db_single_step(struct acpi_walk_state *walk_state,
		    union acpi_parse_object *op, u32 opcode_class)
{}

/*******************************************************************************
 *
 * FUNCTION:    acpi_initialize_debugger
 *
 * PARAMETERS:  None
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Init and start debugger
 *
 ******************************************************************************/

acpi_status acpi_initialize_debugger(void)
{}

ACPI_EXPORT_SYMBOL()

/*******************************************************************************
 *
 * FUNCTION:    acpi_terminate_debugger
 *
 * PARAMETERS:  None
 *
 * RETURN:      None
 *
 * DESCRIPTION: Stop debugger
 *
 ******************************************************************************/
void acpi_terminate_debugger(void)
{}

ACPI_EXPORT_SYMBOL()

/*******************************************************************************
 *
 * FUNCTION:    acpi_set_debugger_thread_id
 *
 * PARAMETERS:  thread_id       - Debugger thread ID
 *
 * RETURN:      None
 *
 * DESCRIPTION: Set debugger thread ID
 *
 ******************************************************************************/
void acpi_set_debugger_thread_id(acpi_thread_id thread_id)
{}

ACPI_EXPORT_SYMBOL()