^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: dsopcode - Dispatcher support for regions and fields
^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 "acdispat.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "acinterp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "acnamesp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include "acevents.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include "actables.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define _COMPONENT ACPI_DISPATCHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) ACPI_MODULE_NAME("dsopcode")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) /* Local prototypes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) acpi_ds_init_buffer_field(u16 aml_opcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) union acpi_operand_object *obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) union acpi_operand_object *buffer_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) union acpi_operand_object *offset_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) union acpi_operand_object *length_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) union acpi_operand_object *result_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^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) * FUNCTION: acpi_ds_initialize_region
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * PARAMETERS: obj_handle - Region namespace node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * DESCRIPTION: Front end to ev_initialize_region
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) acpi_status acpi_ds_initialize_region(acpi_handle obj_handle)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) obj_desc = acpi_ns_get_attached_object(obj_handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) /* Namespace is NOT locked */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) status = acpi_ev_initialize_region(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * FUNCTION: acpi_ds_init_buffer_field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) * PARAMETERS: aml_opcode - create_xxx_field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) * obj_desc - buffer_field object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) * buffer_desc - Host Buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) * offset_desc - Offset into buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * length_desc - Length of field (CREATE_FIELD_OP only)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) * result_desc - Where to store the result
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * DESCRIPTION: Perform actual initialization of a buffer field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) acpi_ds_init_buffer_field(u16 aml_opcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) union acpi_operand_object *obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) union acpi_operand_object *buffer_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) union acpi_operand_object *offset_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) union acpi_operand_object *length_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) union acpi_operand_object *result_desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) u32 offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) u32 bit_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) u32 bit_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) u8 field_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) ACPI_FUNCTION_TRACE_PTR(ds_init_buffer_field, obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) /* Host object must be a Buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) if (buffer_desc->common.type != ACPI_TYPE_BUFFER) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) "Target of Create Field is not a Buffer object - %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) acpi_ut_get_object_type_name(buffer_desc)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) status = AE_AML_OPERAND_TYPE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) * The last parameter to all of these opcodes (result_desc) started
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) * out as a name_string, and should therefore now be a NS node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) * after resolution in acpi_ex_resolve_operands().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) if (ACPI_GET_DESCRIPTOR_TYPE(result_desc) != ACPI_DESC_TYPE_NAMED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) "(%s) destination not a NS Node [%s]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) acpi_ps_get_opcode_name(aml_opcode),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) acpi_ut_get_descriptor_name(result_desc)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) status = AE_AML_OPERAND_TYPE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) goto cleanup;
^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) offset = (u32) offset_desc->integer.value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * Setup the Bit offsets and counts, according to the opcode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) switch (aml_opcode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) case AML_CREATE_FIELD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) /* Offset is in bits, count is in bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) field_flags = AML_FIELD_ACCESS_BYTE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) bit_offset = offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) bit_count = (u32) length_desc->integer.value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) /* Must have a valid (>0) bit count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) if (bit_count == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) ACPI_BIOS_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) "Attempt to CreateField of length zero"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) status = AE_AML_OPERAND_VALUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) case AML_CREATE_BIT_FIELD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) /* Offset is in bits, Field is one bit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) bit_offset = offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) bit_count = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) field_flags = AML_FIELD_ACCESS_BYTE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) case AML_CREATE_BYTE_FIELD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) /* Offset is in bytes, field is one byte */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) bit_offset = 8 * offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) bit_count = 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) field_flags = AML_FIELD_ACCESS_BYTE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) case AML_CREATE_WORD_FIELD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) /* Offset is in bytes, field is one word */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) bit_offset = 8 * offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) bit_count = 16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) field_flags = AML_FIELD_ACCESS_WORD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) case AML_CREATE_DWORD_FIELD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) /* Offset is in bytes, field is one dword */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) bit_offset = 8 * offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) bit_count = 32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) field_flags = AML_FIELD_ACCESS_DWORD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) case AML_CREATE_QWORD_FIELD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) /* Offset is in bytes, field is one qword */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) bit_offset = 8 * offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) bit_count = 64;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) field_flags = AML_FIELD_ACCESS_QWORD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) "Unknown field creation opcode 0x%02X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) aml_opcode));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) status = AE_AML_BAD_OPCODE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) /* Entire field must fit within the current length of the buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) if ((bit_offset + bit_count) > (8 * (u32)buffer_desc->buffer.length)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) status = AE_AML_BUFFER_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) ACPI_BIOS_EXCEPTION((AE_INFO, status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) "Field [%4.4s] at bit offset/length %u/%u "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) "exceeds size of target Buffer (%u bits)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) acpi_ut_get_node_name(result_desc),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) bit_offset, bit_count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 8 * (u32)buffer_desc->buffer.length));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) goto cleanup;
^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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) * Initialize areas of the field object that are common to all fields
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) * For field_flags, use LOCK_RULE = 0 (NO_LOCK),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) * UPDATE_RULE = 0 (UPDATE_PRESERVE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) acpi_ex_prep_common_field_object(obj_desc, field_flags, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) bit_offset, bit_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) obj_desc->buffer_field.buffer_obj = buffer_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) obj_desc->buffer_field.is_create_field =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) aml_opcode == AML_CREATE_FIELD_OP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) /* Reference count for buffer_desc inherits obj_desc count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) buffer_desc->common.reference_count = (u16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) (buffer_desc->common.reference_count +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) obj_desc->common.reference_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) cleanup:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) /* Always delete the operands */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) acpi_ut_remove_reference(offset_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) acpi_ut_remove_reference(buffer_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) if (aml_opcode == AML_CREATE_FIELD_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) acpi_ut_remove_reference(length_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) /* On failure, delete the result descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) acpi_ut_remove_reference(result_desc); /* Result descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) /* Now the address and length are valid for this buffer_field */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) obj_desc->buffer_field.flags |= AOPOBJ_DATA_VALID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) return_ACPI_STATUS(status);
^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) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) * FUNCTION: acpi_ds_eval_buffer_field_operands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) * PARAMETERS: walk_state - Current walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) * op - A valid buffer_field Op object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) * DESCRIPTION: Get buffer_field Buffer and Index
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) * Called from acpi_ds_exec_end_op during buffer_field parse tree walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) union acpi_parse_object *op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) union acpi_parse_object *next_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) ACPI_FUNCTION_TRACE_PTR(ds_eval_buffer_field_operands, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) * This is where we evaluate the address and length fields of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) * create_xxx_field declaration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) node = op->common.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) /* next_op points to the op that holds the Buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) next_op = op->common.value.arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) /* Evaluate/create the address and length operands */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) status = acpi_ds_create_operands(walk_state, next_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) obj_desc = acpi_ns_get_attached_object(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) return_ACPI_STATUS(AE_NOT_EXIST);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) /* Resolve the operands */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) acpi_ex_resolve_operands(op->common.aml_opcode, ACPI_WALK_OPERANDS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) ACPI_ERROR((AE_INFO, "(%s) bad operand(s), status 0x%X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) acpi_ps_get_opcode_name(op->common.aml_opcode),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) status));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) /* Initialize the Buffer Field */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) /* NOTE: Slightly different operands for this opcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) acpi_ds_init_buffer_field(op->common.aml_opcode, obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) walk_state->operands[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) walk_state->operands[1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) walk_state->operands[2],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) walk_state->operands[3]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) /* All other, create_xxx_field opcodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) acpi_ds_init_buffer_field(op->common.aml_opcode, obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) walk_state->operands[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) walk_state->operands[1], NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) walk_state->operands[2]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)
^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) * FUNCTION: acpi_ds_eval_region_operands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) * PARAMETERS: walk_state - Current walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) * op - A valid region Op object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) * DESCRIPTION: Get region address and length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) * Called from acpi_ds_exec_end_op during op_region parse tree walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) *
^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) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) union acpi_parse_object *op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) union acpi_operand_object *operand_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) union acpi_parse_object *next_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) acpi_adr_space_type space_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) ACPI_FUNCTION_TRACE_PTR(ds_eval_region_operands, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) * This is where we evaluate the address and length fields of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) * op_region declaration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) node = op->common.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) /* next_op points to the op that holds the space_ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) next_op = op->common.value.arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) space_id = (acpi_adr_space_type)next_op->common.value.integer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) /* next_op points to address op */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) next_op = next_op->common.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) /* Evaluate/create the address and length operands */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) status = acpi_ds_create_operands(walk_state, next_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) /* Resolve the length and address operands to numbers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) acpi_ex_resolve_operands(op->common.aml_opcode, ACPI_WALK_OPERANDS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) obj_desc = acpi_ns_get_attached_object(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) return_ACPI_STATUS(AE_NOT_EXIST);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) * Get the length operand and save it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) * (at Top of stack)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) operand_desc = walk_state->operands[walk_state->num_operands - 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) obj_desc->region.length = (u32) operand_desc->integer.value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) acpi_ut_remove_reference(operand_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) /* A zero-length operation region is unusable. Just warn */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) if (!obj_desc->region.length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) && (space_id < ACPI_NUM_PREDEFINED_REGIONS)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) ACPI_WARNING((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) "Operation Region [%4.4s] has zero length (SpaceId %X)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) node->name.ascii, space_id));
^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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) * Get the address and save it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) * (at top of stack - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) operand_desc = walk_state->operands[walk_state->num_operands - 2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) obj_desc->region.address = (acpi_physical_address)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) operand_desc->integer.value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) acpi_ut_remove_reference(operand_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) ACPI_FORMAT_UINT64(obj_desc->region.address),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) obj_desc->region.length));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) status = acpi_ut_add_address_range(obj_desc->region.space_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) obj_desc->region.address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) obj_desc->region.length, node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) /* Now the address and length are valid for this opregion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) obj_desc->region.flags |= AOPOBJ_DATA_VALID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) }
^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) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) * FUNCTION: acpi_ds_eval_table_region_operands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) * PARAMETERS: walk_state - Current walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) * op - A valid region Op object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) * DESCRIPTION: Get region address and length.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) * Called from acpi_ds_exec_end_op during data_table_region parse
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) * tree walk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) union acpi_parse_object *op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) union acpi_operand_object **operand;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) union acpi_parse_object *next_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) struct acpi_table_header *table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) u32 table_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) ACPI_FUNCTION_TRACE_PTR(ds_eval_table_region_operands, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) * This is where we evaluate the Signature string, oem_id string,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) * and oem_table_id string of the Data Table Region declaration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) node = op->common.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) /* next_op points to Signature string op */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) next_op = op->common.value.arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) * Evaluate/create the Signature string, oem_id string,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) * and oem_table_id string operands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) status = acpi_ds_create_operands(walk_state, next_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) return_ACPI_STATUS(status);
^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) operand = &walk_state->operands[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) * Resolve the Signature string, oem_id string,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) * and oem_table_id string operands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) acpi_ex_resolve_operands(op->common.aml_opcode, ACPI_WALK_OPERANDS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) goto cleanup;
^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) /* Find the ACPI table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) status = acpi_tb_find_table(operand[0]->string.pointer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) operand[1]->string.pointer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) operand[2]->string.pointer, &table_index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) if (status == AE_NOT_FOUND) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) "ACPI Table [%4.4s] OEM:(%s, %s) not found in RSDT/XSDT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) operand[0]->string.pointer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) operand[1]->string.pointer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) operand[2]->string.pointer));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) status = acpi_get_table_by_index(table_index, &table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) obj_desc = acpi_ns_get_attached_object(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) status = AE_NOT_EXIST;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) obj_desc->region.address = ACPI_PTR_TO_PHYSADDR(table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) obj_desc->region.length = table->length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) ACPI_FORMAT_UINT64(obj_desc->region.address),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) obj_desc->region.length));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) /* Now the address and length are valid for this opregion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) obj_desc->region.flags |= AOPOBJ_DATA_VALID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) cleanup:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) acpi_ut_remove_reference(operand[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) acpi_ut_remove_reference(operand[1]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) acpi_ut_remove_reference(operand[2]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) * FUNCTION: acpi_ds_eval_data_object_operands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) * PARAMETERS: walk_state - Current walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) * op - A valid data_object Op object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) * obj_desc - data_object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) * DESCRIPTION: Get the operands and complete the following data object types:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) * Buffer, Package.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) union acpi_parse_object *op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) union acpi_operand_object *obj_desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) union acpi_operand_object *arg_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) u32 length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) ACPI_FUNCTION_TRACE(ds_eval_data_object_operands);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) /* The first operand (for all of these data objects) is the length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) * Set proper index into operand stack for acpi_ds_obj_stack_push
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) * invoked inside acpi_ds_create_operand.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) walk_state->operand_index = walk_state->num_operands;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) /* Ignore if child is not valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) if (!op->common.value.arg) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) "Missing child while evaluating opcode %4.4X, Op %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) op->common.aml_opcode, op));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) status = acpi_ds_create_operand(walk_state, op->common.value.arg, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) status = acpi_ex_resolve_operands(walk_state->opcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) &(walk_state->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) operands[walk_state->num_operands -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) 1]), walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) /* Extract length operand */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) arg_desc = walk_state->operands[walk_state->num_operands - 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) length = (u32) arg_desc->integer.value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) /* Cleanup for length operand */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) status = acpi_ds_obj_stack_pop(1, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) return_ACPI_STATUS(status);
^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) acpi_ut_remove_reference(arg_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) * Create the actual data object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) switch (op->common.aml_opcode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) case AML_BUFFER_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) acpi_ds_build_internal_buffer_obj(walk_state, op, length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) &obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) case AML_PACKAGE_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) case AML_VARIABLE_PACKAGE_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) acpi_ds_build_internal_package_obj(walk_state, op, length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) &obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) return_ACPI_STATUS(AE_AML_BAD_OPCODE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) if (ACPI_SUCCESS(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) * Return the object in the walk_state, unless the parent is a package -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) * in this case, the return object will be stored in the parse tree
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) * for the package.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) if ((!op->common.parent) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) ((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) (op->common.parent->common.aml_opcode !=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) AML_VARIABLE_PACKAGE_OP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) && (op->common.parent->common.aml_opcode !=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) AML_NAME_OP))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) walk_state->result_obj = obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) * FUNCTION: acpi_ds_eval_bank_field_operands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) * PARAMETERS: walk_state - Current walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) * op - A valid bank_field Op object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) * DESCRIPTION: Get bank_field bank_value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) * Called from acpi_ds_exec_end_op during bank_field parse tree walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) acpi_ds_eval_bank_field_operands(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) union acpi_parse_object *op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) union acpi_operand_object *operand_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) union acpi_parse_object *next_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) union acpi_parse_object *arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) ACPI_FUNCTION_TRACE_PTR(ds_eval_bank_field_operands, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) * This is where we evaluate the bank_value field of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) * bank_field declaration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) /* next_op points to the op that holds the Region */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) next_op = op->common.value.arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) /* next_op points to the op that holds the Bank Register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) next_op = next_op->common.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) /* next_op points to the op that holds the Bank Value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) next_op = next_op->common.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) * Set proper index into operand stack for acpi_ds_obj_stack_push
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) * invoked inside acpi_ds_create_operand.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) * We use walk_state->Operands[0] to store the evaluated bank_value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) walk_state->operand_index = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) status = acpi_ds_create_operand(walk_state, next_op, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) status = acpi_ex_resolve_to_value(&walk_state->operands[0], walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) acpi_ps_get_opcode_name(op->common.aml_opcode), 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) * Get the bank_value operand and save it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) * (at Top of stack)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) operand_desc = walk_state->operands[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) /* Arg points to the start Bank Field */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) arg = acpi_ps_get_arg(op, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) while (arg) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) /* Ignore OFFSET and ACCESSAS terms here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) node = arg->common.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) obj_desc = acpi_ns_get_attached_object(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) return_ACPI_STATUS(AE_NOT_EXIST);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) obj_desc->bank_field.value =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) (u32) operand_desc->integer.value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) /* Move to next field in the list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) arg = arg->common.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) acpi_ut_remove_reference(operand_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) }