summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduard Acatrinei <eduard.acatrinei@certussoftware.ro>2024-08-29 10:32:58 +0300
committerPeter Jones <pjones@redhat.com>2025-01-15 16:35:16 -0500
commitad8692e848cb520d734fbb075c30dcc3307ef8a4 (patch)
tree8f59b18706e752d38b3561bca463358711508a6c
parent196cbb9e74b8c25bbdb68944ad99ba69fa4dcaaf (diff)
downloadefi-boot-shim-ad8692e848cb520d734fbb075c30dcc3307ef8a4.tar.gz
efi-boot-shim-ad8692e848cb520d734fbb075c30dcc3307ef8a4.zip
avoid EFIv2 runtime services on Apple x86 machines
While booting a MacBookPro15,2 (the last Intel model, 2019), shim 15.8 gets stuck in RT->QueryVariableInfo(). Previously, these devices shipped with EFI firmware version 1.10, and we had a quirk in place for this (#364). However, Apple updated the firmware to version 2.40, but it still doesn't implement runtime services. This patch adds a test for Apple as the vendor, and treats that as equivalent to having an older major UEFI version. Signed-off-by: Eduard Acatrinei <eduard.acatrinei@certussoftware.ro>
-rw-r--r--mok.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/mok.c b/mok.c
index 0ac34158..405107c1 100644
--- a/mok.c
+++ b/mok.c
@@ -217,6 +217,22 @@ typedef UINTN SIZE_T;
#define EFI_MAJOR_VERSION(tablep) ((UINT16)((((tablep)->Hdr.Revision) >> 16) & 0xfffful))
#define EFI_MINOR_VERSION(tablep) ((UINT16)(((tablep)->Hdr.Revision) & 0xfffful))
+static BOOLEAN is_apple_firmware_vendor(void)
+{
+ CHAR16 vendorbuf[100] = L"";
+ CHAR16 *vendor = ST->FirmwareVendor;
+ if (!vendor)
+ return FALSE;
+
+ CopyMem(vendorbuf, vendor, sizeof(vendorbuf) - sizeof(vendorbuf[0]));
+ dprint(L"FirmwareVendor: \"%s\"\n", vendorbuf);
+
+ if (StrnCmp(vendorbuf, L"Apple", 5) == 0)
+ return TRUE;
+
+ return FALSE;
+}
+
static EFI_STATUS
get_max_var_sz(UINT32 attrs, SIZE_T *max_var_szp)
{
@@ -226,7 +242,7 @@ get_max_var_sz(UINT32 attrs, SIZE_T *max_var_szp)
uint64_t max_var_sz = 0;
*max_var_szp = 0;
- if (EFI_MAJOR_VERSION(RT) < 2) {
+ if (EFI_MAJOR_VERSION(RT) < 2 || is_apple_firmware_vendor()) {
dprint(L"EFI %d.%d; no RT->QueryVariableInfo(). Using 1024!\n",
EFI_MAJOR_VERSION(RT), EFI_MINOR_VERSION(RT));
max_var_sz = remaining_sz = max_storage_sz = 1024;