[edk2-devel] [PATCH v2] MdeModulePkg/EsrtFmpDxe: Support multiple devices with 0 HardwareInstance
Jeff Brasen via groups.io
jbrasen=nvidia.com at groups.io
Mon Dec 12 19:27:26 UTC 2022
Skip error check if HardwareInstance is 0 as this either means that
FmpVersion < 3 and not supported or,
"A zero means the FMP provider is not able to determine a
unique hardware instance number or a hardware instance number
is not needed." per UEFI specification.
As the FmpInstances are merged and HardwareInstance is not used
remove error check in this case.
Signed-off-by: Jeff Brasen <jbrasen at nvidia.com>
---
MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c | 22 ++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
index 4f47c55cce..5bc627461d 100644
--- a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
+++ b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
@@ -153,16 +153,20 @@ CreateEsrtEntry (
//
// Check to see of FmpImageInfoBuf GUID/HardwareInstance is unique
+ // Skip if HardwareInstance is 0 as this is the case if FmpVersion < 3
+ // or the device can not create a unique ID per UEFI specification
//
- for (Index = 0; Index < *NumberOfDescriptors; Index++) {
- if (CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId)) {
- if (HardwareInstances[Index].HardwareInstance == FmpHardwareInstance) {
- DEBUG ((DEBUG_ERROR, "EsrtFmpDxe: Duplicate firmware image descriptor with GUID %g HardwareInstance:0x%x\n", &FmpImageInfoBuf->ImageTypeId, FmpHardwareInstance));
- ASSERT (
- !CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId) ||
- HardwareInstances[Index].HardwareInstance != FmpHardwareInstance
- );
- return EFI_UNSUPPORTED;
+ if (FmpHardwareInstance != 0) {
+ for (Index = 0; Index < *NumberOfDescriptors; Index++) {
+ if (CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId)) {
+ if (HardwareInstances[Index].HardwareInstance == FmpHardwareInstance) {
+ DEBUG ((DEBUG_ERROR, "EsrtFmpDxe: Duplicate firmware image descriptor with GUID %g HardwareInstance:0x%x\n", &FmpImageInfoBuf->ImageTypeId, FmpHardwareInstance));
+ ASSERT (
+ !CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId) ||
+ HardwareInstances[Index].HardwareInstance != FmpHardwareInstance
+ );
+ return EFI_UNSUPPORTED;
+ }
}
}
}
--
2.25.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97277): https://edk2.groups.io/g/devel/message/97277
Mute This Topic: https://groups.io/mt/95629273/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list