2005-04-17 05:20:36 +07:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2010-01-22 18:07:36 +07:00
|
|
|
* Copyright (C) 2000 - 2010, Intel Corp.
|
2005-04-17 05:20:36 +07: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 12:30:03 +07:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "acevents.h"
|
|
|
|
#include "acnamesp.h"
|
|
|
|
#include "actables.h"
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_EVENTS
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_MODULE_NAME("evxfevnt")
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-12-30 08:45:17 +07:00
|
|
|
/* Local prototypes */
|
2009-04-22 12:02:06 +07:00
|
|
|
static acpi_status
|
2008-12-30 08:45:17 +07:00
|
|
|
acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
|
|
|
struct acpi_gpe_block_info *gpe_block, void *context);
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_enable
|
|
|
|
*
|
|
|
|
* PARAMETERS: None
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Transfers the system into ACPI mode.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2008-12-30 08:45:17 +07:00
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status acpi_enable(void)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
ACPICA: simplify SCI_EN workaround
acpi_hw_set_mode() double checks its effectiveness
by calling acpi_hw_get_mode() -- polling up to 3 seconds.
It would be more logical for its caller, acpi_enable()
acpi_enable() to do the double-checking. (lets assume
that acpi_disable() isn't interesting)
The ACPI specification is unclear on this point.
Some parts say that the BIOS sets SCI_EN and then returns to the OS,
but one part says "OSPM polls the SCI_EN bit until it is sampled SET".
The systems I have on hand do the former,
SCI_EN is observed to be set upon return from the BIOS.
So we move the check up out of acpi_hw_set_mode()
up into acpi_enable() where it makes logical sense.
Then we replace the 3-second polling loop
with a single check. If this check fails, we'll see:
"Hardware did not enter ACPI mode"
and the system will bail out of ACPI initialization
and likely fail to boot. If we see that in practice,
we can restore the polling, but put it into acpi_enable.
This patch is important if acpi_enable() is used in
the resume from S3 path. Many systems today are seen
coming back from S3 with SCI_EN off, and then failing
to set SCI_EN in response to acpi_enable(). Those systems
will take 3 seconds longer to resume due to this loop.
However, it is possible that we will not use acpi_enable()
in the S3 resume path, and bang SCI_EN directly, which
would make the loop harmless, as it would be invisible
to all systems except those that need it.
Signed-off-by: Len Brown <len.brown@intel.com>
2010-05-07 04:41:08 +07:00
|
|
|
acpi_status status;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_enable);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2007-02-02 23:48:23 +07:00
|
|
|
/* ACPI tables must be present */
|
|
|
|
|
|
|
|
if (!acpi_tb_tables_loaded()) {
|
|
|
|
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check current mode */
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
|
|
|
"System is already in ACPI mode\n"));
|
ACPICA: simplify SCI_EN workaround
acpi_hw_set_mode() double checks its effectiveness
by calling acpi_hw_get_mode() -- polling up to 3 seconds.
It would be more logical for its caller, acpi_enable()
acpi_enable() to do the double-checking. (lets assume
that acpi_disable() isn't interesting)
The ACPI specification is unclear on this point.
Some parts say that the BIOS sets SCI_EN and then returns to the OS,
but one part says "OSPM polls the SCI_EN bit until it is sampled SET".
The systems I have on hand do the former,
SCI_EN is observed to be set upon return from the BIOS.
So we move the check up out of acpi_hw_set_mode()
up into acpi_enable() where it makes logical sense.
Then we replace the 3-second polling loop
with a single check. If this check fails, we'll see:
"Hardware did not enter ACPI mode"
and the system will bail out of ACPI initialization
and likely fail to boot. If we see that in practice,
we can restore the polling, but put it into acpi_enable.
This patch is important if acpi_enable() is used in
the resume from S3 path. Many systems today are seen
coming back from S3 with SCI_EN off, and then failing
to set SCI_EN in response to acpi_enable(). Those systems
will take 3 seconds longer to resume due to this loop.
However, it is possible that we will not use acpi_enable()
in the S3 resume path, and bang SCI_EN directly, which
would make the loop harmless, as it would be invisible
to all systems except those that need it.
Signed-off-by: Len Brown <len.brown@intel.com>
2010-05-07 04:41:08 +07:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
ACPICA: simplify SCI_EN workaround
acpi_hw_set_mode() double checks its effectiveness
by calling acpi_hw_get_mode() -- polling up to 3 seconds.
It would be more logical for its caller, acpi_enable()
acpi_enable() to do the double-checking. (lets assume
that acpi_disable() isn't interesting)
The ACPI specification is unclear on this point.
Some parts say that the BIOS sets SCI_EN and then returns to the OS,
but one part says "OSPM polls the SCI_EN bit until it is sampled SET".
The systems I have on hand do the former,
SCI_EN is observed to be set upon return from the BIOS.
So we move the check up out of acpi_hw_set_mode()
up into acpi_enable() where it makes logical sense.
Then we replace the 3-second polling loop
with a single check. If this check fails, we'll see:
"Hardware did not enter ACPI mode"
and the system will bail out of ACPI initialization
and likely fail to boot. If we see that in practice,
we can restore the polling, but put it into acpi_enable.
This patch is important if acpi_enable() is used in
the resume from S3 path. Many systems today are seen
coming back from S3 with SCI_EN off, and then failing
to set SCI_EN in response to acpi_enable(). Those systems
will take 3 seconds longer to resume due to this loop.
However, it is possible that we will not use acpi_enable()
in the S3 resume path, and bang SCI_EN directly, which
would make the loop harmless, as it would be invisible
to all systems except those that need it.
Signed-off-by: Len Brown <len.brown@intel.com>
2010-05-07 04:41:08 +07:00
|
|
|
/* Transition to ACPI mode */
|
2005-04-17 05:20:36 +07:00
|
|
|
|
ACPICA: simplify SCI_EN workaround
acpi_hw_set_mode() double checks its effectiveness
by calling acpi_hw_get_mode() -- polling up to 3 seconds.
It would be more logical for its caller, acpi_enable()
acpi_enable() to do the double-checking. (lets assume
that acpi_disable() isn't interesting)
The ACPI specification is unclear on this point.
Some parts say that the BIOS sets SCI_EN and then returns to the OS,
but one part says "OSPM polls the SCI_EN bit until it is sampled SET".
The systems I have on hand do the former,
SCI_EN is observed to be set upon return from the BIOS.
So we move the check up out of acpi_hw_set_mode()
up into acpi_enable() where it makes logical sense.
Then we replace the 3-second polling loop
with a single check. If this check fails, we'll see:
"Hardware did not enter ACPI mode"
and the system will bail out of ACPI initialization
and likely fail to boot. If we see that in practice,
we can restore the polling, but put it into acpi_enable.
This patch is important if acpi_enable() is used in
the resume from S3 path. Many systems today are seen
coming back from S3 with SCI_EN off, and then failing
to set SCI_EN in response to acpi_enable(). Those systems
will take 3 seconds longer to resume due to this loop.
However, it is possible that we will not use acpi_enable()
in the S3 resume path, and bang SCI_EN directly, which
would make the loop harmless, as it would be invisible
to all systems except those that need it.
Signed-off-by: Len Brown <len.brown@intel.com>
2010-05-07 04:41:08 +07:00
|
|
|
status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Could not transition to ACPI mode"));
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Sanity check that transition succeeded */
|
|
|
|
|
|
|
|
if (acpi_hw_get_mode() != ACPI_SYS_MODE_ACPI) {
|
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Hardware did not enter ACPI mode"));
|
|
|
|
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
ACPICA: simplify SCI_EN workaround
acpi_hw_set_mode() double checks its effectiveness
by calling acpi_hw_get_mode() -- polling up to 3 seconds.
It would be more logical for its caller, acpi_enable()
acpi_enable() to do the double-checking. (lets assume
that acpi_disable() isn't interesting)
The ACPI specification is unclear on this point.
Some parts say that the BIOS sets SCI_EN and then returns to the OS,
but one part says "OSPM polls the SCI_EN bit until it is sampled SET".
The systems I have on hand do the former,
SCI_EN is observed to be set upon return from the BIOS.
So we move the check up out of acpi_hw_set_mode()
up into acpi_enable() where it makes logical sense.
Then we replace the 3-second polling loop
with a single check. If this check fails, we'll see:
"Hardware did not enter ACPI mode"
and the system will bail out of ACPI initialization
and likely fail to boot. If we see that in practice,
we can restore the polling, but put it into acpi_enable.
This patch is important if acpi_enable() is used in
the resume from S3 path. Many systems today are seen
coming back from S3 with SCI_EN off, and then failing
to set SCI_EN in response to acpi_enable(). Those systems
will take 3 seconds longer to resume due to this loop.
However, it is possible that we will not use acpi_enable()
in the S3 resume path, and bang SCI_EN directly, which
would make the loop harmless, as it would be invisible
to all systems except those that need it.
Signed-off-by: Len Brown <len.brown@intel.com>
2010-05-07 04:41:08 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
|
|
|
"Transition to ACPI mode successful\n"));
|
|
|
|
|
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2006-10-03 11:00:00 +07:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_enable)
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_disable
|
|
|
|
*
|
|
|
|
* PARAMETERS: None
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2005-04-19 09:49:35 +07:00
|
|
|
* DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode.
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status acpi_disable(void)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status status = AE_OK;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_disable);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
|
|
|
"System is already in legacy (non-ACPI) mode\n"));
|
|
|
|
} else {
|
2005-04-17 05:20:36 +07:00
|
|
|
/* Transition to LEGACY mode */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 04:43:00 +07:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Could not exit ACPI mode to legacy mode"));
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI mode disabled\n"));
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2006-10-03 11:00:00 +07:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_disable)
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_enable_event
|
|
|
|
*
|
|
|
|
* PARAMETERS: Event - The fixed eventto be enabled
|
|
|
|
* Flags - Reserved
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Enable an ACPI event (fixed)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status acpi_enable_event(u32 event, u32 flags)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
u32 value;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_enable_event);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Decode the Fixed Event */
|
|
|
|
|
|
|
|
if (event > ACPI_EVENT_MAX) {
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-11-12 15:01:56 +07:00
|
|
|
* Enable the requested fixed event (by writing a one to the enable
|
|
|
|
* register bit)
|
2005-04-17 05:20:36 +07:00
|
|
|
*/
|
2005-08-05 11:44:28 +07:00
|
|
|
status =
|
2009-02-23 14:02:07 +07:00
|
|
|
acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
|
2009-03-06 08:49:25 +07:00
|
|
|
enable_register_id, ACPI_ENABLE_EVENT);
|
2005-08-05 11:44:28 +07:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure that the hardware responded */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
status =
|
2009-02-23 14:02:07 +07:00
|
|
|
acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
|
|
|
|
enable_register_id, &value);
|
2005-08-05 11:44:28 +07:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (value != 1) {
|
2006-01-28 04:43:00 +07:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Could not enable %s event",
|
|
|
|
acpi_ut_get_event_name(event)));
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2006-10-03 11:00:00 +07:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_enable_event)
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-06-08 15:49:08 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_clear_and_enable_gpe
|
|
|
|
*
|
|
|
|
* PARAMETERS: gpe_event_info - GPE to enable
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Clear the given GPE from stale events and enable it.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
static acpi_status
|
|
|
|
acpi_clear_and_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
|
|
|
|
{
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We will only allow a GPE to be enabled if it has either an
|
|
|
|
* associated method (_Lxx/_Exx) or a handler. Otherwise, the
|
|
|
|
* GPE will be immediately disabled by acpi_ev_gpe_dispatch the
|
|
|
|
* first time it fires.
|
|
|
|
*/
|
|
|
|
if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)) {
|
|
|
|
return_ACPI_STATUS(AE_NO_HANDLER);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear the GPE (of stale events) */
|
|
|
|
status = acpi_hw_clear_gpe(gpe_event_info);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable the requested GPE */
|
|
|
|
status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
|
|
|
|
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
2010-02-18 05:41:07 +07:00
|
|
|
* FUNCTION: acpi_set_gpe
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
2010-04-06 13:52:37 +07:00
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
2005-04-17 05:20:36 +07:00
|
|
|
* gpe_number - GPE level within the GPE block
|
2010-04-06 13:52:37 +07:00
|
|
|
* action - ACPI_GPE_ENABLE or ACPI_GPE_DISABLE
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2010-04-06 13:52:37 +07:00
|
|
|
* DESCRIPTION: Enable or disable an individual GPE. This function bypasses
|
|
|
|
* the reference count mechanism used in the acpi_enable_gpe and
|
|
|
|
* acpi_disable_gpe interfaces -- and should be used with care.
|
|
|
|
*
|
|
|
|
* Note: Typically used to disable a runtime GPE for short period of time,
|
|
|
|
* then re-enable it, without disturbing the existing reference counts. This
|
|
|
|
* is useful, for example, in the Embedded Controller (EC) driver.
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
2010-02-18 05:41:07 +07:00
|
|
|
acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-04-06 13:52:37 +07:00
|
|
|
acpi_status status;
|
|
|
|
acpi_cpu_flags flags;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-02-18 05:41:07 +07:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_set_gpe);
|
|
|
|
|
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (!gpe_event_info) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2010-02-18 05:41:07 +07:00
|
|
|
/* Perform the action */
|
|
|
|
|
|
|
|
switch (action) {
|
|
|
|
case ACPI_GPE_ENABLE:
|
2010-06-08 15:49:08 +07:00
|
|
|
status = acpi_clear_and_enable_gpe(gpe_event_info);
|
2010-02-18 05:41:07 +07:00
|
|
|
break;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-02-18 05:41:07 +07:00
|
|
|
case ACPI_GPE_DISABLE:
|
2010-06-08 15:49:08 +07:00
|
|
|
status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE);
|
2010-02-18 05:41:07 +07:00
|
|
|
break;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-02-18 05:41:07 +07:00
|
|
|
default:
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
break;
|
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
unlock_and_exit:
|
2010-02-18 05:41:07 +07:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2010-02-18 05:41:07 +07:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_set_gpe)
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-06-25 06:18:39 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_gpe_wakeup
|
|
|
|
*
|
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
|
|
|
* gpe_number - GPE level within the GPE block
|
|
|
|
* Action - Enable or Disable
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Set or clear the GPE's wakeup enable mask bit.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
acpi_status acpi_gpe_wakeup(acpi_handle gpe_device, u32 gpe_number, u8 action)
|
|
|
|
{
|
|
|
|
acpi_status status = AE_OK;
|
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
|
|
|
struct acpi_gpe_register_info *gpe_register_info;
|
|
|
|
acpi_cpu_flags flags;
|
|
|
|
u32 register_bit;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_TRACE(acpi_gpe_wakeup);
|
|
|
|
|
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
|
|
|
|
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
|
|
|
if (!gpe_event_info) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
gpe_register_info = gpe_event_info->register_info;
|
|
|
|
if (!gpe_register_info) {
|
|
|
|
status = AE_NOT_EXIST;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
register_bit =
|
|
|
|
acpi_hw_get_gpe_register_bit(gpe_event_info, gpe_register_info);
|
|
|
|
|
|
|
|
/* Perform the action */
|
|
|
|
|
|
|
|
switch (action) {
|
|
|
|
case ACPI_GPE_ENABLE:
|
2010-07-01 09:11:45 +07:00
|
|
|
ACPI_SET_BIT(gpe_register_info->enable_for_wake,
|
|
|
|
(u8)register_bit);
|
2010-06-25 06:18:39 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_GPE_DISABLE:
|
|
|
|
ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
|
2010-07-01 09:11:45 +07:00
|
|
|
(u8)register_bit);
|
2010-06-25 06:18:39 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ACPI_ERROR((AE_INFO, "%u, Invalid action", action));
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
unlock_and_exit:
|
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
|
|
|
|
|
|
|
ACPI_EXPORT_SYMBOL(acpi_gpe_wakeup)
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_enable_gpe
|
|
|
|
*
|
2010-04-06 13:52:37 +07:00
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
2005-04-17 05:20:36 +07:00
|
|
|
* gpe_number - GPE level within the GPE block
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2010-04-06 13:52:37 +07:00
|
|
|
* DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is
|
2010-07-01 09:11:45 +07:00
|
|
|
* hardware-enabled.
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
2010-07-01 09:11:45 +07:00
|
|
|
acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-04-06 13:52:37 +07:00
|
|
|
acpi_cpu_flags flags;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_enable_gpe);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-10-26 00:48:46 +07:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (!gpe_event_info) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2010-07-01 09:11:45 +07:00
|
|
|
if (gpe_event_info->runtime_count == ACPI_UINT8_MAX) {
|
|
|
|
status = AE_LIMIT; /* Too many references */
|
|
|
|
goto unlock_and_exit;
|
2010-02-18 05:41:07 +07:00
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-07-01 09:11:45 +07:00
|
|
|
gpe_event_info->runtime_count++;
|
|
|
|
if (gpe_event_info->runtime_count == 1) {
|
|
|
|
status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
|
|
|
|
if (ACPI_SUCCESS(status)) {
|
|
|
|
status = acpi_clear_and_enable_gpe(gpe_event_info);
|
2010-02-18 05:41:07 +07:00
|
|
|
}
|
2010-07-01 09:11:45 +07:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
gpe_event_info->runtime_count--;
|
2010-04-06 13:52:37 +07:00
|
|
|
}
|
2010-02-18 05:41:07 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
unlock_and_exit:
|
2008-10-26 00:48:46 +07:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
2006-10-03 11:00:00 +07:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_enable_gpe)
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_disable_gpe
|
|
|
|
*
|
2010-04-06 13:52:37 +07:00
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
2005-04-17 05:20:36 +07:00
|
|
|
* gpe_number - GPE level within the GPE block
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2010-04-06 13:52:37 +07:00
|
|
|
* DESCRIPTION: Remove a reference to a GPE. When the last reference is
|
|
|
|
* removed, only then is the GPE disabled (for runtime GPEs), or
|
|
|
|
* the GPE mask bit disabled (for wake GPEs)
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
2010-07-01 09:11:45 +07:00
|
|
|
acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-04-06 13:52:37 +07:00
|
|
|
acpi_cpu_flags flags;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_disable_gpe);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-10-26 00:48:46 +07:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2010-04-06 13:52:37 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (!gpe_event_info) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2010-04-06 13:52:37 +07:00
|
|
|
/* Hardware-disable a runtime GPE on removal of the last reference */
|
|
|
|
|
2010-07-01 09:11:45 +07:00
|
|
|
if (!gpe_event_info->runtime_count) {
|
|
|
|
status = AE_LIMIT; /* There are no references to remove */
|
|
|
|
goto unlock_and_exit;
|
2010-02-18 05:41:07 +07:00
|
|
|
}
|
|
|
|
|
2010-07-01 09:11:45 +07:00
|
|
|
gpe_event_info->runtime_count--;
|
|
|
|
if (!gpe_event_info->runtime_count) {
|
|
|
|
status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
|
|
|
|
if (ACPI_SUCCESS(status)) {
|
|
|
|
status =
|
|
|
|
acpi_hw_low_set_gpe(gpe_event_info,
|
|
|
|
ACPI_GPE_DISABLE);
|
2010-04-06 13:52:37 +07:00
|
|
|
}
|
2010-07-01 09:11:45 +07:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
gpe_event_info->runtime_count++;
|
2010-04-06 13:52:37 +07:00
|
|
|
}
|
2010-02-18 05:41:07 +07:00
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-10-26 00:48:46 +07:00
|
|
|
unlock_and_exit:
|
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
2006-10-03 11:00:00 +07:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_disable_gpe)
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_disable_event
|
|
|
|
*
|
|
|
|
* PARAMETERS: Event - The fixed eventto be enabled
|
|
|
|
* Flags - Reserved
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Disable an ACPI event (fixed)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status acpi_disable_event(u32 event, u32 flags)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
u32 value;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_disable_event);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Decode the Fixed Event */
|
|
|
|
|
|
|
|
if (event > ACPI_EVENT_MAX) {
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-11-12 15:01:56 +07:00
|
|
|
* Disable the requested fixed event (by writing a zero to the enable
|
|
|
|
* register bit)
|
2005-04-17 05:20:36 +07:00
|
|
|
*/
|
2005-08-05 11:44:28 +07:00
|
|
|
status =
|
2009-02-23 14:02:07 +07:00
|
|
|
acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
|
2009-03-06 08:49:25 +07:00
|
|
|
enable_register_id, ACPI_DISABLE_EVENT);
|
2005-08-05 11:44:28 +07:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
status =
|
2009-02-23 14:02:07 +07:00
|
|
|
acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
|
|
|
|
enable_register_id, &value);
|
2005-08-05 11:44:28 +07:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (value != 0) {
|
2006-01-28 04:43:00 +07:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Could not disable %s events",
|
|
|
|
acpi_ut_get_event_name(event)));
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2006-10-03 11:00:00 +07:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_disable_event)
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_clear_event
|
|
|
|
*
|
|
|
|
* PARAMETERS: Event - The fixed event to be cleared
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Clear an ACPI event (fixed)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status acpi_clear_event(u32 event)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status status = AE_OK;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_clear_event);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Decode the Fixed Event */
|
|
|
|
|
|
|
|
if (event > ACPI_EVENT_MAX) {
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-11-12 15:01:56 +07:00
|
|
|
* Clear the requested fixed event (By writing a one to the status
|
|
|
|
* register bit)
|
2005-04-17 05:20:36 +07:00
|
|
|
*/
|
2005-08-05 11:44:28 +07:00
|
|
|
status =
|
2009-02-23 14:02:07 +07:00
|
|
|
acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
|
2009-03-06 08:49:25 +07:00
|
|
|
status_register_id, ACPI_CLEAR_STATUS);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2006-10-03 11:00:00 +07:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_clear_event)
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_clear_gpe
|
|
|
|
*
|
2010-04-06 13:52:37 +07:00
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
2005-04-17 05:20:36 +07:00
|
|
|
* gpe_number - GPE level within the GPE block
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Clear an ACPI event (general purpose)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2010-04-06 13:52:37 +07:00
|
|
|
acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-04-06 13:52:37 +07:00
|
|
|
acpi_cpu_flags flags;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_clear_gpe);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-04-06 13:52:37 +07:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (!gpe_event_info) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
status = acpi_hw_clear_gpe(gpe_event_info);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
unlock_and_exit:
|
2010-04-06 13:52:37 +07:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2006-10-03 11:00:00 +07:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_clear_gpe)
|
2005-04-17 05:20:36 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_get_event_status
|
|
|
|
*
|
|
|
|
* PARAMETERS: Event - The fixed event
|
2005-04-19 09:49:35 +07:00
|
|
|
* event_status - Where the current status of the event will
|
2005-04-17 05:20:36 +07:00
|
|
|
* be returned
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Obtains and returns the current status of the event
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status status = AE_OK;
|
2008-06-20 08:42:47 +07:00
|
|
|
u32 value;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_get_event_status);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
if (!event_status) {
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Decode the Fixed Event */
|
|
|
|
|
|
|
|
if (event > ACPI_EVENT_MAX) {
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the status of the requested fixed event */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
status =
|
2009-02-23 14:02:07 +07:00
|
|
|
acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
|
2008-06-20 08:42:47 +07:00
|
|
|
enable_register_id, &value);
|
|
|
|
if (ACPI_FAILURE(status))
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
|
|
|
|
*event_status = value;
|
|
|
|
|
|
|
|
status =
|
2009-02-23 14:02:07 +07:00
|
|
|
acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
|
2008-06-20 08:42:47 +07:00
|
|
|
status_register_id, &value);
|
|
|
|
if (ACPI_FAILURE(status))
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
|
|
|
|
if (value)
|
|
|
|
*event_status |= ACPI_EVENT_FLAG_SET;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-10-28 04:01:02 +07:00
|
|
|
if (acpi_gbl_fixed_event_handlers[event].handler)
|
|
|
|
*event_status |= ACPI_EVENT_FLAG_HANDLE;
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2006-10-03 11:00:00 +07:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_get_event_status)
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_get_gpe_status
|
|
|
|
*
|
2010-04-06 13:52:37 +07:00
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
2005-04-17 05:20:36 +07:00
|
|
|
* gpe_number - GPE level within the GPE block
|
2005-04-19 09:49:35 +07:00
|
|
|
* event_status - Where the current status of the event will
|
2005-04-17 05:20:36 +07:00
|
|
|
* be returned
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Get status of an event (general purpose)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
acpi_status
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_get_gpe_status(acpi_handle gpe_device,
|
2010-04-06 13:52:37 +07:00
|
|
|
u32 gpe_number, acpi_event_status *event_status)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-04-06 13:52:37 +07:00
|
|
|
acpi_cpu_flags flags;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_get_gpe_status);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-04-06 13:52:37 +07:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (!gpe_event_info) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Obtain status on the requested GPE number */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
status = acpi_hw_get_gpe_status(gpe_event_info, event_status);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-10-28 04:01:02 +07:00
|
|
|
if (gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)
|
|
|
|
*event_status |= ACPI_EVENT_FLAG_HANDLE;
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
unlock_and_exit:
|
2010-04-06 13:52:37 +07:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
2006-10-03 11:00:00 +07:00
|
|
|
|
|
|
|
ACPI_EXPORT_SYMBOL(acpi_get_gpe_status)
|
2005-04-17 05:20:36 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_install_gpe_block
|
|
|
|
*
|
|
|
|
* PARAMETERS: gpe_device - Handle to the parent GPE Block Device
|
|
|
|
* gpe_block_address - Address and space_iD
|
|
|
|
* register_count - Number of GPE register pairs in the block
|
2005-05-13 11:00:00 +07:00
|
|
|
* interrupt_number - H/W interrupt for the block
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Create and Install a block of GPE registers
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
acpi_status
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_install_gpe_block(acpi_handle gpe_device,
|
|
|
|
struct acpi_generic_address *gpe_block_address,
|
|
|
|
u32 register_count, u32 interrupt_number)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status status;
|
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
struct acpi_namespace_node *node;
|
|
|
|
struct acpi_gpe_block_info *gpe_block;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_install_gpe_block);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
if ((!gpe_device) || (!gpe_block_address) || (!register_count)) {
|
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 05:20:36 +07:00
|
|
|
return (status);
|
|
|
|
}
|
|
|
|
|
2009-12-11 13:57:00 +07:00
|
|
|
node = acpi_ns_validate_handle(gpe_device);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (!node) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For user-installed GPE Block Devices, the gpe_block_base_number
|
|
|
|
* is always zero
|
|
|
|
*/
|
2005-08-05 11:44:28 +07:00
|
|
|
status =
|
|
|
|
acpi_ev_create_gpe_block(node, gpe_block_address, register_count, 0,
|
|
|
|
interrupt_number, &gpe_block);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 05:20:36 +07:00
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2010-04-06 13:52:37 +07:00
|
|
|
/* Install block in the device_object attached to the node */
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (!obj_desc) {
|
2006-10-02 11:00:00 +07:00
|
|
|
|
2010-04-06 13:52:37 +07:00
|
|
|
/*
|
|
|
|
* No object, create a new one (Device nodes do not always have
|
|
|
|
* an attached object)
|
|
|
|
*/
|
2005-08-05 11:44:28 +07:00
|
|
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (!obj_desc) {
|
|
|
|
status = AE_NO_MEMORY;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
status =
|
|
|
|
acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_DEVICE);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Remove local reference to the object */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_ut_remove_reference(obj_desc);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 05:20:36 +07:00
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-06 13:52:37 +07:00
|
|
|
/* Now install the GPE block in the device_object */
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
obj_desc->device.gpe_block = gpe_block;
|
|
|
|
|
2010-04-06 13:52:37 +07:00
|
|
|
/* Run the _PRW methods and enable the runtime GPEs in the new block */
|
|
|
|
|
|
|
|
status = acpi_ev_initialize_gpe_block(node, gpe_block);
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
unlock_and_exit:
|
|
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2006-10-03 11:00:00 +07:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_install_gpe_block)
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_remove_gpe_block
|
|
|
|
*
|
|
|
|
* PARAMETERS: gpe_device - Handle to the parent GPE Block Device
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Remove a previously installed block of GPE registers
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
acpi_status status;
|
|
|
|
struct acpi_namespace_node *node;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_remove_gpe_block);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
if (!gpe_device) {
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 05:20:36 +07:00
|
|
|
return (status);
|
|
|
|
}
|
|
|
|
|
2009-12-11 13:57:00 +07:00
|
|
|
node = acpi_ns_validate_handle(gpe_device);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (!node) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the device_object attached to the node */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
|
|
|
if (!obj_desc || !obj_desc->device.gpe_block) {
|
|
|
|
return_ACPI_STATUS(AE_NULL_OBJECT);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Delete the GPE block (but not the device_object) */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
status = acpi_ev_delete_gpe_block(obj_desc->device.gpe_block);
|
|
|
|
if (ACPI_SUCCESS(status)) {
|
2005-04-17 05:20:36 +07:00
|
|
|
obj_desc->device.gpe_block = NULL;
|
|
|
|
}
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
unlock_and_exit:
|
|
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
2005-04-19 09:49:35 +07:00
|
|
|
|
2006-10-03 11:00:00 +07:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block)
|
2008-12-30 08:45:17 +07:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_get_gpe_device
|
|
|
|
*
|
|
|
|
* PARAMETERS: Index - System GPE index (0-current_gpe_count)
|
|
|
|
* gpe_device - Where the parent GPE Device is returned
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Obtain the GPE device associated with the input index. A NULL
|
|
|
|
* gpe device indicates that the gpe number is contained in one of
|
|
|
|
* the FADT-defined gpe blocks. Otherwise, the GPE block device.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
acpi_status
|
|
|
|
acpi_get_gpe_device(u32 index, acpi_handle *gpe_device)
|
|
|
|
{
|
|
|
|
struct acpi_gpe_device_info info;
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_TRACE(acpi_get_gpe_device);
|
|
|
|
|
|
|
|
if (!gpe_device) {
|
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (index >= acpi_current_gpe_count) {
|
|
|
|
return_ACPI_STATUS(AE_NOT_EXIST);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup and walk the GPE list */
|
|
|
|
|
|
|
|
info.index = index;
|
|
|
|
info.status = AE_NOT_EXIST;
|
|
|
|
info.gpe_device = NULL;
|
|
|
|
info.next_block_base_index = 0;
|
|
|
|
|
|
|
|
status = acpi_ev_walk_gpe_list(acpi_ev_get_gpe_device, &info);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
|
|
|
|
|
|
|
*gpe_device = info.gpe_device;
|
|
|
|
return_ACPI_STATUS(info.status);
|
|
|
|
}
|
|
|
|
|
|
|
|
ACPI_EXPORT_SYMBOL(acpi_get_gpe_device)
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_get_gpe_device
|
|
|
|
*
|
|
|
|
* PARAMETERS: GPE_WALK_CALLBACK
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Matches the input GPE index (0-current_gpe_count) with a GPE
|
|
|
|
* block device. NULL if the GPE is one of the FADT-defined GPEs.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2009-04-22 12:02:06 +07:00
|
|
|
static acpi_status
|
2008-12-30 08:45:17 +07:00
|
|
|
acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
|
|
|
struct acpi_gpe_block_info *gpe_block, void *context)
|
|
|
|
{
|
|
|
|
struct acpi_gpe_device_info *info = context;
|
|
|
|
|
|
|
|
/* Increment Index by the number of GPEs in this block */
|
|
|
|
|
2010-04-06 13:52:37 +07:00
|
|
|
info->next_block_base_index += gpe_block->gpe_count;
|
2008-12-30 08:45:17 +07:00
|
|
|
|
|
|
|
if (info->index < info->next_block_base_index) {
|
|
|
|
/*
|
|
|
|
* The GPE index is within this block, get the node. Leave the node
|
|
|
|
* NULL for the FADT-defined GPEs
|
|
|
|
*/
|
|
|
|
if ((gpe_block->node)->type == ACPI_TYPE_DEVICE) {
|
|
|
|
info->gpe_device = gpe_block->node;
|
|
|
|
}
|
|
|
|
|
|
|
|
info->status = AE_OK;
|
|
|
|
return (AE_CTRL_END);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (AE_OK);
|
|
|
|
}
|
2008-12-30 08:55:48 +07:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_disable_all_gpes
|
|
|
|
*
|
|
|
|
* PARAMETERS: None
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Disable and clear all GPEs in all GPE blocks
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status acpi_disable_all_gpes(void)
|
|
|
|
{
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_TRACE(acpi_disable_all_gpes);
|
|
|
|
|
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
|
|
|
|
|
|
|
status = acpi_hw_disable_all_gpes();
|
|
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
|
|
|
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_enable_all_runtime_gpes
|
|
|
|
*
|
|
|
|
* PARAMETERS: None
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status acpi_enable_all_runtime_gpes(void)
|
|
|
|
{
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_TRACE(acpi_enable_all_runtime_gpes);
|
|
|
|
|
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
|
|
|
|
|
|
|
status = acpi_hw_enable_all_runtime_gpes();
|
|
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
|
|
|
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|