mirror of https://github.com/acidanthera/audk.git
Enhance Capsule driver to update capsule one by one.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9082 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
bdb140d76b
commit
409d47b49e
|
@ -63,6 +63,7 @@ UpdateCapsule (
|
|||
UINTN ArrayNumber;
|
||||
EFI_STATUS Status;
|
||||
EFI_CAPSULE_HEADER *CapsuleHeader;
|
||||
BOOLEAN NeedReset;
|
||||
|
||||
//
|
||||
// Capsule Count can't be less than one.
|
||||
|
@ -70,7 +71,7 @@ UpdateCapsule (
|
|||
if (CapsuleCount < 1) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
NeedReset = FALSE;
|
||||
CapsuleHeader = NULL;
|
||||
|
||||
for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {
|
||||
|
@ -92,27 +93,52 @@ UpdateCapsule (
|
|||
}
|
||||
|
||||
//
|
||||
// Assume that capsules have the same flags on reseting or not.
|
||||
// Walk through all capsules, record whether there is a capsule
|
||||
// needs reset. And then process capsules which has no reset flag directly.
|
||||
//
|
||||
CapsuleHeader = CapsuleHeaderArray[0];
|
||||
for (ArrayNumber = 0; ArrayNumber < CapsuleCount ; ArrayNumber++) {
|
||||
CapsuleHeader = CapsuleHeaderArray[ArrayNumber];
|
||||
//
|
||||
// Here should be in the boot-time for non-reset capsule image
|
||||
// Platform specific update for the non-reset capsule image.
|
||||
//
|
||||
if ((CapsuleHeader->Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) == 0) {
|
||||
if (EfiAtRuntime ()) {
|
||||
Status = EFI_UNSUPPORTED;
|
||||
} else {
|
||||
Status = ProcessCapsuleImage(CapsuleHeader);
|
||||
}
|
||||
if (EFI_ERROR(Status)) {
|
||||
return Status;
|
||||
}
|
||||
} else {
|
||||
NeedReset = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Process across reset capsule image.
|
||||
// After launching all capsules who has no reset flag, if no more capsules claims
|
||||
// for a system reset just return.
|
||||
//
|
||||
if ((CapsuleHeader->Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) != 0) {
|
||||
//
|
||||
// Check if the platform supports update capsule across a system reset
|
||||
//
|
||||
if (!FeaturePcdGet(PcdSupportUpdateCapsuleReset)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
if (!NeedReset) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// ScatterGatherList is only referenced if the capsules are defined to persist across
|
||||
// system reset.
|
||||
//
|
||||
if (ScatterGatherList == (EFI_PHYSICAL_ADDRESS) (UINTN) NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
} else {
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the platform supports update capsule across a system reset
|
||||
//
|
||||
if (!FeaturePcdGet(PcdSupportUpdateCapsuleReset)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// ScatterGatherList is only referenced if the capsules are defined to persist across
|
||||
// system reset. Set its value into NV storage to let pre-boot driver to pick it up
|
||||
|
@ -125,38 +151,8 @@ UpdateCapsule (
|
|||
sizeof (UINTN),
|
||||
(VOID *) &ScatterGatherList
|
||||
);
|
||||
if (Status != EFI_SUCCESS) {
|
||||
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Successfully set the capsule image address into EFI variable.
|
||||
//
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Process the non-reset capsule image.
|
||||
//
|
||||
if (EfiAtRuntime ()) {
|
||||
//
|
||||
// Runtime mode doesn't support the non-reset capsule image.
|
||||
//
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Here should be in the boot-time for non-reset capsule image
|
||||
// Platform specific update for the non-reset capsule image.
|
||||
//
|
||||
for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {
|
||||
Status = ProcessCapsuleImage (CapsuleHeaderArray[ArrayNumber]);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue