NetBSD-Bugs archive

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

kern/48705: i915drmkms(4): Do not attach console unconditionally.



>Number:         48705
>Category:       kern
>Synopsis:       i915drmkms(4): Do not attach console unconditionally.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 04 13:50:00 +0000 2014
>Originator:     NONAKA Kimihiro
>Release:        6.99.39
>Organization:
>Environment:
NetBSD koharu.myhome.local 6.99.39 NetBSD 6.99.39 (KOHARU) #2230: Fri Apr  4 
21:13:54 JST 2014  
nonaka@koharu.myhome.local:/usr/obj.amd64/sys/arch/amd64/compile/KOHARU amd64
>Description:
I seem to i915drmkms(4) do not consider that the serial console.
>How-To-Repeat:
code inspection
>Fix:
Apply following patch.

diff -uNr sys/external/bsd/drm2/i915drm/i915_pci.c.orig 
sys/external/bsd/drm2/i915drm/i915_pci.c
--- sys/external/bsd/drm2/i915drm/i915_pci.c.orig       2014-04-04 
22:09:45.000000000 +0900
+++ sys/external/bsd/drm2/i915drm/i915_pci.c    2014-04-04 22:12:37.000000000 
+0900
@@ -32,6 +32,8 @@
 #include <sys/cdefs.h>
 __KERNEL_RCSID(0, "$NetBSD: i915_pci.c,v 1.4 2014/04/03 19:18:29 riastradh Exp 
$");
 
+#include "vga.h"
+
 #include <sys/types.h>
 #ifndef _MODULE
 /* XXX Mega-kludge because modules are broken.  */
@@ -46,6 +48,13 @@
 #include <dev/pci/wsdisplay_pci.h>
 #include <dev/wsfb/genfbvar.h>
 
+#if (NVGA > 0)
+#include <dev/ic/mc6845reg.h>
+#include <dev/ic/pcdisplayvar.h>
+#include <dev/ic/vgareg.h>
+#include <dev/ic/vgavar.h>
+#endif
+
 #include <drm/drmP.h>
 
 #include "i915_drv.h"
@@ -58,6 +67,7 @@
        bus_space_handle_t              sc_fb_bsh;
        struct genfb_softc              sc_genfb;
        struct list_head                sc_fb_list; /* XXX Kludge!  */
+       bool                            sc_console;
 };
 
 static int     i915drm_match(device_t, cfdata_t, void *);
@@ -167,6 +177,18 @@
                i915_drm_driver->driver_features &=~ DRIVER_USE_AGP;
        }
 
+#if (NVGA > 0)
+       if (vga_is_console(pa->pa_iot, -1) || vga_is_console(pa->pa_memt, -1)) {
+               sc->sc_console = true;
+               wsdisplay_cndetach();
+               vga_cndetach();
+       } else
+#endif
+       if (genfb_is_console() && genfb_is_enabled()) {
+               sc->sc_console = true;
+       } else
+               sc->sc_console = false;
+
        /* Initialize the drm pci driver state.  */
        sc->sc_drm_dev.driver = i915_drm_driver;
        drm_pci_attach(self, pa, &sc->sc_pci_dev, &sc->sc_drm_dev);
@@ -416,7 +438,7 @@
                goto fail3;
        }
 
-       prop_dictionary_set_bool(dict, "is_console", 1); /* XXX */
+       prop_dictionary_set_bool(dict, "is_console", sc->sc_console);
        prop_dictionary_set_uint32(dict, "width", mode_cmd.width);
        prop_dictionary_set_uint32(dict, "height", mode_cmd.height);
        prop_dictionary_set_uint8(dict, "depth", sizes->surface_bpp);



Home | Main Index | Thread Index | Old Index