2005-04-17 05:20:36 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: evsci - System Control Interrupt configuration and
|
|
|
|
* legacy to ACPI mode state transition functions
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2015-02-05 14:20:45 +07:00
|
|
|
* Copyright (C) 2000 - 2015, Intel Corp.
|
2005-04-17 05:20:36 +07:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions, and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
|
|
|
* substantially similar to the "NO WARRANTY" disclaimer below
|
|
|
|
* ("Disclaimer") and any redistribution must be conditioned upon
|
|
|
|
* including a substantially similar Disclaimer requirement for further
|
|
|
|
* binary redistribution.
|
|
|
|
* 3. Neither the names of the above-listed copyright holders nor the names
|
|
|
|
* of any contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of the
|
|
|
|
* GNU General Public License ("GPL") version 2 as published by the Free
|
|
|
|
* Software Foundation.
|
|
|
|
*
|
|
|
|
* NO WARRANTY
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGES.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <acpi/acpi.h>
|
2009-01-09 12:30:03 +07:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "acevents.h"
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_EVENTS
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_MODULE_NAME("evsci")
|
2012-02-14 17:14:27 +07:00
|
|
|
#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
|
2005-04-19 09:49:35 +07:00
|
|
|
/* Local prototypes */
|
2005-08-05 11:44:28 +07:00
|
|
|
static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2013-09-23 08:52:05 +07: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 08:52:45 +07:00
|
|
|
int_status |= sci_handler->address(sci_handler->context);
|
2013-09-23 08:52:05 +07:00
|
|
|
|
|
|
|
sci_handler = sci_handler->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
|
|
|
return (int_status);
|
|
|
|
}
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_sci_xrupt_handler
|
|
|
|
*
|
2012-07-12 08:40:10 +07:00
|
|
|
* PARAMETERS: context - Calling Context
|
2005-04-17 05:20:36 +07: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 11:44:28 +07:00
|
|
|
static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
|
|
|
|
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(ev_sci_xrupt_handler);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*
|
2014-04-04 11:37:11 +07:00
|
|
|
* We are guaranteed by the ACPICA initialization/shutdown code that
|
2005-04-17 05:20:36 +07: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 11:44:28 +07:00
|
|
|
interrupt_handled |= acpi_ev_fixed_event_detect();
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* General Purpose Events:
|
|
|
|
* Check for and dispatch any GPEs that have occurred
|
|
|
|
*/
|
2005-08-05 11:44:28 +07:00
|
|
|
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2013-09-23 08:52:05 +07:00
|
|
|
/* Invoke all host-installed SCI handlers */
|
|
|
|
|
|
|
|
interrupt_handled |= acpi_ev_sci_dispatch();
|
|
|
|
|
2013-10-31 08:30:28 +07:00
|
|
|
acpi_sci_count++;
|
2013-03-08 16:22:23 +07:00
|
|
|
return_UINT32(interrupt_handled);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_gpe_xrupt_handler
|
|
|
|
*
|
2012-07-12 08:40:10 +07:00
|
|
|
* PARAMETERS: context - Calling Context
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* RETURN: Status code indicates whether interrupt was handled.
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Handler for GPE Block Device interrupts
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
|
|
|
|
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(ev_gpe_xrupt_handler);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*
|
2013-09-23 08:52:05 +07:00
|
|
|
* We are guaranteed by the ACPICA initialization/shutdown code that
|
2005-04-17 05:20:36 +07:00
|
|
|
* if this interrupt handler is installed, ACPI is enabled.
|
|
|
|
*/
|
|
|
|
|
2008-11-12 15:01:56 +07:00
|
|
|
/* GPEs: Check for and dispatch any GPEs that have occurred */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
|
2013-03-08 16:22:23 +07:00
|
|
|
return_UINT32(interrupt_handled);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_install_sci_handler
|
|
|
|
*
|
|
|
|
* PARAMETERS: none
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Installs SCI handler.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
u32 acpi_ev_install_sci_handler(void)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
u32 status = AE_OK;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(ev_install_sci_handler);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2007-02-02 23:48:18 +07: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 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
2013-09-23 08:52:05 +07:00
|
|
|
* FUNCTION: acpi_ev_remove_all_sci_handlers
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* PARAMETERS: none
|
|
|
|
*
|
2013-09-23 08:52:05 +07:00
|
|
|
* RETURN: AE_OK if handler uninstalled, AE_ERROR if handler was not
|
2005-04-17 05:20:36 +07:00
|
|
|
* installed to begin with
|
|
|
|
*
|
2008-11-12 15:01:56 +07:00
|
|
|
* DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
|
2013-09-23 08:52:05 +07:00
|
|
|
* taken. Remove all host-installed SCI handlers.
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* Note: It doesn't seem important to disable all events or set the event
|
2008-11-12 15:01:56 +07:00
|
|
|
* enable registers to their original values. The OS should disable
|
2005-04-17 05:20:36 +07:00
|
|
|
* the SCI interrupt level when the handler is removed, so no more
|
|
|
|
* events will come in.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2013-09-23 08:52:05 +07:00
|
|
|
acpi_status acpi_ev_remove_all_sci_handlers(void)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2013-09-23 08:52:05 +07:00
|
|
|
struct acpi_sci_handler_info *sci_handler;
|
|
|
|
acpi_cpu_flags flags;
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status status;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2013-09-23 08:52:05 +07:00
|
|
|
ACPI_FUNCTION_TRACE(ev_remove_all_sci_handlers);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Just let the OS remove the handler and disable the level */
|
|
|
|
|
2007-02-02 23:48:18 +07:00
|
|
|
status =
|
|
|
|
acpi_os_remove_interrupt_handler((u32) acpi_gbl_FADT.sci_interrupt,
|
|
|
|
acpi_ev_sci_xrupt_handler);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2013-09-23 08:52:05 +07: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 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
2012-02-14 17:14:27 +07:00
|
|
|
|
|
|
|
#endif /* !ACPI_REDUCED_HARDWARE */
|