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:26 -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 22930804F2; Tue, 24 Sep 2019 11:35:26 +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 799D9600CC; Tue, 24 Sep 2019 11:35:23 +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 05/10] OvmfPkg/PlatformPei: detect SMRAM at default SMBASE (skeleton) Date: Tue, 24 Sep 2019 13:35:00 +0200 Message-Id: <20190924113505.27272-6-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.27]); Tue, 24 Sep 2019 11:35:26 +0000 (UTC) Content-Transfer-Encoding: quoted-printable Introduce the Q35SmramAtDefaultSmbaseInitialization() function for detecting the "SMRAM at default SMBASE" feature. For now, the function is only a skeleton, so that we can gradually build upon the result while the result is hard-coded as FALSE. The actual detection will occur in a later patch. 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/PlatformPei.inf | 1 + OvmfPkg/PlatformPei/Platform.h | 7 +++++++ OvmfPkg/PlatformPei/MemDetect.c | 18 ++++++++++++++++++ OvmfPkg/PlatformPei/Platform.c | 1 + 4 files changed, 27 insertions(+) diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/Pl= atformPei.inf index d9fd9c8f05b3..2b0c2c886929 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -84,6 +84,7 @@ [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDecompressionScratchEnd gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes + gUefiOvmfPkgTokenSpaceGuid.PcdQ35SmramAtDefaultSmbase gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platfor= m.h index 2f3cebcd3a6a..43f20f067f22 100644 --- a/OvmfPkg/PlatformPei/Platform.h +++ b/OvmfPkg/PlatformPei/Platform.h @@ -52,6 +52,11 @@ Q35TsegMbytesInitialization ( VOID ); =20 +VOID +Q35SmramAtDefaultSmbaseInitialization ( + VOID + ); + EFI_STATUS PublishPeiMemory ( VOID @@ -119,6 +124,8 @@ extern UINT32 mMaxCpuCount; =20 extern UINT16 mHostBridgeDevId; =20 +extern BOOLEAN mQ35SmramAtDefaultSmbase; + extern UINT32 mQemuUc32Base; =20 #endif // _PLATFORM_PEI_H_INCLUDED_ diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDet= ect.c index 58b171fba1c8..2bc1c46dffc2 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -43,6 +43,8 @@ STATIC UINT32 mS3AcpiReservedMemorySize; =20 STATIC UINT16 mQ35TsegMbytes; =20 +BOOLEAN mQ35SmramAtDefaultSmbase; + UINT32 mQemuUc32Base; =20 VOID @@ -90,6 +92,22 @@ Q35TsegMbytesInitialization ( } =20 =20 +VOID +Q35SmramAtDefaultSmbaseInitialization ( + VOID + ) +{ + RETURN_STATUS PcdStatus; + + ASSERT (mHostBridgeDevId =3D=3D INTEL_Q35_MCH_DEVICE_ID); + + mQ35SmramAtDefaultSmbase =3D FALSE; + PcdStatus =3D PcdSetBoolS (PcdQ35SmramAtDefaultSmbase, + mQ35SmramAtDefaultSmbase); + ASSERT_RETURN_ERROR (PcdStatus); +} + + VOID QemuUc32BaseInitialization ( VOID diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platfor= m.c index ca6d37cb1549..6989712b0645 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -670,6 +670,7 @@ InitializePlatform ( if (FeaturePcdGet (PcdSmmSmramRequire)) { Q35BoardVerification (); Q35TsegMbytesInitialization (); + Q35SmramAtDefaultSmbaseInitialization (); } =20 PublishPeiMemory (); --=20 2.19.1.3.g30247aa5d201