Date: Thu, 19 Mar 1998 10:22:55 +0100 (CET)
From: Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be>
To: Linux/m68k <linux-m68k@lists.linux-m68k.org>
Subject: L68K: Patches for 2.1.85
Sender: owner-linux-m68k@phil.uni-sb.de


Here they are: a bunch of patches for 2.1.85-current.

CHANGES:

  - fbcon-cfb24.[ch], Makefile: added support for 24 bpp packed pixels
    (untested)

  - fbcon-cfb{8,16,32}: use line_length if provided by the frame buffer device

  - Renamed CONFIG_FB_OPEN_FIRMWARE to CONFIG_FB_OF

  - Config.in: cleant up

  - Propagate the KD_SETMODE ioctl to fbcon and the frame buffer device, so it
    can disable text mode acceleration when entering graphics mode. However, I
    still see some problems here:

      o For changing the dispsw pointer, we have to recalculate quite a lot. Or
	is the following piece of code feasible?

	    if (new_mode == KD_TEXT) {
		/* accelerated text */
		if (dispsw == fbcon_cfb8)
		    dispsw = fbcon_cfb8_accel_for_my_chipset;
		else if (dispsw == fbcon_cfb16)
		    dispsw = fbcon_cfb16_accel_for_my_chipset;
		else if (dispsw == fbcon_cfb32)
		    dispsw = fbcon_cfb32_accel_for_my_chipset;
	    } else {
		/* graphics, i.e. unaccelerated text */
		if (dispsw == fbcon_cfb8_accel_for_my_chipset)
		    dispsw = fbcon_cfb8;
		else if (dispsw == fbcon_cfb16_accel_for_my_chipset)
		    dispsw = fbcon_cfb16;
		else if (dispsw == fbcon_cfb32_accel_for_my_chipset)
		    dispsw = fbcon_cfb32;
	    }

      o When changing from GRAPHICS to TEXT mode, we have to reinitialize the
	graphics accelerator registers since they may have been changed by the
	user space application (e.g. the X server)

    Or: should we disable all text output when in graphics mode? This would
    protect us against very slow scrolling of kernel messages when we're in an
    unaccelerated mode and the resulting bad responsiveness of the system.

    BTW, for VGA compatible video hardware, we can `abuse' the KD_SETMODE ioctl
    propagation to install a real VGA text mode in text mode.

  - Don't reference fbcon-* low level drivers that weren't enabled.

  - amifb.c: use mfb (if enabled) for depth == 1. This should speed up both
    text and X for monochrome video modes.

  - First code for centralized monitor specs ([hv]freq limits, dpms capable).
    To be completed.

    Here I think I found a bug in gcc (2.7.2.3, I think): it complains that
    hpicos and vpicos may be used uninitialized in drivers/char/fbmem.c.
    Don't have a 2.8.x or egcs cross compiler yet.

  - Print the number of the frame buffer device (fb%d) on initialization.

  - skeletonfb.c: added more sample code.

  - {of,aty,S3trio}fb.c: support the MkLinux VC_SETCMAP ioctl (untested).

  - Make the Apollo keyboard/mouse driver compile again.

  - *keyb*[ch]: Since all other keymaps in drivers/char/defkeymap.c became
    global symbols some time ago, we can save some space by putting all our
    maps in __initdata and copying them over the PC maps.


STILL TO DO:

  - Merge in Bernd's changes to atyfb.c (high priority on my list)


NOTES:

I created this patch by comparing my current tree with the m68k-2.1.85 tree
with all patches from kernel-patches/2.1.85. But it looks like some patches
must be missing there. I found a lot more differences than expected:

  - many changes for Mac (about 500 KB diff!) (from Michael)

  - set_gain() function for dmasound on Atari (from Andreas?)

Michael: if I screwed things up on the Mac, please let me know.

All comments are welcome. RSVP!

diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/arch/m68k/atari/atakeyb.c m68k/arch/m68k/atari/atakeyb.c
--- m68k-2.1.85/arch/m68k/atari/atakeyb.c	Tue Mar 17 19:28:05 1998
+++ m68k/arch/m68k/atari/atakeyb.c	Tue Mar 17 21:54:08 1998
@@ -117,7 +117,7 @@
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
 };
 
-static u_short atashift_map[NR_KEYS] = {
+static u_short atashift_map[NR_KEYS] __initdata = {
 	0xf200, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
 	0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf008, 0xf009,
 	0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
@@ -136,7 +136,7 @@
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
 };
 
-static u_short atactrl_map[NR_KEYS] = {
+static u_short atactrl_map[NR_KEYS] __initdata = {
 	0xf200, 0xf200, 0xf200, 0xf000, 0xf01b, 0xf01c, 0xf01d, 0xf01e,
 	0xf01f, 0xf07f, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf200,
 	0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
@@ -155,7 +155,7 @@
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
 };
 
-static u_short atashift_ctrl_map[NR_KEYS] = {
+static u_short atashift_ctrl_map[NR_KEYS] __initdata = {
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf200,
 	0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
@@ -174,7 +174,7 @@
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
 };
 
-static u_short ataalt_map[NR_KEYS] = {
+static u_short ataalt_map[NR_KEYS] __initdata = {
 	0xf200, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
 	0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf808, 0xf809,
 	0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
@@ -212,7 +212,7 @@
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
 };
 
-static u_short atactrl_alt_map[NR_KEYS] = {
+static u_short atactrl_alt_map[NR_KEYS] __initdata = {
 	0xf200, 0xf200, 0xf200, 0xf800, 0xf81b, 0xf81c, 0xf81d, 0xf81e,
 	0xf81f, 0xf87f, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf200,
 	0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
@@ -767,14 +767,14 @@
 __initfunc(int atari_keyb_init(void))
 {
     /* setup key map */
-    memcpy (plain_map, ataplain_map, sizeof(plain_map));
-    key_maps[1]  = atashift_map;
+    memcpy(plain_map, ataplain_map, sizeof(plain_map));
+    memcpy(shift_map, atashift_map, sizeof(shift_map));
     key_maps[2]  = 0; /* ataaltgr_map */
-    key_maps[4]  = atactrl_map;
-    key_maps[5]  = atashift_ctrl_map;
-    key_maps[8]  = ataalt_map;
+    memcpy(ctrl_map, atactrl_map, sizeof(ctrl_map));
+    memcpy(shift_ctrl_map, atashift_ctrl_map, sizeof(shift_ctrl_map));
+    memcpy(alt_map, ataalt_map, sizeof(alt_map));
     key_maps[9]  = atashift_alt_map;
-    key_maps[12] = atactrl_alt_map;
+    memcpy(ctrl_alt_map, atactrl_alt_map, sizeof(ctrl_alt_map));
     key_maps[13] = atashift_ctrl_alt_map;
     keymap_count = 8;
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/arch/m68k/mac/mackeyb.c m68k/arch/m68k/mac/mackeyb.c
--- m68k-2.1.85/arch/m68k/mac/mackeyb.c	Tue Mar 17 19:28:09 1998
+++ m68k/arch/m68k/mac/mackeyb.c	Tue Mar 17 21:54:19 1998
@@ -10,13 +10,13 @@
  * misc. keyboard stuff (everything not in adb-bus.c or keyb_m68k.c)
  */
 
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/mm.h>
 #include <linux/kd.h>
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/interrupt.h>
+#include <linux/init.h>
 /* keyb */
 #include <linux/keyboard.h>
 #include <linux/random.h>
@@ -40,7 +40,6 @@
 #define MOUSE_DATAREG	0	/* reg# for movement/button codes from mouse */
 /* end keyboard_input stuff */
 
-#include <asm/keyboard.h>
 #include <linux/kbd_kern.h>
 #include <linux/kbd_ll.h>
 
@@ -82,7 +81,7 @@
 /*
  * Mac private key maps
  */
-u_short mac_plain_map[NR_KEYS] = {
+u_short mac_plain_map[NR_KEYS] __initdata = {
 	0xfb61,	0xfb73,	0xfb64,	0xfb66,	0xfb68,	0xfb67,	0xfb7a,	0xfb78,
 	0xfb63,	0xfb76,	0xf200,	0xfb62,	0xfb71,	0xfb77,	0xfb65,	0xfb72,
 	0xfb79,	0xfb74,	0xf031,	0xf032,	0xf033,	0xf034,	0xf036,	0xf035,
@@ -101,7 +100,7 @@
 	0xf101,	0xf119,	0xf100,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,
 };
 
-u_short mac_shift_map[NR_KEYS] = {
+u_short mac_shift_map[NR_KEYS] __initdata = {
 	0xfb41,	0xfb53,	0xfb44,	0xfb46,	0xfb48,	0xfb47,	0xfb5a,	0xfb58,
 	0xfb43,	0xfb56,	0xf200,	0xfb42,	0xfb51,	0xfb57,	0xfb45,	0xfb52,
 	0xfb59,	0xfb54,	0xf021,	0xf040,	0xf023,	0xf024,	0xf05e,	0xf025,
@@ -120,7 +119,7 @@
 	0xf10b,	0xf20a,	0xf10a,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,
 };
 
-u_short mac_altgr_map[NR_KEYS] = {
+u_short mac_altgr_map[NR_KEYS] __initdata = {
 	0xf914,	0xfb73,	0xf917,	0xf919,	0xfb68,	0xfb67,	0xfb7a,	0xfb78,
 	0xf916,	0xfb76,	0xf200,	0xf915,	0xfb71,	0xfb77,	0xf918,	0xfb72,
 	0xfb79,	0xfb74,	0xf200,	0xf040,	0xf200,	0xf024,	0xf200,	0xf200,
@@ -139,7 +138,7 @@
 	0xf50d,	0xf119,	0xf50c,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,
 };
 
-u_short mac_ctrl_map[NR_KEYS] = {
+u_short mac_ctrl_map[NR_KEYS] __initdata = {
 	0xf001,	0xf013,	0xf004,	0xf006,	0xf008,	0xf007,	0xf01a,	0xf018,
 	0xf003,	0xf016,	0xf200,	0xf002,	0xf011,	0xf017,	0xf005,	0xf012,
 	0xf019,	0xf014,	0xf200,	0xf000,	0xf01b,	0xf01c,	0xf01e,	0xf01d,
@@ -158,7 +157,7 @@
 	0xf101,	0xf119,	0xf100,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,
 };
 
-u_short mac_shift_ctrl_map[NR_KEYS] = {
+u_short mac_shift_ctrl_map[NR_KEYS] __initdata = {
 	0xf001,	0xf013,	0xf004,	0xf006,	0xf008,	0xf007,	0xf01a,	0xf018,
 	0xf003,	0xf016,	0xf200,	0xf002,	0xf011,	0xf017,	0xf005,	0xf012,
 	0xf019,	0xf014,	0xf200,	0xf000,	0xf200,	0xf200,	0xf200,	0xf200,
@@ -177,7 +176,7 @@
 	0xf200,	0xf119,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf20c,
 };
 
-u_short mac_alt_map[NR_KEYS] = {
+u_short mac_alt_map[NR_KEYS] __initdata = {
 	0xf861,	0xf873,	0xf864,	0xf866,	0xf868,	0xf867,	0xf87a,	0xf878,
 	0xf863,	0xf876,	0xf200,	0xf862,	0xf871,	0xf877,	0xf865,	0xf872,
 	0xf879,	0xf874,	0xf831,	0xf832,	0xf833,	0xf834,	0xf836,	0xf835,
@@ -196,7 +195,7 @@
 	0xf501,	0xf119,	0xf500,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,
 };
 
-u_short mac_ctrl_alt_map[NR_KEYS] = {
+u_short mac_ctrl_alt_map[NR_KEYS] __initdata = {
 	0xf801,	0xf813,	0xf804,	0xf806,	0xf808,	0xf807,	0xf81a,	0xf818,
 	0xf803,	0xf816,	0xf200,	0xf802,	0xf811,	0xf817,	0xf805,	0xf812,
 	0xf819,	0xf814,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,
@@ -217,15 +216,6 @@
 
 extern unsigned int keymap_count;
 
-#if 0
-ushort *mac_key_maps[MAX_NR_KEYMAPS] = {
-	mac_plain_map, mac_shift_map, mac_altgr_map, 0,
-	mac_ctrl_map, mac_shift_ctrl_map, 0, 0,
-	mac_alt_map, 0, 0, 0,
-	mac_ctrl_alt_map,	0
-};
-#endif
-
 /*
  * Misc. defines for testing 
  */
@@ -604,23 +594,19 @@
 	return 0;
 }
 
-int mac_keyb_init(void)
+__initfunc(int mac_keyb_init(void))
 {
 	static struct adb_request autopoll_req, confcod_req, mouse_req, readkey_req;
 	volatile int ct;
 
 	/* setup key map */
-	key_maps[0]  = mac_plain_map;
-	key_maps[1]  = mac_shift_map;
-	key_maps[2]  = mac_altgr_map;
-	key_maps[4]  = mac_ctrl_map;
-	key_maps[5]  = mac_shift_ctrl_map;
-	key_maps[8]  = mac_alt_map;
-	/* key_maps[9]  = atashift_alt_map; */
-	key_maps[12] = mac_ctrl_alt_map;
-	/* key_maps[13] = atashift_ctrl_alt_map; */
 	memcpy (plain_map, mac_plain_map, sizeof(plain_map));
-	keymap_count = 7;
+	memcpy(shift_map, mac_shift_map, sizeof(shift_map));
+	memcpy(altgr_map, mac_altgr_map, sizeof(altgr_map));
+	memcpy(ctrl_map, mac_ctrl_map, sizeof(ctrl_map));
+	memcpy(shift_ctrl_map, mac_shift_ctrl_map, sizeof(shift_ctrl_map));
+	memcpy(alt_map, mac_alt_map, sizeof(alt_map));
+	memcpy(ctrl_alt_map, mac_ctrl_alt_map, sizeof(ctrl_alt_map));
 
 	/* initialize mouse interrupt hook */
 	mac_mouse_interrupt_hook = NULL;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/char/amigamouse.c m68k/drivers/char/amigamouse.c
--- m68k-2.1.85/drivers/char/amigamouse.c	Tue Mar 17 19:26:53 1998
+++ m68k/drivers/char/amigamouse.c	Wed Mar 18 23:41:44 1998
@@ -267,7 +267,7 @@
 	mouse.ready = 0;
 	AMI_MSE_INT_ON();
 
-	if ((put_user(buttons | 0x80, buffer++)) ||
+	if (put_user(buttons | 0x80, buffer++) ||
 	    put_user((char)dx, buffer++) ||
 	    put_user((char)dy, buffer++))
 		return -EINVAL;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/char/amikeyb.c m68k/drivers/char/amikeyb.c
--- m68k-2.1.85/drivers/char/amikeyb.c	Tue Mar 17 19:26:57 1998
+++ m68k/drivers/char/amikeyb.c	Tue Mar 17 21:53:54 1998
@@ -52,7 +52,7 @@
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
 };
 
-static u_short amishift_map[NR_KEYS] = {
+static u_short amishift_map[NR_KEYS] __initdata = {
 	0xf07e, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026,
 	0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07c, 0xf200, 0xf300,
 	0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
@@ -71,7 +71,7 @@
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
 };
 
-static u_short amialtgr_map[NR_KEYS] = {
+static u_short amialtgr_map[NR_KEYS] __initdata = {
 	0xf200, 0xf200, 0xf040, 0xf200, 0xf024, 0xf200, 0xf200, 0xf07b,
 	0xf05b, 0xf05d, 0xf07d, 0xf05c, 0xf200, 0xf200, 0xf200, 0xf300,
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
@@ -90,7 +90,7 @@
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
 };
 
-static u_short amictrl_map[NR_KEYS] = {
+static u_short amictrl_map[NR_KEYS] __initdata = {
 	0xf000, 0xf200, 0xf000, 0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f,
 	0xf07f, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf01c, 0xf200, 0xf300,
 	0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
@@ -109,7 +109,7 @@
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
 };
 
-static u_short amishift_ctrl_map[NR_KEYS] = {
+static u_short amishift_ctrl_map[NR_KEYS] __initdata = {
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf300,
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
@@ -128,7 +128,7 @@
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
 };
 
-static u_short amialt_map[NR_KEYS] = {
+static u_short amialt_map[NR_KEYS] __initdata = {
 	0xf860, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837,
 	0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf85c, 0xf200, 0xf900,
 	0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
@@ -147,7 +147,7 @@
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
 };
 
-static u_short amictrl_alt_map[NR_KEYS] = {
+static u_short amictrl_alt_map[NR_KEYS] __initdata = {
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf300,
 	0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
@@ -302,12 +302,12 @@
 
     /* setup key map */
     memcpy(plain_map, amiplain_map, sizeof(plain_map));
-    key_maps[1]  = amishift_map;
-    key_maps[2]  = amialtgr_map;
-    key_maps[4]  = amictrl_map;
-    key_maps[5]  = amishift_ctrl_map;
-    key_maps[8]  = amialt_map;
-    key_maps[12] = amictrl_alt_map;
+    memcpy(shift_map, amishift_map, sizeof(shift_map));
+    memcpy(altgr_map, amialtgr_map, sizeof(altgr_map));
+    memcpy(ctrl_map, amictrl_map, sizeof(ctrl_map));
+    memcpy(shift_ctrl_map, amishift_ctrl_map, sizeof(shift_ctrl_map));
+    memcpy(alt_map, amialt_map, sizeof(alt_map));
+    memcpy(ctrl_alt_map, amictrl_alt_map, sizeof(ctrl_alt_map));
 
     /*
      * Initialize serial data direction.
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/char/dn_keyb.c m68k/drivers/char/dn_keyb.c
--- m68k-2.1.85/drivers/char/dn_keyb.c	Tue Mar 17 19:26:57 1998
+++ m68k/drivers/char/dn_keyb.c	Wed Mar 18 23:43:39 1998
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/poll.h>
 #include <linux/miscdevice.h>
+#include <linux/init.h>
 
 #include <asm/setup.h>
 #include <asm/irq.h>
@@ -59,7 +60,7 @@
 											  debug_keyb_timer_handler };
 #endif
 
-static u_short dnplain_map[NR_KEYS] = {
+static u_short dnplain_map[NR_KEYS] __initdata = {
 /*         ins     del     del     F1      F2      F3      F4  
            mark    line    char                                 */
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
@@ -98,7 +99,7 @@
    0xf200, 0xf300, 0xf200, 0xf310, 0xf30e, 0xf200, 0xf700, 0xf200,
 };
 
-static u_short dnshift_map[NR_KEYS] = {
+static u_short dnshift_map[NR_KEYS] __initdata = {
 /*         ins     del     del     F1      F2      F3      F4
            mark    line    char                                 */
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
@@ -137,7 +138,7 @@
    0xf200, 0xf300, 0xf200, 0xf310, 0xf30e, 0xf200, 0xf708, 0xf200,
 };
 
-static u_short dnctrl_map[NR_KEYS] = {
+static u_short dnctrl_map[NR_KEYS] __initdata = {
 /*         ins     del     del     F1      F2      F3      F4
            mark    line    char                                 */
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
@@ -176,7 +177,7 @@
    0xf200, 0xf300, 0xf200, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200,
 };
 
-static u_short dnalt_map[NR_KEYS] = {
+static u_short dnalt_map[NR_KEYS] __initdata = {
 /*         ins     del     del     F1      F2      F3      F4  
            mark    line    char                                 */
    0xf200, 0xf200, 0xf200, 0xf200, 0xf500, 0xf501, 0xf502, 0xf503,
@@ -215,7 +216,7 @@
    0xf200, 0xf300, 0xf200, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200,
 };
 
-static u_short dnaltgr_map[NR_KEYS] = {
+static u_short dnaltgr_map[NR_KEYS] __initdata = {
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
@@ -234,7 +235,7 @@
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
 };
 
-static u_short dnshift_ctrl_map[NR_KEYS] = {
+static u_short dnshift_ctrl_map[NR_KEYS] __initdata = {
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
@@ -253,7 +254,7 @@
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
 };
 
-static u_short dnctrl_alt_map[NR_KEYS] = {
+static u_short dnctrl_alt_map[NR_KEYS] __initdata = {
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
@@ -308,15 +309,15 @@
         return 0;
 }
 
-static long write_mouse(struct inode * inode, struct file * file,
-                        const char * buffer, unsigned long count)
+static ssize_t write_mouse(struct file * file, const char * buffer,
+			   size_t count, loff_t *ppos)
 {
         return -EINVAL;
 }
 
-static long read_mouse(struct inode * inode, struct file * file,
-                       char * buffer, unsigned long count) {
-
+static ssize_t read_mouse(struct file * file, char * buffer,
+			  size_t count, loff_t *ppos)
+{
 	int dx,dy,r;
 	unsigned char buttons;
 
@@ -348,20 +349,22 @@
 	mouse_dy-=dy;
 	MSE_UPDATE_ON();
 
-	put_user(buttons | 0x80, buffer);
-	put_user((char)dx, buffer + 1);
-	put_user((char)dy, buffer + 2);
-	for (r = 3; r < count; r++)
-  		put_user(0x00, buffer + r);
+	if (put_user(buttons | 0x80, buffer++) ||
+	    put_user((char)dx, buffer++) ||
+	    put_user((char)dy, buffer++))
+		return -EINVAL;
 
-	return r;
+	if (count > 3)
+		if (clear_user(buffer, count - 3))
+			return -EFAULT;
+	return count;
 }
 
-static int fasync_mouse(struct inode *inode, struct file *filp, int on)
+static int fasync_mouse(struct file *filp, int on)
 {
         int retval;
 
-        retval = fasync_helper(inode, filp, on, &mouse_fasyncptr);
+        retval = fasync_helper(filp, on, &mouse_fasyncptr);
         if (retval < 0)
                 return retval;
         return 0;
@@ -370,7 +373,7 @@
 
 static int release_mouse(struct inode * inode, struct file * file)
 {
-        fasync_mouse(inode, file, 0);
+        fasync_mouse(file, 0);
         if (--mouse_active)
                 return 0;
         MSE_UPDATE_OFF();
@@ -566,18 +569,17 @@
         APOLLO_MOUSE_MINOR, "apollomouse", &apollo_mouse_fops
 };
 
-int dn_keyb_init(void) {
+__initfunc(int dn_keyb_init(void)) {
 
 /*  printk("dn_keyb_init\n"); */
 
-  key_maps[0]  = dnplain_map;
-  key_maps[1]  = dnshift_map;
-  key_maps[2]  = dnaltgr_map;
-  key_maps[4]  = dnctrl_map;
-  key_maps[5]  = dnshift_ctrl_map;
-  key_maps[8]  = dnalt_map;
-  key_maps[12] = dnctrl_alt_map;
   memcpy(plain_map, dnplain_map, sizeof(plain_map));
+  memcpy(shift_map, dnshift_map, sizeof(shift_map));
+  memcpy(altgr_map, dnaltgr_map, sizeof(altgr_map));
+  memcpy(ctrl_map, dnctrl_map, sizeof(ctrl_map));
+  memcpy(shift_ctrl_map, dnshift_ctrl_map, sizeof(shift_ctrl_map));
+  memcpy(alt_map, dnalt_map, sizeof(alt_map));
+  memcpy(ctrl_alt_map, dnctrl_alt_map, sizeof(ctrl_alt_map));
 
   mouse_dx=0; 
   mouse_dy=0; 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/char/fbmem.c m68k/drivers/char/fbmem.c
--- m68k-2.1.85/drivers/char/fbmem.c	Tue Mar 17 19:26:54 1998
+++ m68k/drivers/char/fbmem.c	Wed Mar 18 23:30:06 1998
@@ -30,6 +30,9 @@
 #ifdef __mc68000__
 #include <asm/setup.h>
 #endif
+#ifdef __powerpc__
+#include <asm/io.h>
+#endif
 #include <asm/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
@@ -45,6 +48,8 @@
 extern void amifb_setup(char *options, int *ints);
 extern unsigned long atafb_init(unsigned long mem_start);
 extern void atafb_setup(char *options, int *ints);
+extern unsigned long macfb_init(unsigned long mem_start);
+extern void macfb_setup(char *options, int *ints);
 extern unsigned long cyberfb_init(unsigned long mem_start);
 extern void cyberfb_setup(char *options, int *ints);
 extern unsigned long retz3fb_init(unsigned long mem_start);
@@ -58,8 +63,6 @@
 extern unsigned long atyfb_init(unsigned long mem_start);
 extern void atyfb_setup(char *options, int *ints);
 extern unsigned long dnfb_init(unsigned long mem_start);
-extern unsigned long mach64fb_init(unsigned long mem_start);
-extern void mach64fb_setup(char *options, int *ints);
 extern unsigned long tgafb_init(unsigned long mem_start);
 extern unsigned long virgefb_init(unsigned long mem_start);
 extern void virgefb_setup(char *options, int *ints);
@@ -82,6 +85,9 @@
 #ifdef CONFIG_FB_ATARI
 	{ "atafb", atafb_init, atafb_setup },
 #endif
+#ifdef CONFIG_FB_MAC
+	{ "macfb", macfb_init, macfb_setup },
+#endif
 #ifdef CONFIG_FB_CYBER
 	{ "cyber", cyberfb_init, cyberfb_setup },
 #endif
@@ -91,7 +97,7 @@
 #ifdef CONFIG_FB_VIRTUAL
 	{ "vfb", vfb_init, vfb_setup },
 #endif
-#ifdef CONFIG_FB_OPEN_FIRMWARE
+#ifdef CONFIG_FB_OF
 	{ "offb", offb_init, offb_setup },
 #endif
 #ifdef CONFIG_FB_ATY
@@ -101,7 +107,7 @@
 	{ "apollo", dnfb_init, NULL },
 #endif
 #ifdef CONFIG_FB_S3TRIO
-        { "s3trio",s3triofb_init,s3trio_video_setup },
+	{ "s3trio",s3triofb_init,s3trio_video_setup },
 #endif 
 #ifdef CONFIG_FB_TGA
 	{ "tga", tgafb_init, NULL },
@@ -351,7 +357,9 @@
 	}
 	if ((vma->vm_end - vma->vm_start + vma->vm_offset) > len)
 		return -EINVAL;
-#ifndef __powerpc__
+#ifdef __powerpc__
+	start = (unsigned char *)iopa((unsigned long)start);
+#else
 	start = (unsigned char *)__pa(start);
 #endif
 	vma->vm_offset += (unsigned long)start;
@@ -473,6 +481,33 @@
 
 	if (register_chrdev(FB_MAJOR,"fb",&fb_fops))
 		printk("unable to get major %d for fb devs\n", FB_MAJOR);
+}
+
+int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal,
+			const struct fb_info *fb_info)
+{
+    unsigned long long hpicos, vpicos;
+    const unsigned long long _1e12 = 1000000000000ULL;
+    const struct fb_monspecs *monspecs = &fb_info->monspecs;
+
+    hpicos = (unsigned long long)htotal*(unsigned long long)pixclock;
+    vpicos = (unsigned long long)vtotal*(unsigned long long)hpicos;
+    if (!vpicos)
+	return 0;
+
+    if (monspecs->hfmin == 0)
+	return 1;
+
+    if (hpicos*monspecs->hfmin > _1e12 || hpicos*monspecs->hfmax < _1e12 ||
+	vpicos*monspecs->vfmin > _1e12 || vpicos*monspecs->vfmax < _1e12)
+	return 0;
+
+    return 1;
+}
+
+int fbmon_dpms(const struct fb_info *fb_info)
+{
+    return fb_info->monspecs.dpms;
 }
 
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/char/vt.c m68k/drivers/char/vt.c
--- m68k-2.1.85/drivers/char/vt.c	Tue Mar 17 19:26:45 1998
+++ m68k/drivers/char/vt.c	Wed Mar 18 20:38:26 1998
@@ -34,6 +34,10 @@
 #include <linux/vt_kern.h>
 #include <linux/kbd_diacr.h>
 #include <linux/selection.h>
+#ifdef CONFIG_ABSTRACT_CONSOLE
+#include <linux/console.h>
+#include <linux/console_struct.h>
+#endif
 
 char vt_dont_switch = 0;
 extern struct tty_driver console_driver;
@@ -657,6 +661,10 @@
 		if (vt_cons[console]->vc_mode == (unsigned char) arg)
 			return 0;
 		vt_cons[console]->vc_mode = (unsigned char) arg;
+#ifdef CONFIG_ABSTRACT_CONSOLE
+		vc_cons[console].d->vc_sw->con_set_mode(vc_cons[console].d,
+							arg);
+#endif
 		if (console != fg_console)
 			return 0;
 		/*
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/macintosh/mac_keyb.c m68k/drivers/macintosh/mac_keyb.c
--- m68k-2.1.85/drivers/macintosh/mac_keyb.c	Tue Mar 17 19:27:35 1998
+++ m68k/drivers/macintosh/mac_keyb.c	Tue Mar 17 21:55:20 1998
@@ -15,8 +15,8 @@
 #include <linux/mm.h>
 #include <linux/signal.h>
 #include <linux/ioport.h>
+#include <linux/init.h>
 
-#include <asm/keyboard.h>
 #include <asm/bitops.h>
 #include <asm/adb.h>
 #include <asm/cuda.h>
@@ -28,6 +28,140 @@
 #define KEYB_LEDREG	2	/* register # for leds on ADB keyboard */
 #define MOUSE_DATAREG	0	/* reg# for movement/button codes from mouse */
 
+static u_short macplain_map[NR_KEYS] = __initdata {
+	0xfb61,	0xfb73,	0xfb64,	0xfb66,	0xfb68,	0xfb67,	0xfb7a,	0xfb78,
+	0xfb63,	0xfb76,	0xf200,	0xfb62,	0xfb71,	0xfb77,	0xfb65,	0xfb72,
+	0xfb79,	0xfb74,	0xf031,	0xf032,	0xf033,	0xf034,	0xf036,	0xf035,
+	0xf03d,	0xf039,	0xf037,	0xf02d,	0xf038,	0xf030,	0xf05d,	0xfb6f,
+	0xfb75,	0xf05b,	0xfb69,	0xfb70,	0xf201,	0xfb6c,	0xfb6a,	0xf027,
+	0xfb6b,	0xf03b,	0xf05c,	0xf02c,	0xf02f,	0xfb6e,	0xfb6d,	0xf02e,
+	0xf009,	0xf020,	0xf060,	0xf07f,	0xf200,	0xf01b,	0xf702,	0xf703,
+	0xf700,	0xf207,	0xf701,	0xf601,	0xf602,	0xf600,	0xf603,	0xf200,
+	0xf200,	0xf310,	0xf200,	0xf30c,	0xf200,	0xf30a,	0xf200,	0xf208,
+	0xf200,	0xf200,	0xf200,	0xf30d,	0xf30e,	0xf200,	0xf30b,	0xf200,
+	0xf200,	0xf200,	0xf300,	0xf301,	0xf302,	0xf303,	0xf304,	0xf305,
+	0xf306,	0xf307,	0xf200,	0xf308,	0xf309,	0xf200,	0xf200,	0xf200,
+	0xf104,	0xf105,	0xf106,	0xf102,	0xf107,	0xf108,	0xf200,	0xf10a,
+	0xf200,	0xf10c,	0xf200,	0xf209,	0xf200,	0xf109,	0xf200,	0xf10b,
+	0xf200,	0xf11d,	0xf115,	0xf114,	0xf118,	0xf116,	0xf103,	0xf117,
+	0xf101,	0xf119,	0xf100,	0xf700,	0xf701,	0xf702,	0xf200,	0xf200,
+};
+
+static u_short macshift_map[NR_KEYS] __initdata = {
+	0xfb41,	0xfb53,	0xfb44,	0xfb46,	0xfb48,	0xfb47,	0xfb5a,	0xfb58,
+	0xfb43,	0xfb56,	0xf200,	0xfb42,	0xfb51,	0xfb57,	0xfb45,	0xfb52,
+	0xfb59,	0xfb54,	0xf021,	0xf040,	0xf023,	0xf024,	0xf05e,	0xf025,
+	0xf02b,	0xf028,	0xf026,	0xf05f,	0xf02a,	0xf029,	0xf07d,	0xfb4f,
+	0xfb55,	0xf07b,	0xfb49,	0xfb50,	0xf201,	0xfb4c,	0xfb4a,	0xf022,
+	0xfb4b,	0xf03a,	0xf07c,	0xf03c,	0xf03f,	0xfb4e,	0xfb4d,	0xf03e,
+	0xf009,	0xf020,	0xf07e,	0xf07f,	0xf200,	0xf01b,	0xf702,	0xf703,
+	0xf700,	0xf207,	0xf701,	0xf601,	0xf602,	0xf600,	0xf603,	0xf200,
+	0xf200,	0xf310,	0xf200,	0xf30c,	0xf200,	0xf30a,	0xf200,	0xf208,
+	0xf200,	0xf200,	0xf200,	0xf30d,	0xf30e,	0xf200,	0xf30b,	0xf200,
+	0xf200,	0xf200,	0xf300,	0xf301,	0xf302,	0xf303,	0xf304,	0xf305,
+	0xf306,	0xf307,	0xf200,	0xf308,	0xf309,	0xf200,	0xf200,	0xf200,
+	0xf10e,	0xf10f,	0xf110,	0xf10c,	0xf111,	0xf112,	0xf200,	0xf10a,
+	0xf200,	0xf10c,	0xf200,	0xf203,	0xf200,	0xf113,	0xf200,	0xf10b,
+	0xf200,	0xf11d,	0xf115,	0xf114,	0xf20b,	0xf116,	0xf10d,	0xf117,
+	0xf10b,	0xf20a,	0xf10a,	0xf700,	0xf701,	0xf702,	0xf200,	0xf200,
+};
+
+static u_short macaltgr_map[NR_KEYS] __initdata = {
+	0xf914,	0xfb73,	0xf917,	0xf919,	0xfb68,	0xfb67,	0xfb7a,	0xfb78,
+	0xf916,	0xfb76,	0xf200,	0xf915,	0xfb71,	0xfb77,	0xf918,	0xfb72,
+	0xfb79,	0xfb74,	0xf200,	0xf040,	0xf200,	0xf024,	0xf200,	0xf200,
+	0xf200,	0xf05d,	0xf07b,	0xf05c,	0xf05b,	0xf07d,	0xf07e,	0xfb6f,
+	0xfb75,	0xf200,	0xfb69,	0xfb70,	0xf201,	0xfb6c,	0xfb6a,	0xf200,
+	0xfb6b,	0xf200,	0xf200,	0xf200,	0xf200,	0xfb6e,	0xfb6d,	0xf200,
+	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf702,	0xf703,
+	0xf700,	0xf207,	0xf701,	0xf601,	0xf602,	0xf600,	0xf603,	0xf200,
+	0xf200,	0xf310,	0xf200,	0xf30c,	0xf200,	0xf30a,	0xf200,	0xf208,
+	0xf200,	0xf200,	0xf200,	0xf30d,	0xf30e,	0xf200,	0xf30b,	0xf200,
+	0xf200,	0xf200,	0xf90a,	0xf90b,	0xf90c,	0xf90d,	0xf90e,	0xf90f,
+	0xf910,	0xf911,	0xf200,	0xf912,	0xf913,	0xf200,	0xf200,	0xf200,
+	0xf510,	0xf511,	0xf512,	0xf50e,	0xf513,	0xf514,	0xf200,	0xf516,
+	0xf200,	0xf10c,	0xf200,	0xf202,	0xf200,	0xf515,	0xf200,	0xf517,
+	0xf200,	0xf11d,	0xf115,	0xf114,	0xf118,	0xf116,	0xf50f,	0xf117,
+	0xf50d,	0xf119,	0xf50c,	0xf700,	0xf701,	0xf702,	0xf200,	0xf200,
+};
+
+static u_short macctrl_map[NR_KEYS] __initdata = {
+	0xf001,	0xf013,	0xf004,	0xf006,	0xf008,	0xf007,	0xf01a,	0xf018,
+	0xf003,	0xf016,	0xf200,	0xf002,	0xf011,	0xf017,	0xf005,	0xf012,
+	0xf019,	0xf014,	0xf200,	0xf000,	0xf01b,	0xf01c,	0xf01e,	0xf01d,
+	0xf200,	0xf200,	0xf01f,	0xf01f,	0xf07f,	0xf200,	0xf01d,	0xf00f,
+	0xf015,	0xf01b,	0xf009,	0xf010,	0xf201,	0xf00c,	0xf00a,	0xf007,
+	0xf00b,	0xf200,	0xf01c,	0xf200,	0xf07f,	0xf00e,	0xf00d,	0xf20e,
+	0xf200,	0xf000,	0xf000,	0xf008,	0xf200,	0xf200,	0xf702,	0xf703,
+	0xf700,	0xf207,	0xf701,	0xf601,	0xf602,	0xf600,	0xf603,	0xf200,
+	0xf200,	0xf310,	0xf200,	0xf30c,	0xf200,	0xf30a,	0xf200,	0xf208,
+	0xf200,	0xf200,	0xf200,	0xf30d,	0xf30e,	0xf200,	0xf30b,	0xf200,
+	0xf200,	0xf200,	0xf300,	0xf301,	0xf302,	0xf303,	0xf304,	0xf305,
+	0xf306,	0xf307,	0xf200,	0xf308,	0xf309,	0xf200,	0xf200,	0xf200,
+	0xf104,	0xf105,	0xf106,	0xf102,	0xf107,	0xf108,	0xf200,	0xf10a,
+	0xf200,	0xf10c,	0xf200,	0xf204,	0xf200,	0xf109,	0xf200,	0xf10b,
+	0xf200,	0xf11d,	0xf115,	0xf114,	0xf118,	0xf116,	0xf103,	0xf117,
+	0xf101,	0xf119,	0xf100,	0xf700,	0xf701,	0xf702,	0xf200,	0xf200,
+};
+
+static u_short macshift_ctrl_map[NR_KEYS] __initdata = {
+	0xf001,	0xf013,	0xf004,	0xf006,	0xf008,	0xf007,	0xf01a,	0xf018,
+	0xf003,	0xf016,	0xf200,	0xf002,	0xf011,	0xf017,	0xf005,	0xf012,
+	0xf019,	0xf014,	0xf200,	0xf000,	0xf200,	0xf200,	0xf200,	0xf200,
+	0xf200,	0xf200,	0xf200,	0xf01f,	0xf200,	0xf200,	0xf200,	0xf00f,
+	0xf015,	0xf200,	0xf009,	0xf010,	0xf201,	0xf00c,	0xf00a,	0xf200,
+	0xf00b,	0xf200,	0xf200,	0xf200,	0xf200,	0xf00e,	0xf00d,	0xf200,
+	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf702,	0xf703,
+	0xf700,	0xf207,	0xf701,	0xf601,	0xf602,	0xf600,	0xf603,	0xf200,
+	0xf200,	0xf310,	0xf200,	0xf30c,	0xf200,	0xf30a,	0xf200,	0xf208,
+	0xf200,	0xf200,	0xf200,	0xf30d,	0xf30e,	0xf200,	0xf30b,	0xf200,
+	0xf200,	0xf200,	0xf300,	0xf301,	0xf302,	0xf303,	0xf304,	0xf305,
+	0xf306,	0xf307,	0xf200,	0xf308,	0xf309,	0xf200,	0xf200,	0xf200,
+	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,
+	0xf200,	0xf10c,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,
+	0xf200,	0xf11d,	0xf115,	0xf114,	0xf118,	0xf116,	0xf200,	0xf117,
+	0xf200,	0xf119,	0xf200,	0xf700,	0xf701,	0xf702,	0xf200,	0xf20c,
+};
+
+static u_short macalt_map[NR_KEYS] __initdata = {
+	0xf861,	0xf873,	0xf864,	0xf866,	0xf868,	0xf867,	0xf87a,	0xf878,
+	0xf863,	0xf876,	0xf200,	0xf862,	0xf871,	0xf877,	0xf865,	0xf872,
+	0xf879,	0xf874,	0xf831,	0xf832,	0xf833,	0xf834,	0xf836,	0xf835,
+	0xf83d,	0xf839,	0xf837,	0xf82d,	0xf838,	0xf830,	0xf85d,	0xf86f,
+	0xf875,	0xf85b,	0xf869,	0xf870,	0xf80d,	0xf86c,	0xf86a,	0xf827,
+	0xf86b,	0xf83b,	0xf85c,	0xf82c,	0xf82f,	0xf86e,	0xf86d,	0xf82e,
+	0xf809,	0xf820,	0xf860,	0xf87f,	0xf200,	0xf81b,	0xf702,	0xf703,
+	0xf700,	0xf207,	0xf701,	0xf210,	0xf211,	0xf600,	0xf603,	0xf200,
+	0xf200,	0xf310,	0xf200,	0xf30c,	0xf200,	0xf30a,	0xf200,	0xf208,
+	0xf200,	0xf200,	0xf200,	0xf30d,	0xf30e,	0xf200,	0xf30b,	0xf200,
+	0xf200,	0xf200,	0xf900,	0xf901,	0xf902,	0xf903,	0xf904,	0xf905,
+	0xf906,	0xf907,	0xf200,	0xf908,	0xf909,	0xf200,	0xf200,	0xf200,
+	0xf504,	0xf505,	0xf506,	0xf502,	0xf507,	0xf508,	0xf200,	0xf50a,
+	0xf200,	0xf10c,	0xf200,	0xf209,	0xf200,	0xf509,	0xf200,	0xf50b,
+	0xf200,	0xf11d,	0xf115,	0xf114,	0xf118,	0xf116,	0xf503,	0xf117,
+	0xf501,	0xf119,	0xf500,	0xf700,	0xf701,	0xf702,	0xf200,	0xf200,
+};
+
+static u_short macctrl_alt_map[NR_KEYS] __initdata = {
+	0xf801,	0xf813,	0xf804,	0xf806,	0xf808,	0xf807,	0xf81a,	0xf818,
+	0xf803,	0xf816,	0xf200,	0xf802,	0xf811,	0xf817,	0xf805,	0xf812,
+	0xf819,	0xf814,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,
+	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf80f,
+	0xf815,	0xf200,	0xf809,	0xf810,	0xf201,	0xf80c,	0xf80a,	0xf200,
+	0xf80b,	0xf200,	0xf200,	0xf200,	0xf200,	0xf80e,	0xf80d,	0xf200,
+	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf702,	0xf703,
+	0xf700,	0xf207,	0xf701,	0xf601,	0xf602,	0xf600,	0xf603,	0xf200,
+	0xf200,	0xf310,	0xf200,	0xf30c,	0xf200,	0xf30a,	0xf200,	0xf208,
+	0xf200,	0xf200,	0xf200,	0xf30d,	0xf30e,	0xf200,	0xf30b,	0xf200,
+	0xf200,	0xf200,	0xf300,	0xf301,	0xf302,	0xf303,	0xf304,	0xf305,
+	0xf306,	0xf307,	0xf200,	0xf308,	0xf309,	0xf200,	0xf200,	0xf200,
+	0xf504,	0xf505,	0xf506,	0xf502,	0xf507,	0xf508,	0xf200,	0xf50a,
+	0xf200,	0xf10c,	0xf200,	0xf200,	0xf200,	0xf509,	0xf200,	0xf50b,
+	0xf200,	0xf11d,	0xf115,	0xf114,	0xf118,	0xf116,	0xf503,	0xf117,
+	0xf501,	0xf119,	0xf500,	0xf700,	0xf701,	0xf702,	0xf200,	0xf200,
+};
+
+
 static void kbd_repeat(unsigned long);
 static struct timer_list repeat_timer = { NULL, NULL, 0, 0, kbd_repeat };
 static int last_keycode;
@@ -118,6 +252,10 @@
 	up_flag = (keycode & 0x80);
 	keycode &= 0x7f;
 
+	/* on the powerbook 3400, the power key gives code 0x7e */
+	if (keycode == 0x7e)
+		keycode = 0x7f;
+
 	if (!repeat)
 		del_timer(&repeat_timer);
 
@@ -388,9 +526,21 @@
 	}
 }
 
-void mackbd_init_hw(void)
+__initfunc(void mackbd_init_hw(void))
 {
 	struct adb_request req;
+
+	if ( (_machine != _MACH_chrp) && (_machine != _MACH_Pmac) )
+		return;
+
+	/* setup key map */
+	memcpy(plain_map, macplain_map, sizeof(plain_map));
+	memcpy(shift_map, macshift_map, sizeof(shift_map));
+	memcpy(altgr_map, macaltgr_map, sizeof(altgr_map));
+	memcpy(ctrl_map, macctrl_map, sizeof(ctrl_map));
+	memcpy(shift_ctrl_map, macshift_ctrl_map, sizeof(shift_ctrl_map));
+	memcpy(alt_map, macalt_map, sizeof(alt_map));
+	memcpy(ctrl_alt_map, macctrl_alt_map, sizeof(ctrl_alt_map));
 
 	/* initialize mouse interrupt hook */
 	adb_mouse_interrupt_hook = NULL;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/Config.in m68k/drivers/video/Config.in
--- m68k-2.1.85/drivers/video/Config.in	Tue Mar 17 19:50:32 1998
+++ m68k/drivers/video/Config.in	Wed Mar 18 20:38:19 1998
@@ -25,12 +25,12 @@
   fi
   if [ "$CONFIG_ATARI" = "y" ]; then
     bool 'Atari native chipset support' CONFIG_FB_ATARI
-#    tristate 'Mach64 Frame Buffer support' CONFIG_FB_MACH64
+    bool 'ATI Mach64 display support' CONFIG_FB_ATY
   fi
-  if [ "$CONFIG_CHRP" = "y" -o "$CONFIG_PMAC" = "y" ]; then
-    bool 'Open Firmware frame buffer device support' CONFIG_FB_OPEN_FIRMWARE
+  if [ "$CONFIG_PPC" = "y" ]; then
+    bool 'Open Firmware frame buffer device support' CONFIG_FB_OF
     bool 'S3 Trio frame buffer device support' CONFIG_FB_S3TRIO
-    if [ "$CONFIG_FB_OPEN_FIRMWARE" = "y" ]; then
+    if [ "$CONFIG_FB_OF" = "y" ]; then
 #     bool 'Apple "control" display support' CONFIG_FB_CONTROL
 #     bool 'Apple "platinum" display support' CONFIG_FB_PLATINUM
 #     bool 'Apple "valkyrie" display support' CONFIG_FB_VALKYRIE
@@ -42,7 +42,7 @@
   fi
   if [ "$CONFIG_MAC" = "y" ]; then
     define_bool CONFIG_FB_MAC y
-  fi 
+  fi
   if [ "$CONFIG_TGA_CONSOLE" = "y" ]; then
     define_bool CONFIG_FB_TGA y
   fi
@@ -55,7 +55,7 @@
     bool '4 bpp packed pixels support' CONFIG_FBCON_CFB4
     bool '8 bpp packed pixels support' CONFIG_FBCON_CFB8
     bool '16 bpp packed pixels support' CONFIG_FBCON_CFB16
-#   bool '24 bpp packed pixels support' CONFIG_FBCON_CFB24
+    bool '24 bpp packed pixels support' CONFIG_FBCON_CFB24
     bool '32 bpp packed pixels support' CONFIG_FBCON_CFB32
     bool 'Amiga bitplanes support' CONFIG_FBCON_AFB
     bool 'Amiga interleaved bitplanes support' CONFIG_FBCON_ILBM
@@ -64,9 +64,12 @@
     bool 'Atari interleaved bitplanes (8 planes) support' CONFIG_FBCON_IPLAN2P8
     bool 'Mac variable bpp packed pixels support' CONFIG_FBCON_MAC
   else
-    if [ "$CONFIG_FB_AMIGA" != "n" -o "$CONFIG_FB_ATARI" != "n" -o \
-	 "$CONFIG_FB_CYBER" != "n" -o "$CONFIG_FB_RETINAZ3" != "n" -o \
-	 "$CONFIG_FB_VIRGE" != "n" -o "$CONFIG_FB_MAC" != "n" -o \
+    if [ "$CONFIG_FB_AMIGA" = "y" -o "$CONFIG_FB_AMIGA" = "m" -o \
+	 "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATARI" = "m" -o \
+	 "$CONFIG_FB_CYBER" = "y" -o "$CONFIG_FB_CYBER" = "m" -o \
+	 "$CONFIG_FB_RETINAZ3" = "y" -o "$CONFIG_FB_RETINAZ3" = "m" -o \
+	 "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_VIRGE" = "m" -o \
+	 "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_MAC" = "m" -o \
 	 "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
       define_bool CONFIG_FBCON_MFB y
     fi
@@ -79,25 +82,30 @@
       define_bool CONFIG_FBCON_IPLAN2P4 y
       define_bool CONFIG_FBCON_IPLAN2P8 y
     fi
-    if [ "$CONFIG_FB_MAC" = "y" -o \
+    if [ "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_MAC" = "m" -o \
 	 "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
       define_bool CONFIG_FBCON_MAC  y
       define_bool CONFIG_FBCON_CFB2 y
       define_bool CONFIG_FBCON_CFB4 y
     fi
     if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATARI" = "m" -o \
-	 "$CONFIG_FB_OPEN_FIRMWARE" = "y" -o "$CONFIG_FB_MAC" = "y" -o \
-	 "$CONFIG_FB_TGA" = "y" -o \
+	 "$CONFIG_FB_OF" = "y" -o "$CONFIG_FB_OF" = "m" -o \
+	 "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_MAC" = "m" -o  \
+	 "$CONFIG_FB_TGA" = "y" -o "$CONFIG_FB_TGA" = "m" -o \
 	 "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
       define_bool CONFIG_FBCON_CFB8 y
     fi
     if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATARI" = "m" -o \
-	 "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_MAC" = "y" -o \
+	 "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_ATY" = "m" -o \
+	 "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_MAC" = "m" -o \
 	 "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
       define_bool CONFIG_FBCON_CFB16 y
     fi
+    if [ "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
+      define_bool CONFIG_FBCON_CFB24 y
+    fi
     if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATARI" = "m" -o \
-	 "$CONFIG_FB_ATY" = "y" -o \
+	 "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_ATY" = "m" -o \
 	 "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
       define_bool CONFIG_FBCON_CFB32 y
     fi
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/Makefile m68k/drivers/video/Makefile
--- m68k-2.1.85/drivers/video/Makefile	Tue Mar 17 19:27:35 1998
+++ m68k/drivers/video/Makefile	Wed Mar 18 23:35:47 1998
@@ -64,15 +64,7 @@
 L_OBJS += macfb.o
 endif
 
-ifeq ($(CONFIG_FB_MACH64),y)
-L_OBJS += mach64fb.o
-else
-  ifeq ($(CONFIG_FB_MACH64),m)
-  M_OBJS += mach64fb.o
-  endif
-endif
-
-ifeq ($(CONFIG_FB_OPEN_FIRMWARE),y)
+ifeq ($(CONFIG_FB_OF),y)
 L_OBJS += offb.o
 endif
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/S3triofb.c m68k/drivers/video/S3triofb.c
--- m68k-2.1.85/drivers/video/S3triofb.c	Tue Mar 17 19:50:32 1998
+++ m68k/drivers/video/S3triofb.c	Wed Mar 18 23:26:48 1998
@@ -23,6 +23,7 @@
 
 */
 
+#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -73,21 +74,27 @@
 
 static int s3trio_open(struct fb_info *info);
 static int s3trio_release(struct fb_info *info);
-static int s3trio_get_fix(struct fb_fix_screeninfo *fix, struct fb_info *info);
-static int s3trio_get_var(struct fb_var_screeninfo *var, struct fb_info *info);
-static int s3trio_set_var(struct fb_var_screeninfo *var, struct fb_info *info);
-static int s3trio_pan_display(struct fb_var_screeninfo *var,
-			      struct fb_info *info);
-static int s3trio_get_cmap(struct fb_cmap *cmap, int kspc,
+static int s3trio_get_fix(struct fb_fix_screeninfo *fix, int con,
+			  struct fb_info *info);
+static int s3trio_get_var(struct fb_var_screeninfo *var, int con,
+			  struct fb_info *info);
+static int s3trio_set_var(struct fb_var_screeninfo *var, int con,
+			  struct fb_info *info);
+static int s3trio_get_cmap(struct fb_cmap *cmap, int kspc, int con,
 			   struct fb_info *info);
-static int s3trio_set_cmap(struct fb_cmap *cmap, int kspc,
+static int s3trio_set_cmap(struct fb_cmap *cmap, int kspc, int con,
 			   struct fb_info *info);
+static int s3trio_pan_display(struct fb_var_screeninfo *var, int con,
+			      struct fb_info *info);
 static int s3trio_ioctl(struct inode *inode, struct file *file, u_int cmd,
-			    u_long arg, struct fb_info *info);
+			u_long arg, int con, struct fb_info *info);
 
 #ifdef CONFIG_FB_COMPAT_XPMAC
 extern struct vc_mode display_info;
+extern struct fb_info *console_fb_info;
 extern int (*console_setmode_ptr)(struct vc_mode *, int);
+extern int (*console_set_cmap_ptr)(struct fb_cmap *, int, int,
+				   struct fb_info *);
 static int s3trio_console_setmode(struct vc_mode *mode, int doit);
 #endif /* CONFIG_FB_COMPAT_XPMAC */
 
@@ -105,7 +112,9 @@
      *  Text console acceleration
      */
 
+#ifdef CONFIG_FBCON_CFB8
 static struct display_switch fbcon_trio8;
+#endif
 
     /*
      *    Accelerated Functions used by the low level console driver
@@ -134,7 +143,7 @@
 
 static struct fb_ops s3trio_ops = {
     s3trio_open, s3trio_release, s3trio_get_fix, s3trio_get_var, s3trio_set_var,
-    s3trio_get_cmap, s3trio_set_cmap, s3trio_pan_display, s3trio_ioctl
+    s3trio_get_cmap, s3trio_set_cmap, s3trio_pan_display, NULL, s3trio_ioctl
 };
 
 
@@ -163,7 +172,8 @@
      *  Get the Fixed Part of the Display
      */
 
-static int s3trio_get_fix(struct fb_fix_screeninfo *fix, struct fb_info *info)
+static int s3trio_get_fix(struct fb_fix_screeninfo *fix, int con,
+			  struct fb_info *info)
 {
     memcpy(fix, &fb_fix, sizeof(fb_fix));
     return 0;
@@ -174,7 +184,8 @@
      *  Get the User Defined Part of the Display
      */
 
-static int s3trio_get_var(struct fb_var_screeninfo *var, struct fb_info *info)
+static int s3trio_get_var(struct fb_var_screeninfo *var, int con,
+			  struct fb_info *info)
 {
     memcpy(var, &fb_var, sizeof(fb_var));
     return 0;
@@ -185,7 +196,8 @@
      *  Set the User Defined Part of the Display
      */
 
-static int s3trio_set_var(struct fb_var_screeninfo *var, struct fb_info *info)
+static int s3trio_set_var(struct fb_var_screeninfo *var, int con,
+			  struct fb_info *info)
 {
     if (var->xres > fb_var.xres || var->yres > fb_var.yres ||
 	var->xres_virtual > fb_var.xres_virtual ||
@@ -204,7 +216,7 @@
      *  This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag
      */
 
-static int s3trio_pan_display(struct fb_var_screeninfo *var,
+static int s3trio_pan_display(struct fb_var_screeninfo *var, int con,
 			      struct fb_info *info)
 {
     if (var->xoffset || var->yoffset)
@@ -217,7 +229,7 @@
      *  Get the Colormap
      */
 
-static int s3trio_get_cmap(struct fb_cmap *cmap, int kspc,
+static int s3trio_get_cmap(struct fb_cmap *cmap, int kspc, int con,
 			   struct fb_info *info)
 {
     if (con == currcon) /* current console? */
@@ -235,7 +247,7 @@
      *  Set the Colormap
      */
 
-static int s3trio_set_cmap(struct fb_cmap *cmap, int kspc,
+static int s3trio_set_cmap(struct fb_cmap *cmap, int kspc, int con,
 			   struct fb_info *info)
 {
     int err;
@@ -256,7 +268,7 @@
 
 
 static int s3trio_ioctl(struct inode *inode, struct file *file, u_int cmd,
-			u_long arg, struct fb_info *info)
+			u_long arg, int con, struct fb_info *info)
 {
     return -EINVAL;
 }
@@ -521,7 +533,11 @@
     disp.line_length = fb_fix.line_length;
     disp.can_soft_blank = 1;
     disp.inverse = 0;
+#ifdef CONFIG_FBCON_CFB8
     disp.dispsw = &fbcon_trio8;
+#else
+    disp.dispsw = NULL;
+#endif
 
     strcpy(fb_info.modename, "Trio64 ");
     strncat(fb_info.modename, dp->full_name, sizeof(fb_info.modename));
@@ -542,24 +558,29 @@
 #endif
 
 #ifdef CONFIG_FB_COMPAT_XPMAC
-    display_info.height = fb_var.yres;
-    display_info.width = fb_var.xres;
-    display_info.depth = 8;
-    display_info.pitch = fb_fix.line_length;
-    display_info.mode = 0;
-    strncpy(display_info.name, dp->name, sizeof(display_info.name));
-    display_info.fb_address = (unsigned long)fb_fix.smem_start;
-    display_info.disp_reg_address = address + 0x1008000;
-    display_info.cmap_adr_address = address + 0x1008000 + 0x3c8;
-    display_info.cmap_data_address = address + 0x1008000 + 0x3c9;
-    console_setmode_ptr = s3trio_console_setmode;
+    if (!console_fb_info) {
+	display_info.height = fb_var.yres;
+	display_info.width = fb_var.xres;
+	display_info.depth = 8;
+	display_info.pitch = fb_fix.line_length;
+	display_info.mode = 0;
+	strncpy(display_info.name, dp->name, sizeof(display_info.name));
+	display_info.fb_address = (unsigned long)fb_fix.smem_start;
+	display_info.disp_reg_address = address + 0x1008000;
+	display_info.cmap_adr_address = address + 0x1008000 + 0x3c8;
+	display_info.cmap_data_address = address + 0x1008000 + 0x3c9;
+	console_fb_info = &fb_info;
+	console_setmode_ptr = s3trio_console_setmode;
+	console_set_cmap_ptr = s3trio_set_cmap;
+    }
 #endif /* CONFIG_FB_COMPAT_XPMAC) */
 
     err = register_framebuffer(&fb_info);
     if (err < 0)
 	return mem_start;
 
-    printk("S3 Trio frame buffer device on %s\n", dp->full_name);
+    printk("fb%d: S3 Trio frame buffer device on %s\n",
+	   GET_FB_IDX(fb_info.node), dp->full_name);
 
     return mem_start;
 }
@@ -603,7 +624,7 @@
 
 static int s3triofbcon_setcmap(struct fb_cmap *cmap, int con)
 {
-    return(s3trio_set_cmap(cmap, 1, con));
+    return(s3trio_set_cmap(cmap, 1, con, &fb_info));
 }
 
 
@@ -654,10 +675,10 @@
 	return;
     if (fb_display[con].cmap.len)
 	fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-		    s3trio_setcolreg, info);
+		    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, info);
+		    &fb_display[con].var, 1, s3trio_setcolreg, &fb_info);
 }
 
 #ifdef CONFIG_FB_COMPAT_XPMAC
@@ -812,6 +833,7 @@
      *  Text console acceleration
      */
 
+#ifdef CONFIG_FBCON_CFB8
 static void fbcon_trio8_bmove(struct display *p, int sy, int sx, int dy,
 			      int dx, int height, int width)
 {
@@ -860,3 +882,4 @@
    fbcon_cfb8_setup, fbcon_trio8_bmove, fbcon_trio8_clear, fbcon_trio8_putc,
    fbcon_trio8_putcs, fbcon_trio8_revc
 };
+#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/amifb.c m68k/drivers/video/amifb.c
--- m68k-2.1.85/drivers/video/amifb.c	Tue Mar 17 19:27:36 1998
+++ m68k/drivers/video/amifb.c	Wed Mar 18 23:24:33 1998
@@ -62,6 +62,8 @@
 
 #include "fbcon-afb.h"
 #include "fbcon-ilbm.h"
+#include "fbcon-mfb.h"
+
 
 #define DEBUG
 
@@ -538,15 +540,6 @@
 
 
 	/*
-	 * Monitor Specifications
-	 *
-	 * These are typical for a `generic' Amiga monitor (e.g. A1960)
-	 */
-
-static long vfmin = 50, vfmax = 90, hfmin = 15000, hfmax = 38000;
-
-
-	/*
 	 * Various macros
 	 */
 
@@ -743,6 +736,7 @@
 static int currcon = 0;
 
 static struct display disp;
+
 static struct fb_info fb_info;
 
 
@@ -984,6 +978,7 @@
 static int amifb_ilbm = 0;	/* interleaved or normal bitplanes */
 static int amifb_inverse = 0;
 static int amifb_usermode __initdata = 0;
+static int amifb_userdepth __initdata = -1;
 
 	/*
 	 * Some default modes
@@ -1250,24 +1245,9 @@
 static struct fb_ops amifb_ops = {
 	amifb_open, amifb_release, amifb_get_fix, amifb_get_var,
 	amifb_set_var, amifb_get_cmap, amifb_set_cmap,
-	amifb_pan_display, amifb_ioctl
+	amifb_pan_display, NULL, amifb_ioctl
 };
 
-static struct useropts {
-	long xres;
-	long yres;
-	long xres_virtual;
-	long yres_virtual;
-	long bits_per_pixel;
-	long left_margin;
-	long right_margin;
-	long upper_margin;
-	long lower_margin;
-	long hsync_len;
-	long vsync_len;
-} useropts __initdata = {
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
-};
 
 __initfunc(void amifb_setup(char *options, int *ints))
 {
@@ -1295,51 +1275,51 @@
 		else if (!strncmp(this_opt, "fstart:", 7))
 			min_fstrt = simple_strtoul(this_opt+7, NULL, 0);
 		else if (!strncmp(this_opt, "depth:", 6))
-			useropts.bits_per_pixel = simple_strtoul(this_opt+6, NULL, 0);
+			amifb_userdepth = simple_strtoul(this_opt+6, NULL, 0);
 		else if (!strncmp(this_opt, "size:", 5)) {
 			p = this_opt + 5;
 			if (*p != ';')
-				useropts.xres = simple_strtoul(p, NULL, 0);
+				amifb_default.xres = simple_strtoul(p, NULL, 0);
 			if (!(p = strchr(p, ';')))
 				continue;
 			if (*++p != ';')
-				useropts.yres = simple_strtoul(p, NULL, 0);
+				amifb_default.yres = simple_strtoul(p, NULL, 0);
 			if (!(p = strchr(p, ';')))
 				continue;
 			if (*++p != ';')
-				useropts.xres_virtual = simple_strtoul(p, NULL, 0);
+				amifb_default.xres_virtual = simple_strtoul(p, NULL, 0);
 			if (!(p = strchr(p, ';')))
 				continue;
 			if (*++p != ';')
-				useropts.yres_virtual = simple_strtoul(p, NULL, 0);
+				amifb_default.yres_virtual = simple_strtoul(p, NULL, 0);
 			if (!(p = strchr(p, ';')))
 				continue;
 			if (*++p)
-				useropts.bits_per_pixel = simple_strtoul(p, NULL, 0);
+				amifb_default.bits_per_pixel = simple_strtoul(p, NULL, 0);
 		} else if (!strncmp(this_opt, "timing:", 7)) {
 			p = this_opt + 7;
 			if (*p != ';')
-				useropts.left_margin = simple_strtoul(p, NULL, 0);
+				amifb_default.left_margin = simple_strtoul(p, NULL, 0);
 			if (!(p = strchr(p, ';')))
 				continue;
 			if (*++p != ';')
-				useropts.right_margin = simple_strtoul(p, NULL, 0);
+				amifb_default.right_margin = simple_strtoul(p, NULL, 0);
 			if (!(p = strchr(p, ';')))
 				continue;
 			if (*++p != ';')
-				useropts.upper_margin = simple_strtoul(p, NULL, 0);
+				amifb_default.upper_margin = simple_strtoul(p, NULL, 0);
 			if (!(p = strchr(p, ';')))
 				continue;
 			if (*++p)
-				useropts.lower_margin = simple_strtoul(p, NULL, 0);
+				amifb_default.lower_margin = simple_strtoul(p, NULL, 0);
 		} else if (!strncmp(this_opt, "sync:", 5)) {
 			p = this_opt + 5;
 			if (*p != ';')
-				useropts.hsync_len = simple_strtoul(p, NULL, 0);
+				amifb_default.hsync_len = simple_strtoul(p, NULL, 0);
 			if (!(p = strchr(p, ';')))
 				continue;
 			if (*++p)
-				useropts.vsync_len = simple_strtoul(p, NULL, 0);
+				amifb_default.vsync_len = simple_strtoul(p, NULL, 0);
 		} else
 			get_video_mode(this_opt);
 	}
@@ -1377,10 +1357,10 @@
 		if (hmax <= 0 || hmax <= hmin)
 			goto cap_invalid;
 
-		vfmin = vmin;
-		vfmax = vmax;
-		hfmin = hmin;
-		hfmax = hmax;
+		fb_info.monspecs.vfmin = vmin;
+		fb_info.monspecs.vfmax = vmax;
+		fb_info.monspecs.hfmin = hmin;
+		fb_info.monspecs.hfmax = hmax;
 cap_invalid:
 		;
 	}
@@ -1498,10 +1478,25 @@
 			display->line_length = fix.line_length;
 			display->can_soft_blank = 1;
 			display->inverse = amifb_inverse;
-			if (amifb_ilbm)
-			    display->dispsw = &fbcon_ilbm;
-			else
-			    display->dispsw = &fbcon_afb;
+			switch (fix.type) {
+#ifdef CONFIG_FBCON_ILBM
+			    case FB_TYPE_INTERLEAVED_PLANES:
+				display->dispsw = &fbcon_ilbm;
+				break;
+#endif
+#ifdef CONFIG_FBCON_AFB
+			    case FB_TYPE_PLANES:
+				display->dispsw = &fbcon_afb;
+				break;
+#endif
+#ifdef CONFIG_FBCON_MFB
+			    case FB_TYPE_PACKED_PIXELS:	/* depth == 1 */
+				display->dispsw = &fbcon_mfb;
+				break;
+#endif
+			    default:
+				display->dispsw = NULL;
+			}
 			if (fb_info.changevar)
 				(*fb_info.changevar)(con);
 		}
@@ -1816,6 +1811,8 @@
 	 * Replace the Tag Values with the Real Pixel Clock Values
 	 */
 
+	if (amifb_userdepth != -1)
+		amifb_default.bits_per_pixel = amifb_userdepth;
 	for (i = 0; i < NUM_TOTAL_MODES; i++) {
 		struct fb_var_screeninfo *var = &amifb_predefined[i].var;
 		tag = var->pixclock;
@@ -1825,6 +1822,22 @@
 				var->bits_per_pixel = maxdepth[tag];
 		}
 	}
+	tag = amifb_default.pixclock;
+	if (tag == TAG_SHRES || tag == TAG_HIRES || tag == TAG_LORES) {
+		amifb_default.pixclock = pixclock[tag];
+		if (amifb_default.bits_per_pixel > maxdepth[tag])
+			amifb_default.bits_per_pixel = maxdepth[tag];
+	}
+
+	/*
+	 *  These monitor specs are for a typical Amiga monitor (e.g. A1960)
+	 */
+	if (fb_info.monspecs.hfmin == 0) {
+	    fb_info.monspecs.hfmin = 15000;
+	    fb_info.monspecs.hfmax = 38000;
+	    fb_info.monspecs.vfmin = 49;
+	    fb_info.monspecs.vfmax = 90;
+	}
 
 	strcpy(fb_info.modename, amifb_name);
 	fb_info.changevar = NULL;
@@ -1881,8 +1894,9 @@
 
 	amifb_set_var(&amifb_default, -1, &fb_info);
 
-	printk("%s frame buffer device, using %ldK of video memory\n",
-	       fb_info.modename, videomemorysize>>10);
+	printk("fb%d: %s frame buffer device, using %ldK of video memory\n",
+	       GET_FB_IDX(fb_info.node), fb_info.modename,
+	       videomemorysize>>10);
 
 	/* TODO: This driver cannot be unloaded yet */
 	MOD_INC_USE_COUNT;
@@ -2026,30 +2040,6 @@
 	for (i = 0; i < NUM_TOTAL_MODES; i++) {
 		if (!strcmp(name, amifb_predefined[i].name)) {
 			amifb_default = amifb_predefined[i].var;
-
-			if (useropts.xres != -1)
-				amifb_default.xres = useropts.xres;
-			if (useropts.yres != -1)
-				amifb_default.yres = useropts.yres;
-			if (useropts.xres_virtual != -1)
-				amifb_default.xres_virtual = useropts.xres_virtual;
-			if (useropts.yres_virtual != -1)
-				amifb_default.yres_virtual = useropts.yres_virtual;
-			if (useropts.bits_per_pixel != -1)
-				amifb_default.bits_per_pixel = useropts.bits_per_pixel;
-			if (useropts.left_margin != -1)
-				amifb_default.left_margin = useropts.left_margin;
-			if (useropts.right_margin != -1)
-				amifb_default.right_margin = useropts.right_margin;
-			if (useropts.upper_margin != -1)
-				amifb_default.upper_margin = useropts.upper_margin;
-			if (useropts.lower_margin != -1)
-				amifb_default.lower_margin = useropts.lower_margin;
-			if (useropts.hsync_len != -1)
-				amifb_default.hsync_len = useropts.hsync_len;
-			if (useropts.vsync_len != -1)
-				amifb_default.vsync_len = useropts.vsync_len;
-
 			amifb_usermode = i;
 			return;
 		}
@@ -2131,6 +2121,12 @@
 	fix->smem_start = (char *)videomemory;
 	fix->smem_len = videomemorysize;
 
+#ifdef CONFIG_FBCON_MFB
+	if (par->bpp == 1) {
+		fix->type = FB_TYPE_PACKED_PIXELS;
+		fix->type_aux = 0;
+	} else
+#endif
 	if (amifb_ilbm) {
 		fix->type = FB_TYPE_INTERLEAVED_PLANES;
 		fix->type_aux = par->next_line;
@@ -2165,7 +2161,7 @@
 {
 	u_short clk_shift, line_shift;
 	u_long maxfetchstop, fstrt, fsize, fconst, xres_n, yres_n;
-	u_long hrate = 0, vrate = 0;
+	u_int htotal, vtotal;
 
 	/*
 	 * Find a matching Pixel Clock
@@ -2302,8 +2298,8 @@
 				DPRINTK("diwstrt_v too low for pal\n");
 				return -EINVAL;
 			}
-			hrate = 15625;
-			vrate = 50;
+			htotal = PAL_HTOTAL>>clk_shift;
+			vtotal = PAL_VTOTAL>>1;
 			if (!IS_OCS) {
 				par->beamcon0 = BMC0_PAL;
 				par->bplcon3 |= BPC3_BRDRBLNK;
@@ -2332,8 +2328,8 @@
 				DPRINTK("diwstrt_v too low for ntsc\n");
 				return -EINVAL;
 			}
-			hrate = 15750;
-			vrate = 60;
+			htotal = NTSC_HTOTAL>>clk_shift;
+			vtotal = NTSC_VTOTAL>>1;
 			if (!IS_OCS) {
 				par->beamcon0 = 0;
 				par->bplcon3 |= BPC3_BRDRBLNK;
@@ -2392,9 +2388,8 @@
 			par->beamcon0 |= BMC0_VSYTRUE;
 		if (var->sync & FB_SYNC_COMP_HIGH_ACT)
 			par->beamcon0 |= BMC0_CSYTRUE;
-		hrate = (amiga_masterclock+par->htotal/2)/par->htotal;
-		vrate = div2(par->vtotal) * par->htotal;
-		vrate = (amiga_masterclock+vrate/2)/vrate;
+		htotal = par->htotal>>clk_shift;
+		vtotal = par->vtotal>>1;
 	} else {
 		DPRINTK("only broadcast modes possible for ocs\n");
 		return -EINVAL;
@@ -2529,7 +2524,8 @@
 	par->crsr.spot_x = par->crsr.spot_y = 0;
 	par->crsr.height = par->crsr.width = 0;
 
-	if (hrate < hfmin || hrate > hfmax || vrate < vfmin || vrate > vfmax) {
+	if (!fbmon_valid_timings(pixclock[clk_shift], htotal, vtotal,
+				 &fb_info)) {
 		DPRINTK("mode doesn't fit for monitor\n");
 		return -EINVAL;
 	}
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/atafb.c m68k/drivers/video/atafb.c
--- m68k-2.1.85/drivers/video/atafb.c	Tue Mar 17 19:27:36 1998
+++ m68k/drivers/video/atafb.c	Wed Mar 18 22:54:53 1998
@@ -765,10 +765,6 @@
 #define F_MON_VGA	2
 #define F_MON_TV	3
 
-/* Multisync monitor capabilities */
-/* Atari-TOS defaults if no boot option present */
-static long vfmin=58, vfmax=62, hfmin=31000, hfmax=32000;
-
 static struct pixel_clock {
 	unsigned long f;	/* f/[Hz] */
 	unsigned long t;	/* t/[ps] (=1/f) */
@@ -1027,11 +1023,14 @@
 
 			/* Choose master pixelclock depending on hor. timing */
 			plen = 1 * xstretch;
-			if ((plen * xres + f25.right+f25.hsync+f25.left) * hfmin < f25.f)
+			if ((plen * xres + f25.right+f25.hsync+f25.left) *
+			    fb_info.monspecs.hfmin < f25.f)
 				pclock = &f25;
-			else if ((plen * xres + f32.right+f32.hsync+f32.left) * hfmin < f32.f)
+			else if ((plen * xres + f32.right+f32.hsync+f32.left) * 
+			    fb_info.monspecs.hfmin < f32.f)
 				pclock = &f32;
-			else if ((plen * xres + fext.right+fext.hsync+fext.left) * hfmin < fext.f
+			else if ((plen * xres + fext.right+fext.hsync+fext.left) * 
+			    fb_info.monspecs.hfmin < fext.f
 			         && fext.f)
 				pclock = &fext;
 			else
@@ -1204,14 +1203,14 @@
 
 	/*  check hor. frequency */
 	hfreq = pclock->f / ((par->HHT+2)*prescale*2);
-	if (hfreq > hfmax && mon_type!=F_MON_VGA) {
+	if (hfreq > fb_info.monspecs.hfmax && mon_type!=F_MON_VGA) {
 		/* ++guenther:   ^^^^^^^^^^^^^^^^^^^ can't remember why I did this */
 		/* Too high -> enlarge margin */
 		left_margin += 1;
 		right_margin += 1;
 		goto again;
 	}
-	if (hfreq > hfmax || hfreq < hfmin)
+	if (hfreq > fb_info.monspecs.hfmax || hfreq < fb_info.monspecs.hfmin)
 		return -EINVAL;
 
 	/* Vxx-registers */
@@ -1240,45 +1239,52 @@
 	/* V-frequency check, hope I didn't create any loop here. */
 	/* Interlace and doubleline are mutually exclusive. */
 	vfreq = (hfreq * 2) / (par->VFT + 1);
-	if      (vfreq > vfmax && !doubleline && !interlace) {
+	if      (vfreq > fb_info.monspecs.vfmax && !doubleline && !interlace) {
 		/* Too high -> try again with doubleline */
 		doubleline = 1;
 		goto again;
 	}
-	else if (vfreq < vfmin && !interlace && !doubleline) {
+	else if (vfreq < fb_info.monspecs.vfmin && !interlace && !doubleline) {
 		/* Too low -> try again with interlace */
 		interlace = 1;
 		goto again;
 	}
-	else if (vfreq < vfmin && doubleline) {
+	else if (vfreq < fb_info.monspecs.vfmin && doubleline) {
 		/* Doubleline too low -> clear doubleline and enlarge margins */
 		int lines;
 		doubleline = 0;
-		for (lines=0; (hfreq*2)/(par->VFT+1+4*lines-2*yres)>vfmax; lines++)
+		for (lines=0;
+		     (hfreq*2)/(par->VFT+1+4*lines-2*yres)>fb_info.monspecs.vfmax;
+		     lines++)
 			;
 		upper_margin += lines;
 		lower_margin += lines;
 		goto again;
 	}
-	else if (vfreq > vfmax && doubleline) {
+	else if (vfreq > fb_info.monspecs.vfmax && doubleline) {
 		/* Doubleline too high -> enlarge margins */
 		int lines;
-		for (lines=0; (hfreq*2)/(par->VFT+1+4*lines)>vfmax; lines+=2)
+		for (lines=0;
+		     (hfreq*2)/(par->VFT+1+4*lines)>fb_info.monspecs.vfmax;
+		     lines+=2)
 			;
 		upper_margin += lines;
 		lower_margin += lines;
 		goto again;
 	}
-	else if (vfreq > vfmax && interlace) {
+	else if (vfreq > fb_info.monspecs.vfmax && interlace) {
 		/* Interlace, too high -> enlarge margins */
 		int lines;
-		for (lines=0; (hfreq*2)/(par->VFT+1+4*lines)>vfmax; lines++)
+		for (lines=0;
+		     (hfreq*2)/(par->VFT+1+4*lines)>fb_info.monspecs.vfmax;
+		     lines++)
 			;
 		upper_margin += lines;
 		lower_margin += lines;
 		goto again;
 	}
-	else if (vfreq < vfmin || vfreq > vfmax)
+	else if (vfreq < fb_info.monspecs.vfmin ||
+		 vfreq > fb_info.monspecs.vfmax)
 		return -EINVAL;
 
   set_screen_base:
@@ -1707,18 +1713,18 @@
 	f030_bus_width = fhw << 6 & 0x80;
 	switch (mon_type) {
 	case F_MON_SM:
-		vfmin = 70;
-		vfmax = 72;
-		hfmin = 35713;
-		hfmax = 35715;
+		fb_info.monspecs.vfmin = 70;
+		fb_info.monspecs.vfmax = 72;
+		fb_info.monspecs.hfmin = 35713;
+		fb_info.monspecs.hfmax = 35715;
 		break;
 	case F_MON_SC:
 	case F_MON_TV:
 		/* PAL...NTSC */
-		vfmin = 49; /* not 50, since TOS defaults to 49.9x Hz */
-		vfmax = 60;
-		hfmin = 15620;
-		hfmax = 15755;
+		fb_info.monspecs.vfmin = 49; /* not 50, since TOS defaults to 49.9x Hz */
+		fb_info.monspecs.vfmax = 60;
+		fb_info.monspecs.hfmin = 15620;
+		fb_info.monspecs.hfmax = 15755;
 		break;
 	}
 	/* initialize hsync-len */
@@ -2636,7 +2642,7 @@
 static struct fb_ops atafb_ops = {
 	atafb_open, atafb_release, atafb_get_fix, atafb_get_var,
 	atafb_set_var, atafb_get_cmap, atafb_set_cmap,
-	atafb_pan_display, atafb_ioctl	
+	atafb_pan_display, NULL, atafb_ioctl	
 };
 
 static void
@@ -2769,6 +2775,16 @@
 		panic("Cannot initialize video hardware\n");
 #endif
 	} while (0);
+
+	/* Multisync monitor capabilities */
+	/* Atari-TOS defaults if no boot option present */
+	if (fb_info.monspecs.hfmin == 0) {
+	    fb_info.monspecs.hfmin = 31000;
+	    fb_info.monspecs.hfmax = 32000;
+	    fb_info.monspecs.vfmin = 58;
+	    fb_info.monspecs.vfmax = 62;
+	}
+
 	detected_mode = fbhw->detect();
 	check_default_par(detected_mode);
 #ifdef ATAFB_EXT
@@ -2836,8 +2852,8 @@
 	   printk("   virtual %dx%d\n",
 			  disp.var.xres_virtual, disp.var.yres_virtual);
 	do_install_cmap(0, &fb_info);
-	printk("%s frame buffer device, using %dK of video memory\n",
-	       fb_info.modename, screen_len>>10);
+	printk("fb%d: %s frame buffer device, using %dK of video memory\n",
+	       GET_FB_IDX(fb_info.node), fb_info.modename, screen_len>>10);
 
 	/* TODO: This driver cannot be unloaded yet */
 	MOD_INC_USE_COUNT;
@@ -3087,10 +3103,10 @@
 	hmax = 1000 * simple_strtoul(p, NULL, 10);
 	if (hmax <= 0 || hmax <= hmin) goto cap_invalid;
 
-	vfmin = vmin;
-	vfmax = vmax;
-	hfmin = hmin;
-	hfmax = hmax;
+	fb_info.monspecs.vfmin = vmin;
+	fb_info.monspecs.vfmax = vmax;
+	fb_info.monspecs.hfmin = hmin;
+	fb_info.monspecs.hfmax = hmax;
       cap_invalid:
 	;
     }
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/atyfb.c m68k/drivers/video/atyfb.c
--- m68k-2.1.85/drivers/video/atyfb.c	Tue Mar 17 19:50:33 1998
+++ m68k/drivers/video/atyfb.c	Wed Mar 18 20:38:20 1998
@@ -329,12 +329,17 @@
      *  Text console acceleration
      */
 
+#ifdef CONFIG_FBCON_CFB8
 static struct display_switch fbcon_aty8;
+#endif
 
 
 #ifdef CONFIG_FB_COMPAT_XPMAC
 extern struct vc_mode display_info;
+extern struct fb_info *console_fb_info;
 extern int (*console_setmode_ptr)(struct vc_mode *, int);
+extern int (*console_set_cmap_ptr)(struct fb_cmap *, int, int,
+				   struct fb_info *);
 static int atyfb_console_setmode(struct vc_mode *, int);
 #endif
 
@@ -352,7 +357,7 @@
 
 static struct fb_ops atyfb_ops = {
     atyfb_open, atyfb_release, atyfb_get_fix, atyfb_get_var, atyfb_set_var,
-    atyfb_get_cmap, atyfb_set_cmap, atyfb_pan_display, atyfb_ioctl
+    atyfb_get_cmap, atyfb_set_cmap, atyfb_pan_display, NULL, atyfb_ioctl
 };
 
 
@@ -859,6 +864,11 @@
 	 init->crtc_gen_cntl[1] == 0))
 	return -EINVAL;
 
+#if 0
+    if (!fbmon_valid_timings(pixclock, htotal, vtotal, info))
+	return -EINVAL;
+#endif
+
     return 0;
 }
 
@@ -1333,10 +1343,15 @@
     encode_var(&var, &default_par);
     atyfb_set_var(&var, -1, &fb_info);
 
-    printk("%s frame buffer device on %s\n", atyfb_name, dp->full_name);
+    printk("fb%d: %s frame buffer device on %s\n", GET_FB_IDX(fb_info.node),
+	   atyfb_name, dp->full_name);
 
 #ifdef CONFIG_FB_COMPAT_XPMAC
-    console_setmode_ptr = atyfb_console_setmode;
+    if (!console_fb_info) {
+	console_fb_info = &fb_info;
+	console_setmode_ptr = atyfb_console_setmode;
+	console_set_cmap_ptr = atyfb_set_cmap;
+    }
 #endif /* CONFIG_FB_COMPAT_XPMAC) */
 
     return mem_start;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/cyberfb.c m68k/drivers/video/cyberfb.c
--- m68k-2.1.85/drivers/video/cyberfb.c	Tue Mar 17 19:50:32 1998
+++ m68k/drivers/video/cyberfb.c	Wed Mar 18 20:38:22 1998
@@ -240,7 +240,9 @@
  *    Text console acceleration
  */
 
+#ifdef CONFIG_FBCON_CFB8
 static struct display_switch fbcon_cyber8;
+#endif
 
 
 /*
@@ -855,12 +857,16 @@
 	display->can_soft_blank = 1;
 	display->inverse = Cyberfb_inverse;
 	switch (display->var.bits_per_pixel) {
+#ifdef CONFIG_FBCON_CFB8
 	    case 8:
 		display->dispsw = &fbcon_cyber8;
 		break;
+#endif
+#ifdef CONFIG_FBCON_CFB16
 	    case 16:
 		display->dispsw = &fbcon_cfb16;
 		break;
+#endif
 	    default:
 		display->dispsw = NULL;
 		break;
@@ -970,7 +976,7 @@
 static struct fb_ops cyberfb_ops = {
 	cyberfb_open, cyberfb_release, cyberfb_get_fix, cyberfb_get_var,
 	cyberfb_set_var, cyberfb_get_cmap, cyberfb_set_cmap,
-	cyberfb_pan_display, cyberfb_ioctl
+	cyberfb_pan_display, NULL, cyberfb_ioctl
 };
 
 
@@ -1051,8 +1057,8 @@
 	cyberfb_set_disp(-1, &fb_info);
 	do_install_cmap(0, &fb_info);
 
-	printk("%s frame buffer device, using %ldK of video memory\n",
-	       fb_info.modename, CyberSize>>10);
+	printk("fb%d: %s frame buffer device, using %ldK of video memory\n",
+	       GET_FB_IDX(fb_info.node), fb_info.modename, CyberSize>>10);
 
 	/* TODO: This driver cannot be unloaded yet */
 	MOD_INC_USE_COUNT;
@@ -1123,6 +1129,7 @@
  *    Text console acceleration
  */
 
+#ifdef CONFIG_FBCON_CFB8
 static void fbcon_cyber8_bmove(struct display *p, int sy, int sx, int dy,
 			       int dx, int height, int width)
 {
@@ -1171,7 +1178,7 @@
    fbcon_cfb8_setup, fbcon_cyber8_bmove, fbcon_cyber8_clear, fbcon_cyber8_putc,
    fbcon_cyber8_putcs, fbcon_cyber8_revc
 };
-
+#endif
 
 
 #ifdef MODULE
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/dnfb.c m68k/drivers/video/dnfb.c
--- m68k-2.1.85/drivers/video/dnfb.c	Tue Mar 17 19:27:36 1998
+++ m68k/drivers/video/dnfb.c	Wed Mar 18 20:38:22 1998
@@ -142,7 +142,7 @@
 static struct fb_info fb_info;
 static struct fb_ops dnfb_ops = { 
 	dnfb_open,dnfb_release, dnfb_get_fix, dnfb_get_var, dnfb_set_var,
-	dnfb_get_cmap, dnfb_set_cmap, dnfb_pan_display, dnfb_ioctl
+	dnfb_get_cmap, dnfb_set_cmap, dnfb_pan_display, NULL, dnfb_ioctl
 };
 
 static int currcon=0;
@@ -306,7 +306,11 @@
    disp[con].can_soft_blank = 1;
    disp[con].inverse = 0;
    disp[con].line_length = fix.line_length;
+#ifdef CONFIG_FBCON_MFB
    disp[con].dispsw = &fbcon_mfb;
+#else
+   disp[con].dispsw = NULL;
+#endif
 }
   
 unsigned long dnfb_init(unsigned long mem_start)
@@ -337,7 +341,8 @@
         outb(S_DATA_PLN, AP_CONTROL_2);
         outw(SWAP(0x3),AP_ROP_1);
 
-        printk("apollo frame buffer alive and kicking !\n");
+        printk("fb%d: apollo frame buffer alive and kicking !\n",
+	       GET_FB_IDX(fb_info.node));
 
 	
         dnfb_get_var(&disp[0].var, 0, &fb_info);
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/fbcon-afb.c m68k/drivers/video/fbcon-afb.c
--- m68k-2.1.85/drivers/video/fbcon-afb.c	Tue Mar 17 19:27:36 1998
+++ m68k/drivers/video/fbcon-afb.c	Wed Mar 18 20:38:22 1998
@@ -13,7 +13,6 @@
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/string.h>
-#include <linux/config.h>
 #include <linux/fb.h>
 
 #include "fbcon.h"
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/fbcon-cfb16.c m68k/drivers/video/fbcon-cfb16.c
--- m68k-2.1.85/drivers/video/fbcon-cfb16.c	Tue Mar 17 19:50:33 1998
+++ m68k/drivers/video/fbcon-cfb16.c	Wed Mar 18 20:38:22 1998
@@ -13,7 +13,6 @@
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/string.h>
-#include <linux/config.h>
 #include <linux/fb.h>
 
 #include "fbcon.h"
@@ -38,7 +37,7 @@
 
 void fbcon_cfb16_setup(struct display *p)
 {
-    p->next_line = p->var.xres_virtual<<1;
+    p->next_line = p->line_length ? p->line_length : p->var.xres_virtual<<1;
     p->next_plane = 0;
 }
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/fbcon-cfb2.c m68k/drivers/video/fbcon-cfb2.c
--- m68k-2.1.85/drivers/video/fbcon-cfb2.c	Tue Mar 17 19:27:38 1998
+++ m68k/drivers/video/fbcon-cfb2.c	Tue Feb 17 23:24:21 1998
@@ -3,7 +3,7 @@
  *				  packed pixels
  *
  *	Created 26 Dec 1997 by Michael Schmitz
- *	Based on 
+ *	Based on cfb4.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
@@ -32,90 +32,13 @@
      *  all week. On a MacII that matters _lots_
      */
 
-static u16 nibbletab_cfb2[] = {
-    0x0000,0x0003,0x000c,0x000f,
-    0x0030,0x0033,0x003c,0x003f,
-    0x00c0,0x00c3,0x00cc,0x00cf,
-    0x00f0,0x00f3,0x00fc,0x00ff,
-
-    0x0300,0x0303,0x030c,0x030f,
-    0x0330,0x0333,0x033c,0x033f,
-    0x03c0,0x03c3,0x03cc,0x03cf,
-    0x03f0,0x03f3,0x03fc,0x03ff,
-
-    0x0c00,0x0c03,0x0c0c,0x0c0f,
-    0x0c30,0x0c33,0x0c3c,0x0c3f,
-    0x0cc0,0x0cc3,0x0ccc,0x0ccf,
-    0x0cf0,0x0cf3,0x0cfc,0x0cff,
-
-    0x0f00,0x0f03,0x0f0c,0x000f,
-    0x0f30,0x0f33,0x0f3c,0x003f,
-    0x0fc0,0x0fc3,0x0fcc,0x00cf,
-    0x0ff0,0x0ff3,0x0ffc,0x0fff,
-
-    /* */
-    0x3000,0x3003,0x300c,0x300f,
-    0x3030,0x3033,0x303c,0x303f,
-    0x30c0,0x30c3,0x30cc,0x30cf,
-    0x30f0,0x30f3,0x30fc,0x30ff,
-
-    0x3300,0x3303,0x330c,0x330f,
-    0x3330,0x3333,0x333c,0x333f,
-    0x33c0,0x33c3,0x33cc,0x33cf,
-    0x33f0,0x33f3,0x33fc,0x33ff,
-
-    0x3c00,0x3c03,0x3c0c,0x3c0f,
-    0x3c30,0x3c33,0x3c3c,0x3c3f,
-    0x3cc0,0x3cc3,0x3ccc,0x3ccf,
-    0x3cf0,0x3cf3,0x3cfc,0x3cff,
-
-    0x3f00,0x3f03,0x3f0c,0x3f0f,
-    0x3f30,0x3f33,0x3f3c,0x3f3f,
-    0x3fc0,0x3fc3,0x3fcc,0x3fcf,
-    0x3ff0,0x3ff3,0x3ffc,0x3fff,
-
-    /* */
-    0xc000,0xc003,0xc00c,0xc00f,
-    0xc030,0xc033,0xc03c,0xc03f,
-    0xc0c0,0xc0c3,0xc0cc,0xc0cf,
-    0xc0f0,0xc0f3,0xc0fc,0xc0ff,
-
-    0xc300,0xc303,0xc30c,0xc30f,
-    0xc330,0xc333,0xc33c,0xc33f,
-    0xc3c0,0xc3c3,0xc3cc,0xc3cf,
-    0xc3f0,0xc3f3,0xc3fc,0xc3ff,
-
-    0xcc00,0xcc03,0xcc0c,0xcc0f,
-    0xcc30,0xcc33,0xcc3c,0xcc3f,
-    0xccc0,0xccc3,0xcccc,0xcccf,
-    0xccf0,0xccf3,0xccfc,0xccff,
-
-    0xcf00,0xcf03,0xcf0c,0xcf0f,
-    0xcf30,0xcf33,0xcf3c,0xcf3f,
-    0xcfc0,0xcfc3,0xcfcc,0xcfcf,
-    0xcff0,0xcff3,0xcffc,0xcfff,
-
-    /* */
-    0xf000,0xf003,0xf00c,0xf00f,
-    0xf030,0xf033,0xf03c,0xf03f,
-    0xf0c0,0xf0c3,0xf0cc,0xf0cf,
-    0xf0f0,0xf0f3,0xf0fc,0xf0ff,
-
-    0xf300,0xf303,0xf30c,0xf30f,
-    0xf330,0xf333,0xf33c,0xf33f,
-    0xf3c0,0xf3c3,0xf3cc,0xf3cf,
-    0xf3f0,0xf3f3,0xf3fc,0xf3ff,
-
-    0xfc00,0xfc03,0xfc0c,0xfc0f,
-    0xfc30,0xfc33,0xfc3c,0xfc3f,
-    0xfcc0,0xfcc3,0xfccc,0xfccf,
-    0xfcf0,0xfcf3,0xfcfc,0xfcff,
-
-    0xff00,0xff03,0xff0c,0xff0f,
-    0xff30,0xff33,0xff3c,0xff3f,
-    0xffc0,0xffc3,0xffcc,0xffcf,
-    0xfff0,0xfff3,0xfffc,0xffff
+static u_char nibbletab_cfb2[]={
+	0x00,0x03,0x0c,0x0f,
+	0x30,0x33,0x3c,0x3f,
+	0xc0,0xc3,0xcc,0xcf,
+	0xf0,0xf3,0xfc,0xff
 };
+ 
 
 void fbcon_cfb2_setup(struct display *p)
 {
@@ -165,19 +88,16 @@
 	int bytes=p->next_line,lines=height * p->fontheight, rows, i;
 	u32 bgx;
 
-/*	if(p->screen_base!=0xFDD00020)
-		mac_boom(1);*/
 	dest = p->screen_base + sy * p->fontheight * bytes + sx * 2;
 
 	bgx=attr_bgcol_ec(p,conp);
-	bgx |= (bgx << 2);	/* expand the colour to 32bits */
+	bgx |= (bgx << 2);	/* expand the colour to 16 bits */
 	bgx |= (bgx << 4);
 	bgx |= (bgx << 8);
-	bgx |= (bgx << 16);
 
 	if (sx == 0 && width * 2 == bytes) {
 		for (i = 0 ; i < lines * width ; i++) {
-			((u32 *)dest)[0]=bgx;
+			((u16 *)dest)[0]=bgx;
 			dest+=2;
 		}
 	} else {
@@ -186,7 +106,7 @@
 			dest=dest0;
 			for (i = 0 ; i < width ; i++) {
 				/* memset ?? */
-				((u32 *)dest)[0]=bgx;
+				((u16 *)dest)[0]=bgx;
 				dest+=2;
 			}
 		}
@@ -202,28 +122,22 @@
 
 	c &= 0xff;
 
-	dest = p->screen_base + yy * p->fontheight * bytes + xx * 4;
+	dest = p->screen_base + yy * p->fontheight * bytes + xx * 2;
 	cdat = p->fontdata + c * p->fontheight;
 
 	fgx=3;/*attr_fgcol(p,conp)&0x0F;*/
 	bgx=attr_bgcol(p,conp)&0x0F;
-	fgx |= (fgx << 2);
+	fgx |= (fgx << 2);	/* expand color to 8 bits */
 	fgx |= (fgx << 4);
-	fgx |= (fgx << 8);
 	bgx |= (bgx << 2);
 	bgx |= (bgx << 4);
-	bgx |= (bgx << 8);
 	eorx = fgx ^ bgx;
 
 	for (rows = p->fontheight ; rows-- ; dest += bytes) {
-		((u16 *)dest)[0]=
-			(nibbletab_cfb2[*cdat >> 6] & eorx) ^ bgx;
-		((u16 *)dest)[1]=
-			(nibbletab_cfb2[(*cdat >> 4) & 0x3] & eorx) ^ bgx;
-		((u16 *)dest)[2]=
-			(nibbletab_cfb2[(*cdat >> 2) & 0x3] & eorx) ^ bgx;
-		((u16 *)dest)[4]=
-			(nibbletab_cfb2[*cdat++ & 0x3] & eorx) ^ bgx;
+		((u8 *)dest)[0]=
+			(nibbletab_cfb2[*cdat >> 4] & eorx) ^ bgx;
+		((u8 *)dest)[1]=
+			(nibbletab_cfb2[*cdat++ & 0xf] & eorx) ^ bgx;
 	}
 }
 
@@ -239,26 +153,18 @@
 	bgx=attr_bgcol(p,conp);
 	fgx |= (fgx << 2);
 	fgx |= (fgx << 4);
-	fgx |= (fgx << 8);
-	fgx |= (fgx << 16);
 	bgx |= (bgx << 2);
 	bgx |= (bgx << 4);
-	bgx |= (bgx << 8);
-	bgx |= (bgx << 16);
 	eorx = fgx ^ bgx;
 	while (count--) {
 		c = *s++;
 		cdat = p->fontdata + c * p->fontheight;
 
 		for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
-			((u16 *)dest)[0]=
-			(nibbletab_cfb2[*cdat >> 6] & eorx) ^ bgx;
-			((u16 *)dest)[1]=
-				(nibbletab_cfb2[(*cdat >> 4) & 0x3] & eorx) ^ bgx;
-			((u16 *)dest)[2]=
-				(nibbletab_cfb2[(*cdat >> 2) & 0x3] & eorx) ^ bgx;
-			((u16 *)dest)[1]=
-			(nibbletab_cfb2[*cdat++ & 0x3] & eorx) ^ bgx;
+			((u8 *)dest)[0]=
+				(nibbletab_cfb2[*cdat >> 4] & eorx) ^ bgx;
+			((u8 *)dest)[1]=
+				(nibbletab_cfb2[*cdat++ & 0xf] & eorx) ^ bgx;
 		}
 		dest0+=2;
 	}
@@ -271,7 +177,7 @@
 
 	dest = p->screen_base + yy * p->fontheight * bytes + xx * 2;
 	for (rows = p->fontheight ; rows-- ; dest += bytes) {
-		((u32 *)dest)[0] ^= 0x33333333;
+		((u16 *)dest)[0] ^= 0xffff;
 	}
 }
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/fbcon-cfb24.c m68k/drivers/video/fbcon-cfb24.c
--- m68k-2.1.85/drivers/video/fbcon-cfb24.c	Thu Jan  1 01:00:00 1970
+++ m68k/drivers/video/fbcon-cfb24.c	Wed Mar 18 23:01:25 1998
@@ -0,0 +1,221 @@
+/*
+ *  linux/drivers/video/cfb24.c -- Low level frame buffer operations for 24 bpp
+ *				   truecolor packed pixels
+ *
+ *	Created 7 Mar 1998 by Geert Uytterhoeven
+ *
+ *  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/module.h>
+#include <linux/tty.h>
+#include <linux/console.h>
+#include <linux/string.h>
+#include <linux/config.h>
+#include <linux/fb.h>
+
+#include "fbcon.h"
+#include "fbcon-cfb24.h"
+
+
+#warning Remove this warning after the test cycle was finalized
+
+
+    /*
+     *  24 bpp packed pixels
+     */
+
+u32 fbcon_cfb24_cmap[16];
+
+void fbcon_cfb24_setup(struct display *p)
+{
+    p->next_line = p->line_length ? p->line_length : p->var.xres_virtual*3;
+    p->next_plane = 0;
+}
+
+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;
+    u8 *src, *dst;
+
+    if (sx == 0 && dx == 0 && width * 24 == bytes)
+	mymemmove(p->screen_base + dy * linesize,
+		  p->screen_base + sy * linesize,
+		  height * linesize);
+    else if (dy < sy || (dy == sy && dx < sx)) {
+	src = p->screen_base + sy * linesize + sx * 24;
+	dst = p->screen_base + dy * linesize + dx * 24;
+	for (rows = height * p->fontheight ; rows-- ;) {
+	    mymemmove(dst, src, width * 24);
+	    src += bytes;
+	    dst += bytes;
+	}
+    } else {
+	src = p->screen_base + (sy+height) * linesize + sx * 24 - bytes;
+	dst = p->screen_base + (dy+height) * linesize + dx * 24 - bytes;
+	for (rows = height * p->fontheight ; rows-- ;) {
+	    mymemmove(dst, src, width * 24);
+	    src -= bytes;
+	    dst -= bytes;
+	}
+    }
+}
+
+void fbcon_cfb24_clear(struct vc_data *conp, struct display *p, int sy, int sx,
+		       int height, int width)
+{
+    u8 *dest0, *dest;
+    int bytes = p->next_line, lines = height * p->fontheight, rows, i;
+    u32 bgx;
+
+    dest = p->screen_base + sy * p->fontheight * bytes + sx * 24;
+
+    bgx = fbcon_cfb24_cmap[attr_bgcol_ec(p, conp)];
+
+    if (sx == 0 && width * 24 == bytes)
+	for (i = 0 ; i < lines * width ; i++) {
+	    ((u32 *)dest)[0] = bgx;
+	    ((u32 *)dest)[1] = bgx;
+	    ((u32 *)dest)[2] = bgx;
+	    ((u32 *)dest)[3] = bgx;
+	    ((u32 *)dest)[4] = bgx;
+	    ((u32 *)dest)[5] = bgx;
+	    dest += 24;
+	}
+    else {
+	dest0 = dest;
+	for (rows = lines; rows-- ; dest0 += bytes) {
+	    dest = dest0;
+	    for (i = 0 ; i < width ; i++) {
+		((u32 *)dest)[0] = bgx;
+		((u32 *)dest)[1] = bgx;
+		((u32 *)dest)[2] = bgx;
+		((u32 *)dest)[3] = bgx;
+		((u32 *)dest)[4] = bgx;
+		((u32 *)dest)[5] = bgx;
+		dest += 24;
+	    }
+	}
+    }
+}
+
+static inline void store4pixels(u32 d1, u32 d2, u32 d3, u32 d4, u32 *dest)
+{
+#if defined(__BIG_ENDIAN)
+    *dest++ = (d1<<8) | (d2>>16);
+    *dest++ = (d2<<16) | (d3>>8);
+    *dest++ = (d3<<24) | d4;
+#elif defined(__LITTLE_ENDIAN)
+#error Please add support for little endian byteorder
+#else
+#error FIXME: No endianness??
+#endif
+}
+
+void fbcon_cfb24_putc(struct vc_data *conp, struct display *p, int c, int yy,
+		      int xx)
+{
+    u8 *dest, *cdat;
+    int bytes = p->next_line, rows;
+    u32 eorx, fgx, bgx;
+
+    c &= 0xff;
+
+    dest = p->screen_base + yy * p->fontheight * bytes + xx * 24;
+    cdat = p->fontdata + c * p->fontheight;
+
+    fgx = fbcon_cfb24_cmap[attr_fgcol(p, conp)];
+    bgx = fbcon_cfb24_cmap[attr_bgcol(p, conp)];
+    eorx = fgx ^ bgx;
+
+    for (rows = p->fontheight ; rows-- ; dest += bytes) {
+	u8 bits = *cdat++;
+	u32 d1, d2, d3, d4;
+	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);
+	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));
+    }
+}
+
+void fbcon_cfb24_putcs(struct vc_data *conp, struct display *p, const char *s,
+		       int count, int yy, int xx)
+{
+    u8 *cdat, c, *dest, *dest0;
+    int rows, bytes = p->next_line;
+    u32 eorx, fgx, bgx;
+
+    dest0 = p->screen_base + yy * p->fontheight * bytes + xx * 24;
+    fgx = fbcon_cfb24_cmap[attr_fgcol(p, conp)];
+    bgx = fbcon_cfb24_cmap[attr_bgcol(p, conp)];
+    eorx = fgx ^ bgx;
+    while (count--) {
+	c = *s++;
+	cdat = p->fontdata + c * p->fontheight;
+
+	for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+	    u8 bits = *cdat++;
+	    u32 d1, d2, d3, d4;
+	    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);
+	    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));
+	}
+	dest0 += 24;
+    }
+}
+
+void fbcon_cfb24_revc(struct display *p, int xx, int yy)
+{
+    u8 *dest;
+    int bytes = p->next_line, rows;
+
+    dest = p->screen_base + yy * p->fontheight * bytes + xx * 24;
+    for (rows = p->fontheight ; rows-- ; dest += bytes) {
+	((u32 *)dest)[0] ^= 0xffffffff;
+	((u32 *)dest)[1] ^= 0xffffffff;
+	((u32 *)dest)[2] ^= 0xffffffff;
+	((u32 *)dest)[3] ^= 0xffffffff;
+	((u32 *)dest)[4] ^= 0xffffffff;
+	((u32 *)dest)[5] ^= 0xffffffff;
+    }
+}
+
+
+    /*
+     *  `switch' for the low level operations
+     */
+
+struct display_switch fbcon_cfb24 = {
+    fbcon_cfb24_setup, fbcon_cfb24_bmove, fbcon_cfb24_clear, fbcon_cfb24_putc,
+    fbcon_cfb24_putcs, fbcon_cfb24_revc
+};
+
+
+    /*
+     *  Visible symbols for modules
+     */
+
+EXPORT_SYMBOL(fbcon_cfb24);
+EXPORT_SYMBOL(fbcon_cfb24_setup);
+EXPORT_SYMBOL(fbcon_cfb24_bmove);
+EXPORT_SYMBOL(fbcon_cfb24_clear);
+EXPORT_SYMBOL(fbcon_cfb24_putc);
+EXPORT_SYMBOL(fbcon_cfb24_putcs);
+EXPORT_SYMBOL(fbcon_cfb24_revc);
+EXPORT_SYMBOL(fbcon_cfb24_cmap);
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/fbcon-cfb24.h m68k/drivers/video/fbcon-cfb24.h
--- m68k-2.1.85/drivers/video/fbcon-cfb24.h	Thu Jan  1 01:00:00 1970
+++ m68k/drivers/video/fbcon-cfb24.h	Wed Mar 18 20:38:22 1998
@@ -0,0 +1,16 @@
+    /*
+     *  24 bpp packed pixel (cfb24)
+     */
+
+extern struct display_switch fbcon_cfb24;
+extern u32 fbcon_cfb24_cmap[16];
+extern void fbcon_cfb24_setup(struct display *p);
+extern void fbcon_cfb24_bmove(struct display *p, int sy, int sx, int dy,
+			      int dx, int height, int width);
+extern void fbcon_cfb24_clear(struct vc_data *conp, struct display *p, int sy,
+			      int sx, int height, int width);
+extern void fbcon_cfb24_putc(struct vc_data *conp, struct display *p, int c,
+			     int yy, int xx);
+extern void fbcon_cfb24_putcs(struct vc_data *conp, struct display *p,
+			      const char *s, int count, int yy, int xx);
+extern void fbcon_cfb24_revc(struct display *p, int xx, int yy);
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/fbcon-cfb32.c m68k/drivers/video/fbcon-cfb32.c
--- m68k-2.1.85/drivers/video/fbcon-cfb32.c	Tue Mar 17 19:50:33 1998
+++ m68k/drivers/video/fbcon-cfb32.c	Wed Mar 18 20:38:23 1998
@@ -28,7 +28,7 @@
 
 void fbcon_cfb32_setup(struct display *p)
 {
-    p->next_line = p->var.xres_virtual<<2;
+    p->next_line = p->line_length ? p->line_length : p->var.xres_virtual<<2;
     p->next_plane = 0;
 }
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/fbcon-cfb8.c m68k/drivers/video/fbcon-cfb8.c
--- m68k-2.1.85/drivers/video/fbcon-cfb8.c	Tue Mar 17 19:50:33 1998
+++ m68k/drivers/video/fbcon-cfb8.c	Wed Mar 18 20:38:23 1998
@@ -13,7 +13,6 @@
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/string.h>
-#include <linux/config.h>
 #include <linux/fb.h>
 
 #include "fbcon.h"
@@ -42,7 +41,7 @@
 
 void fbcon_cfb8_setup(struct display *p)
 {
-    p->next_line = p->var.xres_virtual;
+    p->next_line = p->line_length ? p->line_length : p->var.xres_virtual;
     p->next_plane = 0;
 }
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/fbcon-iplan2p2.c m68k/drivers/video/fbcon-iplan2p2.c
--- m68k-2.1.85/drivers/video/fbcon-iplan2p2.c	Tue Mar 17 19:27:36 1998
+++ m68k/drivers/video/fbcon-iplan2p2.c	Wed Mar 18 20:38:23 1998
@@ -14,7 +14,6 @@
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/string.h>
-#include <linux/config.h>
 #include <linux/fb.h>
 
 #include <asm/byteorder.h>
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/fbcon-iplan2p4.c m68k/drivers/video/fbcon-iplan2p4.c
--- m68k-2.1.85/drivers/video/fbcon-iplan2p4.c	Tue Mar 17 19:27:36 1998
+++ m68k/drivers/video/fbcon-iplan2p4.c	Wed Mar 18 20:38:23 1998
@@ -14,7 +14,6 @@
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/string.h>
-#include <linux/config.h>
 #include <linux/fb.h>
 
 #include <asm/byteorder.h>
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/fbcon-iplan2p8.c m68k/drivers/video/fbcon-iplan2p8.c
--- m68k-2.1.85/drivers/video/fbcon-iplan2p8.c	Tue Mar 17 19:27:36 1998
+++ m68k/drivers/video/fbcon-iplan2p8.c	Wed Mar 18 20:38:23 1998
@@ -14,7 +14,6 @@
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/string.h>
-#include <linux/config.h>
 #include <linux/fb.h>
 
 #include <asm/byteorder.h>
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/fbcon-mfb.c m68k/drivers/video/fbcon-mfb.c
--- m68k-2.1.85/drivers/video/fbcon-mfb.c	Tue Mar 17 19:50:33 1998
+++ m68k/drivers/video/fbcon-mfb.c	Wed Mar 18 20:38:23 1998
@@ -13,7 +13,6 @@
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/string.h>
-#include <linux/config.h>
 #include <linux/fb.h>
 
 #include "fbcon.h"
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/fbcon.c m68k/drivers/video/fbcon.c
--- m68k-2.1.85/drivers/video/fbcon.c	Tue Mar 17 21:34:58 1998
+++ m68k/drivers/video/fbcon.c	Wed Mar 18 21:02:33 1998
@@ -31,7 +31,7 @@
  *  Currently the following organizations are supported:
  *
  *    o afb			Amiga bitplanes
- *    o cfb{2,4,8,16,32}	Packed pixels
+ *    o cfb{2,4,8,16,24,32}	Packed pixels
  *    o ilbm			Amiga interleaved bitplanes
  *    o iplan2p[248]		Atari interleaved bitplanes
  *    o mfb			Monochrome
@@ -39,7 +39,6 @@
  *  To do:
  *
  *    - Implement 16 plane mode (iplan2p16)
- *    - Add support for 24 bit packed pixels (cfb24)
  *    - Hardware cursor
  *
  *
@@ -166,6 +165,7 @@
 static int fbcon_set_font(struct vc_data *conp, int w, int h, char *data);
 static int fbcon_set_palette(struct vc_data *conp, unsigned char *table);
 static int fbcon_scrolldelta(int lines);
+static int fbcon_set_mode(struct vc_data *conp, int mode);
 
 
 /*
@@ -1025,9 +1025,9 @@
     return( 0 );
 }
 
-static unsigned short palette_red[16];
-static unsigned short palette_green[16];
-static unsigned short palette_blue[16];
+static u16 palette_red[16];
+static u16 palette_green[16];
+static u16 palette_blue[16];
 
 static struct fb_cmap palette_cmap  = {
     0, 16, palette_red, palette_green, palette_blue, NULL
@@ -1092,6 +1092,20 @@
 }
 
 
+    /*
+     *  Switch between `text' (emulated and accelerated) and `graphics'
+     *  (unaccelerated text) mode
+     */
+
+static int fbcon_set_mode(struct vc_data *conp, int mode)
+{
+    struct display *p = &fb_display[conp->vc_num];
+    struct fb_ops *ops = p->fb_info->fbops;
+
+    return ops->fb_set_mode ? ops->fb_set_mode(mode, p->fb_info) : 0;
+}
+
+
 #define LOGO_H			80
 #define LOGO_W			80
 #define LOGO_LINE	(LOGO_W/8)
@@ -1168,8 +1182,61 @@
 
 #if defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || \
     defined(CONFIG_FBCON_CFB32)
-    if ((depth % 8 == 0) && (p->visual == FB_VISUAL_TRUECOLOR ||
-			     p->visual == FB_VISUAL_DIRECTCOLOR)) {
+    if (p->visual == FB_VISUAL_TRUECOLOR) {
+	unsigned int val;		/* max. depth 32! */
+	int bdepth;
+	int redshift, greenshift, blueshift;
+		
+	/* Bug: Doesn't obey msb_right ... (who needs that?) */
+	redshift   = p->var.red.offset;
+	greenshift = p->var.green.offset;
+	blueshift  = p->var.blue.offset;
+
+	if (depth >= 24 && (depth % 8) == 0) {
+	    /* have at least 8 bits per color */
+	    src = logo;
+	    bdepth = depth/8;
+	    for( y1 = 0; y1 < LOGO_H; y1++ ) {
+		dst = fb + y1*line;
+		for( x1 = 0; x1 < LOGO_W; x1++, src++ ) {
+		    val = (*src << redshift) |
+			  (*src << greenshift) |
+			  (*src << blueshift);
+		    for( i = bdepth-1; i >= 0; --i )
+			*dst++ = val >> (i*8);
+		}
+	    }
+	}
+	else if (depth >= 15 && depth <= 23) {
+	    /* have 5..7 bits per color, using 16 color image */
+	    unsigned int pix;
+	    src = linux_logo16;
+	    bdepth = (depth+7)/8;
+	    for( y1 = 0; y1 < LOGO_H; y1++ ) {
+		dst = fb + y1*line;
+		for( x1 = 0; x1 < LOGO_W/2; x1++, src++ ) {
+		    pix = (*src >> 4) | 0x10; /* upper nibble */
+		    val = (pix << redshift) |
+			  (pix << greenshift) |
+			  (pix << blueshift);
+		    for( i = 0; i < bdepth; ++i )
+			*dst++ = val >> (i*8);
+		    pix = (*src & 0x0f) | 0x10; /* lower nibble */
+		    val = (pix << redshift) |
+			  (pix << greenshift) |
+			  (pix << blueshift);
+		    for( i = bdepth-1; i >= 0; --i )
+			*dst++ = val >> (i*8);
+		}
+	    }
+	}
+	
+	done = 1;
+    }
+#endif
+#if defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || \
+    defined(CONFIG_FBCON_CFB32)
+    if ((depth % 8 == 0) && (p->visual == FB_VISUAL_DIRECTCOLOR)) {
 	/* Modes without color mapping, needs special data transformation... */
 	unsigned int val;		/* max. depth 32! */
 	int bdepth = depth/8;
@@ -1189,9 +1256,9 @@
 	for( y1 = 0; y1 < LOGO_H; y1++ ) {
 	    dst = fb + y1*line;
 	    for( x1 = 0; x1 < LOGO_W; x1++, src++ ) {
-		val = (*src << redshift) |
-		      (*src << greenshift) |
-		      (*src << blueshift);
+		val = ((linux_logo_red[*src]   & redmask)   << redshift) |
+		      ((linux_logo_green[*src] & greenmask) << greenshift) |
+		      ((linux_logo_blue[*src]  & bluemask)  << blueshift);
 		for( i = bdepth-1; i >= 0; --i )
 		    *dst++ = val >> (i*8);
 	    }
@@ -1297,7 +1364,7 @@
     fbcon_startup, fbcon_init, fbcon_deinit, fbcon_clear, fbcon_putc,
     fbcon_putcs, fbcon_cursor, fbcon_scroll, fbcon_bmove, fbcon_switch,
     fbcon_blank, fbcon_get_font, fbcon_set_font, fbcon_set_palette,
-    fbcon_scrolldelta
+    fbcon_scrolldelta, fbcon_set_mode
 };
 
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/macfb.c m68k/drivers/video/macfb.c
--- m68k-2.1.85/drivers/video/macfb.c	Tue Mar 17 19:27:38 1998
+++ m68k/drivers/video/macfb.c	Wed Mar 18 20:38:23 1998
@@ -23,6 +23,9 @@
 #include <asm/macintosh.h>
 #include <linux/fb.h>
 
+
+/* conditionalize these ?? */
+#include "fbcon-mfb.h"
 #include "fbcon-cfb2.h"
 #include "fbcon-cfb4.h"
 #include "fbcon-cfb8.h"
@@ -219,15 +222,26 @@
 	display->inverse = inverse;
 
 	switch (mac_depth) {
+#ifdef CONFIG_FBCON_MFB
+	    case 1:
+		display->dispsw = &fbcon_mfb;
+		break;
+#endif
+#ifdef CONFIG_FBCON_CFB2
 	    case 2:
 		display->dispsw = &fbcon_cfb2;
 		break;
+#endif
+#ifdef CONFIG_FBCON_CFB4
 	    case 4:
 		display->dispsw = &fbcon_cfb4;
 		break;
+#endif
+#ifdef CONFIG_FBCON_CFB8
 	    case 8:
 		display->dispsw = &fbcon_cfb8;
 		break;
+#endif
 	    default:
 		display->dispsw = NULL;
 		break;
@@ -247,8 +261,8 @@
 static int macfb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
 			  struct fb_info *info)
 {
-	printk("macfb_get_cmap: not supported!\n");
 #if 0
+	printk("macfb_get_cmap: not supported!\n");
 	/* interferes with X11 */
 	if (console_loglevel < 7)
 		return -EINVAL;
@@ -267,8 +281,8 @@
 static int macfb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
 			  struct fb_info *info)
 {
-	printk("macfb_set_cmap: not supported!\n");
 #if 0
+	printk("macfb_set_cmap: not supported!\n");
 	if (console_loglevel < 7)
 		return -EINVAL;
 	if (!fb_display[con].cmap.len) {	/* no colormap allocated? */
@@ -309,6 +323,7 @@
 	macfb_get_cmap,
 	macfb_set_cmap,
 	macfb_pan_display,
+	NULL,
 	macfb_ioctl
 };
 
@@ -418,15 +433,18 @@
 		return NULL;
 	}
 
-	macfb_get_var(&disp.var, -1, &fb_info));
+	macfb_get_var(&disp.var, -1, &fb_info);
 	macfb_set_disp(-1);
-	
+
 	/*
 	 *	Register the nubus hook
 	 */
 	 
 	register_nubus_device(&nb_video);
-	
+
+	printk("fb%d: %s frame buffer device using %ldK of video memory\n",
+	       GET_FB_IDX(fb_info.node), fb_info.modename, mac_videosize>>10);
+
 	return mem_start;
 }
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/offb.c m68k/drivers/video/offb.c
--- m68k-2.1.85/drivers/video/offb.c	Tue Mar 17 19:50:33 1998
+++ m68k/drivers/video/offb.c	Wed Mar 18 20:38:24 1998
@@ -86,7 +86,10 @@
 int console_getmode(struct vc_mode *);
 int console_setmode(struct vc_mode *, int);
 int console_powermode(int);
+struct fb_info *console_fb_info = NULL;
 int (*console_setmode_ptr)(struct vc_mode *, int) = NULL;
+int (*console_set_cmap_ptr)(struct fb_cmap *, int, int, struct fb_info *)
+    = NULL;
 struct vc_mode display_info;
 #endif /* CONFIG_FB_COMPAT_XPMAC */
 
@@ -113,7 +116,7 @@
 
 static struct fb_ops offb_ops = {
     offb_open, offb_release, offb_get_fix, offb_get_var, offb_set_var,
-    offb_get_cmap, offb_set_cmap, offb_pan_display, offb_ioctl
+    offb_get_cmap, offb_set_cmap, offb_pan_display, NULL, offb_ioctl
 };
 
 
@@ -279,7 +282,7 @@
 static const char *aty_names[] = {
     "ATY,mach64", "ATY,XCLAIM", "ATY,264VT", "ATY,mach64ii", "ATY,264GT-B", 
     "ATY,mach64_3D_pcc", "ATY,XCLAIM3D", "ATY,XCLAIMVR", "ATY,RAGEII_M",
-    "ATY,mach64_3DU"
+    "ATY,XCLAIMVRPro", "ATY,mach64_3DU"
 };
 #endif /* CONFIG_FB_ATY */
 
@@ -363,27 +366,6 @@
 	    info->cmap_data = info->cmap_adr + 1;
 	}
 
-#ifdef CONFIG_FB_COMPAT_XPMAC
-	if (display_info.height == 0) {	/* Only the first display */
-	    display_info.height = var->yres;
-	    display_info.width = var->xres;
-	    display_info.depth = 8;
-	    display_info.pitch = fix->line_length;
-	    display_info.mode = 0;
-	    strncpy(display_info.name, dp->name, sizeof(display_info.name));
-	    display_info.fb_address = iopa((unsigned long)fix->smem_start);
-	    display_info.cmap_adr_address = 0;
-	    display_info.cmap_data_address = 0;
-	    display_info.disp_reg_address = 0;
-	    /* XXX kludge for ati */
-	    if (strncmp(dp->name, "ATY,", 4) == 0) {
-		    display_info.disp_reg_address = iopa(address + 0x7ffc00);
-		    display_info.cmap_adr_address = iopa(address + 0x7ffcc0);
-		    display_info.cmap_data_address = iopa(address + 0x7ffcc1);
-	    }
-	}
-#endif /* CONFIG_FB_COMPAT_XPMAC) */
-
 	fix->visual = info->cmap_adr ? FB_VISUAL_PSEUDOCOLOR :
 				       FB_VISUAL_STATIC_PSEUDOCOLOR;
 
@@ -418,7 +400,11 @@
 	disp->line_length = fix->line_length;
 	disp->can_soft_blank = info->cmap_adr ? 1 : 0;
 	disp->inverse = 0;
+#ifdef CONFIG_FBCON_CFB8
 	disp->dispsw = &fbcon_cfb8;
+#else
+	disp->dispsw = NULL;
+#endif
 
 	strcpy(info->info.modename, "OFfb ");
 	strncat(info->info.modename, dp->full_name,
@@ -444,7 +430,31 @@
 	}
 	offb_set_var(var, -1, &info->info);
 
-	printk("Open Firmware frame buffer device on %s\n", dp->full_name);
+	printk("fb%d: Open Firmware frame buffer device on %s\n",
+	       GET_FB_IDX(info->info.node), dp->full_name);
+
+#ifdef CONFIG_FB_COMPAT_XPMAC
+	if (!console_fb_info) {
+	    display_info.height = var->yres;
+	    display_info.width = var->xres;
+	    display_info.depth = 8;
+	    display_info.pitch = fix->line_length;
+	    display_info.mode = 0;
+	    strncpy(display_info.name, dp->name, sizeof(display_info.name));
+	    display_info.fb_address = iopa((unsigned long)fix->smem_start);
+	    display_info.cmap_adr_address = 0;
+	    display_info.cmap_data_address = 0;
+	    display_info.disp_reg_address = 0;
+	    /* XXX kludge for ati */
+	    if (strncmp(dp->name, "ATY,", 4) == 0) {
+		    display_info.disp_reg_address = iopa(address + 0x7ffc00);
+		    display_info.cmap_adr_address = iopa(address + 0x7ffcc0);
+		    display_info.cmap_data_address = iopa(address + 0x7ffcc1);
+	    }
+	    console_fb_info = &info->info;
+	    console_set_cmap_ptr = offb_set_cmap;
+	}
+#endif /* CONFIG_FB_COMPAT_XPMAC) */
     }
     return mem_start;
 }
@@ -577,6 +587,16 @@
 
     /*
      *  Backward compatibility mode for Xpmac
+     *
+     *  To do:
+     *
+     *    - console_setmode() should fill in a struct fb_var_screeninfo (using
+     *	    the MacOS video mode database) and simply call a decode_var()
+     *	    function, so console_setmode_ptr is no longer needed.
+     *
+     *    - instead of using the console_* stuff (filled in by the frame
+     *      buffer), we should use the correct struct fb_info for the
+     *	    foreground virtual console.
      */
 
 int console_getmode(struct vc_mode *mode)
@@ -591,8 +611,40 @@
 
     if (console_setmode_ptr == NULL)
 	return -EINVAL;
+
     err = (*console_setmode_ptr)(mode, doit);
     return err;
+}
+
+static u16 palette_red[16];
+static u16 palette_green[16];                                                 
+static u16 palette_blue[16];
+
+static struct fb_cmap palette_cmap = {
+    0, 16, palette_red, palette_green, palette_blue, NULL
+};
+
+int console_setcmap(int n_entries, unsigned char *red, unsigned char *green,
+		    unsigned char *blue)
+{
+    int i, j, n;
+
+    if (console_set_cmap_ptr == NULL)
+	return -EOPNOTSUPP;
+    for (i = 0; i < n_entries; i += n) {
+	n = n_entries-i;
+	if (n > 16)
+	    n = 16;
+	palette_cmap.start = i;
+	palette_cmap.len = n;
+	for (j = 0; j < n; j++) {
+	    palette_cmap.red[j]   = (red[i+j] << 8) | red[i+j];
+	    palette_cmap.green[j] = (green[i+j] << 8) | green[i+j];
+	    palette_cmap.blue[j]  = (blue[i+j] << 8) | blue[i+j];
+	}
+	(*console_set_cmap_ptr)(&palette_cmap, 1, fg_console, console_fb_info);
+    }
+    return 0;
 }
 
 int console_powermode(int mode)
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/retz3fb.c m68k/drivers/video/retz3fb.c
--- m68k-2.1.85/drivers/video/retz3fb.c	Tue Mar 17 19:27:37 1998
+++ m68k/drivers/video/retz3fb.c	Wed Mar 18 20:38:24 1998
@@ -21,6 +21,7 @@
  */
 
 
+#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -287,7 +288,9 @@
  *    Text console acceleration
  */
 
+#ifdef CONFIG_FBCON_CFB8
 static struct display_switch fbcon_retz3_8;
+#endif
 
 
 /*
@@ -1269,9 +1272,11 @@
 	display->can_soft_blank = 1;
 	display->inverse = z3fb_inverse;
 	switch (display->var.bits_per_pixel) {
+#ifdef CONFIG_FBCON_CFB8
 	case 8:
 		display->dispsw = &fbcon_retz3_8;
 		break;
+#endif
 #ifdef CONFIG_FBCON_CFB16
 	case 16:
 		display->dispsw = &fbcon_cfb16;
@@ -1332,9 +1337,11 @@
 			display->can_soft_blank = 1;
 			display->inverse = z3fb_inverse;
 			switch (display->var.bits_per_pixel) {
+#ifdef CONFIG_FBCON_CFB8
 			case 8:
 				display->dispsw = &fbcon_retz3_8;
 				break;
+#endif
 #ifdef CONFIG_FBCON_CFB16
 			case 16:
 				display->dispsw = &fbcon_cfb16;
@@ -1432,7 +1439,7 @@
 static struct fb_ops retz3fb_ops = {
 	retz3fb_open, retz3fb_release, retz3fb_get_fix, retz3fb_get_var,
 	retz3fb_set_var, retz3fb_get_cmap, retz3fb_set_cmap,
-	retz3fb_pan_display, retz3fb_ioctl
+	retz3fb_pan_display, NULL, retz3fb_ioctl
 };
 
 
@@ -1521,8 +1528,8 @@
 
 	do_install_cmap(0, &fb_info);
 
-	printk("%s frame buffer device, using %ldK of video memory\n",
-	       fb_info.modename, z3_size>>10);
+	printk("fb%d: %s frame buffer device, using %ldK of video memory\n",
+	       GET_FB_IDX(fb_info.node), fb_info.modename, z3_size>>10);
 
 	/* TODO: This driver cannot be unloaded yet */
 	MOD_INC_USE_COUNT;
@@ -1609,6 +1616,7 @@
  *  Text console acceleration
  */
 
+#ifdef CONFIG_FBCON_CFB8
 static void fbcon_retz3_8_bmove(struct display *p, int sy, int sx, int dy, int dx,
 	                int height, int width)
 {
@@ -1657,3 +1665,4 @@
     fbcon_cfb8_setup, fbcon_retz3_8_bmove, fbcon_retz3_8_clear,
     fbcon_cfb8_putc, fbcon_cfb8_putcs, fbcon_cfb8_revc
 };
+#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/skeletonfb.c m68k/drivers/video/skeletonfb.c
--- m68k-2.1.85/drivers/video/skeletonfb.c	Tue Mar 17 19:27:38 1998
+++ m68k/drivers/video/skeletonfb.c	Wed Mar 18 20:38:24 1998
@@ -114,6 +114,11 @@
      */
 
     /* ... */
+
+    /* pixclock in picos, htotal in pixels, vtotal in scanlines */
+    if (!fbmon_valid_timings(pixclock, htotal, vtotal, info))
+	    return -EINVAL;
+
     return 0;
 }
 
@@ -181,17 +186,17 @@
 	 *  Make the first 16 colors of the palette available to fbcon
 	 */
 	if (is_cfb15)		/* RGB 555 */
-	    packed16_cmap[regno] = be16_to_cpu((red << 10) | (green << 5) |
-					       blue);
+	    fbcon_cfb15_cmap[regno] = be16_to_cpu((red << 10) | (green << 5) |
+						  blue);
 	if (is_cfb16)		/* RGB 565 */
-	    packed16_cmap[regno] = be16_to_cpu((red << 11) | (green << 5) |
-					       blue);
+	    fbcon_cfb16_cmap[regno] = be16_to_cpu((red << 11) | (green << 5) |
+						  blue);
 	if (is_cfb24)		/* RGB 888 */
-	    packed24_cmap[regno] = be32_to_cpu((red << 16) | (green << 8) |
-					       blue);
+	    fbcon_cfb24_cmap[regno] = be32_to_cpu((red << 16) | (green << 8) |
+						  blue);
 	if (is_cfb32)		/* RGBA 8888 */
-	    packed32_cmap[regno] = be32_to_cpu((red << 24) | (green << 16) |
-					       (blue << 8) | transp);
+	    fbcon_cfb32_cmap[regno] = be32_to_cpu((red << 24) | (green << 16) |
+						  (blue << 8) | transp);
     }
     /* ... */
     return 0;
@@ -234,12 +239,24 @@
     /*
      *  Return a pointer to appropriate low level text console operations for
      *  the video mode `par' of your video hardware. These can be generic
-     *  software operations, or hardware accelerated routines specifically
+     *  software routines, or hardware accelerated routines specifically
      *  tailored for your hardware.
      *  If you don't have any appropriate operations, simple fill in the NULL
      *  pointer, and there will be no text output.
      */
-    return &fbcon_cfb8;
+#ifdef CONFIG_FBCON_CFB8
+    if (is_cfb8)
+	return &fbcon_cfb8;
+#endif
+#ifdef CONFIG_FBCON_CFB16
+    if (is_cfb16)
+	return &fbcon_cfb16;
+#endif
+#ifdef CONFIG_FBCON_CFB32
+    if (is_cfb32)
+	return &fbcon_cfb32;
+#endif
+    return NULL;
 }
 
 
@@ -283,7 +300,8 @@
 	return err;
     fbgen_set_disp(-1, &fb_info.gen.info);
     fbgen_install_cmap(0, &fb_info.gen);
-    printk("%s frame buffer device\n", fb_info.modename);
+    printk("fb%d: %s frame buffer device\n", GET_FB_IDX(fb_info.node),
+	   fb_info.modename);
 
     /* uncomment this if your driver cannot be unloaded */
     /* MOD_INC_USE_COUNT; */
@@ -346,7 +364,7 @@
 
 static struct fb_ops xxxfb_ops = {
     xxxfb_open, xxxfb_release, fbgen_get_fix, fbgen_get_var, fbgen_set_var,
-    fbgen_get_cmap, fbgen_set_cmap, fbgen_pan_display, fbgen_ioctl
+    fbgen_get_cmap, fbgen_set_cmap, fbgen_pan_display, NULL, fbgen_ioctl
 };
 
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/tgafb.c m68k/drivers/video/tgafb.c
--- m68k-2.1.85/drivers/video/tgafb.c	Tue Mar 17 19:50:33 1998
+++ m68k/drivers/video/tgafb.c	Wed Mar 18 20:38:24 1998
@@ -296,7 +296,7 @@
 
 static struct fb_ops tgafb_ops = {
     tgafb_open, tgafb_release, tgafb_get_fix, tgafb_get_var, tgafb_set_var,
-    tgafb_get_cmap, tgafb_set_cmap, tgafb_pan_display, tgafb_ioctl
+    tgafb_get_cmap, tgafb_set_cmap, tgafb_pan_display, NULL, tgafb_ioctl
 };
 
 
@@ -738,10 +738,21 @@
     disp.line_length = fb_fix.line_length;
     disp.can_soft_blank = 1;
     disp.inverse = 0;
-    if (tga_type == 0)	/* 8-plane */
-	disp.dispsw = &fbcon_cfb8;
-    else		/* 24-plane or 24plusZ */
-	disp.dispsw = &fbcon_cfb32;
+    switch (tga_type) {
+#ifdef CONFIG_FBCON_CFB8
+	case 0: /* 8-plane */
+	    disp.dispsw = &fbcon_cfb8;
+	    break;
+#endif
+#ifdef CONFIG_FBCON_CFB32
+	case 1: /* 24-plane */
+	case 3: /* 24plusZ */
+	    disp.dispsw = &fbcon_cfb32;
+	    break;
+#endif
+	default:
+	    disp.dispsw = NULL;
+    }
 
     strcpy(fb_info.modename, fb_fix.id);
     fb_info.node = -1;
@@ -759,7 +770,8 @@
 
     tgafb_set_var(&fb_var, -1, &fb_info);
 
-    printk("%s frame buffer device\n", fb_fix.id);
+    printk("fb%d: %s frame buffer device\n", GET_FB_IDX(fb_info.node),
+	   fb_fix.id);
     return mem_start;
 }
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/txtcon.c m68k/drivers/video/txtcon.c
--- m68k-2.1.85/drivers/video/txtcon.c	Tue Mar 17 19:27:37 1998
+++ m68k/drivers/video/txtcon.c	Wed Mar 18 20:38:24 1998
@@ -44,6 +44,7 @@
 static int txtcon_set_font(struct vc_data *conp, int w, int h, char *data);
 static int txtcon_set_palette(struct vc_data *conp, unsigned char *table);
 static int txtcon_scrolldelta(int lines);
+static int txtcon_set_mode(struct vc_data *conp, int mode);
 
 
 static unsigned long txtcon_startup(unsigned long kmem_start,
@@ -145,6 +146,11 @@
     return -ENOSYS;
 }
 
+static int txtcon_set_mode(struct vc_data *conp, int mode)
+{
+    return -ENOSYS;
+}
+
 
 /* ====================================================================== */
 
@@ -167,5 +173,6 @@
     txtcon_get_font,
     txtcon_set_font,
     txtcon_set_palette,
-    txtcon_scrolldelta
+    txtcon_scrolldelta,
+    txtcon_set_mode
 };
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/vfb.c m68k/drivers/video/vfb.c
--- m68k-2.1.85/drivers/video/vfb.c	Tue Mar 17 19:27:37 1998
+++ m68k/drivers/video/vfb.c	Wed Mar 18 20:38:24 1998
@@ -8,6 +8,7 @@
  *  more details.
  */
 
+#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -27,6 +28,7 @@
 #include "fbcon-cfb4.h"
 #include "fbcon-cfb8.h"
 #include "fbcon-cfb16.h"
+#include "fbcon-cfb24.h"
 #include "fbcon-cfb32.h"
 
 
@@ -111,9 +113,8 @@
 
 
 static struct fb_ops vfb_ops = {
-    vfb_open, vfb_release, vfb_get_fix,
-    vfb_get_var, vfb_set_var, vfb_get_cmap,
-    vfb_set_cmap, vfb_pan_display, vfb_ioctl
+    vfb_open, vfb_release, vfb_get_fix, vfb_get_var, vfb_set_var, vfb_get_cmap,
+    vfb_set_cmap, vfb_pan_display, NULL, vfb_ioctl
 };
 
 
@@ -259,29 +260,41 @@
 	    display->can_soft_blank = 1;
 	    display->inverse = 0;
 	    switch (var->bits_per_pixel) {
+#ifdef CONFIG_FBCON_MFB
 		case 1:
 		    display->dispsw = &fbcon_mfb;
 		    break;
+#endif
+#ifdef CONFIG_FBCON_CFB2
 		case 2:
 		    display->dispsw = &fbcon_cfb2;
 		    break;
+#endif
+#ifdef CONFIG_FBCON_CFB4
 		case 4:
 		    display->dispsw = &fbcon_cfb4;
 		    break;
+#endif
+#ifdef CONFIG_FBCON_CFB8
 		case 8:
 		    display->dispsw = &fbcon_cfb8;
 		    break;
+#endif
+#ifdef CONFIG_FBCON_CFB16
 		case 16:
 		    display->dispsw = &fbcon_cfb16;
 		    break;
-#if 0
+#endif
+#ifdef CONFIG_FBCON_CFB24
 		case 24:
 		    display->dispsw = &fbcon_cfb24;
 		    break;
 #endif
+#ifdef CONFIG_FBCON_CFB32
 		case 32:
 		    display->dispsw = &fbcon_cfb32;
 		    break;
+#endif
 		default:
 		    display->dispsw = NULL;
 		    break;
@@ -435,8 +448,8 @@
 
     vfb_set_var(&vfb_default, -1, &fb_info);
 
-    printk("Virtual frame buffer device, using %ldK of video memory\n",
-	   videomemorysize>>10);
+    printk("fb%d: Virtual frame buffer device, using %ldK of video memory\n",
+	   GET_FB_IDX(fb_info.node), videomemorysize>>10);
     return mem_start;
 }
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/vgacon.c m68k/drivers/video/vgacon.c
--- m68k-2.1.85/drivers/video/vgacon.c	Tue Mar 17 19:50:33 1998
+++ m68k/drivers/video/vgacon.c	Wed Mar 18 20:38:26 1998
@@ -104,6 +104,7 @@
 static int vgacon_set_font(struct vc_data *conp, int w, int h, char *data);
 static int vgacon_set_palette(struct vc_data *conp, unsigned char *table);
 static int vgacon_scrolldelta(int lines);
+static int vgacon_set_mode(struct vc_data *conp, int mode);
 
 
 /*
@@ -556,6 +557,11 @@
     return -ENOSYS;
 }
 
+static int vgacon_set_mode(struct vc_data *conp, int mode)
+{
+    return -ENOSYS;
+}
+
 
 __initfunc(static int vgacon_show_logo( void ))
 {
@@ -579,5 +585,5 @@
     vgacon_startup, vgacon_init, vgacon_deinit, vgacon_clear, vgacon_putc,
     vgacon_putcs, vgacon_cursor, vgacon_scroll, vgacon_bmove, vgacon_switch,
     vgacon_blank, vgacon_get_font, vgacon_set_font, vgacon_set_palette,
-    vgacon_scrolldelta
+    vgacon_scrolldelta, vgacon_set_mode
 };
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/drivers/video/virgefb.c m68k/drivers/video/virgefb.c
--- m68k-2.1.85/drivers/video/virgefb.c	Tue Mar 17 19:50:33 1998
+++ m68k/drivers/video/virgefb.c	Wed Mar 18 20:38:26 1998
@@ -269,7 +269,9 @@
  *    Text console acceleration
  */
 
+#ifdef CONFIG_FBCON_CFB8
 static struct display_switch fbcon_virge8;
+#endif
 
 
 /*
@@ -967,7 +969,7 @@
 static struct fb_ops virgefb_ops = {
 	virgefb_open, virgefb_release, virgefb_get_fix, virgefb_get_var,
 	virgefb_set_var, virgefb_get_cmap, virgefb_set_cmap,
-	virgefb_pan_display, virgefb_ioctl
+	virgefb_pan_display, NULL, virgefb_ioctl
 };
 
 
@@ -1071,8 +1073,8 @@
 	virgefb_set_disp(-1, &fb_info);
 	do_install_cmap(0, &fb_info);
 
-	printk("%s frame buffer device, using %ldK of video memory\n",
-	       fb_info.modename, CyberSize>>10);
+	printk("fb%d: %s frame buffer device, using %ldK of video memory\n",
+	       GET_FB_IDX(fb_info.node), fb_info.modename, CyberSize>>10);
 
 	/* TODO: This driver cannot be unloaded yet */
 	MOD_INC_USE_COUNT;
@@ -1143,6 +1145,7 @@
  *    Text console acceleration
  */
 
+#ifdef CONFIG_FBCON_CFB8
 static void fbcon_virge8_bmove(struct display *p, int sy, int sx, int dy,
 			       int dx, int height, int width)
 {
@@ -1168,6 +1171,7 @@
    fbcon_cfb8_setup, fbcon_virge8_bmove, fbcon_virge8_clear, fbcon_cfb8_putc,
    fbcon_cfb8_putcs, fbcon_cfb8_revc
 };
+#endif
 
 
 #ifdef MODULE
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/include/linux/console.h m68k/include/linux/console.h
--- m68k-2.1.85/include/linux/console.h	Tue Mar 17 19:25:15 1998
+++ m68k/include/linux/console.h	Wed Mar 18 20:38:26 1998
@@ -42,6 +42,7 @@
 	int	(*con_set_font)(struct vc_data *, int, int, char *);
 	int	(*con_set_palette)(struct vc_data *, unsigned char *);
 	int	(*con_scrolldelta)(int);
+	int	(*con_set_mode)(struct vc_data *, int);
 };
 
 extern struct consw *conswitchp;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/include/linux/fb.h m68k/include/linux/fb.h
--- m68k-2.1.85/include/linux/fb.h	Tue Mar 17 21:30:30 1998
+++ m68k/include/linux/fb.h	Wed Mar 18 20:38:26 1998
@@ -95,6 +95,7 @@
 #define FB_SYNC_BROADCAST	16	/* broadcast video timings      */
 					/* vtotal = 144d/288n/576i => PAL  */
 					/* vtotal = 121d/242n/484i => NTSC */
+#define FB_SYNC_ON_GREEN	32	/* sync on green */
 
 #define FB_VMODE_NONINTERLACED  0	/* non interlaced */
 #define FB_VMODE_INTERLACED	1	/* interlaced	*/
@@ -157,6 +158,14 @@
 	__u32 framebuffer;
 };
 
+struct fb_monspecs {
+	unsigned hfmin : 20;		/* hfreq lower limit (Hz) */
+	unsigned hfmax : 20; 		/* hfreq upper limit (Hz) */
+	unsigned vfmin : 10;		/* vfreq lower limit (Hz) */
+	unsigned vfmax : 10;		/* vfreq upper limit (Hz) */
+	unsigned dpms : 1;		/* supports DPMS */
+};
+
 #ifdef __KERNEL__
 
 #include <linux/fs.h>
@@ -192,6 +201,8 @@
     /* pan display */
     int (*fb_pan_display)(struct fb_var_screeninfo *var, int con,
 			  struct fb_info *info);
+    /* switch between text and graphics mode */
+    int (*fb_set_mode)(int mode, struct fb_info *info);
     /* perform fb specific ioctl */
     int (*fb_ioctl)(struct inode *inode, struct file *file, unsigned int cmd,
 		    unsigned long arg, int con, struct fb_info *info);
@@ -247,9 +258,10 @@
 
 
 struct fb_info {
-   char modename[40];               /* default video mode */
+   char modename[40];			/* default video mode */
    int node;
    struct fb_ops *fbops;
+   struct fb_monspecs monspecs;
    struct display *disp;		/* initial display variable */
    char fontname[40];			/* default font name */
    int (*changevar)(int);		/* tell console var has changed */
@@ -315,6 +327,10 @@
 extern int register_framebuffer(struct fb_info *fb_info);
 extern int unregister_framebuffer(const struct fb_info *fb_info);
 extern unsigned long probe_framebuffers(unsigned long kmem_start);
+extern int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal,
+			       const struct fb_info *fb_info);
+extern int fbmon_dpms(const struct fb_info *fb_info);
+
 
 extern int num_registered_fb;
 extern struct fb_info *registered_fb[FB_MAX];
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.85/include/linux/keyboard.h m68k/include/linux/keyboard.h
--- m68k-2.1.85/include/linux/keyboard.h	Tue Mar 17 19:25:01 1998
+++ m68k/include/linux/keyboard.h	Tue Mar 17 21:54:42 1998
@@ -24,6 +24,12 @@
 extern const int max_vals[];
 extern unsigned short *key_maps[MAX_NR_KEYMAPS];
 extern unsigned short plain_map[NR_KEYS];
+extern unsigned short shift_map[NR_KEYS];
+extern unsigned short altgr_map[NR_KEYS];
+extern unsigned short ctrl_map[NR_KEYS];
+extern unsigned short shift_ctrl_map[NR_KEYS];
+extern unsigned short alt_map[NR_KEYS];
+extern unsigned short ctrl_alt_map[NR_KEYS];
 extern struct wait_queue * keypress_wait;
 #endif
 

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

