Commit snapshot of pmax console rework as basepoint for 1.3.2 pullup:

* Do rcons output properly, using cn_tab->cn_dev which points
   at rcons cdevsw entrypoints.

 * The pmadx console code was using keyboard (serial) device
   (major,minor) for raster consoles with special code in the keyboard
   drivers to catch output intended for consoles, pull it off the device
   queue, and print them via cnputc().
   Ifdef out  RCONS_BRAINDAMAGE.

* Other minor cleanup to pmax scc driver.
This commit is contained in:
jonathan 1998-03-24 00:23:55 +00:00
parent 04784d87fa
commit 6d836436ac
8 changed files with 283 additions and 160 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dc.c,v 1.38 1998/03/22 09:27:07 jonathan Exp $ */
/* $NetBSD: dc.c,v 1.39 1998/03/24 00:23:55 jonathan Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dc.c,v 1.38 1998/03/22 09:27:07 jonathan Exp $");
__KERNEL_RCSID(0, "$NetBSD: dc.c,v 1.39 1998/03/24 00:23:55 jonathan Exp $");
/*
* devDC7085.c --
@ -106,6 +106,7 @@ __KERNEL_RCSID(0, "$NetBSD: dc.c,v 1.38 1998/03/22 09:27:07 jonathan Exp $");
#include <pmax/dev/dcvar.h>
#include <pmax/dev/dc_cons.h>
#include <pmax/dev/rconsvar.h>
#define DCUNIT(dev) (minor(dev) >> 2)
#define DCLINE(dev) (minor(dev) & 3)
@ -204,14 +205,20 @@ dcregs *dc_cons_addr = 0;
* XXX used for ugly special-cased console input that should be redone
* more cleanly.
*/
#ifdef RCONS_BRAINDAMAGE
static inline int raster_console __P((void));
static inline int
raster_console()
{
return (cn_tab->cn_pri == CN_INTERNAL ||
cn_tab->cn_pri == CN_NORMAL);
return (cn_tab->cn_pri == CN_INTERNAL || cn_tab->cn_pri == CN_NORMAL);
}
#endif /* RCONS_BRAINDAMAGE */
/* Test to see if active serial console on this unit. */
#define CONSOLE_ON_UNIT(unit) \
(major(cn_tab->cn_dev) == DCDEV && SCCUNIT(cn_tab->cn_dev) == (unit))
/* XXX move back into dc_consinit when debugged */
@ -320,23 +327,28 @@ dcattach(sc, addr, dtr_mask, rtscts_mask, speed,
* Special handling for consoles.
*/
if (sc->sc_dv.dv_unit == 0) {
if (raster_console()) {
if (major(cn_tab->cn_dev) == DCDEV) {
/* set params for serial console */
s = spltty();
dc_consinit(cn_tab->cn_dev, dcaddr);
dcaddr->dc_csr |= (CSR_MSE | CSR_TIE | CSR_RIE);
splx(s);
}
if ( 1 /*raster_console()*/) {
s = spltty();
dcaddr->dc_lpr = LPR_RXENAB | LPR_8_BIT_CHAR |
LPR_B4800 | DCKBD_PORT;
wbflush();
DELAY(10000);
KBDReset(makedev(DCDEV, DCKBD_PORT), dcPutc);
DELAY(10000);
dcaddr->dc_lpr = LPR_RXENAB | LPR_B4800 | LPR_OPAR |
LPR_PARENB | LPR_8_BIT_CHAR | DCMOUSE_PORT;
wbflush();
DELAY(1000);
KBDReset(makedev(DCDEV, DCKBD_PORT), dcPutc);
DELAY(10000);
/*XXX*/printf("reset mouse\n");
MouseInit(makedev(DCDEV, DCMOUSE_PORT), dcPutc, dcGetc);
splx(s);
}
else if (major(cn_tab->cn_dev) == DCDEV) {
s = spltty();
dc_consinit(cn_tab->cn_dev, dcaddr);
dcaddr->dc_csr |= (CSR_MSE | CSR_TIE | CSR_RIE);
/*XXX*/printf("done\n");
splx(s);
}
}
@ -378,7 +390,6 @@ dcopen(dev, flag, mode, p)
register struct dc_softc *sc;
register int unit, line;
int s, error = 0;
int firstopen = 0;
unit = DCUNIT(dev);
line = DCLINE(dev);
@ -399,7 +410,6 @@ dcopen(dev, flag, mode, p)
tp->t_dev = dev;
if ((tp->t_state & TS_ISOPEN) == 0 && tp->t_wopen == 0) {
ttychars(tp);
firstopen = 1;
#ifndef PORTSELECTOR
if (tp->t_ispeed == 0) {
#endif
@ -440,7 +450,7 @@ dcopen(dev, flag, mode, p)
return (error);
error = (*linesw[tp->t_line].l_open)(dev, tp);
#if NRASTERCONSOLE > 0
#if NRASTERCONSOLE > 0 && RCONS_BRAINDAMAGE
/*
* Handle console cases specially.
*/
@ -449,7 +459,7 @@ dcopen(dev, flag, mode, p)
extern struct tty *fbconstty;
tp->t_winsize = fbconstty->t_winsize;
}
#endif /* NRASTERCONSOLE */
#endif /* NRASTERCONSOLE && RCONS_BRAINDAMAGE */
return (error);
}
@ -652,7 +662,7 @@ cold_dcparam(tp, t, dcaddr, allow_19200)
/*
* Handle console cases specially.
*/
if (raster_console()) {
if (/*XXX*/ 1) { /* XXX jrs */
if (unit == DCKBD_PORT) {
lpr = LPR_RXENAB | LPR_8_BIT_CHAR |
LPR_B4800 | DCKBD_PORT;
@ -737,7 +747,7 @@ dcrint(sc)
overrun = 1;
}
/* the keyboard requires special translation */
if (raster_console() && tp == dc_tty[DCKBD_PORT]) {
if (tp == dc_tty[DCKBD_PORT]) {
if (cc == LK_DO) {
#ifdef DDB
spl0();
@ -755,6 +765,8 @@ dcrint(sc)
}
if ((cc = kbdMapChar(cc)) < 0)
return;
rcons_input(0, cc);
return;
} else if (tp == dc_tty[DCMOUSE_PORT] && dcMouseButtons) {
mouseInput(cc);
return;
@ -883,7 +895,10 @@ dcstart(tp)
}
if (tp->t_outq.c_cc == 0)
goto out;
#ifdef RCONS_BRAINDAMAGE
/* handle console specially */
/* XXX raster console output via serial port! */
if (raster_console() && tp == sc->dc_tty[DCKBD_PORT]) {
while (tp->t_outq.c_cc > 0) {
cc = getc(&tp->t_outq) & 0x7f;
@ -902,6 +917,8 @@ dcstart(tp)
}
goto out;
}
#endif /* RCONS_BRAINDAMAGE */
cc = ndqb(&tp->t_outq, 0);
if (cc == 0)
goto out;

View File

@ -1,4 +1,4 @@
/* $NetBSD: dtop.c,v 1.32 1998/03/22 09:27:07 jonathan Exp $ */
/* $NetBSD: dtop.c,v 1.33 1998/03/24 00:23:55 jonathan Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -94,7 +94,7 @@ SOFTWARE.
********************************************************/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dtop.c,v 1.32 1998/03/22 09:27:07 jonathan Exp $");
__KERNEL_RCSID(0, "$NetBSD: dtop.c,v 1.33 1998/03/24 00:23:55 jonathan Exp $");
#include "rasterconsole.h"
@ -124,6 +124,7 @@ __KERNEL_RCSID(0, "$NetBSD: dtop.c,v 1.32 1998/03/22 09:27:07 jonathan Exp $");
#include <machine/fbio.h>
#include <machine/fbvar.h>
#include <pmax/dev/fbreg.h>
#include <pmax/dev/rconsvar.h>
#include <pmax/pmax/asic.h>
#include <pmax/pmax/maxine.h>
@ -186,8 +187,6 @@ int dtop_keyboard_handler __P((dtop_device_t, dtop_message_t, int, int));
int dtopparam __P((struct tty *, struct termios *));
void dtopstart __P((struct tty *));
/*
* lk201 keyboard divisions and up/down mode key bitmap.
*/
@ -322,7 +321,7 @@ dtopopen(dev, flag, mode, p)
return (error);
error = (*linesw[tp->t_line].l_open)(dev, tp);
#if NRASTERCONSOLE > 0
#if (RASTERCONSOLE > 0) && defined(RCONS_BRAINDAMAGE)
/* handle raster console specially */
if (tp == DTOP_TTY(0) && firstopen) {
extern struct tty *fbconstty;
@ -430,10 +429,13 @@ dtopintr(sc)
dtop_message msg;
int devno;
dtop_softc_t dtop;
int s;
dtop = sc;
s = spltty();
if (dtop_get_packet(dtop, &msg) < 0) {
#ifdef DIAGNOSTIC
#if defined(DIAGNOSTIC) || defined (DEBUG) || defined(RCONS_DEBUG)
printf("dtop: overrun (or stray)\n");
#endif
/*
@ -451,15 +453,17 @@ dtopintr(sc)
* If not probed yet, just throw the data away.
*/
if (!dtop->probed_once)
return 0;
goto out;
devno = DTOP_DEVICE_NO(msg.src_address);
if (devno < 0 || devno > 15)
return (0);
goto out;
(void) (*dtop->device[devno].handler)
(&dtop->device[devno].status, &msg,
DTOP_EVENT_RECEIVE_PACKET, 0);
out:
splx(s);
return(0);
}
@ -467,7 +471,6 @@ void
dtopstart(tp)
register struct tty *tp;
{
register int cc;
int s;
s = spltty();
@ -482,8 +485,11 @@ dtopstart(tp)
}
if (tp->t_outq.c_cc == 0)
goto out;
#ifdef RCONS_BRAINDAMAGE
/* handle console specially */
if (tp == DTOP_TTY(0)) {
register int cc;
while (tp->t_outq.c_cc > 0) {
cc = getc(&tp->t_outq) & 0x7f;
cnputc(cc);
@ -500,6 +506,8 @@ dtopstart(tp)
selwakeup(&tp->t_wsel);
}
}
#endif /* RCONS_BRAINDAMAGE */
out:
splx(s);
}
@ -799,7 +807,9 @@ dtop_keyboard_handler(dev, msg, event, outc)
register u_char *ls, *le, *ns, *ne;
u_char save[11], retc;
int msg_len, c, s;
#ifdef RCONS_BRAINDAMAGE
struct tty *tp = DTOP_TTY(0);
#endif
/*
* Fiddle about emulating an lk201 keyboard. The lk501
@ -899,8 +909,12 @@ dtop_keyboard_handler(dev, msg, event, outc)
if (dtopDivertXInput) {
(*dtopDivertXInput)(*ns);
c = -1; /* consumed by X */
} else if (c >= 0 && tp != NULL)
} else if (c >= 0 /*&& tp != NULL*/)
#if 0
(*linesw[tp->t_line].l_rint)(c, tp);
#else
rcons_input(0, c);
#endif
dev->keyboard.k_ar_state = K_AR_ACTIVE;
}
/* return the related keycode anyways */
@ -928,7 +942,10 @@ dtop_keyboard_repeat(arg)
{
dtop_device_t dev = (dtop_device_t)arg;
register int i, c;
#if 0
struct tty *tp = DTOP_TTY(0);
#endif
int s = spltty(), gotone = 0;
for (i = 0; i < dev->keyboard.last_codes_count; i++) {
@ -943,7 +960,11 @@ dtop_keyboard_repeat(arg)
}
if ((c = kbdMapChar(KEY_REPEAT)) >= 0) {
#if 0
(*linesw[tp->t_line].l_rint)(c, tp);
#else
rcons_input(0, c);
#endif
gotone = 1;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lk201.c,v 1.8 1998/03/22 09:27:07 jonathan Exp $ */
/* $NetBSD: lk201.c,v 1.9 1998/03/24 00:23:55 jonathan Exp $ */
/*
* The LK201 keycode mapping routine is here, along with initialization
@ -366,6 +366,10 @@ MouseInit(mdev, putc, getc)
*/
(*putc)(mdev, MOUSE_SELF_TEST);
id_byte1 = (*getc)(mdev);
if (id_byte1 == MOUSE_SELF_TEST) {
printf("MouseInit: mouse loopback connector.\n");
return;
}
if (id_byte1 < 0) {
printf("MouseInit: Timeout on 1st byte of self-test report\n");
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: promio.c,v 1.20 1997/10/19 10:25:52 jonathan Exp $ */
/* $NetBSD: promio.c,v 1.21 1998/03/24 00:23:56 jonathan Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: promio.c,v 1.20 1997/10/19 10:25:52 jonathan Exp $");
__KERNEL_RCSID(0, "$NetBSD: promio.c,v 1.21 1998/03/24 00:23:56 jonathan Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -65,6 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: promio.c,v 1.20 1997/10/19 10:25:52 jonathan Exp $")
#include <pmax/pmax/asic.h>
#include <pmax/pmax/turbochannel.h>
#include <pmax/pmax/pmaxtype.h>
#include <pmax/dev/rconsvar.h>
#include <machine/pmioctl.h>
@ -134,9 +135,6 @@ extern int pmax_boardtype; /* Mother board type */
* keyboard, a serial port, or the "virtual" console.
*/
extern struct consdev *cn_tab; /* Console I/O table... */
extern void rcons_vputc __P((dev_t, int)); /* XXX */
struct consdev cd = {
(void (*)(struct consdev *))0, /* probe */
(void (*)(struct consdev *))0, /* init */
@ -240,6 +238,7 @@ consinit()
cd.cn_dev = makedev(DCDEV, DCKBD_PORT);
cd.cn_getc = LKgetc;
lk_divert(dcGetc, makedev(DCDEV, DCKBD_PORT));
cd.cn_dev = makedev(RCONSDEV, 0);
cd.cn_putc = rcons_vputc; /*XXX*/
return;
}
@ -249,7 +248,7 @@ consinit()
case DS_MAXINE:
#if NDTOP > 0
if (kbd == 3) {
cd.cn_dev = makedev(DTOPDEV, 0);
cd.cn_dev = makedev(RCONSDEV, 0);
cd.cn_getc = dtopKBDGetc;
} else
#endif /* NDTOP */
@ -287,6 +286,10 @@ consinit()
goto remcons;
break;
/*
* No configured baseboard video found, or
* no configured baseboard keyboard found. Fallback to serial.
*/
default:
goto remcons;
};
@ -297,12 +300,13 @@ consinit()
*/
#if NTC>0
if (tc_findconsole(crt)) {
cd.cn_pri = CN_NORMAL;
#ifdef RCONS_HACK
/* FIXME */ cd.cn_putc = v_putc;
cd.cn_dev = makedev (RCONSDEV, 0);
#endif /* RCONS_HACK */
cd.cn_putc = rcons_vputc; /*XXX*/
/*
* send console output to rcons output, with
* input from cn_dev as computed above.
*/
rcons_indev(&cd);
return;
} else
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: rcons.c,v 1.14 1996/10/13 13:14:00 jonathan Exp $ */
/* $NetBSD: rcons.c,v 1.15 1998/03/24 00:23:56 jonathan Exp $ */
/*
* Copyright (c) 1995
@ -64,6 +64,7 @@
#include <pmax/pmax/asic.h>
#include <pmax/pmax/turbochannel.h>
#include <pmax/pmax/pmaxtype.h>
#include <pmax/dev/rconsvar.h>
#include <dev/cons.h>
#include <sys/device.h>
@ -76,6 +77,7 @@
#include <machine/pmioctl.h>
#include <pmax/dev/fbreg.h>
#define RCONSDEV 85
/*
@ -99,10 +101,12 @@ void rcons_vputc __P ((dev_t dev, int c));
void rconsreset __P((struct tty *tp, int rw));
void rconsstrategy __P((struct buf *bp));
void rcons_input __P((dev_t dev, int ic));
void rconsstart __P((struct tty *));
#ifdef notyet
void rconsstart __P((struct tty *));
static void rcons_later __P((void*));
#endif
void nobell __P ((int));
@ -194,6 +198,26 @@ rcons_vputc(dev, c)
rcons_cnputc(c);
}
/*
* Set up the console device to take input from `dev'
* and send output via rcons.
*/
void
rcons_indev(cn)
struct consdev *cn;
{
register int s;
s = spltty();
/* Send any subsequent console calls to this cn_tab to rcons. */
cn->cn_dev = makedev (RCONSDEV, 0);
/* fixup for signature mismatch. */
cn->cn_putc = rcons_vputc;
splx(s);
}
/*
* Pseudo-device attach routine. rcons doesn't need to be a pseudo
* device, and isn't on a sparc; this is a useful point to set up
@ -376,15 +400,12 @@ rconsmmap (dev, off, prot)
return 0;
}
void
rconsstrategy(bp)
struct buf *bp;
{
}
/* Called by real input device when there is input for rcons. Passes
input through line discpline interrupt routine... */
/*
* Our "interrupt" routine for input.
* Called by the keyboard device driver at spltty when it has
* input for rcons.
*/
void
rcons_input (dev, ic)
dev_t dev;
@ -392,6 +413,11 @@ rcons_input (dev, ic)
{
struct tty *tp;
int unit = minor (dev);
#ifdef RCONS_DEBUG
printf("rcons_input: unit %d gives %c on \n", unit, ic);
#endif
if (unit > NRASTERCONSOLE)
return;
tp = &rcons_tty [unit];

View File

@ -0,0 +1,11 @@
#ifndef _MACHINE_RCONS_H_
#define _MACHINE_RCONS_H_
#ifdef _KERNEL
struct consdev;
extern void rcons_indev __P((struct consdev *));
extern void rcons_vputc __P((dev_t, int)); /* XXX */
extern void rcons_input __P((dev_t, int ic)); /*XXX*/
#endif /* _KERNEL */
#endif /* _MACHINE_RCONS_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu_cons.c,v 1.20 1997/10/19 10:25:52 jonathan Exp $ */
/* $NetBSD: cpu_cons.c,v 1.21 1998/03/24 00:23:56 jonathan Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: cpu_cons.c,v 1.20 1997/10/19 10:25:52 jonathan Exp $");
__KERNEL_RCSID(0, "$NetBSD: cpu_cons.c,v 1.21 1998/03/24 00:23:56 jonathan Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -65,6 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_cons.c,v 1.20 1997/10/19 10:25:52 jonathan Exp $
#include <pmax/pmax/asic.h>
#include <pmax/pmax/turbochannel.h>
#include <pmax/pmax/pmaxtype.h>
#include <pmax/dev/rconsvar.h>
#include <machine/pmioctl.h>
@ -134,9 +135,6 @@ extern int pmax_boardtype; /* Mother board type */
* keyboard, a serial port, or the "virtual" console.
*/
extern struct consdev *cn_tab; /* Console I/O table... */
extern void rcons_vputc __P((dev_t, int)); /* XXX */
struct consdev cd = {
(void (*)(struct consdev *))0, /* probe */
(void (*)(struct consdev *))0, /* init */
@ -240,6 +238,7 @@ consinit()
cd.cn_dev = makedev(DCDEV, DCKBD_PORT);
cd.cn_getc = LKgetc;
lk_divert(dcGetc, makedev(DCDEV, DCKBD_PORT));
cd.cn_dev = makedev(RCONSDEV, 0);
cd.cn_putc = rcons_vputc; /*XXX*/
return;
}
@ -249,7 +248,7 @@ consinit()
case DS_MAXINE:
#if NDTOP > 0
if (kbd == 3) {
cd.cn_dev = makedev(DTOPDEV, 0);
cd.cn_dev = makedev(RCONSDEV, 0);
cd.cn_getc = dtopKBDGetc;
} else
#endif /* NDTOP */
@ -287,6 +286,10 @@ consinit()
goto remcons;
break;
/*
* No configured baseboard video found, or
* no configured baseboard keyboard found. Fallback to serial.
*/
default:
goto remcons;
};
@ -297,12 +300,13 @@ consinit()
*/
#if NTC>0
if (tc_findconsole(crt)) {
cd.cn_pri = CN_NORMAL;
#ifdef RCONS_HACK
/* FIXME */ cd.cn_putc = v_putc;
cd.cn_dev = makedev (RCONSDEV, 0);
#endif /* RCONS_HACK */
cd.cn_putc = rcons_vputc; /*XXX*/
/*
* send console output to rcons output, with
* input from cn_dev as computed above.
*/
rcons_indev(&cd);
return;
} else
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: scc.c,v 1.37 1998/03/22 09:27:07 jonathan Exp $ */
/* $NetBSD: scc.c,v 1.38 1998/03/24 00:23:56 jonathan Exp $ */
/*
* Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: scc.c,v 1.37 1998/03/22 09:27:07 jonathan Exp $");
__KERNEL_RCSID(0, "$NetBSD: scc.c,v 1.38 1998/03/24 00:23:56 jonathan Exp $");
#ifdef alpha
#include "opt_dec_3000_300.h"
@ -114,6 +114,7 @@ __KERNEL_RCSID(0, "$NetBSD: scc.c,v 1.37 1998/03/22 09:27:07 jonathan Exp $");
#include <pmax/pmax/maxine.h>
#include <pmax/pmax/asic.h>
#include <pmax/dev/sccreg.h>
#include <pmax/dev/rconsvar.h>
#include <pmax/tc/sccvar.h> /* XXX */
#endif
@ -172,11 +173,20 @@ extern int pending_remcons;
* more cleanly.
*/
#ifdef RCONS_BRAINDAMAGE
static inline int
raster_console(void)
{
#if 1
return (cn_tab->cn_pri == CN_NORMAL || cn_tab->cn_pri == CN_INTERNAL);
#else
register int israster =
(cn_tab->cn_pri == CN_NORMAL || cn_tab->cn_pri == CN_INTERNAL);
printf("israster: %d\n", israster);
return israster;
#endif
}
#endif
#define SCCUNIT(dev) (minor(dev) >> 1)
@ -285,6 +295,10 @@ static void rr __P((char *, scc_regmap_t *));
static void scc_modem_intr __P((dev_t));
static void sccreset __P((struct scc_softc *));
void scc_kbd_init __P((struct scc_softc *sc, dev_t dev));
void scc_mouse_init __P((struct scc_softc *sc, dev_t dev));
void scc_tty_init __P((struct scc_softc *sc, dev_t dev));
int sccintr __P((void *));
#ifdef alpha
void scc_alphaintr __P((int));
@ -301,7 +315,6 @@ static struct consdev scccons = {
NULL, NULL, sccGetc, sccPutc, sccPollc, NODEV, 0
};
void scc_consinit __P((dev_t dev, scc_regmap_t *sccaddr));
void scc_oconsinit __P((struct scc_softc *sc, dev_t dev));
/*
@ -355,27 +368,6 @@ scc_consinit(dev, sccaddr)
splx(s);
}
void
scc_oconsinit(sc, dev)
struct scc_softc *sc;
dev_t dev;
{
struct termios cterm;
struct tty ctty;
int s;
s = spltty();
ctty.t_dev = dev;
cterm.c_cflag = CS8;
#ifdef pmax
/* XXX -- why on pmax, not on Alpha? */
cterm.c_cflag |= CLOCAL;
#endif
cterm.c_ospeed = cterm.c_ispeed = 9600;
(void) sccparam(&ctty, &cterm);
DELAY(1000);
splx(s);
}
/*
* Test to see if device is present.
@ -464,20 +456,16 @@ sccattach(parent, self, aux)
struct tty *tp;
void *sccaddr;
int cntr;
#if 0
struct termios cterm;
struct tty ctty;
int s;
#endif
extern int cputype;
int unit;
unit = sc->sc_dv.dv_unit;
/* serial console debugging */
#if defined(DEBUG) && defined(HAVE_RCONS) && 0
if (CONSOLE_ON_UNIT(unit) && (cn_tab->cn_pri == CN_REMOTE))
printf("\nattaching scc%d, currently PROM console\n", unit);
#endif /* defined(DEBUG) && defined(HAVE_RCONS)*/
sccaddr = (void*)MIPS_PHYS_TO_KSEG1(d->iada_addr);
#ifdef SPARSE
sccaddr = (void *)TC_DENSE_TO_SPARSE((tc_addr_t)sccaddr);
@ -563,77 +551,41 @@ sccattach(parent, self, aux)
#ifdef notyet
scc_consinit(cn_tab->cn_dev, sccaddr);
#else
scc_oconsinit(sc, cn_tab->cn_dev);
scc_tty_init(sc, cn_tab->cn_dev);
#endif
printf(" (In sccattach: cn_dev = 0x%x)", cn_tab->cn_dev);
printf(" (Unit = %d)", unit);
printf(": console\n");
printf(": console");
pending_remcons = 0;
/*
* XXX We should support configurations where the PROM
* console device is a serial console, and a
* framebuffer, keyboard, and mouse are present.
*/
#ifdef BREAKS_X_WITH_REMOTE_CONSOLE
return;
}
#endif /* pmax */
#ifdef HAVE_RCONS
if ((cn_tab->cn_getc == LKgetc)) {
/* XXX test below may be too inclusive ? */
/*(1)*/ /*(CONSOLE_ON_UNIT(unit))*/
if (major(cn_tab->cn_dev) == SCCDEV) {
if (unit == 1) {
s = spltty();
ctty.t_dev = makedev(SCCDEV, SCCKBD_PORT);
cterm.c_cflag = CS8;
#ifdef pmax
/* XXX -- why on pmax, not on Alpha? */
cterm.c_cflag |= CLOCAL;
#endif /* pmax */
cterm.c_ospeed = cterm.c_ispeed = 4800;
(void) sccparam(&ctty, &cterm);
DELAY(10000);
#ifdef notyet
/*
* For some reason doing this hangs the 3min
* during booting. Fortunately the keyboard
* works ok without it.
*/
KBDReset(ctty.t_dev, sccPutc);
#endif /* notyet */
DELAY(10000);
splx(s);
} else if (unit == 0) {
s = spltty();
ctty.t_dev = makedev(SCCDEV, SCCMOUSE_PORT);
cterm.c_cflag = CS8 | PARENB | PARODD;
cterm.c_ospeed = cterm.c_ispeed = 4800;
(void) sccparam(&ctty, &cterm);
#ifdef HAVE_RCONS
DELAY(10000);
MouseInit(ctty.t_dev, sccPutc, sccGetc);
DELAY(10000);
#endif
splx(s);
}
}
} else
#endif /* HAVE_RCONS */
if (SCCUNIT(cn_tab->cn_dev) == unit)
{
#ifdef alpha
s = spltty();
ctty.t_dev = makedev(SCCDEV,
sc->sc_dv.dv_unit == 0 ? SCCCOMM2_PORT : SCCCOMM3_PORT);
cterm.c_cflag = (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8;
cterm.c_ospeed = cterm.c_ispeed = 9600;
(void) sccparam(&ctty, &cterm);
DELAY(1000);
#endif /* alpha */
}
#endif /* pmax */
#ifdef HAVE_RCONS
/* XXX test below may be too inclusive ? */
if (cputype != DS_MAXINE) {
if (unit == 1) {
scc_kbd_init(sc, makedev(SCCDEV, SCCKBD_PORT));
} else if (unit == 0) {
scc_mouse_init(sc, makedev(SCCDEV, SCCMOUSE_PORT));
}
}
#endif /* HAVE_RCONS */
#ifdef alpha
if (SCCUNIT(cn_tab->cn_dev) == unit) {
scc_tty_init(sc,
makedev(SCCDEV, (sc->sc_dv.dv_unit == 0 ?
SCCCOMM2_PORT : SCCCOMM3_PORT)));
}
/*
* XXX
* Unit 1 is the remote console, wire it up now.
@ -649,9 +601,89 @@ sccattach(parent, self, aux)
sc->scc_softCAR |= SCCLINE(cn_tab->cn_dev);
} else
printf("\n");
#else /* !alpha */
#else /* pmax */
printf("\n");
#endif /* !alpha */
#endif /* pmax */
}
/*
* Initialize line parameters for a serial console.
*/
void
scc_tty_init(sc, dev)
struct scc_softc *sc;
dev_t dev;
{
struct termios cterm;
struct tty ctty;
int s;
s = spltty();
ctty.t_dev = dev;
cterm.c_cflag = (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8;
#ifdef pmax
/* XXX -- why on pmax, not on Alpha? */
cterm.c_cflag |= CLOCAL;
#endif
cterm.c_ospeed = cterm.c_ispeed = 9600;
(void) sccparam(&ctty, &cterm);
DELAY(1000);
splx(s);
}
void
scc_kbd_init(sc, dev)
struct scc_softc *sc;
dev_t dev;
{
struct termios cterm;
struct tty ctty;
int s;
s = spltty();
ctty.t_dev = dev;
cterm.c_cflag = CS8;
#ifdef pmax
/* XXX -- why on pmax, not on Alpha? */
cterm.c_cflag |= CLOCAL;
#endif /* pmax */
cterm.c_ospeed = cterm.c_ispeed = 4800;
(void) sccparam(&ctty, &cterm);
DELAY(10000);
#ifdef notyet
/*
* For some reason doing this hangs the 3min
* during booting. Fortunately the keyboard
* works ok without it.
*/
KBDReset(ctty.t_dev, sccPutc);
#endif /* notyet */
DELAY(10000);
splx(s);
}
void
scc_mouse_init(sc, dev)
struct scc_softc *sc;
dev_t dev;
{
struct termios cterm;
struct tty ctty;
int s;
s = spltty();
ctty.t_dev = dev;
cterm.c_cflag = CS8 | PARENB | PARODD;
cterm.c_ospeed = cterm.c_ispeed = 4800;
(void) sccparam(&ctty, &cterm);
#ifdef HAVE_RCONS
DELAY(10000);
MouseInit(ctty.t_dev, sccPutc, sccGetc);
DELAY(10000);
#endif
splx(s);
}
@ -738,7 +770,6 @@ sccopen(dev, flag, mode, p)
register struct tty *tp;
register int unit, line;
int s, error = 0;
int firstopen = 0;
unit = SCCUNIT(dev);
if (unit >= scc_cd.cd_ndevs)
@ -760,7 +791,6 @@ sccopen(dev, flag, mode, p)
tp->t_dev = dev;
if ((tp->t_state & TS_ISOPEN) == 0 && tp->t_wopen == 0) {
ttychars(tp);
firstopen = 1;
#ifndef PORTSELECTOR
if (tp->t_ispeed == 0) {
#endif
@ -794,14 +824,15 @@ sccopen(dev, flag, mode, p)
return (error);
error = (*linesw[tp->t_line].l_open)(dev, tp);
#ifdef HAVE_RCONS
#if defined(HAVE_RCONS) && defined(RCONS_BRAINDAMAGE)
/* handle raster console specially */
if (tp == scctty(makedev(SCCDEV,SCCKBD_PORT)) &&
raster_console() && firstopen) {
extern struct tty *fbconstty;
tp->t_winsize = fbconstty->t_winsize;
}
#endif /* HAVE_RCONS */
#endif /* old rcons brain-damage */
return (error);
}
@ -1008,7 +1039,7 @@ cold_sccparam(tp, t, sc)
/*
* pmax driver used to reset the SCC here. That reset causes the
* other channel on the SCC to drop outpur chars: at least that's
* other channel on the SCC to drop output chars: at least that's
* what CGD reports for the Alpha. It's a bug.
*/
#if 0
@ -1206,7 +1237,7 @@ sccintr(xxxsc)
/*
* Keyboard needs special treatment.
*/
if (tp == scctty(makedev(SCCDEV, SCCKBD_PORT)) && raster_console()) {
if (tp == scctty(makedev(SCCDEV, SCCKBD_PORT))) {
#if defined(DDB) && defined(LK_DO)
if (cc == LK_DO) {
spl0();
@ -1225,6 +1256,7 @@ sccintr(xxxsc)
#ifdef HAVE_RCONS
if ((cc = kbdMapChar(cc)) < 0)
continue;
rcons_input(0, cc);
#endif
/*
* Now for mousey
@ -1287,7 +1319,10 @@ sccstart(tp)
}
if (tp->t_outq.c_cc == 0)
goto out;
#ifdef RCONS_BRAINDAMAGE
/* handle console specially */
/* XXX raster console output via serial port! */
if (tp == scctty(makedev(SCCDEV,SCCKBD_PORT)) && raster_console()) {
while (tp->t_outq.c_cc > 0) {
cc = getc(&tp->t_outq) & 0x7f;
@ -1306,6 +1341,7 @@ sccstart(tp)
}
goto out;
}
#endif
cc = ndqb(&tp->t_outq, 0);
tp->t_state |= TS_BUSY;
@ -1469,8 +1505,8 @@ scc_modem_intr(dev)
* On pmax, ignore hups on a console tty.
* On alpha, a no-op, for historical reasons. XXXXXX
*/
#ifndef alpha
if (!CONSOLE_ON_UNIT(sc->sc_dv.dv_unit)) {
#ifdef pmax
if (!CONSOLE_ON_UNIT(sc->sc_dv.dv_unit) && !pending_remcons) {
if (car) {
/* carrier present */
if (!(tp->t_state & TS_CARR_ON))
@ -1478,7 +1514,7 @@ scc_modem_intr(dev)
} else if (tp->t_state & TS_CARR_ON)
(void)(*linesw[tp->t_line].l_modem)(tp, 0);
}
#endif /* !alpha */
#endif /* pmax */
splx(s);
}