From ced0ba8e2bbc427b3ecd6723922db3cf71fb3999 Mon Sep 17 00:00:00 2001 From: Sergey Isakov Date: Tue, 22 Oct 2019 15:00:07 +0300 Subject: [PATCH] add apple varibles to be erased Signed-off-by: Sergey Isakov --- CloverPkg.dec | 24 ++++++++++++++++++++++++ rEFIt_UEFI/Platform/Nvram.c | 28 +++++++++++++++++++++++----- rEFIt_UEFI/refit.inf | 8 ++++++++ 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/CloverPkg.dec b/CloverPkg.dec index 0e6d34e2f..69e646e46 100644 --- a/CloverPkg.dec +++ b/CloverPkg.dec @@ -74,6 +74,30 @@ gApplePlatformInfoKeyboardGuid = {0x51871CB9, 0xE25D, 0x44B4, {0x96, 0x99, 0x0E, 0xE8, 0x64, 0x4C, 0xED, 0x69}} gAppleOsLoadedNamedEventGuid = {0xC5C5DA95, 0x7D5C, 0x45E6, {0x83, 0x72, 0x89, 0xBD, 0x52, 0x6D, 0xE9, 0x56}} gBootChimeVendorVariableGuid = {0x89D4F995, 0x67E3, 0x4895, {0x8F, 0x18, 0x45, 0x4B, 0x65, 0x1D, 0x92, 0x15}} + # Include/Guid/AppleVariable.h + gAppleCoreStorageVariableGuid = { 0x8D63D4FE, 0xBD3C, 0x4AAD, { 0x88, 0x1D, 0x86, 0xFD, 0x97, 0x4B, 0xC1, 0xDF }} + + # Include/Guid/AppleVariable.h + gAppleTamperResistantBootVariableGuid = { 0x5D62B28D, 0x6ED2, 0x40B4, { 0xA5, 0x60, 0x6C, 0xD7, 0x9B, 0x93, 0xD3, 0x66 }} + + # Include/Guid/AppleVariable.h + gAppleWirelessNetworkVariableGuid = { 0x36C28AB5, 0x6566, 0x4C50, { 0x9E, 0xBD, 0xCB, 0xB9, 0x20, 0xF8, 0x38, 0x43 }} + + # Include/Guid/AppleVariable.h + gApplePersonalizationVariableGuid = { 0xFA4CE28D, 0xB62F, 0x4C99, { 0x9C, 0xC3, 0x68, 0x15, 0x68, 0x6E, 0x30, 0xF9 }} + + # Include/Guid/AppleVariable.h + gAppleTamperResistantBootSecureVariableGuid = { 0xF68DA75E, 0x1B55, 0x4E70, { 0xB4, 0x1B, 0xA7, 0xB7, 0xA5, 0xB7, 0x58, 0xEA }} + + # Include/Guid/AppleVariable.h + gAppleTamperResistantBootEfiUserVariableGuid = { 0x4E8023FF, 0xA79A, 0x47D1, { 0xA3, 0x42, 0x75, 0x24, 0xCF, 0xC9, 0x6D, 0xC4 }} + + # Include/Guid/AppleVariable.h + gAppleNetbootVariableGuid = { 0x37BCBEC7, 0xA645, 0x4215, { 0x97, 0x9E, 0xF5, 0xAE, 0x4D, 0x11, 0x5F, 0x13 }} + + # Include/Guid/AppleVariable.h + gAppleSecureBootVariableGuid = { 0x94B73556, 0x2197, 0x4702, { 0x82, 0xA8, 0x3E, 0x13, 0x37, 0xDA, 0xFB, 0xFB }} + # Include/Protocol/ApplePartitionInfo.h gAppleApfsPartitionTypeGuid = {0x7C3457EF, 0x0000, 0x11AA, {0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC}} gAppleApfsContainerInfoGuid = {0x3533CF0D, 0x685F, 0x5EBF, {0x8D, 0xC6, 0x73, 0x93, 0x48, 0x5B, 0xAF, 0xA2}} diff --git a/rEFIt_UEFI/Platform/Nvram.c b/rEFIt_UEFI/Platform/Nvram.c index fb1a1b756..156b307de 100644 --- a/rEFIt_UEFI/Platform/Nvram.c +++ b/rEFIt_UEFI/Platform/Nvram.c @@ -54,6 +54,16 @@ EFI_GUID mOzmosisProprietary2Guid = { 0x9480E8A1, 0x1793, 0x46C9, { 0x91, // BootChime extern EFI_GUID gBootChimeVendorVariableGuid; +//Apple variables +extern EFI_GUID gAppleCoreStorageVariableGuid; +extern EFI_GUID gAppleTamperResistantBootVariableGuid; +extern EFI_GUID gAppleWirelessNetworkVariableGuid; +extern EFI_GUID gApplePersonalizationVariableGuid; +extern EFI_GUID gAppleNetbootVariableGuid; +extern EFI_GUID gAppleSecureBootVariableGuid; +extern EFI_GUID gAppleTamperResistantBootSecureVariableGuid; +extern EFI_GUID gAppleTamperResistantBootEfiUserVariableGuid; + APPLE_SMC_IO_PROTOCOL *gAppleSmc = NULL; typedef struct NVRAM_DATA @@ -316,8 +326,16 @@ IsDeletableVariable ( ) { // Apple GUIDs - if (CompareGuid (Guid, &gEfiAppleVendorGuid) || - CompareGuid (Guid, &gEfiAppleBootGuid)) { + if (CompareGuid(Guid, &gEfiAppleVendorGuid) || + CompareGuid(Guid, &gEfiAppleBootGuid) || + CompareGuid(Guid, &gAppleCoreStorageVariableGuid) || + CompareGuid(Guid, &gAppleTamperResistantBootVariableGuid) || + CompareGuid(Guid, &gAppleWirelessNetworkVariableGuid) || + CompareGuid(Guid, &gApplePersonalizationVariableGuid) || + CompareGuid(Guid, &gAppleNetbootVariableGuid) || + CompareGuid(Guid, &gAppleSecureBootVariableGuid) || + CompareGuid(Guid, &gAppleTamperResistantBootSecureVariableGuid) || + CompareGuid(Guid, &gAppleTamperResistantBootEfiUserVariableGuid)) { return TRUE; // Disable Clover Boot Options from being deleted @@ -332,13 +350,13 @@ IsDeletableVariable ( // Lilu / OpenCore extensions } else if (CompareGuid (Guid, &gOcVendorVariableGuid) || - CompareGuid (Guid, &gOcReadOnlyVariableGuid) || - CompareGuid (Guid, &gOcWriteOnlyVariableGuid)) { + CompareGuid(Guid, &gOcReadOnlyVariableGuid) || + CompareGuid(Guid, &gOcWriteOnlyVariableGuid)) { return TRUE; // Ozmozis extensions } else if (CompareGuid (Guid, &mOzmosisProprietary1Guid) || - CompareGuid (Guid, &mOzmosisProprietary2Guid)) { + CompareGuid (Guid, &mOzmosisProprietary2Guid)) { return TRUE; // BootChime diff --git a/rEFIt_UEFI/refit.inf b/rEFIt_UEFI/refit.inf index 3ffd12448..fd00ada36 100644 --- a/rEFIt_UEFI/refit.inf +++ b/rEFIt_UEFI/refit.inf @@ -200,6 +200,14 @@ gEfiAppleBootGuid gEfiAppleNvramGuid gEfiAppleVendorGuid + gAppleCoreStorageVariableGuid + gAppleTamperResistantBootVariableGuid + gAppleWirelessNetworkVariableGuid + gApplePersonalizationVariableGuid + gAppleNetbootVariableGuid + gAppleSecureBootVariableGuid + gAppleTamperResistantBootSecureVariableGuid + gAppleTamperResistantBootEfiUserVariableGuid gEfiDxeServicesTableGuid gEfiEventReadyToBootGuid gEfiEventVirtualAddressChangeGuid