exmisc.c 19 KB

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