Make the ARCS console work again, by initializing the dev_t on arcbios init

rather than in the open entry point (where it's too late for cnopen).  Being
checked in from my Indy using the ARCS console on the graphics display.
This commit is contained in:
rafal 2001-09-08 01:39:11 +00:00
parent 7baf597ac1
commit ece8acc29b
2 changed files with 15 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: arcbios.c,v 1.3 2001/07/08 23:57:09 thorpej Exp $ */
/* $NetBSD: arcbios.c,v 1.4 2001/09/08 01:39:11 rafal Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -38,7 +38,9 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <dev/cons.h>
#include <sys/conf.h>
#include <dev/arcbios/arcbios.h>
#include <dev/arcbios/arcbiosvar.h>
@ -62,6 +64,8 @@ struct consdev arcbios_cn = {
NODEV, CN_NORMAL,
};
cdev_decl(arcbios_tty);
/*
* arcbios_init:
*
@ -70,6 +74,7 @@ struct consdev arcbios_cn = {
int
arcbios_init(vaddr_t pblkva)
{
int maj;
struct arcbios_sysid *sid;
ARCBIOS_SPB = (struct arcbios_spb *) pblkva;
@ -88,6 +93,13 @@ arcbios_init(vaddr_t pblkva)
/* Initialize our pointer to the firmware vector. */
ARCBIOS = ARCBIOS_SPB->FirmwareVector;
/* Find the ARC BIOS console device major (needed by cnopen) */
for (maj = 0; maj < nchrdev; maj++)
if (cdevsw[maj].d_open == arcbios_ttyopen)
break;
arcbios_cn.cn_dev = makedev(maj, 0);
/* Initialize the bootstrap console. */
cn_tab = &arcbios_cn;

View File

@ -1,4 +1,4 @@
/* $NetBSD: arcbios_tty.c,v 1.1 2001/07/08 19:58:03 thorpej Exp $ */
/* $NetBSD: arcbios_tty.c,v 1.2 2001/09/08 01:39:12 rafal Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -47,8 +47,6 @@ struct callout arcbios_tty_ch = CALLOUT_INITIALIZER;
static struct tty *arcbios_tty[1];
extern struct consdev arcbios_cn;
void arcbios_tty_start(struct tty *);
void arcbios_tty_poll(void *);
int arcbios_tty_param(struct tty *, struct termios *);
@ -60,7 +58,7 @@ arcbios_ttyopen(dev_t dev, int flag, int mode, struct proc *p)
{
int unit = minor(dev);
struct tty *tp;
int s, maj, error = 0, setuptimeout = 0;
int s, error = 0, setuptimeout = 0;
if (unit != 0)
return (ENODEV);
@ -87,14 +85,6 @@ arcbios_ttyopen(dev_t dev, int flag, int mode, struct proc *p)
ttsetwater(tp);
setuptimeout = 1;
/*
* Initialize the ARC BIOS console device major.
*/
for (maj = 0; maj < nchrdev; maj++)
if (cdevsw[maj].d_open == arcbios_ttyopen)
break;
arcbios_cn.cn_dev = makedev(maj, 0);
} else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) {
splx(s);
return (EBUSY);