-# $NetBSD: GENERIC,v 1.8 1995/12/29 17:12:48 thorpej Exp $
+# $NetBSD: GENERIC,v 1.9 1996/02/24 00:54:53 thorpej Exp $
#
# Generic kernel - one size fits all.
#
options USELEDS # make the lights twinkle
options COMPAT_NOLABEL # defaults for unlabeled disks
#options PANICBUTTON # two fast <reset>s on HIL dump kernel
+#options CONSCODE="9" # force console at this select code
#
# HP-UX binary compatibility.
-# $NetBSD: Makefile.hp300,v 1.28 1995/10/22 06:05:21 thorpej Exp $
+# $OpenBSD: Makefile.hp300,v 1.6 1996/04/25 06:36:20 mickey Exp $
+# $NetBSD: Makefile.hp300,v 1.38 1996/03/01 17:03:17 scottr Exp $
-# @(#)Makefile.hp300 8.2 (Berkeley) 1/23/94
-#
# Makefile for NetBSD
#
# This makefile is constructed from a machine description:
# Most changes should be made in the machine description
# /sys/arch/hp300/conf/``machineid''
# after which you should do
-# config machineid
+# config machineid
# Machine generic makefile changes should be made in
# /sys/arch/hp300/conf/Makefile.hp300
# after which config should be rerun for all machines of that type.
# -DTRACE compile in kernel tracing hooks
# -DQUOTA compile in file system quotas
+# DEBUG is set to -g if debugging.
+# PROF is set to -pg if profiling.
-# DEBUG is set to -g by config if debugging is requested (config -g).
-# PROF is set to -pg by config if profiling is requested (config -p).
-AS= as ${DEBUG}
-AWK= awk
-CC= cc ${DEBUG}
-CPP= cpp
-LD= ld
-TOUCH= touch -f -c
+AS?= as
+CC?= cc
+CPP?= cpp
+LD?= ld
+STRIP?= strip -d
+TOUCH?= touch -f -c
# source tree is located via $S relative to the compilation directory
S= ../../../..
HP300= ../..
-INCLUDES= -I. -I$S/arch -I$S -I$S/sys
-COPTS= ${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Dhp300 -DFPCOPROC
-CFLAGS= -O6 -Werror ${COPTS}
+INCLUDES= -I. -I$S/arch -I$S
+CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Dhp300 -DFPCOPROC
+CFLAGS= ${DEBUG} -O2 -Werror -msoft-float
+AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE
+LINKFLAGS= -n -Ttext 0 -e start
### find out what to use for libkern
.include "$S/lib/libkern/Makefile.inc"
# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
# is marked as config-dependent.
-NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
-NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
-
-DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
-DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
+NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
+NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-PROFILE_C= ${CC} -S -c ${COPTS} $<; \
- sed -e s/_mcount/mcount/ -e s/subrmcount/subr_mcount/ <$*.s | \
- ${AS} -o $@; \
- rm -f $*.s
+DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
+DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-NORMAL_S= ${CPP} ${COPTS} $< | ${AS} -o $@
-NORMAL_S_C= ${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
+NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
+NORMAL_S_C= ${CC} ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $<
%OBJS
%CFILES
+#%SFILES
+
# load lines for config "xxx" will be emitted as:
# xxx: ${SYSTEM_DEP} swapxxx.o
# ${SYSTEM_LD_HEAD}
# ${SYSTEM_LD} swapxxx.o
# ${SYSTEM_LD_TAIL}
-SYSTEM_OBJ= locore.o ${FPSP} ${OBJS} param.o ioconf.o \
- ${LIBKERN} ${LIBCOMPAT}
+SYSTEM_OBJ= locore.o ${FPSP} \
+ param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
-SYSTEM_LD_HEAD= rm -f $@
-SYSTEM_LD= -@if [ X${DEBUG} = X-g ]; \
- then strip=-X; \
- else strip=-x; \
- fi; \
- echo ${LD} $$strip -n -T 0 -o $@ -e start '$${SYSTEM_OBJ}' vers.o; \
- ${LD} $$strip -n -T 0 -o $@ -e start ${SYSTEM_OBJ} vers.o
-SYSTEM_LD_TAIL= @size $@; chmod 755 $@; \
- [ X${DEBUG} = X-g ] && { \
+SYSTEM_LD_HEAD= @rm -f $@
+SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
+ ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
+SYSTEM_LD_TAIL= @size $@; chmod 755 $@
+
+DEBUG?=
+.if ${DEBUG} == "-g"
+LINKFLAGS+= -X
+SYSTEM_LD_TAIL+=; \
echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
- echo strip -d $@; strip -d $@; } || true
+ echo ${STRIP} $@; ${STRIP} $@
+.else
+LINKFLAGS+= -x
+.endif
%LOAD
-vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
- sh $S/conf/newvers.sh
- ${CC} ${CFLAGS} -c vers.c
+assym.h: genassym
+ ./genassym >assym.h
-clean::
- rm -f eddep *netbsd netbsd.gdb tags *.o locore.i \
- [a-z]*.s [Ee]rrs linterrs makelinks genassym
+genassym: genassym.o
+ ${CC} -o $@ genassym.o
-lint: /tmp param.c
- @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
- ${HP300}/hp300/Locore.c ${CFILES} ${HP300}/hp300/swapgeneric.c \
- ioconf.c param.c | \
- grep -v 'struct/union .* never defined' | \
- grep -v 'possible pointer alignment problem'
+genassym.o: ${HP300}/hp300/genassym.c
+ ${NORMAL_C_C}
-locore.o: assym.s ${HP300}/hp300/vectors.s ${HP300}/hp300/locore.s
-locore.o: ${HP300}/include/trap.h ${HP300}/include/psl.h ${HP300}/include/pte.h
-locore.o: ${HP300}/include/cpu.h
- ${CPP} -DLOCORE ${COPTS} ${HP300}/hp300/locore.s | ${AS} -o locore.o
+param.c: $S/conf/param.c
+ rm -f param.c
+ cp $S/conf/param.c .
-# the following is necessary because autoconf.o depends on #if GENERIC
-autoconf.o: Makefile
+param.o: param.c Makefile
+ ${NORMAL_C_C}
-# the following are necessary because the files depend on the types of
-# hp cpu's included in the system configuration
-machdep.o sys_machdep.o pmap.o pmap_bootstrap.o trap.o dma.o: Makefile
+ioconf.o: ioconf.c
+ ${NORMAL_C}
-# depend on network or filesystem configuration
-uipc_domain.o uipc_proto.o vfs_conf.o locore.o: Makefile
-if_tun.o if_loop.o if_ethersubr.o: Makefile
-in_proto.o: Makefile
+vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
+ sh $S/conf/newvers.sh
+ ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
-# depend on maxusers
-assym.s: Makefile
-assym.s: genassym
- ./genassym >assym.s
+clean::
+ rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
+ [Ee]rrs linterrs makelinks genassym genassym.o assym.h
-genassym: ${HP300}/hp300/genassym.c Makefile
- ${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dhp300 -o genassym \
- ${HP300}/hp300/genassym.c
+lint:
+ @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
+ ${HP300}/hp300/Locore.c ${CFILES} ${HP300}/hp300/swapgeneric.c \
+ ioconf.c param.c | \
+ grep -v 'static function .* unused'
-depend: assym.s param.c
- mkdep ${COPTS} ${CFILES} ioconf.c param.c
- mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${HP300}/hp300/genassym.c
+tags:
+ @echo "see $S/kern/Makefile for tags"
links:
egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
sort -u | comm -23 - dontlink | \
- sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
+ sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
sh makelinks && rm -f dontlink
-tags:
- @echo "see $S/kern/Makefile for tags"
+SRCS= ${HP300}/hp300/locore.s \
+ param.c ioconf.c ${CFILES} ${SFILES}
+depend: .depend
+.depend: ${SRCS} assym.h param.c
+ mkdep ${AFLAGS} ${CPPFLAGS} ${HP300}/hp300/locore.s
+ mkdep -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
+ -if test -n "${SFILES}"; then \
+ mkdep -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
+ fi
+ mkdep -a ${CFLAGS} ${CPPFLAGS} ${PARAM} ${HP300}/hp300/genassym.c
+
+
+# depend on root or device configuration
+autoconf.o conf.o: Makefile
+
+# depend on network or filesystem configuration
+uipc_domain.o uipc_proto.o vfs_conf.o: Makefile
+if_tun.o if_loop.o if_ethersubr.o: Makefile
+in_proto.o: Makefile
-ioconf.o: ioconf.c
- ${CC} -c ${CFLAGS} ioconf.c
+# depend on maxusers
+genassym.o machdep.o: Makefile
-param.c: $S/conf/param.c
- rm -f param.c
- cp $S/conf/param.c .
+# depend on CPU configuration
+dma.o genassym.o hpux_machdep.o locore.o machdep.o pmap.o pmap_boostrap.o sys_machdep.o trap.o: Makefile
-param.o: param.c Makefile
- ${CC} -c ${CFLAGS} ${PARAM} param.c
+
+locore.o: ${HP300}/hp300/locore.s assym.h
+ ${NORMAL_S}
%RULES
-# $NetBSD: files.hp300.oldconf,v 1.22 1996/01/08 03:27:36 thorpej Exp $
+# $NetBSD: files.hp300.oldconf,v 1.25 1996/02/24 00:54:55 thorpej Exp $
#
arch/hp300/hp300/autoconf.c standard
arch/hp300/hp300/clock.c standard
arch/hp300/hp300/kgdb_glue.c optional kgdb compile-with "${NORMAL_C} -fno-defer-pop"
arch/hp300/hp300/kgdb_stub.c optional kgdb
arch/hp300/hp300/machdep.c standard config-dependent
+arch/hp300/hp300/isr.c standard
arch/hp300/hp300/mem.c standard
arch/hp300/hp300/pmap.c standard
arch/hp300/hp300/pmap_bootstrap.c standard
arch/hp300/dev/grf_machdep.c optional grf
arch/hp300/dev/grf_rb.c optional grf needs-count # XXX? d-d?
arch/hp300/dev/grf_tc.c optional grf needs-count # XXX? d-d?
-arch/hp300/dev/ite_dv.c optional ite needs-count # XXX? d-d?
-arch/hp300/dev/ite_gb.c optional ite needs-count # XXX? d-d?
-arch/hp300/dev/ite_hy.c optional ite needs-count # XXX? d-d?
-arch/hp300/dev/ite_rb.c optional ite needs-count # XXX? d-d?
-arch/hp300/dev/ite_tc.c optional ite needs-count # XXX? d-d?
arch/hp300/dev/dcm.c optional dcm device-driver
arch/hp300/dev/if_le.c optional le device-driver
arch/hp300/dev/dma.c standard
arch/hp300/dev/ite.c optional ite needs-count # XXX? d-d?
arch/hp300/dev/ite_subr.c optional ite needs-count # XXX? d-d?
arch/m68k/m68k/copy.s standard
+arch/m68k/m68k/db_memrw.c optional ddb
dev/cons.c standard
dev/cninit.c standard
thisisfor_in_proto.c optional hy
-/* $NetBSD: ac.c,v 1.3 1995/12/02 18:21:49 thorpej Exp $ */
+/* $NetBSD: ac.c,v 1.4 1996/02/14 02:43:54 thorpej Exp $ */
/*
* Copyright (c) 1991 University of Utah.
(void)acident(sc, hd, 1); /* XXX Ick. */
+ sc->sc_dq.dq_softc = sc;
sc->sc_dq.dq_unit = unit;
sc->sc_dq.dq_ctlr = hd->hp_ctlr;
sc->sc_dq.dq_slave = hd->hp_slave;
}
}
-acintr(unit, stat)
- int unit, stat;
+acintr(arg, stat)
+ void *arg;
+ int stat;
{
- register struct ac_softc *sc = &ac_softc[unit];
+ register struct ac_softc *sc = arg;
register struct buf *bp = sc->sc_bp;
u_char sensebuf[78];
struct scsi_xsense *sp;
+ int unit = sc->sc_hd->hp_unit;
#ifdef DEBUG
if (ac_debug & ACD_FOLLOW)
-/* $NetBSD: ct.c,v 1.14 1996/01/23 00:28:09 scottr Exp $ */
+/* $NetBSD: ct.c,v 1.15 1996/02/14 02:44:02 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
(void)ctident(sc, hd, 1); /* XXX Ick. */
ctreset(sc, hd);
+ sc->sc_dq.dq_softc = sc;
sc->sc_dq.dq_ctlr = hd->hp_ctlr;
sc->sc_dq.dq_unit = hd->hp_unit;
sc->sc_dq.dq_slave = hd->hp_slave;
#endif
}
-ctintr(unit)
- register int unit;
+int
+ctintr(arg)
+ void *arg;
{
- register struct ct_softc *sc = &ct_softc[unit];
+ register struct ct_softc *sc = arg;
register struct buf *bp, *dp;
u_char stat;
+ int unit = sc->sc_hd->hp_unit;
bp = cttab[unit].b_actf;
if (bp == NULL) {
-/* $NetBSD: ctreg.h,v 1.5 1995/12/31 04:11:42 thorpej Exp $ */
+/* $NetBSD: ctreg.h,v 1.6 1996/02/09 18:00:35 scottr Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
#define C_SSM 0x3e
#define C_WFM 0x49
#define C_UNLOAD 0x4a
-/*
- * XXX XXX XXX THIS IS SUPPOSED TO FIT IN A 1-BYTE SPACE?!
- */
-#if 0
-#define C_REL 0x140
-#else
-#define C_REL 0x40 /* what ended up happening */
-#endif
+#define C_REL 0xc0
#define C_CMD 0x05
#define C_EXEC 0x0e
-/* $NetBSD: dca.c,v 1.19 1995/12/31 00:27:16 thorpej Exp $ */
+/* $NetBSD: dca.c,v 1.23 1996/03/03 16:48:52 thorpej Exp $ */
/*
- * Copyright (c) 1995 Jason R. Thorpe. All rights reserved.
+ * Copyright (c) 1995, 1996 Jason R. Thorpe. All rights reserved.
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
#include <sys/kernel.h>
#include <sys/syslog.h>
+#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <dev/cons.h>
struct hp_device *sc_hd; /* device info */
struct dcadevice *sc_dca; /* pointer to hardware */
struct tty *sc_tty; /* our tty instance */
- struct isr sc_isr; /* interrupt handler */
int sc_oflows; /* overflow counter */
short sc_flags; /* state flags */
#define DCA_ACTIVE 0x0001 /* indicates live unit */
#define DCA_SOFTCAR 0x0002 /* indicates soft-carrier */
#define DCA_HASFIFO 0x0004 /* indicates unit has FIFO */
+#define DCA_ISCONSOLE 0x0008 /* indicates unit is console */
} dca_softc[NDCA];
void dcastart();
-int dcaparam(), dcaintr();
+int dcaparam();
+int dcaintr __P((void *));
int ndca = NDCA;
int dcadefaultrate = TTYDEF_SPEED;
int dcamajor;
-int dcafastservice;
/*
- * Stuff for DCA console support. This could probably be done a little
- * better.
+ * Stuff for DCA console support.
*/
static struct dcadevice *dca_cn = NULL; /* pointer to hardware */
-static int dca_lastcnpri = CN_DEAD; /* XXX last priority */
static int dcaconsinit; /* has been initialized */
-#ifdef DCACONSOLE
-static int dcaconsole = DCACONSOLE;
-#else
-static int dcaconsole = -1;
-#endif
struct speedtab dcaspeedtab[] = {
0, 0,
struct dcadevice *dca = (struct dcadevice *)hd->hp_addr;
struct dca_softc *sc = &dca_softc[unit];
- if (unit == dcaconsole)
+ if (hd->hp_args->hw_sc == conscode) {
+ sc->sc_flags |= DCA_ISCONSOLE;
DELAY(100000);
+ /*
+ * We didn't know which unit this would be during
+ * the console probe, so we have to fixup cn_dev here.
+ */
+ cn_tab->cn_dev = makedev(dcamajor, unit);
+ }
+
dca->dca_reset = 0xFF;
DELAY(100);
sc->sc_dca = dca;
/* Establish interrupt handler. */
- sc->sc_isr.isr_ipl = hd->hp_ipl;
- sc->sc_isr.isr_arg = unit;
- sc->sc_isr.isr_intr = dcaintr;
- isrlink(&sc->sc_isr);
+ isrlink(dcaintr, sc, hd->hp_ipl,
+ (sc->sc_flags & DCA_HASFIFO) ? ISRPRI_TTY : ISRPRI_TTYNOBUF);
sc->sc_flags |= DCA_ACTIVE;
if (hd->hp_flags)
* Need to reset baud rate, etc. of next print so reset dcaconsinit.
* Also make sure console is always "hardwired."
*/
- if (unit == dcaconsole) {
+ if (sc->sc_flags & DCA_ISCONSOLE) {
dcaconsinit = 0;
sc->sc_flags |= DCA_SOFTCAR;
printf(": console, ");
#ifdef KGDB
if (kgdb_dev == makedev(dcamajor, unit)) {
- if (dcaconsole == unit)
+ if (sc->sc_flags & DCA_ISCONSOLE)
kgdb_dev = NODEV; /* can't debug over console port */
else {
dcainit(dca, kgdb_rate);
if (error == 0)
error = (*linesw[tp->t_line].l_open)(dev, tp);
- /*
- * XXX hack to speed up unbuffered builtin port.
- * If dca_fastservice is set, a level 5 interrupt
- * will be directed to dcaintr first.
- */
- if (error == 0 && unit == 0 && (sc->sc_flags & DCA_HASFIFO) == 0)
- dcafastservice = 1;
return (error);
}
unit = DCAUNIT(dev);
- if (unit == 0)
- dcafastservice = 0;
-
sc = &dca_softc[unit];
dca = sc->sc_dca;
tp = sc->sc_tty;
}
int
-dcaintr(unit)
- register int unit;
+dcaintr(arg)
+ void *arg;
{
- struct dca_softc *sc = &dca_softc[unit];
+ struct dca_softc *sc = arg;
+ int unit = sc->sc_hd->hp_unit;
register struct dcadevice *dca = sc->sc_dca;
register struct tty *tp = sc->sc_tty;
register u_char code;
userbits = *(int *)data;
- if ((userbits & TIOCFLAG_SOFTCAR) || (unit == dcaconsole))
+ if ((userbits & TIOCFLAG_SOFTCAR) ||
+ (sc->sc_flags & DCA_ISCONSOLE))
sc->sc_flags |= DCA_SOFTCAR;
if (userbits & TIOCFLAG_CLOCAL)
* Following are all routines needed for DCA to act as console
*/
-void
-dcacnprobe(cp)
- struct consdev *cp;
+int
+dca_console_scan(scode, va, arg)
+ int scode;
+ caddr_t va;
+ void *arg;
{
- struct dcadevice *dca;
- int unit;
-
- /* locate the major number */
- for (dcamajor = 0; dcamajor < nchrdev; dcamajor++)
- if (cdevsw[dcamajor].d_open == dcaopen)
- break;
-
- /* XXX: ick */
- unit = CONUNIT;
-
- dca = (struct dcadevice *)sctova(CONSCODE);
-
- /* make sure hardware exists */
- if (badaddr((short *)dca)) {
- cp->cn_pri = CN_DEAD;
- return;
- }
-
- /* initialize required fields */
- cp->cn_dev = makedev(dcamajor, unit);
+ struct dcadevice *dca = (struct dcadevice *)va;
+ struct consdev *cp = arg;
+ u_char *dioiidev;
+ int force = 0, pri;
switch (dca->dca_id) {
case DCAID0:
case DCAID1:
- cp->cn_pri = CN_NORMAL;
+ pri = CN_NORMAL;
break;
+
case DCAREMID0:
case DCAREMID1:
- cp->cn_pri = CN_REMOTE;
+ pri = CN_REMOTE;
break;
+
default:
- cp->cn_pri = CN_DEAD;
- break;
+ return (0);
}
+#ifdef CONSCODE
/*
- * If dcaconsole is initialized, raise our priority.
+ * Raise our priority, if appropriate.
*/
- if (dcaconsole == unit)
- cp->cn_pri = CN_REMOTE;
+ if (scode == CONSCODE) {
+ pri = CN_REMOTE;
+ force = conforced = 1;
+ }
+#endif
+
+ /* Only raise priority. */
+ if (pri > cp->cn_pri)
+ cp->cn_pri = pri;
/*
* If our priority is higher than the currently-remembered
- * DCA, stash our priority and address, for the benefit of
- * dcacninit().
+ * console, stash our priority, for the benefit of dcacninit().
*/
- if (cp->cn_pri > dca_lastcnpri) {
- dca_lastcnpri = cp->cn_pri;
- dca_cn = dca;
+ if (((cn_tab == NULL) || (cp->cn_pri > cn_tab->cn_pri)) || force) {
+ cn_tab = cp;
+ if (scode >= 132) {
+ dioiidev = (u_char *)va;
+ return ((dioiidev[0x101] + 1) * 0x100000);
+ }
+ return (DIOCSIZE);
}
+ return (0);
+}
+
+void
+dcacnprobe(cp)
+ struct consdev *cp;
+{
+
+ /* locate the major number */
+ for (dcamajor = 0; dcamajor < nchrdev; dcamajor++)
+ if (cdevsw[dcamajor].d_open == dcaopen)
+ break;
+
+ /* initialize required fields */
+ cp->cn_dev = makedev(dcamajor, 0); /* XXX */
+ cp->cn_pri = CN_DEAD;
+
+ /* Abort early if console is already forced. */
+ if (conforced)
+ return;
+
+ console_scan(dca_console_scan, cp);
#ifdef KGDB
+ /* XXX this needs to be fixed. */
if (major(kgdb_dev) == 1) /* XXX */
kgdb_dev = makedev(dcamajor, minor(kgdb_dev));
#endif
}
+/* ARGSUSED */
void
dcacninit(cp)
struct consdev *cp;
{
- int unit = DCAUNIT(cp->cn_dev);
+ dca_cn = (struct dcadevice *)conaddr;
dcainit(dca_cn, dcadefaultrate);
- dcaconsole = unit;
dcaconsinit = 1;
}
stat = dev; if (stat) return (0);
#endif
- /*
- * NOTE: This assumes that DCAUNIT(dev) == dcaconsole. If
- * it doesn't, well, you lose. (It's also extremely unlikely
- * that will ever not be the case.)
- */
-
s = splhigh();
while (((stat = dca_cn->dca_lsr) & LSR_RXRDY) == 0)
;
stat = dev; if (stat) return;
#endif
- /*
- * NOTE: This assumes that DCAUNIT(dev) == dcaconsole. If
- * it doesn't, well, you lose. (It's also extremely unlikely
- * that will ever not be the case.)
- */
-
if (dcaconsinit == 0) {
dcainit(dca_cn, dcadefaultrate);
dcaconsinit = 1;
-/* $NetBSD: dcareg.h,v 1.5 1995/12/31 00:27:19 thorpej Exp $ */
+/* $NetBSD: dcareg.h,v 1.6 1996/02/24 00:55:02 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
#define MSR_TERI 0x04
#define MSR_DDSR 0x02
#define MSR_DCTS 0x01
-
-/* WARNING: Serial console is assumed to be at SC9 */
-#define CONSCODE (9)
-#define CONUNIT (0)
-/* $NetBSD: dcm.c,v 1.22 1995/12/31 00:27:21 thorpej Exp $ */
+/* $NetBSD: dcm.c,v 1.26 1996/03/03 16:48:54 thorpej Exp $ */
/*
- * Copyright (c) 1995 Jason R. Thorpe. All rights reserved.
+ * Copyright (c) 1995, 1996 Jason R. Thorpe. All rights reserved.
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
#include <sys/syslog.h>
#include <sys/time.h>
+#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <dev/cons.h>
#define DEFAULT_BAUD_RATE 9600
#endif
-int dcmmatch(), dcmintr(), dcmparam();
+int dcmmatch(), dcmparam();
void dcmattach(), dcmstart();
struct driver dcmdriver = {
dcmmatch, dcmattach, "dcm",
static struct dcmdevice *dcm_cn = NULL; /* pointer to hardware */
static int dcm_lastcnpri = CN_DEAD; /* XXX last priority */
static int dcmconsinit; /* has been initialized */
-#ifdef DCMCONSOLE
-static int dcmconsole = DCMCONSOLE;
-#else
-static int dcmconsole = -1;
-#endif
int dcmdefaultrate = DEFAULT_BAUD_RATE;
int dcmconbrdbusy = 0;
struct tty *sc_tty[NDCMPORT]; /* our tty instances */
struct modemreg *sc_modem[NDCMPORT]; /* modem control */
char sc_mcndlast[NDCMPORT]; /* XXX last modem status for port */
- struct isr sc_isr; /* interrupt handler */
short sc_softCAR; /* mask of ports with soft-carrier */
struct dcmischeme sc_scheme; /* interrupt scheme for board */
* Bits for sc_flags
*/
#define DCM_ACTIVE 0x00000001 /* indicates board is alive */
+#define DCM_ISCONSOLE 0x00000002 /* indicates board is console */
#define DCM_STDDCE 0x00000010 /* re-map DCE to standard */
#define DCM_FLAGMASK (DCM_STDDCE) /* mask of valid bits in config flags */
} dcm_softc[NDCM];
void dcminit __P((struct dcmdevice *, int, int));
+int dcmintr __P((void *));
int
dcmmatch(hd)
struct dcm_softc *sc = &dcm_softc[hd->hp_unit];
struct dcmdevice *dcm;
int i, timo = 0;
- int s, brd, isconsole, mbits;
+ int s, brd, mbits;
dcm = (struct dcmdevice *)hd->hp_addr;
if ((dcm->dcm_rsid & 0x1f) != DCMID)
return (0);
brd = hd->hp_unit;
- isconsole = (brd == DCMBOARD(dcmconsole));
-
- /*
- * XXX selected console device (CONSUNIT) as determined by
- * dcmcnprobe does not agree with logical numbering imposed
- * by the config file (i.e. lowest address DCM is not unit
- * CONSUNIT). Don't recognize this card.
- */
- if (isconsole && (dcm != sc->sc_dcm))
- return (0);
sc->sc_hd = hd;
hd->hp_ipl = DCMIPL(dcm->dcm_ic);
return (0);
DELAY(50000) /* XXX why is this needed ???? */
if (dcm->dcm_stcon != ST_OK) {
- if (!isconsole)
+ if (hd->hp_args->hw_sc != conscode)
printf("dcm%d: self test failed: %x\n",
brd, dcm->dcm_stcon);
return (0);
struct dcm_softc *sc = &dcm_softc[hd->hp_unit];
struct dcmdevice *dcm;
int i, timo = 0;
- int s, brd, isconsole, mbits;
+ int s, brd, mbits;
dcm = sc->sc_dcm = (struct dcmdevice *)hd->hp_addr;
brd = hd->hp_unit;
- isconsole = (brd == DCMBOARD(dcmconsole));
+ if (hd->hp_args->hw_sc == conscode) {
+ sc->sc_flags |= DCM_ISCONSOLE;
+
+ /*
+ * We didn't know which unit this would be during
+ * the console probe, so we have to fixup cn_dev here.
+ * Note that we always assume port 1 on the board.
+ */
+ cn_tab->cn_dev = makedev(dcmmajor, (brd << 2) | DCMCONSPORT);
+ }
/* Extract configuration info from flags. */
sc->sc_softCAR = (hd->hp_flags & DCM_SOFTCAR);
sc->sc_flags |= DCM_ACTIVE;
/* Establish the interrupt handler. */
- sc->sc_isr.isr_ipl = hd->hp_ipl;
- sc->sc_isr.isr_arg = brd;
- sc->sc_isr.isr_intr = dcmintr;
- isrlink(&sc->sc_isr);
+ isrlink(dcmintr, sc, hd->hp_ipl, ISRPRI_TTY);
if (dcmistype == DIS_TIMER)
dcmsetischeme(brd, DIS_RESET|DIS_TIMER);
dcm->dcm_ic = IC_IE; /* turn all interrupts on */
/*
- * Need to reset baud rate, etc. of next print so reset dcmconsole.
+ * Need to reset baud rate, etc. of next print so reset dcmconsinit.
* Also make sure console is always "hardwired"
*/
- if (isconsole) {
+ if (sc->sc_flags & DCM_ISCONSOLE) {
dcmconsinit = 0;
- sc->sc_softCAR |= (1 << DCMPORT(dcmconsole));
- printf(": console on port %d\n", DCMPORT(dcmconsole));
+ sc->sc_softCAR |= (1 << DCMCONSPORT);
+ printf(": console on port %d\n", DCMCONSPORT);
} else
printf("\n");
#ifdef KGDB
if (major(kgdb_dev) == dcmmajor &&
DCMBOARD(DCMUNIT(kgdb_dev)) == brd) {
- if (dcmconsole == DCMUNIT(kgdb_dev))
+ if (dcmconsole == DCMUNIT(kgdb_dev)) /* XXX fixme */
kgdb_dev = NODEV; /* can't debug over console port */
#ifndef KGDB_CHEAT
/*
}
int
-dcmintr(brd)
- register int brd;
+dcmintr(arg)
+ void *arg;
{
- struct dcm_softc *sc = &dcm_softc[brd];
+ struct dcm_softc *sc = arg;
struct dcmdevice *dcm = sc->sc_dcm;
struct dcmischeme *dis = &sc->sc_scheme;
+ int brd = sc->sc_hd->hp_unit;
int code, i;
int pcnd[4], mcode, mcnd[4];
userbits = *(int *)data;
if ((userbits & TIOCFLAG_SOFTCAR) ||
- ((board == DCMBOARD(dcmconsole)) &&
- (port == DCMPORT(dcmconsole))))
+ ((sc->sc_flags & DCM_ISCONSOLE) &&
+ (port == DCMCONSPORT)))
sc->sc_softCAR |= (1 << port);
if (userbits & TIOCFLAG_CLOCAL)
* Following are all routines needed for DCM to act as console
*/
-void
-dcmcnprobe(cp)
- struct consdev *cp;
+int
+dcm_console_scan(scode, va, arg)
+ int scode;
+ caddr_t va;
+ void *arg;
{
- struct dcm_softc *sc; /* XXX thorpej */
- struct dcmdevice *dcm;
- struct hp_hw *hw;
- int unit;
+ struct dcmdevice *dcm = (struct dcmdevice *)va;
+ struct consdev *cp = arg;
+ u_char *dioiidev;
+ int force = 0, pri;
- /* locate the major number */
- for (dcmmajor = 0; dcmmajor < nchrdev; dcmmajor++)
- if (cdevsw[dcmmajor].d_open == dcmopen)
- break;
-
- /*
- * XXX FIX ME!
- * Implicitly assigns the lowest select code DCM card found to be
- * logical unit 0 (actually CONUNIT). If your config file does
- * anything different, you're screwed.
- */
- for (hw = sc_table; hw->hw_type; hw++)
- if (HW_ISDEV(hw, D_COMMDCM) && !badaddr((short *)hw->hw_kva))
- break;
- if (!HW_ISDEV(hw, D_COMMDCM)) {
- cp->cn_pri = CN_DEAD;
- return;
- }
-
- unit = CONUNIT;
- dcm = (struct dcmdevice *)hw->hw_kva;
-
- /* initialize required fields */
- cp->cn_dev = makedev(dcmmajor, unit);
switch (dcm->dcm_rsid) {
case DCMID:
- cp->cn_pri = CN_NORMAL;
+ pri = CN_NORMAL;
break;
case DCMID|DCMCON:
- cp->cn_pri = CN_REMOTE;
+ pri = CN_REMOTE;
break;
default:
- cp->cn_pri = CN_DEAD;
- return;
+ return (0);
}
+#ifdef CONSCODE
/*
- * If dcmconsole is initialized, raise our priority.
+ * Raise our priority, if appropriate.
*/
- if (dcmconsole == unit)
- cp->cn_pri = CN_REMOTE;
+ if (scode == CONSCODE) {
+ pri = CN_REMOTE;
+ force = conforced = 1;
+ }
+#endif
+
+ /* Only raise priority. */
+ if (pri > cp->cn_pri)
+ cp->cn_pri = pri;
/*
* If our priority is higher than the currently-remembered
- * DCM, stash our priority and address, for the benefit of
- * dcmcninit().
+ * console, stash our priority, for the benefit of dcmcninit().
*/
- if (cp->cn_pri > dcm_lastcnpri) {
- dcm_lastcnpri = cp->cn_pri;
- dcm_cn = dcm;
+ if (((cn_tab == NULL) || (cp->cn_pri > cn_tab->cn_pri)) || force) {
+ cn_tab = cp;
+ if (scode >= 132) {
+ dioiidev = (u_char *)va;
+ return ((dioiidev[0x101] + 1) * 0x100000);
+ }
+ return (DIOCSIZE);
}
+ return (0);
+}
+
+void
+dcmcnprobe(cp)
+ struct consdev *cp;
+{
+
+ /* locate the major number */
+ for (dcmmajor = 0; dcmmajor < nchrdev; dcmmajor++)
+ if (cdevsw[dcmmajor].d_open == dcmopen)
+ break;
+
+ /* initialize required fields */
+ cp->cn_dev = makedev(dcmmajor, 0); /* XXX */
+ cp->cn_pri = CN_DEAD;
+
+ /* Abort early if console already forced. */
+ if (conforced)
+ return;
+
+ console_scan(dcm_console_scan, cp);
#ifdef KGDB_CHEAT
+ /* XXX this needs to be fixed. */
/*
* This doesn't currently work, at least not with ite consoles;
* the console hasn't been initialized yet.
#endif
}
+/* ARGSUSED */
void
dcmcninit(cp)
struct consdev *cp;
{
- int unit = DCMUNIT(cp->cn_dev);
- int port = DCMPORT(unit);
- dcminit(dcm_cn, port, dcmdefaultrate);
+ dcm_cn = (struct dcmdevice *)conaddr;
+ dcminit(dcm_cn, DCMCONSPORT, dcmdefaultrate);
dcmconsinit = 1;
- dcmconsole = DCMUNIT(cp->cn_dev);
}
+/* ARGSUSED */
int
dcmcngetc(dev)
dev_t dev;
struct dcmrfifo *fifo;
struct dcmpreg *pp;
u_int head;
- int s, c, stat, unit, port;
-
- unit = DCMUNIT(dev);
- port = DCMPORT(unit);
-
- /*
- * NOTE: This assumes that unit == dcmconsole. If it doesn't,
- * well, you lose. (It's also extremely unlikely that will ever
- * not be the case.)
- */
+ int s, c, stat;
- pp = dcm_preg(dcm_cn, port);
+ pp = dcm_preg(dcm_cn, DCMCONSPORT);
s = splhigh();
head = pp->r_head & RX_MASK;
- fifo = &dcm_cn->dcm_rfifos[3-port][head>>1];
+ fifo = &dcm_cn->dcm_rfifos[3-DCMCONSPORT][head>>1];
while (head == (pp->r_tail & RX_MASK))
;
/*
/*
* Console kernel output character routine.
*/
+/* ARGSUSED */
void
dcmcnputc(dev, c)
dev_t dev;
{
struct dcmpreg *pp;
unsigned tail;
- int s, unit, port, stat;
-
- unit = DCMUNIT(dev);
- port = DCMPORT(unit);
-
- /*
- * NOTE: This assumes that unit == dcmconsole. If it doesn't,
- * well, you lose. (It's also extremely unlikely that will ever
- * not be the case.)
- */
+ int s, unit, stat;
- pp = dcm_preg(dcm_cn, port);
+ pp = dcm_preg(dcm_cn, DCMCONSPORT);
s = splhigh();
#ifdef KGDB
if (dev != kgdb_dev)
#endif
if (dcmconsinit == 0) {
- dcminit(dcm_cn, port, dcmdefaultrate);
+ dcminit(dcm_cn, DCMCONSPORT, dcmdefaultrate);
dcmconsinit = 1;
}
tail = pp->t_tail & TX_MASK;
while (tail != (pp->t_head & TX_MASK))
;
- dcm_cn->dcm_tfifos[3-port][tail].data_char = c;
+ dcm_cn->dcm_tfifos[3-DCMCONSPORT][tail].data_char = c;
pp->t_tail = tail = (tail + 1) & TX_MASK;
SEM_LOCK(dcm_cn);
- dcm_cn->dcm_cmdtab[port].dcm_data |= CT_TX;
- dcm_cn->dcm_cr |= (1 << port);
+ dcm_cn->dcm_cmdtab[DCMCONSPORT].dcm_data |= CT_TX;
+ dcm_cn->dcm_cr |= (1 << DCMCONSPORT);
SEM_UNLOCK(dcm_cn);
while (tail != (pp->t_head & TX_MASK))
;
-/* $NetBSD: dcmreg.h,v 1.4 1994/10/26 07:23:37 cgd Exp $ */
+/* $NetBSD: dcmreg.h,v 1.5 1996/02/24 00:55:05 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#define RX_MASK 0xff
/*
- * WARNING: Serial console is assumed to be the lowest select-code card
- * and that card must be logical unit 0 in the kernel. Also, CONUNIT must
- * be 1, the port affected by the REMOTE/LOCAL switch.
+ * DCM console caveat: only port 1 is affected by the remote switch, and
+ * thus the only supported console port on a given DCM card.
*/
-#define CONUNIT (1)
+#define DCMCONSPORT 1
-/* $NetBSD: device.h,v 1.6 1995/12/02 18:21:54 thorpej Exp $ */
+/* $NetBSD: device.h,v 1.7 1996/02/14 02:44:14 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
char hp_xname[8];
};
+/* XXX This needs to die. */
struct devqueue {
struct devqueue *dq_forw;
struct devqueue *dq_back;
int dq_ctlr;
int dq_unit;
int dq_slave;
+ void *dq_softc;
struct driver *dq_driver;
};
-/* $NetBSD: dma.c,v 1.6 1995/12/02 02:46:45 thorpej Exp $ */
+/* $NetBSD: dma.c,v 1.7 1996/02/14 02:44:17 thorpej Exp $ */
/*
* Copyright (c) 1995 Jason R. Thorpe.
#define DMAF_NOINTR 0x04
struct devqueue dmachan[NDMACHAN + 1];
-int dmaintr();
+int dmaintr __P((void *));
#ifdef DEBUG
int dmadebug = 0;
printf("%s: 98620%c, 2 channels, %d bit\n", sc->sc_xname,
rev, (rev == 'B') ? 16 : 32);
+
+ /* Establish the interrupt handler */
+ isrlink(dmaintr, sc, DMAINTLVL, ISRPRI_BIO);
}
int
}
int
-dmaintr()
+dmaintr(arg)
+ void *arg;
{
- struct dma_softc *sc = &Dma_softc;
+ struct dma_softc *sc = arg;
register struct dma_channel *dc;
register int i, stat;
int found = 0;
-/* $NetBSD: fhpib.c,v 1.8 1995/12/02 18:21:56 thorpej Exp $ */
+/* $NetBSD: fhpib.c,v 1.9 1996/02/14 02:44:20 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
void fhpibppwatch __P((void *));
void fhpibgo __P((int, int, int, void *, int, int, int));
void fhpibdone __P((int));
-int fhpibintr __P((int));
+int fhpibintr __P((void *));
/*
* Our controller ops structure.
hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
dmafree(&hs->sc_dq);
dq = hs->sc_sq.dq_forw;
- (dq->dq_driver->d_intr)(dq->dq_unit);
+ (dq->dq_driver->d_intr)(dq->dq_softc);
}
(void) splx(s);
}
}
int
-fhpibintr(unit)
- register int unit;
+fhpibintr(arg)
+ void *arg;
{
- register struct hpib_softc *hs = &hpib_softc[unit];
+ register struct hpib_softc *hs = arg;
register struct fhpibdevice *hd;
register struct devqueue *dq;
- register int stat0;
+ register int stat0, unit = hs->sc_hc->hp_unit;
hd = (struct fhpibdevice *)hs->sc_hc->hp_addr;
stat0 = hd->hpib_ids;
hd->hpib_imask = 0;
hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
dmafree(&hs->sc_dq);
- (dq->dq_driver->d_intr)(dq->dq_unit);
+ (dq->dq_driver->d_intr)(dq->dq_softc);
} else if (hs->sc_flags & HPIBF_PPOLL) {
stat0 = hd->hpib_intr;
#ifdef DEBUG
}
#endif
hs->sc_flags &= ~HPIBF_PPOLL;
- (dq->dq_driver->d_intr)(dq->dq_unit);
+ (dq->dq_driver->d_intr)(dq->dq_softc);
}
return(1);
}
-/* $NetBSD: grf.c,v 1.16 1995/11/28 08:14:30 thorpej Exp $ */
+/* $NetBSD: grf.c,v 1.17 1996/02/24 00:55:07 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#include <sys/vnode.h>
#include <sys/mman.h>
+#include <machine/autoconf.h>
+#include <machine/cpu.h>
+
#include <hp300/dev/grfioctl.h>
#include <hp300/dev/grfvar.h>
#include <hp300/dev/grfreg.h>
-#include <machine/cpu.h>
-
#ifdef COMPAT_HPUX
#include <compat/hpux/hpux.h>
extern struct emul emul_hpux;
#include <miscfs/specfs/specdev.h>
#include "ite.h"
-#if NITE == 0
+#if NITE > 0
+#include <hp300/dev/itevar.h>
+#else
#define iteon(u,f)
#define iteoff(u,f)
-#endif
+#endif /* NITE > 0 */
struct grf_softc grf_softc[NGRF];
+/*
+ * Frambuffer state information, statically allocated for benefit
+ * of the console.
+ */
+struct grf_data grf_cn;
+
#ifdef DEBUG
int grfdebug = 0;
#define GDB_DEVNO 0x01
#endif
/*ARGSUSED*/
-grfopen(dev, flags)
+grfopen(dev, flags, mode, p)
dev_t dev;
- int flags;
+ int flags, mode;
+ struct proc *p;
{
int unit = GRFUNIT(dev);
- register struct grf_softc *gp = &grf_softc[unit];
+ struct grf_softc *sc;
+ struct grf_data *gp;
int error = 0;
- if (unit >= NGRF || (gp->g_flags & GF_ALIVE) == 0)
+ if (unit >= NGRF)
return(ENXIO);
+
+ sc = &grf_softc[unit];
+ gp = sc->sc_data;
+
+ if ((gp->g_flags & GF_ALIVE) == 0)
+ return (ENXIO);
+
if ((gp->g_flags & (GF_OPEN|GF_EXCLUDE)) == (GF_OPEN|GF_EXCLUDE))
return(EBUSY);
#ifdef COMPAT_HPUX
/*
* XXX: cannot handle both HPUX and BSD processes at the same time
*/
- if (curproc->p_emul == &emul_hpux)
+ if (p->p_emul == &emul_hpux)
if (gp->g_flags & GF_BSDOPEN)
return(EBUSY);
else
}
/*ARGSUSED*/
-grfclose(dev, flags)
+grfclose(dev, flags, mode, p)
dev_t dev;
- int flags;
+ int flags, mode;
+ struct proc *p;
{
- register struct grf_softc *gp = &grf_softc[GRFUNIT(dev)];
+ int unit = GRFUNIT(dev);
+ struct grf_softc *sc;
+ struct grf_data *gp;
+
+ if (unit >= NGRF)
+ return(ENXIO);
+
+ sc = &grf_softc[unit];
+ gp = sc->sc_data;
+
+ if ((gp->g_flags & GF_ALIVE) == 0)
+ return (ENXIO);
(void) grfoff(dev);
#ifdef COMPAT_HPUX
caddr_t data;
struct proc *p;
{
- register struct grf_softc *gp = &grf_softc[GRFUNIT(dev)];
- int error;
+ struct grf_softc *sc;
+ struct grf_data *gp;
+ int error, unit = GRFUNIT(dev);
+
+ if (unit >= NGRF)
+ return(ENXIO);
+
+ sc = &grf_softc[unit];
+ gp = sc->sc_data;
+
+ if ((gp->g_flags & GF_ALIVE) == 0)
+ return (ENXIO);
#ifdef COMPAT_HPUX
if (p->p_emul == &emul_hpux)
return(grfaddr(&grf_softc[GRFUNIT(dev)], off));
}
+int
grfon(dev)
- dev_t dev;
+ dev_t dev; /* XXX */
{
int unit = GRFUNIT(dev);
- struct grf_softc *gp = &grf_softc[unit];
+ struct grf_softc *sc;
+ struct grf_data *gp;
+
+ sc = &grf_softc[unit];
+ gp = sc->sc_data;
/*
* XXX: iteoff call relies on devices being in same order
* as ITEs and the fact that iteoff only uses the minor part
* of the dev arg.
*/
- iteoff(unit, 3);
+ iteoff(sc->sc_ite->sc_data, 3);
return((*gp->g_sw->gd_mode)(gp,
(dev&GRFOVDEV) ? GM_GRFOVON : GM_GRFON,
(caddr_t)0));
}
+int
grfoff(dev)
- dev_t dev;
+ dev_t dev; /* XXX */
{
int unit = GRFUNIT(dev);
- struct grf_softc *gp = &grf_softc[unit];
+ struct grf_softc *sc;
+ struct grf_data *gp;
int error;
+ sc = &grf_softc[unit];
+ gp = sc->sc_data;
+
(void) grfunmap(dev, (caddr_t)0, curproc);
error = (*gp->g_sw->gd_mode)(gp,
(dev&GRFOVDEV) ? GM_GRFOVOFF : GM_GRFOFF,
(caddr_t)0);
/* XXX: see comment for iteoff above */
- iteon(unit, 2);
+ (void) iteon(sc->sc_ite->sc_data, 2);
return(error);
}
-grfaddr(gp, off)
- struct grf_softc *gp;
+int
+grfaddr(sc, off)
+ struct grf_softc *sc;
register int off;
{
- register struct grfinfo *gi = &gp->g_display;
+ struct grf_data *gp= sc->sc_data;
+ struct grfinfo *gi = &gp->g_display;
/* control registers */
if (off >= 0 && off < gi->gd_regsize)
caddr_t data;
struct proc *p;
{
- register struct grf_softc *gp = &grf_softc[GRFUNIT(dev)];
+ struct grf_softc *sc = &grf_softc[GRFUNIT(dev)];
+ struct grf_data *gp = sc->sc_data;
int error;
error = 0;
return(error);
}
+int
grflock(gp, block)
- register struct grf_softc *gp;
+ struct grf_data *gp;
int block;
{
struct proc *p = curproc; /* XXX */
#ifdef DEBUG
if (grfdebug & GDB_LOCK)
- printf("grflock(%d): dev %x flags %x lockpid %x\n",
- p->p_pid, gp-grf_softc, gp->g_flags,
+ printf("grflock(%d): flags %x lockpid %x\n",
+ p->p_pid, gp->g_flags,
gp->g_lockp ? gp->g_lockp->p_pid : -1);
#endif
if (gp->g_pid) {
}
grfunlock(gp)
- register struct grf_softc *gp;
+ struct grf_data *gp;
{
#ifdef DEBUG
if (grfdebug & GDB_LOCK)
- printf("grfunlock(%d): dev %x flags %x lockpid %d\n",
- curproc->p_pid, gp-grf_softc, gp->g_flags,
+ printf("grfunlock(%d): flags %x lockpid %d\n",
+ curproc->p_pid, gp->g_flags,
gp->g_lockp ? gp->g_lockp->p_pid : -1);
#endif
if (gp->g_lockp != curproc)
dev_t dev;
{
int unit = GRFUNIT(dev);
- struct grf_softc *gp = &grf_softc[unit];
+ struct grf_softc *sc = &grf_softc[unit];
+ struct grf_data *gp = sc->sc_data;
int newdev;
if (unit >= NGRF || (gp->g_flags&GF_ALIVE) == 0)
caddr_t *addrp;
struct proc *p;
{
- struct grf_softc *gp = &grf_softc[GRFUNIT(dev)];
+ struct grf_softc *sc = &grf_softc[GRFUNIT(dev)];
+ struct grf_data *gp = sc->sc_data;
int len, error;
struct vnode vn;
struct specinfo si;
caddr_t addr;
struct proc *p;
{
- struct grf_softc *gp = &grf_softc[GRFUNIT(dev)];
+ struct grf_softc *sc = &grf_softc[GRFUNIT(dev)];
+ struct grf_data *gp = sc->sc_data;
vm_size_t size;
int rv;
* slot is available.
*/
grffindpid(gp)
- struct grf_softc *gp;
+ struct grf_data *gp;
{
register short pid, *sp;
register int i, limit;
}
grfrmpid(gp)
- struct grf_softc *gp;
+ struct grf_data *gp;
{
register short pid, *sp;
register int limit, i;
-/* $NetBSD: grf_conf.c,v 1.2 1994/10/26 07:23:48 cgd Exp $ */
+/* $NetBSD: grf_conf.c,v 1.3 1996/02/24 00:55:08 thorpej Exp $ */
/*
+ * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* Copyright (c) 1991 University of Utah.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
#include <sys/types.h>
-#include <hp300/dev/device.h>
-#include <hp300/dev/grfioctl.h>
+#include <hp300/dev/grfioctl.h> /* XXX */
#include <hp300/dev/grfvar.h>
-#include <hp300/dev/grfreg.h>
-extern int tc_init(), tc_mode();
-extern int gb_init(), gb_mode();
-extern int rb_init(), rb_mode();
-extern int dv_init(), dv_mode();
-extern int hy_init(), hy_mode();
+extern struct grfsw dvbox_grfsw;
+extern struct grfsw gbox_grfsw;
+extern struct grfsw hyper_grfsw;
+extern struct grfsw rbox_grfsw;
+extern struct grfsw topcat_grfsw;
+extern struct grfsw lrcatseye_grfsw;
+extern struct grfsw hrcatseye_grfsw;
+extern struct grfsw hrmcatseye_grfsw;
-struct grfsw grfsw[] = {
- GID_TOPCAT, GRFBOBCAT, "topcat", tc_init, tc_mode,
- GID_GATORBOX, GRFGATOR, "gatorbox", gb_init, gb_mode,
- GID_RENAISSANCE,GRFRBOX, "renaissance", rb_init, rb_mode,
- GID_LRCATSEYE, GRFCATSEYE, "lo-res catseye", tc_init, tc_mode,
- GID_HRCCATSEYE, GRFCATSEYE, "hi-res catseye", tc_init, tc_mode,
- GID_HRMCATSEYE, GRFCATSEYE, "hi-res catseye", tc_init, tc_mode,
- GID_DAVINCI, GRFDAVINCI, "davinci", dv_init, dv_mode,
- GID_HYPERION, GRFHYPERION, "hyperion", hy_init, hy_mode,
+struct grfsw *grfsw[] = {
+ &topcat_grfsw,
+ &gbox_grfsw,
+ &rbox_grfsw,
+ &lrcatseye_grfsw,
+ &hrcatseye_grfsw,
+ &hrmcatseye_grfsw,
+ &dvbox_grfsw,
+ &hyper_grfsw,
};
int ngrfsw = sizeof(grfsw) / sizeof(grfsw[0]);
-
-#include "ite.h"
-#if NITE > 0
-
-#include <hp300/dev/itevar.h>
-
-extern u_char ite_readbyte();
-extern int ite_writeglyph();
-extern int topcat_scroll(), topcat_init(), topcat_deinit();
-extern int topcat_clear(), topcat_putc(), topcat_cursor();
-extern int gbox_scroll(), gbox_init(), gbox_deinit();
-extern int gbox_clear(), gbox_putc(), gbox_cursor();
-extern int rbox_scroll(), rbox_init(), rbox_deinit();
-extern int rbox_clear(), rbox_putc(), rbox_cursor();
-extern int dvbox_scroll(), dvbox_init(), dvbox_deinit();
-extern int dvbox_clear(), dvbox_putc(), dvbox_cursor();
-extern int hyper_scroll(), hyper_init(), hyper_deinit();
-extern int hyper_clear(), hyper_putc(), hyper_cursor();
-
-struct itesw itesw[] = {
- GID_TOPCAT,
- topcat_init, topcat_deinit, topcat_clear, topcat_putc,
- topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph,
- GID_GATORBOX,
- gbox_init, gbox_deinit, gbox_clear, gbox_putc,
- gbox_cursor, gbox_scroll, ite_readbyte, ite_writeglyph,
- GID_RENAISSANCE,
- rbox_init, rbox_deinit, rbox_clear, rbox_putc,
- rbox_cursor, rbox_scroll, ite_readbyte, ite_writeglyph,
- GID_LRCATSEYE,
- topcat_init, topcat_deinit, topcat_clear, topcat_putc,
- topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph,
- GID_HRCCATSEYE,
- topcat_init, topcat_deinit, topcat_clear, topcat_putc,
- topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph,
- GID_HRMCATSEYE,
- topcat_init, topcat_deinit, topcat_clear, topcat_putc,
- topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph,
- GID_DAVINCI,
- dvbox_init, dvbox_deinit, dvbox_clear, dvbox_putc,
- dvbox_cursor, dvbox_scroll, ite_readbyte, ite_writeglyph,
- GID_HYPERION,
- hyper_init, hyper_deinit, hyper_clear, hyper_putc,
- hyper_cursor, hyper_scroll, ite_readbyte, ite_writeglyph,
-};
-int nitesw = sizeof(itesw) / sizeof(itesw[0]);
-#endif
-#endif
+#endif /* NGRF > 0 */
-/* $NetBSD: grf_dv.c,v 1.4 1994/10/26 07:23:49 cgd Exp $ */
+/* $NetBSD: grf_dv.c,v 1.7 1996/03/03 16:48:56 thorpej Exp $ */
/*
+ * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* Graphics routines for the DaVinci, HP98730/98731 Graphics system.
*/
#include <sys/param.h>
+#include <sys/conf.h>
#include <sys/errno.h>
+#include <sys/proc.h>
+#include <sys/ioctl.h>
+#include <sys/tty.h>
+#include <sys/systm.h>
+
+#include <machine/autoconf.h>
+#include <machine/cpu.h>
+
+#include <dev/cons.h>
#include <hp300/dev/grfioctl.h>
#include <hp300/dev/grfvar.h>
+#include <hp300/dev/grfreg.h>
#include <hp300/dev/grf_dvreg.h>
-#include <machine/cpu.h>
+#include <hp300/dev/itevar.h>
+#include <hp300/dev/itereg.h>
+
+#include "ite.h"
+
+int dv_init __P((struct grf_data *, int, caddr_t));
+int dv_mode __P((struct grf_data *, int, caddr_t));
+void dv_reset __P((struct dvboxfb *));
+
+/* DaVinci grf switch */
+struct grfsw dvbox_grfsw = {
+ GID_DAVINCI, GRFDAVINCI, "davinci", dv_init, dv_mode
+};
+
+#if NITE > 0
+void dvbox_init __P((struct ite_data *));
+void dvbox_deinit __P((struct ite_data *));
+void dvbox_putc __P((struct ite_data *, int, int, int, int));
+void dvbox_cursor __P((struct ite_data *, int));
+void dvbox_clear __P((struct ite_data *, int, int, int, int));
+void dvbox_scroll __P((struct ite_data *, int, int, int, int));
+void dvbox_windowmove __P((struct ite_data *, int, int, int, int,
+ int, int, int));
+
+/* DaVinci ite switch */
+struct itesw dvbox_itesw = {
+ dvbox_init, dvbox_deinit, dvbox_clear, dvbox_putc,
+ dvbox_cursor, dvbox_scroll, ite_readbyte, ite_writeglyph
+};
+#endif /* NITE > 0 */
/*
* Initialize hardware.
* Must point g_display at a grfinfo structure describing the hardware.
* Returns 0 if hardware not present, non-zero ow.
*/
-dv_init(gp, addr)
- struct grf_softc *gp;
+int
+dv_init(gp, scode, addr)
+ struct grf_data *gp;
+ int scode;
caddr_t addr;
{
register struct dvboxfb *dbp;
int fboff;
extern caddr_t sctopa(), iomap();
- dbp = (struct dvboxfb *) addr;
- if (ISIIOVA(addr))
- gi->gd_regaddr = (caddr_t) IIOP(addr);
- else
- gi->gd_regaddr = sctopa(vatosc(addr));
- gi->gd_regsize = 0x20000;
- gi->gd_fbwidth = (dbp->fbwmsb << 8) | dbp->fbwlsb;
- gi->gd_fbheight = (dbp->fbhmsb << 8) | dbp->fbhlsb;
- gi->gd_fbsize = gi->gd_fbwidth * gi->gd_fbheight;
- fboff = (dbp->fbomsb << 8) | dbp->fbolsb;
- gi->gd_fbaddr = (caddr_t) (*((u_char *)addr + fboff) << 16);
- if (gi->gd_regaddr >= (caddr_t)DIOIIBASE) {
- /*
- * For DIO II space the fbaddr just computed is the offset
- * from the select code base (regaddr) of the framebuffer.
- * Hence it is also implicitly the size of the register set.
- */
- gi->gd_regsize = (int) gi->gd_fbaddr;
- gi->gd_fbaddr += (int) gi->gd_regaddr;
- gp->g_regkva = addr;
- gp->g_fbkva = addr + gi->gd_regsize;
- } else {
- /*
- * For DIO space we need to map the seperate framebuffer.
- */
- gp->g_regkva = addr;
- gp->g_fbkva = iomap(gi->gd_fbaddr, gi->gd_fbsize);
- }
- gi->gd_dwidth = (dbp->dwmsb << 8) | dbp->dwlsb;
- gi->gd_dheight = (dbp->dwmsb << 8) | dbp->dwlsb;
- gi->gd_planes = 0; /* ?? */
- gi->gd_colors = 256;
+ /*
+ * If the console has been initialized, and it was us, there's
+ * no need to repeat this.
+ */
+ if (consinit_active || (scode != conscode)) {
+ dbp = (struct dvboxfb *) addr;
+ if (ISIIOVA(addr))
+ gi->gd_regaddr = (caddr_t) IIOP(addr);
+ else
+ gi->gd_regaddr = sctopa(scode);
+ gi->gd_regsize = 0x20000;
+ gi->gd_fbwidth = (dbp->fbwmsb << 8) | dbp->fbwlsb;
+ gi->gd_fbheight = (dbp->fbhmsb << 8) | dbp->fbhlsb;
+ gi->gd_fbsize = gi->gd_fbwidth * gi->gd_fbheight;
+ fboff = (dbp->fbomsb << 8) | dbp->fbolsb;
+ gi->gd_fbaddr = (caddr_t) (*((u_char *)addr + fboff) << 16);
+ if (gi->gd_regaddr >= (caddr_t)DIOIIBASE) {
+ /*
+ * For DIO II space the fbaddr just computed is
+ * the offset from the select code base (regaddr)
+ * of the framebuffer. Hence it is also implicitly
+ * the size of the register set.
+ */
+ gi->gd_regsize = (int) gi->gd_fbaddr;
+ gi->gd_fbaddr += (int) gi->gd_regaddr;
+ gp->g_regkva = addr;
+ gp->g_fbkva = addr + gi->gd_regsize;
+ } else {
+ /*
+ * For DIO space we need to map the seperate
+ * framebuffer.
+ */
+ gp->g_regkva = addr;
+ gp->g_fbkva = iomap(gi->gd_fbaddr, gi->gd_fbsize);
+ }
+ gi->gd_dwidth = (dbp->dwmsb << 8) | dbp->dwlsb;
+ gi->gd_dheight = (dbp->dwmsb << 8) | dbp->dwlsb;
+ gi->gd_planes = 0; /* ?? */
+ gi->gd_colors = 256;
- dv_reset(dbp);
+ dv_reset(dbp);
+ }
return(1);
}
/*
* Magic code herein.
*/
+void
dv_reset(dbp)
- register struct dvboxfb *dbp;
+ struct dvboxfb *dbp;
{
dbp->reset = 0x80;
DELAY(100);
* Right now all we can do is grfon/grfoff.
* Return a UNIX error number or 0 for success.
*/
+int
dv_mode(gp, cmd, data)
- register struct grf_softc *gp;
+ struct grf_data *gp;
int cmd;
caddr_t data;
{
return(error);
}
+#if NITE > 0
+
+/*
+ * DaVinci ite routines
+ */
+
+#define REGBASE ((struct dvboxfb *)(ip->regbase))
+#define WINDOWMOVER dvbox_windowmove
+
+void
+dvbox_init(ip)
+ register struct ite_data *ip;
+{
+ int i;
+
+ /* XXX */
+ if (ip->regbase == 0) {
+ struct grf_data *gp = ip->grf;
+
+ ip->regbase = gp->g_regkva;
+ ip->fbbase = gp->g_fbkva;
+ ip->fbwidth = gp->g_display.gd_fbwidth;
+ ip->fbheight = gp->g_display.gd_fbheight;
+ ip->dwidth = gp->g_display.gd_dwidth;
+ ip->dheight = gp->g_display.gd_dheight;
+ /*
+ * XXX some displays (e.g. the davinci) appear
+ * to return a display height greater than the
+ * returned FB height. Guess we should go back
+ * to getting the display dimensions from the
+ * fontrom...
+ */
+ if (ip->dwidth > ip->fbwidth)
+ ip->dwidth = ip->fbwidth;
+ if (ip->dheight > ip->fbheight)
+ ip->dheight = ip->fbheight;
+ }
+
+ dv_reset((struct dvboxfb *)ip->regbase);
+
+ /*
+ * Turn on frame buffer, turn on overlay planes, set replacement
+ * rule, enable top overlay plane writes for ite, disable all frame
+ * buffer planes, set byte per pixel, and display frame buffer 0.
+ * Lastly, turn on the box.
+ */
+ REGBASE->interrupt = 0x04;
+ REGBASE->drive = 0x10;
+ REGBASE->rep_rule = RR_COPY << 4 | RR_COPY;
+ REGBASE->opwen = 0x01;
+ REGBASE->fbwen = 0x0;
+ REGBASE->fold = 0x01;
+ REGBASE->vdrive = 0x0;
+ REGBASE->dispen = 0x01;
+
+ /*
+ * Video enable top overlay plane.
+ */
+ REGBASE->opvenp = 0x01;
+ REGBASE->opvens = 0x01;
+
+ /*
+ * Make sure that overlay planes override frame buffer planes.
+ */
+ REGBASE->ovly0p = 0x0;
+ REGBASE->ovly0s = 0x0;
+ REGBASE->ovly1p = 0x0;
+ REGBASE->ovly1s = 0x0;
+ REGBASE->fv_trig = 0x1;
+ DELAY(100);
+
+ /*
+ * Setup the overlay colormaps. Need to set the 0,1 (black/white)
+ * color for both banks.
+ */
+
+ for (i = 0; i <= 1; i++) {
+ REGBASE->cmapbank = i;
+ REGBASE->rgb[0].red = 0x00;
+ REGBASE->rgb[0].green = 0x00;
+ REGBASE->rgb[0].blue = 0x00;
+ REGBASE->rgb[1].red = 0xFF;
+ REGBASE->rgb[1].green = 0xFF;
+ REGBASE->rgb[1].blue = 0xFF;
+ }
+ REGBASE->cmapbank = 0;
+
+ db_waitbusy(ip->regbase);
+
+ ite_fontinfo(ip);
+ ite_fontinit(ip);
+
+ /*
+ * Clear the (visible) framebuffer.
+ */
+ dvbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
+ db_waitbusy(ip->regbase);
+
+ /*
+ * Stash the inverted cursor.
+ */
+ dvbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
+ ip->cblanky, ip->cblankx, ip->ftheight,
+ ip->ftwidth, RR_COPYINVERTED);
+}
+
+void
+dvbox_deinit(ip)
+ register struct ite_data *ip;
+{
+ dvbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
+ db_waitbusy(ip->regbase);
+
+ ip->flags &= ~ITE_INITED;
+}
+
+void
+dvbox_putc(ip, c, dy, dx, mode)
+ struct ite_data *ip;
+ int dy, dx, c, mode;
+{
+ register int wrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
+
+ dvbox_windowmove(ip, charY(ip, c), charX(ip, c),
+ dy * ip->ftheight, dx * ip->ftwidth,
+ ip->ftheight, ip->ftwidth, wrr);
+}
+
+void
+dvbox_cursor(ip, flag)
+ struct ite_data *ip;
+ int flag;
+{
+ if (flag == DRAW_CURSOR)
+ draw_cursor(ip)
+ else if (flag == MOVE_CURSOR) {
+ erase_cursor(ip)
+ draw_cursor(ip)
+ }
+ else
+ erase_cursor(ip)
+}
+
+void
+dvbox_clear(ip, sy, sx, h, w)
+ struct ite_data *ip;
+ int sy, sx, h, w;
+{
+ dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
+ sy * ip->ftheight, sx * ip->ftwidth,
+ h * ip->ftheight, w * ip->ftwidth,
+ RR_CLEAR);
+}
+
+void
+dvbox_scroll(ip, sy, sx, count, dir)
+ struct ite_data *ip;
+ int sy, count, dir, sx;
+{
+ register int dy;
+ register int dx = sx;
+ register int height = 1;
+ register int width = ip->cols;
+
+ if (dir == SCROLL_UP) {
+ dy = sy - count;
+ height = ip->rows - sy;
+ }
+ else if (dir == SCROLL_DOWN) {
+ dy = sy + count;
+ height = ip->rows - dy - 1;
+ }
+ else if (dir == SCROLL_RIGHT) {
+ dy = sy;
+ dx = sx + count;
+ width = ip->cols - dx;
+ }
+ else {
+ dy = sy;
+ dx = sx - count;
+ width = ip->cols - sx;
+ }
+
+ dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
+ dy * ip->ftheight, dx * ip->ftwidth,
+ height * ip->ftheight,
+ width * ip->ftwidth, RR_COPY);
+}
+
+void
+dvbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
+ struct ite_data *ip;
+ int sy, sx, dy, dx, h, w, func;
+{
+ register struct dvboxfb *dp = REGBASE;
+ if (h == 0 || w == 0)
+ return;
+
+ db_waitbusy(ip->regbase);
+ dp->rep_rule = func << 4 | func;
+ dp->source_y = sy;
+ dp->source_x = sx;
+ dp->dest_y = dy;
+ dp->dest_x = dx;
+ dp->wheight = h;
+ dp->wwidth = w;
+ dp->wmove = 1;
+}
+
+/*
+ * DaVinci console support
+ */
+
+int
+dvbox_console_scan(scode, va, arg)
+ int scode;
+ caddr_t va;
+ void *arg;
+{
+ struct grfreg *grf = (struct grfreg *)va;
+ struct consdev *cp = arg;
+ u_char *dioiidev;
+ int force = 0, pri;
+
+ if ((grf->gr_id == GRFHWID) && (grf->gr_id2 == GID_DAVINCI)) {
+ pri = CN_NORMAL;
+
+#ifdef CONSCODE
+ /*
+ * Raise our priority, if appropriate.
+ */
+ if (scode == CONSCODE) {
+ pri = CN_REMOTE;
+ force = conforced = 1;
+ }
#endif
+
+ /* Only raise priority. */
+ if (pri > cp->cn_pri)
+ cp->cn_pri = pri;
+
+ /*
+ * If our priority is higher than the currently-remembered
+ * console, stash our priority.
+ */
+ if (((cn_tab == NULL) || (cp->cn_pri > cn_tab->cn_pri))
+ || force) {
+ cn_tab = cp;
+ if (scode >= 132) {
+ dioiidev = (u_char *)va;
+ return ((dioiidev[0x101] + 1) * 0x100000);
+ }
+ return (DIOCSIZE);
+ }
+ }
+ return (0);
+}
+
+void
+dvboxcnprobe(cp)
+ struct consdev *cp;
+{
+ int maj;
+ caddr_t va;
+ struct grfreg *grf;
+ int force = 0;
+
+ maj = ite_major();
+
+ /* initialize required fields */
+ cp->cn_dev = makedev(maj, 0); /* XXX */
+ cp->cn_pri = CN_DEAD;
+
+ /* Abort early if console is already forced. */
+ if (conforced)
+ return;
+
+ /* Look for "internal" framebuffer. */
+ va = (caddr_t)IIOV(GRFIADDR);
+ grf = (struct grfreg *)va;
+ if (!badaddr(va) &&
+ ((grf->gr_id == GRFHWID) && (grf->gr_id2 == GID_DAVINCI))) {
+ cp->cn_pri = CN_INTERNAL;
+
+#ifdef CONSCODE
+ /*
+ * Raise our priority and save some work, if appropriate.
+ */
+ if (CONSCODE == -1) {
+ cp->cn_pri = CN_REMOTE;
+ force = conforced = 1;
+ }
+#endif
+
+ /*
+ * If our priority is higher than the currently
+ * remembered console, stash our priority, and
+ * unmap whichever device might be currently mapped.
+ * Since we're internal, we set the saved size to 0
+ * so they don't attempt to unmap our fixed VA later.
+ */
+ if (((cn_tab == NULL) || (cp->cn_pri > cn_tab->cn_pri))
+ || force) {
+ cn_tab = cp;
+ if (convasize)
+ iounmap(conaddr, convasize);
+ conscode = -1;
+ conaddr = va;
+ convasize = 0;
+ }
+ }
+
+ console_scan(dvbox_console_scan, cp);
+}
+
+void
+dvboxcninit(cp)
+ struct consdev *cp;
+{
+ struct ite_data *ip = &ite_cn;
+ struct grf_data *gp = &grf_cn;
+
+ /*
+ * Initialize the framebuffer hardware.
+ */
+ (void)dv_init(gp, conscode, conaddr);
+
+ /*
+ * Set up required grf data.
+ */
+ gp->g_sw = &dvbox_grfsw;
+ gp->g_display.gd_id = gp->g_sw->gd_swid;
+ gp->g_flags = GF_ALIVE;
+
+ /*
+ * Set up required ite data and initialize ite.
+ */
+ ip->isw = &dvbox_itesw;
+ ip->grf = gp;
+ ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
+ ip->attrbuf = console_attributes;
+ iteinit(ip);
+
+ kbd_ite = ip; /* XXX */
+}
+
+#endif /* NITE > 0 */
+#endif /* NGRF > 0 */
-/* $NetBSD: grf_gb.c,v 1.4 1994/10/26 07:23:52 cgd Exp $ */
+/* $NetBSD: grf_gb.c,v 1.7 1996/03/03 16:48:58 thorpej Exp $ */
/*
+ * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* (as in 9837 Gator systems)
*/
#include <sys/param.h>
+#include <sys/conf.h>
#include <sys/errno.h>
+#include <sys/proc.h>
+#include <sys/ioctl.h>
+#include <sys/tty.h>
+#include <sys/systm.h>
+
+#include <machine/autoconf.h>
+#include <machine/cpu.h>
+
+#include <dev/cons.h>
#include <hp300/dev/grfioctl.h>
#include <hp300/dev/grfvar.h>
+#include <hp300/dev/grfreg.h>
#include <hp300/dev/grf_gbreg.h>
-#include <machine/cpu.h>
+#include <hp300/dev/itevar.h>
+#include <hp300/dev/itereg.h>
+
+#include "ite.h"
#define CRTC_DATA_LENGTH 0x0e
u_char crtc_init_data[CRTC_DATA_LENGTH] = {
0x30, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00
};
+int gb_init __P((struct grf_data *gp, int, caddr_t));
+int gb_mode __P((struct grf_data *gp, int, caddr_t));
+void gb_microcode __P((struct gboxfb *));
+
+/* Gatorbox grf switch */
+struct grfsw gbox_grfsw = {
+ GID_GATORBOX, GRFGATOR, "gatorbox", gb_init, gb_mode
+};
+
+#if NITE > 0
+void gbox_init __P((struct ite_data *));
+void gbox_deinit __P((struct ite_data *));
+void gbox_putc __P((struct ite_data *, int, int, int, int));
+void gbox_cursor __P((struct ite_data *, int));
+void gbox_clear __P((struct ite_data *, int, int, int, int));
+void gbox_scroll __P((struct ite_data *, int, int, int, int));
+void gbox_windowmove __P((struct ite_data *, int, int, int, int,
+ int, int, int));
+
+/* Gatorbox ite switch */
+struct itesw gbox_itesw = {
+ gbox_init, gbox_deinit, gbox_clear, gbox_putc,
+ gbox_cursor, gbox_scroll, ite_readbyte, ite_writeglyph
+};
+#endif /* NITE > 0 */
+
/*
* Initialize hardware.
* Must point g_display at a grfinfo structure describing the hardware.
* Returns 0 if hardware not present, non-zero ow.
*/
-gb_init(gp, addr)
- struct grf_softc *gp;
+int
+gb_init(gp, scode, addr)
+ struct grf_data *gp;
+ int scode;
caddr_t addr;
{
register struct gboxfb *gbp;
int fboff;
extern caddr_t sctopa(), iomap();
- gbp = (struct gboxfb *) addr;
- if (ISIIOVA(addr))
- gi->gd_regaddr = (caddr_t) IIOP(addr);
- else
- gi->gd_regaddr = sctopa(vatosc(addr));
- gi->gd_regsize = 0x10000;
- gi->gd_fbwidth = 1024; /* XXX */
- gi->gd_fbheight = 1024; /* XXX */
- gi->gd_fbsize = gi->gd_fbwidth * gi->gd_fbheight;
- fboff = (gbp->fbomsb << 8) | gbp->fbolsb;
- gi->gd_fbaddr = (caddr_t) (*((u_char *)addr + fboff) << 16);
- gp->g_regkva = addr;
- gp->g_fbkva = iomap(gi->gd_fbaddr, gi->gd_fbsize);
- gi->gd_dwidth = 1024; /* XXX */
- gi->gd_dheight = 768; /* XXX */
- gi->gd_planes = 0; /* how do we do this? */
/*
- * The minimal register info here is from the Gatorbox X driver.
+ * If the console has been initialized, and it was us, there's
+ * no need to repeat this.
*/
- fbp = (u_char *) gp->g_fbkva;
- gbp->write_protect = 0;
- gbp->interrupt = 4; /** fb_enable ? **/
- gbp->rep_rule = 3; /* GXcopy */
- gbp->blink1 = 0xff;
- gbp->blink2 = 0xff;
+ if (consinit_active || (scode != conscode)) {
+ gbp = (struct gboxfb *) addr;
+ if (ISIIOVA(addr))
+ gi->gd_regaddr = (caddr_t) IIOP(addr);
+ else
+ gi->gd_regaddr = sctopa(scode);
+ gi->gd_regsize = 0x10000;
+ gi->gd_fbwidth = 1024; /* XXX */
+ gi->gd_fbheight = 1024; /* XXX */
+ gi->gd_fbsize = gi->gd_fbwidth * gi->gd_fbheight;
+ fboff = (gbp->fbomsb << 8) | gbp->fbolsb;
+ gi->gd_fbaddr = (caddr_t) (*((u_char *)addr + fboff) << 16);
+ gp->g_regkva = addr;
+ gp->g_fbkva = iomap(gi->gd_fbaddr, gi->gd_fbsize);
+ gi->gd_dwidth = 1024; /* XXX */
+ gi->gd_dheight = 768; /* XXX */
+ gi->gd_planes = 0; /* how do we do this? */
+ /*
+ * The minimal register info here is from the Gatorbox X driver.
+ */
+ fbp = (u_char *) gp->g_fbkva;
+ gbp->write_protect = 0;
+ gbp->interrupt = 4; /** fb_enable ? **/
+ gbp->rep_rule = 3; /* GXcopy */
+ gbp->blink1 = 0xff;
+ gbp->blink2 = 0xff;
- gb_microcode(gbp);
+ gb_microcode(gbp);
- /*
- * Find out how many colors are available by determining
- * which planes are installed. That is, write all ones to
- * a frame buffer location, see how many ones are read back.
- */
- save = *fbp;
- *fbp = 0xFF;
- gi->gd_colors = *fbp + 1;
- *fbp = save;
+ /*
+ * Find out how many colors are available by determining
+ * which planes are installed. That is, write all ones to
+ * a frame buffer location, see how many ones are read back.
+ */
+ save = *fbp;
+ *fbp = 0xFF;
+ gi->gd_colors = *fbp + 1;
+ *fbp = save;
+ }
return(1);
}
/*
* Program the 6845.
*/
+void
gb_microcode(gbp)
- register struct gboxfb *gbp;
+ struct gboxfb *gbp;
{
register int i;
* Right now all we can do is grfon/grfoff.
* Return a UNIX error number or 0 for success.
*/
+int
gb_mode(gp, cmd, data)
- register struct grf_softc *gp;
+ register struct grf_data *gp;
int cmd;
caddr_t data;
{
struct gboxfb *gbp;
int error = 0;
- gbp = (struct gboxfb *) gp->g_regkva;
+ gbp = (struct gboxfb *)gp->g_regkva;
switch (cmd) {
case GM_GRFON:
gbp->sec_interrupt = 1;
return(error);
}
+#if NITE > 0
+
+/*
+ * Gatorbox ite routines
+ */
+
+#define REGBASE ((struct gboxfb *)(ip->regbase))
+#define WINDOWMOVER gbox_windowmove
+
+void
+gbox_init(ip)
+ register struct ite_data *ip;
+{
+ /* XXX */
+ if (ip->regbase == 0) {
+ struct grf_data *gp = ip->grf;
+
+ ip->regbase = gp->g_regkva;
+ ip->fbbase = gp->g_fbkva;
+ ip->fbwidth = gp->g_display.gd_fbwidth;
+ ip->fbheight = gp->g_display.gd_fbheight;
+ ip->dwidth = gp->g_display.gd_dwidth;
+ ip->dheight = gp->g_display.gd_dheight;
+ }
+
+ REGBASE->write_protect = 0x0;
+ REGBASE->interrupt = 0x4;
+ REGBASE->rep_rule = RR_COPY;
+ REGBASE->blink1 = 0xff;
+ REGBASE->blink2 = 0xff;
+ gb_microcode((struct gboxfb *)ip->regbase);
+ REGBASE->sec_interrupt = 0x01;
+
+ /*
+ * Set up the color map entries. We use three entries in the
+ * color map. The first, is for black, the second is for
+ * white, and the very last entry is for the inverted cursor.
+ */
+ REGBASE->creg_select = 0x00;
+ REGBASE->cmap_red = 0x00;
+ REGBASE->cmap_grn = 0x00;
+ REGBASE->cmap_blu = 0x00;
+ REGBASE->cmap_write = 0x00;
+ gbcm_waitbusy(ip->regbase);
+
+ REGBASE->creg_select = 0x01;
+ REGBASE->cmap_red = 0xFF;
+ REGBASE->cmap_grn = 0xFF;
+ REGBASE->cmap_blu = 0xFF;
+ REGBASE->cmap_write = 0x01;
+ gbcm_waitbusy(ip->regbase);
+
+ REGBASE->creg_select = 0xFF;
+ REGBASE->cmap_red = 0xFF;
+ REGBASE->cmap_grn = 0xFF;
+ REGBASE->cmap_blu = 0xFF;
+ REGBASE->cmap_write = 0x01;
+ gbcm_waitbusy(ip->regbase);
+
+ ite_fontinfo(ip);
+ ite_fontinit(ip);
+
+ /*
+ * Clear the display. This used to be before the font unpacking
+ * but it crashes. Figure it out later.
+ */
+ gbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
+ tile_mover_waitbusy(ip->regbase);
+
+ /*
+ * Stash the inverted cursor.
+ */
+ gbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
+ ip->cblanky, ip->cblankx, ip->ftheight,
+ ip->ftwidth, RR_COPYINVERTED);
+}
+
+void
+gbox_deinit(ip)
+ struct ite_data *ip;
+{
+ gbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
+ tile_mover_waitbusy(ip->regbase);
+
+ ip->flags &= ~ITE_INITED;
+}
+
+void
+gbox_putc(ip, c, dy, dx, mode)
+ struct ite_data *ip;
+ int dy, dx;
+ int c, mode;
+{
+ register int wrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
+
+ gbox_windowmove(ip, charY(ip, c), charX(ip, c),
+ dy * ip->ftheight, dx * ip->ftwidth,
+ ip->ftheight, ip->ftwidth, wrr);
+}
+
+void
+gbox_cursor(ip, flag)
+ struct ite_data *ip;
+ int flag;
+{
+ if (flag == DRAW_CURSOR)
+ draw_cursor(ip)
+ else if (flag == MOVE_CURSOR) {
+ erase_cursor(ip)
+ draw_cursor(ip)
+ }
+ else
+ erase_cursor(ip)
+}
+
+void
+gbox_clear(ip, sy, sx, h, w)
+ struct ite_data *ip;
+ int sy, sx, h, w;
+{
+ gbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
+ sy * ip->ftheight, sx * ip->ftwidth,
+ h * ip->ftheight, w * ip->ftwidth,
+ RR_CLEAR);
+}
+#define gbox_blockmove(ip, sy, sx, dy, dx, h, w) \
+ gbox_windowmove((ip), \
+ (sy) * ip->ftheight, \
+ (sx) * ip->ftwidth, \
+ (dy) * ip->ftheight, \
+ (dx) * ip->ftwidth, \
+ (h) * ip->ftheight, \
+ (w) * ip->ftwidth, \
+ RR_COPY)
+
+void
+gbox_scroll(ip, sy, sx, count, dir)
+ struct ite_data *ip;
+ int sy, dir, sx, count;
+{
+ register int height, dy, i;
+
+ tile_mover_waitbusy(ip->regbase);
+ REGBASE->write_protect = 0x0;
+
+ if (dir == SCROLL_UP) {
+ dy = sy - count;
+ height = ip->rows - sy;
+ for (i = 0; i < height; i++)
+ gbox_blockmove(ip, sy + i, sx, dy + i, 0, 1, ip->cols);
+ }
+ else if (dir == SCROLL_DOWN) {
+ dy = sy + count;
+ height = ip->rows - dy;
+ for (i = (height - 1); i >= 0; i--)
+ gbox_blockmove(ip, sy + i, sx, dy + i, 0, 1, ip->cols);
+ }
+ else if (dir == SCROLL_RIGHT) {
+ gbox_blockmove(ip, sy, sx, sy, sx + count,
+ 1, ip->cols - (sx + count));
+ }
+ else {
+ gbox_blockmove(ip, sy, sx, sy, sx - count,
+ 1, ip->cols - sx);
+ }
+}
+
+void
+gbox_windowmove(ip, sy, sx, dy, dx, h, w, mask)
+ struct ite_data *ip;
+ int sy, sx, dy, dx, mask, h, w;
+{
+ register int src, dest;
+
+ src = (sy * 1024) + sx; /* upper left corner in pixels */
+ dest = (dy * 1024) + dx;
+
+ tile_mover_waitbusy(ip->regbase);
+ REGBASE->width = -(w / 4);
+ REGBASE->height = -(h / 4);
+ if (src < dest)
+ REGBASE->rep_rule = MOVE_DOWN_RIGHT|mask;
+ else {
+ REGBASE->rep_rule = MOVE_UP_LEFT|mask;
+ /*
+ * Adjust to top of lower right tile of the block.
+ */
+ src = src + ((h - 4) * 1024) + (w - 4);
+ dest= dest + ((h - 4) * 1024) + (w - 4);
+ }
+ FBBASE[dest] = FBBASE[src];
+}
+
+/*
+ * Gatorbox console support
+ */
+
+int
+gbox_console_scan(scode, va, arg)
+ int scode;
+ caddr_t va;
+ void *arg;
+{
+ struct grfreg *grf = (struct grfreg *)va;
+ struct consdev *cp = arg;
+ u_char *dioiidev;
+ int force = 0, pri;
+
+ if ((grf->gr_id == GRFHWID) && (grf->gr_id2 == GID_GATORBOX)) {
+ pri = CN_NORMAL;
+
+#ifdef CONSCODE
+ /*
+ * Raise our priority, if appropriate.
+ */
+ if (scode == CONSCODE) {
+ pri = CN_REMOTE;
+ force = conforced = 1;
+ }
#endif
+
+ /* Only raise priority. */
+ if (pri > cp->cn_pri)
+ cp->cn_pri = pri;
+
+ /*
+ * If our priority is higher than the currently-remembered
+ * console, stash our priority.
+ */
+ if (((cn_tab == NULL) || (cp->cn_pri > cn_tab->cn_pri))
+ || force) {
+ cn_tab = cp;
+ if (scode >= 132) {
+ dioiidev = (u_char *)va;
+ return ((dioiidev[0x101] + 1) * 0x100000);
+ }
+ return (DIOCSIZE);
+ }
+ }
+ return (0);
+}
+
+void
+gboxcnprobe(cp)
+ struct consdev *cp;
+{
+ int maj;
+ caddr_t va;
+ struct grfreg *grf;
+ int force = 0;
+
+ maj = ite_major();
+
+ /* initialize required fields */
+ cp->cn_dev = makedev(maj, 0); /* XXX */
+ cp->cn_pri = CN_DEAD;
+
+ /* Abort early if console already forced. */
+ if (conforced)
+ return;
+
+ /* Look for "internal" framebuffer. */
+ va = (caddr_t)IIOV(GRFIADDR);
+ grf = (struct grfreg *)va;
+ if (!badaddr(va) &&
+ ((grf->gr_id == GRFHWID) && (grf->gr_id2 == GID_GATORBOX))) {
+ cp->cn_pri = CN_INTERNAL;
+
+#ifdef CONSCODE
+ /*
+ * Raise our priority and save some work, if appropriate.
+ */
+ if (CONSCODE == -1) {
+ cp->cn_pri = CN_REMOTE;
+ force = conforced = 1;
+ }
+#endif
+
+ /*
+ * If our priority is higher than the currently
+ * remembered console, stash our priority, and
+ * unmap whichever device might be currently mapped.
+ * Since we're internal, we set the saved size to 0
+ * so they don't attempt to unmap our fixed VA later.
+ */
+ if (((cn_tab == NULL) || (cp->cn_pri > cn_tab->cn_pri))
+ || force) {
+ cn_tab = cp;
+ if (convasize)
+ iounmap(conaddr, convasize);
+ conscode = -1;
+ conaddr = va;
+ convasize = 0;
+ }
+ }
+
+ console_scan(gbox_console_scan, cp);
+}
+
+void
+gboxcninit(cp)
+ struct consdev *cp;
+{
+ struct ite_data *ip = &ite_cn;
+ struct grf_data *gp = &grf_cn;
+
+ /*
+ * Initialize the framebuffer hardware.
+ */
+ (void)gb_init(gp, conscode, conaddr);
+
+ /*
+ * Set up required grf data.
+ */
+ gp->g_sw = &gbox_grfsw;
+ gp->g_display.gd_id = gp->g_sw->gd_swid;
+ gp->g_flags = GF_ALIVE;
+
+ /*
+ * Set up required ite data and initialize ite.
+ */
+ ip->isw = &gbox_itesw;
+ ip->grf = gp;
+ ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
+ ip->attrbuf = console_attributes;
+ iteinit(ip);
+
+ kbd_ite = ip; /* XXX */
+}
+
+#endif /* NITE > 0 */
+#endif /* NGRF > 0 */
-/* $NetBSD: grf_hy.c,v 1.2 1994/10/26 07:23:55 cgd Exp $ */
+/* $NetBSD: grf_hy.c,v 1.5 1996/03/03 16:49:00 thorpej Exp $ */
/*
+ * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* Copyright (c) 1991 University of Utah.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* Graphics routines for HYPERION frame buffer
*/
#include <sys/param.h>
+#include <sys/conf.h>
#include <sys/errno.h>
+#include <sys/proc.h>
+#include <sys/ioctl.h>
+#include <sys/tty.h>
+#include <sys/systm.h>
+#include <sys/uio.h>
+
+#include <machine/autoconf.h>
+#include <machine/cpu.h>
+
+#include <dev/cons.h>
#include <hp300/dev/grfioctl.h>
#include <hp300/dev/grfvar.h>
+#include <hp300/dev/grfreg.h>
#include <hp300/dev/grf_hyreg.h>
-#include <machine/cpu.h>
+#include <hp300/dev/itevar.h>
+#include <hp300/dev/itereg.h>
+
+#include "ite.h"
caddr_t badhyaddr = (caddr_t) -1;
+int hy_init __P((struct grf_data *gp, int, caddr_t));
+int hy_mode __P((struct grf_data *gp, int, caddr_t));
+void hyper_ite_fontinit __P((struct ite_data *));
+
+/* Hyperion grf switch */
+struct grfsw hyper_grfsw = {
+ GID_HYPERION, GRFHYPERION, "hyperion", hy_init, hy_mode
+};
+
+#if NITE > 0
+void hyper_init __P((struct ite_data *));
+void hyper_deinit __P((struct ite_data *));
+void hyper_int_fontinit __P((struct ite_data *));
+void hyper_putc __P((struct ite_data *, int, int, int, int));
+void hyper_cursor __P((struct ite_data *, int));
+void hyper_clear __P((struct ite_data *, int, int, int, int));
+void hyper_scroll __P((struct ite_data *, int, int, int, int));
+void hyper_windowmove __P((struct ite_data *, int, int, int, int,
+ int, int, int));
+
+/* Hyperion ite switch */
+struct itesw hyper_itesw = {
+ hyper_init, hyper_deinit, hyper_clear, hyper_putc,
+ hyper_cursor, hyper_scroll, ite_readbyte, ite_writeglyph
+};
+#endif /* NITE > 0 */
+
/*
* Initialize hardware.
* Must fill in the grfinfo structure in g_softc.
* Returns 0 if hardware not present, non-zero ow.
*/
-hy_init(gp, addr)
- struct grf_softc *gp;
+int
+hy_init(gp, scode, addr)
+ struct grf_data *gp;
+ int scode;
caddr_t addr;
{
register struct hyboxfb *hy = (struct hyboxfb *) addr;
int fboff;
extern caddr_t sctopa(), iomap();
- if (ISIIOVA(addr))
- gi->gd_regaddr = (caddr_t) IIOP(addr);
- else
- gi->gd_regaddr = sctopa(vatosc(addr));
- gi->gd_regsize = 0x20000;
- gi->gd_fbwidth = (hy->fbwmsb << 8) | hy->fbwlsb;
- gi->gd_fbheight = (hy->fbhmsb << 8) | hy->fbhlsb;
- gi->gd_fbsize = (gi->gd_fbwidth * gi->gd_fbheight) >> 3;
- fboff = (hy->fbomsb << 8) | hy->fbolsb;
- gi->gd_fbaddr = (caddr_t) (*((u_char *)addr + fboff) << 16);
- if (gi->gd_regaddr >= (caddr_t)DIOIIBASE) {
- /*
- * For DIO II space the fbaddr just computed is the offset
- * from the select code base (regaddr) of the framebuffer.
- * Hence it is also implicitly the size of the register set.
- */
- gi->gd_regsize = (int) gi->gd_fbaddr;
- gi->gd_fbaddr += (int) gi->gd_regaddr;
- gp->g_regkva = addr;
- gp->g_fbkva = addr + gi->gd_regsize;
- } else {
- /*
- * For DIO space we need to map the seperate framebuffer.
- */
- gp->g_regkva = addr;
- gp->g_fbkva = iomap(gi->gd_fbaddr, gi->gd_fbsize);
+ /*
+ * If the console has been initialized, and it was us, there's
+ * no need to repeat this.
+ */
+ if (consinit_active || (scode != conscode)) {
+ if (ISIIOVA(addr))
+ gi->gd_regaddr = (caddr_t) IIOP(addr);
+ else
+ gi->gd_regaddr = sctopa(scode);
+ gi->gd_regsize = 0x20000;
+ gi->gd_fbwidth = (hy->fbwmsb << 8) | hy->fbwlsb;
+ gi->gd_fbheight = (hy->fbhmsb << 8) | hy->fbhlsb;
+ gi->gd_fbsize = (gi->gd_fbwidth * gi->gd_fbheight) >> 3;
+ fboff = (hy->fbomsb << 8) | hy->fbolsb;
+ gi->gd_fbaddr = (caddr_t) (*((u_char *)addr + fboff) << 16);
+ if (gi->gd_regaddr >= (caddr_t)DIOIIBASE) {
+ /*
+ * For DIO II space the fbaddr just computed is
+ * the offset from the select code base (regaddr)
+ * of the framebuffer. Hence it is also implicitly
+ * the size of the register set.
+ */
+ gi->gd_regsize = (int) gi->gd_fbaddr;
+ gi->gd_fbaddr += (int) gi->gd_regaddr;
+ gp->g_regkva = addr;
+ gp->g_fbkva = addr + gi->gd_regsize;
+ } else {
+ /*
+ * For DIO space we need to map the seperate
+ * framebuffer.
+ */
+ gp->g_regkva = addr;
+ gp->g_fbkva = iomap(gi->gd_fbaddr, gi->gd_fbsize);
+ }
+ gi->gd_dwidth = (hy->dwmsb << 8) | hy->dwlsb;
+ gi->gd_dheight = (hy->dhmsb << 8) | hy->dhlsb;
+ gi->gd_planes = hy->num_planes;
+ gi->gd_colors = 1 << gi->gd_planes;
}
- gi->gd_dwidth = (hy->dwmsb << 8) | hy->dwlsb;
- gi->gd_dheight = (hy->dhmsb << 8) | hy->dhlsb;
- gi->gd_planes = hy->num_planes;
- gi->gd_colors = 1 << gi->gd_planes;
-
return(1);
}
* Return a UNIX error number or 0 for success.
* Function may not be needed anymore.
*/
+int
hy_mode(gp, cmd, data)
- struct grf_softc *gp;
+ struct grf_data *gp;
int cmd;
caddr_t data;
{
}
return(error);
}
+
+#if NITE > 0
+
+/*
+ * Hyperion ite routines
+ */
+
+#define REGBASE ((struct hyboxfb *)(ip->regbase))
+#define WINDOWMOVER hyper_windowmove
+
+#undef charX
+#define charX(ip,c) \
+ (((c) % (ip)->cpl) * ((((ip)->ftwidth + 7) / 8) * 8) + (ip)->fontx)
+
+void
+hyper_init(ip)
+ struct ite_data *ip;
+{
+ int width;
+
+ /* XXX */
+ if (ip->regbase == NULL) {
+ struct grf_data *gp = ip->grf;
+
+ ip->regbase = gp->g_regkva;
+ ip->fbbase = gp->g_fbkva;
+ ip->fbwidth = gp->g_display.gd_fbwidth;
+ ip->fbheight = gp->g_display.gd_fbheight;
+ ip->dwidth = gp->g_display.gd_dwidth;
+ ip->dheight = gp->g_display.gd_dheight;
+ }
+
+ ite_fontinfo(ip);
+ width = ((ip->ftwidth + 7) / 8) * 8;
+ ip->cpl = (ip->fbwidth - ip->dwidth) / width;
+ ip->cblanky = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight;
+
+ /*
+ * Clear the framebuffer on all planes.
+ */
+ hyper_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
+
+ hyper_ite_fontinit(ip);
+
+ REGBASE->nblank = 0x05;
+
+ /*
+ * Stash the inverted cursor.
+ */
+ hyper_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
+ ip->cblanky, ip->cblankx, ip->ftheight,
+ ip->ftwidth, RR_COPYINVERTED);
+}
+
+void
+hyper_deinit(ip)
+ struct ite_data *ip;
+{
+ hyper_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
+
+ REGBASE->nblank = 0x05;
+ ip->flags &= ~ITE_INITED;
+}
+
+void
+hyper_ite_fontinit(ip)
+ struct ite_data *ip;
+{
+ register u_char *fbmem, *dp;
+ int c, l, b;
+ int stride, width;
+
+ dp = (u_char *)(getword(ip, getword(ip, FONTROM) + FONTADDR) +
+ ip->regbase) + FONTDATA;
+ stride = ip->fbwidth >> 3;
+ width = (ip->ftwidth + 7) / 8;
+
+ for (c = 0; c < 128; c++) {
+ fbmem = (u_char *) FBBASE +
+ (ip->fonty + (c / ip->cpl) * ip->ftheight) *
+ stride;
+ fbmem += (ip->fontx >> 3) + (c % ip->cpl) * width;
+ for (l = 0; l < ip->ftheight; l++) {
+ for (b = 0; b < width; b++) {
+ *fbmem++ = *dp;
+ dp += 2;
+ }
+ fbmem -= width;
+ fbmem += stride;
+ }
+ }
+}
+
+void
+hyper_putc(ip, c, dy, dx, mode)
+ struct ite_data *ip;
+ int c, dy, dx, mode;
+{
+ int wmrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
+
+ hyper_windowmove(ip, charY(ip, c), charX(ip, c),
+ dy * ip->ftheight, dx * ip->ftwidth,
+ ip->ftheight, ip->ftwidth, wmrr);
+}
+
+void
+hyper_cursor(ip, flag)
+ struct ite_data *ip;
+ int flag;
+{
+ if (flag == DRAW_CURSOR)
+ draw_cursor(ip)
+ else if (flag == MOVE_CURSOR) {
+ erase_cursor(ip)
+ draw_cursor(ip)
+ }
+ else
+ erase_cursor(ip)
+}
+
+void
+hyper_clear(ip, sy, sx, h, w)
+ struct ite_data *ip;
+ int sy, sx, h, w;
+{
+ hyper_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
+ sy * ip->ftheight, sx * ip->ftwidth,
+ h * ip->ftheight, w * ip->ftwidth,
+ RR_CLEAR);
+}
+
+void
+hyper_scroll(ip, sy, sx, count, dir)
+ struct ite_data *ip;
+ int sy, count, dir, sx;
+{
+ register int dy;
+ register int dx = sx;
+ register int height = 1;
+ register int width = ip->cols;
+
+ if (dir == SCROLL_UP) {
+ dy = sy - count;
+ height = ip->rows - sy;
+ }
+ else if (dir == SCROLL_DOWN) {
+ dy = sy + count;
+ height = ip->rows - dy - 1;
+ }
+ else if (dir == SCROLL_RIGHT) {
+ dy = sy;
+ dx = sx + count;
+ width = ip->cols - dx;
+ }
+ else {
+ dy = sy;
+ dx = sx - count;
+ width = ip->cols - sx;
+ }
+
+ hyper_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
+ dy * ip->ftheight, dx * ip->ftwidth,
+ height * ip->ftheight,
+ width * ip->ftwidth, RR_COPY);
+}
+
+#include <hp300/dev/maskbits.h>
+
+/* NOTE:
+ * the first element in starttab could be 0xffffffff. making it 0
+ * lets us deal with a full first word in the middle loop, rather
+ * than having to do the multiple reads and masks that we'd
+ * have to do if we thought it was partial.
+ */
+int starttab[32] =
+ {
+ 0x00000000,
+ 0x7FFFFFFF,
+ 0x3FFFFFFF,
+ 0x1FFFFFFF,
+ 0x0FFFFFFF,
+ 0x07FFFFFF,
+ 0x03FFFFFF,
+ 0x01FFFFFF,
+ 0x00FFFFFF,
+ 0x007FFFFF,
+ 0x003FFFFF,
+ 0x001FFFFF,
+ 0x000FFFFF,
+ 0x0007FFFF,
+ 0x0003FFFF,
+ 0x0001FFFF,
+ 0x0000FFFF,
+ 0x00007FFF,
+ 0x00003FFF,
+ 0x00001FFF,
+ 0x00000FFF,
+ 0x000007FF,
+ 0x000003FF,
+ 0x000001FF,
+ 0x000000FF,
+ 0x0000007F,
+ 0x0000003F,
+ 0x0000001F,
+ 0x0000000F,
+ 0x00000007,
+ 0x00000003,
+ 0x00000001
+ };
+
+int endtab[32] =
+ {
+ 0x00000000,
+ 0x80000000,
+ 0xC0000000,
+ 0xE0000000,
+ 0xF0000000,
+ 0xF8000000,
+ 0xFC000000,
+ 0xFE000000,
+ 0xFF000000,
+ 0xFF800000,
+ 0xFFC00000,
+ 0xFFE00000,
+ 0xFFF00000,
+ 0xFFF80000,
+ 0xFFFC0000,
+ 0xFFFE0000,
+ 0xFFFF0000,
+ 0xFFFF8000,
+ 0xFFFFC000,
+ 0xFFFFE000,
+ 0xFFFFF000,
+ 0xFFFFF800,
+ 0xFFFFFC00,
+ 0xFFFFFE00,
+ 0xFFFFFF00,
+ 0xFFFFFF80,
+ 0xFFFFFFC0,
+ 0xFFFFFFE0,
+ 0xFFFFFFF0,
+ 0xFFFFFFF8,
+ 0xFFFFFFFC,
+ 0xFFFFFFFE
+ };
+
+void
+hyper_windowmove(ip, sy, sx, dy, dx, h, w, func)
+ struct ite_data *ip;
+ int sy, sx, dy, dx, h, w, func;
+{
+ int width; /* add to get to same position in next line */
+
+ unsigned int *psrcLine, *pdstLine;
+ /* pointers to line with current src and dst */
+ register unsigned int *psrc; /* pointer to current src longword */
+ register unsigned int *pdst; /* pointer to current dst longword */
+
+ /* following used for looping through a line */
+ unsigned int startmask, endmask; /* masks for writing ends of dst */
+ int nlMiddle; /* whole longwords in dst */
+ register int nl; /* temp copy of nlMiddle */
+ register unsigned int tmpSrc;
+ /* place to store full source word */
+ register int xoffSrc; /* offset (>= 0, < 32) from which to
+ fetch whole longwords fetched
+ in src */
+ int nstart; /* number of ragged bits at start of dst */
+ int nend; /* number of ragged bits at end of dst */
+ int srcStartOver; /* pulling nstart bits from src
+ overflows into the next word? */
+
+ if (h == 0 || w == 0)
+ return;
+
+ width = ip->fbwidth >> 5;
+
+ if (sy < dy) /* start at last scanline of rectangle */
+ {
+ psrcLine = ((unsigned int *) ip->fbbase) + ((sy+h-1) * width);
+ pdstLine = ((unsigned int *) ip->fbbase) + ((dy+h-1) * width);
+ width = -width;
+ }
+ else /* start at first scanline */
+ {
+ psrcLine = ((unsigned int *) ip->fbbase) + (sy * width);
+ pdstLine = ((unsigned int *) ip->fbbase) + (dy * width);
+ }
+
+ /* x direction doesn't matter for < 1 longword */
+ if (w <= 32)
+ {
+ int srcBit, dstBit; /* bit offset of src and dst */
+
+ pdstLine += (dx >> 5);
+ psrcLine += (sx >> 5);
+ psrc = psrcLine;
+ pdst = pdstLine;
+
+ srcBit = sx & 0x1f;
+ dstBit = dx & 0x1f;
+
+ while(h--)
+ {
+ getandputrop(psrc, srcBit, dstBit, w, pdst, func)
+ pdst += width;
+ psrc += width;
+ }
+ }
+ else
+ {
+ maskbits(dx, w, startmask, endmask, nlMiddle)
+ if (startmask)
+ nstart = 32 - (dx & 0x1f);
+ else
+ nstart = 0;
+ if (endmask)
+ nend = (dx + w) & 0x1f;
+ else
+ nend = 0;
+
+ xoffSrc = ((sx & 0x1f) + nstart) & 0x1f;
+ srcStartOver = ((sx & 0x1f) + nstart) > 31;
+
+ if (sx >= dx) /* move left to right */
+ {
+ pdstLine += (dx >> 5);
+ psrcLine += (sx >> 5);
+
+ while (h--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+
+ if (startmask)
+ {
+ getandputrop(psrc, (sx & 0x1f),
+ (dx & 0x1f), nstart, pdst, func)
+ pdst++;
+ if (srcStartOver)
+ psrc++;
+ }
+
+ /* special case for aligned operations */
+ if (xoffSrc == 0)
+ {
+ nl = nlMiddle;
+ while (nl--)
+ {
+ DoRop (*pdst, func, *psrc++, *pdst);
+ pdst++;
+ }
+ }
+ else
+ {
+ nl = nlMiddle + 1;
+ while (--nl)
+ {
+ getunalignedword (psrc, xoffSrc, tmpSrc)
+ DoRop (*pdst, func, tmpSrc, *pdst);
+ pdst++;
+ psrc++;
+ }
+ }
+
+ if (endmask)
+ {
+ getandputrop0(psrc, xoffSrc, nend, pdst, func);
+ }
+
+ pdstLine += width;
+ psrcLine += width;
+ }
+ }
+ else /* move right to left */
+ {
+ pdstLine += (dx+w >> 5);
+ psrcLine += (sx+w >> 5);
+ /* if fetch of last partial bits from source crosses
+ a longword boundary, start at the previous longword
+ */
+ if (xoffSrc + nend >= 32)
+ --psrcLine;
+
+ while (h--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+
+ if (endmask)
+ {
+ getandputrop0(psrc, xoffSrc, nend, pdst, func);
+ }
+
+ nl = nlMiddle + 1;
+ while (--nl)
+ {
+ --psrc;
+ --pdst;
+ getunalignedword(psrc, xoffSrc, tmpSrc)
+ DoRop(*pdst, func, tmpSrc, *pdst);
+ }
+
+ if (startmask)
+ {
+ if (srcStartOver)
+ --psrc;
+ --pdst;
+ getandputrop(psrc, (sx & 0x1f),
+ (dx & 0x1f), nstart, pdst, func)
+ }
+
+ pdstLine += width;
+ psrcLine += width;
+ }
+ } /* move right to left */
+ }
+}
+
+/*
+ * Hyperion console support
+ */
+
+int
+hyper_console_scan(scode, va, arg)
+ int scode;
+ caddr_t va;
+ void *arg;
+{
+ struct grfreg *grf = (struct grfreg *)va;
+ struct consdev *cp = arg;
+ u_char *dioiidev;
+ int force = 0, pri;
+
+ if ((grf->gr_id == GRFHWID) && (grf->gr_id2 == GID_HYPERION)) {
+ pri = CN_NORMAL;
+
+#ifdef CONSCODE
+ /*
+ * Raise our prioity, if appropriate.
+ */
+ if (scode == CONSCODE) {
+ pri = CN_REMOTE;
+ force = conforced = 1;
+ }
#endif
+
+ /* Only raise priority. */
+ if (pri > cp->cn_pri)
+ cp->cn_pri = pri;
+
+ /*
+ * If our priority is higher than the currently-remembered
+ * console, stash our priority.
+ */
+ if (((cn_tab == NULL) || (cp->cn_pri > cn_tab->cn_pri))
+ || force) {
+ cn_tab = cp;
+ if (scode >= 132) {
+ dioiidev = (u_char *)va;
+ return ((dioiidev[0x101] + 1) * 0x100000);
+ }
+ return (DIOCSIZE);
+ }
+ }
+ return (0);
+}
+
+void
+hypercnprobe(cp)
+ struct consdev *cp;
+{
+ int maj;
+ caddr_t va;
+ struct grfreg *grf;
+ int force = 0;
+
+ maj = ite_major();
+
+ /* initialize required fields */
+ cp->cn_dev = makedev(maj, 0); /* XXX */
+ cp->cn_pri = CN_DEAD;
+
+ /* Abort early if console is already forced. */
+ if (conforced)
+ return;
+
+ /* Look for "internal" framebuffer. */
+ va = (caddr_t)IIOV(GRFIADDR);
+ grf = (struct grfreg *)va;
+ if (!badaddr(va) &&
+ ((grf->gr_id == GRFHWID) && (grf->gr_id2 == GID_HYPERION))) {
+ cp->cn_pri = CN_INTERNAL;
+
+#ifdef CONSCODE
+ /*
+ * Raise our priority and save some work, if appropriate.
+ */
+ if (CONSCODE == -1) {
+ cp->cn_pri = CN_REMOTE;
+ force = conforced = 1;
+ }
+#endif
+
+ /*
+ * If our priority is higher than the currently
+ * remembered console, stash our priority, and
+ * unmap whichever device might be currently mapped.
+ * Since we're internal, we set the saved size to 0
+ * so they don't attempt to unmap our fixed VA later.
+ */
+ if (((cn_tab == NULL) || (cp->cn_pri > cn_tab->cn_pri))
+ || force) {
+ cn_tab = cp;
+ if (convasize)
+ iounmap(conaddr, convasize);
+ conscode = -1;
+ conaddr = va;
+ convasize = 0;
+ }
+ }
+
+ console_scan(hyper_console_scan, cp);
+}
+
+void
+hypercninit(cp)
+ struct consdev *cp;
+{
+ struct ite_data *ip = &ite_cn;
+ struct grf_data *gp = &grf_cn;
+
+ /*
+ * Initialize the framebuffer hardware.
+ */
+ (void)hy_init(gp, conscode, conaddr);
+
+ /*
+ * Set up required grf data.
+ */
+ gp->g_sw = &hyper_grfsw;
+ gp->g_display.gd_id = gp->g_sw->gd_swid;
+ gp->g_flags = GF_ALIVE;
+
+ /*
+ * Set up required ite data and initialize ite.
+ */
+ ip->isw = &hyper_itesw;
+ ip->grf = gp;
+ ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
+ ip->attrbuf = console_attributes;
+ iteinit(ip);
+
+ kbd_ite = ip; /* XXX */
+}
+
+#endif /* NITE > 0 */
+#endif /* NGRF > 0 */
-/* $NetBSD: grf_machdep.c,v 1.3 1995/12/02 18:21:58 thorpej Exp $ */
+/* $NetBSD: grf_machdep.c,v 1.4 1996/02/24 00:55:13 thorpej Exp $ */
/*
+ * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* Copyright (c) 1991 University of Utah.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
#if NGRF > 0
#include <sys/param.h>
+#include <sys/malloc.h>
+#include <sys/systm.h>
+
+#include <machine/autoconf.h>
#include <hp300/dev/device.h>
#include <hp300/dev/grfioctl.h>
#include <hp300/dev/grfvar.h>
#include <hp300/dev/grfreg.h>
+#include <hp300/dev/itevar.h>
+
+#include "ite.h"
+
int grfmatch();
void grfattach();
-struct driver grfdriver = { grfmatch, grfattach, "grf" };
-/*
- * XXX called from ite console init routine.
- * Does just what configure will do later but without printing anything.
- */
-grfconfig()
-{
- register caddr_t addr;
- register struct hp_hw *hw;
- register struct hp_device *hd, *nhd;
+int grfinit __P((struct hp_device *, struct grf_data *, int));
- for (hw = sc_table; hw->hw_type; hw++) {
- if (!HW_ISDEV(hw, D_BITMAP))
- continue;
- /*
- * Found one, now match up with a logical unit number
- */
- nhd = NULL;
- addr = hw->hw_kva;
- for (hd = hp_dinit; hd->hp_driver; hd++) {
- if (hd->hp_driver != &grfdriver || hd->hp_alive)
- continue;
- /*
- * Wildcarded. If first, remember as possible match.
- */
- if (hd->hp_addr == NULL) {
- if (nhd == NULL)
- nhd = hd;
- continue;
- }
- /*
- * Not wildcarded.
- * If exact match done searching, else keep looking.
- */
- if (sctova(hd->hp_addr) == addr) {
- nhd = hd;
- break;
- }
- }
- /*
- * Found a match, initialize
- */
- if (nhd && grfinit(addr, nhd->hp_unit))
- nhd->hp_addr = addr;
- }
-}
+struct driver grfdriver = { grfmatch, grfattach, "grf" };
-/*
- * Normal init routine called by configure() code
- */
int
grfmatch(hd)
struct hp_device *hd;
{
- struct grf_softc *gp = &grf_softc[hd->hp_unit];
+ struct grf_softc *sc = &grf_softc[hd->hp_unit];
+ int scode;
- if ((gp->g_flags & GF_ALIVE) == 0 &&
- !grfinit(hd->hp_addr, hd->hp_unit))
+ if (hd->hp_args->hw_pa == (caddr_t)GRFIADDR) /* XXX */
+ scode = -1;
+ else
+ scode = hd->hp_args->hw_sc;
+
+ if (scode == conscode) {
+ /*
+ * We've already been initialized.
+ */
+ sc->sc_data = &grf_cn;
+ return (1);
+ }
+
+ /*
+ * Allocate storage space for the grf_data.
+ */
+ sc->sc_data = (struct grf_data *)malloc(sizeof(struct grf_data),
+ M_DEVBUF, M_NOWAIT);
+ if (sc->sc_data == NULL) {
+ printf("grfmatch: malloc for grf_data failed\n");
return (0);
+ }
+ bzero(sc->sc_data, sizeof(struct grf_data));
- return(1);
+ return (grfinit(hd, sc->sc_data, scode));
}
void
grfattach(hd)
struct hp_device *hd;
{
- struct grf_softc *gp = &grf_softc[hd->hp_unit];
+ struct grf_softc *sc = &grf_softc[hd->hp_unit];
+ struct grf_data *gp = sc->sc_data;
+ int scode, isconsole;
+
+ if (hd->hp_args->hw_pa == (caddr_t)GRFIADDR) /* XXX */
+ scode = -1;
+ else
+ scode = hd->hp_args->hw_sc;
+
+ if (scode == conscode)
+ isconsole = 1;
+ else
+ isconsole = 0;
printf(": %d x %d ", gp->g_display.gd_dwidth,
gp->g_display.gd_dheight);
printf("monochrome");
else
printf("%d color", gp->g_display.gd_colors);
- printf(" %s display\n", gp->g_sw->gd_desc);
+ printf(" %s display", gp->g_sw->gd_desc);
+ if (isconsole)
+ printf(" (console)");
+ printf("\n");
+
+#if NITE > 0
+ /* XXX hack */
+ ite_attach_grf(hd->hp_unit, isconsole);
+#endif /* NITE > 0 */
}
-grfinit(addr, unit)
- caddr_t addr;
- int unit;
+int
+grfinit(hd, gp, scode)
+ struct hp_device *hd;
+ struct grf_data *gp;
+ int scode;
{
- struct grf_softc *gp = &grf_softc[unit];
register struct grfsw *gsw;
struct grfreg *gr;
+ caddr_t addr = hd->hp_addr;
+ int i;
gr = (struct grfreg *) addr;
if (gr->gr_id != GRFHWID)
return(0);
- for (gsw = grfsw; gsw < &grfsw[ngrfsw]; gsw++)
+ for (i = 0; i < ngrfsw; ++i) {
+ gsw = grfsw[i];
if (gsw->gd_hwid == gr->gr_id2)
break;
- if (gsw < &grfsw[ngrfsw] && (*gsw->gd_init)(gp, addr)) {
+ }
+ if ((i < ngrfsw) && (*gsw->gd_init)(gp, scode, addr)) {
gp->g_sw = gsw;
gp->g_display.gd_id = gsw->gd_swid;
gp->g_flags = GF_ALIVE;
}
return(0);
}
-#endif
+#endif /* NGRF > 0 */
-/* $NetBSD: grf_rb.c,v 1.4 1994/10/26 07:24:01 cgd Exp $ */
+/* $NetBSD: grf_rb.c,v 1.7 1996/03/03 16:49:02 thorpej Exp $ */
/*
+ * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* Graphics routines for the Renaissance, HP98720 Graphics system.
*/
#include <sys/param.h>
+#include <sys/conf.h>
#include <sys/errno.h>
+#include <sys/proc.h>
+#include <sys/ioctl.h>
+#include <sys/tty.h>
+#include <sys/systm.h>
+
+#include <machine/autoconf.h>
+#include <machine/cpu.h>
+
+#include <dev/cons.h>
#include <hp300/dev/grfioctl.h>
#include <hp300/dev/grfvar.h>
+#include <hp300/dev/grfreg.h>
#include <hp300/dev/grf_rbreg.h>
-#include <machine/cpu.h>
+#include <hp300/dev/itevar.h>
+#include <hp300/dev/itereg.h>
+
+#include "ite.h"
+
+int rb_init __P((struct grf_data *gp, int, caddr_t));
+int rb_mode __P((struct grf_data *gp, int, caddr_t));
+
+/* Renaissance grf switch */
+struct grfsw rbox_grfsw = {
+ GID_RENAISSANCE, GRFRBOX, "renaissance", rb_init, rb_mode
+};
+
+#if NITE > 0
+void rbox_init __P((struct ite_data *));
+void rbox_deinit __P((struct ite_data *));
+void rbox_putc __P((struct ite_data *, int, int, int, int));
+void rbox_cursor __P((struct ite_data *, int));
+void rbox_clear __P((struct ite_data *, int, int, int, int));
+void rbox_scroll __P((struct ite_data *, int, int, int, int));
+void rbox_windowmove __P((struct ite_data *, int, int, int, int,
+ int, int, int));
+
+/* Renaissance ite switch */
+struct itesw rbox_itesw = {
+ rbox_init, rbox_deinit, rbox_clear, rbox_putc,
+ rbox_cursor, rbox_scroll, ite_readbyte, ite_writeglyph
+};
+#endif /* NITE > 0 */
/*
* Initialize hardware.
* Must point g_display at a grfinfo structure describing the hardware.
* Returns 0 if hardware not present, non-zero ow.
*/
-rb_init(gp, addr)
- struct grf_softc *gp;
+int
+rb_init(gp, scode, addr)
+ struct grf_data *gp;
+ int scode;
caddr_t addr;
{
register struct rboxfb *rbp;
int fboff;
extern caddr_t sctopa(), iomap();
- rbp = (struct rboxfb *) addr;
- if (ISIIOVA(addr))
- gi->gd_regaddr = (caddr_t) IIOP(addr);
- else
- gi->gd_regaddr = sctopa(vatosc(addr));
- gi->gd_regsize = 0x20000;
- gi->gd_fbwidth = (rbp->fbwmsb << 8) | rbp->fbwlsb;
- gi->gd_fbheight = (rbp->fbhmsb << 8) | rbp->fbhlsb;
- gi->gd_fbsize = gi->gd_fbwidth * gi->gd_fbheight;
- fboff = (rbp->fbomsb << 8) | rbp->fbolsb;
- gi->gd_fbaddr = (caddr_t) (*((u_char *)addr + fboff) << 16);
- if (gi->gd_regaddr >= (caddr_t)DIOIIBASE) {
- /*
- * For DIO II space the fbaddr just computed is the offset
- * from the select code base (regaddr) of the framebuffer.
- * Hence it is also implicitly the size of the register set.
- */
- gi->gd_regsize = (int) gi->gd_fbaddr;
- gi->gd_fbaddr += (int) gi->gd_regaddr;
- gp->g_regkva = addr;
- gp->g_fbkva = addr + gi->gd_regsize;
- } else {
- /*
- * For DIO space we need to map the seperate framebuffer.
- */
- gp->g_regkva = addr;
- gp->g_fbkva = iomap(gi->gd_fbaddr, gi->gd_fbsize);
+ /*
+ * If the console has been initialized, and it was us, there's
+ * no need to repeat this.
+ */
+ if (consinit_active || (scode != conscode)) {
+ rbp = (struct rboxfb *) addr;
+ if (ISIIOVA(addr))
+ gi->gd_regaddr = (caddr_t) IIOP(addr);
+ else
+ gi->gd_regaddr = sctopa(scode);
+ gi->gd_regsize = 0x20000;
+ gi->gd_fbwidth = (rbp->fbwmsb << 8) | rbp->fbwlsb;
+ gi->gd_fbheight = (rbp->fbhmsb << 8) | rbp->fbhlsb;
+ gi->gd_fbsize = gi->gd_fbwidth * gi->gd_fbheight;
+ fboff = (rbp->fbomsb << 8) | rbp->fbolsb;
+ gi->gd_fbaddr = (caddr_t) (*((u_char *)addr + fboff) << 16);
+ if (gi->gd_regaddr >= (caddr_t)DIOIIBASE) {
+ /*
+ * For DIO II space the fbaddr just computed is
+ * the offset from the select code base (regaddr)
+ * of the framebuffer. Hence it is also implicitly
+ * the size of the register set.
+ */
+ gi->gd_regsize = (int) gi->gd_fbaddr;
+ gi->gd_fbaddr += (int) gi->gd_regaddr;
+ gp->g_regkva = addr;
+ gp->g_fbkva = addr + gi->gd_regsize;
+ } else {
+ /*
+ * For DIO space we need to map the seperate
+ * framebuffer.
+ */
+ gp->g_regkva = addr;
+ gp->g_fbkva = iomap(gi->gd_fbaddr, gi->gd_fbsize);
+ }
+ gi->gd_dwidth = (rbp->dwmsb << 8) | rbp->dwlsb;
+ gi->gd_dheight = (rbp->dwmsb << 8) | rbp->dwlsb;
+ gi->gd_planes = 0; /* ?? */
+ gi->gd_colors = 256;
}
- gi->gd_dwidth = (rbp->dwmsb << 8) | rbp->dwlsb;
- gi->gd_dheight = (rbp->dwmsb << 8) | rbp->dwlsb;
- gi->gd_planes = 0; /* ?? */
- gi->gd_colors = 256;
return(1);
}
* Right now all we can do is grfon/grfoff.
* Return a UNIX error number or 0 for success.
*/
+int
rb_mode(gp, cmd, data)
- register struct grf_softc *gp;
+ register struct grf_data *gp;
int cmd;
caddr_t data;
{
return(error);
}
+#if NITE > 0
+
+/*
+ * Renaissance ite routines
+ */
+
+#define REGBASE ((struct rboxfb *)(ip->regbase))
+#define WINDOWMOVER rbox_windowmove
+
+void
+rbox_init(ip)
+ struct ite_data *ip;
+{
+ register int i;
+
+ /* XXX */
+ if (ip->regbase == 0) {
+ struct grf_data *gp = ip->grf;
+
+ ip->regbase = gp->g_regkva;
+ ip->fbbase = gp->g_fbkva;
+ ip->fbwidth = gp->g_display.gd_fbwidth;
+ ip->fbheight = gp->g_display.gd_fbheight;
+ ip->dwidth = gp->g_display.gd_dwidth;
+ ip->dheight = gp->g_display.gd_dheight;
+ /*
+ * XXX some displays (e.g. the davinci) appear
+ * to return a display height greater than the
+ * returned FB height. Guess we should go back
+ * to getting the display dimensions from the
+ * fontrom...
+ */
+ if (ip->dwidth > ip->fbwidth)
+ ip->dwidth = ip->fbwidth;
+ if (ip->dheight > ip->fbheight)
+ ip->dheight = ip->fbheight;
+ }
+
+ rb_waitbusy(ip->regbase);
+
+ REGBASE->reset = 0x39;
+ DELAY(1000);
+
+ REGBASE->interrupt = 0x04;
+ REGBASE->display_enable = 0x01;
+ REGBASE->video_enable = 0x01;
+ REGBASE->drive = 0x01;
+ REGBASE->vdrive = 0x0;
+
+ ite_fontinfo(ip);
+
+ REGBASE->opwen = 0xFF;
+
+ /*
+ * Clear the framebuffer.
+ */
+ rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
+ rb_waitbusy(ip->regbase);
+
+ for(i = 0; i < 16; i++) {
+ *(ip->regbase + 0x63c3 + i*4) = 0x0;
+ *(ip->regbase + 0x6403 + i*4) = 0x0;
+ *(ip->regbase + 0x6803 + i*4) = 0x0;
+ *(ip->regbase + 0x6c03 + i*4) = 0x0;
+ *(ip->regbase + 0x73c3 + i*4) = 0x0;
+ *(ip->regbase + 0x7403 + i*4) = 0x0;
+ *(ip->regbase + 0x7803 + i*4) = 0x0;
+ *(ip->regbase + 0x7c03 + i*4) = 0x0;
+ }
+
+ REGBASE->rep_rule = 0x33;
+
+ /*
+ * I cannot figure out how to make the blink planes stop. So, we
+ * must set both colormaps so that when the planes blink, and
+ * the secondary colormap is active, we still get text.
+ */
+ CM1RED[0x00].value = 0x00;
+ CM1GRN[0x00].value = 0x00;
+ CM1BLU[0x00].value = 0x00;
+ CM1RED[0x01].value = 0xFF;
+ CM1GRN[0x01].value = 0xFF;
+ CM1BLU[0x01].value = 0xFF;
+
+ CM2RED[0x00].value = 0x00;
+ CM2GRN[0x00].value = 0x00;
+ CM2BLU[0x00].value = 0x00;
+ CM2RED[0x01].value = 0xFF;
+ CM2GRN[0x01].value = 0xFF;
+ CM2BLU[0x01].value = 0xFF;
+
+ REGBASE->blink = 0x00;
+ REGBASE->write_enable = 0x01;
+ REGBASE->opwen = 0x00;
+
+ ite_fontinit(ip);
+
+ /*
+ * Stash the inverted cursor.
+ */
+ rbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
+ ip->cblanky, ip->cblankx, ip->ftheight,
+ ip->ftwidth, RR_COPYINVERTED);
+}
+
+void
+rbox_deinit(ip)
+ struct ite_data *ip;
+{
+ rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
+ rb_waitbusy(ip->regbase);
+
+ ip->flags &= ~ITE_INITED;
+}
+
+void
+rbox_putc(ip, c, dy, dx, mode)
+ struct ite_data *ip;
+ int dy, dx, c, mode;
+{
+ register int wrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
+
+ rbox_windowmove(ip, charY(ip, c), charX(ip, c),
+ dy * ip->ftheight, dx * ip->ftwidth,
+ ip->ftheight, ip->ftwidth, wrr);
+}
+
+void
+rbox_cursor(ip, flag)
+ struct ite_data *ip;
+ int flag;
+{
+ if (flag == DRAW_CURSOR)
+ draw_cursor(ip)
+ else if (flag == MOVE_CURSOR) {
+ erase_cursor(ip)
+ draw_cursor(ip)
+ }
+ else
+ erase_cursor(ip)
+}
+
+void
+rbox_clear(ip, sy, sx, h, w)
+ struct ite_data *ip;
+ int sy, sx, h, w;
+{
+ rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
+ sy * ip->ftheight, sx * ip->ftwidth,
+ h * ip->ftheight, w * ip->ftwidth,
+ RR_CLEAR);
+}
+
+void
+rbox_scroll(ip, sy, sx, count, dir)
+ struct ite_data *ip;
+ int sy, count, dir, sx;
+{
+ register int dy;
+ register int dx = sx;
+ register int height = 1;
+ register int width = ip->cols;
+
+ if (dir == SCROLL_UP) {
+ dy = sy - count;
+ height = ip->rows - sy;
+ }
+ else if (dir == SCROLL_DOWN) {
+ dy = sy + count;
+ height = ip->rows - dy - 1;
+ }
+ else if (dir == SCROLL_RIGHT) {
+ dy = sy;
+ dx = sx + count;
+ width = ip->cols - dx;
+ }
+ else {
+ dy = sy;
+ dx = sx - count;
+ width = ip->cols - sx;
+ }
+
+ rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
+ dy * ip->ftheight, dx * ip->ftwidth,
+ height * ip->ftheight,
+ width * ip->ftwidth, RR_COPY);
+}
+
+void
+rbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
+ struct ite_data *ip;
+ int sy, sx, dy, dx, h, w, func;
+{
+ register struct rboxfb *rp = REGBASE;
+ if (h == 0 || w == 0)
+ return;
+
+ rb_waitbusy(ip->regbase);
+ rp->rep_rule = func << 4 | func;
+ rp->source_y = sy;
+ rp->source_x = sx;
+ rp->dest_y = dy;
+ rp->dest_x = dx;
+ rp->wheight = h;
+ rp->wwidth = w;
+ rp->wmove = 1;
+}
+
+/*
+ * Renaissance console support
+ */
+
+int
+rbox_console_scan(scode, va, arg)
+ int scode;
+ caddr_t va;
+ void *arg;
+{
+ struct grfreg *grf = (struct grfreg *)va;
+ struct consdev *cp = arg;
+ u_char *dioiidev;
+ int force = 0, pri;
+
+ if ((grf->gr_id == GRFHWID) && (grf->gr_id2 == GID_RENAISSANCE)) {
+ pri = CN_NORMAL;
+
+#ifdef CONSCODE
+ /*
+ * Raise our priority, if appropriate.
+ */
+ if (scode == CONSCODE) {
+ pri = CN_REMOTE;
+ force = conforced = 1;
+ }
+#endif
+
+ /* Only raise priority. */
+ if (pri > cp->cn_pri)
+ cp->cn_pri = pri;
+
+ /*
+ * If our priority is higher than the currently-remembered
+ * console, stash our priority.
+ */
+ if (((cn_tab == NULL) || (cp->cn_pri > cn_tab->cn_pri))
+ || force) {
+ cn_tab = cp;
+ if (scode >= 132) {
+ dioiidev = (u_char *)va;
+ return ((dioiidev[0x101] + 1) * 0x100000);
+ }
+ return (DIOCSIZE);
+ }
+ }
+ return (0);
+}
+
+void
+rboxcnprobe(cp)
+ struct consdev *cp;
+{
+ int maj;
+ caddr_t va;
+ struct grfreg *grf;
+ int force = 0;
+
+ maj = ite_major();
+
+ /* initialize required fields */
+ cp->cn_dev = makedev(maj, 0); /* XXX */
+ cp->cn_pri = CN_DEAD;
+
+ /* Abort early if console is already forced. */
+ if (conforced)
+ return;
+
+ /* Look for "internal" framebuffer. */
+ va = (caddr_t)IIOV(GRFIADDR);
+ grf = (struct grfreg *)va;
+ if (!badaddr(va) &&
+ ((grf->gr_id == GRFHWID) && (grf->gr_id2 == GID_RENAISSANCE))) {
+ cp->cn_pri = CN_INTERNAL;
+
+#ifdef CONSCODE
+ /*
+ * Raise our priority and save some work, if appropriate.
+ */
+ if (CONSCODE == -1) {
+ cp->cn_pri = CN_REMOTE;
+ force = conforced = 1;
+ }
#endif
+
+ /*
+ * If our priority is higher than the currently
+ * remembered console, stash our priority, and
+ * unmap whichever device might be currently mapped.
+ * Since we're internal, we set the saved size to 0
+ * so they don't attempt to unmap our fixed VA later.
+ */
+ if (((cn_tab == NULL) || (cp->cn_pri > cn_tab->cn_pri))
+ || force) {
+ cn_tab = cp;
+ if (convasize)
+ iounmap(conaddr, convasize);
+ conscode = -1;
+ conaddr = va;
+ convasize = 0;
+ }
+ }
+
+ console_scan(rbox_console_scan, cp);
+}
+
+void
+rboxcninit(cp)
+ struct consdev *cp;
+{
+ struct ite_data *ip = &ite_cn;
+ struct grf_data *gp = &grf_cn;
+
+ /*
+ * Initialize the framebuffer hardware.
+ */
+ (void)rb_init(gp, conscode, conaddr);
+
+ /*
+ * Set up required grf data.
+ */
+ gp->g_sw = &rbox_grfsw;
+ gp->g_display.gd_id = gp->g_sw->gd_swid;
+ gp->g_flags = GF_ALIVE;
+
+ /*
+ * Set up required ite data and initialize ite.
+ */
+ ip->isw = &rbox_itesw;
+ ip->grf = gp;
+ ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
+ ip->attrbuf = console_attributes;
+ iteinit(ip);
+
+ kbd_ite = ip; /* XXX */
+}
+
+#endif /* NITE > 0 */
+#endif /* NGRF > 0 */
-/* $NetBSD: grf_tc.c,v 1.4 1994/10/26 07:24:04 cgd Exp $ */
+/* $NetBSD: grf_tc.c,v 1.7 1996/03/03 16:49:04 thorpej Exp $ */
/*
+ * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* Graphics routines for TOPCAT and CATSEYE frame buffers
*/
#include <sys/param.h>
+#include <sys/conf.h>
#include <sys/errno.h>
+#include <sys/proc.h>
+#include <sys/ioctl.h>
+#include <sys/tty.h>
+#include <sys/systm.h>
+
+#include <machine/autoconf.h>
+#include <machine/cpu.h>
+
+#include <dev/cons.h>
#include <hp300/dev/grfioctl.h>
#include <hp300/dev/grfvar.h>
#include <hp300/dev/grfreg.h>
#include <hp300/dev/grf_tcreg.h>
-#include <machine/cpu.h>
+#include <hp300/dev/itevar.h>
+#include <hp300/dev/itereg.h>
+
+#include "ite.h"
+
+int tc_init __P((struct grf_data *, int, caddr_t));
+int tc_mode __P((struct grf_data *, int, caddr_t));
+
+/* Topcat (bobcat) grf switch */
+struct grfsw topcat_grfsw = {
+ GID_TOPCAT, GRFBOBCAT, "topcat", tc_init, tc_mode
+};
+
+/* Lo-res catseye grf switch */
+struct grfsw lrcatseye_grfsw = {
+ GID_LRCATSEYE, GRFCATSEYE, "lo-res catseye", tc_init, tc_mode
+};
+
+/* Hi-res catseye grf switch */
+struct grfsw hrcatseye_grfsw = {
+ GID_HRCCATSEYE, GRFCATSEYE, "hi-res catseye", tc_init, tc_mode
+};
+
+/* Hi-res monochrome catseye grf switch */
+struct grfsw hrmcatseye_grfsw = {
+ GID_HRMCATSEYE, GRFCATSEYE, "hi-res catseye", tc_init, tc_mode
+};
+
+#if NITE > 0
+void topcat_init __P((struct ite_data *));
+void topcat_deinit __P((struct ite_data *));
+void topcat_putc __P((struct ite_data *, int, int, int, int));
+void topcat_cursor __P((struct ite_data *, int));
+void topcat_clear __P((struct ite_data *, int, int, int, int));
+void topcat_scroll __P((struct ite_data *, int, int, int, int));
+void topcat_windowmove __P((struct ite_data *, int, int, int, int,
+ int, int, int));
+
+/* Topcat/catseye ite switch */
+struct itesw topcat_itesw = {
+ topcat_init, topcat_deinit, topcat_clear, topcat_putc,
+ topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph
+};
+#endif /* NITE > 0 */
/*
* Initialize hardware.
* Must fill in the grfinfo structure in g_softc.
* Returns 0 if hardware not present, non-zero ow.
*/
-tc_init(gp, addr)
- struct grf_softc *gp;
+int
+tc_init(gp, scode, addr)
+ struct grf_data *gp;
+ int scode;
caddr_t addr;
{
register struct tcboxfb *tp = (struct tcboxfb *) addr;
volatile u_char *fbp;
u_char save;
int fboff;
- extern caddr_t sctopa(), iomap();
+ extern caddr_t sctopa();
- if (ISIIOVA(addr))
- gi->gd_regaddr = (caddr_t) IIOP(addr);
- else
- gi->gd_regaddr = sctopa(vatosc(addr));
- gi->gd_regsize = 0x10000;
- gi->gd_fbwidth = (tp->fbwmsb << 8) | tp->fbwlsb;
- gi->gd_fbheight = (tp->fbhmsb << 8) | tp->fbhlsb;
- gi->gd_fbsize = gi->gd_fbwidth * gi->gd_fbheight;
- fboff = (tp->fbomsb << 8) | tp->fbolsb;
- gi->gd_fbaddr = (caddr_t) (*((u_char *)addr + fboff) << 16);
- if (gi->gd_regaddr >= (caddr_t)DIOIIBASE) {
- /*
- * For DIO II space the fbaddr just computed is the offset
- * from the select code base (regaddr) of the framebuffer.
- * Hence it is also implicitly the size of the register set.
- */
- gi->gd_regsize = (int) gi->gd_fbaddr;
- gi->gd_fbaddr += (int) gi->gd_regaddr;
- gp->g_regkva = addr;
- gp->g_fbkva = addr + gi->gd_regsize;
- } else {
- /*
- * For DIO space we need to map the seperate framebuffer.
- */
- gp->g_regkva = addr;
- gp->g_fbkva = iomap(gi->gd_fbaddr, gi->gd_fbsize);
- }
- gi->gd_dwidth = (tp->dwmsb << 8) | tp->dwlsb;
- gi->gd_dheight = (tp->dhmsb << 8) | tp->dhlsb;
- gi->gd_planes = tp->num_planes;
- gi->gd_colors = 1 << gi->gd_planes;
- if (gi->gd_colors == 1) {
- fbp = (u_char *) gp->g_fbkva;
- tp->wen = ~0;
- tp->prr = 0x3;
- tp->fben = ~0;
- save = *fbp;
- *fbp = 0xFF;
- gi->gd_colors = *fbp + 1;
- *fbp = save;
+ /*
+ * If the console has been initialized, and it was us, there's
+ * no need to repeat this.
+ */
+ if (consinit_active || (scode != conscode)) {
+ if (ISIIOVA(addr))
+ gi->gd_regaddr = (caddr_t) IIOP(addr);
+ else
+ gi->gd_regaddr = sctopa(scode);
+ gi->gd_regsize = 0x10000;
+ gi->gd_fbwidth = (tp->fbwmsb << 8) | tp->fbwlsb;
+ gi->gd_fbheight = (tp->fbhmsb << 8) | tp->fbhlsb;
+ gi->gd_fbsize = gi->gd_fbwidth * gi->gd_fbheight;
+ fboff = (tp->fbomsb << 8) | tp->fbolsb;
+ gi->gd_fbaddr = (caddr_t) (*((u_char *)addr + fboff) << 16);
+ if (gi->gd_regaddr >= (caddr_t)DIOIIBASE) {
+ /*
+ * For DIO II space the fbaddr just computed is the
+ * offset from the select code base (regaddr) of the
+ * framebuffer. Hence it is also implicitly the
+ * size of the register set.
+ */
+ gi->gd_regsize = (int) gi->gd_fbaddr;
+ gi->gd_fbaddr += (int) gi->gd_regaddr;
+ gp->g_regkva = addr;
+ gp->g_fbkva = addr + gi->gd_regsize;
+ } else {
+ /*
+ * For DIO space we need to map the seperate
+ * framebuffer.
+ */
+ gp->g_regkva = addr;
+ gp->g_fbkva = iomap(gi->gd_fbaddr, gi->gd_fbsize);
+ }
+ gi->gd_dwidth = (tp->dwmsb << 8) | tp->dwlsb;
+ gi->gd_dheight = (tp->dhmsb << 8) | tp->dhlsb;
+ gi->gd_planes = tp->num_planes;
+ gi->gd_colors = 1 << gi->gd_planes;
+ if (gi->gd_colors == 1) {
+ fbp = (u_char *) gp->g_fbkva;
+ tp->wen = ~0;
+ tp->prr = 0x3;
+ tp->fben = ~0;
+ save = *fbp;
+ *fbp = 0xFF;
+ gi->gd_colors = *fbp + 1;
+ *fbp = save;
+ }
}
return(1);
}
* Function may not be needed anymore.
*/
/*ARGSUSED*/
+int
tc_mode(gp, cmd, data)
- struct grf_softc *gp;
+ struct grf_data *gp;
int cmd;
caddr_t data;
{
}
return(error);
}
+
+#if NITE > 0
+
+/*
+ * Topcat/catseye ite routines
+ */
+
+#define REGBASE ((struct tcboxfb *)(ip->regbase))
+#define WINDOWMOVER topcat_windowmove
+
+void
+topcat_init(ip)
+ struct ite_data *ip;
+{
+ /* XXX */
+ if (ip->regbase == NULL) {
+ struct grf_data *gp = ip->grf;
+
+ ip->regbase = gp->g_regkva;
+ ip->fbbase = gp->g_fbkva;
+ ip->fbwidth = gp->g_display.gd_fbwidth;
+ ip->fbheight = gp->g_display.gd_fbheight;
+ ip->dwidth = gp->g_display.gd_dwidth;
+ ip->dheight = gp->g_display.gd_dheight;
+ }
+
+ /*
+ * Catseye looks a lot like a topcat, but not completely.
+ * So, we set some bits to make it work.
+ */
+ if (REGBASE->fbid != GID_TOPCAT) {
+ while ((REGBASE->catseye_status & 1))
+ ;
+ REGBASE->catseye_status = 0x0;
+ REGBASE->vb_select = 0x0;
+ REGBASE->tcntrl = 0x0;
+ REGBASE->acntrl = 0x0;
+ REGBASE->pncntrl = 0x0;
+ REGBASE->rug_cmdstat = 0x90;
+ }
+
+ /*
+ * Determine the number of planes by writing to the first frame
+ * buffer display location, then reading it back.
+ */
+ REGBASE->wen = ~0;
+ REGBASE->fben = ~0;
+ REGBASE->prr = RR_COPY;
+ *FBBASE = 0xFF;
+ ip->planemask = *FBBASE;
+
+ /*
+ * Enable reading/writing of all the planes.
+ */
+ REGBASE->fben = ip->planemask;
+ REGBASE->wen = ip->planemask;
+ REGBASE->ren = ip->planemask;
+ REGBASE->prr = RR_COPY;
+
+ ite_fontinfo(ip);
+
+ /*
+ * Clear the framebuffer on all planes.
+ */
+ topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
+ tc_waitbusy(ip->regbase, ip->planemask);
+
+ ite_fontinit(ip);
+
+ /*
+ * Initialize color map for color displays
+ */
+ if (ip->planemask != 1) {
+ tc_waitbusy(ip->regbase, ip->planemask);
+ REGBASE->nblank = 0x01;
+
+ tccm_waitbusy(ip->regbase);
+ REGBASE->rdata = 0x0;
+ REGBASE->gdata = 0x0;
+ REGBASE->bdata = 0x0;
+ REGBASE->cindex = 0xFF;
+ REGBASE->strobe = 0xFF;
+
+ DELAY(100);
+ tccm_waitbusy(ip->regbase);
+ REGBASE->rdata = 0x0;
+ REGBASE->gdata = 0x0;
+ REGBASE->bdata = 0x0;
+ REGBASE->cindex = 0x0;
+
+ DELAY(100);
+ tccm_waitbusy(ip->regbase);
+ REGBASE->rdata = 0xFF;
+ REGBASE->gdata = 0xFF;
+ REGBASE->bdata = 0xFF;
+ REGBASE->cindex = 0xFE;
+ REGBASE->strobe = 0xFF;
+
+ DELAY(100);
+ tccm_waitbusy(ip->regbase);
+ REGBASE->rdata = 0x0;
+ REGBASE->gdata = 0x0;
+ REGBASE->bdata = 0x0;
+ REGBASE->cindex = 0x0;
+ }
+
+ /*
+ * Stash the inverted cursor.
+ */
+ topcat_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
+ ip->cblanky, ip->cblankx, ip->ftheight,
+ ip->ftwidth, RR_COPYINVERTED);
+}
+
+void
+topcat_deinit(ip)
+ struct ite_data *ip;
+{
+ topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
+ tc_waitbusy(ip->regbase, ip->planemask);
+
+ REGBASE->nblank = ~0;
+ ip->flags &= ~ITE_INITED;
+}
+
+void
+topcat_putc(ip, c, dy, dx, mode)
+ struct ite_data *ip;
+ int c, dy, dx, mode;
+{
+ int wmrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
+
+ topcat_windowmove(ip, charY(ip, c), charX(ip, c),
+ dy * ip->ftheight, dx * ip->ftwidth,
+ ip->ftheight, ip->ftwidth, wmrr);
+}
+
+void
+topcat_cursor(ip, flag)
+ struct ite_data *ip;
+ int flag;
+{
+ if (flag == DRAW_CURSOR)
+ draw_cursor(ip)
+ else if (flag == MOVE_CURSOR) {
+ erase_cursor(ip)
+ draw_cursor(ip)
+ }
+ else
+ erase_cursor(ip)
+}
+
+void
+topcat_clear(ip, sy, sx, h, w)
+ struct ite_data *ip;
+ int sy, sx, h, w;
+{
+ topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
+ sy * ip->ftheight, sx * ip->ftwidth,
+ h * ip->ftheight, w * ip->ftwidth,
+ RR_CLEAR);
+}
+
+void
+topcat_scroll(ip, sy, sx, count, dir)
+ struct ite_data *ip;
+ int sy, count, dir, sx;
+{
+ register int dy;
+ register int dx = sx;
+ register int height = 1;
+ register int width = ip->cols;
+
+ if (dir == SCROLL_UP) {
+ dy = sy - count;
+ height = ip->rows - sy;
+ }
+ else if (dir == SCROLL_DOWN) {
+ dy = sy + count;
+ height = ip->rows - dy - 1;
+ }
+ else if (dir == SCROLL_RIGHT) {
+ dy = sy;
+ dx = sx + count;
+ width = ip->cols - dx;
+ }
+ else {
+ dy = sy;
+ dx = sx - count;
+ width = ip->cols - sx;
+ }
+
+ topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
+ dy * ip->ftheight, dx * ip->ftwidth,
+ height * ip->ftheight,
+ width * ip->ftwidth, RR_COPY);
+}
+
+void
+topcat_windowmove(ip, sy, sx, dy, dx, h, w, func)
+ struct ite_data *ip;
+ int sy, sx, dy, dx, h, w, func;
+{
+ register struct tcboxfb *rp = REGBASE;
+
+ if (h == 0 || w == 0)
+ return;
+ tc_waitbusy(ip->regbase, ip->planemask);
+ rp->wmrr = func;
+ rp->source_y = sy;
+ rp->source_x = sx;
+ rp->dest_y = dy;
+ rp->dest_x = dx;
+ rp->wheight = h;
+ rp->wwidth = w;
+ rp->wmove = ip->planemask;
+}
+
+/*
+ * Topcat/catseye console support
+ */
+
+int
+topcat_console_scan(scode, va, arg)
+ int scode;
+ caddr_t va;
+ void *arg;
+{
+ struct grfreg *grf = (struct grfreg *)va;
+ struct consdev *cp = arg;
+ u_char *dioiidev;
+ int force = 0, pri;
+
+ if (grf->gr_id != GRFHWID)
+ return (0);
+
+ switch (grf->gr_id2) {
+ case GID_TOPCAT:
+ case GID_LRCATSEYE:
+ case GID_HRCCATSEYE:
+ case GID_HRMCATSEYE:
+ break;
+
+ default:
+ return (0);
+ }
+
+ pri = CN_NORMAL;
+
+#ifdef CONSCODE
+ /*
+ * Raise our priority, if appropriate.
+ */
+ if (scode == CONSCODE) {
+ pri = CN_REMOTE;
+ force = conforced = 1;
+ }
+#endif
+
+ /* Only raise priority. */
+ if (pri > cp->cn_pri)
+ cp->cn_pri = pri;
+
+ /*
+ * If our priority is higher than the currently-remembered
+ * console, stash our priority.
+ */
+ if (((cn_tab == NULL) || (cp->cn_pri > cn_tab->cn_pri)) || force) {
+ cn_tab = cp;
+ if (scode >= 132) {
+ dioiidev = (u_char *)va;
+ return ((dioiidev[0x101] + 1) * 0x100000);
+ }
+ return (DIOCSIZE);
+ }
+ return (0);
+}
+
+void
+topcatcnprobe(cp)
+ struct consdev *cp;
+{
+ int maj;
+ caddr_t va;
+ struct grfreg *grf;
+ int force = 0;
+
+ maj = ite_major();
+
+ /* initialize required fields */
+ cp->cn_dev = makedev(maj, 0); /* XXX */
+ cp->cn_pri = CN_DEAD;
+
+ /* Abort early if the console is already forced. */
+ if (conforced)
+ return;
+
+ /* Look for "internal" framebuffer. */
+ va = (caddr_t)IIOV(GRFIADDR);
+ grf = (struct grfreg *)va;
+ if (!badaddr(va) && (grf->gr_id == GRFHWID)) {
+ switch (grf->gr_id2) {
+ case GID_TOPCAT:
+ case GID_LRCATSEYE:
+ case GID_HRCCATSEYE:
+ case GID_HRMCATSEYE:
+ cp->cn_pri = CN_INTERNAL;
+
+#ifdef CONSCODE
+ /*
+ * Raise our priority and save some work,
+ * if appropriate.
+ */
+ if (CONSCODE == -1) {
+ cp->cn_pri = CN_REMOTE;
+ force = conforced = 1;
+ }
#endif
+
+ /*
+ * If our priority is higher than the currently
+ * remembered console, stash our priority, and unmap
+ * whichever device might be currently mapped.
+ * Since we're internal, we set the saved size to 0
+ * so they don't attempt to unmap our fixed VA later.
+ */
+ if (((cn_tab == NULL) || (cp->cn_pri > cn_tab->cn_pri))
+ || force) {
+ cn_tab = cp;
+ if (convasize)
+ iounmap(conaddr, convasize);
+ conscode = -1;
+ conaddr = va;
+ convasize = 0;
+ }
+ }
+ }
+
+ console_scan(topcat_console_scan, cp);
+}
+
+void
+topcatcninit(cp)
+ struct consdev *cp;
+{
+ struct ite_data *ip = &ite_cn;
+ struct grf_data *gp = &grf_cn;
+ struct grfreg *grf = (struct grfreg *)conaddr;
+
+ /*
+ * Initialize the framebuffer hardware.
+ */
+ (void)tc_init(gp, conscode, conaddr);
+
+ /*
+ * Set up required grf data.
+ */
+ switch (grf->gr_id2) {
+ case GID_TOPCAT:
+ gp->g_sw = &topcat_grfsw;
+ break;
+
+ case GID_LRCATSEYE:
+ gp->g_sw = &lrcatseye_grfsw;
+ break;
+
+ case GID_HRCCATSEYE:
+ gp->g_sw = &hrcatseye_grfsw;
+ break;
+
+ case GID_HRMCATSEYE:
+ gp->g_sw = &hrmcatseye_grfsw;
+ break;
+
+ default:
+ /* THIS SHOULD NEVER HAPPEN! */
+ panic("topcat console: impossible!"); /* XXX won't see it */
+ }
+ gp->g_display.gd_id = gp->g_sw->gd_swid;
+ gp->g_flags = GF_ALIVE;
+
+ /*
+ * Set up required ite data and initialize ite.
+ */
+ ip->isw = &topcat_itesw;
+ ip->grf = gp;
+ ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
+ ip->attrbuf = console_attributes;
+ iteinit(ip);
+
+ kbd_ite = ip; /* XXX */
+}
+
+#endif /* NITE > 0 */
+#endif /* NGRF > 0 */
-/* $NetBSD: grfvar.h,v 1.6 1995/03/28 18:16:06 jtc Exp $ */
+/* $NetBSD: grfvar.h,v 1.7 1996/02/24 00:55:18 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
};
#define gl_lockslot gl_locks[0]
-/*
- * Static configuration info for display types
- */
-struct grfsw {
- int gd_hwid; /* id returned by hardware */
- int gd_swid; /* id to be returned by software */
- char *gd_desc; /* description printed at config time */
- int (*gd_init)(); /* boot time init routine */
- int (*gd_mode)(); /* misc function routine */
-};
-
/* per display info */
-struct grf_softc {
+struct grf_data {
int g_flags; /* software flags */
struct grfsw *g_sw; /* static configuration info */
caddr_t g_regkva; /* KVA of registers */
caddr_t g_data; /* device dependent data */
};
+/*
+ * Static configuration info for display types
+ */
+struct grfsw {
+ int gd_hwid; /* id returned by hardware */
+ int gd_swid; /* id to be returned by software */
+ char *gd_desc; /* description printed at config time */
+ /* boot time init routine */
+ int (*gd_init) __P((struct grf_data *, int, caddr_t));
+ /* misc function routine */
+ int (*gd_mode) __P((struct grf_data *, int, caddr_t));
+};
+
+struct grf_softc {
+ struct grf_data *sc_data; /* display state information */
+ struct ite_softc *sc_ite; /* pointer to ite; may be NULL */
+};
+
/* flags */
#define GF_ALIVE 0x01
#define GF_OPEN 0x02
#define GRFUNIT(d) ((d) & 0x7)
#ifdef _KERNEL
+extern struct grf_data grf_cn; /* grf_data for console device */
extern struct grf_softc grf_softc[];
-extern struct grfsw grfsw[];
+extern struct grfsw *grfsw[];
extern int ngrfsw;
#endif
-/* $NetBSD: hil.c,v 1.21 1996/01/10 20:31:12 thorpej Exp $ */
+/* $NetBSD: hil.c,v 1.22 1996/02/14 02:44:24 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
register struct hil_softc *hilp = &hil_softc[HILLOOP(dev)];
register struct hilloopdev *dptr;
u_char device = HILUNIT(dev);
+ int s;
#ifdef DEBUG
if (hildebug & HDB_FOLLOW)
/*
* Opened the keyboard, put in raw mode.
*/
- (void) splhil();
+ s = splhil();
if (device == hilp->hl_kbddev) {
u_char mask = 0;
send_hil_cmd(hilp->hl_addr, HIL_WRITEKBDSADR, &mask, 1, NULL);
printf("hilopen: keyboard %d raw\n", hilp->hl_kbddev);
#endif
}
- (void) spl0();
+ splx(s);
return (0);
}
register int i;
u_char device = HILUNIT(dev);
char mask, lpctrl;
+ int s;
extern struct emul emul_netbsd;
#ifdef DEBUG
(void) hilqfree(hilp, i, p);
} else {
mask = ~hildevmask(device);
- (void) splhil();
+ s = splhil();
for (i = 0; i < NHILQ; i++)
if (hilp->hl_queue[i].hq_procp == p) {
dptr->hd_qmask &= ~hilqmask(i);
hilp->hl_queue[i].hq_devmask &= mask;
}
- (void) spl0();
+ splx(s);
}
}
/*
/*
* Set keyboard back to cooked mode when closed.
*/
- (void) splhil();
+ s = splhil();
if (device && device == hilp->hl_kbddev) {
mask = 1 << (hilp->hl_kbddev - 1);
send_hil_cmd(hilp->hl_addr, HIL_WRITEKBDSADR, &mask, 1, NULL);
#endif
kbdenable(HILLOOP(dev));
}
- (void) spl0();
+ splx(s);
return (0);
}
register int cc;
u_char device = HILUNIT(dev);
u_char buf[HILBUFSIZE];
- int error;
+ int error, s;
#if 0
/*
if ((dptr->hd_flags & HIL_READIN) == 0)
return(ENODEV);
- (void) splhil();
+ s = splhil();
while (dptr->hd_queue.c_cc == 0) {
if (dptr->hd_flags & HIL_NOBLOCK) {
spl0();
return (error);
}
}
- (void) spl0();
+ splx(s);
error = 0;
while (uio->uio_resid > 0 && error == 0) {
-/* $NetBSD: hpib.c,v 1.7 1995/12/02 18:22:01 thorpej Exp $ */
+/* $NetBSD: hpib.c,v 1.8 1996/02/14 02:44:28 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
void hpibstart __P((int));
void hpibgo __P((int, int, int, void *, int, int, int));
void hpibdone __P((int));
-int hpibintr __P((int));
+int hpibintr __P((void *));
struct driver hpibdriver = {
hpibmatch,
};
struct hpib_softc hpib_softc[NHPIB];
-struct isr hpib_isr[NHPIB];
extern int nhpibtype __P((struct hp_ctlr *)); /* XXX */
extern int fhpibtype __P((struct hp_ctlr *)); /* XXX */
/*
* Call the appropriate "attach" routine for this controller.
* The type is set in the "type" routine.
+ *
+ * XXX This is, by the way, exactly backwards.
*/
switch (hs->sc_type) {
case HPIBA:
hs->sc_sq.dq_forw = hs->sc_sq.dq_back = &hs->sc_sq;
/* Establish the interrupt handler. */
- hpib_isr[hc->hp_unit].isr_intr = hpibintr;
- hpib_isr[hc->hp_unit].isr_ipl = hc->hp_ipl;
- hpib_isr[hc->hp_unit].isr_arg = hc->hp_unit;
- isrlink(&hpib_isr[hc->hp_unit]);
+ isrlink(hpibintr, hs, hc->hp_ipl, ISRPRI_BIO);
/* Reset the controller, display what we've seen, and we're done. */
hpibreset(hc->hp_unit);
}
int
-hpibintr(unit)
- register int unit;
+hpibintr(arg)
+ void *arg;
{
+ struct hpib_softc *hs = arg;
- return ((hpib_softc[unit].sc_controller->hpib_intr)(unit));
+ return ((hs->sc_controller->hpib_intr)(arg));
}
#endif /* NHPIB > 0 */
-/* $NetBSD: hpibvar.h,v 1.7 1995/11/19 17:57:18 thorpej Exp $ */
+/* $NetBSD: hpibvar.h,v 1.8 1996/02/14 02:44:31 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
#define C_UNT_P 0xdf /* with odd parity */
#define C_SCG 0x60 /* Secondary group commands */
-/*
- * Each of the HP-IB controller drivers fills in this structure, which
- * is used by the indirect driver to call controller-specific functions.
- */
-struct hpib_controller {
- void (*hpib_reset) __P((int));
- int (*hpib_send) __P((int, int, int, void *, int));
- int (*hpib_recv) __P((int, int, int, void *, int));
- int (*hpib_ppoll) __P((int));
- void (*hpib_ppwatch) __P((void *));
- void (*hpib_go) __P((int, int, int, void *, int, int, int));
- void (*hpib_done) __P((int));
- int (*hpib_intr) __P((int));
-};
-
struct hpib_softc {
struct hp_ctlr *sc_hc;
struct hpib_controller *sc_controller;
int sc_curcnt;
};
+/*
+ * Each of the HP-IB controller drivers fills in this structure, which
+ * is used by the indirect driver to call controller-specific functions.
+ */
+struct hpib_controller {
+ void (*hpib_reset) __P((int));
+ int (*hpib_send) __P((int, int, int, void *, int));
+ int (*hpib_recv) __P((int, int, int, void *, int));
+ int (*hpib_ppoll) __P((int));
+ void (*hpib_ppwatch) __P((void *));
+ void (*hpib_go) __P((int, int, int, void *, int, int, int));
+ void (*hpib_done) __P((int));
+ int (*hpib_intr) __P((void *));
+};
+
/* sc_flags */
#define HPIBF_IO 0x1
#define HPIBF_DONE 0x2
-/* $NetBSD: if_le.c,v 1.26 1996/01/02 21:56:21 thorpej Exp $ */
+/* $NetBSD: if_le.c,v 1.29 1996/04/22 02:30:45 christos Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
int lematch __P((struct hp_device *));
void leattach __P((struct hp_device *));
int leintr __P((void *));
-static int hp300_leintr __P((int)); /* machine-dependent wrapper */
+static int hp300_leintr __P((void *)); /* machine-dependent wrapper */
struct driver ledriver = {
lematch, leattach, "le",
/* offsets for: ID, REGS, MEM, NVRAM */
int lestd[] = { 0, 0x4000, 0x8000, 0xC008 };
+integrate void
+lehwinit(sc)
+ struct le_softc *sc;
+{
+}
+
integrate void
lewrcsr(sc, port, val)
struct le_softc *sc;
cp++;
}
- sc->sc_copytodesc = copytobuf_contig;
- sc->sc_copyfromdesc = copyfrombuf_contig;
- sc->sc_copytobuf = copytobuf_contig;
- sc->sc_copyfrombuf = copyfrombuf_contig;
- sc->sc_zerobuf = zerobuf_contig;
+ sc->sc_copytodesc = am7990_copytobuf_contig;
+ sc->sc_copyfromdesc = am7990_copyfrombuf_contig;
+ sc->sc_copytobuf = am7990_copytobuf_contig;
+ sc->sc_copyfrombuf = am7990_copyfrombuf_contig;
+ sc->sc_zerobuf = am7990_zerobuf_contig;
sc->sc_arpcom.ac_if.if_name = ledriver.d_name;
leconfig(sc);
- sc->sc_isr.isr_intr = hp300_leintr;
- sc->sc_isr.isr_arg = hd->hp_unit;
- sc->sc_isr.isr_ipl = hd->hp_ipl;
- isrlink(&sc->sc_isr);
+ /* Establish the interrupt handler. */
+ isrlink(hp300_leintr, sc, hd->hp_ipl, ISRPRI_NET);
ler0->ler0_status = LE_IE;
}
static int
-hp300_leintr(unit)
- int unit;
+hp300_leintr(arg)
+ void *arg;
{
- struct le_softc *sc = LE_SOFTC(unit);
+ struct le_softc *sc = arg;
u_int16_t isr;
#ifdef USELEDS
-/* $NetBSD: ite.c,v 1.28 1995/11/19 23:14:22 thorpej Exp $ */
+/* $NetBSD: ite.c,v 1.29 1996/02/24 00:55:20 thorpej Exp $ */
/*
+ * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
#include <sys/systm.h>
#include <sys/malloc.h>
+#include <machine/autoconf.h>
+
+#include <dev/cons.h>
+
#include <hp300/dev/grfioctl.h>
#include <hp300/dev/grfvar.h>
#include <hp300/dev/itevar.h>
int iteburst = 64;
int nite = NITE;
-struct tty *ite_tty[NITE];
-struct ite_softc *kbd_ite = NULL;
+struct ite_data *kbd_ite = NULL;
struct ite_softc ite_softc[NITE];
-void itestart();
+/*
+ * Terminal emulator state information, statically allocated
+ * for the benefit of the console.
+ */
+struct ite_data ite_cn;
+
+void iteinit __P((struct ite_data *));
+void iteputchar __P((int, struct ite_data *));
+void itecheckwrap __P((struct ite_data *, struct itesw *));
+void ite_dchar __P((struct ite_data *, struct itesw *));
+void ite_ichar __P((struct ite_data *, struct itesw *));
+void ite_dline __P((struct ite_data *, struct itesw *));
+void ite_iline __P((struct ite_data *, struct itesw *));
+void ite_clrtoeol __P((struct ite_data *, struct itesw *, int, int));
+void ite_clrtoeos __P((struct ite_data *, struct itesw *));
+void itestart __P((struct tty *));
/*
* Primary attribute buffer to be used by the first bitmapped console
* Dummy for pseudo-device config.
*/
/*ARGSUSED*/
+void
iteattach(n)
int n;
{
}
+/*
+ * Allocate storage for ite data structures.
+ * XXX This is a kludge and will go away with new config.
+ */
+void
+ite_attach_grf(unit, isconsole)
+ int unit, isconsole;
+{
+ struct ite_softc *ite = &ite_softc[unit];
+ struct grf_softc *grf = &grf_softc[unit];
+
+ /*
+ * Check to see if our structure is pre-allocated.
+ */
+ if (isconsole) {
+ ite->sc_data = &ite_cn;
+
+ /*
+ * We didn't know which unit this would be during
+ * the console probe, so we have to fixup cn_dev here.
+ */
+ cn_tab->cn_dev = makedev(ite_major(), unit);
+ } else {
+ ite->sc_data =
+ (struct ite_data *)malloc(sizeof(struct ite_data),
+ M_DEVBUF, M_NOWAIT);
+ if (ite->sc_data == NULL) {
+ printf("ite_attach_grf: malloc for ite_data failed\n");
+ return;
+ }
+ bzero(ite->sc_data, sizeof(struct ite_data));
+ }
+
+ /*
+ * Cross-reference the ite and the grf.
+ */
+ ite->sc_grf = grf;
+ grf->sc_ite = ite;
+
+ printf("ite%d at grf%d: attached\n", unit, unit);
+}
+
/*
* Perform functions necessary to setup device as a terminal emulator.
*/
-iteon(dev, flag)
- dev_t dev;
+int
+iteon(ip, flag)
+ struct ite_data *ip;
int flag;
{
- int unit = ITEUNIT(dev);
- struct tty *tp = ite_tty[unit];
- struct ite_softc *ip = &ite_softc[unit];
- if (unit < 0 || unit >= NITE || (ip->flags&ITE_ALIVE) == 0)
+ if ((ip->flags & ITE_ALIVE) == 0)
return(ENXIO);
+
/* force ite active, overriding graphics mode */
if (flag & 1) {
ip->flags |= ITE_ACTIVE;
ip->flags &= ~(ITE_INGRF|ITE_INITED);
}
+
/* leave graphics mode */
if (flag & 2) {
ip->flags &= ~ITE_INGRF;
if ((ip->flags & ITE_ACTIVE) == 0)
return(0);
}
+
ip->flags |= ITE_ACTIVE;
if (ip->flags & ITE_INGRF)
return(0);
+
if (kbd_ite == NULL || kbd_ite == ip) {
kbd_ite = ip;
- kbdenable(unit);
+ kbdenable(0); /* XXX */
}
- iteinit(dev);
+
+ iteinit(ip);
return(0);
}
-iteinit(dev)
- dev_t dev;
+void
+iteinit(ip)
+ struct ite_data *ip;
{
- int unit = ITEUNIT(dev);
- struct ite_softc *ip = &ite_softc[unit];
if (ip->flags & ITE_INITED)
return;
* Deinit'ing the console every time leads to a very active
* screen when processing /etc/rc.
*/
-iteoff(dev, flag)
- dev_t dev;
+void
+iteoff(ip, flag)
+ struct ite_data *ip;
int flag;
{
- register struct ite_softc *ip = &ite_softc[ITEUNIT(dev)];
if (flag & 2) {
ip->flags |= ITE_INGRF;
struct proc *p;
{
int unit = ITEUNIT(dev);
- register struct tty *tp;
- register struct ite_softc *ip = &ite_softc[unit];
- register int error;
+ struct tty *tp;
+ struct ite_softc *sc = &ite_softc[unit];
+ struct ite_data *ip = sc->sc_data;
+ int error;
int first = 0;
- if (!ite_tty[unit])
- tp = ite_tty[unit] = ttymalloc();
+ if (ip->tty == NULL)
+ tp = ip->tty = ttymalloc();
else
- tp = ite_tty[unit];
+ tp = ip->tty;
if ((tp->t_state&(TS_ISOPEN|TS_XCLUDE)) == (TS_ISOPEN|TS_XCLUDE)
&& p->p_ucred->cr_uid != 0)
return (EBUSY);
if ((ip->flags & ITE_ACTIVE) == 0) {
- error = iteon(dev, 0);
+ error = iteon(ip, 0);
if (error)
return (error);
first = 1;
tp->t_winsize.ws_row = ip->rows;
tp->t_winsize.ws_col = ip->cols;
} else if (first)
- iteoff(dev, 0);
+ iteoff(ip, 0);
return (error);
}
int flag, mode;
struct proc *p;
{
- register struct tty *tp = ite_tty[ITEUNIT(dev)];
+ struct ite_softc *sc = &ite_softc[ITEUNIT(dev)];
+ struct ite_data *ip = sc->sc_data;
+ struct tty *tp = ip->tty;
(*linesw[tp->t_line].l_close)(tp, flag);
ttyclose(tp);
- iteoff(dev, 0);
+ iteoff(ip, 0);
#if 0
ttyfree(tp);
- ite_tty[ITEUNIT(dev)] = (struct tty *)0;
+ ip->tty = (struct tty *)0;
#endif
return(0);
}
struct uio *uio;
int flag;
{
- register struct tty *tp = ite_tty[ITEUNIT(dev)];
+ struct ite_softc *sc = &ite_softc[ITEUNIT(dev)];
+ struct tty *tp = sc->sc_data->tty;
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
}
struct uio *uio;
int flag;
{
- register struct tty *tp = ite_tty[ITEUNIT(dev)];
+ struct ite_softc *sc = &ite_softc[ITEUNIT(dev)];
+ struct tty *tp = sc->sc_data->tty;
return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
}
itetty(dev)
dev_t dev;
{
+ struct ite_softc *sc = &ite_softc[ITEUNIT(dev)];
- return (ite_tty[ITEUNIT(dev)]);
+ return (sc->sc_data->tty);
}
int
int flag;
struct proc *p;
{
- register struct tty *tp = ite_tty[ITEUNIT(dev)];
+ struct ite_softc *sc = &ite_softc[ITEUNIT(dev)];
+ struct ite_data *ip = sc->sc_data;
+ struct tty *tp = ip->tty;
int error;
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, addr, flag, p);
{
register int cc, s;
int hiwat = 0, hadcursor = 0;
- struct ite_softc *ip;
+ struct ite_softc *sc;
+ struct ite_data *ip;
+
+ sc = &ite_softc[ITEUNIT(tp->t_dev)];
+ ip = sc->sc_data;
/*
* (Potentially) lower priority. We only need to protect ourselves
* Handle common (?) case
*/
if (cc == 1) {
- iteputchar(getc(&tp->t_outq), tp->t_dev);
+ iteputchar(getc(&tp->t_outq), ip);
} else if (cc) {
/*
* Limit the amount of output we do in one burst
* Turn off cursor while we output multiple characters.
* Saves a lot of expensive window move operations.
*/
- ip = &ite_softc[ITEUNIT(tp->t_dev)];
if (ip->flags & ITE_CURSORON) {
ite_erasecursor(ip, ip->isw);
ip->flags &= ~ITE_CURSORON;
hadcursor = 1;
}
while (--cc >= 0)
- iteputchar(getc(&tp->t_outq), tp->t_dev);
+ iteputchar(getc(&tp->t_outq), ip);
if (hadcursor) {
ip->flags |= ITE_CURSORON;
ite_drawcursor(ip, ip->isw);
}
+void
itefilter(stat, c)
- register char stat, c;
+ char stat, c;
{
static int capsmode = 0;
static int metamode = 0;
register char code, *str;
- struct tty *kbd_tty = ite_tty[kbd_ite - ite_softc];
+ struct tty *kbd_tty = kbd_ite->tty;
if (kbd_tty == NULL)
return;
}
}
-iteputchar(c, dev)
- register int c;
- dev_t dev;
+void
+iteputchar(c, ip)
+ int c;
+ struct ite_data *ip;
{
- int unit = ITEUNIT(dev);
- register struct ite_softc *ip = &ite_softc[unit];
- register struct itesw *sp = ip->isw;
- register int n;
+ struct itesw *sp = ip->isw;
+ int n;
if ((ip->flags & (ITE_ACTIVE|ITE_INGRF)) != ITE_ACTIVE)
return;
break;
case '\t':
- if (ip->curx < TABEND(unit)) {
+ if (ip->curx < TABEND(ip)) {
n = TABSIZE - (ip->curx & (TABSIZE - 1));
ip->curx += n;
ite_movecursor(ip, sp);
case CTRL('G'):
if (ip == kbd_ite)
- kbdbell(unit);
+ kbdbell(0); /* XXX */
break;
case ESC:
}
}
+void
itecheckwrap(ip, sp)
- register struct ite_softc *ip;
- register struct itesw *sp;
+ struct ite_data *ip;
+ struct itesw *sp;
{
if (++ip->curx == ip->cols) {
ip->curx = 0;
ite_movecursor(ip, sp);
}
+void
ite_dchar(ip, sp)
- register struct ite_softc *ip;
- register struct itesw *sp;
+ struct ite_data *ip;
+ struct itesw *sp;
{
if (ip->curx < ip->cols - 1) {
ite_erasecursor(ip, sp);
ite_drawcursor(ip, sp);
}
+void
ite_ichar(ip, sp)
- register struct ite_softc *ip;
- register struct itesw *sp;
+ struct ite_data *ip;
+ struct itesw *sp;
{
if (ip->curx < ip->cols - 1) {
ite_erasecursor(ip, sp);
ite_drawcursor(ip, sp);
}
+void
ite_dline(ip, sp)
- register struct ite_softc *ip;
- register struct itesw *sp;
+ struct ite_data *ip;
+ struct itesw *sp;
{
if (ip->cury < ip->rows - 1) {
ite_erasecursor(ip, sp);
ite_clrtoeol(ip, sp, ip->rows - 1, 0);
}
+void
ite_iline(ip, sp)
- register struct ite_softc *ip;
- register struct itesw *sp;
+ struct ite_data *ip;
+ struct itesw *sp;
{
if (ip->cury < ip->rows - 1) {
ite_erasecursor(ip, sp);
ite_clrtoeol(ip, sp, ip->cury, 0);
}
+void
ite_clrtoeol(ip, sp, y, x)
- register struct ite_softc *ip;
- register struct itesw *sp;
- register int y, x;
+ struct ite_data *ip;
+ struct itesw *sp;
+ int y, x;
{
(*sp->ite_clear)(ip, y, x, 1, ip->cols - x);
attrclr(ip, y, x, 1, ip->cols - x);
ite_drawcursor(ip, sp);
}
+void
ite_clrtoeos(ip, sp)
- register struct ite_softc *ip;
- register struct itesw *sp;
+ struct ite_data *ip;
+ struct itesw *sp;
{
(*sp->ite_clear)(ip, ip->cury, 0, ip->rows - ip->cury, ip->cols);
attrclr(ip, ip->cury, 0, ip->rows - ip->cury, ip->cols);
ite_drawcursor(ip, sp);
}
-/*
- * Console functions
- */
-#include <dev/cons.h>
-#ifdef hp300
-#include <hp300/dev/grfreg.h>
-#endif
-
-#ifdef DEBUG
-/*
- * Minimum ITE number at which to start looking for a console.
- * Setting to 0 will do normal search, 1 will skip first ITE device,
- * NITE will skip ITEs and use serial port.
- */
-int whichconsole = 0;
-#endif
-
-void
-itecnprobe(cp)
- struct consdev *cp;
+int
+ite_major()
{
- register struct ite_softc *ip;
- int i, sw, maj, unit, pri;
+ static int itemaj, initialized;
- /* locate the major number */
- for (maj = 0; maj < nchrdev; maj++)
- if (cdevsw[maj].d_open == iteopen)
- break;
-
- /* urk! */
- grfconfig();
+ /* Only compute once. */
+ if (initialized)
+ return (itemaj);
+ initialized = 1;
- /* check all the individual displays and find the best */
- unit = -1;
- pri = CN_DEAD;
- for (i = 0; i < NITE; i++) {
- struct grf_softc *gp = &grf_softc[i];
-
- ip = &ite_softc[i];
- if ((gp->g_flags & GF_ALIVE) == 0)
- continue;
- ip->flags = (ITE_ALIVE|ITE_CONSOLE);
-
- /* locate the proper switch table. */
- for (sw = 0; sw < nitesw; sw++)
- if (itesw[sw].ite_hwid == gp->g_sw->gd_hwid)
- break;
-
- if (sw == nitesw)
- continue;
-#ifdef DEBUG
- if (i < whichconsole)
- continue;
-#endif
- ip->isw = &itesw[sw];
- ip->grf = gp;
-#ifdef hp300
- if ((int)gp->g_display.gd_regaddr == GRFIADDR) {
- pri = CN_INTERNAL;
- unit = i;
- } else if (unit < 0) {
- pri = CN_NORMAL;
- unit = i;
- }
-#endif
-#ifdef hp800
- /* XXX use the first one for now */
- if (unit < 0) {
- pri = CN_INTERNAL;
- unit = i;
- }
-#endif
- }
+ /* locate the major number */
+ for (itemaj = 0; itemaj < nchrdev; itemaj++)
+ if (cdevsw[itemaj].d_open == iteopen)
- /* initialize required fields */
- cp->cn_dev = makedev(maj, unit);
- cp->cn_pri = pri;
+ return (itemaj);
}
-void
-itecninit(cp)
- struct consdev *cp;
-{
- int unit = ITEUNIT(cp->cn_dev);
- struct ite_softc *ip = &ite_softc[unit];
-
- ip->attrbuf = console_attributes;
- iteinit(cp->cn_dev);
- ip->flags |= (ITE_ACTIVE | ITE_ISCONS);
- kbd_ite = ip;
-}
+/*
+ * Console functions. Console probes are done by the individual
+ * framebuffer drivers.
+ */
/*ARGSUSED*/
int
return(c);
}
+/* ARGSUSED */
void
itecnputc(dev, c)
dev_t dev;
int c;
{
static int paniced = 0;
- struct ite_softc *ip = &ite_softc[ITEUNIT(dev)];
+ struct ite_data *ip = &ite_cn;
if (panicstr && !paniced &&
(ip->flags & (ITE_ACTIVE|ITE_INGRF)) != ITE_ACTIVE) {
- (void) iteon(dev, 3);
+ (void) iteon(ip, 3);
paniced = 1;
}
- iteputchar(c, dev);
+ iteputchar(c, ip);
}
#endif
-/* $NetBSD: ite_dv.c,v 1.5 1994/10/26 07:24:28 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_dv.c 1.10 93/06/25$
- *
- * @(#)ite_dv.c 8.1 (Berkeley) 7/8/93
- */
-
-#include "ite.h"
-#if NITE > 0
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/systm.h>
-
-#include <hp300/dev/itevar.h>
-#include <hp300/dev/itereg.h>
-#include <hp300/dev/grf_dvreg.h>
-
-#include <machine/cpu.h>
-
-/* XXX */
-#include <hp300/dev/grfioctl.h>
-#include <hp300/dev/grfvar.h>
-
-#define REGBASE ((struct dvboxfb *)(ip->regbase))
-#define WINDOWMOVER dvbox_windowmove
-
-dvbox_init(ip)
- register struct ite_softc *ip;
-{
- int i;
-
- /* XXX */
- if (ip->regbase == 0) {
- struct grf_softc *gp = ip->grf;
-
- ip->regbase = gp->g_regkva;
- ip->fbbase = gp->g_fbkva;
- ip->fbwidth = gp->g_display.gd_fbwidth;
- ip->fbheight = gp->g_display.gd_fbheight;
- ip->dwidth = gp->g_display.gd_dwidth;
- ip->dheight = gp->g_display.gd_dheight;
- /*
- * XXX some displays (e.g. the davinci) appear
- * to return a display height greater than the
- * returned FB height. Guess we should go back
- * to getting the display dimensions from the
- * fontrom...
- */
- if (ip->dwidth > ip->fbwidth)
- ip->dwidth = ip->fbwidth;
- if (ip->dheight > ip->fbheight)
- ip->dheight = ip->fbheight;
- }
-
- dv_reset(ip->regbase);
-
- /*
- * Turn on frame buffer, turn on overlay planes, set replacement
- * rule, enable top overlay plane writes for ite, disable all frame
- * buffer planes, set byte per pixel, and display frame buffer 0.
- * Lastly, turn on the box.
- */
- REGBASE->interrupt = 0x04;
- REGBASE->drive = 0x10;
- REGBASE->rep_rule = RR_COPY << 4 | RR_COPY;
- REGBASE->opwen = 0x01;
- REGBASE->fbwen = 0x0;
- REGBASE->fold = 0x01;
- REGBASE->vdrive = 0x0;
- REGBASE->dispen = 0x01;
-
- /*
- * Video enable top overlay plane.
- */
- REGBASE->opvenp = 0x01;
- REGBASE->opvens = 0x01;
-
- /*
- * Make sure that overlay planes override frame buffer planes.
- */
- REGBASE->ovly0p = 0x0;
- REGBASE->ovly0s = 0x0;
- REGBASE->ovly1p = 0x0;
- REGBASE->ovly1s = 0x0;
- REGBASE->fv_trig = 0x1;
- DELAY(100);
-
- /*
- * Setup the overlay colormaps. Need to set the 0,1 (black/white)
- * color for both banks.
- */
-
- for (i = 0; i <= 1; i++) {
- REGBASE->cmapbank = i;
- REGBASE->rgb[0].red = 0x00;
- REGBASE->rgb[0].green = 0x00;
- REGBASE->rgb[0].blue = 0x00;
- REGBASE->rgb[1].red = 0xFF;
- REGBASE->rgb[1].green = 0xFF;
- REGBASE->rgb[1].blue = 0xFF;
- }
- REGBASE->cmapbank = 0;
-
- db_waitbusy(ip->regbase);
-
- ite_fontinfo(ip);
- ite_fontinit(ip);
-
- /*
- * Clear the (visible) framebuffer.
- */
- dvbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
- db_waitbusy(ip->regbase);
-
- /*
- * Stash the inverted cursor.
- */
- dvbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight,
- ip->ftwidth, RR_COPYINVERTED);
-}
-
-dvbox_deinit(ip)
- register struct ite_softc *ip;
-{
- dvbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
- db_waitbusy(ip->regbase);
-
- ip->flags &= ~ITE_INITED;
-}
-
-dvbox_putc(ip, c, dy, dx, mode)
- register struct ite_softc *ip;
- register int dy, dx;
- int c, mode;
-{
- register int wrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
-
- dvbox_windowmove(ip, charY(ip, c), charX(ip, c),
- dy * ip->ftheight, dx * ip->ftwidth,
- ip->ftheight, ip->ftwidth, wrr);
-}
-
-dvbox_cursor(ip, flag)
- register struct ite_softc *ip;
- register int flag;
-{
- if (flag == DRAW_CURSOR)
- draw_cursor(ip)
- else if (flag == MOVE_CURSOR) {
- erase_cursor(ip)
- draw_cursor(ip)
- }
- else
- erase_cursor(ip)
-}
-
-dvbox_clear(ip, sy, sx, h, w)
- struct ite_softc *ip;
- register int sy, sx, h, w;
-{
- dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
- sy * ip->ftheight, sx * ip->ftwidth,
- h * ip->ftheight, w * ip->ftwidth,
- RR_CLEAR);
-}
-
-dvbox_scroll(ip, sy, sx, count, dir)
- register struct ite_softc *ip;
- register int sy, count;
- int dir, sx;
-{
- register int dy;
- register int dx = sx;
- register int height = 1;
- register int width = ip->cols;
-
- if (dir == SCROLL_UP) {
- dy = sy - count;
- height = ip->rows - sy;
- }
- else if (dir == SCROLL_DOWN) {
- dy = sy + count;
- height = ip->rows - dy - 1;
- }
- else if (dir == SCROLL_RIGHT) {
- dy = sy;
- dx = sx + count;
- width = ip->cols - dx;
- }
- else {
- dy = sy;
- dx = sx - count;
- width = ip->cols - sx;
- }
-
- dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
- dy * ip->ftheight, dx * ip->ftwidth,
- height * ip->ftheight,
- width * ip->ftwidth, RR_COPY);
-}
-
-dvbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
- struct ite_softc *ip;
- int sy, sx, dy, dx, h, w, func;
-{
- register struct dvboxfb *dp = REGBASE;
- if (h == 0 || w == 0)
- return;
-
- db_waitbusy(ip->regbase);
- dp->rep_rule = func << 4 | func;
- dp->source_y = sy;
- dp->source_x = sx;
- dp->dest_y = dy;
- dp->dest_x = dx;
- dp->wheight = h;
- dp->wwidth = w;
- dp->wmove = 1;
-}
-#endif
-/* $NetBSD: ite_gb.c,v 1.5 1994/10/26 07:24:29 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_gb.c 1.20 92/12/20$
- *
- * @(#)ite_gb.c 8.1 (Berkeley) 6/10/93
- */
-
-#include "ite.h"
-#if NITE > 0
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/systm.h>
-
-#include <hp300/dev/itevar.h>
-#include <hp300/dev/itereg.h>
-#include <hp300/dev/grf_gbreg.h>
-
-#include <machine/cpu.h>
-
-/* XXX */
-#include <hp300/dev/grfioctl.h>
-#include <hp300/dev/grfvar.h>
-
-#define REGBASE ((struct gboxfb *)(ip->regbase))
-#define WINDOWMOVER gbox_windowmove
-
-gbox_init(ip)
- register struct ite_softc *ip;
-{
- /* XXX */
- if (ip->regbase == 0) {
- struct grf_softc *gp = ip->grf;
-
- ip->regbase = gp->g_regkva;
- ip->fbbase = gp->g_fbkva;
- ip->fbwidth = gp->g_display.gd_fbwidth;
- ip->fbheight = gp->g_display.gd_fbheight;
- ip->dwidth = gp->g_display.gd_dwidth;
- ip->dheight = gp->g_display.gd_dheight;
- }
-
- REGBASE->write_protect = 0x0;
- REGBASE->interrupt = 0x4;
- REGBASE->rep_rule = RR_COPY;
- REGBASE->blink1 = 0xff;
- REGBASE->blink2 = 0xff;
- gb_microcode(ip->regbase);
- REGBASE->sec_interrupt = 0x01;
-
- /*
- * Set up the color map entries. We use three entries in the
- * color map. The first, is for black, the second is for
- * white, and the very last entry is for the inverted cursor.
- */
- REGBASE->creg_select = 0x00;
- REGBASE->cmap_red = 0x00;
- REGBASE->cmap_grn = 0x00;
- REGBASE->cmap_blu = 0x00;
- REGBASE->cmap_write = 0x00;
- gbcm_waitbusy(ip->regbase);
-
- REGBASE->creg_select = 0x01;
- REGBASE->cmap_red = 0xFF;
- REGBASE->cmap_grn = 0xFF;
- REGBASE->cmap_blu = 0xFF;
- REGBASE->cmap_write = 0x01;
- gbcm_waitbusy(ip->regbase);
-
- REGBASE->creg_select = 0xFF;
- REGBASE->cmap_red = 0xFF;
- REGBASE->cmap_grn = 0xFF;
- REGBASE->cmap_blu = 0xFF;
- REGBASE->cmap_write = 0x01;
- gbcm_waitbusy(ip->regbase);
-
- ite_fontinfo(ip);
- ite_fontinit(ip);
-
- /*
- * Clear the display. This used to be before the font unpacking
- * but it crashes. Figure it out later.
- */
- gbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
- tile_mover_waitbusy(ip->regbase);
-
- /*
- * Stash the inverted cursor.
- */
- gbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight,
- ip->ftwidth, RR_COPYINVERTED);
-}
-
-gbox_deinit(ip)
- struct ite_softc *ip;
-{
- gbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
- tile_mover_waitbusy(ip->regbase);
-
- ip->flags &= ~ITE_INITED;
-}
-
-gbox_putc(ip, c, dy, dx, mode)
- register struct ite_softc *ip;
- register int dy, dx;
- int c, mode;
-{
- register int wrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
-
- gbox_windowmove(ip, charY(ip, c), charX(ip, c),
- dy * ip->ftheight, dx * ip->ftwidth,
- ip->ftheight, ip->ftwidth, wrr);
-}
-
-gbox_cursor(ip, flag)
- register struct ite_softc *ip;
- register int flag;
-{
- if (flag == DRAW_CURSOR)
- draw_cursor(ip)
- else if (flag == MOVE_CURSOR) {
- erase_cursor(ip)
- draw_cursor(ip)
- }
- else
- erase_cursor(ip)
-}
-
-gbox_clear(ip, sy, sx, h, w)
- struct ite_softc *ip;
- register int sy, sx, h, w;
-{
- gbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
- sy * ip->ftheight, sx * ip->ftwidth,
- h * ip->ftheight, w * ip->ftwidth,
- RR_CLEAR);
-}
-#define gbox_blockmove(ip, sy, sx, dy, dx, h, w) \
- gbox_windowmove((ip), \
- (sy) * ip->ftheight, \
- (sx) * ip->ftwidth, \
- (dy) * ip->ftheight, \
- (dx) * ip->ftwidth, \
- (h) * ip->ftheight, \
- (w) * ip->ftwidth, \
- RR_COPY)
-
-gbox_scroll(ip, sy, sx, count, dir)
- register struct ite_softc *ip;
- register int sy;
- int dir, sx, count;
-{
- register int height, dy, i;
-
- tile_mover_waitbusy(ip->regbase);
- REGBASE->write_protect = 0x0;
-
- if (dir == SCROLL_UP) {
- dy = sy - count;
- height = ip->rows - sy;
- for (i = 0; i < height; i++)
- gbox_blockmove(ip, sy + i, sx, dy + i, 0, 1, ip->cols);
- }
- else if (dir == SCROLL_DOWN) {
- dy = sy + count;
- height = ip->rows - dy;
- for (i = (height - 1); i >= 0; i--)
- gbox_blockmove(ip, sy + i, sx, dy + i, 0, 1, ip->cols);
- }
- else if (dir == SCROLL_RIGHT) {
- gbox_blockmove(ip, sy, sx, sy, sx + count,
- 1, ip->cols - (sx + count));
- }
- else {
- gbox_blockmove(ip, sy, sx, sy, sx - count,
- 1, ip->cols - sx);
- }
-}
-
-gbox_windowmove(ip, sy, sx, dy, dx, h, w, mask)
- register struct ite_softc *ip;
- int sy, sx, dy, dx, mask;
- register int h, w;
-{
- register int src, dest;
-
- src = (sy * 1024) + sx; /* upper left corner in pixels */
- dest = (dy * 1024) + dx;
-
- tile_mover_waitbusy(ip->regbase);
- REGBASE->width = -(w / 4);
- REGBASE->height = -(h / 4);
- if (src < dest)
- REGBASE->rep_rule = MOVE_DOWN_RIGHT|mask;
- else {
- REGBASE->rep_rule = MOVE_UP_LEFT|mask;
- /*
- * Adjust to top of lower right tile of the block.
- */
- src = src + ((h - 4) * 1024) + (w - 4);
- dest= dest + ((h - 4) * 1024) + (w - 4);
- }
- FBBASE[dest] = FBBASE[src];
-}
-#endif
-/* $NetBSD: ite_hy.c,v 1.2 1994/10/26 07:24:31 cgd Exp $ */
-
-/*
- * Copyright (c) 1991 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Mark Davies of the Department of Computer
- * Science, Victoria University of Wellington, New Zealand.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_hy.c 1.2 92/12/20$
- *
- * @(#)ite_hy.c 8.1 (Berkeley) 6/10/93
- */
-
-#include "ite.h"
-#if NITE > 0
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/systm.h>
-#include <sys/uio.h>
-
-#include <hp300/dev/grf_hyreg.h>
-#include <hp300/dev/itereg.h>
-#include <hp300/dev/itevar.h>
-
-#include <machine/cpu.h>
-
-/* XXX */
-#include <hp300/dev/grfioctl.h>
-#include <hp300/dev/grfvar.h>
-
-#define REGBASE ((struct hyboxfb *)(ip->regbase))
-#define WINDOWMOVER hyper_windowmove
-
-#undef charX
-#define charX(ip,c) \
- (((c) % (ip)->cpl) * ((((ip)->ftwidth + 7) / 8) * 8) + (ip)->fontx)
-
-hyper_init(ip)
- register struct ite_softc *ip;
-{
- int width;
-
- /* XXX */
- if (ip->regbase == NULL) {
- struct grf_softc *gp = ip->grf;
-
- ip->regbase = gp->g_regkva;
- ip->fbbase = gp->g_fbkva;
- ip->fbwidth = gp->g_display.gd_fbwidth;
- ip->fbheight = gp->g_display.gd_fbheight;
- ip->dwidth = gp->g_display.gd_dwidth;
- ip->dheight = gp->g_display.gd_dheight;
- }
-
- ite_fontinfo(ip);
- width = ((ip->ftwidth + 7) / 8) * 8;
- ip->cpl = (ip->fbwidth - ip->dwidth) / width;
- ip->cblanky = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight;
-
- /*
- * Clear the framebuffer on all planes.
- */
- hyper_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
-
- hyper_ite_fontinit(ip);
-
- REGBASE->nblank = 0x05;
-
- /*
- * Stash the inverted cursor.
- */
- hyper_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight,
- ip->ftwidth, RR_COPYINVERTED);
-}
-
-hyper_deinit(ip)
- register struct ite_softc *ip;
-{
- hyper_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
-
- REGBASE->nblank = 0x05;
- ip->flags &= ~ITE_INITED;
-}
-
-hyper_ite_fontinit(ip)
- register struct ite_softc *ip;
-{
- register u_char *fbmem, *dp;
- int c, l, b;
- int stride, width;
-
- dp = (u_char *)(getword(ip, getword(ip, FONTROM) + FONTADDR) +
- ip->regbase) + FONTDATA;
- stride = ip->fbwidth >> 3;
- width = (ip->ftwidth + 7) / 8;
-
- for (c = 0; c < 128; c++) {
- fbmem = (u_char *) FBBASE +
- (ip->fonty + (c / ip->cpl) * ip->ftheight) *
- stride;
- fbmem += (ip->fontx >> 3) + (c % ip->cpl) * width;
- for (l = 0; l < ip->ftheight; l++) {
- for (b = 0; b < width; b++) {
- *fbmem++ = *dp;
- dp += 2;
- }
- fbmem -= width;
- fbmem += stride;
- }
- }
-}
-
-hyper_putc(ip, c, dy, dx, mode)
- register struct ite_softc *ip;
- int c, dy, dx, mode;
-{
- int wmrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
-
- hyper_windowmove(ip, charY(ip, c), charX(ip, c),
- dy * ip->ftheight, dx * ip->ftwidth,
- ip->ftheight, ip->ftwidth, wmrr);
-}
-
-hyper_cursor(ip, flag)
- register struct ite_softc *ip;
- register int flag;
-{
- if (flag == DRAW_CURSOR)
- draw_cursor(ip)
- else if (flag == MOVE_CURSOR) {
- erase_cursor(ip)
- draw_cursor(ip)
- }
- else
- erase_cursor(ip)
-}
-
-hyper_clear(ip, sy, sx, h, w)
- register struct ite_softc *ip;
- register int sy, sx, h, w;
-{
- hyper_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
- sy * ip->ftheight, sx * ip->ftwidth,
- h * ip->ftheight, w * ip->ftwidth,
- RR_CLEAR);
-}
-
-hyper_scroll(ip, sy, sx, count, dir)
- register struct ite_softc *ip;
- register int sy, count;
- int dir, sx;
-{
- register int dy;
- register int dx = sx;
- register int height = 1;
- register int width = ip->cols;
-
- if (dir == SCROLL_UP) {
- dy = sy - count;
- height = ip->rows - sy;
- }
- else if (dir == SCROLL_DOWN) {
- dy = sy + count;
- height = ip->rows - dy - 1;
- }
- else if (dir == SCROLL_RIGHT) {
- dy = sy;
- dx = sx + count;
- width = ip->cols - dx;
- }
- else {
- dy = sy;
- dx = sx - count;
- width = ip->cols - sx;
- }
-
- hyper_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
- dy * ip->ftheight, dx * ip->ftwidth,
- height * ip->ftheight,
- width * ip->ftwidth, RR_COPY);
-}
-
-#include <hp300/dev/maskbits.h>
-
-/* NOTE:
- * the first element in starttab could be 0xffffffff. making it 0
- * lets us deal with a full first word in the middle loop, rather
- * than having to do the multiple reads and masks that we'd
- * have to do if we thought it was partial.
- */
-int starttab[32] =
- {
- 0x00000000,
- 0x7FFFFFFF,
- 0x3FFFFFFF,
- 0x1FFFFFFF,
- 0x0FFFFFFF,
- 0x07FFFFFF,
- 0x03FFFFFF,
- 0x01FFFFFF,
- 0x00FFFFFF,
- 0x007FFFFF,
- 0x003FFFFF,
- 0x001FFFFF,
- 0x000FFFFF,
- 0x0007FFFF,
- 0x0003FFFF,
- 0x0001FFFF,
- 0x0000FFFF,
- 0x00007FFF,
- 0x00003FFF,
- 0x00001FFF,
- 0x00000FFF,
- 0x000007FF,
- 0x000003FF,
- 0x000001FF,
- 0x000000FF,
- 0x0000007F,
- 0x0000003F,
- 0x0000001F,
- 0x0000000F,
- 0x00000007,
- 0x00000003,
- 0x00000001
- };
-
-int endtab[32] =
- {
- 0x00000000,
- 0x80000000,
- 0xC0000000,
- 0xE0000000,
- 0xF0000000,
- 0xF8000000,
- 0xFC000000,
- 0xFE000000,
- 0xFF000000,
- 0xFF800000,
- 0xFFC00000,
- 0xFFE00000,
- 0xFFF00000,
- 0xFFF80000,
- 0xFFFC0000,
- 0xFFFE0000,
- 0xFFFF0000,
- 0xFFFF8000,
- 0xFFFFC000,
- 0xFFFFE000,
- 0xFFFFF000,
- 0xFFFFF800,
- 0xFFFFFC00,
- 0xFFFFFE00,
- 0xFFFFFF00,
- 0xFFFFFF80,
- 0xFFFFFFC0,
- 0xFFFFFFE0,
- 0xFFFFFFF0,
- 0xFFFFFFF8,
- 0xFFFFFFFC,
- 0xFFFFFFFE
- };
-
-hyper_windowmove(ip, sy, sx, dy, dx, h, w, func)
- struct ite_softc *ip;
- int sy, sx, dy, dx, h, w, func;
-{
- int width; /* add to get to same position in next line */
-
- unsigned int *psrcLine, *pdstLine;
- /* pointers to line with current src and dst */
- register unsigned int *psrc; /* pointer to current src longword */
- register unsigned int *pdst; /* pointer to current dst longword */
-
- /* following used for looping through a line */
- unsigned int startmask, endmask; /* masks for writing ends of dst */
- int nlMiddle; /* whole longwords in dst */
- register int nl; /* temp copy of nlMiddle */
- register unsigned int tmpSrc;
- /* place to store full source word */
- register int xoffSrc; /* offset (>= 0, < 32) from which to
- fetch whole longwords fetched
- in src */
- int nstart; /* number of ragged bits at start of dst */
- int nend; /* number of ragged bits at end of dst */
- int srcStartOver; /* pulling nstart bits from src
- overflows into the next word? */
-
- if (h == 0 || w == 0)
- return;
-
- width = ip->fbwidth >> 5;
-
- if (sy < dy) /* start at last scanline of rectangle */
- {
- psrcLine = ((unsigned int *) ip->fbbase) + ((sy+h-1) * width);
- pdstLine = ((unsigned int *) ip->fbbase) + ((dy+h-1) * width);
- width = -width;
- }
- else /* start at first scanline */
- {
- psrcLine = ((unsigned int *) ip->fbbase) + (sy * width);
- pdstLine = ((unsigned int *) ip->fbbase) + (dy * width);
- }
-
- /* x direction doesn't matter for < 1 longword */
- if (w <= 32)
- {
- int srcBit, dstBit; /* bit offset of src and dst */
-
- pdstLine += (dx >> 5);
- psrcLine += (sx >> 5);
- psrc = psrcLine;
- pdst = pdstLine;
-
- srcBit = sx & 0x1f;
- dstBit = dx & 0x1f;
-
- while(h--)
- {
- getandputrop(psrc, srcBit, dstBit, w, pdst, func)
- pdst += width;
- psrc += width;
- }
- }
- else
- {
- maskbits(dx, w, startmask, endmask, nlMiddle)
- if (startmask)
- nstart = 32 - (dx & 0x1f);
- else
- nstart = 0;
- if (endmask)
- nend = (dx + w) & 0x1f;
- else
- nend = 0;
-
- xoffSrc = ((sx & 0x1f) + nstart) & 0x1f;
- srcStartOver = ((sx & 0x1f) + nstart) > 31;
-
- if (sx >= dx) /* move left to right */
- {
- pdstLine += (dx >> 5);
- psrcLine += (sx >> 5);
-
- while (h--)
- {
- psrc = psrcLine;
- pdst = pdstLine;
-
- if (startmask)
- {
- getandputrop(psrc, (sx & 0x1f),
- (dx & 0x1f), nstart, pdst, func)
- pdst++;
- if (srcStartOver)
- psrc++;
- }
-
- /* special case for aligned operations */
- if (xoffSrc == 0)
- {
- nl = nlMiddle;
- while (nl--)
- {
- DoRop (*pdst, func, *psrc++, *pdst);
- pdst++;
- }
- }
- else
- {
- nl = nlMiddle + 1;
- while (--nl)
- {
- getunalignedword (psrc, xoffSrc, tmpSrc)
- DoRop (*pdst, func, tmpSrc, *pdst);
- pdst++;
- psrc++;
- }
- }
-
- if (endmask)
- {
- getandputrop0(psrc, xoffSrc, nend, pdst, func);
- }
-
- pdstLine += width;
- psrcLine += width;
- }
- }
- else /* move right to left */
- {
- pdstLine += (dx+w >> 5);
- psrcLine += (sx+w >> 5);
- /* if fetch of last partial bits from source crosses
- a longword boundary, start at the previous longword
- */
- if (xoffSrc + nend >= 32)
- --psrcLine;
-
- while (h--)
- {
- psrc = psrcLine;
- pdst = pdstLine;
-
- if (endmask)
- {
- getandputrop0(psrc, xoffSrc, nend, pdst, func);
- }
-
- nl = nlMiddle + 1;
- while (--nl)
- {
- --psrc;
- --pdst;
- getunalignedword(psrc, xoffSrc, tmpSrc)
- DoRop(*pdst, func, tmpSrc, *pdst);
- }
-
- if (startmask)
- {
- if (srcStartOver)
- --psrc;
- --pdst;
- getandputrop(psrc, (sx & 0x1f),
- (dx & 0x1f), nstart, pdst, func)
- }
-
- pdstLine += width;
- psrcLine += width;
- }
- } /* move right to left */
- }
-}
-#endif
-/* $NetBSD: ite_rb.c,v 1.5 1994/10/26 07:24:33 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_rb.c 1.19 93/06/25$
- *
- * @(#)ite_rb.c 8.1 (Berkeley) 7/8/93
- */
-
-#include "ite.h"
-#if NITE > 0
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/systm.h>
-
-#include <hp300/dev/itevar.h>
-#include <hp300/dev/itereg.h>
-#include <hp300/dev/grf_rbreg.h>
-
-#include <machine/cpu.h>
-
-/* XXX */
-#include <hp300/dev/grfioctl.h>
-#include <hp300/dev/grfvar.h>
-
-#define REGBASE ((struct rboxfb *)(ip->regbase))
-#define WINDOWMOVER rbox_windowmove
-
-rbox_init(ip)
- struct ite_softc *ip;
-{
- register int i;
-
- /* XXX */
- if (ip->regbase == 0) {
- struct grf_softc *gp = ip->grf;
-
- ip->regbase = gp->g_regkva;
- ip->fbbase = gp->g_fbkva;
- ip->fbwidth = gp->g_display.gd_fbwidth;
- ip->fbheight = gp->g_display.gd_fbheight;
- ip->dwidth = gp->g_display.gd_dwidth;
- ip->dheight = gp->g_display.gd_dheight;
- /*
- * XXX some displays (e.g. the davinci) appear
- * to return a display height greater than the
- * returned FB height. Guess we should go back
- * to getting the display dimensions from the
- * fontrom...
- */
- if (ip->dwidth > ip->fbwidth)
- ip->dwidth = ip->fbwidth;
- if (ip->dheight > ip->fbheight)
- ip->dheight = ip->fbheight;
- }
-
- rb_waitbusy(ip->regbase);
-
- REGBASE->reset = 0x39;
- DELAY(1000);
-
- REGBASE->interrupt = 0x04;
- REGBASE->display_enable = 0x01;
- REGBASE->video_enable = 0x01;
- REGBASE->drive = 0x01;
- REGBASE->vdrive = 0x0;
-
- ite_fontinfo(ip);
-
- REGBASE->opwen = 0xFF;
-
- /*
- * Clear the framebuffer.
- */
- rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
- rb_waitbusy(ip->regbase);
-
- for(i = 0; i < 16; i++) {
- *(ip->regbase + 0x63c3 + i*4) = 0x0;
- *(ip->regbase + 0x6403 + i*4) = 0x0;
- *(ip->regbase + 0x6803 + i*4) = 0x0;
- *(ip->regbase + 0x6c03 + i*4) = 0x0;
- *(ip->regbase + 0x73c3 + i*4) = 0x0;
- *(ip->regbase + 0x7403 + i*4) = 0x0;
- *(ip->regbase + 0x7803 + i*4) = 0x0;
- *(ip->regbase + 0x7c03 + i*4) = 0x0;
- }
-
- REGBASE->rep_rule = 0x33;
-
- /*
- * I cannot figure out how to make the blink planes stop. So, we
- * must set both colormaps so that when the planes blink, and
- * the secondary colormap is active, we still get text.
- */
- CM1RED[0x00].value = 0x00;
- CM1GRN[0x00].value = 0x00;
- CM1BLU[0x00].value = 0x00;
- CM1RED[0x01].value = 0xFF;
- CM1GRN[0x01].value = 0xFF;
- CM1BLU[0x01].value = 0xFF;
-
- CM2RED[0x00].value = 0x00;
- CM2GRN[0x00].value = 0x00;
- CM2BLU[0x00].value = 0x00;
- CM2RED[0x01].value = 0xFF;
- CM2GRN[0x01].value = 0xFF;
- CM2BLU[0x01].value = 0xFF;
-
- REGBASE->blink = 0x00;
- REGBASE->write_enable = 0x01;
- REGBASE->opwen = 0x00;
-
- ite_fontinit(ip);
-
- /*
- * Stash the inverted cursor.
- */
- rbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight,
- ip->ftwidth, RR_COPYINVERTED);
-}
-
-rbox_deinit(ip)
- struct ite_softc *ip;
-{
- rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
- rb_waitbusy(ip->regbase);
-
- ip->flags &= ~ITE_INITED;
-}
-
-rbox_putc(ip, c, dy, dx, mode)
- register struct ite_softc *ip;
- register int dy, dx;
- int c, mode;
-{
- register int wrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
-
- rbox_windowmove(ip, charY(ip, c), charX(ip, c),
- dy * ip->ftheight, dx * ip->ftwidth,
- ip->ftheight, ip->ftwidth, wrr);
-}
-
-rbox_cursor(ip, flag)
- register struct ite_softc *ip;
- register int flag;
-{
- if (flag == DRAW_CURSOR)
- draw_cursor(ip)
- else if (flag == MOVE_CURSOR) {
- erase_cursor(ip)
- draw_cursor(ip)
- }
- else
- erase_cursor(ip)
-}
-
-rbox_clear(ip, sy, sx, h, w)
- struct ite_softc *ip;
- register int sy, sx, h, w;
-{
- rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
- sy * ip->ftheight, sx * ip->ftwidth,
- h * ip->ftheight, w * ip->ftwidth,
- RR_CLEAR);
-}
-
-rbox_scroll(ip, sy, sx, count, dir)
- register struct ite_softc *ip;
- register int sy, count;
- int dir, sx;
-{
- register int dy;
- register int dx = sx;
- register int height = 1;
- register int width = ip->cols;
-
- if (dir == SCROLL_UP) {
- dy = sy - count;
- height = ip->rows - sy;
- }
- else if (dir == SCROLL_DOWN) {
- dy = sy + count;
- height = ip->rows - dy - 1;
- }
- else if (dir == SCROLL_RIGHT) {
- dy = sy;
- dx = sx + count;
- width = ip->cols - dx;
- }
- else {
- dy = sy;
- dx = sx - count;
- width = ip->cols - sx;
- }
-
- rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
- dy * ip->ftheight, dx * ip->ftwidth,
- height * ip->ftheight,
- width * ip->ftwidth, RR_COPY);
-}
-
-rbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
- struct ite_softc *ip;
- int sy, sx, dy, dx, h, w, func;
-{
- register struct rboxfb *rp = REGBASE;
- if (h == 0 || w == 0)
- return;
-
- rb_waitbusy(ip->regbase);
- rp->rep_rule = func << 4 | func;
- rp->source_y = sy;
- rp->source_x = sx;
- rp->dest_y = dy;
- rp->dest_x = dx;
- rp->wheight = h;
- rp->wwidth = w;
- rp->wmove = 1;
-}
-#endif
-/* $NetBSD: ite_subr.c,v 1.5 1994/10/26 07:24:35 cgd Exp $ */
+/* $NetBSD: ite_subr.c,v 1.6 1996/02/24 00:55:29 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#include <machine/cpu.h>
+void
ite_fontinfo(ip)
- struct ite_softc *ip;
+ struct ite_data *ip;
{
u_long fontaddr = getword(ip, getword(ip, FONTROM) + FONTADDR);
}
}
+void
ite_fontinit(ip)
- register struct ite_softc *ip;
+ struct ite_data *ip;
{
int bytewidth = (((ip->ftwidth - 1) / 8) + 1);
int glyphsize = bytewidth * ip->ftheight;
*/
u_char
ite_readbyte(ip, disp)
- struct ite_softc *ip;
+ struct ite_data *ip;
int disp;
{
return((u_char) *(((u_char *)ip->regbase) + disp));
}
+void
ite_writeglyph(ip, fbmem, glyphp)
- register struct ite_softc *ip;
- register u_char *fbmem, *glyphp;
+ struct ite_data *ip;
+ u_char *fbmem, *glyphp;
{
register int bn;
int l, b;
-/* $NetBSD: ite_tc.c,v 1.5 1994/10/26 07:24:37 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_tc.c 1.27 92/12/20$
- *
- * @(#)ite_tc.c 8.1 (Berkeley) 6/10/93
- */
-
-#include "ite.h"
-#if NITE > 0
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/systm.h>
-
-#include <hp300/dev/grf_tcreg.h>
-#include <hp300/dev/grfreg.h>
-#include <hp300/dev/itereg.h>
-#include <hp300/dev/itevar.h>
-
-#include <machine/cpu.h>
-
-/* XXX */
-#include <hp300/dev/grfioctl.h>
-#include <hp300/dev/grfvar.h>
-
-#define REGBASE ((struct tcboxfb *)(ip->regbase))
-#define WINDOWMOVER topcat_windowmove
-
-topcat_init(ip)
- register struct ite_softc *ip;
-{
- /* XXX */
- if (ip->regbase == NULL) {
- struct grf_softc *gp = ip->grf;
-
- ip->regbase = gp->g_regkva;
- ip->fbbase = gp->g_fbkva;
- ip->fbwidth = gp->g_display.gd_fbwidth;
- ip->fbheight = gp->g_display.gd_fbheight;
- ip->dwidth = gp->g_display.gd_dwidth;
- ip->dheight = gp->g_display.gd_dheight;
- }
-
- /*
- * Catseye looks a lot like a topcat, but not completely.
- * So, we set some bits to make it work.
- */
- if (REGBASE->fbid != GID_TOPCAT) {
- while ((REGBASE->catseye_status & 1))
- ;
- REGBASE->catseye_status = 0x0;
- REGBASE->vb_select = 0x0;
- REGBASE->tcntrl = 0x0;
- REGBASE->acntrl = 0x0;
- REGBASE->pncntrl = 0x0;
- REGBASE->rug_cmdstat = 0x90;
- }
-
- /*
- * Determine the number of planes by writing to the first frame
- * buffer display location, then reading it back.
- */
- REGBASE->wen = ~0;
- REGBASE->fben = ~0;
- REGBASE->prr = RR_COPY;
- *FBBASE = 0xFF;
- ip->planemask = *FBBASE;
-
- /*
- * Enable reading/writing of all the planes.
- */
- REGBASE->fben = ip->planemask;
- REGBASE->wen = ip->planemask;
- REGBASE->ren = ip->planemask;
- REGBASE->prr = RR_COPY;
-
- ite_fontinfo(ip);
-
- /*
- * Clear the framebuffer on all planes.
- */
- topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
- tc_waitbusy(ip->regbase, ip->planemask);
-
- ite_fontinit(ip);
-
- /*
- * Initialize color map for color displays
- */
- if (ip->planemask != 1) {
- tc_waitbusy(ip->regbase, ip->planemask);
- REGBASE->nblank = 0x01;
-
- tccm_waitbusy(ip->regbase);
- REGBASE->rdata = 0x0;
- REGBASE->gdata = 0x0;
- REGBASE->bdata = 0x0;
- REGBASE->cindex = 0xFF;
- REGBASE->strobe = 0xFF;
-
- DELAY(100);
- tccm_waitbusy(ip->regbase);
- REGBASE->rdata = 0x0;
- REGBASE->gdata = 0x0;
- REGBASE->bdata = 0x0;
- REGBASE->cindex = 0x0;
-
- DELAY(100);
- tccm_waitbusy(ip->regbase);
- REGBASE->rdata = 0xFF;
- REGBASE->gdata = 0xFF;
- REGBASE->bdata = 0xFF;
- REGBASE->cindex = 0xFE;
- REGBASE->strobe = 0xFF;
-
- DELAY(100);
- tccm_waitbusy(ip->regbase);
- REGBASE->rdata = 0x0;
- REGBASE->gdata = 0x0;
- REGBASE->bdata = 0x0;
- REGBASE->cindex = 0x0;
- }
-
- /*
- * Stash the inverted cursor.
- */
- topcat_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight,
- ip->ftwidth, RR_COPYINVERTED);
-}
-
-topcat_deinit(ip)
- register struct ite_softc *ip;
-{
- topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
- tc_waitbusy(ip->regbase, ip->planemask);
-
- REGBASE->nblank = ~0;
- ip->flags &= ~ITE_INITED;
-}
-
-topcat_putc(ip, c, dy, dx, mode)
- register struct ite_softc *ip;
- int c, dy, dx, mode;
-{
- int wmrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
-
- topcat_windowmove(ip, charY(ip, c), charX(ip, c),
- dy * ip->ftheight, dx * ip->ftwidth,
- ip->ftheight, ip->ftwidth, wmrr);
-}
-
-topcat_cursor(ip, flag)
- register struct ite_softc *ip;
- register int flag;
-{
- if (flag == DRAW_CURSOR)
- draw_cursor(ip)
- else if (flag == MOVE_CURSOR) {
- erase_cursor(ip)
- draw_cursor(ip)
- }
- else
- erase_cursor(ip)
-}
-
-topcat_clear(ip, sy, sx, h, w)
- register struct ite_softc *ip;
- register int sy, sx, h, w;
-{
- topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
- sy * ip->ftheight, sx * ip->ftwidth,
- h * ip->ftheight, w * ip->ftwidth,
- RR_CLEAR);
-}
-
-topcat_scroll(ip, sy, sx, count, dir)
- register struct ite_softc *ip;
- register int sy, count;
- int dir, sx;
-{
- register int dy;
- register int dx = sx;
- register int height = 1;
- register int width = ip->cols;
-
- if (dir == SCROLL_UP) {
- dy = sy - count;
- height = ip->rows - sy;
- }
- else if (dir == SCROLL_DOWN) {
- dy = sy + count;
- height = ip->rows - dy - 1;
- }
- else if (dir == SCROLL_RIGHT) {
- dy = sy;
- dx = sx + count;
- width = ip->cols - dx;
- }
- else {
- dy = sy;
- dx = sx - count;
- width = ip->cols - sx;
- }
-
- topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
- dy * ip->ftheight, dx * ip->ftwidth,
- height * ip->ftheight,
- width * ip->ftwidth, RR_COPY);
-}
-
-topcat_windowmove(ip, sy, sx, dy, dx, h, w, func)
- struct ite_softc *ip;
- int sy, sx, dy, dx, h, w, func;
-{
- register struct tcboxfb *rp = REGBASE;
-
- if (h == 0 || w == 0)
- return;
- tc_waitbusy(ip->regbase, ip->planemask);
- rp->wmrr = func;
- rp->source_y = sy;
- rp->source_x = sx;
- rp->dest_y = dy;
- rp->dest_x = dx;
- rp->wheight = h;
- rp->wwidth = w;
- rp->wmove = ip->planemask;
-}
-#endif
-/* $NetBSD: itevar.h,v 1.8 1995/11/19 23:14:25 thorpej Exp $ */
+/* $NetBSD: itevar.h,v 1.9 1996/02/24 00:55:31 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#define ITEUNIT(dev) minor(dev)
-struct itesw {
- int ite_hwid; /* Hardware id */
- int (*ite_init)();
- int (*ite_deinit)();
- int (*ite_clear)();
- int (*ite_putc)();
- int (*ite_cursor)();
- int (*ite_scroll)();
- u_char (*ite_readbyte)();
- int (*ite_writeglyph)();
-};
-
#define getbyte(ip, offset) \
((*(ip)->isw->ite_readbyte)(ip, offset))
#define writeglyph(ip, offset, fontbuf) \
((*(ip)->isw->ite_writeglyph)((ip), (offset), (fontbuf)))
-struct ite_softc {
+struct ite_data {
int flags;
+ struct tty *tty;
struct itesw *isw;
- struct grf_softc *grf;
+ struct grf_data *grf;
caddr_t regbase, fbbase;
short curx, cury;
short cursorx, cursory;
caddr_t devdata; /* display dependent data */
};
+struct itesw {
+ void (*ite_init) __P((struct ite_data *));
+ void (*ite_deinit) __P((struct ite_data *));
+ void (*ite_clear) __P((struct ite_data *, int, int, int, int));
+ void (*ite_putc) __P((struct ite_data *, int, int, int, int));
+ void (*ite_cursor) __P((struct ite_data *, int));
+ void (*ite_scroll) __P((struct ite_data *, int, int, int, int));
+ u_char (*ite_readbyte) __P((struct ite_data *, int));
+ void (*ite_writeglyph) __P((struct ite_data *, u_char *, u_char *));
+};
+
+struct ite_softc {
+ struct ite_data *sc_data; /* terminal state info */
+ struct grf_softc *sc_grf; /* pointer to framebuffer */
+};
+
/* Flags */
#define ITE_ALIVE 0x01 /* hardware exists */
#define ITE_INITED 0x02 /* device has been initialized */
#define KBD_EXT_RIGHT_UP 0x93
#define TABSIZE 8
-#define TABEND(u) (ite_tty[u]->t_winsize.ws_col - TABSIZE)
+#define TABEND(ip) ((ip)->tty->t_winsize.ws_col - TABSIZE)
#ifdef _KERNEL
+extern struct ite_data ite_cn; /* ite_data for console device */
+extern struct ite_data *kbd_ite; /* XXX */
extern struct ite_softc ite_softc[];
extern struct itesw itesw[];
+extern u_char console_attributes[];
extern int nitesw;
+
+/* ite.c prototypes */
+void ite_attach_grf __P((int, int));
+int iteon __P((struct ite_data *, int));
+void iteoff __P((struct ite_data *, int));
+void itefilter __P((char, char));
+int ite_major __P((void));
+
+/* ite_subr.c prototypes */
+void ite_fontinfo __P((struct ite_data *));
+void ite_fontinit __P((struct ite_data *));
+u_char ite_readbyte __P((struct ite_data *, int));
+void ite_writeglyph __P((struct ite_data *, u_char *, u_char *));
#endif
-/* $NetBSD: mt.c,v 1.2 1995/12/02 18:22:04 thorpej Exp $ */
+/* $NetBSD: mt.c,v 1.3 1996/02/14 02:44:40 thorpej Exp $ */
/*
* Copyright (c) 1992, The University of Utah and
sc->sc_hpibno = hpibno;
sc->sc_slave = slave;
sc->sc_flags = MTF_EXISTS;
+ sc->sc_dq.dq_softc = sc;
sc->sc_dq.dq_ctlr = hpibno;
sc->sc_dq.dq_unit = unit;
sc->sc_dq.dq_slave = slave;
{ hpib_softc[unit].sc_flags &= ~HPIBF_PPOLL; }
void
-spl_mtintr(unit)
- int unit;
+spl_mtintr(arg)
+ void *arg;
{
+ struct mt_softc *sc = arg;
int s = splbio();
- hpibppclear(mt_softc[unit].sc_hpibno);
- mtintr(unit);
+ hpibppclear(sc->sc_hpibno);
+ mtintr(sc);
(void) splx(s);
}
log(LOG_ERR, "mt%d can't reset\n", unit);
goto fatalerror;
}
- timeout(spl_mtintr, (void *)unit, 4 * hz);
+ timeout(spl_mtintr, (void *)sc, 4 * hz);
hpibawait(sc->sc_hpibno, sc->sc_slave);
return;
bp->b_un.b_addr, bp->b_bcount, rw, rw != 0);
}
-mtintr(unit)
- register int unit;
+int
+mtintr(arg)
+ void *arg;
{
- register struct mt_softc *sc = &mt_softc[unit];
+ register struct mt_softc *sc = arg;
register struct buf *bp, *dp;
register int i;
+ int unit = sc->sc_hd->hp_unit;
u_char cmdbuf[4];
bp = mttab[unit].b_actf;
* to the request for DSJ. It's probably just "busy" figuring
* it out and will know in a little bit...
*/
- timeout(spl_mtintr, (void *)unit, hz >> 5);
+ timeout(spl_mtintr, (void *)sc, hz >> 5);
return;
default:
sc->sc_stat3, sc->sc_stat5);
if ((bp->b_flags & B_CMD) && bp->b_cmd == MTRESET)
- untimeout(spl_mtintr, (void *)unit);
+ untimeout(spl_mtintr, (void *)sc);
if (sc->sc_stat3 & SR3_POWERUP)
sc->sc_flags &= MTF_OPEN | MTF_EXISTS;
goto error;
sc->sc_flags |= MTF_HITBOF;
}
if (bp->b_cmd == MTRESET) {
- untimeout(spl_mtintr, (void *)unit);
+ untimeout(spl_mtintr, (void *)sc);
sc->sc_flags |= MTF_ALIVE;
}
} else {
-/* $NetBSD: nhpib.c,v 1.8 1995/12/02 18:22:06 thorpej Exp $ */
+/* $NetBSD: nhpib.c,v 1.9 1996/02/14 02:44:45 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
void nhpibppwatch __P((void *));
void nhpibgo __P((int, int, int, void *, int, int, int));
void nhpibdone __P((int));
-int nhpibintr __P((int));
+int nhpibintr __P((void *));
/*
* Our controller ops structure.
hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
dmafree(&hs->sc_dq);
dq = hs->sc_sq.dq_forw;
- (dq->dq_driver->d_intr)(dq->dq_unit);
+ (dq->dq_driver->d_intr)(dq->dq_softc);
}
(void) splx(s);
}
}
int
-nhpibintr(unit)
- register int unit;
+nhpibintr(arg)
+ void *arg;
{
- register struct hpib_softc *hs = &hpib_softc[unit];
+ register struct hpib_softc *hs = arg;
register struct nhpibdevice *hd;
register struct devqueue *dq;
register int stat0;
- int stat1;
+ int stat1, unit = hs->sc_hc->hp_unit;
#ifdef lint
if (stat1 = unit) return(1);
hd->hpib_acr = AUX_TCA;
hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
dmafree(&hs->sc_dq);
- (dq->dq_driver->d_intr)(dq->dq_unit);
+ (dq->dq_driver->d_intr)(dq->dq_softc);
} else if (hs->sc_flags & HPIBF_PPOLL) {
hd->hpib_mim = 0;
stat0 = nhpibppoll(unit);
if (stat0 & (0x80 >> dq->dq_slave)) {
hs->sc_flags &= ~HPIBF_PPOLL;
- (dq->dq_driver->d_intr)(dq->dq_unit);
+ (dq->dq_driver->d_intr)(dq->dq_softc);
}
#ifdef DEBUG
else
-/* $NetBSD: ppi.c,v 1.7 1995/12/02 18:22:08 thorpej Exp $ */
+/* $NetBSD: ppi.c,v 1.8 1996/02/14 02:44:49 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
printf("\n");
sc->sc_flags = PPIF_ALIVE;
+ sc->sc_dq.dq_softc = sc;
sc->sc_dq.dq_ctlr = hd->hp_ctlr;
sc->sc_dq.dq_unit = hd->hp_unit;
sc->sc_dq.dq_slave = hd->hp_slave;
-/* $NetBSD: rd.c,v 1.18 1996/01/10 20:54:29 thorpej Exp $ */
+/* $NetBSD: rd.c,v 1.20 1996/02/14 02:44:54 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
rs->sc_dkdev.dk_name = rs->sc_xname;
disk_attach(&rs->sc_dkdev);
- return (0);
-
return (1);
}
(void)rdident(rs, hd, 1); /* XXX Ick. */
+ rs->sc_dq.dq_softc = rs;
rs->sc_dq.dq_ctlr = hd->hp_ctlr;
rs->sc_dq.dq_unit = hd->hp_unit;
rs->sc_dq.dq_slave = hd->hp_slave;
rs->sc_addr, rs->sc_resid, rw, rw != 0);
}
-rdintr(unit)
- register int unit;
+rdintr(arg)
+ void *arg;
{
- register struct rd_softc *rs = &rd_softc[unit];
+ register struct rd_softc *rs = arg;
+ int unit = rs->sc_hd->hp_unit;
register struct buf *bp = rdtab[unit].b_actf;
register struct hp_device *hp = rs->sc_hd;
u_char stat = 13; /* in case hpibrecv fails */
-/* $NetBSD: rdreg.h,v 1.6 1995/12/31 04:11:43 thorpej Exp $ */
+/* $NetBSD: rdreg.h,v 1.7 1996/02/09 18:00:37 scottr Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#define C_SREL 0x3b
#define C_SSM 0x3e
#define C_SRAM 0x48
-/*
- * XXX XXX XXX THIS IS SUPPOSED TO FIT IN A 1-BYTE SPACE?!
- */
-#if 0
-#define C_REL 0x140
-#else
-#define C_REL 0x40 /* what ended up happening */
-#endif
+#define C_REL 0xc0
#define C_CMD 0x05
#define C_EXEC 0x0e
-/* $NetBSD: scsi.c,v 1.7 1995/12/02 18:22:12 thorpej Exp $ */
+/* $NetBSD: scsi.c,v 1.8 1996/02/14 02:44:59 thorpej Exp $ */
/*
* Copyright (c) 1990, 1993
extern void _insque();
extern void _remque();
-int scsimatch(), scsigo(), scsiintr(), scsixfer();
+int scsimatch(), scsigo(), scsixfer();
void scsiattach(), scsistart(), scsidone(), scsifree(), scsireset();
+int scsiintr __P((void *));
struct driver scsidriver = {
scsimatch, scsiattach, "scsi", (int (*)())scsistart, scsigo, scsiintr,
(int (*)())scsidone,
};
struct scsi_softc scsi_softc[NSCSI];
-struct isr scsi_isr[NSCSI];
int scsi_cmd_wait = SCSI_CMD_WAIT;
int scsi_data_wait = SCSI_DATA_WAIT;
hs->sc_dq.dq_unit = hc->hp_unit;
hs->sc_dq.dq_driver = &scsidriver;
hs->sc_sq.dq_forw = hs->sc_sq.dq_back = &hs->sc_sq;
- scsi_isr[hc->hp_unit].isr_intr = scsiintr;
- scsi_isr[hc->hp_unit].isr_ipl = hc->hp_ipl;
- scsi_isr[hc->hp_unit].isr_arg = hc->hp_unit;
- isrlink(&scsi_isr[hc->hp_unit]);
+
+ /* Establish the interrupt handler. */
+ isrlink(scsiintr, hs, hc->hp_ipl, ISRPRI_BIO);
+
+ /* Reset the controller. */
scsireset(hc->hp_unit);
/*
}
int
-scsiintr(unit)
- register int unit;
+scsiintr(arg)
+ void *arg;
{
- register struct scsi_softc *hs = &scsi_softc[unit];
+ register struct scsi_softc *hs = arg;
volatile register struct scsidevice *hd =
(struct scsidevice *)hs->sc_hc->hp_addr;
register u_char ints;
register struct devqueue *dq;
+ int unit = hs->sc_hc->hp_unit;
if ((hd->scsi_csr & (CSR_IE|CSR_IR)) != (CSR_IE|CSR_IR))
return (0);
finishxfer(hs, hd, dq->dq_slave);
hs->sc_flags &=~ (SCSI_IO|SCSI_HAVEDMA);
dmafree(&hs->sc_dq);
- (dq->dq_driver->d_intr)(dq->dq_unit, hs->sc_stat[0]);
+ (dq->dq_driver->d_intr)(dq->dq_softc, hs->sc_stat[0]);
} else {
/* Something unexpected happened -- deal with it. */
hd->scsi_ints = ints;
hs->sc_flags &=~ (SCSI_IO|SCSI_HAVEDMA);
dmafree(&hs->sc_dq);
dq = hs->sc_sq.dq_forw;
- (dq->dq_driver->d_intr)(dq->dq_unit, -1);
+ (dq->dq_driver->d_intr)(dq->dq_softc, -1);
}
}
return(1);
-/* $NetBSD: sd.c,v 1.21 1996/01/07 22:02:18 thorpej Exp $ */
+/* $NetBSD: sd.c,v 1.22 1996/02/14 02:45:05 thorpej Exp $ */
/*
* Copyright (c) 1990, 1993
(void)sdident(sc, hd, 1); /* XXX Ick. */
+ sc->sc_dq.dq_softc = sc;
sc->sc_dq.dq_ctlr = hd->hp_ctlr;
sc->sc_dq.dq_unit = hd->hp_unit;
sc->sc_dq.dq_slave = hd->hp_slave;
}
void
-sdintr(unit, stat)
- register int unit;
+sdintr(arg, stat)
+ void *arg;
int stat;
{
- register struct sd_softc *sc = &sd_softc[unit];
+ register struct sd_softc *sc = arg;
+ int unit = sc->sc_hd->hp_unit;
register struct buf *bp = sdtab[unit].b_actf;
register struct hp_device *hp = sc->sc_hd;
int cond;
-/* $NetBSD: st.c,v 1.13 1995/12/02 18:22:18 thorpej Exp $ */
+/* $NetBSD: st.c,v 1.14 1996/02/14 02:45:12 thorpej Exp $ */
/*
* Copyright (c) 1990 University of Utah.
(void)stident(sc, hd, 1); /* XXX Ick. */
+ sc->sc_dq.dq_softc = sc;
sc->sc_dq.dq_ctlr = hd->hp_ctlr;
sc->sc_dq.dq_unit = hd->hp_unit;
sc->sc_dq.dq_slave = hd->hp_slave;
return(0);
}
-stintr(unit, stat)
- int unit, stat;
+stintr(arg, stat)
+ void *arg;
+ int stat;
{
- register struct st_softc *sc = &st_softc[unit];
+ register struct st_softc *sc = arg;
+ int unit = sc->sc_hd->hp_unit;
register struct st_xsense *xp = &st_xsense[unit];
register struct buf *bp = sttab[unit].b_actf;
struct hp_device *hp = sc->sc_hd;
-/* $NetBSD: Locore.c,v 1.11 1995/09/10 19:42:17 thorpej Exp $ */
+/* $NetBSD: Locore.c,v 1.12 1996/02/02 18:05:55 mycroft Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
* @(#)Locore.c 7.4 (Berkeley) 5/7/91
*/
-#include "../include/pte.h"
-#include "../includecpu.h"
-
-#include "sys/param.h"
-#include "sys/systm.h"
-#include "sys/user.h"
-#include "sys/vm.h"
-#include "sys/ioctl.h"
-#include "sys/tty.h"
-#include "sys/proc.h"
-#include "sys/buf.h"
-#include "sys/msgbuf.h"
-#include "sys/mbuf.h"
-#include "sys/protosw.h"
-#include "sys/domain.h"
-#include "sys/map.h"
-#include "sys/dkbad.h"
+#include <machine/pte.h>
+#include <machine/cpu.h>
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/user.h>
+#include <sys/vm.h>
+#include <sys/ioctl.h>
+#include <sys/tty.h>
+#include <sys/proc.h>
+#include <sys/buf.h>
+#include <sys/msgbuf.h>
+#include <sys/mbuf.h>
+#include <sys/protosw.h>
+#include <sys/domain.h>
+#include <sys/map.h>
+#include <sys/dkbad.h>
/*
* Pseudo file for lint to show what is used/defined in locore.s.
-/* $NetBSD: autoconf.c,v 1.14 1995/12/30 18:25:25 thorpej Exp $ */
+/* $NetBSD: autoconf.c,v 1.18 1996/04/07 18:21:08 thorpej Exp $ */
/*
+ * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
#include <sys/dmap.h>
#include <sys/reboot.h>
+#include <dev/cons.h>
+
+#include <machine/autoconf.h>
#include <machine/vmparam.h>
#include <machine/cpu.h>
#include <machine/pte.h>
+
#include <hp300/hp300/isr.h>
+
#include <hp300/dev/device.h>
#include <hp300/dev/grfreg.h>
#include <hp300/dev/hilreg.h>
*/
int cold; /* if 1, still working on cold-start */
int cpuspeed = 0; /* relative cpu speed -- can be patched */
-struct isr isrqueue[NISR];
struct hp_hw sc_table[MAXCTLRS];
/* XXX must be allocated statically because of early console init */
register struct hp_hw *hw;
int found;
+ /*
+ * Find out what hardware is attached to the machine.
+ * XXX goes away with new config.
+ */
+ find_devs();
+
/*
* XXX: these should be consolidated into some kind of table
*/
char notmappedmsg[] = "WARNING: no space to map IO card, ignored\n";
+/*
+ * Scan all select codes, passing the corresponding VA to (*func)().
+ * (*func)() is a driver-specific routine that looks for the console
+ * hardware.
+ */
+void
+console_scan(func, arg)
+ int (*func) __P((int, caddr_t, void *));
+ void *arg;
+{
+ int size, scode, sctop;
+ caddr_t pa, va;
+
+ /*
+ * Scan all select codes. Check each location for some
+ * hardware. If there's something there, call (*func)().
+ */
+ sctop = (machineid == HP_320) ? 32 : 256;
+ for (scode = 0; scode < sctop; ++scode) {
+ /*
+ * Abort mission if console has been forced.
+ */
+ if (conforced)
+ return;
+
+ /*
+ * Skip over the select code hole and
+ * the internal HP-IB controller.
+ */
+ if (((scode >= 32) && (scode < 132)) ||
+ ((scode == 7) && internalhpib))
+ continue;
+
+ /* Map current PA. */
+ pa = sctopa(scode);
+ va = iomap(pa, NBPG);
+ if (va == 0)
+ continue;
+
+ /* Check to see if hardware exists. */
+ if (badaddr(va)) {
+ iounmap(va, NBPG);
+ continue;
+ }
+
+ /*
+ * Hardware present, call callback. Driver returns
+ * size of region to map if console probe successful
+ * and worthwhile.
+ */
+ size = (*func)(scode, va, arg);
+ iounmap(va, NBPG);
+ if (size) {
+ /* Free last mapping. */
+ if (convasize)
+ iounmap(conaddr, convasize);
+ convasize = 0;
+
+ /* Remap to correct size. */
+ va = iomap(pa, size);
+ if (va == 0)
+ continue;
+
+ /* Save this state for next time. */
+ conscode = scode;
+ conaddr = va;
+ convasize = size;
+ }
+ }
+}
+
+/*
+ * Special version of cninit(). Actually, crippled somewhat.
+ * This version lets the drivers assign cn_tab.
+ */
+void
+hp300_cninit()
+{
+ struct consdev *cp;
+ extern struct consdev constab[];
+
+ cn_tab = NULL;
+
+ /*
+ * Call all of the console probe functions.
+ */
+ for (cp = constab; cp->cn_probe; cp++)
+ (*cp->cn_probe)(cp);
+
+ /*
+ * No console, we can handle it.
+ */
+ if (cn_tab == NULL)
+ return;
+
+ /*
+ * Turn on the console.
+ */
+ (*cn_tab->cn_init)(cn_tab);
+}
+
/*
* Scan the IO space looking for devices.
*/
short sc;
u_char *id_reg;
register caddr_t addr;
- register struct hp_hw *hw;
+ register struct hp_hw *hw = sc_table;
int didmap, sctop;
- /*
- * Initialize IO resource map for iomap().
- */
- rminit(extiomap, (long)EIOMAPSIZE, (long)1, "extio", EIOMAPSIZE/16);
- hw = sc_table;
/*
* Probe all select codes + internal display addr
*/
hw->hw_pa = (caddr_t) 0x478000;
addr = internalhpib = (caddr_t) IIOV(hw->hw_pa);
didmap = 0;
+ } else if (sc == conscode) {
+ /*
+ * If this is the console, it's already been
+ * mapped, and the address is known.
+ */
+ hw->hw_pa = sctopa(sc);
+ addr = conaddr;
+ didmap = 0;
} else {
hw->hw_pa = sctopa(sc);
addr = iomap(hw->hw_pa, NBPG);
return(kva);
}
+void
iounmap(kva, size)
caddr_t kva;
int size;
rmfree(extiomap, btoc(size), ix);
}
-isrinit()
-{
- register int i;
-
- for (i = 0; i < NISR; i++)
- isrqueue[i].isr_forw = isrqueue[i].isr_back = &isrqueue[i];
-}
-
-void
-isrlink(isr)
- register struct isr *isr;
-{
- int i = ISRIPL(isr->isr_ipl);
-
- if (i < 0 || i >= NISR) {
- printf("bad IPL %d\n", i);
- panic("configure");
- }
- insque(isr, isrqueue[i].isr_back);
-}
-
/*
* Configure swap space and related parameters.
*/
dumpdev = swdevt[0].sw_dev;
#endif
}
+
+#ifndef NEWCONFIG /* XXX */
+void
+config_init()
+{
+ /* Stub, so kernel will link. */
+}
+#endif
-/* $OpenBSD: conf.c,v 1.3 1996/02/21 12:53:44 mickey Exp $ */
+/* $NetBSD: conf.c,v 1.31 1996/03/14 21:26:28 christos Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
cdev_decl(vnd);
cdev_decl(st);
cdev_decl(fd);
+dev_decl(filedesc,open);
#include "bpfilter.h"
cdev_decl(bpf);
#include "tun.h"
cdev_notdef(), /* 18 */
cdev_disk_init(NVND,vnd), /* 19: vnode disk driver */
cdev_tape_init(NST,st), /* 20: SCSI tape */
- cdev_fd_init(1,fd), /* 21: file descriptor pseudo-device */
+ cdev_fd_init(1,filedesc), /* 21: file descriptor pseudo-device */
cdev_bpftun_init(NBPFILTER,bpf),/* 22: Berkeley packet filter */
cdev_bpftun_init(NTUN,tun), /* 23: network tunnel */
cdev_lkm_init(NLKM,lkm), /* 24: loadable module driver */
*/
#include <dev/cons.h>
-#define itecnpollc nullcnpollc
-cons_decl(ite);
-#define dcacnpollc nullcnpollc
+#define dvboxcngetc itecngetc
+#define dvboxcnputc itecnputc
+#define dvboxcnpollc nullcnpollc
+cons_decl(dvbox);
+
+#define gboxcngetc itecngetc
+#define gboxcnputc itecnputc
+#define gboxcnpollc nullcnpollc
+cons_decl(gbox);
+
+#define hypercngetc itecngetc
+#define hypercnputc itecnputc
+#define hypercnpollc nullcnpollc
+cons_decl(hyper);
+
+#define rboxcngetc itecngetc
+#define rboxcnputc itecnputc
+#define rboxcnpollc nullcnpollc
+cons_decl(rbox);
+
+#define topcatcngetc itecngetc
+#define topcatcnputc itecnputc
+#define topcatcnpollc nullcnpollc
+cons_decl(topcat);
+
+#define dcacnpollc nullcnpollc
cons_decl(dca);
-#define dcmcnpollc nullcnpollc
+
+#define dcmcnpollc nullcnpollc
cons_decl(dcm);
struct consdev constab[] = {
#if NITE > 0
- cons_init(ite),
+#if NGRF > 0 /* XXX */
+ cons_init(dvbox),
+ cons_init(gbox),
+ cons_init(hyper),
+ cons_init(rbox),
+ cons_init(topcat),
+#endif
#endif
#if NDCA > 0
cons_init(dca),
-/* $NetBSD: disksubr.c,v 1.6 1995/08/08 06:23:08 thorpej Exp $ */
+/* $NetBSD: disksubr.c,v 1.8 1996/02/02 19:50:26 scottr Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993
* @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94
*/
-#include "param.h"
-#include "systm.h"
-#include "buf.h"
-#include "disklabel.h"
-#include "syslog.h"
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/disklabel.h>
+#include <sys/syslog.h>
#define b_cylinder b_resid
npp->p_cpg = opp->p_cpg;
}
}
- nlp->d_checksum = 0;
- nlp->d_checksum = dkcksum(nlp);
+ nlp->d_checksum = 0;
+ nlp->d_checksum = dkcksum(nlp);
*olp = *nlp;
return (0);
}
-/* encoding of disk minor numbers, should be elsewhere... */
-#define dkunit(dev) (minor(dev) >> 3)
-#define dkpart(dev) (minor(dev) & 07)
-#define dkminor(unit, part) (((unit) << 3) | (part))
-
/*
* Write disk label back to device after modification.
*/
int labelpart;
int error = 0;
- labelpart = dkpart(dev);
+ labelpart = DISKPART(dev);
if (lp->d_partitions[labelpart].p_offset != 0) {
if (lp->d_partitions[0].p_offset != 0)
return (EXDEV); /* not quite right */
labelpart = 0;
}
bp = geteblk((int)lp->d_secsize);
- bp->b_dev = makedev(major(dev), dkminor(dkunit(dev), labelpart));
+ bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), labelpart);
bp->b_blkno = LABELSECTOR;
bp->b_bcount = lp->d_secsize;
bp->b_flags = B_READ;
struct disklabel *lp;
int wlabel;
{
- struct partition *p = &lp->d_partitions[dkpart(bp->b_dev)];
+ struct partition *p = &lp->d_partitions[DISKPART(bp->b_dev)];
int labelsect = lp->d_partitions[0].p_offset;
int maxsz = p->p_size;
int sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
-/* $NetBSD: genassym.c,v 1.16 1995/12/11 17:09:09 thorpej Exp $ */
+/* $NetBSD: genassym.c,v 1.18 1996/02/02 23:53:20 mycroft Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
#define _VA_LIST_ _BSD_VA_LIST_
#define _PTRDIFF_T_ _BSD_PTRDIFF_T_
-#define _KERNEL
-
#include <sys/param.h>
#include <sys/buf.h>
#include <sys/map.h>
#include <sys/syscall.h>
#include <sys/user.h>
+#include <vm/vm.h>
+
#include <machine/cpu.h>
#include <machine/trap.h>
#include <machine/psl.h>
#include <machine/pte.h>
#include <hp300/hp300/clockreg.h>
-#include <vm/vm.h>
#ifdef USELEDS
#include <hp300/hp300/led.h>
#endif
#include <stdio.h>
#include <stddef.h>
#include <string.h>
-#include <unistd.h>
extern int errno;
-/* $NetBSD: hpux_machdep.c,v 1.1 1996/01/06 12:44:06 thorpej Exp $ */
+/* $NetBSD: hpux_machdep.c,v 1.2 1996/02/14 02:56:45 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996 Jason R. Thorpe. All rights reserved.
-/* $NetBSD: isr.h,v 1.4 1994/10/26 07:25:37 cgd Exp $ */
+/* $NetBSD: isr.h,v 1.6 1996/02/28 01:03:53 thorpej Exp $ */
-/*
- * Copyright (c) 1982, 1993
- * The Regents of the University of California. All rights reserved.
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * @(#)isr.h 8.1 (Berkeley) 6/10/93
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/queue.h>
+
+/*
+ * The location and size of the autovectored interrupt portion
+ * of the vector table.
*/
+#define ISRLOC 0x18
+#define NISR 8
struct isr {
- struct isr *isr_forw;
- struct isr *isr_back;
- int (*isr_intr)();
- int isr_arg;
- int isr_ipl;
+ LIST_ENTRY(isr) isr_link;
+ int (*isr_func) __P((void *));
+ void *isr_arg;
+ int isr_ipl;
+ int isr_priority;
};
-#define NISR 3
-#define ISRIPL(x) ((x) - 3)
+/*
+ * ISR priorities. These are not the same as interrupt levels.
+ */
+#define ISRPRI_BIO 0
+#define ISRPRI_NET 1
+#define ISRPRI_TTY 2
+#define ISRPRI_TTYNOBUF 3
+
+void isrinit __P((void));
+void isrlink __P((int (*)(void *), void *, int, int));
+void isrdispatch __P((int));
-/* $NetBSD: locore.s,v 1.47 1996/01/16 22:24:28 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.50 1996/02/14 02:56:56 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
/*
* Interrupt handlers.
- * All DIO device interrupts are auto-vectored. Most can be configured
- * to interrupt in the range IPL3 to IPL5. Here are our assignments:
- *
- * Level 0: Spurious: ignored.
- * Level 1: HIL
- * Level 2:
- * Level 3: Internal HP-IB, DCM
- * Level 4: "Fast" HP-IBs, SCSI
- * Level 5: DMA, Ethernet, Built-in RS232 (DCA)
- * Level 6: Clock
- * Level 7: Non-maskable: parity errors, RESET key
+ * All device interrupts are auto-vectored. The CPU provides
+ * the vector 0x18+level. Note we count spurious interrupts, but
+ * we don't do anything else with them.
*/
- .globl _hilint, _intrhand, _hardclock, _nmihand, _dmaintr
- .globl _dcafastservice
-_spurintr:
+#define INTERRUPT_SAVEREG moveml #0xC0C0,sp@-
+#define INTERRUPT_RESTOREREG moveml sp@+,#0x0303
+
+ /* Externs. */
+ .globl _hilint, _isrdispatch, _nmihand
+ .globl _hardclock, _statintr
+
+_spurintr: /* Level 0 */
addql #1,_intrcnt+0
addql #1,_cnt+V_INTR
jra rei
-_lev1intr:
- moveml #0xC0C0,sp@-
+_lev1intr: /* Level 1: HIL XXX this needs to go away */
+ INTERRUPT_SAVEREG
jbsr _hilint
- moveml sp@+,#0x0303
+ INTERRUPT_RESTOREREG
addql #1,_intrcnt+4
addql #1,_cnt+V_INTR
jra rei
-/*
- * Check for unbuffered serial port (DCA) interrupts first in an attempt
- * to minimize received character lossage. Then we check for DMA activity
- * to reduce overhead there.
- */
-_lev5intr:
- moveml #0xC0C0,sp@-
- tstl _dcafastservice | unbuffered port active?
- jeq Ltrydma | no, check DMA
- clrl sp@- | yes, check DCA port 0
- jbsr _dcaintr | first to avoid overflow
+_intrhand: /* Levels 2 through 5 */
+ INTERRUPT_SAVEREG
+ movw sp@(22),sp@- | push exception vector info
+ clrw sp@-
+ jbsr _isrdispatch | call dispatch routine
addql #4,sp
- tstl d0 | did it belong to DCA?
- jeq Ltrydma | no, go try DMA
- moveml sp@+,#0x0303
- addql #1,_intrcnt+20
- addql #1,_cnt+V_INTR
- jra rei
-Ltrydma:
- jbsr _dmaintr | check DMA channels
- tstl d0 | was it ours?
- jeq Lnotdma | no, go poll other devices
- moveml sp@+,#0x0303
- addql #1,_intrcnt+24
- addql #1,_cnt+V_INTR
- jra rei
-
-_lev2intr:
-_lev3intr:
-_lev4intr:
- moveml #0xC0C0,sp@-
-Lnotdma:
- lea _intrcnt,a0
- movw sp@(22),d0 | use vector offset
- andw #0xfff,d0 | sans frame type
- addql #1,a0@(-0x60,d0:w) | to increment apropos counter
- movw sr,sp@- | push current SR value
- clrw sp@- | padded to longword
- jbsr _intrhand | handle interrupt
- addql #4,sp | pop SR
- moveml sp@+,#0x0303
- addql #1,_cnt+V_INTR
- jra rei
+ INTERRUPT_RESTOREREG
+ jra rei | all done
-_lev6intr:
- moveml #0xC0C0,sp@- | save scratch registers
+_lev6intr: /* Level 6: clock */
+ INTERRUPT_SAVEREG
CLKADDR(a0)
movb a0@(CLKSR),d0 | read clock status
Lclkagain:
btst #2,d0 | timer3 interrupt?
jeq Lnotim3 | no, skip statclock
movpw a0@(CLKMSB3),d1 | clear timer3 interrupt
- addql #1,_intrcnt+32 | count clock interrupts
+ addql #1,_intrcnt+28 | count clock interrupts
lea sp@(16),a1 | a1 = &clockframe
movl d0,sp@- | save status
movl a1,sp@-
Lnotim3:
btst #0,d0 | timer1 interrupt?
jeq Lrecheck | no, skip hardclock
- addql #1,_intrcnt+28 | count hardclock interrupts
+ addql #1,_intrcnt+24 | count hardclock interrupts
lea sp@(16),a1 | a1 = &clockframe
movl a1,sp@-
#ifdef USELEDS
addql #1,_cnt+V_INTR | chalk up another interrupt
movb a0@(CLKSR),d0 | see if anything happened
jmi Lclkagain | while we were in hardclock/statintr
- moveml sp@+,#0x0303 | restore scratch registers
+ INTERRUPT_RESTOREREG
jra rei | all done
-_lev7intr:
- addql #1,_intrcnt+36
+_lev7intr: /* Level 7: Parity errors, reset key */
+ addql #1,_intrcnt+32
clrl sp@-
moveml #0xFFFF,sp@- | save registers
movl usp,a0 | and save
.asciz "lev3"
.asciz "lev4"
.asciz "lev5"
- .asciz "dma"
.asciz "clock"
.asciz "statclock"
.asciz "nmi"
_eintrnames:
.even
_intrcnt:
- .long 0,0,0,0,0,0,0,0,0,0
+ .long 0,0,0,0,0,0,0,0,0
_eintrcnt:
-/* $NetBSD: machdep.c,v 1.56 1996/01/16 22:24:33 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.62 1996/03/13 23:42:45 scottr Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#include <sys/shm.h>
#endif
+#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/reg.h>
#include <machine/psl.h>
#include <machine/pte.h>
+
#include <dev/cons.h>
-#include <hp300/hp300/isr.h>
-#include <net/netisr.h>
#define MAXMEM 64*1024*CLSIZE /* XXX - from cmap.h */
#include <vm/vm_kern.h>
+#include <vm/vm_param.h>
/* the following is used externally (sysctl_hw) */
char machine[] = "hp300"; /* cpu "architecture" */
extern struct emul emul_hpux;
#endif
+/*
+ * Select code of console. Set to -1 if console is on
+ * "internal" framebuffer.
+ */
+int conscode;
+int consinit_active; /* flag for driver init routines */
+caddr_t conaddr; /* for drivers in cn_init() */
+int convasize; /* size of mapped console device */
+int conforced; /* console has been forced */
+
/*
* Console initialization: called early on from main,
* before vm init or startup. Do enough configuration
*/
consinit()
{
+ extern struct map extiomap[];
/*
- * Set cpuspeed immediately since cninit() called routines
+ * Initialize some variables for sanity.
+ */
+ consinit_active = 1;
+ convasize = 0;
+ conforced = 0;
+ conscode = 1024; /* invalid */
+
+ /*
+ * Set cpuspeed immediately since hp300_cninit() called routines
* might use delay. Note that we only set it if a custom value
* has not already been specified.
*/
if (mmutype == MMU_68040)
cpuspeed *= 2; /* XXX */
}
+
/*
- * Find what hardware is attached to this machine.
- */
- find_devs();
+ * Initialize the DIO resource map.
+ */
+ rminit(extiomap, (long)EIOMAPSIZE, (long)1, "extio", EIOMAPSIZE/16);
/*
* Initialize the console before we print anything out.
*/
- cninit();
+ hp300_cninit();
+
+ consinit_active = 0;
#ifdef DDB
ddb_init();
/* Run any shutdown hooks. */
doshutdownhooks();
-#ifdef PANICWAIT
- if ((howto & RB_HALT) == 0) {
- printf("hit any hey to reboot...\n");
+#if defined(PANICWAIT) && !defined(DDB)
+ if ((howto & RB_HALT) == 0 && panicstr) {
+ printf("hit any key to reboot...\n");
(void)cngetc();
printf("\n");
}
return(0);
}
-netintr()
-{
-#ifdef INET
- if (netisr & (1 << NETISR_ARP)) {
- netisr &= ~(1 << NETISR_ARP);
- arpintr();
- }
- if (netisr & (1 << NETISR_IP)) {
- netisr &= ~(1 << NETISR_IP);
- ipintr();
- }
-#endif
-#ifdef NS
- if (netisr & (1 << NETISR_NS)) {
- netisr &= ~(1 << NETISR_NS);
- nsintr();
- }
-#endif
-#ifdef ISO
- if (netisr & (1 << NETISR_ISO)) {
- netisr &= ~(1 << NETISR_ISO);
- clnlintr();
- }
-#endif
-#ifdef CCITT
- if (netisr & (1 << NETISR_CCITT)) {
- netisr &= ~(1 << NETISR_CCITT);
- ccittintr();
- }
-#endif
-#include "ppp.h"
-#if NPPP > 0
- if (netisr & (1 << NETISR_PPP)) {
- netisr &= ~(1 << NETISR_PPP);
- pppintr();
- }
-#endif
-}
-
-intrhand(sr)
- int sr;
-{
- register struct isr *isr;
- register int found = 0;
- register int ipl;
- extern struct isr isrqueue[];
- static int straycount;
-
- ipl = (sr >> 8) & 7;
- switch (ipl) {
-
- case 3:
- case 4:
- case 5:
- ipl = ISRIPL(ipl);
- isr = isrqueue[ipl].isr_forw;
- for (; isr != &isrqueue[ipl]; isr = isr->isr_forw) {
- if ((isr->isr_intr)(isr->isr_arg)) {
- found++;
- break;
- }
- }
- if (found)
- straycount = 0;
- else if (++straycount > 50)
- panic("intrhand: stray interrupt");
- else
- printf("stray interrupt, sr 0x%x\n", sr);
- break;
-
- case 0:
- case 1:
- case 2:
- case 6:
- case 7:
- if (++straycount > 50)
- panic("intrhand: unexpected sr");
- else
- printf("intrhand: unexpected sr 0x%x\n", sr);
- break;
- }
-}
-
#if (defined(DDB) || defined(DEBUG)) && !defined(PANICBUTTON)
#define PANICBUTTON
#endif
-| $NetBSD: vectors.s,v 1.6 1994/10/26 07:26:03 cgd Exp $
+| $NetBSD: vectors.s,v 1.7 1996/02/14 02:57:07 thorpej Exp $
| Copyright (c) 1988 University of Utah
| Copyright (c) 1990, 1993
.globl _buserr,_addrerr
.globl _illinst,_zerodiv,_chkinst,_trapvinst,_privinst,_trace
.globl _badtrap
- .globl _spurintr,_lev1intr,_lev2intr,_lev3intr
- .globl _lev4intr,_lev5intr,_lev6intr,_lev7intr
+ .globl _spurintr,_lev1intr,_lev6intr,_lev7intr
+ .globl _intrhand
.globl _trap0,_trap1,_trap2,_trap15
.globl _fpfline, _fpunsupp
.globl _trap12
.long _badtrap /* 23: unassigned, reserved */
.long _spurintr /* 24: spurious interrupt */
.long _lev1intr /* 25: level 1 interrupt autovector */
- .long _lev2intr /* 26: level 2 interrupt autovector */
- .long _lev3intr /* 27: level 3 interrupt autovector */
- .long _lev4intr /* 28: level 4 interrupt autovector */
- .long _lev5intr /* 29: level 5 interrupt autovector */
+ .long _intrhand /* 26: level 2 interrupt autovector */
+ .long _intrhand /* 27: level 3 interrupt autovector */
+ .long _intrhand /* 28: level 4 interrupt autovector */
+ .long _intrhand /* 29: level 5 interrupt autovector */
.long _lev6intr /* 30: level 6 interrupt autovector */
.long _lev7intr /* 31: level 7 interrupt autovector */
.long _trap0 /* 32: syscalls */
-/* $NetBSD: vm_machdep.c,v 1.26 1995/12/09 04:37:38 mycroft Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.28 1996/02/09 16:58:40 scottr Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* is a total crock, the multiple mappings of these physical pages should
* be reflected in the higher-level VM structures to avoid problems.
*/
-vmapbuf(bp)
+/*ARGSUSED*/
+void
+vmapbuf(bp, sz)
register struct buf *bp;
+ vm_size_t sz;
{
register int npf;
register caddr_t addr;
/*
* Free the io map PTEs associated with this IO operation.
*/
-vunmapbuf(bp)
+/*ARGSUSED*/
+void
+vunmapbuf(bp, sz)
register struct buf *bp;
+ vm_size_t sz;
{
register caddr_t addr;
register int npf;
-/* $NetBSD: hpux_machdep.h,v 1.1 1996/01/06 12:44:08 thorpej Exp $ */
+/* $NetBSD: hpux_machdep.h,v 1.3 1996/02/28 01:05:57 thorpej Exp $ */
-/*
- * Copyright (c) 1995, 1996 Jason R. Thorpe.
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Jason R. Thorpe.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _MACHINE_HPUX_MACHDEP_H_
-/* $NetBSD: param.h,v 1.23 1995/08/13 00:22:40 mycroft Exp $ */
+/* $NetBSD: param.h,v 1.25 1996/03/04 05:04:23 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
/*
* Machine dependent constants for HP9000 series 300.
*/
+#define _MACHINE hp300
#define MACHINE "hp300"
+#define _MACHINE_ARCH m68k
#define MACHINE_ARCH "m68k"
#define MID_MACHINE MID_M68K4K
-/* $NetBSD: dca.c,v 1.8 1995/10/04 06:54:44 thorpej Exp $ */
+/* $NetBSD: dca.c,v 1.9 1996/02/26 21:51:25 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
struct dcadevice *dcacnaddr = 0;
+#define DCACONSCODE 9 /* XXX */
+
void
dcaprobe(cp)
struct consdev *cp;
{
register struct dcadevice *dca;
- dcacnaddr = (struct dcadevice *) sctoaddr(CONSCODE);
+ dcacnaddr = (struct dcadevice *) sctoaddr(DCACONSCODE);
if (badaddr((char *)dcacnaddr)) {
cp->cn_pri = CN_DEAD;
return;
}
#endif
- curcons_scode = CONSCODE;
+ curcons_scode = DCACONSCODE;
}
void
-/* $NetBSD: dcm.c,v 1.8 1995/10/04 06:54:45 thorpej Exp $ */
+/* $NetBSD: dcm.c,v 1.9 1996/02/27 22:11:44 scottr Exp $ */
/*
* Copyright (c) 1988 University of Utah.
struct dcmdevice *dcmcnaddr = NULL;
+#define DCMCONUNIT 0 /* XXX */
+
void
dcmprobe(cp)
struct consdev *cp;
struct consdev *cp;
{
register struct dcmdevice *dcm = dcmcnaddr;
- register int port = CONUNIT;
+ register int port = DCMCONUNIT;
dcm->dcm_ic = IC_ID;
while (dcm->dcm_thead[port].ptr != dcm->dcm_ttail[port].ptr)
register unsigned head;
int c, stat, port;
- port = CONUNIT;
+ port = DCMCONUNIT;
pp = dcm_preg(dcm, port);
head = pp->r_head & RX_MASK;
if (head == (pp->r_tail & RX_MASK))
unsigned tail;
int port, stat;
- port = CONUNIT;
+ port = DCMCONUNIT;
pp = dcm_preg(dcm, port);
tail = pp->t_tail & TX_MASK;
timo = 50000;
-/* $NetBSD: ite.c,v 1.10 1995/10/04 06:54:47 thorpej Exp $ */
+/* $NetBSD: ite.c,v 1.11 1996/03/03 04:23:33 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#include <sys/param.h>
#include <dev/cons.h>
#include <hp300/dev/device.h>
-#include <hp300/dev/itevar.h>
+#include <hp300/stand/itevar.h>
#include <hp300/dev/grfreg.h>
#include <hp300/stand/consdefs.h>
#include <hp300/stand/samachdep.h>
-extern int nodev();
-extern u_char ite_readbyte();
-extern int ite_writeglyph();
-
-extern int topcat_init(), topcat_putc();
-extern int topcat_clear(), topcat_cursor(), topcat_scroll();
-extern int gbox_init(), gbox_clear();
-extern int gbox_putc(), gbox_cursor(), gbox_scroll();
-extern int rbox_init(), rbox_clear();
-extern int rbox_putc(), rbox_cursor(), rbox_scroll();
-extern int dvbox_init(), dvbox_clear();
-extern int dvbox_putc(), dvbox_cursor(), dvbox_scroll();
-extern int hyper_init(), hyper_clear();
-extern int hyper_putc(), hyper_cursor(), hyper_scroll();
+void ite_deinit_noop __P((struct ite_data *));
struct itesw itesw[] = {
- GID_TOPCAT,
- topcat_init, nodev, topcat_clear, topcat_putc,
- topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph,
- GID_GATORBOX,
- gbox_init, nodev, gbox_clear, gbox_putc,
- gbox_cursor, gbox_scroll, ite_readbyte, ite_writeglyph,
- GID_RENAISSANCE,
- rbox_init, nodev, rbox_clear, rbox_putc,
- rbox_cursor, rbox_scroll, ite_readbyte, ite_writeglyph,
- GID_LRCATSEYE,
- topcat_init, nodev, topcat_clear, topcat_putc,
- topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph,
- GID_HRCCATSEYE,
- topcat_init, nodev, topcat_clear, topcat_putc,
- topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph,
- GID_HRMCATSEYE,
- topcat_init, nodev, topcat_clear, topcat_putc,
- topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph,
- GID_DAVINCI,
- dvbox_init, nodev, dvbox_clear, dvbox_putc,
- dvbox_cursor, dvbox_scroll, ite_readbyte, ite_writeglyph,
- GID_HYPERION,
- hyper_init, nodev, hyper_clear, hyper_putc,
- hyper_cursor, hyper_scroll, ite_readbyte, ite_writeglyph,
+ { GID_TOPCAT,
+ topcat_init, ite_deinit_noop, topcat_clear, topcat_putc,
+ topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph },
+
+ { GID_GATORBOX,
+ gbox_init, ite_deinit_noop, gbox_clear, gbox_putc,
+ gbox_cursor, gbox_scroll, ite_readbyte, ite_writeglyph },
+
+ { GID_RENAISSANCE,
+ rbox_init, ite_deinit_noop, rbox_clear, rbox_putc,
+ rbox_cursor, rbox_scroll, ite_readbyte, ite_writeglyph },
+
+ { GID_LRCATSEYE,
+ topcat_init, ite_deinit_noop, topcat_clear, topcat_putc,
+ topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph },
+
+ { GID_HRCCATSEYE,
+ topcat_init, ite_deinit_noop, topcat_clear, topcat_putc,
+ topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph },
+
+ { GID_HRMCATSEYE,
+ topcat_init, ite_deinit_noop, topcat_clear, topcat_putc,
+ topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph },
+
+ { GID_DAVINCI,
+ dvbox_init, ite_deinit_noop, dvbox_clear, dvbox_putc,
+ dvbox_cursor, dvbox_scroll, ite_readbyte, ite_writeglyph },
+
+ { GID_HYPERION,
+ hyper_init, ite_deinit_noop, hyper_clear, hyper_putc,
+ hyper_cursor, hyper_scroll, ite_readbyte, ite_writeglyph },
};
int nitesw = sizeof(itesw) / sizeof(itesw[0]);
/* these guys need to be in initialized data */
int itecons = -1;
-struct ite_softc ite_softc[NITE] = { 0 };
+struct ite_data ite_data[NITE] = { 0 };
int ite_scode[NITE] = { 0 };
/*
int dtype, fboff, i;
struct hp_hw *hw;
struct grfreg *gr;
- struct ite_softc *ip;
+ struct ite_data *ip;
i = 0;
for (hw = sc_table; hw < &sc_table[MAXCTLRS]; hw++) {
if (i >= NITE)
break;
ite_scode[i] = hw->hw_sc;
- ip = &ite_softc[i];
+ ip = &ite_data[i];
ip->isw = &itesw[dtype];
ip->regbase = (caddr_t) gr;
fboff = (gr->gr_fbomsb << 8) | gr->gr_fbolsb;
struct consdev *cp;
{
register int ite;
- register struct ite_softc *ip;
+ register struct ite_data *ip;
int unit, pri;
#ifdef CONSDEBUG
if (ite < whichconsole)
continue;
#endif
- ip = &ite_softc[ite];
+ ip = &ite_data[ite];
if ((ip->flags & (ITE_ALIVE|ITE_CONSOLE))
!= (ITE_ALIVE|ITE_CONSOLE))
continue;
struct consdev *cp;
{
int ite = cp->cn_dev;
- struct ite_softc *ip;
+ struct ite_data *ip;
if (itecons != -1)
return;
- ip = &ite_softc[ite];
+ ip = &ite_data[ite];
ip->curx = 0;
ip->cury = 0;
dev_t dev;
register int c;
{
- register struct ite_softc *ip = &ite_softc[itecons];
+ register struct ite_data *ip = &ite_data[itecons];
register struct itesw *sp = ip->isw;
c &= 0x7F;
}
itecheckwrap(ip, sp)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register struct itesw *sp;
{
if (++ip->curx == ip->cols) {
}
ite_clrtoeol(ip, sp, y, x)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register struct itesw *sp;
register int y, x;
{
#endif
}
#endif
+
+/* ARGSUSED */
+void
+ite_deinit_noop(ip)
+ struct ite_data *ip;
+{
+}
-/* $NetBSD: ite_dv.c,v 1.7 1994/10/26 07:27:31 cgd Exp $ */
+/* $NetBSD: ite_dv.c,v 1.8 1996/03/03 04:23:35 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#ifdef ITECONSOLE
#include <sys/param.h>
-#include <hp300/dev/itevar.h>
+#include <hp300/stand/itevar.h>
#include <hp300/dev/itereg.h>
#include <hp300/dev/grf_dvreg.h>
#define REGBASE ((struct dvboxfb *)(ip->regbase))
#define WINDOWMOVER dvbox_windowmove
+void dvbox_windowmove __P((struct ite_data *, int, int, int, int,
+ int, int, int));
+
+void
dvbox_init(ip)
- struct ite_softc *ip;
+ struct ite_data *ip;
{
int i;
db_waitbusy(ip->regbase);
}
+void
dvbox_putc(ip, c, dy, dx, mode)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register int dy, dx;
int c, mode;
{
ip->ftheight, ip->ftwidth, RR_COPY);
}
+void
dvbox_cursor(ip, flag)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register int flag;
{
if (flag == DRAW_CURSOR)
erase_cursor(ip)
}
+void
dvbox_clear(ip, sy, sx, h, w)
- struct ite_softc *ip;
+ struct ite_data *ip;
register int sy, sx, h, w;
{
dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
RR_CLEAR);
}
+void
dvbox_scroll(ip, sy, sx, count, dir)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register int sy, count;
int dir, sx;
{
ip->cols * ip->ftwidth, RR_COPY);
}
+void
dvbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
- struct ite_softc *ip;
+ struct ite_data *ip;
int sy, sx, dy, dx, h, w, func;
{
register struct dvboxfb *dp = REGBASE;
-/* $NetBSD: ite_gb.c,v 1.7 1994/10/26 07:27:33 cgd Exp $ */
+/* $NetBSD: ite_gb.c,v 1.8 1996/03/03 04:23:36 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#include <sys/param.h>
-#include <hp300/dev/itevar.h>
+#include <hp300/stand/itevar.h>
#include <hp300/dev/itereg.h>
#include <hp300/dev/grf_gbreg.h>
#define REGBASE ((struct gboxfb *)(ip->regbase))
#define WINDOWMOVER gbox_windowmove
+void gbox_windowmove __P((struct ite_data *, int, int, int, int,
+ int, int, int));
+
+void
gbox_init(ip)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
{
REGBASE->write_protect = 0x0;
REGBASE->interrupt = 0x4;
ip->ftwidth, RR_COPYINVERTED);
}
+void
gbox_putc(ip, c, dy, dx, mode)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register int dy, dx;
int c, mode;
{
ip->ftheight, ip->ftwidth, RR_COPY);
}
+void
gbox_cursor(ip, flag)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register int flag;
{
if (flag == DRAW_CURSOR)
erase_cursor(ip)
}
+void
gbox_clear(ip, sy, sx, h, w)
- struct ite_softc *ip;
+ struct ite_data *ip;
register int sy, sx, h, w;
{
gbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
(w) * ip->ftwidth, \
RR_COPY)
+void
gbox_scroll(ip, sy, sx, count, dir)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register int sy;
int dir, sx, count;
{
gbox_blockmove(ip, sy + i, sx, dy + i, 0, 1, ip->cols);
}
+void
gbox_windowmove(ip, sy, sx, dy, dx, h, w, mask)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
int sy, sx, dy, dx, mask;
register int h, w;
{
-/* $NetBSD: ite_hy.c,v 1.2 1994/10/26 07:27:34 cgd Exp $ */
+/* $NetBSD: ite_hy.c,v 1.3 1996/03/03 04:23:37 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#ifdef ITECONSOLE
#include <sys/param.h>
-#include <hp300/dev/itevar.h>
+#include <hp300/stand/itevar.h>
#include <hp300/dev/itereg.h>
#include <hp300/dev/grf_hyreg.h>
#define charX(ip,c) \
(((c) % (ip)->cpl) * ((((ip)->ftwidth + 7) / 8) * 8) + (ip)->fontx)
+void hyper_ite_fontinit __P((struct ite_data *));
+void hyper_windowmove __P((struct ite_data *, int, int, int, int,
+ int, int, int));
+
+void
hyper_init(ip)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
{
int width;
ip->ftwidth, RR_COPYINVERTED);
}
+void
hyper_ite_fontinit(ip)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
{
register u_char *fbmem, *dp;
int c, l, b;
}
}
+void
hyper_putc(ip, c, dy, dx, mode)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register int dy, dx;
int c, mode;
{
ip->ftheight, ip->ftwidth, RR_COPY);
}
+void
hyper_cursor(ip, flag)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
int flag;
{
switch (flag) {
}
}
+void
hyper_clear(ip, sy, sx, h, w)
- struct ite_softc *ip;
+ struct ite_data *ip;
register int sy, sx, h, w;
{
hyper_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
RR_CLEAR);
}
+void
hyper_scroll(ip, sy, sx, count, dir)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register int sy, count;
int dir, sx;
{
0xFFFFFFFE
};
+void
hyper_windowmove(ip, sy, sx, dy, dx, h, w, func)
- struct ite_softc *ip;
+ struct ite_data *ip;
int sy, sx, dy, dx, h, w, func;
{
unsigned int *psrcBase, *pdstBase;
-/* $NetBSD: ite_rb.c,v 1.7 1994/10/26 07:27:37 cgd Exp $ */
+/* $NetBSD: ite_rb.c,v 1.8 1996/03/03 04:23:38 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#ifdef ITECONSOLE
#include <sys/param.h>
-#include <hp300/dev/itevar.h>
+#include <hp300/stand/itevar.h>
#include <hp300/dev/itereg.h>
#include <hp300/dev/grf_rbreg.h>
#define REGBASE ((struct rboxfb *)(ip->regbase))
#define WINDOWMOVER rbox_windowmove
+void rbox_windowmove __P((struct ite_data *, int, int, int, int,
+ int, int, int));
+
+void
rbox_init(ip)
- struct ite_softc *ip;
+ struct ite_data *ip;
{
int i;
ip->ftwidth, RR_COPYINVERTED);
}
+void
rbox_putc(ip, c, dy, dx, mode)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register int dy, dx;
int c, mode;
{
ip->ftheight, ip->ftwidth, RR_COPY);
}
+void
rbox_cursor(ip, flag)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register int flag;
{
if (flag == DRAW_CURSOR)
erase_cursor(ip)
}
+void
rbox_clear(ip, sy, sx, h, w)
- struct ite_softc *ip;
+ struct ite_data *ip;
register int sy, sx, h, w;
{
rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
RR_CLEAR);
}
+void
rbox_scroll(ip, sy, sx, count, dir)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register int sy, count;
int dir, sx;
{
ip->cols * ip->ftwidth, RR_COPY);
}
+void
rbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
- struct ite_softc *ip;
+ struct ite_data *ip;
int sy, sx, dy, dx, h, w, func;
{
register struct rboxfb *rp = REGBASE;
-/* $NetBSD: ite_subr.c,v 1.7 1994/10/26 07:27:39 cgd Exp $ */
+/* $NetBSD: ite_subr.c,v 1.8 1996/03/03 04:23:40 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#ifdef ITECONSOLE
#include <sys/param.h>
-#include <hp300/dev/itevar.h>
+#include <hp300/stand/itevar.h>
#include <hp300/dev/itereg.h>
ite_fontinfo(ip)
- struct ite_softc *ip;
+ struct ite_data *ip;
{
u_long fontaddr = getword(ip, getword(ip, FONTROM) + FONTADDR);
}
ite_fontinit(ip)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
{
int bytewidth = (((ip->ftwidth - 1) / 8) + 1);
int glyphsize = bytewidth * ip->ftheight;
*/
u_char
ite_readbyte(ip, disp)
- struct ite_softc *ip;
+ struct ite_data *ip;
int disp;
{
return((u_char) *(((u_char *)ip->regbase) + disp));
}
+void
ite_writeglyph(ip, fbmem, glyphp)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register u_char *fbmem, *glyphp;
{
register int bn;
-/* $NetBSD: ite_tc.c,v 1.7 1994/10/26 07:27:41 cgd Exp $ */
+/* $NetBSD: ite_tc.c,v 1.8 1996/03/03 04:23:41 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#ifdef ITECONSOLE
#include <sys/param.h>
-#include <hp300/dev/itevar.h>
+#include <hp300/stand/itevar.h>
#include <hp300/dev/itereg.h>
#include <hp300/dev/grfreg.h>
#include <hp300/dev/grf_tcreg.h>
#define REGBASE ((struct tcboxfb *)(ip->regbase))
#define WINDOWMOVER topcat_windowmove
+void topcat_windowmove __P((struct ite_data *, int, int, int, int,
+ int, int, int));
+
+void
topcat_init(ip)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
{
/*
ip->ftwidth, RR_COPYINVERTED);
}
+void
topcat_putc(ip, c, dy, dx, mode)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register int dy, dx;
int c, mode;
{
ip->ftheight, ip->ftwidth, RR_COPY);
}
+void
topcat_cursor(ip, flag)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register int flag;
{
if (flag == DRAW_CURSOR)
erase_cursor(ip)
}
+void
topcat_clear(ip, sy, sx, h, w)
- struct ite_softc *ip;
+ struct ite_data *ip;
register int sy, sx, h, w;
{
topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
RR_CLEAR);
}
+void
topcat_scroll(ip, sy, sx, count, dir)
- register struct ite_softc *ip;
+ register struct ite_data *ip;
register int sy, count;
int dir, sx;
{
ip->cols * ip->ftwidth, RR_COPY);
}
+void
topcat_windowmove(ip, sy, sx, dy, dx, h, w, func)
- struct ite_softc *ip;
+ struct ite_data *ip;
int sy, sx, dy, dx, h, w, func;
{
register struct tcboxfb *rp = REGBASE;