3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #include <RuntimeLibInternal.h>
21 // Driver Lib Module Globals
24 STATIC EFI_EVENT mEfiVirtualNotifyEvent
;
25 STATIC BOOLEAN mEfiGoneVirtual
= FALSE
;
26 STATIC BOOLEAN mEfiAtRuntime
= FALSE
;
27 EFI_RUNTIME_SERVICES
*mRT
;
31 RuntimeDriverExitBootServices (
39 Set AtRuntime flag as TRUE after ExitBootServices
43 Event - The Event that is being processed
45 Context - Event Context
54 // Clear out BootService globals
64 RuntimeLibVirtualNotifyEvent (
72 Fixup internal data so that EFI can be call in virtual mode.
73 Call the passed in Child Notify event and convert any pointers in
78 Event - The Event that is being processed
80 Context - Event Context
89 EFI_EVENT_NOTIFY ChildNotifyEventHandler
;
92 _gDriverSetVirtualAddressMapEvent
[Index
] != NULL
;
94 ChildNotifyEventHandler
= _gDriverSetVirtualAddressMapEvent
[Index
];
95 ChildNotifyEventHandler (Event
, NULL
);
99 // Update global for Runtime Services Table and IO
101 EfiConvertPointer (0, (VOID
**) &mRT
);
103 mEfiGoneVirtual
= TRUE
;
108 RuntimeDriverLibConstruct (
109 IN EFI_HANDLE ImageHandle
,
110 IN EFI_SYSTEM_TABLE
*SystemTable
116 Intialize runtime Driver Lib if it has not yet been initialized.
120 ImageHandle - The firmware allocated handle for the EFI image.
122 SystemTable - A pointer to the EFI System Table.
124 GoVirtualChildEvent - Caller can register a virtual notification event.
128 EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.
134 mRT
= SystemTable
->RuntimeServices
;
137 // Register SetVirtualAddressMap () notify function
139 if (_gDriverSetVirtualAddressMapEvent
[0] != NULL
) {
140 Status
= gBS
->CreateEvent (
141 EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE
,
143 RuntimeLibVirtualNotifyEvent
,
145 &mEfiVirtualNotifyEvent
148 ASSERT_EFI_ERROR (Status
);
156 RuntimeDriverLibDeconstruct (
163 This routine will free some resources which have been allocated in
164 EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error,
165 it must call this routine to free the allocated resource before the exiting.
173 EFI_SUCCESS - Shotdown the Runtime Driver Lib successfully
174 EFI_UNSUPPORTED - Runtime Driver lib was not initialized at all
181 // Close SetVirtualAddressMap () notify function
183 if (_gDriverSetVirtualAddressMapEvent
[0] != NULL
) {
184 Status
= gBS
->CloseEvent (mEfiVirtualNotifyEvent
);
185 ASSERT_EFI_ERROR (Status
);
199 Return TRUE if ExitBootServices () has been called
205 TRUE - If ExitBootServices () has been called
209 return mEfiAtRuntime
;
220 Return TRUE if SetVirtualAddressMap () has been called
226 TRUE - If SetVirtualAddressMap () has been called
230 return mEfiGoneVirtual
;