24UINT32 mMaxSizePopulateCapsule = 0;
25UINT32 mMaxSizeNonPopulateCapsule = 0;
73 BOOLEAN InitiateReset;
74 CHAR16 CapsuleVarName[30];
82 return EFI_UNSUPPORTED;
88 if (CapsuleCount < 1) {
89 return EFI_INVALID_PARAMETER;
93 InitiateReset =
FALSE;
95 CapsuleVarName[0] = 0;
97 for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {
102 CapsuleHeader = CapsuleHeaderArray[ArrayNumber];
103 if ((CapsuleHeader->
Flags & (CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE)) == CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) {
104 return EFI_INVALID_PARAMETER;
111 if ((CapsuleHeader->
Flags & (CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_INITIATE_RESET)) == CAPSULE_FLAGS_INITIATE_RESET) {
112 return EFI_INVALID_PARAMETER;
119 && ((CapsuleHeader->
Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) != 0))
121 return EFI_INVALID_PARAMETER;
127 if ((CapsuleHeader->
Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) {
129 if (EFI_ERROR (Status)) {
139 for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {
140 CapsuleHeader = CapsuleHeaderArray[ArrayNumber];
145 if ((CapsuleHeader->
Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) == 0) {
147 Status = EFI_OUT_OF_RESOURCES;
152 if (EFI_ERROR (Status)) {
157 if ((CapsuleHeader->
Flags & CAPSULE_FLAGS_INITIATE_RESET) != 0) {
158 InitiateReset =
TRUE;
176 return EFI_INVALID_PARAMETER;
183 return EFI_UNSUPPORTED;
193 TempVarName = CapsuleVarName +
StrLen (CapsuleVarName);
197 sizeof (CapsuleVarName) - ((
UINTN)TempVarName - (
UINTN)CapsuleVarName),
211 &gEfiCapsuleVendorGuid,
214 (VOID *)&ScatterGatherList
216 if (!EFI_ERROR (Status)) {
270 OUT UINT64 *MaxiumCapsuleSize,
282 if (CapsuleCount < 1) {
283 return EFI_INVALID_PARAMETER;
289 if ((MaxiumCapsuleSize ==
NULL) || (ResetType ==
NULL)) {
290 return EFI_INVALID_PARAMETER;
293 CapsuleHeader =
NULL;
296 for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {
297 CapsuleHeader = CapsuleHeaderArray[ArrayNumber];
302 if ((CapsuleHeader->
Flags & (CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE)) == CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) {
303 return EFI_INVALID_PARAMETER;
310 if ((CapsuleHeader->
Flags & (CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_INITIATE_RESET)) == CAPSULE_FLAGS_INITIATE_RESET) {
311 return EFI_INVALID_PARAMETER;
318 && ((CapsuleHeader->
Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) != 0))
320 return EFI_INVALID_PARAMETER;
326 if ((CapsuleHeader->
Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) {
328 if (EFI_ERROR (Status)) {
337 for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {
338 CapsuleHeader = CapsuleHeaderArray[ArrayNumber];
339 if ((CapsuleHeader->
Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) != 0) {
350 return EFI_UNSUPPORTED;
354 *MaxiumCapsuleSize = (UINT64)mMaxSizePopulateCapsule;
360 *MaxiumCapsuleSize = (UINT64)mMaxSizeNonPopulateCapsule;
385 mMaxSizePopulateCapsule =
PcdGet32 (PcdMaxSizePopulateCapsule);
386 mMaxSizeNonPopulateCapsule =
PcdGet32 (PcdMaxSizeNonPopulateCapsule);
407 Status =
gBS->InstallMultipleProtocolInterfaces (
409 &gEfiCapsuleArchProtocolGuid,
BOOLEAN IsPersistAcrossResetCapsuleSupported(VOID)
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
VOID CapsuleCacheWriteBack(IN EFI_PHYSICAL_ADDRESS ScatterGatherList)
EFI_STATUS EFIAPI ProcessCapsuleImage(IN EFI_CAPSULE_HEADER *CapsuleHeader)
EFI_STATUS EFIAPI SupportCapsuleImage(IN EFI_CAPSULE_HEADER *CapsuleHeader)
EFI_STATUS EFIAPI QueryCapsuleCapabilities(IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, IN UINTN CapsuleCount, OUT UINT64 *MaxiumCapsuleSize, OUT EFI_RESET_TYPE *ResetType)
EFI_STATUS EFIAPI CapsuleServiceInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI UpdateCapsule(IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, IN UINTN CapsuleCount, IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL)
VOID SaveLongModeContext(VOID)
#define EFI_CAPSULE_VARIABLE_NAME
RETURN_STATUS EFIAPI UnicodeValueToStringS(IN OUT CHAR16 *Buffer, IN UINTN BufferSize, IN UINTN Flags, IN INT64 Value, IN UINTN Width)
EFI_RUNTIME_SERVICES * gRT
#define ASSERT_EFI_ERROR(StatusParameter)
#define PcdGet32(TokenName)
#define PcdGetBool(TokenName)
#define FeaturePcdGet(TokenName)
UINT64 EFI_PHYSICAL_ADDRESS
#define EFI_VARIABLE_NON_VOLATILE
BOOLEAN EFIAPI EfiAtRuntime(VOID)
VOID EFIAPI EfiResetSystem(IN EFI_RESET_TYPE ResetType, IN EFI_STATUS ResetStatus, IN UINTN DataSize, IN VOID *ResetData OPTIONAL)
EFI_STATUS EFIAPI EfiSetVariable(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data)