2018-03-15 07:13:07 +08:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
|
2005-04-17 06:20:36 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: evsci - System Control Interrupt configuration and
|
|
|
|
* legacy to ACPI mode state transition functions
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#include <acpi/acpi.h>
|
2009-01-09 13:30:03 +08:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "acevents.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_EVENTS
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_MODULE_NAME("evsci")
|
2012-02-14 18:14:27 +08:00
|
|
|
#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
|
2005-04-19 10:49:35 +08:00
|
|
|
/* Local prototypes */
|
2005-08-05 12:44:28 +08:00
|
|
|
static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-09-23 09:52:05 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_sci_dispatch
|
|
|
|
*
|
|
|
|
* PARAMETERS: None
|
|
|
|
*
|
|
|
|
* RETURN: Status code indicates whether interrupt was handled.
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Dispatch the SCI to all host-installed SCI handlers.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
u32 acpi_ev_sci_dispatch(void)
|
|
|
|
{
|
|
|
|
struct acpi_sci_handler_info *sci_handler;
|
|
|
|
acpi_cpu_flags flags;
|
|
|
|
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_NAME(ev_sci_dispatch);
|
|
|
|
|
|
|
|
/* Are there any host-installed SCI handlers? */
|
|
|
|
|
|
|
|
if (!acpi_gbl_sci_handler_list) {
|
|
|
|
return (int_status);
|
|
|
|
}
|
|
|
|
|
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
|
|
|
|
|
|
|
/* Invoke all host-installed SCI handlers */
|
|
|
|
|
|
|
|
sci_handler = acpi_gbl_sci_handler_list;
|
|
|
|
while (sci_handler) {
|
|
|
|
|
|
|
|
/* Invoke the installed handler (at interrupt level) */
|
|
|
|
|
2013-09-23 09:52:45 +08:00
|
|
|
int_status |= sci_handler->address(sci_handler->context);
|
2013-09-23 09:52:05 +08:00
|
|
|
|
|
|
|
sci_handler = sci_handler->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
|
|
|
return (int_status);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_sci_xrupt_handler
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: context - Calling Context
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: Status code indicates whether interrupt was handled.
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Interrupt handler that will figure out what function or
|
|
|
|
* control method to call to deal with a SCI.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
|
|
|
|
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
|
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(ev_sci_xrupt_handler);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
2014-04-04 12:37:11 +08:00
|
|
|
* We are guaranteed by the ACPICA initialization/shutdown code that
|
2005-04-17 06:20:36 +08:00
|
|
|
* if this interrupt handler is installed, ACPI is enabled.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fixed Events:
|
|
|
|
* Check for and dispatch any Fixed Events that have occurred
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
interrupt_handled |= acpi_ev_fixed_event_detect();
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* General Purpose Events:
|
|
|
|
* Check for and dispatch any GPEs that have occurred
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-09-23 09:52:05 +08:00
|
|
|
/* Invoke all host-installed SCI handlers */
|
|
|
|
|
|
|
|
interrupt_handled |= acpi_ev_sci_dispatch();
|
|
|
|
|
2013-10-31 09:30:28 +08:00
|
|
|
acpi_sci_count++;
|
2013-03-08 17:22:23 +08:00
|
|
|
return_UINT32(interrupt_handled);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_gpe_xrupt_handler
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: context - Calling Context
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: Status code indicates whether interrupt was handled.
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Handler for GPE Block Device interrupts
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
|
|
|
|
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
|
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(ev_gpe_xrupt_handler);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
2013-09-23 09:52:05 +08:00
|
|
|
* We are guaranteed by the ACPICA initialization/shutdown code that
|
2005-04-17 06:20:36 +08:00
|
|
|
* if this interrupt handler is installed, ACPI is enabled.
|
|
|
|
*/
|
|
|
|
|
2008-11-12 16:01:56 +08:00
|
|
|
/* GPEs: Check for and dispatch any GPEs that have occurred */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
|
2013-03-08 17:22:23 +08:00
|
|
|
return_UINT32(interrupt_handled);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_install_sci_handler
|
|
|
|
*
|
|
|
|
* PARAMETERS: none
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Installs SCI handler.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
u32 acpi_ev_install_sci_handler(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
u32 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(ev_install_sci_handler);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-02-03 00:48:18 +08:00
|
|
|
status =
|
|
|
|
acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT.sci_interrupt,
|
|
|
|
acpi_ev_sci_xrupt_handler,
|
|
|
|
acpi_gbl_gpe_xrupt_list_head);
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
2013-09-23 09:52:05 +08:00
|
|
|
* FUNCTION: acpi_ev_remove_all_sci_handlers
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* PARAMETERS: none
|
|
|
|
*
|
2013-09-23 09:52:05 +08:00
|
|
|
* RETURN: AE_OK if handler uninstalled, AE_ERROR if handler was not
|
2005-04-17 06:20:36 +08:00
|
|
|
* installed to begin with
|
|
|
|
*
|
2008-11-12 16:01:56 +08:00
|
|
|
* DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
|
2013-09-23 09:52:05 +08:00
|
|
|
* taken. Remove all host-installed SCI handlers.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* Note: It doesn't seem important to disable all events or set the event
|
2008-11-12 16:01:56 +08:00
|
|
|
* enable registers to their original values. The OS should disable
|
2005-04-17 06:20:36 +08:00
|
|
|
* the SCI interrupt level when the handler is removed, so no more
|
|
|
|
* events will come in.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2013-09-23 09:52:05 +08:00
|
|
|
acpi_status acpi_ev_remove_all_sci_handlers(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2013-09-23 09:52:05 +08:00
|
|
|
struct acpi_sci_handler_info *sci_handler;
|
|
|
|
acpi_cpu_flags flags;
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-09-23 09:52:05 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ev_remove_all_sci_handlers);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Just let the OS remove the handler and disable the level */
|
|
|
|
|
2007-02-03 00:48:18 +08:00
|
|
|
status =
|
|
|
|
acpi_os_remove_interrupt_handler((u32) acpi_gbl_FADT.sci_interrupt,
|
|
|
|
acpi_ev_sci_xrupt_handler);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-09-23 09:52:05 +08:00
|
|
|
if (!acpi_gbl_sci_handler_list) {
|
|
|
|
return (status);
|
|
|
|
}
|
|
|
|
|
|
|
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
|
|
|
|
|
|
|
/* Free all host-installed SCI handlers */
|
|
|
|
|
|
|
|
while (acpi_gbl_sci_handler_list) {
|
|
|
|
sci_handler = acpi_gbl_sci_handler_list;
|
|
|
|
acpi_gbl_sci_handler_list = sci_handler->next;
|
|
|
|
ACPI_FREE(sci_handler);
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
2012-02-14 18:14:27 +08:00
|
|
|
|
|
|
|
#endif /* !ACPI_REDUCED_HARDWARE */
|