OpenCore: Sync with OcConfigurationLib

This commit is contained in:
vit9696 2019-04-06 15:41:15 +03:00
parent c70147a4e3
commit c1abcffb4e
5 changed files with 61 additions and 6 deletions

View File

@ -16,6 +16,7 @@
#define OPEN_CORE_H
#include <Library/OcConfigurationLib.h>
#include <Library/OcCpuLib.h>
#include <Library/OcStorageLib.h>
#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

View File

@ -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

View File

@ -24,6 +24,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/MemoryAllocationLib.h>
#include <Library/OcBootManagementLib.h>
#include <Library/OcConfigurationLib.h>
#include <Library/OcCpuLib.h>
#include <Library/OcDevicePathLib.h>
#include <Library/OcStorageLib.h>
#include <Library/UefiBootServicesTableLib.h>
@ -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,

View File

@ -64,7 +64,6 @@
DevicePathLib
OcDevicePropertyLib
OcMiscLib
OcProtocolLib
OcAppleBootPolicyLib
OcBootManagementLib
OcConfigurationLib

View File

@ -17,6 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PrintLib.h>
#include <Library/OcCpuLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Protocol/DevicePath.h>
@ -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 ();
}
}