rsutils.c 22 KB

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