hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/acpi/acpica/dswload2.c
....@@ -3,7 +3,7 @@
33 *
44 * Module Name: dswload2 - Dispatcher second pass namespace load callbacks
55 *
6
- * Copyright (C) 2000 - 2018, Intel Corp.
6
+ * Copyright (C) 2000 - 2020, Intel Corp.
77 *
88 *****************************************************************************/
99
....@@ -15,6 +15,9 @@
1515 #include "acinterp.h"
1616 #include "acnamesp.h"
1717 #include "acevents.h"
18
+#ifdef ACPI_EXEC_APP
19
+#include "aecommon.h"
20
+#endif
1821
1922 #define _COMPONENT ACPI_DISPATCHER
2023 ACPI_MODULE_NAME("dswload2")
....@@ -24,7 +27,7 @@
2427 * FUNCTION: acpi_ds_load2_begin_op
2528 *
2629 * PARAMETERS: walk_state - Current state of the parse tree walk
27
- * out_op - Wher to return op if a new one is created
30
+ * out_op - Where to return op if a new one is created
2831 *
2932 * RETURN: Status
3033 *
....@@ -296,6 +299,14 @@
296299 }
297300 #endif
298301
302
+ /*
303
+ * For name creation opcodes, the full namepath prefix must
304
+ * exist, except for the final (new) nameseg.
305
+ */
306
+ if (walk_state->op_info->flags & AML_NAMED) {
307
+ flags |= ACPI_NS_PREFIX_MUST_EXIST;
308
+ }
309
+
299310 /* Add new entry or lookup existing entry */
300311
301312 status =
....@@ -363,9 +374,11 @@
363374 struct acpi_namespace_node *node;
364375 union acpi_parse_object *arg;
365376 struct acpi_namespace_node *new_node;
366
-#ifndef ACPI_NO_METHOD_EXECUTION
367377 u32 i;
368378 u8 region_space;
379
+#ifdef ACPI_EXEC_APP
380
+ union acpi_operand_object *obj_desc;
381
+ char *namepath;
369382 #endif
370383
371384 ACPI_FUNCTION_TRACE(ds_load2_end_op);
....@@ -453,7 +466,6 @@
453466 arg = op->common.value.arg;
454467
455468 switch (walk_state->op_info->type) {
456
-#ifndef ACPI_NO_METHOD_EXECUTION
457469
458470 case AML_TYPE_CREATE_FIELD:
459471 /*
....@@ -461,6 +473,11 @@
461473 * be evaluated later during the execution phase
462474 */
463475 status = acpi_ds_create_buffer_field(op, walk_state);
476
+ if (ACPI_FAILURE(status)) {
477
+ ACPI_EXCEPTION((AE_INFO, status,
478
+ "CreateBufferField failure"));
479
+ goto cleanup;
480
+ }
464481 break;
465482
466483 case AML_TYPE_NAMED_FIELD:
....@@ -550,12 +567,10 @@
550567 }
551568
552569 break;
553
-#endif /* ACPI_NO_METHOD_EXECUTION */
554570
555571 case AML_TYPE_NAMED_COMPLEX:
556572
557573 switch (op->common.aml_opcode) {
558
-#ifndef ACPI_NO_METHOD_EXECUTION
559574 case AML_REGION_OP:
560575 case AML_DATA_REGION_OP:
561576
....@@ -601,6 +616,29 @@
601616 case AML_NAME_OP:
602617
603618 status = acpi_ds_create_node(walk_state, node, op);
619
+ if (ACPI_FAILURE(status)) {
620
+ goto cleanup;
621
+ }
622
+#ifdef ACPI_EXEC_APP
623
+ /*
624
+ * acpi_exec support for namespace initialization file (initialize
625
+ * Name opcodes in this code.)
626
+ */
627
+ namepath = acpi_ns_get_external_pathname(node);
628
+ status = ae_lookup_init_file_entry(namepath, &obj_desc);
629
+ if (ACPI_SUCCESS(status)) {
630
+
631
+ /* Detach any existing object, attach new object */
632
+
633
+ if (node->object) {
634
+ acpi_ns_detach_object(node);
635
+ }
636
+ acpi_ns_attach_object(node, obj_desc,
637
+ obj_desc->common.type);
638
+ }
639
+ ACPI_FREE(namepath);
640
+ status = AE_OK;
641
+#endif
604642 break;
605643
606644 case AML_METHOD_OP:
....@@ -642,8 +680,6 @@
642680 }
643681 }
644682 break;
645
-
646
-#endif /* ACPI_NO_METHOD_EXECUTION */
647683
648684 default:
649685