mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-27 12:15:19 +01:00
add gibraltar
Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
parent
61fbc3761e
commit
7c21ded8c1
48
Include/Protocol/AppleSystemInfo.h
Normal file
48
Include/Protocol/AppleSystemInfo.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/** @file
|
||||||
|
Apple System Info protocol.
|
||||||
|
|
||||||
|
Copyright (C) 2020, vit9696. All rights reserved.<BR>
|
||||||
|
This program and the accompanying materials are licensed and made available
|
||||||
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
|
distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php.
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef APPLE_SYSTEM_INFO_H
|
||||||
|
#define APPLE_SYSTEM_INFO_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
Apple System Info protocol GUID.
|
||||||
|
This protocol is present on Gibraltar Macs (ones with T1/T2).
|
||||||
|
82ED9A9E-CCBB-4CD2-8A94-F4E3559AF911
|
||||||
|
**/
|
||||||
|
#define APPLE_SYSTEM_INFO_PROTOCOL_GUID \
|
||||||
|
{ 0x82ED9A9E, 0xCCBB, 0x4CD2 \
|
||||||
|
{ 0x8A, 0x94, 0xF4, 0xE3, 0x55, 0x9A, 0xF9, 0x11 } }
|
||||||
|
|
||||||
|
typedef struct APPLE_SYSTEM_INFO_PROTOCOL_ APPLE_SYSTEM_INFO_PROTOCOL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Check whether platform is Gibraltar or not.
|
||||||
|
|
||||||
|
@retval TRUE on Gibraltar platform (T2 machine).
|
||||||
|
@retval FALSE on legacy platform.
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
BOOLEAN
|
||||||
|
(EFIAPI *APPLE_SYSTEM_INFO_IS_GIBRALTAR)(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
struct APPLE_SYSTEM_INFO_PROTOCOL_ {
|
||||||
|
UINTN Revision;
|
||||||
|
APPLE_SYSTEM_INFO_IS_GIBRALTAR IsGibraltar;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern EFI_GUID gAppleSystemInfoProtocolGuid;
|
||||||
|
|
||||||
|
#endif // APPLE_SYSTEM_INFO_H
|
@ -47,6 +47,7 @@
|
|||||||
#include "../Platform/CloverVersion.h"
|
#include "../Platform/CloverVersion.h"
|
||||||
|
|
||||||
#include <Guid/DataHubRecords.h>
|
#include <Guid/DataHubRecords.h>
|
||||||
|
#include <Protocol/AppleSystemInfo.h>
|
||||||
|
|
||||||
#define EFI_CPU_DATA_MAXIMUM_LENGTH 0x100
|
#define EFI_CPU_DATA_MAXIMUM_LENGTH 0x100
|
||||||
|
|
||||||
@ -396,6 +397,16 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
|
|||||||
gSettings.RtVariables.HWTarget = GetHWTarget(GlobalConfig.CurrentModel);
|
gSettings.RtVariables.HWTarget = GetHWTarget(GlobalConfig.CurrentModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern APPLE_SYSTEM_INFO_PROTOCOL mSystemInfo;
|
||||||
|
if (gSettings.RtVariables.HWTarget.notEmpty()) {
|
||||||
|
//install gibraltar
|
||||||
|
/*Status=*/gBS->InstallProtocolInterface (&gImageHandle,
|
||||||
|
&gAppleSystemInfoProtocolGuid,
|
||||||
|
EFI_NATIVE_INTERFACE,
|
||||||
|
&mSystemInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (gSettings.RtVariables.HWTarget.notEmpty() && (Entry->LoaderType != OSTYPE_OSX_INSTALLER) &&
|
if (gSettings.RtVariables.HWTarget.notEmpty() && (Entry->LoaderType != OSTYPE_OSX_INSTALLER) &&
|
||||||
(Entry->macOSVersion < MacOsVersion("13"_XS8)) ) {
|
(Entry->macOSVersion < MacOsVersion("13"_XS8)) ) {
|
||||||
SetNvramXString8(L"BridgeOSHardwareModel", gEfiAppleNvramGuid, Attributes, gSettings.RtVariables.HWTarget);
|
SetNvramXString8(L"BridgeOSHardwareModel", gEfiAppleNvramGuid, Attributes, gSettings.RtVariables.HWTarget);
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include <Protocol/FirmwareVolume.h>
|
#include <Protocol/FirmwareVolume.h>
|
||||||
#include <Protocol/AppleSMC.h>
|
#include <Protocol/AppleSMC.h>
|
||||||
|
#include <Protocol/AppleSystemInfo.h>
|
||||||
|
|
||||||
#ifndef DEBUG_ALL
|
#ifndef DEBUG_ALL
|
||||||
#define DEBUG_PRO 1
|
#define DEBUG_PRO 1
|
||||||
@ -54,6 +55,7 @@ UINT16 KeyboardProduct = 0x021d; //iMac aluminium
|
|||||||
|
|
||||||
extern UINT32 mCurrentColor;
|
extern UINT32 mCurrentColor;
|
||||||
extern EFI_GUID gAppleUserInterfaceThemeProtocolGuid;
|
extern EFI_GUID gAppleUserInterfaceThemeProtocolGuid;
|
||||||
|
extern EFI_GUID gAppleSystemInfoProtocolGuid;
|
||||||
|
|
||||||
typedef struct _APPLE_GETVAR_PROTOCOL APPLE_GETVAR_PROTOCOL;
|
typedef struct _APPLE_GETVAR_PROTOCOL APPLE_GETVAR_PROTOCOL;
|
||||||
|
|
||||||
@ -370,6 +372,20 @@ STATIC APPLE_USER_INTERFACE_THEME_PROTOCOL mAppleUserInterfaceThemeProtocol = {
|
|||||||
UserInterfaceThemeGetColor
|
UserInterfaceThemeGetColor
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
IsGibraltar ()
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
APPLE_SYSTEM_INFO_PROTOCOL mSystemInfo =
|
||||||
|
{
|
||||||
|
1,
|
||||||
|
IsGibraltar
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern EFI_FIRMWARE_VOLUME_PROTOCOL FirmwareVolume;
|
extern EFI_FIRMWARE_VOLUME_PROTOCOL FirmwareVolume;
|
||||||
extern APPLE_SMC_IO_PROTOCOL SMCHelperProtocol;
|
extern APPLE_SMC_IO_PROTOCOL SMCHelperProtocol;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
//EFI_GUID gEfiConsoleControlProtocolGuid = {0xF42F7782, 0x012E, 0x4C12, {0x99, 0x56, 0x49, 0xF9, 0x43, 0x04, 0xF7, 0x21}};
|
//EFI_GUID gEfiConsoleControlProtocolGuid = {0xF42F7782, 0x012E, 0x4C12, {0x99, 0x56, 0x49, 0xF9, 0x43, 0x04, 0xF7, 0x21}};
|
||||||
//EFI_GUID gAppleFirmwarePasswordProtocolGuid = {0x8FFEEB3A, 0x4C98, 0x4630, {0x80, 0x3F, 0x74, 0x0F, 0x95, 0x67, 0x09, 0x1D}};
|
//EFI_GUID gAppleFirmwarePasswordProtocolGuid = {0x8FFEEB3A, 0x4C98, 0x4630, {0x80, 0x3F, 0x74, 0x0F, 0x95, 0x67, 0x09, 0x1D}};
|
||||||
//gEfiGlobalVariableGuid
|
//gEfiGlobalVariableGuid
|
||||||
//EFI_GUID gEfiGlobalVarGuid = {0x8BE4DF61, 0x93CA, 0x11D2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C}};
|
//EFI_GUID gEfiGlobalVariableGuid = {0x8BE4DF61, 0x93CA, 0x11D2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C}};
|
||||||
// 8BE4DF61-93CA-11D2-AA0D-00E098032B8C:BootOrder
|
// 8BE4DF61-93CA-11D2-AA0D-00E098032B8C:BootOrder
|
||||||
//EFI_GUID gEfiDevicePathPropertyDatabaseProtocolGuid = {0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0}};
|
//EFI_GUID gEfiDevicePathPropertyDatabaseProtocolGuid = {0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0}};
|
||||||
//EFI_GUID gEfi AppleBootGuid = {0x7C436110, 0xAB2A, 0x4BBB, {0xA8, 0x80, 0xFE, 0x41, 0x99, 0x5C, 0x9F, 0x82}}; //gAppleBootVariableGuid
|
//EFI_GUID gEfi AppleBootGuid = {0x7C436110, 0xAB2A, 0x4BBB, {0xA8, 0x80, 0xFE, 0x41, 0x99, 0x5C, 0x9F, 0x82}}; //gAppleBootVariableGuid
|
||||||
|
@ -244,7 +244,7 @@ extern "C" {
|
|||||||
//constexpr const EFI_GUID gEfiConsoleControlProtocolGuid = {0xF42F7782, 0x012E, 0x4C12, {0x99, 0x56, 0x49, 0xF9, 0x43, 0x04, 0xF7, 0x21}};
|
//constexpr const EFI_GUID gEfiConsoleControlProtocolGuid = {0xF42F7782, 0x012E, 0x4C12, {0x99, 0x56, 0x49, 0xF9, 0x43, 0x04, 0xF7, 0x21}};
|
||||||
//constexpr const EFI_GUID gAppleFirmwarePasswordProtocolGuid = {0x8FFEEB3A, 0x4C98, 0x4630, {0x80, 0x3F, 0x74, 0x0F, 0x95, 0x67, 0x09, 0x1D}};
|
//constexpr const EFI_GUID gAppleFirmwarePasswordProtocolGuid = {0x8FFEEB3A, 0x4C98, 0x4630, {0x80, 0x3F, 0x74, 0x0F, 0x95, 0x67, 0x09, 0x1D}};
|
||||||
//gEfiGlobalVariableGuid
|
//gEfiGlobalVariableGuid
|
||||||
//constexpr const EFI_GUID gEfiGlobalVarGuid = {0x8BE4DF61, 0x93CA, 0x11D2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C}};
|
//constexpr const EFI_GUID gEfiGlobalVariableGuid = {0x8BE4DF61, 0x93CA, 0x11D2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C}};
|
||||||
//constexpr const EFI_GUID gEfiDevicePathPropertyDatabaseProtocolGuid = {0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0}};
|
//constexpr const EFI_GUID gEfiDevicePathPropertyDatabaseProtocolGuid = {0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0}};
|
||||||
//constexpr const EFI_GUID gEfi AppleBootGuid = {0x7C436110, 0xAB2A, 0x4BBB, {0xA8, 0x80, 0xFE, 0x41, 0x99, 0x5C, 0x9F, 0x82}}; //gAppleBootVariableGuid
|
//constexpr const EFI_GUID gEfi AppleBootGuid = {0x7C436110, 0xAB2A, 0x4BBB, {0xA8, 0x80, 0xFE, 0x41, 0x99, 0x5C, 0x9F, 0x82}}; //gAppleBootVariableGuid
|
||||||
//constexpr const EFI_GUID gEfiAppleNvramGuid = {0x4D1EDE05, 0x38C7, 0x4A6A, {0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x8C, 0x14}}; //gAppleVendorVariableGuid
|
//constexpr const EFI_GUID gEfiAppleNvramGuid = {0x4D1EDE05, 0x38C7, 0x4A6A, {0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x8C, 0x14}}; //gAppleVendorVariableGuid
|
||||||
|
@ -550,7 +550,7 @@ UINT64 GetPlatformFeature(MacModel Model)
|
|||||||
case iMac201:
|
case iMac201:
|
||||||
case iMac202:
|
case iMac202:
|
||||||
case MacPro71:
|
case MacPro71:
|
||||||
return 0x20;
|
return 0x0; //0x20;
|
||||||
case MacBookPro151:
|
case MacBookPro151:
|
||||||
case MacBookPro152:
|
case MacBookPro152:
|
||||||
case MacBookPro153:
|
case MacBookPro153:
|
||||||
@ -559,11 +559,11 @@ UINT64 GetPlatformFeature(MacModel Model)
|
|||||||
case MacBookPro162: //there is also 0x3A
|
case MacBookPro162: //there is also 0x3A
|
||||||
case MacBookPro163:
|
case MacBookPro163:
|
||||||
case MacBookPro164:
|
case MacBookPro164:
|
||||||
return 0x32;
|
return 0x12; //0x32;
|
||||||
case MacBookAir81:
|
case MacBookAir81:
|
||||||
case MacBookAir82:
|
case MacBookAir82:
|
||||||
case MacBookAir91:
|
case MacBookAir91:
|
||||||
return 0x3A;
|
return 0x1A; //3A;
|
||||||
// It is nonsense, ASCII code сharacter "2" = 0x32 != 0x02. Don't use ioreg, so that not to be confused. Use dmidecode dump.
|
// It is nonsense, ASCII code сharacter "2" = 0x32 != 0x02. Don't use ioreg, so that not to be confused. Use dmidecode dump.
|
||||||
default:
|
default:
|
||||||
return 0xFFFF; // disabled
|
return 0xFFFF; // disabled
|
||||||
|
@ -534,7 +534,7 @@
|
|||||||
gEfiFirmwareVolumeProtocolGuid
|
gEfiFirmwareVolumeProtocolGuid
|
||||||
gAppleSMCProtocolGuid ## PRODUCES and CONSUMES
|
gAppleSMCProtocolGuid ## PRODUCES and CONSUMES
|
||||||
gAppleSMCStateProtocolGuid ## PRODUCES and CONSUMES
|
gAppleSMCStateProtocolGuid ## PRODUCES and CONSUMES
|
||||||
|
gAppleSystemInfoProtocolGuid
|
||||||
|
|
||||||
gFSInjectProtocolGuid
|
gFSInjectProtocolGuid
|
||||||
gMsgLogProtocolGuid
|
gMsgLogProtocolGuid
|
||||||
|
Loading…
Reference in New Issue
Block a user