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: uteval - Object evaluation
^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 "acnamesp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #define _COMPONENT          ACPI_UTILITIES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) ACPI_MODULE_NAME("uteval")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * FUNCTION:    acpi_ut_evaluate_object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * PARAMETERS:  prefix_node         - Starting node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *              path                - Path to object from starting node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *              expected_return_types - Bitmap of allowed return types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  *              return_desc         - Where a return value is stored
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * DESCRIPTION: Evaluates a namespace object and verifies the type of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  *              return object. Common code that simplifies accessing objects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  *              that have required return objects of fixed types.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  *              NOTE: Internal function, no parameter validation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 			const char *path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 			u32 expected_return_btypes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 			union acpi_operand_object **return_desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	struct acpi_evaluate_info *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	u32 return_btype;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	ACPI_FUNCTION_TRACE(ut_evaluate_object);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	/* Allocate the evaluation information block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	if (!info) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		return_ACPI_STATUS(AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	info->prefix_node = prefix_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	info->relative_pathname = path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	/* Evaluate the object/method */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	status = acpi_ns_evaluate(info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 		if (status == AE_NOT_FOUND) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 			ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 					  "[%4.4s.%s] was not found\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 					  acpi_ut_get_node_name(prefix_node),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 					  path));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 			ACPI_ERROR_METHOD("Method execution failed",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 					  prefix_node, path, status);
^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) 		goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	/* Did we get a return object? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	if (!info->return_object) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 		if (expected_return_btypes) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 			ACPI_ERROR_METHOD("No object was returned from",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 					  prefix_node, path, AE_NOT_EXIST);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 			status = AE_NOT_EXIST;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	/* Map the return object type to the bitmapped type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	switch ((info->return_object)->common.type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	case ACPI_TYPE_INTEGER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		return_btype = ACPI_BTYPE_INTEGER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	case ACPI_TYPE_BUFFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		return_btype = ACPI_BTYPE_BUFFER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	case ACPI_TYPE_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		return_btype = ACPI_BTYPE_STRING;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	case ACPI_TYPE_PACKAGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		return_btype = ACPI_BTYPE_PACKAGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		return_btype = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	if ((acpi_gbl_enable_interpreter_slack) && (!expected_return_btypes)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		 * We received a return object, but one was not expected. This can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 		 * happen frequently if the "implicit return" feature is enabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 		 * Just delete the return object and return AE_OK.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		acpi_ut_remove_reference(info->return_object);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	/* Is the return object one of the expected types? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	if (!(expected_return_btypes & return_btype)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		ACPI_ERROR_METHOD("Return object type is incorrect",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 				  prefix_node, path, AE_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 			    "Type returned from %s was incorrect: %s, expected Btypes: 0x%X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 			    path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 			    acpi_ut_get_object_type_name(info->return_object),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 			    expected_return_btypes));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		/* On error exit, we must delete the return object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		acpi_ut_remove_reference(info->return_object);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		status = AE_TYPE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	/* Object type is OK, return it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	*return_desc = info->return_object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) cleanup:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	ACPI_FREE(info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^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)  * FUNCTION:    acpi_ut_evaluate_numeric_object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  * PARAMETERS:  object_name         - Object name to be evaluated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  *              device_node         - Node for the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)  *              value               - Where the value is returned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  * DESCRIPTION: Evaluates a numeric namespace object for a selected device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)  *              and stores result in *Value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)  *              NOTE: Internal function, no parameter validation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) acpi_ut_evaluate_numeric_object(const char *object_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 				struct acpi_namespace_node *device_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 				u64 *value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	ACPI_FUNCTION_TRACE(ut_evaluate_numeric_object);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	status = acpi_ut_evaluate_object(device_node, object_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 					 ACPI_BTYPE_INTEGER, &obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 		return_ACPI_STATUS(status);
^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) 	/* Get the returned Integer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	*value = obj_desc->integer.value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	/* On exit, we must delete the return object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	acpi_ut_remove_reference(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)  * FUNCTION:    acpi_ut_execute_STA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)  * PARAMETERS:  device_node         - Node for the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)  *              flags               - Where the status flags are returned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)  * DESCRIPTION: Executes _STA for selected device and stores results in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  *              *Flags. If _STA does not exist, then the device is assumed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  *              to be present/functional/enabled (as per the ACPI spec).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  *              NOTE: Internal function, no parameter validation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	ACPI_FUNCTION_TRACE(ut_execute_STA);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 					 ACPI_BTYPE_INTEGER, &obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 		if (AE_NOT_FOUND == status) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 			 * if _STA does not exist, then (as per the ACPI specification),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 			 * the returned flags will indicate that the device is present,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 			 * functional, and enabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 			ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 					  "_STA on %4.4s was not found, assuming device is present\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 					  acpi_ut_get_node_name(device_node)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 			*flags = ACPI_UINT32_MAX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 			status = AE_OK;
^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) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	/* Extract the status flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	*flags = (u32) obj_desc->integer.value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	/* On exit, we must delete the return object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	acpi_ut_remove_reference(obj_desc);
^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_ut_execute_power_methods
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)  * PARAMETERS:  device_node         - Node for the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)  *              method_names        - Array of power method names
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)  *              method_count        - Number of methods to execute
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)  *              out_values          - Where the power method values are returned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)  * RETURN:      Status, out_values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)  * DESCRIPTION: Executes the specified power methods for the device and returns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)  *              the result(s).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)  *              NOTE: Internal function, no parameter validation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 			      const char **method_names,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 			      u8 method_count, u8 *out_values)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	acpi_status final_status = AE_NOT_FOUND;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	ACPI_FUNCTION_TRACE(ut_execute_power_methods);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	for (i = 0; i < method_count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 		 * Execute the power method (_sx_d or _sx_w). The only allowable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 		 * return type is an Integer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 		status = acpi_ut_evaluate_object(device_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 						 ACPI_CAST_PTR(char,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 							       method_names[i]),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 						 ACPI_BTYPE_INTEGER, &obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 		if (ACPI_SUCCESS(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 			out_values[i] = (u8)obj_desc->integer.value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 			/* Delete the return object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 			acpi_ut_remove_reference(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 			final_status = AE_OK;	/* At least one value is valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 		out_values[i] = ACPI_UINT8_MAX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 		if (status == AE_NOT_FOUND) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 			continue;	/* Ignore if not found */
^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,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 				  "Failed %s on Device %4.4s, %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 				  ACPI_CAST_PTR(char, method_names[i]),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 				  acpi_ut_get_node_name(device_node),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 				  acpi_format_exception(status)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 	return_ACPI_STATUS(final_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) }