Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/dev fix a few mmap bugs. pretend to be a cg3...



details:   https://anonhg.NetBSD.org/src/rev/be3737942896
branches:  trunk
changeset: 475097:be3737942896
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Aug 01 06:27:00 1999 +0000

description:
fix a few mmap bugs.  pretend to be a cg3 and implement a hack
to fack the Xsun server to believe that the p9100's framebuffer
is really a cg3's.  So if only colormaps worked, X would be able
to run.

diffstat:

 sys/arch/sparc/dev/p9100.c |  21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r dac5d3ed8a19 -r be3737942896 sys/arch/sparc/dev/p9100.c
--- a/sys/arch/sparc/dev/p9100.c        Sun Aug 01 05:02:06 1999 +0000
+++ b/sys/arch/sparc/dev/p9100.c        Sun Aug 01 06:27:00 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: p9100.c,v 1.1 1999/08/01 00:23:49 matt Exp $ */
+/*     $NetBSD: p9100.c,v 1.2 1999/08/01 06:27:00 matt Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -222,7 +222,7 @@
        fb->fb_driver = &p9100fbdriver;
        fb->fb_device = &sc->sc_dev;
        fb->fb_flags = sc->sc_dev.dv_cfdata->cf_flags & FB_USERMASK;
-       fb->fb_type.fb_type = FBTYPE_SUN2COLOR;
+       fb->fb_type.fb_type = FBTYPE_SUN3COLOR;
 
        /*
         * When the ROM has mapped in a p9100 display, the address
@@ -496,10 +496,23 @@
        if (off < 0)
                return (-1);
 
+#define CG3_MMAP_OFFSET        0x04000000
+       /* Make Xsun think we are a CG3 (SUN3COLOR)
+        */
+       if (off >= CG3_MMAP_OFFSET && off < CG3_MMAP_OFFSET + sc->sc_fb_psize) {
+               off -= CG3_MMAP_OFFSET;
+               if (bus_space_mmap(sc->sc_bustag,
+                                  sc->sc_fb_btype,
+                                  sc->sc_fb_paddr + off,
+                                  BUS_SPACE_MAP_LINEAR, &bh))
+                       return (-1);
+               return ((int)bh);
+       }
+
        if (off >= sc->sc_fb_psize + sc->sc_ctl_psize + sc->sc_cmd_psize)
                return (-1);
 
-       if (off <= sc->sc_fb_psize) {
+       if (off < sc->sc_fb_psize) {
                if (bus_space_mmap(sc->sc_bustag,
                                   sc->sc_fb_btype,
                                   sc->sc_fb_paddr + off,
@@ -508,7 +521,7 @@
                return ((int)bh);
        }
        off -= sc->sc_fb_psize;
-       if (off <= sc->sc_ctl_psize) {
+       if (off < sc->sc_ctl_psize) {
                if (bus_space_mmap(sc->sc_bustag,
                                   sc->sc_ctl_btype,
                                   sc->sc_ctl_paddr + off,



Home | Main Index | Thread Index | Old Index