Source-Changes-HG archive

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

[src/trunk]: src/sys put binary compatibility support for the old AMD-only CP...



details:   https://anonhg.NetBSD.org/src/rev/d84d77130dd5
branches:  trunk
changeset: 782131:d84d77130dd5
user:      drochner <drochner%NetBSD.org@localhost>
date:      Wed Oct 17 20:19:55 2012 +0000

description:
put binary compatibility support for the old AMD-only CPU microcode
update API inside COMPAT_60

diffstat:

 sys/arch/x86/include/cpu_ucode.h   |   5 +++--
 sys/arch/x86/x86/cpu_ucode.c       |  11 +++++++----
 sys/arch/x86/x86/cpu_ucode_amd.c   |   7 +++++--
 sys/arch/x86/x86/cpu_ucode_intel.c |   5 +++--
 sys/arch/xen/xen/xen_ucode.c       |  10 +++++++---
 sys/kern/kern_cpu.c                |  10 ++++++----
 sys/sys/cpu.h                      |  12 ++++++------
 7 files changed, 37 insertions(+), 23 deletions(-)

diffs (268 lines):

diff -r 731eaa81e59d -r d84d77130dd5 sys/arch/x86/include/cpu_ucode.h
--- a/sys/arch/x86/include/cpu_ucode.h  Wed Oct 17 20:18:55 2012 +0000
+++ b/sys/arch/x86/include/cpu_ucode.h  Wed Oct 17 20:19:55 2012 +0000
@@ -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 @@
 #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);
 
diff -r 731eaa81e59d -r d84d77130dd5 sys/arch/x86/x86/cpu_ucode.c
--- a/sys/arch/x86/x86/cpu_ucode.c      Wed Oct 17 20:18:55 2012 +0000
+++ b/sys/arch/x86/x86/cpu_ucode.c      Wed Oct 17 20:19:55 2012 +0000
@@ -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 @@
        return 0;
 }
 
-/* XXX COMPAT */
+#ifdef COMPAT_60
 int
 compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *data)
 {
@@ -76,6 +77,7 @@
 
        return 0;
 }
+#endif
 
 int
 cpu_ucode_md_open(firmware_handle_t *fwh, int loader_version, const char *fwname)
@@ -120,7 +122,7 @@
        return error;
 }
 
-/* XXX COMPAT */
+#ifdef COMPAT_60
 int
 compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *data)
 {
@@ -143,3 +145,4 @@
        sc->sc_blobsize = 0;
        return error;
 }
+#endif
diff -r 731eaa81e59d -r d84d77130dd5 sys/arch/x86/x86/cpu_ucode_amd.c
--- a/sys/arch/x86/x86/cpu_ucode_amd.c  Wed Oct 17 20:18:55 2012 +0000
+++ b/sys/arch/x86/x86/cpu_ucode_amd.c  Wed Oct 17 20:19:55 2012 +0000
@@ -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 @@
        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 @@
        ucode->version = uclevel;
        return 0;
 }
+#endif
 
 int
 cpu_ucode_amd_firmware_open(firmware_handle_t *fwh, const char *fwname)
diff -r 731eaa81e59d -r d84d77130dd5 sys/arch/x86/x86/cpu_ucode_intel.c
--- a/sys/arch/x86/x86/cpu_ucode_intel.c        Wed Oct 17 20:18:55 2012 +0000
+++ b/sys/arch/x86/x86/cpu_ucode_intel.c        Wed Oct 17 20:19:55 2012 +0000
@@ -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>
diff -r 731eaa81e59d -r d84d77130dd5 sys/arch/xen/xen/xen_ucode.c
--- a/sys/arch/xen/xen/xen_ucode.c      Wed Oct 17 20:18:55 2012 +0000
+++ b/sys/arch/xen/xen/xen_ucode.c      Wed Oct 17 20:19:55 2012 +0000
@@ -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 @@
        return 0;
 }
 
-/* XXX COMPAT */
+#ifdef COMPAT_60
 int
 compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *data)
 {
@@ -76,6 +77,7 @@
 
        return 0;
 }
+#endif
 
 int
 cpu_ucode_md_open(firmware_handle_t *fwh, int loader_version, const char *fwname)
@@ -119,6 +121,7 @@
        return error;
 }
 
+#ifdef COMPAT_60
 int
 compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *data)
 {
@@ -143,3 +146,4 @@
        sc->sc_blobsize = 0;
        return error;
 }
+#endif
diff -r 731eaa81e59d -r d84d77130dd5 sys/kern/kern_cpu.c
--- a/sys/kern/kern_cpu.c       Wed Oct 17 20:18:55 2012 +0000
+++ b/sys/kern/kern_cpu.c       Wed Oct 17 20:19:55 2012 +0000
@@ -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 @@
                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 @@
                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 @@
                error = compat6_cpu_ucode_apply((const struct compat6_cpu_ucode *)data);
                break;
 #endif
+#endif
 
        default:
                error = ENOTTY;
diff -r 731eaa81e59d -r d84d77130dd5 sys/sys/cpu.h
--- a/sys/sys/cpu.h     Wed Oct 17 20:18:55 2012 +0000
+++ b/sys/sys/cpu.h     Wed Oct 17 20:19:55 2012 +0000
@@ -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 @@
 #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 @@
 };
 
 int cpu_ucode_get_version(struct cpu_ucode_version *);
-/* XXX ifdef COMPAT */
+int cpu_ucode_apply(const struct cpu_ucode *);
+#ifdef COMPAT_60
 int compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *);
-int cpu_ucode_apply(const struct cpu_ucode *);
-/* XXX ifdef COMPAT */
 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



Home | Main Index | Thread Index | Old Index