public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jordan Justen <jordan.l.justen@intel.com>
To: edk2-devel@lists.01.org
Cc: Jordan Justen <jordan.l.justen@intel.com>,
	Laszlo Ersek <lersek@redhat.com>
Subject: [PATCH 04/12] OvmfPkg QemuFlash: Make QemuFlash.* Base class safe
Date: Mon, 27 Mar 2017 01:05:36 -0700	[thread overview]
Message-ID: <20170327080544.24748-5-jordan.l.justen@intel.com> (raw)
In-Reply-To: <20170327080544.24748-1-jordan.l.justen@intel.com>

We will create a small 'NULL' base library to detect flash in PEI.

Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
---
 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/QemuFlashFvbServicesRuntimeDxe/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
 
-  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials are licensed and made available
   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.
 
 **/
-EFI_STATUS
+RETURN_STATUS
 QemuFlashRead (
   IN        EFI_LBA                              Lba,
   IN        UINTN                                Offset,
@@ -139,7 +139,7 @@ QemuFlashRead (
   // block into the flash memory.
   //
   if (Lba >= mFdBlockCount) {
-    return EFI_INVALID_PARAMETER;
+    return RETURN_INVALID_PARAMETER;
   }
 
   //
@@ -149,7 +149,7 @@ QemuFlashRead (
 
   CopyMem (Buffer, Ptr, *NumBytes);
 
-  return EFI_SUCCESS;
+  return RETURN_SUCCESS;
 }
 
 
@@ -163,7 +163,7 @@ QemuFlashRead (
   @param[in] Buffer   Pointer to the data to write.
 
 **/
-EFI_STATUS
+RETURN_STATUS
 QemuFlashWrite (
   IN        EFI_LBA                             Lba,
   IN        UINTN                               Offset,
@@ -179,7 +179,7 @@ QemuFlashWrite (
   // block into the flash memory.
   //
   if (Lba >= mFdBlockCount) {
-    return EFI_INVALID_PARAMETER;
+    return RETURN_INVALID_PARAMETER;
   }
 
   //
@@ -199,7 +199,7 @@ QemuFlashWrite (
     *(Ptr - 1) = READ_ARRAY_CMD;
   }
 
-  return EFI_SUCCESS;
+  return RETURN_SUCCESS;
 }
 
 
@@ -209,7 +209,7 @@ QemuFlashWrite (
   @param Lba    The logical block index to erase.
 
 **/
-EFI_STATUS
+RETURN_STATUS
 QemuFlashEraseBlock (
   IN   EFI_LBA      Lba
   )
@@ -217,24 +217,24 @@ QemuFlashEraseBlock (
   volatile UINT8  *Ptr;
 
   if (Lba >= mFdBlockCount) {
-    return EFI_INVALID_PARAMETER;
+    return RETURN_INVALID_PARAMETER;
   }
 
   Ptr = QemuFlashPtr (Lba, 0);
   *Ptr = BLOCK_ERASE_CMD;
   *Ptr = BLOCK_ERASE_CONFIRM_CMD;
-  return EFI_SUCCESS;
+  return RETURN_SUCCESS;
 }
 
 
 /**
   Initializes QEMU flash memory support
 
-  @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.
 
 **/
-EFI_STATUS
+RETURN_STATUS
 QemuFlashInitialize (
   VOID
   )
@@ -246,9 +246,9 @@ QemuFlashInitialize (
 
   if (!QemuFlashDetected ()) {
     ASSERT (!FeaturePcdGet (PcdSmmSmramRequire));
-    return EFI_WRITE_PROTECTED;
+    return RETURN_WRITE_PROTECTED;
   }
 
-  return EFI_SUCCESS;
+  return RETURN_SUCCESS;
 }
 
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.h b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/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
 
-  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials are licensed and made available
   under the terms and conditions of the BSD License which accompanies this
@@ -16,8 +16,6 @@
 #ifndef __QEMU_FLASH_H__
 #define __QEMU_FLASH_H__
 
-#include <Protocol/FirmwareVolumeBlock.h>
-
 extern UINT8 *mFlashBase;
 
 /**
@@ -30,7 +28,7 @@ extern UINT8 *mFlashBase;
   @param[in] Buffer   Pointer to the buffer to read into.
 
 **/
-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.
 
 **/
-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.
 
 **/
-EFI_STATUS
+RETURN_STATUS
 QemuFlashEraseBlock (
   IN   EFI_LBA      Lba
   );
@@ -73,11 +71,11 @@ QemuFlashEraseBlock (
 /**
   Initializes QEMU flash memory support
 
-  @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.
 
 **/
-EFI_STATUS
+RETURN_STATUS
 QemuFlashInitialize (
   VOID
   );
-- 
2.11.0



  parent reply	other threads:[~2017-03-27  8:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27  8:05 [PATCH 00/12] OvmfPkg: Enable variable access in PEI Jordan Justen
2017-03-27  8:05 ` [PATCH 01/12] OvmfPkg/build.sh: Add support for --disable-flash switch Jordan Justen
2017-03-27  8:05 ` [PATCH 02/12] OvmfPkg: resolve PcdLib for all PEIMs individually Jordan Justen
2017-03-27  8:05 ` [PATCH 03/12] OvmfPkg: resolve PcdLib for PEIMs to PeiPcdLib by default Jordan Justen
2017-03-27  8:05 ` Jordan Justen [this message]
2017-03-27  8:05 ` [PATCH 05/12] OvmfPkg QemuFlash: Make QemuFlashDetected external Jordan Justen
2017-03-27  8:05 ` [PATCH 06/12] OvmfPkg QemuFlash: Add DetectFlashBaseLib.inf 'NULL' library Jordan Justen
2017-03-27  8:05 ` [PATCH 07/12] OvmfPkg PlatformPei: Detect and set PcdOvmfFlashVariablesEnable Jordan Justen
2017-03-27  8:05 ` [PATCH 08/12] OvmfPkg/EmuVariableFvbRuntimeDxe: Use PcdOvmfFlashVariablesEnable Jordan Justen
2017-03-27  8:05 ` [PATCH 09/12] OvmfPkg PlatformPei: Set flash variable PCDs Jordan Justen
2017-03-27  8:05 ` [PATCH 10/12] OvmfPkg PlatformPei: Initialize memory based variable store buffer Jordan Justen
2017-03-27  8:05 ` [PATCH 11/12] OvmfPkg: Enable PEI variable access Jordan Justen
2017-03-27  8:05 ` [PATCH 12/12] OvmfPkg QemuFlashFvbServicesRuntimeDxe: Cleanup init now done in PEI Jordan Justen
2017-03-27 18:03 ` [PATCH 00/12] OvmfPkg: Enable variable access " Laszlo Ersek
2017-03-27 21:47   ` Jordan Justen
2017-03-28  9:22     ` Laszlo Ersek
2017-03-29  5:24       ` Jordan Justen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170327080544.24748-5-jordan.l.justen@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox