.. | .. |
---|
36 | 36 | acpi_status status; |
---|
37 | 37 | const struct acpi_predefined_names *init_val = NULL; |
---|
38 | 38 | struct acpi_namespace_node *new_node; |
---|
| 39 | + struct acpi_namespace_node *prev_node = NULL; |
---|
39 | 40 | union acpi_operand_object *obj_desc; |
---|
40 | 41 | acpi_string val = NULL; |
---|
41 | 42 | |
---|
.. | .. |
---|
61 | 62 | */ |
---|
62 | 63 | acpi_gbl_root_node = &acpi_gbl_root_node_struct; |
---|
63 | 64 | |
---|
64 | | - /* Enter the pre-defined names in the name table */ |
---|
| 65 | + /* Enter the predefined names in the name table */ |
---|
65 | 66 | |
---|
66 | 67 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
---|
67 | 68 | "Entering predefined entries into namespace\n")); |
---|
68 | 69 | |
---|
| 70 | + /* |
---|
| 71 | + * Create the initial (default) namespace. |
---|
| 72 | + * This namespace looks like something similar to this: |
---|
| 73 | + * |
---|
| 74 | + * ACPI Namespace (from Namespace Root): |
---|
| 75 | + * 0 _GPE Scope 00203160 00 |
---|
| 76 | + * 0 _PR_ Scope 002031D0 00 |
---|
| 77 | + * 0 _SB_ Device 00203240 00 Notify Object: 0020ADD8 |
---|
| 78 | + * 0 _SI_ Scope 002032B0 00 |
---|
| 79 | + * 0 _TZ_ Device 00203320 00 |
---|
| 80 | + * 0 _REV Integer 00203390 00 = 0000000000000002 |
---|
| 81 | + * 0 _OS_ String 00203488 00 Len 14 "Microsoft Windows NT" |
---|
| 82 | + * 0 _GL_ Mutex 00203580 00 Object 002035F0 |
---|
| 83 | + * 0 _OSI Method 00203678 00 Args 1 Len 0000 Aml 00000000 |
---|
| 84 | + */ |
---|
69 | 85 | for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { |
---|
| 86 | + status = AE_OK; |
---|
70 | 87 | |
---|
71 | 88 | /* _OSI is optional for now, will be permanent later */ |
---|
72 | 89 | |
---|
.. | .. |
---|
75 | 92 | continue; |
---|
76 | 93 | } |
---|
77 | 94 | |
---|
78 | | - status = |
---|
79 | | - acpi_ns_lookup(NULL, ACPI_CAST_PTR(char, init_val->name), |
---|
80 | | - init_val->type, ACPI_IMODE_LOAD_PASS2, |
---|
81 | | - ACPI_NS_NO_UPSEARCH, NULL, &new_node); |
---|
82 | | - if (ACPI_FAILURE(status)) { |
---|
83 | | - ACPI_EXCEPTION((AE_INFO, status, |
---|
84 | | - "Could not create predefined name %s", |
---|
85 | | - init_val->name)); |
---|
86 | | - continue; |
---|
| 95 | + /* |
---|
| 96 | + * Create, init, and link the new predefined name |
---|
| 97 | + * Note: No need to use acpi_ns_lookup here because all the |
---|
| 98 | + * predefined names are at the root level. It is much easier to |
---|
| 99 | + * just create and link the new node(s) here. |
---|
| 100 | + */ |
---|
| 101 | + new_node = |
---|
| 102 | + acpi_ns_create_node(*ACPI_CAST_PTR(u32, init_val->name)); |
---|
| 103 | + if (!new_node) { |
---|
| 104 | + status = AE_NO_MEMORY; |
---|
| 105 | + goto unlock_and_exit; |
---|
87 | 106 | } |
---|
| 107 | + |
---|
| 108 | + new_node->descriptor_type = ACPI_DESC_TYPE_NAMED; |
---|
| 109 | + new_node->type = init_val->type; |
---|
| 110 | + |
---|
| 111 | + if (!prev_node) { |
---|
| 112 | + acpi_gbl_root_node_struct.child = new_node; |
---|
| 113 | + } else { |
---|
| 114 | + prev_node->peer = new_node; |
---|
| 115 | + } |
---|
| 116 | + |
---|
| 117 | + new_node->parent = &acpi_gbl_root_node_struct; |
---|
| 118 | + prev_node = new_node; |
---|
88 | 119 | |
---|
89 | 120 | /* |
---|
90 | 121 | * Name entered successfully. If entry in pre_defined_names[] specifies |
---|
.. | .. |
---|
131 | 162 | |
---|
132 | 163 | new_node->value = obj_desc->method.param_count; |
---|
133 | 164 | #else |
---|
134 | | - /* Mark this as a very SPECIAL method */ |
---|
| 165 | + /* Mark this as a very SPECIAL method (_OSI) */ |
---|
135 | 166 | |
---|
136 | 167 | obj_desc->method.info_flags = |
---|
137 | 168 | ACPI_METHOD_INTERNAL_ONLY; |
---|
.. | .. |
---|
267 | 298 | acpi_object_type this_search_type; |
---|
268 | 299 | u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; |
---|
269 | 300 | u32 local_flags; |
---|
| 301 | + acpi_interpreter_mode local_interpreter_mode; |
---|
270 | 302 | |
---|
271 | 303 | ACPI_FUNCTION_TRACE(ns_lookup); |
---|
272 | 304 | |
---|
.. | .. |
---|
506 | 538 | */ |
---|
507 | 539 | this_search_type = ACPI_TYPE_ANY; |
---|
508 | 540 | current_node = this_node; |
---|
| 541 | + |
---|
509 | 542 | while (num_segments && current_node) { |
---|
510 | 543 | num_segments--; |
---|
511 | 544 | if (!num_segments) { |
---|
.. | .. |
---|
536 | 569 | } |
---|
537 | 570 | } |
---|
538 | 571 | |
---|
| 572 | + /* Handle opcodes that create a new name_seg via a full name_path */ |
---|
| 573 | + |
---|
| 574 | + local_interpreter_mode = interpreter_mode; |
---|
| 575 | + if ((flags & ACPI_NS_PREFIX_MUST_EXIST) && (num_segments > 0)) { |
---|
| 576 | + |
---|
| 577 | + /* Every element of the path must exist (except for the final name_seg) */ |
---|
| 578 | + |
---|
| 579 | + local_interpreter_mode = ACPI_IMODE_EXECUTE; |
---|
| 580 | + } |
---|
| 581 | + |
---|
539 | 582 | /* Extract one ACPI name from the front of the pathname */ |
---|
540 | 583 | |
---|
541 | 584 | ACPI_MOVE_32_TO_32(&simple_name, path); |
---|
.. | .. |
---|
544 | 587 | |
---|
545 | 588 | status = |
---|
546 | 589 | acpi_ns_search_and_enter(simple_name, walk_state, |
---|
547 | | - current_node, interpreter_mode, |
---|
| 590 | + current_node, |
---|
| 591 | + local_interpreter_mode, |
---|
548 | 592 | this_search_type, local_flags, |
---|
549 | 593 | &this_node); |
---|
550 | 594 | if (ACPI_FAILURE(status)) { |
---|
551 | 595 | if (status == AE_NOT_FOUND) { |
---|
552 | | - |
---|
| 596 | +#if !defined ACPI_ASL_COMPILER /* Note: iASL reports this error by itself, not needed here */ |
---|
| 597 | + if (flags & ACPI_NS_PREFIX_MUST_EXIST) { |
---|
| 598 | + acpi_os_printf(ACPI_MSG_BIOS_ERROR |
---|
| 599 | + "Object does not exist: %4.4s\n", |
---|
| 600 | + (char *)&simple_name); |
---|
| 601 | + } |
---|
| 602 | +#endif |
---|
553 | 603 | /* Name not found in ACPI namespace */ |
---|
554 | 604 | |
---|
555 | 605 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
---|
.. | .. |
---|
664 | 714 | |
---|
665 | 715 | /* Point to next name segment and make this node current */ |
---|
666 | 716 | |
---|
667 | | - path += ACPI_NAME_SIZE; |
---|
| 717 | + path += ACPI_NAMESEG_SIZE; |
---|
668 | 718 | current_node = this_node; |
---|
669 | 719 | } |
---|
670 | 720 | |
---|