Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^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: dsargs - Support for execution of dynamic arguments for static
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *                       objects (regions, fields, buffer fields, etc.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Copyright (C) 2000 - 2020, Intel Corp.
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <acpi/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include "accommon.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include "acparser.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include "amlcode.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include "acdispat.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include "acnamesp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define _COMPONENT          ACPI_DISPATCHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) ACPI_MODULE_NAME("dsargs")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) /* Local prototypes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) acpi_ds_execute_arguments(struct acpi_namespace_node *node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 			  struct acpi_namespace_node *scope_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 			  u32 aml_length, u8 *aml_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * FUNCTION:    acpi_ds_execute_arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * PARAMETERS:  node                - Object NS node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  *              scope_node          - Parent NS node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  *              aml_length          - Length of executable AML
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  *              aml_start           - Pointer to the AML
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  * RETURN:      Status.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  * DESCRIPTION: Late (deferred) execution of region or field arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) acpi_ds_execute_arguments(struct acpi_namespace_node *node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 			  struct acpi_namespace_node *scope_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 			  u32 aml_length, u8 *aml_start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	union acpi_parse_object *op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	struct acpi_walk_state *walk_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	ACPI_FUNCTION_TRACE_PTR(ds_execute_arguments, aml_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	/* Allocate a new parser op to be the root of the parsed tree */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	op = acpi_ps_alloc_op(AML_INT_EVAL_SUBTREE_OP, aml_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	if (!op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 		return_ACPI_STATUS(AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	/* Save the Node for use in acpi_ps_parse_aml */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	op->common.node = scope_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	/* Create and initialize a new parser state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	walk_state = acpi_ds_create_walk_state(0, NULL, NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	if (!walk_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		status = AE_NO_MEMORY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	status = acpi_ds_init_aml_walk(walk_state, op, NULL, aml_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 				       aml_length, NULL, ACPI_IMODE_LOAD_PASS1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		acpi_ds_delete_walk_state(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	/* Mark this parse as a deferred opcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	walk_state->parse_flags = ACPI_PARSE_DEFERRED_OP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	walk_state->deferred_node = node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	/* Pass1: Parse the entire declaration */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	status = acpi_ps_parse_aml(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	/* Get and init the Op created above */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	op->common.node = node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	acpi_ps_delete_parse_tree(op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	/* Evaluate the deferred arguments */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	op = acpi_ps_alloc_op(AML_INT_EVAL_SUBTREE_OP, aml_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	if (!op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		return_ACPI_STATUS(AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	op->common.node = scope_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	/* Create and initialize a new parser state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	walk_state = acpi_ds_create_walk_state(0, NULL, NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	if (!walk_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		status = AE_NO_MEMORY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	/* Execute the opcode and arguments */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	status = acpi_ds_init_aml_walk(walk_state, op, NULL, aml_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 				       aml_length, NULL, ACPI_IMODE_EXECUTE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		acpi_ds_delete_walk_state(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	/* Mark this execution as a deferred opcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	walk_state->deferred_node = node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	status = acpi_ps_parse_aml(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) cleanup:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	acpi_ps_delete_parse_tree(op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  * FUNCTION:    acpi_ds_get_buffer_field_arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  * PARAMETERS:  obj_desc        - A valid buffer_field object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)  * RETURN:      Status.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)  * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)  *              evaluation of these field attributes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	union acpi_operand_object *extra_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_field_arguments, obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	/* Get the AML pointer (method object) and buffer_field node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	extra_desc = acpi_ns_get_secondary_object(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	node = obj_desc->buffer_field.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 			(ACPI_TYPE_BUFFER_FIELD, node, NULL));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 			  acpi_ut_get_node_name(node)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	/* Execute the AML code for the term_arg arguments */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	status = acpi_ds_execute_arguments(node, node->parent,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 					   extra_desc->extra.aml_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 					   extra_desc->extra.aml_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)  * FUNCTION:    acpi_ds_get_bank_field_arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)  * PARAMETERS:  obj_desc        - A valid bank_field object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)  * RETURN:      Status.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)  * DESCRIPTION: Get bank_field bank_value. This implements the late
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)  *              evaluation of these field attributes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	union acpi_operand_object *extra_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	ACPI_FUNCTION_TRACE_PTR(ds_get_bank_field_arguments, obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 		return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	/* Get the AML pointer (method object) and bank_field node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	extra_desc = acpi_ns_get_secondary_object(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	node = obj_desc->bank_field.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 			(ACPI_TYPE_LOCAL_BANK_FIELD, node, NULL));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 			  acpi_ut_get_node_name(node)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	/* Execute the AML code for the term_arg arguments */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	status = acpi_ds_execute_arguments(node, node->parent,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 					   extra_desc->extra.aml_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 					   extra_desc->extra.aml_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	status = acpi_ut_add_address_range(obj_desc->region.space_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 					   obj_desc->region.address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 					   obj_desc->region.length, node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) }
^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)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)  * FUNCTION:    acpi_ds_get_buffer_arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)  * PARAMETERS:  obj_desc        - A valid Buffer object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)  * RETURN:      Status.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)  * DESCRIPTION: Get Buffer length and initializer byte list. This implements
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)  *              the late evaluation of these attributes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_arguments, obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 		return_ACPI_STATUS(AE_OK);
^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) 	/* Get the Buffer node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	node = obj_desc->buffer.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	if (!node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 		ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 			    "No pointer back to namespace node in buffer object %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 			    obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 		return_ACPI_STATUS(AE_AML_INTERNAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Buffer Arg Init\n"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	/* Execute the AML code for the term_arg arguments */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	status = acpi_ds_execute_arguments(node, node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 					   obj_desc->buffer.aml_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 					   obj_desc->buffer.aml_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)  * FUNCTION:    acpi_ds_get_package_arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)  * PARAMETERS:  obj_desc        - A valid Package object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)  * RETURN:      Status.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)  * DESCRIPTION: Get Package length and initializer byte list. This implements
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)  *              the late evaluation of these attributes.
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	ACPI_FUNCTION_TRACE_PTR(ds_get_package_arguments, obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 		return_ACPI_STATUS(AE_OK);
^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) 	/* Get the Package node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 	node = obj_desc->package.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	if (!node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 		ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 			    "No pointer back to namespace node in package %p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 			    obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 		return_ACPI_STATUS(AE_AML_INTERNAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Package Argument Init, AML Ptr: %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 			  obj_desc->package.aml_start));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 	/* Execute the AML code for the term_arg arguments */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	status = acpi_ds_execute_arguments(node, node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 					   obj_desc->package.aml_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 					   obj_desc->package.aml_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)  * FUNCTION:    acpi_ds_get_region_arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)  * PARAMETERS:  obj_desc        - A valid region object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)  * RETURN:      Status.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)  * DESCRIPTION: Get region address and length. This implements the late
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)  *              evaluation of these region attributes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 	struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	union acpi_operand_object *extra_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	ACPI_FUNCTION_TRACE_PTR(ds_get_region_arguments, obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 		return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 	extra_desc = acpi_ns_get_secondary_object(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 	if (!extra_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 		return_ACPI_STATUS(AE_NOT_EXIST);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	/* Get the Region node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	node = obj_desc->region.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 			(ACPI_TYPE_REGION, node, NULL));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 	ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 			  "[%4.4s] OpRegion Arg Init at AML %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 			  acpi_ut_get_node_name(node),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 			  extra_desc->extra.aml_start));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	/* Execute the argument AML */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 	status = acpi_ds_execute_arguments(node, extra_desc->extra.scope_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 					   extra_desc->extra.aml_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 					   extra_desc->extra.aml_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 		return_ACPI_STATUS(status);
^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) 	status = acpi_ut_add_address_range(obj_desc->region.space_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 					   obj_desc->region.address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 					   obj_desc->region.length, node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) }