X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FInclude%2FLibrary%2FSynchronizationLib.h;h=6cf3d71770e7e6fcd4f027ed4fb49a2f0ef6c2a4;hb=d8af3301a648df3b4eea6933a46f56f1853367d6;hp=63bc72b1a74fe87eb9fd61f0ac0948ae4a84ee6f;hpb=1a2f870c9babe077c2d3abea23b6e8e044778341;p=mirror_edk2.git diff --git a/MdePkg/Include/Library/SynchronizationLib.h b/MdePkg/Include/Library/SynchronizationLib.h index 63bc72b1a7..6cf3d71770 100644 --- a/MdePkg/Include/Library/SynchronizationLib.h +++ b/MdePkg/Include/Library/SynchronizationLib.h @@ -1,8 +1,8 @@ /** @file Provides synchronization functions. -Copyright (c) 2006 - 2008, Intel Corporation
-All rights reserved. This program and the accompanying materials +Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -26,8 +26,8 @@ typedef volatile UINTN SPIN_LOCK; optimal spin lock performance. This function retrieves the spin lock alignment requirements for optimal - performance on a given CPU architecture. The spin lock alignment must be a - power of two and is returned by this function. If there are no alignment + performance on a given CPU architecture. The spin lock alignment is byte alignment. + It must be a power of two and is returned by this function. If there are no alignment requirements, then 1 must be returned. The spin lock synchronization functions must function correctly if the spin lock size and alignment values returned by this function are not used at all. These values are hints to the @@ -157,7 +157,7 @@ ReleaseSpinLock ( UINT32 EFIAPI InterlockedIncrement ( - IN UINT32 *Value + IN volatile UINT32 *Value ); @@ -179,10 +179,36 @@ InterlockedIncrement ( UINT32 EFIAPI InterlockedDecrement ( - IN UINT32 *Value + IN volatile UINT32 *Value ); +/** + Performs an atomic compare exchange operation on a 16-bit unsigned integer. + + Performs an atomic compare exchange operation on the 16-bit unsigned integer + specified by Value. If Value is equal to CompareValue, then Value is set to + ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, + then Value is returned. The compare exchange operation must be performed using + MP safe mechanisms. + + If Value is NULL, then ASSERT(). + + @param Value A pointer to the 16-bit value for the compare exchange + operation. + @param CompareValue 16-bit value used in compare operation. + @param ExchangeValue 16-bit value used in exchange operation. + + @return The original *Value before exchange. +**/ +UINT16 +EFIAPI +InterlockedCompareExchange16 ( + IN OUT volatile UINT16 *Value, + IN UINT16 CompareValue, + IN UINT16 ExchangeValue + ); + /** Performs an atomic compare exchange operation on a 32-bit unsigned integer. @@ -205,7 +231,7 @@ InterlockedDecrement ( UINT32 EFIAPI InterlockedCompareExchange32 ( - IN OUT UINT32 *Value, + IN OUT volatile UINT32 *Value, IN UINT32 CompareValue, IN UINT32 ExchangeValue ); @@ -232,7 +258,7 @@ InterlockedCompareExchange32 ( UINT64 EFIAPI InterlockedCompareExchange64 ( - IN OUT UINT64 *Value, + IN OUT volatile UINT64 *Value, IN UINT64 CompareValue, IN UINT64 ExchangeValue ); @@ -259,7 +285,7 @@ InterlockedCompareExchange64 ( VOID * EFIAPI InterlockedCompareExchangePointer ( - IN OUT VOID **Value, + IN OUT VOID * volatile *Value, IN VOID *CompareValue, IN VOID *ExchangeValue );