ACPI_STATUS AcpiRemoveFixedEventHandler ( UINT32 Event, ACPI_EVENT_HANDLER Handler) { ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE (AcpiRemoveFixedEventHandler); /* Parameter validation */ if (Event > ACPI_EVENT_MAX) { return_ACPI_STATUS (AE_BAD_PARAMETER); } Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Disable the event before removing the handler */ Status = AcpiDisableEvent (Event, 0); /* Always Remove the handler */ AcpiGbl_FixedEventHandlers[Event].Handler = NULL; AcpiGbl_FixedEventHandlers[Event].Context = NULL; if (ACPI_FAILURE (Status)) { ACPI_WARNING ((AE_INFO, "Could not disable fixed event - %s (%u)", AcpiUtGetEventName (Event), Event)); } else { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event - %s (%X)\n", AcpiUtGetEventName (Event), Event)); } (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); return_ACPI_STATUS (Status); }
void AcpiEvTerminate ( void) { UINT32 i; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (EvTerminate); if (AcpiGbl_EventsInitialized) { /* * Disable all event-related functionality. In all cases, on error, * print a message but obviously we don't abort. */ /* Disable all fixed events */ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { Status = AcpiDisableEvent (i, 0); if (ACPI_FAILURE (Status)) { ACPI_ERROR ((AE_INFO, "Could not disable fixed event %u", (UINT32) i)); } } /* Disable all GPEs in all GPE blocks */ Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL); Status = AcpiEvRemoveGlobalLockHandler (); if (ACPI_FAILURE(Status)) { ACPI_ERROR ((AE_INFO, "Could not remove Global Lock handler")); } AcpiGbl_EventsInitialized = FALSE; } /* Remove SCI handlers */ Status = AcpiEvRemoveAllSciHandlers (); if (ACPI_FAILURE(Status)) { ACPI_ERROR ((AE_INFO, "Could not remove SCI handler")); } /* Deallocate all handler objects installed within GPE info structs */ Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers, NULL); /* Return to original mode if necessary */ if (AcpiGbl_OriginalMode == ACPI_SYS_MODE_LEGACY) { Status = AcpiDisable (); if (ACPI_FAILURE (Status)) { ACPI_WARNING ((AE_INFO, "AcpiDisable failed")); } } return_VOID; }
void disable_fixed_event(uint32 event) { AcpiDisableEvent(event, 0); }
ACPI_STATUS AtFixedEventsCommon( UINT32 ApiCall, UINT32 CheckAction, ACPI_STATUS ExpectedStatus) { ACPI_STATUS Status; UINT32 Event, Flags = 0; UINT32 i; char *ApiCallName; ACPI_EVENT_STATUS EventStatus, *EventStatusPointer = &EventStatus; Status = AtSubsystemInit( AAPITS_INI_DEF, AAPITS_EN_FLAGS, AAPITS_OI_FLAGS, NULL); if (ACPI_FAILURE(Status)) { return (Status); } for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { switch (i) { case 0: Event = ACPI_EVENT_PMTIMER; break; case 1: Event = ACPI_EVENT_GLOBAL; break; case 2: Event = ACPI_EVENT_POWER_BUTTON; break; case 3: Event = ACPI_EVENT_SLEEP_BUTTON; break; case 4: Event = ACPI_EVENT_RTC; break; default: TestErrors++; printf ("Test Error: the number of Fixed Events (%d) too big (should be 5)\n", ACPI_NUM_FIXED_EVENTS); return (AE_ERROR); } if (CheckAction == 1) { Event += ACPI_NUM_FIXED_EVENTS; } else if (CheckAction == 2) { EventStatusPointer = NULL; } switch (ApiCall) { case 0: ApiCallName = "AcpiEnableEvent"; Status = AcpiEnableEvent(Event, Flags); break; case 1: ApiCallName = "AcpiDisableEvent"; Status = AcpiDisableEvent(Event, Flags); break; case 2: ApiCallName = "AcpiClearEvent"; Status = AcpiClearEvent(Event); break; case 3: ApiCallName = "AcpiGetEventStatus"; Status = AcpiGetEventStatus(Event, EventStatusPointer); break; default: TestErrors++; printf ("Test Error: the ApiCall number (%d) should be in range 0-3\n", ApiCall); return (AE_ERROR); } if (Status != ExpectedStatus) { AapiErrors++; printf ("Api Error: %s(%d) returned %s, expected %s\n", ApiCallName, Event, AcpiFormatException(Status), AcpiFormatException(ExpectedStatus)); if (Status != AE_OK) { return (Status); } else { return (AE_ERROR); } } } return (AtTerminateCtrlCheck(AE_OK, ALL_STAT)); }