TianoCore EDK2 master
Loading...
Searching...
No Matches
Library.c
Go to the documentation of this file.
1
9#include "DxeMain.h"
10
11//
12// Lock Stuff
13//
14
31 )
32{
33 ASSERT (Lock != NULL);
34 ASSERT (Lock->Lock != EfiLockUninitialized);
35
36 if (Lock->Lock == EfiLockAcquired) {
37 //
38 // Lock is already owned, so bail out
39 //
40 return EFI_ACCESS_DENIED;
41 }
42
43 Lock->OwnerTpl = CoreRaiseTpl (Lock->Tpl);
44
45 Lock->Lock = EfiLockAcquired;
46 return EFI_SUCCESS;
47}
48
58VOID
61 )
62{
63 ASSERT (Lock != NULL);
64 ASSERT (Lock->Lock == EfiLockReleased);
65
66 Lock->OwnerTpl = CoreRaiseTpl (Lock->Tpl);
67 Lock->Lock = EfiLockAcquired;
68}
69
79VOID
82 )
83{
84 EFI_TPL Tpl;
85
86 ASSERT (Lock != NULL);
87 ASSERT (Lock->Lock == EfiLockAcquired);
88
89 Tpl = Lock->OwnerTpl;
90
91 Lock->Lock = EfiLockReleased;
92
93 CoreRestoreTpl (Tpl);
94}
EFI_TPL EFIAPI CoreRaiseTpl(IN EFI_TPL NewTpl)
Definition: Tpl.c:57
VOID EFIAPI CoreRestoreTpl(IN EFI_TPL NewTpl)
Definition: Tpl.c:95
EFI_STATUS CoreAcquireLockOrFail(IN EFI_LOCK *Lock)
Definition: Library.c:29
VOID CoreAcquireLock(IN EFI_LOCK *Lock)
Definition: Library.c:59
VOID CoreReleaseLock(IN EFI_LOCK *Lock)
Definition: Library.c:80
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
EFI_STATUS EFIAPI Lock(IN EFI_SMM_ACCESS2_PROTOCOL *This)
Definition: SmmAccessDxe.c:133
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
UINTN EFI_TPL
Definition: UefiBaseType.h:41
#define EFI_SUCCESS
Definition: UefiBaseType.h:112