news68k PROM function based framebuffer console support

Izumi Tsutsui <[email protected]> Mon, 21 Nov 2011 01:27:51 +0900
Newsgroups gmane.os.netbsd.ports.news68k
Message-ID <[email protected]>
Dear news68k users,

As seen in source-changes@, I've committed preliminary PROM internal
function based framebuffer console output support:
http://mail-index.NetBSD.org/source-changes/2011/11/20/msg029148.html

---
Module Name:	src
Committed By:	tsutsui
Date:		Sun Nov 20 15:38:00 UTC 2011

Modified Files:
	src/sys/arch/news68k/conf: GENERIC INSTALL files.news68k majors.news68k
	src/sys/arch/news68k/dev: if_le.c kb_hb.c si.c zs.c
	src/sys/arch/news68k/include: cpu.h vmparam.h
	src/sys/arch/news68k/news68k: locore.s machdep.c pmap_bootstrap.c
Added Files:
	src/sys/arch/news68k/news68k: romcalls.S romcons.c

Log Message:
Add preliminary PROM internal function based framebuffer console support,
which was demonstrated at Open Source Conference 2011 Kansai @ Kyoto
back in July:
http://www.NetBSD.org/gallery/events.html#opensourceconf2011-Kansai

- map 0xc0000000-0xffffffff PA region (which is mirror of PA 0x0-0x3fffffff)
  to the same VA via %tt0 and %tt1 registers and move KVA space accordingly
  (like luna68k does for its devices)
- save trap #0 vector for PROM function calls in early bootstrap
  and register it to trap #14 to call it from kernel for console output
- add dumb romcall based tty attachment taken from src/sys/dev/ofw/ofcons.c
- add rom function call stubs from news68k/stand/common/romcalls.S
- remove IIOV() macro for device registers where now mapped PA==VA via %tt1

XXX: romcons is not enabled yet because there is no generic interface
XXX: to attach wskbd(4) to non wsdisplay(4) devices like this romcons.
---

It's still disabled by default, but it can be used with the attached
ugly patch for MI wskbd.c to attach MI wskbd to MD romcons:

---
Index: sys/dev/wscons/wskbd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/wscons/wskbd.c,v
retrieving revision 1.130
diff -u -p -r1.130 wskbd.c
--- sys/dev/wscons/wskbd.c	26 Oct 2010 05:12:34 -0000	1.130
+++ sys/dev/wscons/wskbd.c	20 Nov 2011 15:59:17 -0000
@@ -703,6 +703,27 @@ wskbd_input(device_t dev, u_int type, in
 		return;
 	}
 #endif
+#ifdef news68k
+#include "romcons.h"
+#if NROMCONS > 0
+	if (sc->sc_translating) {
+		int num, i;
+		keysym_t ks;
+		extern bool romcons_is_console;
+		extern void romcons_kbdinput(int);
+
+		if (romcons_is_console) {
+			num = wskbd_translate(sc->id, type, value);
+			for (i = 0; i < num; i++) {
+				ks = sc->id->t_symbols[i];
+				if (KS_GROUP(ks) == KS_GROUP_Plain &&
+				    KS_VALUE(ks) <= 0x7f);
+					romcons_kbdinput(KS_VALUE(ks));
+			}
+		}
+	}
+#endif
+#endif
 
 	wskbd_deliver_event(sc, type, value);
 

---

Have fun,

---
Izumi Tsutsui