svn commit: r199310 - projects/ppc64/sys/powerpc/mambo

Nathan Whitehorn nwhitehorn at FreeBSD.org
Mon Nov 16 04:55:17 UTC 2009


Author: nwhitehorn
Date: Mon Nov 16 04:55:16 2009
New Revision: 199310
URL: http://svn.freebsd.org/changeset/base/199310

Log:
  Update mambo console to (a) poll faster, and (b) use callouts instead
  of timeout. This makes it slightly less unbearable. Most of these changes
  were copied from dcons.

Modified:
  projects/ppc64/sys/powerpc/mambo/mambo_console.c

Modified: projects/ppc64/sys/powerpc/mambo/mambo_console.c
==============================================================================
--- projects/ppc64/sys/powerpc/mambo/mambo_console.c	Mon Nov 16 04:14:22 2009	(r199309)
+++ projects/ppc64/sys/powerpc/mambo/mambo_console.c	Mon Nov 16 04:55:16 2009	(r199310)
@@ -27,7 +27,6 @@
 __FBSDID("$FreeBSD: head/sys/dev/mambo/mambo_console.c 193018 2009-05-29 06:41:23Z ed $");
 
 #include "opt_comconsole.h"
-#include "opt_ofw.h"
 
 #include <sys/param.h>
 #include <sys/kdb.h>
@@ -46,28 +45,21 @@ __FBSDID("$FreeBSD: head/sys/dev/mambo/m
 
 #include "mambocall.h"
 
-#ifndef	MAMBOCONS_POLL_HZ
-#define	MAMBOCONS_POLL_HZ	4
-#endif
 #define MAMBOBURSTLEN	128	/* max number of bytes to write in one chunk */
 
 #define MAMBO_CONSOLE_WRITE	0
 #define MAMBO_CONSOLE_READ	60
 
-static tsw_open_t mambotty_open;
-static tsw_close_t mambotty_close;
 static tsw_outwakeup_t mambotty_outwakeup;
 
 static struct ttydevsw mambo_ttydevsw = {
 	.tsw_flags	= TF_NOPREFIX,
-	.tsw_open	= mambotty_open,
-	.tsw_close	= mambotty_close,
 	.tsw_outwakeup	= mambotty_outwakeup,
 };
 
 static int			polltime;
-static struct callout_handle	mambo_timeouthandle
-    = CALLOUT_HANDLE_INITIALIZER(&mambo_timeouthandle);
+static struct callout		mambo_callout;
+static struct tty 		*tp = NULL;
 
 #if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER)
 static int			alt_break_state;
@@ -86,7 +78,6 @@ CONSOLE_DRIVER(mambo);
 static void
 cn_drvinit(void *unused)
 {
-	struct tty *tp;
 
 	if (mambo_consdev.cn_pri != CN_DEAD &&
 	    mambo_consdev.cn_name[0] != '\0') {
@@ -97,30 +88,15 @@ cn_drvinit(void *unused)
 		tty_init_console(tp, 0);
 		tty_makedev(tp, NULL, "%s", "mambocons");
 		tty_makealias(tp, "mambocons");
-	}
-}
-
-SYSINIT(cndev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, cn_drvinit, NULL);
 
-static int
-mambotty_open(struct tty *tp)
-{
-	polltime = hz / MAMBOCONS_POLL_HZ;
-	if (polltime < 1)
 		polltime = 1;
 
-	mambo_timeouthandle = timeout(mambo_timeout, tp, polltime);
-
-	return (0);
+		callout_init(&mambo_callout, CALLOUT_MPSAFE);
+		callout_reset(&mambo_callout, polltime, mambo_timeout, NULL);
+	}
 }
 
-static void
-mambotty_close(struct tty *tp)
-{
-
-	/* XXX Should be replaced with callout_stop(9) */
-	untimeout(mambo_timeout, tp, mambo_timeouthandle);
-}
+SYSINIT(cndev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, cn_drvinit, NULL);
 
 static void
 mambotty_outwakeup(struct tty *tp)
@@ -139,18 +115,15 @@ mambotty_outwakeup(struct tty *tp)
 static void
 mambo_timeout(void *v)
 {
-	struct	tty *tp;
 	int 	c;
 
-	tp = (struct tty *)v;
-
 	tty_lock(tp);
 	while ((c = mambo_cngetc(NULL)) != -1)
 		ttydisc_rint(tp, c, 0);
 	ttydisc_rint_done(tp);
 	tty_unlock(tp);
 
-	mambo_timeouthandle = timeout(mambo_timeout, tp, polltime);
+	callout_reset(&mambo_callout, polltime, mambo_timeout, NULL);
 }
 
 static void
@@ -180,7 +153,7 @@ mambo_cnterm(struct consdev *cp)
 static int
 mambo_cngetc(struct consdev *cp)
 {
-	unsigned char ch;
+	int ch;
 
 	ch = mambocall(MAMBO_CONSOLE_READ);
 


More information about the svn-src-projects mailing list