]>
git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/Dxe/Library/Library.c
2 DXE Core library services.
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
16 Initialize a basic mutual exclusion lock. Each lock
17 provides mutual exclusion access at it's task priority
18 level. Since there is no-premption (at any TPL) or
19 multiprocessor support, acquiring the lock only consists
20 of raising to the locks TPL.
22 @param Lock The EFI_LOCK structure to initialize
24 @retval EFI_SUCCESS Lock Owned.
25 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
29 CoreAcquireLockOrFail (
33 ASSERT (Lock
!= NULL
);
34 ASSERT (Lock
->Lock
!= EfiLockUninitialized
);
36 if (Lock
->Lock
== EfiLockAcquired
) {
38 // Lock is already owned, so bail out
40 return EFI_ACCESS_DENIED
;
43 Lock
->OwnerTpl
= CoreRaiseTpl (Lock
->Tpl
);
45 Lock
->Lock
= EfiLockAcquired
;
50 Raising to the task priority level of the mutual exclusion
51 lock, and then acquires ownership of the lock.
53 @param Lock The lock to acquire
63 ASSERT (Lock
!= NULL
);
64 ASSERT (Lock
->Lock
== EfiLockReleased
);
66 Lock
->OwnerTpl
= CoreRaiseTpl (Lock
->Tpl
);
67 Lock
->Lock
= EfiLockAcquired
;
71 Releases ownership of the mutual exclusion lock, and
72 restores the previous task priority level.
74 @param Lock The lock to release
86 ASSERT (Lock
!= NULL
);
87 ASSERT (Lock
->Lock
== EfiLockAcquired
);
91 Lock
->Lock
= EfiLockReleased
;