summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/MAKEDEV.common5
-rw-r--r--etc/Makefile13
-rw-r--r--etc/etc.hp300/MAKEDEV.md52
-rw-r--r--etc/etc.hp300/fbtab2
-rw-r--r--etc/etc.hp300/ttys13
-rw-r--r--sbin/wsconsctl/Makefile16
-rw-r--r--sbin/wsconsctl/util.c9
-rw-r--r--share/man/man4/hil.48
-rw-r--r--share/man/man4/man4.hp300/Makefile6
-rw-r--r--share/man/man4/man4.hp300/dio.43
-rw-r--r--share/man/man4/man4.hp300/dvbox.421
-rw-r--r--share/man/man4/man4.hp300/gbox.421
-rw-r--r--share/man/man4/man4.hp300/grf.4183
-rw-r--r--share/man/man4/man4.hp300/hyper.419
-rw-r--r--share/man/man4/man4.hp300/intro.415
-rw-r--r--share/man/man4/man4.hp300/ite.4154
-rw-r--r--share/man/man4/man4.hp300/rbox.421
-rw-r--r--share/man/man4/man4.hp300/sgc.452
-rw-r--r--share/man/man4/man4.hp300/topcat.420
-rw-r--r--share/man/man4/sti.47
-rw-r--r--sys/arch/hp300/conf/DISKLESS65
-rw-r--r--sys/arch/hp300/conf/GENERIC73
-rw-r--r--sys/arch/hp300/conf/RAMDISK56
-rw-r--r--sys/arch/hp300/conf/files.hp300112
-rw-r--r--sys/arch/hp300/dev/dca.c37
-rw-r--r--sys/arch/hp300/dev/dcm.c27
-rw-r--r--sys/arch/hp300/dev/diofb.c471
-rw-r--r--sys/arch/hp300/dev/diofbreg.h (renamed from sys/arch/hp300/dev/grfreg.h)69
-rw-r--r--sys/arch/hp300/dev/diofbvar.h131
-rw-r--r--sys/arch/hp300/dev/dvbox.c518
-rw-r--r--sys/arch/hp300/dev/dvboxreg.h189
-rw-r--r--sys/arch/hp300/dev/gbox.c509
-rw-r--r--sys/arch/hp300/dev/gboxreg.h130
-rw-r--r--sys/arch/hp300/dev/grf.c799
-rw-r--r--sys/arch/hp300/dev/grf_dv.c743
-rw-r--r--sys/arch/hp300/dev/grf_dvreg.h190
-rw-r--r--sys/arch/hp300/dev/grf_gb.c693
-rw-r--r--sys/arch/hp300/dev/grf_gbreg.h123
-rw-r--r--sys/arch/hp300/dev/grf_hy.c843
-rw-r--r--sys/arch/hp300/dev/grf_rb.c690
-rw-r--r--sys/arch/hp300/dev/grf_rbreg.h142
-rw-r--r--sys/arch/hp300/dev/grf_subr.c128
-rw-r--r--sys/arch/hp300/dev/grf_tc.c830
-rw-r--r--sys/arch/hp300/dev/grf_tcreg.h142
-rw-r--r--sys/arch/hp300/dev/grfioctl.h121
-rw-r--r--sys/arch/hp300/dev/grfvar.h153
-rw-r--r--sys/arch/hp300/dev/hil.c1794
-rw-r--r--sys/arch/hp300/dev/hil_intio.c97
-rw-r--r--sys/arch/hp300/dev/hil_keymaps.c335
-rw-r--r--sys/arch/hp300/dev/hilioctl.h197
-rw-r--r--sys/arch/hp300/dev/hilreg.h176
-rw-r--r--sys/arch/hp300/dev/hilvar.h141
-rw-r--r--sys/arch/hp300/dev/hyper.c634
-rw-r--r--sys/arch/hp300/dev/hyperreg.h (renamed from sys/arch/hp300/dev/grf_hyreg.h)68
-rw-r--r--sys/arch/hp300/dev/ite.c1003
-rw-r--r--sys/arch/hp300/dev/ite_subr.c149
-rw-r--r--sys/arch/hp300/dev/itevar.h213
-rw-r--r--sys/arch/hp300/dev/kbdmap.h70
-rw-r--r--sys/arch/hp300/dev/maskbits.h89
-rw-r--r--sys/arch/hp300/dev/rbox.c480
-rw-r--r--sys/arch/hp300/dev/rboxreg.h145
-rw-r--r--sys/arch/hp300/dev/sgc.c144
-rw-r--r--sys/arch/hp300/dev/sgcreg.h41
-rw-r--r--sys/arch/hp300/dev/sgcvar.h44
-rw-r--r--sys/arch/hp300/dev/sti_sgc.c221
-rw-r--r--sys/arch/hp300/dev/topcat.c577
-rw-r--r--sys/arch/hp300/dev/topcatreg.h146
-rw-r--r--sys/arch/hp300/hp300/autoconf.c188
-rw-r--r--sys/arch/hp300/hp300/bus_space.c249
-rw-r--r--sys/arch/hp300/hp300/clock.c98
-rw-r--r--sys/arch/hp300/hp300/clockreg.h4
-rw-r--r--sys/arch/hp300/hp300/conf.c86
-rw-r--r--sys/arch/hp300/hp300/locore.s67
-rw-r--r--sys/arch/hp300/hp300/machdep.c19
-rw-r--r--sys/arch/hp300/hp300/vectors.s4
-rw-r--r--sys/arch/hp300/hp300/wscons_machdep.c83
-rw-r--r--sys/arch/hp300/include/autoconf.h4
-rw-r--r--sys/arch/hp300/include/bus.h436
-rw-r--r--sys/arch/hp300/include/cpu.h4
-rw-r--r--sys/arch/hp300/include/hil_machdep.h (renamed from sys/arch/hp300/dev/itereg.h)35
-rw-r--r--sys/arch/hp300/include/intr.h13
-rw-r--r--sys/conf/files4
-rw-r--r--sys/dev/wscons/wsconsio.h9
-rw-r--r--usr.sbin/Makefile4
-rw-r--r--usr.sbin/grfinfo/Makefile15
-rw-r--r--usr.sbin/grfinfo/grfinfo.173
-rw-r--r--usr.sbin/grfinfo/grfinfo.c162
-rw-r--r--usr.sbin/hilinfo/Makefile15
-rw-r--r--usr.sbin/hilinfo/hilinfo.867
-rw-r--r--usr.sbin/hilinfo/hilinfo.c153
-rw-r--r--usr.sbin/wsconscfg/Makefile16
91 files changed, 6053 insertions, 11143 deletions
diff --git a/etc/MAKEDEV.common b/etc/MAKEDEV.common
index cc3338b8542..78dfc00a0b4 100644
--- a/etc/MAKEDEV.common
+++ b/etc/MAKEDEV.common
@@ -1,4 +1,4 @@
-vers(a, {-$OpenBSD: MAKEDEV.common,v 1.13 2005/01/10 07:53:57 dlg Exp $-})dnl
+vers(a, {-$OpenBSD: MAKEDEV.common,v 1.14 2005/01/14 22:39:11 miod Exp $-})dnl
divert(1)dnl
dnl
dnl Common device definitions.
@@ -470,8 +470,6 @@ _mkdev(fdesc, fd, {-RMlist="mkdir -p fd;$RMlist" n=0
while [ $n -lt 64 ];do M fd/$n c major_fdesc_c $n;n=Add($n, 1);done
MKlist="$MKlist;chmod 555 fd"-})dnl
__devitem(grf_mac, grf*, Raw interface to the mac68k graphics devices,grf)dnl
-__devitem(ite, ite*, Terminal emulator interface to HP300 graphics devices)dnl
-__devitem({-hil-}, {-hil-}, HP-HIL input devices)dnl
__devitem(oppr, openprom,PROM settings,openprom)dnl
_cdev(oppr, openprom, 70, 0)dnl
__devitem(cry, crypto, Hardware crypto access driver,crypto)dnl
@@ -534,7 +532,6 @@ __devitem(bpp, bpp*, Parallel port)dnl
_mkdev(bpp, {-bpp*-}, {-M bpp$U c major_bpp_c $U 600-}, 600)dnl
__devitem(xfs, xfs*, XFS filesystem node, mount_xfs 8)dnl
_mcdev(xfs, xfs*, xfs, {-major_xfs_c-}, 600)dnl
-__devitem(hil, hil, HP-HIL input devices)dnl
__devitem(rmidi, rmidi*, Raw MIDI devices,midi)dnl
_mcdev(rmidi, rmidi*, rmidi, {-major_rmidi_c-}, 666)dnl
__devtitle(plat, Platform-specific devices)dnl
diff --git a/etc/Makefile b/etc/Makefile
index 340ff6ec623..749293f48e9 100644
--- a/etc/Makefile
+++ b/etc/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.213 2005/01/13 19:27:13 drahn Exp $
+# $OpenBSD: Makefile,v 1.214 2005/01/14 22:39:12 miod Exp $
TZDIR= /usr/share/zoneinfo
LOCALTIME= Canada/Mountain
@@ -21,10 +21,11 @@ BIN1= changelist ccd.conf csh.cshrc csh.login csh.logout daily dhcpd.conf \
etc.${MACHINE}/disktab dhclient.conf mailer.conf ntpd.conf
.if ${MACHINE} == "alpha" || ${MACHINE} == "amd64" || \
- ${MACHINE} == "cats" || ${MACHINE} == "hppa" || \
- ${MACHINE} == "i386" || ${MACHINE} == "luna88k" || \
- ${MACHINE} == "macppc" || ${MACHINE} == "sparc" || \
- ${MACHINE} == "sparc64" || ${MACHINE} == "zaurus"
+ ${MACHINE} == "cats" || ${MACHINE} == "hp300" || \
+ ${MACHINE} == "hppa" || ${MACHINE} == "i386" || \
+ ${MACHINE} == "luna88k" || ${MACHINE} == "macppc" || \
+ ${MACHINE} == "sparc" || ${MACHINE} == "sparc64" || \
+ ${MACHINE} == "zaurus"
BIN1+= wsconsctl.conf
.endif
@@ -374,7 +375,7 @@ distrib:
DHSIZE=1024 1536 2048 3072 4096
update-moduli:
( \
- echo '# $$OpenBSD: Makefile,v 1.213 2005/01/13 19:27:13 drahn Exp $$'; \
+ echo '# $$OpenBSD: Makefile,v 1.214 2005/01/14 22:39:12 miod Exp $$'; \
echo '# Time Type Tests Tries Size Generator Modulus'; \
( for i in ${DHSIZE}; do \
ssh-keygen -b $$i -G /dev/stdout; \
diff --git a/etc/etc.hp300/MAKEDEV.md b/etc/etc.hp300/MAKEDEV.md
index cab4c45e608..1a16a0a61a5 100644
--- a/etc/etc.hp300/MAKEDEV.md
+++ b/etc/etc.hp300/MAKEDEV.md
@@ -1,5 +1,5 @@
vers(__file__,
- {-$OpenBSD: MAKEDEV.md,v 1.22 2004/08/03 21:46:46 miod Exp $-},
+ {-$OpenBSD: MAKEDEV.md,v 1.23 2005/01/14 22:39:15 miod Exp $-},
etc.MACHINE)dnl
dnl
dnl Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org>
@@ -41,7 +41,6 @@ _mkdev(ct, ct*|mt*,
echo bad unit for tape in: $1
;;
esac-})dnl
-__devitem(grf, grf*, Raw interface to HP300 graphics devices)dnl
dnl
dnl
_TITLE(make)
@@ -71,14 +70,17 @@ _DEV(ptm, 52)
_DEV(pty, 5)
_DEV(tty, 4)
_TITLE(cons)
-_DEV(grf, 10)
-_DEV(ite)
+_DEV(wscons)
+_DEV(wsdisp, 40)
+_DEV(wskbd, 41)
+_DEV(wsmux, 43)
+_TITLE(point)
+_DEV(wsmouse, 42)
_TITLE(prn)
_DEV(ppi, 11)
_TITLE(spec)
_DEV(bpf, 22)
_DEV(fdesc, 21)
-_DEV(hil, 14)
_DEV(lkm, 24)
_DEV(pf, 33)
_DEV(rnd, 32)
@@ -93,7 +95,7 @@ dnl
ramdisk)
_recurse std ct0 ct1 st0 st1 hd0 hd1 hd2 hd3 hd4
_recurse sd0 sd1 sd2 sd3 sd4 cd0 cd1 rd0 pty0
- _recurse hil grf0 apci0 ite0 dca0 dcm0 dcm1
+ _recurse apci0 dca0 dcm0 dcm1
_recurse bpf0 bpf1 tun0 tun1 lkm random
;;
@@ -160,37 +162,6 @@ ppi*)
esac
;;
-ite*)
- case $U in
- 0|1|2|3)
- M ttye$U c 13 $U 600
- ;;
- *)
- echo bad unit for ite in: $i
- ;;
- esac
- ;;
-
-grf*)
- case $U in
- 0|1|2|3)
- M grf$U c major_grf_c $U 600
- ;;
- *)
- echo bad unit for grf in: $i
- ;;
- esac
- ;;
-
-hil)
- for U in 0 1 2 3 4 5 6 7
- do
- M hil$U c 14 $U 600
- done
- MKlist="$MKlist;ln hil1 keyboard"
- MKlist="$MKlist;ln hil3 locator"
- RMlist="$RMlist keyboard locator"
- ;;
dnl
target(all, ses, 0)dnl
target(all, ch, 0)dnl
@@ -209,14 +180,10 @@ target(all, st, 0, 1)dnl
target(all, uk, 0)dnl
target(all, vnd, 0, 1, 2, 3)dnl
target(all, ccd, 0, 1, 2, 3)dnl
-target( all, grf, 0)dnl
-dnl XXX target( all, hil, 0, 1, 2, 3, 4, 5, 6, 7)dnl
-target( all, hil, )dnl
target( all, dca, 0, 1)dnl
target( all, dcm, 0, 1, 2, 3)dnl
target( all, hd, 0, 1, 2)dnl
target( all, ct, 0, 1)dnl
-target( all, ite, 0)dnl
target( all, ttye, 0, 1, 2, 3, 4, 5, 6)dnl
target(ramd, cd, 0, 1)dnl
target(ramd, ct, 0, 1)dnl
@@ -225,10 +192,7 @@ target(ramd, sd, 0, 1, 2)dnl
target(ramd, st, 0, 1)dnl
target(ramd, rd, 0, 1)dnl
target(ramd, pty, 0)dnl
-target(ramd, hil, )dnl
-target(ramd, grf, 0)dnl
target(ramd, apci, 0)dnl
-target(ramd, ite, 0)dnl
target(ramd, dca, 0)dnl
target(ramd, dcm, 0, 1)dnl
target(ramd, bpf, 0, 1)dnl
diff --git a/etc/etc.hp300/fbtab b/etc/etc.hp300/fbtab
index 32fb4f357f4..d0c58313610 100644
--- a/etc/etc.hp300/fbtab
+++ b/etc/etc.hp300/fbtab
@@ -1 +1 @@
-/dev/console 0600 /dev/grf0:/dev/hil0:/dev/hil1:/dev/hil2:/dev/hil3:/dev/hil4:/dev/hil5:/dev/hil6:/dev/hil7
+/dev/console 0600 /dev/ttyC0:/dev/wskbd:/dev/wskbd0:/dev/wsmouse:/dev/wsmouse0:/dev/ttyCcfg
diff --git a/etc/etc.hp300/ttys b/etc/etc.hp300/ttys
index 71c3d707c90..356f59b9349 100644
--- a/etc/etc.hp300/ttys
+++ b/etc/etc.hp300/ttys
@@ -1,14 +1,13 @@
#
-# $OpenBSD: ttys,v 1.6 2002/06/09 06:15:14 todd Exp $
+# $OpenBSD: ttys,v 1.7 2005/01/14 22:39:15 miod Exp $
#
# name getty type status comments
#
-# If the console is marked insecure, single-user requires
-# the root password.
-console "/usr/libexec/getty Pc" hp300h on secure
-
-# Hardwired lines are marked off, by default, so getty(8)
-# is quiet when they don't exist.
+# main console device
+console "/usr/libexec/getty std.9600" vt220 on secure
+# graphics console
+ttyC0 "/usr/libexec/getty std.9600" vt220 off secure
+# serial lines
tty00 "/usr/libexec/getty std.9600" unknown off secure
tty01 "/usr/libexec/getty std.9600" unknown off secure
tty02 "/usr/libexec/getty std.9600" unknown off secure
diff --git a/sbin/wsconsctl/Makefile b/sbin/wsconsctl/Makefile
index 9ef0c977ad4..b7ad8330a8e 100644
--- a/sbin/wsconsctl/Makefile
+++ b/sbin/wsconsctl/Makefile
@@ -1,11 +1,11 @@
-# $OpenBSD: Makefile,v 1.21 2005/01/13 19:17:25 drahn Exp $
+# $OpenBSD: Makefile,v 1.22 2005/01/14 22:39:17 miod Exp $
.if ${MACHINE} == "alpha" || ${MACHINE} == "amd64" || \
- ${MACHINE} == "cats" || ${MACHINE} == "hppa" || \
- ${MACHINE} == "i386" || ${MACHINE} == "luna88k" || \
- ${MACHINE} == "macppc" || ${MACHINE} == "sparc" || \
- ${MACHINE} == "sgi" || ${MACHINE} == "sparc64" || \
- ${MACHINE} == "zaurus"
+ ${MACHINE} == "cats" || ${MACHINE} == "hp300" || \
+ ${MACHINE} == "hppa" || ${MACHINE} == "i386" || \
+ ${MACHINE} == "luna88k" || ${MACHINE} == "macppc" || \
+ ${MACHINE} == "sgi" || ${MACHINE} == "sparc" || \
+ ${MACHINE} == "sparc64" || ${MACHINE} == "zaurus"
PROG= wsconsctl
SRCS= display.c keyboard.c keysym.c map_parse.y map_scan.l \
@@ -26,7 +26,7 @@ NOPROG=yes
.endif
MAN= wsconsctl.8
-MANSUBDIR= alpha amd64 cats hppa i386 luna88k macppc sgi sparc sparc64
-MANSUBDIR+= zaurus
+MANSUBDIR= alpha amd64 cats hp300 hppa i386 luna88k macppc sgi
+MANSUBDIR+= sparc sparc64 zaurus
.include <bsd.prog.mk>
diff --git a/sbin/wsconsctl/util.c b/sbin/wsconsctl/util.c
index 1501c88d6ee..0f531e0a72c 100644
--- a/sbin/wsconsctl/util.c
+++ b/sbin/wsconsctl/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.26 2005/01/14 15:49:03 drahn Exp $ */
+/* $OpenBSD: util.c,v 1.27 2005/01/14 22:39:17 miod Exp $ */
/* $NetBSD: util.c,v 1.8 2000/03/14 08:11:53 sato Exp $ */
/*-
@@ -131,7 +131,12 @@ static const struct nameint dpytype_tab[] = {
{ WSDISPLAY_TYPE_MGX, "mgx" },
{ WSDISPLAY_TYPE_SB_P9000, "p9000" },
{ WSDISPLAY_TYPE_RFLEX, "rasterflex" },
- { WSDISPLAY_TYPE_LUNA, "luna" }
+ { WSDISPLAY_TYPE_LUNA, "luna" },
+ { WSDISPLAY_TYPE_DVBOX, "davinci" },
+ { WSDISPLAY_TYPE_GBOX, "gatorbox" },
+ { WSDISPLAY_TYPE_RBOX, "renaissance" },
+ { WSDISPLAY_TYPE_HYPERION, "hyperion" },
+ { WSDISPLAY_TYPE_TOPCAT, "topcat" }
};
static const struct nameint kbdenc_tab[] = {
diff --git a/share/man/man4/hil.4 b/share/man/man4/hil.4
index bf20e8adaf6..a19a0017470 100644
--- a/share/man/man4/hil.4
+++ b/share/man/man4/hil.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: hil.4,v 1.6 2004/09/30 19:59:24 mickey Exp $
+.\" $OpenBSD: hil.4,v 1.7 2005/01/14 22:39:19 miod Exp $
.\"
.\" Copyright (c) 2003 Miodrag Vallat.
.\" All rights reserved.
@@ -24,14 +24,16 @@
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\"
-.Dd February 11, 2003
+.Dd January 12, 2005
.Dt HIL 4
.Os
.Sh NAME
.Nm hil
.Nd HP-HIL driver
.Sh SYNOPSIS
-.Cd "hil* at gsc? irq 1"
+.Cd "hil* at intio? " Pq hp300
+.Cd "hil* at gsc? irq 1 " Pq hppa
+.Pp
.Cd "hilkbd* at hil?"
.Cd "hilms* at hil?"
.Cd "hilid* at hil?"
diff --git a/share/man/man4/man4.hp300/Makefile b/share/man/man4/man4.hp300/Makefile
index 432dee8dfee..eaf3807f2f0 100644
--- a/share/man/man4/man4.hp300/Makefile
+++ b/share/man/man4/man4.hp300/Makefile
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile,v 1.10 2005/01/08 19:47:38 miod Exp $
+# $OpenBSD: Makefile,v 1.11 2005/01/14 22:39:21 miod Exp $
# from: @(#)Makefile 5.1 (Berkeley) 6/29/90
MAN= apci.4 autoconf.4 ct.4 dca.4 dcm.4 dio.4 dvbox.4 frodo.4 gbox.4 \
- grf.4 hd.4 hil.4 hyper.4 intro.4 ite.4 le.4 mem.4 nhpib.4 \
- ppi.4 rbox.4 spc.4 topcat.4
+ hd.4 hyper.4 intro.4 le.4 mem.4 nhpib.4 ppi.4 rbox.4 sgc.4 spc.4 \
+ topcat.4
MLINKS= mem.4 kmem.4
MLINKS+=nhpib.4 fhpib.4 nhpib.4 hpibbus.4
MANSUBDIR=hp300
diff --git a/share/man/man4/man4.hp300/dio.4 b/share/man/man4/man4.hp300/dio.4
index 045120005c4..435b9531759 100644
--- a/share/man/man4/man4.hp300/dio.4
+++ b/share/man/man4/man4.hp300/dio.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: dio.4,v 1.4 2004/08/03 21:46:49 miod Exp $
+.\" $OpenBSD: dio.4,v 1.5 2005/01/14 22:39:21 miod Exp $
.\" $NetBSD: dio.4,v 1.2 2002/01/15 01:31:30 wiz Exp $
.\"
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -118,5 +118,6 @@ HP 98658 SCSI host adaptor
.Xr intro 4 ,
.Xr le 4 ,
.Xr rbox 4 ,
+.Xr sgc 4 ,
.Xr spc 4 ,
.Xr topcat 4
diff --git a/share/man/man4/man4.hp300/dvbox.4 b/share/man/man4/man4.hp300/dvbox.4
index 0ae3ececea6..de6e4587261 100644
--- a/share/man/man4/man4.hp300/dvbox.4
+++ b/share/man/man4/man4.hp300/dvbox.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: dvbox.4,v 1.6 2005/01/08 19:47:38 miod Exp $
+.\" $OpenBSD: dvbox.4,v 1.7 2005/01/14 22:39:21 miod Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" from: @(#)dv.4 8.1 (Berkeley) 6/9/93
.\"
-.Dd March 16, 2003
+.Dd January 12, 2005
.Dt DVBOX 4 hp300
.Os
.Sh NAME
@@ -42,9 +42,9 @@
.Tn HP98730
DaVinci frame buffer
.Sh SYNOPSIS
-.Cd "dvbox* at intio?"
-.Cd "dvbox* at dio?"
-.Cd "grf* at dvbox?"
+.Cd "dvbox* at intio?"
+.Cd "dvbox* at dio?"
+.Cd "wsdisplay* at dvbox?"
.Sh DESCRIPTION
The
.Tn HP98730
@@ -59,9 +59,7 @@ frame buffer extensions, it is possible to add overlay planes.
The
.Nm
driver provides a frame buffer abstraction to the
-.Xr grf 4
-driver, and the associated
-.Xr ite 4
+.Xr wscons 4
console framework.
.Pp
The DaVinci can be configured at either the ``internal'' address
@@ -70,13 +68,14 @@ or at an external select code less than 32.
The hardware installation manual describes the procedure for
setting these values.
.Sh SEE ALSO
-.Xr ioctl 2 ,
.Xr gbox 4 ,
-.Xr grf 4 ,
.Xr hyper 4 ,
.Xr intro 4 ,
.Xr rbox 4 ,
-.Xr topcat 4
+.Xr sti 4 ,
+.Xr topcat 4 ,
+.Xr wscons 4 ,
+.Xr wsdisplay 4
.Sh BUGS
This driver has not been tested with all possible combinations of frame
buffer boards and scan boards installed in the device.
diff --git a/share/man/man4/man4.hp300/gbox.4 b/share/man/man4/man4.hp300/gbox.4
index b360fb484f8..2a557ad20da 100644
--- a/share/man/man4/man4.hp300/gbox.4
+++ b/share/man/man4/man4.hp300/gbox.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: gbox.4,v 1.6 2005/01/08 19:47:38 miod Exp $
+.\" $OpenBSD: gbox.4,v 1.7 2005/01/14 22:39:21 miod Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" from: @(#)gb.4 8.1 (Berkeley) 6/9/93
.\"
-.Dd March 16, 2003
+.Dd January 12, 2005
.Dt GBOX 4 hp300
.Os
.Sh NAME
@@ -42,9 +42,9 @@
.Tn HP98700
Gatorbox frame buffer
.Sh SYNOPSIS
-.Cd "gbox* at intio?"
-.Cd "gbox* at dio?"
-.Cd "grf* at gbox?"
+.Cd "gbox* at intio?"
+.Cd "gbox* at dio?"
+.Cd "wsdisplay* at gbox?"
.Sh DESCRIPTION
The
.Tn HP98700
@@ -60,9 +60,7 @@ The 98710 also has some acceleration features.
The
.Nm
driver provides a frame buffer abstraction to the
-.Xr grf 4
-driver, and the associated
-.Xr ite 4
+.Xr wscons 4
console framework.
.Pp
The 98700 can be used as the only graphics device on a system, in which case
@@ -86,10 +84,11 @@ The
.%T 98700H Installation Guide
contains further configuration information.
.Sh SEE ALSO
-.Xr ioctl 2 ,
.Xr dvbox 4 ,
-.Xr grf 4 ,
.Xr hyper 4 ,
.Xr intro 4 ,
.Xr rbox 4 ,
-.Xr topcat 4
+.Xr sti 4 ,
+.Xr topcat 4 ,
+.Xr wscons 4 ,
+.Xr wsdisplay 4
diff --git a/share/man/man4/man4.hp300/grf.4 b/share/man/man4/man4.hp300/grf.4
deleted file mode 100644
index f08641b4d3a..00000000000
--- a/share/man/man4/man4.hp300/grf.4
+++ /dev/null
@@ -1,183 +0,0 @@
-.\" $OpenBSD: grf.4,v 1.14 2005/01/08 19:47:38 miod Exp $
-.\"
-.\" Copyright (c) 1990, 1991, 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. 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: @(#)grf.4 8.1 (Berkeley) 6/9/93
-.\"
-.Dd June 9, 1993
-.Dt GRF 4 hp300
-.Os
-.Sh NAME
-.Nm grf
-.Nd
-.Tn HP
-graphics frame buffer device interface
-.Sh SYNOPSIS
-.Cd "grf* at dvbox?"
-.Cd "grf* at gbox?"
-.Cd "grf* at hyper?"
-.Cd "grf* at rbox?"
-.Cd "grf* at topcat?"
-.Cd ""
-.Cd "ite* at grf?"
-.Sh DESCRIPTION
-This is a generic description of the frame buffer device interface.
-.Pp
-The devices to which this applies are the 98544, 98545 and 98547
-Topcat graphics cards (also known as
-.Tn HP300H
-devices),
-the 98548, 98549 and 98550
-Catseye graphics cards,
-the A1416A
-Kathmandu graphics cards,
-the 98700
-Gatorbox graphics box,
-the 98720
-Renaissance graphics box,
-the 98730
-DaVinci graphics box,
-and the A1096A
-Hyperion graphics cards.
-.Pp
-The basic programming of the
-.Nm grf Ns ?\&
-devices involves opening the device
-file, mapping the control registers and frame buffer addresses into user
-space, and then manipulating the device as the application requires.
-The address mapping is controlled by an
-.Xr ioctl 2
-call to map the device into user space, and an unmap call when finished.
-.Pp
-The ioctls supported by
-.Ox
-are:
-.Bl -tag -width GRFIOCGINFO
-.It Dv GRFIOCGINFO
-Get Graphics Info
-.Pp
-Get info about device, setting the entries in the
-.Em grfinfo
-structure, as defined in
-.Aq Pa machine/grfioctl.h :
-.Bd -literal
-struct grfinfo {
- int gd_id; /* HP-UX identifier */
- caddr_t gd_regaddr; /* control registers physaddr */
- int gd_regsize; /* control registers size */
- caddr_t gd_fbaddr; /* frame buffer physaddr */
- int gd_fbsize; /* frame buffer size */
- short gd_colors; /* number of colors */
- short gd_planes; /* number of planes */
-/* new stuff */
- int gd_fbwidth; /* frame buffer width */
- int gd_fbheight; /* frame buffer height */
- int gd_dwidth; /* displayed part width */
- int gd_dheight; /* displayed part height */
- int gd_pad[6]; /* for future expansion */
-};
-.Ed
-.It Dv GRFIOCON
-Graphics On
-.Pp
-Turn graphics on by enabling
-.Tn CRT
-output.
-The screen will come on, displaying whatever is in the frame buffer, using
-whatever colormap is in place.
-.It Dv GRFIOCOFF
-Graphics Off
-.Pp
-Turn graphics off by disabling output to the
-.Tn CRT .
-The frame buffer contents
-are not affected.
-.It Dv GRFIOCMAP
-Map Device to user space
-.Pp
-Map in control registers and frame buffer space.
-Once the device file is mapped, the frame buffer memory and registers
-are accessible.
-.It Dv GRFIOCUNMAP
-Unmap Device
-.Pp
-Unmap control registers and frame buffer space.
-.El
-.Sh FILES
-.Bl -tag -width /dev/XXXX -compact
-.It Pa /dev/grf?
-.Ox
-interface special files
-.El
-.Sh EXAMPLES
-This short code fragment is an example of opening some graphics device and
-mapping in the control and frame buffer space:
-.Bd -literal
-#define GRF_DEV <some_graphics_device> /* /dev/grfN */
-
-struct fbstruct *regs; /* fbstruct = gboxfb, rboxfb, etc. */
-u_char *Addr, frame_buffer;
-struct grfinfo gi;
-int disp_fd;
-
-disp_fd = open(GRF_DEV, O_WRONLY);
-if (ioctl(disp_fd, GRFIOCGINFO, &gi) < 0) return -1;
-ioctl(disp_fd, GRFIOCON, 0);
-
-if (ioctl(disp_fd, GRFIOCMAP, &Addr) < 0) {
- ioctl(disp_fd, GRFIOCOFF, 0);
- return -1;
-}
-regs = (fbstruct *)Addr; /* Control Registers */
-frame_buffer = (u_char *)Addr + gi.gd_regsize; /* Frame buffer mem */
-.Ed
-.Sh DIAGNOSTICS
-None under
-.Ox .
-.Pp
-.Tn HP-UX
-The
-.Tn CE.utilities/Crtadjust
-programs, running in
-.Tn HP-UX
-compatibility mode,
-can be used for each specific device.
-.Sh SEE ALSO
-.Xr ioctl 2 ,
-.Xr dvbox 4 ,
-.Xr gbox 4 ,
-.Xr hil 4 ,
-.Xr hyper 4 ,
-.Xr intro 4 ,
-.Xr ite 4 ,
-.Xr rbox 4 ,
-.Xr topcat 4
diff --git a/share/man/man4/man4.hp300/hyper.4 b/share/man/man4/man4.hp300/hyper.4
index 9db78e6907a..a9a074777ca 100644
--- a/share/man/man4/man4.hp300/hyper.4
+++ b/share/man/man4/man4.hp300/hyper.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: hyper.4,v 1.6 2005/01/08 23:31:00 jmc Exp $
+.\" $OpenBSD: hyper.4,v 1.7 2005/01/14 22:39:21 miod Exp $
.\"
.\" Copyright (c) 2003, Miodrag Vallat.
.\" All rights reserved.
@@ -24,7 +24,7 @@
.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd March 16, 2003
+.Dd January 12, 2005
.Dt HYPER 4 hp300
.Os
.Sh NAME
@@ -33,17 +33,15 @@
.Tn HP A1096A
Hyperion frame buffer
.Sh SYNOPSIS
-.Cd "hyper* at dio?"
-.Cd "grf* at hyper?"
+.Cd "hyper* at dio?"
+.Cd "wsdisplay* at hyper?"
.Sh DESCRIPTION
The Hyperion is a monochrome, high-resolution frame buffer.
.Pp
The
.Nm
driver provides a frame buffer abstraction to the
-.Xr grf 4
-driver, and the associated
-.Xr ite 4
+.Xr wscons 4
console framework.
.Sh SELECT CODE
The
@@ -66,8 +64,9 @@ Leaving a jumper open is equivalent to shorting pins 1 and 2.
.Sh SEE ALSO
.Xr dvbox 4 ,
.Xr gbox 4 ,
-.Xr grf 4 ,
.Xr intro 4 ,
-.Xr ite 4 ,
.Xr rbox 4 ,
-.Xr topcat 4
+.Xr sti 4 ,
+.Xr topcat 4 ,
+.Xr wscons 4 ,
+.Xr wsdisplay 4
diff --git a/share/man/man4/man4.hp300/intro.4 b/share/man/man4/man4.hp300/intro.4
index dde08fe2ffd..926e5066dce 100644
--- a/share/man/man4/man4.hp300/intro.4
+++ b/share/man/man4/man4.hp300/intro.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: intro.4,v 1.20 2004/08/03 21:46:49 miod Exp $
+.\" $OpenBSD: intro.4,v 1.21 2005/01/14 22:39:21 miod Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" from: @(#)intro.4 8.1 (Berkeley) 6/5/93
.\"
-.Dd July 27, 2004
+.Dd January 12, 2005
.Dt INTRO 4 hp300
.Os
.Sh NAME
@@ -64,7 +64,7 @@ The networking support is introduced in
.Sh DEVICE SUPPORT
This section describes the hardware supported on the
.Tn HP
-9000/300 series.
+9000/300 and 9000/400 series.
Software support for these devices comes in two forms.
A hardware device may be supported with a character or block
.Em device driver ,
@@ -123,9 +123,6 @@ frame buffer.
.Tn HP98700
.Dq Gatorbox
frame buffer.
-.It Xr grf 4
-Generic frame buffer interface for
-.Xr ite 4 .
.It Xr hd 4
CS/80 disk interface.
.It Xr hil 4
@@ -136,8 +133,6 @@ Built-in and 98625 HP-IB interface.
.Tn A1096A
.Dq Hyperion
frame buffer.
-.It Xr ite 4
-HP Internal Terminal Emulator.
.It Xr le 4
98643 LANCE-based Ethernet interface.
.It Xr ppi 4
@@ -146,8 +141,12 @@ HP-IB printer/plotter interface.
.Tn HP98720
.Dq Renaissance
frame buffer.
+.It Xr sgc 4
+Standard Graphics Connection bus.
.It Xr spc 4
HP 98658 SCSI host adaptor.
+.It Xr sti 4
+SGC frame buffers.
.It Xr topcat 4
.Tn HP98544
.Dq Topcat ,
diff --git a/share/man/man4/man4.hp300/ite.4 b/share/man/man4/man4.hp300/ite.4
deleted file mode 100644
index 8c862ab825d..00000000000
--- a/share/man/man4/man4.hp300/ite.4
+++ /dev/null
@@ -1,154 +0,0 @@
-.\" $OpenBSD: ite.4,v 1.9 2005/01/08 19:47:38 miod Exp $
-.\"
-.\" Copyright (c) 1990, 1991, 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. 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: @(#)ite.4 8.1 (Berkeley) 6/9/93
-.\"
-.Dd June 9, 1993
-.Dt ITE 4 hp300
-.Os
-.Sh NAME
-.Nm ite
-.Nd
-.Tn HP
-Internal Terminal Emulator
-.Sh SYNOPSIS
-.Cd "ite* at grf?"
-.Sh DESCRIPTION
-.Tn TTY
-special files of the form
-.Pa /dev/ttye?
-are interfaces to the
-.Tn HP ITE
-for bit-mapped displays as implemented under
-.Ox .
-An
-.Tn ITE
-is the main system console on most
-.Tn HP300
-workstations and
-is the mechanism through which a user communicates with the machine.
-If more than one display exists on a system,
-any or all can be used as
-.Tn ITE Ns s
-with the limitation that only the first
-one opened will have a keyboard (since only one keyboard is supported).
-.Pp
-.Tn ITE
-devices use the
-.Tn HP-UX
-.Sq Li 300h
-.Xr termcap 5
-or
-.Xr terminfo 5
-entries.
-However, as currently implemented,
-the
-.Tn ITE
-does not support the full range of
-.Tn HP-UX
-capabilities for this device.
-Missing are multiple colors, underlining, blinking, softkeys,
-programmable tabs, scrolling memory and keyboard arrow keys.
-The keyboard does not have any of the international character
-support of
-.Tn HP Ns 's
-.Tn NLS
-system.
-It does use the left and right
-.Em extend char
-keys as meta keys, in that it will set the eighth bit of the character code.
-.Pp
-Upon booting, the kernel will first look for an
-.Tn ITE
-device
-to use as the system console
-.Pq Pa /dev/console .
-If a display exists at any hardware address, it will be the console.
-.Pp
-When activated as an
-.Tn ITE
-(special file opened),
-all displays go through a standard initialization sequence.
-The frame buffer is cleared,
-the
-.Tn ROM
-fonts are unpacked and loaded into off-screen storage and
-a cursor appears.
-The
-.Tn ITE
-initialization routine also sets the colormap entry used to white.
-Variable colors are not used, mainly for reasons of simplicity.
-The font pixels are all set to 0xff and the colormap entry corresponding
-to all planes is set to R=255, G=255 and B=255.
-The actual number of planes used to display the characters depends
-on the hardware installed.
-Finally, if the keyboard
-.Tn HIL
-device is not already assigned to another
-.Tn ITE
-device, it is placed in ``cooked'' mode and assigned to this
-.Tn ITE .
-.Pp
-On most systems,
-a display is used both as an
-.Tn ITE
-.Pf ( Pa /dev/ttye?
-aka
-.Pa /dev/console )
-and as a graphics device
-.Pq Pa /dev/grf? .
-In this environment,
-there is some interaction between the two uses that should be noted.
-For example, opening
-.Pa /dev/grf0
-will deactivate the
-.Tn ITE ,
-that is, write over whatever may be on the
-.Tn ITE
-display.
-When the graphics application is finished and
-.Pa /dev/grf0
-closed, the
-.Tn ITE
-will be reinitialized with the frame buffer cleared and the
-.Tn ITE
-colormap installed.
-.Sh SEE ALSO
-.Xr dvbox 4 ,
-.Xr gbox 4 ,
-.Xr grf 4 ,
-.Xr hil 4 ,
-.Xr hyper 4 ,
-.Xr intro 4 ,
-.Xr rbox 4 ,
-.Xr topcat 4
diff --git a/share/man/man4/man4.hp300/rbox.4 b/share/man/man4/man4.hp300/rbox.4
index c5eb52469c0..a6971e3a4d6 100644
--- a/share/man/man4/man4.hp300/rbox.4
+++ b/share/man/man4/man4.hp300/rbox.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rbox.4,v 1.5 2005/01/08 19:47:38 miod Exp $
+.\" $OpenBSD: rbox.4,v 1.6 2005/01/14 22:39:21 miod Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" from: @(#)rb.4 8.1 (Berkeley) 6/9/93
.\"
-.Dd March 16, 2003
+.Dd January 12, 2005
.Dt RBOX 4 hp300
.Os
.Sh NAME
@@ -42,9 +42,9 @@
.Tn HP98720
Renaissance frame buffer
.Sh SYNOPSIS
-.Cd "rbox* at intio?"
-.Cd "rbox* at dio?"
-.Cd "grf* at rbox?"
+.Cd "rbox* at intio?"
+.Cd "rbox* at dio?"
+.Cd "wsdisplay* at rbox?"
.Sh DESCRIPTION
The
.Tn HP98720
@@ -59,9 +59,7 @@ frame buffer extensions, it is possible to add overlay planes.
The
.Nm
driver provides a frame buffer abstraction to the
-.Xr grf 4
-driver, and the associated
-.Xr ite 4
+.Xr wscons 4
console framework.
.Pp
The Renaissance can be configured at either the ``internal'' address
@@ -70,13 +68,14 @@ or at an external select code less than 32.
The hardware installation manual describes the procedure for
setting these values.
.Sh SEE ALSO
-.Xr ioctl 2 ,
.Xr dvbox 4 ,
.Xr gbox 4 ,
-.Xr grf 4 ,
.Xr hyper 4 ,
.Xr intro 4 ,
-.Xr topcat 4
+.Xr sti 4 ,
+.Xr topcat 4 ,
+.Xr wscons 4 ,
+.Xr wsdisplay 4
.Sh BUGS
This driver has not been tested with all possible
combinations of frame buffer boards and scan boards installed in the device.
diff --git a/share/man/man4/man4.hp300/sgc.4 b/share/man/man4/man4.hp300/sgc.4
new file mode 100644
index 00000000000..02d49bd2b65
--- /dev/null
+++ b/share/man/man4/man4.hp300/sgc.4
@@ -0,0 +1,52 @@
+.\" $OpenBSD: sgc.4,v 1.1 2005/01/14 22:39:21 miod Exp $
+.\"
+.\" Copyright (c) 2005, Miodrag Vallat
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.Dd January 12, 2005
+.Dt SGC 4 hp300
+.Os
+.Sh NAME
+.Nm sgc
+.Nd Standard Graphics Connection bus
+.Sh SYNOPSIS
+.Cd "sgc0 at mainbus0"
+.Sh DESCRIPTION
+The SGC bus was designed by
+.Tn HP
+as a standard interface to connect graphics products to workstations.
+The
+.Nm
+driver provides support for the SGC bus found on some HP 9000/4xx series
+workstations.
+.Sh SUPPORTED DEVICES
+The following SGC devices are supported:
+.Ss Framebuffers
+.Bl -tag -width xxxxxx -offset indent -compact
+.It Xr sti 4
+HP Standard Text Interface compatible frame buffers
+.El
+.Sh SEE ALSO
+.Xr dio 4 ,
+.Xr intro 4 ,
+.Xr sti 4
diff --git a/share/man/man4/man4.hp300/topcat.4 b/share/man/man4/man4.hp300/topcat.4
index a96c6f1ade4..25edefdbe84 100644
--- a/share/man/man4/man4.hp300/topcat.4
+++ b/share/man/man4/man4.hp300/topcat.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: topcat.4,v 1.9 2005/01/11 22:34:13 miod Exp $
+.\" $OpenBSD: topcat.4,v 1.10 2005/01/14 22:39:21 miod Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" from: @(#)tc.4 8.1 (Berkeley) 6/9/93
.\"
-.Dd January 11, 2005
+.Dd January 12, 2005
.Dt TOPCAT 4 hp300
.Os
.Sh NAME
@@ -45,9 +45,9 @@ and
Kathmandu
frame buffers
.Sh SYNOPSIS
-.Cd "topcat* at intio?"
-.Cd "topcat* at dio?"
-.Cd "grf* at topcat?"
+.Cd "topcat* at intio?"
+.Cd "topcat* at dio?"
+.Cd "wsdisplay* at topcat?"
.Sh DESCRIPTION
The
HP98543, HP98544, HP98545A and HP98547A Topcat,
@@ -79,9 +79,7 @@ are accelerated frame buffers, with the following resolution and color depth:
The
.Nm
driver provides a frame buffer abstraction to the
-.Xr grf 4
-driver, and the associated
-.Xr ite 4
+.Xr wscons 4
console framework.
.Pp
The Topcat display cards are not user configurable.
@@ -94,10 +92,12 @@ switches selector to define the
.Dq select code .
A select code of 1 will use the same settings as the Topcat cards.
.Sh SEE ALSO
-.Xr ioctl 2 ,
.Xr dvbox 4 ,
.Xr gbox 4 ,
.Xr grf 4 ,
.Xr hyper 4 ,
.Xr intro 4 ,
-.Xr rbox 4
+.Xr rbox 4 ,
+.Xr sti 4 ,
+.Xr wscons 4 ,
+.Xr wsdisplay 4
diff --git a/share/man/man4/sti.4 b/share/man/man4/sti.4
index 586f00c6f7e..7913682ab46 100644
--- a/share/man/man4/sti.4
+++ b/share/man/man4/sti.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sti.4,v 1.15 2004/09/30 19:59:25 mickey Exp $
+.\" $OpenBSD: sti.4,v 1.16 2005/01/14 22:39:19 miod Exp $
.\"
.\" Copyright (c) 2001 Michael Shalayeff
.\" All rights reserved.
@@ -24,7 +24,7 @@
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
.\" THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd May 11, 2001
+.Dd January 12, 2005
.Dt STI 4
.Os
.Sh NAME
@@ -33,6 +33,7 @@
.Sh SYNOPSIS
.Cd "sti* at mainbus0"
.Cd "sti* at phantomas0"
+.Cd "sti* at sgc?"
.\" .Cd "sti* at pci?"
.Cd "wsdisplay* at sti?"
.Sh DESCRIPTION
@@ -45,6 +46,7 @@ The following models are supported
(though not all features or frame buffer depths may be available):
.Bl -column "Visualize FX10pro" "Bits" "Mem" "3D" "machines" -offset left
.It "Model" Ta "Bits" Ta "Mem" Ta "3D" Ta "Machines/Cards"
+.It "EVRX" Ta "8" Ta "2" Ta "" Ta "HP9000/425e"
.\" .It "Timber" Ta "8" Ta "2" Ta "" Ta "HP9000/705/710"
.It "GRX" Ta "8g" Ta "2" Ta "" Ta "SGC"
.It "CRX" Ta "8" Ta "2" Ta "" Ta "SGC"
@@ -247,6 +249,7 @@ Colour frame buffer support.
.El
.Sh SEE ALSO
.Xr intro 4 ,
+.Xr sgc 4 ,
.Xr phantomas 4 ,
.Xr wsdisplay 4
.Pp
diff --git a/sys/arch/hp300/conf/DISKLESS b/sys/arch/hp300/conf/DISKLESS
index 3265a9993df..98d71469011 100644
--- a/sys/arch/hp300/conf/DISKLESS
+++ b/sys/arch/hp300/conf/DISKLESS
@@ -1,4 +1,4 @@
-# $OpenBSD: DISKLESS,v 1.24 2004/09/16 09:14:03 mickey Exp $
+# $OpenBSD: DISKLESS,v 1.25 2005/01/14 22:39:23 miod Exp $
# $NetBSD: GENERIC,v 1.23 1997/01/31 06:12:57 thorpej Exp $
#
# Generic kernel - one size fits all.
@@ -10,15 +10,15 @@ machine hp300 m68k
include "../../../conf/GENERIC"
# Support for various CPU types
-option HP320
-option HP330 # includes 318, 319
-option HP340
+option HP320
+option HP330 # includes 318, 319
+option HP340
option HP345
-option HP350
-option HP360
-option HP370
-option HP375
-option HP380
+option HP350
+option HP360
+option HP370
+option HP375
+option HP380
option HP385
option HP400
option HP425
@@ -28,23 +28,16 @@ option HP433
maxusers 16
# Options for HP hardware
-option USELEDS # make the lights twinkle
+option USELEDS # make the lights twinkle
#option CONSCODE="9" # force console at this select code
-option UK_KEYBOARD # include United Kingdom HIL keymap
-option SE_KEYBOARD # include Swedish HIL keymap
-#
-# HP-UX binary compatibility.
-# NOTE: THIS IS STILL VERY EXPERIMENTAL. YOUR MILEAGE MAY VARY.
-#
-option COMPAT_HPUX # HP-UX binary compatibility
-
-option COMPAT_M68K4K # compat. with NetBSD/m68k4k binaries
+option COMPAT_HPUX # HP-UX binary compatibility
+option COMPAT_M68K4K # compat. with NetBSD/m68k4k binaries
option COMPAT_SUNOS # SunOS/sun3 binaries
# Verbose descriptions of unconfigured DIO devices
# (Warning: this compiles in a large string table)
-option DIOVERBOSE # recognize "unknown" DIO devices
+option DIOVERBOSE # recognize "unknown" DIO devices
config bsd swap generic
@@ -52,6 +45,15 @@ mainbus0 at root # root "bus"
intio0 at mainbus0 # internal i/o space
dio0 at mainbus0 # DIO/DIO-II bus
+#sgc0 at mainbus0 # SGC bus on some 4xx models
+
+# Human Interface Loop devices
+hil0 at intio? # HIL controller
+hilkbd* at hil? # keyboards
+wskbd* at hilkbd? mux 1
+hilms* at hil? # mice, buttons and tablets
+wsmouse* at hilms? mux 0
+hilid* at hil? # ID module
# Frodo utility chip found on 4xx's
frodo0 at intio?
@@ -63,35 +65,34 @@ apci* at frodo? # tty flavor
# Davinci framebuffer
dvbox* at intio?
dvbox* at dio?
+wsdisplay* at dvbox?
# Gatorbox framebuffer
gbox* at intio?
gbox* at dio?
+wsdisplay* at gbox?
# Hyperion framebuffer
hyper* at dio?
+wsdisplay* at hyper?
# Renaissance framebuffer
rbox* at intio?
rbox* at dio?
+wsdisplay* at rbox?
# Topcat/catseye framebuffers
topcat* at intio?
topcat* at dio?
+wsdisplay* at topcat?
-# Framebuffer abstraction
-grf* at dvbox?
-grf* at gbox?
-grf* at hyper?
-grf* at rbox?
-grf* at topcat?
-
-# Internal Terminal Emulator
-ite* at grf?
+# SGC framebuffers
+#sti* at sgc?
+#wsdisplay* at sti?
-dca0 at dio? scode 9 flags 1 # DCA serial interfaces
+dca0 at dio? scode 9 flags 1 # DCA serial interfaces
dca* at dio?
-dcm* at dio? flags 0xe # DCM 4- or 8-port serial interfaces
+dcm* at dio? flags 0xe # DCM 4- or 8-port serial interfaces
-le* at dio? # LANCE ethernet interfaces
+le* at dio? # LANCE ethernet interfaces
diff --git a/sys/arch/hp300/conf/GENERIC b/sys/arch/hp300/conf/GENERIC
index 3612e23443f..d6b74fd9af3 100644
--- a/sys/arch/hp300/conf/GENERIC
+++ b/sys/arch/hp300/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.33 2004/09/16 09:14:03 mickey Exp $
+# $OpenBSD: GENERIC,v 1.34 2005/01/14 22:39:23 miod Exp $
# $NetBSD: GENERIC,v 1.23 1997/01/31 06:12:57 thorpej Exp $
#
# Generic kernel - one size fits all.
@@ -10,41 +10,34 @@ machine hp300 m68k
include "../../../conf/GENERIC"
# Support for various CPU types
-option HP320
-option HP330 # includes 318, 319
-option HP340
+option HP320
+option HP330 # includes 318, 319
+option HP340
option HP345
-option HP350
-option HP360
-option HP370
-option HP375
-option HP380
-option HP385
-option HP400
-option HP425
-option HP433
+option HP350
+option HP360
+option HP370
+option HP375
+option HP380
+option HP385
+option HP400
+option HP425
+option HP433
# Need to set locally
maxusers 32
# Options for HP hardware
-option USELEDS # make the lights twinkle
+option USELEDS # make the lights twinkle
#option CONSCODE="9" # force console at this select code
-option UK_KEYBOARD # include United Kingdom HIL keymap
-option SE_KEYBOARD # include Swedish HIL keymap
-#
-# HP-UX binary compatibility.
-# NOTE: THIS IS STILL VERY EXPERIMENTAL. YOUR MILEAGE MAY VARY.
-#
-option COMPAT_HPUX # HP-UX binary compatibility
-
-option COMPAT_M68K4K # compat. with NetBSD/m68k4k binaries
+option COMPAT_HPUX # HP-UX binary compatibility
+option COMPAT_M68K4K # compat. with NetBSD/m68k4k binaries
option COMPAT_SUNOS # SunOS/sun3 binaries
# Verbose descriptions of unconfigured DIO devices
# (Warning: this compiles in a large string table)
-option DIOVERBOSE # recognize "unknown" DIO devices
+option DIOVERBOSE # recognize "unknown" DIO devices
config bsd swap generic
@@ -52,6 +45,15 @@ mainbus0 at root # root "bus"
intio0 at mainbus0 # internal i/o space
dio0 at mainbus0 # DIO/DIO-II bus
+#sgc0 at mainbus0 # SGC bus on some 4xx models
+
+# Human Interface Loop devices
+hil0 at intio? # HIL controller
+hilkbd* at hil? # keyboards
+wskbd* at hilkbd? mux 1
+hilms* at hil? # mice, buttons and tablets
+wsmouse* at hilms? mux 0
+hilid* at hil? # ID module
# Frodo utility chip found on 4xx's
frodo0 at intio?
@@ -63,36 +65,35 @@ apci* at frodo? # tty flavor
# Davinci framebuffer
dvbox* at intio?
dvbox* at dio?
+wsdisplay* at dvbox?
# Gatorbox framebuffer
gbox* at intio?
gbox* at dio?
+wsdisplay* at gbox?
# Hyperion framebuffer
hyper* at dio?
+wsdisplay* at hyper?
# Renaissance framebuffer
rbox* at intio?
rbox* at dio?
+wsdisplay* at rbox?
# Topcat/catseye framebuffers
topcat* at intio?
topcat* at dio?
+wsdisplay* at topcat?
-# Framebuffer abstraction
-grf* at dvbox?
-grf* at gbox?
-grf* at hyper?
-grf* at rbox?
-grf* at topcat?
-
-# Internal Terminal Emulator
-ite* at grf?
+# SGC framebuffers
+#sti* at sgc?
+#wsdisplay* at sti?
-dca0 at dio? scode 9 flags 1 # DCA serial interfaces
+dca0 at dio? scode 9 flags 1 # DCA serial interfaces
dca* at dio?
-dcm* at dio? flags 0xe # DCM 4- or 8-port serial interfaces
+dcm* at dio? flags 0xe # DCM 4- or 8-port serial interfaces
le* at dio? # LANCE ethernet interfaces
@@ -119,3 +120,5 @@ cd* at scsibus? # SCSI CD-ROMs
ch* at scsibus? # SCSI changer devices
ss* at scsibus? # SCSI scanners
uk* at scsibus? # unknown SCSI devices
+
+pseudo-device wsmux 2 # mouse and keyboard multiplexor
diff --git a/sys/arch/hp300/conf/RAMDISK b/sys/arch/hp300/conf/RAMDISK
index fe70f074e83..aed467ba746 100644
--- a/sys/arch/hp300/conf/RAMDISK
+++ b/sys/arch/hp300/conf/RAMDISK
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISK,v 1.20 2004/09/16 09:14:03 mickey Exp $
+# $OpenBSD: RAMDISK,v 1.21 2005/01/14 22:39:23 miod Exp $
#
# Ram disk kernel.
#
@@ -6,19 +6,19 @@
machine hp300 m68k
# Support for various CPU types
-option HP320
-option HP330 # includes 318, 319
-option HP340
+option HP320
+option HP330 # includes 318, 319
+option HP340
option HP345
-option HP350
-option HP360
-option HP370
-option HP375
-option HP380
+option HP350
+option HP360
+option HP370
+option HP375
+option HP380
option HP385
-option HP400
-option HP425
-option HP433
+option HP400
+option HP425
+option HP433
maxusers 32
@@ -41,14 +41,12 @@ option INET # IP + ICMP + TCP + UDP
option BOOT_CONFIG # add support for boot -c
# Options for HP hardware
-option USELEDS # make the lights twinkle
+option USELEDS # make the lights twinkle
#option CONSCODE="9" # force console at this select code
-option UK_KEYBOARD # include United Kingdom HIL keymap
-option SE_KEYBOARD # include Swedish HIL keymap
# Verbose descriptions of unconfigured DIO devices
# (Warning: this compiles in a large string table)
-option DIOVERBOSE # recognize "unknown" DIO devices
+option DIOVERBOSE # recognize "unknown" DIO devices
# Options for the ramdisk.
option MINIROOTSIZE=4096
@@ -60,6 +58,15 @@ mainbus0 at root # root "bus"
intio0 at mainbus0 # internal i/o space
dio0 at mainbus0 # DIO/DIO-II bus
+#sgc0 at mainbus0 # SGC bus on some 4xx models
+
+# Human Interface Loop devices
+hil0 at intio? # HIL controller
+hilkbd* at hil? # keyboards
+wskbd* at hilkbd? mux 1
+#hilms* at hil? # mice, buttons and tablets
+#wsmouse* at hilms? mux 0
+#hilid* at hil? # ID module
# Frodo utility chip found on 4xx's
frodo0 at intio?
@@ -71,31 +78,30 @@ apci* at frodo? # tty flavor
# Davinci framebuffer
dvbox* at intio?
dvbox* at dio?
+wsdisplay* at dvbox?
# Gatorbox framebuffer
gbox* at intio?
gbox* at dio?
+wsdisplay* at gbox?
# Hyperion framebuffer
hyper* at dio?
+wsdisplay* at hyper?
# Renaissance framebuffer
rbox* at intio?
rbox* at dio?
+wsdisplay* at rbox?
# Topcat/catseye framebuffers
topcat* at intio?
topcat* at dio?
+wsdisplay* at topcat?
-# Framebuffer abstraction
-grf* at dvbox?
-grf* at gbox?
-grf* at hyper?
-grf* at rbox?
-grf* at topcat?
-
-# Internal Terminal Emulator
-ite* at grf?
+# SGC framebuffers
+#sti* at sgc?
+#wsdisplay* at sti?
dca0 at dio? scode 9 flags 1 # DCA serial interfaces
dca* at dio?
diff --git a/sys/arch/hp300/conf/files.hp300 b/sys/arch/hp300/conf/files.hp300
index fcf0af9ae68..c9bb0aa76ee 100644
--- a/sys/arch/hp300/conf/files.hp300
+++ b/sys/arch/hp300/conf/files.hp300
@@ -1,4 +1,4 @@
-# $OpenBSD: files.hp300,v 1.24 2004/10/08 13:04:36 grange Exp $
+# $OpenBSD: files.hp300,v 1.25 2005/01/14 22:39:23 miod Exp $
# $NetBSD: files.hp300,v 1.28 1997/05/12 08:23:28 thorpej Exp $
#
# hp300-specific configuration info
@@ -32,6 +32,14 @@ attach dio at mainbus
file arch/hp300/dev/dio.c dio
#
+# SGC bus
+#
+
+device sgc {[ slot = -1]}
+attach sgc at mainbus
+file arch/hp300/dev/sgc.c sgc needs-flag
+
+#
# Devices in Internal i/o space
#
@@ -40,68 +48,63 @@ device frodo {[offset = -1]}
attach frodo at intio
file arch/hp300/dev/frodo.c frodo
+# Apollo Keyboard and mouse
+device dnkbd
+attach dnkbd at frodo
+file arch/hp300/dev/dnkbd.c dnkbd needs-flag
+
# Apollo APCI 8250-like UARTs
device apci
attach apci at frodo
-file arch/hp300/dev/apci.c apci needs-flag
+file arch/hp300/dev/apci.c apci needs-flag
-# Frame buffer attribute
-define grfdev { }
+# "workstation console" routines
+include "dev/wscons/files.wscons"
+file arch/hp300/hp300/wscons_machdep.c wsdisplay
+#
# Frame buffer devices
-device dvbox: grfdev
-file arch/hp300/dev/grf_dv.c dvbox needs-flag
-
-device gbox: grfdev
-file arch/hp300/dev/grf_gb.c gbox needs-flag
-
-device hyper: grfdev
-file arch/hp300/dev/grf_hy.c hyper needs-flag
-
-device rbox: grfdev
-file arch/hp300/dev/grf_rb.c rbox needs-flag
+#
+define diofb
+file arch/hp300/dev/diofb.c diofb
-device topcat: grfdev
-file arch/hp300/dev/grf_tc.c topcat needs-flag
+device dvbox: wsemuldisplaydev, diofb
+attach dvbox at intio with dvbox_intio
+attach dvbox at dio with dvbox_dio
+file arch/hp300/dev/dvbox.c dvbox needs-flag
-# `grf' framebuffer abstraction
-device grf { }
-attach grf at grfdev
-file arch/hp300/dev/grf.c grf needs-flag
-file arch/hp300/dev/grf_subr.c grf
+device gbox: wsemuldisplaydev, diofb
+attach gbox at intio with gbox_intio
+attach gbox at dio with gbox_dio
+file arch/hp300/dev/gbox.c gbox needs-flag
-# Internal Terminal Emulator
-device ite
-attach ite at grf
-file arch/hp300/dev/ite.c ite needs-flag
-file arch/hp300/dev/ite_subr.c ite
+device hyper: wsemuldisplaydev, diofb
+attach hyper at dio with hyper_dio
+file arch/hp300/dev/hyper.c hyper needs-flag
-# Internal i/o framebuffer attachments
-attach dvbox at intio with dvbox_intio
-attach gbox at intio with gbox_intio
+device rbox: wsemuldisplaydev, diofb
attach rbox at intio with rbox_intio
+attach rbox at dio with rbox_dio
+file arch/hp300/dev/rbox.c rbox needs-flag
+
+device topcat: wsemuldisplaydev, diofb
attach topcat at intio with topcat_intio
+attach topcat at dio with topcat_dio
+file arch/hp300/dev/topcat.c topcat needs-flag
#
-# Devices on the DIO bus
+# Other devices on the DIO bus
#
-# DIO framebuffer attachments
-attach dvbox at dio with dvbox_dio
-attach gbox at dio with gbox_dio
-attach hyper at dio with hyper_dio
-attach rbox at dio with rbox_dio
-attach topcat at dio with topcat_dio
-
# DCA serial interface
device dca: tty
attach dca at dio
-file arch/hp300/dev/dca.c dca needs-flag
+file arch/hp300/dev/dca.c dca needs-flag
# DCM serial interface
device dcm: tty
attach dcm at dio
-file arch/hp300/dev/dcm.c dcm needs-flag
+file arch/hp300/dev/dcm.c dcm needs-flag
# LANCE ethernet
attach le at dio
@@ -126,20 +129,20 @@ file arch/hp300/dev/hpib.c hpibbus
# HP-IB devices
device ct: tape
attach ct at hpibbus
-file arch/hp300/dev/ct.c ct needs-flag
+file arch/hp300/dev/ct.c ct needs-flag
device mt: tape
attach mt at hpibbus
-file arch/hp300/dev/mt.c mt needs-flag
+file arch/hp300/dev/mt.c mt needs-flag
device hd: disk
attach hd at hpibbus
-file arch/hp300/dev/hd.c hd needs-flag
+file arch/hp300/dev/hd.c hd needs-flag
major {hd = 2}
device ppi
attach ppi at hpibbus
-file arch/hp300/dev/ppi.c ppi needs-flag
+file arch/hp300/dev/ppi.c ppi needs-flag
# RAM disk
major {rd = 8}
@@ -155,19 +158,31 @@ file arch/hp300/dev/mb89352.c spc
major {sd = 4}
major {cd = 9}
-# Human (Hilarious) Interface Loop
-# XXX should be a real device
-file arch/hp300/dev/hil.c
-file arch/hp300/dev/hil_keymaps.c
+#
+# Devices on the SGC bus
+#
+
+attach sti at sgc with sti_sgc
+file arch/hp300/dev/sti_sgc.c sti_sgc
+
+#
+# HIL Human Interface Loop devices
+#
+include "dev/hil/files.hil"
+
+attach hil at intio with hil_intio
+file arch/hp300/dev/hil_intio.c hil_intio
#
# Non-device files
#
file arch/hp300/hp300/autoconf.c
+file arch/hp300/hp300/bus_space.c
file arch/hp300/hp300/clock.c
file arch/hp300/hp300/conf.c
file arch/hp300/hp300/db_memrw.c ddb | kgdb
+file arch/hp300/hp300/disksubr.c
file arch/hp300/hp300/dkbad.c
file arch/hp300/hp300/kgdb_machdep.c kgdb
file arch/hp300/hp300/machdep.c
@@ -179,7 +194,6 @@ file arch/hp300/hp300/pmap_bootstrap.c
file arch/hp300/hp300/sys_machdep.c
file arch/hp300/hp300/trap.c
file arch/hp300/hp300/vm_machdep.c
-file arch/hp300/hp300/disksubr.c
file arch/hp300/dev/dma.c
file dev/cninit.c
diff --git a/sys/arch/hp300/dev/dca.c b/sys/arch/hp300/dev/dca.c
index 903c5536ec9..5dedb908cb0 100644
--- a/sys/arch/hp300/dev/dca.c
+++ b/sys/arch/hp300/dev/dca.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dca.c,v 1.21 2005/01/08 22:13:53 miod Exp $ */
+/* $OpenBSD: dca.c,v 1.22 2005/01/14 22:39:25 miod Exp $ */
/* $NetBSD: dca.c,v 1.35 1997/05/05 20:58:18 thorpej Exp $ */
/*
@@ -58,6 +58,7 @@
#include <sys/device.h>
#include <machine/autoconf.h>
+#include <machine/bus.h>
#include <machine/cpu.h>
#include <machine/intr.h>
@@ -299,7 +300,7 @@ dcaopen(dev, flag, mode, p)
struct dcadevice *dca;
u_char code;
int s, error = 0;
-
+
if (unit >= dca_cd.cd_ndevs ||
(sc = dca_cd.cd_devs[unit]) == NULL)
return (ENXIO);
@@ -346,7 +347,7 @@ dcaopen(dev, flag, mode, p)
dca->dca_fifo = FIFO_ENABLE | FIFO_RCV_RST |
FIFO_XMT_RST |
(tp->t_ispeed <= 1200 ? FIFO_TRIGGER_1 :
- FIFO_TRIGGER_14);
+ FIFO_TRIGGER_14);
/* Flush any pending I/O */
while ((dca->dca_iir & IIR_IMASK) == IIR_RXRDY)
@@ -385,7 +386,7 @@ dcaopen(dev, flag, mode, p)
while (sc->sc_cua ||
((tp->t_cflag & CLOCAL) == 0 &&
(tp->t_state & TS_CARR_ON) == 0)) {
- tp->t_state |= TS_WOPEN;
+ tp->t_state |= TS_WOPEN;
error = ttysleep(tp, (caddr_t)&tp->t_rawq,
TTIPRI | PCATCH, ttopen, 0);
if (!DCACUA(dev) && sc->sc_cua && error == EINTR)
@@ -407,7 +408,7 @@ dcaopen(dev, flag, mode, p)
return (error);
}
-
+
/*ARGSUSED*/
int
dcaclose(dev, flag, mode, p)
@@ -420,7 +421,7 @@ dcaclose(dev, flag, mode, p)
struct dcadevice *dca;
int unit;
int s;
-
+
unit = DCAUNIT(dev);
sc = dca_cd.cd_devs[unit];
@@ -451,7 +452,7 @@ dcaclose(dev, flag, mode, p)
#endif
return (0);
}
-
+
int
dcaread(dev, uio, flag)
dev_t dev;
@@ -464,7 +465,7 @@ dcaread(dev, uio, flag)
int error, of;
sc = dca_cd.cd_devs[unit];
-
+
tp = sc->sc_tty;
of = sc->sc_oflows;
error = (*linesw[tp->t_line].l_read)(tp, uio, flag);
@@ -476,7 +477,7 @@ dcaread(dev, uio, flag)
log(LOG_WARNING, "%s: silo overflow\n", sc->sc_dev.dv_xname);
return (error);
}
-
+
int
dcawrite(dev, uio, flag)
dev_t dev;
@@ -485,7 +486,7 @@ dcawrite(dev, uio, flag)
{
struct dca_softc *sc = dca_cd.cd_devs[DCAUNIT(dev)];
struct tty *tp = sc->sc_tty;
-
+
return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
}
@@ -497,7 +498,7 @@ dcatty(dev)
return (sc->sc_tty);
}
-
+
int
dcaintr(arg)
void *arg;
@@ -679,7 +680,7 @@ dcaioctl(dev, cmd, data, flag, p)
struct tty *tp = sc->sc_tty;
struct dcadevice *dca = sc->sc_dca;
int error;
-
+
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
if (error >= 0)
return (error);
@@ -769,7 +770,7 @@ dcaparam(tp, t)
int cfcr, cflag = t->c_cflag;
int ospeed = ttspeedtab(t->c_ospeed, dcaspeedtab);
int s;
-
+
/* check requested parameters */
if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed))
return (EINVAL);
@@ -835,7 +836,7 @@ dcaparam(tp, t)
splx(s);
return (0);
}
-
+
void
dcastart(tp)
struct tty *tp;
@@ -843,7 +844,7 @@ dcastart(tp)
int s, c, unit = DCAUNIT(tp->t_dev);
struct dca_softc *sc = dca_cd.cd_devs[unit];
struct dcadevice *dca = sc->sc_dca;
-
+
s = spltty();
if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP))
@@ -869,7 +870,7 @@ dcastart(tp)
fifoout[c]++;
#endif
} else
- dca->dca_data = getc(&tp->t_outq);
+ dca->dca_data = getc(&tp->t_outq);
}
out:
@@ -894,7 +895,7 @@ dcastop(tp, flag)
splx(s);
return (0);
}
-
+
int
dcamctl(sc, bits, how)
struct dca_softc *sc;
@@ -1043,7 +1044,7 @@ dcacnprobe(cp)
if (conforced)
return;
- console_scan(dca_console_scan, cp);
+ console_scan(dca_console_scan, cp, HP300_BUS_DIO);
#ifdef KGDB
/* XXX this needs to be fixed. */
diff --git a/sys/arch/hp300/dev/dcm.c b/sys/arch/hp300/dev/dcm.c
index 8de1361e110..a2060d15a10 100644
--- a/sys/arch/hp300/dev/dcm.c
+++ b/sys/arch/hp300/dev/dcm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dcm.c,v 1.20 2005/01/08 22:13:53 miod Exp $ */
+/* $OpenBSD: dcm.c,v 1.21 2005/01/14 22:39:25 miod Exp $ */
/* $NetBSD: dcm.c,v 1.41 1997/05/05 20:59:16 thorpej Exp $ */
/*
@@ -63,6 +63,7 @@
#include <sys/device.h>
#include <machine/autoconf.h>
+#include <machine/bus.h>
#include <machine/cpu.h>
#include <machine/intr.h>
@@ -556,7 +557,7 @@ dcmopen(dev, flag, mode, p)
return (error);
}
-
+
/*ARGSUSED*/
int
dcmclose(dev, flag, mode, p)
@@ -567,7 +568,7 @@ dcmclose(dev, flag, mode, p)
int s, unit, board, port;
struct dcm_softc *sc;
struct tty *tp;
-
+
unit = DCMUNIT(dev);
board = DCMBOARD(unit);
port = DCMPORT(unit);
@@ -596,7 +597,7 @@ dcmclose(dev, flag, mode, p)
#endif
return (0);
}
-
+
int
dcmread(dev, uio, flag)
dev_t dev;
@@ -616,7 +617,7 @@ dcmread(dev, uio, flag)
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
}
-
+
int
dcmwrite(dev, uio, flag)
dev_t dev;
@@ -652,7 +653,7 @@ dcmtty(dev)
return (sc->sc_tty[port]);
}
-
+
int
dcmintr(arg)
void *arg;
@@ -692,7 +693,7 @@ dcmintr(arg)
if (dcmdebug & DDB_INTR) {
printf("%s: dcmintr: iir %x pc %x/%x/%x/%x ",
sc->sc_dev.dv_xname, code, pcnd[0], pcnd[1],
- pcnd[2], pcnd[3]);
+ pcnd[2], pcnd[3]);
printf("miir %x mc %x/%x/%x/%x\n",
mcode, mcnd[0], mcnd[1], mcnd[2], mcnd[3]);
}
@@ -960,7 +961,7 @@ dcmioctl(dev, cmd, data, flag, p)
sc = dcm_cd.cd_devs[board];
dcm = sc->sc_dcm;
tp = sc->sc_tty[port];
-
+
#ifdef DEBUG
if (dcmdebug & DDB_IOCTL)
printf("%s port %d: dcmioctl: cmd %lx data %x flag %x\n",
@@ -1136,7 +1137,7 @@ dcmparam(tp, t)
DELAY(16 * DCM_USPERCH(tp->t_ospeed));
return (0);
}
-
+
void
dcmstart(tp)
struct tty *tp;
@@ -1263,7 +1264,7 @@ out:
#endif
splx(s);
}
-
+
/*
* Stop output on a line.
*/
@@ -1283,7 +1284,7 @@ dcmstop(tp, flag)
splx(s);
return (0);
}
-
+
/*
* Modem control
*/
@@ -1463,7 +1464,7 @@ dcmselftest(sc)
s = splhigh();
dcm->dcm_rsid = DCMRS;
DELAY(50000); /* 5000 is not long enough */
- dcm->dcm_rsid = 0;
+ dcm->dcm_rsid = 0;
dcm->dcm_ic = IC_IE;
dcm->dcm_cr = CR_SELFT;
while ((dcm->dcm_ic & IC_IR) == 0) {
@@ -1569,7 +1570,7 @@ dcmcnprobe(cp)
if (conforced)
return;
- console_scan(dcm_console_scan, cp);
+ console_scan(dcm_console_scan, cp, HP300_BUS_DIO);
#ifdef KGDB_CHEAT
/* XXX this needs to be fixed. */
diff --git a/sys/arch/hp300/dev/diofb.c b/sys/arch/hp300/dev/diofb.c
new file mode 100644
index 00000000000..8930d3de62d
--- /dev/null
+++ b/sys/arch/hp300/dev/diofb.c
@@ -0,0 +1,471 @@
+/* $OpenBSD: diofb.c,v 1.1 2005/01/14 22:39:25 miod Exp $ */
+
+/*
+ * Copyright (c) 2005, Miodrag Vallat
+ *
+ * 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.
+ *
+ * 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.
+ */
+/*
+ * 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. 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.
+ */
+
+#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/device.h>
+
+#include <machine/autoconf.h>
+#include <machine/cpu.h>
+
+#include <hp300/dev/dioreg.h>
+#include <hp300/dev/diovar.h>
+
+#include <dev/wscons/wsdisplayvar.h>
+
+#include <hp300/dev/diofbreg.h>
+#include <hp300/dev/diofbvar.h>
+
+/*
+ * X and Y location of character 'c' in the framebuffer, in pixels.
+ */
+#define charX(fb,c) \
+ (((c) % (fb)->cpl) * (fb)->ftscale + (fb)->fontx)
+#define charY(fb,c) \
+ (((c) / (fb)->cpl) * (fb)->ftheight + (fb)->fonty)
+
+void diofb_fontcopy(struct diofb *, char *, char *);
+
+int diofb_mapchar(void *, int, unsigned int *);
+void diofb_cursor(void *, int, int, int);
+void diofb_putchar(void *, int, int, u_int, long);
+void diofb_copycols(void *, int, int, int, int);
+void diofb_erasecols(void *, int, int, int, long);
+void diofb_copyrows(void *, int, int, int);
+void diofb_eraserows(void *, int, int, long);
+
+const struct wsdisplay_emulops diofb_emulops = {
+ diofb_cursor,
+ diofb_mapchar,
+ diofb_putchar,
+ diofb_copycols,
+ diofb_erasecols,
+ diofb_copyrows,
+ diofb_eraserows,
+ diofb_alloc_attr
+};
+
+/*
+ * Frame buffer geometry initialization
+ */
+
+int
+diofb_fbinquire(struct diofb *fb, int scode, struct diofbreg *fbr, int regsize)
+{
+ int fboff;
+
+ if (ISIIOVA(fbr))
+ fb->regaddr = (caddr_t)IIOP(fbr);
+ else
+ fb->regaddr = dio_scodetopa(scode);
+ fb->regsize = regsize;
+
+ if (fb->fbwidth == 0 || fb->fbheight == 0) {
+ fb->fbwidth = (fbr->fbwmsb << 8) | fbr->fbwlsb;
+ fb->fbheight = (fbr->fbhmsb << 8) | fbr->fbhlsb;
+ }
+ fb->fbsize = fb->fbwidth * fb->fbheight;
+
+ fboff = (fbr->fbomsb << 8) | fbr->fbolsb;
+ fb->fbaddr = (caddr_t) (*((u_char *)fbr + fboff) << 16);
+
+ if (fb->regaddr >= (caddr_t)DIOII_BASE) {
+ /*
+ * 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 set.
+ */
+ fb->regsize = (int)fb->fbaddr;
+ fb->fbaddr += (int)fb->regaddr;
+ fb->regkva = (caddr_t)fbr;
+ fb->fbkva = (caddr_t)fbr + fb->regsize;
+ } else {
+ /*
+ * For DIO space we need to map the separate
+ * framebuffer.
+ */
+ fb->regkva = (caddr_t)fbr;
+ fb->fbkva = iomap(fb->fbaddr, fb->fbsize);
+ if (fb->fbkva == NULL)
+ return (ENOMEM);
+ }
+ if (fb->dwidth == 0 || fb->dheight == 0) {
+ fb->dwidth = (fbr->dwmsb << 8) | fbr->dwlsb;
+ fb->dheight = (fbr->dhmsb << 8) | fbr->dhlsb;
+ }
+
+ /*
+ * Some displays, such as the DaVinci, appear to return a display
+ * height larger than the frame buffer height.
+ */
+ if (fb->dwidth > fb->fbwidth)
+ fb->dwidth = fb->fbwidth;
+ if (fb->dheight > fb->fbheight)
+ fb->dheight = fb->fbheight;
+
+ return (0);
+}
+
+/*
+ * PROM font setup
+ */
+
+void
+diofb_fbsetup(struct diofb *fb)
+{
+ u_long fontaddr = getword(fb, getword(fb, FONTROM) + FONTADDR);
+
+ /*
+ * Get font metrics.
+ */
+ fb->ftheight = getbyte(fb, fontaddr + FONTHEIGHT);
+ fb->ftwidth = getbyte(fb, fontaddr + FONTWIDTH);
+ fb->ftscale = fb->ftwidth;
+ fb->rows = fb->dheight / fb->ftheight;
+ fb->cols = fb->dwidth / fb->ftwidth;
+
+ /*
+ * Decide where to put the font in off-screen memory.
+ */
+ if (fb->fbwidth > fb->dwidth) {
+ /* Unpacked font will be to the right of the display */
+ fb->fontx = fb->dwidth;
+ fb->fonty = 0;
+ fb->cpl = (fb->fbwidth - fb->dwidth) / fb->ftwidth;
+ fb->cblankx = fb->dwidth;
+ } else {
+ /* Unpacked font will be below the display */
+ fb->fontx = 0;
+ fb->fonty = fb->dheight;
+ fb->cpl = fb->fbwidth / fb->ftwidth;
+ fb->cblankx = 0;
+ }
+ fb->cblanky = fb->fonty + ((FONTMAXCHAR / fb->cpl) + 1) * fb->ftheight;
+
+ /*
+ * Clear display
+ */
+ (*fb->bmv)(fb, 0, 0, 0, 0, fb->dwidth, fb->dheight, RR_CLEAR);
+
+ strlcpy(fb->wsd.name, "std", sizeof(fb->wsd.name));
+ fb->wsd.ncols = fb->cols;
+ fb->wsd.nrows = fb->rows;
+ fb->wsd.textops = &diofb_emulops;
+ fb->wsd.fontwidth = fb->ftwidth;
+ fb->wsd.fontheight = fb->ftheight;
+ fb->wsd.capabilities = WSSCREEN_REVERSE;
+}
+
+void
+diofb_fontunpack(struct diofb *fb)
+{
+ char fontbuf[500]; /* XXX malloc not initialized yet */
+ char *dp, *fbmem;
+ int bytewidth, glyphsize;
+ int c, i, romp;
+
+ /*
+ * Unpack PROM font to the off-screen location.
+ */
+ bytewidth = (((fb->ftwidth - 1) / 8) + 1);
+ glyphsize = bytewidth * fb->ftheight;
+ romp = getword(fb, getword(fb, FONTROM) + FONTADDR) + FONTDATA;
+ for (c = 0; c < FONTMAXCHAR; c++) {
+ fbmem = (char *)(FBBASE(fb) +
+ (fb->fonty + (c / fb->cpl) * fb->ftheight) * fb->fbwidth +
+ (fb->fontx + (c % fb->cpl) * fb->ftwidth));
+ dp = fontbuf;
+ for (i = 0; i < glyphsize; i++) {
+ *dp++ = getbyte(fb, romp);
+ romp += 2;
+ }
+ diofb_fontcopy(fb, fbmem, fontbuf);
+ }
+}
+
+void
+diofb_fontcopy(struct diofb *fb, char *fbmem, char *glyphp)
+{
+ int bn;
+ int l, b;
+
+ for (l = 0; l < fb->ftheight; l++) {
+ bn = 7;
+ for (b = 0; b < fb->ftwidth; b++) {
+ if ((1 << bn) & *glyphp)
+ *fbmem++ = 1;
+ else
+ *fbmem++ = 0;
+ if (--bn < 0) {
+ bn = 7;
+ glyphp++;
+ }
+ }
+ if (bn < 7)
+ glyphp++;
+ fbmem -= fb->ftwidth;
+ fbmem += fb->fbwidth;
+ }
+}
+
+/*
+ * Attachment helper
+ */
+void
+diofb_end_attach(void *sc, struct wsdisplay_accessops *accessops,
+ struct diofb *fb, int console, int planes, const char *descr)
+{
+ struct wsemuldisplaydev_attach_args waa;
+ struct wsscreen_descr *scrlist[1];
+ struct wsscreen_list screenlist;
+
+ printf(": %dx%d", fb->dwidth, fb->dheight);
+
+ if (planes == 0)
+ planes = fb->planes;
+ if (planes == 1)
+ printf(" monochrome");
+ else
+ printf("x%d", planes);
+
+ if (descr != NULL)
+ printf(" %s", descr);
+ printf(" frame buffer\n");
+
+ scrlist[0] = &fb->wsd;
+ screenlist.nscreens = 1;
+ screenlist.screens = (const struct wsscreen_descr **)scrlist;
+
+ waa.console = console;
+ waa.scrdata = &screenlist;
+ waa.accessops = accessops;
+ waa.accesscookie = fb;
+
+ config_found((struct device *)sc, &waa, wsemuldisplaydevprint);
+}
+
+/*
+ * Common wsdisplay emulops for DIO frame buffers
+ */
+
+/* the cursor is just an inverted space */
+#define flip_cursor(fb) \
+do { \
+ (*fb->bmv)((fb), (fb)->cblankx, (fb)->cblanky, \
+ (fb)->cursorx * (fb)->ftwidth, \
+ (fb)->cursory * (fb)->ftheight, \
+ (fb)->ftwidth, (fb)->ftheight, RR_XOR); \
+} while (0)
+
+int
+diofb_alloc_attr(void *cookie, int fg, int bg, int flag, long *attrp)
+{
+ *attrp = flag & WSATTR_REVERSE;
+ return (0);
+}
+
+int
+diofb_mapchar(void *cookie, int c, unsigned int *cp)
+{
+ if (c < (int)' ' || c >= FONTMAXCHAR) {
+ *cp = ' ';
+ return (0);
+ }
+
+ *cp = c;
+ return (5);
+}
+
+void
+diofb_cursor(void *cookie, int on, int row, int col)
+{
+ struct diofb *fb = cookie;
+
+ /* Turn old cursor off if necessary */
+ if (fb->curvisible != 0)
+ flip_cursor(fb);
+
+ fb->cursorx = col;
+ fb->cursory = row;
+
+ if ((fb->curvisible = on) != 0)
+ flip_cursor(fb);
+}
+
+void
+diofb_putchar(void *cookie, int row, int col, u_int uc, long attr)
+{
+ struct diofb *fb = cookie;
+ int wmrr;
+
+ wmrr = (attr & WSATTR_REVERSE) ? RR_COPYINVERTED : RR_COPY;
+
+ (*fb->bmv)(fb, charX(fb, uc), charY(fb, uc),
+ col * fb->ftwidth, row * fb->ftheight,
+ fb->ftwidth, fb->ftheight, wmrr);
+}
+
+void
+diofb_copycols(void *cookie, int row, int src, int dst, int n)
+{
+ struct diofb *fb = cookie;
+
+ n *= fb->ftwidth;
+ src *= fb->ftwidth;
+ dst *= fb->ftwidth;
+ row *= fb->ftheight;
+
+ (*fb->bmv)(fb, src, row, dst, row, n, fb->ftheight, RR_COPY);
+}
+
+void
+diofb_copyrows(void *cookie, int src, int dst, int n)
+{
+ struct diofb *fb = cookie;
+
+ n *= fb->ftheight;
+ src *= fb->ftheight;
+ dst *= fb->ftheight;
+
+ (*fb->bmv)(fb, 0, src, 0, dst, fb->dwidth, n, RR_COPY);
+}
+
+void
+diofb_erasecols(void *cookie, int row, int col, int num, long attr)
+{
+ struct diofb *fb = cookie;
+
+ num *= fb->ftwidth;
+ col *= fb->ftwidth;
+ row *= fb->ftheight;
+ (*fb->bmv)(fb, col, row, col, row, num, fb->ftheight, RR_CLEAR);
+}
+
+void
+diofb_eraserows(void *cookie, int row, int num, long attr)
+{
+ struct diofb *fb = cookie;
+
+ row *= fb->ftheight;
+ num *= fb->ftheight;
+ (*fb->bmv)(fb, 0, row, 0, row, fb->dwidth, num, RR_CLEAR);
+}
+
+/*
+ * Common wsdisplay accessops for DIO frame buffers
+ */
+
+int
+diofb_alloc_screen(void *v, const struct wsscreen_descr *type,
+ void **cookiep, int *curxp, int *curyp, long *attrp)
+{
+ struct diofb *fb = v;
+
+ if (fb->nscreens > 0)
+ return (ENOMEM);
+
+ /*
+ * Setup inverted cursor.
+ */
+ (*fb->bmv)(fb, charX(fb, ' '), charY(fb, ' '),
+ fb->cblankx, fb->cblanky, fb->ftwidth, fb->ftheight,
+ RR_COPYINVERTED);
+
+ *cookiep = fb;
+ *curxp = *curyp = 0;
+ diofb_alloc_attr(fb, 0, 0, 0, attrp);
+ fb->nscreens++;
+
+ return (0);
+}
+
+void
+diofb_free_screen(void *v, void *cookie)
+{
+ struct diofb *fb = v;
+
+ fb->nscreens--;
+}
+
+int
+diofb_show_screen(void *v, void *cookie, int waitok,
+ void (*cb)(void *, int, int), void *cbarg)
+{
+ return (0);
+}
+
+paddr_t
+diofb_mmap(void * v, off_t offset, int prot)
+{
+ struct diofb *fb = v;
+
+ if (offset & PGOFSET)
+ return (-1);
+
+ if (offset < 0 || offset > fb->fbsize)
+ return (-1);
+
+ return (((paddr_t)fb->fbaddr + offset) >> PGSHIFT);
+}
diff --git a/sys/arch/hp300/dev/grfreg.h b/sys/arch/hp300/dev/diofbreg.h
index eee0fddde89..321a42594aa 100644
--- a/sys/arch/hp300/dev/grfreg.h
+++ b/sys/arch/hp300/dev/diofbreg.h
@@ -1,8 +1,7 @@
-/* $OpenBSD: grfreg.h,v 1.4 2005/01/14 19:11:53 miod Exp $ */
-/* $NetBSD: grfreg.h,v 1.2 1994/10/26 07:24:09 cgd Exp $ */
+/* $OpenBSD: diofbreg.h,v 1.1 2005/01/14 22:39:25 miod Exp $ */
/*
- * Copyright (c) 1991 University of Utah.
+ * Copyright (c) 1988 University of Utah.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -60,32 +59,42 @@
#define GID_HYPERION 14
#ifndef _LOCORE
-typedef unsigned char grftype;
-
-struct grfreg {
- grftype gr_pad0,
- gr_id, /* +0x01 */
- gr_pad1[0x3],
- gr_fbwidth_h, /* +0x05 */
- gr_pad2,
- gr_fbwidth_l, /* +0x07 */
- gr_pad3,
- gr_fbheight_h, /* +0x09 */
- gr_pad4,
- gr_fbheight_l, /* +0x0B */
- gr_pad5,
- gr_dwidth_h, /* +0x0D */
- gr_pad6,
- gr_dwidth_l, /* +0x0F */
- gr_pad7,
- gr_dheight_h, /* +0x11 */
- gr_pad8,
- gr_dheight_l, /* +0x13 */
- gr_pad9,
- gr_id2, /* +0x15 */
- gr_pad10[0x47],
- gr_fbomsb, /* +0x5d */
- gr_pad11,
- gr_fbolsb; /* +0x5f */
+struct diofbreg {
+ u_int8_t :8;
+ u_int8_t id; /* +0x01 */
+ u_int8_t pad1[0x3];
+ u_int8_t fbwmsb; /* +0x05 */
+ u_int8_t :8;
+ u_int8_t fbwlsb; /* +0x07 */
+ u_int8_t :8;
+ u_int8_t fbhmsb; /* +0x09 */
+ u_int8_t :8;
+ u_int8_t fbhlsb; /* +0x0B */
+ u_int8_t :8;
+ u_int8_t dwmsb; /* +0x0D */
+ u_int8_t :8;
+ u_int8_t dwlsb; /* +0x0F */
+ u_int8_t :8;
+ u_int8_t dhmsb; /* +0x11 */
+ u_int8_t :8;
+ u_int8_t dhlsb; /* +0x13 */
+ u_int8_t :8;
+ u_int8_t id2; /* +0x15 */
+ u_int8_t pad2[0x47];
+ u_int8_t fbomsb; /* +0x5d */
+ u_int8_t :8;
+ u_int8_t fbolsb; /* +0x5f */
};
#endif
+
+/*
+ * Offsets into the display ROM that is part of the first 4K of each
+ * DIO display device.
+ */
+#define FONTROM 0x3b /* Offset of font information structure. */
+#define FONTADDR 0x4 /* Offset from FONTROM to font address. */
+#define FONTHEIGHT 0x0 /* Offset from font address to font height. */
+#define FONTWIDTH 0x2 /* Offset from font address to font width. */
+#define FONTDATA 0xA /* Offset from font address to font glyphs. */
+
+#define FBBASE(fb) ((volatile char *)(fb)->fbkva)
diff --git a/sys/arch/hp300/dev/diofbvar.h b/sys/arch/hp300/dev/diofbvar.h
new file mode 100644
index 00000000000..3cf1e88407d
--- /dev/null
+++ b/sys/arch/hp300/dev/diofbvar.h
@@ -0,0 +1,131 @@
+/* $OpenBSD: diofbvar.h,v 1.1 2005/01/14 22:39:25 miod Exp $ */
+
+/*
+ * Copyright (c) 2005, Miodrag Vallat
+ *
+ * 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.
+ *
+ * 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.
+ */
+/*
+ * 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. 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.
+ */
+
+/*
+ * Minimal frame buffer state structure.
+ */
+struct diofb {
+ caddr_t regkva; /* KVA of registers */
+ caddr_t fbkva; /* KVA of framebuffer */
+
+ caddr_t regaddr; /* control registers physaddr */
+ int regsize; /* control registers size */
+
+ caddr_t fbaddr; /* frame buffer physaddr */
+ int fbsize; /* frame buffer size */
+
+ u_int planes; /* number of planes */
+ u_int planemask; /* and related mask */
+
+ u_int fbwidth; /* frame buffer width */
+ u_int fbheight; /* frame buffer height */
+ u_int dwidth; /* displayed part width */
+ u_int dheight; /* displayed part height */
+
+ int curvisible;
+
+ /* font information */
+ u_int rows, cols; /* display size, in chars */
+ u_int cpl; /* chars per line off screen */
+ u_int ftheight, ftwidth, ftscale; /* font metrics */
+ u_int fontx, fonty; /* off screen font position */
+
+ /* cursor information */
+ u_int cursorx, cursory; /* cursor position */
+ u_int cblankx, cblanky; /* off screen cursor shape */
+
+ /* wsdisplay information */
+ struct wsscreen_descr wsd;
+ int nscreens;
+
+ /* blockmove routine */
+ void (*bmv)(struct diofb *, u_int16_t, u_int16_t,
+ u_int16_t, u_int16_t, u_int16_t, u_int16_t, int);
+};
+
+/* Replacement Rules (rops) */
+#define RR_CLEAR 0x0
+#define RR_COPY 0x3
+#define RR_XOR 0x6
+#define RR_COPYINVERTED 0xc
+
+#define getbyte(fb, disp) \
+ ((u_char) *((u_char *)(fb)->regkva + (disp)))
+
+#define getword(fb, offset) \
+ ((getbyte((fb), offset) << 8) | getbyte((fb), (offset) + 2))
+
+#define FONTMAXCHAR 128
+
+void diofb_end_attach(void *, struct wsdisplay_accessops *, struct diofb *,
+ int, int, const char *);
+int diofb_fbinquire(struct diofb *, int, struct diofbreg *, int);
+void diofb_fbsetup(struct diofb *);
+void diofb_fontunpack(struct diofb *);
+
+int diofb_alloc_attr(void *, int, int, int, long *);
+int diofb_alloc_screen(void *, const struct wsscreen_descr *, void **,
+ int *, int *, long *);
+void diofb_free_screen(void *, void *);
+paddr_t diofb_mmap(void *, off_t, int);
+int diofb_show_screen(void *, void *, int, void (*)(void *, int, int),
+ void *);
+
+extern struct diofb diofb_cn; /* struct diofb for console device */
diff --git a/sys/arch/hp300/dev/dvbox.c b/sys/arch/hp300/dev/dvbox.c
new file mode 100644
index 00000000000..01c08b3afce
--- /dev/null
+++ b/sys/arch/hp300/dev/dvbox.c
@@ -0,0 +1,518 @@
+/* $OpenBSD: dvbox.c,v 1.1 2005/01/14 22:39:25 miod Exp $ */
+
+/*
+ * Copyright (c) 2005, Miodrag Vallat
+ *
+ * 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.
+ *
+ * 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.
+ */
+/*
+ * 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.
+ *
+ * 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. 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: grf_dv.c 1.12 93/08/13$
+ *
+ * @(#)grf_dv.c 8.4 (Berkeley) 1/12/94
+ */
+
+/*
+ * Graphics routines for the DaVinci, HP98730/98731 Graphics system.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+#include <sys/proc.h>
+#include <sys/ioctl.h>
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+#include <machine/cpu.h>
+
+#include <hp300/dev/dioreg.h>
+#include <hp300/dev/diovar.h>
+#include <hp300/dev/diodevs.h>
+#include <hp300/dev/intiovar.h>
+
+#include <dev/cons.h>
+
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wsdisplayvar.h>
+
+#include <hp300/dev/diofbreg.h>
+#include <hp300/dev/diofbvar.h>
+#include <hp300/dev/dvboxreg.h>
+
+struct dvbox_softc {
+ struct device sc_dev;
+ struct diofb *sc_fb;
+ struct diofb sc_fb_store;
+ int sc_scode;
+};
+
+int dvbox_dio_match(struct device *, void *, void *);
+void dvbox_dio_attach(struct device *, struct device *, void *);
+int dvbox_intio_match(struct device *, void *, void *);
+void dvbox_intio_attach(struct device *, struct device *, void *);
+
+struct cfattach dvbox_dio_ca = {
+ sizeof(struct dvbox_softc), dvbox_dio_match, dvbox_dio_attach
+};
+
+struct cfattach dvbox_intio_ca = {
+ sizeof(struct dvbox_softc), dvbox_intio_match, dvbox_intio_attach
+};
+
+struct cfdriver dvbox_cd = {
+ NULL, "dvbox", DV_DULL
+};
+
+int dvbox_reset(struct diofb *, int, struct diofbreg *);
+void dvbox_setcolor(struct diofb *, u_int,
+ u_int8_t, u_int8_t, u_int8_t);
+void dvbox_windowmove(struct diofb *, u_int16_t, u_int16_t,
+ u_int16_t, u_int16_t, u_int16_t, u_int16_t, int);
+
+int dvbox_ioctl(void *, u_long, caddr_t, int, struct proc *);
+void dvbox_burner(void *, u_int, u_int);
+
+struct wsdisplay_accessops dvbox_accessops = {
+ dvbox_ioctl,
+ diofb_mmap,
+ diofb_alloc_screen,
+ diofb_free_screen,
+ diofb_show_screen,
+ NULL, /* load_font */
+ NULL, /* scrollback */
+ NULL, /* getchar */
+ dvbox_burner
+};
+
+/*
+ * Attachment glue
+ */
+
+int
+dvbox_intio_match(struct device *parent, void *match, void *aux)
+{
+ struct intio_attach_args *ia = aux;
+ struct diofbreg *fbr;
+
+ fbr = (struct diofbreg *)IIOV(GRFIADDR);
+
+ if (badaddr((caddr_t)fbr))
+ return (0);
+
+ if (fbr->id == GRFHWID && fbr->id2 == GID_DAVINCI) {
+ ia->ia_addr = (caddr_t)GRFIADDR;
+ return (1);
+ }
+
+ return (0);
+}
+
+void
+dvbox_intio_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct dvbox_softc *sc = (struct dvbox_softc *)self;
+ struct diofbreg *fbr;
+
+ fbr = (struct diofbreg *)IIOV(GRFIADDR);
+ sc->sc_scode = -1; /* XXX internal i/o */
+
+ if (sc->sc_scode == conscode) {
+ sc->sc_fb = &diofb_cn;
+ } else {
+ sc->sc_fb = &sc->sc_fb_store;
+ dvbox_reset(sc->sc_fb, sc->sc_scode, fbr);
+ }
+
+ diofb_end_attach(sc, &dvbox_accessops, sc->sc_fb,
+ sc->sc_scode == conscode, 4 /* XXX */, NULL);
+}
+
+int
+dvbox_dio_match(struct device *parent, void *match, void *aux)
+{
+ struct dio_attach_args *da = aux;
+
+ if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
+ da->da_secid == DIO_DEVICE_SECID_DAVINCI)
+ return (1);
+
+ return (0);
+}
+
+void
+dvbox_dio_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct dvbox_softc *sc = (struct dvbox_softc *)self;
+ struct dio_attach_args *da = aux;
+ struct diofbreg *fbr;
+
+ sc->sc_scode = da->da_scode;
+ if (sc->sc_scode == conscode) {
+ fbr = (struct diofbreg *)conaddr; /* already mapped */
+ sc->sc_fb = &diofb_cn;
+ } else {
+ sc->sc_fb = &sc->sc_fb_store;
+ fbr = (struct diofbreg *)
+ iomap(dio_scodetopa(sc->sc_scode), da->da_size);
+ if (fbr == NULL ||
+ dvbox_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) {
+ printf(": can't map framebuffer\n");
+ return;
+ }
+ }
+
+ diofb_end_attach(sc, &dvbox_accessops, sc->sc_fb,
+ sc->sc_scode == conscode, 4 /* XXX */, NULL);
+}
+
+/*
+ * Initialize hardware and display routines.
+ */
+int
+dvbox_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
+{
+ volatile struct dvboxfb *db = (struct dvboxfb *)fbr;
+ int rc;
+ int i;
+
+ if ((rc = diofb_fbinquire(fb, scode, fbr, 0x20000)) != 0)
+ return (rc);
+
+ fb->planes = 8;
+ fb->planemask = (1 << fb->planes) - 1;
+
+ /*
+ * Magic initialization code.
+ */
+
+ db->reset = 0x80;
+ DELAY(100);
+
+ db->interrupt = 0x04;
+ db->en_scan = 0x01;
+ db->fbwen = ~0;
+ db->opwen = ~0;
+ db->fold = 0x01; /* 8bpp */
+ db->drive = 0x01; /* use FB plane */
+ db->rep_rule = DVBOX_DUALROP(RR_COPY);
+ db->alt_rr = DVBOX_DUALROP(RR_COPY);
+ db->zrr = DVBOX_DUALROP(RR_COPY);
+
+ db->fbvenp = 0xFF; /* enable video */
+ db->dispen = 0x01; /* enable display */
+ db->fbvens = 0x0;
+ db->fv_trig = 0x01;
+ DELAY(100);
+ db->vdrive = 0x0;
+ db->zconfig = 0x0;
+
+ while (db->wbusy & 0x01)
+ DELAY(10);
+
+ db->cmapbank = 0;
+
+ db->red0 = 0;
+ db->red1 = 0;
+ db->green0 = 0;
+ db->green1 = 0;
+ db->blue0 = 0;
+ db->blue1 = 0;
+
+ db->panxh = 0;
+ db->panxl = 0;
+ db->panyh = 0;
+ db->panyl = 0;
+ db->zoom = 0;
+ db->cdwidth = 0x50;
+ db->chstart = 0x52;
+ db->cvwidth = 0x22;
+ db->pz_trig = 1;
+
+ /*
+ * 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.
+ */
+ db->interrupt = 0x04;
+ db->drive = 0x10;
+ db->rep_rule = DVBOX_DUALROP(RR_COPY);
+ db->opwen = 0x01;
+ db->fbwen = 0x0;
+ db->fold = 0x01;
+ db->vdrive = 0x0;
+ db->dispen = 0x01;
+
+ /*
+ * Video enable top overlay plane.
+ */
+ db->opvenp = 0x01;
+ db->opvens = 0x01;
+
+ /*
+ * Make sure that overlay planes override frame buffer planes.
+ */
+ db->ovly0p = 0x0;
+ db->ovly0s = 0x0;
+ db->ovly1p = 0x0;
+ db->ovly1s = 0x0;
+ db->fv_trig = 0x1;
+ DELAY(100);
+
+ fb->bmv = dvbox_windowmove;
+
+ diofb_fbsetup(fb);
+ diofb_fontunpack(fb);
+
+ /*
+ * Setup the overlay colormaps. Need to set the 0,1 (black/white)
+ * color for both banks.
+ */
+
+ db_waitbusy(db);
+ for (i = 0; i <= 1; i++) {
+ db->cmapbank = i;
+ db->rgb[0].red = 0x00;
+ db->rgb[0].green = 0x00;
+ db->rgb[0].blue = 0x00;
+ db->rgb[1].red = 0xFF;
+ db->rgb[1].green = 0xFF;
+ db->rgb[1].blue = 0xFF;
+ }
+ db->cmapbank = 0;
+ db_waitbusy(db);
+
+ return (0);
+}
+
+int
+dvbox_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
+{
+ struct diofb *fb = v;
+ struct wsdisplay_fbinfo *wdf;
+
+ switch (cmd) {
+ case WSDISPLAYIO_GTYPE:
+ *(u_int *)data = WSDISPLAY_TYPE_UNKNOWN;
+ break;
+ case WSDISPLAYIO_GINFO:
+ wdf = (void *)data;
+ wdf->height = fb->dheight;
+ wdf->width = fb->dwidth;
+ wdf->depth = fb->planes;
+ wdf->cmsize = 8; /* XXX 16 because of overlay? */
+ break;
+ case WSDISPLAYIO_LINEBYTES:
+ *(u_int *)data = (fb->fbwidth * fb->planes) >> 3;
+ break;
+ case WSDISPLAYIO_GETCMAP:
+ case WSDISPLAYIO_PUTCMAP:
+ /* XXX TBD */
+ break;
+ case WSDISPLAYIO_GVIDEO:
+ case WSDISPLAYIO_SVIDEO:
+ break;
+ default:
+ return (-1);
+ }
+
+ return (0);
+}
+
+void
+dvbox_burner(void *v, u_int on, u_int flags)
+{
+ struct diofb *fb = v;
+ volatile struct dvboxfb *db = (struct dvboxfb *)fb->regkva;
+
+ if (on)
+ db->dispen = 0x01;
+ else
+ db->dispen = 0x00;
+}
+
+void
+dvbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
+ u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int rop)
+{
+ volatile struct dvboxfb *db = (struct dvboxfb *)fb->regkva;
+
+ db_waitbusy(db);
+ db->rep_rule = DVBOX_DUALROP(rop);
+ db->source_y = sy;
+ db->source_x = sx;
+ db->dest_y = dy;
+ db->dest_x = dx;
+ db->wheight = cy;
+ db->wwidth = cx;
+ db->wmove = 1;
+}
+
+/*
+ * DaVinci console support
+ */
+
+int dvbox_console_scan(int, caddr_t, void *);
+cons_decl(dvbox);
+
+int
+dvbox_console_scan(int scode, caddr_t va, void *arg)
+{
+ struct diofbreg *fbr = (struct diofbreg *)va;
+ struct consdev *cp = arg;
+ u_char *dioiidev;
+ int force = 0, pri;
+
+ if (fbr->id != GRFHWID || fbr->id2 != GID_DAVINCI)
+ 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 >= DIOII_SCBASE) {
+ dioiidev = (u_char *)va;
+ return ((dioiidev[0x101] + 1) * 0x100000);
+ }
+ return (DIO_DEVSIZE);
+ }
+ return (0);
+}
+
+void
+dvboxcnprobe(struct consdev *cp)
+{
+ int maj;
+ caddr_t va;
+ struct diofbreg *fbr;
+ int force = 0;
+
+ /* Abort early if console is already forced. */
+ if (conforced)
+ return;
+
+ for (maj = 0; maj < nchrdev; maj++) {
+ if (cdevsw[maj].d_open == wsdisplayopen)
+ break;
+ }
+
+ if (maj == nchrdev)
+ return;
+
+ cp->cn_dev = makedev(maj, 0);
+ cp->cn_pri = CN_DEAD;
+
+ /* Look for "internal" framebuffer. */
+ va = (caddr_t)IIOV(GRFIADDR);
+ fbr = (struct diofbreg *)va;
+ if (!badaddr(va) &&
+ fbr->id == GRFHWID && fbr->id2 == GID_DAVINCI) {
+ cp->cn_pri = CN_INTERNAL;
+
+#ifdef CONSCODE
+ if (CONSCODE == -1) {
+ 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, HP300_BUS_DIO);
+}
+
+void
+dvboxcninit(struct consdev *cp)
+{
+ long defattr;
+
+ dvbox_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
+ diofb_alloc_attr(NULL, 0, 0, 0, &defattr);
+ wsdisplay_cnattach(&diofb_cn.wsd, &diofb_cn, 0, 0, defattr);
+}
diff --git a/sys/arch/hp300/dev/dvboxreg.h b/sys/arch/hp300/dev/dvboxreg.h
new file mode 100644
index 00000000000..038958a9319
--- /dev/null
+++ b/sys/arch/hp300/dev/dvboxreg.h
@@ -0,0 +1,189 @@
+/* $OpenBSD: dvboxreg.h,v 1.1 2005/01/14 22:39:25 miod Exp $ */
+/* $NetBSD: grf_dvreg.h,v 1.5 1994/10/26 07:23:50 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. 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: grf_dvreg.h 1.5 92/01/21$
+ *
+ * @(#)grf_dvreg.h 8.1 (Berkeley) 6/10/93
+ */
+
+#define db_waitbusy(regaddr) \
+do { \
+ while (((volatile struct dvboxfb *)(regaddr))->wbusy != 0 || \
+ ((volatile struct dvboxfb *)(regaddr))->as_busy != 0) \
+ DELAY(10); \
+} while (0)
+
+#define DVBOX_DUALROP(rop) ((rop) << 4 | (rop))
+
+struct rgb {
+ u_int8_t :8, :8, :8;
+ u_int8_t red;
+ u_int8_t :8, :8, :8;
+ u_int8_t green;
+ u_int8_t :8, :8, :8;
+ u_int8_t blue;
+};
+
+struct dvboxfb {
+ u_int8_t :8;
+ u_int8_t reset; /* reset register 0x01 */
+ u_int8_t fb_address; /* frame buffer address 0x02 */
+ u_int8_t interrupt; /* interrupt register 0x03 */
+ u_int8_t :8;
+ u_int8_t fbwmsb; /* frame buffer width MSB 0x05 */
+ u_int8_t :8;
+ u_int8_t fbwlsb; /* frame buffer width MSB 0x07 */
+ u_int8_t :8;
+ u_int8_t fbhmsb; /* frame buffer height MSB 0x09 */
+ u_int8_t :8;
+ u_int8_t fbhlsb; /* frame buffer height MSB 0x0b */
+ u_int8_t :8;
+ u_int8_t dwmsb; /* display width MSB 0x0d */
+ u_int8_t :8;
+ u_int8_t dwlsb; /* display width MSB 0x0f */
+ u_int8_t :8;
+ u_int8_t dhmsb; /* display height MSB 0x11 */
+ u_int8_t :8;
+ u_int8_t dhlsb; /* display height MSB 0x13 */
+ u_int8_t :8;
+ u_int8_t fbid; /* frame buffer id 0x15 */
+ u_int8_t f1[0x47];
+ u_int8_t fbomsb; /* frame buffer offset MSB 0x5d */
+ u_int8_t :8;
+ u_int8_t fbolsb; /* frame buffer offset LSB 0x5f */
+ u_int8_t f2[16359];
+ u_int8_t wbusy; /* Window move in progress 0x4047 */
+ u_int8_t f3[0x405b-0x4047-1];
+ u_int8_t as_busy; /* Scan accessing frame buf. 0x405B */
+ u_int8_t f4[0x4090-0x405b-1];
+ u_int32_t fbwen; /* Frame buffer write enable 0x4090 */
+ u_int8_t f5[0x409f-0x4090-4];
+ u_int8_t wmove; /* Initiate window move. 0x409F */
+ u_int8_t f6[0x40b3-0x409f-1];
+ u_int8_t fold; /* Byte/longword per pixel 0x40B3 */
+ u_int8_t f7[0x40b7-0x40b3-1];
+ u_int8_t opwen; /* Overlay plane write enable 0x40B7 */
+ u_int8_t f8[0x40bf-0x40b7-1];
+ u_int8_t drive; /* Select FB vs. Overlay. 0x40BF */
+
+ u_int8_t f8a[0x40cb-0x40bf-1];
+ u_int8_t zconfig; /* Z buffer configuration 0x40CB */
+ u_int8_t f8b[0x40cf-0x40cb-1];
+ u_int8_t alt_rr; /* Alternate replacement rule 0x40CF */
+ u_int8_t f8c[0x40d3-0x40cf-1];
+ u_int8_t zrr; /* Z replacement rule 0x40D3 */
+
+ u_int8_t f9[0x40d7-0x40d3-1];
+ u_int8_t en_scan; /* Enable scan DTACK. 0x40D7 */
+ u_int8_t f10[0x40ef-0x40d7-1];
+ u_int8_t rep_rule; /* Replacement rule 0x40EF */
+ u_int8_t f11[0x40f2-0x40ef-1];
+ u_int16_t source_x; /* Window source X origin 0x40F2 */
+ u_int8_t f12[0x40f6-0x40f2-2];
+ u_int16_t source_y; /* Window source Y origin 0x40F6 */
+ u_int8_t f13[0x40fa-0x40f6-2];
+ u_int16_t dest_x; /* Window dest X origin 0x40FA */
+ u_int8_t f14[0x40fe -0x40fa-2];
+ u_int16_t dest_y; /* Window dest Y origin 0x40FE */
+ u_int8_t f15[0x4102-0x40fe -2];
+ u_int16_t wwidth; /* Window width 0x4102 */
+ u_int8_t f16[0x4106-0x4102-2];
+ u_int16_t wheight; /* Window height 0x4106 */
+ u_int8_t f17[0x6003-0x4106-2];
+ u_int8_t cmapbank; /* Bank select (0 or 1) 0x6003 */
+ u_int8_t f18[0x6007-0x6003-1];
+ u_int8_t dispen; /* Display enable 0x6007 */
+
+ u_int8_t f18a[0x600B-0x6007-1];
+ u_int8_t fbvenp; /* Frame buffer video enable 0x600B */
+ u_int8_t f18b[0x6017-0x600B-1];
+ u_int8_t fbvens; /* fbvenp blink counterpart 0x6017 */
+
+ u_int8_t f19[0x6023-0x6017-1];
+ u_int8_t vdrive; /* Video display mode 0x6023 */
+ u_int8_t f20[0x6083-0x6023-1];
+ u_int8_t panxh; /* Pan display in X (high) 0x6083 */
+ u_int8_t f21[0x6087-0x6083-1];
+ u_int8_t panxl; /* Pan display in X (low) 0x6087 */
+ u_int8_t f22[0x608b-0x6087-1];
+ u_int8_t panyh; /* Pan display in Y (high) 0x608B */
+ u_int8_t f23[0x608f-0x608b-1];
+ u_int8_t panyl; /* Pan display in Y (low) 0x608F */
+ u_int8_t f24[0x6093-0x608f-1];
+ u_int8_t zoom; /* Zoom factor 0x6093 */
+ u_int8_t f25[0x6097-0x6093-1];
+ u_int8_t pz_trig; /* Pan & zoom trigger 0x6097 */
+ u_int8_t f26[0x609b-0x6097-1];
+ u_int8_t ovly0p; /* Overlay 0 primary map 0x609B */
+ u_int8_t f27[0x609f-0x609b-1];
+ u_int8_t ovly1p; /* Overlay 1 primary map 0x609F */
+ u_int8_t f28[0x60a3-0x609f-1];
+ u_int8_t ovly0s; /* Overlay 0 secondary map 0x60A3 */
+ u_int8_t f29[0x60a7-0x60a3-1];
+ u_int8_t ovly1s; /* Overlay 1 secondary map 0x60A7 */
+ u_int8_t f30[0x60ab-0x60a7-1];
+ u_int8_t opvenp; /* Overlay video enable 0x60AB */
+ u_int8_t f31[0x60af-0x60ab-1];
+ u_int8_t opvens; /* Overlay blink enable 0x60AF */
+ u_int8_t f32[0x60b3-0x60af-1];
+ u_int8_t fv_trig; /* Trigger control registers 0x60B3 */
+ u_int8_t f33[0x60b7-0x60b3-1];
+ u_int8_t cdwidth; /* Iris cdwidth timing reg. 0x60B7 */
+ u_int8_t f34[0x60bb-0x60b7-1];
+ u_int8_t chstart; /* Iris chstart timing reg. 0x60BB */
+ u_int8_t f35[0x60bf-0x60bb-1];
+ u_int8_t cvwidth; /* Iris cvwidth timing reg. 0x60BF */
+ u_int8_t f36[0x6100-0x60bf-1];
+ struct rgb rgb[8]; /* overlay color map */
+ u_int8_t f37[0x6403-0x6100-sizeof(struct rgb)*8];
+ u_int8_t red0;
+ u_int8_t f38[0x6803-0x6403-1];
+ u_int8_t green0;
+ u_int8_t f39[0x6c03-0x6803-1];
+ u_int8_t blue0;
+ u_int8_t f40[0x7403-0x6c03-1];
+ u_int8_t red1;
+ u_int8_t f41[0x7803-0x7403-1];
+ u_int8_t green1;
+ u_int8_t f42[0x7c03-0x7803-1];
+ u_int8_t blue1;
+ u_int8_t f43[0x8012-0x7c03-1];
+ u_int16_t status1; /* Master Status register 0x8012 */
+ u_int8_t f44[0xC226-0x8012-2];
+ u_int16_t trans; /* Transparency 0xC226 */
+ u_int8_t f45[0xC23E -0xC226-2];
+ u_int16_t pstop; /* Pace value control 0xc23e */
+};
diff --git a/sys/arch/hp300/dev/gbox.c b/sys/arch/hp300/dev/gbox.c
new file mode 100644
index 00000000000..823954c82e1
--- /dev/null
+++ b/sys/arch/hp300/dev/gbox.c
@@ -0,0 +1,509 @@
+/* $OpenBSD: gbox.c,v 1.1 2005/01/14 22:39:25 miod Exp $ */
+
+/*
+ * Copyright (c) 2005, Miodrag Vallat
+ *
+ * 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.
+ *
+ * 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.
+ */
+/*
+ * 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.
+ *
+ * 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. 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: grf_gb.c 1.18 93/08/13$
+ *
+ * @(#)grf_gb.c 8.4 (Berkeley) 1/12/94
+ */
+
+/*
+ * Graphics routines for the Gatorbox.
+ *
+ * Note: In the context of this system, "gator" and "gatorbox" both refer to
+ * HP 987x0 graphics systems. "Gator" is not used for high res mono.
+ * (as in 9837 Gator systems)
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+#include <sys/proc.h>
+#include <sys/ioctl.h>
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+#include <machine/cpu.h>
+
+#include <hp300/dev/dioreg.h>
+#include <hp300/dev/diovar.h>
+#include <hp300/dev/diodevs.h>
+#include <hp300/dev/intiovar.h>
+
+#include <dev/cons.h>
+
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wsdisplayvar.h>
+
+#include <hp300/dev/diofbreg.h>
+#include <hp300/dev/diofbvar.h>
+#include <hp300/dev/gboxreg.h>
+
+struct gbox_softc {
+ struct device sc_dev;
+ struct diofb *sc_fb;
+ struct diofb sc_fb_store;
+ int sc_scode;
+};
+
+int gbox_dio_match(struct device *, void *, void *);
+void gbox_dio_attach(struct device *, struct device *, void *);
+int gbox_intio_match(struct device *, void *, void *);
+void gbox_intio_attach(struct device *, struct device *, void *);
+
+struct cfattach gbox_dio_ca = {
+ sizeof(struct gbox_softc), gbox_dio_match, gbox_dio_attach
+};
+
+struct cfattach gbox_intio_ca = {
+ sizeof(struct gbox_softc), gbox_intio_match, gbox_intio_attach
+};
+
+struct cfdriver gbox_cd = {
+ NULL, "gbox", DV_DULL
+};
+
+int gbox_reset(struct diofb *, int, struct diofbreg *);
+void gbox_windowmove(struct diofb *, u_int16_t, u_int16_t,
+ u_int16_t, u_int16_t, u_int16_t, u_int16_t, int);
+
+int gbox_ioctl(void *, u_long, caddr_t, int, struct proc *);
+void gbox_burner(void *, u_int, u_int);
+
+struct wsdisplay_accessops gbox_accessops = {
+ gbox_ioctl,
+ diofb_mmap,
+ diofb_alloc_screen,
+ diofb_free_screen,
+ diofb_show_screen,
+ NULL, /* load_font */
+ NULL, /* scrollback */
+ NULL, /* getchar */
+ gbox_burner
+};
+
+/*
+ * Attachment glue
+ */
+int
+gbox_intio_match(struct device *parent, void *match, void *aux)
+{
+ struct intio_attach_args *ia = aux;
+ struct diofbreg *fbr;
+
+ fbr = (struct diofbreg *)IIOV(GRFIADDR);
+
+ if (badaddr((caddr_t)fbr))
+ return (0);
+
+ if (fbr->id == GRFHWID && fbr->id2 == GID_GATORBOX) {
+ ia->ia_addr = (caddr_t)GRFIADDR;
+ return (1);
+ }
+
+ return (0);
+}
+
+void
+gbox_intio_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct gbox_softc *sc = (struct gbox_softc *)self;
+ struct diofbreg *fbr;
+
+ fbr = (struct diofbreg *)IIOV(GRFIADDR);
+ sc->sc_scode = -1; /* XXX internal i/o */
+
+ if (sc->sc_scode == conscode) {
+ sc->sc_fb = &diofb_cn;
+ } else {
+ sc->sc_fb = &sc->sc_fb_store;
+ gbox_reset(sc->sc_fb, sc->sc_scode, fbr);
+ }
+
+ diofb_end_attach(sc, &gbox_accessops, sc->sc_fb,
+ sc->sc_scode == conscode, 0, NULL);
+}
+
+int
+gbox_dio_match(struct device *parent, void *match, void *aux)
+{
+ struct dio_attach_args *da = aux;
+
+ /* We can not appear in DIO-II space */
+ if (DIO_ISDIOII(da->da_scode))
+ return (0);
+
+ if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
+ da->da_secid == DIO_DEVICE_SECID_GATORBOX)
+ return (1);
+
+ return (0);
+}
+
+void
+gbox_dio_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct gbox_softc *sc = (struct gbox_softc *)self;
+ struct dio_attach_args *da = aux;
+ struct diofbreg * fbr;
+
+ sc->sc_scode = da->da_scode;
+ if (sc->sc_scode == conscode) {
+ fbr = (struct diofbreg *)conaddr; /* already mapped */
+ sc->sc_fb = &diofb_cn;
+ } else {
+ sc->sc_fb = &sc->sc_fb_store;
+ fbr = (struct diofbreg *)
+ iomap(dio_scodetopa(sc->sc_scode), da->da_size);
+ if (fbr == NULL ||
+ gbox_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) {
+ printf(": can't map framebuffer\n");
+ return;
+ }
+ }
+
+ diofb_end_attach(sc, &gbox_accessops, sc->sc_fb,
+ sc->sc_scode == conscode, 0, NULL);
+}
+
+/*
+ * Initialize hardware and display routines.
+ */
+
+const u_int8_t crtc_init_data[] = {
+ 0x29, 0x20, 0x23, 0x04, 0x30, 0x0b, 0x30,
+ 0x30, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00
+};
+
+int
+gbox_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
+{
+ volatile struct gboxfb *gb = (struct gboxfb *)fbr;
+ u_int8_t *fbp, save;
+ int rc;
+ int i;
+
+ /* XXX don't trust hardware, force defaults */
+ fb->fbwidth = 1024;
+ fb->fbheight = 1024;
+ fb->dwidth = 1024;
+ fb->dheight = 768;
+ if ((rc = diofb_fbinquire(fb, scode, fbr, 0x10000)) != 0)
+ return (rc);
+
+ /*
+ * The minimal info here is from the Gatorbox X driver.
+ */
+ gb->write_protect = 0x0;
+ gb->interrupt = 0x4;
+ gb->rep_rule = RR_COPY;
+ gb->blink1 = 0xff;
+ gb->blink2 = 0xff;
+
+ /*
+ * Program the 6845.
+ */
+ for (i = 0; i < sizeof(crtc_init_data); i++) {
+ gb->crtc_address = i;
+ gb->crtc_data = crtc_init_data[i];
+ }
+
+ /*
+ * 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.
+ */
+ fbp = (u_int8_t *)fb->fbkva;
+ save = *fbp;
+ *fbp = 0x0ff;
+ fb->planemask = *fbp;
+ *fbp = save;
+ for (fb->planes = 1; fb->planemask >= (1 << fb->planes);
+ fb->planes++);
+
+ /*
+ * 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.
+ */
+ gb->creg_select = 0x00;
+ gb->cmap_red = 0x00;
+ gb->cmap_grn = 0x00;
+ gb->cmap_blu = 0x00;
+ gb->cmap_write = 0x00;
+ gbcm_waitbusy(gb);
+
+ gb->creg_select = 0x01;
+ gb->cmap_red = 0xFF;
+ gb->cmap_grn = 0xFF;
+ gb->cmap_blu = 0xFF;
+ gb->cmap_write = 0x01;
+ gbcm_waitbusy(gb);
+
+ /* XXX is the cursors entry necessary??? */
+ gb->creg_select = 0xFF;
+ gb->cmap_red = 0xFF;
+ gb->cmap_grn = 0xFF;
+ gb->cmap_blu = 0xFF;
+ gb->cmap_write = 0x01;
+ gbcm_waitbusy(gb);
+
+ fb->bmv = gbox_windowmove;
+ diofb_fbsetup(fb);
+ diofb_fontunpack(fb);
+
+ tile_mover_waitbusy(gb);
+
+ /*
+ * Enable display.
+ */
+ gb->sec_interrupt = 0x01;
+
+ return (0);
+}
+
+int
+gbox_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
+{
+ struct diofb *fb = v;
+ struct wsdisplay_fbinfo *wdf;
+
+ switch (cmd) {
+ case WSDISPLAYIO_GTYPE:
+ *(u_int *)data = WSDISPLAY_TYPE_UNKNOWN;
+ break;
+ case WSDISPLAYIO_GINFO:
+ wdf = (void *)data;
+ wdf->height = fb->dheight;
+ wdf->width = fb->dwidth;
+ wdf->depth = fb->planes;
+ wdf->cmsize = 1 << fb->planes;
+ break;
+ case WSDISPLAYIO_LINEBYTES:
+ *(u_int *)data = (fb->fbwidth * fb->planes) >> 3;
+ break;
+ case WSDISPLAYIO_GETCMAP:
+ case WSDISPLAYIO_PUTCMAP:
+ /* XXX TBD */
+ break;
+ case WSDISPLAYIO_GVIDEO:
+ case WSDISPLAYIO_SVIDEO:
+ break;
+ default:
+ return (-1);
+ }
+
+ return (0);
+}
+
+void
+gbox_burner(void *v, u_int on, u_int flags)
+{
+ struct diofb *fb = v;
+ volatile struct gboxfb *gb = (struct gboxfb *)fb->regkva;
+
+ if (on)
+ gb->sec_interrupt = 0x01;
+ else
+ gb->sec_interrupt = 0x00;
+}
+
+void
+gbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
+ u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int rop)
+{
+ volatile struct gboxfb *gb = (struct gboxfb *)fb->regkva;
+ int src, dest;
+
+ src = (sy * 1024) + sx; /* upper left corner in pixels */
+ dest = (dy * 1024) + dx;
+
+ tile_mover_waitbusy(gb);
+ gb->width = -(cx / 4);
+ gb->height = -(cy / 4);
+ if (src < dest)
+ gb->rep_rule = MOVE_DOWN_RIGHT | rop;
+ else {
+ gb->rep_rule = MOVE_UP_LEFT | rop;
+ /*
+ * Adjust to top of lower right tile of the block.
+ */
+ src = src + ((cy - 4) * 1024) + (cx - 4);
+ dest= dest + ((cy - 4) * 1024) + (cx - 4);
+ }
+ FBBASE(fb)[dest] = FBBASE(fb)[src];
+}
+
+/*
+ * Gatorbox console support
+ */
+
+int gbox_console_scan(int, caddr_t, void *);
+cons_decl(gbox);
+
+int
+gbox_console_scan(int scode, caddr_t va, void *arg)
+{
+ struct diofbreg *fbr = (struct diofbreg *)va;
+ struct consdev *cp = arg;
+ u_char *dioiidev;
+ int force = 0, pri;
+
+ if (fbr->id != GRFHWID || fbr->id2 == GID_GATORBOX)
+ 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 >= DIOII_SCBASE) {
+ dioiidev = (u_char *)va;
+ return ((dioiidev[0x101] + 1) * 0x100000);
+ }
+ return (DIO_DEVSIZE);
+ }
+ return (0);
+}
+
+void
+gboxcnprobe(struct consdev *cp)
+{
+ int maj;
+ caddr_t va;
+ struct diofbreg *fbr;
+ int force = 0;
+
+ /* Abort early if console already forced. */
+ if (conforced)
+ return;
+
+ for (maj = 0; maj < nchrdev; maj++) {
+ if (cdevsw[maj].d_open == wsdisplayopen)
+ break;
+ }
+
+ if (maj == nchrdev)
+ return;
+
+ cp->cn_dev = makedev(maj, 0);
+ cp->cn_pri = CN_DEAD;
+
+ /* Look for "internal" framebuffer. */
+ va = (caddr_t)IIOV(GRFIADDR);
+ fbr = (struct diofbreg *)va;
+ if (!badaddr(va) &&
+ fbr->id == GRFHWID && fbr->id2 == GID_GATORBOX) {
+ cp->cn_pri = CN_INTERNAL;
+
+#ifdef CONSCODE
+ if (CONSCODE == -1) {
+ 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, HP300_BUS_DIO);
+}
+
+void
+gboxcninit(cp)
+ struct consdev *cp;
+{
+ long defattr;
+
+ gbox_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
+ diofb_alloc_attr(NULL, 0, 0, 0, &defattr);
+ wsdisplay_cnattach(&diofb_cn.wsd, &diofb_cn, 0, 0, defattr);
+}
diff --git a/sys/arch/hp300/dev/gboxreg.h b/sys/arch/hp300/dev/gboxreg.h
new file mode 100644
index 00000000000..f1d35c5fb24
--- /dev/null
+++ b/sys/arch/hp300/dev/gboxreg.h
@@ -0,0 +1,130 @@
+/* $OpenBSD: gboxreg.h,v 1.1 2005/01/14 22:39:25 miod Exp $ */
+/* $NetBSD: grf_gbreg.h,v 1.4 1994/10/26 07:23:53 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. 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: grf_gbreg.h 1.11 92/01/21$
+ *
+ * @(#)grf_gbreg.h 8.1 (Berkeley) 6/10/93
+ */
+
+/*
+ * Gatorbox driver regs
+ */
+
+#define TILER_ENABLE 0x80
+#define LINE_MOVER_ENABLE 0x80
+#define UP_LEFT 0x00
+#define DOWN_RIGHT 0x40
+#define MOVE_UP_LEFT (TILER_ENABLE | UP_LEFT)
+#define MOVE_DOWN_RIGHT (TILER_ENABLE | DOWN_RIGHT)
+
+#define tile_mover_waitbusy(regaddr) \
+do { \
+ while (((struct gboxfb *)(regaddr))->sec_interrupt & 0x10) \
+ DELAY(1); \
+} while (0)
+
+#define line_mover_waitbusy(regaddr) \
+do { \
+ while ((((struct gboxfb *)(regaddr))->status & 0x80) == 0) \
+ DELAY(1); \
+} while (0)
+
+#define gbcm_waitbusy(regaddr) \
+do { \
+ while (((struct gboxfb *)(regaddr))->cmap_busy != 0xff) \
+ DELAY(1); \
+} while (0)
+
+struct gboxfb {
+ u_int8_t :8;
+ u_int8_t reset; /* reset register 0x01 */
+ u_int8_t sec_interrupt; /* Secondary interrupt register 0x03 */
+ u_int8_t interrupt; /* interrupt register 0x03 */
+ u_int8_t :8;
+ u_int8_t fbwmsb; /* frame buffer width MSB 0x05 */
+ u_int8_t :8;
+ u_int8_t fbwlsb; /* frame buffer width MSB 0x07 */
+ u_int8_t :8;
+ u_int8_t fbhmsb; /* frame buffer height MSB 0x09 */
+ u_int8_t :8;
+ u_int8_t fbhlsb; /* frame buffer height MSB 0x0b */
+ u_int8_t :8;
+ u_int8_t dwmsb; /* display width MSB 0x0d */
+ u_int8_t :8;
+ u_int8_t dwlsb; /* display width MSB 0x0f */
+ u_int8_t :8;
+ u_int8_t dhmsb; /* display height MSB 0x11 */
+ u_int8_t :8;
+ u_int8_t dhlsb; /* display height MSB 0x13 */
+ u_int8_t :8;
+ u_int8_t fbid; /* Scondary frame buffer id 0x15 */
+ u_int8_t f1[0x5d-0x15-1];
+ u_int8_t fbomsb; /* frame buffer offset MSB 0x5d */
+ u_int8_t :8;
+ u_int8_t fbolsb; /* frame buffer offset LSB 0x5f */
+ u_int8_t f2[0x4000-0x5f-1];
+ u_int8_t crtc_address; /* CTR controller address reg 0x4000 */
+ u_int8_t status; /* Status register 0x4001 */
+ u_int8_t crtc_data; /* CTR controller data reg 0x4002 */
+ u_int8_t f3[6];
+ u_int8_t line_mover_rep_rule; /* Line move rep rule */
+ u_int8_t :8, :8;
+ u_int8_t line_mover_width; /* Line move width */
+ u_int8_t f4[0xff3];
+ u_int8_t width; /* width in tiles 0x5001 */
+ u_int8_t :8;
+ u_int8_t height; /* height in tiles 0x5003 */
+ u_int8_t f5[3];
+ u_int8_t rep_rule; /* replacement rule 0x5007 */
+ u_int8_t f6[0x6001-0x5007-1];
+ u_int8_t blink1; /* blink 1 0x6001 */
+ u_int8_t f7[3];
+ u_int8_t blink2; /* blink 2 0x6005 */
+ u_int8_t f8[3];
+ u_int8_t write_protect; /* write protect 0x6009 */
+ u_int8_t f9[0x6803-0x6009-1];
+ u_int8_t cmap_busy; /* color map busy 0x6803 */
+ u_int8_t f10[0x68b9-0x6803-1];
+ u_int8_t creg_select; /* color map register select 0x68b8 */
+ u_int8_t f11[0x68f1-0x68b9-1];
+ u_int8_t cmap_write; /* color map write trigger 0x68f1 */
+ u_int8_t f12[0x69b3-0x68f1-1];
+ u_int8_t cmap_red; /* red value register 0x69b3 */
+ u_int8_t :8;
+ u_int8_t cmap_grn; /* green value register 0x69b5 */
+ u_int8_t :8;
+ u_int8_t cmap_blu; /* blue value register 0x69b6 */
+};
diff --git a/sys/arch/hp300/dev/grf.c b/sys/arch/hp300/dev/grf.c
deleted file mode 100644
index eb204fd152d..00000000000
--- a/sys/arch/hp300/dev/grf.c
+++ /dev/null
@@ -1,799 +0,0 @@
-/* $OpenBSD: grf.c,v 1.23 2003/09/23 16:51:11 millert Exp $ */
-/* $NetBSD: grf.c,v 1.30 1998/08/20 08:33:41 kleink 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. 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: grf.c 1.36 93/08/13$
- *
- * @(#)grf.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics display driver for HP 300/400/700/800 machines.
- * This is the hardware-independent portion of the driver.
- * Hardware access is through the machine dependent grf switch routines.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <sys/malloc.h>
-#include <sys/mman.h>
-#include <sys/poll.h>
-#include <sys/proc.h>
-#include <sys/resourcevar.h>
-#include <sys/vnode.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/grfioctl.h>
-#include <hp300/dev/grfvar.h>
-#include <hp300/dev/grfreg.h>
-
-#ifdef COMPAT_HPUX
-#include <compat/hpux/hpux.h>
-extern struct emul emul_hpux;
-#endif
-
-#include <uvm/uvm.h>
-
-#include <miscfs/specfs/specdev.h>
-
-#include "ite.h"
-#if NITE > 0
-#include <hp300/dev/itevar.h>
-#else
-#define iteon(u,f) 0 /* noramlly returns int */
-#define iteoff(u,f)
-#endif /* NITE > 0 */
-
-/* prototypes for the devsw entry points */
-cdev_decl(grf);
-
-int grfmatch(struct device *, void *, void *);
-void grfattach(struct device *, struct device *, void *);
-
-struct cfattach grf_ca = {
- sizeof(struct grf_softc), grfmatch, grfattach
-};
-
-struct cfdriver grf_cd = {
- NULL, "grf", DV_DULL
-};
-
-int grfprint(void *, const char *);
-
-/*
- * Frambuffer state information, statically allocated for benefit
- * of the console.
- */
-struct grf_data grf_cn;
-
-#ifdef DEBUG
-int grfdebug = 0;
-#define GDB_DEVNO 0x01
-#define GDB_MMAP 0x02
-#define GDB_IOMAP 0x04
-#define GDB_LOCK 0x08
-#endif
-
-int
-grfmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
-
- return (1);
-}
-
-void
-grfattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct grf_softc *sc = (struct grf_softc *)self;
- struct grfdev_attach_args *ga = aux;
-
- printf("\n");
-
- sc->sc_data = ga->ga_data;
- sc->sc_scode = ga->ga_scode; /* XXX */
-
- /* Attach an ITE. */
- (void)config_found(self, aux, grfprint);
-}
-
-int
-grfprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
-
- /* Only ITEs can attach to GRFs, easy... */
- if (pnp)
- printf("ite at %s", pnp);
-
- return (UNCONF);
-}
-
-/*ARGSUSED*/
-int
-grfopen(dev, flags, mode, p)
- dev_t dev;
- int flags, mode;
- struct proc *p;
-{
- int unit = GRFUNIT(dev);
- struct grf_softc *sc;
- struct grf_data *gp;
- int error = 0;
-
- if (unit >= grf_cd.cd_ndevs ||
- (sc = grf_cd.cd_devs[unit]) == NULL)
- return (ENXIO);
-
- 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 (p->p_emul == &emul_hpux) {
- if (gp->g_flags & GF_BSDOPEN)
- return(EBUSY);
- else
- gp->g_flags |= GF_HPUXOPEN;
- } else {
- if (gp->g_flags & GF_HPUXOPEN)
- return(EBUSY);
- else
- gp->g_flags |= GF_BSDOPEN;
- }
-#endif
- /*
- * First open.
- * XXX: always put in graphics mode.
- */
- error = 0;
- if ((gp->g_flags & GF_OPEN) == 0) {
- gp->g_flags |= GF_OPEN;
- error = grfon(dev);
- }
- return(error);
-}
-
-/*ARGSUSED*/
-int
-grfclose(dev, flags, mode, p)
- dev_t dev;
- int flags, mode;
- struct proc *p;
-{
- int unit = GRFUNIT(dev);
- struct grf_softc *sc;
- struct grf_data *gp;
-
- sc = grf_cd.cd_devs[unit];
-
- gp = sc->sc_data;
-
- if ((gp->g_flags & GF_ALIVE) == 0)
- return (ENXIO);
-
- (void) grfoff(dev);
-#ifdef COMPAT_HPUX
- (void) grfunlock(gp);
-#endif
- gp->g_flags &= GF_ALIVE;
- return(0);
-}
-
-/*ARGSUSED*/
-int
-grfioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- int flag;
- caddr_t data;
- struct proc *p;
-{
- struct grf_softc *sc;
- struct grf_data *gp;
- int error, unit = GRFUNIT(dev);
-
- sc = grf_cd.cd_devs[unit];
-
- gp = sc->sc_data;
-
- if ((gp->g_flags & GF_ALIVE) == 0)
- return (ENXIO);
-
-#ifdef COMPAT_HPUX
- if (p->p_emul == &emul_hpux)
- return(hpuxgrfioctl(dev, cmd, data, flag, p));
-#endif
- error = 0;
- switch (cmd) {
-
- case GRFIOCGINFO:
- bcopy((caddr_t)&gp->g_display, data, sizeof(struct grfinfo));
- break;
-
- case GRFIOCON:
- error = grfon(dev);
- break;
-
- case GRFIOCOFF:
- error = grfoff(dev);
- break;
-
- case GRFIOCMAP:
- error = grfmap(dev, (caddr_t *)data, p);
- break;
-
- case GRFIOCUNMAP:
- error = grfunmap(dev, *(caddr_t *)data, p);
- break;
-
- default:
- error = EINVAL;
- break;
-
- }
- return(error);
-}
-
-/*ARGSUSED*/
-int
-grfpoll(dev, events, p)
- dev_t dev;
- int events;
- struct proc *p;
-{
- return (events & (POLLOUT | POLLWRNORM));
-}
-
-/*ARGSUSED*/
-paddr_t
-grfmmap(dev, off, prot)
- dev_t dev;
- off_t off;
- int prot;
-{
- struct grf_softc *sc = grf_cd.cd_devs[GRFUNIT(dev)];
-
- return (grfaddr(sc, off));
-}
-
-int
-grfon(dev)
- dev_t dev; /* XXX */
-{
- int unit = GRFUNIT(dev);
- struct grf_softc *sc;
- struct grf_data *gp;
-
- sc = grf_cd.cd_devs[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(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; /* XXX */
-{
- int unit = GRFUNIT(dev);
- struct grf_softc *sc;
- struct grf_data *gp;
- int error;
-
- sc = grf_cd.cd_devs[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 */
- (void) iteon(sc->sc_ite->sc_data, 2);
- return(error);
-}
-
-int
-grfaddr(sc, off)
- struct grf_softc *sc;
- int off;
-{
- struct grf_data *gp= sc->sc_data;
- struct grfinfo *gi = &gp->g_display;
-
- /* control registers */
- if (off >= 0 && off < gi->gd_regsize)
- return(((u_int)gi->gd_regaddr + off) >> PGSHIFT);
-
- /* frame buffer */
- if (off >= gi->gd_regsize && off < gi->gd_regsize+gi->gd_fbsize) {
- off -= gi->gd_regsize;
- return(((u_int)gi->gd_fbaddr + off) >> PGSHIFT);
- }
- /* bogus */
- return(-1);
-}
-
-/*
- * HP-UX compatibility routines
- */
-#ifdef COMPAT_HPUX
-
-/*ARGSUSED*/
-int
-hpuxgrfioctl(dev, cmd, data, flag, p)
- dev_t dev;
- int cmd, flag;
- caddr_t data;
- struct proc *p;
-{
- struct grf_softc *sc = grf_cd.cd_devs[GRFUNIT(dev)];
- struct grf_data *gp = sc->sc_data;
- int error;
-
- error = 0;
- switch (cmd) {
-
- case GCID:
- *(int *)data = gp->g_display.gd_id;
- break;
-
- case GCON:
- error = grfon(dev);
- break;
-
- case GCOFF:
- error = grfoff(dev);
- break;
-
- case GCLOCK:
- error = grflock(gp, 1);
- break;
-
- case GCUNLOCK:
- error = grfunlock(gp);
- break;
-
- case GCAON:
- case GCAOFF:
- break;
-
- /* GCSTATIC is implied by our implementation */
- case GCSTATIC_CMAP:
- case GCVARIABLE_CMAP:
- break;
-
- /* map in control regs and frame buffer */
- case GCMAP:
- error = grfmap(dev, (caddr_t *)data, p);
- break;
-
- case GCUNMAP:
- error = grfunmap(dev, *(caddr_t *)data, p);
- /* XXX: HP-UX uses GCUNMAP to get rid of GCSLOT memory */
- if (error)
- error = grflckunmmap(dev, *(caddr_t *)data);
- break;
-
- case GCSLOT:
- {
- struct grf_slot *sp = (struct grf_slot *)data;
-
- sp->slot = grffindpid(gp);
- if (sp->slot) {
- error = grflckmmap(dev, (caddr_t *)&sp->addr);
- if (error && gp->g_pid) {
- free((caddr_t)gp->g_pid, M_DEVBUF);
- gp->g_pid = NULL;
- }
- } else
- error = EINVAL; /* XXX */
- break;
- }
-
- case GCDESCRIBE:
- error = (*gp->g_sw->gd_mode)(gp, GM_DESCRIBE, data);
- break;
-
- /*
- * XXX: only used right now to map in rbox control registers
- * Will be replaced in the future with a real IOMAP interface.
- */
- case IOMAPMAP:
- error = iommap(dev, (caddr_t *)data);
-#if 0
- /*
- * It may not be worth kludging this (using p_devtmp) to
- * make this work. It was an undocumented side-effect
- * in HP-UX that the mapped address was the return value
- * of the ioctl. The only thing I remember that counted
- * on this behavior was the rbox X10 server.
- */
- if (!error)
- u.u_r.r_val1 = *(int *)data; /* XXX: this sux */
-#endif
- break;
-
- case IOMAPUNMAP:
- error = iounmmap(dev, *(caddr_t *)data);
- break;
-
- default:
- error = EINVAL;
- break;
- }
- return(error);
-}
-
-int
-grflock(gp, block)
- struct grf_data *gp;
- int block;
-{
- struct proc *p = curproc; /* XXX */
- int error;
-
-#ifdef DEBUG
- if (grfdebug & GDB_LOCK)
- 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) {
-#ifdef DEBUG
- if (grfdebug & GDB_LOCK)
- printf(" lockpslot %d lockslot %d lock[lockslot] %d\n",
- gp->g_lock->gl_lockslot, gp->g_lockpslot,
- gp->g_lock->gl_locks[gp->g_lockpslot]);
-#endif
- gp->g_lock->gl_lockslot = 0;
- if (gp->g_lock->gl_locks[gp->g_lockpslot] == 0) {
- gp->g_lockp = NULL;
- gp->g_lockpslot = 0;
- }
- }
- if (gp->g_lockp) {
- if (gp->g_lockp == p)
- return(EBUSY);
- if (!block)
- return(OEAGAIN);
- do {
- gp->g_flags |= GF_WANTED;
- if ((error = tsleep((caddr_t)&gp->g_flags,
- (PZERO+1) | PCATCH, devioc, 0)))
- return (error);
- } while (gp->g_lockp);
- }
- gp->g_lockp = p;
- if (gp->g_pid) {
- int slot = grffindpid(gp);
-
-#ifdef DEBUG
- if (grfdebug & GDB_LOCK)
- printf(" slot %d\n", slot);
-#endif
- gp->g_lockpslot = gp->g_lock->gl_lockslot = slot;
- gp->g_lock->gl_locks[slot] = 1;
- }
- return(0);
-}
-
-int
-grfunlock(gp)
- struct grf_data *gp;
-{
-#ifdef DEBUG
- if (grfdebug & GDB_LOCK)
- 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)
- return(EBUSY);
- if (gp->g_pid) {
-#ifdef DEBUG
- if (grfdebug & GDB_LOCK)
- printf(" lockpslot %d lockslot %d lock[lockslot] %d\n",
- gp->g_lock->gl_lockslot, gp->g_lockpslot,
- gp->g_lock->gl_locks[gp->g_lockpslot]);
-#endif
- gp->g_lock->gl_locks[gp->g_lockpslot] = 0;
- gp->g_lockpslot = gp->g_lock->gl_lockslot = 0;
- }
- if (gp->g_flags & GF_WANTED) {
- wakeup((caddr_t)&gp->g_flags);
- gp->g_flags &= ~GF_WANTED;
- }
- gp->g_lockp = NULL;
- return(0);
-}
-
-/*
- * Convert a BSD style minor devno to HPUX style.
- * We cannot just create HPUX style nodes as they require 24 bits
- * of minor device number and we only have 8.
- * XXX: This may give the wrong result for remote stats of other
- * machines where device 10 exists.
- */
-int
-grfdevno(dev)
- dev_t dev;
-{
- int unit = GRFUNIT(dev);
- struct grf_softc *sc;
- struct grf_data *gp;
- int newdev;
-
- if (unit >= grf_cd.cd_ndevs ||
- (sc = grf_cd.cd_devs[unit]) == NULL)
- return (bsdtohpuxdev(dev));
-
- gp = sc->sc_data;
- if ((gp->g_flags & GF_ALIVE) == 0)
- return (bsdtohpuxdev(dev));
-
- /* magic major number */
- newdev = 12 << 24;
- /* now construct minor number */
- if (gp->g_display.gd_regaddr != (caddr_t)GRFIADDR)
- newdev |= (sc->sc_scode << 16) | 0x200;
- if (dev & GRFIMDEV)
- newdev |= 0x02;
- else if (dev & GRFOVDEV)
- newdev |= 0x01;
-#ifdef DEBUG
- if (grfdebug & GDB_DEVNO)
- printf("grfdevno: dev %x newdev %x\n", dev, newdev);
-#endif
- return(newdev);
-}
-
-#endif /* COMPAT_HPUX */
-
-int
-grfmap(dev, addrp, p)
- dev_t dev;
- caddr_t *addrp;
- struct proc *p;
-{
- struct grf_softc *sc = grf_cd.cd_devs[GRFUNIT(dev)];
- struct grf_data *gp = sc->sc_data;
- int len, error;
- struct vnode vn;
- struct specinfo si;
- int flags;
-
-#ifdef DEBUG
- if (grfdebug & GDB_MMAP)
- printf("grfmap(%d): addr %p\n", p->p_pid, *addrp);
-#endif
- len = gp->g_display.gd_regsize + gp->g_display.gd_fbsize;
- flags = MAP_SHARED;
- if (*addrp)
- flags |= MAP_FIXED;
- else
- *addrp = (caddr_t)0x1000000; /* XXX */
- vn.v_type = VCHR; /* XXX */
- vn.v_specinfo = &si; /* XXX */
- vn.v_rdev = dev; /* XXX */
- error = uvm_mmap(&p->p_vmspace->vm_map, (vaddr_t *)addrp,
- (vsize_t)len, UVM_PROT_RW, UVM_PROT_RW,
- flags, (caddr_t)&vn, 0,
- p->p_rlimit[RLIMIT_MEMLOCK].rlim_cur);
- if (error == 0)
- (void) (*gp->g_sw->gd_mode)(gp, GM_MAP, *addrp);
- return(error);
-}
-
-int
-grfunmap(dev, addr, p)
- dev_t dev;
- caddr_t addr;
- struct proc *p;
-{
- struct grf_softc *sc = grf_cd.cd_devs[GRFUNIT(dev)];
- struct grf_data *gp = sc->sc_data;
- vsize_t size;
-
-#ifdef DEBUG
- if (grfdebug & GDB_MMAP)
- printf("grfunmap(%d): dev %x addr %p\n", p->p_pid, dev, addr);
-#endif
- if (addr == 0)
- return(EINVAL); /* XXX: how do we deal with this? */
- (void) (*gp->g_sw->gd_mode)(gp, GM_UNMAP, 0);
- size = round_page(gp->g_display.gd_regsize + gp->g_display.gd_fbsize);
- uvm_unmap(&p->p_vmspace->vm_map, (vaddr_t)addr,
- (vaddr_t)addr + size);
- return (0);
-}
-
-#ifdef COMPAT_HPUX
-int
-iommap(dev, addrp)
- dev_t dev;
- caddr_t *addrp;
-{
-
-#ifdef DEBUG
- if (grfdebug & (GDB_MMAP|GDB_IOMAP))
- printf("iommap(%d): addr %p\n", curproc->p_pid, *addrp);
-#endif
- return(-1);
-}
-
-int
-iounmmap(dev, addr)
- dev_t dev;
- caddr_t addr;
-{
-#ifdef DEBUG
- int unit = minor(dev);
-
- if (grfdebug & (GDB_MMAP|GDB_IOMAP))
- printf("iounmmap(%d): id %d addr %p\n",
- curproc->p_pid, unit, addr);
-#endif
- return(0);
-}
-
-/*
- * Processes involved in framebuffer mapping via GCSLOT are recorded in
- * an array of pids. The first element is used to record the last slot used
- * (for faster lookups). The remaining elements record up to GRFMAXLCK-1
- * process ids. Returns a slot number between 1 and GRFMAXLCK or 0 if no
- * slot is available.
- */
-int
-grffindpid(gp)
- struct grf_data *gp;
-{
- short pid, *sp;
- int i, limit;
- int ni;
-
- if (gp->g_pid == NULL) {
- gp->g_pid = (short *)
- malloc(GRFMAXLCK * sizeof(short), M_DEVBUF, M_WAITOK);
- bzero((caddr_t)gp->g_pid, GRFMAXLCK * sizeof(short));
- }
- pid = curproc->p_pid;
- ni = limit = gp->g_pid[0];
- for (i = 1, sp = &gp->g_pid[1]; i <= limit; i++, sp++) {
- if (*sp == pid)
- goto done;
- if (*sp == 0)
- ni = i;
- }
- i = ni;
- if (i < limit) {
- gp->g_pid[i] = pid;
- goto done;
- }
- if (++i == GRFMAXLCK)
- return(0);
- gp->g_pid[0] = i;
- gp->g_pid[i] = pid;
-done:
-#ifdef DEBUG
- if (grfdebug & GDB_LOCK)
- printf("grffindpid(%d): slot %d of %d\n",
- pid, i, gp->g_pid[0]);
-#endif
- return(i);
-}
-
-void
-grfrmpid(gp)
- struct grf_data *gp;
-{
- short pid, *sp;
- int limit, i;
- int mi;
-
- if (gp->g_pid == NULL || (limit = gp->g_pid[0]) == 0)
- return;
- pid = curproc->p_pid;
- limit = gp->g_pid[0];
- mi = 0;
- for (i = 1, sp = &gp->g_pid[1]; i <= limit; i++, sp++) {
- if (*sp == pid)
- *sp = 0;
- else if (*sp)
- mi = i;
- }
- i = mi;
- if (i < limit)
- gp->g_pid[0] = i;
-#ifdef DEBUG
- if (grfdebug & GDB_LOCK)
- printf("grfrmpid(%d): slot %d of %d\n",
- pid, sp-gp->g_pid, gp->g_pid[0]);
-#endif
-}
-
-int
-grflckmmap(dev, addrp)
- dev_t dev;
- caddr_t *addrp;
-{
-#ifdef DEBUG
- struct proc *p = curproc; /* XXX */
-
- if (grfdebug & (GDB_MMAP|GDB_LOCK))
- printf("grflckmmap(%d): addr %p\n",
- p->p_pid, *addrp);
-#endif
- return(-1);
-}
-
-int
-grflckunmmap(dev, addr)
- dev_t dev;
- caddr_t addr;
-{
-#ifdef DEBUG
- int unit = minor(dev);
-
- if (grfdebug & (GDB_MMAP|GDB_LOCK))
- printf("grflckunmmap(%d): id %d addr %p\n",
- curproc->p_pid, unit, addr);
-#endif
- return(EINVAL);
-}
-#endif /* COMPAT_HPUX */
diff --git a/sys/arch/hp300/dev/grf_dv.c b/sys/arch/hp300/dev/grf_dv.c
deleted file mode 100644
index 8928c9e33de..00000000000
--- a/sys/arch/hp300/dev/grf_dv.c
+++ /dev/null
@@ -1,743 +0,0 @@
-/* $OpenBSD: grf_dv.c,v 1.10 2005/01/08 22:13:53 miod Exp $ */
-/* $NetBSD: grf_dv.c,v 1.11 1997/03/31 07:34:14 scottr 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.
- *
- * 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. 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: grf_dv.c 1.12 93/08/13$
- *
- * @(#)grf_dv.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for the DaVinci, HP98730/98731 Graphics system.
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <dev/cons.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/intiovar.h>
-
-#include <hp300/dev/grfioctl.h>
-#include <hp300/dev/grfvar.h>
-#include <hp300/dev/grfreg.h>
-#include <hp300/dev/grf_dvreg.h>
-
-#include <hp300/dev/itevar.h>
-#include <hp300/dev/itereg.h>
-
-#include "ite.h"
-
-int dv_init(struct grf_data *, int, caddr_t);
-int dv_mode(struct grf_data *, int, caddr_t);
-void dv_reset(struct dvboxfb *);
-
-int dvbox_intio_match(struct device *, void *, void *);
-void dvbox_intio_attach(struct device *, struct device *, void *);
-
-int dvbox_dio_match(struct device *, void *, void *);
-void dvbox_dio_attach(struct device *, struct device *, void *);
-
-int dvbox_console_scan(int, caddr_t, void *);
-void dvboxcnprobe(struct consdev *cp);
-void dvboxcninit(struct consdev *cp);
-
-struct cfattach dvbox_intio_ca = {
- sizeof(struct grfdev_softc), dvbox_intio_match, dvbox_intio_attach
-};
-
-struct cfattach dvbox_dio_ca = {
- sizeof(struct grfdev_softc), dvbox_dio_match, dvbox_dio_attach
-};
-
-struct cfdriver dvbox_cd = {
- NULL, "dvbox", DV_DULL
-};
-
-/* DaVinci grf switch */
-struct grfsw dvbox_grfsw = {
- GID_DAVINCI, GRFDAVINCI, "dvbox", dv_init, dv_mode
-};
-
-#if NITE > 0
-void dvbox_init(struct ite_data *);
-void dvbox_deinit(struct ite_data *);
-void dvbox_putc(struct ite_data *, int, int, int, int);
-void dvbox_cursor(struct ite_data *, int);
-void dvbox_clear(struct ite_data *, int, int, int, int);
-void dvbox_scroll(struct ite_data *, int, int, int, int);
-void dvbox_windowmove(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 */
-
-int
-dvbox_intio_match(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct intio_attach_args *ia = aux;
- struct grfreg *grf;
-
- grf = (struct grfreg *)IIOV(GRFIADDR);
- if (badaddr((caddr_t)grf))
- return (0);
-
- if (grf->gr_id == DIO_DEVICE_ID_FRAMEBUFFER &&
- grf->gr_id2 == DIO_DEVICE_SECID_DAVINCI) {
- ia->ia_addr = (caddr_t)GRFIADDR;
- return (1);
- }
-
- return (0);
-}
-
-void
-dvbox_intio_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct grfdev_softc *sc = (struct grfdev_softc *)self;
- caddr_t grf;
-
- grf = (caddr_t)IIOV(GRFIADDR);
- sc->sc_scode = -1; /* XXX internal i/o */
-
-#if NITE > 0
- grfdev_attach(sc, dv_init, grf, &dvbox_grfsw, &dvbox_itesw);
-#else
- grfdev_attach(sc, dv_init, grf, &dvbox_grfsw, NULL);
-#endif /* NITE > 0 */
-}
-
-int
-dvbox_dio_match(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
- da->da_secid == DIO_DEVICE_SECID_DAVINCI)
- return (1);
-
- return (0);
-}
-
-void
-dvbox_dio_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct grfdev_softc *sc = (struct grfdev_softc *)self;
- struct dio_attach_args *da = aux;
- caddr_t grf;
-
- sc->sc_scode = da->da_scode;
- if (sc->sc_scode == conscode)
- grf = conaddr;
- else {
- grf = iomap(dio_scodetopa(sc->sc_scode), da->da_size);
- if (grf == 0) {
- printf("%s: can't map framebuffer\n",
- sc->sc_dev.dv_xname);
- return;
- }
- }
-
-#if NITE > 0
- grfdev_attach(sc, dv_init, grf, &dvbox_grfsw, &dvbox_itesw);
-#else
- grfdev_attach(sc, dv_init, grf, &dvbox_grfsw, NULL);
-#endif
-}
-
-/*
- * Initialize hardware.
- * Must point g_display at a grfinfo structure describing the hardware.
- * Returns 0 if hardware not present, non-zero ow.
- */
-int
-dv_init(gp, scode, addr)
- struct grf_data *gp;
- int scode;
- caddr_t addr;
-{
- struct dvboxfb *dbp;
- struct grfinfo *gi = &gp->g_display;
- int fboff;
-
- /*
- * 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 = dio_scodetopa(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)DIOII_BASE) {
- /*
- * 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 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 separate
- * 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);
- }
- return(1);
-}
-
-/*
- * Magic code herein.
- */
-void
-dv_reset(dbp)
- struct dvboxfb *dbp;
-{
- dbp->reset = 0x80;
- DELAY(100);
-
- dbp->interrupt = 0x04;
- dbp->en_scan = 0x01;
- dbp->fbwen = ~0;
- dbp->opwen = ~0;
- dbp->fold = 0x01;
- dbp->drive = 0x01;
- dbp->rep_rule = 0x33;
- dbp->alt_rr = 0x33;
- dbp->zrr = 0x33;
-
- dbp->fbvenp = 0xFF;
- dbp->dispen = 0x01;
- dbp->fbvens = 0x0;
- dbp->fv_trig = 0x01;
- DELAY(100);
- dbp->vdrive = 0x0;
- dbp->zconfig = 0x0;
-
- while (dbp->wbusy & 0x01)
- DELAY(100);
-
- dbp->cmapbank = 0;
-
- dbp->red0 = 0;
- dbp->red1 = 0;
- dbp->green0 = 0;
- dbp->green1 = 0;
- dbp->blue0 = 0;
- dbp->blue1 = 0;
-
- dbp->panxh = 0;
- dbp->panxl = 0;
- dbp->panyh = 0;
- dbp->panyl = 0;
- dbp->zoom = 0;
- dbp->cdwidth = 0x50;
- dbp->chstart = 0x52;
- dbp->cvwidth = 0x22;
- dbp->pz_trig = 1;
-}
-
-/*
- * Change the mode of the display.
- * Right now all we can do is grfon/grfoff.
- * Return a UNIX error number or 0 for success.
- */
-int
-dv_mode(gp, cmd, data)
- struct grf_data *gp;
- int cmd;
- caddr_t data;
-{
- struct dvboxfb *dbp;
- int error = 0;
-
- dbp = (struct dvboxfb *) gp->g_regkva;
- switch (cmd) {
- case GM_GRFON:
- dbp->dispen = 0x01;
- break;
-
- case GM_GRFOFF:
- break;
-
- case GM_GRFOVON:
- dbp->opwen = 0xF;
- dbp->drive = 0x10;
- break;
-
- case GM_GRFOVOFF:
- dbp->opwen = 0;
- dbp->drive = 0x01;
- break;
-
- /*
- * Remember UVA of mapping for GCDESCRIBE.
- * XXX this should be per-process.
- */
- case GM_MAP:
- gp->g_data = data;
- break;
-
- case GM_UNMAP:
- gp->g_data = 0;
- break;
-
-#ifdef COMPAT_HPUX
- case GM_DESCRIBE:
- {
- struct grf_fbinfo *fi = (struct grf_fbinfo *)data;
- struct grfinfo *gi = &gp->g_display;
- int i;
-
- /* feed it what HP-UX expects */
- fi->id = gi->gd_id;
- fi->mapsize = gi->gd_fbsize;
- fi->dwidth = gi->gd_dwidth;
- fi->dlength = gi->gd_dheight;
- fi->width = gi->gd_fbwidth;
- fi->length = gi->gd_fbheight;
- fi->bpp = NBBY;
- fi->xlen = (fi->width * fi->bpp) / NBBY;
- fi->npl = gi->gd_planes;
- fi->bppu = fi->npl;
- fi->nplbytes = fi->xlen * ((fi->length * fi->bpp) / NBBY);
- bcopy("HP98730", fi->name, 8);
- fi->attr = 2; /* HW block mover */
- /*
- * If mapped, return the UVA where mapped.
- */
- if (gp->g_data) {
- fi->regbase = gp->g_data;
- fi->fbbase = fi->regbase + gp->g_display.gd_regsize;
- } else {
- fi->fbbase = 0;
- fi->regbase = 0;
- }
- for (i = 0; i < 6; i++)
- fi->regions[i] = 0;
- break;
- }
-#endif
-
- default:
- error = EINVAL;
- break;
- }
- return(error);
-}
-
-#if NITE > 0
-
-/*
- * DaVinci ite routines
- */
-
-#define REGBASE ((struct dvboxfb *)(ip->regbase))
-#define WINDOWMOVER dvbox_windowmove
-
-void
-dvbox_init(ip)
- 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)
- 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;
-{
- 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;
-{
- int dy;
- int dx = sx;
- int height = 1;
- 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;
-{
- 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 (DIO_DEVSIZE);
- }
- }
- 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 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;
-
- /*
- * Initialize the terminal emulator.
- */
- itecninit(gp, &dvbox_itesw);
-}
-
-#endif /* NITE > 0 */
diff --git a/sys/arch/hp300/dev/grf_dvreg.h b/sys/arch/hp300/dev/grf_dvreg.h
deleted file mode 100644
index 489e8fb3ef4..00000000000
--- a/sys/arch/hp300/dev/grf_dvreg.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/* $OpenBSD: grf_dvreg.h,v 1.3 2003/06/02 23:27:44 millert Exp $ */
-/* $NetBSD: grf_dvreg.h,v 1.5 1994/10/26 07:23:50 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. 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: grf_dvreg.h 1.5 92/01/21$
- *
- * @(#)grf_dvreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-/*
- * Map of the DaVinci frame buffer controller chip in memory ...
- */
-
-#define db_waitbusy(regaddr) \
- while (((struct dvboxfb *)(regaddr))->wbusy || \
- ((struct dvboxfb *)(regaddr))->as_busy) DELAY(100)
-
-struct rgb {
- u_char :8, :8, :8;
- vu_char red;
- u_char :8, :8, :8;
- vu_char green;
- u_char :8, :8, :8;
- vu_char blue;
-};
-
-struct dvboxfb {
- u_char :8;
- vu_char reset; /* reset register 0x01 */
- u_char fb_address; /* frame buffer address 0x02 */
- vu_char interrupt; /* interrupt register 0x03 */
- u_char :8;
- vu_char fbwmsb; /* frame buffer width MSB 0x05 */
- u_char :8;
- vu_char fbwlsb; /* frame buffer width MSB 0x07 */
- u_char :8;
- vu_char fbhmsb; /* frame buffer height MSB 0x09 */
- u_char :8;
- vu_char fbhlsb; /* frame buffer height MSB 0x0b */
- u_char :8;
- vu_char dwmsb; /* display width MSB 0x0d */
- u_char :8;
- vu_char dwlsb; /* display width MSB 0x0f */
- u_char :8;
- vu_char dhmsb; /* display height MSB 0x11 */
- u_char :8;
- vu_char dhlsb; /* display height MSB 0x13 */
- u_char :8;
- vu_char fbid; /* frame buffer id 0x15 */
- u_char f1[0x47];
- vu_char fbomsb; /* frame buffer offset MSB 0x5d */
- u_char :8;
- vu_char fbolsb; /* frame buffer offset LSB 0x5f */
- u_char f2[16359];
- vu_char wbusy; /* Window move in progress 0x4047 */
- u_char f3[0x405b-0x4047-1];
- vu_char as_busy; /* Scan accessing frame buf. 0x405B */
- u_char f4[0x4090-0x405b-1];
- vu_int fbwen; /* Frame buffer write enable 0x4090 */
- u_char f5[0x409f-0x4090-4];
- vu_char wmove; /* Initiate window move. 0x409F */
- u_char f6[0x40b3-0x409f-1];
- vu_char fold; /* Byte/longword per pixel 0x40B3 */
- u_char f7[0x40b7-0x40b3-1];
- vu_char opwen; /* Overlay plane write enable 0x40B7 */
- u_char f8[0x40bf-0x40b7-1];
- vu_char drive; /* Select FB vs. Overlay. 0x40BF */
-
- u_char f8a[0x40cb-0x40bf-1];
- vu_char zconfig; /* Z buffer configuration 0x40CB */
- u_char f8b[0x40cf-0x40cb-1];
- vu_char alt_rr; /* Alternate replacement rule 0x40CF */
- u_char f8c[0x40d3-0x40cf-1];
- vu_char zrr; /* Z replacement rule 0x40D3 */
-
- u_char f9[0x40d7-0x40d3-1];
- vu_char en_scan; /* Enable scan DTACK. 0x40D7 */
- u_char f10[0x40ef-0x40d7-1];
- vu_char rep_rule; /* Replacement rule 0x40EF */
- u_char f11[0x40f2-0x40ef-1];
- vu_short source_x; /* Window source X origin 0x40F2 */
- u_char f12[0x40f6-0x40f2-2];
- vu_short source_y; /* Window source Y origin 0x40F6 */
- u_char f13[0x40fa-0x40f6-2];
- vu_short dest_x; /* Window dest X origin 0x40FA */
- u_char f14[0x40fe -0x40fa-2];
- vu_short dest_y; /* Window dest Y origin 0x40FE */
- u_char f15[0x4102-0x40fe -2];
- vu_short wwidth; /* Window width 0x4102 */
- u_char f16[0x4106-0x4102-2];
- vu_short wheight; /* Window height 0x4106 */
- u_char f17[0x6003-0x4106-2];
- vu_char cmapbank; /* Bank select (0 or 1) 0x6003 */
- u_char f18[0x6007-0x6003-1];
- vu_char dispen; /* Display enable 0x6007 */
-
- u_char f18a[0x600B-0x6007-1];
- vu_char fbvenp; /* Frame buffer video enable 0x600B */
- u_char f18b[0x6017-0x600B-1];
- vu_char fbvens; /* fbvenp blink counterpart 0x6017 */
-
- u_char f19[0x6023-0x6017-1];
- vu_char vdrive; /* Video display mode 0x6023 */
- u_char f20[0x6083-0x6023-1];
- vu_char panxh; /* Pan display in X (high) 0x6083 */
- u_char f21[0x6087-0x6083-1];
- vu_char panxl; /* Pan display in X (low) 0x6087 */
- u_char f22[0x608b-0x6087-1];
- vu_char panyh; /* Pan display in Y (high) 0x608B */
- u_char f23[0x608f-0x608b-1];
- vu_char panyl; /* Pan display in Y (low) 0x608F */
- u_char f24[0x6093-0x608f-1];
- vu_char zoom; /* Zoom factor 0x6093 */
- u_char f25[0x6097-0x6093-1];
- vu_char pz_trig; /* Pan & zoom trigger 0x6097 */
- u_char f26[0x609b-0x6097-1];
- vu_char ovly0p; /* Overlay 0 primary map 0x609B */
- u_char f27[0x609f-0x609b-1];
- vu_char ovly1p; /* Overlay 1 primary map 0x609F */
- u_char f28[0x60a3-0x609f-1];
- vu_char ovly0s; /* Overlay 0 secondary map 0x60A3 */
- u_char f29[0x60a7-0x60a3-1];
- vu_char ovly1s; /* Overlay 1 secondary map 0x60A7 */
- u_char f30[0x60ab-0x60a7-1];
- vu_char opvenp; /* Overlay video enable 0x60AB */
- u_char f31[0x60af-0x60ab-1];
- vu_char opvens; /* Overlay blink enable 0x60AF */
- u_char f32[0x60b3-0x60af-1];
- vu_char fv_trig; /* Trigger control registers 0x60B3 */
- u_char f33[0x60b7-0x60b3-1];
- vu_char cdwidth; /* Iris cdwidth timing reg. 0x60B7 */
- u_char f34[0x60bb-0x60b7-1];
- vu_char chstart; /* Iris chstart timing reg. 0x60BB */
- u_char f35[0x60bf-0x60bb-1];
- vu_char cvwidth; /* Iris cvwidth timing reg. 0x60BF */
- u_char f36[0x6100-0x60bf-1];
- struct rgb rgb[8]; /* overlay color map */
- u_char f37[0x6403-0x6100-sizeof(struct rgb)*8];
- vu_char red0;
- u_char f38[0x6803-0x6403-1];
- vu_char green0;
- u_char f39[0x6c03-0x6803-1];
- vu_char blue0;
- u_char f40[0x7403-0x6c03-1];
- vu_char red1;
- u_char f41[0x7803-0x7403-1];
- vu_char green1;
- u_char f42[0x7c03-0x7803-1];
- vu_char blue1;
- u_char f43[0x8012-0x7c03-1];
- vu_short status1; /* Master Status register 0x8012 */
- u_char f44[0xC226-0x8012-2];
- vu_short trans; /* Transparency 0xC226 */
- u_char f45[0xC23E -0xC226-2];
- vu_short pstop; /* Pace value control 0xc23e */
-};
diff --git a/sys/arch/hp300/dev/grf_gb.c b/sys/arch/hp300/dev/grf_gb.c
deleted file mode 100644
index db747e790d3..00000000000
--- a/sys/arch/hp300/dev/grf_gb.c
+++ /dev/null
@@ -1,693 +0,0 @@
-/* $OpenBSD: grf_gb.c,v 1.9 2005/01/08 22:13:53 miod Exp $ */
-/* $NetBSD: grf_gb.c,v 1.11 1997/03/31 07:34:15 scottr 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.
- *
- * 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. 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: grf_gb.c 1.18 93/08/13$
- *
- * @(#)grf_gb.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for the Gatorbox.
- *
- * Note: In the context of this system, "gator" and "gatorbox" both refer to
- * HP 987x0 graphics systems. "Gator" is not used for high res mono.
- * (as in 9837 Gator systems)
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <dev/cons.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/intiovar.h>
-
-#include <hp300/dev/grfioctl.h>
-#include <hp300/dev/grfvar.h>
-#include <hp300/dev/grfreg.h>
-#include <hp300/dev/grf_gbreg.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] = {
- 0x29, 0x20, 0x23, 0x04, 0x30, 0x0b, 0x30,
- 0x30, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00
-};
-
-int gb_init(struct grf_data *gp, int, caddr_t);
-int gb_mode(struct grf_data *gp, int, caddr_t);
-void gb_microcode(struct gboxfb *);
-
-int gbox_intio_match(struct device *, void *, void *);
-void gbox_intio_attach(struct device *, struct device *, void *);
-
-int gbox_dio_match(struct device *, void *, void *);
-void gbox_dio_attach(struct device *, struct device *, void *);
-
-int gbox_console_scan(int, caddr_t, void *);
-void gboxcnprobe(struct consdev *cp);
-void gboxcninit(struct consdev *cp);
-
-struct cfattach gbox_intio_ca = {
- sizeof(struct grfdev_softc), gbox_intio_match, gbox_intio_attach
-};
-
-struct cfattach gbox_dio_ca = {
- sizeof(struct grfdev_softc), gbox_dio_match, gbox_dio_attach
-};
-
-struct cfdriver gbox_cd = {
- NULL, "gbox", DV_DULL
-};
-
-/* Gatorbox grf switch */
-struct grfsw gbox_grfsw = {
- GID_GATORBOX, GRFGATOR, "gatorbox", gb_init, gb_mode
-};
-
-#if NITE > 0
-void gbox_init(struct ite_data *);
-void gbox_deinit(struct ite_data *);
-void gbox_putc(struct ite_data *, int, int, int, int);
-void gbox_cursor(struct ite_data *, int);
-void gbox_clear(struct ite_data *, int, int, int, int);
-void gbox_scroll(struct ite_data *, int, int, int, int);
-void gbox_windowmove(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 */
-
-int
-gbox_intio_match(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct intio_attach_args *ia = aux;
- struct grfreg *grf;
-
- grf = (struct grfreg *)IIOV(GRFIADDR);
- if (badaddr((caddr_t)grf))
- return (0);
-
- if (grf->gr_id == DIO_DEVICE_ID_FRAMEBUFFER &&
- grf->gr_id2 == DIO_DEVICE_SECID_GATORBOX) {
- ia->ia_addr = (caddr_t)GRFIADDR;
- return (1);
- }
-
- return (0);
-}
-
-void
-gbox_intio_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct grfdev_softc *sc = (struct grfdev_softc *)self;
- caddr_t grf;
-
- grf = (caddr_t)IIOV(GRFIADDR);
- sc->sc_scode = -1; /* XXX internal i/o */
-
-#if NITE > 0
- grfdev_attach(sc, gb_init, grf, &gbox_grfsw, &gbox_itesw);
-#else
- grfdev_attach(sc, gb_init, grf, &gbox_grfsw, NULL);
-#endif /* NITE > 0 */
-}
-
-int
-gbox_dio_match(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
- da->da_secid == DIO_DEVICE_SECID_GATORBOX)
- return (1);
-
- return (0);
-}
-
-void
-gbox_dio_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct grfdev_softc *sc = (struct grfdev_softc *)self;
- struct dio_attach_args *da = aux;
- caddr_t grf;
-
- sc->sc_scode = da->da_scode;
- if (sc->sc_scode == conscode)
- grf = conaddr;
- else {
- grf = iomap(dio_scodetopa(sc->sc_scode), da->da_size);
- if (grf == 0) {
- printf("%s: can't map framebuffer\n",
- sc->sc_dev.dv_xname);
- return;
- }
- }
-
-#if NITE > 0
- grfdev_attach(sc, gb_init, grf, &gbox_grfsw, &gbox_itesw);
-#else
- grfdev_attach(sc, gb_init, grf, &gbox_grfsw, NULL);
-#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.
- */
-int
-gb_init(gp, scode, addr)
- struct grf_data *gp;
- int scode;
- caddr_t addr;
-{
- struct gboxfb *gbp;
- struct grfinfo *gi = &gp->g_display;
- u_char *fbp, save;
- int fboff;
-
- /*
- * If the console has been initialized, and it was us, there's
- * no need to repeat this.
- */
- if (consinit_active || (scode != conscode)) {
- gbp = (struct gboxfb *) addr;
- if (ISIIOVA(addr))
- gi->gd_regaddr = (caddr_t) IIOP(addr);
- else
- gi->gd_regaddr = dio_scodetopa(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 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);
-
- /*
- * 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)
- struct gboxfb *gbp;
-{
- int i;
-
- for (i = 0; i < CRTC_DATA_LENGTH; i++) {
- gbp->crtc_address = i;
- gbp->crtc_data = crtc_init_data[i];
- }
-}
-
-/*
- * Change the mode of the display.
- * Right now all we can do is grfon/grfoff.
- * Return a UNIX error number or 0 for success.
- */
-int
-gb_mode(gp, cmd, data)
- struct grf_data *gp;
- int cmd;
- caddr_t data;
-{
- struct gboxfb *gbp;
- int error = 0;
-
- gbp = (struct gboxfb *)gp->g_regkva;
- switch (cmd) {
- case GM_GRFON:
- gbp->sec_interrupt = 1;
- break;
-
- case GM_GRFOFF:
- break;
-
- /*
- * Remember UVA of mapping for GCDESCRIBE.
- * XXX this should be per-process.
- */
- case GM_MAP:
- gp->g_data = data;
- break;
-
- case GM_UNMAP:
- gp->g_data = 0;
- break;
-
-#ifdef COMPAT_HPUX
- case GM_DESCRIBE:
- {
- struct grf_fbinfo *fi = (struct grf_fbinfo *)data;
- struct grfinfo *gi = &gp->g_display;
- int i;
-
- /* feed it what HP-UX expects */
- fi->id = gi->gd_id;
- fi->mapsize = gi->gd_fbsize;
- fi->dwidth = gi->gd_dwidth;
- fi->dlength = gi->gd_dheight;
- fi->width = gi->gd_fbwidth;
- fi->length = gi->gd_fbheight;
- fi->bpp = NBBY;
- fi->xlen = (fi->width * fi->bpp) / NBBY;
- fi->npl = gi->gd_planes;
- fi->bppu = fi->npl;
- fi->nplbytes = fi->xlen * ((fi->length * fi->bpp) / NBBY);
- bcopy("HP98700", fi->name, 8);
- fi->attr = 2; /* HW block mover */
- /*
- * If mapped, return the UVA where mapped.
- */
- if (gp->g_data) {
- fi->regbase = gp->g_data;
- fi->fbbase = fi->regbase + gp->g_display.gd_regsize;
- } else {
- fi->fbbase = 0;
- fi->regbase = 0;
- }
- for (i = 0; i < 6; i++)
- fi->regions[i] = 0;
- break;
- }
-#endif
-
- default:
- error = EINVAL;
- break;
- }
- return(error);
-}
-
-#if NITE > 0
-
-/*
- * Gatorbox ite routines
- */
-
-#define REGBASE ((struct gboxfb *)(ip->regbase))
-#define WINDOWMOVER gbox_windowmove
-
-void
-gbox_init(ip)
- 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;
-{
- 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;
-{
- 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;
-{
- 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 (DIO_DEVSIZE);
- }
- }
- 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 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;
-
- /*
- * Initialize the terminal emulator.
- */
- itecninit(gp, &gbox_itesw);
-}
-
-#endif /* NITE > 0 */
diff --git a/sys/arch/hp300/dev/grf_gbreg.h b/sys/arch/hp300/dev/grf_gbreg.h
deleted file mode 100644
index 44288972527..00000000000
--- a/sys/arch/hp300/dev/grf_gbreg.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $OpenBSD: grf_gbreg.h,v 1.3 2003/06/02 23:27:44 millert Exp $ */
-/* $NetBSD: grf_gbreg.h,v 1.4 1994/10/26 07:23:53 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. 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: grf_gbreg.h 1.11 92/01/21$
- *
- * @(#)grf_gbreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-/*
- * Gatorbox driver regs
- */
-
-#define TILER_ENABLE 0x80
-#define LINE_MOVER_ENABLE 0x80
-#define UP_LEFT 0x00
-#define DOWN_RIGHT 0x40
-#define MOVE_UP_LEFT TILER_ENABLE|UP_LEFT
-#define MOVE_DOWN_RIGHT TILER_ENABLE|DOWN_RIGHT
-
-#define tile_mover_waitbusy(regaddr) \
- while (((struct gboxfb *)(regaddr))->sec_interrupt & 0x10)
-
-#define line_mover_waitbusy(regaddr) \
- while ((((struct gboxfb *)(regaddr))->status & 0x80) == 0)
-
-#define gbcm_waitbusy(regaddr) \
- while (((struct gboxfb *)(regaddr))->cmap_busy != 0xff)
-
-struct gboxfb {
- u_char :8;
- vu_char reset; /* reset register 0x01 */
- vu_char sec_interrupt; /* Secondary interrupt register 0x03 */
- vu_char interrupt; /* interrupt register 0x03 */
- u_char :8;
- vu_char fbwmsb; /* frame buffer width MSB 0x05 */
- u_char :8;
- vu_char fbwlsb; /* frame buffer width MSB 0x07 */
- u_char :8;
- vu_char fbhmsb; /* frame buffer height MSB 0x09 */
- u_char :8;
- vu_char fbhlsb; /* frame buffer height MSB 0x0b */
- u_char :8;
- vu_char dwmsb; /* display width MSB 0x0d */
- u_char :8;
- vu_char dwlsb; /* display width MSB 0x0f */
- u_char :8;
- vu_char dhmsb; /* display height MSB 0x11 */
- u_char :8;
- vu_char dhlsb; /* display height MSB 0x13 */
- u_char :8;
- vu_char fbid; /* Scondary frame buffer id 0x15 */
- u_char f1[0x5d-0x15-1];
- vu_char fbomsb; /* frame buffer offset MSB 0x5d */
- u_char :8;
- vu_char fbolsb; /* frame buffer offset LSB 0x5f */
- u_char f2[0x4000-0x5f-1];
- vu_char crtc_address; /* CTR controller address reg 0x4000 */
- vu_char status; /* Status register 0x4001 */
- vu_char crtc_data; /* CTR controller data reg 0x4002 */
- u_char f3[6];
- vu_char line_mover_rep_rule; /* Line move rep rule */
- u_char :8, :8;
- vu_char line_mover_width; /* Line move width */
- u_char f4[0xff3];
- vu_char width; /* width in tiles 0x5001 */
- u_char :8;
- vu_char height; /* height in tiles 0x5003 */
- u_char f5[3];
- vu_char rep_rule; /* replacement rule 0x5007 */
- u_char f6[0x6001-0x5007-1];
- vu_char blink1; /* blink 1 0x6001 */
- u_char f7[3];
- vu_char blink2; /* blink 2 0x6005 */
- u_char f8[3];
- vu_char write_protect; /* write protect 0x6009 */
- u_char f9[0x6803-0x6009-1];
- vu_char cmap_busy; /* color map busy 0x6803 */
- u_char f10[0x68b9-0x6803-1];
- vu_char creg_select; /* color map register select 0x68b8 */
- u_char f11[0x68f1-0x68b9-1];
- vu_char cmap_write; /* color map write trigger 0x68f1 */
- u_char f12[0x69b3-0x68f1-1];
- vu_char cmap_red; /* red value register 0x69b3 */
- u_char :8;
- vu_char cmap_grn; /* green value register 0x69b5 */
- u_char :8;
- vu_char cmap_blu; /* blue value register 0x69b6 */
-};
diff --git a/sys/arch/hp300/dev/grf_hy.c b/sys/arch/hp300/dev/grf_hy.c
deleted file mode 100644
index 25ad65b9f95..00000000000
--- a/sys/arch/hp300/dev/grf_hy.c
+++ /dev/null
@@ -1,843 +0,0 @@
-/* $OpenBSD: grf_hy.c,v 1.10 2005/01/08 22:13:53 miod Exp $ */
-/* $NetBSD: grf_hy.c,v 1.9 1997/03/31 07:34:16 scottr 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.
- *
- * 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. 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: grf_hy.c 1.2 93/08/13$
- *
- * @(#)grf_hy.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for HYPERION frame buffer
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <dev/cons.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/intiovar.h>
-
-#include <hp300/dev/grfioctl.h>
-#include <hp300/dev/grfvar.h>
-#include <hp300/dev/grfreg.h>
-#include <hp300/dev/grf_hyreg.h>
-
-#include <hp300/dev/itevar.h>
-#include <hp300/dev/itereg.h>
-
-#include "ite.h"
-
-caddr_t badhyaddr = (caddr_t) -1;
-
-int hy_init(struct grf_data *gp, int, caddr_t);
-int hy_mode(struct grf_data *gp, int, caddr_t);
-void hyper_ite_fontinit(struct ite_data *);
-
-int hyper_dio_match(struct device *, void *, void *);
-void hyper_dio_attach(struct device *, struct device *, void *);
-
-int hyper_console_scan(int, caddr_t, void *);
-void hypercnprobe(struct consdev *cp);
-void hypercninit(struct consdev *cp);
-
-struct cfattach hyper_dio_ca = {
- sizeof(struct grfdev_softc), hyper_dio_match, hyper_dio_attach
-};
-
-struct cfdriver hyper_cd = {
- NULL, "hyper", DV_DULL
-};
-
-/* Hyperion grf switch */
-struct grfsw hyper_grfsw = {
- GID_HYPERION, GRFHYPERION, "hyperion", hy_init, hy_mode
-};
-
-#if NITE > 0
-void hyper_init(struct ite_data *);
-void hyper_deinit(struct ite_data *);
-void hyper_int_fontinit(struct ite_data *);
-void hyper_putc(struct ite_data *, int, int, int, int);
-void hyper_cursor(struct ite_data *, int);
-void hyper_clear(struct ite_data *, int, int, int, int);
-void hyper_scroll(struct ite_data *, int, int, int, int);
-void hyper_windowmove(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 */
-
-int
-hyper_dio_match(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
- da->da_secid == DIO_DEVICE_SECID_HYPERION)
- return (1);
-
- return (0);
-}
-
-void
-hyper_dio_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct grfdev_softc *sc = (struct grfdev_softc *)self;
- struct dio_attach_args *da = aux;
- caddr_t grf;
-
- sc->sc_scode = da->da_scode;
- if (sc->sc_scode == conscode)
- grf = conaddr;
- else {
- grf = iomap(dio_scodetopa(sc->sc_scode), da->da_size);
- if (grf == 0) {
- printf("%s: can't map framebuffer\n",
- sc->sc_dev.dv_xname);
- return;
- }
- }
-
-#if NITE > 0
- grfdev_attach(sc, hy_init, grf, &hyper_grfsw, &hyper_itesw);
-#else
- grfdev_attach(sc, hy_init, grf, &hyper_grfsw, NULL);
-#endif /* NITE > 0 */
-}
-
-/*
- * Initialize hardware.
- * Must fill in the grfinfo structure in g_softc.
- * Returns 0 if hardware not present, non-zero ow.
- */
-int
-hy_init(gp, scode, addr)
- struct grf_data *gp;
- int scode;
- caddr_t addr;
-{
- struct hyboxfb *hy = (struct hyboxfb *) addr;
- struct grfinfo *gi = &gp->g_display;
- int fboff;
-
- /*
- * 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 = dio_scodetopa(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)DIOII_BASE) {
- /*
- * 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 separate
- * 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;
- }
- return(1);
-}
-
-/*
- * Change the mode of the display.
- * Right now all we can do is grfon/grfoff.
- * Return a UNIX error number or 0 for success.
- * Function may not be needed anymore.
- */
-int
-hy_mode(gp, cmd, data)
- struct grf_data *gp;
- int cmd;
- caddr_t data;
-{
- int error = 0;
-
- switch (cmd) {
- case GM_GRFON:
- case GM_GRFOFF:
- break;
-
- /*
- * Remember UVA of mapping for GCDESCRIBE.
- * XXX this should be per-process.
- */
- case GM_MAP:
- gp->g_data = data;
- break;
-
- case GM_UNMAP:
- gp->g_data = 0;
- break;
-
-#ifdef COMPAT_HPUX
- case GM_DESCRIBE:
- {
- struct grf_fbinfo *fi = (struct grf_fbinfo *)data;
- struct grfinfo *gi = &gp->g_display;
- int i;
-
- /* feed it what HP-UX expects */
- fi->id = gi->gd_id;
- fi->mapsize = gi->gd_fbsize;
- fi->dwidth = gi->gd_dwidth;
- fi->dlength = gi->gd_dheight;
- fi->width = gi->gd_fbwidth;
- fi->length = gi->gd_fbheight;
- fi->bpp = NBBY;
- fi->xlen = (fi->width * fi->bpp) / NBBY;
- fi->npl = gi->gd_planes;
- fi->bppu = fi->npl;
- fi->nplbytes = fi->xlen * ((fi->length * fi->bpp) / NBBY);
- bcopy("A1096A", fi->name, 7); /* ?? */
- fi->attr = 0; /* ?? */
- /*
- * If mapped, return the UVA where mapped.
- */
- if (gp->g_data) {
- fi->regbase = gp->g_data;
- fi->fbbase = fi->regbase + gp->g_display.gd_regsize;
- } else {
- fi->fbbase = 0;
- fi->regbase = 0;
- }
- for (i = 0; i < 6; i++)
- fi->regions[i] = 0;
- break;
- }
-#endif
-
- default:
- error = EINVAL;
- break;
- }
- 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;
-{
- 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;
-{
- int dy;
- int dx = sx;
- int height = 1;
- 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 */
- unsigned int *psrc; /* pointer to current src longword */
- 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 */
- int nl; /* temp copy of nlMiddle */
- unsigned int tmpSrc;
- /* place to store full source word */
- 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 (DIO_DEVSIZE);
- }
- }
- 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 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;
-
- /*
- * Initialize the terminal emulator.
- */
- itecninit(gp, &hyper_itesw);
-}
-
-#endif /* NITE > 0 */
diff --git a/sys/arch/hp300/dev/grf_rb.c b/sys/arch/hp300/dev/grf_rb.c
deleted file mode 100644
index b9604dbb5ad..00000000000
--- a/sys/arch/hp300/dev/grf_rb.c
+++ /dev/null
@@ -1,690 +0,0 @@
-/* $OpenBSD: grf_rb.c,v 1.11 2005/01/08 22:13:53 miod Exp $ */
-/* $NetBSD: grf_rb.c,v 1.11 1997/03/31 07:34:17 scottr 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.
- *
- * 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. 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: grf_rb.c 1.15 93/08/13$
- *
- * @(#)grf_rb.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for the Renaissance, HP98720 Graphics system.
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <dev/cons.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/intiovar.h>
-
-#include <hp300/dev/grfioctl.h>
-#include <hp300/dev/grfvar.h>
-#include <hp300/dev/grfreg.h>
-#include <hp300/dev/grf_rbreg.h>
-
-#include <hp300/dev/itevar.h>
-#include <hp300/dev/itereg.h>
-
-#include "ite.h"
-
-int rb_init(struct grf_data *gp, int, caddr_t);
-int rb_mode(struct grf_data *gp, int, caddr_t);
-
-int rbox_intio_match(struct device *, void *, void *);
-void rbox_intio_attach(struct device *, struct device *, void *);
-
-int rbox_dio_match(struct device *, void *, void *);
-void rbox_dio_attach(struct device *, struct device *, void *);
-
-int rbox_console_scan(int, caddr_t, void *);
-void rboxcnprobe(struct consdev *cp);
-void rboxcninit(struct consdev *cp);
-
-struct cfattach rbox_intio_ca = {
- sizeof(struct grfdev_softc), rbox_intio_match, rbox_intio_attach
-};
-
-struct cfattach rbox_dio_ca = {
- sizeof(struct grfdev_softc), rbox_dio_match, rbox_dio_attach
-};
-
-struct cfdriver rbox_cd = {
- NULL, "rbox", DV_DULL
-};
-
-/* Renaissance grf switch */
-struct grfsw rbox_grfsw = {
- GID_RENAISSANCE, GRFRBOX, "renaissance", rb_init, rb_mode
-};
-
-#if NITE > 0
-void rbox_init(struct ite_data *);
-void rbox_deinit(struct ite_data *);
-void rbox_putc(struct ite_data *, int, int, int, int);
-void rbox_cursor(struct ite_data *, int);
-void rbox_clear(struct ite_data *, int, int, int, int);
-void rbox_scroll(struct ite_data *, int, int, int, int);
-void rbox_windowmove(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 */
-
-int
-rbox_intio_match(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct intio_attach_args *ia = aux;
- struct grfreg *grf;
-
- grf = (struct grfreg *)IIOV(GRFIADDR);
- if (badaddr((caddr_t)grf))
- return (0);
-
- if (grf->gr_id == DIO_DEVICE_ID_FRAMEBUFFER &&
- grf->gr_id2 == DIO_DEVICE_SECID_RENAISSANCE) {
- ia->ia_addr = (caddr_t)GRFIADDR;
- return (1);
- }
-
- return (0);
-}
-
-void
-rbox_intio_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct grfdev_softc *sc = (struct grfdev_softc *)self;
- caddr_t grf;
-
- grf = (caddr_t)IIOV(GRFIADDR);
- sc->sc_scode = -1; /* XXX internal i/o */
-
-#if NITE > 0
- grfdev_attach(sc, rb_init, grf, &rbox_grfsw, &rbox_itesw);
-#else
- grfdev_attach(sc, rb_init, grf, &rbox_grfsw, NULL);
-#endif /* NITE > 0 */
-}
-
-int
-rbox_dio_match(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
- da->da_secid == DIO_DEVICE_SECID_RENAISSANCE)
- return (1);
-
- return (0);
-}
-
-void
-rbox_dio_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct grfdev_softc *sc = (struct grfdev_softc *)self;
- struct dio_attach_args *da = aux;
- caddr_t grf;
-
- sc->sc_scode = da->da_scode;
- if (sc->sc_scode == conscode)
- grf = conaddr;
- else {
- grf = iomap(dio_scodetopa(sc->sc_scode), da->da_size);
- if (grf == 0) {
- printf("%s: can't map framebuffer\n",
- sc->sc_dev.dv_xname);
- return;
- }
- }
-
-#if NITE > 0
- grfdev_attach(sc, rb_init, grf, &rbox_grfsw, &rbox_itesw);
-#else
- grfdev_attach(sc, rb_init, grf, &rbox_grfsw, NULL);
-#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.
- */
-int
-rb_init(gp, scode, addr)
- struct grf_data *gp;
- int scode;
- caddr_t addr;
-{
- struct rboxfb *rbp;
- struct grfinfo *gi = &gp->g_display;
- int fboff;
-
- /*
- * 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 = dio_scodetopa(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)DIOII_BASE) {
- /*
- * 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 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 separate
- * 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;
- }
- return(1);
-}
-
-/*
- * Change the mode of the display.
- * Right now all we can do is grfon/grfoff.
- * Return a UNIX error number or 0 for success.
- */
-int
-rb_mode(gp, cmd, data)
- struct grf_data *gp;
- int cmd;
- caddr_t data;
-{
- struct rboxfb *rbp;
- int error = 0;
-
- rbp = (struct rboxfb *) gp->g_regkva;
- switch (cmd) {
- /*
- * The minimal info here is from the Renaissance X driver.
- */
- case GM_GRFON:
- case GM_GRFOFF:
- break;
-
- case GM_GRFOVON:
- rbp->write_enable = 0;
- rbp->opwen = 0xF;
- rbp->drive = 0x10;
- break;
-
- case GM_GRFOVOFF:
- rbp->opwen = 0;
- rbp->write_enable = 0xffffffff;
- rbp->drive = 0x01;
- break;
-
- /*
- * Remember UVA of mapping for GCDESCRIBE.
- * XXX this should be per-process.
- */
- case GM_MAP:
- gp->g_data = data;
- break;
-
- case GM_UNMAP:
- gp->g_data = 0;
- break;
-
-#ifdef COMPAT_HPUX
- case GM_DESCRIBE:
- {
- struct grf_fbinfo *fi = (struct grf_fbinfo *)data;
- struct grfinfo *gi = &gp->g_display;
- int i;
-
- /* feed it what HP-UX expects */
- fi->id = gi->gd_id;
- fi->mapsize = gi->gd_fbsize;
- fi->dwidth = gi->gd_dwidth;
- fi->dlength = gi->gd_dheight;
- fi->width = gi->gd_fbwidth;
- fi->length = gi->gd_fbheight;
- fi->bpp = NBBY;
- fi->xlen = (fi->width * fi->bpp) / NBBY;
- fi->npl = gi->gd_planes;
- fi->bppu = fi->npl;
- fi->nplbytes = fi->xlen * ((fi->length * fi->bpp) / NBBY);
- bcopy("HP98720", fi->name, 8);
- fi->attr = 2; /* HW block mover */
- /*
- * If mapped, return the UVA where mapped.
- */
- if (gp->g_data) {
- fi->regbase = gp->g_data;
- fi->fbbase = fi->regbase + gp->g_display.gd_regsize;
- } else {
- fi->fbbase = 0;
- fi->regbase = 0;
- }
- for (i = 0; i < 6; i++)
- fi->regions[i] = 0;
- break;
- }
-#endif
-
- default:
- error = EINVAL;
- break;
- }
- 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;
-{
- 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;
-{
- 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;
-{
- int dy;
- int dx = sx;
- int height = 1;
- 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;
-{
- 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 (DIO_DEVSIZE);
- }
- }
- 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 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;
-
- /*
- * Initialize the terminal emulator.
- */
- itecninit(gp, &rbox_itesw);
-}
-
-#endif /* NITE > 0 */
diff --git a/sys/arch/hp300/dev/grf_rbreg.h b/sys/arch/hp300/dev/grf_rbreg.h
deleted file mode 100644
index 538f4f4b645..00000000000
--- a/sys/arch/hp300/dev/grf_rbreg.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* $OpenBSD: grf_rbreg.h,v 1.3 2003/06/02 23:27:44 millert Exp $ */
-/* $NetBSD: grf_rbreg.h,v 1.4 1994/10/26 07:24:03 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. 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: grf_rbreg.h 1.9 92/01/21$
- *
- * @(#)grf_rbreg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Map of the Renaissance frame buffer controller chip in memory ...
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-#define rb_waitbusy(regaddr) \
- while (((struct rboxfb *)(regaddr))->wbusy & 0x01) DELAY(100)
-
-#define CM1RED ((struct rencm *)(ip->regbase + 0x6400))
-#define CM1GRN ((struct rencm *)(ip->regbase + 0x6800))
-#define CM1BLU ((struct rencm *)(ip->regbase + 0x6C00))
-#define CM2RED ((struct rencm *)(ip->regbase + 0x7400))
-#define CM2GRN ((struct rencm *)(ip->regbase + 0x7800))
-#define CM2BLU ((struct rencm *)(ip->regbase + 0x7C00))
-
-struct rencm {
- u_char :8, :8, :8;
- vu_char value;
-};
-
-struct rboxfb {
- u_char filler1[1];
- vu_char reset; /* reset register 0x01 */
- vu_char fb_address; /* frame buffer address 0x02 */
- vu_char interrupt; /* interrupt register 0x03 */
- u_char filler1a;
- vu_char fbwmsb; /* frame buffer width MSB 0x05 */
- u_char filler1b;
- vu_char fbwlsb; /* frame buffer width MSB 0x07 */
- u_char filler1c;
- vu_char fbhmsb; /* frame buffer height MSB 0x09 */
- u_char filler1d;
- vu_char fbhlsb; /* frame buffer height MSB 0x0b */
- u_char filler1e;
- vu_char dwmsb; /* display width MSB 0x0d */
- u_char filler1f;
- vu_char dwlsb; /* display width MSB 0x0f */
- u_char filler1g;
- vu_char dhmsb; /* display height MSB 0x11 */
- u_char filler1h;
- vu_char dhlsb; /* display height MSB 0x13 */
- u_char filler1i;
- vu_char fbid; /* frame buffer id 0x15 */
- u_char filler1j[0x47];
- vu_char fbomsb; /* frame buffer offset MSB 0x5d */
- u_char filler1k;
- vu_char fbolsb; /* frame buffer offset LSB 0x5f */
- u_char filler2[16359];
- vu_char wbusy; /* window mover is active 0x4047 */
- u_char filler3[0x405b - 0x4048];
- vu_char scanbusy; /* scan converteris active 0x405B */
- u_char filler3b[0x4083 - 0x405c];
- vu_char video_enable; /* drive vid. refresh bus 0x4083 */
- u_char filler4[3];
- vu_char display_enable; /* enable the display 0x4087 */
- u_char filler5[8];
- vu_int write_enable; /* write enable register 0x4090 */
- u_char filler6[11];
- vu_char wmove; /* start window mover 0x409f */
- u_char filler7[3];
- vu_char blink; /* blink register 0x40a3 */
- u_char filler8[15];
- vu_char fold; /* fold register 0x40b3 */
- vu_int opwen; /* overlay plane write enable 0x40b4 */
- u_char filler9[3];
- vu_char tmode; /* Tile mode size 0x40bb */
- u_char filler9a[3];
- vu_char drive; /* drive register 0x40bf */
- u_char filler10[3];
- vu_char vdrive; /* vdrive register 0x40c3 */
- u_char filler10a[0x40cb-0x40c4];
- vu_char zconfig; /* Z-buffer mode 0x40cb */
- u_char filler11a[2];
- vu_short tpatt; /* Transparency pattern 0x40ce */
- u_char filler11b[3];
- vu_char dmode; /* dither mode 0x40d3 */
- u_char filler11c[3];
- vu_char en_scan; /* enable scan board to DTACK 0x40d7 */
- u_char filler11d[0x40ef-0x40d8];
- vu_char rep_rule; /* replacement rule 0x40ef */
- u_char filler12[2];
- vu_short source_x; /* source x 0x40f2 */
- u_char filler13[2];
- vu_short source_y; /* source y 0x40f6 */
- u_char filler14[2];
- vu_short dest_x; /* dest x 0x40fa */
- u_char filler15[2];
- vu_short dest_y; /* dest y 0x40fe */
- u_char filler16[2];
- vu_short wwidth; /* window width 0x4102 */
- u_char filler17[2];
- vu_short wheight; /* window height 0x4106 */
- u_char filler18[18];
- vu_short patt_x; /* pattern x 0x411a */
- u_char filler19[2];
- vu_short patt_y; /* pattern y 0x411e */
- u_char filler20[0x8012 - 0x4120];
- vu_short te_status; /* transform engine status 0x8012 */
- u_char filler21[0x1ffff-0x8014];
-};
diff --git a/sys/arch/hp300/dev/grf_subr.c b/sys/arch/hp300/dev/grf_subr.c
deleted file mode 100644
index 3f545a27ebf..00000000000
--- a/sys/arch/hp300/dev/grf_subr.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* $OpenBSD: grf_subr.c,v 1.6 2002/03/14 01:26:30 millert Exp $ */
-/* $NetBSD: grf_subr.c,v 1.4 1997/03/31 07:34:18 scottr Exp $ */
-
-/*-
- * 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:
- * 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 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 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.
- */
-
-/*
- * Subroutines common to all framebuffer devices.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/grfioctl.h>
-#include <hp300/dev/grfvar.h>
-
-#include <hp300/dev/itevar.h>
-
-int grfdevprint(void *, const char *);
-
-void
-grfdev_attach(sc, init, regs, sw, isw)
- struct grfdev_softc *sc;
- int (*init)(struct grf_data *, int, caddr_t);
- caddr_t regs;
- struct grfsw *sw;
- struct itesw *isw;
-{
- struct grfdev_attach_args ga;
- struct grf_data *gp;
- int isconsole;
-
- isconsole = (sc->sc_scode == conscode);
-
- if (isconsole)
- sc->sc_data = gp = &grf_cn;
- else {
- sc->sc_data = gp =
- (struct grf_data *)malloc(sizeof(struct grf_data),
- M_DEVBUF, M_NOWAIT);
- if (sc->sc_data == NULL) {
- printf("\n%s: can't allocate grf data\n",
- sc->sc_dev.dv_xname);
- return;
- }
- bzero(sc->sc_data, sizeof(struct grf_data));
-
- /* Initialize the framebuffer hardware. */
- if ((*init)(sc->sc_data, sc->sc_scode, regs) == 0) {
- printf("\n%s: init failed\n",
- sc->sc_dev.dv_xname);
- free(sc->sc_data, M_DEVBUF);
- return;
- }
-
- gp->g_flags = GF_ALIVE;
- gp->g_sw = sw;
- gp->g_display.gd_id = gp->g_sw->gd_swid;
- }
-
- /* Announce ourselves. */
- printf(": %d x %d ", gp->g_display.gd_dwidth,
- gp->g_display.gd_dheight);
- if (gp->g_display.gd_colors == 2)
- printf("monochrome");
- else
- printf("%d color", gp->g_display.gd_colors);
- printf(" %s display\n", gp->g_sw->gd_desc);
-
- /* Attach a grf. */
- ga.ga_scode = sc->sc_scode; /* XXX */
- ga.ga_isconsole = isconsole;
- ga.ga_data = (void *)sc->sc_data;
- ga.ga_ite = (void *)isw;
- (void)config_found(&sc->sc_dev, &ga, grfdevprint);
-}
-
-int
-grfdevprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- /* struct grfdev_attach_args *ga = aux; */
-
- /* Only grf's can attach to grfdev's... easy. */
- if (pnp)
- printf("grf at %s", pnp);
-
- return (UNCONF);
-}
diff --git a/sys/arch/hp300/dev/grf_tc.c b/sys/arch/hp300/dev/grf_tc.c
deleted file mode 100644
index 5f407139c0e..00000000000
--- a/sys/arch/hp300/dev/grf_tc.c
+++ /dev/null
@@ -1,830 +0,0 @@
-/* $OpenBSD: grf_tc.c,v 1.12 2005/01/08 22:13:53 miod Exp $ */
-/* $NetBSD: grf_tc.c,v 1.11 1997/03/31 07:34:18 scottr 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.
- *
- * 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. 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: grf_tc.c 1.20 93/08/13$
- *
- * @(#)grf_tc.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * 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 <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <dev/cons.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/intiovar.h>
-
-#include <hp300/dev/grfioctl.h>
-#include <hp300/dev/grfvar.h>
-#include <hp300/dev/grfreg.h>
-#include <hp300/dev/grf_tcreg.h>
-
-#include <hp300/dev/itevar.h>
-#include <hp300/dev/itereg.h>
-
-#include "ite.h"
-
-int tc_init(struct grf_data *, int, caddr_t);
-int tc_mode(struct grf_data *, int, caddr_t);
-
-void topcat_common_attach(struct grfdev_softc *, caddr_t, u_int8_t);
-
-int topcat_intio_match(struct device *, void *, void *);
-void topcat_intio_attach(struct device *, struct device *, void *);
-
-int topcat_dio_match(struct device *, void *, void *);
-void topcat_dio_attach(struct device *, struct device *, void *);
-
-int topcat_console_scan(int, caddr_t, void *);
-void topcatcnprobe(struct consdev *cp);
-void topcatcninit(struct consdev *cp);
-
-struct cfattach topcat_intio_ca = {
- sizeof(struct grfdev_softc), topcat_intio_match, topcat_intio_attach
-};
-
-struct cfattach topcat_dio_ca = {
- sizeof(struct grfdev_softc), topcat_dio_match, topcat_dio_attach
-};
-
-struct cfdriver topcat_cd = {
- NULL, "topcat", DV_DULL
-};
-
-/* 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(struct ite_data *);
-void topcat_deinit(struct ite_data *);
-void topcat_putc(struct ite_data *, int, int, int, int);
-void topcat_cursor(struct ite_data *, int);
-void topcat_clear(struct ite_data *, int, int, int, int);
-void topcat_scroll(struct ite_data *, int, int, int, int);
-void topcat_windowmove(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 */
-
-int
-topcat_intio_match(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct intio_attach_args *ia = aux;
- struct grfreg *grf;
-
- grf = (struct grfreg *)IIOV(GRFIADDR);
-
- if (badaddr((caddr_t)grf))
- return (0);
-
- if (grf->gr_id == DIO_DEVICE_ID_FRAMEBUFFER) {
- switch (grf->gr_id2) {
- case DIO_DEVICE_SECID_TOPCAT:
- case DIO_DEVICE_SECID_LRCATSEYE:
- case DIO_DEVICE_SECID_HRCCATSEYE:
- case DIO_DEVICE_SECID_HRMCATSEYE:
-#if 0
- case DIO_DEVICE_SECID_XXXCATSEYE:
-#endif
- ia->ia_addr = (caddr_t)GRFIADDR;
- return (1);
- }
- }
-
- return (0);
-}
-
-void
-topcat_intio_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct grfdev_softc *sc = (struct grfdev_softc *)self;
- struct grfreg *grf;
-
- grf = (struct grfreg *)IIOV(GRFIADDR);
- sc->sc_scode = -1; /* XXX internal i/o */
-
- topcat_common_attach(sc, (caddr_t)grf, grf->gr_id2);
-}
-
-int
-topcat_dio_match(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER) {
- switch (da->da_secid) {
- case DIO_DEVICE_SECID_TOPCAT:
- case DIO_DEVICE_SECID_LRCATSEYE:
- case DIO_DEVICE_SECID_HRCCATSEYE:
- case DIO_DEVICE_SECID_HRMCATSEYE:
-#if 0
- case DIO_DEVICE_SECID_XXXCATSEYE:
-#endif
- return (1);
- }
- }
-
- return (0);
-}
-
-void
-topcat_dio_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct grfdev_softc *sc = (struct grfdev_softc *)self;
- struct dio_attach_args *da = aux;
- caddr_t grf;
-
- sc->sc_scode = da->da_scode;
- if (sc->sc_scode == conscode)
- grf = conaddr;
- else {
- grf = iomap(dio_scodetopa(sc->sc_scode), da->da_size);
- if (grf == 0) {
- printf("%s: can't map framebuffer\n",
- sc->sc_dev.dv_xname);
- return;
- }
- }
-
- topcat_common_attach(sc, grf, da->da_secid);
-}
-
-void
-topcat_common_attach(sc, grf, secid)
- struct grfdev_softc *sc;
- caddr_t grf;
- u_int8_t secid;
-{
- struct grfsw *sw;
-
- switch (secid) {
- case DIO_DEVICE_SECID_TOPCAT:
- sw = &topcat_grfsw;
- break;
-
- case DIO_DEVICE_SECID_LRCATSEYE:
- sw = &lrcatseye_grfsw;
- break;
-
- case DIO_DEVICE_SECID_HRCCATSEYE:
- sw = &hrcatseye_grfsw;
- break;
-
- case DIO_DEVICE_SECID_HRMCATSEYE:
- sw = &hrmcatseye_grfsw;
- break;
-#if 0
- case DIO_DEVICE_SECID_XXXCATSEYE:
- sw = XXX?
- break;
-#endif
- default:
- printf("%s: unknown device 0x%x\n",
- sc->sc_dev.dv_xname, secid);
- panic("topcat_common_attach");
- }
-
-#if NITE > 0
- grfdev_attach(sc, tc_init, grf, sw, &topcat_itesw);
-#else
- grfdev_attach(sc, tc_init, grf, sw, NULL);
-#endif /* NITE > 0 */
-}
-
-/*
- * Initialize hardware.
- * Must fill in the grfinfo structure in g_softc.
- * Returns 0 if hardware not present, non-zero ow.
- */
-int
-tc_init(gp, scode, addr)
- struct grf_data *gp;
- int scode;
- caddr_t addr;
-{
- struct tcboxfb *tp = (struct tcboxfb *) addr;
- struct grfinfo *gi = &gp->g_display;
- volatile u_char *fbp;
- u_char save;
- int fboff;
-
- /*
- * 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 = dio_scodetopa(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)DIOII_BASE) {
- /*
- * 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 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 separate
- * 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);
-}
-
-/*
- * Change the mode of the display.
- * Right now all we can do is grfon/grfoff.
- * Return a UNIX error number or 0 for success.
- * Function may not be needed anymore.
- */
-/*ARGSUSED*/
-int
-tc_mode(gp, cmd, data)
- struct grf_data *gp;
- int cmd;
- caddr_t data;
-{
- int error = 0;
-
- switch (cmd) {
- case GM_GRFON:
- case GM_GRFOFF:
- break;
-
- /*
- * Remember UVA of mapping for GCDESCRIBE.
- * XXX this should be per-process.
- */
- case GM_MAP:
- gp->g_data = data;
- break;
-
- case GM_UNMAP:
- gp->g_data = 0;
- break;
-
-#ifdef COMPAT_HPUX
- case GM_DESCRIBE:
- {
- struct grf_fbinfo *fi = (struct grf_fbinfo *)data;
- struct grfinfo *gi = &gp->g_display;
- int i;
-
- /* feed it what HP-UX expects */
- fi->id = gi->gd_id;
- fi->mapsize = gi->gd_fbsize;
- fi->dwidth = gi->gd_dwidth;
- fi->dlength = gi->gd_dheight;
- fi->width = gi->gd_fbwidth;
- fi->length = gi->gd_fbheight;
- fi->bpp = NBBY;
- fi->xlen = (fi->width * fi->bpp) / NBBY;
- fi->npl = gi->gd_planes;
- fi->bppu = fi->npl;
- fi->nplbytes = fi->xlen * ((fi->length * fi->bpp) / NBBY);
- /* XXX */
- switch (gp->g_sw->gd_hwid) {
- case GID_HRCCATSEYE:
- bcopy("HP98550", fi->name, 8);
- break;
- case GID_LRCATSEYE:
- bcopy("HP98549", fi->name, 8);
- break;
- case GID_HRMCATSEYE:
- bcopy("HP98548", fi->name, 8);
- break;
- case GID_TOPCAT:
- switch (gi->gd_colors) {
- case 64:
- bcopy("HP98547", fi->name, 8);
- break;
- case 16:
- if (gi->gd_dheight == 400) {
- bcopy("HP98543", fi->name, 8);
- } else {
- bcopy("HP98545", fi->name, 8);
- }
- break;
- case 2:
- bcopy("HP98544", fi->name, 8);
- break;
- }
- break;
- }
- fi->attr = 2; /* HW block mover */
- /*
- * If mapped, return the UVA where mapped.
- */
- if (gp->g_data) {
- fi->regbase = gp->g_data;
- fi->fbbase = fi->regbase + gp->g_display.gd_regsize;
- } else {
- fi->fbbase = 0;
- fi->regbase = 0;
- }
- for (i = 0; i < 6; i++)
- fi->regions[i] = 0;
- break;
- }
-#endif
-
- default:
- error = EINVAL;
- break;
- }
- 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;
-{
- int dy;
- int dx = sx;
- int height = 1;
- 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;
-{
- 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 (DIO_DEVSIZE);
- }
- 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 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;
-
- /*
- * Initialize the terminal emulator.
- */
- itecninit(gp, &topcat_itesw);
-}
-
-#endif /* NITE > 0 */
diff --git a/sys/arch/hp300/dev/grf_tcreg.h b/sys/arch/hp300/dev/grf_tcreg.h
deleted file mode 100644
index cc7c2cf0395..00000000000
--- a/sys/arch/hp300/dev/grf_tcreg.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* $OpenBSD: grf_tcreg.h,v 1.3 2003/06/02 23:27:44 millert Exp $ */
-/* $NetBSD: grf_tcreg.h,v 1.6 1994/10/26 07:24:06 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. 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: grf_tcreg.h 1.11 92/01/21$
- *
- * @(#)grf_tcreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-#define tccm_waitbusy(regaddr) \
- while (((struct tcboxfb *)(regaddr))->cmap_busy & 0x04) DELAY(100)
-
-#define tc_waitbusy(regaddr,planes) \
- while (((struct tcboxfb *)(regaddr))->busy & planes) DELAY(100)
-
-struct tcboxfb {
- u_char :8;
- vu_char reset; /* reset register 0x01 */
- vu_char fb_address; /* frame buffer address 0x02 */
- vu_char interrupt; /* interrupt register 0x03 */
- u_char :8;
- vu_char fbwmsb; /* frame buffer width MSB 0x05 */
- u_char :8;
- vu_char fbwlsb; /* frame buffer width MSB 0x07 */
- u_char :8;
- vu_char fbhmsb; /* frame buffer height MSB 0x09 */
- u_char :8;
- vu_char fbhlsb; /* frame buffer height MSB 0x0b */
- u_char :8;
- vu_char dwmsb; /* display width MSB 0x0d */
- u_char :8;
- vu_char dwlsb; /* display width MSB 0x0f */
- u_char :8;
- vu_char dhmsb; /* display height MSB 0x11 */
- u_char :8;
- vu_char dhlsb; /* display height MSB 0x13 */
- u_char :8;
- vu_char fbid; /* Scondary frame buffer id 0x15 */
- u_char :8;
- vu_char bits; /* square(0)/double-high(1) 0x17 */
- u_char f1[0x5b-0x17-1];
- vu_char num_planes; /* number of color planes 0x5b */
- u_char :8;
- vu_char fbomsb; /* frame buffer offset MSB 0x5d */
- u_char :8;
- vu_char fbolsb; /* frame buffer offset LSB 0x5f */
- u_char f2[0x4040-0x5f-1];
- vu_char vblank; /* vertical blanking 0x4040 */
- u_char :8,:8,:8;
- vu_char busy; /* window move active 0x4044 */
- u_char :8,:8,:8;
- vu_char vtrace_request; /* vert retrace intr request 0x4048 */
- u_char :8,:8,:8;
- vu_char move_request; /* window move intr request 0x404C */
- u_char f3[0x4080-0x404c-1];
- vu_char nblank; /* display enable planes 0x4080 */
- u_char f4[0x4088-0x4080-1];
- vu_char wen; /* write enable plane 0x4088 */
- u_char f5[0x408c-0x4088-1];
- vu_char ren; /* read enable plane 0x408c */
- u_char f6[0x4090-0x408c-1];
- vu_char fben; /* frame buffer write enable 0x4090 */
- u_char f7[0x409c-0x4090-1];
- vu_char wmove; /* start window move 0x409c */
- u_char f8[0x40a0-0x409c-1];
- vu_char blink; /* enable blink planes 0x40a0 */
- u_char f9[0x40a8-0x40a0-1];
- vu_char altframe; /* enable alternate frame 0x40a8 */
- u_char f10[0x40ac-0x40a8-1];
- vu_char curon; /* cursor control register 0x40ac */
- u_char f11[0x40ea-0x40ac-1];
- vu_char prr; /* pixel replacement rule 0x40ea */
- u_char f12[0x40ef-0x40ea-1];
- vu_char wmrr; /* move replacement rule 0x40ef */
- u_char f13[0x40f2-0x40ef-1];
- vu_short source_x; /* source x pixel # 0x40f2 */
- u_char f14[0x40f6-0x40f2-2];
- vu_short source_y; /* source y pixel # 0x40f6 */
- u_char f15[0x40fa-0x40f6-2];
- vu_short dest_x; /* dest x pixel # 0x40fa */
- u_char f16[0x40fe -0x40fa-2];
- vu_short dest_y; /* dest y pixel # 0x40fe */
- u_char f17[0x4102-0x40fe -2];
- vu_short wwidth; /* block mover pixel width 0x4102 */
- u_char f18[0x4106-0x4102-2];
- vu_short wheight; /* block mover pixel height 0x4106 */
- /* Catseye */
- u_char f19[0x4206-0x4106-2];
- vu_short rug_cmdstat; /* RUG Command/Staus 0x4206 */
- u_char f20[0x4510-0x4206-2];
- vu_short vb_select; /* Vector/BitBlt Select 0x4510 */
- vu_short tcntrl; /* Three Operand Control 0x4512 */
- vu_short acntrl; /* BitBlt Mode 0x4514 */
- vu_short pncntrl; /* Plane Control 0x4516 */
- u_char f21[0x4800-0x4516-2];
- vu_short catseye_status; /* Catseye Status 0x4800 */
- /* End of Catseye */
- u_char f22[0x6002-0x4800-2];
- vu_short cmap_busy; /* Color Ram busy 0x6002 */
- u_char f23[0x60b2-0x6002-2];
- vu_short rdata; /* color map red data 0x60b2 */
- vu_short gdata; /* color map green data 0x60b4 */
- vu_short bdata; /* color map blue data 0x60b6 */
- vu_short cindex; /* color map index 0x60b8 */
- vu_short plane_mask; /* plane mask select 0x60ba */
- u_char f24[0x60f0-0x60ba-2];
- vu_short strobe; /* color map trigger 0x60f0 */
-};
diff --git a/sys/arch/hp300/dev/grfioctl.h b/sys/arch/hp300/dev/grfioctl.h
deleted file mode 100644
index b720e2081bb..00000000000
--- a/sys/arch/hp300/dev/grfioctl.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* $OpenBSD: grfioctl.h,v 1.4 2003/06/02 23:27:44 millert Exp $ */
-/* $NetBSD: grfioctl.h,v 1.5 1994/10/26 07:24:08 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. 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: grfioctl.h 1.17 93/08/13$
- *
- * @(#)grfioctl.h 8.2 (Berkeley) 9/9/93
- */
-
-struct grfinfo {
- int gd_id; /* HP-UX identifier */
- caddr_t gd_regaddr; /* control registers physaddr */
- int gd_regsize; /* control registers size */
- caddr_t gd_fbaddr; /* frame buffer physaddr */
- int gd_fbsize; /* frame buffer size */
- short gd_colors; /* number of colors */
- short gd_planes; /* number of planes */
-/* new stuff */
- int gd_fbwidth; /* frame buffer width */
- int gd_fbheight; /* frame buffer height */
- int gd_dwidth; /* displayed part width */
- int gd_dheight; /* displayed part height */
- int gd_pad[6]; /* for future expansion */
-};
-
-/* types */
-#define GRFGATOR 8
-#define GRFBOBCAT 9
-#define GRFCATSEYE 9
-#define GRFRBOX 10
-#define GRFFIREEYE 11
-#define GRFHYPERION 12
-#define GRFDAVINCI 14
-
-/*
- * HP-UX ioctls (here for the benefit of the driver)
- */
-struct grf_slot {
- int slot;
- u_char *addr;
-};
-
-struct grf_fbinfo {
- int id;
- int mapsize;
- int dwidth, dlength;
- int width, length;
- int xlen;
- int bpp, bppu;
- int npl, nplbytes;
- char name[32];
- int attr;
- caddr_t fbbase, regbase;
- caddr_t regions[6];
-};
-
-#ifndef _IOH
-#define _IOH(x,y) (IOC_IN|((x)<<8)|y) /* IOC_IN is IOC_VOID */
-
-#define GCID _IOR('G', 0, int)
-#define GCON _IOH('G', 1)
-#define GCOFF _IOH('G', 2)
-#define GCAON _IOH('G', 3)
-#define GCAOFF _IOH('G', 4)
-#define GCMAP _IOWR('G', 5, int)
-#define GCUNMAP _IOWR('G', 6, int)
-#define GCLOCK _IOH('G', 7)
-#define GCUNLOCK _IOH('G', 8)
-#define GCLOCK_MINIMUM _IOH('G', 9)
-#define GCUNLOCK_MINIMUM _IOH('G', 10)
-#define GCSTATIC_CMAP _IOH('G', 11)
-#define GCVARIABLE_CMAP _IOH('G', 12)
-#define GCSLOT _IOWR('G', 13, struct grf_slot)
-#define GCDESCRIBE _IOR('G', 21, struct grf_fbinfo)
-
-/* XXX: for now */
-#define IOMAPID _IOR('M',0,int) /* ??? */
-#define IOMAPMAP _IOWR('M',1,int)
-#define IOMAPUNMAP _IOWR('M',2,int)
-#endif
-
-/*
- * BSD ioctls
- */
-#define GRFIOCGINFO _IOR('G', 0, struct grfinfo) /* get info on device */
-#define GRFIOCON _IO('G', 1) /* turn graphics on */
-#define GRFIOCOFF _IO('G', 2) /* turn graphics off */
-#define GRFIOCMAP _IOWR('G', 5, int) /* map in regs+framebuffer */
-#define GRFIOCUNMAP _IOW('G', 6, int) /* unmap regs+framebuffer */
diff --git a/sys/arch/hp300/dev/grfvar.h b/sys/arch/hp300/dev/grfvar.h
deleted file mode 100644
index 80476f09837..00000000000
--- a/sys/arch/hp300/dev/grfvar.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/* $OpenBSD: grfvar.h,v 1.9 2003/06/02 23:27:44 millert Exp $ */
-/* $NetBSD: grfvar.h,v 1.10 1997/03/31 07:34:19 scottr 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. 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: grfvar.h 1.11 93/08/13$
- *
- * @(#)grfvar.h 8.2 (Berkeley) 9/9/93
- */
-
-/* internal structure of lock page */
-#define GRFMAXLCK 256
-struct grf_lockpage {
- u_char gl_locks[GRFMAXLCK];
-};
-#define gl_lockslot gl_locks[0]
-
-/* per display info */
-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_fbkva; /* KVA of framebuffer */
- struct grfinfo g_display; /* hardware description (for ioctl) */
- struct grf_lockpage *g_lock; /* lock page associated with device */
- struct proc *g_lockp; /* process holding lock */
- short *g_pid; /* array of pids with device open */
- int g_lockpslot; /* g_pid entry of g_lockp */
- 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)(struct grf_data *, int, caddr_t);
- /* misc function routine */
- int (*gd_mode)(struct grf_data *, int, caddr_t);
-};
-
-struct grf_softc {
- struct device sc_dev; /* generic device info */
- int sc_scode; /* select code; for grfdevno() */
- struct grf_data *sc_data; /* display state information */
- struct ite_softc *sc_ite; /* pointer to ite; may be NULL */
-};
-
-struct grfdev_softc {
- struct device sc_dev; /* generic device info */
- struct grf_data *sc_data; /* generic grf data */
- int sc_scode; /* select code, -1 for intio */
-};
-
-/*
- * Set up by the hardware driver, and passed all the way down to
- * the ITE, if appropriate.
- */
-struct grfdev_attach_args {
- int ga_scode; /* XXX select code, -1 for intio */
- int ga_isconsole; /* from hardware; is console? */
- void *ga_data; /* hardware-dependent data */
- void *ga_ite; /* ITE switch table */
-};
-
-/* flags */
-#define GF_ALIVE 0x01
-#define GF_OPEN 0x02
-#define GF_EXCLUDE 0x04
-#define GF_WANTED 0x08
-#define GF_BSDOPEN 0x10
-#define GF_HPUXOPEN 0x20
-
-/* requests to mode routine */
-#define GM_GRFON 1
-#define GM_GRFOFF 2
-#define GM_GRFOVON 3
-#define GM_GRFOVOFF 4
-#define GM_DESCRIBE 5
-#define GM_MAP 6
-#define GM_UNMAP 7
-
-/* minor device interpretation */
-#define GRFOVDEV 0x10 /* overlay planes */
-#define GRFIMDEV 0x20 /* images planes */
-#define GRFUNIT(d) ((d) & 0x7)
-
-#ifdef _KERNEL
-extern struct grf_data grf_cn; /* grf_data for console device */
-
-/* grf.c prototypes */
-int grfmap(dev_t, caddr_t *, struct proc *);
-int grfunmap(dev_t, caddr_t, struct proc *);
-int grfon(dev_t);
-int grfoff(dev_t);
-int grfaddr(struct grf_softc *, int);
-
-#ifdef COMPAT_HPUX
-int hpuxgrfioctl(dev_t, int, caddr_t, int, struct proc *);
-
-int grflock(struct grf_data *, int);
-int grfunlock(struct grf_data *);
-int grfdevno(dev_t);
-
-int iommap(dev_t, caddr_t *);
-int iounmmap(dev_t, caddr_t);
-
-int grffindpid(struct grf_data *);
-void grfrmpid(struct grf_data *);
-int grflckmmap(dev_t, caddr_t *);
-int grflckunmmap(dev_t, caddr_t);
-#endif /* COMPAT_HPUX */
-
-/* grf_subr.c prototypes */
-struct itesw;
-void grfdev_attach(struct grfdev_softc *,
- int (*init)(struct grf_data *, int, caddr_t),
- caddr_t, struct grfsw *, struct itesw *itesw);
-#endif /* _KERNEL */
diff --git a/sys/arch/hp300/dev/hil.c b/sys/arch/hp300/dev/hil.c
deleted file mode 100644
index 8d8c702fe42..00000000000
--- a/sys/arch/hp300/dev/hil.c
+++ /dev/null
@@ -1,1794 +0,0 @@
-/* $OpenBSD: hil.c,v 1.20 2003/09/24 06:41:43 miod Exp $ */
-/* $NetBSD: hil.c,v 1.34 1997/04/02 22:37:32 scottr 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. 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: hil.c 1.38 92/01/21$
- *
- * @(#)hil.c 8.2 (Berkeley) 1/12/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/poll.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/user.h>
-
-#include <hp300/dev/hilreg.h>
-#include <hp300/dev/hilioctl.h>
-#include <hp300/dev/hilvar.h>
-#include <hp300/dev/itevar.h>
-#include <hp300/dev/kbdmap.h>
-
-#include <machine/cpu.h>
-
-#ifdef hp300
-#define NHIL 1 /* XXX */
-#else
-#include "hil.h"
-#endif
-
-struct hil_softc hil_softc[NHIL];
-struct _hilbell default_bell = { BELLDUR, BELLFREQ };
-#ifdef hp800
-int hilspl;
-#endif
-
-#ifdef DEBUG
-int hildebug = 0;
-#define HDB_FOLLOW 0x01
-#define HDB_MMAP 0x02
-#define HDB_MASK 0x04
-#define HDB_CONFIG 0x08
-#define HDB_KEYBOARD 0x10
-#define HDB_IDMODULE 0x20
-#define HDB_EVENTS 0x80
-#endif
-
-#ifdef COMPAT_HPUX
-extern struct emul emul_hpux;
-#endif
-
-/* XXX ITE interface */
-char *kbd_keymap;
-char *kbd_shiftmap;
-char *kbd_ctrlmap;
-char *kbd_ctrlshiftmap;
-char **kbd_stringmap;
-
-/* symbolic sleep message strings */
-char hilin[] = "hilin";
-
-cdev_decl(hil);
-
-void hilinfo(int);
-void hilconfig(struct hil_softc *);
-void hilreset(struct hil_softc *);
-void hilbeep(struct hil_softc *, struct _hilbell *);
-int hiliddev(struct hil_softc *);
-
-void hilint(int);
-void hil_process_int(struct hil_softc *, u_char, u_char);
-void hilevent(struct hil_softc *);
-void hpuxhilevent(struct hil_softc *, struct hilloopdev *);
-
-int hilqalloc(struct hil_softc *, struct hilqinfo *, struct proc *);
-int hilqfree(struct hil_softc *, int, struct proc *);
-int hilqmap(struct hil_softc *, int, int, struct proc *);
-int hilqunmap(struct hil_softc *, int, int, struct proc *);
-
-#ifdef DEBUG
-void printhilpollbuf(struct hil_softc *);
-void printhilcmdbuf(struct hil_softc *);
-void hilreport(struct hil_softc *);
-#endif /* DEBUG */
-
-void
-hilsoftinit(unit, hilbase)
- int unit;
- struct hil_dev *hilbase;
-{
- struct hil_softc *hilp = &hil_softc[unit];
- int i;
-
- /* XXX ITE interface */
- extern char us_keymap[], us_shiftmap[], us_ctrlmap[],
- us_ctrlshiftmap[], *us_stringmap[];
-
-#ifdef DEBUG
- if (hildebug & HDB_FOLLOW)
- printf("hilsoftinit(%d, %p)\n", unit, hilbase);
-#endif
- /*
- * Initialize loop information
- */
- hilp->hl_addr = hilbase;
- hilp->hl_cmdending = FALSE;
- hilp->hl_actdev = hilp->hl_cmddev = 0;
- hilp->hl_cmddone = FALSE;
- hilp->hl_cmdbp = hilp->hl_cmdbuf;
- hilp->hl_pollbp = hilp->hl_pollbuf;
- hilp->hl_kbddev = 0;
- hilp->hl_kbdflags = 0;
- /*
- * Clear all queues and device associations with queues
- */
- for (i = 0; i < NHILQ; i++) {
- hilp->hl_queue[i].hq_eventqueue = NULL;
- hilp->hl_queue[i].hq_procp = NULL;
- hilp->hl_queue[i].hq_devmask = 0;
- }
- for (i = 0; i < NHILD; i++)
- hilp->hl_device[i].hd_qmask = 0;
- hilp->hl_device[HILLOOPDEV].hd_flags = (HIL_ALIVE|HIL_PSEUDO);
-
- /*
- * Set up default keyboard language. We always default
- * to US ASCII - it seems to work OK for non-recognized
- * keyboards.
- */
- hilp->hl_kbdlang = KBD_DEFAULT;
- kbd_keymap = us_keymap; /* XXX */
- kbd_shiftmap = us_shiftmap; /* XXX */
- kbd_ctrlmap = us_ctrlmap; /* XXX */
- kbd_ctrlshiftmap = us_ctrlshiftmap; /* XXX */
- kbd_stringmap = us_stringmap; /* XXX */
-}
-
-void
-hilinit(unit, hilbase)
- int unit;
- struct hil_dev *hilbase;
-{
- struct hil_softc *hilp = &hil_softc[unit];
-#ifdef DEBUG
- if (hildebug & HDB_FOLLOW)
- printf("hilinit(%d, %p)\n", unit, hilbase);
-#endif
- /*
- * Initialize software (if not already done).
- */
- if ((hilp->hl_device[HILLOOPDEV].hd_flags & HIL_ALIVE) == 0)
- hilsoftinit(unit, hilbase);
- /*
- * Initialize hardware.
- * Reset the loop hardware, and collect keyboard/id info
- */
- hilreset(hilp);
- hilinfo(unit);
- kbdenable(unit);
-}
-
-/* ARGSUSED */
-int
-hilopen(dev, flags, mode, p)
- dev_t dev;
- int flags, mode;
- struct proc *p;
-{
- struct hil_softc *hilp = &hil_softc[HILLOOP(dev)];
- struct hilloopdev *dptr;
- u_char device = HILUNIT(dev);
- int s;
-
-#ifdef DEBUG
- if (hildebug & HDB_FOLLOW)
- printf("hilopen(%d): loop %x device %x\n",
- p->p_pid, HILLOOP(dev), device);
-#endif
-
- if ((hilp->hl_device[HILLOOPDEV].hd_flags & HIL_ALIVE) == 0)
- return(ENXIO);
-
- dptr = &hilp->hl_device[device];
- if ((dptr->hd_flags & HIL_ALIVE) == 0)
- return(ENODEV);
-
- /*
- * Pseudo-devices cannot be read, nothing more to do.
- */
- if (dptr->hd_flags & HIL_PSEUDO)
- return(0);
-
- /*
- * Open semantics:
- * 1. Open devices have only one of HIL_READIN/HIL_QUEUEIN.
- * 2. HPUX processes always get read syscall interface and
- * must have exclusive use of the device.
- * 3. BSD processes default to shared queue interface.
- * Multiple processes can open the device.
- */
-#ifdef COMPAT_HPUX
- if (p->p_emul == &emul_hpux) {
- if (dptr->hd_flags & (HIL_READIN|HIL_QUEUEIN))
- return(EBUSY);
- dptr->hd_flags |= HIL_READIN;
- } else
-#endif
- {
- if (dptr->hd_flags & HIL_READIN)
- return(EBUSY);
- dptr->hd_flags |= HIL_QUEUEIN;
- }
- if (flags & FNONBLOCK)
- dptr->hd_flags |= HIL_NOBLOCK;
- /*
- * It is safe to flush the read buffer as we are guaranteed
- * that no one else is using it.
- */
- if ((dptr->hd_flags & HIL_OPENED) == 0) {
- dptr->hd_flags |= HIL_OPENED;
- clalloc(&dptr->hd_queue, HILMAXCLIST, 0);
- }
-
- send_hil_cmd(hilp->hl_addr, HIL_INTON, NULL, 0, NULL);
- /*
- * Opened the keyboard, put in raw mode.
- */
- s = splhil();
- if (device == hilp->hl_kbddev) {
- u_char mask = 0;
- send_hil_cmd(hilp->hl_addr, HIL_WRITEKBDSADR, &mask, 1, NULL);
- hilp->hl_kbdflags |= KBD_RAW;
-#ifdef DEBUG
- if (hildebug & HDB_KEYBOARD)
- printf("hilopen: keyboard %d raw\n", hilp->hl_kbddev);
-#endif
- }
- splx(s);
- return (0);
-}
-
-/* ARGSUSED */
-int
-hilclose(dev, flags, mode, p)
- dev_t dev;
- int flags, mode;
- struct proc *p;
-{
- struct hil_softc *hilp = &hil_softc[HILLOOP(dev)];
- struct hilloopdev *dptr;
- int i;
- u_char device = HILUNIT(dev);
- char mask, lpctrl;
- int s;
- extern struct emul emul_native;
-
-#ifdef DEBUG
- if (hildebug & HDB_FOLLOW)
- printf("hilclose(%d): device %x\n", p->p_pid, device);
-#endif
-
- dptr = &hilp->hl_device[device];
- if (device && (dptr->hd_flags & HIL_PSEUDO))
- return (0);
-
- if (p && p->p_emul == &emul_native) {
- /*
- * If this is the loop device,
- * free up all queues belonging to this process.
- */
- if (device == 0) {
- for (i = 0; i < NHILQ; i++)
- if (hilp->hl_queue[i].hq_procp == p)
- (void) hilqfree(hilp, i, p);
- } else {
- mask = ~hildevmask(device);
- 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;
- }
- splx(s);
- }
- }
- /*
- * The read buffer can go away.
- */
- dptr->hd_flags &= ~(HIL_QUEUEIN|HIL_READIN|HIL_NOBLOCK|HIL_OPENED);
- clfree(&dptr->hd_queue);
- /*
- * Set keyboard back to cooked mode when closed.
- */
- 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);
- hilp->hl_kbdflags &= ~(KBD_RAW|KBD_AR1|KBD_AR2);
- /*
- * XXX: We have had trouble with keyboards remaining raw
- * after close due to the LPC_KBDCOOK bit getting cleared
- * somewhere along the line. Hence we check and reset
- * LPCTRL if necessary.
- */
- send_hil_cmd(hilp->hl_addr, HIL_READLPCTRL, NULL, 0, &lpctrl);
- if ((lpctrl & LPC_KBDCOOK) == 0) {
- printf("hilclose: bad LPCTRL %x, reset to %x\n",
- lpctrl, lpctrl|LPC_KBDCOOK);
- lpctrl |= LPC_KBDCOOK;
- send_hil_cmd(hilp->hl_addr, HIL_WRITELPCTRL,
- &lpctrl, 1, NULL);
- }
-#ifdef DEBUG
- if (hildebug & HDB_KEYBOARD)
- printf("hilclose: keyboard %d cooked\n",
- hilp->hl_kbddev);
-#endif
- kbdenable(HILLOOP(dev));
- }
- splx(s);
- return (0);
-}
-
-/*
- * Read interface to HIL device.
- */
-/* ARGSUSED */
-int
-hilread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct hil_softc *hilp = &hil_softc[HILLOOP(dev)];
- struct hilloopdev *dptr;
- int cc;
- u_char device = HILUNIT(dev);
- u_char buf[HILBUFSIZE];
- int error, s;
-
-#if 0
- /*
- * XXX: Don't do this since HP-UX doesn't.
- *
- * Check device number.
- * This check is necessary since loop can reconfigure.
- */
- if (device > hilp->hl_maxdev)
- return(ENODEV);
-#endif
-
- dptr = &hilp->hl_device[device];
- if ((dptr->hd_flags & HIL_READIN) == 0)
- return(ENODEV);
-
- s = splhil();
- while (dptr->hd_queue.c_cc == 0) {
- if (dptr->hd_flags & HIL_NOBLOCK) {
- spl0();
- return(EWOULDBLOCK);
- }
- dptr->hd_flags |= HIL_ASLEEP;
- if ((error = tsleep((caddr_t)dptr,
- TTIPRI | PCATCH, hilin, 0))) {
- (void) spl0();
- return (error);
- }
- }
- splx(s);
-
- error = 0;
- while (uio->uio_resid > 0 && error == 0) {
- cc = q_to_b(&dptr->hd_queue, buf,
- min(uio->uio_resid, HILBUFSIZE));
- if (cc <= 0)
- break;
- error = uiomove(buf, cc, uio);
- }
- return(error);
-}
-
-int
-hilioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct hil_softc *hilp = &hil_softc[HILLOOP(dev)];
- char device = HILUNIT(dev);
- struct hilloopdev *dptr;
- int i;
- u_char hold;
- int error;
-
-#ifdef DEBUG
- if (hildebug & HDB_FOLLOW)
- printf("hilioctl(%d): dev %x cmd %lx\n",
- p->p_pid, device, cmd);
-#endif
-
- dptr = &hilp->hl_device[(int)device];
- if ((dptr->hd_flags & HIL_ALIVE) == 0)
- return (ENODEV);
-
- /*
- * Don't allow hardware ioctls on virtual devices.
- * Note that though these are the BSD names, they have the same
- * values as the HP-UX equivalents so we catch them as well.
- */
- if (dptr->hd_flags & HIL_PSEUDO) {
- switch (cmd) {
- case HILIOCSC:
- case HILIOCID:
- case OHILIOCID:
- case HILIOCRN:
- case HILIOCRS:
- case HILIOCED:
- return(ENODEV);
-
- /*
- * XXX: should also return ENODEV but HP-UX compat
- * breaks if we do. They work ok right now because
- * we only recognize one keyboard on the loop. This
- * will have to change if we remove that restriction.
- */
- case HILIOCAROFF:
- case HILIOCAR1:
- case HILIOCAR2:
- break;
-
- default:
- break;
- }
- }
-
-#ifdef COMPAT_HPUX
- if (p->p_emul == &emul_hpux)
- return(hpuxhilioctl(dev, cmd, data, flag));
-#endif
-
- hilp->hl_cmdbp = hilp->hl_cmdbuf;
- bzero((caddr_t)hilp->hl_cmdbuf, HILBUFSIZE);
- hilp->hl_cmddev = device;
- error = 0;
- switch (cmd) {
-
- case HILIOCSBP:
- /* Send four data bytes to the tone gererator. */
- send_hil_cmd(hilp->hl_addr, HIL_STARTCMD, data, 4, NULL);
- /* Send the trigger beeper command to the 8042. */
- send_hil_cmd(hilp->hl_addr, (cmd & 0xFF), NULL, 0, NULL);
- break;
-
- case OHILIOCRRT:
- case HILIOCRRT:
- /* Transfer the real time to the 8042 data buffer */
- send_hil_cmd(hilp->hl_addr, (cmd & 0xFF), NULL, 0, NULL);
- /* Read each byte of the real time */
- for (i = 0; i < 5; i++) {
- send_hil_cmd(hilp->hl_addr, HIL_READTIME + i, NULL,
- 0, &hold);
- data[4-i] = hold;
- }
- break;
-
- case HILIOCRT:
- for (i = 0; i < 4; i++) {
- send_hil_cmd(hilp->hl_addr, (cmd & 0xFF) + i,
- NULL, 0, &hold);
- data[i] = hold;
- }
- break;
-
- case HILIOCID:
- case OHILIOCID:
- case HILIOCSC:
- case HILIOCRN:
- case HILIOCRS:
- case HILIOCED:
- send_hildev_cmd(hilp, device, (cmd & 0xFF));
- bcopy(hilp->hl_cmdbuf, data, hilp->hl_cmdbp-hilp->hl_cmdbuf);
- break;
-
- case HILIOCAROFF:
- case HILIOCAR1:
- case HILIOCAR2:
- if (hilp->hl_kbddev) {
- hilp->hl_cmddev = hilp->hl_kbddev;
- send_hildev_cmd(hilp, hilp->hl_kbddev, (cmd & 0xFF));
- hilp->hl_kbdflags &= ~(KBD_AR1|KBD_AR2);
- if (cmd == HILIOCAR1)
- hilp->hl_kbdflags |= KBD_AR1;
- else if (cmd == HILIOCAR2)
- hilp->hl_kbdflags |= KBD_AR2;
- }
- break;
-
- case HILIOCBEEP:
- hilbeep(hilp, (struct _hilbell *)data);
- break;
-
- case FIONBIO:
- dptr = &hilp->hl_device[(int)device];
- if (*(int *)data)
- dptr->hd_flags |= HIL_NOBLOCK;
- else
- dptr->hd_flags &= ~HIL_NOBLOCK;
- break;
-
- /*
- * FIOASYNC must be present for FIONBIO above to work!
- * (See fcntl in kern_descrip.c).
- */
- case FIOASYNC:
- break;
-
- case HILIOCALLOCQ:
- error = hilqalloc(hilp, (struct hilqinfo *)data, p);
- break;
-
- case HILIOCFREEQ:
- error = hilqfree(hilp, ((struct hilqinfo *)data)->qid, p);
- break;
-
- case HILIOCMAPQ:
- error = hilqmap(hilp, *(int *)data, device, p);
- break;
-
- case HILIOCUNMAPQ:
- error = hilqunmap(hilp, *(int *)data, device, p);
- break;
-
- case HILIOCHPUX:
- dptr = &hilp->hl_device[(int)device];
- dptr->hd_flags |= HIL_READIN;
- dptr->hd_flags &= ~HIL_QUEUEIN;
- break;
-
- case HILIOCRESET:
- hilreset(hilp);
- break;
-
-#ifdef DEBUG
- case HILIOCTEST:
- hildebug = *(int *) data;
- break;
-#endif
-
- default:
- error = EINVAL;
- break;
-
- }
- hilp->hl_cmddev = 0;
- return(error);
-}
-
-#ifdef COMPAT_HPUX
-/* ARGSUSED */
-int
-hpuxhilioctl(dev, cmd, data, flag)
- dev_t dev;
- int cmd, flag;
- caddr_t data;
-{
- struct hil_softc *hilp = &hil_softc[HILLOOP(dev)];
- char device = HILUNIT(dev);
- struct hilloopdev *dptr;
- int i;
- u_char hold;
-
- hilp->hl_cmdbp = hilp->hl_cmdbuf;
- bzero((caddr_t)hilp->hl_cmdbuf, HILBUFSIZE);
- hilp->hl_cmddev = device;
- switch (cmd) {
-
- case HILSC:
- case HILID:
- case HILRN:
- case HILRS:
- case HILED:
- case HILP1:
- case HILP2:
- case HILP3:
- case HILP4:
- case HILP5:
- case HILP6:
- case HILP7:
- case HILP:
- case HILA1:
- case HILA2:
- case HILA3:
- case HILA4:
- case HILA5:
- case HILA6:
- case HILA7:
- case HILA:
- send_hildev_cmd(hilp, device, (cmd & 0xFF));
- bcopy(hilp->hl_cmdbuf, data, hilp->hl_cmdbp-hilp->hl_cmdbuf);
- break;
-
- case HILDKR:
- case HILER1:
- case HILER2:
- if (hilp->hl_kbddev) {
- hilp->hl_cmddev = hilp->hl_kbddev;
- send_hildev_cmd(hilp, hilp->hl_kbddev, (cmd & 0xFF));
- hilp->hl_kbdflags &= ~(KBD_AR1|KBD_AR2);
- if (cmd == HILIOCAR1)
- hilp->hl_kbdflags |= KBD_AR1;
- else if (cmd == HILIOCAR2)
- hilp->hl_kbdflags |= KBD_AR2;
- }
- break;
-
- case EFTSBP:
- /* Send four data bytes to the tone gererator. */
- send_hil_cmd(hilp->hl_addr, HIL_STARTCMD, data, 4, NULL);
- /* Send the trigger beeper command to the 8042. */
- send_hil_cmd(hilp->hl_addr, (cmd & 0xFF), NULL, 0, NULL);
- break;
-
- case EFTRRT:
- /* Transfer the real time to the 8042 data buffer */
- send_hil_cmd(hilp->hl_addr, (cmd & 0xFF), NULL, 0, NULL);
- /* Read each byte of the real time */
- for (i = 0; i < 5; i++) {
- send_hil_cmd(hilp->hl_addr, HIL_READTIME + i, NULL,
- 0, &hold);
- data[4-i] = hold;
- }
- break;
-
- case EFTRT:
- for (i = 0; i < 4; i++) {
- send_hil_cmd(hilp->hl_addr, (cmd & 0xFF) + i,
- NULL, 0, &hold);
- data[i] = hold;
- }
- break;
-
- case EFTRLC:
- case EFTRCC:
- send_hil_cmd(hilp->hl_addr, (cmd & 0xFF), NULL, 0, &hold);
- *data = hold;
- break;
-
- case EFTSRPG:
- case EFTSRD:
- case EFTSRR:
- send_hil_cmd(hilp->hl_addr, (cmd & 0xFF), data, 1, NULL);
- break;
-
- case EFTSBI:
-#ifdef hp800
- /* XXX big magic */
- hold = 7 - (*(u_char *)data >> 5);
- *(int *)data = 0x84069008 | (hold << 8);
- send_hil_cmd(hilp->hl_addr, HIL_STARTCMD, data, 4, NULL);
- send_hil_cmd(hilp->hl_addr, 0xC4, NULL, 0, NULL);
- break;
-#else
- hilbeep(hilp, (struct _hilbell *)data);
-#endif
- break;
-
- case FIONBIO:
- dptr = &hilp->hl_device[(int)device];
- if (*(int *)data)
- dptr->hd_flags |= HIL_NOBLOCK;
- else
- dptr->hd_flags &= ~HIL_NOBLOCK;
- break;
-
- case FIOASYNC:
- break;
-
- default:
- hilp->hl_cmddev = 0;
- return(EINVAL);
- }
- hilp->hl_cmddev = 0;
- return(0);
-}
-#endif
-
-/* ARGSUSED */
-paddr_t
-hilmmap(dev, off, prot)
- dev_t dev;
- off_t off;
- int prot;
-{
- return (-1);
-}
-
-/*ARGSUSED*/
-int
-hilpoll(dev, events, p)
- dev_t dev;
- int events;
- struct proc *p;
-{
- struct hil_softc *hilp = &hil_softc[HILLOOP(dev)];
- struct hilloopdev *dptr;
- struct hiliqueue *qp;
- int mask;
- int s, revents, device;
-
- revents = events & (POLLOUT | POLLWRNORM);
- if ((events & (POLLIN | POLLRDNORM)) == 0)
- return (revents);
-
- device = HILUNIT(dev);
-
- /*
- * Read interface.
- * Return 1 if there is something in the queue, 0 ow.
- */
- dptr = &hilp->hl_device[device];
- if (dptr->hd_flags & HIL_READIN) {
- s = splhil();
- if (dptr->hd_queue.c_cc)
- revents |= events & (POLLIN | POLLRDNORM);
- else
- selrecord(p, &dptr->hd_selr);
- splx(s);
- return (revents);
- }
-
- /*
- * Make sure device is alive and real (or the loop device).
- * Note that we do not do this for the read interface.
- * This is primarily to be consistant with HP-UX.
- */
- if (device && (dptr->hd_flags & (HIL_ALIVE|HIL_PSEUDO)) != HIL_ALIVE)
- return (revents | (events & (POLLIN | POLLRDNORM)));
-
- /*
- * Select on loop device is special.
- * Check to see if there are any data for any loop device
- * provided it is associated with a queue belonging to this user.
- */
- if (device == 0)
- mask = -1;
- else
- mask = hildevmask(device);
- /*
- * Must check everybody with interrupts blocked to prevent races.
- */
- s = splhil();
- for (qp = hilp->hl_queue; qp < &hilp->hl_queue[NHILQ]; qp++)
- if (qp->hq_procp == p && (mask & qp->hq_devmask) &&
- qp->hq_eventqueue->hil_evqueue.head !=
- qp->hq_eventqueue->hil_evqueue.tail) {
- splx(s);
- return (revents | (events & (POLLIN | POLLRDNORM)));
- }
-
- selrecord(p, &dptr->hd_selr);
- splx(s);
- return (revents);
-}
-
-/*ARGSUSED*/
-void
-hilint(unit)
- int unit;
-{
-#ifdef hp300
- struct hil_softc *hilp = &hil_softc[0]; /* XXX how do we know on 300? */
-#else
- struct hil_softc *hilp = &hil_softc[unit];
-#endif
- struct hil_dev *hildevice = hilp->hl_addr;
- u_char c, stat;
-
- stat = READHILSTAT(hildevice);
- c = READHILDATA(hildevice); /* clears interrupt */
- hil_process_int(hilp, stat, c);
-}
-
-#include "ite.h"
-
-void
-hil_process_int(hilp, stat, c)
- struct hil_softc *hilp;
- u_char stat, c;
-{
-#ifdef DEBUG
- if (hildebug & HDB_EVENTS)
- printf("hilint: %x %x\n", stat, c);
-#endif
-
- /* the shift enables the compiler to generate a jump table */
- switch ((stat>>HIL_SSHIFT) & HIL_SMASK) {
-
-#if NITE > 0
- case HIL_KEY:
- case HIL_SHIFT:
- case HIL_CTRL:
- case HIL_CTRLSHIFT:
- itefilter(stat, c);
- return;
-#endif
-
- case HIL_STATUS: /* The status info. */
- if (c & HIL_ERROR) {
- hilp->hl_cmddone = TRUE;
- if (c == HIL_RECONFIG)
- hilconfig(hilp);
- break;
- }
- if (c & HIL_COMMAND) {
- if (c & HIL_POLLDATA) /* End of data */
- hilevent(hilp);
- else /* End of command */
- hilp->hl_cmdending = TRUE;
- hilp->hl_actdev = 0;
- } else {
- if (c & HIL_POLLDATA) { /* Start of polled data */
- if (hilp->hl_actdev != 0)
- hilevent(hilp);
- hilp->hl_actdev = (c & HIL_DEVMASK);
- hilp->hl_pollbp = hilp->hl_pollbuf;
- } else { /* Start of command */
- if (hilp->hl_cmddev == (c & HIL_DEVMASK)) {
- hilp->hl_cmdbp = hilp->hl_cmdbuf;
- hilp->hl_actdev = 0;
- }
- }
- }
- return;
-
- case HIL_DATA:
- if (hilp->hl_actdev != 0) /* Collecting poll data */
- *hilp->hl_pollbp++ = c;
- else if (hilp->hl_cmddev != 0) { /* Collecting cmd data */
- if (hilp->hl_cmdending) {
- hilp->hl_cmddone = TRUE;
- hilp->hl_cmdending = FALSE;
- } else
- *hilp->hl_cmdbp++ = c;
- }
- return;
-
- case 0: /* force full jump table */
- default:
- return;
- }
-}
-
-/*
- * Optimized macro to compute:
- * eq->head == (eq->tail + 1) % eq->size
- * i.e. has tail caught up with head. We do this because 32 bit long
- * remaidering is expensive (a function call with our compiler).
- */
-#define HQFULL(eq) (((eq)->head?(eq)->head:(eq)->size) == (eq)->tail+1)
-#define HQVALID(eq) \
- ((eq)->size == HEVQSIZE && (eq)->tail >= 0 && (eq)->tail < HEVQSIZE)
-
-void
-hilevent(hilp)
- struct hil_softc *hilp;
-{
- struct hilloopdev *dptr = &hilp->hl_device[hilp->hl_actdev];
- int len, mask, qnum;
- u_char *cp, *pp;
- HILQ *hq;
- struct timeval ourtime;
- hil_packet *proto;
- int s, len0;
- long tenths;
-
-#ifdef DEBUG
- if (hildebug & HDB_EVENTS) {
- printf("hilevent: dev %d pollbuf: ", hilp->hl_actdev);
- printhilpollbuf(hilp);
- printf("\n");
- }
-#endif
-
- /*
- * Note that HIL_READIN effectively "shuts off" any queues
- * that may have been in use at the time of an HILIOCHPUX call.
- */
- if (dptr->hd_flags & HIL_READIN) {
- hpuxhilevent(hilp, dptr);
- return;
- }
-
- /*
- * If this device isn't on any queue or there are no data
- * in the packet (can this happen?) do nothing.
- */
- if (dptr->hd_qmask == 0 ||
- (len0 = hilp->hl_pollbp - hilp->hl_pollbuf) <= 0)
- return;
-
- /*
- * Everybody gets the same time stamp
- */
- s = splclock();
- ourtime = time;
- splx(s);
- tenths = (ourtime.tv_sec * 100) + (ourtime.tv_usec / 10000);
-
- proto = NULL;
- mask = dptr->hd_qmask;
- for (qnum = 0; mask; qnum++) {
- if ((mask & hilqmask(qnum)) == 0)
- continue;
- mask &= ~hilqmask(qnum);
- hq = hilp->hl_queue[qnum].hq_eventqueue;
-
- /*
- * Ensure that queue fields that we rely on are valid
- * and that there is space in the queue. If either
- * test fails, we just skip this queue.
- */
- if (!HQVALID(&hq->hil_evqueue) || HQFULL(&hq->hil_evqueue))
- continue;
-
- /*
- * Copy data to queue.
- * If this is the first queue we construct the packet
- * with length, timestamp and poll buffer data.
- * For second and successive packets we just duplicate
- * the first packet.
- */
- pp = (u_char *) &hq->hil_event[hq->hil_evqueue.tail];
- if (proto == NULL) {
- proto = (hil_packet *)pp;
- cp = hilp->hl_pollbuf;
- len = len0;
- *pp++ = len + 6;
- *pp++ = hilp->hl_actdev;
- *(long *)pp = tenths;
- pp += sizeof(long);
- do *pp++ = *cp++; while (--len);
- } else
- *(hil_packet *)pp = *proto;
-
- if (++hq->hil_evqueue.tail == hq->hil_evqueue.size)
- hq->hil_evqueue.tail = 0;
- }
-
- /*
- * Wake up anyone polling this device or the loop itself
- */
- selwakeup(&dptr->hd_selr);
- dptr = &hilp->hl_device[HILLOOPDEV];
- selwakeup(&dptr->hd_selr);
-}
-
-#undef HQFULL
-
-void
-hpuxhilevent(hilp, dptr)
- struct hil_softc *hilp;
- struct hilloopdev *dptr;
-{
- int len;
- struct timeval ourtime;
- long tstamp;
- int s;
-
- /*
- * Everybody gets the same time stamp
- */
- s = splclock();
- ourtime = time;
- splx(s);
- tstamp = (ourtime.tv_sec * 100) + (ourtime.tv_usec / 10000);
-
- /*
- * Each packet that goes into the buffer must be preceded by the
- * number of bytes in the packet, and the timestamp of the packet.
- * This adds 5 bytes to the packet size. Make sure there is enough
- * room in the buffer for it, and if not, toss the packet.
- */
- len = hilp->hl_pollbp - hilp->hl_pollbuf;
- if (dptr->hd_queue.c_cc <= (HILMAXCLIST - (len+5))) {
- putc(len+5, &dptr->hd_queue);
- (void) b_to_q((u_char *)&tstamp, sizeof tstamp, &dptr->hd_queue);
- (void) b_to_q((u_char *)hilp->hl_pollbuf, len, &dptr->hd_queue);
- }
-
- /*
- * Wake up any one blocked on a read or poll
- */
- if (dptr->hd_flags & HIL_ASLEEP) {
- dptr->hd_flags &= ~HIL_ASLEEP;
- wakeup((caddr_t)dptr);
- }
- selwakeup(&dptr->hd_selr);
-}
-
-/*
- * Shared queue manipulation routines
- */
-
-int
-hilqalloc(hilp, qip, p)
- struct hil_softc *hilp;
- struct hilqinfo *qip;
- struct proc *p;
-{
-
-#ifdef DEBUG
- if (hildebug & HDB_FOLLOW)
- printf("hilqalloc(%d): addr %p\n", p->p_pid, qip->addr);
-#endif
- return(EINVAL);
-}
-
-int
-hilqfree(hilp, qnum, p)
- struct hil_softc *hilp;
- int qnum;
- struct proc *p;
-{
-
-#ifdef DEBUG
- if (hildebug & HDB_FOLLOW)
- printf("hilqfree(%d): qnum %d\n", p->p_pid, qnum);
-#endif
- return(EINVAL);
-}
-
-int
-hilqmap(hilp, qnum, device, p)
- struct hil_softc *hilp;
- int qnum, device;
- struct proc *p;
-{
- struct hilloopdev *dptr = &hilp->hl_device[device];
- int s;
-
-#ifdef DEBUG
- if (hildebug & HDB_FOLLOW)
- printf("hilqmap(%d): qnum %d device %x\n",
- p->p_pid, qnum, device);
-#endif
- if (qnum >= NHILQ || hilp->hl_queue[qnum].hq_procp != p)
- return(EINVAL);
- if ((dptr->hd_flags & HIL_QUEUEIN) == 0)
- return(EINVAL);
- if (dptr->hd_qmask && p->p_ucred->cr_uid &&
- p->p_ucred->cr_uid != dptr->hd_uid)
- return(EPERM);
-
- hilp->hl_queue[qnum].hq_devmask |= hildevmask(device);
- if (dptr->hd_qmask == 0)
- dptr->hd_uid = p->p_ucred->cr_uid;
- s = splhil();
- dptr->hd_qmask |= hilqmask(qnum);
- splx(s);
-#ifdef DEBUG
- if (hildebug & HDB_MASK)
- printf("hilqmap(%d): devmask %x qmask %x\n",
- p->p_pid, hilp->hl_queue[qnum].hq_devmask,
- dptr->hd_qmask);
-#endif
- return(0);
-}
-
-int
-hilqunmap(hilp, qnum, device, p)
- struct hil_softc *hilp;
- int qnum, device;
- struct proc *p;
-{
- int s;
-
-#ifdef DEBUG
- if (hildebug & HDB_FOLLOW)
- printf("hilqunmap(%d): qnum %d device %x\n",
- p->p_pid, qnum, device);
-#endif
-
- if (qnum >= NHILQ || hilp->hl_queue[qnum].hq_procp != p)
- return(EINVAL);
-
- hilp->hl_queue[qnum].hq_devmask &= ~hildevmask(device);
- s = splhil();
- hilp->hl_device[device].hd_qmask &= ~hilqmask(qnum);
- splx(s);
-#ifdef DEBUG
- if (hildebug & HDB_MASK)
- printf("hilqunmap(%d): devmask %x qmask %x\n",
- p->p_pid, hilp->hl_queue[qnum].hq_devmask,
- hilp->hl_device[device].hd_qmask);
-#endif
- return(0);
-}
-
-/*
- * Cooked keyboard functions for ite driver.
- * There is only one "cooked" ITE keyboard (the first keyboard found)
- * per loop. There may be other keyboards, but they will always be "raw".
- */
-
-void
-kbdbell(unit)
- int unit;
-{
- struct hil_softc *hilp = &hil_softc[unit];
-
- hilbeep(hilp, &default_bell);
-}
-
-void
-kbdenable(unit)
- int unit;
-{
- struct hil_softc *hilp = &hil_softc[unit];
- struct hil_dev *hildevice = hilp->hl_addr;
- char db;
-
- /* Set the autorepeat rate */
- db = ar_format(KBD_ARR);
- send_hil_cmd(hildevice, HIL_SETARR, &db, 1, NULL);
-
- /* Set the autorepeat delay */
- db = ar_format(KBD_ARD);
- send_hil_cmd(hildevice, HIL_SETARD, &db, 1, NULL);
-
- /* Enable interrupts */
- send_hil_cmd(hildevice, HIL_INTON, NULL, 0, NULL);
-}
-
-void
-kbddisable(unit)
- int unit;
-{
-}
-
-/*
- * The following chunk of code implements HIL console keyboard
- * support.
- */
-
-struct hil_dev *hilkbd_cn_device;
-char *kbd_cn_keymap;
-char *kbd_cn_shiftmap;
-char *kbd_cn_ctrlmap;
-
-/*
- * XXX: read keyboard directly and return code.
- * Used by console getchar routine. Could really screw up anybody
- * reading from the keyboard in the normal, interrupt driven fashion.
- */
-int
-kbdgetc(statp)
- int *statp;
-{
- int c, stat;
- int s;
-
- if (hilkbd_cn_device == NULL)
- return (0);
-
- /*
- * XXX needs to be splraise because we could be called
- * XXX at splhigh, e.g. in DDB.
- */
- s = splhil();
- while (((stat = READHILSTAT(hilkbd_cn_device)) & HIL_DATA_RDY) == 0)
- ;
- c = READHILDATA(hilkbd_cn_device);
- splx(s);
- *statp = stat;
- return (c);
-}
-
-/*
- * Perform basic initialization of the HIL keyboard, suitable
- * for early console use.
- */
-void
-kbdcninit()
-{
- struct hil_dev *h = HILADDR; /* == VA (see hilreg.h) */
- struct kbdmap *km;
- u_char lang;
-
- /* XXX from hil_keymaps.c */
- extern char us_keymap[], us_shiftmap[], us_ctrlmap[];
-
- hilkbd_cn_device = h;
-
- /* Default to US-ASCII keyboard. */
- kbd_cn_keymap = us_keymap;
- kbd_cn_shiftmap = us_shiftmap;
- kbd_cn_ctrlmap = us_ctrlmap;
-
- HILWAIT(h);
- WRITEHILCMD(h, HIL_SETARR);
- HILWAIT(h);
- WRITEHILDATA(h, ar_format(KBD_ARR));
- HILWAIT(h);
- WRITEHILCMD(h, HIL_READKBDLANG);
- HILDATAWAIT(h);
- lang = READHILDATA(h);
- for (km = kbd_map; km->kbd_code; km++) {
- if (km->kbd_code == lang) {
- kbd_cn_keymap = km->kbd_keymap;
- kbd_cn_shiftmap = km->kbd_shiftmap;
- kbd_cn_ctrlmap = km->kbd_ctrlmap;
- }
- }
- HILWAIT(h);
- WRITEHILCMD(h, HIL_INTON);
-}
-
-/* End of HIL console keyboard code. */
-
-/*
- * Recognize and clear keyboard generated NMIs.
- * Returns 1 if it was ours, 0 otherwise. Note that we cannot use
- * send_hil_cmd() to issue the clear NMI command as that would actually
- * lower the priority to splimp() and it doesn't wait for the completion
- * of the command. Either of these conditions could result in the
- * interrupt reoccuring. Note that we issue the CNMT command twice.
- * This seems to be needed, once is not always enough!?!
- */
-int
-kbdnmi()
-{
- struct hil_softc *hilp = &hil_softc[0]; /* XXX how do we know on 300? */
-
- if ((*KBDNMISTAT & KBDNMI) == 0)
- return(0);
-
- HILWAIT(hilp->hl_addr);
- WRITEHILCMD(hilp->hl_addr, HIL_CNMT);
- HILWAIT(hilp->hl_addr);
- WRITEHILCMD(hilp->hl_addr, HIL_CNMT);
- HILWAIT(hilp->hl_addr);
- return(1);
-}
-
-#define HILSECURITY 0x33
-#define HILIDENTIFY 0x03
-#define HILSCBIT 0x04
-
-/*
- * Called at boot time to print out info about interesting devices
- */
-void
-hilinfo(unit)
- int unit;
-{
- struct hil_softc *hilp = &hil_softc[unit];
- int id, len;
- struct kbdmap *km;
-
- /*
- * Keyboard info.
- */
- if (hilp->hl_kbddev) {
- printf("hil%d: ", hilp->hl_kbddev);
- for (km = kbd_map; km->kbd_code; km++)
- if (km->kbd_code == hilp->hl_kbdlang) {
- printf("%s ", km->kbd_desc);
- break;
- }
- printf("keyboard\n");
- }
- /*
- * ID module.
- * Attempt to locate the first ID module and print out its
- * security code. Is this a good idea??
- */
- id = hiliddev(hilp);
- if (id) {
- hilp->hl_cmdbp = hilp->hl_cmdbuf;
- hilp->hl_cmddev = id;
- send_hildev_cmd(hilp, id, HILSECURITY);
- len = hilp->hl_cmdbp - hilp->hl_cmdbuf;
- hilp->hl_cmdbp = hilp->hl_cmdbuf;
- hilp->hl_cmddev = 0;
- printf("hil%d: security code", id);
- for (id = 0; id < len; id++)
- printf(" %x", hilp->hl_cmdbuf[id]);
- while (id++ < 16)
- printf(" 0");
- printf("\n");
- }
-}
-
-#define HILAR1 0x3E
-#define HILAR2 0x3F
-
-/*
- * Called after the loop has reconfigured. Here we need to:
- * - determine how many devices are on the loop
- * (some may have been added or removed)
- * - locate the ITE keyboard (if any) and ensure
- * that it is in the proper state (raw or cooked)
- * and is set to use the proper language mapping table
- * - ensure all other keyboards are raw
- * Note that our device state is now potentially invalid as
- * devices may no longer be where they were. What we should
- * do here is either track where the devices went and move
- * state around accordingly or, more simply, just mark all
- * devices as HIL_DERROR and don't allow any further use until
- * they are closed. This is a little too brutal for my tastes,
- * we prefer to just assume people won't move things around.
- */
-void
-hilconfig(hilp)
- struct hil_softc *hilp;
-{
- u_char db;
- int s;
-
- s = splhil();
-#ifdef DEBUG
- if (hildebug & HDB_CONFIG) {
- printf("hilconfig: reconfigured: ");
- send_hil_cmd(hilp->hl_addr, HIL_READLPSTAT, NULL, 0, &db);
- printf("LPSTAT %x, ", db);
- send_hil_cmd(hilp->hl_addr, HIL_READLPCTRL, NULL, 0, &db);
- printf("LPCTRL %x, ", db);
- send_hil_cmd(hilp->hl_addr, HIL_READKBDSADR, NULL, 0, &db);
- printf("KBDSADR %x\n", db);
- hilreport(hilp);
- }
-#endif
- /*
- * Determine how many devices are on the loop.
- * Mark those as alive and real, all others as dead.
- */
- db = 0;
- send_hil_cmd(hilp->hl_addr, HIL_READLPSTAT, NULL, 0, &db);
- hilp->hl_maxdev = db & LPS_DEVMASK;
-#ifdef DEBUG
- if (hildebug & HDB_CONFIG)
- printf("hilconfig: %d devices found\n", hilp->hl_maxdev);
-#endif
- for (db = 1; db < NHILD; db++) {
- if (db <= hilp->hl_maxdev)
- hilp->hl_device[db].hd_flags |= HIL_ALIVE;
- else
- hilp->hl_device[db].hd_flags &= ~HIL_ALIVE;
- hilp->hl_device[db].hd_flags &= ~HIL_PSEUDO;
- }
-#ifdef DEBUG
- if (hildebug & (HDB_CONFIG|HDB_KEYBOARD))
- printf("hilconfig: max device %d\n", hilp->hl_maxdev);
-#endif
- if (hilp->hl_maxdev == 0) {
- hilp->hl_kbddev = 0;
- splx(s);
- return;
- }
- /*
- * Find out where the keyboards are and record the ITE keyboard
- * (first one found). If no keyboards found, we are all done.
- */
- db = 0;
- send_hil_cmd(hilp->hl_addr, HIL_READKBDSADR, NULL, 0, &db);
-#ifdef DEBUG
- if (hildebug & HDB_KEYBOARD)
- printf("hilconfig: keyboard: KBDSADR %x, old %d, new %d\n",
- db, hilp->hl_kbddev, ffs((int)db));
-#endif
- hilp->hl_kbddev = ffs((int)db);
- if (hilp->hl_kbddev == 0) {
- splx(s);
- return;
- }
- /*
- * Determine if the keyboard should be cooked or raw and configure it.
- */
- db = (hilp->hl_kbdflags & KBD_RAW) ? 0 : 1 << (hilp->hl_kbddev - 1);
- send_hil_cmd(hilp->hl_addr, HIL_WRITEKBDSADR, &db, 1, NULL);
- /*
- * Re-enable autorepeat in raw mode, cooked mode AR is not affected.
- */
- if (hilp->hl_kbdflags & (KBD_AR1|KBD_AR2)) {
- db = (hilp->hl_kbdflags & KBD_AR1) ? HILAR1 : HILAR2;
- hilp->hl_cmddev = hilp->hl_kbddev;
- send_hildev_cmd(hilp, hilp->hl_kbddev, db);
- hilp->hl_cmddev = 0;
- }
- /*
- * Determine the keyboard language configuration, but don't
- * override a user-specified setting.
- */
- db = 0;
- send_hil_cmd(hilp->hl_addr, HIL_READKBDLANG, NULL, 0, &db);
-#ifdef DEBUG
- if (hildebug & HDB_KEYBOARD)
- printf("hilconfig: language: old %x new %x\n",
- hilp->hl_kbdlang, db);
-#endif
- if (hilp->hl_kbdlang != KBD_SPECIAL) {
- struct kbdmap *km;
-
- for (km = kbd_map; km->kbd_code; km++) {
- if (km->kbd_code == db) {
- hilp->hl_kbdlang = db;
- /* XXX */
- kbd_keymap = km->kbd_keymap;
- kbd_shiftmap = km->kbd_shiftmap;
- kbd_ctrlmap = km->kbd_ctrlmap;
- kbd_ctrlshiftmap = km->kbd_ctrlshiftmap;
- kbd_stringmap = km->kbd_stringmap;
- break;
- }
- }
- if (km->kbd_code == 0) {
- printf(
- "hilconfig: unknown keyboard type 0x%x, using default\n",
- db);
- }
- }
- splx(s);
-}
-
-void
-hilreset(hilp)
- struct hil_softc *hilp;
-{
- struct hil_dev *hildevice = hilp->hl_addr;
- u_char db;
-
-#ifdef DEBUG
- if (hildebug & HDB_FOLLOW)
- printf("hilreset(%p)\n", hilp);
-#endif
- /*
- * Initialize the loop: reconfigure, don't report errors,
- * cook keyboards, and enable autopolling.
- */
- db = LPC_RECONF | LPC_KBDCOOK | LPC_NOERROR | LPC_AUTOPOLL;
- send_hil_cmd(hildevice, HIL_WRITELPCTRL, &db, 1, NULL);
- /*
- * Delay one second for reconfiguration and then read the the
- * data to clear the interrupt (if the loop reconfigured).
- */
- DELAY(1000000);
- if (READHILSTAT(hildevice) & HIL_DATA_RDY)
- db = READHILDATA(hildevice);
- /*
- * The HIL loop may have reconfigured. If so we proceed on,
- * if not we loop until a successful reconfiguration is reported
- * back to us. The HIL loop will continue to attempt forever.
- * Probably not very smart.
- */
- do {
- send_hil_cmd(hildevice, HIL_READLPSTAT, NULL, 0, &db);
- } while ((db & (LPS_CONFFAIL|LPS_CONFGOOD)) == 0);
- /*
- * At this point, the loop should have reconfigured.
- * The reconfiguration interrupt has already called hilconfig()
- * so the keyboard has been determined.
- */
- send_hil_cmd(hildevice, HIL_INTON, NULL, 0, NULL);
-}
-
-void
-hilbeep(hilp, bp)
- struct hil_softc *hilp;
- struct _hilbell *bp;
-{
- u_char buf[2];
-
- buf[0] = ~((bp->duration - 10) / 10);
- buf[1] = bp->frequency;
- send_hil_cmd(hilp->hl_addr, HIL_SETTONE, buf, 2, NULL);
-}
-
-/*
- * Locate and return the address of the first ID module, 0 if none present.
- */
-int
-hiliddev(hilp)
- struct hil_softc *hilp;
-{
- int i, len;
-
-#ifdef DEBUG
- if (hildebug & HDB_IDMODULE)
- printf("hiliddev(%p): max %d, looking for idmodule...",
- hilp, hilp->hl_maxdev);
-#endif
- for (i = 1; i <= hilp->hl_maxdev; i++) {
- hilp->hl_cmdbp = hilp->hl_cmdbuf;
- hilp->hl_cmddev = i;
- send_hildev_cmd(hilp, i, HILIDENTIFY);
- /*
- * XXX: the final condition checks to ensure that the
- * device ID byte is in the range of the ID module (0x30-0x3F)
- */
- len = hilp->hl_cmdbp - hilp->hl_cmdbuf;
- if (len > 1 && (hilp->hl_cmdbuf[1] & HILSCBIT) &&
- (hilp->hl_cmdbuf[0] & 0xF0) == 0x30) {
- hilp->hl_cmdbp = hilp->hl_cmdbuf;
- hilp->hl_cmddev = i;
- send_hildev_cmd(hilp, i, HILSECURITY);
- break;
- }
- }
- hilp->hl_cmdbp = hilp->hl_cmdbuf;
- hilp->hl_cmddev = 0;
-#ifdef DEBUG
- if (hildebug & HDB_IDMODULE) {
- if (i <= hilp->hl_maxdev)
- printf("found at %d\n", i);
- else
- printf("not found\n");
- }
-#endif
- return(i <= hilp->hl_maxdev ? i : 0);
-}
-
-#ifdef COMPAT_HPUX
-/*
- * XXX map devno as expected by HP-UX
- */
-int
-hildevno(dev)
- dev_t dev;
-{
- int newdev;
-
- newdev = 24 << 24;
-#ifdef HILCOMPAT
- /*
- * XXX compat check
- * Don't convert old style specfiles already in correct format
- */
- if (minor(dev) && (dev & 0xF) == 0)
- newdev |= minor(dev);
- else
-#endif
- newdev |= (HILLOOP(dev) << 8) | (HILUNIT(dev) << 4);
- return(newdev);
-}
-#endif
-
-/*
- * Low level routines which actually talk to the 8042 chip.
- */
-
-/*
- * Send a command to the 8042 with zero or more bytes of data.
- * If rdata is non-null, wait for and return a byte of data.
- * We run at splimp() to make the transaction as atomic as
- * possible without blocking the clock (is this necessary?)
- */
-void
-send_hil_cmd(hildevice, cmd, data, dlen, rdata)
- struct hil_dev *hildevice;
- u_char cmd, *data, dlen;
- u_char *rdata;
-{
- u_char status;
- int s = splimp();
-
- HILWAIT(hildevice);
- WRITEHILCMD(hildevice, cmd);
- while (dlen--) {
- HILWAIT(hildevice);
- WRITEHILDATA(hildevice, *data++);
- }
- if (rdata) {
- do {
- HILDATAWAIT(hildevice);
- status = READHILSTAT(hildevice);
- *rdata = READHILDATA(hildevice);
- } while (((status >> HIL_SSHIFT) & HIL_SMASK) != HIL_68K);
- }
- splx(s);
-}
-
-/*
- * Send a command to a device on the loop.
- * Since only one command can be active on the loop at any time,
- * we must ensure that we are not interrupted during this process.
- * Hence we mask interrupts to prevent potential access from most
- * interrupt routines and turn off auto-polling to disable the
- * internally generated poll commands.
- *
- * splhigh is extremely conservative but insures atomic operation,
- * splimp (clock only interrupts) seems to be good enough in practice.
- */
-void
-send_hildev_cmd(hilp, device, cmd)
- struct hil_softc *hilp;
- char device, cmd;
-{
- struct hil_dev *hildevice = hilp->hl_addr;
- u_char status, c;
- int s = splimp();
-
- polloff(hildevice);
-
- /*
- * Transfer the command and device info to the chip
- */
- HILWAIT(hildevice);
- WRITEHILCMD(hildevice, HIL_STARTCMD);
- HILWAIT(hildevice);
- WRITEHILDATA(hildevice, 8 + device);
- HILWAIT(hildevice);
- WRITEHILDATA(hildevice, cmd);
- HILWAIT(hildevice);
- WRITEHILDATA(hildevice, HIL_TIMEOUT);
- /*
- * Trigger the command and wait for completion
- */
- HILWAIT(hildevice);
- WRITEHILCMD(hildevice, HIL_TRIGGER);
- hilp->hl_cmddone = FALSE;
- do {
- HILDATAWAIT(hildevice);
- status = READHILSTAT(hildevice);
- c = READHILDATA(hildevice);
- hil_process_int(hilp, status, c);
- } while (!hilp->hl_cmddone);
-
- pollon(hildevice);
- splx(s);
-}
-
-/*
- * Turn auto-polling off and on.
- * Also disables and enable auto-repeat. Why?
- */
-void
-polloff(hildevice)
- struct hil_dev *hildevice;
-{
- char db;
-
- /*
- * Turn off auto repeat
- */
- HILWAIT(hildevice);
- WRITEHILCMD(hildevice, HIL_SETARR);
- HILWAIT(hildevice);
- WRITEHILDATA(hildevice, 0);
- /*
- * Turn off auto-polling
- */
- HILWAIT(hildevice);
- WRITEHILCMD(hildevice, HIL_READLPCTRL);
- HILDATAWAIT(hildevice);
- db = READHILDATA(hildevice);
- db &= ~LPC_AUTOPOLL;
- HILWAIT(hildevice);
- WRITEHILCMD(hildevice, HIL_WRITELPCTRL);
- HILWAIT(hildevice);
- WRITEHILDATA(hildevice, db);
- /*
- * Must wait til polling is really stopped
- */
- do {
- HILWAIT(hildevice);
- WRITEHILCMD(hildevice, HIL_READBUSY);
- HILDATAWAIT(hildevice);
- db = READHILDATA(hildevice);
- } while (db & BSY_LOOPBUSY);
-}
-
-void
-pollon(hildevice)
- struct hil_dev *hildevice;
-{
- char db;
-
- /*
- * Turn on auto polling
- */
- HILWAIT(hildevice);
- WRITEHILCMD(hildevice, HIL_READLPCTRL);
- HILDATAWAIT(hildevice);
- db = READHILDATA(hildevice);
- db |= LPC_AUTOPOLL;
- HILWAIT(hildevice);
- WRITEHILCMD(hildevice, HIL_WRITELPCTRL);
- HILWAIT(hildevice);
- WRITEHILDATA(hildevice, db);
- /*
- * Turn on auto repeat
- */
- HILWAIT(hildevice);
- WRITEHILCMD(hildevice, HIL_SETARR);
- HILWAIT(hildevice);
- WRITEHILDATA(hildevice, ar_format(KBD_ARR));
-}
-
-#ifdef DEBUG
-void
-printhilpollbuf(hilp)
- struct hil_softc *hilp;
-{
- u_char *cp;
- int i, len;
-
- cp = hilp->hl_pollbuf;
- len = hilp->hl_pollbp - cp;
- for (i = 0; i < len; i++)
- printf("%x ", hilp->hl_pollbuf[i]);
- printf("\n");
-}
-
-void
-printhilcmdbuf(hilp)
- struct hil_softc *hilp;
-{
- u_char *cp;
- int i, len;
-
- cp = hilp->hl_cmdbuf;
- len = hilp->hl_cmdbp - cp;
- for (i = 0; i < len; i++)
- printf("%x ", hilp->hl_cmdbuf[i]);
- printf("\n");
-}
-
-void
-hilreport(hilp)
- struct hil_softc *hilp;
-{
- int i, len;
- int s = splhil();
-
- for (i = 1; i <= hilp->hl_maxdev; i++) {
- hilp->hl_cmdbp = hilp->hl_cmdbuf;
- hilp->hl_cmddev = i;
- send_hildev_cmd(hilp, i, HILIDENTIFY);
- printf("hil%d: id: ", i);
- printhilcmdbuf(hilp);
- len = hilp->hl_cmdbp - hilp->hl_cmdbuf;
- if (len > 1 && (hilp->hl_cmdbuf[1] & HILSCBIT)) {
- hilp->hl_cmdbp = hilp->hl_cmdbuf;
- hilp->hl_cmddev = i;
- send_hildev_cmd(hilp, i, HILSECURITY);
- printf("hil%d: sc: ", i);
- printhilcmdbuf(hilp);
- }
- }
- hilp->hl_cmdbp = hilp->hl_cmdbuf;
- hilp->hl_cmddev = 0;
- splx(s);
-}
-#endif
diff --git a/sys/arch/hp300/dev/hil_intio.c b/sys/arch/hp300/dev/hil_intio.c
new file mode 100644
index 00000000000..65d24aa781c
--- /dev/null
+++ b/sys/arch/hp300/dev/hil_intio.c
@@ -0,0 +1,97 @@
+/* $OpenBSD: hil_intio.c,v 1.1 2005/01/14 22:39:25 miod Exp $ */
+
+/*
+ * Copyright (c) 2005, Miodrag Vallat.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/cpu.h>
+#include <machine/intr.h>
+
+#include <hp300/dev/intiovar.h>
+
+#include <machine/hil_machdep.h>
+#include <machine/bus.h>
+#include <dev/hil/hilvar.h>
+
+int hil_intio_match(struct device *, void *, void *);
+void hil_intio_attach(struct device *, struct device *, void *);
+
+struct cfattach hil_intio_ca = {
+ sizeof(struct hil_softc), hil_intio_match, hil_intio_attach
+};
+
+int
+hil_intio_match(struct device *parent, void *match, void *aux)
+{
+ struct intio_attach_args *ia = aux;
+static int hil_matched = 0;
+
+ /* Allow only one instance. */
+ if (hil_matched != 0)
+ return (0);
+
+ if (badaddr((caddr_t)IIOV(HILADDR))) /* should not happen! */
+ return (0);
+
+ ia->ia_addr = (caddr_t)HILADDR;
+ return (1);
+}
+
+struct isr hil_isr;
+
+void
+hil_intio_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct hil_softc *sc = (void *)self;
+ int hil_is_console;
+
+ sc->sc_bst = HP300_BUS_TAG(HP300_BUS_INTIO, 0);
+ if (bus_space_map(sc->sc_bst, HILADDR - INTIOBASE,
+ HILMAPSIZE, 0, &sc->sc_bsh) != 0) {
+ printf(": couldn't map hil controller\n");
+ return;
+ }
+
+ /*
+ * For now, HIL is always considered as a valid console keyboard,
+ * as we do not attach the Domain keyboard yet.
+ */
+ hil_is_console = 1;
+
+ hil_attach(sc, hil_is_console);
+
+ hil_isr.isr_func = hil_intr;
+ hil_isr.isr_arg = sc;
+ hil_isr.isr_ipl = 1;
+ hil_isr.isr_priority = IPL_TTY;
+ intr_establish(&hil_isr, self->dv_xname);
+
+ startuphook_establish(hil_attach_deferred, sc);
+}
diff --git a/sys/arch/hp300/dev/hil_keymaps.c b/sys/arch/hp300/dev/hil_keymaps.c
deleted file mode 100644
index a1207a3e9f0..00000000000
--- a/sys/arch/hp300/dev/hil_keymaps.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/* $OpenBSD: hil_keymaps.c,v 1.5 2003/06/02 23:27:44 millert Exp $ */
-/* $NetBSD: hil_keymaps.c,v 1.7 1997/03/31 07:34:22 scottr 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. 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: hil_keymaps.c 1.1 90/07/09$
- *
- * @(#)hil_keymaps.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Keymaps for various HP-HIL keyboard layouts. These tables apply only to
- * keyboards in "cooked" mode. Currently only one is supported as an ITE
- * keyboard.
- *
- * Maps are indexed by cooked keycode and contain the ASCII character for
- * that keycode. The map-set used depends on the keyboard "language". The
- * map used within that set depends on the shift/control status that is
- * returned by the hardware along with the keycode. If an entry is NULL for
- * a key in the appropriate unshifted, shifted, control, or control-shifted
- * table, then a single "string" table is consulted. In this fashion, a
- * multi- character sequence can be returned for a key press. Note that
- * control/shift status have no effect on multi-character lookup (i.e. there
- * is only one string table per set, not four).
- *
- * Someday we could allow user-definable keymaps, but we would have to come up
- * with a better format (at least externally). This format takes up lots of
- * space. Having keymaps for all 18 or so HP supported layouts would be bad
- * news.
- */
-#include <sys/param.h>
-#include <hp300/dev/kbdmap.h>
-
-char us_keymap[] = {
- NULL, '`', '\\', ESC, NULL, DEL, NULL, NULL,
- '\n', '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\n', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, '\b', NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- ESC, '\r', NULL, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', 'E', '(', ')', '^',
- '1', '2', '3', '4', '5', '6', '7', '8',
- '9', '0', '-', '=', '[', ']', ';', '\'',
- ',', '.', '/', '\040', 'o', 'p', 'k', 'l',
- 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
- 'a', 's', 'd', 'f', 'g', 'h', 'j', 'm',
- 'z', 'x', 'c', 'v', 'b', 'n', NULL, NULL
-};
-
-char us_shiftmap[] = {
- NULL, '~', '|', DEL, NULL, DEL, NULL, NULL,
- '\n', '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\n', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, DEL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- ESC, '\r', NULL, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', '`', '|', '\\', '~',
- '!', '@', '#', '$', '%', '^', '&', '*',
- '(', ')', '_', '+', '{', '}', ':', '\"',
- '<', '>', '?', '\040', 'O', 'P', 'K', 'L',
- 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
- 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'M',
- 'Z', 'X', 'C', 'V', 'B', 'N', NULL, NULL
-};
-
-char us_ctrlmap[] = {
- NULL, '`', '\034', ESC, NULL, DEL, NULL, NULL,
- '\n', '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\n', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, '\b', NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- ESC, '\r', NULL, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', 'E', '(', ')', '\036',
- '1', '2', '3', '4', '5', '6', '7', '8',
- '9', '0', '-', '=', '\033', '\035', ';', '\'',
- ',', '.', '/', '\040', '\017', '\020', '\013', '\014',
- '\021', '\027', '\005', '\022', '\024', '\031', '\025', '\011',
- '\001', '\023', '\004', '\006', '\007', '\010', '\012', '\015',
- '\032', '\030', '\003', '\026', '\002', '\016', NULL, NULL
-};
-
-char us_ctrlshiftmap[] = {
- NULL, '~', '|', DEL, NULL, DEL, NULL, NULL,
- '\n', '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\n', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, DEL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- ESC, '\r', NULL, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', '`', '|', '\034', '~',
- '!', '\000', '#', '$', '%', '\036', '&', '*',
- '(', ')', '\037', '+', '{', '}', ':', '\"',
- '<', '>', '?', '\040', '\017', '\020', '\013', '\014',
- '\021', '\027', '\005', '\022', '\024', '\031', '\025', '\011',
- '\001', '\023', '\004', '\006', '\007', '\010', '\012', '\015',
- '\032', '\030', '\003', '\026', '\002', '\016', NULL, NULL
-};
-
-char *us_stringmap[] = {
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, "\033V","\033h",
- "\033U",NULL, NULL, NULL, NULL, NULL, "\033K","\033J",
- NULL, NULL, NULL, "\033p","\033q","\033t","\033u","\033v",
- "\033r","\033s","\033B","\033A","\033w",NULL, "\033D","\033C",
- "\033L","\033M",NULL, NULL, "\033P",NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
-};
-
-#ifdef UK_KEYBOARD
-char uk_keymap[] = {
- NULL, '`', '<', ESC, NULL, DEL, NULL, NULL,
- '\n', '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\n', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, '\b', NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- ESC, '\r', NULL, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', 'E', '(', ')', '^',
- '1', '2', '3', '4', '5', '6', '7', '8',
- '9', '0', '+', '\'', '[', ']', '*', '\\',
- ',', '.', '-', '\040', 'o', 'p', 'k', 'l',
- 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
- 'a', 's', 'd', 'f', 'g', 'h', 'j', 'm',
- 'z', 'x', 'c', 'v', 'b', 'n', NULL, NULL
-};
-
-char uk_shiftmap[] = {
- NULL, '~', '>', DEL, NULL, DEL, NULL, NULL,
- '\n', '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\n', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, DEL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- ESC, '\r', NULL, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', '`', '|', '\\', '~',
- '!', '\"', '#', '$', '%', '&', '^', '(',
- ')', '=', '?', '/', '{', '}', '@', '|',
- ';', ':', '_', '\040', 'O', 'P', 'K', 'L',
- 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
- 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'M',
- 'Z', 'X', 'C', 'V', 'B', 'N', NULL, NULL
-};
-
-char uk_ctrlmap[] = {
- NULL, '`', '<', ESC, NULL, DEL, NULL, NULL,
- '\n', '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\n', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, '\b', NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- ESC, '\r', NULL, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', 'E', '(', ')', '\036',
- '1', '2', '3', '4', '5', '6', '7', '8',
- '9', '0', '+', '\'', '\033', '\035', '*', '\034',
- ',', '.', '/', '\040', '\017', '\020', '\013', '\014',
- '\021', '\027', '\005', '\022', '\024', '\031', '\025', '\011',
- '\001', '\023', '\004', '\006', '\007', '\010', '\012', '\015',
- '\032', '\030', '\003', '\026', '\002', '\016', NULL, NULL
-};
-
-char uk_ctrlshiftmap[] = {
- NULL, '~', '>', DEL, NULL, DEL, NULL, NULL,
- '\n', '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\n', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, DEL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- ESC, '\r', NULL, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', '`', '|', '\034', '~',
- '!', '\"', '#', '$', '%', '&', '\036', '(',
- ')', '=', '?', '/', '{', '}', '\000', '|',
- ';', ':', '\037', '\040', '\017', '\020', '\013', '\014',
- '\021', '\027', '\005', '\022', '\024', '\031', '\025', '\011',
- '\001', '\023', '\004', '\006', '\007', '\010', '\012', '\015',
- '\032', '\030', '\003', '\026', '\002', '\016', NULL, NULL
-};
-#endif
-
-#ifdef SE_KEYBOARD
-char se_keymap[] = {
- NULL, '<', '\'', ESC, NULL, DEL, NULL, NULL,
- '\n', '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\n', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, '\b', NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- ESC, '\r', NULL, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', 'E', '(', ')', '^',
- '1', '2', '3', '4', '5', '6', '7', '8',
- '9', '0', '+', '`', '}', '~', '|', '{',
- ',', '.', '-', '\040', 'o', 'p', 'k', 'l',
- 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
- 'a', 's', 'd', 'f', 'g', 'h', 'j', 'm',
- 'z', 'x', 'c', 'v', 'b', 'n', NULL, NULL
-};
-
-char se_shiftmap[] = {
- NULL, '>', '*', DEL, NULL, DEL, NULL, NULL,
- '\n', '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\n', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, DEL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- ESC, '\r', NULL, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '-', '`', '*', '\\', '>',
- '!', '\"', '#', '$', '%', '&', '/', '(',
- ')', '=', '?', '@', ']', '^', '\\', '[',
- ';', ':', '_', '\040', 'O', 'P', 'K', 'L',
- 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
- 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'M',
- 'Z', 'X', 'C', 'V', 'B', 'N', NULL, NULL
-};
-
-char se_ctrlmap[] = {
- NULL, '`', '\034', ESC, NULL, DEL, NULL, NULL,
- '\n', '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\n', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, '\b', NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- ESC, '\r', NULL, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', 'E', '(', ')', '\036',
- '1', '2', '3', '4', '5', '6', '7', '8',
- '9', '0', '-', '=', '\033', '\035', ';', '\'',
- ',', '.', '/', '\040', '\017', '\020', '\013', '\014',
- '\021', '\027', '\005', '\022', '\024', '\031', '\025', '\011',
- '\001', '\023', '\004', '\006', '\007', '\010', '\012', '\015',
- '\032', '\030', '\003', '\026', '\002', '\016', NULL, NULL
-};
-
-char se_ctrlshiftmap[] = {
- NULL, '~', '|', DEL, NULL, DEL, NULL, NULL,
- '\n', '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\n', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, '\t', NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, DEL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- ESC, '\r', NULL, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', '`', '|', '\034', '~',
- '!', '\000', '#', '$', '%', '\036', '&', '*',
- '(', ')', '\037', '+', '{', '}', ':', '\"',
- '<', '>', '?', '\040', '\017', '\020', '\013', '\014',
- '\021', '\027', '\005', '\022', '\024', '\031', '\025', '\011',
- '\001', '\023', '\004', '\006', '\007', '\010', '\012', '\015',
- '\032', '\030', '\003', '\026', '\002', '\016', NULL, NULL
-};
-#endif
-
-/*
- * The keyboard map table.
- * Lookup is by hardware returned language code.
- */
-struct kbdmap kbd_map[] = {
- { KBD_US, "US ASCII",
- us_keymap, us_shiftmap, us_ctrlmap, us_ctrlshiftmap, us_stringmap },
-
-#ifdef UK_KEYBOARD
- { KBD_UK, "United Kingdom",
- uk_keymap, uk_shiftmap, uk_ctrlmap, uk_ctrlshiftmap, us_stringmap },
-#endif
-
-#ifdef SE_KEYBOARD
- { KBD_SE, "Swedish",
- se_keymap, se_shiftmap, se_ctrlmap, se_ctrlshiftmap, us_stringmap },
-#endif
-
- { 0, NULL, NULL, NULL, NULL, NULL, NULL },
-};
diff --git a/sys/arch/hp300/dev/hilioctl.h b/sys/arch/hp300/dev/hilioctl.h
deleted file mode 100644
index fa75e5ba01c..00000000000
--- a/sys/arch/hp300/dev/hilioctl.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/* $OpenBSD: hilioctl.h,v 1.3 2003/06/02 23:27:44 millert Exp $ */
-/* $NetBSD: hilioctl.h,v 1.6 1994/10/26 07:24:14 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. 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: hilioctl.h 1.10 92/01/21$
- *
- * @(#)hilioctl.h 8.1 (Berkeley) 6/10/93
- */
-
-struct _hilbell {
- u_char duration;
- u_char frequency;
-};
-
-struct _hilbuf16 {
- u_char string[16];
-};
-
-struct _hilbuf11 {
- u_char string[11];
-};
-
-struct _hilbuf5 {
- u_char string[5];
-};
-
-struct _hilbuf4 {
- u_char string[4];
-};
-
-struct _hilbuf2 {
- u_char string[2];
-};
-
-struct hilqinfo {
- int qid;
- char *addr;
-};
-
-/*
- * HPUX ioctls (here for the benefit of the HIL driver).
- * Named as they are under HPUX.
- * The first set are loop device ioctls.
- * The second set are ioctls for the 8042.
- * Note that some are not defined as in HPUX
- * due to the difference in the definitions of IOC_VOID.
- */
-#ifdef hp800
-#define _IOHpux(x,y) _IO(x,y)
-#else
-#define _IOHpux(x,y) (IOC_IN|((x)<<8)|y) /* IOC_IN is IOC_VOID */
-#endif
-
-/*
- * The HP compiler (at least as of HP-UX 7.X) pads odd sized structures
- * to a short boundary. To avoid issues of whether our compiler pads
- * and, if so to what boundary, we explicitly state the values for
- * troublesome ioctls:
- *
- * HILID (HILIOCID) _IOR('h',0x03, struct _hilbuf11),
- * EFTRRT (HILIOCRRT) _IOR('H',0x31, struct _hilbuf5).
- */
-#define HILID 0x400C6803 /* Identify & describe */
-#define HILSC _IOR('h',0x33, struct _hilbuf16) /* Security code */
-#define HILRN _IOR('h',0x30, struct _hilbuf16) /* Report name */
-#define HILRS _IOR('h',0x31, struct _hilbuf16) /* Report status */
-#define HILED _IOR('h',0x32, struct _hilbuf16) /* Extended describe*/
-#define HILDKR _IOHpux('h',0x3D) /* Disable autorepeat */
-#define HILER1 _IOHpux('h',0x3E) /* Autorepeat 1/30 */
-#define HILER2 _IOHpux('h',0x3F) /* Autorepeat 1/60 */
-#define HILP1 _IOHpux('h',0x40) /* Prompt 1 */
-#define HILP2 _IOHpux('h',0x41) /* Prompt 2 */
-#define HILP3 _IOHpux('h',0x42) /* Prompt 3 */
-#define HILP4 _IOHpux('h',0x43) /* Prompt 4 */
-#define HILP5 _IOHpux('h',0x44) /* Prompt 5 */
-#define HILP6 _IOHpux('h',0x45) /* Prompt 6 */
-#define HILP7 _IOHpux('h',0x46) /* Prompt 7 */
-#define HILP _IOHpux('h',0x47) /* Prompt */
-#define HILA1 _IOHpux('h',0x48) /* Acknowledge 1 */
-#define HILA2 _IOHpux('h',0x49) /* Acknowledge 2 */
-#define HILA3 _IOHpux('h',0x4A) /* Acknowledge 3 */
-#define HILA4 _IOHpux('h',0x4B) /* Acknowledge 4 */
-#define HILA5 _IOHpux('h',0x4C) /* Acknowledge 5 */
-#define HILA6 _IOHpux('h',0x4D) /* Acknowledge 6 */
-#define HILA7 _IOHpux('h',0x4E) /* Acknowledge 7 */
-#define HILA _IOHpux('h',0x4F) /* Acknowledge */
-
-#define EFTSRD _IOW('H',0xa0,char) /* Set the repeat delay. */
-#define EFTSRR _IOW('H',0xa2,char) /* Set the repeat rate. */
-#define EFTSRPG _IOW('H',0xa6,char) /* Set RPG interrupt rate. */
-#define EFTSBP _IOW('H',0xc4,struct _hilbuf4) /* Send data to the beeper. */
-#define EFTRLC _IOR('H',0x12,char) /* Read the language code. */
-#define EFTRCC _IOR('H',0x11,char) /* Read configuration code. */
-#define EFTRRT 0x40064831 /* Read the real time. */
-#define EFTRT _IOR('H',0xf4,struct _hilbuf4) /* Read the timers for the
- four voices. */
-#ifdef hp800
-#define EFTSBI _IOW('H',0xa3,char) /* Do the beep thing. */
-#else
-#define EFTSBI _IOW('H',0xa3,struct _hilbuf2) /* Set the bell information. */
-#endif
-
-/*
- * BSD ioctls.
- * Mostly the same as the HPUX versions except for shared-queue ioctls.
- */
-#define OHILIOCID 0x400B6803 /* XXX compat */
-#define HILIOCID HILID
-#define HILIOCSC _IOR('h',0x33, struct _hilbuf16)
-#define HILIOCRN _IOR('h',0x30, struct _hilbuf16)
-#define HILIOCRS _IOR('h',0x31, struct _hilbuf16)
-#define HILIOCED _IOR('h',0x32, struct _hilbuf16)
-#define HILIOCAROFF _IO('h',0x3D)
-#define HILIOCAR1 _IO('h',0x3E)
-#define HILIOCAR2 _IO('h',0x3F)
-#define HILIOCSBP _IOW('H',0xc4,struct _hilbuf4)
-#define OHILIOCRRT 0x40054831 /* XXX compat */
-#define HILIOCRRT EFTRRT
-#define HILIOCRT _IOR('H',0xf4,struct _hilbuf4)
-#define HILIOCBEEP _IOW('H',0xA3,struct _hilbell)
-# define BELLDUR 80 /* tone duration in msec (10 - 2560) */
-# define BELLFREQ 8 /* tone frequency (0 - 63) */
-
-#define HILIOCALLOCQ _IOWR('H',0x72, struct hilqinfo) /* allocate queue */
-#define HILIOCFREEQ _IOW('H',0x73, struct hilqinfo) /* deallocate queue */
-#define HILIOCMAPQ _IOW('H',0x74, int) /* map device to queue */
-#define HILIOCUNMAPQ _IOW('H',0x75, int) /* unmap device from dev */
-#define HILIOCTEST _IOW('H',0x76, int) /* Toggle debugging mode */
-#define HILIOCHPUX _IO('H',0x77) /* use HPUX (read) semantics */
-#define HILIOCRESET _IO('H',0x78) /* Reset the HIL loop. */
-
-/*
- * HIL input queue.
- * This is the circular queue (allocated by HILIOCALLOC) shared by kernel
- * and user. It consists of a sixteen byte header followed by space for
- * 255 input data packets (a total of 4096 bytes). The kernel adds packets
- * at tail. The user is expected to remove packets from head. This is the
- * only field in the header that the user should modify.
- */
-typedef struct hil_packet {
- u_char size; /* total packet size */
- u_char dev; /* loop device packet was generated by */
- long tstamp; /* time stamp */
- u_char data[10]; /* device data */
-} hil_packet;
-
-typedef struct hil_eventqueue {
- int size;
- int head;
- int tail;
- int pad;
-} hil_eventqueue;
-
-typedef union hilqueue {
- char hqu_size[0x1000];
- struct q_data {
- hil_eventqueue h_eventqueue;
- hil_packet h_event[1];
- } q_data;
-#define hil_evqueue q_data.h_eventqueue
-#define hil_event q_data.h_event
-} HILQ;
-
-#define HEVQSIZE \
- ((sizeof(HILQ) - sizeof(struct q_data)) / sizeof(hil_packet) + 1)
diff --git a/sys/arch/hp300/dev/hilreg.h b/sys/arch/hp300/dev/hilreg.h
deleted file mode 100644
index 2b2f7737c78..00000000000
--- a/sys/arch/hp300/dev/hilreg.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/* $OpenBSD: hilreg.h,v 1.4 2003/06/02 23:27:44 millert Exp $ */
-/* $NetBSD: hilreg.h,v 1.6 1997/02/02 09:39:21 thorpej 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. 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: hilreg.h 1.10 92/01/21$
- *
- * @(#)hilreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-#ifdef hp300
-struct hil_dev {
- char hil_pad0;
- vu_char hil_data;
- char hil_pad1;
- vu_char hil_cmd;
-};
-
-#define HILADDR ((struct hil_dev *)IIOV(0x428000))
-#define BBCADDR ((struct hil_dev *)IIOV(0x420000))
-#endif
-
-#ifdef hp800
-#ifdef hp700
-struct hil_dev {
- vu_char hil_rsthold; /* (WO) reset hold (and Serial #3) */
- vu_char hil_resv1[2047];
- vu_char hil_data; /* send/receive data to/from 8042 */
- vu_char hil_cmd; /* status/control to/from 8042 */
- vu_char hil_resv2[1022];
- vu_char hil_rstrel; /* (WO) reset release (and Serial #3) */
-
-};
-#else
-struct hil_dev {
- vu_int hil_data;
- vu_int hil_pad;
- vu_int hil_cmd;
-};
-#endif
-#endif
-#define hil_stat hil_cmd
-
-#if defined(hp300) || defined(hp700)
-#define READHILDATA(x) ((x)->hil_data)
-#define READHILSTAT(x) ((x)->hil_stat)
-#define READHILCMD(x) ((x)->hil_cmd)
-#define WRITEHILDATA(x, y) ((x)->hil_data = (y))
-#define WRITEHILSTAT(x, y) ((x)->hil_stat = (y))
-#define WRITEHILCMD(x, y) ((x)->hil_cmd = (y))
-#else
-#define READHILDATA(x) ((x)->hil_data >> 24)
-#define READHILSTAT(x) ((x)->hil_stat >> 24)
-#define READHILCMD(x) ((x)->hil_cmd >> 24)
-#define WRITEHILDATA(x, y) ((x)->hil_data = ((y) << 24))
-#define WRITEHILSTAT(x, y) ((x)->hil_stat = ((y) << 24))
-#define WRITEHILCMD(x, y) ((x)->hil_cmd = ((y) << 24))
-#endif
-
-#define HIL_BUSY 0x02
-#define HIL_DATA_RDY 0x01
-
-#define HILWAIT(hil_dev) while ((READHILSTAT(hil_dev) & HIL_BUSY))
-#define HILDATAWAIT(hil_dev) while (!(READHILSTAT(hil_dev) & HIL_DATA_RDY))
-
-/* HIL status bits */
-#define HIL_POLLDATA 0x10 /* HIL poll data follows */
-#define HIL_COMMAND 0x08 /* Start of original command */
-#define HIL_ERROR 0x080 /* HIL error */
-#define HIL_RECONFIG 0x080 /* HIL has reconfigured */
-#define HIL_STATMASK (HIL_DATA | HIL_COMMAND)
-
-#define HIL_SSHIFT 4 /* Bits to shift status over */
-#define HIL_SMASK 0xF /* Service request status mask */
-#define HIL_DEVMASK 0x07
-
-/* HIL status types */
-#define HIL_STATUS 0x5 /* HIL status in data register */
-#define HIL_DATA 0x6 /* HIL data in data register */
-#define HIL_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */
-#define HIL_CTRL 0x9 /* key + CTRL */
-#define HIL_SHIFT 0xA /* key + SHIFT */
-#define HIL_KEY 0xB /* key only */
-#define HIL_68K 0x4 /* Data from the 68k is ready */
-
-/* HIL commands */
-#define HIL_SETARD 0xA0 /* set auto-repeat delay */
-#define HIL_SETARR 0xA2 /* set auto-repeat rate */
-#define HIL_SETTONE 0xA3 /* set tone generator */
-#define HIL_CNMT 0xB2 /* clear nmi */
-#define HIL_INTON 0x5C /* Turn on interrupts. */
-#define HIL_INTOFF 0x5D /* Turn off interrupts. */
-#define HIL_TRIGGER 0xC5 /* trigger command */
-#define HIL_STARTCMD 0xE0 /* start loop command */
-#define HIL_TIMEOUT 0xFE /* timeout */
-#define HIL_READTIME 0x13 /* Read real time register */
-
-/* Read/write various registers on the 8042. */
-#define HIL_READBUSY 0x02 /* internal "busy" register */
-#define HIL_READKBDLANG 0x12 /* read keyboard language code */
-#define HIL_READKBDSADR 0xF9
-#define HIL_WRITEKBDSADR 0xE9
-#define HIL_READLPSTAT 0xFA
-#define HIL_WRITELPSTAT 0xEA
-#define HIL_READLPCTRL 0xFB
-#define HIL_WRITELPCTRL 0xEB
-
-/* BUSY bits */
-#define BSY_LOOPBUSY 0x04
-
-/* LPCTRL bits */
-#define LPC_AUTOPOLL 0x01 /* enable auto-polling */
-#define LPC_NOERROR 0x02 /* don't report errors */
-#define LPC_NORECONF 0x04 /* don't report reconfigure */
-#define LPC_KBDCOOK 0x10 /* cook all keyboards */
-#define LPC_RECONF 0x80 /* reconfigure the loop */
-
-/* LPSTAT bits */
-#define LPS_DEVMASK 0x07 /* number of loop devices */
-#define LPS_CONFGOOD 0x08 /* reconfiguration worked */
-#define LPS_CONFFAIL 0x80 /* reconfiguration failed */
-
-/* HIL packet headers */
-#define HIL_MOUSEDATA 0x2
-#define HIL_KBDDATA 0x40
-
-#define HIL_MOUSEMOTION 0x02 /* mouse movement event */
-#define HIL_KBDBUTTON 0x40 /* keyboard button event */
-#define HIL_MOUSEBUTTON 0x40 /* mouse button event */
-#define HIL_BUTTONBOX 0x60 /* button box event */
-#define HIL_TABLET 0x02 /* tablet motion event */
-#define HIL_KNOBBOX 0x03 /* knob box motion data */
-
-/* For setting auto repeat on the keyboard */
-#define ar_format(x) ~((x - 10) / 10)
-#define KBD_ARD 400 /* initial delay in msec (10 - 2560) */
-#define KBD_ARR 60 /* rate (10 - 2550 msec, 2551 == off) */
-
-#ifdef hp300
-/* Magic */
-#define KBDNMISTAT ((volatile char *)IIOV(0x478005))
-#define KBDNMI 0x04
-#endif
diff --git a/sys/arch/hp300/dev/hilvar.h b/sys/arch/hp300/dev/hilvar.h
deleted file mode 100644
index 5e9e6195e1c..00000000000
--- a/sys/arch/hp300/dev/hilvar.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* $OpenBSD: hilvar.h,v 1.6 2003/06/02 23:27:44 millert Exp $ */
-/* $NetBSD: hilvar.h,v 1.14 1997/04/01 19:29:10 scottr 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. 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: hilvar.h 1.3 92/01/21$
- *
- * @(#)hilvar.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
-#define NHILD 8 /* 7 actual + loop pseudo (dev 0) */
-#define NHILQ 8 /* must be <= sizeof(int) */
-
-#define HILBUFSIZE 40 /* size of interrupt poll buffer */
-#define HILMAXCLIST 1024 /* max chars in clists for HPUX io */
-
-#define HILLOOPDEV 0 /* loop device index */
-
-/*
- * Minor device numbers.
- * HP-UX uses 12 bits of the form:
- * LLLLDDDD0000
- * where L is 4 bits of loop number, D 4 bits of device and 4 bits of 0.
- * BSD uses 8 bits:
- * LLLLDDDD
- * Device files are in BSD format, we map device numbers to HP-UX format
- * on stat calls.
- */
-#define HILUNIT(d) ((d) & 0xF)
-#define HILLOOP(d) (((d)>>4) & 0xF)
-
-#define hildevmask(d) (1 << (d))
-#define hilqmask(q) (1 << (q))
-
-struct hiliqueue {
- HILQ *hq_eventqueue; /* input queue shared with user */
- struct proc *hq_procp; /* process this queue belongs to */
- char hq_devmask; /* devices mapped to this queue */
-};
-
-struct hilloopdev {
- int hd_flags; /* device state */
- int hd_qmask; /* queues this device is mapped to */
- struct clist hd_queue; /* event queue for HPUX-style input */
- struct selinfo hd_selr; /* process read selecting */
- uid_t hd_uid; /* uid of mapping process */
-};
-
-/* hd_flags */
-#define HIL_ALIVE 0x01 /* device is present */
-#define HIL_PSEUDO 0x02 /* device is virtual */
-#define HIL_READIN 0x04 /* device using read() input interface */
-#define HIL_QUEUEIN 0x08 /* device using shared Q input interface */
-#define HIL_OPENED 0x10 /* flag for first open */
-#define HIL_NOBLOCK 0x20 /* device is in non-blocking read mode */
-#define HIL_ASLEEP 0x40 /* process awaiting input on device */
-#define HIL_DERROR 0x80 /* loop has reconfigured, reality altered */
-
-struct hil_softc {
- struct hil_dev *hl_addr; /* base of hardware registers */
- u_char hl_cmddone; /* */
- u_char hl_cmdending; /* */
- u_char hl_actdev; /* current input device */
- u_char hl_cmddev; /* device to perform command on */
- u_char hl_pollbuf[HILBUFSIZE]; /* interrupt time input buffer */
- u_char hl_cmdbuf[HILBUFSIZE]; /* */
- u_char *hl_pollbp; /* pointer into hl_pollbuf */
- u_char *hl_cmdbp; /* pointer into hl_cmdbuf */
- struct hiliqueue hl_queue[NHILQ]; /* input queues */
- struct hilloopdev hl_device[NHILD]; /* device data */
- u_char hl_maxdev; /* number of devices on loop */
- u_char hl_kbddev; /* keyboard device on loop */
- u_char hl_kbdlang; /* keyboard language */
- u_char hl_kbdflags; /* keyboard state */
-};
-
-/* hl_kbdflags */
-#define KBD_RAW 0x01 /* keyboard is raw */
-#define KBD_AR1 0x02 /* keyboard auto-repeat rate 1 */
-#define KBD_AR2 0x04 /* keyboard auto-repeat rate 2 */
-
-#ifdef _KERNEL
-void kbdbell(int);
-void kbdenable(int);
-void kbddisable(int);
-int kbdgetc(int *);
-void kbdcninit(void);
-
-int kbdnmi(void);
-
-void hilsoftinit(int, struct hil_dev *);
-void hilinit(int, struct hil_dev *);
-
-void send_hil_cmd(struct hil_dev *, u_char,
- u_char *, u_char, u_char *);
-void send_hildev_cmd(struct hil_softc *, char, char);
-
-void polloff(struct hil_dev *);
-void pollon(struct hil_dev *);
-
-#ifdef COMPAT_HPUX
-int hpuxhilioctl(dev_t, int, caddr_t, int);
-int hildevno(dev_t);
-#endif /* COMPAT_HPUX */
-#endif /* _KERNEL */
diff --git a/sys/arch/hp300/dev/hyper.c b/sys/arch/hp300/dev/hyper.c
new file mode 100644
index 00000000000..36c1b6b9b0d
--- /dev/null
+++ b/sys/arch/hp300/dev/hyper.c
@@ -0,0 +1,634 @@
+/* $OpenBSD: hyper.c,v 1.1 2005/01/14 22:39:25 miod Exp $ */
+
+/*
+ * Copyright (c) 2005, Miodrag Vallat.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ */
+/*
+ * 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.
+ *
+ * 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. 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: grf_hy.c 1.2 93/08/13$
+ *
+ * @(#)grf_hy.c 8.4 (Berkeley) 1/12/94
+ */
+
+/*
+ * Graphics routines for HYPERION frame buffer
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+#include <sys/ioctl.h>
+#include <sys/proc.h>
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+#include <machine/cpu.h>
+
+#include <hp300/dev/dioreg.h>
+#include <hp300/dev/diovar.h>
+#include <hp300/dev/diodevs.h>
+#include <hp300/dev/intiovar.h>
+
+#include <dev/cons.h>
+
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wsdisplayvar.h>
+
+#include <hp300/dev/diofbreg.h>
+#include <hp300/dev/diofbvar.h>
+#include <hp300/dev/hyperreg.h>
+
+struct hyper_softc {
+ struct device sc_dev;
+ struct diofb *sc_fb;
+ struct diofb sc_fb_store;
+};
+
+int hyper_dio_match(struct device *, void *, void *);
+void hyper_dio_attach(struct device *, struct device *, void *);
+
+struct cfattach hyper_dio_ca = {
+ sizeof(struct hyper_softc), hyper_dio_match, hyper_dio_attach
+};
+
+struct cfdriver hyper_cd = {
+ NULL, "hyper", DV_DULL
+};
+
+void hyper_fontunpack(struct diofb *);
+int hyper_reset(struct diofb *, int, struct diofbreg *);
+void hyper_windowmove(struct diofb *, u_int16_t, u_int16_t,
+ u_int16_t, u_int16_t, u_int16_t, u_int16_t, int);
+
+int hyper_ioctl(void *, u_long, caddr_t, int, struct proc *);
+void hyper_burner(void *, u_int, u_int);
+
+struct wsdisplay_accessops hyper_accessops = {
+ hyper_ioctl,
+ diofb_mmap,
+ diofb_alloc_screen,
+ diofb_free_screen,
+ diofb_show_screen,
+ NULL, /* load_font */
+ NULL, /* scrollback */
+ NULL, /* getchar */
+ hyper_burner
+};
+
+/*
+ * Attachment glue
+ */
+
+int
+hyper_dio_match(struct device *parent, void *match, void *aux)
+{
+ struct dio_attach_args *da = aux;
+
+ if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
+ da->da_secid == DIO_DEVICE_SECID_HYPERION)
+ return (1);
+
+ return (0);
+}
+
+void
+hyper_dio_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct hyper_softc *sc = (struct hyper_softc *)self;
+ struct dio_attach_args *da = aux;
+ struct diofbreg *fbr;
+ int scode;
+
+ scode = da->da_scode;
+ if (scode == conscode) {
+ fbr = (struct diofbreg *)conaddr; /* already mapped */
+ sc->sc_fb = &diofb_cn;;
+ } else {
+ sc->sc_fb = &sc->sc_fb_store;
+ fbr = (struct diofbreg *)
+ iomap(dio_scodetopa(scode), da->da_size);
+ if (fbr == NULL ||
+ hyper_reset(sc->sc_fb, scode, fbr) != 0) {
+ printf(": can't map framebuffer\n");
+ return;
+ }
+ }
+
+ diofb_end_attach(self, &hyper_accessops, sc->sc_fb,
+ scode == conscode, 0, NULL);
+}
+
+/*
+ * Initialize hardware and display routines.
+ */
+int
+hyper_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
+{
+ volatile struct hyboxfb *hy = (struct hyboxfb *)fbr;
+ int rc;
+
+ if ((rc = diofb_fbinquire(fb, scode, fbr, 0x20000)) != 0)
+ return (rc);
+
+ fb->planes = hy->num_planes;
+ fb->planemask = (1 << fb->planes) - 1;
+
+ fb->bmv = hyper_windowmove;
+ diofb_fbsetup(fb);
+ hyper_fontunpack(fb);
+
+ /*
+ * Enable display.
+ */
+ hy->nblank = 0x05;
+
+ return (0);
+}
+
+int
+hyper_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
+{
+ struct diofb *fb = v;
+ struct wsdisplay_fbinfo *wdf;
+
+ switch (cmd) {
+ case WSDISPLAYIO_GTYPE:
+ *(u_int *)data = WSDISPLAY_TYPE_UNKNOWN;
+ break;
+ case WSDISPLAYIO_GINFO:
+ wdf = (void *)data;
+ wdf->height = fb->dheight;
+ wdf->width = fb->dwidth;
+ wdf->depth = fb->planes;
+ wdf->cmsize = 0;
+ break;
+ case WSDISPLAYIO_LINEBYTES:
+ *(u_int *)data = (fb->fbwidth * fb->planes) >> 3;
+ break;
+ case WSDISPLAYIO_GVIDEO:
+ case WSDISPLAYIO_SVIDEO:
+ case WSDISPLAYIO_GETCMAP:
+ case WSDISPLAYIO_PUTCMAP:
+ break;
+ default:
+ return (-1);
+ }
+
+ return (0);
+}
+
+void
+hyper_burner(void *v, u_int on, u_int flags)
+{
+ struct diofb *fb = v;
+ volatile struct hyboxfb *hy = (struct hyboxfb *)fb->regkva;
+
+ if (on) {
+ hy->nblank = 0x05;
+ } else {
+ hy->nblank = 0x00;
+ }
+}
+
+/*
+ * Display routines
+ */
+
+void
+hyper_fontunpack(struct diofb *fb)
+{
+ u_char *fbmem, *dp;
+ int c, l, b;
+ int stride, width;
+
+ /*
+ * The PROM font is packed more tightly on the Hyperion than on
+ * other DIO framebuffers.
+ * Compensate the diofb_fontsetup() computations and unpack.
+ */
+
+ fb->ftscale = roundup(fb->ftwidth, 8);
+ fb->cpl = (fb->fbwidth - fb->dwidth) / fb->ftscale;
+ fb->cblanky = fb->fonty + ((FONTMAXCHAR / fb->cpl) + 1) * fb->ftheight;
+
+ dp = (u_char *)(getword(fb, getword(fb, FONTROM) + FONTADDR) +
+ fb->regkva) + FONTDATA;
+
+ stride = fb->fbwidth >> 3;
+ width = (fb->ftwidth + 7) >> 3;
+ for (c = 0; c < FONTMAXCHAR; c++) {
+ fbmem = (u_char *)FBBASE(fb) +
+ (fb->fonty + (c / fb->cpl) * fb->ftheight) * stride +
+ (fb->fontx >> 3) + (c % fb->cpl) * width;
+ for (l = 0; l < fb->ftheight; l++) {
+ for (b = 0; b < width; b++) {
+ *fbmem++ = *dp;
+ dp += 2;
+ }
+ fbmem -= width;
+ fbmem += stride;
+ }
+ }
+}
+
+#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.
+ */
+const 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
+};
+
+const 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(struct diofb *fb, u_int16_t sx, u_int16_t sy,
+ u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int rop)
+{
+ int width; /* add to get to same position in next line */
+
+ unsigned int *psrcLine, *pdstLine;
+ /* pointers to line with current src and dst */
+ unsigned int *psrc; /* pointer to current src longword */
+ 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 */
+ int nl; /* temp copy of nlMiddle */
+ unsigned int tmpSrc;
+ /* place to store full source word */
+ 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? */
+
+ width = fb->fbwidth >> 5;
+
+ if (sy < dy) { /* start at last scanline of rectangle */
+ psrcLine = ((u_int *)fb->fbkva) + ((sy + cy - 1) * width);
+ pdstLine = ((u_int *)fb->fbkva) + ((dy + cy - 1) * width);
+ width = -width;
+ } else { /* start at first scanline */
+ psrcLine = ((u_int *)fb->fbkva) + (sy * width);
+ pdstLine = ((u_int *)fb->fbkva) + (dy * width);
+ }
+
+ /* x direction doesn't matter for < 1 longword */
+ if (cx <= 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 (cy--) {
+ getandputrop(psrc, srcBit, dstBit, cx, pdst, rop);
+ pdst += width;
+ psrc += width;
+ }
+ } else {
+ maskbits(dx, cx, startmask, endmask, nlMiddle);
+ if (startmask)
+ nstart = 32 - (dx & 0x1f);
+ else
+ nstart = 0;
+ if (endmask)
+ nend = (dx + cx) & 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 (cy--) {
+ psrc = psrcLine;
+ pdst = pdstLine;
+
+ if (startmask) {
+ getandputrop(psrc, (sx & 0x1f),
+ (dx & 0x1f), nstart, pdst, rop);
+ pdst++;
+ if (srcStartOver)
+ psrc++;
+ }
+
+ /* special case for aligned operations */
+ if (xoffSrc == 0) {
+ nl = nlMiddle;
+ while (nl--) {
+ DoRop(*pdst, rop, *psrc++,
+ *pdst);
+ pdst++;
+ }
+ } else {
+ nl = nlMiddle + 1;
+ while (--nl) {
+ getunalignedword(psrc, xoffSrc,
+ tmpSrc);
+ DoRop(*pdst, rop, tmpSrc,
+ *pdst);
+ pdst++;
+ psrc++;
+ }
+ }
+
+ if (endmask) {
+ getandputrop0(psrc, xoffSrc, nend,
+ pdst, rop);
+ }
+
+ pdstLine += width;
+ psrcLine += width;
+ }
+ } else { /* move right to left */
+ pdstLine += ((dx + cx) >> 5);
+ psrcLine += ((sx + cx) >> 5);
+ /*
+ * If fetch of last partial bits from source crosses
+ * a longword boundary, start at the previous longword
+ */
+ if (xoffSrc + nend >= 32)
+ --psrcLine;
+
+ while (cy--) {
+ psrc = psrcLine;
+ pdst = pdstLine;
+
+ if (endmask) {
+ getandputrop0(psrc, xoffSrc, nend,
+ pdst, rop);
+ }
+
+ nl = nlMiddle + 1;
+ while (--nl) {
+ --psrc;
+ --pdst;
+ getunalignedword(psrc, xoffSrc, tmpSrc);
+ DoRop(*pdst, rop, tmpSrc, *pdst);
+ }
+
+ if (startmask) {
+ if (srcStartOver)
+ --psrc;
+ --pdst;
+ getandputrop(psrc, (sx & 0x1f),
+ (dx & 0x1f), nstart, pdst, rop);
+ }
+
+ pdstLine += width;
+ psrcLine += width;
+ }
+ }
+ }
+}
+
+/*
+ * Hyperion console support
+ */
+
+int hyper_console_scan(int, caddr_t, void *);
+cons_decl(hyper);
+
+int
+hyper_console_scan(int scode, caddr_t va, void *arg)
+{
+ struct diofbreg *fbr = (struct diofbreg *)va;
+ struct consdev *cp = arg;
+ u_char *dioiidev;
+ int force = 0, pri;
+
+ if (fbr->id != GRFHWID || fbr->id2 != GID_HYPERION)
+ return (0);
+
+ pri = CN_INTERNAL;
+
+#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 >= DIOII_SCBASE) {
+ dioiidev = (u_char *)va;
+ return ((dioiidev[0x101] + 1) * 0x100000);
+ }
+ return (DIO_DEVSIZE);
+ }
+ return (0);
+}
+
+void
+hypercnprobe(struct consdev *cp)
+{
+ int maj;
+ caddr_t va;
+ struct diofbreg *fbr;
+ int force = 0;
+
+ /* Abort early if console is already forced. */
+ if (conforced)
+ return;
+
+ for (maj = 0; maj < nchrdev; maj++) {
+ if (cdevsw[maj].d_open == wsdisplayopen)
+ break;
+ }
+
+ if (maj == nchrdev)
+ return;
+
+ cp->cn_dev = makedev(maj, 0);
+ cp->cn_pri = CN_DEAD;
+
+ /* Look for "internal" framebuffer. */
+ va = (caddr_t)IIOV(GRFIADDR);
+ fbr = (struct diofbreg *)va;
+ if (!badaddr(va) &&
+ (fbr->id == GRFHWID && fbr->id2 == GID_HYPERION)) {
+ cp->cn_pri = CN_INTERNAL;
+
+#ifdef CONSCODE
+ if (CONSCODE == -1) {
+ 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, HP300_BUS_DIO);
+}
+
+void
+hypercninit(struct consdev *cp)
+{
+ long defattr;
+
+ hyper_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
+ diofb_alloc_attr(NULL, 0, 0, 0, &defattr);
+ wsdisplay_cnattach(&diofb_cn.wsd, &diofb_cn, 0, 0, defattr);
+}
diff --git a/sys/arch/hp300/dev/grf_hyreg.h b/sys/arch/hp300/dev/hyperreg.h
index 0bf7c6cb936..ab7e7204ff7 100644
--- a/sys/arch/hp300/dev/grf_hyreg.h
+++ b/sys/arch/hp300/dev/hyperreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: grf_hyreg.h,v 1.3 2003/06/02 23:27:44 millert Exp $ */
+/* $OpenBSD: hyperreg.h,v 1.1 2005/01/14 22:39:25 miod Exp $ */
/* $NetBSD: grf_hyreg.h,v 1.2 1994/10/26 07:23:57 cgd Exp $ */
/*
@@ -40,40 +40,38 @@
* @(#)grf_hyreg.h 8.1 (Berkeley) 6/10/93
*/
-#include <hp300/dev/iotypes.h> /* XXX */
-
struct hyboxfb {
- u_char :8;
- vu_char reset; /* reset register 0x01 */
- vu_char fb_address; /* frame buffer address 0x02 */
- vu_char interrupt; /* interrupt register 0x03 */
- u_char :8;
- vu_char fbwmsb; /* frame buffer width MSB 0x05 */
- u_char :8;
- vu_char fbwlsb; /* frame buffer width MSB 0x07 */
- u_char :8;
- vu_char fbhmsb; /* frame buffer height MSB 0x09 */
- u_char :8;
- vu_char fbhlsb; /* frame buffer height MSB 0x0b */
- u_char :8;
- vu_char dwmsb; /* display width MSB 0x0d */
- u_char :8;
- vu_char dwlsb; /* display width MSB 0x0f */
- u_char :8;
- vu_char dhmsb; /* display height MSB 0x11 */
- u_char :8;
- vu_char dhlsb; /* display height MSB 0x13 */
- u_char :8;
- vu_char fbid; /* Scondary frame buffer id 0x15 */
- u_char :8;
- vu_char bits; /* square(0)/double-high(1) 0x17 */
- u_char f1[0x5b-0x17-1];
- vu_char num_planes; /* number of color planes 0x5b */
- u_char :8;
- vu_char fbomsb; /* frame buffer offset MSB 0x5d */
- u_char :8;
- vu_char fbolsb; /* frame buffer offset LSB 0x5f */
- u_char f2[0x4000-0x5f-1];
- vu_char nblank; /* display enable planes 0x4000 */
+ u_int8_t :8;
+ u_int8_t reset; /* reset register 0x01 */
+ u_int8_t fb_address; /* frame buffer address 0x02 */
+ u_int8_t interrupt; /* interrupt register 0x03 */
+ u_int8_t :8;
+ u_int8_t fbwmsb; /* frame buffer width MSB 0x05 */
+ u_int8_t :8;
+ u_int8_t fbwlsb; /* frame buffer width MSB 0x07 */
+ u_int8_t :8;
+ u_int8_t fbhmsb; /* frame buffer height MSB 0x09 */
+ u_int8_t :8;
+ u_int8_t fbhlsb; /* frame buffer height MSB 0x0b */
+ u_int8_t :8;
+ u_int8_t dwmsb; /* display width MSB 0x0d */
+ u_int8_t :8;
+ u_int8_t dwlsb; /* display width MSB 0x0f */
+ u_int8_t :8;
+ u_int8_t dhmsb; /* display height MSB 0x11 */
+ u_int8_t :8;
+ u_int8_t dhlsb; /* display height MSB 0x13 */
+ u_int8_t :8;
+ u_int8_t fbid; /* Scondary frame buffer id 0x15 */
+ u_int8_t :8;
+ u_int8_t bits; /* square(0)/double-high(1) 0x17 */
+ u_int8_t f1[0x5b-0x17-1];
+ u_int8_t num_planes; /* number of color planes 0x5b */
+ u_int8_t :8;
+ u_int8_t fbomsb; /* frame buffer offset MSB 0x5d */
+ u_int8_t :8;
+ u_int8_t fbolsb; /* frame buffer offset LSB 0x5f */
+ u_int8_t f2[0x4000-0x5f-1];
+ u_int8_t nblank; /* display enable planes 0x4000 */
};
diff --git a/sys/arch/hp300/dev/ite.c b/sys/arch/hp300/dev/ite.c
deleted file mode 100644
index 460a1187ac0..00000000000
--- a/sys/arch/hp300/dev/ite.c
+++ /dev/null
@@ -1,1003 +0,0 @@
-/* $OpenBSD: ite.c,v 1.16 2003/10/03 16:44:49 miod Exp $ */
-/* $NetBSD: ite.c,v 1.38 1997/03/31 07:37:25 scottr 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.
- *
- * 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. 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.c 1.28 92/12/20$
- *
- * @(#)ite.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * Bit-mapped display terminal emulator machine independent code.
- * This is a very rudimentary. Much more can be abstracted out of
- * the hardware dependent routines.
- */
-
-#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/malloc.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-
-#include <dev/cons.h>
-
-#include <hp300/dev/grfioctl.h>
-#include <hp300/dev/grfvar.h>
-#include <hp300/dev/hilioctl.h>
-#include <hp300/dev/hilvar.h>
-#include <hp300/dev/itevar.h>
-#include <hp300/dev/kbdmap.h>
-
-/* prototypes for devsw entry points */
-cdev_decl(ite);
-
-#define set_attr(ip, attr) ((ip)->attribute |= (attr))
-#define clr_attr(ip, attr) ((ip)->attribute &= ~(attr))
-
-/*
- * # of chars are output in a single itestart() call.
- * If this is too big, user processes will be blocked out for
- * long periods of time while we are emptying the queue in itestart().
- * If it is too small, console output will be very ragged.
- */
-int iteburst = 64;
-
-struct ite_data *kbd_ite = NULL;
-
-int itematch(struct device *, void *, void *);
-void iteattach(struct device *, struct device *, void *);
-
-struct cfattach ite_ca = {
- sizeof(struct ite_softc), itematch, iteattach
-};
-
-struct cfdriver ite_cd = {
- NULL, "ite", DV_TTY
-};
-
-/*
- * Terminal emulator state information, statically allocated
- * for the benefit of the console.
- */
-struct ite_data ite_cn;
-
-void iteinit(struct ite_data *);
-void iteputchar(int, struct ite_data *);
-void itecheckwrap(struct ite_data *, struct itesw *);
-void ite_dchar(struct ite_data *, struct itesw *);
-void ite_ichar(struct ite_data *, struct itesw *);
-void ite_dline(struct ite_data *, struct itesw *);
-void ite_iline(struct ite_data *, struct itesw *);
-void ite_clrtoeol(struct ite_data *, struct itesw *, int, int);
-void ite_clrtoeos(struct ite_data *, struct itesw *);
-void itestart(struct tty *);
-
-/*
- * Primary attribute buffer to be used by the first bitmapped console
- * found. Secondary displays alloc the attribute buffer as needed.
- * Size is based on a 68x128 display, which is currently our largest.
- */
-u_char ite_console_attributes[0x2200];
-
-#define ite_erasecursor(ip, sp) { \
- if ((ip)->flags & ITE_CURSORON) \
- (*(sp)->ite_cursor)((ip), ERASE_CURSOR); \
-}
-#define ite_drawcursor(ip, sp) { \
- if ((ip)->flags & ITE_CURSORON) \
- (*(sp)->ite_cursor)((ip), DRAW_CURSOR); \
-}
-#define ite_movecursor(ip, sp) { \
- if ((ip)->flags & ITE_CURSORON) \
- (*(sp)->ite_cursor)((ip), MOVE_CURSOR); \
-}
-
-int
-itematch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
-
- return (1);
-}
-
-void
-iteattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct ite_softc *ite = (struct ite_softc *)self;
- struct grf_softc *grf = (struct grf_softc *)parent;
- struct grfdev_attach_args *ga = aux;
-
- /* Allocate the ite_data. */
- if (ga->ga_isconsole) {
- ite->sc_data = &ite_cn;
- printf(": console");
-
- /*
- * 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(), self->dv_unit);
- } else {
- ite->sc_data =
- (struct ite_data *)malloc(sizeof(struct ite_data),
- M_DEVBUF, M_NOWAIT);
- if (ite->sc_data == NULL) {
- printf("\n%s: malloc for ite_data failed\n",
- ite->sc_dev.dv_xname);
- return;
- }
- bzero(ite->sc_data, sizeof(struct ite_data));
- ite->sc_data->isw = (struct itesw *)ga->ga_ite;
- ite->sc_data->grf = (struct grf_data *)ga->ga_data;
- ite->sc_data->flags = ITE_ALIVE;
- }
-
- /*
- * Cross-reference the ite and the grf.
- */
- ite->sc_grf = grf;
- grf->sc_ite = ite;
-
- printf("\n");
-}
-
-/*
- * Perform functions necessary to setup device as a terminal emulator.
- */
-int
-iteon(ip, flag)
- struct ite_data *ip;
- int flag;
-{
-
- 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(0); /* XXX */
- }
-
- iteinit(ip);
- return(0);
-}
-
-void
-iteinit(ip)
- struct ite_data *ip;
-{
-
- if (ip->flags & ITE_INITED)
- return;
-
- ip->curx = 0;
- ip->cury = 0;
- ip->cursorx = 0;
- ip->cursory = 0;
-
- (*ip->isw->ite_init)(ip);
- ip->flags |= ITE_CURSORON;
- ite_drawcursor(ip, ip->isw);
-
- ip->attribute = 0;
- if (ip->attrbuf == NULL)
- ip->attrbuf = (u_char *)
- malloc(ip->rows * ip->cols, M_DEVBUF, M_WAITOK);
- bzero(ip->attrbuf, (ip->rows * ip->cols));
-
- ip->imode = 0;
- ip->flags |= ITE_INITED;
-}
-
-/*
- * "Shut down" device as terminal emulator.
- * Note that we do not deinit the console device unless forced.
- * Deinit'ing the console every time leads to a very active
- * screen when processing /etc/rc.
- */
-void
-iteoff(ip, flag)
- struct ite_data *ip;
- int flag;
-{
-
- if (flag & 2) {
- ip->flags |= ITE_INGRF;
- ip->flags &= ~ITE_CURSORON;
- }
- if ((ip->flags & ITE_ACTIVE) == 0)
- return;
- if ((flag & 1) ||
- (ip->flags & (ITE_INGRF|ITE_ISCONS|ITE_INITED)) == ITE_INITED)
- (*ip->isw->ite_deinit)(ip);
-
- /*
- * XXX When the system is rebooted with "reboot", init(8)
- * kills the last process to have the console open.
- * If we don't prevent the ITE_ACTIVE bit from being
- * cleared, we will never see messages printed during
- * the process of rebooting.
- */
- if ((flag & 2) == 0 && (ip->flags & ITE_ISCONS) == 0)
- ip->flags &= ~ITE_ACTIVE;
-}
-
-/* ARGSUSED */
-int
-iteopen(dev, mode, devtype, p)
- dev_t dev;
- int mode, devtype;
- struct proc *p;
-{
- int unit = ITEUNIT(dev);
- struct tty *tp;
- struct ite_softc *sc;
- struct ite_data *ip;
- int error;
- int first = 0;
-
- if (unit >= ite_cd.cd_ndevs ||
- (sc = ite_cd.cd_devs[unit]) == NULL)
- return (ENXIO);
- ip = sc->sc_data;
-
- if (ip->tty == NULL) {
- tp = ip->tty = ttymalloc();
- } else
- 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(ip, 0);
- if (error)
- return (error);
- first = 1;
- }
- tp->t_oproc = itestart;
- tp->t_param = NULL;
- tp->t_dev = dev;
- if ((tp->t_state&TS_ISOPEN) == 0) {
- ttychars(tp);
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_cflag = CS8|CREAD;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
- tp->t_state = TS_ISOPEN|TS_CARR_ON;
- ttsetwater(tp);
- }
- error = (*linesw[tp->t_line].l_open)(dev, tp);
- if (error == 0) {
- tp->t_winsize.ws_row = ip->rows;
- tp->t_winsize.ws_col = ip->cols;
- } else if (first)
- iteoff(ip, 0);
- return (error);
-}
-
-/*ARGSUSED*/
-int
-iteclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct ite_softc *sc = ite_cd.cd_devs[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(ip, 0);
-#if 0
- ttyfree(tp);
- ip->tty = (struct tty *)0;
-#endif
- return(0);
-}
-
-int
-iteread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct ite_softc *sc = ite_cd.cd_devs[ITEUNIT(dev)];
- struct tty *tp = sc->sc_data->tty;
-
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-itewrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct ite_softc *sc = ite_cd.cd_devs[ITEUNIT(dev)];
- struct tty *tp = sc->sc_data->tty;
-
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-struct tty *
-itetty(dev)
- dev_t dev;
-{
- struct ite_softc *sc = ite_cd.cd_devs[ITEUNIT(dev)];
-
- return (sc->sc_data->tty);
-}
-
-int
-iteioctl(dev, cmd, addr, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t addr;
- int flag;
- struct proc *p;
-{
- struct ite_softc *sc = ite_cd.cd_devs[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);
- if (error >= 0)
- return (error);
- error = ttioctl(tp, cmd, addr, flag, p);
- if (error >= 0)
- return (error);
- return (ENOTTY);
-}
-
-void
-itestart(tp)
- struct tty *tp;
-{
- int cc, s;
- int hiwat = 0, hadcursor = 0;
- struct ite_softc *sc;
- struct ite_data *ip;
-
- sc = ite_cd.cd_devs[ITEUNIT(tp->t_dev)];
- ip = sc->sc_data;
-
- s = splkbd();
- if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) {
- splx(s);
- return;
- }
- tp->t_state |= TS_BUSY;
- cc = tp->t_outq.c_cc;
- if (cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
- /*
- * Handle common (?) case
- */
- if (cc == 1) {
- iteputchar(getc(&tp->t_outq), ip);
- } else if (cc) {
- /*
- * Limit the amount of output we do in one burst
- * to prevent hogging the CPU.
- */
- if (cc > iteburst) {
- hiwat++;
- cc = iteburst;
- }
- /*
- * Turn off cursor while we output multiple characters.
- * Saves a lot of expensive window move operations.
- */
- if (ip->flags & ITE_CURSORON) {
- ite_erasecursor(ip, ip->isw);
- ip->flags &= ~ITE_CURSORON;
- hadcursor = 1;
- }
- while (--cc >= 0)
- iteputchar(getc(&tp->t_outq), ip);
- if (hadcursor) {
- ip->flags |= ITE_CURSORON;
- ite_drawcursor(ip, ip->isw);
- }
- if (hiwat) {
- tp->t_state |= TS_TIMEOUT;
- timeout_add(&tp->t_rstrt_to, 1);
- }
- }
- tp->t_state &= ~TS_BUSY;
- splx(s);
-}
-
-int
-itestop(tp, flag)
- struct tty *tp;
- int flag;
-{
- return (0);
-}
-
-void
-itefilter(stat, c)
- char stat, c;
-{
- static int capsmode = 0;
- static int metamode = 0;
- char code, *str;
- struct tty *kbd_tty = kbd_ite->tty;
-
- if (kbd_tty == NULL)
- return;
-
- switch (c & 0xFF) {
- case KBD_CAPSLOCK:
- capsmode = !capsmode;
- return;
-
- case KBD_EXT_LEFT_DOWN:
- case KBD_EXT_RIGHT_DOWN:
- metamode = 1;
- return;
-
- case KBD_EXT_LEFT_UP:
- case KBD_EXT_RIGHT_UP:
- metamode = 0;
- return;
- }
-
- c &= KBD_CHARMASK;
- switch ((stat>>KBD_SSHIFT) & KBD_SMASK) {
- default:
- case KBD_KEY:
- if (!capsmode) {
- code = kbd_keymap[(int)c];
- break;
- }
- /* FALLTHROUGH */
-
- case KBD_SHIFT:
- code = kbd_shiftmap[(int)c];
- break;
-
- case KBD_CTRL:
- code = kbd_ctrlmap[(int)c];
- break;
-
- case KBD_CTRLSHIFT:
- code = kbd_ctrlshiftmap[(int)c];
- break;
- }
-
- if (code == '\0' && (str = kbd_stringmap[(int)c]) != '\0') {
- while (*str)
- (*linesw[kbd_tty->t_line].l_rint)(*str++, kbd_tty);
- } else {
- if (metamode)
- code |= 0x80;
- (*linesw[kbd_tty->t_line].l_rint)(code, kbd_tty);
- }
-}
-
-void
-iteputchar(c, ip)
- int c;
- struct ite_data *ip;
-{
- struct itesw *sp = ip->isw;
- int n;
-
- if ((ip->flags & (ITE_ACTIVE|ITE_INGRF)) != ITE_ACTIVE)
- return;
-
- if (ip->escape) {
-doesc:
- switch (ip->escape) {
-
- case '&': /* Next can be a,d, or s */
- if (ip->fpd++) {
- ip->escape = c;
- ip->fpd = 0;
- }
- return;
-
- case 'a': /* cursor change */
- switch (c) {
-
- case 'Y': /* Only y coord. */
- ip->cury = min(ip->pos, ip->rows-1);
- ip->pos = 0;
- ip->escape = 0;
- ite_movecursor(ip, sp);
- clr_attr(ip, ATTR_INV);
- break;
-
- case 'y': /* y coord first */
- ip->cury = min(ip->pos, ip->rows-1);
- ip->pos = 0;
- ip->fpd = 0;
- break;
-
- case 'C': /* x coord */
- ip->curx = min(ip->pos, ip->cols-1);
- ip->pos = 0;
- ip->escape = 0;
- ite_movecursor(ip, sp);
- clr_attr(ip, ATTR_INV);
- break;
-
- default: /* Possibly a 3 digit number. */
- if (c >= '0' && c <= '9' && ip->fpd < 3) {
- ip->pos = ip->pos * 10 + (c - '0');
- ip->fpd++;
- } else {
- ip->pos = 0;
- ip->escape = 0;
- }
- break;
- }
- return;
-
- case 'd': /* attribute change */
- switch (c) {
-
- case 'B':
- set_attr(ip, ATTR_INV);
- break;
- case 'D':
- /* XXX: we don't do anything for underline */
- set_attr(ip, ATTR_UL);
- break;
- case '@':
- clr_attr(ip, ATTR_ALL);
- break;
- }
- ip->escape = 0;
- return;
-
- case 's': /* keypad control */
- switch (ip->fpd) {
-
- case 0:
- ip->hold = c;
- ip->fpd++;
- return;
-
- case 1:
- if (c == 'A') {
- switch (ip->hold) {
-
- case '0':
- clr_attr(ip, ATTR_KPAD);
- break;
- case '1':
- set_attr(ip, ATTR_KPAD);
- break;
- }
- }
- ip->hold = 0;
- }
- ip->escape = 0;
- return;
-
- case 'i': /* back tab */
- if (ip->curx > TABSIZE) {
- n = ip->curx - (ip->curx & (TABSIZE - 1));
- ip->curx -= n;
- } else
- ip->curx = 0;
- ite_movecursor(ip, sp);
- ip->escape = 0;
- return;
-
- case '3': /* clear all tabs */
- goto ignore;
-
- case 'K': /* clear_eol */
- ite_clrtoeol(ip, sp, ip->cury, ip->curx);
- ip->escape = 0;
- return;
-
- case 'J': /* clear_eos */
- ite_clrtoeos(ip, sp);
- ip->escape = 0;
- return;
-
- case 'B': /* cursor down 1 line */
- if (++ip->cury == ip->rows) {
- --ip->cury;
- ite_erasecursor(ip, sp);
- (*sp->ite_scroll)(ip, 1, 0, 1, SCROLL_UP);
- ite_clrtoeol(ip, sp, ip->cury, 0);
- }
- else
- ite_movecursor(ip, sp);
- clr_attr(ip, ATTR_INV);
- ip->escape = 0;
- return;
-
- case 'C': /* cursor forward 1 char */
- ip->escape = 0;
- itecheckwrap(ip, sp);
- return;
-
- case 'A': /* cursor up 1 line */
- if (ip->cury > 0) {
- ip->cury--;
- ite_movecursor(ip, sp);
- }
- ip->escape = 0;
- clr_attr(ip, ATTR_INV);
- return;
-
- case 'P': /* delete character */
- ite_dchar(ip, sp);
- ip->escape = 0;
- return;
-
- case 'M': /* delete line */
- ite_dline(ip, sp);
- ip->escape = 0;
- return;
-
- case 'Q': /* enter insert mode */
- ip->imode = 1;
- ip->escape = 0;
- return;
-
- case 'R': /* exit insert mode */
- ip->imode = 0;
- ip->escape = 0;
- return;
-
- case 'L': /* insert blank line */
- ite_iline(ip, sp);
- ip->escape = 0;
- return;
-
- case 'h': /* home key */
- ip->cury = ip->curx = 0;
- ite_movecursor(ip, sp);
- ip->escape = 0;
- return;
-
- case 'D': /* left arrow key */
- if (ip->curx > 0) {
- ip->curx--;
- ite_movecursor(ip, sp);
- }
- ip->escape = 0;
- return;
-
- case '1': /* set tab in all rows */
- goto ignore;
-
- case ESC:
- if ((ip->escape = c) == ESC)
- break;
- ip->fpd = 0;
- goto doesc;
-
- default:
-ignore:
- ip->escape = 0;
- return;
-
- }
- }
-
- switch (c &= 0x7F) {
-
- case '\n':
-
- if (++ip->cury == ip->rows) {
- --ip->cury;
- ite_erasecursor(ip, sp);
- (*sp->ite_scroll)(ip, 1, 0, 1, SCROLL_UP);
- ite_clrtoeol(ip, sp, ip->cury, 0);
- } else
- ite_movecursor(ip, sp);
- clr_attr(ip, ATTR_INV);
- break;
-
- case '\r':
- if (ip->curx) {
- ip->curx = 0;
- ite_movecursor(ip, sp);
- }
- break;
-
- case '\b':
- if (--ip->curx < 0)
- ip->curx = 0;
- else
- ite_movecursor(ip, sp);
- break;
-
- case '\t':
- if (ip->curx < TABEND(ip)) {
- n = TABSIZE - (ip->curx & (TABSIZE - 1));
- ip->curx += n;
- ite_movecursor(ip, sp);
- } else
- itecheckwrap(ip, sp);
- break;
-
- case CTRL('G'):
- if (ip == kbd_ite)
- kbdbell(0); /* XXX */
- break;
-
- case ESC:
- ip->escape = ESC;
- break;
-
- default:
- if (c < ' ' || c == DEL)
- break;
- if (ip->imode)
- ite_ichar(ip, sp);
- if ((ip->attribute & ATTR_INV) || attrtest(ip, ATTR_INV)) {
- attrset(ip, ATTR_INV);
- (*sp->ite_putc)(ip, c, ip->cury, ip->curx, ATTR_INV);
- } else
- (*sp->ite_putc)(ip, c, ip->cury, ip->curx, ATTR_NOR);
- ite_drawcursor(ip, sp);
- itecheckwrap(ip, sp);
- break;
- }
-}
-
-void
-itecheckwrap(ip, sp)
- struct ite_data *ip;
- struct itesw *sp;
-{
- if (++ip->curx == ip->cols) {
- ip->curx = 0;
- clr_attr(ip, ATTR_INV);
- if (++ip->cury == ip->rows) {
- --ip->cury;
- ite_erasecursor(ip, sp);
- (*sp->ite_scroll)(ip, 1, 0, 1, SCROLL_UP);
- ite_clrtoeol(ip, sp, ip->cury, 0);
- return;
- }
- }
- ite_movecursor(ip, sp);
-}
-
-void
-ite_dchar(ip, sp)
- struct ite_data *ip;
- struct itesw *sp;
-{
- if (ip->curx < ip->cols - 1) {
- ite_erasecursor(ip, sp);
- (*sp->ite_scroll)(ip, ip->cury, ip->curx + 1, 1, SCROLL_LEFT);
- attrmov(ip, ip->cury, ip->curx + 1, ip->cury, ip->curx,
- 1, ip->cols - ip->curx - 1);
- }
- attrclr(ip, ip->cury, ip->cols - 1, 1, 1);
- (*sp->ite_putc)(ip, ' ', ip->cury, ip->cols - 1, ATTR_NOR);
- ite_drawcursor(ip, sp);
-}
-
-void
-ite_ichar(ip, sp)
- struct ite_data *ip;
- struct itesw *sp;
-{
- if (ip->curx < ip->cols - 1) {
- ite_erasecursor(ip, sp);
- (*sp->ite_scroll)(ip, ip->cury, ip->curx, 1, SCROLL_RIGHT);
- attrmov(ip, ip->cury, ip->curx, ip->cury, ip->curx + 1,
- 1, ip->cols - ip->curx - 1);
- }
- attrclr(ip, ip->cury, ip->curx, 1, 1);
- (*sp->ite_putc)(ip, ' ', ip->cury, ip->curx, ATTR_NOR);
- ite_drawcursor(ip, sp);
-}
-
-void
-ite_dline(ip, sp)
- struct ite_data *ip;
- struct itesw *sp;
-{
- if (ip->cury < ip->rows - 1) {
- ite_erasecursor(ip, sp);
- (*sp->ite_scroll)(ip, ip->cury + 1, 0, 1, SCROLL_UP);
- attrmov(ip, ip->cury + 1, 0, ip->cury, 0,
- ip->rows - ip->cury - 1, ip->cols);
- }
- ite_clrtoeol(ip, sp, ip->rows - 1, 0);
-}
-
-void
-ite_iline(ip, sp)
- struct ite_data *ip;
- struct itesw *sp;
-{
- if (ip->cury < ip->rows - 1) {
- ite_erasecursor(ip, sp);
- (*sp->ite_scroll)(ip, ip->cury, 0, 1, SCROLL_DOWN);
- attrmov(ip, ip->cury, 0, ip->cury + 1, 0,
- ip->rows - ip->cury - 1, ip->cols);
- }
- ite_clrtoeol(ip, sp, ip->cury, 0);
-}
-
-void
-ite_clrtoeol(ip, sp, 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)
- 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);
-}
-
-int
-ite_major()
-{
- static int itemaj, initialized;
-
- /* Only compute once. */
- if (initialized)
- return (itemaj);
- initialized = 1;
-
- /* locate the major number */
- for (itemaj = 0; itemaj < nchrdev; itemaj++)
- if (cdevsw[itemaj].d_open == iteopen)
- break;
-
- return (itemaj);
-}
-
-/*
- * Console functions. Console probes are done by the individual
- * framebuffer drivers.
- */
-
-void
-itecninit(gp, isw)
- struct grf_data *gp;
- struct itesw *isw;
-{
- struct ite_data *ip = &ite_cn;
-
- /*
- * Set up required ite data and initialize ite.
- */
- ip->isw = isw;
- ip->grf = gp;
- ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
- ip->attrbuf = ite_console_attributes;
- iteinit(ip);
-
- /*
- * Initialize the console keyboard.
- */
- kbdcninit();
-
- kbd_ite = ip; /* XXX */
-}
-
-/*ARGSUSED*/
-int
-itecngetc(dev)
- dev_t dev;
-{
- int c;
- int stat;
-
- c = kbdgetc(&stat);
- switch ((stat >> KBD_SSHIFT) & KBD_SMASK) {
- case KBD_SHIFT:
- c = kbd_cn_shiftmap[c & KBD_CHARMASK];
- break;
- case KBD_CTRL:
- c = kbd_cn_ctrlmap[c & KBD_CHARMASK];
- break;
- case KBD_KEY:
- c = kbd_cn_keymap[c & KBD_CHARMASK];
- break;
- default:
- c = 0;
- break;
- }
- return(c);
-}
-
-/* ARGSUSED */
-void
-itecnputc(dev, c)
- dev_t dev;
- int c;
-{
- static int paniced = 0;
- struct ite_data *ip = &ite_cn;
-
- if (panicstr && !paniced &&
- (ip->flags & (ITE_ACTIVE|ITE_INGRF)) != ITE_ACTIVE) {
- (void) iteon(ip, 3);
- paniced = 1;
- }
- iteputchar(c, ip);
-}
diff --git a/sys/arch/hp300/dev/ite_subr.c b/sys/arch/hp300/dev/ite_subr.c
deleted file mode 100644
index da5ae8033b1..00000000000
--- a/sys/arch/hp300/dev/ite_subr.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* $OpenBSD: ite_subr.c,v 1.5 2003/06/02 23:27:45 millert Exp $ */
-/* $NetBSD: ite_subr.c,v 1.8 1997/03/31 07:37:26 scottr 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. 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_subr.c 1.4 92/01/21$
- *
- * @(#)ite_subr.c 8.2 (Berkeley) 1/12/94
- */
-
-#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/device.h>
-
-#include <hp300/dev/itevar.h>
-#include <hp300/dev/itereg.h>
-
-#include <machine/cpu.h>
-
-void
-ite_fontinfo(ip)
- struct ite_data *ip;
-{
- u_long fontaddr = getword(ip, getword(ip, FONTROM) + FONTADDR);
-
- ip->ftheight = getbyte(ip, fontaddr + FONTHEIGHT);
- ip->ftwidth = getbyte(ip, fontaddr + FONTWIDTH);
- ip->rows = ip->dheight / ip->ftheight;
- ip->cols = ip->dwidth / ip->ftwidth;
-
- if (ip->fbwidth > ip->dwidth) {
- /*
- * Stuff goes to right of display.
- */
- ip->fontx = ip->dwidth;
- ip->fonty = 0;
- ip->cpl = (ip->fbwidth - ip->dwidth) / ip->ftwidth;
- ip->cblankx = ip->dwidth;
- ip->cblanky = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight;
- }
- else {
- /*
- * Stuff goes below the display.
- */
- ip->fontx = 0;
- ip->fonty = ip->dheight;
- ip->cpl = ip->fbwidth / ip->ftwidth;
- ip->cblankx = 0;
- ip->cblanky = ip->fonty + ((128 / ip->cpl) + 1) * ip->ftheight;
- }
-}
-
-void
-ite_fontinit(ip)
- struct ite_data *ip;
-{
- int bytewidth = (((ip->ftwidth - 1) / 8) + 1);
- int glyphsize = bytewidth * ip->ftheight;
- u_char fontbuf[500]; /* XXX malloc not initialize yet */
- u_char *dp, *fbmem;
- int c, i, romp;
-
- romp = getword(ip, getword(ip, FONTROM) + FONTADDR) + FONTDATA;
- for (c = 0; c < 128; c++) {
- fbmem = (u_char *)
- (FBBASE +
- (ip->fonty + (c / ip->cpl) * ip->ftheight) * ip->fbwidth +
- (ip->fontx + (c % ip->cpl) * ip->ftwidth));
- dp = fontbuf;
- for (i = 0; i < glyphsize; i++) {
- *dp++ = getbyte(ip, romp);
- romp += 2;
- }
- writeglyph(ip, fbmem, fontbuf);
- }
-}
-
-/*
- * Display independent versions of the readbyte and writeglyph routines.
- */
-u_char
-ite_readbyte(ip, disp)
- struct ite_data *ip;
- int disp;
-{
- return((u_char) *(((u_char *)ip->regbase) + disp));
-}
-
-void
-ite_writeglyph(ip, fbmem, glyphp)
- struct ite_data *ip;
- u_char *fbmem, *glyphp;
-{
- int bn;
- int l, b;
-
- for (l = 0; l < ip->ftheight; l++) {
- bn = 7;
- for (b = 0; b < ip->ftwidth; b++) {
- if ((1 << bn) & *glyphp)
- *fbmem++ = 1;
- else
- *fbmem++ = 0;
- if (--bn < 0) {
- bn = 7;
- glyphp++;
- }
- }
- if (bn < 7)
- glyphp++;
- fbmem -= ip->ftwidth;
- fbmem += ip->fbwidth;
- }
-}
diff --git a/sys/arch/hp300/dev/itevar.h b/sys/arch/hp300/dev/itevar.h
deleted file mode 100644
index 3c321b7efdf..00000000000
--- a/sys/arch/hp300/dev/itevar.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/* $OpenBSD: itevar.h,v 1.11 2003/06/02 23:27:45 millert Exp $ */
-/* $NetBSD: itevar.h,v 1.14 1997/03/31 07:37:27 scottr 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. 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: itevar.h 1.15 92/12/20$
- *
- * @(#)itevar.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef _KERNEL
-#define ITEUNIT(dev) minor(dev)
-
-#define getbyte(ip, offset) \
- ((*(ip)->isw->ite_readbyte)(ip, offset))
-
-#define getword(ip, offset) \
- ((getbyte(ip, offset) << 8) | getbyte(ip, (offset) + 2))
-
-#define writeglyph(ip, offset, fontbuf) \
- ((*(ip)->isw->ite_writeglyph)((ip), (offset), (fontbuf)))
-
-struct ite_data {
- int flags;
- struct tty *tty;
- struct itesw *isw;
- struct grf_data *grf;
- caddr_t regbase, fbbase;
- short curx, cury;
- short cursorx, cursory;
- short cblankx, cblanky;
- short rows, cols;
- short cpl;
- short dheight, dwidth;
- short fbheight, fbwidth;
- short ftheight, ftwidth;
- short fontx, fonty;
- short attribute;
- u_char *attrbuf;
- short planemask;
- short pos;
- char imode, escape, fpd, hold;
- caddr_t devdata; /* display dependent data */
-};
-
-struct itesw {
- void (*ite_init)(struct ite_data *);
- void (*ite_deinit)(struct ite_data *);
- void (*ite_clear)(struct ite_data *, int, int, int, int);
- void (*ite_putc)(struct ite_data *, int, int, int, int);
- void (*ite_cursor)(struct ite_data *, int);
- void (*ite_scroll)(struct ite_data *, int, int, int, int);
- u_char (*ite_readbyte)(struct ite_data *, int);
- void (*ite_writeglyph)(struct ite_data *, u_char *, u_char *);
-};
-
-struct ite_softc {
- struct device sc_dev; /* generic device info */
- struct ite_data *sc_data; /* terminal state info */
- struct grf_softc *sc_grf; /* pointer to framebuffer */
-};
-#endif /* _KERNEL */
-
-/* Flags */
-#define ITE_ALIVE 0x01 /* hardware exists */
-#define ITE_INITED 0x02 /* device has been initialized */
-#define ITE_CONSOLE 0x04 /* device can be console */
-#define ITE_ISCONS 0x08 /* device is console */
-#define ITE_ACTIVE 0x10 /* device is being used as ITE */
-#define ITE_INGRF 0x20 /* device in use as non-ITE */
-#define ITE_CURSORON 0x40 /* cursor being tracked */
-
-#define attrloc(ip, y, x) \
- (ip->attrbuf + ((y) * ip->cols) + (x))
-
-#define attrclr(ip, sy, sx, h, w) \
- bzero(ip->attrbuf + ((sy) * ip->cols) + (sx), (h) * (w))
-
-#define attrmov(ip, sy, sx, dy, dx, h, w) \
- bcopy(ip->attrbuf + ((sy) * ip->cols) + (sx), \
- ip->attrbuf + ((dy) * ip->cols) + (dx), \
- (h) * (w))
-
-#define attrtest(ip, attr) \
- ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) & attr)
-
-#define attrset(ip, attr) \
- ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) = attr)
-
-/*
- * X and Y location of character 'c' in the framebuffer, in pixels.
- */
-#define charX(ip,c) \
- (((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx)
-
-#define charY(ip,c) \
- (((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty)
-
-/*
- * The cursor is just an inverted space.
- */
-#define draw_cursor(ip) { \
- WINDOWMOVER(ip, ip->cblanky, ip->cblankx, \
- ip->cury * ip->ftheight, \
- ip->curx * ip->ftwidth, \
- ip->ftheight, ip->ftwidth, RR_XOR); \
- ip->cursorx = ip->curx; \
- ip->cursory = ip->cury; }
-
-#define erase_cursor(ip) \
- WINDOWMOVER(ip, ip->cblanky, ip->cblankx, \
- ip->cursory * ip->ftheight, \
- ip->cursorx * ip->ftwidth, \
- ip->ftheight, ip->ftwidth, RR_XOR);
-
-/* Character attributes */
-#define ATTR_NOR 0x0 /* normal */
-#define ATTR_INV 0x1 /* inverse */
-#define ATTR_UL 0x2 /* underline */
-#define ATTR_ALL (ATTR_INV | ATTR_UL)
-
-/* Keyboard attributes */
-#define ATTR_KPAD 0x4 /* keypad transmit */
-
-/* Replacement Rules */
-#define RR_CLEAR 0x0
-#define RR_COPY 0x3
-#define RR_XOR 0x6
-#define RR_COPYINVERTED 0xc
-
-#define SCROLL_UP 0x01
-#define SCROLL_DOWN 0x02
-#define SCROLL_LEFT 0x03
-#define SCROLL_RIGHT 0x04
-#define DRAW_CURSOR 0x05
-#define ERASE_CURSOR 0x06
-#define MOVE_CURSOR 0x07
-
-#define KBD_SSHIFT 4 /* bits to shift status */
-#define KBD_CHARMASK 0x7F
-
-/* keyboard status */
-#define KBD_SMASK 0xF /* service request status mask */
-#define KBD_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */
-#define KBD_CTRL 0x9 /* key + CTRL */
-#define KBD_SHIFT 0xA /* key + SHIFT */
-#define KBD_KEY 0xB /* key only */
-
-#define KBD_CAPSLOCK 0x18
-
-#define KBD_EXT_LEFT_DOWN 0x12
-#define KBD_EXT_LEFT_UP 0x92
-#define KBD_EXT_RIGHT_DOWN 0x13
-#define KBD_EXT_RIGHT_UP 0x93
-
-#define TABSIZE 8
-#define TABEND(ip) ((ip)->tty ? ((ip)->tty->t_winsize.ws_col - TABSIZE) \
- : ((ip)->cols - 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 int nitesw;
-
-/* ite.c prototypes */
-void ite_attach_grf(int, int);
-int iteon(struct ite_data *, int);
-void iteoff(struct ite_data *, int);
-void itefilter(char, char);
-void itecninit(struct grf_data *, struct itesw *);
-int itecngetc(dev_t);
-void itecnputc(dev_t, int);
-int ite_major(void);
-
-/* ite_subr.c prototypes */
-void ite_fontinfo(struct ite_data *);
-void ite_fontinit(struct ite_data *);
-u_char ite_readbyte(struct ite_data *, int);
-void ite_writeglyph(struct ite_data *, u_char *, u_char *);
-#endif
diff --git a/sys/arch/hp300/dev/kbdmap.h b/sys/arch/hp300/dev/kbdmap.h
deleted file mode 100644
index ee5eebddf27..00000000000
--- a/sys/arch/hp300/dev/kbdmap.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $OpenBSD: kbdmap.h,v 1.4 2003/06/02 23:27:45 millert Exp $ */
-/* $NetBSD: kbdmap.h,v 1.7 1996/10/05 05:22:11 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * 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. 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.
- *
- * @(#)kbdmap.h 8.1 (Berkeley) 6/10/93
- */
-
-#define ESC '\033'
-#define DEL '\177'
-
-struct kbdmap {
- int kbd_code;
- char *kbd_desc;
- char *kbd_keymap;
- char *kbd_shiftmap;
- char *kbd_ctrlmap;
- char *kbd_ctrlshiftmap;
- char **kbd_stringmap;
-};
-
-/* kbd_code */
-#define KBD_SPECIAL 0x00 /* user defined */
-#define KBD_US 0x1F /* US ASCII */
-#define KBD_UK 0x17 /* United Kingdom */
-#define KBD_SE 0x0e /* Swedish */
-
-#define KBD_DEFAULT KBD_US /* default type */
-
-#ifdef _KERNEL
-/* XXX: ITE interface */
-extern char *kbd_keymap;
-extern char *kbd_shiftmap;
-extern char *kbd_ctrlmap;
-extern char *kbd_ctrlshiftmap;
-extern char **kbd_stringmap;
-
-/* XXX: itecngetc() interface */
-extern char *kbd_cn_keymap;
-extern char *kbd_cn_shiftmap;
-extern char *kbd_cn_ctrlmap;
-
-extern struct kbdmap kbd_map[];
-#endif
diff --git a/sys/arch/hp300/dev/maskbits.h b/sys/arch/hp300/dev/maskbits.h
index bf116c92d47..79675fb127f 100644
--- a/sys/arch/hp300/dev/maskbits.h
+++ b/sys/arch/hp300/dev/maskbits.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: maskbits.h,v 1.4 2003/06/02 23:27:45 millert Exp $ */
+/* $OpenBSD: maskbits.h,v 1.5 2005/01/14 22:39:26 miod Exp $ */
/* $NetBSD: maskbits.h,v 1.3 1997/03/31 07:37:28 scottr Exp $ */
/*-
@@ -53,13 +53,15 @@ and the number of whole longwords between the ends.
*/
-#define maskbits(x, w, startmask, endmask, nlw) \
- startmask = starttab[(x)&0x1f]; \
- endmask = endtab[((x)+(w)) & 0x1f]; \
- if (startmask) \
- nlw = (((w) - (32 - ((x)&0x1f))) >> 5); \
- else \
- nlw = (w) >> 5;
+#define maskbits(x, w, startmask, endmask, nlw) \
+do { \
+ startmask = starttab[(x) & 0x1f]; \
+ endmask = endtab[((x) + (w)) & 0x1f]; \
+ if (startmask) \
+ nlw = (((w) - (32 - ((x) & 0x1f))) >> 5); \
+ else \
+ nlw = (w) >> 5; \
+} while (0)
#define FASTGETBITS(psrc, x, w, dst) \
asm ("bfextu %3{%1:%2},%0" \
@@ -70,44 +72,45 @@ and the number of whole longwords between the ends.
: "=o" (*(char *)(pdst)) \
: "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst)))
-#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \
-{ \
- unsigned int _tmpsrc, _tmpdst; \
- FASTGETBITS(pdst, dstbit, width, _tmpdst); \
- FASTGETBITS(psrc, srcbit, width, _tmpsrc); \
- DoRop(_tmpdst, rop, _tmpsrc, _tmpdst); \
- FASTPUTBITS(_tmpdst, dstbit, width, pdst); \
-}
+#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \
+do { \
+ unsigned int _tmpsrc, _tmpdst; \
+ FASTGETBITS(pdst, dstbit, width, _tmpdst); \
+ FASTGETBITS(psrc, srcbit, width, _tmpsrc); \
+ DoRop(_tmpdst, rop, _tmpsrc, _tmpdst); \
+ FASTPUTBITS(_tmpdst, dstbit, width, pdst); \
+} while (0)
#define getandputrop0(psrc, srcbit, width, pdst, rop) \
getandputrop(psrc, srcbit, 0, width, pdst, rop)
-#define getunalignedword(psrc, x, dst) { \
- int _tmp; \
- FASTGETBITS(psrc, x, 32, _tmp); \
- dst = _tmp; \
-}
+#define getunalignedword(psrc, x, dst) \
+do { \
+ int _tmp; \
+ FASTGETBITS(psrc, x, 32, _tmp); \
+ dst = _tmp; \
+} while (0)
-#define fnCLEAR(src, dst) (0)
-#define fnCOPY(src, dst) (src)
-#define fnXOR(src, dst) (src ^ dst)
-#define fnCOPYINVERTED(src, dst)(~src)
+#define fnCLEAR(src, dst) (0)
+#define fnCOPY(src, dst) (src)
+#define fnXOR(src, dst) ((src) ^ (dst))
+#define fnCOPYINVERTED(src, dst) (~(src))
-#define DoRop(result, alu, src, dst) \
-{ \
- if (alu == RR_COPY) \
- result = fnCOPY (src, dst); \
- else \
- switch (alu) \
- { \
- case RR_CLEAR: \
- result = fnCLEAR (src, dst); \
- break; \
- case RR_XOR: \
- result = fnXOR (src, dst); \
- break; \
- case RR_COPYINVERTED: \
- result = fnCOPYINVERTED (src, dst); \
- break; \
- } \
-}
+#define DoRop(result, alu, src, dst) \
+do { \
+ switch (alu) { \
+ case RR_CLEAR: \
+ default: \
+ result = fnCLEAR(src, dst); \
+ break; \
+ case RR_COPY: \
+ result = fnCOPY(src, dst); \
+ break; \
+ case RR_XOR: \
+ result = fnXOR(src, dst); \
+ break; \
+ case RR_COPYINVERTED: \
+ result = fnCOPYINVERTED(src, dst); \
+ break; \
+ } \
+} while (0)
diff --git a/sys/arch/hp300/dev/rbox.c b/sys/arch/hp300/dev/rbox.c
new file mode 100644
index 00000000000..effe4108aa5
--- /dev/null
+++ b/sys/arch/hp300/dev/rbox.c
@@ -0,0 +1,480 @@
+/* $OpenBSD: rbox.c,v 1.1 2005/01/14 22:39:26 miod Exp $ */
+
+/*
+ * Copyright (c) 2005, Miodrag Vallat
+ *
+ * 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.
+ *
+ * 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.
+ */
+/*
+ * 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.
+ *
+ * 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. 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: grf_rb.c 1.15 93/08/13$
+ *
+ * @(#)grf_rb.c 8.4 (Berkeley) 1/12/94
+ */
+
+/*
+ * Graphics routines for the Renaissance, HP98720 Graphics system.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+#include <sys/proc.h>
+#include <sys/ioctl.h>
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+#include <machine/cpu.h>
+
+#include <hp300/dev/dioreg.h>
+#include <hp300/dev/diovar.h>
+#include <hp300/dev/diodevs.h>
+#include <hp300/dev/intiovar.h>
+
+#include <dev/cons.h>
+
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wsdisplayvar.h>
+
+#include <hp300/dev/diofbreg.h>
+#include <hp300/dev/diofbvar.h>
+#include <hp300/dev/rboxreg.h>
+
+struct rbox_softc {
+ struct device sc_dev;
+ struct diofb *sc_fb;
+ struct diofb sc_fb_store;
+ int sc_scode;
+};
+
+int rbox_dio_match(struct device *, void *, void *);
+void rbox_dio_attach(struct device *, struct device *, void *);
+int rbox_intio_match(struct device *, void *, void *);
+void rbox_intio_attach(struct device *, struct device *, void *);
+
+struct cfattach rbox_dio_ca = {
+ sizeof(struct rbox_softc), rbox_dio_match, rbox_dio_attach
+};
+
+struct cfattach rbox_intio_ca = {
+ sizeof(struct rbox_softc), rbox_intio_match, rbox_intio_attach
+};
+
+struct cfdriver rbox_cd = {
+ NULL, "rbox", DV_DULL
+};
+
+int rbox_reset(struct diofb *, int, struct diofbreg *);
+void rbox_setcolor(struct diofb *, u_int,
+ u_int8_t, u_int8_t, u_int8_t);
+void rbox_windowmove(struct diofb *, u_int16_t, u_int16_t,
+ u_int16_t, u_int16_t, u_int16_t, u_int16_t, int);
+
+int rbox_ioctl(void *, u_long, caddr_t, int, struct proc *);
+void rbox_burner(void *, u_int, u_int);
+
+struct wsdisplay_accessops rbox_accessops = {
+ rbox_ioctl,
+ diofb_mmap,
+ diofb_alloc_screen,
+ diofb_free_screen,
+ diofb_show_screen,
+ NULL, /* load_font */
+ NULL, /* scrollback */
+ NULL, /* getchar */
+ rbox_burner
+};
+
+/*
+ * Attachment glue
+ */
+
+int
+rbox_intio_match(struct device *parent, void *match, void *aux)
+{
+ struct intio_attach_args *ia = aux;
+ struct diofbreg *fbr;
+
+ fbr = (struct diofbreg *)IIOV(GRFIADDR);
+
+ if (badaddr((caddr_t)fbr))
+ return (0);
+
+ if (fbr->id == GRFHWID && fbr->id2 == GID_RENAISSANCE) {
+ ia->ia_addr = (caddr_t)GRFIADDR;
+ return (1);
+ }
+
+ return (0);
+}
+
+void
+rbox_intio_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct rbox_softc *sc = (struct rbox_softc *)self;
+ struct diofbreg *fbr;
+
+ fbr = (struct diofbreg *)IIOV(GRFIADDR);
+ sc->sc_scode = -1; /* XXX internal i/o */
+
+ if (sc->sc_scode == conscode) {
+ sc->sc_fb = &diofb_cn;
+ } else {
+ sc->sc_fb = &sc->sc_fb_store;
+ rbox_reset(sc->sc_fb, sc->sc_scode, fbr);
+ }
+
+ diofb_end_attach(sc, &rbox_accessops, sc->sc_fb,
+ sc->sc_scode == conscode, 4 /* XXX */, NULL);
+}
+
+int
+rbox_dio_match(struct device *parent, void *match, void *aux)
+{
+ struct dio_attach_args *da = aux;
+
+ if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
+ da->da_secid == DIO_DEVICE_SECID_RENAISSANCE)
+ return (1);
+
+ return (0);
+}
+
+void
+rbox_dio_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct rbox_softc *sc = (struct rbox_softc *)self;
+ struct dio_attach_args *da = aux;
+ struct diofbreg *fbr;
+
+ sc->sc_scode = da->da_scode;
+ if (sc->sc_scode == conscode) {
+ fbr = (struct diofbreg *)conaddr; /* already mapped */
+ sc->sc_fb = &diofb_cn;
+ } else {
+ sc->sc_fb = &sc->sc_fb_store;
+ fbr = (struct diofbreg *)
+ iomap(dio_scodetopa(sc->sc_scode), da->da_size);
+ if (fbr == NULL ||
+ rbox_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) {
+ printf(": can't map framebuffer\n");
+ return;
+ }
+ }
+
+ diofb_end_attach(sc, &rbox_accessops, sc->sc_fb,
+ sc->sc_scode == conscode, 4 /* XXX */, NULL);
+}
+
+/*
+ * Initialize hardware and display routines.
+ */
+int
+rbox_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
+{
+ volatile struct rboxfb *rb = (struct rboxfb *)fbr;
+ int rc;
+ int i;
+
+ if ((rc = diofb_fbinquire(fb, scode, fbr, 0x20000)) != 0)
+ return (rc);
+
+ fb->planes = 8;
+ fb->planemask = (1 << fb->planes) - 1;
+
+ rb_waitbusy(rb);
+
+ rb->reset = GRFHWID;
+ DELAY(1000);
+
+ rb->interrupt = 0x04;
+ rb->video_enable = 0x01;
+ rb->drive = 0x01;
+ rb->vdrive = 0x0;
+
+ rb->opwen = 0xFF;
+
+ fb->bmv = rbox_windowmove;
+ diofb_fbsetup(fb);
+ diofb_fontunpack(fb);
+
+ rb_waitbusy(fb->regkva);
+
+ /*
+ * Clear color map
+ */
+ for (i = 0; i < 16; i++) {
+ *(fb->regkva + 0x63c3 + i*4) = 0x0;
+ *(fb->regkva + 0x6403 + i*4) = 0x0;
+ *(fb->regkva + 0x6803 + i*4) = 0x0;
+ *(fb->regkva + 0x6c03 + i*4) = 0x0;
+ *(fb->regkva + 0x73c3 + i*4) = 0x0;
+ *(fb->regkva + 0x7403 + i*4) = 0x0;
+ *(fb->regkva + 0x7803 + i*4) = 0x0;
+ *(fb->regkva + 0x7c03 + i*4) = 0x0;
+ }
+
+ rb->rep_rule = RBOX_DUALROP(RR_COPY);
+
+ /*
+ * 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(fb)[0x00].value = 0x00;
+ CM1GRN(fb)[0x00].value = 0x00;
+ CM1BLU(fb)[0x00].value = 0x00;
+ CM1RED(fb)[0x01].value = 0xFF;
+ CM1GRN(fb)[0x01].value = 0xFF;
+ CM1BLU(fb)[0x01].value = 0xFF;
+
+ CM2RED(fb)[0x00].value = 0x00;
+ CM2GRN(fb)[0x00].value = 0x00;
+ CM2BLU(fb)[0x00].value = 0x00;
+ CM2RED(fb)[0x01].value = 0xFF;
+ CM2GRN(fb)[0x01].value = 0xFF;
+ CM2BLU(fb)[0x01].value = 0xFF;
+
+ rb->blink = 0x00;
+ rb->write_enable = 0x01;
+ rb->opwen = 0x00;
+
+ /*
+ * Enable display.
+ */
+ rb->display_enable = 0x01;
+
+ return (0);
+}
+
+int
+rbox_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
+{
+ struct diofb *fb = v;
+ struct wsdisplay_fbinfo *wdf;
+
+ switch (cmd) {
+ case WSDISPLAYIO_GTYPE:
+ *(u_int *)data = WSDISPLAY_TYPE_UNKNOWN;
+ break;
+ case WSDISPLAYIO_GINFO:
+ wdf = (void *)data;
+ wdf->height = fb->dheight;
+ wdf->width = fb->dwidth;
+ wdf->depth = fb->planes;
+ wdf->cmsize = 1 << fb->planes;
+ break;
+ case WSDISPLAYIO_LINEBYTES:
+ *(u_int *)data = (fb->fbwidth * fb->planes) >> 3;
+ break;
+ case WSDISPLAYIO_GETCMAP:
+ case WSDISPLAYIO_PUTCMAP:
+ /* XXX TBD */
+ break;
+ case WSDISPLAYIO_GVIDEO:
+ case WSDISPLAYIO_SVIDEO:
+ break;
+ default:
+ return (-1);
+ }
+
+ return (0);
+}
+
+void
+rbox_burner(void *v, u_int on, u_int flags)
+{
+ struct diofb *fb = v;
+ volatile struct rboxfb *rb = (struct rboxfb *)fb->regkva;
+
+ if (on) {
+ rb->display_enable = 0x01;
+ } else {
+ rb->display_enable = 0x00;
+ }
+}
+
+void
+rbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
+ u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int rop)
+{
+ volatile struct rboxfb *rb = (struct rboxfb *)fb->regkva;
+
+ rb_waitbusy(rb);
+ rb->rep_rule = RBOX_DUALROP(rop);
+ rb->source_y = sy;
+ rb->source_x = sx;
+ rb->dest_y = dy;
+ rb->dest_x = dx;
+ rb->wheight = cy;
+ rb->wwidth = cx;
+ rb->wmove = 1;
+}
+
+/*
+ * Renaissance console support
+ */
+
+int rbox_console_scan(int, caddr_t, void *);
+cons_decl(rbox);
+
+int
+rbox_console_scan(int scode, caddr_t va, void *arg)
+{
+ struct diofbreg *fbr = (struct diofbreg *)va;
+ struct consdev *cp = arg;
+ u_char *dioiidev;
+ int force = 0, pri;
+
+ if (fbr->id != GRFHWID || fbr->id2 != GID_RENAISSANCE)
+ return (0);
+
+ pri = CN_INTERNAL;
+
+#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 >= DIOII_SCBASE) {
+ dioiidev = (u_char *)va;
+ return ((dioiidev[0x101] + 1) * 0x100000);
+ }
+ return (DIO_DEVSIZE);
+ }
+ return (0);
+}
+
+void
+rboxcnprobe(struct consdev *cp)
+{
+ int maj;
+ caddr_t va;
+ struct diofbreg *fbr;
+ int force = 0;
+
+ /* Abort early if console is already forced. */
+ if (conforced)
+ return;
+
+ for (maj = 0; maj < nchrdev; maj++) {
+ if (cdevsw[maj].d_open == wsdisplayopen)
+ break;
+ }
+
+ if (maj == nchrdev)
+ return;
+
+ cp->cn_dev = makedev(maj, 0);
+ cp->cn_pri = CN_DEAD;
+
+ /* Look for "internal" framebuffer. */
+ va = (caddr_t)IIOV(GRFIADDR);
+ fbr = (struct diofbreg *)va;
+ if (!badaddr(va) &&
+ fbr->id == GRFHWID && fbr->id2 == GID_RENAISSANCE) {
+ cp->cn_pri = CN_INTERNAL;
+
+#ifdef CONSCODE
+ if (CONSCODE == -1) {
+ 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, HP300_BUS_DIO);
+}
+
+void
+rboxcninit(struct consdev *cp)
+{
+ long defattr;
+
+ rbox_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
+ diofb_alloc_attr(NULL, 0, 0, 0, &defattr);
+ wsdisplay_cnattach(&diofb_cn.wsd, &diofb_cn, 0, 0, defattr);
+}
diff --git a/sys/arch/hp300/dev/rboxreg.h b/sys/arch/hp300/dev/rboxreg.h
new file mode 100644
index 00000000000..68cf9572c7c
--- /dev/null
+++ b/sys/arch/hp300/dev/rboxreg.h
@@ -0,0 +1,145 @@
+/* $OpenBSD: rboxreg.h,v 1.1 2005/01/14 22:39:26 miod Exp $ */
+/* $NetBSD: grf_rbreg.h,v 1.4 1994/10/26 07:24:03 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. 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: grf_rbreg.h 1.9 92/01/21$
+ *
+ * @(#)grf_rbreg.h 8.1 (Berkeley) 6/10/93
+ */
+
+/*
+ * Map of the Renaissance frame buffer controller chip in memory ...
+ */
+
+#define rb_waitbusy(regaddr) \
+do { \
+ while (((volatile struct rboxfb *)(regaddr))->wbusy & 0x01) \
+ DELAY(10); \
+} while (0)
+
+#define RBOX_DUALROP(rop) ((rop) << 4 | (rop))
+
+#define CM1RED(fb) ((volatile struct rencm *)((fb)->regkva + 0x6400))
+#define CM1GRN(fb) ((volatile struct rencm *)((fb)->regkva + 0x6800))
+#define CM1BLU(fb) ((volatile struct rencm *)((fb)->regkva + 0x6C00))
+#define CM2RED(fb) ((volatile struct rencm *)((fb)->regkva + 0x7400))
+#define CM2GRN(fb) ((volatile struct rencm *)((fb)->regkva + 0x7800))
+#define CM2BLU(fb) ((volatile struct rencm *)((fb)->regkva + 0x7C00))
+
+struct rencm {
+ u_int8_t :8, :8, :8;
+ u_int8_t value;
+};
+
+struct rboxfb {
+ u_int8_t :8;
+ u_int8_t reset; /* reset register 0x01 */
+ u_int8_t fb_address; /* frame buffer address 0x02 */
+ u_int8_t interrupt; /* interrupt register 0x03 */
+ u_int8_t :8;
+ u_int8_t fbwmsb; /* frame buffer width MSB 0x05 */
+ u_int8_t :8;
+ u_int8_t fbwlsb; /* frame buffer width MSB 0x07 */
+ u_int8_t :8;
+ u_int8_t fbhmsb; /* frame buffer height MSB 0x09 */
+ u_int8_t :8;
+ u_int8_t fbhlsb; /* frame buffer height MSB 0x0b */
+ u_int8_t :8;
+ u_int8_t dwmsb; /* display width MSB 0x0d */
+ u_int8_t :8;
+ u_int8_t dwlsb; /* display width MSB 0x0f */
+ u_int8_t :8;
+ u_int8_t dhmsb; /* display height MSB 0x11 */
+ u_int8_t :8;
+ u_int8_t dhlsb; /* display height MSB 0x13 */
+ u_int8_t :8;
+ u_int8_t fbid; /* frame buffer id 0x15 */
+ u_int8_t filler1[0x47];
+ u_int8_t fbomsb; /* frame buffer offset MSB 0x5d */
+ u_int8_t :8;
+ u_int8_t fbolsb; /* frame buffer offset LSB 0x5f */
+ u_int8_t filler2[16359];
+ u_int8_t wbusy; /* window mover is active 0x4047 */
+ u_int8_t filler3[0x405b - 0x4048];
+ u_int8_t scanbusy; /* scan converteris active 0x405B */
+ u_int8_t filler3b[0x4083 - 0x405c];
+ u_int8_t video_enable; /* drive vid. refresh bus 0x4083 */
+ u_int8_t filler4[3];
+ u_int8_t display_enable; /* enable the display 0x4087 */
+ u_int8_t filler5[8];
+ u_int32_t write_enable; /* write enable register 0x4090 */
+ u_int8_t filler6[11];
+ u_int8_t wmove; /* start window mover 0x409f */
+ u_int8_t filler7[3];
+ u_int8_t blink; /* blink register 0x40a3 */
+ u_int8_t filler8[15];
+ u_int8_t fold; /* fold register 0x40b3 */
+ u_int32_t opwen; /* overlay plane write enable 0x40b4 */
+ u_int8_t filler9[3];
+ u_int8_t tmode; /* Tile mode size 0x40bb */
+ u_int8_t filler9a[3];
+ u_int8_t drive; /* drive register 0x40bf */
+ u_int8_t filler10[3];
+ u_int8_t vdrive; /* vdrive register 0x40c3 */
+ u_int8_t filler10a[0x40cb-0x40c4];
+ u_int8_t zconfig; /* Z-buffer mode 0x40cb */
+ u_int8_t filler11a[2];
+ u_int16_t tpatt; /* Transparency pattern 0x40ce */
+ u_int8_t filler11b[3];
+ u_int8_t dmode; /* dither mode 0x40d3 */
+ u_int8_t filler11c[3];
+ u_int8_t en_scan; /* enable scan board to DTACK 0x40d7 */
+ u_int8_t filler11d[0x40ef-0x40d8];
+ u_int8_t rep_rule; /* replacement rule 0x40ef */
+ u_int8_t filler12[2];
+ u_int16_t source_x; /* source x 0x40f2 */
+ u_int8_t filler13[2];
+ u_int16_t source_y; /* source y 0x40f6 */
+ u_int8_t filler14[2];
+ u_int16_t dest_x; /* dest x 0x40fa */
+ u_int8_t filler15[2];
+ u_int16_t dest_y; /* dest y 0x40fe */
+ u_int8_t filler16[2];
+ u_int16_t wwidth; /* window width 0x4102 */
+ u_int8_t filler17[2];
+ u_int16_t wheight; /* window height 0x4106 */
+ u_int8_t filler18[18];
+ u_int16_t patt_x; /* pattern x 0x411a */
+ u_int8_t filler19[2];
+ u_int16_t patt_y; /* pattern y 0x411e */
+ u_int8_t filler20[0x8012 - 0x4120];
+ u_int16_t te_status; /* transform engine status 0x8012 */
+ u_int8_t filler21[0x1ffff-0x8014];
+};
diff --git a/sys/arch/hp300/dev/sgc.c b/sys/arch/hp300/dev/sgc.c
new file mode 100644
index 00000000000..eb1707df1af
--- /dev/null
+++ b/sys/arch/hp300/dev/sgc.c
@@ -0,0 +1,144 @@
+/* $OpenBSD: sgc.c,v 1.1 2005/01/14 22:39:26 miod Exp $ */
+
+/*
+ * Copyright (c) 2005, Miodrag Vallat
+ *
+ * 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.
+ *
+ * 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.
+ *
+ */
+
+/*
+ * SGC bus attachment and mapping glue.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+
+#include <machine/autoconf.h>
+#include <machine/cpu.h>
+#include <machine/hp300spu.h>
+
+#include <hp300/dev/dmavar.h>
+
+#include <hp300/dev/sgcreg.h>
+#include <hp300/dev/sgcvar.h>
+
+int sgcmatch(struct device *, void *, void *);
+void sgcattach(struct device *, struct device *, void *);
+int sgcprint(void *, const char *);
+
+struct cfattach sgc_ca = {
+ sizeof(struct device), sgcmatch, sgcattach
+};
+
+struct cfdriver sgc_cd = {
+ NULL, "sgc", DV_DULL
+};
+
+int
+sgcmatch(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+{
+static int sgc_matched = 0;
+
+ /* Allow only one instance. */
+ if (sgc_matched)
+ return (0);
+
+ /*
+ * Leave out machines which can not have an SGC bus.
+ */
+
+ if (machineid != HP_400 && machineid != HP_425 &&
+ machineid != HP_433)
+ return (0);
+
+ return (sgc_matched = 1);
+}
+
+void
+sgcattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct sgc_attach_args saa;
+ caddr_t pa, va;
+ int slot, rv;
+
+ printf("\n");
+
+ for (slot = 0; slot < SGC_NSLOTS; slot++) {
+ pa = sgc_slottopa(slot);
+ va = iomap(pa, PAGE_SIZE);
+ if (va == NULL) {
+ printf("%s: can't map slot %d\n", self->dv_xname, slot);
+ continue;
+ }
+
+ /* Check for hardware. */
+ rv = badaddr(va);
+ iounmap(va, PAGE_SIZE);
+
+ if (rv != 0)
+ continue;
+
+ bzero(&saa, sizeof(saa));
+ saa.saa_slot = slot;
+
+ /* Attach matching device. */
+ config_found(self, &saa, sgcprint);
+ }
+}
+
+int
+sgcprint(aux, pnp)
+ void *aux;
+ const char *pnp;
+{
+ struct sgc_attach_args *saa = aux;
+
+ if (pnp)
+ printf("unknown SGC card at %s", pnp);
+ printf(" slot %d", saa->saa_slot);
+ return (UNCONF);
+}
+
+/*
+ * Convert a slot number to a system physical address.
+ * This is needed for bus_space.
+ */
+void *
+sgc_slottopa(int slot)
+{
+ u_long rval;
+
+ if (slot < 0 || slot > SGC_NSLOTS)
+ rval = 0;
+ else
+ rval = SGC_BASE + (slot * SGC_DEVSIZE);
+
+ return ((void *)rval);
+}
diff --git a/sys/arch/hp300/dev/sgcreg.h b/sys/arch/hp300/dev/sgcreg.h
new file mode 100644
index 00000000000..5a7e4c744ee
--- /dev/null
+++ b/sys/arch/hp300/dev/sgcreg.h
@@ -0,0 +1,41 @@
+/* $OpenBSD: sgcreg.h,v 1.1 2005/01/14 22:39:26 miod Exp $ */
+
+/*
+ * Copyright (c) 2005, Miodrag Vallat
+ *
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * Register definitions for the SGC bus.
+ */
+
+/*
+ * SGC ranges from slots 0-3 at physical addresses given by:
+ * 0x20000000 + slot * 0x04000000
+ */
+
+#define SGC_BASE 0x20000000
+#define SGC_END 0x30000000
+#define SGC_DEVSIZE 0x04000000
+
+#define SGC_NSLOTS 4
diff --git a/sys/arch/hp300/dev/sgcvar.h b/sys/arch/hp300/dev/sgcvar.h
new file mode 100644
index 00000000000..71a81861abd
--- /dev/null
+++ b/sys/arch/hp300/dev/sgcvar.h
@@ -0,0 +1,44 @@
+/* $OpenBSD: sgcvar.h,v 1.1 2005/01/14 22:39:26 miod Exp $ */
+
+/*
+ * Copyright (c) 2005, Miodrag Vallat.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ */
+
+/*
+ * Autoconfiguration definitions and prototypes for the SGC bus.
+ */
+
+struct sgc_attach_args {
+ int saa_slot; /* slot number */
+};
+
+#ifdef _KERNEL
+void *sgc_slottopa(int);
+#endif /* _KERNEL */
+
+/* Macros to switch between SGC slot numbers and kernel conscode */
+#define SGC_SLOT_TO_CONSCODE(slot) (256 + (slot))
+#define CONSCODE_TO_SGC_SLOT(code) ((code) - 256)
diff --git a/sys/arch/hp300/dev/sti_sgc.c b/sys/arch/hp300/dev/sti_sgc.c
new file mode 100644
index 00000000000..3656b855196
--- /dev/null
+++ b/sys/arch/hp300/dev/sti_sgc.c
@@ -0,0 +1,221 @@
+/* $OpenBSD: sti_sgc.c,v 1.1 2005/01/14 22:39:26 miod Exp $ */
+
+/*
+ * Copyright (c) 2005, Miodrag Vallat
+ *
+ * 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.
+ *
+ * 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.
+ *
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+#include <machine/cpu.h>
+
+#include <dev/cons.h>
+
+#include <hp300/dev/sgcreg.h>
+#include <hp300/dev/sgcvar.h>
+
+#include <dev/wscons/wsdisplayvar.h>
+#include <dev/wscons/wsconsio.h>
+
+#include <dev/ic/stireg.h>
+#include <dev/ic/stivar.h>
+
+#include "wsdisplay.h"
+
+/*
+ * This is a safe upper bound of the amount of memory we will need to
+ * bus_space_map() for sti frame buffers.
+ */
+#define STI_MEMSIZE 0x0003f000 /* XXX */
+
+int sti_sgc_match(struct device *, void *, void *);
+void sti_sgc_attach(struct device *, struct device *, void *);
+
+struct cfattach sti_sgc_ca = {
+ sizeof(struct sti_softc), sti_sgc_match, sti_sgc_attach
+};
+
+int
+sti_sgc_match(struct device *parent, void *match, void *aux)
+{
+ struct sgc_attach_args *saa = aux;
+ bus_space_tag_t iot;
+ bus_space_handle_t ioh;
+ int devtype;
+
+#ifdef SGC_CONSOLE
+ /*
+ * If we already probed it succesfully as a console device, go ahead,
+ * since we will not be able to bus_space_map() again.
+ */
+ if (SGC_SLOT_TO_CONSCODE(saa->saa_slot) == conscode)
+ return (1);
+#endif
+
+ iot = HP300_BUS_TAG(HP300_BUS_SGC, saa->saa_slot);
+
+ if (bus_space_map(iot, (bus_addr_t)sgc_slottopa(saa->saa_slot),
+ PAGE_SIZE, 0, &ioh))
+ return (0);
+
+ devtype = bus_space_read_1(iot, ioh, 3);
+
+ bus_space_unmap(iot, ioh, PAGE_SIZE);
+
+ /*
+ * This might not be reliable enough. On the other hand, non-STI
+ * SGC cards will apparently not initialize in an hp300, to the
+ * point of not even answering bus probes (checked with an
+ * Harmony/FDDI SGC card).
+ */
+ if (devtype != STI_DEVTYPE1 && devtype != STI_DEVTYPE4)
+ return (0);
+
+ return (1);
+}
+
+void
+sti_sgc_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct sti_softc *sc = (void *)self;
+ struct sgc_attach_args *saa = aux;
+
+ sc->memt = sc->iot = HP300_BUS_TAG(HP300_BUS_SGC, saa->saa_slot);
+ sc->base = (bus_addr_t)sgc_slottopa(saa->saa_slot);
+
+ if (bus_space_map(sc->iot, sc->base, STI_MEMSIZE, 0, &sc->romh)) {
+ printf(": can't map frame buffer");
+ return;
+ }
+
+ if (SGC_SLOT_TO_CONSCODE(saa->saa_slot) == conscode)
+ sc->sc_flags |= STI_CONSOLE;
+
+ sti_attach_common(sc, STI_CODEBASE_M68K);
+}
+
+/*
+ * Console code
+ */
+
+int sti_console_scan(int, caddr_t, void *);
+cons_decl(sti);
+
+int
+sti_console_scan(int slot, caddr_t va, void *arg)
+{
+#ifdef SGC_CONSOLE
+ struct consdev *cp = arg;
+ bus_space_tag_t iot;
+ bus_space_handle_t ioh;
+ int force = 0, pri;
+ int devtype;
+
+ iot = HP300_BUS_TAG(HP300_BUS_SGC, slot);
+
+ if (bus_space_map(iot, (bus_addr_t)sgc_slottopa(slot), STI_MEMSIZE, 0,
+ &ioh))
+ return (0);
+
+ devtype = bus_space_read_1(iot, ioh, 3);
+
+ bus_space_unmap(iot, ioh, STI_MEMSIZE);
+
+ /* XXX this is not reliable enough */
+ if (devtype != STI_DEVTYPE1 && devtype != STI_DEVTYPE4)
+ return (0);
+
+ pri = CN_INTERNAL;
+
+#ifdef CONSCODE
+ /*
+ * Raise our priority, if appropriate.
+ */
+ if (SGC_SLOT_TO_CONSCODE(slot) == 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;
+ return (1);
+ }
+
+ return (0);
+#else
+ /* Do not allow console to be on an SGC device (yet). */
+ return (0);
+#endif
+}
+
+void
+sticnprobe(struct consdev *cp)
+{
+ int maj;
+
+ /* Abort early if the console is already forced. */
+ if (conforced)
+ return;
+
+ for (maj = 0; maj < nchrdev; maj++) {
+ if (cdevsw[maj].d_open == wsdisplayopen)
+ break;
+ }
+
+ if (maj == nchrdev)
+ return;
+
+ cp->cn_dev = makedev(maj, 0);
+ cp->cn_pri = CN_DEAD;
+
+ /* Search for an sti device */
+ console_scan(sti_console_scan, cp, HP300_BUS_SGC);
+}
+
+void
+sticninit(struct consdev *cp)
+{
+ /*
+ * We should theoretically initialize the sti driver here.
+ * However, since it relies upon the vm system being initialized,
+ * which is not the case at this point, postpone the initialization.
+ *
+ * We can't even use the PROM output services, since they are not
+ * available AT ALL when we are running virtual.
+ */
+}
diff --git a/sys/arch/hp300/dev/topcat.c b/sys/arch/hp300/dev/topcat.c
new file mode 100644
index 00000000000..d9a5c3dc922
--- /dev/null
+++ b/sys/arch/hp300/dev/topcat.c
@@ -0,0 +1,577 @@
+/* $OpenBSD: topcat.c,v 1.1 2005/01/14 22:39:26 miod Exp $ */
+
+/*
+ * Copyright (c) 2005, Miodrag Vallat.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ */
+/*
+ * 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.
+ *
+ * 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. 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: grf_tc.c 1.20 93/08/13$
+ *
+ * @(#)grf_tc.c 8.4 (Berkeley) 1/12/94
+ */
+
+/*
+ * Graphics routines for TOPCAT, CATSEYE and KATHMANDU frame buffers
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+#include <sys/proc.h>
+#include <sys/ioctl.h>
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+#include <machine/cpu.h>
+
+#include <hp300/dev/dioreg.h>
+#include <hp300/dev/diovar.h>
+#include <hp300/dev/diodevs.h>
+#include <hp300/dev/intiovar.h>
+
+#include <dev/cons.h>
+
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wsdisplayvar.h>
+
+#include <hp300/dev/diofbreg.h>
+#include <hp300/dev/diofbvar.h>
+#include <hp300/dev/topcatreg.h>
+
+struct topcat_softc {
+ struct device sc_dev;
+ struct diofb *sc_fb;
+ struct diofb sc_fb_store;
+ int sc_scode;
+};
+
+int topcat_dio_match(struct device *, void *, void *);
+void topcat_dio_attach(struct device *, struct device *, void *);
+int topcat_intio_match(struct device *, void *, void *);
+void topcat_intio_attach(struct device *, struct device *, void *);
+
+struct cfattach topcat_dio_ca = {
+ sizeof(struct topcat_softc), topcat_dio_match, topcat_dio_attach
+};
+
+struct cfattach topcat_intio_ca = {
+ sizeof(struct topcat_softc), topcat_intio_match, topcat_intio_attach
+};
+
+struct cfdriver topcat_cd = {
+ NULL, "topcat", DV_DULL
+};
+
+void topcat_end_attach(struct topcat_softc *, u_int8_t);
+int topcat_reset(struct diofb *, int, struct diofbreg *);
+void topcat_setcolor(struct diofb *, u_int,
+ u_int8_t, u_int8_t, u_int8_t);
+void topcat_windowmove(struct diofb *, u_int16_t, u_int16_t,
+ u_int16_t, u_int16_t, u_int16_t, u_int16_t, int);
+
+int topcat_ioctl(void *, u_long, caddr_t, int, struct proc *);
+void topcat_burner(void *, u_int, u_int);
+
+struct wsdisplay_accessops topcat_accessops = {
+ topcat_ioctl,
+ diofb_mmap,
+ diofb_alloc_screen,
+ diofb_free_screen,
+ diofb_show_screen,
+ NULL, /* load_font */
+ NULL, /* scrollback */
+ NULL, /* getchar */
+ topcat_burner
+};
+
+/*
+ * Attachment glue
+ */
+
+int
+topcat_intio_match(struct device *parent, void *match, void *aux)
+{
+ struct intio_attach_args *ia = aux;
+ struct diofbreg *fbr;
+
+ fbr = (struct diofbreg *)IIOV(GRFIADDR);
+
+ if (badaddr((caddr_t)fbr))
+ return (0);
+
+ if (fbr->id == GRFHWID) {
+ switch (fbr->id2) {
+ case GID_TOPCAT:
+ case GID_LRCATSEYE:
+ case GID_HRCCATSEYE:
+ case GID_HRMCATSEYE:
+#if 0
+ case GID_XXXCATSEYE:
+#endif
+ ia->ia_addr = (caddr_t)GRFIADDR;
+ return (1);
+ }
+ }
+
+ return (0);
+}
+
+void
+topcat_intio_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct topcat_softc *sc = (struct topcat_softc *)self;
+ struct diofbreg *fbr;
+
+ fbr = (struct diofbreg *)IIOV(GRFIADDR);
+ sc->sc_scode = -1; /* XXX internal i/o */
+
+ if (sc->sc_scode == conscode) {
+ sc->sc_fb = &diofb_cn;
+ } else {
+ sc->sc_fb = &sc->sc_fb_store;
+ topcat_reset(sc->sc_fb, sc->sc_scode, fbr);
+ }
+
+ topcat_end_attach(sc, fbr->id2);
+}
+
+int
+topcat_dio_match(struct device *parent, void *match, void *aux)
+{
+ struct dio_attach_args *da = aux;
+
+ if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER) {
+ switch (da->da_secid) {
+ case DIO_DEVICE_SECID_TOPCAT:
+ case DIO_DEVICE_SECID_LRCATSEYE:
+ case DIO_DEVICE_SECID_HRCCATSEYE:
+ case DIO_DEVICE_SECID_HRMCATSEYE:
+#if 0
+ case DIO_DEVICE_SECID_XXXCATSEYE:
+#endif
+ return (1);
+ }
+ }
+
+ return (0);
+}
+
+void
+topcat_dio_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct topcat_softc *sc = (struct topcat_softc *)self;
+ struct dio_attach_args *da = aux;
+ struct diofbreg *fbr;
+
+ sc->sc_scode = da->da_scode;
+ if (sc->sc_scode == conscode) {
+ fbr = (struct diofbreg *)conaddr; /* already mapped */
+ sc->sc_fb = &diofb_cn;
+ } else {
+ sc->sc_fb = &sc->sc_fb_store;
+ fbr = (struct diofbreg *)
+ iomap(dio_scodetopa(sc->sc_scode), da->da_size);
+ if (fbr == NULL ||
+ topcat_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) {
+ printf(": can't map framebuffer\n");
+ return;
+ }
+ }
+
+ topcat_end_attach(sc, fbr->id2);
+}
+
+void
+topcat_end_attach(struct topcat_softc *sc, u_int8_t id)
+{
+ const char *fbname = "unknown";
+
+ switch (id) {
+ case GID_TOPCAT:
+ switch (sc->sc_fb->planes) {
+ case 1:
+ fbname = "HP98544 topcat";
+ break;
+ case 4:
+ if (sc->sc_fb->dheight == 400)
+ fbname = "HP98543 topcat";
+ else
+ fbname = "HP98545 topcat";
+ break;
+ case 6:
+ fbname = "HP98547 topcat";
+ break;
+ }
+ break;
+ case GID_HRCCATSEYE:
+ fbname = "HP98550 catseye";
+ break;
+ case GID_LRCATSEYE:
+ fbname = "HP98549 catseye";
+ break;
+ case GID_HRMCATSEYE:
+ fbname = "HP98548 catseye";
+ break;
+ }
+
+ diofb_end_attach(sc, &topcat_accessops, sc->sc_fb,
+ sc->sc_scode == conscode, 0, fbname);
+}
+
+/*
+ * Initialize hardware and display routines.
+ */
+int
+topcat_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
+{
+ volatile struct tcboxfb *tc = (struct tcboxfb *)fbr;
+ int rc;
+
+ if ((rc = diofb_fbinquire(fb, scode, fbr, 0x10000)) != 0)
+ return (rc);
+
+ fb->planes = tc->num_planes;
+ fb->planemask = (1 << fb->planes) - 1;
+
+ /*
+ * If we could not get a valid number of planes, determine it
+ * by writing to the first frame buffer display location,
+ * then reading it back.
+ */
+ if (fb->planes == 0) { /* gee, no planes reported above */
+ volatile u_int8_t *fbp;
+ u_int8_t save;
+
+ fbp = (u_int8_t *)fb->fbkva;
+ tc->fben = ~0;
+ tc->wen = ~0;
+ tc->ren = ~0;
+ tc->prr = RR_COPY;
+ save = *fbp;
+ *fbp = 0xff;
+ fb->planemask = *fbp;
+ *fbp = save;
+
+ for (fb->planes = 1; fb->planemask >= (1 << fb->planes);
+ fb->planes++);
+ }
+
+ /*
+ * Catseye looks a lot like a topcat, but not completely.
+ * So, we set some bits to make it work.
+ */
+ if (tc->fbid != GID_TOPCAT) {
+ while ((tc->catseye_status & 1))
+ ;
+ tc->catseye_status = 0x0;
+ tc->vb_select = 0x0;
+ tc->tcntrl = 0x0;
+ tc->acntrl = 0x0;
+ tc->pncntrl = 0x0;
+ tc->rug_cmdstat = 0x90;
+ }
+
+ /*
+ * Enable reading/writing of all the planes.
+ */
+ tc->fben = fb->planemask;
+ tc->wen = fb->planemask;
+ tc->ren = fb->planemask;
+ tc->prr = RR_COPY;
+
+ fb->bmv = topcat_windowmove;
+ diofb_fbsetup(fb);
+ diofb_fontunpack(fb);
+
+ /*
+ * Initialize color map for color displays
+ */
+ if (fb->planes > 1) {
+ topcat_setcolor(fb, 0, 0, 0, 0);
+ topcat_setcolor(fb, 1, 255, 255, 255);
+ }
+
+ /*
+ * Enable display.
+ */
+ tc->nblank = 0xff;
+
+ return (0);
+}
+
+int
+topcat_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
+{
+ struct diofb *fb = v;
+ struct wsdisplay_fbinfo *wdf;
+
+ switch (cmd) {
+ case WSDISPLAYIO_GTYPE:
+ *(u_int *)data = WSDISPLAY_TYPE_UNKNOWN;
+ break;
+ case WSDISPLAYIO_GINFO:
+ wdf = (void *)data;
+ wdf->height = fb->dheight;
+ wdf->width = fb->dwidth;
+ wdf->depth = fb->planes;
+ wdf->cmsize = 1 << fb->planes;
+ break;
+ case WSDISPLAYIO_LINEBYTES:
+ *(u_int *)data = (fb->fbwidth * fb->planes) >> 3;
+ break;
+ case WSDISPLAYIO_GETCMAP:
+ case WSDISPLAYIO_PUTCMAP:
+ /* XXX TBD */
+ break;
+ case WSDISPLAYIO_GVIDEO:
+ case WSDISPLAYIO_SVIDEO:
+ break;
+ default:
+ return (-1);
+ }
+
+ return (0);
+}
+
+void
+topcat_burner(void *v, u_int on, u_int flags)
+{
+ struct diofb *fb = v;
+ volatile struct tcboxfb *tc = (struct tcboxfb *)fb->regkva;
+
+ if (on) {
+ tc->nblank = 0xff;
+ } else {
+ tc->nblank = 0;
+ }
+}
+
+void
+topcat_setcolor(struct diofb *fb, u_int index,
+ u_int8_t r, u_int8_t g, u_int8_t b)
+{
+ volatile struct tcboxfb *tc = (struct tcboxfb *)fb->regkva;
+
+ tccm_waitbusy(tc);
+ tc->rdata = r;
+ tc->gdata = g;
+ tc->bdata = b;
+ tc->cindex = 255 - index;
+ tc->strobe = 0xff;
+
+ tccm_waitbusy(tc);
+ tc->rdata = 0;
+ tc->gdata = 0;
+ tc->bdata = 0;
+ tc->cindex = 0;
+}
+
+/*
+ * Accelerated routines
+ */
+
+void
+topcat_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
+ u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int rop)
+{
+ volatile struct tcboxfb *tc = (struct tcboxfb *)fb->regkva;
+
+ tc_waitbusy(tc, fb->planemask);
+
+ tc->wmrr = rop;
+ tc->source_y = sy;
+ tc->source_x = sx;
+ tc->dest_y = dy;
+ tc->dest_x = dx;
+ tc->wheight = cy;
+ tc->wwidth = cx;
+ tc->wmove = fb->planemask;
+}
+
+/*
+ * Topcat/catseye console support
+ */
+
+int topcat_console_scan(int, caddr_t, void *);
+cons_decl(topcat);
+
+int
+topcat_console_scan(int scode, caddr_t va, void *arg)
+{
+ struct diofbreg *fbr = (struct diofbreg *)va;
+ struct consdev *cp = arg;
+ u_char *dioiidev;
+ int force = 0, pri;
+
+ if (fbr->id != GRFHWID)
+ return (0);
+
+ switch (fbr->id2) {
+ case GID_TOPCAT:
+ case GID_LRCATSEYE:
+ case GID_HRCCATSEYE:
+ case GID_HRMCATSEYE:
+ break;
+
+ default:
+ return (0);
+ }
+
+ pri = CN_INTERNAL;
+
+#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 >= DIOII_SCBASE) {
+ dioiidev = (u_char *)va;
+ return ((dioiidev[0x101] + 1) * 0x100000);
+ }
+ return (DIO_DEVSIZE);
+ }
+ return (0);
+}
+
+void
+topcatcnprobe(struct consdev *cp)
+{
+ int maj;
+ caddr_t va;
+ struct diofbreg *fbr;
+ int force = 0;
+
+ /* Abort early if the console is already forced. */
+ if (conforced)
+ return;
+
+ for (maj = 0; maj < nchrdev; maj++) {
+ if (cdevsw[maj].d_open == wsdisplayopen)
+ break;
+ }
+
+ if (maj == nchrdev)
+ return;
+
+ cp->cn_dev = makedev(maj, 0);
+ cp->cn_pri = CN_DEAD;
+
+ /* Look for "internal" framebuffer. */
+ va = (caddr_t)IIOV(GRFIADDR);
+ fbr = (struct diofbreg *)va;
+ if (!badaddr(va) && (fbr->id == GRFHWID)) {
+ switch (fbr->id2) {
+ case GID_TOPCAT:
+ case GID_LRCATSEYE:
+ case GID_HRCCATSEYE:
+ case GID_HRMCATSEYE:
+ cp->cn_pri = CN_INTERNAL;
+
+#ifdef CONSCODE
+ if (CONSCODE == -1) {
+ 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, HP300_BUS_DIO);
+}
+
+void
+topcatcninit(struct consdev *cp)
+{
+ long defattr;
+
+ topcat_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
+ diofb_alloc_attr(NULL, 0, 0, 0, &defattr);
+ wsdisplay_cnattach(&diofb_cn.wsd, &diofb_cn, 0, 0, defattr);
+}
diff --git a/sys/arch/hp300/dev/topcatreg.h b/sys/arch/hp300/dev/topcatreg.h
new file mode 100644
index 00000000000..2cd029af3d5
--- /dev/null
+++ b/sys/arch/hp300/dev/topcatreg.h
@@ -0,0 +1,146 @@
+/* $OpenBSD: topcatreg.h,v 1.1 2005/01/14 22:39:26 miod Exp $ */
+/* $NetBSD: grf_tcreg.h,v 1.6 1994/10/26 07:24:06 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. 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: grf_tcreg.h 1.11 92/01/21$
+ *
+ * @(#)grf_tcreg.h 8.1 (Berkeley) 6/10/93
+ */
+
+#define tccm_waitbusy(regaddr) \
+do { \
+ while (((volatile struct tcboxfb *)(regaddr))->cmap_busy & 0x04) \
+ DELAY(10); \
+} while (0)
+
+#define tc_waitbusy(regaddr,planes) \
+do { \
+ while (((volatile struct tcboxfb *)(regaddr))->busy & planes) \
+ DELAY(10); \
+} while (0)
+
+struct tcboxfb {
+ u_int8_t :8;
+ u_int8_t reset; /* reset register 0x01 */
+ u_int8_t fb_address; /* frame buffer address 0x02 */
+ u_int8_t interrupt; /* interrupt register 0x03 */
+ u_int8_t :8;
+ u_int8_t fbwmsb; /* frame buffer width MSB 0x05 */
+ u_int8_t :8;
+ u_int8_t fbwlsb; /* frame buffer width MSB 0x07 */
+ u_int8_t :8;
+ u_int8_t fbhmsb; /* frame buffer height MSB 0x09 */
+ u_int8_t :8;
+ u_int8_t fbhlsb; /* frame buffer height MSB 0x0b */
+ u_int8_t :8;
+ u_int8_t dwmsb; /* display width MSB 0x0d */
+ u_int8_t :8;
+ u_int8_t dwlsb; /* display width MSB 0x0f */
+ u_int8_t :8;
+ u_int8_t dhmsb; /* display height MSB 0x11 */
+ u_int8_t :8;
+ u_int8_t dhlsb; /* display height MSB 0x13 */
+ u_int8_t :8;
+ u_int8_t fbid; /* Scondary frame buffer id 0x15 */
+ u_int8_t :8;
+ u_int8_t bits; /* square(0)/double-high(1) 0x17 */
+ u_int8_t f1[0x5b-0x17-1];
+ u_int8_t num_planes; /* number of color planes 0x5b */
+ u_int8_t :8;
+ u_int8_t fbomsb; /* frame buffer offset MSB 0x5d */
+ u_int8_t :8;
+ u_int8_t fbolsb; /* frame buffer offset LSB 0x5f */
+ u_int8_t f2[0x4040-0x5f-1];
+ u_int8_t vblank; /* vertical blanking 0x4040 */
+ u_int8_t :8,:8,:8;
+ u_int8_t busy; /* window move active 0x4044 */
+ u_int8_t :8,:8,:8;
+ u_int8_t vtrace_request; /* vert retrace intr request 0x4048 */
+ u_int8_t :8,:8,:8;
+ u_int8_t move_request; /* window move intr request 0x404C */
+ u_int8_t f3[0x4080-0x404c-1];
+ u_int8_t nblank; /* display enable planes 0x4080 */
+ u_int8_t f4[0x4088-0x4080-1];
+ u_int8_t wen; /* write enable plane 0x4088 */
+ u_int8_t f5[0x408c-0x4088-1];
+ u_int8_t ren; /* read enable plane 0x408c */
+ u_int8_t f6[0x4090-0x408c-1];
+ u_int8_t fben; /* frame buffer write enable 0x4090 */
+ u_int8_t f7[0x409c-0x4090-1];
+ u_int8_t wmove; /* start window move 0x409c */
+ u_int8_t f8[0x40a0-0x409c-1];
+ u_int8_t blink; /* enable blink planes 0x40a0 */
+ u_int8_t f9[0x40a8-0x40a0-1];
+ u_int8_t altframe; /* enable alternate frame 0x40a8 */
+ u_int8_t f10[0x40ac-0x40a8-1];
+ u_int8_t curon; /* cursor control register 0x40ac */
+ u_int8_t f11[0x40ea-0x40ac-1];
+ u_int8_t prr; /* pixel replacement rule 0x40ea */
+ u_int8_t f12[0x40ef-0x40ea-1];
+ u_int8_t wmrr; /* move replacement rule 0x40ef */
+ u_int8_t f13[0x40f2-0x40ef-1];
+ u_int16_t source_x; /* source x pixel # 0x40f2 */
+ u_int8_t f14[0x40f6-0x40f2-2];
+ u_int16_t source_y; /* source y pixel # 0x40f6 */
+ u_int8_t f15[0x40fa-0x40f6-2];
+ u_int16_t dest_x; /* dest x pixel # 0x40fa */
+ u_int8_t f16[0x40fe -0x40fa-2];
+ u_int16_t dest_y; /* dest y pixel # 0x40fe */
+ u_int8_t f17[0x4102-0x40fe -2];
+ u_int16_t wwidth; /* block mover pixel width 0x4102 */
+ u_int8_t f18[0x4106-0x4102-2];
+ u_int16_t wheight; /* block mover pixel height 0x4106 */
+ /* Catseye */
+ u_int8_t f19[0x4206-0x4106-2];
+ u_int16_t rug_cmdstat; /* RUG Command/Staus 0x4206 */
+ u_int8_t f20[0x4510-0x4206-2];
+ u_int16_t vb_select; /* Vector/BitBlt Select 0x4510 */
+ u_int16_t tcntrl; /* Three Operand Control 0x4512 */
+ u_int16_t acntrl; /* BitBlt Mode 0x4514 */
+ u_int16_t pncntrl; /* Plane Control 0x4516 */
+ u_int8_t f21[0x4800-0x4516-2];
+ u_int16_t catseye_status; /* Catseye Status 0x4800 */
+ /* End of Catseye */
+ u_int8_t f22[0x6002-0x4800-2];
+ u_int16_t cmap_busy; /* Color Ram busy 0x6002 */
+ u_int8_t f23[0x60b2-0x6002-2];
+ u_int16_t rdata; /* color map red data 0x60b2 */
+ u_int16_t gdata; /* color map green data 0x60b4 */
+ u_int16_t bdata; /* color map blue data 0x60b6 */
+ u_int16_t cindex; /* color map index 0x60b8 */
+ u_int16_t plane_mask; /* plane mask select 0x60ba */
+ u_int8_t f24[0x60f0-0x60ba-2];
+ u_int16_t strobe; /* color map trigger 0x60f0 */
+};
diff --git a/sys/arch/hp300/hp300/autoconf.c b/sys/arch/hp300/hp300/autoconf.c
index f4d6ccb191f..6ca63d1b6a1 100644
--- a/sys/arch/hp300/hp300/autoconf.c
+++ b/sys/arch/hp300/hp300/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.29 2005/01/09 00:09:51 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.30 2005/01/14 22:39:27 miod Exp $ */
/* $NetBSD: autoconf.c,v 1.45 1999/04/10 17:31:02 kleink Exp $ */
/*
@@ -76,6 +76,7 @@
#include <dev/cons.h>
#include <machine/autoconf.h>
+#include <machine/bus.h>
#include <machine/vmparam.h>
#include <machine/cpu.h>
#include <machine/hp300spu.h>
@@ -87,15 +88,18 @@
#include <hp300/dev/diodevs.h>
#include <hp300/dev/dmavar.h>
-#include <hp300/dev/grfreg.h>
-#include <hp300/dev/hilreg.h>
-#include <hp300/dev/hilioctl.h>
-#include <hp300/dev/hilvar.h>
#include <hp300/dev/hpibvar.h>
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
+#include "sgc.h"
+
+#if NSGC > 0
+#include <hp300/dev/sgcreg.h>
+#include <hp300/dev/sgcvar.h>
+#endif
+
/*
* The following several variables are related to
* the configuration process, and are used in initializing
@@ -176,7 +180,7 @@ static struct device *getdisk(char *str, int len, int defpart,
dev_t *devp);
static int findblkmajor(struct device *dv);
static char *findblkname(int);
-static int getstr(char *cp, int size);
+static int getstr(char *cp, int size);
static int device_match(const char *, const char *);
int mainbusmatch(struct device *, void *, void *);
@@ -243,19 +247,6 @@ cpu_configure()
LIST_INIT(&dev_data_list_hpib);
LIST_INIT(&dev_data_list_scsi);
- /*
- * XXX In order for the HIL to configure, interrupts need to be
- * XXX enabled. However, we need to initialize the HIL driver's
- * XXX software state prior to that, since a pending interrupt
- * XXX might cause the HIL's interrupt handler to be run in an
- * XXX uninitialized environment otherwise.
- *
- * XXX These should be consolidated into some kind of table.
- */
- hilsoftinit(0, HILADDR);
- (void)spl0();
- hilinit(0, HILADDR);
-
(void)splhigh();
if (config_rootfound("mainbus", "mainbus") == NULL)
panic("no mainbus found");
@@ -722,7 +713,7 @@ setroot()
bzero(buf, sizeof(buf));
snprintf(buf, sizeof buf, "%s%d", rootdevname,
DISKUNIT(rootdev));
-
+
TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (strcmp(buf, dv->dv_xname) == 0) {
root_device = dv;
@@ -781,15 +772,15 @@ setroot()
}
static int
-getstr(cp, size)
+getstr(cp, size)
register char *cp;
register int size;
{
register char *lp;
- register int c;
+ register int c;
register int len;
- lp = cp;
+ lp = cp;
len = 0;
for (;;) {
c = cngetc();
@@ -901,8 +892,8 @@ findbootdev()
if (scsiboot) {
findbootdev_slave(&dev_data_list_scsi, ctlr,
slave, punit);
- if (booted_device == NULL)
- return;
+ if (booted_device == NULL)
+ return;
#ifdef DIAGNOSTIC
/*
@@ -914,7 +905,7 @@ findbootdev()
printf("WARNING: boot device/type mismatch!\n");
printf("device = %s, type = %d\n",
booted_device->dv_xname, type);
- booted_device = NULL;
+ booted_device = NULL;
}
#endif
return;
@@ -1124,68 +1115,117 @@ dev_data_insert(dd, ddlist)
* hardware.
*/
void
-console_scan(func, arg)
+console_scan(func, arg, bus)
int (*func)(int, caddr_t, void *);
void *arg;
+ int bus;
{
- int size, scode, sctop;
+ int rv, 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 = DIO_SCMAX(machineid);
- for (scode = 0; scode < sctop; ++scode) {
+ switch (bus) {
+ case HP300_BUS_DIO:
/*
- * Abort mission if console has been forced.
+ * Scan all select codes. Check each location for some
+ * hardware. If there's something there, call (*func)().
*/
- if (conforced)
- return;
+ sctop = DIO_SCMAX(machineid);
+ 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;
+ /*
+ * Skip over the select code hole and
+ * the internal HP-IB controller.
+ */
+ if (DIO_INHOLE(scode) ||
+ ((scode == 7) && internalhpib))
+ continue;
- /* Map current PA. */
- pa = dio_scodetopa(scode);
- va = iomap(pa, NBPG);
- if (va == 0)
- continue;
+ /* Map current PA. */
+ pa = dio_scodetopa(scode);
+ va = iomap(pa, PAGE_SIZE);
+ if (va == NULL)
+ continue;
- /* Check to see if hardware exists. */
- if (badaddr(va)) {
- iounmap(va, NBPG);
- continue;
- }
+ /* Check to see if hardware exists. */
+ if (badaddr(va)) {
+ iounmap(va, PAGE_SIZE);
+ 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, PAGE_SIZE);
+ if (size != 0) {
+ /* Free last mapping. */
+ if (convasize)
+ iounmap(conaddr, convasize);
+ convasize = 0;
+
+ /* Remap to correct size. */
+ va = iomap(pa, size);
+ if (va == NULL)
+ continue;
+
+ /* Save this state for next time. */
+ conscode = scode;
+ conaddr = va;
+ convasize = size;
+ }
+ }
+ break;
+#if NSGC > 0
+ case HP300_BUS_SGC:
/*
- * Hardware present, call callback. Driver returns
- * size of region to map if console probe successful
- * and worthwhile.
+ * Scan all slots. Check each location for some
+ * hardware. If there's something there, call (*func)().
*/
- 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)
+ for (scode = 0; scode < SGC_NSLOTS; ++scode) {
+ /*
+ * Abort mission if console has been forced.
+ */
+ if (conforced)
+ return;
+
+ /* Map current PA. */
+ pa = sgc_slottopa(scode);
+ va = iomap(pa, PAGE_SIZE);
+ if (va == NULL)
+ continue;
+
+ /* Check for hardware. */
+ rv = badaddr(va);
+ iounmap(va, PAGE_SIZE);
+ if (rv != 0)
continue;
- /* Save this state for next time. */
- conscode = scode;
- conaddr = va;
- convasize = size;
+ /*
+ * Invoke the callback. Driver will return
+ * non-zero if console probe successfull
+ * and worthwhile.
+ */
+ size = (*func)(scode, NULL, arg);
+ if (size) {
+ /* Free last mapping. */
+ if (convasize)
+ iounmap(conaddr, convasize);
+
+ /* Save this state for next time. */
+ conscode = SGC_SLOT_TO_CONSCODE(scode);
+ conaddr = NULL;
+ convasize = 0;
+ }
}
+ break;
+#endif
}
}
@@ -1248,8 +1288,8 @@ iomap(pa, size)
if (error != 0)
return NULL;
- physaccess(kva, pa, size, PG_RW|PG_CI);
- return(kva);
+ physaccess(kva, pa, size, PG_RW | PG_CI);
+ return (kva);
}
/*
diff --git a/sys/arch/hp300/hp300/bus_space.c b/sys/arch/hp300/hp300/bus_space.c
new file mode 100644
index 00000000000..6d6d69b6bab
--- /dev/null
+++ b/sys/arch/hp300/hp300/bus_space.c
@@ -0,0 +1,249 @@
+/* $OpenBSD: bus_space.c,v 1.1 2005/01/14 22:39:27 miod Exp $ */
+/* $NetBSD: bus_space.c,v 1.6 2002/09/27 15:36:02 provos Exp $ */
+
+/*-
+ * Copyright (c) 1998 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:
+ * 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 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 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 FOUNDATION 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.
+ */
+
+/*
+ * Implementation of bus_space mapping for the hp300.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/extent.h>
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <hp300/dev/sgcvar.h>
+
+#include "sgc.h"
+
+extern char *extiobase;
+extern struct extent *extio;
+extern int *nofault;
+
+/* ARGSUSED */
+int
+bus_space_map(t, bpa, size, flags, bshp)
+ bus_space_tag_t t;
+ bus_addr_t bpa;
+ bus_size_t size;
+ int flags;
+ bus_space_handle_t *bshp;
+{
+ u_long kva;
+ int error;
+
+ switch (HP300_TAG_BUS(t)) {
+ case HP300_BUS_INTIO:
+ /*
+ * Intio space is direct-mapped in pmap_bootstrap(); just
+ * do the translation.
+ */
+ *bshp = (bus_space_handle_t)IIOV(INTIOBASE + bpa);
+ return (0);
+ case HP300_BUS_DIO:
+ break;
+#if NSGC > 0
+ case HP300_BUS_SGC:
+#if 0
+ bpa += (bus_addr_t)sgc_slottopa(HP300_TAG_CODE(t));
+#endif
+ break;
+#endif
+ default:
+ panic("bus_space_map: bad space tag");
+ }
+
+ /*
+ * Allocate virtual address space from the extio extent map.
+ */
+ size = m68k_round_page(size);
+ error = extent_alloc(extio, size, PAGE_SIZE, 0, EX_NOBOUNDARY,
+ EX_NOWAIT | EX_MALLOCOK, &kva);
+ if (error)
+ return (error);
+
+ /*
+ * Map the range. The range is always cache-inhibited on the hp300.
+ */
+ physaccess((caddr_t)kva, (caddr_t)bpa, size, PG_RW | PG_CI);
+
+ /*
+ * All done.
+ */
+ *bshp = (bus_space_handle_t)kva;
+ return (0);
+}
+
+/* ARGSUSED */
+int
+bus_space_alloc(t, rstart, rend, size, alignment, boundary, flags,
+ bpap, bshp)
+ bus_space_tag_t t;
+ bus_addr_t rstart, rend;
+ bus_size_t size, alignment, boundary;
+ int flags;
+ bus_addr_t *bpap;
+ bus_space_handle_t *bshp;
+{
+
+ /*
+ * Not meaningful on any currently-supported hp300 bus.
+ */
+ return (EINVAL);
+}
+
+/* ARGSUSED */
+void
+bus_space_free(t, bsh, size)
+ bus_space_tag_t t;
+ bus_space_handle_t bsh;
+ bus_size_t size;
+{
+
+ /*
+ * Not meaningful on any currently-supported hp300 bus.
+ */
+ panic("bus_space_free: shouldn't be here");
+}
+
+void
+bus_space_unmap(t, bsh, size)
+ bus_space_tag_t t;
+ bus_space_handle_t bsh;
+ bus_size_t size;
+{
+#ifdef DIAGNOSTIC
+ extern int eiomapsize;
+#endif
+
+ switch (HP300_TAG_BUS(t)) {
+ case HP300_BUS_INTIO:
+ /*
+ * Intio space is direct-mapped in pmap_bootstrap(); nothing
+ * to do.
+ */
+ return;
+ case HP300_BUS_DIO:
+#if NSGC > 0
+ case HP300_BUS_SGC:
+#endif
+#ifdef DIAGNOSTIC
+ if ((caddr_t)bsh < extiobase ||
+ (caddr_t)bsh >= (extiobase + ptoa(eiomapsize)))
+ panic("bus_space_unmap: bad bus space handle");
+#endif
+ break;
+ default:
+ panic("bus_space_unmap: bad space tag");
+ }
+
+ size = m68k_round_page(size);
+
+#ifdef DIAGNOSTIC
+ if (bsh & PGOFSET)
+ panic("bus_space_unmap: unaligned");
+#endif
+
+ /*
+ * Unmap the range.
+ */
+ physunaccess((caddr_t)bsh, size);
+
+ /*
+ * Free it from the extio extent map.
+ */
+ if (extent_free(extio, (u_long)bsh, size,
+ EX_NOWAIT | EX_MALLOCOK))
+ printf("bus_space_unmap: kva 0x%lx size 0x%lx: "
+ "can't free region\n", (u_long) bsh, size);
+}
+
+/* ARGSUSED */
+int
+bus_space_subregion(t, bsh, offset, size, nbshp)
+ bus_space_tag_t t;
+ bus_space_handle_t bsh;
+ bus_size_t offset, size;
+ bus_space_handle_t *nbshp;
+{
+
+ *nbshp = bsh + offset;
+ return (0);
+}
+
+/* ARGSUSED */
+int
+hp300_bus_space_probe(t, bsh, offset, sz)
+ bus_space_tag_t t;
+ bus_space_handle_t bsh;
+ bus_size_t offset;
+ int sz;
+{
+ label_t faultbuf;
+ int i;
+
+ nofault = (int *)&faultbuf;
+ if (setjmp((label_t *)nofault)) {
+ nofault = NULL;
+ return (0);
+ }
+
+ switch (sz) {
+ case 1:
+ i = bus_space_read_1(t, bsh, offset);
+ break;
+
+ case 2:
+ i = bus_space_read_2(t, bsh, offset);
+ break;
+
+ case 4:
+ i = bus_space_read_4(t, bsh, offset);
+ break;
+
+ default:
+ panic("bus_space_probe: unupported data size %d", sz);
+ /* NOTREACHED */
+ }
+
+ nofault = NULL;
+ return (1);
+}
diff --git a/sys/arch/hp300/hp300/clock.c b/sys/arch/hp300/hp300/clock.c
index 47464d05773..cb97306e65f 100644
--- a/sys/arch/hp300/hp300/clock.c
+++ b/sys/arch/hp300/hp300/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.11 2004/10/02 21:28:54 miod Exp $ */
+/* $OpenBSD: clock.c,v 1.12 2005/01/14 22:39:27 miod Exp $ */
/* $NetBSD: clock.c,v 1.20 1997/04/27 20:43:38 thorpej Exp $ */
/*
@@ -57,9 +57,7 @@
#include <machine/cpu.h>
#include <machine/hp300spu.h>
-#include <hp300/dev/hilreg.h>
-#include <hp300/dev/hilioctl.h>
-#include <hp300/dev/hilvar.h>
+#include <dev/hil/hilreg.h> /* for BBC */
#include <hp300/hp300/clockreg.h>
#ifdef GPROF
@@ -87,7 +85,7 @@ static int month_days[12] = {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
u_char bbc_registers[13];
-struct hil_dev *bbcaddr = NULL;
+volatile u_int8_t *bbcaddr = NULL;
void clockintr(struct clockframe *);
void statintr(struct clockframe *);
@@ -97,6 +95,8 @@ struct bbc_tm *gmt_to_bbc(long);
int bbc_to_gmt(u_long *);
void read_bbc(void);
u_char read_bbc_reg(int);
+void send_clock_cmd(volatile u_int8_t *, u_int8_t, u_int8_t *,
+ u_int8_t, u_int8_t *);
u_char write_bbc_reg(int, u_int);
static int clock_ipl = IPL_CLOCK;
@@ -153,7 +153,7 @@ hp300_calibrate_delay()
/* Enable the timer */
clk->clk_cr2 = CLK_CR1;
clk->clk_cr1 = CLK_IENAB;
-
+
delay(10000);
/* Timer1 interrupt flag high? */
@@ -381,10 +381,14 @@ inittodr(base)
/* XXX */
if (!bbcinited) {
- if (badbaddr((caddr_t)&BBCADDR->hil_stat))
- printf("WARNING: no battery clock\n");
- else
- bbcaddr = BBCADDR;
+ if (machineid == HP_425 && mmuid == MMUID_425_E)
+ bbcaddr = NULL;
+ else {
+ if (badbaddr((caddr_t)(BBCADDR + HILP_STAT)))
+ printf("WARNING: no battery clock\n");
+ else
+ bbcaddr = BBCADDR;
+ }
bbcinited = 1;
}
@@ -394,16 +398,18 @@ inittodr(base)
* time is more recent than the gmt time in the clock,
* then use the filesystem time and warn the user.
*/
- if (!bbc_to_gmt(&timbuf) || timbuf < base) {
- printf("WARNING: bad date in battery clock\n");
- timbuf = base;
+ if (bbcaddr != NULL) {
+ if (!bbc_to_gmt(&timbuf) || timbuf < base) {
+ printf("WARNING: bad date in battery clock\n");
+ timbuf = base;
+ }
}
if (base < 5*SECYR) {
printf("WARNING: preposterous time in file system");
timbuf = 6*SECYR + 186*SECDAY + SECDAY/2;
printf(" -- CHECK AND RESET THE DATE!\n");
}
-
+
/* Battery clock does not store usec's, so forget about it. */
time.tv_sec = timbuf;
}
@@ -417,6 +423,9 @@ resettodr()
int i;
struct bbc_tm *tmptr;
+ if (bbcaddr == NULL)
+ return;
+
tmptr = gmt_to_bbc(time.tv_sec);
decimal_to_bbc(0, 1, tmptr->tm_sec);
@@ -458,7 +467,7 @@ gmt_to_bbc(tim)
for (i = STARTOFTIME - 1900; day >= days_in_year(i); i++)
day -= days_in_year(i);
rt.tm_year = i;
-
+
/* Number of months in days left */
if (leapyear(rt.tm_year))
days_in_month(FEBRUARY) = 29;
@@ -468,8 +477,8 @@ gmt_to_bbc(tim)
rt.tm_mon = i;
/* Days are what is left over (+1) from all that. */
- rt.tm_mday = day + 1;
-
+ rt.tm_mday = day + 1;
+
return(&rt);
}
@@ -508,7 +517,7 @@ bbc_to_gmt(timbuf)
for (i = 1; i < month; i++)
tmp += days_in_month(i);
-
+
tmp += (day - 1);
tmp = ((tmp * 24 + hour) * 60 + min) * 60 + sec;
@@ -538,9 +547,9 @@ read_bbc_reg(reg)
{
u_char data = reg;
- if (bbcaddr) {
- send_hil_cmd(bbcaddr, BBC_SET_REG, &data, 1, NULL);
- send_hil_cmd(bbcaddr, BBC_READ_REG, NULL, 0, &data);
+ if (bbcaddr != NULL) {
+ send_clock_cmd(bbcaddr, BBC_SET_REG, &data, 1, NULL);
+ send_clock_cmd(bbcaddr, BBC_READ_REG, NULL, 0, &data);
}
return(data);
}
@@ -554,10 +563,47 @@ write_bbc_reg(reg, data)
tmp = (u_char) ((data << HIL_SSHIFT) | reg);
- if (bbcaddr) {
- send_hil_cmd(bbcaddr, BBC_SET_REG, &tmp, 1, NULL);
- send_hil_cmd(bbcaddr, BBC_WRITE_REG, NULL, 0, NULL);
- send_hil_cmd(bbcaddr, BBC_READ_REG, NULL, 0, &tmp);
+ if (bbcaddr != NULL) {
+ send_clock_cmd(bbcaddr, BBC_SET_REG, &tmp, 1, NULL);
+ send_clock_cmd(bbcaddr, BBC_WRITE_REG, NULL, 0, NULL);
+ send_clock_cmd(bbcaddr, BBC_READ_REG, NULL, 0, &tmp);
}
return(tmp);
-}
+}
+
+/*
+ * Battery-backed clock command interface.
+ * The BBC appears to have an HIL-like command interface, but can not attach
+ * as a complete HIL device to an HIL controller driver.
+ * The following routine is a simplified command loop.
+ */
+void
+send_clock_cmd(volatile u_int8_t *address, u_int8_t cmd, u_int8_t *data,
+ u_int8_t dlen, u_int8_t *rdata)
+{
+ u_int8_t status;
+ int s;
+
+ s = splimp();
+
+ while ((address[HILP_STAT] & HIL_BUSY) != 0)
+ DELAY(1);
+ address[HILP_CMD] = cmd;
+ while (dlen--) {
+ while ((address[HILP_STAT] & HIL_BUSY) != 0)
+ DELAY(1);
+ address[HILP_DATA] = *data++;
+ DELAY(1);
+ }
+ if (rdata != NULL) {
+ do {
+ while ((address[HILP_STAT] & HIL_DATA_RDY) == 0)
+ DELAY(1);
+ status = address[HILP_STAT];
+ *rdata = address[HILP_DATA];
+ DELAY(1);
+ } while (((status >> HIL_SSHIFT) & HIL_SMASK) != HIL_68K);
+ }
+
+ splx(s);
+}
diff --git a/sys/arch/hp300/hp300/clockreg.h b/sys/arch/hp300/hp300/clockreg.h
index 805974d0005..9346d67dea0 100644
--- a/sys/arch/hp300/hp300/clockreg.h
+++ b/sys/arch/hp300/hp300/clockreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: clockreg.h,v 1.4 2003/06/02 23:27:45 millert Exp $ */
+/* $OpenBSD: clockreg.h,v 1.5 2005/01/14 22:39:27 miod Exp $ */
/* $NetBSD: clockreg.h,v 1.5 1994/10/26 07:25:26 cgd Exp $ */
/*
@@ -97,6 +97,8 @@ struct clkreg {
* HP300 battery-backed clock
*/
+#define BBCADDR (u_int8_t *)(IIOV(0x420000))
+
struct bbc_tm {
int tm_sec;
int tm_min;
diff --git a/sys/arch/hp300/hp300/conf.c b/sys/arch/hp300/hp300/conf.c
index a95ae75b598..73e65cbeb1c 100644
--- a/sys/arch/hp300/hp300/conf.c
+++ b/sys/arch/hp300/hp300/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.36 2004/08/03 21:46:58 miod Exp $ */
+/* $OpenBSD: conf.c,v 1.37 2005/01/14 22:39:27 miod Exp $ */
/* $NetBSD: conf.c,v 1.39 1997/05/12 08:17:53 thorpej Exp $ */
/*-
@@ -77,44 +77,24 @@ struct bdevsw bdevsw[] =
};
int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
-/* open, close, ioctl, poll, mmap -- XXX should be a map device */
-#define cdev_grf_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \
- (dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, dev_init(c,n,poll), \
- dev_init(c,n,mmap) }
-
/* open, close, read, write, ioctl -- XXX should be a generic device */
#define cdev_ppi_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \
0, (dev_type_poll((*))) enodev, (dev_type_mmap((*))) enodev }
-/* open, close, read, ioctl, poll, mmap -- XXX should be a map device */
-#define cdev_hil_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
- (dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, dev_init(c,n,poll), \
- dev_init(c,n,mmap) }
-
#define mmread mmrw
#define mmwrite mmrw
cdev_decl(mm);
#include "pty.h"
cdev_decl(ct);
cdev_decl(hd);
-#include "grf.h"
-cdev_decl(grf);
#include "ppi.h"
cdev_decl(ppi);
#include "dca.h"
cdev_decl(dca);
#include "apci.h"
cdev_decl(apci);
-#include "ite.h"
-cdev_decl(ite);
-/* XXX shouldn't this be optional? */
-cdev_decl(hil);
#include "dcm.h"
cdev_decl(dcm);
cdev_decl(mt);
@@ -126,9 +106,11 @@ cdev_decl(fd);
#include <xfs/nxfs.h>
cdev_decl(xfs_dev);
#endif
-
+#include "wsdisplay.h"
+#include "wskbd.h"
+#include "wsmouse.h"
+#include "wsmux.h"
#include "pf.h"
-
#include "systrace.h"
struct cdevsw cdevsw[] =
@@ -143,11 +125,11 @@ struct cdevsw cdevsw[] =
cdev_tape_init(NCT,ct), /* 7: cs80 cartridge tape */
cdev_disk_init(NSD,sd), /* 8: SCSI disk */
cdev_disk_init(NHD,hd), /* 9: HPIB disk */
- cdev_grf_init(NGRF,grf), /* 10: frame buffer */
+ cdev_notdef(), /* 10: vas frame buffer */
cdev_ppi_init(NPPI,ppi), /* 11: printer/plotter interface */
cdev_tty_init(NDCA,dca), /* 12: built-in single-port serial */
- cdev_tty_init(NITE,ite), /* 13: console terminal emulator */
- cdev_hil_init(1,hil), /* 14: human interface loop */
+ cdev_notdef(), /* 13: was console terminal emulator */
+ cdev_notdef(), /* 14: was human interface loop */
cdev_tty_init(NDCM,dcm), /* 15: 4-port serial */
cdev_tape_init(NMT,mt), /* 16: magnetic reel tape */
cdev_disk_init(NCCD,ccd), /* 17: concatenated disk */
@@ -173,10 +155,10 @@ struct cdevsw cdevsw[] =
cdev_uk_init(NUK,uk), /* 37 */
cdev_ss_init(NSS,ss), /* 38 */
cdev_ch_init(NCH,ch), /* 39 */
- cdev_notdef(), /* 40 */
- cdev_notdef(), /* 41 */
- cdev_notdef(), /* 42 */
- cdev_notdef(), /* 43 */
+ cdev_wsdisplay_init(NWSDISPLAY,wsdisplay), /* 40: frame buffers */
+ cdev_mouse_init(NWSKBD,wskbd), /* 41: keyboards */
+ cdev_mouse_init(NWSMOUSE,wsmouse), /* 42: mice */
+ cdev_mouse_init(NWSMUX,wsmux), /* 43: ws multiplexor */
cdev_notdef(), /* 44 */
cdev_notdef(), /* 45 */
cdev_notdef(), /* 46 */
@@ -187,7 +169,6 @@ struct cdevsw cdevsw[] =
#ifdef XFS
cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
#else
-
cdev_notdef(), /* 51 */
#endif
cdev_ptm_init(NPTY,ptm), /* 52: pseudo-tty ptm device */
@@ -285,29 +266,34 @@ int nchrtoblktbl = sizeof(chrtoblktbl) / sizeof(chrtoblktbl[0]);
*/
#include <dev/cons.h>
-#define dvboxcngetc itecngetc
-#define dvboxcnputc itecnputc
-#define dvboxcnpollc nullcnpollc
+#define dvboxcngetc wscngetc
+#define dvboxcnputc wscnputc
+#define dvboxcnpollc wscnpollc
cons_decl(dvbox);
-#define gboxcngetc itecngetc
-#define gboxcnputc itecnputc
-#define gboxcnpollc nullcnpollc
+#define gboxcngetc wscngetc
+#define gboxcnputc wscnputc
+#define gboxcnpollc wscnpollc
cons_decl(gbox);
-#define hypercngetc itecngetc
-#define hypercnputc itecnputc
-#define hypercnpollc nullcnpollc
+#define hypercngetc wscngetc
+#define hypercnputc wscnputc
+#define hypercnpollc wscnpollc
cons_decl(hyper);
-#define rboxcngetc itecngetc
-#define rboxcnputc itecnputc
-#define rboxcnpollc nullcnpollc
+#define rboxcngetc wscngetc
+#define rboxcnputc wscnputc
+#define rboxcnpollc wscnpollc
cons_decl(rbox);
-#define topcatcngetc itecngetc
-#define topcatcnputc itecnputc
-#define topcatcnpollc nullcnpollc
+#define sticngetc wscngetc
+#define sticnputc wscnputc
+#define sticnpollc wscnpollc
+cons_decl(sti);
+
+#define topcatcngetc wscngetc
+#define topcatcnputc wscnputc
+#define topcatcnpollc wscnpollc
cons_decl(topcat);
#define dcacnpollc nullcnpollc
@@ -323,10 +309,11 @@ cons_decl(dcm);
#include "gbox.h"
#include "hyper.h"
#include "rbox.h"
+#include "sti.h"
#include "topcat.h"
struct consdev constab[] = {
-#if NITE > 0
+#if NWSDISPLAY > 0
#if NDVBOX > 0
cons_init(dvbox),
#endif
@@ -339,10 +326,13 @@ struct consdev constab[] = {
#if NRBOX > 0
cons_init(rbox),
#endif
+#if NSTI > 0
+ cons_init(sti),
+#endif
#if NTOPCAT > 0
cons_init(topcat),
#endif
-#endif /* NITE > 0 */
+#endif /* NWSDISPLAY > 0 */
#if NDCA > 0
cons_init(dca),
#endif
diff --git a/sys/arch/hp300/hp300/locore.s b/sys/arch/hp300/hp300/locore.s
index 1a462b2cd51..46193c0c01e 100644
--- a/sys/arch/hp300/hp300/locore.s
+++ b/sys/arch/hp300/hp300/locore.s
@@ -1,9 +1,9 @@
-/* $OpenBSD: locore.s,v 1.46 2005/01/14 19:11:56 miod Exp $ */
+/* $OpenBSD: locore.s,v 1.47 2005/01/14 22:39:27 miod Exp $ */
/* $NetBSD: locore.s,v 1.91 1998/11/11 06:41:25 thorpej Exp $ */
/*
* Copyright (c) 1997 Theo de Raadt
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -72,7 +72,14 @@
#include <hp300/hp300/leds.h>
#endif
#include <hp300/dev/dioreg.h>
-#include <hp300/dev/grfreg.h>
+#include <hp300/dev/diofbreg.h>
+
+#include "sgc.h"
+#if NSGC > 0
+#include <hp300/dev/sgcreg.h>
+#endif
+
+#define SYSFLAG 0xfffffed2
#define MMUADDR(ar) movl _C_LABEL(MMUbase),ar
#define CLKADDR(ar) movl _C_LABEL(CLKbase),ar
@@ -150,8 +157,8 @@ ASENTRY_NOPROFILE(start)
movl #CACHE_OFF,d0
movc d0,cacr | clear and disable on-chip cache(s)
-/* check for internal HP-IB in SYSFLAG */
- btst #5,0xfffffed2 | internal HP-IB?
+ /* check for internal HP-IB in SYSFLAG */
+ btst #5,SYSFLAG | internal HP-IB?
jeq Lhaveihpib | yes, have HP-IB just continue
RELOC(internalhpib, a0)
movl #0,a0@ | no, clear associated address
@@ -370,6 +377,35 @@ dioloop:
cmpl #256, d2
jne dioloop
+#if NSGC > 0
+ /*
+ * Probe for SGC devices, slots 0 to 3.
+ * Only do the probe on machines which might have an SGC bus.
+ */
+ RELOC(machineid,a0)
+ cmpl #HP_400,a0@
+ jeq sgcprobe
+ cmpl #HP_425,a0@
+ jeq sgcprobe
+ cmpl #HP_433,a0@
+ jne eiodone
+sgcprobe:
+ clrl d2 | first slot...
+ movl #SGC_BASE, a0 | and first address
+sgcloop:
+ ASRELOC(phys_badaddr, a3)
+ jbsr a3@ | probe address
+ movl #SGC_DEVSIZE, d1
+ tstl d0 | success?
+ jne 2f | no, skip
+ addl d1, d3 | yes, count it
+2:
+ addl d1, a0 | next slot address...
+ addql #1, d2 | and slot number
+ cmpl #SGC_NSLOTS, d2
+ jne sgcloop
+#endif
+
eiodone:
moveq #PGSHIFT, d2
lsrl d2, d3 | convert from bytes to pages
@@ -628,7 +664,7 @@ GLOBAL(proc_trampoline)
/*
* Trap/interrupt vector routines
- */
+ */
#include <m68k/m68k/trap_subr.s>
.data
@@ -655,7 +691,7 @@ ENTRY_NOPROFILE(buserr60)
movl a0,sp@(FR_SP) | in the savearea
movel sp@(FR_HW+12),d0 | FSLW
btst #2,d0 | branch prediction error?
- jeq Lnobpe
+ jeq Lnobpe
movc cacr,d2
orl #IC60_CABC,d2 | clear all branch cache entries
movc d2,cacr
@@ -675,7 +711,7 @@ Lnobpe:
Lberr3:
movl d1,sp@-
movl d0,sp@- | code is FSLW now.
- andw #0x1f80,d0
+ andw #0x1f80,d0
jeq Lberr60 | it is a bus error
movl #T_MMUFLT,sp@- | show that we are an MMU fault
jra _ASM_LABEL(faultstkadj) | and deal with it
@@ -929,7 +965,7 @@ ENTRY_NOPROFILE(trap0)
movw #SPL1,sr
tstb _C_LABEL(ssir)
jne Lsir1
-Ltrap1:
+Ltrap1:
movl sp@(FR_SP),a0 | grab and restore
movl a0,usp | user SP
moveml sp@+,#0x7FFF | restore most registers
@@ -1083,13 +1119,6 @@ ENTRY_NOPROFILE(spurintr) /* level 0 */
addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
jra _ASM_LABEL(rei)
-ENTRY_NOPROFILE(lev1intr) /* level 1: HIL XXX this needs to go away */
- INTERRUPT_SAVEREG
- jbsr _C_LABEL(hilint)
- INTERRUPT_RESTOREREG
- addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
- jra _ASM_LABEL(rei)
-
ENTRY_NOPROFILE(intrhand) /* levels 2 through 5 */
INTERRUPT_SAVEREG
movw sp@(22),sp@- | push exception vector info
@@ -1241,7 +1270,7 @@ Lgotsir:
moveml #0xFFFF,sp@- | save all registers
movl usp,a1 | including
movl a1,sp@(FR_SP) | the users SP
-Lsir1:
+Lsir1:
clrl sp@- | VA == none
clrl sp@- | code == none
movl #T_SSIR,sp@- | type == software interrupt
@@ -1264,7 +1293,7 @@ Ldorte:
/*
* Primitives
- */
+ */
/*
* Use common m68k support routines.
@@ -1979,7 +2008,7 @@ ASLOCAL(_bsave)
ASLOCAL(_ssave)
.long 0
.text
-
+
/*
* Handle the nitty-gritty of rebooting the machine.
* Basically we just turn off the MMU and jump to the appropriate ROM routine.
diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c
index 508bc5b0702..05086ff284c 100644
--- a/sys/arch/hp300/hp300/machdep.c
+++ b/sys/arch/hp300/hp300/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.97 2005/01/14 19:11:56 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.98 2005/01/14 22:39:27 miod Exp $ */
/* $NetBSD: machdep.c,v 1.121 1999/03/26 23:41:29 mycroft Exp $ */
/*
@@ -89,9 +89,6 @@
#define MAXMEM 64*1024 /* XXX - from cmap.h */
#include <uvm/uvm_extern.h>
-#include <hp300/dev/hilreg.h>
-#include <hp300/dev/hilioctl.h>
-#include <hp300/dev/hilvar.h>
#ifdef USELEDS
#include <hp300/hp300/leds.h>
#endif
@@ -99,7 +96,7 @@
/* the following is used externally (sysctl_hw) */
char machine[] = MACHINE; /* from <machine/param.h> */
-struct vm_map *exec_map = NULL;
+struct vm_map *exec_map = NULL;
struct vm_map *phys_map = NULL;
extern paddr_t avail_start, avail_end;
@@ -224,12 +221,12 @@ consinit()
conscode = 1024; /* invalid */
/*
- * Initialize the DIO resource map.
+ * Initialize the bus resource map.
*/
extio = extent_create("extio",
(u_long)extiobase, (u_long)extiobase + ctob(eiomapsize),
M_DEVBUF, extiospace, sizeof(extiospace), EX_NOWAIT);
-
+
/*
* Initialize the console before we print anything out.
*/
@@ -321,7 +318,7 @@ cpu_startup()
while (curbufsize) {
pg = uvm_pagealloc(NULL, 0, NULL, 0);
- if (pg == NULL)
+ if (pg == NULL)
panic("cpu_startup: not enough memory for "
"buffer cache");
@@ -1076,6 +1073,7 @@ nmihand(frame)
return;
innmihand = 1;
+#if 0 /* XXX */
/* Check for keyboard <CRTL>+<SHIFT>+<RESET>. */
if (kbdnmi()) {
#ifdef DDB
@@ -1085,13 +1083,16 @@ nmihand(frame)
#endif /* DDB */
goto nmihand_out; /* no more work to do */
}
+#endif
if (parityerror(&frame))
return;
/* panic?? */
printf("unexpected level 7 interrupt ignored\n");
+#if 0
nmihand_out:
+#endif
innmihand = 0;
}
@@ -1227,7 +1228,7 @@ done:
/*
* cpu_exec_aout_makecmds():
* cpu-dependent a.out format hook for execve().
- *
+ *
* Determine of the given exec package refers to something which we
* understand and, if so, set up the vmcmds for it.
*/
diff --git a/sys/arch/hp300/hp300/vectors.s b/sys/arch/hp300/hp300/vectors.s
index 9995a12ab3c..0131b1d2bf8 100644
--- a/sys/arch/hp300/hp300/vectors.s
+++ b/sys/arch/hp300/hp300/vectors.s
@@ -1,4 +1,4 @@
-| $OpenBSD: vectors.s,v 1.9 2004/01/27 16:16:22 miod Exp $
+| $OpenBSD: vectors.s,v 1.10 2005/01/14 22:39:28 miod Exp $
| $NetBSD: vectors.s,v 1.12 1997/07/14 19:18:32 thorpej Exp $
| Copyright (c) 1997 Jason R. Thorpe. All rights reserved.
@@ -75,7 +75,7 @@ GLOBAL(vectab)
VECTOR(badtrap) /* 22: unassigned, reserved */
VECTOR(badtrap) /* 23: unassigned, reserved */
VECTOR(spurintr) /* 24: spurious interrupt */
- VECTOR(lev1intr) /* 25: level 1 interrupt autovector */
+ VECTOR(intrhand) /* 25: level 1 interrupt autovector */
VECTOR(intrhand) /* 26: level 2 interrupt autovector */
VECTOR(intrhand) /* 27: level 3 interrupt autovector */
VECTOR(intrhand) /* 28: level 4 interrupt autovector */
diff --git a/sys/arch/hp300/hp300/wscons_machdep.c b/sys/arch/hp300/hp300/wscons_machdep.c
new file mode 100644
index 00000000000..bb4376d6007
--- /dev/null
+++ b/sys/arch/hp300/hp300/wscons_machdep.c
@@ -0,0 +1,83 @@
+/* $OpenBSD: wscons_machdep.c,v 1.1 2005/01/14 22:39:28 miod Exp $ */
+
+/*
+ * Copyright (c) 2002 Michael Shalayeff
+ * All rights reserved.
+ *
+ * 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 Michael Shalayeff.
+ * 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 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 OR HIS RELATIVES 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 MIND, 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/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+
+#include <dev/cons.h>
+
+#include "wsdisplay.h"
+#if NWSDISPLAY > 0
+#include <dev/wscons/wsdisplayvar.h>
+#endif
+
+#include "wskbd.h"
+#if NWSKBD > 0
+#include <dev/wscons/wskbdvar.h>
+#endif
+
+#include <hp300/dev/diofbreg.h>
+#include <hp300/dev/diofbvar.h>
+
+struct diofb diofb_cn;
+
+cons_decl(ws);
+
+void
+wscnputc(dev_t dev, int i)
+{
+#if NWSDISPLAY > 0
+ wsdisplay_cnputc(dev, i);
+#endif
+}
+
+int
+wscngetc(dev_t dev)
+{
+#if NWSKBD > 0
+ return (wskbd_cngetc(dev));
+#else
+ return (0);
+#endif
+}
+
+void
+wscnpollc(dev_t dev, int on)
+{
+#if NWSKBD > 0
+ wskbd_cnpollc(dev, on);
+#endif
+}
diff --git a/sys/arch/hp300/include/autoconf.h b/sys/arch/hp300/include/autoconf.h
index 4b1d224559f..29853abc89e 100644
--- a/sys/arch/hp300/include/autoconf.h
+++ b/sys/arch/hp300/include/autoconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.h,v 1.8 2002/03/14 03:15:52 millert Exp $ */
+/* $OpenBSD: autoconf.h,v 1.9 2005/01/14 22:39:29 miod Exp $ */
/* $NetBSD: autoconf.h,v 1.4 1997/04/01 03:03:56 scottr Exp $ */
/*-
@@ -45,7 +45,7 @@ extern int convasize; /* size of mapping at conaddr */
extern int conforced; /* console has been forced */
void hp300_cninit(void);
-void console_scan(int (*)(int, caddr_t, void *), void *);
+void console_scan(int (*)(int, caddr_t, void *), void *, int);
caddr_t iomap(caddr_t, int);
void iounmap(caddr_t, int);
#endif /* _KERNEL */
diff --git a/sys/arch/hp300/include/bus.h b/sys/arch/hp300/include/bus.h
new file mode 100644
index 00000000000..328f2e10330
--- /dev/null
+++ b/sys/arch/hp300/include/bus.h
@@ -0,0 +1,436 @@
+/* $OpenBSD: bus.h,v 1.1 2005/01/14 22:39:29 miod Exp $ */
+/* $NetBSD: bus.h,v 1.6 2001/12/02 01:20:33 gmcgarry Exp $ */
+
+/*-
+ * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * 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 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 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 FOUNDATION 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.
+ */
+
+/*
+ * Copyright (C) 1997 Scott Reynolds. All rights reserved.
+ *
+ * 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. The name of the author may not 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.
+ */
+
+#ifndef _HP300_BUS_H_
+#define _HP300_BUS_H_
+
+/*
+ * Bus codes
+ */
+#define HP300_BUS_INTIO 1
+#define HP300_BUS_DIO 2
+#define HP300_BUS_SGC 3
+
+/*
+ * How to build bus space tags, and break them
+ */
+#define HP300_BUS_TAG(bus, code) ((bus) << 8 | (code))
+#define HP300_TAG_BUS(tag) ((tag) >> 8)
+#define HP300_TAG_CODE(tag) ((tag) & 0xff)
+
+/*
+ * Bus address and size types
+ */
+typedef u_long bus_addr_t;
+typedef u_long bus_size_t;
+
+/*
+ * Access methods for bus resources and address space.
+ */
+typedef int bus_space_tag_t;
+typedef u_long bus_space_handle_t;
+
+#define BUS_SPACE_MAP_CACHEABLE 0x01
+#define BUS_SPACE_MAP_LINEAR 0x02
+#define BUS_SPACE_MAP_PREFETCHABLE 0x04
+
+int bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t,
+ int, bus_space_handle_t *);
+void bus_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+int bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp);
+int bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart,
+ bus_addr_t rend, bus_size_t size, bus_size_t align,
+ bus_size_t boundary, int cacheable, bus_addr_t *addrp,
+ bus_space_handle_t *bshp);
+void bus_space_free(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t size);
+#define bus_space_vaddr(t, h) (void *)(h)
+
+/*
+ * Probe the bus at t/bsh/offset, using sz as the size of the load.
+ *
+ * This is a machine-dependent extension, and is not to be used by
+ * machine-independent code.
+ */
+
+int hp300_bus_space_probe(bus_space_tag_t t,
+ bus_space_handle_t bsh, bus_size_t offset, int sz);
+
+#define bus_space_read_1(t, h, o) \
+ ((void) t, (*(volatile u_int8_t *)((h) + (o))))
+
+#define bus_space_read_2(t, h, o) \
+ ((void) t, (*(volatile u_int16_t *)((h) + (o))))
+
+#define bus_space_read_4(t, h, o) \
+ ((void) t, (*(volatile u_int32_t *)((h) + (o))))
+
+#define bus_space_read_multi_1(t, h, o, a, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,a1 ; \
+ movl %2,d0 ; \
+ 1: movb a0@,a1@+ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (a), "g" (c) : \
+ "a0","a1","d0"); \
+} while (0)
+
+#define bus_space_read_multi_2(t, h, o, a, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,a1 ; \
+ movl %2,d0 ; \
+ 1: movw a0@,a1@+ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (a), "g" (c) : \
+ "a0","a1","d0"); \
+} while (0)
+
+#define bus_space_read_multi_4(t, h, o, a, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,a1 ; \
+ movl %2,d0 ; \
+ 1: movl a0@,a1@+ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (a), "g" (c) : \
+ "a0","a1","d0"); \
+} while (0)
+
+#define bus_space_read_region_1(t, h, o, a, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,a1 ; \
+ movl %2,d0 ; \
+ 1: movb a0@+,a1@+ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (a), "g" (c) : \
+ "a0","a1","d0"); \
+} while (0)
+
+#define bus_space_read_region_2(t, h, o, a, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,a1 ; \
+ movl %2,d0 ; \
+ 1: movw a0@+,a1@+ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (a), "g" (c) : \
+ "a0","a1","d0"); \
+} while (0)
+
+#define bus_space_read_region_4(t, h, o, a, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,a1 ; \
+ movl %2,d0 ; \
+ 1: movl a0@+,a1@+ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (a), "g" (c) : \
+ "a0","a1","d0"); \
+} while (0)
+
+#define bus_space_write_1(t, h, o, v) \
+ ((void) t, ((void)(*(volatile u_int8_t *)((h) + (o)) = (v))))
+
+#define bus_space_write_2(t, h, o, v) \
+ ((void) t, ((void)(*(volatile u_int16_t *)((h) + (o)) = (v))))
+
+#define bus_space_write_4(t, h, o, v) \
+ ((void) t, ((void)(*(volatile u_int32_t *)((h) + (o)) = (v))))
+
+#define bus_space_write_multi_1(t, h, o, a, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,a1 ; \
+ movl %2,d0 ; \
+ 1: movb a1@+,a0@ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (a), "g" (c) : \
+ "a0","a1","d0"); \
+} while (0)
+
+#define bus_space_write_multi_2(t, h, o, a, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,a1 ; \
+ movl %2,d0 ; \
+ 1: movw a1@+,a0@ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (a), "g" (c) : \
+ "a0","a1","d0"); \
+} while (0)
+
+#define bus_space_write_multi_4(t, h, o, a, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,a1 ; \
+ movl %2,d0 ; \
+ 1: movl a1@+,a0@ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (a), "g" (c) : \
+ "a0","a1","d0"); \
+} while (0)
+
+#define bus_space_write_region_1(t, h, o, a, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,a1 ; \
+ movl %2,d0 ; \
+ 1: movb a1@+,a0@+ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (a), "g" (c) : \
+ "a0","a1","d0"); \
+} while (0)
+
+#define bus_space_write_region_2(t, h, o, a, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,a1 ; \
+ movl %2,d0 ; \
+ 1: movw a1@+,a0@+ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (a), "g" (c) : \
+ "a0","a1","d0"); \
+} while (0)
+
+#define bus_space_write_region_4(t, h, o, a, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,a1 ; \
+ movl %2,d0 ; \
+ 1: movl a1@+,a0@+ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (a), "g" (c) : \
+ "a0","a1","d0"); \
+} while (0)
+
+#define bus_space_set_multi_1(t, h, o, val, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,d1 ; \
+ movl %2,d0 ; \
+ 1: movb d1,a0@ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (val), "g" (c) : \
+ "a0","d0","d1"); \
+} while (0)
+
+#define bus_space_set_multi_2(t, h, o, val, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,d1 ; \
+ movl %2,d0 ; \
+ 1: movw d1,a0@ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (val), "g" (c) : \
+ "a0","d0","d1"); \
+} while (0)
+
+#define bus_space_set_multi_4(t, h, o, val, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,d1 ; \
+ movl %2,d0 ; \
+ 1: movl d1,a0@ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (val), "g" (c) : \
+ "a0","d0","d1"); \
+} while (0)
+
+#define bus_space_set_region_1(t, h, o, val, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,d1 ; \
+ movl %2,d0 ; \
+ 1: movb d1,a0@+ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (val), "g" (c) : \
+ "a0","d0","d1"); \
+} while (0)
+
+#define bus_space_set_region_2(t, h, o, val, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,d1 ; \
+ movl %2,d0 ; \
+ 1: movw d1,a0@+ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (val), "g" (c) : \
+ "a0","d0","d1"); \
+} while (0)
+
+#define bus_space_set_region_4(t, h, o, val, c) do { \
+ (void) t; \
+ __asm __volatile (" \
+ movl %0,a0 ; \
+ movl %1,d1 ; \
+ movl %2,d0 ; \
+ 1: movl d1,a0@+ ; \
+ subql #1,d0 ; \
+ jne 1b" : \
+ : \
+ "r" ((h) + (o)), "g" (val), "g" (c) : \
+ "a0","d0","d1"); \
+} while (0)
+
+#define __HP300_copy_region_N(BYTES) \
+static __inline void __CONCAT(bus_space_copy_region_,BYTES) \
+ __P((bus_space_tag_t, \
+ bus_space_handle_t bsh1, bus_size_t off1, \
+ bus_space_handle_t bsh2, bus_size_t off2, \
+ bus_size_t count)); \
+ \
+static __inline void \
+__CONCAT(bus_space_copy_region_,BYTES)(t, h1, o1, h2, o2, c) \
+ bus_space_tag_t t; \
+ bus_space_handle_t h1, h2; \
+ bus_size_t o1, o2, c; \
+{ \
+ bus_size_t o; \
+ \
+ if ((h1 + o1) >= (h2 + o2)) { \
+ /* src after dest: copy forward */ \
+ for (o = 0; c != 0; c--, o += BYTES) \
+ __CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o, \
+ __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \
+ } else { \
+ /* dest after src: copy backwards */ \
+ for (o = (c - 1) * BYTES; c != 0; c--, o -= BYTES) \
+ __CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o, \
+ __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \
+ } \
+}
+__HP300_copy_region_N(1)
+__HP300_copy_region_N(2)
+__HP300_copy_region_N(4)
+#undef __HP300_copy_region_N
+
+/*
+ * Note: the 680x0 does not currently require barriers, but we must
+ * provide the flags to MI code.
+ */
+#define bus_space_barrier(t, h, o, l, f) \
+ ((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f)))
+#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
+#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
+
+#define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
+
+#endif /* _HP300_BUS_H_ */
diff --git a/sys/arch/hp300/include/cpu.h b/sys/arch/hp300/include/cpu.h
index c1bbbb624d9..9a6cd45134b 100644
--- a/sys/arch/hp300/include/cpu.h
+++ b/sys/arch/hp300/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.25 2005/01/08 22:13:54 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.26 2005/01/14 22:39:29 miod Exp $ */
/* $NetBSD: cpu.h,v 1.28 1998/02/13 07:41:51 scottr Exp $ */
/*
@@ -196,8 +196,6 @@ int kvtop(caddr_t);
#define ROMBASE (0x00000000)
#define INTIOBASE (0x00400000)
#define INTIOTOP (0x00600000)
-#define EXTIOBASE (0x00600000)
-#define EXTIOTOP (0x20000000)
#define MAXADDR (0xFFFFF000)
/*
diff --git a/sys/arch/hp300/dev/itereg.h b/sys/arch/hp300/include/hil_machdep.h
index 6f7967c6891..e7bf41150ef 100644
--- a/sys/arch/hp300/dev/itereg.h
+++ b/sys/arch/hp300/include/hil_machdep.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: itereg.h,v 1.3 2003/06/02 23:27:45 millert Exp $ */
-/* $NetBSD: itereg.h,v 1.5 1994/10/26 07:24:39 cgd Exp $ */
+/* $OpenBSD: hil_machdep.h,v 1.1 2005/01/14 22:39:29 miod Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -18,7 +17,11 @@
* 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. Neither the name of the University nor the names of its contributors
+ * 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.
*
@@ -34,23 +37,21 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: Utah $Hdr: itereg.h 1.3 92/01/21$
+ * from: Utah $Hdr: hilreg.h 1.10 92/01/21$
*
- * @(#)itereg.h 8.1 (Berkeley) 6/10/93
+ * @(#)hilreg.h 8.1 (Berkeley) 6/10/93
*/
/*
- * Offsets into the display ROM that is part of the first 4K of each
- * display device.
+ * HP 9000/300-series specific HIL definitions
*/
-#define FONTROM 0x3B /* Offset of font information structure. */
-#define FONTADDR 0x4 /* Offset from FONTROM to font address. */
-#define FONTHEIGHT 0x0 /* Offset from font address to font height. */
-#define FONTWIDTH 0x2 /* Offset from font address to font width. */
-#define FONTDATA 0xA /* Offset from font address to font glyphs. */
-#ifdef hp300
-#define FBBASE ((volatile u_char *)ip->fbbase)
-#else
-#define FBBASE ((volatile u_long *)ip->fbbase)
-#endif
+#define HILP_DATA 1 /* (R/W) data port */
+#define HILP_CMD 3 /* (R/W) status and control port */
+#define HILP_STAT HILP_CMD
+
+#define HILBUFSIZE 40 /* size of interrupt poll buffer */
+
+#define HILADDR 0x428000
+
+#define HILMAPSIZE 4
diff --git a/sys/arch/hp300/include/intr.h b/sys/arch/hp300/include/intr.h
index afe0f392a31..0b17340d699 100644
--- a/sys/arch/hp300/include/intr.h
+++ b/sys/arch/hp300/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.13 2004/09/30 16:22:59 millert Exp $ */
+/* $OpenBSD: intr.h,v 1.14 2005/01/14 22:39:29 miod Exp $ */
/* $NetBSD: intr.h,v 1.2 1997/07/24 05:43:08 scottr Exp $ */
/*-
@@ -125,15 +125,10 @@ extern unsigned short hp300_impipl;
#define IPL_STATCLOCK 6
#define IPL_HIGH 7
-/* These spl calls are _not_ to be used by machine-independent code. */
-#define splhil() _splraise(PSL_S|PSL_IPL1)
-#define splkbd() splhil()
-#define splsoft() spl1()
-
/* These spl calls are used by machine-independent code. */
-#define spllowersoftclock() splsoft()
-#define splsoftclock() splsoft()
-#define splsoftnet() splsoft()
+#define spllowersoftclock() spl1()
+#define splsoftclock() spl1()
+#define splsoftnet() spl1()
#define splbio() _splraise(hp300_bioipl)
#define splnet() _splraise(hp300_netipl)
#define spltty() _splraise(hp300_ttyipl)
diff --git a/sys/conf/files b/sys/conf/files
index f0cb08809f4..ea4cadfdd14 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.325 2005/01/14 12:04:02 grange Exp $
+# $OpenBSD: files,v 1.326 2005/01/14 22:39:31 miod Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -312,7 +312,7 @@ file dev/ic/lpt.c lpt & (lpt_isa | lpt_localbus | lpt_gsc | lpt_puc | lpt_apio
# STI (hp graphics)
device sti: wsemuldisplaydev
-file dev/ic/sti.c sti & (sti_pci | sti_gedoens)
+file dev/ic/sti.c sti & (sti_pci | sti_gedoens | sti_sgc) needs-flag
# Initio ULTRA WIDE/ULTRA2 WIDE SCSI Controllers
device iha: scsi
diff --git a/sys/dev/wscons/wsconsio.h b/sys/dev/wscons/wsconsio.h
index 24aaddd04e7..e3bc78931a7 100644
--- a/sys/dev/wscons/wsconsio.h
+++ b/sys/dev/wscons/wsconsio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsconsio.h,v 1.32 2005/01/14 15:48:01 drahn Exp $ */
+/* $OpenBSD: wsconsio.h,v 1.33 2005/01/14 22:39:33 miod Exp $ */
/* $NetBSD: wsconsio.h,v 1.31.2.1 2000/07/07 09:49:17 hannken Exp $ */
/*
@@ -260,7 +260,7 @@ struct wsmouse_calibcoords {
#define WSDISPLAY_TYPE_DCPVR 24 /* Dreamcast PowerVR */
#define WSDISPLAY_TYPE_SUN24 25 /* Sun 24 bit framebuffers */
#define WSDISPLAY_TYPE_SUNBW 26 /* Sun black and white fb */
-#define WSDISPLAY_TYPE_STI 27 /* HP STI frambuffers */
+#define WSDISPLAY_TYPE_STI 27 /* HP STI framebuffers */
#define WSDISPLAY_TYPE_SUNCG3 28 /* Sun cgthree */
#define WSDISPLAY_TYPE_SUNCG6 29 /* Sun cgsix */
#define WSDISPLAY_TYPE_SUNFFB 30 /* Sun creator FFB */
@@ -276,6 +276,11 @@ struct wsmouse_calibcoords {
#define WSDISPLAY_TYPE_SB_P9000 40 /* Tadpole SPARCbook P9000 */
#define WSDISPLAY_TYPE_RFLEX 41 /* RasterFlex series */
#define WSDISPLAY_TYPE_LUNA 42 /* OMRON Luna */
+#define WSDISPLAY_TYPE_DVBOX 43 /* HP DaVinci */
+#define WSDISPLAY_TYPE_GBOX 44 /* HP Gatorbox */
+#define WSDISPLAY_TYPE_RBOX 45 /* HP Renaissance */
+#define WSDISPLAY_TYPE_HYPERION 46 /* HP Hyperion */
+#define WSDISPLAY_TYPE_TOPCAT 47 /* HP Topcat */
/* Basic display information. Not applicable to all display types. */
struct wsdisplay_fbinfo {
diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile
index 0ffcfe343a5..73700219a47 100644
--- a/usr.sbin/Makefile
+++ b/usr.sbin/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.113 2004/06/22 07:03:38 henning Exp $
+# $OpenBSD: Makefile,v 1.114 2005/01/14 22:39:35 miod Exp $
.include <bsd.own.mk>
@@ -18,7 +18,7 @@ SUBDIR+=faithd ndp rip6query route6d rtadvd rtsold traceroute6
# Arch dependent tools, with manpages
SUBDIR+=bad144 apm apmd fdformat memconfig
-SUBDIR+=eeprom gpioctl grfinfo hilinfo hotplugd
+SUBDIR+=eeprom gpioctl hotplugd
SUBDIR+=wsconscfg wsfontload
# Extended Attribute tools
diff --git a/usr.sbin/grfinfo/Makefile b/usr.sbin/grfinfo/Makefile
deleted file mode 100644
index f2b7ac72549..00000000000
--- a/usr.sbin/grfinfo/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# $OpenBSD: Makefile,v 1.5 2002/09/06 22:08:36 miod Exp $
-
-.if ${MACHINE} == "hp300"
-PROG= grfinfo
-CFLAGS+= -I${.CURDIR}/../../sys/arch/hp300
-DPADD= ${LIBUTIL}
-LDADD= -lutil
-.else
-NOPROG=yes
-.endif
-
-MAN=grfinfo.1
-MANSUBDIR=hp300
-
-.include <bsd.prog.mk>
diff --git a/usr.sbin/grfinfo/grfinfo.1 b/usr.sbin/grfinfo/grfinfo.1
deleted file mode 100644
index a17cdc755dd..00000000000
--- a/usr.sbin/grfinfo/grfinfo.1
+++ /dev/null
@@ -1,73 +0,0 @@
-.\" $OpenBSD: grfinfo.1,v 1.6 2002/09/06 22:08:36 miod Exp $
-.\" $NetBSD: grfinfo.1,v 1.1 1997/01/31 23:06:53 carrel Exp $
-.\"
-.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Dave Carrel
-.\"
-.\" 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.
-.\"
-.Dd January 31, 1997
-.Dt GRFINFO 1
-.Os
-.Sh NAME
-.Nm grfinfo
-.Nd display information about grf graphics devices
-.Sh SYNOPSIS
-.Nm grfinfo
-.Op Fl a
-.Op Fl t
-.Ar device ...
-.Sh DESCRIPTION
-.Nm
-displays information about the graphics framebuffer
-.Ar device
-list.
-.Pp
-The options are as follows:
-.Bl -tag -width Ds
-.It Fl a
-For each
-.Ar device ,
-display the type and all possible information.
-.It Fl t
-For each
-.Ar device ,
-display the type.
-.El
-.Pp
-If no options are given, the type will be printed (that is,
-.Nm
-will behave as if
-.Fl t
-had been passed).
-.Sh SEE ALSO
-.Xr grf 4
diff --git a/usr.sbin/grfinfo/grfinfo.c b/usr.sbin/grfinfo/grfinfo.c
deleted file mode 100644
index 80632a204db..00000000000
--- a/usr.sbin/grfinfo/grfinfo.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* $OpenBSD: grfinfo.c,v 1.6 2002/09/06 22:12:18 deraadt Exp $ */
-
-/*
- * Copyright (c) 1987-1993, The University of Utah and
- * the Center for Software Science at the University of Utah (CSS).
- * All rights reserved.
- *
- * Permission to use, copy, modify and distribute this software is hereby
- * granted provided that (1) source code retains these copyright, permission,
- * and disclaimer notices, and (2) redistributions including binaries
- * reproduce the notices in supporting documentation, and (3) all advertising
- * materials mentioning features or use of this software display the following
- * acknowledgement: ``This product includes software developed by the Center
- * for Software Science at the University of Utah.''
- *
- * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
- * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF
- * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * CSS requests users of this software to return to css-dist@cs.utah.edu any
- * improvements that they make and grant CSS redistribution rights.
- *
- * from: Utah $Hdr: grfinfo.c 1.3 94/04/04$
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <util.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <dev/grfioctl.h>
-
-int getinfo(char *);
-void printall(void);
-char *tname(void);
-void usage(void);
-
-struct grfinfo gi;
-
-struct grf_info {
- int grf_id;
- char *grf_name;
-} info[] = {
- GRFGATOR, "gatorbox",
- GRFBOBCAT, "topcat",
- GRFRBOX, "renaissance",
- GRFFIREEYE, "fireeye",
- GRFHYPERION, "hyperion",
- GRFDAVINCI, "davinci",
- -1, "unknown",
-};
-
-int
-main(int argc, char *argv[])
-{
- int aflg, tflg;
- int c;
- char *dname;
-
- aflg = tflg = 0;
- while ((c = getopt(argc, argv, "at")) != -1) {
- switch (c) {
- case 'a':
- if (tflg != 0)
- usage();
- aflg++;
- break;
- case 't':
- if (aflg != 0)
- usage();
- tflg++;
- break;
- case '?':
- default:
- usage();
- }
- }
- argc -= optind;
- argv += optind;
-
- if (argc == 0)
- usage();
- while (argc-- != 0) {
- dname = *argv++;
- if (getinfo(dname)) {
- printf("%s: ", dname);
- if (aflg)
- printall();
- else
- printf("%s\n", tname());
- }
- }
- exit(0);
-}
-
-int
-getinfo(char *dname)
-{
- int f;
-
- f = opendev(dname, 0, OPENDEV_BLCK, NULL);
- if (f < 0) {
- warn("open(%s)", dname);
- return 0;
- }
- if (ioctl(f, GRFIOCGINFO, &gi) < 0) {
- warn("ioctl(%s)", dname);
- close(f);
- return 0;
- }
-
- close(f);
- return 1;
-}
-
-void
-printall(void)
-{
- printf("%d x %d, ", gi.gd_dwidth, gi.gd_dheight);
- if (gi.gd_colors < 3)
- printf("monochrome, ");
- else {
- printf("%d colors, ", gi.gd_colors);
- if (gi.gd_planes)
- printf("%d planes, ", gi.gd_planes);
- }
- printf("%s\n", tname());
- printf("registers: 0x%x bytes at 0x%x\n",
- gi.gd_regsize, gi.gd_regaddr);
- printf("framebuf: 0x%x bytes at 0x%x (%d x %d)\n",
- gi.gd_fbsize, gi.gd_fbaddr, gi.gd_fbwidth, gi.gd_fbheight);
-}
-
-char *
-tname(void)
-{
- struct grf_info *gp;
-
- for (gp = info; gp->grf_id >= 0; gp++)
- if (gi.gd_id == gp->grf_id)
- break;
- /*
- * Heuristics to differentiate catseye from topcat:
- * low-res color catseye has 1k x 1k framebuffer and 64 colors
- * hi-res mono and color catseye have 1280 wide display
- */
- if (gi.gd_id == GRFBOBCAT &&
- (gi.gd_dwidth == 1280 ||
- gi.gd_fbsize == 0x100000 && gi.gd_colors == 64))
- return("catseye");
- return(gp->grf_name);
-}
-
-void
-usage(void)
-{
- extern char *__progname;
-
- fprintf(stderr, "usage: %s [-at] device\n", __progname);
- exit(1);
-}
diff --git a/usr.sbin/hilinfo/Makefile b/usr.sbin/hilinfo/Makefile
deleted file mode 100644
index 756730ca089..00000000000
--- a/usr.sbin/hilinfo/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# $OpenBSD: Makefile,v 1.5 2002/02/19 20:20:39 miod Exp $
-
-.if ${MACHINE}=="hp300"
-PROG= hilinfo
-CFLAGS+= -I${.CURDIR}/../../sys/arch/hp300
-DPADD= ${LIBUTIL}
-LDADD= -lutil
-.else
-NOPROG=yes
-.endif
-
-MAN=hilinfo.8
-MANSUBDIR=hp300
-
-.include <bsd.prog.mk>
diff --git a/usr.sbin/hilinfo/hilinfo.8 b/usr.sbin/hilinfo/hilinfo.8
deleted file mode 100644
index 9bc30b67b86..00000000000
--- a/usr.sbin/hilinfo/hilinfo.8
+++ /dev/null
@@ -1,67 +0,0 @@
-.\" $OpenBSD: hilinfo.8,v 1.3 2003/06/12 12:59:50 jmc Exp $
-.\"
-.\" Copyright (c) 2002 Miodrag Vallat.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistribution 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.
-.\"
-.\" 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.
-.\"
-.\"
-.Dd February 19, 2002
-.Dt HILINFO 1 hp300
-.Os
-.Sh NAME
-.Nm hilinfo
-.Nd provides information on HIL devices
-.Sh SYNOPSIS
-.Nm hilinfo
-.Op Fl a
-.Op Fl t
-.Ar device ...
-.Sh DESCRIPTION
-.Nm
-prints information about the
-.Ar device
-list.
-.Pp
-The options are as follows:
-.Bl -tag -width Ds
-.It Fl a
-For each
-.Ar device ,
-display the type and the complete hil information bitstring.
-.It Fl t
-For each
-.Ar device ,
-display the type.
-.El
-.Pp
-If no options are given, the type will be printed (that is,
-.Nm
-will behave as if
-.Fl t
-had been passed).
-.Sh SEE ALSO
-.Xr hil 4
-.Sh HISTORY
-A
-.Nm
-command appeared in
-.Bx 4.4 .
diff --git a/usr.sbin/hilinfo/hilinfo.c b/usr.sbin/hilinfo/hilinfo.c
deleted file mode 100644
index 2b064564f5c..00000000000
--- a/usr.sbin/hilinfo/hilinfo.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* $OpenBSD: hilinfo.c,v 1.6 2004/08/01 18:32:18 deraadt Exp $ */
-/*
- * Copyright (c) 1987-1993, The University of Utah and
- * the Center for Software Science at the University of Utah (CSS).
- * All rights reserved.
- *
- * Permission to use, copy, modify and distribute this software is hereby
- * granted provided that (1) source code retains these copyright, permission,
- * and disclaimer notices, and (2) redistributions including binaries
- * reproduce the notices in supporting documentation, and (3) all advertising
- * materials mentioning features or use of this software display the following
- * acknowledgement: ``This product includes software developed by the Center
- * for Software Science at the University of Utah.''
- *
- * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
- * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF
- * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * CSS requests users of this software to return to css-dist@cs.utah.edu any
- * improvements that they make and grant CSS redistribution rights.
- *
- * from: Utah $Hdr: hilinfo.c 1.3 94/04/04$
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <util.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <dev/hilioctl.h>
-
-int getinfo(char *);
-void printall(void);
-char *tname(void);
-void usage(void);
-
-struct _hilbuf11 hi;
-struct _hilbuf16 sc;
-
-struct hil_info {
- u_char hil_lo;
- u_char hil_hi;
- char *hil_name;
-} info[] = {
- 0xA0, 0xFF, "keyboard",
- 0x60, 0x6B, "mouse",
- 0x90, 0x97, "tablet",
- 0x34, 0x34, "id-module",
- 0x30, 0x30, "button-box",
- 0x00, 0x00, "unknown",
-};
-
-int
-main(int argc, char *argv[])
-{
- int aflg, tflg;
- int c;
- char *dname;
-
- aflg = tflg = 0;
- while ((c = getopt(argc, argv, "at")) != -1) {
- switch (c) {
- case 'a':
- if (tflg != 0)
- usage();
- aflg++;
- break;
- case 't':
- if (aflg != 0)
- usage();
- tflg++;
- break;
- case '?':
- default:
- usage();
- }
- }
- argc -= optind;
- argv += optind;
-
- if (argc == 0)
- usage();
- while (argc-- != 0) {
- dname = *argv++;
- if (getinfo(dname)) {
- printf("%s: ", dname);
- if (aflg)
- printall();
- else
- printf("%s\n", tname());
- }
- }
- exit(0);
-}
-
-int
-getinfo(char *dname)
-{
- int f;
-
- f = opendev(dname, 0, OPENDEV_BLCK, NULL);
- if (f < 0) {
- warn("open(%s)", dname);
- return 0;
- }
- if (ioctl(f, HILIOCID, &hi) < 0 || ioctl(f, HILIOCSC, &sc) < 0) {
- warn("ioctl(%s)", dname);
- close(f);
- return 0;
- }
-
- close(f);
- return 1;
-}
-
-void
-printall(void)
-{
- int i;
-
- printf("%s, info: ", tname());
- for (i = 0; i < 11; i++)
- printf("%2.2x", hi.string[i]);
- if (strcmp(tname(), "id-module") == 0) {
- printf(", sc: ");
- for (i = 0; i < 16; i++)
- printf("%2.2x", sc.string[i]);
- }
- printf("\n");
-}
-
-char *
-tname(void)
-{
- struct hil_info *hp;
-
- for (hp = info; hp->hil_lo; hp++)
- if (hi.string[0] >= hp->hil_lo && hi.string[0] <= hp->hil_hi)
- break;
- if (hi.string[0] == 0x61 && hi.string[1] == 0x13)
- return("knobs");
- return(hp->hil_name);
-}
-
-void
-usage(void)
-{
- extern char *__progname;
-
- fprintf(stderr, "usage: %s [-at] device\n", __progname);
- exit(1);
-}
diff --git a/usr.sbin/wsconscfg/Makefile b/usr.sbin/wsconscfg/Makefile
index ead8e6c33cf..ed6084509b0 100644
--- a/usr.sbin/wsconscfg/Makefile
+++ b/usr.sbin/wsconscfg/Makefile
@@ -1,11 +1,11 @@
-# $OpenBSD: Makefile,v 1.18 2005/01/13 19:21:04 drahn Exp $
+# $OpenBSD: Makefile,v 1.19 2005/01/14 22:39:40 miod Exp $
.if ${MACHINE} == "alpha" || ${MACHINE} == "amd64" || \
- ${MACHINE} == "cats" || ${MACHINE} == "hppa" || \
- ${MACHINE} == "i386" || ${MACHINE} == "luna88k" || \
- ${MACHINE} == "macppc" || ${MACHINE} == "sparc" || \
- ${MACHINE} == "sparc64" || ${MACHINE} == "sgi" || \
- ${MACHINE} == "zaurus"
+ ${MACHINE} == "cats" || ${MACHINE} == "hp300" || \
+ ${MACHINE} == "hppa" || ${MACHINE} == "i386" || \
+ ${MACHINE} == "luna88k" || ${MACHINE} == "macppc" || \
+ ${MACHINE} == "sgi" || ${MACHINE} == "sparc" || \
+ ${MACHINE} == "sparc64" || ${MACHINE} == "zaurus"
PROG= wsconscfg
SRCS= wsconscfg.c
@@ -17,7 +17,7 @@ NOPROG=yes
.endif
MAN= wsconscfg.8
-MANSUBDIR= alpha amd64 cats hppa i386 luna88k macppc sparc sparc64 sgi
-MANSUBDIR+= zaurus
+MANSUBDIR= alpha amd64 cats hp300 hppa i386 luna88k macppc sgi
+MANSUBDIR+= sparc sparc64 zaurus
.include <bsd.prog.mk>