![]() |
|
|||
File indexing completed on 2025-05-11 08:24:02
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 - 2024, 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 * Alternatively, you may choose to be licensed under the terms of the 0119 * following license: 0120 * 0121 * Redistribution and use in source and binary forms, with or without 0122 * modification, are permitted provided that the following conditions 0123 * are met: 0124 * 1. Redistributions of source code must retain the above copyright 0125 * notice, this list of conditions, and the following disclaimer, 0126 * without modification. 0127 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 0128 * substantially similar to the "NO WARRANTY" disclaimer below 0129 * ("Disclaimer") and any redistribution must be conditioned upon 0130 * including a substantially similar Disclaimer requirement for further 0131 * binary redistribution. 0132 * 3. Neither the names of the above-listed copyright holders nor the names 0133 * of any contributors may be used to endorse or promote products derived 0134 * from this software without specific prior written permission. 0135 * 0136 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 0137 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 0138 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 0139 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 0140 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 0141 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 0142 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0143 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0144 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0145 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 0146 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0147 * 0148 * Alternatively, you may choose to be licensed under the terms of the 0149 * GNU General Public License ("GPL") version 2 as published by the Free 0150 * Software Foundation. 0151 * 0152 *****************************************************************************/ 0153 0154 #include "acpi.h" 0155 #include "accommon.h" 0156 #include "acevents.h" 0157 0158 0159 #define _COMPONENT ACPI_EVENTS 0160 ACPI_MODULE_NAME ("evsci") 0161 0162 #if (!ACPI_REDUCED_HARDWARE) /* Entire module */ 0163 0164 /* Local prototypes */ 0165 0166 static UINT32 ACPI_SYSTEM_XFACE 0167 AcpiEvSciXruptHandler ( 0168 void *Context); 0169 0170 0171 /******************************************************************************* 0172 * 0173 * FUNCTION: AcpiEvSciDispatch 0174 * 0175 * PARAMETERS: None 0176 * 0177 * RETURN: Status code indicates whether interrupt was handled. 0178 * 0179 * DESCRIPTION: Dispatch the SCI to all host-installed SCI handlers. 0180 * 0181 ******************************************************************************/ 0182 0183 UINT32 0184 AcpiEvSciDispatch ( 0185 void) 0186 { 0187 ACPI_SCI_HANDLER_INFO *SciHandler; 0188 ACPI_CPU_FLAGS Flags; 0189 UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; 0190 0191 0192 ACPI_FUNCTION_NAME (EvSciDispatch); 0193 0194 0195 /* Are there any host-installed SCI handlers? */ 0196 0197 if (!AcpiGbl_SciHandlerList) 0198 { 0199 return (IntStatus); 0200 } 0201 0202 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); 0203 0204 /* Invoke all host-installed SCI handlers */ 0205 0206 SciHandler = AcpiGbl_SciHandlerList; 0207 while (SciHandler) 0208 { 0209 /* Invoke the installed handler (at interrupt level) */ 0210 0211 IntStatus |= SciHandler->Address ( 0212 SciHandler->Context); 0213 0214 SciHandler = SciHandler->Next; 0215 } 0216 0217 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); 0218 return (IntStatus); 0219 } 0220 0221 0222 /******************************************************************************* 0223 * 0224 * FUNCTION: AcpiEvSciXruptHandler 0225 * 0226 * PARAMETERS: Context - Calling Context 0227 * 0228 * RETURN: Status code indicates whether interrupt was handled. 0229 * 0230 * DESCRIPTION: Interrupt handler that will figure out what function or 0231 * control method to call to deal with a SCI. 0232 * 0233 ******************************************************************************/ 0234 0235 static UINT32 ACPI_SYSTEM_XFACE 0236 AcpiEvSciXruptHandler ( 0237 void *Context) 0238 { 0239 ACPI_GPE_XRUPT_INFO *GpeXruptList = Context; 0240 UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED; 0241 0242 0243 ACPI_FUNCTION_TRACE (EvSciXruptHandler); 0244 0245 0246 /* 0247 * We are guaranteed by the ACPICA initialization/shutdown code that 0248 * if this interrupt handler is installed, ACPI is enabled. 0249 */ 0250 0251 /* 0252 * Fixed Events: 0253 * Check for and dispatch any Fixed Events that have occurred 0254 */ 0255 InterruptHandled |= AcpiEvFixedEventDetect (); 0256 0257 /* 0258 * General Purpose Events: 0259 * Check for and dispatch any GPEs that have occurred 0260 */ 0261 InterruptHandled |= AcpiEvGpeDetect (GpeXruptList); 0262 0263 /* Invoke all host-installed SCI handlers */ 0264 0265 InterruptHandled |= AcpiEvSciDispatch (); 0266 0267 AcpiSciCount++; 0268 return_UINT32 (InterruptHandled); 0269 } 0270 0271 0272 /******************************************************************************* 0273 * 0274 * FUNCTION: AcpiEvGpeXruptHandler 0275 * 0276 * PARAMETERS: Context - Calling Context 0277 * 0278 * RETURN: Status code indicates whether interrupt was handled. 0279 * 0280 * DESCRIPTION: Handler for GPE Block Device interrupts 0281 * 0282 ******************************************************************************/ 0283 0284 UINT32 ACPI_SYSTEM_XFACE 0285 AcpiEvGpeXruptHandler ( 0286 void *Context) 0287 { 0288 ACPI_GPE_XRUPT_INFO *GpeXruptList = Context; 0289 UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED; 0290 0291 0292 ACPI_FUNCTION_TRACE (EvGpeXruptHandler); 0293 0294 0295 /* 0296 * We are guaranteed by the ACPICA initialization/shutdown code that 0297 * if this interrupt handler is installed, ACPI is enabled. 0298 */ 0299 0300 /* GPEs: Check for and dispatch any GPEs that have occurred */ 0301 0302 InterruptHandled |= AcpiEvGpeDetect (GpeXruptList); 0303 return_UINT32 (InterruptHandled); 0304 } 0305 0306 0307 /****************************************************************************** 0308 * 0309 * FUNCTION: AcpiEvInstallSciHandler 0310 * 0311 * PARAMETERS: none 0312 * 0313 * RETURN: Status 0314 * 0315 * DESCRIPTION: Installs SCI handler. 0316 * 0317 ******************************************************************************/ 0318 0319 UINT32 0320 AcpiEvInstallSciHandler ( 0321 void) 0322 { 0323 UINT32 Status = AE_OK; 0324 0325 0326 ACPI_FUNCTION_TRACE (EvInstallSciHandler); 0327 0328 0329 Status = AcpiOsInstallInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt, 0330 AcpiEvSciXruptHandler, AcpiGbl_GpeXruptListHead); 0331 return_ACPI_STATUS (Status); 0332 } 0333 0334 0335 /****************************************************************************** 0336 * 0337 * FUNCTION: AcpiEvRemoveAllSciHandlers 0338 * 0339 * PARAMETERS: none 0340 * 0341 * RETURN: AE_OK if handler uninstalled, AE_ERROR if handler was not 0342 * installed to begin with 0343 * 0344 * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be 0345 * taken. Remove all host-installed SCI handlers. 0346 * 0347 * Note: It doesn't seem important to disable all events or set the event 0348 * enable registers to their original values. The OS should disable 0349 * the SCI interrupt level when the handler is removed, so no more 0350 * events will come in. 0351 * 0352 ******************************************************************************/ 0353 0354 ACPI_STATUS 0355 AcpiEvRemoveAllSciHandlers ( 0356 void) 0357 { 0358 ACPI_SCI_HANDLER_INFO *SciHandler; 0359 ACPI_CPU_FLAGS Flags; 0360 ACPI_STATUS Status; 0361 0362 0363 ACPI_FUNCTION_TRACE (EvRemoveAllSciHandlers); 0364 0365 0366 /* Just let the OS remove the handler and disable the level */ 0367 0368 Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt, 0369 AcpiEvSciXruptHandler); 0370 0371 if (!AcpiGbl_SciHandlerList) 0372 { 0373 return (Status); 0374 } 0375 0376 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); 0377 0378 /* Free all host-installed SCI handlers */ 0379 0380 while (AcpiGbl_SciHandlerList) 0381 { 0382 SciHandler = AcpiGbl_SciHandlerList; 0383 AcpiGbl_SciHandlerList = SciHandler->Next; 0384 ACPI_FREE (SciHandler); 0385 } 0386 0387 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); 0388 return_ACPI_STATUS (Status); 0389 } 0390 0391 #endif /* !ACPI_REDUCED_HARDWARE */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |