finish MD glue for compat ucode module.

This commit is contained in:
christos 2018-03-18 00:51:45 +00:00
parent 83b317da58
commit cf143c3723
4 changed files with 34 additions and 23 deletions

View File

@ -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.c,v 1.1 2018/03/17 19:00:23 christos Exp
#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:

View File

@ -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)

View File

@ -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_mostly;
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 *data, int flag, lwp_t *l)
#endif
default:
error = (*compat_cpuctl_ioctl)(cmd, data);
error = (*compat_cpuctl_ioctl)(l, cmd, data);
break;
}
mutex_exit(&cpu_lock);

View File

@ -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
.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>