]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.c
Removed cross references from PciCf8Lib and PciExpressLib class to PciLib class.
[mirror_edk2.git] / EdkModulePkg / Universal / Runtime / RuntimeDxe / Runtime.c
1 /*++
2
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
8
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.
11
12 Module Name:
13
14 Runtime.c
15
16 Abstract:
17
18 Runtime Architectural Protocol as defined in the DXE CIS
19
20 This code is used to produce the EFI runtime virtual switch over
21
22 THIS IS VERY DANGEROUS CODE BE VERY CAREFUL IF YOU CHANGE IT
23
24 The transition for calling EFI Runtime functions in physical mode to calling
25 them in virtual mode is very very complex. Every pointer in needs to be
26 converted from physical mode to virtual mode. Be very careful walking linked
27 lists! Then to make it really hard the code it's self needs be relocated into
28 the new virtual address space.
29
30 So here is the concept. The code in this module will never ever be called in
31 virtual mode. This is the code that collects the information needed to convert
32 to virtual mode (DXE core registers runtime stuff with this code). Since this
33 code is used to fixup all runtime images, it CAN NOT fix it's self up. So some
34 code has to stay behind and that is us.
35
36 Also you need to be careful about when you allocate memory, as once we are in
37 runtime (including our EVT_SIGNAL_EXIT_BOOT_SERVICES event) you can no longer
38 allocate memory.
39
40 Any runtime driver that gets loaded before us will not be callable in virtual
41 mode. This is due to the fact that the DXE core can not register the info
42 needed with us. This is good, since it keeps the code in this file from
43 getting registered.
44
45
46 Revision History:
47
48 - Move the CalculateCrc32 function from Runtime Arch Protocol to Boot Service.
49 Runtime Arch Protocol definition no longer contains CalculateCrc32. Boot Service
50 Table now contains an item named CalculateCrc32.
51
52 --*/
53
54
55 #include "Runtime.h"
56
57 //
58 // This is a only short term solution.
59 // There is a change coming to the Runtime AP that
60 // will make it so the Runtime driver will not have to allocate any buffers.
61 //
62 #define MAX_RUNTIME_IMAGE_NUM (64)
63 #define MAX_RUNTIME_EVENT_NUM (64)
64 RUNTIME_IMAGE_RELOCATION_DATA mRuntimeImageBuffer[MAX_RUNTIME_IMAGE_NUM];
65 RUNTIME_NOTIFY_EVENT_DATA mRuntimeEventBuffer[MAX_RUNTIME_EVENT_NUM];
66 UINTN mRuntimeImageNumber;
67 UINTN mRuntimeEventNumber;
68
69 //
70 // The handle onto which the Runtime Architectural Protocol instance is installed
71 //
72 EFI_HANDLE mRuntimeHandle = NULL;
73
74 //
75 // The Runtime Architectural Protocol instance produced by this driver
76 //
77 EFI_RUNTIME_ARCH_PROTOCOL mRuntime = {
78 RuntimeDriverRegisterImage,
79 RuntimeDriverRegisterEvent
80 };
81
82 //
83 // Global Variables
84 //
85 LIST_ENTRY mRelocationList = INITIALIZE_LIST_HEAD_VARIABLE(mRelocationList);
86 LIST_ENTRY mEventList = INITIALIZE_LIST_HEAD_VARIABLE(mEventList);
87 BOOLEAN mEfiVirtualMode = FALSE;
88 EFI_GUID mLocalEfiUgaIoProtocolGuid = EFI_UGA_IO_PROTOCOL_GUID;
89 EFI_MEMORY_DESCRIPTOR *mVirtualMap = NULL;
90 UINTN mVirtualMapDescriptorSize;
91 UINTN mVirtualMapMaxIndex;
92
93 EFI_LOADED_IMAGE_PROTOCOL *mMyLoadedImage;
94
95 #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
96 STATIC EFI_GUID mEfiCapsuleHeaderGuid = EFI_CAPSULE_GUID;
97 #endif
98 //
99 // Worker Functions
100 //
101 VOID
102 RuntimeDriverCalculateEfiHdrCrc (
103 IN OUT EFI_TABLE_HEADER *Hdr
104 )
105 /*++
106
107 Routine Description:
108
109 Calcualte the 32-bit CRC in a EFI table using the Runtime Drivers
110 internal function. The EFI Boot Services Table can not be used because
111 the EFI Boot Services Table was destroyed at ExitBootServices()
112
113 Arguments:
114
115 Hdr - Pointer to an EFI standard header
116
117 Returns:
118
119 None
120
121 --*/
122 {
123 UINT32 Crc;
124
125 Hdr->CRC32 = 0;
126
127 Crc = 0;
128 RuntimeDriverCalculateCrc32 ((UINT8 *) Hdr, Hdr->HeaderSize, &Crc);
129 Hdr->CRC32 = Crc;
130 }
131
132 EFI_STATUS
133 EFIAPI
134 RuntimeDriverRegisterImage (
135 IN EFI_RUNTIME_ARCH_PROTOCOL *This,
136 IN EFI_PHYSICAL_ADDRESS ImageBase,
137 IN UINTN ImageSize,
138 IN VOID *RelocationData
139 )
140 /*++
141
142 Routine Description:
143
144 When a SetVirtualAddressMap() is performed all the runtime images loaded by
145 DXE must be fixed up with the new virtual address map. To facilitate this the
146 Runtime Architectural Protocol needs to be informed of every runtime driver
147 that is registered. All the runtime images loaded by DXE should be registered
148 with this service by the DXE Core when ExitBootServices() is called. The
149 images that are registered with this service must have successfully been
150 loaded into memory with the Boot Service LoadImage(). As a result, no
151 parameter checking needs to be performed.
152
153 Arguments:
154
155 This - The EFI_RUNTIME_ARCH_PROTOCOL instance.
156
157 ImageBase - Start of image that has been loaded in memory. It is either
158 a pointer to the DOS or PE header of the image.
159
160 ImageSize - Size of the image in bytes.
161
162 RelocationData - Information about the fixups that were performed on ImageBase
163 when it was loaded into memory. This information is needed
164 when the virtual mode fix-ups are reapplied so that data that
165 has been programmatically updated will not be fixed up. If
166 code updates a global variable the code is responsible for
167 fixing up the variable for virtual mode.
168
169 Returns:
170
171 EFI_SUCCESS - The ImageBase has been registered.
172
173 --*/
174 {
175 RUNTIME_IMAGE_RELOCATION_DATA *RuntimeImage;
176
177 if (mMyLoadedImage->ImageBase == (VOID *) (UINTN) ImageBase) {
178 //
179 // We don't want to relocate our selves, as we only run in physical mode.
180 //
181 return EFI_SUCCESS;
182 }
183
184 RuntimeImage = &mRuntimeImageBuffer[mRuntimeImageNumber];
185 mRuntimeImageNumber++;
186 ASSERT (mRuntimeImageNumber < MAX_RUNTIME_IMAGE_NUM);
187
188 RuntimeImage->Valid = TRUE;
189 RuntimeImage->ImageBase = ImageBase;
190 RuntimeImage->ImageSize = ImageSize;
191 RuntimeImage->RelocationData = RelocationData;
192
193 InsertTailList (&mRelocationList, &RuntimeImage->Link);
194 return EFI_SUCCESS;
195 }
196
197 EFI_STATUS
198 EFIAPI
199 RuntimeDriverRegisterEvent (
200 IN EFI_RUNTIME_ARCH_PROTOCOL *This,
201 IN UINT32 Type,
202 IN EFI_TPL NotifyTpl,
203 IN EFI_EVENT_NOTIFY NotifyFunction,
204 IN VOID *NotifyContext,
205 IN EFI_EVENT *Event
206 )
207 /*++
208
209 Routine Description:
210
211 This function is used to support the required runtime events. Currently only
212 runtime events of type EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE needs to be
213 registered with this service. All the runtime events that exist in the DXE
214 Core should be registered with this service when ExitBootServices() is called.
215 All the events that are registered with this service must have been created
216 with the Boot Service CreateEvent(). As a result, no parameter checking needs
217 to be performed.
218
219 Arguments:
220
221 This - The EFI_RUNTIME_ARCH_PROTOCOL instance.
222
223 Type - The same as Type passed into CreateEvent().
224
225 NotifyTpl - The same as NotifyTpl passed into CreateEvent().
226
227 NotifyFunction - The same as NotifyFunction passed into CreateEvent().
228
229 NotifyContext - The same as NotifyContext passed into CreateEvent().
230
231 Event - The EFI_EVENT returned by CreateEvent(). Event must be in
232 runtime memory.
233
234 Returns:
235
236 EFI_SUCCESS - The Event has been registered.
237
238 --*/
239 {
240 RUNTIME_NOTIFY_EVENT_DATA *RuntimeEvent;
241
242 RuntimeEvent = &mRuntimeEventBuffer[mRuntimeEventNumber];
243 mRuntimeEventNumber++;
244 ASSERT (mRuntimeEventNumber < MAX_RUNTIME_EVENT_NUM);
245
246 RuntimeEvent->Type = Type;
247 RuntimeEvent->NotifyTpl = NotifyTpl;
248 RuntimeEvent->NotifyFunction = NotifyFunction;
249 RuntimeEvent->NotifyContext = NotifyContext;
250 RuntimeEvent->Event = Event;
251
252 InsertTailList (&mEventList, &RuntimeEvent->Link);
253 return EFI_SUCCESS;
254 }
255
256 EFI_STATUS
257 EFIAPI
258 RuntimeDriverConvertPointer (
259 IN UINTN DebugDisposition,
260 IN OUT VOID **ConvertAddress
261 )
262 {
263 UINTN Address;
264 VOID *PlabelConvertAddress;
265 UINT64 VirtEndOfRange;
266 EFI_MEMORY_DESCRIPTOR *VirtEntry;
267 UINTN Index;
268
269 //
270 // Make sure ConvertAddress is a valid pointer
271 //
272 if (ConvertAddress == NULL) {
273 return EFI_INVALID_PARAMETER;
274 }
275 //
276 // Get the address to convert
277 //
278 Address = (UINTN) *ConvertAddress;
279
280 //
281 // If this is a null pointer, return if it's allowed
282 //
283 if (Address == 0) {
284 if (DebugDisposition & EFI_OPTIONAL_POINTER) {
285 return EFI_SUCCESS;
286 }
287
288 return EFI_INVALID_PARAMETER;
289 }
290
291 PlabelConvertAddress = NULL;
292 VirtEntry = mVirtualMap;
293 for (Index = 0; Index < mVirtualMapMaxIndex; Index++) {
294 //
295 // To prevent the inclusion of 64-bit math functions a UINTN was placed in
296 // front of VirtEntry->NumberOfPages to cast it to a 32-bit thing on IA-32
297 // platforms. If you get this ASSERT remove the UINTN and do a 64-bit
298 // multiply.
299 //
300 ASSERT ((VirtEntry->NumberOfPages < 0xffffffff) || (sizeof (UINTN) > 4));
301
302 if ((VirtEntry->Attribute & EFI_MEMORY_RUNTIME) == EFI_MEMORY_RUNTIME) {
303 if (Address >= VirtEntry->PhysicalStart) {
304 VirtEndOfRange = VirtEntry->PhysicalStart + (((UINTN) VirtEntry->NumberOfPages) * EFI_PAGE_SIZE);
305 if (Address < VirtEndOfRange) {
306 //
307 // Compute new address
308 //
309 *ConvertAddress = (VOID *) (Address - (UINTN) VirtEntry->PhysicalStart + (UINTN) VirtEntry->VirtualStart);
310 return EFI_SUCCESS;
311 } else if (Address < (VirtEndOfRange + 0x200000)) {
312 //
313 // On Itanium GP defines a window +/- 2 MB inside an image.
314 // The compiler may asign a GP value outside of the image. Thus
315 // it could fall out side of any of our valid regions
316 //
317 PlabelConvertAddress = (VOID *) (Address - (UINTN) VirtEntry->PhysicalStart + (UINTN) VirtEntry->VirtualStart);
318 }
319 }
320 }
321
322 VirtEntry = NextMemoryDescriptor (VirtEntry, mVirtualMapDescriptorSize);
323 }
324
325 if (DebugDisposition & EFI_IPF_GP_POINTER) {
326 //
327 // If it's an IPF GP and the GP was outside the image handle that case.
328 //
329 if (PlabelConvertAddress != NULL) {
330 *ConvertAddress = PlabelConvertAddress;
331 return EFI_SUCCESS;
332 }
333 }
334
335 return EFI_NOT_FOUND;
336 }
337
338 EFI_STATUS
339 RuntimeDriverConvertInternalPointer (
340 IN OUT VOID **ConvertAddress
341 )
342 {
343 return RuntimeDriverConvertPointer (0x0, ConvertAddress);
344 }
345
346 EFI_STATUS
347 EFIAPI
348 RuntimeDriverSetVirtualAddressMap (
349 IN UINTN MemoryMapSize,
350 IN UINTN DescriptorSize,
351 IN UINT32 DescriptorVersion,
352 IN EFI_MEMORY_DESCRIPTOR *VirtualMap
353 )
354 {
355 EFI_STATUS Status;
356 RUNTIME_NOTIFY_EVENT_DATA *RuntimeEvent;
357 RUNTIME_IMAGE_RELOCATION_DATA *RuntimeImage;
358 LIST_ENTRY *Link;
359 UINTN Index;
360 UINTN Index1;
361 EFI_DRIVER_OS_HANDOFF_HEADER *DriverOsHandoffHeader;
362 EFI_DRIVER_OS_HANDOFF *DriverOsHandoff;
363 EFI_PHYSICAL_ADDRESS VirtImageBase;
364 #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
365 EFI_CAPSULE_TABLE *CapsuleTable;
366 #endif
367
368 //
369 // Can only switch to virtual addresses once the memory map is locked down,
370 // and can only set it once
371 //
372 if (!EfiAtRuntime () || mEfiVirtualMode) {
373 return EFI_UNSUPPORTED;
374 }
375 //
376 // Only understand the original descriptor format
377 //
378 if (DescriptorVersion != EFI_MEMORY_DESCRIPTOR_VERSION || DescriptorSize < sizeof (EFI_MEMORY_DESCRIPTOR)) {
379 return EFI_INVALID_PARAMETER;
380 }
381 //
382 // BugBug: Add code here to verify the memory map. We should
383 // cache a copy of the system memory map in the EFI System Table
384 // as a GUID pointer pair.
385 //
386 //
387 // Make sure all virtual translations are satisfied
388 //
389 mVirtualMapMaxIndex = MemoryMapSize / DescriptorSize;
390
391 //
392 // BugBug :The following code does not work hence commented out.
393 // Need to be replaced by something that works.
394 //
395 // VirtEntry = VirtualMap;
396 // for (Index = 0; Index < mVirtualMapMaxIndex; Index++) {
397 // if (((VirtEntry->Attribute & EFI_MEMORY_RUNTIME) == EFI_MEMORY_RUNTIME) &&
398 // (VirtEntry->VirtualStart != 0) ) {
399 // return EFI_NO_MAPPING;
400 // }
401 // VirtEntry = NextMemoryDescriptor(VirtEntry, DescriptorSize);
402 // }
403 //
404 // We are now committed to go to virtual mode, so lets get to it!
405 //
406 mEfiVirtualMode = TRUE;
407
408 //
409 // ConvertPointer() needs this mVirtualMap to do the conversion. So set up
410 // globals we need to parse the virtual address map.
411 //
412 mVirtualMapDescriptorSize = DescriptorSize;
413 mVirtualMap = VirtualMap;
414
415 //
416 // Signal all the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE events.
417 // The core call RuntimeDriverRegisterEvent() for
418 // every runtime event and we stored them in the mEventList
419 //
420 //
421 // Currently the bug in StatusCode/RuntimeLib has been fixed, it will
422 // check whether in Runtime or not (this is judged by looking at
423 // mEfiAtRuntime global So this ReportStatusCode will work
424 //
425 REPORT_STATUS_CODE (
426 EFI_PROGRESS_CODE,
427 (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP)
428 );
429
430 //
431 // BugBug - Commented out for now because the status code driver is not
432 // ready for runtime yet. The Status Code driver calls data hub with does
433 // a bunch of Boot Service things (locks, AllocatePool) and hangs somewhere
434 // on the way.
435 //
436 // ReportStatusCode (
437 // EfiProgressCode, EfiMaxErrorSeverity,
438 // 0x03, 0x01, 12, // ReadyToBoot Progress code
439 // 0x00, 30, L"ConvertPointer"
440 // );
441 //
442 for (Link = mEventList.ForwardLink; Link != &mEventList; Link = Link->ForwardLink) {
443 RuntimeEvent = _CR (Link, RUNTIME_NOTIFY_EVENT_DATA, Link);
444 if ((RuntimeEvent->Type & EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) == EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) {
445 RuntimeEvent->NotifyFunction (
446 RuntimeEvent->Event,
447 RuntimeEvent->NotifyContext
448 );
449 }
450 }
451 //
452 // Relocate runtime images. Runtime images loaded before the runtime AP was
453 // started will not be relocated, since they would not have gotten registered.
454 // This includes the code in this file.
455 //
456 for (Link = mRelocationList.ForwardLink; Link != &mRelocationList; Link = Link->ForwardLink) {
457 RuntimeImage = _CR (Link, RUNTIME_IMAGE_RELOCATION_DATA, Link);
458 if (RuntimeImage->Valid) {
459
460 VirtImageBase = RuntimeImage->ImageBase;
461 Status = RuntimeDriverConvertPointer (0, (VOID **) &VirtImageBase);
462 ASSERT_EFI_ERROR (Status);
463
464 PeCoffLoaderRelocateImageForRuntime (
465 RuntimeImage->ImageBase,
466 VirtImageBase,
467 RuntimeImage->ImageSize,
468 RuntimeImage->RelocationData
469 );
470
471 FlushCpuCache (RuntimeImage->ImageBase, (UINT64)RuntimeImage->ImageSize);
472 }
473 }
474 //
475 // Convert all the Runtime Services except ConvertPointer() and SetVirtualAddressMap()
476 // and recompute the CRC-32
477 //
478 RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetTime);
479 RuntimeDriverConvertInternalPointer ((VOID **) &gRT->SetTime);
480 RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetWakeupTime);
481 RuntimeDriverConvertInternalPointer ((VOID **) &gRT->SetWakeupTime);
482 RuntimeDriverConvertInternalPointer ((VOID **) &gRT->ResetSystem);
483 RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetNextHighMonotonicCount);
484 RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetVariable);
485 RuntimeDriverConvertInternalPointer ((VOID **) &gRT->SetVariable);
486 RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetNextVariableName);
487 #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
488 RuntimeDriverConvertInternalPointer ((VOID **) &gRT->QueryVariableInfo);
489 RuntimeDriverConvertInternalPointer ((VOID **) &gRT->UpdateCapsule);
490 RuntimeDriverConvertInternalPointer ((VOID **) &gRT->QueryCapsuleCapabilities);
491 #endif
492 RuntimeDriverCalculateEfiHdrCrc (&gRT->Hdr);
493
494 //
495 // Convert the UGA OS Handoff Table if it is present in the Configuration Table
496 //
497 for (Index = 0; Index < gST->NumberOfTableEntries; Index++) {
498 if (CompareGuid (&mLocalEfiUgaIoProtocolGuid, &(gST->ConfigurationTable[Index].VendorGuid))) {
499 DriverOsHandoffHeader = gST->ConfigurationTable[Index].VendorTable;
500 for (Index1 = 0; Index1 < DriverOsHandoffHeader->NumberOfEntries; Index1++) {
501 DriverOsHandoff = (EFI_DRIVER_OS_HANDOFF *)
502 (
503 (UINTN) DriverOsHandoffHeader +
504 DriverOsHandoffHeader->HeaderSize +
505 Index1 *
506 DriverOsHandoffHeader->SizeOfEntries
507 );
508 RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &DriverOsHandoff->DevicePath);
509 RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &DriverOsHandoff->PciRomImage);
510 }
511
512 RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &(gST->ConfigurationTable[Index].VendorTable));
513 }
514 #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
515 if (CompareGuid (&mEfiCapsuleHeaderGuid, &(gST->ConfigurationTable[Index].VendorGuid))) {
516 CapsuleTable = gST->ConfigurationTable[Index].VendorTable;
517 for (Index1 = 0; Index1 < CapsuleTable->CapsuleArrayNumber; Index1++) {
518 RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &CapsuleTable->CapsulePtr[Index1]);
519 }
520 RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &(gST->ConfigurationTable[Index].VendorTable));
521 }
522 #endif
523 }
524 //
525 // Convert the runtime fields of the EFI System Table and recompute the CRC-32
526 //
527 RuntimeDriverConvertInternalPointer ((VOID **) &gST->FirmwareVendor);
528 RuntimeDriverConvertInternalPointer ((VOID **) &gST->ConfigurationTable);
529 RuntimeDriverConvertInternalPointer ((VOID **) &gST->RuntimeServices);
530 RuntimeDriverCalculateEfiHdrCrc (&gST->Hdr);
531
532 //
533 // At this point, gRT and gST are physical pointers, but the contents of these tables
534 // have been converted to runtime.
535 //
536 //
537 // mVirtualMap is only valid during SetVirtualAddressMap() call
538 //
539 mVirtualMap = NULL;
540
541 return EFI_SUCCESS;
542 }
543
544 EFI_STATUS
545 EFIAPI
546 RuntimeDriverInitialize (
547 IN EFI_HANDLE ImageHandle,
548 IN EFI_SYSTEM_TABLE *SystemTable
549 )
550 /*++
551
552 Routine Description:
553 Install Runtime AP. This code includes the EfiDriverLib, but it functions at
554 RT in physical mode. The only Lib services are gBS, gRT, and the DEBUG and
555 ASSERT macros (they do ReportStatusCode).
556
557 Arguments:
558 (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
559
560 Returns:
561
562 EFI_SUCEESS - Runtime Driver Architectural Protocol Installed
563
564 Other - Return value from gBS->InstallMultipleProtocolInterfaces
565
566 --*/
567 {
568 EFI_STATUS Status;
569
570 //
571 // This image needs to be exclued from relocation for virtual mode, so cache
572 // a copy of the Loaded Image protocol to test later.
573 //
574 Status = gBS->HandleProtocol (
575 ImageHandle,
576 &gEfiLoadedImageProtocolGuid,
577 (VOID **) &mMyLoadedImage
578 );
579 ASSERT_EFI_ERROR (Status);
580
581 //
582 // Initialize the table used to compute 32-bit CRCs
583 //
584 RuntimeDriverInitializeCrc32Table ();
585
586 //
587 // Fill in the entries of the EFI Boot Services and EFI Runtime Services Tables
588 //
589 gBS->CalculateCrc32 = RuntimeDriverCalculateCrc32;
590 gRT->SetVirtualAddressMap = RuntimeDriverSetVirtualAddressMap;
591 gRT->ConvertPointer = RuntimeDriverConvertPointer;
592
593 //
594 // Install the Runtime Architectural Protocol onto a new handle
595 //
596 Status = gBS->InstallMultipleProtocolInterfaces (
597 &mRuntimeHandle,
598 &gEfiRuntimeArchProtocolGuid,
599 &mRuntime,
600 NULL
601 );
602 ASSERT_EFI_ERROR (Status);
603
604 mRuntimeImageNumber = 0;
605 mRuntimeEventNumber = 0;
606
607 return Status;
608 }