mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2025-02-02 22:51:28 +01:00
Merge branch 'opencore_integration' of https://github.com/CloverHackyColor/CloverBootloader into opencore_integration
This commit is contained in:
commit
1171919eda
@ -962,8 +962,8 @@ DEFINE BUILD_OPTIONS=-DMDEPKG_NDEBUG -DCLOVER_BUILD $(VBIOS_PATCH_CLOVEREFI_FLAG
|
||||
MSFT:*_*_*_CC_FLAGS = /FAcs $(BUILD_OPTIONS) -Dinline=__inline /Zi -D DISABLE_NEW_DEPRECATED_INTERFACES -D OC_TARGET_DEBUG
|
||||
|
||||
XCODE:*_*_*_CC_FLAGS = -fno-unwind-tables -Wno-msvc-include -Os $(BUILD_OPTIONS) $(DISABLE_LTO_FLAG) -D DISABLE_NEW_DEPRECATED_INTERFACES -D OC_TARGET_DEBUG
|
||||
GCC:*_*_*_CC_FLAGS = $(BUILD_OPTIONS) $(DISABLE_LTO_FLAG) -D DISABLE_NEW_DEPRECATED_INTERFACES -D OC_TARGET_DEBUG
|
||||
GCC:*_*_*_CXX_FLAGS = $(BUILD_OPTIONS) $(DISABLE_LTO_FLAG) -D DISABLE_NEW_DEPRECATED_INTERFACES -D OC_TARGET_DEBUG
|
||||
GCC:*_*_*_CC_FLAGS = $(BUILD_OPTIONS) $(DISABLE_LTO_FLAG) -DMDEPKG_NDEBUG -D DISABLE_NEW_DEPRECATED_INTERFACES -D OC_TARGET_DEBUG
|
||||
GCC:*_*_*_CXX_FLAGS = $(BUILD_OPTIONS) $(DISABLE_LTO_FLAG) -DMDEPKG_NDEBUG -D DISABLE_NEW_DEPRECATED_INTERFACES -D OC_TARGET_DEBUG
|
||||
#-fanalyzer -Wmismatched-tags
|
||||
#-Weffc++
|
||||
#-Wunused-but-set-variable
|
||||
|
@ -1523,7 +1523,7 @@ typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LOCATE_DEVICE_PATH)(
|
||||
IN EFI_GUID *Protocol,
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL * JCONST *DevicePath,
|
||||
OUT EFI_HANDLE *Device
|
||||
);
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 057a9b41309bf098deac9a2b687ec4e3a364cdc0
|
||||
Subproject commit d134b6051728c0493c2f1127e586a07fe77a052f
|
@ -178,6 +178,8 @@
|
||||
9A4F685E2449D4B4004B2F7E /* strlen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A105B5124483AE30006DE06 /* strlen.cpp */; };
|
||||
9A4F68622449D4CB004B2F7E /* APFS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A105B4624483AE30006DE06 /* APFS.cpp */; };
|
||||
9A4F68652449D533004B2F7E /* APFS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A105B4624483AE30006DE06 /* APFS.cpp */; };
|
||||
9A61B3002522165100AEE0FA /* Self.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A61B2FE2522165100AEE0FA /* Self.cpp */; };
|
||||
9A61B3012522165100AEE0FA /* Self.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A61B2FF2522165100AEE0FA /* Self.h */; };
|
||||
9A637AE82430D927000B9474 /* XTheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E3262F2428F4EE002240E8 /* XTheme.cpp */; };
|
||||
9A637AE92430D928000B9474 /* XTheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E3262F2428F4EE002240E8 /* XTheme.cpp */; };
|
||||
9A637AEA2430D928000B9474 /* XTheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E3262F2428F4EE002240E8 /* XTheme.cpp */; };
|
||||
@ -775,6 +777,8 @@
|
||||
9A36E5E024F7EF20007A1107 /* string.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = string.cpp; sourceTree = "<group>"; };
|
||||
9A4185B42439F29D00BEAFB8 /* LoadOptions_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadOptions_test.h; sourceTree = "<group>"; };
|
||||
9A4185B52439F29D00BEAFB8 /* LoadOptions_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadOptions_test.cpp; sourceTree = "<group>"; };
|
||||
9A61B2FE2522165100AEE0FA /* Self.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Self.cpp; sourceTree = "<group>"; };
|
||||
9A61B2FF2522165100AEE0FA /* Self.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Self.h; sourceTree = "<group>"; };
|
||||
9A63C6CA24EBEF78000EB836 /* Version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Version.h; path = ../../Version.h; sourceTree = "<group>"; };
|
||||
9A670D2024E53FD400B5D780 /* XBuffer_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XBuffer_tests.cpp; sourceTree = "<group>"; };
|
||||
9A670D2124E53FD500B5D780 /* XBuffer_tests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XBuffer_tests.h; sourceTree = "<group>"; };
|
||||
@ -1137,6 +1141,8 @@
|
||||
9AC77F1624176C04005CDD5C /* Platform */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A61B2FE2522165100AEE0FA /* Self.cpp */,
|
||||
9A61B2FF2522165100AEE0FA /* Self.h */,
|
||||
9A36E57324F56156007A1107 /* plist */,
|
||||
9AC77F2024176C04005CDD5C /* AcpiPatcher.cpp */,
|
||||
9A105B4424483AE20006DE06 /* AcpiPatcher.h */,
|
||||
@ -1509,6 +1515,7 @@
|
||||
9AD469552452B63300D6D0DB /* XToolsConf.h in Headers */,
|
||||
9AD469512452B5A600D6D0DB /* Devices.h in Headers */,
|
||||
9A28CC98241AB34800F3D247 /* XString_test.h in Headers */,
|
||||
9A61B3012522165100AEE0FA /* Self.h in Headers */,
|
||||
9AC7807424176C04005CDD5C /* REFIT_MENU_SCREEN.h in Headers */,
|
||||
9A105B7C24483AE40006DE06 /* StartupSound.h in Headers */,
|
||||
9AC7804124176C04005CDD5C /* Platform.h in Headers */,
|
||||
@ -1997,6 +2004,7 @@
|
||||
9AC7805E24176C04005CDD5C /* common.cpp in Sources */,
|
||||
9AC7804924176C04005CDD5C /* egemb_icons.cpp in Sources */,
|
||||
9AC7801124176C04005CDD5C /* Edid.cpp in Sources */,
|
||||
9A61B3002522165100AEE0FA /* Self.cpp in Sources */,
|
||||
9A9EA80A245AD9E50076EC02 /* XToolsCommon_test.cpp in Sources */,
|
||||
9AC7803A24176C04005CDD5C /* smbios.cpp in Sources */,
|
||||
);
|
||||
@ -2316,6 +2324,9 @@
|
||||
$PROJECT_DIR/../../MdeModulePkg/Include,
|
||||
$PROJECT_DIR/../../Library/MemLogLibDefault,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/Apple,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/Acidanthera,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/AMI,
|
||||
$PROJECT_DIR/../../UefiCpuPkg/Include,
|
||||
);
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_CFLAGS = (
|
||||
@ -2397,6 +2408,9 @@
|
||||
$PROJECT_DIR/../../MdeModulePkg/Include,
|
||||
$PROJECT_DIR/../../Library/MemLogLibDefault,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/Apple,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/Acidanthera,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/AMI,
|
||||
$PROJECT_DIR/../../UefiCpuPkg/Include,
|
||||
);
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_CFLAGS = (
|
||||
@ -2478,26 +2492,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
$PROJECT_DIR/../../Build/Clover/DEBUG_XCODE8/X64/rEFIt_UEFI/refit/DEBUG,
|
||||
$PROJECT_DIR/../../rEFIt_UEFI/include,
|
||||
$PROJECT_DIR/../../rEFIt_UEFI/Platform/Posix,
|
||||
$PROJECT_DIR/../../rEFIt_UEFI/Platform,
|
||||
$PROJECT_DIR/../../rEFIt_UEFI/cpp_unit_test,
|
||||
$PROJECT_DIR/../../rEFIt_UEFI,
|
||||
$PROJECT_DIR/../../Include,
|
||||
$PROJECT_DIR/../../Include/Library,
|
||||
$PROJECT_DIR/../../IntelFrameworkModulePkg/Include,
|
||||
$PROJECT_DIR/../../IntelFrameworkPkg/Include,
|
||||
$PROJECT_DIR/../../MdePkg/Include,
|
||||
$PROJECT_DIR/../../MdePkg/Include/X64,
|
||||
$PROJECT_DIR/../../MdeModulePkg/Include,
|
||||
$PROJECT_DIR/../../Library/MemLogLibDefault,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/Apple,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/Acidanthera,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/AMI,
|
||||
$PROJECT_DIR/../../UefiCpuPkg/Include,
|
||||
);
|
||||
HEADER_SEARCH_PATHS = $inherited;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
@ -2552,26 +2547,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
$PROJECT_DIR/../../Build/Clover/DEBUG_XCODE8/X64/rEFIt_UEFI/refit/DEBUG,
|
||||
$PROJECT_DIR/../../rEFIt_UEFI/include,
|
||||
$PROJECT_DIR/../../rEFIt_UEFI/Platform/Posix,
|
||||
$PROJECT_DIR/../../rEFIt_UEFI/Platform,
|
||||
$PROJECT_DIR/../../rEFIt_UEFI/cpp_unit_test,
|
||||
$PROJECT_DIR/../../rEFIt_UEFI,
|
||||
$PROJECT_DIR/../../Include,
|
||||
$PROJECT_DIR/../../Include/Library,
|
||||
$PROJECT_DIR/../../IntelFrameworkModulePkg/Include,
|
||||
$PROJECT_DIR/../../IntelFrameworkPkg/Include,
|
||||
$PROJECT_DIR/../../MdePkg/Include,
|
||||
$PROJECT_DIR/../../MdePkg/Include/X64,
|
||||
$PROJECT_DIR/../../MdeModulePkg/Include,
|
||||
$PROJECT_DIR/../../Library/MemLogLibDefault,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/Apple,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/Acidanthera,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/AMI,
|
||||
$PROJECT_DIR/../../UefiCpuPkg/Include,
|
||||
);
|
||||
HEADER_SEARCH_PATHS = $inherited;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
@ -38,7 +38,7 @@
|
||||
* returns null if it is not APFS part
|
||||
*/
|
||||
EFI_GUID *APFSPartitionUUIDExtract(
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
const EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
{
|
||||
while (!IsDevicePathEndType(DevicePath) &&
|
||||
@ -61,7 +61,7 @@ EFI_GUID *APFSPartitionUUIDExtract(
|
||||
* returns empty string if it is not APFS part
|
||||
*/
|
||||
XString8 APFSPartitionUUIDExtractAsXString8(
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
const EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
{
|
||||
EFI_GUID* uuid = APFSPartitionUUIDExtract(DevicePath);
|
||||
|
@ -19,12 +19,12 @@ constexpr LString8 ApfsSignatureUUID = "BE74FCF7-0B7C-49F3-9147-01F4042E6842";
|
||||
* returns null if it is not APFS part
|
||||
*/
|
||||
EFI_GUID* APFSPartitionUUIDExtract(
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
const EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
);
|
||||
|
||||
|
||||
XString8 APFSPartitionUUIDExtractAsXString8(
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
const EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
);
|
||||
|
||||
//XStringW APFSPartitionUUIDExtractAsXStringW(
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "platformdata.h"
|
||||
#include "smbios.h"
|
||||
#include "cpu.h"
|
||||
#include "DataHubCpu.h"
|
||||
|
||||
#include <Guid/DataHubRecords.h>
|
||||
|
||||
@ -394,7 +395,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
|
||||
gDriversFlags.AptioFix3Loaded || gDriversFlags.AptioMemFixLoaded) {
|
||||
EFI_STATUS Status;
|
||||
REFIT_VOLUME *Volume = Entry->Volume;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath = Volume->DevicePath;
|
||||
const EFI_DEVICE_PATH_PROTOCOL *DevicePath = Volume->DevicePath;
|
||||
// We need to remember from which device we boot, to make silence boot while special recovery boot
|
||||
Status = gRT->SetVariable(L"specialbootdevice", &gEfiAppleBootGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
|
@ -20,7 +20,7 @@ EFIAPI
|
||||
LogDataHub (
|
||||
EFI_GUID *TypeGuid,
|
||||
CONST CHAR16 *Name,
|
||||
VOID *Data,
|
||||
const VOID *Data,
|
||||
UINT32 DataSize
|
||||
);
|
||||
|
||||
|
@ -668,7 +668,7 @@ UINT16 PartNumForVolume(REFIT_VOLUME *Volume)
|
||||
{
|
||||
UINT16 PartNum = 0; //if not found then zero mean whole disk
|
||||
HARDDRIVE_DEVICE_PATH *HdPath = NULL;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath = Volume->DevicePath;
|
||||
const EFI_DEVICE_PATH_PROTOCOL *DevicePath = Volume->DevicePath;
|
||||
|
||||
while (DevicePath && !IsDevicePathEnd (DevicePath)) {
|
||||
if ((DevicePathType (DevicePath) == MEDIA_DEVICE_PATH) &&
|
||||
|
@ -40,7 +40,6 @@
|
||||
|
||||
extern EFI_GUID gEfiDevicePathPropertyDatabaseProtocolGuid;
|
||||
extern EFI_GUID gAppleFramebufferInfoProtocolGuid;
|
||||
extern BOOLEAN gProvideConsoleGopEnable;
|
||||
|
||||
UINT32 mPropSize = 0;
|
||||
UINT8* mProperties = NULL;
|
||||
|
@ -604,7 +604,7 @@ EFI_STATUS bootPBRtest(REFIT_VOLUME* volume)
|
||||
UINT32 LbaOffset = 0;
|
||||
UINT32 LbaSize = 0;
|
||||
HARDDRIVE_DEVICE_PATH *HdPath = NULL;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath = volume->DevicePath;
|
||||
const EFI_DEVICE_PATH_PROTOCOL *DevicePath = volume->DevicePath;
|
||||
UINT8 BiosDriveNum;
|
||||
// UINT16 OldMask;
|
||||
// UINT16 NewMask;
|
||||
@ -752,7 +752,7 @@ EFI_STATUS bootPBR(REFIT_VOLUME* volume, BOOLEAN SataReset)
|
||||
UINT32 LbaOffset = 0;
|
||||
UINT32 LbaSize = 0;
|
||||
HARDDRIVE_DEVICE_PATH *HdPath = NULL;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath = volume->DevicePath;
|
||||
const EFI_DEVICE_PATH_PROTOCOL *DevicePath = volume->DevicePath;
|
||||
UINT8 BiosDriveNum;
|
||||
//UINT16 OldMask;
|
||||
//UINT16 NewMask;
|
||||
|
@ -565,7 +565,7 @@ VOID DumpSmcKeys()
|
||||
/** Searches for GPT HDD dev path node and return pointer to partition GUID or NULL. */
|
||||
EFI_GUID
|
||||
*FindGPTPartitionGuidInDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
const EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
{
|
||||
HARDDRIVE_DEVICE_PATH *HDDDevPath;
|
||||
@ -598,8 +598,8 @@ EFI_GUID
|
||||
/** Returns TRUE if dev paths are equal. Ignores some differences. */
|
||||
BOOLEAN
|
||||
BootVolumeDevicePathEqual (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
|
||||
const EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
|
||||
const EFI_DEVICE_PATH_PROTOCOL *DevicePath2
|
||||
)
|
||||
{
|
||||
BOOLEAN Equal;
|
||||
@ -729,8 +729,8 @@ BootVolumeDevicePathEqual (
|
||||
/** Returns TRUE if dev paths contain the same MEDIA_DEVICE_PATH. */
|
||||
BOOLEAN
|
||||
BootVolumeMediaDevicePathNodesEqual (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath2
|
||||
)
|
||||
{
|
||||
DevicePath1 = Clover_FindDevicePathNodeWithType (DevicePath1, MEDIA_DEVICE_PATH, 0);
|
||||
|
@ -95,7 +95,7 @@ GetEfiBootDeviceFromNvram (VOID);
|
||||
|
||||
EFI_GUID
|
||||
*FindGPTPartitionGuidInDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
const EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
);
|
||||
|
||||
VOID
|
||||
|
@ -23,6 +23,7 @@ Headers collection for procedures
|
||||
|
||||
#include "../include/OneLinerMacros.h"
|
||||
|
||||
#include "Self.h"
|
||||
#include "../entry_scan/common.h"
|
||||
#include "../libeg/BmLib.h"
|
||||
#include "BootLog.h"
|
||||
|
42
rEFIt_UEFI/Platform/Self.cpp
Normal file
42
rEFIt_UEFI/Platform/Self.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Self.cpp
|
||||
*
|
||||
* Created on: Sep 28, 2020
|
||||
* Author: jief
|
||||
*/
|
||||
|
||||
#include "Self.h"
|
||||
#include <Platform.h>
|
||||
#include "../refit/lib.h"
|
||||
|
||||
#ifndef DEBUG_ALL
|
||||
#define DEBUG_SELF 1
|
||||
#else
|
||||
#define DEBUG_SELF DEBUG_ALL
|
||||
#endif
|
||||
|
||||
#if DEBUG_SELF == 0
|
||||
#define DBG(...)
|
||||
#else
|
||||
#define DBG(...) DebugLog(DEBUG_SELF, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
|
||||
Self self;
|
||||
|
||||
EFI_STATUS Self::initialize(EFI_HANDLE ImageHandle)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
m_SelfImageHandle = ImageHandle;
|
||||
Status = gBS->HandleProtocol(self.getSelfImageHandle(), &gEfiLoadedImageProtocolGuid, (VOID **) &m_SelfLoadedImage);
|
||||
if ( EFI_ERROR(Status) ) panic("Cannot get SelfLoadedImage");
|
||||
if ( self.getSelfDeviceHandle() == NULL ) panic("self.getSelfDeviceHandle() == NULL");
|
||||
|
||||
m_SelfDevicePath = DuplicateDevicePath(DevicePathFromHandle(self.getSelfDeviceHandle()));
|
||||
if ( m_SelfDevicePath == NULL ) panic("m_SelfDevicePath == NULL");
|
||||
|
||||
DBG("self.getSelfDevicePath()=%ls @%llX\n", FileDevicePathToXStringW(&self.getSelfDevicePath()).wc_str(), (uintptr_t)self.getSelfDeviceHandle());
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
38
rEFIt_UEFI/Platform/Self.h
Normal file
38
rEFIt_UEFI/Platform/Self.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Self.h
|
||||
*
|
||||
* Created on: Sep 28, 2020
|
||||
* Author: jief
|
||||
*/
|
||||
|
||||
#ifndef PLATFORM_SELF_H_
|
||||
#define PLATFORM_SELF_H_
|
||||
|
||||
#include <Platform.h>
|
||||
|
||||
class Self
|
||||
{
|
||||
protected:
|
||||
EFI_HANDLE m_SelfImageHandle;
|
||||
EFI_LOADED_IMAGE *m_SelfLoadedImage;
|
||||
EFI_DEVICE_PATH *m_SelfDevicePath;
|
||||
|
||||
public:
|
||||
Self () : m_SelfImageHandle(NULL), m_SelfLoadedImage{0}, m_SelfDevicePath(NULL) {};
|
||||
Self(const Self&) = delete;
|
||||
Self& operator = (const Self&) = delete;
|
||||
|
||||
~Self () {};
|
||||
|
||||
EFI_STATUS initialize(EFI_HANDLE ImageHandle);
|
||||
|
||||
EFI_HANDLE getSelfImageHandle() { return m_SelfImageHandle; }
|
||||
const EFI_LOADED_IMAGE& getSelfLoadedImage() { return *m_SelfLoadedImage; }
|
||||
EFI_HANDLE getSelfDeviceHandle() { return getSelfLoadedImage().DeviceHandle; }
|
||||
const EFI_DEVICE_PATH& getSelfDevicePath() { return *m_SelfDevicePath; }
|
||||
|
||||
};
|
||||
|
||||
extern Self self;
|
||||
|
||||
#endif /* PLATFORM_SELF_H_ */
|
@ -139,7 +139,6 @@ EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl = NULL;
|
||||
|
||||
extern BOOLEAN NeedPMfix;
|
||||
//OC_ABC_SETTINGS_4CLOVER gQuirks;
|
||||
BOOLEAN gProvideConsoleGopEnable;
|
||||
|
||||
//extern INTN OldChosenAudio;
|
||||
|
||||
@ -257,8 +256,8 @@ ParseLoadOptions (
|
||||
|
||||
XStringW& ConfName = *ConfNamePtr;
|
||||
|
||||
Start = (CHAR8*)SelfLoadedImage->LoadOptions;
|
||||
End = (CHAR8*)((CHAR8*)SelfLoadedImage->LoadOptions + SelfLoadedImage->LoadOptionsSize);
|
||||
Start = (CHAR8*)self.getSelfLoadedImage().LoadOptions;
|
||||
End = (CHAR8*)((CHAR8*)self.getSelfLoadedImage().LoadOptions + self.getSelfLoadedImage().LoadOptionsSize);
|
||||
while ((Start < End) && ((*Start == ' ') || (*Start == '\\') || (*Start == '/')))
|
||||
{
|
||||
++Start;
|
||||
@ -308,14 +307,14 @@ ParseLoadOptions (
|
||||
}
|
||||
|
||||
//
|
||||
// analyze SelfLoadedImage->LoadOptions to extract Default Volume and Default Loader
|
||||
// analyze self.getSelfLoadedImage().LoadOptions to extract Default Volume and Default Loader
|
||||
// input and output data are global
|
||||
//
|
||||
VOID
|
||||
GetBootFromOption(VOID)
|
||||
{
|
||||
UINT8 *Data = (UINT8*)SelfLoadedImage->LoadOptions;
|
||||
UINTN Len = SelfLoadedImage->LoadOptionsSize;
|
||||
UINT8 *Data = (UINT8*)self.getSelfLoadedImage().LoadOptions;
|
||||
UINTN Len = self.getSelfLoadedImage().LoadOptionsSize;
|
||||
UINTN NameSize, Name2Size;
|
||||
|
||||
Data += 4; //skip signature as we already here
|
||||
@ -2576,6 +2575,9 @@ GetEarlyUserSettings (
|
||||
}
|
||||
}
|
||||
|
||||
Prop = GUIDict->propertyForKey("ProvideConsoleGop");
|
||||
gSettings.ProvideConsoleGop = IsPropertyNotNullAndTrue(Prop);
|
||||
|
||||
Prop = GUIDict->propertyForKey("ConsoleMode");
|
||||
if (Prop != NULL) {
|
||||
if (Prop->isInt64()) {
|
||||
@ -2956,8 +2958,6 @@ if ( !Prop ) panic("Cannot find AvoidRuntimeDefrag in OcQuirks under root (OC bo
|
||||
Prop = OcQuirksDict->propertyForKey( "ProtectUefiServices");
|
||||
gSettings.ocBooterQuirks.ProtectUefiServices = IsPropertyNotNullAndTrue(Prop);
|
||||
gSettings.QuirksMask |= gSettings.ocBooterQuirks.ProtectUefiServices? QUIRK_UEFI:0;
|
||||
Prop = OcQuirksDict->propertyForKey( "ProvideConsoleGopEnable");
|
||||
gProvideConsoleGopEnable = IsPropertyNotNullAndTrue(Prop);
|
||||
Prop = OcQuirksDict->propertyForKey( "ProvideCustomSlide");
|
||||
gSettings.ocBooterQuirks.ProvideCustomSlide = IsPropertyNotNullAndTrue(Prop);
|
||||
gSettings.QuirksMask |= gSettings.ocBooterQuirks.ProvideCustomSlide? QUIRK_CUSTOM:0;
|
||||
|
@ -606,6 +606,8 @@ public:
|
||||
OC_BOOTER_QUIRKS ocBooterQuirks;
|
||||
XObjArray<MMIOWhiteList> mmioWhiteListArray;
|
||||
|
||||
BOOLEAN ProvideConsoleGop;
|
||||
|
||||
|
||||
SETTINGS_DATA() : VendorName(), RomVersion(), EfiVersion(), ReleaseDate(), ManufactureName(), ProductName(), VersionNr(), SerialNr(), SmUUID(),
|
||||
pad0{0}, FamilyName(), OEMProduct(), OEMVendor(), BoardManufactureName(), BoardSerialNumber(), BoardNumber(), LocationInChassis(),
|
||||
@ -633,7 +635,7 @@ public:
|
||||
AFGLowPowerState(0), PNLF_UID(0), ACPIDropTables(0), DisableEntryScan(0), DisableToolScan(0), KernelScan(0), LinuxScan(0), CustomEntries(0),
|
||||
CustomLegacy(0), CustomTool(0), NrAddProperties(0), AddProperties(0), BlockKexts{0}, SortedACPICount(0), SortedACPI(0), DisabledAMLCount(0), DisabledAML(0),
|
||||
IntelMaxValue(0), OptionsBits(0), FlagsBits(0), UIScale(0), EFILoginHiDPI(0), flagstate{0},
|
||||
ArbProperties(0), QuirksMask(0), MaxSlide(0), ocBooterQuirks{0}, mmioWhiteListArray()
|
||||
ArbProperties(0), QuirksMask(0), MaxSlide(0), ocBooterQuirks{0}, mmioWhiteListArray(), ProvideConsoleGop(0)
|
||||
{};
|
||||
SETTINGS_DATA(const SETTINGS_DATA& other) = delete; // Can be defined if needed
|
||||
const SETTINGS_DATA& operator = ( const SETTINGS_DATA & ) = delete; // Can be defined if needed
|
||||
@ -878,7 +880,7 @@ public:
|
||||
DebugLog(FALSE), ScratchDebugLogAtStart(FALSE), FastBoot(FALSE), NeverHibernate(FALSE), StrictHibernate(FALSE),
|
||||
RtcHibernateAware(FALSE), HibernationFixup(FALSE), SignatureFixup(FALSE), Theme(), ScreenResolution(), ConsoleMode(0), CustomIcons(FALSE), IconFormat(ICON_FORMAT_DEF), NoEarlyProgress(FALSE), Timezone(0xFF),
|
||||
ShowOptimus(FALSE), Codepage(0xC0), CodepageSize(0xC0) {};
|
||||
REFIT_CONFIG(const SIDELOAD_KEXT& other) = delete; // Can be defined if needed
|
||||
REFIT_CONFIG(const REFIT_CONFIG& other) = delete; // Can be defined if needed
|
||||
const REFIT_CONFIG& operator = ( const REFIT_CONFIG & ) = delete; // Can be defined if needed
|
||||
~REFIT_CONFIG() { }
|
||||
|
||||
|
@ -108,3 +108,41 @@ XString8 Bytes2HexStr(UINT8 *data, UINTN len)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN haveError = FALSE;
|
||||
|
||||
|
||||
BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CONST CHAR16 *where)
|
||||
{
|
||||
// CHAR16 ErrorName[64];
|
||||
|
||||
if (!EFI_ERROR(Status))
|
||||
return FALSE;
|
||||
|
||||
// StatusToString(ErrorName, Status);
|
||||
gST->ConOut->SetAttribute (gST->ConOut, EFI_RED | EFI_BACKGROUND_BLACK);
|
||||
printf("Fatal Error: %s %ls\n", efiStrError(Status), where);
|
||||
gST->ConOut->SetAttribute (gST->ConOut, EFI_LIGHTGRAY | EFI_BACKGROUND_BLACK);
|
||||
haveError = TRUE;
|
||||
|
||||
//gBS->Exit(ImageHandle, ExitStatus, ExitDataSize, ExitData);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where)
|
||||
{
|
||||
// CHAR16 ErrorName[64];
|
||||
|
||||
if (!EFI_ERROR(Status))
|
||||
return FALSE;
|
||||
|
||||
// StatusToString(ErrorName, Status);
|
||||
gST->ConOut->SetAttribute (gST->ConOut, EFI_RED | EFI_BACKGROUND_BLACK);
|
||||
printf("Error: %s %ls\n", efiStrError(Status), where);
|
||||
gST->ConOut->SetAttribute (gST->ConOut, EFI_LIGHTGRAY | EFI_BACKGROUND_BLACK);
|
||||
haveError = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -71,4 +71,16 @@ AsciiStrDecimalToUintn (
|
||||
return AsciiStrDecimalToUintn(String.c_str());
|
||||
}
|
||||
|
||||
extern BOOLEAN haveError;
|
||||
|
||||
|
||||
BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CONST CHAR16 *where);
|
||||
BOOLEAN CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where);
|
||||
|
||||
//EFI_DEVICE_PATH_PROTOCOL *
|
||||
//EFIAPI
|
||||
//NextDevicePathNode (
|
||||
// IN VOID *Node
|
||||
// );
|
||||
|
||||
#endif
|
||||
|
@ -579,7 +579,7 @@ EFI_STATUS LOADER_ENTRY::LoadKexts()
|
||||
}
|
||||
|
||||
for (size_t idx = 0 ; idx < kextArray.size() ; idx++ ) {
|
||||
AddKext(Volume->RootDir, kextArray[idx].FileName, archCpuType);
|
||||
AddKext(SelfVolume->RootDir, S8Printf("%ls\\kexts\\%ls\\%ls", OEMPath.wc_str(), kextArray[idx].KextDirNameUnderOEMPath.wc_str(), kextArray[idx].FileName.wc_str()), archCpuType);
|
||||
}
|
||||
|
||||
UINTN mm_extra_size;
|
||||
|
@ -100,11 +100,11 @@ void construct_globals_objects(EFI_HANDLE ImageHandle)
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
void construct_globals_objects()
|
||||
void construct_globals_objects(EFI_HANDLE ImageHandle)
|
||||
{
|
||||
DBG("Work in progress\n");
|
||||
UINT32 PeCoffHeaderOffset = 0;
|
||||
EFI_IMAGE_DOS_HEADER* DosHdr = (EFI_IMAGE_DOS_HEADER*)SelfLoadedImage->ImageBase;
|
||||
EFI_IMAGE_DOS_HEADER* DosHdr = (EFI_IMAGE_DOS_HEADER*)self.getSelfLoadedImage().ImageBase;
|
||||
if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
|
||||
// DOS image header is present, so read the PE header after the DOS image header
|
||||
PeCoffHeaderOffset = DosHdr->e_lfanew;
|
||||
@ -112,7 +112,7 @@ void construct_globals_objects()
|
||||
DBG("ImageContext.PeCoffHeaderOffset: %08X %d\n", PeCoffHeaderOffset, PeCoffHeaderOffset);
|
||||
|
||||
|
||||
EFI_IMAGE_OPTIONAL_HEADER_UNION* ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *) ((UINTN) (SelfLoadedImage->ImageBase) + PeCoffHeaderOffset);
|
||||
EFI_IMAGE_OPTIONAL_HEADER_UNION* ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *) ((UINTN) (self.getSelfLoadedImage().ImageBase) + PeCoffHeaderOffset);
|
||||
EFI_IMAGE_SECTION_HEADER* SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINTN) ImgHdr + sizeof(UINT32) + sizeof(EFI_IMAGE_FILE_HEADER) + ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader);
|
||||
|
||||
for (int Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index++, SectionHeader++)
|
||||
@ -124,8 +124,8 @@ void construct_globals_objects()
|
||||
if (strcmp((CONST CHAR8*) SectionHeader->Name, ".CRT") == 0)
|
||||
{
|
||||
|
||||
ctor_ptr* currentCtor = (ctor_ptr*) (((UINTN) (SelfLoadedImage->ImageBase)) + SectionHeader->PointerToRawData);
|
||||
ctor_ptr* ctorend = (ctor_ptr*) (((UINTN) (SelfLoadedImage->ImageBase)) + SectionHeader->PointerToRawData + SectionHeader->Misc.VirtualSize);
|
||||
ctor_ptr* currentCtor = (ctor_ptr*) (((UINTN) (self.getSelfLoadedImage().ImageBase)) + SectionHeader->PointerToRawData);
|
||||
ctor_ptr* ctorend = (ctor_ptr*) (((UINTN) (self.getSelfLoadedImage().ImageBase)) + SectionHeader->PointerToRawData + SectionHeader->Misc.VirtualSize);
|
||||
while (currentCtor < ctorend)
|
||||
{
|
||||
DBG("¤tCtor %X %d\n", (UINTN) (currentCtor), (UINTN) (currentCtor));
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
/*
|
||||
* NOTE : SelfLoadedImage must be initialized to call this.
|
||||
* NOTE : self.getSelfLoadedImage() must be initialized to call this.
|
||||
*/
|
||||
extern void construct_globals_objects(EFI_HANDLE ImageHandle);
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
extern CONST CHAR8* IconsNames[];
|
||||
|
||||
const XIcon& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
|
||||
const XIcon& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, const EFI_DEVICE_PATH_PROTOCOL *DevicePath)
|
||||
|
||||
{
|
||||
UINTN IconNum = 0;
|
||||
|
@ -47,7 +47,7 @@ extern REFIT_MENU_SCREEN MainMenu;
|
||||
|
||||
extern XObjArray<REFIT_VOLUME> Volumes;
|
||||
// common
|
||||
const XIcon& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath);
|
||||
const XIcon& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, const EFI_DEVICE_PATH_PROTOCOL *DevicePath);
|
||||
|
||||
|
||||
// Ask user for file path from directory menu
|
||||
|
@ -32,6 +32,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <Platform.h>
|
||||
#include "entry_scan.h"
|
||||
|
||||
#ifndef DEBUG_ALL
|
||||
@ -389,7 +390,7 @@ static EFI_STATUS EFIAPI LockedOpenProtocol(IN EFI_HANDLE Handle, IN EFI_GUID *P
|
||||
|
||||
static EFI_STATUS EFIAPI LockedCloseProtocol(IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, IN EFI_HANDLE AgentHandle, IN EFI_HANDLE ControllerHandle)
|
||||
{
|
||||
if (Handle == SelfImageHandle) {
|
||||
if (Handle == self.getSelfImageHandle()) {
|
||||
if (Protocol == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
@ -434,7 +435,7 @@ static EFI_STATUS LockGraphicsGOP(VOID)
|
||||
// Open GOP protocols, they will be modified by our modified boot services
|
||||
Size /= sizeof(EFI_HANDLE *);
|
||||
for (i = 0; i < Size; ++i) {
|
||||
gBS->OpenProtocol(Buffer[i], &gEfiGraphicsOutputProtocolGuid, &Interface, SelfImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
gBS->OpenProtocol(Buffer[i], &gEfiGraphicsOutputProtocolGuid, &Interface, self.getSelfImageHandle(), NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@ -463,7 +464,7 @@ static EFI_STATUS LockGraphicsUGA(VOID)
|
||||
// Open UGA protocols, they will be modified by our modified boot services
|
||||
Size /= sizeof(EFI_HANDLE *);
|
||||
for (i = 0; i < Size; ++i) {
|
||||
gBS->OpenProtocol(Buffer[i], &gEfiUgaDrawProtocolGuid, &Interface, SelfImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
gBS->OpenProtocol(Buffer[i], &gEfiUgaDrawProtocolGuid, &Interface, self.getSelfImageHandle(), NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -216,8 +216,10 @@
|
||||
Platform/plist/xml.h
|
||||
Platform/plist/xml.cpp
|
||||
# Platform/Pointer.cpp
|
||||
Platform/Settings.cpp
|
||||
Platform/Settings.h
|
||||
Platform/Self.cpp
|
||||
Platform/Self.h
|
||||
Platform/Settings.cpp
|
||||
Platform/Settings.h
|
||||
Platform/smbios.h
|
||||
Platform/smbios.cpp
|
||||
Platform/spd.cpp
|
||||
|
@ -55,13 +55,9 @@
|
||||
|
||||
// variables
|
||||
|
||||
EFI_HANDLE SelfImageHandle;
|
||||
EFI_HANDLE SelfDeviceHandle;
|
||||
EFI_LOADED_IMAGE *SelfLoadedImage;
|
||||
EFI_FILE *SelfRootDir;
|
||||
EFI_FILE *SelfDir;
|
||||
XStringW SelfDirPath;
|
||||
EFI_DEVICE_PATH *SelfDevicePath;
|
||||
EFI_DEVICE_PATH *SelfFullDevicePath;
|
||||
|
||||
XTheme ThemeX;
|
||||
@ -175,29 +171,16 @@ EFI_STATUS GetRootFromPath(IN EFI_DEVICE_PATH_PROTOCOL* DevicePath, OUT EFI_FILE
|
||||
|
||||
EFI_STATUS InitRefitLib(IN EFI_HANDLE ImageHandle)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
XStringW FilePathAsString;
|
||||
UINTN i;
|
||||
UINTN DevicePathSize;
|
||||
EFI_DEVICE_PATH_PROTOCOL* TmpDevicePath;
|
||||
|
||||
SelfImageHandle = ImageHandle;
|
||||
Status = gBS->HandleProtocol(SelfImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &SelfLoadedImage);
|
||||
if (CheckFatalError(Status, L"while getting a LoadedImageProtocol handle"))
|
||||
return Status;
|
||||
self.initialize(ImageHandle);
|
||||
|
||||
SelfDeviceHandle = SelfLoadedImage->DeviceHandle;
|
||||
TmpDevicePath = DevicePathFromHandle (SelfDeviceHandle);
|
||||
DevicePathSize = GetDevicePathSize (TmpDevicePath);
|
||||
SelfDevicePath = (__typeof__(SelfDevicePath))AllocateAlignedPages(EFI_SIZE_TO_PAGES(DevicePathSize), 64);
|
||||
CopyMem(SelfDevicePath, TmpDevicePath, DevicePathSize);
|
||||
|
||||
DBG("SelfDevicePath=%ls @%llX\n", FileDevicePathToXStringW(SelfDevicePath).wc_str(), (uintptr_t)SelfDeviceHandle);
|
||||
|
||||
// find the current directory
|
||||
FilePathAsString = FileDevicePathToXStringW(SelfLoadedImage->FilePath);
|
||||
FilePathAsString = FileDevicePathToXStringW(self.getSelfLoadedImage().FilePath);
|
||||
if (FilePathAsString.notEmpty()) {
|
||||
SelfFullDevicePath = FileDevicePath(SelfDeviceHandle, FilePathAsString);
|
||||
SelfFullDevicePath = FileDevicePath(self.getSelfDeviceHandle(), FilePathAsString);
|
||||
for (i = FilePathAsString.length(); i > 0 && FilePathAsString[i] != '\\'; i--) ;
|
||||
if (i > 0) {
|
||||
FilePathAsString = FilePathAsString.subString(0, i);
|
||||
@ -263,11 +246,11 @@ EFI_STATUS ReinitSelfLib(VOID)
|
||||
|
||||
// DbgHeader("ReinitSelfLib");
|
||||
|
||||
if (!SelfDevicePath) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
// if (!self.getSelfDevicePath()) {
|
||||
// return EFI_NOT_FOUND;
|
||||
// }
|
||||
|
||||
TmpDevicePath = DuplicateDevicePath(SelfDevicePath);
|
||||
TmpDevicePath = DuplicateDevicePath(&self.getSelfDevicePath());
|
||||
DBG("reinit: self device path=%ls\n", FileDevicePathToXStringW(TmpDevicePath).wc_str());
|
||||
if(TmpDevicePath == NULL)
|
||||
return EFI_NOT_FOUND;
|
||||
@ -284,7 +267,9 @@ EFI_STATUS ReinitSelfLib(VOID)
|
||||
DBG("SelfRootDir can't be reopened\n");
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
SelfDeviceHandle = NewSelfHandle;
|
||||
// panic("todo");
|
||||
// self.getSelfDeviceHandle() = NewSelfHandle;
|
||||
self.initialize(self.getSelfImageHandle());
|
||||
/*Status = */SelfRootDir->Open(SelfRootDir, &ThemeX.ThemeDir, ThemePath.wc_str(), EFI_FILE_MODE_READ, 0);
|
||||
|
||||
|
||||
@ -301,9 +286,8 @@ EFI_STATUS FinishInitRefitLib(VOID)
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (SelfRootDir == NULL) {
|
||||
SelfRootDir = EfiLibOpenRoot(SelfLoadedImage->DeviceHandle);
|
||||
SelfRootDir = EfiLibOpenRoot(self.getSelfLoadedImage().DeviceHandle);
|
||||
if (SelfRootDir != NULL) {
|
||||
SelfDeviceHandle = SelfLoadedImage->DeviceHandle;
|
||||
} else {
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
@ -1099,7 +1083,7 @@ VOID ScanVolumes(VOID)
|
||||
REFIT_VOLUME* Volume = new REFIT_VOLUME;
|
||||
Volume->LegacyOS = new LEGACY_OS;
|
||||
Volume->DeviceHandle = Handles[HandleIndex];
|
||||
if (Volume->DeviceHandle == SelfDeviceHandle) {
|
||||
if (Volume->DeviceHandle == self.getSelfDeviceHandle()) {
|
||||
SelfVolume = Volume;
|
||||
}
|
||||
|
||||
@ -1139,8 +1123,8 @@ VOID ScanVolumes(VOID)
|
||||
if (SelfVolume == NULL){
|
||||
DBG(" WARNING: SelfVolume not found"); //Slice - and what?
|
||||
SelfVolume = new REFIT_VOLUME;
|
||||
SelfVolume->DeviceHandle = SelfDeviceHandle;
|
||||
SelfVolume->DevicePath = SelfDevicePath;
|
||||
SelfVolume->DeviceHandle = self.getSelfDeviceHandle();
|
||||
SelfVolume->DevicePath = DuplicateDevicePath(&self.getSelfDevicePath());
|
||||
SelfVolume->RootDir = SelfRootDir;
|
||||
SelfVolume->DiskKind = DISK_KIND_BOOTER;
|
||||
SelfVolume->VolName = L"Clover"_XSW;
|
||||
@ -1252,7 +1236,7 @@ VOID ReinitVolumes(VOID)
|
||||
REFIT_VOLUME *Volume;
|
||||
UINTN VolumeIndex;
|
||||
UINTN VolumesFound = 0;
|
||||
EFI_DEVICE_PATH *RemainingDevicePath;
|
||||
const EFI_DEVICE_PATH *RemainingDevicePath;
|
||||
EFI_HANDLE DeviceHandle, WholeDiskHandle;
|
||||
|
||||
for (VolumeIndex = 0; VolumeIndex < Volumes.size(); VolumeIndex++) {
|
||||
@ -1266,7 +1250,8 @@ VOID ReinitVolumes(VOID)
|
||||
if (Volume->DevicePath != NULL) {
|
||||
// get the handle for that path
|
||||
RemainingDevicePath = Volume->DevicePath;
|
||||
Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid, &RemainingDevicePath, &DeviceHandle);
|
||||
|
||||
Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid, const_cast<EFI_DEVICE_PATH**>(&RemainingDevicePath), &DeviceHandle);
|
||||
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Volume->DeviceHandle = DeviceHandle;
|
||||
@ -1282,7 +1267,7 @@ VOID ReinitVolumes(VOID)
|
||||
if (Volume->WholeDiskDevicePath != NULL) {
|
||||
// get the handle for that path
|
||||
RemainingDevicePath = DuplicateDevicePath(Volume->WholeDiskDevicePath);
|
||||
Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid, &RemainingDevicePath, &WholeDiskHandle);
|
||||
Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid, const_cast<EFI_DEVICE_PATH**>(&RemainingDevicePath), &WholeDiskHandle);
|
||||
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Volume->WholeDiskBlockIO = (__typeof__(Volume->WholeDiskBlockIO))WholeDiskHandle;
|
||||
@ -1628,7 +1613,7 @@ INTN FindMem(IN CONST VOID *Buffer, IN UINTN BufferLength, IN CONST VOID *Search
|
||||
|
||||
**/
|
||||
XStringW DevicePathToXStringW (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
||||
const EFI_DEVICE_PATH_PROTOCOL *DevPath
|
||||
)
|
||||
{
|
||||
CHAR16* DevicePathStr = ConvertDevicePathToText (DevPath, TRUE, TRUE);
|
||||
@ -1641,7 +1626,7 @@ XStringW DevicePathToXStringW (
|
||||
//
|
||||
// Aptio UEFI returns File DevPath as 2 nodes (dir, file)
|
||||
// and DevicePathToStr connects them with /, but we need '\\'
|
||||
XStringW FileDevicePathToXStringW(IN EFI_DEVICE_PATH_PROTOCOL *DevPath)
|
||||
XStringW FileDevicePathToXStringW(const EFI_DEVICE_PATH_PROTOCOL *DevPath)
|
||||
{
|
||||
CHAR16 *FilePath;
|
||||
CHAR16 *Char;
|
||||
@ -1671,7 +1656,7 @@ XStringW FileDevicePathToXStringW(IN EFI_DEVICE_PATH_PROTOCOL *DevPath)
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
XStringW FileDevicePathFileToXStringW(IN EFI_DEVICE_PATH_PROTOCOL *DevPath)
|
||||
XStringW FileDevicePathFileToXStringW(const EFI_DEVICE_PATH_PROTOCOL *DevPath)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *Node;
|
||||
|
||||
|
@ -297,13 +297,9 @@ typedef enum {
|
||||
#define SCREEN_EDGE_RIGHT 70000
|
||||
#define SCREEN_EDGE_BOTTOM 80000
|
||||
|
||||
extern EFI_HANDLE SelfImageHandle;
|
||||
extern EFI_HANDLE SelfDeviceHandle;
|
||||
extern EFI_LOADED_IMAGE *SelfLoadedImage;
|
||||
extern EFI_FILE *SelfRootDir;
|
||||
extern EFI_FILE *SelfDir;
|
||||
extern XStringW SelfDirPath;
|
||||
extern EFI_DEVICE_PATH *SelfDevicePath;
|
||||
extern EFI_DEVICE_PATH *SelfFullDevicePath;
|
||||
extern XStringW ThemePath;
|
||||
extern EFI_FILE *OEMDir;
|
||||
@ -363,10 +359,10 @@ CHAR16 * egFindExtension(IN CHAR16 *FileName);
|
||||
|
||||
INTN FindMem(IN CONST VOID *Buffer, IN UINTN BufferLength, IN CONST VOID *SearchString, IN UINTN SearchStringLength);
|
||||
|
||||
XStringW DevicePathToXStringW(IN EFI_DEVICE_PATH_PROTOCOL *DevPath);
|
||||
XStringW FileDevicePathToXStringW(IN EFI_DEVICE_PATH_PROTOCOL *DevPath);
|
||||
XStringW FileDevicePathFileToXStringW(IN EFI_DEVICE_PATH_PROTOCOL *DevPath);
|
||||
//UINTN FileDevicePathNameLen(IN CONST FILEPATH_DEVICE_PATH *FilePath);
|
||||
XStringW DevicePathToXStringW(const EFI_DEVICE_PATH_PROTOCOL *DevPath);
|
||||
XStringW FileDevicePathToXStringW(const EFI_DEVICE_PATH_PROTOCOL *DevPath);
|
||||
XStringW FileDevicePathFileToXStringW(const EFI_DEVICE_PATH_PROTOCOL *DevPath);
|
||||
//UINTN FileDevicePathNameLen(const FILEPATH_DEVICE_PATH *FilePath);
|
||||
|
||||
EFI_STATUS InitializeUnicodeCollationProtocol (VOID);
|
||||
|
||||
|
@ -165,7 +165,7 @@ static EFI_STATUS LoadEFIImageList(IN EFI_DEVICE_PATH **DevicePaths,
|
||||
// load the image into memory
|
||||
ReturnStatus = Status = EFI_NOT_FOUND; // in case the list is empty
|
||||
for (DevicePathIndex = 0; DevicePaths[DevicePathIndex] != NULL; DevicePathIndex++) {
|
||||
ReturnStatus = Status = gBS->LoadImage(FALSE, SelfImageHandle, DevicePaths[DevicePathIndex], NULL, 0, &ChildImageHandle);
|
||||
ReturnStatus = Status = gBS->LoadImage(FALSE, self.getSelfImageHandle(), DevicePaths[DevicePathIndex], NULL, 0, &ChildImageHandle);
|
||||
DBG(" status=%s", efiStrError(Status));
|
||||
if (ReturnStatus != EFI_NOT_FOUND)
|
||||
break;
|
||||
@ -568,7 +568,7 @@ VOID CheckEmptyFB()
|
||||
|
||||
VOID LOADER_ENTRY::StartLoader()
|
||||
{
|
||||
if (/* DISABLES CODE */ (1) || OSVersion.startWith("11") ) {
|
||||
if ( ( OSTYPE_IS_OSX(LoaderType) || OSTYPE_IS_OSX_RECOVERY(LoaderType) || OSTYPE_IS_OSX_INSTALLER(LoaderType) ) && OSVersion.startWith("11") ) {
|
||||
StartLoader11();
|
||||
return;
|
||||
}
|
||||
@ -1468,8 +1468,8 @@ DBG("Beginning OC\n");
|
||||
|
||||
OC_STRING_ASSIGN(mOpenCoreConfiguration.Misc.Security.SecureBootModel, "Disabled");
|
||||
OC_STRING_ASSIGN(mOpenCoreConfiguration.Misc.Security.Vault, "Optional");
|
||||
#ifdef JIEF_DEBUG
|
||||
mOpenCoreConfiguration.Nvram.WriteFlash = true;
|
||||
#ifdef JIEF_DEBUG
|
||||
#endif
|
||||
|
||||
#ifndef USE_OC_SECTION_Booter
|
||||
@ -1597,8 +1597,10 @@ DBG("Beginning OC\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// mOpenCoreConfiguration.Uefi.Output.ProvideConsoleGop = true;
|
||||
#ifndef USE_OC_SECTION_PlatformInfo
|
||||
mOpenCoreConfiguration.Kernel.Quirks.CustomSmbiosGuid = false; //already done by CLover.
|
||||
#endif
|
||||
mOpenCoreConfiguration.Uefi.Output.ProvideConsoleGop = gSettings.ProvideConsoleGop;
|
||||
OC_STRING_ASSIGN(mOpenCoreConfiguration.Uefi.Output.Resolution, XString8(GlobalConfig.ScreenResolution).c_str());
|
||||
OcMain(&mOpenCoreStorage, NULL);
|
||||
|
||||
@ -1821,7 +1823,7 @@ static VOID ScanDriverDir(IN CONST CHAR16 *Path, OUT EFI_HANDLE **DriversToConne
|
||||
#undef BOOLEAN_AT_INDEX
|
||||
|
||||
snwprintf(FileName, 512, "%ls\\%ls", Path, DirEntry->FileName);
|
||||
Status = StartEFIImage(FileDevicePath(SelfLoadedImage->DeviceHandle, FileName),
|
||||
Status = StartEFIImage(FileDevicePath(self.getSelfLoadedImage().DeviceHandle, FileName),
|
||||
NullXString8Array, DirEntry->FileName, XStringW().takeValueFrom(DirEntry->FileName), NULL, &DriverHandle);
|
||||
if (EFI_ERROR(Status)) {
|
||||
continue;
|
||||
@ -2498,13 +2500,13 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
if ( !EFI_ERROR(Status) ) DBG("Clover : Image base = 0x%llX\n", (uintptr_t)LoadedImage->ImageBase); // do not change, it's used by grep to feed the debugger
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
gBS->Stall(1500000); // to give time to gdb to connect
|
||||
gBS->Stall(2500000); // to give time to gdb to connect
|
||||
// gBS->Stall(0500000); // to give time to gdb to connect
|
||||
// PauseForKey(L"press\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
construct_globals_objects(gImageHandle); // do this after SelfLoadedImage is initialized
|
||||
construct_globals_objects(gImageHandle); // do this after self.getSelfLoadedImage() is initialized
|
||||
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
@ -2602,10 +2604,10 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
GetDevices();
|
||||
|
||||
// LoadOptions Parsing
|
||||
DBG("Clover load options size = %d bytes\n", SelfLoadedImage->LoadOptionsSize);
|
||||
if ((SelfLoadedImage->LoadOptions != NULL) &&
|
||||
(SelfLoadedImage->LoadOptionsSize != 0)){
|
||||
if (*(UINT32*)SelfLoadedImage->LoadOptions == CLOVER_SIGN) {
|
||||
DBG("Clover load options size = %d bytes\n", self.getSelfLoadedImage().LoadOptionsSize);
|
||||
if ((self.getSelfLoadedImage().LoadOptions != NULL) &&
|
||||
(self.getSelfLoadedImage().LoadOptionsSize != 0)){
|
||||
if (*(UINT32*)self.getSelfLoadedImage().LoadOptions == CLOVER_SIGN) {
|
||||
GetBootFromOption();
|
||||
} else {
|
||||
ParseLoadOptions(&ConfName, &gConfigDict[1]);
|
||||
|
@ -80,7 +80,6 @@ extern OC_GLOBAL_CONFIG mOpenCoreConfiguration;
|
||||
#endif
|
||||
|
||||
extern CONST CHAR8 *AudioOutputNames[];
|
||||
extern BOOLEAN gProvideConsoleGopEnable;
|
||||
|
||||
INTN LayoutMainMenuHeight = 376;
|
||||
INTN LayoutAnimMoveForMenuX = 0;
|
||||
@ -448,7 +447,7 @@ VOID FillInputs(BOOLEAN New)
|
||||
InputItems[InputItemsCount].ItemType = Decimal; //122
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%04lld", gSettings.MaxSlide);
|
||||
InputItems[InputItemsCount].ItemType = BoolValue; //123
|
||||
InputItems[InputItemsCount++].BValue = gProvideConsoleGopEnable;
|
||||
InputItems[InputItemsCount++].BValue = gSettings.ProvideConsoleGop;
|
||||
|
||||
|
||||
|
||||
@ -1073,8 +1072,8 @@ VOID ApplyInputs(VOID)
|
||||
}
|
||||
i++; //123
|
||||
if (InputItems[i].Valid) {
|
||||
gProvideConsoleGopEnable = InputItems[i].BValue;
|
||||
DBG("applied ConsoleGopEnable=%s\n", gProvideConsoleGopEnable?"Y":"N");
|
||||
gSettings.ProvideConsoleGop = InputItems[i].BValue;
|
||||
DBG("applied ConsoleGopEnable=%s\n", gSettings.ProvideConsoleGop ? "Y" : "N" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -92,8 +92,6 @@ static BOOLEAN GraphicsScreenDirty;
|
||||
|
||||
// general defines and variables
|
||||
|
||||
static BOOLEAN haveError = FALSE;
|
||||
|
||||
//
|
||||
// Screen initialization and switching
|
||||
//
|
||||
@ -285,40 +283,6 @@ StatusToString (
|
||||
}*/
|
||||
|
||||
|
||||
BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CONST CHAR16 *where)
|
||||
{
|
||||
// CHAR16 ErrorName[64];
|
||||
|
||||
if (!EFI_ERROR(Status))
|
||||
return FALSE;
|
||||
|
||||
// StatusToString(ErrorName, Status);
|
||||
gST->ConOut->SetAttribute (gST->ConOut, ATTR_ERROR);
|
||||
printf("Fatal Error: %s %ls\n", efiStrError(Status), where);
|
||||
gST->ConOut->SetAttribute (gST->ConOut, ATTR_BASIC);
|
||||
haveError = TRUE;
|
||||
|
||||
//gBS->Exit(ImageHandle, ExitStatus, ExitDataSize, ExitData);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where)
|
||||
{
|
||||
// CHAR16 ErrorName[64];
|
||||
|
||||
if (!EFI_ERROR(Status))
|
||||
return FALSE;
|
||||
|
||||
// StatusToString(ErrorName, Status);
|
||||
gST->ConOut->SetAttribute (gST->ConOut, ATTR_ERROR);
|
||||
printf("Error: %s %ls\n", efiStrError(Status), where);
|
||||
gST->ConOut->SetAttribute (gST->ConOut, ATTR_BASIC);
|
||||
haveError = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Graphics functions
|
||||
//
|
||||
|
@ -15,6 +15,3 @@ VOID BltClearScreen();
|
||||
INTN HybridRepositioning(INTN Edge, INTN Value, INTN ImageDimension, INTN ScreenDimension, INTN DesignScreenDimension);
|
||||
INTN CalculateNudgePosition(INTN Position, INTN NudgeValue, INTN ImageDimension, INTN ScreenDimension);
|
||||
|
||||
|
||||
BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CONST CHAR16 *where);
|
||||
BOOLEAN CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where);
|
||||
|
Loading…
Reference in New Issue
Block a user