Module Name: src Committed By: christos Date: Sun Mar 18 00:51:46 UTC 2018
Modified Files: src/sys/compat/common: kern_cpu_60.c src/sys/compat/sys: cpuio.h src/sys/kern: kern_cpu.c src/sys/modules/compat: Makefile Log Message: finish MD glue for compat ucode module. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/compat/common/kern_cpu_60.c cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/cpuio.h cvs rdiff -u -r1.72 -r1.73 src/sys/kern/kern_cpu.c cvs rdiff -u -r1.14 -r1.15 src/sys/modules/compat/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/compat/common/kern_cpu_60.c diff -u src/sys/compat/common/kern_cpu_60.c:1.1 src/sys/compat/common/kern_cpu_60.c:1.2 --- src/sys/compat/common/kern_cpu_60.c:1.1 Sat Mar 17 15:00:23 2018 +++ src/sys/compat/common/kern_cpu_60.c Sat Mar 17 20:51:45 2018 @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: kern_cpu_60. #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: Index: src/sys/compat/sys/cpuio.h diff -u src/sys/compat/sys/cpuio.h:1.6 src/sys/compat/sys/cpuio.h:1.7 --- src/sys/compat/sys/cpuio.h:1.6 Sat Mar 17 15:00:23 2018 +++ src/sys/compat/sys/cpuio.h Sat Mar 17 20:51:45 2018 @@ -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 @@ struct compat6_cpu_ucode { 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) Index: src/sys/kern/kern_cpu.c diff -u src/sys/kern/kern_cpu.c:1.72 src/sys/kern/kern_cpu.c:1.73 --- src/sys/kern/kern_cpu.c:1.72 Sat Mar 17 15:03:25 2018 +++ src/sys/kern/kern_cpu.c Sat Mar 17 20:51:46 2018 @@ -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 @@ struct cpu_info **cpu_infos __read_most 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 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void #endif default: - error = (*compat_cpuctl_ioctl)(cmd, data); + error = (*compat_cpuctl_ioctl)(l, cmd, data); break; } mutex_exit(&cpu_lock); Index: src/sys/modules/compat/Makefile diff -u src/sys/modules/compat/Makefile:1.14 src/sys/modules/compat/Makefile:1.15 --- src/sys/modules/compat/Makefile:1.14 Thu Nov 3 00:26:58 2016 +++ src/sys/modules/compat/Makefile Sat Mar 17 20:51:46 2018 @@ -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_20 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 @@ SRCS+= compat_mod.c .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>