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
23 static EFI_EVENT mEfiVirtualNotifyEvent
;
24 EFI_RUNTIME_SERVICES
*mRT
;
28 RuntimeDriverExitBootServices (
36 Set AtRuntime flag as TRUE after ExitBootServices
40 Event - The Event that is being processed
42 Context - Event Context
58 RuntimeLibVirtualNotifyEvent (
66 Fixup internal data so that EFI can be call in virtual mode.
67 Call the passed in Child Notify event and convert any pointers in
72 Event - The Event that is being processed
74 Context - Event Context
83 EFI_EVENT_NOTIFY ChildNotifyEventHandler
;
85 for (Index
= 0; _gDriverSetVirtualAddressMapEvent
[Index
] != NULL
; Index
++) {
86 ChildNotifyEventHandler
= _gDriverSetVirtualAddressMapEvent
[Index
];
87 ChildNotifyEventHandler (Event
, NULL
);
91 // Update global for Runtime Services Table
93 EfiConvertPointer (0, (VOID
**) &mRT
);
98 RuntimeDriverLibConstruct (
99 IN EFI_HANDLE ImageHandle
,
100 IN EFI_SYSTEM_TABLE
*SystemTable
106 Intialize runtime Driver Lib if it has not yet been initialized.
110 ImageHandle - The firmware allocated handle for the EFI image.
112 SystemTable - A pointer to the EFI System Table.
114 GoVirtualChildEvent - Caller can register a virtual notification event.
118 EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.
124 mRT
= SystemTable
->RuntimeServices
;
127 // Register SetVirtualAddressMap () notify function
129 if (_gDriverSetVirtualAddressMapEvent
[0] != NULL
) {
130 Status
= gBS
->CreateEvent (
131 EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE
,
133 RuntimeLibVirtualNotifyEvent
,
135 &mEfiVirtualNotifyEvent
137 ASSERT_EFI_ERROR (Status
);
145 RuntimeDriverLibDeconstruct (
146 IN EFI_HANDLE ImageHandle
,
147 IN EFI_SYSTEM_TABLE
*SystemTable
153 This routine will free some resources which have been allocated in
154 EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error,
155 it must call this routine to free the allocated resource before the exiting.
163 EFI_SUCCESS - Shotdown the Runtime Driver Lib successfully
164 EFI_UNSUPPORTED - Runtime Driver lib was not initialized at all
171 // Close SetVirtualAddressMap () notify function
173 if (_gDriverSetVirtualAddressMapEvent
[0] != NULL
) {
174 Status
= gBS
->CloseEvent (mEfiVirtualNotifyEvent
);
175 ASSERT_EFI_ERROR (Status
);
189 Return TRUE if ExitBootService () has been called
195 TRUE - If ExitBootService () has been called
199 EFI_GUID Guid
= EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID
;
200 SAL_RETURN_REGS ReturnReg
;
202 ReturnReg
= EfiCallEsalService (&Guid
, IsEfiRuntime
, 0, 0, 0, 0, 0, 0, 0);
204 return (BOOLEAN
) (ReturnReg
.r9
== 1);
215 Return TRUE if SetVirtualAddressMap () has been called
221 TRUE - If SetVirtualAddressMap () has been called
225 EFI_GUID Guid
= EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID
;
226 SAL_RETURN_REGS ReturnReg
;
228 ReturnReg
= EfiCallEsalService (&Guid
, IsVirtual
, 0, 0, 0, 0, 0, 0, 0);
230 return (BOOLEAN
) (ReturnReg
.r9
== 1);