^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: psobject - Support for parse objects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 2000 - 2020, Intel Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <acpi/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "accommon.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "acparser.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include "amlcode.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include "acconvert.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "acnamesp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define _COMPONENT ACPI_PARSER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) ACPI_MODULE_NAME("psobject")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) /* Local prototypes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * FUNCTION: acpi_ps_get_aml_opcode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * PARAMETERS: walk_state - Current state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * DESCRIPTION: Extract the next AML opcode from the input stream.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) *
^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) static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) ACPI_ERROR_ONLY(u32 aml_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) ACPI_FUNCTION_TRACE_PTR(ps_get_aml_opcode, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) walk_state->aml = walk_state->parser_state.aml;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) walk_state->opcode = acpi_ps_peek_opcode(&(walk_state->parser_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * First cut to determine what we have found:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) * 1) A valid AML opcode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) * 2) A name string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * 3) An unknown/invalid opcode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) switch (walk_state->op_info->class) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) case AML_CLASS_ASCII:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) case AML_CLASS_PREFIX:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * Starts with a valid prefix or ASCII char, this is a name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * string. Convert the bare name string to a namepath.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) walk_state->opcode = AML_INT_NAMEPATH_OP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) walk_state->arg_types = ARGP_NAMESTRING;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) case AML_CLASS_UNKNOWN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) /* The opcode is unrecognized. Complain and skip unknown opcodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) if (walk_state->pass_number == 2) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) ACPI_ERROR_ONLY(aml_offset =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) (u32)ACPI_PTR_DIFF(walk_state->aml,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) walk_state->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) parser_state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) aml_start));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) walk_state->opcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) (u32)(aml_offset +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) sizeof(struct acpi_table_header))));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) ACPI_DUMP_BUFFER((walk_state->parser_state.aml - 16),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 48);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #ifdef ACPI_ASL_COMPILER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * This is executed for the disassembler only. Output goes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * to the disassembled ASL output file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) ("/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) walk_state->opcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) (u32)(aml_offset +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) sizeof(struct acpi_table_header)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) "Aborting disassembly, AML byte code is corrupt"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) /* Dump the context surrounding the invalid opcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) acpi_ut_dump_buffer(((u8 *)walk_state->parser_state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) aml - 16), 48, DB_BYTE_DISPLAY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) (aml_offset +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) sizeof(struct acpi_table_header) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 16));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) acpi_os_printf(" */\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) * Just abort the disassembly, cannot continue because the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) * parser is essentially lost. The disassembler can then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) * randomly fail because an ill-constructed parse tree
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) * can result.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) return_ACPI_STATUS(AE_AML_BAD_OPCODE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) /* Increment past one-byte or two-byte opcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) walk_state->parser_state.aml++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) if (walk_state->opcode > 0xFF) { /* Can only happen if first byte is 0x5B */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) walk_state->parser_state.aml++;
^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) return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) /* Found opcode info, this is a normal opcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) walk_state->parser_state.aml +=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) acpi_ps_get_opcode_size(walk_state->opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) walk_state->arg_types = walk_state->op_info->parse_args;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * FUNCTION: acpi_ps_build_named_op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) * PARAMETERS: walk_state - Current state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) * aml_op_start - Begin of named Op in AML
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * unnamed_op - Early Op (not a named Op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) * op - Returned Op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) * DESCRIPTION: Parse a named Op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) acpi_ps_build_named_op(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) u8 *aml_op_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) union acpi_parse_object *unnamed_op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) union acpi_parse_object **op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) acpi_status status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) union acpi_parse_object *arg = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) ACPI_FUNCTION_TRACE_PTR(ps_build_named_op, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) unnamed_op->common.value.arg = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) unnamed_op->common.arg_list_length = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) unnamed_op->common.aml_opcode = walk_state->opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) * Get and append arguments until we find the node that contains
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) * the name (the type ARGP_NAME).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) while (GET_CURRENT_ARG_TYPE(walk_state->arg_types) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) (GET_CURRENT_ARG_TYPE(walk_state->arg_types) != ARGP_NAME)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) ASL_CV_CAPTURE_COMMENTS(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) acpi_ps_get_next_arg(walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) &(walk_state->parser_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) GET_CURRENT_ARG_TYPE(walk_state->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) arg_types), &arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) acpi_ps_append_arg(unnamed_op, arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) INCREMENT_ARG_LIST(walk_state->arg_types);
^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) /* are there any inline comments associated with the name_seg?? If so, save this. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) ASL_CV_CAPTURE_COMMENTS(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) #ifdef ACPI_ASL_COMPILER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) if (acpi_gbl_current_inline_comment != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) unnamed_op->common.name_comment =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) acpi_gbl_current_inline_comment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) acpi_gbl_current_inline_comment = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) #endif
^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) * Make sure that we found a NAME and didn't run out of arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) if (!GET_CURRENT_ARG_TYPE(walk_state->arg_types)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) return_ACPI_STATUS(AE_AML_NO_OPERAND);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) /* We know that this arg is a name, move to next arg */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) INCREMENT_ARG_LIST(walk_state->arg_types);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) * Find the object. This will either insert the object into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) * the namespace or simply look it up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) walk_state->op = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) status = walk_state->descending_callback(walk_state, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) if (status != AE_CTRL_TERMINATE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) ACPI_EXCEPTION((AE_INFO, status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) "During name lookup/catalog"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) if (!*op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) status = acpi_ps_next_parse_state(walk_state, *op, status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) if (status == AE_CTRL_PENDING) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) status = AE_CTRL_PARSE_PENDING;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) acpi_ps_append_arg(*op, unnamed_op->common.value.arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) #ifdef ACPI_ASL_COMPILER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) /* save any comments that might be associated with unnamed_op. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) (*op)->common.inline_comment = unnamed_op->common.inline_comment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) (*op)->common.end_node_comment = unnamed_op->common.end_node_comment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) (*op)->common.close_brace_comment =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) unnamed_op->common.close_brace_comment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) (*op)->common.name_comment = unnamed_op->common.name_comment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) (*op)->common.comment_list = unnamed_op->common.comment_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) (*op)->common.end_blk_comment = unnamed_op->common.end_blk_comment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) (*op)->common.cv_filename = unnamed_op->common.cv_filename;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) (*op)->common.cv_parent_filename =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) unnamed_op->common.cv_parent_filename;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) (*op)->named.aml = unnamed_op->common.aml;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) unnamed_op->common.inline_comment = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) unnamed_op->common.end_node_comment = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) unnamed_op->common.close_brace_comment = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) unnamed_op->common.name_comment = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) unnamed_op->common.comment_list = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) unnamed_op->common.end_blk_comment = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) if ((*op)->common.aml_opcode == AML_REGION_OP ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) (*op)->common.aml_opcode == AML_DATA_REGION_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) * Defer final parsing of an operation_region body, because we don't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) * have enough info in the first pass to parse it correctly (i.e.,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) * there may be method calls within the term_arg elements of the body.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) * However, we must continue parsing because the opregion is not a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) * standalone package -- we don't know where the end is at this point.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) * (Length is unknown until parse of the body complete)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) (*op)->named.data = aml_op_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) (*op)->named.length = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) }
^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) * FUNCTION: acpi_ps_create_op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) * PARAMETERS: walk_state - Current state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) * aml_op_start - Op start in AML
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) * new_op - Returned Op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) * DESCRIPTION: Get Op from AML
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) acpi_ps_create_op(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) u8 *aml_op_start, union acpi_parse_object **new_op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) acpi_status status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) union acpi_parse_object *op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) union acpi_parse_object *named_op = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) union acpi_parse_object *parent_scope;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) u8 argument_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) const struct acpi_opcode_info *op_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) ACPI_FUNCTION_TRACE_PTR(ps_create_op, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) status = acpi_ps_get_aml_opcode(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) if (status == AE_CTRL_PARSE_CONTINUE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) /* Create Op structure and append to parent's argument list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) op = acpi_ps_alloc_op(walk_state->opcode, aml_op_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) if (!op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) return_ACPI_STATUS(AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) if (walk_state->op_info->flags & AML_NAMED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) acpi_ps_build_named_op(walk_state, aml_op_start, op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) &named_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) acpi_ps_free_op(op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) #ifdef ACPI_ASL_COMPILER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) if (acpi_gbl_disasm_flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) && walk_state->opcode == AML_EXTERNAL_OP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) && status == AE_NOT_FOUND) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) * If parsing of AML_EXTERNAL_OP's name path fails, then skip
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) * past this opcode and keep parsing. This is a much better
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) * alternative than to abort the entire disassembler. At this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) * point, the parser_state is at the end of the namepath of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) * external declaration opcode. Setting walk_state->Aml to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) * walk_state->parser_state.Aml + 2 moves increments the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) * walk_state->Aml past the object type and the paramcount of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) * external opcode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) walk_state->aml = walk_state->parser_state.aml + 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) walk_state->parser_state.aml = walk_state->aml;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) *new_op = named_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) /* Not a named opcode, just allocate Op and append to parent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) if (walk_state->op_info->flags & AML_CREATE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) * Backup to beginning of create_XXXfield declaration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) * body_length is unknown until we parse the body
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) op->named.data = aml_op_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) op->named.length = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) if (walk_state->opcode == AML_BANK_FIELD_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) * Backup to beginning of bank_field declaration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) * body_length is unknown until we parse the body
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) op->named.data = aml_op_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) op->named.length = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) parent_scope = acpi_ps_get_parent_scope(&(walk_state->parser_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) acpi_ps_append_arg(parent_scope, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) if (parent_scope) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) op_info =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) acpi_ps_get_opcode_info(parent_scope->common.aml_opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) if (op_info->flags & AML_HAS_TARGET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) argument_count =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) acpi_ps_get_argument_count(op_info->type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) if (parent_scope->common.arg_list_length >
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) argument_count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) op->common.flags |= ACPI_PARSEOP_TARGET;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) }
^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) * Special case for both Increment() and Decrement(), where
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) * the lone argument is both a source and a target.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) else if ((parent_scope->common.aml_opcode == AML_INCREMENT_OP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) || (parent_scope->common.aml_opcode ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) AML_DECREMENT_OP)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) op->common.flags |= ACPI_PARSEOP_TARGET;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) if (walk_state->descending_callback != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) * Find the object. This will either insert the object into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) * the namespace or simply look it up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) walk_state->op = *new_op = op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) status = walk_state->descending_callback(walk_state, &op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) status = acpi_ps_next_parse_state(walk_state, op, status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) if (status == AE_CTRL_PENDING) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) status = AE_CTRL_PARSE_PENDING;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) * FUNCTION: acpi_ps_complete_op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) * PARAMETERS: walk_state - Current state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) * op - Returned Op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) * status - Parse status before complete Op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) * DESCRIPTION: Complete Op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) acpi_ps_complete_op(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) union acpi_parse_object **op, acpi_status status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) acpi_status status2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) ACPI_FUNCTION_TRACE_PTR(ps_complete_op, walk_state);
^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) * Finished one argument of the containing scope
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) walk_state->parser_state.scope->parse_scope.arg_count--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) /* Close this Op (will result in parse subtree deletion) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) status2 = acpi_ps_complete_this_op(walk_state, *op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) if (ACPI_FAILURE(status2)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) return_ACPI_STATUS(status2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) *op = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) switch (status) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) case AE_OK:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) case AE_CTRL_TRANSFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) /* We are about to transfer to a called method */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) walk_state->prev_op = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) walk_state->prev_arg_types = walk_state->arg_types;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) case AE_CTRL_END:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) acpi_ps_pop_scope(&(walk_state->parser_state), op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) &walk_state->arg_types,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) &walk_state->arg_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) if (*op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) walk_state->op = *op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) walk_state->op_info =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) acpi_ps_get_opcode_info((*op)->common.aml_opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) walk_state->opcode = (*op)->common.aml_opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) status = walk_state->ascending_callback(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) (void)acpi_ps_next_parse_state(walk_state, *op, status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) status2 = acpi_ps_complete_this_op(walk_state, *op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) if (ACPI_FAILURE(status2)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) return_ACPI_STATUS(status2);
^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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) case AE_CTRL_BREAK:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) case AE_CTRL_CONTINUE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) /* Pop off scopes until we find the While */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) while (!(*op) || ((*op)->common.aml_opcode != AML_WHILE_OP)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) acpi_ps_pop_scope(&(walk_state->parser_state), op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) &walk_state->arg_types,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) &walk_state->arg_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) /* Close this iteration of the While loop */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) walk_state->op = *op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) walk_state->op_info =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) acpi_ps_get_opcode_info((*op)->common.aml_opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) walk_state->opcode = (*op)->common.aml_opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) status = walk_state->ascending_callback(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) (void)acpi_ps_next_parse_state(walk_state, *op, status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) status2 = acpi_ps_complete_this_op(walk_state, *op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) if (ACPI_FAILURE(status2)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) return_ACPI_STATUS(status2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) case AE_CTRL_TERMINATE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) /* Clean up */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) do {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) if (*op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) status2 =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) acpi_ps_complete_this_op(walk_state, *op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) if (ACPI_FAILURE(status2)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) return_ACPI_STATUS(status2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) acpi_ut_delete_generic_state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) (acpi_ut_pop_generic_state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) (&walk_state->control_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) acpi_ps_pop_scope(&(walk_state->parser_state), op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) &walk_state->arg_types,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) &walk_state->arg_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) } while (*op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) default: /* All other non-AE_OK status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) do {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) if (*op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) * These Opcodes need to be removed from the namespace because they
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) * get created even if these opcodes cannot be created due to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) * errors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) if (((*op)->common.aml_opcode == AML_REGION_OP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) || ((*op)->common.aml_opcode ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) AML_DATA_REGION_OP)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) acpi_ns_delete_children((*op)->common.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) acpi_ns_remove_node((*op)->common.node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) (*op)->common.node = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) acpi_ps_delete_parse_tree(*op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) status2 =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) acpi_ps_complete_this_op(walk_state, *op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) if (ACPI_FAILURE(status2)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) return_ACPI_STATUS(status2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) acpi_ps_pop_scope(&(walk_state->parser_state), op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) &walk_state->arg_types,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) &walk_state->arg_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) } while (*op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) #if 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) * TBD: Cleanup parse ops on error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) if (*op == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) acpi_ps_pop_scope(parser_state, op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) &walk_state->arg_types,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) &walk_state->arg_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) walk_state->prev_op = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) walk_state->prev_arg_types = walk_state->arg_types;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) if (walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) * There was something that went wrong while executing code at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) * module-level. We need to skip parsing whatever caused the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) * error and keep going. One runtime error during the table load
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) * should not cause the entire table to not be loaded. This is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) * because there could be correct AML beyond the parts that caused
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) * the runtime error.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) ACPI_INFO(("Ignoring error and continuing table load"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) /* This scope complete? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) if (acpi_ps_has_completed_scope(&(walk_state->parser_state))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) acpi_ps_pop_scope(&(walk_state->parser_state), op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) &walk_state->arg_types,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) &walk_state->arg_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Popped scope, Op=%p\n", *op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) *op = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) * FUNCTION: acpi_ps_complete_final_op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) * PARAMETERS: walk_state - Current state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) * op - Current Op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) * status - Current parse status before complete last
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) * Op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) * DESCRIPTION: Complete last Op.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) union acpi_parse_object *op, acpi_status status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) acpi_status status2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) ACPI_FUNCTION_TRACE_PTR(ps_complete_final_op, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) * Complete the last Op (if not completed), and clear the scope stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) * It is easily possible to end an AML "package" with an unbounded number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) * of open scopes (such as when several ASL blocks are closed with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) * sequential closing braces). We want to terminate each one cleanly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "AML package complete at Op %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) do {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) if (op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) if (walk_state->ascending_callback != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) walk_state->op = op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) walk_state->op_info =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) acpi_ps_get_opcode_info(op->common.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) aml_opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) walk_state->opcode = op->common.aml_opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) walk_state->ascending_callback(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) acpi_ps_next_parse_state(walk_state, op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) if (status == AE_CTRL_PENDING) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) acpi_ps_complete_op(walk_state, &op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) if (status == AE_CTRL_TERMINATE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) /* Clean up */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) do {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) if (op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) status2 =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) acpi_ps_complete_this_op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) (walk_state, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) if (ACPI_FAILURE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) (status2)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) return_ACPI_STATUS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) (status2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) acpi_ps_pop_scope(&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) (walk_state->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) parser_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) &op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) &walk_state->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) arg_types,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) &walk_state->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) arg_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) } while (op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) else if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) /* First error is most important */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) (void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) acpi_ps_complete_this_op(walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) status2 = acpi_ps_complete_this_op(walk_state, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) if (ACPI_FAILURE(status2)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) return_ACPI_STATUS(status2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) acpi_ps_pop_scope(&(walk_state->parser_state), &op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) &walk_state->arg_types,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) &walk_state->arg_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) } while (op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) }