mirror of
https://github.com/acpica/acpica/
synced 2025-01-17 23:09:18 +03:00
New interface to OsAcquireLock and OsReleaseLock
date 2005.06.07.17.06.00; author rmoore1; state Exp;
This commit is contained in:
parent
a0f276f3a8
commit
775e178f42
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: hwgpe - Low level GPE enable/disable/clear functions
|
||||
* $Revision: 1.69 $
|
||||
* $Revision: 1.70 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -461,7 +461,7 @@ AcpiHwEnableWakeupGpeBlock (
|
||||
*
|
||||
* FUNCTION: AcpiHwDisableAllGpes
|
||||
*
|
||||
* PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -471,7 +471,7 @@ AcpiHwEnableWakeupGpeBlock (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiHwDisableAllGpes (
|
||||
UINT32 Flags)
|
||||
void)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
|
||||
@ -479,8 +479,8 @@ AcpiHwDisableAllGpes (
|
||||
ACPI_FUNCTION_TRACE ("HwDisableAllGpes");
|
||||
|
||||
|
||||
Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, Flags);
|
||||
Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, Flags);
|
||||
Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock);
|
||||
Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
@ -489,7 +489,7 @@ AcpiHwDisableAllGpes (
|
||||
*
|
||||
* FUNCTION: AcpiHwEnableAllRuntimeGpes
|
||||
*
|
||||
* PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -499,7 +499,7 @@ AcpiHwDisableAllGpes (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiHwEnableAllRuntimeGpes (
|
||||
UINT32 Flags)
|
||||
void)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
|
||||
@ -507,7 +507,7 @@ AcpiHwEnableAllRuntimeGpes (
|
||||
ACPI_FUNCTION_TRACE ("HwEnableAllRuntimeGpes");
|
||||
|
||||
|
||||
Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock, Flags);
|
||||
Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
@ -516,7 +516,7 @@ AcpiHwEnableAllRuntimeGpes (
|
||||
*
|
||||
* FUNCTION: AcpiHwEnableAllWakeupGpes
|
||||
*
|
||||
* PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -526,7 +526,7 @@ AcpiHwEnableAllRuntimeGpes (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiHwEnableAllWakeupGpes (
|
||||
UINT32 Flags)
|
||||
void)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
|
||||
@ -534,7 +534,7 @@ AcpiHwEnableAllWakeupGpes (
|
||||
ACPI_FUNCTION_TRACE ("HwEnableAllWakeupGpes");
|
||||
|
||||
|
||||
Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock, Flags);
|
||||
Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Module Name: hwregs - Read/write access functions for the various ACPI
|
||||
* control and status registers.
|
||||
* $Revision: 1.157 $
|
||||
* $Revision: 1.171 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -11,7 +11,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
|
||||
@ -162,8 +162,9 @@ AcpiHwClearAcpiStatus (
|
||||
}
|
||||
}
|
||||
|
||||
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
|
||||
ACPI_BITMASK_ALL_FIXED_STATUS);
|
||||
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
|
||||
ACPI_REGISTER_PM1_STATUS,
|
||||
ACPI_BITMASK_ALL_FIXED_STATUS);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto UnlockAndExit;
|
||||
@ -183,7 +184,7 @@ AcpiHwClearAcpiStatus (
|
||||
|
||||
/* Clear the GPE Bits in all GPE registers in all GPE blocks */
|
||||
|
||||
Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, ACPI_ISR);
|
||||
Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock);
|
||||
|
||||
UnlockAndExit:
|
||||
if (Flags & ACPI_MTX_LOCK)
|
||||
@ -217,30 +218,32 @@ AcpiGetSleepTypeData (
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
ACPI_PARAMETER_INFO Info;
|
||||
char *SleepStateName;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("AcpiGetSleepTypeData");
|
||||
|
||||
|
||||
/*
|
||||
* Validate parameters
|
||||
*/
|
||||
/* Validate parameters */
|
||||
|
||||
if ((SleepState > ACPI_S_STATES_MAX) ||
|
||||
!SleepTypeA || !SleepTypeB)
|
||||
{
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/*
|
||||
* Evaluate the namespace object containing the values for this state
|
||||
*/
|
||||
/* Evaluate the namespace object containing the values for this state */
|
||||
|
||||
Info.Parameters = NULL;
|
||||
Status = AcpiNsEvaluateByName ((char *) AcpiGbl_SleepStateNames[SleepState],
|
||||
&Info);
|
||||
Info.ReturnObject = NULL;
|
||||
SleepStateName = (char *) AcpiGbl_SleepStateNames[SleepState];
|
||||
|
||||
Status = AcpiNsEvaluateByName (SleepStateName, &Info);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s while evaluating SleepState [%s]\n",
|
||||
AcpiFormatException (Status), AcpiGbl_SleepStateNames[SleepState]));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"%s while evaluating SleepState [%s]\n",
|
||||
AcpiFormatException (Status), SleepStateName));
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
@ -249,7 +252,8 @@ AcpiGetSleepTypeData (
|
||||
|
||||
if (!Info.ReturnObject)
|
||||
{
|
||||
ACPI_REPORT_ERROR (("Missing Sleep State object\n"));
|
||||
ACPI_REPORT_ERROR (("No Sleep State object returned from [%s]\n",
|
||||
SleepStateName));
|
||||
Status = AE_NOT_EXIST;
|
||||
}
|
||||
|
||||
@ -257,42 +261,53 @@ AcpiGetSleepTypeData (
|
||||
|
||||
else if (ACPI_GET_OBJECT_TYPE (Info.ReturnObject) != ACPI_TYPE_PACKAGE)
|
||||
{
|
||||
ACPI_REPORT_ERROR (("Sleep State object not a Package\n"));
|
||||
ACPI_REPORT_ERROR (("Sleep State return object is not a Package\n"));
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
}
|
||||
|
||||
/* The package must have at least two elements */
|
||||
|
||||
/*
|
||||
* The package must have at least two elements. NOTE (March 2005): This
|
||||
* goes against the current ACPI spec which defines this object as a
|
||||
* package with one encoded DWORD element. However, existing practice
|
||||
* by BIOS vendors seems to be to have 2 or more elements, at least
|
||||
* one per sleep type (A/B).
|
||||
*/
|
||||
else if (Info.ReturnObject->Package.Count < 2)
|
||||
{
|
||||
ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n"));
|
||||
ACPI_REPORT_ERROR ((
|
||||
"Sleep State return package does not have at least two elements\n"));
|
||||
Status = AE_AML_NO_OPERAND;
|
||||
}
|
||||
|
||||
/* The first two elements must both be of type Integer */
|
||||
|
||||
else if ((ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[0]) != ACPI_TYPE_INTEGER) ||
|
||||
(ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[1]) != ACPI_TYPE_INTEGER))
|
||||
else if ((ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[0])
|
||||
!= ACPI_TYPE_INTEGER) ||
|
||||
(ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[1])
|
||||
!= ACPI_TYPE_INTEGER))
|
||||
{
|
||||
ACPI_REPORT_ERROR (("Sleep State package elements are not both Integers (%s, %s)\n",
|
||||
ACPI_REPORT_ERROR ((
|
||||
"Sleep State return package elements are not both Integers (%s, %s)\n",
|
||||
AcpiUtGetObjectTypeName (Info.ReturnObject->Package.Elements[0]),
|
||||
AcpiUtGetObjectTypeName (Info.ReturnObject->Package.Elements[1])));
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Valid _Sx_ package size, type, and value
|
||||
*/
|
||||
*SleepTypeA = (UINT8) (Info.ReturnObject->Package.Elements[0])->Integer.Value;
|
||||
*SleepTypeB = (UINT8) (Info.ReturnObject->Package.Elements[1])->Integer.Value;
|
||||
/* Valid _Sx_ package size, type, and value */
|
||||
|
||||
*SleepTypeA = (UINT8)
|
||||
(Info.ReturnObject->Package.Elements[0])->Integer.Value;
|
||||
*SleepTypeB = (UINT8)
|
||||
(Info.ReturnObject->Package.Elements[1])->Integer.Value;
|
||||
}
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"While evaluating SleepState [%s], bad Sleep object %p type %s\n",
|
||||
AcpiGbl_SleepStateNames[SleepState], Info.ReturnObject,
|
||||
"%s While evaluating SleepState [%s], bad Sleep object %p type %s\n",
|
||||
AcpiFormatException (Status),
|
||||
SleepStateName, Info.ReturnObject,
|
||||
AcpiUtGetObjectTypeName (Info.ReturnObject)));
|
||||
}
|
||||
|
||||
@ -307,9 +322,9 @@ AcpiGetSleepTypeData (
|
||||
*
|
||||
* PARAMETERS: RegisterId - Index of ACPI Register to access
|
||||
*
|
||||
* RETURN: The bit mask to be used when accessing the register
|
||||
* RETURN: The bitmask to be used when accessing the register
|
||||
*
|
||||
* DESCRIPTION: Map RegisterId into a register bit mask.
|
||||
* DESCRIPTION: Map RegisterId into a register bitmask.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -338,8 +353,8 @@ AcpiHwGetBitRegisterInfo (
|
||||
* ReturnValue - Value that was read from the register
|
||||
* Flags - Lock the hardware or not
|
||||
*
|
||||
* RETURN: Value is read from specified Register. Value returned is
|
||||
* normalized to bit0 (is shifted all the way right)
|
||||
* RETURN: Status and the value read from specified Register. Value
|
||||
* returned is normalized to bit0 (is shifted all the way right)
|
||||
*
|
||||
* DESCRIPTION: ACPI BitRegister read function.
|
||||
*
|
||||
@ -376,6 +391,8 @@ AcpiGetRegister (
|
||||
}
|
||||
}
|
||||
|
||||
/* Read from the register */
|
||||
|
||||
Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
|
||||
BitRegInfo->ParentRegister, &RegisterValue);
|
||||
|
||||
@ -407,10 +424,10 @@ AcpiGetRegister (
|
||||
*
|
||||
* PARAMETERS: RegisterId - ID of ACPI BitRegister to access
|
||||
* Value - (only used on write) value to write to the
|
||||
* Register, NOT pre-normalized to the bit pos.
|
||||
* Register, NOT pre-normalized to the bit pos
|
||||
* Flags - Lock the hardware or not
|
||||
*
|
||||
* RETURN: None
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: ACPI Bit Register write function.
|
||||
*
|
||||
@ -451,7 +468,7 @@ AcpiSetRegister (
|
||||
/* Always do a register read first so we can insert the new bits */
|
||||
|
||||
Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
|
||||
BitRegInfo->ParentRegister, &RegisterValue);
|
||||
BitRegInfo->ParentRegister, &RegisterValue);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto UnlockAndExit;
|
||||
@ -491,7 +508,7 @@ AcpiSetRegister (
|
||||
BitRegInfo->AccessBitMask, Value);
|
||||
|
||||
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
|
||||
ACPI_REGISTER_PM1_ENABLE, (UINT16) RegisterValue);
|
||||
ACPI_REGISTER_PM1_ENABLE, (UINT16) RegisterValue);
|
||||
break;
|
||||
|
||||
|
||||
@ -508,7 +525,7 @@ AcpiSetRegister (
|
||||
BitRegInfo->AccessBitMask, Value);
|
||||
|
||||
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
|
||||
ACPI_REGISTER_PM1_CONTROL, (UINT16) RegisterValue);
|
||||
ACPI_REGISTER_PM1_CONTROL, (UINT16) RegisterValue);
|
||||
break;
|
||||
|
||||
|
||||
@ -523,17 +540,19 @@ AcpiSetRegister (
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
|
||||
RegisterValue,
|
||||
ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address))));
|
||||
ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (
|
||||
AcpiGbl_FADT->XPm2CntBlk.Address))));
|
||||
|
||||
ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
|
||||
BitRegInfo->AccessBitMask, Value);
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n",
|
||||
RegisterValue,
|
||||
ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address))));
|
||||
ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (
|
||||
AcpiGbl_FADT->XPm2CntBlk.Address))));
|
||||
|
||||
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
|
||||
ACPI_REGISTER_PM2_CONTROL, (UINT8) (RegisterValue));
|
||||
ACPI_REGISTER_PM2_CONTROL, (UINT8) (RegisterValue));
|
||||
break;
|
||||
|
||||
|
||||
@ -551,7 +570,9 @@ UnlockAndExit:
|
||||
|
||||
/* Normalize the value that was read */
|
||||
|
||||
ACPI_DEBUG_EXEC (RegisterValue = ((RegisterValue & BitRegInfo->AccessBitMask) >> BitRegInfo->BitPosition));
|
||||
ACPI_DEBUG_EXEC (RegisterValue =
|
||||
((RegisterValue & BitRegInfo->AccessBitMask) >>
|
||||
BitRegInfo->BitPosition));
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n",
|
||||
Value, RegisterValue, BitRegInfo->ParentRegister));
|
||||
@ -563,10 +584,11 @@ UnlockAndExit:
|
||||
*
|
||||
* FUNCTION: AcpiHwRegisterRead
|
||||
*
|
||||
* PARAMETERS: UseLock - Mutex hw access.
|
||||
* RegisterId - RegisterID + Offset.
|
||||
* PARAMETERS: UseLock - Mutex hw access
|
||||
* RegisterId - RegisterID + Offset
|
||||
* ReturnValue - Where the register value is returned
|
||||
*
|
||||
* RETURN: Value read or written.
|
||||
* RETURN: Status and the value read.
|
||||
*
|
||||
* DESCRIPTION: Acpi register read function. Registers are read at the
|
||||
* given offset.
|
||||
@ -658,7 +680,8 @@ AcpiHwRegisterRead (
|
||||
break;
|
||||
|
||||
default:
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", RegisterId));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n",
|
||||
RegisterId));
|
||||
Status = AE_BAD_PARAMETER;
|
||||
break;
|
||||
}
|
||||
@ -682,10 +705,11 @@ UnlockAndExit:
|
||||
*
|
||||
* FUNCTION: AcpiHwRegisterWrite
|
||||
*
|
||||
* PARAMETERS: UseLock - Mutex hw access.
|
||||
* RegisterId - RegisterID + Offset.
|
||||
* PARAMETERS: UseLock - Mutex hw access
|
||||
* RegisterId - RegisterID + Offset
|
||||
* Value - The value to write
|
||||
*
|
||||
* RETURN: Value read or written.
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Acpi register Write function. Registers are written at the
|
||||
* given offset.
|
||||
@ -808,11 +832,11 @@ UnlockAndExit:
|
||||
*
|
||||
* PARAMETERS: Width - 8, 16, or 32
|
||||
* Value - Where the value is returned
|
||||
* Register - GAS register structure
|
||||
* Reg - GAS register structure
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Read from either memory, IO, or PCI config space.
|
||||
* DESCRIPTION: Read from either memory or IO space.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -822,8 +846,7 @@ AcpiHwLowLevelRead (
|
||||
UINT32 *Value,
|
||||
ACPI_GENERIC_ADDRESS *Reg)
|
||||
{
|
||||
ACPI_PCI_ID PciId;
|
||||
UINT16 PciRegister;
|
||||
UINT64 Address;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
@ -835,43 +858,37 @@ AcpiHwLowLevelRead (
|
||||
* a non-zero address within. However, don't return an error
|
||||
* because the PM1A/B code must not fail if B isn't present.
|
||||
*/
|
||||
if ((!Reg) ||
|
||||
(!ACPI_VALID_ADDRESS (Reg->Address)))
|
||||
if (!Reg)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/* Get a local copy of the address. Handles possible alignment issues */
|
||||
|
||||
ACPI_MOVE_64_TO_64 (&Address, &Reg->Address);
|
||||
if (!ACPI_VALID_ADDRESS (Address))
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
*Value = 0;
|
||||
|
||||
/*
|
||||
* Three address spaces supported:
|
||||
* Memory, IO, or PCI_Config.
|
||||
* Two address spaces supported: Memory or IO.
|
||||
* PCI_Config is not supported here because the GAS struct is insufficient
|
||||
*/
|
||||
switch (Reg->AddressSpaceId)
|
||||
{
|
||||
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
|
||||
|
||||
Status = AcpiOsReadMemory (
|
||||
(ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Reg->Address),
|
||||
(ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Address),
|
||||
Value, Width);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_ADR_SPACE_SYSTEM_IO:
|
||||
|
||||
Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Reg->Address),
|
||||
Value, Width);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_ADR_SPACE_PCI_CONFIG:
|
||||
|
||||
PciId.Segment = 0;
|
||||
PciId.Bus = 0;
|
||||
PciId.Device = ACPI_PCI_DEVICE (ACPI_GET_ADDRESS (Reg->Address));
|
||||
PciId.Function = ACPI_PCI_FUNCTION (ACPI_GET_ADDRESS (Reg->Address));
|
||||
PciRegister = (UINT16) ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address));
|
||||
|
||||
Status = AcpiOsReadPciConfiguration (&PciId, PciRegister,
|
||||
Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Address),
|
||||
Value, Width);
|
||||
break;
|
||||
|
||||
@ -882,10 +899,11 @@ AcpiHwLowLevelRead (
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
|
||||
*Value, Width,
|
||||
ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Reg->Address)),
|
||||
AcpiUtGetRegionName (Reg->AddressSpaceId)));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_IO,
|
||||
"Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
|
||||
*Value, Width,
|
||||
ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Address)),
|
||||
AcpiUtGetRegionName (Reg->AddressSpaceId)));
|
||||
|
||||
return (Status);
|
||||
}
|
||||
@ -897,11 +915,11 @@ AcpiHwLowLevelRead (
|
||||
*
|
||||
* PARAMETERS: Width - 8, 16, or 32
|
||||
* Value - To be written
|
||||
* Register - GAS register structure
|
||||
* Reg - GAS register structure
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Write to either memory, IO, or PCI config space.
|
||||
* DESCRIPTION: Write to either memory or IO space.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -911,8 +929,7 @@ AcpiHwLowLevelWrite (
|
||||
UINT32 Value,
|
||||
ACPI_GENERIC_ADDRESS *Reg)
|
||||
{
|
||||
ACPI_PCI_ID PciId;
|
||||
UINT16 PciRegister;
|
||||
UINT64 Address;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
@ -924,56 +941,51 @@ AcpiHwLowLevelWrite (
|
||||
* a non-zero address within. However, don't return an error
|
||||
* because the PM1A/B code must not fail if B isn't present.
|
||||
*/
|
||||
if ((!Reg) ||
|
||||
(!ACPI_VALID_ADDRESS (Reg->Address)))
|
||||
if (!Reg)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/* Get a local copy of the address. Handles possible alignment issues */
|
||||
|
||||
ACPI_MOVE_64_TO_64 (&Address, &Reg->Address);
|
||||
if (!ACPI_VALID_ADDRESS (Address))
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Three address spaces supported:
|
||||
* Memory, IO, or PCI_Config.
|
||||
* Two address spaces supported: Memory or IO.
|
||||
* PCI_Config is not supported here because the GAS struct is insufficient
|
||||
*/
|
||||
switch (Reg->AddressSpaceId)
|
||||
{
|
||||
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
|
||||
|
||||
Status = AcpiOsWriteMemory (
|
||||
(ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Reg->Address),
|
||||
(ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Address),
|
||||
Value, Width);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_ADR_SPACE_SYSTEM_IO:
|
||||
|
||||
Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Reg->Address),
|
||||
Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Address),
|
||||
Value, Width);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_ADR_SPACE_PCI_CONFIG:
|
||||
|
||||
PciId.Segment = 0;
|
||||
PciId.Bus = 0;
|
||||
PciId.Device = ACPI_PCI_DEVICE (ACPI_GET_ADDRESS (Reg->Address));
|
||||
PciId.Function = ACPI_PCI_FUNCTION (ACPI_GET_ADDRESS (Reg->Address));
|
||||
PciRegister = (UINT16) ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address));
|
||||
|
||||
Status = AcpiOsWritePciConfiguration (&PciId, PciRegister,
|
||||
(ACPI_INTEGER) Value, Width);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Unsupported address space: %X\n", Reg->AddressSpaceId));
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
|
||||
Value, Width,
|
||||
ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Reg->Address)),
|
||||
AcpiUtGetRegionName (Reg->AddressSpaceId)));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_IO,
|
||||
"Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
|
||||
Value, Width,
|
||||
ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Address)),
|
||||
AcpiUtGetRegionName (Reg->AddressSpaceId)));
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
|
||||
* $Revision: 1.70 $
|
||||
* $Revision: 1.75 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -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 (ACPI_ISR);
|
||||
Status = AcpiHwDisableAllGpes ();
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
AcpiGbl_SystemAwakeAndRunning = FALSE;
|
||||
|
||||
Status = AcpiHwEnableAllWakeupGpes (ACPI_ISR);
|
||||
Status = AcpiHwEnableAllWakeupGpes ();
|
||||
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 (ACPI_ISR);
|
||||
Status = AcpiHwDisableAllGpes ();
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
AcpiGbl_SystemAwakeAndRunning = FALSE;
|
||||
|
||||
Status = AcpiHwEnableAllWakeupGpes (ACPI_ISR);
|
||||
Status = AcpiHwEnableAllWakeupGpes ();
|
||||
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
|
||||
*
|
||||
@ -645,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? */
|
||||
|
||||
@ -667,14 +671,14 @@ AcpiLeaveSleepState (
|
||||
* 1) Disable/Clear all GPEs
|
||||
* 2) Enable all runtime GPEs
|
||||
*/
|
||||
Status = AcpiHwDisableAllGpes (ACPI_NOT_ISR);
|
||||
Status = AcpiHwDisableAllGpes ();
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
AcpiGbl_SystemAwakeAndRunning = TRUE;
|
||||
|
||||
Status = AcpiHwEnableAllRuntimeGpes (ACPI_NOT_ISR);
|
||||
Status = AcpiHwEnableAllRuntimeGpes ();
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
@ -682,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 */
|
||||
@ -699,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);
|
||||
|
Loading…
Reference in New Issue
Block a user