IT! WORKS!

Pyun YongHyeon yongari at kt-is.co.kr
Wed Jun 16 08:56:49 GMT 2004


On Tue, Jun 15, 2004 at 11:47:27PM -0400, Mykel wrote:
 > Ken Smith wrote:
...
 > 
 > Now how about the console? how can I make typing at least practical on 
 > here? I was hoping to use this as a desktop machine.
 > 

Because I got big trouble while testing TCP/UDP cksum offload
fix for hme(4) on console, I touched ofw_console code. I stole
the code from OpenBSD. It seems that now the console works as
expected. No more 1 sec. pause needed to see correct typing on
keyboard. Here is patch. I'm not familiar with tty code, so
it may be just dirty hack or it may not work except my Ultra2.

Regards,
Pyun YongHyeon
-- 
Pyun YongHyeon <http://www.kr.freebsd.org/~yongari>
-------------- next part --------------
--- sys/dev/ofw/ofw_console.c.orig	Fri Jun 11 07:15:51 2004
+++ sys/dev/ofw/ofw_console.c	Wed Jun 16 17:38:48 2004
@@ -42,7 +42,8 @@
 
 #include <ddb/ddb.h>
 
-#define	OFW_POLL_HZ	4
+#define	OFW_POLL_HZ	100
+#define OFBURSTLEN	128	/* max number of bytes to write in one chunk */
 
 static d_open_t		ofw_dev_open;
 static d_close_t	ofw_dev_close;
@@ -125,7 +126,7 @@
 		ttychars(tp);
 		tp->t_iflag = TTYDEF_IFLAG;
 		tp->t_oflag = TTYDEF_OFLAG;
-		tp->t_cflag = TTYDEF_CFLAG|CLOCAL;
+		tp->t_cflag = TTYDEF_CFLAG;
 		tp->t_lflag = TTYDEF_LFLAG;
 		tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
 		ttsetwater(tp);
@@ -162,6 +163,8 @@
 		return (ENXIO);
 	}
 
+	/* XXX Should be replaced with callout_stop(9) */
+	untimeout(ofw_timeout, tp, ofw_timeouthandle);
 	ttyld_close(tp, flag);
 	ttyclose(tp);
 
@@ -179,16 +182,18 @@
 static void
 ofw_tty_start(struct tty *tp)
 {
+	struct clist *cl;
+	int len;
+	u_char buf[OFBURSTLEN];
 
-	if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) {
-		ttwwakeup(tp);
+
+	if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))
 		return;
-	}
 
 	tp->t_state |= TS_BUSY;
-	while (tp->t_outq.c_cc != 0) {
-		ofw_cons_putc(NULL, getc(&tp->t_outq));
-	}
+	cl = &tp->t_outq;
+	len = q_to_b(cl, buf, OFBURSTLEN);
+	OF_write(stdout, buf, len);
 	tp->t_state &= ~TS_BUSY;
 
 	ttwwakeup(tp);


More information about the freebsd-sparc64 mailing list