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