Module Name: src
Committed By: drochner
Date: Wed Oct 17 20:19:55 UTC 2012
Modified Files:
src/sys/arch/x86/include: cpu_ucode.h
src/sys/arch/x86/x86: cpu_ucode.c cpu_ucode_amd.c cpu_ucode_intel.c
src/sys/arch/xen/xen: xen_ucode.c
src/sys/kern: kern_cpu.c
src/sys/sys: cpu.h
Log Message:
put binary compatibility support for the old AMD-only CPU microcode
update API inside COMPAT_60
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/include/cpu_ucode.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/x86/cpu_ucode.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/x86/cpu_ucode_amd.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/x86/cpu_ucode_intel.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/xen/xen/xen_ucode.c
cvs rdiff -u -r1.58 -r1.59 src/sys/kern/kern_cpu.c
cvs rdiff -u -r1.36 -r1.37 src/sys/sys/cpu.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/include/cpu_ucode.h
diff -u src/sys/arch/x86/include/cpu_ucode.h:1.2 src/sys/arch/x86/include/cpu_ucode.h:1.3
--- src/sys/arch/x86/include/cpu_ucode.h:1.2 Wed Aug 29 17:13:22 2012
+++ src/sys/arch/x86/include/cpu_ucode.h Wed Oct 17 20:19:55 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.h,v 1.2 2012/08/29 17:13:22 drochner Exp $ */
+/* $NetBSD: cpu_ucode.h,v 1.3 2012/10/17 20:19:55 drochner Exp $ */
/*
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -48,8 +48,9 @@ struct cpu_ucode_version_intel1 {
#include <dev/firmload.h>
int cpu_ucode_amd_get_version(struct cpu_ucode_version *);
-/* XXX COMPAT */
+#ifdef COMPAT_60
int compat6_cpu_ucode_amd_get_version(struct compat6_cpu_ucode *);
+#endif
int cpu_ucode_amd_firmware_open(firmware_handle_t *, const char *);
int cpu_ucode_amd_apply(struct cpu_ucode_softc *, int);
Index: src/sys/arch/x86/x86/cpu_ucode.c
diff -u src/sys/arch/x86/x86/cpu_ucode.c:1.2 src/sys/arch/x86/x86/cpu_ucode.c:1.3
--- src/sys/arch/x86/x86/cpu_ucode.c:1.2 Wed Aug 29 17:13:22 2012
+++ src/sys/arch/x86/x86/cpu_ucode.c Wed Oct 17 20:19:55 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.c,v 1.2 2012/08/29 17:13:22 drochner Exp $ */
+/* $NetBSD: cpu_ucode.c,v 1.3 2012/10/17 20:19:55 drochner Exp $ */
/*
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,9 +29,10 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.2 2012/08/29 17:13:22 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.3 2012/10/17 20:19:55 drochner Exp $");
#include "opt_cpu_ucode.h"
+#include "opt_compat_netbsd.h"
#include <sys/param.h>
#include <sys/cpuio.h>
@@ -62,7 +63,7 @@ cpu_ucode_get_version(struct cpu_ucode_v
return 0;
}
-/* XXX COMPAT */
+#ifdef COMPAT_60
int
compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *data)
{
@@ -76,6 +77,7 @@ compat6_cpu_ucode_get_version(struct com
return 0;
}
+#endif
int
cpu_ucode_md_open(firmware_handle_t *fwh, int loader_version, const char *fwname)
@@ -120,7 +122,7 @@ cpu_ucode_apply(const struct cpu_ucode *
return error;
}
-/* XXX COMPAT */
+#ifdef COMPAT_60
int
compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *data)
{
@@ -143,3 +145,4 @@ compat6_cpu_ucode_apply(const struct com
sc->sc_blobsize = 0;
return error;
}
+#endif
Index: src/sys/arch/x86/x86/cpu_ucode_amd.c
diff -u src/sys/arch/x86/x86/cpu_ucode_amd.c:1.4 src/sys/arch/x86/x86/cpu_ucode_amd.c:1.5
--- src/sys/arch/x86/x86/cpu_ucode_amd.c:1.4 Wed Aug 29 17:13:22 2012
+++ src/sys/arch/x86/x86/cpu_ucode_amd.c Wed Oct 17 20:19:55 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode_amd.c,v 1.4 2012/08/29 17:13:22 drochner Exp $ */
+/* $NetBSD: cpu_ucode_amd.c,v 1.5 2012/10/17 20:19:55 drochner Exp $ */
/*
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,10 +29,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_amd.c,v 1.4 2012/08/29 17:13:22 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_amd.c,v 1.5 2012/10/17 20:19:55 drochner Exp $");
#include "opt_xen.h"
#include "opt_cpu_ucode.h"
+#include "opt_compat_netbsd.h"
#include <sys/param.h>
#include <sys/conf.h>
@@ -115,6 +116,7 @@ cpu_ucode_amd_get_version(struct cpu_uco
return copyout(&data, ucode->data, sizeof(data));
}
+#ifdef COMPAT_60
int
compat6_cpu_ucode_amd_get_version(struct compat6_cpu_ucode *ucode)
{
@@ -127,6 +129,7 @@ compat6_cpu_ucode_amd_get_version(struct
ucode->version = uclevel;
return 0;
}
+#endif
int
cpu_ucode_amd_firmware_open(firmware_handle_t *fwh, const char *fwname)
Index: src/sys/arch/x86/x86/cpu_ucode_intel.c
diff -u src/sys/arch/x86/x86/cpu_ucode_intel.c:1.1 src/sys/arch/x86/x86/cpu_ucode_intel.c:1.2
--- src/sys/arch/x86/x86/cpu_ucode_intel.c:1.1 Wed Aug 29 17:13:22 2012
+++ src/sys/arch/x86/x86/cpu_ucode_intel.c Wed Oct 17 20:19:55 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode_intel.c,v 1.1 2012/08/29 17:13:22 drochner Exp $ */
+/* $NetBSD: cpu_ucode_intel.c,v 1.2 2012/10/17 20:19:55 drochner Exp $ */
/*
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,10 +29,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.1 2012/08/29 17:13:22 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.2 2012/10/17 20:19:55 drochner Exp $");
#include "opt_xen.h"
#include "opt_cpu_ucode.h"
+#include "opt_compat_netbsd.h"
#include <sys/param.h>
#include <sys/conf.h>
Index: src/sys/arch/xen/xen/xen_ucode.c
diff -u src/sys/arch/xen/xen/xen_ucode.c:1.2 src/sys/arch/xen/xen/xen_ucode.c:1.3
--- src/sys/arch/xen/xen/xen_ucode.c:1.2 Wed Aug 29 17:13:22 2012
+++ src/sys/arch/xen/xen/xen_ucode.c Wed Oct 17 20:19:55 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_ucode.c,v 1.2 2012/08/29 17:13:22 drochner Exp $ */
+/* $NetBSD: xen_ucode.c,v 1.3 2012/10/17 20:19:55 drochner Exp $ */
/*
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,9 +29,10 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_ucode.c,v 1.2 2012/08/29 17:13:22 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_ucode.c,v 1.3 2012/10/17 20:19:55 drochner Exp $");
#include "opt_cpu_ucode.h"
+#include "opt_compat_netbsd.h"
#include <sys/param.h>
#include <sys/cpuio.h>
@@ -62,7 +63,7 @@ cpu_ucode_get_version(struct cpu_ucode_v
return 0;
}
-/* XXX COMPAT */
+#ifdef COMPAT_60
int
compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *data)
{
@@ -76,6 +77,7 @@ compat6_cpu_ucode_get_version(struct com
return 0;
}
+#endif
int
cpu_ucode_md_open(firmware_handle_t *fwh, int loader_version, const char *fwname)
@@ -119,6 +121,7 @@ cpu_ucode_apply(const struct cpu_ucode *
return error;
}
+#ifdef COMPAT_60
int
compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *data)
{
@@ -143,3 +146,4 @@ compat6_cpu_ucode_apply(const struct com
sc->sc_blobsize = 0;
return error;
}
+#endif
Index: src/sys/kern/kern_cpu.c
diff -u src/sys/kern/kern_cpu.c:1.58 src/sys/kern/kern_cpu.c:1.59
--- src/sys/kern/kern_cpu.c:1.58 Sat Sep 1 00:24:43 2012
+++ src/sys/kern/kern_cpu.c Wed Oct 17 20:19:55 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_cpu.c,v 1.58 2012/09/01 00:24:43 matt Exp $ */
+/* $NetBSD: kern_cpu.c,v 1.59 2012/10/17 20:19:55 drochner 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.58 2012/09/01 00:24:43 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.59 2012/10/17 20:19:55 drochner Exp $");
#include "opt_cpu_ucode.h"
#include "opt_compat_netbsd.h"
@@ -275,10 +275,11 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void
error = cpu_ucode_get_version((struct cpu_ucode_version *)data);
break;
- /* XXX ifdef COMPAT */
+#ifdef COMPAT_60
case OIOC_CPU_UCODE_GET_VERSION:
error = compat6_cpu_ucode_get_version((struct compat6_cpu_ucode *)data);
break;
+#endif
case IOC_CPU_UCODE_APPLY:
error = kauth_authorize_machdep(l->l_cred,
@@ -289,7 +290,7 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void
error = cpu_ucode_apply((const struct cpu_ucode *)data);
break;
- /* XXX ifdef COMPAT */
+#ifdef COMPAT_60
case OIOC_CPU_UCODE_APPLY:
error = kauth_authorize_machdep(l->l_cred,
KAUTH_MACHDEP_CPU_UCODE_APPLY,
@@ -299,6 +300,7 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void
error = compat6_cpu_ucode_apply((const struct compat6_cpu_ucode *)data);
break;
#endif
+#endif
default:
error = ENOTTY;
Index: src/sys/sys/cpu.h
diff -u src/sys/sys/cpu.h:1.36 src/sys/sys/cpu.h:1.37
--- src/sys/sys/cpu.h:1.36 Wed Aug 29 17:13:22 2012
+++ src/sys/sys/cpu.h Wed Oct 17 20:19:55 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.36 2012/08/29 17:13:22 drochner Exp $ */
+/* $NetBSD: cpu.h,v 1.37 2012/10/17 20:19:55 drochner Exp $ */
/*-
* Copyright (c) 2007 YAMAMOTO Takashi,
@@ -45,10 +45,10 @@ void cpu_idle(void);
#ifdef CPU_UCODE
#include <sys/cpuio.h>
#include <dev/firmload.h>
-
-/* XXX ifdef COMPAT */
+#ifdef COMPAT_60
#include <compat/sys/cpuio.h>
#endif
+#endif
/*
* cpu_need_resched() must always be called with the target CPU
@@ -120,11 +120,11 @@ struct cpu_ucode_softc {
};
int cpu_ucode_get_version(struct cpu_ucode_version *);
-/* XXX ifdef COMPAT */
-int compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *);
int cpu_ucode_apply(const struct cpu_ucode *);
-/* XXX ifdef COMPAT */
+#ifdef COMPAT_60
+int compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *);
int compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *);
+#endif
int cpu_ucode_load(struct cpu_ucode_softc *, const char *);
int cpu_ucode_md_open(firmware_handle_t *, int, const char *);
#endif