diff options
-rw-r--r-- | sys/arch/arm/arm/arm32_machdep.c | 17 | ||||
-rw-r--r-- | sys/arch/arm/include/cpu.h | 6 |
2 files changed, 20 insertions, 3 deletions
diff --git a/sys/arch/arm/arm/arm32_machdep.c b/sys/arch/arm/arm/arm32_machdep.c index a5645c3c559..2ec0a44b6c2 100644 --- a/sys/arch/arm/arm/arm32_machdep.c +++ b/sys/arch/arm/arm/arm32_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arm32_machdep.c,v 1.59 2020/05/16 14:44:44 kettenis Exp $ */ +/* $OpenBSD: arm32_machdep.c,v 1.60 2020/05/17 15:36:50 kettenis Exp $ */ /* $NetBSD: arm32_machdep.c,v 1.42 2003/12/30 12:33:15 pk Exp $ */ /* @@ -59,6 +59,7 @@ #include <uvm/uvm_extern.h> #include <dev/cons.h> +#include <dev/ofw/openfirm.h> #include <arm/machdep.h> #include <machine/conf.h> @@ -303,6 +304,8 @@ int cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen, struct proc *p) { + char *compatible; + int node, len, error; /* all sysctl names at this level are terminal */ if (namelen != 1) @@ -331,6 +334,18 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, return (sysctl_rdint(oldp, oldlenp, newp, 0)); #endif + case CPU_COMPATIBLE: + node = OF_finddevice("/"); + len = OF_getproplen(node, "compatible"); + if (len <= 0) + return (EOPNOTSUPP); + compatible = malloc(len, M_TEMP, M_WAITOK | M_ZERO); + OF_getprop(node, "compatible", compatible, len); + compatible[len - 1] = 0; + error = sysctl_rdstring(oldp, oldlenp, newp, compatible); + free(compatible, M_TEMP, len); + return error; + default: return (EOPNOTSUPP); } diff --git a/sys/arch/arm/include/cpu.h b/sys/arch/arm/include/cpu.h index 0f93c34f008..c4d47ec0e18 100644 --- a/sys/arch/arm/include/cpu.h +++ b/sys/arch/arm/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.57 2020/01/12 16:55:00 kettenis Exp $ */ +/* $OpenBSD: cpu.h,v 1.58 2020/05/17 15:36:50 kettenis Exp $ */ /* $NetBSD: cpu.h,v 1.34 2003/06/23 11:01:08 martin Exp $ */ /* @@ -67,7 +67,8 @@ #define CPU_MAXSPEED 11 /* int: number of valid machdep ids */ /* 12 formerly int: CPU_LIDSUSPEND */ #define CPU_LIDACTION 13 /* action caused by lid close */ -#define CPU_MAXID 14 /* number of valid machdep ids */ +#define CPU_COMPATIBLE 14 /* compatible property */ +#define CPU_MAXID 15 /* number of valid machdep ids */ #define CTL_MACHDEP_NAMES { \ { 0, 0 }, \ @@ -84,6 +85,7 @@ { "maxspeed", CTLTYPE_INT }, \ { 0, 0 }, \ { "lidaction", CTLTYPE_INT }, \ + { "compatible", CTLTYPE_STRING }, \ } #ifdef _KERNEL |