]>
Commit | Line | Data |
---|---|---|
0537d50f | 1 | /** @file\r |
504214c4 | 2 | \r |
e9b67286 | 3 | This library class defines a set of interfaces for how to process capsule image updates.\r |
0537d50f | 4 | \r |
8636f70b | 5 | Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>\r |
9d510e61 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
0537d50f LG |
7 | \r |
8 | **/\r | |
9 | \r | |
10 | #ifndef __CAPSULE_LIB_H__\r | |
11 | #define __CAPSULE_LIB_H__\r | |
12 | \r | |
8636f70b WX |
13 | //\r |
14 | // BOOLEAN Variable to indicate whether system is in the capsule on disk state.\r | |
15 | //\r | |
16 | #define COD_RELOCATION_INFO_VAR_NAME L"CodRelocationInfo"\r | |
17 | \r | |
0537d50f | 18 | /**\r |
d1102dba LG |
19 | The firmware checks whether the capsule image is supported\r |
20 | by the CapsuleGuid in CapsuleHeader or if there is other specific information in\r | |
64a80549 | 21 | the capsule image.\r |
0fb30bc9 JY |
22 | \r |
23 | Caution: This function may receive untrusted input.\r | |
24 | \r | |
64a80549 | 25 | @param CapsuleHeader Pointer to the UEFI capsule image to be checked.\r |
d1102dba | 26 | \r |
0537d50f LG |
27 | @retval EFI_SUCESS Input capsule is supported by firmware.\r |
28 | @retval EFI_UNSUPPORTED Input capsule is not supported by the firmware.\r | |
29 | **/\r | |
30 | EFI_STATUS\r | |
31 | EFIAPI\r | |
32 | SupportCapsuleImage (\r | |
33 | IN EFI_CAPSULE_HEADER *CapsuleHeader\r | |
ed66e1bc | 34 | );\r |
0537d50f LG |
35 | \r |
36 | /**\r | |
e9b67286 | 37 | The firmware-specific implementation processes the capsule image\r |
109e9a61 | 38 | if it recognized the format of this capsule image.\r |
0fb30bc9 JY |
39 | \r |
40 | Caution: This function may receive untrusted input.\r | |
41 | \r | |
d1102dba LG |
42 | @param CapsuleHeader Pointer to the UEFI capsule image to be processed.\r |
43 | \r | |
44 | @retval EFI_SUCESS Capsule Image processed successfully.\r | |
0537d50f LG |
45 | @retval EFI_UNSUPPORTED Capsule image is not supported by the firmware.\r |
46 | **/\r | |
47 | EFI_STATUS\r | |
48 | EFIAPI\r | |
49 | ProcessCapsuleImage (\r | |
50 | IN EFI_CAPSULE_HEADER *CapsuleHeader\r | |
ed66e1bc | 51 | );\r |
0537d50f | 52 | \r |
0fb30bc9 JY |
53 | /**\r |
54 | \r | |
55 | This routine is called to process capsules.\r | |
56 | \r | |
57 | Caution: This function may receive untrusted input.\r | |
58 | \r | |
59 | The capsules reported in EFI_HOB_UEFI_CAPSULE are processed.\r | |
60 | If there is no EFI_HOB_UEFI_CAPSULE, this routine does nothing.\r | |
61 | \r | |
62 | This routine should be called twice in BDS.\r | |
63 | 1) The first call must be before EndOfDxe. The system capsules is processed.\r | |
64 | If device capsule FMP protocols are exposted at this time and device FMP\r | |
65 | capsule has zero EmbeddedDriverCount, the device capsules are processed.\r | |
66 | Each individual capsule result is recorded in capsule record variable.\r | |
67 | System may reset in this function, if reset is required by capsule and\r | |
68 | all capsules are processed.\r | |
69 | If not all capsules are processed, reset will be defered to second call.\r | |
70 | \r | |
71 | 2) The second call must be after EndOfDxe and after ConnectAll, so that all\r | |
72 | device capsule FMP protocols are exposed.\r | |
73 | The system capsules are skipped. If the device capsules are NOT processed\r | |
74 | in first call, they are processed here.\r | |
75 | Each individual capsule result is recorded in capsule record variable.\r | |
76 | System may reset in this function, if reset is required by capsule\r | |
77 | processed in first call and second call.\r | |
78 | \r | |
79 | @retval EFI_SUCCESS There is no error when processing capsules.\r | |
80 | @retval EFI_OUT_OF_RESOURCES No enough resource to process capsules.\r | |
81 | \r | |
82 | **/\r | |
83 | EFI_STATUS\r | |
84 | EFIAPI\r | |
85 | ProcessCapsules (\r | |
86 | VOID\r | |
87 | );\r | |
88 | \r | |
8636f70b WX |
89 | /**\r |
90 | This routine is called to check if CapsuleOnDisk flag in OsIndications Variable\r | |
91 | is enabled.\r | |
92 | \r | |
93 | @retval TRUE Flag is enabled\r | |
94 | @retval FALSE Flag is not enabled\r | |
95 | \r | |
96 | **/\r | |
97 | BOOLEAN\r | |
98 | EFIAPI\r | |
99 | CoDCheckCapsuleOnDiskFlag(\r | |
100 | VOID\r | |
101 | );\r | |
102 | \r | |
103 | /**\r | |
104 | This routine is called to clear CapsuleOnDisk flags including OsIndications and BootNext variable\r | |
105 | \r | |
106 | @retval EFI_SUCCESS All Capsule On Disk flags are cleared\r | |
107 | \r | |
108 | **/\r | |
109 | EFI_STATUS\r | |
110 | EFIAPI\r | |
111 | CoDClearCapsuleOnDiskFlag(\r | |
112 | VOID\r | |
113 | );\r | |
114 | \r | |
115 | /**\r | |
116 | Relocate Capsule on Disk from EFI system partition.\r | |
117 | \r | |
118 | Two solution to deliver Capsule On Disk:\r | |
119 | Solution A: If PcdCapsuleInRamSupport is enabled, relocate Capsule On Disk to memory and call UpdateCapsule().\r | |
120 | Solution B: If PcdCapsuleInRamSupport is disabled, relocate Capsule On Disk to a platform-specific NV storage\r | |
121 | device with BlockIo protocol.\r | |
122 | \r | |
123 | Device enumeration like USB costs time, user can input MaxRetry to tell function to retry.\r | |
124 | Function will stall 100ms between each retry.\r | |
125 | \r | |
126 | Side Effects:\r | |
127 | Capsule Delivery Supported Flag in OsIndication variable and BootNext variable will be cleared.\r | |
128 | Solution B: Content corruption. Block IO write directly touches low level write. Orignal partitions, file\r | |
129 | systems of the relocation device will be corrupted.\r | |
130 | \r | |
131 | @param[in] MaxRetry Max Connection Retry. Stall 100ms between each connection try to ensure\r | |
132 | devices like USB can get enumerated. Input 0 means no retry.\r | |
133 | \r | |
134 | @retval EFI_SUCCESS Capsule on Disk images are successfully relocated.\r | |
135 | \r | |
136 | **/\r | |
137 | EFI_STATUS\r | |
138 | EFIAPI\r | |
139 | CoDRelocateCapsule(\r | |
140 | UINTN MaxRetry\r | |
141 | );\r | |
142 | \r | |
143 | /**\r | |
144 | Remove the temp file from the root of EFI System Partition.\r | |
145 | Device enumeration like USB costs time, user can input MaxRetry to tell function to retry.\r | |
146 | Function will stall 100ms between each retry.\r | |
147 | \r | |
148 | @param[in] MaxRetry Max Connection Retry. Stall 100ms between each connection try to ensure\r | |
149 | devices like USB can get enumerated. Input 0 means no retry.\r | |
150 | \r | |
151 | @retval EFI_SUCCESS Remove the temp file successfully.\r | |
152 | \r | |
153 | **/\r | |
154 | EFI_STATUS\r | |
155 | EFIAPI\r | |
156 | CoDRemoveTempFile (\r | |
157 | UINTN MaxRetry\r | |
158 | );\r | |
159 | \r | |
0537d50f | 160 | #endif\r |