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