TianoCore EDK2 master
Loading...
Searching...
No Matches
DxeResetSystemLibMicrovm.c
Go to the documentation of this file.
1
9#include <Base.h> // BIT1
10#include <PiDxe.h>
11
12#include <Library/BaseLib.h> // CpuDeadLoop()
13#include <Library/DebugLib.h> // ASSERT()
15#include <Library/IoLib.h> // IoWrite8()
16#include <Library/ResetSystemLib.h> // ResetCold()
17#include <Library/TimerLib.h> // MicroSecondDelay()
18#include <Library/UefiRuntimeLib.h> // EfiGoneVirtual()
19#include <OvmfPlatforms.h> // PIIX4_PMBA_VALUE
20
22EFIAPI
23DxeResetSystemLibMicrovmConstructor (
24 IN EFI_HANDLE ImageHandle,
25 IN EFI_SYSTEM_TABLE *SystemTable
26 )
27{
28 UINTN Address = MICROVM_GED_MMIO_BASE;
29 EFI_STATUS Status;
31
32 DEBUG ((DEBUG_INFO, "%a: start\n", __func__));
33
34 Status = gDS->GetMemorySpaceDescriptor (Address, &Descriptor);
35 if (EFI_ERROR (Status)) {
36 DEBUG ((DEBUG_INFO, "%a: GetMemorySpaceDescriptor failed\n", __func__));
37 return RETURN_UNSUPPORTED;
38 }
39
40 Status = gDS->SetMemorySpaceAttributes (
41 Address,
42 SIZE_4KB,
43 Descriptor.Attributes | EFI_MEMORY_RUNTIME
44 );
45 if (EFI_ERROR (Status)) {
46 DEBUG ((DEBUG_INFO, "%a: SetMemorySpaceAttributes failed\n", __func__));
47 return RETURN_UNSUPPORTED;
48 }
49
50 DEBUG ((DEBUG_INFO, "%a: done\n", __func__));
51 return EFI_SUCCESS;
52}
UINT64 UINTN
EFI_DXE_SERVICES * gDS
#define RETURN_UNSUPPORTED
Definition: Base.h:1081
#define IN
Definition: Base.h:279
#define DEBUG(Expression)
Definition: DebugLib.h:434
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112