uteval.c revision 129684
1/******************************************************************************
2 *
3 * Module Name: uteval - Object evaluation
4 *              $Revision: 54 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights.  You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.
21 *
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
28 *
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code.  No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
37 *
38 * The above copyright and patent license is granted only if the following
39 * conditions are met:
40 *
41 * 3. Conditions
42 *
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision.  In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change.  Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee.  Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
54 *
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution.  In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
65 * make.
66 *
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3.4. Intel retains all right, title, and interest in and to the Original
74 * Intel Code.
75 *
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
80 *
81 * 4. Disclaimer and Export Compliance
82 *
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
90 *
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
99 *
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government.  In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117#define __UTEVAL_C__
118
119#include "acpi.h"
120#include "acnamesp.h"
121#include "acinterp.h"
122
123
124#define _COMPONENT          ACPI_UTILITIES
125        ACPI_MODULE_NAME    ("uteval")
126
127
128/*******************************************************************************
129 *
130 * FUNCTION:    AcpiUtOsiImplementation
131 *
132 * PARAMETERS:  WalkState           - Current walk state
133 *
134 * RETURN:      Status
135 *
136 * DESCRIPTION: Implementation of _OSI predefined control method
137 *              Supported = _OSI (String)
138 *
139 ******************************************************************************/
140
141ACPI_STATUS
142AcpiUtOsiImplementation (
143    ACPI_WALK_STATE         *WalkState)
144{
145    ACPI_OPERAND_OBJECT     *StringDesc;
146    ACPI_OPERAND_OBJECT     *ReturnDesc;
147    ACPI_NATIVE_UINT        i;
148
149
150    ACPI_FUNCTION_TRACE ("UtOsiImplementation");
151
152
153    /* Validate the string input argument */
154
155    StringDesc = WalkState->Arguments[0].Object;
156    if (!StringDesc || (StringDesc->Common.Type != ACPI_TYPE_STRING))
157    {
158        return_ACPI_STATUS (AE_TYPE);
159    }
160
161    /* Create a return object (Default value = 0) */
162
163    ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
164    if (!ReturnDesc)
165    {
166        return_ACPI_STATUS (AE_NO_MEMORY);
167    }
168
169    /* Compare input string to table of supported strings */
170
171    for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++)
172    {
173        if (!ACPI_STRCMP (StringDesc->String.Pointer,
174                            (char *) AcpiGbl_ValidOsiStrings[i]))
175        {
176            /* This string is supported */
177
178            ReturnDesc->Integer.Value = 0xFFFFFFFF;
179            break;
180        }
181    }
182
183    WalkState->ReturnDesc = ReturnDesc;
184    return_ACPI_STATUS (AE_CTRL_TERMINATE);
185}
186
187
188/*******************************************************************************
189 *
190 * FUNCTION:    AcpiUtEvaluateObject
191 *
192 * PARAMETERS:  PrefixNode          - Starting node
193 *              Path                - Path to object from starting node
194 *              ExpectedReturnTypes - Bitmap of allowed return types
195 *              ReturnDesc          - Where a return value is stored
196 *
197 * RETURN:      Status
198 *
199 * DESCRIPTION: Evaluates a namespace object and verifies the type of the
200 *              return object.  Common code that simplifies accessing objects
201 *              that have required return objects of fixed types.
202 *
203 *              NOTE: Internal function, no parameter validation
204 *
205 ******************************************************************************/
206
207ACPI_STATUS
208AcpiUtEvaluateObject (
209    ACPI_NAMESPACE_NODE     *PrefixNode,
210    char                    *Path,
211    UINT32                  ExpectedReturnBtypes,
212    ACPI_OPERAND_OBJECT     **ReturnDesc)
213{
214    ACPI_PARAMETER_INFO     Info;
215    ACPI_STATUS             Status;
216    UINT32                  ReturnBtype;
217
218
219    ACPI_FUNCTION_TRACE ("UtEvaluateObject");
220
221
222    Info.Node = PrefixNode;
223    Info.Parameters = NULL;
224    Info.ParameterType = ACPI_PARAM_ARGS;
225
226    /* Evaluate the object/method */
227
228    Status = AcpiNsEvaluateRelative (Path, &Info);
229    if (ACPI_FAILURE (Status))
230    {
231        if (Status == AE_NOT_FOUND)
232        {
233            ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s.%s] was not found\n",
234                AcpiUtGetNodeName (PrefixNode), Path));
235        }
236        else
237        {
238            ACPI_REPORT_METHOD_ERROR ("Method execution failed",
239                PrefixNode, Path, Status);
240        }
241
242        return_ACPI_STATUS (Status);
243    }
244
245    /* Did we get a return object? */
246
247    if (!Info.ReturnObject)
248    {
249        if (ExpectedReturnBtypes)
250        {
251            ACPI_REPORT_METHOD_ERROR ("No object was returned from",
252                PrefixNode, Path, AE_NOT_EXIST);
253
254            return_ACPI_STATUS (AE_NOT_EXIST);
255        }
256
257        return_ACPI_STATUS (AE_OK);
258    }
259
260    /* Map the return object type to the bitmapped type */
261
262    switch (ACPI_GET_OBJECT_TYPE (Info.ReturnObject))
263    {
264    case ACPI_TYPE_INTEGER:
265        ReturnBtype = ACPI_BTYPE_INTEGER;
266        break;
267
268    case ACPI_TYPE_BUFFER:
269        ReturnBtype = ACPI_BTYPE_BUFFER;
270        break;
271
272    case ACPI_TYPE_STRING:
273        ReturnBtype = ACPI_BTYPE_STRING;
274        break;
275
276    case ACPI_TYPE_PACKAGE:
277        ReturnBtype = ACPI_BTYPE_PACKAGE;
278        break;
279
280    default:
281        ReturnBtype = 0;
282        break;
283    }
284
285    /* Is the return object one of the expected types? */
286
287    if (!(ExpectedReturnBtypes & ReturnBtype))
288    {
289        ACPI_REPORT_METHOD_ERROR ("Return object type is incorrect",
290            PrefixNode, Path, AE_TYPE);
291
292        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
293            "Type returned from %s was incorrect: %X\n",
294            Path, ACPI_GET_OBJECT_TYPE (Info.ReturnObject)));
295
296        /* On error exit, we must delete the return object */
297
298        AcpiUtRemoveReference (Info.ReturnObject);
299        return_ACPI_STATUS (AE_TYPE);
300    }
301
302    /* Object type is OK, return it */
303
304    *ReturnDesc = Info.ReturnObject;
305    return_ACPI_STATUS (AE_OK);
306}
307
308
309/*******************************************************************************
310 *
311 * FUNCTION:    AcpiUtEvaluateNumericObject
312 *
313 * PARAMETERS:  *ObjectName         - Object name to be evaluated
314 *              DeviceNode          - Node for the device
315 *              *Address            - Where the value is returned
316 *
317 * RETURN:      Status
318 *
319 * DESCRIPTION: Evaluates a numeric namespace object for a selected device
320 *              and stores result in *Address.
321 *
322 *              NOTE: Internal function, no parameter validation
323 *
324 ******************************************************************************/
325
326ACPI_STATUS
327AcpiUtEvaluateNumericObject (
328    char                    *ObjectName,
329    ACPI_NAMESPACE_NODE     *DeviceNode,
330    ACPI_INTEGER            *Address)
331{
332    ACPI_OPERAND_OBJECT     *ObjDesc;
333    ACPI_STATUS             Status;
334
335
336    ACPI_FUNCTION_TRACE ("UtEvaluateNumericObject");
337
338
339    Status = AcpiUtEvaluateObject (DeviceNode, ObjectName,
340                ACPI_BTYPE_INTEGER, &ObjDesc);
341    if (ACPI_FAILURE (Status))
342    {
343        return_ACPI_STATUS (Status);
344    }
345
346    /* Get the returned Integer */
347
348    *Address = ObjDesc->Integer.Value;
349
350    /* On exit, we must delete the return object */
351
352    AcpiUtRemoveReference (ObjDesc);
353    return_ACPI_STATUS (Status);
354}
355
356
357/*******************************************************************************
358 *
359 * FUNCTION:    AcpiUtCopyIdString
360 *
361 * PARAMETERS:  Destination         - Where to copy the string
362 *              Source              - Source string
363 *              MaxLength           - Length of the destination buffer
364 *
365 * RETURN:      None
366 *
367 * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods.
368 *              Performs removal of a leading asterisk if present -- workaround
369 *              for a known issue on a bunch of machines.
370 *
371 ******************************************************************************/
372
373static void
374AcpiUtCopyIdString (
375    char                    *Destination,
376    char                    *Source,
377    ACPI_SIZE               MaxLength)
378{
379
380
381    /*
382     * Workaround for ID strings that have a leading asterisk. This construct
383     * is not allowed by the ACPI specification  (ID strings must be
384     * alphanumeric), but enough existing machines have this embedded in their
385     * ID strings that the following code is useful.
386     */
387    if (*Source == '*')
388    {
389        Source++;
390    }
391
392    /* Do the actual copy */
393
394    ACPI_STRNCPY (Destination, Source, MaxLength);
395}
396
397
398/*******************************************************************************
399 *
400 * FUNCTION:    AcpiUtExecute_HID
401 *
402 * PARAMETERS:  DeviceNode          - Node for the device
403 *              *Hid                - Where the HID is returned
404 *
405 * RETURN:      Status
406 *
407 * DESCRIPTION: Executes the _HID control method that returns the hardware
408 *              ID of the device.
409 *
410 *              NOTE: Internal function, no parameter validation
411 *
412 ******************************************************************************/
413
414ACPI_STATUS
415AcpiUtExecute_HID (
416    ACPI_NAMESPACE_NODE     *DeviceNode,
417    ACPI_DEVICE_ID          *Hid)
418{
419    ACPI_OPERAND_OBJECT     *ObjDesc;
420    ACPI_STATUS             Status;
421
422
423    ACPI_FUNCTION_TRACE ("UtExecute_HID");
424
425
426    Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__HID,
427                ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc);
428    if (ACPI_FAILURE (Status))
429    {
430        return_ACPI_STATUS (Status);
431    }
432
433    if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
434    {
435        /* Convert the Numeric HID to string */
436
437        AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Value);
438    }
439    else
440    {
441        /* Copy the String HID from the returned object */
442
443        AcpiUtCopyIdString (Hid->Value, ObjDesc->String.Pointer,
444                sizeof (Hid->Value));
445    }
446
447    /* On exit, we must delete the return object */
448
449    AcpiUtRemoveReference (ObjDesc);
450    return_ACPI_STATUS (Status);
451}
452
453
454/*******************************************************************************
455 *
456 * FUNCTION:    AcpiUtTranslateOneCid
457 *
458 * PARAMETERS:  ObjDesc             - _CID object, must be integer or string
459 *              OneCid              - Where the CID string is returned
460 *
461 * RETURN:      Status
462 *
463 * DESCRIPTION: Return a numeric or string _CID value as a string.
464 *              (Compatible ID)
465 *
466 *              NOTE:  Assumes a maximum _CID string length of
467 *                     ACPI_MAX_CID_LENGTH.
468 *
469 ******************************************************************************/
470
471static ACPI_STATUS
472AcpiUtTranslateOneCid (
473    ACPI_OPERAND_OBJECT     *ObjDesc,
474    ACPI_COMPATIBLE_ID      *OneCid)
475{
476
477
478    switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
479    {
480    case ACPI_TYPE_INTEGER:
481
482        /* Convert the Numeric CID to string */
483
484        AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, OneCid->Value);
485        return (AE_OK);
486
487    case ACPI_TYPE_STRING:
488
489        if (ObjDesc->String.Length > ACPI_MAX_CID_LENGTH)
490        {
491            return (AE_AML_STRING_LIMIT);
492        }
493
494        /* Copy the String CID from the returned object */
495
496        AcpiUtCopyIdString (OneCid->Value, ObjDesc->String.Pointer,
497                ACPI_MAX_CID_LENGTH);
498        return (AE_OK);
499
500    default:
501
502        return (AE_TYPE);
503    }
504}
505
506
507/*******************************************************************************
508 *
509 * FUNCTION:    AcpiUtExecute_CID
510 *
511 * PARAMETERS:  DeviceNode          - Node for the device
512 *              *Cid                - Where the CID is returned
513 *
514 * RETURN:      Status
515 *
516 * DESCRIPTION: Executes the _CID control method that returns one or more
517 *              compatible hardware IDs for the device.
518 *
519 *              NOTE: Internal function, no parameter validation
520 *
521 ******************************************************************************/
522
523ACPI_STATUS
524AcpiUtExecute_CID (
525    ACPI_NAMESPACE_NODE     *DeviceNode,
526    ACPI_COMPATIBLE_ID_LIST **ReturnCidList)
527{
528    ACPI_OPERAND_OBJECT     *ObjDesc;
529    ACPI_STATUS             Status;
530    UINT32                  Count;
531    UINT32                  Size;
532    ACPI_COMPATIBLE_ID_LIST *CidList;
533    ACPI_NATIVE_UINT        i;
534
535
536    ACPI_FUNCTION_TRACE ("UtExecute_CID");
537
538
539    /* Evaluate the _CID method for this device */
540
541    Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CID,
542                ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE,
543                &ObjDesc);
544    if (ACPI_FAILURE (Status))
545    {
546        return_ACPI_STATUS (Status);
547    }
548
549    /* Get the number of _CIDs returned */
550
551    Count = 1;
552    if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE)
553    {
554        Count = ObjDesc->Package.Count;
555    }
556
557    /* Allocate a worst-case buffer for the _CIDs */
558
559    Size = (((Count - 1) * sizeof (ACPI_COMPATIBLE_ID)) +
560                           sizeof (ACPI_COMPATIBLE_ID_LIST));
561
562    CidList = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Size);
563    if (!CidList)
564    {
565        return_ACPI_STATUS (AE_NO_MEMORY);
566    }
567
568    /* Init CID list */
569
570    CidList->Count = Count;
571    CidList->Size  = Size;
572
573    /*
574     *  A _CID can return either a single compatible ID or a package of compatible
575     *  IDs.  Each compatible ID can be one of the following:
576     *  -- Number (32 bit compressed EISA ID) or
577     *  -- String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss").
578     */
579
580    /* The _CID object can be either a single CID or a package (list) of CIDs */
581
582    if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE)
583    {
584        /* Translate each package element */
585
586        for (i = 0; i < Count; i++)
587        {
588            Status = AcpiUtTranslateOneCid (ObjDesc->Package.Elements[i],
589                            &CidList->Id[i]);
590            if (ACPI_FAILURE (Status))
591            {
592                break;
593            }
594        }
595    }
596    else
597    {
598        /* Only one CID, translate to a string */
599
600        Status = AcpiUtTranslateOneCid (ObjDesc, CidList->Id);
601    }
602
603    /* Cleanup on error */
604
605    if (ACPI_FAILURE (Status))
606    {
607        ACPI_MEM_FREE (CidList);
608    }
609    else
610    {
611        *ReturnCidList = CidList;
612    }
613
614    /* On exit, we must delete the _CID return object */
615
616    AcpiUtRemoveReference (ObjDesc);
617    return_ACPI_STATUS (Status);
618}
619
620
621/*******************************************************************************
622 *
623 * FUNCTION:    AcpiUtExecute_UID
624 *
625 * PARAMETERS:  DeviceNode          - Node for the device
626 *              *Uid                - Where the UID is returned
627 *
628 * RETURN:      Status
629 *
630 * DESCRIPTION: Executes the _UID control method that returns the hardware
631 *              ID of the device.
632 *
633 *              NOTE: Internal function, no parameter validation
634 *
635 ******************************************************************************/
636
637ACPI_STATUS
638AcpiUtExecute_UID (
639    ACPI_NAMESPACE_NODE     *DeviceNode,
640    ACPI_DEVICE_ID          *Uid)
641{
642    ACPI_OPERAND_OBJECT     *ObjDesc;
643    ACPI_STATUS             Status;
644
645
646    ACPI_FUNCTION_TRACE ("UtExecute_UID");
647
648
649    Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__UID,
650                ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc);
651    if (ACPI_FAILURE (Status))
652    {
653        return_ACPI_STATUS (Status);
654    }
655
656    if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
657    {
658        /* Convert the Numeric UID to string */
659
660        AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Value);
661    }
662    else
663    {
664        /* Copy the String UID from the returned object */
665
666        AcpiUtCopyIdString (Uid->Value, ObjDesc->String.Pointer,
667                sizeof (Uid->Value));
668    }
669
670    /* On exit, we must delete the return object */
671
672    AcpiUtRemoveReference (ObjDesc);
673    return_ACPI_STATUS (Status);
674}
675
676
677/*******************************************************************************
678 *
679 * FUNCTION:    AcpiUtExecute_STA
680 *
681 * PARAMETERS:  DeviceNode          - Node for the device
682 *              *Flags              - Where the status flags are returned
683 *
684 * RETURN:      Status
685 *
686 * DESCRIPTION: Executes _STA for selected device and stores results in
687 *              *Flags.
688 *
689 *              NOTE: Internal function, no parameter validation
690 *
691 ******************************************************************************/
692
693ACPI_STATUS
694AcpiUtExecute_STA (
695    ACPI_NAMESPACE_NODE     *DeviceNode,
696    UINT32                  *Flags)
697{
698    ACPI_OPERAND_OBJECT     *ObjDesc;
699    ACPI_STATUS             Status;
700
701
702    ACPI_FUNCTION_TRACE ("UtExecute_STA");
703
704
705    Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__STA,
706                ACPI_BTYPE_INTEGER, &ObjDesc);
707    if (ACPI_FAILURE (Status))
708    {
709        if (AE_NOT_FOUND == Status)
710        {
711            ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
712                "_STA on %4.4s was not found, assuming device is present\n",
713                AcpiUtGetNodeName (DeviceNode)));
714
715            *Flags = 0x0F;
716            Status = AE_OK;
717        }
718
719        return_ACPI_STATUS (Status);
720    }
721
722    /* Extract the status flags */
723
724    *Flags = (UINT32) ObjDesc->Integer.Value;
725
726    /* On exit, we must delete the return object */
727
728    AcpiUtRemoveReference (ObjDesc);
729    return_ACPI_STATUS (Status);
730}
731
732
733/*******************************************************************************
734 *
735 * FUNCTION:    AcpiUtExecute_Sxds
736 *
737 * PARAMETERS:  DeviceNode          - Node for the device
738 *              *Flags              - Where the status flags are returned
739 *
740 * RETURN:      Status
741 *
742 * DESCRIPTION: Executes _STA for selected device and stores results in
743 *              *Flags.
744 *
745 *              NOTE: Internal function, no parameter validation
746 *
747 ******************************************************************************/
748
749ACPI_STATUS
750AcpiUtExecute_Sxds (
751    ACPI_NAMESPACE_NODE     *DeviceNode,
752    UINT8                   *Highest)
753{
754    ACPI_OPERAND_OBJECT     *ObjDesc;
755    ACPI_STATUS             Status;
756    UINT32                  i;
757
758
759    ACPI_FUNCTION_TRACE ("UtExecute_Sxds");
760
761
762    for (i = 0; i < 4; i++)
763    {
764        Highest[i] = 0xFF;
765        Status = AcpiUtEvaluateObject (DeviceNode,
766                    (char *) AcpiGbl_HighestDstateNames[i],
767                    ACPI_BTYPE_INTEGER, &ObjDesc);
768        if (ACPI_FAILURE (Status))
769        {
770            if (Status != AE_NOT_FOUND)
771            {
772                ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
773                    "%s on Device %4.4s, %s\n",
774                    (char *) AcpiGbl_HighestDstateNames[i],
775                    AcpiUtGetNodeName (DeviceNode),
776                    AcpiFormatException (Status)));
777
778                return_ACPI_STATUS (Status);
779            }
780        }
781        else
782        {
783            /* Extract the Dstate value */
784
785            Highest[i] = (UINT8) ObjDesc->Integer.Value;
786
787            /* Delete the return object */
788
789            AcpiUtRemoveReference (ObjDesc);
790        }
791    }
792
793    return_ACPI_STATUS (AE_OK);
794}
795