rsxface.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. /*******************************************************************************
  2. *
  3. * Module Name: rsxface - Public interfaces to the resource manager
  4. *
  5. ******************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2015, 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. #define EXPORT_ACPI_INTERFACES
  43. #include <acpi/acpi.h>
  44. #include "accommon.h"
  45. #include "acresrc.h"
  46. #include "acnamesp.h"
  47. #define _COMPONENT ACPI_RESOURCES
  48. ACPI_MODULE_NAME("rsxface")
  49. /* Local macros for 16,32-bit to 64-bit conversion */
  50. #define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field)
  51. #define ACPI_COPY_ADDRESS(out, in) \
  52. ACPI_COPY_FIELD(out, in, resource_type); \
  53. ACPI_COPY_FIELD(out, in, producer_consumer); \
  54. ACPI_COPY_FIELD(out, in, decode); \
  55. ACPI_COPY_FIELD(out, in, min_address_fixed); \
  56. ACPI_COPY_FIELD(out, in, max_address_fixed); \
  57. ACPI_COPY_FIELD(out, in, info); \
  58. ACPI_COPY_FIELD(out, in, address.granularity); \
  59. ACPI_COPY_FIELD(out, in, address.minimum); \
  60. ACPI_COPY_FIELD(out, in, address.maximum); \
  61. ACPI_COPY_FIELD(out, in, address.translation_offset); \
  62. ACPI_COPY_FIELD(out, in, address.address_length); \
  63. ACPI_COPY_FIELD(out, in, resource_source);
  64. /* Local prototypes */
  65. static acpi_status
  66. acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context);
  67. static acpi_status
  68. acpi_rs_validate_parameters(acpi_handle device_handle,
  69. struct acpi_buffer *buffer,
  70. struct acpi_namespace_node **return_node);
  71. /*******************************************************************************
  72. *
  73. * FUNCTION: acpi_rs_validate_parameters
  74. *
  75. * PARAMETERS: device_handle - Handle to a device
  76. * buffer - Pointer to a data buffer
  77. * return_node - Pointer to where the device node is returned
  78. *
  79. * RETURN: Status
  80. *
  81. * DESCRIPTION: Common parameter validation for resource interfaces
  82. *
  83. ******************************************************************************/
  84. static acpi_status
  85. acpi_rs_validate_parameters(acpi_handle device_handle,
  86. struct acpi_buffer *buffer,
  87. struct acpi_namespace_node **return_node)
  88. {
  89. acpi_status status;
  90. struct acpi_namespace_node *node;
  91. ACPI_FUNCTION_TRACE(rs_validate_parameters);
  92. /*
  93. * Must have a valid handle to an ACPI device
  94. */
  95. if (!device_handle) {
  96. return_ACPI_STATUS(AE_BAD_PARAMETER);
  97. }
  98. node = acpi_ns_validate_handle(device_handle);
  99. if (!node) {
  100. return_ACPI_STATUS(AE_BAD_PARAMETER);
  101. }
  102. if (node->type != ACPI_TYPE_DEVICE) {
  103. return_ACPI_STATUS(AE_TYPE);
  104. }
  105. /*
  106. * Validate the user buffer object
  107. *
  108. * if there is a non-zero buffer length we also need a valid pointer in
  109. * the buffer. If it's a zero buffer length, we'll be returning the
  110. * needed buffer size (later), so keep going.
  111. */
  112. status = acpi_ut_validate_buffer(buffer);
  113. if (ACPI_FAILURE(status)) {
  114. return_ACPI_STATUS(status);
  115. }
  116. *return_node = node;
  117. return_ACPI_STATUS(AE_OK);
  118. }
  119. /*******************************************************************************
  120. *
  121. * FUNCTION: acpi_get_irq_routing_table
  122. *
  123. * PARAMETERS: device_handle - Handle to the Bus device we are querying
  124. * ret_buffer - Pointer to a buffer to receive the
  125. * current resources for the device
  126. *
  127. * RETURN: Status
  128. *
  129. * DESCRIPTION: This function is called to get the IRQ routing table for a
  130. * specific bus. The caller must first acquire a handle for the
  131. * desired bus. The routine table is placed in the buffer pointed
  132. * to by the ret_buffer variable parameter.
  133. *
  134. * If the function fails an appropriate status will be returned
  135. * and the value of ret_buffer is undefined.
  136. *
  137. * This function attempts to execute the _PRT method contained in
  138. * the object indicated by the passed device_handle.
  139. *
  140. ******************************************************************************/
  141. acpi_status
  142. acpi_get_irq_routing_table(acpi_handle device_handle,
  143. struct acpi_buffer *ret_buffer)
  144. {
  145. acpi_status status;
  146. struct acpi_namespace_node *node;
  147. ACPI_FUNCTION_TRACE(acpi_get_irq_routing_table);
  148. /* Validate parameters then dispatch to internal routine */
  149. status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node);
  150. if (ACPI_FAILURE(status)) {
  151. return_ACPI_STATUS(status);
  152. }
  153. status = acpi_rs_get_prt_method_data(node, ret_buffer);
  154. return_ACPI_STATUS(status);
  155. }
  156. ACPI_EXPORT_SYMBOL(acpi_get_irq_routing_table)
  157. /*******************************************************************************
  158. *
  159. * FUNCTION: acpi_get_current_resources
  160. *
  161. * PARAMETERS: device_handle - Handle to the device object for the
  162. * device we are querying
  163. * ret_buffer - Pointer to a buffer to receive the
  164. * current resources for the device
  165. *
  166. * RETURN: Status
  167. *
  168. * DESCRIPTION: This function is called to get the current resources for a
  169. * specific device. The caller must first acquire a handle for
  170. * the desired device. The resource data is placed in the buffer
  171. * pointed to by the ret_buffer variable parameter.
  172. *
  173. * If the function fails an appropriate status will be returned
  174. * and the value of ret_buffer is undefined.
  175. *
  176. * This function attempts to execute the _CRS method contained in
  177. * the object indicated by the passed device_handle.
  178. *
  179. ******************************************************************************/
  180. acpi_status
  181. acpi_get_current_resources(acpi_handle device_handle,
  182. struct acpi_buffer *ret_buffer)
  183. {
  184. acpi_status status;
  185. struct acpi_namespace_node *node;
  186. ACPI_FUNCTION_TRACE(acpi_get_current_resources);
  187. /* Validate parameters then dispatch to internal routine */
  188. status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node);
  189. if (ACPI_FAILURE(status)) {
  190. return_ACPI_STATUS(status);
  191. }
  192. status = acpi_rs_get_crs_method_data(node, ret_buffer);
  193. return_ACPI_STATUS(status);
  194. }
  195. ACPI_EXPORT_SYMBOL(acpi_get_current_resources)
  196. /*******************************************************************************
  197. *
  198. * FUNCTION: acpi_get_possible_resources
  199. *
  200. * PARAMETERS: device_handle - Handle to the device object for the
  201. * device we are querying
  202. * ret_buffer - Pointer to a buffer to receive the
  203. * resources for the device
  204. *
  205. * RETURN: Status
  206. *
  207. * DESCRIPTION: This function is called to get a list of the possible resources
  208. * for a specific device. The caller must first acquire a handle
  209. * for the desired device. The resource data is placed in the
  210. * buffer pointed to by the ret_buffer variable.
  211. *
  212. * If the function fails an appropriate status will be returned
  213. * and the value of ret_buffer is undefined.
  214. *
  215. ******************************************************************************/
  216. acpi_status
  217. acpi_get_possible_resources(acpi_handle device_handle,
  218. struct acpi_buffer *ret_buffer)
  219. {
  220. acpi_status status;
  221. struct acpi_namespace_node *node;
  222. ACPI_FUNCTION_TRACE(acpi_get_possible_resources);
  223. /* Validate parameters then dispatch to internal routine */
  224. status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node);
  225. if (ACPI_FAILURE(status)) {
  226. return_ACPI_STATUS(status);
  227. }
  228. status = acpi_rs_get_prs_method_data(node, ret_buffer);
  229. return_ACPI_STATUS(status);
  230. }
  231. ACPI_EXPORT_SYMBOL(acpi_get_possible_resources)
  232. /*******************************************************************************
  233. *
  234. * FUNCTION: acpi_set_current_resources
  235. *
  236. * PARAMETERS: device_handle - Handle to the device object for the
  237. * device we are setting resources
  238. * in_buffer - Pointer to a buffer containing the
  239. * resources to be set for the device
  240. *
  241. * RETURN: Status
  242. *
  243. * DESCRIPTION: This function is called to set the current resources for a
  244. * specific device. The caller must first acquire a handle for
  245. * the desired device. The resource data is passed to the routine
  246. * the buffer pointed to by the in_buffer variable.
  247. *
  248. ******************************************************************************/
  249. acpi_status
  250. acpi_set_current_resources(acpi_handle device_handle,
  251. struct acpi_buffer *in_buffer)
  252. {
  253. acpi_status status;
  254. struct acpi_namespace_node *node;
  255. ACPI_FUNCTION_TRACE(acpi_set_current_resources);
  256. /* Validate the buffer, don't allow zero length */
  257. if ((!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) {
  258. return_ACPI_STATUS(AE_BAD_PARAMETER);
  259. }
  260. /* Validate parameters then dispatch to internal routine */
  261. status = acpi_rs_validate_parameters(device_handle, in_buffer, &node);
  262. if (ACPI_FAILURE(status)) {
  263. return_ACPI_STATUS(status);
  264. }
  265. status = acpi_rs_set_srs_method_data(node, in_buffer);
  266. return_ACPI_STATUS(status);
  267. }
  268. ACPI_EXPORT_SYMBOL(acpi_set_current_resources)
  269. /*******************************************************************************
  270. *
  271. * FUNCTION: acpi_get_event_resources
  272. *
  273. * PARAMETERS: device_handle - Handle to the device object for the
  274. * device we are getting resources
  275. * in_buffer - Pointer to a buffer containing the
  276. * resources to be set for the device
  277. *
  278. * RETURN: Status
  279. *
  280. * DESCRIPTION: This function is called to get the event resources for a
  281. * specific device. The caller must first acquire a handle for
  282. * the desired device. The resource data is passed to the routine
  283. * the buffer pointed to by the in_buffer variable. Uses the
  284. * _AEI method.
  285. *
  286. ******************************************************************************/
  287. acpi_status
  288. acpi_get_event_resources(acpi_handle device_handle,
  289. struct acpi_buffer *ret_buffer)
  290. {
  291. acpi_status status;
  292. struct acpi_namespace_node *node;
  293. ACPI_FUNCTION_TRACE(acpi_get_event_resources);
  294. /* Validate parameters then dispatch to internal routine */
  295. status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node);
  296. if (ACPI_FAILURE(status)) {
  297. return_ACPI_STATUS(status);
  298. }
  299. status = acpi_rs_get_aei_method_data(node, ret_buffer);
  300. return_ACPI_STATUS(status);
  301. }
  302. ACPI_EXPORT_SYMBOL(acpi_get_event_resources)
  303. /******************************************************************************
  304. *
  305. * FUNCTION: acpi_resource_to_address64
  306. *
  307. * PARAMETERS: resource - Pointer to a resource
  308. * out - Pointer to the users's return buffer
  309. * (a struct acpi_resource_address64)
  310. *
  311. * RETURN: Status
  312. *
  313. * DESCRIPTION: If the resource is an address16, address32, or address64,
  314. * copy it to the address64 return buffer. This saves the
  315. * caller from having to duplicate code for different-sized
  316. * addresses.
  317. *
  318. ******************************************************************************/
  319. acpi_status
  320. acpi_resource_to_address64(struct acpi_resource *resource,
  321. struct acpi_resource_address64 *out)
  322. {
  323. struct acpi_resource_address16 *address16;
  324. struct acpi_resource_address32 *address32;
  325. if (!resource || !out) {
  326. return (AE_BAD_PARAMETER);
  327. }
  328. /* Convert 16 or 32 address descriptor to 64 */
  329. switch (resource->type) {
  330. case ACPI_RESOURCE_TYPE_ADDRESS16:
  331. address16 =
  332. ACPI_CAST_PTR(struct acpi_resource_address16,
  333. &resource->data);
  334. ACPI_COPY_ADDRESS(out, address16);
  335. break;
  336. case ACPI_RESOURCE_TYPE_ADDRESS32:
  337. address32 =
  338. ACPI_CAST_PTR(struct acpi_resource_address32,
  339. &resource->data);
  340. ACPI_COPY_ADDRESS(out, address32);
  341. break;
  342. case ACPI_RESOURCE_TYPE_ADDRESS64:
  343. /* Simple copy for 64 bit source */
  344. memcpy(out, &resource->data,
  345. sizeof(struct acpi_resource_address64));
  346. break;
  347. default:
  348. return (AE_BAD_PARAMETER);
  349. }
  350. return (AE_OK);
  351. }
  352. ACPI_EXPORT_SYMBOL(acpi_resource_to_address64)
  353. /*******************************************************************************
  354. *
  355. * FUNCTION: acpi_get_vendor_resource
  356. *
  357. * PARAMETERS: device_handle - Handle for the parent device object
  358. * name - Method name for the parent resource
  359. * (METHOD_NAME__CRS or METHOD_NAME__PRS)
  360. * uuid - Pointer to the UUID to be matched.
  361. * includes both subtype and 16-byte UUID
  362. * ret_buffer - Where the vendor resource is returned
  363. *
  364. * RETURN: Status
  365. *
  366. * DESCRIPTION: Walk a resource template for the specified device to find a
  367. * vendor-defined resource that matches the supplied UUID and
  368. * UUID subtype. Returns a struct acpi_resource of type Vendor.
  369. *
  370. ******************************************************************************/
  371. acpi_status
  372. acpi_get_vendor_resource(acpi_handle device_handle,
  373. char *name,
  374. struct acpi_vendor_uuid * uuid,
  375. struct acpi_buffer * ret_buffer)
  376. {
  377. struct acpi_vendor_walk_info info;
  378. acpi_status status;
  379. /* Other parameters are validated by acpi_walk_resources */
  380. if (!uuid || !ret_buffer) {
  381. return (AE_BAD_PARAMETER);
  382. }
  383. info.uuid = uuid;
  384. info.buffer = ret_buffer;
  385. info.status = AE_NOT_EXIST;
  386. /* Walk the _CRS or _PRS resource list for this device */
  387. status =
  388. acpi_walk_resources(device_handle, name,
  389. acpi_rs_match_vendor_resource, &info);
  390. if (ACPI_FAILURE(status)) {
  391. return (status);
  392. }
  393. return (info.status);
  394. }
  395. ACPI_EXPORT_SYMBOL(acpi_get_vendor_resource)
  396. /*******************************************************************************
  397. *
  398. * FUNCTION: acpi_rs_match_vendor_resource
  399. *
  400. * PARAMETERS: acpi_walk_resource_callback
  401. *
  402. * RETURN: Status
  403. *
  404. * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID
  405. *
  406. ******************************************************************************/
  407. static acpi_status
  408. acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
  409. {
  410. struct acpi_vendor_walk_info *info = context;
  411. struct acpi_resource_vendor_typed *vendor;
  412. struct acpi_buffer *buffer;
  413. acpi_status status;
  414. /* Ignore all descriptors except Vendor */
  415. if (resource->type != ACPI_RESOURCE_TYPE_VENDOR) {
  416. return (AE_OK);
  417. }
  418. vendor = &resource->data.vendor_typed;
  419. /*
  420. * For a valid match, these conditions must hold:
  421. *
  422. * 1) Length of descriptor data must be at least as long as a UUID struct
  423. * 2) The UUID subtypes must match
  424. * 3) The UUID data must match
  425. */
  426. if ((vendor->byte_length < (ACPI_UUID_LENGTH + 1)) ||
  427. (vendor->uuid_subtype != info->uuid->subtype) ||
  428. (memcmp(vendor->uuid, info->uuid->data, ACPI_UUID_LENGTH))) {
  429. return (AE_OK);
  430. }
  431. /* Validate/Allocate/Clear caller buffer */
  432. buffer = info->buffer;
  433. status = acpi_ut_initialize_buffer(buffer, resource->length);
  434. if (ACPI_FAILURE(status)) {
  435. return (status);
  436. }
  437. /* Found the correct resource, copy and return it */
  438. memcpy(buffer->pointer, resource, resource->length);
  439. buffer->length = resource->length;
  440. /* Found the desired descriptor, terminate resource walk */
  441. info->status = AE_OK;
  442. return (AE_CTRL_TERMINATE);
  443. }
  444. /*******************************************************************************
  445. *
  446. * FUNCTION: acpi_walk_resource_buffer
  447. *
  448. * PARAMETERS: buffer - Formatted buffer returned by one of the
  449. * various Get*Resource functions
  450. * user_function - Called for each resource
  451. * context - Passed to user_function
  452. *
  453. * RETURN: Status
  454. *
  455. * DESCRIPTION: Walks the input resource template. The user_function is called
  456. * once for each resource in the list.
  457. *
  458. ******************************************************************************/
  459. acpi_status
  460. acpi_walk_resource_buffer(struct acpi_buffer * buffer,
  461. acpi_walk_resource_callback user_function,
  462. void *context)
  463. {
  464. acpi_status status = AE_OK;
  465. struct acpi_resource *resource;
  466. struct acpi_resource *resource_end;
  467. ACPI_FUNCTION_TRACE(acpi_walk_resource_buffer);
  468. /* Parameter validation */
  469. if (!buffer || !buffer->pointer || !user_function) {
  470. return_ACPI_STATUS(AE_BAD_PARAMETER);
  471. }
  472. /* Buffer contains the resource list and length */
  473. resource = ACPI_CAST_PTR(struct acpi_resource, buffer->pointer);
  474. resource_end =
  475. ACPI_ADD_PTR(struct acpi_resource, buffer->pointer, buffer->length);
  476. /* Walk the resource list until the end_tag is found (or buffer end) */
  477. while (resource < resource_end) {
  478. /* Sanity check the resource type */
  479. if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
  480. status = AE_AML_INVALID_RESOURCE_TYPE;
  481. break;
  482. }
  483. /* Sanity check the length. It must not be zero, or we loop forever */
  484. if (!resource->length) {
  485. return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
  486. }
  487. /* Invoke the user function, abort on any error returned */
  488. status = user_function(resource, context);
  489. if (ACPI_FAILURE(status)) {
  490. if (status == AE_CTRL_TERMINATE) {
  491. /* This is an OK termination by the user function */
  492. status = AE_OK;
  493. }
  494. break;
  495. }
  496. /* end_tag indicates end-of-list */
  497. if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) {
  498. break;
  499. }
  500. /* Get the next resource descriptor */
  501. resource = ACPI_NEXT_RESOURCE(resource);
  502. }
  503. return_ACPI_STATUS(status);
  504. }
  505. ACPI_EXPORT_SYMBOL(acpi_walk_resource_buffer)
  506. /*******************************************************************************
  507. *
  508. * FUNCTION: acpi_walk_resources
  509. *
  510. * PARAMETERS: device_handle - Handle to the device object for the
  511. * device we are querying
  512. * name - Method name of the resources we want.
  513. * (METHOD_NAME__CRS, METHOD_NAME__PRS, or
  514. * METHOD_NAME__AEI)
  515. * user_function - Called for each resource
  516. * context - Passed to user_function
  517. *
  518. * RETURN: Status
  519. *
  520. * DESCRIPTION: Retrieves the current or possible resource list for the
  521. * specified device. The user_function is called once for
  522. * each resource in the list.
  523. *
  524. ******************************************************************************/
  525. acpi_status
  526. acpi_walk_resources(acpi_handle device_handle,
  527. char *name,
  528. acpi_walk_resource_callback user_function, void *context)
  529. {
  530. acpi_status status;
  531. struct acpi_buffer buffer;
  532. ACPI_FUNCTION_TRACE(acpi_walk_resources);
  533. /* Parameter validation */
  534. if (!device_handle || !user_function || !name ||
  535. (!ACPI_COMPARE_NAME(name, METHOD_NAME__CRS) &&
  536. !ACPI_COMPARE_NAME(name, METHOD_NAME__PRS) &&
  537. !ACPI_COMPARE_NAME(name, METHOD_NAME__AEI))) {
  538. return_ACPI_STATUS(AE_BAD_PARAMETER);
  539. }
  540. /* Get the _CRS/_PRS/_AEI resource list */
  541. buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
  542. status = acpi_rs_get_method_data(device_handle, name, &buffer);
  543. if (ACPI_FAILURE(status)) {
  544. return_ACPI_STATUS(status);
  545. }
  546. /* Walk the resource list and cleanup */
  547. status = acpi_walk_resource_buffer(&buffer, user_function, context);
  548. ACPI_FREE(buffer.pointer);
  549. return_ACPI_STATUS(status);
  550. }
  551. ACPI_EXPORT_SYMBOL(acpi_walk_resources)