2 EDKII System Capsule library.
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef __EDKII_SYSTEM_CAPSULE_LIB_H__
10 #define __EDKII_SYSTEM_CAPSULE_LIB_H__
12 #include <Guid/EdkiiSystemFmpCapsule.h>
15 Extract ImageFmpInfo from system firmware.
17 @param[in] SystemFirmwareImage The System Firmware image.
18 @param[in] SystemFirmwareImageSize The size of the System Firmware image in bytes.
19 @param[out] ImageFmpInfo The ImageFmpInfo.
20 @param[out] ImageFmpInfoSize The size of the ImageFmpInfo in bytes.
22 @retval TRUE The ImageFmpInfo is extracted.
23 @retval FALSE The ImageFmpInfo is not extracted.
27 ExtractSystemFirmwareImageFmpInfo (
28 IN VOID
*SystemFirmwareImage
,
29 IN UINTN SystemFirmwareImageSize
,
30 OUT EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR
**ImageFmpInfo
,
31 OUT UINTN
*ImageFmpInfoSize
35 Extract the driver FV from an authenticated image.
37 @param[in] AuthenticatedImage The authenticated capsule image.
38 @param[in] AuthenticatedImageSize The size of the authenticated capsule image in bytes.
39 @param[out] DriverFvImage The driver FV image.
40 @param[out] DriverFvImageSize The size of the driver FV image in bytes.
42 @retval TRUE The driver Fv is extracted.
43 @retval FALSE The driver Fv is not extracted.
47 ExtractDriverFvImage (
48 IN VOID
*AuthenticatedImage
,
49 IN UINTN AuthenticatedImageSize
,
50 OUT VOID
**DriverFvImage
,
51 OUT UINTN
*DriverFvImageSize
55 Extract the config image from an authenticated image.
57 @param[in] AuthenticatedImage The authenticated capsule image.
58 @param[in] AuthenticatedImageSize The size of the authenticated capsule image in bytes.
59 @param[out] ConfigImage The config image.
60 @param[out] ConfigImageSize The size of the config image in bytes.
62 @retval TRUE The config image is extracted.
63 @retval FALSE The config image is not extracted.
68 IN VOID
*AuthenticatedImage
,
69 IN UINTN AuthenticatedImageSize
,
70 OUT VOID
**ConfigImage
,
71 OUT UINTN
*ConfigImageSize
75 Extract the System Firmware image from an authenticated image.
77 @param[in] AuthenticatedImage The authenticated capsule image.
78 @param[in] AuthenticatedImageSize The size of the authenticated capsule image in bytes.
79 @param[out] SystemFirmwareImage The System Firmware image.
80 @param[out] SystemFirmwareImageSize The size of the System Firmware image in bytes.
82 @retval TRUE The System Firmware image is extracted.
83 @retval FALSE The System Firmware image is not extracted.
87 ExtractSystemFirmwareImage (
88 IN VOID
*AuthenticatedImage
,
89 IN UINTN AuthenticatedImageSize
,
90 OUT VOID
**SystemFirmwareImage
,
91 OUT UINTN
*SystemFirmwareImageSize
95 Extract the authenticated image from an FMP capsule image.
97 @param[in] Image The FMP capsule image, including EFI_FIRMWARE_IMAGE_AUTHENTICATION.
98 @param[in] ImageSize The size of FMP capsule image in bytes.
99 @param[out] LastAttemptStatus The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.
100 @param[out] AuthenticatedImage The authenticated capsule image, excluding EFI_FIRMWARE_IMAGE_AUTHENTICATION.
101 @param[out] AuthenticatedImageSize The size of the authenticated capsule image in bytes.
103 @retval TRUE The authenticated image is extracted.
104 @retval FALSE The authenticated image is not extracted.
108 ExtractAuthenticatedImage (
111 OUT UINT32
*LastAttemptStatus
,
112 OUT VOID
**AuthenticatedImage
,
113 OUT UINTN
*AuthenticatedImageSize
117 Authenticated system firmware FMP capsule image.
119 Caution: This function may receive untrusted input.
121 @param[in] Image The FMP capsule image, including EFI_FIRMWARE_IMAGE_AUTHENTICATION.
122 @param[in] ImageSize The size of FMP capsule image in bytes.
123 @param[in] ForceVersionMatch TRUE: The version of capsule must be as same as the version of current image.
124 FALSE: The version of capsule must be as same as greater than the lowest
125 supported version of current image.
126 @param[out] LastAttemptVersion The last attempt version, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.
127 @param[out] LastAttemptStatus The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.
128 @param[out] AuthenticatedImage The authenticated capsule image, excluding EFI_FIRMWARE_IMAGE_AUTHENTICATION.
129 @param[out] AuthenticatedImageSize The size of the authenticated capsule image in bytes.
131 @retval TRUE Authentication passes and the authenticated image is extracted.
132 @retval FALSE Authentication fails and the authenticated image is not extracted.
136 CapsuleAuthenticateSystemFirmware (
139 IN BOOLEAN ForceVersionMatch
,
140 OUT UINT32
*LastAttemptVersion
,
141 OUT UINT32
*LastAttemptStatus
,
142 OUT VOID
**AuthenticatedImage
,
143 OUT UINTN
*AuthenticatedImageSize