From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 E4F0C203BEBE0 for ; Mon, 27 Mar 2017 01:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490602135; x=1522138135; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=uwKcrLbx3wiK/mdtQkhm+YZqs1Qdoi66e5Ki0RvT0X0=; b=xPuIgShsutIX++iv3PbY+CsN89O0PXqag1tuvcsKfJXjX0sBwrSjI1vr 53NH/ns8U2OXOKp70i9qqvMKCbJYFA==; Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2017 01:08:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,229,1486454400"; d="scan'208";a="80948358" Received: from junghyun-mobl.amr.corp.intel.com (HELO jljusten-skl.amr.corp.intel.com) ([10.252.131.12]) by fmsmga005.fm.intel.com with ESMTP; 27 Mar 2017 01:08:55 -0700 From: Jordan Justen To: edk2-devel@lists.01.org Cc: Jordan Justen , Laszlo Ersek Date: Mon, 27 Mar 2017 01:05:38 -0700 Message-Id: <20170327080544.24748-7-jordan.l.justen@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170327080544.24748-1-jordan.l.justen@intel.com> References: <20170327080544.24748-1-jordan.l.justen@intel.com> Subject: [PATCH 06/12] OvmfPkg QemuFlash: Add DetectFlashBaseLib.inf 'NULL' library X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Mar 2017 08:08:56 -0000 This library attempts to detect QEMU flash. If writable flash is detected, then PcdOvmfFlashVariablesEnable is set to TRUE. Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen --- .../DetectFlashNullLib.c | 41 +++++++++++++++ .../DetectFlashNullLib.inf | 60 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 OvmfPkg/QemuFlashFvbServicesRuntimeDxe/DetectFlashNullLib.c create mode 100644 OvmfPkg/QemuFlashFvbServicesRuntimeDxe/DetectFlashNullLib.inf diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/DetectFlashNullLib.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/DetectFlashNullLib.c new file mode 100644 index 0000000000..cfa6026ff2 --- /dev/null +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/DetectFlashNullLib.c @@ -0,0 +1,41 @@ +/** @file + OVMF support for QEMU system firmware flash device + + Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include +#include + +#include "QemuFlash.h" + + +/** + Initializes QEMU flash memory support + + @retval !RETURN_SUCCESS Failed to set the PCD + @retval RETURN_SUCCESS The constructor was successful + +**/ +RETURN_STATUS +EFIAPI +DetectFlashConstructor ( + VOID + ) +{ + if (QemuFlashDetected ()) { + return PcdSetBoolS (PcdOvmfFlashVariablesEnable, TRUE); + } + + return RETURN_SUCCESS; +} diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/DetectFlashNullLib.inf b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/DetectFlashNullLib.inf new file mode 100644 index 0000000000..1b7717af3e --- /dev/null +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/DetectFlashNullLib.inf @@ -0,0 +1,60 @@ +## @file +# This is a small library with a constructor that will set a PCD if +# writable flash is detected. +# +# Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DetectFlashNullLib + FILE_GUID = 6ec93337-513a-4188-bf57-7bb746c6e8ac + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = NULL|PEIM DXE_RUNTIME_DRIVER DXE_SMM_DRIVER + CONSTRUCTOR = DetectFlashConstructor + +# +# The following information is for reference only and not required by the build +# tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + DetectFlashNullLib.c + QemuFlash.c + +[Packages] + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + PcdLib + +[FixedPcd] + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize + +[Pcd] + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable + +[FeaturePcd] + gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire + +[Depex] + TRUE -- 2.11.0