From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Tue, 24 Sep 2019 04:35:23 -0700 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 27E6089AC0; Tue, 24 Sep 2019 11:35:23 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-118.rdu2.redhat.com [10.10.120.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A4B7600CC; Tue, 24 Sep 2019 11:35:20 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Ard Biesheuvel , Boris Ostrovsky , Brijesh Singh , Igor Mammedov , Jiewen Yao , Joao M Martins , Jordan Justen , Jun Nakajima , Michael Kinney , Paolo Bonzini , Phillip Goerl , Yingwen Chen Subject: [PATCH wave 1 04/10] OvmfPkg/PlatformPei: factor out Q35BoardVerification() Date: Tue, 24 Sep 2019 13:34:59 +0200 Message-Id: <20190924113505.27272-5-lersek@redhat.com> In-Reply-To: <20190924113505.27272-1-lersek@redhat.com> References: <20190924113505.27272-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 24 Sep 2019 11:35:23 +0000 (UTC) Content-Transfer-Encoding: quoted-printable Before adding another SMM-related, and therefore Q35-only, dynamically detectable feature, extract the current board type check from Q35TsegMbytesInitialization() to a standalone function. Cc: Ard Biesheuvel Cc: Boris Ostrovsky Cc: Brijesh Singh Cc: Igor Mammedov Cc: Jiewen Yao Cc: Joao M Martins Cc: Jordan Justen Cc: Jun Nakajima Cc: Michael Kinney Cc: Paolo Bonzini Cc: Phillip Goerl Cc: Yingwen Chen Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1512 Signed-off-by: Laszlo Ersek --- OvmfPkg/PlatformPei/MemDetect.c | 13 +---------- OvmfPkg/PlatformPei/Platform.c | 23 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDet= ect.c index d451989f31c9..58b171fba1c8 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -53,18 +53,7 @@ Q35TsegMbytesInitialization ( UINT16 ExtendedTsegMbytes; RETURN_STATUS PcdStatus; =20 - if (mHostBridgeDevId !=3D INTEL_Q35_MCH_DEVICE_ID) { - DEBUG (( - DEBUG_ERROR, - "%a: no TSEG (SMRAM) on host bridge DID=3D0x%04x; " - "only DID=3D0x%04x (Q35) is supported\n", - __FUNCTION__, - mHostBridgeDevId, - INTEL_Q35_MCH_DEVICE_ID - )); - ASSERT (FALSE); - CpuDeadLoop (); - } + ASSERT (mHostBridgeDevId =3D=3D INTEL_Q35_MCH_DEVICE_ID); =20 // // Check if QEMU offers an extended TSEG. diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platfor= m.c index 3ba2459872d9..ca6d37cb1549 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -563,6 +563,28 @@ S3Verification ( } =20 =20 +VOID +Q35BoardVerification ( + VOID + ) +{ + if (mHostBridgeDevId =3D=3D INTEL_Q35_MCH_DEVICE_ID) { + return; + } + + DEBUG (( + DEBUG_ERROR, + "%a: no TSEG (SMRAM) on host bridge DID=3D0x%04x; " + "only DID=3D0x%04x (Q35) is supported\n", + __FUNCTION__, + mHostBridgeDevId, + INTEL_Q35_MCH_DEVICE_ID + )); + ASSERT (FALSE); + CpuDeadLoop (); +} + + /** Fetch the number of boot CPUs from QEMU and expose it to UefiCpuPkg mo= dules. Set the mMaxCpuCount variable. @@ -646,6 +668,7 @@ InitializePlatform ( mHostBridgeDevId =3D PciRead16 (OVMF_HOSTBRIDGE_DID); =20 if (FeaturePcdGet (PcdSmmSmramRequire)) { + Q35BoardVerification (); Q35TsegMbytesInitialization (); } =20 --=20 2.19.1.3.g30247aa5d201