From nobody Sat Nov 2 14:24:40 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1489534405384181.67958474928264; Tue, 14 Mar 2017 16:33:25 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 078AD803FF; Tue, 14 Mar 2017 16:33:13 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A199180331 for ; Tue, 14 Mar 2017 16:33:09 -0700 (PDT) Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4133212B48; Tue, 14 Mar 2017 23:33:10 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-194.phx2.redhat.com [10.3.116.194]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2ENWpwg006449; Tue, 14 Mar 2017 19:33:09 -0400 X-Original-To: edk2-devel@ml01.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Wed, 15 Mar 2017 00:32:44 +0100 Message-Id: <20170314233246.17864-13-lersek@redhat.com> In-Reply-To: <20170314233246.17864-1-lersek@redhat.com> References: <20170314233246.17864-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 14 Mar 2017 23:33:10 +0000 (UTC) Subject: [edk2] [PATCH 12/14] OvmfPkg/QemuFlashFvbServicesRuntimeDxe: don't set flash PCDs if SMM or no-emu X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" ... only check them. When OVMF is built with -D SMM_REQUIRE or with -D MEM_VARSTORE_EMU_ENABLE=3DFALSE then the PCDs are set during the PEI phase, as part of FaultTolerantWritePei's startup (in FlashNvStorageAddressLib's constructor). Cc: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c | 58 +++++++++++++= +------ 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c b/Ovmf= Pkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c index ff27c1100c01..62419a8fdf08 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c @@ -1093,24 +1093,46 @@ FvbInitialize ( =20 MarkMemoryRangeForRuntimeAccess (BaseAddress, Length); =20 - // - // Set several PCD values to point to flash - // - PcdStatus =3D PcdSet64S ( - PcdFlashNvStorageVariableBase64, - (UINTN) PcdGet32 (PcdOvmfFlashNvStorageVariableBase) - ); - ASSERT_RETURN_ERROR (PcdStatus); - PcdStatus =3D PcdSet32S ( - PcdFlashNvStorageFtwWorkingBase, - PcdGet32 (PcdOvmfFlashNvStorageFtwWorkingBase) - ); - ASSERT_RETURN_ERROR (PcdStatus); - PcdStatus =3D PcdSet32S ( - PcdFlashNvStorageFtwSpareBase, - PcdGet32 (PcdOvmfFlashNvStorageFtwSpareBase) - ); - ASSERT_RETURN_ERROR (PcdStatus); + if (!FeaturePcdGet (PcdSmmSmramRequire) && + FeaturePcdGet (PcdMemVarstoreEmuEnable)) { + // + // This build is suitable for both flash and in-memory emulated variab= les, + // and we happen to have found flash. Set several PCD values to point = to + // flash. + // + PcdStatus =3D PcdSet64S ( + PcdFlashNvStorageVariableBase64, + PcdGet32 (PcdOvmfFlashNvStorageVariableBase) + ); + ASSERT_RETURN_ERROR (PcdStatus); + PcdStatus =3D PcdSet32S ( + PcdFlashNvStorageFtwWorkingBase, + PcdGet32 (PcdOvmfFlashNvStorageFtwWorkingBase) + ); + ASSERT_RETURN_ERROR (PcdStatus); + PcdStatus =3D PcdSet32S ( + PcdFlashNvStorageFtwSpareBase, + PcdGet32 (PcdOvmfFlashNvStorageFtwSpareBase) + ); + ASSERT_RETURN_ERROR (PcdStatus); + } else { + // + // This build is suitable for flash variables only. Double-check sever= al + // PCDs that point to the flash. + // + ASSERT ( + (PcdGet64 (PcdFlashNvStorageVariableBase64) =3D=3D + PcdGet32 (PcdOvmfFlashNvStorageVariableBase)) + ); + ASSERT ( + (PcdGet32 (PcdFlashNvStorageFtwWorkingBase) =3D=3D + PcdGet32 (PcdOvmfFlashNvStorageFtwWorkingBase)) + ); + ASSERT ( + (PcdGet32 (PcdFlashNvStorageFtwSpareBase) =3D=3D + PcdGet32 (PcdOvmfFlashNvStorageFtwSpareBase)) + ); + } =20 FwhInstance =3D (EFI_FW_VOL_INSTANCE *) ( --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel