]> git.proxmox.com Git - mirror_edk2.git/commitdiff
FmpDevicePkg: Add library instances
authorKinney, Michael D <michael.d.kinney@intel.com>
Wed, 4 Apr 2018 17:27:21 +0000 (10:27 -0700)
committerKinney, Michael D <michael.d.kinney@intel.com>
Thu, 2 Aug 2018 21:46:18 +0000 (14:46 -0700)
https://bugzilla.tianocore.org/show_bug.cgi?id=922

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

Add library instances for FmpDeviceLib, CapsuleUpdatePolicyLib,
and FmpPayloadHeaderLib.

Library Classes
===============
* FmpDeviceLibNull - Non-functional template of the FmpDeviceLib
  that can be used as a starting point for an FmpDeviceLib for
  a specific firmware storage device.
* CapsuleUpdatePolicyLibNull - Functional template of the
  CapsuleUpdatePolicyLib that can be used as a starting point
  of a platform specific implementation.
* FmpPayloadHeaderLibV1 - Version 1 of the FmpPayloadHeaderLib.
  This library is indented to be used "as is" with no need for
  any device specific or platform specific changes.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.c [new file with mode: 0644]
FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.inf [new file with mode: 0644]
FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.uni [new file with mode: 0644]
FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c [new file with mode: 0644]
FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLibNull.inf [new file with mode: 0644]
FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLibNull.uni [new file with mode: 0644]
FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLib.c [new file with mode: 0644]
FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.inf [new file with mode: 0644]
FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.uni [new file with mode: 0644]

diff --git a/FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.c b/FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.c
new file mode 100644 (file)
index 0000000..d86d6ba
--- /dev/null
@@ -0,0 +1,136 @@
+/**  @file\r
+  Provides platform policy services used during a capsule update.\r
+\r
+  Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
+\r
+  Redistribution and use in source and binary forms, with or without\r
+  modification, are permitted provided that the following conditions are met:\r
+  1. Redistributions of source code must retain the above copyright notice,\r
+  this list of conditions and the following disclaimer.\r
+  2. Redistributions in binary form must reproduce the above copyright notice,\r
+  this list of conditions and the following disclaimer in the documentation\r
+  and/or other materials provided with the distribution.\r
+\r
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\r
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
+  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r
+  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
+  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
+  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\r
+**/\r
+\r
+#include <PiDxe.h>\r
+#include <Library/CapsuleUpdatePolicyLib.h>\r
+\r
+/**\r
+  Determine if the system power state supports a capsule update.\r
+\r
+  @param[out] Good  Returns TRUE if system power state supports a capsule\r
+                    update.  Returns FALSE if system power state does not\r
+                    support a capsule update.  Return value is only valid if\r
+                    return status is EFI_SUCCESS.\r
+\r
+  @retval EFI_SUCCESS            Good parameter has been updated with result.\r
+  @retval EFI_INVALID_PARAMETER  Good is NULL.\r
+  @retval EFI_DEVICE_ERROR       System power state can not be determined.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CheckSystemPower (\r
+  OUT BOOLEAN  *Good\r
+  )\r
+{\r
+  *Good = TRUE;\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Determines if the system thermal state supports a capsule update.\r
+\r
+  @param[out] Good  Returns TRUE if system thermal state supports a capsule\r
+                    update.  Returns FALSE if system thermal state does not\r
+                    support a capsule update.  Return value is only valid if\r
+                    return status is EFI_SUCCESS.\r
+\r
+  @retval EFI_SUCCESS            Good parameter has been updated with result.\r
+  @retval EFI_INVALID_PARAMETER  Good is NULL.\r
+  @retval EFI_DEVICE_ERROR       System thermal state can not be determined.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CheckSystemThermal (\r
+  IN OUT BOOLEAN  *Good\r
+  )\r
+{\r
+  *Good = TRUE;\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Determines if the system environment state supports a capsule update.\r
+\r
+  @param[out] Good  Returns TRUE if system environment state supports a capsule\r
+                    update.  Returns FALSE if system environment state does not\r
+                    support a capsule update.  Return value is only valid if\r
+                    return status is EFI_SUCCESS.\r
+\r
+  @retval EFI_SUCCESS            Good parameter has been updated with result.\r
+  @retval EFI_INVALID_PARAMETER  Good is NULL.\r
+  @retval EFI_DEVICE_ERROR       System environment state can not be determined.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CheckSystemEnvironment (\r
+  IN OUT BOOLEAN  *Good\r
+  )\r
+{\r
+  *Good = TRUE;\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Determines if the Lowest Supported Version checks should be performed.  The\r
+  expected result from this function is TRUE.  A platform can choose to return\r
+  FALSE (e.g. during manufacturing or servicing) to allow a capsule update to a\r
+  version below the current Lowest Supported Version.\r
+\r
+  @retval TRUE   The lowest supported version check is required.\r
+  @retval FALSE  Do not perform lowest support version check.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsLowestSupportedVersionCheckRequired (\r
+  VOID\r
+  )\r
+{\r
+  return TRUE;\r
+}\r
+\r
+/**\r
+  Determines if the FMP device should be locked when the event specified by\r
+  PcdFmpDeviceLockEventGuid is signaled. The expected result from this function\r
+  is TRUE so the FMP device is always locked.  A platform can choose to return\r
+  FALSE (e.g. during manufacturing) to allow FMP devices to remain unlocked.\r
+\r
+  @retval TRUE   The FMP device lock action is required at lock event guid.\r
+  @retval FALSE  Do not perform FMP device lock at lock event guid.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsLockFmpDeviceAtLockEventGuidRequired (\r
+  VOID\r
+  )\r
+{\r
+  return TRUE;\r
+}\r
diff --git a/FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.inf b/FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.inf
new file mode 100644 (file)
index 0000000..c7c669e
--- /dev/null
@@ -0,0 +1,45 @@
+## @file\r
+#  Provides platform policy services used during a capsule update.\r
+#\r
+#  Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
+#\r
+#  Redistribution and use in source and binary forms, with or without\r
+#  modification, are permitted provided that the following conditions are met:\r
+#  1. Redistributions of source code must retain the above copyright notice,\r
+#  this list of conditions and the following disclaimer.\r
+#  2. Redistributions in binary form must reproduce the above copyright notice,\r
+#  this list of conditions and the following disclaimer in the documentation\r
+#  and/or other materials provided with the distribution.\r
+#\r
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\r
+#  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+#  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
+#  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r
+#  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+#  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+#  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
+#  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r
+#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION     = 0x00010005\r
+  BASE_NAME       = CapsuleUpdatePolicyLibNull\r
+  MODULE_UNI_FILE = CapsuleUpdatePolicyLibNull.uni\r
+  FILE_GUID       = 8E36EC87-440D-44F9-AB2F-AA806C61A1A6\r
+  MODULE_TYPE     = BASE\r
+  VERSION_STRING  = 1.0\r
+  LIBRARY_CLASS   = CapsuleUpdatePolicyLib\r
+\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF ARM AARCH64\r
+#\r
+\r
+[Sources]\r
+  CapsuleUpdatePolicyLibNull.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  FmpDevicePkg/FmpDevicePkg.dec\r
diff --git a/FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.uni b/FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.uni
new file mode 100644 (file)
index 0000000..0f16fea
--- /dev/null
@@ -0,0 +1,17 @@
+// /** @file\r
+// Provides platform policy services used during a capsule update.\r
+//\r
+// Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
+//\r
+// This program and the accompanying materials\r
+// are licensed and made available under the terms and conditions of the BSD License\r
+// which accompanies this distribution. The full text of the license may be found at\r
+// http://opensource.org/licenses/bsd-license.php\r
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+//\r
+// **/\r
+\r
+#string STR_MODULE_ABSTRACT     #language en-US  "Provides platform policy services used during a capsule update."\r
+\r
+#string STR_MODULE_DESCRIPTION  #language en-US  "Provides platform policy services used during a capsule update."\r
diff --git a/FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c b/FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c
new file mode 100644 (file)
index 0000000..03e8750
--- /dev/null
@@ -0,0 +1,427 @@
+/**  @file\r
+  Provides firmware device specific services to support updates of a firmware\r
+  image stored in a firmware device.\r
+\r
+  Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
+\r
+  Redistribution and use in source and binary forms, with or without\r
+  modification, are permitted provided that the following conditions are met:\r
+  1. Redistributions of source code must retain the above copyright notice,\r
+  this list of conditions and the following disclaimer.\r
+  2. Redistributions in binary form must reproduce the above copyright notice,\r
+  this list of conditions and the following disclaimer in the documentation\r
+  and/or other materials provided with the distribution.\r
+\r
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\r
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
+  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r
+  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
+  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
+  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\r
+**/\r
+\r
+#include <PiDxe.h>\r
+#include <Library/FmpDeviceLib.h>\r
+\r
+/**\r
+  Provide a function to install the Firmware Management Protocol instance onto a\r
+  device handle when the device is managed by a driver that follows the UEFI\r
+  Driver Model.  If the device is not managed by a driver that follows the UEFI\r
+  Driver Model, then EFI_UNSUPPORTED is returned.\r
+\r
+  @param[in] FmpInstaller  Function that installs the Firmware Management\r
+                           Protocol.\r
+\r
+  @retval EFI_SUCCESS      The device is managed by a driver that follows the\r
+                           UEFI Driver Model.  FmpInstaller must be called on\r
+                           each Driver Binding Start().\r
+  @retval EFI_UNSUPPORTED  The device is not managed by a driver that follows\r
+                           the UEFI Driver Model.\r
+  @retval other            The Firmware Management Protocol for this firmware\r
+                           device is not installed.  The firmware device is\r
+                           still locked using FmpDeviceLock().\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+RegisterFmpInstaller (\r
+  IN FMP_DEVICE_LIB_REGISTER_FMP_INSTALLER  Function\r
+  )\r
+{\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  Returns the size, in bytes, of the firmware image currently stored in the\r
+  firmware device.  This function is used to by the GetImage() and\r
+  GetImageInfo() services of the Firmware Management Protocol.  If the image\r
+  size can not be determined from the firmware device, then 0 must be returned.\r
+\r
+  @param[out] Size  Pointer to the size, in bytes, of the firmware image\r
+                    currently stored in the firmware device.\r
+\r
+  @retval EFI_SUCCESS            The size of the firmware image currently\r
+                                 stored in the firmware device was returned.\r
+  @retval EFI_INVALID_PARAMETER  Size is NULL.\r
+  @retval EFI_UNSUPPORTED        The firmware device does not support reporting\r
+                                 the size of the currently stored firmware image.\r
+  @retval EFI_DEVICE_ERROR       An error occurred attempting to determine the\r
+                                 size of the firmware image currently stored in\r
+                                 in the firmware device.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FmpDeviceGetSize (\r
+  IN UINTN  *Size\r
+  )\r
+{\r
+  if (Size == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+  *Size = 0;\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Returns the GUID value used to fill in the ImageTypeId field of the\r
+  EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo()\r
+  service of the Firmware Management Protocol.  If EFI_UNSUPPORTED is returned,\r
+  then the ImageTypeId field is set to gEfiCallerIdGuid.  If EFI_SUCCESS is\r
+  returned, then ImageTypeId is set to the Guid returned from this function.\r
+\r
+  @param[out] Guid  Double pointer to a GUID value that is updated to point to\r
+                    to a GUID value.  The GUID value is not allocated and must\r
+                    not be modified or freed by the caller.\r
+\r
+  @retval EFI_SUCCESS      EFI_FIRMWARE_IMAGE_DESCRIPTOR ImageTypeId GUID is set\r
+                           to the returned Guid value.\r
+  @retval EFI_UNSUPPORTED  EFI_FIRMWARE_IMAGE_DESCRIPTOR ImageTypeId GUID is set\r
+                           to gEfiCallerIdGuid.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FmpDeviceGetImageTypeIdGuidPtr (\r
+  OUT EFI_GUID  **Guid\r
+  )\r
+{\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  Returns values used to fill in the AttributesSupported and AttributesSettings\r
+  fields of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the\r
+  GetImageInfo() service of the Firmware Management Protocol.  The following\r
+  bit values from the Firmware Management Protocol may be combined:\r
+    IMAGE_ATTRIBUTE_IMAGE_UPDATABLE\r
+    IMAGE_ATTRIBUTE_RESET_REQUIRED\r
+    IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED\r
+    IMAGE_ATTRIBUTE_IN_USE\r
+    IMAGE_ATTRIBUTE_UEFI_IMAGE\r
+\r
+  @param[out] Supported  Attributes supported by this firmware device.\r
+  @param[out] Setting    Attributes settings for this firmware device.\r
+\r
+  @retval EFI_SUCCESS            The attributes supported by the firmware\r
+                                 device were returned.\r
+  @retval EFI_INVALID_PARAMETER  Supported is NULL.\r
+  @retval EFI_INVALID_PARAMETER  Setting is NULL.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FmpDeviceGetAttributes (\r
+  IN OUT UINT64  *Supported,\r
+  IN OUT UINT64  *Setting\r
+  )\r
+{\r
+  if (Supported == NULL || Setting == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+  *Supported = 0;\r
+  *Setting   = 0;\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Returns the value used to fill in the LowestSupportedVersion field of the\r
+  EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo()\r
+  service of the Firmware Management Protocol.  If EFI_SUCCESS is returned, then\r
+  the firmware device supports a method to report the LowestSupportedVersion\r
+  value from the currently stored firmware image.  If the value can not be\r
+  reported for the firmware image currently stored in the firmware device, then\r
+  EFI_UNSUPPORTED must be returned.  EFI_DEVICE_ERROR is returned if an error\r
+  occurs attempting to retrieve the LowestSupportedVersion value for the\r
+  currently stored firmware image.\r
+\r
+  @note It is recommended that all firmware devices support a method to report\r
+        the LowestSupportedVersion value from the currently stored firmware\r
+        image.\r
+\r
+  @param[out] LowestSupportedVersion  LowestSupportedVersion value retrieved\r
+                                      from the currently stored firmware image.\r
+\r
+  @retval EFI_SUCCESS       The lowest supported version of currently stored\r
+                            firmware image was returned in LowestSupportedVersion.\r
+  @retval EFI_UNSUPPORTED   The firmware device does not support a method to\r
+                            report the lowest supported version of the currently\r
+                            stored firmware image.\r
+  @retval EFI_DEVICE_ERROR  An error occurred attempting to retrieve the lowest\r
+                            supported version of the currently stored firmware\r
+                            image.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FmpDeviceGetLowestSupportedVersion (\r
+  OUT UINT32  *LowestSupportedVersion\r
+  )\r
+{\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  Returns the Null-terminated Unicode string that is used to fill in the\r
+  VersionName field of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is\r
+  returned by the GetImageInfo() service of the Firmware Management Protocol.\r
+  The returned string must be allocated using EFI_BOOT_SERVICES.AllocatePool().\r
+\r
+  @note It is recommended that all firmware devices support a method to report\r
+        the VersionName string from the currently stored firmware image.\r
+\r
+  @param[out] VersionString  The version string retrieved from the currently\r
+                             stored firmware image.\r
+\r
+  @retval EFI_SUCCESS            The version string of currently stored\r
+                                 firmware image was returned in Version.\r
+  @retval EFI_INVALID_PARAMETER  VersionString is NULL.\r
+  @retval EFI_UNSUPPORTED        The firmware device does not support a method\r
+                                 to report the version string of the currently\r
+                                 stored firmware image.\r
+  @retval EFI_DEVICE_ERROR       An error occurred attempting to retrieve the\r
+                                 version string of the currently stored\r
+                                 firmware image.\r
+  @retval EFI_OUT_OF_RESOURCES   There are not enough resources to allocate the\r
+                                 buffer for the version string of the currently\r
+                                 stored firmware image.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FmpDeviceGetVersionString (\r
+  OUT CHAR16  **VersionString\r
+  )\r
+{\r
+  if (VersionString == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+  *VersionString = NULL;\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  Returns the value used to fill in the Version field of the\r
+  EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo()\r
+  service of the Firmware Management Protocol.  If EFI_SUCCESS is returned, then\r
+  the firmware device supports a method to report the Version value from the\r
+  currently stored firmware image.  If the value can not be reported for the\r
+  firmware image currently stored in the firmware device, then EFI_UNSUPPORTED\r
+  must be returned.  EFI_DEVICE_ERROR is returned if an error occurs attempting\r
+  to retrieve the LowestSupportedVersion value for the currently stored firmware\r
+  image.\r
+\r
+  @note It is recommended that all firmware devices support a method to report\r
+        the Version value from the currently stored firmware image.\r
+\r
+  @param[out] Version  The version value retrieved from the currently stored\r
+                       firmware image.\r
+\r
+  @retval EFI_SUCCESS       The version of currently stored firmware image was\r
+                            returned in Version.\r
+  @retval EFI_UNSUPPORTED   The firmware device does not support a method to\r
+                            report the version of the currently stored firmware\r
+                            image.\r
+  @retval EFI_DEVICE_ERROR  An error occurred attempting to retrieve the version\r
+                            of the currently stored firmware image.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FmpDeviceGetVersion (\r
+  OUT UINT32  *Version\r
+  )\r
+{\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  Returns a copy of the firmware image currently stored in the firmware device.\r
+\r
+  @note It is recommended that all firmware devices support a method to retrieve\r
+        a copy currently stored firmware image.  This can be used to support\r
+        features such as recovery and rollback.\r
+\r
+  @param[out]    Image      Pointer to a caller allocated buffer where the\r
+                            currently stored firmware image is copied to.\r
+  @param[in out] ImageSize  Pointer the size, in bytes, of the Image buffer.\r
+                            On return, points to the size, in bytes, of firmware\r
+                            image currently stored in the firmware device.\r
+\r
+  @retval EFI_SUCCESS            Image contains a copy of the firmware image\r
+                                 currently stored in the firmware device, and\r
+                                 ImageSize contains the size, in bytes, of the\r
+                                 firmware image currently stored in the\r
+                                 firmware device.\r
+  @retval EFI_BUFFER_TOO_SMALL   The buffer specified by ImageSize is too small\r
+                                 to hold the firmware image currently stored in\r
+                                 the firmware device. The buffer size required\r
+                                 is returned in ImageSize.\r
+  @retval EFI_INVALID_PARAMETER  The Image is NULL.\r
+  @retval EFI_INVALID_PARAMETER  The ImageSize is NULL.\r
+  @retval EFI_UNSUPPORTED        The operation is not supported.\r
+  @retval EFI_DEVICE_ERROR       An error occurred attempting to retrieve the\r
+                                 firmware image currently stored in the firmware\r
+                                 device.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FmpDeviceGetImage (\r
+  IN OUT    VOID   *Image,\r
+  IN IN OUT UINTN  *ImageSize\r
+  )\r
+{\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  Checks if a new firmware image is valid for the firmware device.  This\r
+  function allows firmware update operation to validate the firmware image\r
+  before FmpDeviceSetImage() is called.\r
+\r
+  @param[in]  Image           Points to a new firmware image.\r
+  @param[in]  ImageSize       Size, in bytes, of a new firmware image.\r
+  @param[out] ImageUpdatable  Indicates if a new firmware image is valid for\r
+                              a firmware update to the firmware device.  The\r
+                              following values from the Firmware Management\r
+                              Protocol are supported:\r
+                                IMAGE_UPDATABLE_VALID\r
+                                IMAGE_UPDATABLE_INVALID\r
+                                IMAGE_UPDATABLE_INVALID_TYPE\r
+                                IMAGE_UPDATABLE_INVALID_OLD\r
+                                IMAGE_UPDATABLE_VALID_WITH_VENDOR_CODE\r
+\r
+  @retval EFI_SUCCESS            The image was successfully checked.  Additional\r
+                                 status information is returned in\r
+                                 ImageUpdateable.\r
+  @retval EFI_INVALID_PARAMETER  Image is NULL.\r
+  @retval EFI_INVALID_PARAMETER  ImageUpdateable is NULL.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FmpDeviceCheckImage (\r
+  IN  CONST VOID  *Image,\r
+  IN  UINTN       ImageSize,\r
+  OUT UINT32      *ImageUpdateable\r
+  )\r
+{\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Updates a firmware device with a new firmware image.  This function returns\r
+  EFI_UNSUPPORTED if the firmware image is not updatable.  If the firmware image\r
+  is updatable, the function should perform the following minimal validations\r
+  before proceeding to do the firmware image update.\r
+    - Validate that the image is a supported image for this firmware device.\r
+      Return EFI_ABORTED if the image is not supported.  Additional details\r
+      on why the image is not a supported image may be returned in AbortReason.\r
+    - Validate the data from VendorCode if is not NULL.  Firmware image\r
+      validation must be performed before VendorCode data validation.\r
+      VendorCode data is ignored or considered invalid if image validation\r
+      fails.  Return EFI_ABORTED if the VendorCode data is invalid.\r
+\r
+  VendorCode enables vendor to implement vendor-specific firmware image update\r
+  policy.  Null if the caller did not specify the policy or use the default\r
+  policy.  As an example, vendor can implement a policy to allow an option to\r
+  force a firmware image update when the abort reason is due to the new firmware\r
+  image version is older than the current firmware image version or bad image\r
+  checksum.  Sensitive operations such as those wiping the entire firmware image\r
+  and render the device to be non-functional should be encoded in the image\r
+  itself rather than passed with the VendorCode.  AbortReason enables vendor to\r
+  have the option to provide a more detailed description of the abort reason to\r
+  the caller.\r
+\r
+  @param[in]  Image             Points to the new firmware image.\r
+  @param[in]  ImageSize         Size, in bytes, of the new firmware image.\r
+  @param[in]  VendorCode        This enables vendor to implement vendor-specific\r
+                                firmware image update policy.  NULL indicates\r
+                                the caller did not specify the policy or use the\r
+                                default policy.\r
+  @param[in]  Progress          A function used to report the progress of\r
+                                updating the firmware device with the new\r
+                                firmware image.\r
+  @param[in]  CapsuleFwVersion  The version of the new firmware image from the\r
+                                update capsule that provided the new firmware\r
+                                image.\r
+  @param[out] AbortReason       A pointer to a pointer to a Null-terminated\r
+                                Unicode string providing more details on an\r
+                                aborted operation. The buffer is allocated by\r
+                                this function with\r
+                                EFI_BOOT_SERVICES.AllocatePool().  It is the\r
+                                caller's responsibility to free this buffer with\r
+                                EFI_BOOT_SERVICES.FreePool().\r
+\r
+  @retval EFI_SUCCESS            The firmware device was successfully updated\r
+                                 with the new firmware image.\r
+  @retval EFI_ABORTED            The operation is aborted.  Additional details\r
+                                 are provided in AbortReason.\r
+  @retval EFI_INVALID_PARAMETER  The Image was NULL.\r
+  @retval EFI_UNSUPPORTED        The operation is not supported.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FmpDeviceSetImage (\r
+  IN  CONST VOID                                     *Image,\r
+  IN  UINTN                                          ImageSize,\r
+  IN  CONST VOID                                     *VendorCode,       OPTIONAL\r
+  IN  EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS  Progress,          OPTIONAL\r
+  IN  UINT32                                         CapsuleFwVersion,\r
+  OUT CHAR16                                         **AbortReason\r
+  )\r
+{\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  Lock the firmware device that contains a firmware image.  Once a firmware\r
+  device is locked, any attempts to modify the firmware image contents in the\r
+  firmware device must fail.\r
+\r
+  @note It is recommended that all firmware devices support a lock method to\r
+        prevent modifications to a stored firmware image.\r
+\r
+  @note A firmware device lock mechanism is typically only cleared by a full\r
+        system reset (not just sleep state/low power mode).\r
+\r
+  @retval  EFI_SUCCESS      The firmware device was locked.\r
+  @retval  EFI_UNSUPPORTED  The firmware device does not support locking\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FmpDeviceLock (\r
+  VOID\r
+  )\r
+{\r
+  return EFI_UNSUPPORTED;\r
+}\r
diff --git a/FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLibNull.inf b/FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLibNull.inf
new file mode 100644 (file)
index 0000000..d51f69d
--- /dev/null
@@ -0,0 +1,48 @@
+## @file\r
+#  Provides firmware device specific services to support updates of a firmware\r
+#  image stored in a firmware device.\r
+#\r
+#  Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
+#\r
+#  Redistribution and use in source and binary forms, with or without\r
+#  modification, are permitted provided that the following conditions are met:\r
+#  1. Redistributions of source code must retain the above copyright notice,\r
+#  this list of conditions and the following disclaimer.\r
+#  2. Redistributions in binary form must reproduce the above copyright notice,\r
+#  this list of conditions and the following disclaimer in the documentation\r
+#  and/or other materials provided with the distribution.\r
+#\r
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\r
+#  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+#  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
+#  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r
+#  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+#  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+#  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
+#  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r
+#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION     = 0x00010005\r
+  BASE_NAME       = FmpDeviceLibNull\r
+  MODULE_UNI_FILE = FmpDeviceLibNull.uni\r
+  FILE_GUID       = 8507642B-AE92-4664-B713-807F7774A96D\r
+  MODULE_TYPE     = DXE_DRIVER\r
+  VERSION_STRING  = 1.0\r
+  LIBRARY_CLASS   = FmpDeviceLib|DXE_DRIVER\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF ARM AARCH64\r
+#\r
+\r
+[Sources]\r
+  FmpDeviceLib.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  FmpDevicePkg/FmpDevicePkg.dec\r
diff --git a/FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLibNull.uni b/FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLibNull.uni
new file mode 100644 (file)
index 0000000..bedb38e
--- /dev/null
@@ -0,0 +1,18 @@
+// /** @file\r
+// Provides firmware device specific services to support updates of a firmware\r
+// image stored in a firmware device.\r
+//\r
+// Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
+//\r
+// This program and the accompanying materials\r
+// are licensed and made available under the terms and conditions of the BSD License\r
+// which accompanies this distribution. The full text of the license may be found at\r
+// http://opensource.org/licenses/bsd-license.php\r
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+//\r
+// **/\r
+\r
+#string STR_MODULE_ABSTRACT     #language en-US  "Provides firmware device specific services to support updates of a firmware image stored in a firmware device."\r
+\r
+#string STR_MODULE_DESCRIPTION  #language en-US  "Provides firmware device specific services to support updates of a firmware image stored in a firmware device."\r
diff --git a/FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLib.c b/FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLib.c
new file mode 100644 (file)
index 0000000..5f08e8b
--- /dev/null
@@ -0,0 +1,188 @@
+/**  @file\r
+  Provides services to retrieve values from Version 1 of a capsule's FMP Payload\r
+  Header. The FMP Payload Header structure is not defined in the library class.\r
+  Instead, services are provided to retrieve information from the FMP Payload\r
+  Header.  If information is added to the FMP Payload Header, then new services\r
+  may be added to this library class to retrieve the new information.\r
+\r
+  Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
+\r
+  Redistribution and use in source and binary forms, with or without\r
+  modification, are permitted provided that the following conditions are met:\r
+  1. Redistributions of source code must retain the above copyright notice,\r
+  this list of conditions and the following disclaimer.\r
+  2. Redistributions in binary form must reproduce the above copyright notice,\r
+  this list of conditions and the following disclaimer in the documentation\r
+  and/or other materials provided with the distribution.\r
+\r
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\r
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
+  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r
+  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
+  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
+  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\r
+**/\r
+\r
+#include <PiDxe.h>\r
+#include <Library/FmpPayloadHeaderLib.h>\r
+\r
+///\r
+/// Define FMP Payload Header structure here so it is not public\r
+///\r
+\r
+#pragma pack(1)\r
+\r
+typedef struct {\r
+  UINT32  Signature;\r
+  UINT32  HeaderSize;\r
+  UINT32  FwVersion;\r
+  UINT32  LowestSupportedVersion;\r
+} FMP_PAYLOAD_HEADER;\r
+\r
+#pragma pack()\r
+\r
+///\r
+/// Identifier is used to make sure the data in the header is for this structure\r
+/// and version.  If the structure changes update the last digit.\r
+///\r
+#define FMP_PAYLOAD_HEADER_SIGNATURE SIGNATURE_32 ('M', 'S', 'S', '1')\r
+\r
+/**\r
+  Returns the FMP Payload Header size in bytes.\r
+\r
+  @param[in]  Header          FMP Payload Header to evaluate\r
+  @param[in]  FmpPayloadSize  Size of FMP payload\r
+  @param[out] Size            The size, in bytes, of the FMP Payload Header.\r
+\r
+  @retval EFI_SUCCESS            The firmware version was returned.\r
+  @retval EFI_INVALID_PARAMETER  Header is NULL.\r
+  @retval EFI_INVALID_PARAMETER  Size is NULL.\r
+  @retval EFI_INVALID_PARAMETER  Header is not a valid FMP Payload Header.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetFmpPayloadHeaderSize (\r
+  IN  CONST VOID   *Header,\r
+  IN  CONST UINTN  FmpPayloadSize,\r
+  OUT UINT32       *Size\r
+  )\r
+{\r
+  FMP_PAYLOAD_HEADER  *FmpPayloadHeader;\r
+\r
+  FmpPayloadHeader = NULL;\r
+\r
+  if (Header == NULL || Size == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  FmpPayloadHeader = (FMP_PAYLOAD_HEADER *)Header;\r
+  if ((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) < (UINTN)FmpPayloadHeader ||\r
+      (UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) >= (UINTN)FmpPayloadHeader + FmpPayloadSize ||\r
+      FmpPayloadHeader->HeaderSize < sizeof (FMP_PAYLOAD_HEADER)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  if (FmpPayloadHeader->Signature != FMP_PAYLOAD_HEADER_SIGNATURE) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  *Size = FmpPayloadHeader->HeaderSize;\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Returns the version described in the FMP Payload Header.\r
+\r
+  @param[in]  Header          FMP Payload Header to evaluate\r
+  @param[in]  FmpPayloadSize  Size of FMP payload\r
+  @param[out] Version         The firmware version described in the FMP Payload\r
+                              Header.\r
+\r
+  @retval EFI_SUCCESS            The firmware version was returned.\r
+  @retval EFI_INVALID_PARAMETER  Header is NULL.\r
+  @retval EFI_INVALID_PARAMETER  Version is NULL.\r
+  @retval EFI_INVALID_PARAMETER  Header is not a valid FMP Payload Header.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetFmpPayloadHeaderVersion (\r
+  IN  CONST VOID   *Header,\r
+  IN  CONST UINTN  FmpPayloadSize,\r
+  OUT UINT32       *Version\r
+  )\r
+{\r
+  FMP_PAYLOAD_HEADER  *FmpPayloadHeader;\r
+\r
+  FmpPayloadHeader = NULL;\r
+\r
+  if (Header == NULL || Version == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  FmpPayloadHeader = (FMP_PAYLOAD_HEADER *)Header;\r
+  if ((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) < (UINTN)FmpPayloadHeader ||\r
+      (UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) >= (UINTN)FmpPayloadHeader + FmpPayloadSize ||\r
+      FmpPayloadHeader->HeaderSize < sizeof (FMP_PAYLOAD_HEADER)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  if (FmpPayloadHeader->Signature != FMP_PAYLOAD_HEADER_SIGNATURE) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  *Version = FmpPayloadHeader->FwVersion;\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Returns the lowest supported version described in the FMP Payload Header.\r
+\r
+  @param[in]  Header                  FMP Payload Header to evaluate\r
+  @param[in]  FmpPayloadSize          Size of FMP payload\r
+  @param[out] LowestSupportedVersion  The lowest supported version described in\r
+                                      the FMP Payload Header.\r
+\r
+  @retval EFI_SUCCESS            The lowest support version was returned.\r
+  @retval EFI_INVALID_PARAMETER  Header is NULL.\r
+  @retval EFI_INVALID_PARAMETER  LowestSupportedVersion is NULL.\r
+  @retval EFI_INVALID_PARAMETER  Header is not a valid FMP Payload Header.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetFmpPayloadHeaderLowestSupportedVersion (\r
+  IN     CONST VOID   *Header,\r
+  IN     CONST UINTN  FmpPayloadSize,\r
+  IN OUT UINT32       *LowestSupportedVersion\r
+  )\r
+{\r
+  FMP_PAYLOAD_HEADER  *FmpPayloadHeader;\r
+\r
+  FmpPayloadHeader = NULL;\r
+\r
+  if (Header == NULL || LowestSupportedVersion == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  FmpPayloadHeader = (FMP_PAYLOAD_HEADER *)Header;\r
+  if ((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) < (UINTN)FmpPayloadHeader ||\r
+      (UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) >= (UINTN)FmpPayloadHeader + FmpPayloadSize ||\r
+      FmpPayloadHeader->HeaderSize < sizeof (FMP_PAYLOAD_HEADER)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  if (FmpPayloadHeader->Signature != FMP_PAYLOAD_HEADER_SIGNATURE) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  *LowestSupportedVersion = FmpPayloadHeader->LowestSupportedVersion;\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.inf b/FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.inf
new file mode 100644 (file)
index 0000000..41ed6e2
--- /dev/null
@@ -0,0 +1,48 @@
+## @file\r
+#  Provides services to retrieve values from Version 1 of a capsule's FMP Payload\r
+#  Header. The FMP Payload Header structure is not defined in the library class.\r
+#  Instead, services are provided to retrieve information from the FMP Payload\r
+#  Header.  If information is added to the FMP Payload Header, then new services\r
+#  may be added to this library class to retrieve the new information.\r
+#\r
+#  Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
+#\r
+#  Redistribution and use in source and binary forms, with or without\r
+#  modification, are permitted provided that the following conditions are met:\r
+#  1. Redistributions of source code must retain the above copyright notice,\r
+#  this list of conditions and the following disclaimer.\r
+#  2. Redistributions in binary form must reproduce the above copyright notice,\r
+#  this list of conditions and the following disclaimer in the documentation\r
+#  and/or other materials provided with the distribution.\r
+#\r
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\r
+#  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+#  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
+#  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r
+#  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+#  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+#  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
+#  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r
+#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = FmpPayloadHeaderLibV1\r
+  FILE_GUID                      = 98A79A6C-513C-4E72-8375-39C0A7244C4B\r
+  MODULE_TYPE                    = DXE_DRIVER\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = FmpPayloadHeaderLib|DXE_DRIVER UEFI_APPLICATION\r
+\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF ARM AARCH64\r
+#\r
+\r
+[Sources]\r
+  FmpPayloadHeaderLib.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  FmpDevicePkg/FmpDevicePkg.dec\r
diff --git a/FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.uni b/FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.uni
new file mode 100644 (file)
index 0000000..4eef317
--- /dev/null
@@ -0,0 +1,21 @@
+// /** @file\r
+// Provides services to retrieve values from Version 1 of a capsule's FMP Payload\r
+// Header. The FMP Payload Header structure is not defined in the library class.\r
+// Instead, services are provided to retrieve information from the FMP Payload\r
+// Header.  If information is added to the FMP Payload Header, then new services\r
+// may be added to this library class to retrieve the new information.\r
+//\r
+// Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
+//\r
+// This program and the accompanying materials\r
+// are licensed and made available under the terms and conditions of the BSD License\r
+// which accompanies this distribution. The full text of the license may be found at\r
+// http://opensource.org/licenses/bsd-license.php\r
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+//\r
+// **/\r
+\r
+#string STR_MODULE_ABSTRACT     #language en-US  "Provides services to retrieve values from Version 1 of a capsule's FMP Payload Header."\r
+\r
+#string STR_MODULE_DESCRIPTION  #language en-US  "Provides services to retrieve values from Version 1 of a capsule's FMP Payload Header."\r