From 1c3a0ad1025fc636d775282b3d5fcf4db4a6e1f6 Mon Sep 17 00:00:00 2001 From: kettenis Date: Thu, 20 Oct 2022 18:43:35 +0000 Subject: [PATCH] Don't attempt to use EFI runtime services on UEFI versions before 2.1. The Dell Precision T1600 has a UEFI 2.0 implementation where calling GetTime() accesses memory that isn't covered by a runtime mapping. And frankly UEFI 2.0 is so ancient that we don't really want to use it anyway. This also adds the check to the arm64 version even though UEFI versions before 2.4 don't have arm64 support. But for now I want to keep amd64 and arm64 code as similar as possible. ok kn@ --- sys/arch/amd64/amd64/efi_machdep.c | 6 +++++- sys/arch/arm64/dev/efi_machdep.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/arch/amd64/amd64/efi_machdep.c b/sys/arch/amd64/amd64/efi_machdep.c index f4e9835caf1..cb005543916 100644 --- a/sys/arch/amd64/amd64/efi_machdep.c +++ b/sys/arch/amd64/amd64/efi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efi_machdep.c,v 1.1 2022/10/16 15:03:39 kettenis Exp $ */ +/* $OpenBSD: efi_machdep.c,v 1.2 2022/10/20 18:43:35 kettenis Exp $ */ /* * Copyright (c) 2022 Mark Kettenis @@ -112,6 +112,10 @@ efi_attach(struct device *parent, struct device *self, void *aux) printf(".%d", minor % 10); printf("\n"); + /* Early implementations can be buggy. */ + if (major < 2 || (major == 2 && minor < 10)) + return; + if ((bios_efiinfo->flags & BEI_64BIT) == 0) return; diff --git a/sys/arch/arm64/dev/efi_machdep.c b/sys/arch/arm64/dev/efi_machdep.c index 287310548c3..1144af51cf9 100644 --- a/sys/arch/arm64/dev/efi_machdep.c +++ b/sys/arch/arm64/dev/efi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efi_machdep.c,v 1.2 2022/10/12 13:39:50 kettenis Exp $ */ +/* $OpenBSD: efi_machdep.c,v 1.3 2022/10/20 18:43:35 kettenis Exp $ */ /* * Copyright (c) 2017 Mark Kettenis @@ -118,6 +118,10 @@ efi_attach(struct device *parent, struct device *self, void *aux) printf(".%d", minor % 10); printf("\n"); + /* Early implementations can be buggy. */ + if (major < 2 || (major == 2 && minor < 10)) + return; + efi_map_runtime(sc); /* -- 2.20.1