From 39605d02be71c8f8c8e4203b482edd8871b057b9 Mon Sep 17 00:00:00 2001 From: vit9696 Date: Sat, 20 Feb 2021 23:13:09 +0300 Subject: [PATCH] OcConsoleLib: Fix installing Apple FB Info protocol when no GOP exists --- Changelog.md | 1 + Include/Apple/Protocol/AppleDiagLed.h | 24 ++++++++++++++++++++++++ Library/OcConsoleLib/FramebufferInfo.c | 5 +++++ OpenCorePkg.dec | 3 +++ 4 files changed, 33 insertions(+) create mode 100644 Include/Apple/Protocol/AppleDiagLed.h diff --git a/Changelog.md b/Changelog.md index 3f32d1c2..839c9b3c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,6 +11,7 @@ OpenCore Changelog - Added support for R/O page tables in `SetupVirtualMap` quirk - Added OEM preservation for certain Apple SMBIOS tables - Fixed switching to graphics mode when entering OpenCanopy +- Fixed installing Apple FB Info protocol when no GOP exists #### v0.6.6 - Added keyboard and pointer entry scroll support in OpenCanopy diff --git a/Include/Apple/Protocol/AppleDiagLed.h b/Include/Apple/Protocol/AppleDiagLed.h new file mode 100644 index 00000000..f725d5ca --- /dev/null +++ b/Include/Apple/Protocol/AppleDiagLed.h @@ -0,0 +1,24 @@ +/** @file + Apple Diag Led protocol. + +Copyright (C) 2021, vit9696. 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 APPLE_DIAG_LED_PROTOCOL_H +#define APPLE_DIAG_LED_PROTOCOL_H + +#define APPLE_DIAG_LED_PROTOCOL_GUID \ + { 0xA9FBF34B, 0xE2A2, 0x41D1, \ + { 0xBA, 0x00, 0xA2, 0x74, 0xA5, 0x5C, 0xD1, 0x64 } } + +extern EFI_GUID gAppleDiagLedProtocolGuid; + +#endif // APPLE_DIAG_LED_PROTOCOL_H diff --git a/Library/OcConsoleLib/FramebufferInfo.c b/Library/OcConsoleLib/FramebufferInfo.c index 7ffd4940..4e01a194 100644 --- a/Library/OcConsoleLib/FramebufferInfo.c +++ b/Library/OcConsoleLib/FramebufferInfo.c @@ -117,6 +117,11 @@ OcAppleFbInfoInstallProtocol ( } } + if (OcCountProtocolInstances (&gEfiGraphicsOutputProtocolGuid) == 0) { + DEBUG ((DEBUG_ERROR, "OCOS: No GOP protocols for FB info\n")); + return NULL; + } + NewHandle = NULL; Status = gBS->InstallMultipleProtocolInterfaces ( &NewHandle, diff --git a/OpenCorePkg.dec b/OpenCorePkg.dec index d66f3463..ff108474 100755 --- a/OpenCorePkg.dec +++ b/OpenCorePkg.dec @@ -633,6 +633,9 @@ ## Include/Apple/Protocol/AppleDiag.h gAppleDiagVaultProtocolGuid = { 0xF76761DC, 0xFF89, 0x44E4, { 0x9C, 0x0C, 0xCD, 0x0A, 0xDA, 0x4E, 0xF9, 0x83 }} + ## Include/Apple/Protocol/AppleDiagLed.h + gAppleDiagLedProtocolGuid = { 0xA9FBF34B, 0xE2A2, 0x41D1, { 0xBA, 0x00, 0xA2, 0x74, 0xA5, 0x5C, 0xD1, 0x64 }} + ## Include/Apple/Protocol/AppleRemovableMedia.h gAppleRemovableMediaProtocolGuid = { 0x2EA9743A, 0x23D9, 0x425E, { 0x87, 0x2C, 0xF6, 0x15, 0xAA, 0x19, 0x57, 0x88 }}