| .. | .. |
|---|
| 3 | 3 | * |
|---|
| 4 | 4 | * Module Name: dswload2 - Dispatcher second pass namespace load callbacks |
|---|
| 5 | 5 | * |
|---|
| 6 | | - * Copyright (C) 2000 - 2018, Intel Corp. |
|---|
| 6 | + * Copyright (C) 2000 - 2020, Intel Corp. |
|---|
| 7 | 7 | * |
|---|
| 8 | 8 | *****************************************************************************/ |
|---|
| 9 | 9 | |
|---|
| .. | .. |
|---|
| 15 | 15 | #include "acinterp.h" |
|---|
| 16 | 16 | #include "acnamesp.h" |
|---|
| 17 | 17 | #include "acevents.h" |
|---|
| 18 | +#ifdef ACPI_EXEC_APP |
|---|
| 19 | +#include "aecommon.h" |
|---|
| 20 | +#endif |
|---|
| 18 | 21 | |
|---|
| 19 | 22 | #define _COMPONENT ACPI_DISPATCHER |
|---|
| 20 | 23 | ACPI_MODULE_NAME("dswload2") |
|---|
| .. | .. |
|---|
| 24 | 27 | * FUNCTION: acpi_ds_load2_begin_op |
|---|
| 25 | 28 | * |
|---|
| 26 | 29 | * 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 |
|---|
| 28 | 31 | * |
|---|
| 29 | 32 | * RETURN: Status |
|---|
| 30 | 33 | * |
|---|
| .. | .. |
|---|
| 296 | 299 | } |
|---|
| 297 | 300 | #endif |
|---|
| 298 | 301 | |
|---|
| 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 | + |
|---|
| 299 | 310 | /* Add new entry or lookup existing entry */ |
|---|
| 300 | 311 | |
|---|
| 301 | 312 | status = |
|---|
| .. | .. |
|---|
| 363 | 374 | struct acpi_namespace_node *node; |
|---|
| 364 | 375 | union acpi_parse_object *arg; |
|---|
| 365 | 376 | struct acpi_namespace_node *new_node; |
|---|
| 366 | | -#ifndef ACPI_NO_METHOD_EXECUTION |
|---|
| 367 | 377 | u32 i; |
|---|
| 368 | 378 | u8 region_space; |
|---|
| 379 | +#ifdef ACPI_EXEC_APP |
|---|
| 380 | + union acpi_operand_object *obj_desc; |
|---|
| 381 | + char *namepath; |
|---|
| 369 | 382 | #endif |
|---|
| 370 | 383 | |
|---|
| 371 | 384 | ACPI_FUNCTION_TRACE(ds_load2_end_op); |
|---|
| .. | .. |
|---|
| 453 | 466 | arg = op->common.value.arg; |
|---|
| 454 | 467 | |
|---|
| 455 | 468 | switch (walk_state->op_info->type) { |
|---|
| 456 | | -#ifndef ACPI_NO_METHOD_EXECUTION |
|---|
| 457 | 469 | |
|---|
| 458 | 470 | case AML_TYPE_CREATE_FIELD: |
|---|
| 459 | 471 | /* |
|---|
| .. | .. |
|---|
| 461 | 473 | * be evaluated later during the execution phase |
|---|
| 462 | 474 | */ |
|---|
| 463 | 475 | 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 | + } |
|---|
| 464 | 481 | break; |
|---|
| 465 | 482 | |
|---|
| 466 | 483 | case AML_TYPE_NAMED_FIELD: |
|---|
| .. | .. |
|---|
| 550 | 567 | } |
|---|
| 551 | 568 | |
|---|
| 552 | 569 | break; |
|---|
| 553 | | -#endif /* ACPI_NO_METHOD_EXECUTION */ |
|---|
| 554 | 570 | |
|---|
| 555 | 571 | case AML_TYPE_NAMED_COMPLEX: |
|---|
| 556 | 572 | |
|---|
| 557 | 573 | switch (op->common.aml_opcode) { |
|---|
| 558 | | -#ifndef ACPI_NO_METHOD_EXECUTION |
|---|
| 559 | 574 | case AML_REGION_OP: |
|---|
| 560 | 575 | case AML_DATA_REGION_OP: |
|---|
| 561 | 576 | |
|---|
| .. | .. |
|---|
| 601 | 616 | case AML_NAME_OP: |
|---|
| 602 | 617 | |
|---|
| 603 | 618 | 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 |
|---|
| 604 | 642 | break; |
|---|
| 605 | 643 | |
|---|
| 606 | 644 | case AML_METHOD_OP: |
|---|
| .. | .. |
|---|
| 642 | 680 | } |
|---|
| 643 | 681 | } |
|---|
| 644 | 682 | break; |
|---|
| 645 | | - |
|---|
| 646 | | -#endif /* ACPI_NO_METHOD_EXECUTION */ |
|---|
| 647 | 683 | |
|---|
| 648 | 684 | default: |
|---|
| 649 | 685 | |
|---|