]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h
2 Declaration of internal functions in BaseSynchronizationLib.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef __BASE_SYNCHRONIZATION_LIB_INTERNALS__
10 #define __BASE_SYNCHRONIZATION_LIB_INTERNALS__
13 #include <Library/SynchronizationLib.h>
14 #include <Library/BaseLib.h>
15 #include <Library/DebugLib.h>
16 #include <Library/TimerLib.h>
17 #include <Library/PcdLib.h>
20 Performs an atomic increment of an 32-bit unsigned integer.
22 Performs an atomic increment of the 32-bit unsigned integer specified by
23 Value and returns the incremented value. The increment operation must be
24 performed using MP safe mechanisms.
26 @param Value A pointer to the 32-bit value to increment.
28 @return The incremented value.
33 InternalSyncIncrement (
34 IN
volatile UINT32
*Value
39 Performs an atomic decrement of an 32-bit unsigned integer.
41 Performs an atomic decrement of the 32-bit unsigned integer specified by
42 Value and returns the decrement value. The decrement operation must be
43 performed using MP safe mechanisms.
45 @param Value A pointer to the 32-bit value to decrement.
47 @return The decrement value.
52 InternalSyncDecrement (
53 IN
volatile UINT32
*Value
58 Performs an atomic compare exchange operation on a 16-bit unsigned integer.
60 Performs an atomic compare exchange operation on the 16-bit unsigned integer
61 specified by Value. If Value is equal to CompareValue, then Value is set to
62 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
63 then Value is returned. The compare exchange operation must be performed using
66 @param Value A pointer to the 16-bit value for the compare exchange
68 @param CompareValue A 16-bit value used in compare operation.
69 @param ExchangeValue A 16-bit value used in exchange operation.
71 @return The original *Value before exchange.
76 InternalSyncCompareExchange16 (
77 IN
volatile UINT16
*Value
,
78 IN UINT16 CompareValue
,
79 IN UINT16 ExchangeValue
84 Performs an atomic compare exchange operation on a 32-bit unsigned integer.
86 Performs an atomic compare exchange operation on the 32-bit unsigned integer
87 specified by Value. If Value is equal to CompareValue, then Value is set to
88 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
89 then Value is returned. The compare exchange operation must be performed using
92 @param Value A pointer to the 32-bit value for the compare exchange
94 @param CompareValue A 32-bit value used in compare operation.
95 @param ExchangeValue A 32-bit value used in exchange operation.
97 @return The original *Value before exchange.
102 InternalSyncCompareExchange32 (
103 IN
volatile UINT32
*Value
,
104 IN UINT32 CompareValue
,
105 IN UINT32 ExchangeValue
110 Performs an atomic compare exchange operation on a 64-bit unsigned integer.
112 Performs an atomic compare exchange operation on the 64-bit unsigned integer specified
113 by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and
114 CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.
115 The compare exchange operation must be performed using MP safe mechanisms.
117 @param Value A pointer to the 64-bit value for the compare exchange
119 @param CompareValue A 64-bit value used in compare operation.
120 @param ExchangeValue A 64-bit value used in exchange operation.
122 @return The original *Value before exchange.
127 InternalSyncCompareExchange64 (
128 IN
volatile UINT64
*Value
,
129 IN UINT64 CompareValue
,
130 IN UINT64 ExchangeValue
134 Internal function to retrieve the architecture specific spin lock alignment
135 requirements for optimal spin lock performance.
137 @return The architecture specific spin lock alignment.
141 InternalGetSpinLockProperties (