nsrepair.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. /******************************************************************************
  2. *
  3. * Module Name: nsrepair - Repair for objects returned by predefined methods
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2012, 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 "acnamesp.h"
  45. #include "acinterp.h"
  46. #include "acpredef.h"
  47. #define _COMPONENT ACPI_NAMESPACE
  48. ACPI_MODULE_NAME("nsrepair")
  49. /*******************************************************************************
  50. *
  51. * This module attempts to repair or convert objects returned by the
  52. * predefined methods to an object type that is expected, as per the ACPI
  53. * specification. The need for this code is dictated by the many machines that
  54. * return incorrect types for the standard predefined methods. Performing these
  55. * conversions here, in one place, eliminates the need for individual ACPI
  56. * device drivers to do the same. Note: Most of these conversions are different
  57. * than the internal object conversion routines used for implicit object
  58. * conversion.
  59. *
  60. * The following conversions can be performed as necessary:
  61. *
  62. * Integer -> String
  63. * Integer -> Buffer
  64. * String -> Integer
  65. * String -> Buffer
  66. * Buffer -> Integer
  67. * Buffer -> String
  68. * Buffer -> Package of Integers
  69. * Package -> Package of one Package
  70. * An incorrect standalone object is wrapped with required outer package
  71. *
  72. * Additional possible repairs:
  73. * Required package elements that are NULL replaced by Integer/String/Buffer
  74. *
  75. ******************************************************************************/
  76. /* Local prototypes */
  77. static acpi_status
  78. acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
  79. union acpi_operand_object **return_object);
  80. static acpi_status
  81. acpi_ns_convert_to_string(union acpi_operand_object *original_object,
  82. union acpi_operand_object **return_object);
  83. static acpi_status
  84. acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
  85. union acpi_operand_object **return_object);
  86. /*******************************************************************************
  87. *
  88. * FUNCTION: acpi_ns_repair_object
  89. *
  90. * PARAMETERS: Data - Pointer to validation data structure
  91. * expected_btypes - Object types expected
  92. * package_index - Index of object within parent package (if
  93. * applicable - ACPI_NOT_PACKAGE_ELEMENT
  94. * otherwise)
  95. * return_object_ptr - Pointer to the object returned from the
  96. * evaluation of a method or object
  97. *
  98. * RETURN: Status. AE_OK if repair was successful.
  99. *
  100. * DESCRIPTION: Attempt to repair/convert a return object of a type that was
  101. * not expected.
  102. *
  103. ******************************************************************************/
  104. acpi_status
  105. acpi_ns_repair_object(struct acpi_predefined_data *data,
  106. u32 expected_btypes,
  107. u32 package_index,
  108. union acpi_operand_object **return_object_ptr)
  109. {
  110. union acpi_operand_object *return_object = *return_object_ptr;
  111. union acpi_operand_object *new_object;
  112. acpi_status status;
  113. ACPI_FUNCTION_NAME(ns_repair_object);
  114. /*
  115. * At this point, we know that the type of the returned object was not
  116. * one of the expected types for this predefined name. Attempt to
  117. * repair the object by converting it to one of the expected object
  118. * types for this predefined name.
  119. */
  120. if (expected_btypes & ACPI_RTYPE_INTEGER) {
  121. status = acpi_ns_convert_to_integer(return_object, &new_object);
  122. if (ACPI_SUCCESS(status)) {
  123. goto object_repaired;
  124. }
  125. }
  126. if (expected_btypes & ACPI_RTYPE_STRING) {
  127. status = acpi_ns_convert_to_string(return_object, &new_object);
  128. if (ACPI_SUCCESS(status)) {
  129. goto object_repaired;
  130. }
  131. }
  132. if (expected_btypes & ACPI_RTYPE_BUFFER) {
  133. status = acpi_ns_convert_to_buffer(return_object, &new_object);
  134. if (ACPI_SUCCESS(status)) {
  135. goto object_repaired;
  136. }
  137. }
  138. if (expected_btypes & ACPI_RTYPE_PACKAGE) {
  139. /*
  140. * A package is expected. We will wrap the existing object with a
  141. * new package object. It is often the case that if a variable-length
  142. * package is required, but there is only a single object needed, the
  143. * BIOS will return that object instead of wrapping it with a Package
  144. * object. Note: after the wrapping, the package will be validated
  145. * for correct contents (expected object type or types).
  146. */
  147. status =
  148. acpi_ns_wrap_with_package(data, return_object, &new_object);
  149. if (ACPI_SUCCESS(status)) {
  150. /*
  151. * The original object just had its reference count
  152. * incremented for being inserted into the new package.
  153. */
  154. *return_object_ptr = new_object; /* New Package object */
  155. data->flags |= ACPI_OBJECT_REPAIRED;
  156. return (AE_OK);
  157. }
  158. }
  159. /* We cannot repair this object */
  160. return (AE_AML_OPERAND_TYPE);
  161. object_repaired:
  162. /* Object was successfully repaired */
  163. if (package_index != ACPI_NOT_PACKAGE_ELEMENT) {
  164. /*
  165. * The original object is a package element. We need to
  166. * decrement the reference count of the original object,
  167. * for removing it from the package.
  168. *
  169. * However, if the original object was just wrapped with a
  170. * package object as part of the repair, we don't need to
  171. * change the reference count.
  172. */
  173. if (!(data->flags & ACPI_OBJECT_WRAPPED)) {
  174. new_object->common.reference_count =
  175. return_object->common.reference_count;
  176. if (return_object->common.reference_count > 1) {
  177. return_object->common.reference_count--;
  178. }
  179. }
  180. ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
  181. "%s: Converted %s to expected %s at Package index %u\n",
  182. data->pathname,
  183. acpi_ut_get_object_type_name(return_object),
  184. acpi_ut_get_object_type_name(new_object),
  185. package_index));
  186. } else {
  187. ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
  188. "%s: Converted %s to expected %s\n",
  189. data->pathname,
  190. acpi_ut_get_object_type_name(return_object),
  191. acpi_ut_get_object_type_name(new_object)));
  192. }
  193. /* Delete old object, install the new return object */
  194. acpi_ut_remove_reference(return_object);
  195. *return_object_ptr = new_object;
  196. data->flags |= ACPI_OBJECT_REPAIRED;
  197. return (AE_OK);
  198. }
  199. /*******************************************************************************
  200. *
  201. * FUNCTION: acpi_ns_convert_to_integer
  202. *
  203. * PARAMETERS: original_object - Object to be converted
  204. * return_object - Where the new converted object is returned
  205. *
  206. * RETURN: Status. AE_OK if conversion was successful.
  207. *
  208. * DESCRIPTION: Attempt to convert a String/Buffer object to an Integer.
  209. *
  210. ******************************************************************************/
  211. static acpi_status
  212. acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
  213. union acpi_operand_object **return_object)
  214. {
  215. union acpi_operand_object *new_object;
  216. acpi_status status;
  217. u64 value = 0;
  218. u32 i;
  219. switch (original_object->common.type) {
  220. case ACPI_TYPE_STRING:
  221. /* String-to-Integer conversion */
  222. status = acpi_ut_strtoul64(original_object->string.pointer,
  223. ACPI_ANY_BASE, &value);
  224. if (ACPI_FAILURE(status)) {
  225. return (status);
  226. }
  227. break;
  228. case ACPI_TYPE_BUFFER:
  229. /* Buffer-to-Integer conversion. Max buffer size is 64 bits. */
  230. if (original_object->buffer.length > 8) {
  231. return (AE_AML_OPERAND_TYPE);
  232. }
  233. /* Extract each buffer byte to create the integer */
  234. for (i = 0; i < original_object->buffer.length; i++) {
  235. value |=
  236. ((u64) original_object->buffer.
  237. pointer[i] << (i * 8));
  238. }
  239. break;
  240. default:
  241. return (AE_AML_OPERAND_TYPE);
  242. }
  243. new_object = acpi_ut_create_integer_object(value);
  244. if (!new_object) {
  245. return (AE_NO_MEMORY);
  246. }
  247. *return_object = new_object;
  248. return (AE_OK);
  249. }
  250. /*******************************************************************************
  251. *
  252. * FUNCTION: acpi_ns_convert_to_string
  253. *
  254. * PARAMETERS: original_object - Object to be converted
  255. * return_object - Where the new converted object is returned
  256. *
  257. * RETURN: Status. AE_OK if conversion was successful.
  258. *
  259. * DESCRIPTION: Attempt to convert a Integer/Buffer object to a String.
  260. *
  261. ******************************************************************************/
  262. static acpi_status
  263. acpi_ns_convert_to_string(union acpi_operand_object *original_object,
  264. union acpi_operand_object **return_object)
  265. {
  266. union acpi_operand_object *new_object;
  267. acpi_size length;
  268. acpi_status status;
  269. switch (original_object->common.type) {
  270. case ACPI_TYPE_INTEGER:
  271. /*
  272. * Integer-to-String conversion. Commonly, convert
  273. * an integer of value 0 to a NULL string. The last element of
  274. * _BIF and _BIX packages occasionally need this fix.
  275. */
  276. if (original_object->integer.value == 0) {
  277. /* Allocate a new NULL string object */
  278. new_object = acpi_ut_create_string_object(0);
  279. if (!new_object) {
  280. return (AE_NO_MEMORY);
  281. }
  282. } else {
  283. status =
  284. acpi_ex_convert_to_string(original_object,
  285. &new_object,
  286. ACPI_IMPLICIT_CONVERT_HEX);
  287. if (ACPI_FAILURE(status)) {
  288. return (status);
  289. }
  290. }
  291. break;
  292. case ACPI_TYPE_BUFFER:
  293. /*
  294. * Buffer-to-String conversion. Use a to_string
  295. * conversion, no transform performed on the buffer data. The best
  296. * example of this is the _BIF method, where the string data from
  297. * the battery is often (incorrectly) returned as buffer object(s).
  298. */
  299. length = 0;
  300. while ((length < original_object->buffer.length) &&
  301. (original_object->buffer.pointer[length])) {
  302. length++;
  303. }
  304. /* Allocate a new string object */
  305. new_object = acpi_ut_create_string_object(length);
  306. if (!new_object) {
  307. return (AE_NO_MEMORY);
  308. }
  309. /*
  310. * Copy the raw buffer data with no transform. String is already NULL
  311. * terminated at Length+1.
  312. */
  313. ACPI_MEMCPY(new_object->string.pointer,
  314. original_object->buffer.pointer, length);
  315. break;
  316. default:
  317. return (AE_AML_OPERAND_TYPE);
  318. }
  319. *return_object = new_object;
  320. return (AE_OK);
  321. }
  322. /*******************************************************************************
  323. *
  324. * FUNCTION: acpi_ns_convert_to_buffer
  325. *
  326. * PARAMETERS: original_object - Object to be converted
  327. * return_object - Where the new converted object is returned
  328. *
  329. * RETURN: Status. AE_OK if conversion was successful.
  330. *
  331. * DESCRIPTION: Attempt to convert a Integer/String/Package object to a Buffer.
  332. *
  333. ******************************************************************************/
  334. static acpi_status
  335. acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
  336. union acpi_operand_object **return_object)
  337. {
  338. union acpi_operand_object *new_object;
  339. acpi_status status;
  340. union acpi_operand_object **elements;
  341. u32 *dword_buffer;
  342. u32 count;
  343. u32 i;
  344. switch (original_object->common.type) {
  345. case ACPI_TYPE_INTEGER:
  346. /*
  347. * Integer-to-Buffer conversion.
  348. * Convert the Integer to a packed-byte buffer. _MAT and other
  349. * objects need this sometimes, if a read has been performed on a
  350. * Field object that is less than or equal to the global integer
  351. * size (32 or 64 bits).
  352. */
  353. status =
  354. acpi_ex_convert_to_buffer(original_object, &new_object);
  355. if (ACPI_FAILURE(status)) {
  356. return (status);
  357. }
  358. break;
  359. case ACPI_TYPE_STRING:
  360. /* String-to-Buffer conversion. Simple data copy */
  361. new_object =
  362. acpi_ut_create_buffer_object(original_object->string.
  363. length);
  364. if (!new_object) {
  365. return (AE_NO_MEMORY);
  366. }
  367. ACPI_MEMCPY(new_object->buffer.pointer,
  368. original_object->string.pointer,
  369. original_object->string.length);
  370. break;
  371. case ACPI_TYPE_PACKAGE:
  372. /*
  373. * This case is often seen for predefined names that must return a
  374. * Buffer object with multiple DWORD integers within. For example,
  375. * _FDE and _GTM. The Package can be converted to a Buffer.
  376. */
  377. /* All elements of the Package must be integers */
  378. elements = original_object->package.elements;
  379. count = original_object->package.count;
  380. for (i = 0; i < count; i++) {
  381. if ((!*elements) ||
  382. ((*elements)->common.type != ACPI_TYPE_INTEGER)) {
  383. return (AE_AML_OPERAND_TYPE);
  384. }
  385. elements++;
  386. }
  387. /* Create the new buffer object to replace the Package */
  388. new_object = acpi_ut_create_buffer_object(ACPI_MUL_4(count));
  389. if (!new_object) {
  390. return (AE_NO_MEMORY);
  391. }
  392. /* Copy the package elements (integers) to the buffer as DWORDs */
  393. elements = original_object->package.elements;
  394. dword_buffer = ACPI_CAST_PTR(u32, new_object->buffer.pointer);
  395. for (i = 0; i < count; i++) {
  396. *dword_buffer = (u32) (*elements)->integer.value;
  397. dword_buffer++;
  398. elements++;
  399. }
  400. break;
  401. default:
  402. return (AE_AML_OPERAND_TYPE);
  403. }
  404. *return_object = new_object;
  405. return (AE_OK);
  406. }
  407. /*******************************************************************************
  408. *
  409. * FUNCTION: acpi_ns_repair_null_element
  410. *
  411. * PARAMETERS: Data - Pointer to validation data structure
  412. * expected_btypes - Object types expected
  413. * package_index - Index of object within parent package (if
  414. * applicable - ACPI_NOT_PACKAGE_ELEMENT
  415. * otherwise)
  416. * return_object_ptr - Pointer to the object returned from the
  417. * evaluation of a method or object
  418. *
  419. * RETURN: Status. AE_OK if repair was successful.
  420. *
  421. * DESCRIPTION: Attempt to repair a NULL element of a returned Package object.
  422. *
  423. ******************************************************************************/
  424. acpi_status
  425. acpi_ns_repair_null_element(struct acpi_predefined_data *data,
  426. u32 expected_btypes,
  427. u32 package_index,
  428. union acpi_operand_object **return_object_ptr)
  429. {
  430. union acpi_operand_object *return_object = *return_object_ptr;
  431. union acpi_operand_object *new_object;
  432. ACPI_FUNCTION_NAME(ns_repair_null_element);
  433. /* No repair needed if return object is non-NULL */
  434. if (return_object) {
  435. return (AE_OK);
  436. }
  437. /*
  438. * Attempt to repair a NULL element of a Package object. This applies to
  439. * predefined names that return a fixed-length package and each element
  440. * is required. It does not apply to variable-length packages where NULL
  441. * elements are allowed, especially at the end of the package.
  442. */
  443. if (expected_btypes & ACPI_RTYPE_INTEGER) {
  444. /* Need an Integer - create a zero-value integer */
  445. new_object = acpi_ut_create_integer_object((u64)0);
  446. } else if (expected_btypes & ACPI_RTYPE_STRING) {
  447. /* Need a String - create a NULL string */
  448. new_object = acpi_ut_create_string_object(0);
  449. } else if (expected_btypes & ACPI_RTYPE_BUFFER) {
  450. /* Need a Buffer - create a zero-length buffer */
  451. new_object = acpi_ut_create_buffer_object(0);
  452. } else {
  453. /* Error for all other expected types */
  454. return (AE_AML_OPERAND_TYPE);
  455. }
  456. if (!new_object) {
  457. return (AE_NO_MEMORY);
  458. }
  459. /* Set the reference count according to the parent Package object */
  460. new_object->common.reference_count =
  461. data->parent_package->common.reference_count;
  462. ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
  463. "%s: Converted NULL package element to expected %s at index %u\n",
  464. data->pathname,
  465. acpi_ut_get_object_type_name(new_object),
  466. package_index));
  467. *return_object_ptr = new_object;
  468. data->flags |= ACPI_OBJECT_REPAIRED;
  469. return (AE_OK);
  470. }
  471. /******************************************************************************
  472. *
  473. * FUNCTION: acpi_ns_remove_null_elements
  474. *
  475. * PARAMETERS: Data - Pointer to validation data structure
  476. * package_type - An acpi_return_package_types value
  477. * obj_desc - A Package object
  478. *
  479. * RETURN: None.
  480. *
  481. * DESCRIPTION: Remove all NULL package elements from packages that contain
  482. * a variable number of sub-packages. For these types of
  483. * packages, NULL elements can be safely removed.
  484. *
  485. *****************************************************************************/
  486. void
  487. acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
  488. u8 package_type,
  489. union acpi_operand_object *obj_desc)
  490. {
  491. union acpi_operand_object **source;
  492. union acpi_operand_object **dest;
  493. u32 count;
  494. u32 new_count;
  495. u32 i;
  496. ACPI_FUNCTION_NAME(ns_remove_null_elements);
  497. /*
  498. * We can safely remove all NULL elements from these package types:
  499. * PTYPE1_VAR packages contain a variable number of simple data types.
  500. * PTYPE2 packages contain a variable number of sub-packages.
  501. */
  502. switch (package_type) {
  503. case ACPI_PTYPE1_VAR:
  504. case ACPI_PTYPE2:
  505. case ACPI_PTYPE2_COUNT:
  506. case ACPI_PTYPE2_PKG_COUNT:
  507. case ACPI_PTYPE2_FIXED:
  508. case ACPI_PTYPE2_MIN:
  509. case ACPI_PTYPE2_REV_FIXED:
  510. case ACPI_PTYPE2_FIX_VAR:
  511. break;
  512. default:
  513. case ACPI_PTYPE1_FIXED:
  514. case ACPI_PTYPE1_OPTION:
  515. return;
  516. }
  517. count = obj_desc->package.count;
  518. new_count = count;
  519. source = obj_desc->package.elements;
  520. dest = source;
  521. /* Examine all elements of the package object, remove nulls */
  522. for (i = 0; i < count; i++) {
  523. if (!*source) {
  524. new_count--;
  525. } else {
  526. *dest = *source;
  527. dest++;
  528. }
  529. source++;
  530. }
  531. /* Update parent package if any null elements were removed */
  532. if (new_count < count) {
  533. ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
  534. "%s: Found and removed %u NULL elements\n",
  535. data->pathname, (count - new_count)));
  536. /* NULL terminate list and update the package count */
  537. *dest = NULL;
  538. obj_desc->package.count = new_count;
  539. }
  540. }
  541. /*******************************************************************************
  542. *
  543. * FUNCTION: acpi_ns_wrap_with_package
  544. *
  545. * PARAMETERS: Data - Pointer to validation data structure
  546. * original_object - Pointer to the object to repair.
  547. * obj_desc_ptr - The new package object is returned here
  548. *
  549. * RETURN: Status, new object in *obj_desc_ptr
  550. *
  551. * DESCRIPTION: Repair a common problem with objects that are defined to
  552. * return a variable-length Package of sub-objects. If there is
  553. * only one sub-object, some BIOS code mistakenly simply declares
  554. * the single object instead of a Package with one sub-object.
  555. * This function attempts to repair this error by wrapping a
  556. * Package object around the original object, creating the
  557. * correct and expected Package with one sub-object.
  558. *
  559. * Names that can be repaired in this manner include:
  560. * _ALR, _CSD, _HPX, _MLS, _PLD, _PRT, _PSS, _TRT, _TSS,
  561. * _BCL, _DOD, _FIX, _Sx
  562. *
  563. ******************************************************************************/
  564. acpi_status
  565. acpi_ns_wrap_with_package(struct acpi_predefined_data *data,
  566. union acpi_operand_object *original_object,
  567. union acpi_operand_object **obj_desc_ptr)
  568. {
  569. union acpi_operand_object *pkg_obj_desc;
  570. ACPI_FUNCTION_NAME(ns_wrap_with_package);
  571. /*
  572. * Create the new outer package and populate it. The new package will
  573. * have a single element, the lone sub-object.
  574. */
  575. pkg_obj_desc = acpi_ut_create_package_object(1);
  576. if (!pkg_obj_desc) {
  577. return (AE_NO_MEMORY);
  578. }
  579. pkg_obj_desc->package.elements[0] = original_object;
  580. ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
  581. "%s: Wrapped %s with expected Package object\n",
  582. data->pathname,
  583. acpi_ut_get_object_type_name(original_object)));
  584. /* Return the new object in the object pointer */
  585. *obj_desc_ptr = pkg_obj_desc;
  586. data->flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;
  587. return (AE_OK);
  588. }