source: mainline/boot/arch/ia64/loader/gefi/lib/runtime/rtlock.c@ 36251c6

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 36251c6 was 7208b6c, checked in by Jakub Vana <jakub.vana@…>, 18 years ago

Basic IA64 boot and kernel suport for real machines

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*++
2
3Copyright (c) 1998 Intel Corporation
4
5Module Name:
6
7 lock.c
8
9Abstract:
10
11 Implements FLOCK
12
13
14
15Revision History
16
17--*/
18
19
20#include "lib.h"
21
22
23
24#pragma RUNTIME_CODE(RtAcquireLock)
25VOID
26RtAcquireLock (
27 IN FLOCK *Lock
28 )
29/*++
30
31Routine Description:
32
33 Raising to the task priority level of the mutual exclusion
34 lock, and then acquires ownership of the lock.
35
36Arguments:
37
38 Lock - The lock to acquire
39
40Returns:
41
42 Lock owned
43
44--*/
45{
46 if (BS) {
47 if (BS->RaiseTPL != NULL) {
48 Lock->OwnerTpl = BS->RaiseTPL(Lock->Tpl);
49 }
50 }
51 else {
52 if (LibRuntimeRaiseTPL != NULL) {
53 Lock->OwnerTpl = LibRuntimeRaiseTPL(Lock->Tpl);
54 }
55 }
56 Lock->Lock += 1;
57 ASSERT (Lock->Lock == 1);
58}
59
60
61#pragma RUNTIME_CODE(RtAcquireLock)
62VOID
63RtReleaseLock (
64 IN FLOCK *Lock
65 )
66/*++
67
68Routine Description:
69
70 Releases ownership of the mutual exclusion lock, and
71 restores the previous task priority level.
72
73Arguments:
74
75 Lock - The lock to release
76
77Returns:
78
79 Lock unowned
80
81--*/
82{
83 EFI_TPL Tpl;
84
85 Tpl = Lock->OwnerTpl;
86 ASSERT(Lock->Lock == 1);
87 Lock->Lock -= 1;
88 if (BS) {
89 if (BS->RestoreTPL != NULL) {
90 BS->RestoreTPL (Tpl);
91 }
92 }
93 else {
94 if (LibRuntimeRestoreTPL != NULL) {
95 LibRuntimeRestoreTPL(Tpl);
96 }
97 }
98}
Note: See TracBrowser for help on using the repository browser.