summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Library/ResetSystemLib
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2016-05-09 21:04:47 +0200
committerLaszlo Ersek <lersek@redhat.com>2016-05-17 20:48:39 +0200
commit1466b76f938501269d1c95f068b6d4938acec22d (patch)
tree0a8703db48c6de2a1a66f91e20824f104fc7a9fe /OvmfPkg/Library/ResetSystemLib
parentb97af6d42bfaba836a685a0df75e0304170d7a87 (diff)
downloadedk2-1466b76f938501269d1c95f068b6d4938acec22d.tar.gz
edk2-1466b76f938501269d1c95f068b6d4938acec22d.tar.bz2
edk2-1466b76f938501269d1c95f068b6d4938acec22d.zip
OvmfPkg: determine PMBA value dependent on host bridge device ID
In this patch, the AcpiTimerLib instances, ResetSystemLib, and PlatformPei are modified together in order to keep VMs functional across a bisection: they all must agree on the PMBA value used. ResetSystemLib must not use dynamic PCDs. With SOURCE_DEBUG_ENABLE, it gets linked into the debug agent, therefore the same restrictions apply to it as to BaseRomAcpiTimerLib. Luckily, AcpiPmControl() is only used for powering off the virtual machine, thus the extra cost of a PCI config space read, compared to a PcdGet16(), should be negligible. This is the patch that moves the PMBA to IO port 0x0600 on Q35 in practice. The ResetSystemLib change is easiest to verify with the "reset -s" command in the UEFI shell (which goes through gRT->ResetSystem() and, in OVMF, PcAtChipsetPkg/KbcResetDxe). Cc: Gabriel Somlo <somlo@cmu.edu> Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1333238 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Gabriel Somlo <somlo@cmu.edu>
Diffstat (limited to 'OvmfPkg/Library/ResetSystemLib')
-rw-r--r--OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
index 308a600214..399f547d91 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -18,6 +18,7 @@
#include <Library/DebugLib.h>
#include <Library/IoLib.h>
#include <Library/TimerLib.h>
+#include <OvmfPlatforms.h>
#include <OvmfPlatforms.h>
@@ -26,10 +27,27 @@ AcpiPmControl (
UINTN SuspendType
)
{
+ UINT16 AcpiPmBaseAddress;
+ UINT16 HostBridgeDevId;
+
ASSERT (SuspendType < 6);
- IoBitFieldWrite16 (PIIX4_PMBA_VALUE + 4, 10, 13, (UINT16) SuspendType);
- IoOr16 (PIIX4_PMBA_VALUE + 4, BIT13);
+ AcpiPmBaseAddress = 0;
+ HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
+ switch (HostBridgeDevId) {
+ case INTEL_82441_DEVICE_ID:
+ AcpiPmBaseAddress = PIIX4_PMBA_VALUE;
+ break;
+ case INTEL_Q35_MCH_DEVICE_ID:
+ AcpiPmBaseAddress = ICH9_PMBASE_VALUE;
+ break;
+ default:
+ ASSERT (FALSE);
+ CpuDeadLoop ();
+ }
+
+ IoBitFieldWrite16 (AcpiPmBaseAddress + 4, 10, 13, (UINT16) SuspendType);
+ IoOr16 (AcpiPmBaseAddress + 4, BIT13);
CpuDeadLoop ();
}