[ACPI] acpi_register_gsi() fix needed for ACPICA 20051021
[linux-2.6-block.git] / drivers / acpi / utilities / uteval.c
CommitLineData
1da177e4
LT
1/******************************************************************************
2 *
3 * Module Name: uteval - Object evaluation
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
1da177e4
LT
44#include <acpi/acpi.h>
45#include <acpi/acnamesp.h>
46#include <acpi/acinterp.h>
47
1da177e4 48#define _COMPONENT ACPI_UTILITIES
4be44fcd 49ACPI_MODULE_NAME("uteval")
1da177e4 50
44f6c012 51/* Local prototypes */
44f6c012 52static void
4be44fcd 53acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length);
44f6c012
RM
54
55static acpi_status
4be44fcd
LB
56acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
57 struct acpi_compatible_id *one_cid);
1da177e4
LT
58
59/*******************************************************************************
60 *
61 * FUNCTION: acpi_ut_osi_implementation
62 *
63 * PARAMETERS: walk_state - Current walk state
64 *
65 * RETURN: Status
66 *
67 * DESCRIPTION: Implementation of _OSI predefined control method
68 * Supported = _OSI (String)
69 *
70 ******************************************************************************/
71
4be44fcd 72acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
1da177e4 73{
4be44fcd
LB
74 union acpi_operand_object *string_desc;
75 union acpi_operand_object *return_desc;
76 acpi_native_uint i;
1da177e4 77
4be44fcd 78 ACPI_FUNCTION_TRACE("ut_osi_implementation");
1da177e4
LT
79
80 /* Validate the string input argument */
81
82 string_desc = walk_state->arguments[0].object;
83 if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) {
4be44fcd 84 return_ACPI_STATUS(AE_TYPE);
1da177e4
LT
85 }
86
87 /* Create a return object (Default value = 0) */
88
4be44fcd 89 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
1da177e4 90 if (!return_desc) {
4be44fcd 91 return_ACPI_STATUS(AE_NO_MEMORY);
1da177e4
LT
92 }
93
94 /* Compare input string to table of supported strings */
95
96 for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) {
4be44fcd
LB
97 if (!ACPI_STRCMP(string_desc->string.pointer,
98 (char *)acpi_gbl_valid_osi_strings[i])) {
1da177e4
LT
99 /* This string is supported */
100
101 return_desc->integer.value = 0xFFFFFFFF;
102 break;
103 }
104 }
105
106 walk_state->return_desc = return_desc;
4be44fcd 107 return_ACPI_STATUS(AE_CTRL_TERMINATE);
1da177e4
LT
108}
109
1da177e4
LT
110/*******************************************************************************
111 *
112 * FUNCTION: acpi_ut_evaluate_object
113 *
114 * PARAMETERS: prefix_node - Starting node
115 * Path - Path to object from starting node
116 * expected_return_types - Bitmap of allowed return types
117 * return_desc - Where a return value is stored
118 *
119 * RETURN: Status
120 *
121 * DESCRIPTION: Evaluates a namespace object and verifies the type of the
122 * return object. Common code that simplifies accessing objects
123 * that have required return objects of fixed types.
124 *
125 * NOTE: Internal function, no parameter validation
126 *
127 ******************************************************************************/
128
129acpi_status
4be44fcd
LB
130acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
131 char *path,
132 u32 expected_return_btypes,
133 union acpi_operand_object **return_desc)
1da177e4 134{
4be44fcd
LB
135 struct acpi_parameter_info info;
136 acpi_status status;
137 u32 return_btype;
1da177e4 138
4be44fcd 139 ACPI_FUNCTION_TRACE("ut_evaluate_object");
1da177e4
LT
140
141 info.node = prefix_node;
142 info.parameters = NULL;
143 info.parameter_type = ACPI_PARAM_ARGS;
144
145 /* Evaluate the object/method */
146
4be44fcd
LB
147 status = acpi_ns_evaluate_relative(path, &info);
148 if (ACPI_FAILURE(status)) {
1da177e4 149 if (status == AE_NOT_FOUND) {
4be44fcd
LB
150 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
151 "[%4.4s.%s] was not found\n",
152 acpi_ut_get_node_name(prefix_node),
153 path));
154 } else {
155 ACPI_REPORT_METHOD_ERROR("Method execution failed",
156 prefix_node, path, status);
1da177e4
LT
157 }
158
4be44fcd 159 return_ACPI_STATUS(status);
1da177e4
LT
160 }
161
162 /* Did we get a return object? */
163
164 if (!info.return_object) {
165 if (expected_return_btypes) {
4be44fcd
LB
166 ACPI_REPORT_METHOD_ERROR("No object was returned from",
167 prefix_node, path,
168 AE_NOT_EXIST);
1da177e4 169
4be44fcd 170 return_ACPI_STATUS(AE_NOT_EXIST);
1da177e4
LT
171 }
172
4be44fcd 173 return_ACPI_STATUS(AE_OK);
1da177e4
LT
174 }
175
176 /* Map the return object type to the bitmapped type */
177
4be44fcd 178 switch (ACPI_GET_OBJECT_TYPE(info.return_object)) {
1da177e4
LT
179 case ACPI_TYPE_INTEGER:
180 return_btype = ACPI_BTYPE_INTEGER;
181 break;
182
183 case ACPI_TYPE_BUFFER:
184 return_btype = ACPI_BTYPE_BUFFER;
185 break;
186
187 case ACPI_TYPE_STRING:
188 return_btype = ACPI_BTYPE_STRING;
189 break;
190
191 case ACPI_TYPE_PACKAGE:
192 return_btype = ACPI_BTYPE_PACKAGE;
193 break;
194
195 default:
196 return_btype = 0;
197 break;
198 }
199
4be44fcd 200 if ((acpi_gbl_enable_interpreter_slack) && (!expected_return_btypes)) {
1da177e4
LT
201 /*
202 * We received a return object, but one was not expected. This can
203 * happen frequently if the "implicit return" feature is enabled.
204 * Just delete the return object and return AE_OK.
205 */
4be44fcd
LB
206 acpi_ut_remove_reference(info.return_object);
207 return_ACPI_STATUS(AE_OK);
1da177e4
LT
208 }
209
210 /* Is the return object one of the expected types? */
211
212 if (!(expected_return_btypes & return_btype)) {
4be44fcd
LB
213 ACPI_REPORT_METHOD_ERROR("Return object type is incorrect",
214 prefix_node, path, AE_TYPE);
1da177e4 215
4be44fcd
LB
216 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
217 "Type returned from %s was incorrect: %s, expected Btypes: %X\n",
218 path,
219 acpi_ut_get_object_type_name(info.
220 return_object),
221 expected_return_btypes));
1da177e4
LT
222
223 /* On error exit, we must delete the return object */
224
4be44fcd
LB
225 acpi_ut_remove_reference(info.return_object);
226 return_ACPI_STATUS(AE_TYPE);
1da177e4
LT
227 }
228
229 /* Object type is OK, return it */
230
231 *return_desc = info.return_object;
4be44fcd 232 return_ACPI_STATUS(AE_OK);
1da177e4
LT
233}
234
1da177e4
LT
235/*******************************************************************************
236 *
237 * FUNCTION: acpi_ut_evaluate_numeric_object
238 *
44f6c012 239 * PARAMETERS: object_name - Object name to be evaluated
1da177e4 240 * device_node - Node for the device
44f6c012 241 * Address - Where the value is returned
1da177e4
LT
242 *
243 * RETURN: Status
244 *
245 * DESCRIPTION: Evaluates a numeric namespace object for a selected device
246 * and stores result in *Address.
247 *
248 * NOTE: Internal function, no parameter validation
249 *
250 ******************************************************************************/
251
252acpi_status
4be44fcd
LB
253acpi_ut_evaluate_numeric_object(char *object_name,
254 struct acpi_namespace_node *device_node,
255 acpi_integer * address)
1da177e4 256{
4be44fcd
LB
257 union acpi_operand_object *obj_desc;
258 acpi_status status;
1da177e4 259
4be44fcd 260 ACPI_FUNCTION_TRACE("ut_evaluate_numeric_object");
1da177e4 261
4be44fcd
LB
262 status = acpi_ut_evaluate_object(device_node, object_name,
263 ACPI_BTYPE_INTEGER, &obj_desc);
264 if (ACPI_FAILURE(status)) {
265 return_ACPI_STATUS(status);
1da177e4
LT
266 }
267
268 /* Get the returned Integer */
269
270 *address = obj_desc->integer.value;
271
272 /* On exit, we must delete the return object */
273
4be44fcd
LB
274 acpi_ut_remove_reference(obj_desc);
275 return_ACPI_STATUS(status);
1da177e4
LT
276}
277
1da177e4
LT
278/*******************************************************************************
279 *
280 * FUNCTION: acpi_ut_copy_id_string
281 *
282 * PARAMETERS: Destination - Where to copy the string
283 * Source - Source string
284 * max_length - Length of the destination buffer
285 *
286 * RETURN: None
287 *
288 * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods.
289 * Performs removal of a leading asterisk if present -- workaround
290 * for a known issue on a bunch of machines.
291 *
292 ******************************************************************************/
293
294static void
4be44fcd 295acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length)
1da177e4
LT
296{
297
1da177e4
LT
298 /*
299 * Workaround for ID strings that have a leading asterisk. This construct
300 * is not allowed by the ACPI specification (ID strings must be
301 * alphanumeric), but enough existing machines have this embedded in their
302 * ID strings that the following code is useful.
303 */
304 if (*source == '*') {
305 source++;
306 }
307
308 /* Do the actual copy */
309
4be44fcd 310 ACPI_STRNCPY(destination, source, max_length);
1da177e4
LT
311}
312
1da177e4
LT
313/*******************************************************************************
314 *
315 * FUNCTION: acpi_ut_execute_HID
316 *
317 * PARAMETERS: device_node - Node for the device
44f6c012 318 * Hid - Where the HID is returned
1da177e4
LT
319 *
320 * RETURN: Status
321 *
322 * DESCRIPTION: Executes the _HID control method that returns the hardware
323 * ID of the device.
324 *
325 * NOTE: Internal function, no parameter validation
326 *
327 ******************************************************************************/
328
329acpi_status
4be44fcd
LB
330acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
331 struct acpi_device_id *hid)
1da177e4 332{
4be44fcd
LB
333 union acpi_operand_object *obj_desc;
334 acpi_status status;
1da177e4 335
4be44fcd 336 ACPI_FUNCTION_TRACE("ut_execute_HID");
1da177e4 337
4be44fcd
LB
338 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID,
339 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
340 &obj_desc);
341 if (ACPI_FAILURE(status)) {
342 return_ACPI_STATUS(status);
1da177e4
LT
343 }
344
4be44fcd 345 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
1da177e4
LT
346 /* Convert the Numeric HID to string */
347
4be44fcd
LB
348 acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
349 hid->value);
350 } else {
1da177e4
LT
351 /* Copy the String HID from the returned object */
352
4be44fcd
LB
353 acpi_ut_copy_id_string(hid->value, obj_desc->string.pointer,
354 sizeof(hid->value));
1da177e4
LT
355 }
356
357 /* On exit, we must delete the return object */
358
4be44fcd
LB
359 acpi_ut_remove_reference(obj_desc);
360 return_ACPI_STATUS(status);
1da177e4
LT
361}
362
1da177e4
LT
363/*******************************************************************************
364 *
365 * FUNCTION: acpi_ut_translate_one_cid
366 *
367 * PARAMETERS: obj_desc - _CID object, must be integer or string
368 * one_cid - Where the CID string is returned
369 *
370 * RETURN: Status
371 *
372 * DESCRIPTION: Return a numeric or string _CID value as a string.
373 * (Compatible ID)
374 *
375 * NOTE: Assumes a maximum _CID string length of
376 * ACPI_MAX_CID_LENGTH.
377 *
378 ******************************************************************************/
379
380static acpi_status
4be44fcd
LB
381acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
382 struct acpi_compatible_id *one_cid)
1da177e4
LT
383{
384
4be44fcd 385 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
1da177e4
LT
386 case ACPI_TYPE_INTEGER:
387
388 /* Convert the Numeric CID to string */
389
4be44fcd
LB
390 acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
391 one_cid->value);
1da177e4
LT
392 return (AE_OK);
393
394 case ACPI_TYPE_STRING:
395
396 if (obj_desc->string.length > ACPI_MAX_CID_LENGTH) {
397 return (AE_AML_STRING_LIMIT);
398 }
399
400 /* Copy the String CID from the returned object */
401
4be44fcd
LB
402 acpi_ut_copy_id_string(one_cid->value, obj_desc->string.pointer,
403 ACPI_MAX_CID_LENGTH);
1da177e4
LT
404 return (AE_OK);
405
406 default:
407
408 return (AE_TYPE);
409 }
410}
411
1da177e4
LT
412/*******************************************************************************
413 *
414 * FUNCTION: acpi_ut_execute_CID
415 *
416 * PARAMETERS: device_node - Node for the device
44f6c012 417 * return_cid_list - Where the CID list is returned
1da177e4
LT
418 *
419 * RETURN: Status
420 *
421 * DESCRIPTION: Executes the _CID control method that returns one or more
422 * compatible hardware IDs for the device.
423 *
424 * NOTE: Internal function, no parameter validation
425 *
426 ******************************************************************************/
427
428acpi_status
4be44fcd
LB
429acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
430 struct acpi_compatible_id_list ** return_cid_list)
1da177e4 431{
4be44fcd
LB
432 union acpi_operand_object *obj_desc;
433 acpi_status status;
434 u32 count;
435 u32 size;
1da177e4 436 struct acpi_compatible_id_list *cid_list;
4be44fcd 437 acpi_native_uint i;
1da177e4 438
4be44fcd 439 ACPI_FUNCTION_TRACE("ut_execute_CID");
1da177e4
LT
440
441 /* Evaluate the _CID method for this device */
442
4be44fcd
LB
443 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__CID,
444 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING
445 | ACPI_BTYPE_PACKAGE, &obj_desc);
446 if (ACPI_FAILURE(status)) {
447 return_ACPI_STATUS(status);
1da177e4
LT
448 }
449
450 /* Get the number of _CIDs returned */
451
452 count = 1;
4be44fcd 453 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
1da177e4
LT
454 count = obj_desc->package.count;
455 }
456
457 /* Allocate a worst-case buffer for the _CIDs */
458
4be44fcd
LB
459 size = (((count - 1) * sizeof(struct acpi_compatible_id)) +
460 sizeof(struct acpi_compatible_id_list));
1da177e4 461
4be44fcd 462 cid_list = ACPI_MEM_CALLOCATE((acpi_size) size);
1da177e4 463 if (!cid_list) {
4be44fcd 464 return_ACPI_STATUS(AE_NO_MEMORY);
1da177e4
LT
465 }
466
467 /* Init CID list */
468
469 cid_list->count = count;
470 cid_list->size = size;
471
472 /*
44f6c012
RM
473 * A _CID can return either a single compatible ID or a package of
474 * compatible IDs. Each compatible ID can be one of the following:
475 * 1) Integer (32 bit compressed EISA ID) or
476 * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss")
1da177e4
LT
477 */
478
479 /* The _CID object can be either a single CID or a package (list) of CIDs */
480
4be44fcd 481 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
1da177e4
LT
482 /* Translate each package element */
483
484 for (i = 0; i < count; i++) {
4be44fcd
LB
485 status =
486 acpi_ut_translate_one_cid(obj_desc->package.
487 elements[i],
488 &cid_list->id[i]);
489 if (ACPI_FAILURE(status)) {
1da177e4
LT
490 break;
491 }
492 }
4be44fcd 493 } else {
1da177e4
LT
494 /* Only one CID, translate to a string */
495
4be44fcd 496 status = acpi_ut_translate_one_cid(obj_desc, cid_list->id);
1da177e4
LT
497 }
498
499 /* Cleanup on error */
500
4be44fcd
LB
501 if (ACPI_FAILURE(status)) {
502 ACPI_MEM_FREE(cid_list);
503 } else {
1da177e4
LT
504 *return_cid_list = cid_list;
505 }
506
507 /* On exit, we must delete the _CID return object */
508
4be44fcd
LB
509 acpi_ut_remove_reference(obj_desc);
510 return_ACPI_STATUS(status);
1da177e4
LT
511}
512
1da177e4
LT
513/*******************************************************************************
514 *
515 * FUNCTION: acpi_ut_execute_UID
516 *
517 * PARAMETERS: device_node - Node for the device
44f6c012 518 * Uid - Where the UID is returned
1da177e4
LT
519 *
520 * RETURN: Status
521 *
522 * DESCRIPTION: Executes the _UID control method that returns the hardware
523 * ID of the device.
524 *
525 * NOTE: Internal function, no parameter validation
526 *
527 ******************************************************************************/
528
529acpi_status
4be44fcd
LB
530acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
531 struct acpi_device_id *uid)
1da177e4 532{
4be44fcd
LB
533 union acpi_operand_object *obj_desc;
534 acpi_status status;
1da177e4 535
4be44fcd 536 ACPI_FUNCTION_TRACE("ut_execute_UID");
1da177e4 537
4be44fcd
LB
538 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID,
539 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
540 &obj_desc);
541 if (ACPI_FAILURE(status)) {
542 return_ACPI_STATUS(status);
1da177e4
LT
543 }
544
4be44fcd 545 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
1da177e4
LT
546 /* Convert the Numeric UID to string */
547
4be44fcd
LB
548 acpi_ex_unsigned_integer_to_string(obj_desc->integer.value,
549 uid->value);
550 } else {
1da177e4
LT
551 /* Copy the String UID from the returned object */
552
4be44fcd
LB
553 acpi_ut_copy_id_string(uid->value, obj_desc->string.pointer,
554 sizeof(uid->value));
1da177e4
LT
555 }
556
557 /* On exit, we must delete the return object */
558
4be44fcd
LB
559 acpi_ut_remove_reference(obj_desc);
560 return_ACPI_STATUS(status);
1da177e4
LT
561}
562
1da177e4
LT
563/*******************************************************************************
564 *
565 * FUNCTION: acpi_ut_execute_STA
566 *
567 * PARAMETERS: device_node - Node for the device
44f6c012 568 * Flags - Where the status flags are returned
1da177e4
LT
569 *
570 * RETURN: Status
571 *
572 * DESCRIPTION: Executes _STA for selected device and stores results in
573 * *Flags.
574 *
575 * NOTE: Internal function, no parameter validation
576 *
577 ******************************************************************************/
578
579acpi_status
4be44fcd 580acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags)
1da177e4 581{
4be44fcd
LB
582 union acpi_operand_object *obj_desc;
583 acpi_status status;
1da177e4 584
4be44fcd 585 ACPI_FUNCTION_TRACE("ut_execute_STA");
1da177e4 586
4be44fcd
LB
587 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA,
588 ACPI_BTYPE_INTEGER, &obj_desc);
589 if (ACPI_FAILURE(status)) {
1da177e4 590 if (AE_NOT_FOUND == status) {
4be44fcd
LB
591 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
592 "_STA on %4.4s was not found, assuming device is present\n",
593 acpi_ut_get_node_name(device_node)));
1da177e4
LT
594
595 *flags = 0x0F;
596 status = AE_OK;
597 }
598
4be44fcd 599 return_ACPI_STATUS(status);
1da177e4
LT
600 }
601
602 /* Extract the status flags */
603
604 *flags = (u32) obj_desc->integer.value;
605
606 /* On exit, we must delete the return object */
607
4be44fcd
LB
608 acpi_ut_remove_reference(obj_desc);
609 return_ACPI_STATUS(status);
1da177e4
LT
610}
611
1da177e4
LT
612/*******************************************************************************
613 *
614 * FUNCTION: acpi_ut_execute_Sxds
615 *
616 * PARAMETERS: device_node - Node for the device
44f6c012 617 * Flags - Where the status flags are returned
1da177e4
LT
618 *
619 * RETURN: Status
620 *
621 * DESCRIPTION: Executes _STA for selected device and stores results in
622 * *Flags.
623 *
624 * NOTE: Internal function, no parameter validation
625 *
626 ******************************************************************************/
627
628acpi_status
4be44fcd 629acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest)
1da177e4 630{
4be44fcd
LB
631 union acpi_operand_object *obj_desc;
632 acpi_status status;
633 u32 i;
1da177e4 634
4be44fcd 635 ACPI_FUNCTION_TRACE("ut_execute_Sxds");
1da177e4
LT
636
637 for (i = 0; i < 4; i++) {
638 highest[i] = 0xFF;
4be44fcd
LB
639 status = acpi_ut_evaluate_object(device_node,
640 (char *)
641 acpi_gbl_highest_dstate_names
642 [i], ACPI_BTYPE_INTEGER,
643 &obj_desc);
644 if (ACPI_FAILURE(status)) {
1da177e4 645 if (status != AE_NOT_FOUND) {
4be44fcd
LB
646 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
647 "%s on Device %4.4s, %s\n",
648 (char *)
649 acpi_gbl_highest_dstate_names
650 [i],
651 acpi_ut_get_node_name
652 (device_node),
653 acpi_format_exception
654 (status)));
655
656 return_ACPI_STATUS(status);
1da177e4 657 }
4be44fcd 658 } else {
1da177e4
LT
659 /* Extract the Dstate value */
660
661 highest[i] = (u8) obj_desc->integer.value;
662
663 /* Delete the return object */
664
4be44fcd 665 acpi_ut_remove_reference(obj_desc);
1da177e4
LT
666 }
667 }
668
4be44fcd 669 return_ACPI_STATUS(AE_OK);
1da177e4 670}