nsrepair2.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. /******************************************************************************
  2. *
  3. * Module Name: nsrepair2 - Repair for objects returned by specific
  4. * predefined methods
  5. *
  6. *****************************************************************************/
  7. /*
  8. * Copyright (C) 2000 - 2009, Intel Corp.
  9. * All rights reserved.
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. * 1. Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions, and the following disclaimer,
  16. * without modification.
  17. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18. * substantially similar to the "NO WARRANTY" disclaimer below
  19. * ("Disclaimer") and any redistribution must be conditioned upon
  20. * including a substantially similar Disclaimer requirement for further
  21. * binary redistribution.
  22. * 3. Neither the names of the above-listed copyright holders nor the names
  23. * of any contributors may be used to endorse or promote products derived
  24. * from this software without specific prior written permission.
  25. *
  26. * Alternatively, this software may be distributed under the terms of the
  27. * GNU General Public License ("GPL") version 2 as published by the Free
  28. * Software Foundation.
  29. *
  30. * NO WARRANTY
  31. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  32. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  33. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  34. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  35. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  40. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41. * POSSIBILITY OF SUCH DAMAGES.
  42. */
  43. #include <acpi/acpi.h>
  44. #include "accommon.h"
  45. #include "acnamesp.h"
  46. #include "acpredef.h"
  47. #define _COMPONENT ACPI_NAMESPACE
  48. ACPI_MODULE_NAME("nsrepair2")
  49. /*
  50. * Information structure and handler for ACPI predefined names that can
  51. * be repaired on a per-name basis.
  52. */
  53. typedef
  54. acpi_status(*acpi_repair_function) (struct acpi_predefined_data *data,
  55. union acpi_operand_object **return_object_ptr);
  56. typedef struct acpi_repair_info {
  57. char name[ACPI_NAME_SIZE];
  58. acpi_repair_function repair_function;
  59. } acpi_repair_info;
  60. /* Local prototypes */
  61. static const struct acpi_repair_info *acpi_ns_match_repairable_name(struct
  62. acpi_namespace_node
  63. *node);
  64. static acpi_status
  65. acpi_ns_repair_ALR(struct acpi_predefined_data *data,
  66. union acpi_operand_object **return_object_ptr);
  67. static acpi_status
  68. acpi_ns_repair_FDE(struct acpi_predefined_data *data,
  69. union acpi_operand_object **return_object_ptr);
  70. static acpi_status
  71. acpi_ns_repair_PSS(struct acpi_predefined_data *data,
  72. union acpi_operand_object **return_object_ptr);
  73. static acpi_status
  74. acpi_ns_repair_TSS(struct acpi_predefined_data *data,
  75. union acpi_operand_object **return_object_ptr);
  76. static acpi_status
  77. acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
  78. union acpi_operand_object *return_object,
  79. u32 expected_count,
  80. u32 sort_index,
  81. u8 sort_direction, char *sort_key_name);
  82. static void
  83. acpi_ns_sort_list(union acpi_operand_object **elements,
  84. u32 count, u32 index, u8 sort_direction);
  85. /* Values for sort_direction above */
  86. #define ACPI_SORT_ASCENDING 0
  87. #define ACPI_SORT_DESCENDING 1
  88. /*
  89. * This table contains the names of the predefined methods for which we can
  90. * perform more complex repairs.
  91. *
  92. * As necessary:
  93. *
  94. * _ALR: Sort the list ascending by ambient_illuminance
  95. * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs
  96. * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs
  97. * _PSS: Sort the list descending by Power
  98. * _TSS: Sort the list descending by Power
  99. */
  100. static const struct acpi_repair_info acpi_ns_repairable_names[] = {
  101. {"_ALR", acpi_ns_repair_ALR},
  102. {"_FDE", acpi_ns_repair_FDE},
  103. {"_GTM", acpi_ns_repair_FDE}, /* _GTM has same repair as _FDE */
  104. {"_PSS", acpi_ns_repair_PSS},
  105. {"_TSS", acpi_ns_repair_TSS},
  106. {{0, 0, 0, 0}, NULL} /* Table terminator */
  107. };
  108. #define ACPI_FDE_FIELD_COUNT 5
  109. #define ACPI_FDE_BYTE_BUFFER_SIZE 5
  110. #define ACPI_FDE_DWORD_BUFFER_SIZE (ACPI_FDE_FIELD_COUNT * sizeof (u32))
  111. /******************************************************************************
  112. *
  113. * FUNCTION: acpi_ns_complex_repairs
  114. *
  115. * PARAMETERS: Data - Pointer to validation data structure
  116. * Node - Namespace node for the method/object
  117. * validate_status - Original status of earlier validation
  118. * return_object_ptr - Pointer to the object returned from the
  119. * evaluation of a method or object
  120. *
  121. * RETURN: Status. AE_OK if repair was successful. If name is not
  122. * matched, validate_status is returned.
  123. *
  124. * DESCRIPTION: Attempt to repair/convert a return object of a type that was
  125. * not expected.
  126. *
  127. *****************************************************************************/
  128. acpi_status
  129. acpi_ns_complex_repairs(struct acpi_predefined_data *data,
  130. struct acpi_namespace_node *node,
  131. acpi_status validate_status,
  132. union acpi_operand_object **return_object_ptr)
  133. {
  134. const struct acpi_repair_info *predefined;
  135. acpi_status status;
  136. /* Check if this name is in the list of repairable names */
  137. predefined = acpi_ns_match_repairable_name(node);
  138. if (!predefined) {
  139. return (validate_status);
  140. }
  141. status = predefined->repair_function(data, return_object_ptr);
  142. return (status);
  143. }
  144. /******************************************************************************
  145. *
  146. * FUNCTION: acpi_ns_match_repairable_name
  147. *
  148. * PARAMETERS: Node - Namespace node for the method/object
  149. *
  150. * RETURN: Pointer to entry in repair table. NULL indicates not found.
  151. *
  152. * DESCRIPTION: Check an object name against the repairable object list.
  153. *
  154. *****************************************************************************/
  155. static const struct acpi_repair_info *acpi_ns_match_repairable_name(struct
  156. acpi_namespace_node
  157. *node)
  158. {
  159. const struct acpi_repair_info *this_name;
  160. /* Search info table for a repairable predefined method/object name */
  161. this_name = acpi_ns_repairable_names;
  162. while (this_name->repair_function) {
  163. if (ACPI_COMPARE_NAME(node->name.ascii, this_name->name)) {
  164. return (this_name);
  165. }
  166. this_name++;
  167. }
  168. return (NULL); /* Not found */
  169. }
  170. /******************************************************************************
  171. *
  172. * FUNCTION: acpi_ns_repair_ALR
  173. *
  174. * PARAMETERS: Data - Pointer to validation data structure
  175. * return_object_ptr - Pointer to the object returned from the
  176. * evaluation of a method or object
  177. *
  178. * RETURN: Status. AE_OK if object is OK or was repaired successfully
  179. *
  180. * DESCRIPTION: Repair for the _ALR object. If necessary, sort the object list
  181. * ascending by the ambient illuminance values.
  182. *
  183. *****************************************************************************/
  184. static acpi_status
  185. acpi_ns_repair_ALR(struct acpi_predefined_data *data,
  186. union acpi_operand_object **return_object_ptr)
  187. {
  188. union acpi_operand_object *return_object = *return_object_ptr;
  189. acpi_status status;
  190. status = acpi_ns_check_sorted_list(data, return_object, 2, 1,
  191. ACPI_SORT_ASCENDING,
  192. "AmbientIlluminance");
  193. return (status);
  194. }
  195. /******************************************************************************
  196. *
  197. * FUNCTION: acpi_ns_repair_FDE
  198. *
  199. * PARAMETERS: Data - Pointer to validation data structure
  200. * return_object_ptr - Pointer to the object returned from the
  201. * evaluation of a method or object
  202. *
  203. * RETURN: Status. AE_OK if object is OK or was repaired successfully
  204. *
  205. * DESCRIPTION: Repair for the _FDE and _GTM objects. The expected return
  206. * value is a Buffer of 5 DWORDs. This function repairs a common
  207. * problem where the return value is a Buffer of BYTEs, not
  208. * DWORDs.
  209. *
  210. *****************************************************************************/
  211. static acpi_status
  212. acpi_ns_repair_FDE(struct acpi_predefined_data *data,
  213. union acpi_operand_object **return_object_ptr)
  214. {
  215. union acpi_operand_object *return_object = *return_object_ptr;
  216. union acpi_operand_object *buffer_object;
  217. u8 *byte_buffer;
  218. u32 *dword_buffer;
  219. u32 i;
  220. ACPI_FUNCTION_NAME(ns_repair_FDE);
  221. switch (return_object->common.type) {
  222. case ACPI_TYPE_BUFFER:
  223. /* This is the expected type. Length should be (at least) 5 DWORDs */
  224. if (return_object->buffer.length >= ACPI_FDE_DWORD_BUFFER_SIZE) {
  225. return (AE_OK);
  226. }
  227. /* We can only repair if we have exactly 5 BYTEs */
  228. if (return_object->buffer.length != ACPI_FDE_BYTE_BUFFER_SIZE) {
  229. ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
  230. data->node_flags,
  231. "Incorrect return buffer length %u, expected %u",
  232. return_object->buffer.length,
  233. ACPI_FDE_DWORD_BUFFER_SIZE));
  234. return (AE_AML_OPERAND_TYPE);
  235. }
  236. /* Create the new (larger) buffer object */
  237. buffer_object =
  238. acpi_ut_create_buffer_object(ACPI_FDE_DWORD_BUFFER_SIZE);
  239. if (!buffer_object) {
  240. return (AE_NO_MEMORY);
  241. }
  242. /* Expand each byte to a DWORD */
  243. byte_buffer = return_object->buffer.pointer;
  244. dword_buffer =
  245. ACPI_CAST_PTR(u32, buffer_object->buffer.pointer);
  246. for (i = 0; i < ACPI_FDE_FIELD_COUNT; i++) {
  247. *dword_buffer = (u32) *byte_buffer;
  248. dword_buffer++;
  249. byte_buffer++;
  250. }
  251. ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
  252. "%s Expanded Byte Buffer to expected DWord Buffer\n",
  253. data->pathname));
  254. break;
  255. default:
  256. return (AE_AML_OPERAND_TYPE);
  257. }
  258. /* Delete the original return object, return the new buffer object */
  259. acpi_ut_remove_reference(return_object);
  260. *return_object_ptr = buffer_object;
  261. data->flags |= ACPI_OBJECT_REPAIRED;
  262. return (AE_OK);
  263. }
  264. /******************************************************************************
  265. *
  266. * FUNCTION: acpi_ns_repair_TSS
  267. *
  268. * PARAMETERS: Data - Pointer to validation data structure
  269. * return_object_ptr - Pointer to the object returned from the
  270. * evaluation of a method or object
  271. *
  272. * RETURN: Status. AE_OK if object is OK or was repaired successfully
  273. *
  274. * DESCRIPTION: Repair for the _TSS object. If necessary, sort the object list
  275. * descending by the power dissipation values.
  276. *
  277. *****************************************************************************/
  278. static acpi_status
  279. acpi_ns_repair_TSS(struct acpi_predefined_data *data,
  280. union acpi_operand_object **return_object_ptr)
  281. {
  282. union acpi_operand_object *return_object = *return_object_ptr;
  283. acpi_status status;
  284. status = acpi_ns_check_sorted_list(data, return_object, 5, 1,
  285. ACPI_SORT_DESCENDING,
  286. "PowerDissipation");
  287. return (status);
  288. }
  289. /******************************************************************************
  290. *
  291. * FUNCTION: acpi_ns_repair_PSS
  292. *
  293. * PARAMETERS: Data - Pointer to validation data structure
  294. * return_object_ptr - Pointer to the object returned from the
  295. * evaluation of a method or object
  296. *
  297. * RETURN: Status. AE_OK if object is OK or was repaired successfully
  298. *
  299. * DESCRIPTION: Repair for the _PSS object. If necessary, sort the object list
  300. * by the CPU frequencies. Check that the power dissipation values
  301. * are all proportional to CPU frequency (i.e., sorting by
  302. * frequency should be the same as sorting by power.)
  303. *
  304. *****************************************************************************/
  305. static acpi_status
  306. acpi_ns_repair_PSS(struct acpi_predefined_data *data,
  307. union acpi_operand_object **return_object_ptr)
  308. {
  309. union acpi_operand_object *return_object = *return_object_ptr;
  310. union acpi_operand_object **outer_elements;
  311. u32 outer_element_count;
  312. union acpi_operand_object **elements;
  313. union acpi_operand_object *obj_desc;
  314. u32 previous_value;
  315. acpi_status status;
  316. u32 i;
  317. /*
  318. * Entries (sub-packages) in the _PSS Package must be sorted by power
  319. * dissipation, in descending order. If it appears that the list is
  320. * incorrectly sorted, sort it. We sort by cpu_frequency, since this
  321. * should be proportional to the power.
  322. */
  323. status = acpi_ns_check_sorted_list(data, return_object, 6, 0,
  324. ACPI_SORT_DESCENDING,
  325. "CpuFrequency");
  326. if (ACPI_FAILURE(status)) {
  327. return (status);
  328. }
  329. /*
  330. * We now know the list is correctly sorted by CPU frequency. Check if
  331. * the power dissipation values are proportional.
  332. */
  333. previous_value = ACPI_UINT32_MAX;
  334. outer_elements = return_object->package.elements;
  335. outer_element_count = return_object->package.count;
  336. for (i = 0; i < outer_element_count; i++) {
  337. elements = (*outer_elements)->package.elements;
  338. obj_desc = elements[1]; /* Index1 = power_dissipation */
  339. if ((u32) obj_desc->integer.value > previous_value) {
  340. ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
  341. data->node_flags,
  342. "SubPackage[%u,%u] - suspicious power dissipation values",
  343. i - 1, i));
  344. }
  345. previous_value = (u32) obj_desc->integer.value;
  346. outer_elements++;
  347. }
  348. return (AE_OK);
  349. }
  350. /******************************************************************************
  351. *
  352. * FUNCTION: acpi_ns_check_sorted_list
  353. *
  354. * PARAMETERS: Data - Pointer to validation data structure
  355. * return_object - Pointer to the top-level returned object
  356. * expected_count - Minimum length of each sub-package
  357. * sort_index - Sub-package entry to sort on
  358. * sort_direction - Ascending or descending
  359. * sort_key_name - Name of the sort_index field
  360. *
  361. * RETURN: Status. AE_OK if the list is valid and is sorted correctly or
  362. * has been repaired by sorting the list.
  363. *
  364. * DESCRIPTION: Check if the package list is valid and sorted correctly by the
  365. * sort_index. If not, then sort the list.
  366. *
  367. *****************************************************************************/
  368. static acpi_status
  369. acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
  370. union acpi_operand_object *return_object,
  371. u32 expected_count,
  372. u32 sort_index,
  373. u8 sort_direction, char *sort_key_name)
  374. {
  375. u32 outer_element_count;
  376. union acpi_operand_object **outer_elements;
  377. union acpi_operand_object **elements;
  378. union acpi_operand_object *obj_desc;
  379. u32 i;
  380. u32 previous_value;
  381. ACPI_FUNCTION_NAME(ns_check_sorted_list);
  382. /* The top-level object must be a package */
  383. if (return_object->common.type != ACPI_TYPE_PACKAGE) {
  384. return (AE_AML_OPERAND_TYPE);
  385. }
  386. /*
  387. * NOTE: assumes list of sub-packages contains no NULL elements.
  388. * Any NULL elements should have been removed by earlier call
  389. * to acpi_ns_remove_null_elements.
  390. */
  391. outer_elements = return_object->package.elements;
  392. outer_element_count = return_object->package.count;
  393. if (!outer_element_count) {
  394. return (AE_AML_PACKAGE_LIMIT);
  395. }
  396. previous_value = 0;
  397. if (sort_direction == ACPI_SORT_DESCENDING) {
  398. previous_value = ACPI_UINT32_MAX;
  399. }
  400. /* Examine each subpackage */
  401. for (i = 0; i < outer_element_count; i++) {
  402. /* Each element of the top-level package must also be a package */
  403. if ((*outer_elements)->common.type != ACPI_TYPE_PACKAGE) {
  404. return (AE_AML_OPERAND_TYPE);
  405. }
  406. /* Each sub-package must have the minimum length */
  407. if ((*outer_elements)->package.count < expected_count) {
  408. return (AE_AML_PACKAGE_LIMIT);
  409. }
  410. elements = (*outer_elements)->package.elements;
  411. obj_desc = elements[sort_index];
  412. if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
  413. return (AE_AML_OPERAND_TYPE);
  414. }
  415. /*
  416. * The list must be sorted in the specified order. If we detect a
  417. * discrepancy, sort the entire list.
  418. */
  419. if (((sort_direction == ACPI_SORT_ASCENDING) &&
  420. (obj_desc->integer.value < previous_value)) ||
  421. ((sort_direction == ACPI_SORT_DESCENDING) &&
  422. (obj_desc->integer.value > previous_value))) {
  423. acpi_ns_sort_list(return_object->package.elements,
  424. outer_element_count, sort_index,
  425. sort_direction);
  426. data->flags |= ACPI_OBJECT_REPAIRED;
  427. ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
  428. "%s: Repaired unsorted list - now sorted by %s\n",
  429. data->pathname, sort_key_name));
  430. return (AE_OK);
  431. }
  432. previous_value = (u32) obj_desc->integer.value;
  433. outer_elements++;
  434. }
  435. return (AE_OK);
  436. }
  437. /******************************************************************************
  438. *
  439. * FUNCTION: acpi_ns_remove_null_elements
  440. *
  441. * PARAMETERS: Data - Pointer to validation data structure
  442. * package_type - An acpi_return_package_types value
  443. * obj_desc - A Package object
  444. *
  445. * RETURN: None.
  446. *
  447. * DESCRIPTION: Remove all NULL package elements from packages that contain
  448. * a variable number of sub-packages.
  449. *
  450. *****************************************************************************/
  451. void
  452. acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
  453. u8 package_type,
  454. union acpi_operand_object *obj_desc)
  455. {
  456. union acpi_operand_object **source;
  457. union acpi_operand_object **dest;
  458. u32 count;
  459. u32 new_count;
  460. u32 i;
  461. ACPI_FUNCTION_NAME(ns_remove_null_elements);
  462. /*
  463. * PTYPE1 packages contain no subpackages.
  464. * PTYPE2 packages contain a variable number of sub-packages. We can
  465. * safely remove all NULL elements from the PTYPE2 packages.
  466. */
  467. switch (package_type) {
  468. case ACPI_PTYPE1_FIXED:
  469. case ACPI_PTYPE1_VAR:
  470. case ACPI_PTYPE1_OPTION:
  471. return;
  472. case ACPI_PTYPE2:
  473. case ACPI_PTYPE2_COUNT:
  474. case ACPI_PTYPE2_PKG_COUNT:
  475. case ACPI_PTYPE2_FIXED:
  476. case ACPI_PTYPE2_MIN:
  477. case ACPI_PTYPE2_REV_FIXED:
  478. break;
  479. default:
  480. return;
  481. }
  482. count = obj_desc->package.count;
  483. new_count = count;
  484. source = obj_desc->package.elements;
  485. dest = source;
  486. /* Examine all elements of the package object, remove nulls */
  487. for (i = 0; i < count; i++) {
  488. if (!*source) {
  489. new_count--;
  490. } else {
  491. *dest = *source;
  492. dest++;
  493. }
  494. source++;
  495. }
  496. /* Update parent package if any null elements were removed */
  497. if (new_count < count) {
  498. ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
  499. "%s: Found and removed %u NULL elements\n",
  500. data->pathname, (count - new_count)));
  501. /* NULL terminate list and update the package count */
  502. *dest = NULL;
  503. obj_desc->package.count = new_count;
  504. }
  505. }
  506. /******************************************************************************
  507. *
  508. * FUNCTION: acpi_ns_sort_list
  509. *
  510. * PARAMETERS: Elements - Package object element list
  511. * Count - Element count for above
  512. * Index - Sort by which package element
  513. * sort_direction - Ascending or Descending sort
  514. *
  515. * RETURN: None
  516. *
  517. * DESCRIPTION: Sort the objects that are in a package element list.
  518. *
  519. * NOTE: Assumes that all NULL elements have been removed from the package,
  520. * and that all elements have been verified to be of type Integer.
  521. *
  522. *****************************************************************************/
  523. static void
  524. acpi_ns_sort_list(union acpi_operand_object **elements,
  525. u32 count, u32 index, u8 sort_direction)
  526. {
  527. union acpi_operand_object *obj_desc1;
  528. union acpi_operand_object *obj_desc2;
  529. union acpi_operand_object *temp_obj;
  530. u32 i;
  531. u32 j;
  532. /* Simple bubble sort */
  533. for (i = 1; i < count; i++) {
  534. for (j = (count - 1); j >= i; j--) {
  535. obj_desc1 = elements[j - 1]->package.elements[index];
  536. obj_desc2 = elements[j]->package.elements[index];
  537. if (((sort_direction == ACPI_SORT_ASCENDING) &&
  538. (obj_desc1->integer.value >
  539. obj_desc2->integer.value))
  540. || ((sort_direction == ACPI_SORT_DESCENDING)
  541. && (obj_desc1->integer.value <
  542. obj_desc2->integer.value))) {
  543. temp_obj = elements[j - 1];
  544. elements[j - 1] = elements[j];
  545. elements[j] = temp_obj;
  546. }
  547. }
  548. }
  549. }