diff options
Diffstat (limited to 'sys/contrib/dev/acpica/evxfevnt.c')
-rw-r--r-- | sys/contrib/dev/acpica/evxfevnt.c | 89 |
1 files changed, 65 insertions, 24 deletions
diff --git a/sys/contrib/dev/acpica/evxfevnt.c b/sys/contrib/dev/acpica/evxfevnt.c index 463985d..5d121a8 100644 --- a/sys/contrib/dev/acpica/evxfevnt.c +++ b/sys/contrib/dev/acpica/evxfevnt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable - * $Revision: 28 $ + * $Revision: 33 $ * *****************************************************************************/ @@ -124,11 +124,11 @@ #include "amlcode.h" #include "acinterp.h" -#define _COMPONENT EVENT_HANDLING +#define _COMPONENT ACPI_EVENTS MODULE_NAME ("evxfevnt") -/************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEnable * @@ -138,7 +138,7 @@ * * DESCRIPTION: Transfers the system into ACPI mode. * - *************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiEnable (void) @@ -153,7 +153,7 @@ AcpiEnable (void) if (!AcpiGbl_DSDT) { - DEBUG_PRINT (ACPI_WARN, ("No ACPI tables present!\n")); + DEBUG_PRINTP (ACPI_WARN, ("No ACPI tables present!\n")); return_ACPI_STATUS (AE_NO_ACPI_TABLES); } @@ -161,8 +161,7 @@ AcpiEnable (void) if (SYS_MODE_LEGACY == AcpiHwGetModeCapabilities()) { - DEBUG_PRINT (ACPI_WARN, - ("AcpiEnable: Only legacy mode supported!\n")); + DEBUG_PRINTP (ACPI_WARN, ("Only legacy mode supported!\n")); return_ACPI_STATUS (AE_ERROR); } @@ -171,17 +170,17 @@ AcpiEnable (void) Status = AcpiHwSetMode (SYS_MODE_ACPI); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_FATAL, ("Could not transition to ACPI mode.\n")); + DEBUG_PRINTP (ACPI_FATAL, ("Could not transition to ACPI mode.\n")); return_ACPI_STATUS (Status); } - DEBUG_PRINT (ACPI_OK, ("Transition to ACPI mode successful\n")); + DEBUG_PRINTP (ACPI_OK, ("Transition to ACPI mode successful\n")); return_ACPI_STATUS (Status); } -/************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiDisable * @@ -192,7 +191,7 @@ AcpiEnable (void) * DESCRIPTION: Returns the system to original ACPI/legacy mode, and * uninstalls the SCI interrupt handler. * - *************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiDisable (void) @@ -203,12 +202,20 @@ AcpiDisable (void) FUNCTION_TRACE ("AcpiDisable"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Restore original mode */ Status = AcpiHwSetMode (AcpiGbl_OriginalMode); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, ("Unable to transition to original mode")); + DEBUG_PRINTP (ACPI_ERROR, ("Unable to transition to original mode")); return_ACPI_STATUS (Status); } @@ -221,7 +228,7 @@ AcpiDisable (void) } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEnableEvent * @@ -246,6 +253,14 @@ AcpiEnableEvent ( FUNCTION_TRACE ("AcpiEnableEvent"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* The Type must be either Fixed AcpiEvent or GPE */ switch (Type) @@ -291,8 +306,9 @@ AcpiEnableEvent ( 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_ERROR); + DEBUG_PRINTP (ACPI_ERROR, + ("Fixed event bit clear when it should be set\n")); + return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); } break; @@ -302,7 +318,7 @@ AcpiEnableEvent ( /* Ensure that we have a valid GPE number */ - if ((Event >= NUM_GPE) || + if ((Event > ACPI_GPE_MAX) || (AcpiGbl_GpeValid[Event] == ACPI_GPE_INVALID)) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -325,7 +341,7 @@ AcpiEnableEvent ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiDisableEvent * @@ -350,6 +366,14 @@ AcpiDisableEvent ( FUNCTION_TRACE ("AcpiDisableEvent"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* The Type must be either Fixed AcpiEvent or GPE */ switch (Type) @@ -395,8 +419,9 @@ AcpiDisableEvent ( 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_ERROR); + DEBUG_PRINTP (ACPI_ERROR, + ("Fixed event bit set when it should be clear,\n")); + return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); } break; @@ -406,7 +431,7 @@ AcpiDisableEvent ( /* Ensure that we have a valid GPE number */ - if ((Event >= NUM_GPE) || + if ((Event > ACPI_GPE_MAX) || (AcpiGbl_GpeValid[Event] == ACPI_GPE_INVALID)) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -426,7 +451,7 @@ AcpiDisableEvent ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiClearEvent * @@ -451,6 +476,14 @@ AcpiClearEvent ( FUNCTION_TRACE ("AcpiClearEvent"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* The Type must be either Fixed AcpiEvent or GPE */ switch (Type) @@ -500,7 +533,7 @@ AcpiClearEvent ( /* Ensure that we have a valid GPE number */ - if ((Event >= NUM_GPE) || + if ((Event > ACPI_GPE_MAX) || (AcpiGbl_GpeValid[Event] == ACPI_GPE_INVALID)) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -520,7 +553,7 @@ AcpiClearEvent ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiGetEventStatus * @@ -549,6 +582,14 @@ AcpiGetEventStatus ( FUNCTION_TRACE ("AcpiGetEventStatus"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + if (!EventStatus) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -601,7 +642,7 @@ AcpiGetEventStatus ( /* Ensure that we have a valid GPE number */ - if ((Event >= NUM_GPE) || + if ((Event > ACPI_GPE_MAX) || (AcpiGbl_GpeValid[Event] == ACPI_GPE_INVALID)) { return_ACPI_STATUS (AE_BAD_PARAMETER); |