Removed all support to save/restore the GPE status/enable registers --

unnecessary.


date	2002.01.14.22.19.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 16:45:00 +00:00
parent b7b4c69be7
commit adae2195b2
3 changed files with 33 additions and 354 deletions

View File

@ -2,7 +2,7 @@
*
* Module Name: evsci - System Control Interrupt configuration and
* legacy to ACPI mode state transition functions
* $Revision: 1.78 $
* $Revision: 1.79 $
*
******************************************************************************/
@ -239,77 +239,3 @@ AcpiEvRemoveSciHandler (void)
}
/*******************************************************************************
*
* FUNCTION: AcpiEvRestoreAcpiState
*
* PARAMETERS: none
*
* RETURN: none
*
* DESCRIPTION: Restore the original ACPI state of the machine
*
******************************************************************************/
void
AcpiEvRestoreAcpiState (void)
{
UINT32 Index;
FUNCTION_TRACE ("EvRestoreAcpiState");
/* Restore the state of the chipset enable bits. */
if (AcpiGbl_RestoreAcpiChipset == TRUE)
{
/* Restore the fixed events */
if (AcpiHwRegisterRead (ACPI_MTX_LOCK, PM1_EN) !=
AcpiGbl_Pm1EnableRegisterSave)
{
AcpiHwRegisterWrite (ACPI_MTX_LOCK, PM1_EN,
AcpiGbl_Pm1EnableRegisterSave);
}
/* Ensure that all status bits are clear */
AcpiHwClearAcpiStatus ();
/* Now restore the GPEs */
for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe0BlkLen); Index++)
{
if (AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE0_EN_BLOCK | Index) !=
AcpiGbl_Gpe0EnableRegisterSave[Index])
{
AcpiHwRegisterWrite (ACPI_MTX_LOCK, GPE0_EN_BLOCK | Index,
AcpiGbl_Gpe0EnableRegisterSave[Index]);
}
}
/* GPE Block 1 present? */
if (AcpiGbl_FADT->Gpe1BlkLen)
{
for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe1BlkLen); Index++)
{
if (AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE1_EN_BLOCK | Index) !=
AcpiGbl_Gpe1EnableRegisterSave[Index])
{
AcpiHwRegisterWrite (ACPI_MTX_LOCK, GPE1_EN_BLOCK | Index,
AcpiGbl_Gpe1EnableRegisterSave[Index]);
}
}
}
if (AcpiHwGetMode() != AcpiGbl_OriginalMode)
{
AcpiHwSetMode (AcpiGbl_OriginalMode);
}
}
return_VOID;
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
* $Revision: 1.45 $
* $Revision: 1.46 $
*
*****************************************************************************/
@ -218,8 +218,6 @@ AcpiDisable (void)
/* Unload the SCI interrupt handler */
AcpiEvRemoveSciHandler ();
AcpiEvRestoreAcpiState ();
return_ACPI_STATUS (Status);
}
@ -291,10 +289,12 @@ AcpiEnableEvent (
*/
AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, RegisterId, 1);
/* Make sure that the hardware responded */
if (1 != AcpiHwRegisterBitAccess(ACPI_READ, ACPI_MTX_LOCK, RegisterId))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Fixed event bit clear when it should be set\n"));
"Could not enable %s event\n", AcpiUtGetEventName (Event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
break;
@ -401,7 +401,7 @@ AcpiDisableEvent (
if (0 != AcpiHwRegisterBitAccess(ACPI_READ, ACPI_MTX_LOCK, RegisterId))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Fixed event bit set when it should be clear,\n"));
"Could not disable %s events\n", AcpiUtGetEventName (Event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
break;

View File

@ -1,7 +1,8 @@
/******************************************************************************
*
* Module Name: hwacpi - ACPI hardware functions - mode and timer
* $Revision: 1.28 $
* Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
* $Revision: 1.50 $
*
*****************************************************************************/
@ -9,8 +10,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 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -120,7 +121,7 @@
#include "achware.h"
#define _COMPONENT HARDWARE
#define _COMPONENT ACPI_HARDWARE
MODULE_NAME ("hwacpi")
@ -140,8 +141,7 @@ ACPI_STATUS
AcpiHwInitialize (
void)
{
ACPI_STATUS Status = AE_OK;
UINT32 Index;
ACPI_STATUS Status;
FUNCTION_TRACE ("HwInitialize");
@ -151,154 +151,20 @@ AcpiHwInitialize (
if (!AcpiGbl_FADT)
{
AcpiGbl_RestoreAcpiChipset = FALSE;
DEBUG_PRINT (ACPI_ERROR, ("HwInitialize: No FADT!\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "A FADT is not loaded\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
/* Must support *some* mode! */
/*
if (!(SystemFlags & SYS_MODES_MASK))
{
RestoreAcpiChipset = FALSE;
/* Sanity check the FADT for valid values */
DEBUG_PRINT (ACPI_ERROR,
("CmHardwareInitialize: Supported modes uninitialized!\n"));
return_ACPI_STATUS (AE_ERROR);
Status = AcpiUtValidateFadt ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
*/
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 block of 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 + PM1aEvtBlkLength / 2. 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 =
AcpiOsIn16 ((AcpiGbl_FADT->Pm1aEvtBlk + 2));
if (AcpiGbl_FADT->Pm1bEvtBlk)
{
AcpiGbl_Pm1EnableRegisterSave |=
AcpiOsIn16 ((AcpiGbl_FADT->Pm1bEvtBlk + 2));
}
/*
* The GPEs behave similarly, except that the length of the register
* block is not fixed, so the buffer must be allocated with malloc
*/
if (AcpiGbl_FADT->Gpe0Blk && 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] =
AcpiOsIn8 (AcpiGbl_FADT->Gpe0Blk +
DIV_2 (AcpiGbl_FADT->Gpe0BlkLen));
}
}
else
{
AcpiGbl_Gpe0EnableRegisterSave = NULL;
}
if (AcpiGbl_FADT->Gpe1Blk && 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] =
AcpiOsIn8 (AcpiGbl_FADT->Gpe1Blk +
DIV_2 (AcpiGbl_FADT->Gpe1BlkLen));
}
}
else
{
AcpiGbl_Gpe1EnableRegisterSave = NULL;
}
}
return_ACPI_STATUS (Status);
return_ACPI_STATUS (AE_OK);
}
@ -310,8 +176,7 @@ AcpiHwInitialize (
*
* RETURN: Status
*
* DESCRIPTION: Transitions the system into the requested mode or does nothing
* if the system is already in that mode.
* DESCRIPTION: Transitions the system into the requested mode.
*
******************************************************************************/
@ -320,7 +185,8 @@ AcpiHwSetMode (
UINT32 Mode)
{
ACPI_STATUS Status = AE_ERROR;
ACPI_STATUS Status = AE_NO_HARDWARE_RESPONSE;
FUNCTION_TRACE ("HwSetMode");
@ -329,25 +195,27 @@ AcpiHwSetMode (
{
/* BIOS should have disabled ALL fixed and GP events */
AcpiOsOut8 (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiEnable);
DEBUG_PRINT (ACPI_INFO, ("Attempting to enable ACPI mode\n"));
AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiEnable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_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
*/
AcpiOsOut8 (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiDisable);
DEBUG_PRINT (ACPI_INFO,
("Attempting to enable Legacy (non-ACPI) mode\n"));
AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiDisable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Attempting to enable Legacy (non-ACPI) mode\n"));
}
/* Give the platform some time to react */
AcpiOsStall (20000);
if (AcpiHwGetMode () == Mode)
{
DEBUG_PRINT (ACPI_INFO, ("Mode %d successfully enabled\n", Mode));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", Mode));
Status = AE_OK;
}
@ -384,118 +252,3 @@ AcpiHwGetMode (void)
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);
}
/******************************************************************************
*
* FUNCTION: AcpiHwPmtTicks
*
* PARAMETERS: none
*
* RETURN: Current value of the ACPI PMT (timer)
*
* DESCRIPTION: Obtains current value of ACPI PMT
*
******************************************************************************/
UINT32
AcpiHwPmtTicks (void)
{
UINT32 Ticks;
FUNCTION_TRACE ("AcpiPmtTicks");
Ticks = AcpiOsIn32 (AcpiGbl_FADT->PmTmrBlk);
return_VALUE (Ticks);
}
/******************************************************************************
*
* FUNCTION: AcpiHwPmtResolution
*
* PARAMETERS: none
*
* RETURN: Number of bits of resolution in the PMT (either 24 or 32)
*
* DESCRIPTION: Obtains resolution of the ACPI PMT (either 24bit or 32bit)
*
******************************************************************************/
UINT32
AcpiHwPmtResolution (void)
{
FUNCTION_TRACE ("AcpiPmtResolution");
if (0 == AcpiGbl_FADT->TmrValExt)
{
return_VALUE (24);
}
return_VALUE (32);
}