NetBSD Problem Report #48705

From www@NetBSD.org  Fri Apr  4 13:45:36 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 4989FA580A
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  4 Apr 2014 13:45:36 +0000 (UTC)
Message-Id: <20140404134534.E8115A5811@mollari.NetBSD.org>
Date: Fri,  4 Apr 2014 13:45:34 +0000 (UTC)
From: nonakap@gmail.com
Reply-To: nonakap@gmail.com
To: gnats-bugs@NetBSD.org
Subject: i915drmkms(4): Do not attach console unconditionally.
X-Send-Pr-Version: www-1.0

>Number:         48705
>Category:       kern
>Synopsis:       i915drmkms(4): Do not attach console unconditionally.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    riastradh
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 04 13:50:00 +0000 2014
>Closed-Date:    Fri Apr 25 23:49:14 +0000 2014
>Last-Modified:  Fri Apr 25 23:49:14 +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);

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->riastradh
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Mon, 07 Apr 2014 13:07:14 +0000
Responsible-Changed-Why:
mine


From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48705 CVS commit: src/sys/external/bsd/drm2/i915drm
Date: Fri, 25 Apr 2014 19:02:52 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Fri Apr 25 19:02:51 UTC 2014

 Modified Files:
 	src/sys/external/bsd/drm2/i915drm: i915_pci.c

 Log Message:
 Take the console only from vga or generic genfb.

 Adapted from a patch by nonaka@ in PR 48705.

 While here, attach i915 genfb earlier as in PR 48706.


 To generate a diff of this commit:
 cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/i915drm/i915_pci.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Fri, 25 Apr 2014 23:49:14 +0000
State-Changed-Why:
fixed


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.