use a flag in the softc to indicate if an instance has been configured,
rather than a bit in 32-bit global variable indexed by unit number.
This commit is contained in:
parent
d42decb9db
commit
8f2820b4a6
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ite.c,v 1.67 2004/02/24 15:05:54 wiz Exp $ */
|
||||
/* $NetBSD: ite.c,v 1.68 2005/01/19 02:08:40 chs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -83,7 +83,7 @@
|
||||
#include "opt_ddb.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.67 2004/02/24 15:05:54 wiz Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.68 2005/01/19 02:08:40 chs Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -131,8 +131,6 @@ __KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.67 2004/02/24 15:05:54 wiz Exp $");
|
||||
#define SUBR_SCROLL(ip,sy,sx,count,dir) \
|
||||
(ip)->grf->g_itescroll(ip,sy,sx,count,dir)
|
||||
|
||||
u_int ite_confunits; /* configured units */
|
||||
|
||||
int start_repeat_timeo = 30; /* first repeat after x s/100 */
|
||||
int next_repeat_timeo = 10; /* next repeat after x s/100 */
|
||||
|
||||
@ -211,12 +209,7 @@ itematch(struct device *pdp, struct cfdata *cfp, void *auxp)
|
||||
int maj;
|
||||
|
||||
gp = auxp;
|
||||
/*
|
||||
* all that our mask allows (more than enough no one
|
||||
* has > 32 monitors for text consoles on one machine)
|
||||
*/
|
||||
if (cfp->cf_unit >= sizeof(ite_confunits) * NBBY)
|
||||
return(0);
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* normally this would be done in attach, however
|
||||
@ -236,12 +229,6 @@ iteattach(struct device *pdp, struct device *dp, void *auxp)
|
||||
int s;
|
||||
|
||||
gp = (struct grf_softc *)auxp;
|
||||
|
||||
/*
|
||||
* mark unit as attached (XXX see itematch)
|
||||
*/
|
||||
ite_confunits |= 1 << ITEUNIT(gp->g_itedev);
|
||||
|
||||
if (dp) {
|
||||
ip = (struct ite_softc *)dp;
|
||||
|
||||
@ -271,6 +258,7 @@ iteattach(struct device *pdp, struct device *dp, void *auxp)
|
||||
if (kbd_ite == ip)
|
||||
printf(" has keyboard");
|
||||
printf("\n");
|
||||
ip->flags |= ITE_ATTACHED;
|
||||
} else {
|
||||
if (con_itesoftc.grf != NULL &&
|
||||
con_itesoftc.grf->g_conpri > gp->g_conpri)
|
||||
@ -408,7 +396,7 @@ itecnputc(dev_t dev, int c)
|
||||
|
||||
if (panicstr && !paniced &&
|
||||
(ip->flags & (ITE_ACTIVE | ITE_INGRF)) != ITE_ACTIVE) {
|
||||
(void)ite_on(dev, 3);
|
||||
ite_on(dev, 3);
|
||||
paniced = 1;
|
||||
}
|
||||
iteputchar(ch, ip);
|
||||
@ -462,10 +450,11 @@ iteopen(dev_t dev, int mode, int devtype, struct proc *p)
|
||||
unit = ITEUNIT(dev);
|
||||
first = 0;
|
||||
|
||||
if (((1 << unit) & ite_confunits) == 0)
|
||||
return (ENXIO);
|
||||
|
||||
if (unit >= ite_cd.cd_ndevs)
|
||||
return ENXIO;
|
||||
ip = getitesp(dev);
|
||||
if ((ip->flags & ITE_ATTACHED) == 0)
|
||||
return ENXIO;
|
||||
|
||||
if (ip->tp == NULL) {
|
||||
tp = ip->tp = ttymalloc();
|
||||
@ -476,9 +465,7 @@ iteopen(dev_t dev, int mode, int devtype, struct proc *p)
|
||||
&& p->p_ucred->cr_uid != 0)
|
||||
return (EBUSY);
|
||||
if ((ip->flags & ITE_ACTIVE) == 0) {
|
||||
error = ite_on(dev, 0);
|
||||
if (error)
|
||||
return (error);
|
||||
ite_on(dev, 0);
|
||||
first = 1;
|
||||
}
|
||||
tp->t_oproc = itestart;
|
||||
@ -682,16 +669,13 @@ itestart(struct tty *tp)
|
||||
splx(s);
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
ite_on(dev_t dev, int flag)
|
||||
{
|
||||
struct ite_softc *ip;
|
||||
int unit;
|
||||
|
||||
unit = ITEUNIT(dev);
|
||||
if (((1 << unit) & ite_confunits) == 0)
|
||||
return (ENXIO);
|
||||
|
||||
ip = getitesp(dev);
|
||||
|
||||
/* force ite active, overriding graphics mode */
|
||||
@ -703,13 +687,12 @@ ite_on(dev_t dev, int flag)
|
||||
if (flag & 2) {
|
||||
ip->flags &= ~ITE_INGRF;
|
||||
if ((ip->flags & ITE_ACTIVE) == 0)
|
||||
return (0);
|
||||
return;
|
||||
}
|
||||
ip->flags |= ITE_ACTIVE;
|
||||
if (ip->flags & ITE_INGRF)
|
||||
return (0);
|
||||
return;
|
||||
iteinit(dev);
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: itevar.h,v 1.16 2002/09/06 13:18:43 gehenna Exp $ */
|
||||
/* $NetBSD: itevar.h,v 1.17 2005/01/19 02:08:40 chs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christian E. Hopps
|
||||
@ -109,6 +109,7 @@ enum ite_flags {
|
||||
ITE_ISOPEN = 0x8, /* ite has been opened */
|
||||
ITE_INGRF = 0x10, /* ite is in graphics mode */
|
||||
ITE_ACTIVE = 0x20, /* ite is an active terminal */
|
||||
ITE_ATTACHED = 0x40, /* ite is attached */
|
||||
};
|
||||
|
||||
enum ite_replrules {
|
||||
@ -200,7 +201,7 @@ void iteinit(dev_t);
|
||||
void itestart(struct tty *);
|
||||
|
||||
/* ite functions */
|
||||
int ite_on(dev_t, int);
|
||||
void ite_on(dev_t, int);
|
||||
void ite_off(dev_t, int);
|
||||
void ite_reinit(dev_t);
|
||||
int ite_param(struct tty *, struct termios *);
|
||||
|
Loading…
Reference in New Issue
Block a user