dswload2.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  1. /******************************************************************************
  2. *
  3. * Module Name: dswload2 - Dispatcher second pass namespace load callbacks
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2015, Intel Corp.
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions, and the following disclaimer,
  15. * without modification.
  16. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  17. * substantially similar to the "NO WARRANTY" disclaimer below
  18. * ("Disclaimer") and any redistribution must be conditioned upon
  19. * including a substantially similar Disclaimer requirement for further
  20. * binary redistribution.
  21. * 3. Neither the names of the above-listed copyright holders nor the names
  22. * of any contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * Alternatively, this software may be distributed under the terms of the
  26. * GNU General Public License ("GPL") version 2 as published by the Free
  27. * Software Foundation.
  28. *
  29. * NO WARRANTY
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  31. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  32. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  33. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  34. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  36. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  38. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  39. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGES.
  41. */
  42. #include <acpi/acpi.h>
  43. #include "accommon.h"
  44. #include "acparser.h"
  45. #include "amlcode.h"
  46. #include "acdispat.h"
  47. #include "acinterp.h"
  48. #include "acnamesp.h"
  49. #include "acevents.h"
  50. #define _COMPONENT ACPI_DISPATCHER
  51. ACPI_MODULE_NAME("dswload2")
  52. /*******************************************************************************
  53. *
  54. * FUNCTION: acpi_ds_load2_begin_op
  55. *
  56. * PARAMETERS: walk_state - Current state of the parse tree walk
  57. * out_op - Wher to return op if a new one is created
  58. *
  59. * RETURN: Status
  60. *
  61. * DESCRIPTION: Descending callback used during the loading of ACPI tables.
  62. *
  63. ******************************************************************************/
  64. acpi_status
  65. acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
  66. union acpi_parse_object **out_op)
  67. {
  68. union acpi_parse_object *op;
  69. struct acpi_namespace_node *node;
  70. acpi_status status;
  71. acpi_object_type object_type;
  72. char *buffer_ptr;
  73. u32 flags;
  74. ACPI_FUNCTION_TRACE(ds_load2_begin_op);
  75. op = walk_state->op;
  76. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
  77. walk_state));
  78. if (op) {
  79. if ((walk_state->control_state) &&
  80. (walk_state->control_state->common.state ==
  81. ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
  82. /* We are executing a while loop outside of a method */
  83. status = acpi_ds_exec_begin_op(walk_state, out_op);
  84. return_ACPI_STATUS(status);
  85. }
  86. /* We only care about Namespace opcodes here */
  87. if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
  88. (walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
  89. (!(walk_state->op_info->flags & AML_NAMED))) {
  90. return_ACPI_STATUS(AE_OK);
  91. }
  92. /* Get the name we are going to enter or lookup in the namespace */
  93. if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
  94. /* For Namepath op, get the path string */
  95. buffer_ptr = op->common.value.string;
  96. if (!buffer_ptr) {
  97. /* No name, just exit */
  98. return_ACPI_STATUS(AE_OK);
  99. }
  100. } else {
  101. /* Get name from the op */
  102. buffer_ptr = ACPI_CAST_PTR(char, &op->named.name);
  103. }
  104. } else {
  105. /* Get the namestring from the raw AML */
  106. buffer_ptr =
  107. acpi_ps_get_next_namestring(&walk_state->parser_state);
  108. }
  109. /* Map the opcode into an internal object type */
  110. object_type = walk_state->op_info->object_type;
  111. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  112. "State=%p Op=%p Type=%X\n", walk_state, op,
  113. object_type));
  114. switch (walk_state->opcode) {
  115. case AML_FIELD_OP:
  116. case AML_BANK_FIELD_OP:
  117. case AML_INDEX_FIELD_OP:
  118. node = NULL;
  119. status = AE_OK;
  120. break;
  121. case AML_INT_NAMEPATH_OP:
  122. /*
  123. * The name_path is an object reference to an existing object.
  124. * Don't enter the name into the namespace, but look it up
  125. * for use later.
  126. */
  127. status =
  128. acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
  129. object_type, ACPI_IMODE_EXECUTE,
  130. ACPI_NS_SEARCH_PARENT, walk_state, &(node));
  131. break;
  132. case AML_SCOPE_OP:
  133. /* Special case for Scope(\) -> refers to the Root node */
  134. if (op && (op->named.node == acpi_gbl_root_node)) {
  135. node = op->named.node;
  136. status =
  137. acpi_ds_scope_stack_push(node, object_type,
  138. walk_state);
  139. if (ACPI_FAILURE(status)) {
  140. return_ACPI_STATUS(status);
  141. }
  142. } else {
  143. /*
  144. * The Path is an object reference to an existing object.
  145. * Don't enter the name into the namespace, but look it up
  146. * for use later.
  147. */
  148. status =
  149. acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
  150. object_type, ACPI_IMODE_EXECUTE,
  151. ACPI_NS_SEARCH_PARENT, walk_state,
  152. &(node));
  153. if (ACPI_FAILURE(status)) {
  154. #ifdef ACPI_ASL_COMPILER
  155. if (status == AE_NOT_FOUND) {
  156. status = AE_OK;
  157. } else {
  158. ACPI_ERROR_NAMESPACE(buffer_ptr,
  159. status);
  160. }
  161. #else
  162. ACPI_ERROR_NAMESPACE(buffer_ptr, status);
  163. #endif
  164. return_ACPI_STATUS(status);
  165. }
  166. }
  167. /*
  168. * We must check to make sure that the target is
  169. * one of the opcodes that actually opens a scope
  170. */
  171. switch (node->type) {
  172. case ACPI_TYPE_ANY:
  173. case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
  174. case ACPI_TYPE_DEVICE:
  175. case ACPI_TYPE_POWER:
  176. case ACPI_TYPE_PROCESSOR:
  177. case ACPI_TYPE_THERMAL:
  178. /* These are acceptable types */
  179. break;
  180. case ACPI_TYPE_INTEGER:
  181. case ACPI_TYPE_STRING:
  182. case ACPI_TYPE_BUFFER:
  183. /*
  184. * These types we will allow, but we will change the type.
  185. * This enables some existing code of the form:
  186. *
  187. * Name (DEB, 0)
  188. * Scope (DEB) { ... }
  189. */
  190. ACPI_WARNING((AE_INFO,
  191. "Type override - [%4.4s] had invalid type (%s) "
  192. "for Scope operator, changed to type ANY",
  193. acpi_ut_get_node_name(node),
  194. acpi_ut_get_type_name(node->type)));
  195. node->type = ACPI_TYPE_ANY;
  196. walk_state->scope_info->common.value = ACPI_TYPE_ANY;
  197. break;
  198. case ACPI_TYPE_METHOD:
  199. /*
  200. * Allow scope change to root during execution of module-level
  201. * code. Root is typed METHOD during this time.
  202. */
  203. if ((node == acpi_gbl_root_node) &&
  204. (walk_state->
  205. parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
  206. break;
  207. }
  208. /*lint -fallthrough */
  209. default:
  210. /* All other types are an error */
  211. ACPI_ERROR((AE_INFO,
  212. "Invalid type (%s) for target of "
  213. "Scope operator [%4.4s] (Cannot override)",
  214. acpi_ut_get_type_name(node->type),
  215. acpi_ut_get_node_name(node)));
  216. return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
  217. }
  218. break;
  219. default:
  220. /* All other opcodes */
  221. if (op && op->common.node) {
  222. /* This op/node was previously entered into the namespace */
  223. node = op->common.node;
  224. if (acpi_ns_opens_scope(object_type)) {
  225. status =
  226. acpi_ds_scope_stack_push(node, object_type,
  227. walk_state);
  228. if (ACPI_FAILURE(status)) {
  229. return_ACPI_STATUS(status);
  230. }
  231. }
  232. return_ACPI_STATUS(AE_OK);
  233. }
  234. /*
  235. * Enter the named type into the internal namespace. We enter the name
  236. * as we go downward in the parse tree. Any necessary subobjects that
  237. * involve arguments to the opcode must be created as we go back up the
  238. * parse tree later.
  239. *
  240. * Note: Name may already exist if we are executing a deferred opcode.
  241. */
  242. if (walk_state->deferred_node) {
  243. /* This name is already in the namespace, get the node */
  244. node = walk_state->deferred_node;
  245. status = AE_OK;
  246. break;
  247. }
  248. flags = ACPI_NS_NO_UPSEARCH;
  249. if (walk_state->pass_number == ACPI_IMODE_EXECUTE) {
  250. /* Execution mode, node cannot already exist, node is temporary */
  251. flags |= ACPI_NS_ERROR_IF_FOUND;
  252. if (!
  253. (walk_state->
  254. parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
  255. flags |= ACPI_NS_TEMPORARY;
  256. }
  257. }
  258. /* Add new entry or lookup existing entry */
  259. status =
  260. acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
  261. object_type, ACPI_IMODE_LOAD_PASS2, flags,
  262. walk_state, &node);
  263. if (ACPI_SUCCESS(status) && (flags & ACPI_NS_TEMPORARY)) {
  264. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  265. "***New Node [%4.4s] %p is temporary\n",
  266. acpi_ut_get_node_name(node), node));
  267. }
  268. break;
  269. }
  270. if (ACPI_FAILURE(status)) {
  271. ACPI_ERROR_NAMESPACE(buffer_ptr, status);
  272. return_ACPI_STATUS(status);
  273. }
  274. if (!op) {
  275. /* Create a new op */
  276. op = acpi_ps_alloc_op(walk_state->opcode, walk_state->aml);
  277. if (!op) {
  278. return_ACPI_STATUS(AE_NO_MEMORY);
  279. }
  280. /* Initialize the new op */
  281. if (node) {
  282. op->named.name = node->name.integer;
  283. }
  284. *out_op = op;
  285. }
  286. /*
  287. * Put the Node in the "op" object that the parser uses, so we
  288. * can get it again quickly when this scope is closed
  289. */
  290. op->common.node = node;
  291. return_ACPI_STATUS(status);
  292. }
  293. /*******************************************************************************
  294. *
  295. * FUNCTION: acpi_ds_load2_end_op
  296. *
  297. * PARAMETERS: walk_state - Current state of the parse tree walk
  298. *
  299. * RETURN: Status
  300. *
  301. * DESCRIPTION: Ascending callback used during the loading of the namespace,
  302. * both control methods and everything else.
  303. *
  304. ******************************************************************************/
  305. acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
  306. {
  307. union acpi_parse_object *op;
  308. acpi_status status = AE_OK;
  309. acpi_object_type object_type;
  310. struct acpi_namespace_node *node;
  311. union acpi_parse_object *arg;
  312. struct acpi_namespace_node *new_node;
  313. #ifndef ACPI_NO_METHOD_EXECUTION
  314. u32 i;
  315. u8 region_space;
  316. #endif
  317. ACPI_FUNCTION_TRACE(ds_load2_end_op);
  318. op = walk_state->op;
  319. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
  320. walk_state->op_info->name, op, walk_state));
  321. /* Check if opcode had an associated namespace object */
  322. if (!(walk_state->op_info->flags & AML_NSOBJECT)) {
  323. return_ACPI_STATUS(AE_OK);
  324. }
  325. if (op->common.aml_opcode == AML_SCOPE_OP) {
  326. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  327. "Ending scope Op=%p State=%p\n", op,
  328. walk_state));
  329. }
  330. object_type = walk_state->op_info->object_type;
  331. /*
  332. * Get the Node/name from the earlier lookup
  333. * (It was saved in the *op structure)
  334. */
  335. node = op->common.node;
  336. /*
  337. * Put the Node on the object stack (Contains the ACPI Name of
  338. * this object)
  339. */
  340. walk_state->operands[0] = (void *)node;
  341. walk_state->num_operands = 1;
  342. /* Pop the scope stack */
  343. if (acpi_ns_opens_scope(object_type) &&
  344. (op->common.aml_opcode != AML_INT_METHODCALL_OP)) {
  345. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  346. "(%s) Popping scope for Op %p\n",
  347. acpi_ut_get_type_name(object_type), op));
  348. status = acpi_ds_scope_stack_pop(walk_state);
  349. if (ACPI_FAILURE(status)) {
  350. goto cleanup;
  351. }
  352. }
  353. /*
  354. * Named operations are as follows:
  355. *
  356. * AML_ALIAS
  357. * AML_BANKFIELD
  358. * AML_CREATEBITFIELD
  359. * AML_CREATEBYTEFIELD
  360. * AML_CREATEDWORDFIELD
  361. * AML_CREATEFIELD
  362. * AML_CREATEQWORDFIELD
  363. * AML_CREATEWORDFIELD
  364. * AML_DATA_REGION
  365. * AML_DEVICE
  366. * AML_EVENT
  367. * AML_FIELD
  368. * AML_INDEXFIELD
  369. * AML_METHOD
  370. * AML_METHODCALL
  371. * AML_MUTEX
  372. * AML_NAME
  373. * AML_NAMEDFIELD
  374. * AML_OPREGION
  375. * AML_POWERRES
  376. * AML_PROCESSOR
  377. * AML_SCOPE
  378. * AML_THERMALZONE
  379. */
  380. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  381. "Create-Load [%s] State=%p Op=%p NamedObj=%p\n",
  382. acpi_ps_get_opcode_name(op->common.aml_opcode),
  383. walk_state, op, node));
  384. /* Decode the opcode */
  385. arg = op->common.value.arg;
  386. switch (walk_state->op_info->type) {
  387. #ifndef ACPI_NO_METHOD_EXECUTION
  388. case AML_TYPE_CREATE_FIELD:
  389. /*
  390. * Create the field object, but the field buffer and index must
  391. * be evaluated later during the execution phase
  392. */
  393. status = acpi_ds_create_buffer_field(op, walk_state);
  394. break;
  395. case AML_TYPE_NAMED_FIELD:
  396. /*
  397. * If we are executing a method, initialize the field
  398. */
  399. if (walk_state->method_node) {
  400. status = acpi_ds_init_field_objects(op, walk_state);
  401. }
  402. switch (op->common.aml_opcode) {
  403. case AML_INDEX_FIELD_OP:
  404. status =
  405. acpi_ds_create_index_field(op,
  406. (acpi_handle) arg->
  407. common.node, walk_state);
  408. break;
  409. case AML_BANK_FIELD_OP:
  410. status =
  411. acpi_ds_create_bank_field(op, arg->common.node,
  412. walk_state);
  413. break;
  414. case AML_FIELD_OP:
  415. status =
  416. acpi_ds_create_field(op, arg->common.node,
  417. walk_state);
  418. break;
  419. default:
  420. /* All NAMED_FIELD opcodes must be handled above */
  421. break;
  422. }
  423. break;
  424. case AML_TYPE_NAMED_SIMPLE:
  425. status = acpi_ds_create_operands(walk_state, arg);
  426. if (ACPI_FAILURE(status)) {
  427. goto cleanup;
  428. }
  429. switch (op->common.aml_opcode) {
  430. case AML_PROCESSOR_OP:
  431. status = acpi_ex_create_processor(walk_state);
  432. break;
  433. case AML_POWER_RES_OP:
  434. status = acpi_ex_create_power_resource(walk_state);
  435. break;
  436. case AML_MUTEX_OP:
  437. status = acpi_ex_create_mutex(walk_state);
  438. break;
  439. case AML_EVENT_OP:
  440. status = acpi_ex_create_event(walk_state);
  441. break;
  442. case AML_ALIAS_OP:
  443. status = acpi_ex_create_alias(walk_state);
  444. break;
  445. default:
  446. /* Unknown opcode */
  447. status = AE_OK;
  448. goto cleanup;
  449. }
  450. /* Delete operands */
  451. for (i = 1; i < walk_state->num_operands; i++) {
  452. acpi_ut_remove_reference(walk_state->operands[i]);
  453. walk_state->operands[i] = NULL;
  454. }
  455. break;
  456. #endif /* ACPI_NO_METHOD_EXECUTION */
  457. case AML_TYPE_NAMED_COMPLEX:
  458. switch (op->common.aml_opcode) {
  459. #ifndef ACPI_NO_METHOD_EXECUTION
  460. case AML_REGION_OP:
  461. case AML_DATA_REGION_OP:
  462. if (op->common.aml_opcode == AML_REGION_OP) {
  463. region_space = (acpi_adr_space_type)
  464. ((op->common.value.arg)->common.value.
  465. integer);
  466. } else {
  467. region_space = ACPI_ADR_SPACE_DATA_TABLE;
  468. }
  469. /*
  470. * The op_region is not fully parsed at this time. The only valid
  471. * argument is the space_id. (We must save the address of the
  472. * AML of the address and length operands)
  473. *
  474. * If we have a valid region, initialize it. The namespace is
  475. * unlocked at this point.
  476. *
  477. * Need to unlock interpreter if it is locked (if we are running
  478. * a control method), in order to allow _REG methods to be run
  479. * during acpi_ev_initialize_region.
  480. */
  481. if (walk_state->method_node) {
  482. /*
  483. * Executing a method: initialize the region and unlock
  484. * the interpreter
  485. */
  486. status =
  487. acpi_ex_create_region(op->named.data,
  488. op->named.length,
  489. region_space,
  490. walk_state);
  491. if (ACPI_FAILURE(status)) {
  492. return_ACPI_STATUS(status);
  493. }
  494. acpi_ex_exit_interpreter();
  495. }
  496. status =
  497. acpi_ev_initialize_region
  498. (acpi_ns_get_attached_object(node), FALSE);
  499. if (walk_state->method_node) {
  500. acpi_ex_enter_interpreter();
  501. }
  502. if (ACPI_FAILURE(status)) {
  503. /*
  504. * If AE_NOT_EXIST is returned, it is not fatal
  505. * because many regions get created before a handler
  506. * is installed for said region.
  507. */
  508. if (AE_NOT_EXIST == status) {
  509. status = AE_OK;
  510. }
  511. }
  512. break;
  513. case AML_NAME_OP:
  514. status = acpi_ds_create_node(walk_state, node, op);
  515. break;
  516. case AML_METHOD_OP:
  517. /*
  518. * method_op pkg_length name_string method_flags term_list
  519. *
  520. * Note: We must create the method node/object pair as soon as we
  521. * see the method declaration. This allows later pass1 parsing
  522. * of invocations of the method (need to know the number of
  523. * arguments.)
  524. */
  525. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  526. "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
  527. walk_state, op, op->named.node));
  528. if (!acpi_ns_get_attached_object(op->named.node)) {
  529. walk_state->operands[0] =
  530. ACPI_CAST_PTR(void, op->named.node);
  531. walk_state->num_operands = 1;
  532. status =
  533. acpi_ds_create_operands(walk_state,
  534. op->common.value.
  535. arg);
  536. if (ACPI_SUCCESS(status)) {
  537. status =
  538. acpi_ex_create_method(op->named.
  539. data,
  540. op->named.
  541. length,
  542. walk_state);
  543. }
  544. walk_state->operands[0] = NULL;
  545. walk_state->num_operands = 0;
  546. if (ACPI_FAILURE(status)) {
  547. return_ACPI_STATUS(status);
  548. }
  549. }
  550. break;
  551. #endif /* ACPI_NO_METHOD_EXECUTION */
  552. default:
  553. /* All NAMED_COMPLEX opcodes must be handled above */
  554. break;
  555. }
  556. break;
  557. case AML_CLASS_INTERNAL:
  558. /* case AML_INT_NAMEPATH_OP: */
  559. break;
  560. case AML_CLASS_METHOD_CALL:
  561. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  562. "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
  563. walk_state, op, node));
  564. /*
  565. * Lookup the method name and save the Node
  566. */
  567. status =
  568. acpi_ns_lookup(walk_state->scope_info,
  569. arg->common.value.string, ACPI_TYPE_ANY,
  570. ACPI_IMODE_LOAD_PASS2,
  571. ACPI_NS_SEARCH_PARENT |
  572. ACPI_NS_DONT_OPEN_SCOPE, walk_state,
  573. &(new_node));
  574. if (ACPI_SUCCESS(status)) {
  575. /*
  576. * Make sure that what we found is indeed a method
  577. * We didn't search for a method on purpose, to see if the name
  578. * would resolve
  579. */
  580. if (new_node->type != ACPI_TYPE_METHOD) {
  581. status = AE_AML_OPERAND_TYPE;
  582. }
  583. /* We could put the returned object (Node) on the object stack for
  584. * later, but for now, we will put it in the "op" object that the
  585. * parser uses, so we can get it again at the end of this scope
  586. */
  587. op->common.node = new_node;
  588. } else {
  589. ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
  590. }
  591. break;
  592. default:
  593. break;
  594. }
  595. cleanup:
  596. /* Remove the Node pushed at the very beginning */
  597. walk_state->operands[0] = NULL;
  598. walk_state->num_operands = 0;
  599. return_ACPI_STATUS(status);
  600. }