Source-Changes-HG archive

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

[src/netbsd-8]: src/sys Missing files from commit for ticket #1280:



details:   https://anonhg.NetBSD.org/src/rev/e8e1f260c6fb
branches:  netbsd-8
changeset: 451941:e8e1f260c6fb
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Jun 12 11:35:40 2019 +0000

description:
Missing files from commit for ticket #1280:

        sys/arch/x86/x86/hypervvar.h: revision 1.1
        sys/dev/hyperv/genfb_vmbus.c: revision 1.1
        sys/dev/hyperv/genfb_vmbusvar.h: revision 1.1
        sys/dev/hyperv/hvkbd.c: revision 1.1
        sys/dev/hyperv/hvkbdvar.h: revision 1.1

Added drivers for Hyper-V Synthetic Keyboard and Video device.

Avoid undefined reference to `hyperv_guid_video' without vmbus(4).

Avoid undefined reference to `hyperv_is_gen1' without hyperv(4).

Use efi_probe().

diffstat:

 sys/arch/x86/x86/hypervvar.h    |   39 ++-
 sys/dev/hyperv/genfb_vmbus.c    |  162 +++++++++-
 sys/dev/hyperv/genfb_vmbusvar.h |   42 ++-
 sys/dev/hyperv/hvkbd.c          |  648 +++++++++++++++++++++++++++++++++++++++-
 sys/dev/hyperv/hvkbdvar.h       |   10 +-
 5 files changed, 894 insertions(+), 7 deletions(-)

diffs (truncated from 970 to 300 lines):

diff -r 69295ce999c2 -r e8e1f260c6fb sys/arch/x86/x86/hypervvar.h
--- a/sys/arch/x86/x86/hypervvar.h      Wed Jun 12 10:40:13 2019 +0000
+++ b/sys/arch/x86/x86/hypervvar.h      Wed Jun 12 11:35:40 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hypervvar.h,v 1.1.4.2 2019/06/12 10:17:32 martin Exp $ */
+/*     $NetBSD: hypervvar.h,v 1.1.4.3 2019/06/12 11:35:40 martin Exp $ */
 
 /*-
  * Copyright (c) 2009-2012,2016 Microsoft Corp.
@@ -35,3 +35,40 @@
 device_t       device_hyperv_register(device_t, void *);
 
 #endif /* _X86_HYPERVVAR_H_ */
+/*     $NetBSD: hypervvar.h,v 1.1.4.3 2019/06/12 11:35:40 martin Exp $ */
+
+/*-
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
+ * Copyright (c) 2012 NetApp Inc.
+ * Copyright (c) 2012 Citrix Inc.
+ * All rights reserved.
+ *
+ * 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 unmodified, 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 AUTHOR ``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 AUTHOR 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.
+ */
+
+#ifndef _X86_HYPERVVAR_H_
+#define _X86_HYPERVVAR_H_
+
+void           hyperv_early_init(void);
+device_t       device_hyperv_register(device_t, void *);
+
+#endif /* _X86_HYPERVVAR_H_ */
diff -r 69295ce999c2 -r e8e1f260c6fb sys/dev/hyperv/genfb_vmbus.c
--- a/sys/dev/hyperv/genfb_vmbus.c      Wed Jun 12 10:40:13 2019 +0000
+++ b/sys/dev/hyperv/genfb_vmbus.c      Wed Jun 12 11:35:40 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: genfb_vmbus.c,v 1.1.4.2 2019/06/12 10:17:32 martin Exp $       */
+/*     $NetBSD: genfb_vmbus.c,v 1.1.4.3 2019/06/12 11:35:40 martin Exp $       */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb_vmbus.c,v 1.1.4.2 2019/06/12 10:17:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_vmbus.c,v 1.1.4.3 2019/06/12 11:35:40 martin Exp $");
 
 #include "opt_wsfb.h"
 #include "opt_genfb.h"
@@ -156,3 +156,161 @@
        genfb_enable_polling(self);
        return true;
 }
+/*     $NetBSD: genfb_vmbus.c,v 1.1.4.3 2019/06/12 11:35:40 martin Exp $       */
+
+/*-
+ * Copyright (c) 2007 Michael Lorenz
+ * All rights reserved.
+ *
+ * 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: genfb_vmbus.c,v 1.1.4.3 2019/06/12 11:35:40 martin Exp $");
+
+#include "opt_wsfb.h"
+#include "opt_genfb.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/proc.h>
+#include <sys/mutex.h>
+#include <sys/ioctl.h>
+#include <sys/systm.h>
+#include <sys/kauth.h>
+
+#include <dev/wsfb/genfbvar.h>
+
+#include <dev/hyperv/vmbusvar.h>
+#include <dev/hyperv/genfb_vmbusvar.h>
+
+static int     genfb_vmbus_match(device_t, cfdata_t, void *);
+static void    genfb_vmbus_attach(device_t, device_t, void *);
+static int     genfb_vmbus_ioctl(void *, void *, u_long, void *, int,
+                   struct lwp *);
+static paddr_t genfb_vmbus_mmap(void *, void *, off_t, int);
+static int     genfb_vmbus_drm_print(void *, const char *);
+static bool    genfb_vmbus_shutdown(device_t, int);
+
+CFATTACH_DECL_NEW(genfb_vmbus, sizeof(struct genfb_vmbus_softc),
+    genfb_vmbus_match, genfb_vmbus_attach, NULL, NULL);
+
+static int
+genfb_vmbus_match(device_t parent, cfdata_t match, void *aux)
+{
+       struct vmbus_attach_args *aa = aux;
+
+       if (memcmp(aa->aa_type, &hyperv_guid_video, sizeof(*aa->aa_type)) != 0)
+               return 0;
+
+       if (!genfb_is_enabled())
+               return 0;       /* explicitly disabled by MD code */
+
+       /* Use genfb(4) at pci in Gen.1 VM. */
+       if (hyperv_is_gen1())
+               return 0;
+
+       return 1;
+}
+
+static void
+genfb_vmbus_attach(device_t parent, device_t self, void *aux)
+{
+       static const struct genfb_ops zero_ops;
+       struct genfb_vmbus_softc *sc = device_private(self);
+       struct vmbus_attach_args *aa = aux;
+       struct genfb_ops ops = zero_ops;
+
+       aprint_naive("\n");
+       aprint_normal(": Hyper-V Synthetic Video\n");
+
+       sc->sc_gen.sc_dev = self;
+       sc->sc_memt = aa->aa_memt;
+
+       genfb_init(&sc->sc_gen);
+
+       /* firmware / MD code responsible for restoring the display */
+       if (sc->sc_gen.sc_pmfcb == NULL)
+               pmf_device_register1(self, NULL, NULL,
+                   genfb_vmbus_shutdown);
+       else
+               pmf_device_register1(self,
+                   sc->sc_gen.sc_pmfcb->gpc_suspend,
+                   sc->sc_gen.sc_pmfcb->gpc_resume,
+                   genfb_vmbus_shutdown);
+
+       if ((sc->sc_gen.sc_width == 0) || (sc->sc_gen.sc_fbsize == 0)) {
+               aprint_debug_dev(self, "not configured by firmware\n");
+               return;
+       }
+
+       ops.genfb_ioctl = genfb_vmbus_ioctl;
+       ops.genfb_mmap = genfb_vmbus_mmap;
+
+       if (genfb_attach(&sc->sc_gen, &ops) != 0)
+               return;
+
+       /* now try to attach a DRM */
+       config_found_ia(self, "drm", aux, genfb_vmbus_drm_print);
+}
+
+static int
+genfb_vmbus_drm_print(void *aux, const char *pnp)
+{
+
+       if (pnp)
+               aprint_normal("drm at %s", pnp);
+       return UNCONF;
+}
+
+static int
+genfb_vmbus_ioctl(void *v, void *vs, u_long cmd, void *data, int flag,
+    struct lwp *l)
+{
+
+       switch (cmd) {
+       case WSDISPLAYIO_GTYPE:
+               *(u_int *)data = WSDISPLAY_TYPE_GENFB;
+               return 0;
+       }
+
+       return EPASSTHROUGH;
+}
+
+static paddr_t
+genfb_vmbus_mmap(void *v, void *vs, off_t offset, int prot)
+{
+       struct genfb_vmbus_softc *sc = v;
+
+       return bus_space_mmap(sc->sc_memt, sc->sc_gen.sc_fboffset, offset, prot,
+           BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE);
+}
+
+static bool
+genfb_vmbus_shutdown(device_t self, int flags)
+{
+
+       genfb_enable_polling(self);
+       return true;
+}
diff -r 69295ce999c2 -r e8e1f260c6fb sys/dev/hyperv/genfb_vmbusvar.h
--- a/sys/dev/hyperv/genfb_vmbusvar.h   Wed Jun 12 10:40:13 2019 +0000
+++ b/sys/dev/hyperv/genfb_vmbusvar.h   Wed Jun 12 11:35:40 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: genfb_vmbusvar.h,v 1.1.4.2 2019/06/12 10:17:32 martin Exp $    */
+/*     $NetBSD: genfb_vmbusvar.h,v 1.1.4.3 2019/06/12 11:35:40 martin Exp $    */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -38,3 +38,43 @@
 };
 
 #endif /* _DEV_HYPERV_GENFB_VMBUSVAR_H_ */
+/*     $NetBSD: genfb_vmbusvar.h,v 1.1.4.3 2019/06/12 11:35:40 martin Exp $    */
+
+/*-
+ * Copyright (c) 2007 Michael Lorenz
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#ifndef _DEV_HYPERV_GENFB_VMBUSVAR_H_
+#define _DEV_HYPERV_GENFB_VMBUSVAR_H_
+
+#include <dev/wsfb/genfbvar.h>
+
+struct genfb_vmbus_softc {
+       struct genfb_softc      sc_gen;
+
+       bus_space_tag_t         sc_memt;
+};
+
+#endif /* _DEV_HYPERV_GENFB_VMBUSVAR_H_ */
diff -r 69295ce999c2 -r e8e1f260c6fb sys/dev/hyperv/hvkbd.c
--- a/sys/dev/hyperv/hvkbd.c    Wed Jun 12 10:40:13 2019 +0000
+++ b/sys/dev/hyperv/hvkbd.c    Wed Jun 12 11:35:40 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hvkbd.c,v 1.1.4.2 2019/06/12 10:17:32 martin Exp $     */
+/*     $NetBSD: hvkbd.c,v 1.1.4.3 2019/06/12 11:35:40 martin Exp $     */
 
 /*-
  * Copyright (c) 2017 Microsoft Corp.
@@ -36,7 +36,7 @@
 #endif /* _KERNEL_OPT */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.1.4.2 2019/06/12 10:17:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.1.4.3 2019/06/12 11:35:40 martin Exp $");
 
 #include <sys/param.h>



Home | Main Index | Thread Index | Old Index