Extraneous spaces removed

date	2000.06.13.21.21.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 16:46:42 +00:00
parent 686f08eddb
commit d710836331
3 changed files with 421 additions and 486 deletions

View File

@ -1,5 +1,5 @@
/******************************************************************************
*
*
* Module Name: evapi - External interfaces for ACPI events
*
*****************************************************************************/
@ -37,9 +37,9 @@
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial prton of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
@ -47,11 +47,11 @@
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
@ -85,7 +85,7 @@
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
@ -116,12 +116,12 @@
#define __EVAPI_C__
#include <acpi.h>
#include <hardware.h>
#include <namesp.h>
#include <events.h>
#include <amlcode.h>
#include <interp.h>
#include "acpi.h"
#include "hardware.h"
#include "namesp.h"
#include "events.h"
#include "amlcode.h"
#include "interp.h"
#define _COMPONENT EVENT_HANDLING
MODULE_NAME ("evapi");
@ -162,41 +162,41 @@ AcpiInstallFixedEventHandler (
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
CmAcquireMutex (MTX_EVENTS);
AcpiCmAcquireMutex (MTX_EVENTS);
/* Don't allow two handlers. */
if (NULL != Gbl_FixedEventHandlers[Event].Handler)
if (NULL != Acpi_GblFixedEventHandlers[Event].Handler)
{
Status = AE_EXIST;
goto Cleanup;
}
/* Install the handler before enabling the event - just in case... */
Gbl_FixedEventHandlers[Event].Handler = Handler;
Gbl_FixedEventHandlers[Event].Context = Context;
if (1 != HwRegisterIO (ACPI_WRITE, Event + TMR_EN, 1))
Acpi_GblFixedEventHandlers[Event].Handler = Handler;
Acpi_GblFixedEventHandlers[Event].Context = Context;
if (1 != AcpiHwRegisterIO (ACPI_WRITE, MTX_LOCK, Event + TMR_EN, 1))
{
DEBUG_PRINT (ACPI_WARN, ("Could not write to fixed event enable register.\n"));
/* Remove the handler */
Gbl_FixedEventHandlers[Event].Handler = NULL;
Gbl_FixedEventHandlers[Event].Context = NULL;
Acpi_GblFixedEventHandlers[Event].Handler = NULL;
Acpi_GblFixedEventHandlers[Event].Context = NULL;
Status = AE_ERROR;
goto Cleanup;
}
DEBUG_PRINT (ACPI_INFO, ("Enabled fixed event %d. Handler: %x\n", Event, Handler));
DEBUG_PRINT (ACPI_INFO, ("Enabled fixed event %d. Handler: %x\n", Event, Handler));
Cleanup:
CmReleaseMutex (MTX_EVENTS);
AcpiCmReleaseMutex (MTX_EVENTS);
return_ACPI_STATUS (Status);
}
@ -231,12 +231,12 @@ AcpiRemoveFixedEventHandler (
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
CmAcquireMutex (MTX_EVENTS);
AcpiCmAcquireMutex (MTX_EVENTS);
/* Disable the event before removing the handler - just in case... */
if (0 != HwRegisterIO (ACPI_WRITE, Event + TMR_EN, 0))
if (0 != AcpiHwRegisterIO (ACPI_WRITE, MTX_LOCK, Event + TMR_EN, 0))
{
DEBUG_PRINT (ACPI_WARN, ("Could not write to fixed event enable register.\n"));
Status = AE_ERROR;
@ -245,13 +245,13 @@ AcpiRemoveFixedEventHandler (
/* Remove the handler */
Gbl_FixedEventHandlers[Event].Handler = NULL;
Gbl_FixedEventHandlers[Event].Context = NULL;
DEBUG_PRINT (ACPI_INFO, ("Disabled fixed event %d.\n", Event));
Acpi_GblFixedEventHandlers[Event].Handler = NULL;
Acpi_GblFixedEventHandlers[Event].Context = NULL;
DEBUG_PRINT (ACPI_INFO, ("Disabled fixed event %d.\n", Event));
Cleanup:
CmReleaseMutex (MTX_EVENTS);
AcpiCmReleaseMutex (MTX_EVENTS);
return_ACPI_STATUS (Status);
}
@ -276,8 +276,8 @@ Cleanup:
ACPI_STATUS
AcpiInstallNotifyHandler (
ACPI_HANDLE Device,
UINT32 HandlerType,
NOTIFY_HANDLER Handler,
UINT32 HandlerType,
NOTIFY_HANDLER Handler,
void *Context)
{
ACPI_OBJECT_INTERNAL *ObjDesc;
@ -299,9 +299,9 @@ AcpiInstallNotifyHandler (
/* Convert and validate the device handle */
CmAcquireMutex (MTX_NAMESPACE);
AcpiCmAcquireMutex (MTX_NAMESPACE);
ObjEntry = NsConvertHandleToEntry (Device);
ObjEntry = AcpiNsConvertHandleToEntry (Device);
if (!ObjEntry)
{
Status = AE_BAD_PARAMETER;
@ -320,8 +320,8 @@ AcpiInstallNotifyHandler (
* Make sure the handler is not already installed.
*/
if (((HandlerType == ACPI_SYSTEM_NOTIFY) && Gbl_SysNotify.Handler) ||
((HandlerType == ACPI_DEVICE_NOTIFY) && Gbl_DrvNotify.Handler))
if (((HandlerType == ACPI_SYSTEM_NOTIFY) && Acpi_GblSysNotify.Handler) ||
((HandlerType == ACPI_DEVICE_NOTIFY) && Acpi_GblDrvNotify.Handler))
{
Status = AE_EXIST;
goto UnlockAndExit;
@ -329,16 +329,16 @@ AcpiInstallNotifyHandler (
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
Gbl_SysNotify.Nte = ObjEntry;
Gbl_SysNotify.Handler = Handler;
Gbl_SysNotify.Context = Context;
Acpi_GblSysNotify.Nte = ObjEntry;
Acpi_GblSysNotify.Handler = Handler;
Acpi_GblSysNotify.Context = Context;
}
else
{
Gbl_DrvNotify.Nte = ObjEntry;
Gbl_DrvNotify.Handler = Handler;
Gbl_DrvNotify.Context = Context;
Acpi_GblDrvNotify.Nte = ObjEntry;
Acpi_GblDrvNotify.Handler = Handler;
Acpi_GblDrvNotify.Context = Context;
}
@ -352,10 +352,10 @@ AcpiInstallNotifyHandler (
* These are the ONLY objects that can receive ACPI notifications
*/
if ((ObjEntry->Type != ACPI_TYPE_Device) &&
(ObjEntry->Type != ACPI_TYPE_Processor) &&
(ObjEntry->Type != ACPI_TYPE_Power) &&
(ObjEntry->Type != ACPI_TYPE_Thermal))
if ((ObjEntry->Type != ACPI_TYPE_DEVICE) &&
(ObjEntry->Type != ACPI_TYPE_PROCESSOR) &&
(ObjEntry->Type != ACPI_TYPE_POWER) &&
(ObjEntry->Type != ACPI_TYPE_THERMAL))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
@ -363,7 +363,7 @@ AcpiInstallNotifyHandler (
/* Check for an existing internal object */
ObjDesc = NsGetAttachedObject ((ACPI_HANDLE) ObjEntry);
ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) ObjEntry);
if (ObjDesc)
{
/*
@ -383,7 +383,7 @@ AcpiInstallNotifyHandler (
{
/* Create a new object */
ObjDesc = CmCreateInternalObject (ObjEntry->Type);
ObjDesc = AcpiCmCreateInternalObject (ObjEntry->Type);
if (!ObjDesc)
{
Status = AE_NO_MEMORY;
@ -392,7 +392,7 @@ AcpiInstallNotifyHandler (
/* Attach new object to the NTE */
Status = NsAttachObject (Device, ObjDesc, (UINT8) ObjEntry->Type);
Status = AcpiNsAttachObject (Device, ObjDesc, (UINT8) ObjEntry->Type);
if (ACPI_FAILURE (Status))
{
@ -401,11 +401,11 @@ AcpiInstallNotifyHandler (
}
/*
/*
* If we get here, we know that there is no handler installed
* so let's party
*/
NotifyObj = CmCreateInternalObject (INTERNAL_TYPE_Notify);
NotifyObj = AcpiCmCreateInternalObject (INTERNAL_TYPE_NOTIFY);
if (!NotifyObj)
{
Status = AE_NO_MEMORY;
@ -429,7 +429,7 @@ AcpiInstallNotifyHandler (
UnlockAndExit:
CmReleaseMutex (MTX_NAMESPACE);
AcpiCmReleaseMutex (MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
@ -452,7 +452,7 @@ UnlockAndExit:
ACPI_STATUS
AcpiRemoveNotifyHandler (
ACPI_HANDLE Device,
UINT32 HandlerType,
UINT32 HandlerType,
NOTIFY_HANDLER Handler)
{
ACPI_OBJECT_INTERNAL *NotifyObj;
@ -472,11 +472,11 @@ AcpiRemoveNotifyHandler (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
CmAcquireMutex (MTX_NAMESPACE);
AcpiCmAcquireMutex (MTX_NAMESPACE);
/* Convert and validate the device handle */
ObjEntry = NsConvertHandleToEntry (Device);
ObjEntry = AcpiNsConvertHandleToEntry (Device);
if (!ObjEntry)
{
Status = AE_BAD_PARAMETER;
@ -487,10 +487,10 @@ AcpiRemoveNotifyHandler (
* These are the ONLY objects that can receive ACPI notifications
*/
if ((ObjEntry->Type != ACPI_TYPE_Device) &&
(ObjEntry->Type != ACPI_TYPE_Processor) &&
(ObjEntry->Type != ACPI_TYPE_Power) &&
(ObjEntry->Type != ACPI_TYPE_Thermal))
if ((ObjEntry->Type != ACPI_TYPE_DEVICE) &&
(ObjEntry->Type != ACPI_TYPE_PROCESSOR) &&
(ObjEntry->Type != ACPI_TYPE_POWER) &&
(ObjEntry->Type != ACPI_TYPE_THERMAL))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
@ -498,7 +498,7 @@ AcpiRemoveNotifyHandler (
/* Check for an existing internal object */
ObjDesc = NsGetAttachedObject ((ACPI_HANDLE) ObjEntry);
ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) ObjEntry);
if (!ObjDesc)
{
Status = AE_NOT_EXIST;
@ -527,7 +527,7 @@ AcpiRemoveNotifyHandler (
goto UnlockAndExit;
}
/*
/*
* Now we can remove the handler
*/
if (HandlerType == ACPI_SYSTEM_NOTIFY)
@ -538,11 +538,11 @@ AcpiRemoveNotifyHandler (
{
ObjDesc->Device.DrvHandler = NULL;
}
CmRemoveReference (NotifyObj);
AcpiCmRemoveReference (NotifyObj);
UnlockAndExit:
CmReleaseMutex (MTX_NAMESPACE);
AcpiCmReleaseMutex (MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
@ -550,7 +550,7 @@ UnlockAndExit:
*
* FUNCTION: AcpiInstallGpeHandler
*
* PARAMETERS: GpeNumber - The GPE number. The numbering scheme is
* PARAMETERS: GpeNumber - The GPE number. The numbering scheme is
* bank 0 first, then bank 1.
* Trigger - Whether this GPE should be treated as an
* edge- or level-triggered interrupt.
@ -559,7 +559,7 @@ UnlockAndExit:
*
* RETURN: Status
*
* DESCRIPTION: Install a handler for a General Purpose Event.
* DESCRIPTION: Install a handler for a General Purpose AcpiEvent.
*
******************************************************************************/
@ -571,7 +571,7 @@ AcpiInstallGpeHandler (
void *Context)
{
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE ("AcpiInstallGpeHandler");
/* Parameter validation */
@ -583,16 +583,16 @@ AcpiInstallGpeHandler (
/* Ensure that we have a valid GPE number */
if (Gbl_GpeValid[GpeNumber] == GPE_INVALID)
if (Acpi_GblGpeValid[GpeNumber] == GPE_INVALID)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
CmAcquireMutex (MTX_EVENTS);
AcpiCmAcquireMutex (MTX_EVENTS);
/* Make sure that there isn't a handler there already */
if (Gbl_GpeInfo[GpeNumber].Handler)
if (Acpi_GblGpeInfo[GpeNumber].Handler)
{
Status = AE_EXIST;
goto Cleanup;
@ -600,17 +600,17 @@ AcpiInstallGpeHandler (
/* Install the handler */
Gbl_GpeInfo[GpeNumber].Handler = Handler;
Gbl_GpeInfo[GpeNumber].Context = Context;
Gbl_GpeInfo[GpeNumber].Type = (UINT8) Type;
Acpi_GblGpeInfo[GpeNumber].Handler = Handler;
Acpi_GblGpeInfo[GpeNumber].Context = Context;
Acpi_GblGpeInfo[GpeNumber].Type = (UINT8) Type;
/* Clear the GPE (of stale events), the enable it */
HwClearGpe (GpeNumber);
HwEnableGpe (GpeNumber);
AcpiHwClearGpe (GpeNumber);
AcpiHwEnableGpe (GpeNumber);
Cleanup:
CmReleaseMutex (MTX_EVENTS);
AcpiCmReleaseMutex (MTX_EVENTS);
return_ACPI_STATUS (Status);
}
@ -624,18 +624,18 @@ Cleanup:
*
* RETURN: Status
*
* DESCRIPTION: Remove a handler for a General Purpose Event.
* DESCRIPTION: Remove a handler for a General Purpose AcpiEvent.
*
******************************************************************************/
ACPI_STATUS
AcpiRemoveGpeHandler (
UINT32 GpeNumber,
UINT32 GpeNumber,
GPE_HANDLER Handler)
{
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE ("AcpiRemoveGpeHandler");
@ -648,33 +648,33 @@ AcpiRemoveGpeHandler (
/* Ensure that we have a valid GPE number */
if (Gbl_GpeValid[GpeNumber] == GPE_INVALID)
if (Acpi_GblGpeValid[GpeNumber] == GPE_INVALID)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Disable the GPE before removing the handler */
HwDisableGpe (GpeNumber);
AcpiHwDisableGpe (GpeNumber);
CmAcquireMutex (MTX_EVENTS);
AcpiCmAcquireMutex (MTX_EVENTS);
/* Make sure that the installed handler is the same */
if (Gbl_GpeInfo[GpeNumber].Handler != Handler)
if (Acpi_GblGpeInfo[GpeNumber].Handler != Handler)
{
HwEnableGpe (GpeNumber);
AcpiHwEnableGpe (GpeNumber);
Status = AE_BAD_PARAMETER;
goto Cleanup;
}
/* Remove the handler */
Gbl_GpeInfo[GpeNumber].Handler = NULL;
Gbl_GpeInfo[GpeNumber].Context = NULL;
Acpi_GblGpeInfo[GpeNumber].Handler = NULL;
Acpi_GblGpeInfo[GpeNumber].Context = NULL;
Cleanup:
CmReleaseMutex (MTX_EVENTS);
AcpiCmReleaseMutex (MTX_EVENTS);
return_ACPI_STATUS (Status);
}
@ -701,13 +701,13 @@ AcpiAcquireGlobalLock (
ACPI_STATUS Status;
AmlEnterInterpreter ();
AcpiAmlEnterInterpreter ();
/* TBD: add timeout param to internal interface, and perhaps INTERPRETER_LOCKED */
/* TBD: [Restructure] add timeout param to internal interface, and perhaps INTERPRETER_LOCKED */
Status = EvAcquireGlobalLock ();
AmlExitInterpreter ();
Status = AcpiEvAcquireGlobalLock ();
AcpiAmlExitInterpreter ();
*OutHandle = 0;
return Status;
@ -733,9 +733,9 @@ AcpiReleaseGlobalLock (
{
/* TBD: Validate handle */
/* TBD: [Restructure] Validate handle */
EvReleaseGlobalLock ();
AcpiEvReleaseGlobalLock ();
return AE_OK;
}

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
* $Revision: 1.67 $
* Module Name: evapievt - External Interfaces, ACPI event disable/enable
*
*****************************************************************************/
@ -9,8 +8,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
* All rights reserved.
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
@ -115,16 +114,21 @@
*****************************************************************************/
#define __EVXFEVNT_C__
#define __EVAPIEVT_C__
#include "acpi.h"
#include "acevents.h"
#include "hardware.h"
#include "namesp.h"
#include "events.h"
#include "amlcode.h"
#include "interp.h"
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evxfevnt")
#define _COMPONENT EVENT_HANDLING
MODULE_NAME ("evapievt");
/*******************************************************************************
/**************************************************************************
*
* FUNCTION: AcpiEnable
*
@ -132,50 +136,86 @@
*
* RETURN: Status
*
* DESCRIPTION: Transfers the system into ACPI mode.
* DESCRIPTION: Ensures that the system control interrupt (SCI) is properly
* configured, disables SCI event sources, installs the SCI
* handler, and transfers the system into ACPI mode.
*
******************************************************************************/
*************************************************************************/
ACPI_STATUS
AcpiEnable (void)
{
ACPI_STATUS Status = AE_OK;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("AcpiEnable");
FUNCTION_TRACE ("AcpiEnable");
/* Make sure we have the FADT*/
/* Make sure we've got ACPI tables */
if (!AcpiGbl_FADT)
if (!Acpi_GblDSDT)
{
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
DEBUG_PRINT (ACPI_WARN, ("No ACPI tables present!\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
if (AcpiHwGetMode() == ACPI_SYS_MODE_ACPI)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n"));
}
else
{
/* Transition to ACPI mode */
/* Make sure the BIOS supports ACPI mode */
Status = AcpiHwSetMode (ACPI_SYS_MODE_ACPI);
if (ACPI_FAILURE (Status))
{
ACPI_REPORT_ERROR (("Could not transition to ACPI mode.\n"));
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Transition to ACPI mode successful\n"));
if (SYS_MODE_LEGACY == AcpiHwGetModeCapabilities())
{
DEBUG_PRINT (ACPI_WARN, ("Only legacy mode supported!\n"));
return_ACPI_STATUS (AE_ERROR);
}
Acpi_GblOriginalMode = AcpiHwGetMode();
/*
* Initialize the Fixed and General Purpose AcpiEvents prior. This is
* done prior to enabling SCIs to prevent interrupts from occuring
* before handers are installed.
*/
if (ACPI_FAILURE (AcpiEvFixedEventInitialize ()))
{
DEBUG_PRINT (ACPI_FATAL, ("Unable to initialize fixed events.\n"));
return_ACPI_STATUS (AE_ERROR);
}
if (ACPI_FAILURE (AcpiEvGpeInitialize()))
{
DEBUG_PRINT (ACPI_FATAL, ("Unable to initialize general purpose events.\n"));
return_ACPI_STATUS (AE_ERROR);
}
/* Install the SCI handler */
if (ACPI_FAILURE (AcpiEvInstallSciHandler ()))
{
DEBUG_PRINT (ACPI_FATAL, ("Unable to install System Control Interrupt Handler\n"));
return_ACPI_STATUS (AE_ERROR);
}
/* Transition to ACPI mode */
if (AE_OK != AcpiHwSetMode (SYS_MODE_ACPI))
{
DEBUG_PRINT (ACPI_FATAL, ("Could not transition to ACPI mode.\n"));
return_ACPI_STATUS (AE_ERROR);
}
DEBUG_PRINT (ACPI_OK, ("Transition to ACPI mode successful\n"));
/* Install handlers for control method GPE handlers (_Lxx, _Exx) */
AcpiEvInitGpeControlMethods ();
Status = AcpiEvInitGlobalLockHandler ();
return_ACPI_STATUS (Status);
}
/*******************************************************************************
/**************************************************************************
*
* FUNCTION: AcpiDisable
*
@ -183,415 +223,318 @@ AcpiEnable (void)
*
* RETURN: Status
*
* DESCRIPTION: Transfers the system into LEGACY mode.
* DESCRIPTION: Returns the system to original ACPI/legacy mode, and
* uninstalls the SCI interrupt handler.
*
******************************************************************************/
*************************************************************************/
ACPI_STATUS
AcpiDisable (void)
{
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE ("AcpiDisable");
ACPI_FUNCTION_TRACE ("AcpiDisable");
/* Restore original mode */
if (!AcpiGbl_FADT)
if (AE_OK != AcpiHwSetMode (Acpi_GblOriginalMode))
{
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
DEBUG_PRINT (ACPI_ERROR, ("Unable to transition to original mode"));
return_ACPI_STATUS (AE_ERROR);
}
if (AcpiHwGetMode() == ACPI_SYS_MODE_LEGACY)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in legacy (non-ACPI) mode\n"));
}
else
{
/* Transition to LEGACY mode */
/* Unload the SCI interrupt handler */
Status = AcpiHwSetMode (ACPI_SYS_MODE_LEGACY);
AcpiEvRemoveSciHandler ();
AcpiEvRestoreAcpiState ();
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not exit ACPI mode to legacy mode"));
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI mode disabled\n"));
}
return_ACPI_STATUS (Status);
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
/******************************************************************************
*
* FUNCTION: AcpiEnableEvent
*
* PARAMETERS: Event - The fixed eventto be enabled
* Flags - Reserved
* PARAMETERS: Event - The fixed event or GPE to be enabled
* Type - The type of event
*
* RETURN: Status
*
* DESCRIPTION: Enable an ACPI event (fixed)
* DESCRIPTION: Enable an ACPI event (fixed and general purpose)
*
******************************************************************************/
ACPI_STATUS
AcpiEnableEvent (
UINT32 Event,
UINT32 Flags)
UINT32 Type)
{
ACPI_STATUS Status = AE_OK;
UINT32 Value;
UINT32 RegisterId;
ACPI_FUNCTION_TRACE ("AcpiEnableEvent");
FUNCTION_TRACE ("AcpiEnableEvent");
/* Decode the Fixed Event */
/* The Type must be either Fixed AcpiEvent or GPE */
if (Event > ACPI_EVENT_MAX)
switch (Type)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* Enable the requested fixed event (by writing a one to the
* enable register bit)
*/
Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
1, ACPI_MTX_LOCK);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
case EVENT_FIXED:
/* Make sure that the hardware responded */
/* Decode the Fixed AcpiEvent */
Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
&Value, ACPI_MTX_LOCK);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
if (Value != 1)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not enable %s event\n", AcpiUtGetEventName (Event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEnableGpe
*
* PARAMETERS: GpeDevice - Parent GPE Device
* GpeNumber - GPE level within the GPE block
* Flags - Just enable, or also wake enable?
* Called from ISR or not
*
* RETURN: Status
*
* DESCRIPTION: Enable an ACPI event (general purpose)
*
******************************************************************************/
ACPI_STATUS
AcpiEnableGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE ("AcpiEnableGpe");
/* Use semaphore lock if not executing at interrupt level */
if (Flags & ACPI_NOT_ISR)
{
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
switch (Event)
{
return_ACPI_STATUS (Status);
case EVENT_PMTIMER:
RegisterId = TMR_EN;
break;
case EVENT_GLOBAL:
RegisterId = GBL_EN;
break;
case EVENT_POWER_BUTTON:
RegisterId = PWRBTN_EN;
break;
case EVENT_SLEEP_BUTTON:
RegisterId = SLPBTN_EN;
break;
case EVENT_RTC:
RegisterId = RTC_EN;
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
break;
}
}
/* Ensure that we have a valid GPE number */
/* Enable the requested fixed event (by writing a one to the enable register bit) */
AcpiHwRegisterIO (ACPI_WRITE, TRUE, RegisterId, 1);
break;
case EVENT_GPE:
/* Ensure that we have a valid GPE number */
if ((Event >= NUM_GPE) ||
(Acpi_GblGpeValid[Event] == GPE_INVALID))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Enable the requested GPE number */
AcpiHwEnableGpe (Event);
break;
default:
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/* Enable the requested GPE number */
Status = AcpiHwEnableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
if (Flags & ACPI_EVENT_WAKE_ENABLE)
{
AcpiHwEnableGpeForWakeup (GpeEventInfo);
}
UnlockAndExit:
if (Flags & ACPI_NOT_ISR)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
/******************************************************************************
*
* FUNCTION: AcpiDisableEvent
*
* PARAMETERS: Event - The fixed eventto be enabled
* Flags - Reserved
* PARAMETERS: Event - The fixed event or GPE to be enabled
* Type - The type of event
*
* RETURN: Status
*
* DESCRIPTION: Disable an ACPI event (fixed)
* DESCRIPTION: Disable an ACPI event (fixed and general purpose)
*
******************************************************************************/
ACPI_STATUS
AcpiDisableEvent (
UINT32 Event,
UINT32 Flags)
UINT32 Type)
{
ACPI_STATUS Status = AE_OK;
UINT32 Value;
UINT32 RegisterId;
ACPI_FUNCTION_TRACE ("AcpiDisableEvent");
FUNCTION_TRACE ("AcpiDisableEvent");
/* Decode the Fixed Event */
/* The Type must be either Fixed AcpiEvent or GPE */
if (Event > ACPI_EVENT_MAX)
switch (Type)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* Disable the requested fixed event (by writing a zero to the
* enable register bit)
*/
Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
0, ACPI_MTX_LOCK);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
case EVENT_FIXED:
Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
&Value, ACPI_MTX_LOCK);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Decode the Fixed AcpiEvent */
if (Value != 0)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not disable %s events\n", AcpiUtGetEventName (Event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDisableGpe
*
* PARAMETERS: GpeDevice - Parent GPE Device
* GpeNumber - GPE level within the GPE block
* Flags - Just enable, or also wake enable?
* Called from ISR or not
*
* RETURN: Status
*
* DESCRIPTION: Disable an ACPI event (general purpose)
*
******************************************************************************/
ACPI_STATUS
AcpiDisableGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE ("AcpiDisableGpe");
/* Use semaphore lock if not executing at interrupt level */
if (Flags & ACPI_NOT_ISR)
{
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
switch (Event)
{
return_ACPI_STATUS (Status);
case EVENT_PMTIMER:
RegisterId = TMR_EN;
break;
case EVENT_GLOBAL:
RegisterId = GBL_EN;
break;
case EVENT_POWER_BUTTON:
RegisterId = PWRBTN_EN;
break;
case EVENT_SLEEP_BUTTON:
RegisterId = SLPBTN_EN;
break;
case EVENT_RTC:
RegisterId = RTC_EN;
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
break;
}
}
/* Ensure that we have a valid GPE number */
/* Disable the requested fixed event (by writing a zero to the enable register bit) */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
AcpiHwRegisterIO (ACPI_WRITE, TRUE, RegisterId, 0);
break;
case EVENT_GPE:
/* Ensure that we have a valid GPE number */
if ((Event >= NUM_GPE) ||
(Acpi_GblGpeValid[Event] == GPE_INVALID))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Disable the requested GPE number */
AcpiHwDisableGpe (Event);
break;
default:
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/*
* Only disable the requested GPE number for wake if specified.
* Otherwise, turn it totally off
*/
if (Flags & ACPI_EVENT_WAKE_DISABLE)
{
AcpiHwDisableGpeForWakeup (GpeEventInfo);
}
else
{
Status = AcpiHwDisableGpe (GpeEventInfo);
}
UnlockAndExit:
if (Flags & ACPI_NOT_ISR)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
/******************************************************************************
*
* FUNCTION: AcpiClearEvent
*
* PARAMETERS: Event - The fixed event to be cleared
* PARAMETERS: Event - The fixed event or GPE to be cleared
* Type - The type of event
*
* RETURN: Status
*
* DESCRIPTION: Clear an ACPI event (fixed)
* DESCRIPTION: Clear an ACPI event (fixed and general purpose)
*
******************************************************************************/
ACPI_STATUS
AcpiClearEvent (
UINT32 Event)
UINT32 Event,
UINT32 Type)
{
ACPI_STATUS Status = AE_OK;
UINT32 RegisterId;
ACPI_FUNCTION_TRACE ("AcpiClearEvent");
FUNCTION_TRACE ("AcpiClearEvent");
/* Decode the Fixed Event */
/* The Type must be either Fixed AcpiEvent or GPE */
if (Event > ACPI_EVENT_MAX)
switch (Type)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* Clear the requested fixed event (By writing a one to the
* status register bit)
*/
Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
1, ACPI_MTX_LOCK);
case EVENT_FIXED:
return_ACPI_STATUS (Status);
}
/* Decode the Fixed AcpiEvent */
/*******************************************************************************
*
* FUNCTION: AcpiClearGpe
*
* PARAMETERS: GpeDevice - Parent GPE Device
* GpeNumber - GPE level within the GPE block
* Flags - Called from an ISR or not
*
* RETURN: Status
*
* DESCRIPTION: Clear an ACPI event (general purpose)
*
******************************************************************************/
ACPI_STATUS
AcpiClearGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE ("AcpiClearGpe");
/* Use semaphore lock if not executing at interrupt level */
if (Flags & ACPI_NOT_ISR)
{
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
switch (Event)
{
return_ACPI_STATUS (Status);
case EVENT_PMTIMER:
RegisterId = TMR_STS;
break;
case EVENT_GLOBAL:
RegisterId = GBL_STS;
break;
case EVENT_POWER_BUTTON:
RegisterId = PWRBTN_STS;
break;
case EVENT_SLEEP_BUTTON:
RegisterId = SLPBTN_STS;
break;
case EVENT_RTC:
RegisterId = RTC_STS;
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
break;
}
}
/* Ensure that we have a valid GPE number */
/* Clear the requested fixed event (By writing a one to the status register bit) */
AcpiHwRegisterIO (ACPI_WRITE, TRUE, RegisterId, 1);
break;
case EVENT_GPE:
/* Ensure that we have a valid GPE number */
if ((Event >= NUM_GPE) ||
(Acpi_GblGpeValid[Event] == GPE_INVALID))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
AcpiHwClearGpe (Event);
break;
default:
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
Status = AcpiHwClearGpe (GpeEventInfo);
UnlockAndExit:
if (Flags & ACPI_NOT_ISR)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
/******************************************************************************
*
* FUNCTION: AcpiGetEventStatus
*
* PARAMETERS: Event - The fixed event
* Event Status - Where the current status of the event will
* PARAMETERS: Event - The fixed event or GPE
* Type - The type of event
* Status - Where the current status of the event will
* be returned
*
* RETURN: Status
@ -600,15 +543,18 @@ UnlockAndExit:
*
******************************************************************************/
ACPI_STATUS
AcpiGetEventStatus (
UINT32 Event,
UINT32 Type,
ACPI_EVENT_STATUS *EventStatus)
{
ACPI_STATUS Status = AE_OK;
UINT32 RegisterId;
ACPI_FUNCTION_TRACE ("AcpiGetEventStatus");
FUNCTION_TRACE ("AcpiGetEventStatus");
if (!EventStatus)
@ -616,82 +562,71 @@ AcpiGetEventStatus (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Decode the Fixed Event */
if (Event > ACPI_EVENT_MAX)
/* The Type must be either Fixed AcpiEvent or GPE */
switch (Type)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Get the status of the requested fixed event */
case EVENT_FIXED:
Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
EventStatus, ACPI_MTX_LOCK);
/* Decode the Fixed AcpiEvent */
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiGetGpeStatus
*
* PARAMETERS: GpeDevice - Parent GPE Device
* GpeNumber - GPE level within the GPE block
* Flags - Called from an ISR or not
* Event Status - Where the current status of the event will
* be returned
*
* RETURN: Status
*
* DESCRIPTION: Get status of an event (general purpose)
*
******************************************************************************/
ACPI_STATUS
AcpiGetGpeStatus (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Flags,
ACPI_EVENT_STATUS *EventStatus)
{
ACPI_STATUS Status = AE_OK;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE ("AcpiGetGpeStatus");
/* Use semaphore lock if not executing at interrupt level */
if (Flags & ACPI_NOT_ISR)
{
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
switch (Event)
{
return_ACPI_STATUS (Status);
case EVENT_PMTIMER:
RegisterId = TMR_STS;
break;
case EVENT_GLOBAL:
RegisterId = GBL_STS;
break;
case EVENT_POWER_BUTTON:
RegisterId = PWRBTN_STS;
break;
case EVENT_SLEEP_BUTTON:
RegisterId = SLPBTN_STS;
break;
case EVENT_RTC:
RegisterId = RTC_STS;
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
break;
}
}
/* Ensure that we have a valid GPE number */
/* Get the status of the requested fixed event */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
*EventStatus = AcpiHwRegisterIO (ACPI_READ, TRUE, RegisterId);
break;
case EVENT_GPE:
/* Ensure that we have a valid GPE number */
if ((Event >= NUM_GPE) ||
(Acpi_GblGpeValid[Event] == GPE_INVALID))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Obtain status on the requested GPE number */
AcpiHwGetGpeStatus (Event, EventStatus);
break;
default:
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/* Obtain status on the requested GPE number */
Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus);
UnlockAndExit:
if (Flags & ACPI_NOT_ISR)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
}
return_ACPI_STATUS (Status);
}

View File

@ -190,7 +190,7 @@ AcpiInstallAddressSpaceHandler (
if ((ObjEntry->Type != ACPI_TYPE_DEVICE) &&
(ObjEntry->Type != ACPI_TYPE_PROCESSOR) &&
(ObjEntry->Type != ACPI_TYPE_THERMAL) &&
(ObjEntry != AcpiGbl_RootObject))
(ObjEntry != Acpi_GblRootObject))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
@ -312,7 +312,7 @@ AcpiInstallAddressSpaceHandler (
}
DEBUG_PRINT (TRACE_OPREGION, ("Installing address handler for %s on Device 0x%p (0x%p)\n",
AcpiGbl_RegionTypes[SpaceId], ObjEntry, ObjDesc));
Acpi_GblRegionTypes[SpaceId], ObjEntry, ObjDesc));
/*
* Now we can install the handler
@ -448,7 +448,7 @@ AcpiRemoveAddressSpaceHandler (
* Got it, first dereference this in the Regions
*/
DEBUG_PRINT (TRACE_OPREGION, ("Removing address handler 0x%p (0x%p) for %s on Device 0x%p (0x%p)\n",
HandlerObj, Handler, AcpiGbl_RegionTypes[SpaceId], ObjEntry, ObjDesc));
HandlerObj, Handler, Acpi_GblRegionTypes[SpaceId], ObjEntry, ObjDesc));
RegionObj = HandlerObj->AddrHandler.RegionList;
@ -501,7 +501,7 @@ AcpiRemoveAddressSpaceHandler (
*/
DEBUG_PRINT (TRACE_OPREGION,
("Unable to remove address handler 0x%p for %s on Device nte 0x%p, obj 0x%p\n",
Handler, AcpiGbl_RegionTypes[SpaceId], ObjEntry, ObjDesc));
Handler, Acpi_GblRegionTypes[SpaceId], ObjEntry, ObjDesc));
Status = AE_NOT_EXIST;