Module Name:    src
Committed By:   jmcneill
Date:           Thu Jan 30 11:09:53 UTC 2025

Modified Files:
        src/sys/arch/arm/fdt: arm_fdt.c

Log Message:
Ignore broken UEFI RTS on Radxa Orion O6


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/fdt/arm_fdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/fdt/arm_fdt.c
diff -u src/sys/arch/arm/fdt/arm_fdt.c:1.21 src/sys/arch/arm/fdt/arm_fdt.c:1.22
--- src/sys/arch/arm/fdt/arm_fdt.c:1.21	Fri Apr  7 08:55:30 2023
+++ src/sys/arch/arm/fdt/arm_fdt.c	Thu Jan 30 11:09:53 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_fdt.c,v 1.21 2023/04/07 08:55:30 skrll Exp $ */
+/* $NetBSD: arm_fdt.c,v 1.22 2025/01/30 11:09:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill <jmcne...@invisible.ca>
@@ -31,7 +31,7 @@
 #include "opt_modular.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm_fdt.c,v 1.21 2023/04/07 08:55:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_fdt.c,v 1.22 2025/01/30 11:09:53 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -68,6 +68,11 @@ static int	arm_fdt_efi_rtc_gettime(todr_
 static int	arm_fdt_efi_rtc_settime(todr_chip_handle_t, struct clock_ymdhms *);
 
 static struct todr_chip_handle efi_todr;
+
+static const char * const ignore_efi_runtime_models[] = {
+	/* RTC calls do not work with current firmware. */
+	"Radxa Computer (Shenzhen) Co., Ltd. Radxa Orion O6",
+};
 #endif
 
 CFATTACH_DECL_NEW(arm_fdt, 0,
@@ -244,6 +249,27 @@ arm_fdt_module_init(void)
 }
 
 #ifdef EFI_RUNTIME
+static bool
+arm_fdi_efi_ignored(void)
+{
+	const int phandle = OF_peer(0);
+	const char *descr;
+	u_int n;
+
+	descr = fdtbus_get_string(phandle, "model");
+	if (descr == NULL) {
+		return false;
+	}
+
+	for (n = 0; n < __arraycount(ignore_efi_runtime_models); n++) {
+		if (strcmp(descr, ignore_efi_runtime_models[n]) == 0) {
+			return true;
+		}
+	}
+
+	return false;
+}
+
 static void
 arm_fdt_efi_init(device_t dev)
 {
@@ -255,6 +281,11 @@ arm_fdt_efi_init(device_t dev)
 	if (chosen < 0)
 		return;
 
+	if (arm_fdi_efi_ignored()) {
+		aprint_debug_dev(dev, "EFI runtime services ignored on this platform\n");
+		return;
+	}
+
 	if (of_getprop_uint64(chosen, "netbsd,uefi-system-table", &efi_system_table) != 0)
 		return;
 

Reply via email to