summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Library/ResetSystemLib
diff options
context:
space:
mode:
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 ();
}