diff --git a/Include/OpenCore.h b/Include/OpenCore.h index 9846058c..c6e3fe8f 100644 --- a/Include/OpenCore.h +++ b/Include/OpenCore.h @@ -16,6 +16,7 @@ #define OPEN_CORE_H #include +#include #include #define OPEN_CORE_IMAGE_PATH L"EFI\\OC\\OpenCore.efi" @@ -36,7 +37,8 @@ VOID OcLoadUefiSupport ( IN OC_STORAGE_CONTEXT *Storage, - IN OC_GLOBAL_CONFIG *Config + IN OC_GLOBAL_CONFIG *Config, + IN OC_CPU_INFO *CpuInfo ); #endif // OPEN_CORE_H diff --git a/OpenCorePkg.dsc b/OpenCorePkg.dsc index 9057dc99..c16b2a8c 100755 --- a/OpenCorePkg.dsc +++ b/OpenCorePkg.dsc @@ -68,7 +68,6 @@ OcMachoLib|OcSupportPkg/Library/OcMachoLib/OcMachoLib.inf OcMiscLib|OcSupportPkg/Library/OcMiscLib/OcMiscLib.inf OcPngLib|OcSupportPkg/Library/OcPngLib/OcPngLib.inf - OcProtocolLib|OcSupportPkg/Library/OcProtocolLib/OcProtocolLib.inf OcSerializeLib|OcSupportPkg/Library/OcSerializeLib/OcSerializeLib.inf OcSmbiosLib|OcSupportPkg/Library/OcSmbiosLib/OcSmbiosLib.inf OcStorageLib|OcSupportPkg/Library/OcStorageLib/OcStorageLib.inf diff --git a/Platform/OpenCore/OpenCore.c b/Platform/OpenCore/OpenCore.c index 02c9216c..a6e11f75 100644 --- a/Platform/OpenCore/OpenCore.c +++ b/Platform/OpenCore/OpenCore.c @@ -24,6 +24,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include #include @@ -63,6 +64,7 @@ OcMain ( EFI_STATUS Status; CHAR8 *Config; UINT32 ConfigSize; + OC_CPU_INFO CpuInfo; Config = OcStorageReadFileUnicode ( Storage, @@ -83,7 +85,9 @@ OcMain ( DEBUG ((DEBUG_ERROR, "OC: Failed to load configuration!\n")); } - OcLoadUefiSupport (Storage, &mOpenCoreConfiguration); + OcCpuScanProcessor (&CpuInfo); + + OcLoadUefiSupport (Storage, &mOpenCoreConfiguration, &CpuInfo); Status = OcRunSimpleBootMenu ( OC_SCAN_DEFAULT_POLICY, diff --git a/Platform/OpenCore/OpenCore.inf b/Platform/OpenCore/OpenCore.inf index 26cd335b..6bf99c6f 100644 --- a/Platform/OpenCore/OpenCore.inf +++ b/Platform/OpenCore/OpenCore.inf @@ -64,7 +64,6 @@ DevicePathLib OcDevicePropertyLib OcMiscLib - OcProtocolLib OcAppleBootPolicyLib OcBootManagementLib OcConfigurationLib diff --git a/Platform/OpenCore/OpenCoreUefi.c b/Platform/OpenCore/OpenCoreUefi.c index 8da149ec..0a68ec89 100644 --- a/Platform/OpenCore/OpenCoreUefi.c +++ b/Platform/OpenCore/OpenCoreUefi.c @@ -17,6 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include @@ -154,13 +155,63 @@ ConnectDrivers ( FreePool (HandleBuffer); } +STATIC +VOID +ProvideConsoleGop ( + VOID + ) +{ + EFI_STATUS Status; + VOID *Gop; + + Gop = NULL; + Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, &Gop); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "Missing GOP on ConsoleOutHandle - %r\n", Status)); + Status = gBS->LocateProtocol (&gEfiGraphicsOutputProtocolGuid, NULL, &Gop); + + if (!EFI_ERROR (Status)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &gST->ConsoleOutHandle, + &gEfiGraphicsOutputProtocolGuid, + Gop, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "Failed to install GOP on ConsoleOutHandle - %r\n", Status)); + } + } else { + DEBUG ((DEBUG_WARN, "Missing GOP entirely - %r\n", Status)); + } + } +} + VOID OcLoadUefiSupport ( IN OC_STORAGE_CONTEXT *Storage, - IN OC_GLOBAL_CONFIG *Config + IN OC_GLOBAL_CONFIG *Config, + IN OC_CPU_INFO *CpuInfo ) { + if (Config->Uefi.Quirks.DisableWatchDog) { + // + // boot.efi kills watchdog only in FV2 UI. + // + gBS->SetWatchdogTimer (0, 0, 0, NULL); + } + + if (Config->Uefi.Quirks.IgnoreInvalidFlexRatio) { + OcCpuCorrectFlexRatio (CpuInfo); + } + + if (Config->Uefi.Quirks.ProvideConsoleGop) { + ProvideConsoleGop (); + } + LoadDrivers (Storage, Config); - ConnectDrivers (); + if (Config->Uefi.ConnectDrivers) { + ConnectDrivers (); + } }