1/******************************************************************************
2 *
3 * Module Name: evgpe - General Purpose Event handling and dispatch
4 * $Revision: 40 $
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;
211 return_ACPI_STATUS (AE_OK);
212 }
213
214 /* 2) Enable case. Set the appropriate enable bits */
215
216 switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
217 {
218 case ACPI_GPE_TYPE_WAKE:
219 GpeRegisterInfo->EnableForWake |= RegisterBit;
220 GpeRegisterInfo->EnableForRun &= ~RegisterBit;
221 break;
222
223 case ACPI_GPE_TYPE_RUNTIME:
224 GpeRegisterInfo->EnableForWake &= ~RegisterBit;
225 GpeRegisterInfo->EnableForRun |= RegisterBit;
226 break;
227
228 case ACPI_GPE_TYPE_WAKE_RUN:
229 GpeRegisterInfo->EnableForWake |= RegisterBit;
230 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:
277 GpeEventInfo->Flags |= ACPI_GPE_WAKE_ENABLED;
278 break;
279
280 case ACPI_GPE_TYPE_WAKE_RUN:
281 GpeEventInfo->Flags |= ACPI_GPE_WAKE_ENABLED;
282
283 /*lint -fallthrough */
284
285 case ACPI_GPE_TYPE_RUNTIME:
286
287 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:
353 GpeEventInfo->Flags &= ~ACPI_GPE_WAKE_ENABLED;
354 break;
355
356 case ACPI_GPE_TYPE_WAKE_RUN:
357 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
365 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 {
724 GpeEventInfo->Flags |= ACPI_GPE_SYSTEM_RUNNING;
725 }
726 else
727 {
728 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
742 /* Invoke the installed handler (at interrupt level) */
743
744 GpeEventInfo->Dispatch.Handler->Address ((void *)
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 ---
2 *
3 * Module Name: evgpe - General Purpose Event handling and dispatch
4 * $Revision: 40 $
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;
211 return_ACPI_STATUS (AE_OK);
212 }
213
214 /* 2) Enable case. Set the appropriate enable bits */
215
216 switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
217 {
218 case ACPI_GPE_TYPE_WAKE:
219 GpeRegisterInfo->EnableForWake |= RegisterBit;
220 GpeRegisterInfo->EnableForRun &= ~RegisterBit;
221 break;
222
223 case ACPI_GPE_TYPE_RUNTIME:
224 GpeRegisterInfo->EnableForWake &= ~RegisterBit;
225 GpeRegisterInfo->EnableForRun |= RegisterBit;
226 break;
227
228 case ACPI_GPE_TYPE_WAKE_RUN:
229 GpeRegisterInfo->EnableForWake |= RegisterBit;
230 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:
277 GpeEventInfo->Flags |= ACPI_GPE_WAKE_ENABLED;
278 break;
279
280 case ACPI_GPE_TYPE_WAKE_RUN:
281 GpeEventInfo->Flags |= ACPI_GPE_WAKE_ENABLED;
282
283 /*lint -fallthrough */
284
285 case ACPI_GPE_TYPE_RUNTIME:
286
287 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:
353 GpeEventInfo->Flags &= ~ACPI_GPE_WAKE_ENABLED;
354 break;
355
356 case ACPI_GPE_TYPE_WAKE_RUN:
357 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
365 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 {
724 GpeEventInfo->Flags |= ACPI_GPE_SYSTEM_RUNNING;
725 }
726 else
727 {
728 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
742 /* Invoke the installed handler (at interrupt level) */
743
744 GpeEventInfo->Dispatch.Handler->Address ((void *)
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 ---