Source-Changes-HG archive

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

[src/pgoyette-compat]: src/sys Import from -current the MD glue code for comp...



details:   https://anonhg.NetBSD.org/src/rev/0c6965e07191
branches:  pgoyette-compat
changeset: 321062:0c6965e07191
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Mar 18 01:17:29 2018 +0000

description:
Import from -current the MD glue code for compat cpu_ucode

diffstat:

 sys/compat/common/kern_cpu_60.c |  26 ++++++++++++++++++++------
 sys/compat/sys/cpuio.h          |   4 ++--
 sys/kern/kern_cpu.c             |   8 ++++----
 sys/modules/compat/Makefile     |  31 +++++++++++++++++++------------
 4 files changed, 45 insertions(+), 24 deletions(-)

diffs (171 lines):

diff -r 50fa7de8210e -r 0c6965e07191 sys/compat/common/kern_cpu_60.c
--- a/sys/compat/common/kern_cpu_60.c   Sun Mar 18 00:35:26 2018 +0000
+++ b/sys/compat/common/kern_cpu_60.c   Sun Mar 18 01:17:29 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_cpu_60.c,v 1.1.2.2 2018/03/17 21:37:52 pgoyette Exp $     */
+/*     $NetBSD: kern_cpu_60.c,v 1.1.2.3 2018/03/18 01:17:29 pgoyette Exp $     */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,21 +30,31 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.1.2.2 2018/03/17 21:37:52 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.1.2.3 2018/03/18 01:17:29 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_cpu_ucode.h"
+#include "opt_compat_netbsd.h"
+#endif
 
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/systm.h>
 #include <sys/errno.h>
 #include <sys/kauth.h>
+#include <sys/lwp.h>
 #include <sys/cpu.h>
 #include <sys/cpuio.h>
 
-#include <compat/sys/cpuio.h>
+#include <compat/common/compat_mod.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:
@@ -62,14 +72,18 @@
        }
 }
 
-void
+int
 kern_cpu_60_init(void)
 {
+
        compat_cpuctl_ioctl = compat6_cpuctl_ioctl;
+       return 0;
 }
 
-void
+int
 kern_cpu_60_fini(void)
 {
+
        compat_cpuctl_ioctl = (void *)enosys;
+       return 0;
 }
diff -r 50fa7de8210e -r 0c6965e07191 sys/compat/sys/cpuio.h
--- a/sys/compat/sys/cpuio.h    Sun Mar 18 00:35:26 2018 +0000
+++ b/sys/compat/sys/cpuio.h    Sun Mar 18 01:17:29 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuio.h,v 1.5.16.2 2018/03/17 23:54:33 pgoyette Exp $ */
+/* $NetBSD: cpuio.h,v 1.5.16.3 2018/03/18 01:17:29 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -39,7 +39,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 50fa7de8210e -r 0c6965e07191 sys/kern/kern_cpu.c
--- a/sys/kern/kern_cpu.c       Sun Mar 18 00:35:26 2018 +0000
+++ b/sys/kern/kern_cpu.c       Sun Mar 18 01:17:29 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_cpu.c,v 1.71.16.7 2018/03/17 21:37:53 pgoyette Exp $      */
+/*     $NetBSD: kern_cpu.c,v 1.71.16.8 2018/03/18 01:17:29 pgoyette 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.71.16.7 2018/03/17 21:37:53 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.8 2018/03/18 01:17:29 pgoyette 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 50fa7de8210e -r 0c6965e07191 sys/modules/compat/Makefile
--- a/sys/modules/compat/Makefile       Sun Mar 18 00:35:26 2018 +0000
+++ b/sys/modules/compat/Makefile       Sun Mar 18 01:17:29 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.14.14.3 2018/03/17 06:49:57 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.14.14.4 2018/03/18 01:17:29 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -25,6 +25,15 @@
 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"
 
 SRCS+= compat_mod.c compat_exec.c compat_util.c
@@ -32,17 +41,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