PERFORCE change 99462 for review
Kip Macy
kmacy at FreeBSD.org
Sat Jun 17 20:29:40 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=99462
Change 99462 by kmacy at kmacy_storage:sun4v_work on 2006/06/17 20:28:53
fix hv_cnputchar to return error code
fix console to handle H_EWOULDBLOCK
Affected files ...
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hcall.S#8 edit
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hvcons.c#5 edit
Differences ...
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hcall.S#8 (text+ko) ====
@@ -402,9 +402,8 @@
ENTRY(hv_cnputchar)
mov CONS_WRITE, %o5
ta FAST_TRAP
- tst %o0
retl
- movnz %xcc, -1, %o0
+ nop
SET_SIZE(hv_cnputchar)
/*
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hvcons.c#5 (text+ko) ====
@@ -46,7 +46,7 @@
#include <machine/resource.h>
#include <machine/hypervisor_api.h>
-#define HVCN_POLL_FREQ 4
+#define HVCN_POLL_FREQ 10
static d_open_t hvcn_open;
@@ -64,6 +64,7 @@
static struct resource *hvcn_irq;
static void *hvcn_intrhand;
+static int prevchar = 0;
static int polltime;
static struct callout_handle hvcn_timeouthandle
= CALLOUT_HANDLE_INITIALIZER(&hvcn_timeouthandle);
@@ -243,7 +244,6 @@
int error;
error = 0;
-
do {
if (c == '\n')
error = hv_cnputchar('\r');
@@ -266,21 +266,23 @@
static void
hvcn_tty_start(struct tty *tp)
{
- int error;
+ int c;
- if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP)) {
- ttwwakeup(tp);
- return;
- }
+ if (!(tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))) {
+ tp->t_state |= TS_BUSY;
+
+ if (prevchar && (hv_cnputchar(prevchar) != H_EWOULDBLOCK))
+ prevchar = 0;
+ while (tp->t_outq.c_cc != 0) {
+ c = prevchar = getc(&tp->t_outq);
- tp->t_state |= TS_BUSY;
- error = 0;
- while (tp->t_outq.c_cc != 0 && error != H_EWOULDBLOCK)
- error = hv_cnputchar(getc(&tp->t_outq));
-
- tp->t_state &= ~TS_BUSY;
-
- ttwwakeup(tp);
+ if (hv_cnputchar(prevchar) == H_EWOULDBLOCK)
+ break;
+ prevchar = 0;
+ }
+ tp->t_state &= ~TS_BUSY;
+ ttwwakeup(tp);
+ }
}
static void
@@ -303,8 +305,9 @@
while ((c = hvcncheckc(NULL)) != -1)
if (tp->t_state & TS_ISOPEN)
ttyld_rint(tp, c);
-
+ if (tp->t_outq.c_cc != 0 || prevchar != 0)
+ hvcn_tty_start(tp);
}
static void
More information about the p4-projects
mailing list