Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jan 2018 08:01:51 +0000 (UTC)
From:      Wojciech Macek <wma@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328077 - head/sys/powerpc/powernv
Message-ID:  <201801170801.w0H81pJR044093@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: wma
Date: Wed Jan 17 08:01:51 2018
New Revision: 328077
URL: https://svnweb.freebsd.org/changeset/base/328077

Log:
  PowerNV: workaround console on OPAL 5.4
  
  FreeBSD prints text char-by-char, which is not what OPAL
  is designed to. Poll events more frequently to avoid buffer
  overflow and loosing data.
  
  Created by:            Wojciech Macek <wma@semihalf.com>
  Obtained from:         Semihalf
  Sponsored by:          QCM Technologies

Modified:
  head/sys/powerpc/powernv/opal_console.c

Modified: head/sys/powerpc/powernv/opal_console.c
==============================================================================
--- head/sys/powerpc/powernv/opal_console.c	Wed Jan 17 07:39:11 2018	(r328076)
+++ head/sys/powerpc/powernv/opal_console.c	Wed Jan 17 08:01:51 2018	(r328077)
@@ -435,11 +435,15 @@ uart_opal_cngetc(struct consdev *cp)
 static void
 uart_opal_cnputc(struct consdev *cp, int c)
 {
-	static uint64_t events;
 	unsigned char ch = c;
+	int a;
 
-	if (cold)
-		opal_call(OPAL_POLL_EVENTS, &events); /* Clear FIFO if needed */
+	if (1) {
+		/* Clear FIFO if needed. Must be repeated few times. */
+		for (a = 0; a < 20; a++) {
+			opal_call(OPAL_POLL_EVENTS, NULL);
+		}
+	}
 	uart_opal_put(console_sc, &ch, 1);
 }
 
@@ -461,7 +465,7 @@ uart_opal_ttyoutwakeup(struct tty *tp)
 	int len;
 
 	sc = tty_softc(tp);
-	
+
 	while ((len = ttydisc_getc(tp, buffer, sizeof(buffer))) != 0)
 		uart_opal_put(sc, buffer, len);
 }
@@ -479,6 +483,8 @@ uart_opal_intr(void *v)
 		ttydisc_rint(tp, c, 0);
 	ttydisc_rint_done(tp);
 	tty_unlock(tp);
+
+	opal_call(OPAL_POLL_EVENTS, NULL);
 
 	if (sc->irqres == NULL)
 		callout_reset(&sc->callout, sc->polltime, uart_opal_intr, sc);



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