]>
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 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
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.
21 Initialize a basic mutual exclusion lock. Each lock
22 provides mutual exclusion access at it's task priority
23 level. Since there is no-premption (at any TPL) or
24 multiprocessor support, acquiring the lock only consists
25 of raising to the locks TPL.
27 @param Lock The EFI_LOCK structure to initialize
29 @retval EFI_SUCCESS Lock Owned.
30 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
34 CoreAcquireLockOrFail (
38 ASSERT (Lock
!= NULL
);
39 ASSERT (Lock
->Lock
!= EfiLockUninitialized
);
41 if (Lock
->Lock
== EfiLockAcquired
) {
43 // Lock is already owned, so bail out
45 return EFI_ACCESS_DENIED
;
48 Lock
->OwnerTpl
= CoreRaiseTpl (Lock
->Tpl
);
50 Lock
->Lock
= EfiLockAcquired
;
57 Raising to the task priority level of the mutual exclusion
58 lock, and then acquires ownership of the lock.
60 @param Lock The lock to acquire
70 ASSERT (Lock
!= NULL
);
71 ASSERT (Lock
->Lock
== EfiLockReleased
);
73 Lock
->OwnerTpl
= CoreRaiseTpl (Lock
->Tpl
);
74 Lock
->Lock
= EfiLockAcquired
;
80 Releases ownership of the mutual exclusion lock, and
81 restores the previous task priority level.
83 @param Lock The lock to release
95 ASSERT (Lock
!= NULL
);
96 ASSERT (Lock
->Lock
== EfiLockAcquired
);
100 Lock
->Lock
= EfiLockReleased
;
102 CoreRestoreTpl (Tpl
);