Back to home page

Quest Cross Reference

 
 

    


Warning, cross-references for /kernel/drivers/acpica/evsci.c need to be fixed.

0001 /*******************************************************************************
0002  *
0003  * Module Name: evsci - System Control Interrupt configuration and
0004  *                      legacy to ACPI mode state transition functions
0005  *
0006  ******************************************************************************/
0007 
0008 /******************************************************************************
0009  *
0010  * 1. Copyright Notice
0011  *
0012  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
0013  * All rights reserved.
0014  *
0015  * 2. License
0016  *
0017  * 2.1. This is your license from Intel Corp. under its intellectual property
0018  * rights.  You may have additional license terms from the party that provided
0019  * you this software, covering your right to use that party's intellectual
0020  * property rights.
0021  *
0022  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
0023  * copy of the source code appearing in this file ("Covered Code") an
0024  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
0025  * base code distributed originally by Intel ("Original Intel Code") to copy,
0026  * make derivatives, distribute, use and display any portion of the Covered
0027  * Code in any form, with the right to sublicense such rights; and
0028  *
0029  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
0030  * license (with the right to sublicense), under only those claims of Intel
0031  * patents that are infringed by the Original Intel Code, to make, use, sell,
0032  * offer to sell, and import the Covered Code and derivative works thereof
0033  * solely to the minimum extent necessary to exercise the above copyright
0034  * license, and in no event shall the patent license extend to any additions
0035  * to or modifications of the Original Intel Code.  No other license or right
0036  * is granted directly or by implication, estoppel or otherwise;
0037  *
0038  * The above copyright and patent license is granted only if the following
0039  * conditions are met:
0040  *
0041  * 3. Conditions
0042  *
0043  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
0044  * Redistribution of source code of any substantial portion of the Covered
0045  * Code or modification with rights to further distribute source must include
0046  * the above Copyright Notice, the above License, this list of Conditions,
0047  * and the following Disclaimer and Export Compliance provision.  In addition,
0048  * Licensee must cause all Covered Code to which Licensee contributes to
0049  * contain a file documenting the changes Licensee made to create that Covered
0050  * Code and the date of any change.  Licensee must include in that file the
0051  * documentation of any changes made by any predecessor Licensee.  Licensee
0052  * must include a prominent statement that the modification is derived,
0053  * directly or indirectly, from Original Intel Code.
0054  *
0055  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
0056  * Redistribution of source code of any substantial portion of the Covered
0057  * Code or modification without rights to further distribute source must
0058  * include the following Disclaimer and Export Compliance provision in the
0059  * documentation and/or other materials provided with distribution.  In
0060  * addition, Licensee may not authorize further sublicense of source of any
0061  * portion of the Covered Code, and must include terms to the effect that the
0062  * license from Licensee to its licensee is limited to the intellectual
0063  * property embodied in the software Licensee provides to its licensee, and
0064  * not to intellectual property embodied in modifications its licensee may
0065 
0066  * make.
0067  *
0068  * 3.3. Redistribution of Executable. Redistribution in executable form of any
0069  * substantial portion of the Covered Code or modification must reproduce the
0070  * above Copyright Notice, and the following Disclaimer and Export Compliance
0071  * provision in the documentation and/or other materials provided with the
0072  * distribution.
0073  *
0074  * 3.4. Intel retains all right, title, and interest in and to the Original
0075  * Intel Code.
0076  *
0077  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
0078  * Intel shall be used in advertising or otherwise to promote the sale, use or
0079  * other dealings in products derived from or relating to the Covered Code
0080  * without prior written authorization from Intel.
0081  *
0082  * 4. Disclaimer and Export Compliance
0083  *
0084  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
0085  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
0086  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
0087  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
0088  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
0089  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
0090  * PARTICULAR PURPOSE.
0091  *
0092  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
0093  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
0094  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
0095  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
0096  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
0097  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
0098  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
0099  * LIMITED REMEDY.
0100  *
0101  * 4.3. Licensee shall not export, either directly or indirectly, any of this
0102  * software or system incorporating such software without first obtaining any
0103  * required license or other approval from the U. S. Department of Commerce or
0104  * any other agency or department of the United States Government.  In the
0105  * event Licensee exports any such software from the United States or
0106  * re-exports any such software from a foreign destination, Licensee shall
0107  * ensure that the distribution and export/re-export of the software is in
0108  * compliance with all laws, regulations, orders, or other restrictions of the
0109  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
0110  * any of its subsidiaries will export/re-export any technical data, process,
0111  * software, or service, directly or indirectly, to any country for which the
0112  * United States government or any agency thereof requires an export license,
0113  * other governmental approval, or letter of assurance, without first obtaining
0114  * such license, approval or letter.
0115  *
0116  *****************************************************************************/
0117 
0118 #include "acpi.h"
0119 #include "accommon.h"
0120 #include "acevents.h"
0121 
0122 
0123 #define _COMPONENT          ACPI_EVENTS
0124         ACPI_MODULE_NAME    ("evsci")
0125 
0126 /* Local prototypes */
0127 
0128 static UINT32 ACPI_SYSTEM_XFACE
0129 AcpiEvSciXruptHandler (
0130     void                    *Context);
0131 
0132 
0133 /*******************************************************************************
0134  *
0135  * FUNCTION:    AcpiEvSciXruptHandler
0136  *
0137  * PARAMETERS:  Context   - Calling Context
0138  *
0139  * RETURN:      Status code indicates whether interrupt was handled.
0140  *
0141  * DESCRIPTION: Interrupt handler that will figure out what function or
0142  *              control method to call to deal with a SCI.
0143  *
0144  ******************************************************************************/
0145 
0146 static UINT32 ACPI_SYSTEM_XFACE
0147 AcpiEvSciXruptHandler (
0148     void                    *Context)
0149 {
0150     ACPI_GPE_XRUPT_INFO     *GpeXruptList = Context;
0151     UINT32                  InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED;
0152 
0153 
0154     ACPI_FUNCTION_TRACE (EvSciXruptHandler);
0155 
0156 
0157     /*
0158      * We are guaranteed by the ACPI CA initialization/shutdown code that
0159      * if this interrupt handler is installed, ACPI is enabled.
0160      */
0161 
0162     /*
0163      * Fixed Events:
0164      * Check for and dispatch any Fixed Events that have occurred
0165      */
0166     InterruptHandled |= AcpiEvFixedEventDetect ();
0167 
0168     /*
0169      * General Purpose Events:
0170      * Check for and dispatch any GPEs that have occurred
0171      */
0172     InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
0173 
0174     AcpiSciCount++;
0175     return_UINT32 (InterruptHandled);
0176 }
0177 
0178 
0179 /*******************************************************************************
0180  *
0181  * FUNCTION:    AcpiEvGpeXruptHandler
0182  *
0183  * PARAMETERS:  Context   - Calling Context
0184  *
0185  * RETURN:      Status code indicates whether interrupt was handled.
0186  *
0187  * DESCRIPTION: Handler for GPE Block Device interrupts
0188  *
0189  ******************************************************************************/
0190 
0191 UINT32 ACPI_SYSTEM_XFACE
0192 AcpiEvGpeXruptHandler (
0193     void                    *Context)
0194 {
0195     ACPI_GPE_XRUPT_INFO     *GpeXruptList = Context;
0196     UINT32                  InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED;
0197 
0198 
0199     ACPI_FUNCTION_TRACE (EvGpeXruptHandler);
0200 
0201 
0202     /*
0203      * We are guaranteed by the ACPI CA initialization/shutdown code that
0204      * if this interrupt handler is installed, ACPI is enabled.
0205      */
0206 
0207     /* GPEs: Check for and dispatch any GPEs that have occurred */
0208 
0209     InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
0210 
0211     return_UINT32 (InterruptHandled);
0212 }
0213 
0214 
0215 /******************************************************************************
0216  *
0217  * FUNCTION:    AcpiEvInstallSciHandler
0218  *
0219  * PARAMETERS:  none
0220  *
0221  * RETURN:      Status
0222  *
0223  * DESCRIPTION: Installs SCI handler.
0224  *
0225  ******************************************************************************/
0226 
0227 UINT32
0228 AcpiEvInstallSciHandler (
0229     void)
0230 {
0231     UINT32                  Status = AE_OK;
0232 
0233 
0234     ACPI_FUNCTION_TRACE (EvInstallSciHandler);
0235 
0236 
0237     Status = AcpiOsInstallInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt,
0238                 AcpiEvSciXruptHandler, AcpiGbl_GpeXruptListHead);
0239     return_ACPI_STATUS (Status);
0240 }
0241 
0242 
0243 /******************************************************************************
0244  *
0245  * FUNCTION:    AcpiEvRemoveSciHandler
0246  *
0247  * PARAMETERS:  none
0248  *
0249  * RETURN:      E_OK if handler uninstalled OK, E_ERROR if handler was not
0250  *              installed to begin with
0251  *
0252  * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
0253  *              taken.
0254  *
0255  * Note:  It doesn't seem important to disable all events or set the event
0256  *        enable registers to their original values. The OS should disable
0257  *        the SCI interrupt level when the handler is removed, so no more
0258  *        events will come in.
0259  *
0260  ******************************************************************************/
0261 
0262 ACPI_STATUS
0263 AcpiEvRemoveSciHandler (
0264     void)
0265 {
0266     ACPI_STATUS             Status;
0267 
0268 
0269     ACPI_FUNCTION_TRACE (EvRemoveSciHandler);
0270 
0271 
0272     /* Just let the OS remove the handler and disable the level */
0273 
0274     Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt,
0275                 AcpiEvSciXruptHandler);
0276 
0277     return_ACPI_STATUS (Status);
0278 }
0279 
0280