/** @file
Reset System Library functions for OVMF
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include // BIT1
#include
#include // CpuDeadLoop()
#include // ASSERT()
#include
#include // IoWrite8()
#include // ResetCold()
#include // MicroSecondDelay()
#include // EfiGoneVirtual()
#include // PIIX4_PMBA_VALUE
EFI_STATUS
EFIAPI
DxeResetSystemLibMicrovmConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
UINTN Address = MICROVM_GED_MMIO_BASE;
EFI_STATUS Status;
EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
DEBUG ((DEBUG_INFO, "%a: start\n", __func__));
Status = gDS->GetMemorySpaceDescriptor (Address, &Descriptor);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "%a: GetMemorySpaceDescriptor failed\n", __func__));
return RETURN_UNSUPPORTED;
}
Status = gDS->SetMemorySpaceAttributes (
Address,
SIZE_4KB,
Descriptor.Attributes | EFI_MEMORY_RUNTIME
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "%a: SetMemorySpaceAttributes failed\n", __func__));
return RETURN_UNSUPPORTED;
}
DEBUG ((DEBUG_INFO, "%a: done\n", __func__));
return EFI_SUCCESS;
}