uteval.c 21 KB

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