/* Pre-validate the system RAM when SEV-SNP is enabled in the guest VM. */
VOID EFIAPI MemEncryptSevSnpPreValidateSystemRam(IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages)
/* Pre-validate the system RAM when SEV-SNP is enabled in the guest VM. */
VOID EFIAPI MemEncryptSevSnpPreValidateSystemRam(IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages)
{
  EFI_STATUS  Status;
  if (!MemEncryptSevSnpIsEnabled ()) {
    return;
  }
  if (BaseAddress >= SIZE_4GB) {
    Status = InternalMemEncryptSevCreateIdentityMap1G (
               0,
               BaseAddress,
               EFI_PAGES_TO_SIZE (NumPages)
               );
    if (EFI_ERROR (Status)) {
      ASSERT (FALSE);
      CpuDeadLoop ();
    }
  }
  InternalSetPageState (BaseAddress, NumPages, SevSnpPagePrivate, TRUE);
}