Date: Wed, 12 Aug 1998 20:39:33 +0200 (CEST)
From: Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be>
To: Linux/m68k <linux-m68k@lists.linux-m68k.org>
Subject: L68K: Video patches for 2.1.115
Sender: owner-linux-m68k@phil.uni-sb.de


Here they are, the video patches for Linux/m68k 2.1.115

  - Colormap changes, as promised. From now on, {set,get}colreg use 16 bit RGB
    values instead of values rounded to the hardware's capabilities. This fixes
    the DIRECTCOLOR problem. Note that I DID NOT UPDATE ATAFB, due to my lack
    of knowledge about the Atari hardware. Can someone please (please) look at
    this?
  - Fix possible array overflow (ecs_palette) in amifb.
  - Add missing color bitfields to clgenfb.
  - Fix possible buffer overflow in atyfb (remove strcat of GX/CT/VT/GT to
    atyfb_name for each board found)
  - For Mach64 LT-G, the default video mode is 1024x768 (G3 PowerBook LCD)
  - Update video and console to the vger level

The 16 color logo has wrong colors. I guess I should redither it against the
real console palette.

Enjoy! And let's hope there are no more bugs to find for Andreas :-)

diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/char/console.c m68k/drivers/char/console.c
--- jes-2.1.115/drivers/char/console.c	Sun Aug  9 21:47:50 1998
+++ m68k/drivers/char/console.c	Mon Aug 10 21:14:46 1998
@@ -197,7 +197,7 @@
 	return p;
 }
 
-static inline void scrolldelta(int lines)
+static void scrolldelta(int lines)
 {
 	int currcons = fg_console;
 
@@ -453,9 +453,9 @@
 	int i = scr_readw((u16 *) pos);
 	u32 type = cursor_type;
 
+	if (! (type & 0x10)) return;
 	if (softcursor_original != -1) return;
 	softcursor_original = i;
-	if (! (type & 0x10)) return;
 	i |= ((type >> 8) & 0xff00 );
 	i ^= ((type) & 0xff00 );
 	if ((type & 0x20) && ((softcursor_original & 0x7000) == (i & 0x7000))) i ^= 0x7000;
@@ -467,6 +467,8 @@
 
 static void hide_cursor(int currcons)
 {
+	if (currcons == sel_cons)
+		clear_selection();
 	if (softcursor_original != -1) {
 		scr_writew(softcursor_original,(u16 *) pos);
 		if (DO_UPDATE)
@@ -481,6 +483,8 @@
     if (!IS_FG || console_blanked || vcmode == KD_GRAPHICS)
 	return;
     if (deccm) {
+	if (currcons == sel_cons)
+		clear_selection();
 	add_softcursor(currcons);
 	if ((cursor_type & 0x0f) != 1)
 	    sw->con_cursor(vc_cons[currcons].d,CM_DRAW);
@@ -527,8 +531,6 @@
 	}
 	lock = 1;
 
-	clear_selection();
-
 	hide_cursor(currcons);
 	if (fg_console != new_console) {
 		display = vc_cons[new_console].d->vc_display_fg;
@@ -610,7 +612,8 @@
 		vt_cons[currcons] = NULL;
 		return -ENOMEM;
 	    }
-	    con_set_default_unimap(currcons);
+	    if (!*vc_cons[currcons].d->vc_uni_pagedir_loc)
+		con_set_default_unimap(currcons);
 	    screenbuf = (unsigned short *) q;
 	    kmalloced = 1;
 	    screenbuf_size = video_screen_size;
@@ -1687,14 +1690,10 @@
 			/* DEC screen alignment test. kludge :-) */
 			video_erase_char =
 				(video_erase_char & 0xff00) | 'E';
-			/* Arno:
-			 * Doesn't work, because csi_J(c,2)
-			 * calls con_clear and doesn't print
-			 * the erase char..	FIXME
-			 */
 			csi_J(currcons, 2);
 			video_erase_char =
 				(video_erase_char & 0xff00) | ' ';
+			do_update_region(currcons, origin, screenbuf_size/2);
 		}
 		return;
 	case ESsetG0:
@@ -1766,10 +1765,6 @@
 	himask = hi_font_mask;
 	charmask = himask ? 0x1ff : 0xff;
 
-	/* clear the selection */
-	if (currcons == sel_cons)
-		clear_selection();
-
 	/* undraw cursor first */
 	if (IS_FG)
 		hide_cursor(currcons);
@@ -1906,7 +1901,6 @@
 	run_task_queue(&con_task_queue);
 	if (want_console >= 0) {
 		if (want_console != fg_console && vc_cons_allocated(want_console)) {
-			clear_selection();
 			hide_cursor(fg_console);
 			save_screen();
 			change_console(want_console);
@@ -2415,8 +2409,8 @@
 
 	/* entering graphics mode? */
 	if (nopowersave) {
-		save_screen();
 		hide_cursor(currcons);
+		save_screen();
 		sw->con_blank(vc_cons[currcons].d, -1);
 		console_blanked = fg_console + 1;
 		set_origin(currcons);
@@ -2474,6 +2468,9 @@
 
 	currcons = fg_console;
 	console_blanked = 0;
+#ifdef CONFIG_APM
+	apm_display_unblank();
+#endif
 	if (sw->con_blank(vc_cons[currcons].d, 0))
 		/* Low-level driver cannot restore -> do it ourselves */
 		update_screen(fg_console);
@@ -2586,7 +2583,7 @@
 int con_font_op(int currcons, struct console_font_op *op)
 {
 	int rc = -EINVAL;
-	int size, set;
+	int size = max_font_size, set;
 	u8 *temp = NULL;
 	struct console_font_op old_op;
 
@@ -2626,10 +2623,9 @@
 		if (size > max_font_size)
 			return -ENOSPC;
 		set = 1;
-	} else if (op->op == KD_FONT_OP_GET) {
-		size = max_font_size;
+	} else if (op->op == KD_FONT_OP_GET)
 		set = 0;
-	} else
+	else
 		return sw->con_font_op(vc_cons[currcons].d, op);
 	if (op->data) {
 		temp = kmalloc(size, GFP_KERNEL);
@@ -2698,6 +2694,22 @@
 {
 	gotoxy(currcons, p[0], p[1]);
 	set_cursor(currcons);
+}
+
+u16 vcs_scr_readw(int currcons, u16 *org)
+{
+	if ((unsigned long)org == pos && softcursor_original != -1)
+		return softcursor_original;
+	return scr_readw(org);
+}
+
+void vcs_scr_writew(int currcons, u16 val, u16 *org)
+{
+	scr_writew(val, org);
+	if ((unsigned long)org == pos) {
+		softcursor_original = -1;
+		add_softcursor(currcons);
+	}
 }
 
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/char/consolemap.c m68k/drivers/char/consolemap.c
--- jes-2.1.115/drivers/char/consolemap.c	Sun Aug  9 21:47:52 1998
+++ m68k/drivers/char/consolemap.c	Wed Aug 12 20:13:27 1998
@@ -576,6 +576,24 @@
 }
 
 int
+con_copy_unimap(int dstcon, int srccon)
+{
+	struct vc_data *sconp = vc_cons[srccon].d;
+	struct vc_data *dconp = vc_cons[dstcon].d;
+	struct uni_pagedir *q;
+	
+	if (!vc_cons_allocated(srccon) || !*sconp->vc_uni_pagedir_loc)
+		return -EINVAL;
+	if (*dconp->vc_uni_pagedir_loc == *sconp->vc_uni_pagedir_loc)
+		return 0;
+	con_free_unimap(dstcon);
+	q = (struct uni_pagedir *)*sconp->vc_uni_pagedir_loc;
+	q->refcount++;
+	*dconp->vc_uni_pagedir_loc = (long)q;
+	return 0;
+}
+
+int
 con_get_unimap(int con, ushort ct, ushort *uct, struct unipair *list)
 {
 	int i, j, k, ect;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/char/fbmem.c m68k/drivers/char/fbmem.c
--- jes-2.1.115/drivers/char/fbmem.c	Sun Aug  9 21:47:52 1998
+++ m68k/drivers/char/fbmem.c	Wed Aug 12 19:47:30 1998
@@ -253,6 +253,9 @@
     int oldidx = con2fb_map[unit];
     struct fb_info *oldfb, *newfb;
     struct vc_data *conp;
+    char *fontdata;
+    unsigned short fontwidth, fontheight, fontwidthlog, fontheightlog;
+    int userfont;
 
     if (newidx != con2fb_map[unit]) {
        oldfb = registered_fb[oldidx];
@@ -261,9 +264,21 @@
 	   return;
        oldfb->fbops->fb_release(oldfb,0);
        conp = fb_display[unit].conp;
+       fontdata = fb_display[unit].fontdata;
+       fontwidth = fb_display[unit]._fontwidth;
+       fontheight = fb_display[unit]._fontheight;
+       fontwidthlog = fb_display[unit]._fontwidthlog;
+       fontheightlog = fb_display[unit]._fontheightlog;
+       userfont = fb_display[unit].userfont;
        con2fb_map[unit] = newidx;
        fb_display[unit] = *(newfb->disp);
        fb_display[unit].conp = conp;
+       fb_display[unit].fontdata = fontdata;
+       fb_display[unit]._fontwidth = fontwidth;
+       fb_display[unit]._fontheight = fontheight;
+       fb_display[unit]._fontwidthlog = fontwidthlog;
+       fb_display[unit]._fontheightlog = fontheightlog;
+       fb_display[unit].userfont = userfont;
        fb_display[unit].fb_info = newfb;
        if (!newfb->changevar)
 	   newfb->changevar = oldfb->changevar;
@@ -594,7 +609,7 @@
 
     if (!options || !*options)
 	    return;
-
+	    
     if (!strncmp(options, "map:", 4)) {
 	    options += 4;
 	    if (*options)
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/char/vc_screen.c m68k/drivers/char/vc_screen.c
--- jes-2.1.115/drivers/char/vc_screen.c	Fri Jul 10 19:11:03 1998
+++ m68k/drivers/char/vc_screen.c	Mon Aug 10 21:20:58 1998
@@ -7,7 +7,8 @@
  *            [minor: N]
  *
  * /dev/vcsaN: idem, but including attributes, and prefixed with
- *	the 4 bytes lines,columns,x,y (as screendump used to give)
+ *	the 4 bytes lines,columns,x,y (as screendump used to give).
+ *	Attribute/character pair is in native endianity.
  *            [minor: N+128]
  *
  * This replaces screendump and part of selection, so that the system
@@ -39,18 +40,6 @@
 #undef addr
 #define HEADER_SIZE	4
 
-static unsigned short
-func_scr_readw(unsigned short *org)
-{
-return scr_readw( org );
-}
-
-static void
-func_scr_writew(unsigned short val, unsigned short *org)
-{
-scr_writew( val, org );
-}
-
 static int
 vcs_size(struct inode *inode)
 {
@@ -91,7 +80,7 @@
 	return file->f_pos;
 }
 
-#define RETURN( x ) { enable_bh( CONSOLE_BH ); return x; }
+#define RETURN(x) { enable_bh(CONSOLE_BH); return x; }
 static ssize_t
 vcs_read(struct file *file, char *buf, size_t count, loff_t *ppos)
 {
@@ -104,7 +93,7 @@
 
 	attr = (currcons & 128);
 	currcons = (currcons & 127);
-	disable_bh( CONSOLE_BH );
+	disable_bh(CONSOLE_BH);
 	if (currcons == 0) {
 		currcons = fg_console;
 		viewed = 1;
@@ -125,7 +114,7 @@
 	if (!attr) {
 		org = screen_pos(currcons, p, viewed);
 		while (count-- > 0)
-			put_user(func_scr_readw(org++) & 0xff, buf++);
+			put_user(vcs_scr_readw(currcons, org++) & 0xff, buf++);
 	} else {
 		if (p < HEADER_SIZE) {
 			char header[HEADER_SIZE];
@@ -140,21 +129,21 @@
 		    org = screen_pos(currcons, p/2, viewed);
 		    if ((p & 1) && count > 0)
 #ifdef __BIG_ENDIAN
-			    { count--; put_user(func_scr_readw(org++) & 0xff, buf++); }
+			    { count--; put_user(vcs_scr_readw(currcons, org++) & 0xff, buf++); }
 #else
-			    { count--; put_user(func_scr_readw(org++) >> 8, buf++); }
+			    { count--; put_user(vcs_scr_readw(currcons, org++) >> 8, buf++); }
 #endif
 		}
 		while (count > 1) {
-			put_user(func_scr_readw(org++), (unsigned short *) buf);
+			put_user(vcs_scr_readw(currcons, org++), (unsigned short *) buf);
 			buf += 2;
 			count -= 2;
 		}
 		if (count > 0)
 #ifdef __BIG_ENDIAN
-			put_user(func_scr_readw(org) >> 8, buf++);
+			put_user(vcs_scr_readw(currcons, org) >> 8, buf++);
 #else
-			put_user(func_scr_readw(org) & 0xff, buf++);
+			put_user(vcs_scr_readw(currcons, org) & 0xff, buf++);
 #endif
 	}
 	read = buf - buf0;
@@ -170,11 +159,11 @@
 	long p = *ppos;
 	long viewed, attr, size, written;
 	const char *buf0;
-	unsigned short *org = NULL;
+	u16 *org0 = NULL, *org = NULL;
 
 	attr = (currcons & 128);
 	currcons = (currcons & 127);
-	disable_bh( CONSOLE_BH );
+	disable_bh(CONSOLE_BH);
 	if (currcons == 0) {
 		currcons = fg_console;
 		viewed = 1;
@@ -193,12 +182,12 @@
 
 	buf0 = buf;
 	if (!attr) {
-		org = screen_pos(currcons, p, viewed);
+		org0 = org = screen_pos(currcons, p, viewed);
 		while (count > 0) {
 			unsigned char c;
 			count--;
 			get_user(c, (const unsigned char*)buf++);
-			func_scr_writew((func_scr_readw(org) & 0xff00) | c, org);
+			vcs_scr_writew(currcons, (vcs_scr_readw(currcons, org) & 0xff00) | c, org);
 			org++;
 		}
 	} else {
@@ -211,18 +200,18 @@
 				putconsxy(currcons, header+2);
 		}
 		if (count > 0) {
-		    p -= HEADER_SIZE;
-			org = screen_pos(currcons, p/2, viewed);
+			p -= HEADER_SIZE;
+			org0 = org = screen_pos(currcons, p/2, viewed);
 			if ((p & 1) && count > 0) {
 			    char c;
 				count--;
 				get_user(c,buf++);
 #ifdef __BIG_ENDIAN
-				func_scr_writew(c |
-				     (func_scr_readw(org) & 0xff00), org);
+				vcs_scr_writew(currcons, c |
+				     (vcs_scr_readw(currcons, org) & 0xff00), org);
 #else
-				func_scr_writew((c << 8) |
-				     (func_scr_readw(org) & 0xff), org);
+				vcs_scr_writew(currcons, (c << 8) |
+				     (vcs_scr_readw(currcons, org) & 0xff), org);
 #endif
 				org++;
 			}
@@ -230,7 +219,7 @@
 		while (count > 1) {
 			unsigned short w;
 			get_user(w, (const unsigned short *) buf);
-			func_scr_writew(w, org++);
+			vcs_scr_writew(currcons, w, org++);
 			buf += 2;
 			count -= 2;
 		}
@@ -238,15 +227,14 @@
 			unsigned char c;
 			get_user(c, (const unsigned char*)buf++);
 #ifdef __BIG_ENDIAN
-			func_scr_writew((func_scr_readw(org) & 0xff) | (c << 8), org);
+			vcs_scr_writew(currcons, (vcs_scr_readw(currcons, org) & 0xff) | (c << 8), org);
 #else
-			func_scr_writew((func_scr_readw(org) & 0xff00) | c, org);
+			vcs_scr_writew(currcons, (vcs_scr_readw(currcons, org) & 0xff00) | c, org);
 #endif
 		}
 	}
-	if (currcons == fg_console)
-		/* Horribly inefficient if count < screen size.  */
-		update_screen(currcons);
+	if (org0)
+		update_region(currcons, (unsigned long)(org0), org-org0);
 	written = buf - buf0;
 	*ppos += written;
 	RETURN( written );
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/Config.in m68k/drivers/video/Config.in
--- jes-2.1.115/drivers/video/Config.in	Sun Aug  9 21:48:25 1998
+++ m68k/drivers/video/Config.in	Mon Aug 10 19:53:36 1998
@@ -37,7 +37,7 @@
       bool 'Apple "platinum" display support' CONFIG_FB_PLATINUM
 #     bool 'Apple "valkyrie" display support' CONFIG_FB_VALKYRIE
       bool 'ATI Mach64 display support' CONFIG_FB_ATY
-#     bool 'IMS Twin Turbo display support' CONFIG_FB_IMSTT
+      bool 'IMS Twin Turbo display support' CONFIG_FB_IMSTT
       bool 'Chips 65550 display support' CONFIG_FB_CT65550
       bool 'S3 Trio display support' CONFIG_FB_S3TRIO
     fi
@@ -75,7 +75,9 @@
       bool '  CGthree support' CONFIG_FB_CGTHREE
       if [ "$ARCH" = "sparc" ]; then
         bool '  TCX (SS4/SS5 only) support' CONFIG_FB_TCX
+	bool '  CGfourteen (SX) support' CONFIG_FB_CGFOURTEEN
       fi
+      bool '  Leo (ZX) support' CONFIG_FB_LEO
     fi
   fi
   if [ "$ARCH" = "sparc64" ]; then
@@ -138,15 +140,17 @@
 	 "$CONFIG_FB_OF" = "y" -o "$CONFIG_FB_TGA" = "y" -o \
 	 "$CONFIG_FB_VESA" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \
 	 "$CONFIG_FB_TCX" = "y" -o "$CONFIG_FB_CGTHREE" = "y" -o \
-	 "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" ]; then
+	 "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \
+	 "$CONFIG_FB_CGFOURTEEN" = "y" ]; then
       define_bool CONFIG_FBCON_CFB8 y
     else
       if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_ATARI" = "m" -o \
-	   "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_MAC" = "y" -o \
+	   "$CONFIG_FB_ATY" = "m" -o "$CONFIG_FB_MAC" = "m" -o \
 	   "$CONFIG_FB_OF" = "m" -o "$CONFIG_FB_TGA" = "m" -o \
 	   "$CONFIG_FB_VESA" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \
 	   "$CONFIG_FB_TCX" = "m" -o "$CONFIG_FB_CGTHREE" = "m" -o \
-	   "$CONFIG_FB_CONTROL" = "m" ]; then
+	   "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \
+	   "$CONFIG_FB_CGFOURTEEN" = "m" ]; then
 	define_bool CONFIG_FBCON_CFB8 m
       fi
     fi
@@ -164,22 +168,24 @@
       fi
     fi
     if [ "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \
-	 "$CONFIG_FB_CLGEN" = "y" ]; then
+	 "$CONFIG_FB_CLGEN" = "y" -o "$CONFIG_FB_VESA" = "y" ]; then
       define_bool CONFIG_FBCON_CFB24 y
     else
       if [ "$CONFIG_FB_ATY" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \
-	   "$CONFIG_FB_CLGEN" = "m" ]; then
+	   "$CONFIG_FB_CLGEN" = "m" -o "$CONFIG_FB_VESA" = "m" ]; then
 	define_bool CONFIG_FBCON_CFB24 m
       fi
     fi
     if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATY" = "y" -o \
 	 "$CONFIG_FB_VESA" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \
-	 "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" ]; then
+	 "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \
+	 "$CONFIG_FB_TGA" = "y" ]; then
       define_bool CONFIG_FBCON_CFB32 y
     else
       if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_ATY" = "m" -o \
 	   "$CONFIG_FB_VESA" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \
-	   "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" ]; then
+	   "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \
+	   "$CONFIG_FB_TGA" = "m" ]; then
 	define_bool CONFIG_FBCON_CFB32 m
       fi
     fi
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/Makefile m68k/drivers/video/Makefile
--- jes-2.1.115/drivers/video/Makefile	Sun Aug  9 21:48:25 1998
+++ m68k/drivers/video/Makefile	Fri Jul 31 09:00:54 1998
@@ -21,9 +21,11 @@
 
 # Frame Buffer Console
 
-# Nasty trick to make sure all wanted stuff is linked in
-O_TARGET = fbdev.o
-L_OBJS += fbdev.o
+ifeq ($(CONFIG_FB),y)
+  # Nasty trick to make sure all wanted stuff is linked in
+  O_TARGET = fbdev.o
+  L_OBJS += fbdev.o
+endif
 
 ifeq ($(CONFIG_DUMMY_CONSOLE),y)
   L_OBJS += dummycon.o
@@ -126,6 +128,10 @@
 L_OBJS += offb.o macmodes.o
 endif
 
+ifeq ($(CONFIG_FB_IMSTT),y)
+L_OBJS += imsttfb.o
+endif
+
 ifeq ($(CONFIG_FB_RETINAZ3),y)
 L_OBJS += retz3fb.o
 else
@@ -225,6 +231,20 @@
     M_OBJS += tcxfb.o
     endif
   endif
+  ifeq ($(CONFIG_FB_CGFOURTEEN),y)
+    L_OBJS += cgfourteenfb.o
+  else
+    ifeq ($(CONFIG_FB_CGFOURTEEN),m)
+    M_OBJS += cgfourteenfb.o
+    endif
+  endif
+  ifeq ($(CONFIG_FB_LEO),y)
+    L_OBJS += leofb.o
+  else
+    ifeq ($(CONFIG_FB_LEO),m)
+    M_OBJS += leofb.o
+    endif
+  endif
 else
   ifeq ($(CONFIG_FB_SBUS),m)
   M_OBJS += sbusfb.o
@@ -261,6 +281,20 @@
     else
       ifeq ($(CONFIG_FB_TCX),m)
       M_OBJS += tcxfb.o
+      endif
+    endif
+    ifeq ($(CONFIG_FB_CGFOURTEEN),y)
+      M_OBJS += cgfourteenfb.o
+    else
+      ifeq ($(CONFIG_FB_CGFOURTEEN),m)
+      M_OBJS += cgfourteenfb.o
+      endif
+    endif
+    ifeq ($(CONFIG_FB_LEO),y)
+      M_OBJS += leofb.o
+    else
+      ifeq ($(CONFIG_FB_LEO),m)
+      M_OBJS += leofb.o
       endif
     endif
   endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/S3triofb.c m68k/drivers/video/S3triofb.c
--- jes-2.1.115/drivers/video/S3triofb.c	Sun Aug  9 21:48:26 1998
+++ m68k/drivers/video/S3triofb.c	Wed Aug 12 09:29:11 1998
@@ -250,8 +250,7 @@
 			   struct fb_info *info)
 {
     if (con == currcon) /* current console? */
-	return fb_get_cmap(cmap, &fb_display[con].var, kspc, s3trio_getcolreg,
-			   info);
+	return fb_get_cmap(cmap, kspc, s3trio_getcolreg, info);
     else if (fb_display[con].cmap.len) /* non default colormap? */
 	fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
     else
@@ -276,8 +275,7 @@
 	    return err;
     }
     if (con == currcon)			/* current console? */
-	return fb_set_cmap(cmap, &fb_display[con].var, kspc, s3trio_setcolreg,
-			   info);
+	return fb_set_cmap(cmap, kspc, s3trio_setcolreg, info);
     else
 	fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
     return 0;
@@ -624,8 +622,7 @@
 {
     /* Do we have to save the colormap? */
     if (fb_display[currcon].cmap.len)
-	fb_get_cmap(&fb_display[currcon].cmap, &fb_display[currcon].var, 1,
-		    s3trio_getcolreg, info);
+	fb_get_cmap(&fb_display[currcon].cmap, 1, s3trio_getcolreg, info);
 
     currcon = con;
     /* Install new colormap */
@@ -678,17 +675,16 @@
 {
     if (regno > 255)
 	return 1;
-    *red = palette[regno].red;
-    *green = palette[regno].green;
-    *blue = palette[regno].blue;
+    *red = (palette[regno].red << 8) | palette[regno].red;
+    *green = (palette[regno].green << 8) | palette[regno].green;
+    *blue = (palette[regno].blue << 8) | palette[regno].blue;
+    *transp = 0;
     return 0;
 }
 
 
     /*
-     *  Set a single color register. The values supplied are already
-     *  rounded down to the hardware's capabilities (according to the
-     *  entries in the var structure). Return != 0 for invalid regno.
+     *  Set a single color register. Return != 0 for invalid regno.
      */
 
 static int s3trio_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
@@ -696,6 +692,10 @@
 {
     if (regno > 255)
 	return 1;
+
+    red >>= 8;
+    green >>= 8;
+    blue >>= 8;
     palette[regno].red = red;
     palette[regno].green = green;
     palette[regno].blue = blue;
@@ -714,11 +714,10 @@
     if (con != currcon)
 	return;
     if (fb_display[con].cmap.len)
-	fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-		    s3trio_setcolreg, &fb_info);
+	fb_set_cmap(&fb_display[con].cmap, 1, s3trio_setcolreg, &fb_info);
     else
-	fb_set_cmap(fb_default_cmap(fb_display[con].var.bits_per_pixel),
-		    &fb_display[con].var, 1, s3trio_setcolreg, &fb_info);
+	fb_set_cmap(fb_default_cmap(fb_display[con].var.bits_per_pixel), 1,
+		    s3trio_setcolreg, &fb_info);
 }
 
 void s3triofb_setup(char *options, int *ints) {
@@ -837,9 +836,9 @@
 			      int dx, int height, int width)
 {
     sx *= 8; dx *= 8; width *= 8;
-    Trio_BitBLT((u_short)sx, (u_short)(sy*p->fontheight), (u_short)dx,
-		 (u_short)(dy*p->fontheight), (u_short)width,
-		 (u_short)(height*p->fontheight), (u_short)S3_NEW);
+    Trio_BitBLT((u_short)sx, (u_short)(sy*fontheight(p)), (u_short)dx,
+		 (u_short)(dy*fontheight(p)), (u_short)width,
+		 (u_short)(height*fontheight(p)), (u_short)S3_NEW);
 }
 
 static void fbcon_trio8_clear(struct vc_data *conp, struct display *p, int sy,
@@ -850,9 +849,9 @@
     sx *= 8; width *= 8;
     bg = attr_bgcol_ec(p,conp);
     Trio_RectFill((u_short)sx,
-		   (u_short)(sy*p->fontheight),
+		   (u_short)(sy*fontheight(p)),
 		   (u_short)width,
-		   (u_short)(height*p->fontheight),
+		   (u_short)(height*fontheight(p)),
 		   (u_short)S3_NEW,
 		   (u_short)bg);
 }
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/acornfb.c m68k/drivers/video/acornfb.c
--- jes-2.1.115/drivers/video/acornfb.c	Sun Aug  9 21:48:26 1998
+++ m68k/drivers/video/acornfb.c	Wed Aug 12 09:29:12 1998
@@ -228,12 +228,19 @@
 static int
 acornfb_vidc20_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue, u_int *trans, struct fb_info *info)
 {
+	int t;
+
 	if (regno >= current_par.palette_size)
 		return 1;
-	*red   = current_par.palette.vidc20[regno].d.red;
-	*green = current_par.palette.vidc20[regno].d.green;
-	*blue  = current_par.palette.vidc20[regno].d.blue;
-	*trans = current_par.palette.vidc20[regno].d.ext;
+	t = current_par.palette.vidc20[regno].d.red;
+	*red = (t << 8) | t;
+	t = current_par.palette.vidc20[regno].d.green;
+	*green = (t << 8) | t;
+	t = current_par.palette.vidc20[regno].d.blue;
+	*blue = (t << 8) | t;
+	t = current_par.palette.vidc20[regno].d.ext;
+	t |= t << 4;
+	*transp = (t << 8) | t;
 	return 0;
 }
 
@@ -243,6 +250,9 @@
 	if (regno >= current_par.palette_size)
 		return 1;
 
+	red >>= 8;
+	green >>= 8;
+	blue >>= 8;
 	current_par.palette.vidc20[regno].p = 0;
 	current_par.palette.vidc20[regno].d.red   = red;
 	current_par.palette.vidc20[regno].d.green = green;
@@ -261,8 +271,7 @@
 	int err = 0;
 
 	if (con == currcon)
-		err = fb_get_cmap(cmap, &fb_display[con].var,
-			          kspc, acornfb_vidc20_getcolreg, info);
+		err = fb_get_cmap(cmap, kspc, acornfb_vidc20_getcolreg, info);
 	else if (fb_display[con].cmap.len)
 		fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
 	else
@@ -282,8 +291,8 @@
 				    current_par.palette_size, 0);
 	if (!err) {
 		if (con == currcon)
-			err = fb_set_cmap(cmap, &fb_display[con].var,
-					  kspc, acornfb_vidc20_setcolreg, info);
+			err = fb_set_cmap(cmap, kspc, acornfb_vidc20_setcolreg,
+					  info);
 		else
 			fb_copy_cmap(cmap, &fb_display[con].cmap,
 				     kspc ? 0 : 1);
@@ -374,7 +383,7 @@
 	fb_info.blank		= acornfb_blank;
 
 	acornfb_set_disp(-1);
-	fb_set_cmap(fb_default_cmap(current_par.palette_size), &fb_display[0].var,
+	fb_set_cmap(fb_default_cmap(current_par.palette_size),
 		    1, acornfb_vidc20_setcolreg, &fb_info);
 	register_framebuffer(&fb_info);
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/amifb.c m68k/drivers/video/amifb.c
--- jes-2.1.115/drivers/video/amifb.c	Sun Aug  9 21:48:27 1998
+++ m68k/drivers/video/amifb.c	Wed Aug 12 09:29:17 1998
@@ -756,8 +756,9 @@
 
 	/*
 	 * Since we can't read the palette on OCS/ECS, and since reading one
-	 * single color palette entry require 5 expensive custom chip bus accesses
+	 * single color palette entry requires 5 expensive custom chip bus accesses
 	 * on AGA, we keep a copy of the current palette.
+	 * Note that the entries are always 24 bit!
 	 */
 
 #if defined(CONFIG_FB_AMIGA_AGA)
@@ -1077,13 +1078,13 @@
 /* colour */
 
 #define rgb2hw8_high(red, green, blue) \
-	(((red)<<4 & 0xf00) | ((green) & 0x0f0) | ((blue)>>4 & 0x00f))
+	(((red & 0xf0)<<4) | (green & 0xf0) | ((blue & 0xf0)>>4))
 #define rgb2hw8_low(red, green, blue) \
-	(((red)<<8 & 0xf00) | ((green)<<4 & 0x0f0) | ((blue) & 0x00f))
+	(((red & 0x0f)<<8) | ((green & 0x0f)<<4) | (blue & 0x0f))
 #define rgb2hw4(red, green, blue) \
-	(((red)<<8 & 0xf00) | ((green)<<4 & 0x0f0) | ((blue) & 0x00f))
+	(((red & 0xf0)<<4) | (green & 0xf0) | ((blue & 0xf0)>>4))
 #define rgb2hw2(red, green, blue) \
-	(((red)<<10 & 0xc00) | ((green)<<6 & 0x0c0) | ((blue)<<2 & 0x00c))
+	(((red & 0xc0)<<4) | (green & 0xc0) | ((blue & 0xc0)>>4))
 
 /* sprpos/sprctl (sprite positioning) */
 
@@ -1558,8 +1559,7 @@
 			  struct fb_info *info)
 {
 	if (con == currcon) /* current console? */
-		return fb_get_cmap(cmap, &fb_display[con].var, kspc,
-				   ami_getcolreg, info);
+		return fb_get_cmap(cmap, kspc, ami_getcolreg, info);
 	else if (fb_display[con].cmap.len) /* non default colormap? */
 		fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
 	else
@@ -1584,8 +1584,7 @@
 			return err;
 	}
 	if (con == currcon)			/* current console? */
-		return fb_set_cmap(cmap, &fb_display[con].var, kspc,
-				   ami_setcolreg, info);
+		return fb_set_cmap(cmap, kspc, ami_setcolreg, info);
 	else
 		fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
 	return 0;
@@ -1916,8 +1915,7 @@
 {
 	/* Do we have to save the colormap? */
 	if (fb_display[currcon].cmap.len)
-		fb_get_cmap(&fb_display[currcon].cmap,
-			    &fb_display[currcon].var, 1, ami_getcolreg, info);
+		fb_get_cmap(&fb_display[currcon].cmap, 1, ami_getcolreg, info);
 
 	currcon = con;
 	ami_set_var(&fb_display[con].var);
@@ -1954,12 +1952,10 @@
 	if (con != currcon)
 		return;
 	if (fb_display[con].cmap.len)
-		fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-			    ami_setcolreg, info);
+		fb_set_cmap(&fb_display[con].cmap, 1, ami_setcolreg, info);
 	else
 		fb_set_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel),
-					    &fb_display[con].var, 1,
-					    ami_setcolreg, info);
+					    1, ami_setcolreg, info);
 }
 
 static int flash_cursor(void)
@@ -2767,17 +2763,34 @@
 static int ami_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue,
                          u_int *transp, struct fb_info *info)
 {
+	int len, tr, tg, tb;
+
 	if (IS_AGA) {
 		if (regno > 255)
 			return 1;
+		len = 8;
+	} else if (currentpar.bplcon0 & BPC0_SHRES) {
+		if (regno > 3)
+			return 1;
+		len = 2;
 	} else {
 		if (regno > 31)
 			return 1;
+		len = 4;
 	}
-
-	*red = palette[regno].red;
-	*green = palette[regno].green;
-	*blue = palette[regno].blue;
+	tr = palette[regno].red>>(8-len);
+	tg = palette[regno].green>>(8-len);
+	tb = palette[regno].blue>>(8-len);
+	while (len < 16) {
+		tr |= tr<<len;
+		tg |= tg<<len;
+		tb |= tb<<len;
+		len <<= 1;
+	}
+	*red = tr;
+	*green = tg;
+	*blue = tb;
+	*transp = 0;
 	return 0;
 }
 
@@ -2791,16 +2804,22 @@
 static int ami_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
                          u_int transp, struct fb_info *info)
 {
-#if defined(CONFIG_FB_AMIGA_AGA)
-	u_short bplcon3 = currentpar.bplcon3;
-
 	if (IS_AGA) {
 		if (regno > 255)
 			return 1;
-	} else
-#endif
+	} else if (currentpar.bplcon0 & BPC0_SHRES) {
+		if (regno > 3)
+			return 1;
+	} else {
 		if (regno > 31)
 			return 1;
+	}
+	red >>= 8;
+	green >>= 8;
+	blue >>= 8;
+	palette[regno].red = red;
+	palette[regno].green = green;
+	palette[regno].blue = blue;
 
 	/*
 	 * Update the corresponding Hardware Color Register, unless it's Color
@@ -2810,13 +2829,10 @@
 	 * being changed by ami_do_blank() during the VBlank.
 	 */
 
-	palette[regno].red = red;
-	palette[regno].green = green;
-	palette[regno].blue = blue;
-
 	if (regno || !is_blanked) {
 #if defined(CONFIG_FB_AMIGA_AGA)
 		if (IS_AGA) {
+			u_short bplcon3 = currentpar.bplcon3;
 			VBlankOff();
 			custom.bplcon3 = bplcon3 | (regno<<8 & 0xe000);
 			custom.color[regno&31] = rgb2hw8_high(red, green, blue);
@@ -2826,26 +2842,24 @@
 			VBlankOn();
 		} else
 #endif
-		{
 #if defined(CONFIG_FB_AMIGA_ECS)
-			if (currentpar.bplcon0 & BPC0_SHRES) {
-				u_short color, mask;
-				int i;
-
-				mask = 0x3333;
-				color = rgb2hw2(red, green, blue);
-				VBlankOff();
-				for (i = regno+12; i >= (int)regno; i -= 4)
-					custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color;
-				mask <<=2; color >>= 2;
-				regno = down16(regno)+mul4(mod4(regno));
-				for (i = regno+3; i >= (int)regno; i--)
-					custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color;
-				VBlankOn();
-			} else
+		if (currentpar.bplcon0 & BPC0_SHRES) {
+			u_short color, mask;
+			int i;
+
+			mask = 0x3333;
+			color = rgb2hw2(red, green, blue);
+			VBlankOff();
+			for (i = regno+12; i >= (int)regno; i -= 4)
+				custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color;
+			mask <<=2; color >>= 2;
+			regno = down16(regno)+mul4(mod4(regno));
+			for (i = regno+3; i >= (int)regno; i--)
+				custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color;
+			VBlankOn();
+		} else
 #endif
-				custom.color[regno] = rgb2hw4(red, green, blue);
-		}
+			custom.color[regno] = rgb2hw4(red, green, blue);
 	}
 	return 0;
 }
@@ -2982,23 +2996,21 @@
 		custom.bplcon3 = bplcon3;
 	} else
 #endif
-	{
 #if defined(CONFIG_FB_AMIGA_ECS)
-		if (par->bplcon0 & BPC0_SHRES) {
-			u_short color, mask;
-			int i;
-
-			mask = 0x3333;
-			color = rgb2hw2(red, green, blue);
-			for (i = 12; i >= 0; i -= 4)
-				custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color;
-			mask <<=2; color >>= 2;
-			for (i = 3; i >= 0; i--)
-				custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color;
-		} else
+	if (par->bplcon0 & BPC0_SHRES) {
+		u_short color, mask;
+		int i;
+
+		mask = 0x3333;
+		color = rgb2hw2(red, green, blue);
+		for (i = 12; i >= 0; i -= 4)
+			custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color;
+		mask <<=2; color >>= 2;
+		for (i = 3; i >= 0; i--)
+			custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color;
+	} else
 #endif
-			custom.color[0] = rgb2hw4(red, green, blue);
-	}
+		custom.color[0] = rgb2hw4(red, green, blue);
 	is_blanked = do_blank > 0 ? do_blank : 0;
 }
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/atafb.c m68k/drivers/video/atafb.c
--- jes-2.1.115/drivers/video/atafb.c	Sun Aug  9 21:48:27 1998
+++ m68k/drivers/video/atafb.c	Wed Aug 12 20:19:15 1998
@@ -47,7 +47,6 @@
 #define ATAFB_EXT
 #define ATAFB_FALCON
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -683,6 +682,7 @@
 }
 
 
+#error Fix getcolreg/setcolreg
 static int tt_getcolreg( unsigned regno, unsigned *red,
 						 unsigned *green, unsigned *blue,
 						 unsigned *transp, struct fb_info *info )
@@ -2384,12 +2384,10 @@
 	if (con != currcon)
 		return;
 	if (fb_display[con].cmap.len)
-		fb_set_cmap(&fb_display[con].cmap, &(fb_display[con].var), 1,
-			    fbhw->setcolreg, info);
+		fb_set_cmap(&fb_display[con].cmap, 1, fbhw->setcolreg, info);
 	else
 		fb_set_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel),
-					    &(fb_display[con].var), 1,
-					    fbhw->setcolreg, info);		
+					    1, fbhw->setcolreg, info);		
 }
 
 
@@ -2547,8 +2545,7 @@
 atafb_get_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info)
 {
 	if (con == currcon) /* current console ? */
-		return fb_get_cmap(cmap, &(fb_display[con].var), kspc,
-				   fbhw->getcolreg, info);
+		return fb_get_cmap(cmap, kspc, fbhw->getcolreg, info);
 	else
 		if (fb_display[con].cmap.len) /* non default colormap ? */
 			fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
@@ -2569,8 +2566,7 @@
 		return err;
 	}
 	if (con == currcon) /* current console ? */
-		return fb_set_cmap(cmap, &(fb_display[con].var), kspc,
-				   fbhw->setcolreg, info);
+		return fb_set_cmap(cmap, kspc, fbhw->setcolreg, info);
 	else
 		fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
 	return 0;
@@ -2676,8 +2672,7 @@
 {
 	/* Do we have to save the colormap ? */
 	if (fb_display[currcon].cmap.len)
-		fb_get_cmap(&fb_display[currcon].cmap,
-			    &(fb_display[currcon].var), 1, fbhw->getcolreg,
+		fb_get_cmap(&fb_display[currcon].cmap, 1, fbhw->getcolreg,
 			    info);
 	do_fb_set_var(&fb_display[con].var,1);
 	currcon=con;
@@ -2708,8 +2703,7 @@
 		cmap.transp=NULL;
 		cmap.start=0;
 		cmap.len=16;
-		fb_set_cmap(&cmap, &(fb_display[currcon].var), 1,
-			    fbhw->setcolreg, info);
+		fb_set_cmap(&cmap, 1, fbhw->setcolreg, info);
 	}
 	else
 		do_install_cmap(currcon, info);
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/ati-gt.h m68k/drivers/video/ati-gt.h
--- jes-2.1.115/drivers/video/ati-gt.h	Sun Feb  8 22:35:55 1998
+++ m68k/drivers/video/ati-gt.h	Mon Aug 10 21:08:16 1998
@@ -1,203 +0,0 @@
-/* the usage for the following structs vary from the gx and vt:
-and sdram and sgram gt's
-	pll registers (sdram) 6,7,11;
-	crtc_h_sync_strt_wid[3];
-	dsp1[3] (sdram,sgram,unused)
-	dsp2[3] (offset regbase+24, depends on colour mode);
-	crtc_h_tot_disp,crtc_v_tot_disp,crtc_v_sync_strt_wid,unused;
-	pll registers (sgram) 7,11;
-*/
-
-/* Register values for 1280x1024, 75Hz mode (20). no 16/32 */
-static struct aty_regvals aty_gt_reg_init_20 = {
-	{ 0x41, 0xf9, 0x04 },
-	{ 0xe02a7, 0x1401a6, 0 },
-	{ 0x260957, 0x2806d6, 0 },
-	{ 0x10006b6, 0x20006b6, 0x30006b6 },
-
-	0x9f00d2, 0x03ff0429, 0x30400, 0,
-	{ 0xb5, 0x04 }
-};
-
-#if 0
-/* Register values for 1280x960, 75Hz mode (19) */
-static struct aty_regvals aty_gt_reg_init_19 = {
-};
-#endif
-
-/* Register values for 1152x870, 75Hz mode (18) */
-static struct aty_regvals aty_gt_reg_init_18 = {
-	{ 0x41, 0xe6, 0x04 },
-	{ 0x300295, 0x300194, 0x300593 },
-	{ 0x260a1c, 0x380561, 0},
-	{ 0x1000744, 0x2000744, 0x3000744 },
-
-	0x8f00b5, 0x3650392, 0x230368, 0,
-	{ 0xe6, 0x04 }
-};
-
-/* Register values for 1024x768, 75Hz mode (17), 32 bpp untested */
-static struct aty_regvals aty_gt_reg_init_17 = {
-	{ 0x41, 0xb5, 0x04 },
-	{ 0xc0283, 0xc0182, 0xc0581 },
-	{ 0x36066d, 0x3806d6, 0},
-	{ 0xa0049e, 0x100049e, 0x200049e },
-
-	0x7f00a3, 0x2ff031f, 0x30300, 0,
-	{ 0xb8, 0x04 }
-};
-
-#if 0
-/* Register values for x, Hz mode (16) */
-static struct aty_regvals aty_gt_reg_init_16 = {
-};
-#endif
-
-/* Register values for 1024x768, 70Hz mode (15) */
-static struct aty_regvals aty_gt_reg_init_15 = {
-	{ 0x41, 0xad, 0x04 },
-	{ 0x310284, 0x310183, 0x310582 },
-	{ 0x0, 0x380727 },
-	{ 0x0 },
-	0x7f00a5, 0x2ff0325, 0x260302,
-};    
-
-/* Register values for 1024x768, 60Hz mode (14) */
-static struct aty_regvals aty_gt_reg_init_14 = {
-	{ 0x40, 0xe1, 0x14 },
-	{ 0x310284, 0x310183, 0x310582 },
-	{ 0x3607c0, 0x380840, 0x0 },
-	{ 0xa80592, 0x1000592, 0x0 },
-
-	0x7f00a7, 0x2ff0325, 0x260302, 0,
-	{ 0xe1, 0x14 }
-};  
-
-/* Register values for 832x624, 75Hz mode (13) */
-static struct aty_regvals aty_gt_reg_init_13 = {
-	{ 0x40, 0xc6, 0x14 },
-	{ 0x28026d, 0x28016c, 0x28056b },
-	{ 0x3608cf, 0x380960, 0 },
-	{ 0xb00655, 0x1000655, 0x2000655 },
-
-	0x67008f, 0x26f029a, 0x230270, 0,
-	{ 0xc6, 0x14 }
-};
-
-/* Register values for 800x600, 75Hz mode (12) */
-static struct aty_regvals aty_gt_reg_init_12 = {
-	{ 0x42, 0xe4, 0x04 },
-	{ 0xa0267, 0xa0166, 0x0a0565},
-	{ 0x360a33, 0x48056d, 0},
-	{ 0xc00755, 0x1000755, 0x02000755},
-
-	0x630083, 0x2570270, 0x30258, 0,
-	{ 0xe4, 0x4 }
-};
-
-/* Register values for 800x600, 72Hz mode (11) */
-static struct aty_regvals aty_gt_reg_init_11 = {
-	{ 0x42, 0xe6, 0x04 },
-	{ 0xf026c, 0xf016b, 0xf056a },
-	{ 0x360a1d, 0x480561, 0},
-	{ 0xc00745, 0x1000745, 0x2000745 },
-	
-	0x630081, 0x02570299, 0x6027c
-};
-
-/* Register values for 800x600, 60Hz mode (10) */
-static struct aty_regvals aty_gt_reg_init_10 = {
-	{ 0x42, 0xb8, 0x04 },
-	{ 0x10026a, 0x100169, 0x100568 },
-	{ 0x460652, 0x4806ba, 0},
-	{ 0x68048b, 0xa0048b, 0x100048b },
-
-	0x630083, 0x02570273, 0x40258, 0,
-	{ 0xb8, 0x4 }
-};
-
-/* Register values for 800x600, 56Hz mode (9) */
-static struct aty_regvals aty_gt_reg_init_9 = {
-	{ 0x42, 0xf9, 0x14 },
-	{ 0x90268, 0x90167, 0x090566 },
-	{ 0x460701, 0x480774, 0},
-	{ 0x700509, 0xa80509, 0x1000509 },
-
-	0x63007f, 0x2570270, 0x20258
-};
-
-#if 0
-/* Register values for 768x576, 50Hz mode (8) */
-static struct aty_regvals aty_gt_reg_init_8 = {
-};
-
-/* Register values for 640x870, 75Hz Full Page Display (7) */
-static struct aty_regvals aty_gt_reg_init_7 = {
-};
-#endif
-
-/* Register values for 640x480, 67Hz mode (6) */
-static struct aty_regvals aty_gt_reg_init_6 = {
-	{ 0x42, 0xd1, 0x14 },
-	{ 0x280259, 0x280158, 0x280557 },
-	{ 0x460858, 0x4808e2, 0},
-	{ 0x780600, 0xb00600, 0x1000600 },
-
-	0x4f006b, 0x1df020c, 0x2301e2, 0,
-	{ 0x8b, 0x4 }
-};
-
-/* Register values for 640x480, 60Hz mode (5) */
-static struct aty_regvals aty_gt_reg_init_5 = {
-	{ 0x43, 0xe8, 0x04 },
-	{ 0x2c0253, 0x2c0152, 0x2c0551 },
-	{ 0x460a06, 0x580555, 0},
-	{ 0x880734, 0xc00734, 0x1000734 },
-
-	0x4f0063, 0x1df020c, 0x2201e9, 0,
-	{ 0xe8, 0x04 }
-};
-
-#if 0
-/* Register values for x, Hz mode (4) */
-static struct aty_regvals aty_gt_reg_init_4 = {
-};
-
-/* Register values for x, Hz mode (3) */
-static struct aty_regvals aty_gt_reg_init_3 = {
-};
-
-/* Register values for x, Hz mode (2) */
-static struct aty_regvals aty_gt_reg_init_2 = {
-};
-
-/* Register values for x, Hz mode (1) */
-static struct aty_regvals aty_gt_reg_init_1 = {
-};
-#endif
-
-/* yikes, more data structures (dsp2)
- * XXX kludge for sgram
- */
-static int sgram_dsp[20][3] = {
-	{0,0,0},
-	{0,0,0},
-	{0,0,0},
-	{0,0,0},
-	{0x5203d7,0x7803d9,0xb803dd}, //5
-	{0x940666,0xe0066a,0x1700672}, //6
-	{0,0,0},
-	{0,0,0},
-	{0x88055f,0xd80563,0x170056b}, //9
-	{0x8404d9,0xb804dd,0x17004e5}, //10
-	{0x7803e2,0xb803e6,0x17003ee}, //11
-	{0x7803eb,0xb803ef,0x17003f7}, //12
-	{0xe806c5,0x17006cd,0x2e006dd}, //13
-	{0xe005f6,0x17005fe,0x2e0060e}, //14
-	{0xd8052c,0x1700534,0x2e00544}, //15
-	{0,0,0},
-	{0xb804f2,0x17004e5,0x2e0050a}, //17
-	{0xb803e6,0x17003ee,0x2e003fe}, //18
-	{0,0,0},
-	{0,0,0},
-};
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/ati-gx.h m68k/drivers/video/ati-gx.h
--- jes-2.1.115/drivers/video/ati-gx.h	Tue Mar 24 19:08:18 1998
+++ m68k/drivers/video/ati-gx.h	Mon Aug 10 21:08:16 1998
@@ -1,122 +0,0 @@
-/* Register values for 1280x1024, 75Hz (WAS 60) mode (20) */
-static struct aty_regvals aty_gx_reg_init_20 = {
-   { 0x200, 0x200, 0x200 },
-
-    { 0x1200a5, 0x1200a3, 0x1200a3 },
-    { 0x30c0200, 0x30e0300, 0x30e0300 },
-    { 0x2, 0x3, 0x3 },
-
-    0x9f00d2, 0x3ff0429, 0x30400, 0x28100040,
-    { 0xd4, 0x9 }
-};     
-
-/* Register values for 1152x870, 75Hz mode (18) */
-static struct aty_regvals aty_gx_reg_init_18 = {
-    { 0x200, 0x200, 0x200 },
-
-    { 0x300097, 0x300095, 0x300094 },
-    { 0x3090200, 0x30e0300, 0x30e0600 },
-    { 0x2, 0x3, 0x6 },
-
-    0x8f00b5, 0x3650392, 0x230368, 0x24100040,
-    { 0x53, 0x3 }
-};
-
-/* Register values for 1024x768, 75Hz mode (17) */
-static struct aty_regvals aty_gx_reg_init_17 = {
-    { 0x200, 0x200, 0x200 },
-
-    { 0x2c0087, 0x2c0085, 0x2c0084 },
-    { 0x3070200, 0x30e0300, 0x30e0600 },
-    { 0x2, 0x3, 0x6 },
-
-    0x7f00a5, 0x2ff0323, 0x230302, 0x20100000,
-    { 0x42, 0x3 }
-};
-
-/* Register values for 1024x768, 72Hz mode (15) */
-static struct aty_regvals aty_gx_reg_init_15 = {
-    { 0, 0, 0 },
-
-    { 0x310086, 0x310084, 0x310084 },
-    { 0x3070200, 0x30e0300, 0x30e0300 },
-    { 0x2002312, 0x3002312, 0x3002312 },
-
-    0x7f00a5, 0x2ff0325, 0x260302, 0x20100000,
-    { 0x88, 0x7 }
-};    
-
-/* Register values for 1024x768, 60Hz mode (14) */
-static struct aty_regvals aty_gx_reg_init_14 = {
-	{ 0, 0, 0 },
-
-	{ 0x310086, 0x310084, 0x310084 },
-	{ 0x3060200, 0x30d0300, 0x30d0300 },
-	{ 0x2002312, 0x3002312, 0x3002312 },
-
-	0x7f00a7, 0x2ff0325, 0x260302, 0x20100000,
-	{ 0x6c, 0x6 }
-};  
-
-/* Register values for 832x624, 75Hz mode (13) */
-static struct aty_regvals aty_gx_reg_init_13 = {
-    { 0x200, 0x200, 0x200 },
-
-    { 0x28006f, 0x28006d, 0x28006c },
-    { 0x3050200, 0x30b0300, 0x30e0600 },
-    { 0x2, 0x3, 0x6 },
-
-    0x67008f, 0x26f029a, 0x230270, 0x1a100040,
-    { 0x4f, 0x5 }
-};
-
-#if 0		/* not filled in yet */
-/* Register values for 800x600, 75Hz mode (12) */
-static struct aty_regvals aty_gx_reg_init_12 = {
-	{ 0x10, 0x28, 0x50 },
-	{ },
-	{ }	/* pixel clock = 49.11MHz for V=74.40Hz */
-};
-
-/* Register values for 800x600, 72Hz mode (11) */
-static struct aty_regvals aty_gx_reg_init_11 = {
-	{ 0x10, 0x28, 0x50 },
-	{ },
-	{ }	/* pixel clock = 49.63MHz for V=71.66Hz */
-};
-
-/* Register values for 800x600, 60Hz mode (10) */
-static struct aty_regvals aty_gx_reg_init_10 = {
-	{ 0x10, 0x28, 0x50 },
-	{ },
-	{ }	/* pixel clock = 41.41MHz for V=59.78Hz */
-};
-
-/* Register values for 640x870, 75Hz Full Page Display (7) */
-static struct aty_regvals aty_gx_reg_init_7 = {
-	{ 0x10, 0x30, 0x68 },
-	{ },
-	{ }	/* pixel clock = 57.29MHz for V=75.01Hz */
-};
-#endif
-
-/* Register values for 640x480, 67Hz mode (6) */
-static struct aty_regvals aty_gx_reg_init_6 = {
-	{ 0x200, 0x200, 0x200 },
-
-	{ 0x28005b, 0x280059, 0x280058 },
-	{ 0x3040200, 0x3060300, 0x30c0600 },
-	{ 0x2002312, 0x3002312, 0x6002312 },
-
-	0x4f006b, 0x1df020c, 0x2301e2, 0x14100040,
-        { 0x35, 0x07 }
-};
-
-#if 0		/* not filled in yet */
-/* Register values for 640x480, 60Hz mode (5) */
-static struct aty_regvals aty_gx_reg_init_5 = {
-	{ 0x200, 0x200, 0x200 },
-	{ },
-        { 0x35, 0x07 }
-};
-#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/ati-vt.h m68k/drivers/video/ati-vt.h
--- jes-2.1.115/drivers/video/ati-vt.h	Sun Feb  8 22:35:52 1998
+++ m68k/drivers/video/ati-vt.h	Mon Aug 10 21:08:16 1998
@@ -1,147 +0,0 @@
-/* Register values for 1280x1024, 60Hz mode (20) */
-static struct aty_regvals aty_vt_reg_init_20 = {
-  { 0, 0, 0 },
-     
-  { 0x002e02a7, 0x002e02a7, 0 },
-  { 0x03070200, 0x03070200, 0 },
-  { 0x0a00cb22, 0x0b00cb23, 0 },
-     
-    0x009f00d2, 0x03ff0429, 0x00030400, 0x28000000,
-  { 0x00, 0xaa }
-};
-
-/* Register values for 1280x960, 75Hz mode (19) */
-static struct aty_regvals aty_vt_reg_init_19 = {
-  { 0, 0, 0 },
-  { 0x003202a3, 0x003201a2, 0 },
-  { 0x030b0200, 0x030b0300, 0 },
-  { 0x0a00cb22, 0x0b00cb23, 0 },
-
-    0x009f00d1, 0x03bf03e7, 0x000303c0, 0x28000000,
-  { 0x00, 0xc6 }
-};
-
-/* Register values for 1152x870, 75Hz mode (18) */
-static struct aty_regvals aty_vt_reg_init_18 = {
-  { 0, 0, 0 },
-     
-  { 0x00300295, 0x00300194, 0 },
-  { 0x03080200, 0x03080300, 0 },
-  { 0x0a00cb21, 0x0b00cb22, 0 },
-     
-    0x008f00b5, 0x03650392, 0x00230368, 0x24000000,
-  { 0x00, 0x9d }
-};
-
-/* Register values for 1024x768, 75Hz mode (17) */
-static struct aty_regvals aty_vt_reg_init_17 = {
-  { 0, 0, 0 },
-
-  { 0x002c0283, 0x002c0182, 0 },
-  { 0x03080200, 0x03080300, 0 },
-  { 0x0a00cb21, 0x0b00cb22, 0 },
-     
-    0x007f00a3, 0x02ff031f, 0x00030300, 0x20000000,
-  { 0x01, 0xf7 }
-};
-
-/* Register values for 1024x768, 70Hz mode (15) */
-static struct aty_regvals aty_vt_reg_init_15 = {
-  { 0, 0, 0 },
-  { 0x00310284, 0x00310183, 0 },
-  { 0x03080200, 0x03080300, 0 },
-  { 0x0a00cb21, 0x0b00cb22, 0 },
-
-    0x007f00a5, 0x02ff0325, 0x00260302, 0x20000000,
-  { 0x01, 0xeb }
-};    
-
-/* Register values for 1024x768, 60Hz mode (14) */
-static struct aty_regvals aty_vt_reg_init_14 = {
-  { 0, 0, 0 },
-     
-  { 0x00310284, 0x00310183, 0x00310582 }, /* 32 bit 0x00310582 */
-  { 0x03080200, 0x03080300, 0x03070600 }, /* 32 bit 0x03070600 */
-  { 0x0a00cb21, 0x0b00cb22, 0x0e00cb23 },
-    
-    0x007f00a7, 0x02ff0325, 0x00260302, 0x20000000,
-  { 0x01, 0xcc }
-};  
-
-/* Register values for 832x624, 75Hz mode (13) */
-static struct aty_regvals aty_vt_reg_init_13 = {
-  { 0, 0, 0 },
-
-  { 0x0028026d, 0x0028016c, 0x0028056b },
-  { 0x03080200, 0x03070300, 0x03090600 },
-  { 0x0a00cb21, 0x0b00cb21, 0x0e00cb22 },
-
-    0x0067008f, 0x026f029a, 0x00230270, 0x1a000000,
-  { 0x01, 0xb4 }
-};
-
-/* Register values for 800x600, 75Hz mode (12) */
-static struct aty_regvals aty_vt_reg_init_12 = {
-  { 0, 0, 0 },
-     
-  { 0x002a0267, 0x002a0166, 0x002a0565 },
-  { 0x03040200, 0x03060300, 0x03070600 },
-  { 0x0a00cb21, 0x0b00cb21, 0x0e00cb22 },
-     
-    0x00630083, 0x02570270, 0x00030258, 0x19000000,
-  { 0x01, 0x9c }
-};
-
-/* Register values for 800x600, 72Hz mode (11) */
-static struct aty_regvals aty_vt_reg_init_11 = {
-  { 0, 0, 0 },
-     
-  { 0x002f026c, 0x002f016b, 0x002f056a },
-  { 0x03050200, 0x03070300, 0x03090600 },
-  { 0x0a00cb21, 0x0b00cb21, 0x0e00cb22 },
-
-    0x00630081, 0x02570299, 0x0006027c, 0x19000000,
-  { 0x01, 0x9d }
-};
-
-/* Register values for 800x600, 60Hz mode (10) */
-static struct aty_regvals aty_vt_reg_init_10 = {
-  { 0, 0, 0 },
-     
-  { 0x0030026a, 0x00300169, 0x00300568 },
-  { 0x03050200, 0x03070300, 0x03090600 },
-  { 0x0a00cb21, 0x0b00cb21, 0x0e00cb22 },
-     
-    0x00630083, 0x02570273, 0x00040258, 0x19000000,
-  { 0x02, 0xfb }
-};
-
-/* Register values for 640x480, 67Hz mode (6) */
-static struct aty_regvals aty_vt_reg_init_6 = {
-  { 0, 0, 0 },
-      
-  { 0x00280259, 0x00280158, 0x00280557 },
-  { 0x03050200, 0x03070300, 0x030a0600 },
-  { 0x0a00cb21, 0x0b00cb21, 0x0e00cb22 },
-      
-    0x004f006b, 0x01df020c, 0x002301e2, 0x14000000,
-  { 0x02, 0xbe }
-};
-
-/* Register values for 640x480, 60Hz mode (5) */
-static struct aty_regvals aty_vt_reg_init_5 = {
-  { 0, 0, 0 },
-      
-  { 0x002c0253, 0x002c0152, 0x002c0551 },
-  { 0x03050200, 0x03070300, 0x03090600 },
-  { 0x0a00cb21, 0x0b00cb21, 0x0e00cb22 },
-
-    0x004f0063, 0x01df020c, 0x002201e9, 0x14000000,
-  { 0x02, 0x9e }
-};
-                               /*     8 bit       15 bit      32 bit   */
-static int vt_mem_cntl[3][3] = { { 0x0A00CB21, 0x0B00CB21, 0x0E00CB21 },  /* 1 MB VRAM */
-                                 { 0x0A00CB22, 0x0B00CB22, 0x0E00CB22 },  /* 2 MB VRAM */
-                                { 0x0200053B, 0x0300053B, 0x0600053B }   /* 4 M B VRAM */
- };
-
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/atyfb.c m68k/drivers/video/atyfb.c
--- jes-2.1.115/drivers/video/atyfb.c	Sun Aug  9 21:48:27 1998
+++ m68k/drivers/video/atyfb.c	Wed Aug 12 09:29:24 1998
@@ -1,9 +1,9 @@
 /*
  *  linux/drivers/video/atyfb.c -- Frame buffer device for ATI Mach64
  *
- *	Copyright (C) 1997-1998 Geert Uytterhoeven
- *	Copyright (C) 1998 Bernd Harries
- *	Copyright (C) 1998 Eddie C. Dost
+ *	Copyright (C) 1997-1998  Geert Uytterhoeven
+ *	Copyright (C) 1998  Bernd Harries
+ *	Copyright (C) 1998  Eddie C. Dost  (ecd@skynet.be)
  *
  *  This driver is partly based on the PowerMac console driver:
  *
@@ -26,17 +26,10 @@
 
   TODO:
 
-  (ecd):
+    - cursor support on all cards and all ramdacs.
+    - cursor parameters controlable via ioctl()s.
 
-    - fix initialization of cursor timer.
-
-    - add code to detect ramdac type on initialization.
-
-    - add code to support cursor on all cards and all ramdacs.
-
-    - make cursor parameters controllable via ioctl()s.
-
-						(Anyone to help with all this?)
+						(Anyone to help with this?)
 
 ******************************************************************************/
 
@@ -58,6 +51,8 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/nvram.h>
+#include <linux/kd.h>
+#include <linux/vt_kern.h>
 
 #ifdef CONFIG_FB_COMPAT_XPMAC
 #include <asm/vc_ioctl.h>
@@ -72,6 +67,8 @@
 #endif
 #ifdef __sparc__
 #include <asm/pbm.h>
+#include <asm/fbio.h>
+#include <asm/uaccess.h>
 #endif
 
 #include "aty.h"
@@ -82,6 +79,12 @@
 #include "fbcon-cfb32.h"
 
 
+/*
+ * Debug flags.
+ */
+#undef PLL_DEBUG
+
+
 #define GUI_RESERVE	0x00001000
 
 #define CLASS_GX	1
@@ -179,6 +182,7 @@
     u32 color[2];
     u8 bits[8][64];
     u8 mask[8][64];
+    u8 *ram;
     struct timer_list *timer;
 };
 
@@ -188,8 +192,6 @@
     unsigned long ati_regbase;
     unsigned long frame_buffer_phys;
     unsigned long frame_buffer;
-    struct display disp;
-    struct display_switch dispsw;
     struct pci_mmap_map *mmap_map;
     struct aty_cursor *cursor;
     struct aty_cmap_regs *aty_cmap_regs;
@@ -208,6 +210,29 @@
     u8 dac_type;
     u8 clk_type;
     u8 mem_refresh_rate;
+    struct display disp;
+#ifdef FBCON_HAS_CFB8
+    struct display_switch disp8;
+    struct display_switch adisp8;
+#endif
+#ifdef FBCON_HAS_CFB16
+    struct display_switch disp16;
+    struct display_switch adisp16;
+#endif
+#ifdef FBCON_HAS_CFB24
+    struct display_switch disp24;
+    struct display_switch adisp24;
+#endif
+#ifdef FBCON_HAS_CFB32
+    struct display_switch disp32;
+    struct display_switch adisp32;
+#endif
+#ifdef __sparc__
+    u8 open;
+    u8 mmaped;
+    int vtconsole;
+    int consolecnt;
+#endif
 };
 
 
@@ -293,6 +318,7 @@
      */
 
 static int aty_init(struct fb_info_aty *info, const char *name);
+static struct aty_cursor *aty_init_cursor(struct fb_info_aty *fb);
 #ifdef CONFIG_ATARI
 static int store_video_par(char *videopar, unsigned char m64_num);
 static char *strtoke(char *s, const char *ct);
@@ -303,6 +329,9 @@
 			const struct fb_info_aty *info);
 static void aty_st_514(int offset, u8 val, const struct fb_info_aty *info);
 static void aty_st_pll(int offset, u8 val, const struct fb_info_aty *info);
+#ifdef PLL_DEBUG
+static u8 aty_ld_pll(int offset, const struct fb_info_aty *info);
+#endif
 static void aty_set_crtc(const struct fb_info_aty *info,
 			 const struct crtc *crtc);
 static int aty_var_to_crtc(const struct fb_info_aty *info,
@@ -313,22 +342,17 @@
 			   struct fb_var_screeninfo *var);
 static void aty_set_pll_gx(const struct fb_info_aty *info,
 			   const struct pll_gx *pll);
-static int aty_var_to_pll_18818(const struct fb_var_screeninfo *var,
-				struct pll_gx *pll);
-static int aty_var_to_pll_514(const struct fb_var_screeninfo *var,
-			      struct pll_gx *pll);
-static int aty_pll_gx_to_var(const struct pll_gx *pll,
-			     struct fb_var_screeninfo *var);
+static int aty_var_to_pll_18818(u32 vclk_per, struct pll_gx *pll);
+static int aty_var_to_pll_514(u32 vclk_per, struct pll_gx *pll);
+static int aty_pll_gx_to_var(const struct pll_gx *pll, u32 *vclk_per);
 static void aty_set_pll_ct(const struct fb_info_aty *info,
 			   const struct pll_ct *pll);
 static int aty_dsp_gt(const struct fb_info_aty *info, u8 mclk_fb_div,
 		      u8 mclk_post_div, u8 vclk_fb_div, u8 vclk_post_div,
 		      u8 bpp, struct pll_ct *pll);
-static int aty_var_to_pll_ct(const struct fb_info_aty *info,
-			     const struct fb_var_screeninfo *var,
-			     struct pll_ct *pll);
-static int aty_pll_ct_to_var(const struct pll_ct *pll,
-			     struct fb_var_screeninfo *var);
+static int aty_var_to_pll_ct(const struct fb_info_aty *info, u32 vclk_per,
+			     u8 bpp, struct pll_ct *pll);
+static int aty_pll_ct_to_var(const struct pll_ct *pll, u32 *vclk_per);
 static void atyfb_set_par(const struct atyfb_par *par,
 			  struct fb_info_aty *info);
 static int atyfb_decode_var(const struct fb_var_screeninfo *var,
@@ -434,7 +458,7 @@
 #if defined(__powerpc__)
     temp = info->ati_regbase;
     asm("lwbrx %0,%1,%2" : "=r"(val) : "r" (regindex), "r" (temp));
-#elif defined(__sparc__v9__)
+#elif defined(__sparc_v9__)
     temp = info->ati_regbase + regindex;
     asm("lduwa [%1] %2, %0" : "=r" (val) : "r" (temp), "i" (ASI_PL));
 #else
@@ -453,9 +477,9 @@
     temp = info->ati_regbase;
     asm("stwbrx %0,%1,%2" : : "r" (val), "r" (regindex), "r" (temp) :
 	"memory");
-#elif defined(__sparc__v9__)
+#elif defined(__sparc_v9__)
     temp = info->ati_regbase + regindex;
-    asm("stwa %0, [%1] %2" : "r" (val), "r" (temp), "i" (ASI_PL) : "memory");
+    asm("stwa %0, [%1] %2" : : "r" (val), "r" (temp), "i" (ASI_PL) : "memory");
 #else
     temp = info->ati_regbase+regindex;
     *((volatile u32 *)(temp)) = cpu_to_le32(val);
@@ -642,20 +666,20 @@
     aty_st_8(CLOCK_CNTL + 1, (offset << 2) & ~PLL_WR_EN, info);
 }
 
-#if 0 /* ecd debug */
+#ifdef PLL_DEBUG
 static u8 aty_ld_pll(int offset, const struct fb_info_aty *info)
 {
-    u8 val;
+    u8 res;
 
     /* write addr byte */
     aty_st_8(CLOCK_CNTL + 1, (offset << 2), info);
     eieio();
     /* read the register value */
-    val = aty_ld_8(CLOCK_CNTL + 2, info);
+    res = aty_ld_8(CLOCK_CNTL + 2, info);
     eieio();
-    return val;
+    return res;
 }
-#endif /* ecd debug */
+#endif
 
 #if defined(CONFIG_PMAC) || defined(CONFIG_CHRP)
 
@@ -730,6 +754,11 @@
 	if (!c)
 		return;
 
+#ifdef __sparc__
+	if (fb->mmaped && currcon == fb->vtconsole)
+		return;
+#endif
+
 	for (i = 0; i < 2; i++) {
 		c->color[i] =  (u32)red[i] << 24;
 		c->color[i] |= (u32)green[i] << 16;
@@ -740,7 +769,6 @@
 	wait_for_fifo(2, fb);
 	aty_st_le32(CUR_CLR0, c->color[0], fb);
 	aty_st_le32(CUR_CLR1, c->color[1], fb);
-	wait_for_idle(fb);
 }
 
 static void
@@ -753,8 +781,12 @@
 	if (!c)
 		return;
 
-	ram = (u8 *)(fb->frame_buffer + c->offset);
+#ifdef __sparc__
+	if (fb->mmaped && currcon == fb->vtconsole)
+		return;
+#endif
 
+	ram = c->ram;
 	for (y = 0; y < c->size.y; y++) {
 		for (x = 0; x < c->size.x >> 2; x++) {
 			m = c->mask[x][y];
@@ -782,6 +814,11 @@
 	if (!c)
 		return;
 
+#ifdef __sparc__
+	if (fb->mmaped && currcon == fb->vtconsole)
+		return;
+#endif
+
 	if (c->on) {
 		x = c->pos.x - c->hot.x;
 		if (x < 0) {
@@ -812,7 +849,6 @@
 			    aty_ld_le32(GEN_TEST_CNTL, fb) & ~HWCURSOR_ENABLE,
 			    fb);
 	}
-	wait_for_idle(fb);
 }
 
 static void
@@ -838,16 +874,21 @@
 }
 
 static void
-atyfb_cursor(struct display *d, int mode, int x, int y)
+atyfb_cursor(struct display *p, int mode, int x, int y)
 {
-	struct fb_info_aty *fb = (struct fb_info_aty *)d->fb_info;
+	struct fb_info_aty *fb = (struct fb_info_aty *)p->fb_info;
 	struct aty_cursor *c = fb->cursor;
 
 	if (!c)
 		return;
 
-	x *= d->fontwidth;
-	y *= d->fontheight;
+#ifdef __sparc__
+	if (fb->mmaped && currcon == fb->vtconsole)
+		return;
+#endif
+
+	x *= fontwidth(p);
+	y *= fontheight(p);
 	if (c->pos.x == x && c->pos.y == y && (mode == CM_ERASE) == !c->on)
 		return;
 
@@ -866,26 +907,55 @@
 		c->on = 1;
 		aty_set_cursor(fb);
 
-		if (!c->timer) {
-			c->timer = kmalloc(sizeof(*c->timer), GFP_KERNEL);
-			if (!c->timer)
-				return;
-
-			c->blink_rate = DEFAULT_CURSOR_BLINK_RATE;
-
-			init_timer(c->timer);
-			c->timer->expires = jiffies + (HZ / 50);
-			c->timer->data = (unsigned long)fb;
-			c->timer->function = aty_cursor_timer_handler;
-			add_timer(c->timer);
-		}
-
 		c->vbl_cnt = c->blink_rate;
 		c->enable = 1;
 		break;
 	}
 }
 
+static struct aty_cursor *
+aty_init_cursor(struct fb_info_aty *fb)
+{
+	struct aty_cursor *cursor;
+	unsigned long addr;
+
+	cursor = kmalloc(sizeof(struct aty_cursor), GFP_ATOMIC);
+	if (!cursor)
+		return 0;
+	memset(cursor, 0, sizeof(*cursor));
+
+	cursor->timer = kmalloc(sizeof(*cursor->timer), GFP_KERNEL);
+	if (!cursor->timer) {
+		kfree(cursor);
+		return 0;
+	}
+	memset(cursor->timer, 0, sizeof(*cursor->timer));
+
+	cursor->blink_rate = DEFAULT_CURSOR_BLINK_RATE;
+	cursor->offset = fb->total_vram - 0x1000;
+
+#ifdef __sparc__
+	addr = fb->frame_buffer - 0x800000 + cursor->offset;
+	cursor->ram = (u8 *)addr;
+#else
+#ifdef __BIG_ENDIAN
+	addr = fb->frame_buffer_phys - 0x800000 + cursor->offset;
+	cursor->ram = (u8 *)ioremap(addr, 1024);
+#else
+	addr = fb->frame_buffer + cursor->offset;
+	cursor->ram = (u8 *)addr;
+#endif
+#endif
+
+	init_timer(cursor->timer);
+	cursor->timer->expires = jiffies + (HZ / 50);
+	cursor->timer->data = (unsigned long)fb;
+	cursor->timer->function = aty_cursor_timer_handler;
+	add_timer(cursor->timer);
+
+	return cursor;
+}
+
 static int
 atyfb_set_font(struct display *d, int width, int height)
 {
@@ -899,7 +969,6 @@
 	    height = 16;
 	}
 
-	c->offset = fb->total_vram - 0x1000;
 	c->hot.x = 0;
 	c->hot.y = 0;
 	c->size.x = width;
@@ -948,7 +1017,7 @@
     u32 xres, yres, vxres, vyres, xoffset, yoffset, bpp;
     u32 left, right, upper, lower, hslen, vslen, sync, vmode;
     u32 h_total, h_disp, h_sync_strt, h_sync_dly, h_sync_wid, h_sync_pol;
-    u32 v_total, v_disp, v_sync_strt, v_sync_wid, v_sync_pol;
+    u32 v_total, v_disp, v_sync_strt, v_sync_wid, v_sync_pol, c_sync;
     u32 pix_width, dp_pix_width, dp_chain_mask;
 
     /* input */
@@ -1005,6 +1074,8 @@
 	FAIL("v_total too large");
     v_sync_pol = sync & FB_SYNC_VERT_HIGH_ACT ? 0 : 1;
 
+    c_sync = sync & FB_SYNC_COMP_HIGH_ACT ? CRTC_CSYNC_EN : 0;
+
     if (bpp <= 8) {
 	bpp = 8;
 	pix_width = CRTC_PIX_WIDTH_8BPP;
@@ -1049,7 +1120,7 @@
     crtc->v_tot_disp = v_total | (v_disp<<16);
     crtc->v_sync_strt_wid = v_sync_strt | (v_sync_wid<<16) | (v_sync_pol<<21);
     crtc->off_pitch = ((yoffset*vxres+xoffset)*bpp/64) | (vxres<<19);
-    crtc->gen_cntl = pix_width | CRTC_EXT_DISP_EN | CRTC_ENABLE;
+    crtc->gen_cntl = pix_width | c_sync | CRTC_EXT_DISP_EN | CRTC_ENABLE;
     if ((Gx == CT_CHIP_ID) || (Gx == ET_CHIP_ID) ||
 	((Gx == VT_CHIP_ID) && !(Rev & 0x03)) ||
 	((Gx == GT_CHIP_ID) && !(Rev & 0x03))) {
@@ -1105,7 +1176,7 @@
 {
     u32 xres, yres, bpp, left, right, upper, lower, hslen, vslen, sync;
     u32 h_total, h_disp, h_sync_strt, h_sync_dly, h_sync_wid, h_sync_pol;
-    u32 v_total, v_disp, v_sync_strt, v_sync_wid, v_sync_pol;
+    u32 v_total, v_disp, v_sync_strt, v_sync_wid, v_sync_pol, c_sync;
     u32 pix_width;
 
     /* input */
@@ -1121,19 +1192,21 @@
     v_sync_strt = crtc->v_sync_strt_wid & 0x7ff;
     v_sync_wid = (crtc->v_sync_strt_wid>>16) & 0x1f;
     v_sync_pol = (crtc->v_sync_strt_wid>>21) & 0x1;
+    c_sync = crtc->gen_cntl & CRTC_CSYNC_EN ? 1 : 0;
     pix_width = crtc->gen_cntl & CRTC_PIX_WIDTH_MASK;
 
     /* convert */
     xres = (h_disp+1)*8;
     yres = v_disp+1;
     left = (h_total-h_sync_strt-h_sync_wid)*8-h_sync_dly;
-    right = (h_sync_strt-h_disp)*8;
+    right = (h_sync_strt-h_disp)*8+h_sync_dly;
     hslen = h_sync_wid*8;
     upper = v_total-v_sync_strt-v_sync_wid;
     lower = v_sync_strt-v_disp;
     vslen = v_sync_wid;
     sync = (h_sync_pol ? 0 : FB_SYNC_HOR_HIGH_ACT) |
-	   (v_sync_pol ? 0 : FB_SYNC_VERT_HIGH_ACT);
+	   (v_sync_pol ? 0 : FB_SYNC_VERT_HIGH_ACT) |
+	   (c_sync ? FB_SYNC_COMP_HIGH_ACT : 0);
 
     switch (pix_width) {
 #if 0
@@ -1209,6 +1282,10 @@
 	default:
 	    FAIL("Invalid pixel width");
     }
+    var->red.msb_right = 0;
+    var->green.msb_right = 0;
+    var->blue.msb_right = 0;
+    var->transp.msb_right = 0;
 
     /* output */
     var->xres = xres;
@@ -1258,8 +1335,7 @@
     }
 }
 
-static int aty_var_to_pll_18818(const struct fb_var_screeninfo *var,
-				struct pll_gx *pll)
+static int aty_var_to_pll_18818(u32 vclk_per, struct pll_gx *pll)
 {
     /*
      *  FIXME: use real calculations instead of using fixed values from the old
@@ -1305,7 +1381,7 @@
 
     for (set = 0; set < sizeof(ATI18818_clocks)/sizeof(*ATI18818_clocks);
 	 set++)
-	if (var->pixclock <= ATI18818_clocks[set].ps_lim) {
+	if (vclk_per <= ATI18818_clocks[set].ps_lim) {
 	    pll->m = ATI18818_clocks[set].mode;
 	    pll->n = ATI18818_clocks[set].prog;
 	    return 0;
@@ -1313,8 +1389,7 @@
     return -EINVAL;
 }
 
-static int aty_var_to_pll_514(const struct fb_var_screeninfo *var,
-			      struct pll_gx *pll)
+static int aty_var_to_pll_514(u32 vclk_per, struct pll_gx *pll)
 {
     /*
      *  FIXME: use real calculations instead of using fixed values from the old
@@ -1336,7 +1411,7 @@
     int i;
 
     for (i = 0; i < sizeof(RGB514_clocks)/sizeof(*RGB514_clocks); i++)
-	if (var->pixclock <= RGB514_clocks[i].limit) {
+	if (vclk_per <= RGB514_clocks[i].limit) {
 	    pll->m = RGB514_clocks[i].m;
 	    pll->n = RGB514_clocks[i].n;
 	    return 0;
@@ -1346,8 +1421,7 @@
 
     /* FIXME: ATI18818?? */
 
-static int aty_pll_gx_to_var(const struct pll_gx *pll,
-			     struct fb_var_screeninfo *var)
+static int aty_pll_gx_to_var(const struct pll_gx *pll, u32 *vclk_per)
 {
     u8 df, vco_div_count, ref_div_count;
 
@@ -1355,7 +1429,7 @@
     vco_div_count = pll->m & 0x3f;
     ref_div_count = pll->n;
 
-    var->pixclock = (ref_clk_per*(vco_div_count+65)/ref_div_count)>>(3-df);
+    *vclk_per = (ref_clk_per*(vco_div_count+65)/ref_div_count)>>(3-df);
 
     return 0;
 }
@@ -1368,22 +1442,6 @@
 static void aty_set_pll_ct(const struct fb_info_aty *info,
 			   const struct pll_ct *pll)
 {
-#if 0 /* ecd debug */
-printk("PLL_REF_DIV:   %02x (%02x)\n",
-	pll->pll_ref_div, aty_ld_pll(PLL_REF_DIV, info));
-printk("PLL_GEN_CNTL:  %02x (%02x)\n",
-	pll->pll_gen_cntl, aty_ld_pll(PLL_GEN_CNTL, info));
-printk("MCLK_FB_DIV:   %02x (%02x)\n",
-	pll->mclk_fb_div, aty_ld_pll(MCLK_FB_DIV, info));
-printk("PLL_VCLK_CNTL: %02x (%02x)\n",
-	pll->pll_vclk_cntl, aty_ld_pll(PLL_VCLK_CNTL, info));
-printk("VCLK_POST_DIV: %02x (%02x)\n",
-	pll->vclk_post_div, aty_ld_pll(VCLK_POST_DIV, info));
-printk("VCLK0_FB_DIV:  %02x (%02x)\n",
-	pll->vclk_fb_div, aty_ld_pll(VCLK0_FB_DIV, info));
-printk("PLL_EXT_CNTL:  %02x (%02x)\n",
-	pll->pll_ext_cntl, aty_ld_pll(PLL_EXT_CNTL, info));
-#endif /* ecd debug */
     aty_st_pll(PLL_REF_DIV, pll->pll_ref_div, info);
     aty_st_pll(PLL_GEN_CNTL, pll->pll_gen_cntl, info);
     aty_st_pll(MCLK_FB_DIV, pll->mclk_fb_div, info);
@@ -1467,11 +1525,10 @@
     return 0;
 }
 
-static int aty_var_to_pll_ct(const struct fb_info_aty *info,
-			     const struct fb_var_screeninfo *var,
-			     struct pll_ct *pll)
+static int aty_var_to_pll_ct(const struct fb_info_aty *info, u32 vclk_per,
+			     u8 bpp, struct pll_ct *pll)
 {
-    u32 vclk_per, q, x;		/* x is a workaround for sparc64-linux-gcc */
+    u32 q, x;			/* x is a workaround for sparc64-linux-gcc */
     u8 pll_ref_div, pll_gen_cntl, pll_ext_cntl;
     u8 mclk_fb_div, mclk_post_div, mpostdiv = 0;
     u8 vclk_fb_div, vclk_post_div, vpostdiv = 0;
@@ -1481,7 +1538,6 @@
 
     pll->pll_vclk_cntl = 0x03;	/* VCLK = PLL_VCLK/VCLKx_POST */
 
-    vclk_per = var->pixclock;
     pll_ref_div = info->pll_per*2*255/ref_clk_per;
 
     /* FIXME: use the VTB/GTB /3 post divider if it's better suited */
@@ -1513,7 +1569,7 @@
     vclk_fb_div = q*vclk_post_div/8;
 
     if ((err = aty_dsp_gt(info, mclk_fb_div, mclk_post_div, vclk_fb_div,
-			  vclk_post_div, var->bits_per_pixel, pll)))
+			  vclk_post_div, bpp, pll)))
 	return err;
 
     if ((((Gx == GT_CHIP_ID) && (Rev & 0x03)) || (Gx == GU_CHIP_ID) ||
@@ -1524,7 +1580,6 @@
     else
 	pll_gen_cntl = 0x84;
 
-    pll_ext_cntl = 0;
     switch (mclk_post_div) {
 	case 1:
 	    mpostdiv = 0;
@@ -1543,10 +1598,11 @@
 	    break;
     }
     pll_gen_cntl |= mpostdiv<<4;	/* mclk */
-    pll_ext_cntl |= mpostdiv;		/* xclk == mclk */
-#ifdef __sparc__
-    pll_ext_cntl = 0;			/* ??? xclk == mpllclk ??? */
-#endif
+
+    if (Gx == VT_CHIP_ID && (Rev == 0x40 || Rev == 0x48))
+	pll_ext_cntl = 0;
+    else
+    	pll_ext_cntl = mpostdiv;	/* xclk == mclk */
 
     switch (vclk_post_div) {
 	case 1:
@@ -1585,8 +1641,7 @@
     return 0;
 }
 
-static int aty_pll_ct_to_var(const struct pll_ct *pll,
-			     struct fb_var_screeninfo *var)
+static int aty_pll_ct_to_var(const struct pll_ct *pll, u32 *vclk_per)
 {
     u8 pll_ref_div = pll->pll_ref_div;
     u8 vclk_fb_div = pll->vclk_fb_div;
@@ -1600,7 +1655,7 @@
 				    (vclk_post_div & 3)];
     if (vpostdiv == 0)
 	return -EINVAL;
-    var->pixclock = pll_ref_div*vpostdiv*ref_clk_per/vclk_fb_div/2;
+    *vclk_per = pll_ref_div*vpostdiv*ref_clk_per/vclk_fb_div/2;
     return 0;
 }
 
@@ -1632,7 +1687,8 @@
     } else {
 	aty_set_pll_ct(info, &par->pll.ct);
 	i = aty_ld_le32(MEM_CNTL, info) & 0xf30fffff;
-	i |= info->mem_refresh_rate<<20;
+	if (!(Gx == VT_CHIP_ID && (Rev == 0x40 || Rev == 0x48)))
+	    i |= info->mem_refresh_rate << 20;
 	switch (par->crtc.bpp) {
 	    case 8:
 	    case 24:
@@ -1655,14 +1711,9 @@
 	    /* GT */
 	    aty_st_le32(DAC_CNTL, 0x86010102, info);
 	    aty_st_le32(BUS_CNTL, 0x7b23a040, info);
-	    aty_st_le32(EXT_MEM_CNTL, 0x5000001, info);
+	    aty_st_le32(EXT_MEM_CNTL,
+			aty_ld_le32(EXT_MEM_CNTL, info) | 0x5000001, info);
 	}
-
-#ifdef __sparc__
-	i &= ~0x00f00000;	/* ??? Doesn't work right with higher values. */
-	i |= (info->mem_refresh_rate & 1) << 20;
-#endif
-
 	aty_st_le32(MEM_CNTL, i, info);
     }
     aty_st_8(DAC_MASK, 0xff, info);
@@ -1704,14 +1755,15 @@
     if ((Gx == GX_PCI_ID) || (Gx == CX_PCI_ID))
 	switch (info->clk_type) {
 	    case CLK_ATI18818_1:
-		err = aty_var_to_pll_18818(var, &par->pll.gx);
+		err = aty_var_to_pll_18818(var->pixclock, &par->pll.gx);
 		break;
 	    case CLK_IBMRGB514:
-		err = aty_var_to_pll_514(var, &par->pll.gx);
+		err = aty_var_to_pll_514(var->pixclock, &par->pll.gx);
 		break;
 	}
     else
-	err = aty_var_to_pll_ct(info, var, &par->pll.ct);
+	err = aty_var_to_pll_ct(info, var->pixclock, par->crtc.bpp,
+				&par->pll.ct);
     if (err)
 	return err;
 
@@ -1721,7 +1773,7 @@
 	par->accel_flags = 0;
 
 #if 0
-    if (!fbmon_valid_timings(pixclock, htotal, vtotal, info))
+    if (!fbmon_valid_timings(var->pixclock, htotal, vtotal, info))
 	return -EINVAL;
 #endif
 
@@ -1739,9 +1791,9 @@
     if ((err = aty_crtc_to_var(&par->crtc, var)))
 	return err;
     if ((Gx == GX_PCI_ID) || (Gx == CX_PCI_ID))
-	err = aty_pll_gx_to_var(&par->pll.gx, var);
+	err = aty_pll_gx_to_var(&par->pll.gx, &var->pixclock);
     else
-	err = aty_pll_ct_to_var(&par->pll.ct, var);
+	err = aty_pll_ct_to_var(&par->pll.ct, &var->pixclock);
     if (err)
 	return err;
 
@@ -1774,15 +1826,38 @@
 static int atyfb_open(struct fb_info *info, int user)
 
 {
-    /*
-     *  Nothing, only a usage count for the moment
-     */
+#ifdef __sparc__
+    struct fb_info_aty *fb = (struct fb_info_aty *)info;
+
+    if (user) {
+	if (fb->open)
+	    return -EBUSY;
+	fb->mmaped = 0;
+	fb->open = 1;
+	fb->vtconsole = -1;
+    } else {
+	fb->consolecnt++;
+    }
+#endif
     MOD_INC_USE_COUNT;
     return(0);
 }
 
 static int atyfb_release(struct fb_info *info, int user)
 {
+#ifdef __sparc__
+    struct fb_info_aty *fb = (struct fb_info_aty *)info;
+
+    if (user) {
+	if (fb->vtconsole != -1)
+	    vt_cons[fb->vtconsole]->vc_mode = KD_TEXT;
+	fb->open = 0;
+	fb->mmaped = 0;
+	fb->vtconsole = -1;
+    } else {
+	fb->consolecnt--;
+    }
+#endif
     MOD_DEC_USE_COUNT;
     return(0);
 }
@@ -1849,32 +1924,6 @@
     0, FB_VMODE_NONINTERLACED
 };
 
-#ifdef __sparc__
-struct fb_var_screeninfo default_var_1024x768 __initdata = {
-    /* 1024x768, 75 Hz, Non-Interlaced (78.75 MHz dotclock) */
-    1024, 768, 1024, 768, 0, 0, 8, 0,
-    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-    0, 0, -1, -1, 0, 12699, 176, 16, 28, 1, 96, 3,
-    FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
-};
-
-struct fb_var_screeninfo default_var_1152x864 __initdata = {
-    /* 1152x864, 75 Hz, Non-Interlaced (110.0 MHz dotclock) */
-    1152, 864, 1152, 864, 0, 0, 8, 0,
-    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-    0, 0, -1, -1, 0, 9091, 144, 24, 85, 45, 144, 8,
-    FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
-};
-
-struct fb_var_screeninfo default_var_1280x1024 __initdata = {
-    /* 1280x1024, 75 Hz, Non-Interlaced (135.00 MHz dotclock) */
-    1280, 1024, 1280, 1024, 0, 0, 8, 0,
-    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-    0, 0, -1, -1, 0, 7408, 248, 16, 38, 1, 144, 3,
-    FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
-};
-#endif
-
 
     /*
      *  Get the Fixed Part of the Display
@@ -1962,22 +2011,22 @@
 	    switch (par.crtc.bpp) {
 #ifdef FBCON_HAS_CFB8
 		case 8:
-		    *display->dispsw = accel ? fbcon_aty8 : fbcon_cfb8;
+		    display->dispsw = accel ? &info->adisp8 : &info->disp8;
 		    break;
 #endif
 #ifdef FBCON_HAS_CFB16
 		case 16:
-		    *display->dispsw = accel ? fbcon_aty16 : fbcon_cfb16;
+		    display->dispsw = accel ? &info->adisp16 : &info->disp16;
 		    break;
 #endif
 #ifdef FBCON_HAS_CFB24
 		case 24:
-		    *display->dispsw = accel ? fbcon_aty24 : fbcon_cfb24;
+		    display->dispsw = accel ? &info->adisp24 : &info->disp24;
 		    break;
 #endif
 #ifdef FBCON_HAS_CFB32
 		case 32:
-		    *display->dispsw = accel ? fbcon_aty32 : fbcon_cfb32;
+		    display->dispsw = accel ? &info->adisp32 : &info->disp32;
 		    break;
 #endif
 		default:
@@ -1987,10 +2036,6 @@
 	    display->scrollmode = accel ? 0 : SCROLL_YREDRAW;
 	    if (info->fb_info.changevar)
 		(*info->fb_info.changevar)(con);
-	    if (info->cursor) {
-		display->dispsw->cursor = atyfb_cursor;
-		display->dispsw->set_font = atyfb_set_font;
-	    }
 	}
 	if (con == currcon)
 	    atyfb_set_par(&par, info);
@@ -2038,8 +2083,7 @@
 			  struct fb_info *info)
 {
     if (con == currcon) /* current console? */
-	return fb_get_cmap(cmap, &fb_display[con].var, kspc, atyfb_getcolreg,
-			   info);
+	return fb_get_cmap(cmap, kspc, atyfb_getcolreg, info);
     else if (fb_display[con].cmap.len) /* non default colormap? */
 	fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
     else {
@@ -2064,8 +2108,7 @@
 	    return err;
     }
     if (con == currcon)			/* current console? */
-	return fb_set_cmap(cmap, &fb_display[con].var, kspc, atyfb_setcolreg,
-			   info);
+	return fb_set_cmap(cmap, kspc, atyfb_setcolreg, info);
     else
 	fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
     return 0;
@@ -2075,7 +2118,27 @@
 static int atyfb_ioctl(struct inode *inode, struct file *file, u_int cmd,
 		       u_long arg, int con, struct fb_info *info)
 {
+#ifdef __sparc__
+    struct fb_info_aty *fb = (struct fb_info_aty *)info;
+    struct fbtype fbtyp;
+
+    switch (cmd) {
+    case FBIOGTYPE:
+	fbtyp.fb_type = FBTYPE_PCI_GENERIC;
+	fbtyp.fb_width = fb->current_par.crtc.vxres;
+	fbtyp.fb_height = fb->current_par.crtc.vyres;
+	fbtyp.fb_depth = fb->current_par.crtc.bpp;
+	fbtyp.fb_cmsize = fb_display[con].cmap.len;
+	fbtyp.fb_size = fb->total_vram;
+	copy_to_user_ret((struct fbtype *)arg, &fbtyp, sizeof(fbtyp), -EFAULT);
+	break;
+    default:
+	return -EINVAL;
+    }
+    return 0;
+#else
     return -EINVAL;
+#endif
 }
 
 #ifdef __sparc__
@@ -2097,10 +2160,15 @@
 	/* To stop the swapper from even considering these pages. */
 	vma->vm_flags |= (VM_SHM | VM_LOCKED);
 
+	if (((vma->vm_offset == 0) && (size == fb->total_vram)) ||
+	    ((vma->vm_offset == fb->total_vram) && (size == PAGE_SIZE)))
+		vma->vm_offset += 0x8000000000000000UL;
+
 #ifdef __sparc_v9__
 	/* Align it as much as desirable */
 	{
-		int j, max = -1, align;
+		unsigned long j, align;
+		int max = -1;
 		
 		map_offset = vma->vm_offset+size;
 		for (i = 0; fb->mmap_map[i].size; i++) {
@@ -2151,7 +2219,7 @@
 
 			if (start > offset)
 				continue;
-			if (offset > end)
+			if (offset >= end)
 				continue;
 
 			map_size = fb->mmap_map[i].size - (offset - start);
@@ -2181,6 +2249,18 @@
 	vma->vm_file = file;
 	file->f_count++;
 	vma->vm_flags |= VM_IO;
+
+	if (!fb->mmaped) {
+		int lastconsole = 0;
+
+		if (info->display_fg)
+			lastconsole = info->display_fg->vc_num;
+		fb->mmaped = 1;
+		if (fb->consolecnt && fb_display[lastconsole].fb_info == info) {
+			fb->vtconsole = lastconsole;
+			vt_cons[lastconsole]->vc_mode = KD_GRAPHICS;
+		}
+	}
 	return 0;
 }
 #endif /* __sparc__ */
@@ -2357,8 +2437,13 @@
 	    default_vmode = VMODE_CHOOSE;
     }
     if (default_vmode == VMODE_CHOOSE) {
-	sense = read_aty_sense(info);
-	default_vmode = mac_map_monitor_sense(sense);
+	if (Gx == LG_CHIP_ID)
+	    /* G3 PowerBook with 1024x768 LCD */
+	    default_vmode = VMODE_1024_768_60;
+	else {
+	    sense = read_aty_sense(info);
+	    default_vmode = mac_map_monitor_sense(sense);
+	}
     }
     if (default_vmode <= 0 || default_vmode > VMODE_MAX)
 	default_vmode = VMODE_640_480_60;
@@ -2377,15 +2462,6 @@
 	return 0;
     }
 
-    if ((Gx == GX_CHIP_ID) || (Gx == CX_CHIP_ID))
-	strcat(atyfb_name, "GX");
-    else if ((Gx == CT_CHIP_ID) || (Gx == ET_CHIP_ID))
-	strcat(atyfb_name, "CT");
-    else if ((Gx == VT_CHIP_ID) || (Gx == VU_CHIP_ID))
-	strcat(atyfb_name, "VT");
-    else
-	strcat(atyfb_name, "GT");
-
     disp = &info->disp;
 
     strcpy(info->fb_info.modename, atyfb_name);
@@ -2405,16 +2481,56 @@
 	info->palette[j].blue = default_blu[k];
     }
 
+#ifdef FBCON_HAS_CFB8
+    info->disp8 = fbcon_cfb8;
+    info->adisp8 = fbcon_aty8;
+#endif
+#ifdef FBCON_HAS_CFB16
+    info->disp16 = fbcon_cfb16;
+    info->adisp16 = fbcon_aty16;
+#endif
+#ifdef FBCON_HAS_CFB24
+    info->disp24 = fbcon_cfb24;
+    info->adisp24 = fbcon_aty24;
+#endif
+#ifdef FBCON_HAS_CFB32
+    info->disp32 = fbcon_cfb32;
+    info->adisp32 = fbcon_aty32;
+#endif
+
     if ((Gx == VT_CHIP_ID) || (Gx == GT_CHIP_ID) || (Gx == GU_CHIP_ID) ||
 	(Gx == LG_CHIP_ID) || (Gx == GB_CHIP_ID) || (Gx == GD_CHIP_ID) ||
 	(Gx == GI_CHIP_ID) || (Gx == GP_CHIP_ID) || (Gx == GQ_CHIP_ID) ||
 	(Gx == VU_CHIP_ID)) {
-	info->cursor = kmalloc(sizeof(struct aty_cursor), GFP_ATOMIC);
-	if (info->cursor)
-	    memset(info->cursor, 0, sizeof(*info->cursor));
+	info->cursor = aty_init_cursor(info);
+	if (info->cursor) {
+#ifdef FBCON_HAS_CFB8
+	    info->disp8.cursor = atyfb_cursor;
+	    info->disp8.set_font = atyfb_set_font;
+	    info->adisp8.cursor = atyfb_cursor;
+	    info->adisp8.set_font = atyfb_set_font;
+#endif
+#ifdef FBCON_HAS_CFB16
+	    info->disp16.cursor = atyfb_cursor;
+	    info->disp16.set_font = atyfb_set_font;
+	    info->adisp16.cursor = atyfb_cursor;
+	    info->adisp16.set_font = atyfb_set_font;
+#endif
+#ifdef FBCON_HAS_CFB24
+	    info->disp24.cursor = atyfb_cursor;
+	    info->disp24.set_font = atyfb_set_font;
+	    info->adisp24.cursor = atyfb_cursor;
+	    info->adisp24.set_font = atyfb_set_font;
+#endif
+#ifdef FBCON_HAS_CFB32
+	    info->disp32.cursor = atyfb_cursor;
+	    info->disp32.set_font = atyfb_set_font;
+	    info->adisp32.cursor = atyfb_cursor;
+	    info->adisp32.set_font = atyfb_set_font;
+#endif
+	}
     }
 
-    disp->dispsw = &info->dispsw;
     atyfb_set_var(&var, -1, &info->fb_info);
 
     if (register_framebuffer(&info->fb_info) < 0)
@@ -2434,14 +2550,19 @@
     struct pci_dev *pdev;
     struct fb_info_aty *info;
     unsigned long addr;
-    int i, j;
-    u16 tmp;
 #ifdef __sparc__
     extern int con_is_present(void);
+    struct pcidev_cookie *pcp;
+    char prop[128];
+    int node, len;
+    u32 mem, chip_id;
+    int i, j;
 
     /* Do not attach when we have a serial console. */
     if (!con_is_present())
 	return;
+#else
+    u16 tmp;
 #endif
 
     for (pdev = pci_devices; pdev; pdev = pdev->next) {
@@ -2480,16 +2601,16 @@
 	     */
 	    for (i = 0; i < 6 && pdev->base_address[i]; i++)
 		/* nothing */;
-	    j = i + 1;
+	    j = i + 3;
 
 	    info->mmap_map = kmalloc(j * sizeof(*info->mmap_map), GFP_ATOMIC);
 	    if (!info->mmap_map) {
 		printk("atyfb_init: can't alloc mmap_map\n");
 		kfree(info);
 	    }
-
 	    memset(info->mmap_map, 0, j * sizeof(*info->mmap_map));
-	    for (i = j = 0; i < 6 && pdev->base_address[i]; i++) {
+
+	    for (i = 0, j = 2; i < 6 && pdev->base_address[i]; i++) {
 		int io, breg = PCI_BASE_ADDRESS_0 + (i << 2);
 		unsigned long base;
 		u32 size, pbase;
@@ -2508,8 +2629,7 @@
 		size = ~(size) + 1;
 
 		if (base == addr) {
-			info->mmap_map[j].voff = (pbase + 0x800000)
-								& PAGE_MASK;
+			info->mmap_map[j].voff = (pbase + 0x800000) & PAGE_MASK;
 			info->mmap_map[j].poff = __pa((base + 0x800000)
 								& PAGE_MASK);
 			info->mmap_map[j].size = 0x800000;
@@ -2530,9 +2650,10 @@
 	    /*
 	     * Fix PROMs idea of MEM_CNTL settings...
 	     */
-	    tmp = aty_ld_le32(CONFIG_CHIP_ID, info) & CFG_CHIP_TYPE;
-	    if (tmp == VT_CHIP_ID) {
-		u32 mem = aty_ld_le32(MEM_CNTL, info);
+	    mem = aty_ld_le32(MEM_CNTL, info);
+	    chip_id = aty_ld_le32(CONFIG_CHIP_ID, info);
+	    if (((chip_id & CFG_CHIP_TYPE) == VT_CHIP_ID) &&
+		!((chip_id >> 24) & 1)) {
 		switch (mem & 0x0f) {
 		    case 3:
 			mem = (mem & ~(0x0f)) | 2;
@@ -2550,60 +2671,58 @@
 			break;
 		}
 		if ((aty_ld_le32(CONFIG_STAT0, info) & 7) >= SDRAM)
-			mem &= ~(0x00f00000);
-		aty_st_le32(MEM_CNTL, mem, info);
+			mem &= ~(0x00700000);
 	    }
+	    mem &= ~(0xcf80e000);	/* Turn off all undocumented bits. */
+	    aty_st_le32(MEM_CNTL, mem, info);
 
 	    /*
-	     * Set default vmode and cmode from PROM properties.
+	     * If this is the console device, we will set default video
+	     * settings to what the PROM left us with.
 	     */
-	    {
-		struct pcidev_cookie *cookie = pdev->sysdata;
-		int node = cookie->prom_node;
-		int width = prom_getintdefault(node, "width", 1024);
-		int height = prom_getintdefault(node, "height", 768);
-		int depth = prom_getintdefault(node, "depth", 8);
-
-		switch (width) {
-		    case 1024:
-			if (height == 768)
-			    default_var = default_var_1024x768;
-			break;
-		    case 1152:
-			if (height == 864)
-			    default_var = default_var_1152x864;
-			break;
-		    case 1280:
-			if (height == 1024)
-			    default_var = default_var_1280x1024;
-			break;
-		    default:
-			break;
+	    node = prom_getchild(prom_root_node);
+	    node = prom_searchsiblings(node, "aliases");
+	    if (node) {
+		len = prom_getproperty(node, "screen", prop, sizeof(prop));
+		if (len > 0) {
+		    prop[len] = '\0';
+		    node = prom_finddevice(prop);
+		} else {
+		    node = 0;
 		}
+	    }
 
-		switch (depth) {
-		    case 8:
-			default_var.bits_per_pixel = 8;
-			break;
-		    case 16:
-			default_var.bits_per_pixel = 16;
-			break;
-		    case 24:
-			default_var.bits_per_pixel = 24;
-			break;
-		    case 32:
-			default_var.bits_per_pixel = 32;
-			break;
-		    default:
-			break;
-		}
+	    pcp = pdev->sysdata;
+	    if (node == pcp->prom_node) {
+
+		struct fb_var_screeninfo *var = &default_var;
+		u32 v_total, h_total;
+		struct crtc crtc;
+
+		crtc.vxres = prom_getintdefault(node, "width", 1024);
+		crtc.vyres = prom_getintdefault(node, "height", 768);
+		crtc.bpp = prom_getintdefault(node, "depth", 8);
+		crtc.xoffset = crtc.yoffset = 0;
+		crtc.h_tot_disp = aty_ld_le32(CRTC_H_TOTAL_DISP, info);
+		crtc.h_sync_strt_wid = aty_ld_le32(CRTC_H_SYNC_STRT_WID, info);
+		crtc.v_tot_disp = aty_ld_le32(CRTC_V_TOTAL_DISP, info);
+		crtc.v_sync_strt_wid = aty_ld_le32(CRTC_V_SYNC_STRT_WID, info);
+		crtc.gen_cntl = aty_ld_le32(CRTC_GEN_CNTL, info);
+		aty_crtc_to_var(&crtc, var);
+
+		/*
+		 * FIXME: Read the PLL to figure actual Refresh Rate.
+		 *        Default to 66Hz for now.
+		 */
+		h_total = var->xres + var->right_margin +
+			  var->hsync_len + var->left_margin;
+		v_total = var->yres + var->lower_margin +
+			  var->vsync_len + var->upper_margin;
+		default_var.pixclock = 1000000000000ULL/(66*h_total*v_total);
 	    }
 
 #else /* __sparc__ */
 
-	    info->ati_regbase = (unsigned long)
-				ioremap(0x7ff000 + addr, 0x1000) + 0xc00;
-
 	    info->ati_regbase_phys = 0x7ff000 + addr;
 	    info->ati_regbase = (unsigned long)
 				ioremap(info->ati_regbase_phys, 0x1000);
@@ -2636,7 +2755,24 @@
 		if (info->mmap_map)
 		    kfree(info->mmap_map);
 		kfree(info);
+		return;
 	    }
+
+#ifdef __sparc__
+	    /*
+	     * Add /dev/fb mmap values.
+	     */
+	    info->mmap_map[0].voff = 0x8000000000000000UL;
+	    info->mmap_map[0].poff = __pa(info->frame_buffer & PAGE_MASK);
+	    info->mmap_map[0].size = info->total_vram;
+	    info->mmap_map[0].prot_mask = _PAGE_CACHE;
+	    info->mmap_map[0].prot_flag = _PAGE_E;
+	    info->mmap_map[1].voff = info->mmap_map[0].voff + info->total_vram;
+	    info->mmap_map[1].poff = __pa(info->ati_regbase & PAGE_MASK);
+	    info->mmap_map[1].size = PAGE_SIZE;
+	    info->mmap_map[1].prot_mask = _PAGE_CACHE;
+	    info->mmap_map[1].prot_flag = _PAGE_E;
+#endif /* __sparc__ */
 	}
     }
 #elif defined(CONFIG_ATARI)
@@ -2652,6 +2788,11 @@
 	}
 
 	info = kmalloc(sizeof(struct fb_info_aty), GFP_ATOMIC);
+	if (!info) {
+	    printk("atyfb_init: can't alloc fb_info_aty\n");
+	    return;
+	}
+	memset(info, 0, sizeof(struct fb_info_aty));
 
 	/*
 	 *  Map the video memory (physical address given) to somewhere in the
@@ -2686,6 +2827,7 @@
     for (; dp; dp = dp->next) {
 	switch (dp->n_addrs) {
 	    case 1:
+	    case 2:
 	    case 3:
 		addr = dp->addrs[0].address;
 		break;
@@ -2703,6 +2845,11 @@
 	}
 
 	info = kmalloc(sizeof(struct fb_info_aty), GFP_ATOMIC);
+	if (!info) {
+	    printk("atyfb_of_init: can't alloc fb_info_aty\n");
+	    return;
+	}
+	memset(info, 0, sizeof(struct fb_info_aty));
 
 	info->ati_regbase = (unsigned long)ioremap(0x7ff000+addr,
 						   0x1000)+0xc00;
@@ -2766,24 +2913,13 @@
 	}
 #if defined(CONFIG_PMAC) || defined(CONFIG_CHRP)
 	if (!strncmp(this_opt, "vmode:", 6)) {
-	    int vmode = simple_strtoul(this_opt+6, NULL, 0);
+	    unsigned int vmode = simple_strtoul(this_opt+6, NULL, 0);
 	    if (vmode > 0 && vmode <= VMODE_MAX)
 		default_vmode = vmode;
 	} else if (!strncmp(this_opt, "cmode:", 6)) {
-	    int depth = simple_strtoul(this_opt+6, NULL, 0);
-	    switch (depth) {
-		case 8:
-		    default_cmode = 0;
-		    break;
-		case 15:
-		case 16:
-		    default_cmode = 1;
-		    break;
-		case 24:
-		case 32:
-		    default_cmode = 2;
-		    break;
-	    }
+	    unsigned int cmode = simple_strtoul(this_opt+6, NULL, 0);
+	    if (cmode <= CMODE_32)
+		default_cmode = cmode;
 	}
 #endif
 #ifdef CONFIG_ATARI
@@ -2861,13 +2997,21 @@
 
     /* Do we have to save the colormap? */
     if (fb_display[currcon].cmap.len)
-	fb_get_cmap(&fb_display[currcon].cmap, &fb_display[currcon].var, 1,
-		    atyfb_getcolreg, fb);
+	fb_get_cmap(&fb_display[currcon].cmap, 1, atyfb_getcolreg, fb);
+
+    /* Erase HW Cursor */
+    if (info->cursor)
+	atyfb_cursor(&fb_display[currcon], CM_ERASE,
+		     info->cursor->pos.x, info->cursor->pos.y);
+
     currcon = con;
+
     atyfb_decode_var(&fb_display[con].var, &par, info);
     atyfb_set_par(&par, info);
+
     /* Install new colormap */
     do_install_cmap(con, fb);
+
     /* Install hw cursor */
     if (info->cursor) {
 	aty_set_cursor_color(info, cursor_pixel_map, cursor_color_map,
@@ -2933,9 +3077,10 @@
 
     if (regno > 255)
 	return 1;
-    *red = info->palette[regno].red;
-    *green = info->palette[regno].green;
-    *blue = info->palette[regno].blue;
+    *red = (info->palette[regno].red<<8) | info->palette[regno].red;
+    *green = (info->palette[regno].green<<8) | info->palette[regno].green;
+    *blue = (info->palette[regno].blue<<8) | info->palette[regno].blue;
+    *transp = 0;
     return 0;
 }
 
@@ -2954,6 +3099,9 @@
 
     if (regno > 255)
 	return 1;
+    red >>= 8;
+    green >>= 8;
+    blue >>= 8;
     info->palette[regno].red = red;
     info->palette[regno].green = green;
     info->palette[regno].blue = blue;
@@ -2969,24 +3117,31 @@
 	     (info->current_par.crtc.bpp == 16)) ? 3 : 0;
     info->aty_cmap_regs->windex = regno << scale;
     eieio();
-    info->aty_cmap_regs->lut = red << scale;
+    info->aty_cmap_regs->lut = red;
     eieio();
-    info->aty_cmap_regs->lut = green << scale;
+    info->aty_cmap_regs->lut = green;
     eieio();
-    info->aty_cmap_regs->lut = blue << scale;
+    info->aty_cmap_regs->lut = blue;
     eieio();
-    if (regno < 16) {
+    if (regno < 16)
+	switch (info->current_par.crtc.bpp) {
 #ifdef FBCON_HAS_CFB16
-	fbcon_cfb16_cmap[regno] = (regno << 10) | (regno << 5) | regno;
+	    case 16:
+		fbcon_cfb16_cmap[regno] = (regno << 10) | (regno << 5) | regno;
+		break;
 #endif
 #ifdef FBCON_HAS_CFB24
-	fbcon_cfb24_cmap[regno] = (regno << 16) | (regno << 8) | regno;
+	    case 24:
+		fbcon_cfb24_cmap[regno] = (regno << 16) | (regno << 8) | regno;
+		break;
 #endif
 #ifdef FBCON_HAS_CFB32
-	fbcon_cfb32_cmap[regno] = (regno << 24) | (regno << 16) |
-				  (regno << 8) | regno;
+	    case 32:
+		i = (regno << 8) | regno;
+		fbcon_cfb32_cmap[regno] = (i << 16) | i;
+		break;
 #endif
-    }
+	    }
     return 0;
 }
 
@@ -2996,12 +3151,10 @@
     if (con != currcon)
 	return;
     if (fb_display[con].cmap.len)
-	fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-		    atyfb_setcolreg, info);
+	fb_set_cmap(&fb_display[con].cmap, 1, atyfb_setcolreg, info);
     else {
 	int size = fb_display[con].var.bits_per_pixel == 16 ? 32 : 256;
-	fb_set_cmap(fb_default_cmap(size), &fb_display[con].var, 1,
-		    atyfb_setcolreg, info);
+	fb_set_cmap(fb_default_cmap(size), 1, atyfb_setcolreg, info);
     }
 }
 
@@ -3095,12 +3248,19 @@
 static void fbcon_aty_bmove(struct display *p, int sy, int sx, int dy, int dx,
 			    int height, int width)
 {
-    sx *= p->fontwidth;
-    sy *= p->fontheight;
-    dx *= p->fontwidth;
-    dy *= p->fontheight;
-    width *= p->fontwidth;
-    height *= p->fontheight;
+#ifdef __sparc__
+    struct fb_info_aty *fb = (struct fb_info_aty *)(p->fb_info);
+
+    if (fb->mmaped && currcon == fb->vtconsole)
+	return;
+#endif
+
+    sx *= fontwidth(p);
+    sy *= fontheight(p);
+    dx *= fontwidth(p);
+    dy *= fontheight(p);
+    width *= fontwidth(p);
+    height *= fontheight(p);
 
     aty_rectcopy(sx, sy, dx, dy, width, height,
 		 (struct fb_info_aty *)p->fb_info);
@@ -3109,14 +3269,22 @@
 static void fbcon_aty_clear(struct vc_data *conp, struct display *p, int sy,
 			    int sx, int height, int width)
 {
-    u32 bgx = attr_bgcol_ec(p, conp);
+    u32 bgx;
+#ifdef __sparc__
+    struct fb_info_aty *fb = (struct fb_info_aty *)(p->fb_info);
+
+    if (fb->mmaped && currcon == fb->vtconsole)
+	return;
+#endif
+
+    bgx = attr_bgcol_ec(p, conp);
     bgx |= (bgx << 8);
     bgx |= (bgx << 16);
 
-    sx *= p->fontwidth;
-    sy *= p->fontheight;
-    width *= p->fontwidth;
-    height *= p->fontheight;
+    sx *= fontwidth(p);
+    sy *= fontheight(p);
+    width *= fontwidth(p);
+    height *= fontheight(p);
 
     aty_rectfill(sx, sy, width, height, bgx,
 		 (struct fb_info_aty *)p->fb_info);
@@ -3126,6 +3294,13 @@
 static void fbcon_aty8_putc(struct vc_data *conp, struct display *p, int c,
 			    int yy, int xx)
 {
+#ifdef __sparc__
+    struct fb_info_aty *fb = (struct fb_info_aty *)(p->fb_info);
+
+    if (fb->mmaped && currcon == fb->vtconsole)
+	return;
+#endif
+
     wait_for_idle((struct fb_info_aty *)p->fb_info);
     fbcon_cfb8_putc(conp, p, c, yy, xx);
 }
@@ -3134,6 +3309,13 @@
 			     const unsigned short *s, int count, int yy,
 			     int xx)
 {
+#ifdef __sparc__
+    struct fb_info_aty *fb = (struct fb_info_aty *)(p->fb_info);
+
+    if (fb->mmaped && currcon == fb->vtconsole)
+	return;
+#endif
+
     wait_for_idle((struct fb_info_aty *)p->fb_info);
     fbcon_cfb8_putcs(conp, p, s, count, yy, xx);
 }
@@ -3149,6 +3331,13 @@
 static void fbcon_aty16_putc(struct vc_data *conp, struct display *p, int c,
 			     int yy, int xx)
 {
+#ifdef __sparc__
+    struct fb_info_aty *fb = (struct fb_info_aty *)(p->fb_info);
+
+    if (fb->mmaped && currcon == fb->vtconsole)
+	return;
+#endif
+
     wait_for_idle((struct fb_info_aty *)p->fb_info);
     fbcon_cfb16_putc(conp, p, c, yy, xx);
 }
@@ -3157,6 +3346,13 @@
 			      const unsigned short *s, int count, int yy,
 			      int xx)
 {
+#ifdef __sparc__
+    struct fb_info_aty *fb = (struct fb_info_aty *)(p->fb_info);
+
+    if (fb->mmaped && currcon == fb->vtconsole)
+	return;
+#endif
+
     wait_for_idle((struct fb_info_aty *)p->fb_info);
     fbcon_cfb16_putcs(conp, p, s, count, yy, xx);
 }
@@ -3172,6 +3368,13 @@
 static void fbcon_aty24_putc(struct vc_data *conp, struct display *p, int c,
 			     int yy, int xx)
 {
+#ifdef __sparc__
+    struct fb_info_aty *fb = (struct fb_info_aty *)(p->fb_info);
+
+    if (fb->mmaped && currcon == fb->vtconsole)
+	return;
+#endif
+
     wait_for_idle((struct fb_info_aty *)p->fb_info);
     fbcon_cfb24_putc(conp, p, c, yy, xx);
 }
@@ -3180,6 +3383,13 @@
 			      const unsigned short *s, int count, int yy,
 			      int xx)
 {
+#ifdef __sparc__
+    struct fb_info_aty *fb = (struct fb_info_aty *)(p->fb_info);
+
+    if (fb->mmaped && currcon == fb->vtconsole)
+	return;
+#endif
+
     wait_for_idle((struct fb_info_aty *)p->fb_info);
     fbcon_cfb24_putcs(conp, p, s, count, yy, xx);
 }
@@ -3195,6 +3405,13 @@
 static void fbcon_aty32_putc(struct vc_data *conp, struct display *p, int c,
 			     int yy, int xx)
 {
+#ifdef __sparc__
+    struct fb_info_aty *fb = (struct fb_info_aty *)(p->fb_info);
+
+    if (fb->mmaped && currcon == fb->vtconsole)
+	return;
+#endif
+
     wait_for_idle((struct fb_info_aty *)p->fb_info);
     fbcon_cfb32_putc(conp, p, c, yy, xx);
 }
@@ -3203,6 +3420,13 @@
 			      const unsigned short *s, int count, int yy,
 			      int xx)
 {
+#ifdef __sparc__
+    struct fb_info_aty *fb = (struct fb_info_aty *)(p->fb_info);
+
+    if (fb->mmaped && currcon == fb->vtconsole)
+	return;
+#endif
+
     wait_for_idle((struct fb_info_aty *)p->fb_info);
     fbcon_cfb32_putcs(conp, p, s, count, yy, xx);
 }
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/bwtwofb.c m68k/drivers/video/bwtwofb.c
--- jes-2.1.115/drivers/video/bwtwofb.c	Sun Aug  9 21:48:27 1998
+++ m68k/drivers/video/bwtwofb.c	Mon Aug 10 19:21:24 1998
@@ -1,4 +1,4 @@
-/* $Id: bwtwofb.c,v 1.1 1998/07/21 14:50:48 jj Exp $
+/* $Id: bwtwofb.c,v 1.4 1998/08/10 09:08:30 jj Exp $
  * bwtwofb.c: BWtwo frame buffer driver
  *
  * Copyright (C) 1998 Jakub Jelinek   (jj@ultra.linux.cz)
@@ -63,6 +63,7 @@
 #define BWTWO_SR_ID_MONO	0x02
 #define BWTWO_SR_ID_MONO_ECL	0x03
 #define BWTWO_SR_ID_MSYNC	0x04
+#define BWTWO_SR_ID_NOCONN	0x0a
 
 /* Control Register Constants */
 #define BWTWO_CTL_ENABLE_INTS   0x80
@@ -94,7 +95,7 @@
 
 static void bw2_margins (struct fb_info_sbusfb *fb, struct display *p, int x_margin, int y_margin)
 {
-	p->screen_base += ((y_margin - fb->y_margin) * p->line_length + (x_margin - fb->x_margin)) >> 3;
+	p->screen_base += (y_margin - fb->y_margin) * p->line_length + ((x_margin - fb->x_margin) >> 3);
 }
 
 static u8 bw2regs_1600[] __initdata = {
@@ -140,7 +141,7 @@
 	struct display *disp = &fb->disp;
 	struct fbtype *type = &fb->type;
 #ifdef CONFIG_SUN4
-	unsigned long phys = SUN4_300_BWTWO_PHYSADDR;
+	unsigned long phys = sun4_bwtwo_physaddr;
 #else
 	unsigned long phys = fb->sbdp->reg_addrs[0].phys_addr;
 #endif
@@ -182,6 +183,8 @@
 					else
 						p = bw2regs_66hz;
 					break;
+				case BWTWO_SR_ID_NOCONN:
+					return NULL;
 				default:
 					prom_printf("bw2: can't handle SR %02x\n",
 						    status);
@@ -201,7 +204,7 @@
 	if (!disp->screen_base)
 		disp->screen_base = (char *)sparc_alloc_io(phys, 0, 
 			type->fb_size, "bw2_ram", fb->iospace, 0);
-	disp->screen_base += (fix->line_length * fb->y_margin + fb->x_margin) >> 3;
+	disp->screen_base += fix->line_length * fb->y_margin + (fb->x_margin >> 3);
 	fb->dispsw = fbcon_mfb;
 	fix->visual = FB_VISUAL_MONO01;
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/cgfourteenfb.c m68k/drivers/video/cgfourteenfb.c
--- jes-2.1.115/drivers/video/cgfourteenfb.c	Thu Jan  1 01:00:00 1970
+++ m68k/drivers/video/cgfourteenfb.c	Tue Jul 28 20:48:21 1998
@@ -0,0 +1,384 @@
+/* $Id: cgfourteenfb.c,v 1.1 1998/07/28 13:08:32 jj Exp $
+ * cgfourteenfb.c: CGfourteen frame buffer driver
+ *
+ * Copyright (C) 1996,1998 Jakub Jelinek (jj@ultra.linux.cz)
+ * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx)
+ */
+
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/tty.h>
+#include <linux/malloc.h>
+#include <linux/vmalloc.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/fb.h>
+#include <linux/init.h>
+#include <linux/selection.h>
+
+#include "sbusfb.h"
+#include <asm/io.h>
+#include <asm/pgtable.h>
+#include <asm/uaccess.h>
+
+#include "fbcon-cfb8.h"
+
+#define CG14_MCR_INTENABLE_SHIFT	7
+#define CG14_MCR_INTENABLE_MASK		0x80
+#define CG14_MCR_VIDENABLE_SHIFT	6
+#define CG14_MCR_VIDENABLE_MASK		0x40
+#define CG14_MCR_PIXMODE_SHIFT		4
+#define CG14_MCR_PIXMODE_MASK		0x30
+#define CG14_MCR_TMR_SHIFT		2
+#define CG14_MCR_TMR_MASK		0x0c
+#define CG14_MCR_TMENABLE_SHIFT		1
+#define CG14_MCR_TMENABLE_MASK		0x02
+#define CG14_MCR_RESET_SHIFT		0
+#define CG14_MCR_RESET_MASK		0x01
+#define CG14_REV_REVISION_SHIFT		4
+#define CG14_REV_REVISION_MASK		0xf0
+#define CG14_REV_IMPL_SHIFT		0
+#define CG14_REV_IMPL_MASK		0x0f
+#define CG14_VBR_FRAMEBASE_SHIFT	12
+#define CG14_VBR_FRAMEBASE_MASK		0x00fff000
+#define CG14_VMCR1_SETUP_SHIFT		0
+#define CG14_VMCR1_SETUP_MASK		0x000001ff
+#define CG14_VMCR1_VCONFIG_SHIFT	9
+#define CG14_VMCR1_VCONFIG_MASK		0x00000e00
+#define CG14_VMCR2_REFRESH_SHIFT	0
+#define CG14_VMCR2_REFRESH_MASK		0x00000001
+#define CG14_VMCR2_TESTROWCNT_SHIFT	1
+#define CG14_VMCR2_TESTROWCNT_MASK	0x00000002
+#define CG14_VMCR2_FBCONFIG_SHIFT	2
+#define CG14_VMCR2_FBCONFIG_MASK	0x0000000c
+#define CG14_VCR_REFRESHREQ_SHIFT	0
+#define CG14_VCR_REFRESHREQ_MASK	0x000003ff
+#define CG14_VCR1_REFRESHENA_SHIFT	10
+#define CG14_VCR1_REFRESHENA_MASK	0x00000400
+#define CG14_VCA_CAD_SHIFT		0
+#define CG14_VCA_CAD_MASK		0x000003ff
+#define CG14_VCA_VERS_SHIFT		10
+#define CG14_VCA_VERS_MASK		0x00000c00
+#define CG14_VCA_RAMSPEED_SHIFT		12
+#define CG14_VCA_RAMSPEED_MASK		0x00001000
+#define CG14_VCA_8MB_SHIFT		13
+#define CG14_VCA_8MB_MASK		0x00002000
+
+#define CG14_MCR_PIXMODE_8		0
+#define CG14_MCR_PIXMODE_16		2
+#define CG14_MCR_PIXMODE_32		3
+
+struct cg14_regs{
+	volatile u8 mcr;	/* Master Control Reg */
+	volatile u8 ppr;	/* Packed Pixel Reg */
+	volatile u8 tms[2];	/* Test Mode Status Regs */
+	volatile u8 msr;	/* Master Status Reg */
+	volatile u8 fsr;	/* Fault Status Reg */
+	volatile u8 rev;	/* Revision & Impl */
+	volatile u8 ccr;	/* Clock Control Reg */
+	volatile u32 tmr;	/* Test Mode Read Back */
+	volatile u8 mod;	/* Monitor Operation Data Reg */
+	volatile u8 acr;	/* Aux Control */
+	u8 xxx0[6];
+	volatile u16 hct;	/* Hor Counter */
+	volatile u16 vct;	/* Vert Counter */
+	volatile u16 hbs;	/* Hor Blank Start */
+	volatile u16 hbc;	/* Hor Blank Clear */
+	volatile u16 hss;	/* Hor Sync Start */
+	volatile u16 hsc;	/* Hor Sync Clear */
+	volatile u16 csc;	/* Composite Sync Clear */
+	volatile u16 vbs;	/* Vert Blank Start */
+	volatile u16 vbc;	/* Vert Blank Clear */
+	volatile u16 vss;	/* Vert Sync Start */
+	volatile u16 vsc;	/* Vert Sync Clear */
+	volatile u16 xcs;
+	volatile u16 xcc;
+	volatile u16 fsa;	/* Fault Status Address */
+	volatile u16 adr;	/* Address Registers */
+	u8 xxx1[0xce];
+	volatile u8 pcg[0x100]; /* Pixel Clock Generator */
+	volatile u32 vbr;	/* Frame Base Row */
+	volatile u32 vmcr;	/* VBC Master Control */
+	volatile u32 vcr;	/* VBC refresh */
+	volatile u32 vca;	/* VBC Config */
+};
+
+#define CG14_CCR_ENABLE	0x04
+#define CG14_CCR_SELECT 0x02	/* HW/Full screen */
+
+struct cg14_cursor {
+	volatile u32 cpl0[32];	/* Enable plane 0 */
+	volatile u32 cpl1[32];  /* Color selection plane */
+	volatile u8 ccr;	/* Cursor Control Reg */
+	u8 xxx0[3];
+	volatile u16 cursx;	/* Cursor x,y position */
+	volatile u16 cursy;	/* Cursor x,y position */
+	volatile u32 color0;
+	volatile u32 color1;
+	u32 xxx1[0x1bc];
+	volatile u32 cpl0i[32];	/* Enable plane 0 autoinc */
+	volatile u32 cpl1i[32]; /* Color selection autoinc */
+};
+
+struct cg14_dac {
+	volatile u8 addr;	/* Address Register */
+	u8 xxx0[255];
+	volatile u8 glut;	/* Gamma table */
+	u8 xxx1[255];
+	volatile u8 select;	/* Register Select */
+	u8 xxx2[255];
+	volatile u8 mode;	/* Mode Register */
+};
+
+struct cg14_xlut{
+	volatile u8 x_xlut [256];
+	volatile u8 x_xlutd [256];
+	u8 xxx0[0x600];
+	volatile u8 x_xlut_inc [256];
+	volatile u8 x_xlutd_inc [256];
+};
+
+/* Color look up table (clut) */
+/* Each one of these arrays hold the color lookup table (for 256
+ * colors) for each MDI page (I assume then there should be 4 MDI
+ * pages, I still wonder what they are.  I have seen NeXTStep split
+ * the screen in four parts, while operating in 24 bits mode.  Each
+ * integer holds 4 values: alpha value (transparency channel, thanks
+ * go to John Stone (johns@umr.edu) from OpenBSD), red, green and blue
+ *
+ * I currently use the clut instead of the Xlut
+ */
+struct cg14_clut {
+	unsigned int c_clut [256];
+	unsigned int c_clutd [256];    /* i wonder what the 'd' is for */
+	unsigned int c_clut_inc [256];
+	unsigned int c_clutd_inc [256];
+};
+
+static struct sbus_mmap_map cg14_mmap_map[] __initdata = {
+	{ CG14_REGS,		0x80000000,		0x1000		    },
+	{ CG14_XLUT,		0x80003000,		0x1000		    },
+	{ CG14_CLUT1,		0x80004000,		0x1000		    },
+	{ CG14_CLUT2,		0x80005000,		0x1000		    },
+	{ CG14_CLUT3,		0x80006000,		0x1000		    },
+	{ CG3_MMAP_OFFSET - 
+	  0x7000,		0x80000000,		0x7000		    },
+	{ CG3_MMAP_OFFSET,	0x00000000,		SBUS_MMAP_FBSIZE(1) },
+	{ MDI_CURSOR_MAP,	0x80001000,		0x1000		    },
+	{ MDI_CHUNKY_BGR_MAP,	0x01000000,		0x400000	    },
+	{ MDI_PLANAR_X16_MAP,	0x02000000,		0x200000	    },
+	{ MDI_PLANAR_C16_MAP,	0x02800000,		0x200000	    },
+	{ MDI_PLANAR_X32_MAP,	0x03000000,		0x100000	    },
+	{ MDI_PLANAR_B32_MAP,	0x03400000,		0x100000	    },
+	{ MDI_PLANAR_G32_MAP,	0x03800000,		0x100000	    },
+	{ MDI_PLANAR_R32_MAP,	0x03c00000,		0x100000	    },
+	{ 0,			0,			0		    }
+};
+
+static void cg14_loadcmap (struct fb_info_sbusfb *fb, int index, int count)
+{
+	struct cg14_clut *clut = fb->s.cg14.clut;
+	        
+	for (; count--; index++)
+		clut->c_clut[index] = 
+			(fb->color_map CM(index,2) << 16) |
+			(fb->color_map CM(index,1) << 8) |
+			(fb->color_map CM(index,0));
+}
+
+static void cg14_margins (struct fb_info_sbusfb *fb, struct display *p, int x_margin, int y_margin)
+{
+	p->screen_base += (y_margin - fb->y_margin) * p->line_length + (x_margin - fb->x_margin);
+}
+
+static void cg14_setcursormap (struct fb_info_sbusfb *fb, u8 *red, u8 *green, u8 *blue)
+{
+	struct cg14_cursor *cur = fb->s.cg14.cursor;
+	
+	cur->color0 = ((red[0]) | (green[0] << 8) | (blue[0] << 16));
+	cur->color1 = ((red[1]) | (green[1] << 8) | (blue[1] << 16));
+}
+
+/* Set cursor shape */
+static void cg14_setcurshape (struct fb_info_sbusfb *fb)
+{
+	struct cg14_cursor *cur = fb->s.cg14.cursor;
+	int i;
+
+	for (i = 0; i < 32; i++){
+		cur->cpl0 [i] = fb->cursor.bits[0][i];
+		cur->cpl1 [i] = fb->cursor.bits[1][i];
+	}
+}
+
+/* Load cursor information */
+static void cg14_setcursor (struct fb_info_sbusfb *fb)
+{
+	struct cg_cursor *c = &fb->cursor;
+	struct cg14_cursor *cur = fb->s.cg14.cursor;
+                
+	if (c->enable)
+		cur->ccr |= CG14_CCR_ENABLE;
+	cur->cursx = ((c->cpos.fbx - c->chot.fbx) & 0xfff);
+	cur->cursy = ((c->cpos.fby - c->chot.fby) & 0xfff);
+}
+
+static void cg14_switch_from_graph (struct fb_info_sbusfb *fb)
+{
+	/* Set the 8-bpp mode */
+	if (fb->open && fb->mmaped){
+		volatile char *mcr = &fb->s.cg14.regs->mcr;
+	                                
+		fb->s.cg14.mode = 8;
+		*mcr = (*mcr & ~(CG14_MCR_PIXMODE_MASK));
+	}
+}
+
+static void cg14_reset (struct fb_info_sbusfb *fb)
+{
+	volatile char *mcr = &fb->s.cg14.regs->mcr;
+	        
+	*mcr = (*mcr & ~(CG14_MCR_PIXMODE_MASK));
+}
+
+static int cg14_ioctl (struct fb_info_sbusfb *fb, unsigned int cmd, unsigned long arg)
+{
+	volatile char *mcr = &fb->s.cg14.regs->mcr;
+	struct mdi_cfginfo *mdii;
+	int mode;
+	        
+	switch (cmd) {
+	case MDI_RESET:
+		*mcr = (*mcr & ~CG14_MCR_PIXMODE_MASK);
+		break;
+	case MDI_GET_CFGINFO:
+		mdii = (struct mdi_cfginfo *)arg;
+		put_user_ret(FBTYPE_MDICOLOR, &mdii->mdi_type, -EFAULT);
+		__put_user_ret(fb->type.fb_height, &mdii->mdi_height, -EFAULT);
+		__put_user_ret(fb->type.fb_width, &mdii->mdi_width, -EFAULT);
+		__put_user_ret(fb->s.cg14.mode, &mdii->mdi_mode, -EFAULT);
+		__put_user_ret(72, &mdii->mdi_pixfreq, -EFAULT); /* FIXME */
+		__put_user_ret(fb->s.cg14.ramsize, &mdii->mdi_size, -EFAULT);
+		break;
+	case MDI_SET_PIXELMODE:
+		get_user_ret(mode, (int *)arg, -EFAULT);
+		switch (mode){
+		case MDI_32_PIX:
+			*mcr = (*mcr & ~CG14_MCR_PIXMODE_MASK) |
+				(CG14_MCR_PIXMODE_32 << CG14_MCR_PIXMODE_SHIFT);
+			break;
+		case MDI_16_PIX:
+			*mcr = (*mcr & ~CG14_MCR_PIXMODE_MASK) | 0x20;
+			break;
+		case MDI_8_PIX:
+			*mcr = (*mcr & ~CG14_MCR_PIXMODE_MASK);
+			break;
+		default:
+			return -ENOSYS;
+		}
+		fb->s.cg14.mode = mode;
+		break;
+	default:
+		return -EINVAL;
+	}
+	return 0;
+}
+
+__initfunc(static unsigned long get_phys(unsigned long addr))
+{
+	return __get_phys(addr);
+}
+
+__initfunc(static int get_iospace(unsigned long addr))
+{
+	return __get_iospace(addr);
+}
+
+static char idstring[60] __initdata = { 0 };
+
+__initfunc(char *cgfourteenfb_init(struct fb_info_sbusfb *fb))
+{
+	struct fb_fix_screeninfo *fix = &fb->fix;
+	struct display *disp = &fb->disp;
+	struct fbtype *type = &fb->type;
+	unsigned long rphys, phys;
+	u32 bases[6];
+	int is_8mb, i;
+
+#ifndef FBCON_HAS_CFB8
+	return NULL;
+#endif
+	prom_getproperty (fb->prom_node, "address", (char *) &bases[0], 8);
+	if (!bases[0]) {
+		printk("cg14 not mmaped\n");
+		return NULL;
+	}
+	if (get_iospace(bases[0]) != get_iospace(bases[1])) {
+		printk("Ugh. cg14 iospaces don't match\n");
+		return NULL;
+	}
+	fb->physbase = phys = get_phys(bases[1]);
+	rphys = get_phys(bases[0]);
+	fb->iospace = get_iospace(bases[0]);
+	fb->s.cg14.regs = (struct cg14_regs *)(unsigned long)bases[0];
+	fb->s.cg14.clut = (void *)((unsigned long)bases[0]+CG14_CLUT1);
+	fb->s.cg14.cursor = (void *)((unsigned long)bases[0]+CG14_CURSORREGS);
+	disp->screen_base = (char *)bases[1];
+	
+	/* CG14_VCA_8MB_MASK is not correctly set on the 501-2482
+	 * VSIMM, so we read the memory size from the PROM
+	 */
+	prom_getproperty(fb->prom_node, "reg", (char *) &bases[0], 24);
+	is_8mb = bases[5] == 0x800000;
+
+	fb->mmap_map = kmalloc(sizeof(cg14_mmap_map), GFP_KERNEL);
+	if (!fb->mmap_map)
+		return NULL;
+
+	for (i = 0; ; i++) {
+		fb->mmap_map[i].voff = cg14_mmap_map[i].voff;
+		fb->mmap_map[i].poff = (cg14_mmap_map[i].poff & 0x80000000) ?
+				       (cg14_mmap_map[i].poff & 0x7fffffff) + rphys - phys :
+				       cg14_mmap_map[i].poff;
+		fb->mmap_map[i].size = cg14_mmap_map[i].size;
+		if (is_8mb && fb->mmap_map[i].size >= 0x100000 &&
+		    fb->mmap_map[i].size <= 0x400000)
+			fb->mmap_map[i].size <<= 1;
+		if (!cg14_mmap_map[i].size)
+			break;
+	}
+
+	strcpy(fb->info.modename, "CGfourteen");
+	strcpy(fix->id, "CGfourteen");
+	fix->line_length = fb->var.xres_virtual;
+	
+	disp->scrollmode = SCROLL_YREDRAW;
+	disp->screen_base += fix->line_length * fb->y_margin + fb->x_margin;
+	fb->dispsw = fbcon_cfb8;
+	
+	type->fb_depth = 24;
+	fb->emulations[1] = FBTYPE_SUN3COLOR;
+
+	fb->margins = cg14_margins;
+	fb->loadcmap = cg14_loadcmap;
+	fb->setcursor = cg14_setcursor;
+	fb->setcursormap = cg14_setcursormap;
+	fb->setcurshape = cg14_setcurshape;
+	fb->reset = cg14_reset;
+	fb->switch_from_graph = cg14_switch_from_graph;
+	fb->ioctl = cg14_ioctl;
+	
+	fb->s.cg14.mode = 8;
+	fb->s.cg14.ramsize = (is_8mb) ? 0x800000 : 0x400000;
+	
+	cg14_reset(fb);
+	
+	sprintf(idstring, "cgfourteen at %x.%08lx, %dMB, rev=%d, impl=%d", fb->iospace, phys,
+		is_8mb ? 8 : 4, fb->s.cg14.regs->rev >> 4, fb->s.cg14.regs->rev & 0xf);
+	
+	return idstring;
+}
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/cgsixfb.c m68k/drivers/video/cgsixfb.c
--- jes-2.1.115/drivers/video/cgsixfb.c	Sun Aug  9 21:48:27 1998
+++ m68k/drivers/video/cgsixfb.c	Wed Jul 29 19:00:16 1998
@@ -1,4 +1,4 @@
-/* $Id: cgsixfb.c,v 1.7 1998/07/22 12:44:59 jj Exp $
+/* $Id: cgsixfb.c,v 1.9 1998/07/29 10:05:49 jj Exp $
  * cgsixfb.c: CGsix (GX,GXplus) frame buffer driver
  *
  * Copyright (C) 1996,1998 Jakub Jelinek (jj@ultra.linux.cz)
@@ -245,15 +245,15 @@
 	fbc->clip = 0;
 	fbc->pm = ~(0);
 
-        if (p->fontheightlog) {
-		y = sy << p->fontheightlog; h = height << p->fontheightlog;
+        if (fontheightlog(p)) {
+		y = sy << fontheightlog(p); h = height << fontheightlog(p);
 	} else {
-		y = sy * p->fontheight; h = height * p->fontheight;
+		y = sy * fontheight(p); h = height * fontheight(p);
 	}
-	if (p->fontwidthlog) {
-		x = sx << p->fontwidthlog; w = width << p->fontwidthlog;
+	if (fontwidthlog(p)) {
+		x = sx << fontwidthlog(p); w = width << fontwidthlog(p);
 	} else {
-		x = sx * p->fontwidth; w = width * p->fontwidth;
+		x = sx * fontwidth(p); w = width * fontwidth(p);
 	}
 	fbc->arecty = y + fb->y_margin;
 	fbc->arectx = x + fb->x_margin;
@@ -299,26 +299,21 @@
 	int i, x, y;
 	u8 *fd;
 
-	if (p->fontheightlog) {
-		y = fb->y_margin + (yy << p->fontheightlog);
-		i = ((c & p->charmask) << p->fontheightlog);
+	if (fontheightlog(p)) {
+		y = fb->y_margin + (yy << fontheightlog(p));
+		i = ((c & p->charmask) << fontheightlog(p));
 	} else {
-		y = fb->y_margin + (yy * p->fontheight);
-		i = (c & p->charmask) * p->fontheight;
+		y = fb->y_margin + (yy * fontheight(p));
+		i = (c & p->charmask) * fontheight(p);
 	}
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-	fd = p->fontdata + i;
-	x = fb->x_margin + xx * 8;
-#else
-	if (p->fontwidth <= 8)
+	if (fontwidth(p) <= 8)
 		fd = p->fontdata + i;
 	else
 		fd = p->fontdata + (i << 1);
-	if (p->fontwidthlog)
-		x = fb->x_margin + (xx << p->fontwidthlog);
+	if (fontwidthlog(p))
+		x = fb->x_margin + (xx << fontwidthlog(p));
 	else
-		x = fb->x_margin + (xx * p->fontwidth);
-#endif
+		x = fb->x_margin + (xx * fontwidth(p));
 	do {
 		i = fbc->s;
 	} while (i & 0x10000000);
@@ -333,21 +328,17 @@
 	fbc->incx = 0;
 	fbc->incy = 1;
 	fbc->x0 = x;
-	fbc->x1 = x + p->fontwidth - 1;
+	fbc->x1 = x + fontwidth(p) - 1;
 	fbc->y0 = y;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-	if (p->fontwidth <= 8) {
-#endif
-		for (i = 0; i < p->fontheight; i++)
+	if (fontwidth(p) <= 8) {
+		for (i = 0; i < fontheight(p); i++)
 			fbc->font = *fd++ << 24;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
 	} else {
-		for (i = 0; i < p->fontheight; i++) {
+		for (i = 0; i < fontheight(p); i++) {
 			fbc->font = *(u16 *)fd << 16;
 			fd += 2;
 		}
 	}
-#endif
 }
 
 static void cg6_putcs(struct vc_data *conp, struct display *p, const unsigned short *s,
@@ -371,50 +362,41 @@
 	fbc->pm = 0xff;
 	x = fb->x_margin;
 	y = fb->y_margin;
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-	x += xx * 8;
-#else
-	if (p->fontwidthlog)
-		x += (xx << p->fontwidthlog);
+	if (fontwidthlog(p))
+		x += (xx << fontwidthlog(p));
 	else
-		x += xx * p->fontwidth;
-#endif
-	if (p->fontheightlog)
-		y += (yy << p->fontheightlog);
+		x += xx * fontwidth(p);
+	if (fontheightlog(p))
+		y += (yy << fontheightlog(p));
 	else
-		y += (yy * p->fontheight);
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-	if (p->fontwidth <= 8) {
-#endif
+		y += (yy * fontheight(p));
+	if (fontwidth(p) <= 8) {
 		while (count >= 4) {
 			count -= 4;
 			fbc->incx = 0;
 			fbc->incy = 1;
 			fbc->x0 = x;
-			fbc->x1 = (x += 4 * p->fontwidth) - 1;
+			fbc->x1 = (x += 4 * fontwidth(p)) - 1;
 			fbc->y0 = y;
-			if (p->fontheightlog) {
-				fd1 = p->fontdata + ((*s++ & p->charmask) << p->fontheightlog);
-				fd2 = p->fontdata + ((*s++ & p->charmask) << p->fontheightlog);
-				fd3 = p->fontdata + ((*s++ & p->charmask) << p->fontheightlog);
-				fd4 = p->fontdata + ((*s++ & p->charmask) << p->fontheightlog);
+			if (fontheightlog(p)) {
+				fd1 = p->fontdata + ((*s++ & p->charmask) << fontheightlog(p));
+				fd2 = p->fontdata + ((*s++ & p->charmask) << fontheightlog(p));
+				fd3 = p->fontdata + ((*s++ & p->charmask) << fontheightlog(p));
+				fd4 = p->fontdata + ((*s++ & p->charmask) << fontheightlog(p));
 			} else {
-				fd1 = p->fontdata + ((*s++ & p->charmask) * p->fontheight);
-				fd2 = p->fontdata + ((*s++ & p->charmask) * p->fontheight);
-				fd3 = p->fontdata + ((*s++ & p->charmask) * p->fontheight);
-				fd4 = p->fontdata + ((*s++ & p->charmask) * p->fontheight);
+				fd1 = p->fontdata + ((*s++ & p->charmask) * fontheight(p));
+				fd2 = p->fontdata + ((*s++ & p->charmask) * fontheight(p));
+				fd3 = p->fontdata + ((*s++ & p->charmask) * fontheight(p));
+				fd4 = p->fontdata + ((*s++ & p->charmask) * fontheight(p));
 			}
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-			if (p->fontwidth == 8) {
-#endif
-				for (i = 0; i < p->fontheight; i++)
+			if (fontwidth(p) == 8) {
+				for (i = 0; i < fontheight(p); i++)
 					fbc->font = ((u32)*fd4++) | ((((u32)*fd3++) | ((((u32)*fd2++) | (((u32)*fd1++) 
 						<< 8)) << 8)) << 8);
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
 			} else {
-				for (i = 0; i < p->fontheight; i++)
+				for (i = 0; i < fontheight(p); i++)
 					fbc->font = (((u32)*fd4++) | ((((u32)*fd3++) | ((((u32)*fd2++) | (((u32)*fd1++) 
-						<< p->fontwidth)) << p->fontwidth)) << p->fontwidth)) << (24 - 3 * p->fontwidth);
+						<< fontwidth(p))) << fontwidth(p))) << fontwidth(p))) << (24 - 3 * fontwidth(p));
 			}
 		}
 	} else {
@@ -423,48 +405,43 @@
 			fbc->incx = 0;
 			fbc->incy = 1;
 			fbc->x0 = x;
-			fbc->x1 = (x += 2 * p->fontwidth) - 1;
+			fbc->x1 = (x += 2 * fontwidth(p)) - 1;
 			fbc->y0 = y;
-			if (p->fontheightlog) {
-				fd1 = p->fontdata + ((*s++ & p->charmask) << (p->fontheightlog + 1));
-				fd2 = p->fontdata + ((*s++ & p->charmask) << (p->fontheightlog + 1));
+			if (fontheightlog(p)) {
+				fd1 = p->fontdata + ((*s++ & p->charmask) << (fontheightlog(p) + 1));
+				fd2 = p->fontdata + ((*s++ & p->charmask) << (fontheightlog(p) + 1));
 			} else {
-				fd1 = p->fontdata + (((*s++ & p->charmask) * p->fontheight) << 1);
-				fd2 = p->fontdata + (((*s++ & p->charmask) * p->fontheight) << 1);
+				fd1 = p->fontdata + (((*s++ & p->charmask) * fontheight(p)) << 1);
+				fd2 = p->fontdata + (((*s++ & p->charmask) * fontheight(p)) << 1);
 			}
-			for (i = 0; i < p->fontheight; i++) {
-				fbc->font = ((((u32)*(u16 *)fd1) << p->fontwidth) | ((u32)*(u16 *)fd2)) << (16 - p->fontwidth);
+			for (i = 0; i < fontheight(p); i++) {
+				fbc->font = ((((u32)*(u16 *)fd1) << fontwidth(p)) | ((u32)*(u16 *)fd2)) << (16 - fontwidth(p));
 				fd1 += 2; fd2 += 2;
 			}
 		}
-#endif
 	}
 	while (count) {
 		count--;
 		fbc->incx = 0;
 		fbc->incy = 1;
 		fbc->x0 = x;
-		fbc->x1 = (x += p->fontwidth) - 1;
+		fbc->x1 = (x += fontwidth(p)) - 1;
 		fbc->y0 = y;
-		if (p->fontheightlog)
-			i = ((*s++ & p->charmask) << p->fontheightlog);
+		if (fontheightlog(p))
+			i = ((*s++ & p->charmask) << fontheightlog(p));
 		else
-			i = ((*s++ & p->charmask) * p->fontheight);
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-		if (p->fontwidth <= 8) {
-#endif
+			i = ((*s++ & p->charmask) * fontheight(p));
+		if (fontwidth(p) <= 8) {
 			fd1 = p->fontdata + i;
-			for (i = 0; i < p->fontheight; i++)
+			for (i = 0; i < fontheight(p); i++)
 				fbc->font = *fd1++ << 24;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
 		} else {
 			fd1 = p->fontdata + (i << 1);
-			for (i = 0; i < p->fontheight; i++) {
+			for (i = 0; i < fontheight(p); i++) {
 				fbc->font = *(u16 *)fd1 << 16;
 				fd1 += 2;
 			}
 		}
-#endif
 	}
 }
 
@@ -555,11 +532,13 @@
 static void cg6_reset (struct fb_info_sbusfb *fb)
 {
 	unsigned int rev, conf;
+	struct cg6_tec *tec = fb->s.cg6.tec;
+	struct cg6_fbc *fbc = fb->s.cg6.fbc;
 	
 	/* Turn off stuff in the Transform Engine. */
-	fb->s.cg6.tec->tec_matrix = 0;
-	fb->s.cg6.tec->tec_clip = 0;
-	fb->s.cg6.tec->tec_vdc = 0;
+	tec->tec_matrix = 0;
+	tec->tec_clip = 0;
+	tec->tec_vdc = 0;
 
 	/* Take care of bugs in old revisions. */
 	rev = (*(fb->s.cg6.fhc) >> CG6_FHC_REV_SHIFT) & CG6_FHC_REV_MASK;
@@ -574,21 +553,21 @@
 	}
 
 	/* Set things in the FBC. */
-	fb->s.cg6.fbc->mode &= ~(CG6_FBC_BLIT_MASK | CG6_FBC_MODE_MASK |
-			    CG6_FBC_DRAW_MASK | CG6_FBC_BWRITE0_MASK |
-			    CG6_FBC_BWRITE1_MASK | CG6_FBC_BREAD_MASK |
-			    CG6_FBC_BDISP_MASK);
-	fb->s.cg6.fbc->mode |= (CG6_FBC_BLIT_SRC | CG6_FBC_MODE_COLOR8 |
-			   CG6_FBC_DRAW_RENDER | CG6_FBC_BWRITE0_ENABLE |
-			   CG6_FBC_BWRITE1_DISABLE | CG6_FBC_BREAD_0 |
-			   CG6_FBC_BDISP_0);
-	fb->s.cg6.fbc->clip = 0;
-	fb->s.cg6.fbc->offx = 0;
-	fb->s.cg6.fbc->offy = 0;
-	fb->s.cg6.fbc->clipminx = 0;
-	fb->s.cg6.fbc->clipminy = 0;
-	fb->s.cg6.fbc->clipmaxx = fb->type.fb_width - 1;
-	fb->s.cg6.fbc->clipmaxy = fb->type.fb_height - 1;
+	fbc->mode &= ~(CG6_FBC_BLIT_MASK | CG6_FBC_MODE_MASK |
+		       CG6_FBC_DRAW_MASK | CG6_FBC_BWRITE0_MASK |
+		       CG6_FBC_BWRITE1_MASK | CG6_FBC_BREAD_MASK |
+		       CG6_FBC_BDISP_MASK);
+	fbc->mode |= (CG6_FBC_BLIT_SRC | CG6_FBC_MODE_COLOR8 |
+		      CG6_FBC_DRAW_RENDER | CG6_FBC_BWRITE0_ENABLE |
+		      CG6_FBC_BWRITE1_DISABLE | CG6_FBC_BREAD_0 |
+		      CG6_FBC_BDISP_0);
+	fbc->clip = 0;
+	fbc->offx = 0;
+	fbc->offy = 0;
+	fbc->clipminx = 0;
+	fbc->clipminy = 0;
+	fbc->clipmaxx = fb->type.fb_width - 1;
+	fbc->clipmaxy = fb->type.fb_height - 1;
 	/* Enable cursor in Brooktree DAC. */
 	fb->s.cg6.bt->addr = 0x06 << 24;
 	fb->s.cg6.bt->control |= 0x03 << 24;
@@ -610,6 +589,7 @@
 	unsigned long phys = fb->sbdp->reg_addrs[0].phys_addr;
 	u32 conf;
 	char *p;
+	struct bt_regs *bt;
 
 	strcpy(fb->info.modename, "CGsix");
 		
@@ -630,7 +610,7 @@
 			sizeof(struct cg6_tec), "cgsix_tec", fb->iospace, 0);
 	fb->s.cg6.thc = (struct cg6_thc *)sparc_alloc_io(phys + CG6_THC_OFFSET, 0, 
 				sizeof(struct cg6_thc), "cgsix_thc", fb->iospace, 0);
-	fb->s.cg6.bt = (struct bt_regs *)sparc_alloc_io(phys + CG6_BROOKTREE_OFFSET, 0, 
+	fb->s.cg6.bt = bt = (struct bt_regs *)sparc_alloc_io(phys + CG6_BROOKTREE_OFFSET, 0, 
 				sizeof(struct bt_regs), "cgsix_dac", fb->iospace, 0);
 	fb->s.cg6.fhc = (u32 *)sparc_alloc_io(phys + CG6_FHC_OFFSET, 0, 
 				sizeof(u32), "cgsix_fhc", fb->iospace, 0);
@@ -651,14 +631,14 @@
 	fb->mmap_map = cg6_mmap_map;
 	
 	/* Initialize Brooktree DAC */
-	fb->s.cg6.bt->addr = 0x04 << 24;         /* color planes */
-	fb->s.cg6.bt->control = 0xff << 24;
-	fb->s.cg6.bt->addr = 0x05 << 24;
-	fb->s.cg6.bt->control = 0x00 << 24;
-	fb->s.cg6.bt->addr = 0x06 << 24;         /* overlay plane */
-	fb->s.cg6.bt->control = 0x73 << 24;
-	fb->s.cg6.bt->addr = 0x07 << 24;
-	fb->s.cg6.bt->control = 0x00 << 24;
+	bt->addr = 0x04 << 24;         /* color planes */
+	bt->control = 0xff << 24;
+	bt->addr = 0x05 << 24;
+	bt->control = 0x00 << 24;
+	bt->addr = 0x06 << 24;         /* overlay plane */
+	bt->control = 0x73 << 24;
+	bt->addr = 0x07 << 24;
+	bt->control = 0x00 << 24;
 	
 	conf = *fb->s.cg6.fhc;
 	switch(conf & CG6_FHC_CPU_MASK) {
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/chipsfb.c m68k/drivers/video/chipsfb.c
--- jes-2.1.115/drivers/video/chipsfb.c	Sun Aug  9 21:48:27 1998
+++ m68k/drivers/video/chipsfb.c	Wed Aug 12 09:29:25 1998
@@ -187,8 +187,7 @@
 			  struct fb_info *info)
 {
 	if (con == currcon)		/* current console? */
-		return fb_get_cmap(cmap, &fb_display[con].var, kspc,
-				   chipsfb_getcolreg, info);
+		return fb_get_cmap(cmap, kspc, chipsfb_getcolreg, info);
 	if (fb_display[con].cmap.len)	/* non default colormap? */
 		fb_copy_cmap(&fb_display[con].cmap, cmap, kspc? 0: 2);
 	else
@@ -209,8 +208,7 @@
 	}
 
 	if (con == currcon)
-		return fb_set_cmap(cmap, &disp->var, kspc, chipsfb_setcolreg,
-				   info);
+		return fb_set_cmap(cmap, kspc, chipsfb_setcolreg, info);
 	fb_copy_cmap(cmap, &disp->cmap, kspc==0);
 	return 0;
 }
@@ -229,9 +227,7 @@
 	int	bit_depth;
 
 	if (fb_display[currcon].cmap.len)
-		fb_get_cmap(&old_disp->cmap,
-			    &old_disp->var, 1, chipsfb_getcolreg,
-			    info);
+		fb_get_cmap(&old_disp->cmap, 1, chipsfb_getcolreg, info);
 
 	bit_depth = new_disp->var.bits_per_pixel;
 	if (old_disp->var.bits_per_pixel != bit_depth)
@@ -279,9 +275,10 @@
 
 	if (regno > 255)
 		return 1;
-	*red = p->palette[regno].red;
-	*green = p->palette[regno].green;
-	*blue = p->palette[regno].blue;
+	*red = (p->palette[regno].red<<8) | p->palette[regno].red;
+	*green = (p->palette[regno].green<<8) | p->palette[regno].green;
+	*blue = (p->palette[regno].blue<<8) | p->palette[regno].blue;
+	*transp = 0;
 	return 0;
 }
 
@@ -292,6 +289,9 @@
 
 	if (regno > 255)
 		return 1;
+	red >>= 8;
+	green >>= 8;
+	blue >>= 8;
 	p->palette[regno].red = red;
 	p->palette[regno].green = green;
 	p->palette[regno].blue = blue;
@@ -302,8 +302,8 @@
 	out_8(p->io_base + 0x3c9, blue);
 
 #ifdef FBCON_HAS_CFB16
-    if (regno < 16)
-		fbcon_cfb16_cmap[regno] = (red << 10) | (green << 5) | blue;		
+	if (regno < 16)
+		fbcon_cfb16_cmap[regno] = (red << 10) | (green << 5) | blue;
 #endif
 
     return 0;
@@ -314,18 +314,13 @@
 	if (con != currcon)
 		return;
 	if (fb_display[con].cmap.len)
-		fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-			    chipsfb_setcolreg, info);
-	else
-		fb_set_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel), &fb_display[con].var, 1,
-			    chipsfb_setcolreg, info);
+		fb_set_cmap(&fb_display[con].cmap, 1, chipsfb_setcolreg, info);
+	else {
+		int size = fb_display[con].var.bits_per_pixel == 16 ? 32 : 256;
+		fb_set_cmap(fb_default_cmap(size), 1, chipsfb_setcolreg, info);
+	}
 }
 
-#ifdef CONFIG_FB_COMPAT_XPMAC
-/* from drivers/macintosh/pmac-cons.h */
-#define VMODE_800_600_60	10	/* 800x600, 60Hz */
-#endif /* CONFIG_FB_COMPAT_XPMAC */
-
 static void chips_set_bitdepth(struct fb_info_chips *p, struct display* disp, int con, int bpp)
 {
 	int err;
@@ -396,7 +391,6 @@
 {
 	int i;
 
-	memset(&p->fix, 0, sizeof(p->fix));
 	strcpy(p->fix.id, "C&T 65550");
 	p->fix.smem_start = (char *) p->chips_base_phys;
 	p->fix.smem_len = 800 * 600;
@@ -405,7 +399,6 @@
 	p->fix.visual = FB_VISUAL_PSEUDOCOLOR;
 	p->fix.line_length = 800;
 
-	memset(&p->var, 0, sizeof(p->var));
 	p->var.xres = 800;
 	p->var.yres = 600;
 	p->var.xres_virtual = 800;
@@ -419,7 +412,6 @@
 	p->var.upper_margin = p->var.lower_margin = 16;
 	p->var.hsync_len = p->var.vsync_len = 8;
 
-	memset(&p->disp, 0, sizeof(p->disp));
 	p->disp.var = p->var;
 	p->disp.cmap.red = NULL;
 	p->disp.cmap.green = NULL;
@@ -507,6 +499,7 @@
 	p = kmalloc(sizeof(*p), GFP_ATOMIC);
 	if (p == 0)
 		return;
+	memset(p, 0, sizeof(*p));
 	addr = dp->addrs[0].address;
 	p->chips_base_phys = addr;
 	p->frame_buffer = __ioremap(addr+0x800000, 0x100000, _PAGE_NO_CACHE);
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/clgenfb.c m68k/drivers/video/clgenfb.c
--- jes-2.1.115/drivers/video/clgenfb.c	Sun Aug  9 21:48:28 1998
+++ m68k/drivers/video/clgenfb.c	Wed Aug 12 09:29:30 1998
@@ -2,7 +2,6 @@
  * Based on retz3fb.c and clgen.c
  */
  
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -34,17 +33,6 @@
 
 #define arraysize(x)    (sizeof(x)/sizeof(*(x)))
 
-/* zorro IDs */
-#define ZORRO_PROD_HELFRICH_SD64_RAM				0x08930A00
-#define ZORRO_PROD_HELFRICH_SD64_REG				0x08930B00
-#define ZORRO_PROD_HELFRICH_PICCOLO_RAM				0x08930500
-#define ZORRO_PROD_HELFRICH_PICCOLO_REG				0x08930600
-#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM	0x08770B00
-#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG	0x08770C00
-#define ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_RAM			0x08910200
-#define ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_REG			0x08910100
-#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3			0x08771800
-
 /* board types */
 #define BT_NONE     0
 #define BT_SD64     1
@@ -458,23 +446,54 @@
     case 8:
 	_par->line_length 	= _par->var.xres_virtual;
 	_par->visual		= FB_VISUAL_PSEUDOCOLOR;
+	_par->var.red.offset    = 0;
+	_par->var.red.length    = 6;
+	_par->var.green.offset  = 0;
+	_par->var.green.length  = 6;
+	_par->var.blue.offset   = 0;
+	_par->var.blue.length   = 6;
 	break;
 
     case 16:
 	_par->line_length	= _par->var.xres_virtual * 2;
 	_par->visual		= FB_VISUAL_DIRECTCOLOR;
+	_par->var.red.offset    = 10;
+	_par->var.red.length    = 5;
+	_par->var.green.offset  = 5;
+	_par->var.green.length  = 5;
+	_par->var.blue.offset   = 0;
+	_par->var.blue.length   = 5;
 	break;
 
     case 24:
 	_par->line_length	= _par->var.xres_virtual * 3;
 	_par->visual		= FB_VISUAL_DIRECTCOLOR;
+	_par->var.red.offset    = 16;
+	_par->var.red.length    = 8;
+	_par->var.green.offset  = 8;
+	_par->var.green.length  = 8;
+	_par->var.blue.offset   = 0;
+	_par->var.blue.length   = 8;
 	break;
 
     case 32:
 	_par->line_length	= _par->var.xres_virtual * 4;
 	_par->visual		= FB_VISUAL_DIRECTCOLOR;
+	_par->var.red.offset    = 16;
+	_par->var.red.length    = 8;
+	_par->var.green.offset  = 8;
+	_par->var.green.length  = 8;
+	_par->var.blue.offset   = 0;
+	_par->var.blue.length   = 8;
 	break;
     }
+    _par->var.red.msb_right = 0;
+    _par->var.green.msb_right = 0;
+    _par->var.blue.msb_right = 0;
+    _par->var.transp.offset = 0;
+    _par->var.transp.length = 0;
+    _par->var.transp.msb_right = 0;
+
     _par->type		= FB_TYPE_PACKED_PIXELS;
 
     /* convert from ps to kHz */
@@ -692,7 +711,7 @@
 #if 0
     	/* restore first 2 color registers for mono mode */
     	WClut( 0, 0x00, 0x00, 0x00);  /* background: black */
-	WClut( 1, 0xff, 0xff, 0xff);  /* foreground: white */
+	WClut( 1, 0x3f, 0x3f, 0x3f);  /* foreground: white */
 #endif
 	WGfx(GR5,     0);      /* mode register */
 	
@@ -956,16 +975,16 @@
 {
     unsigned char bred, bgreen, bblue;
 
-    if (regno > 255 || regno < 0)
+    if (regno > 255)
 	return (1);
 
     fb_info = (struct clgenfb_info *)info;
 
     RClut(regno, &bred, &bgreen, &bblue);
 
-    *red    = (u_int)bred;
-    *green  = (u_int)bgreen;
-    *blue   = (u_int)bblue;
+    *red = (bred<<10) | (bred<<4) | (bred>>2);
+    *green = (bgreen<<10) | (bgreen<<4) | (bgreen>>2);
+    *blue = (bblue<<10) | (bblue<<4) | (bblue>>2);
     *transp = 0;
     return (0);
 }
@@ -974,13 +993,13 @@
 			   unsigned blue, unsigned transp, 
 			   struct fb_info *info)
 {
-    if (regno > 255 || regno < 0)
+    if (regno > 255)
 	return (1);
 
     fb_info = (struct clgenfb_info *)info;
     
     /* "transparent" stuff is completely ignored. */
-    WClut(regno, (red & 0xff), (green & 0xff), (blue & 0xff));
+    WClut(regno, red>>10, green>>10, blue>>10);
 
     return (0);
 }
@@ -1241,28 +1260,28 @@
 
     /* CLUT setup */
     WClut( 0, 0x00, 0x00, 0x00);  /* background: black */
-    WClut( 1, 0xff, 0xff, 0xff);  /* foreground: white */
-    WClut( 2, 0x00, 0x80, 0x00);
-    WClut( 3, 0x00, 0x80, 0x80);
-    WClut( 4, 0x80, 0x00, 0x00);
-    WClut( 5, 0x80, 0x00, 0x80);
-    WClut( 6, 0x80, 0x40, 0x00);
-    WClut( 7, 0x80, 0x80, 0x80);
-    WClut( 8, 0x40, 0x40, 0x40);
-    WClut( 9, 0x40, 0x40, 0xc0);
-    WClut(10, 0x40, 0xc0, 0x40);
-    WClut(11, 0x40, 0xc0, 0xc0);
-    WClut(12, 0xc0, 0x40, 0x40);
-    WClut(13, 0xc0, 0x40, 0xc0);
-    WClut(14, 0xc0, 0xc0, 0x40);
-    WClut(15, 0xc0, 0xc0, 0xc0);
+    WClut( 1, 0x3f, 0x3f, 0x3f);  /* foreground: white */
+    WClut( 2, 0x00, 0x20, 0x00);
+    WClut( 3, 0x00, 0x20, 0x20);
+    WClut( 4, 0x20, 0x00, 0x00);
+    WClut( 5, 0x20, 0x00, 0x20);
+    WClut( 6, 0x20, 0x10, 0x00);
+    WClut( 7, 0x20, 0x20, 0x20);
+    WClut( 8, 0x10, 0x10, 0x10);
+    WClut( 9, 0x10, 0x10, 0x30);
+    WClut(10, 0x10, 0x30, 0x10);
+    WClut(11, 0x10, 0x30, 0x30);
+    WClut(12, 0x30, 0x10, 0x10);
+    WClut(13, 0x30, 0x10, 0x30);
+    WClut(14, 0x30, 0x30, 0x10);
+    WClut(15, 0x30, 0x30, 0x30);
 
     /* the rest a grey ramp */
     {
 	int i;
 
 	for (i = 16; i < 256; i++)
-	    WClut(i, i, i, i);
+	    WClut(i, i>>2, i>>2, i>>2);
     }
 
 
@@ -1382,12 +1401,12 @@
 static void fbcon_clgen8_bmove(struct display *p, int sy, int sx, 
 				int dy, int dx, int height, int width)
 {
-    sx     *= p->fontwidth;
-    sy     *= p->fontheight;
-    dx     *= p->fontwidth;
-    dy     *= p->fontheight;
-    width  *= p->fontwidth;
-    height *= p->fontheight;
+    sx     *= fontwidth(p);
+    sy     *= fontheight(p);
+    dx     *= fontwidth(p);
+    dy     *= fontheight(p);
+    width  *= fontwidth(p);
+    height *= fontheight(p);
 
     fb_info = (struct clgenfb_info*)p->fb_info;
 
@@ -1405,10 +1424,10 @@
     
     fb_info = (struct clgenfb_info*)p->fb_info;
 
-    sx     *= p->fontwidth;
-    sy     *= p->fontheight;
-    width  *= p->fontwidth;
-    height *= p->fontheight;
+    sx     *= fontwidth(p);
+    sy     *= fontheight(p);
+    width  *= fontwidth(p);
+    height *= fontheight(p);
 
     col = attr_bgcol_ec(p, conp);
     col &= 0xff;
@@ -1836,7 +1855,7 @@
 	fb_info->regs[0x9000] = val;
 }
 
-/*** WClut - set CLUT entry (range: 0..255 is automat. shifted to 0..63) ***/
+/*** WClut - set CLUT entry (range: 0..63) ***/
 void WClut(unsigned char regnum, unsigned char red, unsigned char green, unsigned char blue)
 {
 	unsigned int data = 0x3c9;
@@ -1849,19 +1868,19 @@
 		/* but DAC data register IS, at least for Picasso II */
 		if(fb_info->btype == BT_PICASSO)
 			data += 0xfff;
-		fb_info->regs[data] = (red   >> 2);
-		fb_info->regs[data] = (green >> 2);
-		fb_info->regs[data] = (blue  >> 2);
+		fb_info->regs[data] = red;
+		fb_info->regs[data] = green;
+		fb_info->regs[data] = blue;
 	}
 	else
 	{
-		fb_info->regs[data] = (blue  >> 2);
-		fb_info->regs[data] = (green >> 2);
-		fb_info->regs[data] = (red   >> 2);
+		fb_info->regs[data] = blue;
+		fb_info->regs[data] = green;
+		fb_info->regs[data] = red;
 	}
 }
 
-/*** RClut - read CLUT entry and convert to 0..255 range ***/
+/*** RClut - read CLUT entry (range 0..63) ***/
 void RClut(unsigned char regnum, unsigned char *red, unsigned char *green, unsigned char *blue)
 {
 	unsigned int data = 0x3c9;
@@ -1872,15 +1891,15 @@
 	{
 		if(fb_info->btype == BT_PICASSO)
 			data += 0xfff;
-		*red   = fb_info->regs[data] << 2;
-		*green = fb_info->regs[data] << 2;
-		*blue  = fb_info->regs[data] << 2;
+		*red   = fb_info->regs[data];
+		*green = fb_info->regs[data];
+		*blue  = fb_info->regs[data];
 	}
 	else
 	{
-		*blue  = fb_info->regs[data] << 2;
-		*green = fb_info->regs[data] << 2;
-		*red   = fb_info->regs[data] << 2;
+		*blue  = fb_info->regs[data];
+		*green = fb_info->regs[data];
+		*red   = fb_info->regs[data];
 	}
 }
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/controlfb.c m68k/drivers/video/controlfb.c
--- jes-2.1.115/drivers/video/controlfb.c	Sun Aug  9 21:48:28 1998
+++ m68k/drivers/video/controlfb.c	Wed Aug 12 09:29:31 1998
@@ -244,8 +244,7 @@
 			  struct fb_info *info)
 {
 	if (con == currcon)		/* current console? */
-		return fb_get_cmap(cmap, &fb_display[con].var, kspc,
-				   controlfb_getcolreg, info);
+		return fb_get_cmap(cmap, kspc, controlfb_getcolreg, info);
 	if (fb_display[con].cmap.len)	/* non default colormap? */
 		fb_copy_cmap(&fb_display[con].cmap, cmap, kspc? 0: 2);
 	else {
@@ -269,8 +268,7 @@
 	}
 
 	if (con == currcon)
-		return fb_set_cmap(cmap, &disp->var, kspc, controlfb_setcolreg,
-				   info);
+		return fb_set_cmap(cmap, kspc, controlfb_setcolreg, info);
 	fb_copy_cmap(cmap, &disp->cmap, kspc ? 0 : 1);
 	return 0;
 }
@@ -284,8 +282,7 @@
 static int controlfb_switch(int con, struct fb_info *info)
 {
 	if (fb_display[currcon].cmap.len)
-		fb_get_cmap(&fb_display[currcon].cmap,
-			    &fb_display[currcon].var, 1, controlfb_getcolreg,
+		fb_get_cmap(&fb_display[currcon].cmap, 1, controlfb_getcolreg,
 			    info);
 	currcon = con;
 #if 0
@@ -346,9 +343,10 @@
 
 	if (regno > 255)
 		return 1;
-	*red = p->palette[regno].red;
-	*green = p->palette[regno].green;
-	*blue = p->palette[regno].blue;
+	*red = (p->palette[regno].red<<8) | p->palette[regno].red;
+	*green = (p->palette[regno].green<<8) | p->palette[regno].green;
+	*blue = (p->palette[regno].blue<<8) | p->palette[regno].blue;
+	*transp = 0;
 	return 0;
 }
 
@@ -356,9 +354,13 @@
 			     u_int transp, struct fb_info *info)
 {
 	struct fb_info_control *p = (struct fb_info_control *) info;
+	int i;
 
-	if (regno > 255 || regno < 0)
+	if (regno > 255)
 		return 1;
+	red >>= 8;
+	green >>= 8;
+	blue >>= 8;
 	p->palette[regno].red = red;
 	p->palette[regno].green = green;
 	p->palette[regno].blue = blue;
@@ -368,25 +370,29 @@
 	out_8(&p->cmap_regs->lut, green);	/* a time...			*/
 	out_8(&p->cmap_regs->lut, blue);
 
-	if(regno < 16) {
-#if 0
+	if (regno < 16)
+		switch (p->var.bits_per_pixel) {
 #ifdef FBCON_HAS_CFB16
-		fbcon_cfb16_cmap[regno] = (red << 10) | (green << 5) | blue;
-#endif
-#ifdef FBCON_HAS_CFB32
-		fbcon_cfb32_cmap[regno] = (red << 16) | (green << 8) | blue;
-		/* I think. */
-#endif
+			case 16:
+#if 0
+				fbcon_cfb16_cmap[regno] = (red << 10) | (green << 5) | blue;
 #else
-#ifdef FBCON_HAS_CFB16
-		fbcon_cfb16_cmap[regno] = (regno << 10) | (regno << 5) | regno;
+				fbcon_cfb16_cmap[regno] = (regno << 10) | (regno << 5) | regno;
+#endif
+				break;
 #endif
 #ifdef FBCON_HAS_CFB32
-		fbcon_cfb32_cmap[regno] = (regno << 24) | (regno << 16) | (regno << 8) | regno;
-		/* I think. */
+			case 32:
+#if 0
+				fbcon_cfb32_cmap[regno] = (red << 16) | (green << 8) | blue;
+#else
+				i = (regno << 8) | regno;
+				fbcon_cfb32_cmap[regno] = (i << 16) | i;
+				/* I think */
 #endif
+				break;
 #endif
-	}
+		}
 	return 0;
 }
 
@@ -395,12 +401,12 @@
 	if (con != currcon)
 		return;
 	if (fb_display[con].cmap.len)
-		fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-			    controlfb_setcolreg, info);
+		fb_set_cmap(&fb_display[con].cmap, 1, controlfb_setcolreg,
+			    info);
 	else {
 		int size = fb_display[con].var.bits_per_pixel == 16 ? 32 : 256;
-		fb_set_cmap(fb_default_cmap(size), &fb_display[con].var, 1,
-			    controlfb_setcolreg, info);
+		fb_set_cmap(fb_default_cmap(size), 1, controlfb_setcolreg,
+			    info);
 	}
 }
 
@@ -578,6 +584,7 @@
 	p = kmalloc(sizeof(*p), GFP_ATOMIC);
 	if (p == 0)
 		return;
+	memset(p, 0, sizeof(*p));
 
 	/* Map in frame buffer and registers */
 	for (i = 0; i < dp->n_addrs; ++i) {
@@ -901,7 +908,7 @@
 	p->fix.smem_len = control_vram_reqd(par->vmode, par->cmode);
 		/* Hmm, jonh used total_vram here. */
 	p->fix.visual = (par->cmode == CMODE_8) ?
-		FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
+		FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR;
 	p->fix.line_length = par->vxres << par->cmode;
 		/* ywrapstep, xpanstep, ypanstep */
 }
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/creatorfb.c m68k/drivers/video/creatorfb.c
--- jes-2.1.115/drivers/video/creatorfb.c	Sun Aug  9 21:48:28 1998
+++ m68k/drivers/video/creatorfb.c	Mon Aug 10 19:21:34 1998
@@ -1,4 +1,4 @@
-/* $Id: creatorfb.c,v 1.9 1998/07/22 12:45:04 jj Exp $
+/* $Id: creatorfb.c,v 1.13 1998/08/07 19:10:48 jj Exp $
  * creatorfb.c: Creator/Creator3D frame buffer driver
  *
  * Copyright (C) 1997,1998 Jakub Jelinek (jj@ultra.linux.cz)
@@ -68,56 +68,141 @@
 #define	FFB_PROM_POFF		0x00000000
 #define	FFB_EXP_POFF		0x00200000
 
-#define FFB_Y_BYTE_ADDR_SHIFT          11
-#define FFB_Y_ADDR_SHIFT               13
-
-#define FFB_PPC_ACE_DISABLE             1
-#define FFB_PPC_ACE_AUX_ADD             3
-#define FFB_PPC_ACE_SHIFT              18
-#define FFB_PPC_DCE_DISABLE             2
-#define FFB_PPC_DCE_SHIFT              16
-#define FFB_PPC_ABE_DISABLE             2
-#define FFB_PPC_ABE_SHIFT              14
-#define FFB_PPC_VCE_DISABLE             1
-#define FFB_PPC_VCE_2D                  2
-#define FFB_PPC_VCE_SHIFT              12
-#define FFB_PPC_APE_DISABLE             2
-#define FFB_PPC_APE_SHIFT              10
-#define FFB_PPC_CS_VARIABLE             2
-#define FFB_PPC_CS_SHIFT                0
-
-#define FFB_FBC_WB_A                    1
-#define FFB_FBC_WB_SHIFT               29
-#define FFB_FBC_PGE_MASK                3
-#define FFB_FBC_BE_SHIFT                4
-#define FFB_FBC_GE_SHIFT                2
-#define FFB_FBC_RE_SHIFT                0
+/* Draw operations */
+#define FFB_DRAWOP_DOT		0x00
+#define FFB_DRAWOP_AADOT	0x01
+#define FFB_DRAWOP_BRLINECAP	0x02
+#define FFB_DRAWOP_BRLINEOPEN	0x03
+#define FFB_DRAWOP_DDLINE	0x04
+#define FFB_DRAWOP_AALINE	0x05
+#define FFB_DRAWOP_TRIANGLE	0x06
+#define FFB_DRAWOP_POLYGON	0x07
+#define FFB_DRAWOP_RECTANGLE	0x08
+#define FFB_DRAWOP_FASTFILL	0x09
+#define FFB_DRAWOP_BCOPY	0x0a
+#define FFB_DRAWOP_VSCROLL	0x0b
+
+/* Pixel processor control */
+/* Force WID */
+#define FFB_PPC_FW_DISABLE	0x800000
+#define FFB_PPC_FW_ENABLE	0xc00000
+/* Auxiliary clip */
+#define FFB_PPC_ACE_DISABLE	0x040000
+#define FFB_PPC_ACE_AUX_SUB	0x080000
+#define FFB_PPC_ACE_AUX_ADD	0x0c0000
+/* Depth cue */
+#define FFB_PPC_DCE_DISABLE	0x020000
+#define FFB_PPC_DCE_ENABLE	0x030000
+/* Alpha blend */
+#define FFB_PPC_ABE_DISABLE	0x008000
+#define FFB_PPC_ABE_ENABLE	0x00c000
+/* View clip */
+#define FFB_PPC_VCE_DISABLE	0x001000
+#define FFB_PPC_VCE_2D		0x002000
+#define FFB_PPC_VCE_3D		0x003000
+/* Area pattern */
+#define FFB_PPC_APE_DISABLE	0x000800
+#define FFB_PPC_APE_ENABLE	0x000c00
+/* Transparent background */
+#define FFB_PPC_TBE_OPAQUE	0x000200
+#define FFB_PPC_TBE_TRANSPARENT	0x000300
+/* Z source */
+#define FFB_PPC_ZS_VAR		0x000080
+#define FFB_PPC_ZS_CONST	0x0000c0
+/* Y source */
+#define FFB_PPC_YS_VAR		0x000020
+#define FFB_PPC_YS_CONST	0x000030
+/* X source */
+#define FFB_PPC_XS_WID		0x000004
+#define FFB_PPC_XS_VAR		0x000008
+#define FFB_PPC_XS_CONST	0x00000c
+/* Color (BGR) source */
+#define FFB_PPC_CS_VAR		0x000002
+#define FFB_PPC_CS_CONST	0x000003
 
 #define FFB_ROP_NEW                  0x83
-#define FFB_ROP_RGB_SHIFT               0
 
 #define FFB_UCSR_FIFO_MASK     0x00000fff
 #define FFB_UCSR_RP_BUSY       0x02000000
 
 struct ffb_fbc {
-	u8		xxx1[0x60];
+	/* Next vertex registers */
+	u32		xxx1[3];
+	volatile u32	alpha;
+	volatile u32	red;
+	volatile u32	green;
+	volatile u32	blue;
+	volatile u32	depth;
+	volatile u32	y;
+	volatile u32	x;
+	u32		xxx2[2];
+	volatile u32	ryf;
+	volatile u32	rxf;
+	u32		xxx3[2];
+	
+	volatile u32	dmyf;
+	volatile u32	dmxf;
+	u32		xxx4[2];
+	volatile u32	ebyi;
+	volatile u32	ebxi;
+	u32		xxx5[2];
 	volatile u32	by;
 	volatile u32	bx;
-	u32		xxx2;
-	u32		xxx3;
+	u32		dy;
+	u32		dx;
 	volatile u32	bh;
 	volatile u32	bw;
-	u8		xxx4[0x188];
+	u32		xxx6[2];
+	
+	u32		xxx7[32];
+	
+	/* Setup unit vertex state register */
+	volatile u32	suvtx;
+	u32		xxx8[63];
+	
+	/* Control registers */
 	volatile u32	ppc;
-	u32		xxx5;
+	volatile u32	wid;
 	volatile u32	fg;
 	volatile u32	bg;
-	u8		xxx6[0x44];
+	volatile u32	consty;
+	volatile u32	constz;
+	volatile u32	xclip;
+	volatile u32	dcss;
+	volatile u32	vclipmin;
+	volatile u32	vclipmax;
+	volatile u32	vclipzmin;
+	volatile u32	vclipzmax;
+	volatile u32	dcsf;
+	volatile u32	dcsb;
+	volatile u32	dczf;
+	volatile u32	dczb;
+	
+	u32		xxx9;
+	volatile u32	blendc;
+	volatile u32	blendc1;
+	volatile u32	blendc2;
+	volatile u32	fbramitc;
 	volatile u32	fbc;
 	volatile u32	rop;
-	u8		xxx7[0x34];
+	volatile u32	cmp;
+	volatile u32	matchab;
+	volatile u32	matchc;
+	volatile u32	magnab;
+	volatile u32	magnc;
+	volatile u32	fbcfg0;
+	volatile u32	fbcfg1;
+	volatile u32	fbcfg2;
+	volatile u32	fbcfg3;
+	
+	u32		ppcfg;
+	volatile u32	pick;
+	volatile u32	fillmode;
+	volatile u32	fbramwac;
 	volatile u32	pmask;
-	u8		xxx8[12];
+	volatile u32	xpmask;
+	volatile u32	ypmask;
+	volatile u32	zpmask;
 	volatile u32	clip0min;
 	volatile u32	clip0max;
 	volatile u32	clip1min;
@@ -126,18 +211,64 @@
 	volatile u32	clip2max;
 	volatile u32	clip3min;
 	volatile u32	clip3max;
-	u8		xxx9[0x3c];
-	volatile u32	unk1;
-	volatile u32	unk2;
-	u8		xxx10[0x10];
+	
+	/* New 3dRAM III support regs */
+	volatile u32	rawblend2;
+	volatile u32	rawpreblend;
+	volatile u32	rawstencil;
+	volatile u32	rawstencilctl;
+	volatile u32	threedram1;
+	volatile u32	threedram2;
+	volatile u32	passin;
+	volatile u32	rawclrdepth;
+	volatile u32	rawpmask;
+	volatile u32	rawcsrc;
+	volatile u32	rawmatch;
+	volatile u32	rawmagn;
+	volatile u32	rawropblend;
+	volatile u32	rawcmp;
+	volatile u32	rawwac;
+	volatile u32	fbramid;
+	
+	volatile u32	drawop;
+	u32		xxx10[2];
+	volatile u32	fontlpat;
+	u32		xxx11;
 	volatile u32	fontxy;
 	volatile u32	fontw;
 	volatile u32	fontinc;
 	volatile u32	font;
-	u8		xxx11[0x4dc];
-	volatile u32	unk3;
-	u8		xxx12[0xfc];
+	u32		xxx12[3];
+	volatile u32	blend2;
+	volatile u32	preblend;
+	volatile u32	stencil;
+	volatile u32	stencilctl;
+
+	u32		xxx13[4];	
+	volatile u32	dcss1;
+	volatile u32	dcss2;
+	volatile u32	dcss3;
+	volatile u32	widpmask;
+	volatile u32	dcs2;
+	volatile u32	dcs3;
+	volatile u32	dcs4;
+	u32		xxx14;
+	volatile u32	dcd2;
+	volatile u32	dcd3;
+	volatile u32	dcd4;
+	u32		xxx15;
+	
+	volatile u32	pattern[32];
+	
+	u32		xxx16[256];
+	
+	volatile u32	devid;
+	u32		xxx17[63];
+	
 	volatile u32	ucsr;
+	u32		xxx18[31];
+	
+	volatile u32	mer;
 };
 
 struct ffb_dac {
@@ -184,22 +315,18 @@
 	register struct ffb_fbc *fbc = fb->s.ffb.fbc;
 	int x, y, w, h;
 	
-	fbc->ppc = 0x1803;
 	fbc->fg = ffb_cmap[attr_bgcol_ec(p,conp)];
-	fbc->fbc = 0x2000707f;
-	fbc->rop = 0x83;
-	fbc->pmask = 0xffffffff;
-	fbc->unk2 = 8;
+	fbc->drawop = FFB_DRAWOP_RECTANGLE;
 
-	if (p->fontheightlog) {
-		y = sy << p->fontheightlog; h = height << p->fontheightlog;
+	if (fontheightlog(p)) {
+		y = sy << fontheightlog(p); h = height << fontheightlog(p);
 	} else {
-		y = sy * p->fontheight; h = height * p->fontheight;
+		y = sy * fontheight(p); h = height * fontheight(p);
 	}
-	if (p->fontwidthlog) {
-		x = sx << p->fontwidthlog; w = width << p->fontwidthlog;
+	if (fontwidthlog(p)) {
+		x = sx << fontwidthlog(p); w = width << fontwidthlog(p);
 	} else {
-		x = sx * p->fontwidth; w = width * p->fontwidth;
+		x = sx * fontwidth(p); w = width * fontwidth(p);
 	}
 	fbc->by = y + fb->y_margin;
 	fbc->bx = x + fb->x_margin;
@@ -212,12 +339,8 @@
 {
 	register struct ffb_fbc *fbc = fb->s.ffb.fbc;
 
-	fbc->ppc = 0x1803;
 	fbc->fg = ffb_cmap[attr_bgcol(p,s)];
-	fbc->fbc = 0x2000707f;
-	fbc->rop = 0x83;
-	fbc->pmask = 0xffffffff;
-	fbc->unk2 = 8;
+	fbc->drawop = FFB_DRAWOP_RECTANGLE;
 	while (count-- > 0) {
 		fbc->by = boxes[1];
 		fbc->bx = boxes[0];
@@ -234,48 +357,35 @@
 	int i, xy;
 	u8 *fd;
 
-	if (p->fontheightlog) {
-		xy = (yy << (16 + p->fontheightlog));
-		i = ((c & p->charmask) << p->fontheightlog);
+	if (fontheightlog(p)) {
+		xy = (yy << (16 + fontheightlog(p)));
+		i = ((c & p->charmask) << fontheightlog(p));
 	} else {
-		xy = ((yy * p->fontheight) << 16);
-		i = (c & p->charmask) * p->fontheight;
+		xy = ((yy * fontheight(p)) << 16);
+		i = (c & p->charmask) * fontheight(p);
 	}
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-	fd = p->fontdata + i;
-	xy += (x * 8) + fb->s.ffb.xy_margin;
-#else
-	if (p->fontwidth <= 8)
+	if (fontwidth(p) <= 8)
 		fd = p->fontdata + i;
 	else
 		fd = p->fontdata + (i << 1);
-	if (p->fontwidthlog)
-		xy += (xx << p->fontwidthlog) + fb->s.ffb.xy_margin;
+	if (fontwidthlog(p))
+		xy += (xx << fontwidthlog(p)) + fb->s.ffb.xy_margin;
 	else
-		xy += (xx * p->fontwidth) + fb->s.ffb.xy_margin;
-#endif
-	fbc->ppc = 0x203;
+		xy += (xx * fontwidth(p)) + fb->s.ffb.xy_margin;
 	fbc->fg = ffb_cmap[attr_fgcol(p,c)];
-	fbc->fbc = 0x2000707f;
-	fbc->rop = 0x83;
-	fbc->pmask = 0xffffffff;
 	fbc->bg = ffb_cmap[attr_bgcol(p,c)];
-	fbc->fontw = p->fontwidth;
+	fbc->fontw = fontwidth(p);
 	fbc->fontinc = 0x10000;
 	fbc->fontxy = xy;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-	if (p->fontwidth <= 8) {
-#endif
-		for (i = 0; i < p->fontheight; i++)
+	if (fontwidth(p) <= 8) {
+		for (i = 0; i < fontheight(p); i++)
 			fbc->font = *fd++ << 24;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
 	} else {
-		for (i = 0; i < p->fontheight; i++) {
+		for (i = 0; i < fontheight(p); i++) {
 			fbc->font = *(u16 *)fd << 16;
 			fd += 2;
 		}
 	}
-#endif
 }
 
 static void ffb_putcs(struct vc_data *conp, struct display *p, const unsigned short *s,
@@ -286,105 +396,87 @@
 	int i, xy;
 	u8 *fd1, *fd2, *fd3, *fd4;
 
-	fbc->ppc = 0x203;
 	fbc->fg = ffb_cmap[attr_fgcol(p,*s)];
-	fbc->fbc = 0x2000707f;
-	fbc->rop = 0x83;
-	fbc->pmask = 0xffffffff;
 	fbc->bg = ffb_cmap[attr_bgcol(p,*s)];
 	xy = fb->s.ffb.xy_margin;
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-	xy += xx * 8;
-#else
-	if (p->fontwidthlog)
-		xy += (xx << p->fontwidthlog);
+	if (fontwidthlog(p))
+		xy += (xx << fontwidthlog(p));
 	else
-		xy += xx * p->fontwidth;
-#endif
-	if (p->fontheightlog)
-		xy += (yy << (16 + p->fontheightlog));
+		xy += xx * fontwidth(p);
+	if (fontheightlog(p))
+		xy += (yy << (16 + fontheightlog(p)));
 	else
-		xy += ((yy * p->fontheight) << 16);
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-	if (p->fontwidth <= 8) {
-#endif
+		xy += ((yy * fontheight(p)) << 16);
+	if (fontwidth(p) <= 8) {
 		while (count >= 4) {
 			count -= 4;
-			fbc->fontw = 4 * p->fontwidth;
+			fbc->fontw = 4 * fontwidth(p);
 			fbc->fontinc = 0x10000;
 			fbc->fontxy = xy;
-			if (p->fontheightlog) {
-				fd1 = p->fontdata + ((*s++ & p->charmask) << p->fontheightlog);
-				fd2 = p->fontdata + ((*s++ & p->charmask) << p->fontheightlog);
-				fd3 = p->fontdata + ((*s++ & p->charmask) << p->fontheightlog);
-				fd4 = p->fontdata + ((*s++ & p->charmask) << p->fontheightlog);
+			if (fontheightlog(p)) {
+				fd1 = p->fontdata + ((*s++ & p->charmask) << fontheightlog(p));
+				fd2 = p->fontdata + ((*s++ & p->charmask) << fontheightlog(p));
+				fd3 = p->fontdata + ((*s++ & p->charmask) << fontheightlog(p));
+				fd4 = p->fontdata + ((*s++ & p->charmask) << fontheightlog(p));
 			} else {
-				fd1 = p->fontdata + ((*s++ & p->charmask) * p->fontheight);
-				fd2 = p->fontdata + ((*s++ & p->charmask) * p->fontheight);
-				fd3 = p->fontdata + ((*s++ & p->charmask) * p->fontheight);
-				fd4 = p->fontdata + ((*s++ & p->charmask) * p->fontheight);
+				fd1 = p->fontdata + ((*s++ & p->charmask) * fontheight(p));
+				fd2 = p->fontdata + ((*s++ & p->charmask) * fontheight(p));
+				fd3 = p->fontdata + ((*s++ & p->charmask) * fontheight(p));
+				fd4 = p->fontdata + ((*s++ & p->charmask) * fontheight(p));
 			}
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-			if (p->fontwidth == 8) {
-#endif
-				for (i = 0; i < p->fontheight; i++)
+			if (fontwidth(p) == 8) {
+				for (i = 0; i < fontheight(p); i++)
 					fbc->font = ((u32)*fd4++) | ((((u32)*fd3++) | ((((u32)*fd2++) | (((u32)*fd1++) 
 						<< 8)) << 8)) << 8);
 				xy += 32;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
 			} else {
-				for (i = 0; i < p->fontheight; i++)
+				for (i = 0; i < fontheight(p); i++)
 					fbc->font = (((u32)*fd4++) | ((((u32)*fd3++) | ((((u32)*fd2++) | (((u32)*fd1++) 
-						<< p->fontwidth)) << p->fontwidth)) << p->fontwidth)) << (24 - 3 * p->fontwidth);
-				xy += 4 * p->fontwidth;
+						<< fontwidth(p))) << fontwidth(p))) << fontwidth(p))) << (24 - 3 * fontwidth(p));
+				xy += 4 * fontwidth(p);
 			}
 		}
 	} else {
 		while (count >= 2) {
 			count -= 2;
-			fbc->fontw = 2 * p->fontwidth;
+			fbc->fontw = 2 * fontwidth(p);
 			fbc->fontinc = 0x10000;
 			fbc->fontxy = xy;
-			if (p->fontheightlog) {
-				fd1 = p->fontdata + ((*s++ & p->charmask) << (p->fontheightlog + 1));
-				fd2 = p->fontdata + ((*s++ & p->charmask) << (p->fontheightlog + 1));
+			if (fontheightlog(p)) {
+				fd1 = p->fontdata + ((*s++ & p->charmask) << (fontheightlog(p) + 1));
+				fd2 = p->fontdata + ((*s++ & p->charmask) << (fontheightlog(p) + 1));
 			} else {
-				fd1 = p->fontdata + (((*s++ & p->charmask) * p->fontheight) << 1);
-				fd2 = p->fontdata + (((*s++ & p->charmask) * p->fontheight) << 1);
+				fd1 = p->fontdata + (((*s++ & p->charmask) * fontheight(p)) << 1);
+				fd2 = p->fontdata + (((*s++ & p->charmask) * fontheight(p)) << 1);
 			}
-			for (i = 0; i < p->fontheight; i++) {
-				fbc->font = ((((u32)*(u16 *)fd1) << p->fontwidth) | ((u32)*(u16 *)fd2)) << (16 - p->fontwidth);
+			for (i = 0; i < fontheight(p); i++) {
+				fbc->font = ((((u32)*(u16 *)fd1) << fontwidth(p)) | ((u32)*(u16 *)fd2)) << (16 - fontwidth(p));
 				fd1 += 2; fd2 += 2;
 			}
-			xy += 2 * p->fontwidth;
+			xy += 2 * fontwidth(p);
 		}
-#endif
 	}
 	while (count) {
 		count--;
-		fbc->fontw = p->fontwidth;
+		fbc->fontw = fontwidth(p);
 		fbc->fontinc = 0x10000;
 		fbc->fontxy = xy;
-		if (p->fontheightlog)
-			i = ((*s++ & p->charmask) << p->fontheightlog);
+		if (fontheightlog(p))
+			i = ((*s++ & p->charmask) << fontheightlog(p));
 		else
-			i = ((*s++ & p->charmask) * p->fontheight);
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-		if (p->fontwidth <= 8) {
-#endif
+			i = ((*s++ & p->charmask) * fontheight(p));
+		if (fontwidth(p) <= 8) {
 			fd1 = p->fontdata + i;
-			for (i = 0; i < p->fontheight; i++)
+			for (i = 0; i < fontheight(p); i++)
 				fbc->font = *fd1++ << 24;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
 		} else {
 			fd1 = p->fontdata + (i << 1);
-			for (i = 0; i < p->fontheight; i++) {
+			for (i = 0; i < fontheight(p); i++) {
 				fbc->font = *(u16 *)fd1 << 16;
 				fd1 += 2;
 			}
 		}
-#endif
-		xy += p->fontwidth;
+		xy += fontwidth(p);
 	}
 }
 
@@ -477,6 +569,16 @@
 	ffb_curs_enable (fb, fb->cursor.enable);
 }
 
+static void ffb_switch_from_graph (struct fb_info_sbusfb *fb)
+{
+	register struct ffb_fbc *fbc = fb->s.ffb.fbc;
+
+	fbc->ppc = FFB_PPC_VCE_DISABLE|FFB_PPC_TBE_OPAQUE|FFB_PPC_APE_DISABLE|FFB_PPC_CS_CONST;
+	fbc->fbc = 0x2000707f;
+	fbc->rop = FFB_ROP_NEW;
+	fbc->pmask = 0xffffffff;
+}                                
+
 static char idstring[60] __initdata = { 0 };
 
 __initfunc(char *creatorfb_init(struct fb_info_sbusfb *fb))
@@ -494,7 +596,7 @@
 	strcpy(fb->info.modename, "Creator");
 		
 	strcpy(fix->id, "Creator");
-	fix->visual = FB_VISUAL_DIRECTCOLOR;
+	fix->visual = FB_VISUAL_TRUECOLOR;
 	fix->line_length = 8192;
 	fix->accel = FB_ACCEL_SUN_CREATOR;
 	
@@ -515,7 +617,10 @@
 	fb->setcursor = ffb_setcursor;
 	fb->setcursormap = ffb_setcursormap;
 	fb->setcurshape = ffb_setcurshape;
+	fb->switch_from_graph = ffb_switch_from_graph;
 	fb->fill = ffb_fill;
+	
+	ffb_switch_from_graph(fb);
 	
 	fb->physbase = regs[0].phys_addr;
 	fb->mmap_map = ffb_mmap_map;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/cyberfb.c m68k/drivers/video/cyberfb.c
--- jes-2.1.115/drivers/video/cyberfb.c	Sun Aug  9 21:48:28 1998
+++ m68k/drivers/video/cyberfb.c	Wed Aug 12 09:29:34 1998
@@ -20,8 +20,6 @@
  * for more details.
  */
 
-
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -120,7 +118,7 @@
 
 
 static unsigned int CyberKey = 0;
-static unsigned char Cyber_colour_table [256][4];
+static unsigned char Cyber_colour_table [256][3];
 static unsigned long CyberMem;
 static unsigned long CyberSize;
 static volatile char *CyberRegs;
@@ -311,7 +309,6 @@
 		Cyber_colour_table [i][0] = i;
 		Cyber_colour_table [i][1] = i;
 		Cyber_colour_table [i][2] = i;
-		Cyber_colour_table [i][3] = 0;
 	}
 
 	/*
@@ -358,7 +355,7 @@
 		*(CursorBase+3+(i*4)) = 0xffff0000;
 	}
 
-	Cyber_setcolreg (255, 56, 100, 160, 0, NULL /* unused */);
+	Cyber_setcolreg (255, 56<<8, 100<<8, 160<<8, 0, NULL /* unused */);
 	Cyber_setcolreg (254, 0, 0, 0, 0, NULL /* unused */);
 
 	return 0;
@@ -385,7 +382,7 @@
 	if (par->bpp == 8)
 		fix->visual = FB_VISUAL_PSEUDOCOLOR;
 	else
-		fix->visual = FB_VISUAL_DIRECTCOLOR;
+		fix->visual = FB_VISUAL_TRUECOLOR;
 
 	fix->xpanstep = 0;
 	fix->ypanstep = 0;
@@ -495,9 +492,7 @@
 
 
 /*
- *    Set a single color register. The values supplied are already
- *    rounded down to the hardware's capabilities (according to the
- *    entries in the var structure). Return != 0 for invalid regno.
+ *    Set a single color register. Return != 0 for invalid regno.
  */
 
 static int Cyber_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
@@ -509,14 +504,17 @@
 	}
 
 	wb_64(0x3c8, (unsigned char) regno);
-	Cyber_colour_table [regno][0] = red & 0xff;
-	Cyber_colour_table [regno][1] = green & 0xff;
-	Cyber_colour_table [regno][2] = blue & 0xff;
-	Cyber_colour_table [regno][3] = transp;
-
-	wb_64(0x3c9, (red & 0xff) >> 2);
-	wb_64(0x3c9, (green & 0xff) >> 2);
-	wb_64(0x3c9, (blue & 0xff) >> 2);
+	red >>= 10;
+	green >>= 10;
+	blue >>= 10;
+
+	Cyber_colour_table [regno][0] = red;
+	Cyber_colour_table [regno][1] = green;
+	Cyber_colour_table [regno][2] = blue;
+
+	wb_64(0x3c9, red);
+	wb_64(0x3c9, green);
+	wb_64(0x3c9, blue);
 
 	return (0);
 }
@@ -530,12 +528,17 @@
 static int Cyber_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue,
 			   u_int *transp, struct fb_info *info)
 {
+	int t;
+
 	if (regno >= 256)
 		return (1);
-	*red	= Cyber_colour_table [regno][0];
-	*green	= Cyber_colour_table [regno][1];
-	*blue	= Cyber_colour_table [regno][2];
-	*transp = Cyber_colour_table [regno][3];
+	t	= Cyber_colour_table [regno][0];
+	*red	= (t<<10) | (t<<4) | (t>>2);
+	t	= Cyber_colour_table [regno][1];
+	*green	= (t<<10) | (t<<4) | (t>>2);
+	t	= Cyber_colour_table [regno][2];
+	*blue	= (t<<10) | (t<<4) | (t>>2);
+	*transp = 0;
 	return (0);
 }
 
@@ -563,9 +566,9 @@
 		for (i = 0; i < 256; i++)
 		{
 			wb_64(0x3c8, (unsigned char) i);
-			wb_64(0x3c9, Cyber_colour_table[i][0] >> 2);
-			wb_64(0x3c9, Cyber_colour_table[i][1] >> 2);
-			wb_64(0x3c9, Cyber_colour_table[i][2] >> 2);
+			wb_64(0x3c9, Cyber_colour_table[i][0]);
+			wb_64(0x3c9, Cyber_colour_table[i][1]);
+			wb_64(0x3c9, Cyber_colour_table[i][2]);
 		}
 	}
 }
@@ -759,11 +762,10 @@
 	if (con != currcon)
 		return;
 	if (fb_display[con].cmap.len)
-		fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-			    fbhw->setcolreg, info);
+		fb_set_cmap(&fb_display[con].cmap, 1, fbhw->setcolreg, info);
 	else
 		fb_set_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel),
-			    &fb_display[con].var, 1, fbhw->setcolreg, info);
+			    1, fbhw->setcolreg, info);
 }
 
 
@@ -917,8 +919,7 @@
 			    struct fb_info *info)
 {
 	if (con == currcon) /* current console? */
-		return(fb_get_cmap(cmap, &fb_display[con].var,
-				   kspc, fbhw->getcolreg, info));
+		return(fb_get_cmap(cmap, kspc, fbhw->getcolreg, info));
 	else if (fb_display[con].cmap.len) /* non default colormap? */
 		fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
 	else
@@ -943,8 +944,7 @@
 			return(err);
 	}
 	if (con == currcon)		 /* current console? */
-		return(fb_set_cmap(cmap, &fb_display[con].var,
-				   kspc, fbhw->setcolreg, info));
+		return(fb_set_cmap(cmap, kspc, fbhw->setcolreg, info));
 	else
 		fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
 	return(0);
@@ -1069,8 +1069,8 @@
 {
 	/* Do we have to save the colormap? */
 	if (fb_display[currcon].cmap.len)
-		fb_get_cmap(&fb_display[currcon].cmap, &fb_display[currcon].var, 1,
-			    fbhw->getcolreg, info);
+		fb_get_cmap(&fb_display[currcon].cmap, 1, fbhw->getcolreg,
+			    info);
 
 	do_fb_set_var(&fb_display[con].var, 1);
 	currcon = con;
@@ -1132,9 +1132,9 @@
 			       int dx, int height, int width)
 {
     sx *= 8; dx *= 8; width *= 8;
-    Cyber_BitBLT((u_short)sx, (u_short)(sy*p->fontheight), (u_short)dx,
-		 (u_short)(dy*p->fontheight), (u_short)width,
-		 (u_short)(height*p->fontheight), (u_short)S3_NEW);
+    Cyber_BitBLT((u_short)sx, (u_short)(sy*fontheight(p)), (u_short)dx,
+		 (u_short)(dy*fontheight(p)), (u_short)width,
+		 (u_short)(height*fontheight(p)), (u_short)S3_NEW);
 }
 
 static void fbcon_cyber8_clear(struct vc_data *conp, struct display *p, int sy,
@@ -1145,9 +1145,9 @@
     sx *= 8; width *= 8;
     bg = attr_bgcol_ec(p,conp);
     Cyber_RectFill((u_short)sx,
-		   (u_short)(sy*p->fontheight),
+		   (u_short)(sy*fontheight(p)),
 		   (u_short)width,
-		   (u_short)(height*p->fontheight),
+		   (u_short)(height*fontheight(p)),
 		   (u_short)S3_NEW,
 		   (u_short)bg);
 }
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/dnfb.c m68k/drivers/video/dnfb.c
--- jes-2.1.115/drivers/video/dnfb.c	Sun Aug  9 21:48:29 1998
+++ m68k/drivers/video/dnfb.c	Mon Aug  3 19:48:02 1998
@@ -5,7 +5,6 @@
 #include <linux/tty.h>
 #include <linux/malloc.h>
 #include <linux/delay.h>
-#include <linux/config.h>
 #include <linux/interrupt.h>
 #include <asm/setup.h>
 #include <asm/segment.h>
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/dummycon.c m68k/drivers/video/dummycon.c
--- jes-2.1.115/drivers/video/dummycon.c	Sun Aug  9 21:48:29 1998
+++ m68k/drivers/video/dummycon.c	Mon Aug  3 19:48:10 1998
@@ -5,6 +5,7 @@
  *  available, usually until fbcon takes console over.
  */
 
+#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kdev_t.h>
 #include <linux/tty.h>
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcmap.c m68k/drivers/video/fbcmap.c
--- jes-2.1.115/drivers/video/fbcmap.c	Sun Aug  9 21:48:30 1998
+++ m68k/drivers/video/fbcmap.c	Wed Aug 12 09:29:36 1998
@@ -31,10 +31,6 @@
     }
 }
 
-#define CNVT_TOHW(val,width)	((((val)<<(width))+0x7fff-(val))>>16)
-#define CNVT_FROMHW(val,width)	(((width) ? ((((val)<<16)-(val)) / \
-					((1<<(width))-1)) : 0))
-
 static u16 red2[] = {
     0x0000, 0xaaaa
 };
@@ -163,9 +159,10 @@
      *  Get the colormap for a screen
      */
 
-int fb_get_cmap(struct fb_cmap *cmap, struct fb_var_screeninfo *var, int kspc,
+int fb_get_cmap(struct fb_cmap *cmap, int kspc,
     	    	int (*getcolreg)(u_int, u_int *, u_int *, u_int *, u_int *,
-				 struct fb_info *), struct fb_info *info)
+				 struct fb_info *),
+		struct fb_info *info)
 {
     int i, start;
     u16 *red, *green, *blue, *transp;
@@ -181,10 +178,6 @@
     for (i = 0; i < cmap->len; i++) {
 	if (getcolreg(start++, &hred, &hgreen, &hblue, &htransp, info))
 	    return 0;
-	hred = CNVT_FROMHW(hred, var->red.length);
-	hgreen = CNVT_FROMHW(hgreen, var->green.length);
-	hblue = CNVT_FROMHW(hblue, var->blue.length);
-	htransp = CNVT_FROMHW(htransp, var->transp.length);
 	if (kspc) {
 	    *red = hred;
 	    *green = hgreen;
@@ -212,9 +205,10 @@
      *  Set the colormap for a screen
      */
 
-int fb_set_cmap(struct fb_cmap *cmap, struct fb_var_screeninfo *var, int kspc,
+int fb_set_cmap(struct fb_cmap *cmap, int kspc,
     	    	int (*setcolreg)(u_int, u_int, u_int, u_int, u_int,
-				 struct fb_info *), struct fb_info *info)
+				 struct fb_info *),
+		struct fb_info *info)
 {
     int i, start;
     u16 *red, *green, *blue, *transp;
@@ -243,10 +237,6 @@
 	    else
 		htransp = 0;
 	}
-	hred = CNVT_TOHW(hred, var->red.length);
-	hgreen = CNVT_TOHW(hgreen, var->green.length);
-	hblue = CNVT_TOHW(hblue, var->blue.length);
-	htransp = CNVT_TOHW(htransp, var->transp.length);
 	red++;
 	green++;
 	blue++;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-afb.c m68k/drivers/video/fbcon-afb.c
--- jes-2.1.115/drivers/video/fbcon-afb.c	Sun Aug  9 21:48:30 1998
+++ m68k/drivers/video/fbcon-afb.c	Wed Jul 29 19:00:24 1998
@@ -174,22 +174,22 @@
     u_short i, j;
 
     if (sx == 0 && dx == 0 && width == p->next_line) {
-	src = p->screen_base+sy*p->fontheight*width;
-	dest = p->screen_base+dy*p->fontheight*width;
+	src = p->screen_base+sy*fontheight(p)*width;
+	dest = p->screen_base+dy*fontheight(p)*width;
 	i = p->var.bits_per_pixel;
 	do {
-	    mymemmove(dest, src, height*p->fontheight*width);
+	    mymemmove(dest, src, height*fontheight(p)*width);
 	    src += p->next_plane;
 	    dest += p->next_plane;
 	} while (--i);
     } else if (dy <= sy) {
-	src0 = p->screen_base+sy*p->fontheight*p->next_line+sx;
-	dest0 = p->screen_base+dy*p->fontheight*p->next_line+dx;
+	src0 = p->screen_base+sy*fontheight(p)*p->next_line+sx;
+	dest0 = p->screen_base+dy*fontheight(p)*p->next_line+dx;
 	i = p->var.bits_per_pixel;
 	do {
 	    src = src0;
 	    dest = dest0;
-	    j = height*p->fontheight;
+	    j = height*fontheight(p);
 	    do {
 	        mymemmove(dest, src, width);
 	        src += p->next_line;
@@ -199,13 +199,13 @@
 	    dest0 += p->next_plane;
 	} while (--i);
     } else {
-	src0 = p->screen_base+(sy+height)*p->fontheight*p->next_line+sx;
-	dest0 = p->screen_base+(dy+height)*p->fontheight*p->next_line+dx;
+	src0 = p->screen_base+(sy+height)*fontheight(p)*p->next_line+sx;
+	dest0 = p->screen_base+(dy+height)*fontheight(p)*p->next_line+dx;
 	i = p->var.bits_per_pixel;
 	do {
 	    src = src0;
 	    dest = dest0;
-	    j = height*p->fontheight;
+	    j = height*fontheight(p);
 	    do {
 	        src -= p->next_line;
 	        dest -= p->next_line;
@@ -224,13 +224,13 @@
     u_short i, j;
     int bg;
 
-    dest0 = p->screen_base+sy*p->fontheight*p->next_line+sx;
+    dest0 = p->screen_base+sy*fontheight(p)*p->next_line+sx;
 
     bg = attr_bgcol_ec(p,conp);
     i = p->var.bits_per_pixel;
     do {
 	dest = dest0;
-	j = height*p->fontheight;
+	j = height*fontheight(p);
 	do {
 	    if (bg & 1)
 	        mymemset(dest, width);
@@ -250,8 +250,8 @@
     u_short i, j;
     int fg, bg;
 
-    dest0 = p->screen_base+yy*p->fontheight*p->next_line+xx;
-    cdat0 = p->fontdata+(c&p->charmask)*p->fontheight;
+    dest0 = p->screen_base+yy*fontheight(p)*p->next_line+xx;
+    cdat0 = p->fontdata+(c&p->charmask)*fontheight(p);
     fg = attr_fgcol(p,c);
     bg = attr_bgcol(p,c);
 
@@ -264,7 +264,7 @@
 	    expand += 512;
 	if (fg & 1)
 	    expand += 256;
-	j = p->fontheight;
+	j = fontheight(p);
 	do {
 	    *dest = expand[*cdat++];
 	    dest += p->next_line;
@@ -289,7 +289,7 @@
     u16 c1, c2, c3, c4;
     int fg0, bg0, fg, bg;
 
-    dest0 = p->screen_base+yy*p->fontheight*p->next_line+xx;
+    dest0 = p->screen_base+yy*fontheight(p)*p->next_line+xx;
     fg0 = attr_fgcol(p,*s);
     bg0 = attr_bgcol(p,*s);
 
@@ -299,7 +299,7 @@
 	    dest1 = dest0++;
 	    xx++;
 
-	    cdat10 = p->fontdata+c1*p->fontheight;
+	    cdat10 = p->fontdata+c1*fontheight(p);
 	    fg = fg0;
 	    bg = bg0;
 
@@ -312,7 +312,7 @@
 		    expand += 512;
 		if (fg & 1)
 		    expand += 256;
-		j = p->fontheight;
+		j = fontheight(p);
 		do {
 		    *dest = expand[*cdat1++];
 		    dest += p->next_line;
@@ -328,10 +328,10 @@
 	    c4 = s[3] & p->charmask;
 
 	    dest1 = dest0;
-	    cdat10 = p->fontdata+c1*p->fontheight;
-	    cdat20 = p->fontdata+c2*p->fontheight;
-	    cdat30 = p->fontdata+c3*p->fontheight;
-	    cdat40 = p->fontdata+c4*p->fontheight;
+	    cdat10 = p->fontdata+c1*fontheight(p);
+	    cdat20 = p->fontdata+c2*fontheight(p);
+	    cdat30 = p->fontdata+c3*fontheight(p);
+	    cdat40 = p->fontdata+c4*fontheight(p);
 	    fg = fg0;
 	    bg = bg0;
 
@@ -347,7 +347,7 @@
 		    expand += 512;
 		if (fg & 1)
 		    expand += 256;
-		j = p->fontheight;
+		j = fontheight(p);
 	        do {
 #if defined(__BIG_ENDIAN)
 		    *(u32 *)dest = expand[*cdat1++]<<24 |
@@ -381,7 +381,7 @@
     u_short i, j;
     int mask;
 
-    dest0 = p->screen_base+yy*p->fontheight*p->next_line+xx;
+    dest0 = p->screen_base+yy*fontheight(p)*p->next_line+xx;
     mask = p->fgcol ^ p->bgcol;
 
     /*
@@ -394,7 +394,7 @@
     do {
 	if (mask & 1) {
 	    dest = dest0;
-	    j = p->fontheight;
+	    j = fontheight(p);
 	    do {
 	        *dest = ~*dest;
 		dest += p->next_line;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-afb.h m68k/drivers/video/fbcon-afb.h
--- jes-2.1.115/drivers/video/fbcon-afb.h	Sun Aug  9 21:48:30 1998
+++ m68k/drivers/video/fbcon-afb.h	Mon Aug  3 19:48:14 1998
@@ -2,6 +2,8 @@
      *  Amiga bitplanes (afb)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_AFB) || defined(CONFIG_FBCON_AFB_MODULE)
 #define FBCON_HAS_AFB
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-cfb16.c m68k/drivers/video/fbcon-cfb16.c
--- jes-2.1.115/drivers/video/fbcon-cfb16.c	Sun Aug  9 21:48:30 1998
+++ m68k/drivers/video/fbcon-cfb16.c	Wed Jul 29 19:00:24 1998
@@ -44,28 +44,28 @@
 void fbcon_cfb16_bmove(struct display *p, int sy, int sx, int dy, int dx,
 		       int height, int width)
 {
-    int bytes = p->next_line, linesize = bytes * p->fontheight, rows;
+    int bytes = p->next_line, linesize = bytes * fontheight(p), rows;
     u8 *src, *dst;
 
-    if (sx == 0 && dx == 0 && width * p->fontwidth * 2 == bytes) {
+    if (sx == 0 && dx == 0 && width * fontwidth(p) * 2 == bytes) {
 	mymemmove(p->screen_base + dy * linesize,
 		  p->screen_base + sy * linesize,
 		  height * linesize);
 	return;
     }
-    if (p->fontwidthlog) {
-	sx <<= p->fontwidthlog+1;
-	dx <<= p->fontwidthlog+1;
-	width <<= p->fontwidthlog+1;
+    if (fontwidthlog(p)) {
+	sx <<= fontwidthlog(p)+1;
+	dx <<= fontwidthlog(p)+1;
+	width <<= fontwidthlog(p)+1;
     } else {
-	sx *= p->fontwidth*2;
-	dx *= p->fontwidth*2;
-	width *= p->fontwidth*2;
+	sx *= fontwidth(p)*2;
+	dx *= fontwidth(p)*2;
+	width *= fontwidth(p)*2;
     }
     if (dy < sy || (dy == sy && dx < sx)) {
 	src = p->screen_base + sy * linesize + sx;
 	dst = p->screen_base + dy * linesize + dx;
-	for (rows = height * p->fontheight; rows--;) {
+	for (rows = height * fontheight(p); rows--;) {
 	    mymemmove(dst, src, width);
 	    src += bytes;
 	    dst += bytes;
@@ -73,7 +73,7 @@
     } else {
 	src = p->screen_base + (sy+height) * linesize + sx - bytes;
 	dst = p->screen_base + (dy+height) * linesize + dx - bytes;
-	for (rows = height * p->fontheight; rows--;) {
+	for (rows = height * fontheight(p); rows--;) {
 	    mymemmove(dst, src, width);
 	    src -= bytes;
 	    dst -= bytes;
@@ -85,15 +85,15 @@
 		       int height, int width)
 {
     u8 *dest0, *dest;
-    int bytes = p->next_line, lines = height * p->fontheight, rows, i;
+    int bytes = p->next_line, lines = height * fontheight(p), rows, i;
     u32 bgx;
 
-    dest = p->screen_base + sy * p->fontheight * bytes + sx * p->fontwidth * 2;
+    dest = p->screen_base + sy * fontheight(p) * bytes + sx * fontwidth(p) * 2;
 
     bgx = fbcon_cfb16_cmap[attr_bgcol_ec(p, conp)];
     bgx |= (bgx << 16);
 
-    width *= p->fontwidth/4;
+    width *= fontwidth(p)/4;
     if (sx == 0 && width * 8 == bytes)
 	for (i = 0; i < lines * width; i++) {
 	    ((u32 *)dest)[0] = bgx;
@@ -120,7 +120,7 @@
     int bytes = p->next_line, rows;
     u32 eorx, fgx, bgx;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 2;
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 2;
 
     fgx = fbcon_cfb16_cmap[attr_fgcol(p, c)];
     bgx = fbcon_cfb16_cmap[attr_bgcol(p, c)];
@@ -128,30 +128,24 @@
     bgx |= (bgx << 16);
     eorx = fgx ^ bgx;
 
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-    switch (p->fontwidth) {
+    switch (fontwidth(p)) {
     case 4:
     case 8:
-#endif
-	cdat = p->fontdata + (c & p->charmask) * p->fontheight;
-	for (rows = p->fontheight; rows--; dest += bytes) {
+	cdat = p->fontdata + (c & p->charmask) * fontheight(p);
+	for (rows = fontheight(p); rows--; dest += bytes) {
 	    bits = *cdat++;
 	    ((u32 *)dest)[0] = (tab_cfb16[bits >> 6] & eorx) ^ bgx;
 	    ((u32 *)dest)[1] = (tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-	    if (p->fontwidth == 8)
-#endif
-	    {
+	    if (fontwidth(p) == 8) {
 		((u32 *)dest)[2] = (tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx;
 		((u32 *)dest)[3] = (tab_cfb16[bits & 3] & eorx) ^ bgx;
 	    }
 	}
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
 	break;
     case 12:
     case 16:
-	cdat = p->fontdata + ((c & p->charmask) * p->fontheight << 1);
-	for (rows = p->fontheight; rows--; dest += bytes) {
+	cdat = p->fontdata + ((c & p->charmask) * fontheight(p) << 1);
+	for (rows = fontheight(p); rows--; dest += bytes) {
 	    bits = *cdat++;
 	    ((u32 *)dest)[0] = (tab_cfb16[bits >> 6] & eorx) ^ bgx;
 	    ((u32 *)dest)[1] = (tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx;
@@ -160,14 +154,13 @@
 	    bits = *cdat++;
 	    ((u32 *)dest)[4] = (tab_cfb16[bits >> 6] & eorx) ^ bgx;
 	    ((u32 *)dest)[5] = (tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx;
-	    if (p->fontwidth == 16) {
+	    if (fontwidth(p) == 16) {
 		((u32 *)dest)[6] = (tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx;
 		((u32 *)dest)[7] = (tab_cfb16[bits & 3] & eorx) ^ bgx;
 	    }
 	}
 	break;
     }
-#endif
 }
 
 void fbcon_cfb16_putcs(struct vc_data *conp, struct display *p,
@@ -178,44 +171,37 @@
     int rows, bytes = p->next_line;
     u32 eorx, fgx, bgx;
 
-    dest0 = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 2;
+    dest0 = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 2;
     fgx = fbcon_cfb16_cmap[attr_fgcol(p, *s)];
     bgx = fbcon_cfb16_cmap[attr_bgcol(p, *s)];
     fgx |= (fgx << 16);
     bgx |= (bgx << 16);
     eorx = fgx ^ bgx;
 
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-    switch (p->fontwidth) {
+    switch (fontwidth(p)) {
     case 4:
     case 8:
-#endif
 	while (count--) {
 	    c = *s++ & p->charmask;
-	    cdat = p->fontdata + c * p->fontheight;
-	    for (rows = p->fontheight, dest = dest0; rows--; dest += bytes) {
+	    cdat = p->fontdata + c * fontheight(p);
+	    for (rows = fontheight(p), dest = dest0; rows--; dest += bytes) {
 		u8 bits = *cdat++;
 		((u32 *)dest)[0] = (tab_cfb16[bits >> 6] & eorx) ^ bgx;
 		((u32 *)dest)[1] = (tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-		if (p->fontwidth == 8)
-#endif
-		{
-		
+		if (fontwidth(p) == 8) {
 		    ((u32 *)dest)[2] = (tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx;
 		    ((u32 *)dest)[3] = (tab_cfb16[bits & 3] & eorx) ^ bgx;
 		}
 	    }
-	    dest0 += p->fontwidth*2;;
+	    dest0 += fontwidth(p)*2;;
 	}
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
 	break;
     case 12:
     case 16:
 	while (count--) {
 	    c = *s++ & p->charmask;
-	    cdat = p->fontdata + (c * p->fontheight << 1);
-	    for (rows = p->fontheight, dest = dest0; rows--; dest += bytes) {
+	    cdat = p->fontdata + (c * fontheight(p) << 1);
+	    for (rows = fontheight(p), dest = dest0; rows--; dest += bytes) {
 		u8 bits = *cdat++;
 		((u32 *)dest)[0] = (tab_cfb16[bits >> 6] & eorx) ^ bgx;
 		((u32 *)dest)[1] = (tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx;
@@ -224,16 +210,15 @@
 		bits = *cdat++;
 		((u32 *)dest)[4] = (tab_cfb16[bits >> 6] & eorx) ^ bgx;
 		((u32 *)dest)[5] = (tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx;
-		if (p->fontwidth == 16) {
+		if (fontwidth(p) == 16) {
 		    ((u32 *)dest)[6] = (tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx;
 		    ((u32 *)dest)[7] = (tab_cfb16[bits & 3] & eorx) ^ bgx;
 		}
 	    }
-	    dest0 += p->fontwidth*2;
+	    dest0 += fontwidth(p)*2;
 	}
 	break;
     }
-#endif
 }
 
 void fbcon_cfb16_revc(struct display *p, int xx, int yy)
@@ -241,13 +226,9 @@
     u8 *dest;
     int bytes = p->next_line, rows;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth*2;
-    for (rows = p->fontheight; rows--; dest += bytes) {
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-	((u32 *)dest)[2] ^= 0xffffffff; ((u32 *)dest)[3] ^= 0xffffffff;
-	((u32 *)dest)[0] ^= 0xffffffff; ((u32 *)dest)[1] ^= 0xffffffff;
-#else
-	switch (p->fontwidth) {
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p)*2;
+    for (rows = fontheight(p); rows--; dest += bytes) {
+	switch (fontwidth(p)) {
 	case 16:
 	    ((u32 *)dest)[6] ^= 0xffffffff; ((u32 *)dest)[7] ^= 0xffffffff;
 	    /* FALL THROUGH */
@@ -260,7 +241,6 @@
 	case 4:
 	    ((u32 *)dest)[0] ^= 0xffffffff; ((u32 *)dest)[1] ^= 0xffffffff;
 	}
-#endif
     }
 }
 
@@ -272,9 +252,9 @@
     u32 bgx;
     int i, j;
 
-    unsigned int right_start = conp->vc_cols*p->fontwidth;
+    unsigned int right_start = conp->vc_cols*fontwidth(p);
     unsigned int right_width = p->var.xres_virtual-right_start;
-    unsigned int bottom_start = conp->vc_rows*p->fontheight;
+    unsigned int bottom_start = conp->vc_rows*fontheight(p);
     unsigned int bottom_width = p->var.yres_virtual-bottom_start;
 
     bgx = fbcon_cfb16_cmap[attr_bgcol_ec(p, conp)];
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-cfb2.c m68k/drivers/video/fbcon-cfb2.c
--- jes-2.1.115/drivers/video/fbcon-cfb2.c	Sun Aug  9 21:48:30 1998
+++ m68k/drivers/video/fbcon-cfb2.c	Wed Jul 29 19:00:24 1998
@@ -57,7 +57,7 @@
 void fbcon_cfb2_bmove(struct display *p, int sy, int sx, int dy, int dx,
 		      int height, int width)
 {
-	int bytes = p->next_line, linesize = bytes * p->fontheight, rows;
+	int bytes = p->next_line, linesize = bytes * fontheight(p), rows;
 	u8 *src,*dst;
 
 	if (sx == 0 && dx == 0 && width * 2 == bytes) {
@@ -69,7 +69,7 @@
 		if (dy < sy || (dy == sy && dx < sx)) {
 			src = p->screen_base + sy * linesize + sx * 2;
 			dst = p->screen_base + dy * linesize + dx * 2;
-			for (rows = height * p->fontheight ; rows-- ;) {
+			for (rows = height * fontheight(p) ; rows-- ;) {
 				mymemmove(dst, src, width * 2);
 				src += bytes;
 				dst += bytes;
@@ -80,7 +80,7 @@
 				- bytes;
 			dst = p->screen_base + (dy+height) * linesize + dx * 2
 				- bytes;
-			for (rows = height * p->fontheight ; rows-- ;) {
+			for (rows = height * fontheight(p) ; rows-- ;) {
 				mymemmove(dst, src, width * 2);
 				src -= bytes;
 				dst -= bytes;
@@ -93,10 +93,10 @@
 		      int height, int width)
 {
 	u8 *dest0,*dest;
-	int bytes=p->next_line,lines=height * p->fontheight, rows, i;
+	int bytes=p->next_line,lines=height * fontheight(p), rows, i;
 	u32 bgx;
 
-	dest = p->screen_base + sy * p->fontheight * bytes + sx * 2;
+	dest = p->screen_base + sy * fontheight(p) * bytes + sx * 2;
 
 	bgx=attr_bgcol_ec(p,conp);
 	bgx |= (bgx << 2);	/* expand the colour to 16 bits */
@@ -128,8 +128,8 @@
 	int bytes=p->next_line,rows;
 	u32 eorx,fgx,bgx;
 
-	dest = p->screen_base + yy * p->fontheight * bytes + xx * 2;
-	cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+	dest = p->screen_base + yy * fontheight(p) * bytes + xx * 2;
+	cdat = p->fontdata + (c & p->charmask) * fontheight(p);
 
 	fgx=3;/*attr_fgcol(p,c);*/
 	bgx=attr_bgcol(p,c);
@@ -139,7 +139,7 @@
 	bgx |= (bgx << 4);
 	eorx = fgx ^ bgx;
 
-	for (rows = p->fontheight ; rows-- ; dest += bytes) {
+	for (rows = fontheight(p) ; rows-- ; dest += bytes) {
 		((u8 *)dest)[0]=
 			(nibbletab_cfb2[*cdat >> 4] & eorx) ^ bgx;
 		((u8 *)dest)[1]=
@@ -155,7 +155,7 @@
 	int rows,bytes=p->next_line;
 	u32 eorx, fgx, bgx;
 
-	dest0 = p->screen_base + yy * p->fontheight * bytes + xx * 2;
+	dest0 = p->screen_base + yy * fontheight(p) * bytes + xx * 2;
 	fgx=3/*attr_fgcol(p,*s)*/;
 	bgx=attr_bgcol(p,*s);
 	fgx |= (fgx << 2);
@@ -165,9 +165,9 @@
 	eorx = fgx ^ bgx;
 	while (count--) {
 		c = *s++ & p->charmask;
-		cdat = p->fontdata + c * p->fontheight;
+		cdat = p->fontdata + c * fontheight(p);
 
-		for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+		for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
 			((u8 *)dest)[0]=
 				(nibbletab_cfb2[*cdat >> 4] & eorx) ^ bgx;
 			((u8 *)dest)[1]=
@@ -182,8 +182,8 @@
 	u8 *dest;
 	int bytes=p->next_line, rows;
 
-	dest = p->screen_base + yy * p->fontheight * bytes + xx * 2;
-	for (rows = p->fontheight ; rows-- ; dest += bytes) {
+	dest = p->screen_base + yy * fontheight(p) * bytes + xx * 2;
+	for (rows = fontheight(p) ; rows-- ; dest += bytes) {
 		((u16 *)dest)[0] ^= 0xffff;
 	}
 }
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-cfb2.h m68k/drivers/video/fbcon-cfb2.h
--- jes-2.1.115/drivers/video/fbcon-cfb2.h	Sun Aug  9 21:48:30 1998
+++ m68k/drivers/video/fbcon-cfb2.h	Mon Aug  3 19:48:18 1998
@@ -2,6 +2,8 @@
      *  2 bpp packed pixel (cfb2)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_CFB2) || defined(CONFIG_FBCON_CFB2_MODULE)
 #define FBCON_HAS_CFB2
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-cfb24.c m68k/drivers/video/fbcon-cfb24.c
--- jes-2.1.115/drivers/video/fbcon-cfb24.c	Sun Aug  9 21:48:30 1998
+++ m68k/drivers/video/fbcon-cfb24.c	Wed Jul 29 19:00:24 1998
@@ -34,29 +34,29 @@
 void fbcon_cfb24_bmove(struct display *p, int sy, int sx, int dy, int dx,
 		       int height, int width)
 {
-    int bytes = p->next_line, linesize = bytes * p->fontheight, rows;
+    int bytes = p->next_line, linesize = bytes * fontheight(p), rows;
     u8 *src, *dst;
 
-    if (sx == 0 && dx == 0 && width * p->fontwidth * 3 == bytes) {
+    if (sx == 0 && dx == 0 && width * fontwidth(p) * 3 == bytes) {
 	mymemmove(p->screen_base + dy * linesize,
 		  p->screen_base + sy * linesize,
 		  height * linesize);
 	return;
     }
-    if (p->fontwidthlog) {
-	sx <<= p->fontwidthlog;
-	dx <<= p->fontwidthlog;
-	width <<= p->fontwidthlog;
+    if (fontwidthlog(p)) {
+	sx <<= fontwidthlog(p);
+	dx <<= fontwidthlog(p);
+	width <<= fontwidthlog(p);
     } else {
-	sx *= p->fontwidth;
-	dx *= p->fontwidth;
-	width *= p->fontwidth;
+	sx *= fontwidth(p);
+	dx *= fontwidth(p);
+	width *= fontwidth(p);
     }
     sx *= 3; dx *= 3; width *= 3;
     if (dy < sy || (dy == sy && dx < sx)) {
 	src = p->screen_base + sy * linesize + sx;
 	dst = p->screen_base + dy * linesize + dx;
-	for (rows = height * p->fontheight; rows--;) {
+	for (rows = height * fontheight(p); rows--;) {
 	    mymemmove(dst, src, width);
 	    src += bytes;
 	    dst += bytes;
@@ -64,7 +64,7 @@
     } else {
 	src = p->screen_base + (sy+height) * linesize + sx - bytes;
 	dst = p->screen_base + (dy+height) * linesize + dx - bytes;
-	for (rows = height * p->fontheight; rows--;) {
+	for (rows = height * fontheight(p); rows--;) {
 	    mymemmove(dst, src, width);
 	    src -= bytes;
 	    dst -= bytes;
@@ -91,14 +91,14 @@
 		       int height, int width)
 {
     u8 *dest0, *dest;
-    int bytes = p->next_line, lines = height * p->fontheight, rows, i;
+    int bytes = p->next_line, lines = height * fontheight(p), rows, i;
     u32 bgx;
 
-    dest = p->screen_base + sy * p->fontheight * bytes + sx * p->fontwidth * 3;
+    dest = p->screen_base + sy * fontheight(p) * bytes + sx * fontwidth(p) * 3;
 
     bgx = fbcon_cfb24_cmap[attr_bgcol_ec(p, conp)];
 
-    width *= p->fontwidth/4;
+    width *= fontwidth(p)/4;
     if (sx == 0 && width * 12 == bytes)
 	for (i = 0; i < lines * width; i++) {
 	    store4pixels(bgx, bgx, bgx, bgx, (u32 *)dest);
@@ -123,34 +123,31 @@
     int bytes = p->next_line, rows;
     u32 eorx, fgx, bgx, d1, d2, d3, d4;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 3;
-    if (p->fontwidth <= 8)
-	cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 3;
+    if (fontwidth(p) <= 8)
+	cdat = p->fontdata + (c & p->charmask) * fontheight(p);
     else
-	cdat = p->fontdata + ((c & p->charmask) * p->fontheight << 1);
+	cdat = p->fontdata + ((c & p->charmask) * fontheight(p) << 1);
 
     fgx = fbcon_cfb24_cmap[attr_fgcol(p, c)];
     bgx = fbcon_cfb24_cmap[attr_bgcol(p, c)];
     eorx = fgx ^ bgx;
 
-    for (rows = p->fontheight; rows--; dest += bytes) {
+    for (rows = fontheight(p); rows--; dest += bytes) {
 	bits = *cdat++;
 	d1 = (-(bits >> 7) & eorx) ^ bgx;
 	d2 = (-(bits >> 6 & 1) & eorx) ^ bgx;
 	d3 = (-(bits >> 5 & 1) & eorx) ^ bgx;
 	d4 = (-(bits >> 4 & 1) & eorx) ^ bgx;
 	store4pixels(d1, d2, d3, d4, (u32 *)dest);
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-	if (p->fontwidth < 8)
+	if (fontwidth(p) < 8)
 	    continue;
-#endif
 	d1 = (-(bits >> 3 & 1) & eorx) ^ bgx;
 	d2 = (-(bits >> 2 & 1) & eorx) ^ bgx;
 	d3 = (-(bits >> 1 & 1) & eorx) ^ bgx;
 	d4 = (-(bits & 1) & eorx) ^ bgx;
 	store4pixels(d1, d2, d3, d4, (u32 *)(dest+12));
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-	if (p->fontwidth < 12)
+	if (fontwidth(p) < 12)
 	    continue;
 	bits = *cdat++;
 	d1 = (-(bits >> 7) & eorx) ^ bgx;
@@ -158,14 +155,13 @@
 	d3 = (-(bits >> 5 & 1) & eorx) ^ bgx;
 	d4 = (-(bits >> 4 & 1) & eorx) ^ bgx;
 	store4pixels(d1, d2, d3, d4, (u32 *)(dest+24));
-	if (p->fontwidth < 16)
+	if (fontwidth(p) < 16)
 	    continue;
 	d1 = (-(bits >> 3 & 1) & eorx) ^ bgx;
 	d2 = (-(bits >> 2 & 1) & eorx) ^ bgx;
 	d3 = (-(bits >> 1 & 1) & eorx) ^ bgx;
 	d4 = (-(bits & 1) & eorx) ^ bgx;
 	store4pixels(d1, d2, d3, d4, (u32 *)(dest+32));
-#endif
     }
 }
 
@@ -177,39 +173,32 @@
     int rows, bytes = p->next_line;
     u32 eorx, fgx, bgx, d1, d2, d3, d4;
 
-    dest0 = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 3;
+    dest0 = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 3;
     fgx = fbcon_cfb24_cmap[attr_fgcol(p, *s)];
     bgx = fbcon_cfb24_cmap[attr_bgcol(p, *s)];
     eorx = fgx ^ bgx;
     while (count--) {
 	c = *s++ & p->charmask;
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-	cdat = p->fontdata + c * p->fontheight;
-#else
-	if (p->fontwidth <= 8)
-	    cdat = p->fontdata + c * p->fontheight;
+	if (fontwidth(p) <= 8)
+	    cdat = p->fontdata + c * fontheight(p);
 	  
 	else
-	    cdat = p->fontdata + (c * p->fontheight << 1);
-#endif
-	for (rows = p->fontheight, dest = dest0; rows--; dest += bytes) {
+	    cdat = p->fontdata + (c * fontheight(p) << 1);
+	for (rows = fontheight(p), dest = dest0; rows--; dest += bytes) {
 	    bits = *cdat++;
 	    d1 = (-(bits >> 7) & eorx) ^ bgx;
 	    d2 = (-(bits >> 6 & 1) & eorx) ^ bgx;
 	    d3 = (-(bits >> 5 & 1) & eorx) ^ bgx;
 	    d4 = (-(bits >> 4 & 1) & eorx) ^ bgx;
 	    store4pixels(d1, d2, d3, d4, (u32 *)dest);
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-	    if (p->fontwidth < 8)
+	    if (fontwidth(p) < 8)
 		continue;
-#endif
 	    d1 = (-(bits >> 3 & 1) & eorx) ^ bgx;
 	    d2 = (-(bits >> 2 & 1) & eorx) ^ bgx;
 	    d3 = (-(bits >> 1 & 1) & eorx) ^ bgx;
 	    d4 = (-(bits & 1) & eorx) ^ bgx;
 	    store4pixels(d1, d2, d3, d4, (u32 *)(dest+12));
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-	    if (p->fontwidth < 12)
+	    if (fontwidth(p) < 12)
 		continue;
 	    bits = *cdat++;
 	    d1 = (-(bits >> 7) & eorx) ^ bgx;
@@ -217,16 +206,15 @@
 	    d3 = (-(bits >> 5 & 1) & eorx) ^ bgx;
 	    d4 = (-(bits >> 4 & 1) & eorx) ^ bgx;
 	    store4pixels(d1, d2, d3, d4, (u32 *)(dest+24));
-	    if (p->fontwidth < 16)
+	    if (fontwidth(p) < 16)
 		continue;
 	    d1 = (-(bits >> 3 & 1) & eorx) ^ bgx;
 	    d2 = (-(bits >> 2 & 1) & eorx) ^ bgx;
 	    d3 = (-(bits >> 1 & 1) & eorx) ^ bgx;
 	    d4 = (-(bits & 1) & eorx) ^ bgx;
 	    store4pixels(d1, d2, d3, d4, (u32 *)(dest+32));
-#endif
 	}
-	dest0 += p->fontwidth*3;
+	dest0 += fontwidth(p)*3;
     }
 }
 
@@ -235,15 +223,9 @@
     u8 *dest;
     int bytes = p->next_line, rows;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 3;
-    for (rows = p->fontheight; rows--; dest += bytes) {
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-	((u32 *)dest)[3] ^= 0xffffffff; ((u32 *)dest)[4] ^= 0xffffffff;
-	((u32 *)dest)[5] ^= 0xffffffff;
-	((u32 *)dest)[0] ^= 0xffffffff; ((u32 *)dest)[1] ^= 0xffffffff;
-	((u32 *)dest)[2] ^= 0xffffffff;
-#else
-	switch (p->fontwidth) {
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 3;
+    for (rows = fontheight(p); rows--; dest += bytes) {
+	switch (fontwidth(p)) {
 	case 16:
 	    ((u32 *)dest)[9] ^= 0xffffffff; ((u32 *)dest)[10] ^= 0xffffffff;
 	    ((u32 *)dest)[11] ^= 0xffffffff;	/* FALL THROUGH */
@@ -257,7 +239,6 @@
 	    ((u32 *)dest)[0] ^= 0xffffffff; ((u32 *)dest)[1] ^= 0xffffffff;
 	    ((u32 *)dest)[2] ^= 0xffffffff;
 	}
-#endif
     }
 }
 
@@ -268,9 +249,9 @@
     u32 bgx;
     int i, j;
 
-    unsigned int right_start = conp->vc_cols*p->fontwidth;
+    unsigned int right_start = conp->vc_cols*fontwidth(p);
     unsigned int right_width = p->var.xres_virtual-right_start;
-    unsigned int bottom_start = conp->vc_rows*p->fontheight;
+    unsigned int bottom_start = conp->vc_rows*fontheight(p);
     unsigned int bottom_width = p->var.yres_virtual-bottom_start;
 
     bgx = fbcon_cfb24_cmap[attr_bgcol_ec(p, conp)];
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-cfb24.h m68k/drivers/video/fbcon-cfb24.h
--- jes-2.1.115/drivers/video/fbcon-cfb24.h	Sun Aug  9 21:48:30 1998
+++ m68k/drivers/video/fbcon-cfb24.h	Mon Aug  3 19:48:22 1998
@@ -2,6 +2,8 @@
      *  24 bpp packed pixel (cfb24)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_CFB24) || defined(CONFIG_FBCON_CFB24_MODULE)
 #define FBCON_HAS_CFB24
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-cfb32.c m68k/drivers/video/fbcon-cfb32.c
--- jes-2.1.115/drivers/video/fbcon-cfb32.c	Sun Aug  9 21:48:30 1998
+++ m68k/drivers/video/fbcon-cfb32.c	Wed Jul 29 19:00:38 1998
@@ -34,28 +34,28 @@
 void fbcon_cfb32_bmove(struct display *p, int sy, int sx, int dy, int dx,
 		       int height, int width)
 {
-    int bytes = p->next_line, linesize = bytes * p->fontheight, rows;
+    int bytes = p->next_line, linesize = bytes * fontheight(p), rows;
     u8 *src, *dst;
 
-    if (sx == 0 && dx == 0 && width * p->fontwidth * 4 == bytes) {
+    if (sx == 0 && dx == 0 && width * fontwidth(p) * 4 == bytes) {
 	mymemmove(p->screen_base + dy * linesize,
 		  p->screen_base + sy * linesize,
 		  height * linesize);
 	return;
     }
-    if (p->fontwidthlog) {
-	sx <<= p->fontwidthlog+2;
-	dx <<= p->fontwidthlog+2;
-	width <<= p->fontwidthlog+2;
+    if (fontwidthlog(p)) {
+	sx <<= fontwidthlog(p)+2;
+	dx <<= fontwidthlog(p)+2;
+	width <<= fontwidthlog(p)+2;
     } else {
-	sx *= p->fontwidth*4;
-	dx *= p->fontwidth*4;
-	width *= p->fontwidth*4;
+	sx *= fontwidth(p)*4;
+	dx *= fontwidth(p)*4;
+	width *= fontwidth(p)*4;
     }
     if (dy < sy || (dy == sy && dx < sx)) {
 	src = p->screen_base + sy * linesize + sx;
 	dst = p->screen_base + dy * linesize + dx;
-	for (rows = height * p->fontheight; rows--;) {
+	for (rows = height * fontheight(p); rows--;) {
 	    mymemmove(dst, src, width);
 	    src += bytes;
 	    dst += bytes;
@@ -63,7 +63,7 @@
     } else {
 	src = p->screen_base + (sy+height) * linesize + sx - bytes;
 	dst = p->screen_base + (dy+height) * linesize + dx - bytes;
-	for (rows = height * p->fontheight; rows--;) {
+	for (rows = height * fontheight(p); rows--;) {
 	    mymemmove(dst, src, width);
 	    src -= bytes;
 	    dst -= bytes;
@@ -75,14 +75,14 @@
 		       int height, int width)
 {
     u8 *dest0, *dest;
-    int bytes = p->next_line, lines = height * p->fontheight, rows, i;
+    int bytes = p->next_line, lines = height * fontheight(p), rows, i;
     u32 bgx;
 
-    dest = p->screen_base + sy * p->fontheight * bytes + sx * p->fontwidth * 4;
+    dest = p->screen_base + sy * fontheight(p) * bytes + sx * fontwidth(p) * 4;
 
     bgx = fbcon_cfb32_cmap[attr_bgcol_ec(p, conp)];
 
-    width *= p->fontwidth/4;
+    width *= fontwidth(p)/4;
     if (sx == 0 && width * 16 == bytes)
 	for (i = 0; i < lines * width; i++) {
 	    ((u32 *)dest)[0] = bgx;
@@ -113,48 +113,40 @@
     int bytes = p->next_line, rows;
     u32 eorx, fgx, bgx;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 4;
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-    cdat = p->fontdata + (c & p->charmask) * p->fontheight;
-#else
-    if (p->fontwidth <= 8)
-	cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 4;
+    if (fontwidth(p) <= 8)
+	cdat = p->fontdata + (c & p->charmask) * fontheight(p);
     else
-	cdat = p->fontdata + ((c & p->charmask) * p->fontheight << 1);
-#endif
+	cdat = p->fontdata + ((c & p->charmask) * fontheight(p) << 1);
     fgx = fbcon_cfb32_cmap[attr_fgcol(p, c)];
     bgx = fbcon_cfb32_cmap[attr_bgcol(p, c)];
     eorx = fgx ^ bgx;
 
-    for (rows = p->fontheight; rows--; dest += bytes) {
+    for (rows = fontheight(p); rows--; dest += bytes) {
 	bits = *cdat++;
 	((u32 *)dest)[0] = (-(bits >> 7) & eorx) ^ bgx;
 	((u32 *)dest)[1] = (-(bits >> 6 & 1) & eorx) ^ bgx;
 	((u32 *)dest)[2] = (-(bits >> 5 & 1) & eorx) ^ bgx;
 	((u32 *)dest)[3] = (-(bits >> 4 & 1) & eorx) ^ bgx;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-	if (p->fontwidth < 8)
+	if (fontwidth(p) < 8)
 	    continue;
-#endif
 	((u32 *)dest)[4] = (-(bits >> 3 & 1) & eorx) ^ bgx;
 	((u32 *)dest)[5] = (-(bits >> 2 & 1) & eorx) ^ bgx;
 	((u32 *)dest)[6] = (-(bits >> 1 & 1) & eorx) ^ bgx;
 	((u32 *)dest)[7] = (-(bits & 1) & eorx) ^ bgx;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-	if (p->fontwidth < 12)
+	if (fontwidth(p) < 12)
 	    continue;
 	bits = *cdat++;
 	((u32 *)dest)[8] = (-(bits >> 7) & eorx) ^ bgx;
 	((u32 *)dest)[9] = (-(bits >> 6 & 1) & eorx) ^ bgx;
 	((u32 *)dest)[10] = (-(bits >> 5 & 1) & eorx) ^ bgx;
 	((u32 *)dest)[11] = (-(bits >> 4 & 1) & eorx) ^ bgx;
-	if (p->fontwidth < 16)
+	if (fontwidth(p) < 16)
 	    continue;
 	((u32 *)dest)[12] = (-(bits >> 3 & 1) & eorx) ^ bgx;
 	((u32 *)dest)[13] = (-(bits >> 2 & 1) & eorx) ^ bgx;
 	((u32 *)dest)[14] = (-(bits >> 1 & 1) & eorx) ^ bgx;
 	((u32 *)dest)[15] = (-(bits & 1) & eorx) ^ bgx;
-#endif
     }
 }
 
@@ -166,51 +158,43 @@
     int rows, bytes = p->next_line;
     u32 eorx, fgx, bgx;
 
-    dest0 = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 4;
+    dest0 = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 4;
     fgx = fbcon_cfb32_cmap[attr_fgcol(p, *s)];
     bgx = fbcon_cfb32_cmap[attr_bgcol(p, *s)];
     eorx = fgx ^ bgx;
     while (count--) {
 	c = *s++ & p->charmask;
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-	cdat = p->fontdata + c * p->fontheight;
-#else
-	if (p->fontwidth <= 8)
-	    cdat = p->fontdata + c * p->fontheight;
+	if (fontwidth(p) <= 8)
+	    cdat = p->fontdata + c * fontheight(p);
 	else
-	    cdat = p->fontdata + (c * p->fontheight << 1);
-#endif
-	for (rows = p->fontheight, dest = dest0; rows--; dest += bytes) {
+	    cdat = p->fontdata + (c * fontheight(p) << 1);
+	for (rows = fontheight(p), dest = dest0; rows--; dest += bytes) {
 	    bits = *cdat++;
 	    ((u32 *)dest)[0] = (-(bits >> 7) & eorx) ^ bgx;
 	    ((u32 *)dest)[1] = (-(bits >> 6 & 1) & eorx) ^ bgx;
 	    ((u32 *)dest)[2] = (-(bits >> 5 & 1) & eorx) ^ bgx;
 	    ((u32 *)dest)[3] = (-(bits >> 4 & 1) & eorx) ^ bgx;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-	    if (p->fontwidth < 8)
+	    if (fontwidth(p) < 8)
 		continue;
-#endif
 	    ((u32 *)dest)[4] = (-(bits >> 3 & 1) & eorx) ^ bgx;
 	    ((u32 *)dest)[5] = (-(bits >> 2 & 1) & eorx) ^ bgx;
 	    ((u32 *)dest)[6] = (-(bits >> 1 & 1) & eorx) ^ bgx;
 	    ((u32 *)dest)[7] = (-(bits & 1) & eorx) ^ bgx;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-	    if (p->fontwidth < 12)
+	    if (fontwidth(p) < 12)
 		continue;
 	    bits = *cdat++;
 	    ((u32 *)dest)[8] = (-(bits >> 7) & eorx) ^ bgx;
 	    ((u32 *)dest)[9] = (-(bits >> 6 & 1) & eorx) ^ bgx;
 	    ((u32 *)dest)[10] = (-(bits >> 5 & 1) & eorx) ^ bgx;
 	    ((u32 *)dest)[11] = (-(bits >> 4 & 1) & eorx) ^ bgx;
-	    if (p->fontwidth < 16)
+	    if (fontwidth(p) < 16)
 		continue;
 	    ((u32 *)dest)[12] = (-(bits >> 3 & 1) & eorx) ^ bgx;
 	    ((u32 *)dest)[13] = (-(bits >> 2 & 1) & eorx) ^ bgx;
 	    ((u32 *)dest)[14] = (-(bits >> 1 & 1) & eorx) ^ bgx;
 	    ((u32 *)dest)[15] = (-(bits & 1) & eorx) ^ bgx;
-#endif
 	}
-	dest0 += p->fontwidth*4;
+	dest0 += fontwidth(p)*4;
     }
 }
 
@@ -219,15 +203,9 @@
     u8 *dest;
     int bytes = p->next_line, rows;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth * 4;
-    for (rows = p->fontheight; rows--; dest += bytes) {
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-	((u32 *)dest)[4] ^= 0xffffffff; ((u32 *)dest)[5] ^= 0xffffffff;
-	((u32 *)dest)[6] ^= 0xffffffff; ((u32 *)dest)[7] ^= 0xffffffff;
-	((u32 *)dest)[0] ^= 0xffffffff; ((u32 *)dest)[1] ^= 0xffffffff;
-	((u32 *)dest)[2] ^= 0xffffffff; ((u32 *)dest)[3] ^= 0xffffffff;
-#else
-	switch (p->fontwidth) {
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 4;
+    for (rows = fontheight(p); rows--; dest += bytes) {
+	switch (fontwidth(p)) {
 	case 16:
 	    ((u32 *)dest)[12] ^= 0xffffffff; ((u32 *)dest)[13] ^= 0xffffffff;
 	    ((u32 *)dest)[14] ^= 0xffffffff; ((u32 *)dest)[15] ^= 0xffffffff;
@@ -245,7 +223,6 @@
 	    ((u32 *)dest)[2] ^= 0xffffffff; ((u32 *)dest)[3] ^= 0xffffffff;
 	    /* FALL THROUGH */
 	}
-#endif
     }
 }
 
@@ -257,9 +234,9 @@
     u32 bgx;
     int i, j;
 
-    unsigned int right_start = conp->vc_cols*p->fontwidth;
+    unsigned int right_start = conp->vc_cols*fontwidth(p);
     unsigned int right_width = p->var.xres_virtual-right_start;
-    unsigned int bottom_start = conp->vc_rows*p->fontheight;
+    unsigned int bottom_start = conp->vc_rows*fontheight(p);
     unsigned int bottom_width = p->var.yres_virtual-bottom_start;
 
     bgx = fbcon_cfb32_cmap[attr_bgcol_ec(p, conp)];
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-cfb32.h m68k/drivers/video/fbcon-cfb32.h
--- jes-2.1.115/drivers/video/fbcon-cfb32.h	Sun Aug  9 21:48:30 1998
+++ m68k/drivers/video/fbcon-cfb32.h	Mon Aug  3 19:48:25 1998
@@ -2,6 +2,8 @@
      *  32 bpp packed pixel (cfb32)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_CFB32) || defined(CONFIG_FBCON_CFB32_MODULE)
 #define FBCON_HAS_CFB32
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-cfb4.c m68k/drivers/video/fbcon-cfb4.c
--- jes-2.1.115/drivers/video/fbcon-cfb4.c	Sun Aug  9 21:48:30 1998
+++ m68k/drivers/video/fbcon-cfb4.c	Wed Jul 29 19:00:39 1998
@@ -57,7 +57,7 @@
 void fbcon_cfb4_bmove(struct display *p, int sy, int sx, int dy, int dx,
 		      int height, int width)
 {
-	int bytes = p->next_line, linesize = bytes * p->fontheight, rows;
+	int bytes = p->next_line, linesize = bytes * fontheight(p), rows;
 	u8 *src,*dst;
 
 	if (sx == 0 && dx == 0 && width * 4 == bytes) {
@@ -69,7 +69,7 @@
 		if (dy < sy || (dy == sy && dx < sx)) {
 			src = p->screen_base + sy * linesize + sx * 4;
 			dst = p->screen_base + dy * linesize + dx * 4;
-			for (rows = height * p->fontheight ; rows-- ;) {
+			for (rows = height * fontheight(p) ; rows-- ;) {
 				mymemmove(dst, src, width * 4);
 				src += bytes;
 				dst += bytes;
@@ -80,7 +80,7 @@
 				- bytes;
 			dst = p->screen_base + (dy+height) * linesize + dx * 4
 				- bytes;
-			for (rows = height * p->fontheight ; rows-- ;) {
+			for (rows = height * fontheight(p) ; rows-- ;) {
 				mymemmove(dst, src, width * 4);
 				src -= bytes;
 				dst -= bytes;
@@ -93,12 +93,12 @@
 		      int height, int width)
 {
 	u8 *dest0,*dest;
-	int bytes=p->next_line,lines=height * p->fontheight, rows, i;
+	int bytes=p->next_line,lines=height * fontheight(p), rows, i;
 	u32 bgx;
 
 /*	if(p->screen_base!=0xFDD00020)
 		mac_boom(1);*/
-	dest = p->screen_base + sy * p->fontheight * bytes + sx * 4;
+	dest = p->screen_base + sy * fontheight(p) * bytes + sx * 4;
 
 	bgx=attr_bgcol_ec(p,conp);
 	bgx |= (bgx << 4);	/* expand the colour to 32bits */
@@ -130,8 +130,8 @@
 	int bytes=p->next_line,rows;
 	u32 eorx,fgx,bgx;
 
-	dest = p->screen_base + yy * p->fontheight * bytes + xx * 4;
-	cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+	dest = p->screen_base + yy * fontheight(p) * bytes + xx * 4;
+	cdat = p->fontdata + (c & p->charmask) * fontheight(p);
 
 	fgx=15;/*attr_fgcol(p,c);*/
 	bgx=attr_bgcol(p,c);
@@ -141,7 +141,7 @@
 	bgx |= (bgx << 8);
 	eorx = fgx ^ bgx;
 
-	for (rows = p->fontheight ; rows-- ; dest += bytes) {
+	for (rows = fontheight(p) ; rows-- ; dest += bytes) {
 		((u16 *)dest)[0]=
 			(nibbletab_cfb4[*cdat >> 4] & eorx) ^ bgx;
 		((u16 *)dest)[1]=
@@ -157,7 +157,7 @@
 	int rows,bytes=p->next_line;
 	u32 eorx, fgx, bgx;
 
-	dest0 = p->screen_base + yy * p->fontheight * bytes + xx * 4;
+	dest0 = p->screen_base + yy * fontheight(p) * bytes + xx * 4;
 	fgx=15/*attr_fgcol(p,*s)*/;
 	bgx=attr_bgcol(p,*s);
 	fgx |= (fgx << 4);
@@ -169,9 +169,9 @@
 	eorx = fgx ^ bgx;
 	while (count--) {
 		c = *s++ & p->charmask;
-		cdat = p->fontdata + c * p->fontheight;
+		cdat = p->fontdata + c * fontheight(p);
 
-		for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+		for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
 			((u16 *)dest)[0]=
 			(nibbletab_cfb4[*cdat >> 4] & eorx) ^ bgx;
 			((u16 *)dest)[1]=
@@ -186,8 +186,8 @@
 	u8 *dest;
 	int bytes=p->next_line, rows;
 
-	dest = p->screen_base + yy * p->fontheight * bytes + xx * 4;
-	for (rows = p->fontheight ; rows-- ; dest += bytes) {
+	dest = p->screen_base + yy * fontheight(p) * bytes + xx * 4;
+	for (rows = fontheight(p) ; rows-- ; dest += bytes) {
 		((u32 *)dest)[0] ^= 0x0f0f0f0f;
 	}
 }
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-cfb4.h m68k/drivers/video/fbcon-cfb4.h
--- jes-2.1.115/drivers/video/fbcon-cfb4.h	Sun Aug  9 21:48:30 1998
+++ m68k/drivers/video/fbcon-cfb4.h	Mon Aug  3 19:48:28 1998
@@ -2,6 +2,8 @@
      *  4 bpp packed pixel (cfb4)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_CFB4) || defined(CONFIG_FBCON_CFB4_MODULE)
 #define FBCON_HAS_CFB4
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-cfb8.c m68k/drivers/video/fbcon-cfb8.c
--- jes-2.1.115/drivers/video/fbcon-cfb8.c	Sun Aug  9 21:48:30 1998
+++ m68k/drivers/video/fbcon-cfb8.c	Wed Jul 29 19:00:39 1998
@@ -48,24 +48,24 @@
 void fbcon_cfb8_bmove(struct display *p, int sy, int sx, int dy, int dx,
 		      int height, int width)
 {
-    int bytes = p->next_line, linesize = bytes * p->fontheight, rows;
+    int bytes = p->next_line, linesize = bytes * fontheight(p), rows;
     u8 *src,*dst;
 
-    if (sx == 0 && dx == 0 && width * p->fontwidth == bytes) {
+    if (sx == 0 && dx == 0 && width * fontwidth(p) == bytes) {
 	mymemmove(p->screen_base + dy * linesize,
 		  p->screen_base + sy * linesize,
 		  height * linesize);
 	return;
     }
-    if (p->fontwidthlog) {
-    	sx <<= p->fontwidthlog; dx <<= p->fontwidthlog; width <<= p->fontwidthlog;
+    if (fontwidthlog(p)) {
+    	sx <<= fontwidthlog(p); dx <<= fontwidthlog(p); width <<= fontwidthlog(p);
     } else {
-    	sx *= p->fontwidth; dx *= p->fontwidth; width *= p->fontwidth;
+    	sx *= fontwidth(p); dx *= fontwidth(p); width *= fontwidth(p);
     }
     if (dy < sy || (dy == sy && dx < sx)) {
 	src = p->screen_base + sy * linesize + sx;
 	dst = p->screen_base + dy * linesize + dx;
-	for (rows = height * p->fontheight ; rows-- ;) {
+	for (rows = height * fontheight(p) ; rows-- ;) {
 	    mymemmove(dst, src, width);
 	    src += bytes;
 	    dst += bytes;
@@ -73,7 +73,7 @@
     } else {
 	src = p->screen_base + (sy+height) * linesize + sx - bytes;
 	dst = p->screen_base + (dy+height) * linesize + dx - bytes;
-	for (rows = height * p->fontheight ; rows-- ;) {
+	for (rows = height * fontheight(p) ; rows-- ;) {
 	    mymemmove(dst, src, width);
 	    src -= bytes;
 	    dst -= bytes;
@@ -85,17 +85,17 @@
 		      int height, int width)
 {
     u8 *dest;
-    int bytes=p->next_line,lines=height * p->fontheight, rows;
+    int bytes=p->next_line,lines=height * fontheight(p), rows;
     u8 bgx;
 
-    dest = p->screen_base + sy * p->fontheight * bytes + sx * p->fontwidth;
+    dest = p->screen_base + sy * fontheight(p) * bytes + sx * fontwidth(p);
 
     bgx=attr_bgcol_ec(p,conp);
 
-    if (sx == 0 && p->fontwidth == 8 && width * 8 == bytes)
-        memset(dest, bgx, lines * width * p->fontwidth);
+    if (sx == 0 && fontwidth(p) == 8 && width * 8 == bytes)
+        memset(dest, bgx, lines * width * fontwidth(p));
     else {
-    	width *= p->fontwidth;
+    	width *= fontwidth(p);
 	for (rows = lines; rows-- ; dest += bytes)
 	    memset(dest, bgx, width);
     }
@@ -108,11 +108,11 @@
     int bytes=p->next_line,rows;
     u32 eorx,fgx,bgx;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth;
-    if (p->fontwidth <= 8)
-	cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p);
+    if (fontwidth(p) <= 8)
+	cdat = p->fontdata + (c & p->charmask) * fontheight(p);
     else
-	cdat = p->fontdata + ((c & p->charmask) * p->fontheight << 1);
+	cdat = p->fontdata + ((c & p->charmask) * fontheight(p) << 1);
 
     fgx=attr_fgcol(p,c);
     bgx=attr_bgcol(p,c);
@@ -122,33 +122,29 @@
     bgx |= (bgx << 16);
     eorx = fgx ^ bgx;
 
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-    switch (p->fontwidth) {
+    switch (fontwidth(p)) {
     case 4:
-	for (rows = p->fontheight ; rows-- ; dest += bytes)
+	for (rows = fontheight(p) ; rows-- ; dest += bytes)
 	    ((u32 *)dest)[0]= (nibbletab_cfb8[*cdat++ >> 4] & eorx) ^ bgx;
         break;
     case 8:
-#endif
-	for (rows = p->fontheight ; rows-- ; dest += bytes) {
+	for (rows = fontheight(p) ; rows-- ; dest += bytes) {
 	    ((u32 *)dest)[0]= (nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx;
 	    ((u32 *)dest)[1]= (nibbletab_cfb8[*cdat++ & 0xf] & eorx) ^ bgx;
         }
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
         break;
     case 12:
     case 16:
-	for (rows = p->fontheight ; rows-- ; dest += bytes) {
+	for (rows = fontheight(p) ; rows-- ; dest += bytes) {
 	    ((u32 *)dest)[0]= (nibbletab_cfb8[*(u16 *)cdat >> 12] & eorx) ^ bgx;
 	    ((u32 *)dest)[1]= (nibbletab_cfb8[(*(u16 *)cdat >> 8) & 0xf] & eorx) ^ bgx;
 	    ((u32 *)dest)[2]= (nibbletab_cfb8[(*(u16 *)cdat >> 4) & 0xf] & eorx) ^ bgx;
-	    if (p->fontwidth == 16)
+	    if (fontwidth(p) == 16)
 	        ((u32 *)dest)[3]= (nibbletab_cfb8[*cdat & 0xf] & eorx) ^ bgx;
 	    cdat += 2;
         }
         break;
     }
-#endif
 }
 
 void fbcon_cfb8_putcs(struct vc_data *conp, struct display *p, 
@@ -159,7 +155,7 @@
     int rows,bytes=p->next_line;
     u32 eorx, fgx, bgx;
 
-    dest0 = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth;
+    dest0 = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p);
     fgx=attr_fgcol(p,*s);
     bgx=attr_bgcol(p,*s);
     fgx |= (fgx << 8);
@@ -167,51 +163,47 @@
     bgx |= (bgx << 8);
     bgx |= (bgx << 16);
     eorx = fgx ^ bgx;
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
-    switch (p->fontwidth) {
+    switch (fontwidth(p)) {
     case 4:
 	while (count--) {
 	    c = *s++ & p->charmask;
-	    cdat = p->fontdata + c * p->fontheight;
+	    cdat = p->fontdata + c * fontheight(p);
 
-	    for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes)
+	    for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes)
 		((u32 *)dest)[0]= (nibbletab_cfb8[*cdat++ >> 4] & eorx) ^ bgx;
 	    dest0+=4;
         }
         break;
     case 8:
-#endif
 	while (count--) {
 	    c = *s++ & p->charmask;
-	    cdat = p->fontdata + c * p->fontheight;
+	    cdat = p->fontdata + c * fontheight(p);
 
-	    for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+	    for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
 		((u32 *)dest)[0]= (nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx;
 		((u32 *)dest)[1]= (nibbletab_cfb8[*cdat++ & 0xf] & eorx) ^ bgx;
 	    }
 	    dest0+=8;
         }
-#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
         break;
     case 12:
     case 16:
 	while (count--) {
 	    c = *s++ & p->charmask;
-	    cdat = p->fontdata + (c * p->fontheight << 1);
+	    cdat = p->fontdata + (c * fontheight(p) << 1);
 
-	    for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+	    for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
 		((u32 *)dest)[0]= (nibbletab_cfb8[*(u16 *)cdat >> 12] & eorx) ^ bgx;
 		((u32 *)dest)[1]= (nibbletab_cfb8[(*(u16 *)cdat >> 8) & 0xf] & eorx) ^ bgx;
 		((u32 *)dest)[2]= (nibbletab_cfb8[(*(u16 *)cdat >> 4) & 0xf] & eorx) ^ bgx;
-		if (p->fontwidth == 16)
+		if (fontwidth(p) == 16)
 		    ((u32 *)dest)[3]= (nibbletab_cfb8[*cdat & 0xf] & eorx) ^ bgx;
 		cdat += 2;
 	    }
-	    dest0+=p->fontwidth;
+	    dest0+=fontwidth(p);
         }
         break;
     }
-#endif
 }
 
 void fbcon_cfb8_revc(struct display *p, int xx, int yy)
@@ -219,20 +211,15 @@
     u8 *dest;
     int bytes=p->next_line, rows;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth;
-    for (rows = p->fontheight ; rows-- ; dest += bytes) {
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-    	((u32 *)dest)[1] ^= 0x0f0f0f0f;
-    	((u32 *)dest)[0] ^= 0x0f0f0f0f;
-#else
-    	switch (p->fontwidth) {
+    dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p);
+    for (rows = fontheight(p) ; rows-- ; dest += bytes) {
+    	switch (fontwidth(p)) {
     	case 16: ((u32 *)dest)[3] ^= 0x0f0f0f0f; /* FALL THROUGH */
     	case 12: ((u32 *)dest)[2] ^= 0x0f0f0f0f; /* FALL THROUGH */
     	case 8: ((u32 *)dest)[1] ^= 0x0f0f0f0f;  /* FALL THROUGH */
     	case 4: ((u32 *)dest)[0] ^= 0x0f0f0f0f;  /* FALL THROUGH */
     	default: break;
     	}
-#endif
     }
 }
 
@@ -243,9 +230,9 @@
     u8 bgx;
     int i;
 
-    unsigned int right_start = conp->vc_cols*p->fontwidth;
+    unsigned int right_start = conp->vc_cols*fontwidth(p);
     unsigned int right_width = p->var.xres_virtual-right_start;
-    unsigned int bottom_start = conp->vc_rows*p->fontheight;
+    unsigned int bottom_start = conp->vc_rows*fontheight(p);
     unsigned int bottom_width = p->var.yres_virtual-bottom_start;
 
     bgx=attr_bgcol_ec(p,conp);
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-cfb8.h m68k/drivers/video/fbcon-cfb8.h
--- jes-2.1.115/drivers/video/fbcon-cfb8.h	Sun Aug  9 21:48:30 1998
+++ m68k/drivers/video/fbcon-cfb8.h	Mon Aug  3 19:48:32 1998
@@ -2,6 +2,8 @@
      *  8 bpp packed pixel (cfb8)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_CFB8) || defined(CONFIG_FBCON_CFB8_MODULE)
 #define FBCON_HAS_CFB8
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-ilbm.c m68k/drivers/video/fbcon-ilbm.c
--- jes-2.1.115/drivers/video/fbcon-ilbm.c	Sun Aug  9 21:48:30 1998
+++ m68k/drivers/video/fbcon-ilbm.c	Wed Jul 29 19:00:39 1998
@@ -45,25 +45,25 @@
 		      int height, int width)
 {
     if (sx == 0 && dx == 0 && width == p->next_plane)
-	mymemmove(p->screen_base+dy*p->fontheight*p->next_line,
-		  p->screen_base+sy*p->fontheight*p->next_line,
-		  height*p->fontheight*p->next_line);
+	mymemmove(p->screen_base+dy*fontheight(p)*p->next_line,
+		  p->screen_base+sy*fontheight(p)*p->next_line,
+		  height*fontheight(p)*p->next_line);
     else {
 	u8 *src, *dest;
 	u_int i;
 
 	if (dy <= sy) {
-	    src = p->screen_base+sy*p->fontheight*p->next_line+sx;
-	    dest = p->screen_base+dy*p->fontheight*p->next_line+dx;
-	    for (i = p->var.bits_per_pixel*height*p->fontheight; i--;) {
+	    src = p->screen_base+sy*fontheight(p)*p->next_line+sx;
+	    dest = p->screen_base+dy*fontheight(p)*p->next_line+dx;
+	    for (i = p->var.bits_per_pixel*height*fontheight(p); i--;) {
 		mymemmove(dest, src, width);
 		src += p->next_plane;
 		dest += p->next_plane;
 	    }
 	} else {
-	    src = p->screen_base+(sy+height)*p->fontheight*p->next_line+sx;
-	    dest = p->screen_base+(dy+height)*p->fontheight*p->next_line+dx;
-	    for (i = p->var.bits_per_pixel*height*p->fontheight; i--;) {
+	    src = p->screen_base+(sy+height)*fontheight(p)*p->next_line+sx;
+	    dest = p->screen_base+(dy+height)*fontheight(p)*p->next_line+dx;
+	    for (i = p->var.bits_per_pixel*height*fontheight(p); i--;) {
 		src -= p->next_plane;
 		dest -= p->next_plane;
 		mymemmove(dest, src, width);
@@ -79,10 +79,10 @@
     u_int i, rows;
     int bg, bg0;
 
-    dest = p->screen_base+sy*p->fontheight*p->next_line+sx;
+    dest = p->screen_base+sy*fontheight(p)*p->next_line+sx;
 
     bg0 = attr_bgcol_ec(p,conp);
-    for (rows = height*p->fontheight; rows--;) {
+    for (rows = height*fontheight(p); rows--;) {
 	bg = bg0;
 	for (i = p->var.bits_per_pixel; i--; dest += p->next_plane) {
 	    if (bg & 1)
@@ -102,12 +102,12 @@
     u8 d;
     int fg0, bg0, fg, bg;
 
-    dest = p->screen_base+yy*p->fontheight*p->next_line+xx;
-    cdat = p->fontdata+(c&p->charmask)*p->fontheight;
+    dest = p->screen_base+yy*fontheight(p)*p->next_line+xx;
+    cdat = p->fontdata+(c&p->charmask)*fontheight(p);
     fg0 = attr_fgcol(p,c);
     bg0 = attr_bgcol(p,c);
 
-    for (rows = p->fontheight; rows--;) {
+    for (rows = fontheight(p); rows--;) {
 	d = *cdat++;
 	fg = fg0;
 	bg = bg0;
@@ -153,7 +153,7 @@
     u32 d;
     int fg0, bg0, fg, bg;
 
-    dest0 = p->screen_base+yy*p->fontheight*p->next_line+xx;
+    dest0 = p->screen_base+yy*fontheight(p)*p->next_line+xx;
     fg0 = attr_fgcol(p,*s);
     bg0 = attr_bgcol(p,*s);
 
@@ -163,8 +163,8 @@
 	    dest = dest0++;
 	    xx++;
 
-	    cdat1 = p->fontdata+c1*p->fontheight;
-	    for (rows = p->fontheight; rows--;) {
+	    cdat1 = p->fontdata+c1*fontheight(p);
+	    for (rows = fontheight(p); rows--;) {
 		d = *cdat1++;
 		fg = fg0;
 		bg = bg0;
@@ -191,11 +191,11 @@
 	    c4 = s[3] & p->charmask;
 
 	    dest = dest0;
-	    cdat1 = p->fontdata+c1*p->fontheight;
-	    cdat2 = p->fontdata+c2*p->fontheight;
-	    cdat3 = p->fontdata+c3*p->fontheight;
-	    cdat4 = p->fontdata+c4*p->fontheight;
-	    for (rows = p->fontheight; rows--;) {
+	    cdat1 = p->fontdata+c1*fontheight(p);
+	    cdat2 = p->fontdata+c2*fontheight(p);
+	    cdat3 = p->fontdata+c3*fontheight(p);
+	    cdat4 = p->fontdata+c4*fontheight(p);
+	    for (rows = fontheight(p); rows--;) {
 #if defined(__BIG_ENDIAN)
 		d = *cdat1++<<24 | *cdat2++<<16 | *cdat3++<<8 | *cdat4++;
 #elif defined(__LITTLE_ENDIAN)
@@ -234,7 +234,7 @@
     u_int rows, i;
     int mask;
 
-    dest0 = p->screen_base+yy*p->fontheight*p->next_line+xx;
+    dest0 = p->screen_base+yy*fontheight(p)*p->next_line+xx;
     mask = p->fgcol ^ p->bgcol;
 
     /*
@@ -246,7 +246,7 @@
     for (i = p->var.bits_per_pixel; i--; dest0 += p->next_plane) {
 	if (mask & 1) {
 	    dest = dest0;
-	    for (rows = p->fontheight; rows--; dest += p->next_line)
+	    for (rows = fontheight(p); rows--; dest += p->next_line)
 		*dest = ~*dest;
 	}
 	mask >>= 1;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-ilbm.h m68k/drivers/video/fbcon-ilbm.h
--- jes-2.1.115/drivers/video/fbcon-ilbm.h	Sun Aug  9 21:48:31 1998
+++ m68k/drivers/video/fbcon-ilbm.h	Mon Aug  3 19:48:34 1998
@@ -2,6 +2,8 @@
      *  Amiga interleaved bitplanes (ilbm)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_ILBM) || defined(CONFIG_FBCON_ILBM_MODULE)  
 #define FBCON_HAS_ILBM 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-iplan2p2.c m68k/drivers/video/fbcon-iplan2p2.c
--- jes-2.1.115/drivers/video/fbcon-iplan2p2.c	Sun Aug  9 21:48:31 1998
+++ m68k/drivers/video/fbcon-iplan2p2.c	Wed Jul 29 19:00:39 1998
@@ -169,16 +169,16 @@
 	/*  Special (but often used) case: Moving whole lines can be
 	 *  done with memmove()
 	 */
-	mymemmove(p->screen_base + dy * p->next_line * p->fontheight,
-		  p->screen_base + sy * p->next_line * p->fontheight,
-		  p->next_line * height * p->fontheight);
+	mymemmove(p->screen_base + dy * p->next_line * fontheight(p),
+		  p->screen_base + sy * p->next_line * fontheight(p),
+		  p->next_line * height * fontheight(p));
     } else {
 	int rows, cols;
 	u8 *src;
 	u8 *dst;
 	int bytes = p->next_line;
-	int linesize = bytes * p->fontheight;
-	u_int colsize  = height * p->fontheight;
+	int linesize = bytes * fontheight(p);
+	u_int colsize  = height * fontheight(p);
 	u_int upwards  = (dy < sy) || (dy == sy && dx < sx);
 
 	if ((sx & 1) == (dx & 1)) {
@@ -258,7 +258,7 @@
     u8 *start;
     int rows;
     int bytes = p->next_line;
-    int lines = height * p->fontheight;
+    int lines = height * fontheight(p);
     u32 size;
     u32 cval;
     u16 pcval;
@@ -266,11 +266,11 @@
     cval = expand2l (COLOR_2P (attr_bgcol_ec(p,conp)));
 
     if (sx == 0 && width * 2 == bytes) {
-	offset = sy * bytes * p->fontheight;
+	offset = sy * bytes * fontheight(p);
 	size = lines * bytes;
 	memset_even_2p(p->screen_base+offset, size, cval);
     } else {
-	offset = (sy * bytes * p->fontheight) + (sx>>1)*4 + (sx & 1);
+	offset = (sy * bytes * fontheight(p)) + (sx>>1)*4 + (sx & 1);
 	start = p->screen_base + offset;
 	pcval = expand2w(COLOR_2P(attr_bgcol_ec(p,conp)));
 
@@ -306,14 +306,14 @@
     int bytes = p->next_line;
     u16 eorx, fgx, bgx, fdx;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + (xx>>1)*4 + (xx & 1);
-    cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+    dest = p->screen_base + yy * fontheight(p) * bytes + (xx>>1)*4 + (xx & 1);
+    cdat = p->fontdata + (c & p->charmask) * fontheight(p);
 
     fgx = expand2w(COLOR_2P(attr_fgcol(p,c)));
     bgx = expand2w(COLOR_2P(attr_bgcol(p,c)));
     eorx = fgx ^ bgx;
 
-    for (rows = p->fontheight ; rows-- ; dest += bytes) {
+    for (rows = fontheight(p) ; rows-- ; dest += bytes) {
 	fdx = dup2w(*cdat++);
 	movepw(dest, (fdx & eorx) ^ bgx);
     }
@@ -330,16 +330,16 @@
     u16 eorx, fgx, bgx, fdx;
 
     bytes = p->next_line;
-    dest0 = p->screen_base + yy * p->fontheight * bytes + (xx>>1)*4 + (xx & 1);
+    dest0 = p->screen_base + yy * fontheight(p) * bytes + (xx>>1)*4 + (xx & 1);
     fgx = expand2w(COLOR_2P(attr_fgcol(p,*s)));
     bgx = expand2w(COLOR_2P(attr_bgcol(p,*s)));
     eorx = fgx ^ bgx;
 
     while (count--) {
 	c = *s++ & p->charmask;
-	cdat  = p->fontdata + (c * p->fontheight);
+	cdat  = p->fontdata + (c * fontheight(p));
 
-	for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+	for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
 	    fdx = dup2w(*cdat++);
 	    movepw(dest, (fdx & eorx) ^ bgx);
 	}
@@ -353,9 +353,9 @@
     int j;
     int bytes;
 
-    dest = p->screen_base + yy * p->fontheight * p->next_line + (xx>>1)*4 +
+    dest = p->screen_base + yy * fontheight(p) * p->next_line + (xx>>1)*4 +
 	   (xx & 1);
-    j = p->fontheight;
+    j = fontheight(p);
     bytes = p->next_line;
     while (j--) {
 	/*  This should really obey the individual character's
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-iplan2p2.h m68k/drivers/video/fbcon-iplan2p2.h
--- jes-2.1.115/drivers/video/fbcon-iplan2p2.h	Sun Aug  9 21:48:31 1998
+++ m68k/drivers/video/fbcon-iplan2p2.h	Mon Aug  3 19:48:39 1998
@@ -2,6 +2,8 @@
      *  Atari interleaved bitplanes (2 planes) (iplan2p2)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_IPLAN2P2) || defined(CONFIG_FBCON_IPLAN2P2_MODULE)
 #define FBCON_HAS_IPLAN2P2
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-iplan2p4.c m68k/drivers/video/fbcon-iplan2p4.c
--- jes-2.1.115/drivers/video/fbcon-iplan2p4.c	Sun Aug  9 21:48:31 1998
+++ m68k/drivers/video/fbcon-iplan2p4.c	Wed Jul 29 19:00:40 1998
@@ -177,16 +177,16 @@
 	/*  Special (but often used) case: Moving whole lines can be
 	 *done with memmove()
 	 */
-	mymemmove(p->screen_base + dy * p->next_line * p->fontheight,
-		  p->screen_base + sy * p->next_line * p->fontheight,
-		  p->next_line * height * p->fontheight);
+	mymemmove(p->screen_base + dy * p->next_line * fontheight(p),
+		  p->screen_base + sy * p->next_line * fontheight(p),
+		  p->next_line * height * fontheight(p));
     } else {
 	int rows, cols;
 	u8 *src;
 	u8 *dst;
 	int bytes = p->next_line;
-	int linesize = bytes * p->fontheight;
-	u_int colsize  = height * p->fontheight;
+	int linesize = bytes * fontheight(p);
+	u_int colsize  = height * fontheight(p);
 	u_int upwards  = (dy < sy) || (dy == sy && dx < sx);
 
 	if ((sx & 1) == (dx & 1)) {
@@ -269,18 +269,18 @@
     u8 *start;
     int rows;
     int bytes = p->next_line;
-    int lines = height * p->fontheight;
+    int lines = height * fontheight(p);
     u32 size;
     u32 cval1, cval2, pcval;
 
     expand4dl(attr_bgcol_ec(p,conp), &cval1, &cval2);
 
     if (sx == 0 && width * 4 == bytes) {
-	offset = sy * bytes * p->fontheight;
+	offset = sy * bytes * fontheight(p);
 	size = lines * bytes;
 	memset_even_4p(p->screen_base+offset, size, cval1, cval2);
     } else {
-	offset = (sy * bytes * p->fontheight) + (sx>>1)*8 + (sx & 1);
+	offset = (sy * bytes * fontheight(p)) + (sx>>1)*8 + (sx & 1);
 	start = p->screen_base + offset;
 	pcval = expand4l(attr_bgcol_ec(p,conp));
 
@@ -316,14 +316,14 @@
     int bytes = p->next_line;
     u32 eorx, fgx, bgx, fdx;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + (xx>>1)*8 + (xx & 1);
-    cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+    dest = p->screen_base + yy * fontheight(p) * bytes + (xx>>1)*8 + (xx & 1);
+    cdat = p->fontdata + (c & p->charmask) * fontheight(p);
 
     fgx = expand4l(attr_fgcol(p,c));
     bgx = expand4l(attr_bgcol(p,c));
     eorx = fgx ^ bgx;
 
-    for(rows = p->fontheight ; rows-- ; dest += bytes) {
+    for(rows = fontheight(p) ; rows-- ; dest += bytes) {
 	fdx = dup4l(*cdat++);
 	movepl(dest, (fdx & eorx) ^ bgx);
     }
@@ -340,7 +340,7 @@
     u32 eorx, fgx, bgx, fdx;
 
     bytes = p->next_line;
-    dest0 = p->screen_base + yy * p->fontheight * bytes + (xx>>1)*8 + (xx & 1);
+    dest0 = p->screen_base + yy * fontheight(p) * bytes + (xx>>1)*8 + (xx & 1);
     fgx = expand4l(attr_fgcol(p,*s));
     bgx = expand4l(attr_bgcol(p,*s));
     eorx = fgx ^ bgx;
@@ -354,9 +354,9 @@
 	*/
 
 	c = *s++ & p->charmask;
-	cdat  = p->fontdata + (c * p->fontheight);
+	cdat  = p->fontdata + (c * fontheight(p));
 
-	for(rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+	for(rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
 	    fdx = dup4l(*cdat++);
 	    movepl(dest, (fdx & eorx) ^ bgx);
 	}
@@ -370,9 +370,9 @@
     int j;
     int bytes;
 
-    dest = p->screen_base + yy * p->fontheight * p->next_line + (xx>>1)*8 +
+    dest = p->screen_base + yy * fontheight(p) * p->next_line + (xx>>1)*8 +
 	   (xx & 1);
-    j = p->fontheight;
+    j = fontheight(p);
     bytes = p->next_line;
 
     while (j--) {
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-iplan2p4.h m68k/drivers/video/fbcon-iplan2p4.h
--- jes-2.1.115/drivers/video/fbcon-iplan2p4.h	Sun Aug  9 21:48:31 1998
+++ m68k/drivers/video/fbcon-iplan2p4.h	Mon Aug  3 19:48:41 1998
@@ -2,6 +2,8 @@
      *  Atari interleaved bitplanes (4 planes) (iplan2p4)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_IPLAN2P4) || defined(CONFIG_FBCON_IPLAN2P4_MODULE)
 #define FBCON_HAS_IPLAN2P4
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-iplan2p8.c m68k/drivers/video/fbcon-iplan2p8.c
--- jes-2.1.115/drivers/video/fbcon-iplan2p8.c	Sun Aug  9 21:48:31 1998
+++ m68k/drivers/video/fbcon-iplan2p8.c	Wed Jul 29 19:00:40 1998
@@ -209,16 +209,16 @@
 	/*  Special (but often used) case: Moving whole lines can be
 	 *  done with memmove()
 	 */
-	fast_memmove(p->screen_base + dy * p->next_line * p->fontheight,
-		     p->screen_base + sy * p->next_line * p->fontheight,
-		     p->next_line * height * p->fontheight);
+	fast_memmove(p->screen_base + dy * p->next_line * fontheight(p),
+		     p->screen_base + sy * p->next_line * fontheight(p),
+		     p->next_line * height * fontheight(p));
      } else {
 	int rows, cols;
 	u8 *src;
 	u8 *dst;
 	int bytes = p->next_line;
-	int linesize = bytes * p->fontheight;
-	u_int colsize = height * p->fontheight;
+	int linesize = bytes * fontheight(p);
+	u_int colsize = height * fontheight(p);
 	u_int upwards = (dy < sy) || (dy == sy && dx < sx);
 
 	if ((sx & 1) == (dx & 1)) {
@@ -301,18 +301,18 @@
     u8 *start;
     int rows;
     int bytes = p->next_line;
-    int lines = height * p->fontheight;
+    int lines = height * fontheight(p);
     u32 size;
     u32 cval1, cval2, cval3, cval4, pcval1, pcval2;
 
     expand8ql(attr_bgcol_ec(p,conp), &cval1, &cval2, &cval3, &cval4);
 
     if (sx == 0 && width * 8 == bytes) {
-	offset = sy * bytes * p->fontheight;
+	offset = sy * bytes * fontheight(p);
 	size    = lines * bytes;
 	memset_even_8p(p->screen_base+offset, size, cval1, cval2, cval3, cval4);
     } else {
-	offset = (sy * bytes * p->fontheight) + (sx>>1)*16 + (sx & 1);
+	offset = (sy * bytes * fontheight(p)) + (sx>>1)*16 + (sx & 1);
 	start = p->screen_base + offset;
 	expand8dl(attr_bgcol_ec(p,conp), &pcval1, &pcval2);
 
@@ -348,14 +348,14 @@
     int bytes = p->next_line;
     u32 eorx1, eorx2, fgx1, fgx2, bgx1, bgx2, fdx;
 
-    dest = p->screen_base + yy * p->fontheight * bytes + (xx>>1)*16 + (xx & 1);
-    cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+    dest = p->screen_base + yy * fontheight(p) * bytes + (xx>>1)*16 + (xx & 1);
+    cdat = p->fontdata + (c & p->charmask) * fontheight(p);
 
     expand8dl(attr_fgcol(p,c), &fgx1, &fgx2);
     expand8dl(attr_bgcol(p,c), &bgx1, &bgx2);
     eorx1 = fgx1 ^ bgx1; eorx2  = fgx2 ^ bgx2;
 
-    for(rows = p->fontheight ; rows-- ; dest += bytes) {
+    for(rows = fontheight(p) ; rows-- ; dest += bytes) {
 	fdx = dup4l(*cdat++);
 	movepl2(dest, (fdx & eorx1) ^ bgx1, (fdx & eorx2) ^ bgx2);
     }
@@ -372,7 +372,7 @@
     u32 eorx1, eorx2, fgx1, fgx2, bgx1, bgx2, fdx;
 
     bytes = p->next_line;
-    dest0 = p->screen_base + yy * p->fontheight * bytes + (xx>>1)*16 +
+    dest0 = p->screen_base + yy * fontheight(p) * bytes + (xx>>1)*16 +
 	    (xx & 1);
 
     expand8dl(attr_fgcol(p,*s), &fgx1, &fgx2);
@@ -389,9 +389,9 @@
 	*/
 
 	c = *s++ & p->charmask;
-	cdat  = p->fontdata + (c * p->fontheight);
+	cdat  = p->fontdata + (c * fontheight(p));
 
-	for(rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+	for(rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
 	    fdx = dup4l(*cdat++);
 	    movepl2(dest, (fdx & eorx1) ^ bgx1, (fdx & eorx2) ^ bgx2);
 	}
@@ -405,9 +405,9 @@
     int j;
     int bytes;
 
-    dest = p->screen_base + yy * p->fontheight * p->next_line + (xx>>1)*16 +
+    dest = p->screen_base + yy * fontheight(p) * p->next_line + (xx>>1)*16 +
 	   (xx & 1);
-    j = p->fontheight;
+    j = fontheight(p);
     bytes = p->next_line;
 
     while (j--) {
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-iplan2p8.h m68k/drivers/video/fbcon-iplan2p8.h
--- jes-2.1.115/drivers/video/fbcon-iplan2p8.h	Sun Aug  9 21:48:31 1998
+++ m68k/drivers/video/fbcon-iplan2p8.h	Mon Aug  3 19:48:45 1998
@@ -2,6 +2,8 @@
      *  Atari interleaved bitplanes (8 planes) (iplan2p8)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_IPLAN2P8) || defined(CONFIG_FBCON_IPLAN2P8_MODULE)
 #define FBCON_HAS_IPLAN2P8
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-mac.c m68k/drivers/video/fbcon-mac.c
--- jes-2.1.115/drivers/video/fbcon-mac.c	Sun Aug  9 21:48:31 1998
+++ m68k/drivers/video/fbcon-mac.c	Wed Aug 12 09:29:39 1998
@@ -57,24 +57,24 @@
    int dl,dr,dt,db,dw,dlo;
    int move_up;
 
-   src = (u8 *) (p->screen_base + sy * p->fontheight * p->next_line);
-   dest = (u8 *) (p->screen_base + dy * p->fontheight * p->next_line);
+   src = (u8 *) (p->screen_base + sy * fontheight(p) * p->next_line);
+   dest = (u8 *) (p->screen_base + dy * fontheight(p) * p->next_line);
 
    if( sx == 0 && width == p->conp->vc_cols) {
-     s = height * p->fontheight * p->next_line;
+     s = height * fontheight(p) * p->next_line;
      mymemmove(dest, src, s);
      return;
    }
    
-   l = sx * p->fontwidth;
-   r = l + width * p->fontwidth;
-   t = sy * p->fontheight;
-   b = t + height * p->fontheight;
-
-   dl = dx * p->fontwidth;
-   dr = dl + width * p->fontwidth;
-   dt = dy * p->fontheight;
-   db = dt + height * p->fontheight;
+   l = sx * fontwidth(p);
+   r = l + width * fontwidth(p);
+   t = sy * fontheight(p);
+   b = t + height * fontheight(p);
+
+   dl = dx * fontwidth(p);
+   dr = dl + width * fontwidth(p);
+   dt = dy * fontheight(p);
+   db = dt + height * fontheight(p);
 
    /* w is the # pixels between two long-aligned points, left and right */
    w = (r&~31) - ((l+31)&~31);
@@ -143,8 +143,8 @@
    if (sy <= sx) {
      i = b;
      move_up = 0;
-     src += height * p->fontheight;
-     dest += height * p->fontheight;
+     src += height * fontheight(p);
+     dest += height * fontheight(p);
    } else {
      i = t;
      move_up = 1;
@@ -195,22 +195,22 @@
    u8 *dest;
    int l,r,t,b,w,lo,s;
 
-   inverse = attr_reverse(p,conp->vc_attr);
+   inverse = conp ? attr_reverse(p,conp->vc_attr) : 0;
    pixel = inverse ? PIXEL_WHITE_MAC : PIXEL_BLACK_MAC;
-   dest = (u8 *) (p->screen_base + sy * p->fontheight * p->next_line);
+   dest = (u8 *) (p->screen_base + sy * fontheight(p) * p->next_line);
 
    if( sx == 0 && width == p->conp->vc_cols) {
-     s = height * p->fontheight * p->next_line;
+     s = height * fontheight(p) * p->next_line;
      if (inverse)
        mymemclear(dest, s);
      else
        mymemset(dest, s);
    }
    
-   l = sx * p->fontwidth;
-   r = l + width * p->fontwidth;
-   t = sy * p->fontheight;
-   b = t + height * p->fontheight;
+   l = sx * fontwidth(p);
+   r = l + width * fontwidth(p);
+   t = sy * fontheight(p);
+   b = t + height * fontheight(p);
    /* w is the # pixels between two long-aligned points, left and right */
    w = (r&~31) - ((l+31)&~31);
    /* lo is the # pixels between the left edge and a long-aligned left pixel */
@@ -272,23 +272,23 @@
    u8 d;
    int j;
 
-   cdat = p->fontdata+(c&p->charmask)*p->fontheight;
+   cdat = p->fontdata+(c&p->charmask)*fontheight(p);
    bold = attr_bold(p,c);
    ch_reverse = attr_reverse(p,c);
    ch_underline = attr_underline(p,c);
 
-   for (rows = 0; rows < p->fontheight; rows++) {
+   for (rows = 0; rows < fontheight(p); rows++) {
       d = *cdat++;
       if (!conp->vc_can_do_color) {
-	if (ch_underline && rows == (p->fontheight-2))
+	if (ch_underline && rows == (fontheight(p)-2))
 	  d = 0xff;
 	else if (bold)
 	  d |= d>>1;
 	if (ch_reverse)
 	  d = ~d;
       }
-      for (j = 0; j < p->fontwidth; j++) {
-	plot_pixel_mac(p, (d & 0x80) >> 7, (xx*p->fontwidth) + j, (yy*p->fontheight) + rows);
+      for (j = 0; j < fontwidth(p); j++) {
+	plot_pixel_mac(p, (d & 0x80) >> 7, (xx*fontwidth(p)) + j, (yy*fontheight(p)) + rows);
 	d <<= 1;
       }
    }
@@ -311,9 +311,9 @@
 {
    u_int rows, j;
 
-   for (rows = 0; rows < p->fontheight; rows++) {
-     for (j = 0; j < p->fontwidth; j++) {
-       plot_pixel_mac (p, PIXEL_INVERT_MAC, (xx*p->fontwidth)+j, (yy*p->fontheight)+rows);
+   for (rows = 0; rows < fontheight(p); rows++) {
+     for (j = 0; j < fontwidth(p); j++) {
+       plot_pixel_mac (p, PIXEL_INVERT_MAC, (xx*fontwidth(p))+j, (yy*fontheight(p))+rows);
      }
    }
 }
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-mac.h m68k/drivers/video/fbcon-mac.h
--- jes-2.1.115/drivers/video/fbcon-mac.h	Sun Aug  9 21:48:31 1998
+++ m68k/drivers/video/fbcon-mac.h	Mon Aug  3 19:48:48 1998
@@ -2,6 +2,8 @@
      *  Mac variable bpp packed pixels (mac)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_MAC) || defined(CONFIG_FBCON_MAC_MODULE)
 #define FBCON_HAS_MAC
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-mfb.c m68k/drivers/video/fbcon-mfb.c
--- jes-2.1.115/drivers/video/fbcon-mfb.c	Sun Aug  9 21:48:31 1998
+++ m68k/drivers/video/fbcon-mfb.c	Wed Aug 12 09:29:41 1998
@@ -39,21 +39,21 @@
     u_int rows;
 
     if (sx == 0 && dx == 0 && width == p->next_line) {
-	src = p->screen_base+sy*p->fontheight*width;
-	dest = p->screen_base+dy*p->fontheight*width;
-	mymemmove(dest, src, height*p->fontheight*width);
+	src = p->screen_base+sy*fontheight(p)*width;
+	dest = p->screen_base+dy*fontheight(p)*width;
+	mymemmove(dest, src, height*fontheight(p)*width);
     } else if (dy <= sy) {
-	src = p->screen_base+sy*p->fontheight*p->next_line+sx;
-	dest = p->screen_base+dy*p->fontheight*p->next_line+dx;
-	for (rows = height*p->fontheight; rows--;) {
+	src = p->screen_base+sy*fontheight(p)*p->next_line+sx;
+	dest = p->screen_base+dy*fontheight(p)*p->next_line+dx;
+	for (rows = height*fontheight(p); rows--;) {
 	    mymemmove(dest, src, width);
 	    src += p->next_line;
 	    dest += p->next_line;
 	}
     } else {
-	src = p->screen_base+((sy+height)*p->fontheight-1)*p->next_line+sx;
-	dest = p->screen_base+((dy+height)*p->fontheight-1)*p->next_line+dx;
-	for (rows = height*p->fontheight; rows--;) {
+	src = p->screen_base+((sy+height)*fontheight(p)-1)*p->next_line+sx;
+	dest = p->screen_base+((dy+height)*fontheight(p)-1)*p->next_line+dx;
+	for (rows = height*fontheight(p); rows--;) {
 	    mymemmove(dest, src, width);
 	    src -= p->next_line;
 	    dest -= p->next_line;
@@ -66,17 +66,18 @@
 {
     u8 *dest;
     u_int rows;
+    int inverse = conp ? attr_reverse(p,conp->vc_attr) : 0;
 
-    dest = p->screen_base+sy*p->fontheight*p->next_line+sx;
+    dest = p->screen_base+sy*fontheight(p)*p->next_line+sx;
 
     if (sx == 0 && width == p->next_line) {
-	if (attr_reverse(p,conp->vc_attr))
-	    mymemset(dest, height*p->fontheight*width);
+	if (inverse)
+	    mymemset(dest, height*fontheight(p)*width);
 	else
-	    mymemclear(dest, height*p->fontheight*width);
+	    mymemclear(dest, height*fontheight(p)*width);
     } else
-	for (rows = height*p->fontheight; rows--; dest += p->next_line)
-	    if (attr_reverse(p,conp->vc_attr))
+	for (rows = height*fontheight(p); rows--; dest += p->next_line)
+	    if (inverse)
 		mymemset(dest, width);
 	    else
 		mymemclear_small(dest, width);
@@ -89,13 +90,13 @@
     u_int rows, bold, revs, underl;
     u8 d;
 
-    dest = p->screen_base+yy*p->fontheight*p->next_line+xx;
-    cdat = p->fontdata+(c&p->charmask)*p->fontheight;
+    dest = p->screen_base+yy*fontheight(p)*p->next_line+xx;
+    cdat = p->fontdata+(c&p->charmask)*fontheight(p);
     bold = attr_bold(p,c);
     revs = attr_reverse(p,c);
     underl = attr_underline(p,c);
 
-    for (rows = p->fontheight; rows--; dest += p->next_line) {
+    for (rows = fontheight(p); rows--; dest += p->next_line) {
 	d = *cdat++;
 	if (underl && !rows)
 	    d = 0xff;
@@ -115,7 +116,7 @@
     u8 d;
     u16 c;
 
-    dest0 = p->screen_base+yy*p->fontheight*p->next_line+xx;
+    dest0 = p->screen_base+yy*fontheight(p)*p->next_line+xx;
     bold = attr_bold(p,*s);
     revs = attr_reverse(p,*s);
     underl = attr_underline(p,*s);
@@ -123,8 +124,8 @@
     while (count--) {
 	c = *s++ & p->charmask;
 	dest = dest0++;
-	cdat = p->fontdata+c*p->fontheight;
-	for (rows = p->fontheight; rows--; dest += p->next_line) {
+	cdat = p->fontdata+c*fontheight(p);
+	for (rows = fontheight(p); rows--; dest += p->next_line) {
 	    d = *cdat++;
 	    if (underl && !rows)
 		d = 0xff;
@@ -142,8 +143,8 @@
     u8 *dest;
     u_int rows;
 
-    dest = p->screen_base+yy*p->fontheight*p->next_line+xx;
-    for (rows = p->fontheight; rows--; dest += p->next_line)
+    dest = p->screen_base+yy*fontheight(p)*p->next_line+xx;
+    for (rows = fontheight(p); rows--; dest += p->next_line)
 	*dest = ~*dest;
 }
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-mfb.h m68k/drivers/video/fbcon-mfb.h
--- jes-2.1.115/drivers/video/fbcon-mfb.h	Sun Aug  9 21:48:31 1998
+++ m68k/drivers/video/fbcon-mfb.h	Mon Aug  3 19:48:49 1998
@@ -2,6 +2,8 @@
      *  Monochrome (mfb)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_MFB) || defined(CONFIG_FBCON_MFB_MODULE)
 #define FBCON_HAS_MFB
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon-vga.h m68k/drivers/video/fbcon-vga.h
--- jes-2.1.115/drivers/video/fbcon-vga.h	Sun Aug  9 21:48:31 1998
+++ m68k/drivers/video/fbcon-vga.h	Mon Aug  3 19:48:53 1998
@@ -2,6 +2,8 @@
      *  VGA characters/attributes
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_VGA) || defined(CONFIG_FBCON_VGA_MODULE)
 #define FBCON_HAS_VGA
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon.c m68k/drivers/video/fbcon.c
--- jes-2.1.115/drivers/video/fbcon.c	Sun Aug  9 21:48:31 1998
+++ m68k/drivers/video/fbcon.c	Wed Aug 12 09:29:44 1998
@@ -112,6 +112,14 @@
 static int logo_lines;
 static int logo_shown = -1;
 
+#define REFCOUNT(fd)	(((int *)(fd))[-1])
+#define FNTSIZE(fd)	(((int *)(fd))[-2])
+#define FNTCHARCNT(fd)	(((int *)(fd))[-3])
+#define FNTSUM(fd)	(((int *)(fd))[-4])
+#define FONT_EXTRA_WORDS 4
+
+static void fbcon_free_font(struct display *p);
+
 /*
  * Emmanuel: fbcon will now use a hardware cursor if the
  * low-level driver provides a non-NULL dispsw->cursor pointer,
@@ -349,6 +357,7 @@
     int unit = conp->vc_num;
     struct display *p = &fb_display[unit];
 
+    fbcon_free_font(p);
     p->dispsw = NULL;
     p->conp = 0;
 }
@@ -366,11 +375,11 @@
 {
     if (p->scrollmode == SCROLL_YREDRAW)
     	return;
-    if (divides(p->ywrapstep, p->fontheight) &&
-	divides(p->fontheight, p->var.yres_virtual))
+    if (divides(p->ywrapstep, fontheight(p)) &&
+	divides(fontheight(p), p->var.yres_virtual))
 	p->scrollmode = SCROLL_YWRAP;
-    else if (divides(p->ypanstep, p->fontheight) &&
-	     p->var.yres_virtual >= p->var.yres+p->fontheight)
+    else if (divides(p->ypanstep, fontheight(p)) &&
+	     p->var.yres_virtual >= p->var.yres+fontheight(p))
 	p->scrollmode = SCROLL_YPAN;
     else
 	p->scrollmode = SCROLL_YMOVE;
@@ -379,14 +388,15 @@
 static void fbcon_font_widths(struct display *p)
 {
     int i;
-    p->fontwidthlog = 0;
+    
+    p->_fontwidthlog = 0;
     for (i = 2; i <= 6; i++)
-    	if (p->fontwidth == (1 << i))
-	    p->fontwidthlog = i;
-    p->fontheightlog = 0;
+    	if (fontwidth(p) == (1 << i))
+	    p->_fontwidthlog = i;
+    p->_fontheightlog = 0;
     for (i = 2; i <= 6; i++)
-    	if (p->fontheight == (1 << i))
-	    p->fontheightlog = i;
+    	if (fontheight(p) == (1 << i))
+	    p->_fontheightlog = i;
 }
 
 #define fontwidthvalid(p,w) ((p)->dispsw->fontwidthmask & FONTWIDTH(w))
@@ -395,25 +405,57 @@
 {
     struct display *p = &fb_display[con];
     struct vc_data *conp = p->conp;
+    int unit = conp->vc_num;
     int nr_rows, nr_cols;
     int old_rows, old_cols;
     unsigned short *save = NULL, *r, *q;
+    int i, charcnt = 256;
+    struct fbcon_font_desc *font;
     /* Only if not module */
     extern int initmem_freed;
-    struct fbcon_font_desc *font;
+    
     if (con != fg_console || initmem_freed || p->type == FB_TYPE_TEXT)
     	logo = 0;
 
     p->var.xoffset = p->var.yoffset = p->yscroll = 0;  /* reset wrap/pan */
+    
+    for (i = 0; i < MAX_NR_CONSOLES; i++)
+    	if (i != con && fb_display[i].fb_info == p->fb_info &&
+    	    fb_display[i].conp && fb_display[i].fontdata)
+    		break;
+
+    fbcon_free_font(p);    
+    if (i < MAX_NR_CONSOLES) {
+    	struct display *q = &fb_display[i];
+
+        if (fontwidthvalid(p,fontwidth(q))) {
+            /* If we are not the first console on this
+               fb, copy the font from that console */
+	    p->_fontwidth = q->_fontwidth;
+	    p->_fontheight = q->_fontheight;
+    	    p->_fontwidthlog = q->_fontwidthlog;
+    	    p->_fontheightlog = q->_fontheightlog;
+    	    p->fontdata = q->fontdata;
+    	    p->userfont = q->userfont; 
+    	    if (p->userfont) {
+    		REFCOUNT(p->fontdata)++;
+    		charcnt = FNTCHARCNT(p->fontdata);
+    	    }
+    	    con_copy_unimap(con, i);
+    	}
+    }
 
-    if (!p->fb_info->fontname[0] ||
-	!(font = fbcon_find_font(p->fb_info->fontname)))
-	    font = fbcon_get_default_font(p->var.xres, p->var.yres);
-    p->fontwidth = font->width;
-    p->fontheight = font->height;
-    p->fontdata = font->data;
-    fbcon_font_widths(p);
-    if (!fontwidthvalid(p,p->fontwidth)) {
+    if (!p->fontdata) {
+        if (!p->fb_info->fontname[0] ||
+	    !(font = fbcon_find_font(p->fb_info->fontname)))
+	        font = fbcon_get_default_font(p->var.xres, p->var.yres);
+        p->_fontwidth = font->width;
+        p->_fontheight = font->height;
+        p->fontdata = font->data;
+        fbcon_font_widths(p);
+    }
+    
+    if (!fontwidthvalid(p,fontwidth(p))) {
 #ifdef CONFIG_MAC
 	if (MACH_IS_MAC)
 	    /* ++Geert: hack to make 6x11 fonts work on mac */
@@ -422,26 +464,26 @@
 #endif
 	{
 	    /* ++Geert: changed from panic() to `correct and continue' */
-	    printk(KERN_ERR "fbcon_setup: No support for fontwidth %d\n", p->fontwidth);
+	    printk(KERN_ERR "fbcon_setup: No support for fontwidth %d\n", fontwidth(p));
 	    p->dispsw = &fbcon_dummy;
 	}
     }
     if (p->dispsw->set_font)
-    	p->dispsw->set_font(p, p->fontwidth, p->fontheight);
+    	p->dispsw->set_font(p, fontwidth(p), fontheight(p));
     updatescrollmode(p);
     
     old_cols = conp->vc_cols;
     old_rows = conp->vc_rows;
     
-    nr_cols = p->var.xres/p->fontwidth;
-    nr_rows = p->var.yres/p->fontheight;
+    nr_cols = p->var.xres/fontwidth(p);
+    nr_rows = p->var.yres/fontheight(p);
     
     if (logo) {
     	/* Need to make room for the logo */
 	int cnt;
 	int step;
     
-    	logo_lines = (LOGO_H + p->fontheight - 1) / p->fontheight;
+    	logo_lines = (LOGO_H + fontheight(p) - 1) / fontheight(p);
     	q = (unsigned short *)(conp->vc_origin + conp->vc_size_row * old_rows);
     	step = logo_lines * old_cols;
     	for (r = q - logo_lines * old_cols; r < q; r++)
@@ -483,12 +525,21 @@
 	conp->vc_cols = nr_cols;
 	conp->vc_rows = nr_rows;
     }
-    p->vrows = p->var.yres_virtual/p->fontheight;
+    p->vrows = p->var.yres_virtual/fontheight(p);
     conp->vc_can_do_color = p->var.bits_per_pixel != 1;
-    p->fgshift = 8;
-    p->bgshift = 12;
-    p->charmask = 0xff;
-    conp->vc_hi_font_mask = 0;
+    conp->vc_complement_mask = conp->vc_can_do_color ? 0x7700 : 0x0800;
+    if (charcnt == 256) {
+    	p->conp->vc_hi_font_mask = 0;
+    	p->fgshift = 8;
+    	p->bgshift = 12;
+    	p->charmask = 0xff;
+    } else {
+    	p->conp->vc_hi_font_mask = 0x100;
+    	p->conp->vc_complement_mask <<= 1;
+    	p->fgshift = 9;
+    	p->bgshift = 13;
+    	p->charmask = 0x1ff;
+    }
 
     if (!p->dispsw) {
 	printk(KERN_WARNING "fbcon_setup: type %d (aux %d, depth %d) not "
@@ -512,7 +563,7 @@
     	    conp->vc_pos += logo_lines * conp->vc_size_row;
     	    kfree(save);
 	}
-	if (con == fg_console)
+	if (con == fg_console && vt_cons[unit]->vc_mode == KD_TEXT)
 	    update_screen(con); /* So that we set origin correctly */
     }
 	
@@ -704,7 +755,7 @@
     if (p->yscroll >= p->vrows)	/* Deal with wrap */
 	p->yscroll -= p->vrows;
     p->var.xoffset = 0;
-    p->var.yoffset = p->yscroll*p->fontheight;
+    p->var.yoffset = p->yscroll*fontheight(p);
     p->var.vmode |= FB_VMODE_YWRAP;
     p->fb_info->updatevar(unit, p->fb_info);
     scrollback_max += count;
@@ -721,7 +772,7 @@
     if (p->yscroll < 0)		/* Deal with wrap */
 	p->yscroll += p->vrows;
     p->var.xoffset = 0;
-    p->var.yoffset = p->yscroll*p->fontheight;
+    p->var.yoffset = p->yscroll*fontheight(p);
     p->var.vmode |= FB_VMODE_YWRAP;
     p->fb_info->updatevar(unit, p->fb_info);
     scrollback_max -= count;
@@ -741,7 +792,7 @@
 	p->yscroll -= p->vrows-conp->vc_rows;
     }
     p->var.xoffset = 0;
-    p->var.yoffset = p->yscroll*p->fontheight;
+    p->var.yoffset = p->yscroll*fontheight(p);
     p->var.vmode &= ~FB_VMODE_YWRAP;
     p->fb_info->updatevar(unit, p->fb_info);
     scrollback_max += count;
@@ -761,7 +812,7 @@
 	p->yscroll += p->vrows-conp->vc_rows;
     }
     p->var.xoffset = 0;
-    p->var.yoffset = p->yscroll*p->fontheight;
+    p->var.yoffset = p->yscroll*fontheight(p);
     p->var.vmode &= ~FB_VMODE_YWRAP;
     p->fb_info->updatevar(unit, p->fb_info);
     scrollback_max -= count;
@@ -945,7 +996,8 @@
 		    	return 1;
 		}
 	    else {
-		fbcon_bmove(conp, t+count, 0, t, 0, b-t-count, conp->vc_cols);
+		if (p->scrollmode != SCROLL_YREDRAW)
+			fbcon_bmove(conp, t+count, 0, t, 0, b-t-count, conp->vc_cols);
 		fbcon_clear(conp, b-count, 0, count, conp->vc_cols);
 	    }
 	    break;
@@ -1008,20 +1060,11 @@
 		 *	Man who copies in wrong direction, end up with trashed
 		 *	data
 		 */
-		fbcon_bmove(conp, t, 0, t+count, 0, b-t-count, conp->vc_cols);
+		if (p->scrollmode != SCROLL_YREDRAW)
+			fbcon_bmove(conp, t, 0, t+count, 0, b-t-count, conp->vc_cols);
 		fbcon_clear(conp, t, 0, count, conp->vc_cols);
 	    }
 	    break;
-
-	case SM_LEFT:
-	    fbcon_bmove(conp, 0, t+count, 0, t, conp->vc_rows, b-t-count);
-	    fbcon_clear(conp, 0, b-count, conp->vc_rows, count);
-	    break;
-
-	case SM_RIGHT:
-	    fbcon_bmove(conp, 0, t, 0, t+count, conp->vc_rows, b-t-count);
-	    fbcon_clear(conp, 0, t, conp->vc_rows, count);
-	    break;
     }
     return 0;
 }
@@ -1100,7 +1143,7 @@
     		conp2->vc_top = 0;
     	logo_shown = -1;
     }
-    p->var.yoffset = p->yscroll*p->fontheight;
+    p->var.yoffset = p->yscroll*fontheight(p);
     switch (p->scrollmode) {
 	case SCROLL_YWRAP:
 	    scrollback_phys_max = p->vrows-conp->vc_rows;
@@ -1151,7 +1194,7 @@
 			     p->var.xres_virtual*p->var.yres_virtual*
 			     p->var.bits_per_pixel>>3);
 	     } else
-		 p->dispsw->clear(conp, p, 0, 0, p->conp->vc_rows, p->conp->vc_cols);
+		 p->dispsw->clear(NULL, p, 0, 0, p->conp->vc_rows, p->conp->vc_cols);
 	    return 0;
 	} else {
 	    /* Tell console.c that it has to restore the screen itself */
@@ -1162,67 +1205,73 @@
     return 0;
 }
 
+static void fbcon_free_font(struct display *p)
+{
+    if (p->userfont && p->fontdata &&
+        (--REFCOUNT(p->fontdata) == 0))
+	kfree(p->fontdata - FONT_EXTRA_WORDS*sizeof(int));
+    p->fontdata = NULL;
+    p->userfont = 0;
+}
 
 static inline int fbcon_get_font(int unit, struct console_font_op *op)
 {
     struct display *p = &fb_display[unit];
     u8 *data = op->data;
+    u8 *fontdata = p->fontdata;
     int i, j;
 
 #ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
-    if (p->fontwidth != 8) return -EINVAL;
+    if (fontwidth(p) != 8) return -EINVAL;
 #endif
-    op->width = p->fontwidth;
-    op->height = p->fontheight;
+    op->width = fontwidth(p);
+    op->height = fontheight(p);
     op->charcount = (p->charmask == 0x1ff) ? 512 : 256;
     if (!op->data) return 0;
     
     if (op->width <= 8) {
     	for (i = 0; i < op->charcount; i++) {
-	    for (j = 0; j < p->fontheight; j++)
-		*data++ = p->fontdata[i*p->fontheight+j];
-	    data += 32 - p->fontheight;
+	    for (j = 0; j < fontheight(p); j++)
+		*data++ = *fontdata++;
+	    memset(data, 0, 32-j);
 	}
     }
 #ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
     else if (op->width <= 16) {
 	for (i = 0; i < op->charcount; i++) {
-	    for (j = 0; j < p->fontheight; j++) {
-		*data++ = ((u16 *)p->fontdata)[i*p->fontheight+j] >> 8;
-		*data++ = ((u16 *)p->fontdata)[i*p->fontheight+j];
+	    for (j = 0; j < fontheight(p); j++) {
+		*data++ = *(u16 *)fontdata >> 8;
+		*data++ = *(u16 *)fontdata;
+		fontdata += sizeof(u16);
 	    }
-	    data += 2 * (32 - p->fontheight);
+	    memset(data, 0, 2*(32-j));
 	}
     } else if (op->width <= 24) {
 	for (i = 0; i < op->charcount; i++) {
-	    for (j = 0; j < p->fontheight; j++) {
-		*data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 24;
-		*data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 16;
-		*data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 8;
+	    for (j = 0; j < fontheight(p); j++) {
+		*data++ = *(u32 *)fontdata >> 24;
+		*data++ = *(u32 *)fontdata >> 16;
+		*data++ = *(u32 *)fontdata >> 8;
+		fontdata += sizeof(u32);
 	    }
-	    data += 3 * (32 - p->fontheight);
+	    memset(data, 0, 3*(32-j));
 	}
     } else {
 	for (i = 0; i < op->charcount; i++) {
-	    for (j = 0; j < p->fontheight; j++) {
-		*data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 24;
-		*data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 16;
-		*data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 8;
-		*data++ = ((u32 *)p->fontdata)[i*p->fontheight+j];
+	    for (j = 0; j < fontheight(p); j++) {
+		*data++ = *(u32 *)fontdata >> 24;
+		*data++ = *(u32 *)fontdata >> 16;
+		*data++ = *(u32 *)fontdata >> 8;
+		*data++ = *(u32 *)fontdata;
+		fontdata += sizeof(u32);
 	    }
-	    data += 4 * (32 - p->fontheight);
+	    memset(data, 0, 4*(32-j));
 	}
     }
 #endif
     return 0;
 }
 
-
-#define REFCOUNT(fd)	(((int *)(fd))[-1])
-#define FNTSIZE(fd)	(((int *)(fd))[-2])
-#define FNTCHARCNT(fd)	(((int *)(fd))[-3])
-#define FNTSUM(fd)	(((int *)(fd))[-4])
-
 static int fbcon_do_set_font(int unit, struct console_font_op *op, u8 *data, int userfont)
 {
     struct display *p = &fb_display[unit];
@@ -1233,12 +1282,12 @@
     char *old_data = NULL;
 
     if (!fontwidthvalid(p,w)) {
-        if (userfont)
-	    kfree(data);
+        if (userfont && op->op != KD_FONT_OP_COPY)
+	    kfree(data - FONT_EXTRA_WORDS*sizeof(int));
 	return -ENXIO;
     }
 
-    resize = (w != p->fontwidth) || (h != p->fontheight);
+    resize = (w != fontwidth(p)) || (h != fontheight(p));
     if (p->userfont)
         old_data = p->fontdata;
     if (userfont)
@@ -1248,8 +1297,8 @@
     p->fontdata = data;
     if ((p->userfont = userfont))
         REFCOUNT(data)++;
-    p->fontwidth = w;
-    p->fontheight = h;
+    p->_fontwidth = w;
+    p->_fontheight = h;
     if (p->conp->vc_hi_font_mask && cnt == 256) {
     	p->conp->vc_hi_font_mask = 0;
     	p->conp->vc_complement_mask >>= 1;
@@ -1269,7 +1318,7 @@
 	/* reset wrap/pan */
 	p->var.xoffset = p->var.yoffset = p->yscroll = 0;
 	if (!p->dispsw->set_font || 
-	    !p->dispsw->set_font(p, p->fontwidth, p->fontheight)) {
+	    !p->dispsw->set_font(p, fontwidth(p), fontheight(p))) {
 	    /* Adjust the virtual screen-size to fontheight*rows */
 	    p->var.yres_virtual = (p->var.yres/h)*h;
 	}
@@ -1280,7 +1329,7 @@
 	update_screen( unit );
 
     if (old_data && (--REFCOUNT(old_data) == 0))
-	kfree( old_data - 4*sizeof(int) );
+	kfree(old_data - FONT_EXTRA_WORDS*sizeof(int));
 
     return 0;
 }
@@ -1297,8 +1346,8 @@
     od = &fb_display[h];
     if (od->fontdata == p->fontdata)
         return 0; /* already the same font... */
-    op->width = od->fontwidth;
-    op->height = od->fontheight;
+    op->width = fontwidth(od);
+    op->height = fontheight(od);
     return fbcon_do_set_font(unit, op, od->fontdata, od->userfont);
 }
 
@@ -1309,9 +1358,10 @@
     int size = h;
     int i, j, k;
     u8 *new_data, *data = op->data, c, *p;
+#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
     u32 d;
+#else
 
-#ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
     if (w != 8)
     	return -EINVAL;
 #endif
@@ -1327,57 +1377,59 @@
     }
     size *= op->charcount;
        
-    if (!(new_data = kmalloc( 4*sizeof(int)+size, GFP_USER )))
+    if (!(new_data = kmalloc(FONT_EXTRA_WORDS*sizeof(int)+size, GFP_USER)))
         return -ENOMEM;
-    new_data += 4*sizeof(int);
+    new_data += FONT_EXTRA_WORDS*sizeof(int);
     FNTSIZE(new_data) = size;
     FNTCHARCNT(new_data) = op->charcount;
     REFCOUNT(new_data) = 0; /* usage counter */
     k = 0;
-    p = data;
+    p = new_data;
     if (w <= 8) {
 	for (i = 0; i < op->charcount; i++) {
 	    for (j = 0; j < h; j++) {
-	        c = *p++;
+	        c = *data++;
 		k += c;
-		new_data[i*h+j] = c;
+		*p++ = c;
 	    }
-	    p += 32 - h;
+	    data += 32 - h;
 	}
     }
 #ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
     else if (w <= 16) {
 	for (i = 0; i < op->charcount; i++) {
 	    for (j = 0; j < h; j++) {
-	        d = (p[0] << 8) | p[1];
-	        p += 2;
+	        d = (data[0] << 8) | data[1];
+	        data += 2;
 		k += d;
-		((u16 *)new_data)[i*h+j] = d;
+		*(u16 *)p = d;
+		p += sizeof(u16);
 	    }
-	    p += 2*(32 - h);
+	    data += 2*(32 - h);
 	}
     } else {
 	for (i = 0; i < op->charcount; i++) {
 	    for (j = 0; j < h; j++) {
 	    	if (w <= 24) {
-		    d = (p[0] << 24) | 
-			(p[1] << 16) | 
-			(p[2] << 8);
-		    p += 3;
+		    d = (data[0] << 24) | 
+			(data[1] << 16) | 
+			(data[2] << 8);
+		    data += 3;
 		} else {
-		    d = (p[0] << 24) | 
-			(p[1] << 16) | 
-			(p[2] << 8) |
-			p[3];
-		    p += 4;
+		    d = (data[0] << 24) | 
+			(data[1] << 16) | 
+			(data[2] << 8) |
+			data[3];
+		    data += 4;
 		}
 		k += d;
-		((u32 *)new_data)[i*h+j] = d;
+		*(u32 *)p = d;
+		p += sizeof(u32);
 	    }
 	    if (w <= 24)
-	    	p += 3*(32 - h);
+		data += 3*(32 - h);
 	    else
-	        p += 4*(32 - h);
+		data += 4*(32 - h);
 	}
     }
 #endif
@@ -1389,7 +1441,7 @@
     	    FNTSUM(fb_display[i].fontdata) == k &&
     	    FNTSIZE(fb_display[i].fontdata) == size &&
 	    !memcmp(fb_display[i].fontdata, new_data, size)) {
-	    kfree(new_data - 4*sizeof(int));
+	    kfree(new_data - FONT_EXTRA_WORDS*sizeof(int));
 	    new_data = fb_display[i].fontdata;
 	    break;
     	}
@@ -1509,13 +1561,18 @@
     else if (offset >= limit)
 	offset -= limit;
     p->var.xoffset = 0;
-    p->var.yoffset = offset*p->fontheight;
+    p->var.yoffset = offset*fontheight(p);
     p->fb_info->updatevar(unit, p->fb_info);
     if (!offset)
 	fbcon_cursor(conp, CM_DRAW);
     return 0;
 }
 
+static inline unsigned safe_shift(unsigned d,int n)
+{
+    return n<0 ? d>>-n : d<<n;
+}
+
 __initfunc(static int fbcon_show_logo( void ))
 {
     struct display *p = &fb_display[fg_console]; /* draw to vt in foreground */
@@ -1532,10 +1589,10 @@
 	return 0;
 
     /* Set colors if visual is PSEUDOCOLOR and we have enough colors, or for
-     * TRUECOLOR */
+     * DIRECTCOLOR */
     if ((p->visual == FB_VISUAL_PSEUDOCOLOR && depth >= 4) ||
-	p->visual == FB_VISUAL_TRUECOLOR) {
-	int is_truecolor = (p->visual == FB_VISUAL_TRUECOLOR);
+	p->visual == FB_VISUAL_DIRECTCOLOR) {
+	int is_truecolor = (p->visual == FB_VISUAL_DIRECTCOLOR);
 	int use_256 = (!is_truecolor && depth >= 8) ||
 		      (is_truecolor && depth >= 24);
 	int first_col = use_256 ? 32 : depth > 4 ? 16 : 0;
@@ -1588,7 +1645,7 @@
     	 
 #if defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || \
     defined(CONFIG_FBCON_CFB32) || defined(CONFIG_FB_SBUS)
-        if (p->visual == FB_VISUAL_TRUECOLOR) {
+        if (p->visual == FB_VISUAL_DIRECTCOLOR) {
 	    unsigned int val;		/* max. depth 32! */
 	    int bdepth;
 	    int redshift, greenshift, blueshift;
@@ -1629,13 +1686,21 @@
 			val = (pix << redshift) |
 			      (pix << greenshift) |
 			      (pix << blueshift);
+#ifdef __LITTLE_ENDIAN
 			for( i = 0; i < bdepth; ++i )
+#else
+			for( i = bdepth-1; i >= 0; --i )
+#endif
 			    *dst++ = val >> (i*8);
 			pix = (*src & 0x0f) | 0x10; /* lower nibble */
 			val = (pix << redshift) |
 			      (pix << greenshift) |
 			      (pix << blueshift);
+#ifdef __LITTLE_ENDIAN
+			for( i = 0; i < bdepth; ++i )
+#else
 			for( i = bdepth-1; i >= 0; --i )
+#endif
 			    *dst++ = val >> (i*8);
 		    }
 		}
@@ -1645,7 +1710,7 @@
 #endif
 #if defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || \
     defined(CONFIG_FBCON_CFB32) || defined(CONFIG_FB_SBUS)
-	if ((depth % 8 == 0) && (p->visual == FB_VISUAL_DIRECTCOLOR)) {
+	if ((depth % 8 == 0) && (p->visual == FB_VISUAL_TRUECOLOR)) {
 	    /* Modes without color mapping, needs special data transformation... */
 	    unsigned int val;		/* max. depth 32! */
 	    int bdepth = depth/8;
@@ -1665,9 +1730,9 @@
 	    for( y1 = 0; y1 < LOGO_H; y1++ ) {
 		dst = fb + y1*line + x*bdepth;
 		for( x1 = 0; x1 < LOGO_W; x1++, src++ ) {
-		    val = ((linux_logo_red[*src-32]   & redmask)   << redshift) |
-		          ((linux_logo_green[*src-32] & greenmask) << greenshift) |
-		          ((linux_logo_blue[*src-32]  & bluemask)  << blueshift);
+		    val = safe_shift((linux_logo_red[*src-32]   & redmask), redshift) |
+		          safe_shift((linux_logo_green[*src-32] & greenmask), greenshift) |
+		          safe_shift((linux_logo_blue[*src-32]  & bluemask), blueshift);
 #ifdef __LITTLE_ENDIAN
 		    for( i = 0; i < bdepth; ++i )
 #else
@@ -1766,7 +1831,7 @@
     /* Modes not yet supported: packed pixels with depth != 8 (does such a
      * thing exist in reality?) */
 
-    return done ? (LOGO_H + p->fontheight - 1) / p->fontheight : 0 ;
+    return done ? (LOGO_H + fontheight(p) - 1) / fontheight(p) : 0 ;
 }
 
 /*
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbcon.h m68k/drivers/video/fbcon.h
--- jes-2.1.115/drivers/video/fbcon.h	Sun Aug  9 21:48:31 1998
+++ m68k/drivers/video/fbcon.h	Wed Aug 12 09:29:45 1998
@@ -23,6 +23,7 @@
     void (*setup)(struct display *p);
     void (*bmove)(struct display *p, int sy, int sx, int dy, int dx,
 		  int height, int width);
+    /* for clear, conp may be NULL, which means use a blanking (black) color */
     void (*clear)(struct vc_data *conp, struct display *p, int sy, int sx,
 		  int height, int width);
     void (*putc)(struct vc_data *conp, struct display *p, int c, int yy,
@@ -36,6 +37,9 @@
     unsigned int fontwidthmask;      /* 1 at (1 << (width - 1)) if width is supported */
 }; 
 
+#define fontheight(p) ((p)->_fontheight)
+#define fontheightlog(p) ((p)->_fontheightlog)
+
 #ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
 
 /* fontwidth w is supported by dispsw */
@@ -43,6 +47,9 @@
 /* fontwidths w1-w2 inclusive are supported by dispsw */
 #define FONTWIDTHRANGE(w1,w2)	FONTWIDTH(8)
 
+#define fontwidth(p) (8)
+#define fontwidthlog(p) (0)
+
 #else
 
 /* fontwidth w is supported by dispsw */
@@ -50,6 +57,9 @@
 /* fontwidths w1-w2 inclusive are supported by dispsw */
 #define FONTWIDTHRANGE(w1,w2)	(FONTWIDTH(w2+1) - FONTWIDTH(w1))
 
+#define fontwidth(p) ((p)->_fontwidth)
+#define fontwidthlog(p) ((p)->_fontwidthlog)
+
 #endif
 
     /*
@@ -62,7 +72,7 @@
 #define attr_bgcol(p,s)    \
 	(((s) >> ((p)->bgshift)) & 0x0f)
 #define	attr_bgcol_ec(p,conp) \
-	(((conp)->vc_video_erase_char >> ((p)->bgshift)) & 0x0f)
+	((conp) ? (((conp)->vc_video_erase_char >> ((p)->bgshift)) & 0x0f) : 0)
 
 /* Monochrome */
 #define attr_bold(p,s) \
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/fbgen.c m68k/drivers/video/fbgen.c
--- jes-2.1.115/drivers/video/fbgen.c	Sun Aug  9 21:48:31 1998
+++ m68k/drivers/video/fbgen.c	Wed Aug 12 09:29:47 1998
@@ -114,8 +114,7 @@
     struct fbgen_hwswitch *fbhw = info2->fbhw;
 
     if (con == currcon)			/* current console ? */
-	return fb_get_cmap(cmap, &fb_display[con].var, kspc, fbhw->getcolreg,
-			   info);
+	return fb_get_cmap(cmap, kspc, fbhw->getcolreg, info);
     else
 	if (fb_display[con].cmap.len)	/* non default colormap ? */
 	    fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
@@ -144,8 +143,7 @@
 	    return err;
     }
     if (con == currcon)			/* current console ? */
-	return fb_set_cmap(cmap, &fb_display[con].var, kspc, fbhw->setcolreg,
-			   info);
+	return fb_set_cmap(cmap, kspc, fbhw->setcolreg, info);
     else
 	fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
     return 0;
@@ -276,12 +274,10 @@
     if (con != currcon)
 	return;
     if (fb_display[con].cmap.len)
-	fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-		    fbhw->setcolreg, &info->info);
+	fb_set_cmap(&fb_display[con].cmap, 1, fbhw->setcolreg, &info->info);
     else {
 	int size = fb_display[con].var.bits_per_pixel == 16 ? 64 : 256;
-	fb_set_cmap(fb_default_cmap(size), &fb_display[con].var, 1,
-		    fbhw->setcolreg, &info->info);
+	fb_set_cmap(fb_default_cmap(size), 1, fbhw->setcolreg, &info->info);
     }
 }
 
@@ -315,8 +311,8 @@
 
     /* Do we have to save the colormap ? */
     if (fb_display[currcon].cmap.len)
-	fb_get_cmap(&fb_display[currcon].cmap, &fb_display[currcon].var, 1,
-		    fbhw->getcolreg, &info2->info);
+	fb_get_cmap(&fb_display[currcon].cmap, 1, fbhw->getcolreg,
+		    &info2->info);
     fbgen_do_set_var(&fb_display[con].var, 1, info2);
     currcon = con;
     /* Install new colormap */
@@ -346,7 +342,7 @@
 	cmap.transp = NULL;
 	cmap.start = 0;
 	cmap.len = 16;
-	fb_set_cmap(&cmap, &fb_display[currcon].var, 1, fbhw->setcolreg, info);
+	fb_set_cmap(&cmap, 1, fbhw->setcolreg, info);
     } else
 	fbgen_install_cmap(currcon, info2);
 }
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/font_acorn_8x8.c m68k/drivers/video/font_acorn_8x8.c
--- jes-2.1.115/drivers/video/font_acorn_8x8.c	Sun Aug  9 21:48:32 1998
+++ m68k/drivers/video/font_acorn_8x8.c	Mon Aug  3 19:48:56 1998
@@ -1,5 +1,7 @@
 /* Acorn-like font definition, with PC graphics characters */
 
+#include <linux/config.h>
+
 #include "font.h"
 
 static unsigned char acorndata_8x8[] = {
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/imsttfb.c m68k/drivers/video/imsttfb.c
--- jes-2.1.115/drivers/video/imsttfb.c	Thu Jan  1 01:00:00 1970
+++ m68k/drivers/video/imsttfb.c	Wed Aug 12 09:29:49 1998
@@ -0,0 +1,1031 @@
+/*
+ *  drivers/video/imsttfb.c -- frame buffer device for IMS Twin Turbo
+ *
+ *  This file is derived from the powermac console "imstt" driver:
+ *  Copyright (C) 1997 Sigurdur Asgeirsson
+ *  With additional hacking by Jeffrey Kuskin (jsk@mojave.stanford.edu)
+ *
+ *  most of the frame buffer device stuff was copied from atyfb.c
+ *
+ *  This file is subject to the terms and conditions of the GNU General Public
+ *  License. See the file COPYING in the main directory of this archive for
+ *  more details.
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/tty.h>
+#include <linux/malloc.h>
+#include <linux/vmalloc.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/fb.h>
+#include <linux/selection.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <asm/io.h>
+#include <asm/uaccess.h>
+
+#if defined(CONFIG_PMAC) || defined(CONFIG_CHRP)
+#include <linux/nvram.h>
+#include <asm/prom.h>
+#include <asm/pci-bridge.h>
+#include "macmodes.h"
+#endif
+
+#include "fbcon.h"
+#include "fbcon-cfb8.h"
+#include "fbcon-cfb16.h"
+#include "fbcon-cfb24.h"
+#include "fbcon-cfb32.h"
+
+#ifdef CONFIG_FB_COMPAT_XPMAC
+#include <asm/vc_ioctl.h>
+
+extern struct vc_mode display_info;
+extern struct fb_info *console_fb_info;
+
+void
+set_display_info (struct display *disp)
+{
+	display_info.width = disp->var.xres;
+	display_info.height = disp->var.yres;
+	display_info.depth = disp->var.bits_per_pixel;
+	display_info.pitch = disp->var.xres * (disp->var.bits_per_pixel / 8);
+	switch (disp->var.xres) {
+		case 640:
+			display_info.mode = 6;
+			break;
+		case 832:
+			display_info.mode = 13;
+			break;
+		case 1024:
+			display_info.mode = 17;
+			break;
+		case 1152:
+			display_info.mode = 18;
+			break;
+		case 1280:
+			display_info.mode = disp->var.yres == 960 ? 19 : 20;
+			break;
+		default:
+			display_info.mode = 0;
+	}
+}
+#endif
+
+enum {
+	PADDRW	= 0x00,
+	PDATA	= 0x04,
+	PPMASK	= 0x08,
+	PADDRR	= 0x0C,
+	PIDXLO	= 0x10,	
+	PIDXHI	= 0x14,	
+	PIDXDATA= 0x18,
+	PIDXCTL	= 0x1C,
+
+	PPIXREP	= 0x0A,
+	PM0	= 0x20,
+	PN0	= 0x21,
+	PP0	= 0x22,
+	PC0	= 0x23,
+	MCTL_3	= 0x72
+};
+
+struct initvalues {
+	__u8 addr, value;
+};
+
+static struct initvalues initregs[] = {
+	{ 0x02, 0x21 },	/* (0x01) Miscellaneous Clock Control */
+	{ 0x03, 0x00 },	/* (0x00) Sync Control */
+	{ 0x04, 0x00 },	/* (0x00) Horizontal Sync Position */
+	{ 0x05, 0x00 },	/* (0x00) Power Management */
+	{ 0x06, 0x03 },	/* (0x02) DAC Operation */
+	{ 0x07, 0x00 },	/* (0x00) Palette Control */
+	{ 0x08, 0x01 },	/* (0x01) System Clock Control */
+
+	/*
+	 * Note that colors in X are correct only if all video data is
+	 * passed through the palette in the DAC.  That is, "indirect
+	 * color" must be configured.  This is the case for the IBM DAC
+	 * used in the 2MB and 4MB cards, at least.
+	 */
+	{ 0x0B, 0x00 },	/* (U) 8 BPP Control */
+	{ 0x0C, 0x01 },	/* (U) 16 BPP Control; the "1" means use 555 RGB color encoding */
+	{ 0x0D, 0x00 },	/* (U) 24 BPP Packed Control */
+	{ 0x0E, 0x00 },	/* (U) 32 BPP Control */
+
+	{ 0x10, 0x05 },	/* (0x00) Pixel PLL Control 1 */
+	{ 0x11, 0x00 },	/* (0x00) Pixel PLL Control 2 */
+	{ 0x15, 0x08 },	/* (0x08) SYSCLK N (System PLL Reference Divider) */
+	{ 0x16, 0x4f },	/* (0x41) SYSCLK M (System PLL VCO Divider) */
+	{ 0x17, 0x00 },	/* (U) SYSCLK P */
+	{ 0x18, 0x00 },	/* (U) SYSCLK C */
+	{ 0x30, 0x00 },	/* (0x00) Cursor Control */
+	{ 0x60, 0xFF },	/* (U) Border Color Red */
+	{ 0x61, 0xFF },	/* (U) Border Color Green */
+	{ 0x62, 0xFF },	/* (U) Border Color Blue */
+	{ 0x70, 0x01 },	/* (0x00) Miscellaneous Control 1 */
+	{ 0x71, 0x45 },	/* (0x00) Miscellaneous Control 2 */
+	{ 0x72, 0x00 },	/* (0x00) Miscellaneous Control 3 */
+	{ 0x78, 0x00 },	/* (0x00) Key Control/DB Operation */
+};
+
+enum {
+	S1SA	=  0, /* 0x00 */
+	S2SA	=  1, /* 0x04 */
+	SP	=  2, /* 0x08 */
+	DSA	=  3, /* 0x0C */
+	CNT	=  4, /* 0x10 */
+	DP_OCTRL=  5, /* 0x14 */
+	BI	=  8, /* 0x20 */
+	MBC	=  9, /* 0x24 */
+	BLTCTL	= 10, /* 0x28 */
+
+	/* Scan Timing Generator Registers */
+	HES	= 12, /* 0x30 */
+	HEB	= 13, /* 0x34 */
+	HSB	= 14, /* 0x38 */
+	HT	= 15, /* 0x3C */
+	VES	= 16, /* 0x40 */
+	VEB	= 17, /* 0x44 */
+	VSB	= 18, /* 0x48 */
+	VT	= 19, /* 0x4C */
+	HCIV	= 20, /* 0x50 */
+	VCIV	= 21, /* 0x54 */
+	TCDR	= 22, /* 0x58 */
+	VIL	= 23, /* 0x5C */
+	STGCTL	= 24, /* 0x60 */
+
+	/* Screen Refresh Generator Registers */
+	SSR	= 25, /* 0x64 */
+	HRIR	= 26, /* 0x68 */
+	SPR	= 27, /* 0x6C */
+	CMR	= 28, /* 0x70 */
+	SRGCTL	= 29, /* 0x74 */
+
+	/* RAM Refresh Generator Registers */
+	RRCIV	= 30, /* 0x78 */
+	RRSC	= 31, /* 0x7C */
+	RRCR	= 34, /* 0x88 */
+
+	/* System Registers */
+	GIOE	= 32, /* 0x80 */
+	GIO	= 33, /* 0x84 */
+	SCR	= 35, /* 0x8C */
+	SSTATUS	= 36, /* 0x90 */
+	PRC	= 37, /* 0x94 */
+
+#if 0	
+	/* PCI Registers */
+	DVID	= 0x00000000L,
+	SC	= 0x00000004L,
+	CCR	= 0x00000008L,
+	OG	= 0x0000000CL,
+	BARM	= 0x00000010L,
+	BARER	= 0x00000030L,
+#endif
+};
+
+#define USE_NV_VMODE
+#define INIT_BPP	8
+#define INIT_XRES	640
+#define INIT_YRES	480
+#define MAX_XRES	1600
+#define MAX_YRES	1200
+
+/*
+ * Dot clock rate is 20MHz * (m + 1) / ((n + 1) * (p ? 2 * p : 1)
+ * where m = clk[0], n = clk[1], p = clk[2]
+ * clk[3] is c, charge pump bias which depends on the VCO frequency  
+ */
+struct imstt_regvals {
+	__u16 cfg[9];
+	__u8 clk[4];
+	__u32 pitch;
+};
+
+/* 1600x1200, 75Hz */
+static struct imstt_regvals imstt_reg_init_1600x1200x75 = {
+	{ 0x0018, 0x0040, 0x0108, 0x010c, 0x0003, 0x002a, 0x04da, 0x04dd, 0x04da },
+	{ 0x09, 0x00, 0x00, 0x02 },
+	1600
+};
+
+/* 1280x1024, 75Hz (20) */
+static struct imstt_regvals imstt_reg_init_20 = {
+	{ 0x0012, 0x002f, 0x00cf, 0x00d3, 0x0003, 0x0029, 0x0429, 0x042a, 0x0429 },
+	{ 0x1a, 0x03, 0x00, 0x02 },
+	1280
+};
+
+/* 1280x960, 75Hz (19) */
+static struct imstt_regvals imstt_reg_init_19 = {
+	{ 0x0012, 0x0030, 0x00d0, 0x00d2, 0x0003, 0x0027, 0x03e7, 0x03e8, 0x03e7 },
+	{ 0x3e, 0x09, 0x00, 0x02 },
+	1280
+};
+
+/* 1152x870, 75Hz (18) */
+static struct imstt_regvals imstt_reg_init_18 = {
+	{ 0x0012, 0x0022, 0x00b2, 0x00b6, 0x0003, 0x0031, 0x0397, 0x039a, 0x0397 }, 
+	{ 0x3c, 0x0b, 0x00, 0x02 },
+	1152
+};
+
+/* 1024x768, 75Hz (17) */
+#if 1
+static struct imstt_regvals imstt_reg_init_17 = {
+	{ 0x000a, 0x001c, 0x009c, 0x00a6, 0x0003, 0x0020, 0x0320, 0x0323, 0x0320 }, 
+	{ 0x07, 0x00, 0x01, 0x02 },
+	1024
+};
+#else
+/* this almost works with a 14" apple multiple scan monitor */
+static struct imstt_regvals imstt_reg_init_17 = {
+	{ 0x000a, 0x001d, 0x009c, 0x00ac, 0x0003, 0x0020, 0x0320, 0x0323, 0x0320 }, 
+	{ 0x3e, 0x0a, 0x01, 0x02 },
+	1024
+};
+#endif
+
+/* 832x624, 75Hz (13) */
+static struct imstt_regvals imstt_reg_init_13 = {
+	{ 0x0005, 0x0020, 0x0088, 0x0090, 0x0003, 0x0028, 0x0298, 0x029b, 0x0298 },
+	{ 0x3e, 0x0a, 0x01, 0x02 },
+	832
+};
+
+/* 640x480, 67Hz (6) */
+static struct imstt_regvals imstt_reg_init_6 = {
+	{ 0x0008, 0x0012, 0x0062, 0x006c, 0x0003, 0x002a, 0x020a, 0x020c, 0x020a },
+	{ 0x78, 0x13, 0x02, 0x02 },
+	640
+};
+
+static struct imstt_regvals *
+compute_imstt_regvals (int xres, int yres)
+{
+	struct imstt_regvals *init;
+
+	switch (xres) {
+		case 640:
+			init = &imstt_reg_init_6;
+			break;
+		case 832:
+			init = &imstt_reg_init_13;
+			break;
+		case 1024:
+			init = &imstt_reg_init_17;
+			break;
+		case 1152:
+			init = &imstt_reg_init_18;
+			break;
+		case 1280:
+			init = yres == 960 ? &imstt_reg_init_19 : &imstt_reg_init_20;
+			break;
+		case 1600:
+			init = &imstt_reg_init_1600x1200x75;
+			break;
+		default:
+			init = 0;
+			break;
+	}
+
+#if 0
+	init->cfg[2] = init->cfg[1] + (xres / 8);
+	init->cfg[3] = init->cfg[2] + 8;	// +8 for 13, +4 for 18, +10 for others
+	init->cfg[4] = 0x0003;
+	init->cfg[7] = init->cfg[6] + 3;
+	init->cfg[8] = init->cfg[6];
+	
+	init->clk[3] = 0x02;
+
+	init->pitch = xres;
+#endif
+
+	return init;
+}
+
+struct fb_info_imstt {
+	struct fb_info info;
+	struct fb_fix_screeninfo fix;
+	struct fb_var_screeninfo var;
+	struct display disp;
+	struct {
+		__u8 red, green, blue;
+	} palette[256];
+	__u8 *frame_buffer_phys, *frame_buffer;
+	__u32 *dc_regs_phys, *dc_regs;
+	__u8 *cmap_regs_phys, *cmap_regs;
+	__u32 total_vram;
+};
+
+static int currcon = 0;
+
+static void set_imstt_regvals (struct fb_info_imstt *p, struct imstt_regvals *init, int bpp);
+
+static int
+imsttfb_getcolreg (u_int regno, u_int *red, u_int *green,
+		   u_int *blue, u_int *transp, struct fb_info *info)
+{
+	struct fb_info_imstt *p = (struct fb_info_imstt *)info;
+
+	if (regno > 255)
+		return 1;
+	*red = (p->palette[regno].red<<8) | p->palette[regno].red;
+	*green = (p->palette[regno].green<<8) | p->palette[regno].green;
+	*blue = (p->palette[regno].blue<<8) | p->palette[regno].blue;
+	*transp = 0;
+	return 0;
+}
+
+static int
+imsttfb_setcolreg (u_int regno, u_int red, u_int green, u_int blue,
+		   u_int transp, struct fb_info *info)
+{
+	struct fb_info_imstt *p = (struct fb_info_imstt *)info;
+	int i;
+
+	if (regno > 255)
+		return 1;
+
+	red >>= 8;
+	green >>= 8;
+	blue >>= 8;
+
+	p->palette[regno].red = red;
+	p->palette[regno].green = green;
+	p->palette[regno].blue = blue;
+
+	if (fb_display[currcon].var.bits_per_pixel == 16) {
+		p->cmap_regs[PADDRW] = regno << 3;	eieio();
+		p->cmap_regs[PDATA] = red;		eieio();
+		p->cmap_regs[PDATA] = green;		eieio();
+		p->cmap_regs[PDATA] = blue;		eieio();
+	} else {
+		p->cmap_regs[PADDRW] = regno;	eieio();
+		p->cmap_regs[PDATA] = red;	eieio();
+		p->cmap_regs[PDATA] = green;	eieio();
+		p->cmap_regs[PDATA] = blue;	eieio();
+	}
+
+	if (regno < 16)
+		switch (fb_display[currcon].var.bits_per_pixel) {
+#ifdef FBCON_HAS_CFB16
+			case 16:
+				fbcon_cfb16_cmap[regno] = (regno << 10) | (regno << 5) | regno;
+				break;
+#endif
+#ifdef FBCON_HAS_CFB24
+			case 24:
+				fbcon_cfb24_cmap[regno] = (regno << 16) | (regno << 8) | regno;
+				break;
+#endif
+#ifdef FBCON_HAS_CFB32
+			case 32:
+				i = (regno << 8) | regno;
+				fbcon_cfb32_cmap[regno] = (i << 16) | i;
+				break;
+#endif
+		}
+
+	return 0;
+}
+
+static void
+do_install_cmap (int con, struct fb_info *info)
+{
+	if (con != currcon)
+		return;
+	if (fb_display[con].cmap.len)
+		fb_set_cmap(&fb_display[con].cmap, 1, imsttfb_setcolreg, info);
+	else {
+		int size = fb_display[con].var.bits_per_pixel == 16 ? 32 : 256;
+		fb_set_cmap(fb_default_cmap(size), 1, imsttfb_setcolreg, info);
+	}
+}
+
+static int
+imsttfb_open (struct fb_info *info, int user)
+{
+	MOD_INC_USE_COUNT;
+	return 0;
+}
+
+static int
+imsttfb_release (struct fb_info *info, int user)
+{
+	MOD_DEC_USE_COUNT;
+	return 0;
+}
+
+static int
+imsttfb_get_fix (struct fb_fix_screeninfo *fix, int con, struct fb_info *info)
+{
+	struct fb_info_imstt *p = (struct fb_info_imstt *)info;
+
+	*fix = p->fix;
+	if (con >= 0) {
+		struct fb_var_screeninfo *var = &fb_display[con].var;
+		fix->visual = var->bits_per_pixel == 8 ? FB_VISUAL_PSEUDOCOLOR
+						       : FB_VISUAL_TRUECOLOR;
+		fix->line_length = var->xres * (var->bits_per_pixel / 8);
+	}
+
+	return 0;
+}
+
+static int
+imsttfb_get_var (struct fb_var_screeninfo *var, int con, struct fb_info *info)
+{
+	struct fb_info_imstt *p = (struct fb_info_imstt *)info;
+
+	*var = con >= 0 ? fb_display[con].var : p->disp.var;
+
+	return 0;
+}
+
+static int
+imsttfb_set_var (struct fb_var_screeninfo *var, int con, struct fb_info *info)
+{
+	struct fb_info_imstt *p = (struct fb_info_imstt *)info;
+	struct display *disp;
+	int oldbpp, oldxres;
+	struct imstt_regvals *init;
+
+	disp = con >= 0 ? &fb_display[con] : &p->disp;
+
+	if (var->xres > MAX_XRES || var->yres > MAX_YRES
+	    || var->xres_virtual > MAX_XRES || var->yres_virtual > MAX_YRES
+	    || (var->bits_per_pixel != 8 && var->bits_per_pixel != 16
+	        && var->bits_per_pixel != 24 && var->bits_per_pixel != 32)
+	    || var->nonstd
+	    || (var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED)
+		return -EINVAL;
+
+	if ((var->xres * var->yres) * (var->bits_per_pixel / 8) > p->total_vram)
+		return -EINVAL;
+
+	if (!((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW))
+		return 0;
+
+	init = compute_imstt_regvals(var->xres, var->yres);
+	if (!init)
+		return -EINVAL;
+
+	oldbpp = disp->var.bits_per_pixel;
+	oldxres = disp->var.xres;
+
+	disp->var = *var;
+
+	disp->var.xres_virtual = disp->var.xres;
+	disp->var.yres_virtual = disp->var.yres;
+	disp->var.activate = 0;
+	disp->var.red.msb_right = 0;
+	disp->var.green.msb_right = 0;
+	disp->var.blue.msb_right = 0;
+	disp->var.transp.msb_right = 0;
+	disp->var.height = -1;
+	disp->var.width = -1;
+	disp->var.vmode = FB_VMODE_NONINTERLACED;
+	disp->var.pixclock = 10000;
+	disp->var.left_margin = p->var.right_margin = 16;
+	disp->var.upper_margin = p->var.lower_margin = 16;
+	disp->var.hsync_len = p->var.vsync_len = 8;
+
+	disp->screen_base = p->frame_buffer;
+	disp->inverse = 0;
+	disp->scrollmode = SCROLL_YREDRAW;
+
+	if (oldxres != disp->var.xres || oldbpp != disp->var.bits_per_pixel)
+		disp->line_length = disp->var.xres * (disp->var.bits_per_pixel / 8);
+
+	if (oldbpp != disp->var.bits_per_pixel) {
+		disp->visual = disp->var.bits_per_pixel == 8 ? FB_VISUAL_PSEUDOCOLOR
+						 	     : FB_VISUAL_TRUECOLOR;
+		disp->dispsw = 0;
+		switch (disp->var.bits_per_pixel) {
+			case 8:
+				disp->var.red.offset = 0;
+				disp->var.red.length = 8;
+				disp->var.green.offset = 0;
+				disp->var.green.length = 8;
+				disp->var.blue.offset = 0;
+				disp->var.blue.length = 8;
+				disp->var.transp.offset = 0;
+				disp->var.transp.length = 0;
+#ifdef FBCON_HAS_CFB8
+				disp->dispsw = &fbcon_cfb8;
+#endif
+				break;
+			case 16:	/* RGB 555 */
+				disp->var.red.offset = 10;
+				disp->var.red.length = 5;
+				disp->var.green.offset = 5;
+				disp->var.green.length = 5;
+				disp->var.blue.offset = 0;
+				disp->var.blue.length = 5;
+				disp->var.transp.offset = 0;
+				disp->var.transp.length = 0;
+#ifdef FBCON_HAS_CFB16
+				disp->dispsw = &fbcon_cfb16;
+#endif
+				break;
+			case 24:	/* RGB 888 */
+				disp->var.red.offset = 16;
+				disp->var.red.length = 8;
+				disp->var.green.offset = 8;
+				disp->var.green.length = 8;
+				disp->var.blue.offset = 0;
+				disp->var.blue.length = 8;
+				disp->var.transp.offset = 0;
+				disp->var.transp.length = 0;
+#ifdef FBCON_HAS_CFB24
+				disp->dispsw = &fbcon_cfb24;
+#endif
+				break;
+			case 32:	/* RGBA 8888 */
+				disp->var.red.offset = 16;
+				disp->var.red.length = 8;
+				disp->var.green.offset = 8;
+				disp->var.green.length = 8;
+				disp->var.blue.offset = 0;
+				disp->var.blue.length = 8;
+				disp->var.transp.offset = 24;
+				disp->var.transp.length = 8;
+#ifdef FBCON_HAS_CFB32
+				disp->dispsw = &fbcon_cfb32;
+#endif
+				break;
+		}
+	}
+
+	if (info->changevar)
+		(*info->changevar)(con);
+
+#ifdef CONFIG_FB_COMPAT_XPMAC
+	set_display_info(disp);
+#endif
+
+	if (con == currcon && (oldxres != disp->var.xres || oldbpp != disp->var.bits_per_pixel))
+		set_imstt_regvals(p, init, disp->var.bits_per_pixel);
+
+	if (oldbpp != disp->var.bits_per_pixel) {
+		fb_alloc_cmap(&disp->cmap, 0, 0);
+		fb_set_cmap(&disp->cmap, 1, imsttfb_setcolreg, info);
+	}
+
+	return 0;
+}
+
+static int
+imsttfb_pan_display (struct fb_var_screeninfo *var, int con, struct fb_info *info)
+{
+	if (var->xoffset != 0 || var->yoffset != 0)
+		return -EINVAL;
+
+	return 0;
+}
+
+static int
+imsttfb_get_cmap (struct fb_cmap *cmap, int kspc, int con, struct fb_info *info)
+{
+	if (con == currcon)	/* current console? */
+		return fb_get_cmap(cmap, kspc, imsttfb_getcolreg, info);
+	else if (fb_display[con].cmap.len)	/* non default colormap? */
+		fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
+	else {
+		int size = fb_display[con].var.bits_per_pixel == 16 ? 32 : 256;
+		fb_copy_cmap(fb_default_cmap(size), cmap, kspc ? 0 : 2);
+	}
+
+	return 0;
+}
+
+static int
+imsttfb_set_cmap (struct fb_cmap *cmap, int kspc, int con, struct fb_info *info)
+{
+	int err;
+
+	if (!fb_display[con].cmap.len) {	/* no colormap allocated? */
+		int size = fb_display[con].var.bits_per_pixel == 16 ? 32 : 256;
+		if ((err = fb_alloc_cmap(&fb_display[con].cmap, size, 0)))
+			return err;
+	}
+	if (con == currcon)			/* current console? */
+		return fb_set_cmap(cmap, kspc, imsttfb_setcolreg, info);
+	else
+		fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
+
+	return 0;
+}
+
+static int
+imsttfb_ioctl (struct inode *inode, struct file *file, u_int cmd,
+	       u_long arg, int con, struct fb_info *info)
+{
+	int r;
+
+	switch (cmd) {
+		case 31337:
+			r = verify_area(VERIFY_WRITE, (void *)arg,
+					sizeof(struct imstt_regvals));
+			if (!r)
+				r = copy_to_user((void *)arg, &imstt_reg_init_17,
+						 sizeof(struct imstt_regvals));
+			break;
+		case 31338:
+			r = verify_area(VERIFY_READ, (void *)arg,
+					sizeof(struct imstt_regvals));
+			if (!r)
+				r = copy_from_user(&imstt_reg_init_17,
+						   (void *)arg, sizeof(struct imstt_regvals));
+			break;
+		default:
+			r = -ENOIOCTLCMD;
+			break;
+	}
+
+	return r;
+}
+
+static struct fb_ops imsttfb_ops = {
+	imsttfb_open,
+	imsttfb_release,
+	imsttfb_get_fix,
+	imsttfb_get_var,
+	imsttfb_set_var,
+	imsttfb_get_cmap,
+	imsttfb_set_cmap,
+	imsttfb_pan_display,
+	imsttfb_ioctl
+};
+
+static int
+imsttfb_switch (int con, struct fb_info *info)
+{
+	struct display *old = &fb_display[currcon], *new = &fb_display[con];
+
+	if (old->cmap.len)
+		fb_get_cmap(&old->cmap, 1, imsttfb_getcolreg, info);
+	currcon = con;
+	if (old->var.xres != new->var.xres
+	    || old->var.yres != new->var.yres
+	    || old->var.bits_per_pixel != new->var.bits_per_pixel) {
+		struct imstt_regvals *init = compute_imstt_regvals(new->var.xres, new->var.yres);
+		if (!init) /* ?!? */ return 0;
+		set_imstt_regvals((struct fb_info_imstt *)info, init, new->var.bits_per_pixel);
+#ifdef CONFIG_FB_COMPAT_XPMAC
+		set_display_info(new);
+#endif
+	}
+	do_install_cmap(con, info);
+
+	return 0;
+}
+
+static int
+imsttfb_updatevar (int con, struct fb_info *info)
+{
+	return 0;
+}
+
+static void
+imsttfb_blank (int blank, struct fb_info *info)
+{
+	struct fb_info_imstt *p = (struct fb_info_imstt *)info;
+	long ctrl;
+
+	ctrl = ld_le32(&p->dc_regs[STGCTL]) | 0x0030;
+	if (blank > 0) {
+		switch (blank - 1) {
+			case VESA_VSYNC_SUSPEND:
+				ctrl &= ~0x0020;
+				break;
+			case VESA_HSYNC_SUSPEND:
+				ctrl &= ~0x0010;
+				break;
+			case VESA_NO_BLANKING:
+				break;
+			case VESA_POWERDOWN:
+				break;
+		}
+	}
+	out_le32(&p->dc_regs[STGCTL], ctrl);
+}
+
+static void
+set_imstt_regvals (struct fb_info_imstt *p, struct imstt_regvals *init, int bpp)
+{
+	__u32 ctl, pitch, byteswap, scr;
+	__u8 pformat;
+
+	p->cmap_regs[PIDXHI] = 0;		eieio();
+	p->cmap_regs[PIDXLO] = PM0;		eieio();
+	p->cmap_regs[PIDXDATA] = init->clk[0];	eieio();
+	p->cmap_regs[PIDXLO] = PN0;		eieio();
+	p->cmap_regs[PIDXDATA] = init->clk[1];	eieio();
+	p->cmap_regs[PIDXLO] = PP0;		eieio();
+	p->cmap_regs[PIDXDATA] = init->clk[2];	eieio();
+	p->cmap_regs[PIDXLO] = PC0;		eieio();
+	p->cmap_regs[PIDXDATA] = init->clk[3];	eieio();
+
+  /*
+   * From what I (jsk) can gather poking around with MacsBug,
+   * bits 8 and 9 in the SCR register control endianness
+   * correction (byte swapping).  These bits must be set according
+   * to the color depth as follows:
+   *     Color depth    Bit 9   Bit 8
+   *     ==========     =====   =====
+   *        8bpp          0       0
+   *       16bpp          0       1
+   *       32bpp          1       1
+   */
+	switch (bpp) {
+		case 32:
+			ctl = 0x17b5;
+			pitch = init->pitch;
+			pformat = 0x06;
+			byteswap = 0x3;
+			break;
+		case 24: /* FIXME */
+			ctl = 0x17b5;
+			pitch = (init->pitch * 3) / 4;
+			pformat = 0x05;
+			byteswap = 0x2;
+			break;
+		case 16:
+			ctl = 0x17b3;
+			pitch = init->pitch / 2;
+			pformat = 0x04;
+			byteswap = 0x1;
+			break;
+		case 8:
+		default:
+			ctl = 0x17b1;
+			pitch = init->pitch / 4;
+			pformat = 0x03;
+			byteswap = 0x00;
+			break;
+	}
+
+	out_le32(&p->dc_regs[HES], init->cfg[0]);
+	out_le32(&p->dc_regs[HEB], init->cfg[1]);
+	out_le32(&p->dc_regs[HSB], init->cfg[2]);
+	out_le32(&p->dc_regs[HT], init->cfg[3]);
+	out_le32(&p->dc_regs[VES], init->cfg[4]);
+	out_le32(&p->dc_regs[VEB], init->cfg[5]);
+	out_le32(&p->dc_regs[VSB], init->cfg[6]);
+	out_le32(&p->dc_regs[VT], init->cfg[7]);
+	out_le32(&p->dc_regs[HCIV], 1);
+	out_le32(&p->dc_regs[VCIV], 1);
+	out_le32(&p->dc_regs[TCDR], 4);
+	out_le32(&p->dc_regs[VIL], init->cfg[8]);  /* JSK 0 */
+ 
+	out_le32(&p->dc_regs[SSR], 0);  /* JSK 0 */
+	out_le32(&p->dc_regs[HRIR], 0x0100);
+	out_le32(&p->dc_regs[CMR], 0x00FF);
+	out_le32(&p->dc_regs[SRGCTL], 0x0073);
+
+	if (p->total_vram == 0x000200000)
+		scr = 0x059d | (byteswap << 8);
+	else {
+		pitch /= 2;
+		scr = 0xd0dc | (byteswap << 8);
+	}
+
+	out_le32(&p->dc_regs[SCR], scr);
+	out_le32(&p->dc_regs[SPR], pitch);
+
+	p->cmap_regs[PIDXHI] = 0;		eieio();
+	p->cmap_regs[PIDXLO] = PPIXREP;		eieio();
+	p->cmap_regs[PIDXDATA] = pformat;	eieio();
+	p->cmap_regs[PIDXHI] = 0;		eieio();
+
+	out_le32(&p->dc_regs[STGCTL], ctl);
+}
+
+__initfunc(static void init_imstt(struct fb_info_imstt *p))
+{
+	int i;
+	__u32 tmp;
+	struct imstt_regvals *init;
+
+	tmp = in_le32(&p->dc_regs[SSTATUS]);
+	/* printk("chip version %ld, ", (tmp & 0x0F00) >> 8); */
+
+	tmp = in_le32(&p->dc_regs[PRC]);
+	p->total_vram = (tmp & 0x0004) ? 0x000400000L : 0x000200000L;
+
+	/* initialize the card */
+	tmp = in_le32(&p->dc_regs[STGCTL]);
+	out_le32(&p->dc_regs[STGCTL], tmp & ~0x1);
+
+	p->cmap_regs[PPMASK] = 0xFF;
+	/* set default values for DAC registers */ 
+	p->cmap_regs[PIDXHI] = 0;	eieio();
+	for (i = 0; i < sizeof(initregs) / sizeof(*initregs); i++) {
+		p->cmap_regs[PIDXLO] = initregs[i].addr;	eieio();
+		p->cmap_regs[PIDXDATA] = initregs[i].value;	eieio();
+	}
+#if defined(USE_NV_VMODE) && (defined(CONFIG_PMAC) || defined(CONFIG_CHRP))
+	{
+		int vmode, cmode;
+
+		vmode = nvram_read_byte(NV_VMODE);
+		if (vmode <= 0 || vmode > VMODE_MAX)
+			vmode = VMODE_640_480_67;
+		cmode = nvram_read_byte(NV_CMODE);
+		if (cmode < CMODE_8 || cmode > CMODE_32)
+			cmode = CMODE_8;
+		if (mac_vmode_to_var(vmode, cmode, &p->var)) {
+			p->var.xres = p->var.xres_virtual = INIT_XRES;
+			p->var.yres = p->var.yres_virtual = INIT_YRES;
+			p->var.bits_per_pixel = INIT_BPP;
+		}
+	}
+#else
+	p->var.xres = p->var.xres_virtual = INIT_XRES;
+	p->var.yres = p->var.yres_virtual = INIT_YRES;
+	p->var.bits_per_pixel = INIT_BPP;
+#endif
+	if ((p->var.xres * p->var.yres) * (p->var.bits_per_pixel / 8) > p->total_vram
+	    || !(init = compute_imstt_regvals(p->var.xres, p->var.yres))) {
+		printk("imsttfb: %dx%dx%d not supported\n", p->var.xres, p->var.yres, p->var.bits_per_pixel);
+		kfree(p);
+		return;
+	}
+
+	set_imstt_regvals(p, init, p->var.bits_per_pixel);
+
+	p->var.height = p->var.width = -1;
+	p->var.vmode = FB_VMODE_NONINTERLACED;
+	p->var.pixclock = 10000;
+	p->var.left_margin = p->var.right_margin = 16;
+	p->var.upper_margin = p->var.lower_margin = 16;
+	p->var.hsync_len = p->var.vsync_len = 8;
+	switch (p->var.bits_per_pixel) {
+		case 8:
+			p->var.red.offset = 0;
+			p->var.red.length = 8;
+			p->var.green.offset = 0;
+			p->var.green.length = 8;
+			p->var.blue.offset = 0;
+			p->var.blue.length = 8;
+			p->var.transp.offset = 0;
+			p->var.transp.length = 0;
+			break;
+		case 16:	/* RGB 555 */
+			p->var.red.offset = 10;
+			p->var.red.length = 5;
+			p->var.green.offset = 5;
+			p->var.green.length = 5;
+			p->var.blue.offset = 0;
+			p->var.blue.length = 5;
+			p->var.transp.offset = 0;
+			p->var.transp.length = 0;
+			break;
+		case 24:	/* RGB 888 */
+			p->var.red.offset = 16;
+			p->var.red.length = 8;
+			p->var.green.offset = 8;
+			p->var.green.length = 8;
+			p->var.blue.offset = 0;
+			p->var.blue.length = 8;
+			p->var.transp.offset = 0;
+			p->var.transp.length = 0;
+			break;
+		case 32:	/* RGBA 8888 */
+			p->var.red.offset = 16;
+			p->var.red.length = 8;
+			p->var.green.offset = 8;
+			p->var.green.length = 8;
+			p->var.blue.offset = 0;
+			p->var.blue.length = 8;
+			p->var.transp.offset = 24;
+			p->var.transp.length = 8;
+			break;
+	}
+
+	strcpy(p->fix.id, "IMS Twin Turbo");
+	p->fix.smem_start = (__u8 *)p->frame_buffer_phys;
+	p->fix.smem_len = p->total_vram;
+	p->fix.mmio_start = (__u8 *)p->dc_regs_phys;
+	p->fix.mmio_len = 0x40000;
+	p->fix.type = FB_TYPE_PACKED_PIXELS;
+	p->fix.visual = p->var.bits_per_pixel == 8 ? FB_VISUAL_PSEUDOCOLOR
+						   : FB_VISUAL_TRUECOLOR;
+	p->fix.line_length = p->var.xres * (p->var.bits_per_pixel / 8);
+
+	p->disp.var = p->var;
+	p->disp.screen_base = p->frame_buffer;
+	p->disp.visual = p->fix.visual;
+	p->disp.type = p->fix.type;
+	p->disp.type_aux = p->fix.type_aux;
+	p->disp.line_length = p->fix.line_length;
+	p->disp.can_soft_blank = 1;
+	p->disp.scrollmode = SCROLL_YREDRAW;
+	switch (p->var.bits_per_pixel) {
+#ifdef FBCON_HAS_CFB8
+		case 8:
+			p->disp.dispsw = &fbcon_cfb8;
+			break;
+#endif
+#ifdef FBCON_HAS_CFB16
+		case 16:
+			p->disp.dispsw = &fbcon_cfb16;
+			break;
+#endif
+#ifdef FBCON_HAS_CFB24
+		case 24:
+			p->disp.dispsw = &fbcon_cfb24;
+			break;
+#endif
+#ifdef FBCON_HAS_CFB32
+		case 32:
+			p->disp.dispsw = &fbcon_cfb32;
+			break;
+#endif
+		default:
+			p->disp.dispsw = 0;
+			break;
+	}
+
+	strcpy(p->info.modename, p->fix.id);
+	p->info.node = -1;
+	p->info.fbops = &imsttfb_ops;
+	p->info.disp = &p->disp;
+	p->info.fontname[0] = 0;
+	p->info.changevar = 0;
+	p->info.switch_con = &imsttfb_switch;
+	p->info.updatevar = &imsttfb_updatevar;
+	p->info.blank = &imsttfb_blank;
+
+	for (i = 0; i < 16; ++i) {
+		int j = color_table[i];
+		p->palette[i].red = default_red[j];
+		p->palette[i].green = default_grn[j];
+		p->palette[i].blue = default_blu[j];
+	}
+
+	if (register_framebuffer(&p->info) < 0) {
+		kfree(p);
+		return;
+	}
+
+	printk("fb%d: IMS Twin Turbo frame buffer\n", GET_FB_IDX(p->info.node));
+
+#ifdef CONFIG_FB_COMPAT_XPMAC
+	strncpy(display_info.name, "IMS,tt128mb", sizeof(display_info.name));
+	display_info.fb_address = (__u32)p->frame_buffer_phys;
+	display_info.cmap_adr_address = (__u32)&p->cmap_regs_phys[PADDRW];
+	display_info.cmap_data_address = (__u32)&p->cmap_regs_phys[PDATA];
+	display_info.disp_reg_address = 0;
+	set_display_info(&p->disp);
+	console_fb_info = &p->info;
+#endif /* CONFIG_FB_COMPAT_XPMAC */
+}
+
+__initfunc(void imsttfb_of_init(struct device_node *dp))
+{
+	struct fb_info_imstt *p;
+	unsigned long addr, size;
+	unsigned char bus, devfn;
+	unsigned short cmd;
+
+	if (dp->n_addrs < 2 || dp->addrs[1].size < 0x02000000)
+		return;
+
+	addr = dp->addrs[1].address;
+	size = dp->addrs[1].size;
+
+	p = kmalloc(sizeof(struct fb_info_imstt), GFP_ATOMIC);
+	if (!p)
+		return;
+	memset(p, 0, sizeof(struct fb_info_imstt));
+	p->frame_buffer_phys = (__u8 *)addr;
+	p->frame_buffer = (__u8 *)__ioremap(addr, size, _PAGE_NO_CACHE);
+	p->dc_regs_phys = (__u32 *)(p->frame_buffer_phys + 0x00800000);
+	p->dc_regs = (__u32 *)(p->frame_buffer + 0x00800000);
+	p->cmap_regs_phys = (__u8 *)(p->frame_buffer_phys + 0x00840000);
+	p->cmap_regs = (__u8 *)(p->frame_buffer + 0x00840000);
+
+	if (pci_device_loc(dp, &bus, &devfn) == 0) {
+		pcibios_read_config_word(bus, devfn, PCI_COMMAND, &cmd);
+		if (cmd != 0xffff) {
+			cmd |= PCI_COMMAND_MEMORY;
+			pcibios_write_config_word(bus, devfn, PCI_COMMAND, cmd);
+		}
+	}
+
+	p->frame_buffer[0] = 0;
+
+	init_imstt(p);
+}
+
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/leofb.c m68k/drivers/video/leofb.c
--- jes-2.1.115/drivers/video/leofb.c	Thu Jan  1 01:00:00 1970
+++ m68k/drivers/video/leofb.c	Wed Jul 29 19:00:44 1998
@@ -0,0 +1,582 @@
+/* $Id: leofb.c,v 1.2 1998/07/29 10:06:04 jj Exp $
+ * leofb.c: Leo (ZX) 24/8bit frame buffer driver
+ *
+ * Copyright (C) 1996,1997,1998 Jakub Jelinek (jj@ultra.linux.cz)
+ * Copyright (C) 1997 Michal Rehacek (Michal.Rehacek@st.mff.cuni.cz)
+ */
+
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/tty.h>
+#include <linux/malloc.h>
+#include <linux/vmalloc.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/fb.h>
+#include <linux/init.h>
+#include <linux/selection.h>
+
+#include "sbusfb.h"
+#include <asm/io.h>
+
+#define LEO_OFF_LC_SS0_KRN	0x00200000
+#define LEO_OFF_LC_SS0_USR	0x00201000
+#define LEO_OFF_LC_SS1_KRN	0x01200000
+#define LEO_OFF_LC_SS1_USR	0x01201000
+#define LEO_OFF_LD_SS0		0x00400000
+#define LEO_OFF_LD_SS1		0x01400000
+#define LEO_OFF_LD_GBL		0x00401000
+#define LEO_OFF_LX_KRN		0x00600000
+#define LEO_OFF_LX_CURSOR	0x00601000
+#define LEO_OFF_SS0		0x00800000
+#define LEO_OFF_SS1		0x01800000
+#define LEO_OFF_UNK		0x00602000
+#define LEO_OFF_UNK2		0x00000000
+
+#define LEO_CUR_ENABLE		0x00000080
+#define LEO_CUR_UPDATE		0x00000030
+#define LEO_CUR_PROGRESS	0x00000006
+#define LEO_CUR_UPDATECMAP	0x00000003
+
+#define LEO_CUR_TYPE_MASK	0x00000000
+#define LEO_CUR_TYPE_IMAGE	0x00000020
+#define LEO_CUR_TYPE_CMAP	0x00000050
+
+struct leo_cursor {
+	u8		xxx0[16];
+	volatile u32	cur_type;
+	volatile u32	cur_misc;
+	volatile u32	cur_cursxy;
+	volatile u32	cur_data;
+};
+
+#define LEO_KRN_TYPE_CLUT0	0x00001000
+#define LEO_KRN_TYPE_CLUT1	0x00001001
+#define LEO_KRN_TYPE_CLUT2	0x00001002
+#define LEO_KRN_TYPE_WID	0x00001003
+#define LEO_KRN_TYPE_UNK	0x00001006
+#define LEO_KRN_TYPE_VIDEO	0x00002003
+#define LEO_KRN_TYPE_CLUTDATA	0x00004000
+#define LEO_KRN_CSR_ENABLE	0x00000008
+#define LEO_KRN_CSR_PROGRESS	0x00000004
+#define LEO_KRN_CSR_UNK		0x00000002
+#define LEO_KRN_CSR_UNK2	0x00000001
+
+struct leo_lx_krn {
+	volatile u32	krn_type;
+	volatile u32	krn_csr;
+	volatile u32	krn_value;
+};
+
+struct leo_lc_ss0_krn {
+	volatile u32 	misc;
+	u8		xxx0[0x800-4];
+	volatile u32	rev;
+};
+
+struct leo_lc_ss0_usr {
+	volatile u32	csr;
+	volatile u32	attrs;
+	volatile u32 	fontc;
+	volatile u32	fontc2;
+	volatile u32	extent;
+	volatile u32	src;
+	u32		xxx1[1];
+	volatile u32	copy;
+	volatile u32	fill;
+};
+
+struct leo_lc_ss1_krn {
+	u8	unknown;
+};
+
+struct leo_lc_ss1_usr {
+	u8	unknown;
+};
+
+struct leo_ld_ss0 {
+	u8		xxx0[0xe00];
+	u32		xxx1[2];
+	volatile u32	unk;
+	u32		xxx2[1];
+	volatile u32	unk2;
+	volatile u32	unk3;
+	u32		xxx3[2];
+	volatile u32	fg;
+	volatile u32	bg;
+	u8		xxx4[0x05c];
+	volatile u32	planemask;
+	volatile u32	rop;
+};
+
+#define LEO_SS1_MISC_ENABLE	0x00000001
+#define LEO_SS1_MISC_STEREO	0x00000002
+struct leo_ld_ss1 {
+	u8		xxx0[0xef4];
+	volatile u32	ss1_misc;
+};
+
+struct leo_ld_gbl {
+	u8	unknown;
+};
+
+static struct sbus_mmap_map leo_mmap_map[] = {
+	{ LEO_SS0_MAP,		LEO_OFF_SS0,		0x800000	},
+	{ LEO_LC_SS0_USR_MAP,	LEO_OFF_LC_SS0_USR,	PAGE_SIZE	},
+	{ LEO_LD_SS0_MAP,	LEO_OFF_LD_SS0,		PAGE_SIZE	},
+	{ LEO_LX_CURSOR_MAP,	LEO_OFF_LX_CURSOR,	PAGE_SIZE	},
+	{ LEO_SS1_MAP,		LEO_OFF_SS1,		0x800000	},
+	{ LEO_LC_SS1_USR_MAP,	LEO_OFF_LC_SS1_USR,	PAGE_SIZE	},
+	{ LEO_LD_SS1_MAP,	LEO_OFF_LD_SS1,		PAGE_SIZE	},
+	{ LEO_UNK_MAP,		LEO_OFF_UNK,		PAGE_SIZE	},
+	{ LEO_LX_KRN_MAP,	LEO_OFF_LX_KRN,		PAGE_SIZE	},
+	{ LEO_LC_SS0_KRN_MAP,	LEO_OFF_LC_SS0_KRN,	PAGE_SIZE	},
+	{ LEO_LC_SS1_KRN_MAP,	LEO_OFF_LC_SS1_KRN,	PAGE_SIZE	},
+	{ LEO_LD_GBL_MAP,	LEO_OFF_LD_GBL,		PAGE_SIZE	},
+	{ LEO_UNK2_MAP,		LEO_OFF_UNK2,		0x100000	},
+	{ 0,			0,			0	  	}
+};
+
+static void leo_setup(struct display *p)
+{
+	p->next_line = 8192;
+	p->next_plane = 0;
+}
+
+static void leo_clear(struct vc_data *conp, struct display *p, int sy, int sx,
+		      int height, int width)
+{
+	struct fb_info_sbusfb *fb = (struct fb_info_sbusfb *)p->fb_info;
+	register struct leo_lc_ss0_usr *us = fb->s.leo.lc_ss0_usr;
+	register struct leo_ld_ss0 *ss = fb->s.leo.ld_ss0;
+	int x, y, w, h;
+	int i;
+
+	do {
+		i = us->csr;
+	} while (i & 0x20000000);
+	ss->unk = 0xffff;
+	ss->unk2 = 0;
+	ss->unk3 = fb->s.leo.extent;
+	ss->fg = (attr_bgcol_ec(p,conp)<<24) | 0x030703;
+	ss->planemask = 0xff000000;
+	ss->rop = 0xd0840;
+	if (fontheightlog(p)) {
+		y = sy << fontheightlog(p); h = height << fontheightlog(p);
+	} else {
+		y = sy * fontheight(p); h = height * fontheight(p);
+	}
+	if (fontwidthlog(p)) {
+		x = sx << fontwidthlog(p); w = width << fontwidthlog(p);
+	} else {
+		x = sx * fontwidth(p); w = width * fontwidth(p);
+	}
+	us->extent = (w - 1) | ((h - 1) << 11);
+	i = us->attrs;
+	us->fill = (x + fb->x_margin) | ((y + fb->y_margin) << 11) |
+		   ((i & 3) << 29) | ((i & 8) ? 0x80000000 : 0);
+}
+
+static void leo_fill(struct fb_info_sbusfb *fb, struct display *p, int s,
+		     int count, unsigned short *boxes)
+{
+	int i;
+	register struct leo_lc_ss0_usr *us = fb->s.leo.lc_ss0_usr;
+	register struct leo_ld_ss0 *ss = fb->s.leo.ld_ss0;
+	
+	do {
+		i = us->csr;
+	} while (i & 0x20000000);
+	ss->unk = 0xffff;
+	ss->unk2 = 0;
+	ss->unk3 = fb->s.leo.extent;
+	ss->fg = (attr_bgcol(p,s)<<24) | 0x030703;
+	ss->planemask = 0xff000000;
+	ss->rop = 0xd0840;
+	while (count-- > 0) {
+		us->extent = (boxes[2] - boxes[0] - 1) | 
+			     ((boxes[3] - boxes[1] - 1) << 11);
+		i = us->attrs;
+		us->fill = boxes[0] | (boxes[1] << 11) |
+			   ((i & 3) << 29) | ((i & 8) ? 0x80000000 : 0);
+	}
+}
+
+static void leo_putc(struct vc_data *conp, struct display *p, int c, int yy, int xx)
+{
+	struct fb_info_sbusfb *fb = (struct fb_info_sbusfb *)p->fb_info;
+	register struct leo_lc_ss0_usr *us = fb->s.leo.lc_ss0_usr;
+	register struct leo_ld_ss0 *ss = fb->s.leo.ld_ss0;
+	int i, x, y;
+	u8 *fd;
+	u32 *u;
+
+	if (fontheightlog(p)) {
+		y = yy << (fontheightlog(p) + 11);
+		i = (c & p->charmask) << fontheightlog(p);
+	} else {
+		y = (yy * fontheight(p)) << 11;
+		i = (c & p->charmask) * fontheight(p);
+	}
+	if (fontwidth(p) <= 8)
+		fd = p->fontdata + i;
+	else
+		fd = p->fontdata + (i << 1);
+	if (fontwidthlog(p))
+		x = xx << fontwidthlog(p);
+	else
+		x = xx * fontwidth(p);
+	do {
+		i = us->csr;
+	} while (i & 0x20000000);
+	ss->fg = attr_fgcol(p,c) << 24;
+	ss->bg = attr_bgcol(p,c) << 24;
+	ss->rop = 0x310040;
+	ss->planemask = 0xff000000;
+	us->fontc2 = 0xFFFFFFFE;
+	us->attrs = 4;
+	us->fontc = 0xFFFFFFFF<<(32-fontwidth(p));
+	u = ((u32 *)p->screen_base) + y + x;
+	if (fontwidth(p) <= 8) {
+		for (i = 0; i < fontheight(p); i++, u += 2048)
+			*u = *fd++ << 24;
+	} else {
+		for (i = 0; i < fontheight(p); i++, u += 2048) {
+			*u = *(u16 *)fd << 16;
+			fd += 2;
+		}
+	}
+}
+
+static void leo_putcs(struct vc_data *conp, struct display *p, const unsigned short *s,
+		      int count, int yy, int xx)
+{
+	struct fb_info_sbusfb *fb = (struct fb_info_sbusfb *)p->fb_info;
+	register struct leo_lc_ss0_usr *us = fb->s.leo.lc_ss0_usr;
+	register struct leo_ld_ss0 *ss = fb->s.leo.ld_ss0;
+	int i, x, y;
+	u8 *fd1, *fd2, *fd3, *fd4;
+	u32 *u;
+
+	do {
+		i = us->csr;
+	} while (i & 0x20000000);
+	ss->fg = attr_fgcol(p,*s) << 24;
+	ss->bg = attr_bgcol(p,*s) << 24;
+	ss->rop = 0x310040;
+	ss->planemask = 0xff000000;
+	us->fontc2 = 0xFFFFFFFE;
+	us->attrs = 4;
+	us->fontc = 0xFFFFFFFF<<(32-fontwidth(p));
+	if (fontwidthlog(p))
+		x = (xx << fontwidthlog(p));
+	else
+		x = xx * fontwidth(p);
+	if (fontheightlog(p))
+		y = yy << (fontheightlog(p) + 11);
+	else
+		y = (yy * fontheight(p)) << 11;
+	u = ((u32 *)p->screen_base) + y + x;
+	if (fontwidth(p) <= 8) {
+		us->fontc = 0xFFFFFFFF<<(32-4*fontwidth(p));
+		x = 4*fontwidth(p) - fontheight(p)*2048;
+		while (count >= 4) {
+			count -= 4;
+			if (fontheightlog(p)) {
+				fd1 = p->fontdata + ((*s++ & p->charmask) << fontheightlog(p));
+				fd2 = p->fontdata + ((*s++ & p->charmask) << fontheightlog(p));
+				fd3 = p->fontdata + ((*s++ & p->charmask) << fontheightlog(p));
+				fd4 = p->fontdata + ((*s++ & p->charmask) << fontheightlog(p));
+			} else {
+				fd1 = p->fontdata + ((*s++ & p->charmask) * fontheight(p));
+				fd2 = p->fontdata + ((*s++ & p->charmask) * fontheight(p));
+				fd3 = p->fontdata + ((*s++ & p->charmask) * fontheight(p));
+				fd4 = p->fontdata + ((*s++ & p->charmask) * fontheight(p));
+			}
+			if (fontwidth(p) == 8) {
+				for (i = 0; i < fontheight(p); i++, u += 2048)
+					*u = ((u32)*fd4++) | ((((u32)*fd3++) | ((((u32)*fd2++) | (((u32)*fd1++) 
+						<< 8)) << 8)) << 8);
+				u += x;
+			} else {
+				for (i = 0; i < fontheight(p); i++, u += 2048)
+					*u = (((u32)*fd4++) | ((((u32)*fd3++) | ((((u32)*fd2++) | (((u32)*fd1++) 
+						<< fontwidth(p))) << fontwidth(p))) << fontwidth(p))) << (24 - 3 * fontwidth(p));
+				u += x;
+			}
+		}
+	} else {
+		us->fontc = 0xFFFFFFFF<<(32-2*fontwidth(p));
+		x = 2*fontwidth(p) - fontheight(p)*2048;
+		while (count >= 2) {
+			count -= 2;
+			if (fontheightlog(p)) {
+				fd1 = p->fontdata + ((*s++ & p->charmask) << (fontheightlog(p) + 1));
+				fd2 = p->fontdata + ((*s++ & p->charmask) << (fontheightlog(p) + 1));
+			} else {
+				fd1 = p->fontdata + (((*s++ & p->charmask) * fontheight(p)) << 1);
+				fd2 = p->fontdata + (((*s++ & p->charmask) * fontheight(p)) << 1);
+			}
+			for (i = 0; i < fontheight(p); i++, u += 2048) {
+				*u = ((((u32)*(u16 *)fd1) << fontwidth(p)) | ((u32)*(u16 *)fd2)) << (16 - fontwidth(p));
+				fd1 += 2; fd2 += 2;
+			}
+			u += x;
+		}
+	}
+	us->fontc = 0xFFFFFFFF<<(32-fontwidth(p));
+	x = fontwidth(p) - fontheight(p)*2048;
+	while (count) {
+		count--;
+		if (fontheightlog(p))
+			i = ((*s++ & p->charmask) << fontheightlog(p));
+		else
+			i = ((*s++ & p->charmask) * fontheight(p));
+		if (fontwidth(p) <= 8) {
+			fd1 = p->fontdata + i;
+			for (i = 0; i < fontheight(p); i++, u += 2048)
+				*u = *fd1++ << 24;
+		} else {
+			fd1 = p->fontdata + (i << 1);
+			for (i = 0; i < fontheight(p); i++, u += 2048) {
+				*u = *(u16 *)fd1 << 16;
+				fd1 += 2;
+			}
+		}
+		u += x;
+	}
+}
+
+static void leo_revc(struct display *p, int xx, int yy)
+{
+	/* Not used if hw cursor */
+}
+
+static int leo_wait (struct leo_lx_krn *lx_krn)
+{
+	int i;
+	
+	for (i = 0; (lx_krn->krn_csr & LEO_KRN_CSR_PROGRESS) && i < 300000; i++)
+		udelay (1); /* Busy wait at most 0.3 sec */
+	if (i == 300000) return -EFAULT; /* Timed out - should we print some message? */
+	return 0;
+}
+
+static void leo_loadcmap (struct fb_info_sbusfb *fb, int index, int count)
+{
+        struct leo_lx_krn *lx_krn = fb->s.leo.lx_krn;
+	int i;
+	
+	lx_krn->krn_type = LEO_KRN_TYPE_CLUT0;
+	i = leo_wait (lx_krn);
+	if (i) return;
+	lx_krn->krn_type = LEO_KRN_TYPE_CLUTDATA;
+	for (i = 0; i < 256; i++)
+		lx_krn->krn_value = fb->color_map CM(i,0) |
+				    (fb->color_map CM(i,1) << 8) |
+				    (fb->color_map CM(i,2) << 16); /* Throw colors there :)) */
+	lx_krn->krn_type = LEO_KRN_TYPE_CLUT0;
+	lx_krn->krn_csr |= (LEO_KRN_CSR_UNK|LEO_KRN_CSR_UNK2);
+}
+
+static void leo_restore_palette (struct fb_info_sbusfb *fb)
+{
+	fb->s.leo.ld_ss1->ss1_misc &= ~(LEO_SS1_MISC_ENABLE);
+}
+
+static struct display_switch leo_dispsw __initdata = {
+	leo_setup, fbcon_redraw_bmove, leo_clear, leo_putc, leo_putcs, leo_revc, 
+	NULL, NULL, NULL, FONTWIDTHRANGE(1,16) /* Allow fontwidths up to 16 */
+};
+
+static void leo_setcursormap (struct fb_info_sbusfb *fb, u8 *red, u8 *green, u8 *blue)
+{
+        struct leo_cursor *l = fb->s.leo.cursor;
+	int i;
+                
+	for (i = 0; (l->cur_misc & LEO_CUR_PROGRESS) && i < 300000; i++)
+		udelay (1); /* Busy wait at most 0.3 sec */
+	if (i == 300000) return; /* Timed out - should we print some message? */
+	l->cur_type = LEO_CUR_TYPE_CMAP;
+	l->cur_data = (red[0] | (green[0]<<8) | (blue[0]<<16));
+	l->cur_data = (red[1] | (green[1]<<8) | (blue[1]<<16));
+	l->cur_misc = LEO_CUR_UPDATECMAP;
+}
+
+/* Set cursor shape */
+static void leo_setcurshape (struct fb_info_sbusfb *fb)
+{
+	int i, j, k;
+	u32 m, n, mask;
+	struct leo_cursor *l = fb->s.leo.cursor;
+                        
+	l->cur_misc &= ~LEO_CUR_ENABLE;
+	for (k = 0; k < 2; k ++) {
+		l->cur_type = (k * LEO_CUR_TYPE_IMAGE); /* LEO_CUR_TYPE_MASK is 0 */
+		for (i = 0; i < 32; i++) {
+			mask = 0;
+			m = fb->cursor.bits[k][i];
+			/* mask = m with reversed bit order */
+			for (j = 0, n = 1; j < 32; j++, n <<= 1)
+				if (m & n)
+					mask |= (0x80000000 >> j);
+			l->cur_data = mask;
+		}
+	}
+	l->cur_misc |= LEO_CUR_ENABLE;
+}
+
+/* Load cursor information */
+static void leo_setcursor (struct fb_info_sbusfb *fb)
+{
+	struct cg_cursor *c = &fb->cursor;
+	struct leo_cursor *l = fb->s.leo.cursor;
+
+	l->cur_misc &= ~LEO_CUR_ENABLE;
+	l->cur_cursxy = ((c->cpos.fbx - c->chot.fbx) & 0x7ff)
+	|(((c->cpos.fby - c->chot.fby) & 0x7ff) << 11);
+	l->cur_misc |= LEO_CUR_UPDATE;
+	if (c->enable)
+		l->cur_misc |= LEO_CUR_ENABLE;
+}
+
+static void leo_blank (struct fb_info_sbusfb *fb)
+{
+	fb->s.leo.lx_krn->krn_type = LEO_KRN_TYPE_VIDEO;
+	fb->s.leo.lx_krn->krn_csr &= ~LEO_KRN_CSR_ENABLE;
+}
+
+static void leo_unblank (struct fb_info_sbusfb *fb)
+{
+	fb->s.leo.lx_krn->krn_type = LEO_KRN_TYPE_VIDEO;
+	if (!(fb->s.leo.lx_krn->krn_csr & LEO_KRN_CSR_ENABLE))
+		fb->s.leo.lx_krn->krn_csr |= LEO_KRN_CSR_ENABLE;
+}
+
+__initfunc(static int
+leo_wid_put (struct fb_info_sbusfb *fb, struct fb_wid_list *wl))
+{
+	struct leo_lx_krn *lx_krn = fb->s.leo.lx_krn;
+	struct fb_wid_item *wi;
+	int i, j;
+
+	lx_krn->krn_type = LEO_KRN_TYPE_WID;
+	i = leo_wait (lx_krn);
+	if (i) return i;
+	for (i = 0, wi = wl->wl_list; i < wl->wl_count; i++, wi++) {
+		switch (wi->wi_type) {
+		case FB_WID_DBL_8: j = (wi->wi_index & 0xf) + 0x40; break;
+		case FB_WID_DBL_24: j = wi->wi_index & 0x3f; break;
+		default: return -EINVAL;
+		}
+		lx_krn->krn_type = 0x5800 + j;
+		lx_krn->krn_value = wi->wi_values[0];
+	}
+	return 0;
+}
+
+static void leo_margins (struct fb_info_sbusfb *fb, struct display *p, int x_margin, int y_margin)
+{
+	p->screen_base += 8192 * (y_margin - fb->y_margin) + 4 * (x_margin - fb->x_margin);
+}
+
+static char idstring[40] __initdata = { 0 };
+
+__initfunc(char *leofb_init(struct fb_info_sbusfb *fb))
+{
+	struct fb_fix_screeninfo *fix = &fb->fix;
+	struct fb_var_screeninfo *var = &fb->var;
+	struct display *disp = &fb->disp;
+	struct fbtype *type = &fb->type;
+	unsigned long phys = fb->sbdp->reg_addrs[0].phys_addr;
+	struct fb_wid_item wi;
+	struct fb_wid_list wl;
+	int i;
+
+	strcpy(fb->info.modename, "Leo");
+		
+	strcpy(fix->id, "Leo");
+	fix->visual = 0xff; /* We only know how to do acceleration and know nothing
+	                       about the actual memory layout */
+	fix->line_length = 8192;
+	fix->accel = FB_ACCEL_SUN_LEO;
+	
+	var->accel_flags = FB_ACCELF_TEXT;
+	
+	disp->scrollmode = SCROLL_YREDRAW;
+	if (!disp->screen_base)
+		disp->screen_base = (char *)sparc_alloc_io(phys + LEO_OFF_SS0, 0, 
+			0x800000, "leo_ram", fb->iospace, 0);
+	disp->screen_base += 8192 * fb->y_margin + 4 * fb->x_margin;
+	fb->s.leo.lc_ss0_usr = (struct leo_lc_ss0_usr *)
+			sparc_alloc_io(phys + LEO_OFF_LC_SS0_USR, 0, 
+			PAGE_SIZE, "leo_lc_ss0_usr", fb->iospace, 0);
+	fb->s.leo.ld_ss0 = (struct leo_ld_ss0 *)
+			sparc_alloc_io(phys + LEO_OFF_LD_SS0, 0, 
+			PAGE_SIZE, "leo_ld_ss0", fb->iospace, 0);
+	fb->s.leo.ld_ss1 = (struct leo_ld_ss1 *)
+			sparc_alloc_io(phys + LEO_OFF_LD_SS1, 0, 
+			PAGE_SIZE, "leo_ld_ss1", fb->iospace, 0);
+	fb->s.leo.lx_krn = (struct leo_lx_krn *)
+			sparc_alloc_io(phys + LEO_OFF_LX_KRN, 0, 
+			PAGE_SIZE, "leo_lx_krn", fb->iospace, 0);
+	fb->s.leo.cursor = (struct leo_cursor *)
+			sparc_alloc_io(phys + LEO_OFF_LX_CURSOR, 0, 
+			sizeof(struct leo_cursor), "leo_lx_cursor", fb->iospace, 0);
+	fb->dispsw = leo_dispsw;
+
+	fb->s.leo.extent = (type->fb_width-1) | ((type->fb_height-1) << 16);
+
+	fb->s.leo.ld_ss0->unk = 0xffff;
+	fb->s.leo.ld_ss0->unk2 = 0;
+	fb->s.leo.ld_ss0->unk3 = fb->s.leo.extent;
+	wl.wl_count = 1;
+	wl.wl_list = &wi;
+	wi.wi_type = FB_WID_DBL_8;
+	wi.wi_index = 0;
+	wi.wi_values [0] = 0x2c0;
+	leo_wid_put (fb, &wl);
+	wi.wi_index = 1;
+	wi.wi_values [0] = 0x30;
+	leo_wid_put (fb, &wl);
+	wi.wi_index = 2;
+	wi.wi_values [0] = 0x20;
+	leo_wid_put (fb, &wl);
+
+	fb->s.leo.ld_ss1->ss1_misc |= LEO_SS1_MISC_ENABLE;
+
+	fb->s.leo.ld_ss0->fg = 0x30703;
+	fb->s.leo.ld_ss0->planemask = 0xff000000;
+	fb->s.leo.ld_ss0->rop = 0xd0840;
+	fb->s.leo.lc_ss0_usr->extent = (type->fb_width-1) | ((type->fb_height-1) << 11);
+	i = fb->s.leo.lc_ss0_usr->attrs;
+	fb->s.leo.lc_ss0_usr->fill = (0) | ((0) << 11) | ((i & 3) << 29) | ((i & 8) ? 0x80000000 : 0);
+	do {
+		i = fb->s.leo.lc_ss0_usr->csr;
+	} while (i & 0x20000000);
+
+	fb->margins = leo_margins;
+	fb->loadcmap = leo_loadcmap;
+	fb->setcursor = leo_setcursor;
+	fb->setcursormap = leo_setcursormap;
+	fb->setcurshape = leo_setcurshape;
+	fb->restore_palette = leo_restore_palette;
+	fb->fill = leo_fill;
+	fb->blank = leo_blank;
+	fb->unblank = leo_unblank;
+	
+	fb->physbase = phys;
+	fb->mmap_map = leo_mmap_map;
+	
+#ifdef __sparc_v9__
+	sprintf(idstring, "leo at %016lx", phys);
+#else	
+	sprintf(idstring, "leo at %x.%08lx", fb->iospace, phys);
+#endif
+		    
+	return idstring;
+}
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/macfb.c m68k/drivers/video/macfb.c
--- jes-2.1.115/drivers/video/macfb.c	Sun Aug  9 21:48:32 1998
+++ m68k/drivers/video/macfb.c	Wed Aug 12 09:29:51 1998
@@ -2,7 +2,6 @@
  *	We've been given MAC frame buffer info by the booter. Now go set it up
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -262,7 +261,7 @@
 	if (console_loglevel < 7)
 		return -EINVAL;
 	if (con == currcon) /* current console? */
-		return fb_get_cmap(cmap, &fb_display[con].var, kspc, 0 /*offb_getcolreg*/, info);
+		return fb_get_cmap(cmap, kspc, 0 /*offb_getcolreg*/, info);
 	else if (fb_display[con].cmap.len) /* non default colormap? */
 		fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
 	else
@@ -286,7 +285,7 @@
 		return err;
 	}
 	if (con == currcon)			/* current console? */
-		return fb_set_cmap(cmap, &fb_display[con].var, kspc, 1 /*offb_setcolreg*/, info);
+		return fb_set_cmap(cmap, kspc, 1 /*offb_setcolreg*/, info);
 	else
 		fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
 #endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/macmodes.c m68k/drivers/video/macmodes.c
--- jes-2.1.115/drivers/video/macmodes.c	Sun Aug  9 21:48:32 1998
+++ m68k/drivers/video/macmodes.c	Mon Aug  3 19:49:03 1998
@@ -8,8 +8,6 @@
  *  more details.
  */
 
-
-#include <linux/config.h>
 #include <linux/tty.h>
 #include <linux/fb.h>
 #include <linux/string.h>
@@ -369,7 +367,7 @@
 	    continue;
 	if (var->pixclock > mode->pixclock)
 	    continue;
-	if (var->vmode != mode->vmode)
+	if ((var->vmode & FB_VMODE_MASK) != mode->vmode)
 	    continue;
 	*vmode = mode->number;
 	return 0;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/offb.c m68k/drivers/video/offb.c
--- jes-2.1.115/drivers/video/offb.c	Sun Aug  9 21:48:33 1998
+++ m68k/drivers/video/offb.c	Wed Aug 12 09:29:53 1998
@@ -229,8 +229,7 @@
 			 struct fb_info *info)
 {
     if (con == currcon) /* current console? */
-	return fb_get_cmap(cmap, &fb_display[con].var, kspc, offb_getcolreg,
-			   info);
+	return fb_get_cmap(cmap, kspc, offb_getcolreg, info);
     else if (fb_display[con].cmap.len) /* non default colormap? */
 	fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
     else
@@ -258,8 +257,7 @@
 	    return err;
     }
     if (con == currcon)			/* current console? */
-	return fb_set_cmap(cmap, &fb_display[con].var, kspc, offb_setcolreg,
-			   info);
+	return fb_set_cmap(cmap, kspc, offb_setcolreg, info);
     else
 	fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
     return 0;
@@ -279,6 +277,9 @@
 #ifdef CONFIG_FB_S3TRIO
 extern void s3triofb_init_of(struct device_node *dp);
 #endif /* CONFIG_FB_S3TRIO */
+#ifdef CONFIG_FB_IMSTT
+extern void imsttfb_of_init(struct device_node *dp);
+#endif
 #ifdef CONFIG_FB_CT65550
 extern void chips_of_init(struct device_node *dp);
 #endif /* CONFIG_FB_CT65550 */
@@ -319,6 +320,12 @@
             if (s3triofb_init_of(dp))
                 continue;
 #endif /* CONFIG_FB_S3TRIO */
+#ifdef CONFIG_FB_IMSTT
+	    if (!strncmp(dp->name, "IMS,tt128mb", 11)) {
+		imsttfb_of_init(dp);
+		continue;
+	    }
+#endif
 #ifdef CONFIG_FB_CT65550
 	    if (!strcmp(dp->name, "chips65550")) {
 		chips_of_init(dp);
@@ -333,7 +340,6 @@
 #endif /* CONFIG_FB_CONTROL */
 #ifdef CONFIG_FB_PLATINUM
 	    if (!strncmp(dp->name, "platinum",8)) {
-	    	printk("jonh: offb_init sees device node %s\n", dp->name);
 		platinum_of_init(dp);
 		continue;
 	    }
@@ -341,6 +347,10 @@
 	}
 
 	info = kmalloc(sizeof(struct fb_info_offb), GFP_ATOMIC);
+	if (info == 0)
+	    continue;
+	memset(info, 0, sizeof(*info));
+
 	fix = &info->fix;
 	var = &info->var;
 	disp = &info->disp;
@@ -505,8 +515,7 @@
 {
     /* Do we have to save the colormap? */
     if (fb_display[currcon].cmap.len)
-	fb_get_cmap(&fb_display[currcon].cmap, &fb_display[currcon].var, 1,
-		    offb_getcolreg, info);
+	fb_get_cmap(&fb_display[currcon].cmap, 1, offb_getcolreg, info);
 
     currcon = con;
     /* Install new colormap */
@@ -561,9 +570,11 @@
 
     if (!info2->cmap_adr || regno > 255)
 	return 1;
-    *red = info2->palette[regno].red;
-    *green = info2->palette[regno].green;
-    *blue = info2->palette[regno].blue;
+    
+    *red = (info2->palette[regno].red<<8) | info2->palette[regno].red;
+    *green = (info2->palette[regno].green<<8) | info2->palette[regno].green;
+    *blue = (info2->palette[regno].blue<<8) | info2->palette[regno].blue;
+    *transp = 0;
     return 0;
 }
 
@@ -581,6 +592,10 @@
 
     if (!info2->cmap_adr || regno > 255)
 	return 1;
+    red >>= 8;
+    green >>= 8;
+    blue >>= 8;
+
     info2->palette[regno].red = red;
     info2->palette[regno].green = green;
     info2->palette[regno].blue = blue;
@@ -601,12 +616,10 @@
     if (con != currcon)
 	return;
     if (fb_display[con].cmap.len)
-	fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-		    offb_setcolreg, info);
+	fb_set_cmap(&fb_display[con].cmap, 1, offb_setcolreg, info);
     else
 	fb_set_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel),
-				    &fb_display[con].var, 1, offb_setcolreg,
-				    info);
+				    1, offb_setcolreg, info);
 }
 
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/platinumfb.c m68k/drivers/video/platinumfb.c
--- jes-2.1.115/drivers/video/platinumfb.c	Sun Aug  9 21:48:34 1998
+++ m68k/drivers/video/platinumfb.c	Wed Aug 12 09:29:55 1998
@@ -1,19 +1,12 @@
 /*
  *  platinumfb.c -- frame buffer device for the PowerMac 'platinum' display
  *
- *  Created 12 July 1998 by Dan Jacobowitz <dan@debian.org>
- *  Copyright (C) 1998 Dan Jacobowitz
+ *  Copyright (C) 1998 Franz Sirl
  *
  *  Frame buffer structure from:
- *    drivers/video/chipsfb.c -- frame buffer device for
- *    Chips & Technologies 65550 chip.
- *
- *    Copyright (C) 1998 Paul Mackerras
- *
- *    This file is derived from the Powermac "chips" driver:
- *    Copyright (C) 1997 Fabio Riccardi.
- *    And from the frame buffer device for Open Firmware-initialized devices:
- *    Copyright (C) 1997 Geert Uytterhoeven.
+ *    drivers/video/controlfb.c -- frame buffer device for
+ *    Apple 'control' display chip.
+ *    Copyright (C) 1998 Dan Jacobowitz
  *
  *  Hardware information from:
  *    platinum.c: Console support for PowerMac "platinum" display adaptor.
@@ -47,7 +40,6 @@
 #include <asm/prom.h>
 #include <asm/pgtable.h>
 #include <asm/adb.h>
-#include <asm/cuda.h>
 
 #include "fbcon.h"
 #include "fbcon-cfb8.h"
@@ -57,8 +49,12 @@
 #include "macmodes.h"
 #include "platinumfb.h"
 
+static char fontname[40] __initdata = { 0 };
+
 static int currcon = 0;
-static int switching = 0;
+
+static int default_vmode = VMODE_NVRAM;
+static int default_cmode = CMODE_NVRAM;
 
 struct fb_par_platinum {
 	int	vmode, cmode;
@@ -68,68 +64,104 @@
 };
 
 struct fb_info_platinum {
-	struct fb_info			info;
-	struct fb_fix_screeninfo	fix;
-	struct fb_var_screeninfo	var;
+	struct fb_info			fb_info;
 	struct display			disp;
-	struct fb_par_platinum		par;
+#ifdef FBCON_HAS_CFB8
+	struct display_switch		disp8;
+#endif
+#ifdef FBCON_HAS_CFB16
+	struct display_switch		disp16;
+#endif
+#ifdef FBCON_HAS_CFB32
+	struct display_switch		disp32;
+#endif
+	struct fb_par_platinum		default_par;
+	struct fb_par_platinum		current_par;
+
 	struct {
 		__u8 red, green, blue;
-	}			palette[256];
+	}				palette[256];
 	
 	volatile struct cmap_regs	*cmap_regs;
-	unsigned long		cmap_regs_phys;
+	unsigned long			cmap_regs_phys;
 	
 	volatile struct platinum_regs	*platinum_regs;
-	unsigned long		platinum_regs_phys;
+	unsigned long			platinum_regs_phys;
 	
-	__u8			*frame_buffer;
-	__u8			*base_frame_buffer;
-	unsigned long		frame_buffer_phys;
-	
-	int			sense;
-	unsigned long		total_vram;
+	__u8				*frame_buffer;
+	volatile __u8			*base_frame_buffer;
+	unsigned long			frame_buffer_phys;
+	
+	unsigned long			total_vram;
+	int				clktype;
+	int				dactype;
 };
 
 /*
- * Exported functions
+ * Frame buffer device API
  */
-void platinum_init(void);
-void platinum_of_init(struct device_node *dp);
 
 static int platinum_open(struct fb_info *info, int user);
 static int platinum_release(struct fb_info *info, int user);
 static int platinum_get_fix(struct fb_fix_screeninfo *fix, int con,
-			 struct fb_info *info);
+			    struct fb_info *fb);
 static int platinum_get_var(struct fb_var_screeninfo *var, int con,
-			 struct fb_info *info);
+			    struct fb_info *fb);
 static int platinum_set_var(struct fb_var_screeninfo *var, int con,
-			 struct fb_info *info);
+			    struct fb_info *fb);
 static int platinum_pan_display(struct fb_var_screeninfo *var, int con,
-			     struct fb_info *info);
+				struct fb_info *fb);
 static int platinum_get_cmap(struct fb_cmap *cmap, int kspc, int con,
-			  struct fb_info *info);
+			     struct fb_info *info);
 static int platinum_set_cmap(struct fb_cmap *cmap, int kspc, int con,
-			  struct fb_info *info);
+			     struct fb_info *info);
 static int platinum_ioctl(struct inode *inode, struct file *file, u_int cmd,
-		       u_long arg, int con, struct fb_info *info);
+			  u_long arg, int con, struct fb_info *info);
+
+
+/*
+ * Interface to the low level console driver
+ */
+
+static int platinum_switch(int con, struct fb_info *fb);
+static int platinum_updatevar(int con, struct fb_info *fb);
+static void platinum_blank(int blank, struct fb_info *fb);
+
+
+/*
+ * internal functions
+ */
 
-static int read_platinum_sense(struct fb_info_platinum *p);
 static inline int platinum_vram_reqd(int video_mode, int color_mode);
-static void set_platinum_clock(struct fb_info_platinum *p, unsigned char *params);
-static void platinum_set_hardware(struct fb_info_platinum *p);
-static void platinum_par_to_all(struct fb_info_platinum *p, int init);
-static inline void platinum_par_to_var(struct fb_par_platinum *par, struct fb_var_screeninfo *var);
-static int platinum_var_to_par(struct fb_var_screeninfo *var,
-	struct fb_par_platinum *par, const struct fb_info *fb_info);
-
-static void platinum_init_info(struct fb_info *info, struct fb_info_platinum *p);
-static void platinum_par_to_display(struct fb_par_platinum *par,
-  struct display *disp, struct fb_fix_screeninfo *fix, struct fb_info_platinum *p);
-static void platinum_init_display(struct display *disp);
-static void platinum_par_to_fix(struct fb_par_platinum *par, struct fb_fix_screeninfo *fix,
-	struct fb_info_platinum *p);
-static void platinum_init_fix(struct fb_fix_screeninfo *fix, struct fb_info_platinum *p);
+static int read_platinum_sense(struct fb_info_platinum *info);
+static void set_platinum_clock(struct fb_info_platinum *info);
+static void platinum_set_par(const struct fb_par_platinum *par, struct fb_info_platinum *info);
+static int platinum_par_to_var(struct fb_var_screeninfo *var,
+			       const struct fb_par_platinum *par,
+			       const struct fb_info_platinum *info);
+static int platinum_var_to_par(const struct fb_var_screeninfo *var,
+			       struct fb_par_platinum *par,
+			       const struct fb_info_platinum *info);
+static int platinum_encode_fix(struct fb_fix_screeninfo *fix,
+			       const struct fb_par_platinum *par,
+			       const struct fb_info_platinum *info);
+static int platinum_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue,
+			      u_int *transp, struct fb_info *fb);
+static int platinum_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
+			      u_int transp, struct fb_info *fb);
+static void do_install_cmap(int con, struct fb_info *info);
+
+
+/*
+ * Interface used by the world
+ */
+
+void platinum_init(void);
+#ifdef CONFIG_FB_OF
+void platinum_of_init(struct device_node *dp);
+#endif
+void platinum_setup(char *options, int *ints);
+
 
 static struct fb_ops platinumfb_ops = {
 	platinum_open,
@@ -143,13 +175,6 @@
 	platinum_ioctl
 };
 
-static int platinum_getcolreg(u_int regno, u_int *red, u_int *green,
-			     u_int *blue, u_int *transp, struct fb_info *info);
-static int platinum_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
-			     u_int transp, struct fb_info *info);
-static void do_install_cmap(int con, struct fb_info *info);
-
-#define FUNCID { printk(KERN_INFO "entering %s\n", __FUNCTION__); }
 
 __openfirmware
 
@@ -167,76 +192,119 @@
 }
 
 static int platinum_get_fix(struct fb_fix_screeninfo *fix, int con,
-			 struct fb_info *info)
+			    struct fb_info *fb)
 {
-	struct fb_info_platinum *cp = (struct fb_info_platinum *) info;
+	const struct fb_info_platinum *info = (struct fb_info_platinum *)fb;
+	struct fb_par_platinum par;
 
-	*fix = cp->fix;
+	if (con == -1)
+		par = info->default_par;
+	else
+		platinum_var_to_par(&fb_display[con].var, &par, info);
+
+	platinum_encode_fix(fix, &par, info);
 	return 0;
 }
 
 static int platinum_get_var(struct fb_var_screeninfo *var, int con,
-			 struct fb_info *info)
+			    struct fb_info *fb)
 {
-	struct fb_info_platinum *cp = (struct fb_info_platinum *) info;
+	const struct fb_info_platinum *info = (struct fb_info_platinum *)fb;
+
+	if (con == -1)
+		platinum_par_to_var(var, &info->default_par, info);
+	else
+		*var = fb_display[con].var;
 
-	*var = cp->var;
 	return 0;
 }
 
-/* Sets everything according to var */
 static int platinum_set_var(struct fb_var_screeninfo *var, int con,
-			 struct fb_info *info)
+			    struct fb_info *fb)
 {
-	struct fb_info_platinum *p = (struct fb_info_platinum *) info;
-	struct display *disp;
+	struct fb_info_platinum *info = (struct fb_info_platinum *) fb;
 	struct fb_par_platinum par;
-	int depthchange, err;
+	struct display *display;
+	int oldxres, oldyres, oldvxres, oldvyres, oldbpp, err;
+	int activate = var->activate;
+
+	display = (con >= 0) ? &fb_display[con] : fb->disp;
 
-//    FUNCID;
-	disp = (con >= 0) ? &fb_display[con] : &p->disp;
 	if((err = platinum_var_to_par(var, &par, info))) {
-		printk (KERN_ERR "Error in platinum_set_var, calling platinum_var_to_par: %d.\n", err);
+		printk(KERN_ERR "platinum_set_var: error calling platinum_var_to_par: %d.\n", err);
 		return err;
 	}
 	
-	if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW) {
-		printk("Not activating, in platinum_set_var.\n");
-		platinum_par_to_var(&par, var);
+	platinum_par_to_var(var, &par, info);
+
+	if ((activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW) {
+		printk(KERN_INFO "platinum_set_var: Not activating.\n");
 		return 0;
 	}
-/* I know, we want to use fb_display[con], but grab certain info from p->var instead. */
-#define DIRTY(x) (p->var.x != var->x)
-	depthchange = DIRTY(bits_per_pixel);
-	if(!DIRTY(xres) && !DIRTY(yres) && !DIRTY(xres_virtual) &&
-	   !DIRTY(yres_virtual) && !DIRTY(bits_per_pixel)) {
-	   	platinum_par_to_var(&par, var);
-		p->var = disp->var = *var;
-		return 0;
+
+	oldxres = display->var.xres;
+	oldyres = display->var.yres;
+	oldvxres = display->var.xres_virtual;
+	oldvyres = display->var.yres_virtual;
+	oldbpp = display->var.bits_per_pixel;
+	display->var = *var;
+
+	if (oldxres != var->xres || oldyres != var->yres ||
+	    oldvxres != var->xres_virtual || oldyres != var->yres_virtual ||
+	    oldbpp != var->bits_per_pixel) {
+	    struct fb_fix_screeninfo fix;
+
+	    platinum_encode_fix(&fix, &par, info);
+	    display->screen_base = (char *) info->frame_buffer + 0x1000;
+	    display->visual = fix.visual;
+	    display->type = fix.type;
+	    display->type_aux = fix.type_aux;
+	    display->ypanstep = fix.ypanstep;
+	    display->ywrapstep = fix.ywrapstep;
+	    display->line_length = fix.line_length;
+	    display->can_soft_blank = 1;
+	    display->inverse = 0;
+
+	    switch(par.cmode) {
+#ifdef FBCON_HAS_CFB8
+	     case CMODE_8:
+		display->dispsw = &info->disp8;
+		break;
+#endif
+#ifdef FBCON_HAS_CFB16
+	     case CMODE_16:
+		display->dispsw = &info->disp16;
+		break;
+#endif
+#ifdef FBCON_HAS_CFB32
+	     case CMODE_32:
+		display->dispsw = &info->disp32;
+		break;
+#endif
+	     default:
+		display->dispsw = NULL;
+		break;
+	    }
+	    
+	    display->scrollmode = SCROLL_YREDRAW;
+	    if (info->fb_info.changevar)
+	      (*info->fb_info.changevar)(con);
 	}
-	printk("Original bpp is %d, new bpp %d.\n", p->var.bits_per_pixel, var->bits_per_pixel);
-	/* OK, we're getting here at the right times... */
-	p->par = par;
-	platinum_par_to_var(&par, var);
-	p->var = *var;
-	platinum_par_to_fix(&par, &p->fix, p);
-	platinum_par_to_display(&par, disp, &p->fix, p);
-	p->disp = *disp;
-	
-	if(info->changevar && !switching)	/* Don't want to do this if just switching consoles. */
-		(*info->changevar)(con);
-	if(con == currcon)
-		platinum_set_hardware(p);
-	if(depthchange)
-		if((err = fb_alloc_cmap(&disp->cmap, 0, 0)))
-			return err;
-	if(depthchange || switching)
-		do_install_cmap(con, info);
+
+	if (con == currcon)
+		platinum_set_par(&par, info);
+
+	if (oldbpp != var->bits_per_pixel) {
+	    if ((err = fb_alloc_cmap(&display->cmap, 0, 0)))
+	      return err;
+	    do_install_cmap(con, &info->fb_info);
+	}
+
 	return 0;
 }
 
 static int platinum_pan_display(struct fb_var_screeninfo *var, int con,
-			     struct fb_info *info)
+				struct fb_info *info)
 {
     /*
      *  Pan (or wrap, depending on the `vmode' field) the display using the
@@ -244,21 +312,18 @@
      *  If the values don't fit, return -EINVAL.
      */
 
-//	FUNCID;
 	if (var->xoffset != 0 || var->yoffset != 0)
 		return -EINVAL;
 	return 0;
 }
 
 static int platinum_get_cmap(struct fb_cmap *cmap, int kspc, int con,
-			  struct fb_info *info)
+			     struct fb_info *info)
 {
-//    FUNCID;
 	if (con == currcon)		/* current console? */
-		return fb_get_cmap(cmap, &fb_display[con].var, kspc,
-				   platinum_getcolreg, info);
+		return fb_get_cmap(cmap, kspc, platinum_getcolreg, info);
 	if (fb_display[con].cmap.len)	/* non default colormap? */
-		fb_copy_cmap(&fb_display[con].cmap, cmap, kspc? 0: 2);
+		fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
 	else {
 		int size = fb_display[con].var.bits_per_pixel == 16 ? 32 : 256;
 		fb_copy_cmap(fb_default_cmap(size), cmap, kspc ? 0 : 2);
@@ -267,63 +332,54 @@
 }
 
 static int platinum_set_cmap(struct fb_cmap *cmap, int kspc, int con,
-			 struct fb_info *info)
+			     struct fb_info *info)
 {
-	struct display *disp = &fb_display[con];
 	int err;
 
-//    FUNCID;
-	if (disp->cmap.len == 0) {
+	if (!fb_display[con].cmap.len) {
 		int size = fb_display[con].var.bits_per_pixel == 16 ? 32 : 256;
-		err = fb_alloc_cmap(&disp->cmap, size, 0);
+		err = fb_alloc_cmap(&fb_display[con].cmap, size, 0);
 		if (err)
 			return err;
 	}
 
 	if (con == currcon)
-		return fb_set_cmap(cmap, &disp->var, kspc, platinum_setcolreg,
-				   info);
-	fb_copy_cmap(cmap, &disp->cmap, kspc ? 0 : 1);
+		return fb_set_cmap(cmap, kspc, platinum_setcolreg, info);
+	fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
 	return 0;
 }
 
 static int platinum_ioctl(struct inode *inode, struct file *file, u_int cmd,
-		       u_long arg, int con, struct fb_info *info)
+			  u_long arg, int con, struct fb_info *info)
 {
-//	FUNCID;
+	printk(KERN_ERR "platinum_ioctl not yet implemented\n");
 	return -EINVAL;
 }
 
-static int platinum_switch(int con, struct fb_info *info)
+static int platinum_switch(int con, struct fb_info *fb)
 {
-//    FUNCID;
+	struct fb_info_platinum *info = (struct fb_info_platinum *) fb;
+	struct fb_par_platinum par;
+
 	if (fb_display[currcon].cmap.len)
-		fb_get_cmap(&fb_display[currcon].cmap,
-			    &fb_display[currcon].var, 1, platinum_getcolreg,
-			    info);
+		fb_get_cmap(&fb_display[currcon].cmap, 1, platinum_getcolreg,
+			    fb);
 	currcon = con;
-#if 0
+
 	platinum_var_to_par(&fb_display[currcon].var, &par, info);
-	platinum_set_par(&par, info); /*STOPPEDHERE - did i define that? */
-	do_install_cmap(con, info);
-#else
-	/* I see no reason not to do this.  Minus info->changevar(). */
-	/* DOH.  This makes platinum_set_var compare, you guessed it, */
-	/* fb_display[con].var (first param), and fb_display[con].var! */
-	/* Perhaps I just fixed that... */
-	switching = 1;
-	platinum_set_var(&fb_display[con].var, con, info);
-	switching = 0;
-#endif
-	return 0;
+	platinum_set_par(&par, info);
+	do_install_cmap(con, fb);
+
+	return 1;
 }
 
-static int platinum_updatevar(int con, struct fb_info *info)
+static int platinum_updatevar(int con, struct fb_info *fb)
 {
+	printk(KERN_ERR "platinum_updatevar is doing nothing yet.\n");
 	return 0;
 }
 
-static void platinum_blank(int blank_mode, struct fb_info *info)
+static void platinum_blank(int blank,  struct fb_info *fb)
 {
 /*
  *  Blank the screen if blank_mode != 0, else unblank. If blank == NULL
@@ -337,71 +393,68 @@
  */
 /* [danj] I think there's something fishy about those constants... */
 /*
-	struct fb_info_platinum *p = (struct fb_info_platinum *) info;
+	struct fb_info_platinum *info = (struct fb_info_platinum *) fb;
 	int	ctrl;
 
-	ctrl = ld_le32(&p->platinum_regs->ctrl.r) | 0x33;
-	if (blank_mode)
+	ctrl = ld_le32(&info->platinum_regs->ctrl.r) | 0x33;
+	if (blank)
 		--blank_mode;
-	if (blank_mode & VESA_VSYNC_SUSPEND)
+	if (blank & VESA_VSYNC_SUSPEND)
 		ctrl &= ~3;
-	if (blank_mode & VESA_HSYNC_SUSPEND)
+	if (blank & VESA_HSYNC_SUSPEND)
 		ctrl &= ~0x30;
-	out_le32(&p->platinum_regs->ctrl.r, ctrl);
+	out_le32(&info->platinum_regs->ctrl.r, ctrl);
 */
 /* TODO: Figure out how the heck to powerdown this thing! */
-//FUNCID;
     return;
 }
 
 static int platinum_getcolreg(u_int regno, u_int *red, u_int *green,
-			     u_int *blue, u_int *transp, struct fb_info *info)
+			      u_int *blue, u_int *transp, struct fb_info *fb)
 {
-	struct fb_info_platinum *p = (struct fb_info_platinum *) info;
+	struct fb_info_platinum *info = (struct fb_info_platinum *) fb;
 
-//    FUNCID;
-	if (regno > 255 || regno < 0)
+	if (regno > 255)
 		return 1;
-	*red = p->palette[regno].red;
-	*green = p->palette[regno].green;
-	*blue = p->palette[regno].blue;
+
+	*red = (info->palette[regno].red<<8) | info->palette[regno].red;
+	*green = (info->palette[regno].green<<8) | info->palette[regno].green;
+	*blue = (info->palette[regno].blue<<8) | info->palette[regno].blue;
+	*transp = 0;
 	return 0;
 }
 
 static int platinum_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
-			     u_int transp, struct fb_info *info)
+			      u_int transp, struct fb_info *fb)
 {
-	struct fb_info_platinum *p = (struct fb_info_platinum *) info;
+	struct fb_info_platinum *info = (struct fb_info_platinum *) fb;
+	volatile struct cmap_regs *cmap_regs = info->cmap_regs;
+	int scale;
 
-//    FUNCID;
-	if (regno > 255 || regno < 0)
+	if (regno > 255)
 		return 1;
-	p->palette[regno].red = red;
-	p->palette[regno].green = green;
-	p->palette[regno].blue = blue;
-
-	out_8(&p->cmap_regs->addr, regno);	/* tell clut what addr to fill	*/
-	out_8(&p->cmap_regs->lut, red);		/* send one color channel at	*/
-	out_8(&p->cmap_regs->lut, green);	/* a time...			*/
-	out_8(&p->cmap_regs->lut, blue);
+
+	red >>= 8;
+	green >>= 8;
+	blue >>= 8;
+
+	info->palette[regno].red = red;
+	info->palette[regno].green = green;
+	info->palette[regno].blue = blue;
+
+	scale = (info->current_par.cmode == CMODE_16) ? 3 : 0;
+
+	out_8(&cmap_regs->addr, regno);		/* tell clut what addr to fill	*/
+	out_8(&cmap_regs->lut, red<<scale);	/* send one color channel at	*/
+	out_8(&cmap_regs->lut, green<<scale);	/* a time...			*/
+	out_8(&cmap_regs->lut, blue<<scale);
 
 	if(regno < 16) {
-#if 0
 #ifdef FBCON_HAS_CFB16
-		fbcon_cfb16_cmap[regno] = (red << 10) | (green << 5) | blue;
-#endif
-#ifdef FBCON_HAS_CFB32
-		fbcon_cfb32_cmap[regno] = (red << 16) | (green << 8) | blue;
-		/* I think. */
-#endif
-#else
-#ifdef FBCON_HAS_CFB16
-		fbcon_cfb16_cmap[regno] = (regno << 10) | (regno << 5) | regno;
+		fbcon_cfb16_cmap[regno] = (regno << 10) | (regno << 5) | (regno << 0);
 #endif
 #ifdef FBCON_HAS_CFB32
 		fbcon_cfb32_cmap[regno] = (regno << 24) | (regno << 16) | (regno << 8) | regno;
-		/* I think. */
-#endif
 #endif
 	}
 	return 0;
@@ -409,53 +462,46 @@
 
 static void do_install_cmap(int con, struct fb_info *info)
 {
-//    FUNCID;
 	if (con != currcon)
 		return;
 	if (fb_display[con].cmap.len)
-		fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-			    platinum_setcolreg, info);
+		fb_set_cmap(&fb_display[con].cmap, 1, platinum_setcolreg,
+			    info);
 	else {
 		int size = fb_display[con].var.bits_per_pixel == 16 ? 32 : 256;
-		fb_set_cmap(fb_default_cmap(size), &fb_display[con].var, 1,
-			    platinum_setcolreg, info);
+		fb_set_cmap(fb_default_cmap(size), 1, platinum_setcolreg,
+			    info);
 	}
 }
 
-#ifdef CONFIG_FB_COMPAT_XPMAC
-extern struct vc_mode display_info;
-extern struct fb_info *console_fb_info;
-#if 0
-extern int (*console_setmode_ptr)(struct vc_mode *, int);
-extern int (*console_set_cmap_ptr)(struct fb_cmap *, int, int,
-				   struct fb_info *);
-int console_setmode(struct vc_mode *, int);
-#endif
-#endif /* CONFIG_FB_COMPAT_XPMAC */
-
 static inline int platinum_vram_reqd(int video_mode, int color_mode)
 {
-	return vmode_attrs[video_mode - 1].vres
-		* platinum_reg_init[video_mode-1]->pitch[color_mode];
+	return vmode_attrs[video_mode-1].vres *
+	       (vmode_attrs[video_mode-1].hres * (1<<color_mode) + 0x20) +0x1000;
 }
 
 #define STORE_D2(a, d) { \
-	out_8(&p->cmap_regs->addr, (a+32)); \
-	out_8(&p->cmap_regs->d2, (d)); \
+	out_8(&cmap_regs->addr, (a+32)); \
+	out_8(&cmap_regs->d2, (d)); \
 }
 
-static void set_platinum_clock(struct fb_info_platinum *p, unsigned char *clock_params)
+static void set_platinum_clock(struct fb_info_platinum *info)
 {
-//    FUNCID;
+	volatile struct cmap_regs *cmap_regs = info->cmap_regs;
+	struct platinum_regvals	*init;
+
+	init = platinum_reg_init[info->current_par.vmode-1];
+
 	STORE_D2(6, 0xc6);
-	out_8(&p->cmap_regs->addr,3+32);
-	if (in_8(&p->cmap_regs->d2) == 2) {
-		STORE_D2(7, clock_params[0]);
-		STORE_D2(8, clock_params[1]);
+	out_8(&cmap_regs->addr,3+32);
+
+	if (in_8(&cmap_regs->d2) == 2) {
+		STORE_D2(7, init->clock_params[info->clktype][0]);
+		STORE_D2(8, init->clock_params[info->clktype][1]);
 		STORE_D2(3, 3);
 	} else {
-		STORE_D2(4, clock_params[0]);
-		STORE_D2(5, clock_params[1]);
+		STORE_D2(4, init->clock_params[info->clktype][0]);
+		STORE_D2(5, init->clock_params[info->clktype][1]);
 		STORE_D2(3, 2);
 	}
 
@@ -464,131 +510,155 @@
 }
 
 
-__initfunc(static void init_platinum(struct fb_info_platinum *p))
-{
-	struct fb_par_platinum *par = &p->par;
-
-//    FUNCID;
-	p->sense = read_platinum_sense(p);
-	printk("Monitor sense value = 0x%x, ", p->sense);
-	/* Try to pick a video mode out of NVRAM if we have one. */
-	par->vmode = nvram_read_byte(NV_VMODE);
-	if(par->vmode <= 0 || par->vmode > VMODE_MAX || !platinum_reg_init[par->vmode - 1])
-		par->vmode = VMODE_CHOOSE;
-	if(par->vmode == VMODE_CHOOSE)
-		par->vmode = mac_map_monitor_sense(p->sense);
-	if(!platinum_reg_init[par->vmode - 1])
-		par->vmode = VMODE_640_480_67;
-
-	par->cmode = nvram_read_byte(NV_CMODE);
-	if(par->cmode < CMODE_8 || par->cmode > CMODE_32)
-		par->cmode = CMODE_8;
-	/*
-	 * Reduce the pixel size if we don't have enough VRAM.
-	 */
-	while(par->cmode > CMODE_8 && platinum_vram_reqd(par->vmode, par->cmode) > p->total_vram)
-		par->cmode--;
-	
-	printk("using video mode %d and color mode %d.\n", par->vmode, par->cmode);
-	
-	par->vxres = par->xres = vmode_attrs[par->vmode - 1].hres;
-	par->vyres = par->yres = vmode_attrs[par->vmode - 1].vres;
-	par->xoffset = par->yoffset = 0;
-	
-	platinum_par_to_all(p, 1);
-	
-	if (register_framebuffer(&p->info) < 0) {
-		kfree(p);
-		return;
-	}
-	platinum_set_hardware(p);
-	
-	printk("fb%d: platinum display adapter\n", GET_FB_IDX(p->info.node));	
-}
-
 /* Now how about actually saying, Make it so! */
 /* Some things in here probably don't need to be done each time. */
-static void platinum_set_hardware(struct fb_info_platinum *p)
+static void platinum_set_par(const struct fb_par_platinum *par, struct fb_info_platinum *info)
 {
-	struct platinum_regvals	*init;
-	int			i, dtype, clkmode;
-	int			vmode, cmode;
+	volatile struct platinum_regs	*platinum_regs = info->platinum_regs;
+	volatile struct cmap_regs	*cmap_regs = info->cmap_regs;
+	struct platinum_regvals		*init;
+	int				i;
+	int				vmode, cmode;
 	
-//    FUNCID;
-	vmode = p->par.vmode;
-	cmode = p->par.cmode;
+	info->current_par = *par;
+
+	vmode = par->vmode;
+	cmode = par->cmode;
 
 	init = platinum_reg_init[vmode - 1];
 
 	/* Initialize display timing registers */
-	out_be32(&p->platinum_regs->reg[24].r, 7);	/* turn display off */
+	out_be32(&platinum_regs->reg[24].r, 7);	/* turn display off */
 
 	for (i = 0; i < 26; ++i)
-		out_be32(&p->platinum_regs->reg[i+32].r, init->regs[i]);
-	out_be32(&p->platinum_regs->reg[26+32].r, (p->total_vram == 0x100000 ?
-						   init->offset[cmode] + 4 - cmode :
-						   init->offset[cmode]));
-	out_be32(&p->platinum_regs->reg[16].r, (unsigned) p->frame_buffer_phys + init->fb_offset);
-	out_be32(&p->platinum_regs->reg[18].r, init->pitch[cmode]);
-	out_be32(&p->platinum_regs->reg[19].r, (p->total_vram == 0x100000 ?
-						init->mode[cmode+1] :
-						init->mode[cmode]));
-	out_be32(&p->platinum_regs->reg[20].r, (p->total_vram == 0x100000 ? 0x11 : 0x1011));
-	out_be32(&p->platinum_regs->reg[21].r, 0x100);
-	out_be32(&p->platinum_regs->reg[22].r, 1);
-	out_be32(&p->platinum_regs->reg[23].r, 1);
-	out_be32(&p->platinum_regs->reg[26].r, 0xc00);
-	out_be32(&p->platinum_regs->reg[27].r, 0x235);
-	/* out_be32(&p->platinum_regs->reg[27].r, 0x2aa); */
+		out_be32(&platinum_regs->reg[i+32].r, init->regs[i]);
+
+	out_be32(&platinum_regs->reg[26+32].r, (info->total_vram == 0x100000 ?
+						init->offset[cmode] + 4 - cmode :
+						init->offset[cmode]));
+	out_be32(&platinum_regs->reg[16].r, (unsigned) info->frame_buffer_phys + 0x1000 - 0x10);
+	out_be32(&platinum_regs->reg[18].r, init->pitch[cmode]);
+	out_be32(&platinum_regs->reg[19].r, (info->total_vram == 0x100000 ?
+					     init->mode[cmode+1] :
+					     init->mode[cmode]));
+	out_be32(&platinum_regs->reg[20].r, (info->total_vram == 0x100000 ? 0x11 : 0x1011));
+	out_be32(&platinum_regs->reg[21].r, 0x100);
+	out_be32(&platinum_regs->reg[22].r, 1);
+	out_be32(&platinum_regs->reg[23].r, 1);
+	out_be32(&platinum_regs->reg[26].r, 0xc00);
+	out_be32(&platinum_regs->reg[27].r, 0x235);
+	/* out_be32(&platinum_regs->reg[27].r, 0x2aa); */
 
-	STORE_D2(0, (p->total_vram == 0x100000 ?
+	STORE_D2(0, (info->total_vram == 0x100000 ?
 		     init->dacula_ctrl[cmode] & 0xf :
 		     init->dacula_ctrl[cmode]));
 	STORE_D2(1, 4);
 	STORE_D2(2, 0);
-	/*
-	 * Try to determine whether we have an old or a new DACula.
-	 */
-	out_8(&p->cmap_regs->addr, 0x40);
-	dtype = in_8(&p->cmap_regs->d2);
-	switch (dtype) {
-	case 0x3c:
-		clkmode = 1;
-		break;
-	case 0x84:
-		clkmode = 0;
-		break;
-	default:
-		clkmode = 0;
-		printk("Unknown DACula type: %x\n", dtype);
-	}
 
-	set_platinum_clock(p, init->clock_params[clkmode]);
+	set_platinum_clock(info);
 
-	out_be32(&p->platinum_regs->reg[24].r, 0);	/* turn display on */
+	out_be32(&platinum_regs->reg[24].r, 0);	/* turn display on */
 
 #ifdef CONFIG_FB_COMPAT_XPMAC
-	/* And let the world know the truth. */
-	if (!console_fb_info || console_fb_info == &p->info) {
-		display_info.height = p->var.yres;
-		display_info.width = p->var.xres;
+	if (console_fb_info == &info->fb_info) {
+		display_info.height = par->yres;
+		display_info.width = par->xres;
 		display_info.depth = ( (cmode == CMODE_32) ? 32 :
 				      ((cmode == CMODE_16) ? 16 : 8));
-		display_info.pitch = p->fix.line_length;
+		display_info.pitch = vmode_attrs[vmode-1].hres * (1<<cmode) + 0x20;
 		display_info.mode = vmode;
 		strncpy(display_info.name, "platinum",
 			sizeof(display_info.name));
-		display_info.fb_address = p->frame_buffer_phys
-					+ init->fb_offset
-					+ 0x10;
-		display_info.cmap_adr_address = p->cmap_regs_phys;
-		display_info.cmap_data_address = p->cmap_regs_phys + 0x30;
-		display_info.disp_reg_address = p->platinum_regs_phys;
-		console_fb_info = &p->info;
+		display_info.fb_address = info->frame_buffer_phys + 0x1000;
+		display_info.cmap_adr_address = info->cmap_regs_phys;
+		display_info.cmap_data_address = info->cmap_regs_phys + 0x30;
+		display_info.disp_reg_address = info->platinum_regs_phys;
+		
 	}
 #endif /* CONFIG_FB_COMPAT_XPMAC */
 }
 
+
+__initfunc(static int init_platinum(struct fb_info_platinum *info))
+{
+	struct fb_var_screeninfo var;
+	struct display *disp;
+	int sense;
+	int j,k;
+
+	sense = read_platinum_sense(info);
+	printk(KERN_INFO "Monitor sense value = 0x%x, ", sense);
+
+	if (default_vmode == VMODE_NVRAM) {
+		default_vmode = nvram_read_byte(NV_VMODE);
+		if (default_vmode <= 0 || default_vmode > VMODE_MAX ||
+		    !platinum_reg_init[default_vmode-1])
+			default_vmode = VMODE_CHOOSE;
+	}
+	if (default_vmode == VMODE_CHOOSE) {
+		default_vmode = mac_map_monitor_sense(sense);
+	}
+	if (default_vmode <= 0 || default_vmode > VMODE_MAX)
+		default_vmode = VMODE_640_480_60;
+	if (default_cmode == CMODE_NVRAM)
+		default_cmode = nvram_read_byte(NV_CMODE);
+	if (default_cmode < CMODE_8 || default_cmode > CMODE_32)
+		default_cmode = CMODE_8;
+	/*
+	 * Reduce the pixel size if we don't have enough VRAM.
+	 */
+	while(default_cmode > CMODE_8 && platinum_vram_reqd(default_vmode, default_cmode) > info->total_vram)
+		default_cmode--;
+
+	printk("using video mode %d and color mode %d.\n", default_vmode, default_cmode);
+
+	mac_vmode_to_var(default_vmode, default_cmode, &var);
+
+	if (platinum_var_to_par(&var, &info->default_par, info)) {
+		printk(KERN_ERR "platinumfb: can't set default video mode\n");
+		return 0;
+	}
+
+	disp = &info->disp;
+
+	strcpy(info->fb_info.modename, "platinum");
+	info->fb_info.node = -1;
+	info->fb_info.fbops = &platinumfb_ops;
+	info->fb_info.disp = disp;
+	strcpy(info->fb_info.fontname, fontname);
+	info->fb_info.changevar = NULL;
+	info->fb_info.switch_con = &platinum_switch;
+	info->fb_info.updatevar = &platinum_updatevar;
+	info->fb_info.blank = &platinum_blank;
+
+	for (j = 0; j < 16; j++) {
+		k = color_table[j];
+		info->palette[j].red = default_red[k];
+		info->palette[j].green = default_grn[k];
+		info->palette[j].blue = default_blu[k];
+	}
+
+#ifdef FBCON_HAS_CFB8
+	info->disp8 = fbcon_cfb8;
+#endif
+#ifdef FBCON_HAS_CFB16
+	info->disp16 = fbcon_cfb16;
+#endif
+#ifdef FBCON_HAS_CFB32
+	info->disp32 = fbcon_cfb32;
+#endif
+
+	platinum_set_var(&var, -1, &info->fb_info);
+
+	if (register_framebuffer(&info->fb_info) < 0)
+		return 0;
+
+	printk(KERN_INFO "fb%d: platinum frame buffer device\n",
+	       GET_FB_IDX(info->fb_info.node));
+
+	return 1;
+}
+
 __initfunc(void platinum_init(void))
 {
 #ifndef CONFIG_FB_OF
@@ -600,17 +670,27 @@
 #endif /* CONFIG_FB_OF */
 }
 
+#ifdef __powerpc__
+#define invalidate_cache(addr) \
+	asm volatile("eieio; dcbi 0,%1" \
+	: "=m" (*(addr)) : "r" (addr) : "memory");
+#else
+#define invalidate_cache(addr)
+#endif
+
 __initfunc(void platinum_of_init(struct device_node *dp))
 {
-	struct fb_info_platinum	*p;
+	struct fb_info_platinum	*info;
 	unsigned long		addr, size;
 	int			i, bank0, bank1, bank2, bank3;
-//FUNCID;	
+
 	if(dp->n_addrs != 2)
 		panic("expecting 2 address for platinum (got %d)", dp->n_addrs);
-	p = kmalloc(sizeof(*p), GFP_ATOMIC);
-	if (p == 0)
+
+	info = kmalloc(sizeof(*info), GFP_ATOMIC);
+	if (info == 0)
 		return;
+	memset(info, 0, sizeof(*info));
 
 	/* Map in frame buffer and registers */
 	for (i = 0; i < dp->n_addrs; ++i) {
@@ -618,47 +698,67 @@
 		size = dp->addrs[i].size;
 		if (size >= 0x400000) {
 			/* frame buffer - map only 4MB */
-			p->frame_buffer_phys = addr;
-			p->frame_buffer = __ioremap(addr, 0x400000, _PAGE_WRITETHRU);
-			p->base_frame_buffer = p->frame_buffer;
+			info->frame_buffer_phys = addr;
+			info->frame_buffer = __ioremap(addr, 0x400000, _PAGE_WRITETHRU);
+			info->base_frame_buffer = info->frame_buffer;
 		} else {
 			/* registers */
-			p->platinum_regs_phys = addr;
-			p->platinum_regs = ioremap(addr, size);
+			info->platinum_regs_phys = addr;
+			info->platinum_regs = ioremap(addr, size);
 		}
 	}
-	p->cmap_regs_phys = 0xf301b000;	/* XXX not in prom? */
-	p->cmap_regs = ioremap(p->cmap_regs_phys, 0x1000);
+
+	info->cmap_regs_phys = 0xf301b000;	/* XXX not in prom? */
+	info->cmap_regs = ioremap(info->cmap_regs_phys, 0x1000);
 
 	/* Grok total video ram */
-	out_be32(&p->platinum_regs->reg[16].r, (unsigned)p->frame_buffer_phys);
-	out_be32(&p->platinum_regs->reg[20].r, 0x1011);	/* select max vram */
-	out_be32(&p->platinum_regs->reg[24].r, 0);	/* switch in vram */
-	eieio();
-	p->frame_buffer[0x100000] = 0x34;
-	asm volatile("eieio; dcbi 0,%0" : : "r" (&p->frame_buffer[0x100000]) : "memory");
-	p->frame_buffer[0x200000] = 0x56;
-	asm volatile("eieio; dcbi 0,%0" : : "r" (&p->frame_buffer[0x200000]) : "memory");
-	p->frame_buffer[0x300000] = 0x78;
-	asm volatile("eieio; dcbi 0,%0" : : "r" (&p->frame_buffer[0x300000]) : "memory");
+	out_be32(&info->platinum_regs->reg[16].r, (unsigned)info->frame_buffer_phys);
+	out_be32(&info->platinum_regs->reg[20].r, 0x1011);	/* select max vram */
+	out_be32(&info->platinum_regs->reg[24].r, 0);	/* switch in vram */
+
+	info->base_frame_buffer[0x100000] = 0x34;
+	info->base_frame_buffer[0x100008] = 0x0;
+	invalidate_cache(&info->base_frame_buffer[0x100000]);
+	info->base_frame_buffer[0x200000] = 0x56;
+	info->base_frame_buffer[0x200008] = 0x0;
+	invalidate_cache(&info->base_frame_buffer[0x200000]);
+	info->base_frame_buffer[0x300000] = 0x78;
+	info->base_frame_buffer[0x300008] = 0x0;
+	invalidate_cache(&info->base_frame_buffer[0x300000]);
 	bank0 = 1; /* builtin 1MB vram, always there */
-	bank1 = p->frame_buffer[0x100000] == 0x34;
-	bank2 = p->frame_buffer[0x200000] == 0x56;
-	bank3 = p->frame_buffer[0x300000] == 0x78;
-	p->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x100000;
-	printk("Total VRAM = %dMB\n", p->total_vram / 1024 / 1024);
+	bank1 = info->base_frame_buffer[0x100000] == 0x34;
+	bank2 = info->base_frame_buffer[0x200000] == 0x56;
+	bank3 = info->base_frame_buffer[0x300000] == 0x78;
+	info->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x100000;
+	printk(KERN_INFO "Total VRAM = %dMB %d%d%d%d\n", (int) (info->total_vram / 1024 / 1024), bank3, bank2, bank1, bank0);
 
-//	p->frame_buffer = p->base_frame_buffer
-//			+ platinum_reg_init[p->par.vmode-1]->fb_offset;
+	/*
+	 * Try to determine whether we have an old or a new DACula.
+	 */
+	out_8(&info->cmap_regs->addr, 0x40);
+	info->dactype = in_8(&info->cmap_regs->d2);
+	switch (info->dactype) {
+	case 0x3c:
+		info->clktype = 1;
+		break;
+	case 0x84:
+		info->clktype = 0;
+		break;
+	default:
+		info->clktype = 0;
+		printk(KERN_INFO "Unknown DACula type: %x\n", info->dactype);
+		break;
+	}
+
+	if (!init_platinum(info)) {
+		kfree(info);
+		return;
+	}
 
 #ifdef CONFIG_FB_COMPAT_XPMAC
-#if 0
-	console_set_cmap_ptr = platinum_set_cmap;
-	console_setmode_ptr = platinum_console_setmode;
+	if (!console_fb_info)
+		console_fb_info = &info->fb_info;
 #endif
-#endif /* CONFIG_FB_COMPAT_XPMAC */
-
-	init_platinum(p);
 }
 
 /*
@@ -666,387 +766,141 @@
  * Note that this can be called before calibrate_delay,
  * so we can't use udelay.
  */
-static int read_platinum_sense(struct fb_info_platinum *p)
+static int read_platinum_sense(struct fb_info_platinum *info)
 {
+	volatile struct platinum_regs *platinum_regs = info->platinum_regs;
 	int sense;
 
-	out_be32(&p->platinum_regs->reg[23].r, 7);	/* turn off drivers */
+	out_be32(&platinum_regs->reg[23].r, 7);	/* turn off drivers */
 	__delay(2000);
-	sense = (~in_be32(&p->platinum_regs->reg[23].r) & 7) << 8;
+	sense = (~in_be32(&platinum_regs->reg[23].r) & 7) << 8;
 
 	/* drive each sense line low in turn and collect the other 2 */
-	out_be32(&p->platinum_regs->reg[23].r, 3);	/* drive A low */
+	out_be32(&platinum_regs->reg[23].r, 3);	/* drive A low */
 	__delay(2000);
-	sense |= (~in_be32(&p->platinum_regs->reg[23].r) & 3) << 4;
-	out_be32(&p->platinum_regs->reg[23].r, 5);	/* drive B low */
+	sense |= (~in_be32(&platinum_regs->reg[23].r) & 3) << 4;
+	out_be32(&platinum_regs->reg[23].r, 5);	/* drive B low */
 	__delay(2000);
-	sense |= (~in_be32(&p->platinum_regs->reg[23].r) & 4) << 1;
-	sense |= (~in_be32(&p->platinum_regs->reg[23].r) & 1) << 2;
-	out_be32(&p->platinum_regs->reg[23].r, 6);	/* drive C low */
+	sense |= (~in_be32(&platinum_regs->reg[23].r) & 4) << 1;
+	sense |= (~in_be32(&platinum_regs->reg[23].r) & 1) << 2;
+	out_be32(&platinum_regs->reg[23].r, 6);	/* drive C low */
 	__delay(2000);
-	sense |= (~in_be32(&p->platinum_regs->reg[23].r) & 6) >> 1;
+	sense |= (~in_be32(&platinum_regs->reg[23].r) & 6) >> 1;
 
-	out_be32(&p->platinum_regs->reg[23].r, 7);	/* turn off drivers */
+	out_be32(&platinum_regs->reg[23].r, 7);	/* turn off drivers */
 
 	return sense;
 }
 
-#if 0
 /* This routine takes a user-supplied var, and picks the best vmode/cmode from it. */
-static int platinum_var_to_par(struct fb_var_screeninfo *var, 
-	struct fb_par_platinum *par, const struct fb_info *fb_info)
-{
-	int xres = var->xres;
-	int yres = var->yres;
-	int bpp = var->bits_per_pixel;
-	
-	struct platinum_regvals *init;
-	struct fb_info_platinum *p = (struct fb_info_platinum *) fb_info;
-
-//    FUNCID;
-    /*
-     *  Get the video params out of 'var'. If a value doesn't fit, round it up,
-     *  if it's too big, return -EINVAL.
-     *
-     *  Suggestion: Round up in the following order: bits_per_pixel, xres,
-     *  yres, xres_virtual, yres_virtual, xoffset, yoffset, grayscale,
-     *  bitfields, horizontal timing, vertical timing.
-     */
-	/* swiped by jonh from atyfb.c */
-	if (xres <= 512 && yres <= 384)
-		par->vmode = VMODE_512_384_60;		 /* 512x384, 60Hz */
-	else if (xres <= 640 && yres <= 480)
-		par->vmode = VMODE_640_480_67;		/* 640x480, 67Hz */
-	else if (xres <= 640 && yres <= 870)
-		par->vmode = VMODE_640_870_75P;		/* 640x870, 75Hz (portrait) */
-	else if (xres <= 768 && yres <= 576)
-		par->vmode = VMODE_768_576_50I;		/* 768x576, 50Hz (PAL full frame) */
-	else if (xres <= 800 && yres <= 600)
-		par->vmode = VMODE_800_600_75;		/* 800x600, 75Hz */
-	else if (xres <= 832 && yres <= 624)
-		par->vmode = VMODE_832_624_75;		/* 832x624, 75Hz */
-	else if (xres <= 1024 && yres <= 768)
-		par->vmode = VMODE_1024_768_75;		/* 1024x768, 75Hz */
-	else if (xres <= 1152 && yres <= 870)
-		par->vmode = VMODE_1152_870_75;		/* 1152x870, 75Hz */
-	else if (xres <= 1280 && yres <= 960)
-		par->vmode = VMODE_1280_960_75;		/* 1280x960, 75Hz */
-	else if (xres <= 1280 && yres <= 1024)
-		par->vmode = VMODE_1280_1024_75;	/* 1280x1024, 75Hz */
-	else {
-		printk(KERN_ERR "Bad  resolution in platinum_var_to_par()!\n");
+static int platinum_var_to_par(const struct fb_var_screeninfo *var, 
+			       struct fb_par_platinum *par,
+			       const struct fb_info_platinum *info)
+{
+	if(mac_var_to_vmode(var, &par->vmode, &par->cmode) != 0) {
+		printk(KERN_ERR "platinum_var_to_par: mac_var_to_vmode unsuccessful.\n");
+		printk(KERN_ERR "platinum_var_to_par: var->xres = %d\n", var->xres);
+		printk(KERN_ERR "platinum_var_to_par: var->yres = %d\n", var->yres);
+		printk(KERN_ERR "platinum_var_to_par: var->xres_virtual = %d\n", var->xres_virtual);
+		printk(KERN_ERR "platinum_var_to_par: var->yres_virtual = %d\n", var->yres_virtual);
+		printk(KERN_ERR "platinum_var_to_par: var->bits_per_pixel = %d\n", var->bits_per_pixel);
+		printk(KERN_ERR "platinum_var_to_par: var->pixclock = %d\n", var->pixclock);
+		printk(KERN_ERR "platinum_var_to_par: var->vmode = %d\n", var->vmode);
 		return -EINVAL;
 	}
-	xres = vmode_attrs[par->vmode - 1].hres;
-	yres = vmode_attrs[par->vmode - 1].vres;
-
-/*
-	if (var->xres_virtual <= xres)
-		par->vxres = xres;
-	else
-		par->vxres = (var->xres_virtual+7) & ~7;
-	if (var->yres_virtual <= yres)
-		par->vyres = yres;
-	else
-		par->vyres = var->yres_virtual;
 
-	par->xoffset = (var->xoffset+7) & ~7;
-	par->yoffset = var->yoffset;
-	if (par->xoffset+xres > par->vxres || par->yoffset+yres > par->vyres)
+	if(!platinum_reg_init[par->vmode-1]) {
+		printk(KERN_ERR "platinum_var_to_par, vmode %d not valid.\n", par->vmode);
 		return -EINVAL;
-*/
+	}
 
-	/* I'm too chicken to think about virtual	*/
-	/* resolutions just yet. Bok bok.			*/
-	
-	/* And I'm too chicken to even figure out what they are.  Awk awk. [danj] */
-	if (var->xres_virtual > xres || var->yres_virtual > yres
-		|| var->xoffset != 0 || var->yoffset != 0) {
-		printk(KERN_ERR "Bad  virtual resolution in platinum_var_to_par()!\n");
+	if (platinum_vram_reqd(par->vmode, par->cmode) > info->total_vram) {
+		printk(KERN_ERR "platinum_var_to_par, not enough ram for vmode %d, cmode %d.\n", par->vmode, par->cmode);
 		return -EINVAL;
 	}
 
-	par->xres = xres;
-	par->yres = yres;
-	par->vxres = xres;
-	par->vyres = yres;
+	par->xres = vmode_attrs[par->vmode-1].hres;
+	par->yres = vmode_attrs[par->vmode-1].vres;
 	par->xoffset = 0;
 	par->yoffset = 0;
-
-	if (bpp <= 8)
-		par->cmode = CMODE_8;
-	else if (bpp <= 16)
-		par->cmode = CMODE_16;
-	else if (bpp <= 32)
-		par->cmode = CMODE_32;
-	else {
-		printk(KERN_ERR "Bad color mode in platinum_var_to_par()!\n");
-		return -EINVAL;
-	}
-
-	if (platinum_vram_reqd(par->vmode, par->cmode) > p->total_vram) {
-		printk(KERN_ERR "Bad vram size requested in platinum_var_to_par()!\n");
-		return -EINVAL;
-	}
-	/* Check if we know about the wanted video mode */
-	init = platinum_reg_init[par->vmode-1];
-	if (init == NULL) {
-		/* I'm not sure if platinum has any specific requirements --	*/
-		/* if we have a regvals struct, we're good to go?		*/
-		printk(KERN_ERR "platinum_reg_init failed platinum_var_to_par()!\n");
-		return -EINVAL;
-	}
-
-	return 0;
-}
-#else
-/* This routine takes a user-supplied var, and picks the best vmode/cmode from it. */
-static int platinum_var_to_par(struct fb_var_screeninfo *var, 
-	struct fb_par_platinum *par, const struct fb_info *fb_info)
-{
-	struct fb_info_platinum *p = (struct fb_info_platinum *) fb_info;
+	par->vxres = par->xres;
+	par->vyres = par->yres;
 	
-//    FUNCID;
-	if(mac_var_to_vmode(var, &par->vmode, &par->cmode) != 0)
-		return -EINVAL;
-	par->xres = par->vxres = vmode_attrs[par->vmode - 1].hres;
-	par->yres = par->vyres = vmode_attrs[par->vmode - 1].vres;
-	par->xoffset = par->yoffset = 0;
-	
-	if (platinum_vram_reqd(par->vmode, par->cmode) > p->total_vram)
-		return -EINVAL;
-
-	/* Check if we know about the wanted video mode */
-	if(!platinum_reg_init[par->vmode-1]) {
-		/* I'm not sure if platinum has any specific requirements --	*/
-		/* if we have a regvals struct, we're good to go?		*/
-		return -EINVAL;
-	}
 	return 0;
 }
-#endif
 
-#if 0
-static void platinum_par_to_var(struct fb_par_platinum *par, struct fb_var_screeninfo *var)
+static int platinum_par_to_var(struct fb_var_screeninfo *var,
+			       const struct fb_par_platinum *par,
+			       const struct fb_info_platinum *info)
 {
-	memset(var, 0, sizeof(*var));
-	var->xres = vmode_attrs[par->vmode - 1].hres;
-	var->yres = vmode_attrs[par->vmode - 1].vres;
-	var->xres_virtual = var->xres;
-	var->yres_virtual = var->yres;	/* For now. */
-	var->xoffset = par->xoffset;
-	var->yoffset = par->yoffset;
-	var->grayscale = 0;
-	
-	if(par->cmode != CMODE_8 && par->cmode != CMODE_16 && par->cmode != CMODE_32) {
-		printk(KERN_ERR "Bad color mode in platinum_par_to_var()!\n");
-		par->cmode = CMODE_8;
-	}
-	switch(par->cmode) {
-	case CMODE_8:
-		var->bits_per_pixel = 8;
-		var->red.offset = 0;
-		var->red.length = 8;
-		var->green.offset = 0;
-		var->green.length = 8;
-		var->blue.offset = 0;
-		var->blue.length = 8;
-		var->transp.offset = 0;
-		var->transp.length = 0;
-		break;
-	case CMODE_16:	/* RGB 555 */
-		var->bits_per_pixel = 16;
-		var->red.offset = 10;
-		var->red.length = 5;
-		var->green.offset = 5;
-		var->green.length = 5;
-		var->blue.offset = 0;
-		var->blue.length = 5;
-		var->transp.offset = 0;
-		var->transp.length = 0;
-		break;
-	case CMODE_32:	/* RGB 888 */
-		var->bits_per_pixel = 32;
-		var->red.offset = 16;
-		var->red.length = 8;
-		var->green.offset = 8;
-		var->green.length = 8;
-		var->blue.offset = 0;
-		var->blue.length = 8;
-		var->transp.offset = 24;
-		var->transp.length = 8;
-		break;
-	}
-	var->red.msb_right = 0;
-	var->green.msb_right = 0;
-	var->blue.msb_right = 0;
-	var->transp.msb_right = 0;
-	var->nonstd = 0;
-	var->activate = 0;
-	var->height = -1;
-	var->width = -1;
-	var->vmode = FB_VMODE_NONINTERLACED;
-
-	/* these are total guesses, copied right out of atyfb.c */
-	var->left_margin = var->right_margin = 64;
-	var->upper_margin = var->lower_margin = 32;
-	var->hsync_len = 8;
-	var->vsync_len = 8;
-	var->sync = 0;
-
-#if 1
-/* jonh's pixclocks...*/
-	/* no long long support in the kernel :-( */
-	/* this splittig trick will work if xres > 232 */
-	var->pixclock = 1000000000/
-	(var->left_margin+var->xres+var->right_margin+var->hsync_len);
-	var->pixclock *= 1000;
-	var->pixclock /= vmode_attrs[par->vmode-1].vfreq*
-	 (var->upper_margin+var->yres+var->lower_margin+var->vsync_len);
-#else
-/* danj's */
-	/* 10^12 * clock_params[0] / (3906400 * clock_params[1] * 2^clock_params[2]) */
-	/* (10^12 * clock_params[0] / (3906400 * clock_params[1])) >> clock_params[2] */
-	/* (255990.17 * clock_params[0] / clock_params[1]) >> clock_params[2] */
-	var->pixclock = 255990 * platinum_reg_init[par->vmode-1]->clock_params[0];
-	var->pixclock /= platinum_reg_init[par->vmode-1]->clock_params[1];
-	var->pixclock >>= platinum_reg_init[par->vmode-1]->clock_params[2];
-#endif
-}
-#else
-static inline void platinum_par_to_var(struct fb_par_platinum *par, struct fb_var_screeninfo *var)
-{
-//    FUNCID;
-	mac_vmode_to_var(par->vmode, par->cmode, var);
+	return mac_vmode_to_var(par->vmode, par->cmode, var);
 }
-#endif
 
-static void platinum_init_fix(struct fb_fix_screeninfo *fix, struct fb_info_platinum *p)
+static int platinum_encode_fix(struct fb_fix_screeninfo *fix,
+			       const struct fb_par_platinum *par,
+			       const struct fb_info_platinum *info)
 {
-//    FUNCID;
 	memset(fix, 0, sizeof(*fix));
 	strcpy(fix->id, "platinum");
-	fix->mmio_start = (char *)p->platinum_regs_phys;
+	fix->smem_start = (void *) (info->frame_buffer_phys + 0x1000);
+	fix->smem_len = (u32) info->total_vram - 0x1000;
+	fix->mmio_start = (char *) (info->platinum_regs_phys);
 	fix->mmio_len = 0x1000;
 	fix->type = FB_TYPE_PACKED_PIXELS;
-	
 	fix->type_aux = 0;
 	fix->ywrapstep = 0;
 	fix->xpanstep = 0;
 	fix->ypanstep = 0;
-}
-
-/* Fix must already be inited ^^^^^^^ */
-static void platinum_par_to_fix(struct fb_par_platinum *par, 
-				struct fb_fix_screeninfo *fix,
-				struct fb_info_platinum *p)
-{
-//    FUNCID;
-	fix->smem_start = (void *)(p->frame_buffer_phys);
-	fix->smem_len = platinum_vram_reqd(par->vmode, par->cmode);
-		/* Hmm, jonh used total_vram here. */
 	fix->visual = (par->cmode == CMODE_8) ?
 		FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR;
-//	fix->line_length = par->vxres << par->cmode;
-	fix->line_length = platinum_reg_init[par->vmode-1]->pitch[par->cmode];
-
-}
+	fix->line_length = vmode_attrs[par->vmode-1].hres * (1<<par->cmode) + 0x20;
 
-static void platinum_init_display(struct display *disp)
-{
-	memset(disp, 0, sizeof(*disp));
-	disp->type = /* fix->type */ FB_TYPE_PACKED_PIXELS;
-	disp->can_soft_blank = 1;
-	disp->scrollmode = SCROLL_YREDRAW;
-#if 0
-		disp->type_aux = fix->type_aux;
-		disp->cmap.red = NULL;	/* ??? danj */
-		disp->cmap.green = NULL;
-		disp->cmap.blue = NULL;
-		disp->cmap.transp = NULL;
-			/* Yeah, I realize I just set 0 = 0. */
-#endif
-}
-
-static void platinum_par_to_display(struct fb_par_platinum *par,
-  struct display *disp, struct fb_fix_screeninfo *fix, struct fb_info_platinum *p)
-{
-//    FUNCID;
-	disp->var = p->var;
-	disp->screen_base = (char *) p->frame_buffer
-			  + platinum_reg_init[par->vmode-1]->fb_offset
-			  + ((par->yres % 16) / 2) * fix->line_length + 0x10;
-	disp->visual = fix->visual;
-	disp->line_length = fix->line_length;
-
-	if(disp->scrollmode != SCROLL_YREDRAW) {
-		printk(KERN_ERR "Scroll mode not YREDRAW in platinum_par_to_display!!\n");
-		disp->scrollmode = SCROLL_YREDRAW;
-	}
-
-	switch(par->cmode) {
-#ifdef FBCON_HAS_CFB8
-	 case CMODE_8:
-	    disp->dispsw = &fbcon_cfb8;
-	    break;
-#endif
-#ifdef FBCON_HAS_CFB16
-	 case CMODE_16:
-	    disp->dispsw = &fbcon_cfb16;
-	    break;
-#endif
-#ifdef FBCON_HAS_CFB32
-	 case CMODE_32:
-	    disp->dispsw = &fbcon_cfb32;
-	    break;
-#endif
-	 default:
-	    disp->dispsw = NULL;
-	    break;
-	}
+	return 0;
 }
 
-static void platinum_init_info(struct fb_info *info, struct fb_info_platinum *p)
-{
-//    FUNCID;
-	strcpy(info->modename, p->fix.id);
-	info->node = -1;	/* ??? danj */
-	info->fbops = &platinumfb_ops;
-	info->disp = &p->disp;
-	info->fontname[0] = 0;
-	info->changevar = NULL;
-	info->switch_con = &platinum_switch;
-	info->updatevar = &platinum_updatevar;
-	info->blank = &platinum_blank;
-}
 
-/* danj: Oh, I HOPE I didn't miss anything major in here... */
-static void platinum_par_to_all(struct fb_info_platinum *p, int init)
+/* 
+ * Parse user speficied options (`video=platinumfb:')
+ */
+__initfunc(void platinum_setup(char *options, int *ints))
 {
-//    FUNCID;
-	if(init) {
-		platinum_init_fix(&p->fix, p);
-	}
-	platinum_par_to_fix(&p->par, &p->fix, p);
+	char *this_opt;
 
-	platinum_par_to_var(&p->par, &p->var);
+	if (!options || !*options)
+		return;
 
-	if(init) {
-		platinum_init_display(&p->disp);
-	}
-	platinum_par_to_display(&p->par, &p->disp, &p->fix, p);
-	
-	if(init) {
-		platinum_init_info(&p->info, p);
+	for (this_opt = strtok(options, ","); this_opt;
+	     this_opt = strtok(NULL, ",")) {
+		if (!strncmp(this_opt, "font:", 5)) {
+			char *p;
+			int i;
+
+			p = this_opt + 5;
+			for (i = 0; i < sizeof(fontname) - 1; i++)
+				if (!*p || *p == ' ' || *p == ',')
+					break;
+			memcpy(fontname, this_opt + 5, i);
+			fontname[i] = 0;
+		}
+		if (!strncmp(this_opt, "vmode:", 6)) {
+	    		int vmode = simple_strtoul(this_opt+6, NULL, 0);
+	    	if (vmode > 0 && vmode <= VMODE_MAX)
+			default_vmode = vmode;
+		} else if (!strncmp(this_opt, "cmode:", 6)) {
+			int depth = simple_strtoul(this_opt+6, NULL, 0);
+			switch (depth) {
+			 case 8:
+			    default_cmode = CMODE_8;
+			    break;
+			 case 15:
+			 case 16:
+			    default_cmode = CMODE_16;
+			    break;
+			 case 24:
+			 case 32:
+			    default_cmode = CMODE_32;
+			    break;
+			}
+		}
 	}
 }
-
-#if 0
-__initfunc(void platinum_setup(char *options, int *ints))
-{
-    /* Parse user speficied options (`video=platinumfb:') */
-	FUNCID;
-}
-
-#endif
-
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/platinumfb.h m68k/drivers/video/platinumfb.h
--- jes-2.1.115/drivers/video/platinumfb.h	Sun Aug  9 21:48:34 1998
+++ m68k/drivers/video/platinumfb.h	Wed Jul 29 00:09:33 1998
@@ -311,8 +311,6 @@
 	{{ 94, 5 + DIV16 }, { 48, 7 + DIV8 }}
 };
 
-#define VMODE_MAX           20
-
 static struct platinum_regvals *platinum_reg_init[VMODE_MAX] = {
 	&platinum_reg_init_1,
 	&platinum_reg_init_2,
@@ -366,34 +364,3 @@
 	{1280, 1024, 75}
 };
 
-/* this stuff should probably be shared by the various vmode-based	*/
-/* drivers in a vmode.h header.										*/
-
-#define VMODE_NVRAM		0	/* use value stored in nvram */
-#define VMODE_512_384_60I	1	/* 512x384, 60Hz interlaced (NTSC) */
-#define VMODE_512_384_60	2	/* 512x384, 60Hz */
-#define VMODE_640_480_50I	3	/* 640x480, 50Hz interlaced (PAL) */
-#define VMODE_640_480_60I	4	/* 640x480, 60Hz interlaced (NTSC) */
-#define VMODE_640_480_60	5	/* 640x480, 60Hz (VGA) */
-#define VMODE_640_480_67	6	/* 640x480, 67Hz */
-#define VMODE_640_870_75P	7	/* 640x870, 75Hz (portrait) */
-#define VMODE_768_576_50I	8	/* 768x576, 50Hz (PAL full frame) */
-#define VMODE_800_600_56	9	/* 800x600, 56Hz */
-#define VMODE_800_600_60	10	/* 800x600, 60Hz */
-#define VMODE_800_600_72	11	/* 800x600, 72Hz */
-#define VMODE_800_600_75	12	/* 800x600, 75Hz */
-#define VMODE_832_624_75	13	/* 832x624, 75Hz */
-#define VMODE_1024_768_60	14	/* 1024x768, 60Hz */
-#define VMODE_1024_768_70	15	/* 1024x768, 70Hz (or 72Hz?) */
-#define VMODE_1024_768_75V	16	/* 1024x768, 75Hz (VESA) */
-#define VMODE_1024_768_75	17	/* 1024x768, 75Hz */
-#define VMODE_1152_870_75	18	/* 1152x870, 75Hz */
-#define VMODE_1280_960_75	19	/* 1280x960, 75Hz */
-#define VMODE_1280_1024_75	20	/* 1280x1024, 75Hz */
-#define VMODE_MAX		20
-#define VMODE_CHOOSE		99	/* choose based on monitor sense */
-
-#define CMODE_NVRAM		-1	/* use value stored in nvram */
-#define CMODE_8			0	/* 8 bits/pixel */
-#define CMODE_16		1	/* 16 (actually 15) bits/pixel */
-#define CMODE_32		2	/* 32 (actually 24) bits/pixel */
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/promcon.c m68k/drivers/video/promcon.c
--- jes-2.1.115/drivers/video/promcon.c	Sun Aug  9 21:48:34 1998
+++ m68k/drivers/video/promcon.c	Mon Aug  3 19:49:04 1998
@@ -1,11 +1,10 @@
-/* $Id: promcon.c,v 1.10 1998/07/24 15:31:53 jj Exp $
+/* $Id: promcon.c,v 1.11 1998/08/03 15:29:35 davem Exp $
  * Console driver utilizing PROM sun terminal emulation
  *
  * Copyright (C) 1998  Eddie C. Dost  (ecd@skynet.be)
  * Copyright (C) 1998  Jakub Jelinek  (jj@ultra.linux.cz)
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/retz3fb.c m68k/drivers/video/retz3fb.c
--- jes-2.1.115/drivers/video/retz3fb.c	Sun Aug  9 21:48:38 1998
+++ m68k/drivers/video/retz3fb.c	Wed Aug 12 09:29:58 1998
@@ -20,8 +20,6 @@
  * for more details.
  */
 
-
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -141,7 +139,7 @@
 static char retz3fb_name[16] = "RetinaZ3";
 
 
-static unsigned char retz3_color_table [256][4];
+static unsigned char retz3_color_table [256][3];
 static unsigned long z3_mem;
 static unsigned long z3_fbmem;
 static unsigned long z3_size;
@@ -796,7 +794,6 @@
 			retz3_color_table [i][0] = i;
 			retz3_color_table [i][1] = i;
 			retz3_color_table [i][2] = i;
-			retz3_color_table [i][3] = 0;
 		}
 	}
 
@@ -821,7 +818,7 @@
 	}
 #endif
 
-	retz3_setcolreg (255, 56, 100, 160, 0, NULL /* unused */);
+	retz3_setcolreg (255, 56<<8, 100<<8, 160<<8, 0, NULL /* unused */);
 	retz3_setcolreg (254, 0, 0, 0, 0, NULL /* unused */);
 
 	return 0;
@@ -848,7 +845,7 @@
 	if (par->bpp == 8)
 		fix->visual = FB_VISUAL_PSEUDOCOLOR;
 	else
-		fix->visual = FB_VISUAL_DIRECTCOLOR;
+		fix->visual = FB_VISUAL_TRUECOLOR;
 
 	fix->xpanstep = 0;
 	fix->ypanstep = 0;
@@ -946,9 +943,7 @@
 
 
 /*
- *    Set a single color register. The values supplied are already
- *    rounded down to the hardware's capabilities (according to the
- *    entries in the var structure). Return != 0 for invalid regno.
+ *    Set a single color register. Return != 0 for invalid regno.
  */
 
 static int retz3_setcolreg(unsigned int regno, unsigned int red,
@@ -960,15 +955,18 @@
 	if (regno > 255)
 		return 1;
 
-	retz3_color_table [regno][0] = red & 0xff;
-	retz3_color_table [regno][1] = green & 0xff;
-	retz3_color_table [regno][2] = blue & 0xff;
-	retz3_color_table [regno][3] = transp;
+	red >>= 10;
+	green >>= 10;
+	blue >>= 10;
+
+	retz3_color_table [regno][0] = red;
+	retz3_color_table [regno][1] = green;
+	retz3_color_table [regno][2] = blue;
 
 	reg_w(VDAC_ADDRESS_W, regno);
-	reg_w(VDAC_DATA, (red & 0xff) >> 2);
-	reg_w(VDAC_DATA, (green & 0xff) >> 2);
-	reg_w(VDAC_DATA, (blue & 0xff) >> 2);
+	reg_w(VDAC_DATA, red);
+	reg_w(VDAC_DATA, green);
+	reg_w(VDAC_DATA, blue);
 
 	return 0;
 }
@@ -983,12 +981,17 @@
 			   unsigned int *green, unsigned int *blue,
 			   unsigned int *transp, struct fb_info *info)
 {
+	int t;
+
 	if (regno > 255)
 		return 1;
-	*red    = retz3_color_table [regno][0];
-	*green  = retz3_color_table [regno][1];
-	*blue   = retz3_color_table [regno][2];
-	*transp = retz3_color_table [regno][3];
+	t       = retz3_color_table [regno][0];
+	*red    = (t<<10) | (t<<4) | (t>>2);
+	t       = retz3_color_table [regno][1];
+	*green  = (t<<10) | (t<<4) | (t>>2);
+	t       = retz3_color_table [regno][2];
+	*blue   = (t<<10) | (t<<4) | (t>>2);
+	*transp = 0;
 	return 0;
 }
 
@@ -1011,9 +1014,9 @@
 	else
 		for (i = 0; i < 256; i++){
 			reg_w(VDAC_ADDRESS_W, i);
-			reg_w(VDAC_DATA, retz3_color_table [i][0] >> 2);
-			reg_w(VDAC_DATA, retz3_color_table [i][1] >> 2);
-			reg_w(VDAC_DATA, retz3_color_table [i][2] >> 2);
+			reg_w(VDAC_DATA, retz3_color_table [i][0]);
+			reg_w(VDAC_DATA, retz3_color_table [i][1]);
+			reg_w(VDAC_DATA, retz3_color_table [i][2]);
 		}
 }
 
@@ -1188,12 +1191,10 @@
 	if (con != currcon)
 		return;
 	if (fb_display[con].cmap.len)
-		fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-			    fbhw->setcolreg, info);
+		fb_set_cmap(&fb_display[con].cmap, 1, fbhw->setcolreg, info);
 	else
 		fb_set_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel),
-					    &fb_display[con].var, 1,
-					    fbhw->setcolreg, info);
+					    1, fbhw->setcolreg, info);
 }
 
 
@@ -1394,8 +1395,7 @@
 			    struct fb_info *info)
 {
 	if (con == currcon) /* current console? */
-		return(fb_get_cmap(cmap, &fb_display[con].var, kspc,
-				   fbhw->getcolreg, info));
+		return(fb_get_cmap(cmap, kspc, fbhw->getcolreg, info));
 	else if (fb_display[con].cmap.len) /* non default colormap? */
 		fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
 	else
@@ -1421,8 +1421,7 @@
 			return err;
 	}
 	if (con == currcon)              /* current console? */
-		return(fb_set_cmap(cmap, &fb_display[con].var, kspc,
-				   fbhw->setcolreg, info));
+		return(fb_set_cmap(cmap, kspc, fbhw->setcolreg, info));
 	else
 		fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
 	return 0;
@@ -1554,8 +1553,7 @@
 {
 	/* Do we have to save the colormap? */
 	if (fb_display[currcon].cmap.len)
-		fb_get_cmap(&fb_display[currcon].cmap,
-			    &fb_display[currcon].var, 1, fbhw->getcolreg,
+		fb_get_cmap(&fb_display[currcon].cmap, 1, fbhw->getcolreg,
 			    info);
 
 	do_fb_set_var(&fb_display[con].var, 1);
@@ -1633,7 +1631,7 @@
 static void fbcon_retz3_8_bmove(struct display *p, int sy, int sx, int dy, int dx,
 	                int height, int width)
 {
-	int fontwidth = p->fontwidth;
+	int fontwidth = fontwidth(p);
 
 	sx *= fontwidth;
 	dx *= fontwidth;
@@ -1641,11 +1639,11 @@
 
 	retz3_bitblt(&p->var,
 		     (unsigned short)sx,
-		     (unsigned short)(sy*p->fontheight),
+		     (unsigned short)(sy*fontheight(p)),
 		     (unsigned short)dx,
-		     (unsigned short)(dy*p->fontheight),
+		     (unsigned short)(dy*fontheight(p)),
 		     (unsigned short)width,
-		     (unsigned short)(height*p->fontheight),
+		     (unsigned short)(height*fontheight(p)),
 		     Z3BLTcopy,
 		     0xffff);
 }
@@ -1654,7 +1652,7 @@
 			sy, int sx, int height, int width)
 {
 	unsigned short col;
-	int fontwidth = p->fontwidth;
+	int fontwidth = fontwidth(p);
 
 	sx *= fontwidth;
 	width *= fontwidth;
@@ -1665,11 +1663,11 @@
 
 	retz3_bitblt(&p->var,
 		     (unsigned short)sx,
-		     (unsigned short)(sy*p->fontheight),
+		     (unsigned short)(sy*fontheight(p)),
 		     (unsigned short)sx,
-		     (unsigned short)(sy*p->fontheight),
+		     (unsigned short)(sy*fontheight(p)),
 		     (unsigned short)width,
-		     (unsigned short)(height*p->fontheight),
+		     (unsigned short)(height*fontheight(p)),
 		     Z3BLTset,
 		     col);
 }
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/sbusfb.c m68k/drivers/video/sbusfb.c
--- jes-2.1.115/drivers/video/sbusfb.c	Sun Aug  9 21:48:38 1998
+++ m68k/drivers/video/sbusfb.c	Wed Aug 12 09:30:02 1998
@@ -143,8 +143,10 @@
 	if (user) {	
 		if (fb->vtconsole != -1) {
 			vt_cons[fb->vtconsole]->vc_mode = KD_TEXT;
-			if (fb->mmaped)
+			if (fb->mmaped) {
+				fb->graphmode--;
 				sbusfb_clear_margin(&fb_display[fb->vtconsole], 0);
+			}
 		}
 		if (fb->reset)
 			fb->reset(fb);
@@ -247,7 +249,9 @@
 		fb->mmaped = 1;
 		if (fb->consolecnt && fb_display[lastconsole].fb_info == info) {
 			fb->vtconsole = lastconsole;
+			fb->graphmode++;
 			vt_cons [lastconsole]->vc_mode = KD_GRAPHICS;
+			vc_cons[lastconsole].d->vc_sw->con_cursor(vc_cons[lastconsole].d,CM_ERASE);
 		} else if (fb->unblank && !fb->blanked)
 			(*fb->unblank)(fb);
 	}
@@ -258,6 +262,8 @@
 {
 	struct fb_info_sbusfb *fb = sbusfbinfod(p);
 
+	if (fb->switch_from_graph)
+		(*fb->switch_from_graph)(fb);
 	if (fb->fill) {
 		unsigned short rects [16];
 
@@ -307,8 +313,6 @@
 				memset (q, attr_bgcol(p,s), size);
 		}
 	}
-	if (fb->switch_from_graph)
-		(*fb->switch_from_graph)(fb);
 }
 
 static void sbusfb_disp_setup(struct display *p)
@@ -457,28 +461,28 @@
 	case CM_MOVE:
 	case CM_DRAW:
 		if (!fb->hw_cursor_shown) {
-			fb->cursor.size.fbx = p->fontwidth;
-			fb->cursor.size.fby = p->fontheight;
+			fb->cursor.size.fbx = fontwidth(p);
+			fb->cursor.size.fby = fontheight(p);
 			fb->cursor.chot.fbx = 0;
 			fb->cursor.chot.fby = 0;
 			fb->cursor.enable = 1;
 			memset (fb->cursor.bits, 0, sizeof (fb->cursor.bits));
-			fb->cursor.bits[0][p->fontheight - 2] = (0xffffffff << (32 - p->fontwidth));
-			fb->cursor.bits[1][p->fontheight - 2] = (0xffffffff << (32 - p->fontwidth));
-			fb->cursor.bits[0][p->fontheight - 1] = (0xffffffff << (32 - p->fontwidth));
-			fb->cursor.bits[1][p->fontheight - 1] = (0xffffffff << (32 - p->fontwidth));
+			fb->cursor.bits[0][fontheight(p) - 2] = (0xffffffff << (32 - fontwidth(p)));
+			fb->cursor.bits[1][fontheight(p) - 2] = (0xffffffff << (32 - fontwidth(p)));
+			fb->cursor.bits[0][fontheight(p) - 1] = (0xffffffff << (32 - fontwidth(p)));
+			fb->cursor.bits[1][fontheight(p) - 1] = (0xffffffff << (32 - fontwidth(p)));
 			(*fb->setcursormap) (fb, hw_cursor_cmap, hw_cursor_cmap, hw_cursor_cmap);
 			(*fb->setcurshape) (fb);
 			fb->hw_cursor_shown = 1;
 		}
-		if (p->fontwidthlog)
-			fb->cursor.cpos.fbx = (x << p->fontwidthlog) + fb->x_margin;
+		if (fontwidthlog(p))
+			fb->cursor.cpos.fbx = (x << fontwidthlog(p)) + fb->x_margin;
 		else
-			fb->cursor.cpos.fbx = (x * p->fontwidth) + fb->x_margin;
-		if (p->fontheightlog)
-			fb->cursor.cpos.fby = (y << p->fontheightlog) + fb->y_margin;
+			fb->cursor.cpos.fbx = (x * fontwidth(p)) + fb->x_margin;
+		if (fontheightlog(p))
+			fb->cursor.cpos.fby = (y << fontheightlog(p)) + fb->y_margin;
 		else
-			fb->cursor.cpos.fby = (y * p->fontheight) + fb->y_margin;
+			fb->cursor.cpos.fby = (y * fontheight(p)) + fb->y_margin;
 		(*fb->setcursor)(fb);
 		break;
 	}
@@ -492,7 +496,7 @@
 			 struct fb_info *info)
 {
 	if (con == currcon) /* current console? */
-		return fb_get_cmap(cmap, &fb_display[con].var, kspc, sbusfb_getcolreg, info);
+		return fb_get_cmap(cmap, kspc, sbusfb_getcolreg, info);
 	else if (fb_display[con].cmap.len) /* non default colormap? */
 		fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
 	else
@@ -514,7 +518,7 @@
 			return err;
 	}
 	if (con == currcon) {			/* current console? */
-		err = fb_set_cmap(cmap, &fb_display[con].var, kspc, sbusfb_setcolreg, info);
+		err = fb_set_cmap(cmap, kspc, sbusfb_setcolreg, info);
 		if (!err) {
 			struct fb_info_sbusfb *fb = sbusfbinfo(info);
 			
@@ -678,7 +682,8 @@
 		(*fb->setcursor) (fb);
 		break;
 	default:
-		/* FIXME: Call here possible fb specific ioctl */
+		if (fb->ioctl)
+			return fb->ioctl(fb, cmd, arg);
 		return -EINVAL;
 	}		
 	return 0;
@@ -729,18 +734,18 @@
     
 	/* Do we have to save the colormap? */
 	if (fb_display[currcon].cmap.len)
-		fb_get_cmap(&fb_display[currcon].cmap, &fb_display[currcon].var, 1, sbusfb_getcolreg, info);
+		fb_get_cmap(&fb_display[currcon].cmap, 1, sbusfb_getcolreg, info);
 
 	lastconsole = info->display_fg->vc_num;
 	if (lastconsole != con && 
-	    (fb_display[lastconsole].fontwidth != fb_display[con].fontwidth ||
-	     fb_display[lastconsole].fontheight != fb_display[con].fontheight))
+	    (fontwidth(&fb_display[lastconsole]) != fontwidth(&fb_display[con]) ||
+	     fontheight(&fb_display[lastconsole]) != fontheight(&fb_display[con])))
 		fb->hw_cursor_shown = 0;
 	x_margin = (fb_display[con].var.xres_virtual - fb_display[con].var.xres) / 2;
 	y_margin = (fb_display[con].var.yres_virtual - fb_display[con].var.yres) / 2;
 	if (fb->margins)
 		fb->margins(fb, &fb_display[con], x_margin, y_margin);
-	if (fb->x_margin != x_margin || fb->y_margin != y_margin) {
+	if (fb->graphmode || fb->x_margin != x_margin || fb->y_margin != y_margin) {
 		fb->x_margin = x_margin; fb->y_margin = y_margin;
 		sbusfb_clear_margin(&fb_display[con], 0);
 	}
@@ -786,9 +791,10 @@
 
 	if (!fb->color_map || regno > 255)
 		return 1;
-	*red = fb->color_map CM(regno, 0);
-	*green = fb->color_map CM(regno, 1);
-	*blue = fb->color_map CM(regno, 2);
+	*red = (fb->color_map CM(regno, 0)<<8) || fb->color_map CM(regno, 0);
+	*green = (fb->color_map CM(regno, 1)<<8) || fb->color_map CM(regno, 1);
+	*blue = (fb->color_map CM(regno, 2)<<8) || fb->color_map CM(regno, 2);
+	*transp = 0;
 	return 0;
 }
 
@@ -806,6 +812,9 @@
 
 	if (!fb->color_map || regno > 255)
 		return 1;
+	red >>= 8;
+	green >>= 8;
+	blue >>= 8;
 	fb->color_map CM(regno, 0) = red;
 	fb->color_map CM(regno, 1) = green;
 	fb->color_map CM(regno, 2) = blue;
@@ -820,11 +829,10 @@
 	if (con != currcon)
 		return;
 	if (fb_display[con].cmap.len)
-		fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-			    sbusfb_setcolreg, info);
+		fb_set_cmap(&fb_display[con].cmap, 1, sbusfb_setcolreg, info);
 	else
 		fb_set_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel),
-			    &fb_display[con].var, 1, sbusfb_setcolreg, info);
+			    1, sbusfb_setcolreg, info);
 	if (fb->loadcmap)
 		(*fb->loadcmap)(fb, 0, 256);
 }
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/sbusfb.h m68k/drivers/video/sbusfb.h
--- jes-2.1.115/drivers/video/sbusfb.h	Sun Aug  9 21:48:38 1998
+++ m68k/drivers/video/sbusfb.h	Mon Aug  3 18:49:29 1998
@@ -36,6 +36,21 @@
 	struct tcx_tec *tec;
 	u32 *cplane;
 };
+struct fb_info_leo {
+	struct leo_lx_krn *lx_krn;
+	struct leo_lc_ss0_usr *lc_ss0_usr;
+	struct leo_ld_ss0 *ld_ss0;
+	struct leo_ld_ss1 *ld_ss1;
+	struct leo_cursor *cursor;
+	unsigned int extent;
+};
+struct fb_info_cgfourteen {
+	struct cg14_regs *regs;
+	struct cg14_cursor *cursor;
+	struct cg14_clut *clut;
+	int ramsize;
+	int mode;
+};
 
 struct cg_cursor {
 	short	enable;         /* cursor is enabled */
@@ -71,6 +86,8 @@
 		struct fb_info_bwtwo bw2;
 		struct fb_info_cgthree cg3;
 		struct fb_info_tcx tcx;
+		struct fb_info_leo leo;
+		struct fb_info_cgfourteen cg14;
 	} s;
 	unsigned char *color_map;
 	struct cg_cursor cursor;
@@ -82,6 +99,7 @@
 	int y_margin;
 	int vtconsole;
 	int consolecnt;
+	int graphmode;
 	int emulations[4];
 	struct sbus_mmap_map *mmap_map;
 	unsigned long physbase;
@@ -99,6 +117,7 @@
 	void (*fill)(struct fb_info_sbusfb *, struct display *, int, int, unsigned short *);
 	void (*switch_from_graph)(struct fb_info_sbusfb *);
 	void (*restore_palette)(struct fb_info_sbusfb *);
+	int (*ioctl)(struct fb_info_sbusfb *, unsigned int, unsigned long);
 };
 
 extern char *creatorfb_init(struct fb_info_sbusfb *);
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/skeletonfb.c m68k/drivers/video/skeletonfb.c
--- jes-2.1.115/drivers/video/skeletonfb.c	Sun Aug  9 21:48:38 1998
+++ m68k/drivers/video/skeletonfb.c	Wed Aug 12 09:30:02 1998
@@ -8,7 +8,6 @@
  * for more details.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -164,6 +163,7 @@
 {
     /*
      *  Read a single color register and split it into colors/transparent.
+     *  The return values must have a 16 bit magnitude.
      *  Return != 0 for invalid regno.
      */
 
@@ -176,9 +176,9 @@
 			 const struct fb_info *fb_info)
 {
     /*
-     *  Set a single color register. The values supplied are already rounded
-     *  down to the hardware's capabilities (according to the entries in the
-     *  `var' structure). Return != 0 for invalid regno.
+     *  Set a single color register. The values supplied have a 16 bit
+     *  magnitude.
+     *  Return != 0 for invalid regno.
      */
 
     if (regno < 16) {
@@ -186,17 +186,22 @@
 	 *  Make the first 16 colors of the palette available to fbcon
 	 */
 	if (is_cfb15)		/* RGB 555 */
-	    fbcon_cfb15_cmap[regno] = be16_to_cpu((red << 10) | (green << 5) |
-						  blue);
+	    fbcon_cfb16_cmap[regno] = ((red & 0xf800) >> 1) |
+				      ((green & 0xf800) >> 6) |
+				      ((blue & 0xf800) >> 11);
 	if (is_cfb16)		/* RGB 565 */
-	    fbcon_cfb16_cmap[regno] = be16_to_cpu((red << 11) | (green << 5) |
-						  blue);
+	    fbcon_cfb16_cmap[regno] = (red & 0xf800) |
+				      ((green & 0xfc00) >> 5) |
+				      ((blue & 0xf800) >> 11);
 	if (is_cfb24)		/* RGB 888 */
-	    fbcon_cfb24_cmap[regno] = be32_to_cpu((red << 16) | (green << 8) |
-						  blue);
+	    fbcon_cfb24_cmap[regno] = ((red & 0xff00) << 8) |
+				      (green & 0xff00) |
+				      ((blue & 0xff00) >> 8);
 	if (is_cfb32)		/* RGBA 8888 */
-	    fbcon_cfb32_cmap[regno] = be32_to_cpu((red << 24) | (green << 16) |
-						  (blue << 8) | transp);
+	    fbcon_cfb32_cmap[regno] = ((red & 0xff00) << 16) |
+				      ((green & 0xff00) << 8) |
+				      (blue & 0xff00) |
+				      ((transp & 0xff00) >> 8);
     }
     /* ... */
     return 0;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/tcxfb.c m68k/drivers/video/tcxfb.c
--- jes-2.1.115/drivers/video/tcxfb.c	Sun Aug  9 21:48:38 1998
+++ m68k/drivers/video/tcxfb.c	Mon Aug 10 19:22:01 1998
@@ -1,4 +1,4 @@
-/* $Id: tcxfb.c,v 1.1 1998/07/21 14:50:44 jj Exp $
+/* $Id: tcxfb.c,v 1.4 1998/08/10 08:26:14 jj Exp $
  * tcxfb.c: TCX 24/8bit frame buffer driver
  *
  * Copyright (C) 1996,1998 Jakub Jelinek (jj@ultra.linux.cz)
@@ -113,6 +113,7 @@
 		bt->color_map = fb->color_map CM(i,1) << 24;
 		bt->color_map = fb->color_map CM(i,2) << 24;
 	}
+	bt->addr = 0;
 }
 
 static void tcx_restore_palette (struct fb_info_sbusfb *fb)
@@ -211,7 +212,7 @@
 	struct display *disp = &fb->disp;
 	struct fbtype *type = &fb->type;
 	unsigned long phys = fb->sbdp->reg_addrs[0].phys_addr;
-	int lowdepth;
+	int lowdepth, i, j;
 
 #ifndef FBCON_HAS_CFB8
 	return NULL;
@@ -265,10 +266,22 @@
 	fb->blank = tcx_blank;
 	fb->unblank = tcx_unblank;
 	fb->reset = tcx_reset;
-	
+
 	fb->physbase = 0;
+	for (i = 0; i < 13; i++) {
+		/* tcx_mmap_map has to be sorted by voff, while
+		   order of phys registers from PROM differs a little
+		   bit. Here is the correction */
+		switch (i) {
+		case 10: j = 12; break;
+		case 11:
+		case 12: j = i - 1; break;
+		default: j = i; break;
+		}
+		tcx_mmap_map[i].poff = fb->sbdp->reg_addrs[j].phys_addr;
+	}
 	fb->mmap_map = tcx_mmap_map;
-	
+
 	/* Initialize Brooktree DAC */
 	fb->s.tcx.bt->addr = 0x04 << 24;         /* color planes */
 	fb->s.tcx.bt->control = 0xff << 24;
@@ -278,13 +291,13 @@
 	fb->s.tcx.bt->control = 0x73 << 24;
 	fb->s.tcx.bt->addr = 0x07 << 24;
 	fb->s.tcx.bt->control = 0x00 << 24;
-	
+
 	sprintf(idstring, "tcx at %x.%08lx Rev %d.%d %s", fb->iospace, phys,
 		    (fb->s.tcx.thc->thc_rev >> TCX_THC_REV_REV_SHIFT) & TCX_THC_REV_REV_MASK,
                     (fb->s.tcx.thc->thc_rev >> TCX_THC_REV_MINREV_SHIFT) & TCX_THC_REV_MINREV_MASK,
 		    lowdepth ? "8-bit only" : "24-bit depth");
 		    
 	tcx_reset(fb);
-		    
+
 	return idstring;
 }
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/tgafb.c m68k/drivers/video/tgafb.c
--- jes-2.1.115/drivers/video/tgafb.c	Sun Aug  9 21:48:38 1998
+++ m68k/drivers/video/tgafb.c	Wed Aug 12 19:29:33 1998
@@ -15,14 +15,12 @@
 
 /* KNOWN PROBLEMS/TO DO ===================================================== *
  *
- *	- How to set a single color register?
+ *	- How to set a single color register on 24-plane cards?
  *
  *	- Hardware cursor (useful for other graphics boards too)
  *
  * KNOWN PROBLEMS/TO DO ==================================================== */
 
-
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
@@ -406,8 +404,7 @@
 			  struct fb_info *info)
 {
     if (con == currcon) /* current console? */
-	return fb_get_cmap(cmap, &fb_display[con].var, kspc, tgafb_getcolreg,
-			   info);
+	return fb_get_cmap(cmap, kspc, tgafb_getcolreg, info);
     else if (fb_display[con].cmap.len) /* non default colormap? */
 	fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
     else
@@ -431,10 +428,10 @@
 	    return err;
     }
     if (con == currcon) {		/* current console? */
-	err = fb_set_cmap(cmap, &fb_display[con].var, kspc, tgafb_setcolreg,
-			  info);
+	err = fb_set_cmap(cmap, kspc, tgafb_setcolreg, info);
 #if 1
-	tga_update_palette();
+	if (tga_type != 0)
+		tga_update_palette();
 #endif
 	return err;
     } else
@@ -683,9 +680,9 @@
 	TGA_WRITE_REG(temp & 0x000fffff, TGA_CURSOR_BASE_REG);
     }
 
-    /* finally, enable video scan & cursor
+    /* finally, enable video scan
        (and pray for the monitor... :-) */
-    TGA_WRITE_REG(0x05, TGA_VALID_REG); /* SCANNING and CURSOR */
+    TGA_WRITE_REG(0x01, TGA_VALID_REG); /* SCANNING */
 
     fb_var.xres = fb_var.xres_virtual = 640;
     fb_var.yres = fb_var.yres_virtual = 480;
@@ -781,8 +778,7 @@
 {
     /* Do we have to save the colormap? */
     if (fb_display[currcon].cmap.len)
-	fb_get_cmap(&fb_display[currcon].cmap, &fb_display[currcon].var, 1,
-		    tgafb_getcolreg, info);
+	fb_get_cmap(&fb_display[currcon].cmap, 1, tgafb_getcolreg, info);
 
     currcon = con;
     /* Install new colormap */
@@ -806,7 +802,13 @@
 
 static void tgafbcon_blank(int blank, struct fb_info *info)
 {
-    /* Nothing */
+    /* Should also do stuff here for vesa blanking  -tor */
+
+    if (blank > 0) {
+	TGA_WRITE_REG(0x03, TGA_VALID_REG); /* SCANNING and BLANK */
+    } else {
+	TGA_WRITE_REG(0x01, TGA_VALID_REG); /* SCANNING */
+    }
 }
 
     /*
@@ -819,9 +821,10 @@
 {
     if (regno > 255)
 	return 1;
-    *red = palette[regno].red;
-    *green = palette[regno].green;
-    *blue = palette[regno].blue;
+    *red = (palette[regno].red<<8) || palette[regno].red;
+    *green = (palette[regno].green<<8) || palette[regno].green;
+    *blue = (palette[regno].blue<<8) || palette[regno].blue;
+    *transp = 0;
     return 0;
 }
 
@@ -837,6 +840,9 @@
 {
     if (regno > 255)
 	return 1;
+    red >>= 8;
+    green >>= 8;
+    blue >>= 8;
     palette[regno].red = red;
     palette[regno].green = green;
     palette[regno].blue = blue;
@@ -846,7 +852,14 @@
 	fbcon_cfb32_cmap[regno] = (red << 16) | (green << 8) | blue;
 #endif
 
-    /* How to set a single color register?? */
+    if (tga_type == 0) { /* 8-plane */
+        BT485_WRITE(regno, BT485_ADDR_PAL_WRITE);
+        TGA_WRITE_REG(BT485_DATA_PAL, TGA_RAMDAC_SETUP_REG);
+        TGA_WRITE_REG(red|(BT485_DATA_PAL<<8),TGA_RAMDAC_REG);
+        TGA_WRITE_REG(green|(BT485_DATA_PAL<<8),TGA_RAMDAC_REG);
+        TGA_WRITE_REG(blue|(BT485_DATA_PAL<<8),TGA_RAMDAC_REG);
+    }                                                    
+    /* How to set a single color register on 24-plane cards?? */
 
     return 0;
 }
@@ -854,31 +867,21 @@
 
 #if 1
     /*
-     *	FIXME: since I don't know how to set a single arbitrary color register,
-     *  all color palette registers have to be updated
+     *	FIXME: since I don't know how to set a single arbitrary color register
+     *  on 24-plane cards, all color palette registers have to be updated
      */
 
 static void tga_update_palette(void)
 {
     int i;
 
-    if (tga_type == 0) { /* 8-plane */
-	BT485_WRITE(0x00, BT485_ADDR_PAL_WRITE);
-	TGA_WRITE_REG(BT485_DATA_PAL, TGA_RAMDAC_SETUP_REG);
-	for (i = 0; i < 256; i++) {
-	    TGA_WRITE_REG(palette[i].red|(BT485_DATA_PAL<<8),TGA_RAMDAC_REG);
-	    TGA_WRITE_REG(palette[i].green|(BT485_DATA_PAL<<8),TGA_RAMDAC_REG);
-	    TGA_WRITE_REG(palette[i].blue|(BT485_DATA_PAL<<8),TGA_RAMDAC_REG);
-	}
-    } else {
-	BT463_LOAD_ADDR(0x0000);
-	TGA_WRITE_REG((BT463_PALETTE<<2), TGA_RAMDAC_REG);
+    BT463_LOAD_ADDR(0x0000);
+    TGA_WRITE_REG((BT463_PALETTE<<2), TGA_RAMDAC_REG);
 
-	for (i = 0; i < 256; i++) {
-	    TGA_WRITE_REG(palette[i].red|(BT463_PALETTE<<10), TGA_RAMDAC_REG);
-	    TGA_WRITE_REG(palette[i].green|(BT463_PALETTE<<10), TGA_RAMDAC_REG);
-	    TGA_WRITE_REG(palette[i].blue|(BT463_PALETTE<<10), TGA_RAMDAC_REG);
-	}
+    for (i = 0; i < 256; i++) {
+	 TGA_WRITE_REG(palette[i].red|(BT463_PALETTE<<10), TGA_RAMDAC_REG);
+	 TGA_WRITE_REG(palette[i].green|(BT463_PALETTE<<10), TGA_RAMDAC_REG);
+	 TGA_WRITE_REG(palette[i].blue|(BT463_PALETTE<<10), TGA_RAMDAC_REG);
     }
 }
 #endif
@@ -888,14 +891,13 @@
     if (con != currcon)
 	return;
     if (fb_display[con].cmap.len)
-	fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-		    tgafb_setcolreg, info);
+	fb_set_cmap(&fb_display[con].cmap, 1, tgafb_setcolreg, info);
     else
 	fb_set_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel),
-				    &fb_display[con].var, 1, tgafb_setcolreg,
-				    info);
+				    1, tgafb_setcolreg, info);
 #if 1
-    tga_update_palette();
+    if (tga_type != 0)
+        tga_update_palette();
 #endif
 }
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/vesafb.c m68k/drivers/video/vesafb.c
--- jes-2.1.115/drivers/video/vesafb.c	Sun Aug  9 21:48:38 1998
+++ m68k/drivers/video/vesafb.c	Wed Aug 12 09:30:06 1998
@@ -8,7 +8,6 @@
  *
  */ 
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -22,8 +21,10 @@
 #include <linux/selection.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
+#include <linux/config.h>
 
 #include <asm/io.h>
+#include <asm/mtrr.h>
 
 #include "fbcon.h"
 #include "fbcon-cfb8.h"
@@ -78,17 +79,14 @@
 static struct fb_info fb_info;
 static struct { u_char red, green, blue, pad; } palette[256];
 
-static int inverse = 0;
+static int             inverse   = 0;
+static int             currcon   = 0;
 
-static int currcon = 0;
-
-/* --------------------------------------------------------------------- */
-/* speed up scrolling                                                    */
+static int             ypan,ywrap = 0;
+static unsigned short  *pmi_base  = 0;
+static void            (*pmi_start)(void);
+static void            (*pmi_pal)(void);
 
-#define USE_REDRAW   1
-#define USE_MEMMOVE  2
-  
-static int vesafb_scroll = USE_REDRAW;
 static struct display_switch vesafb_sw;
 
 /* --------------------------------------------------------------------- */
@@ -112,8 +110,38 @@
 	return(0);
 }
 
-static int fb_update_var(int con, struct fb_info *info)
+static int vesafb_pan_display(struct fb_var_screeninfo *var, int con,
+                            struct fb_info *info)
 {
+	int offset;
+
+	if (var->xoffset)
+		return -EINVAL;
+	if (ypan && var->yoffset+var->yres > var->yres_virtual)
+		return -EINVAL;
+	if (ywrap && var->yoffset > var->yres_virtual)
+		return -EINVAL;
+
+	/* printk("vesafb: pan: x,y=%d,%d\n",var->xoffset,var->yoffset); */
+	offset = (var->yoffset * video_linelength + var->xoffset) / 4;
+
+        __asm__ __volatile__(
+                "call *(%%edi)"
+                : /* no return value */
+                : "a" (0x4f07),         /* EAX */
+                  "b" (0),              /* EBX */
+                  "c" (offset),         /* ECX */
+                  "d" (offset >> 16),   /* EDX */
+                  "D" (&pmi_start));    /* EDI */
+	return 0;
+}
+
+static int vesafb_update_var(int con, struct fb_info *info)
+{
+	if (con == currcon && (ywrap || ypan)) {
+		struct fb_var_screeninfo *var = &fb_display[currcon].var;
+		return vesafb_pan_display(var,con,info);
+	}
 	return 0;
 }
 
@@ -127,9 +155,9 @@
 	fix->smem_len=video_size;
 	fix->type = video_type;
 	fix->visual = video_visual;
-	fix->xpanstep=0;
-	fix->ypanstep=0;
-	fix->ywrapstep=0;
+	fix->xpanstep  = 0;
+	fix->ypanstep  = ypan  ? 1 : 0;
+	fix->ywrapstep = ywrap ? 1 : 0;
 	fix->line_length=video_linelength;
 	return 0;
 }
@@ -192,7 +220,7 @@
 	}
 	memcpy(&vesafb_sw, sw, sizeof(*sw));
 	display->dispsw = &vesafb_sw;
-	if (vesafb_scroll == USE_REDRAW) {
+	if (!ypan && !ywrap) {
 		display->scrollmode = SCROLL_YREDRAW;
 		vesafb_sw.bmove = fbcon_redraw_bmove;
 	}
@@ -214,12 +242,18 @@
 	 *  Return != 0 for invalid regno.
 	 */
 
+	int t;
+
 	if (regno >= video_cmap_len)
 		return 1;
 
-	*red   = palette[regno].red;
-	*green = palette[regno].green;
-	*blue  = palette[regno].blue;
+	t = palette[regno].red;
+	*red = (t<<10) | (t<<4) | (t>>2);
+	t = palette[regno].green;
+	*green = (t<<10) | (t<<4) | (t>>2);
+	t = palette[regno].blue;
+	*blue = (t<<10) | (t<<4) | (t>>2);
+	*transp = 0;
 	return 0;
 }
 
@@ -236,7 +270,11 @@
 	
 	if (regno >= video_cmap_len)
 		return 1;
-	
+
+	red >>= 10;
+        green >>= 10;
+        blue >>= 10;
+
 	palette[regno].red   = red;
 	palette[regno].green = green;
 	palette[regno].blue  = blue;
@@ -280,11 +318,9 @@
 	if (con != currcon)
 		return;
 	if (fb_display[con].cmap.len)
-		fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-			    vesa_setcolreg, info);
+		fb_set_cmap(&fb_display[con].cmap, 1, vesa_setcolreg, info);
 	else
-		fb_set_cmap(fb_default_cmap(video_cmap_len),
-			    &fb_display[con].var, 1, vesa_setcolreg,
+		fb_set_cmap(fb_default_cmap(video_cmap_len), 1, vesa_setcolreg,
 			    info);
 }
 
@@ -292,7 +328,7 @@
 			   struct fb_info *info)
 {
 	if (con == currcon) /* current console? */
-		return fb_get_cmap(cmap, &fb_display[con].var, kspc, vesa_getcolreg, info);
+		return fb_get_cmap(cmap, kspc, vesa_getcolreg, info);
 	else if (fb_display[con].cmap.len) /* non default colormap? */
 		fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
 	else
@@ -312,19 +348,12 @@
 			return err;
 	}
 	if (con == currcon)			/* current console? */
-		return fb_set_cmap(cmap, &fb_display[con].var, kspc, vesa_setcolreg, info);
+		return fb_set_cmap(cmap, kspc, vesa_setcolreg, info);
 	else
 		fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
 	return 0;
 }
 
-static int vesafb_pan_display(struct fb_var_screeninfo *var, int con,
-			     struct fb_info *info)
-{
-	/* no panning */
-	return -EINVAL;
-}
-
 static int vesafb_ioctl(struct inode *inode, struct file *file, 
 		       unsigned int cmd, unsigned long arg, int con,
 		       struct fb_info *info)
@@ -361,9 +390,11 @@
 		if (! strcmp(this_opt, "inverse"))
 			inverse=1;
 		else if (! strcmp(this_opt, "redraw"))
-			vesafb_scroll = USE_REDRAW;
-		else if (! strcmp(this_opt, "memmove"))
-			vesafb_scroll = USE_MEMMOVE;
+			ywrap=0,ypan=0;
+		else if (! strcmp(this_opt, "ypan"))
+			ywrap=0,ypan=1;
+		else if (! strcmp(this_opt, "ywrap"))
+			ywrap=1,ypan=0;
 		else if (!strncmp(this_opt, "font:", 5))
 			strcpy(fb_info.fontname, this_opt+5);
 	}
@@ -373,12 +404,13 @@
 {
 	/* Do we have to save the colormap? */
 	if (fb_display[currcon].cmap.len)
-		fb_get_cmap(&fb_display[currcon].cmap, &fb_display[currcon].var, 1,
-			    vesa_getcolreg, info);
+		fb_get_cmap(&fb_display[currcon].cmap, 1, vesa_getcolreg,
+			    info);
 	
 	currcon = con;
 	/* Install new colormap */
 	do_install_cmap(con, info);
+	vesafb_update_var(con,info);
 	return 0;
 }
 
@@ -401,24 +433,61 @@
 	video_width         = screen_info.lfb_width;
 	video_height        = screen_info.lfb_height;
 	video_linelength    = screen_info.lfb_linelength;
-	video_size          = video_linelength * video_height /* screen_info.lfb_size */;
+	video_size          = screen_info.lfb_size * 65536;
 	video_visual = (video_bpp == 8) ?
-		FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR;
+		FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
         video_vbase = ioremap((unsigned long)video_base, video_size);
 
-	printk("vesafb: %dx%dx%d, linelength=%d\n",
-	       video_width, video_height, video_bpp, video_linelength);
-	printk("vesafb: framebuffer at 0x%p, mapped to 0x%p, size %d\n",
-	       video_base, video_vbase, video_size);
-	if (vesafb_scroll == USE_REDRAW)  printk("vesafb: scrolling=redraw\n");
-	if (vesafb_scroll == USE_MEMMOVE) printk("vesafb: scrolling=memmove\n");
-	 
+	printk("vesafb: framebuffer at 0x%p, mapped to 0x%p, size %dk\n",
+	       video_base, video_vbase, video_size/1024);
+	printk("vesafb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
+	       video_width, video_height, video_bpp, video_linelength, screen_info.pages);
+
+	if (screen_info.vesapm_seg) {
+		printk("vesafb: protected mode interface info at %04x:%04x\n",
+		       screen_info.vesapm_seg,screen_info.vesapm_off);
+	}
+	if (screen_info.vesapm_seg < 0xc000)
+		ywrap = ypan = 0; /* not available or some DOS TSR ... */
+	if (screen_info.pages < 2)
+		ywrap = ypan = 0; /* need at least two screen pages */
+
+	if (ypan || ywrap) {
+		pmi_base  = (unsigned short*)(__PAGE_OFFSET+((unsigned long)screen_info.vesapm_seg << 4) + screen_info.vesapm_off);
+		pmi_start = (void*)((char*)pmi_base + pmi_base[1]);
+		pmi_pal   = (void*)((char*)pmi_base + pmi_base[2]);
+		printk("vesafb: pmi: set display start = %p, set palette = %p\n",pmi_start,pmi_pal);
+		printk("vesafb: pmi: ports = ");
+			for (i = pmi_base[3]/2; pmi_base[i] != 0xffff; i++)
+				printk("%x ",pmi_base[i]);
+		printk(", memory = ");
+			for (i++; pmi_base[i] != 0xffff; i+=3)
+				printk("%lx+%x ",
+				       ((unsigned long)pmi_base[i]<<16)
+					   + pmi_base[i+1], pmi_base[i+3]);
+		printk("\n");
+	}
+
 	vesafb_defined.xres=video_width;
 	vesafb_defined.yres=video_height;
 	vesafb_defined.xres_virtual=video_width;
 	vesafb_defined.yres_virtual=video_height;
 	vesafb_defined.bits_per_pixel=video_bpp;
 
+	if (ypan) {
+		printk("vesafb: scrolling: ypan using protected mode interface\n");
+		vesafb_defined.yres_virtual = video_height * screen_info.pages;
+	} else if (ywrap) {
+		printk("vesafb: scrolling: ywrap using protected mode interface\n");
+#if 0
+		vesafb_defined.yres_virtual = video_height * screen_info.pages; /* available pages */
+#else
+		vesafb_defined.yres_virtual = video_size / video_linelength; /* whole video memory */
+#endif
+	} else {
+		printk("vesafb: scrolling: redraw\n");
+	}
+
 	if (video_bpp > 8) {
 		vesafb_defined.red.offset    = screen_info.red_pos;
 		vesafb_defined.red.length    = screen_info.red_size;
@@ -452,6 +521,9 @@
 		video_cmap_len = 256;
 	}
 	request_region(0x3c0, 32, "vga+");
+#ifdef CONFIG_MTRR
+        mtrr_add((unsigned long)video_base, video_size, MTRR_TYPE_WRCOMB, 1);
+#endif
 	
 	strcpy(fb_info.modename, "VESA VGA");
 	fb_info.changevar = NULL;
@@ -459,7 +531,7 @@
 	fb_info.fbops = &vesafb_ops;
 	fb_info.disp=&disp;
 	fb_info.switch_con=&vesafb_switch;
-	fb_info.updatevar=&fb_update_var;
+	fb_info.updatevar=&vesafb_update_var;
 	fb_info.blank=&vesafb_blank;
 	vesafb_set_disp(-1);
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/vfb.c m68k/drivers/video/vfb.c
--- jes-2.1.115/drivers/video/vfb.c	Sun Aug  9 21:48:38 1998
+++ m68k/drivers/video/vfb.c	Wed Aug 12 09:30:08 1998
@@ -8,7 +8,6 @@
  *  more details.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -350,8 +349,7 @@
 			struct fb_info *info)
 {
     if (con == currcon) /* current console? */
-	return fb_get_cmap(cmap, &fb_display[con].var, kspc, vfb_getcolreg,
-			   info);
+	return fb_get_cmap(cmap, kspc, vfb_getcolreg, info);
     else if (fb_display[con].cmap.len) /* non default colormap? */
 	fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
     else
@@ -375,8 +373,7 @@
 	    return err;
     }
     if (con == currcon)			/* current console? */
-	return fb_set_cmap(cmap, &fb_display[con].var, kspc, vfb_setcolreg,
-			   info);
+	return fb_set_cmap(cmap, kspc, vfb_setcolreg, info);
     else
 	fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
     return 0;
@@ -450,8 +447,7 @@
 {
     /* Do we have to save the colormap? */
     if (fb_display[currcon].cmap.len)
-	fb_get_cmap(&fb_display[currcon].cmap, &fb_display[currcon].var, 1,
-		    vfb_getcolreg, info);
+	fb_get_cmap(&fb_display[currcon].cmap, 1, vfb_getcolreg, info);
 
     currcon = con;
     /* Install new colormap */
@@ -580,9 +576,10 @@
 {
     if (regno > 255)
 	return 1;
-    *red = palette[regno].red;
-    *green = palette[regno].green;
-    *blue = palette[regno].blue;
+    *red = (palette[regno].red<<8) || palette[regno].red;
+    *green = (palette[regno].green<<8) || palette[regno].green;
+    *blue = (palette[regno].blue<<8) || palette[regno].blue;
+    *transp = 0;
     return 0;
 }
 
@@ -598,6 +595,9 @@
 {
     if (regno > 255)
 	return 1;
+    red >>= 8;
+    green >>= 8;
+    blue >>= 8;
     palette[regno].red = red;
     palette[regno].green = green;
     palette[regno].blue = blue;
@@ -610,11 +610,10 @@
     if (con != currcon)
 	return;
     if (fb_display[con].cmap.len)
-	fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-		    vfb_setcolreg, info);
+	fb_set_cmap(&fb_display[con].cmap, 1, vfb_setcolreg, info);
     else
-	fb_set_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel),
-		    &fb_display[con].var, 1, vfb_setcolreg, info);
+	fb_set_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel), 1,
+		    vfb_setcolreg, info);
 }
 
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/vgacon.c m68k/drivers/video/vgacon.c
--- jes-2.1.115/drivers/video/vgacon.c	Sun Aug  9 21:48:38 1998
+++ m68k/drivers/video/vgacon.c	Mon Aug 10 19:22:18 1998
@@ -33,7 +33,7 @@
  *  more details.
  */
 
-
+#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/fs.h>
@@ -190,6 +190,7 @@
 			display_desc = "*MDA";
 			request_region(0x3b0,12,"mda");
 			request_region(0x3bf, 1,"mda");
+			vga_video_font_height = 16;
 		}
 	}
 	else				/* If not, it is color. */
@@ -256,6 +257,7 @@
 			vga_vram_end = 0xba000;
 			display_desc = "*CGA";
 			request_region(0x3d4,2,"cga");
+			vga_video_font_height = 8;
 		}
 	}
 	vga_vram_base = VGA_MAP_MEM(vga_vram_base);
@@ -284,11 +286,12 @@
 	    || vga_video_type == VIDEO_TYPE_EGAM) {
 		vga_hardscroll_enabled = vga_hardscroll_user_enable;
 		vga_default_font_height = ORIG_VIDEO_POINTS;
-		vga_video_font_height = video_font_height = ORIG_VIDEO_POINTS;
+		vga_video_font_height = ORIG_VIDEO_POINTS;
 		/* This may be suboptimal but is a safe bet - go with it */
 		video_scan_lines =
-			video_font_height * vga_video_num_lines;
+			vga_video_font_height * vga_video_num_lines;
 	}
+	video_font_height = vga_video_font_height;
 
 	return display_desc;
 }
@@ -359,12 +362,12 @@
 	int col = vga_can_do_color;
 
 	while (count--) {
-		u16 a = *p;
+		u16 a = scr_readw(p);
 		if (col)
 			a = ((a) & 0x88ff) | (((a) & 0x7000) >> 4) | (((a) & 0x0700) << 4);
 		else
 			a ^= ((a & 0x0700) == 0x0100) ? 0x7000 : 0x7700;
-		*p++ = a;
+		scr_writew(a, p++);
 	}
 }
 
@@ -450,7 +453,8 @@
 	 */
 	vga_video_num_columns = c->vc_cols;
 	vga_video_num_lines = c->vc_rows;
-	scr_memcpyw_to((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, c->vc_screenbuf_size);
+	if (!vga_is_gfx)
+		scr_memcpyw_to((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, c->vc_screenbuf_size);
 	return 0;	/* Redrawing not needed */
 }
 
@@ -680,7 +684,7 @@
 		charmap = (char *)VGA_MAP_MEM(colourmap);
 		beg = 0x0e;
 #ifdef VGA_CAN_DO_64KB
-		if (video_type == VIDEO_TYPE_VGAC)
+		if (vga_video_type == VIDEO_TYPE_VGAC)
 			beg = 0x06;
 #endif
 	} else {
@@ -930,7 +934,8 @@
 		c->vc_x = ORIG_X;
 		c->vc_y = ORIG_Y;
 	}
-	scr_memcpyw_from((u16 *) c->vc_screenbuf, (u16 *) c->vc_origin, c->vc_screenbuf_size);
+	if (!vga_is_gfx)
+		scr_memcpyw_from((u16 *) c->vc_screenbuf, (u16 *) c->vc_origin, c->vc_screenbuf_size);
 }
 
 static int vgacon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/vgafb.c m68k/drivers/video/vgafb.c
--- jes-2.1.115/drivers/video/vgafb.c	Sun Aug  9 21:48:38 1998
+++ m68k/drivers/video/vgafb.c	Wed Aug 12 09:30:12 1998
@@ -354,8 +354,7 @@
 			  struct fb_info *info)
 {
     if (con == currcon) /* current console? */
-	return fb_get_cmap(cmap, &fb_display[con].var, kspc, vgafb_getcolreg,
-			   info);
+	return fb_get_cmap(cmap, kspc, vgafb_getcolreg, info);
     else if (fb_display[con].cmap.len) /* non default colormap? */
 	fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
     else
@@ -380,8 +379,7 @@
 	    return err;
     }
     if (con == currcon) {		/* current console? */
-	err = fb_set_cmap(cmap, &fb_display[con].var, kspc, vgafb_setcolreg,
-			  info);
+	err = fb_set_cmap(cmap, kspc, vgafb_setcolreg, info);
 	return err;
     } else
 	fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
@@ -658,8 +656,7 @@
 {
     /* Do we have to save the colormap? */
     if (fb_display[currcon].cmap.len)
-	fb_get_cmap(&fb_display[currcon].cmap, &fb_display[currcon].var, 1,
-		    vgafb_getcolreg, info);
+	fb_get_cmap(&fb_display[currcon].cmap, 1, vgafb_getcolreg, info);
 
     currcon = con;
     /* Install new colormap */
@@ -696,11 +693,17 @@
 static int vgafb_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue,
 			 u_int *transp, struct fb_info *info)
 {
+    int t;
+
     if (regno > 15)
 	return 1;
-    *red = palette[regno].red;
-    *green = palette[regno].green;
-    *blue = palette[regno].blue;
+    t = palette[regno].red;
+    *red = (t<<10) | (t<<4) | (t>>2);
+    t = palette[regno].green;
+    *green = (t<<10) | (t<<4) | (t>>2);
+    t = palette[regno].blue;
+    *blue = (t<<10) | (t<<4) | (t>>2);
+    *transp = 0;
     return 0;
 }
 
@@ -716,6 +719,9 @@
 {
     if (regno > 15)
 	return 1;
+    red >>= 10;
+    green >>= 10;
+    blue >>= 10;
     palette[regno].red = red;
     palette[regno].green = green;
     palette[regno].blue = blue;
@@ -730,12 +736,10 @@
     if (con != currcon)
 	return;
     if (fb_display[con].cmap.len)
-	fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-		    vgafb_setcolreg, info);
+	fb_set_cmap(&fb_display[con].cmap, 1, vgafb_setcolreg, info);
     else
 	fb_set_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel),
-				    &fb_display[con].var, 1, vgafb_setcolreg,
-				    info);
+				    1, vgafb_setcolreg, info);
 }
 
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/drivers/video/virgefb.c m68k/drivers/video/virgefb.c
--- jes-2.1.115/drivers/video/virgefb.c	Sun Aug  9 21:48:38 1998
+++ m68k/drivers/video/virgefb.c	Wed Aug 12 09:30:16 1998
@@ -16,7 +16,6 @@
 
 #undef VIRGEFBDEBUG
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -148,7 +147,7 @@
 
 
 static unsigned int CyberKey = 0;
-static unsigned char Cyber_colour_table [256][4];
+static unsigned char Cyber_colour_table [256][3];
 static unsigned long CyberMem;
 static unsigned long CyberSize;
 static volatile char *CyberRegs;
@@ -324,7 +323,6 @@
 		Cyber_colour_table [i][0] = i;
 		Cyber_colour_table [i][1] = i;
 		Cyber_colour_table [i][2] = i;
-		Cyber_colour_table [i][3] = 0;
 	}
 
 	/*
@@ -383,7 +381,7 @@
 	if (par->bpp == 8)
 		fix->visual = FB_VISUAL_PSEUDOCOLOR;
 	else
-		fix->visual = FB_VISUAL_DIRECTCOLOR;
+		fix->visual = FB_VISUAL_TRUECOLOR;
 
 	fix->xpanstep = 0;
 	fix->ypanstep = 0;
@@ -446,7 +444,7 @@
 
 	if (par->bpp == 8) {
 		var->red.offset = 0;
-		var->red.length = 8;
+		var->red.length = 6;
 		var->red.msb_right = 0;
 		var->blue = var->green = var->red;
 	} else {
@@ -512,14 +510,17 @@
 	 */
 
 	vgawb_3d(0x3c8, (unsigned char) regno);
-	Cyber_colour_table [regno][0] = red & 0xff;
-	Cyber_colour_table [regno][1] = green & 0xff;
-	Cyber_colour_table [regno][2] = blue & 0xff;
-	Cyber_colour_table [regno][3] = transp;
-
-	vgawb_3d(0x3c9, ((red & 0xff) >> 2));
-	vgawb_3d(0x3c9, ((green & 0xff) >> 2));
-	vgawb_3d(0x3c9, ((blue & 0xff) >> 2));
+	red >>= 10;
+	green >>= 10;
+	blue >>= 10;
+
+	Cyber_colour_table [regno][0] = red;
+	Cyber_colour_table [regno][1] = green;
+	Cyber_colour_table [regno][2] = blue;
+
+	vgawb_3d(0x3c9, red);
+	vgawb_3d(0x3c9, green);
+	vgawb_3d(0x3c9, blue);
 
 	return (0);
 }
@@ -533,12 +534,17 @@
 static int Cyber_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue,
 			   u_int *transp, struct fb_info *info)
 {
+	int t;
+
 	if (regno >= 256)
 		return (1);
-	*red	= Cyber_colour_table [regno][0];
-	*green	= Cyber_colour_table [regno][1];
-	*blue	= Cyber_colour_table [regno][2];
-	*transp = Cyber_colour_table [regno][3];
+	t       = Cyber_colour_table [regno][0];
+	*red    = (t<<10) | (t<<4) | (t>>2);
+	t       = Cyber_colour_table [regno][1];
+	*green  = (t<<10) | (t<<4) | (t>>2);
+	t       = Cyber_colour_table [regno][2];
+	*blue   = (t<<10) | (t<<4) | (t>>2);
+	*transp = 0;
 	return (0);
 }
 
@@ -566,9 +572,9 @@
 		for (i = 0; i < 256; i++)
 		{
 			vgawb_3d(0x3c8, (unsigned char) i);
-			vgawb_3d(0x3c9, Cyber_colour_table[i][0] >> 2);
-			vgawb_3d(0x3c9, Cyber_colour_table[i][1] >> 2);
-			vgawb_3d(0x3c9, Cyber_colour_table[i][2] >> 2);
+			vgawb_3d(0x3c9, Cyber_colour_table[i][0]);
+			vgawb_3d(0x3c9, Cyber_colour_table[i][1]);
+			vgawb_3d(0x3c9, Cyber_colour_table[i][2]);
 		}
 	}
 }
@@ -753,11 +759,10 @@
 	if (con != currcon)
 		return;
 	if (fb_display[con].cmap.len)
-		fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-			    fbhw->setcolreg, info);
+		fb_set_cmap(&fb_display[con].cmap, 1, fbhw->setcolreg, info);
 	else
 		fb_set_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel),
-			    &fb_display[con].var, 1, fbhw->setcolreg, info);
+			    1, fbhw->setcolreg, info);
 }
 
 
@@ -911,8 +916,7 @@
 			    struct fb_info *info)
 {
 	if (con == currcon) /* current console? */
-		return(fb_get_cmap(cmap, &fb_display[con].var,
-				   kspc, fbhw->getcolreg, info));
+		return(fb_get_cmap(cmap, kspc, fbhw->getcolreg, info));
 	else if (fb_display[con].cmap.len) /* non default colormap? */
 		fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
 	else
@@ -937,8 +941,7 @@
 			return(err);
 	}
 	if (con == currcon)		 /* current console? */
-		return(fb_set_cmap(cmap, &fb_display[con].var,
-				   kspc, fbhw->setcolreg, info));
+		return(fb_set_cmap(cmap, kspc, fbhw->setcolreg, info));
 	else
 		fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
 	return(0);
@@ -1081,8 +1084,8 @@
 {
 	/* Do we have to save the colormap? */
 	if (fb_display[currcon].cmap.len)
-		fb_get_cmap(&fb_display[currcon].cmap, &fb_display[currcon].var, 1,
-			    fbhw->getcolreg, info);
+		fb_get_cmap(&fb_display[currcon].cmap, 1, fbhw->getcolreg,
+			    info);
 
 	do_fb_set_var(&fb_display[con].var, 1);
 	currcon = con;
@@ -1144,9 +1147,9 @@
 			       int dx, int height, int width)
 {
         sx *= 8; dx *= 8; width *= 8;
-        Cyber3D_BitBLT((u_short)sx, (u_short)(sy*p->fontheight), (u_short)dx,
-                       (u_short)(dy*p->fontheight), (u_short)width,
-                       (u_short)(height*p->fontheight));
+        Cyber3D_BitBLT((u_short)sx, (u_short)(sy*fontheight(p)), (u_short)dx,
+                       (u_short)(dy*fontheight(p)), (u_short)width,
+                       (u_short)(height*fontheight(p)));
 }
 
 static void fbcon_virge8_clear(struct vc_data *conp, struct display *p, int sy,
@@ -1156,8 +1159,8 @@
 
         sx *= 8; width *= 8;
         bg = attr_bgcol_ec(p,conp);
-        Cyber3D_RectFill((u_short)sx, (u_short)(sy*p->fontheight),
-                         (u_short)width, (u_short)(height*p->fontheight),
+        Cyber3D_RectFill((u_short)sx, (u_short)(sy*fontheight(p)),
+                         (u_short)width, (u_short)(height*fontheight(p)),
                          (u_short)bg);
 }
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/include/linux/fb.h m68k/include/linux/fb.h
--- jes-2.1.115/include/linux/fb.h	Sun Aug  9 21:48:52 1998
+++ m68k/include/linux/fb.h	Wed Aug 12 19:47:41 1998
@@ -264,10 +264,10 @@
    u_long next_line;                /* offset to one line below */
    u_long next_plane;               /* offset to next plane */
    u_char *fontdata;                /* Font associated to this display */
-   unsigned short fontheightlog;
-   unsigned short fontwidthlog;
-   unsigned short fontheight;
-   unsigned short fontwidth;
+   unsigned short _fontheightlog;
+   unsigned short _fontwidthlog;
+   unsigned short _fontheight;
+   unsigned short _fontwidth;
    int userfont;                    /* != 0 if fontdata kmalloc()ed */
    struct display_switch *dispsw;   /* low level operations */
    u_short scrollmode;              /* Scroll Method */
@@ -394,14 +394,13 @@
 extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
 extern void fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to,
 			 int fsfromto);
-extern int fb_get_cmap(struct fb_cmap *cmap, struct fb_var_screeninfo *var,
-		       int kspc, int (*getcolreg)(u_int, u_int *, u_int *,
-						  u_int *, u_int *,
-						  struct fb_info *),
+extern int fb_get_cmap(struct fb_cmap *cmap, int kspc,
+		       int (*getcolreg)(u_int, u_int *, u_int *, u_int *,
+					u_int *, struct fb_info *),
 		       struct fb_info *fb_info);
-extern int fb_set_cmap(struct fb_cmap *cmap, struct fb_var_screeninfo *var,
-		       int kspc, int (*setcolreg)(u_int, u_int, u_int, u_int,
-						  u_int, struct fb_info *),
+extern int fb_set_cmap(struct fb_cmap *cmap, int kspc,
+		       int (*setcolreg)(u_int, u_int, u_int, u_int, u_int,
+					struct fb_info *),
 		       struct fb_info *fb_info);
 extern struct fb_cmap *fb_default_cmap(int len);
 extern void fb_invert_cmaps(void);
@@ -461,31 +460,6 @@
 #define FB_CURSOR_OFF		0
 #define FB_CURSOR_ON		1
 #define FB_CURSOR_FLASH		2
-
-#define FBCMD_DRAWLINE		0x4621
-#define FBCMD_MOVE		0x4622
-
-#define FB_LINE_XOR	1
-#define FB_LINE_BOX	2
-#define FB_LINE_FILLED	4
-
-struct fb_line {
-	__s32 start_x;
-	__s32 start_y;
-	__s32 end_x;
-	__s32 end_y;
-	__u32 color;
-	__u32 option;
-};
-
-struct fb_move {
-	__s32 src_x;
-	__s32 src_y;
-	__s32 dest_x;
-	__s32 dest_y;
-	__u32 height;
-	__u32 width;
-};
 
 #endif /* Preliminary */
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/include/linux/selection.h m68k/include/linux/selection.h
--- jes-2.1.115/include/linux/selection.h	Sun Aug  9 21:48:54 1998
+++ m68k/include/linux/selection.h	Mon Aug 10 21:24:30 1998
@@ -40,4 +40,7 @@
 extern void getconsxy(int currcons, char *p);
 extern void putconsxy(int currcons, char *p);
 
+extern u16 vcs_scr_readw(int currcons, u16 *org);
+extern void vcs_scr_writew(int currcons, u16 val, u16 *org);
+
 #endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.115/include/linux/vt_kern.h m68k/include/linux/vt_kern.h
--- jes-2.1.115/include/linux/vt_kern.h	Sun Aug  9 21:48:56 1998
+++ m68k/include/linux/vt_kern.h	Wed Aug 12 20:12:51 1998
@@ -75,6 +75,7 @@
 int con_set_default_unimap(int currcons);
 void con_free_unimap(int currcons);
 void con_protect_unimap(int currcons, int rdonly);
+int con_copy_unimap(int dstcons, int srccons);
 
 /* vt.c */
 

Greetings,

						Geert

--
Geert Uytterhoeven                     Geert.Uytterhoeven@cs.kuleuven.ac.be
Wavelets, Linux/{m68k~Amiga,PPC~CHRP}  http://www.cs.kuleuven.ac.be/~geert/
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium

