2005-04-17 06:20:36 +08:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2010-01-22 19:07:36 +08:00
|
|
|
* Copyright (C) 2000 - 2010, Intel Corp.
|
2005-04-17 06:20:36 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions, and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
|
|
|
* substantially similar to the "NO WARRANTY" disclaimer below
|
|
|
|
* ("Disclaimer") and any redistribution must be conditioned upon
|
|
|
|
* including a substantially similar Disclaimer requirement for further
|
|
|
|
* binary redistribution.
|
|
|
|
* 3. Neither the names of the above-listed copyright holders nor the names
|
|
|
|
* of any contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of the
|
|
|
|
* GNU General Public License ("GPL") version 2 as published by the Free
|
|
|
|
* Software Foundation.
|
|
|
|
*
|
|
|
|
* NO WARRANTY
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGES.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <acpi/acpi.h>
|
2009-01-09 13:30:03 +08:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "acevents.h"
|
|
|
|
#include "acnamesp.h"
|
|
|
|
#include "actables.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_EVENTS
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_MODULE_NAME("evxfevnt")
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-12-30 09:45:17 +08:00
|
|
|
/* Local prototypes */
|
2009-04-22 13:02:06 +08:00
|
|
|
static acpi_status
|
2008-12-30 09:45:17 +08: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 06:20:36 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_enable
|
|
|
|
*
|
|
|
|
* PARAMETERS: None
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Transfers the system into ACPI mode.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2008-12-30 09:45:17 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status acpi_enable(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_enable);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-02-03 00:48:23 +08:00
|
|
|
/* ACPI tables must be present */
|
|
|
|
|
|
|
|
if (!acpi_tb_tables_loaded()) {
|
|
|
|
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check current mode */
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
|
|
|
"System is already in ACPI mode\n"));
|
|
|
|
} else {
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Transition to ACPI mode */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Could not transition to ACPI mode"));
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
|
|
|
"Transition to ACPI mode successful\n"));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_enable)
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_disable
|
|
|
|
*
|
|
|
|
* PARAMETERS: None
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status acpi_disable(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_disable);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
|
|
|
"System is already in legacy (non-ACPI) mode\n"));
|
|
|
|
} else {
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Transition to LEGACY mode */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Could not exit ACPI mode to legacy mode"));
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI mode disabled\n"));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_disable)
|
|
|
|
|
2005-04-17 06:20:36 +08: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 12:44:28 +08:00
|
|
|
acpi_status acpi_enable_event(u32 event, u32 flags)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
u32 value;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_enable_event);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Decode the Fixed Event */
|
|
|
|
|
|
|
|
if (event > ACPI_EVENT_MAX) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-11-12 16:01:56 +08:00
|
|
|
* Enable the requested fixed event (by writing a one to the enable
|
|
|
|
* register bit)
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
2009-02-23 15:02:07 +08:00
|
|
|
acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
|
2009-03-06 09:49:25 +08:00
|
|
|
enable_register_id, ACPI_ENABLE_EVENT);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure that the hardware responded */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
2009-02-23 15:02:07 +08:00
|
|
|
acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
|
|
|
|
enable_register_id, &value);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (value != 1) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Could not enable %s event",
|
|
|
|
acpi_ut_get_event_name(event)));
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_enable_event)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
2010-02-18 06:41:07 +08:00
|
|
|
* FUNCTION: acpi_set_gpe
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2010-04-06 14:52:37 +08:00
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
2005-04-17 06:20:36 +08:00
|
|
|
* gpe_number - GPE level within the GPE block
|
2010-04-06 14:52:37 +08:00
|
|
|
* action - ACPI_GPE_ENABLE or ACPI_GPE_DISABLE
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2010-04-06 14:52:37 +08: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 06:20:36 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
2010-02-18 06:41:07 +08:00
|
|
|
acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-04-06 14:52:37 +08:00
|
|
|
acpi_status status;
|
|
|
|
acpi_cpu_flags flags;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-02-18 06:41:07 +08:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_set_gpe);
|
|
|
|
|
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!gpe_event_info) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2010-02-18 06:41:07 +08:00
|
|
|
/* Perform the action */
|
|
|
|
|
|
|
|
switch (action) {
|
|
|
|
case ACPI_GPE_ENABLE:
|
2010-02-24 07:52:08 +08:00
|
|
|
status = acpi_ev_enable_gpe(gpe_event_info);
|
2010-02-18 06:41:07 +08:00
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-02-18 06:41:07 +08:00
|
|
|
case ACPI_GPE_DISABLE:
|
|
|
|
status = acpi_ev_disable_gpe(gpe_event_info);
|
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-02-18 06:41:07 +08:00
|
|
|
default:
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
break;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
unlock_and_exit:
|
2010-02-18 06:41:07 +08:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2010-02-18 06:41:07 +08:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_set_gpe)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_enable_gpe
|
|
|
|
*
|
2010-04-06 14:52:37 +08:00
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
2005-04-17 06:20:36 +08:00
|
|
|
* gpe_number - GPE level within the GPE block
|
2010-04-06 14:52:37 +08:00
|
|
|
* gpe_type - ACPI_GPE_TYPE_RUNTIME or ACPI_GPE_TYPE_WAKE
|
|
|
|
* or both
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2010-04-06 14:52:37 +08:00
|
|
|
* DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is
|
|
|
|
* hardware-enabled (for runtime GPEs), or the GPE register mask
|
|
|
|
* is updated (for wake GPEs).
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
2010-04-06 14:52:37 +08:00
|
|
|
acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-04-06 14:52:37 +08:00
|
|
|
acpi_cpu_flags flags;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_enable_gpe);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-04-06 14:52:37 +08:00
|
|
|
/* Parameter validation */
|
|
|
|
|
|
|
|
if (!gpe_type || (gpe_type & ~ACPI_GPE_TYPE_WAKE_RUN)) {
|
2010-02-24 07:52:08 +08:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2010-04-06 14:52:37 +08:00
|
|
|
}
|
2010-02-24 07:52:08 +08:00
|
|
|
|
2008-10-26 01:48:46 +08:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!gpe_event_info) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2010-04-06 14:52:37 +08:00
|
|
|
if (gpe_type & ACPI_GPE_TYPE_RUNTIME) {
|
|
|
|
if (gpe_event_info->runtime_count == ACPI_UINT8_MAX) {
|
|
|
|
status = AE_LIMIT; /* Too many references */
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
gpe_event_info->runtime_count++;
|
|
|
|
if (gpe_event_info->runtime_count == 1) {
|
2010-02-24 07:52:08 +08:00
|
|
|
status = acpi_ev_enable_gpe(gpe_event_info);
|
2010-04-06 14:52:37 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2010-02-24 07:52:08 +08:00
|
|
|
gpe_event_info->runtime_count--;
|
2010-04-06 14:52:37 +08:00
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
2010-02-24 07:52:08 +08:00
|
|
|
}
|
2010-02-18 06:41:07 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-04-06 14:52:37 +08:00
|
|
|
if (gpe_type & ACPI_GPE_TYPE_WAKE) {
|
|
|
|
/* The GPE must have the ability to wake the system */
|
|
|
|
|
2010-02-18 06:41:07 +08:00
|
|
|
if (!(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) {
|
2010-04-06 14:52:37 +08:00
|
|
|
status = AE_TYPE;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gpe_event_info->wakeup_count == ACPI_UINT8_MAX) {
|
|
|
|
status = AE_LIMIT; /* Too many references */
|
2010-02-18 06:41:07 +08:00
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-04-06 14:52:37 +08:00
|
|
|
* Update the enable mask on the first wakeup reference. Wake GPEs
|
|
|
|
* are only hardware-enabled just before sleeping.
|
2010-02-18 06:41:07 +08:00
|
|
|
*/
|
2010-04-06 14:52:37 +08:00
|
|
|
gpe_event_info->wakeup_count++;
|
|
|
|
if (gpe_event_info->wakeup_count == 1) {
|
|
|
|
(void)acpi_ev_update_gpe_enable_masks(gpe_event_info);
|
|
|
|
}
|
2010-02-18 06:41:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
unlock_and_exit:
|
2008-10-26 01:48:46 +08:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_enable_gpe)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_disable_gpe
|
|
|
|
*
|
2010-04-06 14:52:37 +08:00
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
2005-04-17 06:20:36 +08:00
|
|
|
* gpe_number - GPE level within the GPE block
|
2010-04-06 14:52:37 +08:00
|
|
|
* gpe_type - ACPI_GPE_TYPE_RUNTIME or ACPI_GPE_TYPE_WAKE
|
|
|
|
* or both
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2010-04-06 14:52:37 +08: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 06:20:36 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
2010-04-06 14:52:37 +08:00
|
|
|
acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-04-06 14:52:37 +08:00
|
|
|
acpi_cpu_flags flags;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_disable_gpe);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-04-06 14:52:37 +08:00
|
|
|
/* Parameter validation */
|
|
|
|
|
|
|
|
if (!gpe_type || (gpe_type & ~ACPI_GPE_TYPE_WAKE_RUN)) {
|
2010-02-24 07:52:08 +08:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2010-04-06 14:52:37 +08:00
|
|
|
}
|
2010-02-24 07:52:08 +08:00
|
|
|
|
2008-10-26 01:48:46 +08:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2010-04-06 14:52:37 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!gpe_event_info) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2010-04-06 14:52:37 +08:00
|
|
|
/* Hardware-disable a runtime GPE on removal of the last reference */
|
|
|
|
|
|
|
|
if (gpe_type & ACPI_GPE_TYPE_RUNTIME) {
|
|
|
|
if (!gpe_event_info->runtime_count) {
|
|
|
|
status = AE_LIMIT; /* There are no references to remove */
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
gpe_event_info->runtime_count--;
|
|
|
|
if (!gpe_event_info->runtime_count) {
|
2010-02-24 07:52:08 +08:00
|
|
|
status = acpi_ev_disable_gpe(gpe_event_info);
|
2010-04-06 14:52:37 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
gpe_event_info->runtime_count++;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
}
|
2010-02-18 06:41:07 +08:00
|
|
|
}
|
|
|
|
|
2010-04-06 14:52:37 +08:00
|
|
|
/*
|
|
|
|
* Update masks for wake GPE on removal of the last reference.
|
|
|
|
* No need to hardware-disable wake GPEs here, they are not currently
|
|
|
|
* enabled.
|
|
|
|
*/
|
|
|
|
if (gpe_type & ACPI_GPE_TYPE_WAKE) {
|
|
|
|
if (!gpe_event_info->wakeup_count) {
|
|
|
|
status = AE_LIMIT; /* There are no references to remove */
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
gpe_event_info->wakeup_count--;
|
|
|
|
if (!gpe_event_info->wakeup_count) {
|
|
|
|
(void)acpi_ev_update_gpe_enable_masks(gpe_event_info);
|
|
|
|
}
|
2010-02-18 06:41:07 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-10-26 01:48:46 +08:00
|
|
|
unlock_and_exit:
|
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_disable_gpe)
|
|
|
|
|
2005-04-17 06:20:36 +08: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 12:44:28 +08:00
|
|
|
acpi_status acpi_disable_event(u32 event, u32 flags)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
u32 value;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_disable_event);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Decode the Fixed Event */
|
|
|
|
|
|
|
|
if (event > ACPI_EVENT_MAX) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-11-12 16:01:56 +08:00
|
|
|
* Disable the requested fixed event (by writing a zero to the enable
|
|
|
|
* register bit)
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
2009-02-23 15:02:07 +08:00
|
|
|
acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
|
2009-03-06 09:49:25 +08:00
|
|
|
enable_register_id, ACPI_DISABLE_EVENT);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
2009-02-23 15:02:07 +08:00
|
|
|
acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
|
|
|
|
enable_register_id, &value);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (value != 0) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Could not disable %s events",
|
|
|
|
acpi_ut_get_event_name(event)));
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_disable_event)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_clear_event
|
|
|
|
*
|
|
|
|
* PARAMETERS: Event - The fixed event to be cleared
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Clear an ACPI event (fixed)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status acpi_clear_event(u32 event)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_clear_event);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Decode the Fixed Event */
|
|
|
|
|
|
|
|
if (event > ACPI_EVENT_MAX) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-11-12 16:01:56 +08:00
|
|
|
* Clear the requested fixed event (By writing a one to the status
|
|
|
|
* register bit)
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
2009-02-23 15:02:07 +08:00
|
|
|
acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
|
2009-03-06 09:49:25 +08:00
|
|
|
status_register_id, ACPI_CLEAR_STATUS);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_clear_event)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_clear_gpe
|
|
|
|
*
|
2010-04-06 14:52:37 +08:00
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
2005-04-17 06:20:36 +08:00
|
|
|
* gpe_number - GPE level within the GPE block
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Clear an ACPI event (general purpose)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2010-04-06 14:52:37 +08:00
|
|
|
acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-04-06 14:52:37 +08:00
|
|
|
acpi_cpu_flags flags;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_clear_gpe);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-04-06 14:52:37 +08:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!gpe_event_info) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_hw_clear_gpe(gpe_event_info);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
unlock_and_exit:
|
2010-04-06 14:52:37 +08:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_clear_gpe)
|
2005-04-17 06:20:36 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_get_event_status
|
|
|
|
*
|
|
|
|
* PARAMETERS: Event - The fixed event
|
2005-04-19 10:49:35 +08:00
|
|
|
* event_status - Where the current status of the event will
|
2005-04-17 06:20:36 +08:00
|
|
|
* be returned
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Obtains and returns the current status of the event
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
2008-06-20 09:42:47 +08:00
|
|
|
u32 value;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_get_event_status);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (!event_status) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Decode the Fixed Event */
|
|
|
|
|
|
|
|
if (event > ACPI_EVENT_MAX) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the status of the requested fixed event */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
2009-02-23 15:02:07 +08:00
|
|
|
acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
|
2008-06-20 09:42:47 +08:00
|
|
|
enable_register_id, &value);
|
|
|
|
if (ACPI_FAILURE(status))
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
|
|
|
|
*event_status = value;
|
|
|
|
|
|
|
|
status =
|
2009-02-23 15:02:07 +08:00
|
|
|
acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
|
2008-06-20 09:42:47 +08:00
|
|
|
status_register_id, &value);
|
|
|
|
if (ACPI_FAILURE(status))
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
|
|
|
|
if (value)
|
|
|
|
*event_status |= ACPI_EVENT_FLAG_SET;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-10-28 05:01:02 +08:00
|
|
|
if (acpi_gbl_fixed_event_handlers[event].handler)
|
|
|
|
*event_status |= ACPI_EVENT_FLAG_HANDLE;
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_get_event_status)
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_get_gpe_status
|
|
|
|
*
|
2010-04-06 14:52:37 +08:00
|
|
|
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
|
2005-04-17 06:20:36 +08:00
|
|
|
* gpe_number - GPE level within the GPE block
|
2005-04-19 10:49:35 +08:00
|
|
|
* event_status - Where the current status of the event will
|
2005-04-17 06:20:36 +08:00
|
|
|
* be returned
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Get status of an event (general purpose)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_get_gpe_status(acpi_handle gpe_device,
|
2010-04-06 14:52:37 +08:00
|
|
|
u32 gpe_number, acpi_event_status *event_status)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
struct acpi_gpe_event_info *gpe_event_info;
|
2010-04-06 14:52:37 +08:00
|
|
|
acpi_cpu_flags flags;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_get_gpe_status);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-04-06 14:52:37 +08:00
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Ensure that we have a valid GPE number */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!gpe_event_info) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Obtain status on the requested GPE number */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_hw_get_gpe_status(gpe_event_info, event_status);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-10-28 05:01:02 +08:00
|
|
|
if (gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)
|
|
|
|
*event_status |= ACPI_EVENT_FLAG_HANDLE;
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
unlock_and_exit:
|
2010-04-06 14:52:37 +08:00
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2006-10-03 12:00:00 +08:00
|
|
|
|
|
|
|
ACPI_EXPORT_SYMBOL(acpi_get_gpe_status)
|
2005-04-17 06:20:36 +08: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 12:00:00 +08:00
|
|
|
* interrupt_number - H/W interrupt for the block
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Create and Install a block of GPE registers
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08: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 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08: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 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_install_gpe_block);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
if ((!gpe_device) || (!gpe_block_address) || (!register_count)) {
|
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
return (status);
|
|
|
|
}
|
|
|
|
|
2009-12-11 14:57:00 +08:00
|
|
|
node = acpi_ns_validate_handle(gpe_device);
|
2005-04-17 06:20:36 +08: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 12:44:28 +08: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 06:20:36 +08:00
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2010-04-06 14:52:37 +08:00
|
|
|
/* Install block in the device_object attached to the node */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!obj_desc) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2010-04-06 14:52:37 +08:00
|
|
|
/*
|
|
|
|
* No object, create a new one (Device nodes do not always have
|
|
|
|
* an attached object)
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!obj_desc) {
|
|
|
|
status = AE_NO_MEMORY;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
|
|
|
acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_DEVICE);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Remove local reference to the object */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_remove_reference(obj_desc);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-06 14:52:37 +08:00
|
|
|
/* Now install the GPE block in the device_object */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
obj_desc->device.gpe_block = gpe_block;
|
|
|
|
|
2010-04-06 14:52:37 +08: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 12:44:28 +08:00
|
|
|
unlock_and_exit:
|
|
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_install_gpe_block)
|
2005-04-17 06:20:36 +08: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 12:44:28 +08:00
|
|
|
acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
acpi_status status;
|
|
|
|
struct acpi_namespace_node *node;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_remove_gpe_block);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (!gpe_device) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
return (status);
|
|
|
|
}
|
|
|
|
|
2009-12-11 14:57:00 +08:00
|
|
|
node = acpi_ns_validate_handle(gpe_device);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!node) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the device_object attached to the node */
|
|
|
|
|
2005-08-05 12:44:28 +08: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 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Delete the GPE block (but not the device_object) */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ev_delete_gpe_block(obj_desc->device.gpe_block);
|
|
|
|
if (ACPI_SUCCESS(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
obj_desc->device.gpe_block = NULL;
|
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
unlock_and_exit:
|
|
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2005-04-19 10:49:35 +08:00
|
|
|
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block)
|
2008-12-30 09:45:17 +08: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 13:02:06 +08:00
|
|
|
static acpi_status
|
2008-12-30 09:45:17 +08: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 14:52:37 +08:00
|
|
|
info->next_block_base_index += gpe_block->gpe_count;
|
2008-12-30 09:45:17 +08: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 09:55:48 +08: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);
|
|
|
|
}
|