Vishal Bhoj | 82c8071 | 2015-12-15 21:13:33 +0530 | [diff] [blame^] | 1 | /** @file
|
| 2 | Declaration of internal functions in BaseSynchronizationLib.
|
| 3 |
|
| 4 | Copyright (c) 2006 - 2010, 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. The state of the return value is not
|
| 31 | guaranteed to be MP safe.
|
| 32 |
|
| 33 | @param Value A pointer to the 32-bit value to increment.
|
| 34 |
|
| 35 | @return The incremented value.
|
| 36 |
|
| 37 | **/
|
| 38 | UINT32
|
| 39 | EFIAPI
|
| 40 | InternalSyncIncrement (
|
| 41 | IN volatile UINT32 *Value
|
| 42 | );
|
| 43 |
|
| 44 |
|
| 45 | /**
|
| 46 | Performs an atomic decrement of an 32-bit unsigned integer.
|
| 47 |
|
| 48 | Performs an atomic decrement of the 32-bit unsigned integer specified by
|
| 49 | Value and returns the decrement value. The decrement operation must be
|
| 50 | performed using MP safe mechanisms. The state of the return value is not
|
| 51 | guaranteed to be MP safe.
|
| 52 |
|
| 53 | @param Value A pointer to the 32-bit value to decrement.
|
| 54 |
|
| 55 | @return The decrement value.
|
| 56 |
|
| 57 | **/
|
| 58 | UINT32
|
| 59 | EFIAPI
|
| 60 | InternalSyncDecrement (
|
| 61 | IN volatile UINT32 *Value
|
| 62 | );
|
| 63 |
|
| 64 |
|
| 65 | /**
|
| 66 | Performs an atomic compare exchange operation on a 32-bit unsigned integer.
|
| 67 |
|
| 68 | Performs an atomic compare exchange operation on the 32-bit unsigned integer
|
| 69 | specified by Value. If Value is equal to CompareValue, then Value is set to
|
| 70 | ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
|
| 71 | then Value is returned. The compare exchange operation must be performed using
|
| 72 | MP safe mechanisms.
|
| 73 |
|
| 74 | @param Value A pointer to the 32-bit value for the compare exchange
|
| 75 | operation.
|
| 76 | @param CompareValue A 32-bit value used in compare operation.
|
| 77 | @param ExchangeValue A 32-bit value used in exchange operation.
|
| 78 |
|
| 79 | @return The original *Value before exchange.
|
| 80 |
|
| 81 | **/
|
| 82 | UINT32
|
| 83 | EFIAPI
|
| 84 | InternalSyncCompareExchange32 (
|
| 85 | IN volatile UINT32 *Value,
|
| 86 | IN UINT32 CompareValue,
|
| 87 | IN UINT32 ExchangeValue
|
| 88 | );
|
| 89 |
|
| 90 |
|
| 91 | /**
|
| 92 | Performs an atomic compare exchange operation on a 64-bit unsigned integer.
|
| 93 |
|
| 94 | Performs an atomic compare exchange operation on the 64-bit unsigned integer specified
|
| 95 | by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and
|
| 96 | CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.
|
| 97 | The compare exchange operation must be performed using MP safe mechanisms.
|
| 98 |
|
| 99 | @param Value A pointer to the 64-bit value for the compare exchange
|
| 100 | operation.
|
| 101 | @param CompareValue A 64-bit value used in compare operation.
|
| 102 | @param ExchangeValue A 64-bit value used in exchange operation.
|
| 103 |
|
| 104 | @return The original *Value before exchange.
|
| 105 |
|
| 106 | **/
|
| 107 | UINT64
|
| 108 | EFIAPI
|
| 109 | InternalSyncCompareExchange64 (
|
| 110 | IN volatile UINT64 *Value,
|
| 111 | IN UINT64 CompareValue,
|
| 112 | IN UINT64 ExchangeValue
|
| 113 | );
|
| 114 |
|
| 115 | #endif
|