evgpe.c (129684) | evgpe.c (131440) |
---|---|
1/****************************************************************************** 2 * 3 * Module Name: evgpe - General Purpose Event handling and dispatch | 1/****************************************************************************** 2 * 3 * Module Name: evgpe - General Purpose Event handling and dispatch |
4 * $Revision: 40 $ | 4 * $Revision: 42 $ |
5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. --- 188 unchanged lines hidden (view full) --- 201 return_ACPI_STATUS (AE_NOT_EXIST); 202 } 203 RegisterBit = GpeEventInfo->RegisterBit; 204 205 /* 1) Disable case. Simply clear all enable bits */ 206 207 if (Type == ACPI_GPE_DISABLE) 208 { | 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. --- 188 unchanged lines hidden (view full) --- 201 return_ACPI_STATUS (AE_NOT_EXIST); 202 } 203 RegisterBit = GpeEventInfo->RegisterBit; 204 205 /* 1) Disable case. Simply clear all enable bits */ 206 207 if (Type == ACPI_GPE_DISABLE) 208 { |
209 GpeRegisterInfo->EnableForWake &= ~RegisterBit; 210 GpeRegisterInfo->EnableForRun &= ~RegisterBit; | 209 ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); 210 ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); |
211 return_ACPI_STATUS (AE_OK); 212 } 213 | 211 return_ACPI_STATUS (AE_OK); 212 } 213 |
214 /* 2) Enable case. Set the appropriate enable bits */ | 214 /* 2) Enable case. Set/Clear the appropriate enable bits */ |
215 216 switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) 217 { 218 case ACPI_GPE_TYPE_WAKE: | 215 216 switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) 217 { 218 case ACPI_GPE_TYPE_WAKE: |
219 GpeRegisterInfo->EnableForWake |= RegisterBit; 220 GpeRegisterInfo->EnableForRun &= ~RegisterBit; | 219 ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); 220 ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); |
221 break; 222 223 case ACPI_GPE_TYPE_RUNTIME: | 221 break; 222 223 case ACPI_GPE_TYPE_RUNTIME: |
224 GpeRegisterInfo->EnableForWake &= ~RegisterBit; 225 GpeRegisterInfo->EnableForRun |= RegisterBit; | 224 ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); 225 ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); |
226 break; 227 228 case ACPI_GPE_TYPE_WAKE_RUN: | 226 break; 227 228 case ACPI_GPE_TYPE_WAKE_RUN: |
229 GpeRegisterInfo->EnableForWake |= RegisterBit; 230 GpeRegisterInfo->EnableForRun |= RegisterBit; | 229 ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); 230 ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); |
231 break; 232 233 default: 234 return_ACPI_STATUS (AE_BAD_PARAMETER); 235 } 236 237 return_ACPI_STATUS (AE_OK); 238} --- 30 unchanged lines hidden (view full) --- 269 return_ACPI_STATUS (Status); 270 } 271 272 /* Mark wake-enabled or HW enable, or both */ 273 274 switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) 275 { 276 case ACPI_GPE_TYPE_WAKE: | 231 break; 232 233 default: 234 return_ACPI_STATUS (AE_BAD_PARAMETER); 235 } 236 237 return_ACPI_STATUS (AE_OK); 238} --- 30 unchanged lines hidden (view full) --- 269 return_ACPI_STATUS (Status); 270 } 271 272 /* Mark wake-enabled or HW enable, or both */ 273 274 switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) 275 { 276 case ACPI_GPE_TYPE_WAKE: |
277 GpeEventInfo->Flags |= ACPI_GPE_WAKE_ENABLED; | 277 278 ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED); |
278 break; 279 280 case ACPI_GPE_TYPE_WAKE_RUN: | 279 break; 280 281 case ACPI_GPE_TYPE_WAKE_RUN: |
281 GpeEventInfo->Flags |= ACPI_GPE_WAKE_ENABLED; | |
282 | 282 |
283 ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED); 284 |
|
283 /*lint -fallthrough */ 284 285 case ACPI_GPE_TYPE_RUNTIME: 286 | 285 /*lint -fallthrough */ 286 287 case ACPI_GPE_TYPE_RUNTIME: 288 |
287 GpeEventInfo->Flags |= ACPI_GPE_RUN_ENABLED; | 289 ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_RUN_ENABLED); |
288 289 if (WriteToHardware) 290 { 291 /* Clear the GPE (of stale events), then enable it */ 292 293 Status = AcpiHwClearGpe (GpeEventInfo); 294 if (ACPI_FAILURE (Status)) 295 { --- 49 unchanged lines hidden (view full) --- 345 return_ACPI_STATUS (Status); 346 } 347 348 /* Mark wake-disabled or HW disable, or both */ 349 350 switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) 351 { 352 case ACPI_GPE_TYPE_WAKE: | 290 291 if (WriteToHardware) 292 { 293 /* Clear the GPE (of stale events), then enable it */ 294 295 Status = AcpiHwClearGpe (GpeEventInfo); 296 if (ACPI_FAILURE (Status)) 297 { --- 49 unchanged lines hidden (view full) --- 347 return_ACPI_STATUS (Status); 348 } 349 350 /* Mark wake-disabled or HW disable, or both */ 351 352 switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) 353 { 354 case ACPI_GPE_TYPE_WAKE: |
353 GpeEventInfo->Flags &= ~ACPI_GPE_WAKE_ENABLED; | 355 ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED); |
354 break; 355 356 case ACPI_GPE_TYPE_WAKE_RUN: | 356 break; 357 358 case ACPI_GPE_TYPE_WAKE_RUN: |
357 GpeEventInfo->Flags &= ~ACPI_GPE_WAKE_ENABLED; | 359 ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED); |
358 359 /*lint -fallthrough */ 360 361 case ACPI_GPE_TYPE_RUNTIME: 362 363 /* Disable the requested runtime GPE */ 364 | 360 361 /*lint -fallthrough */ 362 363 case ACPI_GPE_TYPE_RUNTIME: 364 365 /* Disable the requested runtime GPE */ 366 |
365 GpeEventInfo->Flags &= ~ACPI_GPE_RUN_ENABLED; | 367 ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_RUN_ENABLED); |
366 Status = AcpiHwWriteGpeEnableReg (GpeEventInfo); 367 break; 368 369 default: 370 return_ACPI_STATUS (AE_BAD_PARAMETER); 371 } 372 373 return_ACPI_STATUS (AE_OK); --- 342 unchanged lines hidden (view full) --- 716 return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); 717 } 718 } 719 720 /* Save current system state */ 721 722 if (AcpiGbl_SystemAwakeAndRunning) 723 { | 368 Status = AcpiHwWriteGpeEnableReg (GpeEventInfo); 369 break; 370 371 default: 372 return_ACPI_STATUS (AE_BAD_PARAMETER); 373 } 374 375 return_ACPI_STATUS (AE_OK); --- 342 unchanged lines hidden (view full) --- 718 return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); 719 } 720 } 721 722 /* Save current system state */ 723 724 if (AcpiGbl_SystemAwakeAndRunning) 725 { |
724 GpeEventInfo->Flags |= ACPI_GPE_SYSTEM_RUNNING; | 726 ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_SYSTEM_RUNNING); |
725 } 726 else 727 { | 727 } 728 else 729 { |
728 GpeEventInfo->Flags &= ~ACPI_GPE_SYSTEM_RUNNING; | 730 ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_SYSTEM_RUNNING); |
729 } 730 731 /* 732 * Dispatch the GPE to either an installed handler, or the control 733 * method associated with this GPE (_Lxx or _Exx). 734 * If a handler exists, we invoke it and do not attempt to run the method. 735 * If there is neither a handler nor a method, we disable the level to 736 * prevent further events from coming in here. 737 */ 738 switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) 739 { 740 case ACPI_GPE_DISPATCH_HANDLER: 741 | 731 } 732 733 /* 734 * Dispatch the GPE to either an installed handler, or the control 735 * method associated with this GPE (_Lxx or _Exx). 736 * If a handler exists, we invoke it and do not attempt to run the method. 737 * If there is neither a handler nor a method, we disable the level to 738 * prevent further events from coming in here. 739 */ 740 switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) 741 { 742 case ACPI_GPE_DISPATCH_HANDLER: 743 |
742 /* Invoke the installed handler (at interrupt level) */ 743 744 GpeEventInfo->Dispatch.Handler->Address ((void *) | 744 /* 745 * Invoke the installed handler (at interrupt level) 746 * Ignore return status for now. TBD: leave GPE disabled on error? 747 */ 748 (void) GpeEventInfo->Dispatch.Handler->Address ( |
745 GpeEventInfo->Dispatch.Handler->Context); 746 747 /* It is now safe to clear level-triggered events. */ 748 749 if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) 750 { 751 Status = AcpiHwClearGpe (GpeEventInfo); 752 if (ACPI_FAILURE (Status)) --- 117 unchanged lines hidden --- | 749 GpeEventInfo->Dispatch.Handler->Context); 750 751 /* It is now safe to clear level-triggered events. */ 752 753 if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) 754 { 755 Status = AcpiHwClearGpe (GpeEventInfo); 756 if (ACPI_FAILURE (Status)) --- 117 unchanged lines hidden --- |