2005-04-17 06:20:36 +08:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: evgpeblk - GPE block creation and initialization.
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2010-01-22 19:07:36 +08:00
|
|
|
* Copyright (C) 2000 - 2010, 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("evgpeblk")
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
/* Local prototypes */
|
|
|
|
static acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
|
|
|
|
u32 interrupt_number);
|
2005-04-19 10:49:35 +08:00
|
|
|
|
|
|
|
static acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_install_gpe_block
|
|
|
|
*
|
2008-11-12 16:01:56 +08:00
|
|
|
* PARAMETERS: gpe_block - New GPE block
|
|
|
|
* interrupt_number - Xrupt to be associated with this
|
|
|
|
* GPE block
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Install new GPE block with mutex support
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
static acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
|
|
|
|
u32 interrupt_number)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
struct acpi_gpe_block_info *next_gpe_block;
|
|
|
|
struct acpi_gpe_xrupt_info *gpe_xrupt_block;
|
|
|
|
acpi_status status;
|
2006-01-28 05:43:00 +08:00
|
|
|
acpi_cpu_flags flags;
|
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_install_gpe_block);
|
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)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block(interrupt_number);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!gpe_xrupt_block) {
|
|
|
|
status = AE_NO_MEMORY;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
/* Install the new block at the end of the list with lock */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (gpe_xrupt_block->gpe_block_list_head) {
|
|
|
|
next_gpe_block = gpe_xrupt_block->gpe_block_list_head;
|
|
|
|
while (next_gpe_block->next) {
|
|
|
|
next_gpe_block = next_gpe_block->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
next_gpe_block->next = gpe_block;
|
|
|
|
gpe_block->previous = next_gpe_block;
|
2005-08-05 12:44:28 +08:00
|
|
|
} else {
|
2005-04-17 06:20:36 +08:00
|
|
|
gpe_xrupt_block->gpe_block_list_head = gpe_block;
|
|
|
|
}
|
|
|
|
|
|
|
|
gpe_block->xrupt_block = gpe_xrupt_block;
|
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
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
unlock_and_exit:
|
|
|
|
status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_delete_gpe_block
|
|
|
|
*
|
2008-11-12 16:01:56 +08:00
|
|
|
* PARAMETERS: gpe_block - Existing GPE block
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Remove a GPE block
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status;
|
2006-01-28 05:43:00 +08:00
|
|
|
acpi_cpu_flags flags;
|
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_install_gpe_block);
|
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)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Disable all GPEs in this block */
|
|
|
|
|
2008-12-30 09:45:17 +08:00
|
|
|
status =
|
|
|
|
acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block, NULL);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (!gpe_block->previous && !gpe_block->next) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* This is the last gpe_block on this interrupt */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
2005-08-05 12:44:28 +08:00
|
|
|
} else {
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Remove the block on this interrupt with lock */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (gpe_block->previous) {
|
|
|
|
gpe_block->previous->next = gpe_block->next;
|
2005-08-05 12:44:28 +08:00
|
|
|
} else {
|
|
|
|
gpe_block->xrupt_block->gpe_block_list_head =
|
|
|
|
gpe_block->next;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (gpe_block->next) {
|
|
|
|
gpe_block->next->previous = gpe_block->previous;
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2010-04-06 14:52:37 +08:00
|
|
|
acpi_current_gpe_count -= gpe_block->gpe_count;
|
2008-12-30 09:45:17 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Free the gpe_block */
|
|
|
|
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_FREE(gpe_block->register_info);
|
|
|
|
ACPI_FREE(gpe_block->event_info);
|
|
|
|
ACPI_FREE(gpe_block);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
unlock_and_exit:
|
|
|
|
status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_create_gpe_info_blocks
|
|
|
|
*
|
|
|
|
* PARAMETERS: gpe_block - New GPE block
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Create the register_info and event_info blocks for this GPE block
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
static acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
struct acpi_gpe_register_info *gpe_register_info = NULL;
|
|
|
|
struct acpi_gpe_event_info *gpe_event_info = NULL;
|
|
|
|
struct acpi_gpe_event_info *this_event;
|
|
|
|
struct acpi_gpe_register_info *this_register;
|
2008-06-10 13:42:13 +08:00
|
|
|
u32 i;
|
|
|
|
u32 j;
|
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_create_gpe_info_blocks);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Allocate the GPE register information block */
|
|
|
|
|
2006-10-03 12:00:00 +08:00
|
|
|
gpe_register_info = ACPI_ALLOCATE_ZEROED((acpi_size) gpe_block->
|
|
|
|
register_count *
|
|
|
|
sizeof(struct
|
|
|
|
acpi_gpe_register_info));
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!gpe_register_info) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
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
|
|
|
"Could not allocate the GpeRegisterInfo table"));
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate the GPE event_info block. There are eight distinct GPEs
|
2005-11-02 13:00:00 +08:00
|
|
|
* per register. Initialization to zeros is sufficient.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2010-04-06 14:52:37 +08:00
|
|
|
gpe_event_info = ACPI_ALLOCATE_ZEROED((acpi_size) gpe_block->gpe_count *
|
2006-10-03 12:00:00 +08:00
|
|
|
sizeof(struct
|
|
|
|
acpi_gpe_event_info));
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!gpe_event_info) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
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
|
|
|
"Could not allocate the GpeEventInfo table"));
|
2005-04-17 06:20:36 +08:00
|
|
|
status = AE_NO_MEMORY;
|
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Save the new Info arrays in the GPE block */
|
|
|
|
|
|
|
|
gpe_block->register_info = gpe_register_info;
|
2005-08-05 12:44:28 +08:00
|
|
|
gpe_block->event_info = gpe_event_info;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
2005-11-02 13:00:00 +08:00
|
|
|
* Initialize the GPE Register and Event structures. A goal of these
|
2008-11-12 16:01:56 +08:00
|
|
|
* tables is to hide the fact that there are two separate GPE register
|
|
|
|
* sets in a given GPE hardware block, the status registers occupy the
|
|
|
|
* first half, and the enable registers occupy the second half.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
this_register = gpe_register_info;
|
2005-08-05 12:44:28 +08:00
|
|
|
this_event = gpe_event_info;
|
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
|
|
|
/* Init the register_info for this GPE register (8 GPEs) */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
this_register->base_gpe_number =
|
|
|
|
(u8) (gpe_block->block_base_number +
|
|
|
|
(i * ACPI_GPE_REGISTER_WIDTH));
|
|
|
|
|
2007-02-03 00:48:23 +08:00
|
|
|
this_register->status_address.address =
|
|
|
|
gpe_block->block_address.address + i;
|
2005-08-05 12:44:28 +08:00
|
|
|
|
2007-02-03 00:48:23 +08:00
|
|
|
this_register->enable_address.address =
|
|
|
|
gpe_block->block_address.address + i +
|
|
|
|
gpe_block->register_count;
|
2005-08-05 12:44:28 +08:00
|
|
|
|
2007-02-03 00:48:18 +08:00
|
|
|
this_register->status_address.space_id =
|
|
|
|
gpe_block->block_address.space_id;
|
|
|
|
this_register->enable_address.space_id =
|
|
|
|
gpe_block->block_address.space_id;
|
|
|
|
this_register->status_address.bit_width =
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_GPE_REGISTER_WIDTH;
|
2007-02-03 00:48:18 +08:00
|
|
|
this_register->enable_address.bit_width =
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_GPE_REGISTER_WIDTH;
|
2008-12-31 02:55:32 +08:00
|
|
|
this_register->status_address.bit_offset = 0;
|
|
|
|
this_register->enable_address.bit_offset = 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Init the event_info for each GPE within this register */
|
|
|
|
|
|
|
|
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
|
2007-02-03 00:48:19 +08:00
|
|
|
this_event->gpe_number =
|
|
|
|
(u8) (this_register->base_gpe_number + j);
|
2005-04-17 06:20:36 +08:00
|
|
|
this_event->register_info = this_register;
|
|
|
|
this_event++;
|
|
|
|
}
|
|
|
|
|
2005-11-02 13:00:00 +08:00
|
|
|
/* Disable all GPEs within this register */
|
|
|
|
|
2009-06-24 09:44:06 +08:00
|
|
|
status = acpi_hw_write(0x00, &this_register->enable_address);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
|
2005-11-02 13:00:00 +08:00
|
|
|
/* Clear any pending GPE events within this register */
|
|
|
|
|
2009-06-24 09:44:06 +08:00
|
|
|
status = acpi_hw_write(0xFF, &this_register->status_address);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
this_register++;
|
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
error_exit:
|
2005-04-17 06:20:36 +08:00
|
|
|
if (gpe_register_info) {
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_FREE(gpe_register_info);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
if (gpe_event_info) {
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_FREE(gpe_event_info);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_create_gpe_block
|
|
|
|
*
|
|
|
|
* PARAMETERS: gpe_device - Handle to the parent GPE block
|
|
|
|
* gpe_block_address - Address and space_iD
|
|
|
|
* register_count - Number of GPE register pairs in the block
|
|
|
|
* gpe_block_base_number - Starting GPE number for the block
|
2005-05-13 12:00:00 +08:00
|
|
|
* interrupt_number - H/W interrupt for the block
|
2005-04-17 06:20:36 +08:00
|
|
|
* return_gpe_block - Where the new block descriptor is returned
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2005-11-02 13:00:00 +08:00
|
|
|
* DESCRIPTION: Create and Install a block of GPE registers. All GPEs within
|
|
|
|
* the block are disabled at exit.
|
|
|
|
* Note: Assumes namespace is locked.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
|
|
|
|
struct acpi_generic_address *gpe_block_address,
|
|
|
|
u32 register_count,
|
|
|
|
u8 gpe_block_base_number,
|
|
|
|
u32 interrupt_number,
|
|
|
|
struct acpi_gpe_block_info **return_gpe_block)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status;
|
2005-11-02 13:00:00 +08:00
|
|
|
struct acpi_gpe_block_info *gpe_block;
|
2010-04-27 11:32:28 +08:00
|
|
|
struct acpi_gpe_walk_info walk_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_create_gpe_block);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (!register_count) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate a new GPE block */
|
|
|
|
|
2006-10-03 12:00:00 +08:00
|
|
|
gpe_block = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_block_info));
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!gpe_block) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize the new GPE block */
|
|
|
|
|
2005-11-02 13:00:00 +08:00
|
|
|
gpe_block->node = gpe_device;
|
2010-04-06 14:52:37 +08:00
|
|
|
gpe_block->gpe_count = (u16)(register_count * ACPI_GPE_REGISTER_WIDTH);
|
2005-04-17 06:20:36 +08:00
|
|
|
gpe_block->register_count = register_count;
|
|
|
|
gpe_block->block_base_number = gpe_block_base_number;
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address,
|
|
|
|
sizeof(struct acpi_generic_address));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-11-02 13:00:00 +08:00
|
|
|
/*
|
|
|
|
* Create the register_info and event_info sub-structures
|
|
|
|
* Note: disables and clears all GPEs in the block
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ev_create_gpe_info_blocks(gpe_block);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_FREE(gpe_block);
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-11-02 13:00:00 +08:00
|
|
|
/* Install the new block in the global lists */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ev_install_gpe_block(gpe_block, interrupt_number);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_FREE(gpe_block);
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2010-04-27 11:32:28 +08:00
|
|
|
/* Find all GPE methods (_Lxx or_Exx) for this block */
|
|
|
|
|
|
|
|
walk_info.gpe_block = gpe_block;
|
|
|
|
walk_info.gpe_device = gpe_device;
|
|
|
|
walk_info.enable_this_gpe = FALSE;
|
|
|
|
walk_info.execute_by_owner_id = FALSE;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ns_walk_namespace(ACPI_TYPE_METHOD, gpe_device,
|
|
|
|
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
|
2010-04-06 14:52:37 +08:00
|
|
|
acpi_ev_match_gpe_method, NULL,
|
2010-04-27 11:32:28 +08:00
|
|
|
&walk_info, NULL);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-11-02 13:00:00 +08:00
|
|
|
/* Return the new block */
|
|
|
|
|
|
|
|
if (return_gpe_block) {
|
|
|
|
(*return_gpe_block) = gpe_block;
|
|
|
|
}
|
|
|
|
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
|
|
|
"GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
|
|
|
|
(u32) gpe_block->block_base_number,
|
|
|
|
(u32) (gpe_block->block_base_number +
|
2010-04-06 14:52:37 +08:00
|
|
|
(gpe_block->gpe_count - 1)),
|
2005-11-02 13:00:00 +08:00
|
|
|
gpe_device->name.ascii, gpe_block->register_count,
|
|
|
|
interrupt_number));
|
|
|
|
|
2008-12-30 09:45:17 +08:00
|
|
|
/* Update global count of currently available GPEs */
|
|
|
|
|
2010-04-06 14:52:37 +08:00
|
|
|
acpi_current_gpe_count += gpe_block->gpe_count;
|
2005-11-02 13:00:00 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_initialize_gpe_block
|
|
|
|
*
|
|
|
|
* PARAMETERS: gpe_device - Handle to the parent GPE block
|
|
|
|
* gpe_block - Gpe Block info
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Initialize and enable a GPE block. First find and run any
|
|
|
|
* _PRT methods associated with the block, then enable the
|
|
|
|
* appropriate GPEs.
|
|
|
|
* Note: Assumes namespace is locked.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
|
|
|
acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
|
|
|
|
struct acpi_gpe_block_info *gpe_block)
|
|
|
|
{
|
2010-04-06 14:52:37 +08:00
|
|
|
acpi_status status;
|
2005-11-02 13:00:00 +08:00
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-04-27 11:32:28 +08:00
|
|
|
struct acpi_gpe_walk_info walk_info;
|
2005-11-02 13:00:00 +08:00
|
|
|
u32 wake_gpe_count;
|
|
|
|
u32 gpe_enabled_count;
|
2010-04-06 14:52:37 +08:00
|
|
|
u32 gpe_index;
|
|
|
|
u32 gpe_number;
|
2008-06-10 13:42:13 +08:00
|
|
|
u32 i;
|
|
|
|
u32 j;
|
2005-11-02 13:00:00 +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_initialize_gpe_block);
|
2005-11-02 13:00:00 +08:00
|
|
|
|
|
|
|
/* Ignore a null GPE block (e.g., if no GPE block 1 exists) */
|
|
|
|
|
|
|
|
if (!gpe_block) {
|
|
|
|
return_ACPI_STATUS(AE_OK);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2005-11-02 13:00:00 +08:00
|
|
|
* Runtime option: Should wake GPEs be enabled at runtime? The default
|
|
|
|
* is no, they should only be enabled just as the machine goes to sleep.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
if (acpi_gbl_leave_wake_gpes_disabled) {
|
|
|
|
/*
|
2005-11-02 13:00:00 +08:00
|
|
|
* Differentiate runtime vs wake GPEs, via the _PRW control methods.
|
|
|
|
* Each GPE that has one or more _PRWs that reference it is by
|
|
|
|
* definition a wake GPE and will not be enabled while the machine
|
|
|
|
* is running.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2010-04-27 11:32:28 +08:00
|
|
|
walk_info.gpe_block = gpe_block;
|
|
|
|
walk_info.gpe_device = gpe_device;
|
|
|
|
walk_info.execute_by_owner_id = FALSE;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-04-27 11:32:28 +08:00
|
|
|
status =
|
|
|
|
acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
|
2009-11-13 10:06:08 +08:00
|
|
|
acpi_ev_match_prw_and_gpe, NULL,
|
2010-04-27 11:32:28 +08:00
|
|
|
&walk_info, NULL);
|
2010-04-06 14:52:37 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
ACPI_EXCEPTION((AE_INFO, status,
|
|
|
|
"While executing _PRW methods"));
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-04-06 14:52:37 +08:00
|
|
|
* Enable all GPEs that have a corresponding method and are not
|
2010-02-18 06:41:07 +08:00
|
|
|
* capable of generating wakeups. Any other GPEs within this block
|
2010-04-06 14:52:37 +08:00
|
|
|
* must be enabled via the acpi_enable_gpe interface.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
wake_gpe_count = 0;
|
|
|
|
gpe_enabled_count = 0;
|
2010-04-06 14:52:37 +08:00
|
|
|
|
|
|
|
if (gpe_device == acpi_gbl_fadt_gpe_device) {
|
2010-02-18 06:41:07 +08:00
|
|
|
gpe_device = NULL;
|
2010-04-06 14:52:37 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
for (i = 0; i < gpe_block->register_count; i++) {
|
2010-02-18 06:41:07 +08:00
|
|
|
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
|
|
|
/* Get the info block for this particular GPE */
|
2010-04-06 14:52:37 +08:00
|
|
|
|
|
|
|
gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j;
|
2010-02-18 06:41:07 +08:00
|
|
|
gpe_event_info = &gpe_block->event_info[gpe_index];
|
2010-06-08 16:50:20 +08:00
|
|
|
gpe_number = gpe_index + gpe_block->block_base_number;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the GPE has already been enabled for runtime
|
|
|
|
* signaling, make sure it remains enabled, but do not
|
|
|
|
* increment its reference counter.
|
|
|
|
*/
|
|
|
|
if (gpe_event_info->runtime_count) {
|
2010-07-01 11:01:12 +08:00
|
|
|
status = acpi_ev_enable_gpe(gpe_event_info);
|
|
|
|
goto enabled;
|
2010-06-08 16:50:20 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-02-18 06:41:07 +08:00
|
|
|
if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) {
|
2005-04-17 06:20:36 +08:00
|
|
|
wake_gpe_count++;
|
2010-04-06 14:52:37 +08:00
|
|
|
if (acpi_gbl_leave_wake_gpes_disabled) {
|
2010-02-18 06:41:07 +08:00
|
|
|
continue;
|
2010-04-06 14:52:37 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2010-02-18 06:41:07 +08:00
|
|
|
|
2010-04-06 14:52:37 +08:00
|
|
|
/* Ignore GPEs that have no corresponding _Lxx/_Exx method */
|
|
|
|
|
|
|
|
if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD)) {
|
2010-02-18 06:41:07 +08:00
|
|
|
continue;
|
2010-04-06 14:52:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable this GPE */
|
2010-02-18 06:41:07 +08:00
|
|
|
|
2010-07-01 10:11:45 +08:00
|
|
|
status = acpi_enable_gpe(gpe_device, gpe_number);
|
2010-07-01 11:01:12 +08:00
|
|
|
enabled:
|
2010-04-06 14:52:37 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
ACPI_EXCEPTION((AE_INFO, status,
|
|
|
|
"Could not enable GPE 0x%02X",
|
2010-02-18 06:41:07 +08:00
|
|
|
gpe_number));
|
2010-04-06 14:52:37 +08:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
gpe_enabled_count++;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-27 11:32:28 +08:00
|
|
|
if (gpe_enabled_count || wake_gpe_count) {
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
|
|
|
"Enabled %u Runtime GPEs, added %u Wake GPEs in this block\n",
|
|
|
|
gpe_enabled_count, wake_gpe_count));
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-02-18 06:41:07 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|