Subject: SE/30 grf mmap() fix
To: None <port-mac68k@NetBSD.ORG>
From: Denny Gentry <denny1@home.com>
List: port-mac68k
Date: 03/13/1997 20:53:34
It was rumored several days ago on this list that GENERIC-26
might allow the SE/30 to use mmap grf feature in dt and
X, rather than USE_OLD_GRF. I tried it, and mmap still fails.

  I have developed a fix for the SE/30, but I'm not sure
if it will break other machines.

in grf_mv.c:
195c195
< 	gm->fbbase = (caddr_t) (sc->sc_slot.virtual_base + image.offset);
---
> 	gm->fbbase = (caddr_t) (sc->sc_slot.virtual_base);

in grf.c:
374c374
< 	*addrp += (unsigned long) gp->sc_grfmode->fboff & 0xfff;
---
> 	*addrp += (unsigned long) gp->sc_grfmode->fboff;

  As far as I can tell, in the unmodified file the fboff gets
added twice: once to fbbase, and again in grfmap. grfmap works
because if truncates the lower 12 bits, which effectively masks
fboff to zero. grfmmap does no such truncation, and since fboff
is added twice it is pointing way up in the VRAM somewhere.

  Do most machines/video cards have an fboff of 0? Thats the only
way I can see that everything else works, but not the SE/30.

--Denny