From afc8f179c356f01b7c41b444babbde41e87be54e Mon Sep 17 00:00:00 2001 From: vit9696 Date: Sat, 18 Jan 2020 19:36:47 +0300 Subject: [PATCH] Bootstrap: Improved OpenCore rerun detection for new versions --- Application/Bootstrap/Bootstrap.c | 21 ++++++---- Changelog.md | 6 +++ Include/Protocol/OcBootstrap.h | 67 ------------------------------- OpenCorePkg.dec | 3 -- Platform/OpenCore/OpenCore.c | 5 ++- 5 files changed, 23 insertions(+), 79 deletions(-) delete mode 100644 Include/Protocol/OcBootstrap.h diff --git a/Application/Bootstrap/Bootstrap.c b/Application/Bootstrap/Bootstrap.c index 3d672ac2..508db619 100644 --- a/Application/Bootstrap/Bootstrap.c +++ b/Application/Bootstrap/Bootstrap.c @@ -92,7 +92,7 @@ LoadOpenCore ( } STATIC -VOID +EFI_STATUS StartOpenCore ( IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem, IN EFI_HANDLE LoadHandle, @@ -112,7 +112,7 @@ StartOpenCore ( if (EFI_ERROR (Status)) { DEBUG ((DEBUG_INFO, "BS: Failed to locate bootstrap protocol - %r\n", Status)); - return; + return EFI_NOT_FOUND; } if (Bootstrap->Revision != OC_BOOTSTRAP_PROTOCOL_REVISION) { @@ -122,16 +122,18 @@ StartOpenCore ( Bootstrap->Revision, OC_BOOTSTRAP_PROTOCOL_REVISION )); - return; + return EFI_UNSUPPORTED; } AbsPath = AbsoluteDevicePath (LoadHandle, LoadPath); - Bootstrap->ReRun (Bootstrap, FileSystem, AbsPath); + Status = Bootstrap->ReRun (Bootstrap, FileSystem, AbsPath); if (AbsPath != NULL) { FreePool (AbsPath); } + + return Status; } EFI_STATUS @@ -187,7 +189,10 @@ UefiMain ( // DEBUG ((DEBUG_INFO, "BS: Trying to start loaded OpenCore image...\n")); - StartOpenCore (FileSystem, LoadedImage->DeviceHandle, LoadedImage->FilePath); + Status = StartOpenCore (FileSystem, LoadedImage->DeviceHandle, LoadedImage->FilePath); + if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) { + return Status; + } DEBUG ((DEBUG_INFO, "BS: Trying to load OpenCore image...\n")); Status = LoadOpenCore (FileSystem, ImageHandle, &OcImageHandle); @@ -196,8 +201,8 @@ UefiMain ( return EFI_NOT_FOUND; } - StartOpenCore (FileSystem, LoadedImage->DeviceHandle, LoadedImage->FilePath); - DEBUG ((DEBUG_WARN, "BS: Failed to start OpenCore image...\n")); + Status = StartOpenCore (FileSystem, LoadedImage->DeviceHandle, LoadedImage->FilePath); + DEBUG ((DEBUG_WARN, "BS: Failed to start OpenCore image - %r\n", Status)); - return EFI_NOT_FOUND; + return Status; } diff --git a/Changelog.md b/Changelog.md index 38b090cc..75e8c1e1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,11 @@ OpenCore Changelog ================== + +#### v0.5.5 +- Fixed CPU bus ratio calculation for Nehalem and Westmere +- Fixed CPU package calculation on MacPro5,1 and similar +- Improved OpenCore rerun detection for new versions + #### v0.5.4 - Added Enter key handling in boot menu for quick proceed - Update builtin firmware versions diff --git a/Include/Protocol/OcBootstrap.h b/Include/Protocol/OcBootstrap.h deleted file mode 100644 index 24d2ea4b..00000000 --- a/Include/Protocol/OcBootstrap.h +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - Copyright (C) 2018, vit9696. All rights reserved. - - All rights reserved. - - 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 OC_BOOTSTRAP_PROTOCOL_H -#define OC_BOOTSTRAP_PROTOCOL_H - -#include - -#include - -/// -/// BA1EB455-B182-4F14-8521-E422C325DEF6 -/// -#define OC_BOOTSTRAP_PROTOCOL_GUID \ - { \ - 0xBA1EB455, 0xB182, 0x4F14, { 0x85, 0x21, 0xE4, 0x22, 0xC3, 0x25, 0xDE, 0xF6 } \ - } - -/// -/// OC_BOOTSTRAP_PROTOCOL revision -/// -#define OC_BOOTSTRAP_PROTOCOL_REVISION 4 - -/// -/// Forward declaration of OC_BOOTSTRAP_PROTOCOL structure. -/// -typedef struct OC_BOOTSTRAP_PROTOCOL_ OC_BOOTSTRAP_PROTOCOL; - -/** - Restart OpenCore at specified file system, does not return. - - @param[in] This This protocol. - @param[in] FileSystem File system to bootstrap in. - @param[in] LoadPath EFI device path to loaded image. -**/ -typedef -VOID -(EFIAPI *OC_BOOTSTRAP_RERUN) ( - IN OC_BOOTSTRAP_PROTOCOL *This, - IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem, - IN EFI_DEVICE_PATH_PROTOCOL *LoadPath OPTIONAL - ); - -/// -/// The structure exposed by the OC_BOOTSTRAP_PROTOCOL. -/// -struct OC_BOOTSTRAP_PROTOCOL_ { - UINTN Revision; - UINTN NestedCount; - OC_RSA_PUBLIC_KEY *VaultKey; - OC_BOOTSTRAP_RERUN ReRun; -}; - -extern EFI_GUID gOcBootstrapProtocolGuid; - -#endif // OC_BOOTSTRAP_PROTOCOL_H diff --git a/OpenCorePkg.dec b/OpenCorePkg.dec index 19dbe369..ab1aaef2 100755 --- a/OpenCorePkg.dec +++ b/OpenCorePkg.dec @@ -21,6 +21,3 @@ [Includes] Include - -[Protocols] - gOcBootstrapProtocolGuid = { 0xBA1EB455, 0xB182, 0x4F14, { 0x85, 0x21, 0xE4, 0x22, 0xC3, 0x25, 0xDE, 0xF6 }} diff --git a/Platform/OpenCore/OpenCore.c b/Platform/OpenCore/OpenCore.c index 4ccb86eb..31aedacd 100644 --- a/Platform/OpenCore/OpenCore.c +++ b/Platform/OpenCore/OpenCore.c @@ -165,7 +165,7 @@ OcMain ( } STATIC -VOID +EFI_STATUS EFIAPI OcBootstrapRerun ( IN OC_BOOTSTRAP_PROTOCOL *This, @@ -200,9 +200,12 @@ OcBootstrapRerun ( } } else { DEBUG ((DEBUG_WARN, "OC: Nested ReRun is not supported\n")); + Status = EFI_ALREADY_STARTED; } --This->NestedCount; + + return Status; } STATIC