Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenevxfevnt.c
Go to the documentation of this file.
00001 /****************************************************************************** 00002 * 00003 * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable 00004 * 00005 *****************************************************************************/ 00006 00007 /****************************************************************************** 00008 * 00009 * 1. Copyright Notice 00010 * 00011 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. 00012 * All rights reserved. 00013 * 00014 * 2. License 00015 * 00016 * 2.1. This is your license from Intel Corp. under its intellectual property 00017 * rights. You may have additional license terms from the party that provided 00018 * you this software, covering your right to use that party's intellectual 00019 * property rights. 00020 * 00021 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 00022 * copy of the source code appearing in this file ("Covered Code") an 00023 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 00024 * base code distributed originally by Intel ("Original Intel Code") to copy, 00025 * make derivatives, distribute, use and display any portion of the Covered 00026 * Code in any form, with the right to sublicense such rights; and 00027 * 00028 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 00029 * license (with the right to sublicense), under only those claims of Intel 00030 * patents that are infringed by the Original Intel Code, to make, use, sell, 00031 * offer to sell, and import the Covered Code and derivative works thereof 00032 * solely to the minimum extent necessary to exercise the above copyright 00033 * license, and in no event shall the patent license extend to any additions 00034 * to or modifications of the Original Intel Code. No other license or right 00035 * is granted directly or by implication, estoppel or otherwise; 00036 * 00037 * The above copyright and patent license is granted only if the following 00038 * conditions are met: 00039 * 00040 * 3. Conditions 00041 * 00042 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 00043 * Redistribution of source code of any substantial portion of the Covered 00044 * Code or modification with rights to further distribute source must include 00045 * the above Copyright Notice, the above License, this list of Conditions, 00046 * and the following Disclaimer and Export Compliance provision. In addition, 00047 * Licensee must cause all Covered Code to which Licensee contributes to 00048 * contain a file documenting the changes Licensee made to create that Covered 00049 * Code and the date of any change. Licensee must include in that file the 00050 * documentation of any changes made by any predecessor Licensee. Licensee 00051 * must include a prominent statement that the modification is derived, 00052 * directly or indirectly, from Original Intel Code. 00053 * 00054 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 00055 * Redistribution of source code of any substantial portion of the Covered 00056 * Code or modification without rights to further distribute source must 00057 * include the following Disclaimer and Export Compliance provision in the 00058 * documentation and/or other materials provided with distribution. In 00059 * addition, Licensee may not authorize further sublicense of source of any 00060 * portion of the Covered Code, and must include terms to the effect that the 00061 * license from Licensee to its licensee is limited to the intellectual 00062 * property embodied in the software Licensee provides to its licensee, and 00063 * not to intellectual property embodied in modifications its licensee may 00064 * make. 00065 * 00066 * 3.3. Redistribution of Executable. Redistribution in executable form of any 00067 * substantial portion of the Covered Code or modification must reproduce the 00068 * above Copyright Notice, and the following Disclaimer and Export Compliance 00069 * provision in the documentation and/or other materials provided with the 00070 * distribution. 00071 * 00072 * 3.4. Intel retains all right, title, and interest in and to the Original 00073 * Intel Code. 00074 * 00075 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 00076 * Intel shall be used in advertising or otherwise to promote the sale, use or 00077 * other dealings in products derived from or relating to the Covered Code 00078 * without prior written authorization from Intel. 00079 * 00080 * 4. Disclaimer and Export Compliance 00081 * 00082 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 00083 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 00084 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 00085 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 00086 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 00087 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 00088 * PARTICULAR PURPOSE. 00089 * 00090 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 00091 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 00092 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 00093 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 00094 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 00095 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 00096 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 00097 * LIMITED REMEDY. 00098 * 00099 * 4.3. Licensee shall not export, either directly or indirectly, any of this 00100 * software or system incorporating such software without first obtaining any 00101 * required license or other approval from the U. S. Department of Commerce or 00102 * any other agency or department of the United States Government. In the 00103 * event Licensee exports any such software from the United States or 00104 * re-exports any such software from a foreign destination, Licensee shall 00105 * ensure that the distribution and export/re-export of the software is in 00106 * compliance with all laws, regulations, orders, or other restrictions of the 00107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 00108 * any of its subsidiaries will export/re-export any technical data, process, 00109 * software, or service, directly or indirectly, to any country for which the 00110 * United States government or any agency thereof requires an export license, 00111 * other governmental approval, or letter of assurance, without first obtaining 00112 * such license, approval or letter. 00113 * 00114 *****************************************************************************/ 00115 00116 00117 #define __EVXFEVNT_C__ 00118 00119 #include "acpi.h" 00120 #include "accommon.h" 00121 #include "actables.h" 00122 00123 #define _COMPONENT ACPI_EVENTS 00124 ACPI_MODULE_NAME ("evxfevnt") 00125 00126 00127 /******************************************************************************* 00128 * 00129 * FUNCTION: AcpiEnable 00130 * 00131 * PARAMETERS: None 00132 * 00133 * RETURN: Status 00134 * 00135 * DESCRIPTION: Transfers the system into ACPI mode. 00136 * 00137 ******************************************************************************/ 00138 00139 ACPI_STATUS 00140 AcpiEnable ( 00141 void) 00142 { 00143 ACPI_STATUS Status = AE_OK; 00144 00145 00146 ACPI_FUNCTION_TRACE (AcpiEnable); 00147 00148 00149 /* ACPI tables must be present */ 00150 00151 if (!AcpiTbTablesLoaded ()) 00152 { 00153 return_ACPI_STATUS (AE_NO_ACPI_TABLES); 00154 } 00155 00156 /* Check current mode */ 00157 00158 if (AcpiHwGetMode() == ACPI_SYS_MODE_ACPI) 00159 { 00160 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n")); 00161 } 00162 else 00163 { 00164 /* Transition to ACPI mode */ 00165 00166 Status = AcpiHwSetMode (ACPI_SYS_MODE_ACPI); 00167 if (ACPI_FAILURE (Status)) 00168 { 00169 ACPI_ERROR ((AE_INFO, "Could not transition to ACPI mode")); 00170 return_ACPI_STATUS (Status); 00171 } 00172 00173 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, 00174 "Transition to ACPI mode successful\n")); 00175 } 00176 00177 return_ACPI_STATUS (Status); 00178 } 00179 00180 ACPI_EXPORT_SYMBOL (AcpiEnable) 00181 00182 00183 /******************************************************************************* 00184 * 00185 * FUNCTION: AcpiDisable 00186 * 00187 * PARAMETERS: None 00188 * 00189 * RETURN: Status 00190 * 00191 * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode. 00192 * 00193 ******************************************************************************/ 00194 00195 ACPI_STATUS 00196 AcpiDisable ( 00197 void) 00198 { 00199 ACPI_STATUS Status = AE_OK; 00200 00201 00202 ACPI_FUNCTION_TRACE (AcpiDisable); 00203 00204 00205 if (AcpiHwGetMode() == ACPI_SYS_MODE_LEGACY) 00206 { 00207 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, 00208 "System is already in legacy (non-ACPI) mode\n")); 00209 } 00210 else 00211 { 00212 /* Transition to LEGACY mode */ 00213 00214 Status = AcpiHwSetMode (ACPI_SYS_MODE_LEGACY); 00215 00216 if (ACPI_FAILURE (Status)) 00217 { 00218 ACPI_ERROR ((AE_INFO, 00219 "Could not exit ACPI mode to legacy mode")); 00220 return_ACPI_STATUS (Status); 00221 } 00222 00223 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI mode disabled\n")); 00224 } 00225 00226 return_ACPI_STATUS (Status); 00227 } 00228 00229 ACPI_EXPORT_SYMBOL (AcpiDisable) 00230 00231 00232 /******************************************************************************* 00233 * 00234 * FUNCTION: AcpiEnableEvent 00235 * 00236 * PARAMETERS: Event - The fixed eventto be enabled 00237 * Flags - Reserved 00238 * 00239 * RETURN: Status 00240 * 00241 * DESCRIPTION: Enable an ACPI event (fixed) 00242 * 00243 ******************************************************************************/ 00244 00245 ACPI_STATUS 00246 AcpiEnableEvent ( 00247 UINT32 Event, 00248 UINT32 Flags) 00249 { 00250 ACPI_STATUS Status = AE_OK; 00251 UINT32 Value; 00252 00253 00254 ACPI_FUNCTION_TRACE (AcpiEnableEvent); 00255 00256 00257 /* Decode the Fixed Event */ 00258 00259 if (Event > ACPI_EVENT_MAX) 00260 { 00261 return_ACPI_STATUS (AE_BAD_PARAMETER); 00262 } 00263 00264 /* 00265 * Enable the requested fixed event (by writing a one to the enable 00266 * register bit) 00267 */ 00268 Status = AcpiWriteBitRegister ( 00269 AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 00270 ACPI_ENABLE_EVENT); 00271 if (ACPI_FAILURE (Status)) 00272 { 00273 return_ACPI_STATUS (Status); 00274 } 00275 00276 /* Make sure that the hardware responded */ 00277 00278 Status = AcpiReadBitRegister ( 00279 AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value); 00280 if (ACPI_FAILURE (Status)) 00281 { 00282 return_ACPI_STATUS (Status); 00283 } 00284 00285 if (Value != 1) 00286 { 00287 ACPI_ERROR ((AE_INFO, 00288 "Could not enable %s event", AcpiUtGetEventName (Event))); 00289 return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); 00290 } 00291 00292 return_ACPI_STATUS (Status); 00293 } 00294 00295 ACPI_EXPORT_SYMBOL (AcpiEnableEvent) 00296 00297 00298 /******************************************************************************* 00299 * 00300 * FUNCTION: AcpiDisableEvent 00301 * 00302 * PARAMETERS: Event - The fixed event to be disabled 00303 * Flags - Reserved 00304 * 00305 * RETURN: Status 00306 * 00307 * DESCRIPTION: Disable an ACPI event (fixed) 00308 * 00309 ******************************************************************************/ 00310 00311 ACPI_STATUS 00312 AcpiDisableEvent ( 00313 UINT32 Event, 00314 UINT32 Flags) 00315 { 00316 ACPI_STATUS Status = AE_OK; 00317 UINT32 Value; 00318 00319 00320 ACPI_FUNCTION_TRACE (AcpiDisableEvent); 00321 00322 00323 /* Decode the Fixed Event */ 00324 00325 if (Event > ACPI_EVENT_MAX) 00326 { 00327 return_ACPI_STATUS (AE_BAD_PARAMETER); 00328 } 00329 00330 /* 00331 * Disable the requested fixed event (by writing a zero to the enable 00332 * register bit) 00333 */ 00334 Status = AcpiWriteBitRegister ( 00335 AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 00336 ACPI_DISABLE_EVENT); 00337 if (ACPI_FAILURE (Status)) 00338 { 00339 return_ACPI_STATUS (Status); 00340 } 00341 00342 Status = AcpiReadBitRegister ( 00343 AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value); 00344 if (ACPI_FAILURE (Status)) 00345 { 00346 return_ACPI_STATUS (Status); 00347 } 00348 00349 if (Value != 0) 00350 { 00351 ACPI_ERROR ((AE_INFO, 00352 "Could not disable %s events", AcpiUtGetEventName (Event))); 00353 return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); 00354 } 00355 00356 return_ACPI_STATUS (Status); 00357 } 00358 00359 ACPI_EXPORT_SYMBOL (AcpiDisableEvent) 00360 00361 00362 /******************************************************************************* 00363 * 00364 * FUNCTION: AcpiClearEvent 00365 * 00366 * PARAMETERS: Event - The fixed event to be cleared 00367 * 00368 * RETURN: Status 00369 * 00370 * DESCRIPTION: Clear an ACPI event (fixed) 00371 * 00372 ******************************************************************************/ 00373 00374 ACPI_STATUS 00375 AcpiClearEvent ( 00376 UINT32 Event) 00377 { 00378 ACPI_STATUS Status = AE_OK; 00379 00380 00381 ACPI_FUNCTION_TRACE (AcpiClearEvent); 00382 00383 00384 /* Decode the Fixed Event */ 00385 00386 if (Event > ACPI_EVENT_MAX) 00387 { 00388 return_ACPI_STATUS (AE_BAD_PARAMETER); 00389 } 00390 00391 /* 00392 * Clear the requested fixed event (By writing a one to the status 00393 * register bit) 00394 */ 00395 Status = AcpiWriteBitRegister ( 00396 AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 00397 ACPI_CLEAR_STATUS); 00398 00399 return_ACPI_STATUS (Status); 00400 } 00401 00402 ACPI_EXPORT_SYMBOL (AcpiClearEvent) 00403 00404 00405 /******************************************************************************* 00406 * 00407 * FUNCTION: AcpiGetEventStatus 00408 * 00409 * PARAMETERS: Event - The fixed event 00410 * EventStatus - Where the current status of the event will 00411 * be returned 00412 * 00413 * RETURN: Status 00414 * 00415 * DESCRIPTION: Obtains and returns the current status of the event 00416 * 00417 ******************************************************************************/ 00418 00419 ACPI_STATUS 00420 AcpiGetEventStatus ( 00421 UINT32 Event, 00422 ACPI_EVENT_STATUS *EventStatus) 00423 { 00424 ACPI_STATUS Status = AE_OK; 00425 00426 00427 ACPI_FUNCTION_TRACE (AcpiGetEventStatus); 00428 00429 00430 if (!EventStatus) 00431 { 00432 return_ACPI_STATUS (AE_BAD_PARAMETER); 00433 } 00434 00435 /* Decode the Fixed Event */ 00436 00437 if (Event > ACPI_EVENT_MAX) 00438 { 00439 return_ACPI_STATUS (AE_BAD_PARAMETER); 00440 } 00441 00442 /* Get the status of the requested fixed event */ 00443 00444 Status = AcpiReadBitRegister ( 00445 AcpiGbl_FixedEventInfo[Event].StatusRegisterId, EventStatus); 00446 00447 return_ACPI_STATUS (Status); 00448 } 00449 00450 ACPI_EXPORT_SYMBOL (AcpiGetEventStatus) 00451 00452 Generated on Sat May 26 2012 04:25:46 for ReactOS by
1.7.6.1
|