Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Jul 2009 02:50:33 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r195332 - projects/mips/sys/dev/cfe
Message-ID:  <200907040250.n642oXhk095079@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Sat Jul  4 02:50:33 2009
New Revision: 195332
URL: http://svn.freebsd.org/changeset/base/195332

Log:
  Fix various conolse issues with cfe after MPSAFE tty.
  Fix a bug with getting env on cfe...

Modified:
  projects/mips/sys/dev/cfe/cfe_api.c
  projects/mips/sys/dev/cfe/cfe_console.c

Modified: projects/mips/sys/dev/cfe/cfe_api.c
==============================================================================
--- projects/mips/sys/dev/cfe/cfe_api.c	Sat Jul  4 02:49:17 2009	(r195331)
+++ projects/mips/sys/dev/cfe/cfe_api.c	Sat Jul  4 02:50:33 2009	(r195332)
@@ -160,7 +160,7 @@ cfe_enumenv(int idx, char *name, int nam
 {
     cfe_xiocb_t xiocb;
 
-    xiocb.xiocb_fcode = CFE_CMD_ENV_SET;
+    xiocb.xiocb_fcode = CFE_CMD_ENV_ENUM;
     xiocb.xiocb_status = 0;
     xiocb.xiocb_handle = 0;
     xiocb.xiocb_flags = 0;

Modified: projects/mips/sys/dev/cfe/cfe_console.c
==============================================================================
--- projects/mips/sys/dev/cfe/cfe_console.c	Sat Jul  4 02:49:17 2009	(r195331)
+++ projects/mips/sys/dev/cfe/cfe_console.c	Sat Jul  4 02:50:33 2009	(r195332)
@@ -84,14 +84,12 @@ CONSOLE_DRIVER(cfe);
 static void
 cn_drvinit(void *unused)
 {
-	char output[32];
 	struct tty *tp;
 
 	if (cfe_consdev.cn_pri != CN_DEAD &&
 	    cfe_consdev.cn_name[0] != '\0') {
 		tp = tty_alloc(&cfe_ttydevsw, NULL);
-		tty_makedev(tp, NULL, "%s", output);
-		tty_makealias(tp, "cfecons");
+		tty_makedev(tp, NULL, "cfecons");
 	}
 }
 
@@ -117,15 +115,21 @@ cfe_tty_close(struct tty *tp)
 static void
 cfe_tty_outwakeup(struct tty *tp)
 {
-	int len;
+	int len, written, rc;
 	u_char buf[CFEBURSTLEN];
 
 	for (;;) {
 		len = ttydisc_getc(tp, buf, sizeof buf);
 		if (len == 0)
 			break;
-		while (cfe_write(conhandle, buf, len) == 0)
-			continue;
+
+		written = 0;
+		while (written < len) {
+			rc = cfe_write(conhandle, &buf[written], len - written);
+			if (rc < 0)
+				break;
+			written += rc;
+		}
 	}
 }
 
@@ -184,13 +188,9 @@ cfe_cnterm(struct consdev *cp)
 static int
 cfe_cngetc(struct consdev *cp)
 {
-	int result;
 	unsigned char ch;
 
-	while ((result = cfe_read(conhandle, &ch, 1)) == 0)
-		continue;
-
-	if (result > 0) {
+	if (cfe_read(conhandle, &ch, 1) == 1) {
 #if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER)
 		int kdb_brk;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907040250.n642oXhk095079>