Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys finish MD glue for compat ucode module.



details:   https://anonhg.NetBSD.org/src/rev/0bb6efd96f24
branches:  trunk
changeset: 321486:0bb6efd96f24
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 18 00:51:45 2018 +0000

description:
finish MD glue for compat ucode module.

diffstat:

 sys/compat/common/kern_cpu_60.c |  16 +++++++++++-----
 sys/compat/sys/cpuio.h          |   4 ++--
 sys/kern/kern_cpu.c             |   8 ++++----
 sys/modules/compat/Makefile     |  29 +++++++++++++++++------------
 4 files changed, 34 insertions(+), 23 deletions(-)

diffs (143 lines):

diff -r 878ed6102f2e -r 0bb6efd96f24 sys/compat/common/kern_cpu_60.c
--- a/sys/compat/common/kern_cpu_60.c   Sun Mar 18 00:17:17 2018 +0000
+++ b/sys/compat/common/kern_cpu_60.c   Sun Mar 18 00:51:45 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_cpu_60.c,v 1.1 2018/03/17 19:00:23 christos Exp $ */
+/*     $NetBSD: kern_cpu_60.c,v 1.2 2018/03/18 00:51:45 christos Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.1 2018/03/17 19:00:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.2 2018/03/18 00:51:45 christos Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_cpu_ucode.h"
+#include "opt_compat_netbsd.h"
+#endif
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -40,11 +45,12 @@
 #include <sys/cpu.h>
 #include <sys/cpuio.h>
 
-#include <compat/sys/cpuio.h>
-
 static int
-compat6_cpuctl_ioctl(u_long cmd, void *data)
+compat6_cpuctl_ioctl(struct lwp *l, u_long cmd, void *data)
 {
+#if defined(CPU_UCODE) && defined(COMPAT_60)
+       int error;
+#endif
        switch (cmd) {
 #if defined(CPU_UCODE) && defined(COMPAT_60)
        case OIOC_CPU_UCODE_GET_VERSION:
diff -r 878ed6102f2e -r 0bb6efd96f24 sys/compat/sys/cpuio.h
--- a/sys/compat/sys/cpuio.h    Sun Mar 18 00:17:17 2018 +0000
+++ b/sys/compat/sys/cpuio.h    Sun Mar 18 00:51:45 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuio.h,v 1.6 2018/03/17 19:00:23 christos Exp $ */
+/* $NetBSD: cpuio.h,v 1.7 2018/03/18 00:51:45 christos Exp $ */
 
 #include <sys/ioccom.h>
 
@@ -7,7 +7,7 @@
        char fwname[PATH_MAX];
 };
 
-extern int (*compat_cpuctl_ioctl)(u_long, void *);
+extern int (*compat_cpuctl_ioctl)(struct lwp *, u_long, void *);
 
 #define OIOC_CPU_UCODE_GET_VERSION      _IOR('c', 4, struct compat6_cpu_ucode)
 #define OIOC_CPU_UCODE_APPLY            _IOW('c', 5, struct compat6_cpu_ucode)
diff -r 878ed6102f2e -r 0bb6efd96f24 sys/kern/kern_cpu.c
--- a/sys/kern/kern_cpu.c       Sun Mar 18 00:17:17 2018 +0000
+++ b/sys/kern/kern_cpu.c       Sun Mar 18 00:51:45 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_cpu.c,v 1.72 2018/03/17 19:03:25 christos Exp $   */
+/*     $NetBSD: kern_cpu.c,v 1.73 2018/03/18 00:51:46 christos Exp $   */
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.72 2018/03/17 19:03:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.73 2018/03/18 00:51:46 christos Exp $");
 
 #include "opt_cpu_ucode.h"
 
@@ -127,7 +127,7 @@
 kcpuset_t *    kcpuset_attached        __read_mostly   = NULL;
 kcpuset_t *    kcpuset_running         __read_mostly   = NULL;
 
-int (*compat_cpuctl_ioctl)(u_long, void *) = (void *)enosys;
+int (*compat_cpuctl_ioctl)(struct lwp *, u_long, void *) = (void *)enosys;
 
 static char cpu_model[128];
 
@@ -296,7 +296,7 @@
 #endif
 
        default:
-               error = (*compat_cpuctl_ioctl)(cmd, data);
+               error = (*compat_cpuctl_ioctl)(l, cmd, data);
                break;
        }
        mutex_exit(&cpu_lock);
diff -r 878ed6102f2e -r 0bb6efd96f24 sys/modules/compat/Makefile
--- a/sys/modules/compat/Makefile       Sun Mar 18 00:17:17 2018 +0000
+++ b/sys/modules/compat/Makefile       Sun Mar 18 00:51:45 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.14 2016/11/03 04:26:58 riastradh Exp $
+#      $NetBSD: Makefile,v 1.15 2018/03/18 00:51:46 christos Exp $
 
 .include "../Makefile.inc"
 
@@ -24,6 +24,13 @@
 CPPFLAGS+=     -DCOMPAT_30 -DCOMPAT_40 -DCOMPAT_50
 CPPFLAGS+=     -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
 CPPFLAGS+=     -DCOMPAT_43
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
+CPPFLAGS+=     -DCPU_UCODE
+# pick up more for bsd.klinks.mk as needed.
+MACHINE_EXTRA= x86
+.else
+MACHINE_EXTRA= none
+.endif
 
 .include "../../compat/common/Makefile.sysio"
 
@@ -32,17 +39,15 @@
 .PATH: ${S}/arch/${MACHINE}/${MACHINE}
 .PATH: ${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
 .PATH: ${S}/arch/${MACHINE_CPU}/${MACHINE_CPU}
+.PATH: ${S}    ${S}/arch/${MACHINE_EXTRA}/${MACHINE_EXTRA}
 
-.if (exists(${S}/arch/${MACHINE}/${MACHINE}/compat_13_machdep.c)) || \
-    (exists(${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}/compat_13_machdep.c)) || \
-    (exists(${S}/arch/${MACHINE_CPU}/${MACHINE_CPU}/compat_13_machdep.c))
-SRCS+= compat_13_machdep.c
-.endif
-
-.if (exists(${S}/arch/${MACHINE}/${MACHINE}/compat_16_machdep.c)) || \
-    (exists(${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}/compat_16_machdep.c)) || \
-    (exists(${S}/arch/${MACHINE_CPU}/${MACHINE_CPU}/compat_16_machdep.c))
-SRCS+= compat_16_machdep.c
-.endif
+.for i in compat_13_machdep.c compat_16_machdep.c compat_60_cpu_ucode.c
+.   if exists(${S}/arch/${MACHINE}/${MACHINE}/${i}) || \
+       exists(${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}/${i}) || \
+       exists(${S}/arch/${MACHINE_CPU}/${MACHINE_CPU}/${i}) || \
+       exists(${S}/arch/${MACHINE_EXTRA}/${MACHINE_EXTRA}/${i})
+SRCS+= ${i}
+.   endif
+.endfor
 
 .include <bsd.kmodule.mk>



Home | Main Index | Thread Index | Old Index