Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen dedup microcode handling.



details:   https://anonhg.NetBSD.org/src/rev/72e84f2c7440
branches:  trunk
changeset: 831251:72e84f2c7440
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Mar 17 20:03:01 2018 +0000

description:
dedup microcode handling.

diffstat:

 sys/arch/xen/conf/files.xen  |    4 +-
 sys/arch/xen/xen/xen_ucode.c |  160 -------------------------------------------
 2 files changed, 2 insertions(+), 162 deletions(-)

diffs (182 lines):

diff -r 0fe84405cfd6 -r 72e84f2c7440 sys/arch/xen/conf/files.xen
--- a/sys/arch/xen/conf/files.xen       Sat Mar 17 20:02:32 2018 +0000
+++ b/sys/arch/xen/conf/files.xen       Sat Mar 17 20:03:01 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.xen,v 1.166 2018/03/16 12:48:54 maxv Exp $
+#      $NetBSD: files.xen,v 1.167 2018/03/17 20:03:01 christos Exp $
 #      NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #      NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -92,7 +92,7 @@
 file   arch/xen/x86/xen_intr.c
 file   arch/xen/x86/xenfunc.c
 
-file   arch/xen/xen/xen_ucode.c        dom0ops & cpu_ucode needs-flag
+file   arch/x86/x86/cpu_ucode.c        dom0ops & cpu_ucode needs-flag
 file   arch/x86/x86/cpu_ucode_amd.c    dom0ops & cpu_ucode needs-flag
 file   arch/x86/x86/cpu_ucode_intel.c  dom0ops & cpu_ucode needs-flag
 
diff -r 0fe84405cfd6 -r 72e84f2c7440 sys/arch/xen/xen/xen_ucode.c
--- a/sys/arch/xen/xen/xen_ucode.c      Sat Mar 17 20:02:32 2018 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-/* $NetBSD: xen_ucode.c,v 1.6 2018/03/17 18:22:23 christos Exp $ */
-/*
- * Copyright (c) 2012 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christoph Egger.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_ucode.c,v 1.6 2018/03/17 18:22:23 christos Exp $");
-
-#include "opt_cpu_ucode.h"
-#include "opt_compat_netbsd.h"
-
-#include <sys/param.h>
-#include <sys/cpuio.h>
-#include <sys/cpu.h>
-
-#include <dev/firmload.h>
-
-#include <machine/cpuvar.h>
-#include <machine/cputypes.h>
-
-#include <x86/cpu_ucode.h>
-
-static struct cpu_ucode_softc ucode_softc;
-
-int
-cpu_ucode_get_version(struct cpu_ucode_version *data)
-{
-       union {
-               struct cpu_ucode_version_amd a;
-               struct cpu_ucode_version_intel1 i;
-       } v;
-       size_t l;
-       int error;
-
-       if (!data->data)
-               return 0;
-
-       switch (cpu_vendor) {
-       case CPUVENDOR_AMD:
-               error = cpu_ucode_amd_get_version(data, &v, l = sizeof(v.a));
-       case CPUVENDOR_INTEL:
-               error = cpu_ucode_intel_get_version(data, &v, l = sizeof(v.i));
-       default:
-               return EOPNOTSUPP;
-       }
-
-       if (error)
-               return error;
-
-       return copyout(&v, data->data, l);
-}
-
-int
-cpu_ucode_md_open(firmware_handle_t *fwh, int loader_version, const char *fwname)
-{
-       switch (cpu_vendor) {
-       case CPUVENDOR_AMD:
-               return cpu_ucode_amd_firmware_open(fwh, fwname);
-       case CPUVENDOR_INTEL:
-               return cpu_ucode_intel_firmware_open(fwh, fwname);
-       default:
-               return EOPNOTSUPP;
-       }
-}
-
-int
-cpu_ucode_apply(const struct cpu_ucode *data)
-{
-       struct cpu_ucode_softc *sc = &ucode_softc;
-       struct xen_platform_op op;
-       int error;
-
-       /* Xen updates all??? */
-       if (data->cpu_nr != CPU_UCODE_ALL_CPUS)
-               return EOPNOTSUPP;
-
-       sc->loader_version = data->loader_version;
-       error = cpu_ucode_load(sc, data->fwname);
-       if (error)
-               return error;
-
-       op.cmd = XENPF_microcode_update;
-       set_xen_guest_handle(op.u.microcode.data, sc->sc_blob);
-       op.u.microcode.length = sc->sc_blobsize;
-
-       error = -HYPERVISOR_platform_op(&op);
-
-       if (sc->sc_blob)
-               firmware_free(sc->sc_blob, sc->sc_blobsize);
-       sc->sc_blob = NULL;
-       sc->sc_blobsize = 0;
-       return error;
-}
-
-#ifdef COMPAT_60
-int
-compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *data)
-{
-       struct cpu_ucode_version ndata;
-
-       switch (cpu_vendor) {
-       case CPUVENDOR_AMD:
-               ndata.loader_version = CPU_UCODE_LOADER_AMD;
-               return cpu_ucode_amd_get_version(&ndata, &data->version,
-                   sizeof(data->version));
-       default:
-               return EOPNOTSUPP;
-       }
-}
-
-int
-compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *data)
-{
-       struct cpu_ucode_softc *sc = &ucode_softc;
-       struct xen_platform_op op;
-       int error;
-
-       sc->loader_version = CPU_UCODE_LOADER_AMD;
-       error = cpu_ucode_load(sc, data->fwname);
-       if (error)
-               return error;
-
-       op.cmd = XENPF_microcode_update;
-       set_xen_guest_handle(op.u.microcode.data, sc->sc_blob);
-       op.u.microcode.length = sc->sc_blobsize;
-
-       error = -HYPERVISOR_platform_op(&op);
-
-       if (sc->sc_blob != NULL)
-               firmware_free(sc->sc_blob, sc->sc_blobsize);
-       sc->sc_blob = NULL;
-       sc->sc_blobsize = 0;
-       return error;
-}
-#endif /* COMPAT_60 */



Home | Main Index | Thread Index | Old Index