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: dbtest - Various debug-related tests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    6)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    8) #include <acpi/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    9) #include "accommon.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   10) #include "acdebug.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   11) #include "acnamesp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   12) #include "acpredef.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   13) #include "acinterp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   15) #define _COMPONENT          ACPI_CA_DEBUGGER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   16) ACPI_MODULE_NAME("dbtest")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   18) /* Local prototypes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   19) static void acpi_db_test_all_objects(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   21) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   22) acpi_db_test_one_object(acpi_handle obj_handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   23) 			u32 nesting_level, void *context, void **return_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   25) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   26) acpi_db_test_integer_type(struct acpi_namespace_node *node, u32 bit_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   28) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   29) acpi_db_test_buffer_type(struct acpi_namespace_node *node, u32 bit_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   31) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   32) acpi_db_test_string_type(struct acpi_namespace_node *node, u32 byte_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   34) static acpi_status acpi_db_test_package_type(struct acpi_namespace_node *node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   36) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   37) acpi_db_test_field_unit_type(union acpi_operand_object *obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   39) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   40) acpi_db_read_from_object(struct acpi_namespace_node *node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   41) 			 acpi_object_type expected_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   42) 			 union acpi_object **value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   44) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   45) acpi_db_write_to_object(struct acpi_namespace_node *node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   46) 			union acpi_object *value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   48) static void acpi_db_evaluate_all_predefined_names(char *count_arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   50) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   51) acpi_db_evaluate_one_predefined_name(acpi_handle obj_handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   52) 				     u32 nesting_level,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   53) 				     void *context, void **return_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   55) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   56)  * Test subcommands
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   57)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   58) static struct acpi_db_argument_info acpi_db_test_types[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   59) 	{"OBJECTS"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   60) 	{"PREDEFINED"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   61) 	{NULL}			/* Must be null terminated */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   62) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   64) #define CMD_TEST_OBJECTS        0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   65) #define CMD_TEST_PREDEFINED     1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   67) #define BUFFER_FILL_VALUE       0xFF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   69) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   70)  * Support for the special debugger read/write control methods.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   71)  * These methods are installed into the current namespace and are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   72)  * used to read and write the various namespace objects. The point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   73)  * is to force the AML interpreter do all of the work.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   74)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   75) #define ACPI_DB_READ_METHOD     "\\_T98"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   76) #define ACPI_DB_WRITE_METHOD    "\\_T99"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   78) static acpi_handle read_handle = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   79) static acpi_handle write_handle = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   81) /* ASL Definitions of the debugger read/write control methods. AML below. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   83) #if 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   84) definition_block("ssdt.aml", "SSDT", 2, "Intel", "DEBUG", 0x00000001)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   85) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   86) 	method(_T98, 1, not_serialized) {	/* Read */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   87) 		return (de_ref_of(arg0))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   88) 	}
^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) definition_block("ssdt2.aml", "SSDT", 2, "Intel", "DEBUG", 0x00000001)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   92) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   93) 	method(_T99, 2, not_serialized) {	/* Write */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   94) 		store(arg1, arg0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   95) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   97) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   99) static unsigned char read_method_code[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  100) 	0x53, 0x53, 0x44, 0x54, 0x2E, 0x00, 0x00, 0x00,	/* 00000000    "SSDT...." */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  101) 	0x02, 0xC9, 0x49, 0x6E, 0x74, 0x65, 0x6C, 0x00,	/* 00000008    "..Intel." */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  102) 	0x44, 0x45, 0x42, 0x55, 0x47, 0x00, 0x00, 0x00,	/* 00000010    "DEBUG..." */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  103) 	0x01, 0x00, 0x00, 0x00, 0x49, 0x4E, 0x54, 0x4C,	/* 00000018    "....INTL" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  104) 	0x18, 0x12, 0x13, 0x20, 0x14, 0x09, 0x5F, 0x54,	/* 00000020    "... .._T" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  105) 	0x39, 0x38, 0x01, 0xA4, 0x83, 0x68	/* 00000028    "98...h"   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  106) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  108) static unsigned char write_method_code[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  109) 	0x53, 0x53, 0x44, 0x54, 0x2E, 0x00, 0x00, 0x00,	/* 00000000    "SSDT...." */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  110) 	0x02, 0x15, 0x49, 0x6E, 0x74, 0x65, 0x6C, 0x00,	/* 00000008    "..Intel." */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  111) 	0x44, 0x45, 0x42, 0x55, 0x47, 0x00, 0x00, 0x00,	/* 00000010    "DEBUG..." */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  112) 	0x01, 0x00, 0x00, 0x00, 0x49, 0x4E, 0x54, 0x4C,	/* 00000018    "....INTL" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  113) 	0x18, 0x12, 0x13, 0x20, 0x14, 0x09, 0x5F, 0x54,	/* 00000020    "... .._T" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  114) 	0x39, 0x39, 0x02, 0x70, 0x69, 0x68	/* 00000028    "99.pih"   */
^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) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  118)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  119)  * FUNCTION:    acpi_db_execute_test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  120)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  121)  * PARAMETERS:  type_arg        - Subcommand
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  122)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  123)  * RETURN:      None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  124)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  125)  * DESCRIPTION: Execute various debug tests.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  126)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  127)  * Note: Code is prepared for future expansion of the TEST command.
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  131) void acpi_db_execute_test(char *type_arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  132) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  133) 	u32 temp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  135) 	acpi_ut_strupr(type_arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  136) 	temp = acpi_db_match_argument(type_arg, acpi_db_test_types);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  137) 	if (temp == ACPI_TYPE_NOT_FOUND) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  138) 		acpi_os_printf("Invalid or unsupported argument\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  139) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  140) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  142) 	switch (temp) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  143) 	case CMD_TEST_OBJECTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  145) 		acpi_db_test_all_objects();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  146) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  148) 	case CMD_TEST_PREDEFINED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  150) 		acpi_db_evaluate_all_predefined_names(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  151) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  153) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  154) 		break;
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  158) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  159)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  160)  * FUNCTION:    acpi_db_test_all_objects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  161)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  162)  * PARAMETERS:  None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  163)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  164)  * RETURN:      None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  165)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  166)  * DESCRIPTION: This test implements the OBJECTS subcommand. It exercises the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  167)  *              namespace by reading/writing/comparing all data objects such
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  168)  *              as integers, strings, buffers, fields, buffer fields, etc.
^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) static void acpi_db_test_all_objects(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  173) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  174) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  176) 	/* Install the debugger read-object control method if necessary */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  178) 	if (!read_handle) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  179) 		status = acpi_install_method(read_method_code);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  180) 		if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  181) 			acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  182) 			    ("%s, Could not install debugger read method\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  183) 			     acpi_format_exception(status));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  184) 			return;
^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) 		status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  188) 		    acpi_get_handle(NULL, ACPI_DB_READ_METHOD, &read_handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  189) 		if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  190) 			acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  191) 			    ("Could not obtain handle for debug method %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  192) 			     ACPI_DB_READ_METHOD);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  193) 			return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  194) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  195) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  197) 	/* Install the debugger write-object control method if necessary */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  199) 	if (!write_handle) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  200) 		status = acpi_install_method(write_method_code);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  201) 		if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  202) 			acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  203) 			    ("%s, Could not install debugger write method\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  204) 			     acpi_format_exception(status));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  205) 			return;
^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) 		status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  209) 		    acpi_get_handle(NULL, ACPI_DB_WRITE_METHOD, &write_handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  210) 		if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  211) 			acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  212) 			    ("Could not obtain handle for debug method %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  213) 			     ACPI_DB_WRITE_METHOD);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  214) 			return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  215) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  216) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  217) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  218) 	/* Walk the entire namespace, testing each supported named data object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  220) 	(void)acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  221) 				  ACPI_UINT32_MAX, acpi_db_test_one_object,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  222) 				  NULL, NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  223) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  225) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  226)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  227)  * FUNCTION:    acpi_db_test_one_object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  228)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  229)  * PARAMETERS:  acpi_walk_callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  230)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  231)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  232)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  233)  * DESCRIPTION: Test one namespace object. Supported types are Integer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  234)  *              String, Buffer, Package, buffer_field, and field_unit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  235)  *              All other object types are simply ignored.
^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) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  240) acpi_db_test_one_object(acpi_handle obj_handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  241) 			u32 nesting_level, void *context, void **return_value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  242) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  243) 	struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  244) 	union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  245) 	acpi_object_type local_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  246) 	u32 bit_length = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  247) 	u32 byte_length = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  248) 	acpi_status status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  250) 	node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  251) 	obj_desc = node->object;
^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) 	 * For the supported types, get the actual bit length or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  255) 	 * byte length. Map the type to one of Integer/String/Buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  256) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  257) 	switch (node->type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  258) 	case ACPI_TYPE_INTEGER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  259) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  260) 		/* Integer width is either 32 or 64 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  261) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  262) 		local_type = ACPI_TYPE_INTEGER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  263) 		bit_length = acpi_gbl_integer_bit_width;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  264) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  265) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  266) 	case ACPI_TYPE_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  268) 		local_type = ACPI_TYPE_STRING;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  269) 		byte_length = obj_desc->string.length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  270) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  272) 	case ACPI_TYPE_BUFFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  274) 		local_type = ACPI_TYPE_BUFFER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  275) 		byte_length = obj_desc->buffer.length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  276) 		bit_length = byte_length * 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  277) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  278) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  279) 	case ACPI_TYPE_PACKAGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  280) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  281) 		local_type = ACPI_TYPE_PACKAGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  282) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  283) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  284) 	case ACPI_TYPE_FIELD_UNIT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  285) 	case ACPI_TYPE_LOCAL_REGION_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  286) 	case ACPI_TYPE_LOCAL_INDEX_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  287) 	case ACPI_TYPE_LOCAL_BANK_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  289) 		local_type = ACPI_TYPE_FIELD_UNIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  290) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  291) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  292) 	case ACPI_TYPE_BUFFER_FIELD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  293) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  294) 		 * The returned object will be a Buffer if the field length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  295) 		 * is larger than the size of an Integer (32 or 64 bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  296) 		 * depending on the DSDT version).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  297) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  298) 		local_type = ACPI_TYPE_INTEGER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  299) 		if (obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  300) 			bit_length = obj_desc->common_field.bit_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  301) 			byte_length = ACPI_ROUND_BITS_UP_TO_BYTES(bit_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  302) 			if (bit_length > acpi_gbl_integer_bit_width) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  303) 				local_type = ACPI_TYPE_BUFFER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  304) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  305) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  306) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  307) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  308) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  309) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  310) 		/* Ignore all non-data types - Methods, Devices, Scopes, etc. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  311) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  312) 		return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  313) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  314) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  315) 	/* Emit the common prefix: Type:Name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  316) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  317) 	acpi_os_printf("%14s: %4.4s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  318) 		       acpi_ut_get_type_name(node->type), node->name.ascii);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  319) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  320) 	if (!obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  321) 		acpi_os_printf(" No attached sub-object, ignoring\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  322) 		return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  323) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  324) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  325) 	/* At this point, we have resolved the object to one of the major types */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  326) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  327) 	switch (local_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  328) 	case ACPI_TYPE_INTEGER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  329) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  330) 		status = acpi_db_test_integer_type(node, bit_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  331) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  332) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  333) 	case ACPI_TYPE_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  334) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  335) 		status = acpi_db_test_string_type(node, byte_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  336) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  337) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  338) 	case ACPI_TYPE_BUFFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  339) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  340) 		status = acpi_db_test_buffer_type(node, bit_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  341) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  342) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  343) 	case ACPI_TYPE_PACKAGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  344) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  345) 		status = acpi_db_test_package_type(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  346) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  347) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  348) 	case ACPI_TYPE_FIELD_UNIT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  349) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  350) 		status = acpi_db_test_field_unit_type(obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  351) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  352) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  353) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  354) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  355) 		acpi_os_printf(" Ignoring, type not implemented (%2.2X)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  356) 			       local_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  357) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  358) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  359) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  360) 	/* Exit on error, but don't abort the namespace walk */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  361) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  362) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  363) 		status = AE_OK;
^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) 	acpi_os_printf("\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  367) 	return (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) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  371)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  372)  * FUNCTION:    acpi_db_test_integer_type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  373)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  374)  * PARAMETERS:  node                - Parent NS node for the object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  375)  *              bit_length          - Actual length of the object. Used for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  376)  *                                    support of arbitrary length field_unit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  377)  *                                    and buffer_field objects.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  378)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  379)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  380)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  381)  * DESCRIPTION: Test read/write for an Integer-valued object. Performs a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  382)  *              write/read/compare of an arbitrary new value, then performs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  383)  *              a write/read/compare of the original value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  384)  *
^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) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  388) acpi_db_test_integer_type(struct acpi_namespace_node *node, u32 bit_length)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  389) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  390) 	union acpi_object *temp1 = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  391) 	union acpi_object *temp2 = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  392) 	union acpi_object *temp3 = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  393) 	union acpi_object write_value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  394) 	u64 value_to_write;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  395) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  396) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  397) 	if (bit_length > 64) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  398) 		acpi_os_printf(" Invalid length for an Integer: %u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  399) 			       bit_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  400) 		return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  401) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  403) 	/* Read the original value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  404) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  405) 	status = acpi_db_read_from_object(node, ACPI_TYPE_INTEGER, &temp1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  406) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  407) 		return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  408) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  409) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  410) 	acpi_os_printf(ACPI_DEBUG_LENGTH_FORMAT " %8.8X%8.8X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  411) 		       bit_length, ACPI_ROUND_BITS_UP_TO_BYTES(bit_length),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  412) 		       ACPI_FORMAT_UINT64(temp1->integer.value));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  413) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  414) 	value_to_write = ACPI_UINT64_MAX >> (64 - bit_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  415) 	if (temp1->integer.value == value_to_write) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  416) 		value_to_write = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  417) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  418) 	/* Write a new value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  419) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  420) 	write_value.type = ACPI_TYPE_INTEGER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  421) 	write_value.integer.value = value_to_write;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  422) 	status = acpi_db_write_to_object(node, &write_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  423) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  424) 		goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  425) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  426) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  427) 	/* Ensure that we can read back the new value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  428) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  429) 	status = acpi_db_read_from_object(node, ACPI_TYPE_INTEGER, &temp2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  430) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  431) 		goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  432) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  433) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  434) 	if (temp2->integer.value != value_to_write) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  435) 		acpi_os_printf(" MISMATCH 2: %8.8X%8.8X, expecting %8.8X%8.8X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  436) 			       ACPI_FORMAT_UINT64(temp2->integer.value),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  437) 			       ACPI_FORMAT_UINT64(value_to_write));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  438) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  439) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  440) 	/* Write back the original value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  441) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  442) 	write_value.integer.value = temp1->integer.value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  443) 	status = acpi_db_write_to_object(node, &write_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  444) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  445) 		goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  446) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  447) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  448) 	/* Ensure that we can read back the original value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  449) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  450) 	status = acpi_db_read_from_object(node, ACPI_TYPE_INTEGER, &temp3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  451) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  452) 		goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  453) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  454) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  455) 	if (temp3->integer.value != temp1->integer.value) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  456) 		acpi_os_printf(" MISMATCH 3: %8.8X%8.8X, expecting %8.8X%8.8X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  457) 			       ACPI_FORMAT_UINT64(temp3->integer.value),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  458) 			       ACPI_FORMAT_UINT64(temp1->integer.value));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  459) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  460) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  461) exit:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  462) 	if (temp1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  463) 		acpi_os_free(temp1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  464) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  465) 	if (temp2) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  466) 		acpi_os_free(temp2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  467) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  468) 	if (temp3) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  469) 		acpi_os_free(temp3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  470) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  471) 	return (AE_OK);
^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) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  475)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  476)  * FUNCTION:    acpi_db_test_buffer_type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  477)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  478)  * PARAMETERS:  node                - Parent NS node for the object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  479)  *              bit_length          - Actual length of the object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  480)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  481)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  482)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  483)  * DESCRIPTION: Test read/write for an Buffer-valued object. Performs a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  484)  *              write/read/compare of an arbitrary new value, then performs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  485)  *              a write/read/compare of the original value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  486)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  487)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  488) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  489) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  490) acpi_db_test_buffer_type(struct acpi_namespace_node *node, u32 bit_length)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  491) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  492) 	union acpi_object *temp1 = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  493) 	union acpi_object *temp2 = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  494) 	union acpi_object *temp3 = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  495) 	u8 *buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  496) 	union acpi_object write_value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  497) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  498) 	u32 byte_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  499) 	u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  500) 	u8 extra_bits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  501) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  502) 	byte_length = ACPI_ROUND_BITS_UP_TO_BYTES(bit_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  503) 	if (byte_length == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  504) 		acpi_os_printf(" Ignoring zero length buffer");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  505) 		return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  506) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  507) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  508) 	/* Allocate a local buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  509) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  510) 	buffer = ACPI_ALLOCATE_ZEROED(byte_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  511) 	if (!buffer) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  512) 		return (AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  513) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  514) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  515) 	/* Read the original value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  516) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  517) 	status = acpi_db_read_from_object(node, ACPI_TYPE_BUFFER, &temp1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  518) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  519) 		goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  520) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  521) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  522) 	/* Emit a few bytes of the buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  523) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  524) 	acpi_os_printf(ACPI_DEBUG_LENGTH_FORMAT, bit_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  525) 		       temp1->buffer.length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  526) 	for (i = 0; ((i < 8) && (i < byte_length)); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  527) 		acpi_os_printf(" %2.2X", temp1->buffer.pointer[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  528) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  529) 	acpi_os_printf("... ");
^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) 	 * Write a new value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  533) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  534) 	 * Handle possible extra bits at the end of the buffer. Can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  535) 	 * happen for field_units larger than an integer, but the bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  536) 	 * count is not an integral number of bytes. Zero out the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  537) 	 * unused bits.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  538) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  539) 	memset(buffer, BUFFER_FILL_VALUE, byte_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  540) 	extra_bits = bit_length % 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  541) 	if (extra_bits) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  542) 		buffer[byte_length - 1] = ACPI_MASK_BITS_ABOVE(extra_bits);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  543) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  544) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  545) 	write_value.type = ACPI_TYPE_BUFFER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  546) 	write_value.buffer.length = byte_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  547) 	write_value.buffer.pointer = buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  548) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  549) 	status = acpi_db_write_to_object(node, &write_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  550) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  551) 		goto exit;
^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) 	/* Ensure that we can read back the new value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  555) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  556) 	status = acpi_db_read_from_object(node, ACPI_TYPE_BUFFER, &temp2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  557) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  558) 		goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  559) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  560) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  561) 	if (memcmp(temp2->buffer.pointer, buffer, byte_length)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  562) 		acpi_os_printf(" MISMATCH 2: New buffer value");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  563) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  564) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  565) 	/* Write back the original value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  566) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  567) 	write_value.buffer.length = byte_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  568) 	write_value.buffer.pointer = temp1->buffer.pointer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  569) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  570) 	status = acpi_db_write_to_object(node, &write_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  571) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  572) 		goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  573) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  574) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  575) 	/* Ensure that we can read back the original value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  576) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  577) 	status = acpi_db_read_from_object(node, ACPI_TYPE_BUFFER, &temp3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  578) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  579) 		goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  580) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  581) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  582) 	if (memcmp(temp1->buffer.pointer, temp3->buffer.pointer, byte_length)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  583) 		acpi_os_printf(" MISMATCH 3: While restoring original buffer");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  584) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  585) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  586) exit:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  587) 	ACPI_FREE(buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  588) 	if (temp1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  589) 		acpi_os_free(temp1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  590) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  591) 	if (temp2) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  592) 		acpi_os_free(temp2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  593) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  594) 	if (temp3) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  595) 		acpi_os_free(temp3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  596) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  597) 	return (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) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  601)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  602)  * FUNCTION:    acpi_db_test_string_type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  603)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  604)  * PARAMETERS:  node                - Parent NS node for the object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  605)  *              byte_length         - Actual length of the object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  606)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  607)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  608)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  609)  * DESCRIPTION: Test read/write for an String-valued object. Performs a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  610)  *              write/read/compare of an arbitrary new value, then performs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  611)  *              a write/read/compare of the original value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  612)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  613)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  614) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  615) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  616) acpi_db_test_string_type(struct acpi_namespace_node *node, u32 byte_length)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  617) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  618) 	union acpi_object *temp1 = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  619) 	union acpi_object *temp2 = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  620) 	union acpi_object *temp3 = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  621) 	char *value_to_write = "Test String from AML Debugger";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  622) 	union acpi_object write_value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  623) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  624) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  625) 	/* Read the original value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  626) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  627) 	status = acpi_db_read_from_object(node, ACPI_TYPE_STRING, &temp1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  628) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  629) 		return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  630) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  631) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  632) 	acpi_os_printf(ACPI_DEBUG_LENGTH_FORMAT " \"%s\"",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  633) 		       (temp1->string.length * 8), temp1->string.length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  634) 		       temp1->string.pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  635) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  636) 	/* Write a new value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  637) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  638) 	write_value.type = ACPI_TYPE_STRING;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  639) 	write_value.string.length = strlen(value_to_write);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  640) 	write_value.string.pointer = value_to_write;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  641) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  642) 	status = acpi_db_write_to_object(node, &write_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  643) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  644) 		goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  645) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  646) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  647) 	/* Ensure that we can read back the new value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  648) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  649) 	status = acpi_db_read_from_object(node, ACPI_TYPE_STRING, &temp2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  650) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  651) 		goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  652) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  653) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  654) 	if (strcmp(temp2->string.pointer, value_to_write)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  655) 		acpi_os_printf(" MISMATCH 2: %s, expecting %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  656) 			       temp2->string.pointer, value_to_write);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  657) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  658) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  659) 	/* Write back the original value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  660) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  661) 	write_value.string.length = strlen(temp1->string.pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  662) 	write_value.string.pointer = temp1->string.pointer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  663) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  664) 	status = acpi_db_write_to_object(node, &write_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  665) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  666) 		goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  667) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  668) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  669) 	/* Ensure that we can read back the original value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  670) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  671) 	status = acpi_db_read_from_object(node, ACPI_TYPE_STRING, &temp3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  672) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  673) 		goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  674) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  675) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  676) 	if (strcmp(temp1->string.pointer, temp3->string.pointer)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  677) 		acpi_os_printf(" MISMATCH 3: %s, expecting %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  678) 			       temp3->string.pointer, temp1->string.pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  679) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  680) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  681) exit:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  682) 	if (temp1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  683) 		acpi_os_free(temp1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  684) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  685) 	if (temp2) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  686) 		acpi_os_free(temp2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  687) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  688) 	if (temp3) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  689) 		acpi_os_free(temp3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  690) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  691) 	return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  692) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  693) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  694) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  695)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  696)  * FUNCTION:    acpi_db_test_package_type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  697)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  698)  * PARAMETERS:  node                - Parent NS node for the object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  699)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  700)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  701)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  702)  * DESCRIPTION: Test read for a Package object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  703)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  704)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  705) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  706) static acpi_status acpi_db_test_package_type(struct acpi_namespace_node *node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  707) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  708) 	union acpi_object *temp1 = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  709) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  710) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  711) 	/* Read the original value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  712) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  713) 	status = acpi_db_read_from_object(node, ACPI_TYPE_PACKAGE, &temp1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  714) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  715) 		return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  716) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  717) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  718) 	acpi_os_printf(" %.2X Elements", temp1->package.count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  719) 	acpi_os_free(temp1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  720) 	return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  721) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  722) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  723) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  724)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  725)  * FUNCTION:    acpi_db_test_field_unit_type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  726)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  727)  * PARAMETERS:  obj_desc                - A field unit object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  728)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  729)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  730)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  731)  * DESCRIPTION: Test read/write on a named field unit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  732)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  733)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  734) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  735) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  736) acpi_db_test_field_unit_type(union acpi_operand_object *obj_desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  737) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  738) 	union acpi_operand_object *region_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  739) 	u32 bit_length = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  740) 	u32 byte_length = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  741) 	acpi_status status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  742) 	union acpi_operand_object *ret_buffer_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  743) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  744) 	/* Supported spaces are memory/io/pci_config */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  745) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  746) 	region_obj = obj_desc->field.region_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  747) 	switch (region_obj->region.space_id) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  748) 	case ACPI_ADR_SPACE_SYSTEM_MEMORY:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  749) 	case ACPI_ADR_SPACE_SYSTEM_IO:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  750) 	case ACPI_ADR_SPACE_PCI_CONFIG:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  751) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  752) 		/* Need the interpreter to execute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  753) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  754) 		acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  755) 		acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  756) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  757) 		/* Exercise read-then-write */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  758) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  759) 		status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  760) 		    acpi_ex_read_data_from_field(NULL, obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  761) 						 &ret_buffer_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  762) 		if (status == AE_OK) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  763) 			acpi_ex_write_data_to_field(ret_buffer_desc, obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  764) 						    NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  765) 			acpi_ut_remove_reference(ret_buffer_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  766) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  767) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  768) 		acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  769) 		acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  770) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  771) 		bit_length = obj_desc->common_field.bit_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  772) 		byte_length = ACPI_ROUND_BITS_UP_TO_BYTES(bit_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  773) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  774) 		acpi_os_printf(ACPI_DEBUG_LENGTH_FORMAT " [%s]", bit_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  775) 			       byte_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  776) 			       acpi_ut_get_region_name(region_obj->region.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  777) 						       space_id));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  778) 		return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  779) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  780) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  781) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  782) 		acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  783) 		    ("      %s address space is not supported in this command [%4.4s]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  784) 		     acpi_ut_get_region_name(region_obj->region.space_id),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  785) 		     region_obj->region.node->name.ascii);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  786) 		return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  787) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  788) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  789) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  790) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  791)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  792)  * FUNCTION:    acpi_db_read_from_object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  793)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  794)  * PARAMETERS:  node                - Parent NS node for the object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  795)  *              expected_type       - Object type expected from the read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  796)  *              value               - Where the value read is returned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  797)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  798)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  799)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  800)  * DESCRIPTION: Performs a read from the specified object by invoking the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  801)  *              special debugger control method that reads the object. Thus,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  802)  *              the AML interpreter is doing all of the work, increasing the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  803)  *              validity of the test.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  804)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  805)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  806) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  807) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  808) acpi_db_read_from_object(struct acpi_namespace_node *node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  809) 			 acpi_object_type expected_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  810) 			 union acpi_object **value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  811) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  812) 	union acpi_object *ret_value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  813) 	struct acpi_object_list param_objects;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  814) 	union acpi_object params[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  815) 	struct acpi_buffer return_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  816) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  817) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  818) 	params[0].type = ACPI_TYPE_LOCAL_REFERENCE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  819) 	params[0].reference.actual_type = node->type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  820) 	params[0].reference.handle = ACPI_CAST_PTR(acpi_handle, node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  821) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  822) 	param_objects.count = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  823) 	param_objects.pointer = params;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  824) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  825) 	return_obj.length = ACPI_ALLOCATE_BUFFER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  826) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  827) 	acpi_gbl_method_executing = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  828) 	status = acpi_evaluate_object(read_handle, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  829) 				      &param_objects, &return_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  830) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  831) 	acpi_gbl_method_executing = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  832) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  833) 		acpi_os_printf("Could not read from object, %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  834) 			       acpi_format_exception(status));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  835) 		return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  836) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  837) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  838) 	ret_value = (union acpi_object *)return_obj.pointer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  839) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  840) 	switch (ret_value->type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  841) 	case ACPI_TYPE_INTEGER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  842) 	case ACPI_TYPE_BUFFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  843) 	case ACPI_TYPE_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  844) 	case ACPI_TYPE_PACKAGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  845) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  846) 		 * Did we receive the type we wanted? Most important for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  847) 		 * Integer/Buffer case (when a field is larger than an Integer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  848) 		 * it should return a Buffer).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  849) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  850) 		if (ret_value->type != expected_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  851) 			acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  852) 			    (" Type mismatch: Expected %s, Received %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  853) 			     acpi_ut_get_type_name(expected_type),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  854) 			     acpi_ut_get_type_name(ret_value->type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  855) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  856) 			acpi_os_free(return_obj.pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  857) 			return (AE_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  858) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  859) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  860) 		*value = ret_value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  861) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  862) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  863) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  864) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  865) 		acpi_os_printf(" Unsupported return object type, %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  866) 			       acpi_ut_get_type_name(ret_value->type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  867) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  868) 		acpi_os_free(return_obj.pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  869) 		return (AE_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  870) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  871) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  872) 	return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  873) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  874) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  875) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  876)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  877)  * FUNCTION:    acpi_db_write_to_object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  878)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  879)  * PARAMETERS:  node                - Parent NS node for the object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  880)  *              value               - Value to be written
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  881)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  882)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  883)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  884)  * DESCRIPTION: Performs a write to the specified object by invoking the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  885)  *              special debugger control method that writes the object. Thus,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  886)  *              the AML interpreter is doing all of the work, increasing the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  887)  *              validity of the test.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  888)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  889)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  890) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  891) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  892) acpi_db_write_to_object(struct acpi_namespace_node *node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  893) 			union acpi_object *value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  894) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  895) 	struct acpi_object_list param_objects;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  896) 	union acpi_object params[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  897) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  898) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  899) 	params[0].type = ACPI_TYPE_LOCAL_REFERENCE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  900) 	params[0].reference.actual_type = node->type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  901) 	params[0].reference.handle = ACPI_CAST_PTR(acpi_handle, node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  902) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  903) 	/* Copy the incoming user parameter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  904) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  905) 	memcpy(&params[1], value, sizeof(union acpi_object));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  906) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  907) 	param_objects.count = 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  908) 	param_objects.pointer = params;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  909) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  910) 	acpi_gbl_method_executing = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  911) 	status = acpi_evaluate_object(write_handle, NULL, &param_objects, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  912) 	acpi_gbl_method_executing = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  913) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  914) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  915) 		acpi_os_printf("Could not write to object, %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  916) 			       acpi_format_exception(status));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  917) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  918) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  919) 	return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  920) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  921) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  922) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  923)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  924)  * FUNCTION:    acpi_db_evaluate_all_predefined_names
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  925)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  926)  * PARAMETERS:  count_arg           - Max number of methods to execute
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  927)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  928)  * RETURN:      None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  929)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  930)  * DESCRIPTION: Namespace batch execution. Execute predefined names in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  931)  *              namespace, up to the max count, if specified.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  932)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  933)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  934) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  935) static void acpi_db_evaluate_all_predefined_names(char *count_arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  936) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  937) 	struct acpi_db_execute_walk info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  938) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  939) 	info.count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  940) 	info.max_count = ACPI_UINT32_MAX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  941) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  942) 	if (count_arg) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  943) 		info.max_count = strtoul(count_arg, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  944) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  945) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  946) 	/* Search all nodes in namespace */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  947) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  948) 	(void)acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  949) 				  ACPI_UINT32_MAX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  950) 				  acpi_db_evaluate_one_predefined_name, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  951) 				  (void *)&info, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  952) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  953) 	acpi_os_printf("Evaluated %u predefined names in the namespace\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  954) 		       info.count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  955) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  956) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  957) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  958)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  959)  * FUNCTION:    acpi_db_evaluate_one_predefined_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  960)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  961)  * PARAMETERS:  Callback from walk_namespace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  962)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  963)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  964)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  965)  * DESCRIPTION: Batch execution module. Currently only executes predefined
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  966)  *              ACPI names.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  967)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  968)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  969) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  970) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  971) acpi_db_evaluate_one_predefined_name(acpi_handle obj_handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  972) 				     u32 nesting_level,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  973) 				     void *context, void **return_value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  974) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  975) 	struct acpi_namespace_node *node =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  976) 	    (struct acpi_namespace_node *)obj_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  977) 	struct acpi_db_execute_walk *info =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  978) 	    (struct acpi_db_execute_walk *)context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  979) 	char *pathname;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  980) 	const union acpi_predefined_info *predefined;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  981) 	struct acpi_device_info *obj_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  982) 	struct acpi_object_list param_objects;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  983) 	union acpi_object params[ACPI_METHOD_NUM_ARGS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  984) 	union acpi_object *this_param;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  985) 	struct acpi_buffer return_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  986) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  987) 	u16 arg_type_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  988) 	u8 arg_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  989) 	u8 arg_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  990) 	u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  991) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  992) 	/* The name must be a predefined ACPI name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  993) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  994) 	predefined = acpi_ut_match_predefined_method(node->name.ascii);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  995) 	if (!predefined) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  996) 		return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  997) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  998) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  999) 	if (node->type == ACPI_TYPE_LOCAL_SCOPE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000) 		return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003) 	pathname = acpi_ns_get_normalized_pathname(node, TRUE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004) 	if (!pathname) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005) 		return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008) 	/* Get the object info for number of method parameters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) 	status = acpi_get_object_info(obj_handle, &obj_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012) 		ACPI_FREE(pathname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013) 		return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016) 	param_objects.count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) 	param_objects.pointer = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) 	if (obj_info->type == ACPI_TYPE_METHOD) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021) 		/* Setup default parameters (with proper types) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) 		arg_type_list = predefined->info.argument_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) 		arg_count = METHOD_GET_ARG_COUNT(arg_type_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) 		 * Setup the ACPI-required number of arguments, regardless of what
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028) 		 * the actual method defines. If there is a difference, then the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029) 		 * method is wrong and a warning will be issued during execution.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031) 		this_param = params;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032) 		for (i = 0; i < arg_count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) 			arg_type = METHOD_GET_NEXT_TYPE(arg_type_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034) 			this_param->type = arg_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036) 			switch (arg_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037) 			case ACPI_TYPE_INTEGER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) 				this_param->integer.value = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042) 			case ACPI_TYPE_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044) 				this_param->string.pointer =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045) 				    "This is the default argument string";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046) 				this_param->string.length =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047) 				    strlen(this_param->string.pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050) 			case ACPI_TYPE_BUFFER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) 				this_param->buffer.pointer = (u8 *)params;	/* just a garbage buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053) 				this_param->buffer.length = 48;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056) 			case ACPI_TYPE_PACKAGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058) 				this_param->package.elements = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059) 				this_param->package.count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062) 			default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064) 				acpi_os_printf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065) 				    ("%s: Unsupported argument type: %u\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066) 				     pathname, arg_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070) 			this_param++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1073) 		param_objects.count = arg_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1074) 		param_objects.pointer = params;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1075) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1076) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1077) 	ACPI_FREE(obj_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1078) 	return_obj.pointer = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1079) 	return_obj.length = ACPI_ALLOCATE_BUFFER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1080) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1081) 	/* Do the actual method execution */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1082) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1083) 	acpi_gbl_method_executing = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1084) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1085) 	status = acpi_evaluate_object(node, NULL, &param_objects, &return_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1086) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1087) 	acpi_os_printf("%-32s returned %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1088) 		       pathname, acpi_format_exception(status));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1089) 	acpi_gbl_method_executing = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1090) 	ACPI_FREE(pathname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1091) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1092) 	/* Ignore status from method execution */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1093) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1094) 	status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1095) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1096) 	/* Update count, check if we have executed enough methods */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1097) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1098) 	info->count++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1099) 	if (info->count >= info->max_count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1100) 		status = AE_CTRL_TERMINATE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1101) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1103) 	return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1104) }