diff options
Diffstat (limited to 'MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c')
-rw-r--r-- | MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c index 8befbae..9281322 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c @@ -10,7 +10,7 @@ ValidateFmpCapsule(), and DisplayCapsuleImage() receives untrusted input and
performs basic validation.
- Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2016 - 2024, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2024, Ampere Computing LLC. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -49,7 +49,7 @@ EFI_EVENT mDxeCapsuleLibEndOfDxeEvent = NULL; EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL *mFmpProgress = NULL;
-BOOLEAN mDxeCapsuleLibReadyToBootEvent = FALSE;
+BOOLEAN mDxeCapsuleLibIsExitBootService = FALSE;
/**
Initialize capsule related variables.
@@ -104,7 +104,7 @@ RecordFmpCapsuleStatusVariable ( @param[in] Completion A value between 1 and 100 indicating the current
completion progress of the firmware update
- @retval EFI_SUCESS The capsule update progress was updated.
+ @retval EFI_SUCCESS The capsule update progress was updated.
@retval EFI_INVALID_PARAMETER Completion is greater than 100%.
**/
EFI_STATUS
@@ -169,6 +169,10 @@ IsValidCapsuleHeader ( IN UINT64 CapsuleSize
)
{
+ if (CapsuleHeader == NULL) {
+ return FALSE;
+ }
+
if (CapsuleHeader->CapsuleImageSize != CapsuleSize) {
return FALSE;
}
@@ -197,7 +201,7 @@ IsValidCapsuleHeader ( @param[in] CapsuleHeader Points to a capsule header.
@param[out] EmbeddedDriverCount The EmbeddedDriverCount in the FMP capsule.
- @retval EFI_SUCESS Input capsule is a correct FMP capsule.
+ @retval EFI_SUCCESS Input capsule is a correct FMP capsule.
@retval EFI_INVALID_PARAMETER Input capsule is not a correct FMP capsule.
**/
EFI_STATUS
@@ -341,7 +345,7 @@ ValidateFmpCapsule ( @param[in] CapsuleHeader Points to a capsule header.
- @retval EFI_SUCESS Input capsule is supported by firmware.
+ @retval EFI_SUCCESS Input capsule is supported by firmware.
@retval EFI_UNSUPPORTED Input capsule is not supported by the firmware.
**/
EFI_STATUS
@@ -1194,7 +1198,7 @@ RecordFmpCapsuleStatus ( @param[in] CapFileName Capsule file name.
@param[out] ResetRequired Indicates whether reset is required or not.
- @retval EFI_SUCESS Process Capsule Image successfully.
+ @retval EFI_SUCCESS Process Capsule Image successfully.
@retval EFI_UNSUPPORTED Capsule image is not supported by the firmware.
@retval EFI_VOLUME_CORRUPTED FV volume in the capsule is corrupted.
@retval EFI_OUT_OF_RESOURCES Not enough memory.
@@ -1396,25 +1400,17 @@ IsNestedFmpCapsule ( EFI_SYSTEM_RESOURCE_ENTRY Entry;
EsrtGuidFound = FALSE;
- if (mEsrtTable != NULL) {
- EsrtEntry = (EFI_SYSTEM_RESOURCE_ENTRY *)(mEsrtTable + 1);
- for (Index = 0; Index < mEsrtTable->FwResourceCount; Index++, EsrtEntry++) {
- if (CompareGuid (&EsrtEntry->FwClass, &CapsuleHeader->CapsuleGuid)) {
- EsrtGuidFound = TRUE;
- break;
+ if (mDxeCapsuleLibIsExitBootService) {
+ if (mEsrtTable != NULL) {
+ EsrtEntry = (EFI_SYSTEM_RESOURCE_ENTRY *)(mEsrtTable + 1);
+ for (Index = 0; Index < mEsrtTable->FwResourceCount; Index++, EsrtEntry++) {
+ if (CompareGuid (&EsrtEntry->FwClass, &CapsuleHeader->CapsuleGuid)) {
+ EsrtGuidFound = TRUE;
+ break;
+ }
}
}
} else {
- if (mDxeCapsuleLibReadyToBootEvent) {
- //
- // The ESRT table (mEsrtTable) in the Configuration Table would be located
- // at the ReadyToBoot event if it exists. Hence, it should return here to
- // avoid a crash due to calling gBS->LocateProtocol () at runtime in case
- // there is no ERST table installed.
- //
- return FALSE;
- }
-
//
// Check ESRT protocol
//
@@ -1500,7 +1496,7 @@ IsFmpCapsule ( @param[in] CapsuleHeader Points to a capsule header.
- @retval EFI_SUCESS Input capsule is supported by firmware.
+ @retval EFI_SUCCESS Input capsule is supported by firmware.
@retval EFI_UNSUPPORTED Input capsule is not supported by the firmware.
@retval EFI_INVALID_PARAMETER Input capsule layout is not correct
**/
@@ -1551,7 +1547,7 @@ SupportCapsuleImage ( @param[in] CapFileName Capsule file name.
@param[out] ResetRequired Indicates whether reset is required or not.
- @retval EFI_SUCESS Process Capsule Image successfully.
+ @retval EFI_SUCCESS Process Capsule Image successfully.
@retval EFI_UNSUPPORTED Capsule image is not supported by the firmware.
@retval EFI_VOLUME_CORRUPTED FV volume in the capsule is corrupted.
@retval EFI_OUT_OF_RESOURCES Not enough memory.
@@ -1614,7 +1610,7 @@ ProcessThisCapsuleImage ( @param[in] CapsuleHeader Points to a capsule header.
- @retval EFI_SUCESS Process Capsule Image successfully.
+ @retval EFI_SUCCESS Process Capsule Image successfully.
@retval EFI_UNSUPPORTED Capsule image is not supported by the firmware.
@retval EFI_VOLUME_CORRUPTED FV volume in the capsule is corrupted.
@retval EFI_OUT_OF_RESOURCES Not enough memory.
|