public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: devel@edk2.groups.io
Cc: Umang Patel <umang.patel@intel.com>,
	Jian J Wang <jian.j.wang@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>
Subject: [Patch 1/2] MdeModulePkg/Include/Ppi: Add FirmwareVolumeShadowPpi
Date: Tue, 21 Mar 2023 19:06:25 -0700	[thread overview]
Message-ID: <20230322020626.441-2-michael.d.kinney@intel.com> (raw)
In-Reply-To: <20230322020626.441-1-michael.d.kinney@intel.com>

From: Umang Patel <umang.patel@intel.com>

Add FirmwareVolumeShadow PPI to shadow an FV to memory.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Patel Umang <umang.patel@intel.com>
---
 .../Include/Ppi/FirmwareVolumeShadowPpi.h     | 61 +++++++++++++++++++
 MdeModulePkg/MdeModulePkg.dec                 |  3 +
 2 files changed, 64 insertions(+)
 create mode 100644 MdeModulePkg/Include/Ppi/FirmwareVolumeShadowPpi.h

diff --git a/MdeModulePkg/Include/Ppi/FirmwareVolumeShadowPpi.h b/MdeModulePkg/Include/Ppi/FirmwareVolumeShadowPpi.h
new file mode 100644
index 000000000000..a2756cb0ab1e
--- /dev/null
+++ b/MdeModulePkg/Include/Ppi/FirmwareVolumeShadowPpi.h
@@ -0,0 +1,61 @@
+/** @file
+  Define PPI to shadow Firmware Volume from flash to Permanent Memory.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef PEI_FIRMWARE_VOLUME_SHADOW_PPI_H_
+#define PEI_FIRMWARE_VOLUME_SHADOW_PPI_H_
+
+//
+// Firmware Volume Shadow PPI GUID value
+//
+#define EDKII_FIRMWARE_VOLUME_SHADOW_PPI_GUID \
+  { \
+    0x7dfe756c, 0xed8d, 0x4d77, { 0x9e, 0xc4, 0x39, 0x9a, 0x8a, 0x81, 0x51, 0x16 } \
+  }
+
+/**
+  Copy FV to Destination.  Length of copy is FV length from FV Header.
+
+  @param[in]  FirmwareVolumeBase  Base address of FV to shadow. Length of FV
+                                  is in FV Header.
+  @param[in]  Destination         Pointer to the Buffer in system memory to
+                                  shadow FV.
+  @param[in]  DestinationLength   Size of Destination buffer in bytes.
+
+  @retval EFI_SUCCESS            Shadow complete
+  @retval EFI_INVALID_PARAMETER  Destination is NULL
+  @retval EFI_INVALID_PARAMETER  DestinationLength = 0.
+  @retval EFI_INVALID_PARAMETER  FV does not have valid FV Header.
+  @retval EFI_INVALID_PARAMETER  FV overlaps Destination.
+  @retval EFI_INVALID_PARAMETER  Destination + DestinationLength rolls over 4GB
+                                 for 32-bit or 64-bit rollover.
+  @retval EFI_BUFFER_TOO_SMALL   DestinationLength less than FV length from FV
+                                 Header.
+  @retval EFI_UNSUPPORTED        FirmwareVolumeBase to FVBase + FVLength does
+                                 not support shadow.  Caller should fallback to
+                                 CopyMem().
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_PEI_FIRMWARE_VOLUME_SHADOW)(
+  IN EFI_PHYSICAL_ADDRESS  FirmwareVolumeBase,
+  IN VOID                  *Destination,
+  IN UINTN                 DestinationLength
+  );
+
+///
+/// This PPI provides a service to shadow a FV from one location to another
+///
+typedef struct {
+  EDKII_PEI_FIRMWARE_VOLUME_SHADOW    FirmwareVolumeShadow;
+} EDKII_PEI_FIRMWARE_VOLUME_SHADOW_PPI;
+
+extern EFI_GUID  gEdkiiPeiFirmwareVolumeShadowPpiGuid;
+
+#endif
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index e8058c8bfaec..3eb4a79bf7a0 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -442,6 +442,9 @@ [Guids]
   gBootDiscoveryPolicyMgrFormsetGuid = { 0x5b6f7107, 0xbb3c, 0x4660, { 0x92, 0xcd, 0x54, 0x26, 0x90, 0x28, 0x0b, 0xbd } }
 
 [Ppis]
+  ## Include/Ppi/FirmwareVolumeShadowPpi.h
+  gEdkiiPeiFirmwareVolumeShadowPpiGuid = { 0x7dfe756c, 0xed8d, 0x4d77, {0x9e, 0xc4, 0x39, 0x9a, 0x8a, 0x81, 0x51, 0x16 } }
+
   ## Include/Ppi/AtaController.h
   gPeiAtaControllerPpiGuid       = { 0xa45e60d1, 0xc719, 0x44aa, { 0xb0, 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d }}
 
-- 
2.39.1.windows.1


  reply	other threads:[~2023-03-22  2:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22  2:06 [Patch 0/2] Add and use FirmwareVolumeShadowPpi Michael D Kinney
2023-03-22  2:06 ` Michael D Kinney [this message]
2023-03-22  2:06 ` [Patch 2/2] SecurityPkg/FvReportPei: Use FirmwareVolumeShadowPpi Michael D Kinney
2023-03-22 16:04   ` [edk2-devel] " Oliver Smith-Denny
2023-03-27 15:19     ` Michael D Kinney
2023-03-22 16:05 ` [edk2-devel] [Patch 0/2] Add and use FirmwareVolumeShadowPpi Oliver Smith-Denny
2023-03-23 19:17 ` Michael D Kinney
2023-03-27  4:55 ` Wang, Jian J
2023-03-27 16:26   ` Michael D Kinney

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=20230322020626.441-2-michael.d.kinney@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