Module Name:    src
Committed By:   mrg
Date:           Sat Feb 14 06:58:12 UTC 2015

Modified Files:
        src/sys/external/bsd/drm2/radeon: radeon_pci.c

Log Message:
add a ugly hack to avoid difficult to understand failures with
radeondrmkms on i386.  the problem is that the pcdisplay@isa
and vga@isa drivers rely on some other driver having already
mapped the vga registers to know they should not attach, but
radeondrmkms attaches late as it needs rootfs access, and it
does not map these registers, and either of vga or pcdisplay
will attach, and then attach wsdisplay0, and then getty and
X11 will fail and you shake a tiny fist at the computer.

so, for i386, map and unmap the VGA register space between
the normal attach and the mountroot attach.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/radeon/radeon_pci.c

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

Modified files:

Index: src/sys/external/bsd/drm2/radeon/radeon_pci.c
diff -u src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.4 src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.5
--- src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.4	Sat Jul 26 07:36:09 2014
+++ src/sys/external/bsd/drm2/radeon/radeon_pci.c	Sat Feb 14 06:58:12 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeon_pci.c,v 1.4 2014/07/26 07:36:09 riastradh Exp $	*/
+/*	$NetBSD: radeon_pci.c,v 1.5 2015/02/14 06:58:12 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.4 2014/07/26 07:36:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.5 2015/02/14 06:58:12 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "vga.h"
@@ -82,6 +82,12 @@ struct radeon_softc {
 	}				sc_task_u;
 	struct drm_device		*sc_drm_dev;
 	struct pci_dev			sc_pci_dev;
+#ifdef __i386__
+#define RADEON_PCI_UGLY_MAP_HACK
+	/* XXX Used to claim the VGA device before attach_real */
+	bus_space_handle_t		sc_temp_memh;
+	bool				sc_temp_set;
+#endif
 };
 
 struct radeon_device *
@@ -165,6 +171,17 @@ radeon_attach(device_t parent, device_t 
 	sc->sc_dev = NULL;
 	sc->sc_pa = *pa;
 
+#ifdef RADEON_PCI_UGLY_MAP_HACK
+	/*
+	 * XXX
+	 * We map the VGA registers, so that other driver don't
+	 * think they can.  This stops vga@isa or pcdisplay@isa
+	 * attaching, and stealing wsdisplay0.  Yuck.
+	 */
+	sc->sc_temp_set = bus_space_map(pa->pa_memt, 0xb0000, 0x10000, 0,
+					&sc->sc_temp_memh);
+#endif
+
 	config_mountroot(self, &radeon_attach_real);
 }
 
@@ -180,6 +197,15 @@ radeon_attach_real(device_t self)
 	ok = radeon_pci_lookup(pa, &flags);
 	KASSERT(ok);
 
+#ifdef RADEON_PCI_UGLY_MAP_HACK
+	/*
+	 * XXX
+	 * Unmap the VGA registers so the DRM code can map them.
+	 */
+	if (sc->sc_temp_set)
+		bus_space_unmap(pa->pa_memt, sc->sc_temp_memh, 0x10000);
+#endif
+
 	sc->sc_task_state = RADEON_TASK_ATTACH;
 	SIMPLEQ_INIT(&sc->sc_task_u.attach);
 

Reply via email to