^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Module Name: dbxface - AML Debugger external interfaces
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <acpi/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include "accommon.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include "amlcode.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "acdebug.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "acinterp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include "acparser.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define _COMPONENT ACPI_CA_DEBUGGER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) ACPI_MODULE_NAME("dbxface")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /* Local prototypes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) acpi_db_start_command(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) union acpi_parse_object *op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #ifdef ACPI_OBSOLETE_FUNCTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) void acpi_db_method_end(struct acpi_walk_state *walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #ifdef ACPI_DISASSEMBLER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) static union acpi_parse_object *acpi_db_get_display_op(struct acpi_walk_state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) union acpi_parse_object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) *op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * FUNCTION: acpi_db_start_command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * PARAMETERS: walk_state - Current walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * op - Current executing Op, from AML interpreter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * DESCRIPTION: Enter debugger command loop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) acpi_db_start_command(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) union acpi_parse_object *op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /* TBD: [Investigate] are there namespace locking issues here? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) /* acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) /* Go into the command loop and await next user command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) acpi_gbl_method_executing = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) status = AE_CTRL_TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) while (status == AE_CTRL_TRUE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) /* Notify the completion of the command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) status = acpi_os_notify_command_complete();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) goto error_exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) /* Wait the readiness of the command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) status = acpi_os_wait_command_ready();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) goto error_exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) acpi_db_command_dispatch(acpi_gbl_db_line_buf, walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /* acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) error_exit:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) if (ACPI_FAILURE(status) && status != AE_CTRL_TERMINATE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) ACPI_EXCEPTION((AE_INFO, status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) "While parsing/handling command line"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * FUNCTION: acpi_db_signal_break_point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) * PARAMETERS: walk_state - Current walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) * DESCRIPTION: Called for AML_BREAKPOINT_OP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) void acpi_db_signal_break_point(struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) #ifndef ACPI_APPLICATION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) * Set the single-step flag. This will cause the debugger (if present)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) * to break to the console within the AML debugger at the start of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) * next AML instruction.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) acpi_gbl_cm_single_step = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) acpi_os_printf("**break** Executed AML BreakPoint opcode\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) #ifdef ACPI_DISASSEMBLER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * FUNCTION: acpi_db_get_display_op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * PARAMETERS: walk_state - Current walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * op - Current executing op (from aml interpreter)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * RETURN: Opcode to display
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * DESCRIPTION: Find the opcode to display during single stepping
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) static union acpi_parse_object *acpi_db_get_display_op(struct acpi_walk_state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) union acpi_parse_object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) *op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) union acpi_parse_object *display_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) union acpi_parse_object *parent_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) display_op = op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) parent_op = op->common.parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) if (parent_op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) if ((walk_state->control_state) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) (walk_state->control_state->common.state ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) ACPI_CONTROL_PREDICATE_EXECUTING)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) * We are executing the predicate of an IF or WHILE statement
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) * Search upwards for the containing IF or WHILE so that the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) * entire predicate can be displayed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) while (parent_op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) if ((parent_op->common.aml_opcode == AML_IF_OP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) || (parent_op->common.aml_opcode ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) AML_WHILE_OP)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) display_op = parent_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) parent_op = parent_op->common.parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) while (parent_op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) if ((parent_op->common.aml_opcode == AML_IF_OP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) || (parent_op->common.aml_opcode ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) AML_ELSE_OP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) || (parent_op->common.aml_opcode ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) AML_SCOPE_OP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) || (parent_op->common.aml_opcode ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) AML_METHOD_OP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) || (parent_op->common.aml_opcode ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) AML_WHILE_OP)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) display_op = parent_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) parent_op = parent_op->common.parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) return display_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) * FUNCTION: acpi_db_single_step
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * PARAMETERS: walk_state - Current walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * op - Current executing op (from aml interpreter)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) * opcode_class - Class of the current AML Opcode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) * DESCRIPTION: Called just before execution of an AML opcode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) acpi_db_single_step(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) union acpi_parse_object *op, u32 opcode_class)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) union acpi_parse_object *next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) acpi_status status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) u32 original_debug_level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) u32 aml_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) ACPI_FUNCTION_ENTRY();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) #ifndef ACPI_APPLICATION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) /* Check the abort flag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) if (acpi_gbl_abort_method) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) acpi_gbl_abort_method = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) return (AE_ABORT_METHOD);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) aml_offset = (u32)ACPI_PTR_DIFF(op->common.aml,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) walk_state->parser_state.aml_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) /* Check for single-step breakpoint */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) if (walk_state->method_breakpoint &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) (walk_state->method_breakpoint <= aml_offset)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) /* Check if the breakpoint has been reached or passed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) /* Hit the breakpoint, resume single step, reset breakpoint */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) acpi_os_printf("***Break*** at AML offset %X\n", aml_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) acpi_gbl_cm_single_step = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) acpi_gbl_step_to_next_call = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) walk_state->method_breakpoint = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) /* Check for user breakpoint (Must be on exact Aml offset) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) else if (walk_state->user_breakpoint &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) (walk_state->user_breakpoint == aml_offset)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) acpi_os_printf("***UserBreakpoint*** at AML offset %X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) aml_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) acpi_gbl_cm_single_step = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) acpi_gbl_step_to_next_call = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) walk_state->method_breakpoint = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) * Check if this is an opcode that we are interested in --
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) * namely, opcodes that have arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) if (op->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) switch (opcode_class) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) case AML_CLASS_UNKNOWN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) /* All other opcodes -- continue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) * Under certain debug conditions, display this opcode and its operands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) if ((acpi_gbl_db_output_to_file) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) (acpi_gbl_cm_single_step) || (acpi_dbg_level & ACPI_LV_PARSE)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) if ((acpi_gbl_db_output_to_file) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) (acpi_dbg_level & ACPI_LV_PARSE)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) ("\nAML Debug: Next AML Opcode to execute:\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) * Display this op (and only this op - zero out the NEXT field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) * temporarily, and disable parser trace output for the duration of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) * the display because we don't want the extraneous debug output)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) original_debug_level = acpi_dbg_level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) acpi_dbg_level &= ~(ACPI_LV_PARSE | ACPI_LV_FUNCTIONS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) next = op->common.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) op->common.next = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) /* Now we can disassemble and display it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) #ifdef ACPI_DISASSEMBLER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) acpi_dm_disassemble(walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) acpi_db_get_display_op(walk_state, op),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) ACPI_UINT32_MAX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) * The AML Disassembler is not configured - at least we can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) * display the opcode value and name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) acpi_os_printf("AML Opcode: %4.4X %s\n", op->common.aml_opcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) acpi_ps_get_opcode_name(op->common.aml_opcode));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) if ((op->common.aml_opcode == AML_IF_OP) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) (op->common.aml_opcode == AML_WHILE_OP)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) if (walk_state->control_state->common.value) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) ("Predicate = [True], IF block was executed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) ("Predicate = [False], Skipping IF block\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) } else if (op->common.aml_opcode == AML_ELSE_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) ("Predicate = [False], ELSE block was executed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) /* Restore everything */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) op->common.next = next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) acpi_os_printf("\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) if ((acpi_gbl_db_output_to_file) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) (acpi_dbg_level & ACPI_LV_PARSE)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) acpi_os_printf("\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) acpi_dbg_level = original_debug_level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) /* If we are not single stepping, just continue executing the method */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) if (!acpi_gbl_cm_single_step) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) * If we are executing a step-to-call command,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) * Check if this is a method call.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) if (acpi_gbl_step_to_next_call) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) if (op->common.aml_opcode != AML_INT_METHODCALL_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) /* Not a method call, just keep executing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) /* Found a method call, stop executing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) acpi_gbl_step_to_next_call = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) * If the next opcode is a method call, we will "step over" it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) * by default.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) if (op->common.aml_opcode == AML_INT_METHODCALL_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) /* Force no more single stepping while executing called method */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) acpi_gbl_cm_single_step = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) * Set the breakpoint on/before the call, it will stop execution
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) * as soon as we return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) walk_state->method_breakpoint = 1; /* Must be non-zero! */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) acpi_ex_exit_interpreter();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) status = acpi_db_start_command(walk_state, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) acpi_ex_enter_interpreter();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) /* User commands complete, continue execution of the interrupted method */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) * FUNCTION: acpi_initialize_debugger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) * PARAMETERS: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) * DESCRIPTION: Init and start debugger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) acpi_status acpi_initialize_debugger(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) ACPI_FUNCTION_TRACE(acpi_initialize_debugger);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) /* Init globals */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) acpi_gbl_db_buffer = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) acpi_gbl_db_filename = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) acpi_gbl_db_output_to_file = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) acpi_gbl_db_debug_level = ACPI_LV_VERBOSITY2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) acpi_gbl_db_console_debug_level = ACPI_NORMAL_DEFAULT | ACPI_LV_TABLES;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) acpi_gbl_db_opt_no_ini_methods = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) acpi_gbl_db_opt_no_region_support = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) acpi_gbl_db_buffer = acpi_os_allocate(ACPI_DEBUG_BUFFER_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) if (!acpi_gbl_db_buffer) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) return_ACPI_STATUS(AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) memset(acpi_gbl_db_buffer, 0, ACPI_DEBUG_BUFFER_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) /* Initial scope is the root */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) acpi_gbl_db_scope_buf[0] = AML_ROOT_PREFIX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) acpi_gbl_db_scope_buf[1] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) acpi_gbl_db_scope_node = acpi_gbl_root_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) /* Initialize user commands loop */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) acpi_gbl_db_terminate_loop = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) * If configured for multi-thread support, the debug executor runs in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) * a separate thread so that the front end can be in another address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) * space, environment, or even another machine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) /* These were created with one unit, grab it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) status = acpi_os_initialize_debugger();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) acpi_os_printf("Could not get debugger mutex\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) /* Create the debug execution thread to execute commands */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) acpi_gbl_db_threads_terminated = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) status = acpi_os_execute(OSL_DEBUGGER_MAIN_THREAD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) acpi_db_execute_thread, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) ACPI_EXCEPTION((AE_INFO, status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) "Could not start debugger thread"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) acpi_gbl_db_threads_terminated = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) acpi_gbl_db_thread_id = acpi_os_get_thread_id();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) ACPI_EXPORT_SYMBOL(acpi_initialize_debugger)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) * FUNCTION: acpi_terminate_debugger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) * PARAMETERS: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) * DESCRIPTION: Stop debugger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) void acpi_terminate_debugger(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) /* Terminate the AML Debugger */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) acpi_gbl_db_terminate_loop = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) /* Wait the AML Debugger threads */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) while (!acpi_gbl_db_threads_terminated) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) acpi_os_sleep(100);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) acpi_os_terminate_debugger();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) if (acpi_gbl_db_buffer) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) acpi_os_free(acpi_gbl_db_buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) acpi_gbl_db_buffer = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) /* Ensure that debug output is now disabled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) acpi_gbl_db_output_flags = ACPI_DB_DISABLE_OUTPUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) ACPI_EXPORT_SYMBOL(acpi_terminate_debugger)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) * FUNCTION: acpi_set_debugger_thread_id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) * PARAMETERS: thread_id - Debugger thread ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) * DESCRIPTION: Set debugger thread ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) void acpi_set_debugger_thread_id(acpi_thread_id thread_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) acpi_gbl_db_thread_id = thread_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) ACPI_EXPORT_SYMBOL(acpi_set_debugger_thread_id)