Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/drm2/radeon add a ugly hack to avoid diffic...



details:   https://anonhg.NetBSD.org/src/rev/ac26e2d0890c
branches:  trunk
changeset: 336129:ac26e2d0890c
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Feb 14 06:58:12 2015 +0000

description:
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.

diffstat:

 sys/external/bsd/drm2/radeon/radeon_pci.c |  30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diffs (65 lines):

diff -r ac6de6d15063 -r ac26e2d0890c sys/external/bsd/drm2/radeon/radeon_pci.c
--- a/sys/external/bsd/drm2/radeon/radeon_pci.c Sat Feb 14 06:31:31 2015 +0000
+++ b/sys/external/bsd/drm2/radeon/radeon_pci.c Sat Feb 14 06:58:12 2015 +0000
@@ -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 @@
        }                               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 @@
        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 @@
        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);
 



Home | Main Index | Thread Index | Old Index