From d9fb9c50028ab90b0a1b044c9d13f3143f6093aa Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 2 Dec 2022 14:10:04 +0100 Subject: [PATCH 26/32] OvmfPkg/PlatformPei: Verification: stop using mPlatformInfoHob Stop using the mPlatformInfoHob global variable in S3Verification() and Q35BoardVerification() functions. Pass a pointer to the PlatformInfoHob instead. Signed-off-by: Gerd Hoffmann Tested-by: Tom Lendacky Acked-by: Ard Biesheuvel (cherry picked from commit 4bc2c748516e5c4a8bb86093cd5e1b80a9f35c0f) --- OvmfPkg/PlatformPei/Platform.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index 8307a80617fc..6e31c5fc1f41 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -243,13 +243,14 @@ ReserveEmuVariableNvStore ( ASSERT_RETURN_ERROR (PcdStatus); } +STATIC VOID S3Verification ( - VOID + IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { #if defined (MDE_CPU_X64) - if (mPlatformInfoHob.SmmSmramRequire && mPlatformInfoHob.S3Supported) { + if (PlatformInfoHob->SmmSmramRequire && PlatformInfoHob->S3Supported) { DEBUG (( DEBUG_ERROR, "%a: S3Resume2Pei doesn't support X64 PEI + SMM yet.\n", @@ -272,12 +273,13 @@ S3Verification ( #endif } +STATIC VOID Q35BoardVerification ( - VOID + IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { - if (mPlatformInfoHob.HostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID) { + if (PlatformInfoHob->HostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID) { return; } @@ -286,7 +288,7 @@ Q35BoardVerification ( "%a: no TSEG (SMRAM) on host bridge DID=0x%04x; " "only DID=0x%04x (Q35) is supported\n", __FUNCTION__, - mPlatformInfoHob.HostBridgeDevId, + PlatformInfoHob->HostBridgeDevId, INTEL_Q35_MCH_DEVICE_ID )); ASSERT (FALSE); @@ -357,7 +359,7 @@ InitializePlatform ( ASSERT_EFI_ERROR (Status); } - S3Verification (); + S3Verification (&mPlatformInfoHob); BootModeInitialization (&mPlatformInfoHob); // @@ -369,7 +371,7 @@ InitializePlatform ( MaxCpuCountInitialization (&mPlatformInfoHob); if (mPlatformInfoHob.SmmSmramRequire) { - Q35BoardVerification (); + Q35BoardVerification (&mPlatformInfoHob); Q35TsegMbytesInitialization (&mPlatformInfoHob); Q35SmramAtDefaultSmbaseInitialization (&mPlatformInfoHob); } -- 2.38.1