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: psxface - Parser external interfaces
^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 "acdispat.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include "acinterp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include "actables.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_PARSER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) ACPI_MODULE_NAME("psxface")
^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 void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * FUNCTION:    acpi_debug_trace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * PARAMETERS:  method_name     - Valid ACPI name string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  *              debug_level     - Optional level mask. 0 to use default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  *              debug_layer     - Optional layer mask. 0 to use default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  *              flags           - bit 1: one shot(1) or persistent(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  * DESCRIPTION: External interface to enable debug tracing during control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  *              method execution
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  *
^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) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) acpi_debug_trace(const char *name, u32 debug_level, u32 debug_layer, u32 flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 		return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	acpi_gbl_trace_method_name = name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	acpi_gbl_trace_flags = flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	acpi_gbl_trace_dbg_level = debug_level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	acpi_gbl_trace_dbg_layer = debug_layer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  * FUNCTION:    acpi_ps_execute_method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  * PARAMETERS:  info            - Method info block, contains:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  *                  node            - Method Node to execute
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  *                  obj_desc        - Method object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  *                  parameters      - List of parameters to pass to the method,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)  *                                    terminated by NULL. Params itself may be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)  *                                    NULL if no parameters are being passed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  *                  return_object   - Where to put method's return value (if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  *                                    any). If NULL, no value is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  *                  parameter_type  - Type of Parameter list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  *                  return_object   - Where to put method's return value (if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)  *                                    any). If NULL, no value is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)  *                  pass_number     - Parse or execute pass
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  * DESCRIPTION: Execute a control method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	union acpi_parse_object *op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	struct acpi_walk_state *walk_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	ACPI_FUNCTION_TRACE(ps_execute_method);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	/* Quick validation of DSDT header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	acpi_tb_check_dsdt_header();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	/* Validate the Info and method Node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	if (!info || !info->node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		return_ACPI_STATUS(AE_NULL_ENTRY);
^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) 	/* Init for new method, wait on concurrency semaphore */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	    acpi_ds_begin_method_execution(info->node, info->obj_desc, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	 * The caller "owns" the parameters, so give each one an extra reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	acpi_ps_update_parameter_list(info, REF_INCREMENT);
^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) 	 * Execute the method. Performs parse simultaneously
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 			  "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 			  info->node->name.ascii, info->node, info->obj_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	/* Create and init a Root Node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	op = acpi_ps_create_scope_op(info->obj_desc->method.aml_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	if (!op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		status = AE_NO_MEMORY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	/* Create and initialize a new walk state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	info->pass_number = ACPI_IMODE_EXECUTE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	walk_state =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	    acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 				      NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	if (!walk_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		status = AE_NO_MEMORY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	status = acpi_ds_init_aml_walk(walk_state, op, info->node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 				       info->obj_desc->method.aml_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 				       info->obj_desc->method.aml_length, info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 				       info->pass_number);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		acpi_ds_delete_walk_state(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	walk_state->method_pathname = info->full_pathname;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	walk_state->method_is_nested = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	if (info->obj_desc->method.info_flags & ACPI_METHOD_MODULE_LEVEL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 		walk_state->parse_flags |= ACPI_PARSE_MODULE_LEVEL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	/* Invoke an internal method if necessary */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	if (info->obj_desc->method.info_flags & ACPI_METHOD_INTERNAL_ONLY) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 		status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 		    info->obj_desc->method.dispatch.implementation(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 		info->return_object = walk_state->return_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 		/* Cleanup states */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 		acpi_ds_scope_stack_clear(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		acpi_ps_cleanup_scope(&walk_state->parser_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 		acpi_ds_terminate_control_method(walk_state->method_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 						 walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 		acpi_ds_delete_walk_state(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 		goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	 * Start method evaluation with an implicit return of zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	 * This is done for Windows compatibility.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	if (acpi_gbl_enable_interpreter_slack) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		walk_state->implicit_return_obj =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		    acpi_ut_create_integer_object((u64) 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		if (!walk_state->implicit_return_obj) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 			status = AE_NO_MEMORY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 			acpi_ds_delete_walk_state(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 			goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 		}
^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) 	/* Parse the AML */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	status = acpi_ps_parse_aml(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	/* walk_state was deleted by parse_aml */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) cleanup:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	acpi_ps_delete_parse_tree(op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	/* Take away the extra reference that we gave the parameters above */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	acpi_ps_update_parameter_list(info, REF_DECREMENT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	/* Exit now if error above */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		return_ACPI_STATUS(status);
^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) 	 * If the method has returned an object, signal this to the caller with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	 * a control exception code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	if (info->return_object) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 				  info->return_object));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 		ACPI_DUMP_STACK_ENTRY(info->return_object);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		status = AE_CTRL_RETURN_VALUE;
^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) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) }
^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)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)  * FUNCTION:    acpi_ps_execute_table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)  * PARAMETERS:  info            - Method info block, contains:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)  *              node            - Node to where the is entered into the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)  *                                namespace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)  *              obj_desc        - Pseudo method object describing the AML
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)  *                                code of the entire table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)  *              pass_number     - Parse or execute pass
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)  * DESCRIPTION: Execute a table
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) acpi_status acpi_ps_execute_table(struct acpi_evaluate_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	union acpi_parse_object *op = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	struct acpi_walk_state *walk_state = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	ACPI_FUNCTION_TRACE(ps_execute_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	/* Create and init a Root Node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	op = acpi_ps_create_scope_op(info->obj_desc->method.aml_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	if (!op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 		status = AE_NO_MEMORY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 		goto cleanup;
^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) 	/* Create and initialize a new walk state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	walk_state =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	    acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 				      NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	if (!walk_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 		status = AE_NO_MEMORY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 		goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	status = acpi_ds_init_aml_walk(walk_state, op, info->node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 				       info->obj_desc->method.aml_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 				       info->obj_desc->method.aml_length, info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 				       info->pass_number);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 		goto cleanup;
^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) 	walk_state->method_pathname = info->full_pathname;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	walk_state->method_is_nested = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	if (info->obj_desc->method.info_flags & ACPI_METHOD_MODULE_LEVEL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 		walk_state->parse_flags |= ACPI_PARSE_MODULE_LEVEL;
^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) 	/* Info->Node is the default location to load the table  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	if (info->node && info->node != acpi_gbl_root_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 		status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 		    acpi_ds_scope_stack_push(info->node, ACPI_TYPE_METHOD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 					     walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 		if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 			goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	 * Parse the AML, walk_state will be deleted by parse_aml
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	acpi_ex_enter_interpreter();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	status = acpi_ps_parse_aml(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	acpi_ex_exit_interpreter();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	walk_state = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) cleanup:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	if (walk_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 		acpi_ds_delete_walk_state(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	if (op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 		acpi_ps_delete_parse_tree(op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)  * FUNCTION:    acpi_ps_update_parameter_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)  * PARAMETERS:  info            - See struct acpi_evaluate_info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)  *                                (Used: parameter_type and Parameters)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315)  *              action          - Add or Remove reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)  * DESCRIPTION: Update reference count on all method parameter objects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) static void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	if (info->parameters) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 		/* Update reference count for each parameter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 		for (i = 0; info->parameters[i]; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 			/* Ignore errors, just do them all */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 			(void)acpi_ut_update_object_reference(info->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 							      parameters[i],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 							      action);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) }