Subject: VGA driver changes for machines without built-in font
To: None <tech-kern@netbsd.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-arc
Date: 01/15/2003 22:42:05
Hi,

I'm working for VGA console support of NEC Express5800/240 R4400 EISA
(NEC-J96A) on arc port and now it's almost done.
VGA console is working fine both text and rasterconsole on my J96A,
but I'd like any comments/suggestions before I commit them
because I'm not familiar with VGA and wscons.

Background:
NEC Express5800/240 (and maybe RISCserver2200) has the Cirrus Logic
GD5428 VGA chip on ISA for its console, but ARCBIOS on the machine
doesn't use text mode and vga_common_probe() in sys/dev/ic/vga_common.c
will fail if VGA is not set up in text mode, so it won't be attached
(even for rasterconsole).

Changes:
- Add an MI function vga_reset(), which initialize all VGA registers
  to set it up into text mode (mode 3: 640x400/31.5kHz/70Hz).
- Changes MD consinit() function to call vga_reset() with an
  initalization function for MD chipset.
- In vga.c (for text console), load 8x16 pixel wsfont in vga_init_screen()
  and skip vga_readoutchars() (which saves builtin font chars int memory)
  in vga_common_attach() if there isn't builtin font.
- In vga_raster.c (for raster console), use wsfont for console fontset
  rather than loading builtin font in vga_raster_init_screen().
- and some misc fixes/cosmetics.

Problems:
- Maybe vga_reset() should be in vga_common_probe() or vga_common_attach(),
  but current vga_common_probe() fails unless vga_reset() was called.
  In the current patch, MD consinit checks arc_displayc_id before
  calling vga_reset().
- I have no idea how to detect whether VGA has builtin font or not
  since vga_cnattach() function can't take any flags for it.
  In my current patch, MD consinit() set a global variable
  "vga_no_bulitinfont" and MI drivers check it, but I guess
  it's a bit ugly.
- Each VGA chipset would have "extra" registers and they should also
  be initialized (at least to support text mode), but there is
  no generic way to do it. For my NEC_J96A, MD consinit has
  a function gd54xx_initregs() (it's required to make textmode working),
  but I can't find any docs for the chipset so I'm using values taken
  from PC which uses the same Cirrus chip, but the most left bits on
  the screen are displayed wrong place (offset some lines).

Any comments would be appreciated.
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp

Index: dev/ic/vga.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/vga.c,v
retrieving revision 1.64
diff -u -r1.64 vga.c
--- dev/ic/vga.c	2002/10/15 17:30:43	1.64
+++ dev/ic/vga.c	2003/01/14 13:36:49
@@ -54,13 +54,19 @@
 /* for WSCONS_SUPPORT_PCVTFONTS and WSDISPLAY_CHARFUNCS */
 #include "opt_wsdisplay_compat.h"
 
+int vga_no_builtinfont = 0;
+
 static struct wsdisplay_font _vga_builtinfont = {
-	"builtin",
-	0, 256,
-	WSDISPLAY_FONTENC_IBM,
-	8, 16, 1,
-	WSDISPLAY_FONTORDER_L2R, 0,
-	0
+	"builtin",			/* typeface name */
+	0,				/* firstchar */
+	256,				/* numbhars */
+	WSDISPLAY_FONTENC_IBM,		/* encoding */
+	8,				/* width */
+	16,				/* height */
+	1,				/* stride */
+	WSDISPLAY_FONTORDER_L2R,	/* bit order */
+	WSDISPLAY_FONTORDER_L2R,	/* byte order */
+	NULL				/* data */
 };
 
 struct egavga_font {
@@ -469,6 +475,20 @@
 	scr->pcs.mem = NULL;
 
 	wsfont_init();
+	if (vga_no_builtinfont) {
+		struct wsdisplay_font *wf;
+		int cookie;
+
+		cookie = wsfont_find(NULL, 8, 16, 0,
+		     WSDISPLAY_FONTORDER_L2R, 0);
+		if (cookie == -1 || wsfont_lock(cookie, &wf))
+			panic("can't load console font");
+		vga_loadchars(&vc->hdl, 0, wf->firstchar, wf->numchars,
+		    wf->fontheight, wf->data);
+		vga_builtinfont.wsfont = wf;
+		vga_builtinfont.cookie = cookie;
+		vga_builtinfont.slot = 0;
+	}
 	scr->fontset1 = scr->fontset2 = 0;
 	if (vga_selectfont(vc, scr, 0, 0)) {
 		if (scr == &vga_console_screen)
@@ -584,12 +604,14 @@
 	KASSERT(vga_builtinfont.slot == 0);
 #define BUILTINFONTLOC (0)
 #endif
-	vga_builtinfont.wsfont->data =
-		malloc(256 * vga_builtinfont.wsfont->fontheight,
-		       M_DEVBUF, M_WAITOK);
-	vga_readoutchars(&vc->hdl, BUILTINFONTLOC, 0, 256,
-			 vga_builtinfont.wsfont->fontheight,
-			 vga_builtinfont.wsfont->data);
+	if (!vga_no_builtinfont) {
+		vga_builtinfont.wsfont->data =
+		    malloc(256 * vga_builtinfont.wsfont->fontheight,
+		    M_DEVBUF, M_WAITOK);
+		vga_readoutchars(&vc->hdl, BUILTINFONTLOC, 0, 256,
+				 vga_builtinfont.wsfont->fontheight,
+				 vga_builtinfont.wsfont->data);
+	}
 
 	vc->vc_type = type;
 	vc->vc_funcs = vf;
Index: dev/ic/vga_raster.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/vga_raster.c,v
retrieving revision 1.5
diff -u -r1.5 vga_raster.c
--- dev/ic/vga_raster.c	2002/11/28 07:02:20	1.5
+++ dev/ic/vga_raster.c	2003/01/14 13:36:51
@@ -75,8 +75,10 @@
 
 #include <dev/ic/pcdisplay.h>
 
-u_int8_t builtinfont_data[256 * 16];
+int vga_no_builtinfont = 0;
 
+static u_int8_t builtinfont_data[256 * 16];
+
 struct wsdisplay_font builtinfont = {
 	"builtin",			/* typeface name */
 	0,				/* firstchar */
@@ -397,8 +399,6 @@
 	vc->nfonts = 1;
 	LIST_INIT(&vc->vc_fontlist);
 	vf = &vga_console_fontset_ascii;
-	vga_load_builtinfont(vh, builtinfont_data, 0, 256);
-	vf->font = &builtinfont;
 	LIST_INSERT_HEAD(&vc->vc_fontlist, vf, next);
 }
 
@@ -415,10 +415,28 @@
 	scr->type = type;
 	scr->mindispoffset = 0;
 	scr->maxdispoffset = 0x10000;
-	scr->encoding = WSDISPLAY_FONTENC_IBM;
 	vh = &vc->hdl;
 
 	wsfont_init();
+	if (vga_no_builtinfont) {
+		struct wsdisplay_font *wf;
+		int cookie;
+
+		/* prefer 8x16 pixel font */
+		cookie = wsfont_find(NULL, 8, 16, 0,
+		     WSDISPLAY_FONTORDER_L2R, 0);
+		if (cookie == -1)
+			cookie = wsfont_find(NULL, 0, 0, 0,
+			     WSDISPLAY_FONTORDER_L2R, WSDISPLAY_FONTORDER_L2R);
+		if (cookie == -1 || wsfont_lock(cookie, &wf))
+			panic("can't load console font");
+		vga_console_fontset_ascii.font= wf;
+		scr->encoding = wf->encoding;
+	} else {
+		vga_load_builtinfont(vh, builtinfont_data, 0, 256);
+		vga_console_fontset_ascii.font = &builtinfont;
+		scr->encoding = WSDISPLAY_FONTENC_IBM;
+	}
 	LIST_INIT(&scr->fontset);
 	vga_raster_setup_font(vc, scr);
 
@@ -449,7 +467,7 @@
 			    vh->vh_allmemh, 0x18000 + i * 2);
 			scr->mem[i].attr = bus_space_read_1(vh->vh_memt, 
 			    vh->vh_allmemh, 0x18000 + i * 2 + 1);			 
-			scr->mem[i].enc = WSDISPLAY_FONTENC_IBM;
+			scr->mem[i].enc = scr->encoding;
 		}
 
 		vga_raster_setscreentype(vc, type);
@@ -790,7 +808,7 @@
 		}
 	}
 	
-	cookie = wsfont_find(0, 0, scr->type->fontheight, 0,
+	cookie = wsfont_find(NULL, 0, scr->type->fontheight, 0,
 	    WSDISPLAY_FONTORDER_L2R, 0);
 	if (cookie == -1)
 		return;
@@ -833,9 +851,9 @@
 			mode->vdisplay *= 2;
 		if (mode->vdisplay < 400)
 			regs->miscout = 0xa3;
-		if (mode->vdisplay < 480)
+		else if (mode->vdisplay < 480)
 			regs->miscout = 0x63;
-		if (mode->vdisplay < 768)
+		else if (mode->vdisplay < 768)
 			regs->miscout = 0xe3;
 		else
 			regs->miscout = 0x23;
@@ -996,7 +1014,7 @@
 		scr->cursortmp.ch = 0;
 		scr->cursortmp.attr = 0;
 		scr->cursortmp.second = 0;
-		scr->cursortmp.enc = WSDISPLAY_FONTENC_IBM;
+		scr->cursortmp.enc = scr->encoding;
 	}
 	
 	scr->cursoron = 1;
@@ -1110,7 +1128,7 @@
 	scr->mem[off].ch = c;
 	scr->mem[off].attr = attr;
 	scr->mem[off].second = 0;
-	scr->mem[off].enc = WSDISPLAY_FONTENC_IBM;
+	scr->mem[off].enc = scr->encoding;
 }
 
 static void
@@ -1324,7 +1342,7 @@
 		scr->mem[off + i].ch = ' ';
 		scr->mem[off + i].attr = fillattr;
 		scr->mem[off + i].second = 0;
-		scr->mem[off + i].enc = WSDISPLAY_FONTENC_IBM;
+		scr->mem[off + i].enc = scr->encoding;
 	}
 }
 
Index: dev/ic/vga_subr.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/vga_subr.c,v
retrieving revision 1.11
diff -u -r1.11 vga_subr.c
--- dev/ic/vga_subr.c	2002/10/15 18:14:42	1.11
+++ dev/ic/vga_subr.c	2003/01/14 13:36:51
@@ -42,6 +42,7 @@
 #include <machine/bus.h>
 
 #include <dev/ic/mc6845reg.h>
+#include <dev/ic/pcdisplay.h>
 #include <dev/ic/pcdisplayvar.h>
 #include <dev/ic/vgareg.h>
 #include <dev/ic/vgavar.h>
@@ -50,6 +51,7 @@
 
 static void fontram(struct vga_handle *);
 static void textram(struct vga_handle *);
+static void vga_initregs(struct vga_handle *);

 static void
 fontram(struct vga_handle *vh)
@@ -213,3 +215,186 @@
 	splx(s);
 }
 #endif /* !VGA_RASTERCONSOLE */
+
+/*
+ * vga_reset():
+ *	Reset VGA registers to put it into text mode.
+ *	This function should be called from MD consinit() on ports
+ *	whose firmware does not use text mode at boot time.
+ */
+void
+vga_reset(vh, md_initfunc)
+	struct vga_handle *vh;
+	void (*md_initfunc)(struct vga_handle *);
+{
+	u_int8_t reg;
+
+	if (bus_space_map(vh->vh_iot, 0x3c0, 0x10, 0, &vh->vh_ioh_vga))
+		return;
+
+	reg = bus_space_read_1(vh->vh_iot, vh->vh_ioh_vga, VGA_MISC_DATAR);
+	vh->vh_mono = !(reg & 0x01);
+
+	if (bus_space_map(vh->vh_iot, vh->vh_mono ? 0x3b0 : 0x3d0, 0x10,
+	    0, &vh->vh_ioh_6845))
+		goto out1;
+
+	if (bus_space_map(vh->vh_memt, 0xa0000, 0x20000, 0, &vh->vh_allmemh))
+		goto out2;
+
+	if (bus_space_subregion(vh->vh_memt, vh->vh_allmemh,
+	    vh->vh_mono ? 0x10000 : 0x18000, 0x8000, &vh->vh_memh))
+		goto out3;
+
+	/* check if VGA already in text mode. */
+	if ((vga_gdc_read(vh, misc) & 0x01) == 0)
+		goto out3;
+
+	/* initialize common VGA registers */
+	vga_initregs(vh);
+
+	/* initialize chipset specific registers */
+	if (md_initfunc != NULL)
+		(*md_initfunc)(vh);
+
+	delay(10000);
+
+	/* clear text buffer RAM */
+	bus_space_set_region_2(vh->vh_memt, vh->vh_memh, 0,
+	    ((BG_BLACK | FG_LIGHTGREY) << 8) | ' ', 80 * 25 /*XXX*/);
+
+ out3:
+	bus_space_unmap(vh->vh_memt, vh->vh_allmemh, 0x20000);
+ out2:
+	bus_space_unmap(vh->vh_iot, vh->vh_ioh_6845, 0x10);
+ out1:
+	bus_space_unmap(vh->vh_iot, vh->vh_ioh_vga, 0x10);
+}
+
+/*
+ * values to initialize registers.
+ */
+
+/* sequencer registers */
+static const u_int8_t vga_ts[] = {
+	0x03,	/* 00: reset */
+	0x01,	/* 01: clocking mode */
+	0x03,	/* 02: map mask */
+	0x00,	/* 03: character map select */
+	0x02	/* 04: memory mode */
+};
+
+/* CRT controller registers */
+static const u_int8_t vga_crtc[] = {
+	0x5f,	/* 00: horizontal total */
+	0x4f,	/* 01: horizontal display-enable end */
+	0x50,	/* 02: start horizontal blanking */
+	0x82,	/* 03: display skew control / end horizontal blanking */
+	0x55,	/* 04: start horizontal retrace pulse */
+	0x81,	/* 05: horizontal retrace delay / end horizontal retrace */
+	0xbf,	/* 06: vetical total */
+	0x1f,	/* 07: overflow register */
+	0x00,	/* 08: preset row scan */
+	0x4f,	/* 09: overflow / maximum scan line */
+	0x0d,	/* 0A: cursor off / cursor start */
+	0x0e,	/* 0B: cursor skew / cursor end */
+	0x00,	/* 0C: start regenerative buffer address high */
+	0x00,	/* 0D: start regenerative buffer address low */
+	0x00,	/* 0E: cursor location high */
+	0x00,	/* 0F: cursor location low */
+	0x9c,	/* 10: vertical retrace start */
+	0x8e,	/* 11: vertical interrupt / vertical retrace end */
+	0x8f,	/* 12: vertical display enable end */
+	0x28,	/* 13: logical line width */
+	0x00,	/* 14: underline location */
+	0x96,	/* 15: start vertical blanking */
+	0xb9,	/* 16: end vertical blanking */
+	0xa3,	/* 17: CRT mode control */
+	0xff	/* 18: line compare */
+};
+
+/* graphics controller registers */
+static const u_int8_t vga_gdc[] = {
+	0x00,	/* 00: set/reset map */
+	0x00,	/* 01: enable set/reset */
+	0x00,	/* 02: color compare */
+	0x00,	/* 03: data rotate */
+	0x00,	/* 04: read map select */
+	0x10,	/* 05: graphics mode */
+	0x0e,	/* 06: miscellaneous */
+	0x00,	/* 07: color don't care */
+	0xff	/* 08: bit mask */
+};
+
+/* attribute controller registers */
+static const u_int8_t vga_atc[] = {
+	0x00,	/* 00: internal pallet  0 */
+	0x01,	/* 01: internal pallet  1 */
+	0x02,	/* 02: internal pallet  2 */
+	0x03,	/* 03: internal pallet  3 */
+	0x04,	/* 04: internal pallet  4 */
+	0x05,	/* 05: internal pallet  5 */
+	0x14,	/* 06: internal pallet  6 */
+	0x07,	/* 07: internal pallet  7 */
+	0x38,	/* 08: internal pallet  8 */
+	0x39,	/* 09: internal pallet  9 */
+	0x3a,	/* 0A: internal pallet 10 */
+	0x3b,	/* 0B: internal pallet 11 */
+	0x3c,	/* 0C: internal pallet 12 */
+	0x3d,	/* 0D: internal pallet 13 */
+	0x3e,	/* 0E: internal pallet 14 */
+	0x3f,	/* 0F: internal pallet 15 */
+	0x08,	/* 10: attribute mode control */
+	0x00,	/* 11: overscan color */
+	0x0f,	/* 12: color plane enable */
+	0x08,	/* 13: horizontal PEL panning */
+	0x00	/* 14: color select */
+};
+
+static void
+vga_initregs(vh)
+	struct vga_handle *vh;
+{
+	int i;
+
+	/* disable video */
+	vga_ts_write(vh, mode, vga_ts[1] | 0x20);
+
+	if (vga_no_builtinfont) {
+		/* clear font ram to avoid displaying garbage */
+		fontram(vh);
+		bus_space_set_region_1(vh->vh_memt, vh->vh_allmemh,
+		    0, 0x00, 32 * 16 * 256);
+	}
+
+	/* synchronous reset */
+	vga_ts_write(vh, syncreset, 0x01);
+	/* set TS regs */
+	for (i = 2; i < VGA_TS_NREGS; i++)
+		_vga_ts_write(vh, i, vga_ts[i]);
+	/* clear synchronous reset */
+	vga_ts_write(vh, syncreset, 0x03);
+
+	/* unprotect CRTC regs */
+	_vga_crtc_write(vh, 17, vga_crtc[17] & ~0x80);
+	/* set CRTC regs */
+	for (i = 0; i < VGA_CRTC_NREGS; i++)
+		_vga_crtc_write(vh, i, vga_crtc[i]);
+
+	/* set GDC regs */
+	for (i = 0; i < VGA_GDC_NREGS; i++)
+		_vga_gdc_write(vh, i, vga_gdc[i]);
+
+	/* set DAC PEL mask */
+	bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, 6, 0xff);
+
+	/* set ATC regs */
+	for (i = 0; i < VGA_ATC_NREGS; i++)
+		_vga_attr_write(vh, i, vga_atc[i]);
+
+	/* set misc output register */
+	bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_MISC_DATAW, 0x63);
+
+	/* reenable video */
+	vga_ts_write(vh, mode, vga_ts[1] & ~0x20);
+}
Index: dev/ic/vgavar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/vgavar.h,v
retrieving revision 1.15
diff -u -r1.15 vgavar.h
--- dev/ic/vgavar.h	2002/10/15 18:14:42	1.15
+++ dev/ic/vgavar.h	2003/01/14 13:36:51
@@ -210,3 +210,6 @@
 #else /* !VGA_RASTERCONSOLE */
 void 	vga_load_builtinfont(struct vga_handle *, u_int8_t *, int, int);
 #endif /* !VGA_RASTERCONSOLE */
+void	vga_reset(struct vga_handle *, void (*)(struct vga_handle *));
+
+extern int vga_no_builtinfont;
\ No newline at end of file
Index: arch/arc/arc/c_jazz_eisa.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arc/arc/c_jazz_eisa.c,v
retrieving revision 1.2
diff -u -r1.2 c_jazz_eisa.c
--- arch/arc/arc/c_jazz_eisa.c	2002/12/09 13:36:26	1.2
+++ arch/arc/arc/c_jazz_eisa.c	2003/01/14 13:36:51
@@ -52,6 +52,11 @@
 #include <arc/jazz/pccons_jazziovar.h>
 #endif
 
+#include "vga_isa.h"
+#if NVGA_ISA > 0
+#include <dev/isa/vga_isavar.h>
+#endif
+
 #include "vga_jazzio.h"
 #if NVGA_JAZZIO > 0
 #include <arc/jazz/vga_jazziovar.h>
@@ -155,6 +160,17 @@
 			return;
 		}
 #endif
+
+#if NVGA_ISA > 0
+		if (vga_isa_cnattach(&arc_bus_io, &arc_bus_mem) == 0) {
+#if NPCKBC_JAZZIO > 0
+			pckbc_cnattach(&jazzio_bus, PICA_SYS_KBD,
+			    JAZZIO_KBCMDP, PCKBC_KBD_SLOT);
+#endif
+			return;
+		}
+#endif
+
 #if NPC_JAZZIO > 0
 		if (pccons_jazzio_cnattach(arc_displayc_id, &jazzio_bus) == 0)
 			return;
Index: arch/arc/arc/c_nec_eisa.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arc/arc/c_nec_eisa.c,v
retrieving revision 1.4
diff -u -r1.4 c_nec_eisa.c
--- arch/arc/arc/c_nec_eisa.c	2002/12/09 13:38:30	1.4
+++ arch/arc/arc/c_nec_eisa.c	2003/01/14 13:36:52
@@ -32,6 +32,7 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/kcore.h>
 #include <sys/device.h>
 #include <uvm/uvm_extern.h>
 
@@ -42,12 +43,23 @@
 
 #include <dev/isa/isavar.h>
 
+#include <arc/arc/arcbios.h>
 #include <arc/arc/wired_map.h>
 #include <arc/jazz/pica.h>
 #include <arc/jazz/rd94.h>
 #include <arc/jazz/jazziovar.h>
 #include <arc/isa/isabrvar.h>
 
+#include "vga_isa.h"
+#if NVGA_ISA > 0
+#include <dev/ic/mc6845reg.h>
+#include <dev/ic/pcdisplayvar.h>
+#include <dev/ic/vgareg.h>
+#include <dev/ic/vgavar.h>
+
+static void gd54xx_initregs(struct vga_handle *);
+#endif
+
 /*
  * chipset-dependent isa bus configuration
  */
@@ -146,3 +158,82 @@
 	/* chipset-dependent jazzio bus configuration */
 	jazzio_conf = &jazzio_nec_eisa_conf;
 }
+
+void
+c_nec_eisa_cons_init()
+{
+
+#if NVGA_ISA > 0
+	if (strcmp(arc_displayc_id, "necvdfrb") == 0) {
+		/* NEC RISCserver 2200 R4400 EISA [NEC-R96] */
+		/* NEC Express5800/240 R4400 EISA [NEC-J96A] */
+		struct vga_handle handle;
+
+		vga_no_builtinfont = 1;
+		handle.vh_memt = &arc_bus_mem;
+		handle.vh_iot = &arc_bus_io;
+		vga_reset(&handle, gd54xx_initregs);
+	}
+#endif
+
+	c_jazz_eisa_cons_init();
+}
+
+#if NVGA_ISA > 0
+
+/* values to initialize cirrus GD54xx specific ext registers */
+/* XXX these values are taken from PC XXX */
+static const u_int8_t vga_ts_gd54xx[] = {
+	0x0f,	/* 05: ??? */
+	0x12,	/* 06: enable ext reg (?) */
+	0x00,	/* 07: reset ext sequence (?) */
+	0x00,	/* 08: ??? */
+	0x5c,	/* 09: ??? */
+	0x09,	/* 0A: ??? */
+	0x4a,	/* 0B: ??? */
+	0x5b,	/* 0C: ??? */
+	0x42,	/* 0D: VCLK2 frequency */
+	0x00,	/* 0E: ??? */
+	0x09,	/* 0F: ??? */
+	0x00,	/* 10: ??? */
+	0x00,	/* 11: ??? */
+	0x00,	/* 12: ??? */
+	0x00,	/* 13: ??? */
+	0x00,	/* 14: ??? */
+	0x00,	/* 15: ??? */
+	0xd8,	/* 16: ??? */
+	0x39,	/* 17: ??? */
+	0x00,	/* 18: ??? */
+	0x01,	/* 19: ??? */
+	0x00,	/* 1A: ??? */
+	0x2b,	/* 1B: ??? */
+	0x2f,	/* 1C: ??? */
+	0x1f,	/* 1D: VCLK2 denominator and post-scalar value */
+	0x00,	/* 1E: ??? */
+	0x19	/* 1F: ??? */
+	/* XXX needs more ?? */
+};
+
+static void
+gd54xx_initregs(vh)
+	struct vga_handle *vh;
+{
+	int i;
+
+	/* disable video */
+	vga_ts_write(vh, mode, vga_ts_read(vh, mode) | 0x20);
+
+	/* enable access to GD54xx ext regs */
+	_vga_ts_write(vh, 0x06, 0x12);
+
+	/* setup GD54xx ext regs */
+	for (i = 0; i < sizeof(vga_ts_gd54xx); i++)
+		_vga_ts_write(vh, 0x05 + i, vga_ts_gd54xx[i]);
+	
+	/* disable access to GD54xx ext regs */
+	_vga_ts_write(vh, 0x06, 0x0);
+
+	/* reenable video */
+	vga_ts_write(vh, mode, vga_ts_read(vh, mode) & ~0x20);
+}
+#endif
Index: arch/arc/arc/p_nec_j96a.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arc/arc/p_nec_j96a.c,v
retrieving revision 1.3
diff -u -r1.3 p_nec_j96a.c
--- arch/arc/arc/p_nec_j96a.c	2002/12/09 13:36:27	1.3
+++ arch/arc/arc/p_nec_j96a.c	2003/01/14 13:36:52
@@ -43,7 +43,7 @@
 	c_jazz_eisa_mainbusdevs,
 	platform_generic_match,
 	c_nec_eisa_init,
-	c_jazz_eisa_cons_init,
+	c_nec_eisa_cons_init,
 	jazzio_reset,
 	c_nec_jazz_set_intr,
 };
Index: arch/arc/arc/p_nec_r96.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arc/arc/p_nec_r96.c,v
retrieving revision 1.1
diff -u -r1.1 p_nec_r96.c
--- arch/arc/arc/p_nec_r96.c	2001/06/13 15:35:04	1.1
+++ arch/arc/arc/p_nec_r96.c	2003/01/14 13:36:52
@@ -49,7 +49,7 @@
 	c_jazz_eisa_mainbusdevs,
 	platform_generic_match,
 	c_nec_eisa_init,
-	c_jazz_eisa_cons_init,
+	c_nec_eisa_cons_init,
 	jazzio_reset,
 	c_nec_jazz_set_intr,
 };
Index: arch/arc/conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/arc/conf/GENERIC,v
retrieving revision 1.79
diff -u -r1.79 GENERIC
--- arch/arc/conf/GENERIC	2003/01/04 21:09:31	1.79
+++ arch/arc/conf/GENERIC	2003/01/14 13:36:52
@@ -226,8 +226,10 @@
 
 pc0		at isa? irq 1			# generic PC console device
 opms0		at isa? irq 12			# PS/2 auxiliary port mouse
-#vga0		at isa?
-#pckbc0		at isa?				# PC keyboard controller
+vga0		at isa?
+#options 	VGA_RASTERCONSOLE
+options 	FONT_VT220L8x16
+pckbc0		at isa?				# PC keyboard controller
 com0		at isa? port 0x3f8 irq 4
 com1		at isa? port 0x2f8 irq 3
 com2		at isa? port 0x3e8 irq 4
Index: arch/arc/include/platform.h
===================================================================
RCS file: /cvsroot/src/sys/arch/arc/include/platform.h,v
retrieving revision 1.2
diff -u -r1.2 platform.h
--- arch/arc/include/platform.h	2002/11/30 19:23:47	1.2
+++ arch/arc/include/platform.h	2003/01/14 13:36:53
@@ -92,6 +92,7 @@
 void c_magnum_init __P((void));
 
 void c_nec_eisa_init __P((void));
+void c_nec_eisa_cons_init __P((void));
 
 void c_nec_jazz_set_intr __P((int, int (*) __P((u_int, struct clockframe *)),
     int));