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:41 -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 0335AC057FA6; Tue, 24 Sep 2019 11:35:41 +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 5B494600CC; Tue, 24 Sep 2019 11:35:38 +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 10/10] OvmfPkg/PlatformPei: detect SMRAM at default SMBASE (for real) Date: Tue, 24 Sep 2019 13:35:05 +0200 Message-Id: <20190924113505.27272-11-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.32]); Tue, 24 Sep 2019 11:35:41 +0000 (UTC) Content-Transfer-Encoding: quoted-printable Now that the SMRAM at the default SMBASE is honored everywhere necessary, implement the actual detection. The (simple) steps are described in previous patch "OvmfPkg/IndustryStandard: add MCH_DEFAULT_SMBASE* registe= r macros". 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 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDet= ect.c index 8fdc9c2ed7c9..3364193b4952 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -98,14 +98,23 @@ Q35SmramAtDefaultSmbaseInitialization ( VOID ) { + UINTN CtlReg; + UINT8 CtlRegVal; RETURN_STATUS PcdStatus; =20 ASSERT (mHostBridgeDevId =3D=3D INTEL_Q35_MCH_DEVICE_ID); =20 - mQ35SmramAtDefaultSmbase =3D FALSE; + CtlReg =3D DRAMC_REGISTER_Q35 (MCH_DEFAULT_SMBASE_CTL); + PciWrite8 (CtlReg, MCH_DEFAULT_SMBASE_QUERY); + CtlRegVal =3D PciRead8 (CtlReg); + + mQ35SmramAtDefaultSmbase =3D (BOOLEAN)(CtlRegVal =3D=3D MCH_DEFAULT_SM= BASE_IN_RAM); PcdStatus =3D PcdSetBoolS (PcdQ35SmramAtDefaultSmbase, mQ35SmramAtDefaultSmbase); ASSERT_RETURN_ERROR (PcdStatus); + if (mQ35SmramAtDefaultSmbase) { + DEBUG ((DEBUG_INFO, "%a: SMRAM at default SMBASE found\n", __FUNCTIO= N__)); + } } =20 =20 --=20 2.19.1.3.g30247aa5d201