Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/arch/x86 Pull up following revision(s) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/c9ccdfe300e0
branches:  netbsd-9
changeset: 963368:c9ccdfe300e0
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Dec 08 13:09:28 2019 +0000

description:
Pull up following revision(s) (requested by nonaka in ticket #502):
        sys/arch/x86/x86/hyperv.c: revision 1.5
        sys/arch/x86/include/genfb_machdep.h: revision 1.4
        sys/arch/x86/x86/genfb_machdep.c: revision 1.15
Prevent panic when attaching genfb if using a serial console with Hyper-V Gen.2.

diffstat:

 sys/arch/x86/include/genfb_machdep.h |   3 +-
 sys/arch/x86/x86/genfb_machdep.c     |  45 +++++++++++++++++++++++++++--------
 sys/arch/x86/x86/hyperv.c            |   9 ++++--
 3 files changed, 42 insertions(+), 15 deletions(-)

diffs (142 lines):

diff -r 883043669492 -r c9ccdfe300e0 sys/arch/x86/include/genfb_machdep.h
--- a/sys/arch/x86/include/genfb_machdep.h      Sun Dec 08 13:06:37 2019 +0000
+++ b/sys/arch/x86/include/genfb_machdep.h      Sun Dec 08 13:09:28 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_machdep.h,v 1.3 2011/02/09 13:24:23 jmcneill Exp $ */
+/* $NetBSD: genfb_machdep.h,v 1.3.60.1 2019/12/08 13:09:28 martin Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,6 +29,7 @@
 #ifndef _X86_GENFB_MACHDEP_H
 #define _X86_GENFB_MACHDEP_H
 
+int    x86_genfb_init(void);
 int    x86_genfb_cnattach(void);
 void   x86_genfb_mtrr_init(uint64_t, uint32_t);
 void   x86_genfb_set_console_dev(device_t);
diff -r 883043669492 -r c9ccdfe300e0 sys/arch/x86/x86/genfb_machdep.c
--- a/sys/arch/x86/x86/genfb_machdep.c  Sun Dec 08 13:06:37 2019 +0000
+++ b/sys/arch/x86/x86/genfb_machdep.c  Sun Dec 08 13:09:28 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_machdep.c,v 1.13 2019/05/19 07:43:17 mlelstv Exp $ */
+/* $NetBSD: genfb_machdep.c,v 1.13.2.1 2019/12/08 13:09:28 martin Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.13 2019/05/19 07:43:17 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.13.2.1 2019/12/08 13:09:28 martin Exp $");
 
 #include "opt_mtrr.h"
 
@@ -136,23 +136,19 @@
 }
 
 int
-x86_genfb_cnattach(void)
+x86_genfb_init(void)
 {
-       static int ncalls = 0;
+       static int inited, attached;
        struct rasops_info *ri = &x86_genfb_console_screen.scr_ri;
        const struct btinfo_framebuffer *fbinfo;
        bus_space_tag_t t = x86_bus_space_mem;
        bus_space_handle_t h;
        void *bits;
-       long defattr;
        int err;
 
-       /* XXX jmcneill
-        *  Defer console initialization until UVM is initialized
-        */
-       ++ncalls;
-       if (ncalls < 3)
-               return -1;
+       if (inited)
+               return attached;
+       inited = 1;
 
        memset(&x86_genfb_console_screen, 0, sizeof(x86_genfb_console_screen));
 
@@ -206,6 +202,27 @@
        x86_genfb_stdscreen.textops = &ri->ri_ops;
        x86_genfb_stdscreen.capabilities = ri->ri_caps;
 
+       attached = 1;
+       return 1;
+}
+
+int
+x86_genfb_cnattach(void)
+{
+       static int ncalls = 0;
+       struct rasops_info *ri = &x86_genfb_console_screen.scr_ri;
+       long defattr;
+
+       /* XXX jmcneill
+        *  Defer console initialization until UVM is initialized
+        */
+       ++ncalls;
+       if (ncalls < 3)
+               return -1;
+
+       if (!x86_genfb_init())
+               return 0;
+
        ri->ri_ops.allocattr(ri, 0, 0, 0, &defattr);
        wsdisplay_preattach(&x86_genfb_stdscreen, ri, 0, 0, defattr);
 
@@ -213,6 +230,12 @@
 }
 #else  /* NWSDISPLAY > 0 && NGENFB > 0 */
 int
+x86_genfb_init(void)
+{
+       return 0;
+}
+
+int
 x86_genfb_cnattach(void)
 {
        return 0;
diff -r 883043669492 -r c9ccdfe300e0 sys/arch/x86/x86/hyperv.c
--- a/sys/arch/x86/x86/hyperv.c Sun Dec 08 13:06:37 2019 +0000
+++ b/sys/arch/x86/x86/hyperv.c Sun Dec 08 13:09:28 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hyperv.c,v 1.4 2019/06/03 09:51:04 nonaka Exp $        */
+/*     $NetBSD: hyperv.c,v 1.4.4.1 2019/12/08 13:09:28 martin Exp $    */
 
 /*-
  * Copyright (c) 2009-2012,2016-2017 Microsoft Corp.
@@ -33,7 +33,7 @@
  */
 #include <sys/cdefs.h>
 #ifdef __KERNEL_RCSID
-__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.4 2019/06/03 09:51:04 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.4.4.1 2019/12/08 13:09:28 martin Exp $");
 #endif
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/sys/dev/hyperv/vmbus/hyperv.c 331757 2018-03-30 02:25:12Z emaste $");
@@ -70,7 +70,7 @@
 #include <x86/efi.h>
 
 #include <dev/wsfb/genfbvar.h>
-#include <arch/x86/include/genfb_machdep.h>
+#include <x86/genfb_machdep.h>
 
 #include <x86/x86/hypervreg.h>
 #include <x86/x86/hypervvar.h>
@@ -1103,6 +1103,9 @@
                    sizeof(*aa->aa_type)) == 0) {
                        prop_dictionary_t dict = device_properties(dev);
 
+                       /* Initialize genfb for serial console */
+                       x86_genfb_init();
+
                        /*
                         * framebuffer drivers other than genfb can work
                         * without the address property



Home | Main Index | Thread Index | Old Index