summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2013-03-04 17:38:42 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2013-03-04 17:38:42 +0000
commitfb2ae5fdb5207233e9be8f73d552860d9169fa8e (patch)
tree35a225eeb9c7d6250023830fc1dd521f315e1d48
parentcb7b12ee3c9604bd6d633a40cff1c34ad37851e7 (diff)
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 <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14158 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c5
-rw-r--r--OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf2
2 files changed, 6 insertions, 1 deletions
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
index 85af7f125..d075fbef0 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -17,6 +17,7 @@
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/IoLib.h>
+#include <Library/TimerLib.h>
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 0694b4dd3..c4d8ce54b 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
@@ -35,4 +35,4 @@
[LibraryClasses]
DebugLib
IoLib
-
+ TimerLib