15#define _ReadWriteBarrier() do { __asm__ __volatile__ ("": : : "memory"); } while(0)
17#define SPIN_LOCK_RELEASED ((UINTN) 1)
18#define SPIN_LOCK_ACQUIRED ((UINTN) 2)
67 ASSERT (SpinLock !=
NULL);
70 *SpinLock = SPIN_LOCK_RELEASED;
111 if (
PcdGet32 (PcdSpinLockTimeout) == 0) {
150 Delta = (INT64)(Current - Previous);
160 ASSERT (Total < Timeout);
193 ASSERT (SpinLock !=
NULL);
195 LockValue = *SpinLock;
196 ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED);
198 _ReadWriteBarrier ();
201 (VOID *)SPIN_LOCK_RELEASED,
202 (VOID *)SPIN_LOCK_ACQUIRED
205 _ReadWriteBarrier ();
206 return (BOOLEAN)(Result == (VOID *)SPIN_LOCK_RELEASED);
231 ASSERT (SpinLock !=
NULL);
233 LockValue = *SpinLock;
234 ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED);
236 _ReadWriteBarrier ();
237 *SpinLock = SPIN_LOCK_RELEASED;
238 _ReadWriteBarrier ();
260 IN volatile UINT32 *Value
263 ASSERT (Value !=
NULL);
284 IN volatile UINT32 *Value
287 ASSERT (Value !=
NULL);
313 IN OUT volatile UINT16 *Value,
314 IN UINT16 CompareValue,
315 IN UINT16 ExchangeValue
318 ASSERT (Value !=
NULL);
344 IN OUT volatile UINT32 *Value,
345 IN UINT32 CompareValue,
346 IN UINT32 ExchangeValue
349 ASSERT (Value !=
NULL);
374 IN OUT volatile UINT64 *Value,
375 IN UINT64 CompareValue,
376 IN UINT64 ExchangeValue
379 ASSERT (Value !=
NULL);
404 IN OUT VOID *
volatile *Value,
405 IN VOID *CompareValue,
406 IN VOID *ExchangeValue
411 SizeOfValue =
sizeof (*Value);
413 switch (SizeOfValue) {
414 case sizeof (UINT32):
416 (
volatile UINT32 *)Value,
417 (UINT32)(
UINTN)CompareValue,
418 (UINT32)(
UINTN)ExchangeValue
420 case sizeof (UINT64):
422 (
volatile UINT64 *)Value,
423 (UINT64)(
UINTN)CompareValue,
424 (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)
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)