]> git.proxmox.com Git - mirror_edk2.git/blame - SignedCapsulePkg/Include/Library/EdkiiSystemCapsuleLib.h
SignedCapsulePkg/Include: Add PlatformFlashAccessLib header.
[mirror_edk2.git] / SignedCapsulePkg / Include / Library / EdkiiSystemCapsuleLib.h
CommitLineData
5f190b90
JY
1/** @file\r
2 EDKII System Capsule library.\r
3\r
4Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15\r
16#ifndef __EDKII_SYSTEM_CAPSULE_LIB_H__\r
17#define __EDKII_SYSTEM_CAPSULE_LIB_H__\r
18\r
19#include <Guid/EdkiiSystemFmpCapsule.h>\r
20\r
21/**\r
22 Extract ImageFmpInfo from system firmware.\r
23\r
24 @param[in] SystemFirmwareImage The System Firmware image.\r
25 @param[in] SystemFirmwareImageSize The size of the System Firmware image in bytes.\r
26 @param[out] ImageFmpInfo The ImageFmpInfo.\r
27 @param[out] ImageFmpInfoSize The size of the ImageFmpInfo in bytes.\r
28\r
29 @retval TRUE The ImageFmpInfo is extracted.\r
30 @retval FALSE The ImageFmpInfo is not extracted.\r
31**/\r
32BOOLEAN\r
33EFIAPI\r
34ExtractSystemFirmwareImageFmpInfo (\r
35 IN VOID *SystemFirmwareImage,\r
36 IN UINTN SystemFirmwareImageSize,\r
37 OUT EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR **ImageFmpInfo,\r
38 OUT UINTN *ImageFmpInfoSize\r
39 );\r
40\r
41/**\r
42 Extract the driver FV from an authenticated image.\r
43\r
44 @param[in] AuthenticatedImage The authenticated capsule image.\r
45 @param[in] AuthenticatedImageSize The size of the authenticated capsule image in bytes.\r
46 @param[out] DriverFvImage The driver FV image.\r
47 @param[out] DriverFvImageSize The size of the driver FV image in bytes.\r
48\r
49 @retval TRUE The driver Fv is extracted.\r
50 @retval FALSE The driver Fv is not extracted.\r
51**/\r
52BOOLEAN\r
53EFIAPI\r
54ExtractDriverFvImage (\r
55 IN VOID *AuthenticatedImage,\r
56 IN UINTN AuthenticatedImageSize,\r
57 OUT VOID **DriverFvImage,\r
58 OUT UINTN *DriverFvImageSize\r
59 );\r
60\r
61/**\r
62 Extract the config image from an authenticated image.\r
63\r
64 @param[in] AuthenticatedImage The authenticated capsule image.\r
65 @param[in] AuthenticatedImageSize The size of the authenticated capsule image in bytes.\r
66 @param[out] ConfigImage The config image.\r
67 @param[out] ConfigImageSize The size of the config image in bytes.\r
68\r
69 @retval TRUE The config image is extracted.\r
70 @retval FALSE The config image is not extracted.\r
71**/\r
72BOOLEAN\r
73EFIAPI\r
74ExtractConfigImage (\r
75 IN VOID *AuthenticatedImage,\r
76 IN UINTN AuthenticatedImageSize,\r
77 OUT VOID **ConfigImage,\r
78 OUT UINTN *ConfigImageSize\r
79 );\r
80\r
81/**\r
82 Extract the System Firmware image from an authenticated image.\r
83\r
84 @param[in] AuthenticatedImage The authenticated capsule image.\r
85 @param[in] AuthenticatedImageSize The size of the authenticated capsule image in bytes.\r
86 @param[out] SystemFirmwareImage The System Firmware image.\r
87 @param[out] SystemFirmwareImageSize The size of the System Firmware image in bytes.\r
88\r
89 @retval TRUE The System Firmware image is extracted.\r
90 @retval FALSE The System Firmware image is not extracted.\r
91**/\r
92BOOLEAN\r
93EFIAPI\r
94ExtractSystemFirmwareImage (\r
95 IN VOID *AuthenticatedImage,\r
96 IN UINTN AuthenticatedImageSize,\r
97 OUT VOID **SystemFirmwareImage,\r
98 OUT UINTN *SystemFirmwareImageSize\r
99 );\r
100\r
101/**\r
102 Extract the authenticated image from an FMP capsule image.\r
103\r
104 @param[in] Image The FMP capsule image, including EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r
105 @param[in] ImageSize The size of FMP capsule image in bytes.\r
106 @param[out] LastAttemptStatus The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r
107 @param[out] AuthenticatedImage The authenticated capsule image, excluding EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r
108 @param[out] AuthenticatedImageSize The size of the authenticated capsule image in bytes.\r
109\r
110 @retval TRUE The authenticated image is extracted.\r
111 @retval FALSE The authenticated image is not extracted.\r
112**/\r
113BOOLEAN\r
114EFIAPI\r
115ExtractAuthenticatedImage (\r
116 IN VOID *Image,\r
117 IN UINTN ImageSize,\r
118 OUT UINT32 *LastAttemptStatus,\r
119 OUT VOID **AuthenticatedImage,\r
120 OUT UINTN *AuthenticatedImageSize\r
121 );\r
122\r
123/**\r
124 Authenticated system firmware FMP capsule image.\r
125\r
126 Caution: This function may receive untrusted input.\r
127\r
128 @param[in] Image The FMP capsule image, including EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r
129 @param[in] ImageSize The size of FMP capsule image in bytes.\r
130 @param[in] ForceVersionMatch TRUE: The version of capsule must be as same as the version of current image.\r
131 FALSE: The version of capsule must be as same as greater than the lowest\r
132 supported version of current image.\r
133 @param[out] LastAttemptVersion The last attempt version, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r
134 @param[out] LastAttemptStatus The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r
135 @param[out] AuthenticatedImage The authenticated capsule image, excluding EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r
136 @param[out] AuthenticatedImageSize The size of the authenticated capsule image in bytes.\r
137\r
138 @retval TRUE Authentication passes and the authenticated image is extracted.\r
139 @retval FALSE Authentication fails and the authenticated image is not extracted.\r
140**/\r
141EFI_STATUS\r
142EFIAPI\r
143CapsuleAuthenticateSystemFirmware (\r
144 IN VOID *Image,\r
145 IN UINTN ImageSize,\r
146 IN BOOLEAN ForceVersionMatch,\r
147 OUT UINT32 *LastAttemptVersion,\r
148 OUT UINT32 *LastAttemptStatus,\r
149 OUT VOID **AuthenticatedImage,\r
150 OUT UINTN *AuthenticatedImageSize\r
151 );\r
152\r
153#endif\r
154\r