本文整理汇总了C++中AcpiOsAcquireLock函数的典型用法代码示例。如果您正苦于以下问题:C++ AcpiOsAcquireLock函数的具体用法?C++ AcpiOsAcquireLock怎么用?C++ AcpiOsAcquireLock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AcpiOsAcquireLock函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: AcpiSetGpe
ACPI_STATUS
AcpiSetGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT8 Action)
{
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_STATUS Status;
ACPI_CPU_FLAGS Flags;
ACPI_FUNCTION_TRACE (AcpiSetGpe);
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Ensure that we have a valid GPE number */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/* Perform the action */
switch (Action)
{
case ACPI_GPE_ENABLE:
Status = AcpiEvEnableGpe (GpeEventInfo);
break;
case ACPI_GPE_DISABLE:
Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE);
break;
default:
Status = AE_BAD_PARAMETER;
break;
}
UnlockAndExit:
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return_ACPI_STATUS (Status);
}
开发者ID:juanfra684,项目名称:DragonFlyBSD,代码行数:46,代码来源:evxfgpe.c
示例2: AcpiEvGlobalLockHandler
static UINT32
AcpiEvGlobalLockHandler (
void *Context)
{
ACPI_STATUS Status;
ACPI_CPU_FLAGS Flags;
Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock);
/*
* If a request for the global lock is not actually pending,
* we are done. This handles "spurious" global lock interrupts
* which are possible (and have been seen) with bad BIOSs.
*/
if (!AcpiGbl_GlobalLockPending)
{
goto CleanupAndExit;
}
/*
* Send a unit to the global lock semaphore. The actual acquisition
* of the global lock will be performed by the waiting thread.
*/
Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, 1);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR ((AE_INFO, "Could not signal Global Lock semaphore"));
}
AcpiGbl_GlobalLockPending = FALSE;
CleanupAndExit:
AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags);
return (ACPI_INTERRUPT_HANDLED);
}
开发者ID:ppaeps,项目名称:freebsd-head,代码行数:38,代码来源:evglock.c
示例3: AcpiEnableGpe
ACPI_STATUS
AcpiEnableGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber)
{
ACPI_STATUS Status = AE_BAD_PARAMETER;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_CPU_FLAGS Flags;
ACPI_FUNCTION_TRACE (AcpiEnableGpe);
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/*
* Ensure that we have a valid GPE number and that there is some way
* of handling the GPE (handler or a GPE method). In other words, we
* won't allow a valid GPE to be enabled if there is no way to handle it.
*/
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (GpeEventInfo)
{
if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) !=
ACPI_GPE_DISPATCH_NONE)
{
Status = AcpiEvAddGpeReference (GpeEventInfo);
}
else
{
Status = AE_NO_HANDLER;
}
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return_ACPI_STATUS (Status);
}
开发者ID:matter123,项目名称:mossy,代码行数:37,代码来源:evxfgpe.c
示例4: AcpiEvSciDispatch
UINT32
AcpiEvSciDispatch (
void)
{
ACPI_SCI_HANDLER_INFO *SciHandler;
ACPI_CPU_FLAGS Flags;
UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
ACPI_FUNCTION_NAME (EvSciDispatch);
/* Are there any host-installed SCI handlers? */
if (!AcpiGbl_SciHandlerList)
{
return (IntStatus);
}
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Invoke all host-installed SCI handlers */
SciHandler = AcpiGbl_SciHandlerList;
while (SciHandler)
{
/* Invoke the installed handler (at interrupt level) */
IntStatus |= SciHandler->Address (
SciHandler->Context);
SciHandler = SciHandler->Next;
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return (IntStatus);
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:37,代码来源:evsci.c
示例5: AcpiEvRemoveAllSciHandlers
ACPI_STATUS
AcpiEvRemoveAllSciHandlers (
void)
{
ACPI_SCI_HANDLER_INFO *SciHandler;
ACPI_CPU_FLAGS Flags;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (EvRemoveAllSciHandlers);
/* Just let the OS remove the handler and disable the level */
Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt,
AcpiEvSciXruptHandler);
if (!AcpiGbl_SciHandlerList)
{
return (Status);
}
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Free all host-installed SCI handlers */
while (AcpiGbl_SciHandlerList)
{
SciHandler = AcpiGbl_SciHandlerList;
AcpiGbl_SciHandlerList = SciHandler->Next;
ACPI_FREE (SciHandler);
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return_ACPI_STATUS (Status);
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:36,代码来源:evsci.c
示例6: AcpiHwClearAcpiStatus
ACPI_STATUS
AcpiHwClearAcpiStatus (
void)
{
ACPI_STATUS Status;
ACPI_CPU_FLAGS LockFlags = 0;
ACPI_FUNCTION_TRACE (HwClearAcpiStatus);
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %8.8X%8.8X\n",
ACPI_BITMASK_ALL_FIXED_STATUS,
ACPI_FORMAT_UINT64 (AcpiGbl_XPm1aStatus.Address)));
LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
/* Clear the fixed events in PM1 A/B */
Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_STATUS,
ACPI_BITMASK_ALL_FIXED_STATUS);
AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/* Clear the GPE Bits in all GPE registers in all GPE blocks */
Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL);
Exit:
return_ACPI_STATUS (Status);
}
开发者ID:victoredwardocallaghan,项目名称:DragonFlyBSD,代码行数:36,代码来源:hwregs.c
示例7: AcpiEvInstallGpeHandler
static ACPI_STATUS
AcpiEvInstallGpeHandler (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Type,
BOOLEAN IsRawHandler,
ACPI_GPE_HANDLER Address,
void *Context)
{
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_GPE_HANDLER_INFO *Handler;
ACPI_STATUS Status;
ACPI_CPU_FLAGS Flags;
ACPI_FUNCTION_TRACE (EvInstallGpeHandler);
/* Parameter validation */
if ((!Address) || (Type & ~ACPI_GPE_XRUPT_TYPE_MASK))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Allocate and init handler object (before lock) */
Handler = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_HANDLER_INFO));
if (!Handler)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Ensure that we have a valid GPE number */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
Status = AE_BAD_PARAMETER;
goto FreeAndExit;
}
/* Make sure that there isn't a handler there already */
if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) ==
ACPI_GPE_DISPATCH_HANDLER) ||
(ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) ==
ACPI_GPE_DISPATCH_RAW_HANDLER))
{
Status = AE_ALREADY_EXISTS;
goto FreeAndExit;
}
Handler->Address = Address;
Handler->Context = Context;
Handler->MethodNode = GpeEventInfo->Dispatch.MethodNode;
Handler->OriginalFlags = (UINT8) (GpeEventInfo->Flags &
(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK));
/*
* If the GPE is associated with a method, it may have been enabled
* automatically during initialization, in which case it has to be
* disabled now to avoid spurious execution of the handler.
*/
if (((ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) ==
ACPI_GPE_DISPATCH_METHOD) ||
(ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) ==
ACPI_GPE_DISPATCH_NOTIFY)) &&
GpeEventInfo->RuntimeCount)
{
Handler->OriginallyEnabled = TRUE;
(void) AcpiEvRemoveGpeReference (GpeEventInfo);
/* Sanity check of original type against new type */
if (Type != (UINT32) (GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK))
{
ACPI_WARNING ((AE_INFO, "GPE type mismatch (level/edge)"));
}
}
/* Install the handler */
GpeEventInfo->Dispatch.Handler = Handler;
/* Setup up dispatch flags to indicate handler (vs. method/notify) */
GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
GpeEventInfo->Flags |= (UINT8) (Type | (IsRawHandler ?
ACPI_GPE_DISPATCH_RAW_HANDLER : ACPI_GPE_DISPATCH_HANDLER));
//.........这里部分代码省略.........
开发者ID:ikitayama,项目名称:acpica-tools,代码行数:101,代码来源:evxface.c
示例8: AcpiRemoveSciHandler
ACPI_STATUS
AcpiRemoveSciHandler (
ACPI_SCI_HANDLER Address)
{
ACPI_SCI_HANDLER_INFO *PrevSciHandler;
ACPI_SCI_HANDLER_INFO *NextSciHandler;
ACPI_CPU_FLAGS Flags;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiRemoveSciHandler);
if (!Address)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Remove the SCI handler with lock */
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
PrevSciHandler = NULL;
NextSciHandler = AcpiGbl_SciHandlerList;
while (NextSciHandler)
{
if (NextSciHandler->Address == Address)
{
/* Unlink and free the SCI handler info block */
if (PrevSciHandler)
{
PrevSciHandler->Next = NextSciHandler->Next;
}
else
{
AcpiGbl_SciHandlerList = NextSciHandler->Next;
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
ACPI_FREE (NextSciHandler);
goto UnlockAndExit;
}
PrevSciHandler = NextSciHandler;
NextSciHandler = NextSciHandler->Next;
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
Status = AE_NOT_EXIST;
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
开发者ID:ikitayama,项目名称:acpica-tools,代码行数:62,代码来源:evxface.c
示例9: AcpiInstallSciHandler
ACPI_STATUS
AcpiInstallSciHandler (
ACPI_SCI_HANDLER Address,
void *Context)
{
ACPI_SCI_HANDLER_INFO *NewSciHandler;
ACPI_SCI_HANDLER_INFO *SciHandler;
ACPI_CPU_FLAGS Flags;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiInstallSciHandler);
if (!Address)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Allocate and init a handler object */
NewSciHandler = ACPI_ALLOCATE (sizeof (ACPI_SCI_HANDLER_INFO));
if (!NewSciHandler)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
NewSciHandler->Address = Address;
NewSciHandler->Context = Context;
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/* Lock list during installation */
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
SciHandler = AcpiGbl_SciHandlerList;
/* Ensure handler does not already exist */
while (SciHandler)
{
if (Address == SciHandler->Address)
{
Status = AE_ALREADY_EXISTS;
goto UnlockAndExit;
}
SciHandler = SciHandler->Next;
}
/* Install the new handler into the global list (at head) */
NewSciHandler->Next = AcpiGbl_SciHandlerList;
AcpiGbl_SciHandlerList = NewSciHandler;
UnlockAndExit:
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
Exit:
if (ACPI_FAILURE (Status))
{
ACPI_FREE (NewSciHandler);
}
return_ACPI_STATUS (Status);
}
开发者ID:ikitayama,项目名称:acpica-tools,代码行数:72,代码来源:evxface.c
示例10: AcpiRemoveGpeHandler
ACPI_STATUS
AcpiRemoveGpeHandler (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
ACPI_GPE_HANDLER Address)
{
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_GPE_HANDLER_INFO *Handler;
ACPI_STATUS Status;
ACPI_CPU_FLAGS Flags;
ACPI_FUNCTION_TRACE (AcpiRemoveGpeHandler);
/* Parameter validation */
if (!Address)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Ensure that we have a valid GPE number */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/* Make sure that a handler is indeed installed */
if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) !=
ACPI_GPE_DISPATCH_HANDLER) &&
(ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) !=
ACPI_GPE_DISPATCH_RAW_HANDLER))
{
Status = AE_NOT_EXIST;
goto UnlockAndExit;
}
/* Make sure that the installed handler is the same */
if (GpeEventInfo->Dispatch.Handler->Address != Address)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/* Remove the handler */
Handler = GpeEventInfo->Dispatch.Handler;
GpeEventInfo->Dispatch.Handler = NULL;
/* Restore Method node (if any), set dispatch flags */
GpeEventInfo->Dispatch.MethodNode = Handler->MethodNode;
GpeEventInfo->Flags &=
~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
GpeEventInfo->Flags |= Handler->OriginalFlags;
/*
* If the GPE was previously associated with a method and it was
* enabled, it should be enabled at this point to restore the
* post-initialization configuration.
*/
if (((ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) ==
ACPI_GPE_DISPATCH_METHOD) ||
(ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) ==
ACPI_GPE_DISPATCH_NOTIFY)) &&
Handler->OriginallyEnabled)
{
(void) AcpiEvAddGpeReference (GpeEventInfo);
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
/* Make sure all deferred GPE tasks are completed */
AcpiOsWaitEventsComplete ();
/* Now we can free the handler object */
ACPI_FREE (Handler);
return_ACPI_STATUS (Status);
UnlockAndExit:
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
//.........这里部分代码省略.........
开发者ID:ikitayama,项目名称:acpica-tools,代码行数:101,代码来源:evxface.c
示例11: AcpiRemoveGpeHandler
ACPI_STATUS
AcpiRemoveGpeHandler (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
ACPI_EVENT_HANDLER Address)
{
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_HANDLER_INFO *Handler;
ACPI_STATUS Status;
ACPI_CPU_FLAGS Flags;
ACPI_FUNCTION_TRACE (AcpiRemoveGpeHandler);
/* Parameter validation */
if (!Address)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
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;
}
/* Make sure that a handler is indeed installed */
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) != ACPI_GPE_DISPATCH_HANDLER)
{
Status = AE_NOT_EXIST;
goto UnlockAndExit;
}
/* Make sure that the installed handler is the same */
if (GpeEventInfo->Dispatch.Handler->Address != Address)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/* Disable the GPE before removing the handler */
Status = AcpiEvDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
/* Remove the handler */
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
Handler = GpeEventInfo->Dispatch.Handler;
/* Restore Method node (if any), set dispatch flags */
GpeEventInfo->Dispatch.MethodNode = Handler->MethodNode;
GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */
if (Handler->MethodNode)
{
GpeEventInfo->Flags |= ACPI_GPE_DISPATCH_METHOD;
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
/* Now we can free the handler object */
ACPI_FREE (Handler);
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
开发者ID:oza,项目名称:FreeBSD-7.3-dyntick,代码行数:85,代码来源:evxface.c
示例12: AcpiEvGpeDetect
UINT32
AcpiEvGpeDetect (
ACPI_GPE_XRUPT_INFO *GpeXruptList)
{
ACPI_STATUS Status;
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
UINT8 EnabledStatusByte;
UINT32 StatusReg;
UINT32 EnableReg;
ACPI_CPU_FLAGS Flags;
UINT32 i;
UINT32 j;
ACPI_FUNCTION_NAME (EvGpeDetect);
/* Check for the case where there are no GPEs */
if (!GpeXruptList)
{
return (IntStatus);
}
/*
* We need to obtain the GPE lock for both the data structs and registers
* Note: Not necessary to obtain the hardware lock, since the GPE
* registers are owned by the GpeLock.
*/
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Examine all GPE blocks attached to this interrupt level */
GpeBlock = GpeXruptList->GpeBlockListHead;
while (GpeBlock)
{
/*
* Read all of the 8-bit GPE status and enable registers in this GPE
* block, saving all of them. Find all currently active GP events.
*/
for (i = 0; i < GpeBlock->RegisterCount; i++)
{
/* Get the next status/enable pair */
GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
/*
* Optimization: If there are no GPEs enabled within this
* register, we can safely ignore the entire register.
*/
if (!(GpeRegisterInfo->EnableForRun |
GpeRegisterInfo->EnableForWake))
{
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Ignore disabled registers for GPE %02X-%02X: "
"RunEnable=%02X, WakeEnable=%02X\n",
GpeRegisterInfo->BaseGpeNumber,
GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1),
GpeRegisterInfo->EnableForRun,
GpeRegisterInfo->EnableForWake));
continue;
}
/* Read the Status Register */
Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
/* Read the Enable Register */
Status = AcpiHwRead (&EnableReg, &GpeRegisterInfo->EnableAddress);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Read registers for GPE %02X-%02X: Status=%02X, Enable=%02X, "
"RunEnable=%02X, WakeEnable=%02X\n",
GpeRegisterInfo->BaseGpeNumber,
GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1),
StatusReg, EnableReg,
GpeRegisterInfo->EnableForRun,
GpeRegisterInfo->EnableForWake));
/* Check if there is anything active at all in this register */
EnabledStatusByte = (UINT8) (StatusReg & EnableReg);
if (!EnabledStatusByte)
{
/* No active GPEs in this register, move on */
continue;
}
/* Now look at the individual GPEs in this byte register */
//.........这里部分代码省略.........
开发者ID:99corps,项目名称:runtime,代码行数:101,代码来源:evgpe.c
示例13: AcpiSetGpeWakeMask
ACPI_STATUS
AcpiSetGpeWakeMask (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT8 Action)
{
ACPI_STATUS Status = AE_OK;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
ACPI_CPU_FLAGS Flags;
UINT32 RegisterBit;
ACPI_FUNCTION_TRACE (AcpiSetGpeWakeMask);
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/*
* Ensure that we have a valid GPE number and that this GPE is in
* fact a wake GPE
*/
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE))
{
Status = AE_TYPE;
goto UnlockAndExit;
}
GpeRegisterInfo = GpeEventInfo->RegisterInfo;
if (!GpeRegisterInfo)
{
Status = AE_NOT_EXIST;
goto UnlockAndExit;
}
RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
/* Perform the action */
switch (Action)
{
case ACPI_GPE_ENABLE:
ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit);
break;
case ACPI_GPE_DISABLE:
ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit);
break;
default:
ACPI_ERROR ((AE_INFO, "%u, Invalid action", Action));
Status = AE_BAD_PARAMETER;
break;
}
UnlockAndExit:
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return_ACPI_STATUS (Status);
}
开发者ID:matter123,项目名称:mossy,代码行数:69,代码来源:evxfgpe.c
示例14: AcpiEvDeleteGpeBlock
ACPI_STATUS
AcpiEvDeleteGpeBlock (
ACPI_GPE_BLOCK_INFO *GpeBlock)
{
ACPI_STATUS Status;
ACPI_CPU_FLAGS Flags;
ACPI_FUNCTION_TRACE (EvInstallGpeBlock);
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Disable all GPEs in this block */
Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock, NULL);
if (!GpeBlock->Previous && !GpeBlock->Next)
{
/* This is the last GpeBlock on this interrupt */
Status = AcpiEvDeleteGpeXrupt (GpeBlock->XruptBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
}
else
{
/* Remove the block on this interrupt with lock */
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
if (GpeBlock->Previous)
{
GpeBlock->Previous->Next = GpeBlock->Next;
}
else
{
GpeBlock->XruptBlock->GpeBlockListHead = GpeBlock->Next;
}
if (GpeBlock->Next)
{
GpeBlock->Next->Previous = GpeBlock->Previous;
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
}
AcpiCurrentGpeCount -= GpeBlock->GpeCount;
/* Free the GpeBlock */
ACPI_FREE (GpeBlock->RegisterInfo);
ACPI_FREE (GpeBlock->EventInfo);
ACPI_FREE (GpeBlock);
UnlockAndExit:
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
开发者ID:99corps,项目名称:runtime,代码行数:64,代码来源:evgpeblk.c
示例15: AcpiSetupGpeForWake
ACPI_STATUS
AcpiSetupGpeForWake (
ACPI_HANDLE WakeDevice,
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber)
{
ACPI_STATUS Status = AE_BAD_PARAMETER;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_NAMESPACE_NODE *DeviceNode;
ACPI_CPU_FLAGS Flags;
ACPI_FUNCTION_TRACE (AcpiSetupGpeForWake);
/* Parameter Validation */
if (!WakeDevice)
{
/*
* By forcing WakeDevice to be valid, we automatically enable the
* implicit notify feature on all hosts.
*/
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Validate WakeDevice is of type Device */
DeviceNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, WakeDevice);
if (DeviceNode->Type != ACPI_TYPE_DEVICE)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Ensure that we have a valid GPE number */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (GpeEventInfo)
{
/*
* If there is no method or handler for this GPE, then the
* WakeDevice will be notified whenever this GPE fires (aka
* "implicit notify") Note: The GPE is assumed to be
* level-triggered (for windows compatibility).
*/
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_NONE)
{
GpeEventInfo->Flags =
(ACPI_GPE_DISPATCH_NOTIFY | ACPI_GPE_LEVEL_TRIGGERED);
GpeEventInfo->Dispatch.DeviceNode = DeviceNode;
}
GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE;
Status = AE_OK;
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return_ACPI_STATUS (Status);
}
开发者ID:juanfra684,项目名称:DragonFlyBSD,代码行数:62,代码来源:evxfgpe.c
示例16: AcpiDisableGpe
ACPI_STATUS
AcpiDisableGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT8 GpeType)
{
ACPI_STATUS Status = AE_OK;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_CPU_FLAGS Flags;
ACPI_FUNCTION_TRACE (AcpiDisableGpe);
/* Parameter validation */
if (!GpeType || (GpeType & ~ACPI_GPE_TYPE_WAKE_RUN))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Ensure that we have a valid GPE number */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/* Hardware-disable a runtime GPE on removal of the last reference */
if (GpeType & ACPI_GPE_TYPE_RUNTIME)
{
if (!GpeEventInfo->RuntimeCount)
{
Status = AE_LIMIT; /* There are no references to remove */
goto UnlockAndExit;
}
GpeEventInfo->RuntimeCount--;
if (!GpeEventInfo->RuntimeCount)
{
Status = AcpiEvDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
GpeEventInfo->RuntimeCount++;
goto UnlockAndExit;
}
}
}
/*
* Update masks for wake GPE on removal of the last reference.
* No need to hardware-disable wake GPEs here, they are not currently
* enabled.
*/
if (GpeType & ACPI_GPE_TYPE_WAKE)
{
if (!GpeEventInfo->WakeupCount)
{
Status = AE_LIMIT; /* There are no references to remove */
goto UnlockAndExit;
}
GpeEventInfo->WakeupCount--;
if (!GpeEventInfo->WakeupCount)
{
(void) AcpiEvUpdateGpeEnableMasks (GpeEventInfo);
}
}
UnlockAndExit:
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return_ACPI_STATUS (Status);
}
开发者ID:iversonjimmy,项目名称:acer_cloud_wifi_copy,代码行数:79,代码来源:evxfevnt.c
示例17: AcpiEnableGpe
ACPI_STATUS
AcpiEnableGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT8 GpeType)
{
ACPI_STATUS Status = AE_OK;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_CPU_FLAGS Flags;
ACPI_FUNCTION_TRACE (AcpiEnableGpe);
/* Parameter validation */
if (!GpeType || (GpeType & ~ACPI_GPE_TYPE_WAKE_RUN))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Ensure that we have a valid GPE number */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
if (GpeType & ACPI_GPE_TYPE_RUNTIME)
{
if (GpeEventInfo->RuntimeCount == ACPI_UINT8_MAX)
{
Status = AE_LIMIT; /* Too many references */
goto UnlockAndExit;
}
GpeEventInfo->RuntimeCount++;
if (GpeEventInfo->RuntimeCount == 1)
{
Status = AcpiEvEnableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
GpeEventInfo->RuntimeCount--;
goto UnlockAndExit;
}
}
}
if (GpeType & ACPI_GPE_TYPE_WAKE)
{
/* The GPE must have the ability to wake the system */
if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE))
{
Status = AE_TYPE;
goto UnlockAndExit;
}
if (GpeEventInfo->WakeupCount == ACPI_UINT8_MAX)
{
Status = AE_LIMIT; /* Too many references */
goto UnlockAndExit;
}
/*
* Update the enable mask on the first wakeup reference. Wake GPEs
* are only hardware-enabled just before sleeping.
*/
GpeEventInfo->WakeupCount++;
if (GpeEventInfo->WakeupCount == 1)
{
(void) AcpiEvUpdateGpeEnableMasks (GpeEventInfo);
}
}
UnlockAndExit:
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return_ACPI_STATUS (Status);
}
开发者ID:iversonjimmy,项目名称:acer_cloud_wifi_copy,代码行数:83,代码来源:evxfevnt.c
示例18: AcpiEvGpeDetect
UINT32
AcpiEvGpeDetect (
ACPI_GPE_XRUPT_INFO *GpeXruptList)
{
ACPI_STATUS Status;
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_NAMESPACE_NODE *GpeDevice;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
UINT32 GpeNumber;
ACPI_GPE_HANDLER_INFO *GpeHandlerInfo;
UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
UINT8 EnabledStatusByte;
UINT32 StatusReg;
UINT32 EnableReg;
ACPI_CPU_FLAGS Flags;
UINT32 i;
UINT32 j;
ACPI_FUNCTION_NAME (EvGpeDetect);
/* Check for the case where there are no GPEs */
if (!GpeXruptList)
{
return (IntStatus);
}
/*
* We need to obtain the GPE lock for both the data structs and registers
* Note: Not necessary to obtain the hardware lock, since the GPE
* registers are owned by the GpeLock.
*/
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Examine all GPE blocks attached to this interrupt level */
GpeBlock = GpeXruptList->GpeBlockListHead;
while (GpeBlock)
{
GpeDevice = GpeBlock->Node;
/*
* Read all of the 8-bit GPE status and enable registers in this GPE
* block, saving all of them. Find all currently active GP events.
*/
for (i = 0; i < GpeBlock->RegisterCount; i++)
{
/* Get the next status/enable pair */
GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
/*
* Optimization: If there are no GPEs enabled within this
* register, we can safely ignore the entire register.
*/
if (!(GpeRegisterInfo->EnableForRun |
GpeRegisterInfo->EnableForWake))
{
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Ignore disabled registers for GPE %02X-%02X: "
"RunEnable=%02X, WakeEnable=%02X\n",
GpeRegisterInfo->BaseGpeNumber,
GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1),
GpeRegisterInfo->EnableForRun,
GpeRegisterInfo->EnableForWake));
continue;
}
/* Read the Status Register */
Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
/* Read the Enable Register */
Status = AcpiHwRead (&EnableReg, &GpeRegisterInfo->EnableAddress);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Read registers for GPE %02X-%02X: Status=%02X, Enable=%02X, "
"RunEnable=%02X, WakeEnable=%02X\n",
GpeRegisterInfo->BaseGpeNumber,
GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1),
StatusReg, EnableReg,
GpeRegisterInfo->EnableForRun,
GpeRegisterInfo->EnableForWake));
/* Check if there is anything active at all in this register */
EnabledStatusByte = (UINT8) (StatusReg & EnableReg);
if (!EnabledStatusByte)
{
//.........这里部分代码省略.........
开发者ID:AmirAbrams,项目名称:haiku,代码行数:101,代码来源:evgpe.c
示例19: AcpiEvAcquireGlobalLock
ACPI_STATUS
AcpiEvAcquireGlobalLock (
UINT16 Timeout)
{
ACPI_CPU_FLAGS Flags;
ACPI_STATUS Status;
BOOLEAN Acquired = FALSE;
ACPI_FUNCTION_TRACE (EvAcquireGlobalLock);
/*
* Only one thread can acquire the GL at a time, the GlobalLockMutex
* enforces this. This interface releases the interpreter if we must wait.
*/
Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex,
Timeout);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Update the global lock handle and check for wraparound. The handle is
* only used for the external global lock interfaces, but it is updated
* here to properly handle the case where a single thread may acquire the
* lock via both the AML and the AcpiAcquireGlobalLock interfaces. The
* handle is therefore updated on the first acquire from a given thread
* regardless of where the acquisition request originated.
*/
AcpiGbl_GlobalLockHandle++;
if (AcpiGbl_GlobalLockHandle == 0)
{
AcpiGbl_GlobalLockHandle = 1;
}
/*
* Make sure that a global lock actually exists. If not, just
* treat the lock as a standard mutex.
*/
if (!AcpiGbl_GlobalLockPresent)
{
AcpiGbl_GlobalLockAcquired = TRUE;
return_ACPI_STATUS (AE_OK);
}
Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock);
do
{
/* Attempt to acquire the actual hardware lock */
ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired);
if (Acquired)
{
AcpiGbl_GlobalLockAcquired = TRUE;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Acquired hardware Global Lock\n"));
break;
}
/*
* Did not get the lock. The pending bit was set above, and
* we must now wait until we receive the global lock
* released interrupt.
*/
AcpiGbl_GlobalLockPending = TRUE;
AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Waiting for hardware Global Lock\n"));
/*
* Wait for handshake with the global lock interrupt handler.
* This interface releases the interpreter if we must wait.
*/
Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore,
ACPI_WAIT_FOREVER);
Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock);
} while (ACPI_SUCCESS (Status));
AcpiGbl_GlobalLockPending = FALSE;
AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags);
return_ACPI_STATUS (Status);
}
开发者ID:ppaeps,项目名称:freebsd-head,代码行数:89,代码来源:evglock.c
示例20: AcpiSetupGpeForWake
ACPI_STATUS
AcpiSetupGpeForWake (
ACPI_HANDLE WakeDevice,
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber)
{
ACPI_STATUS Status;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_NAMESPACE_NODE *DeviceNode;
ACPI_GPE_NOTIFY_INFO *Notify;
ACPI_GPE_NOTIFY_INFO *NewNotify;
ACPI_CPU_FLAGS Flags;
ACPI_FUNCTION_TRACE (AcpiSetupGpeForWake);
/* Parameter Validation */
if (!WakeDevice)
{
/*
* By forcing WakeDevice to be valid, we automatically enable the
* implicit notify feature on all hosts.
*/
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Handle root object case */
if (WakeDevice == ACPI_ROOT_OBJECT)
{
DeviceNode = AcpiGbl_RootNode;
}
else
{
DeviceNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, WakeDevice);
}
/* Validate WakeDevice is of type Device */
if (DeviceNode->Type != ACPI_TYPE_DEVICE)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* Allocate a new notify object up front, in case it is n
|
请发表评论