]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Library/ResetSystemLib/DxeResetSystemLibMicrovm.c
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / Library / ResetSystemLib / DxeResetSystemLibMicrovm.c
CommitLineData
1d3e89f3
GH
1/** @file\r
2 Reset System Library functions for OVMF\r
3\r
4 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
6\r
7**/\r
8\r
9#include <Base.h> // BIT1\r
10#include <PiDxe.h>\r
11\r
12#include <Library/BaseLib.h> // CpuDeadLoop()\r
13#include <Library/DebugLib.h> // ASSERT()\r
14#include <Library/DxeServicesTableLib.h>\r
15#include <Library/IoLib.h> // IoWrite8()\r
16#include <Library/ResetSystemLib.h> // ResetCold()\r
17#include <Library/TimerLib.h> // MicroSecondDelay()\r
18#include <Library/UefiRuntimeLib.h> // EfiGoneVirtual()\r
19#include <OvmfPlatforms.h> // PIIX4_PMBA_VALUE\r
20\r
21EFI_STATUS\r
22EFIAPI\r
23DxeResetSystemLibMicrovmConstructor (\r
24 IN EFI_HANDLE ImageHandle,\r
25 IN EFI_SYSTEM_TABLE *SystemTable\r
26 )\r
27{\r
28 UINTN Address = MICROVM_GED_MMIO_BASE;\r
29 EFI_STATUS Status;\r
30 EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;\r
31\r
32 DEBUG ((DEBUG_INFO, "%a: start\n", __FUNCTION__));\r
33\r
34 Status = gDS->GetMemorySpaceDescriptor (Address, &Descriptor);\r
35 if (EFI_ERROR (Status)) {\r
36 DEBUG ((DEBUG_INFO, "%a: GetMemorySpaceDescriptor failed\n", __FUNCTION__));\r
37 return RETURN_UNSUPPORTED;\r
38 }\r
39\r
ac0a286f
MK
40 Status = gDS->SetMemorySpaceAttributes (\r
41 Address,\r
42 SIZE_4KB,\r
43 Descriptor.Attributes | EFI_MEMORY_RUNTIME\r
44 );\r
1d3e89f3
GH
45 if (EFI_ERROR (Status)) {\r
46 DEBUG ((DEBUG_INFO, "%a: SetMemorySpaceAttributes failed\n", __FUNCTION__));\r
47 return RETURN_UNSUPPORTED;\r
48 }\r
49\r
50 DEBUG ((DEBUG_INFO, "%a: done\n", __FUNCTION__));\r
51 return EFI_SUCCESS;\r
52}\r