exresop.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  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. goto next_operand;
  337. case ARGI_BUFFER:
  338. /*
  339. * Need an operand of type ACPI_TYPE_BUFFER,
  340. * But we can implicitly convert from a STRING or INTEGER
  341. * Aka - "Implicit Source Operand Conversion"
  342. */
  343. status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr);
  344. if (ACPI_FAILURE (status)) {
  345. if (status == AE_TYPE) {
  346. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
  347. "Needed [Integer/String/Buffer], found [%s] %p\n",
  348. acpi_ut_get_object_type_name (obj_desc), obj_desc));
  349. return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
  350. }
  351. return_ACPI_STATUS (status);
  352. }
  353. goto next_operand;
  354. case ARGI_STRING:
  355. /*
  356. * Need an operand of type ACPI_TYPE_STRING,
  357. * But we can implicitly convert from a BUFFER or INTEGER
  358. * Aka - "Implicit Source Operand Conversion"
  359. */
  360. status = acpi_ex_convert_to_string (obj_desc, stack_ptr,
  361. ACPI_IMPLICIT_CONVERT_HEX);
  362. if (ACPI_FAILURE (status)) {
  363. if (status == AE_TYPE) {
  364. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
  365. "Needed [Integer/String/Buffer], found [%s] %p\n",
  366. acpi_ut_get_object_type_name (obj_desc), obj_desc));
  367. return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
  368. }
  369. return_ACPI_STATUS (status);
  370. }
  371. goto next_operand;
  372. case ARGI_COMPUTEDATA:
  373. /* Need an operand of type INTEGER, STRING or BUFFER */
  374. switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
  375. case ACPI_TYPE_INTEGER:
  376. case ACPI_TYPE_STRING:
  377. case ACPI_TYPE_BUFFER:
  378. /* Valid operand */
  379. break;
  380. default:
  381. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
  382. "Needed [Integer/String/Buffer], found [%s] %p\n",
  383. acpi_ut_get_object_type_name (obj_desc), obj_desc));
  384. return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
  385. }
  386. goto next_operand;
  387. case ARGI_BUFFER_OR_STRING:
  388. /* Need an operand of type STRING or BUFFER */
  389. switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
  390. case ACPI_TYPE_STRING:
  391. case ACPI_TYPE_BUFFER:
  392. /* Valid operand */
  393. break;
  394. case ACPI_TYPE_INTEGER:
  395. /* Highest priority conversion is to type Buffer */
  396. status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr);
  397. if (ACPI_FAILURE (status)) {
  398. return_ACPI_STATUS (status);
  399. }
  400. break;
  401. default:
  402. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
  403. "Needed [Integer/String/Buffer], found [%s] %p\n",
  404. acpi_ut_get_object_type_name (obj_desc), obj_desc));
  405. return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
  406. }
  407. goto next_operand;
  408. case ARGI_DATAOBJECT:
  409. /*
  410. * ARGI_DATAOBJECT is only used by the size_of operator.
  411. * Need a buffer, string, package, or ref_of reference.
  412. *
  413. * The only reference allowed here is a direct reference to
  414. * a namespace node.
  415. */
  416. switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
  417. case ACPI_TYPE_PACKAGE:
  418. case ACPI_TYPE_STRING:
  419. case ACPI_TYPE_BUFFER:
  420. case ACPI_TYPE_LOCAL_REFERENCE:
  421. /* Valid operand */
  422. break;
  423. default:
  424. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
  425. "Needed [Buffer/String/Package/Reference], found [%s] %p\n",
  426. acpi_ut_get_object_type_name (obj_desc), obj_desc));
  427. return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
  428. }
  429. goto next_operand;
  430. case ARGI_COMPLEXOBJ:
  431. /* Need a buffer or package or (ACPI 2.0) String */
  432. switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
  433. case ACPI_TYPE_PACKAGE:
  434. case ACPI_TYPE_STRING:
  435. case ACPI_TYPE_BUFFER:
  436. /* Valid operand */
  437. break;
  438. default:
  439. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
  440. "Needed [Buffer/String/Package], found [%s] %p\n",
  441. acpi_ut_get_object_type_name (obj_desc), obj_desc));
  442. return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
  443. }
  444. goto next_operand;
  445. case ARGI_REGION_OR_FIELD:
  446. /* Need an operand of type REGION or a FIELD in a region */
  447. switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
  448. case ACPI_TYPE_REGION:
  449. case ACPI_TYPE_LOCAL_REGION_FIELD:
  450. case ACPI_TYPE_LOCAL_BANK_FIELD:
  451. case ACPI_TYPE_LOCAL_INDEX_FIELD:
  452. /* Valid operand */
  453. break;
  454. default:
  455. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
  456. "Needed [Region/region_field], found [%s] %p\n",
  457. acpi_ut_get_object_type_name (obj_desc), obj_desc));
  458. return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
  459. }
  460. goto next_operand;
  461. case ARGI_DATAREFOBJ:
  462. /* Used by the Store() operator only */
  463. switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
  464. case ACPI_TYPE_INTEGER:
  465. case ACPI_TYPE_PACKAGE:
  466. case ACPI_TYPE_STRING:
  467. case ACPI_TYPE_BUFFER:
  468. case ACPI_TYPE_BUFFER_FIELD:
  469. case ACPI_TYPE_LOCAL_REFERENCE:
  470. case ACPI_TYPE_LOCAL_REGION_FIELD:
  471. case ACPI_TYPE_LOCAL_BANK_FIELD:
  472. case ACPI_TYPE_LOCAL_INDEX_FIELD:
  473. case ACPI_TYPE_DDB_HANDLE:
  474. /* Valid operand */
  475. break;
  476. default:
  477. if (acpi_gbl_enable_interpreter_slack) {
  478. /*
  479. * Enable original behavior of Store(), allowing any and all
  480. * objects as the source operand. The ACPI spec does not
  481. * allow this, however.
  482. */
  483. break;
  484. }
  485. if (target_op == AML_DEBUG_OP) {
  486. /* Allow store of any object to the Debug object */
  487. break;
  488. }
  489. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
  490. "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
  491. acpi_ut_get_object_type_name (obj_desc), obj_desc));
  492. return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
  493. }
  494. goto next_operand;
  495. default:
  496. /* Unknown type */
  497. ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
  498. "Internal - Unknown ARGI (required operand) type %X\n",
  499. this_arg_type));
  500. return_ACPI_STATUS (AE_BAD_PARAMETER);
  501. }
  502. /*
  503. * Make sure that the original object was resolved to the
  504. * required object type (Simple cases only).
  505. */
  506. status = acpi_ex_check_object_type (type_needed,
  507. ACPI_GET_OBJECT_TYPE (*stack_ptr), *stack_ptr);
  508. if (ACPI_FAILURE (status)) {
  509. return_ACPI_STATUS (status);
  510. }
  511. next_operand:
  512. /*
  513. * If more operands needed, decrement stack_ptr to point
  514. * to next operand on stack
  515. */
  516. if (GET_CURRENT_ARG_TYPE (arg_types)) {
  517. stack_ptr--;
  518. }
  519. }
  520. return_ACPI_STATUS (status);
  521. }