Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen Add vga display support.



details:   https://anonhg.NetBSD.org/src/rev/2456ee842000
branches:  trunk
changeset: 565978:2456ee842000
user:      cl <cl%NetBSD.org@localhost>
date:      Sat Apr 24 20:58:59 2004 +0000

description:
Add vga display support.

diffstat:

 sys/arch/xen/conf/GENERIC         |    7 +-
 sys/arch/xen/conf/XEN             |    5 +-
 sys/arch/xen/conf/files.compat    |    5 +-
 sys/arch/xen/conf/files.xen       |   10 ++-
 sys/arch/xen/include/vga_xenvar.h |   49 ++++++++++++++
 sys/arch/xen/xen/hypervisor.c     |   20 +++++-
 sys/arch/xen/xen/vga_xen.c        |  132 ++++++++++++++++++++++++++++++++++++++
 7 files changed, 216 insertions(+), 12 deletions(-)

diffs (truncated from 343 to 300 lines):

diff -r fda845b07a2c -r 2456ee842000 sys/arch/xen/conf/GENERIC
--- a/sys/arch/xen/conf/GENERIC Sat Apr 24 20:54:26 2004 +0000
+++ b/sys/arch/xen/conf/GENERIC Sat Apr 24 20:58:59 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.5 2004/04/24 20:05:49 cl Exp $
+# $NetBSD: GENERIC,v 1.6 2004/04/24 20:58:59 cl Exp $
 # NetBSD: GENERIC,v 1.596 2004/04/07 13:13:59 augustss Exp 
 #
 # GENERIC machine description file
@@ -23,7 +23,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.5 $"
+#ident                 "GENERIC-$Revision: 1.6 $"
 
 maxusers       32              # estimated number of users
 
@@ -210,6 +210,9 @@
 sd*            at hypervisor?          # Xen vbd (sd identity)
 cd*            at hypervisor?          # Xen vbd (cd identity)
 
+vga*           at hypervisor?          # Xen VGA display
+wsdisplay*     at vga? console ?
+
 
 # Pull in optional local configuration
 include        "arch/xen/conf/GENERIC.local"
diff -r fda845b07a2c -r 2456ee842000 sys/arch/xen/conf/XEN
--- a/sys/arch/xen/conf/XEN     Sat Apr 24 20:54:26 2004 +0000
+++ b/sys/arch/xen/conf/XEN     Sat Apr 24 20:58:59 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: XEN,v 1.5 2004/04/24 20:05:49 cl Exp $
+# $NetBSD: XEN,v 1.6 2004/04/24 20:58:59 cl Exp $
 
 include        "arch/xen/conf/std.xen"
 
@@ -127,6 +127,9 @@
 sd*            at hypervisor?          # Xen vbd (sd identity)
 cd*            at hypervisor?          # Xen vbd (cd identity)
 
+vga*           at hypervisor?          # Xen VGA display
+wsdisplay*     at vga? console ?
+
 
 include        "arch/xen/conf/GENERIC.local"
 
diff -r fda845b07a2c -r 2456ee842000 sys/arch/xen/conf/files.compat
--- a/sys/arch/xen/conf/files.compat    Sat Apr 24 20:54:26 2004 +0000
+++ b/sys/arch/xen/conf/files.compat    Sat Apr 24 20:58:59 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.compat,v 1.1 2004/03/11 21:44:08 cl Exp $
+#      $NetBSD: files.compat,v 1.2 2004/04/24 20:58:59 cl Exp $
 #      NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 
 # options for MP configuration through the MP spec
@@ -58,6 +58,3 @@
 
 # kernel stack debug
 defflag        opt_kstack_dr0.h                XXXKSTACK_CHECK_DR0
-
-# compat linux #include wsdisplay.h
-defparam wsdisplay.h                   XXXWSDISPLAY
diff -r fda845b07a2c -r 2456ee842000 sys/arch/xen/conf/files.xen
--- a/sys/arch/xen/conf/files.xen       Sat Apr 24 20:54:26 2004 +0000
+++ b/sys/arch/xen/conf/files.xen       Sat Apr 24 20:58:59 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.xen,v 1.8 2004/04/24 20:05:49 cl Exp $
+#      $NetBSD: files.xen,v 1.9 2004/04/24 20:58:59 cl 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 
 
@@ -120,8 +120,8 @@
 attach xencons at hypervisor
 file   arch/xen/xen/xencons.c          xencons needs-flag
 
-#include       "dev/wscons/files.wscons"
-#include       "dev/wsfont/files.wsfont"
+include        "dev/wscons/files.wscons"
+include        "dev/wsfont/files.wsfont"
 
 # CPUS
 
@@ -212,4 +212,8 @@
 attach cd at hypervisor
 
 
+# Generic VGA
+attach vga at hypervisor with vga_xen
+file   arch/xen/xen/vga_xen.c          vga_xen         needs-flag
+
 include "arch/xen/conf/majors.i386"
diff -r fda845b07a2c -r 2456ee842000 sys/arch/xen/include/vga_xenvar.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/xen/include/vga_xenvar.h Sat Apr 24 20:58:59 2004 +0000
@@ -0,0 +1,49 @@
+/* $NetBSD: vga_xenvar.h,v 1.1 2004/04/24 20:58:59 cl Exp $ */
+
+/*
+ *
+ * Copyright (c) 2004 Christian Limpach.
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christian Limpach.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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 _XEN_VGA_XENVAR_H_
+#define _XEN_VGA_XENVAR_H_
+
+struct xen_vga_attach_args {
+       const char              *xa_device;
+       bus_space_tag_t         xa_iot;
+       bus_space_tag_t         xa_memt;
+};
+
+int vga_xen_cnattach(bus_space_tag_t, bus_space_tag_t);
+
+#endif /* _XEN_VGA_XENVAR_H_ */
+
+
+
diff -r fda845b07a2c -r 2456ee842000 sys/arch/xen/xen/hypervisor.c
--- a/sys/arch/xen/xen/hypervisor.c     Sat Apr 24 20:54:26 2004 +0000
+++ b/sys/arch/xen/xen/hypervisor.c     Sat Apr 24 20:58:59 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.2 2004/04/24 18:24:14 cl Exp $ */
+/* $NetBSD: hypervisor.c,v 1.3 2004/04/24 20:58:59 cl Exp $ */
 
 /*
  *
@@ -33,7 +33,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.2 2004/04/24 18:24:14 cl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.3 2004/04/24 20:58:59 cl Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -42,6 +42,7 @@
 #include "xencons.h"
 #include "xennet.h"
 #include "xbd.h"
+#include "vga_xen.h"
 #include "npx.h"
 
 #include "opt_xen.h"
@@ -63,6 +64,11 @@
 #include <machine/xbdvar.h>
 #endif
 
+#if NVGA_XEN > 0
+#include <machine/bus.h>
+#include <machine/vga_xenvar.h>
+#endif
+
 int    hypervisor_match(struct device *, struct cfdata *, void *);
 void   hypervisor_attach(struct device *, struct device *, void *);
 
@@ -73,6 +79,9 @@
 
 union hypervisor_attach_cookie {
        const char *hac_device;         /* first elem of all */
+#if NVGA_XEN > 0
+       struct xen_vga_attach_args hac_vga_xen;
+#endif
 #if NXENCONS > 0
        struct xencons_attach_args hac_xencons;
 #endif
@@ -116,6 +125,13 @@
 
        printf("\n");
 
+#if NVGA_XEN > 0
+       hac.hac_vga_xen.xa_device = "vga_xen";
+       hac.hac_vga_xen.xa_iot = X86_BUS_SPACE_IO;
+       hac.hac_vga_xen.xa_memt = X86_BUS_SPACE_MEM;
+       config_found(self, &hac.hac_vga_xen, hypervisor_print);
+#endif
+
 #if NXENCONS > 0
        hac.hac_xencons.xa_device = "xencons";
        config_found(self, &hac.hac_xencons, hypervisor_print);
diff -r fda845b07a2c -r 2456ee842000 sys/arch/xen/xen/vga_xen.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/xen/xen/vga_xen.c        Sat Apr 24 20:58:59 2004 +0000
@@ -0,0 +1,132 @@
+/* $NetBSD: vga_xen.c,v 1.1 2004/04/24 20:58:59 cl Exp $ */
+
+/*
+ *
+ * Copyright (c) 2004 Christian Limpach.
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christian Limpach.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * 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.
+ */
+
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: vga_xen.c,v 1.1 2004/04/24 20:58:59 cl Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+
+#include <machine/bus.h>
+
+#include <dev/ic/mc6845reg.h>
+#include <dev/ic/pcdisplayvar.h>
+#include <dev/ic/vgareg.h>
+#include <dev/ic/vgavar.h>
+#include <machine/vga_xenvar.h>
+
+#include <dev/isa/isareg.h>    /* For legacy VGA address ranges */
+
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wsdisplayvar.h>
+
+struct vga_xen_softc {
+       struct vga_softc sc_vga;
+};
+
+int    vga_xen_match(struct device *, struct cfdata *, void *);
+void   vga_xen_attach(struct device *, struct device *, void *);
+
+CFATTACH_DECL(vga_xen, sizeof(struct vga_xen_softc),
+    vga_xen_match, vga_xen_attach, NULL, NULL);
+
+paddr_t        vga_xen_mmap(void *, off_t, int);
+
+const struct vga_funcs vga_xen_funcs = {
+       NULL,
+       vga_xen_mmap,
+};
+
+int
+vga_xen_match(struct device *parent, struct cfdata *match, void *aux)
+{
+       struct xen_vga_attach_args *xa = aux;
+
+       if (strcmp(xa->xa_device, "vga_xen"))
+               return 0;
+
+       /* If it's the console, we have a winner! */
+       if (vga_is_console(xa->xa_iot, WSDISPLAY_TYPE_PCIVGA))
+               return (1);
+
+       /*
+        * If we might match, make sure that the card actually looks OK.
+        */
+       if (!vga_common_probe(xa->xa_iot, xa->xa_memt))



Home | Main Index | Thread Index | Old Index