Moved defines to header files

date	2005.03.24.18.41.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 16:58:17 +00:00
parent b2f154d2f6
commit e2203d67c8

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
* $Revision: 1.69 $
* $Revision: 1.74 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* All rights reserved.
*
* 2. License
@ -121,20 +121,7 @@
ACPI_MODULE_NAME ("hwsleep")
#define METHOD_NAME__BFS "\\_BFS"
#define METHOD_NAME__GTS "\\_GTS"
#define METHOD_NAME__PTS "\\_PTS"
#define METHOD_NAME__SST "\\_SI._SST"
#define METHOD_NAME__WAK "\\_WAK"
#define ACPI_SST_INDICATOR_OFF 0
#define ACPI_SST_WORKING 1
#define ACPI_SST_WAKING 2
#define ACPI_SST_SLEEPING 3
#define ACPI_SST_SLEEP_CONTEXT 4
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiSetFirmwareWakingVector
*
@ -143,7 +130,7 @@
*
* RETURN: Status
*
* DESCRIPTION: Access function for dFirmwareWakingVector field in FACS
* DESCRIPTION: Access function for the FirmwareWakingVector field in FACS
*
******************************************************************************/
@ -172,17 +159,17 @@ AcpiSetFirmwareWakingVector (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiGetFirmwareWakingVector
*
* PARAMETERS: *PhysicalAddress - Output buffer where contents of
* PARAMETERS: *PhysicalAddress - Where the contents of
* the FirmwareWakingVector field of
* the FACS will be stored.
* the FACS will be returned.
*
* RETURN: Status
* RETURN: Status, vector
*
* DESCRIPTION: Access function for FirmwareWakingVector field in FACS
* DESCRIPTION: Access function for the FirmwareWakingVector field in FACS
*
******************************************************************************/
@ -216,7 +203,7 @@ AcpiGetFirmwareWakingVector (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiEnterSleepStatePrep
*
@ -294,7 +281,7 @@ AcpiEnterSleepStatePrep (
break;
default:
Arg.Integer.Value = ACPI_SST_INDICATOR_OFF; /* Default is indicator off */
Arg.Integer.Value = ACPI_SST_INDICATOR_OFF; /* Default is off */
break;
}
@ -303,14 +290,15 @@ AcpiEnterSleepStatePrep (
Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
ACPI_REPORT_ERROR (("Method _SST failed, %s\n", AcpiFormatException (Status)));
ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
AcpiFormatException (Status)));
}
return_ACPI_STATUS (AE_OK);
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiEnterSleepState
*
@ -369,7 +357,8 @@ AcpiEnterSleepState (
{
/* Disable BM arbitration */
Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK);
Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE,
1, ACPI_MTX_DO_NOT_LOCK);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -380,14 +369,14 @@ AcpiEnterSleepState (
* 1) Disable/Clear all GPEs
* 2) Enable all wakeup GPEs
*/
Status = AcpiHwDisableAllGpes ();
Status = AcpiHwDisableAllGpes (ACPI_ISR);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiGbl_SystemAwakeAndRunning = FALSE;
Status = AcpiHwEnableAllWakeupGpes ();
Status = AcpiHwEnableAllWakeupGpes (ACPI_ISR);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -395,16 +384,19 @@ AcpiEnterSleepState (
/* Get current value of PM1A control */
Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, &PM1AControl);
Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_CONTROL, &PM1AControl);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Entering sleep state [S%d]\n", SleepState));
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"Entering sleep state [S%d]\n", SleepState));
/* Clear SLP_EN and SLP_TYP fields */
PM1AControl &= ~(SleepTypeRegInfo->AccessBitMask | SleepEnableRegInfo->AccessBitMask);
PM1AControl &= ~(SleepTypeRegInfo->AccessBitMask |
SleepEnableRegInfo->AccessBitMask);
PM1BControl = PM1AControl;
/* Insert SLP_TYP bits */
@ -419,13 +411,15 @@ AcpiEnterSleepState (
/* Write #1: fill in SLP_TYP data */
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl);
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1A_CONTROL, PM1AControl);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1BControl);
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1B_CONTROL, PM1BControl);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -440,13 +434,15 @@ AcpiEnterSleepState (
ACPI_FLUSH_CPU_CACHE ();
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl);
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1A_CONTROL, PM1AControl);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1BControl);
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1B_CONTROL, PM1BControl);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -455,10 +451,11 @@ AcpiEnterSleepState (
if (SleepState > ACPI_STATE_S3)
{
/*
* We wanted to sleep > S3, but it didn't happen (by virtue of the fact that
* we are still executing!)
* We wanted to sleep > S3, but it didn't happen (by virtue of the
* fact that we are still executing!)
*
* Wait ten seconds, then try again. This is to get S4/S5 to work on all machines.
* Wait ten seconds, then try again. This is to get S4/S5 to work on
* all machines.
*
* We wait so long to allow chipsets that poll this reg very slowly to
* still read the right value. Ideally, this block would go
@ -466,7 +463,8 @@ AcpiEnterSleepState (
*/
AcpiOsStall (10000000);
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL,
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_CONTROL,
SleepEnableRegInfo->AccessBitMask);
if (ACPI_FAILURE (Status))
{
@ -478,7 +476,8 @@ AcpiEnterSleepState (
do
{
Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue, ACPI_MTX_DO_NOT_LOCK);
Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue,
ACPI_MTX_DO_NOT_LOCK);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -492,7 +491,7 @@ AcpiEnterSleepState (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiEnterSleepStateS4bios
*
@ -532,14 +531,14 @@ AcpiEnterSleepStateS4bios (
* 1) Disable/Clear all GPEs
* 2) Enable all wakeup GPEs
*/
Status = AcpiHwDisableAllGpes ();
Status = AcpiHwDisableAllGpes (ACPI_ISR);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiGbl_SystemAwakeAndRunning = FALSE;
Status = AcpiHwEnableAllWakeupGpes ();
Status = AcpiHwEnableAllWakeupGpes (ACPI_ISR);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -547,11 +546,13 @@ AcpiEnterSleepStateS4bios (
ACPI_FLUSH_CPU_CACHE ();
Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, (UINT32) AcpiGbl_FADT->S4BiosReq, 8);
Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd,
(UINT32) AcpiGbl_FADT->S4BiosReq, 8);
do {
AcpiOsStall(1000);
Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue, ACPI_MTX_DO_NOT_LOCK);
Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue,
ACPI_MTX_DO_NOT_LOCK);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -562,7 +563,7 @@ AcpiEnterSleepStateS4bios (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiLeaveSleepState
*
@ -571,6 +572,7 @@ AcpiEnterSleepStateS4bios (
* RETURN: Status
*
* DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
* Called with interrupts ENABLED.
*
******************************************************************************/
@ -644,20 +646,23 @@ AcpiLeaveSleepState (
Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
ACPI_REPORT_ERROR (("Method _SST failed, %s\n", AcpiFormatException (Status)));
ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
AcpiFormatException (Status)));
}
Arg.Integer.Value = SleepState;
Status = AcpiEvaluateObject (NULL, METHOD_NAME__BFS, &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
ACPI_REPORT_ERROR (("Method _BFS failed, %s\n", AcpiFormatException (Status)));
ACPI_REPORT_ERROR (("Method _BFS failed, %s\n",
AcpiFormatException (Status)));
}
Status = AcpiEvaluateObject (NULL, METHOD_NAME__WAK, &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", AcpiFormatException (Status)));
ACPI_REPORT_ERROR (("Method _WAK failed, %s\n",
AcpiFormatException (Status)));
}
/* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
@ -666,14 +671,14 @@ AcpiLeaveSleepState (
* 1) Disable/Clear all GPEs
* 2) Enable all runtime GPEs
*/
Status = AcpiHwDisableAllGpes ();
Status = AcpiHwDisableAllGpes (ACPI_NOT_ISR);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiGbl_SystemAwakeAndRunning = TRUE;
Status = AcpiHwEnableAllRuntimeGpes ();
Status = AcpiHwEnableAllRuntimeGpes (ACPI_NOT_ISR);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -681,9 +686,12 @@ AcpiLeaveSleepState (
/* Enable power button */
(void) AcpiSetRegister(AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId,
(void) AcpiSetRegister(
AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId,
1, ACPI_MTX_DO_NOT_LOCK);
(void) AcpiSetRegister(AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId,
(void) AcpiSetRegister(
AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId,
1, ACPI_MTX_DO_NOT_LOCK);
/* Enable BM arbitration */
@ -698,7 +706,8 @@ AcpiLeaveSleepState (
Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
ACPI_REPORT_ERROR (("Method _SST failed, %s\n", AcpiFormatException (Status)));
ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
AcpiFormatException (Status)));
}
return_ACPI_STATUS (Status);