13446Smrj /****************************************************************************** 23446Smrj * 33446Smrj * Module Name: utxface - External interfaces for "global" ACPI functions 43446Smrj * 53446Smrj *****************************************************************************/ 63446Smrj 73446Smrj /****************************************************************************** 83446Smrj * 93446Smrj * 1. Copyright Notice 103446Smrj * 11*9980SDana.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 1173446Smrj #define __UTXFACE_C__ 1183446Smrj 1193446Smrj #include "acpi.h" 120*9980SDana.Myers@Sun.COM #include "accommon.h" 1213446Smrj #include "acevents.h" 1223446Smrj #include "acnamesp.h" 1233446Smrj #include "acdebug.h" 124*9980SDana.Myers@Sun.COM #include "actables.h" 1253446Smrj 1263446Smrj #define _COMPONENT ACPI_UTILITIES 1273446Smrj ACPI_MODULE_NAME ("utxface") 1283446Smrj 1293446Smrj 1307851SDana.Myers@Sun.COM #ifndef ACPI_ASL_COMPILER 1317851SDana.Myers@Sun.COM 1323446Smrj /******************************************************************************* 1333446Smrj * 1343446Smrj * FUNCTION: AcpiInitializeSubsystem 1353446Smrj * 1363446Smrj * PARAMETERS: None 1373446Smrj * 1383446Smrj * RETURN: Status 1393446Smrj * 1403446Smrj * DESCRIPTION: Initializes all global variables. This is the first function 1413446Smrj * called, so any early initialization belongs here. 1423446Smrj * 1433446Smrj ******************************************************************************/ 1443446Smrj 1453446Smrj ACPI_STATUS 1463446Smrj AcpiInitializeSubsystem ( 1473446Smrj void) 1483446Smrj { 1493446Smrj ACPI_STATUS Status; 1503446Smrj 1513446Smrj 1523446Smrj ACPI_FUNCTION_TRACE (AcpiInitializeSubsystem); 1533446Smrj 1543446Smrj 1557851SDana.Myers@Sun.COM AcpiGbl_StartupFlags = ACPI_SUBSYSTEM_INITIALIZE; 1563446Smrj ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ()); 1573446Smrj 1583446Smrj /* Initialize the OS-Dependent layer */ 1593446Smrj 1603446Smrj Status = AcpiOsInitialize (); 1613446Smrj if (ACPI_FAILURE (Status)) 1623446Smrj { 1633446Smrj ACPI_EXCEPTION ((AE_INFO, Status, "During OSL initialization")); 1643446Smrj return_ACPI_STATUS (Status); 1653446Smrj } 1663446Smrj 1673446Smrj /* Initialize all globals used by the subsystem */ 1683446Smrj 1697851SDana.Myers@Sun.COM Status = AcpiUtInitGlobals (); 1707851SDana.Myers@Sun.COM if (ACPI_FAILURE (Status)) 1717851SDana.Myers@Sun.COM { 1727851SDana.Myers@Sun.COM ACPI_EXCEPTION ((AE_INFO, Status, "During initialization of globals")); 1737851SDana.Myers@Sun.COM return_ACPI_STATUS (Status); 1747851SDana.Myers@Sun.COM } 1753446Smrj 1763446Smrj /* Create the default mutex objects */ 1773446Smrj 1783446Smrj Status = AcpiUtMutexInitialize (); 1793446Smrj if (ACPI_FAILURE (Status)) 1803446Smrj { 1813446Smrj ACPI_EXCEPTION ((AE_INFO, Status, "During Global Mutex creation")); 1823446Smrj return_ACPI_STATUS (Status); 1833446Smrj } 1843446Smrj 1853446Smrj /* 1863446Smrj * Initialize the namespace manager and 1873446Smrj * the root of the namespace tree 1883446Smrj */ 1893446Smrj Status = AcpiNsRootInitialize (); 1903446Smrj if (ACPI_FAILURE (Status)) 1913446Smrj { 1923446Smrj ACPI_EXCEPTION ((AE_INFO, Status, "During Namespace initialization")); 1933446Smrj return_ACPI_STATUS (Status); 1943446Smrj } 1953446Smrj 1963446Smrj /* If configured, initialize the AML debugger */ 1973446Smrj 1983446Smrj ACPI_DEBUGGER_EXEC (Status = AcpiDbInitialize ()); 1993446Smrj return_ACPI_STATUS (Status); 2003446Smrj } 2013446Smrj 2023446Smrj ACPI_EXPORT_SYMBOL (AcpiInitializeSubsystem) 2033446Smrj 2043446Smrj 2053446Smrj /******************************************************************************* 2063446Smrj * 2073446Smrj * FUNCTION: AcpiEnableSubsystem 2083446Smrj * 2093446Smrj * PARAMETERS: Flags - Init/enable Options 2103446Smrj * 2113446Smrj * RETURN: Status 2123446Smrj * 2133446Smrj * DESCRIPTION: Completes the subsystem initialization including hardware. 2143446Smrj * Puts system into ACPI mode if it isn't already. 2153446Smrj * 2163446Smrj ******************************************************************************/ 2173446Smrj 2183446Smrj ACPI_STATUS 2193446Smrj AcpiEnableSubsystem ( 2203446Smrj UINT32 Flags) 2213446Smrj { 2223446Smrj ACPI_STATUS Status = AE_OK; 2233446Smrj 2243446Smrj 2253446Smrj ACPI_FUNCTION_TRACE (AcpiEnableSubsystem); 2263446Smrj 2273446Smrj 2283446Smrj /* Enable ACPI mode */ 2293446Smrj 2303446Smrj if (!(Flags & ACPI_NO_ACPI_ENABLE)) 2313446Smrj { 2323446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); 2333446Smrj 2343446Smrj AcpiGbl_OriginalMode = AcpiHwGetMode(); 2353446Smrj 2363446Smrj Status = AcpiEnable (); 2373446Smrj if (ACPI_FAILURE (Status)) 2383446Smrj { 2393446Smrj ACPI_WARNING ((AE_INFO, "AcpiEnable failed")); 2403446Smrj return_ACPI_STATUS (Status); 2413446Smrj } 2423446Smrj } 2433446Smrj 2443446Smrj /* 245*9980SDana.Myers@Sun.COM * Obtain a permanent mapping for the FACS. This is required for the 246*9980SDana.Myers@Sun.COM * Global Lock and the Firmware Waking Vector 247*9980SDana.Myers@Sun.COM */ 248*9980SDana.Myers@Sun.COM Status = AcpiTbInitializeFacs (); 249*9980SDana.Myers@Sun.COM if (ACPI_FAILURE (Status)) 250*9980SDana.Myers@Sun.COM { 251*9980SDana.Myers@Sun.COM ACPI_WARNING ((AE_INFO, "Could not map the FACS table")); 252*9980SDana.Myers@Sun.COM return_ACPI_STATUS (Status); 253*9980SDana.Myers@Sun.COM } 254*9980SDana.Myers@Sun.COM 255*9980SDana.Myers@Sun.COM /* 2563446Smrj * Install the default OpRegion handlers. These are installed unless 2573446Smrj * other handlers have already been installed via the 2583446Smrj * InstallAddressSpaceHandler interface. 2593446Smrj */ 2603446Smrj if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) 2613446Smrj { 2623446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 2633446Smrj "[Init] Installing default address space handlers\n")); 2643446Smrj 2653446Smrj Status = AcpiEvInstallRegionHandlers (); 2663446Smrj if (ACPI_FAILURE (Status)) 2673446Smrj { 2683446Smrj return_ACPI_STATUS (Status); 2693446Smrj } 2703446Smrj } 2713446Smrj 2723446Smrj /* 2733446Smrj * Initialize ACPI Event handling (Fixed and General Purpose) 2743446Smrj * 2753446Smrj * Note1: We must have the hardware and events initialized before we can 2763446Smrj * execute any control methods safely. Any control method can require 2773446Smrj * ACPI hardware support, so the hardware must be fully initialized before 2783446Smrj * any method execution! 2793446Smrj * 2803446Smrj * Note2: Fixed events are initialized and enabled here. GPEs are 2813446Smrj * initialized, but cannot be enabled until after the hardware is 2827851SDana.Myers@Sun.COM * completely initialized (SCI and GlobalLock activated) and the various 2837851SDana.Myers@Sun.COM * initialization control methods are run (_REG, _STA, _INI) on the 2847851SDana.Myers@Sun.COM * entire namespace. 2853446Smrj */ 2863446Smrj if (!(Flags & ACPI_NO_EVENT_INIT)) 2873446Smrj { 2883446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 2893446Smrj "[Init] Initializing ACPI events\n")); 2903446Smrj 2913446Smrj Status = AcpiEvInitializeEvents (); 2923446Smrj if (ACPI_FAILURE (Status)) 2933446Smrj { 2943446Smrj return_ACPI_STATUS (Status); 2953446Smrj } 2963446Smrj } 2973446Smrj 2983446Smrj /* 2993446Smrj * Install the SCI handler and Global Lock handler. This completes the 3003446Smrj * hardware initialization. 3013446Smrj */ 3023446Smrj if (!(Flags & ACPI_NO_HANDLER_INIT)) 3033446Smrj { 3043446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 3053446Smrj "[Init] Installing SCI/GL handlers\n")); 3063446Smrj 3073446Smrj Status = AcpiEvInstallXruptHandlers (); 3083446Smrj if (ACPI_FAILURE (Status)) 3093446Smrj { 3103446Smrj return_ACPI_STATUS (Status); 3113446Smrj } 3123446Smrj } 3133446Smrj 3143446Smrj return_ACPI_STATUS (Status); 3153446Smrj } 3163446Smrj 3173446Smrj ACPI_EXPORT_SYMBOL (AcpiEnableSubsystem) 3183446Smrj 3193446Smrj 3203446Smrj /******************************************************************************* 3213446Smrj * 3223446Smrj * FUNCTION: AcpiInitializeObjects 3233446Smrj * 3243446Smrj * PARAMETERS: Flags - Init/enable Options 3253446Smrj * 3263446Smrj * RETURN: Status 3273446Smrj * 3283446Smrj * DESCRIPTION: Completes namespace initialization by initializing device 3293446Smrj * objects and executing AML code for Regions, buffers, etc. 3303446Smrj * 3313446Smrj ******************************************************************************/ 3323446Smrj 3333446Smrj ACPI_STATUS 3343446Smrj AcpiInitializeObjects ( 3353446Smrj UINT32 Flags) 3363446Smrj { 3373446Smrj ACPI_STATUS Status = AE_OK; 3383446Smrj 3393446Smrj 3403446Smrj ACPI_FUNCTION_TRACE (AcpiInitializeObjects); 3413446Smrj 3423446Smrj 3433446Smrj /* 3443446Smrj * Run all _REG methods 3453446Smrj * 3463446Smrj * Note: Any objects accessed by the _REG methods will be automatically 3473446Smrj * initialized, even if they contain executable AML (see the call to 3483446Smrj * AcpiNsInitializeObjects below). 3493446Smrj */ 3503446Smrj if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) 3513446Smrj { 3523446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 3533446Smrj "[Init] Executing _REG OpRegion methods\n")); 3543446Smrj 3553446Smrj Status = AcpiEvInitializeOpRegions (); 3563446Smrj if (ACPI_FAILURE (Status)) 3573446Smrj { 3583446Smrj return_ACPI_STATUS (Status); 3593446Smrj } 3603446Smrj } 3613446Smrj 3623446Smrj /* 3633446Smrj * Initialize the objects that remain uninitialized. This runs the 3643446Smrj * executable AML that may be part of the declaration of these objects: 3653446Smrj * OperationRegions, BufferFields, Buffers, and Packages. 3663446Smrj */ 3673446Smrj if (!(Flags & ACPI_NO_OBJECT_INIT)) 3683446Smrj { 3693446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 3703446Smrj "[Init] Completing Initialization of ACPI Objects\n")); 3713446Smrj 3723446Smrj Status = AcpiNsInitializeObjects (); 3733446Smrj if (ACPI_FAILURE (Status)) 3743446Smrj { 3753446Smrj return_ACPI_STATUS (Status); 3763446Smrj } 3773446Smrj } 3783446Smrj 3793446Smrj /* 3803446Smrj * Initialize all device objects in the namespace. This runs the device 3813446Smrj * _STA and _INI methods. 3823446Smrj */ 3833446Smrj if (!(Flags & ACPI_NO_DEVICE_INIT)) 3843446Smrj { 3853446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 3863446Smrj "[Init] Initializing ACPI Devices\n")); 3873446Smrj 3883446Smrj Status = AcpiNsInitializeDevices (); 3893446Smrj if (ACPI_FAILURE (Status)) 3903446Smrj { 3913446Smrj return_ACPI_STATUS (Status); 3923446Smrj } 3933446Smrj } 3943446Smrj 3953446Smrj /* 3967851SDana.Myers@Sun.COM * Initialize the GPE blocks defined in the FADT (GPE block 0 and 1). 3977851SDana.Myers@Sun.COM * The runtime GPEs are enabled here. 3987851SDana.Myers@Sun.COM * 3997851SDana.Myers@Sun.COM * This is where the _PRW methods are executed for the GPEs. These 4007851SDana.Myers@Sun.COM * methods can only be executed after the SCI and Global Lock handlers are 4017851SDana.Myers@Sun.COM * installed and initialized. 4027851SDana.Myers@Sun.COM * 4037851SDana.Myers@Sun.COM * GPEs can only be enabled after the _REG, _STA, and _INI methods have 4047851SDana.Myers@Sun.COM * been run. This ensures that all Operation Regions and all Devices have 4057851SDana.Myers@Sun.COM * been initialized and are ready. 4067851SDana.Myers@Sun.COM */ 4077851SDana.Myers@Sun.COM if (!(Flags & ACPI_NO_EVENT_INIT)) 4087851SDana.Myers@Sun.COM { 4097851SDana.Myers@Sun.COM Status = AcpiEvInstallFadtGpes (); 4107851SDana.Myers@Sun.COM if (ACPI_FAILURE (Status)) 4117851SDana.Myers@Sun.COM { 4127851SDana.Myers@Sun.COM return (Status); 4137851SDana.Myers@Sun.COM } 4147851SDana.Myers@Sun.COM } 4157851SDana.Myers@Sun.COM 4167851SDana.Myers@Sun.COM /* 4173446Smrj * Empty the caches (delete the cached objects) on the assumption that 4183446Smrj * the table load filled them up more than they will be at runtime -- 4193446Smrj * thus wasting non-paged memory. 4203446Smrj */ 4213446Smrj Status = AcpiPurgeCachedObjects (); 4223446Smrj 4233446Smrj AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK; 4243446Smrj return_ACPI_STATUS (Status); 4253446Smrj } 4263446Smrj 4273446Smrj ACPI_EXPORT_SYMBOL (AcpiInitializeObjects) 4283446Smrj 4293446Smrj 4307851SDana.Myers@Sun.COM #endif 4317851SDana.Myers@Sun.COM 4323446Smrj /******************************************************************************* 4333446Smrj * 4343446Smrj * FUNCTION: AcpiTerminate 4353446Smrj * 4363446Smrj * PARAMETERS: None 4373446Smrj * 4383446Smrj * RETURN: Status 4393446Smrj * 4403446Smrj * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. 4413446Smrj * 4423446Smrj ******************************************************************************/ 4433446Smrj 4443446Smrj ACPI_STATUS 4453446Smrj AcpiTerminate ( 4463446Smrj void) 4473446Smrj { 4483446Smrj ACPI_STATUS Status; 4493446Smrj 4503446Smrj 4513446Smrj ACPI_FUNCTION_TRACE (AcpiTerminate); 4523446Smrj 4533446Smrj 4543446Smrj /* Terminate the AML Debugger if present */ 4553446Smrj 4563446Smrj ACPI_DEBUGGER_EXEC(AcpiGbl_DbTerminateThreads = TRUE); 4573446Smrj 4583446Smrj /* Shutdown and free all resources */ 4593446Smrj 4603446Smrj AcpiUtSubsystemShutdown (); 4613446Smrj 4623446Smrj 4633446Smrj /* Free the mutex objects */ 4643446Smrj 4653446Smrj AcpiUtMutexTerminate (); 4663446Smrj 4673446Smrj 4683446Smrj #ifdef ACPI_DEBUGGER 4693446Smrj 4703446Smrj /* Shut down the debugger */ 4713446Smrj 4723446Smrj AcpiDbTerminate (); 4733446Smrj #endif 4743446Smrj 4753446Smrj /* Now we can shutdown the OS-dependent layer */ 4763446Smrj 4773446Smrj Status = AcpiOsTerminate (); 4783446Smrj return_ACPI_STATUS (Status); 4793446Smrj } 4803446Smrj 4813446Smrj ACPI_EXPORT_SYMBOL (AcpiTerminate) 4823446Smrj 4837851SDana.Myers@Sun.COM #ifndef ACPI_ASL_COMPILER 4843446Smrj 4853446Smrj /******************************************************************************* 4863446Smrj * 4873446Smrj * FUNCTION: AcpiSubsystemStatus 4883446Smrj * 4893446Smrj * PARAMETERS: None 4903446Smrj * 4913446Smrj * RETURN: Status of the ACPI subsystem 4923446Smrj * 4933446Smrj * DESCRIPTION: Other drivers that use the ACPI subsystem should call this 4943446Smrj * before making any other calls, to ensure the subsystem 4953446Smrj * initialized successfully. 4963446Smrj * 4973446Smrj ******************************************************************************/ 4983446Smrj 4993446Smrj ACPI_STATUS 5003446Smrj AcpiSubsystemStatus ( 5013446Smrj void) 5023446Smrj { 5033446Smrj 5043446Smrj if (AcpiGbl_StartupFlags & ACPI_INITIALIZED_OK) 5053446Smrj { 5063446Smrj return (AE_OK); 5073446Smrj } 5083446Smrj else 5093446Smrj { 5103446Smrj return (AE_ERROR); 5113446Smrj } 5123446Smrj } 5133446Smrj 5143446Smrj ACPI_EXPORT_SYMBOL (AcpiSubsystemStatus) 5153446Smrj 5163446Smrj 5173446Smrj /******************************************************************************* 5183446Smrj * 5193446Smrj * FUNCTION: AcpiGetSystemInfo 5203446Smrj * 5213446Smrj * PARAMETERS: OutBuffer - A buffer to receive the resources for the 5223446Smrj * device 5233446Smrj * 5243446Smrj * RETURN: Status - the status of the call 5253446Smrj * 5263446Smrj * DESCRIPTION: This function is called to get information about the current 5273446Smrj * state of the ACPI subsystem. It will return system information 5283446Smrj * in the OutBuffer. 5293446Smrj * 5303446Smrj * If the function fails an appropriate status will be returned 5313446Smrj * and the value of OutBuffer is undefined. 5323446Smrj * 5333446Smrj ******************************************************************************/ 5343446Smrj 5353446Smrj ACPI_STATUS 5363446Smrj AcpiGetSystemInfo ( 5373446Smrj ACPI_BUFFER *OutBuffer) 5383446Smrj { 5393446Smrj ACPI_SYSTEM_INFO *InfoPtr; 5403446Smrj ACPI_STATUS Status; 5413446Smrj 5423446Smrj 5433446Smrj ACPI_FUNCTION_TRACE (AcpiGetSystemInfo); 5443446Smrj 5453446Smrj 5463446Smrj /* Parameter validation */ 5473446Smrj 5483446Smrj Status = AcpiUtValidateBuffer (OutBuffer); 5493446Smrj if (ACPI_FAILURE (Status)) 5503446Smrj { 5513446Smrj return_ACPI_STATUS (Status); 5523446Smrj } 5533446Smrj 5543446Smrj /* Validate/Allocate/Clear caller buffer */ 5553446Smrj 5563446Smrj Status = AcpiUtInitializeBuffer (OutBuffer, sizeof (ACPI_SYSTEM_INFO)); 5573446Smrj if (ACPI_FAILURE (Status)) 5583446Smrj { 5593446Smrj return_ACPI_STATUS (Status); 5603446Smrj } 5613446Smrj 5623446Smrj /* 5633446Smrj * Populate the return buffer 5643446Smrj */ 5653446Smrj InfoPtr = (ACPI_SYSTEM_INFO *) OutBuffer->Pointer; 5663446Smrj 5673446Smrj InfoPtr->AcpiCaVersion = ACPI_CA_VERSION; 5683446Smrj 5693446Smrj /* System flags (ACPI capabilities) */ 5703446Smrj 5713446Smrj InfoPtr->Flags = ACPI_SYS_MODE_ACPI; 5723446Smrj 5733446Smrj /* Timer resolution - 24 or 32 bits */ 5743446Smrj 5757851SDana.Myers@Sun.COM if (AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) 5763446Smrj { 5773446Smrj InfoPtr->TimerResolution = 24; 5783446Smrj } 5793446Smrj else 5803446Smrj { 5813446Smrj InfoPtr->TimerResolution = 32; 5823446Smrj } 5833446Smrj 5843446Smrj /* Clear the reserved fields */ 5853446Smrj 5863446Smrj InfoPtr->Reserved1 = 0; 5873446Smrj InfoPtr->Reserved2 = 0; 5883446Smrj 5893446Smrj /* Current debug levels */ 5903446Smrj 5913446Smrj InfoPtr->DebugLayer = AcpiDbgLayer; 5923446Smrj InfoPtr->DebugLevel = AcpiDbgLevel; 5933446Smrj 5947851SDana.Myers@Sun.COM return_ACPI_STATUS (AE_OK); 5957851SDana.Myers@Sun.COM } 5967851SDana.Myers@Sun.COM 5977851SDana.Myers@Sun.COM ACPI_EXPORT_SYMBOL (AcpiGetSystemInfo) 5987851SDana.Myers@Sun.COM 5997851SDana.Myers@Sun.COM 6007851SDana.Myers@Sun.COM /******************************************************************************* 6017851SDana.Myers@Sun.COM * 6027851SDana.Myers@Sun.COM * FUNCTION: AcpiGetStatistics 6037851SDana.Myers@Sun.COM * 6047851SDana.Myers@Sun.COM * PARAMETERS: Stats - Where the statistics are returned 6057851SDana.Myers@Sun.COM * 6067851SDana.Myers@Sun.COM * RETURN: Status - the status of the call 6077851SDana.Myers@Sun.COM * 6087851SDana.Myers@Sun.COM * DESCRIPTION: Get the contents of the various system counters 6097851SDana.Myers@Sun.COM * 6107851SDana.Myers@Sun.COM ******************************************************************************/ 6113446Smrj 6127851SDana.Myers@Sun.COM ACPI_STATUS 6137851SDana.Myers@Sun.COM AcpiGetStatistics ( 6147851SDana.Myers@Sun.COM ACPI_STATISTICS *Stats) 6157851SDana.Myers@Sun.COM { 6167851SDana.Myers@Sun.COM ACPI_FUNCTION_TRACE (AcpiGetStatistics); 6177851SDana.Myers@Sun.COM 6187851SDana.Myers@Sun.COM 6197851SDana.Myers@Sun.COM /* Parameter validation */ 6207851SDana.Myers@Sun.COM 6217851SDana.Myers@Sun.COM if (!Stats) 6223446Smrj { 6237851SDana.Myers@Sun.COM return_ACPI_STATUS (AE_BAD_PARAMETER); 6243446Smrj } 6253446Smrj 6267851SDana.Myers@Sun.COM /* Various interrupt-based event counters */ 6277851SDana.Myers@Sun.COM 6287851SDana.Myers@Sun.COM Stats->SciCount = AcpiSciCount; 6297851SDana.Myers@Sun.COM Stats->GpeCount = AcpiGpeCount; 6307851SDana.Myers@Sun.COM 6317851SDana.Myers@Sun.COM ACPI_MEMCPY (Stats->FixedEventCount, AcpiFixedEventCount, 6327851SDana.Myers@Sun.COM sizeof (AcpiFixedEventCount)); 6337851SDana.Myers@Sun.COM 6347851SDana.Myers@Sun.COM 6357851SDana.Myers@Sun.COM /* Other counters */ 6367851SDana.Myers@Sun.COM 6377851SDana.Myers@Sun.COM Stats->MethodCount = AcpiMethodCount; 6387851SDana.Myers@Sun.COM 6393446Smrj return_ACPI_STATUS (AE_OK); 6403446Smrj } 6413446Smrj 6427851SDana.Myers@Sun.COM ACPI_EXPORT_SYMBOL (AcpiGetStatistics) 6433446Smrj 6443446Smrj 6453446Smrj /***************************************************************************** 6463446Smrj * 6473446Smrj * FUNCTION: AcpiInstallInitializationHandler 6483446Smrj * 6493446Smrj * PARAMETERS: Handler - Callback procedure 6503446Smrj * Function - Not (currently) used, see below 6513446Smrj * 6523446Smrj * RETURN: Status 6533446Smrj * 6543446Smrj * DESCRIPTION: Install an initialization handler 6553446Smrj * 6563446Smrj * TBD: When a second function is added, must save the Function also. 6573446Smrj * 6583446Smrj ****************************************************************************/ 6593446Smrj 6603446Smrj ACPI_STATUS 6613446Smrj AcpiInstallInitializationHandler ( 6623446Smrj ACPI_INIT_HANDLER Handler, 6633446Smrj UINT32 Function) 6643446Smrj { 6653446Smrj 6663446Smrj if (!Handler) 6673446Smrj { 6683446Smrj return (AE_BAD_PARAMETER); 6693446Smrj } 6703446Smrj 6713446Smrj if (AcpiGbl_InitHandler) 6723446Smrj { 6733446Smrj return (AE_ALREADY_EXISTS); 6743446Smrj } 6753446Smrj 6763446Smrj AcpiGbl_InitHandler = Handler; 6773446Smrj return AE_OK; 6783446Smrj } 6793446Smrj 6803446Smrj ACPI_EXPORT_SYMBOL (AcpiInstallInitializationHandler) 6813446Smrj 6823446Smrj 6833446Smrj /***************************************************************************** 6843446Smrj * 6853446Smrj * FUNCTION: AcpiPurgeCachedObjects 6863446Smrj * 6873446Smrj * PARAMETERS: None 6883446Smrj * 6893446Smrj * RETURN: Status 6903446Smrj * 6913446Smrj * DESCRIPTION: Empty all caches (delete the cached objects) 6923446Smrj * 6933446Smrj ****************************************************************************/ 6943446Smrj 6953446Smrj ACPI_STATUS 6963446Smrj AcpiPurgeCachedObjects ( 6973446Smrj void) 6983446Smrj { 6993446Smrj ACPI_FUNCTION_TRACE (AcpiPurgeCachedObjects); 7003446Smrj 7013446Smrj (void) AcpiOsPurgeCache (AcpiGbl_StateCache); 7023446Smrj (void) AcpiOsPurgeCache (AcpiGbl_OperandCache); 7033446Smrj (void) AcpiOsPurgeCache (AcpiGbl_PsNodeCache); 7043446Smrj (void) AcpiOsPurgeCache (AcpiGbl_PsNodeExtCache); 7053446Smrj return_ACPI_STATUS (AE_OK); 7063446Smrj } 7073446Smrj 7083446Smrj ACPI_EXPORT_SYMBOL (AcpiPurgeCachedObjects) 7097851SDana.Myers@Sun.COM 710*9980SDana.Myers@Sun.COM #endif /* ACPI_ASL_COMPILER */ 711*9980SDana.Myers@Sun.COM 712