2 Firmware Block Services to support emulating non-volatile variables
3 by pretending that a memory buffer is storage for the NV variables.
5 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Guid/EventGroup.h>
12 #include <Guid/SystemNvDataGuid.h>
13 #include <Guid/VariableFormat.h>
15 #include <Protocol/FirmwareVolumeBlock.h>
16 #include <Protocol/DevicePath.h>
18 #include <Library/UefiLib.h>
19 #include <Library/UefiDriverEntryPoint.h>
20 #include <Library/BaseLib.h>
21 #include <Library/UefiRuntimeLib.h>
22 #include <Library/DebugLib.h>
23 #include <Library/BaseMemoryLib.h>
24 #include <Library/MemoryAllocationLib.h>
25 #include <Library/UefiBootServicesTableLib.h>
26 #include <Library/DevicePathLib.h>
27 #include <Library/PcdLib.h>
28 #include <Library/PlatformFvbLib.h>
31 #define EFI_AUTHENTICATED_VARIABLE_GUID \
32 { 0xaaf32c78, 0x947b, 0x439a, { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 } }
35 // Virtual Address Change Event
37 // This is needed for runtime variable access.
39 EFI_EVENT mEmuVarsFvbAddrChangeEvent
= NULL
;
42 // This is the single instance supported by this driver. It
43 // supports the FVB and Device Path protocols.
45 EFI_FW_VOL_BLOCK_DEVICE mEmuVarsFvb
= {
53 sizeof (MEMMAP_DEVICE_PATH
),
63 END_ENTIRE_DEVICE_PATH_SUBTYPE
,
65 sizeof (EFI_DEVICE_PATH_PROTOCOL
),
71 EMU_FVB_BLOCK_SIZE
, // BlockSize
73 { // FwVolBlockInstance
74 FvbProtocolGetAttributes
,
75 FvbProtocolSetAttributes
,
76 FvbProtocolGetPhysicalAddress
,
77 FvbProtocolGetBlockSize
,
80 FvbProtocolEraseBlocks
,
86 Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE.
88 This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
89 It converts pointer to new virtual address.
91 @param Event Event whose notification function is being invoked.
92 @param Context Pointer to the notification function's context.
97 FvbVirtualAddressChangeEvent (
102 EfiConvertPointer (0x0, &mEmuVarsFvb
.BufferPtr
);
110 The GetPhysicalAddress() function retrieves the base address of
111 a memory-mapped firmware volume. This function should be called
112 only for memory-mapped firmware volumes.
114 @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
116 @param Address Pointer to a caller-allocated
117 EFI_PHYSICAL_ADDRESS that, on successful
118 return from GetPhysicalAddress(), contains the
119 base address of the firmware volume.
121 @retval EFI_SUCCESS The firmware volume base address is returned.
123 @retval EFI_NOT_SUPPORTED The firmware volume is not memory mapped.
128 FvbProtocolGetPhysicalAddress (
129 IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL
*This
,
130 OUT EFI_PHYSICAL_ADDRESS
*Address
133 EFI_FW_VOL_BLOCK_DEVICE
*FvbDevice
;
135 FvbDevice
= FVB_DEVICE_FROM_THIS (This
);
137 *Address
= (EFI_PHYSICAL_ADDRESS
)(UINTN
)FvbDevice
->BufferPtr
;
143 The GetBlockSize() function retrieves the size of the requested
144 block. It also returns the number of additional blocks with
145 the identical size. The GetBlockSize() function is used to
146 retrieve the block map (see EFI_FIRMWARE_VOLUME_HEADER).
149 @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
151 @param Lba Indicates the block for which to return the size.
153 @param BlockSize Pointer to a caller-allocated UINTN in which
154 the size of the block is returned.
156 @param NumberOfBlocks Pointer to a caller-allocated UINTN in
157 which the number of consecutive blocks,
158 starting with Lba, is returned. All
159 blocks in this range have a size of
163 @retval EFI_SUCCESS The firmware volume base address is returned.
165 @retval EFI_INVALID_PARAMETER The requested LBA is out of range.
170 FvbProtocolGetBlockSize (
171 IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL
*This
,
173 OUT UINTN
*BlockSize
,
174 OUT UINTN
*NumberOfBlocks
177 EFI_FW_VOL_BLOCK_DEVICE
*FvbDevice
;
179 if (Lba
>= EMU_FVB_NUM_TOTAL_BLOCKS
) {
180 return EFI_INVALID_PARAMETER
;
183 FvbDevice
= FVB_DEVICE_FROM_THIS (This
);
185 *BlockSize
= FvbDevice
->BlockSize
;
186 *NumberOfBlocks
= (UINTN
)(EMU_FVB_NUM_TOTAL_BLOCKS
- Lba
);
192 The GetAttributes() function retrieves the attributes and
193 current settings of the block. Status Codes Returned
195 @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
197 @param Attributes Pointer to EFI_FVB_ATTRIBUTES_2 in which the
198 attributes and current settings are
199 returned. Type EFI_FVB_ATTRIBUTES_2 is defined
200 in EFI_FIRMWARE_VOLUME_HEADER.
202 @retval EFI_SUCCESS The firmware volume attributes were
208 FvbProtocolGetAttributes (
209 IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL
*This
,
210 OUT EFI_FVB_ATTRIBUTES_2
*Attributes
214 (EFI_FVB_ATTRIBUTES_2
)(
215 EFI_FVB2_READ_ENABLED_CAP
|
216 EFI_FVB2_READ_STATUS
|
217 EFI_FVB2_WRITE_ENABLED_CAP
|
218 EFI_FVB2_WRITE_STATUS
|
219 EFI_FVB2_ERASE_POLARITY
226 The SetAttributes() function sets configurable firmware volume
227 attributes and returns the new settings of the firmware volume.
229 @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
231 @param Attributes On input, Attributes is a pointer to
232 EFI_FVB_ATTRIBUTES_2 that contains the
233 desired firmware volume settings. On
234 successful return, it contains the new
235 settings of the firmware volume. Type
236 EFI_FVB_ATTRIBUTES_2 is defined in
237 EFI_FIRMWARE_VOLUME_HEADER.
239 @retval EFI_SUCCESS The firmware volume attributes were returned.
241 @retval EFI_INVALID_PARAMETER The attributes requested are in
242 conflict with the capabilities
243 as declared in the firmware
249 FvbProtocolSetAttributes (
250 IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL
*This
,
251 IN OUT EFI_FVB_ATTRIBUTES_2
*Attributes
254 return EFI_ACCESS_DENIED
;
258 Erases and initializes a firmware volume block.
260 The EraseBlocks() function erases one or more blocks as denoted
261 by the variable argument list. The entire parameter list of
262 blocks must be verified before erasing any blocks. If a block is
263 requested that does not exist within the associated firmware
264 volume (it has a larger index than the last block of the
265 firmware volume), the EraseBlocks() function must return the
266 status code EFI_INVALID_PARAMETER without modifying the contents
267 of the firmware volume. Implementations should be mindful that
268 the firmware volume might be in the WriteDisabled state. If it
269 is in this state, the EraseBlocks() function must return the
270 status code EFI_ACCESS_DENIED without modifying the contents of
271 the firmware volume. All calls to EraseBlocks() must be fully
272 flushed to the hardware before the EraseBlocks() service
275 @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL
278 @param ... The variable argument list is a list of tuples.
279 Each tuple describes a range of LBAs to erase
280 and consists of the following:
281 - An EFI_LBA that indicates the starting LBA
282 - A UINTN that indicates the number of blocks to
285 The list is terminated with an
286 EFI_LBA_LIST_TERMINATOR. For example, the
287 following indicates that two ranges of blocks
288 (5-7 and 10-11) are to be erased: EraseBlocks
289 (This, 5, 3, 10, 2, EFI_LBA_LIST_TERMINATOR);
291 @retval EFI_SUCCESS The erase request was successfully
294 @retval EFI_ACCESS_DENIED The firmware volume is in the
296 @retval EFI_DEVICE_ERROR The block device is not functioning
297 correctly and could not be written.
298 The firmware device may have been
300 @retval EFI_INVALID_PARAMETER One or more of the LBAs listed
301 in the variable argument list do
302 not exist in the firmware volume.
307 FvbProtocolEraseBlocks (
308 IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL
*This
,
312 EFI_FW_VOL_BLOCK_DEVICE
*FvbDevice
;
319 FvbDevice
= FVB_DEVICE_FROM_THIS (This
);
322 // Check input parameters
324 VA_START (Args
, This
);
326 StartingLba
= VA_ARG (Args
, EFI_LBA
);
327 if (StartingLba
== EFI_LBA_LIST_TERMINATOR
) {
331 NumOfLba
= VA_ARG (Args
, UINTN
);
333 if ((StartingLba
> EMU_FVB_NUM_TOTAL_BLOCKS
) ||
334 (NumOfLba
> EMU_FVB_NUM_TOTAL_BLOCKS
- StartingLba
))
337 return EFI_INVALID_PARAMETER
;
346 VA_START (Args
, This
);
348 StartingLba
= VA_ARG (Args
, EFI_LBA
);
349 if (StartingLba
== EFI_LBA_LIST_TERMINATOR
) {
353 NumOfLba
= VA_ARG (Args
, UINTN
);
355 ErasePtr
= FvbDevice
->BufferPtr
;
356 ErasePtr
+= (UINTN
)StartingLba
* FvbDevice
->BlockSize
;
357 EraseSize
= NumOfLba
* FvbDevice
->BlockSize
;
359 SetMem (ErasePtr
, EraseSize
, ERASED_UINT8
);
365 // Call platform hook
367 VA_START (Args
, This
);
368 PlatformFvbBlocksErased (This
, Args
);
375 Writes the specified number of bytes from the input buffer to the block.
377 The Write() function writes the specified number of bytes from
378 the provided buffer to the specified block and offset. If the
379 firmware volume is sticky write, the caller must ensure that
380 all the bits of the specified range to write are in the
381 EFI_FVB_ERASE_POLARITY state before calling the Write()
382 function, or else the result will be unpredictable. This
383 unpredictability arises because, for a sticky-write firmware
384 volume, a write may negate a bit in the EFI_FVB_ERASE_POLARITY
385 state but cannot flip it back again. In general, before
386 calling the Write() function, the caller should call the
387 EraseBlocks() function first to erase the specified block to
388 write. A block erase cycle will transition bits from the
389 (NOT)EFI_FVB_ERASE_POLARITY state back to the
390 EFI_FVB_ERASE_POLARITY state. Implementations should be
391 mindful that the firmware volume might be in the WriteDisabled
392 state. If it is in this state, the Write() function must
393 return the status code EFI_ACCESS_DENIED without modifying the
394 contents of the firmware volume. The Write() function must
395 also prevent spanning block boundaries. If a write is
396 requested that spans a block boundary, the write must store up
397 to the boundary but not beyond. The output parameter NumBytes
398 must be set to correctly indicate the number of bytes actually
399 written. The caller must be aware that a write may be
400 partially completed. All writes, partial or otherwise, must be
401 fully flushed to the hardware before the Write() service
404 @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
406 @param Lba The starting logical block index to write to.
408 @param Offset Offset into the block at which to begin writing.
410 @param NumBytes Pointer to a UINTN. At entry, *NumBytes
411 contains the total size of the buffer. At
412 exit, *NumBytes contains the total number of
413 bytes actually written.
415 @param Buffer Pointer to a caller-allocated buffer that
416 contains the source for the write.
418 @retval EFI_SUCCESS The firmware volume was written successfully.
420 @retval EFI_BAD_BUFFER_SIZE The write was attempted across an
421 LBA boundary. On output, NumBytes
422 contains the total number of bytes
425 @retval EFI_ACCESS_DENIED The firmware volume is in the
428 @retval EFI_DEVICE_ERROR The block device is malfunctioning
429 and could not be written.
436 IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL
*This
,
439 IN OUT UINTN
*NumBytes
,
443 EFI_FW_VOL_BLOCK_DEVICE
*FvbDevice
;
447 FvbDevice
= FVB_DEVICE_FROM_THIS (This
);
449 if ((Lba
>= EMU_FVB_NUM_TOTAL_BLOCKS
) ||
450 (Offset
> FvbDevice
->BlockSize
))
452 return EFI_INVALID_PARAMETER
;
455 Status
= EFI_SUCCESS
;
456 if (*NumBytes
> FvbDevice
->BlockSize
- Offset
) {
457 *NumBytes
= FvbDevice
->BlockSize
- Offset
;
458 Status
= EFI_BAD_BUFFER_SIZE
;
461 FvbDataPtr
= FvbDevice
->BufferPtr
;
462 FvbDataPtr
+= (UINTN
)Lba
* FvbDevice
->BlockSize
;
463 FvbDataPtr
+= Offset
;
465 CopyMem (FvbDataPtr
, Buffer
, *NumBytes
);
466 PlatformFvbDataWritten (This
, Lba
, Offset
, *NumBytes
, Buffer
);
471 Reads the specified number of bytes into a buffer from the specified block.
473 The Read() function reads the requested number of bytes from the
474 requested block and stores them in the provided buffer.
475 Implementations should be mindful that the firmware volume
476 might be in the ReadDisabled state. If it is in this state,
477 the Read() function must return the status code
478 EFI_ACCESS_DENIED without modifying the contents of the
479 buffer. The Read() function must also prevent spanning block
480 boundaries. If a read is requested that would span a block
481 boundary, the read must read up to the boundary but not
482 beyond. The output parameter NumBytes must be set to correctly
483 indicate the number of bytes actually read. The caller must be
484 aware that a read may be partially completed.
486 @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
488 @param Lba The starting logical block index
491 @param Offset Offset into the block at which to begin reading.
493 @param NumBytes Pointer to a UINTN. At entry, *NumBytes
494 contains the total size of the buffer. At
495 exit, *NumBytes contains the total number of
498 @param Buffer Pointer to a caller-allocated buffer that will
499 be used to hold the data that is read.
501 @retval EFI_SUCCESS The firmware volume was read successfully
502 and contents are in Buffer.
504 @retval EFI_BAD_BUFFER_SIZE Read attempted across an LBA
505 boundary. On output, NumBytes
506 contains the total number of bytes
509 @retval EFI_ACCESS_DENIED The firmware volume is in the
512 @retval EFI_DEVICE_ERROR The block device is not
513 functioning correctly and could
520 IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL
*This
,
523 IN OUT UINTN
*NumBytes
,
527 EFI_FW_VOL_BLOCK_DEVICE
*FvbDevice
;
531 FvbDevice
= FVB_DEVICE_FROM_THIS (This
);
533 if ((Lba
>= EMU_FVB_NUM_TOTAL_BLOCKS
) ||
534 (Offset
> FvbDevice
->BlockSize
))
536 return EFI_INVALID_PARAMETER
;
539 Status
= EFI_SUCCESS
;
540 if (*NumBytes
> FvbDevice
->BlockSize
- Offset
) {
541 *NumBytes
= FvbDevice
->BlockSize
- Offset
;
542 Status
= EFI_BAD_BUFFER_SIZE
;
545 FvbDataPtr
= FvbDevice
->BufferPtr
;
546 FvbDataPtr
+= (UINTN
)Lba
* FvbDevice
->BlockSize
;
547 FvbDataPtr
+= Offset
;
549 CopyMem (Buffer
, FvbDataPtr
, *NumBytes
);
550 PlatformFvbDataRead (This
, Lba
, Offset
, *NumBytes
, Buffer
);
555 Check the integrity of firmware volume header.
557 @param[in] FwVolHeader - A pointer to a firmware volume header
559 @retval EFI_SUCCESS - The firmware volume is consistent
560 @retval EFI_NOT_FOUND - The firmware volume has been corrupted.
565 IN EFI_FIRMWARE_VOLUME_HEADER
*FwVolHeader
571 // Verify the header revision, header signature, length
572 // Length of FvBlock cannot be 2**64-1
573 // HeaderLength cannot be an odd number
575 if ((FwVolHeader
->Revision
!= EFI_FVH_REVISION
) ||
576 (FwVolHeader
->Signature
!= EFI_FVH_SIGNATURE
) ||
577 (FwVolHeader
->FvLength
!= EMU_FVB_SIZE
) ||
578 (FwVolHeader
->HeaderLength
!= EMU_FV_HEADER_LENGTH
)
581 DEBUG ((DEBUG_INFO
, "EMU Variable FVB: Basic FV headers were invalid\n"));
582 return EFI_NOT_FOUND
;
586 // Verify the header checksum
588 Checksum
= CalculateSum16 ((VOID
*)FwVolHeader
, FwVolHeader
->HeaderLength
);
591 DEBUG ((DEBUG_INFO
, "EMU Variable FVB: FV checksum was invalid\n"));
592 return EFI_NOT_FOUND
;
599 Initializes the FV Header and Variable Store Header
600 to support variable operations.
602 @param[in] Ptr - Location to initialize the headers
606 InitializeFvAndVariableStoreHeaders (
611 // Templates for authenticated variable FV header
613 STATIC FVB_FV_HDR_AND_VARS_TEMPLATE FvAndAuthenticatedVarTemplate
= {
614 { // EFI_FIRMWARE_VOLUME_HEADER FvHdr;
615 // UINT8 ZeroVector[16];
616 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
618 // EFI_GUID FileSystemGuid;
619 EFI_SYSTEM_NV_DATA_FV_GUID
,
627 // EFI_FVB_ATTRIBUTES_2 Attributes;
630 // UINT16 HeaderLength;
631 EMU_FV_HEADER_LENGTH
,
636 // UINT16 ExtHeaderOffset;
639 // UINT8 Reserved[1];
645 // EFI_FV_BLOCK_MAP_ENTRY BlockMap[1];
648 EMU_FVB_NUM_TOTAL_BLOCKS
, // UINT32 NumBlocks;
649 EMU_FVB_BLOCK_SIZE
// UINT32 Length;
653 // EFI_FV_BLOCK_MAP_ENTRY EndBlockMap;
654 { 0, 0 }, // End of block map
655 { // VARIABLE_STORE_HEADER VarHdr;
656 // EFI_GUID Signature; // need authenticated variables for secure boot
657 EFI_AUTHENTICATED_VARIABLE_GUID
,
661 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) -
662 OFFSET_OF (FVB_FV_HDR_AND_VARS_TEMPLATE
, VarHdr
)
666 VARIABLE_STORE_FORMATTED
,
669 VARIABLE_STORE_HEALTHY
,
679 EFI_FIRMWARE_VOLUME_HEADER
*Fv
;
682 // Copy the template structure into the location
686 &FvAndAuthenticatedVarTemplate
,
687 sizeof FvAndAuthenticatedVarTemplate
691 // Update the checksum for the FV header
693 Fv
= (EFI_FIRMWARE_VOLUME_HEADER
*)Ptr
;
694 Fv
->Checksum
= CalculateCheckSum16 (Ptr
, Fv
->HeaderLength
);
700 @param[in] ImageHandle The firmware allocated handle for the EFI image.
701 @param[in] SystemTable A pointer to the EFI System Table.
703 @retval EFI_SUCCESS Successfully initialized.
709 IN EFI_HANDLE ImageHandle
,
710 IN EFI_SYSTEM_TABLE
*SystemTable
718 EFI_PHYSICAL_ADDRESS Address
;
719 RETURN_STATUS PcdStatus
;
721 DEBUG ((DEBUG_INFO
, "EMU Variable FVB Started\n"));
724 // Verify that the PCD's are set correctly.
727 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) %
728 EMU_FVB_BLOCK_SIZE
== 0
731 (PcdGet32 (PcdFlashNvStorageVariableSize
) +
732 PcdGet32 (PcdFlashNvStorageFtwWorkingSize
)
734 EMU_FVB_NUM_SPARE_BLOCKS
* EMU_FVB_BLOCK_SIZE
737 DEBUG ((DEBUG_ERROR
, "EMU Variable invalid PCD sizes\n"));
738 return EFI_INVALID_PARAMETER
;
741 if (PcdGet64 (PcdFlashNvStorageVariableBase64
) != 0) {
744 "Disabling EMU Variable FVB since "
745 "flash variables appear to be supported.\n"
751 // By default we will initialize the FV contents. But, if
752 // PcdEmuVariableNvStoreReserved is non-zero, then we will
753 // use this location for our buffer.
755 // If this location does not have a proper FV header, then
756 // we will initialize it.
759 if (PcdGet64 (PcdEmuVariableNvStoreReserved
) != 0) {
760 Ptr
= (VOID
*)(UINTN
)PcdGet64 (PcdEmuVariableNvStoreReserved
);
763 "EMU Variable FVB: Using pre-reserved block at %p\n",
766 Status
= ValidateFvHeader (Ptr
);
767 if (!EFI_ERROR (Status
)) {
768 DEBUG ((DEBUG_INFO
, "EMU Variable FVB: Found valid pre-existing FV\n"));
772 Ptr
= AllocateRuntimePages (EFI_SIZE_TO_PAGES (EMU_FVB_SIZE
));
775 mEmuVarsFvb
.BufferPtr
= Ptr
;
778 // Initialize the main FV header and variable store header
781 SetMem (Ptr
, EMU_FVB_SIZE
, ERASED_UINT8
);
782 InitializeFvAndVariableStoreHeaders (Ptr
);
785 PcdStatus
= PcdSet64S (PcdFlashNvStorageVariableBase64
, (UINTN
)Ptr
);
786 ASSERT_RETURN_ERROR (PcdStatus
);
789 // Initialize the Fault Tolerant Write data area
791 SubPtr
= (VOID
*)((UINT8
*)Ptr
+ PcdGet32 (PcdFlashNvStorageVariableSize
));
792 PcdStatus
= PcdSet64S (
793 PcdFlashNvStorageFtwWorkingBase64
,
796 ASSERT_RETURN_ERROR (PcdStatus
);
799 // Initialize the Fault Tolerant Write spare block
801 SubPtr
= (VOID
*)((UINT8
*)Ptr
+
802 EMU_FVB_NUM_SPARE_BLOCKS
* EMU_FVB_BLOCK_SIZE
);
803 PcdStatus
= PcdSet64S (
804 PcdFlashNvStorageFtwSpareBase64
,
807 ASSERT_RETURN_ERROR (PcdStatus
);
810 // Setup FVB device path
812 Address
= (EFI_PHYSICAL_ADDRESS
)(UINTN
)Ptr
;
813 mEmuVarsFvb
.DevicePath
.MemMapDevPath
.StartingAddress
= Address
;
814 mEmuVarsFvb
.DevicePath
.MemMapDevPath
.EndingAddress
= Address
+ EMU_FVB_SIZE
- 1;
817 // Install the protocols
819 DEBUG ((DEBUG_INFO
, "Installing FVB for EMU Variable support\n"));
821 Status
= gBS
->InstallMultipleProtocolInterfaces (
823 &gEfiFirmwareVolumeBlock2ProtocolGuid
,
824 &mEmuVarsFvb
.FwVolBlockInstance
,
825 &gEfiDevicePathProtocolGuid
,
826 &mEmuVarsFvb
.DevicePath
,
829 ASSERT_EFI_ERROR (Status
);
832 // Register for the virtual address change event
834 Status
= gBS
->CreateEventEx (
837 FvbVirtualAddressChangeEvent
,
839 &gEfiEventVirtualAddressChangeGuid
,
840 &mEmuVarsFvbAddrChangeEvent
842 ASSERT_EFI_ERROR (Status
);