]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h
MdePkg/BaseLib: Introduce CharToUpper and AsciiCharToUpper publicly
[mirror_edk2.git] / MdePkg / Library / BaseSynchronizationLib / BaseSynchronizationLibInternals.h
1 /** @file
2 Declaration of internal functions in BaseSynchronizationLib.
3
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef __BASE_SYNCHRONIZATION_LIB_INTERNALS__
16 #define __BASE_SYNCHRONIZATION_LIB_INTERNALS__
17
18 #include <Base.h>
19 #include <Library/SynchronizationLib.h>
20 #include <Library/BaseLib.h>
21 #include <Library/DebugLib.h>
22 #include <Library/TimerLib.h>
23 #include <Library/PcdLib.h>
24
25 /**
26 Performs an atomic increment of an 32-bit unsigned integer.
27
28 Performs an atomic increment of the 32-bit unsigned integer specified by
29 Value and returns the incremented value. The increment operation must be
30 performed using MP safe mechanisms.
31
32 @param Value A pointer to the 32-bit value to increment.
33
34 @return The incremented value.
35
36 **/
37 UINT32
38 EFIAPI
39 InternalSyncIncrement (
40 IN volatile UINT32 *Value
41 );
42
43
44 /**
45 Performs an atomic decrement of an 32-bit unsigned integer.
46
47 Performs an atomic decrement of the 32-bit unsigned integer specified by
48 Value and returns the decrement value. The decrement operation must be
49 performed using MP safe mechanisms.
50
51 @param Value A pointer to the 32-bit value to decrement.
52
53 @return The decrement value.
54
55 **/
56 UINT32
57 EFIAPI
58 InternalSyncDecrement (
59 IN volatile UINT32 *Value
60 );
61
62
63 /**
64 Performs an atomic compare exchange operation on a 16-bit unsigned integer.
65
66 Performs an atomic compare exchange operation on the 16-bit unsigned integer
67 specified by Value. If Value is equal to CompareValue, then Value is set to
68 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
69 then Value is returned. The compare exchange operation must be performed using
70 MP safe mechanisms.
71
72 @param Value A pointer to the 16-bit value for the compare exchange
73 operation.
74 @param CompareValue A 16-bit value used in compare operation.
75 @param ExchangeValue A 16-bit value used in exchange operation.
76
77 @return The original *Value before exchange.
78
79 **/
80 UINT16
81 EFIAPI
82 InternalSyncCompareExchange16 (
83 IN volatile UINT16 *Value,
84 IN UINT16 CompareValue,
85 IN UINT16 ExchangeValue
86 );
87
88
89 /**
90 Performs an atomic compare exchange operation on a 32-bit unsigned integer.
91
92 Performs an atomic compare exchange operation on the 32-bit unsigned integer
93 specified by Value. If Value is equal to CompareValue, then Value is set to
94 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
95 then Value is returned. The compare exchange operation must be performed using
96 MP safe mechanisms.
97
98 @param Value A pointer to the 32-bit value for the compare exchange
99 operation.
100 @param CompareValue A 32-bit value used in compare operation.
101 @param ExchangeValue A 32-bit value used in exchange operation.
102
103 @return The original *Value before exchange.
104
105 **/
106 UINT32
107 EFIAPI
108 InternalSyncCompareExchange32 (
109 IN volatile UINT32 *Value,
110 IN UINT32 CompareValue,
111 IN UINT32 ExchangeValue
112 );
113
114
115 /**
116 Performs an atomic compare exchange operation on a 64-bit unsigned integer.
117
118 Performs an atomic compare exchange operation on the 64-bit unsigned integer specified
119 by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and
120 CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.
121 The compare exchange operation must be performed using MP safe mechanisms.
122
123 @param Value A pointer to the 64-bit value for the compare exchange
124 operation.
125 @param CompareValue A 64-bit value used in compare operation.
126 @param ExchangeValue A 64-bit value used in exchange operation.
127
128 @return The original *Value before exchange.
129
130 **/
131 UINT64
132 EFIAPI
133 InternalSyncCompareExchange64 (
134 IN volatile UINT64 *Value,
135 IN UINT64 CompareValue,
136 IN UINT64 ExchangeValue
137 );
138
139 /**
140 Internal function to retrieve the architecture specific spin lock alignment
141 requirements for optimal spin lock performance.
142
143 @return The architecture specific spin lock alignment.
144
145 **/
146 UINTN
147 InternalGetSpinLockProperties (
148 VOID
149 );
150
151 #endif