2000-10-28 05:01:06 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: evsci - System Control Interrupt configuration and
|
|
|
|
* legacy to ACPI mode state transition functions
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2011-01-13 16:12:34 +00:00
|
|
|
/*
|
2014-01-15 00:10:20 +00:00
|
|
|
* Copyright (C) 2000 - 2014, Intel Corp.
|
2000-12-21 06:56:46 +00:00
|
|
|
* All rights reserved.
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2011-01-13 16:12:34 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2009-06-01 19:24:26 +00:00
|
|
|
#include "acpi.h"
|
2009-06-01 21:02:40 +00:00
|
|
|
#include "accommon.h"
|
2009-06-01 19:24:26 +00:00
|
|
|
#include "acevents.h"
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2001-05-29 19:52:40 +00:00
|
|
|
#define _COMPONENT ACPI_EVENTS
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_MODULE_NAME ("evsci")
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2012-02-16 00:24:10 +00:00
|
|
|
#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
/* Local prototypes */
|
|
|
|
|
|
|
|
static UINT32 ACPI_SYSTEM_XFACE
|
|
|
|
AcpiEvSciXruptHandler (
|
|
|
|
void *Context);
|
|
|
|
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2013-08-23 18:01:58 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: AcpiEvSciDispatch
|
|
|
|
*
|
|
|
|
* PARAMETERS: None
|
|
|
|
*
|
|
|
|
* RETURN: Status code indicates whether interrupt was handled.
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Dispatch the SCI to all host-installed SCI handlers.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
UINT32
|
|
|
|
AcpiEvSciDispatch (
|
|
|
|
void)
|
|
|
|
{
|
|
|
|
ACPI_SCI_HANDLER_INFO *SciHandler;
|
|
|
|
ACPI_CPU_FLAGS Flags;
|
|
|
|
UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
|
|
|
|
|
|
|
|
|
|
|
|
ACPI_FUNCTION_NAME (EvSciDispatch);
|
|
|
|
|
|
|
|
|
|
|
|
/* Are there any host-installed SCI handlers? */
|
|
|
|
|
|
|
|
if (!AcpiGbl_SciHandlerList)
|
|
|
|
{
|
|
|
|
return (IntStatus);
|
|
|
|
}
|
|
|
|
|
|
|
|
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
|
|
|
|
|
|
|
|
/* Invoke all host-installed SCI handlers */
|
|
|
|
|
|
|
|
SciHandler = AcpiGbl_SciHandlerList;
|
|
|
|
while (SciHandler)
|
|
|
|
{
|
|
|
|
/* Invoke the installed handler (at interrupt level) */
|
|
|
|
|
|
|
|
IntStatus |= SciHandler->Address (
|
|
|
|
SciHandler->Context);
|
|
|
|
|
|
|
|
SciHandler = SciHandler->Next;
|
|
|
|
}
|
|
|
|
|
|
|
|
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
|
|
|
|
return (IntStatus);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-28 05:01:06 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
2003-07-13 22:44:13 +00:00
|
|
|
* FUNCTION: AcpiEvSciXruptHandler
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
|
|
|
* PARAMETERS: Context - Calling Context
|
|
|
|
*
|
|
|
|
* RETURN: Status code indicates whether interrupt was handled.
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Interrupt handler that will figure out what function or
|
2003-07-13 22:44:13 +00:00
|
|
|
* control method to call to deal with a SCI.
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2002-03-16 02:18:13 +00:00
|
|
|
static UINT32 ACPI_SYSTEM_XFACE
|
2003-07-13 22:44:13 +00:00
|
|
|
AcpiEvSciXruptHandler (
|
2002-02-23 05:10:40 +00:00
|
|
|
void *Context)
|
2000-10-28 05:01:06 +00:00
|
|
|
{
|
2003-07-13 22:44:13 +00:00
|
|
|
ACPI_GPE_XRUPT_INFO *GpeXruptList = Context;
|
2002-02-23 05:10:40 +00:00
|
|
|
UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED;
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2007-03-22 17:24:05 +00:00
|
|
|
ACPI_FUNCTION_TRACE (EvSciXruptHandler);
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
2003-04-29 18:39:29 +00:00
|
|
|
* We are guaranteed by the ACPI CA initialization/shutdown code that
|
|
|
|
* if this interrupt handler is installed, ACPI is enabled.
|
2000-10-28 05:01:06 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2003-07-13 22:44:13 +00:00
|
|
|
* Fixed Events:
|
|
|
|
* Check for and dispatch any Fixed Events that have occurred
|
2000-10-28 05:01:06 +00:00
|
|
|
*/
|
|
|
|
InterruptHandled |= AcpiEvFixedEventDetect ();
|
|
|
|
|
2003-07-13 22:44:13 +00:00
|
|
|
/*
|
|
|
|
* General Purpose Events:
|
|
|
|
* Check for and dispatch any GPEs that have occurred
|
|
|
|
*/
|
|
|
|
InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
|
|
|
|
|
2013-08-23 18:01:58 +00:00
|
|
|
/* Invoke all host-installed SCI handlers */
|
|
|
|
|
|
|
|
InterruptHandled |= AcpiEvSciDispatch ();
|
|
|
|
|
2009-06-01 21:02:40 +00:00
|
|
|
AcpiSciCount++;
|
2013-02-15 19:12:35 +00:00
|
|
|
return_UINT32 (InterruptHandled);
|
2003-07-13 22:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: AcpiEvGpeXruptHandler
|
|
|
|
*
|
|
|
|
* PARAMETERS: Context - Calling Context
|
|
|
|
*
|
|
|
|
* RETURN: Status code indicates whether interrupt was handled.
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Handler for GPE Block Device interrupts
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
UINT32 ACPI_SYSTEM_XFACE
|
|
|
|
AcpiEvGpeXruptHandler (
|
|
|
|
void *Context)
|
|
|
|
{
|
|
|
|
ACPI_GPE_XRUPT_INFO *GpeXruptList = Context;
|
|
|
|
UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED;
|
|
|
|
|
|
|
|
|
2007-03-22 17:24:05 +00:00
|
|
|
ACPI_FUNCTION_TRACE (EvGpeXruptHandler);
|
2003-07-13 22:44:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
2013-08-23 18:01:58 +00:00
|
|
|
* We are guaranteed by the ACPICA initialization/shutdown code that
|
2003-07-13 22:44:13 +00:00
|
|
|
* if this interrupt handler is installed, ACPI is enabled.
|
|
|
|
*/
|
|
|
|
|
2009-06-01 21:02:40 +00:00
|
|
|
/* GPEs: Check for and dispatch any GPEs that have occurred */
|
|
|
|
|
2003-07-13 22:44:13 +00:00
|
|
|
InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
|
2013-02-15 19:12:35 +00:00
|
|
|
return_UINT32 (InterruptHandled);
|
2000-10-28 05:01:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: AcpiEvInstallSciHandler
|
|
|
|
*
|
|
|
|
* PARAMETERS: none
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Installs SCI handler.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
UINT32
|
2005-11-01 22:11:18 +00:00
|
|
|
AcpiEvInstallSciHandler (
|
|
|
|
void)
|
2000-10-28 05:01:06 +00:00
|
|
|
{
|
2001-09-07 01:22:25 +00:00
|
|
|
UINT32 Status = AE_OK;
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2007-03-22 17:24:05 +00:00
|
|
|
ACPI_FUNCTION_TRACE (EvInstallSciHandler);
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2007-03-22 17:24:05 +00:00
|
|
|
Status = AcpiOsInstallInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt,
|
|
|
|
AcpiEvSciXruptHandler, AcpiGbl_GpeXruptListHead);
|
2001-09-07 01:22:25 +00:00
|
|
|
return_ACPI_STATUS (Status);
|
2000-10-28 05:01:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
2013-08-23 18:01:58 +00:00
|
|
|
* FUNCTION: AcpiEvRemoveAllSciHandlers
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
|
|
|
* PARAMETERS: none
|
|
|
|
*
|
2013-08-23 18:01:58 +00:00
|
|
|
* RETURN: AE_OK if handler uninstalled, AE_ERROR if handler was not
|
2000-10-28 05:01:06 +00:00
|
|
|
* installed to begin with
|
|
|
|
*
|
2009-06-01 21:02:40 +00:00
|
|
|
* DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
|
2013-08-23 18:01:58 +00:00
|
|
|
* taken. Remove all host-installed SCI handlers.
|
2002-02-23 05:10:40 +00:00
|
|
|
*
|
|
|
|
* Note: It doesn't seem important to disable all events or set the event
|
2009-06-01 21:02:40 +00:00
|
|
|
* enable registers to their original values. The OS should disable
|
2002-02-23 05:10:40 +00:00
|
|
|
* the SCI interrupt level when the handler is removed, so no more
|
|
|
|
* events will come in.
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
ACPI_STATUS
|
2013-08-23 18:01:58 +00:00
|
|
|
AcpiEvRemoveAllSciHandlers (
|
2005-11-01 22:11:18 +00:00
|
|
|
void)
|
2000-10-28 05:01:06 +00:00
|
|
|
{
|
2013-08-23 18:01:58 +00:00
|
|
|
ACPI_SCI_HANDLER_INFO *SciHandler;
|
|
|
|
ACPI_CPU_FLAGS Flags;
|
2002-07-09 17:51:31 +00:00
|
|
|
ACPI_STATUS Status;
|
|
|
|
|
|
|
|
|
2013-08-23 18:01:58 +00:00
|
|
|
ACPI_FUNCTION_TRACE (EvRemoveAllSciHandlers);
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
/* Just let the OS remove the handler and disable the level */
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2007-03-22 17:24:05 +00:00
|
|
|
Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt,
|
|
|
|
AcpiEvSciXruptHandler);
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2013-08-23 18:01:58 +00:00
|
|
|
if (!AcpiGbl_SciHandlerList)
|
|
|
|
{
|
|
|
|
return (Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
|
|
|
|
|
|
|
|
/* Free all host-installed SCI handlers */
|
|
|
|
|
|
|
|
while (AcpiGbl_SciHandlerList)
|
|
|
|
{
|
|
|
|
SciHandler = AcpiGbl_SciHandlerList;
|
|
|
|
AcpiGbl_SciHandlerList = SciHandler->Next;
|
|
|
|
ACPI_FREE (SciHandler);
|
|
|
|
}
|
|
|
|
|
|
|
|
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
|
2002-07-09 17:51:31 +00:00
|
|
|
return_ACPI_STATUS (Status);
|
2000-10-28 05:01:06 +00:00
|
|
|
}
|
|
|
|
|
2012-02-16 00:24:10 +00:00
|
|
|
#endif /* !ACPI_REDUCED_HARDWARE */
|