20#pragma intrinsic(_ReadWriteBarrier)
22#define SPIN_LOCK_RELEASED ((UINTN) 1)
23#define SPIN_LOCK_ACQUIRED ((UINTN) 2)
72 ASSERT (SpinLock !=
NULL);
75 *SpinLock = SPIN_LOCK_RELEASED;
116 if (
PcdGet32 (PcdSpinLockTimeout) == 0) {
155 Delta = (INT64)(Current - Previous);
165 ASSERT (Total < Timeout);
198 ASSERT (SpinLock !=
NULL);
200 LockValue = *SpinLock;
201 ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED);
206 (VOID *)SPIN_LOCK_RELEASED,
207 (VOID *)SPIN_LOCK_ACQUIRED
211 return (BOOLEAN)(Result == (VOID *)SPIN_LOCK_RELEASED);
236 ASSERT (SpinLock !=
NULL);
238 LockValue = *SpinLock;
239 ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED);
242 *SpinLock = SPIN_LOCK_RELEASED;
265 IN volatile UINT32 *Value
268 ASSERT (Value !=
NULL);
289 IN volatile UINT32 *Value
292 ASSERT (Value !=
NULL);
318 IN OUT volatile UINT16 *Value,
319 IN UINT16 CompareValue,
320 IN UINT16 ExchangeValue
323 ASSERT (Value !=
NULL);
349 IN OUT volatile UINT32 *Value,
350 IN UINT32 CompareValue,
351 IN UINT32 ExchangeValue
354 ASSERT (Value !=
NULL);
379 IN OUT volatile UINT64 *Value,
380 IN UINT64 CompareValue,
381 IN UINT64 ExchangeValue
384 ASSERT (Value !=
NULL);
409 IN OUT VOID *
volatile *Value,
410 IN VOID *CompareValue,
411 IN VOID *ExchangeValue
416 SizeOfValue = (UINT8)
sizeof (*Value);
418 switch (SizeOfValue) {
419 case sizeof (UINT32):
421 (
volatile UINT32 *)Value,
422 (UINT32)(
UINTN)CompareValue,
423 (UINT32)(
UINTN)ExchangeValue
425 case sizeof (UINT64):
427 (
volatile UINT64 *)Value,
428 (UINT64)(
UINTN)CompareValue,
429 (UINT64)(
UINTN)ExchangeValue
UINT64 EFIAPI GetPerformanceCounterProperties(OUT UINT64 *StartValue OPTIONAL, OUT UINT64 *EndValue OPTIONAL)
UINT64 EFIAPI GetPerformanceCounter(VOID)
UINT64 EFIAPI DivU64x32(IN UINT64 Dividend, IN UINT32 Divisor)
VOID EFIAPI CpuPause(VOID)
UINT64 EFIAPI MultU64x32(IN UINT64 Multiplicand, IN UINT32 Multiplier)
UINTN InternalGetSpinLockProperties(VOID)
UINT32 EFIAPI InternalSyncDecrement(IN volatile UINT32 *Value)
UINT32 EFIAPI InternalSyncIncrement(IN volatile UINT32 *Value)
UINT64 EFIAPI InternalSyncCompareExchange64(IN volatile UINT64 *Value, IN UINT64 CompareValue, IN UINT64 ExchangeValue)
UINT32 EFIAPI InternalSyncCompareExchange32(IN volatile UINT32 *Value, IN UINT32 CompareValue, IN UINT32 ExchangeValue)
UINT16 EFIAPI InternalSyncCompareExchange16(IN volatile UINT16 *Value, IN UINT16 CompareValue, IN UINT16 ExchangeValue)
#define PcdGet32(TokenName)
UINT32 EFIAPI InterlockedIncrement(IN volatile UINT32 *Value)
VOID *EFIAPI InterlockedCompareExchangePointer(IN OUT VOID *volatile *Value, IN VOID *CompareValue, IN VOID *ExchangeValue)
void _ReadWriteBarrier(void)
SPIN_LOCK *EFIAPI AcquireSpinLock(IN OUT SPIN_LOCK *SpinLock)
UINTN EFIAPI GetSpinLockProperties(VOID)
UINT32 EFIAPI InterlockedCompareExchange32(IN OUT volatile UINT32 *Value, IN UINT32 CompareValue, IN UINT32 ExchangeValue)
UINT16 EFIAPI InterlockedCompareExchange16(IN OUT volatile UINT16 *Value, IN UINT16 CompareValue, IN UINT16 ExchangeValue)
UINT32 EFIAPI InterlockedDecrement(IN volatile UINT32 *Value)
SPIN_LOCK *EFIAPI InitializeSpinLock(OUT SPIN_LOCK *SpinLock)
SPIN_LOCK *EFIAPI ReleaseSpinLock(IN OUT SPIN_LOCK *SpinLock)
BOOLEAN EFIAPI AcquireSpinLockOrFail(IN OUT SPIN_LOCK *SpinLock)
UINT64 EFIAPI InterlockedCompareExchange64(IN OUT volatile UINT64 *Value, IN UINT64 CompareValue, IN UINT64 ExchangeValue)