2018-03-15 02:13:07 +03:00
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2005-04-17 02:20:36 +04:00
/******************************************************************************
*
* Module Name : evxfevnt - External Interfaces , ACPI event disable / enable
*
2022-04-11 21:54:22 +03:00
* Copyright ( C ) 2000 - 2022 , Intel Corp .
2005-04-17 02:20:36 +04:00
*
2018-03-15 02:13:07 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-04-17 02:20:36 +04:00
2013-10-29 05:29:51 +04:00
# define EXPORT_ACPI_INTERFACES
2005-04-17 02:20:36 +04:00
# include <acpi/acpi.h>
2009-01-09 08:30:03 +03:00
# include "accommon.h"
# include "actables.h"
2005-04-17 02:20:36 +04:00
# define _COMPONENT ACPI_EVENTS
2005-08-05 08:44:28 +04:00
ACPI_MODULE_NAME ( " evxfevnt " )
2005-04-17 02:20:36 +04:00
2012-02-14 14:14:27 +04:00
# if (!ACPI_REDUCED_HARDWARE) /* Entire module */
2005-04-17 02:20:36 +04:00
/*******************************************************************************
*
* FUNCTION : acpi_enable
*
* PARAMETERS : None
*
* RETURN : Status
*
* DESCRIPTION : Transfers the system into ACPI mode .
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-08-05 08:44:28 +04:00
acpi_status acpi_enable ( void )
2005-04-17 02:20:36 +04:00
{
ACPICA: simplify SCI_EN workaround
acpi_hw_set_mode() double checks its effectiveness
by calling acpi_hw_get_mode() -- polling up to 3 seconds.
It would be more logical for its caller, acpi_enable()
acpi_enable() to do the double-checking. (lets assume
that acpi_disable() isn't interesting)
The ACPI specification is unclear on this point.
Some parts say that the BIOS sets SCI_EN and then returns to the OS,
but one part says "OSPM polls the SCI_EN bit until it is sampled SET".
The systems I have on hand do the former,
SCI_EN is observed to be set upon return from the BIOS.
So we move the check up out of acpi_hw_set_mode()
up into acpi_enable() where it makes logical sense.
Then we replace the 3-second polling loop
with a single check. If this check fails, we'll see:
"Hardware did not enter ACPI mode"
and the system will bail out of ACPI initialization
and likely fail to boot. If we see that in practice,
we can restore the polling, but put it into acpi_enable.
This patch is important if acpi_enable() is used in
the resume from S3 path. Many systems today are seen
coming back from S3 with SCI_EN off, and then failing
to set SCI_EN in response to acpi_enable(). Those systems
will take 3 seconds longer to resume due to this loop.
However, it is possible that we will not use acpi_enable()
in the S3 resume path, and bang SCI_EN directly, which
would make the loop harmless, as it would be invisible
to all systems except those that need it.
Signed-off-by: Len Brown <len.brown@intel.com>
2010-05-07 01:41:08 +04:00
acpi_status status ;
2010-06-29 04:55:01 +04:00
int retry ;
2005-04-17 02:20:36 +04: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 01:15:00 +04:00
ACPI_FUNCTION_TRACE ( acpi_enable ) ;
2005-04-17 02:20:36 +04:00
2007-02-02 19:48:23 +03:00
/* ACPI tables must be present */
2015-10-14 08:53:57 +03:00
if ( acpi_gbl_fadt_index = = ACPI_INVALID_TABLE_INDEX ) {
2007-02-02 19:48:23 +03:00
return_ACPI_STATUS ( AE_NO_ACPI_TABLES ) ;
}
2013-03-08 13:22:14 +04:00
/* If the Hardware Reduced flag is set, machine is always in acpi mode */
if ( acpi_gbl_reduced_hardware ) {
return_ACPI_STATUS ( AE_OK ) ;
}
2007-02-02 19:48:23 +03:00
/* Check current mode */
2005-04-17 02:20:36 +04:00
if ( acpi_hw_get_mode ( ) = = ACPI_SYS_MODE_ACPI ) {
2005-08-05 08:44:28 +04:00
ACPI_DEBUG_PRINT ( ( ACPI_DB_INIT ,
" System is already in ACPI mode \n " ) ) ;
ACPICA: simplify SCI_EN workaround
acpi_hw_set_mode() double checks its effectiveness
by calling acpi_hw_get_mode() -- polling up to 3 seconds.
It would be more logical for its caller, acpi_enable()
acpi_enable() to do the double-checking. (lets assume
that acpi_disable() isn't interesting)
The ACPI specification is unclear on this point.
Some parts say that the BIOS sets SCI_EN and then returns to the OS,
but one part says "OSPM polls the SCI_EN bit until it is sampled SET".
The systems I have on hand do the former,
SCI_EN is observed to be set upon return from the BIOS.
So we move the check up out of acpi_hw_set_mode()
up into acpi_enable() where it makes logical sense.
Then we replace the 3-second polling loop
with a single check. If this check fails, we'll see:
"Hardware did not enter ACPI mode"
and the system will bail out of ACPI initialization
and likely fail to boot. If we see that in practice,
we can restore the polling, but put it into acpi_enable.
This patch is important if acpi_enable() is used in
the resume from S3 path. Many systems today are seen
coming back from S3 with SCI_EN off, and then failing
to set SCI_EN in response to acpi_enable(). Those systems
will take 3 seconds longer to resume due to this loop.
However, it is possible that we will not use acpi_enable()
in the S3 resume path, and bang SCI_EN directly, which
would make the loop harmless, as it would be invisible
to all systems except those that need it.
Signed-off-by: Len Brown <len.brown@intel.com>
2010-05-07 01:41:08 +04:00
return_ACPI_STATUS ( AE_OK ) ;
}
2005-04-17 02:20:36 +04:00
ACPICA: simplify SCI_EN workaround
acpi_hw_set_mode() double checks its effectiveness
by calling acpi_hw_get_mode() -- polling up to 3 seconds.
It would be more logical for its caller, acpi_enable()
acpi_enable() to do the double-checking. (lets assume
that acpi_disable() isn't interesting)
The ACPI specification is unclear on this point.
Some parts say that the BIOS sets SCI_EN and then returns to the OS,
but one part says "OSPM polls the SCI_EN bit until it is sampled SET".
The systems I have on hand do the former,
SCI_EN is observed to be set upon return from the BIOS.
So we move the check up out of acpi_hw_set_mode()
up into acpi_enable() where it makes logical sense.
Then we replace the 3-second polling loop
with a single check. If this check fails, we'll see:
"Hardware did not enter ACPI mode"
and the system will bail out of ACPI initialization
and likely fail to boot. If we see that in practice,
we can restore the polling, but put it into acpi_enable.
This patch is important if acpi_enable() is used in
the resume from S3 path. Many systems today are seen
coming back from S3 with SCI_EN off, and then failing
to set SCI_EN in response to acpi_enable(). Those systems
will take 3 seconds longer to resume due to this loop.
However, it is possible that we will not use acpi_enable()
in the S3 resume path, and bang SCI_EN directly, which
would make the loop harmless, as it would be invisible
to all systems except those that need it.
Signed-off-by: Len Brown <len.brown@intel.com>
2010-05-07 01:41:08 +04:00
/* Transition to ACPI mode */
2005-04-17 02:20:36 +04:00
ACPICA: simplify SCI_EN workaround
acpi_hw_set_mode() double checks its effectiveness
by calling acpi_hw_get_mode() -- polling up to 3 seconds.
It would be more logical for its caller, acpi_enable()
acpi_enable() to do the double-checking. (lets assume
that acpi_disable() isn't interesting)
The ACPI specification is unclear on this point.
Some parts say that the BIOS sets SCI_EN and then returns to the OS,
but one part says "OSPM polls the SCI_EN bit until it is sampled SET".
The systems I have on hand do the former,
SCI_EN is observed to be set upon return from the BIOS.
So we move the check up out of acpi_hw_set_mode()
up into acpi_enable() where it makes logical sense.
Then we replace the 3-second polling loop
with a single check. If this check fails, we'll see:
"Hardware did not enter ACPI mode"
and the system will bail out of ACPI initialization
and likely fail to boot. If we see that in practice,
we can restore the polling, but put it into acpi_enable.
This patch is important if acpi_enable() is used in
the resume from S3 path. Many systems today are seen
coming back from S3 with SCI_EN off, and then failing
to set SCI_EN in response to acpi_enable(). Those systems
will take 3 seconds longer to resume due to this loop.
However, it is possible that we will not use acpi_enable()
in the S3 resume path, and bang SCI_EN directly, which
would make the loop harmless, as it would be invisible
to all systems except those that need it.
Signed-off-by: Len Brown <len.brown@intel.com>
2010-05-07 01:41:08 +04: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 04:55:01 +04: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-17 02:20:36 +04:00
}
2010-06-29 04:55:01 +04:00
ACPI_ERROR ( ( AE_INFO , " Hardware did not enter ACPI mode " ) ) ;
return_ACPI_STATUS ( AE_NO_HARDWARE_RESPONSE ) ;
2005-04-17 02:20:36 +04:00
}
2006-10-03 08:00:00 +04:00
ACPI_EXPORT_SYMBOL ( acpi_enable )
2005-04-17 02:20:36 +04:00
/*******************************************************************************
*
* FUNCTION : acpi_disable
*
* PARAMETERS : None
*
* RETURN : Status
*
2005-04-19 06:49:35 +04:00
* DESCRIPTION : Transfers the system into LEGACY ( non - ACPI ) mode .
2005-04-17 02:20:36 +04:00
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-08-05 08:44:28 +04:00
acpi_status acpi_disable ( void )
2005-04-17 02:20:36 +04:00
{
2005-08-05 08:44:28 +04:00
acpi_status status = AE_OK ;
2005-04-17 02:20:36 +04: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 01:15:00 +04:00
ACPI_FUNCTION_TRACE ( acpi_disable ) ;
2005-04-17 02:20:36 +04:00
2013-03-08 13:22:14 +04:00
/* If the Hardware Reduced flag is set, machine is always in acpi mode */
if ( acpi_gbl_reduced_hardware ) {
return_ACPI_STATUS ( AE_OK ) ;
}
2005-04-17 02:20:36 +04:00
if ( acpi_hw_get_mode ( ) = = ACPI_SYS_MODE_LEGACY ) {
2005-08-05 08:44:28 +04:00
ACPI_DEBUG_PRINT ( ( ACPI_DB_INIT ,
" System is already in legacy (non-ACPI) mode \n " ) ) ;
} else {
2005-04-17 02:20:36 +04:00
/* Transition to LEGACY mode */
2005-08-05 08:44:28 +04:00
status = acpi_hw_set_mode ( ACPI_SYS_MODE_LEGACY ) ;
2005-04-17 02:20:36 +04:00
2005-08-05 08:44:28 +04:00
if ( ACPI_FAILURE ( status ) ) {
2006-01-28 00:43:00 +03:00
ACPI_ERROR ( ( AE_INFO ,
" Could not exit ACPI mode to legacy mode " ) ) ;
2005-08-05 08:44:28 +04:00
return_ACPI_STATUS ( status ) ;
2005-04-17 02:20:36 +04:00
}
2005-08-05 08:44:28 +04:00
ACPI_DEBUG_PRINT ( ( ACPI_DB_INIT , " ACPI mode disabled \n " ) ) ;
2005-04-17 02:20:36 +04:00
}
2005-08-05 08:44:28 +04:00
return_ACPI_STATUS ( status ) ;
2005-04-17 02:20:36 +04:00
}
2006-10-03 08:00:00 +04:00
ACPI_EXPORT_SYMBOL ( acpi_disable )
2005-04-17 02:20:36 +04:00
/*******************************************************************************
*
* FUNCTION : acpi_enable_event
*
2012-07-12 05:40:10 +04:00
* PARAMETERS : event - The fixed eventto be enabled
* flags - Reserved
2005-04-17 02:20:36 +04:00
*
* RETURN : Status
*
* DESCRIPTION : Enable an ACPI event ( fixed )
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-08-05 08:44:28 +04:00
acpi_status acpi_enable_event ( u32 event , u32 flags )
2005-04-17 02:20:36 +04:00
{
2005-08-05 08:44:28 +04:00
acpi_status status = AE_OK ;
u32 value ;
2005-04-17 02:20:36 +04: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 01:15:00 +04:00
ACPI_FUNCTION_TRACE ( acpi_enable_event ) ;
2005-04-17 02:20:36 +04:00
2017-06-05 11:40:02 +03:00
/* If Hardware Reduced flag is set, there are no fixed events */
if ( acpi_gbl_reduced_hardware ) {
return_ACPI_STATUS ( AE_OK ) ;
}
2005-04-17 02:20:36 +04:00
/* Decode the Fixed Event */
if ( event > ACPI_EVENT_MAX ) {
2005-08-05 08:44:28 +04:00
return_ACPI_STATUS ( AE_BAD_PARAMETER ) ;
2005-04-17 02:20:36 +04:00
}
/*
2008-11-12 11:01:56 +03:00
* Enable the requested fixed event ( by writing a one to the enable
* register bit )
2005-04-17 02:20:36 +04:00
*/
2005-08-05 08:44:28 +04:00
status =
2009-02-23 10:02:07 +03:00
acpi_write_bit_register ( acpi_gbl_fixed_event_info [ event ] .
2009-03-06 04:49:25 +03:00
enable_register_id , ACPI_ENABLE_EVENT ) ;
2005-08-05 08:44:28 +04:00
if ( ACPI_FAILURE ( status ) ) {
return_ACPI_STATUS ( status ) ;
2005-04-17 02:20:36 +04:00
}
/* Make sure that the hardware responded */
2005-08-05 08:44:28 +04:00
status =
2009-02-23 10:02:07 +03:00
acpi_read_bit_register ( acpi_gbl_fixed_event_info [ event ] .
enable_register_id , & value ) ;
2005-08-05 08:44:28 +04:00
if ( ACPI_FAILURE ( status ) ) {
return_ACPI_STATUS ( status ) ;
2005-04-17 02:20:36 +04:00
}
if ( value ! = 1 ) {
2006-01-28 00:43:00 +03:00
ACPI_ERROR ( ( AE_INFO ,
" Could not enable %s event " ,
acpi_ut_get_event_name ( event ) ) ) ;
2005-08-05 08:44:28 +04:00
return_ACPI_STATUS ( AE_NO_HARDWARE_RESPONSE ) ;
2005-04-17 02:20:36 +04:00
}
2005-08-05 08:44:28 +04:00
return_ACPI_STATUS ( status ) ;
2005-04-17 02:20:36 +04:00
}
2006-10-03 08:00:00 +04:00
ACPI_EXPORT_SYMBOL ( acpi_enable_event )
2005-04-17 02:20:36 +04:00
/*******************************************************************************
*
* FUNCTION : acpi_disable_event
*
2012-12-19 09:36:49 +04:00
* PARAMETERS : event - The fixed event to be disabled
* flags - Reserved
2005-04-17 02:20:36 +04:00
*
* RETURN : Status
*
* DESCRIPTION : Disable an ACPI event ( fixed )
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-08-05 08:44:28 +04:00
acpi_status acpi_disable_event ( u32 event , u32 flags )
2005-04-17 02:20:36 +04:00
{
2005-08-05 08:44:28 +04:00
acpi_status status = AE_OK ;
u32 value ;
2005-04-17 02:20:36 +04: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 01:15:00 +04:00
ACPI_FUNCTION_TRACE ( acpi_disable_event ) ;
2005-04-17 02:20:36 +04:00
2017-06-05 11:40:02 +03:00
/* If Hardware Reduced flag is set, there are no fixed events */
if ( acpi_gbl_reduced_hardware ) {
return_ACPI_STATUS ( AE_OK ) ;
}
2005-04-17 02:20:36 +04:00
/* Decode the Fixed Event */
if ( event > ACPI_EVENT_MAX ) {
2005-08-05 08:44:28 +04:00
return_ACPI_STATUS ( AE_BAD_PARAMETER ) ;
2005-04-17 02:20:36 +04:00
}
/*
2008-11-12 11:01:56 +03:00
* Disable the requested fixed event ( by writing a zero to the enable
* register bit )
2005-04-17 02:20:36 +04:00
*/
2005-08-05 08:44:28 +04:00
status =
2009-02-23 10:02:07 +03:00
acpi_write_bit_register ( acpi_gbl_fixed_event_info [ event ] .
2009-03-06 04:49:25 +03:00
enable_register_id , ACPI_DISABLE_EVENT ) ;
2005-08-05 08:44:28 +04:00
if ( ACPI_FAILURE ( status ) ) {
return_ACPI_STATUS ( status ) ;
2005-04-17 02:20:36 +04:00
}
2005-08-05 08:44:28 +04:00
status =
2009-02-23 10:02:07 +03:00
acpi_read_bit_register ( acpi_gbl_fixed_event_info [ event ] .
enable_register_id , & value ) ;
2005-08-05 08:44:28 +04:00
if ( ACPI_FAILURE ( status ) ) {
return_ACPI_STATUS ( status ) ;
2005-04-17 02:20:36 +04:00
}
if ( value ! = 0 ) {
2006-01-28 00:43:00 +03:00
ACPI_ERROR ( ( AE_INFO ,
" Could not disable %s events " ,
acpi_ut_get_event_name ( event ) ) ) ;
2005-08-05 08:44:28 +04:00
return_ACPI_STATUS ( AE_NO_HARDWARE_RESPONSE ) ;
2005-04-17 02:20:36 +04:00
}
2005-08-05 08:44:28 +04:00
return_ACPI_STATUS ( status ) ;
2005-04-17 02:20:36 +04:00
}
2006-10-03 08:00:00 +04:00
ACPI_EXPORT_SYMBOL ( acpi_disable_event )
2005-04-17 02:20:36 +04:00
/*******************************************************************************
*
* FUNCTION : acpi_clear_event
*
2012-07-12 05:40:10 +04:00
* PARAMETERS : event - The fixed event to be cleared
2005-04-17 02:20:36 +04:00
*
* RETURN : Status
*
* DESCRIPTION : Clear an ACPI event ( fixed )
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-08-05 08:44:28 +04:00
acpi_status acpi_clear_event ( u32 event )
2005-04-17 02:20:36 +04:00
{
2005-08-05 08:44:28 +04:00
acpi_status status = AE_OK ;
2005-04-17 02:20:36 +04: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 01:15:00 +04:00
ACPI_FUNCTION_TRACE ( acpi_clear_event ) ;
2005-04-17 02:20:36 +04:00
2017-06-05 11:40:02 +03:00
/* If Hardware Reduced flag is set, there are no fixed events */
if ( acpi_gbl_reduced_hardware ) {
return_ACPI_STATUS ( AE_OK ) ;
}
2005-04-17 02:20:36 +04:00
/* Decode the Fixed Event */
if ( event > ACPI_EVENT_MAX ) {
2005-08-05 08:44:28 +04:00
return_ACPI_STATUS ( AE_BAD_PARAMETER ) ;
2005-04-17 02:20:36 +04:00
}
/*
2008-11-12 11:01:56 +03:00
* Clear the requested fixed event ( By writing a one to the status
* register bit )
2005-04-17 02:20:36 +04:00
*/
2005-08-05 08:44:28 +04:00
status =
2009-02-23 10:02:07 +03:00
acpi_write_bit_register ( acpi_gbl_fixed_event_info [ event ] .
2009-03-06 04:49:25 +03:00
status_register_id , ACPI_CLEAR_STATUS ) ;
2005-04-17 02:20:36 +04:00
2005-08-05 08:44:28 +04:00
return_ACPI_STATUS ( status ) ;
2005-04-17 02:20:36 +04:00
}
2006-10-03 08:00:00 +04:00
ACPI_EXPORT_SYMBOL ( acpi_clear_event )
2005-04-17 02:20:36 +04:00
/*******************************************************************************
*
* FUNCTION : acpi_get_event_status
*
2012-07-12 05:40:10 +04:00
* PARAMETERS : event - The fixed event
2005-04-19 06:49:35 +04:00
* event_status - Where the current status of the event will
2005-04-17 02:20:36 +04:00
* be returned
*
* RETURN : Status
*
* DESCRIPTION : Obtains and returns the current status of the event
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-08-05 08:44:28 +04:00
acpi_status acpi_get_event_status ( u32 event , acpi_event_status * event_status )
2005-04-17 02:20:36 +04:00
{
2014-10-10 06:39:57 +04:00
acpi_status status ;
acpi_event_status local_event_status = 0 ;
u32 in_byte ;
2005-04-17 02:20:36 +04: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 01:15:00 +04:00
ACPI_FUNCTION_TRACE ( acpi_get_event_status ) ;
2005-04-17 02:20:36 +04:00
if ( ! event_status ) {
2005-08-05 08:44:28 +04:00
return_ACPI_STATUS ( AE_BAD_PARAMETER ) ;
2005-04-17 02:20:36 +04:00
}
/* Decode the Fixed Event */
if ( event > ACPI_EVENT_MAX ) {
2005-08-05 08:44:28 +04:00
return_ACPI_STATUS ( AE_BAD_PARAMETER ) ;
2005-04-17 02:20:36 +04:00
}
2014-10-10 06:39:57 +04:00
/* Fixed event currently can be dispatched? */
if ( acpi_gbl_fixed_event_handlers [ event ] . handler ) {
2014-10-10 06:40:05 +04:00
local_event_status | = ACPI_EVENT_FLAG_HAS_HANDLER ;
2014-10-10 06:39:57 +04:00
}
/* Fixed event currently enabled? */
2005-04-17 02:20:36 +04:00
2005-08-05 08:44:28 +04:00
status =
2009-02-23 10:02:07 +03:00
acpi_read_bit_register ( acpi_gbl_fixed_event_info [ event ] .
2014-10-10 06:39:57 +04:00
enable_register_id , & in_byte ) ;
if ( ACPI_FAILURE ( status ) ) {
2008-06-20 05:42:47 +04:00
return_ACPI_STATUS ( status ) ;
2014-10-10 06:39:57 +04:00
}
2008-06-20 05:42:47 +04:00
2014-10-10 06:39:57 +04:00
if ( in_byte ) {
2015-04-13 06:49:13 +03:00
local_event_status | =
( ACPI_EVENT_FLAG_ENABLED | ACPI_EVENT_FLAG_ENABLE_SET ) ;
2014-10-10 06:39:57 +04:00
}
/* Fixed event currently active? */
2008-06-20 05:42:47 +04:00
status =
2009-02-23 10:02:07 +03:00
acpi_read_bit_register ( acpi_gbl_fixed_event_info [ event ] .
2014-10-10 06:39:57 +04:00
status_register_id , & in_byte ) ;
if ( ACPI_FAILURE ( status ) ) {
2008-06-20 05:42:47 +04:00
return_ACPI_STATUS ( status ) ;
2014-10-10 06:39:57 +04:00
}
2008-06-20 05:42:47 +04:00
2014-10-10 06:39:57 +04:00
if ( in_byte ) {
2015-04-13 06:49:13 +03:00
local_event_status | = ACPI_EVENT_FLAG_STATUS_SET ;
2014-10-10 06:39:57 +04:00
}
2008-10-28 00:01:02 +03:00
2014-10-10 06:39:57 +04:00
( * event_status ) = local_event_status ;
return_ACPI_STATUS ( AE_OK ) ;
2005-04-17 02:20:36 +04:00
}
2006-10-03 08:00:00 +04:00
ACPI_EXPORT_SYMBOL ( acpi_get_event_status )
2012-02-14 14:14:27 +04:00
# endif /* !ACPI_REDUCED_HARDWARE */