diff options
author | jkim <jkim@FreeBSD.org> | 2010-07-06 20:57:28 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2010-07-06 20:57:28 +0000 |
commit | ee32cc37846fecf2cb4ccc3dbb6b5b016d146813 (patch) | |
tree | a1a1e6ac1daa6cd0de9bf90f7809c15a3f9bc326 /sys/contrib/dev/acpica/hardware | |
parent | a3fd34d6553f34a17c1ec61d3694f885e251cf65 (diff) | |
parent | 9ef1b91c0f59a1a15565c354b3e372ab265c7b5a (diff) | |
download | FreeBSD-src-ee32cc37846fecf2cb4ccc3dbb6b5b016d146813.zip FreeBSD-src-ee32cc37846fecf2cb4ccc3dbb6b5b016d146813.tar.gz |
Merge ACPICA 20100702.
Diffstat (limited to 'sys/contrib/dev/acpica/hardware')
-rw-r--r-- | sys/contrib/dev/acpica/hardware/hwgpe.c | 124 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/hardware/hwsleep.c | 2 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/hardware/hwvalid.c | 14 |
3 files changed, 86 insertions, 54 deletions
diff --git a/sys/contrib/dev/acpica/hardware/hwgpe.c b/sys/contrib/dev/acpica/hardware/hwgpe.c index 5b02856..da21e30 100644 --- a/sys/contrib/dev/acpica/hardware/hwgpe.c +++ b/sys/contrib/dev/acpica/hardware/hwgpe.c @@ -132,23 +132,54 @@ AcpiHwEnableWakeupGpeBlock ( /****************************************************************************** * - * FUNCTION: AcpiHwLowDisableGpe + * FUNCTION: AcpiHwGetGpeRegisterBit + * + * PARAMETERS: GpeEventInfo - Info block for the GPE + * GpeRegisterInfo - Info block for the GPE register + * + * RETURN: Register mask with a one in the GPE bit position + * + * DESCRIPTION: Compute the register mask for this GPE. One bit is set in the + * correct position for the input GPE. + * + ******************************************************************************/ + +UINT32 +AcpiHwGetGpeRegisterBit ( + ACPI_GPE_EVENT_INFO *GpeEventInfo, + ACPI_GPE_REGISTER_INFO *GpeRegisterInfo) +{ + + return ((UINT32) 1 << + (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber)); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiHwLowSetGpe * * PARAMETERS: GpeEventInfo - Info block for the GPE to be disabled + * Action - Enable or disable * * RETURN: Status * - * DESCRIPTION: Disable a single GPE in the enable register. + * DESCRIPTION: Enable or disable a single GPE in the parent enable register. * ******************************************************************************/ ACPI_STATUS -AcpiHwLowDisableGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) +AcpiHwLowSetGpe ( + ACPI_GPE_EVENT_INFO *GpeEventInfo, + UINT32 Action) { ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; ACPI_STATUS Status; UINT32 EnableMask; + UINT32 RegisterBit; + + + ACPI_FUNCTION_ENTRY (); /* Get the info block for the entire GPE register */ @@ -167,57 +198,38 @@ AcpiHwLowDisableGpe ( return (Status); } - /* Clear just the bit that corresponds to this GPE */ - - ACPI_CLEAR_BIT (EnableMask, ((UINT32) 1 << - (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber))); - - - /* Write the updated enable mask */ - - Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); - return (Status); -} - + /* Set or clear just the bit that corresponds to this GPE */ -/****************************************************************************** - * - * FUNCTION: AcpiHwWriteGpeEnableReg - * - * PARAMETERS: GpeEventInfo - Info block for the GPE to be enabled - * - * RETURN: Status - * - * DESCRIPTION: Write a GPE enable register. Note: The bit for this GPE must - * already be cleared or set in the parent register - * EnableForRun mask. - * - ******************************************************************************/ + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); + switch (Action) + { + case ACPI_GPE_CONDITIONAL_ENABLE: -ACPI_STATUS -AcpiHwWriteGpeEnableReg ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) -{ - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - ACPI_STATUS Status; + /* Only enable if the EnableForRun bit is set */ + if (!(RegisterBit & GpeRegisterInfo->EnableForRun)) + { + return (AE_BAD_PARAMETER); + } - ACPI_FUNCTION_ENTRY (); + /*lint -fallthrough */ + case ACPI_GPE_ENABLE: + ACPI_SET_BIT (EnableMask, RegisterBit); + break; - /* Get the info block for the entire GPE register */ + case ACPI_GPE_DISABLE: + ACPI_CLEAR_BIT (EnableMask, RegisterBit); + break; - GpeRegisterInfo = GpeEventInfo->RegisterInfo; - if (!GpeRegisterInfo) - { - return (AE_NOT_EXIST); + default: + ACPI_ERROR ((AE_INFO, "Invalid GPE Action, %u\n", Action)); + return (AE_BAD_PARAMETER); } - /* Write the entire GPE (runtime) enable register */ - - Status = AcpiHwWrite (GpeRegisterInfo->EnableForRun, - &GpeRegisterInfo->EnableAddress); + /* Write the updated enable mask */ + Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); return (Status); } @@ -238,22 +250,29 @@ ACPI_STATUS AcpiHwClearGpe ( ACPI_GPE_EVENT_INFO *GpeEventInfo) { + ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; ACPI_STATUS Status; - UINT8 RegisterBit; + UINT32 RegisterBit; ACPI_FUNCTION_ENTRY (); + /* Get the info block for the entire GPE register */ - RegisterBit = (UINT8) (1 << - (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber)); + GpeRegisterInfo = GpeEventInfo->RegisterInfo; + if (!GpeRegisterInfo) + { + return (AE_NOT_EXIST); + } /* * Write a one to the appropriate bit in the status register to * clear this GPE. */ + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); + Status = AcpiHwWrite (RegisterBit, - &GpeEventInfo->RegisterInfo->StatusAddress); + &GpeRegisterInfo->StatusAddress); return (Status); } @@ -278,10 +297,10 @@ AcpiHwGetGpeStatus ( ACPI_EVENT_STATUS *EventStatus) { UINT32 InByte; - UINT8 RegisterBit; + UINT32 RegisterBit; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - ACPI_STATUS Status; ACPI_EVENT_STATUS LocalEventStatus = 0; + ACPI_STATUS Status; ACPI_FUNCTION_ENTRY (); @@ -298,8 +317,7 @@ AcpiHwGetGpeStatus ( /* Get the register bitmask for this GPE */ - RegisterBit = (UINT8) (1 << - (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber)); + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); /* GPE currently enabled? (enabled for runtime?) */ diff --git a/sys/contrib/dev/acpica/hardware/hwsleep.c b/sys/contrib/dev/acpica/hardware/hwsleep.c index 913deb3..cccb542 100644 --- a/sys/contrib/dev/acpica/hardware/hwsleep.c +++ b/sys/contrib/dev/acpica/hardware/hwsleep.c @@ -397,7 +397,7 @@ AcpiEnterSleepState ( return_ACPI_STATUS (Status); } ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "Entering sleep state [S%d]\n", SleepState)); + "Entering sleep state [S%u]\n", SleepState)); /* Clear the SLP_EN and SLP_TYP fields */ diff --git a/sys/contrib/dev/acpica/hardware/hwvalid.c b/sys/contrib/dev/acpica/hardware/hwvalid.c index a715053..f23b269 100644 --- a/sys/contrib/dev/acpica/hardware/hwvalid.c +++ b/sys/contrib/dev/acpica/hardware/hwvalid.c @@ -316,6 +316,13 @@ AcpiHwReadPort ( UINT32 i; + /* Truncate address to 16 bits if requested */ + + if (AcpiGbl_TruncateIoAddresses) + { + Address &= ACPI_UINT16_MAX; + } + /* Validate the entire request and perform the I/O */ Status = AcpiHwValidateIoRequest (Address, Width); @@ -383,6 +390,13 @@ AcpiHwWritePort ( UINT32 i; + /* Truncate address to 16 bits if requested */ + + if (AcpiGbl_TruncateIoAddresses) + { + Address &= ACPI_UINT16_MAX; + } + /* Validate the entire request and perform the I/O */ Status = AcpiHwValidateIoRequest (Address, Width); |