]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseSynchronizationLib / BaseSynchronizationLibInternals.h
CommitLineData
720d3c5f 1/** @file\r
65330ad3 2 Declaration of internal functions in BaseSynchronizationLib.\r
720d3c5f 3\r
9095d37b 4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
720d3c5f 6\r
7**/\r
8\r
65330ad3 9#ifndef __BASE_SYNCHRONIZATION_LIB_INTERNALS__\r
10#define __BASE_SYNCHRONIZATION_LIB_INTERNALS__\r
720d3c5f 11\r
12#include <Base.h>\r
13#include <Library/SynchronizationLib.h>\r
14#include <Library/BaseLib.h>\r
15#include <Library/DebugLib.h>\r
16#include <Library/TimerLib.h>\r
17#include <Library/PcdLib.h>\r
18\r
19/**\r
20 Performs an atomic increment of an 32-bit unsigned integer.\r
21\r
22 Performs an atomic increment of the 32-bit unsigned integer specified by\r
23 Value and returns the incremented value. The increment operation must be\r
17634d02 24 performed using MP safe mechanisms.\r
720d3c5f 25\r
26 @param Value A pointer to the 32-bit value to increment.\r
27\r
28 @return The incremented value.\r
29\r
30**/\r
31UINT32\r
32EFIAPI\r
33InternalSyncIncrement (\r
34 IN volatile UINT32 *Value\r
35 );\r
36\r
37\r
38/**\r
39 Performs an atomic decrement of an 32-bit unsigned integer.\r
40\r
41 Performs an atomic decrement of the 32-bit unsigned integer specified by\r
42 Value and returns the decrement value. The decrement operation must be\r
17634d02 43 performed using MP safe mechanisms.\r
720d3c5f 44\r
45 @param Value A pointer to the 32-bit value to decrement.\r
46\r
47 @return The decrement value.\r
48\r
49**/\r
50UINT32\r
51EFIAPI\r
52InternalSyncDecrement (\r
53 IN volatile UINT32 *Value\r
54 );\r
55\r
56\r
9b89163e
AB
57/**\r
58 Performs an atomic compare exchange operation on a 16-bit unsigned integer.\r
59\r
60 Performs an atomic compare exchange operation on the 16-bit unsigned integer\r
61 specified by Value. If Value is equal to CompareValue, then Value is set to\r
62 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,\r
63 then Value is returned. The compare exchange operation must be performed using\r
64 MP safe mechanisms.\r
65\r
66 @param Value A pointer to the 16-bit value for the compare exchange\r
67 operation.\r
68 @param CompareValue A 16-bit value used in compare operation.\r
69 @param ExchangeValue A 16-bit value used in exchange operation.\r
70\r
71 @return The original *Value before exchange.\r
72\r
73**/\r
74UINT16\r
75EFIAPI\r
76InternalSyncCompareExchange16 (\r
77 IN volatile UINT16 *Value,\r
78 IN UINT16 CompareValue,\r
79 IN UINT16 ExchangeValue\r
80 );\r
81\r
82\r
720d3c5f 83/**\r
84 Performs an atomic compare exchange operation on a 32-bit unsigned integer.\r
85\r
86 Performs an atomic compare exchange operation on the 32-bit unsigned integer\r
87 specified by Value. If Value is equal to CompareValue, then Value is set to\r
88 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,\r
89 then Value is returned. The compare exchange operation must be performed using\r
90 MP safe mechanisms.\r
91\r
92 @param Value A pointer to the 32-bit value for the compare exchange\r
93 operation.\r
2fc59a00 94 @param CompareValue A 32-bit value used in compare operation.\r
95 @param ExchangeValue A 32-bit value used in exchange operation.\r
720d3c5f 96\r
97 @return The original *Value before exchange.\r
98\r
99**/\r
100UINT32\r
101EFIAPI\r
102InternalSyncCompareExchange32 (\r
103 IN volatile UINT32 *Value,\r
104 IN UINT32 CompareValue,\r
105 IN UINT32 ExchangeValue\r
106 );\r
107\r
108\r
109/**\r
110 Performs an atomic compare exchange operation on a 64-bit unsigned integer.\r
111\r
112 Performs an atomic compare exchange operation on the 64-bit unsigned integer specified\r
113 by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and\r
114 CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.\r
115 The compare exchange operation must be performed using MP safe mechanisms.\r
116\r
117 @param Value A pointer to the 64-bit value for the compare exchange\r
118 operation.\r
2fc59a00 119 @param CompareValue A 64-bit value used in compare operation.\r
120 @param ExchangeValue A 64-bit value used in exchange operation.\r
720d3c5f 121\r
122 @return The original *Value before exchange.\r
123\r
124**/\r
125UINT64\r
126EFIAPI\r
127InternalSyncCompareExchange64 (\r
128 IN volatile UINT64 *Value,\r
129 IN UINT64 CompareValue,\r
130 IN UINT64 ExchangeValue\r
131 );\r
132\r
5f0a17d8
JF
133/**\r
134 Internal function to retrieve the architecture specific spin lock alignment\r
135 requirements for optimal spin lock performance.\r
136\r
137 @return The architecture specific spin lock alignment.\r
9095d37b 138\r
5f0a17d8
JF
139**/\r
140UINTN\r
141InternalGetSpinLockProperties (\r
142 VOID\r
143 );\r
144\r
720d3c5f 145#endif\r