* make scc_tty_init() callable when very cold: call scc_coldparam() directly.

Use scc_tty_init() in scc_consinit().  Declare scc_consinit() in sccvar.h.

* Remove last vestige of special-case console handling in sccparam() code.

* Call scc_consinit() from findcons scc_serial() console-setup.
  Dont PROM for scc serial console at all.
This commit is contained in:
jonathan 1998-11-15 11:21:52 +00:00
parent b6111d03f9
commit 03b30a046d
4 changed files with 46 additions and 55 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: findcons.c,v 1.7 1998/05/23 18:21:43 matt Exp $ */ /* $NetBSD: findcons.c,v 1.8 1998/11/15 11:21:52 jonathan Exp $ */
/* /*
* Copyright (c) 1998 Jonathan Stone * Copyright (c) 1998 Jonathan Stone
@ -34,7 +34,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: findcons.c,v 1.7 1998/05/23 18:21:43 matt Exp $$"); __KERNEL_RCSID(0, "$NetBSD: findcons.c,v 1.8 1998/11/15 11:21:52 jonathan Exp $$");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -73,6 +73,13 @@ struct consdev cd;
#include <dev/tc/tcvar.h> /* find TC fraembuffer device. */ #include <dev/tc/tcvar.h> /* find TC fraembuffer device. */
#include <machine/tc_machdep.h>
#include <pmax/pmax/asic.h> /* scc serial console addresses */
#include <pmax/pmax/kn03.h>
#include <pmax/pmax/kmin.h>
#include <pmax/pmax/maxine.h>
#include <machine/pmioctl.h> #include <machine/pmioctl.h>
#include <machine/fbio.h> /* framebuffer decls used below */ #include <machine/fbio.h> /* framebuffer decls used below */
#include <machine/fbvar.h> #include <machine/fbvar.h>
@ -380,6 +387,7 @@ scc_serial(comslot)
{ {
#if NSCC > 0 #if NSCC > 0
int dev; int dev;
void * sccaddr;
/* /*
* On the 3min and 3maxplus, the default serial-console * On the 3min and 3maxplus, the default serial-console
@ -387,16 +395,29 @@ scc_serial(comslot)
* On the MAXINE, there is only serial port, which * On the MAXINE, there is only serial port, which
* configures at the lower address. * configures at the lower address.
*/ */
dev = (systype == DS_MAXINE) ? SCCCOMM2_PORT: SCCCOMM3_PORT; switch (systype) {
case DS_MAXINE:
dev = SCCCOMM2_PORT;
sccaddr = (void*)(TC_KV(XINE_SYS_ASIC) + IOASIC_SLOT_4_START);
break;
case DS_3MIN:
dev = SCCCOMM3_PORT;
sccaddr = (void*)(TC_KV(KMIN_SYS_ASIC) + IOASIC_SLOT_6_START);
break;
case DS_3MAXPLUS:
dev = SCCCOMM3_PORT;
sccaddr = (void*)(TC_KV(KN03_SYS_ASIC) + IOASIC_SLOT_6_START);
break;
default:
return (0);
}
cd.cn_dev = makedev(SCCDEV, dev); cd.cn_dev = makedev(SCCDEV, dev);
#ifdef notyet /* no boot-time init entrypoint for scc */ scc_consinit(cd.cn_dev, sccaddr);
return scc_consinit(cd.cn_dev); return 1;
#else /* !notyet */
printf("Using PROM serial output until serial drivers initialized.\n");
return(1);
#endif /* notyet */
#endif /* NSCC */ #endif /* NSCC */
return 0; return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sccreg.h,v 1.4 1994/10/26 21:09:17 cgd Exp $ */ /* $NetBSD: sccreg.h,v 1.5 1998/11/15 11:21:52 jonathan Exp $ */
/*- /*-
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -70,7 +70,7 @@
* some registers are used for the other channel, the following macros * some registers are used for the other channel, the following macros
* are used to access the register ports. * are used to access the register ports.
*/ */
typedef struct { typedef struct scc_regmap {
/* Channel B is first, then A */ /* Channel B is first, then A */
struct { struct {
char scc_pad0; char scc_pad0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: scc.c,v 1.43 1998/10/29 21:25:17 jonathan Exp $ */ /* $NetBSD: scc.c,v 1.44 1998/11/15 11:21:53 jonathan Exp $ */
/* /*
* Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University * Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
@ -66,7 +66,7 @@
*/ */
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: scc.c,v 1.43 1998/10/29 21:25:17 jonathan Exp $"); __KERNEL_RCSID(0, "$NetBSD: scc.c,v 1.44 1998/11/15 11:21:53 jonathan Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
@ -162,10 +162,6 @@ extern void ttrstrt __P((void *));
#define CONSOLE_ON_UNIT(unit) \ #define CONSOLE_ON_UNIT(unit) \
(major(cn_tab->cn_dev) == SCCDEV && SCCUNIT(cn_tab->cn_dev) == (unit)) (major(cn_tab->cn_dev) == SCCDEV && SCCUNIT(cn_tab->cn_dev) == (unit))
#ifdef alpha
#define RASTER_CONSOLE() 1 /* Treat test for cn_screen as true */
#endif
/* /*
* Extract unit (scc chip), channel on chip, and dialin/dialout unit. * Extract unit (scc chip), channel on chip, and dialin/dialout unit.
@ -302,7 +298,7 @@ static struct scc_softc coldcons_softc;
static struct consdev scccons = { static struct consdev scccons = {
NULL, NULL, sccGetc, sccPutc, sccPollc, NODEV, 0 NULL, NULL, sccGetc, sccPutc, sccPollc, NODEV, 0
}; };
void scc_consinit __P((dev_t dev, scc_regmap_t *sccaddr)); void scc_consinit __P((dev_t dev, struct scc_regmap *sccaddr));
/* /*
@ -321,9 +317,6 @@ scc_consinit(dev, sccaddr)
scc_regmap_t *sccaddr; scc_regmap_t *sccaddr;
{ {
struct scc_softc *sc; struct scc_softc *sc;
struct termios cterm;
struct tty ctty;
int s;
/* Save address in case we're cold. */ /* Save address in case we're cold. */
if (cold && scc_cons_addr == 0) { if (cold && scc_cons_addr == 0) {
@ -337,23 +330,13 @@ scc_consinit(dev, sccaddr)
} }
/* Reset chip. */ /* Reset chip. */
sccreset(sc);
/* XXX make sure sccreset() called only once for this chip? */ /* XXX make sure sccreset() called only once for this chip? */
sccreset(sc);
/* set console-line parameters */
s = spltty();
ctty.t_dev = dev;
scccons.cn_dev = dev; scccons.cn_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) cold_sccparam(&ctty, &cterm, sc);
*cn_tab = scccons; *cn_tab = scccons;
DELAY(1000); sc->scc_softCAR |= 1 << SCCLINE(cn_tab->cn_dev);
splx(s); scc_tty_init(sc, cn_tab->cn_dev);
} }
@ -524,11 +507,13 @@ sccattach(parent, self, aux)
* and we just reset the chip under the console. * and we just reset the chip under the console.
* Re-wire this unit up as console ASAP. * Re-wire this unit up as console ASAP.
*/ */
#ifdef alpha
cn_tab = &scccons; cn_tab = &scccons;
cn_tab->cn_dev = makedev(SCCDEV, cn_tab->cn_dev = makedev(SCCDEV,
sc->sc_dv.dv_unit == 0 ? SCCCOMM2_PORT : SCCCOMM3_PORT); sc->sc_dv.dv_unit == 0 ? SCCCOMM2_PORT : SCCCOMM3_PORT);
/* Wire carrier for console. */ /* Wire carrier for console. */
#endif
sc->scc_softCAR |= 1 << SCCLINE(cn_tab->cn_dev); sc->scc_softCAR |= 1 << SCCLINE(cn_tab->cn_dev);
scc_tty_init(sc, cn_tab->cn_dev); scc_tty_init(sc, cn_tab->cn_dev);
@ -573,7 +558,8 @@ scc_tty_init(sc, dev)
cterm.c_cflag |= CLOCAL; cterm.c_cflag |= CLOCAL;
#endif #endif
cterm.c_ospeed = cterm.c_ispeed = 9600; cterm.c_ospeed = cterm.c_ispeed = 9600;
(void) sccparam(&ctty, &cterm); /* scc_tty_init() may be called when very cold */
(void) cold_sccparam(&ctty, &cterm, sc);
DELAY(1000); DELAY(1000);
splx(s); splx(s);
} }
@ -973,24 +959,6 @@ cold_sccparam(tp, t, sc)
tp->t_ospeed = t->c_ospeed; tp->t_ospeed = t->c_ospeed;
tp->t_cflag = cflag; tp->t_cflag = cflag;
/*
* Handle console specially.
*/
#ifdef HAVE_RCONS
if (cn_tab->cn_getc == LKgetc) {
if (minor(tp->t_dev) == SCCKBD_PORT) {
cflag = CS8;
ospeed = ttspeedtab(4800, sccspeedtab);
} else if (minor(tp->t_dev) == SCCMOUSE_PORT) {
cflag = CS8 | PARENB | PARODD;
ospeed = ttspeedtab(4800, sccspeedtab);
}
} else if (tp->t_dev == cn_tab->cn_dev)
#endif /*HAVE_RCONS*/
{
cflag = CS8;
ospeed = ttspeedtab(9600, sccspeedtab);
}
if (ospeed == 0) { if (ospeed == 0) {
(void) sccmctl(tp->t_dev, 0, DMSET); /* hang up line */ (void) sccmctl(tp->t_dev, 0, DMSET); /* hang up line */
return (0); return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sccvar.h,v 1.2 1996/05/19 18:24:33 jonathan Exp $ */ /* $NetBSD: sccvar.h,v 1.3 1998/11/15 11:21:53 jonathan Exp $ */
/* /*
* *
@ -6,6 +6,8 @@
extern int sccGetc __P((dev_t)); extern int sccGetc __P((dev_t));
extern void sccPutc __P((dev_t, int)); extern void sccPutc __P((dev_t, int));
extern int sccparam __P((struct tty *, struct termios *)); extern int sccparam __P((struct tty *, struct termios *));
struct scc_regmap;
void scc_consinit __P((dev_t dev, struct scc_regmap *sccaddr));
/* /*
* Minor device numbers for scc. Weird because B channel comes * Minor device numbers for scc. Weird because B channel comes