]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h
Maintainers.txt: Update email address
[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
2f88bd3a 34 IN volatile UINT32 *Value\r
720d3c5f 35 );\r
36\r
720d3c5f 37/**\r
38 Performs an atomic decrement of an 32-bit unsigned integer.\r
39\r
40 Performs an atomic decrement of the 32-bit unsigned integer specified by\r
41 Value and returns the decrement value. The decrement operation must be\r
17634d02 42 performed using MP safe mechanisms.\r
720d3c5f 43\r
44 @param Value A pointer to the 32-bit value to decrement.\r
45\r
46 @return The decrement value.\r
47\r
48**/\r
49UINT32\r
50EFIAPI\r
51InternalSyncDecrement (\r
2f88bd3a 52 IN volatile UINT32 *Value\r
720d3c5f 53 );\r
54\r
9b89163e
AB
55/**\r
56 Performs an atomic compare exchange operation on a 16-bit unsigned integer.\r
57\r
58 Performs an atomic compare exchange operation on the 16-bit unsigned integer\r
59 specified by Value. If Value is equal to CompareValue, then Value is set to\r
60 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,\r
61 then Value is returned. The compare exchange operation must be performed using\r
62 MP safe mechanisms.\r
63\r
64 @param Value A pointer to the 16-bit value for the compare exchange\r
65 operation.\r
66 @param CompareValue A 16-bit value used in compare operation.\r
67 @param ExchangeValue A 16-bit value used in exchange operation.\r
68\r
69 @return The original *Value before exchange.\r
70\r
71**/\r
72UINT16\r
73EFIAPI\r
74InternalSyncCompareExchange16 (\r
2f88bd3a
MK
75 IN volatile UINT16 *Value,\r
76 IN UINT16 CompareValue,\r
77 IN UINT16 ExchangeValue\r
9b89163e
AB
78 );\r
79\r
720d3c5f 80/**\r
81 Performs an atomic compare exchange operation on a 32-bit unsigned integer.\r
82\r
83 Performs an atomic compare exchange operation on the 32-bit unsigned integer\r
84 specified by Value. If Value is equal to CompareValue, then Value is set to\r
85 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,\r
86 then Value is returned. The compare exchange operation must be performed using\r
87 MP safe mechanisms.\r
88\r
89 @param Value A pointer to the 32-bit value for the compare exchange\r
90 operation.\r
2fc59a00 91 @param CompareValue A 32-bit value used in compare operation.\r
92 @param ExchangeValue A 32-bit value used in exchange operation.\r
720d3c5f 93\r
94 @return The original *Value before exchange.\r
95\r
96**/\r
97UINT32\r
98EFIAPI\r
99InternalSyncCompareExchange32 (\r
2f88bd3a
MK
100 IN volatile UINT32 *Value,\r
101 IN UINT32 CompareValue,\r
102 IN UINT32 ExchangeValue\r
720d3c5f 103 );\r
104\r
720d3c5f 105/**\r
106 Performs an atomic compare exchange operation on a 64-bit unsigned integer.\r
107\r
108 Performs an atomic compare exchange operation on the 64-bit unsigned integer specified\r
109 by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and\r
110 CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.\r
111 The compare exchange operation must be performed using MP safe mechanisms.\r
112\r
113 @param Value A pointer to the 64-bit value for the compare exchange\r
114 operation.\r
2fc59a00 115 @param CompareValue A 64-bit value used in compare operation.\r
116 @param ExchangeValue A 64-bit value used in exchange operation.\r
720d3c5f 117\r
118 @return The original *Value before exchange.\r
119\r
120**/\r
121UINT64\r
122EFIAPI\r
123InternalSyncCompareExchange64 (\r
2f88bd3a
MK
124 IN volatile UINT64 *Value,\r
125 IN UINT64 CompareValue,\r
126 IN UINT64 ExchangeValue\r
720d3c5f 127 );\r
128\r
5f0a17d8
JF
129/**\r
130 Internal function to retrieve the architecture specific spin lock alignment\r
131 requirements for optimal spin lock performance.\r
132\r
133 @return The architecture specific spin lock alignment.\r
9095d37b 134\r
5f0a17d8
JF
135**/\r
136UINTN\r
137InternalGetSpinLockProperties (\r
138 VOID\r
139 );\r
140\r
720d3c5f 141#endif\r