2018-03-14 23:13:07 +00:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
|
2005-04-16 22:20:36 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: evgpeblk - GPE block creation and initialization.
|
|
|
|
*
|
2020-01-10 19:31:49 +00:00
|
|
|
* Copyright (C) 2000 - 2020, Intel Corp.
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
2018-03-14 23:13:07 +00:00
|
|
|
*****************************************************************************/
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#include <acpi/acpi.h>
|
2009-01-09 05:30:03 +00:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "acevents.h"
|
|
|
|
#include "acnamesp.h"
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_EVENTS
|
2005-08-05 04:44:28 +00:00
|
|
|
ACPI_MODULE_NAME("evgpeblk")
|
2012-02-14 10:14:27 +00:00
|
|
|
#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
|
2005-04-19 02:49:35 +00:00
|
|
|
/* Local prototypes */
|
|
|
|
static acpi_status
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
|
|
|
|
u32 interrupt_number);
|
2005-04-19 02:49:35 +00:00
|
|
|
|
|
|
|
static acpi_status
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_install_gpe_block
|
|
|
|
*
|
2008-11-12 08:01:56 +00:00
|
|
|
* PARAMETERS: gpe_block - New GPE block
|
|
|
|
* interrupt_number - Xrupt to be associated with this
|
|
|
|
* GPE block
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Install new GPE block with mutex support
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
static acpi_status
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
|
|
|
|
u32 interrupt_number)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
struct acpi_gpe_block_info *next_gpe_block;
|
|
|
|
struct acpi_gpe_xrupt_info *gpe_xrupt_block;
|
|
|
|
acpi_status status;
|
2006-01-27 21:43:00 +00:00
|
|
|
acpi_cpu_flags flags;
|
2005-04-16 22:20:36 +00: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-21 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE(ev_install_gpe_block);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2014-01-08 05:44:10 +00:00
|
|
|
status =
|
|
|
|
acpi_ev_get_gpe_xrupt_block(interrupt_number, &gpe_xrupt_block);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2005-04-19 02:49:35 +00:00
|
|
|
/* Install the new block at the end of the list with lock */
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-16 22:20:36 +00: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 04:44:28 +00:00
|
|
|
} else {
|
2005-04-16 22:20:36 +00:00
|
|
|
gpe_xrupt_block->gpe_block_list_head = gpe_block;
|
|
|
|
}
|
|
|
|
|
|
|
|
gpe_block->xrupt_block = gpe_xrupt_block;
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2013-10-29 01:30:02 +00:00
|
|
|
unlock_and_exit:
|
2014-01-08 05:44:10 +00:00
|
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_delete_gpe_block
|
|
|
|
*
|
2008-11-12 08:01:56 +00:00
|
|
|
* PARAMETERS: gpe_block - Existing GPE block
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Remove a GPE block
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status status;
|
2006-01-27 21:43:00 +00:00
|
|
|
acpi_cpu_flags flags;
|
2005-04-16 22:20:36 +00: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-21 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE(ev_install_gpe_block);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Disable all GPEs in this block */
|
|
|
|
|
2008-12-30 01:45:17 +00:00
|
|
|
status =
|
|
|
|
acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block, NULL);
|
2019-10-25 21:36:49 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (!gpe_block->previous && !gpe_block->next) {
|
2006-10-02 04:00:00 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* This is the last gpe_block on this interrupt */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
2005-08-05 04:44:28 +00:00
|
|
|
} else {
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Remove the block on this interrupt with lock */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (gpe_block->previous) {
|
|
|
|
gpe_block->previous->next = gpe_block->next;
|
2005-08-05 04:44:28 +00:00
|
|
|
} else {
|
|
|
|
gpe_block->xrupt_block->gpe_block_list_head =
|
|
|
|
gpe_block->next;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (gpe_block->next) {
|
|
|
|
gpe_block->next->previous = gpe_block->previous;
|
|
|
|
}
|
2015-12-29 05:54:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2010-04-06 06:52:37 +00:00
|
|
|
acpi_current_gpe_count -= gpe_block->gpe_count;
|
2008-12-30 01:45:17 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Free the gpe_block */
|
|
|
|
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_FREE(gpe_block->register_info);
|
|
|
|
ACPI_FREE(gpe_block->event_info);
|
|
|
|
ACPI_FREE(gpe_block);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2013-10-29 01:30:02 +00:00
|
|
|
unlock_and_exit:
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00: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 04:44:28 +00:00
|
|
|
acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00: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 05:42:13 +00:00
|
|
|
u32 i;
|
|
|
|
u32 j;
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status status;
|
2005-04-16 22:20:36 +00: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-21 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE(ev_create_gpe_info_blocks);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Allocate the GPE register information block */
|
|
|
|
|
2016-05-05 04:57:53 +00:00
|
|
|
gpe_register_info = ACPI_ALLOCATE_ZEROED((acpi_size)gpe_block->
|
2006-10-03 04:00:00 +00:00
|
|
|
register_count *
|
|
|
|
sizeof(struct
|
|
|
|
acpi_gpe_register_info));
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!gpe_register_info) {
|
2006-01-27 21:43:00 +00: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-21 21:15:00 +00:00
|
|
|
"Could not allocate the GpeRegisterInfo table"));
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate the GPE event_info block. There are eight distinct GPEs
|
2005-11-02 05:00:00 +00:00
|
|
|
* per register. Initialization to zeros is sufficient.
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
2016-05-05 04:57:53 +00:00
|
|
|
gpe_event_info = ACPI_ALLOCATE_ZEROED((acpi_size)gpe_block->gpe_count *
|
2006-10-03 04:00:00 +00:00
|
|
|
sizeof(struct
|
|
|
|
acpi_gpe_event_info));
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!gpe_event_info) {
|
2006-01-27 21:43:00 +00: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-21 21:15:00 +00:00
|
|
|
"Could not allocate the GpeEventInfo table"));
|
2005-04-16 22:20:36 +00: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 04:44:28 +00:00
|
|
|
gpe_block->event_info = gpe_event_info;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*
|
2005-11-02 05:00:00 +00:00
|
|
|
* Initialize the GPE Register and Event structures. A goal of these
|
2008-11-12 08:01:56 +00: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-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
this_register = gpe_register_info;
|
2005-08-05 04:44:28 +00:00
|
|
|
this_event = gpe_event_info;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
for (i = 0; i < gpe_block->register_count; i++) {
|
2006-10-02 04:00:00 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Init the register_info for this GPE register (8 GPEs) */
|
|
|
|
|
2014-04-30 02:06:15 +00:00
|
|
|
this_register->base_gpe_number = (u16)
|
|
|
|
(gpe_block->block_base_number +
|
|
|
|
(i * ACPI_GPE_REGISTER_WIDTH));
|
2005-08-05 04:44:28 +00:00
|
|
|
|
2014-04-30 02:06:15 +00:00
|
|
|
this_register->status_address.address = gpe_block->address + i;
|
2005-08-05 04:44:28 +00:00
|
|
|
|
2007-02-02 16:48:23 +00:00
|
|
|
this_register->enable_address.address =
|
2014-04-30 02:06:15 +00:00
|
|
|
gpe_block->address + i + gpe_block->register_count;
|
2005-08-05 04:44:28 +00:00
|
|
|
|
2014-04-30 02:06:15 +00:00
|
|
|
this_register->status_address.space_id = gpe_block->space_id;
|
|
|
|
this_register->enable_address.space_id = gpe_block->space_id;
|
2007-02-02 16:48:18 +00:00
|
|
|
this_register->status_address.bit_width =
|
2005-08-05 04:44:28 +00:00
|
|
|
ACPI_GPE_REGISTER_WIDTH;
|
2007-02-02 16:48:18 +00:00
|
|
|
this_register->enable_address.bit_width =
|
2005-08-05 04:44:28 +00:00
|
|
|
ACPI_GPE_REGISTER_WIDTH;
|
2008-12-30 18:55:32 +00:00
|
|
|
this_register->status_address.bit_offset = 0;
|
|
|
|
this_register->enable_address.bit_offset = 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Init the event_info for each GPE within this register */
|
|
|
|
|
|
|
|
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
|
2007-02-02 16:48:19 +00:00
|
|
|
this_event->gpe_number =
|
|
|
|
(u8) (this_register->base_gpe_number + j);
|
2005-04-16 22:20:36 +00:00
|
|
|
this_event->register_info = this_register;
|
|
|
|
this_event++;
|
|
|
|
}
|
|
|
|
|
2005-11-02 05:00:00 +00:00
|
|
|
/* Disable all GPEs within this register */
|
|
|
|
|
2009-06-24 01:44:06 +00:00
|
|
|
status = acpi_hw_write(0x00, &this_register->enable_address);
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
|
2005-11-02 05:00:00 +00:00
|
|
|
/* Clear any pending GPE events within this register */
|
|
|
|
|
2009-06-24 01:44:06 +00:00
|
|
|
status = acpi_hw_write(0xFF, &this_register->status_address);
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
this_register++;
|
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2013-10-29 01:30:02 +00:00
|
|
|
error_exit:
|
2005-04-16 22:20:36 +00:00
|
|
|
if (gpe_register_info) {
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_FREE(gpe_register_info);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
if (gpe_event_info) {
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_FREE(gpe_event_info);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_create_gpe_block
|
|
|
|
*
|
|
|
|
* PARAMETERS: gpe_device - Handle to the parent GPE block
|
2012-07-12 01:40:10 +00:00
|
|
|
* gpe_block_address - Address and space_ID
|
2005-04-16 22:20:36 +00:00
|
|
|
* register_count - Number of GPE register pairs in the block
|
|
|
|
* gpe_block_base_number - Starting GPE number for the block
|
2005-05-13 04:00:00 +00:00
|
|
|
* interrupt_number - H/W interrupt for the block
|
2005-04-16 22:20:36 +00:00
|
|
|
* return_gpe_block - Where the new block descriptor is returned
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2005-11-02 05:00:00 +00: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-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
|
2014-04-30 02:06:15 +00:00
|
|
|
u64 address,
|
|
|
|
u8 space_id,
|
2005-08-05 04:44:28 +00:00
|
|
|
u32 register_count,
|
2014-04-30 02:06:15 +00:00
|
|
|
u16 gpe_block_base_number,
|
2005-08-05 04:44:28 +00:00
|
|
|
u32 interrupt_number,
|
|
|
|
struct acpi_gpe_block_info **return_gpe_block)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status status;
|
2005-11-02 05:00:00 +00:00
|
|
|
struct acpi_gpe_block_info *gpe_block;
|
2010-04-27 03:32:28 +00:00
|
|
|
struct acpi_gpe_walk_info walk_info;
|
2005-04-16 22:20:36 +00: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-21 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE(ev_create_gpe_block);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (!register_count) {
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate a new GPE block */
|
|
|
|
|
2006-10-03 04:00:00 +00:00
|
|
|
gpe_block = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_block_info));
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!gpe_block) {
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize the new GPE block */
|
|
|
|
|
2014-04-30 02:06:15 +00:00
|
|
|
gpe_block->address = address;
|
|
|
|
gpe_block->space_id = space_id;
|
2005-11-02 05:00:00 +00:00
|
|
|
gpe_block->node = gpe_device;
|
2010-04-06 06:52:37 +00:00
|
|
|
gpe_block->gpe_count = (u16)(register_count * ACPI_GPE_REGISTER_WIDTH);
|
2010-12-13 05:39:37 +00:00
|
|
|
gpe_block->initialized = FALSE;
|
2005-04-16 22:20:36 +00:00
|
|
|
gpe_block->register_count = register_count;
|
|
|
|
gpe_block->block_base_number = gpe_block_base_number;
|
|
|
|
|
2005-11-02 05:00:00 +00:00
|
|
|
/*
|
|
|
|
* Create the register_info and event_info sub-structures
|
|
|
|
* Note: disables and clears all GPEs in the block
|
|
|
|
*/
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ev_create_gpe_info_blocks(gpe_block);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_FREE(gpe_block);
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-11-02 05:00:00 +00:00
|
|
|
/* Install the new block in the global lists */
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ev_install_gpe_block(gpe_block, interrupt_number);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2013-06-08 01:00:07 +00:00
|
|
|
ACPI_FREE(gpe_block->register_info);
|
|
|
|
ACPI_FREE(gpe_block->event_info);
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_FREE(gpe_block);
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2010-12-13 05:36:15 +00:00
|
|
|
acpi_gbl_all_gpes_initialized = FALSE;
|
2010-09-15 22:30:43 +00:00
|
|
|
|
2010-04-27 03:32:28 +00: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.execute_by_owner_id = FALSE;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2019-10-25 21:36:49 +00:00
|
|
|
(void)acpi_ns_walk_namespace(ACPI_TYPE_METHOD, gpe_device,
|
|
|
|
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
|
|
|
|
acpi_ev_match_gpe_method, NULL, &walk_info,
|
|
|
|
NULL);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-11-02 05:00:00 +00:00
|
|
|
/* Return the new block */
|
|
|
|
|
|
|
|
if (return_gpe_block) {
|
|
|
|
(*return_gpe_block) = gpe_block;
|
|
|
|
}
|
|
|
|
|
2012-12-31 00:07:13 +00:00
|
|
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
|
2014-04-30 02:06:15 +00:00
|
|
|
" Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X%s\n",
|
2012-12-31 00:07:13 +00:00
|
|
|
(u32)gpe_block->block_base_number,
|
|
|
|
(u32)(gpe_block->block_base_number +
|
|
|
|
(gpe_block->gpe_count - 1)),
|
|
|
|
gpe_device->name.ascii, gpe_block->register_count,
|
2014-04-30 02:06:15 +00:00
|
|
|
interrupt_number,
|
|
|
|
interrupt_number ==
|
|
|
|
acpi_gbl_FADT.sci_interrupt ? " (SCI)" : ""));
|
2005-11-02 05:00:00 +00:00
|
|
|
|
2008-12-30 01:45:17 +00:00
|
|
|
/* Update global count of currently available GPEs */
|
|
|
|
|
2010-04-06 06:52:37 +00:00
|
|
|
acpi_current_gpe_count += gpe_block->gpe_count;
|
2005-11-02 05:00:00 +00:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_initialize_gpe_block
|
|
|
|
*
|
2010-12-13 05:39:37 +00:00
|
|
|
* PARAMETERS: acpi_gpe_callback
|
2005-11-02 05:00:00 +00:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2010-12-13 05:39:37 +00:00
|
|
|
* DESCRIPTION: Initialize and enable a GPE block. Enable GPEs that have
|
|
|
|
* associated methods.
|
2005-11-02 05:00:00 +00:00
|
|
|
* Note: Assumes namespace is locked.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2010-09-15 22:30:43 +00:00
|
|
|
acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
|
|
|
struct acpi_gpe_block_info *gpe_block,
|
2018-03-14 23:12:59 +00:00
|
|
|
void *context)
|
2005-11-02 05:00:00 +00:00
|
|
|
{
|
2010-04-06 06:52:37 +00:00
|
|
|
acpi_status status;
|
2005-11-02 05:00:00 +00:00
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
|
|
|
u32 gpe_enabled_count;
|
2010-04-06 06:52:37 +00:00
|
|
|
u32 gpe_index;
|
2008-06-10 05:42:13 +00:00
|
|
|
u32 i;
|
|
|
|
u32 j;
|
2018-03-14 23:12:59 +00:00
|
|
|
u8 *is_polling_needed = context;
|
2018-03-14 23:13:05 +00:00
|
|
|
ACPI_ERROR_ONLY(u32 gpe_number);
|
2005-11-02 05:00:00 +00: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-21 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE(ev_initialize_gpe_block);
|
2005-11-02 05:00:00 +00:00
|
|
|
|
2010-09-15 22:30:43 +00:00
|
|
|
/*
|
2010-12-13 05:39:37 +00:00
|
|
|
* Ignore a null GPE block (e.g., if no GPE block 1 exists), and
|
|
|
|
* any GPE blocks that have been initialized already.
|
2010-09-15 22:30:43 +00:00
|
|
|
*/
|
|
|
|
if (!gpe_block || gpe_block->initialized) {
|
2005-11-02 05:00:00 +00:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
2010-09-15 22:30:43 +00:00
|
|
|
* Enable all GPEs that have a corresponding method and have the
|
2010-12-13 05:39:37 +00:00
|
|
|
* ACPI_GPE_CAN_WAKE flag unset. Any other GPEs within this block
|
|
|
|
* must be enabled via the acpi_enable_gpe() interface.
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
gpe_enabled_count = 0;
|
2010-04-06 06:52:37 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
for (i = 0; i < gpe_block->register_count; i++) {
|
2010-02-17 22:41:07 +00:00
|
|
|
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
|
2006-10-02 04:00:00 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Get the info block for this particular GPE */
|
2010-04-06 06:52:37 +00:00
|
|
|
|
|
|
|
gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j;
|
2010-02-17 22:41:07 +00:00
|
|
|
gpe_event_info = &gpe_block->event_info[gpe_index];
|
2018-03-14 23:13:05 +00:00
|
|
|
ACPI_ERROR_ONLY(gpe_number =
|
|
|
|
gpe_block->block_base_number +
|
|
|
|
gpe_index);
|
2018-03-14 23:12:59 +00:00
|
|
|
gpe_event_info->flags |= ACPI_GPE_INITIALIZED;
|
2010-06-08 08:50:20 +00:00
|
|
|
|
2010-12-13 05:39:17 +00:00
|
|
|
/*
|
|
|
|
* Ignore GPEs that have no corresponding _Lxx/_Exx method
|
2017-08-09 22:30:09 +00:00
|
|
|
* and GPEs that are used for wakeup
|
2010-12-13 05:39:17 +00:00
|
|
|
*/
|
2017-08-09 22:30:09 +00:00
|
|
|
if ((ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) !=
|
|
|
|
ACPI_GPE_DISPATCH_METHOD)
|
2010-09-15 22:30:43 +00:00
|
|
|
|| (gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) {
|
2010-02-17 22:41:07 +00:00
|
|
|
continue;
|
2010-04-06 06:52:37 +00:00
|
|
|
}
|
|
|
|
|
ACPICA: Clear status of GPEs on first direct enable
ACPI GPEs (other than the EC one) can be enabled in two situations.
First, the GPEs with existing _Lxx and _Exx methods are enabled
implicitly by ACPICA during system initialization. Second, the
GPEs without these methods (like GPEs listed by _PRW objects for
wakeup devices) need to be enabled directly by the code that is
going to use them (e.g. ACPI power management or device drivers).
In the former case, if the status of a given GPE is set to start
with, its handler method (either _Lxx or _Exx) needs to be invoked
to take care of the events (possibly) signaled before the GPE was
enabled. In the latter case, however, the first caller of
acpi_enable_gpe() for a given GPE should not be expected to care
about any events that might be signaled through it earlier. In
that case, it is better to clear the status of the GPE before
enabling it, to prevent stale events from triggering unwanted
actions (like spurious system resume, for example).
For this reason, modify acpi_ev_add_gpe_reference() to take an
additional boolean argument indicating whether or not the GPE
status needs to be cleared when its reference counter changes from
zero to one and make acpi_enable_gpe() pass TRUE to it through
that new argument.
Fixes: 18996f2db918 ("ACPICA: Events: Stop unconditionally clearing ACPI IRQs during suspend/resume")
Reported-by: Furquan Shaikh <furquan@google.com>
Tested-by: Furquan Shaikh <furquan@google.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-06-17 11:31:45 +00:00
|
|
|
status = acpi_ev_add_gpe_reference(gpe_event_info, FALSE);
|
2010-04-06 06:52:37 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
ACPI_EXCEPTION((AE_INFO, status,
|
2010-09-15 22:30:43 +00:00
|
|
|
"Could not enable GPE 0x%02X",
|
2017-08-09 22:30:09 +00:00
|
|
|
gpe_number));
|
2010-04-06 06:52:37 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2017-08-09 22:31:58 +00:00
|
|
|
gpe_event_info->flags |= ACPI_GPE_AUTO_ENABLED;
|
|
|
|
|
2018-03-14 23:12:59 +00:00
|
|
|
if (is_polling_needed &&
|
|
|
|
ACPI_GPE_IS_POLLING_NEEDED(gpe_event_info)) {
|
|
|
|
*is_polling_needed = TRUE;
|
2017-08-09 22:30:09 +00:00
|
|
|
}
|
|
|
|
|
2010-04-06 06:52:37 +00:00
|
|
|
gpe_enabled_count++;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
ACPI / ACPICA: Do not execute _PRW methods during initialization
Currently, during initialization ACPICA walks the entire ACPI
namespace in search of any device objects with assciated _PRW
methods. All of the _PRW methods found are executed in the process
to extract the GPE information returned by them, so that the GPEs in
question can be marked as "able to wakeup" (more precisely, the
ACPI_GPE_CAN_WAKE flag is set for them). The only purpose of this
exercise is to avoid enabling the CAN_WAKE GPEs automatically, even
if there are _Lxx/_Exx methods associated with them. However, it is
both costly and unnecessary, because the host OS has to execute the
_PRW methods anyway to check which devices can wake up the system
from sleep states. Moreover, it then uses full information
returned by _PRW, including the GPE information, so it can take care
of disabling the GPEs if necessary.
Remove the code that walks the namespace and executes _PRW from
ACPICA and modify comments to reflect that change. Make
acpi_bus_set_run_wake_flags() disable GPEs for wakeup devices
so that they don't cause spurious wakeup events to be signaled.
This not only reduces the complexity of the ACPICA initialization
code, but in some cases it should reduce the kernel boot time as
well.
Unfortunately, for this purpose we need a new ACPICA function,
acpi_gpe_can_wake(), to be called by the host OS in order to disable
the GPEs that can wake up the system and were previously enabled by
acpi_ev_initialize_gpe_block() or acpi_ev_update_gpes() (such a GPE
should be disabled only once, because the initialization code enables
it only once, but it may be pointed to by _PRW for multiple devices
and that's why the additional function is necessary).
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
2010-07-07 22:43:36 +00:00
|
|
|
if (gpe_enabled_count) {
|
2016-02-19 06:16:42 +00:00
|
|
|
ACPI_INFO(("Enabled %u GPEs in block %02X to %02X",
|
2012-12-31 00:07:13 +00:00
|
|
|
gpe_enabled_count, (u32)gpe_block->block_base_number,
|
|
|
|
(u32)(gpe_block->block_base_number +
|
|
|
|
(gpe_block->gpe_count - 1))));
|
2010-04-27 03:32:28 +00:00
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-09-15 22:30:43 +00:00
|
|
|
gpe_block->initialized = TRUE;
|
|
|
|
|
2010-02-17 22:41:07 +00:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
2012-02-14 10:14:27 +00:00
|
|
|
|
|
|
|
#endif /* !ACPI_REDUCED_HARDWARE */
|