exresop.c 22 KB

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