3 Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>
4 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
29 STATIC EFI_EVENT mEfiVirtualNotifyEvent
;
30 STATIC BOOLEAN mEfiGoneVirtual
= FALSE
;
31 STATIC BOOLEAN mEfiAtRuntime
= FALSE
;
32 EFI_RUNTIME_SERVICES
*mRT
;
35 Set AtRuntime flag as TRUE after ExitBootServices
37 @param[in] Event The Event that is being processed
38 @param[in] Context Event Context
42 RuntimeDriverExitBootServices (
51 Fixup internal data so that EFI can be call in virtual mode.
52 Call the passed in Child Notify event and convert any pointers in
55 @param[in] Event The Event that is being processed
56 @param[in] Context Event Context
61 RuntimeLibVirtualNotifyEvent (
67 EFI_EVENT_NOTIFY ChildNotifyEventHandler
;
70 _gDriverSetVirtualAddressMapEvent
[Index
] != NULL
;
72 ChildNotifyEventHandler
= _gDriverSetVirtualAddressMapEvent
[Index
];
73 ChildNotifyEventHandler (Event
, NULL
);
77 // Update global for Runtime Services Table and IO
79 EfiConvertPointer (0, (VOID
**) &mRT
);
81 mEfiGoneVirtual
= TRUE
;
85 Intialize runtime Driver Lib if it has not yet been initialized.
87 @param[in] ImageHandle The firmware allocated handle for the EFI image.
88 @param[in] SystemTable A pointer to the EFI System Table.
90 @return EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.
94 RuntimeDriverLibConstruct (
95 IN EFI_HANDLE ImageHandle
,
96 IN EFI_SYSTEM_TABLE
*SystemTable
101 ASSERT (SystemTable
!= NULL
);
102 mRT
= SystemTable
->RuntimeServices
;
103 ASSERT (mRT
!= NULL
);
106 // Register SetVirtualAddressMap () notify function
108 ASSERT (gBS
!= NULL
);
109 Status
= gBS
->CreateEvent (
110 EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE
,
112 RuntimeLibVirtualNotifyEvent
,
114 &mEfiVirtualNotifyEvent
117 ASSERT_EFI_ERROR (Status
);
123 This routine will free some resources which have been allocated in
124 EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error,
125 it must call this routine to free the allocated resource before the exiting.
127 @retval EFI_SUCCESS Shutdown the Runtime Driver Lib successfully
128 @retval EFI_UNSUPPORTED Runtime Driver lib was not initialized at all
132 RuntimeDriverLibDeconstruct (
133 IN EFI_HANDLE ImageHandle
,
134 IN EFI_SYSTEM_TABLE
*SystemTable
140 // Close SetVirtualAddressMap () notify function
142 ASSERT (gBS
!= NULL
);
143 Status
= gBS
->CloseEvent (mEfiVirtualNotifyEvent
);
144 ASSERT_EFI_ERROR (Status
);
150 Return TRUE if ExitBootServices () has been called
152 @retval TRUE If ExitBootServices () has been called
160 return mEfiAtRuntime
;
164 Return TRUE if SetVirtualAddressMap () has been called
166 @retval TRUE If SetVirtualAddressMap () has been called
174 return mEfiGoneVirtual
;