Module Name:    src
Committed By:   macallan
Date:           Tue Mar  8 03:22:30 UTC 2011

Modified Files:
        src/sys/dev/pci: genfb_pci.c

Log Message:
only try to map the framebuffer if we don't already have an address
With this radeondrm works with genfb and r6xx.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/pci/genfb_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/dev/pci/genfb_pci.c
diff -u src/sys/dev/pci/genfb_pci.c:1.31 src/sys/dev/pci/genfb_pci.c:1.32
--- src/sys/dev/pci/genfb_pci.c:1.31	Sun Feb 13 11:00:58 2011
+++ src/sys/dev/pci/genfb_pci.c	Tue Mar  8 03:22:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb_pci.c,v 1.31 2011/02/13 11:00:58 phx Exp $ */
+/*	$NetBSD: genfb_pci.c,v 1.32 2011/03/08 03:22:29 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.31 2011/02/13 11:00:58 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.32 2011/03/08 03:22:29 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -131,14 +131,22 @@
 		return;
 	}
 
-	if (bus_space_map(sc->sc_memt, sc->sc_gen.sc_fboffset,
-	    sc->sc_gen.sc_fbsize,
-	    BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE,
-	    &sc->sc_memh) != 0) {
-		aprint_error_dev(self, "unable to map the framebuffer\n");
-		return;
-	}
-	sc->sc_gen.sc_fbaddr = bus_space_vaddr(sc->sc_memt, sc->sc_memh);
+	/*
+	 * if some MD code handed us a framebuffer VA we use that instead of
+	 * mapping our own
+	 */
+	if (sc->sc_gen.sc_fbaddr == NULL) {
+		if (bus_space_map(sc->sc_memt, sc->sc_gen.sc_fboffset,
+		    sc->sc_gen.sc_fbsize,
+		    BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE,
+		    &sc->sc_memh) != 0) {
+			aprint_error_dev(self, "unable to map the framebuffer\n");
+			return;
+		}
+		sc->sc_gen.sc_fbaddr = bus_space_vaddr(sc->sc_memt, sc->sc_memh);
+	} else
+		aprint_debug("%s: recycling existing fb mapping at %lx\n",
+		    device_xname(sc->sc_gen.sc_dev), (unsigned long)sc->sc_gen.sc_fbaddr);
 
 	/* mmap()able bus ranges */
 	idx = 0;

Reply via email to