FmpDevicePkg: Add package, library classes, and PCDs
[mirror_edk2.git] / FmpDevicePkg / Include / Library / FmpPayloadHeaderLib.h
1 /** @file
2 Provides services to retrieve values from a capsule's FMP Payload Header.
3 The structure is not included in the library class. Instead, services are
4 provided to retrieve information from the FMP Payload Header. If information
5 is added to the FMP Payload Header, then new services may be added to this
6 library class to retrieve the new information.
7
8 Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>
9 Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
10
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions are met:
13 1. Redistributions of source code must retain the above copyright notice,
14 this list of conditions and the following disclaimer.
15 2. Redistributions in binary form must reproduce the above copyright notice,
16 this list of conditions and the following disclaimer in the documentation
17 and/or other materials provided with the distribution.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30 **/
31
32 #ifndef _FMP_PAYLOAD_HEADER_LIB_H__
33 #define _FMP_PAYLOAD_HEADER_LIB_H__
34
35 /**
36 Returns the FMP Payload Header size in bytes.
37
38 @param[in] Header FMP Payload Header to evaluate
39 @param[in] FmpPayloadSize Size of FMP payload
40 @param[out] Size The size, in bytes, of the FMP Payload Header.
41
42 @retval EFI_SUCCESS The firmware version was returned.
43 @retval EFI_INVALID_PARAMETER Header is NULL.
44 @retval EFI_INVALID_PARAMETER Size is NULL.
45 @retval EFI_INVALID_PARAMETER Header is not a valid FMP Payload Header.
46
47 **/
48 EFI_STATUS
49 EFIAPI
50 GetFmpPayloadHeaderSize (
51 IN CONST VOID *Header,
52 IN CONST UINTN FmpPayloadSize,
53 OUT UINT32 *Size
54 );
55
56 /**
57 Returns the version described in the FMP Payload Header.
58
59 @param[in] Header FMP Payload Header to evaluate
60 @param[in] FmpPayloadSize Size of FMP payload
61 @param[out] Version The firmware version described in the FMP Payload
62 Header.
63
64 @retval EFI_SUCCESS The firmware version was returned.
65 @retval EFI_INVALID_PARAMETER Header is NULL.
66 @retval EFI_INVALID_PARAMETER Version is NULL.
67 @retval EFI_INVALID_PARAMETER Header is not a valid FMP Payload Header.
68
69 **/
70 EFI_STATUS
71 EFIAPI
72 GetFmpPayloadHeaderVersion (
73 IN CONST VOID *Header,
74 IN CONST UINTN FmpPayloadSize,
75 OUT UINT32 *Version
76 );
77
78 /**
79 Returns the lowest supported version described in the FMP Payload Header.
80
81 @param[in] Header FMP Payload Header to evaluate
82 @param[in] FmpPayloadSize Size of FMP payload
83 @param[out] LowestSupportedVersion The lowest supported version described in
84 the FMP Payload Header.
85
86 @retval EFI_SUCCESS The lowest support version was returned.
87 @retval EFI_INVALID_PARAMETER Header is NULL.
88 @retval EFI_INVALID_PARAMETER LowestSupportedVersion is NULL.
89 @retval EFI_INVALID_PARAMETER Header is not a valid FMP Payload Header.
90
91 **/
92 EFI_STATUS
93 EFIAPI
94 GetFmpPayloadHeaderLowestSupportedVersion (
95 IN CONST VOID *Header,
96 IN CONST UINTN FmpPayloadSize,
97 IN OUT UINT32 *LowestSupportedVersion
98 );
99
100 #endif