diff --git a/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf b/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf index 8fbc75bfcf..2c66f15399 100644 --- a/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf +++ b/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf @@ -4,7 +4,7 @@ # This driver produces EsrtManagement protocol to manage cache ESRT repository for FMP/Non-FMP instances. # ESRT table based on repository is published on gEfiEventReadyToBootGuid. # -# Copyright (c) 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -64,6 +64,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdMaxFmpEsrtCacheNum ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMaxNonFmpEsrtCacheNum ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdSystemRebootAfterCapsuleProcessFlag ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid ## CONSUMES [Depex] gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid diff --git a/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c b/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c index f6d1e97451..35a237e3cc 100644 --- a/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c +++ b/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c @@ -1,7 +1,7 @@ /** @file Esrt management implementation. -Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -390,6 +390,35 @@ EXIT: return Status; } +/** + Return if this FMP is a system FMP or a device FMP, based upon FmpImageInfo. + + @param[in] FmpImageInfo A pointer to EFI_FIRMWARE_IMAGE_DESCRIPTOR + + @return TRUE It is a system FMP. + @return FALSE It is a device FMP. +**/ +BOOLEAN +IsSystemFmp ( + IN EFI_FIRMWARE_IMAGE_DESCRIPTOR *FmpImageInfo + ) +{ + GUID *Guid; + UINTN Count; + UINTN Index; + + Guid = PcdGetPtr(PcdSystemFmpCapsuleImageTypeIdGuid); + Count = PcdGetSize(PcdSystemFmpCapsuleImageTypeIdGuid)/sizeof(GUID); + + for (Index = 0; Index < Count; Index++, Guid++) { + if (CompareGuid(&FmpImageInfo->ImageTypeId, Guid)) { + return TRUE; + } + } + + return FALSE; +} + /** Init one ESRT entry according to input FmpImageInfo (V1, V2, V3) . @@ -407,7 +436,11 @@ SetEsrtEntryFromFmpInfo ( { EsrtEntry->FwVersion = FmpImageInfo->Version; EsrtEntry->FwClass = FmpImageInfo->ImageTypeId; - EsrtEntry->FwType = ESRT_FW_TYPE_DEVICEFIRMWARE; + if (IsSystemFmp(FmpImageInfo)) { + EsrtEntry->FwType = ESRT_FW_TYPE_SYSTEMFIRMWARE; + } else { + EsrtEntry->FwType = ESRT_FW_TYPE_DEVICEFIRMWARE; + } EsrtEntry->LowestSupportedFwVersion = 0; EsrtEntry->CapsuleFlags = 0; EsrtEntry->LastAttemptVersion = 0;