uteval.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  1. /******************************************************************************
  2. *
  3. * Module Name: uteval - Object evaluation
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2006, R. Byron Moore
  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/acinterp.h>
  45. #define _COMPONENT ACPI_UTILITIES
  46. ACPI_MODULE_NAME("uteval")
  47. /* Local prototypes */
  48. static void
  49. acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length);
  50. static acpi_status
  51. acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
  52. struct acpi_compatible_id *one_cid);
  53. /*
  54. * Strings supported by the _OSI predefined (internal) method.
  55. */
  56. static const char *acpi_interfaces_supported[] = {
  57. /* Operating System Vendor Strings */
  58. "Linux",
  59. "Windows 2000",
  60. "Windows 2001",
  61. "Windows 2001 SP0",
  62. "Windows 2001 SP1",
  63. "Windows 2001 SP2",
  64. "Windows 2001 SP3",
  65. "Windows 2001 SP4",
  66. "Windows 2001.1",
  67. "Windows 2001.1 SP1", /* Added 03/2006 */
  68. "Windows 2006", /* Added 03/2006 */
  69. /* Feature Group Strings */
  70. "Extended Address Space Descriptor"
  71. /*
  72. * All "optional" feature group strings (features that are implemented
  73. * by the host) should be implemented in the host version of
  74. * acpi_os_validate_interface and should not be added here.
  75. */
  76. };
  77. /*******************************************************************************
  78. *
  79. * FUNCTION: acpi_ut_osi_implementation
  80. *
  81. * PARAMETERS: walk_state - Current walk state
  82. *
  83. * RETURN: Status
  84. *
  85. * DESCRIPTION: Implementation of the _OSI predefined control method
  86. *
  87. ******************************************************************************/
  88. acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
  89. {
  90. acpi_status status;
  91. union acpi_operand_object *string_desc;
  92. union acpi_operand_object *return_desc;
  93. acpi_native_uint i;
  94. ACPI_FUNCTION_TRACE(ut_osi_implementation);
  95. /* Validate the string input argument */
  96. string_desc = walk_state->arguments[0].object;
  97. if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) {
  98. return_ACPI_STATUS(AE_TYPE);
  99. }
  100. /* Create a return object */
  101. return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
  102. if (!return_desc) {
  103. return_ACPI_STATUS(AE_NO_MEMORY);
  104. }
  105. /* Default return value is SUPPORTED */
  106. return_desc->integer.value = ACPI_UINT32_MAX;
  107. walk_state->return_desc = return_desc;
  108. /* Compare input string to static table of supported interfaces */
  109. for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) {
  110. if (!ACPI_STRCMP
  111. (string_desc->string.pointer,
  112. acpi_interfaces_supported[i])) {
  113. /* The interface is supported */
  114. return_ACPI_STATUS(AE_CTRL_TERMINATE);
  115. }
  116. }
  117. /*
  118. * Did not match the string in the static table, call the host OSL to
  119. * check for a match with one of the optional strings (such as
  120. * "Module Device", "3.0 Thermal Model", etc.)
  121. */
  122. status = acpi_os_validate_interface(string_desc->string.pointer);
  123. if (ACPI_SUCCESS(status)) {
  124. /* The interface is supported */
  125. return_ACPI_STATUS(AE_CTRL_TERMINATE);
  126. }
  127. /* The interface is not supported */
  128. return_desc->integer.value = 0;
  129. return_ACPI_STATUS(AE_CTRL_TERMINATE);
  130. }
  131. /*******************************************************************************
  132. *
  133. * FUNCTION: acpi_ut_evaluate_object
  134. *
  135. * PARAMETERS: prefix_node - Starting node
  136. * Path - Path to object from starting node
  137. * expected_return_types - Bitmap of allowed return types
  138. * return_desc - Where a return value is stored
  139. *
  140. * RETURN: Status
  141. *
  142. * DESCRIPTION: Evaluates a namespace object and verifies the type of the
  143. * return object. Common code that simplifies accessing objects
  144. * that have required return objects of fixed types.
  145. *
  146. * NOTE: Internal function, no parameter validation
  147. *
  148. ******************************************************************************/
  149. acpi_status
  150. acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
  151. char *path,
  152. u32 expected_return_btypes,
  153. union acpi_operand_object **return_desc)
  154. {
  155. struct acpi_evaluate_info *info;
  156. acpi_status status;
  157. u32 return_btype;
  158. ACPI_FUNCTION_TRACE(ut_evaluate_object);
  159. /* Allocate the evaluation information block */
  160. info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
  161. if (!info) {
  162. return_ACPI_STATUS(AE_NO_MEMORY);
  163. }
  164. info->prefix_node = prefix_node;
  165. info->pathname = path;
  166. info->parameter_type = ACPI_PARAM_ARGS;
  167. /* Evaluate the object/method */
  168. status = acpi_ns_evaluate(info);
  169. if (ACPI_FAILURE(status)) {
  170. if (status == AE_NOT_FOUND) {
  171. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  172. "[%4.4s.%s] was not found\n",
  173. acpi_ut_get_node_name(prefix_node),
  174. path));
  175. } else {
  176. ACPI_ERROR_METHOD("Method execution failed",
  177. prefix_node, path, status);
  178. }
  179. goto cleanup;
  180. }
  181. /* Did we get a return object? */
  182. if (!info->return_object) {
  183. if (expected_return_btypes) {
  184. ACPI_ERROR_METHOD("No object was returned from",
  185. prefix_node, path, AE_NOT_EXIST);
  186. status = AE_NOT_EXIST;
  187. }
  188. goto cleanup;
  189. }
  190. /* Map the return object type to the bitmapped type */
  191. switch (ACPI_GET_OBJECT_TYPE(info->return_object)) {
  192. case ACPI_TYPE_INTEGER:
  193. return_btype = ACPI_BTYPE_INTEGER;
  194. break;
  195. case ACPI_TYPE_BUFFER:
  196. return_btype = ACPI_BTYPE_BUFFER;
  197. break;
  198. case ACPI_TYPE_STRING:
  199. return_btype = ACPI_BTYPE_STRING;
  200. break;
  201. case ACPI_TYPE_PACKAGE:
  202. return_btype = ACPI_BTYPE_PACKAGE;
  203. break;
  204. default:
  205. return_btype = 0;
  206. break;
  207. }
  208. if ((acpi_gbl_enable_interpreter_slack) && (!expected_return_btypes)) {
  209. /*
  210. * We received a return object, but one was not expected. This can
  211. * happen frequently if the "implicit return" feature is enabled.
  212. * Just delete the return object and return AE_OK.
  213. */
  214. acpi_ut_remove_reference(info->return_object);
  215. goto cleanup;
  216. }
  217. /* Is the return object one of the expected types? */
  218. if (!(expected_return_btypes & return_btype)) {
  219. ACPI_ERROR_METHOD("Return object type is incorrect",
  220. prefix_node, path, AE_TYPE);
  221. ACPI_ERROR((AE_INFO,
  222. "Type returned from %s was incorrect: %s, expected Btypes: %X",
  223. path,
  224. acpi_ut_get_object_type_name(info->return_object),
  225. expected_return_btypes));
  226. /* On error exit, we must delete the return object */
  227. acpi_ut_remove_reference(info->return_object);
  228. status = AE_TYPE;
  229. goto cleanup;
  230. }
  231. /* Object type is OK, return it */
  232. *return_desc = info->return_object;
  233. cleanup:
  234. ACPI_FREE(info);
  235. return_ACPI_STATUS(status);
  236. }
  237. /*******************************************************************************
  238. *
  239. * FUNCTION: acpi_ut_evaluate_numeric_object
  240. *
  241. * PARAMETERS: object_name - Object name to be evaluated
  242. * device_node - Node for the device
  243. * Address - Where the value is returned
  244. *
  245. * RETURN: Status
  246. *
  247. * DESCRIPTION: Evaluates a numeric namespace object for a selected device
  248. * and stores result in *Address.
  249. *
  250. * NOTE: Internal function, no parameter validation
  251. *
  252. ******************************************************************************/
  253. acpi_status
  254. acpi_ut_evaluate_numeric_object(char *object_name,
  255. struct acpi_namespace_node *device_node,
  256. acpi_integer * address)
  257. {
  258. union acpi_operand_object *obj_desc;
  259. acpi_status status;
  260. ACPI_FUNCTION_TRACE(ut_evaluate_numeric_object);
  261. status = acpi_ut_evaluate_object(device_node, object_name,
  262. ACPI_BTYPE_INTEGER, &obj_desc);
  263. if (ACPI_FAILURE(status)) {
  264. return_ACPI_STATUS(status);
  265. }
  266. /* Get the returned Integer */
  267. *address = obj_desc->integer.value;
  268. /* On exit, we must delete the return object */
  269. acpi_ut_remove_reference(obj_desc);
  270. return_ACPI_STATUS(status);
  271. }
  272. /*******************************************************************************
  273. *
  274. * FUNCTION: acpi_ut_copy_id_string
  275. *
  276. * PARAMETERS: Destination - Where to copy the string
  277. * Source - Source string
  278. * max_length - Length of the destination buffer
  279. *
  280. * RETURN: None
  281. *
  282. * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods.
  283. * Performs removal of a leading asterisk if present -- workaround
  284. * for a known issue on a bunch of machines.
  285. *
  286. ******************************************************************************/
  287. static void
  288. acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length)
  289. {
  290. /*
  291. * Workaround for ID strings that have a leading asterisk. This construct
  292. * is not allowed by the ACPI specification (ID strings must be
  293. * alphanumeric), but enough existing machines have this embedded in their
  294. * ID strings that the following code is useful.
  295. */
  296. if (*source == '*') {
  297. source++;
  298. }
  299. /* Do the actual copy */
  300. ACPI_STRNCPY(destination, source, max_length);
  301. }
  302. /*******************************************************************************
  303. *
  304. * FUNCTION: acpi_ut_execute_HID
  305. *
  306. * PARAMETERS: device_node - Node for the device
  307. * Hid - Where the HID is returned
  308. *
  309. * RETURN: Status
  310. *
  311. * DESCRIPTION: Executes the _HID control method that returns the hardware
  312. * ID of the device.
  313. *
  314. * NOTE: Internal function, no parameter validation
  315. *
  316. ******************************************************************************/
  317. acpi_status
  318. acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
  319. struct acpi_device_id *hid)
  320. {
  321. union acpi_operand_object *obj_desc;
  322. acpi_status status;
  323. ACPI_FUNCTION_TRACE(ut_execute_HID);
  324. status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID,
  325. ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
  326. &obj_desc);
  327. if (ACPI_FAILURE(status)) {
  328. return_ACPI_STATUS(status);
  329. }
  330. if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
  331. /* Convert the Numeric HID to string */
  332. acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
  333. hid->value);
  334. } else {
  335. /* Copy the String HID from the returned object */
  336. acpi_ut_copy_id_string(hid->value, obj_desc->string.pointer,
  337. sizeof(hid->value));
  338. }
  339. /* On exit, we must delete the return object */
  340. acpi_ut_remove_reference(obj_desc);
  341. return_ACPI_STATUS(status);
  342. }
  343. /*******************************************************************************
  344. *
  345. * FUNCTION: acpi_ut_translate_one_cid
  346. *
  347. * PARAMETERS: obj_desc - _CID object, must be integer or string
  348. * one_cid - Where the CID string is returned
  349. *
  350. * RETURN: Status
  351. *
  352. * DESCRIPTION: Return a numeric or string _CID value as a string.
  353. * (Compatible ID)
  354. *
  355. * NOTE: Assumes a maximum _CID string length of
  356. * ACPI_MAX_CID_LENGTH.
  357. *
  358. ******************************************************************************/
  359. static acpi_status
  360. acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
  361. struct acpi_compatible_id *one_cid)
  362. {
  363. switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
  364. case ACPI_TYPE_INTEGER:
  365. /* Convert the Numeric CID to string */
  366. acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
  367. one_cid->value);
  368. return (AE_OK);
  369. case ACPI_TYPE_STRING:
  370. if (obj_desc->string.length > ACPI_MAX_CID_LENGTH) {
  371. return (AE_AML_STRING_LIMIT);
  372. }
  373. /* Copy the String CID from the returned object */
  374. acpi_ut_copy_id_string(one_cid->value, obj_desc->string.pointer,
  375. ACPI_MAX_CID_LENGTH);
  376. return (AE_OK);
  377. default:
  378. return (AE_TYPE);
  379. }
  380. }
  381. /*******************************************************************************
  382. *
  383. * FUNCTION: acpi_ut_execute_CID
  384. *
  385. * PARAMETERS: device_node - Node for the device
  386. * return_cid_list - Where the CID list is returned
  387. *
  388. * RETURN: Status
  389. *
  390. * DESCRIPTION: Executes the _CID control method that returns one or more
  391. * compatible hardware IDs for the device.
  392. *
  393. * NOTE: Internal function, no parameter validation
  394. *
  395. ******************************************************************************/
  396. acpi_status
  397. acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
  398. struct acpi_compatible_id_list ** return_cid_list)
  399. {
  400. union acpi_operand_object *obj_desc;
  401. acpi_status status;
  402. u32 count;
  403. u32 size;
  404. struct acpi_compatible_id_list *cid_list;
  405. acpi_native_uint i;
  406. ACPI_FUNCTION_TRACE(ut_execute_CID);
  407. /* Evaluate the _CID method for this device */
  408. status = acpi_ut_evaluate_object(device_node, METHOD_NAME__CID,
  409. ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING
  410. | ACPI_BTYPE_PACKAGE, &obj_desc);
  411. if (ACPI_FAILURE(status)) {
  412. return_ACPI_STATUS(status);
  413. }
  414. /* Get the number of _CIDs returned */
  415. count = 1;
  416. if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
  417. count = obj_desc->package.count;
  418. }
  419. /* Allocate a worst-case buffer for the _CIDs */
  420. size = (((count - 1) * sizeof(struct acpi_compatible_id)) +
  421. sizeof(struct acpi_compatible_id_list));
  422. cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size);
  423. if (!cid_list) {
  424. return_ACPI_STATUS(AE_NO_MEMORY);
  425. }
  426. /* Init CID list */
  427. cid_list->count = count;
  428. cid_list->size = size;
  429. /*
  430. * A _CID can return either a single compatible ID or a package of
  431. * compatible IDs. Each compatible ID can be one of the following:
  432. * 1) Integer (32 bit compressed EISA ID) or
  433. * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss")
  434. */
  435. /* The _CID object can be either a single CID or a package (list) of CIDs */
  436. if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
  437. /* Translate each package element */
  438. for (i = 0; i < count; i++) {
  439. status =
  440. acpi_ut_translate_one_cid(obj_desc->package.
  441. elements[i],
  442. &cid_list->id[i]);
  443. if (ACPI_FAILURE(status)) {
  444. break;
  445. }
  446. }
  447. } else {
  448. /* Only one CID, translate to a string */
  449. status = acpi_ut_translate_one_cid(obj_desc, cid_list->id);
  450. }
  451. /* Cleanup on error */
  452. if (ACPI_FAILURE(status)) {
  453. ACPI_FREE(cid_list);
  454. } else {
  455. *return_cid_list = cid_list;
  456. }
  457. /* On exit, we must delete the _CID return object */
  458. acpi_ut_remove_reference(obj_desc);
  459. return_ACPI_STATUS(status);
  460. }
  461. /*******************************************************************************
  462. *
  463. * FUNCTION: acpi_ut_execute_UID
  464. *
  465. * PARAMETERS: device_node - Node for the device
  466. * Uid - Where the UID is returned
  467. *
  468. * RETURN: Status
  469. *
  470. * DESCRIPTION: Executes the _UID control method that returns the hardware
  471. * ID of the device.
  472. *
  473. * NOTE: Internal function, no parameter validation
  474. *
  475. ******************************************************************************/
  476. acpi_status
  477. acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
  478. struct acpi_device_id *uid)
  479. {
  480. union acpi_operand_object *obj_desc;
  481. acpi_status status;
  482. ACPI_FUNCTION_TRACE(ut_execute_UID);
  483. status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID,
  484. ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
  485. &obj_desc);
  486. if (ACPI_FAILURE(status)) {
  487. return_ACPI_STATUS(status);
  488. }
  489. if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
  490. /* Convert the Numeric UID to string */
  491. acpi_ex_unsigned_integer_to_string(obj_desc->integer.value,
  492. uid->value);
  493. } else {
  494. /* Copy the String UID from the returned object */
  495. acpi_ut_copy_id_string(uid->value, obj_desc->string.pointer,
  496. sizeof(uid->value));
  497. }
  498. /* On exit, we must delete the return object */
  499. acpi_ut_remove_reference(obj_desc);
  500. return_ACPI_STATUS(status);
  501. }
  502. /*******************************************************************************
  503. *
  504. * FUNCTION: acpi_ut_execute_STA
  505. *
  506. * PARAMETERS: device_node - Node for the device
  507. * Flags - Where the status flags are returned
  508. *
  509. * RETURN: Status
  510. *
  511. * DESCRIPTION: Executes _STA for selected device and stores results in
  512. * *Flags.
  513. *
  514. * NOTE: Internal function, no parameter validation
  515. *
  516. ******************************************************************************/
  517. acpi_status
  518. acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags)
  519. {
  520. union acpi_operand_object *obj_desc;
  521. acpi_status status;
  522. ACPI_FUNCTION_TRACE(ut_execute_STA);
  523. status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA,
  524. ACPI_BTYPE_INTEGER, &obj_desc);
  525. if (ACPI_FAILURE(status)) {
  526. if (AE_NOT_FOUND == status) {
  527. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  528. "_STA on %4.4s was not found, assuming device is present\n",
  529. acpi_ut_get_node_name(device_node)));
  530. *flags = ACPI_UINT32_MAX;
  531. status = AE_OK;
  532. }
  533. return_ACPI_STATUS(status);
  534. }
  535. /* Extract the status flags */
  536. *flags = (u32) obj_desc->integer.value;
  537. /* On exit, we must delete the return object */
  538. acpi_ut_remove_reference(obj_desc);
  539. return_ACPI_STATUS(status);
  540. }
  541. /*******************************************************************************
  542. *
  543. * FUNCTION: acpi_ut_execute_Sxds
  544. *
  545. * PARAMETERS: device_node - Node for the device
  546. * Flags - Where the status flags are returned
  547. *
  548. * RETURN: Status
  549. *
  550. * DESCRIPTION: Executes _STA for selected device and stores results in
  551. * *Flags.
  552. *
  553. * NOTE: Internal function, no parameter validation
  554. *
  555. ******************************************************************************/
  556. acpi_status
  557. acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest)
  558. {
  559. union acpi_operand_object *obj_desc;
  560. acpi_status status;
  561. u32 i;
  562. ACPI_FUNCTION_TRACE(ut_execute_sxds);
  563. for (i = 0; i < 4; i++) {
  564. highest[i] = 0xFF;
  565. status = acpi_ut_evaluate_object(device_node,
  566. ACPI_CAST_PTR(char,
  567. acpi_gbl_highest_dstate_names
  568. [i]),
  569. ACPI_BTYPE_INTEGER, &obj_desc);
  570. if (ACPI_FAILURE(status)) {
  571. if (status != AE_NOT_FOUND) {
  572. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  573. "%s on Device %4.4s, %s\n",
  574. ACPI_CAST_PTR(char,
  575. acpi_gbl_highest_dstate_names
  576. [i]),
  577. acpi_ut_get_node_name
  578. (device_node),
  579. acpi_format_exception
  580. (status)));
  581. return_ACPI_STATUS(status);
  582. }
  583. } else {
  584. /* Extract the Dstate value */
  585. highest[i] = (u8) obj_desc->integer.value;
  586. /* Delete the return object */
  587. acpi_ut_remove_reference(obj_desc);
  588. }
  589. }
  590. return_ACPI_STATUS(AE_OK);
  591. }