2005-04-16 22:20:36 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2010-01-22 11:07:36 +00:00
|
|
|
* Copyright (C) 2000 - 2010, Intel Corp.
|
2005-04-16 22:20:36 +00: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 05:30:03 +00:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "acevents.h"
|
|
|
|
#include "acnamesp.h"
|
|
|
|
#include "actables.h"
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_EVENTS
|
2005-08-05 04:44:28 +00:00
|
|
|
ACPI_MODULE_NAME("evxfevnt")
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-12-30 01:45:17 +00:00
|
|
|
/* Local prototypes */
|
2009-04-22 05:02:06 +00:00
|
|
|
static acpi_status
|
2008-12-30 01:45:17 +00: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-16 22:20:36 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_enable
|
|
|
|
*
|
|
|
|
* PARAMETERS: None
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Transfers the system into ACPI mode.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2008-12-30 01:45:17 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status acpi_enable(void)
|
2005-04-16 22:20:36 +00: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-06 21:41:08 +00:00
|
|
|
acpi_status status;
|
2010-06-29 00:55:01 +00:00
|
|
|
int retry;
|
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(acpi_enable);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-02-02 16:48:23 +00:00
|
|
|
/* ACPI tables must be present */
|
|
|
|
|
|
|
|
if (!acpi_tb_tables_loaded()) {
|
|
|
|
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check current mode */
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
|
2005-08-05 04:44:28 +00: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-06 21:41:08 +00:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
|
|
|
}
|
2005-04-16 22:20:36 +00: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-06 21:41:08 +00:00
|
|
|
/* Transition to ACPI mode */
|
2005-04-16 22:20:36 +00: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-06 21:41:08 +00: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 */
|
|
|
|
|
2010-06-29 00:55:01 +00:00
|
|
|
for (retry = 0; retry < 30000; ++retry) {
|
|
|
|
if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
|
|
|
|
if (retry != 0)
|
|
|
|
ACPI_WARNING((AE_INFO,
|
|
|
|
"Platform took > %d00 usec to enter ACPI mode", retry));
|
|
|
|
return_ACPI_STATUS(AE_OK);
|
|
|
|
}
|
|
|
|
acpi_os_stall(100); /* 100 usec */
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2010-06-29 00:55:01 +00:00
|
|
|
ACPI_ERROR((AE_INFO, "Hardware did not enter ACPI mode"));
|
|
|
|
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_enable)
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_disable
|
|
|
|
*
|
|
|
|
* PARAMETERS: None
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
* DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode.
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status acpi_disable(void)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status status = AE_OK;
|
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(acpi_disable);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
|
2005-08-05 04:44:28 +00:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
|
|
|
"System is already in legacy (non-ACPI) mode\n"));
|
|
|
|
} else {
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Transition to LEGACY mode */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-27 21:43:00 +00:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Could not exit ACPI mode to legacy mode"));
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI mode disabled\n"));
|
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
|
|
|
}
|
|
|
|
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_disable)
|
|
|
|
|
2005-04-16 22:20:36 +00: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 04:44:28 +00:00
|
|
|
acpi_status acpi_enable_event(u32 event, u32 flags)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
u32 value;
|
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(acpi_enable_event);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Decode the Fixed Event */
|
|
|
|
|
|
|
|
if (event > ACPI_EVENT_MAX) {
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-11-12 08:01:56 +00:00
|
|
|
* Enable the requested fixed event (by writing a one to the enable
|
|
|
|
* register bit)
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
2005-08-05 04:44:28 +00:00
|
|
|
status =
|
2009-02-23 07:02:07 +00:00
|
|
|
acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
|
2009-03-06 01:49:25 +00:00
|
|
|
enable_register_id, ACPI_ENABLE_EVENT);
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure that the hardware responded */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status =
|
2009-02-23 07:02:07 +00:00
|
|
|
acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
|
|
|
|
enable_register_id, &value);
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (value != 1) {
|
2006-01-27 21:43:00 +00:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Could not enable %s event",
|
|
|
|
acpi_ut_get_event_name(event)));
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
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
|
|
|
}
|
|
|
|
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_enable_event)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-06-08 08:49:08 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
2010-06-24 23:18:39 +00:00
|
|
|
* FUNCTION: acpi_gpe_wakeup
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
2010-04-06 06:52:37 +00:00
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
2005-04-16 22:20:36 +00:00
|
|
|
* gpe_number - GPE level within the GPE block
|
2010-06-24 23:18:39 +00:00
|
|
|
* Action - Enable or Disable
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2010-06-24 23:18:39 +00:00
|
|
|
* DESCRIPTION: Set or clear the GPE's wakeup enable mask bit.
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
2010-06-24 23:18:39 +00:00
|
|
|
acpi_status acpi_gpe_wakeup(acpi_handle gpe_device, u32 gpe_number, u8 action)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2010-06-24 23:18:39 +00:00
|
|
|
acpi_status status = AE_OK;
|
2005-08-05 04:44:28 +00:00
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-06-24 23:18:39 +00:00
|
|
|
struct acpi_gpe_register_info *gpe_register_info;
|
2010-04-06 06:52:37 +00:00
|
|
|
acpi_cpu_flags flags;
|
2010-06-24 23:18:39 +00:00
|
|
|
u32 register_bit;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-06-24 23:18:39 +00:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_gpe_wakeup);
|
2010-02-17 22:41:07 +00:00
|
|
|
|
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2010-07-07 22:45:34 +00:00
|
|
|
if (!gpe_event_info || !(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2010-06-24 23:18:39 +00:00
|
|
|
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);
|
|
|
|
|
2010-02-17 22:41:07 +00:00
|
|
|
/* Perform the action */
|
|
|
|
|
|
|
|
switch (action) {
|
|
|
|
case ACPI_GPE_ENABLE:
|
2010-07-01 02:11:45 +00:00
|
|
|
ACPI_SET_BIT(gpe_register_info->enable_for_wake,
|
|
|
|
(u8)register_bit);
|
2010-02-17 22:41:07 +00:00
|
|
|
break;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-02-17 22:41:07 +00:00
|
|
|
case ACPI_GPE_DISABLE:
|
2010-06-24 23:18:39 +00:00
|
|
|
ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
|
2010-07-01 02:11:45 +00:00
|
|
|
(u8)register_bit);
|
2010-02-17 22:41:07 +00:00
|
|
|
break;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-02-17 22:41:07 +00:00
|
|
|
default:
|
2010-06-24 23:18:39 +00:00
|
|
|
ACPI_ERROR((AE_INFO, "%u, Invalid action", action));
|
2010-02-17 22:41:07 +00:00
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
break;
|
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-06-24 23:18:39 +00:00
|
|
|
unlock_and_exit:
|
2010-02-17 22:41:07 +00:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2010-06-24 23:18:39 +00:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_gpe_wakeup)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_enable_gpe
|
|
|
|
*
|
2010-04-06 06:52:37 +00:00
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
2005-04-16 22:20:36 +00:00
|
|
|
* gpe_number - GPE level within the GPE block
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2010-04-06 06:52:37 +00:00
|
|
|
* DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is
|
2010-07-01 02:11:45 +00:00
|
|
|
* hardware-enabled.
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
2010-07-01 02:11:45 +00:00
|
|
|
acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2010-08-03 21:55:14 +00:00
|
|
|
acpi_status status = AE_BAD_PARAMETER;
|
2005-08-05 04:44:28 +00:00
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-04-06 06:52:37 +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(acpi_enable_gpe);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-10-25 17:48:46 +00:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2010-08-03 21:55:14 +00:00
|
|
|
if (gpe_event_info) {
|
|
|
|
status = acpi_raw_enable_gpe(gpe_event_info);
|
2010-02-17 22:41:07 +00:00
|
|
|
}
|
|
|
|
|
2008-10-25 17:48:46 +00:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_enable_gpe)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_disable_gpe
|
|
|
|
*
|
2010-04-06 06:52:37 +00:00
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
2005-04-16 22:20:36 +00:00
|
|
|
* gpe_number - GPE level within the GPE block
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2010-04-06 06:52:37 +00: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-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
2010-07-01 02:11:45 +00:00
|
|
|
acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2010-08-03 21:55:14 +00:00
|
|
|
acpi_status status = AE_BAD_PARAMETER;
|
2005-08-05 04:44:28 +00:00
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-04-06 06:52:37 +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(acpi_disable_gpe);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-10-25 17:48:46 +00:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2010-04-06 06:52:37 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Ensure that we have a valid GPE number */
|
2010-04-06 06:52:37 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2010-08-03 21:55:14 +00:00
|
|
|
if (gpe_event_info) {
|
|
|
|
status = acpi_raw_disable_gpe(gpe_event_info) ;
|
2010-04-06 06:52:37 +00:00
|
|
|
}
|
2010-02-23 23:52:08 +00:00
|
|
|
|
2008-10-25 17:48:46 +00:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_disable_gpe)
|
|
|
|
|
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
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_gpe_can_wake
|
|
|
|
*
|
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
|
|
|
* gpe_number - GPE level within the GPE block
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Set the ACPI_GPE_CAN_WAKE flag for the given GPE. If the GPE
|
|
|
|
* has a corresponding method and is currently enabled, disable it
|
|
|
|
* (GPEs with corresponding methods are enabled unconditionally
|
|
|
|
* during initialization, but GPEs that can wake up are expected
|
|
|
|
* to be initially disabled).
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
acpi_status acpi_gpe_can_wake(acpi_handle gpe_device, u32 gpe_number)
|
|
|
|
{
|
|
|
|
acpi_status status = AE_OK;
|
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
|
|
|
acpi_cpu_flags flags;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_TRACE(acpi_gpe_can_wake);
|
|
|
|
|
2008-10-25 17:48:46 +00:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2010-04-06 06:52:37 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2010-09-15 22:30:43 +00:00
|
|
|
if (gpe_event_info) {
|
|
|
|
gpe_event_info->flags |= ACPI_GPE_CAN_WAKE;
|
|
|
|
} else {
|
2005-04-16 22:20:36 +00:00
|
|
|
status = AE_BAD_PARAMETER;
|
2010-02-17 22:41:07 +00:00
|
|
|
}
|
|
|
|
|
2008-10-25 17:48:46 +00:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
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
|
|
|
ACPI_EXPORT_SYMBOL(acpi_gpe_can_wake)
|
2006-10-03 04:00:00 +00:00
|
|
|
|
2005-04-16 22:20:36 +00: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 04:44:28 +00:00
|
|
|
acpi_status acpi_disable_event(u32 event, u32 flags)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
u32 value;
|
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(acpi_disable_event);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Decode the Fixed Event */
|
|
|
|
|
|
|
|
if (event > ACPI_EVENT_MAX) {
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-11-12 08:01:56 +00:00
|
|
|
* Disable the requested fixed event (by writing a zero to the enable
|
|
|
|
* register bit)
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
2005-08-05 04:44:28 +00:00
|
|
|
status =
|
2009-02-23 07:02:07 +00:00
|
|
|
acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
|
2009-03-06 01:49:25 +00:00
|
|
|
enable_register_id, ACPI_DISABLE_EVENT);
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status =
|
2009-02-23 07:02:07 +00:00
|
|
|
acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
|
|
|
|
enable_register_id, &value);
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (value != 0) {
|
2006-01-27 21:43:00 +00:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Could not disable %s events",
|
|
|
|
acpi_ut_get_event_name(event)));
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
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
|
|
|
}
|
|
|
|
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_disable_event)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_clear_event
|
|
|
|
*
|
|
|
|
* PARAMETERS: Event - The fixed event to be cleared
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Clear an ACPI event (fixed)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status acpi_clear_event(u32 event)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status status = AE_OK;
|
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(acpi_clear_event);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Decode the Fixed Event */
|
|
|
|
|
|
|
|
if (event > ACPI_EVENT_MAX) {
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-11-12 08:01:56 +00:00
|
|
|
* Clear the requested fixed event (By writing a one to the status
|
|
|
|
* register bit)
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
2005-08-05 04:44:28 +00:00
|
|
|
status =
|
2009-02-23 07:02:07 +00:00
|
|
|
acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
|
2009-03-06 01:49:25 +00:00
|
|
|
status_register_id, ACPI_CLEAR_STATUS);
|
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
|
|
|
}
|
|
|
|
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_clear_event)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_clear_gpe
|
|
|
|
*
|
2010-04-06 06:52:37 +00:00
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
2005-04-16 22:20:36 +00:00
|
|
|
* gpe_number - GPE level within the GPE block
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Clear an ACPI event (general purpose)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2010-04-06 06:52:37 +00:00
|
|
|
acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-04-06 06:52:37 +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(acpi_clear_gpe);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-04-06 06:52:37 +00:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!gpe_event_info) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_hw_clear_gpe(gpe_event_info);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
unlock_and_exit:
|
2010-04-06 06:52:37 +00:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_clear_gpe)
|
2005-04-16 22:20:36 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_get_event_status
|
|
|
|
*
|
|
|
|
* PARAMETERS: Event - The fixed event
|
2005-04-19 02:49:35 +00:00
|
|
|
* event_status - Where the current status of the event will
|
2005-04-16 22:20:36 +00:00
|
|
|
* be returned
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Obtains and returns the current status of the event
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status status = AE_OK;
|
2008-06-20 01:42:47 +00:00
|
|
|
u32 value;
|
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(acpi_get_event_status);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (!event_status) {
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Decode the Fixed Event */
|
|
|
|
|
|
|
|
if (event > ACPI_EVENT_MAX) {
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the status of the requested fixed event */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status =
|
2009-02-23 07:02:07 +00:00
|
|
|
acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
|
2008-06-20 01:42:47 +00:00
|
|
|
enable_register_id, &value);
|
|
|
|
if (ACPI_FAILURE(status))
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
|
|
|
|
*event_status = value;
|
|
|
|
|
|
|
|
status =
|
2009-02-23 07:02:07 +00:00
|
|
|
acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
|
2008-06-20 01:42:47 +00:00
|
|
|
status_register_id, &value);
|
|
|
|
if (ACPI_FAILURE(status))
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
|
|
|
|
if (value)
|
|
|
|
*event_status |= ACPI_EVENT_FLAG_SET;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-10-27 21:01:02 +00:00
|
|
|
if (acpi_gbl_fixed_event_handlers[event].handler)
|
|
|
|
*event_status |= ACPI_EVENT_FLAG_HANDLE;
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_get_event_status)
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_get_gpe_status
|
|
|
|
*
|
2010-04-06 06:52:37 +00:00
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
2005-04-16 22:20:36 +00:00
|
|
|
* gpe_number - GPE level within the GPE block
|
2005-04-19 02:49:35 +00:00
|
|
|
* event_status - Where the current status of the event will
|
2005-04-16 22:20:36 +00:00
|
|
|
* be returned
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Get status of an event (general purpose)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
acpi_status
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_get_gpe_status(acpi_handle gpe_device,
|
2010-04-06 06:52:37 +00:00
|
|
|
u32 gpe_number, acpi_event_status *event_status)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-04-06 06:52:37 +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(acpi_get_gpe_status);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-04-06 06:52:37 +00:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!gpe_event_info) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Obtain status on the requested GPE number */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_hw_get_gpe_status(gpe_event_info, event_status);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-10-27 21:01:02 +00:00
|
|
|
if (gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)
|
|
|
|
*event_status |= ACPI_EVENT_FLAG_HANDLE;
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
unlock_and_exit:
|
2010-04-06 06:52:37 +00:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
2006-10-03 04:00:00 +00:00
|
|
|
|
|
|
|
ACPI_EXPORT_SYMBOL(acpi_get_gpe_status)
|
2005-04-16 22:20:36 +00: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 04:00:00 +00:00
|
|
|
* interrupt_number - H/W interrupt for the block
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Create and Install a block of GPE registers
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
acpi_status
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_install_gpe_block(acpi_handle gpe_device,
|
|
|
|
struct acpi_generic_address *gpe_block_address,
|
|
|
|
u32 register_count, u32 interrupt_number)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2010-09-15 22:30:43 +00:00
|
|
|
acpi_status status = AE_OK;
|
2005-08-05 04:44:28 +00:00
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
struct acpi_namespace_node *node;
|
|
|
|
struct acpi_gpe_block_info *gpe_block;
|
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(acpi_install_gpe_block);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
if ((!gpe_device) || (!gpe_block_address) || (!register_count)) {
|
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
return (status);
|
|
|
|
}
|
|
|
|
|
2009-12-11 06:57:00 +00:00
|
|
|
node = acpi_ns_validate_handle(gpe_device);
|
2005-04-16 22:20:36 +00: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 04:44:28 +00:00
|
|
|
status =
|
|
|
|
acpi_ev_create_gpe_block(node, gpe_block_address, register_count, 0,
|
|
|
|
interrupt_number, &gpe_block);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2010-04-06 06:52:37 +00:00
|
|
|
/* Install block in the device_object attached to the node */
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!obj_desc) {
|
2006-10-02 04:00:00 +00:00
|
|
|
|
2010-04-06 06:52:37 +00:00
|
|
|
/*
|
|
|
|
* No object, create a new one (Device nodes do not always have
|
|
|
|
* an attached object)
|
|
|
|
*/
|
2005-08-05 04:44:28 +00:00
|
|
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!obj_desc) {
|
|
|
|
status = AE_NO_MEMORY;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status =
|
|
|
|
acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_DEVICE);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Remove local reference to the object */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ut_remove_reference(obj_desc);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-06 06:52:37 +00:00
|
|
|
/* Now install the GPE block in the device_object */
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
obj_desc->device.gpe_block = gpe_block;
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
unlock_and_exit:
|
|
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_install_gpe_block)
|
2005-04-16 22:20:36 +00: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 04:44:28 +00:00
|
|
|
acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
acpi_status status;
|
|
|
|
struct acpi_namespace_node *node;
|
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(acpi_remove_gpe_block);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (!gpe_device) {
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
return (status);
|
|
|
|
}
|
|
|
|
|
2009-12-11 06:57:00 +00:00
|
|
|
node = acpi_ns_validate_handle(gpe_device);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!node) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the device_object attached to the node */
|
|
|
|
|
2005-08-05 04:44:28 +00: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-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Delete the GPE block (but not the device_object) */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ev_delete_gpe_block(obj_desc->device.gpe_block);
|
|
|
|
if (ACPI_SUCCESS(status)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
obj_desc->device.gpe_block = NULL;
|
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
unlock_and_exit:
|
|
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
2005-04-19 02:49:35 +00:00
|
|
|
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block)
|
2008-12-30 01:45:17 +00: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 05:02:06 +00:00
|
|
|
static acpi_status
|
2008-12-30 01:45:17 +00: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 06:52:37 +00:00
|
|
|
info->next_block_base_index += gpe_block->gpe_count;
|
2008-12-30 01:45:17 +00: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 01:55:48 +00: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);
|
|
|
|
}
|
2010-09-15 22:30:43 +00:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_update_gpes
|
|
|
|
*
|
|
|
|
* PARAMETERS: None
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Enable all GPEs that have associated _Lxx or _Exx methods and
|
|
|
|
* are not pointed to by any device _PRW methods indicating that
|
|
|
|
* these GPEs are generally intended for system or device wakeup
|
|
|
|
* (such GPEs have to be enabled directly when the devices whose
|
|
|
|
* _PRW methods point to them are set up for wakeup signaling).
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status acpi_update_gpes(void)
|
|
|
|
{
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_TRACE(acpi_update_gpes);
|
|
|
|
|
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
} else if (acpi_all_gpes_initialized) {
|
|
|
|
goto unlock;
|
|
|
|
}
|
|
|
|
|
|
|
|
status = acpi_ev_walk_gpe_list(acpi_ev_initialize_gpe_block, NULL);
|
|
|
|
if (ACPI_SUCCESS(status)) {
|
|
|
|
acpi_all_gpes_initialized = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
unlock:
|
|
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
|
|
|
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|