2 Reset System Library functions for OVMF
4 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include <Base.h> // BIT1
11 #include <Library/BaseLib.h> // CpuDeadLoop()
12 #include <Library/DebugLib.h> // ASSERT()
13 #include <Library/IoLib.h> // IoWrite8()
14 #include <Library/ResetSystemLib.h> // ResetCold()
15 #include <Library/TimerLib.h> // MicroSecondDelay()
16 #include <Library/UefiRuntimeLib.h> // EfiGoneVirtual()
17 #include <OvmfPlatforms.h> // PIIX4_PMBA_VALUE
24 VOID
*Address
= (VOID
*)(UINTN
)MICROVM_GED_MMIO_BASE_REGS
;
26 if (EfiGoneVirtual ()) {
27 EfiConvertPointer (0, &Address
);
28 DEBUG ((DEBUG_INFO
, "%a: virtual -> 0x%x\n", __FUNCTION__
, Address
));
30 DEBUG ((DEBUG_INFO
, "%a: physical -> 0x%x\n", __FUNCTION__
, Address
));
33 return (UINTN
)Address
;
41 UINTN Address
= MicrovmGedBase ();
43 DEBUG ((DEBUG_INFO
, "%a: microvm reset via ged\n", __FUNCTION__
));
45 Address
+ MICROVM_ACPI_GED_REG_RESET
,
46 MICROVM_ACPI_GED_RESET_VALUE
56 UINTN Address
= MicrovmGedBase ();
58 DEBUG ((DEBUG_INFO
, "%a: microvm poweroff via ged\n", __FUNCTION__
));
60 Address
+ MICROVM_ACPI_GED_REG_SLEEP_CTL
,
61 (1 << 5) /* enable bit */ |
62 (5 << 2) /* typ == S5 */
85 ResetPlatformSpecific (
96 IN EFI_RESET_TYPE ResetType
,
97 IN EFI_STATUS ResetStatus
,
99 IN VOID
*ResetData OPTIONAL