]> git.proxmox.com Git - mirror_edk2.git/blobdiff - FmpDevicePkg/Include/Library/FmpPayloadHeaderLib.h
FmpDevicePkg: Add package, library classes, and PCDs
[mirror_edk2.git] / FmpDevicePkg / Include / Library / FmpPayloadHeaderLib.h
diff --git a/FmpDevicePkg/Include/Library/FmpPayloadHeaderLib.h b/FmpDevicePkg/Include/Library/FmpPayloadHeaderLib.h
new file mode 100644 (file)
index 0000000..cb5622e
--- /dev/null
@@ -0,0 +1,100 @@
+/**  @file\r
+  Provides services to retrieve values from a capsule's FMP Payload Header.\r
+  The structure is not included in the library class.  Instead, services are\r
+  provided to retrieve information from the FMP Payload Header.  If information\r
+  is added to the FMP Payload Header, then new services may be added to this\r
+  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
+#ifndef _FMP_PAYLOAD_HEADER_LIB_H__\r
+#define _FMP_PAYLOAD_HEADER_LIB_H__\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
+/**\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
+/**\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
+#endif\r