uteval.c 21 KB

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