135 lines
4.6 KiB
Diff
135 lines
4.6 KiB
Diff
|
From 1f0cc9c8bbc387a3e39daea604931fc819ba1650 Mon Sep 17 00:00:00 2001
|
||
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
||
|
Date: Fri, 2 Dec 2022 14:10:00 +0100
|
||
|
Subject: [PATCH 22/32] OvmfPkg/PlatformPei Q35 SMM helpers: stop using
|
||
|
mPlatformInfoHob
|
||
|
|
||
|
Stop using the mPlatformInfoHob global variable in
|
||
|
Q35TsegMbytesInitialization() and
|
||
|
Q35SmramAtDefaultSmbaseInitialization() ) functions.
|
||
|
Pass a pointer to the PlatformInfoHob instead.
|
||
|
|
||
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||
|
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
|
||
|
Acked-by: Ard Biesheuvel <ardb@kernel.org>
|
||
|
(cherry picked from commit 00743d144bc5b643e9323ad66f16cb48cf338705)
|
||
|
---
|
||
|
OvmfPkg/PlatformPei/Platform.h | 4 ++--
|
||
|
OvmfPkg/PlatformPei/MemDetect.c | 20 ++++++++++----------
|
||
|
OvmfPkg/PlatformPei/Platform.c | 4 ++--
|
||
|
3 files changed, 14 insertions(+), 14 deletions(-)
|
||
|
|
||
|
diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h
|
||
|
index b13f45ecdb69..7baa5e1d289f 100644
|
||
|
--- a/OvmfPkg/PlatformPei/Platform.h
|
||
|
+++ b/OvmfPkg/PlatformPei/Platform.h
|
||
|
@@ -22,12 +22,12 @@ AddressWidthInitialization (
|
||
|
|
||
|
VOID
|
||
|
Q35TsegMbytesInitialization (
|
||
|
- VOID
|
||
|
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
|
||
|
);
|
||
|
|
||
|
VOID
|
||
|
Q35SmramAtDefaultSmbaseInitialization (
|
||
|
- VOID
|
||
|
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
|
||
|
);
|
||
|
|
||
|
EFI_STATUS
|
||
|
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
|
||
|
index 2e47b1322990..b9207107b4d9 100644
|
||
|
--- a/OvmfPkg/PlatformPei/MemDetect.c
|
||
|
+++ b/OvmfPkg/PlatformPei/MemDetect.c
|
||
|
@@ -41,13 +41,13 @@ Module Name:
|
||
|
|
||
|
VOID
|
||
|
Q35TsegMbytesInitialization (
|
||
|
- VOID
|
||
|
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
|
||
|
)
|
||
|
{
|
||
|
UINT16 ExtendedTsegMbytes;
|
||
|
RETURN_STATUS PcdStatus;
|
||
|
|
||
|
- ASSERT (mPlatformInfoHob.HostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID);
|
||
|
+ ASSERT (PlatformInfoHob->HostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID);
|
||
|
|
||
|
//
|
||
|
// Check if QEMU offers an extended TSEG.
|
||
|
@@ -68,7 +68,7 @@ Q35TsegMbytesInitialization (
|
||
|
PciWrite16 (DRAMC_REGISTER_Q35 (MCH_EXT_TSEG_MB), MCH_EXT_TSEG_MB_QUERY);
|
||
|
ExtendedTsegMbytes = PciRead16 (DRAMC_REGISTER_Q35 (MCH_EXT_TSEG_MB));
|
||
|
if (ExtendedTsegMbytes == MCH_EXT_TSEG_MB_QUERY) {
|
||
|
- mPlatformInfoHob.Q35TsegMbytes = PcdGet16 (PcdQ35TsegMbytes);
|
||
|
+ PlatformInfoHob->Q35TsegMbytes = PcdGet16 (PcdQ35TsegMbytes);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
@@ -80,19 +80,19 @@ Q35TsegMbytesInitialization (
|
||
|
));
|
||
|
PcdStatus = PcdSet16S (PcdQ35TsegMbytes, ExtendedTsegMbytes);
|
||
|
ASSERT_RETURN_ERROR (PcdStatus);
|
||
|
- mPlatformInfoHob.Q35TsegMbytes = ExtendedTsegMbytes;
|
||
|
+ PlatformInfoHob->Q35TsegMbytes = ExtendedTsegMbytes;
|
||
|
}
|
||
|
|
||
|
VOID
|
||
|
Q35SmramAtDefaultSmbaseInitialization (
|
||
|
- VOID
|
||
|
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
|
||
|
)
|
||
|
{
|
||
|
RETURN_STATUS PcdStatus;
|
||
|
|
||
|
- ASSERT (mPlatformInfoHob.HostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID);
|
||
|
+ ASSERT (PlatformInfoHob->HostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID);
|
||
|
|
||
|
- mPlatformInfoHob.Q35SmramAtDefaultSmbase = FALSE;
|
||
|
+ PlatformInfoHob->Q35SmramAtDefaultSmbase = FALSE;
|
||
|
if (FeaturePcdGet (PcdCsmEnable)) {
|
||
|
DEBUG ((
|
||
|
DEBUG_INFO,
|
||
|
@@ -106,19 +106,19 @@ Q35SmramAtDefaultSmbaseInitialization (
|
||
|
CtlReg = DRAMC_REGISTER_Q35 (MCH_DEFAULT_SMBASE_CTL);
|
||
|
PciWrite8 (CtlReg, MCH_DEFAULT_SMBASE_QUERY);
|
||
|
CtlRegVal = PciRead8 (CtlReg);
|
||
|
- mPlatformInfoHob.Q35SmramAtDefaultSmbase = (BOOLEAN)(CtlRegVal ==
|
||
|
+ PlatformInfoHob->Q35SmramAtDefaultSmbase = (BOOLEAN)(CtlRegVal ==
|
||
|
MCH_DEFAULT_SMBASE_IN_RAM);
|
||
|
DEBUG ((
|
||
|
DEBUG_INFO,
|
||
|
"%a: SMRAM at default SMBASE %a\n",
|
||
|
__FUNCTION__,
|
||
|
- mPlatformInfoHob.Q35SmramAtDefaultSmbase ? "found" : "not found"
|
||
|
+ PlatformInfoHob->Q35SmramAtDefaultSmbase ? "found" : "not found"
|
||
|
));
|
||
|
}
|
||
|
|
||
|
PcdStatus = PcdSetBoolS (
|
||
|
PcdQ35SmramAtDefaultSmbase,
|
||
|
- mPlatformInfoHob.Q35SmramAtDefaultSmbase
|
||
|
+ PlatformInfoHob->Q35SmramAtDefaultSmbase
|
||
|
);
|
||
|
ASSERT_RETURN_ERROR (PcdStatus);
|
||
|
}
|
||
|
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
|
||
|
index 5ecd5d8b1ab6..402b2e88461e 100644
|
||
|
--- a/OvmfPkg/PlatformPei/Platform.c
|
||
|
+++ b/OvmfPkg/PlatformPei/Platform.c
|
||
|
@@ -369,8 +369,8 @@ InitializePlatform (
|
||
|
|
||
|
if (mPlatformInfoHob.SmmSmramRequire) {
|
||
|
Q35BoardVerification ();
|
||
|
- Q35TsegMbytesInitialization ();
|
||
|
- Q35SmramAtDefaultSmbaseInitialization ();
|
||
|
+ Q35TsegMbytesInitialization (&mPlatformInfoHob);
|
||
|
+ Q35SmramAtDefaultSmbaseInitialization (&mPlatformInfoHob);
|
||
|
}
|
||
|
|
||
|
PublishPeiMemory ();
|
||
|
--
|
||
|
2.38.1
|
||
|
|