2005-04-17 06:20:36 +08:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: evgpe - General Purpose Event handling and dispatch
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2008-04-24 11:00:13 +08:00
|
|
|
* Copyright (C) 2000 - 2008, Intel Corp.
|
2005-04-17 06:20:36 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions, and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
|
|
|
* substantially similar to the "NO WARRANTY" disclaimer below
|
|
|
|
* ("Disclaimer") and any redistribution must be conditioned upon
|
|
|
|
* including a substantially similar Disclaimer requirement for further
|
|
|
|
* binary redistribution.
|
|
|
|
* 3. Neither the names of the above-listed copyright holders nor the names
|
|
|
|
* of any contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of the
|
|
|
|
* GNU General Public License ("GPL") version 2 as published by the Free
|
|
|
|
* Software Foundation.
|
|
|
|
*
|
|
|
|
* NO WARRANTY
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGES.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <acpi/acpi.h>
|
2009-01-09 13:30:03 +08:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "acevents.h"
|
|
|
|
#include "acnamesp.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_EVENTS
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_MODULE_NAME("evgpe")
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
/* Local prototypes */
|
2005-08-05 12:44:28 +08:00
|
|
|
static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_set_gpe_type
|
|
|
|
*
|
|
|
|
* PARAMETERS: gpe_event_info - GPE to set
|
|
|
|
* Type - New type
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Sets the new type for the GPE (wake, run, or wake/run)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ev_set_gpe_type);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Validate type and update register enable masks */
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case ACPI_GPE_TYPE_WAKE:
|
|
|
|
case ACPI_GPE_TYPE_RUNTIME:
|
|
|
|
case ACPI_GPE_TYPE_WAKE_RUN:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Disable the GPE if currently enabled */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ev_disable_gpe(gpe_event_info);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Type was validated above */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */
|
|
|
|
gpe_event_info->flags |= type; /* Insert type */
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_update_gpe_enable_masks
|
|
|
|
*
|
|
|
|
* PARAMETERS: gpe_event_info - GPE to update
|
|
|
|
* Type - What to do: ACPI_GPE_DISABLE or
|
|
|
|
* ACPI_GPE_ENABLE
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Updates GPE register enable masks based on the GPE type
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
|
|
|
|
u8 type)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
struct acpi_gpe_register_info *gpe_register_info;
|
|
|
|
u8 register_bit;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
gpe_register_info = gpe_event_info->register_info;
|
|
|
|
if (!gpe_register_info) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_NOT_EXIST);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2007-02-03 00:48:19 +08:00
|
|
|
register_bit = (u8)
|
|
|
|
(1 <<
|
|
|
|
(gpe_event_info->gpe_number - gpe_register_info->base_gpe_number));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-11-12 16:01:56 +08:00
|
|
|
/* 1) Disable case. Simply clear all enable bits */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (type == ACPI_GPE_DISABLE) {
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
|
|
|
|
register_bit);
|
|
|
|
ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
|
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2008-11-12 16:01:56 +08:00
|
|
|
/* 2) Enable case. Set/Clear the appropriate enable bits */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
|
|
|
|
case ACPI_GPE_TYPE_WAKE:
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit);
|
|
|
|
ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_GPE_TYPE_RUNTIME:
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
|
|
|
|
register_bit);
|
|
|
|
ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_GPE_TYPE_WAKE_RUN:
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit);
|
|
|
|
ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_enable_gpe
|
|
|
|
*
|
|
|
|
* PARAMETERS: gpe_event_info - GPE to enable
|
|
|
|
* write_to_hardware - Enable now, or just mark data structs
|
|
|
|
* (WAKE GPEs should be deferred)
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Enable a GPE based on the GPE type
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
|
|
|
|
u8 write_to_hardware)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ev_enable_gpe);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Make sure HW enable masks are updated */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
|
|
|
acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_ENABLE);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Mark wake-enabled or HW enable, or both */
|
|
|
|
|
|
|
|
switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
|
|
|
|
case ACPI_GPE_TYPE_WAKE:
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_GPE_TYPE_WAKE_RUN:
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*lint -fallthrough */
|
|
|
|
|
|
|
|
case ACPI_GPE_TYPE_RUNTIME:
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (write_to_hardware) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Clear the GPE (of stale events), then enable it */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_hw_clear_gpe(gpe_event_info);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable the requested runtime GPE */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_hw_write_gpe_enable_reg(gpe_event_info);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_disable_gpe
|
|
|
|
*
|
|
|
|
* PARAMETERS: gpe_event_info - GPE to disable
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Disable a GPE based on the GPE type
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ev_disable_gpe);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Make sure HW enable masks are updated */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
|
|
|
acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_DISABLE);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2008-06-13 08:28:55 +08:00
|
|
|
/* Clear the appropriate enabled flags for this GPE */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
|
|
|
|
case ACPI_GPE_TYPE_WAKE:
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_GPE_TYPE_WAKE_RUN:
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: disable stray GPE, prevent ACPI interrupt storm
GPEs are disabled depending on their type --
WAKE, WAKE_RUN, and RUNTIME. An error is returned
if we are asked to disable a GPE that has no type.
But at least one system exists that enables a GPE from AML
that is not the EC GPE, and has no _Lxx/_Exx AML handler,
and is thus never initialized.
In this case, when an external CRT is plugged in,
the GPE fires, we attempt to disable the GPE,
but instead just return an error.
So the GPE stays asserted and an ACPI interrupt storm follows.
The fix is to disable a firing GPE,
even if it comes from outer space.
http://bugzilla.kernel.org/show_bug.cgi?id=6217
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-11-21 02:38:59 +08:00
|
|
|
/* fallthrough */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
case ACPI_GPE_TYPE_RUNTIME:
|
|
|
|
|
|
|
|
/* Disable the requested runtime GPE */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
|
2008-06-13 08:28:55 +08:00
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
default:
|
2008-06-13 08:28:55 +08:00
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2008-06-13 08:28:55 +08:00
|
|
|
/*
|
|
|
|
* Even if we don't know the GPE type, make sure that we always
|
|
|
|
* disable it. low_disable_gpe will just clear the enable bit for this
|
|
|
|
* GPE and write it. It will not write out the current GPE enable mask,
|
|
|
|
* since this may inadvertently enable GPEs too early, if a rogue GPE has
|
|
|
|
* come in during ACPICA initialization - possibly as a result of AML or
|
|
|
|
* other code that has enabled the GPE.
|
|
|
|
*/
|
|
|
|
status = acpi_hw_low_disable_gpe(gpe_event_info);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_get_gpe_event_info
|
|
|
|
*
|
2008-11-12 16:01:56 +08:00
|
|
|
* PARAMETERS: gpe_device - Device node. NULL for GPE0/GPE1
|
2005-04-17 06:20:36 +08:00
|
|
|
* gpe_number - Raw GPE number
|
|
|
|
*
|
|
|
|
* RETURN: A GPE event_info struct. NULL if not a valid GPE
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Returns the event_info struct associated with this GPE.
|
|
|
|
* Validates the gpe_block and the gpe_number
|
|
|
|
*
|
|
|
|
* Should be called only when the GPE lists are semaphore locked
|
|
|
|
* and not subject to change.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
|
|
|
|
u32 gpe_number)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
struct acpi_gpe_block_info *gpe_block;
|
2008-06-10 13:42:13 +08:00
|
|
|
u32 i;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_FUNCTION_ENTRY();
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* A NULL gpe_block means use the FADT-defined GPE block(s) */
|
|
|
|
|
|
|
|
if (!gpe_device) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Examine GPE Block 0 and 1 (These blocks are permanent) */
|
|
|
|
|
|
|
|
for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) {
|
|
|
|
gpe_block = acpi_gbl_gpe_fadt_blocks[i];
|
|
|
|
if (gpe_block) {
|
2005-08-05 12:44:28 +08:00
|
|
|
if ((gpe_number >= gpe_block->block_base_number)
|
|
|
|
&& (gpe_number <
|
|
|
|
gpe_block->block_base_number +
|
|
|
|
(gpe_block->register_count * 8))) {
|
|
|
|
return (&gpe_block->
|
|
|
|
event_info[gpe_number -
|
|
|
|
gpe_block->
|
|
|
|
block_base_number]);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The gpe_number was not in the range of either FADT GPE block */
|
|
|
|
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* A Non-NULL gpe_device means this is a GPE Block Device */
|
|
|
|
|
2007-05-10 11:34:35 +08:00
|
|
|
obj_desc = acpi_ns_get_attached_object((struct acpi_namespace_node *)
|
|
|
|
gpe_device);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (!obj_desc || !obj_desc->device.gpe_block) {
|
2005-04-17 06:20:36 +08:00
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
gpe_block = obj_desc->device.gpe_block;
|
|
|
|
|
|
|
|
if ((gpe_number >= gpe_block->block_base_number) &&
|
2005-08-05 12:44:28 +08:00
|
|
|
(gpe_number <
|
|
|
|
gpe_block->block_base_number + (gpe_block->register_count * 8))) {
|
|
|
|
return (&gpe_block->
|
|
|
|
event_info[gpe_number - gpe_block->block_base_number]);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_gpe_detect
|
|
|
|
*
|
|
|
|
* PARAMETERS: gpe_xrupt_list - Interrupt block for this interrupt.
|
|
|
|
* Can have multiple GPE blocks attached.
|
|
|
|
*
|
|
|
|
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
|
|
|
|
*
|
2008-11-12 16:01:56 +08:00
|
|
|
* DESCRIPTION: Detect if any GP events have occurred. This function is
|
2005-04-17 06:20:36 +08:00
|
|
|
* executed at interrupt level.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-10-21 12:00:00 +08:00
|
|
|
acpi_status status;
|
|
|
|
struct acpi_gpe_block_info *gpe_block;
|
|
|
|
struct acpi_gpe_register_info *gpe_register_info;
|
2005-08-05 12:44:28 +08:00
|
|
|
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
|
|
|
|
u8 enabled_status_byte;
|
|
|
|
u32 status_reg;
|
|
|
|
u32 enable_reg;
|
2006-01-28 05:43:00 +08:00
|
|
|
acpi_cpu_flags flags;
|
2008-06-10 13:42:13 +08:00
|
|
|
u32 i;
|
|
|
|
u32 j;
|
2005-08-05 12:44:28 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_NAME(ev_gpe_detect);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Check for the case where there are no GPEs */
|
|
|
|
|
|
|
|
if (!gpe_xrupt_list) {
|
|
|
|
return (int_status);
|
|
|
|
}
|
|
|
|
|
2006-06-24 05:04:00 +08:00
|
|
|
/*
|
|
|
|
* We need to obtain the GPE lock for both the data structs and registers
|
2008-11-12 16:01:56 +08:00
|
|
|
* Note: Not necessary to obtain the hardware lock, since the GPE
|
|
|
|
* registers are owned by the gpe_lock.
|
2006-06-24 05:04:00 +08:00
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2006-06-09 04:29:00 +08:00
|
|
|
|
|
|
|
/* Examine all GPE blocks attached to this interrupt level */
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
gpe_block = gpe_xrupt_list->gpe_block_list_head;
|
|
|
|
while (gpe_block) {
|
|
|
|
/*
|
2008-11-12 16:01:56 +08:00
|
|
|
* Read all of the 8-bit GPE status and enable registers in this GPE
|
|
|
|
* block, saving all of them. Find all currently active GP events.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
for (i = 0; i < gpe_block->register_count; i++) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Get the next status/enable pair */
|
|
|
|
|
|
|
|
gpe_register_info = &gpe_block->register_info[i];
|
|
|
|
|
|
|
|
/* Read the Status Register */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
2008-12-31 02:55:32 +08:00
|
|
|
acpi_read(&status_reg,
|
|
|
|
&gpe_register_info->status_address);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Read the Enable Register */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
2008-12-31 02:55:32 +08:00
|
|
|
acpi_read(&enable_reg,
|
|
|
|
&gpe_register_info->enable_address);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
|
|
|
|
"Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
|
|
|
|
gpe_register_info->base_gpe_number,
|
|
|
|
status_reg, enable_reg));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
/* Check if there is anything active at all in this register */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
enabled_status_byte = (u8) (status_reg & enable_reg);
|
|
|
|
if (!enabled_status_byte) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* No active GPEs in this register, move on */
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now look at the individual GPEs in this byte register */
|
|
|
|
|
|
|
|
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Examine one GPE bit */
|
|
|
|
|
2007-02-03 00:48:19 +08:00
|
|
|
if (enabled_status_byte & (1 << j)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Found an active GPE. Dispatch the event to a handler
|
|
|
|
* or method.
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
int_status |=
|
|
|
|
acpi_ev_gpe_dispatch(&gpe_block->
|
2008-06-10 13:42:13 +08:00
|
|
|
event_info[((acpi_size) i * ACPI_GPE_REGISTER_WIDTH) + j], j + gpe_register_info->base_gpe_number);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gpe_block = gpe_block->next;
|
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
unlock_and_exit:
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
return (int_status);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_asynch_execute_gpe_method
|
|
|
|
*
|
|
|
|
* PARAMETERS: Context (gpe_event_info) - Info for this GPE
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
2006-05-27 04:36:00 +08:00
|
|
|
* DESCRIPTION: Perform the actual execution of a GPE control method. This
|
|
|
|
* function is called from an invocation of acpi_os_execute and
|
|
|
|
* therefore does NOT execute at interrupt level - so that
|
2005-04-17 06:20:36 +08:00
|
|
|
* the control method itself is not executed in the context of
|
|
|
|
* an interrupt handler.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2007-11-13 18:05:45 +08:00
|
|
|
static void acpi_ev_asynch_enable_gpe(void *context);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
struct acpi_gpe_event_info *gpe_event_info = (void *)context;
|
|
|
|
acpi_status status;
|
|
|
|
struct acpi_gpe_event_info local_gpe_event_info;
|
2006-05-27 04:36:00 +08:00
|
|
|
struct acpi_evaluate_info *info;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Must revalidate the gpe_number/gpe_block */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
if (!acpi_ev_valid_gpe_event(gpe_event_info)) {
|
|
|
|
status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
2005-04-17 06:20:36 +08:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the GPE flags for return to enabled state */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
(void)acpi_ev_enable_gpe(gpe_event_info, FALSE);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
2008-11-12 16:01:56 +08:00
|
|
|
* Take a snapshot of the GPE info for this level - we copy the info to
|
|
|
|
* prevent a race condition with remove_handler/remove_block.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_MEMCPY(&local_gpe_event_info, gpe_event_info,
|
|
|
|
sizeof(struct acpi_gpe_event_info));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-11-12 16:01:56 +08:00
|
|
|
* Must check for control method type dispatch one more time to avoid a
|
|
|
|
* race with ev_gpe_install_handler
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2005-04-19 10:49:35 +08:00
|
|
|
if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) ==
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_GPE_DISPATCH_METHOD) {
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-05-27 04:36:00 +08:00
|
|
|
/* Allocate the evaluation information block */
|
|
|
|
|
|
|
|
info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
|
|
|
|
if (!info) {
|
|
|
|
status = AE_NO_MEMORY;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
|
|
|
|
* control method that corresponds to this GPE
|
|
|
|
*/
|
|
|
|
info->prefix_node =
|
|
|
|
local_gpe_event_info.dispatch.method_node;
|
|
|
|
info->flags = ACPI_IGNORE_RETURN_VALUE;
|
|
|
|
|
|
|
|
status = acpi_ns_evaluate(info);
|
|
|
|
ACPI_FREE(info);
|
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_EXCEPTION((AE_INFO, status,
|
2007-02-03 00:48:18 +08:00
|
|
|
"while evaluating GPE method [%4.4s]",
|
2006-01-28 05:43:00 +08:00
|
|
|
acpi_ut_get_node_name
|
|
|
|
(local_gpe_event_info.dispatch.
|
2006-06-09 04:29:00 +08:00
|
|
|
method_node)));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
2007-11-13 18:05:45 +08:00
|
|
|
/* Defer enabling of GPE until all notify handlers are done */
|
|
|
|
acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_asynch_enable_gpe,
|
|
|
|
gpe_event_info);
|
|
|
|
return_VOID;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-11-13 18:05:45 +08:00
|
|
|
static void acpi_ev_asynch_enable_gpe(void *context)
|
|
|
|
{
|
|
|
|
struct acpi_gpe_event_info *gpe_event_info = context;
|
|
|
|
acpi_status status;
|
|
|
|
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_GPE_LEVEL_TRIGGERED) {
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2008-11-12 16:01:56 +08:00
|
|
|
* GPE is level-triggered, we clear the GPE status bit after handling
|
|
|
|
* the event.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2007-11-13 18:05:45 +08:00
|
|
|
status = acpi_hw_clear_gpe(gpe_event_info);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable this GPE */
|
2007-11-13 18:05:45 +08:00
|
|
|
(void)acpi_hw_write_gpe_enable_reg(gpe_event_info);
|
2005-04-17 06:20:36 +08:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_gpe_dispatch
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* PARAMETERS: gpe_event_info - Info for this GPE
|
2005-04-17 06:20:36 +08:00
|
|
|
* gpe_number - Number relative to the parent GPE block
|
|
|
|
*
|
|
|
|
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Dispatch a General Purpose Event to either a function (e.g. EC)
|
|
|
|
* or method (e.g. _Lxx/_Exx) handler.
|
|
|
|
*
|
|
|
|
* This function executes at interrupt level.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
u32
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ev_gpe_dispatch);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-02-06 14:26:55 +08:00
|
|
|
acpi_os_gpe_count(gpe_number);
|
2007-02-03 00:48:19 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2008-11-12 16:01:56 +08:00
|
|
|
* If edge-triggered, clear the GPE status bit now. Note that
|
2005-04-17 06:20:36 +08:00
|
|
|
* level-triggered events are cleared after the GPE is serviced.
|
|
|
|
*/
|
2005-04-19 10:49:35 +08:00
|
|
|
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_GPE_EDGE_TRIGGERED) {
|
|
|
|
status = acpi_hw_clear_gpe(gpe_event_info);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_EXCEPTION((AE_INFO, status,
|
|
|
|
"Unable to clear GPE[%2X]",
|
|
|
|
gpe_number));
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-10-01 07:03:00 +08:00
|
|
|
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2007-02-03 00:48:19 +08:00
|
|
|
* Dispatch the GPE to either an installed handler, or the control method
|
|
|
|
* associated with this GPE (_Lxx or _Exx). If a handler exists, we invoke
|
|
|
|
* it and do not attempt to run the method. If there is neither a handler
|
|
|
|
* nor a method, we disable this GPE to prevent further such pointless
|
|
|
|
* events from firing.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
switch (gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) {
|
|
|
|
case ACPI_GPE_DISPATCH_HANDLER:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Invoke the installed handler (at interrupt level)
|
2008-11-12 16:01:56 +08:00
|
|
|
* Ignore return status for now.
|
|
|
|
* TBD: leave GPE disabled on error?
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
(void)gpe_event_info->dispatch.handler->address(gpe_event_info->
|
|
|
|
dispatch.
|
|
|
|
handler->
|
|
|
|
context);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* It is now safe to clear level-triggered events. */
|
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_GPE_LEVEL_TRIGGERED) {
|
|
|
|
status = acpi_hw_clear_gpe(gpe_event_info);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_EXCEPTION((AE_INFO, status,
|
|
|
|
"Unable to clear GPE[%2X]",
|
|
|
|
gpe_number));
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-10-01 07:03:00 +08:00
|
|
|
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_GPE_DISPATCH_METHOD:
|
|
|
|
|
|
|
|
/*
|
2007-02-03 00:48:19 +08:00
|
|
|
* Disable the GPE, so it doesn't keep firing before the method has a
|
|
|
|
* chance to run (it runs asynchronously with interrupts enabled).
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ev_disable_gpe(gpe_event_info);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_EXCEPTION((AE_INFO, status,
|
|
|
|
"Unable to disable GPE[%2X]",
|
|
|
|
gpe_number));
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-10-01 07:03:00 +08:00
|
|
|
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Execute the method associated with the GPE
|
|
|
|
* NOTE: Level-triggered GPEs are cleared after the method completes.
|
|
|
|
*/
|
2006-05-13 05:12:00 +08:00
|
|
|
status = acpi_os_execute(OSL_GPE_HANDLER,
|
|
|
|
acpi_ev_asynch_execute_gpe_method,
|
|
|
|
gpe_event_info);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_EXCEPTION((AE_INFO, status,
|
|
|
|
"Unable to queue handler for GPE[%2X] - event disabled",
|
|
|
|
gpe_number));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
/* No handler or method to run! */
|
|
|
|
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"No handler or method for GPE[%2X], disabling event",
|
|
|
|
gpe_number));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
2008-11-12 16:01:56 +08:00
|
|
|
* Disable the GPE. The GPE will remain disabled until the ACPICA
|
2005-04-17 06:20:36 +08:00
|
|
|
* Core Subsystem is restarted, or a handler is installed.
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ev_disable_gpe(gpe_event_info);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_EXCEPTION((AE_INFO, status,
|
|
|
|
"Unable to disable GPE[%2X]",
|
|
|
|
gpe_number));
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-10-01 07:03:00 +08:00
|
|
|
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-10-01 07:03:00 +08:00
|
|
|
return_UINT32(ACPI_INTERRUPT_HANDLED);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|