ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

utxface.c
Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * Module Name: utxface - External interfaces for "global" ACPI functions
00004  *
00005  *****************************************************************************/
00006 
00007 /******************************************************************************
00008  *
00009  * 1. Copyright Notice
00010  *
00011  * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
00012  * All rights reserved.
00013  *
00014  * 2. License
00015  *
00016  * 2.1. This is your license from Intel Corp. under its intellectual property
00017  * rights.  You may have additional license terms from the party that provided
00018  * you this software, covering your right to use that party's intellectual
00019  * property rights.
00020  *
00021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
00022  * copy of the source code appearing in this file ("Covered Code") an
00023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
00024  * base code distributed originally by Intel ("Original Intel Code") to copy,
00025  * make derivatives, distribute, use and display any portion of the Covered
00026  * Code in any form, with the right to sublicense such rights; and
00027  *
00028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
00029  * license (with the right to sublicense), under only those claims of Intel
00030  * patents that are infringed by the Original Intel Code, to make, use, sell,
00031  * offer to sell, and import the Covered Code and derivative works thereof
00032  * solely to the minimum extent necessary to exercise the above copyright
00033  * license, and in no event shall the patent license extend to any additions
00034  * to or modifications of the Original Intel Code.  No other license or right
00035  * is granted directly or by implication, estoppel or otherwise;
00036  *
00037  * The above copyright and patent license is granted only if the following
00038  * conditions are met:
00039  *
00040  * 3. Conditions
00041  *
00042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
00043  * Redistribution of source code of any substantial portion of the Covered
00044  * Code or modification with rights to further distribute source must include
00045  * the above Copyright Notice, the above License, this list of Conditions,
00046  * and the following Disclaimer and Export Compliance provision.  In addition,
00047  * Licensee must cause all Covered Code to which Licensee contributes to
00048  * contain a file documenting the changes Licensee made to create that Covered
00049  * Code and the date of any change.  Licensee must include in that file the
00050  * documentation of any changes made by any predecessor Licensee.  Licensee
00051  * must include a prominent statement that the modification is derived,
00052  * directly or indirectly, from Original Intel Code.
00053  *
00054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
00055  * Redistribution of source code of any substantial portion of the Covered
00056  * Code or modification without rights to further distribute source must
00057  * include the following Disclaimer and Export Compliance provision in the
00058  * documentation and/or other materials provided with distribution.  In
00059  * addition, Licensee may not authorize further sublicense of source of any
00060  * portion of the Covered Code, and must include terms to the effect that the
00061  * license from Licensee to its licensee is limited to the intellectual
00062  * property embodied in the software Licensee provides to its licensee, and
00063  * not to intellectual property embodied in modifications its licensee may
00064  * make.
00065  *
00066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
00067  * substantial portion of the Covered Code or modification must reproduce the
00068  * above Copyright Notice, and the following Disclaimer and Export Compliance
00069  * provision in the documentation and/or other materials provided with the
00070  * distribution.
00071  *
00072  * 3.4. Intel retains all right, title, and interest in and to the Original
00073  * Intel Code.
00074  *
00075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
00076  * Intel shall be used in advertising or otherwise to promote the sale, use or
00077  * other dealings in products derived from or relating to the Covered Code
00078  * without prior written authorization from Intel.
00079  *
00080  * 4. Disclaimer and Export Compliance
00081  *
00082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
00083  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
00084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
00085  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
00086  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
00087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
00088  * PARTICULAR PURPOSE.
00089  *
00090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
00091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
00092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
00093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
00094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
00095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
00096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
00097  * LIMITED REMEDY.
00098  *
00099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
00100  * software or system incorporating such software without first obtaining any
00101  * required license or other approval from the U. S. Department of Commerce or
00102  * any other agency or department of the United States Government.  In the
00103  * event Licensee exports any such software from the United States or
00104  * re-exports any such software from a foreign destination, Licensee shall
00105  * ensure that the distribution and export/re-export of the software is in
00106  * compliance with all laws, regulations, orders, or other restrictions of the
00107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
00108  * any of its subsidiaries will export/re-export any technical data, process,
00109  * software, or service, directly or indirectly, to any country for which the
00110  * United States government or any agency thereof requires an export license,
00111  * other governmental approval, or letter of assurance, without first obtaining
00112  * such license, approval or letter.
00113  *
00114  *****************************************************************************/
00115 
00116 
00117 #define __UTXFACE_C__
00118 
00119 #include "acpi.h"
00120 #include "accommon.h"
00121 #include "acevents.h"
00122 #include "acnamesp.h"
00123 #include "acdebug.h"
00124 #include "actables.h"
00125 
00126 #define _COMPONENT          ACPI_UTILITIES
00127         ACPI_MODULE_NAME    ("utxface")
00128 
00129 
00130 #ifndef ACPI_ASL_COMPILER
00131 
00132 /*******************************************************************************
00133  *
00134  * FUNCTION:    AcpiInitializeSubsystem
00135  *
00136  * PARAMETERS:  None
00137  *
00138  * RETURN:      Status
00139  *
00140  * DESCRIPTION: Initializes all global variables.  This is the first function
00141  *              called, so any early initialization belongs here.
00142  *
00143  ******************************************************************************/
00144 
00145 ACPI_STATUS
00146 AcpiInitializeSubsystem (
00147     void)
00148 {
00149     ACPI_STATUS             Status;
00150 
00151 
00152     ACPI_FUNCTION_TRACE (AcpiInitializeSubsystem);
00153 
00154 
00155     AcpiGbl_StartupFlags = ACPI_SUBSYSTEM_INITIALIZE;
00156     ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ());
00157 
00158     /* Initialize the OS-Dependent layer */
00159 
00160     Status = AcpiOsInitialize ();
00161     if (ACPI_FAILURE (Status))
00162     {
00163         ACPI_EXCEPTION ((AE_INFO, Status, "During OSL initialization"));
00164         return_ACPI_STATUS (Status);
00165     }
00166 
00167     /* Initialize all globals used by the subsystem */
00168 
00169     Status = AcpiUtInitGlobals ();
00170     if (ACPI_FAILURE (Status))
00171     {
00172         ACPI_EXCEPTION ((AE_INFO, Status, "During initialization of globals"));
00173         return_ACPI_STATUS (Status);
00174     }
00175 
00176     /* Create the default mutex objects */
00177 
00178     Status = AcpiUtMutexInitialize ();
00179     if (ACPI_FAILURE (Status))
00180     {
00181         ACPI_EXCEPTION ((AE_INFO, Status, "During Global Mutex creation"));
00182         return_ACPI_STATUS (Status);
00183     }
00184 
00185     /*
00186      * Initialize the namespace manager and
00187      * the root of the namespace tree
00188      */
00189     Status = AcpiNsRootInitialize ();
00190     if (ACPI_FAILURE (Status))
00191     {
00192         ACPI_EXCEPTION ((AE_INFO, Status, "During Namespace initialization"));
00193         return_ACPI_STATUS (Status);
00194     }
00195 
00196     /* Initialize the global OSI interfaces list with the static names */
00197 
00198     Status = AcpiUtInitializeInterfaces ();
00199     if (ACPI_FAILURE (Status))
00200     {
00201         ACPI_EXCEPTION ((AE_INFO, Status, "During OSI interfaces initialization"));
00202         return_ACPI_STATUS (Status);
00203     }
00204 
00205     /* If configured, initialize the AML debugger */
00206 
00207     ACPI_DEBUGGER_EXEC (Status = AcpiDbInitialize ());
00208     return_ACPI_STATUS (Status);
00209 }
00210 
00211 ACPI_EXPORT_SYMBOL (AcpiInitializeSubsystem)
00212 
00213 
00214 /*******************************************************************************
00215  *
00216  * FUNCTION:    AcpiEnableSubsystem
00217  *
00218  * PARAMETERS:  Flags           - Init/enable Options
00219  *
00220  * RETURN:      Status
00221  *
00222  * DESCRIPTION: Completes the subsystem initialization including hardware.
00223  *              Puts system into ACPI mode if it isn't already.
00224  *
00225  ******************************************************************************/
00226 
00227 ACPI_STATUS
00228 AcpiEnableSubsystem (
00229     UINT32                  Flags)
00230 {
00231     ACPI_STATUS             Status = AE_OK;
00232 
00233 
00234     ACPI_FUNCTION_TRACE (AcpiEnableSubsystem);
00235 
00236 
00237     /* Enable ACPI mode */
00238 
00239     if (!(Flags & ACPI_NO_ACPI_ENABLE))
00240     {
00241         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n"));
00242 
00243         AcpiGbl_OriginalMode = AcpiHwGetMode();
00244 
00245         Status = AcpiEnable ();
00246         if (ACPI_FAILURE (Status))
00247         {
00248             ACPI_WARNING ((AE_INFO, "AcpiEnable failed"));
00249             return_ACPI_STATUS (Status);
00250         }
00251     }
00252 
00253     /*
00254      * Obtain a permanent mapping for the FACS. This is required for the
00255      * Global Lock and the Firmware Waking Vector
00256      */
00257     Status = AcpiTbInitializeFacs ();
00258     if (ACPI_FAILURE (Status))
00259     {
00260         ACPI_WARNING ((AE_INFO, "Could not map the FACS table"));
00261         return_ACPI_STATUS (Status);
00262     }
00263 
00264     /*
00265      * Install the default OpRegion handlers.  These are installed unless
00266      * other handlers have already been installed via the
00267      * InstallAddressSpaceHandler interface.
00268      */
00269     if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
00270     {
00271         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
00272             "[Init] Installing default address space handlers\n"));
00273 
00274         Status = AcpiEvInstallRegionHandlers ();
00275         if (ACPI_FAILURE (Status))
00276         {
00277             return_ACPI_STATUS (Status);
00278         }
00279     }
00280 
00281     /*
00282      * Initialize ACPI Event handling (Fixed and General Purpose)
00283      *
00284      * Note1: We must have the hardware and events initialized before we can
00285      * execute any control methods safely. Any control method can require
00286      * ACPI hardware support, so the hardware must be fully initialized before
00287      * any method execution!
00288      *
00289      * Note2: Fixed events are initialized and enabled here. GPEs are
00290      * initialized, but cannot be enabled until after the hardware is
00291      * completely initialized (SCI and GlobalLock activated) and the various
00292      * initialization control methods are run (_REG, _STA, _INI) on the
00293      * entire namespace.
00294      */
00295     if (!(Flags & ACPI_NO_EVENT_INIT))
00296     {
00297         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
00298             "[Init] Initializing ACPI events\n"));
00299 
00300         Status = AcpiEvInitializeEvents ();
00301         if (ACPI_FAILURE (Status))
00302         {
00303             return_ACPI_STATUS (Status);
00304         }
00305     }
00306 
00307     /*
00308      * Install the SCI handler and Global Lock handler. This completes the
00309      * hardware initialization.
00310      */
00311     if (!(Flags & ACPI_NO_HANDLER_INIT))
00312     {
00313         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
00314             "[Init] Installing SCI/GL handlers\n"));
00315 
00316         Status = AcpiEvInstallXruptHandlers ();
00317         if (ACPI_FAILURE (Status))
00318         {
00319             return_ACPI_STATUS (Status);
00320         }
00321     }
00322 
00323     return_ACPI_STATUS (Status);
00324 }
00325 
00326 ACPI_EXPORT_SYMBOL (AcpiEnableSubsystem)
00327 
00328 
00329 /*******************************************************************************
00330  *
00331  * FUNCTION:    AcpiInitializeObjects
00332  *
00333  * PARAMETERS:  Flags           - Init/enable Options
00334  *
00335  * RETURN:      Status
00336  *
00337  * DESCRIPTION: Completes namespace initialization by initializing device
00338  *              objects and executing AML code for Regions, buffers, etc.
00339  *
00340  ******************************************************************************/
00341 
00342 ACPI_STATUS
00343 AcpiInitializeObjects (
00344     UINT32                  Flags)
00345 {
00346     ACPI_STATUS             Status = AE_OK;
00347 
00348 
00349     ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
00350 
00351 
00352     /*
00353      * Run all _REG methods
00354      *
00355      * Note: Any objects accessed by the _REG methods will be automatically
00356      * initialized, even if they contain executable AML (see the call to
00357      * AcpiNsInitializeObjects below).
00358      */
00359     if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
00360     {
00361         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
00362             "[Init] Executing _REG OpRegion methods\n"));
00363 
00364         Status = AcpiEvInitializeOpRegions ();
00365         if (ACPI_FAILURE (Status))
00366         {
00367             return_ACPI_STATUS (Status);
00368         }
00369     }
00370 
00371     /*
00372      * Execute any module-level code that was detected during the table load
00373      * phase. Although illegal since ACPI 2.0, there are many machines that
00374      * contain this type of code. Each block of detected executable AML code
00375      * outside of any control method is wrapped with a temporary control
00376      * method object and placed on a global list. The methods on this list
00377      * are executed below.
00378      */
00379     AcpiNsExecModuleCodeList ();
00380 
00381     /*
00382      * Initialize the objects that remain uninitialized. This runs the
00383      * executable AML that may be part of the declaration of these objects:
00384      * OperationRegions, BufferFields, Buffers, and Packages.
00385      */
00386     if (!(Flags & ACPI_NO_OBJECT_INIT))
00387     {
00388         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
00389             "[Init] Completing Initialization of ACPI Objects\n"));
00390 
00391         Status = AcpiNsInitializeObjects ();
00392         if (ACPI_FAILURE (Status))
00393         {
00394             return_ACPI_STATUS (Status);
00395         }
00396     }
00397 
00398     /*
00399      * Initialize all device objects in the namespace. This runs the device
00400      * _STA and _INI methods.
00401      */
00402     if (!(Flags & ACPI_NO_DEVICE_INIT))
00403     {
00404         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
00405             "[Init] Initializing ACPI Devices\n"));
00406 
00407         Status = AcpiNsInitializeDevices ();
00408         if (ACPI_FAILURE (Status))
00409         {
00410             return_ACPI_STATUS (Status);
00411         }
00412     }
00413 
00414     /*
00415      * Empty the caches (delete the cached objects) on the assumption that
00416      * the table load filled them up more than they will be at runtime --
00417      * thus wasting non-paged memory.
00418      */
00419     Status = AcpiPurgeCachedObjects ();
00420 
00421     AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK;
00422     return_ACPI_STATUS (Status);
00423 }
00424 
00425 ACPI_EXPORT_SYMBOL (AcpiInitializeObjects)
00426 
00427 
00428 #endif
00429 
00430 /*******************************************************************************
00431  *
00432  * FUNCTION:    AcpiTerminate
00433  *
00434  * PARAMETERS:  None
00435  *
00436  * RETURN:      Status
00437  *
00438  * DESCRIPTION: Shutdown the ACPICA subsystem and release all resources.
00439  *
00440  ******************************************************************************/
00441 
00442 ACPI_STATUS
00443 AcpiTerminate (
00444     void)
00445 {
00446     ACPI_STATUS         Status;
00447 
00448 
00449     ACPI_FUNCTION_TRACE (AcpiTerminate);
00450 
00451 
00452     /* Just exit if subsystem is already shutdown */
00453 
00454     if (AcpiGbl_Shutdown)
00455     {
00456         ACPI_ERROR ((AE_INFO, "ACPI Subsystem is already terminated"));
00457         return_ACPI_STATUS (AE_OK);
00458     }
00459 
00460     /* Subsystem appears active, go ahead and shut it down */
00461 
00462     AcpiGbl_Shutdown = TRUE;
00463     AcpiGbl_StartupFlags = 0;
00464     ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n"));
00465 
00466     /* Terminate the AML Debugger if present */
00467 
00468     ACPI_DEBUGGER_EXEC (AcpiGbl_DbTerminateThreads = TRUE);
00469 
00470     /* Shutdown and free all resources */
00471 
00472     AcpiUtSubsystemShutdown ();
00473 
00474     /* Free the mutex objects */
00475 
00476     AcpiUtMutexTerminate ();
00477 
00478 
00479 #ifdef ACPI_DEBUGGER
00480 
00481     /* Shut down the debugger */
00482 
00483     AcpiDbTerminate ();
00484 #endif
00485 
00486     /* Now we can shutdown the OS-dependent layer */
00487 
00488     Status = AcpiOsTerminate ();
00489     return_ACPI_STATUS (Status);
00490 }
00491 
00492 ACPI_EXPORT_SYMBOL (AcpiTerminate)
00493 
00494 
00495 #ifndef ACPI_ASL_COMPILER
00496 /*******************************************************************************
00497  *
00498  * FUNCTION:    AcpiSubsystemStatus
00499  *
00500  * PARAMETERS:  None
00501  *
00502  * RETURN:      Status of the ACPI subsystem
00503  *
00504  * DESCRIPTION: Other drivers that use the ACPI subsystem should call this
00505  *              before making any other calls, to ensure the subsystem
00506  *              initialized successfully.
00507  *
00508  ******************************************************************************/
00509 
00510 ACPI_STATUS
00511 AcpiSubsystemStatus (
00512     void)
00513 {
00514 
00515     if (AcpiGbl_StartupFlags & ACPI_INITIALIZED_OK)
00516     {
00517         return (AE_OK);
00518     }
00519     else
00520     {
00521         return (AE_ERROR);
00522     }
00523 }
00524 
00525 ACPI_EXPORT_SYMBOL (AcpiSubsystemStatus)
00526 
00527 
00528 /*******************************************************************************
00529  *
00530  * FUNCTION:    AcpiGetSystemInfo
00531  *
00532  * PARAMETERS:  OutBuffer       - A buffer to receive the resources for the
00533  *                                device
00534  *
00535  * RETURN:      Status          - the status of the call
00536  *
00537  * DESCRIPTION: This function is called to get information about the current
00538  *              state of the ACPI subsystem.  It will return system information
00539  *              in the OutBuffer.
00540  *
00541  *              If the function fails an appropriate status will be returned
00542  *              and the value of OutBuffer is undefined.
00543  *
00544  ******************************************************************************/
00545 
00546 ACPI_STATUS
00547 AcpiGetSystemInfo (
00548     ACPI_BUFFER             *OutBuffer)
00549 {
00550     ACPI_SYSTEM_INFO        *InfoPtr;
00551     ACPI_STATUS             Status;
00552 
00553 
00554     ACPI_FUNCTION_TRACE (AcpiGetSystemInfo);
00555 
00556 
00557     /* Parameter validation */
00558 
00559     Status = AcpiUtValidateBuffer (OutBuffer);
00560     if (ACPI_FAILURE (Status))
00561     {
00562         return_ACPI_STATUS (Status);
00563     }
00564 
00565     /* Validate/Allocate/Clear caller buffer */
00566 
00567     Status = AcpiUtInitializeBuffer (OutBuffer, sizeof (ACPI_SYSTEM_INFO));
00568     if (ACPI_FAILURE (Status))
00569     {
00570         return_ACPI_STATUS (Status);
00571     }
00572 
00573     /*
00574      * Populate the return buffer
00575      */
00576     InfoPtr = (ACPI_SYSTEM_INFO *) OutBuffer->Pointer;
00577 
00578     InfoPtr->AcpiCaVersion = ACPI_CA_VERSION;
00579 
00580     /* System flags (ACPI capabilities) */
00581 
00582     InfoPtr->Flags = ACPI_SYS_MODE_ACPI;
00583 
00584     /* Timer resolution - 24 or 32 bits  */
00585 
00586     if (AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER)
00587     {
00588         InfoPtr->TimerResolution = 24;
00589     }
00590     else
00591     {
00592         InfoPtr->TimerResolution = 32;
00593     }
00594 
00595     /* Clear the reserved fields */
00596 
00597     InfoPtr->Reserved1 = 0;
00598     InfoPtr->Reserved2 = 0;
00599 
00600     /* Current debug levels */
00601 
00602     InfoPtr->DebugLayer = AcpiDbgLayer;
00603     InfoPtr->DebugLevel = AcpiDbgLevel;
00604 
00605     return_ACPI_STATUS (AE_OK);
00606 }
00607 
00608 ACPI_EXPORT_SYMBOL (AcpiGetSystemInfo)
00609 
00610 
00611 /*******************************************************************************
00612  *
00613  * FUNCTION:    AcpiGetStatistics
00614  *
00615  * PARAMETERS:  Stats           - Where the statistics are returned
00616  *
00617  * RETURN:      Status          - the status of the call
00618  *
00619  * DESCRIPTION: Get the contents of the various system counters
00620  *
00621  ******************************************************************************/
00622 
00623 ACPI_STATUS
00624 AcpiGetStatistics (
00625     ACPI_STATISTICS         *Stats)
00626 {
00627     ACPI_FUNCTION_TRACE (AcpiGetStatistics);
00628 
00629 
00630     /* Parameter validation */
00631 
00632     if (!Stats)
00633     {
00634         return_ACPI_STATUS (AE_BAD_PARAMETER);
00635     }
00636 
00637     /* Various interrupt-based event counters */
00638 
00639     Stats->SciCount = AcpiSciCount;
00640     Stats->GpeCount = AcpiGpeCount;
00641 
00642     ACPI_MEMCPY (Stats->FixedEventCount, AcpiFixedEventCount,
00643         sizeof (AcpiFixedEventCount));
00644 
00645 
00646     /* Other counters */
00647 
00648     Stats->MethodCount = AcpiMethodCount;
00649 
00650     return_ACPI_STATUS (AE_OK);
00651 }
00652 
00653 ACPI_EXPORT_SYMBOL (AcpiGetStatistics)
00654 
00655 
00656 /*****************************************************************************
00657  *
00658  * FUNCTION:    AcpiInstallInitializationHandler
00659  *
00660  * PARAMETERS:  Handler             - Callback procedure
00661  *              Function            - Not (currently) used, see below
00662  *
00663  * RETURN:      Status
00664  *
00665  * DESCRIPTION: Install an initialization handler
00666  *
00667  * TBD: When a second function is added, must save the Function also.
00668  *
00669  ****************************************************************************/
00670 
00671 ACPI_STATUS
00672 AcpiInstallInitializationHandler (
00673     ACPI_INIT_HANDLER       Handler,
00674     UINT32                  Function)
00675 {
00676 
00677     if (!Handler)
00678     {
00679         return (AE_BAD_PARAMETER);
00680     }
00681 
00682     if (AcpiGbl_InitHandler)
00683     {
00684         return (AE_ALREADY_EXISTS);
00685     }
00686 
00687     AcpiGbl_InitHandler = Handler;
00688     return AE_OK;
00689 }
00690 
00691 ACPI_EXPORT_SYMBOL (AcpiInstallInitializationHandler)
00692 
00693 
00694 /*****************************************************************************
00695  *
00696  * FUNCTION:    AcpiPurgeCachedObjects
00697  *
00698  * PARAMETERS:  None
00699  *
00700  * RETURN:      Status
00701  *
00702  * DESCRIPTION: Empty all caches (delete the cached objects)
00703  *
00704  ****************************************************************************/
00705 
00706 ACPI_STATUS
00707 AcpiPurgeCachedObjects (
00708     void)
00709 {
00710     ACPI_FUNCTION_TRACE (AcpiPurgeCachedObjects);
00711 
00712     (void) AcpiOsPurgeCache (AcpiGbl_StateCache);
00713     (void) AcpiOsPurgeCache (AcpiGbl_OperandCache);
00714     (void) AcpiOsPurgeCache (AcpiGbl_PsNodeCache);
00715     (void) AcpiOsPurgeCache (AcpiGbl_PsNodeExtCache);
00716     return_ACPI_STATUS (AE_OK);
00717 }
00718 
00719 ACPI_EXPORT_SYMBOL (AcpiPurgeCachedObjects)
00720 
00721 
00722 /*****************************************************************************
00723  *
00724  * FUNCTION:    AcpiInstallInterface
00725  *
00726  * PARAMETERS:  InterfaceName       - The interface to install
00727  *
00728  * RETURN:      Status
00729  *
00730  * DESCRIPTION: Install an _OSI interface to the global list
00731  *
00732  ****************************************************************************/
00733 
00734 ACPI_STATUS
00735 AcpiInstallInterface (
00736     ACPI_STRING             InterfaceName)
00737 {
00738     ACPI_STATUS             Status;
00739     ACPI_INTERFACE_INFO     *InterfaceInfo;
00740 
00741 
00742     /* Parameter validation */
00743 
00744     if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0))
00745     {
00746         return (AE_BAD_PARAMETER);
00747     }
00748 
00749     (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
00750 
00751     /* Check if the interface name is already in the global list */
00752 
00753     InterfaceInfo = AcpiUtGetInterface (InterfaceName);
00754     if (InterfaceInfo)
00755     {
00756         /*
00757          * The interface already exists in the list. This is OK if the
00758          * interface has been marked invalid -- just clear the bit.
00759          */
00760         if (InterfaceInfo->Flags & ACPI_OSI_INVALID)
00761         {
00762             InterfaceInfo->Flags &= ~ACPI_OSI_INVALID;
00763             Status = AE_OK;
00764         }
00765         else
00766         {
00767             Status = AE_ALREADY_EXISTS;
00768         }
00769     }
00770     else
00771     {
00772         /* New interface name, install into the global list */
00773 
00774         Status = AcpiUtInstallInterface (InterfaceName);
00775     }
00776 
00777     AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
00778     return (Status);
00779 }
00780 
00781 ACPI_EXPORT_SYMBOL (AcpiInstallInterface)
00782 
00783 
00784 /*****************************************************************************
00785  *
00786  * FUNCTION:    AcpiRemoveInterface
00787  *
00788  * PARAMETERS:  InterfaceName       - The interface to remove
00789  *
00790  * RETURN:      Status
00791  *
00792  * DESCRIPTION: Remove an _OSI interface from the global list
00793  *
00794  ****************************************************************************/
00795 
00796 ACPI_STATUS
00797 AcpiRemoveInterface (
00798     ACPI_STRING             InterfaceName)
00799 {
00800     ACPI_STATUS             Status;
00801 
00802 
00803     /* Parameter validation */
00804 
00805     if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0))
00806     {
00807         return (AE_BAD_PARAMETER);
00808     }
00809 
00810     (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
00811 
00812     Status = AcpiUtRemoveInterface (InterfaceName);
00813 
00814     AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
00815     return (Status);
00816 }
00817 
00818 ACPI_EXPORT_SYMBOL (AcpiRemoveInterface)
00819 
00820 
00821 /*****************************************************************************
00822  *
00823  * FUNCTION:    AcpiInstallInterfaceHandler
00824  *
00825  * PARAMETERS:  Handler             - The _OSI interface handler to install
00826  *                                    NULL means "remove existing handler"
00827  *
00828  * RETURN:      Status
00829  *
00830  * DESCRIPTION: Install a handler for the predefined _OSI ACPI method.
00831  *              invoked during execution of the internal implementation of
00832  *              _OSI. A NULL handler simply removes any existing handler.
00833  *
00834  ****************************************************************************/
00835 
00836 ACPI_STATUS
00837 AcpiInstallInterfaceHandler (
00838     ACPI_INTERFACE_HANDLER  Handler)
00839 {
00840     ACPI_STATUS             Status = AE_OK;
00841 
00842 
00843     (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
00844 
00845     if (Handler && AcpiGbl_InterfaceHandler)
00846     {
00847         Status = AE_ALREADY_EXISTS;
00848     }
00849     else
00850     {
00851         AcpiGbl_InterfaceHandler = Handler;
00852     }
00853 
00854     AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
00855     return (Status);
00856 }
00857 
00858 ACPI_EXPORT_SYMBOL (AcpiInstallInterfaceHandler)
00859 
00860 #endif /* !ACPI_ASL_COMPILER */
00861 

Generated on Sun May 27 2012 04:27:24 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.