exresop.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. /******************************************************************************
  2. *
  3. * Module Name: exresop - AML Interpreter operand/object resolution
  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/amlcode.h>
  44. #include <acpi/acparser.h>
  45. #include <acpi/acinterp.h>
  46. #define _COMPONENT ACPI_EXECUTER
  47. ACPI_MODULE_NAME("exresop")
  48. /* Local prototypes */
  49. static acpi_status
  50. acpi_ex_check_object_type(acpi_object_type type_needed,
  51. acpi_object_type this_type, void *object);
  52. /*******************************************************************************
  53. *
  54. * FUNCTION: acpi_ex_check_object_type
  55. *
  56. * PARAMETERS: type_needed Object type needed
  57. * this_type Actual object type
  58. * Object Object pointer
  59. *
  60. * RETURN: Status
  61. *
  62. * DESCRIPTION: Check required type against actual type
  63. *
  64. ******************************************************************************/
  65. static acpi_status
  66. acpi_ex_check_object_type(acpi_object_type type_needed,
  67. acpi_object_type this_type, void *object)
  68. {
  69. ACPI_FUNCTION_NAME("ex_check_object_type");
  70. if (type_needed == ACPI_TYPE_ANY) {
  71. /* All types OK, so we don't perform any typechecks */
  72. return (AE_OK);
  73. }
  74. if (type_needed == ACPI_TYPE_LOCAL_REFERENCE) {
  75. /*
  76. * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
  77. * objects and thus allow them to be targets. (As per the ACPI
  78. * specification, a store to a constant is a noop.)
  79. */
  80. if ((this_type == ACPI_TYPE_INTEGER) &&
  81. (((union acpi_operand_object *)object)->common.
  82. flags & AOPOBJ_AML_CONSTANT)) {
  83. return (AE_OK);
  84. }
  85. }
  86. if (type_needed != this_type) {
  87. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  88. "Needed [%s], found [%s] %p\n",
  89. acpi_ut_get_type_name(type_needed),
  90. acpi_ut_get_type_name(this_type), object));
  91. return (AE_AML_OPERAND_TYPE);
  92. }
  93. return (AE_OK);
  94. }
  95. /*******************************************************************************
  96. *
  97. * FUNCTION: acpi_ex_resolve_operands
  98. *
  99. * PARAMETERS: Opcode - Opcode being interpreted
  100. * stack_ptr - Pointer to the operand stack to be
  101. * resolved
  102. * walk_state - Current state
  103. *
  104. * RETURN: Status
  105. *
  106. * DESCRIPTION: Convert multiple input operands to the types required by the
  107. * target operator.
  108. *
  109. * Each 5-bit group in arg_types represents one required
  110. * operand and indicates the required Type. The corresponding operand
  111. * will be converted to the required type if possible, otherwise we
  112. * abort with an exception.
  113. *
  114. ******************************************************************************/
  115. acpi_status
  116. acpi_ex_resolve_operands(u16 opcode,
  117. union acpi_operand_object ** stack_ptr,
  118. struct acpi_walk_state * walk_state)
  119. {
  120. union acpi_operand_object *obj_desc;
  121. acpi_status status = AE_OK;
  122. u8 object_type;
  123. void *temp_node;
  124. u32 arg_types;
  125. const struct acpi_opcode_info *op_info;
  126. u32 this_arg_type;
  127. acpi_object_type type_needed;
  128. u16 target_op = 0;
  129. ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode);
  130. op_info = acpi_ps_get_opcode_info(opcode);
  131. if (op_info->class == AML_CLASS_UNKNOWN) {
  132. return_ACPI_STATUS(AE_AML_BAD_OPCODE);
  133. }
  134. arg_types = op_info->runtime_args;
  135. if (arg_types == ARGI_INVALID_OPCODE) {
  136. ACPI_REPORT_ERROR(("resolve_operands: %X is not a valid AML opcode\n", opcode));
  137. return_ACPI_STATUS(AE_AML_INTERNAL);
  138. }
  139. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  140. "Opcode %X [%s] required_operand_types=%8.8X \n",
  141. opcode, op_info->name, arg_types));
  142. /*
  143. * Normal exit is with (arg_types == 0) at end of argument list.
  144. * Function will return an exception from within the loop upon
  145. * finding an entry which is not (or cannot be converted
  146. * to) the required type; if stack underflows; or upon
  147. * finding a NULL stack entry (which should not happen).
  148. */
  149. while (GET_CURRENT_ARG_TYPE(arg_types)) {
  150. if (!stack_ptr || !*stack_ptr) {
  151. ACPI_REPORT_ERROR(("resolve_operands: Null stack entry at %p\n", stack_ptr));
  152. return_ACPI_STATUS(AE_AML_INTERNAL);
  153. }
  154. /* Extract useful items */
  155. obj_desc = *stack_ptr;
  156. /* Decode the descriptor type */
  157. switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
  158. case ACPI_DESC_TYPE_NAMED:
  159. /* Namespace Node */
  160. object_type =
  161. ((struct acpi_namespace_node *)obj_desc)->type;
  162. break;
  163. case ACPI_DESC_TYPE_OPERAND:
  164. /* ACPI internal object */
  165. object_type = ACPI_GET_OBJECT_TYPE(obj_desc);
  166. /* Check for bad acpi_object_type */
  167. if (!acpi_ut_valid_object_type(object_type)) {
  168. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  169. "Bad operand object type [%X]\n",
  170. object_type));
  171. return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
  172. }
  173. if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
  174. /* Decode the Reference */
  175. op_info = acpi_ps_get_opcode_info(opcode);
  176. if (op_info->class == AML_CLASS_UNKNOWN) {
  177. return_ACPI_STATUS(AE_AML_BAD_OPCODE);
  178. }
  179. switch (obj_desc->reference.opcode) {
  180. case AML_DEBUG_OP:
  181. target_op = AML_DEBUG_OP;
  182. /*lint -fallthrough */
  183. case AML_NAME_OP:
  184. case AML_INDEX_OP:
  185. case AML_REF_OF_OP:
  186. case AML_ARG_OP:
  187. case AML_LOCAL_OP:
  188. case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
  189. case AML_INT_NAMEPATH_OP: /* Reference to a named object */
  190. ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT
  191. ((ACPI_DB_EXEC,
  192. "Operand is a Reference, ref_opcode [%s]\n",
  193. (acpi_ps_get_opcode_info
  194. (obj_desc->
  195. reference.
  196. opcode))->
  197. name)));
  198. break;
  199. default:
  200. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  201. "Operand is a Reference, Unknown Reference Opcode %X [%s]\n",
  202. obj_desc->reference.
  203. opcode,
  204. (acpi_ps_get_opcode_info
  205. (obj_desc->reference.
  206. opcode))->name));
  207. return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
  208. }
  209. }
  210. break;
  211. default:
  212. /* Invalid descriptor */
  213. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  214. "Invalid descriptor %p [%s]\n",
  215. obj_desc,
  216. acpi_ut_get_descriptor_name
  217. (obj_desc)));
  218. return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
  219. }
  220. /* Get one argument type, point to the next */
  221. this_arg_type = GET_CURRENT_ARG_TYPE(arg_types);
  222. INCREMENT_ARG_LIST(arg_types);
  223. /*
  224. * Handle cases where the object does not need to be
  225. * resolved to a value
  226. */
  227. switch (this_arg_type) {
  228. case ARGI_REF_OR_STRING: /* Can be a String or Reference */
  229. if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
  230. ACPI_DESC_TYPE_OPERAND)
  231. && (ACPI_GET_OBJECT_TYPE(obj_desc) ==
  232. ACPI_TYPE_STRING)) {
  233. /*
  234. * String found - the string references a named object and
  235. * must be resolved to a node
  236. */
  237. goto next_operand;
  238. }
  239. /*
  240. * Else not a string - fall through to the normal Reference
  241. * case below
  242. */
  243. /*lint -fallthrough */
  244. case ARGI_REFERENCE: /* References: */
  245. case ARGI_INTEGER_REF:
  246. case ARGI_OBJECT_REF:
  247. case ARGI_DEVICE_REF:
  248. case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
  249. case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
  250. case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
  251. /*
  252. * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
  253. * A Namespace Node is OK as-is
  254. */
  255. if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
  256. ACPI_DESC_TYPE_NAMED) {
  257. goto next_operand;
  258. }
  259. status =
  260. acpi_ex_check_object_type(ACPI_TYPE_LOCAL_REFERENCE,
  261. object_type, obj_desc);
  262. if (ACPI_FAILURE(status)) {
  263. return_ACPI_STATUS(status);
  264. }
  265. if (obj_desc->reference.opcode == AML_NAME_OP) {
  266. /* Convert a named reference to the actual named object */
  267. temp_node = obj_desc->reference.object;
  268. acpi_ut_remove_reference(obj_desc);
  269. (*stack_ptr) = temp_node;
  270. }
  271. goto next_operand;
  272. case ARGI_DATAREFOBJ: /* Store operator only */
  273. /*
  274. * We don't want to resolve index_op reference objects during
  275. * a store because this would be an implicit de_ref_of operation.
  276. * Instead, we just want to store the reference object.
  277. * -- All others must be resolved below.
  278. */
  279. if ((opcode == AML_STORE_OP) &&
  280. (ACPI_GET_OBJECT_TYPE(*stack_ptr) ==
  281. ACPI_TYPE_LOCAL_REFERENCE)
  282. && ((*stack_ptr)->reference.opcode ==
  283. AML_INDEX_OP)) {
  284. goto next_operand;
  285. }
  286. break;
  287. default:
  288. /* All cases covered above */
  289. break;
  290. }
  291. /*
  292. * Resolve this object to a value
  293. */
  294. status = acpi_ex_resolve_to_value(stack_ptr, walk_state);
  295. if (ACPI_FAILURE(status)) {
  296. return_ACPI_STATUS(status);
  297. }
  298. /* Get the resolved object */
  299. obj_desc = *stack_ptr;
  300. /*
  301. * Check the resulting object (value) type
  302. */
  303. switch (this_arg_type) {
  304. /*
  305. * For the simple cases, only one type of resolved object
  306. * is allowed
  307. */
  308. case ARGI_MUTEX:
  309. /* Need an operand of type ACPI_TYPE_MUTEX */
  310. type_needed = ACPI_TYPE_MUTEX;
  311. break;
  312. case ARGI_EVENT:
  313. /* Need an operand of type ACPI_TYPE_EVENT */
  314. type_needed = ACPI_TYPE_EVENT;
  315. break;
  316. case ARGI_PACKAGE: /* Package */
  317. /* Need an operand of type ACPI_TYPE_PACKAGE */
  318. type_needed = ACPI_TYPE_PACKAGE;
  319. break;
  320. case ARGI_ANYTYPE:
  321. /* Any operand type will do */
  322. type_needed = ACPI_TYPE_ANY;
  323. break;
  324. case ARGI_DDBHANDLE:
  325. /* Need an operand of type ACPI_TYPE_DDB_HANDLE */
  326. type_needed = ACPI_TYPE_LOCAL_REFERENCE;
  327. break;
  328. /*
  329. * The more complex cases allow multiple resolved object types
  330. */
  331. case ARGI_INTEGER:
  332. /*
  333. * Need an operand of type ACPI_TYPE_INTEGER,
  334. * But we can implicitly convert from a STRING or BUFFER
  335. * Aka - "Implicit Source Operand Conversion"
  336. */
  337. status =
  338. acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16);
  339. if (ACPI_FAILURE(status)) {
  340. if (status == AE_TYPE) {
  341. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  342. "Needed [Integer/String/Buffer], found [%s] %p\n",
  343. acpi_ut_get_object_type_name
  344. (obj_desc),
  345. obj_desc));
  346. return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
  347. }
  348. return_ACPI_STATUS(status);
  349. }
  350. if (obj_desc != *stack_ptr) {
  351. acpi_ut_remove_reference(obj_desc);
  352. }
  353. goto next_operand;
  354. case ARGI_BUFFER:
  355. /*
  356. * Need an operand of type ACPI_TYPE_BUFFER,
  357. * But we can implicitly convert from a STRING or INTEGER
  358. * Aka - "Implicit Source Operand Conversion"
  359. */
  360. status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr);
  361. if (ACPI_FAILURE(status)) {
  362. if (status == AE_TYPE) {
  363. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  364. "Needed [Integer/String/Buffer], found [%s] %p\n",
  365. acpi_ut_get_object_type_name
  366. (obj_desc),
  367. obj_desc));
  368. return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
  369. }
  370. return_ACPI_STATUS(status);
  371. }
  372. if (obj_desc != *stack_ptr) {
  373. acpi_ut_remove_reference(obj_desc);
  374. }
  375. goto next_operand;
  376. case ARGI_STRING:
  377. /*
  378. * Need an operand of type ACPI_TYPE_STRING,
  379. * But we can implicitly convert from a BUFFER or INTEGER
  380. * Aka - "Implicit Source Operand Conversion"
  381. */
  382. status = acpi_ex_convert_to_string(obj_desc, stack_ptr,
  383. ACPI_IMPLICIT_CONVERT_HEX);
  384. if (ACPI_FAILURE(status)) {
  385. if (status == AE_TYPE) {
  386. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  387. "Needed [Integer/String/Buffer], found [%s] %p\n",
  388. acpi_ut_get_object_type_name
  389. (obj_desc),
  390. obj_desc));
  391. return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
  392. }
  393. return_ACPI_STATUS(status);
  394. }
  395. if (obj_desc != *stack_ptr) {
  396. acpi_ut_remove_reference(obj_desc);
  397. }
  398. goto next_operand;
  399. case ARGI_COMPUTEDATA:
  400. /* Need an operand of type INTEGER, STRING or BUFFER */
  401. switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
  402. case ACPI_TYPE_INTEGER:
  403. case ACPI_TYPE_STRING:
  404. case ACPI_TYPE_BUFFER:
  405. /* Valid operand */
  406. break;
  407. default:
  408. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  409. "Needed [Integer/String/Buffer], found [%s] %p\n",
  410. acpi_ut_get_object_type_name
  411. (obj_desc), obj_desc));
  412. return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
  413. }
  414. goto next_operand;
  415. case ARGI_BUFFER_OR_STRING:
  416. /* Need an operand of type STRING or BUFFER */
  417. switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
  418. case ACPI_TYPE_STRING:
  419. case ACPI_TYPE_BUFFER:
  420. /* Valid operand */
  421. break;
  422. case ACPI_TYPE_INTEGER:
  423. /* Highest priority conversion is to type Buffer */
  424. status =
  425. acpi_ex_convert_to_buffer(obj_desc,
  426. stack_ptr);
  427. if (ACPI_FAILURE(status)) {
  428. return_ACPI_STATUS(status);
  429. }
  430. if (obj_desc != *stack_ptr) {
  431. acpi_ut_remove_reference(obj_desc);
  432. }
  433. break;
  434. default:
  435. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  436. "Needed [Integer/String/Buffer], found [%s] %p\n",
  437. acpi_ut_get_object_type_name
  438. (obj_desc), obj_desc));
  439. return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
  440. }
  441. goto next_operand;
  442. case ARGI_DATAOBJECT:
  443. /*
  444. * ARGI_DATAOBJECT is only used by the size_of operator.
  445. * Need a buffer, string, package, or ref_of reference.
  446. *
  447. * The only reference allowed here is a direct reference to
  448. * a namespace node.
  449. */
  450. switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
  451. case ACPI_TYPE_PACKAGE:
  452. case ACPI_TYPE_STRING:
  453. case ACPI_TYPE_BUFFER:
  454. case ACPI_TYPE_LOCAL_REFERENCE:
  455. /* Valid operand */
  456. break;
  457. default:
  458. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  459. "Needed [Buffer/String/Package/Reference], found [%s] %p\n",
  460. acpi_ut_get_object_type_name
  461. (obj_desc), obj_desc));
  462. return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
  463. }
  464. goto next_operand;
  465. case ARGI_COMPLEXOBJ:
  466. /* Need a buffer or package or (ACPI 2.0) String */
  467. switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
  468. case ACPI_TYPE_PACKAGE:
  469. case ACPI_TYPE_STRING:
  470. case ACPI_TYPE_BUFFER:
  471. /* Valid operand */
  472. break;
  473. default:
  474. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  475. "Needed [Buffer/String/Package], found [%s] %p\n",
  476. acpi_ut_get_object_type_name
  477. (obj_desc), obj_desc));
  478. return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
  479. }
  480. goto next_operand;
  481. case ARGI_REGION_OR_FIELD:
  482. /* Need an operand of type REGION or a FIELD in a region */
  483. switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
  484. case ACPI_TYPE_REGION:
  485. case ACPI_TYPE_LOCAL_REGION_FIELD:
  486. case ACPI_TYPE_LOCAL_BANK_FIELD:
  487. case ACPI_TYPE_LOCAL_INDEX_FIELD:
  488. /* Valid operand */
  489. break;
  490. default:
  491. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  492. "Needed [Region/region_field], found [%s] %p\n",
  493. acpi_ut_get_object_type_name
  494. (obj_desc), obj_desc));
  495. return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
  496. }
  497. goto next_operand;
  498. case ARGI_DATAREFOBJ:
  499. /* Used by the Store() operator only */
  500. switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
  501. case ACPI_TYPE_INTEGER:
  502. case ACPI_TYPE_PACKAGE:
  503. case ACPI_TYPE_STRING:
  504. case ACPI_TYPE_BUFFER:
  505. case ACPI_TYPE_BUFFER_FIELD:
  506. case ACPI_TYPE_LOCAL_REFERENCE:
  507. case ACPI_TYPE_LOCAL_REGION_FIELD:
  508. case ACPI_TYPE_LOCAL_BANK_FIELD:
  509. case ACPI_TYPE_LOCAL_INDEX_FIELD:
  510. case ACPI_TYPE_DDB_HANDLE:
  511. /* Valid operand */
  512. break;
  513. default:
  514. if (acpi_gbl_enable_interpreter_slack) {
  515. /*
  516. * Enable original behavior of Store(), allowing any and all
  517. * objects as the source operand. The ACPI spec does not
  518. * allow this, however.
  519. */
  520. break;
  521. }
  522. if (target_op == AML_DEBUG_OP) {
  523. /* Allow store of any object to the Debug object */
  524. break;
  525. }
  526. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  527. "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
  528. acpi_ut_get_object_type_name
  529. (obj_desc), obj_desc));
  530. return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
  531. }
  532. goto next_operand;
  533. default:
  534. /* Unknown type */
  535. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  536. "Internal - Unknown ARGI (required operand) type %X\n",
  537. this_arg_type));
  538. return_ACPI_STATUS(AE_BAD_PARAMETER);
  539. }
  540. /*
  541. * Make sure that the original object was resolved to the
  542. * required object type (Simple cases only).
  543. */
  544. status = acpi_ex_check_object_type(type_needed,
  545. ACPI_GET_OBJECT_TYPE
  546. (*stack_ptr), *stack_ptr);
  547. if (ACPI_FAILURE(status)) {
  548. return_ACPI_STATUS(status);
  549. }
  550. next_operand:
  551. /*
  552. * If more operands needed, decrement stack_ptr to point
  553. * to next operand on stack
  554. */
  555. if (GET_CURRENT_ARG_TYPE(arg_types)) {
  556. stack_ptr--;
  557. }
  558. }
  559. return_ACPI_STATUS(status);
  560. }