^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: nsparse - namespace interface to AML parser
^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) #include "acparser.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include "acdispat.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "actables.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "acinterp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define _COMPONENT ACPI_NAMESPACE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) ACPI_MODULE_NAME("nsparse")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * FUNCTION: ns_execute_table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * PARAMETERS: table_desc - An ACPI table descriptor for table to parse
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * start_node - Where to enter the table into the namespace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * DESCRIPTION: Load ACPI/AML table by executing the entire table as a single
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * large control method.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * NOTE: The point of this is to execute any module-level code in-place
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * as the table is parsed. Some AML code depends on this behavior.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * It is a run-time option at this time, but will eventually become
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * the default.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * Note: This causes the table to only have a single-pass parse.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * However, this is compatible with other ACPI implementations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) acpi_ns_execute_table(u32 table_index, struct acpi_namespace_node *start_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct acpi_table_header *table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) acpi_owner_id owner_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) struct acpi_evaluate_info *info = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) u32 aml_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) u8 *aml_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) union acpi_operand_object *method_obj = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) ACPI_FUNCTION_TRACE(ns_execute_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) status = acpi_get_table_by_index(table_index, &table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) /* Table must consist of at least a complete header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) if (table->length < sizeof(struct acpi_table_header)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) return_ACPI_STATUS(AE_BAD_HEADER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) aml_start = (u8 *)table + sizeof(struct acpi_table_header);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) aml_length = table->length - sizeof(struct acpi_table_header);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) status = acpi_tb_get_owner_id(table_index, &owner_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) return_ACPI_STATUS(status);
^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) /* Create, initialize, and link a new temporary method object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) method_obj = acpi_ut_create_internal_object(ACPI_TYPE_METHOD);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) if (!method_obj) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) return_ACPI_STATUS(AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) /* Allocate the evaluation information block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) if (!info) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) status = AE_NO_MEMORY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) goto cleanup;
^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) ACPI_DEBUG_PRINT_RAW((ACPI_DB_PARSE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) "%s: Create table pseudo-method for [%4.4s] @%p, method %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) ACPI_GET_FUNCTION_NAME, table->signature, table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) method_obj));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) method_obj->method.aml_start = aml_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) method_obj->method.aml_length = aml_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) method_obj->method.owner_id = owner_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) method_obj->method.info_flags |= ACPI_METHOD_MODULE_LEVEL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) info->pass_number = ACPI_IMODE_EXECUTE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) info->node = start_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) info->obj_desc = method_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) info->node_flags = info->node->flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) info->full_pathname = acpi_ns_get_normalized_pathname(info->node, TRUE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) if (!info->full_pathname) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) status = AE_NO_MEMORY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) /* Optional object evaluation log */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) ACPI_DEBUG_PRINT_RAW((ACPI_DB_EVALUATION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) "%-26s: (Definition Block level)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) "Module-level evaluation"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) status = acpi_ps_execute_table(info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) /* Optional object evaluation log */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) ACPI_DEBUG_PRINT_RAW((ACPI_DB_EVALUATION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) "%-26s: (Definition Block level)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) "Module-level complete"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) cleanup:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) if (info) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) ACPI_FREE(info->full_pathname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) info->full_pathname = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) ACPI_FREE(info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) acpi_ut_remove_reference(method_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) * FUNCTION: ns_one_complete_parse
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) * PARAMETERS: pass_number - 1 or 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * table_desc - The table to be parsed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) * DESCRIPTION: Perform one complete parse of an ACPI/AML table.
^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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) acpi_ns_one_complete_parse(u32 pass_number,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) u32 table_index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) struct acpi_namespace_node *start_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) union acpi_parse_object *parse_root;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) u32 aml_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) u8 *aml_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) struct acpi_walk_state *walk_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) struct acpi_table_header *table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) acpi_owner_id owner_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) ACPI_FUNCTION_TRACE(ns_one_complete_parse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) status = acpi_get_table_by_index(table_index, &table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) /* Table must consist of at least a complete header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) if (table->length < sizeof(struct acpi_table_header)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) return_ACPI_STATUS(AE_BAD_HEADER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) aml_start = (u8 *)table + sizeof(struct acpi_table_header);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) aml_length = table->length - sizeof(struct acpi_table_header);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) status = acpi_tb_get_owner_id(table_index, &owner_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) /* Create and init a Root Node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) parse_root = acpi_ps_create_scope_op(aml_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) if (!parse_root) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) return_ACPI_STATUS(AE_NO_MEMORY);
^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) /* Create and initialize a new walk state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) walk_state = acpi_ds_create_walk_state(owner_id, NULL, NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) if (!walk_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) acpi_ps_free_op(parse_root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) return_ACPI_STATUS(AE_NO_MEMORY);
^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) status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) aml_start, aml_length, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) (u8)pass_number);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) acpi_ds_delete_walk_state(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) /* Found OSDT table, enable the namespace override feature */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) if (ACPI_COMPARE_NAMESEG(table->signature, ACPI_SIG_OSDT) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) pass_number == ACPI_IMODE_LOAD_PASS1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) walk_state->namespace_override = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) /* start_node is the default location to load the table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) if (start_node && start_node != acpi_gbl_root_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) acpi_ds_scope_stack_push(start_node, ACPI_TYPE_METHOD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) acpi_ds_delete_walk_state(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) goto cleanup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) /* Parse the AML */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) "*PARSE* pass %u parse\n", pass_number));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) acpi_ex_enter_interpreter();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) status = acpi_ps_parse_aml(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) acpi_ex_exit_interpreter();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) cleanup:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) acpi_ps_delete_parse_tree(parse_root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)
^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) * FUNCTION: acpi_ns_parse_table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) * PARAMETERS: table_desc - An ACPI table descriptor for table to parse
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) * start_node - Where to enter the table into the namespace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) * DESCRIPTION: Parse AML within an ACPI table and return a tree of ops
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) ACPI_FUNCTION_TRACE(ns_parse_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) * Executes the AML table as one large control method.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) * The point of this is to execute any module-level code in-place
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) * as the table is parsed. Some AML code depends on this behavior.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) * Note: This causes the table to only have a single-pass parse.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) * However, this is compatible with other ACPI implementations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) ACPI_DEBUG_PRINT_RAW((ACPI_DB_PARSE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) "%s: **** Start table execution pass\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) ACPI_GET_FUNCTION_NAME));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) status = acpi_ns_execute_table(table_index, start_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) }