From nobody Sat Nov 2 12:16:23 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 14906021452970.22350501342634743; Mon, 27 Mar 2017 01:09:05 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 604C820084745; Mon, 27 Mar 2017 01:08:58 -0700 (PDT) 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 DB951203BEBED for ; Mon, 27 Mar 2017 01:08:54 -0700 (PDT) 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:54 -0700 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:54 -0700 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490602134; x=1522138134; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=sYdc01kSWLAIa2ei6v7F/+sqKWe2aNd08l4Clcjye2A=; b=Jvn4xHXlzGHgvLZ/JPbAsdOxFLWKLZ6VyhOT9XWmeeHVo1cPUm3I9U2d zvhr9fg5m6OKSANuSaCj3xL73HkIFw==; X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,229,1486454400"; d="scan'208";a="80948345" From: Jordan Justen To: edk2-devel@lists.01.org Date: Mon, 27 Mar 2017 01:05:36 -0700 Message-Id: <20170327080544.24748-5-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: [edk2] [PATCH 04/12] OvmfPkg QemuFlash: Make QemuFlash.* Base class safe 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: , Cc: Jordan Justen , Laszlo Ersek 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" We will create a small 'NULL' base library to detect flash in PEI. Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen --- OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c | 30 +++++++++++-------= ---- OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.h | 16 +++++------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c b/OvmfPkg/Q= emuFlashFvbServicesRuntimeDxe/QemuFlash.c index 5677b5ee11..68388048f3 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c @@ -1,7 +1,7 @@ /** @file OVMF support for QEMU system firmware flash device =20 - Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -124,7 +124,7 @@ QemuFlashDetected ( @param[in] Buffer Pointer to the buffer to read into. =20 **/ -EFI_STATUS +RETURN_STATUS QemuFlashRead ( IN EFI_LBA Lba, IN UINTN Offset, @@ -139,7 +139,7 @@ QemuFlashRead ( // block into the flash memory. // if (Lba >=3D mFdBlockCount) { - return EFI_INVALID_PARAMETER; + return RETURN_INVALID_PARAMETER; } =20 // @@ -149,7 +149,7 @@ QemuFlashRead ( =20 CopyMem (Buffer, Ptr, *NumBytes); =20 - return EFI_SUCCESS; + return RETURN_SUCCESS; } =20 =20 @@ -163,7 +163,7 @@ QemuFlashRead ( @param[in] Buffer Pointer to the data to write. =20 **/ -EFI_STATUS +RETURN_STATUS QemuFlashWrite ( IN EFI_LBA Lba, IN UINTN Offset, @@ -179,7 +179,7 @@ QemuFlashWrite ( // block into the flash memory. // if (Lba >=3D mFdBlockCount) { - return EFI_INVALID_PARAMETER; + return RETURN_INVALID_PARAMETER; } =20 // @@ -199,7 +199,7 @@ QemuFlashWrite ( *(Ptr - 1) =3D READ_ARRAY_CMD; } =20 - return EFI_SUCCESS; + return RETURN_SUCCESS; } =20 =20 @@ -209,7 +209,7 @@ QemuFlashWrite ( @param Lba The logical block index to erase. =20 **/ -EFI_STATUS +RETURN_STATUS QemuFlashEraseBlock ( IN EFI_LBA Lba ) @@ -217,24 +217,24 @@ QemuFlashEraseBlock ( volatile UINT8 *Ptr; =20 if (Lba >=3D mFdBlockCount) { - return EFI_INVALID_PARAMETER; + return RETURN_INVALID_PARAMETER; } =20 Ptr =3D QemuFlashPtr (Lba, 0); *Ptr =3D BLOCK_ERASE_CMD; *Ptr =3D BLOCK_ERASE_CONFIRM_CMD; - return EFI_SUCCESS; + return RETURN_SUCCESS; } =20 =20 /** Initializes QEMU flash memory support =20 - @retval EFI_WRITE_PROTECTED The QEMU flash device is not present. - @retval EFI_SUCCESS The QEMU flash device is supported. + @retval RETURN_WRITE_PROTECTED The QEMU flash device is not present. + @retval RETURN_SUCCESS The QEMU flash device is supported. =20 **/ -EFI_STATUS +RETURN_STATUS QemuFlashInitialize ( VOID ) @@ -246,9 +246,9 @@ QemuFlashInitialize ( =20 if (!QemuFlashDetected ()) { ASSERT (!FeaturePcdGet (PcdSmmSmramRequire)); - return EFI_WRITE_PROTECTED; + return RETURN_WRITE_PROTECTED; } =20 - return EFI_SUCCESS; + return RETURN_SUCCESS; } =20 diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.h b/OvmfPkg/Q= emuFlashFvbServicesRuntimeDxe/QemuFlash.h index 8d83dca7a5..4bd971b0d1 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.h +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.h @@ -1,7 +1,7 @@ /** @file OVMF support for QEMU system firmware flash device =20 - Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -16,8 +16,6 @@ #ifndef __QEMU_FLASH_H__ #define __QEMU_FLASH_H__ =20 -#include - extern UINT8 *mFlashBase; =20 /** @@ -30,7 +28,7 @@ extern UINT8 *mFlashBase; @param[in] Buffer Pointer to the buffer to read into. =20 **/ -EFI_STATUS +RETURN_STATUS QemuFlashRead ( IN EFI_LBA Lba, IN UINTN Offset, @@ -49,7 +47,7 @@ QemuFlashRead ( @param[in] Buffer Pointer to the data to write. =20 **/ -EFI_STATUS +RETURN_STATUS QemuFlashWrite ( IN EFI_LBA Lba, IN UINTN Offset, @@ -64,7 +62,7 @@ QemuFlashWrite ( @param Lba The logical block index to erase. =20 **/ -EFI_STATUS +RETURN_STATUS QemuFlashEraseBlock ( IN EFI_LBA Lba ); @@ -73,11 +71,11 @@ QemuFlashEraseBlock ( /** Initializes QEMU flash memory support =20 - @retval EFI_WRITE_PROTECTED The QEMU flash device is not present. - @retval EFI_SUCCESS The QEMU flash device is supported. + @retval RETURN_WRITE_PROTECTED The QEMU flash device is not present. + @retval RETURN_SUCCESS The QEMU flash device is supported. =20 **/ -EFI_STATUS +RETURN_STATUS QemuFlashInitialize ( VOID ); --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel