OcAppleImg4Lib: Add additional matched logic to fall back to NVRAM value

Updates 239c1a533d101c9e46c675a48585dbe548998582
This commit is contained in:
MikeBeaton 2021-09-03 15:19:25 +01:00
parent 239c1a533d
commit d2ba13b6a2

View File

@ -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 ();