📄 evxfevnt.c
字号:
if (Flags & ACPI_NOT_ISR) { (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); } return_ACPI_STATUS (Status);}ACPI_EXPORT_SYMBOL (AcpiDisableGpe)/******************************************************************************* * * FUNCTION: AcpiDisableEvent * * PARAMETERS: Event - The fixed eventto be enabled * Flags - Reserved * * RETURN: Status * * DESCRIPTION: Disable an ACPI event (fixed) * ******************************************************************************/ACPI_STATUSAcpiDisableEvent ( UINT32 Event, UINT32 Flags){ ACPI_STATUS Status = AE_OK; UINT32 Value; ACPI_FUNCTION_TRACE (AcpiDisableEvent); /* Decode the Fixed Event */ if (Event > ACPI_EVENT_MAX) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* * Disable the requested fixed event (by writing a zero to the * enable register bit) */ Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 0); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } if (Value != 0) { ACPI_ERROR ((AE_INFO, "Could not disable %s events", AcpiUtGetEventName (Event))); return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); } return_ACPI_STATUS (Status);}ACPI_EXPORT_SYMBOL (AcpiDisableEvent)/******************************************************************************* * * FUNCTION: AcpiClearEvent * * PARAMETERS: Event - The fixed event to be cleared * * RETURN: Status * * DESCRIPTION: Clear an ACPI event (fixed) * ******************************************************************************/ACPI_STATUSAcpiClearEvent ( UINT32 Event){ ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE (AcpiClearEvent); /* Decode the Fixed Event */ if (Event > ACPI_EVENT_MAX) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* * Clear the requested fixed event (By writing a one to the * status register bit) */ Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 1); return_ACPI_STATUS (Status);}ACPI_EXPORT_SYMBOL (AcpiClearEvent)/******************************************************************************* * * FUNCTION: AcpiClearGpe * * PARAMETERS: GpeDevice - Parent GPE Device * GpeNumber - GPE level within the GPE block * Flags - Called from an ISR or not * * RETURN: Status * * DESCRIPTION: Clear an ACPI event (general purpose) * ******************************************************************************/ACPI_STATUSAcpiClearGpe ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, UINT32 Flags){ ACPI_STATUS Status = AE_OK; ACPI_GPE_EVENT_INFO *GpeEventInfo; ACPI_FUNCTION_TRACE (AcpiClearGpe); /* Use semaphore lock if not executing at interrupt level */ if (Flags & ACPI_NOT_ISR) { Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } /* Ensure that we have a valid GPE number */ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); if (!GpeEventInfo) { Status = AE_BAD_PARAMETER; goto UnlockAndExit; } Status = AcpiHwClearGpe (GpeEventInfo);UnlockAndExit: if (Flags & ACPI_NOT_ISR) { (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); } return_ACPI_STATUS (Status);}ACPI_EXPORT_SYMBOL (AcpiClearGpe)/******************************************************************************* * * FUNCTION: AcpiGetEventStatus * * PARAMETERS: Event - The fixed event * EventStatus - Where the current status of the event will * be returned * * RETURN: Status * * DESCRIPTION: Obtains and returns the current status of the event * ******************************************************************************/ACPI_STATUSAcpiGetEventStatus ( UINT32 Event, ACPI_EVENT_STATUS *EventStatus){ ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE (AcpiGetEventStatus); if (!EventStatus) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Decode the Fixed Event */ if (Event > ACPI_EVENT_MAX) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Get the status of the requested fixed event */ Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, EventStatus); return_ACPI_STATUS (Status);}ACPI_EXPORT_SYMBOL (AcpiGetEventStatus)/******************************************************************************* * * FUNCTION: AcpiGetGpeStatus * * PARAMETERS: GpeDevice - Parent GPE Device * GpeNumber - GPE level within the GPE block * Flags - Called from an ISR or not * EventStatus - Where the current status of the event will * be returned * * RETURN: Status * * DESCRIPTION: Get status of an event (general purpose) * ******************************************************************************/ACPI_STATUSAcpiGetGpeStatus ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, UINT32 Flags, ACPI_EVENT_STATUS *EventStatus){ ACPI_STATUS Status = AE_OK; ACPI_GPE_EVENT_INFO *GpeEventInfo; ACPI_FUNCTION_TRACE (AcpiGetGpeStatus); /* Use semaphore lock if not executing at interrupt level */ if (Flags & ACPI_NOT_ISR) { Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } /* Ensure that we have a valid GPE number */ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); if (!GpeEventInfo) { Status = AE_BAD_PARAMETER; goto UnlockAndExit; } /* Obtain status on the requested GPE number */ Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus);UnlockAndExit: if (Flags & ACPI_NOT_ISR) { (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); } return_ACPI_STATUS (Status);}ACPI_EXPORT_SYMBOL (AcpiGetGpeStatus)/******************************************************************************* * * FUNCTION: AcpiInstallGpeBlock * * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device * GpeBlockAddress - Address and SpaceID * RegisterCount - Number of GPE register pairs in the block * InterruptNumber - H/W interrupt for the block * * RETURN: Status * * DESCRIPTION: Create and Install a block of GPE registers * ******************************************************************************/ACPI_STATUSAcpiInstallGpeBlock ( ACPI_HANDLE GpeDevice, ACPI_GENERIC_ADDRESS *GpeBlockAddress, UINT32 RegisterCount, UINT32 InterruptNumber){ ACPI_STATUS Status; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_NAMESPACE_NODE *Node; ACPI_GPE_BLOCK_INFO *GpeBlock; ACPI_FUNCTION_TRACE (AcpiInstallGpeBlock); if ((!GpeDevice) || (!GpeBlockAddress) || (!RegisterCount)) { return_ACPI_STATUS (AE_BAD_PARAMETER); } Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return (Status); } Node = AcpiNsMapHandleToNode (GpeDevice); if (!Node) { Status = AE_BAD_PARAMETER; goto UnlockAndExit; } /* * For user-installed GPE Block Devices, the GpeBlockBaseNumber * is always zero */ Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount, 0, InterruptNumber, &GpeBlock); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; } /* Run the _PRW methods and enable the GPEs */ Status = AcpiEvInitializeGpeBlock (Node, GpeBlock); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; } /* Get the DeviceObject attached to the node */ ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc) { /* No object, create a new one */ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_DEVICE); if (!ObjDesc) { Status = AE_NO_MEMORY; goto UnlockAndExit; } Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_DEVICE); /* Remove local reference to the object */ AcpiUtRemoveReference (ObjDesc); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; } } /* Install the GPE block in the DeviceObject */ ObjDesc->Device.GpeBlock = GpeBlock;UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status);}ACPI_EXPORT_SYMBOL (AcpiInstallGpeBlock)/******************************************************************************* * * FUNCTION: AcpiRemoveGpeBlock * * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device * * RETURN: Status * * DESCRIPTION: Remove a previously installed block of GPE registers * ******************************************************************************/ACPI_STATUSAcpiRemoveGpeBlock ( ACPI_HANDLE GpeDevice){ ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; ACPI_FUNCTION_TRACE (AcpiRemoveGpeBlock); if (!GpeDevice) { return_ACPI_STATUS (AE_BAD_PARAMETER); } Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return (Status); } Node = AcpiNsMapHandleToNode (GpeDevice); if (!Node) { Status = AE_BAD_PARAMETER; goto UnlockAndExit; } /* Get the DeviceObject attached to the node */ ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc || !ObjDesc->Device.GpeBlock) { return_ACPI_STATUS (AE_NULL_OBJECT); } /* Delete the GPE block (but not the DeviceObject) */ Status = AcpiEvDeleteGpeBlock (ObjDesc->Device.GpeBlock); if (ACPI_SUCCESS (Status)) { ObjDesc->Device.GpeBlock = NULL; }UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status);}ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -