13446Smrj /****************************************************************************** 23446Smrj * 33446Smrj * Module Name: uteval - Object evaluation 43446Smrj * 53446Smrj *****************************************************************************/ 63446Smrj 73446Smrj /****************************************************************************** 83446Smrj * 93446Smrj * 1. Copyright Notice 103446Smrj * 119980SDana.Myers@Sun.COM * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. 123446Smrj * All rights reserved. 133446Smrj * 143446Smrj * 2. License 153446Smrj * 163446Smrj * 2.1. This is your license from Intel Corp. under its intellectual property 173446Smrj * rights. You may have additional license terms from the party that provided 183446Smrj * you this software, covering your right to use that party's intellectual 193446Smrj * property rights. 203446Smrj * 213446Smrj * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 223446Smrj * copy of the source code appearing in this file ("Covered Code") an 233446Smrj * irrevocable, perpetual, worldwide license under Intel's copyrights in the 243446Smrj * base code distributed originally by Intel ("Original Intel Code") to copy, 253446Smrj * make derivatives, distribute, use and display any portion of the Covered 263446Smrj * Code in any form, with the right to sublicense such rights; and 273446Smrj * 283446Smrj * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 293446Smrj * license (with the right to sublicense), under only those claims of Intel 303446Smrj * patents that are infringed by the Original Intel Code, to make, use, sell, 313446Smrj * offer to sell, and import the Covered Code and derivative works thereof 323446Smrj * solely to the minimum extent necessary to exercise the above copyright 333446Smrj * license, and in no event shall the patent license extend to any additions 343446Smrj * to or modifications of the Original Intel Code. No other license or right 353446Smrj * is granted directly or by implication, estoppel or otherwise; 363446Smrj * 373446Smrj * The above copyright and patent license is granted only if the following 383446Smrj * conditions are met: 393446Smrj * 403446Smrj * 3. Conditions 413446Smrj * 423446Smrj * 3.1. Redistribution of Source with Rights to Further Distribute Source. 433446Smrj * Redistribution of source code of any substantial portion of the Covered 443446Smrj * Code or modification with rights to further distribute source must include 453446Smrj * the above Copyright Notice, the above License, this list of Conditions, 463446Smrj * and the following Disclaimer and Export Compliance provision. In addition, 473446Smrj * Licensee must cause all Covered Code to which Licensee contributes to 483446Smrj * contain a file documenting the changes Licensee made to create that Covered 493446Smrj * Code and the date of any change. Licensee must include in that file the 503446Smrj * documentation of any changes made by any predecessor Licensee. Licensee 513446Smrj * must include a prominent statement that the modification is derived, 523446Smrj * directly or indirectly, from Original Intel Code. 533446Smrj * 543446Smrj * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 553446Smrj * Redistribution of source code of any substantial portion of the Covered 563446Smrj * Code or modification without rights to further distribute source must 573446Smrj * include the following Disclaimer and Export Compliance provision in the 583446Smrj * documentation and/or other materials provided with distribution. In 593446Smrj * addition, Licensee may not authorize further sublicense of source of any 603446Smrj * portion of the Covered Code, and must include terms to the effect that the 613446Smrj * license from Licensee to its licensee is limited to the intellectual 623446Smrj * property embodied in the software Licensee provides to its licensee, and 633446Smrj * not to intellectual property embodied in modifications its licensee may 643446Smrj * make. 653446Smrj * 663446Smrj * 3.3. Redistribution of Executable. Redistribution in executable form of any 673446Smrj * substantial portion of the Covered Code or modification must reproduce the 683446Smrj * above Copyright Notice, and the following Disclaimer and Export Compliance 693446Smrj * provision in the documentation and/or other materials provided with the 703446Smrj * distribution. 713446Smrj * 723446Smrj * 3.4. Intel retains all right, title, and interest in and to the Original 733446Smrj * Intel Code. 743446Smrj * 753446Smrj * 3.5. Neither the name Intel nor any other trademark owned or controlled by 763446Smrj * Intel shall be used in advertising or otherwise to promote the sale, use or 773446Smrj * other dealings in products derived from or relating to the Covered Code 783446Smrj * without prior written authorization from Intel. 793446Smrj * 803446Smrj * 4. Disclaimer and Export Compliance 813446Smrj * 823446Smrj * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 833446Smrj * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 843446Smrj * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 853446Smrj * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 863446Smrj * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 873446Smrj * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 883446Smrj * PARTICULAR PURPOSE. 893446Smrj * 903446Smrj * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 913446Smrj * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 923446Smrj * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 933446Smrj * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 943446Smrj * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 953446Smrj * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 963446Smrj * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 973446Smrj * LIMITED REMEDY. 983446Smrj * 993446Smrj * 4.3. Licensee shall not export, either directly or indirectly, any of this 1003446Smrj * software or system incorporating such software without first obtaining any 1013446Smrj * required license or other approval from the U. S. Department of Commerce or 1023446Smrj * any other agency or department of the United States Government. In the 1033446Smrj * event Licensee exports any such software from the United States or 1043446Smrj * re-exports any such software from a foreign destination, Licensee shall 1053446Smrj * ensure that the distribution and export/re-export of the software is in 1063446Smrj * compliance with all laws, regulations, orders, or other restrictions of the 1073446Smrj * U.S. Export Administration Regulations. Licensee agrees that neither it nor 1083446Smrj * any of its subsidiaries will export/re-export any technical data, process, 1093446Smrj * software, or service, directly or indirectly, to any country for which the 1103446Smrj * United States government or any agency thereof requires an export license, 1113446Smrj * other governmental approval, or letter of assurance, without first obtaining 1123446Smrj * such license, approval or letter. 1133446Smrj * 1143446Smrj *****************************************************************************/ 1153446Smrj 1163446Smrj #define __UTEVAL_C__ 1173446Smrj 1183446Smrj #include "acpi.h" 1199980SDana.Myers@Sun.COM #include "accommon.h" 1203446Smrj #include "acnamesp.h" 1213446Smrj 1223446Smrj 1233446Smrj #define _COMPONENT ACPI_UTILITIES 1243446Smrj ACPI_MODULE_NAME ("uteval") 1253446Smrj 1263446Smrj 1273446Smrj /* 1283446Smrj * Strings supported by the _OSI predefined (internal) method. 1299980SDana.Myers@Sun.COM * 1309980SDana.Myers@Sun.COM * March 2009: Removed "Linux" as this host no longer wants to respond true 1319980SDana.Myers@Sun.COM * for this string. Basically, the only safe OS strings are windows-related 132*11225SDana.Myers@Sun.COM * and in many or most cases represent the only test path within the 1339980SDana.Myers@Sun.COM * BIOS-provided ASL code. 1349980SDana.Myers@Sun.COM * 1359980SDana.Myers@Sun.COM * The second element of each entry is used to track the newest version of 1369980SDana.Myers@Sun.COM * Windows that the BIOS has requested. 1373446Smrj */ 1389980SDana.Myers@Sun.COM static const ACPI_INTERFACE_INFO AcpiInterfacesSupported[] = 1393446Smrj { 1403446Smrj /* Operating System Vendor Strings */ 1413446Smrj 1429980SDana.Myers@Sun.COM {"Windows 2000", ACPI_OSI_WIN_2000}, /* Windows 2000 */ 1439980SDana.Myers@Sun.COM {"Windows 2001", ACPI_OSI_WIN_XP}, /* Windows XP */ 1449980SDana.Myers@Sun.COM {"Windows 2001 SP1", ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */ 1459980SDana.Myers@Sun.COM {"Windows 2001.1", ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */ 1469980SDana.Myers@Sun.COM {"Windows 2001 SP2", ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ 1479980SDana.Myers@Sun.COM {"Windows 2001.1 SP1", ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ 1489980SDana.Myers@Sun.COM {"Windows 2006", ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ 149*11225SDana.Myers@Sun.COM {"Windows 2006.1", ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ 150*11225SDana.Myers@Sun.COM {"Windows 2006 SP1", ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ 151*11225SDana.Myers@Sun.COM {"Windows 2009", ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ 1523446Smrj 1533446Smrj /* Feature Group Strings */ 1543446Smrj 1559980SDana.Myers@Sun.COM {"Extended Address Space Descriptor", 0} 1563446Smrj 1573446Smrj /* 1583446Smrj * All "optional" feature group strings (features that are implemented 1593446Smrj * by the host) should be implemented in the host version of 1603446Smrj * AcpiOsValidateInterface and should not be added here. 1613446Smrj */ 1623446Smrj }; 1633446Smrj 1643446Smrj 1653446Smrj /******************************************************************************* 1663446Smrj * 1673446Smrj * FUNCTION: AcpiUtOsiImplementation 1683446Smrj * 1693446Smrj * PARAMETERS: WalkState - Current walk state 1703446Smrj * 1713446Smrj * RETURN: Status 1723446Smrj * 1733446Smrj * DESCRIPTION: Implementation of the _OSI predefined control method 1743446Smrj * 1753446Smrj ******************************************************************************/ 1763446Smrj 1773446Smrj ACPI_STATUS 1783446Smrj AcpiUtOsiImplementation ( 1793446Smrj ACPI_WALK_STATE *WalkState) 1803446Smrj { 1813446Smrj ACPI_STATUS Status; 1823446Smrj ACPI_OPERAND_OBJECT *StringDesc; 1833446Smrj ACPI_OPERAND_OBJECT *ReturnDesc; 1849980SDana.Myers@Sun.COM UINT32 ReturnValue; 1857851SDana.Myers@Sun.COM UINT32 i; 1863446Smrj 1873446Smrj 1883446Smrj ACPI_FUNCTION_TRACE (UtOsiImplementation); 1893446Smrj 1903446Smrj 1913446Smrj /* Validate the string input argument */ 1923446Smrj 1933446Smrj StringDesc = WalkState->Arguments[0].Object; 1943446Smrj if (!StringDesc || (StringDesc->Common.Type != ACPI_TYPE_STRING)) 1953446Smrj { 1963446Smrj return_ACPI_STATUS (AE_TYPE); 1973446Smrj } 1983446Smrj 1993446Smrj /* Create a return object */ 2003446Smrj 2013446Smrj ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); 2023446Smrj if (!ReturnDesc) 2033446Smrj { 2043446Smrj return_ACPI_STATUS (AE_NO_MEMORY); 2053446Smrj } 2063446Smrj 2079980SDana.Myers@Sun.COM /* Default return value is 0, NOT SUPPORTED */ 2083446Smrj 2099980SDana.Myers@Sun.COM ReturnValue = 0; 2103446Smrj 2113446Smrj /* Compare input string to static table of supported interfaces */ 2123446Smrj 2133446Smrj for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiInterfacesSupported); i++) 2143446Smrj { 2159980SDana.Myers@Sun.COM if (!ACPI_STRCMP (StringDesc->String.Pointer, 2169980SDana.Myers@Sun.COM AcpiInterfacesSupported[i].Name)) 2173446Smrj { 2189980SDana.Myers@Sun.COM /* 2199980SDana.Myers@Sun.COM * The interface is supported. 2209980SDana.Myers@Sun.COM * Update the OsiData if necessary. We keep track of the latest 2219980SDana.Myers@Sun.COM * version of Windows that has been requested by the BIOS. 2229980SDana.Myers@Sun.COM */ 2239980SDana.Myers@Sun.COM if (AcpiInterfacesSupported[i].Value > AcpiGbl_OsiData) 2249980SDana.Myers@Sun.COM { 2259980SDana.Myers@Sun.COM AcpiGbl_OsiData = AcpiInterfacesSupported[i].Value; 2269980SDana.Myers@Sun.COM } 2273446Smrj 2289980SDana.Myers@Sun.COM ReturnValue = ACPI_UINT32_MAX; 2299980SDana.Myers@Sun.COM goto Exit; 2303446Smrj } 2313446Smrj } 2323446Smrj 2333446Smrj /* 2343446Smrj * Did not match the string in the static table, call the host OSL to 2353446Smrj * check for a match with one of the optional strings (such as 2363446Smrj * "Module Device", "3.0 Thermal Model", etc.) 2373446Smrj */ 2383446Smrj Status = AcpiOsValidateInterface (StringDesc->String.Pointer); 2393446Smrj if (ACPI_SUCCESS (Status)) 2403446Smrj { 2413446Smrj /* The interface is supported */ 2423446Smrj 2439980SDana.Myers@Sun.COM ReturnValue = ACPI_UINT32_MAX; 2443446Smrj } 2453446Smrj 2469980SDana.Myers@Sun.COM 2479980SDana.Myers@Sun.COM Exit: 2489980SDana.Myers@Sun.COM ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, 2499980SDana.Myers@Sun.COM "ACPI: BIOS _OSI(%s) is %ssupported\n", 2509980SDana.Myers@Sun.COM StringDesc->String.Pointer, ReturnValue == 0 ? "not " : "")); 2513446Smrj 2529980SDana.Myers@Sun.COM /* Complete the return value */ 2539980SDana.Myers@Sun.COM 2549980SDana.Myers@Sun.COM ReturnDesc->Integer.Value = ReturnValue; 2559980SDana.Myers@Sun.COM WalkState->ReturnDesc = ReturnDesc; 2569980SDana.Myers@Sun.COM return_ACPI_STATUS (AE_OK); 2573446Smrj } 2583446Smrj 2593446Smrj 2603446Smrj /******************************************************************************* 2613446Smrj * 2623446Smrj * FUNCTION: AcpiUtEvaluateObject 2633446Smrj * 2643446Smrj * PARAMETERS: PrefixNode - Starting node 2653446Smrj * Path - Path to object from starting node 2663446Smrj * ExpectedReturnTypes - Bitmap of allowed return types 2673446Smrj * ReturnDesc - Where a return value is stored 2683446Smrj * 2693446Smrj * RETURN: Status 2703446Smrj * 2713446Smrj * DESCRIPTION: Evaluates a namespace object and verifies the type of the 272*11225SDana.Myers@Sun.COM * return object. Common code that simplifies accessing objects 2733446Smrj * that have required return objects of fixed types. 2743446Smrj * 2753446Smrj * NOTE: Internal function, no parameter validation 2763446Smrj * 2773446Smrj ******************************************************************************/ 2783446Smrj 2793446Smrj ACPI_STATUS 2803446Smrj AcpiUtEvaluateObject ( 2813446Smrj ACPI_NAMESPACE_NODE *PrefixNode, 2823446Smrj char *Path, 2833446Smrj UINT32 ExpectedReturnBtypes, 2843446Smrj ACPI_OPERAND_OBJECT **ReturnDesc) 2853446Smrj { 2863446Smrj ACPI_EVALUATE_INFO *Info; 2873446Smrj ACPI_STATUS Status; 2883446Smrj UINT32 ReturnBtype; 2893446Smrj 2903446Smrj 2913446Smrj ACPI_FUNCTION_TRACE (UtEvaluateObject); 2923446Smrj 2933446Smrj 2943446Smrj /* Allocate the evaluation information block */ 2953446Smrj 2963446Smrj Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); 2973446Smrj if (!Info) 2983446Smrj { 2993446Smrj return_ACPI_STATUS (AE_NO_MEMORY); 3003446Smrj } 3013446Smrj 3023446Smrj Info->PrefixNode = PrefixNode; 3033446Smrj Info->Pathname = Path; 3043446Smrj 3053446Smrj /* Evaluate the object/method */ 3063446Smrj 3073446Smrj Status = AcpiNsEvaluate (Info); 3083446Smrj if (ACPI_FAILURE (Status)) 3093446Smrj { 3103446Smrj if (Status == AE_NOT_FOUND) 3113446Smrj { 3123446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s.%s] was not found\n", 3133446Smrj AcpiUtGetNodeName (PrefixNode), Path)); 3143446Smrj } 3153446Smrj else 3163446Smrj { 3173446Smrj ACPI_ERROR_METHOD ("Method execution failed", 3183446Smrj PrefixNode, Path, Status); 3193446Smrj } 3203446Smrj 3213446Smrj goto Cleanup; 3223446Smrj } 3233446Smrj 3243446Smrj /* Did we get a return object? */ 3253446Smrj 3263446Smrj if (!Info->ReturnObject) 3273446Smrj { 3283446Smrj if (ExpectedReturnBtypes) 3293446Smrj { 3303446Smrj ACPI_ERROR_METHOD ("No object was returned from", 3313446Smrj PrefixNode, Path, AE_NOT_EXIST); 3323446Smrj 3333446Smrj Status = AE_NOT_EXIST; 3343446Smrj } 3353446Smrj 3363446Smrj goto Cleanup; 3373446Smrj } 3383446Smrj 3393446Smrj /* Map the return object type to the bitmapped type */ 3403446Smrj 3419980SDana.Myers@Sun.COM switch ((Info->ReturnObject)->Common.Type) 3423446Smrj { 3433446Smrj case ACPI_TYPE_INTEGER: 3443446Smrj ReturnBtype = ACPI_BTYPE_INTEGER; 3453446Smrj break; 3463446Smrj 3473446Smrj case ACPI_TYPE_BUFFER: 3483446Smrj ReturnBtype = ACPI_BTYPE_BUFFER; 3493446Smrj break; 3503446Smrj 3513446Smrj case ACPI_TYPE_STRING: 3523446Smrj ReturnBtype = ACPI_BTYPE_STRING; 3533446Smrj break; 3543446Smrj 3553446Smrj case ACPI_TYPE_PACKAGE: 3563446Smrj ReturnBtype = ACPI_BTYPE_PACKAGE; 3573446Smrj break; 3583446Smrj 3593446Smrj default: 3603446Smrj ReturnBtype = 0; 3613446Smrj break; 3623446Smrj } 3633446Smrj 3643446Smrj if ((AcpiGbl_EnableInterpreterSlack) && 3653446Smrj (!ExpectedReturnBtypes)) 3663446Smrj { 3673446Smrj /* 368*11225SDana.Myers@Sun.COM * We received a return object, but one was not expected. This can 3693446Smrj * happen frequently if the "implicit return" feature is enabled. 3703446Smrj * Just delete the return object and return AE_OK. 3713446Smrj */ 3723446Smrj AcpiUtRemoveReference (Info->ReturnObject); 3733446Smrj goto Cleanup; 3743446Smrj } 3753446Smrj 3763446Smrj /* Is the return object one of the expected types? */ 3773446Smrj 3783446Smrj if (!(ExpectedReturnBtypes & ReturnBtype)) 3793446Smrj { 3803446Smrj ACPI_ERROR_METHOD ("Return object type is incorrect", 3813446Smrj PrefixNode, Path, AE_TYPE); 3823446Smrj 3833446Smrj ACPI_ERROR ((AE_INFO, 3843446Smrj "Type returned from %s was incorrect: %s, expected Btypes: %X", 3853446Smrj Path, AcpiUtGetObjectTypeName (Info->ReturnObject), 3863446Smrj ExpectedReturnBtypes)); 3873446Smrj 3883446Smrj /* On error exit, we must delete the return object */ 3893446Smrj 3903446Smrj AcpiUtRemoveReference (Info->ReturnObject); 3913446Smrj Status = AE_TYPE; 3923446Smrj goto Cleanup; 3933446Smrj } 3943446Smrj 3953446Smrj /* Object type is OK, return it */ 3963446Smrj 3973446Smrj *ReturnDesc = Info->ReturnObject; 3983446Smrj 3993446Smrj Cleanup: 4003446Smrj ACPI_FREE (Info); 4013446Smrj return_ACPI_STATUS (Status); 4023446Smrj } 4033446Smrj 4043446Smrj 4053446Smrj /******************************************************************************* 4063446Smrj * 4073446Smrj * FUNCTION: AcpiUtEvaluateNumericObject 4083446Smrj * 4093446Smrj * PARAMETERS: ObjectName - Object name to be evaluated 4103446Smrj * DeviceNode - Node for the device 411*11225SDana.Myers@Sun.COM * Value - Where the value is returned 4123446Smrj * 4133446Smrj * RETURN: Status 4143446Smrj * 4153446Smrj * DESCRIPTION: Evaluates a numeric namespace object for a selected device 416*11225SDana.Myers@Sun.COM * and stores result in *Value. 4173446Smrj * 4183446Smrj * NOTE: Internal function, no parameter validation 4193446Smrj * 4203446Smrj ******************************************************************************/ 4213446Smrj 4223446Smrj ACPI_STATUS 4233446Smrj AcpiUtEvaluateNumericObject ( 4243446Smrj char *ObjectName, 4253446Smrj ACPI_NAMESPACE_NODE *DeviceNode, 426*11225SDana.Myers@Sun.COM ACPI_INTEGER *Value) 4273446Smrj { 4283446Smrj ACPI_OPERAND_OBJECT *ObjDesc; 4293446Smrj ACPI_STATUS Status; 4303446Smrj 4313446Smrj 4323446Smrj ACPI_FUNCTION_TRACE (UtEvaluateNumericObject); 4333446Smrj 4343446Smrj 4353446Smrj Status = AcpiUtEvaluateObject (DeviceNode, ObjectName, 4363446Smrj ACPI_BTYPE_INTEGER, &ObjDesc); 4373446Smrj if (ACPI_FAILURE (Status)) 4383446Smrj { 4393446Smrj return_ACPI_STATUS (Status); 4403446Smrj } 4413446Smrj 4423446Smrj /* Get the returned Integer */ 4433446Smrj 444*11225SDana.Myers@Sun.COM *Value = ObjDesc->Integer.Value; 4453446Smrj 4463446Smrj /* On exit, we must delete the return object */ 4473446Smrj 4483446Smrj AcpiUtRemoveReference (ObjDesc); 4493446Smrj return_ACPI_STATUS (Status); 4503446Smrj } 4513446Smrj 4523446Smrj 4533446Smrj /******************************************************************************* 4543446Smrj * 4553446Smrj * FUNCTION: AcpiUtExecute_STA 4563446Smrj * 4573446Smrj * PARAMETERS: DeviceNode - Node for the device 4583446Smrj * Flags - Where the status flags are returned 4593446Smrj * 4603446Smrj * RETURN: Status 4613446Smrj * 4623446Smrj * DESCRIPTION: Executes _STA for selected device and stores results in 4633446Smrj * *Flags. 4643446Smrj * 4653446Smrj * NOTE: Internal function, no parameter validation 4663446Smrj * 4673446Smrj ******************************************************************************/ 4683446Smrj 4693446Smrj ACPI_STATUS 4703446Smrj AcpiUtExecute_STA ( 4713446Smrj ACPI_NAMESPACE_NODE *DeviceNode, 4723446Smrj UINT32 *Flags) 4733446Smrj { 4743446Smrj ACPI_OPERAND_OBJECT *ObjDesc; 4753446Smrj ACPI_STATUS Status; 4763446Smrj 4773446Smrj 4783446Smrj ACPI_FUNCTION_TRACE (UtExecute_STA); 4793446Smrj 4803446Smrj 4813446Smrj Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__STA, 4823446Smrj ACPI_BTYPE_INTEGER, &ObjDesc); 4833446Smrj if (ACPI_FAILURE (Status)) 4843446Smrj { 4853446Smrj if (AE_NOT_FOUND == Status) 4863446Smrj { 4873446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 4883446Smrj "_STA on %4.4s was not found, assuming device is present\n", 4893446Smrj AcpiUtGetNodeName (DeviceNode))); 4903446Smrj 4913446Smrj *Flags = ACPI_UINT32_MAX; 4923446Smrj Status = AE_OK; 4933446Smrj } 4943446Smrj 4953446Smrj return_ACPI_STATUS (Status); 4963446Smrj } 4973446Smrj 4983446Smrj /* Extract the status flags */ 4993446Smrj 5003446Smrj *Flags = (UINT32) ObjDesc->Integer.Value; 5013446Smrj 5023446Smrj /* On exit, we must delete the return object */ 5033446Smrj 5043446Smrj AcpiUtRemoveReference (ObjDesc); 5053446Smrj return_ACPI_STATUS (Status); 5063446Smrj } 5073446Smrj 5083446Smrj 5093446Smrj /******************************************************************************* 5103446Smrj * 511*11225SDana.Myers@Sun.COM * FUNCTION: AcpiUtExecutePowerMethods 5123446Smrj * 5133446Smrj * PARAMETERS: DeviceNode - Node for the device 514*11225SDana.Myers@Sun.COM * MethodNames - Array of power method names 515*11225SDana.Myers@Sun.COM * MethodCount - Number of methods to execute 516*11225SDana.Myers@Sun.COM * OutValues - Where the power method values are returned 5173446Smrj * 518*11225SDana.Myers@Sun.COM * RETURN: Status, OutValues 5193446Smrj * 520*11225SDana.Myers@Sun.COM * DESCRIPTION: Executes the specified power methods for the device and returns 521*11225SDana.Myers@Sun.COM * the result(s). 5223446Smrj * 5233446Smrj * NOTE: Internal function, no parameter validation 5243446Smrj * 5253446Smrj ******************************************************************************/ 5263446Smrj 5273446Smrj ACPI_STATUS 528*11225SDana.Myers@Sun.COM AcpiUtExecutePowerMethods ( 5293446Smrj ACPI_NAMESPACE_NODE *DeviceNode, 530*11225SDana.Myers@Sun.COM const char **MethodNames, 531*11225SDana.Myers@Sun.COM UINT8 MethodCount, 532*11225SDana.Myers@Sun.COM UINT8 *OutValues) 5333446Smrj { 5343446Smrj ACPI_OPERAND_OBJECT *ObjDesc; 5353446Smrj ACPI_STATUS Status; 536*11225SDana.Myers@Sun.COM ACPI_STATUS FinalStatus = AE_NOT_FOUND; 5373446Smrj UINT32 i; 5383446Smrj 5393446Smrj 540*11225SDana.Myers@Sun.COM ACPI_FUNCTION_TRACE (UtExecutePowerMethods); 5413446Smrj 5423446Smrj 543*11225SDana.Myers@Sun.COM for (i = 0; i < MethodCount; i++) 5443446Smrj { 545*11225SDana.Myers@Sun.COM /* 546*11225SDana.Myers@Sun.COM * Execute the power method (_SxD or _SxW). The only allowable 547*11225SDana.Myers@Sun.COM * return type is an Integer. 548*11225SDana.Myers@Sun.COM */ 5493446Smrj Status = AcpiUtEvaluateObject (DeviceNode, 550*11225SDana.Myers@Sun.COM ACPI_CAST_PTR (char, MethodNames[i]), 5513446Smrj ACPI_BTYPE_INTEGER, &ObjDesc); 552*11225SDana.Myers@Sun.COM if (ACPI_SUCCESS (Status)) 5533446Smrj { 554*11225SDana.Myers@Sun.COM OutValues[i] = (UINT8) ObjDesc->Integer.Value; 5553446Smrj 5563446Smrj /* Delete the return object */ 5573446Smrj 5583446Smrj AcpiUtRemoveReference (ObjDesc); 559*11225SDana.Myers@Sun.COM FinalStatus = AE_OK; /* At least one value is valid */ 560*11225SDana.Myers@Sun.COM continue; 5613446Smrj } 562*11225SDana.Myers@Sun.COM 563*11225SDana.Myers@Sun.COM OutValues[i] = ACPI_UINT8_MAX; 564*11225SDana.Myers@Sun.COM if (Status == AE_NOT_FOUND) 565*11225SDana.Myers@Sun.COM { 566*11225SDana.Myers@Sun.COM continue; /* Ignore if not found */ 567*11225SDana.Myers@Sun.COM } 568*11225SDana.Myers@Sun.COM 569*11225SDana.Myers@Sun.COM ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Failed %s on Device %4.4s, %s\n", 570*11225SDana.Myers@Sun.COM ACPI_CAST_PTR (char, MethodNames[i]), 571*11225SDana.Myers@Sun.COM AcpiUtGetNodeName (DeviceNode), AcpiFormatException (Status))); 5723446Smrj } 5733446Smrj 574*11225SDana.Myers@Sun.COM return_ACPI_STATUS (FinalStatus); 5753446Smrj } 576