/drivers/acpi/dispatcher/dsmthdat.c

https://bitbucket.org/evzijst/gittest · C · 715 lines · 283 code · 144 blank · 288 comment · 45 complexity · c2905309de96a67d22975a804fb8b76a MD5 · raw file

  1. /*******************************************************************************
  2. *
  3. * Module Name: dsmthdat - control method arguments and local variables
  4. *
  5. ******************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2005, R. Byron Moore
  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 <acpi/acdispat.h>
  44. #include <acpi/amlcode.h>
  45. #include <acpi/acnamesp.h>
  46. #include <acpi/acinterp.h>
  47. #define _COMPONENT ACPI_DISPATCHER
  48. ACPI_MODULE_NAME ("dsmthdat")
  49. /*******************************************************************************
  50. *
  51. * FUNCTION: acpi_ds_method_data_init
  52. *
  53. * PARAMETERS: walk_state - Current walk state object
  54. *
  55. * RETURN: Status
  56. *
  57. * DESCRIPTION: Initialize the data structures that hold the method's arguments
  58. * and locals. The data struct is an array of NTEs for each.
  59. * This allows ref_of and de_ref_of to work properly for these
  60. * special data types.
  61. *
  62. * NOTES: walk_state fields are initialized to zero by the
  63. * ACPI_MEM_CALLOCATE().
  64. *
  65. * A pseudo-Namespace Node is assigned to each argument and local
  66. * so that ref_of() can return a pointer to the Node.
  67. *
  68. ******************************************************************************/
  69. void
  70. acpi_ds_method_data_init (
  71. struct acpi_walk_state *walk_state)
  72. {
  73. u32 i;
  74. ACPI_FUNCTION_TRACE ("ds_method_data_init");
  75. /* Init the method arguments */
  76. for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) {
  77. ACPI_MOVE_32_TO_32 (&walk_state->arguments[i].name,
  78. NAMEOF_ARG_NTE);
  79. walk_state->arguments[i].name.integer |= (i << 24);
  80. walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED;
  81. walk_state->arguments[i].type = ACPI_TYPE_ANY;
  82. walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
  83. }
  84. /* Init the method locals */
  85. for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) {
  86. ACPI_MOVE_32_TO_32 (&walk_state->local_variables[i].name,
  87. NAMEOF_LOCAL_NTE);
  88. walk_state->local_variables[i].name.integer |= (i << 24);
  89. walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED;
  90. walk_state->local_variables[i].type = ACPI_TYPE_ANY;
  91. walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
  92. }
  93. return_VOID;
  94. }
  95. /*******************************************************************************
  96. *
  97. * FUNCTION: acpi_ds_method_data_delete_all
  98. *
  99. * PARAMETERS: walk_state - Current walk state object
  100. *
  101. * RETURN: None
  102. *
  103. * DESCRIPTION: Delete method locals and arguments. Arguments are only
  104. * deleted if this method was called from another method.
  105. *
  106. ******************************************************************************/
  107. void
  108. acpi_ds_method_data_delete_all (
  109. struct acpi_walk_state *walk_state)
  110. {
  111. u32 index;
  112. ACPI_FUNCTION_TRACE ("ds_method_data_delete_all");
  113. /* Detach the locals */
  114. for (index = 0; index < ACPI_METHOD_NUM_LOCALS; index++) {
  115. if (walk_state->local_variables[index].object) {
  116. ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
  117. index, walk_state->local_variables[index].object));
  118. /* Detach object (if present) and remove a reference */
  119. acpi_ns_detach_object (&walk_state->local_variables[index]);
  120. }
  121. }
  122. /* Detach the arguments */
  123. for (index = 0; index < ACPI_METHOD_NUM_ARGS; index++) {
  124. if (walk_state->arguments[index].object) {
  125. ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
  126. index, walk_state->arguments[index].object));
  127. /* Detach object (if present) and remove a reference */
  128. acpi_ns_detach_object (&walk_state->arguments[index]);
  129. }
  130. }
  131. return_VOID;
  132. }
  133. /*******************************************************************************
  134. *
  135. * FUNCTION: acpi_ds_method_data_init_args
  136. *
  137. * PARAMETERS: *Params - Pointer to a parameter list for the method
  138. * max_param_count - The arg count for this method
  139. * walk_state - Current walk state object
  140. *
  141. * RETURN: Status
  142. *
  143. * DESCRIPTION: Initialize arguments for a method. The parameter list is a list
  144. * of ACPI operand objects, either null terminated or whose length
  145. * is defined by max_param_count.
  146. *
  147. ******************************************************************************/
  148. acpi_status
  149. acpi_ds_method_data_init_args (
  150. union acpi_operand_object **params,
  151. u32 max_param_count,
  152. struct acpi_walk_state *walk_state)
  153. {
  154. acpi_status status;
  155. u32 index = 0;
  156. ACPI_FUNCTION_TRACE_PTR ("ds_method_data_init_args", params);
  157. if (!params) {
  158. ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "No param list passed to method\n"));
  159. return_ACPI_STATUS (AE_OK);
  160. }
  161. /* Copy passed parameters into the new method stack frame */
  162. while ((index < ACPI_METHOD_NUM_ARGS) && (index < max_param_count) && params[index]) {
  163. /*
  164. * A valid parameter.
  165. * Store the argument in the method/walk descriptor.
  166. * Do not copy the arg in order to implement call by reference
  167. */
  168. status = acpi_ds_method_data_set_value (AML_ARG_OP, index, params[index], walk_state);
  169. if (ACPI_FAILURE (status)) {
  170. return_ACPI_STATUS (status);
  171. }
  172. index++;
  173. }
  174. ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", index));
  175. return_ACPI_STATUS (AE_OK);
  176. }
  177. /*******************************************************************************
  178. *
  179. * FUNCTION: acpi_ds_method_data_get_node
  180. *
  181. * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
  182. * Index - which local_var or argument whose type
  183. * to get
  184. * walk_state - Current walk state object
  185. *
  186. * RETURN: Get the Node associated with a local or arg.
  187. *
  188. ******************************************************************************/
  189. acpi_status
  190. acpi_ds_method_data_get_node (
  191. u16 opcode,
  192. u32 index,
  193. struct acpi_walk_state *walk_state,
  194. struct acpi_namespace_node **node)
  195. {
  196. ACPI_FUNCTION_TRACE ("ds_method_data_get_node");
  197. /*
  198. * Method Locals and Arguments are supported
  199. */
  200. switch (opcode) {
  201. case AML_LOCAL_OP:
  202. if (index > ACPI_METHOD_MAX_LOCAL) {
  203. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n",
  204. index, ACPI_METHOD_MAX_LOCAL));
  205. return_ACPI_STATUS (AE_AML_INVALID_INDEX);
  206. }
  207. /* Return a pointer to the pseudo-node */
  208. *node = &walk_state->local_variables[index];
  209. break;
  210. case AML_ARG_OP:
  211. if (index > ACPI_METHOD_MAX_ARG) {
  212. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n",
  213. index, ACPI_METHOD_MAX_ARG));
  214. return_ACPI_STATUS (AE_AML_INVALID_INDEX);
  215. }
  216. /* Return a pointer to the pseudo-node */
  217. *node = &walk_state->arguments[index];
  218. break;
  219. default:
  220. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", opcode));
  221. return_ACPI_STATUS (AE_AML_BAD_OPCODE);
  222. }
  223. return_ACPI_STATUS (AE_OK);
  224. }
  225. /*******************************************************************************
  226. *
  227. * FUNCTION: acpi_ds_method_data_set_value
  228. *
  229. * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
  230. * Index - which local_var or argument to get
  231. * Object - Object to be inserted into the stack entry
  232. * walk_state - Current walk state object
  233. *
  234. * RETURN: Status
  235. *
  236. * DESCRIPTION: Insert an object onto the method stack at entry Opcode:Index.
  237. * Note: There is no "implicit conversion" for locals.
  238. *
  239. ******************************************************************************/
  240. acpi_status
  241. acpi_ds_method_data_set_value (
  242. u16 opcode,
  243. u32 index,
  244. union acpi_operand_object *object,
  245. struct acpi_walk_state *walk_state)
  246. {
  247. acpi_status status;
  248. struct acpi_namespace_node *node;
  249. ACPI_FUNCTION_TRACE ("ds_method_data_set_value");
  250. ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
  251. "new_obj %p Opcode %X, Refs=%d [%s]\n", object,
  252. opcode, object->common.reference_count,
  253. acpi_ut_get_type_name (object->common.type)));
  254. /* Get the namespace node for the arg/local */
  255. status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
  256. if (ACPI_FAILURE (status)) {
  257. return_ACPI_STATUS (status);
  258. }
  259. /*
  260. * Increment ref count so object can't be deleted while installed.
  261. * NOTE: We do not copy the object in order to preserve the call by
  262. * reference semantics of ACPI Control Method invocation.
  263. * (See ACPI specification 2.0_c)
  264. */
  265. acpi_ut_add_reference (object);
  266. /* Install the object */
  267. node->object = object;
  268. return_ACPI_STATUS (status);
  269. }
  270. /*******************************************************************************
  271. *
  272. * FUNCTION: acpi_ds_method_data_get_type
  273. *
  274. * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
  275. * Index - which local_var or argument whose type
  276. * to get
  277. * walk_state - Current walk state object
  278. *
  279. * RETURN: Data type of current value of the selected Arg or Local
  280. *
  281. ******************************************************************************/
  282. #ifdef ACPI_FUTURE_USAGE
  283. acpi_object_type
  284. acpi_ds_method_data_get_type (
  285. u16 opcode,
  286. u32 index,
  287. struct acpi_walk_state *walk_state)
  288. {
  289. acpi_status status;
  290. struct acpi_namespace_node *node;
  291. union acpi_operand_object *object;
  292. ACPI_FUNCTION_TRACE ("ds_method_data_get_type");
  293. /* Get the namespace node for the arg/local */
  294. status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
  295. if (ACPI_FAILURE (status)) {
  296. return_VALUE ((ACPI_TYPE_NOT_FOUND));
  297. }
  298. /* Get the object */
  299. object = acpi_ns_get_attached_object (node);
  300. if (!object) {
  301. /* Uninitialized local/arg, return TYPE_ANY */
  302. return_VALUE (ACPI_TYPE_ANY);
  303. }
  304. /* Get the object type */
  305. return_VALUE (ACPI_GET_OBJECT_TYPE (object));
  306. }
  307. #endif /* ACPI_FUTURE_USAGE */
  308. /*******************************************************************************
  309. *
  310. * FUNCTION: acpi_ds_method_data_get_value
  311. *
  312. * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
  313. * Index - which local_var or argument to get
  314. * walk_state - Current walk state object
  315. * *dest_desc - Ptr to Descriptor into which selected Arg
  316. * or Local value should be copied
  317. *
  318. * RETURN: Status
  319. *
  320. * DESCRIPTION: Retrieve value of selected Arg or Local from the method frame
  321. * at the current top of the method stack.
  322. * Used only in acpi_ex_resolve_to_value().
  323. *
  324. ******************************************************************************/
  325. acpi_status
  326. acpi_ds_method_data_get_value (
  327. u16 opcode,
  328. u32 index,
  329. struct acpi_walk_state *walk_state,
  330. union acpi_operand_object **dest_desc)
  331. {
  332. acpi_status status;
  333. struct acpi_namespace_node *node;
  334. union acpi_operand_object *object;
  335. ACPI_FUNCTION_TRACE ("ds_method_data_get_value");
  336. /* Validate the object descriptor */
  337. if (!dest_desc) {
  338. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null object descriptor pointer\n"));
  339. return_ACPI_STATUS (AE_BAD_PARAMETER);
  340. }
  341. /* Get the namespace node for the arg/local */
  342. status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
  343. if (ACPI_FAILURE (status)) {
  344. return_ACPI_STATUS (status);
  345. }
  346. /* Get the object from the node */
  347. object = node->object;
  348. /* Examine the returned object, it must be valid. */
  349. if (!object) {
  350. /*
  351. * Index points to uninitialized object.
  352. * This means that either 1) The expected argument was
  353. * not passed to the method, or 2) A local variable
  354. * was referenced by the method (via the ASL)
  355. * before it was initialized. Either case is an error.
  356. */
  357. /* If slack enabled, init the local_x/arg_x to an Integer of value zero */
  358. if (acpi_gbl_enable_interpreter_slack) {
  359. object = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
  360. if (!object) {
  361. return_ACPI_STATUS (AE_NO_MEMORY);
  362. }
  363. object->integer.value = 0;
  364. node->object = object;
  365. }
  366. /* Otherwise, return the error */
  367. else switch (opcode) {
  368. case AML_ARG_OP:
  369. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at node %p\n",
  370. index, node));
  371. return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
  372. case AML_LOCAL_OP:
  373. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at node %p\n",
  374. index, node));
  375. return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
  376. default:
  377. ACPI_REPORT_ERROR (("Not Arg/Local opcode: %X\n", opcode));
  378. return_ACPI_STATUS (AE_AML_INTERNAL);
  379. }
  380. }
  381. /*
  382. * The Index points to an initialized and valid object.
  383. * Return an additional reference to the object
  384. */
  385. *dest_desc = object;
  386. acpi_ut_add_reference (object);
  387. return_ACPI_STATUS (AE_OK);
  388. }
  389. /*******************************************************************************
  390. *
  391. * FUNCTION: acpi_ds_method_data_delete_value
  392. *
  393. * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
  394. * Index - which local_var or argument to delete
  395. * walk_state - Current walk state object
  396. *
  397. * RETURN: None
  398. *
  399. * DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts
  400. * a null into the stack slot after the object is deleted.
  401. *
  402. ******************************************************************************/
  403. void
  404. acpi_ds_method_data_delete_value (
  405. u16 opcode,
  406. u32 index,
  407. struct acpi_walk_state *walk_state)
  408. {
  409. acpi_status status;
  410. struct acpi_namespace_node *node;
  411. union acpi_operand_object *object;
  412. ACPI_FUNCTION_TRACE ("ds_method_data_delete_value");
  413. /* Get the namespace node for the arg/local */
  414. status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
  415. if (ACPI_FAILURE (status)) {
  416. return_VOID;
  417. }
  418. /* Get the associated object */
  419. object = acpi_ns_get_attached_object (node);
  420. /*
  421. * Undefine the Arg or Local by setting its descriptor
  422. * pointer to NULL. Locals/Args can contain both
  423. * ACPI_OPERAND_OBJECTS and ACPI_NAMESPACE_NODEs
  424. */
  425. node->object = NULL;
  426. if ((object) &&
  427. (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_OPERAND)) {
  428. /*
  429. * There is a valid object.
  430. * Decrement the reference count by one to balance the
  431. * increment when the object was stored.
  432. */
  433. acpi_ut_remove_reference (object);
  434. }
  435. return_VOID;
  436. }
  437. /*******************************************************************************
  438. *
  439. * FUNCTION: acpi_ds_store_object_to_local
  440. *
  441. * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
  442. * Index - which local_var or argument to set
  443. * obj_desc - Value to be stored
  444. * walk_state - Current walk state
  445. *
  446. * RETURN: Status
  447. *
  448. * DESCRIPTION: Store a value in an Arg or Local. The obj_desc is installed
  449. * as the new value for the Arg or Local and the reference count
  450. * for obj_desc is incremented.
  451. *
  452. ******************************************************************************/
  453. acpi_status
  454. acpi_ds_store_object_to_local (
  455. u16 opcode,
  456. u32 index,
  457. union acpi_operand_object *obj_desc,
  458. struct acpi_walk_state *walk_state)
  459. {
  460. acpi_status status;
  461. struct acpi_namespace_node *node;
  462. union acpi_operand_object *current_obj_desc;
  463. union acpi_operand_object *new_obj_desc;
  464. ACPI_FUNCTION_TRACE ("ds_store_object_to_local");
  465. ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
  466. opcode, index, obj_desc));
  467. /* Parameter validation */
  468. if (!obj_desc) {
  469. return_ACPI_STATUS (AE_BAD_PARAMETER);
  470. }
  471. /* Get the namespace node for the arg/local */
  472. status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
  473. if (ACPI_FAILURE (status)) {
  474. return_ACPI_STATUS (status);
  475. }
  476. current_obj_desc = acpi_ns_get_attached_object (node);
  477. if (current_obj_desc == obj_desc) {
  478. ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n",
  479. obj_desc));
  480. return_ACPI_STATUS (status);
  481. }
  482. /*
  483. * If the reference count on the object is more than one, we must
  484. * take a copy of the object before we store. A reference count
  485. * of exactly 1 means that the object was just created during the
  486. * evaluation of an expression, and we can safely use it since it
  487. * is not used anywhere else.
  488. */
  489. new_obj_desc = obj_desc;
  490. if (obj_desc->common.reference_count > 1) {
  491. status = acpi_ut_copy_iobject_to_iobject (obj_desc, &new_obj_desc, walk_state);
  492. if (ACPI_FAILURE (status)) {
  493. return_ACPI_STATUS (status);
  494. }
  495. }
  496. /*
  497. * If there is an object already in this slot, we either
  498. * have to delete it, or if this is an argument and there
  499. * is an object reference stored there, we have to do
  500. * an indirect store!
  501. */
  502. if (current_obj_desc) {
  503. /*
  504. * Check for an indirect store if an argument
  505. * contains an object reference (stored as an Node).
  506. * We don't allow this automatic dereferencing for
  507. * locals, since a store to a local should overwrite
  508. * anything there, including an object reference.
  509. *
  510. * If both Arg0 and Local0 contain ref_of (Local4):
  511. *
  512. * Store (1, Arg0) - Causes indirect store to local4
  513. * Store (1, Local0) - Stores 1 in local0, overwriting
  514. * the reference to local4
  515. * Store (1, de_refof (Local0)) - Causes indirect store to local4
  516. *
  517. * Weird, but true.
  518. */
  519. if (opcode == AML_ARG_OP) {
  520. /*
  521. * Make sure that the object is the correct type. This may be overkill, but
  522. * it is here because references were NS nodes in the past. Now they are
  523. * operand objects of type Reference.
  524. */
  525. if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) {
  526. ACPI_REPORT_ERROR (("Invalid descriptor type while storing to method arg: [%s]\n",
  527. acpi_ut_get_descriptor_name (current_obj_desc)));
  528. return_ACPI_STATUS (AE_AML_INTERNAL);
  529. }
  530. /*
  531. * If we have a valid reference object that came from ref_of(), do the
  532. * indirect store
  533. */
  534. if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
  535. (current_obj_desc->reference.opcode == AML_REF_OF_OP)) {
  536. ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
  537. "Arg (%p) is an obj_ref(Node), storing in node %p\n",
  538. new_obj_desc, current_obj_desc));
  539. /*
  540. * Store this object to the Node (perform the indirect store)
  541. * NOTE: No implicit conversion is performed, as per the ACPI
  542. * specification rules on storing to Locals/Args.
  543. */
  544. status = acpi_ex_store_object_to_node (new_obj_desc,
  545. current_obj_desc->reference.object, walk_state,
  546. ACPI_NO_IMPLICIT_CONVERSION);
  547. /* Remove local reference if we copied the object above */
  548. if (new_obj_desc != obj_desc) {
  549. acpi_ut_remove_reference (new_obj_desc);
  550. }
  551. return_ACPI_STATUS (status);
  552. }
  553. }
  554. /*
  555. * Delete the existing object
  556. * before storing the new one
  557. */
  558. acpi_ds_method_data_delete_value (opcode, index, walk_state);
  559. }
  560. /*
  561. * Install the Obj descriptor (*new_obj_desc) into
  562. * the descriptor for the Arg or Local.
  563. * (increments the object reference count by one)
  564. */
  565. status = acpi_ds_method_data_set_value (opcode, index, new_obj_desc, walk_state);
  566. /* Remove local reference if we copied the object above */
  567. if (new_obj_desc != obj_desc) {
  568. acpi_ut_remove_reference (new_obj_desc);
  569. }
  570. return_ACPI_STATUS (status);
  571. }