Better OFW console support on Sun Ultra2 machines.

Ultra2 users may want to set OFWCONS_POLL_HZ to a value of '20'.
I have left default value at '4' as higher values can consume a more
than is acceptable amount of CPU, and we don't have a consensus yet
what is an optimal value.

Submitted by:	Pyun YongHyeon <yongari@kt-is.co.kr>
This commit is contained in:
David E. O'Brien 2004-06-24 02:57:11 +00:00
parent d7af790b0d
commit a82b25f9b2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=131016
3 changed files with 20 additions and 9 deletions

View File

@ -9,6 +9,7 @@ GFB_NO_MODE_CHANGE opt_gfb.h
PSYCHO_DEBUG opt_psycho.h
DEBUGGER_ON_POWERFAIL opt_psycho.h
OFW_PCI_DEBUG opt_ofw_pci.h
OFWCONS_POLL_HZ opt_ofw.h
# Debug IOMMU inserts/removes using diagnostic accesses. Very loud.
IOMMU_DIAG opt_iommu.h
PMAP_STATS opt_pmap.h

View File

@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$");
#include "opt_ddb.h"
#include "opt_comconsole.h"
#include "opt_ofw.h"
#include <sys/param.h>
#include <sys/kernel.h>
@ -42,7 +43,10 @@ __FBSDID("$FreeBSD$");
#include <ddb/ddb.h>
#define OFW_POLL_HZ 4
#ifndef OFWCONS_POLL_HZ
#define OFWCONS_POLL_HZ 4 /* 50-100 works best on Ultra2 */
#endif
#define OFBURSTLEN 128 /* max number of bytes to write in one chunk */
static d_open_t ofw_dev_open;
static d_close_t ofw_dev_close;
@ -125,7 +129,7 @@ ofw_dev_open(struct cdev *dev, int flag, int mode, struct thread *td)
ttychars(tp);
tp->t_iflag = TTYDEF_IFLAG;
tp->t_oflag = TTYDEF_OFLAG;
tp->t_cflag = TTYDEF_CFLAG|CLOCAL;
tp->t_cflag = TTYDEF_CFLAG;
tp->t_lflag = TTYDEF_LFLAG;
tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
ttsetwater(tp);
@ -138,7 +142,7 @@ ofw_dev_open(struct cdev *dev, int flag, int mode, struct thread *td)
error = ttyld_open(tp, dev);
if (error == 0 && setuptimeout) {
polltime = hz / OFW_POLL_HZ;
polltime = hz / OFWCONS_POLL_HZ;
if (polltime < 1) {
polltime = 1;
}
@ -162,6 +166,8 @@ ofw_dev_close(struct cdev *dev, int flag, int mode, struct thread *td)
return (ENXIO);
}
/* XXX Should be replaced with callout_stop(9) */
untimeout(ofw_timeout, tp, ofw_timeouthandle);
ttyld_close(tp, flag);
ttyclose(tp);
@ -179,16 +185,18 @@ ofw_tty_param(struct tty *tp, struct termios *t)
static void
ofw_tty_start(struct tty *tp)
{
struct clist *cl;
int len;
u_char buf[OFBURSTLEN];
if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) {
ttwwakeup(tp);
if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))
return;
}
tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0) {
ofw_cons_putc(NULL, getc(&tp->t_outq));
}
cl = &tp->t_outq;
len = q_to_b(cl, buf, OFBURSTLEN);
OF_write(stdout, buf, len);
tp->t_state &= ~TS_BUSY;
ttwwakeup(tp);

View File

@ -50,6 +50,8 @@ device "mk48txx" # Mostek MK48T02, MK48T08, MK48T59 clock
device sab # Siemens SAB82532 based serial ports
device zs # Zilog 8530 based serial ports
option OFWCONS_POLL_HZ=4 # 20 or more works best on Ultra2
#####################################################################
# Devices we don't want to deal with