not set, the capsule has been successfully processed by the firmware.\r
If it set, the ScattlerGatherList is successfully to be set.\r
EFI_INVALID_PARAMETER CapsuleCount is less than 1,CapsuleGuid is not supported.\r
- EFI_DEVICE_ERROR Failed to SetVariable or AllocatePool or ProcessFirmwareVolume.\r
+ EFI_DEVICE_ERROR Failed to SetVariable or ProcessFirmwareVolume.\r
\r
--*/\r
{\r
- UINTN CapsuleSize;\r
UINTN ArrayNumber;\r
- VOID *BufferPtr;\r
EFI_STATUS Status;\r
- EFI_HANDLE FvHandle;\r
EFI_CAPSULE_HEADER *CapsuleHeader;\r
\r
if (CapsuleCount < 1) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- BufferPtr = NULL;\r
CapsuleHeader = NULL;\r
\r
for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {\r
return EFI_INVALID_PARAMETER;\r
}\r
//\r
- // To remove this check. Capsule update supports non reset image.\r
- // \r
- // if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) {\r
- // return EFI_UNSUPPORTED;\r
- // }\r
+ // Check Capsule image without populate flag by firmware support capsule function \r
+ //\r
+ if (((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) && \r
+ (SupportCapsuleImage (CapsuleHeader) != EFI_SUCCESS)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
}\r
\r
//\r
- // Check capsule guid is suppored by this platform. To do\r
- //\r
-\r
- //\r
- //Assume that capsules have the same flags on reseting or not.\r
+ // Assume that capsules have the same flags on reseting or not.\r
//\r
CapsuleHeader = CapsuleHeaderArray[0];\r
\r
if ((CapsuleHeader->Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) != 0) {\r
//\r
- //Check if the platform supports update capsule across a system reset\r
+ // Check if the platform supports update capsule across a system reset\r
//\r
if (!FeaturePcdGet(PcdSupportUpdateCapsuleRest)) {\r
return EFI_UNSUPPORTED;\r
if (Status != EFI_SUCCESS) {\r
return Status;\r
}\r
+ //\r
+ // Successfully set the capsule image address into variable.\r
+ //\r
+ return EFI_SUCCESS;\r
}\r
- return EFI_SUCCESS;\r
}\r
\r
//\r
// The rest occurs in the condition of non-reset mode\r
- // Current Runtime mode doesn't support the non-reset capsule image.\r
+ // Now Runtime mode doesn't support the non-reset capsule image.\r
//\r
if (EfiAtRuntime ()) {\r
return EFI_INVALID_PARAMETER;\r
\r
//\r
// Here should be in the boot-time for non-reset capsule image\r
- // Default process to Update Capsule image into Flash for any guid image.\r
+ // Default process to Update Capsule image into Flash.\r
//\r
for (ArrayNumber = 0; ArrayNumber < CapsuleCount ; ArrayNumber++) {\r
- CapsuleHeader = CapsuleHeaderArray[ArrayNumber];\r
- CapsuleSize = CapsuleHeader->CapsuleImageSize - CapsuleHeader->HeaderSize;\r
-\r
- BufferPtr = AllocatePool (CapsuleSize);\r
- if (BufferPtr == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
-\r
- CopyMem (BufferPtr, (UINT8*)CapsuleHeader+ CapsuleHeader->HeaderSize, CapsuleSize);\r
-\r
- //\r
- //Call DXE service ProcessFirmwareVolume to process immediatelly\r
- //\r
- Status = gDS->ProcessFirmwareVolume (BufferPtr, CapsuleSize, &FvHandle);\r
- if (Status != EFI_SUCCESS) {\r
- FreePool (BufferPtr);\r
+ Status = ProcessCapsuleImage (CapsuleHeaderArray[ArrayNumber]);\r
+ if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
- gDS->Dispatch ();\r
- FreePool (BufferPtr);\r
}\r
\r
return EFI_SUCCESS;\r
return EFI_INVALID_PARAMETER;\r
}\r
//\r
- // To remove this check. Capsule update supports non reset image.\r
- // \r
- // if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) {\r
- // return EFI_UNSUPPORTED;\r
- // }\r
+ // Check Capsule image without populate flag by firmware support capsule function \r
+ //\r
+ if (((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) && \r
+ (SupportCapsuleImage (CapsuleHeader) != EFI_SUCCESS)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
}\r
\r
//\r