summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2020-07-11 11:43:57 +0000
committerkettenis <kettenis@openbsd.org>2020-07-11 11:43:57 +0000
commit0dc8bf2f295bba4fdf5278e4c00c8ffead354f47 (patch)
treedac37d867d195cfb1c5020cf06d94d924596e894
parentChange locks which don't use spin_lock_irq() or spin_lock_irqsave() (diff)
downloadwireguard-openbsd-0dc8bf2f295bba4fdf5278e4c00c8ffead354f47.tar.xz
wireguard-openbsd-0dc8bf2f295bba4fdf5278e4c00c8ffead354f47.zip
Implement a machdep.altivec sysctl that always returns 1. This makes
pixman in xenocara build and hopefully helps with ports as well. suggested by matthieu@
-rw-r--r--sys/arch/powerpc64/include/cpu.h13
-rw-r--r--sys/arch/powerpc64/powerpc64/machdep.c7
2 files changed, 17 insertions, 3 deletions
diff --git a/sys/arch/powerpc64/include/cpu.h b/sys/arch/powerpc64/include/cpu.h
index 6e119228bc3..3729f1b9a53 100644
--- a/sys/arch/powerpc64/include/cpu.h
+++ b/sys/arch/powerpc64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.18 2020/07/05 20:49:40 naddy Exp $ */
+/* $OpenBSD: cpu.h,v 1.19 2020/07/11 11:43:57 kettenis Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -23,7 +23,16 @@
* User-visible definitions
*/
-/* Nothing yet */
+/*
+ * CTL_MACHDEP definitions.
+ */
+#define CPU_ALTIVEC 1 /* altivec is present */
+#define CPU_MAXID 2 /* number of valid machdep ids */
+
+#define CTL_MACHDEP_NAMES { \
+ { 0, 0 }, \
+ { "altivec", CTLTYPE_INT }, \
+}
#ifdef _KERNEL
diff --git a/sys/arch/powerpc64/powerpc64/machdep.c b/sys/arch/powerpc64/powerpc64/machdep.c
index f36215f5b20..4766588a982 100644
--- a/sys/arch/powerpc64/powerpc64/machdep.c
+++ b/sys/arch/powerpc64/powerpc64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.48 2020/07/10 17:09:37 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.49 2020/07/11 11:43:57 kettenis Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -26,6 +26,7 @@
#include <sys/reboot.h>
#include <sys/signalvar.h>
#include <sys/syscallargs.h>
+#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/user.h>
@@ -879,11 +880,15 @@ int
cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen, struct proc *p)
{
+ int altivec = 1; /* Altivec is always supported */
+
/* All sysctl names at this level are terminal. */
if (namelen != 1)
return ENOTDIR; /* overloaded */
switch (name[0]) {
+ case CPU_ALTIVEC:
+ return (sysctl_rdint(oldp, oldlenp, newp, altivec));
default:
return EOPNOTSUPP;
}