svn commit: r328077 - head/sys/powerpc/powernv
Wojciech Macek
wma at FreeBSD.org
Wed Jan 17 08:01:52 UTC 2018
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 at 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);
More information about the svn-src-head
mailing list