dswload2.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  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.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: AcpiDsLoad2BeginOp
  55. *
  56. * PARAMETERS: WalkState - Current state of the parse tree walk
  57. * OutOp - 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. AcpiDsLoad2BeginOp (
  66. ACPI_WALK_STATE *WalkState,
  67. ACPI_PARSE_OBJECT **OutOp)
  68. {
  69. ACPI_PARSE_OBJECT *Op;
  70. ACPI_NAMESPACE_NODE *Node;
  71. ACPI_STATUS Status;
  72. ACPI_OBJECT_TYPE ObjectType;
  73. char *BufferPtr;
  74. UINT32 Flags;
  75. ACPI_FUNCTION_TRACE (DsLoad2BeginOp);
  76. Op = WalkState->Op;
  77. ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
  78. if (Op)
  79. {
  80. if ((WalkState->ControlState) &&
  81. (WalkState->ControlState->Common.State ==
  82. ACPI_CONTROL_CONDITIONAL_EXECUTING))
  83. {
  84. /* We are executing a while loop outside of a method */
  85. Status = AcpiDsExecBeginOp (WalkState, OutOp);
  86. return_ACPI_STATUS (Status);
  87. }
  88. /* We only care about Namespace opcodes here */
  89. if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) &&
  90. (WalkState->Opcode != AML_INT_NAMEPATH_OP)) ||
  91. (!(WalkState->OpInfo->Flags & AML_NAMED)))
  92. {
  93. return_ACPI_STATUS (AE_OK);
  94. }
  95. /* Get the name we are going to enter or lookup in the namespace */
  96. if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
  97. {
  98. /* For Namepath op, get the path string */
  99. BufferPtr = Op->Common.Value.String;
  100. if (!BufferPtr)
  101. {
  102. /* No name, just exit */
  103. return_ACPI_STATUS (AE_OK);
  104. }
  105. }
  106. else
  107. {
  108. /* Get name from the op */
  109. BufferPtr = ACPI_CAST_PTR (char, &Op->Named.Name);
  110. }
  111. }
  112. else
  113. {
  114. /* Get the namestring from the raw AML */
  115. BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState);
  116. }
  117. /* Map the opcode into an internal object type */
  118. ObjectType = WalkState->OpInfo->ObjectType;
  119. ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
  120. "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType));
  121. switch (WalkState->Opcode)
  122. {
  123. case AML_FIELD_OP:
  124. case AML_BANK_FIELD_OP:
  125. case AML_INDEX_FIELD_OP:
  126. Node = NULL;
  127. Status = AE_OK;
  128. break;
  129. case AML_INT_NAMEPATH_OP:
  130. /*
  131. * The NamePath is an object reference to an existing object.
  132. * Don't enter the name into the namespace, but look it up
  133. * for use later.
  134. */
  135. Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
  136. ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
  137. WalkState, &(Node));
  138. break;
  139. case AML_SCOPE_OP:
  140. /* Special case for Scope(\) -> refers to the Root node */
  141. if (Op && (Op->Named.Node == AcpiGbl_RootNode))
  142. {
  143. Node = Op->Named.Node;
  144. Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
  145. if (ACPI_FAILURE (Status))
  146. {
  147. return_ACPI_STATUS (Status);
  148. }
  149. }
  150. else
  151. {
  152. /*
  153. * The Path is an object reference to an existing object.
  154. * Don't enter the name into the namespace, but look it up
  155. * for use later.
  156. */
  157. Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
  158. ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
  159. WalkState, &(Node));
  160. if (ACPI_FAILURE (Status))
  161. {
  162. #ifdef ACPI_ASL_COMPILER
  163. if (Status == AE_NOT_FOUND)
  164. {
  165. Status = AE_OK;
  166. }
  167. else
  168. {
  169. ACPI_ERROR_NAMESPACE (BufferPtr, Status);
  170. }
  171. #else
  172. ACPI_ERROR_NAMESPACE (BufferPtr, Status);
  173. #endif
  174. return_ACPI_STATUS (Status);
  175. }
  176. }
  177. /*
  178. * We must check to make sure that the target is
  179. * one of the opcodes that actually opens a scope
  180. */
  181. switch (Node->Type)
  182. {
  183. case ACPI_TYPE_ANY:
  184. case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
  185. case ACPI_TYPE_DEVICE:
  186. case ACPI_TYPE_POWER:
  187. case ACPI_TYPE_PROCESSOR:
  188. case ACPI_TYPE_THERMAL:
  189. /* These are acceptable types */
  190. break;
  191. case ACPI_TYPE_INTEGER:
  192. case ACPI_TYPE_STRING:
  193. case ACPI_TYPE_BUFFER:
  194. /*
  195. * These types we will allow, but we will change the type.
  196. * This enables some existing code of the form:
  197. *
  198. * Name (DEB, 0)
  199. * Scope (DEB) { ... }
  200. */
  201. ACPI_WARNING ((AE_INFO,
  202. "Type override - [%4.4s] had invalid type (%s) "
  203. "for Scope operator, changed to type ANY",
  204. AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type)));
  205. Node->Type = ACPI_TYPE_ANY;
  206. WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
  207. break;
  208. case ACPI_TYPE_METHOD:
  209. /*
  210. * Allow scope change to root during execution of module-level
  211. * code. Root is typed METHOD during this time.
  212. */
  213. if ((Node == AcpiGbl_RootNode) &&
  214. (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
  215. {
  216. break;
  217. }
  218. /*lint -fallthrough */
  219. default:
  220. /* All other types are an error */
  221. ACPI_ERROR ((AE_INFO,
  222. "Invalid type (%s) for target of "
  223. "Scope operator [%4.4s] (Cannot override)",
  224. AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node)));
  225. return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
  226. }
  227. break;
  228. default:
  229. /* All other opcodes */
  230. if (Op && Op->Common.Node)
  231. {
  232. /* This op/node was previously entered into the namespace */
  233. Node = Op->Common.Node;
  234. if (AcpiNsOpensScope (ObjectType))
  235. {
  236. Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
  237. if (ACPI_FAILURE (Status))
  238. {
  239. return_ACPI_STATUS (Status);
  240. }
  241. }
  242. return_ACPI_STATUS (AE_OK);
  243. }
  244. /*
  245. * Enter the named type into the internal namespace. We enter the name
  246. * as we go downward in the parse tree. Any necessary subobjects that
  247. * involve arguments to the opcode must be created as we go back up the
  248. * parse tree later.
  249. *
  250. * Note: Name may already exist if we are executing a deferred opcode.
  251. */
  252. if (WalkState->DeferredNode)
  253. {
  254. /* This name is already in the namespace, get the node */
  255. Node = WalkState->DeferredNode;
  256. Status = AE_OK;
  257. break;
  258. }
  259. Flags = ACPI_NS_NO_UPSEARCH;
  260. if (WalkState->PassNumber == ACPI_IMODE_EXECUTE)
  261. {
  262. /* Execution mode, node cannot already exist, node is temporary */
  263. Flags |= ACPI_NS_ERROR_IF_FOUND;
  264. if (!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
  265. {
  266. Flags |= ACPI_NS_TEMPORARY;
  267. }
  268. }
  269. /* Add new entry or lookup existing entry */
  270. Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
  271. ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node);
  272. if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY))
  273. {
  274. ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
  275. "***New Node [%4.4s] %p is temporary\n",
  276. AcpiUtGetNodeName (Node), Node));
  277. }
  278. break;
  279. }
  280. if (ACPI_FAILURE (Status))
  281. {
  282. ACPI_ERROR_NAMESPACE (BufferPtr, Status);
  283. return_ACPI_STATUS (Status);
  284. }
  285. if (!Op)
  286. {
  287. /* Create a new op */
  288. Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml);
  289. if (!Op)
  290. {
  291. return_ACPI_STATUS (AE_NO_MEMORY);
  292. }
  293. /* Initialize the new op */
  294. if (Node)
  295. {
  296. Op->Named.Name = Node->Name.Integer;
  297. }
  298. *OutOp = Op;
  299. }
  300. /*
  301. * Put the Node in the "op" object that the parser uses, so we
  302. * can get it again quickly when this scope is closed
  303. */
  304. Op->Common.Node = Node;
  305. return_ACPI_STATUS (Status);
  306. }
  307. /*******************************************************************************
  308. *
  309. * FUNCTION: AcpiDsLoad2EndOp
  310. *
  311. * PARAMETERS: WalkState - Current state of the parse tree walk
  312. *
  313. * RETURN: Status
  314. *
  315. * DESCRIPTION: Ascending callback used during the loading of the namespace,
  316. * both control methods and everything else.
  317. *
  318. ******************************************************************************/
  319. ACPI_STATUS
  320. AcpiDsLoad2EndOp (
  321. ACPI_WALK_STATE *WalkState)
  322. {
  323. ACPI_PARSE_OBJECT *Op;
  324. ACPI_STATUS Status = AE_OK;
  325. ACPI_OBJECT_TYPE ObjectType;
  326. ACPI_NAMESPACE_NODE *Node;
  327. ACPI_PARSE_OBJECT *Arg;
  328. ACPI_NAMESPACE_NODE *NewNode;
  329. #ifndef ACPI_NO_METHOD_EXECUTION
  330. UINT32 i;
  331. UINT8 RegionSpace;
  332. #endif
  333. ACPI_FUNCTION_TRACE (DsLoad2EndOp);
  334. Op = WalkState->Op;
  335. ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
  336. WalkState->OpInfo->Name, Op, WalkState));
  337. /* Check if opcode had an associated namespace object */
  338. if (!(WalkState->OpInfo->Flags & AML_NSOBJECT))
  339. {
  340. return_ACPI_STATUS (AE_OK);
  341. }
  342. if (Op->Common.AmlOpcode == AML_SCOPE_OP)
  343. {
  344. ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
  345. "Ending scope Op=%p State=%p\n", Op, WalkState));
  346. }
  347. ObjectType = WalkState->OpInfo->ObjectType;
  348. /*
  349. * Get the Node/name from the earlier lookup
  350. * (It was saved in the *op structure)
  351. */
  352. Node = Op->Common.Node;
  353. /*
  354. * Put the Node on the object stack (Contains the ACPI Name of
  355. * this object)
  356. */
  357. WalkState->Operands[0] = (void *) Node;
  358. WalkState->NumOperands = 1;
  359. /* Pop the scope stack */
  360. if (AcpiNsOpensScope (ObjectType) &&
  361. (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP))
  362. {
  363. ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
  364. AcpiUtGetTypeName (ObjectType), Op));
  365. Status = AcpiDsScopeStackPop (WalkState);
  366. if (ACPI_FAILURE (Status))
  367. {
  368. goto Cleanup;
  369. }
  370. }
  371. /*
  372. * Named operations are as follows:
  373. *
  374. * AML_ALIAS
  375. * AML_BANKFIELD
  376. * AML_CREATEBITFIELD
  377. * AML_CREATEBYTEFIELD
  378. * AML_CREATEDWORDFIELD
  379. * AML_CREATEFIELD
  380. * AML_CREATEQWORDFIELD
  381. * AML_CREATEWORDFIELD
  382. * AML_DATA_REGION
  383. * AML_DEVICE
  384. * AML_EVENT
  385. * AML_FIELD
  386. * AML_INDEXFIELD
  387. * AML_METHOD
  388. * AML_METHODCALL
  389. * AML_MUTEX
  390. * AML_NAME
  391. * AML_NAMEDFIELD
  392. * AML_OPREGION
  393. * AML_POWERRES
  394. * AML_PROCESSOR
  395. * AML_SCOPE
  396. * AML_THERMALZONE
  397. */
  398. ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
  399. "Create-Load [%s] State=%p Op=%p NamedObj=%p\n",
  400. AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node));
  401. /* Decode the opcode */
  402. Arg = Op->Common.Value.Arg;
  403. switch (WalkState->OpInfo->Type)
  404. {
  405. #ifndef ACPI_NO_METHOD_EXECUTION
  406. case AML_TYPE_CREATE_FIELD:
  407. /*
  408. * Create the field object, but the field buffer and index must
  409. * be evaluated later during the execution phase
  410. */
  411. Status = AcpiDsCreateBufferField (Op, WalkState);
  412. break;
  413. case AML_TYPE_NAMED_FIELD:
  414. /*
  415. * If we are executing a method, initialize the field
  416. */
  417. if (WalkState->MethodNode)
  418. {
  419. Status = AcpiDsInitFieldObjects (Op, WalkState);
  420. }
  421. switch (Op->Common.AmlOpcode)
  422. {
  423. case AML_INDEX_FIELD_OP:
  424. Status = AcpiDsCreateIndexField (
  425. Op, (ACPI_HANDLE) Arg->Common.Node, WalkState);
  426. break;
  427. case AML_BANK_FIELD_OP:
  428. Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState);
  429. break;
  430. case AML_FIELD_OP:
  431. Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState);
  432. break;
  433. default:
  434. /* All NAMED_FIELD opcodes must be handled above */
  435. break;
  436. }
  437. break;
  438. case AML_TYPE_NAMED_SIMPLE:
  439. Status = AcpiDsCreateOperands (WalkState, Arg);
  440. if (ACPI_FAILURE (Status))
  441. {
  442. goto Cleanup;
  443. }
  444. switch (Op->Common.AmlOpcode)
  445. {
  446. case AML_PROCESSOR_OP:
  447. Status = AcpiExCreateProcessor (WalkState);
  448. break;
  449. case AML_POWER_RES_OP:
  450. Status = AcpiExCreatePowerResource (WalkState);
  451. break;
  452. case AML_MUTEX_OP:
  453. Status = AcpiExCreateMutex (WalkState);
  454. break;
  455. case AML_EVENT_OP:
  456. Status = AcpiExCreateEvent (WalkState);
  457. break;
  458. case AML_ALIAS_OP:
  459. Status = AcpiExCreateAlias (WalkState);
  460. break;
  461. default:
  462. /* Unknown opcode */
  463. Status = AE_OK;
  464. goto Cleanup;
  465. }
  466. /* Delete operands */
  467. for (i = 1; i < WalkState->NumOperands; i++)
  468. {
  469. AcpiUtRemoveReference (WalkState->Operands[i]);
  470. WalkState->Operands[i] = NULL;
  471. }
  472. break;
  473. #endif /* ACPI_NO_METHOD_EXECUTION */
  474. case AML_TYPE_NAMED_COMPLEX:
  475. switch (Op->Common.AmlOpcode)
  476. {
  477. #ifndef ACPI_NO_METHOD_EXECUTION
  478. case AML_REGION_OP:
  479. case AML_DATA_REGION_OP:
  480. if (Op->Common.AmlOpcode == AML_REGION_OP)
  481. {
  482. RegionSpace = (ACPI_ADR_SPACE_TYPE)
  483. ((Op->Common.Value.Arg)->Common.Value.Integer);
  484. }
  485. else
  486. {
  487. RegionSpace = ACPI_ADR_SPACE_DATA_TABLE;
  488. }
  489. /*
  490. * The OpRegion is not fully parsed at this time. The only valid
  491. * argument is the SpaceId. (We must save the address of the
  492. * AML of the address and length operands)
  493. *
  494. * If we have a valid region, initialize it. The namespace is
  495. * unlocked at this point.
  496. *
  497. * Need to unlock interpreter if it is locked (if we are running
  498. * a control method), in order to allow _REG methods to be run
  499. * during AcpiEvInitializeRegion.
  500. */
  501. if (WalkState->MethodNode)
  502. {
  503. /*
  504. * Executing a method: initialize the region and unlock
  505. * the interpreter
  506. */
  507. Status = AcpiExCreateRegion (Op->Named.Data,
  508. Op->Named.Length, RegionSpace, WalkState);
  509. if (ACPI_FAILURE (Status))
  510. {
  511. return_ACPI_STATUS (Status);
  512. }
  513. AcpiExExitInterpreter ();
  514. }
  515. Status = AcpiEvInitializeRegion (
  516. AcpiNsGetAttachedObject (Node), FALSE);
  517. if (WalkState->MethodNode)
  518. {
  519. AcpiExEnterInterpreter ();
  520. }
  521. if (ACPI_FAILURE (Status))
  522. {
  523. /*
  524. * If AE_NOT_EXIST is returned, it is not fatal
  525. * because many regions get created before a handler
  526. * is installed for said region.
  527. */
  528. if (AE_NOT_EXIST == Status)
  529. {
  530. Status = AE_OK;
  531. }
  532. }
  533. break;
  534. case AML_NAME_OP:
  535. Status = AcpiDsCreateNode (WalkState, Node, Op);
  536. break;
  537. case AML_METHOD_OP:
  538. /*
  539. * MethodOp PkgLength NameString MethodFlags TermList
  540. *
  541. * Note: We must create the method node/object pair as soon as we
  542. * see the method declaration. This allows later pass1 parsing
  543. * of invocations of the method (need to know the number of
  544. * arguments.)
  545. */
  546. ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
  547. "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
  548. WalkState, Op, Op->Named.Node));
  549. if (!AcpiNsGetAttachedObject (Op->Named.Node))
  550. {
  551. WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node);
  552. WalkState->NumOperands = 1;
  553. Status = AcpiDsCreateOperands (
  554. WalkState, Op->Common.Value.Arg);
  555. if (ACPI_SUCCESS (Status))
  556. {
  557. Status = AcpiExCreateMethod (
  558. Op->Named.Data, Op->Named.Length, WalkState);
  559. }
  560. WalkState->Operands[0] = NULL;
  561. WalkState->NumOperands = 0;
  562. if (ACPI_FAILURE (Status))
  563. {
  564. return_ACPI_STATUS (Status);
  565. }
  566. }
  567. break;
  568. #endif /* ACPI_NO_METHOD_EXECUTION */
  569. default:
  570. /* All NAMED_COMPLEX opcodes must be handled above */
  571. break;
  572. }
  573. break;
  574. case AML_CLASS_INTERNAL:
  575. /* case AML_INT_NAMEPATH_OP: */
  576. break;
  577. case AML_CLASS_METHOD_CALL:
  578. ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
  579. "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
  580. WalkState, Op, Node));
  581. /*
  582. * Lookup the method name and save the Node
  583. */
  584. Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
  585. ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
  586. ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
  587. WalkState, &(NewNode));
  588. if (ACPI_SUCCESS (Status))
  589. {
  590. /*
  591. * Make sure that what we found is indeed a method
  592. * We didn't search for a method on purpose, to see if the name
  593. * would resolve
  594. */
  595. if (NewNode->Type != ACPI_TYPE_METHOD)
  596. {
  597. Status = AE_AML_OPERAND_TYPE;
  598. }
  599. /* We could put the returned object (Node) on the object stack for
  600. * later, but for now, we will put it in the "op" object that the
  601. * parser uses, so we can get it again at the end of this scope
  602. */
  603. Op->Common.Node = NewNode;
  604. }
  605. else
  606. {
  607. ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
  608. }
  609. break;
  610. default:
  611. break;
  612. }
  613. Cleanup:
  614. /* Remove the Node pushed at the very beginning */
  615. WalkState->Operands[0] = NULL;
  616. WalkState->NumOperands = 0;
  617. return_ACPI_STATUS (Status);
  618. }