exmisc.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. /******************************************************************************
  2. *
  3. * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2015, 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/acpi.h>
  43. #include "accommon.h"
  44. #include "acinterp.h"
  45. #include "amlcode.h"
  46. #include "amlresrc.h"
  47. #define _COMPONENT ACPI_EXECUTER
  48. ACPI_MODULE_NAME("exmisc")
  49. /*******************************************************************************
  50. *
  51. * FUNCTION: acpi_ex_get_object_reference
  52. *
  53. * PARAMETERS: obj_desc - Create a reference to this object
  54. * return_desc - Where to store the reference
  55. * walk_state - Current state
  56. *
  57. * RETURN: Status
  58. *
  59. * DESCRIPTION: Obtain and return a "reference" to the target object
  60. * Common code for the ref_of_op and the cond_ref_of_op.
  61. *
  62. ******************************************************************************/
  63. acpi_status
  64. acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
  65. union acpi_operand_object **return_desc,
  66. struct acpi_walk_state *walk_state)
  67. {
  68. union acpi_operand_object *reference_obj;
  69. union acpi_operand_object *referenced_obj;
  70. ACPI_FUNCTION_TRACE_PTR(ex_get_object_reference, obj_desc);
  71. *return_desc = NULL;
  72. switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
  73. case ACPI_DESC_TYPE_OPERAND:
  74. if (obj_desc->common.type != ACPI_TYPE_LOCAL_REFERENCE) {
  75. return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
  76. }
  77. /*
  78. * Must be a reference to a Local or Arg
  79. */
  80. switch (obj_desc->reference.class) {
  81. case ACPI_REFCLASS_LOCAL:
  82. case ACPI_REFCLASS_ARG:
  83. case ACPI_REFCLASS_DEBUG:
  84. /* The referenced object is the pseudo-node for the local/arg */
  85. referenced_obj = obj_desc->reference.object;
  86. break;
  87. default:
  88. ACPI_ERROR((AE_INFO, "Unknown Reference Class 0x%2.2X",
  89. obj_desc->reference.class));
  90. return_ACPI_STATUS(AE_AML_INTERNAL);
  91. }
  92. break;
  93. case ACPI_DESC_TYPE_NAMED:
  94. /*
  95. * A named reference that has already been resolved to a Node
  96. */
  97. referenced_obj = obj_desc;
  98. break;
  99. default:
  100. ACPI_ERROR((AE_INFO, "Invalid descriptor type 0x%X",
  101. ACPI_GET_DESCRIPTOR_TYPE(obj_desc)));
  102. return_ACPI_STATUS(AE_TYPE);
  103. }
  104. /* Create a new reference object */
  105. reference_obj =
  106. acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE);
  107. if (!reference_obj) {
  108. return_ACPI_STATUS(AE_NO_MEMORY);
  109. }
  110. reference_obj->reference.class = ACPI_REFCLASS_REFOF;
  111. reference_obj->reference.object = referenced_obj;
  112. *return_desc = reference_obj;
  113. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  114. "Object %p Type [%s], returning Reference %p\n",
  115. obj_desc, acpi_ut_get_object_type_name(obj_desc),
  116. *return_desc));
  117. return_ACPI_STATUS(AE_OK);
  118. }
  119. /*******************************************************************************
  120. *
  121. * FUNCTION: acpi_ex_concat_template
  122. *
  123. * PARAMETERS: operand0 - First source object
  124. * operand1 - Second source object
  125. * actual_return_desc - Where to place the return object
  126. * walk_state - Current walk state
  127. *
  128. * RETURN: Status
  129. *
  130. * DESCRIPTION: Concatenate two resource templates
  131. *
  132. ******************************************************************************/
  133. acpi_status
  134. acpi_ex_concat_template(union acpi_operand_object *operand0,
  135. union acpi_operand_object *operand1,
  136. union acpi_operand_object **actual_return_desc,
  137. struct acpi_walk_state *walk_state)
  138. {
  139. acpi_status status;
  140. union acpi_operand_object *return_desc;
  141. u8 *new_buf;
  142. u8 *end_tag;
  143. acpi_size length0;
  144. acpi_size length1;
  145. acpi_size new_length;
  146. ACPI_FUNCTION_TRACE(ex_concat_template);
  147. /*
  148. * Find the end_tag descriptor in each resource template.
  149. * Note1: returned pointers point TO the end_tag, not past it.
  150. * Note2: zero-length buffers are allowed; treated like one end_tag
  151. */
  152. /* Get the length of the first resource template */
  153. status = acpi_ut_get_resource_end_tag(operand0, &end_tag);
  154. if (ACPI_FAILURE(status)) {
  155. return_ACPI_STATUS(status);
  156. }
  157. length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer);
  158. /* Get the length of the second resource template */
  159. status = acpi_ut_get_resource_end_tag(operand1, &end_tag);
  160. if (ACPI_FAILURE(status)) {
  161. return_ACPI_STATUS(status);
  162. }
  163. length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer);
  164. /* Combine both lengths, minimum size will be 2 for end_tag */
  165. new_length = length0 + length1 + sizeof(struct aml_resource_end_tag);
  166. /* Create a new buffer object for the result (with one end_tag) */
  167. return_desc = acpi_ut_create_buffer_object(new_length);
  168. if (!return_desc) {
  169. return_ACPI_STATUS(AE_NO_MEMORY);
  170. }
  171. /*
  172. * Copy the templates to the new buffer, 0 first, then 1 follows. One
  173. * end_tag descriptor is copied from Operand1.
  174. */
  175. new_buf = return_desc->buffer.pointer;
  176. memcpy(new_buf, operand0->buffer.pointer, length0);
  177. memcpy(new_buf + length0, operand1->buffer.pointer, length1);
  178. /* Insert end_tag and set the checksum to zero, means "ignore checksum" */
  179. new_buf[new_length - 1] = 0;
  180. new_buf[new_length - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;
  181. /* Return the completed resource template */
  182. *actual_return_desc = return_desc;
  183. return_ACPI_STATUS(AE_OK);
  184. }
  185. /*******************************************************************************
  186. *
  187. * FUNCTION: acpi_ex_do_concatenate
  188. *
  189. * PARAMETERS: operand0 - First source object
  190. * operand1 - Second source object
  191. * actual_return_desc - Where to place the return object
  192. * walk_state - Current walk state
  193. *
  194. * RETURN: Status
  195. *
  196. * DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
  197. *
  198. ******************************************************************************/
  199. acpi_status
  200. acpi_ex_do_concatenate(union acpi_operand_object *operand0,
  201. union acpi_operand_object *operand1,
  202. union acpi_operand_object **actual_return_desc,
  203. struct acpi_walk_state *walk_state)
  204. {
  205. union acpi_operand_object *local_operand1 = operand1;
  206. union acpi_operand_object *return_desc;
  207. char *new_buf;
  208. acpi_status status;
  209. ACPI_FUNCTION_TRACE(ex_do_concatenate);
  210. /*
  211. * Convert the second operand if necessary. The first operand
  212. * determines the type of the second operand, (See the Data Types
  213. * section of the ACPI specification.) Both object types are
  214. * guaranteed to be either Integer/String/Buffer by the operand
  215. * resolution mechanism.
  216. */
  217. switch (operand0->common.type) {
  218. case ACPI_TYPE_INTEGER:
  219. status =
  220. acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
  221. break;
  222. case ACPI_TYPE_STRING:
  223. status = acpi_ex_convert_to_string(operand1, &local_operand1,
  224. ACPI_IMPLICIT_CONVERT_HEX);
  225. break;
  226. case ACPI_TYPE_BUFFER:
  227. status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
  228. break;
  229. default:
  230. ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
  231. operand0->common.type));
  232. status = AE_AML_INTERNAL;
  233. }
  234. if (ACPI_FAILURE(status)) {
  235. goto cleanup;
  236. }
  237. /*
  238. * Both operands are now known to be the same object type
  239. * (Both are Integer, String, or Buffer), and we can now perform the
  240. * concatenation.
  241. */
  242. /*
  243. * There are three cases to handle:
  244. *
  245. * 1) Two Integers concatenated to produce a new Buffer
  246. * 2) Two Strings concatenated to produce a new String
  247. * 3) Two Buffers concatenated to produce a new Buffer
  248. */
  249. switch (operand0->common.type) {
  250. case ACPI_TYPE_INTEGER:
  251. /* Result of two Integers is a Buffer */
  252. /* Need enough buffer space for two integers */
  253. return_desc = acpi_ut_create_buffer_object((acpi_size)
  254. ACPI_MUL_2
  255. (acpi_gbl_integer_byte_width));
  256. if (!return_desc) {
  257. status = AE_NO_MEMORY;
  258. goto cleanup;
  259. }
  260. new_buf = (char *)return_desc->buffer.pointer;
  261. /* Copy the first integer, LSB first */
  262. memcpy(new_buf, &operand0->integer.value,
  263. acpi_gbl_integer_byte_width);
  264. /* Copy the second integer (LSB first) after the first */
  265. memcpy(new_buf + acpi_gbl_integer_byte_width,
  266. &local_operand1->integer.value,
  267. acpi_gbl_integer_byte_width);
  268. break;
  269. case ACPI_TYPE_STRING:
  270. /* Result of two Strings is a String */
  271. return_desc = acpi_ut_create_string_object(((acpi_size)
  272. operand0->string.
  273. length +
  274. local_operand1->
  275. string.length));
  276. if (!return_desc) {
  277. status = AE_NO_MEMORY;
  278. goto cleanup;
  279. }
  280. new_buf = return_desc->string.pointer;
  281. /* Concatenate the strings */
  282. strcpy(new_buf, operand0->string.pointer);
  283. strcpy(new_buf + operand0->string.length,
  284. local_operand1->string.pointer);
  285. break;
  286. case ACPI_TYPE_BUFFER:
  287. /* Result of two Buffers is a Buffer */
  288. return_desc = acpi_ut_create_buffer_object(((acpi_size)
  289. operand0->buffer.
  290. length +
  291. local_operand1->
  292. buffer.length));
  293. if (!return_desc) {
  294. status = AE_NO_MEMORY;
  295. goto cleanup;
  296. }
  297. new_buf = (char *)return_desc->buffer.pointer;
  298. /* Concatenate the buffers */
  299. memcpy(new_buf, operand0->buffer.pointer,
  300. operand0->buffer.length);
  301. memcpy(new_buf + operand0->buffer.length,
  302. local_operand1->buffer.pointer,
  303. local_operand1->buffer.length);
  304. break;
  305. default:
  306. /* Invalid object type, should not happen here */
  307. ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
  308. operand0->common.type));
  309. status = AE_AML_INTERNAL;
  310. goto cleanup;
  311. }
  312. *actual_return_desc = return_desc;
  313. cleanup:
  314. if (local_operand1 != operand1) {
  315. acpi_ut_remove_reference(local_operand1);
  316. }
  317. return_ACPI_STATUS(status);
  318. }
  319. /*******************************************************************************
  320. *
  321. * FUNCTION: acpi_ex_do_math_op
  322. *
  323. * PARAMETERS: opcode - AML opcode
  324. * integer0 - Integer operand #0
  325. * integer1 - Integer operand #1
  326. *
  327. * RETURN: Integer result of the operation
  328. *
  329. * DESCRIPTION: Execute a math AML opcode. The purpose of having all of the
  330. * math functions here is to prevent a lot of pointer dereferencing
  331. * to obtain the operands.
  332. *
  333. ******************************************************************************/
  334. u64 acpi_ex_do_math_op(u16 opcode, u64 integer0, u64 integer1)
  335. {
  336. ACPI_FUNCTION_ENTRY();
  337. switch (opcode) {
  338. case AML_ADD_OP: /* Add (Integer0, Integer1, Result) */
  339. return (integer0 + integer1);
  340. case AML_BIT_AND_OP: /* And (Integer0, Integer1, Result) */
  341. return (integer0 & integer1);
  342. case AML_BIT_NAND_OP: /* NAnd (Integer0, Integer1, Result) */
  343. return (~(integer0 & integer1));
  344. case AML_BIT_OR_OP: /* Or (Integer0, Integer1, Result) */
  345. return (integer0 | integer1);
  346. case AML_BIT_NOR_OP: /* NOr (Integer0, Integer1, Result) */
  347. return (~(integer0 | integer1));
  348. case AML_BIT_XOR_OP: /* XOr (Integer0, Integer1, Result) */
  349. return (integer0 ^ integer1);
  350. case AML_MULTIPLY_OP: /* Multiply (Integer0, Integer1, Result) */
  351. return (integer0 * integer1);
  352. case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */
  353. /*
  354. * We need to check if the shiftcount is larger than the integer bit
  355. * width since the behavior of this is not well-defined in the C language.
  356. */
  357. if (integer1 >= acpi_gbl_integer_bit_width) {
  358. return (0);
  359. }
  360. return (integer0 << integer1);
  361. case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */
  362. /*
  363. * We need to check if the shiftcount is larger than the integer bit
  364. * width since the behavior of this is not well-defined in the C language.
  365. */
  366. if (integer1 >= acpi_gbl_integer_bit_width) {
  367. return (0);
  368. }
  369. return (integer0 >> integer1);
  370. case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */
  371. return (integer0 - integer1);
  372. default:
  373. return (0);
  374. }
  375. }
  376. /*******************************************************************************
  377. *
  378. * FUNCTION: acpi_ex_do_logical_numeric_op
  379. *
  380. * PARAMETERS: opcode - AML opcode
  381. * integer0 - Integer operand #0
  382. * integer1 - Integer operand #1
  383. * logical_result - TRUE/FALSE result of the operation
  384. *
  385. * RETURN: Status
  386. *
  387. * DESCRIPTION: Execute a logical "Numeric" AML opcode. For these Numeric
  388. * operators (LAnd and LOr), both operands must be integers.
  389. *
  390. * Note: cleanest machine code seems to be produced by the code
  391. * below, rather than using statements of the form:
  392. * Result = (Integer0 && Integer1);
  393. *
  394. ******************************************************************************/
  395. acpi_status
  396. acpi_ex_do_logical_numeric_op(u16 opcode,
  397. u64 integer0, u64 integer1, u8 *logical_result)
  398. {
  399. acpi_status status = AE_OK;
  400. u8 local_result = FALSE;
  401. ACPI_FUNCTION_TRACE(ex_do_logical_numeric_op);
  402. switch (opcode) {
  403. case AML_LAND_OP: /* LAnd (Integer0, Integer1) */
  404. if (integer0 && integer1) {
  405. local_result = TRUE;
  406. }
  407. break;
  408. case AML_LOR_OP: /* LOr (Integer0, Integer1) */
  409. if (integer0 || integer1) {
  410. local_result = TRUE;
  411. }
  412. break;
  413. default:
  414. status = AE_AML_INTERNAL;
  415. break;
  416. }
  417. /* Return the logical result and status */
  418. *logical_result = local_result;
  419. return_ACPI_STATUS(status);
  420. }
  421. /*******************************************************************************
  422. *
  423. * FUNCTION: acpi_ex_do_logical_op
  424. *
  425. * PARAMETERS: opcode - AML opcode
  426. * operand0 - operand #0
  427. * operand1 - operand #1
  428. * logical_result - TRUE/FALSE result of the operation
  429. *
  430. * RETURN: Status
  431. *
  432. * DESCRIPTION: Execute a logical AML opcode. The purpose of having all of the
  433. * functions here is to prevent a lot of pointer dereferencing
  434. * to obtain the operands and to simplify the generation of the
  435. * logical value. For the Numeric operators (LAnd and LOr), both
  436. * operands must be integers. For the other logical operators,
  437. * operands can be any combination of Integer/String/Buffer. The
  438. * first operand determines the type to which the second operand
  439. * will be converted.
  440. *
  441. * Note: cleanest machine code seems to be produced by the code
  442. * below, rather than using statements of the form:
  443. * Result = (Operand0 == Operand1);
  444. *
  445. ******************************************************************************/
  446. acpi_status
  447. acpi_ex_do_logical_op(u16 opcode,
  448. union acpi_operand_object *operand0,
  449. union acpi_operand_object *operand1, u8 * logical_result)
  450. {
  451. union acpi_operand_object *local_operand1 = operand1;
  452. u64 integer0;
  453. u64 integer1;
  454. u32 length0;
  455. u32 length1;
  456. acpi_status status = AE_OK;
  457. u8 local_result = FALSE;
  458. int compare;
  459. ACPI_FUNCTION_TRACE(ex_do_logical_op);
  460. /*
  461. * Convert the second operand if necessary. The first operand
  462. * determines the type of the second operand, (See the Data Types
  463. * section of the ACPI 3.0+ specification.) Both object types are
  464. * guaranteed to be either Integer/String/Buffer by the operand
  465. * resolution mechanism.
  466. */
  467. switch (operand0->common.type) {
  468. case ACPI_TYPE_INTEGER:
  469. status =
  470. acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
  471. break;
  472. case ACPI_TYPE_STRING:
  473. status = acpi_ex_convert_to_string(operand1, &local_operand1,
  474. ACPI_IMPLICIT_CONVERT_HEX);
  475. break;
  476. case ACPI_TYPE_BUFFER:
  477. status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
  478. break;
  479. default:
  480. status = AE_AML_INTERNAL;
  481. break;
  482. }
  483. if (ACPI_FAILURE(status)) {
  484. goto cleanup;
  485. }
  486. /*
  487. * Two cases: 1) Both Integers, 2) Both Strings or Buffers
  488. */
  489. if (operand0->common.type == ACPI_TYPE_INTEGER) {
  490. /*
  491. * 1) Both operands are of type integer
  492. * Note: local_operand1 may have changed above
  493. */
  494. integer0 = operand0->integer.value;
  495. integer1 = local_operand1->integer.value;
  496. switch (opcode) {
  497. case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */
  498. if (integer0 == integer1) {
  499. local_result = TRUE;
  500. }
  501. break;
  502. case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */
  503. if (integer0 > integer1) {
  504. local_result = TRUE;
  505. }
  506. break;
  507. case AML_LLESS_OP: /* LLess (Operand0, Operand1) */
  508. if (integer0 < integer1) {
  509. local_result = TRUE;
  510. }
  511. break;
  512. default:
  513. status = AE_AML_INTERNAL;
  514. break;
  515. }
  516. } else {
  517. /*
  518. * 2) Both operands are Strings or both are Buffers
  519. * Note: Code below takes advantage of common Buffer/String
  520. * object fields. local_operand1 may have changed above. Use
  521. * memcmp to handle nulls in buffers.
  522. */
  523. length0 = operand0->buffer.length;
  524. length1 = local_operand1->buffer.length;
  525. /* Lexicographic compare: compare the data bytes */
  526. compare = memcmp(operand0->buffer.pointer,
  527. local_operand1->buffer.pointer,
  528. (length0 > length1) ? length1 : length0);
  529. switch (opcode) {
  530. case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */
  531. /* Length and all bytes must be equal */
  532. if ((length0 == length1) && (compare == 0)) {
  533. /* Length and all bytes match ==> TRUE */
  534. local_result = TRUE;
  535. }
  536. break;
  537. case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */
  538. if (compare > 0) {
  539. local_result = TRUE;
  540. goto cleanup; /* TRUE */
  541. }
  542. if (compare < 0) {
  543. goto cleanup; /* FALSE */
  544. }
  545. /* Bytes match (to shortest length), compare lengths */
  546. if (length0 > length1) {
  547. local_result = TRUE;
  548. }
  549. break;
  550. case AML_LLESS_OP: /* LLess (Operand0, Operand1) */
  551. if (compare > 0) {
  552. goto cleanup; /* FALSE */
  553. }
  554. if (compare < 0) {
  555. local_result = TRUE;
  556. goto cleanup; /* TRUE */
  557. }
  558. /* Bytes match (to shortest length), compare lengths */
  559. if (length0 < length1) {
  560. local_result = TRUE;
  561. }
  562. break;
  563. default:
  564. status = AE_AML_INTERNAL;
  565. break;
  566. }
  567. }
  568. cleanup:
  569. /* New object was created if implicit conversion performed - delete */
  570. if (local_operand1 != operand1) {
  571. acpi_ut_remove_reference(local_operand1);
  572. }
  573. /* Return the logical result and status */
  574. *logical_result = local_result;
  575. return_ACPI_STATUS(status);
  576. }