exresop.c 18 KB

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