Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/atari/dev use a flag in the softc to indicate if an...
details: https://anonhg.NetBSD.org/src/rev/b675489ad573
branches: trunk
changeset: 573080:b675489ad573
user: chs <chs%NetBSD.org@localhost>
date: Wed Jan 19 02:13:02 2005 +0000
description:
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.
diffstat:
sys/arch/atari/dev/ite.c | 60 +++++++++++++++------------------------------
sys/arch/atari/dev/itevar.h | 5 ++-
2 files changed, 23 insertions(+), 42 deletions(-)
diffs (188 lines):
diff -r 10ff9ff9f674 -r b675489ad573 sys/arch/atari/dev/ite.c
--- a/sys/arch/atari/dev/ite.c Wed Jan 19 02:08:55 2005 +0000
+++ b/sys/arch/atari/dev/ite.c Wed Jan 19 02:13:02 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ite.c,v 1.42 2003/11/01 12:56:32 jdolecek Exp $ */
+/* $NetBSD: ite.c,v 1.43 2005/01/19 02:13:02 chs Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
@@ -81,7 +81,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.42 2003/11/01 12:56:32 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.43 2005/01/19 02:13:02 chs Exp $");
#include "opt_ddb.h"
@@ -122,8 +122,6 @@
#define SUBR_CLEAR(ip,sy,sx,h,w) (ip)->grf->g_iteclear(ip,sy,sx,h,w)
#define SUBR_SCROLL(ip,sy,sx,cnt,dir) (ip)->grf->g_itescroll(ip,sy,sx,cnt,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 */
@@ -214,11 +212,10 @@
struct cfdata *cfp;
void *auxp;
{
- static int nmatches = 0;
/*
- * Handle early console stuff. The first cf_unit number
- * matches the console unit. All other early matches will fail.
+ * Handle early console stuff. The first unit number
+ * is the console unit. All other early matches will fail.
*/
if (atari_realconfig == 0) {
if (cons_ite >= 0)
@@ -226,23 +223,13 @@
cons_ite = cfp->cf_unit;
return 1;
}
-
- /*
- * all that our mask allows (more than enough no one
- * has > 32 monitors for text consoles on one machine)
- */
- if (nmatches >= sizeof(ite_confunits) * NBBY)
- return 0; /* checks STAR */
- if (cfp->cf_unit >= sizeof(ite_confunits) * NBBY)
- return 0; /* refuses ite100 at .... */
- nmatches++;
return 1;
}
void
iteattach(pdp, dp, auxp)
-struct device *pdp, *dp;
-void *auxp;
+ struct device *pdp, *dp;
+ void *auxp;
{
struct grf_softc *gp;
struct ite_softc *ip;
@@ -256,10 +243,7 @@
unit = (dp != NULL) ? ip->device.dv_unit : cons_ite;
gp->g_itedev = makedev(maj, unit);
- if(dp) {
-
- ite_confunits |= 1 << ITEUNIT(gp->g_itedev);
-
+ if (dp) {
s = spltty();
if(con_itesoftc.grf != NULL
&& con_itesoftc.grf->g_unit == gp->g_unit) {
@@ -285,7 +269,8 @@
if (kbd_ite == ip)
printf(" has keyboard");
printf("\n");
- } else {
+ ip->flags |= ITE_ATTACHED;
+ } else {
if (con_itesoftc.grf != NULL &&
con_itesoftc.grf->g_conpri > gp->g_conpri)
return;
@@ -440,12 +425,13 @@
int error, first, unit;
unit = ITEUNIT(dev);
+ if (unit >= ite_cd.cd_ndevs)
+ return ENXIO;
+
first = 0;
-
- if (((1 << unit) & ite_confunits) == 0)
+ ip = getitesp(dev);
+ if ((ip->flags & ITE_ATTACHED) == 0)
return (ENXIO);
-
- ip = getitesp(dev);
if (ip->tp == NULL) {
tp = ip->tp = ttymalloc();
@@ -706,7 +692,7 @@
} splx(s);
}
-int
+void
ite_on(dev, flag)
dev_t dev;
int flag;
@@ -715,9 +701,6 @@
int unit;
unit = ITEUNIT(dev);
- if (((1 << unit) & ite_confunits) == 0)
- return (ENXIO);
-
ip = getitesp(dev);
/* force ite active, overriding graphics mode */
@@ -729,13 +712,12 @@
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
@@ -764,16 +746,14 @@
struct ite_softc *ip;
extern const struct cdevsw view_cdevsw;
- if(!(ite_confunits & (1 << unit)))
- return; /* Don't try unconfigured units */
ip = getitesp(unit);
- if(!(ip->flags & ITE_INITED))
- return;
+ if ((ip->flags & (ITE_ATTACHED | ITE_INITED)) == 0)
+ return;
/*
* If switching to an active ite, also switch the keyboard.
*/
- if(ip->flags & ITE_ACTIVE)
+ if (ip->flags & ITE_ACTIVE)
kbd_ite = ip;
/*
diff -r 10ff9ff9f674 -r b675489ad573 sys/arch/atari/dev/itevar.h
--- a/sys/arch/atari/dev/itevar.h Wed Jan 19 02:08:55 2005 +0000
+++ b/sys/arch/atari/dev/itevar.h Wed Jan 19 02:13:02 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: itevar.h,v 1.9 2002/09/06 13:18:43 gehenna Exp $ */
+/* $NetBSD: itevar.h,v 1.10 2005/01/19 02:13:02 chs Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman (Atari modifications)
@@ -104,6 +104,7 @@
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 {
@@ -194,7 +195,7 @@
void iteinit __P((dev_t));
/* ite functions */
-int ite_on __P((dev_t, int));
+void ite_on __P((dev_t, int));
void ite_off __P((dev_t, int));
void ite_reinit __P((dev_t));
int ite_param __P((struct tty *, struct termios *));
Home |
Main Index |
Thread Index |
Old Index