From d2ba13b6a2f4b6402e070ffab1180a4d4833f312 Mon Sep 17 00:00:00 2001 From: MikeBeaton Date: Fri, 3 Sep 2021 15:19:25 +0100 Subject: [PATCH] OcAppleImg4Lib: Add additional matched logic to fall back to NVRAM value Updates 239c1a533d101c9e46c675a48585dbe548998582 --- Library/OcMainLib/OpenCorePlatform.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Library/OcMainLib/OpenCorePlatform.c b/Library/OcMainLib/OpenCorePlatform.c index 9195587f..c6c64163 100644 --- a/Library/OcMainLib/OpenCorePlatform.c +++ b/Library/OcMainLib/OpenCorePlatform.c @@ -858,6 +858,7 @@ OcGetLegacySecureBootECID ( EFI_STATUS Status; OC_SMBIOS_TABLE SmbiosTable; EFI_GUID Uuid; + UINTN ReadSize; ASSERT (Config != NULL); ASSERT (ApECID != NULL); @@ -897,7 +898,7 @@ OcGetLegacySecureBootECID ( } DEBUG ((DEBUG_INFO, "OC: Grabbed SB uuid %g from auto config - %r\n", &Uuid, Status)); } - } else { + } else if (Config->PlatformInfo.UpdateNvram) { Status = OcAsciiStrToRawGuid (OC_BLOB_GET (&Config->PlatformInfo.Nvram.SystemUuid), &Uuid); if (EFI_ERROR (Status)) { ZeroMem (&Uuid, sizeof (Uuid)); @@ -905,6 +906,21 @@ OcGetLegacySecureBootECID ( DEBUG ((DEBUG_INFO, "OC: Grabbed SB uuid %g from manual config - %r\n", &Uuid, Status)); } + if (IsZeroGuid (&Uuid)) { + ReadSize = sizeof (Uuid); + Status = gRT->GetVariable ( + L"system-id", + &gAppleVendorVariableGuid, + NULL, + &ReadSize, + &Uuid + ); + if (EFI_ERROR (Status)) { + ZeroMem (&Uuid, sizeof (Uuid)); + } + DEBUG ((DEBUG_INFO, "OC: Grabbed SB uuid %g direct from NVRAM - %r\n", &Uuid, Status)); + } + if (IsZeroGuid (&Uuid)) { DEBUG ((DEBUG_ERROR, "OC: Grabbed zero system-id for SB, this is not allowed\n")); CpuDeadLoop ();