From: jljusten Date: Mon, 4 Mar 2013 17:38:42 +0000 (+0000) Subject: OvmfPkg: make sure ResetCold() and ResetWarm() never return X-Git-Tag: edk2-stable201903~12687 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=fb2ae5fdb5207233e9be8f73d552860d9169fa8e OvmfPkg: make sure ResetCold() and ResetWarm() never return Also, add a small delay after the 0xCF9 hard reset request -- on qemu/kvm the port access is translated to the qemu-internal system reset request by the CPU thread, and it might progress some more before the IO thread acts upon the system reset request. MicroSecondDelay() is implemented by OvmfPkg's own AcpiTimerLib. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14158 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c index 85af7f1250..d075fbef0a 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -17,6 +17,7 @@ #include #include #include +#include VOID AcpiPmControl ( @@ -46,7 +47,10 @@ ResetCold ( ) { IoWrite8 (0xCF9, BIT2 | BIT1); // 1st choice: PIIX3 RCR, RCPU|SRST + MicroSecondDelay (50); + IoWrite8 (0x64, 0xfe); // 2nd choice: keyboard controller + CpuDeadLoop (); } /** @@ -63,6 +67,7 @@ ResetWarm ( ) { IoWrite8 (0x64, 0xfe); + CpuDeadLoop (); } /** diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf index 0694b4dd3c..c4d8ce54bf 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf @@ -35,4 +35,4 @@ [LibraryClasses] DebugLib IoLib - + TimerLib