13446Smrj /****************************************************************************** 23446Smrj * 33446Smrj * Module Name: utxface - External interfaces for "global" ACPI functions 4*7851SDana.Myers@Sun.COM * $Revision: 1.128 $ 53446Smrj * 63446Smrj *****************************************************************************/ 73446Smrj 83446Smrj /****************************************************************************** 93446Smrj * 103446Smrj * 1. Copyright Notice 113446Smrj * 12*7851SDana.Myers@Sun.COM * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. 133446Smrj * All rights reserved. 143446Smrj * 153446Smrj * 2. License 163446Smrj * 173446Smrj * 2.1. This is your license from Intel Corp. under its intellectual property 183446Smrj * rights. You may have additional license terms from the party that provided 193446Smrj * you this software, covering your right to use that party's intellectual 203446Smrj * property rights. 213446Smrj * 223446Smrj * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 233446Smrj * copy of the source code appearing in this file ("Covered Code") an 243446Smrj * irrevocable, perpetual, worldwide license under Intel's copyrights in the 253446Smrj * base code distributed originally by Intel ("Original Intel Code") to copy, 263446Smrj * make derivatives, distribute, use and display any portion of the Covered 273446Smrj * Code in any form, with the right to sublicense such rights; and 283446Smrj * 293446Smrj * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 303446Smrj * license (with the right to sublicense), under only those claims of Intel 313446Smrj * patents that are infringed by the Original Intel Code, to make, use, sell, 323446Smrj * offer to sell, and import the Covered Code and derivative works thereof 333446Smrj * solely to the minimum extent necessary to exercise the above copyright 343446Smrj * license, and in no event shall the patent license extend to any additions 353446Smrj * to or modifications of the Original Intel Code. No other license or right 363446Smrj * is granted directly or by implication, estoppel or otherwise; 373446Smrj * 383446Smrj * The above copyright and patent license is granted only if the following 393446Smrj * conditions are met: 403446Smrj * 413446Smrj * 3. Conditions 423446Smrj * 433446Smrj * 3.1. Redistribution of Source with Rights to Further Distribute Source. 443446Smrj * Redistribution of source code of any substantial portion of the Covered 453446Smrj * Code or modification with rights to further distribute source must include 463446Smrj * the above Copyright Notice, the above License, this list of Conditions, 473446Smrj * and the following Disclaimer and Export Compliance provision. In addition, 483446Smrj * Licensee must cause all Covered Code to which Licensee contributes to 493446Smrj * contain a file documenting the changes Licensee made to create that Covered 503446Smrj * Code and the date of any change. Licensee must include in that file the 513446Smrj * documentation of any changes made by any predecessor Licensee. Licensee 523446Smrj * must include a prominent statement that the modification is derived, 533446Smrj * directly or indirectly, from Original Intel Code. 543446Smrj * 553446Smrj * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 563446Smrj * Redistribution of source code of any substantial portion of the Covered 573446Smrj * Code or modification without rights to further distribute source must 583446Smrj * include the following Disclaimer and Export Compliance provision in the 593446Smrj * documentation and/or other materials provided with distribution. In 603446Smrj * addition, Licensee may not authorize further sublicense of source of any 613446Smrj * portion of the Covered Code, and must include terms to the effect that the 623446Smrj * license from Licensee to its licensee is limited to the intellectual 633446Smrj * property embodied in the software Licensee provides to its licensee, and 643446Smrj * not to intellectual property embodied in modifications its licensee may 653446Smrj * make. 663446Smrj * 673446Smrj * 3.3. Redistribution of Executable. Redistribution in executable form of any 683446Smrj * substantial portion of the Covered Code or modification must reproduce the 693446Smrj * above Copyright Notice, and the following Disclaimer and Export Compliance 703446Smrj * provision in the documentation and/or other materials provided with the 713446Smrj * distribution. 723446Smrj * 733446Smrj * 3.4. Intel retains all right, title, and interest in and to the Original 743446Smrj * Intel Code. 753446Smrj * 763446Smrj * 3.5. Neither the name Intel nor any other trademark owned or controlled by 773446Smrj * Intel shall be used in advertising or otherwise to promote the sale, use or 783446Smrj * other dealings in products derived from or relating to the Covered Code 793446Smrj * without prior written authorization from Intel. 803446Smrj * 813446Smrj * 4. Disclaimer and Export Compliance 823446Smrj * 833446Smrj * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 843446Smrj * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 853446Smrj * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 863446Smrj * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 873446Smrj * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 883446Smrj * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 893446Smrj * PARTICULAR PURPOSE. 903446Smrj * 913446Smrj * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 923446Smrj * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 933446Smrj * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 943446Smrj * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 953446Smrj * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 963446Smrj * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 973446Smrj * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 983446Smrj * LIMITED REMEDY. 993446Smrj * 1003446Smrj * 4.3. Licensee shall not export, either directly or indirectly, any of this 1013446Smrj * software or system incorporating such software without first obtaining any 1023446Smrj * required license or other approval from the U. S. Department of Commerce or 1033446Smrj * any other agency or department of the United States Government. In the 1043446Smrj * event Licensee exports any such software from the United States or 1053446Smrj * re-exports any such software from a foreign destination, Licensee shall 1063446Smrj * ensure that the distribution and export/re-export of the software is in 1073446Smrj * compliance with all laws, regulations, orders, or other restrictions of the 1083446Smrj * U.S. Export Administration Regulations. Licensee agrees that neither it nor 1093446Smrj * any of its subsidiaries will export/re-export any technical data, process, 1103446Smrj * software, or service, directly or indirectly, to any country for which the 1113446Smrj * United States government or any agency thereof requires an export license, 1123446Smrj * other governmental approval, or letter of assurance, without first obtaining 1133446Smrj * such license, approval or letter. 1143446Smrj * 1153446Smrj *****************************************************************************/ 1163446Smrj 1173446Smrj 1183446Smrj #define __UTXFACE_C__ 1193446Smrj 1203446Smrj #include "acpi.h" 1213446Smrj #include "acevents.h" 1223446Smrj #include "acnamesp.h" 1233446Smrj #include "acdebug.h" 1243446Smrj 1253446Smrj #define _COMPONENT ACPI_UTILITIES 1263446Smrj ACPI_MODULE_NAME ("utxface") 1273446Smrj 1283446Smrj 129*7851SDana.Myers@Sun.COM #ifndef ACPI_ASL_COMPILER 130*7851SDana.Myers@Sun.COM 1313446Smrj /******************************************************************************* 1323446Smrj * 1333446Smrj * FUNCTION: AcpiInitializeSubsystem 1343446Smrj * 1353446Smrj * PARAMETERS: None 1363446Smrj * 1373446Smrj * RETURN: Status 1383446Smrj * 1393446Smrj * DESCRIPTION: Initializes all global variables. This is the first function 1403446Smrj * called, so any early initialization belongs here. 1413446Smrj * 1423446Smrj ******************************************************************************/ 1433446Smrj 1443446Smrj ACPI_STATUS 1453446Smrj AcpiInitializeSubsystem ( 1463446Smrj void) 1473446Smrj { 1483446Smrj ACPI_STATUS Status; 1493446Smrj 1503446Smrj 1513446Smrj ACPI_FUNCTION_TRACE (AcpiInitializeSubsystem); 1523446Smrj 1533446Smrj 154*7851SDana.Myers@Sun.COM AcpiGbl_StartupFlags = ACPI_SUBSYSTEM_INITIALIZE; 1553446Smrj ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ()); 1563446Smrj 1573446Smrj /* Initialize the OS-Dependent layer */ 1583446Smrj 1593446Smrj Status = AcpiOsInitialize (); 1603446Smrj if (ACPI_FAILURE (Status)) 1613446Smrj { 1623446Smrj ACPI_EXCEPTION ((AE_INFO, Status, "During OSL initialization")); 1633446Smrj return_ACPI_STATUS (Status); 1643446Smrj } 1653446Smrj 1663446Smrj /* Initialize all globals used by the subsystem */ 1673446Smrj 168*7851SDana.Myers@Sun.COM Status = AcpiUtInitGlobals (); 169*7851SDana.Myers@Sun.COM if (ACPI_FAILURE (Status)) 170*7851SDana.Myers@Sun.COM { 171*7851SDana.Myers@Sun.COM ACPI_EXCEPTION ((AE_INFO, Status, "During initialization of globals")); 172*7851SDana.Myers@Sun.COM return_ACPI_STATUS (Status); 173*7851SDana.Myers@Sun.COM } 1743446Smrj 1753446Smrj /* Create the default mutex objects */ 1763446Smrj 1773446Smrj Status = AcpiUtMutexInitialize (); 1783446Smrj if (ACPI_FAILURE (Status)) 1793446Smrj { 1803446Smrj ACPI_EXCEPTION ((AE_INFO, Status, "During Global Mutex creation")); 1813446Smrj return_ACPI_STATUS (Status); 1823446Smrj } 1833446Smrj 1843446Smrj /* 1853446Smrj * Initialize the namespace manager and 1863446Smrj * the root of the namespace tree 1873446Smrj */ 1883446Smrj Status = AcpiNsRootInitialize (); 1893446Smrj if (ACPI_FAILURE (Status)) 1903446Smrj { 1913446Smrj ACPI_EXCEPTION ((AE_INFO, Status, "During Namespace initialization")); 1923446Smrj return_ACPI_STATUS (Status); 1933446Smrj } 1943446Smrj 1953446Smrj /* If configured, initialize the AML debugger */ 1963446Smrj 1973446Smrj ACPI_DEBUGGER_EXEC (Status = AcpiDbInitialize ()); 1983446Smrj return_ACPI_STATUS (Status); 1993446Smrj } 2003446Smrj 2013446Smrj ACPI_EXPORT_SYMBOL (AcpiInitializeSubsystem) 2023446Smrj 2033446Smrj 2043446Smrj /******************************************************************************* 2053446Smrj * 2063446Smrj * FUNCTION: AcpiEnableSubsystem 2073446Smrj * 2083446Smrj * PARAMETERS: Flags - Init/enable Options 2093446Smrj * 2103446Smrj * RETURN: Status 2113446Smrj * 2123446Smrj * DESCRIPTION: Completes the subsystem initialization including hardware. 2133446Smrj * Puts system into ACPI mode if it isn't already. 2143446Smrj * 2153446Smrj ******************************************************************************/ 2163446Smrj 2173446Smrj ACPI_STATUS 2183446Smrj AcpiEnableSubsystem ( 2193446Smrj UINT32 Flags) 2203446Smrj { 2213446Smrj ACPI_STATUS Status = AE_OK; 2223446Smrj 2233446Smrj 2243446Smrj ACPI_FUNCTION_TRACE (AcpiEnableSubsystem); 2253446Smrj 2263446Smrj 2273446Smrj /* Enable ACPI mode */ 2283446Smrj 2293446Smrj if (!(Flags & ACPI_NO_ACPI_ENABLE)) 2303446Smrj { 2313446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); 2323446Smrj 2333446Smrj AcpiGbl_OriginalMode = AcpiHwGetMode(); 2343446Smrj 2353446Smrj Status = AcpiEnable (); 2363446Smrj if (ACPI_FAILURE (Status)) 2373446Smrj { 2383446Smrj ACPI_WARNING ((AE_INFO, "AcpiEnable failed")); 2393446Smrj return_ACPI_STATUS (Status); 2403446Smrj } 2413446Smrj } 2423446Smrj 2433446Smrj /* 2443446Smrj * Install the default OpRegion handlers. These are installed unless 2453446Smrj * other handlers have already been installed via the 2463446Smrj * InstallAddressSpaceHandler interface. 2473446Smrj */ 2483446Smrj if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) 2493446Smrj { 2503446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 2513446Smrj "[Init] Installing default address space handlers\n")); 2523446Smrj 2533446Smrj Status = AcpiEvInstallRegionHandlers (); 2543446Smrj if (ACPI_FAILURE (Status)) 2553446Smrj { 2563446Smrj return_ACPI_STATUS (Status); 2573446Smrj } 2583446Smrj } 2593446Smrj 2603446Smrj /* 2613446Smrj * Initialize ACPI Event handling (Fixed and General Purpose) 2623446Smrj * 2633446Smrj * Note1: We must have the hardware and events initialized before we can 2643446Smrj * execute any control methods safely. Any control method can require 2653446Smrj * ACPI hardware support, so the hardware must be fully initialized before 2663446Smrj * any method execution! 2673446Smrj * 2683446Smrj * Note2: Fixed events are initialized and enabled here. GPEs are 2693446Smrj * initialized, but cannot be enabled until after the hardware is 270*7851SDana.Myers@Sun.COM * completely initialized (SCI and GlobalLock activated) and the various 271*7851SDana.Myers@Sun.COM * initialization control methods are run (_REG, _STA, _INI) on the 272*7851SDana.Myers@Sun.COM * entire namespace. 2733446Smrj */ 2743446Smrj if (!(Flags & ACPI_NO_EVENT_INIT)) 2753446Smrj { 2763446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 2773446Smrj "[Init] Initializing ACPI events\n")); 2783446Smrj 2793446Smrj Status = AcpiEvInitializeEvents (); 2803446Smrj if (ACPI_FAILURE (Status)) 2813446Smrj { 2823446Smrj return_ACPI_STATUS (Status); 2833446Smrj } 2843446Smrj } 2853446Smrj 2863446Smrj /* 2873446Smrj * Install the SCI handler and Global Lock handler. This completes the 2883446Smrj * hardware initialization. 2893446Smrj */ 2903446Smrj if (!(Flags & ACPI_NO_HANDLER_INIT)) 2913446Smrj { 2923446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 2933446Smrj "[Init] Installing SCI/GL handlers\n")); 2943446Smrj 2953446Smrj Status = AcpiEvInstallXruptHandlers (); 2963446Smrj if (ACPI_FAILURE (Status)) 2973446Smrj { 2983446Smrj return_ACPI_STATUS (Status); 2993446Smrj } 3003446Smrj } 3013446Smrj 3023446Smrj return_ACPI_STATUS (Status); 3033446Smrj } 3043446Smrj 3053446Smrj ACPI_EXPORT_SYMBOL (AcpiEnableSubsystem) 3063446Smrj 3073446Smrj 3083446Smrj /******************************************************************************* 3093446Smrj * 3103446Smrj * FUNCTION: AcpiInitializeObjects 3113446Smrj * 3123446Smrj * PARAMETERS: Flags - Init/enable Options 3133446Smrj * 3143446Smrj * RETURN: Status 3153446Smrj * 3163446Smrj * DESCRIPTION: Completes namespace initialization by initializing device 3173446Smrj * objects and executing AML code for Regions, buffers, etc. 3183446Smrj * 3193446Smrj ******************************************************************************/ 3203446Smrj 3213446Smrj ACPI_STATUS 3223446Smrj AcpiInitializeObjects ( 3233446Smrj UINT32 Flags) 3243446Smrj { 3253446Smrj ACPI_STATUS Status = AE_OK; 3263446Smrj 3273446Smrj 3283446Smrj ACPI_FUNCTION_TRACE (AcpiInitializeObjects); 3293446Smrj 3303446Smrj 3313446Smrj /* 3323446Smrj * Run all _REG methods 3333446Smrj * 3343446Smrj * Note: Any objects accessed by the _REG methods will be automatically 3353446Smrj * initialized, even if they contain executable AML (see the call to 3363446Smrj * AcpiNsInitializeObjects below). 3373446Smrj */ 3383446Smrj if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) 3393446Smrj { 3403446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 3413446Smrj "[Init] Executing _REG OpRegion methods\n")); 3423446Smrj 3433446Smrj Status = AcpiEvInitializeOpRegions (); 3443446Smrj if (ACPI_FAILURE (Status)) 3453446Smrj { 3463446Smrj return_ACPI_STATUS (Status); 3473446Smrj } 3483446Smrj } 3493446Smrj 3503446Smrj /* 3513446Smrj * Initialize the objects that remain uninitialized. This runs the 3523446Smrj * executable AML that may be part of the declaration of these objects: 3533446Smrj * OperationRegions, BufferFields, Buffers, and Packages. 3543446Smrj */ 3553446Smrj if (!(Flags & ACPI_NO_OBJECT_INIT)) 3563446Smrj { 3573446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 3583446Smrj "[Init] Completing Initialization of ACPI Objects\n")); 3593446Smrj 3603446Smrj Status = AcpiNsInitializeObjects (); 3613446Smrj if (ACPI_FAILURE (Status)) 3623446Smrj { 3633446Smrj return_ACPI_STATUS (Status); 3643446Smrj } 3653446Smrj } 3663446Smrj 3673446Smrj /* 3683446Smrj * Initialize all device objects in the namespace. This runs the device 3693446Smrj * _STA and _INI methods. 3703446Smrj */ 3713446Smrj if (!(Flags & ACPI_NO_DEVICE_INIT)) 3723446Smrj { 3733446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 3743446Smrj "[Init] Initializing ACPI Devices\n")); 3753446Smrj 3763446Smrj Status = AcpiNsInitializeDevices (); 3773446Smrj if (ACPI_FAILURE (Status)) 3783446Smrj { 3793446Smrj return_ACPI_STATUS (Status); 3803446Smrj } 3813446Smrj } 3823446Smrj 3833446Smrj /* 384*7851SDana.Myers@Sun.COM * Initialize the GPE blocks defined in the FADT (GPE block 0 and 1). 385*7851SDana.Myers@Sun.COM * The runtime GPEs are enabled here. 386*7851SDana.Myers@Sun.COM * 387*7851SDana.Myers@Sun.COM * This is where the _PRW methods are executed for the GPEs. These 388*7851SDana.Myers@Sun.COM * methods can only be executed after the SCI and Global Lock handlers are 389*7851SDana.Myers@Sun.COM * installed and initialized. 390*7851SDana.Myers@Sun.COM * 391*7851SDana.Myers@Sun.COM * GPEs can only be enabled after the _REG, _STA, and _INI methods have 392*7851SDana.Myers@Sun.COM * been run. This ensures that all Operation Regions and all Devices have 393*7851SDana.Myers@Sun.COM * been initialized and are ready. 394*7851SDana.Myers@Sun.COM */ 395*7851SDana.Myers@Sun.COM if (!(Flags & ACPI_NO_EVENT_INIT)) 396*7851SDana.Myers@Sun.COM { 397*7851SDana.Myers@Sun.COM Status = AcpiEvInstallFadtGpes (); 398*7851SDana.Myers@Sun.COM if (ACPI_FAILURE (Status)) 399*7851SDana.Myers@Sun.COM { 400*7851SDana.Myers@Sun.COM return (Status); 401*7851SDana.Myers@Sun.COM } 402*7851SDana.Myers@Sun.COM } 403*7851SDana.Myers@Sun.COM 404*7851SDana.Myers@Sun.COM /* 4053446Smrj * Empty the caches (delete the cached objects) on the assumption that 4063446Smrj * the table load filled them up more than they will be at runtime -- 4073446Smrj * thus wasting non-paged memory. 4083446Smrj */ 4093446Smrj Status = AcpiPurgeCachedObjects (); 4103446Smrj 4113446Smrj AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK; 4123446Smrj return_ACPI_STATUS (Status); 4133446Smrj } 4143446Smrj 4153446Smrj ACPI_EXPORT_SYMBOL (AcpiInitializeObjects) 4163446Smrj 4173446Smrj 418*7851SDana.Myers@Sun.COM #endif 419*7851SDana.Myers@Sun.COM 4203446Smrj /******************************************************************************* 4213446Smrj * 4223446Smrj * FUNCTION: AcpiTerminate 4233446Smrj * 4243446Smrj * PARAMETERS: None 4253446Smrj * 4263446Smrj * RETURN: Status 4273446Smrj * 4283446Smrj * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. 4293446Smrj * 4303446Smrj ******************************************************************************/ 4313446Smrj 4323446Smrj ACPI_STATUS 4333446Smrj AcpiTerminate ( 4343446Smrj void) 4353446Smrj { 4363446Smrj ACPI_STATUS Status; 4373446Smrj 4383446Smrj 4393446Smrj ACPI_FUNCTION_TRACE (AcpiTerminate); 4403446Smrj 4413446Smrj 4423446Smrj /* Terminate the AML Debugger if present */ 4433446Smrj 4443446Smrj ACPI_DEBUGGER_EXEC(AcpiGbl_DbTerminateThreads = TRUE); 4453446Smrj 4463446Smrj /* Shutdown and free all resources */ 4473446Smrj 4483446Smrj AcpiUtSubsystemShutdown (); 4493446Smrj 4503446Smrj 4513446Smrj /* Free the mutex objects */ 4523446Smrj 4533446Smrj AcpiUtMutexTerminate (); 4543446Smrj 4553446Smrj 4563446Smrj #ifdef ACPI_DEBUGGER 4573446Smrj 4583446Smrj /* Shut down the debugger */ 4593446Smrj 4603446Smrj AcpiDbTerminate (); 4613446Smrj #endif 4623446Smrj 4633446Smrj /* Now we can shutdown the OS-dependent layer */ 4643446Smrj 4653446Smrj Status = AcpiOsTerminate (); 4663446Smrj return_ACPI_STATUS (Status); 4673446Smrj } 4683446Smrj 4693446Smrj ACPI_EXPORT_SYMBOL (AcpiTerminate) 4703446Smrj 471*7851SDana.Myers@Sun.COM #ifndef ACPI_ASL_COMPILER 4723446Smrj 4733446Smrj /******************************************************************************* 4743446Smrj * 4753446Smrj * FUNCTION: AcpiSubsystemStatus 4763446Smrj * 4773446Smrj * PARAMETERS: None 4783446Smrj * 4793446Smrj * RETURN: Status of the ACPI subsystem 4803446Smrj * 4813446Smrj * DESCRIPTION: Other drivers that use the ACPI subsystem should call this 4823446Smrj * before making any other calls, to ensure the subsystem 4833446Smrj * initialized successfully. 4843446Smrj * 4853446Smrj ******************************************************************************/ 4863446Smrj 4873446Smrj ACPI_STATUS 4883446Smrj AcpiSubsystemStatus ( 4893446Smrj void) 4903446Smrj { 4913446Smrj 4923446Smrj if (AcpiGbl_StartupFlags & ACPI_INITIALIZED_OK) 4933446Smrj { 4943446Smrj return (AE_OK); 4953446Smrj } 4963446Smrj else 4973446Smrj { 4983446Smrj return (AE_ERROR); 4993446Smrj } 5003446Smrj } 5013446Smrj 5023446Smrj ACPI_EXPORT_SYMBOL (AcpiSubsystemStatus) 5033446Smrj 5043446Smrj 5053446Smrj /******************************************************************************* 5063446Smrj * 5073446Smrj * FUNCTION: AcpiGetSystemInfo 5083446Smrj * 5093446Smrj * PARAMETERS: OutBuffer - A buffer to receive the resources for the 5103446Smrj * device 5113446Smrj * 5123446Smrj * RETURN: Status - the status of the call 5133446Smrj * 5143446Smrj * DESCRIPTION: This function is called to get information about the current 5153446Smrj * state of the ACPI subsystem. It will return system information 5163446Smrj * in the OutBuffer. 5173446Smrj * 5183446Smrj * If the function fails an appropriate status will be returned 5193446Smrj * and the value of OutBuffer is undefined. 5203446Smrj * 5213446Smrj ******************************************************************************/ 5223446Smrj 5233446Smrj ACPI_STATUS 5243446Smrj AcpiGetSystemInfo ( 5253446Smrj ACPI_BUFFER *OutBuffer) 5263446Smrj { 5273446Smrj ACPI_SYSTEM_INFO *InfoPtr; 5283446Smrj ACPI_STATUS Status; 5293446Smrj 5303446Smrj 5313446Smrj ACPI_FUNCTION_TRACE (AcpiGetSystemInfo); 5323446Smrj 5333446Smrj 5343446Smrj /* Parameter validation */ 5353446Smrj 5363446Smrj Status = AcpiUtValidateBuffer (OutBuffer); 5373446Smrj if (ACPI_FAILURE (Status)) 5383446Smrj { 5393446Smrj return_ACPI_STATUS (Status); 5403446Smrj } 5413446Smrj 5423446Smrj /* Validate/Allocate/Clear caller buffer */ 5433446Smrj 5443446Smrj Status = AcpiUtInitializeBuffer (OutBuffer, sizeof (ACPI_SYSTEM_INFO)); 5453446Smrj if (ACPI_FAILURE (Status)) 5463446Smrj { 5473446Smrj return_ACPI_STATUS (Status); 5483446Smrj } 5493446Smrj 5503446Smrj /* 5513446Smrj * Populate the return buffer 5523446Smrj */ 5533446Smrj InfoPtr = (ACPI_SYSTEM_INFO *) OutBuffer->Pointer; 5543446Smrj 5553446Smrj InfoPtr->AcpiCaVersion = ACPI_CA_VERSION; 5563446Smrj 5573446Smrj /* System flags (ACPI capabilities) */ 5583446Smrj 5593446Smrj InfoPtr->Flags = ACPI_SYS_MODE_ACPI; 5603446Smrj 5613446Smrj /* Timer resolution - 24 or 32 bits */ 5623446Smrj 563*7851SDana.Myers@Sun.COM if (AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) 5643446Smrj { 5653446Smrj InfoPtr->TimerResolution = 24; 5663446Smrj } 5673446Smrj else 5683446Smrj { 5693446Smrj InfoPtr->TimerResolution = 32; 5703446Smrj } 5713446Smrj 5723446Smrj /* Clear the reserved fields */ 5733446Smrj 5743446Smrj InfoPtr->Reserved1 = 0; 5753446Smrj InfoPtr->Reserved2 = 0; 5763446Smrj 5773446Smrj /* Current debug levels */ 5783446Smrj 5793446Smrj InfoPtr->DebugLayer = AcpiDbgLayer; 5803446Smrj InfoPtr->DebugLevel = AcpiDbgLevel; 5813446Smrj 582*7851SDana.Myers@Sun.COM return_ACPI_STATUS (AE_OK); 583*7851SDana.Myers@Sun.COM } 584*7851SDana.Myers@Sun.COM 585*7851SDana.Myers@Sun.COM ACPI_EXPORT_SYMBOL (AcpiGetSystemInfo) 586*7851SDana.Myers@Sun.COM 587*7851SDana.Myers@Sun.COM 588*7851SDana.Myers@Sun.COM /******************************************************************************* 589*7851SDana.Myers@Sun.COM * 590*7851SDana.Myers@Sun.COM * FUNCTION: AcpiGetStatistics 591*7851SDana.Myers@Sun.COM * 592*7851SDana.Myers@Sun.COM * PARAMETERS: Stats - Where the statistics are returned 593*7851SDana.Myers@Sun.COM * 594*7851SDana.Myers@Sun.COM * RETURN: Status - the status of the call 595*7851SDana.Myers@Sun.COM * 596*7851SDana.Myers@Sun.COM * DESCRIPTION: Get the contents of the various system counters 597*7851SDana.Myers@Sun.COM * 598*7851SDana.Myers@Sun.COM ******************************************************************************/ 5993446Smrj 600*7851SDana.Myers@Sun.COM ACPI_STATUS 601*7851SDana.Myers@Sun.COM AcpiGetStatistics ( 602*7851SDana.Myers@Sun.COM ACPI_STATISTICS *Stats) 603*7851SDana.Myers@Sun.COM { 604*7851SDana.Myers@Sun.COM ACPI_FUNCTION_TRACE (AcpiGetStatistics); 605*7851SDana.Myers@Sun.COM 606*7851SDana.Myers@Sun.COM 607*7851SDana.Myers@Sun.COM /* Parameter validation */ 608*7851SDana.Myers@Sun.COM 609*7851SDana.Myers@Sun.COM if (!Stats) 6103446Smrj { 611*7851SDana.Myers@Sun.COM return_ACPI_STATUS (AE_BAD_PARAMETER); 6123446Smrj } 6133446Smrj 614*7851SDana.Myers@Sun.COM /* Various interrupt-based event counters */ 615*7851SDana.Myers@Sun.COM 616*7851SDana.Myers@Sun.COM Stats->SciCount = AcpiSciCount; 617*7851SDana.Myers@Sun.COM Stats->GpeCount = AcpiGpeCount; 618*7851SDana.Myers@Sun.COM 619*7851SDana.Myers@Sun.COM ACPI_MEMCPY (Stats->FixedEventCount, AcpiFixedEventCount, 620*7851SDana.Myers@Sun.COM sizeof (AcpiFixedEventCount)); 621*7851SDana.Myers@Sun.COM 622*7851SDana.Myers@Sun.COM 623*7851SDana.Myers@Sun.COM /* Other counters */ 624*7851SDana.Myers@Sun.COM 625*7851SDana.Myers@Sun.COM Stats->MethodCount = AcpiMethodCount; 626*7851SDana.Myers@Sun.COM 6273446Smrj return_ACPI_STATUS (AE_OK); 6283446Smrj } 6293446Smrj 630*7851SDana.Myers@Sun.COM ACPI_EXPORT_SYMBOL (AcpiGetStatistics) 6313446Smrj 6323446Smrj 6333446Smrj /***************************************************************************** 6343446Smrj * 6353446Smrj * FUNCTION: AcpiInstallInitializationHandler 6363446Smrj * 6373446Smrj * PARAMETERS: Handler - Callback procedure 6383446Smrj * Function - Not (currently) used, see below 6393446Smrj * 6403446Smrj * RETURN: Status 6413446Smrj * 6423446Smrj * DESCRIPTION: Install an initialization handler 6433446Smrj * 6443446Smrj * TBD: When a second function is added, must save the Function also. 6453446Smrj * 6463446Smrj ****************************************************************************/ 6473446Smrj 6483446Smrj ACPI_STATUS 6493446Smrj AcpiInstallInitializationHandler ( 6503446Smrj ACPI_INIT_HANDLER Handler, 6513446Smrj UINT32 Function) 6523446Smrj { 6533446Smrj 6543446Smrj if (!Handler) 6553446Smrj { 6563446Smrj return (AE_BAD_PARAMETER); 6573446Smrj } 6583446Smrj 6593446Smrj if (AcpiGbl_InitHandler) 6603446Smrj { 6613446Smrj return (AE_ALREADY_EXISTS); 6623446Smrj } 6633446Smrj 6643446Smrj AcpiGbl_InitHandler = Handler; 6653446Smrj return AE_OK; 6663446Smrj } 6673446Smrj 6683446Smrj ACPI_EXPORT_SYMBOL (AcpiInstallInitializationHandler) 6693446Smrj 6703446Smrj 6713446Smrj /***************************************************************************** 6723446Smrj * 6733446Smrj * FUNCTION: AcpiPurgeCachedObjects 6743446Smrj * 6753446Smrj * PARAMETERS: None 6763446Smrj * 6773446Smrj * RETURN: Status 6783446Smrj * 6793446Smrj * DESCRIPTION: Empty all caches (delete the cached objects) 6803446Smrj * 6813446Smrj ****************************************************************************/ 6823446Smrj 6833446Smrj ACPI_STATUS 6843446Smrj AcpiPurgeCachedObjects ( 6853446Smrj void) 6863446Smrj { 6873446Smrj ACPI_FUNCTION_TRACE (AcpiPurgeCachedObjects); 6883446Smrj 6893446Smrj (void) AcpiOsPurgeCache (AcpiGbl_StateCache); 6903446Smrj (void) AcpiOsPurgeCache (AcpiGbl_OperandCache); 6913446Smrj (void) AcpiOsPurgeCache (AcpiGbl_PsNodeCache); 6923446Smrj (void) AcpiOsPurgeCache (AcpiGbl_PsNodeExtCache); 6933446Smrj return_ACPI_STATUS (AE_OK); 6943446Smrj } 6953446Smrj 6963446Smrj ACPI_EXPORT_SYMBOL (AcpiPurgeCachedObjects) 697*7851SDana.Myers@Sun.COM 698*7851SDana.Myers@Sun.COM #endif 699