Global lock is now optional

date	2001.03.02.17.45.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 16:47:09 +00:00
parent 809e54df58
commit 2aaff58c4d
3 changed files with 328 additions and 173 deletions

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
* $Revision: 1.100 $
* $Revision: 1.102 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -150,13 +150,13 @@ AcpiInstallFixedEventHandler (
FIXED_EVENT_HANDLER Handler,
void *Context)
{
ACPI_STATUS Status = AE_OK;
ACPI_STATUS Status;
FUNCTION_TRACE ("AcpiInstallFixedEventHandler");
/* Sanity check the parameters. */
/* Parameter validation */
if (Event >= NUM_FIXED_EVENTS)
{
@ -179,9 +179,8 @@ AcpiInstallFixedEventHandler (
AcpiGbl_FixedEventHandlers[Event].Handler = Handler;
AcpiGbl_FixedEventHandlers[Event].Context = Context;
Status = AcpiEnableEvent(Event, ACPI_EVENT_FIXED);
if (!ACPI_SUCCESS(Status))
Status = AcpiEnableEvent (Event, ACPI_EVENT_FIXED);
if (!ACPI_SUCCESS (Status))
{
DEBUG_PRINT (ACPI_WARN, ("Could not enable fixed event.\n"));
@ -189,13 +188,13 @@ AcpiInstallFixedEventHandler (
AcpiGbl_FixedEventHandlers[Event].Handler = NULL;
AcpiGbl_FixedEventHandlers[Event].Context = NULL;
Status = AE_ERROR;
goto Cleanup;
}
DEBUG_PRINT (ACPI_INFO,
("Enabled fixed event %X, Handler=%p\n", Event, Handler));
else
{
DEBUG_PRINT (ACPI_INFO,
("Enabled fixed event %X, Handler=%p\n", Event, Handler));
}
Cleanup:
@ -228,7 +227,7 @@ AcpiRemoveFixedEventHandler (
FUNCTION_TRACE ("AcpiRemoveFixedEventHandler");
/* Sanity check the parameters. */
/* Parameter validation */
if (Event >= NUM_FIXED_EVENTS)
{
@ -241,22 +240,22 @@ AcpiRemoveFixedEventHandler (
Status = AcpiDisableEvent(Event, ACPI_EVENT_FIXED);
if (!ACPI_SUCCESS(Status))
{
DEBUG_PRINT (ACPI_WARN,
("Could not write to fixed event enable register.\n"));
Status = AE_ERROR;
AcpiCmReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
/* Remove the handler */
/* Always Remove the handler */
AcpiGbl_FixedEventHandlers[Event].Handler = NULL;
AcpiGbl_FixedEventHandlers[Event].Context = NULL;
DEBUG_PRINT (ACPI_INFO, ("Disabled fixed event %X.\n", Event));
if (!ACPI_SUCCESS(Status))
{
DEBUG_PRINT (ACPI_WARN,
("Could not write to fixed event enable register.\n"));
}
else
{
DEBUG_PRINT (ACPI_INFO, ("Disabled fixed event %X.\n", Event));
}
AcpiCmReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
@ -306,7 +305,7 @@ AcpiInstallNotifyHandler (
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
/* Convert and validate the device handle */
/* Convert and validate the device handle */
DeviceNode = AcpiNsConvertHandleToEntry (Device);
if (!DeviceNode)
@ -319,12 +318,12 @@ AcpiInstallNotifyHandler (
* Root Object:
* ------------
* Registering a notify handler on the root object indicates that the
* caller wishes to receive notifications for all objects. Note that
* caller wishes to receive notifications for all objects. Note that
* only one <external> global handler can be regsitered (per notify type).
*/
if (Device == ACPI_ROOT_OBJECT)
{
/* Make sure the handler is not already installed */
/* Make sure the handler is not already installed */
if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
AcpiGbl_SysNotify.Handler) ||
@ -376,7 +375,7 @@ AcpiInstallNotifyHandler (
if (ObjDesc)
{
/* Object exists - make sure there's no handler */
/* Object exists - make sure there's no handler */
if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
ObjDesc->Device.SysHandler) ||
@ -409,7 +408,7 @@ AcpiInstallNotifyHandler (
}
}
/* Install the handler */
/* Install the handler */
NotifyObj = AcpiCmCreateInternalObject (INTERNAL_TYPE_NOTIFY);
if (!NotifyObj)
@ -494,25 +493,25 @@ AcpiRemoveNotifyHandler (
DEBUG_PRINT(ACPI_INFO, ("Removing notify handler for ROOT object.\n"));
if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
!AcpiGbl_SysNotify.Handler) ||
((HandlerType == ACPI_DEVICE_NOTIFY) &&
!AcpiGbl_DrvNotify.Handler))
{
Status = AE_NOT_EXIST;
if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
!AcpiGbl_SysNotify.Handler) ||
((HandlerType == ACPI_DEVICE_NOTIFY) &&
!AcpiGbl_DrvNotify.Handler))
{
Status = AE_NOT_EXIST;
goto UnlockAndExit;
}
}
if (HandlerType == ACPI_SYSTEM_NOTIFY) {
AcpiGbl_SysNotify.Node = NULL;
AcpiGbl_SysNotify.Handler = NULL;
AcpiGbl_SysNotify.Context = NULL;
}
else {
AcpiGbl_DrvNotify.Node = NULL;
AcpiGbl_DrvNotify.Handler = NULL;
AcpiGbl_DrvNotify.Context = NULL;
}
if (HandlerType == ACPI_SYSTEM_NOTIFY) {
AcpiGbl_SysNotify.Node = NULL;
AcpiGbl_SysNotify.Handler = NULL;
AcpiGbl_SysNotify.Context = NULL;
}
else {
AcpiGbl_DrvNotify.Node = NULL;
AcpiGbl_DrvNotify.Handler = NULL;
AcpiGbl_DrvNotify.Context = NULL;
}
}
/*
@ -541,7 +540,7 @@ AcpiRemoveNotifyHandler (
goto UnlockAndExit;
}
/* Object exists - make sure there's an existing handler */
/* Object exists - make sure there's an existing handler */
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
@ -559,7 +558,7 @@ AcpiRemoveNotifyHandler (
goto UnlockAndExit;
}
/* Remove the handler */
/* Remove the handler */
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{

View File

@ -1,6 +1,7 @@
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
* $Revision: 1.29 $
*
*****************************************************************************/
@ -8,8 +9,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -117,14 +118,14 @@
#define __EVXFEVNT_C__
#include "acpi.h"
#include "hardware.h"
#include "namesp.h"
#include "events.h"
#include "achware.h"
#include "acnamesp.h"
#include "acevents.h"
#include "amlcode.h"
#include "interp.h"
#include "acinterp.h"
#define _COMPONENT EVENT_HANDLING
MODULE_NAME ("evxfevnt");
MODULE_NAME ("evxfevnt")
/**************************************************************************
@ -135,9 +136,7 @@
*
* RETURN: Status
*
* 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.
* DESCRIPTION: Transfers the system into ACPI mode.
*
*************************************************************************/
@ -162,54 +161,22 @@ AcpiEnable (void)
if (SYS_MODE_LEGACY == AcpiHwGetModeCapabilities())
{
DEBUG_PRINT (ACPI_WARN, ("Only legacy mode supported!\n"));
return_ACPI_STATUS (AE_ERROR);
}
AcpiGbl_OriginalMode = 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"));
DEBUG_PRINT (ACPI_WARN,
("AcpiEnable: Only legacy mode supported!\n"));
return_ACPI_STATUS (AE_ERROR);
}
/* Transition to ACPI mode */
if (AE_OK != AcpiHwSetMode (SYS_MODE_ACPI))
Status = AcpiHwSetMode (SYS_MODE_ACPI);
if (ACPI_FAILURE (Status))
{
DEBUG_PRINT (ACPI_FATAL, ("Could not transition to ACPI mode.\n"));
return_ACPI_STATUS (AE_ERROR);
return_ACPI_STATUS (Status);
}
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);
}
@ -230,16 +197,19 @@ AcpiEnable (void)
ACPI_STATUS
AcpiDisable (void)
{
ACPI_STATUS Status;
FUNCTION_TRACE ("AcpiDisable");
/* Restore original mode */
if (AE_OK != AcpiHwSetMode (AcpiGbl_OriginalMode))
Status = AcpiHwSetMode (AcpiGbl_OriginalMode);
if (ACPI_FAILURE (Status))
{
DEBUG_PRINT (ACPI_ERROR, ("Unable to transition to original mode"));
return_ACPI_STATUS (AE_ERROR);
return_ACPI_STATUS (Status);
}
/* Unload the SCI interrupt handler */
@ -247,7 +217,7 @@ AcpiDisable (void)
AcpiEvRemoveSciHandler ();
AcpiEvRestoreAcpiState ();
return_ACPI_STATUS (AE_OK);
return_ACPI_STATUS (Status);
}
@ -312,9 +282,19 @@ AcpiEnableEvent (
break;
}
/* Enable the requested fixed event (by writing a one to the enable register bit) */
/*
* Enable the requested fixed event (by writing a one to the
* enable register bit)
*/
AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, RegisterId, 1);
if (1 != AcpiHwRegisterBitAccess(ACPI_READ, ACPI_MTX_LOCK, RegisterId))
{
DEBUG_PRINT(ACPI_ERROR, ("Fixed event bit clear when it should be set,\n"));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
AcpiHwRegisterAccess (ACPI_WRITE, TRUE, RegisterId, 1);
break;
@ -406,9 +386,19 @@ AcpiDisableEvent (
break;
}
/* Disable the requested fixed event (by writing a zero to the enable register bit) */
/*
* Disable the requested fixed event (by writing a zero to the
* enable register bit)
*/
AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, RegisterId, 0);
if (0 != AcpiHwRegisterBitAccess(ACPI_READ, ACPI_MTX_LOCK, RegisterId))
{
DEBUG_PRINT(ACPI_ERROR, ("Fixed event bit set when it should be clear,\n"));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
AcpiHwRegisterAccess (ACPI_WRITE, TRUE, RegisterId, 0);
break;
@ -497,9 +487,12 @@ AcpiClearEvent (
break;
}
/* Clear the requested fixed event (By writing a one to the status register bit) */
/*
* Clear the requested fixed event (By writing a one to the
* status register bit)
*/
AcpiHwRegisterAccess (ACPI_WRITE, TRUE, RegisterId, 1);
AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, RegisterId, 1);
break;
@ -600,7 +593,7 @@ AcpiGetEventStatus (
/* Get the status of the requested fixed event */
*EventStatus = AcpiHwRegisterAccess (ACPI_READ, TRUE, RegisterId);
*EventStatus = AcpiHwRegisterBitAccess (ACPI_READ, ACPI_MTX_LOCK, RegisterId);
break;

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
* $Revision: 1.58 $
* $Revision: 1.37 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,10 +118,11 @@
#define __HWACPI_C__
#include "acpi.h"
#include "achware.h"
#define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME ("hwacpi")
#define _COMPONENT HARDWARE
MODULE_NAME ("hwacpi")
/******************************************************************************
@ -140,30 +141,159 @@ ACPI_STATUS
AcpiHwInitialize (
void)
{
ACPI_STATUS Status;
ACPI_STATUS Status = AE_OK;
UINT32 Index;
ACPI_FUNCTION_TRACE ("HwInitialize");
FUNCTION_TRACE ("HwInitialize");
/* We must have the ACPI tables by the time we get here */
if (!AcpiGbl_FADT)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "A FADT is not loaded\n"));
AcpiGbl_RestoreAcpiChipset = FALSE;
DEBUG_PRINT (ACPI_ERROR, ("HwInitialize: No FADT!\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
/* Sanity check the FADT for valid values */
Status = AcpiUtValidateFadt ();
if (ACPI_FAILURE (Status))
/* Must support *some* mode! */
/*
if (!(SystemFlags & SYS_MODES_MASK))
{
return_ACPI_STATUS (Status);
RestoreAcpiChipset = FALSE;
DEBUG_PRINT (ACPI_ERROR,
("CmHardwareInitialize: Supported modes uninitialized!\n"));
return_ACPI_STATUS (AE_ERROR);
}
return_ACPI_STATUS (AE_OK);
*/
switch (AcpiGbl_SystemFlags & SYS_MODES_MASK)
{
/* Identify current ACPI/legacy mode */
case (SYS_MODE_ACPI):
AcpiGbl_OriginalMode = SYS_MODE_ACPI;
DEBUG_PRINT (ACPI_INFO, ("System supports ACPI mode only.\n"));
break;
case (SYS_MODE_LEGACY):
AcpiGbl_OriginalMode = SYS_MODE_LEGACY;
DEBUG_PRINT (ACPI_INFO,
("Tables loaded from buffer, hardware assumed to support LEGACY mode only.\n"));
break;
case (SYS_MODE_ACPI | SYS_MODE_LEGACY):
if (AcpiHwGetMode () == SYS_MODE_ACPI)
{
AcpiGbl_OriginalMode = SYS_MODE_ACPI;
}
else
{
AcpiGbl_OriginalMode = SYS_MODE_LEGACY;
}
DEBUG_PRINT (ACPI_INFO,
("System supports both ACPI and LEGACY modes.\n"));
DEBUG_PRINT (ACPI_INFO,
("System is currently in %s mode.\n",
(AcpiGbl_OriginalMode == SYS_MODE_ACPI) ? "ACPI" : "LEGACY"));
break;
}
if (AcpiGbl_SystemFlags & SYS_MODE_ACPI)
{
/* Target system supports ACPI mode */
/*
* The purpose of this code is to save the initial state
* of the ACPI event enable registers. An exit function will be
* registered which will restore this state when the application
* exits. The exit function will also clear all of the ACPI event
* status bits prior to restoring the original mode.
*
* The location of the PM1aEvtBlk enable registers is defined as the
* base of PM1aEvtBlk + DIV_2(PM1aEvtBlkLength). Since the spec further
* fully defines the PM1aEvtBlk to be a total of 4 bytes, the offset
* for the enable registers is always 2 from the base. It is hard
* coded here. If this changes in the spec, this code will need to
* be modified. The PM1bEvtBlk behaves as expected.
*/
AcpiGbl_Pm1EnableRegisterSave = (UINT16) AcpiHwRegisterRead (ACPI_MTX_LOCK, PM1_EN);
/*
* The GPEs behave similarly, except that the length of the register
* block is not fixed, so the buffer must be allocated with malloc
*/
if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) &&
AcpiGbl_FADT->Gpe0BlkLen)
{
/* GPE0 specified in FADT */
AcpiGbl_Gpe0EnableRegisterSave =
AcpiCmAllocate (DIV_2 (AcpiGbl_FADT->Gpe0BlkLen));
if (!AcpiGbl_Gpe0EnableRegisterSave)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Save state of GPE0 enable bits */
for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe0BlkLen); Index++)
{
AcpiGbl_Gpe0EnableRegisterSave[Index] =
(UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE0_EN_BLOCK | Index);
}
}
else
{
AcpiGbl_Gpe0EnableRegisterSave = NULL;
}
if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) &&
AcpiGbl_FADT->Gpe1BlkLen)
{
/* GPE1 defined */
AcpiGbl_Gpe1EnableRegisterSave =
AcpiCmAllocate (DIV_2 (AcpiGbl_FADT->Gpe1BlkLen));
if (!AcpiGbl_Gpe1EnableRegisterSave)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* save state of GPE1 enable bits */
for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe1BlkLen); Index++)
{
AcpiGbl_Gpe1EnableRegisterSave[Index] =
(UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE1_EN_BLOCK | Index);
}
}
else
{
AcpiGbl_Gpe1EnableRegisterSave = NULL;
}
}
return_ACPI_STATUS (Status);
}
@ -175,7 +305,8 @@ AcpiHwInitialize (
*
* RETURN: Status
*
* DESCRIPTION: Transitions the system into the requested mode.
* DESCRIPTION: Transitions the system into the requested mode or does nothing
* if the system is already in that mode.
*
******************************************************************************/
@ -184,60 +315,35 @@ AcpiHwSetMode (
UINT32 Mode)
{
ACPI_STATUS Status;
UINT32 Retry;
ACPI_STATUS Status = AE_NO_HARDWARE_RESPONSE;
FUNCTION_TRACE ("HwSetMode");
ACPI_FUNCTION_TRACE ("HwSetMode");
switch (Mode)
if (Mode == SYS_MODE_ACPI)
{
case ACPI_SYS_MODE_ACPI:
/* BIOS should have disabled ALL fixed and GP events */
Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd,
(ACPI_INTEGER) AcpiGbl_FADT->AcpiEnable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n"));
break;
case ACPI_SYS_MODE_LEGACY:
AcpiOsOut8 (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiEnable);
DEBUG_PRINT (ACPI_INFO, ("Attempting to enable ACPI mode\n"));
}
else if (Mode == SYS_MODE_LEGACY)
{
/*
* BIOS should clear all fixed status bits and restore fixed event
* enable bits to default
*/
Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd,
(ACPI_INTEGER) AcpiGbl_FADT->AcpiDisable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Attempting to enable Legacy (non-ACPI) mode\n"));
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
AcpiOsOut8 (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiDisable);
DEBUG_PRINT (ACPI_INFO,
("Attempting to enable Legacy (non-ACPI) mode\n"));
}
if (ACPI_FAILURE (Status))
if (AcpiHwGetMode () == Mode)
{
return_ACPI_STATUS (Status);
}
/*
* Some hardware takes a LONG time to switch modes. Give them 3 sec to
* do so, but allow faster systems to proceed more quickly.
*/
Retry = 3000;
while (Retry)
{
Status = AE_NO_HARDWARE_RESPONSE;
if (AcpiHwGetMode() == Mode) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", Mode));
Status = AE_OK;
break;
}
AcpiOsStall(1000);
Retry--;
DEBUG_PRINT (ACPI_INFO, ("Mode %X successfully enabled\n", Mode));
Status = AE_OK;
}
return_ACPI_STATUS (Status);
@ -260,24 +366,81 @@ AcpiHwSetMode (
UINT32
AcpiHwGetMode (void)
{
ACPI_STATUS Status;
UINT32 Value;
FUNCTION_TRACE ("HwGetMode");
ACPI_FUNCTION_TRACE ("HwGetMode");
Status = AcpiGetRegister (ACPI_BITREG_SCI_ENABLE, &Value, ACPI_MTX_LOCK);
if (ACPI_FAILURE (Status))
if (AcpiHwRegisterBitAccess (ACPI_READ, ACPI_MTX_LOCK, SCI_EN))
{
return_VALUE (ACPI_SYS_MODE_LEGACY);
}
if (Value)
{
return_VALUE (ACPI_SYS_MODE_ACPI);
return_VALUE (SYS_MODE_ACPI);
}
else
{
return_VALUE (ACPI_SYS_MODE_LEGACY);
return_VALUE (SYS_MODE_LEGACY);
}
}
/******************************************************************************
*
* FUNCTION: AcpiHwGetModeCapabilities
*
* PARAMETERS: none
*
* RETURN: logical OR of SYS_MODE_ACPI and SYS_MODE_LEGACY determined at initial
* system state.
*
* DESCRIPTION: Returns capablities of system
*
******************************************************************************/
UINT32
AcpiHwGetModeCapabilities (void)
{
FUNCTION_TRACE ("HwGetModeCapabilities");
if (!(AcpiGbl_SystemFlags & SYS_MODES_MASK))
{
if (AcpiHwGetMode () == SYS_MODE_LEGACY)
{
/*
* Assume that if this call is being made, AcpiInit has been called
* and ACPI support has been established by the presence of the
* tables. Therefore since we're in SYS_MODE_LEGACY, the system
* must support both modes
*/
AcpiGbl_SystemFlags |= (SYS_MODE_ACPI | SYS_MODE_LEGACY);
}
else
{
/* TBD: [Investigate] !!! this may be unsafe... */
/*
* system is is ACPI mode, so try to switch back to LEGACY to see if
* it is supported
*/
AcpiHwSetMode (SYS_MODE_LEGACY);
if (AcpiHwGetMode () == SYS_MODE_LEGACY)
{
/* Now in SYS_MODE_LEGACY, so both are supported */
AcpiGbl_SystemFlags |= (SYS_MODE_ACPI | SYS_MODE_LEGACY);
AcpiHwSetMode (SYS_MODE_ACPI);
}
else
{
/* Still in SYS_MODE_ACPI so this must be an ACPI only system */
AcpiGbl_SystemFlags |= SYS_MODE_ACPI;
}
}
}
return_VALUE (AcpiGbl_SystemFlags & SYS_MODES_MASK);
}