dswload2.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  1. /******************************************************************************
  2. *
  3. * Module Name: dswload2 - Dispatcher second pass namespace load callbacks
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2017, 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. #ifdef ACPI_ASL_COMPILER
  259. /*
  260. * Do not open a scope for AML_EXTERNAL_OP
  261. * acpi_ns_lookup can open a new scope based on the object type
  262. * of this op. AML_EXTERNAL_OP is a declaration rather than a
  263. * definition. In the case that this external is a method object,
  264. * acpi_ns_lookup will open a new scope. However, an AML_EXTERNAL_OP
  265. * associated with the ACPI_TYPE_METHOD is a declaration, rather than
  266. * a definition. Flags is set to avoid opening a scope for any
  267. * AML_EXTERNAL_OP.
  268. */
  269. if (walk_state->opcode == AML_EXTERNAL_OP) {
  270. flags |= ACPI_NS_DONT_OPEN_SCOPE;
  271. }
  272. #endif
  273. /* Add new entry or lookup existing entry */
  274. status =
  275. acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
  276. object_type, ACPI_IMODE_LOAD_PASS2, flags,
  277. walk_state, &node);
  278. if (ACPI_SUCCESS(status) && (flags & ACPI_NS_TEMPORARY)) {
  279. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  280. "***New Node [%4.4s] %p is temporary\n",
  281. acpi_ut_get_node_name(node), node));
  282. }
  283. break;
  284. }
  285. if (ACPI_FAILURE(status)) {
  286. ACPI_ERROR_NAMESPACE(buffer_ptr, status);
  287. return_ACPI_STATUS(status);
  288. }
  289. if (!op) {
  290. /* Create a new op */
  291. op = acpi_ps_alloc_op(walk_state->opcode, walk_state->aml);
  292. if (!op) {
  293. return_ACPI_STATUS(AE_NO_MEMORY);
  294. }
  295. /* Initialize the new op */
  296. if (node) {
  297. op->named.name = node->name.integer;
  298. }
  299. *out_op = op;
  300. }
  301. /*
  302. * Put the Node in the "op" object that the parser uses, so we
  303. * can get it again quickly when this scope is closed
  304. */
  305. op->common.node = node;
  306. return_ACPI_STATUS(status);
  307. }
  308. /*******************************************************************************
  309. *
  310. * FUNCTION: acpi_ds_load2_end_op
  311. *
  312. * PARAMETERS: walk_state - Current state of the parse tree walk
  313. *
  314. * RETURN: Status
  315. *
  316. * DESCRIPTION: Ascending callback used during the loading of the namespace,
  317. * both control methods and everything else.
  318. *
  319. ******************************************************************************/
  320. acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
  321. {
  322. union acpi_parse_object *op;
  323. acpi_status status = AE_OK;
  324. acpi_object_type object_type;
  325. struct acpi_namespace_node *node;
  326. union acpi_parse_object *arg;
  327. struct acpi_namespace_node *new_node;
  328. #ifndef ACPI_NO_METHOD_EXECUTION
  329. u32 i;
  330. u8 region_space;
  331. #endif
  332. ACPI_FUNCTION_TRACE(ds_load2_end_op);
  333. op = walk_state->op;
  334. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
  335. walk_state->op_info->name, op, walk_state));
  336. /* Check if opcode had an associated namespace object */
  337. if (!(walk_state->op_info->flags & AML_NSOBJECT)) {
  338. return_ACPI_STATUS(AE_OK);
  339. }
  340. if (op->common.aml_opcode == AML_SCOPE_OP) {
  341. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  342. "Ending scope Op=%p State=%p\n", op,
  343. walk_state));
  344. }
  345. object_type = walk_state->op_info->object_type;
  346. /*
  347. * Get the Node/name from the earlier lookup
  348. * (It was saved in the *op structure)
  349. */
  350. node = op->common.node;
  351. /*
  352. * Put the Node on the object stack (Contains the ACPI Name of
  353. * this object)
  354. */
  355. walk_state->operands[0] = (void *)node;
  356. walk_state->num_operands = 1;
  357. /* Pop the scope stack */
  358. if (acpi_ns_opens_scope(object_type) &&
  359. (op->common.aml_opcode != AML_INT_METHODCALL_OP)) {
  360. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  361. "(%s) Popping scope for Op %p\n",
  362. acpi_ut_get_type_name(object_type), op));
  363. status = acpi_ds_scope_stack_pop(walk_state);
  364. if (ACPI_FAILURE(status)) {
  365. goto cleanup;
  366. }
  367. }
  368. /*
  369. * Named operations are as follows:
  370. *
  371. * AML_ALIAS
  372. * AML_BANKFIELD
  373. * AML_CREATEBITFIELD
  374. * AML_CREATEBYTEFIELD
  375. * AML_CREATEDWORDFIELD
  376. * AML_CREATEFIELD
  377. * AML_CREATEQWORDFIELD
  378. * AML_CREATEWORDFIELD
  379. * AML_DATA_REGION
  380. * AML_DEVICE
  381. * AML_EVENT
  382. * AML_FIELD
  383. * AML_INDEXFIELD
  384. * AML_METHOD
  385. * AML_METHODCALL
  386. * AML_MUTEX
  387. * AML_NAME
  388. * AML_NAMEDFIELD
  389. * AML_OPREGION
  390. * AML_POWERRES
  391. * AML_PROCESSOR
  392. * AML_SCOPE
  393. * AML_THERMALZONE
  394. */
  395. ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  396. "Create-Load [%s] State=%p Op=%p NamedObj=%p\n",
  397. acpi_ps_get_opcode_name(op->common.aml_opcode),
  398. walk_state, op, node));
  399. /* Decode the opcode */
  400. arg = op->common.value.arg;
  401. switch (walk_state->op_info->type) {
  402. #ifndef ACPI_NO_METHOD_EXECUTION
  403. case AML_TYPE_CREATE_FIELD:
  404. /*
  405. * Create the field object, but the field buffer and index must
  406. * be evaluated later during the execution phase
  407. */
  408. status = acpi_ds_create_buffer_field(op, walk_state);
  409. break;
  410. case AML_TYPE_NAMED_FIELD:
  411. /*
  412. * If we are executing a method, initialize the field
  413. */
  414. if (walk_state->method_node) {
  415. status = acpi_ds_init_field_objects(op, walk_state);
  416. }
  417. switch (op->common.aml_opcode) {
  418. case AML_INDEX_FIELD_OP:
  419. status =
  420. acpi_ds_create_index_field(op,
  421. (acpi_handle)arg->common.
  422. node, walk_state);
  423. break;
  424. case AML_BANK_FIELD_OP:
  425. status =
  426. acpi_ds_create_bank_field(op, arg->common.node,
  427. walk_state);
  428. break;
  429. case AML_FIELD_OP:
  430. status =
  431. acpi_ds_create_field(op, arg->common.node,
  432. walk_state);
  433. break;
  434. default:
  435. /* All NAMED_FIELD opcodes must be handled above */
  436. break;
  437. }
  438. break;
  439. case AML_TYPE_NAMED_SIMPLE:
  440. status = acpi_ds_create_operands(walk_state, arg);
  441. if (ACPI_FAILURE(status)) {
  442. goto cleanup;
  443. }
  444. switch (op->common.aml_opcode) {
  445. case AML_PROCESSOR_OP:
  446. status = acpi_ex_create_processor(walk_state);
  447. break;
  448. case AML_POWER_RESOURCE_OP:
  449. status = acpi_ex_create_power_resource(walk_state);
  450. break;
  451. case AML_MUTEX_OP:
  452. status = acpi_ex_create_mutex(walk_state);
  453. break;
  454. case AML_EVENT_OP:
  455. status = acpi_ex_create_event(walk_state);
  456. break;
  457. case AML_ALIAS_OP:
  458. status = acpi_ex_create_alias(walk_state);
  459. break;
  460. default:
  461. /* Unknown opcode */
  462. status = AE_OK;
  463. goto cleanup;
  464. }
  465. /* Delete operands */
  466. for (i = 1; i < walk_state->num_operands; i++) {
  467. acpi_ut_remove_reference(walk_state->operands[i]);
  468. walk_state->operands[i] = NULL;
  469. }
  470. break;
  471. #endif /* ACPI_NO_METHOD_EXECUTION */
  472. case AML_TYPE_NAMED_COMPLEX:
  473. switch (op->common.aml_opcode) {
  474. #ifndef ACPI_NO_METHOD_EXECUTION
  475. case AML_REGION_OP:
  476. case AML_DATA_REGION_OP:
  477. if (op->common.aml_opcode == AML_REGION_OP) {
  478. region_space = (acpi_adr_space_type)
  479. ((op->common.value.arg)->common.value.
  480. integer);
  481. } else {
  482. region_space = ACPI_ADR_SPACE_DATA_TABLE;
  483. }
  484. /*
  485. * The op_region is not fully parsed at this time. The only valid
  486. * argument is the space_id. (We must save the address of the
  487. * AML of the address and length operands)
  488. *
  489. * If we have a valid region, initialize it. The namespace is
  490. * unlocked at this point.
  491. *
  492. * Need to unlock interpreter if it is locked (if we are running
  493. * a control method), in order to allow _REG methods to be run
  494. * during acpi_ev_initialize_region.
  495. */
  496. if (walk_state->method_node) {
  497. /*
  498. * Executing a method: initialize the region and unlock
  499. * the interpreter
  500. */
  501. status = acpi_ex_create_region(op->named.data,
  502. op->named.length,
  503. region_space,
  504. walk_state);
  505. if (ACPI_FAILURE(status)) {
  506. return_ACPI_STATUS(status);
  507. }
  508. }
  509. status =
  510. acpi_ev_initialize_region
  511. (acpi_ns_get_attached_object(node));
  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. }