rsutils.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  1. // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
  2. /*******************************************************************************
  3. *
  4. * Module Name: rsutils - Utilities for the resource manager
  5. *
  6. ******************************************************************************/
  7. #include <acpi/acpi.h>
  8. #include "accommon.h"
  9. #include "acnamesp.h"
  10. #include "acresrc.h"
  11. #define _COMPONENT ACPI_RESOURCES
  12. ACPI_MODULE_NAME("rsutils")
  13. /*******************************************************************************
  14. *
  15. * FUNCTION: acpi_rs_decode_bitmask
  16. *
  17. * PARAMETERS: mask - Bitmask to decode
  18. * list - Where the converted list is returned
  19. *
  20. * RETURN: Count of bits set (length of list)
  21. *
  22. * DESCRIPTION: Convert a bit mask into a list of values
  23. *
  24. ******************************************************************************/
  25. u8 acpi_rs_decode_bitmask(u16 mask, u8 * list)
  26. {
  27. u8 i;
  28. u8 bit_count;
  29. ACPI_FUNCTION_ENTRY();
  30. /* Decode the mask bits */
  31. for (i = 0, bit_count = 0; mask; i++) {
  32. if (mask & 0x0001) {
  33. list[bit_count] = i;
  34. bit_count++;
  35. }
  36. mask >>= 1;
  37. }
  38. return (bit_count);
  39. }
  40. /*******************************************************************************
  41. *
  42. * FUNCTION: acpi_rs_encode_bitmask
  43. *
  44. * PARAMETERS: list - List of values to encode
  45. * count - Length of list
  46. *
  47. * RETURN: Encoded bitmask
  48. *
  49. * DESCRIPTION: Convert a list of values to an encoded bitmask
  50. *
  51. ******************************************************************************/
  52. u16 acpi_rs_encode_bitmask(u8 * list, u8 count)
  53. {
  54. u32 i;
  55. u16 mask;
  56. ACPI_FUNCTION_ENTRY();
  57. /* Encode the list into a single bitmask */
  58. for (i = 0, mask = 0; i < count; i++) {
  59. mask |= (0x1 << list[i]);
  60. }
  61. return (mask);
  62. }
  63. /*******************************************************************************
  64. *
  65. * FUNCTION: acpi_rs_move_data
  66. *
  67. * PARAMETERS: destination - Pointer to the destination descriptor
  68. * source - Pointer to the source descriptor
  69. * item_count - How many items to move
  70. * move_type - Byte width
  71. *
  72. * RETURN: None
  73. *
  74. * DESCRIPTION: Move multiple data items from one descriptor to another. Handles
  75. * alignment issues and endian issues if necessary, as configured
  76. * via the ACPI_MOVE_* macros. (This is why a memcpy is not used)
  77. *
  78. ******************************************************************************/
  79. void
  80. acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
  81. {
  82. u32 i;
  83. ACPI_FUNCTION_ENTRY();
  84. /* One move per item */
  85. for (i = 0; i < item_count; i++) {
  86. switch (move_type) {
  87. /*
  88. * For the 8-bit case, we can perform the move all at once
  89. * since there are no alignment or endian issues
  90. */
  91. case ACPI_RSC_MOVE8:
  92. case ACPI_RSC_MOVE_GPIO_RES:
  93. case ACPI_RSC_MOVE_SERIAL_VEN:
  94. case ACPI_RSC_MOVE_SERIAL_RES:
  95. memcpy(destination, source, item_count);
  96. return;
  97. /*
  98. * 16-, 32-, and 64-bit cases must use the move macros that perform
  99. * endian conversion and/or accommodate hardware that cannot perform
  100. * misaligned memory transfers
  101. */
  102. case ACPI_RSC_MOVE16:
  103. case ACPI_RSC_MOVE_GPIO_PIN:
  104. ACPI_MOVE_16_TO_16(&ACPI_CAST_PTR(u16, destination)[i],
  105. &ACPI_CAST_PTR(u16, source)[i]);
  106. break;
  107. case ACPI_RSC_MOVE32:
  108. ACPI_MOVE_32_TO_32(&ACPI_CAST_PTR(u32, destination)[i],
  109. &ACPI_CAST_PTR(u32, source)[i]);
  110. break;
  111. case ACPI_RSC_MOVE64:
  112. ACPI_MOVE_64_TO_64(&ACPI_CAST_PTR(u64, destination)[i],
  113. &ACPI_CAST_PTR(u64, source)[i]);
  114. break;
  115. default:
  116. return;
  117. }
  118. }
  119. }
  120. /*******************************************************************************
  121. *
  122. * FUNCTION: acpi_rs_set_resource_length
  123. *
  124. * PARAMETERS: total_length - Length of the AML descriptor, including
  125. * the header and length fields.
  126. * aml - Pointer to the raw AML descriptor
  127. *
  128. * RETURN: None
  129. *
  130. * DESCRIPTION: Set the resource_length field of an AML
  131. * resource descriptor, both Large and Small descriptors are
  132. * supported automatically. Note: Descriptor Type field must
  133. * be valid.
  134. *
  135. ******************************************************************************/
  136. void
  137. acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
  138. union aml_resource *aml)
  139. {
  140. acpi_rs_length resource_length;
  141. ACPI_FUNCTION_ENTRY();
  142. /* Length is the total descriptor length minus the header length */
  143. resource_length = (acpi_rs_length)
  144. (total_length - acpi_ut_get_resource_header_length(aml));
  145. /* Length is stored differently for large and small descriptors */
  146. if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
  147. /* Large descriptor -- bytes 1-2 contain the 16-bit length */
  148. ACPI_MOVE_16_TO_16(&aml->large_header.resource_length,
  149. &resource_length);
  150. } else {
  151. /*
  152. * Small descriptor -- bits 2:0 of byte 0 contain the length
  153. * Clear any existing length, preserving descriptor type bits
  154. */
  155. aml->small_header.descriptor_type = (u8)
  156. ((aml->small_header.descriptor_type &
  157. ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK)
  158. | resource_length);
  159. }
  160. }
  161. /*******************************************************************************
  162. *
  163. * FUNCTION: acpi_rs_set_resource_header
  164. *
  165. * PARAMETERS: descriptor_type - Byte to be inserted as the type
  166. * total_length - Length of the AML descriptor, including
  167. * the header and length fields.
  168. * aml - Pointer to the raw AML descriptor
  169. *
  170. * RETURN: None
  171. *
  172. * DESCRIPTION: Set the descriptor_type and resource_length fields of an AML
  173. * resource descriptor, both Large and Small descriptors are
  174. * supported automatically
  175. *
  176. ******************************************************************************/
  177. void
  178. acpi_rs_set_resource_header(u8 descriptor_type,
  179. acpi_rsdesc_size total_length,
  180. union aml_resource *aml)
  181. {
  182. ACPI_FUNCTION_ENTRY();
  183. /* Set the Resource Type */
  184. aml->small_header.descriptor_type = descriptor_type;
  185. /* Set the Resource Length */
  186. acpi_rs_set_resource_length(total_length, aml);
  187. }
  188. /*******************************************************************************
  189. *
  190. * FUNCTION: acpi_rs_strcpy
  191. *
  192. * PARAMETERS: destination - Pointer to the destination string
  193. * source - Pointer to the source string
  194. *
  195. * RETURN: String length, including NULL terminator
  196. *
  197. * DESCRIPTION: Local string copy that returns the string length, saving a
  198. * strcpy followed by a strlen.
  199. *
  200. ******************************************************************************/
  201. static u16 acpi_rs_strcpy(char *destination, char *source)
  202. {
  203. u16 i;
  204. ACPI_FUNCTION_ENTRY();
  205. for (i = 0; source[i]; i++) {
  206. destination[i] = source[i];
  207. }
  208. destination[i] = 0;
  209. /* Return string length including the NULL terminator */
  210. return ((u16) (i + 1));
  211. }
  212. /*******************************************************************************
  213. *
  214. * FUNCTION: acpi_rs_get_resource_source
  215. *
  216. * PARAMETERS: resource_length - Length field of the descriptor
  217. * minimum_length - Minimum length of the descriptor (minus
  218. * any optional fields)
  219. * resource_source - Where the resource_source is returned
  220. * aml - Pointer to the raw AML descriptor
  221. * string_ptr - (optional) where to store the actual
  222. * resource_source string
  223. *
  224. * RETURN: Length of the string plus NULL terminator, rounded up to native
  225. * word boundary
  226. *
  227. * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor
  228. * to an internal resource descriptor
  229. *
  230. ******************************************************************************/
  231. acpi_rs_length
  232. acpi_rs_get_resource_source(acpi_rs_length resource_length,
  233. acpi_rs_length minimum_length,
  234. struct acpi_resource_source * resource_source,
  235. union aml_resource * aml, char *string_ptr)
  236. {
  237. acpi_rsdesc_size total_length;
  238. u8 *aml_resource_source;
  239. ACPI_FUNCTION_ENTRY();
  240. total_length =
  241. resource_length + sizeof(struct aml_resource_large_header);
  242. aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length);
  243. /*
  244. * resource_source is present if the length of the descriptor is longer
  245. * than the minimum length.
  246. *
  247. * Note: Some resource descriptors will have an additional null, so
  248. * we add 1 to the minimum length.
  249. */
  250. if (total_length > (acpi_rsdesc_size)(minimum_length + 1)) {
  251. /* Get the resource_source_index */
  252. resource_source->index = aml_resource_source[0];
  253. resource_source->string_ptr = string_ptr;
  254. if (!string_ptr) {
  255. /*
  256. * String destination pointer is not specified; Set the String
  257. * pointer to the end of the current resource_source structure.
  258. */
  259. resource_source->string_ptr =
  260. ACPI_ADD_PTR(char, resource_source,
  261. sizeof(struct acpi_resource_source));
  262. }
  263. /*
  264. * In order for the Resource length to be a multiple of the native
  265. * word, calculate the length of the string (+1 for NULL terminator)
  266. * and expand to the next word multiple.
  267. *
  268. * Zero the entire area of the buffer.
  269. */
  270. total_length =
  271. (u32)strlen(ACPI_CAST_PTR(char, &aml_resource_source[1])) +
  272. 1;
  273. total_length = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
  274. memset(resource_source->string_ptr, 0, total_length);
  275. /* Copy the resource_source string to the destination */
  276. resource_source->string_length =
  277. acpi_rs_strcpy(resource_source->string_ptr,
  278. ACPI_CAST_PTR(char,
  279. &aml_resource_source[1]));
  280. return ((acpi_rs_length)total_length);
  281. }
  282. /* resource_source is not present */
  283. resource_source->index = 0;
  284. resource_source->string_length = 0;
  285. resource_source->string_ptr = NULL;
  286. return (0);
  287. }
  288. /*******************************************************************************
  289. *
  290. * FUNCTION: acpi_rs_set_resource_source
  291. *
  292. * PARAMETERS: aml - Pointer to the raw AML descriptor
  293. * minimum_length - Minimum length of the descriptor (minus
  294. * any optional fields)
  295. * resource_source - Internal resource_source
  296. *
  297. * RETURN: Total length of the AML descriptor
  298. *
  299. * DESCRIPTION: Convert an optional resource_source from internal format to a
  300. * raw AML resource descriptor
  301. *
  302. ******************************************************************************/
  303. acpi_rsdesc_size
  304. acpi_rs_set_resource_source(union aml_resource *aml,
  305. acpi_rs_length minimum_length,
  306. struct acpi_resource_source *resource_source)
  307. {
  308. u8 *aml_resource_source;
  309. acpi_rsdesc_size descriptor_length;
  310. ACPI_FUNCTION_ENTRY();
  311. descriptor_length = minimum_length;
  312. /* Non-zero string length indicates presence of a resource_source */
  313. if (resource_source->string_length) {
  314. /* Point to the end of the AML descriptor */
  315. aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length);
  316. /* Copy the resource_source_index */
  317. aml_resource_source[0] = (u8) resource_source->index;
  318. /* Copy the resource_source string */
  319. strcpy(ACPI_CAST_PTR(char, &aml_resource_source[1]),
  320. resource_source->string_ptr);
  321. /*
  322. * Add the length of the string (+ 1 for null terminator) to the
  323. * final descriptor length
  324. */
  325. descriptor_length += ((acpi_rsdesc_size)
  326. resource_source->string_length + 1);
  327. }
  328. /* Return the new total length of the AML descriptor */
  329. return (descriptor_length);
  330. }
  331. /*******************************************************************************
  332. *
  333. * FUNCTION: acpi_rs_get_prt_method_data
  334. *
  335. * PARAMETERS: node - Device node
  336. * ret_buffer - Pointer to a buffer structure for the
  337. * results
  338. *
  339. * RETURN: Status
  340. *
  341. * DESCRIPTION: This function is called to get the _PRT value of an object
  342. * contained in an object specified by the handle passed in
  343. *
  344. * If the function fails an appropriate status will be returned
  345. * and the contents of the callers buffer is undefined.
  346. *
  347. ******************************************************************************/
  348. acpi_status
  349. acpi_rs_get_prt_method_data(struct acpi_namespace_node *node,
  350. struct acpi_buffer *ret_buffer)
  351. {
  352. union acpi_operand_object *obj_desc;
  353. acpi_status status;
  354. ACPI_FUNCTION_TRACE(rs_get_prt_method_data);
  355. /* Parameters guaranteed valid by caller */
  356. /* Execute the method, no parameters */
  357. status =
  358. acpi_ut_evaluate_object(node, METHOD_NAME__PRT, ACPI_BTYPE_PACKAGE,
  359. &obj_desc);
  360. if (ACPI_FAILURE(status)) {
  361. return_ACPI_STATUS(status);
  362. }
  363. /*
  364. * Create a resource linked list from the byte stream buffer that comes
  365. * back from the _CRS method execution.
  366. */
  367. status = acpi_rs_create_pci_routing_table(obj_desc, ret_buffer);
  368. /* On exit, we must delete the object returned by evaluate_object */
  369. acpi_ut_remove_reference(obj_desc);
  370. return_ACPI_STATUS(status);
  371. }
  372. /*******************************************************************************
  373. *
  374. * FUNCTION: acpi_rs_get_crs_method_data
  375. *
  376. * PARAMETERS: node - Device node
  377. * ret_buffer - Pointer to a buffer structure for the
  378. * results
  379. *
  380. * RETURN: Status
  381. *
  382. * DESCRIPTION: This function is called to get the _CRS value of an object
  383. * contained in an object specified by the handle passed in
  384. *
  385. * If the function fails an appropriate status will be returned
  386. * and the contents of the callers buffer is undefined.
  387. *
  388. ******************************************************************************/
  389. acpi_status
  390. acpi_rs_get_crs_method_data(struct acpi_namespace_node *node,
  391. struct acpi_buffer *ret_buffer)
  392. {
  393. union acpi_operand_object *obj_desc;
  394. acpi_status status;
  395. ACPI_FUNCTION_TRACE(rs_get_crs_method_data);
  396. /* Parameters guaranteed valid by caller */
  397. /* Execute the method, no parameters */
  398. status =
  399. acpi_ut_evaluate_object(node, METHOD_NAME__CRS, ACPI_BTYPE_BUFFER,
  400. &obj_desc);
  401. if (ACPI_FAILURE(status)) {
  402. return_ACPI_STATUS(status);
  403. }
  404. /*
  405. * Make the call to create a resource linked list from the
  406. * byte stream buffer that comes back from the _CRS method
  407. * execution.
  408. */
  409. status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
  410. /* On exit, we must delete the object returned by evaluateObject */
  411. acpi_ut_remove_reference(obj_desc);
  412. return_ACPI_STATUS(status);
  413. }
  414. /*******************************************************************************
  415. *
  416. * FUNCTION: acpi_rs_get_prs_method_data
  417. *
  418. * PARAMETERS: node - Device node
  419. * ret_buffer - Pointer to a buffer structure for the
  420. * results
  421. *
  422. * RETURN: Status
  423. *
  424. * DESCRIPTION: This function is called to get the _PRS value of an object
  425. * contained in an object specified by the handle passed in
  426. *
  427. * If the function fails an appropriate status will be returned
  428. * and the contents of the callers buffer is undefined.
  429. *
  430. ******************************************************************************/
  431. acpi_status
  432. acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
  433. struct acpi_buffer *ret_buffer)
  434. {
  435. union acpi_operand_object *obj_desc;
  436. acpi_status status;
  437. ACPI_FUNCTION_TRACE(rs_get_prs_method_data);
  438. /* Parameters guaranteed valid by caller */
  439. /* Execute the method, no parameters */
  440. status =
  441. acpi_ut_evaluate_object(node, METHOD_NAME__PRS, ACPI_BTYPE_BUFFER,
  442. &obj_desc);
  443. if (ACPI_FAILURE(status)) {
  444. return_ACPI_STATUS(status);
  445. }
  446. /*
  447. * Make the call to create a resource linked list from the
  448. * byte stream buffer that comes back from the _CRS method
  449. * execution.
  450. */
  451. status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
  452. /* On exit, we must delete the object returned by evaluateObject */
  453. acpi_ut_remove_reference(obj_desc);
  454. return_ACPI_STATUS(status);
  455. }
  456. /*******************************************************************************
  457. *
  458. * FUNCTION: acpi_rs_get_aei_method_data
  459. *
  460. * PARAMETERS: node - Device node
  461. * ret_buffer - Pointer to a buffer structure for the
  462. * results
  463. *
  464. * RETURN: Status
  465. *
  466. * DESCRIPTION: This function is called to get the _AEI value of an object
  467. * contained in an object specified by the handle passed in
  468. *
  469. * If the function fails an appropriate status will be returned
  470. * and the contents of the callers buffer is undefined.
  471. *
  472. ******************************************************************************/
  473. acpi_status
  474. acpi_rs_get_aei_method_data(struct acpi_namespace_node *node,
  475. struct acpi_buffer *ret_buffer)
  476. {
  477. union acpi_operand_object *obj_desc;
  478. acpi_status status;
  479. ACPI_FUNCTION_TRACE(rs_get_aei_method_data);
  480. /* Parameters guaranteed valid by caller */
  481. /* Execute the method, no parameters */
  482. status =
  483. acpi_ut_evaluate_object(node, METHOD_NAME__AEI, ACPI_BTYPE_BUFFER,
  484. &obj_desc);
  485. if (ACPI_FAILURE(status)) {
  486. return_ACPI_STATUS(status);
  487. }
  488. /*
  489. * Make the call to create a resource linked list from the
  490. * byte stream buffer that comes back from the _CRS method
  491. * execution.
  492. */
  493. status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
  494. /* On exit, we must delete the object returned by evaluateObject */
  495. acpi_ut_remove_reference(obj_desc);
  496. return_ACPI_STATUS(status);
  497. }
  498. /*******************************************************************************
  499. *
  500. * FUNCTION: acpi_rs_get_method_data
  501. *
  502. * PARAMETERS: handle - Handle to the containing object
  503. * path - Path to method, relative to Handle
  504. * ret_buffer - Pointer to a buffer structure for the
  505. * results
  506. *
  507. * RETURN: Status
  508. *
  509. * DESCRIPTION: This function is called to get the _CRS or _PRS value of an
  510. * object contained in an object specified by the handle passed in
  511. *
  512. * If the function fails an appropriate status will be returned
  513. * and the contents of the callers buffer is undefined.
  514. *
  515. ******************************************************************************/
  516. acpi_status
  517. acpi_rs_get_method_data(acpi_handle handle,
  518. const char *path, struct acpi_buffer *ret_buffer)
  519. {
  520. union acpi_operand_object *obj_desc;
  521. acpi_status status;
  522. ACPI_FUNCTION_TRACE(rs_get_method_data);
  523. /* Parameters guaranteed valid by caller */
  524. /* Execute the method, no parameters */
  525. status =
  526. acpi_ut_evaluate_object(ACPI_CAST_PTR
  527. (struct acpi_namespace_node, handle), path,
  528. ACPI_BTYPE_BUFFER, &obj_desc);
  529. if (ACPI_FAILURE(status)) {
  530. return_ACPI_STATUS(status);
  531. }
  532. /*
  533. * Make the call to create a resource linked list from the
  534. * byte stream buffer that comes back from the method
  535. * execution.
  536. */
  537. status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
  538. /* On exit, we must delete the object returned by evaluate_object */
  539. acpi_ut_remove_reference(obj_desc);
  540. return_ACPI_STATUS(status);
  541. }
  542. /*******************************************************************************
  543. *
  544. * FUNCTION: acpi_rs_set_srs_method_data
  545. *
  546. * PARAMETERS: node - Device node
  547. * in_buffer - Pointer to a buffer structure of the
  548. * parameter
  549. *
  550. * RETURN: Status
  551. *
  552. * DESCRIPTION: This function is called to set the _SRS of an object contained
  553. * in an object specified by the handle passed in
  554. *
  555. * If the function fails an appropriate status will be returned
  556. * and the contents of the callers buffer is undefined.
  557. *
  558. * Note: Parameters guaranteed valid by caller
  559. *
  560. ******************************************************************************/
  561. acpi_status
  562. acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
  563. struct acpi_buffer *in_buffer)
  564. {
  565. struct acpi_evaluate_info *info;
  566. union acpi_operand_object *args[2];
  567. acpi_status status;
  568. struct acpi_buffer buffer;
  569. ACPI_FUNCTION_TRACE(rs_set_srs_method_data);
  570. /* Allocate and initialize the evaluation information block */
  571. info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
  572. if (!info) {
  573. return_ACPI_STATUS(AE_NO_MEMORY);
  574. }
  575. info->prefix_node = node;
  576. info->relative_pathname = METHOD_NAME__SRS;
  577. info->parameters = args;
  578. info->flags = ACPI_IGNORE_RETURN_VALUE;
  579. /*
  580. * The in_buffer parameter will point to a linked list of
  581. * resource parameters. It needs to be formatted into a
  582. * byte stream to be sent in as an input parameter to _SRS
  583. *
  584. * Convert the linked list into a byte stream
  585. */
  586. buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
  587. status = acpi_rs_create_aml_resources(in_buffer, &buffer);
  588. if (ACPI_FAILURE(status)) {
  589. goto cleanup;
  590. }
  591. /* Create and initialize the method parameter object */
  592. args[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
  593. if (!args[0]) {
  594. /*
  595. * Must free the buffer allocated above (otherwise it is freed
  596. * later)
  597. */
  598. ACPI_FREE(buffer.pointer);
  599. status = AE_NO_MEMORY;
  600. goto cleanup;
  601. }
  602. args[0]->buffer.length = (u32) buffer.length;
  603. args[0]->buffer.pointer = buffer.pointer;
  604. args[0]->common.flags = AOPOBJ_DATA_VALID;
  605. args[1] = NULL;
  606. /* Execute the method, no return value is expected */
  607. status = acpi_ns_evaluate(info);
  608. /* Clean up and return the status from acpi_ns_evaluate */
  609. acpi_ut_remove_reference(args[0]);
  610. cleanup:
  611. ACPI_FREE(info);
  612. return_ACPI_STATUS(status);
  613. }