]>
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
38 Performs an atomic decrement of an 32-bit unsigned integer.
40 Performs an atomic decrement of the 32-bit unsigned integer specified by
41 Value and returns the decrement value. The decrement operation must be
42 performed using MP safe mechanisms.
44 @param Value A pointer to the 32-bit value to decrement.
46 @return The decrement value.
51 InternalSyncDecrement (
52 IN
volatile UINT32
*Value
56 Performs an atomic compare exchange operation on a 16-bit unsigned integer.
58 Performs an atomic compare exchange operation on the 16-bit unsigned integer
59 specified by Value. If Value is equal to CompareValue, then Value is set to
60 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
61 then Value is returned. The compare exchange operation must be performed using
64 @param Value A pointer to the 16-bit value for the compare exchange
66 @param CompareValue A 16-bit value used in compare operation.
67 @param ExchangeValue A 16-bit value used in exchange operation.
69 @return The original *Value before exchange.
74 InternalSyncCompareExchange16 (
75 IN
volatile UINT16
*Value
,
76 IN UINT16 CompareValue
,
77 IN UINT16 ExchangeValue
81 Performs an atomic compare exchange operation on a 32-bit unsigned integer.
83 Performs an atomic compare exchange operation on the 32-bit unsigned integer
84 specified by Value. If Value is equal to CompareValue, then Value is set to
85 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
86 then Value is returned. The compare exchange operation must be performed using
89 @param Value A pointer to the 32-bit value for the compare exchange
91 @param CompareValue A 32-bit value used in compare operation.
92 @param ExchangeValue A 32-bit value used in exchange operation.
94 @return The original *Value before exchange.
99 InternalSyncCompareExchange32 (
100 IN
volatile UINT32
*Value
,
101 IN UINT32 CompareValue
,
102 IN UINT32 ExchangeValue
106 Performs an atomic compare exchange operation on a 64-bit unsigned integer.
108 Performs an atomic compare exchange operation on the 64-bit unsigned integer specified
109 by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and
110 CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.
111 The compare exchange operation must be performed using MP safe mechanisms.
113 @param Value A pointer to the 64-bit value for the compare exchange
115 @param CompareValue A 64-bit value used in compare operation.
116 @param ExchangeValue A 64-bit value used in exchange operation.
118 @return The original *Value before exchange.
123 InternalSyncCompareExchange64 (
124 IN
volatile UINT64
*Value
,
125 IN UINT64 CompareValue
,
126 IN UINT64 ExchangeValue
130 Internal function to retrieve the architecture specific spin lock alignment
131 requirements for optimal spin lock performance.
133 @return The architecture specific spin lock alignment.
137 InternalGetSpinLockProperties (