3 Copyright (c) 2004 - 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.
23 #include "..\RuntimeLibInternal.h"
26 // Driver Lib Module Globals
28 static EFI_EVENT mEfiVirtualNotifyEvent
;
29 EFI_RUNTIME_SERVICES
*mRT
;
33 RuntimeDriverExitBootServices (
41 Set AtRuntime flag as TRUE after ExitBootServices
45 Event - The Event that is being processed
47 Context - Event Context
62 RuntimeLibVirtualNotifyEvent (
70 Fixup internal data so that EFI can be call in virtual mode.
71 Call the passed in Child Notify event and convert any pointers in
76 Event - The Event that is being processed
78 Context - Event Context
87 EFI_EVENT_NOTIFY ChildNotifyEventHandler
;
89 for (Index
= 0; _gDriverSetVirtualAddressMapEvent
[Index
] != NULL
; Index
++) {
90 ChildNotifyEventHandler
= _gDriverSetVirtualAddressMapEvent
[Index
];
91 ChildNotifyEventHandler (Event
, NULL
);
95 // Update global for Runtime Services Table
97 EfiConvertPointer (0, (VOID
**) &mRT
);
102 RuntimeDriverLibConstruct (
103 IN EFI_HANDLE ImageHandle
,
104 IN EFI_SYSTEM_TABLE
*SystemTable
110 Intialize runtime Driver Lib if it has not yet been initialized.
114 ImageHandle - The firmware allocated handle for the EFI image.
116 SystemTable - A pointer to the EFI System Table.
118 GoVirtualChildEvent - Caller can register a virtual notification event.
122 EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.
128 mRT
= SystemTable
->RuntimeServices
;
131 // Register SetVirtualAddressMap () notify function
133 if (_gDriverSetVirtualAddressMapEvent
[0] != NULL
) {
134 Status
= gBS
->CreateEvent (
135 EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE
,
137 RuntimeLibVirtualNotifyEvent
,
139 &mEfiVirtualNotifyEvent
141 ASSERT_EFI_ERROR (Status
);
149 RuntimeDriverLibDeconstruct (
156 This routine will free some resources which have been allocated in
157 EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error,
158 it must call this routine to free the allocated resource before the exiting.
166 EFI_SUCCESS - Shotdown the Runtime Driver Lib successfully
167 EFI_UNSUPPORTED - Runtime Driver lib was not initialized at all
174 // Close SetVirtualAddressMap () notify function
176 if (_gDriverSetVirtualAddressMapEvent
[0] != NULL
) {
177 Status
= gBS
->CloseEvent (mEfiVirtualNotifyEvent
);
178 ASSERT_EFI_ERROR (Status
);
192 Return TRUE if ExitBootService () has been called
198 TRUE - If ExitBootService () has been called
202 EFI_GUID Guid
= EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID
;
203 SAL_RETURN_REGS ReturnReg
;
205 ReturnReg
= EfiCallEsalService (&Guid
, IsEfiRuntime
, 0, 0, 0, 0, 0, 0, 0);
207 return (BOOLEAN
) (ReturnReg
.r9
== 1);
218 Return TRUE if SetVirtualAddressMap () has been called
224 TRUE - If SetVirtualAddressMap () has been called
228 EFI_GUID Guid
= EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID
;
229 SAL_RETURN_REGS ReturnReg
;
231 ReturnReg
= EfiCallEsalService (&Guid
, IsVirtual
, 0, 0, 0, 0, 0, 0, 0);
233 return (BOOLEAN
) (ReturnReg
.r9
== 1);