summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2016-03-09 16:28:44 +0000
committerderaadt <deraadt@openbsd.org>2016-03-09 16:28:44 +0000
commit696cd27b243dead39b0a0015b5a1b4287fe04a6f (patch)
treed7d83f24867ea666aa2295ebf83dd5be05ed34c1 /sys
parentUnmask interrupts unconditionnally before calling the generic trap handler. (diff)
downloadwireguard-openbsd-696cd27b243dead39b0a0015b5a1b4287fe04a6f.tar.xz
wireguard-openbsd-696cd27b243dead39b0a0015b5a1b4287fe04a6f.zip
We are done providing support for the vax.
lots of agreement.
Diffstat (limited to 'sys')
-rw-r--r--sys/Makefile4
-rw-r--r--sys/arch/vax/Makefile45
-rw-r--r--sys/arch/vax/compile/.cvsignore2
-rw-r--r--sys/arch/vax/conf/GENERIC132
-rw-r--r--sys/arch/vax/conf/Makefile.vax169
-rw-r--r--sys/arch/vax/conf/RAMDISK115
-rw-r--r--sys/arch/vax/conf/files.vax227
-rw-r--r--sys/arch/vax/dec/dzcons.c298
-rw-r--r--sys/arch/vax/dec/dzinput.c100
-rw-r--r--sys/arch/vax/dec/dzkbd.c305
-rw-r--r--sys/arch/vax/dec/dzkbdvar.h20
-rw-r--r--sys/arch/vax/dec/dzms.c161
-rw-r--r--sys/arch/vax/dec/files.dec20
-rw-r--r--sys/arch/vax/dec/lk201_ws.c318
-rw-r--r--sys/arch/vax/dec/lk201reg.h64
-rw-r--r--sys/arch/vax/dec/lk201var.h73
-rw-r--r--sys/arch/vax/dec/sii.c1747
-rw-r--r--sys/arch/vax/dec/siireg.h235
-rw-r--r--sys/arch/vax/dec/siivar.h55
-rw-r--r--sys/arch/vax/dec/vsms_ws.c390
-rw-r--r--sys/arch/vax/dec/vsmsvar.h151
-rw-r--r--sys/arch/vax/dec/wskbdmap_lk201.c216
-rw-r--r--sys/arch/vax/dec/wskbdmap_lk201.h7
-rw-r--r--sys/arch/vax/if/if_de.c683
-rw-r--r--sys/arch/vax/if/if_dereg.h217
-rw-r--r--sys/arch/vax/if/if_le.c282
-rw-r--r--sys/arch/vax/if/if_qe.c835
-rw-r--r--sys/arch/vax/if/if_qereg.h193
-rw-r--r--sys/arch/vax/if/if_uba.h140
-rw-r--r--sys/arch/vax/if/if_ze.c127
-rw-r--r--sys/arch/vax/if/sgec.c876
-rw-r--r--sys/arch/vax/if/sgecreg.h238
-rw-r--r--sys/arch/vax/if/sgecvar.h73
-rw-r--r--sys/arch/vax/include/_float.h71
-rw-r--r--sys/arch/vax/include/_types.h139
-rw-r--r--sys/arch/vax/include/asm.h128
-rw-r--r--sys/arch/vax/include/atomic.h119
-rw-r--r--sys/arch/vax/include/bus.h968
-rw-r--r--sys/arch/vax/include/cca.h127
-rw-r--r--sys/arch/vax/include/cdefs.h21
-rw-r--r--sys/arch/vax/include/clock.h85
-rw-r--r--sys/arch/vax/include/cpu.h189
-rw-r--r--sys/arch/vax/include/cvax.h129
-rw-r--r--sys/arch/vax/include/db_machdep.h76
-rw-r--r--sys/arch/vax/include/disklabel.h40
-rw-r--r--sys/arch/vax/include/endian.h65
-rw-r--r--sys/arch/vax/include/exec.h44
-rw-r--r--sys/arch/vax/include/frame.h64
-rw-r--r--sys/arch/vax/include/intr.h161
-rw-r--r--sys/arch/vax/include/ka410.h171
-rw-r--r--sys/arch/vax/include/ka420.h151
-rw-r--r--sys/arch/vax/include/ka43.h234
-rw-r--r--sys/arch/vax/include/ka46.h56
-rw-r--r--sys/arch/vax/include/ka48.h62
-rw-r--r--sys/arch/vax/include/ka630.h135
-rw-r--r--sys/arch/vax/include/ka650.h166
-rw-r--r--sys/arch/vax/include/ka670.h90
-rw-r--r--sys/arch/vax/include/ka680.h59
-rw-r--r--sys/arch/vax/include/kcore.h10
-rw-r--r--sys/arch/vax/include/limits.h53
-rw-r--r--sys/arch/vax/include/loadfile_machdep.h48
-rw-r--r--sys/arch/vax/include/lock.h10
-rw-r--r--sys/arch/vax/include/macros.h219
-rw-r--r--sys/arch/vax/include/mtpr.h181
-rw-r--r--sys/arch/vax/include/mutex.h61
-rw-r--r--sys/arch/vax/include/nexus.h66
-rw-r--r--sys/arch/vax/include/param.h96
-rw-r--r--sys/arch/vax/include/pcb.h73
-rw-r--r--sys/arch/vax/include/pmap.h149
-rw-r--r--sys/arch/vax/include/proc.h39
-rw-r--r--sys/arch/vax/include/profile.h55
-rw-r--r--sys/arch/vax/include/psl.h108
-rw-r--r--sys/arch/vax/include/pte.h102
-rw-r--r--sys/arch/vax/include/ptrace.h40
-rw-r--r--sys/arch/vax/include/reg.h59
-rw-r--r--sys/arch/vax/include/reloc.h18
-rw-r--r--sys/arch/vax/include/rpb.h130
-rw-r--r--sys/arch/vax/include/scb.h141
-rw-r--r--sys/arch/vax/include/setjmp.h8
-rw-r--r--sys/arch/vax/include/sgmap.h81
-rw-r--r--sys/arch/vax/include/sid.h188
-rw-r--r--sys/arch/vax/include/signal.h63
-rw-r--r--sys/arch/vax/include/spinlock.h14
-rw-r--r--sys/arch/vax/include/stdarg.h59
-rw-r--r--sys/arch/vax/include/tcb.h33
-rw-r--r--sys/arch/vax/include/trap.h93
-rw-r--r--sys/arch/vax/include/uvax.h120
-rw-r--r--sys/arch/vax/include/varargs.h53
-rw-r--r--sys/arch/vax/include/vaxfp.h86
-rw-r--r--sys/arch/vax/include/vmparam.h98
-rw-r--r--sys/arch/vax/include/vsbus.h111
-rw-r--r--sys/arch/vax/mbus/dz_fwio.c216
-rw-r--r--sys/arch/vax/mbus/files.mbus33
-rw-r--r--sys/arch/vax/mbus/fwio.c110
-rw-r--r--sys/arch/vax/mbus/fwioreg.h45
-rw-r--r--sys/arch/vax/mbus/fwiovar.h28
-rw-r--r--sys/arch/vax/mbus/if_le_fwio.c271
-rw-r--r--sys/arch/vax/mbus/legss.c758
-rw-r--r--sys/arch/vax/mbus/mbus.c442
-rw-r--r--sys/arch/vax/mbus/mbusreg.h251
-rw-r--r--sys/arch/vax/mbus/mbusvar.h33
-rw-r--r--sys/arch/vax/mbus/sii_fwio.c164
-rw-r--r--sys/arch/vax/mbus/uba_mbus.c178
-rw-r--r--sys/arch/vax/mscp/files.mscp24
-rw-r--r--sys/arch/vax/mscp/mscp.c445
-rw-r--r--sys/arch/vax/mscp/mscp.h490
-rw-r--r--sys/arch/vax/mscp/mscp_disk.c915
-rw-r--r--sys/arch/vax/mscp/mscp_subr.c868
-rw-r--r--sys/arch/vax/mscp/mscp_tape.c569
-rw-r--r--sys/arch/vax/mscp/mscpreg.h122
-rw-r--r--sys/arch/vax/mscp/mscpvar.h245
-rw-r--r--sys/arch/vax/qbus/dhu.c873
-rw-r--r--sys/arch/vax/qbus/dhureg.h157
-rw-r--r--sys/arch/vax/qbus/dl.c503
-rw-r--r--sys/arch/vax/qbus/dlreg.h90
-rw-r--r--sys/arch/vax/qbus/dz.c734
-rw-r--r--sys/arch/vax/qbus/dz_uba.c145
-rw-r--r--sys/arch/vax/qbus/dzreg.h101
-rw-r--r--sys/arch/vax/qbus/dzvar.h86
-rw-r--r--sys/arch/vax/qbus/files.uba44
-rw-r--r--sys/arch/vax/qbus/qdreg.h379
-rw-r--r--sys/arch/vax/qbus/qevent.h116
-rw-r--r--sys/arch/vax/qbus/uba.c315
-rw-r--r--sys/arch/vax/qbus/ubavar.h162
-rw-r--r--sys/arch/vax/qbus/uda.c487
-rw-r--r--sys/arch/vax/stand/Makefile9
-rw-r--r--sys/arch/vax/stand/Makefile.inc13
-rw-r--r--sys/arch/vax/stand/boot/Makefile58
-rw-r--r--sys/arch/vax/stand/boot/autoconf.c280
-rw-r--r--sys/arch/vax/stand/boot/boot.c296
-rw-r--r--sys/arch/vax/stand/boot/conf.c100
-rw-r--r--sys/arch/vax/stand/boot/consio.c428
-rw-r--r--sys/arch/vax/stand/boot/consio2.S160
-rw-r--r--sys/arch/vax/stand/boot/data.h73
-rw-r--r--sys/arch/vax/stand/boot/devopen.c182
-rw-r--r--sys/arch/vax/stand/boot/if_de.c294
-rw-r--r--sys/arch/vax/stand/boot/if_le.c407
-rw-r--r--sys/arch/vax/stand/boot/if_qe.c258
-rw-r--r--sys/arch/vax/stand/boot/if_ze.c302
-rw-r--r--sys/arch/vax/stand/boot/mfm.c650
-rw-r--r--sys/arch/vax/stand/boot/netio.c185
-rw-r--r--sys/arch/vax/stand/boot/ra.c292
-rw-r--r--sys/arch/vax/stand/boot/rom.c117
-rw-r--r--sys/arch/vax/stand/boot/vaxstand.h77
-rw-r--r--sys/arch/vax/stand/boot/version42
-rw-r--r--sys/arch/vax/stand/common/romread.S74
-rw-r--r--sys/arch/vax/stand/common/srt0.S81
-rw-r--r--sys/arch/vax/stand/common/str.S151
-rw-r--r--sys/arch/vax/stand/common/vaxstand.h56
-rw-r--r--sys/arch/vax/stand/xxboot/Makefile59
-rw-r--r--sys/arch/vax/stand/xxboot/bootxx.c329
-rw-r--r--sys/arch/vax/stand/xxboot/genassym.cf21
-rw-r--r--sys/arch/vax/stand/xxboot/start.S199
-rw-r--r--sys/arch/vax/uba/uba_common.h51
-rw-r--r--sys/arch/vax/uba/uba_dma.c275
-rw-r--r--sys/arch/vax/uba/uba_ibus.c126
-rw-r--r--sys/arch/vax/uba/ubareg.h68
-rw-r--r--sys/arch/vax/vax/autoconf.c374
-rw-r--r--sys/arch/vax/vax/bus_dma.c782
-rw-r--r--sys/arch/vax/vax/bus_mem.c125
-rw-r--r--sys/arch/vax/vax/clock.c399
-rw-r--r--sys/arch/vax/vax/conf.c398
-rw-r--r--sys/arch/vax/vax/cvax.c107
-rw-r--r--sys/arch/vax/vax/db_disasm.c554
-rw-r--r--sys/arch/vax/vax/db_disasm.h110
-rw-r--r--sys/arch/vax/vax/db_machdep.c440
-rw-r--r--sys/arch/vax/vax/disksubr.c152
-rw-r--r--sys/arch/vax/vax/emulate.s1267
-rw-r--r--sys/arch/vax/vax/findcpu.c126
-rw-r--r--sys/arch/vax/vax/genassym.cf117
-rw-r--r--sys/arch/vax/vax/gencons.c325
-rw-r--r--sys/arch/vax/vax/gencons.h70
-rw-r--r--sys/arch/vax/vax/ibus.c131
-rw-r--r--sys/arch/vax/vax/in4_cksum.c228
-rw-r--r--sys/arch/vax/vax/in_cksum.c146
-rw-r--r--sys/arch/vax/vax/ka410.c171
-rw-r--r--sys/arch/vax/vax/ka43.c373
-rw-r--r--sys/arch/vax/vax/ka46.c191
-rw-r--r--sys/arch/vax/vax/ka48.c180
-rw-r--r--sys/arch/vax/vax/ka49.c245
-rw-r--r--sys/arch/vax/vax/ka53.c239
-rw-r--r--sys/arch/vax/vax/ka60.c358
-rw-r--r--sys/arch/vax/vax/ka630.c163
-rw-r--r--sys/arch/vax/vax/ka650.c252
-rw-r--r--sys/arch/vax/vax/ka660.c137
-rw-r--r--sys/arch/vax/vax/ka670.c207
-rw-r--r--sys/arch/vax/vax/ka680.c291
-rw-r--r--sys/arch/vax/vax/led.c259
-rw-r--r--sys/arch/vax/vax/locore.S742
-rw-r--r--sys/arch/vax/vax/machdep.c1343
-rw-r--r--sys/arch/vax/vax/mem.c187
-rw-r--r--sys/arch/vax/vax/mutex.c87
-rw-r--r--sys/arch/vax/vax/opcodes.c411
-rw-r--r--sys/arch/vax/vax/pmap.c1697
-rw-r--r--sys/arch/vax/vax/scb.c168
-rw-r--r--sys/arch/vax/vax/sgmap.c329
-rw-r--r--sys/arch/vax/vax/softintr.c171
-rw-r--r--sys/arch/vax/vax/trap.c404
-rw-r--r--sys/arch/vax/vax/udiv.s68
-rw-r--r--sys/arch/vax/vax/unimpl_emul.s848
-rw-r--r--sys/arch/vax/vax/urem.s66
-rw-r--r--sys/arch/vax/vax/vm_machdep.c276
-rw-r--r--sys/arch/vax/vax/vxt.c149
-rw-r--r--sys/arch/vax/vax/wscons_machdep.c173
-rw-r--r--sys/arch/vax/vsa/asc_vsbus.c492
-rw-r--r--sys/arch/vax/vsa/dz_ibus.c184
-rw-r--r--sys/arch/vax/vsa/gpx.c1405
-rw-r--r--sys/arch/vax/vsa/hdc9224.c874
-rw-r--r--sys/arch/vax/vsa/hdc9224.h196
-rw-r--r--sys/arch/vax/vsa/if_le_vsbus.c273
-rw-r--r--sys/arch/vax/vsa/if_ze_vsbus.c125
-rw-r--r--sys/arch/vax/vsa/lcg.c845
-rw-r--r--sys/arch/vax/vsa/lcgreg.h282
-rw-r--r--sys/arch/vax/vsa/lcspx.c807
-rw-r--r--sys/arch/vax/vsa/maskbits.h101
-rw-r--r--sys/arch/vax/vsa/ncr.c465
-rw-r--r--sys/arch/vax/vsa/smg.c901
-rw-r--r--sys/arch/vax/vsa/vsaudio.c466
-rw-r--r--sys/arch/vax/vsa/vsbus.c417
-rw-r--r--sys/arch/vax/vsa/vsbus_dma.c280
-rw-r--r--sys/arch/vax/vxt/if_ze_vxtbus.c97
-rw-r--r--sys/arch/vax/vxt/qsc.c1072
-rw-r--r--sys/arch/vax/vxt/qsckbd.c290
-rw-r--r--sys/arch/vax/vxt/qscms.c166
-rw-r--r--sys/arch/vax/vxt/qscreg.h173
-rw-r--r--sys/arch/vax/vxt/qscvar.h115
-rw-r--r--sys/arch/vax/vxt/vxtbus.c158
-rw-r--r--sys/arch/vax/vxt/vxtbusvar.h28
228 files changed, 2 insertions, 57091 deletions
diff --git a/sys/Makefile b/sys/Makefile
index 13272d5628e..3f68e96d42b 100644
--- a/sys/Makefile
+++ b/sys/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.43 2015/12/01 08:13:29 deraadt Exp $
+# $OpenBSD: Makefile,v 1.44 2016/03/09 16:28:45 deraadt Exp $
# $NetBSD: Makefile,v 1.5 1995/09/15 21:05:21 pk Exp $
SUBDIR= dev/microcode \
@@ -7,7 +7,7 @@ SUBDIR= dev/microcode \
arch/landisk arch/loongson arch/luna88k \
arch/macppc arch/octeon \
arch/sgi arch/socppc arch/sparc arch/sparc64 \
- arch/vax arch/zaurus
+ arch/zaurus
tags:
cd ${.CURDIR}/kern; make tags
diff --git a/sys/arch/vax/Makefile b/sys/arch/vax/Makefile
deleted file mode 100644
index 7c4d572aabc..00000000000
--- a/sys/arch/vax/Makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-# $OpenBSD: Makefile,v 1.8 2013/12/08 14:46:39 espie Exp $
-
-S= ${.CURDIR}/../..
-KFILE= GENERIC
-.if exists(conf/GENERIC.MP)
-KFILE= GENERIC.MP
-.endif
-TDIRS= ${_arch} include dec if mbus mscp qbus uba vsa vxt
-TAGS= ${.CURDIR}/tags
-
-NOPROG=
-NOMAN=
-NOOBJ=
-SUBDIR= stand
-
-# config the fattest kernel we can find into a temporary dir
-# to create a Makefile. Then use make to pull some variables
-# out and push them into the sub-shell to expand the paths,
-# and finally run ctags.
-tags::
- TDIR=`mktemp -d /tmp/_tagXXXXXXXXXX` || exit 1; \
- eval "S=${S}" && \
- config -s ${S} -b $${TDIR} ${.CURDIR}/conf/${KFILE} && \
- eval "_arch=\"`make -V _arch -f $${TDIR}/Makefile`\"" && \
- eval "_mach=\"`make -V _mach -f $${TDIR}/Makefile`\"" && \
- eval "_machdir=\$S/arch/$${_mach}" && \
- eval "_archdir=\$S/arch/$${_arch}" && \
- eval "HFILES=\"`find $S \( -path $S/'arch' -o -path $S/stand -o -path $S/lib/libsa -o -path $S'/lib/libkern/arch' \) -prune -o -name '*.h'; find $${_machdir} $${_archdir} $S/lib/libkern/arch/$${_mach} \( -name boot -o -name stand \) -prune -o -name '*.h'`\"" && \
- eval "SFILES=\"`make -V SFILES -f $${TDIR}/Makefile`\"" && \
- eval "CFILES=\"`make -V CFILES -f $${TDIR}/Makefile`\"" && \
- eval "AFILES=\"`make -V AFILES -f $${TDIR}/Makefile`\"" && \
- ctags -wd -f ${TAGS} $${CFILES} $${HFILES} && \
- egrep "^[_A-Z]*ENTRY[_A-Z]*\(.*\)" $${SFILES} $${AFILES} | \
- sed "s;\\([^:]*\\):\\([^(]*\\)(\\([^, )]*\\)\\(.*\\);\\3 \\1 /^\\2(\\3\\4$$/;" \
- >> ${TAGS} && \
- sort -o ${TAGS} ${TAGS} && \
- rm -rf $${TDIR}
-
-links:
- -for i in conf ${TDIRS}; do \
- (cd $$i && rm -f tags; ln -s tags tags); done
-
-obj: _SUBDIRUSE
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/vax/compile/.cvsignore b/sys/arch/vax/compile/.cvsignore
deleted file mode 100644
index b72af3039e6..00000000000
--- a/sys/arch/vax/compile/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-GENERIC
-RAMDISK
diff --git a/sys/arch/vax/conf/GENERIC b/sys/arch/vax/conf/GENERIC
deleted file mode 100644
index 573618994a4..00000000000
--- a/sys/arch/vax/conf/GENERIC
+++ /dev/null
@@ -1,132 +0,0 @@
-# $OpenBSD: GENERIC,v 1.57 2011/09/03 20:41:31 miod Exp $
-#
-# For further information on compiling OpenBSD kernels, see the config(8)
-# man page.
-#
-# For further information on hardware support for this architecture, see
-# the intro(4) man page. For further information about kernel options
-# for this architecture, see the options(4) man page. For an explanation
-# of each device driver in this file see the section 4 man page for the
-# device.
-
-machine vax
-include "../../../conf/GENERIC"
-maxusers 8 # estimated number of users
-
-# Here are all different supported CPU types listed.
-# One of these is required.
-option VAX630 # MV II
-option VAX650 # MV III, 3300, 3600, 3800, 3900
-option VAX660 # VAX 4000 200
-option VAX670 # VAX 4000 300
-option VAX680 # VAX 4000 {4,5,6,7}0{0,5}{,A}
-option VAX410 # VS 2000, 3100/{30,}
-option VAX43 # VS 3100/76
-option VAX46 # VS 4000/60
-option VAX48 # VS 4000 VLC
-option VAX49 # VS 4000/90
-option VAX53 # VAX 4000 10X, MicroVAX 3100m9X
-option VAX60 # VS 3[58][24]0
-option VXT # VXT2000 and VXT2000+
-
-option INSN_EMULATE # CPU lacks some hardware instructions.
-
-config bsd swap generic
-
-mainbus0 at root
-
-# All buses; from the beginning attached to mainbus.
-vsbus0 at mainbus0 # All VAXstations but 3[58][24]0
-ibus0 at mainbus0 # All Microvax
-mbus0 at mainbus0 # VS 3[58][24]0
-vxtbus0 at mainbus0 # VXT2000
-
-# Vsbus, the virtual VAXstation bus, and possible devices.
-le0 at vsbus0 csr 0x200e0000 # LANCE ethernet
-ze0 at vsbus0 csr 0x20008000 # SGEC ethernet
-dz0 at vsbus0 csr 0x200a0000 # DC-367 DZ-11 lookalike ctlr
-dz0 at vsbus0 csr 0x25000000 # VS4000/90 4000/10X MV3100/9X serial
-hdc0 at vsbus0 csr 0x200c0000 # HDC9224 MFM/floppy ctlr
-ncr0 at vsbus0 csr 0x200c0080 # VS2000/3100 SCSI-ctlr
-ncr1 at vsbus0 csr 0x200c0180 # VS2000/3100 SCSI-ctlr
-asc0 at vsbus0 csr 0x200c0080 # VS4000/60 (or VLC) SCSI-ctlr
-asc0 at vsbus0 csr 0x26000080 # VS4000/90 4000/10X MV3100/9X SCSI
-smg0 at vsbus0 csr 0x200f0000 # VS3100 on-board mono frame buffer
-gpx0 at vsbus0 csr 0x3c000000 # VS3100 GPX display option
-lcg0 at vsbus0 csr 0x20100000 # VS4000/60 (or VLC) frame buffer
-lcspx0 at vsbus0 csr 0x39302000 # VS4000/90 frame buffer
-vsaudio0 at vsbus0 csr 0x200d0000 # VS4000/60 (or VLC) audio
-vsaudio0 at vsbus0 csr 0x26800000 # VS4000/90 audio
-
-audio0 at vsaudio?
-
-hd* at hdc0 drive? # RD5x disks
-#ry* at hdc0 drive? # RX floppies
-
-# Ibus, the internal bus on most Microvaxen
-uba0 at ibus0 # Qbus adapter
-ze0 at ibus0 # SGEC on-board ethernet
-le0 at ibus0 # LANCE ethernet (MV3400)
-#shac0 at ibus0 # DSSI controller
-
-# M-bus found on VS 3[58][24]0
-fwio* at mbus0 mid ? # I/O module
-legss0 at mbus0 mid 7 # Graphics module
-uba0 at mbus0 mid 0 # Q-bus adaptor module
-
-dz0 at fwio? # DZ-11 like serial ports
-dz* at fwio? # DZ-11 (on additional fwio)
-le0 at fwio? # LANCE ethernet
-le* at fwio? # LANCE (on additional fwio)
-sii* at fwio? # SII SCSI
-
-# VXT2000 devices
-ze0 at vxtbus0 # SGEC on-board ethernet
-qsc0 at vxtbus0 # serial ports
-lcspx0 at vxtbus0 # color frame buffer
-
-# Devices on Unibus/Qbus adapters
-uda0 at uba? csr 0172150 # UDA50/RQDX?
-uda1 at uba? csr 0160334
-mtc0 at uba? csr 0174500 # Tape MSCP ctlr
-#de0 at uba? csr 0174510 # DELUA/DEUNA
-qe0 at uba? csr 0174440 # DEQNA/DELQA
-dhu0 at uba? csr 0160440 # DHU-11
-dz0 at uba? csr 0160100 # DZ-11
-#dl0 at uba? csr 0176500 # DL-11
-
-# MSCP devices
-mscpbus* at uda?
-mscpbus* at mtc?
-
-ra* at mscpbus? drive? # MSCP disk
-rx* at mscpbus? drive? # MSCP floppy
-mt* at mscpbus? drive? # MSCP tape
-
-# SCSI devices
-
-scsibus* at scsi?
-sd* at scsibus?
-st* at scsibus?
-cd* at scsibus?
-ch* at scsibus?
-safte* at scsibus?
-ses* at scsibus?
-uk* at scsibus?
-
-# Workstation console
-wsdisplay* at gpx?
-wsdisplay* at lcg?
-wsdisplay* at lcspx?
-wsdisplay* at legss?
-wsdisplay* at smg?
-
-lkkbd0 at dz0 line 0
-lkkbd0 at qsc0 line 2
-wskbd* at lkkbd?
-lkms0 at dz0 line 1
-lkms0 at qsc0 line 3
-wsmouse* at lkms?
-
-# Machine leds
-led0 at mainbus0
diff --git a/sys/arch/vax/conf/Makefile.vax b/sys/arch/vax/conf/Makefile.vax
deleted file mode 100644
index b6e380408d3..00000000000
--- a/sys/arch/vax/conf/Makefile.vax
+++ /dev/null
@@ -1,169 +0,0 @@
-# $OpenBSD: Makefile.vax,v 1.74 2015/01/13 01:12:50 deraadt Exp $
-
-# For instructions on building kernels consult the config(8) and options(4)
-# manual pages.
-#
-# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
-# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
-# DEBUG is set to -g by config if debugging is requested (config -g).
-# PROF is set to -pg by config if profiling is requested (config -p).
-
-.include <bsd.own.mk>
-
-SIZE?= size
-STRIP?= strip
-
-# source tree is located via $S relative to the compilation directory
-.ifndef S
-S!= cd ../../../..; pwd
-.endif
-
-_machdir?= $S/arch/${_mach}
-_archdir?= $S/arch/${_arch}
-
-INCLUDES= -nostdinc -I$S -I. -I$S/arch
-CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -MD -MP
-CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \
- -Wno-main -Wno-uninitialized \
- -Wframe-larger-than=2047
-
-CMACHFLAGS=
-CMACHFLAGS+= -fno-builtin-printf -fno-builtin-snprintf \
- -fno-builtin-vsnprintf -fno-builtin-log \
- -fno-builtin-log2 -fno-builtin-malloc ${NOPIE_FLAGS}
-.if ${IDENT:M-DNO_PROPOLICE}
-CMACHFLAGS+= -fno-stack-protector
-.endif
-
-COPTS?= -O2
-CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE}
-AFLAGS= -D_LOCORE -x assembler-with-cpp -traditional-cpp \
- ${CWARNFLAGS} ${CMACHFLAGS}
-LINKFLAGS= -N -Ttext 80000000 -e __start --warn-common
-
-.if ${IDENT:M-DDDB_STRUCT}
-DB_STRUCTINFO= db_structinfo.h
-.else
-DB_STRUCTINFO=
-.endif
-
-HOSTCC?= ${CC}
-HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
-HOSTED_CFLAGS= ${CFLAGS}
-HOSTED_C= ${HOSTCC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
-
-NORMAL_C_NOP= ${CC} ${CFLAGS} ${CPPFLAGS} -c $<
-NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
-
-%OBJS
-
-%CFILES
-
-%SFILES
-
-# load lines for config "xxx" will be emitted as:
-# xxx: ${SYSTEM_DEP} swapxxx.o
-# ${SYSTEM_LD_HEAD}
-# ${SYSTEM_LD} swapxxx.o
-# ${SYSTEM_LD_TAIL}
-SYSTEM_HEAD= locore.o param.o ioconf.o
-SYSTEM_OBJ= ${SYSTEM_HEAD} ${OBJS}
-SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
-SYSTEM_LD_HEAD= @rm -f $@
-SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_HEAD} vers.o $${OBJS}'; \
- ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_HEAD} vers.o ${OBJS}
-SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@
-
-DEBUG?=
-.if ${DEBUG} == "-g"
-LINKFLAGS+= -X
-STRIPFLAGS= -g -x
-SYSTEM_LD_TAIL+=; \
- echo mv $@ $@.gdb; rm -f $@.gdb; mv $@ $@.gdb; \
- echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
- ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
-.else
-LINKFLAGS+= -S -x
-.endif
-
-%LOAD
-
-# cc's -MD puts the source and output paths in the dependency file;
-# since those are temp files here we need to fix it up. It also
-# puts the file in /tmp, so we use -MF to put it in the current
-# directory as assym.P and then generate assym.d from it with a
-# good target name
-assym.h: $S/kern/genassym.sh Makefile \
- ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf
- cat ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf | \
- sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} -MF assym.P > assym.h.tmp
- sed '1s/.*/assym.h: \\/' assym.P > assym.d
- sort -u assym.h.tmp > assym.h
-
-param.c: $S/conf/param.c
- rm -f param.c
- cp $S/conf/param.c .
-
-param.o: param.c Makefile
- ${NORMAL_C}
-
-mcount.o: $S/lib/libkern/mcount.c Makefile
- ${NORMAL_C_NOP}
-
-ioconf.o: ioconf.c
- ${NORMAL_C}
-
-vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
- sh $S/conf/newvers.sh
- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
-
-clean::
- rm -f eddep *bsd *bsd.gdb tags *.[dio] [a-z]*.s \
- [Ee]rrs linterrs assym.h ${DB_STRUCTINFO}
-
-lint:
- @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
- ${CFILES} ioconf.c param.c | \
- grep -v 'static function .* unused'
-
-depend:
- @touch $@
-
-tags:
- @echo "see $S/kern/Makefile for tags"
-
-db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.pl
- ${CC} ${CFLAGS} ${CPPFLAGS} -MT $@ -gstabs -c $S/ddb/db_structinfo.c
- objdump -g db_structinfo.o | perl $S/ddb/parse_structinfo.pl > $@
- rm -f db_structinfo.o
-
-locore.o: ${_machdir}/${_mach}/locore.S assym.h
-unimpl_emul.o: assym.h
-
-# The install target can be redefined by putting a
-# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
-MACHINE_NAME!= uname -n
-install: install-kernel-${MACHINE_NAME}
-.if !target(install-kernel-${MACHINE_NAME}})
-install-kernel-${MACHINE_NAME}:
- cmp -s bsd /bsd || ln -f /bsd /obsd
- cp bsd /nbsd
- mv /nbsd /bsd
-.endif
-
-# pull in the dependency information
-.if !empty(DB_STRUCTINFO) && !exists(${DB_STRUCTINFO})
- ${SYSTEM_OBJ}: ${DB_STRUCTINFO}
-.endif
-.ifnmake clean
-. for o in ${SYSTEM_OBJ} assym.h ${DB_STRUCTINFO}
-. if exists(${o:R}.d)
-. include "${o:R}.d"
-. elif exists($o)
- .PHONY: $o
-. endif
-. endfor
-.endif
-
-%RULES
diff --git a/sys/arch/vax/conf/RAMDISK b/sys/arch/vax/conf/RAMDISK
deleted file mode 100644
index d3c692c30db..00000000000
--- a/sys/arch/vax/conf/RAMDISK
+++ /dev/null
@@ -1,115 +0,0 @@
-# $OpenBSD: RAMDISK,v 1.38 2015/07/17 22:52:29 tedu Exp $
-
-machine vax
-maxusers 4
-
-option TIMEZONE=0
-option DST=0
-
-option SMALL_KERNEL
-option NO_PROPOLICE
-option BOOT_CONFIG
-
-option RAMDISK_HOOKS
-option MINIROOTSIZE=3072
-
-option FFS
-option NFSCLIENT
-option CD9660
-option INET6
-
-# Here are all different supported CPU types listed.
-option VAX630 # MV II
-option VAX650 # MV III, 3300, 3600, 3800, 3900
-option VAX660 # VAX 4000 200
-option VAX670 # VAX 4000 300
-option VAX680 # VAX 4000 {4,5,6,7}0{0,5}{,A}
-option VAX410 # VS 2000, 3100/{30,}
-option VAX43 # VS 3100/76
-option VAX46 # VS 4000/60
-option VAX48 # VS 4000 VLC
-option VAX49 # VS 4000/90
-option VAX53 # VAX 4000/10{0,5,6}
-option VAX60 # VS 3[58][24]0
-option VXT # VXT2000 and VXT2000+
-option INSN_EMULATE # CPU lacks some hardware instructions.
-
-config bsd root on rd0a swap on rd0b
-
-mainbus0 at root
-
-# All buses; from the beginning attached to mainbus.
-vsbus0 at mainbus0 # All VAXstations
-ibus0 at mainbus0 # All Microvax
-mbus0 at mainbus0 # VS 3[58][24]0
-vxtbus0 at mainbus0 # VXT2000
-
-# Vsbus, the virtual VAXstation bus, and possible devices.
-le0 at vsbus0 csr 0x200e0000 # LANCE ethernet
-ze0 at vsbus0 csr 0x20008000 # SGEC ethernet
-dz0 at vsbus0 csr 0x200a0000 # DC-367 DZ-11 lookalike ctlr
-dz0 at vsbus0 csr 0x25000000 # VS4000/90 4000/10X MV3100/9X serial
-hdc0 at vsbus0 csr 0x200c0000 # HDC9224 MFM/floppy ctlr
-ncr0 at vsbus0 csr 0x200c0080 # VS2000/3100 SCSI-ctlr
-ncr1 at vsbus0 csr 0x200c0180 # VS2000/3100 SCSI-ctlr
-asc0 at vsbus0 csr 0x200c0080 # VS4000/60 (or VLC) SCSI-ctlr
-asc0 at vsbus0 csr 0x26000080 # VS4000/90 4000/10X MV3100/9X SCSI
-smg0 at vsbus0 csr 0x200f0000 # VS3100 on-board mono frame buffer
-gpx0 at vsbus0 csr 0x3c000000 # VS3100 GPX display option
-lcg0 at vsbus0 csr 0x20100000 # VS4000/60 (or VLC) frame buffer
-lcspx0 at vsbus0 csr 0x39302000 # VS4000/90 frame buffer
-
-hd* at hdc0 drive? # RD5x disks
-
-# Ibus, the internal bus on most Microvaxen
-uba0 at ibus0 # Qbus adapter
-ze0 at ibus0 # SGEC on-board ethernet
-le0 at ibus0 # LANCE ethernet
-
-# M-bus found on VS 3[58][24]0
-fwio* at mbus0 mid ? # I/O module
-legss0 at mbus0 mid 7 # Graphics module
-uba0 at mbus0 mid 0 # Q-bus adaptor module
-
-dz0 at fwio? # DZ-11 like serial ports
-dz* at fwio? # DZ-11 (on additional fwio)
-le0 at fwio? # LANCE ethernet
-le* at fwio? # LANCE (on additional fwio)
-sii* at fwio? # SII SCSI
-
-# VXT2000 devices
-ze0 at vxtbus0 # SGEC on-board ethernet
-qsc0 at vxtbus0 # serial ports
-lcspx0 at vxtbus0 # color frame buffer
-
-uda0 at uba? csr 0172150 # UDA50/RQDX?
-uda1 at uba? csr 0160334
-mtc0 at uba? csr 0174500 # Tape MSCP ctlr
-qe0 at uba? csr 0174440 # DEQNA/DELQA
-dz0 at uba? csr 0160100 # DZ-11
-
-mscpbus* at uda?
-mscpbus* at mtc?
-
-ra* at mscpbus? drive? # MSCP disk
-rx* at mscpbus? drive? # MSCP floppy
-mt* at mscpbus? drive? # MSCP tape
-
-scsibus* at scsi?
-sd* at scsibus?
-st* at scsibus?
-cd* at scsibus?
-
-wsdisplay* at gpx?
-wsdisplay* at lcg?
-wsdisplay* at lcspx?
-wsdisplay* at legss?
-wsdisplay* at smg?
-
-lkkbd0 at dz0 line 0
-lkkbd0 at qsc0 line 2
-wskbd* at lkkbd?
-
-pseudo-device loop 1
-pseudo-device bpfilter 1
-pseudo-device rd 1
diff --git a/sys/arch/vax/conf/files.vax b/sys/arch/vax/conf/files.vax
deleted file mode 100644
index f7c9aa002f5..00000000000
--- a/sys/arch/vax/conf/files.vax
+++ /dev/null
@@ -1,227 +0,0 @@
-# $OpenBSD: files.vax,v 1.60 2015/07/17 22:52:29 tedu Exp $
-# $NetBSD: files.vax,v 1.60 1999/08/27 20:04:32 ragge Exp $
-#
-# new style config file for vax architecture
-#
-
-# maxpartitions must be first item in files.${ARCH}.newconf
-maxpartitions 16
-
-maxusers 2 8 64
-
-device mainbus {}
-attach mainbus at root
-
-# Define a bunch of devices, needed in more than one place.
-device cpu
-
-define dzcons
-
-device vsbus {csr}
-attach vsbus at mainbus
-file arch/vax/vsa/vsbus.c vsbus
-file arch/vax/vsa/vsbus_dma.c vsbus
-
-# DEC SGEC Second Generation Ethernet Controller
-define sgec
-file arch/vax/if/sgec.c sgec
-
-device ibus {}
-attach ibus at mainbus
-file arch/vax/vax/ibus.c ibus
-
-device vxtbus {}
-attach vxtbus at mainbus
-file arch/vax/vxt/vxtbus.c vxtbus
-
-device ze: sgec, ether, ifnet
-attach ze at ibus with ze_ibus
-file arch/vax/if/if_ze.c ze_ibus
-attach ze at vsbus with ze_vsbus
-file arch/vax/vsa/if_ze_vsbus.c ze_vsbus
-attach ze at vxtbus with ze_vxtbus
-file arch/vax/vxt/if_ze_vxtbus.c ze_vxtbus
-
-attach le at ibus with le_ibus: le24
-file arch/vax/if/if_le.c le_ibus
-
-# MSCP device drivers
-include "arch/vax/mscp/files.mscp"
-major {ra = 9}
-
-# Unibus/Q22 bus definitions
-include "arch/vax/qbus/files.uba"
-
-attach uba at ibus with uba_ibus
-file arch/vax/uba/uba_ibus.c uba_ibus
-
-attach dz at vsbus with dz_vsbus: dzcons
-file arch/vax/vsa/dz_ibus.c dz_vsbus
-
-# VXT serial
-device qsc {line = -1}: tty
-attach qsc at vxtbus
-file arch/vax/vxt/qsc.c qsc needs-flag
-
-# RD-type disks at VS2000's onboard MFM-controller
-device hdc {drive = -1}
-attach hdc at vsbus
-file arch/vax/vsa/hdc9224.c hdc | ry | hd needs-flag
-
-device hd: disk
-attach hd at hdc
-major {hd = 19}
-
-device ry: disk
-attach ry at hdc
-major {ry = 24}
-
-#
-# Bus-independent support for DEC devices
-#
-include "arch/vax/dec/files.dec"
-
-# wscons files.
-include "dev/rasops/files.rasops"
-include "dev/wscons/files.wscons"
-include "dev/wsfont/files.wsfont"
-
-# RAM Disk for install floppy
-major {rd = 23}
-
-#
-# Machine-independent SCSI driver.
-#
-
-include "scsi/files.scsi"
-major {sd = 20}
-major {st = 21}
-major {cd = 22}
-
-# builtin NCR53C95 SCSI Controller on VAXstation 4000 VLC/60/9x
-device asc: scsi, ncr53c9x
-attach asc at vsbus with asc_vsbus
-file arch/vax/vsa/asc_vsbus.c asc
-
-# builtin NCR5380 SCSI-controller on VAXstation
-device ncr: scsi, ncr5380sbc
-attach ncr at vsbus
-file arch/vax/vsa/ncr.c ncr
-
-# LANCE ethernet controller on VAXstation
-attach le at vsbus with le_vsbus: le24
-file arch/vax/vsa/if_le_vsbus.c le_vsbus
-
-# Monochrome (on-board) framebuffer on VS3100
-device smg: wsemuldisplaydev, rasops1
-attach smg at vsbus
-file arch/vax/vsa/smg.c smg needs-flag
-
-# GPX framebuffer on VS3100
-device gpx: wsemuldisplaydev, rasops8
-attach gpx at vsbus
-file arch/vax/vsa/gpx.c gpx needs-flag
-
-# LCG framebuffer on KA46/KA48
-device lcg: wsemuldisplaydev, rasops8
-attach lcg at vsbus
-file arch/vax/vsa/lcg.c lcg needs-flag
-
-# LCSPX framebuffer on KA49
-device lcspx: wsemuldisplaydev, rasops8
-attach lcspx at vsbus with lcspx_vsbus
-attach lcspx at vxtbus with lcspx_vxtbus
-file arch/vax/vsa/lcspx.c lcspx needs-flag
-
-device lkkbd: wskbddev
-attach lkkbd at dz with dzkbd
-attach lkkbd at qsc with qsckbd
-file arch/vax/dec/dzkbd.c dzkbd needs-flag
-file arch/vax/vxt/qsckbd.c qsckbd needs-flag
-
-device lkms: wsmousedev
-attach lkms at dz with dzms
-attach lkms at qsc with qscms
-file arch/vax/dec/dzms.c dzms needs-flag
-file arch/vax/vxt/qscms.c qscms needs-flag
-
-file arch/vax/dec/dzinput.c dzkbd | dzms
-
-# M-bus on VS 3[58][24]0
-include "arch/vax/mbus/files.mbus"
-
-# Blinkenlichten
-device led
-attach led at mainbus
-file arch/vax/vax/led.c led needs-flag
-
-device vsaudio: audio, am7930
-attach vsaudio at vsbus
-file arch/vax/vsa/vsaudio.c vsaudio
-
-# These are general files needed for compilation.
-file dev/cninit.c
-file arch/vax/vax/autoconf.c
-file arch/vax/vax/bus_dma.c
-file arch/vax/vax/bus_mem.c
-file arch/vax/vax/clock.c
-file arch/vax/vax/conf.c
-file arch/vax/vax/cvax.c vax60 | vax650
-file arch/vax/vax/db_disasm.c ddb
-file arch/vax/vax/db_machdep.c ddb
-file arch/vax/vax/disksubr.c disk | tape
-file arch/vax/vax/emulate.s insn_emulate
-file arch/vax/vax/findcpu.c
-file arch/vax/vax/gencons.c vax630 | vax650 | vax660 |
- vax670 | vax680
-file arch/vax/vax/in_cksum.c
-file arch/vax/vax/in4_cksum.c
-file arch/vax/vax/ka410.c vax410
-file arch/vax/vax/ka43.c vax43
-file arch/vax/vax/ka46.c vax46
-file arch/vax/vax/ka48.c vax48
-file arch/vax/vax/ka49.c vax49
-file arch/vax/vax/ka53.c vax53
-file arch/vax/vax/ka60.c vax60
-file arch/vax/vax/ka630.c vax630
-file arch/vax/vax/ka650.c vax650
-file arch/vax/vax/ka660.c vax660
-file arch/vax/vax/ka670.c vax670
-file arch/vax/vax/ka680.c vax680
-file arch/vax/vax/machdep.c
-file arch/vax/vax/mem.c
-file arch/vax/vax/mutex.c
-file arch/vax/vax/opcodes.c
-file arch/vax/vax/pmap.c
-file arch/vax/vax/scb.c
-file arch/vax/vax/sgmap.c
-file arch/vax/vax/softintr.c
-file arch/vax/vax/trap.c
-file arch/vax/vax/udiv.s
-file arch/vax/vax/unimpl_emul.s insn_emulate
-file arch/vax/vax/urem.s
-file arch/vax/vax/vm_machdep.c
-file arch/vax/vax/vxt.c vxt
-file arch/vax/vax/wscons_machdep.c wsdisplay | wskbd
-file arch/vax/uba/uba_dma.c uba
-
-# quad support is necessary for 32 bit architectures
-file lib/libkern/adddi3.c
-file lib/libkern/anddi3.c
-file lib/libkern/ashldi3.c
-file lib/libkern/ashrdi3.c
-file lib/libkern/cmpdi2.c
-file lib/libkern/divdi3.c
-file lib/libkern/iordi3.c
-file lib/libkern/lshldi3.c
-file lib/libkern/lshrdi3.c
-file lib/libkern/moddi3.c
-file lib/libkern/muldi3.c
-file lib/libkern/negdi2.c
-file lib/libkern/notdi2.c
-file lib/libkern/qdivrem.c
-file lib/libkern/subdi3.c
-file lib/libkern/ucmpdi2.c
-file lib/libkern/udivdi3.c
-file lib/libkern/umoddi3.c
-file lib/libkern/xordi3.c
diff --git a/sys/arch/vax/dec/dzcons.c b/sys/arch/vax/dec/dzcons.c
deleted file mode 100644
index c5bf9454de0..00000000000
--- a/sys/arch/vax/dec/dzcons.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/* $OpenBSD: dzcons.c,v 1.6 2011/09/19 21:53:00 miod Exp $ */
-/* $NetBSD: dz_ibus.c,v 1.15 1999/08/27 17:50:42 ragge Exp $ */
-/*
- * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * Console routines for system using DZ11-like controllers, with the
- * same register mapping as found on VAXstations.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-
-#include <dev/cons.h>
-
-#include <machine/mtpr.h>
-#include <machine/sid.h>
-#include <machine/vsbus.h>
-#include <machine/ka420.h>
-#ifdef VAX60
-#include <vax/mbus/mbusreg.h>
-#include <vax/mbus/mbusvar.h>
-#include <vax/mbus/fwioreg.h>
-#endif
-
-#include <vax/qbus/dzreg.h>
-#include <vax/qbus/dzvar.h>
-
-#include <vax/dec/dzkbdvar.h>
-
-vaddr_t dz_console_regs; /* console registers mapping */
-
-#define REG(name) short name; short X##name##X;
-static volatile struct ss_dz {/* base address of DZ-controller: 0x200a0000 */
- REG(csr); /* 00 Csr: control/status register */
- REG(rbuf); /* 04 Rbuf/Lpr: receive buffer/line param reg. */
- REG(tcr); /* 08 Tcr: transmit console register */
- REG(tdr); /* 0C Msr/Tdr: modem status reg/transmit data reg */
- REG(lpr0); /* 10 Lpr0: */
- REG(lpr1); /* 14 Lpr0: */
- REG(lpr2); /* 18 Lpr0: */
- REG(lpr3); /* 1C Lpr0: */
-} *dz;
-#undef REG
-
-cdev_decl(dz);
-cons_decl(dz);
-
-extern int getmajor(void *); /* conf.c */
-
-int dzcngetc_internal(int);
-
-/*
- * Receive a character on the given line (blocking call).
- * Used by both serial and keyboard cngetc routines.
- */
-int
-dzcngetc_internal(int line)
-{
- u_short rbuf;
-
- for (;;) {
- while ((dz->csr & DZ_CSR_RX_DONE) == 0)
- ; /* Wait for char */
- rbuf = dz->rbuf;
- if (((rbuf >> 8) & 3) != line)
- continue;
- return (rbuf & 0xff);
- }
-}
-
-/*
- * Returns whether the dz attachment may have a keyboard plugged in.
- * There are no specific parameters identifying the dz chip, since
- * - VAXstation can only have one non-qbus dz chip.
- * - ...except for the KA60 (VAXstation 3500), which can have keyboards
- * connected to all I/O modules, if more than one.
- * - ...and QBus dz attachments do not invoke this function as they know
- * they are ``regular'' serial lines only.
- */
-int
-dz_can_have_kbd()
-{
- switch (vax_boardtype) {
- case VAX_BTYP_410:
- case VAX_BTYP_420:
- case VAX_BTYP_43:
- if ((vax_confdata & KA420_CFG_MULTU) == 0)
- return (1);
- break;
-
- case VAX_BTYP_46:
- if ((vax_siedata & 0xff) == VAX_VTYP_46)
- return (1);
- break;
- case VAX_BTYP_48:
- if (vax_cpustype == VAX_STYP_48)
- return (1);
- break;
-
- case VAX_BTYP_49:
-#ifdef VAX60
- case VAX_BTYP_60:
-#endif
- return (1);
-
- default:
- break;
- }
-
- return (0);
-}
-
-int
-dzcngetc(dev)
- dev_t dev;
-{
- int c = 0, s;
- int line = minor(dev);
-
- s = spltty();
- do {
- c = dzcngetc_internal(line);
- } while (c == 17 || c == 19); /* ignore XON/XOFF */
- splx(s);
-
- if (c == 13)
- c = 10;
-
- return (c);
-}
-
-void
-dzcnprobe(cndev)
- struct consdev *cndev;
-{
- extern vaddr_t iospace;
- int diagcons, major, pri;
- paddr_t ioaddr = DZ_CSR;
-
- if ((major = getmajor(dzopen)) < 0)
- return;
-
- pri = CN_DEAD;
-
- switch (vax_boardtype) {
- case VAX_BTYP_410:
- case VAX_BTYP_420:
- case VAX_BTYP_43:
- diagcons = (vax_confdata & KA420_CFG_L3CON ? 3 : 0);
- break;
-
- case VAX_BTYP_46:
- case VAX_BTYP_48:
- diagcons = (vax_confdata & 0x100 ? 3 : 0);
- break;
-
- case VAX_BTYP_49:
- ioaddr = DZ_CSR_KA49;
- diagcons = (vax_confdata & 8 ? 3 : 0);
- break;
-
- case VAX_BTYP_1303:
- ioaddr = DZ_CSR_KA49;
- diagcons = 3;
- break;
-
-#ifdef VAX60
- case VAX_BTYP_60:
- ioaddr = MBUS_SLOT_BASE(mbus_ioslot) + FWIO_DZ_REG_OFFSET;
- diagcons = 3;
- pri = CN_LOWPRI; /* graphics console always wins */
- break;
-#endif
-
- default:
- return;
- }
-
- if (pri == CN_DEAD)
- pri = diagcons != 0 ? CN_HIGHPRI : CN_LOWPRI;
- cndev->cn_pri = pri;
- cndev->cn_dev = makedev(major, dz_can_have_kbd() ? 3 : diagcons);
- dz_console_regs = iospace;
- ioaccess(iospace, ioaddr, 1);
-}
-
-void
-dzcninit(cndev)
- struct consdev *cndev;
-{
- dzcninit_internal(minor(cndev->cn_dev), 0);
-}
-
-void
-dzcninit_internal(int line, int iskbd)
-{
- int speed;
-
- dz = (void *)dz_console_regs;
-
- speed = iskbd ? DZ_LPR_B4800 : DZ_LPR_B9600;
-
- dz->csr = 0; /* Disable scanning until initting is done */
- dz->tcr = 1 << line; /* Turn on xmitter */
- dz->csr = DZ_CSR_MSE; /* Turn scanning back on */
- dz->rbuf = DZ_LPR_RX_ENABLE | (speed << 8) | DZ_LPR_8_BIT_CHAR | line;
-}
-
-/*
- * IMPORTANT! Do not use major(dev) in dzcnputc(), as dzputc() only provides
- * meaningful minor when invoking dzcnputc().
- */
-void
-dzcnputc(dev,ch)
- dev_t dev;
- int ch;
-{
- int timeout = 1<<15; /* don't hang the machine! */
- int s;
- int mino = minor(dev);
- u_short tcr;
-
- if (mfpr(PR_MAPEN) == 0)
- return;
-
- /*
- * If we are past boot stage, dz* will interrupt,
- * therefore we block.
- */
- s = spltty();
- tcr = dz->tcr; /* remember which lines to scan */
- dz->tcr = (1 << mino);
-
- while ((dz->csr & DZ_CSR_TX_READY) == 0) /* Wait until ready */
- if (--timeout < 0)
- break;
- dz->tdr = ch; /* Put the character */
- timeout = 1<<15;
- while ((dz->csr & DZ_CSR_TX_READY) == 0) /* Wait until ready */
- if (--timeout < 0)
- break;
-
- dz->tcr = tcr;
- splx(s);
-}
-
-void
-dzcnpollc(dev, pollflag)
- dev_t dev;
- int pollflag;
-{
- static u_char mask;
-
- switch (vax_boardtype) {
-#ifdef VAX60
- case VAX_BTYP_60:
- break;
-#endif
-
- default:
- if (pollflag)
- mask = vsbus_setmask(0);
- else
- vsbus_setmask(mask);
- break;
- }
-}
diff --git a/sys/arch/vax/dec/dzinput.c b/sys/arch/vax/dec/dzinput.c
deleted file mode 100644
index de6b88acd30..00000000000
--- a/sys/arch/vax/dec/dzinput.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* $OpenBSD: dzinput.c,v 1.1 2008/08/18 23:04:28 miod Exp $ */
-/* $NetBSD: dz_ibus.c,v 1.15 1999/08/27 17:50:42 ragge Exp $ */
-/*
- * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * Common input routines used by dzkbd and dzms devices.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-
-#include <vax/qbus/dzreg.h>
-#include <vax/qbus/dzvar.h>
-
-#include <vax/dec/dzkbdvar.h>
-
-#include <dev/cons.h>
-
-cons_decl(dz);
-
-int
-dz_print(void *aux, const char *name)
-{
- struct dzkm_attach_args *dz_args = aux;
-
- if (name != NULL)
- printf(dz_args->daa_line == 0 ? "lkkbd at %s" : "lkms at %s",
- name);
- else
- printf(" line %d", dz_args->daa_line);
-
- return (UNCONF);
-}
-
-void
-dzputc(struct dz_linestate *ls, int ch)
-{
- int line;
- u_short tcr;
- int s;
-
- /*
- * If the dz has already been attached, the MI
- * driver will do the transmitting...
- */
- if (ls && ls->dz_sc) {
- s = spltty();
- line = ls->dz_line;
- putc(ch, &ls->dz_tty->t_outq);
- tcr = DZ_READ_WORD(ls->dz_sc, dr_tcr);
- if (!(tcr & (1 << line)))
- DZ_WRITE_WORD(ls->dz_sc, dr_tcr, tcr | (1 << line));
- dzxint(ls->dz_sc);
- splx(s);
- return;
- }
-
- /*
- * Otherwise, use dzcnputc to do the transmitting.
- * This situation only happens for a console keyboard, which is
- * why the minor is hardcoded to the line number. Also, dzcnputc()
- * does not care about the major number, so we skip a not-so-cheap
- * getminor() call.
- */
- dzcnputc(makedev(0 /*getmajor(dzopen)*/, 0), ch);
-}
diff --git a/sys/arch/vax/dec/dzkbd.c b/sys/arch/vax/dec/dzkbd.c
deleted file mode 100644
index c455678d168..00000000000
--- a/sys/arch/vax/dec/dzkbd.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/* $OpenBSD: dzkbd.c,v 1.15 2014/01/26 17:48:07 miod Exp $ */
-/* $NetBSD: dzkbd.c,v 1.1 2000/12/02 17:03:55 ragge Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * 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, Lawrence Berkeley Laboratory.
- *
- * 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.
- *
- * @(#)kbd.c 8.2 (Berkeley) 10/30/93
- */
-
-/*
- * LK200/LK400 keyboard attached to line 0 of the DZ*-11
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/syslog.h>
-#include <sys/malloc.h>
-#include <sys/timeout.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wskbdvar.h>
-#include <dev/wscons/wsksymdef.h>
-#include <dev/wscons/wsksymvar.h>
-#include <vax/dec/wskbdmap_lk201.h>
-
-#include <machine/bus.h>
-
-#include <vax/qbus/dzreg.h>
-#include <vax/qbus/dzvar.h>
-
-#include <vax/dec/dzkbdvar.h>
-#include <vax/dec/lk201reg.h>
-#include <vax/dec/lk201var.h>
-
-struct dzkbd_internal {
- struct dz_linestate *dzi_ls;
- struct lk201_state dzi_ks;
-};
-
-struct dzkbd_internal dzkbd_console_internal;
-
-struct dzkbd_softc {
- struct device dzkbd_dev; /* required first: base device */
-
- struct dzkbd_internal *sc_itl;
- int sc_enabled;
- struct device *sc_wskbddev;
-};
-
-int dzkbd_match(struct device *, struct cfdata *, void *);
-void dzkbd_attach(struct device *, struct device *, void *);
-
-struct cfattach dzkbd_ca = {
- sizeof(struct dzkbd_softc), (cfmatch_t)dzkbd_match, dzkbd_attach,
-};
-
-int dzkbd_enable(void *, int);
-void dzkbd_set_leds(void *, int);
-int dzkbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
-
-const struct wskbd_accessops dzkbd_accessops = {
- dzkbd_enable,
- dzkbd_set_leds,
- dzkbd_ioctl,
-};
-
-void dzkbd_cngetc(void *, u_int *, int *);
-void dzkbd_cnpollc(void *, int);
-
-const struct wskbd_consops dzkbd_consops = {
- dzkbd_cngetc,
- dzkbd_cnpollc,
-};
-
-const struct wskbd_mapdata dzkbd_keymapdata = {
- lkkbd_keydesctab,
-#ifdef LKKBD_LAYOUT
- LKKBD_LAYOUT,
-#else
- KB_US | KB_DEFAULT,
-#endif
-};
-
-int dzkbd_input(void *, int);
-int dzkbd_sendchar(void *, int);
-
-/*
- * kbd_match: how is this dz line configured?
- */
-int
-dzkbd_match(struct device *parent, struct cfdata *cf, void *aux)
-{
- struct dzkm_attach_args *daa = aux;
-
-#define DZCF_LINE 0
-#define DZCF_LINE_DEFAULT 0
-
- /* Exact match is better than wildcard. */
- if (cf->cf_loc[DZCF_LINE] == daa->daa_line)
- return 2;
-
- /* This driver accepts wildcard. */
- if (cf->cf_loc[DZCF_LINE] == DZCF_LINE_DEFAULT)
- return 1;
-
- return 0;
-}
-
-void
-dzkbd_attach(struct device *parent, struct device *self, void *aux)
-{
- struct dz_softc *dz = (void *)parent;
- struct dzkbd_softc *dzkbd = (void *)self;
- struct dzkm_attach_args *daa = aux;
- struct dz_linestate *ls;
- struct dzkbd_internal *dzi;
- struct wskbddev_attach_args a;
- int isconsole;
-
- dz->sc_dz[daa->daa_line].dz_catch = dzkbd_input;
- dz->sc_dz[daa->daa_line].dz_private = dzkbd;
- ls = &dz->sc_dz[daa->daa_line];
-
- isconsole = (daa->daa_flags & DZKBD_CONSOLE);
-
- if (isconsole) {
- dzi = &dzkbd_console_internal;
- dzkbd->sc_enabled = 1;
- } else {
- dzi = malloc(sizeof(struct dzkbd_internal), M_DEVBUF, M_NOWAIT);
- if (dzi == NULL) {
- printf(": out of memory\n");
- return;
- }
- dzi->dzi_ks.attmt.sendchar = dzkbd_sendchar;
- dzi->dzi_ks.attmt.cookie = ls;
- }
- dzi->dzi_ks.device = self;
- dzi->dzi_ls = ls;
- dzkbd->sc_itl = dzi;
-
- printf("\n");
-
- if (!isconsole)
- lk201_init(&dzi->dzi_ks);
-
- a.console = dzi == &dzkbd_console_internal;
- a.keymap = &dzkbd_keymapdata;
- a.accessops = &dzkbd_accessops;
- a.accesscookie = dzkbd;
-
- dzkbd->sc_wskbddev = config_found(self, &a, wskbddevprint);
-}
-
-int
-dzkbd_cnattach()
-{
- /*
- * Early operation (especially keyboard initialization)
- * requires the help of the serial console routines, which
- * need to be initialized to work with the keyboard line.
- */
- dzcninit_internal(0, 1);
-
- dzkbd_console_internal.dzi_ks.attmt.sendchar = dzkbd_sendchar;
- dzkbd_console_internal.dzi_ks.attmt.cookie = NULL;
- lk201_init(&dzkbd_console_internal.dzi_ks);
- dzkbd_console_internal.dzi_ls = NULL;
-
- wskbd_cnattach(&dzkbd_consops, &dzkbd_console_internal,
- &dzkbd_keymapdata);
-
- return 0;
-}
-
-int
-dzkbd_enable(void *v, int on)
-{
- struct dzkbd_softc *sc = v;
-
- sc->sc_enabled = on;
- return 0;
-}
-
-void
-dzkbd_cngetc(void *v, u_int *type, int *data)
-{
- struct dzkbd_internal *dzi = v;
-#if 0
- int line = dzi->dzi_ls != NULL ? dzi->dzi_ls->dz_line : 0;
-#else
- int line = 0; /* keyboard */
-#endif
- int c, s;
-
- do {
- s = spltty();
- c = dzcngetc_internal(line);
- splx(s);
- } while (lk201_decode(&dzi->dzi_ks, 1, 0, c, type, data) == LKD_NODATA);
-}
-
-void
-dzkbd_cnpollc(void *v, int on)
-{
-#if 0
- struct dzkbd_internal *dzi = v;
-#endif
-}
-
-void
-dzkbd_set_leds(void *v, int leds)
-{
- struct dzkbd_softc *sc = (struct dzkbd_softc *)v;
-
- lk201_set_leds(&sc->sc_itl->dzi_ks, leds);
-}
-
-int
-dzkbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- struct dzkbd_softc *sc = (struct dzkbd_softc *)v;
-
- switch (cmd) {
- case WSKBDIO_GTYPE:
- *(int *)data = lk201_get_type(&sc->sc_itl->dzi_ks);
- return 0;
- case WSKBDIO_SETLEDS:
- lk201_set_leds(&sc->sc_itl->dzi_ks, *(int *)data);
- return 0;
- case WSKBDIO_GETLEDS:
- *(int *)data = lk201_get_leds(&sc->sc_itl->dzi_ks);
- return 0;
- case WSKBDIO_COMPLEXBELL:
- lk201_bell(&sc->sc_itl->dzi_ks,
- (struct wskbd_bell_data *)data);
- return 0;
- }
- return -1;
-}
-
-int
-dzkbd_input(void *v, int data)
-{
- struct dzkbd_softc *sc = (struct dzkbd_softc *)v;
- u_int type;
- int val;
- int decode;
-
- /*
- * We want to run through lk201_decode always, so that a late plugged
- * keyboard will get configured correctly.
- */
- do {
- decode = lk201_decode(&sc->sc_itl->dzi_ks, sc->sc_enabled, 1,
- data, &type, &val);
- if (decode != LKD_NODATA)
- wskbd_input(sc->sc_wskbddev, type, val);
- } while (decode == LKD_MORE);
-
- return(1);
-}
-
-int
-dzkbd_sendchar(void *v, int c)
-{
- dzputc((struct dz_linestate *)v, c);
- return (0);
-}
diff --git a/sys/arch/vax/dec/dzkbdvar.h b/sys/arch/vax/dec/dzkbdvar.h
deleted file mode 100644
index dd6cf2dc86e..00000000000
--- a/sys/arch/vax/dec/dzkbdvar.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $OpenBSD: dzkbdvar.h,v 1.4 2008/08/20 16:31:41 miod Exp $ */
-/* $NetBSD: dzkbdvar.h,v 1.2 2001/03/06 07:40:52 matt Exp $ */
-
-struct dzkm_attach_args {
- int daa_line; /* Line to search */
- int daa_flags; /* Console etc...*/
-#define DZKBD_CONSOLE 1
-};
-
-/* dzcons.c */
-int dz_can_have_kbd(void);
-void dzcninit_internal(int, int);
-int dzcngetc_internal(int);
-
-/* dzinput.c */
-void dzputc(struct dz_linestate *, int);
-int dz_print(void *, const char *);
-
-/* dzkbd.c */
-int dzkbd_cnattach(void);
diff --git a/sys/arch/vax/dec/dzms.c b/sys/arch/vax/dec/dzms.c
deleted file mode 100644
index 71deb859682..00000000000
--- a/sys/arch/vax/dec/dzms.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/* $OpenBSD: dzms.c,v 1.8 2008/08/22 21:05:07 miod Exp $ */
-/* $NetBSD: dzms.c,v 1.1 2000/12/02 17:03:55 ragge Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * 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, Lawrence Berkeley Laboratory.
- *
- * 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.
- *
- * @(#)ms.c 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * VSXXX mouse or tablet, attached to line 1 of the DZ*
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/syslog.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-
-#include <machine/bus.h>
-
-#include <vax/qbus/dzreg.h>
-#include <vax/qbus/dzvar.h>
-
-#include <vax/dec/dzkbdvar.h>
-#include <vax/dec/vsmsvar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsmousevar.h>
-
-struct dzms_softc { /* driver status information */
- struct lkms_softc sc_base;
- struct dz_linestate *dzms_ls;
-};
-
-int dzms_match(struct device *, struct cfdata *, void *);
-void dzms_attach(struct device *, struct device *, void *);
-
-struct cfattach dzms_ca = {
- sizeof(struct dzms_softc), (cfmatch_t)dzms_match, dzms_attach,
-};
-
-int dzms_enable(void *);
-void dzms_disable(void *);
-
-const struct wsmouse_accessops dzms_accessops = {
- dzms_enable,
- lkms_ioctl,
- dzms_disable,
-};
-
-int
-dzms_match(struct device *parent, struct cfdata *cf, void *aux)
-{
- struct dzkm_attach_args *daa = aux;
-
-#define DZCF_LINE 0
-#define DZCF_LINE_DEFAULT 1
-
- /* Exact match is better than wildcard. */
- if (cf->cf_loc[DZCF_LINE] == daa->daa_line)
- return 2;
-
- /* This driver accepts wildcard. */
- if (cf->cf_loc[DZCF_LINE] == DZCF_LINE_DEFAULT)
- return 1;
-
- return 0;
-}
-
-void
-dzms_attach(struct device *parent, struct device *self, void *aux)
-{
- struct dz_softc *dz = (void *)parent;
- struct dzms_softc *dzms = (void *)self;
- struct lkms_softc *sc = (void *)self;
- struct dzkm_attach_args *daa = aux;
- struct dz_linestate *ls;
- struct wsmousedev_attach_args a;
-
- dz->sc_dz[daa->daa_line].dz_catch = lkms_input;
- dz->sc_dz[daa->daa_line].dz_private = dzms;
- ls = &dz->sc_dz[daa->daa_line];
- dzms->dzms_ls = ls;
-
- printf("\n");
-
- a.accessops = &dzms_accessops;
- a.accesscookie = dzms;
-
- sc->sc_flags = 0;
- sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint);
-}
-
-int
-dzms_enable(void *v)
-{
- struct dzms_softc *dzms = v;
- struct lkms_softc *sc = v;
-
- if (ISSET(sc->sc_flags, MS_ENABLED))
- return EBUSY;
-
- SET(sc->sc_flags, MS_SELFTEST);
- dzputc(dzms->dzms_ls, VS_SELF_TEST);
- /* selftest is supposed to complete within 500ms */
- (void)tsleep(&sc->sc_flags, TTIPRI, "dzmsopen", hz / 2);
- if (ISSET(sc->sc_flags, MS_SELFTEST)) {
- CLR(sc->sc_flags, MS_SELFTEST);
- return ENXIO;
- }
- DELAY(150);
- dzputc(dzms->dzms_ls, VS_INCREMENTAL);
- SET(sc->sc_flags, MS_ENABLED);
- return 0;
-}
-
-void
-dzms_disable(void *v)
-{
- struct lkms_softc *sc = v;
-
- CLR(sc->sc_flags, MS_ENABLED);
-}
diff --git a/sys/arch/vax/dec/files.dec b/sys/arch/vax/dec/files.dec
deleted file mode 100644
index 1f81a9f177a..00000000000
--- a/sys/arch/vax/dec/files.dec
+++ /dev/null
@@ -1,20 +0,0 @@
-# $OpenBSD: files.dec,v 1.6 2008/08/18 23:19:22 miod Exp $
-# $NetBSD: files.dec,v 1.4 1999/08/04 07:17:51 nisimura Exp $
-#
-# Config file and device description for machine-independent
-# code for devices for Digital Equipment Corp. systems.
-# Included by ports that need it.
-
-# Console on DZ11-like serial ports
-file arch/vax/dec/dzcons.c dzcons
-
-# LK201 keyboard
-file arch/vax/dec/lk201_ws.c lkkbd
-file arch/vax/dec/wskbdmap_lk201.c lkkbd
-
-# VSxxx mouse
-file arch/vax/dec/vsms_ws.c lkms
-
-# DC7061 SII DSSI/SCSI controller
-device sii: scsi
-file arch/vax/dec/sii.c sii
diff --git a/sys/arch/vax/dec/lk201_ws.c b/sys/arch/vax/dec/lk201_ws.c
deleted file mode 100644
index 86d3c25ffce..00000000000
--- a/sys/arch/vax/dec/lk201_ws.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/* $OpenBSD: lk201_ws.c,v 1.10 2006/08/27 16:50:43 miod Exp $ */
-/* $NetBSD: lk201_ws.c,v 1.2 1998/10/22 17:55:20 drochner Exp $ */
-
-/*
- * Copyright (c) 1998
- * Matthias Drochner. 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 for the NetBSD Project
- * by Matthias Drochner.
- * 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 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/kernel.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/timeout.h>
-
-#include <dev/wscons/wsconsio.h>
-
-#include <vax/dec/lk201reg.h>
-#include <vax/dec/lk201var.h>
-#include <vax/dec/wskbdmap_lk201.h> /* for {MIN,MAX}_LK201_KEY */
-
-struct cfdriver lkkbd_cd = {
- NULL, "lkkbd", DV_DULL
-};
-
-void lk201_identify(void *);
-
-static const char *lkkbd_descr[] = {
- "no keyboard",
- "LK-201 keyboard",
- "LK-401 keyboard"
-};
-
-#define send(lks, c) ((*((lks)->attmt.sendchar))((lks)->attmt.cookie, c))
-
-void
-lk201_init(struct lk201_state *lks)
-{
- int i;
-
- lks->waitack = 0;
-
- send(lks, LK_LED_ENABLE);
- send(lks, LK_LED_ALL);
-
- /*
- * set all keys to updown mode; autorepeat is
- * done by wskbd software
- */
- for (i = 1; i <= 14; i++)
- send(lks, LK_CMD_MODE(LK_UPDOWN, i));
-
- send(lks, LK_CL_DISABLE);
- lks->kcvol = 0;
-
- lks->bellvol = -1; /* not yet set */
-
- for (i = 0; i < LK_KLL; i++)
- lks->down_keys_list[i] = -1;
- send(lks, LK_KBD_ENABLE);
-
- send(lks, LK_LED_DISABLE);
- send(lks, LK_LED_ALL);
- lks->leds_state = 0;
-
- /*
- * Note that, when attaching lkkbd initially, this timeout will
- * be scheduled but will not run until interrupts are enabled.
- * This is not a problem, since lk201_identify() relies upon
- * interrupts being enabled.
- */
- timeout_set(&lks->probetmo, lk201_identify, lks);
- timeout_add(&lks->probetmo, 0);
-}
-
-void
-lk201_identify(void *v)
-{
- struct lk201_state *lks = v;
- int i;
-
- /*
- * Swallow all the keyboard acknowledges from lk201_init().
- * There should be 14 of them - one per LK_CMD_MODE command.
- */
- for(;;) {
- lks->waitack = 1;
- for (i = 100; i != 0; i--) {
- DELAY(1000);
- if (lks->waitack == 0)
- break;
- }
- if (i == 0)
- break;
- }
-
- /*
- * Try to set the keyboard in LK-401 mode.
- * If we receive an error, this is an LK-201 keyboard.
- */
- lks->waitack = 1;
- send(lks, LK_ENABLE_401);
- for (i = 100; i != 0; i--) {
- DELAY(1000);
- if (lks->waitack == 0)
- break;
- }
- if (lks->waitack != 0)
- lks->kbdtype = KBD_NONE;
- else {
- if (lks->ackdata == LK_INPUT_ERROR)
- lks->kbdtype = KBD_LK201;
- else
- lks->kbdtype = KBD_LK401;
- }
- lks->waitack = 0;
-
- printf("%s: %s\n", lks->device->dv_xname, lkkbd_descr[lks->kbdtype]);
-}
-
-int
-lk201_decode(struct lk201_state *lks, int active, int wantmulti, int datain,
- u_int *type, int *dataout)
-{
- int i, freeslot;
-
- if (lks->waitack != 0) {
- lks->ackdata = datain;
- lks->waitack = 0;
- return (LKD_NODATA);
- }
-
- switch (datain) {
- case LK_POWER_UP:
-#ifdef DEBUG
- printf("lk201_decode: powerup detected\n");
-#endif
- lk201_init(lks);
- return (LKD_NODATA);
- case LK_KDOWN_ERROR:
- case LK_POWER_ERROR:
- case LK_OUTPUT_ERROR:
- case LK_INPUT_ERROR:
- printf("lk201_decode: error %x\n", datain);
- /* FALLTHROUGH */
- case LK_KEY_REPEAT: /* autorepeat handled by wskbd */
- case LK_MODE_CHANGE: /* ignore silently */
- return (LKD_NODATA);
- }
-
- if (active == 0)
- return (LKD_NODATA); /* no need to decode */
-
- if (datain == LK_KEY_UP) {
- if (wantmulti) {
- for (i = 0; i < LK_KLL; i++)
- if (lks->down_keys_list[i] != -1) {
- *type = WSCONS_EVENT_KEY_UP;
- *dataout = lks->down_keys_list[i] -
- MIN_LK201_KEY;
- lks->down_keys_list[i] = -1;
- return (LKD_MORE);
- }
- return (LKD_NODATA);
- } else {
- for (i = 0; i < LK_KLL; i++)
- lks->down_keys_list[i] = -1;
- *type = WSCONS_EVENT_ALL_KEYS_UP;
- return (LKD_COMPLETE);
- }
- } else if (datain < MIN_LK201_KEY || datain > MAX_LK201_KEY) {
-#ifdef DEBUG
- /* this can happen while hotplugging the keyboard */
- printf("lk201_decode: %x\n", datain);
-#endif
- return (LKD_NODATA);
- }
-
- /*
- * The LK-201 keyboard has a compose key (to the left of the spacebar),
- * but no alt/meta key at all. The LK-401 keyboard fixes this and has
- * two compose keys and two alt keys.
- *
- * If the keyboard is an LK-201, translate the left compose key
- * scancode to a specific key code, which will map as a left alt key,
- * and compose key when shifted), so that the user can have both
- * an alt and a compose key available.
- */
- if (lks->kbdtype == KBD_LK201 && datain == 177)
- datain = 252;
-
- *dataout = datain - MIN_LK201_KEY;
-
- freeslot = -1;
- for (i = 0; i < LK_KLL; i++) {
- if (lks->down_keys_list[i] == datain) {
- *type = WSCONS_EVENT_KEY_UP;
- lks->down_keys_list[i] = -1;
- return (LKD_COMPLETE);
- }
- if (lks->down_keys_list[i] == -1 && freeslot == -1)
- freeslot = i;
- }
-
- if (freeslot == -1) {
- printf("lk201_decode: down(%d) no free slot\n", datain);
- return (LKD_NODATA);
- }
-
- *type = WSCONS_EVENT_KEY_DOWN;
- lks->down_keys_list[freeslot] = datain;
- return (LKD_COMPLETE);
-}
-
-void
-lk201_bell(struct lk201_state *lks, struct wskbd_bell_data *bell)
-{
- unsigned int vol;
-
- if (bell->which & WSKBD_BELL_DOVOLUME) {
- vol = 8 - bell->volume * 8 / 100;
- if (vol > 7)
- vol = 7;
- } else
- vol = 3;
-
- if (vol != lks->bellvol) {
- send(lks, LK_BELL_ENABLE);
- send(lks, LK_PARAM_VOLUME(vol));
- lks->bellvol = vol;
- }
- send(lks, LK_RING_BELL);
-}
-
-int
-lk201_get_leds(struct lk201_state *lks)
-{
- return (lks->leds_state);
-}
-
-int
-lk201_get_type(struct lk201_state *lks)
-{
- /*
- * Note that we report LK201 even if no keyboard is
- * plugged to avoid confusing wsconsctl.
- */
- if (lks->kbdtype == KBD_LK401)
- return (WSKBD_TYPE_LK401);
- else
- return (WSKBD_TYPE_LK201);
-}
-
-void
-lk201_set_keyclick(struct lk201_state *lks, int vol)
-{
- unsigned int newvol;
-
- if (vol == 0)
- send(lks, LK_CL_DISABLE);
- else {
- newvol = 8 - vol * 8 / 100;
- if (newvol > 7)
- newvol = 7;
-
- send(lks, LK_CL_ENABLE);
- send(lks, LK_PARAM_VOLUME(newvol));
- }
-
- lks->kcvol = vol;
-}
-
-void
-lk201_set_leds(struct lk201_state *lks, int leds)
-{
- int newleds;
-
- newleds = 0;
- if (leds & WSKBD_LED_SCROLL)
- newleds |= LK_LED_WAIT;
- if (leds & WSKBD_LED_CAPS)
- newleds |= LK_LED_LOCK;
-
- send(lks, LK_LED_DISABLE);
- send(lks, (0x80 | (~newleds & 0x0f)));
-
- send(lks, LK_LED_ENABLE);
- send(lks, (0x80 | (newleds & 0x0f)));
-
- lks->leds_state = leds;
-}
diff --git a/sys/arch/vax/dec/lk201reg.h b/sys/arch/vax/dec/lk201reg.h
deleted file mode 100644
index 5bfdde2dbf4..00000000000
--- a/sys/arch/vax/dec/lk201reg.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $OpenBSD: lk201reg.h,v 1.1 2001/05/16 22:15:17 hugh Exp $ */
-/* $NetBSD: lk201reg.h,v 1.1 1998/09/17 20:01:57 drochner Exp $ */
-
-/*
- * command keycodes for Digital LK200/LK400 series keyboards.
- */
-
-/*
- * special keycodes
- */
-#define LK_POWER_UP 0x01
-#define LK_KEY_R_SHIFT 0xab
-#define LK_KEY_SHIFT 0xae
-#define LK_KEY_LOCK 0xb0
-#define LK_KEY_CONTROL 0xaf
-#define LK_KEY_R_ALT 0xb2
-#define LK_KEY_UP 0xb3
-#define LK_KEY_REPEAT 0xb4
-#define LK_KEY_HOLD 0x56 /* F1 */
-#define LK_KDOWN_ERROR 0x3d /* key down on powerup error */
-#define LK_POWER_ERROR 0x3e /* keyboard failure on pwrup tst*/
-#define LK_OUTPUT_ERROR 0xb5 /* keystrokes lost during inhbt */
-#define LK_INPUT_ERROR 0xb6 /* garbage command to keyboard */
-#define LK_LOWEST 0x56 /* lowest significant keycode */
-
-/*
- * keyboard commands
- */
-#define LK_UPDOWN 0x86 /* bits for setting lk201 modes */
-#define LK_AUTODOWN 0x82
-#define LK_DOWN 0x80
-#define LK_DEFAULTS 0xd3 /* reset mode settings */
-#define LK_AR_ENABLE 0xe3 /* global auto repeat enable */
-#define LK_CL_ENABLE 0x1b /* keyclick enable */
-#define LK_CL_DISABLE 0x99 /* keyclick disable */
-#define LK_CCL_ENABLE 0xbb /* enable keyclick for CTRL */
-#define LK_CCL_DISABLE 0xb9 /* disable keyclick for CTRL */
-#define LK_KBD_ENABLE 0x8b /* keyboard enable */
-#define LK_BELL_ENABLE 0x23 /* enable the bell */
-#define LK_BELL_DISABLE 0xa1 /* disable the bell */
-#define LK_LED_ENABLE 0x13 /* light led */
-#define LK_LED_DISABLE 0x11 /* turn off led */
-#define LK_RING_BELL 0xa7 /* ring keyboard bell */
-#define LK_LED_1 0x81 /* led bits */
-#define LK_LED_2 0x82
-#define LK_LED_3 0x84
-#define LK_LED_4 0x88
-#define LK_LED_WAIT 0x81
-#define LK_LED_COMP 0x82
-#define LK_LED_LOCK 0x84
-#define LK_LED_HOLD 0x88
-#define LK_LED_ALL 0x8f
-#define LK_HELP 0x7c /* help key */
-#define LK_DO 0x7d /* do key */
-#define LK_DIV6_START 0xad /* start of div 6 */
-#define LK_DIV5_END 0xb2 /* end of div 5 */
-#define LK_ENABLE_401 0xe9 /* turn on LK401 mode */
-#define LK_MODE_CHANGE 0xba /* mode change ack */
-
-/* max volume is 0, lowest is 0x7 */
-#define LK_PARAM_VOLUME(v) (0x80|((v)&0x7))
-
-/* mode command details */
-#define LK_CMD_MODE(m,div) ((m)|((div)<<3))
diff --git a/sys/arch/vax/dec/lk201var.h b/sys/arch/vax/dec/lk201var.h
deleted file mode 100644
index 9702c97b33f..00000000000
--- a/sys/arch/vax/dec/lk201var.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $OpenBSD: lk201var.h,v 1.7 2006/08/05 22:05:55 miod Exp $ */
-/* $NetBSD: lk201var.h,v 1.2 1998/10/22 17:55:20 drochner Exp $ */
-
-/*
- * Copyright (c) 1998
- * Matthias Drochner. 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 for the NetBSD Project
- * by Matthias Drochner.
- * 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 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.
- *
- */
-
-struct lk201_attachment {
- int (*sendchar)(void *, int);
- void *cookie;
-};
-
-struct lk201_state {
- struct device *device;
- struct lk201_attachment attmt;
-
- struct timeout probetmo;
- volatile int waitack;
- int ackdata;
-
- int kbdtype;
-#define KBD_NONE 0x00
-#define KBD_LK201 0x01
-#define KBD_LK401 0x02
-
-#define LK_KLL 8
- int down_keys_list[LK_KLL];
-
- int bellvol;
- int leds_state;
- int kcvol;
-};
-
-void lk201_bell(struct lk201_state *, struct wskbd_bell_data *);
-int lk201_decode(struct lk201_state *, int, int, int, u_int *, int *);
-int lk201_get_leds(struct lk201_state *);
-int lk201_get_type(struct lk201_state *);
-void lk201_init(struct lk201_state *);
-void lk201_set_keyclick(struct lk201_state *, int);
-void lk201_set_leds(struct lk201_state *, int);
-
-/* Values returned by lk201_decode */
-#define LKD_NODATA 0x00
-#define LKD_COMPLETE 0x01
-#define LKD_MORE 0x02
diff --git a/sys/arch/vax/dec/sii.c b/sys/arch/vax/dec/sii.c
deleted file mode 100644
index ef8b5373add..00000000000
--- a/sys/arch/vax/dec/sii.c
+++ /dev/null
@@ -1,1747 +0,0 @@
-/* $OpenBSD: sii.c,v 1.15 2013/01/06 22:06:54 martynas Exp $ */
-/* $NetBSD: sii.c,v 1.42 2000/06/02 20:20:29 mhitch Exp $ */
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * 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.
- *
- * @(#)sii.c 8.2 (Berkeley) 11/30/93
- *
- * from: Header: /sprite/src/kernel/dev/ds3100.md/RCS/devSII.c,
- * v 9.2 89/09/14 13:37:41 jhh Exp $ SPRITE (DECWRL)";
- */
-
-/*
- * SCSI interface driver
- */
-#include <sys/param.h>
-#include <sys/buf.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <scsi/scsi_message.h>
-#ifdef DEBUG
-#include <scsi/scsi_disk.h>
-#endif
-
-#include <vax/dec/siireg.h> /* device registers */
-#include <vax/dec/siivar.h> /* softc and prototypes */
-
-/* XXX not in scsi/scsi_message.h */
-#define MSG_EXT_MODIFY_DATA_PTR 0x00
-
-struct cfdriver sii_cd = {
- NULL, "sii", DV_DULL
-};
-
-/*
- * MACROS for timing out spin loops.
- *
- * Wait until expression is true.
- *
- * Control register bits can change at any time so when the CPU
- * reads a register, the bits might change and
- * invalidate the setup and hold times for the CPU.
- * This macro reads the register twice to be sure the value is stable.
- *
- * args: var - variable to save control register contents
- * reg - control register to read
- * expr - expression to spin on
- * spincount - maximum number of times through the loop
- * cntr - variable for number of tries
- */
-#define SII_WAIT_UNTIL(var, reg, expr, spincount, cntr) \
- do { \
- u_int tmp = reg; \
- for (cntr = 0; cntr < spincount; cntr++) { \
- while (tmp != (var = reg)) \
- tmp = var; \
- if (expr) \
- break; \
- if (cntr >= 100) \
- DELAY(100); \
- } \
- } while (0)
-
-#ifdef DEBUG
-u_int sii_debug = 1;
-int sii_debug_cmd;
-int sii_debug_bn;
-int sii_debug_sz;
-#define NLOG 16
-struct sii_log {
- u_short cstat;
- u_short dstat;
- u_short comm;
- u_short msg;
- int rlen;
- int dlen;
- int target;
-} sii_log[NLOG], *sii_logp = sii_log;
-#endif
-
-#define NORESET 0
-#define RESET 1
-#define NOWAIT 0
-#define WAIT 1
-
-#if 0
-/*
- * XXX That hardcoded 7 below implies SII_NCMD <= 7, which is not the case...
- * XXX Thankfully all uses of SII_BUF_ADDR are in #if 0 sections (and this
- * XXX should be reasonably safe as long as we use 7 as the host id).
- */
-/*
- * Define a safe address in the SCSI buffer for doing status & message DMA
- * XXX why not add another field to softc?
- */
-#define SII_BUF_ADDR(sc) (SII_MAX_DMA_XFER_LENGTH * 7 * 2)
-#endif
-
-/*
- * Forward references
- */
-
-void sii_Reset(struct sii_softc *sc, int resetbus);
-void sii_StartCmd(struct sii_softc *sc, int target);
-void sii_CmdDone(struct sii_softc *sc, int target, int error);
-void sii_DoIntr(struct sii_softc *sc, u_int dstat);
-void sii_StateChg(struct sii_softc *sc, u_int cstat);
-int sii_GetByte(SIIRegs *regs, int phase, int ack);
-void sii_DoSync(struct sii_softc *, State *);
-void sii_StartDMA(SIIRegs *regs, int phase, u_int dmaAddr, int size);
-u_int sii_msgout(SIIRegs *, u_int, u_int8_t);
-void sii_scsi_cmd(struct scsi_xfer *);
-void sii_schedule(struct sii_softc *);
-#ifdef DEBUG
-void sii_DumpLog(void);
-#endif
-
-struct scsi_adapter sii_scsiswitch = {
- sii_scsi_cmd,
- scsi_minphys,
- NULL,
- NULL,
- NULL
-};
-
-void
-sii_attach(sc)
- struct sii_softc *sc;
-{
- struct scsibus_attach_args saa;
- int i;
-
- sc->sc_target = -1; /* no command active */
-
- /*
- * Give each target its own DMA buffer region.
- * Make it big enough for 2 max transfers so we can ping pong buffers
- * while we copy the data.
- */
- for (i = 0; i < SII_NCMD; i++) {
- sc->sc_st[i].dmaAddr[0] =
- SII_MAX_DMA_XFER_LENGTH * 2 * i;
- sc->sc_st[i].dmaAddr[1] = sc->sc_st[i].dmaAddr[0] +
- SII_MAX_DMA_XFER_LENGTH;
- }
-
- sii_Reset(sc, RESET);
- printf("\n");
-
- /*
- * fill in the prototype scsi_link.
- */
- sc->sc_link.adapter = &sii_scsiswitch;
- sc->sc_link.adapter_buswidth = 8;
- sc->sc_link.adapter_softc = sc;
- sc->sc_link.adapter_target = sc->sc_regs->id & SII_IDMSK;
- sc->sc_link.openings = 1; /* driver can't queue requests yet */
-
- /*
- * Now try to attach all the sub-devices
- */
- bzero(&saa, sizeof(saa));
- saa.saa_sc_link = &sc->sc_link;
- config_found(&sc->sc_dev, &saa, scsiprint);
-}
-
-/*
- * Start activity on a SCSI device.
- * We maintain information on each device separately since devices can
- * connect/disconnect during an operation.
- */
-
-void
-sii_scsi_cmd(xs)
- struct scsi_xfer *xs;
-{
- int target = xs->sc_link->target;
- struct sii_softc *sc = xs->sc_link->adapter_softc;
- int s;
- int count;
-
- s = splbio();
- if (sc->sc_xs[target] != NULL) {
-#ifdef DEBUG
- printf("[busy at start]\n");
-#endif
- xs->error = XS_NO_CCB;
- scsi_done(xs);
- splx(s);
- return;
- }
- /*
- * Build a ScsiCmd for this command and start it.
- */
- sc->sc_xs[target] = xs;
- sii_StartCmd(sc, target);
- splx(s);
-
- if ((xs->flags & ITSDONE) != 0)
- return;
- if ((xs->flags & SCSI_POLL) == 0)
- return;
- count = xs->timeout;
- while (count) {
- s = splbio();
- (void)sii_intr(sc);
- splx(s);
- if ((xs->flags & ITSDONE) != 0)
- break;
- /* XXX schedule another command? */
- DELAY(1000);
- --count;
- }
- if ((xs->flags & ITSDONE) != 0)
- return;
- xs->error = XS_TIMEOUT;
- scsi_done(xs);
- return;
-}
-
-/*
- * Check to see if any SII chips have pending interrupts
- * and process as appropriate.
- */
-int
-sii_intr(xxxsc)
- void *xxxsc;
-{
- struct sii_softc *sc = xxxsc;
- u_int dstat;
-
- /*
- * Find which controller caused the interrupt.
- */
- dstat = sc->sc_regs->dstat;
- if (dstat & (SII_CI | SII_DI)) {
- sii_DoIntr(sc, dstat);
- return (1);
- }
-
- return (0);
-}
-
-/*
- * Reset the SII chip and do a SCSI reset if 'reset' is true.
- * NOTE: if !cold && reset, should probably probe for devices
- * since a SCSI bus reset will set UNIT_ATTENTION.
- */
-void
-sii_Reset(sc, reset)
- struct sii_softc* sc;
- int reset; /* TRUE => reset SCSI bus */
-{
- SIIRegs *regs = sc->sc_regs;
-
-#ifdef DEBUG
- if (sii_debug > 1)
- printf("sii: RESET\n");
-#endif
- /*
- * Reset the SII chip.
- */
- regs->comm = SII_CHRESET;
- /*
- * Set arbitrated bus mode.
- */
- regs->csr = SII_HPM;
- /*
- * Set host adapter ID.
- */
- regs->id = SII_ID_IO | sc->sc_hostid;
- /*
- * Enable SII to drive the SCSI bus.
- */
- regs->dictrl = SII_PRE;
- regs->dmctrl = 0;
-
- if (reset) {
- int i;
-
- /*
- * Assert SCSI bus reset for at least 25 Usec to clear the
- * world. SII_DO_RST is self clearing.
- * Delay 250 ms before doing any commands.
- */
- regs->comm = SII_DO_RST;
- DELAY(250000);
-
- /* rearbitrate synchronous offset */
- for (i = 0; i < SII_NCMD; i++)
- sc->sc_st[i].dmaReqAck = 0;
- }
-
- /*
- * Clear any pending interrupts from the reset.
- */
- regs->cstat = regs->cstat;
- regs->dstat = regs->dstat;
- /*
- * Set up SII for arbitrated bus mode, SCSI parity checking,
- * Reselect Enable, and Interrupt Enable.
- */
- regs->csr = SII_HPM | SII_RSE | SII_PCE | SII_IE;
-}
-
-/*
- * Start a SCSI command by sending the cmd data
- * to a SCSI controller via the SII.
- * Call the device done procedure if it can't be started.
- * NOTE: we should be called with interrupts disabled.
- */
-void
-sii_StartCmd(sc, target)
- struct sii_softc *sc; /* which SII to use */
- int target; /* which command to start */
-{
- SIIRegs *regs;
- State *state;
- struct scsi_xfer *xs;
- u_int status;
- int error, retval;
-
- splassert(IPL_BIO);
-
- /* if another command is currently in progress, just wait */
- if (sc->sc_target >= 0)
- return;
-
- /* initialize state information for this command */
- xs = sc->sc_xs[target];
- state = &sc->sc_st[target];
- state->flags = FIRST_DMA;
- state->prevComm = 0;
- state->dmalen = 0;
- state->dmaCurPhase = -1;
- state->dmaPrevPhase = -1;
- state->dmaBufIndex = 0;
- state->cmd = (u_char *)xs->cmd;
- state->cmdlen = xs->cmdlen;
- if ((state->buflen = xs->datalen) == 0) {
- state->dmaDataPhase = -1; /* illegal phase. shouldn't happen */
- state->buf = (char *)NULL;
- } else {
- state->buf = xs->data;
- }
-
-#ifdef DEBUG
- if (sii_debug > 1) {
- printf("sii_StartCmd: %s target %d cmd 0x%x addr %p size %d DMA %d\n",
- sc->sc_dev.dv_xname,
- target, xs->cmd->opcode, xs->data, xs->datalen,
- state->dmaDataPhase);
- }
- sii_debug_cmd = xs->cmd->opcode;
- if (sii_debug_cmd == READ_BIG || sii_debug_cmd == WRITE_BIG) {
- sii_debug_bn = (state->cmd[2] << 24) | (state->cmd[3] << 16) |
- (state->cmd[4] << 8) | state->cmd[5];
- sii_debug_sz = (state->cmd[7] << 8) | state->cmd[8];
- } else {
- sii_debug_bn = 0;
- sii_debug_sz = 0;
- }
-#endif
-
- /* try to select the target */
- regs = sc->sc_regs;
-
- /*
- * Another device may have selected us; in which case,
- * this command will be restarted later.
- */
- if ((status = regs->dstat) & (SII_CI | SII_DI)) {
- sii_DoIntr(sc, status);
- return;
- }
-
- sc->sc_target = target;
- /* do a chained, select with ATN and programmed I/O command */
- regs->data = MSG_IDENTIFYFLAG | MSG_IDENTIFY_DISCFLAG |
- xs->sc_link->lun;
- regs->slcsr = target;
- regs->dmctrl = state->dmaReqAck;
- regs->comm = SII_INXFER | SII_SELECT | SII_ATN | SII_CON |
- SII_MSG_OUT_PHASE;
-
- /*
- * Wait for something to happen
- * (should happen soon or we would use interrupts).
- */
- SII_WAIT_UNTIL(status, regs->cstat, status & (SII_CI | SII_DI),
- SII_WAIT_COUNT/4, retval);
-
- /* check to see if we are connected OK */
- if ((status & (SII_RST | SII_SCH | SII_STATE_MSK)) ==
- (SII_SCH | SII_CON)) {
- regs->cstat = status;
-
-#ifdef DEBUG
- sii_logp->target = target;
- sii_logp->cstat = status;
- sii_logp->dstat = 0;
- sii_logp->comm = regs->comm;
- sii_logp->msg = -1;
- sii_logp->rlen = state->buflen;
- sii_logp->dlen = state->dmalen;
- if (++sii_logp >= &sii_log[NLOG])
- sii_logp = sii_log;
-#endif
-
- /* wait a short time for command phase */
- SII_WAIT_UNTIL(status, regs->dstat, status & SII_MIS,
- SII_WAIT_COUNT, retval);
-#ifdef DEBUG
- if (sii_debug > 2)
- printf("sii_StartCmd: ds %x cnt %d\n", status, retval);
-#endif
- if ((status & (SII_CI | SII_MIS | SII_PHASE_MSK)) !=
- (SII_MIS | SII_CMD_PHASE)) {
- printf("sii_StartCmd: timeout cs %x ds %x cnt %d\n",
- regs->cstat, status, retval); /* XXX */
- /* process interrupt or continue until it happens */
- if (status & (SII_CI | SII_DI))
- sii_DoIntr(sc, status);
- return;
- }
- regs->dstat = SII_DNE; /* clear Msg Out DMA done */
-
- /* send command data */
- sc->sii_copytobuf(sc, state->cmd, state->dmaAddr[0],
- state->cmdlen);
- sii_StartDMA(regs, state->dmaCurPhase = SII_CMD_PHASE,
- state->dmaAddr[0], state->dmalen = xs->cmdlen);
-
- /* wait a little while for DMA to finish */
- SII_WAIT_UNTIL(status, regs->dstat, status & (SII_CI | SII_DI),
- SII_WAIT_COUNT, retval);
-#ifdef DEBUG
- if (sii_debug > 2)
- printf("sii_StartCmd: ds %x, cnt %d\n", status, retval);
-#endif
- if (status & (SII_CI | SII_DI))
- sii_DoIntr(sc, status);
-#ifdef DEBUG
- if (sii_debug > 2)
- printf("sii_StartCmd: DONE ds %x\n", regs->dstat);
-#endif
- return;
- }
-
- /*
- * Another device may have selected us; in which case,
- * this command will be restarted later.
- */
- if (status & (SII_CI | SII_DI)) {
- sii_DoIntr(sc, regs->dstat);
- return;
- }
-
- /*
- * Disconnect if selection command still in progress.
- */
- if (status & SII_SIP) {
- error = XS_SELTIMEOUT; /* device didn't respond */
- regs->comm = SII_DISCON;
- SII_WAIT_UNTIL(status, regs->cstat,
- !(status & (SII_CON | SII_SIP)),
- SII_WAIT_COUNT, retval);
- } else
- error = XS_BUSY; /* couldn't get the bus */
-#ifdef DEBUG
- if (sii_debug > 1)
- printf("sii_StartCmd: Couldn't select target %d error %d\n",
- target, error);
-#endif
- sc->sc_target = -1;
- regs->cstat = 0xffff;
- regs->dstat = 0xffff;
- regs->comm = 0;
- sii_CmdDone(sc, target, error);
-}
-
-/*
- * Process interrupt conditions.
- */
-void
-sii_DoIntr(sc, dstat)
- struct sii_softc *sc;
- u_int dstat;
-{
- SIIRegs *regs = sc->sc_regs;
- State *state;
- u_int cstat;
- int i, msg;
- u_int comm;
-
-again:
- comm = regs->comm;
-
-#ifdef DEBUG
- if (sii_debug > 3)
- printf("sii_DoIntr: cs %x, ds %x cm %x ",
- regs->cstat, dstat, comm);
- sii_logp->target = sc->sc_target;
- sii_logp->cstat = regs->cstat;
- sii_logp->dstat = dstat;
- sii_logp->comm = comm;
- sii_logp->msg = -1;
- if (sc->sc_target >= 0) {
- sii_logp->rlen = sc->sc_st[sc->sc_target].buflen;
- sii_logp->dlen = sc->sc_st[sc->sc_target].dmalen;
- } else {
- sii_logp->rlen = 0;
- sii_logp->dlen = 0;
- }
- if (++sii_logp >= &sii_log[NLOG])
- sii_logp = sii_log;
-#endif
-
- regs->dstat = dstat; /* acknowledge everything */
-
- if (dstat & SII_CI) {
- /* deglitch cstat register */
- msg = regs->cstat;
- while (msg != (cstat = regs->cstat))
- msg = cstat;
- regs->cstat = cstat; /* acknowledge everything */
-#ifdef DEBUG
- if (sii_logp > sii_log)
- sii_logp[-1].cstat = cstat;
- else
- sii_log[NLOG - 1].cstat = cstat;
-#endif
-
- /* check for a BUS RESET */
- if (cstat & SII_RST) {
- printf("%s: SCSI bus reset\n", sc->sc_dev.dv_xname);
- /* need to flush disconnected commands */
- for (i = 0; i < SII_NCMD; i++) {
- if (sc->sc_xs[i] == NULL)
- continue;
- sii_CmdDone(sc, i, XS_DRIVER_STUFFUP /* EIO */);
- }
- /* rearbitrate synchronous offset */
- for (i = 0; i < SII_NCMD; i++)
- sc->sc_st[i].dmaReqAck = 0;
- sc->sc_target = -1;
- return;
- }
-
-#ifdef notdef
- /*
- * Check for a BUS ERROR.
- * According to DEC, this feature doesn't really work
- * and to just clear the bit if it's set.
- */
- if (cstat & SII_BER) {
- regs->cstat = SII_BER;
- }
-#endif
-
- /* check for state change */
- if (cstat & SII_SCH) {
- sii_StateChg(sc, cstat);
- comm = regs->comm;
- }
- }
-
- /* check for DMA completion */
- if (dstat & SII_DNE) {
- u_int dma;
- char *buf;
-
- /*
- * There is a race condition with SII_SCH. There is a short
- * window between the time a SII_SCH is seen after a disconnect
- * and when the SII_SCH is cleared. A reselect can happen
- * in this window and we will clear the SII_SCH without
- * processing the reconnect.
- */
- if (sc->sc_target < 0) {
- cstat = regs->cstat;
- printf("%s: DNE?? dev %d,%d cs %x\n",
- sc->sc_dev.dv_xname,
- regs->slcsr, regs->destat,
- cstat); /* XXX */
- if (cstat & SII_DST) {
- sc->sc_target = regs->destat;
- state = &sc->sc_st[sc->sc_target];
- state->prevComm = 0;
- } else
- panic("sc_target 1");
- }
- state = &sc->sc_st[sc->sc_target];
- /* check for a PARITY ERROR */
- if (dstat & SII_IPE) {
- state->flags |= PENDING_CMD;
- state->nextCmd = MSG_PARITY_ERROR;
- printf("%s: Parity error\n", sc->sc_dev.dv_xname);
- goto abort;
- }
- /* dmalen = amount left to transfer, i = amount transferred */
- i = state->dmalen;
- state->dmalen = 0;
- state->dmaCurPhase = -1;
-#ifdef DEBUG
- if (sii_debug > 4) {
- printf("DNE: amt %d ", i);
- if (!(dstat & SII_TCZ))
- printf("no TCZ?? (%d) ", regs->dmlotc);
- } else if (!(dstat & SII_TCZ)) {
- printf("%s: device %d: no TCZ?? (%d)\n",
- sc->sc_dev.dv_xname, sc->sc_target, regs->dmlotc);
- sii_DumpLog(); /* XXX */
- }
-#endif
- switch (comm & SII_PHASE_MSK) {
- case SII_CMD_PHASE:
- state->cmdlen -= i;
- break;
-
- case SII_DATA_IN_PHASE:
- /* check for more data for the same phase */
- dma = state->dmaAddr[state->dmaBufIndex];
- buf = state->buf;
- state->buf += i;
- state->buflen -= i;
- if (state->buflen > 0 && !(dstat & SII_MIS)) {
- int len;
-
- /* start reading next chunk */
- len = state->buflen;
- if (len > SII_MAX_DMA_XFER_LENGTH)
- len = SII_MAX_DMA_XFER_LENGTH;
- state->dmaBufIndex = !state->dmaBufIndex;
- sii_StartDMA(regs,
- state->dmaCurPhase = SII_DATA_IN_PHASE,
- state->dmaAddr[state->dmaBufIndex],
- state->dmaCnt = state->dmalen = len);
- dstat &= ~(SII_IBF | SII_TBE);
- }
- /* copy in the data */
- sc->sii_copyfrombuf(sc, dma, buf, i);
- break;
-
- case SII_DATA_OUT_PHASE:
- state->dmaBufIndex = !state->dmaBufIndex;
- state->buf += i;
- state->buflen -= i;
-
- /* check for more data for the same phase */
- if (state->buflen <= 0 || (dstat & SII_MIS))
- break;
-
- /* start next chunk */
- i = state->buflen;
- if (i > SII_MAX_DMA_XFER_LENGTH) {
- sii_StartDMA(regs, state->dmaCurPhase =
- SII_DATA_OUT_PHASE,
- state->dmaAddr[state->dmaBufIndex],
- state->dmaCnt = state->dmalen =
- SII_MAX_DMA_XFER_LENGTH);
- /* prepare for next chunk */
- i -= SII_MAX_DMA_XFER_LENGTH;
- if (i > SII_MAX_DMA_XFER_LENGTH)
- i = SII_MAX_DMA_XFER_LENGTH;
- sc->sii_copytobuf(sc, (u_char *)(state->buf +
- SII_MAX_DMA_XFER_LENGTH),
- state->dmaAddr[!state->dmaBufIndex], i);
- } else {
- sii_StartDMA(regs, state->dmaCurPhase =
- SII_DATA_OUT_PHASE,
- state->dmaAddr[state->dmaBufIndex],
- state->dmaCnt = state->dmalen = i);
- }
- dstat &= ~(SII_IBF | SII_TBE);
- }
- }
-
- /* check for phase change or another MsgIn/Out */
- if (dstat & (SII_MIS | SII_IBF | SII_TBE)) {
- /*
- * There is a race condition with SII_SCH. There is a short
- * window between the time a SII_SCH is seen after a disconnect
- * and when the SII_SCH is cleared. A reselect can happen
- * in this window and we will clear the SII_SCH without
- * processing the reconnect.
- */
- if (sc->sc_target < 0) {
- cstat = regs->cstat;
- printf("%s: target %d MIS?? dev %d,%d cs %x ds %x\n",
- sc->sc_dev.dv_xname, sc->sc_target,
- regs->slcsr, regs->destat,
- cstat, dstat); /* XXX */
- if (cstat & SII_DST) {
- sc->sc_target = regs->destat;
- state = &sc->sc_st[sc->sc_target];
- state->prevComm = 0;
- } else {
-#ifdef DEBUG
- sii_DumpLog();
-#endif
- panic("sc_target 2");
- }
- }
- state = &sc->sc_st[sc->sc_target];
- switch (dstat & SII_PHASE_MSK) {
- case SII_CMD_PHASE:
- if (state->dmaPrevPhase >= 0) {
- /* restart DMA after disconnect/reconnect */
- if (state->dmaPrevPhase != SII_CMD_PHASE) {
- printf("%s: device %d: DMA reselect phase doesn't match\n",
- sc->sc_dev.dv_xname, sc->sc_target);
- goto abort;
- }
- state->dmaCurPhase = SII_CMD_PHASE;
- state->dmaPrevPhase = -1;
- regs->dmaddrl = state->dmaAddrL;
- regs->dmaddrh = state->dmaAddrH;
- regs->dmlotc = state->dmaCnt;
- if (state->dmaCnt & 1)
- regs->dmabyte = state->dmaByte;
- regs->comm = SII_DMA | SII_INXFER |
- (comm & SII_STATE_MSK) | SII_CMD_PHASE;
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("Cmd dcnt %d dadr %x ",
- state->dmaCnt,
- (state->dmaAddrH << 16) |
- state->dmaAddrL);
-#endif
- } else {
- /* send command data */
- i = state->cmdlen;
- if (i == 0) {
- printf("%s: device %d: cmd count exceeded\n",
- sc->sc_dev.dv_xname, sc->sc_target);
- goto abort;
- }
- sc->sii_copytobuf(sc, state->cmd,
- state->dmaAddr[0], i);
- sii_StartDMA(regs, state->dmaCurPhase =
- SII_CMD_PHASE, state->dmaAddr[0],
- state->dmaCnt = state->dmalen = i);
- }
- /* wait a short time for XFER complete */
- SII_WAIT_UNTIL(dstat, regs->dstat,
- dstat & (SII_CI | SII_DI), SII_WAIT_COUNT, i);
- if (dstat & (SII_CI | SII_DI)) {
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("cnt %d\n", i);
- else if (sii_debug > 0)
- printf("sii_DoIntr: cmd wait ds %x cnt %d\n",
- dstat, i);
-#endif
- goto again;
- }
- break;
-
- case SII_DATA_IN_PHASE:
- case SII_DATA_OUT_PHASE:
- if (state->cmdlen > 0) {
- printf("%s: device %d: cmd 0x%x: command data not all sent (%d) 1\n",
- sc->sc_dev.dv_xname, sc->sc_target,
- sc->sc_xs[sc->sc_target]->cmd->opcode,
- state->cmdlen);
- state->cmdlen = 0;
-#ifdef DEBUG
- sii_DumpLog();
-#endif
- }
- if (state->dmaPrevPhase >= 0) {
- /* restart DMA after disconnect/reconnect */
- if (state->dmaPrevPhase !=
- (dstat & SII_PHASE_MSK)) {
- printf("%s: device %d: DMA reselect phase doesn't match\n",
- sc->sc_dev.dv_xname, sc->sc_target);
- goto abort;
- }
- state->dmaCurPhase = state->dmaPrevPhase;
- state->dmaPrevPhase = -1;
- regs->dmaddrl = state->dmaAddrL;
- regs->dmaddrh = state->dmaAddrH;
- regs->dmlotc = state->dmaCnt;
- if (state->dmaCnt & 1)
- regs->dmabyte = state->dmaByte;
- regs->comm = SII_DMA | SII_INXFER |
- (comm & SII_STATE_MSK) |
- state->dmaCurPhase;
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("Data %d dcnt %d dadr %x ",
- state->dmaDataPhase,
- state->dmaCnt,
- (state->dmaAddrH << 16) |
- state->dmaAddrL);
-#endif
- break;
- }
-#ifdef DEBUG
- if (sii_debug > 4) {
- printf("Data %d ", state->dmaDataPhase);
- if (sii_debug > 5)
- printf("\n");
- }
-#endif
- i = state->buflen;
- if (i == 0) {
- printf("%s: device %d: data count exceeded\n",
- sc->sc_dev.dv_xname, sc->sc_target);
- goto abort;
- }
- if (i > SII_MAX_DMA_XFER_LENGTH)
- i = SII_MAX_DMA_XFER_LENGTH;
- if ((dstat & SII_PHASE_MSK) == SII_DATA_IN_PHASE) {
- sii_StartDMA(regs,
- state->dmaCurPhase = SII_DATA_IN_PHASE,
- state->dmaAddr[state->dmaBufIndex],
- state->dmaCnt = state->dmalen = i);
- break;
- }
- /* start first chunk */
- if (state->flags & FIRST_DMA) {
- state->flags &= ~FIRST_DMA;
- sc->sii_copytobuf(sc, (u_char *)state->buf,
- state->dmaAddr[state->dmaBufIndex], i);
- }
- sii_StartDMA(regs,
- state->dmaCurPhase = SII_DATA_OUT_PHASE,
- state->dmaAddr[state->dmaBufIndex],
- state->dmaCnt = state->dmalen = i);
- i = state->buflen - SII_MAX_DMA_XFER_LENGTH;
- if (i > 0) {
- /* prepare for next chunk */
- if (i > SII_MAX_DMA_XFER_LENGTH)
- i = SII_MAX_DMA_XFER_LENGTH;
- sc->sii_copytobuf(sc, (u_char *)(state->buf +
- SII_MAX_DMA_XFER_LENGTH),
- state->dmaAddr[!state->dmaBufIndex], i);
- }
- break;
-
- case SII_STATUS_PHASE:
- if (state->cmdlen > 0) {
- printf("%s: device %d: cmd 0x%x: command data not all sent (%d) 2\n",
- sc->sc_dev.dv_xname, sc->sc_target,
- sc->sc_xs[sc->sc_target]->cmd->opcode,
- state->cmdlen);
- state->cmdlen = 0;
-#ifdef DEBUG
- sii_DumpLog();
-#endif
- }
-
- /* read amount transferred if DMA didn't finish */
- if (state->dmalen > 0) {
- i = state->dmalen - regs->dmlotc;
- state->dmalen = 0;
- state->dmaCurPhase = -1;
- regs->dmlotc = 0;
- regs->comm = comm &
- (SII_STATE_MSK | SII_PHASE_MSK);
- regs->dstat = SII_DNE;
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("DMA amt %d ", i);
-#endif
- switch (comm & SII_PHASE_MSK) {
- case SII_DATA_IN_PHASE:
- /* copy in the data */
- sc->sii_copyfrombuf(sc,
- state->dmaAddr[state->dmaBufIndex],
- state->buf, i);
-
- case SII_CMD_PHASE:
- case SII_DATA_OUT_PHASE:
- state->buflen -= i;
- }
- }
-
- /* read a one byte status message */
- state->statusByte = msg =
- sii_GetByte(regs, SII_STATUS_PHASE, 1);
- if (msg < 0) {
- dstat = regs->dstat;
- goto again;
- }
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("Status %x ", msg);
- if (sii_logp > sii_log)
- sii_logp[-1].msg = msg;
- else
- sii_log[NLOG - 1].msg = msg;
-#endif
-
- /* do a quick wait for COMMAND_COMPLETE */
- SII_WAIT_UNTIL(dstat, regs->dstat,
- dstat & (SII_CI | SII_DI), SII_WAIT_COUNT, i);
- if (dstat & (SII_CI | SII_DI)) {
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("cnt2 %d\n", i);
-#endif
- goto again;
- }
- break;
-
- case SII_MSG_IN_PHASE:
- /*
- * Save DMA state if DMA didn't finish.
- * Be careful not to save state again after reconnect
- * and see RESTORE_POINTER message.
- * Note that the SII DMA address is not incremented
- * as DMA proceeds.
- */
- if (state->dmaCurPhase >= 0) {
- /* save DMA registers */
- state->dmaPrevPhase = state->dmaCurPhase;
- state->dmaCurPhase = -1;
- if (dstat & SII_OBB)
- state->dmaByte = regs->dmabyte;
- i = regs->dmlotc;
- if (i != 0)
- i = state->dmaCnt - i;
- /* note: no carry from dmaddrl to dmaddrh */
- state->dmaAddrL = regs->dmaddrl + i;
- state->dmaAddrH = regs->dmaddrh;
- state->dmaCnt = regs->dmlotc;
- if (state->dmaCnt == 0)
- state->dmaCnt = SII_MAX_DMA_XFER_LENGTH;
- regs->comm = comm &
- (SII_STATE_MSK | SII_PHASE_MSK);
- regs->dstat = SII_DNE;
-#ifdef DEBUG
- if (sii_debug > 4) {
- printf("SavP dcnt %d dadr %x ",
- state->dmaCnt,
- (state->dmaAddrH << 16) |
- state->dmaAddrL);
- if (((dstat & SII_OBB) != 0) ^
- (state->dmaCnt & 1))
- printf("OBB??? ");
- } else if (sii_debug > 0) {
- if (((dstat & SII_OBB) != 0) ^
- (state->dmaCnt & 1)) {
- printf("sii_DoIntr: OBB??? ds %x cnt %d\n",
- dstat, state->dmaCnt);
- sii_DumpLog();
- }
- }
-#endif
- }
-
- /* read a one byte message */
- msg = sii_GetByte(regs, SII_MSG_IN_PHASE, 0);
- if (msg < 0) {
- dstat = regs->dstat;
- goto again;
- }
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("MsgIn %x ", msg);
- if (sii_logp > sii_log)
- sii_logp[-1].msg = msg;
- else
- sii_log[NLOG - 1].msg = msg;
-#endif
-
- /* process message */
- switch (msg) {
- case MSG_CMDCOMPLETE:
- /* acknowledge last byte */
- regs->comm = SII_INXFER | SII_MSG_IN_PHASE |
- (comm & SII_STATE_MSK);
- SII_WAIT_UNTIL(dstat, regs->dstat,
- dstat & SII_DNE, SII_WAIT_COUNT, i);
- regs->dstat = SII_DNE;
- msg = sc->sc_target;
- sc->sc_target = -1;
- /*
- * Wait a short time for disconnect.
- * Don't be fooled if SII_BER happens first.
- * Note: a reselect may happen here.
- */
- SII_WAIT_UNTIL(cstat, regs->cstat,
- cstat & (SII_RST | SII_SCH),
- SII_WAIT_COUNT, i);
- if ((cstat & (SII_RST | SII_SCH |
- SII_STATE_MSK)) == SII_SCH) {
- regs->cstat = SII_SCH | SII_BER;
- regs->comm = 0;
- /*
- * Double check that we didn't miss a
- * state change between seeing it and
- * clearing the SII_SCH bit.
- */
- i = regs->cstat;
- if (!(i & SII_SCH) &&
- (i & SII_STATE_MSK) !=
- (cstat & SII_STATE_MSK))
- sii_StateChg(sc, i);
- }
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("cs %x\n", cstat);
-#endif
- sii_CmdDone(sc, msg, XS_NOERROR);
- break;
-
- case MSG_EXTENDED:
- /* acknowledge last byte */
- regs->comm = SII_INXFER | SII_MSG_IN_PHASE |
- (comm & SII_STATE_MSK);
- SII_WAIT_UNTIL(dstat, regs->dstat,
- dstat & SII_DNE, SII_WAIT_COUNT, i);
- regs->dstat = SII_DNE;
- /* read the message length */
- msg = sii_GetByte(regs, SII_MSG_IN_PHASE, 1);
- if (msg < 0) {
- dstat = regs->dstat;
- goto again;
- }
- sc->sc_buf[1] = msg; /* message length */
- if (msg == 0)
- msg = 256;
- /*
- * We read and acknowledge all the bytes
- * except the last so we can assert ATN
- * if needed before acknowledging the last.
- */
- for (i = 0; i < msg; i++) {
- dstat = sii_GetByte(regs,
- SII_MSG_IN_PHASE, i < msg - 1);
- if ((int)dstat < 0) {
- dstat = regs->dstat;
- goto again;
- }
- sc->sc_buf[i + 2] = dstat;
- }
-
- switch (sc->sc_buf[2]) {
- case MSG_EXT_MODIFY_DATA_PTR:
- /* acknowledge last byte */
- regs->comm = SII_INXFER |
- SII_MSG_IN_PHASE |
- (comm & SII_STATE_MSK);
- SII_WAIT_UNTIL(dstat, regs->dstat,
- dstat & SII_DNE,
- SII_WAIT_COUNT, i);
- regs->dstat = SII_DNE;
- i = (sc->sc_buf[3] << 24) |
- (sc->sc_buf[4] << 16) |
- (sc->sc_buf[5] << 8) |
- sc->sc_buf[6];
- if (state->dmaPrevPhase >= 0) {
- state->dmaAddrL += i;
- state->dmaCnt -= i;
- }
- break;
-
- case MSG_EXT_SDTR_LEN:
- /*
- * Acknowledge last byte and
- * signal a request for MSG_OUT.
- */
- regs->comm = SII_INXFER | SII_ATN |
- SII_MSG_IN_PHASE |
- (comm & SII_STATE_MSK);
- SII_WAIT_UNTIL(dstat, regs->dstat,
- dstat & SII_DNE,
- SII_WAIT_COUNT, i);
- regs->dstat = SII_DNE;
- sii_DoSync(sc, state);
- break;
-
- default:
- reject:
- /*
- * Acknowledge last byte and
- * signal a request for MSG_OUT.
- */
- regs->comm = SII_INXFER | SII_ATN |
- SII_MSG_IN_PHASE |
- (comm & SII_STATE_MSK);
- SII_WAIT_UNTIL(dstat, regs->dstat,
- dstat & SII_DNE,
- SII_WAIT_COUNT, i);
- regs->dstat = SII_DNE;
-
- /* wait for MSG_OUT phase */
- SII_WAIT_UNTIL(dstat, regs->dstat,
- dstat & SII_TBE,
- SII_WAIT_COUNT, i);
-
- /* send a reject message */
- sii_msgout(regs, regs->cstat,
- MSG_MESSAGE_REJECT);
- regs->dstat = SII_DNE;
- }
- break;
-
- case MSG_SAVEDATAPOINTER:
- case MSG_RESTOREPOINTERS:
- /* acknowledge last byte */
- regs->comm = SII_INXFER | SII_MSG_IN_PHASE |
- (comm & SII_STATE_MSK);
- SII_WAIT_UNTIL(dstat, regs->dstat,
- dstat & SII_DNE, SII_WAIT_COUNT, i);
- regs->dstat = SII_DNE;
- /* wait a short time for another msg */
- SII_WAIT_UNTIL(dstat, regs->dstat,
- dstat & (SII_CI | SII_DI),
- SII_WAIT_COUNT, i);
- if (dstat & (SII_CI | SII_DI)) {
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("cnt %d\n", i);
-#endif
- goto again;
- }
- break;
-
- case MSG_DISCONNECT:
- /* acknowledge last byte */
- regs->comm = SII_INXFER | SII_MSG_IN_PHASE |
- (comm & SII_STATE_MSK);
- SII_WAIT_UNTIL(dstat, regs->dstat,
- dstat & SII_DNE, SII_WAIT_COUNT, i);
- regs->dstat = SII_DNE;
- state->prevComm = comm;
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("disconn %d ", sc->sc_target);
-#endif
- /*
- * Wait a short time for disconnect.
- * Don't be fooled if SII_BER happens first.
- * Note: a reselect may happen here.
- */
- SII_WAIT_UNTIL(cstat, regs->cstat,
- cstat & (SII_RST | SII_SCH),
- SII_WAIT_COUNT, i);
- if ((cstat & (SII_RST | SII_SCH |
- SII_STATE_MSK)) != SII_SCH) {
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("cnt %d\n", i);
-#endif
- dstat = regs->dstat;
- goto again;
- }
- regs->cstat = SII_SCH | SII_BER;
- regs->comm = 0;
- sc->sc_target = -1;
- /*
- * Double check that we didn't miss a state
- * change between seeing it and clearing
- * the SII_SCH bit.
- */
- i = regs->cstat;
- if (!(i & SII_SCH) && (i & SII_STATE_MSK) !=
- (cstat & SII_STATE_MSK))
- sii_StateChg(sc, i);
- break;
-
- case MSG_MESSAGE_REJECT:
- /* acknowledge last byte */
- regs->comm = SII_INXFER | SII_MSG_IN_PHASE |
- (comm & SII_STATE_MSK);
- SII_WAIT_UNTIL(dstat, regs->dstat,
- dstat & SII_DNE, SII_WAIT_COUNT, i);
- regs->dstat = SII_DNE;
- printf("%s: device %d: message reject.\n",
- sc->sc_dev.dv_xname, sc->sc_target);
- break;
-
- default:
- if (!(msg & MSG_IDENTIFYFLAG)) {
- printf("%s: device %d: couldn't handle "
- "message 0x%x... rejecting.\n",
- sc->sc_dev.dv_xname, sc->sc_target,
- msg);
-#ifdef DEBUG
- sii_DumpLog();
-#endif
- goto reject;
- }
- /* acknowledge last byte */
- regs->comm = SII_INXFER | SII_MSG_IN_PHASE |
- (comm & SII_STATE_MSK);
- SII_WAIT_UNTIL(dstat, regs->dstat,
- dstat & SII_DNE, SII_WAIT_COUNT, i);
- regs->dstat = SII_DNE;
- /* may want to check LUN some day */
- /* wait a short time for another msg */
- SII_WAIT_UNTIL(dstat, regs->dstat,
- dstat & (SII_CI | SII_DI),
- SII_WAIT_COUNT, i);
- if (dstat & (SII_CI | SII_DI)) {
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("cnt %d\n", i);
-#endif
- goto again;
- }
- }
- break;
-
- case SII_MSG_OUT_PHASE:
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("MsgOut %x\n", state->flags); /* XXX */
-#endif
-
- /*
- * Check for parity error.
- * Hardware will automatically set ATN
- * to request the device for a MSG_OUT phase.
- */
- if (state->flags & PENDING_CMD) {
- state->flags &= ~PENDING_CMD;
- dstat = sii_msgout(regs, comm, state->nextCmd);
- } else
- dstat = sii_msgout(regs, comm, MSG_NOOP);
-
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("ds %x i %d\n", dstat, i);
-#endif
- /* just clear the DNE bit and check errors later */
- if (dstat & SII_DNE) {
- regs->dstat = SII_DNE;
- }
- break;
-
- default:
- printf("%s: Couldn't handle phase %d... ignoring.\n",
- sc->sc_dev.dv_xname, dstat & SII_PHASE_MSK);
- }
- }
-
-#ifdef DEBUG
- if (sii_debug > 3)
- printf("\n");
-#endif
- /*
- * Check to make sure we won't be interrupted again.
- * Deglitch dstat register.
- */
- msg = regs->dstat;
- while (msg != (dstat = regs->dstat))
- msg = dstat;
- if (dstat & (SII_CI | SII_DI))
- goto again;
-
- if (sc->sc_target < 0)
- sii_schedule(sc);
- return;
-
-abort:
-#ifdef DEBUG
- /* jump here to abort the current command */
- printf("%s: device %d: current command terminated\n",
- sc->sc_dev.dv_xname, sc->sc_target);
-
- sii_DumpLog();
-#endif
-
- if ((cstat = regs->cstat) & SII_CON) {
- /* try to send an abort msg for awhile */
- regs->dstat = SII_DNE;
- regs->data = MSG_ABORT;
- regs->comm = SII_INXFER | SII_ATN | (cstat & SII_STATE_MSK) |
- SII_MSG_OUT_PHASE;
- SII_WAIT_UNTIL(dstat, regs->dstat,
- (dstat & (SII_DNE | SII_PHASE_MSK)) ==
- (SII_DNE | SII_MSG_OUT_PHASE), 2 * SII_WAIT_COUNT, i);
-#ifdef DEBUG
- if (sii_debug > 0)
- printf("Abort: cs %x ds %x i %d\n", cstat, dstat, i);
-#endif
- if ((dstat & (SII_DNE | SII_PHASE_MSK)) ==
- (SII_DNE | SII_MSG_OUT_PHASE)) {
- /* disconnect if command in progress */
- regs->comm = SII_DISCON;
- SII_WAIT_UNTIL(cstat, regs->cstat,
- !(cstat & SII_CON), SII_WAIT_COUNT, i);
- }
- } else {
-#ifdef DEBUG
- if (sii_debug > 0)
- printf("Abort: cs %x\n", cstat);
-#endif
- }
- regs->cstat = 0xffff;
- regs->dstat = 0xffff;
- regs->comm = 0;
-
- i = sc->sc_target;
- sc->sc_target = -1;
-
- /* XXX xs might have been get taken care of already */
- if (sc->sc_xs[i] != NULL)
- sii_CmdDone(sc, i, XS_DRIVER_STUFFUP /* EIO */);
- else
- sii_schedule(sc);
-
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("sii_DoIntr: after CmdDone target %d\n", sc->sc_target);
-#endif
-}
-
-void
-sii_StateChg(sc, cstat)
- struct sii_softc *sc;
- u_int cstat;
-{
- SIIRegs *regs = sc->sc_regs;
- State *state;
- int i;
-
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("SCH: ");
-#endif
-
- switch (cstat & SII_STATE_MSK) {
- case 0:
- /* disconnect */
- i = sc->sc_target;
- sc->sc_target = -1;
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("disconn %d ", i);
-#endif
- if (i >= 0 && !sc->sc_st[i].prevComm) {
- printf("%s: device %d: spurrious disconnect (%d)\n",
- sc->sc_dev.dv_xname, i, regs->slcsr);
- sc->sc_st[i].prevComm = 0;
- }
- break;
-
- case SII_CON:
- /* connected as initiator */
- i = regs->slcsr;
- if (sc->sc_target == i)
- break;
- printf("%s: device %d: connect to device %d??\n",
- sc->sc_dev.dv_xname, sc->sc_target, i);
- sc->sc_target = i;
- break;
-
- case SII_DST:
- /*
- * Wait for CON to become valid,
- * chip is slow sometimes.
- */
- SII_WAIT_UNTIL(cstat, regs->cstat,
- cstat & SII_CON, SII_WAIT_COUNT, i);
- if (!(cstat & SII_CON))
- panic("sii resel");
- /* FALLTHROUGH */
-
- case SII_CON | SII_DST:
- /*
- * Its a reselection. Save the ID and wait for
- * interrupts to tell us what to do next
- * (should be MSG_IN of IDENTIFY).
- * NOTE: sc_target may be >= 0 if we were in
- * the process of trying to start a command
- * and were reselected before the select
- * command finished.
- */
- sc->sc_target = i = regs->destat;
- state = &sc->sc_st[i];
- regs->comm = SII_CON | SII_DST | SII_MSG_IN_PHASE;
- regs->dmctrl = state->dmaReqAck;
- if (!state->prevComm) {
- printf("%s: device %d: spurious reselection\n",
- sc->sc_dev.dv_xname, i);
- break;
- }
- state->prevComm = 0;
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("resel %d ", sc->sc_target);
-#endif
- break;
-
-#ifdef notyet
- case SII_DST | SII_TGT:
- case SII_CON | SII_DST | SII_TGT:
- /* connected as target */
- printf("%s: Selected by device %d as target!!\n",
- sc->sc_dev.dv_xname, regs->destat);
- regs->comm = SII_DISCON;
- SII_WAIT_UNTIL(!(regs->cstat & SII_CON),
- SII_WAIT_COUNT, i);
- regs->cstat = 0xffff;
- regs->dstat = 0xffff;
- regs->comm = 0;
- break;
-#endif
-
- default:
- printf("%s: Unknown state change (cs %x)!!\n",
- sc->sc_dev.dv_xname, cstat);
-#ifdef DEBUG
- sii_DumpLog();
-#endif
- }
-}
-
-/*
- * Read one byte of data.
- * If 'ack' is true, acknowledge the byte.
- */
-int
-sii_GetByte(regs, phase, ack)
- SIIRegs *regs;
- int phase, ack;
-{
- u_int dstat;
- u_int state;
- int i;
- int data;
-
- dstat = regs->dstat;
- state = regs->cstat & SII_STATE_MSK;
- i = -1;
- if (!(dstat & SII_IBF) || (dstat & SII_MIS)) {
- regs->comm = state | phase;
- /* wait a short time for IBF */
- SII_WAIT_UNTIL(dstat, regs->dstat, dstat & SII_IBF,
- SII_WAIT_COUNT, i);
-#ifdef DEBUG
- if (!(dstat & SII_IBF))
- printf("status no IBF\n");
-#endif
- }
- if (dstat & SII_DNE) { /* XXX */
- printf("sii_GetByte: DNE set 5\n");
-#ifdef DEBUG
- sii_DumpLog();
-#endif
- regs->dstat = SII_DNE;
- }
- data = regs->data;
- /* check for parity error */
- if (dstat & SII_IPE) {
-#ifdef DEBUG
- if (sii_debug > 4)
- printf("cnt0 %d\n", i);
-#endif
- printf("sii_GetByte: data %x ?? ds %x cm %x i %d\n",
- data, dstat, regs->comm, i); /* XXX */
- data = -1;
- ack = 1;
- }
-
- if (ack) {
- regs->comm = SII_INXFER | state | phase;
-
- /* wait a short time for XFER complete */
- SII_WAIT_UNTIL(dstat, regs->dstat, dstat & SII_DNE,
- SII_WAIT_COUNT, i);
-
- /* clear the DNE */
- if (dstat & SII_DNE) {
- regs->dstat = SII_DNE;
- }
- }
-
- return (data);
-}
-
-/*
- * Exchange messages to initiate synchronous data transfers.
- */
-void
-sii_DoSync(sc, state)
- struct sii_softc *sc;
- State *state;
-{
- SIIRegs *regs = sc->sc_regs;
- u_int dstat, comm;
- int i, j;
- u_int len;
-
-#ifdef DEBUG
- if (sii_debug > 0)
- printf("sii_DoSync: len %d per %d req/ack %d\n",
- sc->sc_buf[1], sc->sc_buf[3], sc->sc_buf[4]);
-#endif
-
- /* SII chip can only handle a minimum transfer period of ??? */
- if (sc->sc_buf[3] < 64)
- sc->sc_buf[3] = 64;
- /* SII chip can only handle a maximum REQ/ACK offset of 3 */
- len = sc->sc_buf[4];
- if (len > 3)
- len = 3;
-
- sc->sc_buf[0] = MSG_EXTENDED;
- sc->sc_buf[1] = MSG_EXT_SDTR_LEN;
- sc->sc_buf[2] = MSG_EXT_SDTR;
- sc->sc_buf[4] = len;
-#if 1
- comm = SII_INXFER | SII_ATN | SII_MSG_OUT_PHASE |
- (regs->cstat & SII_STATE_MSK);
- regs->comm = comm & ~SII_INXFER;
- for (j = 0; j < 5; j++) {
- /* wait for target to request the next byte */
- SII_WAIT_UNTIL(dstat, regs->dstat, dstat & SII_TBE,
- SII_WAIT_COUNT, i);
- if (!(dstat & SII_TBE) ||
- (dstat & SII_PHASE_MSK) != SII_MSG_OUT_PHASE) {
- printf("sii_DoSync: TBE? ds %x cm %x i %d\n",
- dstat, comm, i); /* XXX */
- return;
- }
-
- /* the last message byte should have ATN off */
- if (j == 4)
- comm &= ~SII_ATN;
-
- regs->data = sc->sc_buf[j];
- regs->comm = comm;
-
- /* wait a short time for XFER complete */
- SII_WAIT_UNTIL(dstat, regs->dstat, dstat & SII_DNE,
- SII_WAIT_COUNT, i);
-
- if (!(dstat & SII_DNE)) {
- printf("sii_DoSync: DNE? ds %x cm %x i %d\n",
- dstat, comm, i); /* XXX */
- return;
- }
-
- /* clear the DNE, other errors handled later */
- regs->dstat = SII_DNE;
- }
-#else /* 0 */
- sc->sii_copytobuf(sc, sc->sc_buf, SII_BUF_ADDR(sc), 5);
- printf("sii_DoSync: %x %x %x ds %x\n",
- ((u_short *)sc->sc_buf)[0], ((u_short *)sc->sc_buf)[1],
- ((u_short *)sc->sc_buf)[2], regs->dstat); /* XXX */
- regs->dmaddrl = SII_BUF_ADDR(sc);
- regs->dmaddrh = SII_BUF_ADDR(sc) >> 16;
- regs->dmlotc = 5;
- regs->comm = SII_DMA | SII_INXFER | SII_ATN |
- (regs->cstat & SII_STATE_MSK) | SII_MSG_OUT_PHASE;
-
- /* wait a short time for XFER complete */
- SII_WAIT_UNTIL(dstat, regs->dstat,
- (dstat & (SII_DNE | SII_TCZ)) == (SII_DNE | SII_TCZ),
- SII_WAIT_COUNT, i);
-
- if ((dstat & (SII_DNE | SII_TCZ)) != (SII_DNE | SII_TCZ)) {
- printf("sii_DoSync: ds %x cm %x i %d lotc %d\n",
- dstat, regs->comm, i, regs->dmlotc); /* XXX */
- sii_DumpLog(); /* XXX */
- return;
- }
- /* clear the DNE, other errors handled later */
- regs->dstat = SII_DNE;
-#endif /* 0 */
-
-#if 0
- SII_WAIT_UNTIL(dstat, regs->dstat, dstat & (SII_CI | SII_DI),
- SII_WAIT_COUNT, i);
- printf("sii_DoSync: ds %x cm %x i %d lotc %d\n",
- dstat, regs->comm, i, regs->dmlotc); /* XXX */
-#endif
-
- state->dmaReqAck = len;
-}
-
-/*
- * Issue the sequence of commands to the controller to start DMA.
- * NOTE: the data buffer should be word-aligned for DMA out.
- */
-void
-sii_StartDMA(regs, phase, dmaAddr, size)
- SIIRegs *regs; /* which SII to use */
- int phase; /* phase to send/receive data */
- u_int dmaAddr; /* DMA buffer offset */
- int size; /* # of bytes to transfer */
-{
-
- if (regs->dstat & SII_DNE) { /* XXX */
- regs->dstat = SII_DNE;
- printf("sii_StartDMA: DNE set\n");
-#ifdef DEBUG
- sii_DumpLog();
-#endif
- }
- regs->dmaddrl = dmaAddr;
- regs->dmaddrh = dmaAddr >> 16;
- regs->dmlotc = size;
- regs->comm = SII_DMA | SII_INXFER | (regs->cstat & SII_STATE_MSK) |
- phase;
-
-#ifdef DEBUG
- if (sii_debug > 5) {
- printf("sii_StartDMA: cs 0x%x, ds 0x%x, cm 0x%x, size %d\n",
- regs->cstat, regs->dstat, regs->comm, size);
- }
-#endif
-}
-
-/*
- * Call the device driver's 'done' routine to let it know the command is done.
- * The 'done' routine may try to start another command.
- * To be fair, we should start pending commands for other devices
- * before allowing the same device to start another command.
- */
-void
-sii_CmdDone(sc, target, error)
- struct sii_softc *sc; /* which SII to use */
- int target; /* which device is done */
- int error; /* error code if any errors */
-{
- struct scsi_xfer *xs;
-
- splassert(IPL_BIO);
-
- xs = sc->sc_xs[target];
-#ifdef DIAGNOSTIC
- if (target < 0 || xs == NULL)
- panic("sii_CmdDone");
-#endif
- sc->sc_xs[target] = NULL;
-#ifdef DEBUG
- if (sii_debug > 1) {
- printf("sii_CmdDone: %s target %d cmd 0x%x err %d resid %d\n",
- sc->sc_dev.dv_xname,
- target, xs->cmd->opcode, error,
- sc->sc_st[target].buflen);
- }
-#endif
-
- sii_schedule(sc);
-
- xs->status = sc->sc_st[target].statusByte;
- xs->error = error;
- xs->resid = sc->sc_st[target].buflen;
- scsi_done(xs);
-}
-
-/* Send a particular message */
-u_int
-sii_msgout(SIIRegs *regs, u_int state, u_int8_t cmd)
-{
- int i;
- u_int dstat;
-
- regs->data = cmd;
- regs->comm = SII_INXFER | (state & SII_STATE_MSK) | SII_MSG_OUT_PHASE;
-
- SII_WAIT_UNTIL(dstat, regs->dstat, dstat & SII_DNE, SII_WAIT_COUNT, i);
-
- return dstat;
-}
-
-void
-sii_schedule(struct sii_softc *sc)
-{
- unsigned int i;
-
- /* look for another device that is ready */
- for (i = 0; i < SII_NCMD; i++) {
- /* don't restart a disconnected command */
- if (sc->sc_xs[i] == NULL || sc->sc_st[i].prevComm)
- continue;
- sii_StartCmd(sc, i);
- break;
- }
-}
-
-#ifdef DEBUG
-void
-sii_DumpLog()
-{
- struct sii_log *lp;
-
- printf("sii: cmd 0x%x bn %d cnt %d\n", sii_debug_cmd, sii_debug_bn,
- sii_debug_sz);
- lp = sii_logp;
- do {
- printf("target %d cs %x ds %x cm %x msg %x rlen %x dlen %x\n",
- lp->target, lp->cstat, lp->dstat, lp->comm, lp->msg,
- lp->rlen, lp->dlen);
- if (++lp >= &sii_log[NLOG])
- lp = sii_log;
- } while (lp != sii_logp);
-}
-#endif
diff --git a/sys/arch/vax/dec/siireg.h b/sys/arch/vax/dec/siireg.h
deleted file mode 100644
index c83f0df9e37..00000000000
--- a/sys/arch/vax/dec/siireg.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/* $OpenBSD: siireg.h,v 1.1 2008/08/18 23:19:22 miod Exp $ */
-/* $NetBSD: siireg.h,v 1.2 2006/07/29 19:10:57 ad Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- *
- * @(#)siireg.h 8.1 (Berkeley) 6/10/93
- *
- * sii.h --
- *
- * SII registers.
- *
- * Copyright (C) 1989 Digital Equipment Corporation.
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appears in all copies.
- * Digital Equipment Corporation makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * from: Header: /sprite/src/kernel/dev/ds3100.md/RCS/sii.h,
- * v 1.2 89/08/15 19:53:04 rab Exp SPRITE (DECWRL)
- */
-
-#ifndef _SII
-#define _SII
-
-/*
- * SII hardware registers
- */
-typedef volatile struct {
- u_short sdb; /* SCSI Data Bus and Parity */
- u_short pad0;
- u_short sc1; /* SCSI Control Signals One */
- u_short pad1;
- u_short sc2; /* SCSI Control Signals Two */
- u_short pad2;
- u_short csr; /* Control/Status register */
- u_short pad3;
- u_short id; /* Bus ID register */
- u_short pad4;
- u_short slcsr; /* Select Control and Status Register */
- u_short pad5;
- u_short destat; /* Selection Detector Status Register */
- u_short pad6;
- u_short dstmo; /* DSSI Timeout Register */
- u_short pad7;
- u_short data; /* Data Register */
- u_short pad8;
- u_short dmctrl; /* DMA Control Register */
- u_short pad9;
- u_short dmlotc; /* DMA Length of Transfer Counter */
- u_short pad10;
- u_short dmaddrl; /* DMA Address Register Low */
- u_short pad11;
- u_short dmaddrh; /* DMA Address Register High */
- u_short pad12;
- u_short dmabyte; /* DMA Initial Byte Register */
- u_short pad13;
- u_short stlp; /* DSSI Short Target List Pointer */
- u_short pad14;
- u_short ltlp; /* DSSI Long Target List Pointer */
- u_short pad15;
- u_short ilp; /* DSSI Initiator List Pointer */
- u_short pad16;
- u_short dsctrl; /* DSSI Control Register */
- u_short pad17;
- u_short cstat; /* Connection Status Register */
- u_short pad18;
- u_short dstat; /* Data Transfer Status Register */
- u_short pad19;
- u_short comm; /* Command Register */
- u_short pad20;
- u_short dictrl; /* Diagnostic Control Register */
- u_short pad21;
- u_short clock; /* Diagnostic Clock Register */
- u_short pad22;
- u_short bhdiag; /* Bus Handler Diagnostic Register */
- u_short pad23;
- u_short sidiag; /* SCSI IO Diagnostic Register */
- u_short pad24;
- u_short dmdiag; /* Data Mover Diagnostic Register */
- u_short pad25;
- u_short mcdiag; /* Main Control Diagnostic Register */
- u_short pad26;
-} SIIRegs;
-
-/*
- * SC1 - SCSI Control Signals One
- */
-#define SII_SC1_MSK 0x1ff /* All possible signals on the bus */
-#define SII_SC1_SEL 0x80 /* SCSI SEL signal active on bus */
-#define SII_SC1_ATN 0x08 /* SCSI ATN signal active on bus */
-
-/*
- * SC2 - SCSI Control Signals Two
- */
-#define SII_SC2_IGS 0x8 /* SCSI drivers for initiator mode */
-
-/*
- * CSR - Control/Status Register
- */
-#define SII_HPM 0x10 /* SII in on an arbitrated SCSI bus */
-#define SII_RSE 0x08 /* 1 = respond to reselections */
-#define SII_SLE 0x04 /* 1 = respond to selections */
-#define SII_PCE 0x02 /* 1 = report parity errors */
-#define SII_IE 0x01 /* 1 = enable interrupts */
-
-/*
- * ID - Bus ID Register
- */
-#define SII_ID_IO 0x8000 /* I/O */
-
-/*
- * DESTAT - Selection Detector Status Register
- */
-#define SII_IDMSK 0x7 /* ID of target reselected the SII */
-
-/*
- * DMCTRL - DMA Control Register
- */
-#define SII_ASYNC 0x00 /* REQ/ACK Offset for async mode */
-#define SII_SYNC 0x03 /* REQ/ACK Offset for sync mode */
-
-/*
- * DMLOTC - DMA Length Of Transfer Counter
- */
-#define SII_TCMSK 0x1fff /* transfer count mask */
-
-/*
- * CSTAT - Connection Status Register
- */
-#define SII_CI 0x8000 /* composite interrupt bit for CSTAT */
-#define SII_DI 0x4000 /* composite interrupt bit for DSTAT */
-#define SII_RST 0x2000 /* 1 if reset is asserted on SCSI bus */
-#define SII_BER 0x1000 /* Bus error */
-#define SII_OBC 0x0800 /* Out_en Bit Cleared (DSSI mode) */
-#define SII_TZ 0x0400 /* Target pointer Zero (STLP or LTLP is zero) */
-#define SII_BUF 0x0200 /* Buffer service - outbound pkt to non-DSSI */
-#define SII_LDN 0x0100 /* List element Done */
-#define SII_SCH 0x0080 /* State Change */
-#define SII_CON 0x0040 /* SII is Connected to another device */
-#define SII_DST 0x0020 /* SII was Destination of current transfer */
-#define SII_TGT 0x0010 /* SII is operating as a Target */
-#define SII_STATE_MSK 0x0070 /* State Mask */
-#define SII_SWA 0x0008 /* Selected With Attention */
-#define SII_SIP 0x0004 /* Selection In Progress */
-#define SII_LST 0x0002 /* Lost arbitration */
-
-/*
- * DSTAT - Data Transfer Status Register
- */
-#define SII_DNE 0x2000 /* DMA transfer Done */
-#define SII_TCZ 0x1000 /* Transfer Count register is Zero */
-#define SII_TBE 0x0800 /* Transmit Buffer Empty */
-#define SII_IBF 0x0400 /* Input Buffer Full */
-#define SII_IPE 0x0200 /* Incoming Parity Error */
-#define SII_OBB 0x0100 /* Odd Byte Boundry */
-#define SII_MIS 0x0010 /* Phase Mismatch */
-#define SII_ATN 0x0008 /* ATN set by initiator if in Target mode */
-#define SII_MSG 0x0004 /* current bus state of MSG */
-#define SII_CD 0x0002 /* current bus state of C/D */
-#define SII_IO 0x0001 /* current bus state of I/O */
-#define SII_PHASE_MSK 0x0007 /* Phase Mask */
-
-/*
- * The different phases.
- */
-#define SII_MSG_IN_PHASE 0x7
-#define SII_MSG_OUT_PHASE 0x6
-#define SII_STATUS_PHASE 0x3
-#define SII_CMD_PHASE 0x2
-#define SII_DATA_IN_PHASE 0x1
-#define SII_DATA_OUT_PHASE 0x0
-
-/*
- * COMM - Command Register
- */
-#define SII_DMA 0x8000 /* DMA mode */
-#define SII_DO_RST 0x4000 /* Assert reset on SCSI bus for 25 usecs */
-#define SII_RSL 0x1000 /* 0 = select, 1 = reselect desired device */
-
-/* Commands: I - Initiator, T - Target, D - Disconnected */
-#define SII_INXFER 0x0800 /* Information Transfer command (I,T) */
-#define SII_SELECT 0x0400 /* Select command (D) */
-#define SII_REQDATA 0x0200 /* Request Data command (T) */
-#define SII_DISCON 0x0100 /* Disconnect command (I,T,D) */
-#define SII_CHRESET 0x0080 /* Chip Reset command (I,T,D) */
-
-/* Command state bits same as connection status register */
-/* Command phase bits same as data transfer status register */
-
-/*
- * DICTRL - Diagnostic Control Register
- */
-#define SII_PRE 0x4 /* Enable the SII to drive the SCSI bus */
-
-#define SII_WAIT_COUNT 10000 /* Delay count used for the SII chip */
-/*
- * Max DMA transfer length for SII
- * The SII chip only has a 13 bit counter. If 8192 is used as the max count,
- * you can't tell the difference between a count of zero and 8192.
- * 8190 is used instead of 8191 so the count is even.
- */
-#define SII_MAX_DMA_XFER_LENGTH 8192
-
-#endif /* _SII */
diff --git a/sys/arch/vax/dec/siivar.h b/sys/arch/vax/dec/siivar.h
deleted file mode 100644
index 8e54894b05a..00000000000
--- a/sys/arch/vax/dec/siivar.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $OpenBSD: siivar.h,v 1.3 2008/08/30 20:13:03 miod Exp $ */
-/* $NetBSD: siivar.h,v 1.6 2000/06/02 20:16:51 mhitch Exp $ */
-
-#ifndef _SIIVAR_H
-#define _SIIVAR_H
-
-typedef struct scsi_state {
- int statusByte; /* status byte returned during STATUS_PHASE */
- int dmaDataPhase; /* which data phase to expect */
- int dmaCurPhase; /* SCSI phase if DMA is in progress */
- int dmaPrevPhase; /* SCSI phase of DMA suspended by disconnect */
- u_int dmaAddr[2]; /* DMA buffer memory offsets */
- int dmaBufIndex; /* which of the above is currently in use */
- int dmalen; /* amount to transfer in this chunk */
- int cmdlen; /* total remaining amount of cmd to transfer */
- u_char *cmd; /* current pointer within scsicmd->cmd */
- int buflen; /* total remaining amount of data to transfer */
- char *buf; /* current pointer within scsicmd->buf */
- u_short flags; /* see below */
- u_int8_t nextCmd; /* next command to send if PENDING_CMD set */
- u_short prevComm; /* command reg before disconnect */
- u_short dmaCtrl; /* DMA control register if disconnect */
- u_short dmaAddrL; /* DMA address register if disconnect */
- u_short dmaAddrH; /* DMA address register if disconnect */
- u_short dmaCnt; /* DMA count if disconnect */
- u_short dmaByte; /* DMA byte if disconnect on odd boundary */
- u_short dmaReqAck; /* DMA synchronous xfer offset or 0 if async */
-} State;
-
-/* state flags */
-#define FIRST_DMA 0x01 /* true if no data DMA started yet */
-#define PENDING_CMD 0x02 /* need to send a particular command */
-
-#define SII_NCMD 8
-struct sii_softc {
- struct device sc_dev; /* us as a device */
- struct scsi_link sc_link; /* scsi link struct */
- SIIRegs *sc_regs; /* HW address of SII controller chip */
- int sc_flags;
- int sc_target; /* target SCSI ID if connected */
- int sc_hostid;
- void (*sii_copytobuf)(void *, u_char *, u_int, int);
- void (*sii_copyfrombuf)(void *, u_int, u_char *, int);
-
- struct scsi_xfer *sc_xs[SII_NCMD]; /* currently executing requests */
- State sc_st[SII_NCMD]; /* state info for each active command */
-
- u_char sc_buf[258]; /* used for extended messages */
-};
-
-/* Machine-independent back-end attach entry point */
-void sii_attach(struct sii_softc *sc);
-int sii_intr(void *sc);
-
-#endif /* _SIIVAR_H */
diff --git a/sys/arch/vax/dec/vsms_ws.c b/sys/arch/vax/dec/vsms_ws.c
deleted file mode 100644
index 1147175bcc5..00000000000
--- a/sys/arch/vax/dec/vsms_ws.c
+++ /dev/null
@@ -1,390 +0,0 @@
-/* $OpenBSD: vsms_ws.c,v 1.4 2008/08/26 19:46:23 miod Exp $ */
-/* $NetBSD: dzms.c,v 1.1 2000/12/02 17:03:55 ragge Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * 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, Lawrence Berkeley Laboratory.
- *
- * 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.
- *
- * @(#)ms.c 8.1 (Berkeley) 6/11/93
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/syslog.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-
-#include <machine/bus.h>
-
-#include <vax/qbus/dzreg.h>
-#include <vax/qbus/dzvar.h>
-
-#include <vax/dec/dzkbdvar.h>
-#include <vax/dec/vsmsvar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsmousevar.h>
-
-int lkms_handle_error(struct lkms_softc *, int);
-void lkms_input_disabled(struct lkms_softc *, int);
-void lkms_input_mouse(struct lkms_softc *, int);
-void lkms_input_tablet(struct lkms_softc *, int);
-
-#define WSMS_BUTTON(x) (1 << ((x) - 1))
-
-struct cfdriver lkms_cd = {
- NULL, "lkms", DV_DULL
-};
-
-/*
- * Report the device type and status on attachment, and return nonzero
- * if it is not in working state.
- */
-int
-lkms_handle_error(struct lkms_softc *sc, int mask)
-{
- int error = sc->sc_error;
-
-#ifdef DEBUG
- printf("%s: ", sc->dzms_dev.dv_xname);
-#endif
-
- if (ISSET(sc->sc_flags, MS_TABLET)) {
-#ifdef DEBUG
- printf("tablet, ");
-#endif
- /*
- * If we are a tablet, the stylet vs puck information
- * is returned as a non-fatal status code. Handle
- * it there so that this does not get in the way.
- */
- switch (error) {
- case ERROR_TABLET_NO_POINTER:
- /* i can has cheezpuck? */
-#ifdef DEBUG
- printf("neither stylus nor puck connected\n");
-#else
- printf("%s: neither stylus nor puck connected\n",
- sc->dzms_dev.dv_xname);
-#endif
- error = ERROR_OK;
- break;
- case ERROR_TABLET_STYLUS:
-#ifdef DEBUG
- printf("stylus\n");
-#endif
- SET(sc->sc_flags, MS_STYLUS);
- error = ERROR_OK;
- break;
- default:
-#ifdef DEBUG
- printf("puck\n");
-#endif
- break;
- }
- } else {
-#ifdef DEBUG
- printf("mouse\n");
-#endif
- }
-
- switch (error) {
- case ERROR_MEMORY_CKSUM_ERROR:
- printf("%s: memory checksum error\n",
- sc->dzms_dev.dv_xname);
- break;
- case ERROR_BUTTON_ERROR:
- {
- int btn;
-
- /*
- * Print the list of defective parts
- */
- if (ISSET(sc->sc_flags, MS_TABLET)) {
- if ((mask & FRAME_T_PR) != 0)
- printf("%s: proximity sensor defective\n",
- sc->dzms_dev.dv_xname);
- } else
- mask <<= 1;
-
- for (btn = 1; btn < 4; btn++)
- if ((mask & (1 << btn)) != 0)
- printf("%s: button %d held down or defective\n",
- sc->dzms_dev.dv_xname, btn);
- }
- break;
- case ERROR_TABLET_LINK:
- /* how vague this error is... */
- printf("%s: analog or digital error\n",
- sc->dzms_dev.dv_xname);
- break;
- default:
- printf("%s: %sselftest error %02x\n", sc->dzms_dev.dv_xname,
- error >= ERROR_FATAL ? "fatal " : "", error);
- break;
- case ERROR_OK:
- break;
- }
-
- if (error >= ERROR_FATAL)
- return ENXIO;
-
- return 0;
-}
-
-int
-lkms_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- struct lkms_softc *sc = v;
- struct wsmouse_calibcoords *wsmc = (struct wsmouse_calibcoords *)data;
-
- switch (cmd) {
- case WSMOUSEIO_GTYPE:
- *(int *)data = WSMOUSE_TYPE_VSXXX;
- return 0;
-
- case WSMOUSEIO_GCALIBCOORDS:
- if (ISSET(sc->sc_flags, MS_TABLET)) {
- /*
- * The tablet has a usable size of 11 inch on each
- * axis, with a 200dpi resolution.
- */
- wsmc->minx = 0;
- wsmc->maxx = 200 * 11;
- wsmc->miny = 0;
- wsmc->maxy = 200 * 11;
- wsmc->swapxy = 0;
- wsmc->resx = wsmc->maxx; /* anything better? */
- wsmc->resy = wsmc->maxy; /* anything better? */
- wsmc->samplelen = 0;
- return 0;
- } else
- break;
- }
-
- return -1;
-}
-
-int
-lkms_input(void *vsc, int data)
-{
- struct lkms_softc *sc = vsc;
-
- if ((data & FRAME_MASK) != 0) {
- sc->sc_frametype = data & FRAME_TYPE_MASK;
- sc->sc_framepos = 0;
- } else
- sc->sc_framepos++;
-
- if (ISSET(sc->sc_flags, MS_ENABLED) &&
- !ISSET(sc->sc_flags, MS_SELFTEST)) {
- switch (sc->sc_frametype) {
- case FRAME_MOUSE:
- lkms_input_mouse(sc, data);
- break;
- case FRAME_TABLET:
- lkms_input_tablet(sc, data);
- break;
- }
- } else
- lkms_input_disabled(sc, data);
-
- return 1;
-}
-
-/*
- * Input processing while the device is disabled. We only are
- * interested in processing self test frames, so as to identify
- * the device and report its state.
- */
-void
-lkms_input_disabled(struct lkms_softc *sc, int data)
-{
- if (!ISSET(sc->sc_flags, MS_SELFTEST))
- return;
-
- if (sc->sc_frametype == FRAME_SELFTEST) {
- switch (sc->sc_framepos) {
- case 0:
- break;
- case 1:
- data &= FRAME_ST_DEVICE_MASK;
- if (data == FRAME_ST_DEVICE_TABLET)
- SET(sc->sc_flags, MS_TABLET);
- else if (data != FRAME_ST_DEVICE_MOUSE) {
- printf("%s: unrecognized device type %02x\n",
- sc->dzms_dev.dv_xname, data);
- goto fail;
- }
- break;
- case 2:
- sc->sc_error = data;
- break;
- case 3:
- if (lkms_handle_error(sc, data) != 0)
- goto fail;
-
- CLR(sc->sc_flags, MS_SELFTEST);
- goto success;
- break;
- }
-
- return;
- } /* else goto fail; */
-
-fail:
- /*
- * Our self test frame has been truncated, or we have received
- * incorrect data (both could be a cable problem), or the
- * selftest reported an error. The device is unusable.
- */
- CLR(sc->sc_flags, MS_TABLET | MS_STYLUS);
-
-success:
- sc->sc_frametype = 0;
- wakeup(&sc->sc_flags);
-}
-
-/*
- * Input processing while the device is enabled, for mouse frames.
- */
-void
-lkms_input_mouse(struct lkms_softc *sc, int data)
-{
- switch (sc->sc_framepos) {
- case 0:
- sc->buttons = 0;
- /* button order is inverted from wscons */
- if ((data & FRAME_MS_B3) != 0)
- sc->buttons |= WSMS_BUTTON(1);
- if ((data & FRAME_MS_B2) != 0)
- sc->buttons |= WSMS_BUTTON(2);
- if ((data & FRAME_MS_B1) != 0)
- sc->buttons |= WSMS_BUTTON(3);
-
- sc->dx = data & FRAME_MS_X_SIGN;
- sc->dy = data & FRAME_MS_Y_SIGN;
- break;
- case 1:
- if (sc->dx == 0)
- sc->dx = -data;
- else
- sc->dx = data;
- break;
- case 2:
- if (sc->dy == 0)
- sc->dy = -data;
- else
- sc->dy = data;
- wsmouse_input(sc->sc_wsmousedev, sc->buttons,
- sc->dx, sc->dy, 0, 0, WSMOUSE_INPUT_DELTA);
-
- sc->sc_frametype = 0;
- break;
- }
-}
-
-/*
- * Input processing while the device is enabled, for tablet frames.
- */
-void
-lkms_input_tablet(struct lkms_softc *sc, int data)
-{
- switch (sc->sc_framepos) {
- case 0:
- /*
- * Button information will depend on the type of positional
- * device:
- * - puck buttons get reported as is, as a 4 button mouse.
- * Button order is opposite from mouse.
- * - stylus barrel gets reported as left button, while tip
- * gets reported as right button.
- * Proximity sensor gets reported as a fictitious fifth
- * button.
- */
- sc->buttons = 0;
- if ((data & FRAME_T_B1) != 0)
- sc->buttons |= WSMS_BUTTON(1);
- if ((data & FRAME_T_B2) != 0) {
- if (ISSET(sc->sc_flags, MS_STYLUS))
- sc->buttons |= WSMS_BUTTON(3);
- else
- sc->buttons |= WSMS_BUTTON(2);
- }
- if ((data & FRAME_T_B3) != 0)
- sc->buttons |= WSMS_BUTTON(3);
- if ((data & FRAME_T_B4) != 0)
- sc->buttons |= WSMS_BUTTON(4);
- if ((data & FRAME_T_PR) == 0)
- sc->buttons |= WSMS_BUTTON(5);
- break;
- case 1:
- sc->dx = data & 0x3f;
- break;
- case 2:
- sc->dx |= (data & 0x3f) << 6;
- break;
- case 3:
- sc->dy = data & 0x3f;
- break;
- case 4:
- sc->dy |= (data & 0x3f) << 6;
- wsmouse_input(sc->sc_wsmousedev, sc->buttons,
- sc->dx, sc->dy, 0, 0,
- WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y);
-
- sc->sc_frametype = 0;
- break;
- }
-}
diff --git a/sys/arch/vax/dec/vsmsvar.h b/sys/arch/vax/dec/vsmsvar.h
deleted file mode 100644
index 1b998e02633..00000000000
--- a/sys/arch/vax/dec/vsmsvar.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $OpenBSD: vsmsvar.h,v 1.2 2008/08/22 21:05:07 miod Exp $ */
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * 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, Lawrence Berkeley Laboratory.
- *
- * 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.
- *
- * @(#)ms.c 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * Command characters
- */
-#define VS_B9600 'B' /* T only: switch to 9600 bps */
-#define VS_REQUEST_POINT 'D' /* stop incremental position reports */
-#define VS_FREQ_55 'K' /* T only: 55Hz report rate */
-#define VS_FREQ_72 'L' /* T only: 72Hz report rate */
-#define VS_FREQ_120 'M' /* T only: 120Hz report rate, 9600bps */
-#define VS_REQUEST_POSITION 'P' /* request position (in point mode) */
-#define VS_INCREMENTAL 'R' /* incremental position reports */
-#define VS_SELF_TEST 'T' /* reset and self test */
-
-/*
- * Data frame types
- */
-
-#define FRAME_MASK 0x80
-#define FRAME_TYPE_MASK 0xe0
-#define FRAME_MOUSE 0x80 /* 1 0 0 - mouse 3 byte packet */
-#define FRAME_SELFTEST 0xa0 /* 1 0 1 - selftest 4 byte packet */
-#define FRAME_TABLET 0xc0 /* 1 1 0 - tablet 5 byte packet */
-
-/*
- * Selftest frame layout
- * byte 0: frame type and device revision
- * byte 1: manufacturing location code and device type
- * byte 2: self test result
- * byte 3: button mask (if result == button error)
- */
-
-/* byte 0 */
-#define FRAME_ST_REV_MASK 0x0f /* device revision */
-
-/* byte 1 */
-#define FRAME_ST_LOCATION_MASK 0x70
-#define FRAME_ST_DEVICE_MASK 0x0f
-#define FRAME_ST_DEVICE_MOUSE 0x02
-#define FRAME_ST_DEVICE_TABLET 0x04
-
-/* status test error codes */
-#define ERROR_OK 0x00
-#define ERROR_TABLET_STYLUS 0x11 /* stylus only, no puck */
-#define ERROR_TABLET_NO_POINTER 0x13 /* neither stylus nor puck */
-#define ERROR_FATAL 0x20 /* fatal errors from here */
-#define ERROR_TABLET_LINK 0x3a /* tablet internal error */
-#define ERROR_BUTTON_ERROR 0x3d /* button malfunction */
-#define ERROR_MEMORY_CKSUM_ERROR 0x3e /* firmware malfunction */
-
-/*
- * Mouse frame layout
- * byte 0: frame type, delta signs, button mask
- * byte 1: unsigned X delta
- * byte 2: unsigned Y delta
- */
-#define FRAME_MS_X_SIGN 0x10 /* set if positive */
-#define FRAME_MS_Y_SIGN 0x08 /* set if positive */
-#define FRAME_MS_B3 0x04 /* left button */
-#define FRAME_MS_B2 0x02 /* middle button */
-#define FRAME_MS_B1 0x01 /* right button */
-
-/*
- * Tablet frame layout
- * byte 0: frame type, button and proximity sensor mask
- * byte 1: low 6 bits of absolute X position
- * byte 2: high 6 bits of absolute X position
- * byte 3: low 6 bits of absolute Y position
- * byte 4: high 6 bits of absolute Y position
- */
-#define FRAME_T_B4 0x10 /* puck bottom button */
-#define FRAME_T_B3 0x08 /* puck right button */
-#define FRAME_T_B2 0x04 /* puck top / stylus tip */
-#define FRAME_T_B1 0x02 /* puck left / stylus barrel */
-#define FRAME_T_PR 0x01 /* stylus proximity (if zero) */
-
-struct lkms_softc { /* driver status information */
- struct device dzms_dev; /* required first: base device */
-
- int sc_flags;
-#define MS_ENABLED 0x01 /* input enabled */
-#define MS_SELFTEST 0x02 /* selftest in progress */
-#define MS_TABLET 0x04 /* device is a tablet */
-#define MS_STYLUS 0x08 /* tablet has a stylus, not a puck */
-
- int sc_frametype; /* frame type being processed */
- u_int sc_framepos; /* position in the frame */
- int sc_error; /* selftest error result */
-
- u_int buttons;
- int dx, dy;
-
- struct device *sc_wsmousedev;
-};
-
-int lkms_ioctl(void *, u_long, caddr_t, int, struct proc *);
-int lkms_input(void *, int);
diff --git a/sys/arch/vax/dec/wskbdmap_lk201.c b/sys/arch/vax/dec/wskbdmap_lk201.c
deleted file mode 100644
index c3c0b666aa9..00000000000
--- a/sys/arch/vax/dec/wskbdmap_lk201.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/* $OpenBSD: wskbdmap_lk201.c,v 1.7 2006/11/27 16:10:41 miod Exp $ */
-/* $NetBSD: wskbdmap_lk201.c,v 1.4 2000/12/02 16:57:41 ragge Exp $ */
-
-#include <sys/types.h>
-#include <dev/wscons/wsksymdef.h>
-#include <dev/wscons/wsksymvar.h>
-#include <vax/dec/wskbdmap_lk201.h>
-
-#define KC(n) KS_KEYCODE((n) - MIN_LK201_KEY)
-
-static const keysym_t lkkbd_keydesc_us[] = {
-/* pos command normal shifted */
- KC(86), KS_Cmd_Screen0, KS_f1,
- KC(87), KS_Cmd_Screen1, KS_f2,
- KC(88), KS_Cmd_Screen2, KS_f3,
- KC(89), KS_Cmd_Screen3, KS_f4,
- KC(90), KS_Cmd_Screen4, KS_f5,
- KC(100), KS_Cmd_Screen5, KS_f6,
- KC(101), KS_Cmd_Screen6, KS_f7,
- KC(102), KS_Cmd_Screen7, KS_f8,
- KC(103), KS_Cmd_Screen8, KS_f9,
- KC(104), KS_Cmd_Screen9, KS_f10,
- KC(113), KS_Cmd_Debugger, KS_Escape, /* F11 */
- KC(114), KS_f12,
- KC(115), KS_f13,
- KC(116), KS_f14,
- KC(124), KS_Help,
- KC(125), KS_Cmd, KS_Execute,
- KC(128), KS_f17,
- KC(129), KS_f18,
- KC(130), KS_f19,
- KC(131), KS_f20,
- KC(138), KS_Find,
- KC(139), KS_Insert,
- KC(140), KS_KP_Delete,
- KC(141), KS_Select,
- KC(142), KS_Prior,
- KC(143), KS_Next,
- KC(146), KS_KP_0,
- KC(148), KS_KP_Decimal,
- KC(149), KS_KP_Enter,
- KC(150), KS_KP_1,
- KC(151), KS_KP_2,
- KC(152), KS_KP_3,
- KC(153), KS_KP_4,
- KC(154), KS_KP_5,
- KC(155), KS_KP_6,
- KC(156), KS_KP_Separator,
- KC(157), KS_KP_7,
- KC(158), KS_KP_8,
- KC(159), KS_KP_9,
- KC(160), KS_KP_Subtract,
- KC(161), KS_KP_F1,
- KC(162), KS_KP_F2,
- KC(163), KS_KP_F3,
- KC(164), KS_KP_F4,
- KC(167), KS_Left,
- KC(168), KS_Right,
- KC(169), KS_Down,
- KC(170), KS_Up,
- KC(171), KS_Shift_R, /* LK 401 */
- KC(172), KS_Cmd2, KS_Alt_L, /* LK 401 */
- KC(173), KS_Multi_key, /* right compose */ /* LK 401 */
- KC(174), KS_Shift_L,
- KC(175), KS_Cmd1, KS_Control_L,
- KC(176), KS_Caps_Lock,
- KC(177), KS_Multi_key, /* (left) compose */ /* LK 401 */
- KC(178), KS_Cmd2, KS_Alt_R, /* LK 401 */
- KC(188), KS_Delete,
- KC(189), KS_Return,
- KC(190), KS_Tab,
- KC(191), KS_grave, KS_asciitilde,
- KC(192), KS_1, KS_exclam,
- KC(193), KS_q,
- KC(194), KS_a,
- KC(195), KS_z,
- KC(197), KS_2, KS_at,
- KC(198), KS_w,
- KC(199), KS_s,
- KC(200), KS_x,
- KC(201), KS_less, KS_greater,
- KC(203), KS_3, KS_numbersign,
- KC(204), KS_e,
- KC(205), KS_d,
- KC(206), KS_c,
- KC(208), KS_4, KS_dollar,
- KC(209), KS_r,
- KC(210), KS_f,
- KC(211), KS_v,
- KC(212), KS_space,
- KC(214), KS_5, KS_percent,
- KC(215), KS_t,
- KC(216), KS_g,
- KC(217), KS_b,
- KC(219), KS_6, KS_asciicircum,
- KC(220), KS_y,
- KC(221), KS_h,
- KC(222), KS_n,
- KC(224), KS_7, KS_ampersand,
- KC(225), KS_u,
- KC(226), KS_j,
- KC(227), KS_m,
- KC(229), KS_8, KS_asterisk,
- KC(230), KS_i,
- KC(231), KS_k,
- KC(232), KS_comma, KS_less,
- KC(234), KS_9, KS_parenleft,
- KC(235), KS_o,
- KC(236), KS_l,
- KC(237), KS_period, KS_greater,
- KC(239), KS_0, KS_parenright,
- KC(240), KS_p,
- KC(242), KS_semicolon, KS_colon,
- KC(243), KS_slash, KS_question,
- KC(245), KS_equal, KS_plus,
- KC(246), KS_bracketright, KS_braceright,
- KC(247), KS_backslash, KS_bar,
- KC(249), KS_minus, KS_underscore,
- KC(250), KS_bracketleft, KS_braceleft,
- KC(251), KS_apostrophe, KS_quotedbl,
- /* remapped Compose key (177) for LK 201 */
- KC(252), KS_Cmd2, KS_Alt_L, KS_Multi_key
-};
-
-static const keysym_t lkkbd_keydesc_de[] = {
-/* pos command normal shifted XXXXXXX */
- KC(178), KS_Cmd2, KS_Mode_switch,
- KC(191), KS_dead_tilde, KS_dead_circumflex,
- KC(195), KS_y,
- KC(197), KS_2, KS_quotedbl,
- KC(203), KS_3, KS_section,
- KC(219), KS_6, KS_ampersand,
- KC(220), KS_z,
- KC(224), KS_7, KS_slash,
- KC(229), KS_8, KS_parenleft,
- KC(232), KS_comma, KS_semicolon,
- KC(234), KS_9, KS_parenright,
- KC(237), KS_period, KS_colon,
- KC(239), KS_0, KS_equal,
- KC(242), KS_odiaeresis, KS_Odiaeresis,
- KS_braceright, KS_braceleft,
- KC(243), KS_minus, KS_underscore,
- KC(245), KS_dead_acute, KS_dead_grave,
- KC(246), KS_plus, KS_asterisk,
- KC(247), KS_numbersign, KS_apostrophe,
- KC(249), KS_ssharp, KS_question, KS_bar,
- KC(250), KS_udiaeresis, KS_Udiaeresis,
- KS_at, KS_backslash,
- KC(251), KS_adiaeresis, KS_Adiaeresis,
- KS_bracketright,KS_bracketleft,
- /* remapped Compose key (177) for LK 201 */
- KC(252), KS_Cmd2, KS_Mode_switch, KS_Multi_key
-};
-
-static const keysym_t lkkbd_keydesc_de_nodead[] = {
-/* pos command normal shifted XXXXXXX */
- KC(191), KS_asciitilde, KS_asciicircum,
- KC(245), KS_apostrophe, KS_grave,
-};
-
-static const keysym_t lkkbd_keydesc_fr[] = {
- KC(178), KS_Cmd2, KS_Mode_switch,
- KC(192), KS_ampersand, KS_1,
- KC(193), KS_a,
- KC(194), KS_q,
- KC(195), KS_w,
- KC(197), KS_eacute, KS_2, KS_bar,
- KC(198), KS_z,
- KC(203), KS_quotedbl, KS_3,
- KC(208), KS_apostrophe, KS_4,
- KC(214), KS_parenleft, KS_5,
- KC(219), KS_section, KS_6, KS_bracketleft,
- KC(224), KS_egrave, KS_7, KS_bracketright,
- KC(227), KS_comma, KS_question,
- KC(229), KS_exclam, KS_8,
- KC(232), KS_semicolon, KS_period,
- KC(234), KS_ccedilla, KS_9, KS_braceleft,
- KC(237), KS_colon, KS_slash,
- KC(239), KS_agrave, KS_0, KS_braceright,
- KC(242), KS_m,
- KC(243), KS_equal, KS_plus,
- KC(245), KS_minus, KS_underscore,
- KC(246), KS_dollar, KS_asterisk,
- KC(247), KS_numbersign, KS_at,
- KC(249), KS_parenright, KS_degree,
- KC(250), KS_dead_circumflex, KS_dead_diaeresis,
- KC(251), KS_ugrave, KS_percent, KS_backslash,
- /* remapped Compose key (177) for LK 201 */
- KC(252), KS_Cmd2, KS_Mode_switch, KS_Multi_key
-};
-
-static const keysym_t lkkbd_keydesc_pt[] = {
- KC(191), KS_backslash, KS_bar,
- KC(219), KS_6, KS_quotedbl,
- KC(232), KS_comma, KS_semicolon,
- KC(237), KS_period, KS_colon,
- KC(242), KS_ccedilla,
- KC(247), KS_bracketleft, KS_braceleft,
- KC(250), KS_dead_acute, KS_dead_grave,
- KC(251), KS_dead_tilde, KS_dead_circumflex,
-};
-
-#define KBD_MAP(name, base, map) \
- { name, base, sizeof(map)/sizeof(keysym_t), map }
-
-const struct wscons_keydesc lkkbd_keydesctab[] = {
- KBD_MAP(KB_US, 0, lkkbd_keydesc_us),
- KBD_MAP(KB_DE, KB_US, lkkbd_keydesc_de),
- KBD_MAP(KB_DE | KB_NODEAD, KB_DE, lkkbd_keydesc_de_nodead),
- KBD_MAP(KB_FR, KB_US, lkkbd_keydesc_fr),
- KBD_MAP(KB_PT, KB_US, lkkbd_keydesc_pt),
- {0, 0, 0, 0}
-};
-
-#undef KBD_MAP
-#undef KC
diff --git a/sys/arch/vax/dec/wskbdmap_lk201.h b/sys/arch/vax/dec/wskbdmap_lk201.h
deleted file mode 100644
index aa1333cdefe..00000000000
--- a/sys/arch/vax/dec/wskbdmap_lk201.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* $OpenBSD: wskbdmap_lk201.h,v 1.2 2006/07/29 17:06:25 miod Exp $ */
-/* $NetBSD: wskbdmap_lk201.h,v 1.2 1998/09/17 19:59:30 drochner Exp $ */
-
-#define MIN_LK201_KEY 86
-#define MAX_LK201_KEY 251
-
-extern const struct wscons_keydesc lkkbd_keydesctab[];
diff --git a/sys/arch/vax/if/if_de.c b/sys/arch/vax/if/if_de.c
deleted file mode 100644
index f931b000983..00000000000
--- a/sys/arch/vax/if/if_de.c
+++ /dev/null
@@ -1,683 +0,0 @@
-/* $OpenBSD: if_de.c,v 1.35 2015/12/08 13:34:22 tedu Exp $ */
-/* $NetBSD: if_de.c,v 1.27 1997/04/19 15:02:29 ragge Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1989 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.
- *
- * @(#)if_de.c 7.12 (Berkeley) 12/16/90
- */
-
-/*
- * DEC DEUNA interface
- *
- * Lou Salkind
- * New York University
- *
- * TODO:
- * timeout routine (get statistics)
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/buf.h>
-#include <sys/protosw.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-
-#include <machine/pte.h>
-#include <machine/sid.h>
-
-#include <net/if.h>
-
-#include <netinet/in.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-
-#include <machine/cpu.h>
-#include <machine/mtpr.h>
-
-#include <vax/if/if_dereg.h>
-#include <vax/if/if_uba.h>
-#include <vax/uba/ubavar.h>
-
-#define NXMT 3 /* number of transmit buffers */
-#define NRCV 7 /* number of receive buffers (must be > 1) */
-
-int dedebug = 0;
-
-/*
- * Ethernet software status per interface.
- *
- * Each interface is referenced by a network interface structure,
- * ds_if, which the routing code uses to locate the interface.
- * This structure contains the output queue for the interface, its address, ...
- * We also have, for each interface, a UBA interface structure, which
- * contains information about the UNIBUS resources held by the interface:
- * map registers, buffered data paths, etc. Information is cached in this
- * structure for use by the if_uba.c routines in running the interface
- * efficiently.
- */
-struct de_softc {
- struct device ds_dev; /* Configuration common part */
- struct arpcom ds_ac; /* Ethernet common part */
- struct dedevice *ds_vaddr; /* Virtual address of this interface */
-#define ds_if ds_ac.ac_if /* network-visible interface */
- int ds_flags;
-#define DSF_RUNNING 2 /* board is enabled */
-#define DSF_SETADDR 4 /* physical address is changed */
- int ds_ubaddr; /* map info for incore structs */
- struct ifubinfo ds_deuba; /* unibus resource structure */
- struct ifrw ds_ifr[NRCV]; /* unibus receive maps */
- struct ifxmt ds_ifw[NXMT]; /* unibus xmt maps */
- /* the following structures are always mapped in */
- struct de_pcbb ds_pcbb; /* port control block */
- struct de_ring ds_xrent[NXMT]; /* transmit ring entries */
- struct de_ring ds_rrent[NRCV]; /* receive ring entries */
- struct de_udbbuf ds_udbbuf; /* UNIBUS data buffer */
- /* end mapped area */
-#define INCORE_BASE(p) ((char *)&(p)->ds_pcbb)
-#define RVAL_OFF(s,n) ((char *)&(s)->n - INCORE_BASE(s))
-#define LVAL_OFF(s,n) ((char *)(s)->n - INCORE_BASE(s))
-#define PCBB_OFFSET(s) RVAL_OFF(s,ds_pcbb)
-#define XRENT_OFFSET(s) LVAL_OFF(s,ds_xrent)
-#define RRENT_OFFSET(s) LVAL_OFF(s,ds_rrent)
-#define UDBBUF_OFFSET(s) RVAL_OFF(s,ds_udbbuf)
-#define INCORE_SIZE(s) RVAL_OFF(s, ds_xindex)
- int ds_xindex; /* UNA index into transmit chain */
- int ds_rindex; /* UNA index into receive chain */
- int ds_xfree; /* index for next transmit buffer */
- int ds_nxmit; /* # of transmits in progress */
-};
-
-int dematch(struct device *, void *, void *);
-void deattach(struct device *, struct device *, void *);
-int dewait(struct de_softc *, char *);
-void deinit(struct de_softc *);
-int deioctl(struct ifnet *, u_long, caddr_t);
-void dereset(int);
-void destart(struct ifnet *);
-void deread(struct de_softc *, struct ifrw *, int);
-void derecv(int);
-void de_setaddr(u_char *, struct de_softc *);
-void deintr(int);
-
-
-struct cfdriver de_cd = {
- NULL, "de", DV_IFNET
-};
-
-struct cfattach de_ca = {
- sizeof(struct de_softc), dematch, deattach
-};
-/*
- * Interface exists: make available by filling in network interface
- * record. System will initialize the interface when it is ready
- * to accept packets. We get the ethernet address here.
- */
-void
-deattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct uba_attach_args *ua = aux;
- struct de_softc *ds = (struct de_softc *)self;
- struct ifnet *ifp = &ds->ds_if;
- struct dedevice *addr;
- char *c;
- int csr1;
- u_int8_t myaddr[ETHER_ADDR_LEN];
-
- addr = (struct dedevice *)ua->ua_addr;
- ds->ds_vaddr = addr;
- bcopy(ds->ds_dev.dv_xname, ifp->if_xname, IFNAMSIZ);
- ifp->if_softc = ds;
- ifp->if_flags = IFF_BROADCAST;
-
- /*
- * What kind of a board is this?
- * The error bits 4-6 in pcsr1 are a device id as long as
- * the high byte is zero.
- */
- csr1 = addr->pcsr1;
- if (csr1 & 0xff60)
- c = "broken";
- else if (csr1 & 0x10)
- c = "delua";
- else
- c = "deuna";
-
- printf("\n%s: %s\n", ds->ds_dev.dv_xname, c);
- /*
- * Reset the board and temporarily map
- * the pcbb buffer onto the Unibus.
- */
- addr->pcsr0 = 0; /* reset INTE */
- DELAY(100);
- addr->pcsr0 = PCSR0_RSET;
- (void)dewait(ds, "reset");
-
- ds->ds_ubaddr = uballoc((void *)ds->ds_dev.dv_parent,
- (char *)&ds->ds_pcbb, sizeof (struct de_pcbb), 0);
- addr->pcsr2 = ds->ds_ubaddr & 0xffff;
- addr->pcsr3 = (ds->ds_ubaddr >> 16) & 0x3;
- addr->pclow = CMD_GETPCBB;
- (void)dewait(ds, "pcbb");
-
- ds->ds_pcbb.pcbb0 = FC_RDPHYAD;
- addr->pclow = CMD_GETCMD;
- (void)dewait(ds, "read addr ");
-
- ubarelse((void *)ds->ds_dev.dv_parent, &ds->ds_ubaddr);
- bcopy((caddr_t)&ds->ds_pcbb.pcbb2, myaddr, sizeof (myaddr));
- printf("%s: address %s\n", ds->ds_dev.dv_xname,
- ether_sprintf(myaddr));
- ifp->if_ioctl = deioctl;
- ifp->if_start = destart;
- ds->ds_deuba.iff_flags = UBA_CANTWAIT;
-#ifdef notdef
- /* CAN WE USE BDP's ??? */
- ds->ds_deuba.iff_flags |= UBA_NEEDBDP;
-#endif
- if_attach(ifp);
- ether_ifattach(ifp);
-}
-
-/*
- * Reset of interface after UNIBUS reset.
- */
-void
-dereset(unit)
- int unit;
-{
- struct de_softc *sc = de_cd.cd_devs[unit];
- volatile struct dedevice *addr = sc->ds_vaddr;
-
- printf(" de%d", unit);
- sc->ds_if.if_flags &= ~IFF_RUNNING;
- ifq_clr_oactive(&sc->ds_if.if_snd);
- sc->ds_flags &= ~DSF_RUNNING;
- addr->pcsr0 = PCSR0_RSET;
- (void)dewait(sc, "reset");
- deinit(sc);
-}
-
-/*
- * Initialization of interface; clear recorded pending
- * operations, and reinitialize UNIBUS usage.
- */
-void
-deinit(ds)
- struct de_softc *ds;
-{
- volatile struct dedevice *addr;
- struct ifnet *ifp = &ds->ds_if;
- struct ifrw *ifrw;
- struct ifxmt *ifxp;
- struct de_ring *rp;
- int s,incaddr;
-
- if (ds->ds_flags & DSF_RUNNING)
- return;
- if ((ifp->if_flags & IFF_RUNNING) == 0) {
- if (if_ubaminit(&ds->ds_deuba, (void *)ds->ds_dev.dv_parent,
- sizeof (struct ether_header), (int)vax_atop(ETHERMTU),
- ds->ds_ifr, NRCV, ds->ds_ifw, NXMT) == 0) {
- printf("%s: can't initialize\n", ds->ds_dev.dv_xname);
- ds->ds_if.if_flags &= ~IFF_UP;
- return;
- }
- ds->ds_ubaddr = uballoc((void *)ds->ds_dev.dv_parent,
- INCORE_BASE(ds), INCORE_SIZE(ds), 0);
- }
- addr = ds->ds_vaddr;
-
- /* set the pcbb block address */
- incaddr = ds->ds_ubaddr + PCBB_OFFSET(ds);
- addr->pcsr2 = incaddr & 0xffff;
- addr->pcsr3 = (incaddr >> 16) & 0x3;
- addr->pclow = 0; /* reset INTE */
- DELAY(500);
- addr->pclow = CMD_GETPCBB;
- (void)dewait(ds, "pcbb");
-
- /* set the transmit and receive ring header addresses */
- incaddr = ds->ds_ubaddr + UDBBUF_OFFSET(ds);
- ds->ds_pcbb.pcbb0 = FC_WTRING;
- ds->ds_pcbb.pcbb2 = incaddr & 0xffff;
- ds->ds_pcbb.pcbb4 = (incaddr >> 16) & 0x3;
-
- incaddr = ds->ds_ubaddr + XRENT_OFFSET(ds);
- ds->ds_udbbuf.b_tdrbl = incaddr & 0xffff;
- ds->ds_udbbuf.b_tdrbh = (incaddr >> 16) & 0x3;
- ds->ds_udbbuf.b_telen = sizeof (struct de_ring) / sizeof (short);
- ds->ds_udbbuf.b_trlen = NXMT;
- incaddr = ds->ds_ubaddr + RRENT_OFFSET(ds);
- ds->ds_udbbuf.b_rdrbl = incaddr & 0xffff;
- ds->ds_udbbuf.b_rdrbh = (incaddr >> 16) & 0x3;
- ds->ds_udbbuf.b_relen = sizeof (struct de_ring) / sizeof (short);
- ds->ds_udbbuf.b_rrlen = NRCV;
-
- addr->pclow = CMD_GETCMD;
- (void)dewait(ds, "wtring");
-
- /* initialize the mode - enable hardware padding */
- ds->ds_pcbb.pcbb0 = FC_WTMODE;
- /* let hardware do padding - set MTCH bit on broadcast */
- ds->ds_pcbb.pcbb2 = MOD_TPAD|MOD_HDX;
- addr->pclow = CMD_GETCMD;
- (void)dewait(ds, "wtmode");
-
- /* set up the receive and transmit ring entries */
- ifxp = &ds->ds_ifw[0];
- for (rp = &ds->ds_xrent[0]; rp < &ds->ds_xrent[NXMT]; rp++) {
- rp->r_segbl = ifxp->ifw_info & 0xffff;
- rp->r_segbh = (ifxp->ifw_info >> 16) & 0x3;
- rp->r_flags = 0;
- ifxp++;
- }
- ifrw = &ds->ds_ifr[0];
- for (rp = &ds->ds_rrent[0]; rp < &ds->ds_rrent[NRCV]; rp++) {
- rp->r_slen = sizeof (struct de_buf);
- rp->r_segbl = ifrw->ifrw_info & 0xffff;
- rp->r_segbh = (ifrw->ifrw_info >> 16) & 0x3;
- rp->r_flags = RFLG_OWN; /* hang receive */
- ifrw++;
- }
-
- /* start up the board (rah rah) */
- s = splnet();
- ds->ds_rindex = ds->ds_xindex = ds->ds_xfree = ds->ds_nxmit = 0;
- ds->ds_if.if_flags |= IFF_RUNNING;
- addr->pclow = PCSR0_INTE; /* avoid interlock */
- destart(&ds->ds_if); /* queue output packets */
- ds->ds_flags |= DSF_RUNNING; /* need before de_setaddr */
- if (ds->ds_flags & DSF_SETADDR)
- de_setaddr(ds->ds_ac.ac_enaddr, ds);
- addr->pclow = CMD_START | PCSR0_INTE;
- splx(s);
-}
-
-/*
- * Setup output on interface.
- * Get another datagram to send off of the interface queue,
- * and map it to the interface before starting the output.
- * Must be called from ipl >= our interrupt level.
- */
-void
-destart(ifp)
- struct ifnet *ifp;
-{
- int len;
- register struct de_softc *ds = ifp->if_softc;
- volatile struct dedevice *addr = ds->ds_vaddr;
- register struct de_ring *rp;
- struct mbuf *m;
- register int nxmit;
-
- /*
- * the following test is necessary, since
- * the code is not reentrant and we have
- * multiple transmission buffers.
- */
- if (ifq_is_oactive(&ds->ds_if.if_snd))
- return;
- for (nxmit = ds->ds_nxmit; nxmit < NXMT; nxmit++) {
- IFQ_DEQUEUE(&ds->ds_if.if_snd, m);
- if (m == NULL)
- break;
- rp = &ds->ds_xrent[ds->ds_xfree];
- if (rp->r_flags & XFLG_OWN)
- panic("deuna xmit in progress");
- len = if_ubaput(&ds->ds_deuba, &ds->ds_ifw[ds->ds_xfree], m);
- if (ds->ds_deuba.iff_flags & UBA_NEEDBDP) {
- struct uba_softc *uh = (void *)ds->ds_dev.dv_parent;
-
- if (uh->uh_ubapurge)
- (*uh->uh_ubapurge)
- (uh, ds->ds_ifw[ds->ds_xfree].ifw_bdp);
- }
- rp->r_slen = len;
- rp->r_tdrerr = 0;
- rp->r_flags = XFLG_STP|XFLG_ENP|XFLG_OWN;
-
- ds->ds_xfree++;
- if (ds->ds_xfree == NXMT)
- ds->ds_xfree = 0;
- }
- if (ds->ds_nxmit != nxmit) {
- ds->ds_nxmit = nxmit;
- if (ds->ds_flags & DSF_RUNNING)
- addr->pclow = PCSR0_INTE|CMD_PDMD;
- }
-}
-
-/*
- * Command done interrupt.
- */
-void
-deintr(unit)
- int unit;
-{
- volatile struct dedevice *addr;
- register struct de_softc *ds;
- register struct de_ring *rp;
- register struct ifxmt *ifxp;
- short csr0;
-
- ds = de_cd.cd_devs[unit];
- addr = ds->ds_vaddr;
-
-
- /* save flags right away - clear out interrupt bits */
- csr0 = addr->pcsr0;
- addr->pchigh = csr0 >> 8;
-
-
- ifq_set_oactive(&ds->ds_if.if_snd); /* prevent entering destart */
- /*
- * if receive, put receive buffer on mbuf
- * and hang the request again
- */
- derecv(unit);
-
- /*
- * Poll transmit ring and check status.
- * Be careful about loopback requests.
- * Then free buffer space and check for
- * more transmit requests.
- */
- for ( ; ds->ds_nxmit > 0; ds->ds_nxmit--) {
- rp = &ds->ds_xrent[ds->ds_xindex];
- if (rp->r_flags & XFLG_OWN)
- break;
- ds->ds_if.if_opackets++;
- ifxp = &ds->ds_ifw[ds->ds_xindex];
- /* check for unusual conditions */
- if (rp->r_flags & (XFLG_ERRS|XFLG_MTCH|XFLG_ONE|XFLG_MORE)) {
- if (rp->r_flags & XFLG_ERRS) {
- /* output error */
- ds->ds_if.if_oerrors++;
- if (dedebug) {
- printf("de%d: oerror, flags=%b ",
- unit, rp->r_flags, XFLG_BITS);
- printf("tdrerr=%b\n",
- rp->r_tdrerr, XERR_BITS);
- }
- } else if (rp->r_flags & XFLG_ONE) {
- /* one collision */
- ds->ds_if.if_collisions++;
- } else if (rp->r_flags & XFLG_MORE) {
- /* more than one collision */
- ds->ds_if.if_collisions += 2; /* guess */
- } else if (rp->r_flags & XFLG_MTCH) {
- /* received our own packet */
- deread(ds, &ifxp->ifrw,
- rp->r_slen - sizeof (struct ether_header));
- }
- }
- if (ifxp->ifw_xtofree) {
- m_freem(ifxp->ifw_xtofree);
- ifxp->ifw_xtofree = 0;
- }
- /* check if next transmit buffer also finished */
- ds->ds_xindex++;
- if (ds->ds_xindex == NXMT)
- ds->ds_xindex = 0;
- }
- ifq_clr_oactive(&ds->ds_if.if_snd);
- destart(&ds->ds_if);
-
- if (csr0 & PCSR0_RCBI) {
- if (dedebug)
- log(LOG_WARNING, "de%d: buffer unavailable\n", unit);
- addr->pclow = PCSR0_INTE|CMD_PDMD;
- }
-}
-
-/*
- * Ethernet interface receiver interface.
- * If input error just drop packet.
- * Otherwise purge input buffered data path and examine
- * packet to determine type. If can't determine length
- * from type, then have to drop packet. Othewise decapsulate
- * packet based on type and pass to type specific higher-level
- * input routine.
- */
-void
-derecv(unit)
- int unit;
-{
- register struct de_softc *ds = de_cd.cd_devs[unit];
- register struct de_ring *rp;
- int len;
-
- rp = &ds->ds_rrent[ds->ds_rindex];
- while ((rp->r_flags & RFLG_OWN) == 0) {
- if (ds->ds_deuba.iff_flags & UBA_NEEDBDP) {
- struct uba_softc *uh = (void *)ds->ds_dev.dv_parent;
-
- if (uh->uh_ubapurge)
- (*uh->uh_ubapurge)
- (uh,ds->ds_ifr[ds->ds_rindex].ifrw_bdp);
- }
- len = (rp->r_lenerr&RERR_MLEN) - sizeof (struct ether_header)
- - 4; /* don't forget checksum! */
- /* check for errors */
- if ((rp->r_flags & (RFLG_ERRS|RFLG_FRAM|RFLG_OFLO|RFLG_CRC)) ||
- (rp->r_flags&(RFLG_STP|RFLG_ENP)) != (RFLG_STP|RFLG_ENP) ||
- (rp->r_lenerr & (RERR_BUFL|RERR_UBTO|RERR_NCHN)) ||
- len < ETHERMIN || len > ETHERMTU) {
- ds->ds_if.if_ierrors++;
- if (dedebug) {
- printf("de%d: ierror, flags=%b ",
- unit, rp->r_flags, RFLG_BITS);
- printf("lenerr=%b (len=%d)\n",
- rp->r_lenerr, RERR_BITS, len);
- }
- } else
- deread(ds, &ds->ds_ifr[ds->ds_rindex], len);
-
- /* hang the receive buffer again */
- rp->r_lenerr = 0;
- rp->r_flags = RFLG_OWN;
-
- /* check next receive buffer */
- ds->ds_rindex++;
- if (ds->ds_rindex == NRCV)
- ds->ds_rindex = 0;
- rp = &ds->ds_rrent[ds->ds_rindex];
- }
-}
-
-/*
- * Pass a packet to the higher levels.
- * We deal with the trailer protocol here.
- */
-void
-deread(ds, ifrw, len)
- register struct de_softc *ds;
- struct ifrw *ifrw;
- int len;
-{
- struct ether_header *eh;
- struct mbuf *m;
-
- eh = (struct ether_header *)ifrw->ifrw_addr;
- if (len == 0)
- return;
-
- /*
- * Pull packet off interface. Off is nonzero if packet
- * has trailing header; if_ubaget will then force this header
- * information to be at the front.
- */
- m = if_ubaget(&ds->ds_deuba, ifrw, len, &ds->ds_if);
- if (m) {
- /*
- * XXX not exactly sure what if_ubaget does. Manually
- * add the ethernet header to the start of the mbuf chain.
- */
- M_PREPEND(m, sizeof(*eh), M_DONTWAIT);
- if (m) {
- *mtod(m, struct ether_header *) = *eh;
- ether_input_mbuf(&ds->ds_if, m);
- }
- }
-}
-/*
- * Process an ioctl request.
- */
-int
-deioctl(ifp, cmd, data)
- register struct ifnet *ifp;
- u_long cmd;
- caddr_t data;
-{
- register struct de_softc *ds = ifp->if_softc;
- int s, error = 0;
-
- s = splnet();
-
- switch (cmd) {
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
- deinit(ds);
- break;
-
- case SIOCSIFFLAGS:
- if ((ifp->if_flags & IFF_UP) == 0 &&
- ds->ds_flags & DSF_RUNNING) {
- ds->ds_vaddr->pclow = 0;
- DELAY(5000);
- ds->ds_vaddr->pclow = PCSR0_RSET;
- ds->ds_flags &= ~DSF_RUNNING;
- ifq_clr_oactive(&ds->ds_if.if_snd);
- } else if (ifp->if_flags & IFF_UP &&
- (ds->ds_flags & DSF_RUNNING) == 0)
- deinit(ds);
- break;
-
- default:
- error = ether_ioctl(ifp, &ds->ds_ac, cmd, data);
- }
-
- splx(s);
- return (error);
-}
-
-/*
- * set ethernet address for unit
- */
-void
-de_setaddr(physaddr, ds)
- u_char *physaddr;
- struct de_softc *ds;
-{
- volatile struct dedevice *addr= ds->ds_vaddr;
-
- if (! (ds->ds_flags & DSF_RUNNING))
- return;
-
- bcopy((caddr_t) physaddr, (caddr_t) &ds->ds_pcbb.pcbb2, 6);
- ds->ds_pcbb.pcbb0 = FC_WTPHYAD;
- addr->pclow = PCSR0_INTE|CMD_GETCMD;
- if (dewait(ds, "address change") == 0) {
- ds->ds_flags |= DSF_SETADDR;
- bcopy((caddr_t) physaddr, ds->ds_ac.ac_enaddr, 6);
- }
-}
-
-/*
- * Await completion of the named function
- * and check for errors.
- */
-int
-dewait(ds, fn)
- register struct de_softc *ds;
- char *fn;
-{
- volatile struct dedevice *addr = ds->ds_vaddr;
- register int csr0;
-
- while ((addr->pcsr0 & PCSR0_INTR) == 0)
- ;
- csr0 = addr->pcsr0;
- addr->pchigh = csr0 >> 8;
- if (csr0 & PCSR0_PCEI) {
- printf("de%d: %s failed, csr0=%b ", ds->ds_dev.dv_unit, fn,
- csr0, PCSR0_BITS);
- printf("csr1=%b\n", addr->pcsr1, PCSR1_BITS);
- }
- return (csr0 & PCSR0_PCEI);
-}
-
-int
-dematch(parent, cf, aux)
- struct device *parent;
- void *cf, *aux;
-{
- struct uba_attach_args *ua = aux;
- volatile struct dedevice *addr = (struct dedevice *)ua->ua_addr;
- int i;
-
- /*
- * Make sure self-test is finished before we screw with the board.
- * Self-test on a DELUA can take 15 seconds (argh).
- */
- for (i = 0;
- i < 160 &&
- (addr->pcsr0 & PCSR0_FATI) == 0 &&
- (addr->pcsr1 & PCSR1_STMASK) == STAT_RESET;
- ++i)
- DELAY(50000);
- if (((addr->pcsr0 & PCSR0_FATI) != 0) ||
- (((addr->pcsr1 & PCSR1_STMASK) != STAT_READY) &&
- ((addr->pcsr1 & PCSR1_STMASK) != STAT_RUN)))
- return(0);
-
- addr->pcsr0 = 0;
- DELAY(5000);
- addr->pcsr0 = PCSR0_RSET;
- while ((addr->pcsr0 & PCSR0_INTR) == 0)
- ;
- /* make board interrupt by executing a GETPCBB command */
- addr->pcsr0 = PCSR0_INTE;
- addr->pcsr2 = 0;
- addr->pcsr3 = 0;
- addr->pcsr0 = PCSR0_INTE|CMD_GETPCBB;
- DELAY(50000);
-
- ua->ua_ivec = deintr;
- ua->ua_reset = dereset; /* Wish to be called after ubareset */
-
- return 1;
-}
diff --git a/sys/arch/vax/if/if_dereg.h b/sys/arch/vax/if/if_dereg.h
deleted file mode 100644
index d8f8c8fd4a9..00000000000
--- a/sys/arch/vax/if/if_dereg.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/* $OpenBSD: if_dereg.h,v 1.4 2003/06/02 23:27:57 millert Exp $ */
-/* $NetBSD: if_dereg.h,v 1.3 1996/04/08 18:34:55 ragge Exp $ */
-
-/*
- * Copyright (c) 1982, 1986 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.
- *
- * @(#)if_dereg.h 7.3 (Berkeley) 6/28/90
- */
-
-/*
- * DEC DEUNA interface
- */
-struct dedevice {
- union {
- short p0_w;
- char p0_b[2];
- } u_p0;
-#define pcsr0 u_p0.p0_w
-#define pclow u_p0.p0_b[0]
-#define pchigh u_p0.p0_b[1]
- short pcsr1;
- short pcsr2;
- short pcsr3;
-};
-
-/*
- * PCSR 0 bit descriptions
- */
-#define PCSR0_SERI 0x8000 /* Status error interrupt */
-#define PCSR0_PCEI 0x4000 /* Port command error interrupt */
-#define PCSR0_RXI 0x2000 /* Receive done interrupt */
-#define PCSR0_TXI 0x1000 /* Transmit done interrupt */
-#define PCSR0_DNI 0x0800 /* Done interrupt */
-#define PCSR0_RCBI 0x0400 /* Receive buffer unavail intrpt */
-#define PCSR0_FATI 0x0100 /* Fatal error interrupt */
-#define PCSR0_INTR 0x0080 /* Interrupt summary */
-#define PCSR0_INTE 0x0040 /* Interrupt enable */
-#define PCSR0_RSET 0x0020 /* DEUNA reset */
-#define PCSR0_CMASK 0x000f /* command mask */
-
-#define PCSR0_BITS "\20\20SERI\17PCEI\16RXI\15TXI\14DNI\13RCBI\11FATI\10INTR\7INTE\6RSET"
-
-/* bits 0-3 are for the PORT_COMMAND */
-#define CMD_NOOP 0x0
-#define CMD_GETPCBB 0x1 /* Get PCB Block */
-#define CMD_GETCMD 0x2 /* Execute command in PCB */
-#define CMD_STEST 0x3 /* Self test mode */
-#define CMD_START 0x4 /* Reset xmit and receive ring ptrs */
-#define CMD_BOOT 0x5 /* Boot DEUNA */
-#define CMD_PDMD 0x8 /* Polling demand */
-#define CMD_TMRO 0x9 /* Sanity timer on */
-#define CMD_TMRF 0xa /* Sanity timer off */
-#define CMD_RSTT 0xb /* Reset sanity timer */
-#define CMD_STOP 0xf /* Suspend operation */
-
-/*
- * PCSR 1 bit descriptions
- */
-#define PCSR1_XPWR 0x8000 /* Transceiver power BAD */
-#define PCSR1_ICAB 0x4000 /* Interconnect cabling BAD */
-#define PCSR1_STCODE 0x3f00 /* Self test error code */
-#define PCSR1_PCTO 0x0080 /* Port command timed out */
-#define PCSR1_ILLINT 0x0040 /* Illegal interrupt */
-#define PCSR1_TIMEOUT 0x0020 /* Timeout */
-#define PCSR1_POWER 0x0010 /* Power fail */
-#define PCSR1_RMTC 0x0008 /* Remote console reserved */
-#define PCSR1_STMASK 0x0007 /* State */
-
-/* bit 0-3 are for STATE */
-#define STAT_RESET 0x0
-#define STAT_PRIMLD 0x1 /* Primary load */
-#define STAT_READY 0x2
-#define STAT_RUN 0x3
-#define STAT_UHALT 0x5 /* UNIBUS halted */
-#define STAT_NIHALT 0x6 /* NI halted */
-#define STAT_NIUHALT 0x7 /* NI and UNIBUS Halted */
-
-#define PCSR1_BITS "\20\20XPWR\17ICAB\10PCTO\7ILLINT\6TIMEOUT\5POWER\4RMTC"
-
-/*
- * Port Control Block Base
- */
-struct de_pcbb {
- short pcbb0; /* function */
- short pcbb2; /* command specific */
- short pcbb4;
- short pcbb6;
-};
-
-/* PCBB function codes */
-#define FC_NOOP 0x00 /* NO-OP */
-#define FC_LSUADDR 0x01 /* Load and start microaddress */
-#define FC_RDDEFAULT 0x02 /* Read default physical address */
-#define FC_RDPHYAD 0x04 /* Read physical address */
-#define FC_WTPHYAD 0x05 /* Write physical address */
-#define FC_RDMULTI 0x06 /* Read multicast address list */
-#define FC_WTMULTI 0x07 /* Read multicast address list */
-#define FC_RDRING 0x08 /* Read ring format */
-#define FC_WTRING 0x09 /* Write ring format */
-#define FC_RDCNTS 0x0a /* Read counters */
-#define FC_RCCNTS 0x0b /* Read and clear counters */
-#define FC_RDMODE 0x0c /* Read mode */
-#define FC_WTMODE 0x0d /* Write mode */
-#define FC_RDSTATUS 0x0e /* Read port status */
-#define FC_RCSTATUS 0x0f /* Read and clear port status */
-#define FC_DUMPMEM 0x10 /* Dump internal memory */
-#define FC_LOADMEM 0x11 /* Load internal memory */
-#define FC_RDSYSID 0x12 /* Read system ID parameters */
-#define FC_WTSYSID 0x13 /* Write system ID parameters */
-#define FC_RDSERAD 0x14 /* Read load server address */
-#define FC_WTSERAD 0x15 /* Write load server address */
-
-/*
- * Unibus Data Block Base (UDBB) for ring buffers
- */
-struct de_udbbuf {
- short b_tdrbl; /* Transmit desc ring base low 16 bits */
- char b_tdrbh; /* Transmit desc ring base high 2 bits */
- char b_telen; /* Length of each transmit entry */
- short b_trlen; /* Number of entries in the XMIT desc ring */
- short b_rdrbl; /* Receive desc ring base low 16 bits */
- char b_rdrbh; /* Receive desc ring base high 2 bits */
- char b_relen; /* Length of each receive entry */
- short b_rrlen; /* Number of entries in the RECV desc ring */
-};
-
-/*
- * Transmit/Receive Ring Entry
- */
-struct de_ring {
- short r_slen; /* Segment length */
- short r_segbl; /* Segment address (low 16 bits) */
- char r_segbh; /* Segment address (hi 2 bits) */
- u_char r_flags; /* Status flags */
- u_short r_tdrerr; /* Errors */
-#define r_lenerr r_tdrerr
- short r_rid; /* Request ID */
-};
-
-#define XFLG_OWN 0x80 /* If 0 then owned by driver */
-#define XFLG_ERRS 0x40 /* Error summary */
-#define XFLG_MTCH 0x20 /* Address match on xmit request */
-#define XFLG_MORE 0x10 /* More than one entry required */
-#define XFLG_ONE 0x08 /* One collision encountered */
-#define XFLG_DEF 0x04 /* Transmit deferred */
-#define XFLG_STP 0x02 /* Start of packet */
-#define XFLG_ENP 0x01 /* End of packet */
-
-#define XFLG_BITS "\10\10OWN\7ERRS\6MTCH\5MORE\4ONE\3DEF\2STP\1ENP"
-
-#define XERR_BUFL 0x8000 /* Buffer length error */
-#define XERR_UBTO 0x4000 /* UNIBUS tiemout */
-#define XERR_LCOL 0x1000 /* Late collision */
-#define XERR_LCAR 0x0800 /* Loss of carrier */
-#define XERR_RTRY 0x0400 /* Failed after 16 retries */
-#define XERR_TDR 0x03ff /* TDR value */
-
-#define XERR_BITS "\20\20BUFL\17UBTO\15LCOL\14LCAR\13RTRY"
-
-#define RFLG_OWN 0x80 /* If 0 then owned by driver */
-#define RFLG_ERRS 0x40 /* Error summary */
-#define RFLG_FRAM 0x20 /* Framing error */
-#define RFLG_OFLO 0x10 /* Message overflow */
-#define RFLG_CRC 0x08 /* CRC error */
-#define RFLG_STP 0x02 /* Start of packet */
-#define RFLG_ENP 0x01 /* End of packet */
-
-#define RFLG_BITS "\10\10OWN\7ERRS\6FRAM\5OFLO\4CRC\2STP\1ENP"
-
-#define RERR_BUFL 0x8000 /* Buffer length error */
-#define RERR_UBTO 0x4000 /* UNIBUS tiemout */
-#define RERR_NCHN 0x2000 /* No data chaining */
-#define RERR_MLEN 0x0fff /* Message length */
-
-#define RERR_BITS "\20\20BUFL\17UBTO\16NCHN"
-
-/* mode description bits */
-#define MOD_HDX 0x0001 /* Half duplex mode */
-#define MOD_LOOP 0x0004 /* Enable internal loopback */
-#define MOD_DTCR 0x0008 /* Disables CRC generation */
-#define MOD_DMNT 0x0200 /* Disable maintenance features */
-#define MOD_ECT 0x0400 /* Enable collision test */
-#define MOD_TPAD 0x1000 /* Transmit message pad enable */
-#define MOD_DRDC 0x2000 /* Disable data chaining */
-#define MOD_ENAL 0x4000 /* Enable all multicast */
-#define MOD_PROM 0x8000 /* Enable promiscuous mode */
-
-struct de_buf {
- struct ether_header db_head; /* header */
- char db_data[ETHERMTU]; /* packet data */
- int db_crc; /* CRC - on receive only */
-};
diff --git a/sys/arch/vax/if/if_le.c b/sys/arch/vax/if/if_le.c
deleted file mode 100644
index 3d992fe985b..00000000000
--- a/sys/arch/vax/if/if_le.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/* $OpenBSD: if_le.c,v 1.19 2014/12/22 02:26:54 tedu Exp $ */
-/* $NetBSD: if_le.c,v 1.14 1999/08/14 18:40:23 ragge Exp $ */
-
-/*-
- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum and 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.
- *
- * 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) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * 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.
- *
- * @(#)if_le.c 8.2 (Berkeley) 11/16/93
- */
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#include <sys/syslog.h>
-#include <sys/socket.h>
-#include <sys/device.h>
-#include <sys/reboot.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <net/if.h>
-#include <net/if_media.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#include <machine/cpu.h>
-#include <machine/nexus.h>
-#include <machine/scb.h>
-
-#include <dev/ic/lancereg.h>
-#include <dev/ic/lancevar.h>
-#include <dev/ic/am7990reg.h>
-#include <dev/ic/am7990var.h>
-
-#define ETHER_MIN_LEN 64 /* minimum frame length, including CRC */
-#define LEVEC 0xd4 /* Interrupt vector on 3300/3400 */
-
-struct le_softc {
- struct am7990_softc sc_am7990; /* Must be first */
- struct evcount sc_intrcnt;
- int sc_vec;
- volatile uint16_t *sc_rap;
- volatile uint16_t *sc_rdp;
-};
-
-int le_ibus_match(struct device *, void *, void *);
-void le_ibus_attach(struct device *, struct device *, void *);
-void lewrcsr(struct lance_softc *, uint16_t, uint16_t);
-uint16_t lerdcsr(struct lance_softc *, uint16_t);
-void lance_copytobuf_gap2(struct lance_softc *, void *, int, int);
-void lance_copyfrombuf_gap2(struct lance_softc *, void *, int, int);
-void lance_zerobuf_gap2(struct lance_softc *, int, int);
-
-struct cfattach le_ibus_ca = {
- sizeof(struct le_softc), le_ibus_match, le_ibus_attach
-};
-
-void
-lewrcsr(struct lance_softc *ls, uint16_t port, uint16_t val)
-{
- struct le_softc *sc = (void *)ls;
-
- *sc->sc_rap = port;
- *sc->sc_rdp = val;
-}
-
-uint16_t
-lerdcsr(struct lance_softc *ls, uint16_t port)
-{
- struct le_softc *sc = (void *)ls;
-
- *sc->sc_rap = port;
- return *sc->sc_rdp;
-}
-
-int
-le_ibus_match(struct device *parent, void *cf, void *aux)
-{
- struct bp_conf *bp = aux;
-
- if (strcmp("lance", bp->type))
- return 0;
- return 1;
-}
-
-void
-le_ibus_attach(struct device *parent, struct device *self, void *aux)
-{
- struct le_softc *lesc = (void *)self;
- struct lance_softc *sc = &lesc->sc_am7990.lsc;
- int *lance_addr;
- int i, br;
-
- lesc->sc_rdp = (short *)vax_map_physmem(0x20084400, 1);
- lesc->sc_rap = lesc->sc_rdp + 2;
-
- /*
- * Set interrupt vector, by forcing an interrupt.
- */
- scb_vecref(0, 0); /* Clear vector ref */
- *lesc->sc_rap = LE_CSR0;
- *lesc->sc_rdp = LE_C0_STOP;
- DELAY(100);
- *lesc->sc_rdp = LE_C0_INIT|LE_C0_INEA;
- DELAY(100000);
- i = scb_vecref(&lesc->sc_vec, &br);
- if (i == 0 || lesc->sc_vec == 0)
- return;
- scb_vecalloc(lesc->sc_vec, (void *)am7990_intr, sc,
- SCB_ISTACK, &lesc->sc_intrcnt);
- evcount_attach(&lesc->sc_intrcnt, self->dv_xname, &lesc->sc_vec);
-
- printf(": vec %d ipl %x\n%s", lesc->sc_vec, br, self->dv_xname);
- /*
- * MD functions.
- */
- sc->sc_rdcsr = lerdcsr;
- sc->sc_wrcsr = lewrcsr;
- sc->sc_nocarrier = NULL;
-
- sc->sc_mem = (void *)uvm_km_valloc(kernel_map, (128 * 1024));
- if (sc->sc_mem == 0)
- return;
-
- ioaccess((vaddr_t)sc->sc_mem, 0x20120000, (128 * 1024) >> VAX_PGSHIFT);
-
- sc->sc_addr = 0;
- sc->sc_memsize = (64 * 1024);
-
- sc->sc_copytodesc = lance_copytobuf_gap2;
- sc->sc_copyfromdesc = lance_copyfrombuf_gap2;
- sc->sc_copytobuf = lance_copytobuf_gap2;
- sc->sc_copyfrombuf = lance_copyfrombuf_gap2;
- sc->sc_zerobuf = lance_zerobuf_gap2;
-
- /*
- * Get the ethernet address out of rom
- */
- lance_addr = (int *)vax_map_physmem(0x20084200, 1);
- for (i = 0; i < 6; i++)
- sc->sc_arpcom.ac_enaddr[i] = (u_char)lance_addr[i];
- vax_unmap_physmem((vaddr_t)lance_addr, 1);
-
- am7990_config(&lesc->sc_am7990);
-}
-
-/*
- * gap2: two bytes of data followed by two bytes of pad.
- *
- * Buffers must be 4-byte aligned. The code doesn't worry about
- * doing an extra byte.
- */
-
-void
-lance_copytobuf_gap2(struct lance_softc *sc, void *fromv, int boff, int len)
-{
- volatile caddr_t buf = sc->sc_mem;
- caddr_t from = fromv;
- volatile uint16_t *bptr;
-
- if (boff & 0x1) {
- /* handle unaligned first byte */
- bptr = ((volatile uint16_t *)buf) + (boff - 1);
- *bptr = (*from++ << 8) | (*bptr & 0xff);
- bptr += 2;
- len--;
- } else
- bptr = ((volatile uint16_t *)buf) + boff;
- while (len > 1) {
- *bptr = (from[1] << 8) | (from[0] & 0xff);
- bptr += 2;
- from += 2;
- len -= 2;
- }
- if (len == 1)
- *bptr = (uint16_t)*from;
-}
-
-void
-lance_copyfrombuf_gap2(struct lance_softc *sc, void *tov, int boff, int len)
-{
- volatile caddr_t buf = sc->sc_mem;
- caddr_t to = tov;
- volatile uint16_t *bptr;
- uint16_t tmp;
-
- if (boff & 0x1) {
- /* handle unaligned first byte */
- bptr = ((volatile uint16_t *)buf) + (boff - 1);
- *to++ = (*bptr >> 8) & 0xff;
- bptr += 2;
- len--;
- } else
- bptr = ((volatile uint16_t *)buf) + boff;
- while (len > 1) {
- tmp = *bptr;
- *to++ = tmp & 0xff;
- *to++ = (tmp >> 8) & 0xff;
- bptr += 2;
- len -= 2;
- }
- if (len == 1)
- *to = *bptr & 0xff;
-}
-
-void
-lance_zerobuf_gap2(struct lance_softc *sc, int boff, int len)
-{
- volatile caddr_t buf = sc->sc_mem;
- volatile uint16_t *bptr;
-
- if ((unsigned)boff & 0x1) {
- bptr = ((volatile uint16_t *)buf) + (boff - 1);
- *bptr &= 0xff;
- bptr += 2;
- len--;
- } else
- bptr = ((volatile uint16_t *)buf) + boff;
- while (len > 0) {
- *bptr = 0;
- bptr += 2;
- len -= 2;
- }
-}
diff --git a/sys/arch/vax/if/if_qe.c b/sys/arch/vax/if/if_qe.c
deleted file mode 100644
index f20cc577814..00000000000
--- a/sys/arch/vax/if/if_qe.c
+++ /dev/null
@@ -1,835 +0,0 @@
-/* $OpenBSD: if_qe.c,v 1.41 2016/01/25 00:18:55 dlg Exp $ */
-/* $NetBSD: if_qe.c,v 1.51 2002/06/08 12:28:37 ragge Exp $ */
-/*
- * Copyright (c) 1999 Ludd, University of Lule}, Sweden. 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * Driver for DEQNA/DELQA ethernet cards.
- * Things that is still to do:
- * Handle ubaresets. Does not work at all right now.
- * Fix ALLMULTI reception. But someone must tell me how...
- * Collect statistics.
- */
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-#include <sys/sockio.h>
-
-#include <net/if.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#endif
-
-#include <machine/bus.h>
-
-#include <arch/vax/qbus/ubavar.h>
-#include <arch/vax/if/if_qereg.h>
-
-#define RXDESCS 30 /* # of receive descriptors */
-#define TXDESCS 60 /* # transmit descs */
-
-/*
- * Structure containing the elements that must be in DMA-safe memory.
- */
-struct qe_cdata {
- struct qe_ring qc_recv[RXDESCS+1]; /* Receive descriptors */
- struct qe_ring qc_xmit[TXDESCS+1]; /* Transmit descriptors */
- u_int8_t qc_setup[128]; /* Setup packet layout */
-};
-
-struct qe_softc {
- struct device sc_dev; /* Configuration common part */
- struct evcount sc_intrcnt; /* Interrupt counting */
- int sc_cvec;
- struct arpcom sc_ac; /* Ethernet common part */
-#define sc_if sc_ac.ac_if /* network-visible interface */
- bus_space_tag_t sc_iot;
- bus_addr_t sc_ioh;
- bus_dma_tag_t sc_dmat;
- struct qe_cdata *sc_qedata; /* Descriptor struct */
- struct qe_cdata *sc_pqedata; /* Unibus address of above */
- struct mbuf* sc_txmbuf[TXDESCS];
- struct mbuf* sc_rxmbuf[RXDESCS];
- bus_dmamap_t sc_xmtmap[TXDESCS];
- bus_dmamap_t sc_rcvmap[RXDESCS];
- struct ubinfo sc_ui;
- int sc_intvec; /* Interrupt vector */
- int sc_nexttx;
- int sc_inq;
- int sc_lastack;
- int sc_nextrx;
- int sc_setup; /* Setup packet in queue */
-};
-
-static int qematch(struct device *, struct cfdata *, void *);
-static void qeattach(struct device *, struct device *, void *);
-static void qeinit(struct qe_softc *);
-static void qestart(struct ifnet *);
-static void qeintr(void *);
-static int qeioctl(struct ifnet *, u_long, caddr_t);
-static int qe_add_rxbuf(struct qe_softc *, int);
-static void qe_setup(struct qe_softc *);
-static void qetimeout(struct ifnet *);
-
-struct cfattach qe_ca = {
- sizeof(struct qe_softc), (cfmatch_t)qematch, qeattach
-};
-
-struct cfdriver qe_cd = {
- NULL, "qe", DV_IFNET
-};
-
-#define QE_WCSR(iot, ioh, csr, val) \
- bus_space_write_2(iot, ioh, csr, val)
-#define QE_RCSR(iot, ioh, csr) \
- bus_space_read_2(iot, ioh, csr)
-
-#define LOWORD(x) ((int)(x) & 0xffff)
-#define HIWORD(x) (((int)(x) >> 16) & 0x3f)
-
-/*
- * Check for present DEQNA. Done by sending a fake setup packet
- * and wait for interrupt.
- */
-int
-qematch(struct device *parent, struct cfdata *cf, void *aux)
-{
- struct uba_attach_args *ua = aux;
- struct uba_softc *ubasc = (struct uba_softc *)parent;
- struct ubinfo ui;
-#define PROBESIZE 4096
- struct qe_ring *ring;
- struct qe_ring *rp;
- int error;
-
- ring = malloc(PROBESIZE, M_TEMP, M_WAITOK | M_ZERO);
-
- ubasc->uh_lastiv -= 4;
- QE_WCSR(ua->ua_iot, ua->ua_ioh, QE_CSR_CSR, QE_RESET);
- QE_WCSR(ua->ua_iot, ua->ua_ioh, QE_CSR_VECTOR, ubasc->uh_lastiv);
-
- /*
- * Map the ring area. Actually this is done only to be able to
- * send and receive a internal packet; some junk is loopbacked
- * so that the DEQNA has a reason to interrupt.
- */
- ui.ui_size = PROBESIZE;
- ui.ui_vaddr = (caddr_t)&ring[0];
- if ((error = uballoc((void *)parent, &ui, UBA_CANTWAIT))) {
- free(ring, M_TEMP, PROBESIZE);
- return 0;
- }
-
- /*
- * Init a simple "fake" receive and transmit descriptor that
- * points to some unused area. Send a fake setup packet.
- */
- rp = (void *)ui.ui_baddr;
- ring[0].qe_flag = ring[0].qe_status1 = QE_NOTYET;
- ring[0].qe_addr_lo = LOWORD(&rp[4]);
- ring[0].qe_addr_hi = HIWORD(&rp[4]) | QE_VALID | QE_EOMSG | QE_SETUP;
- ring[0].qe_buf_len = -64;
-
- ring[2].qe_flag = ring[2].qe_status1 = QE_NOTYET;
- ring[2].qe_addr_lo = LOWORD(&rp[4]);
- ring[2].qe_addr_hi = HIWORD(&rp[4]) | QE_VALID;
- ring[2].qe_buf_len = -(1500/2);
-
- QE_WCSR(ua->ua_iot, ua->ua_ioh, QE_CSR_CSR,
- QE_RCSR(ua->ua_iot, ua->ua_ioh, QE_CSR_CSR) & ~QE_RESET);
- DELAY(1000);
-
- /*
- * Start the interface and wait for the packet.
- */
- QE_WCSR(ua->ua_iot, ua->ua_ioh, QE_CSR_CSR,
- QE_INT_ENABLE|QE_XMIT_INT|QE_RCV_INT);
- QE_WCSR(ua->ua_iot, ua->ua_ioh, QE_CSR_RCLL, LOWORD(&rp[2]));
- QE_WCSR(ua->ua_iot, ua->ua_ioh, QE_CSR_RCLH, HIWORD(&rp[2]));
- QE_WCSR(ua->ua_iot, ua->ua_ioh, QE_CSR_XMTL, LOWORD(rp));
- QE_WCSR(ua->ua_iot, ua->ua_ioh, QE_CSR_XMTH, HIWORD(rp));
- DELAY(10000);
-
- /*
- * All done with the bus resources.
- */
- ubfree((void *)parent, &ui);
- free(ring, M_TEMP, PROBESIZE);
- return 1;
-}
-
-/*
- * Interface exists: make available by filling in network interface
- * record. System will initialize the interface when it is ready
- * to accept packets.
- */
-void
-qeattach(struct device *parent, struct device *self, void *aux)
-{
- struct uba_attach_args *ua = aux;
- struct uba_softc *ubasc = (struct uba_softc *)parent;
- struct qe_softc *sc = (struct qe_softc *)self;
- struct ifnet *ifp = (struct ifnet *)&sc->sc_if;
- struct qe_ring *rp;
- int i, error;
-
- sc->sc_iot = ua->ua_iot;
- sc->sc_ioh = ua->ua_ioh;
- sc->sc_dmat = ua->ua_dmat;
-
- /*
- * Allocate DMA safe memory for descriptors and setup memory.
- */
-
- sc->sc_ui.ui_size = sizeof(struct qe_cdata);
- if ((error = ubmemalloc((struct uba_softc *)parent, &sc->sc_ui, 0))) {
- printf(": unable to ubmemalloc(), error = %d\n", error);
- return;
- }
- sc->sc_pqedata = (struct qe_cdata *)sc->sc_ui.ui_baddr;
- sc->sc_qedata = (struct qe_cdata *)sc->sc_ui.ui_vaddr;
-
- /*
- * Zero the newly allocated memory.
- */
- bzero(sc->sc_qedata, sizeof(struct qe_cdata));
- /*
- * Create the transmit descriptor DMA maps. We take advantage
- * of the fact that the Qbus address space is big, and therefore
- * allocate map registers for all transmit descriptors also,
- * so that we can avoid this each time we send a packet.
- */
- for (i = 0; i < TXDESCS; i++) {
- if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES,
- 1, MCLBYTES, 0, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW,
- &sc->sc_xmtmap[i]))) {
- printf(": unable to create tx DMA map %d, error = %d\n",
- i, error);
- goto fail_4;
- }
- }
-
- /*
- * Create receive buffer DMA maps.
- */
- for (i = 0; i < RXDESCS; i++) {
- if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1,
- MCLBYTES, 0, BUS_DMA_NOWAIT,
- &sc->sc_rcvmap[i]))) {
- printf(": unable to create rx DMA map %d, error = %d\n",
- i, error);
- goto fail_5;
- }
- }
- /*
- * Pre-allocate the receive buffers.
- */
- for (i = 0; i < RXDESCS; i++) {
- if ((error = qe_add_rxbuf(sc, i)) != 0) {
- printf(": unable to allocate or map rx buffer %d\n,"
- " error = %d\n", i, error);
- goto fail_6;
- }
- }
-
- /*
- * Create ring loops of the buffer chains.
- * This is only done once.
- */
-
- rp = sc->sc_qedata->qc_recv;
- rp[RXDESCS].qe_addr_lo = LOWORD(&sc->sc_pqedata->qc_recv[0]);
- rp[RXDESCS].qe_addr_hi = HIWORD(&sc->sc_pqedata->qc_recv[0]) |
- QE_VALID | QE_CHAIN;
- rp[RXDESCS].qe_flag = rp[RXDESCS].qe_status1 = QE_NOTYET;
-
- rp = sc->sc_qedata->qc_xmit;
- rp[TXDESCS].qe_addr_lo = LOWORD(&sc->sc_pqedata->qc_xmit[0]);
- rp[TXDESCS].qe_addr_hi = HIWORD(&sc->sc_pqedata->qc_xmit[0]) |
- QE_VALID | QE_CHAIN;
- rp[TXDESCS].qe_flag = rp[TXDESCS].qe_status1 = QE_NOTYET;
-
- /*
- * Get the vector that were set at match time, and remember it.
- */
- sc->sc_intvec = ubasc->uh_lastiv;
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_CSR, QE_RESET);
- DELAY(1000);
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_CSR,
- QE_RCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_CSR) & ~QE_RESET);
-
- /*
- * Read out ethernet address and tell which type this card is.
- */
- for (i = 0; i < 6; i++)
- sc->sc_ac.ac_enaddr[i] =
- QE_RCSR(sc->sc_iot, sc->sc_ioh, i * 2) & 0xff;
-
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_VECTOR, sc->sc_intvec | 1);
- printf(": %s, address %s\n",
- QE_RCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_VECTOR) & 1 ?
- "delqa" : "deqna", ether_sprintf(sc->sc_ac.ac_enaddr));
-
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_VECTOR,
- QE_RCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_VECTOR) & ~1); /* ??? */
-
- uba_intr_establish(ua->ua_icookie, ua->ua_cvec, qeintr,
- sc, &sc->sc_intrcnt);
- sc->sc_cvec = ua->ua_cvec;
- evcount_attach(&sc->sc_intrcnt, sc->sc_dev.dv_xname, &sc->sc_cvec);
-
- strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, sizeof ifp->if_xname);
- ifp->if_softc = sc;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_start = qestart;
- ifp->if_ioctl = qeioctl;
- ifp->if_watchdog = qetimeout;
- IFQ_SET_READY(&ifp->if_snd);
-
- /*
- * Attach the interface.
- */
- if_attach(ifp);
- ether_ifattach(ifp);
-
- return;
-
- /*
- * Free any resources we've allocated during the failed attach
- * attempt. Do this in reverse order and fall through.
- */
- fail_6:
- for (i = 0; i < RXDESCS; i++) {
- if (sc->sc_rxmbuf[i] != NULL) {
- bus_dmamap_unload(sc->sc_dmat, sc->sc_xmtmap[i]);
- m_freem(sc->sc_rxmbuf[i]);
- }
- }
- fail_5:
- for (i = 0; i < RXDESCS; i++) {
- if (sc->sc_rcvmap[i] != NULL)
- bus_dmamap_destroy(sc->sc_dmat, sc->sc_rcvmap[i]);
- }
- fail_4:
- for (i = 0; i < TXDESCS; i++) {
- if (sc->sc_xmtmap[i] != NULL)
- bus_dmamap_destroy(sc->sc_dmat, sc->sc_xmtmap[i]);
- }
-}
-
-/*
- * Initialization of interface.
- */
-void
-qeinit(struct qe_softc *sc)
-{
- struct ifnet *ifp = (struct ifnet *)&sc->sc_if;
- struct qe_cdata *qc = sc->sc_qedata;
- int i;
-
-
- /*
- * Reset the interface.
- */
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_CSR, QE_RESET);
- DELAY(1000);
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_CSR,
- QE_RCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_CSR) & ~QE_RESET);
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_VECTOR, sc->sc_intvec);
-
- sc->sc_nexttx = sc->sc_inq = sc->sc_lastack = 0;
- /*
- * Release and init transmit descriptors.
- */
- for (i = 0; i < TXDESCS; i++) {
- if (sc->sc_txmbuf[i]) {
- bus_dmamap_unload(sc->sc_dmat, sc->sc_xmtmap[i]);
- m_freem(sc->sc_txmbuf[i]);
- sc->sc_txmbuf[i] = 0;
- }
- qc->qc_xmit[i].qe_addr_hi = 0; /* Clear valid bit */
- qc->qc_xmit[i].qe_status1 = qc->qc_xmit[i].qe_flag = QE_NOTYET;
- }
-
-
- /*
- * Init receive descriptors.
- */
- for (i = 0; i < RXDESCS; i++)
- qc->qc_recv[i].qe_status1 = qc->qc_recv[i].qe_flag = QE_NOTYET;
- sc->sc_nextrx = 0;
-
- /*
- * Write the descriptor addresses to the device.
- * Receiving packets will be enabled in the interrupt routine.
- */
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_CSR,
- QE_INT_ENABLE|QE_XMIT_INT|QE_RCV_INT);
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_RCLL,
- LOWORD(sc->sc_pqedata->qc_recv));
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_RCLH,
- HIWORD(sc->sc_pqedata->qc_recv));
-
- ifp->if_flags |= IFF_RUNNING;
- ifq_clr_oactive(&ifp->if_snd);
-
- /*
- * Send a setup frame.
- * This will start the transmit machinery as well.
- */
- qe_setup(sc);
-
-}
-
-/*
- * Start output on interface.
- */
-void
-qestart(struct ifnet *ifp)
-{
- struct qe_softc *sc = ifp->if_softc;
- struct qe_cdata *qc = sc->sc_qedata;
- paddr_t buffer;
- struct mbuf *m, *m0;
- int idx, len, s, i, totlen, error;
- short orword, csr;
-
- if ((QE_RCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_CSR) & QE_RCV_ENABLE) == 0)
- return;
-
- s = splnet();
- while (sc->sc_inq < (TXDESCS - 1)) {
-
- if (sc->sc_setup) {
- qe_setup(sc);
- continue;
- }
- idx = sc->sc_nexttx;
- m = ifq_deq_begin(&ifp->if_snd);
- if (m == NULL)
- goto out;
- /*
- * Count number of mbufs in chain.
- * Always do DMA directly from mbufs, therefore the transmit
- * ring is really big.
- */
- for (m0 = m, i = 0; m0; m0 = m0->m_next)
- if (m0->m_len)
- i++;
- if (i >= TXDESCS)
- panic("qestart");
-
- if ((i + sc->sc_inq) >= (TXDESCS - 1)) {
- ifq_deq_rollback(&ifp->if_snd, m);
- ifq_set_oactive(&ifp->if_snd);
- goto out;
- }
-
- ifq_deq_commit(&ifp->if_snd, m);
-
-#if NBPFILTER > 0
- if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
-#endif
- ifp->if_opackets++;
-
- /*
- * m now points to a mbuf chain that can be loaded.
- * Loop around and set it.
- */
- totlen = 0;
- for (m0 = m; m0; m0 = m0->m_next) {
- error = bus_dmamap_load(sc->sc_dmat, sc->sc_xmtmap[idx],
- mtod(m0, void *), m0->m_len, 0, 0);
- buffer = sc->sc_xmtmap[idx]->dm_segs[0].ds_addr;
- len = m0->m_len;
- if (len == 0)
- continue;
-
- totlen += len;
- /* Word alignment calc */
- orword = 0;
- if (totlen == m->m_pkthdr.len) {
- if (totlen < ETHER_MIN_LEN)
- len += (ETHER_MIN_LEN - totlen);
- orword |= QE_EOMSG;
- sc->sc_txmbuf[idx] = m;
- }
- if ((buffer & 1) || (len & 1))
- len += 2;
- if (buffer & 1)
- orword |= QE_ODDBEGIN;
- if ((buffer + len) & 1)
- orword |= QE_ODDEND;
- qc->qc_xmit[idx].qe_buf_len = -(len/2);
- qc->qc_xmit[idx].qe_addr_lo = LOWORD(buffer);
- qc->qc_xmit[idx].qe_addr_hi = HIWORD(buffer);
- qc->qc_xmit[idx].qe_flag =
- qc->qc_xmit[idx].qe_status1 = QE_NOTYET;
- qc->qc_xmit[idx].qe_addr_hi |= (QE_VALID | orword);
- if (++idx == TXDESCS)
- idx = 0;
- sc->sc_inq++;
- }
-#ifdef DIAGNOSTIC
- if (totlen != m->m_pkthdr.len)
- panic("qestart: len fault");
-#endif
-
- /*
- * Kick off the transmit logic, if it is stopped.
- */
- csr = QE_RCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_CSR);
- if (csr & QE_XL_INVALID) {
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_XMTL,
- LOWORD(&sc->sc_pqedata->qc_xmit[sc->sc_nexttx]));
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_XMTH,
- HIWORD(&sc->sc_pqedata->qc_xmit[sc->sc_nexttx]));
- }
- sc->sc_nexttx = idx;
- }
- if (sc->sc_inq == (TXDESCS - 1))
- ifq_set_oactive(&ifp->if_snd);
-
-out: if (sc->sc_inq)
- ifp->if_timer = 5; /* If transmit logic dies */
- splx(s);
-}
-
-static void
-qeintr(void *arg)
-{
- struct qe_softc *sc = arg;
- struct qe_cdata *qc = sc->sc_qedata;
- struct ifnet *ifp = &sc->sc_if;
- struct ether_header *eh;
- struct mbuf_list ml = MBUF_LIST_INITIALIZER();
- struct mbuf *m;
- int csr, status1, status2, len;
-
- csr = QE_RCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_CSR);
-
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_CSR,
- QE_RCV_ENABLE | QE_INT_ENABLE | QE_XMIT_INT | QE_RCV_INT | QE_ILOOP);
-
- if (csr & QE_RCV_INT) {
- while (qc->qc_recv[sc->sc_nextrx].qe_status1 != QE_NOTYET) {
- status1 = qc->qc_recv[sc->sc_nextrx].qe_status1;
- status2 = qc->qc_recv[sc->sc_nextrx].qe_status2;
-
- m = sc->sc_rxmbuf[sc->sc_nextrx];
- len = ((status1 & QE_RBL_HI) |
- (status2 & QE_RBL_LO)) + 60;
- qe_add_rxbuf(sc, sc->sc_nextrx);
- m->m_pkthdr.len = m->m_len = len;
- if (++sc->sc_nextrx == RXDESCS)
- sc->sc_nextrx = 0;
- eh = mtod(m, struct ether_header *);
- /*
- * ALLMULTI means PROMISC in this driver.
- */
- if ((ifp->if_flags & IFF_ALLMULTI) &&
- ((eh->ether_dhost[0] & 1) == 0) &&
- bcmp(sc->sc_ac.ac_enaddr, eh->ether_dhost,
- ETHER_ADDR_LEN)) {
- m_freem(m);
- continue;
- }
-
- if ((status1 & QE_ESETUP) == 0)
- ml_enqueue(&ml, m);
- else
- m_freem(m);
- }
- if_input(ifp, &ml);
- }
-
- if (csr & (QE_XMIT_INT|QE_XL_INVALID)) {
- while (qc->qc_xmit[sc->sc_lastack].qe_status1 != QE_NOTYET) {
- int idx = sc->sc_lastack;
-
- sc->sc_inq--;
- if (++sc->sc_lastack == TXDESCS)
- sc->sc_lastack = 0;
-
- /* XXX collect statistics */
- qc->qc_xmit[idx].qe_addr_hi &= ~QE_VALID;
- qc->qc_xmit[idx].qe_status1 =
- qc->qc_xmit[idx].qe_flag = QE_NOTYET;
-
- if (qc->qc_xmit[idx].qe_addr_hi & QE_SETUP)
- continue;
- bus_dmamap_unload(sc->sc_dmat, sc->sc_xmtmap[idx]);
- if (sc->sc_txmbuf[idx]) {
- m_freem(sc->sc_txmbuf[idx]);
- sc->sc_txmbuf[idx] = 0;
- }
- }
- ifp->if_timer = 0;
- ifq_clr_oactive(&ifp->if_snd);
- qestart(ifp); /* Put in more in queue */
- }
- /*
- * How can the receive list get invalid???
- * Verified that it happens anyway.
- */
- if ((qc->qc_recv[sc->sc_nextrx].qe_status1 == QE_NOTYET) &&
- (QE_RCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_CSR) & QE_RL_INVALID)) {
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_RCLL,
- LOWORD(&sc->sc_pqedata->qc_recv[sc->sc_nextrx]));
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_RCLH,
- HIWORD(&sc->sc_pqedata->qc_recv[sc->sc_nextrx]));
- }
-}
-
-/*
- * Process an ioctl request.
- */
-int
-qeioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
-{
- struct qe_softc *sc = ifp->if_softc;
- int s, error = 0;
-
- s = splnet();
-
- switch (cmd) {
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
- qeinit(sc);
- break;
-
- case SIOCSIFFLAGS:
- if ((ifp->if_flags & IFF_UP) == 0 &&
- (ifp->if_flags & IFF_RUNNING) != 0) {
- /*
- * If interface is marked down and it is running,
- * stop it. (by disabling receive mechanism).
- */
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_CSR,
- QE_RCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_CSR) &
- ~QE_RCV_ENABLE);
- ifp->if_flags &= ~IFF_RUNNING;
- } else if ((ifp->if_flags & IFF_UP) != 0 &&
- (ifp->if_flags & IFF_RUNNING) == 0) {
- /*
- * If interface it marked up and it is stopped, then
- * start it.
- */
- qeinit(sc);
- } else if ((ifp->if_flags & IFF_UP) != 0) {
- /*
- * Send a new setup packet to match any new changes.
- * (Like IFF_PROMISC etc)
- */
- qe_setup(sc);
- }
- break;
-
- default:
- error = ether_ioctl(ifp, &sc->sc_ac, cmd, data);
- }
-
- if (error == ENETRESET) {
- if (ifp->if_flags & IFF_RUNNING)
- qe_setup(sc);
- error = 0;
- }
-
- splx(s);
- return (error);
-}
-
-/*
- * Add a receive buffer to the indicated descriptor.
- */
-int
-qe_add_rxbuf(struct qe_softc *sc, int i)
-{
- struct mbuf *m;
- struct qe_ring *rp;
- vaddr_t addr;
- int error;
-
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == NULL)
- return (ENOBUFS);
-
- MCLGET(m, M_DONTWAIT);
- if ((m->m_flags & M_EXT) == 0) {
- m_freem(m);
- return (ENOBUFS);
- }
-
- if (sc->sc_rxmbuf[i] != NULL)
- bus_dmamap_unload(sc->sc_dmat, sc->sc_rcvmap[i]);
-
- error = bus_dmamap_load(sc->sc_dmat, sc->sc_rcvmap[i],
- m->m_ext.ext_buf, m->m_ext.ext_size, NULL, BUS_DMA_NOWAIT);
- if (error)
- panic("%s: can't load rx DMA map %d, error = %d",
- sc->sc_dev.dv_xname, i, error);
- sc->sc_rxmbuf[i] = m;
-
- bus_dmamap_sync(sc->sc_dmat, sc->sc_rcvmap[i], 0,
- sc->sc_rcvmap[i]->dm_mapsize, BUS_DMASYNC_PREREAD);
-
- /*
- * We know that the mbuf cluster is page aligned. Also, be sure
- * that the IP header will be longword aligned.
- */
- m->m_data += 2;
- addr = sc->sc_rcvmap[i]->dm_segs[0].ds_addr + 2;
- rp = &sc->sc_qedata->qc_recv[i];
- rp->qe_flag = rp->qe_status1 = QE_NOTYET;
- rp->qe_addr_lo = LOWORD(addr);
- rp->qe_addr_hi = HIWORD(addr) | QE_VALID;
- rp->qe_buf_len = -(m->m_ext.ext_size - 2)/2;
-
- return (0);
-}
-
-/*
- * Create a setup packet and put in queue for sending.
- */
-void
-qe_setup(struct qe_softc *sc)
-{
- struct ether_multi *enm;
- struct ether_multistep step;
- struct qe_cdata *qc = sc->sc_qedata;
- struct ifnet *ifp = &sc->sc_if;
- struct arpcom *ac = &sc->sc_ac;
- u_int8_t *enaddr = ac->ac_enaddr;
- int i, j, k, idx, s;
-
- s = splnet();
- if (sc->sc_inq == (TXDESCS - 1)) {
- sc->sc_setup = 1;
- splx(s);
- return;
- }
- sc->sc_setup = 0;
- /*
- * Init the setup packet with valid info.
- */
- memset(qc->qc_setup, 0xff, sizeof(qc->qc_setup)); /* Broadcast */
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- qc->qc_setup[i * 8 + 1] = enaddr[i]; /* Own address */
-
- /*
- * Multicast handling. The DEQNA can handle up to 12 direct
- * ethernet addresses.
- */
- j = 3; k = 0;
- ifp->if_flags &= ~IFF_ALLMULTI;
-
- if (ac->ac_multirangecnt > 0) {
- ifp->if_flags |= IFF_ALLMULTI;
- goto setit;
- }
-
- ETHER_FIRST_MULTI(step, ac, enm);
- while (enm != NULL) {
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- qc->qc_setup[i * 8 + j + k] = enm->enm_addrlo[i];
- j++;
- if (j == 8) {
- j = 1; k += 64;
- }
- if (k > 64) {
- ifp->if_flags |= IFF_ALLMULTI;
- break;
- }
- ETHER_NEXT_MULTI(step, enm);
- }
-
-setit:
- idx = sc->sc_nexttx;
- qc->qc_xmit[idx].qe_buf_len = -64;
-
- /*
- * How is the DEQNA turned in ALLMULTI mode???
- * Until someone tells me, fall back to PROMISC when more than
- * 12 ethernet addresses.
- */
- if (ifp->if_flags & IFF_ALLMULTI)
- ifp->if_flags |= IFF_PROMISC;
- else if (ifp->if_pcount == 0)
- ifp->if_flags &= ~IFF_PROMISC;
- if (ifp->if_flags & IFF_PROMISC)
- qc->qc_xmit[idx].qe_buf_len = -65;
-
- qc->qc_xmit[idx].qe_addr_lo = LOWORD(sc->sc_pqedata->qc_setup);
- qc->qc_xmit[idx].qe_addr_hi =
- HIWORD(sc->sc_pqedata->qc_setup) | QE_SETUP | QE_EOMSG;
- qc->qc_xmit[idx].qe_status1 = qc->qc_xmit[idx].qe_flag = QE_NOTYET;
- qc->qc_xmit[idx].qe_addr_hi |= QE_VALID;
-
- if (QE_RCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_CSR) & QE_XL_INVALID) {
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_XMTL,
- LOWORD(&sc->sc_pqedata->qc_xmit[idx]));
- QE_WCSR(sc->sc_iot, sc->sc_ioh, QE_CSR_XMTH,
- HIWORD(&sc->sc_pqedata->qc_xmit[idx]));
- }
-
- sc->sc_inq++;
- if (++sc->sc_nexttx == TXDESCS)
- sc->sc_nexttx = 0;
- splx(s);
-}
-
-/*
- * Check for dead transmit logic. Not uncommon.
- */
-void
-qetimeout(struct ifnet *ifp)
-{
- struct qe_softc *sc = ifp->if_softc;
-
- if (sc->sc_inq == 0)
- return;
-
- printf("%s: xmit logic died, resetting...\n", sc->sc_dev.dv_xname);
- /*
- * Do a reset of interface, to get it going again.
- * Will it work by just restart the transmit logic?
- */
- qeinit(sc);
-}
diff --git a/sys/arch/vax/if/if_qereg.h b/sys/arch/vax/if/if_qereg.h
deleted file mode 100644
index cefc57288aa..00000000000
--- a/sys/arch/vax/if/if_qereg.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/* $OpenBSD: if_qereg.h,v 1.7 2003/06/02 23:27:57 millert Exp $ */
-/* $NetBSD: if_qereg.h,v 1.6 2001/06/19 13:42:18 wiz Exp $ */
-/*
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Digital Equipment Corp.
- *
- * 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.
- *
- * @(#)if_qereg.h 7.3 (Berkeley) 6/28/90
- */
-
-/* @(#)if_qereg.h 1.2 (ULTRIX) 1/3/85 */
-
-/****************************************************************
- * *
- * Licensed from Digital Equipment Corporation *
- * Copyright (c) *
- * Digital Equipment Corporation *
- * Maynard, Massachusetts *
- * 1985, 1986 *
- * All rights reserved. *
- * *
- * The Information in this software is subject to change *
- * without notice and should not be construed as a commitment *
- * by Digital Equipment Corporation. Digital makes no *
- * representations about the suitability of this software for *
- * any purpose. It is supplied "As Is" without expressed or *
- * implied warranty. *
- * *
- * If the Regents of the University of California or its *
- * licensees modify the software in a manner creating *
- * derivative copyright rights, appropriate copyright *
- * legends may be placed on the derivative work in addition *
- * to that set forth above. *
- * *
- ****************************************************************/
-/* ---------------------------------------------------------------------
- * Modification History
- *
- * 13 Feb. 84 -- rjl
- *
- * Initial version of driver. derived from IL driver.
- *
- * ---------------------------------------------------------------------
- */
-
-/*
- * Digital Q-BUS to NI Adapter
- */
-#ifdef notdef
-struct qedevice {
- u_short qe_sta_addr[2]; /* Station address (actually 6 */
- u_short qe_rcvlist_lo; /* Receive list lo address */
- u_short qe_rcvlist_hi; /* Receive list hi address */
- u_short qe_xmtlist_lo; /* Transmit list lo address */
- u_short qe_xmtlist_hi; /* Transmit list hi address */
- u_short qe_vector; /* Interrupt vector */
- u_short qe_csr; /* Command and Status Register */
-};
-#endif
-
-/*
- * Register offsets in register space.
- */
-#define QE_CSR_ADDR1 0
-#define QE_CSR_ADDR2 2
-#define QE_CSR_RCLL 4
-#define QE_CSR_RCLH 6
-#define QE_CSR_XMTL 8
-#define QE_CSR_XMTH 10
-#define QE_CSR_VECTOR 12
-#define QE_CSR_CSR 14
-
-/*
- * Command and status bits (csr)
- */
-#define QE_RCV_ENABLE 0x0001 /* Receiver enable */
-#define QE_RESET 0x0002 /* Software reset */
-#define QE_NEX_MEM_INT 0x0004 /* Non existent mem interrupt */
-#define QE_LOAD_ROM 0x0008 /* Load boot/diag from rom */
-#define QE_XL_INVALID 0x0010 /* Transmit list invalid */
-#define QE_RL_INVALID 0x0020 /* Receive list invalid */
-#define QE_INT_ENABLE 0x0040 /* Interrupt enable */
-#define QE_XMIT_INT 0x0080 /* Transmit interrupt */
-#define QE_ILOOP 0x0100 /* Internal loopback */
-#define QE_ELOOP 0x0200 /* External loopback */
-#define QE_STIM_ENABLE 0x0400 /* Sanity timer enable */
-#define QE_POWERUP 0x1000 /* Tranceiver power on */
-#define QE_CARRIER 0x2000 /* Carrier detect */
-#define QE_RCV_INT 0x8000 /* Receiver interrupt */
-
-/*
- * Transmit and receive ring discriptor ---------------------------
- *
- * The QNA uses the flag, status1 and the valid bit as a handshake/semiphore
- * mechinism.
- *
- * The flag word is written on ( bits 15,15 set to 1 ) when it reads the
- * descriptor. If the valid bit is set it considers the address to be valid.
- * When it uses the buffer pointed to by the valid address it sets status word
- * one.
- */
-struct qe_ring {
- u_short qe_flag; /* Buffer utilization flags */
- u_short qe_addr_hi;
- u_short qe_addr_lo; /* Low order bits of address */
- short qe_buf_len; /* Negative buffer length */
- u_short qe_status1; /* Status word one */
- u_short qe_status2; /* Status word two */
-};
-
-/*
- * High word address control bits.
- */
-#define QE_VALID 0x8000
-#define QE_CHAIN 0x4000
-#define QE_EOMSG 0x2000
-#define QE_SETUP 0x1000
-#define QE_ODDEND 0x0080
-#define QE_ODDBEGIN 0x0040
-
-/*
- * Status word definations (receive)
- * word1
- */
-#define QE_OVF 0x0001 /* Receiver overflow */
-#define QE_CRCERR 0x0002 /* CRC error */
-#define QE_FRAME 0x0004 /* Framing alignment error */
-#define QE_SHORT 0x0008 /* Packet size < 10 bytes */
-#define QE_RBL_HI 0x0700 /* Hi bits of receive len */
-#define QE_RUNT 0x0800 /* Runt packet */
-#define QE_DISCARD 0x1000 /* Discard the packet */
-#define QE_ESETUP 0x2000 /* Looped back setup or eloop */
-#define QE_ERROR 0x4000 /* Receiver error */
-#define QE_LASTNOT 0x8000 /* Not the last in the packet */
-/* word2 */
-#define QE_RBL_LO 0x00ff /* Low bits of receive len */
-
-/*
- * Status word definations (transmit)
- * word1
- */
-#define QE_CCNT 0x00f0 /* Collision count this packet */
-#define QE_FAIL 0x0100 /* Heart beat check failure */
-#define QE_ABORT 0x0200 /* Transmission abort */
-#define QE_STE16 0x0400 /* Sanity timer default on */
-#define QE_NOCAR 0x0800 /* No carrier */
-#define QE_LOSS 0x1000 /* Loss of carrier while xmit */
-/* word2 */
-#define QE_TDR 0x3fff /* Time domain reflectometry */
-
-/*
- * General constant definations
- */
-#define QEALLOC 0 /* Allocate an mbuf */
-#define QENOALLOC 1 /* No mbuf allocation */
-#define QEDEALLOC 2 /* Release an mbuf chain */
-
-#define QE_NOTYET 0x8000 /* Descriptor not in use yet */
-#define QE_INUSE 0x4000 /* Descriptor being used by QNA */
-#define QE_MASK 0xc000 /* Lastnot/error/used mask */
-
-/*
- * Values for the length of the setup packet that control reception filter.
- */
-#define QE_SETUPLEN 128 /* Size of setup packet */
-#define QE_ALLMULTI 1 /* Receive all multicasts */
-#define QE_PROMISC 2 /* Receive all packets */
diff --git a/sys/arch/vax/if/if_uba.h b/sys/arch/vax/if/if_uba.h
deleted file mode 100644
index 5bf80ddd34b..00000000000
--- a/sys/arch/vax/if/if_uba.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* $OpenBSD: if_uba.h,v 1.7 2003/11/10 21:05:04 miod Exp $ */
-/* $NetBSD: if_uba.h,v 1.6 1996/08/20 14:07:50 ragge Exp $ */
-
-/*
- * Copyright (c) 1982, 1986 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.
- *
- * @(#)if_uba.h 7.4 (Berkeley) 6/28/90
- */
-
-/*
- * Structure and routine definitions
- * for UNIBUS network interfaces.
- */
-
-#define IF_MAXNUBAMR 10
-/*
- * Each interface has structures giving information
- * about UNIBUS resources held by the interface
- * for each send and receive buffer.
- *
- * We hold IF_NUBAMR map registers for datagram data, starting
- * at ifr_mr. Map register ifr_mr[-1] maps the local network header
- * ending on the page boundary. Bdp's are reserved for read and for
- * write, given by ifr_bdp. The prototype of the map register for
- * read and for write is saved in ifr_proto.
- *
- * When write transfers are not full pages on page boundaries we just
- * copy the data into the pages mapped on the UNIBUS and start the
- * transfer. If a write transfer is of a (1024 byte) page on a page
- * boundary, we swap in UNIBUS pte's to reference the pages, and then
- * remap the initial pages (from ifu_wmap) when the transfer completes.
- *
- * When read transfers give whole pages of data to be input, we
- * allocate page frames from a network page list and trade them
- * with the pages already containing the data, mapping the allocated
- * pages to replace the input pages for the next UNIBUS data input.
- */
-
-/*
- * Information per interface.
- */
-struct ifubinfo {
- short iff_flags; /* used during uballoc's */
- short iff_hlen; /* local net header length */
- struct uba_regs *iff_uba; /* uba adaptor regs, in vm */
- pt_entry_t *iff_ubamr; /* uba map regs, in vm */
- struct uba_softc *iff_softc; /* uba */
-};
-
-/*
- * Information per buffer.
- */
-struct ifrw {
- caddr_t ifrw_addr; /* virt addr of header */
- short ifrw_bdp; /* unibus bdp */
- short ifrw_flags; /* type, etc. */
-#define IFRW_W 0x01 /* is a transmit buffer */
- int ifrw_info; /* value from ubaalloc */
- int ifrw_proto; /* map register prototype */
- pt_entry_t *ifrw_mr; /* base of map registers */
-};
-
-/*
- * Information per transmit buffer, including the above.
- */
-struct ifxmt {
- struct ifrw ifrw;
- caddr_t ifw_base; /* virt addr of buffer */
- pt_entry_t ifw_wmap[IF_MAXNUBAMR]; /* base pages for output */
- struct mbuf *ifw_xtofree; /* pages being dma'd out */
- short ifw_xswapd; /* mask of clusters swapped */
- short ifw_nmr; /* number of entries in wmap */
-};
-#define ifw_addr ifrw.ifrw_addr
-#define ifw_bdp ifrw.ifrw_bdp
-#define ifw_flags ifrw.ifrw_flags
-#define ifw_info ifrw.ifrw_info
-#define ifw_proto ifrw.ifrw_proto
-#define ifw_mr ifrw.ifrw_mr
-
-/*
- * Most interfaces have a single receive and a single transmit buffer,
- * and use struct ifuba to store all of the unibus information.
- */
-struct ifuba {
- struct ifubinfo ifu_info;
- struct ifrw ifu_r;
- struct ifxmt ifu_xmt;
-};
-
-#define ifu_softc ifu_info.iff_softc
-#define ifu_hlen ifu_info.iff_hlen
-#define ifu_uba ifu_info.iff_uba
-#define ifu_ubamr ifu_info.iff_ubamr
-#define ifu_flags ifu_info.iff_flags
-#define ifu_w ifu_xmt.ifrw
-#define ifu_xtofree ifu_xmt.ifw_xtofree
-
-#ifdef _KERNEL
-#define if_ubainit(ifuba, uban, hlen, nmr) \
- if_ubaminit(&(ifuba)->ifu_info, uban, hlen, nmr, \
- &(ifuba)->ifu_r, 1, &(ifuba)->ifu_xmt, 1)
-#define if_rubaget(ifu, totlen, off0, ifp) \
- if_ubaget(&(ifu)->ifu_info, &(ifu)->ifu_r, totlen, off0, ifp)
-#define if_wubaput(ifu, m) \
- if_ubaput(&(ifu)->ifu_info, &(ifu)->ifu_xmt, m)
-
-/* Prototypes */
-int if_ubaminit(struct ifubinfo *, struct uba_softc *, int, int,
- struct ifrw *, int, struct ifxmt *, int);
-int if_ubaput(struct ifubinfo *, struct ifxmt *, struct mbuf *);
-struct mbuf *if_ubaget(struct ifubinfo *, struct ifrw *, int,
- struct ifnet *);
-
-#endif
diff --git a/sys/arch/vax/if/if_ze.c b/sys/arch/vax/if/if_ze.c
deleted file mode 100644
index 6087e7a7c16..00000000000
--- a/sys/arch/vax/if/if_ze.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* $OpenBSD: if_ze.c,v 1.11 2015/11/24 17:11:38 mpi Exp $ */
-/* $NetBSD: if_ze.c,v 1.3 2000/01/24 02:54:03 matt Exp $ */
-/*
- * Copyright (c) 1999 Ludd, University of Lule}, Sweden. 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/socket.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-#include <sys/sockio.h>
-
-#include <net/if.h>
-#include <net/if_media.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#include <machine/bus.h>
-#include <machine/nexus.h>
-#include <machine/cpu.h>
-#include <machine/scb.h>
-#include <machine/sid.h>
-
-#include <arch/vax/if/sgecreg.h>
-#include <arch/vax/if/sgecvar.h>
-
-/*
- * Addresses.
- */
-#define SGECADDR 0x20008000
-#define NISA_ROM 0x20084000
-#define SGECVEC 0x108
-
-static int zematch(struct device *, struct cfdata *, void *);
-static void zeattach(struct device *, struct device *, void *);
-
-struct cfattach ze_ibus_ca = {
- sizeof(struct ze_softc), (cfmatch_t)zematch, zeattach
-};
-
-/*
- * Check for present SGEC.
- */
-int
-zematch(parent, cf, aux)
- struct device *parent;
- struct cfdata *cf;
- void *aux;
-{
- struct bp_conf *bp = aux;
-
- /*
- * Should some more intelligent checking be done???
- */
- if (strcmp(bp->type, "sgec") == 0)
- return 1;
- return 0;
-}
-
-/*
- * Interface exists: make available by filling in network interface
- * record. System will initialize the interface when it is ready
- * to accept packets.
- */
-void
-zeattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- extern struct vax_bus_dma_tag vax_bus_dma_tag;
- struct ze_softc *sc = (struct ze_softc *)self;
- int *ea, i;
-
- /*
- * Map in SGEC registers.
- */
- sc->sc_ioh = vax_map_physmem(SGECADDR, 1);
- sc->sc_iot = 0; /* :-) */
- sc->sc_dmat = &vax_bus_dma_tag;
-
- sc->sc_intvec = SGECVEC;
-
- /*
- * Map in, read and release ethernet rom address.
- */
- ea = (int *)vax_map_physmem(NISA_ROM, 1);
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- if (vax_boardtype == VAX_BTYP_660)
- sc->sc_ac.ac_enaddr[i] = (ea[i] >> 24) & 0377;
- else
- sc->sc_ac.ac_enaddr[i] = (ea[i] >> 8) & 0377;
-
- vax_unmap_physmem((vaddr_t)ea, 1);
-
- scb_vecalloc(SGECVEC, (void (*)(void *)) sgec_intr, sc,
- SCB_ISTACK, &sc->sc_intrcnt);
- evcount_attach(&sc->sc_intrcnt, sc->sc_dev.dv_xname, &sc->sc_intvec);
-
- sgec_attach(sc);
-}
diff --git a/sys/arch/vax/if/sgec.c b/sys/arch/vax/if/sgec.c
deleted file mode 100644
index 204b78c8a09..00000000000
--- a/sys/arch/vax/if/sgec.c
+++ /dev/null
@@ -1,876 +0,0 @@
-/* $OpenBSD: sgec.c,v 1.35 2016/01/25 00:18:55 dlg Exp $ */
-/* $NetBSD: sgec.c,v 1.5 2000/06/04 02:14:14 matt Exp $ */
-/*
- * Copyright (c) 1999 Ludd, University of Lule}, Sweden. 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * Driver for the SGEC (Second Generation Ethernet Controller), sitting
- * on for example the VAX 4000/300 (KA670).
- *
- * The SGEC looks like a mixture of the DEQNA and the TULIP. Fun toy.
- *
- * Even though the chip is capable to use virtual addresses (read the
- * System Page Table directly) this driver doesn't do so, and there
- * is no benefit in doing it either in NetBSD of today.
- *
- * Things that is still to do:
- * Collect statistics.
- * Use imperfect filtering when many multicast addresses.
- */
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-#include <sys/sockio.h>
-
-#include <net/if.h>
-#include <net/if_media.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#endif
-
-#include <machine/bus.h>
-
-#include <vax/if/sgecreg.h>
-#include <vax/if/sgecvar.h>
-
-void sgec_rxintr(struct ze_softc *);
-void sgec_txintr(struct ze_softc *);
-void zeinit(struct ze_softc *);
-int zeioctl(struct ifnet *, u_long, caddr_t);
-int ze_ifmedia_change(struct ifnet *const);
-void ze_ifmedia_status(struct ifnet *const, struct ifmediareq *);
-void zekick(struct ze_softc *);
-int zereset(struct ze_softc *);
-void zestart(struct ifnet *);
-void zetimeout(struct ifnet *);
-int ze_add_rxbuf(struct ze_softc *, int);
-void ze_setup(struct ze_softc *);
-
-struct cfdriver ze_cd = {
- NULL, "ze", DV_IFNET
-};
-
-#define ZE_WCSR(csr, val) \
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, csr, val)
-#define ZE_RCSR(csr) \
- bus_space_read_4(sc->sc_iot, sc->sc_ioh, csr)
-
-/*
- * Interface exists: make available by filling in network interface
- * record. System will initialize the interface when it is ready
- * to accept packets.
- */
-void
-sgec_attach(sc)
- struct ze_softc *sc;
-{
- struct ifnet *ifp = (struct ifnet *)&sc->sc_if;
- struct ze_tdes *tp;
- struct ze_rdes *rp;
- bus_dma_segment_t seg;
- int i, s, rseg, error;
-
- /*
- * Allocate DMA safe memory for descriptors and setup memory.
- */
- if ((error = bus_dmamem_alloc(sc->sc_dmat,
- sizeof(struct ze_cdata), NBPG, 0, &seg, 1, &rseg,
- BUS_DMA_NOWAIT)) != 0) {
- printf(": unable to allocate control data, error = %d\n",
- error);
- goto fail_0;
- }
-
- if ((error = bus_dmamem_map(sc->sc_dmat, &seg, rseg,
- sizeof(struct ze_cdata), (caddr_t *)&sc->sc_zedata,
- BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) {
- printf(": unable to map control data, error = %d\n", error);
- goto fail_1;
- }
-
- if ((error = bus_dmamap_create(sc->sc_dmat,
- sizeof(struct ze_cdata), 1,
- sizeof(struct ze_cdata), 0, BUS_DMA_NOWAIT,
- &sc->sc_cmap)) != 0) {
- printf(": unable to create control data DMA map, error = %d\n",
- error);
- goto fail_2;
- }
-
- if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_cmap,
- sc->sc_zedata, sizeof(struct ze_cdata), NULL,
- BUS_DMA_NOWAIT)) != 0) {
- printf(": unable to load control data DMA map, error = %d\n",
- error);
- goto fail_3;
- }
-
- /*
- * Zero the newly allocated memory.
- */
- bzero(sc->sc_zedata, sizeof(struct ze_cdata));
- /*
- * Create the transmit descriptor DMA maps.
- */
- for (i = 0; i < TXDESCS; i++) {
- if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES,
- 1, MCLBYTES, 0, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW,
- &sc->sc_xmtmap[i]))) {
- printf(": unable to create tx DMA map %d, error = %d\n",
- i, error);
- goto fail_4;
- }
- }
-
- /*
- * Create receive buffer DMA maps.
- */
- for (i = 0; i < RXDESCS; i++) {
- if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1,
- MCLBYTES, 0, BUS_DMA_NOWAIT,
- &sc->sc_rcvmap[i]))) {
- printf(": unable to create rx DMA map %d, error = %d\n",
- i, error);
- goto fail_5;
- }
- }
- /*
- * Pre-allocate the receive buffers.
- */
- s = splnet();
- for (i = 0; i < RXDESCS; i++) {
- if ((error = ze_add_rxbuf(sc, i)) != 0) {
- printf(": unable to allocate or map rx buffer %d\n,"
- " error = %d\n", i, error);
- goto fail_6;
- }
- }
- splx(s);
-
- /*
- * Create ring loops of the buffer chains.
- * This is only done once.
- */
- sc->sc_pzedata = (struct ze_cdata *)sc->sc_cmap->dm_segs[0].ds_addr;
-
- rp = sc->sc_zedata->zc_recv;
- rp[RXDESCS].ze_framelen = ZE_FRAMELEN_OW;
- rp[RXDESCS].ze_rdes1 = ZE_RDES1_CA;
- rp[RXDESCS].ze_bufaddr = (char *)sc->sc_pzedata->zc_recv;
-
- tp = sc->sc_zedata->zc_xmit;
- tp[TXDESCS].ze_tdr = ZE_TDR_OW;
- tp[TXDESCS].ze_tdes1 = ZE_TDES1_CA;
- tp[TXDESCS].ze_bufaddr = (char *)sc->sc_pzedata->zc_xmit;
-
- if (zereset(sc))
- return;
-
- strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, sizeof ifp->if_xname);
- ifp->if_softc = sc;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_start = zestart;
- ifp->if_ioctl = zeioctl;
- ifp->if_watchdog = zetimeout;
-
- /*
- * Attach the interface.
- */
- if_attach(ifp);
- ether_ifattach(ifp);
-
- printf(": address %s\n", ether_sprintf(sc->sc_ac.ac_enaddr));
-
- ifmedia_init(&sc->sc_ifmedia, 0, ze_ifmedia_change,
- ze_ifmedia_status);
- ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_10_5, 0, 0);
- ifmedia_set(&sc->sc_ifmedia, IFM_ETHER | IFM_10_5);
- /* supposedly connected, and the first Tx attempt will let us know */
- sc->sc_flags |= SGECF_LINKUP;
- return;
-
- /*
- * Free any resources we've allocated during the failed attach
- * attempt. Do this in reverse order and fall through.
- */
- fail_6:
- for (i = 0; i < RXDESCS; i++) {
- if (sc->sc_rxmbuf[i] != NULL) {
- bus_dmamap_unload(sc->sc_dmat, sc->sc_rcvmap[i]);
- m_freem(sc->sc_rxmbuf[i]);
- }
- }
- fail_5:
- for (i = 0; i < RXDESCS; i++) {
- if (sc->sc_rcvmap[i] != NULL)
- bus_dmamap_destroy(sc->sc_dmat, sc->sc_rcvmap[i]);
- }
- fail_4:
- for (i = 0; i < TXDESCS; i++) {
- if (sc->sc_xmtmap[i] != NULL)
- bus_dmamap_destroy(sc->sc_dmat, sc->sc_xmtmap[i]);
- }
- bus_dmamap_unload(sc->sc_dmat, sc->sc_cmap);
- fail_3:
- bus_dmamap_destroy(sc->sc_dmat, sc->sc_cmap);
- fail_2:
- bus_dmamem_unmap(sc->sc_dmat, (caddr_t)sc->sc_zedata,
- sizeof(struct ze_cdata));
- fail_1:
- bus_dmamem_free(sc->sc_dmat, &seg, rseg);
- fail_0:
- return;
-}
-
-int
-ze_ifmedia_change(struct ifnet *const ifp)
-{
- return (0);
-}
-
-void
-ze_ifmedia_status(struct ifnet *const ifp, struct ifmediareq *req)
-{
- struct ze_softc *sc = ifp->if_softc;
-
- req->ifm_status = IFM_AVALID;
- if (sc->sc_flags & SGECF_LINKUP)
- req->ifm_status |= IFM_ACTIVE;
- req->ifm_active = IFM_10_5 | IFM_ETHER;
-}
-
-/*
- * Initialization of interface.
- */
-void
-zeinit(sc)
- struct ze_softc *sc;
-{
- struct ifnet *ifp = (struct ifnet *)&sc->sc_if;
- struct ze_cdata *zc = sc->sc_zedata;
- int i;
-
- /*
- * Reset the interface.
- */
- if (zereset(sc))
- return;
-
- sc->sc_nexttx = sc->sc_inq = sc->sc_lastack = 0;
- /*
- * Release and init transmit descriptors.
- */
- for (i = 0; i < TXDESCS; i++) {
- if (sc->sc_txmbuf[i]) {
- bus_dmamap_unload(sc->sc_dmat, sc->sc_xmtmap[i]);
- m_freem(sc->sc_txmbuf[i]);
- sc->sc_txmbuf[i] = 0;
- }
- zc->zc_xmit[i].ze_tdr = 0; /* Clear valid bit */
- }
-
-
- /*
- * Init receive descriptors.
- */
- for (i = 0; i < RXDESCS; i++)
- zc->zc_recv[i].ze_framelen = ZE_FRAMELEN_OW;
- sc->sc_nextrx = 0;
-
- ZE_WCSR(ZE_CSR6, ZE_NICSR6_IE | ZE_NICSR6_BL_8 | ZE_NICSR6_ST |
- ZE_NICSR6_SR | ZE_NICSR6_DC);
-
- ifp->if_flags |= IFF_RUNNING;
- ifq_clr_oactive(&ifp->if_snd);
-
- /*
- * Send a setup frame.
- * This will start the transmit machinery as well.
- */
- ze_setup(sc);
-
-}
-
-/*
- * Kick off the transmit logic, if it is stopped.
- * On the VXT2000 we need to always reprogram CSR4,
- * so stop it unconditionnaly.
- */
-void
-zekick(struct ze_softc *sc)
-{
- u_int csr5;
-
- csr5 = ZE_RCSR(ZE_CSR5);
- if (ISSET(sc->sc_flags, SGECF_VXTQUIRKS)) {
- if ((csr5 & ZE_NICSR5_TS) == ZE_NICSR5_TS_RUN) {
- ZE_WCSR(ZE_CSR6, ZE_RCSR(ZE_CSR6) & ~ZE_NICSR6_ST);
- while ((ZE_RCSR(ZE_CSR5) & ZE_NICSR5_TS) !=
- ZE_NICSR5_TS_STOP)
- DELAY(10);
- }
- ZE_WCSR(ZE_CSR4,
- (vaddr_t)&sc->sc_pzedata->zc_xmit[sc->sc_nexttx]);
- ZE_WCSR(ZE_CSR1, ZE_NICSR1_TXPD);
- if ((csr5 & ZE_NICSR5_TS) == ZE_NICSR5_TS_RUN) {
- ZE_WCSR(ZE_CSR6, ZE_RCSR(ZE_CSR6) | ZE_NICSR6_ST);
- while ((ZE_RCSR(ZE_CSR5) & ZE_NICSR5_TS) ==
- ZE_NICSR5_TS_STOP)
- DELAY(10);
- }
- } else {
- if ((csr5 & ZE_NICSR5_TS) != ZE_NICSR5_TS_RUN)
- ZE_WCSR(ZE_CSR1, ZE_NICSR1_TXPD);
- }
-}
-
-/*
- * Start output on interface.
- */
-void
-zestart(ifp)
- struct ifnet *ifp;
-{
- struct ze_softc *sc = ifp->if_softc;
- struct ze_cdata *zc = sc->sc_zedata;
- paddr_t buffer;
- struct mbuf *m, *m0;
- int idx, len, s, i, totlen, error;
- int old_inq = sc->sc_inq;
- short orword;
-
- s = splnet();
- while (sc->sc_inq < (TXDESCS - 1)) {
- if (ISSET(sc->sc_flags, SGECF_SETUP)) {
- ze_setup(sc);
- continue;
- }
- idx = sc->sc_nexttx;
- m = ifq_deq_begin(&ifp->if_snd);
- if (m == NULL)
- goto out;
- /*
- * Count number of mbufs in chain.
- * Always do DMA directly from mbufs, therefore the transmit
- * ring is really big.
- */
- for (m0 = m, i = 0; m0; m0 = m0->m_next)
- if (m0->m_len)
- i++;
- if (i >= TXDESCS)
- panic("zestart"); /* XXX */
-
- if ((i + sc->sc_inq) >= (TXDESCS - 1)) {
- ifq_set_oactive(&ifp->if_snd);
- ifq_deq_rollback(&ifp->if_snd, m);
- goto out;
- }
- ifq_deq_commit(&ifp->if_snd, m);
-
-#if NBPFILTER > 0
- if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
-#endif
- /*
- * m now points to a mbuf chain that can be loaded.
- * Loop around and set it.
- */
- totlen = 0;
- orword = ZE_TDES1_FS;
- for (m0 = m; m0; m0 = m0->m_next) {
- error = bus_dmamap_load(sc->sc_dmat, sc->sc_xmtmap[idx],
- mtod(m0, void *), m0->m_len, 0, 0);
- buffer = sc->sc_xmtmap[idx]->dm_segs[0].ds_addr;
- len = m0->m_len;
- if (len == 0)
- continue;
-
- totlen += len;
- /* Word alignment calc */
- if (totlen == m->m_pkthdr.len) {
- if (totlen < ETHER_ADDR_LEN)
- len += (ETHER_ADDR_LEN - totlen);
- orword |= ZE_TDES1_LS;
- sc->sc_txmbuf[idx] = m;
- }
- zc->zc_xmit[idx].ze_bufsize = len;
- zc->zc_xmit[idx].ze_bufaddr = (char *)buffer;
- zc->zc_xmit[idx].ze_tdes1 = orword | ZE_TDES1_IC;
- zc->zc_xmit[idx].ze_tdr = ZE_TDR_OW;
-
- if (++idx == TXDESCS)
- idx = 0;
- sc->sc_inq++;
- orword = 0;
- }
-#ifdef DIAGNOSTIC
- if (totlen != m->m_pkthdr.len)
- panic("zestart: len fault");
-#endif
-
- /*
- * Kick off the transmit logic, if it is stopped.
- */
- zekick(sc);
- sc->sc_nexttx = idx;
- }
- if (sc->sc_inq == (TXDESCS - 1))
- ifq_set_oactive(&ifp->if_snd);
-
-out: if (old_inq < sc->sc_inq)
- ifp->if_timer = 5; /* If transmit logic dies */
- splx(s);
-}
-
-void
-sgec_rxintr(struct ze_softc *sc)
-{
- struct ze_cdata *zc = sc->sc_zedata;
- struct ifnet *ifp = &sc->sc_if;
- struct mbuf_list ml = MBUF_LIST_INITIALIZER();
- struct mbuf *m;
- u_short rdes0;
- int len;
-
- while ((zc->zc_recv[sc->sc_nextrx].ze_framelen &
- ZE_FRAMELEN_OW) == 0) {
- rdes0 = zc->zc_recv[sc->sc_nextrx].ze_rdes0;
- if (rdes0 & ZE_RDES0_ES) {
- rdes0 &= ~ZE_RDES0_TL; /* not really an error */
- if ((rdes0 & (ZE_RDES0_OF | ZE_RDES0_CE | ZE_RDES0_CS |
- ZE_RDES0_LE | ZE_RDES0_RF)) == 0)
- rdes0 &= ~ZE_RDES0_ES;
- }
- if (rdes0 & ZE_RDES0_ES) {
- ifp->if_ierrors++;
- if (rdes0 & ZE_RDES0_CS)
- ifp->if_collisions++;
- m = NULL;
- } else {
- m = sc->sc_rxmbuf[sc->sc_nextrx];
- len = zc->zc_recv[sc->sc_nextrx].ze_framelen;
- }
- ze_add_rxbuf(sc, sc->sc_nextrx);
- if (m != NULL) {
- m->m_pkthdr.len = m->m_len = len;
- ml_enqueue(&ml, m);
- }
- if (++sc->sc_nextrx == RXDESCS)
- sc->sc_nextrx = 0;
- }
- if_input(ifp, &ml);
-}
-
-void
-sgec_txintr(struct ze_softc *sc)
-{
- struct ze_cdata *zc = sc->sc_zedata;
- struct ifnet *ifp = &sc->sc_if;
- int oldlink = sc->sc_flags & SGECF_LINKUP;
- u_short tdes0;
-
- while ((zc->zc_xmit[sc->sc_lastack].ze_tdr & ZE_TDR_OW) == 0) {
- int idx = sc->sc_lastack;
-
- if (sc->sc_lastack == sc->sc_nexttx)
- break;
- sc->sc_inq--;
- if (++sc->sc_lastack == TXDESCS)
- sc->sc_lastack = 0;
-
- if ((zc->zc_xmit[idx].ze_tdes1 & ZE_TDES1_DT) ==
- ZE_TDES1_DT_SETUP) {
- continue;
- }
-
- tdes0 = zc->zc_xmit[idx].ze_tdes0;
- if (tdes0 & ZE_TDES0_ES) {
- if (tdes0 & ZE_TDES0_TO)
- printf("%s: transmit watchdog timeout\n",
- sc->sc_dev.dv_xname);
- if (tdes0 & (ZE_TDES0_LO | ZE_TDES0_NC))
- sc->sc_flags &= ~SGECF_LINKUP;
- else
- sc->sc_flags |= SGECF_LINKUP;
- if (tdes0 & ZE_TDES0_EC) {
- printf("%s: excessive collisions, tdr %d\n",
- sc->sc_dev.dv_xname,
- zc->zc_xmit[idx].ze_tdr & ~ZE_TDR_OW);
- ifp->if_collisions += 16;
- } else if (tdes0 & ZE_TDES0_LC)
- ifp->if_collisions +=
- (tdes0 & ZE_TDES0_CC) >> 3;
- if (tdes0 & ZE_TDES0_UF)
- printf("%s: underflow\n", sc->sc_dev.dv_xname);
- ifp->if_oerrors++;
- if (tdes0 & (ZE_TDES0_TO | ZE_TDES0_UF))
- zeinit(sc);
- } else {
- sc->sc_flags |= SGECF_LINKUP;
- if (zc->zc_xmit[idx].ze_tdes1 & ZE_TDES1_LS)
- ifp->if_opackets++;
- bus_dmamap_unload(sc->sc_dmat, sc->sc_xmtmap[idx]);
- if (sc->sc_txmbuf[idx]) {
- m_freem(sc->sc_txmbuf[idx]);
- sc->sc_txmbuf[idx] = 0;
- }
- }
- }
-
- /* Notify link status change */
- if ((sc->sc_flags & SGECF_LINKUP) != oldlink) {
- if (oldlink != 0) {
- ifp->if_link_state = LINK_STATE_DOWN;
- ifp->if_baudrate = 0;
- } else {
- ifp->if_link_state = LINK_STATE_UP;
- ifp->if_baudrate = IF_Mbps(10);
- }
- if_link_state_change(ifp);
- }
-
- if (sc->sc_inq == 0)
- ifp->if_timer = 0;
- ifq_clr_oactive(&ifp->if_snd);
- zestart(ifp); /* Put in more in queue */
-}
-
-int
-sgec_intr(sc)
- struct ze_softc *sc;
-{
- int s, csr;
-
- csr = ZE_RCSR(ZE_CSR5);
- if ((csr & ZE_NICSR5_IS) == 0) /* Wasn't we */
- return 0;
-
- /*
- * On some systems, interrupts are handled at spl4, this can end up
- * in pool corruption.
- */
- s = splnet();
-
- ZE_WCSR(ZE_CSR5, csr);
-
- if (csr & ZE_NICSR5_ME) {
- printf("%s: memory error, resetting\n", sc->sc_dev.dv_xname);
- zeinit(sc);
- splx(s);
- return (1);
- }
-
- if (csr & ZE_NICSR5_RI)
- sgec_rxintr(sc);
-
- if (csr & ZE_NICSR5_TI)
- sgec_txintr(sc);
-
- splx(s);
-
- return 1;
-}
-
-/*
- * Process an ioctl request.
- */
-int
-zeioctl(ifp, cmd, data)
- struct ifnet *ifp;
- u_long cmd;
- caddr_t data;
-{
- struct ze_softc *sc = ifp->if_softc;
- struct ifreq *ifr = (struct ifreq *)data;
- int s, error = 0;
-
- s = splnet();
-
- switch (cmd) {
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
- zeinit(sc);
- break;
-
- case SIOCSIFMEDIA:
- case SIOCGIFMEDIA:
- error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, cmd);
- break;
-
- case SIOCSIFFLAGS:
- if ((ifp->if_flags & IFF_UP) == 0 &&
- (ifp->if_flags & IFF_RUNNING) != 0) {
- /*
- * If interface is marked down and it is running,
- * stop it. (by disabling receive mechanism).
- */
- ZE_WCSR(ZE_CSR6, ZE_RCSR(ZE_CSR6) &
- ~(ZE_NICSR6_ST|ZE_NICSR6_SR));
- ifp->if_flags &= ~IFF_RUNNING;
- } else if ((ifp->if_flags & IFF_UP) != 0 &&
- (ifp->if_flags & IFF_RUNNING) == 0) {
- /*
- * If interface it marked up and it is stopped, then
- * start it.
- */
- zeinit(sc);
- } else if ((ifp->if_flags & IFF_UP) != 0) {
- /*
- * Send a new setup packet to match any new changes.
- * (Like IFF_PROMISC etc)
- */
- ze_setup(sc);
- }
- break;
-
- default:
- error = ether_ioctl(ifp, &sc->sc_ac, cmd, data);
- }
-
- if (error == ENETRESET) {
- if (ifp->if_flags & IFF_RUNNING)
- ze_setup(sc);
- error = 0;
- }
-
- splx(s);
- return (error);
-}
-
-/*
- * Add a receive buffer to the indicated descriptor.
- */
-int
-ze_add_rxbuf(sc, i)
- struct ze_softc *sc;
- int i;
-{
- struct mbuf *m;
- struct ze_rdes *rp;
- int error;
-
- splassert(IPL_NET);
-
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == NULL)
- return (ENOBUFS);
-
- MCLGET(m, M_DONTWAIT);
- if ((m->m_flags & M_EXT) == 0) {
- m_freem(m);
- return (ENOBUFS);
- }
-
- if (sc->sc_rxmbuf[i] != NULL)
- bus_dmamap_unload(sc->sc_dmat, sc->sc_rcvmap[i]);
-
- error = bus_dmamap_load(sc->sc_dmat, sc->sc_rcvmap[i],
- m->m_ext.ext_buf, m->m_ext.ext_size, NULL, BUS_DMA_NOWAIT);
- if (error)
- panic("%s: can't load rx DMA map %d, error = %d",
- sc->sc_dev.dv_xname, i, error);
- sc->sc_rxmbuf[i] = m;
-
- bus_dmamap_sync(sc->sc_dmat, sc->sc_rcvmap[i], 0,
- sc->sc_rcvmap[i]->dm_mapsize, BUS_DMASYNC_PREREAD);
-
- /*
- * We know that the mbuf cluster is page aligned. Also, be sure
- * that the IP header will be longword aligned.
- */
- m->m_data += 2;
- rp = &sc->sc_zedata->zc_recv[i];
- rp->ze_bufsize = (m->m_ext.ext_size - 2);
- rp->ze_bufaddr = (char *)sc->sc_rcvmap[i]->dm_segs[0].ds_addr + 2;
- rp->ze_framelen = ZE_FRAMELEN_OW;
-
- return (0);
-}
-
-/*
- * Create a setup packet and put in queue for sending.
- */
-void
-ze_setup(sc)
- struct ze_softc *sc;
-{
- struct ether_multi *enm;
- struct ether_multistep step;
- struct ze_cdata *zc = sc->sc_zedata;
- struct ifnet *ifp = &sc->sc_if;
- struct arpcom *ac = &sc->sc_ac;
- u_int8_t *enaddr = ac->ac_enaddr;
- int j, idx, s, reg;
-
- s = splnet();
- if (sc->sc_inq == (TXDESCS - 1)) {
- SET(sc->sc_flags, SGECF_SETUP);
- splx(s);
- return;
- }
- CLR(sc->sc_flags, SGECF_SETUP);
-
- /*
- * Init the setup packet with valid info.
- */
- memset(zc->zc_setup, 0xff, sizeof(zc->zc_setup)); /* Broadcast */
- bcopy(enaddr, zc->zc_setup, ETHER_ADDR_LEN);
-
- /*
- * Multicast handling. The SGEC can handle up to 16 direct
- * ethernet addresses.
- */
- j = 16;
- ifp->if_flags &= ~IFF_ALLMULTI;
-
- if (ac->ac_multirangecnt > 0) {
- ifp->if_flags |= IFF_ALLMULTI;
- goto setit;
- }
-
- ETHER_FIRST_MULTI(step, ac, enm);
- while (enm != NULL) {
- bcopy(enm->enm_addrlo, &zc->zc_setup[j], ETHER_ADDR_LEN);
- j += 8;
- ETHER_NEXT_MULTI(step, enm);
- if (enm != NULL && j == sizeof(zc->zc_setup)) {
- ifp->if_flags |= IFF_ALLMULTI;
- break;
- }
- }
-
-setit:
- /*
- * Fiddle with the receive logic.
- */
- reg = ZE_RCSR(ZE_CSR6);
- DELAY(10);
- ZE_WCSR(ZE_CSR6, reg & ~ZE_NICSR6_SR); /* Stop rx */
- while ((ZE_RCSR(ZE_CSR5) & ZE_NICSR5_RS) != ZE_NICSR5_RS_STOP)
- DELAY(10);
- reg &= ~ZE_NICSR6_AF;
- if (ifp->if_flags & IFF_PROMISC)
- reg |= ZE_NICSR6_AF_PROM;
- else if (ifp->if_flags & IFF_ALLMULTI)
- reg |= ZE_NICSR6_AF_ALLM;
- DELAY(10);
- ZE_WCSR(ZE_CSR6, reg);
- while ((ZE_RCSR(ZE_CSR5) & ZE_NICSR5_RS) == ZE_NICSR5_RS_STOP)
- DELAY(10);
- /*
- * Only send a setup packet if needed.
- */
- if ((ifp->if_flags & (IFF_PROMISC|IFF_ALLMULTI)) == 0) {
- idx = sc->sc_nexttx;
- zc->zc_xmit[idx].ze_tdes1 = ZE_TDES1_DT_SETUP;
- zc->zc_xmit[idx].ze_bufsize = 128;
- zc->zc_xmit[idx].ze_bufaddr = sc->sc_pzedata->zc_setup;
- zc->zc_xmit[idx].ze_tdr = ZE_TDR_OW;
-
- zekick(sc);
-
- sc->sc_inq++;
- if (++sc->sc_nexttx == TXDESCS)
- sc->sc_nexttx = 0;
- }
- splx(s);
-}
-
-/*
- * Check for dead transmit logic.
- */
-void
-zetimeout(ifp)
- struct ifnet *ifp;
-{
- struct ze_softc *sc = ifp->if_softc;
-
- if (sc->sc_inq == 0)
- return;
-
- printf("%s: xmit logic died, resetting...\n", sc->sc_dev.dv_xname);
- /*
- * Do a reset of interface, to get it going again.
- * Will it work by just restart the transmit logic?
- */
- zeinit(sc);
-}
-
-/*
- * Reset chip:
- * Set/reset the reset flag.
- * Write interrupt vector.
- * Write ring buffer addresses.
- * Write SBR.
- */
-int
-zereset(sc)
- struct ze_softc *sc;
-{
- int reg, i, s;
-
- ZE_WCSR(ZE_CSR6, ZE_NICSR6_RE);
- DELAY(50000);
- if (ZE_RCSR(ZE_CSR5) & ZE_NICSR5_SF) {
- printf("%s: selftest failed\n", sc->sc_dev.dv_xname);
- return 1;
- }
-
- /*
- * Get the vector that were set at match time, and remember it.
- * WHICH VECTOR TO USE? Take one unused. XXX
- * Funny way to set vector described in the programmers manual.
- */
- reg = ZE_NICSR0_IPL14 | sc->sc_intvec | ZE_NICSR0_MBO; /* SYNC/ASYNC??? */
- i = 10;
- s = splnet();
- do {
- if (i-- == 0) {
- printf("Failing SGEC CSR0 init\n");
- splx(s);
- return 1;
- }
- ZE_WCSR(ZE_CSR0, reg);
- } while (ZE_RCSR(ZE_CSR0) != reg);
- splx(s);
-
- ZE_WCSR(ZE_CSR3, (vaddr_t)sc->sc_pzedata->zc_recv);
- ZE_WCSR(ZE_CSR4, (vaddr_t)sc->sc_pzedata->zc_xmit);
- return 0;
-}
diff --git a/sys/arch/vax/if/sgecreg.h b/sys/arch/vax/if/sgecreg.h
deleted file mode 100644
index 75eb248d6f3..00000000000
--- a/sys/arch/vax/if/sgecreg.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/* $OpenBSD: sgecreg.h,v 1.4 2011/09/26 21:44:04 miod Exp $ */
-/* $NetBSD: sgecreg.h,v 1.1 1999/08/08 11:41:29 ragge Exp $ */
-/*
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Digital Equipment Corp.
- *
- * 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.
- *
- */
-
-
-/* Driver for SGEC (second generation Ethernet controller) chip, type DC-541,
- found on the KA670 (and probably other) CPU.
-
- 17 May 1998...Jay Maynard, jmaynard@phoenix.net
-*/
-
-/* SGEC CSRs */
-struct zedevice {
- u_long ze_nicsr0; /* vector address, IPL, sync mode */
- u_long ze_nicsr1; /* TX poll demand */
- u_long ze_nicsr2; /* RX poll demand */
- struct ze_rdes *ze_nicsr3; /* RX descriptor list address */
- struct ze_tdes *ze_nicsr4; /* TX descriptor list address */
- u_long ze_nicsr5; /* SGEC status */
- u_long ze_nicsr6; /* SGEC command/mode */
- u_long ze_nicsr7; /* system page table base address */
- u_long ze_nivcsr8; /* reserved virtual CSR */
- u_long ze_nivcsr9; /* watchdog timers (virtual) */
- u_long ze_nivcsr10; /* revision, missed frame count (v) */
- u_long ze_nivcsr11; /* boot message verification (low) (v) */
- u_long ze_nivcsr12; /* boot message verification (high) (v) */
- u_long ze_nivcsr13; /* boot message processor (v) */
- u_long ze_nivcsr14; /* diagnostic breakpoint (v) */
- u_long ze_nicsr15; /* monitor command */
-};
-
-/*
- * Register offsets.
- */
-#define ZE_CSR0 0
-#define ZE_CSR1 4
-#define ZE_CSR2 8
-#define ZE_CSR3 12
-#define ZE_CSR4 16
-#define ZE_CSR5 20
-#define ZE_CSR6 24
-#define ZE_CSR7 28
-#define ZE_CSR8 32
-#define ZE_CSR9 36
-#define ZE_CSR10 40
-#define ZE_CSR11 44
-#define ZE_CSR12 48
-#define ZE_CSR13 52
-#define ZE_CSR14 56
-#define ZE_CSR15 60
-
-/* SGEC bit definitions */
-/* NICSR0: */
-#define ZE_NICSR0_IPL 0xc0000000 /* interrupt priority level: */
-#define ZE_NICSR0_IPL14 0x00000000 /* 0x14 */
-#define ZE_NICSR0_IPL15 0x40000000 /* 0x15 */
-#define ZE_NICSR0_IPL16 0x80000000 /* 0x16 */
-#define ZE_NICSR0_IPL17 0xc0000000 /* 0x17 */
-#define ZE_NICSR0_SA 0x20000000 /* sync(1)/async mode */
-#define ZE_NICSR0_MBO 0x1fff0003 /* must be set to one on write */
-#define ZE_NICSR0_IV_MASK 0x0000fffc /* bits for the interrupt vector */
-
-/* NICSR1: */
-#define ZE_NICSR1_TXPD 0xffffffff /* transmit polling demand */
-
-/* NICSR2: */
-#define ZE_NICSR2_RXPD 0xffffffff /* receive polling demand */
-
-/* NICSR3 and NICSR4 are pure addresses */
-/* NICSR5: */
-#define ZE_NICSR5_ID 0x80000000 /* init done */
-#define ZE_NICSR5_SF 0x40000000 /* self-test failed */
-#define ZE_NICSR5_SS 0x3c000000 /* self-test status field */
-#define ZE_NICSR5_TS 0x03000000 /* transmission state: */
-#define ZE_NICSR5_TS_STOP 0x00000000 /* stopped */
-#define ZE_NICSR5_TS_RUN 0x01000000 /* running */
-#define ZE_NICSR5_TS_SUSP 0x02000000 /* suspended */
-#define ZE_NICSR5_RS 0x00c00000 /* reception state: */
-#define ZE_NICSR5_RS_STOP 0x00000000 /* stopped */
-#define ZE_NICSR5_RS_RUN 0x00400000 /* running */
-#define ZE_NICSR5_RS_SUSP 0x00800000 /* suspended */
-#define ZE_NICSR5_OM 0x00060000 /* operating mode: */
-#define ZE_NICSR5_OM_NORM 0x00000000 /* normal */
-#define ZE_NICSR5_OM_ILBK 0x00020000 /* internal loopback */
-#define ZE_NICSR5_OM_ELBK 0x00040000 /* external loopback */
-#define ZE_NICSR5_OM_DIAG 0x00060000 /* reserved for diags */
-#define ZE_NICSR5_DN 0x00010000 /* virtual CSR access done */
-#define ZE_NICSR5_MBO 0x0038ff00 /* must be one */
-#define ZE_NICSR5_BO 0x00000080 /* boot message received */
-#define ZE_NICSR5_TW 0x00000040 /* transmit watchdog timeout */
-#define ZE_NICSR5_RW 0x00000020 /* receive watchdog timeout */
-#define ZE_NICSR5_ME 0x00000010 /* memory error */
-#define ZE_NICSR5_RU 0x00000008 /* receive buffer unavailable */
-#define ZE_NICSR5_RI 0x00000004 /* receiver interrupt */
-#define ZE_NICSR5_TI 0x00000002 /* transmitter interrupt */
-#define ZE_NICSR5_IS 0x00000001 /* interrupt summary */
-/* whew! */
-
-/* NICSR6: */
-#define ZE_NICSR6_RE 0x80000000 /* reset */
-#define ZE_NICSR6_IE 0x40000000 /* interrupt enable */
-#define ZE_NICSR6_MBO 0x01e7f000 /* must be one */
-#define ZE_NICSR6_BL 0x1e000000 /* burst limit mask */
-#define ZE_NICSR6_BL_8 0x10000000 /* 8 longwords */
-#define ZE_NICSR6_BL_4 0x08000000 /* 4 longwords */
-#define ZE_NICSR6_BL_2 0x04000000 /* 2 longwords */
-#define ZE_NICSR6_BL_1 0x02000000 /* 1 longword */
-#define ZE_NICSR6_BE 0x00100000 /* boot message enable */
-#define ZE_NICSR6_SE 0x00080000 /* single cycle enable */
-#define ZE_NICSR6_ST 0x00000800 /* start(1)/stop(0) transmission */
-#define ZE_NICSR6_SR 0x00000400 /* start(1)/stop(0) reception */
-#define ZE_NICSR6_OM 0x00000300 /* operating mode: */
-#define ZE_NICSR6_OM_NORM 0x00000000 /* normal */
-#define ZE_NICSR6_OM_ILBK 0x00000100 /* internal loopback */
-#define ZE_NICSR6_OM_ELBK 0x00000200 /* external loopback */
-#define ZE_NICSR6_OM_DIAG 0x00000300 /* reserved for diags */
-#define ZE_NICSR6_DC 0x00000080 /* disable data chaining */
-#define ZE_NICSR6_FC 0x00000040 /* force collision mode */
-#define ZE_NICSR6_PB 0x00000008 /* pass bad frames */
-#define ZE_NICSR6_AF 0x00000006 /* address filtering mode: */
-#define ZE_NICSR6_AF_NORM 0x00000000 /* normal filtering */
-#define ZE_NICSR6_AF_PROM 0x00000002 /* promiscuous mode */
-#define ZE_NICSR6_AF_ALLM 0x00000004 /* all multicasts */
-
-/* NICSR7 is an address, NICSR8 is reserved */
-/* NICSR9: */
-#define ZE_VNICSR9_RT 0xffff0000 /* receiver timeout, *1.6 us */
-#define ZE_VNICSR9_TT 0x0000ffff /* transmitter timeout */
-
-/* NICSR10: */
-#define ZE_VNICSR10_RN 0x001f0000 /* SGEC version */
-#define ZE_VNICSR10_MFC 0x0000ffff /* missed frame counter */
-
-/* if you want to know what's in NICSRs 11-15, define them yourself! */
-
-/* Descriptors: */
-/* Receive descriptor */
-struct ze_rdes {
- u_short ze_rdes0; /* descriptor word 0 flags */
- u_short ze_framelen; /* received frame length */
- u_char ze_rsvd1[3]; /* unused bytes */
- u_char ze_rdes1; /* descriptor word 1 flags */
- short ze_pageoffset; /* offset of buffer in page */
- short ze_bufsize; /* length of data buffer */
- u_char *ze_bufaddr; /* address of data buffer */
-};
-
-/* Receive descriptor bits */
-#define ZE_FRAMELEN_OW 0x8000 /* SGEC owns this descriptor */
-#define ZE_RDES0_ES 0x8000 /* an error has occurred */
-#define ZE_RDES0_LE 0x4000 /* length error */
-#define ZE_RDES0_DT 0x3000 /* data type: */
-#define ZE_RDES0_DT_NORM 0x0000 /* normal frame */
-#define ZE_RDES0_DT_ILBK 0x1000 /* internally looped back frame */
-#define ZE_RDES0_DT_ELBK 0x2000 /* externally looped back frame */
-#define ZE_RDES0_RF 0x0800 /* runt frame */
-#define ZE_RDES0_BO 0x0400 /* buffer overflow */
-#define ZE_RDES0_FS 0x0200 /* first segment */
-#define ZE_RDES0_LS 0x0100 /* last segment */
-#define ZE_RDES0_TL 0x0080 /* frame too long */
-#define ZE_RDES0_CS 0x0040 /* collision seen */
-#define ZE_RDES0_FT 0x0020 /* Ethernet frame type */
-#define ZE_RDES0_TN 0x0008 /* address translation not valid */
-#define ZE_RDES0_DB 0x0004 /* dribbling bits seen */
-#define ZE_RDES0_CE 0x0002 /* CRC error */
-#define ZE_RDES0_OF 0x0001 /* internal FIFO overflow */
-#define ZE_RDES1_CA 0x80 /* chain address */
-#define ZE_RDES1_VA 0x40 /* virtual address */
-#define ZE_RDES1_VT 0x20 /* virtual(1)/phys PTE address */
-
-/* Transmit descriptor */
-struct ze_tdes {
- u_short ze_tdes0; /* descriptor word 0 flags */
- u_short ze_tdr; /* TDR count of cable fault */
- u_char ze_rsvd1[2]; /* unused bytes */
- u_short ze_tdes1; /* descriptor word 1 flags */
- short ze_pageoffset; /* offset of buffer in page */
- short ze_bufsize; /* length of data buffer */
- u_char *ze_bufaddr; /* address of data buffer */
-};
-
-/* Transmit descriptor bits */
-#define ZE_TDR_OW 0x8000 /* SGEC owns this descriptor */
-#define ZE_TDES0_ES 0x8000 /* an error has occurred */
-#define ZE_TDES0_TO 0x4000 /* transmit watchdog timeout */
-#define ZE_TDES0_LE 0x1000 /* length error */
-#define ZE_TDES0_LO 0x0800 /* loss of carrier */
-#define ZE_TDES0_NC 0x0400 /* no carrier */
-#define ZE_TDES0_LC 0x0200 /* late collision */
-#define ZE_TDES0_EC 0x0100 /* excessive collisions */
-#define ZE_TDES0_HF 0x0080 /* heartbeat fail */
-#define ZE_TDES0_CC 0x0078 /* collision count mask */
-#define ZE_TDES0_TN 0x0004 /* address translation invalid */
-#define ZE_TDES0_UF 0x0002 /* underflow */
-#define ZE_TDES0_DE 0x0001 /* transmission deferred */
-#define ZE_TDES1_CA 0x8000 /* chain address */
-#define ZE_TDES1_VA 0x4000 /* virtual address */
-#define ZE_TDES1_DT 0x3000 /* data type: */
-#define ZE_TDES1_DT_NORM 0x0000 /* normal transmit frame */
-#define ZE_TDES1_DT_SETUP 0x2000 /* setup frame */
-#define ZE_TDES1_DT_DIAG 0x3000 /* diagnostic frame */
-#define ZE_TDES1_AC 0x0800 /* CRC disable */
-#define ZE_TDES1_FS 0x0400 /* first segment */
-#define ZE_TDES1_LS 0x0200 /* last segment */
-#define ZE_TDES1_IC 0x0100 /* interrupt on completion */
-#define ZE_TDES1_VT 0x0080 /* virtual(1)/phys PTE address */
-
diff --git a/sys/arch/vax/if/sgecvar.h b/sys/arch/vax/if/sgecvar.h
deleted file mode 100644
index 9418bcff3d1..00000000000
--- a/sys/arch/vax/if/sgecvar.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $OpenBSD: sgecvar.h,v 1.6 2008/08/22 17:09:06 deraadt Exp $ */
-/* $NetBSD: sgecvar.h,v 1.2 2000/06/04 02:14:14 matt Exp $ */
-/*
- * Copyright (c) 1999 Ludd, University of Lule}, Sweden. 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-#define RXDESCS 30 /* # of receive descriptors */
-#define TXDESCS 60 /* # transmit descs */
-
-/*
- * Descriptors must be an even number; optimisation thing.
- */
-struct ze_cdata {
- struct ze_rdes zc_recv[RXDESCS+2]; /* Receive descriptors */
- struct ze_tdes zc_xmit[TXDESCS+2]; /* Transmit descriptors */
- u_int8_t zc_setup[128]; /* Setup packet layout */
-};
-
-struct ze_softc {
- struct device sc_dev; /* Configuration common part */
- struct evcount sc_intrcnt; /* Interrupt counters */
- struct arpcom sc_ac; /* Ethernet common part */
-#define sc_if sc_ac.ac_if /* network-visible interface */
- struct ifmedia sc_ifmedia;
- bus_space_tag_t sc_iot;
- bus_addr_t sc_ioh;
- bus_dma_tag_t sc_dmat;
- struct ze_cdata *sc_zedata; /* Descriptor struct */
- struct ze_cdata *sc_pzedata; /* Physical address of above */
- bus_dmamap_t sc_cmap; /* Map for control structures */
- struct mbuf* sc_txmbuf[TXDESCS];
- struct mbuf* sc_rxmbuf[RXDESCS];
- bus_dmamap_t sc_xmtmap[TXDESCS];
- bus_dmamap_t sc_rcvmap[RXDESCS];
- int sc_intvec; /* Interrupt vector */
- int sc_nexttx;
- int sc_inq;
- int sc_lastack;
- int sc_nextrx;
- int sc_flags;
-#define SGECF_SETUP 0x00000001 /* need to send setup packet */
-#define SGECF_VXTQUIRKS 0x00000002 /* need VXT2000 care */
-#define SGECF_LINKUP 0x00000004 /* got link */
-};
-
-void sgec_attach(struct ze_softc *);
-int sgec_intr(struct ze_softc *);
diff --git a/sys/arch/vax/include/_float.h b/sys/arch/vax/include/_float.h
deleted file mode 100644
index 5c45065e54a..00000000000
--- a/sys/arch/vax/include/_float.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:45 deraadt Exp $ */
-
-/*
- * Copyright (c) 1989 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.
- */
-
-#ifndef _MACHINE__FLOAT_H_
-#define _MACHINE__FLOAT_H_
-
-#define __FLT_RADIX 2 /* b */
-#define __FLT_ROUNDS 1 /* FP addition rounds to nearest */
-#define __FLT_EVAL_METHOD 0 /* no promotions */
-
-#define __FLT_MANT_DIG 24 /* p */
-#define __FLT_EPSILON 1.19209290E-7F /* b**(1-p) */
-#define __FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */
-#define __FLT_MIN_EXP (-127) /* emin */
-#define __FLT_MIN 2.93873588E-39F /* b**(emin-1) */
-#define __FLT_MIN_10_EXP (-38) /* ceil(log10(b**(emin-1))) */
-#define __FLT_MAX_EXP 127 /* emax */
-#define __FLT_MAX 1.70141173E+38F /* (1-b**(-p))*b**emax */
-#define __FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */
-
-#define __DBL_MANT_DIG 56
-#define __DBL_EPSILON 2.77555756156289135E-17
-#define __DBL_DIG 16
-#define __DBL_MIN_EXP (-127)
-#define __DBL_MIN 2.938735877055718770E-39
-#define __DBL_MIN_10_EXP (-38)
-#define __DBL_MAX_EXP 127
-#define __DBL_MAX 1.701411834604692294E+38
-#define __DBL_MAX_10_EXP 38
-
-#define __LDBL_MANT_DIG DBL_MANT_DIG
-#define __LDBL_EPSILON DBL_EPSILON
-#define __LDBL_DIG DBL_DIG
-#define __LDBL_MIN_EXP DBL_MIN_EXP
-#define __LDBL_MIN DBL_MIN
-#define __LDBL_MIN_10_EXP DBL_MIN_10_EXP
-#define __LDBL_MAX_EXP DBL_MAX_EXP
-#define __LDBL_MAX DBL_MAX
-#define __LDBL_MAX_10_EXP DBL_MAX_10_EXP
-
-#define __DECIMAL_DIG 18
-
-#endif /* _MACHINE__FLOAT_H_ */
diff --git a/sys/arch/vax/include/_types.h b/sys/arch/vax/include/_types.h
deleted file mode 100644
index 32e90e3a2ee..00000000000
--- a/sys/arch/vax/include/_types.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/* $OpenBSD: _types.h,v 1.22 2015/09/26 16:01:00 guenther Exp $ */
-
-/*-
- * Copyright (c) 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.
- *
- * @(#)types.h 8.3 (Berkeley) 1/5/94
- * @(#)ansi.h 8.2 (Berkeley) 1/4/94
- */
-
-#ifndef _MACHINE__TYPES_H_
-#define _MACHINE__TYPES_H_
-
-#if defined(_KERNEL)
-typedef struct label_t {
- long val[6];
-} label_t;
-#endif
-
-/*
- * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
- * value for all data types (int, long, ...). The result is an
- * unsigned long and must be cast to any desired pointer type.
- *
- * _ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits).
- */
-#define _ALIGNBYTES (sizeof(int) - 1)
-#define _STACKALIGNBYTES _ALIGNBYTES
-#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
-#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
-
-/* 7.18.1.1 Exact-width integer types */
-typedef signed char __int8_t;
-typedef unsigned char __uint8_t;
-typedef short __int16_t;
-typedef unsigned short __uint16_t;
-typedef int __int32_t;
-typedef unsigned int __uint32_t;
-typedef long long __int64_t;
-typedef unsigned long long __uint64_t;
-
-/* 7.18.1.2 Minimum-width integer types */
-typedef __int8_t __int_least8_t;
-typedef __uint8_t __uint_least8_t;
-typedef __int16_t __int_least16_t;
-typedef __uint16_t __uint_least16_t;
-typedef __int32_t __int_least32_t;
-typedef __uint32_t __uint_least32_t;
-typedef __int64_t __int_least64_t;
-typedef __uint64_t __uint_least64_t;
-
-/* 7.18.1.3 Fastest minimum-width integer types */
-typedef __int32_t __int_fast8_t;
-typedef __uint32_t __uint_fast8_t;
-typedef __int32_t __int_fast16_t;
-typedef __uint32_t __uint_fast16_t;
-typedef __int32_t __int_fast32_t;
-typedef __uint32_t __uint_fast32_t;
-typedef __int64_t __int_fast64_t;
-typedef __uint64_t __uint_fast64_t;
-#define __INT_FAST8_MIN INT32_MIN
-#define __INT_FAST16_MIN INT32_MIN
-#define __INT_FAST32_MIN INT32_MIN
-#define __INT_FAST64_MIN INT64_MIN
-#define __INT_FAST8_MAX INT32_MAX
-#define __INT_FAST16_MAX INT32_MAX
-#define __INT_FAST32_MAX INT32_MAX
-#define __INT_FAST64_MAX INT64_MAX
-#define __UINT_FAST8_MAX UINT32_MAX
-#define __UINT_FAST16_MAX UINT32_MAX
-#define __UINT_FAST32_MAX UINT32_MAX
-#define __UINT_FAST64_MAX UINT64_MAX
-
-/* 7.18.1.4 Integer types capable of holding object pointers */
-typedef long __intptr_t;
-typedef unsigned long __uintptr_t;
-
-/* 7.18.1.5 Greatest-width integer types */
-typedef __int64_t __intmax_t;
-typedef __uint64_t __uintmax_t;
-
-/* Register size */
-typedef long __register_t;
-
-/* VM system types */
-typedef unsigned long __vaddr_t;
-typedef unsigned long __paddr_t;
-typedef unsigned long __vsize_t;
-typedef unsigned long __psize_t;
-
-/* Standard system types */
-typedef double __double_t;
-typedef float __float_t;
-typedef long __ptrdiff_t;
-typedef unsigned long __size_t;
-typedef long __ssize_t;
-#if defined(__GNUC__) && __GNUC__ >= 3
-typedef __builtin_va_list __va_list;
-#else
-typedef char * __va_list;
-#endif
-
-/* Wide character support types */
-#ifndef __cplusplus
-typedef int __wchar_t;
-#endif
-typedef int __wint_t;
-typedef int __rune_t;
-typedef void * __wctrans_t;
-typedef void * __wctype_t;
-
-#endif /* _MACHINE__TYPES_H_ */
diff --git a/sys/arch/vax/include/asm.h b/sys/arch/vax/include/asm.h
deleted file mode 100644
index e7c37872734..00000000000
--- a/sys/arch/vax/include/asm.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* $OpenBSD: asm.h,v 1.13 2015/08/30 10:19:49 guenther Exp $ */
-/* $NetBSD: asm.h,v 1.9 1999/01/15 13:31:28 bouyer Exp $ */
-/*
- * Copyright (c) 1982, 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.
- *
- * @(#)DEFS.h 8.1 (Berkeley) 6/4/93
- */
-
-#ifndef _MACHINE_ASM_H_
-#define _MACHINE_ASM_H_
-
-#define R0 0x001
-#define R1 0x002
-#define R2 0x004
-#define R3 0x008
-#define R4 0x010
-#define R5 0x020
-#define R6 0x040
-#define R7 0x080
-#define R8 0x100
-#define R9 0x200
-#define R10 0x400
-#define R11 0x800
-
-#ifdef __ELF__
-# define _C_LABEL(x) x
-#else
-# ifdef __STDC__
-# define _C_LABEL(x) _ ## x
-# else
-# define _C_LABEL(x) _/**/x
-# endif
-#endif
-
-#define _ASM_LABEL(x) x
-
-#ifdef __STDC__
-# define __CONCAT(x,y) x ## y
-# define __STRING(x) #x
-#else
-# define __CONCAT(x,y) x/**/y
-# define __STRING(x) "x"
-#endif
-
-/* let kernels and others override entrypoint alignment */
-#ifndef _ALIGN_TEXT
-# define _ALIGN_TEXT .align 2
-#endif
-
-#define _ALTENTRY(x) \
- .globl x; .type x,@function; x:
-#define _ENTRY(x, regs) \
- .text; _ALIGN_TEXT; _ALTENTRY(x) .word regs
-
-#if defined(PROF) || defined(GPROF)
-# ifdef __ELF__
-# define _PROF_PROLOGUE \
- .data; 1:; .long 0; .text; moval 1b,r0; jsb _ASM_LABEL(__mcount)
-# else
-# define _PROF_PROLOGUE \
- .data; 1:; .long 0; .text; moval 1b,r0; jsb _ASM_LABEL(mcount)
-# endif
-#else
-# define _PROF_PROLOGUE
-#endif
-
-#define ENTRY(x, regs) _ENTRY(_C_LABEL(x), regs); _PROF_PROLOGUE
-#define ENTRY_NOPROFILE(x, regs) _ENTRY(_C_LABEL(x), regs)
-#define NENTRY(x, regs) _ENTRY(_C_LABEL(x), regs)
-#define ASENTRY(x, regs) _ENTRY(_ASM_LABEL(x), regs); _PROF_PROLOGUE
-#define ASENTRY_NOPROFILE(x, regs) _ENTRY(_ASM_LABEL(x), regs)
-
-#define ALTENTRY(x) _ALTENTRY(_C_LABEL(x))
-#define END(y) .size y, . - y
-#define RCSID(x) .text; .asciz x
-
-#ifdef __ELF__
-#define STRONG_ALIAS(alias,sym) \
- .global alias; \
- alias = sym
-#define WEAK_ALIAS(alias,sym) \
- .weak alias; \
- alias = sym
-#else
-#define STRONG_ALIAS(alias,sym) \
- .global _##alias; \
- _##alias = _##sym
-#define WEAK_ALIAS(alias,sym) \
- .weak _##alias; \
- _##alias = _##sym
-#endif
-
-#ifdef __STDC__
-#define WARN_REFERENCES(sym,msg) \
- .stabs msg ## ,30,0,0,0 ; \
- .stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0
-#else
-#define WARN_REFERENCES(sym,msg) \
- .stabs msg,30,0,0,0 ; \
- .stabs __STRING(_C_LABEL(sym)),1,0,0,0
-#endif /* __STDC__ */
-
-#endif /* _MACHINE_ASM_H_ */
diff --git a/sys/arch/vax/include/atomic.h b/sys/arch/vax/include/atomic.h
deleted file mode 100644
index 0a2c907f538..00000000000
--- a/sys/arch/vax/include/atomic.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* $OpenBSD: atomic.h,v 1.9 2014/07/19 05:27:17 dlg Exp $ */
-
-/* Public Domain */
-
-#ifndef _VAX_ATOMIC_H_
-#define _VAX_ATOMIC_H_
-
-#if defined(_KERNEL)
-
-#include <machine/mtpr.h>
-#include <machine/intr.h>
-
-static __inline void
-atomic_setbits_int(volatile unsigned int *uip, unsigned int v)
-{
- int s;
-
- s = splhigh();
- *uip |= v;
- splx(s);
-}
-
-static __inline void
-atomic_clearbits_int(volatile unsigned int *uip, unsigned int v)
-{
- int s;
-
- s = splhigh();
- *uip &= ~v;
- splx(s);
-}
-
-static __inline unsigned int
-atomic_add_int_nv_sp(volatile unsigned int *uip, unsigned int v)
-{
- int s;
- unsigned int nv;
-
- s = splhigh();
- *uip += v;
- nv = *uip;
- splx(s);
-
- return nv;
-}
-
-static __inline unsigned int
-atomic_sub_int_nv_sp(volatile unsigned int *uip, unsigned int v)
-{
- int s;
- unsigned int nv;
-
- s = splhigh();
- *uip -= v;
- nv = *uip;
- splx(s);
-
- return nv;
-}
-
-static inline unsigned int
-atomic_cas_uint_sp(unsigned int *p, unsigned int o, unsigned int n)
-{
- int s;
- unsigned int ov;
-
- s = splhigh();
- ov = *p;
- if (ov == o)
- *p = n;
- splx(s);
-
- return ov;
-}
-
-static inline unsigned int
-atomic_swap_uint_sp(unsigned int *p, unsigned int v)
-{
- int s;
- unsigned int ov;
-
- s = splhigh();
- ov = *p;
- *p = v;
- splx(s);
-
- return ov;
-}
-
-#define atomic_add_int_nv atomic_add_int_nv_sp
-#define atomic_sub_int_nv atomic_sub_int_nv_sp
-#define atomic_cas_uint atomic_cas_uint_sp
-#define atomic_swap_uint atomic_swap_uint_sp
-
-#define atomic_add_long_nv(p,v) \
- ((unsigned long)atomic_add_int_nv((unsigned int *)p, (unsigned int)v))
-#define atomic_sub_long_nv(p,v) \
- ((unsigned long)atomic_sub_int_nv((unsigned int *)p, (unsigned int)v))
-
-#define atomic_cas_ulong(p,o,n) \
- ((unsigned long)atomic_cas_uint((unsigned int *)p, (unsigned int)o, \
- (unsigned int)n))
-#define atomic_cas_ptr(p,o,n) \
- ((void *)atomic_cas_uint((unsigned int *)p, (unsigned int)o, \
- (unsigned int)n))
-
-#define atomic_swap_ulong(p,o) \
- ((unsigned long)atomic_swap_uint((unsigned int *)p, (unsigned int)o)
-#define atomic_swap_ptr(p,o) \
- ((void *)atomic_swap_uint((unsigned int *)p, (unsigned int)o))
-
-static inline void
-__sync_synchronize(void)
-{
- __asm__ volatile ("" ::: "memory");
-}
-
-#endif /* defined(_KERNEL) */
-#endif /* _VAX_ATOMIC_H_ */
diff --git a/sys/arch/vax/include/bus.h b/sys/arch/vax/include/bus.h
deleted file mode 100644
index 6ab4071d5f8..00000000000
--- a/sys/arch/vax/include/bus.h
+++ /dev/null
@@ -1,968 +0,0 @@
-/* $OpenBSD: bus.h,v 1.16 2011/03/23 16:54:37 pirofti Exp $ */
-/* $NetBSD: bus.h,v 1.14 2000/06/26 04:56:13 simonb 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.
- *
- * 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) 1996 Charles M. Hannum. All rights reserved.
- * Copyright (c) 1996 Christopher G. Demetriou. 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 Christopher G. Demetriou
- * for the NetBSD Project.
- * 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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_BUS_H_
-#define _MACHINE_BUS_H_
-
-/*
- * 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 struct vax_bus_space *bus_space_tag_t;
-typedef u_long bus_space_handle_t;
-
-struct vax_bus_space {
- /* cookie */
- void *vbs_cookie;
-
- /* mapping/unmapping */
- int (*vbs_map)(void *, bus_addr_t, bus_size_t,
- int, bus_space_handle_t *);
- void (*vbs_unmap)(void *, bus_space_handle_t,
- bus_size_t);
- int (*vbs_subregion)(void *, bus_space_handle_t,
- bus_size_t, bus_size_t, bus_space_handle_t *);
-
- /* allocation/deallocation */
- int (*vbs_alloc)(void *, bus_addr_t, bus_addr_t,
- bus_size_t, bus_size_t, bus_size_t, int,
- bus_addr_t *, bus_space_handle_t *);
- void (*vbs_free)(void *, bus_space_handle_t,
- bus_size_t);
-
- /* get kernel virtual address */
- void * (*vbs_vaddr)(void *, bus_space_handle_t);
-};
-
-/*
- * int bus_space_map(bus_space_tag_t t, bus_addr_t addr,
- * bus_size_t size, int flags, bus_space_handle_t *bshp);
- *
- * Map a region of bus space.
- */
-
-#define BUS_SPACE_MAP_CACHEABLE 0x01
-#define BUS_SPACE_MAP_LINEAR 0x02
-#define BUS_SPACE_MAP_PREFETCHABLE 0x04
-
-#define bus_space_map(t, a, s, f, hp) \
- (*(t)->vbs_map)((t)->vbs_cookie, (a), (s), (f), (hp))
-
-/*
- * int bus_space_unmap(bus_space_tag_t t,
- * bus_space_handle_t bsh, bus_size_t size);
- *
- * Unmap a region of bus space.
- */
-
-#define bus_space_unmap(t, h, s) \
- (*(t)->vbs_unmap)((t)->vbs_cookie, (h), (s))
-
-/*
- * 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);
- *
- * Get a new handle for a subregion of an already-mapped area of bus space.
- */
-
-#define bus_space_subregion(t, h, o, s, nhp) \
- (*(t)->vbs_subregion)((t)->vbs_cookie, (h), (o), (s), (nhp))
-
-/*
- * 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 flags, bus_addr_t *addrp,
- * bus_space_handle_t *bshp);
- *
- * Allocate a region of bus space.
- */
-
-#define bus_space_alloc(t, rs, re, s, a, b, f, ap, hp) \
- (*(t)->vbs_alloc)((t)->vbs_cookie, (rs), (re), (s), (a), (b), \
- (f), (ap), (hp))
-
-/*
- * int bus_space_free(bus_space_tag_t t,
- * bus_space_handle_t bsh, bus_size_t size);
- *
- * Free a region of bus space.
- */
-
-#define bus_space_free(t, h, s) \
- (*(t)->vbs_free)((t)->vbs_cookie, (h), (s))
-
-/*
- * void *bus_space_vaddr(bus_space_tag_t t, bus_space_handle_t h);
- *
- * Get kernel virtual address.
- */
-
-#define bus_space_vaddr(t, h) \
- (*(t)->vbs_vaddr)((t)->vbs_cookie, (h))
-
-/*
- * u_intN_t bus_space_read_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset);
- *
- * Read a 1, 2, 4, or 8 byte quantity from bus space
- * described by tag/handle/offset.
- */
-
-#define bus_space_read_1(t, h, o) \
- (*(volatile u_int8_t *)((h) + (o)))
-
-#define bus_space_read_2(t, h, o) \
- (*(volatile u_int16_t *)((h) + (o)))
-
-#define bus_space_read_4(t, h, o) \
- (*(volatile u_int32_t *)((h) + (o)))
-
-#if 0 /* Cause a link error for bus_space_read_8 */
-#define bus_space_read_8(t, h, o) !!! bus_space_read_8 unimplemented !!!
-#endif
-
-/*
- * void bus_space_read_multi_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * u_intN_t *addr, size_t count);
- *
- * Read `count' 1, 2, 4, or 8 byte quantities from bus space
- * described by tag/handle/offset and copy into buffer provided.
- */
-static __inline void vax_mem_read_multi_1(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-static __inline void vax_mem_read_multi_2(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, u_int16_t *, size_t);
-static __inline void vax_mem_read_multi_4(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, u_int32_t *, size_t);
-
-#define bus_space_read_multi_1(t, h, o, a, c) \
- vax_mem_read_multi_1((t), (h), (o), (a), (c))
-
-#define bus_space_read_multi_2(t, h, o, a, c) \
- vax_mem_read_multi_2((t), (h), (o), (a), (c))
-
-#define bus_space_read_multi_4(t, h, o, a, c) \
- vax_mem_read_multi_4((t), (h), (o), (a), (c))
-
-#if 0 /* Cause a link error for bus_space_read_multi_8 */
-#define bus_space_read_multi_8 !!! bus_space_read_multi_8 unimplemented !!!
-#endif
-
-static __inline void
-vax_mem_read_multi_1(t, h, o, a, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- u_int8_t *a;
- size_t c;
-{
- const bus_addr_t addr = h + o;
-
- for (; c != 0; c--, a++)
- *a = *(volatile u_int8_t *)(addr);
-}
-
-static __inline void
-vax_mem_read_multi_2(t, h, o, a, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- u_int16_t *a;
- size_t c;
-{
- const bus_addr_t addr = h + o;
-
- for (; c != 0; c--, a++)
- *a = *(volatile u_int16_t *)(addr);
-}
-
-static __inline void
-vax_mem_read_multi_4(t, h, o, a, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- u_int32_t *a;
- size_t c;
-{
- const bus_addr_t addr = h + o;
-
- for (; c != 0; c--, a++)
- *a = *(volatile u_int32_t *)(addr);
-}
-
-/*
- * void bus_space_read_region_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * u_intN_t *addr, size_t count);
- *
- * Read `count' 1, 2, 4, or 8 byte quantities from bus space
- * described by tag/handle and starting at `offset' and copy into
- * buffer provided.
- */
-
-static __inline void vax_mem_read_region_1(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-static __inline void vax_mem_read_region_2(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, u_int16_t *, size_t);
-static __inline void vax_mem_read_region_4(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, u_int32_t *, size_t);
-
-#define bus_space_read_region_1(t, h, o, a, c) \
- vax_mem_read_region_1((t), (h), (o), (a), (c))
-
-#define bus_space_read_region_2(t, h, o, a, c) \
- vax_mem_read_region_2((t), (h), (o), (a), (c))
-
-#define bus_space_read_region_4(t, h, o, a, c) \
- vax_mem_read_region_4((t), (h), (o), (a), (c))
-
-#if 0 /* Cause a link error for bus_space_read_region_8 */
-#define bus_space_read_region_8 \
- !!! bus_space_read_region_8 unimplemented !!!
-#endif
-
-static __inline void
-vax_mem_read_region_1(t, h, o, a, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- u_int8_t *a;
- size_t c;
-{
- bus_addr_t addr = h + o;
-
- for (; c != 0; c--, addr++, a++)
- *a = *(volatile u_int8_t *)(addr);
-}
-
-static __inline void
-vax_mem_read_region_2(t, h, o, a, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- u_int16_t *a;
- size_t c;
-{
- bus_addr_t addr = h + o;
-
- for (; c != 0; c--, addr++, a++)
- *a = *(volatile u_int16_t *)(addr);
-}
-
-static __inline void
-vax_mem_read_region_4(t, h, o, a, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- u_int32_t *a;
- size_t c;
-{
- bus_addr_t addr = h + o;
-
- for (; c != 0; c--, addr++, a++)
- *a = *(volatile u_int32_t *)(addr);
-}
-
-/*
- * void bus_space_write_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * u_intN_t value);
- *
- * Write the 1, 2, 4, or 8 byte value `value' to bus space
- * described by tag/handle/offset.
- */
-
-#define bus_space_write_1(t, h, o, v) \
- ((void)(*(volatile u_int8_t *)((h) + (o)) = (v)))
-
-#define bus_space_write_2(t, h, o, v) \
- ((void)(*(volatile u_int16_t *)((h) + (o)) = (v)))
-
-#define bus_space_write_4(t, h, o, v) \
- ((void)(*(volatile u_int32_t *)((h) + (o)) = (v)))
-
-#if 0 /* Cause a link error for bus_space_write_8 */
-#define bus_space_write_8 !!! bus_space_write_8 not implemented !!!
-#endif
-
-/*
- * void bus_space_write_multi_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * const u_intN_t *addr, size_t count);
- *
- * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
- * provided to bus space described by tag/handle/offset.
- */
-static __inline void vax_mem_write_multi_1(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-static __inline void vax_mem_write_multi_2(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, const u_int16_t *, size_t);
-static __inline void vax_mem_write_multi_4(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, const u_int32_t *, size_t);
-
-#define bus_space_write_multi_1(t, h, o, a, c) \
- vax_mem_write_multi_1((t), (h), (o), (a), (c))
-
-#define bus_space_write_multi_2(t, h, o, a, c) \
- vax_mem_write_multi_2((t), (h), (o), (a), (c))
-
-#define bus_space_write_multi_4(t, h, o, a, c) \
- vax_mem_write_multi_4((t), (h), (o), (a), (c))
-
-#if 0 /* Cause a link error for bus_space_write_multi_8 */
-#define bus_space_write_multi_8(t, h, o, a, c) \
- !!! bus_space_write_multi_8 unimplemented !!!
-#endif
-
-static __inline void
-vax_mem_write_multi_1(t, h, o, a, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- const u_int8_t *a;
- size_t c;
-{
- const bus_addr_t addr = h + o;
-
- for (; c != 0; c--, a++)
- *(volatile u_int8_t *)(addr) = *a;
-}
-
-static __inline void
-vax_mem_write_multi_2(t, h, o, a, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- const u_int16_t *a;
- size_t c;
-{
- const bus_addr_t addr = h + o;
-
- for (; c != 0; c--, a++)
- *(volatile u_int16_t *)(addr) = *a;
-}
-
-static __inline void
-vax_mem_write_multi_4(t, h, o, a, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- const u_int32_t *a;
- size_t c;
-{
- const bus_addr_t addr = h + o;
-
- for (; c != 0; c--, a++)
- *(volatile u_int32_t *)(addr) = *a;
-}
-
-/*
- * void bus_space_write_region_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * const u_intN_t *addr, size_t count);
- *
- * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
- * to bus space described by tag/handle starting at `offset'.
- */
-static __inline void vax_mem_write_region_1(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-static __inline void vax_mem_write_region_2(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, const u_int16_t *, size_t);
-static __inline void vax_mem_write_region_4(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, const u_int32_t *, size_t);
-
-#define bus_space_write_region_1(t, h, o, a, c) \
- vax_mem_write_region_1((t), (h), (o), (a), (c))
-
-#define bus_space_write_region_2(t, h, o, a, c) \
- vax_mem_write_region_2((t), (h), (o), (a), (c))
-
-#define bus_space_write_region_4(t, h, o, a, c) \
- vax_mem_write_region_4((t), (h), (o), (a), (c))
-
-#if 0 /* Cause a link error for bus_space_write_region_8 */
-#define bus_space_write_region_8 \
- !!! bus_space_write_region_8 unimplemented !!!
-#endif
-
-static __inline void
-vax_mem_write_region_1(t, h, o, a, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- const u_int8_t *a;
- size_t c;
-{
- bus_addr_t addr = h + o;
-
- for (; c != 0; c--, addr++, a++)
- *(volatile u_int8_t *)(addr) = *a;
-}
-
-static __inline void
-vax_mem_write_region_2(t, h, o, a, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- const u_int16_t *a;
- size_t c;
-{
- bus_addr_t addr = h + o;
-
- for (; c != 0; c--, addr++, a++)
- *(volatile u_int16_t *)(addr) = *a;
-}
-
-static __inline void
-vax_mem_write_region_4(t, h, o, a, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- const u_int32_t *a;
- size_t c;
-{
- bus_addr_t addr = h + o;
-
- for (; c != 0; c--, addr++, a++)
- *(volatile u_int32_t *)(addr) = *a;
-}
-
-/*
- * void bus_space_set_multi_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
- * size_t count);
- *
- * Write the 1, 2, 4, or 8 byte value `val' to bus space described
- * by tag/handle/offset `count' times.
- */
-
-static __inline void vax_mem_set_multi_1(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, u_int8_t, size_t);
-static __inline void vax_mem_set_multi_2(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, u_int16_t, size_t);
-static __inline void vax_mem_set_multi_4(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, u_int32_t, size_t);
-
-#define bus_space_set_multi_1(t, h, o, v, c) \
- vax_mem_set_multi_1((t), (h), (o), (v), (c))
-
-#define bus_space_set_multi_2(t, h, o, v, c) \
- vax_mem_set_multi_2((t), (h), (o), (v), (c))
-
-#define bus_space_set_multi_4(t, h, o, v, c) \
- vax_mem_set_multi_4((t), (h), (o), (v), (c))
-
-static __inline void
-vax_mem_set_multi_1(t, h, o, v, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- u_int8_t v;
- size_t c;
-{
- bus_addr_t addr = h + o;
-
- while (c--)
- *(volatile u_int8_t *)(addr) = v;
-}
-
-static __inline void
-vax_mem_set_multi_2(t, h, o, v, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- u_int16_t v;
- size_t c;
-{
- bus_addr_t addr = h + o;
-
- while (c--)
- *(volatile u_int16_t *)(addr) = v;
-}
-
-static __inline void
-vax_mem_set_multi_4(t, h, o, v, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- u_int32_t v;
- size_t c;
-{
- bus_addr_t addr = h + o;
-
- while (c--)
- *(volatile u_int32_t *)(addr) = v;
-}
-
-#if 0 /* Cause a link error for bus_space_set_multi_8 */
-#define bus_space_set_multi_8 !!! bus_space_set_multi_8 unimplemented !!!
-#endif
-
-/*
- * void bus_space_set_region_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
- * size_t count);
- *
- * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
- * by tag/handle starting at `offset'.
- */
-
-static __inline void vax_mem_set_region_1(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, u_int8_t, size_t);
-static __inline void vax_mem_set_region_2(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, u_int16_t, size_t);
-static __inline void vax_mem_set_region_4(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, u_int32_t, size_t);
-
-#define bus_space_set_region_1(t, h, o, v, c) \
- vax_mem_set_region_1((t), (h), (o), (v), (c))
-
-#define bus_space_set_region_2(t, h, o, v, c) \
- vax_mem_set_region_2((t), (h), (o), (v), (c))
-
-#define bus_space_set_region_4(t, h, o, v, c) \
- vax_mem_set_region_4((t), (h), (o), (v), (c))
-
-static __inline void
-vax_mem_set_region_1(t, h, o, v, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- u_int8_t v;
- size_t c;
-{
- bus_addr_t addr = h + o;
-
- for (; c != 0; c--, addr++)
- *(volatile u_int8_t *)(addr) = v;
-}
-
-static __inline void
-vax_mem_set_region_2(t, h, o, v, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- u_int16_t v;
- size_t c;
-{
- bus_addr_t addr = h + o;
-
- for (; c != 0; c--, addr += 2)
- *(volatile u_int16_t *)(addr) = v;
-}
-
-static __inline void
-vax_mem_set_region_4(t, h, o, v, c)
- bus_space_tag_t t;
- bus_space_handle_t h;
- bus_size_t o;
- u_int32_t v;
- size_t c;
-{
- bus_addr_t addr = h + o;
-
- for (; c != 0; c--, addr += 4)
- *(volatile u_int32_t *)(addr) = v;
-}
-
-#if 0 /* Cause a link error for bus_space_set_region_8 */
-#define bus_space_set_region_8 !!! bus_space_set_region_8 unimplemented !!!
-#endif
-
-/*
- * void bus_space_copy_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh1, bus_size_t off1,
- * bus_space_handle_t bsh2, bus_size_t off2,
- * size_t count);
- *
- * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
- * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
- */
-
-static __inline void vax_mem_copy_1(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, bus_space_handle_t,
- bus_size_t, size_t);
-static __inline void vax_mem_copy_2(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, bus_space_handle_t,
- bus_size_t, size_t);
-static __inline void vax_mem_copy_4(bus_space_tag_t,
- bus_space_handle_t, bus_size_t, bus_space_handle_t,
- bus_size_t, size_t);
-
-#define bus_space_copy_1(t, h1, o1, h2, o2, c) \
- vax_mem_copy_1((t), (h1), (o1), (h2), (o2), (c))
-
-#define bus_space_copy_2(t, h1, o1, h2, o2, c) \
- vax_mem_copy_2((t), (h1), (o1), (h2), (o2), (c))
-
-#define bus_space_copy_4(t, h1, o1, h2, o2, c) \
- vax_mem_copy_4((t), (h1), (o1), (h2), (o2), (c))
-
-static __inline void
-vax_mem_copy_1(t, h1, o1, h2, o2, c)
- bus_space_tag_t t;
- bus_space_handle_t h1;
- bus_size_t o1;
- bus_space_handle_t h2;
- bus_size_t o2;
- size_t c;
-{
- bus_addr_t addr1 = h1 + o1;
- bus_addr_t addr2 = h2 + o2;
-
- if (addr1 >= addr2) {
- /* src after dest: copy forward */
- for (; c != 0; c--, addr1++, addr2++)
- *(volatile u_int8_t *)(addr2) =
- *(volatile u_int8_t *)(addr1);
- } else {
- /* dest after src: copy backwards */
- for (addr1 += (c - 1), addr2 += (c - 1);
- c != 0; c--, addr1--, addr2--)
- *(volatile u_int8_t *)(addr2) =
- *(volatile u_int8_t *)(addr1);
- }
-}
-
-static __inline void
-vax_mem_copy_2(t, h1, o1, h2, o2, c)
- bus_space_tag_t t;
- bus_space_handle_t h1;
- bus_size_t o1;
- bus_space_handle_t h2;
- bus_size_t o2;
- size_t c;
-{
- bus_addr_t addr1 = h1 + o1;
- bus_addr_t addr2 = h2 + o2;
-
- if (addr1 >= addr2) {
- /* src after dest: copy forward */
- for (; c != 0; c--, addr1 += 2, addr2 += 2)
- *(volatile u_int16_t *)(addr2) =
- *(volatile u_int16_t *)(addr1);
- } else {
- /* dest after src: copy backwards */
- for (addr1 += 2 * (c - 1), addr2 += 2 * (c - 1);
- c != 0; c--, addr1 -= 2, addr2 -= 2)
- *(volatile u_int16_t *)(addr2) =
- *(volatile u_int16_t *)(addr1);
- }
-}
-
-static __inline void
-vax_mem_copy_4(t, h1, o1, h2, o2, c)
- bus_space_tag_t t;
- bus_space_handle_t h1;
- bus_size_t o1;
- bus_space_handle_t h2;
- bus_size_t o2;
- size_t c;
-{
- bus_addr_t addr1 = h1 + o1;
- bus_addr_t addr2 = h2 + o2;
-
- if (addr1 >= addr2) {
- /* src after dest: copy forward */
- for (; c != 0; c--, addr1 += 4, addr2 += 4)
- *(volatile u_int32_t *)(addr2) =
- *(volatile u_int32_t *)(addr1);
- } else {
- /* dest after src: copy backwards */
- for (addr1 += 4 * (c - 1), addr2 += 4 * (c - 1);
- c != 0; c--, addr1 -= 4, addr2 -= 4)
- *(volatile u_int32_t *)(addr2) =
- *(volatile u_int32_t *)(addr1);
- }
-}
-
-#if 0 /* Cause a link error for bus_space_copy_8 */
-#define bus_space_copy_8 !!! bus_space_copy_8 unimplemented !!!
-#endif
-
-
-/*
- * Bus read/write barrier methods.
- *
- * void bus_space_barrier(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * bus_size_t len, int flags);
- *
- * Note: the vax 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 */
-
-
-/*
- * Flags used in various bus DMA methods.
- */
-#define BUS_DMA_WAITOK 0x000 /* safe to sleep (pseudo-flag) */
-#define BUS_DMA_NOWAIT 0x001 /* not safe to sleep */
-#define BUS_DMA_ALLOCNOW 0x002 /* perform resource allocation now */
-#define BUS_DMA_COHERENT 0x004 /* hint: map memory DMA coherent */
-#define BUS_DMA_BUS1 0x010 /* placeholders for bus functions... */
-#define BUS_DMA_BUS2 0x020
-#define BUS_DMA_BUS3 0x040
-#define BUS_DMA_BUS4 0x080
-#define BUS_DMA_STREAMING 0x100 /* hint: sequential, unidirectional */
-#define BUS_DMA_READ 0x200 /* mapping is device -> memory only */
-#define BUS_DMA_WRITE 0x400 /* mapping is memory -> device only */
-#define BUS_DMA_ZERO 0x800 /* zero memory in dmamem_alloc */
-
-#define VAX_BUS_DMA_SPILLPAGE BUS_DMA_BUS1 /* VS4000 kludge */
-/*
- * Private flags stored in the DMA map.
- */
-#define DMAMAP_HAS_SGMAP 0x80000000 /* sgva/len are valid */
-
-/* Forwards needed by prototypes below. */
-struct mbuf;
-struct uio;
-struct vax_sgmap;
-
-/*
- * Operations performed by bus_dmamap_sync().
- */
-#define BUS_DMASYNC_PREREAD 0x01 /* pre-read synchronization */
-#define BUS_DMASYNC_POSTREAD 0x02 /* post-read synchronization */
-#define BUS_DMASYNC_PREWRITE 0x04 /* pre-write synchronization */
-#define BUS_DMASYNC_POSTWRITE 0x08 /* post-write synchronization */
-
-typedef struct vax_bus_dma_tag *bus_dma_tag_t;
-typedef struct vax_bus_dmamap *bus_dmamap_t;
-
-/*
- * bus_dma_segment_t
- *
- * Describes a single contiguous DMA transaction. Values
- * are suitable for programming into DMA registers.
- */
-struct vax_bus_dma_segment {
- bus_addr_t ds_addr; /* DMA address */
- bus_size_t ds_len; /* length of transfer */
-};
-typedef struct vax_bus_dma_segment bus_dma_segment_t;
-
-struct proc;
-
-/*
- * bus_dma_tag_t
- *
- * A machine-dependent opaque type describing the implementation of
- * DMA for a given bus.
- */
-struct vax_bus_dma_tag {
- void *_cookie; /* cookie used in the guts */
- bus_addr_t _wbase; /* DMA window base */
- bus_size_t _wsize; /* DMA window size */
-
- /*
- * Some chipsets have a built-in boundary constraint, independent
- * of what the device requests. This allows that boundary to
- * be specified. If the device has a more restrictive contraint,
- * the map will use that, otherwise this boundary will be used.
- * This value is ignored if 0.
- */
- bus_size_t _boundary;
-
- /*
- * A bus may have more than one SGMAP window, so SGMAP
- * windows also get a pointer to their SGMAP state.
- */
- struct vax_sgmap *_sgmap;
-
- /*
- * DMA mapping methods.
- */
- int (*_dmamap_create)(bus_dma_tag_t, bus_size_t, int,
- bus_size_t, bus_size_t, int, bus_dmamap_t *);
- void (*_dmamap_destroy)(bus_dma_tag_t, bus_dmamap_t);
- int (*_dmamap_load)(bus_dma_tag_t, bus_dmamap_t, void *,
- bus_size_t, struct proc *, int);
- int (*_dmamap_load_mbuf)(bus_dma_tag_t, bus_dmamap_t,
- struct mbuf *, int);
- int (*_dmamap_load_uio)(bus_dma_tag_t, bus_dmamap_t,
- struct uio *, int);
- int (*_dmamap_load_raw)(bus_dma_tag_t, bus_dmamap_t,
- bus_dma_segment_t *, int, bus_size_t, int);
- void (*_dmamap_unload)(bus_dma_tag_t, bus_dmamap_t);
- void (*_dmamap_sync)(bus_dma_tag_t, bus_dmamap_t,
- bus_addr_t, bus_size_t, int);
-
- /*
- * DMA memory utility functions.
- */
- int (*_dmamem_alloc)(bus_dma_tag_t, bus_size_t, bus_size_t,
- bus_size_t, bus_dma_segment_t *, int, int *, int);
- void (*_dmamem_free)(bus_dma_tag_t,
- bus_dma_segment_t *, int);
- int (*_dmamem_map)(bus_dma_tag_t, bus_dma_segment_t *,
- int, size_t, caddr_t *, int);
- void (*_dmamem_unmap)(bus_dma_tag_t, caddr_t, size_t);
- paddr_t (*_dmamem_mmap)(bus_dma_tag_t, bus_dma_segment_t *,
- int, off_t, int, int);
-};
-
-#define bus_dmamap_create(t, s, n, m, b, f, p) \
- (*(t)->_dmamap_create)((t), (s), (n), (m), (b), (f), (p))
-#define bus_dmamap_destroy(t, p) \
- (*(t)->_dmamap_destroy)((t), (p))
-#define bus_dmamap_load(t, m, b, s, p, f) \
- (*(t)->_dmamap_load)((t), (m), (b), (s), (p), (f))
-#define bus_dmamap_load_mbuf(t, m, b, f) \
- (*(t)->_dmamap_load_mbuf)((t), (m), (b), (f))
-#define bus_dmamap_load_uio(t, m, u, f) \
- (*(t)->_dmamap_load_uio)((t), (m), (u), (f))
-#define bus_dmamap_load_raw(t, m, sg, n, s, f) \
- (*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f))
-#define bus_dmamap_unload(t, p) \
- (*(t)->_dmamap_unload)((t), (p))
-#define bus_dmamap_sync(t, p, o, l, ops) \
- (*(t)->_dmamap_sync)((t), (p), (o), (l), (ops))
-#define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \
- (*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f))
-#define bus_dmamem_free(t, sg, n) \
- (*(t)->_dmamem_free)((t), (sg), (n))
-#define bus_dmamem_map(t, sg, n, s, k, f) \
- (*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f))
-#define bus_dmamem_unmap(t, k, s) \
- (*(t)->_dmamem_unmap)((t), (k), (s))
-#define bus_dmamem_mmap(t, sg, n, o, p, f) \
- (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
-
-/*
- * bus_dmamap_t
- *
- * Describes a DMA mapping.
- */
-struct vax_bus_dmamap {
- /*
- * PRIVATE MEMBERS: not for use by machine-independent code.
- */
- bus_size_t _dm_size; /* largest DMA transfer mappable */
- int _dm_segcnt; /* number of segs this map can map */
- bus_size_t _dm_maxsegsz; /* largest possible segment */
- bus_size_t _dm_boundary; /* don't cross this */
- int _dm_flags; /* misc. flags */
-
- /*
- * This is used only for SGMAP-mapped DMA, but we keep it
- * here to avoid pointless indirection.
- */
- int _dm_pteidx; /* PTE index */
- int _dm_ptecnt; /* PTE count */
- u_long _dm_sgva; /* allocated sgva */
- bus_size_t _dm_sgvalen; /* svga length */
-
- /*
- * PUBLIC MEMBERS: these are used by machine-independent code.
- */
- bus_size_t dm_mapsize; /* size of the mapping */
- int dm_nsegs; /* # valid segments in mapping */
- bus_dma_segment_t dm_segs[1]; /* segments; variable length */
-};
-
-#ifdef _VAX_BUS_DMA_PRIVATE
-int _bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,
- bus_size_t, int, bus_dmamap_t *);
-void _bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
-
-int _bus_dmamap_load(bus_dma_tag_t, bus_dmamap_t,
- void *, bus_size_t, struct proc *, int);
-int _bus_dmamap_load_mbuf(bus_dma_tag_t,
- bus_dmamap_t, struct mbuf *, int);
-int _bus_dmamap_load_uio(bus_dma_tag_t,
- bus_dmamap_t, struct uio *, int);
-int _bus_dmamap_load_raw(bus_dma_tag_t,
- bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int);
-
-void _bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
-void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
- bus_size_t, int);
-
-int _bus_dmamem_alloc(bus_dma_tag_t tag, bus_size_t size,
- bus_size_t alignment, bus_size_t boundary,
- bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags);
-void _bus_dmamem_free(bus_dma_tag_t tag, bus_dma_segment_t *segs,
- int nsegs);
-int _bus_dmamem_map(bus_dma_tag_t tag, bus_dma_segment_t *segs,
- int nsegs, size_t size, caddr_t *kvap, int flags);
-void _bus_dmamem_unmap(bus_dma_tag_t tag, caddr_t kva,
- size_t size);
-paddr_t _bus_dmamem_mmap(bus_dma_tag_t tag, bus_dma_segment_t *segs,
- int nsegs, off_t off, int prot, int flags);
-#endif /* _VAX_BUS_DMA_PRIVATE */
-
-#endif /* _MACHINE_BUS_H_ */
diff --git a/sys/arch/vax/include/cca.h b/sys/arch/vax/include/cca.h
deleted file mode 100644
index 5946796d164..00000000000
--- a/sys/arch/vax/include/cca.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* $OpenBSD: cca.h,v 1.1 2008/08/18 23:25:53 miod Exp $ */
-/* $NetBSD: cca.h,v 1.2 2008/03/11 05:34:02 matt Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Copyright (c) 2000 Ludd, University of Lule}, Sweden. 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * Console Communication Area (CCA) layout description.
- *
- * Based on NetBSD/vax <machine/cca.h>, further reconstructed from the
- * description in VAX 6000 Model 600 System Technical User's Guide
- * (660eatm1.pdf)
- */
-
-struct cca {
- struct cca *cca_base; /* Physical base address of block */
- uint16_t cca_size; /* Size of this struct */
- uint16_t cca_id; /* 'CC' */
- uint8_t cca_nproc; /* max number of CPUs */
- uint8_t cca_cksum; /* Checksum of all earlier bytes */
- uint8_t cca_flags;
-#define CCAF_BOOTIP 0x01 /* bootstrap in progress */
-#define CCAF_REBOOT 0x10 /* reboot requested */
-#define CCAF_REPROMPT 0x20 /* trigger the prom prompt */
-#define CCAF_DISABLE_SECONDARY 0x40 /* ignore messages from secondaries */
- uint8_t cca_revision;
-
- uint64_t cca_ready; /* Data ready? */
- uint64_t cca_console; /* Processors in console mode */
- uint64_t cca_enabled; /* enabled/disabled */
- uint32_t cca_bitmapsz; /* Size of memory bitmap */
- uint32_t cca_bitmap; /* Address of memory bitmap */
- uint32_t cca_bmcksum; /* Bitmap checksum */
- uint8_t cca_tknode; /* TK nodes of boot device */
-#define CCA_TKN_VAXBI_MASK 0x0f
-#define CCA_TKN_VAXBI_SHIFT 0
-#define CCA_TKN_XMI_MASK 0xf0
-#define CCA_TKN_XMI_SHIFT 4
- uint8_t cca_pad0[3];
- uint64_t cca_starting; /* Processors currently starting */
- uint64_t cca_restart; /* Processors currently restarting */
- uint8_t cca_primary; /* XMI node of boot processor */
- uint8_t cca_power;
- uint16_t cca_sernum_ext;
- uint32_t cca_pad1[2];
- uint64_t cca_halted; /* Processors currently halted by user */
- uint8_t cca_sernum[8]; /* Serial number */
-/* CPU revisions */
- struct {
- uint8_t cr_compat; /* cpu compatibility group */
- uint8_t cr_pad0[3];
- uint32_t cr_modulerev; /* ascii module revision */
- } cca_revs[16];
- uint64_t cca_vecenab; /* Processors with enabled vector processors */
- uint64_t cca_vecwork; /* Processors with working vector processors */
- uint32_t cca_vecrevs[16];/* Vector processor revisions */
- uint32_t cca_console_xpgr[16];
- uint32_t cca_entry_xpgr[16];
- uint8_t cca_pad2[80]; /* pad to VAX_NBPG */
-/* Inter-CPU communication structs */
- struct {
- uint8_t cc_flags; /* Status flags */
-#define CCACCF_RXRDY 0x01 /* has message in rxbuf */
-#define CCACCF_DEST 0x02 /* currently sending to zdst */
-#define CCACCF_SRC 0x04 /* currently receiving from zsrc */
-#define CCACCF_ALT 0x08 /* unable to communicate through cca */
- uint8_t cc_zdst; /* Node sending to */
- uint8_t cc_zsrc; /* Node sending from */
- uint8_t cc_znid; /* Originating node if not zsrc */
- uint8_t cc_txlen; /* Length of transmit message */
- uint8_t cc_rxlen; /* Length of receive message */
- uint16_t cc_rxcd;
-#define CCACC_RX_DATA_MASK 0x00ff /* character received */
-#define CCACC_RX_DATA_SHIFT 0
-#define CCACC_RX_NODE_MASK 0x0f00 /* originating node */
-#define CCACC_RX_NODE_SHIFT 8
-#define CCACC_RX_DATA_READY 0x8000 /* rxcd assembled */
- char cc_txbuf[80]; /* Transmit buffer */
- char cc_rxbuf[80]; /* Receive buffer */
- } cca_cc[16];
-};
-
-#ifdef _KERNEL
-extern struct cca *cca;
-#endif
diff --git a/sys/arch/vax/include/cdefs.h b/sys/arch/vax/include/cdefs.h
deleted file mode 100644
index a1e0015d56b..00000000000
--- a/sys/arch/vax/include/cdefs.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* $OpenBSD: cdefs.h,v 1.9 2013/07/05 21:10:50 miod Exp $ */
-
-/*
- * Written by J.T. Conklin <jtc@wimsey.com> 01/17/95.
- * Public domain.
- */
-
-#ifndef _MACHINE_CDEFS_H_
-#define _MACHINE_CDEFS_H_
-
-#define __warn_references(sym,msg) \
- __asm__(".section .gnu.warning." __STRING(sym) \
- " ; .ascii \"" msg "\" ; .text")
-#define __strong_alias(alias,sym) \
- __asm__(".global " __STRING(alias) " ; " __STRING(alias) \
- " = " __STRING(sym))
-#define __weak_alias(alias,sym) \
- __asm__(".weak " __STRING(alias) " ; " __STRING(alias) \
- " = " __STRING(sym))
-
-#endif /* !_MACHINE_CDEFS_H_ */
diff --git a/sys/arch/vax/include/clock.h b/sys/arch/vax/include/clock.h
deleted file mode 100644
index d6aa49af5f7..00000000000
--- a/sys/arch/vax/include/clock.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $OpenBSD: clock.h,v 1.10 2015/02/07 00:09:09 miod Exp $ */
-/* $NetBSD: clock.h,v 1.4 1999/09/06 19:52:53 ragge Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * Time constants. These are unlikely to change.
- */
-#define IS_LEAPYEAR(y) (((y % 4) == 0) && (y % 100))
-
-#define SEC_PER_MIN (60)
-#define SEC_PER_HOUR (SEC_PER_MIN * 60)
-#define SEC_PER_DAY (SEC_PER_HOUR * 24)
-#define DAYSPERYEAR(y) (IS_LEAPYEAR(y) ? 366 : 365)
-#define SECPERYEAR(y) (DAYSPERYEAR(y) * SEC_PER_DAY)
-
-#define TODRBASE (1 << 28) /* Rumours say it comes from VMS */
-
-#define SEC_OFF 0
-#define MIN_OFF 2
-#define HR_OFF 4
-#define WDAY_OFF 6
-#define DAY_OFF 7
-#define MON_OFF 8
-#define YR_OFF 9
-#define CSRA_OFF 10
-#define CSRB_OFF 11
-#define CSRD_OFF 13
-
-#define CSRA_UIP 0200
-#define CSRB_SET 0200
-#define CSRB_24 0002
-#define CSRB_DM 0004
-#define CSRD_VRT 0200
-
-/* ICCS bits */
-
-#define ICCS_ERR 0x80000000 /* lost tick */
-#define ICCS_OFLOW 0x00000080 /* icr overflow */
-#define ICCS_INTENA 0x00000040 /* interrupt enable */
-#define ICCS_INCR 0x00000020 /* increment (if not running) */
-#define ICCS_RESET 0x00000010 /* reset to nicr */
-#define ICCS_RUN 0x00000001 /* enable */
-
-/* Var's used when dealing with clock chip */
-extern volatile short *clk_page;
-extern int clk_adrshift, clk_tweak;
-
-/* Prototypes */
-void icr_hardclock(struct clockframe *);
-int generic_clkread(struct timespec *, time_t);
-void generic_clkwrite(void);
-int chip_clkread(struct timespec *, time_t);
-void chip_clkwrite(void);
-
-int yeartonum(int);
-int numtoyear(int);
diff --git a/sys/arch/vax/include/cpu.h b/sys/arch/vax/include/cpu.h
deleted file mode 100644
index 7a1f9324d5e..00000000000
--- a/sys/arch/vax/include/cpu.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* $OpenBSD: cpu.h,v 1.48 2015/02/07 00:20:53 miod Exp $ */
-/* $NetBSD: cpu.h,v 1.41 1999/10/21 20:01:36 ragge Exp $ */
-
-/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden
- * 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 at Ludd, University of Lule}
- * 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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_CPU_H_
-#define _MACHINE_CPU_H_
-#ifdef _KERNEL
-
-#include <sys/device.h>
-#include <sys/evcount.h>
-
-#include <machine/mtpr.h>
-#include <machine/pte.h>
-#include <machine/pcb.h>
-#include <machine/uvax.h>
-#include <machine/psl.h>
-#include <machine/trap.h>
-#include <machine/intr.h>
-
-#include <sys/sched.h>
-struct cpu_info {
- struct proc *ci_curproc;
-
- struct schedstate_percpu ci_schedstate; /* scheduler state */
- u_int32_t ci_randseed;
-#ifdef DIAGNOSTIC
- int ci_mutex_level;
-#endif
-#ifdef GPROF
- struct gmonparam *ci_gmon;
-#endif
-};
-
-extern struct cpu_info cpu_info_store;
-#define curcpu() (&cpu_info_store)
-#define cpu_number() 0
-#define CPU_IS_PRIMARY(ci) 1
-#define CPU_INFO_ITERATOR int
-#define CPU_INFO_FOREACH(cii, ci) \
- for (cii = 0, ci = curcpu(); ci != NULL; ci = NULL)
-#define CPU_INFO_UNIT(ci) 0
-#define MAXCPUS 1
-#define cpu_unidle(ci)
-
-#define CPU_BUSY_CYCLE() do {} while (0)
-
-struct clockframe {
- int pc;
- int ps;
-};
-
-/*
- * All cpu-dependent info is kept in this struct. Pointer to the
- * struct for the current cpu is set up in locore.c.
- */
-struct cpu_dep {
- void (*cpu_init)(void); /* pmap init before mm is on */
- int (*cpu_mchk)(caddr_t); /* Machine check handling */
- void (*cpu_memerr)(void); /* Memory subsystem errors */
- void (*cpu_conf)(void); /* Autoconfiguration */
- int (*cpu_clkread)(struct timespec *, time_t); /* Read cpu clock time */
- void (*cpu_clkwrite)(void); /* Write system time to cpu */
- short cpu_vups; /* speed of cpu */
- short cpu_scbsz; /* (estimated) size of system control block */
- void (*cpu_halt)(void); /* Cpu dependent halt call */
- void (*cpu_reboot)(int); /* Cpu dependent reboot call */
- void (*cpu_clrf)(void); /* Clear cold/warm start flags */
- void (*cpu_hardclock)(struct clockframe *); /* hardclock handler */
-};
-
-extern struct cpu_dep *dep_call; /* Holds pointer to current CPU struct. */
-
-extern struct device *booted_from;
-extern int mastercpu;
-extern int bootdev;
-
-/*
- * Preempt the current process if in interrupt from user mode,
- * or after the current trap/syscall if in system mode.
- */
-
-#define need_resched(ci){ \
- want_resched++; \
- mtpr(AST_OK,PR_ASTLVL); \
- }
-#define clear_resched(ci) want_resched = 0
-
-/*
- * Notify the current process (p) that it has a signal pending,
- * process as soon as possible.
- */
-
-#define signotify(p) mtpr(AST_OK,PR_ASTLVL);
-
-extern int want_resched; /* resched() was called */
-
-/*
- * This is used during profiling to integrate system time.
- */
-#define PROC_PC(p) (((struct trapframe *)((p)->p_addr->u_pcb.framep))->pc)
-#define PROC_STACK(p) (((struct trapframe *)((p)->p_addr->u_pcb.framep))->sp)
-
-/*
- * Give a profiling tick to the current process when the user profiling
- * buffer pages are invalid. On the vax, request an ast to send us
- * through trap, marking the proc as needing a profiling tick.
- */
-#define need_proftick(p) mtpr(AST_OK,PR_ASTLVL)
-
-/*
- * Temporarily switching to ipl 1 when the kernel is idle allows SIMH
- * to recognize the system is idle, and relinquish CPU time as well.
- */
-#define cpu_idle_enter() do { /* nothing */ } while (0)
-#define cpu_idle_leave() do { /* nothing */ } while (0)
-#define cpu_idle_cycle() \
-do { \
- mtpr(0x01, PR_IPL); \
- mtpr(0x00, PR_IPL); \
-} while (0)
-
-/*
- * This defines the I/O device register space size in pages.
- */
-#define IOSPSZ ((16*1024) / VAX_NBPG) /* 16Kb == 32 pages */
-
-struct device;
-
-extern char cpu_model[100];
-
-/* Some low-level prototypes */
-int badaddr(caddr_t, int);
-void dumpconf(void);
-void dumpsys(void);
-void swapconf(void);
-void disk_printtype(int, int);
-vaddr_t vax_map_physmem(paddr_t, int);
-void vax_unmap_physmem(vaddr_t, int);
-void ioaccess(vaddr_t, paddr_t, int);
-void iounaccess(vaddr_t, int);
-void findcpu(void);
-#ifdef DDB
-int kdbrint(int);
-#endif
-#endif /* _KERNEL */
-
-/*
- * CTL_MACHDEP definitions.
- */
-#define CPU_CONSDEV 1 /* dev_t: console terminal device */
-#define CPU_LED_BLINK 2 /* int: display led patterns */
-#define CPU_MAXID 3 /* number of valid machdep ids */
-
-#define CTL_MACHDEP_NAMES { \
- { 0, 0 }, \
- { "console_device", CTLTYPE_STRUCT }, \
- { "led_blink", CTLTYPE_INT } \
-}
-
-#endif /* _MACHINE_CPU_H_ */
diff --git a/sys/arch/vax/include/cvax.h b/sys/arch/vax/include/cvax.h
deleted file mode 100644
index f5d454aa6e7..00000000000
--- a/sys/arch/vax/include/cvax.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $OpenBSD: cvax.h,v 1.2 2011/09/19 20:58:32 miod Exp $ */
-/* $NetBSD: ka650.h,v 1.6 1997/07/26 10:12:43 ragge Exp $ */
-/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mt. Xinu.
- *
- * 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.
- *
- * @(#)ka650.h 7.5 (Berkeley) 6/28/90
- */
-
-/*
- *
- * Definitions specific to CVAX processors.
- */
-
-/*
- * CADR: Cache Disable Register (IPR 37)
- */
-#define CADR_STMASK 0x000000f0 /* 1st level cache state mask */
-#define CADR_SEN2 0x00000080 /* 1st level cache set 2 enabled */
-#define CADR_SEN1 0x00000040 /* 1st level cache set 1 enabled */
-#define CADR_CENI 0x00000020 /* 1st level I-stream caching enabled */
-#define CADR_CEND 0x00000010 /* 1st level D-stream caching enabled */
-
-/*
- * Internal State Info 2: (for mcheck recovery)
- */
-#define IS2_VCR 0x00008000 /* VAX Can't Restart flag */
-
-#ifndef _LOCORE
-
-/*
- * System Support Chip (SSC) registers
- */
-struct cvax_ssc {
- u_long ssc_sscbr; /* SSC Base Addr Register */
- u_long pad1[3];
- u_long ssc_ssccr; /* SSC Configuration Register */
- u_long pad2[3];
- u_long ssc_cbtcr; /* CDAL Bus Timeout Control Register */
- u_long pad3[18];
- u_long ssc_todr; /* TOY Clock Register */
- u_long pad4[36];
- u_long ssc_tcr0; /* timer control reg 0 */
- u_long ssc_tir0; /* timer interval reg 0 */
- u_long ssc_tnir0; /* timer next interval reg 0 */
- u_long ssc_tivr0; /* timer interrupt vector reg 0 */
- u_long ssc_tcr1; /* timer control reg 1 */
- u_long ssc_tir1; /* timer interval reg 1 */
- u_long ssc_tnir1; /* timer next interval reg 1 */
- u_long ssc_tivr1; /* timer interrupt vector reg 1 */
- u_long pad5[184];
- u_char ssc_cpmbx; /* Console Program Mail Box: Lang & Hact */
- u_char ssc_terminfo; /* TTY info: Video Dev, MCS, CRT & ROM flags */
- u_char ssc_keyboard; /* Keyboard code */
-};
-#define CVAX_SSC 0x20140000
-
-extern struct cvax_ssc *cvax_ssc_ptr;
-
-/*
- * CBTCR: CDAL Bus Timeout Control Register (ssc_cbtcr)
- */
-#define CBTCR_BTO 0x80000000 /* r/w unimp IPR or unack intr */
-#define CBTCR_RWT 0x40000000 /* CDAL Bus Timeout on CPU or DMA */
-
-/*
- * TCR0/TCR1: Programable Timer Control Registers (ssc_tcr[01])
- * (The rest of the bits are the same as in the standard VAX
- * Interval timer and are defined in clock.h)
- */
-#define TCR_STP 0x00000004 /* Stop after time-out */
-
-/*
- * Flags for Console Program Mail Box
- */
-#define CPMB_CVAX_HALTACT 0x03 /* Field for halt action */
-#define CPMB_CVAX_RESTART 0x01 /* Restart */
-#define CPMB_CVAX_REBOOT 0x02 /* Reboot */
-#define CPMB_CVAX_HALT 0x03 /* Halt */
-#define CPMB_CVAX_BIP 0x04 /* Bootstrap in progress */
-#define CPMB_CVAX_RIP 0x08 /* Restart in progress */
-#define CPMB_CVAX_DOTHIS 0x30 /* Execute sommand */
-#define CPMB_CVAX_LANG 0xf0 /* Language field */
-
-/*
- * Machine Check frame
- */
-struct cvax_mchk_frame {
- int cvax_bcnt; /* byte count == 0x10 */
- int cvax_summary; /* summary parameter */
- int cvax_mrvaddr; /* most recent vad */
- int cvax_istate1; /* internal state */
- int cvax_istate2; /* internal state */
- int cvax_pc; /* trapped pc */
- int cvax_psl; /* trapped psl */
-};
-
-const char *cvax_mchk_descr(int);
-void cvax_halt(void);
-void cvax_reboot(int);
-
-#endif /* _LOCORE */
diff --git a/sys/arch/vax/include/db_machdep.h b/sys/arch/vax/include/db_machdep.h
deleted file mode 100644
index c0f28516f16..00000000000
--- a/sys/arch/vax/include/db_machdep.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $OpenBSD: db_machdep.h,v 1.18 2016/02/27 13:08:07 mpi Exp $ */
-/* $NetBSD: db_machdep.h,v 1.6 1998/08/10 14:33:33 ragge Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-#ifndef _MACHINE_DB_MACHDEP_H_
-#define _MACHINE_DB_MACHDEP_H_
-
-/*
- * Machine-dependent defines for new kernel debugger.
- * Modified for vax out of i386 code.
- */
-
-#include <sys/param.h>
-#include <uvm/uvm_extern.h>
-#include <machine/trap.h>
-#include <machine/psl.h>
-
-typedef vaddr_t db_addr_t; /* address - unsigned */
-typedef long db_expr_t; /* expression - signed */
-
-typedef struct trapframe db_regs_t;
-extern db_regs_t ddb_regs; /* register state */
-#define DDB_REGS (&ddb_regs)
-
-#define PC_REGS(regs) ((db_addr_t)(regs)->pc)
-#define SET_PC_REGS(regs, value) (regs)->pc = (long)(value)
-
-#define BKPT_INST 0x03 /* breakpoint instruction */
-#define BKPT_SIZE (1) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
-
-#define FIXUP_PC_AFTER_BREAK(regs) ((regs)->pc -= BKPT_SIZE)
-
-#define db_clear_single_step(regs) ((regs)->psl &= ~PSL_T)
-#define db_set_single_step(regs) ((regs)->psl |= PSL_T)
-
-#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BPTFLT)
-#define IS_WATCHPOINT_TRAP(type, code) ((type) == T_TRCTRAP)
-
-#define I_CALL 0xfb
-#define I_RET 0x04
-#define I_IRET 0x02
-
-#define inst_trap_return(ins) (((ins)&0xff) == I_IRET)
-#define inst_return(ins) (((ins)&0xff) == I_RET)
-#define inst_call(ins) (((ins)&0xff) == I_CALL)
-
-/* Prototypes */
-void db_ktrap(struct trapframe *);
-
-#endif /* _MACHINE_DB_MACHDEP_H_ */
diff --git a/sys/arch/vax/include/disklabel.h b/sys/arch/vax/include/disklabel.h
deleted file mode 100644
index 290741be520..00000000000
--- a/sys/arch/vax/include/disklabel.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $OpenBSD: disklabel.h,v 1.10 2015/09/30 14:57:03 krw Exp $ */
-
-/*
- * Copyright (c) 1994 Christopher G. Demetriou
- * 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 Christopher G. Demetriou.
- * 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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_DISKLABEL_H_
-#define _MACHINE_DISKLABEL_H_
-
-#define LABELSECTOR 0 /* sector containing label */
-#define LABELOFFSET 64 /* offset of label in sector */
-#define MAXPARTITIONS 16 /* number of partitions */
-
-#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/vax/include/endian.h b/sys/arch/vax/include/endian.h
deleted file mode 100644
index b8105016565..00000000000
--- a/sys/arch/vax/include/endian.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $OpenBSD: endian.h,v 1.17 2014/07/12 16:25:09 guenther Exp $ */
-
-/*-
- * Copyright (c) 1997 Niklas Hallqvist. 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.
- */
-
-#ifndef _MACHINE_ENDIAN_H_
-#define _MACHINE_ENDIAN_H_
-
-#ifdef __GNUC__
-
-#define __swap64md __swap64gen
-
-#define __swap32md(x) __statement({ \
- __uint32_t __swap32md_y, __swap32md_x = (x); \
- \
- __asm ("rotl $-8, %1, %0; insv %0, $16, $8, %0; " \
- "rotl $8, %1, %%r1; movb %%r1, %0" : \
- "&=r" (__swap32md_y) : "r" (__swap32md_x) : "r1", "cc"); \
- __swap32md_y; \
-})
-
-#define __swap16md(x) __statement({ \
- __uint16_t __swap16md_y, __swap16md_x = (x); \
- \
- __asm ("rotl $8, %1, %0; rotl $-8, %1, %%r1; movb %%r1, %0; " \
- "movzwl %0, %0" : \
- "&=r" (__swap16md_y) : "r" (__swap16md_x) : "r1", "cc"); \
- __swap16md_y; \
-})
-
-/* Tell sys/endian.h we have MD variants of the swap macros. */
-#ifdef notyet
-#define __HAVE_MD_SWAP
-#endif
-
-#endif /* __GNUC__ */
-
-#define _BYTE_ORDER _LITTLE_ENDIAN
-
-#ifndef __FROM_SYS__ENDIAN
-#include <sys/endian.h>
-#endif
-
-#endif /* _MACHINE_ENDIAN_H_ */
diff --git a/sys/arch/vax/include/exec.h b/sys/arch/vax/include/exec.h
deleted file mode 100644
index 1accbebd005..00000000000
--- a/sys/arch/vax/include/exec.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $OpenBSD: exec.h,v 1.12 2015/08/29 01:58:39 guenther Exp $ */
-/* $NetBSD: exec.h,v 1.4 1995/09/23 14:57:40 ragge Exp $ */
-
-/*
- * Copyright (c) 1993 Christopher G. Demetriou
- * 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 _MACHINE_EXEC_H_
-#define _MACHINE_EXEC_H_
-
-#define __LDPGSZ 4096
-
-#define _KERN_DO_ELF
-
-#define ARCH_ELFSIZE 32
-
-#define ELF_TARG_CLASS ELFCLASS32
-#define ELF_TARG_DATA ELFDATA2LSB
-#define ELF_TARG_MACH EM_VAX
-
-#endif /* _MACHINE_EXEC_H_ */
diff --git a/sys/arch/vax/include/frame.h b/sys/arch/vax/include/frame.h
deleted file mode 100644
index 7d339843075..00000000000
--- a/sys/arch/vax/include/frame.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $OpenBSD: frame.h,v 1.4 2011/03/23 16:54:37 pirofti Exp $ */
-/* $NetBSD: frame.h,v 1.2 2000/06/04 19:30:15 matt Exp $ */
-/*
- * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_FRAME_H_
-#define _MACHINE_FRAME_H_
-
-/*
- * Description of calls frame on stack. This is the
- * standard way of making procedure calls on vax systems.
- */
-struct callsframe {
- unsigned int ca_cond; /* condition handler */
- unsigned int ca_maskpsw; /* register mask and saved psw */
- unsigned int ca_ap; /* argument pointer */
- unsigned int ca_fp; /* frame pointer */
- unsigned int ca_pc; /* program counter */
- unsigned int ca_argno; /* argument count on stack */
- unsigned int ca_arg1; /* first arg on stack */
- /* This can be followed by more arguments */
-};
-
-struct icallsframe {
- struct callsframe ica_frame; /* std call frame */
- unsigned int ica_r0; /* interrupt saved r0 */
- unsigned int ica_r1; /* interrupt saved r1 */
- unsigned int ica_r2; /* interrupt saved r2 */
- unsigned int ica_r3; /* interrupt saved r3 */
- unsigned int ica_r4; /* interrupt saved r4 */
- unsigned int ica_r5; /* interrupt saved r5 */
- unsigned int ica_pc; /* interrupt saved pc */
- unsigned int ica_psl; /* interrupt saved psl */
-};
-
-#endif /* _VAX_FRAME_H */
diff --git a/sys/arch/vax/include/intr.h b/sys/arch/vax/include/intr.h
deleted file mode 100644
index 3b962668813..00000000000
--- a/sys/arch/vax/include/intr.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/* $OpenBSD: intr.h,v 1.18 2014/03/29 18:09:30 guenther Exp $ */
-/* $NetBSD: intr.h,v 1.1 1998/08/18 23:55:00 matt Exp $ */
-
-/*
- * Copyright (c) 1998 Matt Thomas.
- * 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 company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_INTR_H_
-#define _MACHINE_INTR_H_
-
-/* Define the various Interrupt Priority Levels */
-
-/* Interrupt Priority Levels are not mutually exclusive. */
-
-#define IPL_NONE 0x00
-#define IPL_SOFT 0x08
-#define IPL_SOFTCLOCK 0x09
-#define IPL_SOFTNET 0x0a
-#define IPL_SOFTTTY 0x0b
-#define IPL_BIO 0x15 /* block I/O */
-#define IPL_NET 0x15 /* network */
-#define IPL_TTY 0x16 /* terminal */
-#define IPL_VM 0x17 /* memory allocation */
-#define IPL_AUDIO 0x15 /* audio */
-#define IPL_CLOCK 0x18 /* clock */
-#define IPL_STATCLOCK 0x18 /* statclock */
-#define IPL_SCHED 0x1f
-#define IPL_HIGH 0x1f
-
-#define IPL_MPSAFE 0 /* no "mpsafe" interrupts */
-
-#define IST_UNUSABLE -1 /* interrupt cannot be used */
-#define IST_NONE 0 /* none (dummy) */
-#define IST_PULSE 1 /* pulsed */
-#define IST_EDGE 2 /* edge-triggered */
-#define IST_LEVEL 3 /* level-triggered */
-
-#define _splset(reg) \
-({ \
- register int val; \
- __asm volatile ("mfpr $0x12,%0;mtpr %1,$0x12" \
- : "=&g" (val) \
- : "g" (reg)); \
- val; \
-})
-
-#define _splraise(reg) \
-({ \
- register int val; \
- __asm volatile ("mfpr $0x12,%0" \
- : "=&g" (val) \
- : ); \
- if ((reg) > val) { \
- __asm volatile ("mtpr %0,$0x12" \
- : \
- : "g" (reg)); \
- } \
- val; \
-})
-
-#define splx(reg) \
- __asm volatile ("mtpr %0,$0x12" : : "g" (reg))
-
-#define spl0() _splset(IPL_NONE)
-#define splsoftclock() _splraise(IPL_SOFTCLOCK)
-#define splsoftnet() _splraise(IPL_SOFTNET)
-#define splbio() _splraise(IPL_BIO)
-#define splnet() _splraise(IPL_NET)
-#define spltty() _splraise(IPL_TTY)
-#define splvm() _splraise(IPL_VM)
-#define splaudio() _splraise(IPL_AUDIO)
-#define splclock() _splraise(IPL_CLOCK)
-#define splstatclock() _splraise(IPL_STATCLOCK)
-#define splhigh() _splset(IPL_HIGH)
-#define splsched() splhigh()
-
-/* These are better to use when playing with VAX buses */
-#define spl4() _splraise(0x14)
-#define spl5() _splraise(0x15)
-#define spl6() _splraise(0x16)
-#define spl7() _splraise(0x17)
-
-/* SPL asserts */
-#ifdef DIAGNOSTIC
-/*
- * Although this function is implemented in MI code, it must be in this MD
- * header because we don't want this header to include MI includes.
- */
-void splassert_fail(int, int, const char *);
-extern int splassert_ctl;
-void splassert_check(int, const char *);
-#define splassert(__wantipl) do { \
- if (splassert_ctl > 0) { \
- splassert_check(__wantipl, __func__); \
- } \
-} while (0)
-#define splsoftassert(wantipl) splassert(wantipl)
-#else
-#define splassert(wantipl) do { /* nothing */ } while (0)
-#define splsoftassert(wantipl) do { /* nothing */ } while (0)
-#endif
-
-#define SI_SOFT 0 /* for IPL_SOFT */
-#define SI_SOFTCLOCK 1 /* for IPL_SOFTCLOCK */
-#define SI_SOFTNET 2 /* for IPL_SOFTNET */
-#define SI_SOFTTTY 3 /* for IPL_SOFTTTY */
-
-#define SI_NQUEUES 4
-
-#ifndef _LOCORE
-
-#include <machine/mutex.h>
-#include <sys/queue.h>
-
-struct soft_intrhand {
- TAILQ_ENTRY(soft_intrhand) sih_list;
- void (*sih_func)(void *);
- void *sih_arg;
- struct soft_intrq *sih_siq;
- int sih_pending;
-};
-
-struct soft_intrq {
- TAILQ_HEAD(, soft_intrhand) siq_list;
- int siq_si;
- struct mutex siq_mtx;
-};
-
-void softintr_disestablish(void *);
-void *softintr_establish(int, void (*)(void *), void *);
-void softintr_init(void);
-void softintr_schedule(void *);
-
-#endif /* _LOCORE */
-
-#endif /* _VAX_INTR_H */
diff --git a/sys/arch/vax/include/ka410.h b/sys/arch/vax/include/ka410.h
deleted file mode 100644
index a9461641e7c..00000000000
--- a/sys/arch/vax/include/ka410.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/* $OpenBSD: ka410.h,v 1.7 2011/09/11 19:29:01 miod Exp $ */
-/* $NetBSD: ka410.h,v 1.2 1997/02/19 10:06:05 ragge Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * Definition for I/O addresses of
- *
- * MicroVAX 2000 (TeamMate)
- * VAXstation 2000 (VAXstar)
- */
-
-#define KA410_SIDEX 0x20040004 /* SID extension register */
-
-#define KA410_CFGTST 0x20020000 /* Configuration and Test register */
-#define KA410_IORESET 0x20020000 /* I/O Reset register */
-
-#define KA410_ROM_BASE 0x20040000 /* System module ROM */
-#define KA410_ROM_END 0x2007FFFF
-#define KA410_ROM_SIZE 0x40000
-
-#define KA410_IVN_BASE 0x20040020 /* Interrupt Vector Numbers */
-#define KA410_IVN_END 0x2004003F
-#define KA410_IVN_SIZE 0x20
-
-#define KA410_HLTCOD 0x20080000 /* Halt Code Register */
-#define KA410_MSER 0x20080004 /* Memory System Error register */
-#define KA410_MEAR 0x20080008 /* Memory Error Address register */
-#define KA410_INTMSK 0x2008000C /* Interrupt Mask register */
-#define KA410_VDCORG 0x2008000D /* Video Controller Origin Register */
-#define KA410_VDCSEL 0x2008000E /* Video Controller Select Register */
-#define KA410_INTREQ 0x2008000F /* Interrupt Request register */
-#define KA410_INTCLR 0x2008000F /* Interrupt Request clear register */
-
-/*
- * Other fixed addresses which should be mapped
- */
-#define KA410_NWA_BASE 0x20090000 /* Network Address ROM */
-#define KA410_NWA_END 0x2009007F
-#define KA410_NWA_SIZE 0x80
-#define KA410_SER_BASE 0x200A0000 /* Serial line controller */
-#define KA410_SER_END 0x200A000F
-#define KA410_SER_SIZE 0x10
-#define KA410_WAT_BASE 0x200B0000 /* TOY clock */
-#define KA410_WAT_END 0x200B00FF
-#define KA410_WAT_SIZE 0x100
-#define KA410_DKC_BASE 0x200C0000 /* Disk Controller Ports */
-#define KA410_DKC_END 0x200C0007
-#define KA410_DKC_SIZE 0x08
-#define KA410_SCS_BASE 0x200C0080 /* Tape (SCSI) Controller Chip */
-#define KA410_SCS_END 0x200C009F
-#define KA410_SCS_SIZE 0x20
-#define KA410_DMA_BASE 0x200D0000 /* Disk Data buffer RAM */
-#define KA410_DMA_END 0x200D3FFF
-#define KA410_DMA_SIZE 0x4000
-#define KA410_LAN_BASE 0x200E0000 /* LANCE chip registers */
-#define KA410_LAN_END 0x200E0007
-#define KA410_LAN_SIZE 0x08
-#define KA410_CUR_BASE 0x200F0000 /* Monochrome video cursor chip */
-#define KA410_CUR_END 0x200F003F
-#define KA410_CUR_SIZE 0x40
-
-#define KA410_SCS_DADR 0x200C00A0 /* Tape(SCSI) DMA address register */
-#define KA410_SCS_DCNT 0x200C00C0 /* Tape(SCSI) DMA byte count reg. */
-#define KA410_SCS_DDIR 0x200C00C4 /* Tape(SCSI) DMA transfer direction */
-
-/*
- * Definitions for the Configuration and Test Register
- */
-#define KA410_CFG_MULTU 0x80 /* MicroVAX or VAXstation */
-#define KA410_CFG_NETOPT 0x40 /* Network option present */
-#define KA410_CFG_L3CON 0x20 /* Console on line #3 of dc */
-#define KA410_CFG_CURTEST 0x10 /* Cursor Test (monochrom) */
-#define KA410_CFG_VIDOPT 0x08 /* Video option present */
-#define KA410_CFG_MEMSZ 0x07 /* Memory option type/size */
-
-#define KA410_CFG_0MB 0x00 /* No additional Memory board */
-#define KA410_CFG_1MB 0x01
-#define KA410_CFG_2MB 0x02
-#define KA410_CFG_4MB 0x03
-#define KA410_CFG_6MB 0x04
-#define KA410_CFG_8MB 0x05
-#define KA410_CFG_12MB 0x06
-#define KA410_CFG_14MB 0x07
-
-
-/*
- * interrupt request-, clear-, and mask register
- */
-extern volatile unsigned char *ka410_intreq;
-extern volatile unsigned char *ka410_intclr;
-extern volatile unsigned char *ka410_intmsk;
-
-#define INTR_SR (1<<7) /* Serial line receiver or silo full */
-#define INTR_ST (1<<6) /* Serial line transmitter done */
-#define INTR_NP (1<<5) /* Network controller primary */
-#define INTR_NS (1<<4) /* Network controller secondary */
-#define INTR_VF (1<<3) /* Video end of frame */
-#define INTR_VS (1<<2) /* Video secondary */
-#define INTR_SC (1<<1) /* SCSI controller */
-#define INTR_DC (1<<0) /* Disk controller */
-
-/*
- * Clock-Chip data in NVRAM
- */
-#define KA410_CPMBX 0x200B0038 /* Console Mailbox (1 byte) */
-#define KA410_CPFLG 0x200B003C /* Console Program Flags (1 byte) */
-#define KA410_LK201_ID 0x200B0040 /* Keyboard Variation (1 byte) */
-#define KA410_CONS_ID 0x200B0044 /* Console Device Type (1 byte) */
-#define KA410_SCR 0x200B0048 /* Console Scratch RAM */
-#define KA410_TEMP 0x200B0058 /* Used by System Firmware */
-#define KA410_BAT_CHK 0x200B0088 /* Battery Check Data */
-#define KA410_BOOTDEV 0x200B0098 /* Default Boot Device (4 bytes) */
-#define KA410_BOOTFLG 0x200B00A8 /* Default Boot Flags (4 bytes) */
-#define KA410_SCRLEN 0x200B00B8 /* Number of pages of SCR (1 byte) */
-#define KA410_SCSIPORT 0x200B00BC /* Tape Controller Port Data */
-#define KA410_RESERVED 0x200B00C0 /* Reserved (16 bytes) */
-
-
-/*
- * KA410 uses bits 2-9 of longwords to store single bytes in NVRAM,
- * thus we declare the clock as an struct of bit-fields, so that the
- * generic clock-routines work for KA410...
- */
-struct ka410_clock {
- u_long :2; u_long sec :8; u_long :22;
- u_long :2; u_long secalrm :8; u_long :22;
- u_long :2; u_long min :8; u_long :22;
- u_long :2; u_long minalrm :8; u_long :22;
- u_long :2; u_long hr :8; u_long :22;
- u_long :2; u_long hralrm :8; u_long :22;
- u_long :2; u_long dayofwk :8; u_long :22;
- u_long :2; u_long day :8; u_long :22;
- u_long :2; u_long mon :8; u_long :22;
- u_long :2; u_long yr :8; u_long :22;
- u_long :2; u_long csr0 :8; u_long :22;
- u_long :2; u_long csr1 :8; u_long :22;
- u_long :2; u_long csr2 :8; u_long :22;
- u_long :2; u_long csr3 :8; u_long :22;
- u_long :2; u_long cpmbx :8; u_long :22;
-};
diff --git a/sys/arch/vax/include/ka420.h b/sys/arch/vax/include/ka420.h
deleted file mode 100644
index b7c4e4536cc..00000000000
--- a/sys/arch/vax/include/ka420.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $OpenBSD: ka420.h,v 1.5 2008/08/18 23:07:24 miod Exp $ */
-/* $NetBSD: ka420.h,v 1.2 1998/06/07 18:34:09 ragge Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * Definitions for I/O addresses of
- *
- * VAXstation 3100 models 30, 40 (PVAX)
- * MicroVAX 3100 models 10, 20 (Teammate II)
- * MicroVAX 3100 models 10e, 20e (Teammate II)
- * VAXstation 3100 models 38, 48 (PVAX rev#7)
- */
-
-#define KA420_SIDEX 0x20040004 /* SID extension register */
-
-#define KA420_CH2_BASE 0x10000000 /* 2nd level cache data area */
-#define KA420_CH2_END 0x10007FFF
-#define KA420_CH2_SIZE 0x8000
-#define KA420_CT2_BASE 0x10010000 /* 2nd level cache tag area */
-#define KA420_CT2_END 0x10017FFF
-#define KA420_CT2_SIZE 0x8000
-#define KA420_CH2_CREG 0x20084000 /* 2nd level cache control register */
-
-#define KA420_CFGTST 0x20020000 /* Configuration and Test register */
-#define KA420_IORESET 0x20020000 /* I/O Reset register */
-
-#define KA420_ROM_BASE 0x20040000 /* System module ROM */
-#define KA420_ROM_END 0x2007FFFF
-#define KA420_ROM_SIZE 0x40000 /* ??? */
-
-#define KA420_IVN_BASE 0x20040020 /* Interrupt Vector Numbers */
-#define KA420_IVN_END 0x2004003F
-#define KA420_IVN_SIZE 0x20
-
-#define KA420_HLTCOD 0x20080000 /* Halt Code Register */
-#define KA420_MSER 0x20080004 /* Memory System Error register */
-#define KA420_MEAR 0x20080008 /* Memory Error Address register */
-#define KA420_INTMSK 0x2008000C /* Interrupt Mask register */
-#define KA420_VDCORG 0x2008000D /* Video Controller Origin Register */
-#define KA420_VDCSEL 0x2008000E /* Video Controller Select Register */
-#define KA420_INTREQ 0x2008000F /* Interrupt Request register */
-#define KA420_INTCLR 0x2008000F /* Interrupt Request clear register */
-
-#define KA420_CACR 0x20084000 /* L2 cache ctrl reg */
-
-/*
- * Other fixed addresses which should be mapped
- */
-#define KA420_NWA_BASE 0x20090000 /* Network Address ROM */
-#define KA420_NWA_END 0x2009007F
-#define KA420_NWA_SIZE 0x80
-#define KA420_SER_BASE 0x200A0000 /* Serial line controller */
-#define KA420_SER_END 0x200A000F
-#define KA420_SER_SIZE 0x10
-#define KA420_WAT_BASE 0x200B0000 /* TOY clock and NV-RAM */
-#define KA420_WAT_END 0x200B00FF
-#define KA420_WAT_SIZE 0x100
-#define KA420_DKC_BASE 0x200C0000 /* Disk Controller Ports */
-#define KA420_DKC_END 0x200C0007
-#define KA420_DKC_SIZE 0x08
-#define KA420_SCS_BASE 0x200C0080 /* Tape (SCSI) Controller Chip */
-#define KA420_SCS_END 0x200C009F
-#define KA420_SCS_SIZE 0x20
-#define KA420_D16_BASE 0x200D0000 /* 16KB (compatibility) Data Buffer */
-#define KA420_D16_END 0x200D3FFF
-#define KA420_D16_SIZE 0x4000
-#define KA420_LAN_BASE 0x200E0000 /* LANCE chip registers */
-#define KA420_LAN_END 0x200E0007
-#define KA420_LAN_SIZE 0x08
-#define KA420_CUR_BASE 0x200F0000 /* Monochrome video cursor chip */
-#define KA420_CUR_END 0x200F003F
-#define KA420_CUR_SIZE 0x40
-#define KA420_DMA_BASE 0x202D0000 /* 128KB Data Buffer */
-#define KA420_DMA_END 0x202EFFFF
-#define KA420_DMA_SIZE 0x20000
-
-#define KA420_SCD_DADR 0x200C00A0 /* Tape(SCSI) DMA address register */
-#define KA420_SCD_DCNT 0x200C00C0 /* Tape(SCSI) DMA byte count reg. */
-#define KA420_SCD_DDIR 0x200C00C4 /* Tape(SCSI) DMA transfer direction */
-
-#define KA420_STC_MODE 0x200C00E0 /* Storage Controller Mode register */
-
-/*
- * Clock-Chip data in NVRAM
- */
-#define KA420_CPMBX 0x200B0038 /* Console Mailbox (1 byte) */
-#define KA420_CPFLG 0x200B003C /* Console Program Flags (1 byte) */
-#define KA420_LK201_ID 0x200B0040 /* Keyboard Variation (1 byte) */
-#define KA420_CONS_ID 0x200B0044 /* Console Device Type (1 byte) */
-#define KA420_SCR 0x200B0048 /* Console Scratch RAM */
-#define KA420_TEMP 0x200B0058 /* Used by System Firmware */
-#define KA420_BAT_CHK 0x200B0088 /* Battery Check Data */
-#define KA420_BOOTDEV 0x200B0098 /* Default Boot Device (4 bytes) */
-#define KA420_BOOTFLG 0x200B00A8 /* Default Boot Flags (4 bytes) */
-#define KA420_SCRLEN 0x200B00B8 /* Number of pages of SCR (1 byte) */
-#define KA420_SCSIPORT 0x200B00BC /* Tape Controller Port Data */
-#define KA420_RESERVED 0x200B00C0 /* Reserved (16 bytes) */
-
-/* Used bits in the CFGTST (20020000) register */
-#define KA420_CFG_STCMSK 0xc000 /* Storage controller mask */
-#define KA420_CFG_RB 0x0000 /* RB (ST506/SCSI) present */
-#define KA420_CFG_RD 0x4000 /* RD (SCSI/SCSI) present */
-#define KA420_CFG_NONE 0xc000 /* No storage ctlr present */
-#define KA420_CFG_MULTU 0x80 /* MicroVAX or VAXstation */
-#define KA420_CFG_CACHPR 0x40 /* Secondary cache present */
-#define KA420_CFG_L3CON 0x20 /* Console on line #3 of dc */
-#define KA420_CFG_CURTEST 0x10 /* Cursor Test (monochrom) */
-#define KA420_CFG_VIDOPT 0x08 /* Video option present */
-
-/* Secondary cache bits (CACR, 20084000) */
-#define KA420_CACR_CP3 0x80000000 /* last parity read */
-#define KA420_CACR_CP2 0x40000000 /* last parity read */
-#define KA420_CACR_CP1 0x20000000 /* last parity read */
-#define KA420_CACR_CP0 0x10000000 /* last parity read */
-#define KA420_CACR_TPP 0x00100000 /* tag predicted parity */
-#define KA420_CACR_TGP 0x00080000 /* tag parity read */
-#define KA420_CACR_TGV 0x00040000 /* valid flag */
-#define KA420_CACR_TPE 0x00000020 /* tag parity error */
-#define KA420_CACR_CEN 0x00000010 /* cache enable */
-
diff --git a/sys/arch/vax/include/ka43.h b/sys/arch/vax/include/ka43.h
deleted file mode 100644
index c6fab8aa576..00000000000
--- a/sys/arch/vax/include/ka43.h
+++ /dev/null
@@ -1,234 +0,0 @@
-/* $OpenBSD: ka43.h,v 1.6 2011/09/13 21:25:23 miod Exp $ */
-/* $NetBSD: ka43.h,v 1.6 2005/01/14 11:47:43 ragge Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * Definitions for I/O addresses of
- *
- * VAXstation 3100 model 76 (RigelMAX)
- */
-
-#define KA43_SIDEX 0x20040004 /* SID extension register */
-
-#define KA43_CFGTST 0x20020000 /* Configuration and Test register */
-#define KA43_IORESET 0x20020000 /* I/O Reset register */
-
-#define KA43_ROMGETC 0x20040044
-#define KA43_ROMPUTC 0x20040058
-#define KA43_ROMPUTS 0x2004004C
-
-#define KA43_CH2_BASE 0x10000000 /* 2nd level cache data area */
-#define KA43_CH2_END 0x1FFFFFFF
-#define KA43_CH2_SIZE 0x10000000
-#define KA43_CT2_BASE 0x21000000 /* 2nd level cache tag area */
-#define KA43_CT2_END 0x2101FFFF
-#define KA43_CT2_SIZE 0x20000
-#define KA43_CH2_CREG 0x21100000 /* 2nd level cache control register */
-
-#define KA43_ROM_BASE 0x20040000 /* System module ROM */
-#define KA43_ROM_END 0x2007FFFF
-#define KA43_ROM_SIZE 0x40000 /* ??? */
-
-#define KA43_IVN_BASE 0x20040020 /* Interrupt Vector Numbers */
-#define KA43_IVN_END 0x2004003F
-#define KA43_IVN_SIZE 0x20
-
-#define KA43_HLTCOD 0x20080000 /* Halt Code Register */
-/* #define KA43_MSER 0x20080004 */ /* Memory System Error register */
-/* #define KA43_MEAR 0x20080008 */ /* Memory Error Address register */
-#define KA43_INTMSK 0x2008000C /* Interrupt Mask register */
-#define KA43_VDCORG 0x2008000D /* Video Controller Origin Register */
-#define KA43_VDCSEL 0x2008000E /* Video Controller Select Register */
-#define KA43_INTREQ 0x2008000F /* Interrupt Request register */
-#define KA43_INTCLR 0x2008000F /* Interrupt Request clear register */
-#define KA43_DIAGDSP 0x20080010 /* Diagnostic display register */
-#define KA43_PARCTL 0x20080014 /* Parity Control Register */
-#define KA43_DIAGTME 0x2008001E /* diagnostic time register */
-
-#define KA43_PCTL_DPEN 0x00000001 /* DMA parity enable (bit 0) */
-#define KA43_PCTL_CPEN 0x00000002 /* CPU Parity enable (bit 1) */
-#define KA43_PCTL_DMA 0x01000000 /* LANCE DMA control (bit 24) */
-
-/*
- * "CH2" and "SESR" are two common names related to Secondary Cache
- */
-#define KA43_SESR 0x21100000 /* same as KA43_CH2_CREG */
-
-#define KA43_SESR_CENB 0x00000001 /* Cache Enable */
-#define KA43_SESR_SERR 0x00000002
-#define KA43_SESR_LERR 0x00000004
-#define KA43_SESR_CERR 0x00000008
-#define KA43_SESR_DIRTY 0x00000010
-#define KA43_SESR_MISS 0x00000020
-#define KA43_SESR_DPE 0x00000040 /* Dal Parity Error */
-#define KA43_SESR_TPE 0x00000080 /* Tag Parity Error */
-#define KA43_SESR_WSB 0x00010000
-#define KA43_SESR_CIEA 0x7FFC0000
-
-#define KA43_SESR_BITS \
- "\020\010TPE\007DPE\006MISS\005DIRTY\004CERR\003LERR\002SERR\001ENABLE"
-
-/*
- * The following values refer to bits/bitfields within the 4 internal
- * registers controlling primary cache:
- * PR_PCTAG(124, tag-register) PR_PCIDX(125, index-register)
- * PR_PCERR(126, error-register) PR_PCSTS(127, status-register)
- */
-#define KA43_PCTAG_TAG 0x1FFFF800 /* bits 11-29 */
-#define KA43_PCTAG_PARITY 0x40000000
-#define KA43_PCTAG_VALID 0x80000000
-
-#define KA43_PCIDX_INDEX 0x000007F8 /* 0x100 Q-word entries */
-
-#define KA43_PCERR_ADDR 0x3FFFFFFF
-
-#define KA43_PCS_FORCEHIT 0x00000001 /* Force hit */
-#define KA43_PCS_ENABLE 0x00000002 /* Enable primary cache */
-#define KA43_PCS_FLUSH 0x00000004 /* Flush cache */
-#define KA43_PCS_REFRESH 0x00000008 /* Enable refresh */
-#define KA43_PCS_HIT 0x00000010 /* Cache hit */
-#define KA43_PCS_INTERRUPT 0x00000020 /* Interrupt pending */
-#define KA43_PCS_TRAP2 0x00000040 /* Trap while trap */
-#define KA43_PCS_TRAP1 0x00000080 /* Micro trap/machine check */
-#define KA43_PCS_TPERR 0x00000100 /* Tag parity error */
-#define KA43_PCS_DPERR 0x00000200 /* Dal data parity error */
-#define KA43_PCS_PPERR 0x00000400 /* P data parity error */
-#define KA43_PCS_BUSERR 0x00000800 /* Bus error */
-#define KA43_PCS_BCHIT 0x00001000 /* B cache hit */
-
-#define KA43_PCSTS_BITS \
- "\020\015BCHIT\014BUSERR\013PPERR\012DPERR\011TPERR\010TRAP1" \
- "\007TRAP2\006INTR\005HIT\004REFRESH\003FLUSH\002ENABLE\001FORCEHIT"
-
-/*
- * Bits in PR_ACCS (Floating Point Accelerator Register)
- */
-#define KA43_ACCS_VECTOR (1<<0) /* Vector Unit Present */
-#define KA43_ACCS_FCHIP (1<<1) /* FPU chip present */
-#define KA43_ACCS_WEP (1<<31) /* Write Even Parity */
-
-/*
- * Other fixed addresses which should be mapped
- */
-#define KA43_CPU_BASE 0x20080000 /* so called "CPU registers" */
-#define KA43_CPU_END 0x200800FF
-#define KA43_CPU_SIZE 0x100
-#define KA43_NWA_BASE 0x20090000 /* Network Address ROM */
-#define KA43_NWA_END 0x2009007F
-#define KA43_NWA_SIZE 0x80
-#define KA43_SER_BASE 0x200A0000 /* Serial line controller */
-#define KA43_SER_END 0x200A000F
-#define KA43_SER_SIZE 0x10
-#define KA43_WAT_BASE 0x200B0000 /* TOY clock and NV-RAM */
-#define KA43_WAT_END 0x200B00FF
-#define KA43_WAT_SIZE 0x100
-#define KA43_SC1_BASE 0x200C0080 /* 1st SCSI Controller Chip */
-#define KA43_SC1_END 0x200C009F
-#define KA43_SC1_SIZE 0x20
-#define KA43_SC2_BASE 0x200C0180 /* 2nd SCSI Controller Chip */
-#define KA43_SC2_END 0x200C019F
-#define KA43_SC2_SIZE 0x20
-#define KA43_SCS_BASE 0x200C0000 /* area occupied by SCSI 1+2 */
-#define KA43_SCS_END 0x200C01FF
-#define KA43_SCS_SIZE 0x200
-#define KA43_LAN_BASE 0x200E0000 /* LANCE chip registers */
-#define KA43_LAN_END 0x200E0007
-#define KA43_LAN_SIZE 0x08
-#define KA43_CUR_BASE 0x200F0000 /* Monochrome video cursor chip */
-#define KA43_CUR_END 0x200F003C
-#define KA43_CUR_SIZE 0x40
-#define KA43_DMA_BASE 0x202D0000 /* 128KB Data Buffer */
-#define KA43_DMA_END 0x202EFFFF
-#define KA43_DMA_SIZE 0x20000
-#define KA43_VME_BASE 0x30000000
-#define KA43_VME_END 0x3003FFFF
-#define KA43_VME_SIZE 0x40000
-
-#define KA43_DIAGMEM 0x28000000 /* start of diagnostic memory */
-
-#define KA43_SC1_DADR 0x200C00A0 /* (1st SCSI) DMA address register */
-#define KA43_SC1_DCNT 0x200C00C0 /* (1st SCSI) DMA byte count reg. */
-#define KA43_SC1_DDIR 0x200C00C4 /* (1st SCSI) DMA transfer direction */
-#define KA43_SC2_DADR 0x200C01A0
-#define KA43_SC2_DCNT 0x200C01C0
-#define KA43_SC2_DDIR 0x200C01C4
-
-/*
- * Clock-Chip data in NVRAM
- */
-#define KA43_CPMBX 0x200B0038 /* Console Mailbox (1 byte) */
-#define KA43_CPFLG 0x200B003C /* Console Program Flags (1 byte) */
-#define KA43_LK201_ID 0x200B0040 /* Keyboard Variation (1 byte) */
-#define KA43_CONS_ID 0x200B0044 /* Console Device Type (1 byte) */
-#define KA43_SCR 0x200B0048 /* Console Scratch RAM */
-#define KA43_TEMP 0x200B0058 /* Used by System Firmware */
-#define KA43_BAT_CHK 0x200B0088 /* Battery Check Data */
-#define KA43_PASSWD 0x200B0098 /* ??? */
-#define KA43_BOOTFLG 0x200B00A8 /* Default Boot Flags (4 bytes) */
-#define KA43_SCRLEN 0x200B00B8 /* Number of pages of SCR (1 byte) */
-#define KA43_SCSIPORT 0x200B00BC /* Tape Controller Port Data */
-#define KA43_RESERVED 0x200B00C0 /* Reserved (16 bytes) */
-
-struct ka43_cpu {
- u_long hltcod; /* Halt Code Register */
- u_long pad2;
- u_long pad3;
- u_char intreg[4]; /* Four 1-byte registers */
- u_short diagdsp; /* Diagnostic display register */
- u_short pad4;
- u_long parctl; /* Parity Control Register */
- u_short pad5;
- u_short pad6;
- u_short pad7;
- u_short diagtme; /* Diagnostic time register */
-};
-
-struct ka43_clock {
- u_long :2; u_long sec :8; u_long :22;
- u_long :2; u_long secalrm :8; u_long :22;
- u_long :2; u_long min :8; u_long :22;
- u_long :2; u_long minalrm :8; u_long :22;
- u_long :2; u_long hr :8; u_long :22;
- u_long :2; u_long hralrm :8; u_long :22;
- u_long :2; u_long dayofwk :8; u_long :22;
- u_long :2; u_long day :8; u_long :22;
- u_long :2; u_long mon :8; u_long :22;
- u_long :2; u_long yr :8; u_long :22;
- u_long :2; u_long csr0 :8; u_long :22;
- u_long :2; u_long csr1 :8; u_long :22;
- u_long :2; u_long csr2 :8; u_long :22;
- u_long :2; u_long csr3 :8; u_long :22;
- u_long :2; u_long req :4;
- u_long halt :4; u_long :22;
-};
diff --git a/sys/arch/vax/include/ka46.h b/sys/arch/vax/include/ka46.h
deleted file mode 100644
index ce521a01f50..00000000000
--- a/sys/arch/vax/include/ka46.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $OpenBSD: ka46.h,v 1.1 2000/04/26 06:08:27 bjc Exp $ */
-/* $NetBSD: ka46.h,v 1.2 1998/08/11 17:52:58 ragge Exp $ */
-/*
- * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * KA46 (VS4000/60) specific definitions.
- */
-
-
-/* IPR bits definitions */
-#define PCSTS_FLUSH 4
-#define PCSTS_ENABLE 2
-#define PCTAG_PARITY 0x80000000
-#define PCTAG_VALID 1
-
-/* memory addresses of interest */
-#define KA46_INVFLT 0x20200000
-#define KA46_INVFLTSZ 32768
-#define KA46_CCR 0x23000000
-#define KA46_TAGST 0x2d000000
-#define KA46_TAGSZ 32768
-
-#define CCR_CENA 0x00000001
-#define CCR_SPECIO 0x00000010
-
-#define KA46_BWF0 0x20080014
-#define BWF0_FEN 0x01000000
diff --git a/sys/arch/vax/include/ka48.h b/sys/arch/vax/include/ka48.h
deleted file mode 100644
index fc38726d75e..00000000000
--- a/sys/arch/vax/include/ka48.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* $OpenBSD: ka48.h,v 1.3 2006/03/04 19:33:21 miod Exp $ */
-/*
- * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * KA48 (VS4000 VLC) specific definitions. *** INCOMPLETE ! MK-990306 ***
- */
-
-
-/* IPR bits definitions */
-#define PCSTS_FLUSH 4
-#define PCSTS_ENABLE 2
-#define PCTAG_PARITY 0x80000000
-#define PCTAG_VALID 1
-
-/* memory addresses of interest */
-#define KA48_INVFLT 0x20200000
-#define KA48_INVFLTSZ 16384
-#define KA48_CCR 0x23000000
-#define KA48_TAGST 0x2d000000
-#define KA48_TAGSZ 32768
-
-#define CCR_CENA 0x00000001
-#define CCR_SPECIO 0x00000010
-
-#define KA48_BWF0 0x20080014
-#define BWF0_FEN 0x01000000
-
-/* From OpenVMS $IO440DEF & $KA440DEF */
-#define KA48_PARCTL 0x20080014
-#define KA48_PARCTL_CPEN 0x00000001 /* CPU Parity Enable? */
-#define KA48_PARCTL_NPEN 0x00000100 /* ?? Parity Enable */
-#define KA48_PARCTL_INVENA 0x01000000 /* Invalid ? Enable */
-#define KA48_PARCTL_AGS 0x02000000 /* ??? */
diff --git a/sys/arch/vax/include/ka630.h b/sys/arch/vax/include/ka630.h
deleted file mode 100644
index cd6e32914d9..00000000000
--- a/sys/arch/vax/include/ka630.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* $OpenBSD: ka630.h,v 1.7 2011/03/23 16:54:37 pirofti Exp $ */
-/* $NetBSD: ka630.h,v 1.5 2000/07/19 01:01:58 matt Exp $ */
-/*-
- * Copyright (c) 1986, 1988 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.
- *
- * @(#)uvaxII.h 7.4 (Berkeley) 5/9/91
- */
-
-#ifndef _MACHINE_KA630_H_
-#define _MACHINE_KA630_H_
-
-#define UVAXIISID ((u_long *)0x20040004)
-#define UVAXIICPU ((struct uvaxIIcpu *)0x20080000)
-
-#ifndef _LOCORE
-struct uvaxIIcpu {
- u_short uvaxII_bdr;
- u_short uvaxII_xxx;
- u_long uvaxII_mser;
- u_long uvaxII_cear;
- u_long uvaxII_dear;
-};
-#endif
-
-/* Memory system err reg. */
-#define UVAXIIMSER_CD 0x00000300
-#define UVAXIIMSER_NXM 0x00000080
-#define UVAXIIMSER_LPE 0x00000040
-#define UVAXIIMSER_QPE 0x00000020
-#define UVAXIIMSER_MERR 0x000000f0
-#define UVAXIIMSER_CPUE 0x00000060
-#define UVAXIIMSER_DQPE 0x00000010
-#define UVAXIIMSER_LEB 0x00000008
-#define UVAXIIMSER_WRWP 0x00000002
-#define UVAXIIMSER_PEN 0x00000001
-
-/* Mem. error address regs. */
-#define UVAXIICEAR_PG 0x00007fff
-#define UVAXIIDEAR_PG 0x00007fff
-
-/*
- * Definitions specific to the ka630 MicroVAXII Q22 bus cpu card. Includes the
- * tod clock chip and the cpu registers.
- */
-#define KA630CLK ((struct ka630clock *)0x200b8000)
-
-/* Bdr register bits */
-#define KA630BDR_PWROK 0x8000
-#define KA630BDR_HLTENB 0x4000
-#define KA630BDR_CPU 0x0c00
-#define KA630BDR_BDG 0x0300
-#define KA630BDR_DSPL 0x000f
-
-/* Clock registers and constants */
-#define MINSEC 60
-#define HRSEC 3600
-#define DAYSEC (HRSEC * 24)
-#define YEARSEC (DAYSEC * 365)
-
-#define KA630CLK_VRT 0200
-#define KA630CLK_UIP 0200
-#define KA630CLK_RATE 040
-#define KA630CLK_ENABLE 06
-#define KA630CLK_SET 0206
-/* cpmbx bits */
-#define KA630CLK_HLTACT 03
-/* halt action values */
-#define KA630CLK_RESTRT 01
-#define KA630CLK_REBOOT 02
-#define KA630CLK_HALT 03
-#define KA630CLK_DOTHIS 040
-/* in progress flags */
-#define KA630CLK_BOOT 04
-#define KA630CLK_RSTRT 010
-#define KA630CLK_LANG 0360
-
-#ifndef _LOCORE
-struct ka630clock {
- u_short sec;
- u_short secalrm;
- u_short min;
- u_short minalrm;
- u_short hr;
- u_short hralrm;
- u_short dayofwk;
- u_short day;
- u_short mon;
- u_short yr;
- u_short csr0;
- u_short csr1;
- u_short csr2;
- u_short csr3;
- u_short cpmbx; /* CPMBX is used by the boot rom. see ka630-ug-3.3.3 */
-};
-#endif
-
-#define KA630_NVR_ADRS 0x200B8024
-/* Definitions for various locations in the KA630 console page */
-#define KA630_PUTC_POLL 0x20
-#define KA630_PUTC 0x24
-#define KA630_GETC 0x1C
-#define KA630_ROW 0x4C
-#define KA630_MINROW 0x4D
-#define KA630_MAXROW 0x4E
-#define KA630_COL 0x50
-#define KA630_MINCOL 0x51
-#define KA630_MAXCOL 0x52
-
-#endif /* _MACHINE_KA630_H_ */
-
diff --git a/sys/arch/vax/include/ka650.h b/sys/arch/vax/include/ka650.h
deleted file mode 100644
index d24b055badf..00000000000
--- a/sys/arch/vax/include/ka650.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/* $OpenBSD: ka650.h,v 1.13 2015/02/01 15:27:11 miod Exp $ */
-/* $NetBSD: ka650.h,v 1.6 1997/07/26 10:12:43 ragge Exp $ */
-/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mt. Xinu.
- *
- * 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.
- *
- * @(#)ka650.h 7.5 (Berkeley) 6/28/90
- */
-
-/*
- *
- * Definitions specific to the ka650 (uVAX 3600/3602) cpu card.
- */
-
-/*
- * CAER: Memory System Error Register (IPR 39)
- */
-#define CAER_DAL 0x00000040 /* CDAL or level 2 cache data parity */
-#define CAER_MCD 0x00000020 /* mcheck due to DAL parity error */
-#define CAER_MCC 0x00000010 /* mcheck due to 1st lev cache parity */
-#define CAER_DAT 0x00000002 /* data parity in 1st level cache */
-#define CAER_TAG 0x00000001 /* tag parity in 1st level cache */
-
-/*
- * DMA System Error Register (merr_dser)
- */
-#define DSER_QNXM 0x00000080 /* Q-22 Bus NXM */
-#define DSER_QPE 0x00000020 /* Q-22 Bus parity Error */
-#define DSER_MEM 0x00000010 /* Main mem err due to ext dev DMA */
-#define DSER_LOST 0x00000008 /* Lost error: DSER <7,5,4,0> set */
-#define DSER_NOGRANT 0x00000004 /* No Grant timeout on cpu demand R/W */
-#define DSER_DNXM 0x00000001 /* DMA NXM */
-#define DSER_CLEAR (DSER_QNXM | DSER_QPE | DSER_MEM | \
- DSER_LOST | DSER_NOGRANT | DSER_DNXM)
-#define DMASER_BITS \
-"\20\20BHALT\17DCNEG\10QBNXM\6QBPE\5MEMERR\4LOSTERR\3NOGRANT\1DMANXM"
-
-#ifndef _LOCORE
-/*
- * Local registers (in I/O space)
- * This is done in disjoint sections. Map names are set in locore.s
- * and they are mapped in routine configcpu()
- */
-
-/*
- * memory error & configuration registers
- */
-struct ka650_merr {
- u_long merr_scr; /* System Config Register */
- u_long merr_dser; /* DMA System Error Register */
- u_long merr_qbear; /* QBus Error Address Register */
- u_long merr_dear; /* DMA Error Address Register */
- u_long merr_qbmbr; /* Q Bus Map Base address Register */
- u_long pad[59];
- u_long merr_csr[16]; /* Main Memory Config Regs (16 banks) */
- u_long merr_errstat; /* Main Memory Error Status */
- u_long merr_cont; /* Main Memory Control */
-};
-#define KA650_MERR 0x20080000
-
-/*
- * Main Memory Error Status Register (merr_errstat)
- */
-#define MEM_EMASK 0xe0000180 /* mask of all err bits */
-#define MEM_RDS 0x80000000 /* uncorrectable main memory */
-#define MEM_RDSHIGH 0x40000000 /* high rate RDS errors */
-#define MEM_CRD 0x20000000 /* correctable main memory */
-#define MEM_DMA 0x00000100 /* DMA read or write error */
-#define MEM_CDAL 0x00000080 /* CDAL Parity error on write */
-#define MEM_PAGE 0x1ffffe00 /* Offending Page Number */
-#define MEM_PAGESHFT 9 /* Shift to normalize page number */
-
-/*
- * Main Memory Control & Diag Status Reg (merr_cont)
- */
-#define MEM_CRDINT 0x00001000 /* CRD interrupts enabled */
-#define MEM_REFRESH 0x00000800 /* Forced memory refresh */
-#define MEM_ERRDIS 0x00000400 /* error detect disable */
-#define MEM_DIAG 0x00000080 /* Diagnostics mode */
-#define MEM_CHECK 0x0000007f /* check bits for diagnostic mode */
-
-/*
- * Main Memory Config Regs (merr_csr[0-15])
- */
-#define MEM_BNKENBLE 0x80000000 /* Bank Enable */
-#define MEM_BNKNUM 0x03c00000 /* Physical map Bank number */
-#define MEM_BNKUSAGE 0x00000003 /* Bank Usage */
-
-/*
- * Cache Control & Boot/Diag registers
- */
-struct ka650_cbd {
- u_char cbd_cacr; /* Low byte: Cache Enable & Parity Err detect */
- u_char cbd_cdf1; /* Cache diagnostic field (unused) */
- u_char cbd_cdf2; /* Cache diagnostic field (unused) */
- u_char pad;
- u_long cbd_bdr; /* Boot & Diagnostic Register (unused) */
-};
-#define KA650_CBD 0x20084000
-
-/*
- * CACR: Cache Control Register (2nd level cache) (cbd_cacr)
- */
-#define CACR_CEN 0x00000010 /* Cache enable */
-#define CACR_CPE 0x00000020 /* Cache Parity Error */
-
-/*
- * Inter Processor Communication Register
- * To determine if memory error was from QBUS device DMA (as opposed to cpu).
- */
-struct ka650_ipcr {
- u_long pad[80];
- u_short ipcr0; /* InterProcessor Comm Reg for arbiter */
-};
-#define KA650_IPCR 0x20001e00
-
-#endif /* _LOCORE */
-
-/*
- * Mapping info for Cache Entries, including
- * Size (in bytes) of 2nd Level Cache for cache flush operation
- */
-#define KA650_CACHE 0x10000000
-#define KA650_CACHESIZE (64*1024)
-
-/*
- * Useful ROM addresses
- */
-#define KA650ROM_SIDEX 0x20060004 /* system ID extension */
-#define KA650ROM_GETC 0x20060008 /* (jsb) get character from console */
-#define KA650ROM_PUTS 0x2006000c /* (jsb) put string to console */
-#define KA650ROM_GETS 0x20060010 /* (jsb) read string with prompt */
-#define KA650_CONSTYPE 0x20140401 /* byte at which console type resides */
-
-/*
- * Some useful macros
- */
-#define GETFRMREV(x) ((x >> 16) & 0xff)
-#define GETCODREV(x) (x & 0xff)
diff --git a/sys/arch/vax/include/ka670.h b/sys/arch/vax/include/ka670.h
deleted file mode 100644
index 5fbcd6a42ee..00000000000
--- a/sys/arch/vax/include/ka670.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $OpenBSD: ka670.h,v 1.1 2000/04/26 06:08:27 bjc Exp $ */
-/* $NetBSD: ka670.h,v 1.1 1999/06/06 14:23:46 ragge Exp $ */
-/*
- * Copyright (c) 1999 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * Definitions for I/O addresses of
- *
- * VAX 4000/300 (KA670)
- */
-
-#define KA670_SIDEX 0x20040004 /* SID extension register */
-#define KA670_IORESET 0x20020000 /* I/O Reset register */
-
-#define KA670_ROM_BASE 0x20040000 /* System module ROM */
-#define KA670_ROM_END 0x2007FFFF
-#define KA670_ROM_SIZE 0x40000
-
-/*
- * The following values refer to bits/bitfields within the 4 internal
- * registers controlling primary cache:
- * PR_PCTAG(124, tag-register) PR_PCIDX(125, index-register)
- * PR_PCERR(126, error-register) PR_PCSTS(127, status-register)
- */
-#define KA670_PCTAG_TAG 0x1FFFF800 /* bits 11-29 */
-#define KA670_PCTAG_PARITY 0x40000000
-#define KA670_PCTAG_VALID 0x80000000
-
-#define KA670_PCIDX_INDEX 0x000007F8 /* 0x100 Q-word entries */
-
-#define KA670_PCERR_ADDR 0x3FFFFFFF
-
-#define KA670_PCS_FORCEHIT 0x00000001 /* Force hit */
-#define KA670_PCS_ENABLE 0x00000002 /* Enable primary cache */
-#define KA670_PCS_FLUSH 0x00000004 /* Flush cache */
-#define KA670_PCS_REFRESH 0x00000008 /* Enable refresh */
-#define KA670_PCS_HIT 0x00000010 /* Cache hit */
-#define KA670_PCS_INTERRUPT 0x00000020 /* Interrupt pending */
-#define KA670_PCS_TRAP2 0x00000040 /* Trap while trap */
-#define KA670_PCS_TRAP1 0x00000080 /* Micro trap/machine check */
-#define KA670_PCS_TPERR 0x00000100 /* Tag parity error */
-#define KA670_PCS_DPERR 0x00000200 /* Dal data parity error */
-#define KA670_PCS_PPERR 0x00000400 /* P data parity error */
-#define KA670_PCS_BUSERR 0x00000800 /* Bus error */
-#define KA670_PCS_BCHIT 0x00001000 /* B cache hit */
-
-#define KA670_PCSTS_BITS \
- "\020\015BCHIT\014BUSERR\013PPERR\012DPERR\011TPERR\010TRAP1" \
- "\007TRAP2\006INTR\005HIT\004REFRESH\003FLUSH\002ENABLE\001FORCEHIT"
-
-#define KA670_BCSTS_BITS \
- "\020\015BCHIT\014BUSERR\013PPERR\012DPERR\011TPERR\010TRAP1" \
- "\007TRAP2\006INTR\005HIT\004REFRESH\003FLUSH\002ENABLE\001FORCEHIT"
-
-/*
- * Bits in PR_ACCS (Floating Point Accelerator Register)
- */
-#define KA670_ACCS_VECTOR (1<<0) /* Vector Unit Present */
-#define KA670_ACCS_FCHIP (1<<1) /* FPU chip present */
-#define KA670_ACCS_WEP (1<<31) /* Write Even Parity */
diff --git a/sys/arch/vax/include/ka680.h b/sys/arch/vax/include/ka680.h
deleted file mode 100644
index 32618830c12..00000000000
--- a/sys/arch/vax/include/ka680.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $OpenBSD: ka680.h,v 1.1 2001/02/24 10:31:56 hugh Exp $ */
-/* $NetBSD: ka680.h,v 1.1 2001/02/05 13:20:10 ragge Exp $ */
-/*
- * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/* Done by Michael Kukat (michael@unixiron.org) */
-
-/*
- * KA675/680 (VAX4000/[45]00) specific definitions.
- */
-
-
-/* IPR bits definitions */
-#define PCSTS_FLUSH 4
-#define PCSTS_ENABLE 2
-#define PCTAG_PARITY 0x80000000
-#define PCTAG_VALID 1
-
-/* memory addresses of interest */
-#define KA680_INVFLT 0x20200000
-#define KA680_INVFLTSZ 32768
-#define KA680_CCR 0x23000000
-#define KA680_TAGST 0x2d000000
-#define KA680_TAGSZ 32768
-
-#define CCR_CENA 0x00000001
-#define CCR_SPECIO 0x00000010
-
-#define KA680_BWF0 0x20080014
-#define BWF0_FEN 0x01000000
-
diff --git a/sys/arch/vax/include/kcore.h b/sys/arch/vax/include/kcore.h
deleted file mode 100644
index 4837def7594..00000000000
--- a/sys/arch/vax/include/kcore.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $OpenBSD: kcore.h,v 1.1 2006/06/11 22:09:32 miod Exp $ */
-/* public domain */
-
-/* Keep this define consistent with VM_PHYSSEG_MAX in <machine/vmparam.h> */
-#define NPHYS_RAM_SEGS 1
-
-typedef struct cpu_kcore_hdr {
- vaddr_t sysmap;
- phys_ram_seg_t ram_segs[NPHYS_RAM_SEGS];
-} cpu_kcore_hdr_t;
diff --git a/sys/arch/vax/include/limits.h b/sys/arch/vax/include/limits.h
deleted file mode 100644
index 847cd9c60d8..00000000000
--- a/sys/arch/vax/include/limits.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $OpenBSD: limits.h,v 1.16 2015/04/30 13:42:08 millert Exp $ */
-/* $NetBSD: limits.h,v 1.9 2000/03/07 19:33:01 kleink Exp $ */
-
-/*
- * Copyright (c) 1988 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.
- *
- * @(#)limits.h 7.2 (Berkeley) 6/28/90
- */
-
-#ifndef _MACHINE_LIMITS_H_
-#define _MACHINE_LIMITS_H_
-
-#include <sys/cdefs.h>
-
-#if __POSIX_VISIBLE || __XPG_VISIBLE
-#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
-#endif
-
-#if __BSD_VISIBLE
-#define SIZE_T_MAX ULONG_MAX /* max value for a size_t (historic) */
-
-#define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */
-#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */
-#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */
-
-#endif /* __BSD_VISIBLE */
-
-#endif /* _MACHINE_LIMITS_H_ */
diff --git a/sys/arch/vax/include/loadfile_machdep.h b/sys/arch/vax/include/loadfile_machdep.h
deleted file mode 100644
index 7dda94cf4f6..00000000000
--- a/sys/arch/vax/include/loadfile_machdep.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: loadfile_machdep.h,v 1.3 2013/10/17 11:54:02 miod Exp $ */
-
-/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
- *
- * 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 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.
- */
-
-#define BOOT_ELF
-#define ELFSIZE 32
-
-#define LOAD_KERNEL LOAD_ALL
-#define COUNT_KERNEL COUNT_ALL
-
-#define LOADADDR(a) (((u_long)(a)) + offset)
-#define ALIGNENTRY(a) (0)
-#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
-#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
-#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
-#define PROGRESS(a) (void) printf a
-#define ALLOC(a) alloc(a)
-#define FREE(a, b) free(a, b)
diff --git a/sys/arch/vax/include/lock.h b/sys/arch/vax/include/lock.h
deleted file mode 100644
index a11daa14855..00000000000
--- a/sys/arch/vax/include/lock.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $OpenBSD: lock.h,v 1.4 2013/05/21 20:05:30 tedu Exp $ */
-
-/* public domain */
-
-#ifndef _MACHINE_LOCK_H_
-#define _MACHINE_LOCK_H_
-
-#include <machine/atomic.h>
-
-#endif /* _MACHINE_LOCK_H_ */
diff --git a/sys/arch/vax/include/macros.h b/sys/arch/vax/include/macros.h
deleted file mode 100644
index 1b0d76c6b8e..00000000000
--- a/sys/arch/vax/include/macros.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/* $OpenBSD: macros.h,v 1.22 2014/03/29 18:09:30 guenther Exp $ */
-/* $NetBSD: macros.h,v 1.20 2000/07/19 01:02:52 matt Exp $ */
-
-/*
- * Copyright (c) 1994, 1998, 2000 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- */
-
- /* All bugs are subject to removal without further notice */
-
-#ifndef _MACHINE_MACROS_H_
-#define _MACHINE_MACROS_H_
-
-/* Here general macros are supposed to be stored */
-
-static __inline__ int
-ffs(int reg)
-{
- register int val;
-
- __asm__ volatile ("ffs $0,$32,%1,%0;"
- " bneq 1f;"
- " mnegl $1,%0;"
- "1: incl %0"
- : "=&r" (val)
- : "r" (reg) );
- return val;
-}
-
-static __inline__ size_t
-strlen(const char *cp)
-{
- register size_t ret;
-
- __asm__ volatile("locc $0,$65535,(%1);subl3 %%r0,$65535,%0"
- : "=r" (ret)
- : "r" (cp)
- : "r0","r1","cc" );
- return ret;
-}
-
-#if 0
-static __inline__ char *
-strncat(char *cp, const char *c2, size_t count)
-{
- __asm__ volatile("locc $0,%2,(%1);subl3 %%r0,%2,%%r2;"
- "locc $0,$65535,(%0);movc3 %%r2,(%1),(%%r1);"
- "movb $0,(%%r3)"
- :
- : "r" (cp), "r" (c2), "g"(count)
- : "r0","r1","r2","r3","r4","r5","memory","cc");
- return cp;
-}
-#endif
-
-static __inline__ char *
-strncpy(char *cp, const char *c2, size_t len)
-{
- __asm__ volatile("movl %2,%%r2;locc $0,%%r2,(%1);beql 1f;"
- "subl3 %%r0,%2,%%r2;clrb (%0)[%%r2];1:"
- "movc3 %%r2,(%1),(%0)"
- :
- : "r" (cp), "r" (c2), "g"(len)
- : "r0","r1","r2","r3","r4","r5","memory","cc");
- return cp;
-}
-
-static __inline__ void *
-memchr(const void *cp, int c, size_t len)
-{
- void *ret;
- __asm__ volatile("locc %2,%3,(%1);bneq 1f;clrl %%r1;1:movl %%r1,%0"
- : "=g"(ret)
- : "r" (cp), "r" (c), "g"(len)
- : "r0","r1","cc");
- return ret;
-}
-
-static __inline__ int
-strcmp(const char *cp, const char *c2)
-{
- register int ret;
- __asm__ volatile("locc $0,$65535,(%1);subl3 %%r0,$65535,%%r0;"
- "incl %%r0;cmpc3 %%r0,(%1),(%2);beql 1f;"
- "movl $1,%%r2;cmpb (%%r1),(%%r3);bcc 1f;"
- "movl $-1,%%r2;1:movl %%r2,%0"
- : "=g"(ret)
- : "r" (cp), "r" (c2)
- : "r0","r1","r2","r3","cc");
- return ret;
-}
-/* End nya */
-
-#if 0 /* unused, but no point in deleting it since it _is_ an instruction */
-static __inline__ int
-locc(int mask, char *cp, size_t size)
-{
- register ret;
-
- __asm__ volatile("locc %1,%2,(%3);movl %%r0,%0"
- : "=r" (ret)
- : "r" (mask),"r"(size),"r"(cp)
- : "r0","r1" );
- return ret;
-}
-#endif
-
-static __inline__ int
-scanc(u_int size, const u_char *cp, const u_char *table, int mask)
-{
- register int ret;
-
- __asm__ volatile("scanc %1,(%2),(%3),%4;movl %%r0,%0"
- : "=g"(ret)
- : "r"(size),"r"(cp),"r"(table),"r"(mask)
- : "r0","r1","r2","r3" );
- return ret;
-}
-
-static __inline__ int
-skpc(int mask, size_t size, u_char *cp)
-{
- register int ret;
-
- __asm__ volatile("skpc %1,%2,(%3);movl %%r0,%0"
- : "=g"(ret)
- : "r"(mask),"r"(size),"r"(cp)
- : "r0","r1" );
- return ret;
-}
-
-#define cpu_switchto(o, n) \
- __asm__ volatile( \
- "movl %0, %%r0; movl %1, %%r1; movpsl -(%%sp); jsb __cpu_switchto" \
- :: "g"(o), "g"(n) : "r0", "r1");
-
-/*
- * Interlock instructions. Used both in multiprocessor environments to
- * lock between CPUs and in uniprocessor systems when locking is required
- * between I/O devices and the master CPU.
- */
-/*
- * Insqti() locks and inserts an element into the end of a queue.
- * Returns -1 if interlock failed, 1 if inserted OK and 0 if first in queue.
- */
-static __inline__ int
-insqti(void *entry, void *header) {
- register int ret;
-
- __asm__ volatile(
- " mnegl $1,%0;"
- " insqti (%1),(%2);"
- " bcs 1f; # failed insert"
- " beql 2f; # jump if first entry"
- " movl $1,%0;"
- " brb 1f;"
- "2: clrl %0;"
- " 1:;"
- : "=&g"(ret)
- : "r"(entry), "r"(header)
- : "memory");
-
- return ret;
-}
-
-/*
- * Remqhi() removes an element from the head of the queue.
- * Returns -1 if interlock failed, 0 if queue empty, address of the
- * removed element otherwise.
- */
-static __inline__ void *
-remqhi(void *header) {
- register void *ret;
-
- __asm__ volatile(
- " remqhi (%1),%0;"
- " bcs 1f; # failed interlock"
- " bvs 2f; # nothing was removed"
- " brb 3f;"
- "1: mnegl $1,%0;"
- " brb 3f;"
- "2: clrl %0;"
- " 3:;"
- : "=&g"(ret)
- : "r"(header)
- : "memory");
-
- return ret;
-}
-#define ILCK_FAILED -1 /* Interlock failed */
-#define Q_EMPTY 0 /* Queue is/was empty */
-#define Q_OK 1 /* Inserted OK */
-
-#endif /* _MACHINE_MACROS_H_ */
diff --git a/sys/arch/vax/include/mtpr.h b/sys/arch/vax/include/mtpr.h
deleted file mode 100644
index 180205dbcc4..00000000000
--- a/sys/arch/vax/include/mtpr.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/* $OpenBSD: mtpr.h,v 1.9 2014/03/29 18:09:30 guenther Exp $ */
-/* $NetBSD: mtpr.h,v 1.12 1999/06/06 19:06:29 ragge Exp $ */
-
-/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- */
-
- /* All bugs are subject to removal without further notice */
-
-#ifndef _MACHINE_MTPR_H_
-#define _MACHINE_MTPR_H_
-
-/******************************************************************************
-
- Processor register numbers in the VAX /IC
-
-******************************************************************************/
-
-
-#define PR_KSP 0 /* Kernel Stack Pointer */
-#define PR_ESP 1 /* Executive Stack Pointer */
-#define PR_SSP 2 /* Supervisor Stack Pointer */
-#define PR_USP 3 /* User Stack Pointer */
-#define PR_ISP 4 /* Interrupt Stack Pointer */
-
-#define PR_P0BR 8 /* P0 Base Register */
-#define PR_P0LR 9 /* P0 Length Register */
-#define PR_P1BR 10 /* P1 Base Register */
-#define PR_P1LR 11 /* P1 Length Register */
-#define PR_SBR 12 /* System Base Register */
-#define PR_SLR 13 /* System Limit Register */
-#define PR_PCBB 16 /* Process Control Block Base */
-#define PR_SCBB 17 /* System Control Block Base */
-#define PR_IPL 18 /* Interrupt Priority Level */
-#define PR_ASTLVL 19 /* AST Level */
-#define PR_SIRR 20 /* Software Interrupt Request */
-#define PR_SISR 21 /* Software Interrupt Summary */
-#define PR_IPIR 22 /* KA820 Interprocessor register */
-#define PR_MCSR 23 /* Machine Check Status Register 11/750 */
-#define PR_ICCS 24 /* Interval Clock Control */
-#define PR_NICR 25 /* Next Interval Count */
-#define PR_ICR 26 /* Interval Count */
-#define PR_TODR 27 /* Time Of Year (optional) */
-#define PR_CSRS 28 /* Console Storage R/S */
-#define PR_CSRD 29 /* Console Storage R/D */
-#define PR_CSTS 30 /* Console Storage T/S */
-#define PR_CSTD 31 /* Console Storage T/D */
-#define PR_RXCS 32 /* Console Receiver C/S */
-#define PR_RXDB 33 /* Console Receiver D/B */
-#define PR_TXCS 34 /* Console Transmit C/S */
-#define PR_TXDB 35 /* Console Transmit D/B */
-#define PR_TBDR 36 /* Translation Buffer Group Disable Register 11/750 */
-#define PR_CADR 37 /* Cache Disable Register 11/750 */
-#define PR_MCESR 38 /* Machine Check Error Summary Register 11/750 */
-#define PR_CAER 39 /* Cache Error Register 11/750 */
-#define PR_ACCS 40 /* Accelerator control register */
-#define PR_SAVISP 41 /* Console Saved ISP */
-#define PR_SAVPC 42 /* Console Saved PC */
-#define PR_SAVPSL 43 /* Console Saved PSL */
-#define PR_WCSA 44 /* WCS Address */
-#define PR_WCSB 45 /* WCS Data */
-#define PR_SBIFS 48 /* SBI Fault/Status */
-#define PR_SBIS 49 /* SBI Silo */
-#define PR_SBISC 50 /* SBI Silo Comparator */
-#define PR_SBIMT 51 /* SBI Silo Maintenance */
-#define PR_SBIER 52 /* SBI Error Register */
-#define PR_SBITA 53 /* SBI Timeout Address Register */
-#define PR_SBIQC 54 /* SBI Quadword Clear */
-#define PR_IUR 55 /* Initialize Unibus Register 11/750 */
-#define PR_MAPEN 56 /* Memory Management Enable */
-#define PR_TBIA 57 /* Trans. Buf. Invalidate All */
-#define PR_TBIS 58 /* Trans. Buf. Invalidate Single */
-#define PR_TBDATA 59 /* Translation Buffer Data */
-#define PR_MBRK 60 /* Microprogram Break */
-#define PR_PMR 61 /* Performance Monitor Enable */
-#define PR_SID 62 /* System ID Register */
-#define PR_TBCHK 63 /* Translation Buffer Check */
-
-#define PR_PAMACC 64 /* Physical Address Memory Map Access (KA86) */
-#define PR_PAMLOC 65 /* Physical Address Memory Map Location (KA86) */
-#define PR_CSWP 66 /* Cache Sweep (KA86) */
-#define PR_MDECC 67 /* MBOX Data Ecc Register (KA86) */
-#define PR_MENA 68 /* MBOX Error Enable Register (KA86) */
-#define PR_MDCTL 69 /* MBOX Data Control Register (KA86) */
-#define PR_MCCTL 70 /* MBOX Mcc Control Register (KA86) */
-#define PR_MERG 71 /* MBOX Error Generator Register (KA86) */
-#define PR_CRBT 72 /* Console Reboot (KA86) */
-#define PR_DFI 73 /* Diagnostic Fault Insertion Register (KA86) */
-#define PR_EHSR 74 /* Error Handling Status Register (KA86) */
-#define PR_STXCS 76 /* Console Storage C/S (KA86) */
-#define PR_STXDB 77 /* Console Storage D/B (KA86) */
-#define PR_ESPA 78 /* EBOX Scratchpad Address (KA86) */
-#define PR_ESPD 79 /* EBOX Scratchpad Data (KA86) */
-
-#define PR_RXCS1 80 /* Serial-Line Unit 1 Receive CSR (KA820) */
-#define PR_RXDB1 81 /* Serial-Line Unit 1 Receive Data Buffer (KA820) */
-#define PR_TXCS1 82 /* Serial-Line Unit 1 Transmit CSR (KA820) */
-#define PR_TXDB1 83 /* Serial-Line Unit 1 Transmit Data Buffer (KA820) */
-#define PR_RXCS2 84 /* Serial-Line Unit 2 Receive CSR (KA820) */
-#define PR_RXDB2 85 /* Serial-Line Unit 2 Receive Data Buffer (KA820) */
-#define PR_TXCS2 86 /* Serial-Line Unit 2 Transmit CSR (KA820) */
-#define PR_TXDB2 87 /* Serial-Line Unit 2 Transmit Data Buffer (KA820) */
-#define PR_RXCS3 88 /* Serial-Line Unit 3 Receive CSR (KA820) */
-#define PR_RXDB3 89 /* Serial-Line Unit 3 Receive Data Buffer (KA820) */
-#define PR_TXCS3 90 /* Serial-Line Unit 3 Transmit CSR (KA820) */
-#define PR_TXDB3 91 /* Serial-Line Unit 3 Transmit Data Buffer (KA820) */
-#define PR_RXCD 92 /* Receive Console Data from another cpu (KA820) */
-#define PR_CACHEX 93 /* Cache invalidate Register (KA820) */
-#define PR_BINID 94 /* VAXBI node ID Register (KA820) */
-#define PR_BISTOP 95 /* VAXBI Stop Register (KA820) */
-
-#define PR_BCBTS 113 /* Backup Cache Tag Store (KA670) */
-#define PR_BCP1TS 114 /* Primary Tag Store 1st half (KA670) */
-#define PR_BCP2TS 115 /* Primary Tag Store 2st half (KA670) */
-#define PR_BCRFR 116 /* Refresh Register (KA670) */
-#define PR_BCIDX 117 /* Index Register (KA670) */
-#define PR_BCSTS 118 /* Status (KA670) */
-#define PR_BCCTL 119 /* Control Register (KA670) */
-#define PR_BCERR 120 /* Error Address (KA670) */
-#define PR_BCFBTS 121 /* Flush backup tag store (KA670) */
-#define PR_BCFPTS 122 /* Flush primary tag store (KA670) */
-
-#define PR_VINTSR 123 /* vector i/f error status (KA43/KA46) */
-#define PR_PCTAG 124 /* primary cache tag store (KA43/KA46) */
-#define PR_PCIDX 125 /* primary cache index (KA43/KA46) */
-#define PR_PCERR 126 /* primary cache error address (KA43/KA46) */
-#define PR_PCSTS 127 /* primary cache status (KA43/KA46) */
-
-/* Definitions for AST */
-#define AST_NO 4
-#define AST_OK 3
-
-#ifndef _LOCORE
-
-static inline void
-mtpr(register_t val, int reg)
-{
- __asm__ volatile ("mtpr %0,%1"
- : /* No output */
- : "g" (val), "g" (reg)
- : "memory");
-}
-
-static inline register_t
-mfpr(int reg)
-{
- register_t __val;
- __asm__ volatile ("mfpr %1,%0"
- : "=g" (__val)
- : "g" (reg));
- return __val;
-}
-#endif /* _LOCORE */
-
-#endif /* _MACHINE_MTPR_H_ */
diff --git a/sys/arch/vax/include/mutex.h b/sys/arch/vax/include/mutex.h
deleted file mode 100644
index 158c43c56bd..00000000000
--- a/sys/arch/vax/include/mutex.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $OpenBSD: mutex.h,v 1.1 2007/02/03 20:08:50 miod Exp $ */
-
-/*
- * Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
- * 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. 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 ``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 _MACHINE_MUTEX_H_
-#define _MACHINE_MUTEX_H_
-
-/*
- * Simple non-mp implementation.
- */
-struct mutex {
- int mtx_lock;
- int mtx_wantipl;
- int mtx_oldipl;
-};
-
-void mtx_init(struct mutex *, int);
-
-#define MUTEX_INITIALIZER(ipl) { 0, ipl, 0 }
-
-#ifdef DIAGNOSTIC
-#define MUTEX_ASSERT_LOCKED(mtx) do { \
- if ((mtx)->mtx_lock == 0) \
- panic("mutex %p not held in %s", (mtx), __func__); \
-} while (0)
-
-#define MUTEX_ASSERT_UNLOCKED(mtx) do { \
- if ((mtx)->mtx_lock != 0) \
- panic("mutex %p held in %s", (mtx), __func__); \
-} while (0)
-#else
-#define MUTEX_ASSERT_LOCKED(mtx) do { } while (0)
-#define MUTEX_ASSERT_UNLOCKED(mtx) do { } while (0)
-#endif
-
-#define MUTEX_OLDIPL(mtx) (mtx)->mtx_oldipl
-
-#endif
diff --git a/sys/arch/vax/include/nexus.h b/sys/arch/vax/include/nexus.h
deleted file mode 100644
index abc39ee60df..00000000000
--- a/sys/arch/vax/include/nexus.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $OpenBSD: nexus.h,v 1.17 2011/07/06 20:44:11 miod Exp $ */
-/* $NetBSD: nexus.h,v 1.17 2000/06/04 17:58:19 ragge Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986 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.
- *
- * @(#)nexus.h 7.3 (Berkeley) 5/9/91
- */
-
-#ifndef _MACHINE_NEXUS_H_
-#define _MACHINE_NEXUS_H_
-
-#include <machine/bus.h>
-
-struct mainbus_attach_args {
- int maa_bustype;
-};
-
-/*
- * Values for bus (or pseudo-bus) types
- */
-#define VAX_VSBUS 0 /* Virtual vaxstation bus */
-#define VAX_IBUS 1 /* Internal Microvax bus */
-#define VAX_VXTBUS 2 /* Pseudo VXT2000 bus */
-#define VAX_MBUS 3 /* M-bus (KA60) */
-
-#define VAX_LEDS 4 /* pseudo value to attach led0 */
-
-#ifdef _KERNEL
-
-struct bp_conf {
- const char *type;
-};
-
-#endif
-
-/* Memory recover defines */
-#define MCHK_PANIC -1
-#define MCHK_RECOVERED 0
-
-#endif /* _MACHINE_NEXUS_H_ */
diff --git a/sys/arch/vax/include/param.h b/sys/arch/vax/include/param.h
deleted file mode 100644
index c9ed3aef2a3..00000000000
--- a/sys/arch/vax/include/param.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* $OpenBSD: param.h,v 1.42 2013/11/24 22:15:24 miod Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- */
-
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
-
-#define _MACHINE vax
-#define MACHINE "vax"
-#define _MACHINE_ARCH vax
-#define MACHINE_ARCH "vax"
-#define MID_MACHINE MID_VAX
-
-#define PAGE_SHIFT 12
-#define PAGE_SIZE (1 << PAGE_SHIFT)
-#define PAGE_MASK (PAGE_SIZE - 1)
-
-#define VAX_PGSHIFT 9
-#define VAX_NBPG (1 << VAX_PGSHIFT)
-#define VAX_PGOFSET (VAX_NBPG - 1)
-#define VAX_NPTEPG (VAX_NBPG / 4)
-
-#define KERNBASE 0x80000000 /* start of kernel virtual */
-
-#ifdef _KERNEL
-
-#define NBPG PAGE_SIZE /* bytes/page */
-#define PGSHIFT PAGE_SHIFT /* LOG2(PAGE_SIZE) */
-#define PGOFSET PAGE_MASK /* byte offset into page */
-
-#define UPAGES 2 /* pages of u-area */
-#define USPACE (UPAGES * PAGE_SIZE)
-#define USPACE_ALIGN (0) /* u-area alignment 0-none */
-#define REDZONEADDR (VAX_NBPG*3) /* Must be > sizeof(struct user) */
-
-#define NMBCLUSTERS 1024 /* map size, max cluster allocation */
-
-#ifndef MSGBUFSIZE
-#define MSGBUFSIZE (2 * PAGE_SIZE) /* default message buffer size */
-#endif
-
-/*
- * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
- * logical pages.
- */
-#define NKMEMPAGES_MAX_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT)
-
-/* MD conversion macros */
-#define vax_atop(x) (((unsigned)(x) + VAX_PGOFSET) >> VAX_PGSHIFT)
-#define vax_btop(x) (((unsigned)(x)) >> VAX_PGSHIFT)
-
-#include <machine/intr.h>
-
-/* Prototype needed for delay() */
-#ifndef _LOCORE
-#include <machine/cpu.h>
-
-void delay(int);
-/* inline macros used inside kernel */
-#include <machine/macros.h>
-#endif
-
-#define DELAY(x) delay(x)
-#endif /* _KERNEL */
-
-#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/vax/include/pcb.h b/sys/arch/vax/include/pcb.h
deleted file mode 100644
index bbc96b002b7..00000000000
--- a/sys/arch/vax/include/pcb.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $OpenBSD: pcb.h,v 1.9 2015/05/05 02:13:47 guenther Exp $ */
-/* $NetBSD: pcb.h,v 1.10 1996/02/02 18:08:26 mycroft Exp $ */
-
-/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- */
-
- /* All bugs are subject to removal without further notice */
-
-#ifndef _MACHINE_PCB_H_
-#define _MACHINE_PCB_H_
-
-#include <machine/reg.h>
-#include <machine/pte.h>
-
-struct pcb {
-
- /* Hardware registers, based on VAX special instructions */
-
- long KSP; /* Kernel Stack Pointer */
- long ESP; /* Executive Stack Pointer */
- long SSP; /* Supervisor Stack Pointer */
- long USP; /* User Stack Pointer */
- long R[12]; /* Register 0-11 */
- long AP; /* Argument Pointer */
- long FP; /* Frame Pointer */
- long PC; /* Program Counter */
- long PSL; /* Program Status Longword */
- pt_entry_t *P0BR; /* Page 0 Base Register */
- long P0LR; /* Page 0 Length Register */
- pt_entry_t *P1BR; /* Page 1 Base Register */
- long P1LR; /* Page 1 Length Register */
-
- /* Software registers, only used by kernel software */
- void *framep; /* Pointer to syscall frame */
- void *iftrap; /* Tells whether fault copy */
-
- paddr_t pcb_paddr; /* physical address of PCB */
- struct pmap *pcb_pm; /* owning pmap */
- struct pcb *pcb_pmnext; /* next pcb that shares this pmap */
-};
-
-#define AST_MASK 0x07000000
-#define AST_PCB 0x04000000
-
-#endif /* _MACHINE_PCB_H_ */
-
diff --git a/sys/arch/vax/include/pmap.h b/sys/arch/vax/include/pmap.h
deleted file mode 100644
index 994f94b99ff..00000000000
--- a/sys/arch/vax/include/pmap.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* $OpenBSD: pmap.h,v 1.38 2014/01/30 18:16:41 miod Exp $ */
-/* $NetBSD: pmap.h,v 1.37 1999/08/01 13:48:07 ragge Exp $ */
-
-/*
- * Copyright (c) 1987 Carnegie-Mellon University
- * Copyright (c) 1991 Regents of the University of California.
- * All rights reserved.
- *
- * Changed for the VAX port. /IC
- *
- * 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.
- *
- * @(#)pmap.h 7.6 (Berkeley) 5/10/91
- */
-
-
-#ifndef _MACHINE_PMAP_H_
-#define _MACHINE_PMAP_H_
-
-#ifdef _KERNEL
-
-#include <machine/pte.h>
-#include <machine/mtpr.h>
-#include <machine/pcb.h>
-
-/*
- * Some constants to make life easier.
- */
-#define LTOHPS (PAGE_SHIFT - VAX_PGSHIFT)
-#define LTOHPN (1 << LTOHPS)
-
-/*
- * Pmap structure
- */
-
-struct pmap {
- pt_entry_t *pm_p1ap; /* Base of alloced p1 pte space */
- u_int pm_count; /* reference count */
- struct pcb *pm_pcbs; /* PCBs using this pmap */
- pt_entry_t *pm_p0br; /* page 0 base register */
- u_long pm_p0lr; /* page 0 length register */
- pt_entry_t *pm_p1br; /* page 1 base register */
- u_long pm_p1lr; /* page 1 length register */
- struct pmap_statistics pm_stats; /* Some statistics */
-};
-
-typedef struct pmap *pmap_t;
-
-/*
- * For each vm_page_t, there is a list of all currently valid virtual
- * mappings of that page. An entry is a pv_entry_t.
- */
-
-struct pv_entry {
- struct pv_entry *pv_next; /* next pv_entry */
- struct pmap *pv_pmap; /* pmap this entry belongs to */
- vaddr_t pv_va; /* address of the virtual mapping */
-};
-
-extern struct pmap kernel_pmap_store;
-
-#define pmap_kernel() (&kernel_pmap_store)
-
-/*
- * Real nice (fast) routines to get the virtual address of a physical page
- * (and vice versa).
- */
-#define pmap_map_direct(pg) (VM_PAGE_TO_PHYS(pg) | KERNBASE)
-#define pmap_unmap_direct(va) PHYS_TO_VM_PAGE((va) & ~KERNBASE)
-#define __HAVE_PMAP_DIRECT
-
-#define PMAP_STEAL_MEMORY
-
-/*
- * This is the by far most used pmap routine. Make it inline.
- */
-
-/* Routines that are best to define as macros */
-#define pmap_copy(a,b,c,d,e) /* Dont do anything */
-#define pmap_collect(pm) /* nothing */
-#define pmap_update(pm) /* nothing */
-#define pmap_remove(pmap, start, slut) pmap_protect(pmap, start, slut, 0)
-#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
-#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
-#define pmap_reference(pmap) (pmap)->pm_count++
-
-/* These can be done as efficient inline macros */
-#define pmap_copy_page(srcpg, dstpg) do { \
- paddr_t __src = VM_PAGE_TO_PHYS(srcpg); \
- paddr_t __dst = VM_PAGE_TO_PHYS(dstpg); \
- __asm__("addl3 $0x80000000,%0,%%r0;addl3 $0x80000000,%1,%%r1; \
- movc3 $4096,(%%r0),(%%r1)" \
- :: "r"(__src),"r"(__dst):"r0","r1","r2","r3","r4","r5"); \
-} while (0)
-
-#define pmap_zero_page(pg) do { \
- paddr_t __pa = VM_PAGE_TO_PHYS(pg); \
- __asm__("addl3 $0x80000000,%0,%%r0;movc5 $0,(%%r0),$0,$4096,(%%r0)" \
- :: "r"(__pa): "r0","r1","r2","r3","r4","r5"); \
-} while (0)
-
-#define pmap_proc_iflush(p,va,len) /* nothing */
-#define pmap_unuse_final(p) /* nothing */
-
-/* Prototypes */
-void pmap_bootstrap(void);
-vaddr_t pmap_map(vaddr_t, paddr_t, paddr_t, int);
-void pmap_pinit(pmap_t);
-
-#endif /* _KERNEL */
-
-struct vm_page_md {
- struct pv_entry *pv_head;
- int pv_attr; /* write/modified bits */
-};
-
-#define VM_MDPAGE_INIT(pg) \
- do { \
- (pg)->mdpage.pv_head = NULL; \
- (pg)->mdpage.pv_attr = 0; \
- } while (0)
-
-#endif /* _MACHINE_PMAP_H_ */
diff --git a/sys/arch/vax/include/proc.h b/sys/arch/vax/include/proc.h
deleted file mode 100644
index c7185d0532d..00000000000
--- a/sys/arch/vax/include/proc.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $OpenBSD: proc.h,v 1.5 2006/04/17 20:44:45 miod Exp $ */
-/* $NetBSD: proc.h,v 1.2 1994/10/26 08:02:21 cgd Exp $ */
-
-/*
- * Copyright (c) 1991 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.
- *
- * @(#)proc.h 7.1 (Berkeley) 5/15/91
- */
-
-/*
- * Machine-dependent part of the proc structure for vax.
- */
-struct mdproc {
-};
diff --git a/sys/arch/vax/include/profile.h b/sys/arch/vax/include/profile.h
deleted file mode 100644
index 94436b85f07..00000000000
--- a/sys/arch/vax/include/profile.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $OpenBSD: profile.h,v 1.8 2013/07/05 21:10:50 miod Exp $ */
-/* $NetBSD: profile.h,v 1.5 1995/12/31 12:15:58 ragge Exp $ */
-/*
- * Copyright (c) 1992 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.
- *
- * @(#)profile.h 7.1 (Berkeley) 7/16/92
- */
-
-/*
- * _mcount can't be declared static, gcc will optimize it away then.
- */
-#define _MCOUNT_DECL void _mcount
-
-/*
- * Note here: the second argument to __mcount() is pc when mcount
- * was called. Because it's already on the stack we only have to
- * push previous pc _and_ tell calls that it is only one argument
- * to __mcount, so that our return address won't get popped from stack.
- */
-#define MCOUNT \
-__asm__(".text; .globl mcount; mcount: pushl 16(%fp); calls $1,__mcount; rsb");
-
-#ifdef _KERNEL
-/*
- * Note that we assume splhigh() and splx() cannot call mcount()
- * recursively.
- */
-#define MCOUNT_ENTER s = splhigh()
-#define MCOUNT_EXIT splx(s)
-#endif /* _KERNEL */
diff --git a/sys/arch/vax/include/psl.h b/sys/arch/vax/include/psl.h
deleted file mode 100644
index 9e89bec1721..00000000000
--- a/sys/arch/vax/include/psl.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* $OpenBSD: psl.h,v 1.7 2003/06/02 23:27:57 millert Exp $ */
-/* $NetBSD: psl.h,v 1.6 1997/06/07 12:15:28 ragge Exp $ */
-
-/*
- * Rewritten for the VAX port. Based on Berkeley code. /IC
- *
- * Copyright (c) 1982, 1986 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.
- *
- * @(#)psl.h 7.2 (Berkeley) 5/4/91
- */
-
-#ifndef PSL_C
-
-/*
- * VAX program status longword
- */
-
-#define PSL_C 0x00000001 /* carry bit */
-#define PSL_V 0x00000002 /* overflow bit */
-#define PSL_Z 0x00000004 /* zero bit */
-#define PSL_N 0x00000008 /* negative bit */
-#define PSL_T 0x00000010 /* trace enable bit */
-#define PSL_IPL00 0x00000000 /* interrupt priority level 0 */
-#define PSL_IPL01 0x00010000 /* interrupt priority level 1 */
-#define PSL_IPL02 0x00020000 /* interrupt priority level 2 */
-#define PSL_IPL03 0x00030000 /* interrupt priority level 3 */
-#define PSL_IPL04 0x00040000 /* interrupt priority level 4 */
-#define PSL_IPL05 0x00050000 /* interrupt priority level 5 */
-#define PSL_IPL06 0x00060000 /* interrupt priority level 6 */
-#define PSL_IPL07 0x00070000 /* interrupt priority level 7 */
-#define PSL_IPL08 0x00080000 /* interrupt priority level 8 */
-#define PSL_IPL09 0x00090000 /* interrupt priority level 9 */
-#define PSL_IPL0A 0x000a0000 /* interrupt priority level 10 */
-#define PSL_IPL0B 0x000b0000 /* interrupt priority level 11 */
-#define PSL_IPL0C 0x000c0000 /* interrupt priority level 12 */
-#define PSL_IPL0D 0x000d0000 /* interrupt priority level 13 */
-#define PSL_IPL0E 0x000e0000 /* interrupt priority level 14 */
-#define PSL_IPL0F 0x000f0000 /* interrupt priority level 15 */
-#define PSL_IPL10 0x00100000 /* interrupt priority level 16 */
-#define PSL_IPL11 0x00110000 /* interrupt priority level 17 */
-#define PSL_IPL12 0x00120000 /* interrupt priority level 18 */
-#define PSL_IPL13 0x00130000 /* interrupt priority level 19 */
-#define PSL_IPL14 0x00140000 /* interrupt priority level 20 */
-#define PSL_IPL15 0x00150000 /* interrupt priority level 21 */
-#define PSL_IPL16 0x00160000 /* interrupt priority level 22 */
-#define PSL_IPL17 0x00170000 /* interrupt priority level 23 */
-#define PSL_IPL18 0x00180000 /* interrupt priority level 24 */
-#define PSL_IPL19 0x00190000 /* interrupt priority level 25 */
-#define PSL_IPL1A 0x001a0000 /* interrupt priority level 26 */
-#define PSL_IPL1B 0x001b0000 /* interrupt priority level 27 */
-#define PSL_IPL1C 0x001c0000 /* interrupt priority level 28 */
-#define PSL_IPL1D 0x001d0000 /* interrupt priority level 29 */
-#define PSL_IPL1E 0x001e0000 /* interrupt priority level 30 */
-#define PSL_IPL1F 0x001f0000 /* interrupt priority level 31 */
-#define PSL_PREVU 0x00c00000 /* Previous user mode */
-#define PSL_K 0x00000000 /* kernel mode */
-#define PSL_E 0x01000000 /* executive mode */
-#define PSL_S 0x02000000 /* supervisor mode */
-#define PSL_U 0x03000000 /* user mode */
-#define PSL_IS 0x04000000 /* interrupt stack select */
-#define PSL_FPD 0x08000000 /* first part done flag */
-#define PSL_TP 0x40000000 /* trace pending */
-#define PSL_CM 0x80000000 /* compatibility mode */
-
-#define PSL_LOWIPL (PSL_K)
-#define PSL_HIGHIPL (PSL_K | PSL_IPL1F)
-#define PSL_IPL (PSL_IPL1F)
-#define PSL_USER (0)
-
-#define PSL_MBZ 0x3020ff00 /* must be zero bits */
-
-#define PSL_USERSET (0)
-#define PSL_USERCLR (PSL_S | PSL_IPL1F | PSL_MBZ)
-
-/*
- * Macros to decode processor status word.
- */
-#define CLKF_USERMODE(framep) ((((framep)->ps) & (PSL_U)) == PSL_U)
-#define CLKF_PC(framep) ((framep)->pc)
-#define CLKF_INTR(framep) ((((framep)->ps) & (PSL_IS)) == PSL_IS)
-#define PSL2IPL(ps) ((ps) >> 16)
-
-#endif
diff --git a/sys/arch/vax/include/pte.h b/sys/arch/vax/include/pte.h
deleted file mode 100644
index 60deba60a0f..00000000000
--- a/sys/arch/vax/include/pte.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* $OpenBSD: pte.h,v 1.12 2013/11/24 22:08:23 miod Exp $ */
-/* $NetBSD: pte.h,v 1.21 2005/12/24 22:45:40 perry Exp $ */
-
-/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_PTE_H_
-#define _MACHINE_PTE_H_
-
-#ifndef _LOCORE
-
-typedef u_int32_t pt_entry_t; /* page table entry */
-
-#endif /* _LOCORE */
-
-#define PG_V 0x80000000
-#define PG_NV 0x00000000
-#define PG_PROT 0x78000000
-#define PG_RW 0x20000000
-#define PG_KW 0x10000000
-#define PG_KR 0x18000000
-#define PG_URKW 0x70000000
-#define PG_RO 0x78000000
-#define PG_NONE 0x00000000
-#define PG_M 0x04000000
-#define PG_W 0x01000000
-#define PG_SREF 0x00800000
-#define PG_ILLEGAL 0x00600000
-#define PG_FRAME 0x001fffff
-#define PG_PFNUM(x) (((unsigned long)(x) & 0x3ffffe00) >> VAX_PGSHIFT)
-
-#ifndef _LOCORE
-/*
- * Kernel virtual address to page table entry and to physical address.
- */
-extern pt_entry_t *Sysmap;
-#endif
-
-#ifdef __GNUC__
-static inline pt_entry_t *
-kvtopte(vaddr_t va)
-{
- pt_entry_t *pte;
-
- __asm(
- "extzv $9,$21,%1,%0\n\t"
- "moval *Sysmap[%0],%0\n\t"
- : "=r"(pte)
- : "g"(va));
- return pte;
-}
-static inline paddr_t
-kvtophys(vaddr_t va)
-{
- paddr_t pa;
-
- __asm(
- "extzv $9,$21,%1,%0\n\t"
- "ashl $9,*Sysmap[%0],%0\n\t"
- "insv %1,$0,$9,%0\n\t"
- : "=&r"(pa)
- : "g"(va) : "cc");
- return pa;
-}
-#else /* __GNUC__ */
-#define kvtopte(va) (&Sysmap[PG_PFNUM(va)])
-#define kvtophys(va) \
- (((*kvtopte(va) & PG_FRAME) << VAX_PGSHIFT) | ((paddr_t)(va) & VAX_PGOFSET))
-#endif /* __GNUC__ */
-#define uvtopte(va, pcb) \
- (((vaddr_t)(va) < 0x40000000) ? \
- &(((pcb)->P0BR)[PG_PFNUM(va)]) : \
- &(((pcb)->P1BR)[PG_PFNUM(va)]))
-
-#endif
diff --git a/sys/arch/vax/include/ptrace.h b/sys/arch/vax/include/ptrace.h
deleted file mode 100644
index 56141da4a0e..00000000000
--- a/sys/arch/vax/include/ptrace.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $OpenBSD: ptrace.h,v 1.2 1997/05/29 00:04:48 niklas Exp $ */
-/* $NetBSD: ptrace.h,v 1.3 1995/04/12 15:26:49 ragge Exp $ */
-
-/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- */
-
- /* All bugs are subject to removal without further notice */
-
-
-#define PT_STEP (PT_FIRSTMACH + 0)
-#define PT_GETREGS (PT_FIRSTMACH + 1)
-#define PT_SETREGS (PT_FIRSTMACH + 2)
-
diff --git a/sys/arch/vax/include/reg.h b/sys/arch/vax/include/reg.h
deleted file mode 100644
index 5940bcec204..00000000000
--- a/sys/arch/vax/include/reg.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $OpenBSD: reg.h,v 1.4 2011/03/23 16:54:37 pirofti Exp $ */
-/* $NetBSD: reg.h,v 1.3 1995/04/12 15:26:52 ragge Exp $ */
-
-/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- */
-
- /* All bugs are subject to removal without further notice */
-
-#ifndef _MACHINE_REG_H_
-#define _MACHINE_REG_H_
-
-struct reg {
- int r0; /* General registers saved upon trap/syscall */
- int r1;
- int r2;
- int r3;
- int r4;
- int r5;
- int r6;
- int r7;
- int r8;
- int r9;
- int r10;
- int r11;
- int ap; /* Argument pointer on user stack */
- int fp; /* Stack frame pointer */
- int sp;
- int pc; /* User pc */
- int psl; /* User psl */
-};
-
-#endif /* _MACHINE_REG_H_ */
diff --git a/sys/arch/vax/include/reloc.h b/sys/arch/vax/include/reloc.h
deleted file mode 100644
index b733067eae3..00000000000
--- a/sys/arch/vax/include/reloc.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* $OpenBSD: reloc.h,v 1.1 2013/07/05 21:10:50 miod Exp $ */
-/* VAX ELF relocation types */
-
-#define R_VAX_NONE 0
-#define R_VAX_32 1
-#define R_VAX_16 2
-#define R_VAX_8 3
-#define R_VAX_PC32 4
-#define R_VAX_PC16 5
-#define R_VAX_PC8 6
-#define R_VAX_GOT32 7
-#define R_VAX_PLT32 13
-#define R_VAX_COPY 19
-#define R_VAX_GLOB_DAT 20
-#define R_VAX_JMP_SLOT 21
-#define R_VAX_RELATIVE 22
-#define R_VAX_GNU_VTINHERIT 23
-#define R_VAX_GNU_VTENTRY 24
diff --git a/sys/arch/vax/include/rpb.h b/sys/arch/vax/include/rpb.h
deleted file mode 100644
index 1a4438b7c8a..00000000000
--- a/sys/arch/vax/include/rpb.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* $OpenBSD: rpb.h,v 1.11 2008/08/18 23:19:24 miod Exp $ */
-/* $NetBSD: rpb.h,v 1.6 1998/07/01 09:37:11 ragge Exp $ */
-/*
- * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * Look at "VAX/VMS Internals and Data Structures" around page 907
- * to get more info about RPB.
- */
-
-struct rpb { /* size description */
- struct rpb *rpb_base; /* 4 physical base address of block */
- void (*rpb_restart)(void);/* 4 physical address of restart routine */
- long rpb_chksum;/* 4 checksum of first 31 longwords of restart */
- long rpb_rstflg; /* 4 Restart in progress flag */
- long rpb_haltpc; /* 4 PC at HALT/restart */
- /* offset: 20 */
- long rpb_haltpsl;/* 4 PSL at HALT/restart */
- long rpb_haltcode;/* 4 reason for restart */
- long rpb_bootr0;/* 24 Saved bootstrap parameters (R0 through R5) */
- long rpb_bootr1;
- long rpb_bootr2;
- long rpb_bootr3;
- long rpb_bootr4;
- long rpb_bootr5;
- long iovec; /* 4 Address of bootstrap driver */
- long iovecsz;/* 4 Size (in bytes) of bootstrap driver */
- /* offset: 60 */
- long fillbn; /* 4 LBN of seconday bootstrap file */
- long filsiz; /* 4 Size (in blocks) of seconday bootstrap file */
- long pfnmap[2]; /* 8 Descriptor of PFN bitmap */
- long pfncnt; /* 4 Count of physical pages */
- /* offset: 80 */
- long svaspt; /* 4 system virtual address of system page table */
- long csrphy; /* 4 Physical Address of UBA device CSR */
- long csrvir; /* 4 Virtual Address of UBA device CSR */
- long adpphy; /* 4 Physical Address of adapter configurate reg. */
- long adpvir; /* 4 Virtual Address of adapter configurate reg. */
- /* offset: 100 */
- short unit; /* 2 Bootstrap device unit number */
- u_char devtyp; /* 1 Bootstrap device type code */
- u_char slave; /* 1 Bootstrap device slave unit number */
- char file[40]; /* 40 Secondary bootstrap file name */
- u_char confreg[16]; /* 16 Byte array of adapter types */
- /* offset: 160 */
-#if 0
- u_char hdrpgcnt; /* 1 Count of header pages in 2nd bootstrap image */
- short bootndt;/* 2 Type of boot adapter */
- u_char flags; /* 1 Miscellaneous flag bits */
-#else
- long align; /* if the compiler doesnt proper alignment */
-#endif
- long max_pfn;/* 4 Absolute highest PFN */
- long sptep; /* 4 System space PTE prototype register */
- long sbr; /* 4 Saved system base register */
- long cpudbvec;/* 4 Physical address of per-CPU database vector */
- /* offset: 180 */
- long cca_addr; /* 4 Physical address of CCA */
- long slr; /* 4 Saved system length register */
- long memdesc[16]; /* 64 Longword array of memory descriptors */
- long smp_pc; /* 4 SMP boot page physical address */
- long wait; /* 4 Bugcheck loop code for attached processor */
- /* offset: 260 */
- long badpgs; /* 4 Number of bad pages found in memory scan */
- u_char ctrlltr;/* 1 Controller letter designation */
- u_char scbpagct; /* 1 SCB page count */
- u_char reserved[6]; /* 6 -- */
- long vmb_revision; /* 4 VMB revision label */
-};
-
-/*
- * Bootstrap device number encoding.
- */
-#define BDEV_HP 0
-#define BDEV_RK 1
-#define BDEV_RL 2
-#define BDEV_IDC 3
-#define BDEV_UDA 17
-#define BDEV_TK 18
-#define BDEV_HSC 32
-#define BDEV_KDB 33
-#define BDEV_KRB 34
-#define BDEV_NK 35
-#define BDEV_RD 36 /* ST506/MFM disk on HDC9224 */
-#define BDEV_ST 37 /* SCSI tape on NCR5380 */
-#define BDEV_SDS 39 /* SCSI disk on SII */
-#define BDEV_SD 42 /* SCSI disk on NCR5380 */
-#define BDEV_SDN 46 /* SCSI disk on NCR5394 */
-#define BDEV_CNSL 64
-#define BDEV_QE 96
-#define BDEV_DE 97
-#define BDEV_NI 98
-#define BDEV_LE 99
-#define BDEV_ZE 100
-
-#define BDEV_NET BDEV_QE /* first network BDEV */
-
-#ifdef _KERNEL
-extern struct rpb rpb;
-#endif
diff --git a/sys/arch/vax/include/scb.h b/sys/arch/vax/include/scb.h
deleted file mode 100644
index cc16863bc22..00000000000
--- a/sys/arch/vax/include/scb.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* $OpenBSD: scb.h,v 1.10 2008/08/18 23:19:24 miod Exp $ */
-/* $NetBSD: scb.h,v 1.11 2000/07/10 09:14:34 ragge Exp $ */
-
-/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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 _VAX_SCB_H
-#define _VAX_SCB_H
-
-/*
- * Definition of the System Control Block. More about it can be
- * found in the Vax Architecture Reference Manual, section 6.6.
- */
-struct scb {
- void *scb_unused; /* First unused vector */
- void *scb_mcheck;
- void *scb_kspinv;
- void *scb_powfail;
- void *scb_privinst; /* 10 Privileged Instruction fault */
- void *scb_xfcinst;
- void *scb_resop;
- void *scb_resad;
- void *scb_accessv; /* 20 Access Control violation fault */
- void *scb_transinv;
- void *scb_trace;
- void *scb_breakp;
- void *scb_compat; /* 30 Compatibility instruction fault */
- void *scb_arith;
- void *scb_unused1;
- void *scb_unused2;
- void *scb_chmk; /* 40 CHMK */
- void *scb_chme;
- void *scb_chms;
- void *scb_chmu;
- void *scb_sbisilo; /* 50 SBI Silo compare */
- void *scb_cmrd;
- void *scb_sbialert;
- void *scb_sbifault;
- void *scb_memwtimo; /* 60 Memory write timeout */
- void *scb_unused3;
- void *scb_unused4;
- void *scb_unused5;
- void *scb_unused6; /* 70 unused */
- void *scb_unused7;
- void *scb_unused8;
- void *scb_unused9;
- void *scb_unused10; /* 80 unused */
- void *scb_softint1;
- void *scb_softint2;
- void *scb_softint3;
- void *scb_softint4; /* 90 Software interrupt level 4 */
- void *scb_softint5;
- void *scb_softint6;
- void *scb_softint7;
- void *scb_softint8; /* A0 Software interrupt level 8 */
- void *scb_softint9;
- void *scb_softinta;
- void *scb_softintb;
- void *scb_softintc; /* B0 Software interrupt level C */
- void *scb_softintd;
- void *scb_softinte;
- void *scb_softintf;
- void *scb_timer; /* C0 Interval timer */
- void *scb_unused11;
- void *scb_unused12;
- void *scb_unused13;
- void *scb_unused14; /* D0 Unused */
- void *scb_unused15;
- void *scb_unused16;
- void *scb_unused17;
- void *scb_unused18; /* E0 Unused */
- void *scb_unused19;
- void *scb_unused20;
- void *scb_unused21;
- void *scb_csrint;
- void *scb_cstint; /* F0 Console storage transmit interrupt */
- void *scb_ctrint;
- void *scb_cttint;
- struct ivec_dsp *scb_nexvec[4][16]; /* Nexus interrupt vectors */
-};
-
-#define SCB_KSTACK 0
-#define SCB_ISTACK 1
-
-#define vecnum(bus, ipl, tr) (256+(ipl-0x14)*64+tr*4+bus*256)
-
-/*
- * This struct is used when setting up interrupt vectors dynamically.
- * It puts a opaque 32 bit quantity on the stack and also has a placeholder
- * for evcount structure.
- */
-struct ivec_dsp {
- char pushr; /* pushr */
- char pushrarg; /* $0x3f */
- char jsb;
- char mode;
- long displacement;
- void (*hoppaddr)(void *);
- void *pushlarg;
- struct evcount *ev;
-};
-
-#ifdef _KERNEL
-extern const struct ivec_dsp idsptch;
-extern struct scb *scb;
-extern struct ivec_dsp *scb_vec;
-
-extern paddr_t scb_init(paddr_t);
-extern int scb_vecref(int *, int *);
-extern void scb_fake(int, int);
-extern void scb_stray(void *);
-extern void scb_vecalloc(int, void(*)(void *), void *, int, struct evcount *);
-#endif /* _KERNEL */
-
-#endif /* _VAX_SCB_H */
diff --git a/sys/arch/vax/include/setjmp.h b/sys/arch/vax/include/setjmp.h
deleted file mode 100644
index f35f7d86e91..00000000000
--- a/sys/arch/vax/include/setjmp.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $OpenBSD: setjmp.h,v 1.3 2000/04/26 03:08:42 bjc Exp $ */
-/* $NetBSD: setjmp.h,v 1.1 1994/12/20 10:37:18 cgd Exp $ */
-
-/*
- * machine/setjmp.h: machine dependent setjmp-related information.
- */
-
-#define _JBLEN 14 /* size, in longs, of a jmp_buf */
diff --git a/sys/arch/vax/include/sgmap.h b/sys/arch/vax/include/sgmap.h
deleted file mode 100644
index b2683229c33..00000000000
--- a/sys/arch/vax/include/sgmap.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: sgmap.h,v 1.7 2008/06/26 05:42:14 ray Exp $ */
-/* $NetBSD: sgmap.h,v 1.3 2000/05/17 21:22:18 matt Exp $ */
-
-/*-
- * Copyright (c) 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.
- *
- * 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.
- */
-
-#ifndef _VAX_COMMON_SGMAPVAR_H
-#define _VAX_COMMON_SGMAPVAR_H
-
-#include <sys/extent.h>
-#include <machine/bus.h>
-#include <machine/pte.h>
-
-/*
- * A VAX SGMAP's state information. Nothing in the sgmap requires
- * locking[*], with the exception of the extent map. Locking of the
- * extent map is handled within the extent manager itself.
- *
- * [*] While the page table is a `global' resource, access to it is
- * controlled by the extent map; once a region has been allocated from
- * the map, that region is effectively `locked'.
- */
-struct vax_sgmap {
- struct extent *aps_ex; /* extent map to manage sgva space */
- pt_entry_t *aps_pt; /* page table */
- bus_addr_t aps_sgvabase; /* base of the sgva space */
- bus_size_t aps_sgvasize; /* size of the sgva space */
- bus_addr_t aps_pa; /* Address in region */
- unsigned int aps_flags; /* flags */
-};
-
-void vax_sgmap_init(bus_dma_tag_t, struct vax_sgmap *,
- const char *, bus_addr_t, bus_size_t, pt_entry_t *, bus_size_t);
-
-int vax_sgmap_alloc(bus_dmamap_t, bus_size_t,
- struct vax_sgmap *, int);
-void vax_sgmap_free(bus_dmamap_t, struct vax_sgmap *);
-
-int vax_sgmap_load(bus_dma_tag_t, bus_dmamap_t, void *,
- bus_size_t, struct proc *, int, struct vax_sgmap *);
-
-int vax_sgmap_load_mbuf(bus_dma_tag_t, bus_dmamap_t,
- struct mbuf *, int, struct vax_sgmap *);
-
-int vax_sgmap_load_uio(bus_dma_tag_t, bus_dmamap_t,
- struct uio *, int, struct vax_sgmap *);
-
-int vax_sgmap_load_raw(bus_dma_tag_t, bus_dmamap_t,
- bus_dma_segment_t *, int, bus_size_t, int, struct vax_sgmap *);
-
-void vax_sgmap_unload( bus_dma_tag_t, bus_dmamap_t,
- struct vax_sgmap *);
-
-#endif /* _VAX_COMMON_SGMAPVAR_H */
diff --git a/sys/arch/vax/include/sid.h b/sys/arch/vax/include/sid.h
deleted file mode 100644
index f1478f9bb3b..00000000000
--- a/sys/arch/vax/include/sid.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/* $OpenBSD: sid.h,v 1.16 2011/09/19 21:53:02 miod Exp $ */
-/* $NetBSD: sid.h,v 1.12 1999/12/11 17:55:13 ragge Exp $ */
-
-/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- */
-
-/*
- * Chip CPU types / chip CPU Subtypes
- *
- * The type of a VAX is given by the high-order byte of the System
- * identification register (SID) and describes families or series of VAXen.
- * Board-Types/Sub-Types within series are described by the SIED register.
- */
-
-/*
- * 700 series (1977)
- */
-#define VAX_TYP_780 1 /* VAX-11/780, 785, 782 */
-#define VAX_TYP_750 2 /* VAX-11/750 */
-#define VAX_TYP_730 3 /* VAX-11/730, 725 */
-#define VAX_TYP_790 4 /* VAX 8600, 8650 */
-
-#define VAX_BTYP_780 0x01000000 /* generic 11/780 */
-#define VAX_BTYP_750 0x02000000 /* generic 11/750 */
-#define VAX_BTYP_730 0x03000000 /* generic 11/730 */
-#define VAX_BTYP_790 0x04000000 /* generic 11/790 */
-
-/*
- * 8000 series (1986)
- */
-#define VAX_TYP_8SS 5 /* VAX 8200, 8300, 8250, 8350, VS 8000 */
-#define VAX_TYP_8NN 6 /* VAX 8530, 8550, 8700, 8800 */
-
-#define VAX_BTYP_8000 0x05000000 /* generic VAX 8000 */
-
-#define VAX_BTYP_8800 0x06000000 /* generic Nautilus */
-#define VAX_BTYP_8700 0x06000001
-#define VAX_BTYP_8550 0x06000006
-#define VAX_BTYP_8500 0x06000007
-
-/*
- * MicroVAX I (1984)
- */
-#define VAX_TYP_UV1 7 /* MicroVAX I, VAXstation I */
-
-#define VAX_BTYP_610 0x07000000 /* generic MicroVAX-I */
-
-/*
- * MicroVAX II series (1985)
- */
-#define VAX_TYP_UV2 8
-
-#define VAX_BTYP_630 0x08000001 /* MicroVAX II, VAXstation II */
-#define VAX_BTYP_410 0x08000004 /* MicroVAX 2000, VAXstation 2000 */
-
-/*
- * CVAX chip series (1987)
- */
-#define VAX_TYP_CVAX 10
-
-#define VAX_BTYP_650 0x0A000001 /* MicroVAX 3[345689]00 */
-#define VAX_STYP_650 0x1 /* MicroVAX 3500, 3600 */
-#define VAX_STYP_640 0x2 /* MicroVAX 3300, 3400 */
-#define VAX_STYP_655 0x3 /* MicroVAX 3800, 3900 */
-#define VAX_BTYP_9CC 0x0A000002 /* VAX 6000 model 210/310 */
-#define VAX_BTYP_60 0x0A000003 /* VAXstation 3520, 3540 */
-#define VAX_BTYP_420 0x0A000004 /* VAXstation 3100 models 10 - 48 */
-#define VAX_BTYP_IS1 0x0A000006 /* Infoserver 1000 */
-#define VAX_BTYP_5x0 0x0A000007 /* VAXft model 110, 310 */
-
-/*
- * Rigel chip series (1990)
- */
-#define VAX_TYP_RIGEL 11
-
-#define VAX_BTYP_670 0x0B000001 /* VAX 4000 300 */
-#define VAX_STYP_670 0x4 /* VAX 4000 300 */
-#define VAX_BTYP_9RR 0x0B000002 /* VAX 6000 model 410-460 */
-#define VAX_BTYP_43 0x0B000004 /* VAXstation 3100 model 76 */
-
-/*
- * Aquarius series (1990)
- */
-#define VAX_TYP_9000 14
-
-/*
- * Polarstar series (1988)
- */
-#define VAX_TYP_8PS 17
-
-#define VAX_BTYP_8PS 0x11000000 /* VAX 8810 to 8840 */
-
-/*
- * Mariah chip series (1991)
- */
-#define VAX_TYP_MARIAH 18
-
-#define VAX_BTYP_1202 0x12000002 /* VAX 6000 model 510-560 */
-
-#define VAX_BTYP_46 0x12000004 /* VAXstation 4000/60, 3100/80 */
-#define VAX_VTYP_47 0x00000001 /* MicroVAX 3100/80 */
-#define VAX_VTYP_46 0x00000002 /* VAXstation 4000/60 */
-
-/*
- * NVAX chip series (1991)
- */
-#define VAX_TYP_NVAX 19
-
-#define VAX_BTYP_1301 0x13000001 /* Omega machines */
-#define VAX_STYP_675 0x00000c /* VAX 4000 model 400 */
-#define VAX_STYP_680 0x000006 /* VAX 4000 model 500 */
-#define VAX_STYP_690 0x000007 /* VAX 4000 model 600 */
-
-#define VAX_BTYP_1302 0x13000002
-
-#define VAX_BTYP_1303 0x13000003 /* Cheetah machines */
-#define VAX_STYP_50 0x000008 /* KA50 or KA55 */
-#define VAX_STYP_51 0x000009 /* MicroVAX 3100 model 90 / 95 */
-#define VAX_STYP_52 0x00000a /* VAX 4000 model 100 */
-#define VAX_STYP_53 0x00000b /* VAX 4000 model 105A */
-
-#define VAX_BTYP_1305 0x13000005 /* Legacy machines */
-#define VAX_STYP_681 0x00000e /* VAX 4000 model 500A */
-#define VAX_STYP_691 0x00000f /* VAX 4000 model 605A */
-#define VAX_STYP_692 0x000010 /* VAX 4000 model 700 */
-#define VAX_STYP_694 0x000010 /* VAX 4000 model 705A
- (same value as 692) */
-
-#define VAX_BTYP_49 0x13000004 /* VaxStation 4000 model 90 */
-
-/*
- * SOC chip series (1991)
- */
-#define VAX_TYP_SOC 20
-
-#define VAX_BTYP_660 0x14000001 /* VAX 4000 model 200 */
-#define VAX_STYP_660 0x5
-#define VAX_BTYP_48 0x14000004 /* VS4000/VLC and MV3100/{30,40} */
-#define VAX_STYP_45 0x000000 /* MicroVAX 3100 {30,40} */
-#define VAX_STYP_48 0x000001 /* VAXstation 4000 VLC */
-#define VAX_BTYP_550 0x14000007 /* VAXft model 410, 610 */
-#define VAX_BTYP_VXT 0x14000008 /* VXT 2000+ */
-
-/*
- * NVAX+ chip series (1991)
- */
-#define VAX_TYP_NVPLUS 23
-
-#define VAX_BTYP_1701 0x17000001
-
-/*
- * Some common-used external variables.
- */
-extern int vax_cputype; /* general, highest byte of the SID-register */
-extern int vax_cpustype; /* general, second byte of the SIE-register */
-extern int vax_cpudata; /* general, the contents of the SID-register */
-extern int vax_siedata; /* contents of the SIE register */
-extern int vax_bustype; /* HW-dep., setup at consinit() in ka???.c */
-extern int vax_boardtype; /* HW-dep., msb of SID | SIE (SID-extension) */
-extern int vax_confdata; /* HW-dep., hardware dependent config-data */
-
diff --git a/sys/arch/vax/include/signal.h b/sys/arch/vax/include/signal.h
deleted file mode 100644
index 59f306b9887..00000000000
--- a/sys/arch/vax/include/signal.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $OpenBSD: signal.h,v 1.8 2012/12/02 07:03:31 guenther Exp $ */
-/* $NetBSD: signal.h,v 1.4 1995/01/10 19:01:52 jtc Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1989, 1991 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.
- *
- * @(#)signal.h 7.16 (Berkeley) 3/17/91
- */
-
- /* All bugs are subject to removal without further notice */
-
-#ifndef _MACHINE_SIGNAL_H_
-#define _MACHINE_SIGNAL_H_
-
-#include <sys/cdefs.h>
-
-typedef int sig_atomic_t;
-
-#if __BSD_VISIBLE || __XPG_VISIBLE >= 420
-/*
- * Information pushed on stack when a signal is delivered.
- * This is used by the kernel to restore state following
- * execution of the signal handler. It is also made available
- * to the handler to allow it to restore state properly if
- * a non-standard exit is performed.
- */
-struct sigcontext {
- int __sc_unused;
- int sc_mask; /* signal mask to restore */
- int sc_sp; /* sp to restore */
- int sc_fp; /* fp to restore */
- int sc_ap; /* ap to restore */
- int sc_pc; /* pc to restore */
- int sc_ps; /* psl to restore */
- int sc_r[12]; /* registers to restore */
-};
-#endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */
-#endif /* !_MACHINE_SIGNAL_H_ */
diff --git a/sys/arch/vax/include/spinlock.h b/sys/arch/vax/include/spinlock.h
deleted file mode 100644
index b050c25e885..00000000000
--- a/sys/arch/vax/include/spinlock.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* $OpenBSD: spinlock.h,v 1.3 2013/06/01 20:47:40 tedu Exp $ */
-
-#ifndef _MACHINE_SPINLOCK_H_
-#define _MACHINE_SPINLOCK_H_
-
-#define _ATOMIC_LOCK_UNLOCKED (0)
-#define _ATOMIC_LOCK_LOCKED (1)
-typedef int _atomic_lock_t;
-
-#ifndef _KERNEL
-int _atomic_lock(volatile _atomic_lock_t *);
-#endif
-
-#endif
diff --git a/sys/arch/vax/include/stdarg.h b/sys/arch/vax/include/stdarg.h
deleted file mode 100644
index 5616d3881f5..00000000000
--- a/sys/arch/vax/include/stdarg.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $OpenBSD: stdarg.h,v 1.12 2014/03/11 19:45:27 guenther Exp $ */
-/* $NetBSD: stdarg.h,v 1.11 1999/05/03 16:30:34 christos Exp $ */
-
-/*-
- * Copyright (c) 1991 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.
- *
- * @(#)stdarg.h 7.2 (Berkeley) 5/4/91
- */
-
-#ifndef _MACHINE_STDARG_H_
-#define _MACHINE_STDARG_H_
-
-#include <sys/cdefs.h>
-#include <machine/_types.h>
-
-typedef __va_list va_list;
-
-#define __va_size(type) \
- (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))
-
-#define va_start(ap, last) \
- ((ap) = (va_list)__builtin_next_arg(last))
-
-#define va_arg(ap, type) \
- (*(type *)(void *)((ap) += __va_size(type), (ap) - __va_size(type)))
-
-#if __BSD_VISIBLE
-#define __va_copy(dest, src) \
- ((dest) = (src))
-#endif
-
-#define va_end(ap)
-
-#endif /* !_MACHINE_STDARG_H_ */
diff --git a/sys/arch/vax/include/tcb.h b/sys/arch/vax/include/tcb.h
deleted file mode 100644
index 03109f8a103..00000000000
--- a/sys/arch/vax/include/tcb.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* $OpenBSD: tcb.h,v 1.1 2011/10/27 04:01:17 guenther Exp $ */
-
-/*
- * Copyright (c) 2011 Philip Guenther <guenther@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _MACHINE_TCB_H_
-#define _MACHINE_TCB_H_
-
-#ifdef _KERNEL
-
-#error "not yet"
-
-#else /* _KERNEL */
-
-/* Not ELF, so for now use a big TCB to save a memory reference for errno */
-#define TLS_VARIANT 2
-
-#endif /* _KERNEL */
-
-#endif /* _MACHINE_TCB_H_ */
diff --git a/sys/arch/vax/include/trap.h b/sys/arch/vax/include/trap.h
deleted file mode 100644
index 50d2a39d90e..00000000000
--- a/sys/arch/vax/include/trap.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* $OpenBSD: trap.h,v 1.13 2011/03/23 16:54:37 pirofti Exp $ */
-/* $NetBSD: trap.h,v 1.18 2000/06/04 02:19:26 matt Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- *
- * @(#)trap.h 5.4 (Berkeley) 5/9/91
- */
-
-/*
- * Trap type values
- * also known in trap.c for name strings
- */
-#ifndef _MACHINE_TRAP_H_
-#define _MACHINE_TRAP_H_
-
-#define T_RESADFLT 0 /* reserved addressing */
-#define T_PRIVINFLT 1 /* privileged instruction */
-#define T_RESOPFLT 2 /* reserved operand */
-#define T_BPTFLT 3 /* breakpoint instruction */
-#define T_XFCFLT 4 /* Customer reserved instruction */
-#define T_SYSCALL 5 /* system call (kcall) */
-#define T_ARITHFLT 6 /* arithmetic trap */
-#define T_ASTFLT 7 /* system forced exception */
-#define T_PTELEN 8 /* Page table length exceeded */
-#define T_TRANSFLT 9 /* translation fault */
-#define T_TRCTRAP 10 /* trace trap */
-#define T_COMPAT 11 /* compatibility mode fault on VAX */
-#define T_ACCFLT 12 /* Access violation fault */
-#define T_KSPNOTVAL 15 /* kernel stack pointer not valid */
-#define T_KDBTRAP 17 /* kernel debugger trap */
-
-/* These gets ORed with the word for page handling routines */
-#define T_WRITE 0x80
-#define T_PTEFETCH 0x40
-
-/* Trap's coming from user mode */
-#define T_USER 0x100
-
-#ifndef _LOCORE
-struct trapframe {
- long fp; /* Stack frame pointer */
- long ap; /* Argument pointer on user stack */
- long sp; /* Stack pointer */
- long r0; /* General registers saved upon trap/syscall */
- long r1;
- long r2;
- long r3;
- long r4;
- long r5;
- long r6;
- long r7;
- long r8;
- long r9;
- long r10;
- long r11;
- long trap; /* Type of trap */
- long code; /* Trap specific code */
- long pc; /* User pc */
- long psl; /* User psl */
-};
-
-#endif /* _LOCORE */
-
-#endif /* _MACHINE_TRAP_H_ */
diff --git a/sys/arch/vax/include/uvax.h b/sys/arch/vax/include/uvax.h
deleted file mode 100644
index fe113862173..00000000000
--- a/sys/arch/vax/include/uvax.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* $OpenBSD: uvax.h,v 1.6 2011/03/23 16:54:37 pirofti Exp $ */
-/* $NetBSD: uvax.h,v 1.5 1999/02/02 18:37:22 ragge Exp $ */
-/*
- * Copyright (c) 2002 Hugh Graham.
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_UVAX_H_
-#define _MACHINE_UVAX_H_
-
-/*
- * Generic definitions common on all MicroVAXen clock chip.
- */
-#define uVAX_CLKVRT 0200
-#define uVAX_CLKUIP 0200
-#define uVAX_CLKRATE 040
-#define uVAX_CLKENABLE 06
-#define uVAX_CLKSET 0206
-
-/* cpmbx bits */
-#define uVAX_CLKHLTACT 03
-
-/* halt action values */
-#define uVAX_CLKRESTRT 01
-#define uVAX_CLKREBOOT 02
-#define uVAX_CLKHALT 03
-
-/* in progress flags */
-#define uVAX_CLKBOOT 04
-#define uVAX_CLKRSTRT 010
-#define uVAX_CLKLANG 0360
-
-/*
- * Miscellaneous registers common on most VAXststions.
- */
-struct vs_cpu {
- u_long vc_hltcod; /* Halt Code Register */
- u_long vc_410mser; /* VS2K */
- u_long vc_410cear; /* VS2K */
- u_char vc_intmsk; /* Interrupt mask register */
- u_char vc_vdcorg; /* Mono display origin */
- u_char vc_vdcsel; /* Video interrupt select */
- u_char vc_intreq; /* Interrupt request register */
-#define vc_intclr vc_intreq
- u_short vc_diagdsp; /* Diagnostic display register */
- u_short pad4;
- u_long vc_parctl; /* Parity Control Register */
-#define vc_bwf0 vc_parctl
- u_short pad5;
- u_short pad6;
- u_short vc_diagtimu; /* usecond timer KA46 */
- u_short vc_diagtme; /* Diagnostic time register */
-#define vc_diagtimm vc_diagtme /* msecond time KA46 */
-};
-#define PARCTL_DMA 0x1000000
-#define PARCTL_CPEN 2
-#define PARCTL_DPEN 1
-
-/*
- * Console Mailbox layout common to several models.
- */
-
-struct cpmbx {
- unsigned int mbox_halt:2; /* mailbox halt action */
- unsigned int mbox_bip:1; /* bootstrap in progress */
- unsigned int mbox_rip:1; /* restart in progress */
- unsigned int mbox_lang:4; /* language info */
- unsigned int terminal:8; /* terminal info */
- unsigned int keyboard:8; /* keyboard info */
- unsigned int user_four:4; /* unknown */
- unsigned int user_halt:3; /* user halt action */
- unsigned int user_one:1; /* unknown */
-};
-
-extern struct cpmbx *cpmbx;
-
-void generic_halt(void);
-void generic_reboot(int);
-
-#define MHALT_RESTART_REBOOT 0
-#define MHALT_RESTART 1
-#define MHALT_REBOOT 2
-#define MHALT_HALT 3
-
-#define UHALT_DEFAULT 0
-#define UHALT_RESTART 1
-#define UHALT_REBOOT 2
-#define UHALT_HALT 3
-#define UHALT_RESTART_REBOOT 4
-
-#endif
diff --git a/sys/arch/vax/include/varargs.h b/sys/arch/vax/include/varargs.h
deleted file mode 100644
index c5593e0da1e..00000000000
--- a/sys/arch/vax/include/varargs.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $OpenBSD: varargs.h,v 1.6 2011/03/23 16:54:37 pirofti Exp $ */
-/* $NetBSD: varargs.h,v 1.9 1995/12/26 01:16:35 mycroft Exp $ */
-
-/*-
- * Copyright (c) 1990 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.
- *
- * @(#)varargs.h 5.3 (Berkeley) 4/3/91
- */
-
-#ifndef _MACHINE_VARARGS_H_
-#define _MACHINE_VARARGS_H_
-
-#include <machine/stdarg.h>
-
-#if __GNUC__ == 1
-#define __va_ellipsis
-#else
-#define __va_ellipsis ...
-#endif
-
-#define va_alist __builtin_va_alist
-#define va_dcl long __builtin_va_alist; __va_ellipsis
-
-#undef va_start
-#define va_start(ap) \
- ((ap) = (va_list)&__builtin_va_alist)
-
-#endif /* !_MACHINE_VARARGS_H_ */
diff --git a/sys/arch/vax/include/vaxfp.h b/sys/arch/vax/include/vaxfp.h
deleted file mode 100644
index 2b3407faab6..00000000000
--- a/sys/arch/vax/include/vaxfp.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* $OpenBSD: vaxfp.h,v 1.2 2011/03/23 16:54:37 pirofti Exp $ */
-/* $NetBSD: vaxfp.h,v 1.7 2008/04/28 20:23:39 martin Exp $ */
-
-/*-
- * Copyright (c) 2003 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Klaus Klein.
- *
- * 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 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.
- */
-
-/*
- * vaxfp.h defines the layout of VAX Floating-Point data types.
- * Only F_floating and D_floating types are defined here;
- * G_floating and H_floating are not supported by OpenBSD.
- */
-#ifndef _MACHINE_VAXFP_H_
-#define _MACHINE_VAXFP_H_
-
-#define FFLT_EXPBITS 8
-#define FFLT_FRACHBITS 7
-#define FFLT_FRACLBITS 16
-#define FFLT_FRACBITS (FFLT_FRACLBITS + FFLT_FRACHBITS)
-
-struct vax_f_floating {
- unsigned int fflt_frach:FFLT_FRACHBITS;
- unsigned int fflt_exp:FFLT_EXPBITS;
- unsigned int fflt_sign:1;
- unsigned int fflt_fracl:FFLT_FRACLBITS;
-};
-
-#define DFLT_EXPBITS 8
-#define DFLT_FRACHBITS 7
-#define DFLT_FRACMBITS 16
-#define DFLT_FRACLBITS 32
-#define DFLT_FRACBITS (DFLT_FRACLBITS + DFLT_FRACMBITS + DFLT_FRACHBITS)
-
-struct vax_d_floating {
- unsigned int dflt_frach:DFLT_FRACHBITS;
- unsigned int dflt_exp:DFLT_EXPBITS;
- unsigned int dflt_sign:1;
- unsigned int dflt_fracm:DFLT_FRACMBITS;
- unsigned int dflt_fracl:DFLT_FRACLBITS;
-};
-
-/*
- * Exponent biases.
- */
-#define FFLT_EXP_BIAS 128
-#define DFLT_EXP_BIAS 128
-
-/*
- * Convenience data structures.
- */
-union vax_ffloating_u {
- float ffltu_f;
- struct vax_f_floating ffltu_fflt;
-};
-
-union vax_dfloating_u {
- double dfltu_d;
- struct vax_d_floating dfltu_dflt;
-};
-
-#endif /* _MACHINE_VAXFP_H_ */
diff --git a/sys/arch/vax/include/vmparam.h b/sys/arch/vax/include/vmparam.h
deleted file mode 100644
index 681e005a248..00000000000
--- a/sys/arch/vax/include/vmparam.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* $OpenBSD: vmparam.h,v 1.37 2015/11/01 20:10:00 miod Exp $ */
-/* $NetBSD: vmparam.h,v 1.32 2000/03/07 00:05:59 matt Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Slightly modified for the VAX port /IC
- *
- * 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.
- *
- * @(#)vmparam.h 5.9 (Berkeley) 5/12/91
- */
-#ifndef _MACHINE_VMPARAM_H_
-#define _MACHINE_VMPARAM_H_
-
-/*
- * Machine dependent constants for VAX.
- */
-
-#define USRSTACK KERNBASE
-
-/*
- * Virtual memory related constants, all in bytes
- */
-
-#ifndef MAXTSIZ
-#define MAXTSIZ (8*1024*1024) /* max text size */
-#endif
-#ifndef MAXDSIZ
-#define MAXDSIZ (128*1024*1024) /* max data size */
-#endif
-#ifndef MAXSSIZ
-#define MAXSSIZ (8*1024*1024) /* max stack size */
-#endif
-#ifndef DFLDSIZ
-#define DFLDSIZ (8*1024*1024) /* initial data size limit */
-#endif
-#ifndef DFLSSIZ
-#define DFLSSIZ (512*1024) /* initial stack size limit */
-#endif
-
-#define STACKGAP_RANDOM 32*1024
-
-#define BRKSIZ (16*1024*1024)
-
-/*
- * Size of shared memory map
- */
-
-#ifndef SHMMAXPGS
-#define SHMMAXPGS 64 /* XXXX should be 1024 */
-#endif
-
-#define VM_PHYSSEG_MAX 1
-#define VM_PHYSSEG_NOADD
-#define VM_PHYSSEG_STRAT VM_PSTRAT_RANDOM
-
-/* MD round macros */
-#define vax_round_page(x) (((vaddr_t)(x) + VAX_PGOFSET) & ~VAX_PGOFSET)
-#define vax_trunc_page(x) ((vaddr_t)(x) & ~VAX_PGOFSET)
-
-/* user/kernel map constants */
-#define VM_MIN_ADDRESS ((vaddr_t)PAGE_SIZE)
-#define VM_MAXUSER_ADDRESS ((vaddr_t)KERNBASE)
-#define VM_MAX_ADDRESS ((vaddr_t)KERNBASE)
-#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)KERNBASE)
-#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)(0xC0000000))
-
-#define USRIOSIZE (8 * VAX_NPTEPG) /* 512MB */
-#define VM_PHYS_SIZE (USRIOSIZE*VAX_NBPG)
-
-#endif /* _MACHINE_VMPARAM_H_ */
diff --git a/sys/arch/vax/include/vsbus.h b/sys/arch/vax/include/vsbus.h
deleted file mode 100644
index dd4bd09e82b..00000000000
--- a/sys/arch/vax/include/vsbus.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* $OpenBSD: vsbus.h,v 1.11 2011/09/11 19:29:01 miod Exp $ */
-/* $NetBSD: vsbus.h,v 1.13 2000/06/25 16:00:46 ragge Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * Generic definitions for the (virtual) vsbus. contains common info
- * used by all VAXstations.
- */
-
-#ifndef _MACHINE_VSBUS_H_
-#define _MACHINE_VSBUS_H_
-
-#include <machine/bus.h>
-#include <machine/sgmap.h>
-
-struct vsbus_attach_args {
- vaddr_t va_addr; /* virtual CSR address */
- paddr_t va_paddr; /* physical CSR address */
-
- short va_br; /* Interrupt level */
- int va_cvec; /* Interrupt vector address */
- u_char va_maskno; /* Interrupt vector in mask */
- vaddr_t va_dmaaddr; /* DMA area address */
- vsize_t va_dmasize; /* DMA area size */
- bus_space_tag_t va_iot;
- bus_dma_tag_t va_dmat;
-};
-
-/*
- * Some chip addresses and constants, same on all VAXstations.
- */
-#define VS_CFGTST 0x20020000 /* config register */
-#define VS_REGS 0x20080000 /* Misc cpu internal regs */
-#define VS_REGS_KA49 0x25c00000 /* ... same, on 512KB ROM systems */
-#define NI_ADDR 0x20090000 /* Ethernet address */
-#define DZ_CSR 0x200a0000 /* DZ11-compatible chip csr */
-#define DZ_CSR_KA49 0x25000000 /* ... same, on 512KB ROM systems */
-#define VS_CLOCK 0x200b0000 /* clock chip address */
-#define SCA_REGS 0x200c0000 /* disk device addresses */
-#define SCA_REGS_KA49 0x26000000 /* ... same, on 512KB ROM systems */
-#define NI_BASE 0x200e0000 /* LANCE CSRs */
-#define NI_IOSIZE (128 * VAX_NBPG) /* IO address size */
-
-#define KA49_SCSIMAP 0x27000000 /* KA49 SCSI SGMAP */
-/*
- * Small monochrome graphics framebuffer, present on all machines.
- */
-#define SMADDR 0x30000000
-#define SMSIZE 0x20000 /* Actually 256k, only 128k used */
-
-struct vsbus_softc {
- struct device sc_dev;
- u_char *sc_intmsk; /* Mask register */
- u_char *sc_intclr; /* Clear interrupt register */
- u_char *sc_intreq; /* Interrupt request register */
- u_char sc_mask; /* Interrupts to enable after autoconf */
- vaddr_t sc_vsregs; /* Where the VS_REGS are mapped */
- vaddr_t sc_dmaaddr; /* Mass storage virtual DMA area */
- vsize_t sc_dmasize; /* Size of the DMA area */
-
- struct vax_bus_dma_tag sc_dmatag;
- struct vax_sgmap sc_sgmap;
-};
-
-struct vsbus_dma {
- SIMPLEQ_ENTRY(vsbus_dma) vd_q;
- void (*vd_go)(void *);
- void *vd_arg;
-};
-
-#ifdef _KERNEL
-void vsbus_dma_init(struct vsbus_softc *, unsigned ptecnt);
-u_char vsbus_setmask(int);
-void vsbus_clrintr(int);
-void vsbus_copytoproc(struct proc *, caddr_t, caddr_t, int);
-void vsbus_copyfromproc(struct proc *, caddr_t, caddr_t, int);
-void vsbus_dma_start(struct vsbus_dma *);
-void vsbus_dma_intr(void);
-#endif
-#endif /* _MACHINE_VSBUS_H_ */
diff --git a/sys/arch/vax/mbus/dz_fwio.c b/sys/arch/vax/mbus/dz_fwio.c
deleted file mode 100644
index 42cc31ebd6f..00000000000
--- a/sys/arch/vax/mbus/dz_fwio.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/* $OpenBSD: dz_fwio.c,v 1.2 2008/08/24 14:49:35 miod Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/device.h>
-#include <sys/systm.h>
-
-#include <machine/bus.h>
-#include <machine/sid.h>
-
-#include <vax/mbus/mbusreg.h>
-#include <vax/mbus/mbusvar.h>
-#include <vax/mbus/fwioreg.h>
-#include <vax/mbus/fwiovar.h>
-
-#include <vax/qbus/dzreg.h>
-#include <vax/qbus/dzvar.h>
-
-#include <vax/dec/dzkbdvar.h>
-
-#include <sys/tty.h>
-#include <dev/cons.h>
-
-#include "dzkbd.h"
-#include "dzms.h"
-
-int dz_fwio_match(struct device *, void *, void *);
-void dz_fwio_attach(struct device *, struct device *, void *);
-
-struct cfattach dz_fwio_ca = {
- sizeof(struct dz_softc), dz_fwio_match, dz_fwio_attach
-};
-
-extern struct cfdriver dz_cd;
-
-int dz_fwio_intr(void *);
-
-#define DZ_FWIO_CSR 0
-#define DZ_FWIO_RBUF 4
-#define DZ_FWIO_DTR 9
-#define DZ_FWIO_BREAK 13
-#define DZ_FWIO_TBUF 12
-#define DZ_FWIO_TCR 8
-#define DZ_FWIO_DCD 13
-#define DZ_FWIO_RING 13
-
-int
-dz_fwio_match(struct device *parent, void *vcf, void *aux)
-{
- struct fwio_attach_args *faa = (struct fwio_attach_args *)aux;
-
- return strcmp(faa->faa_dev, dz_cd.cd_name) == 0 ? 1 : 0;
-}
-
-void
-dz_fwio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct fwio_attach_args *faa = (struct fwio_attach_args *)aux;
- struct dz_softc *sc = (struct dz_softc *)self;
- paddr_t basepa;
-#if NDZKBD > 0 || NDZMS > 0
- struct dzkm_attach_args daa;
- extern struct consdev wsdisplay_cons;
-#endif
- extern vaddr_t dz_console_regs;
- vaddr_t dz_regs;
- unsigned int vec;
- int console;
- int serial_console;
-
- vec = faa->faa_vecbase + FBIC_DEVIRQ2 * 4;
- printf(" vec %d: ", vec);
-
- /*
- * Map registers.
- */
-
- if (dz_console_regs != 0 && faa->faa_mid == mbus_ioslot) {
- dz_regs = dz_console_regs;
- console = 1;
- serial_console = (vax_confdata & 0x60) == 0;
- if (serial_console)
- printf("console, ");
- } else {
- basepa = faa->faa_base + FWIO_DZ_REG_OFFSET;
- dz_regs = vax_map_physmem(basepa, 1);
- console = 0;
- }
-
- /*
- * XXX - This is evil and ugly, but...
- * due to the nature of how bus_space_* works on VAX, this will
- * be perfectly good until everything is converted.
- */
- sc->sc_ioh = dz_regs;
-
- sc->sc_dr.dr_csr = DZ_FWIO_CSR;
- sc->sc_dr.dr_rbuf = DZ_FWIO_RBUF;
- sc->sc_dr.dr_tbuf = DZ_FWIO_TBUF;
- sc->sc_dr.dr_tcr = DZ_FWIO_TCR;
- sc->sc_dr.dr_dtr = DZ_FWIO_DTR;
- sc->sc_dr.dr_break = DZ_FWIO_BREAK;
- sc->sc_dr.dr_dcd = DZ_FWIO_DCD;
- sc->sc_dr.dr_ring = DZ_FWIO_RING;
-
- sc->sc_type = DZ_DZV;
-
- /* no modem control bits except on line 2 */
- sc->sc_dsr = (1 << 0) | (1 << 1) | (1 << 3);
-
- printf("4 lines");
-
- /*
- * Complete attachment.
- */
-
- dzattach(sc);
-
- /*
- * Register interrupt handler.
- */
-
- if (mbus_intr_establish(vec, IPL_TTY, dz_fwio_intr, sc,
- self->dv_xname) != 0) {
- printf("\n%s: can't establish interrupt\n", self->dv_xname);
- return;
- }
-
- /*
- * Attach input devices, if any.
- */
-
-#if NDZKBD > 0
- daa.daa_line = 0;
- DZ_WRITE_WORD(sc, dr_rbuf, DZ_LPR_RX_ENABLE | (DZ_LPR_B4800 << 8) |
- DZ_LPR_8_BIT_CHAR | daa.daa_line);
- daa.daa_flags =
- (console && cn_tab == &wsdisplay_cons ? DZKBD_CONSOLE : 0);
- config_found(self, &daa, dz_print);
-#endif
-#if NDZMS > 0
- daa.daa_line = 1;
- DZ_WRITE_WORD(sc, dr_rbuf, DZ_LPR_RX_ENABLE | (DZ_LPR_B4800 << 8) |
- DZ_LPR_8_BIT_CHAR | DZ_LPR_PARENB | DZ_LPR_OPAR | daa.daa_line);
- daa.daa_flags = 0;
- config_found(self, &daa, dz_print);
-#endif
-}
-
-int
-dz_fwio_intr(void *v)
-{
- struct dz_softc *sc = (struct dz_softc *)v;
-
- /*
- * FBIC expects edge interrupts, while the dz does level
- * interrupts. To avoid missing interrupts while servicing,
- * we disable further device interrupts while servicing.
- */
- DZ_WRITE_WORD(sc, dr_csr,
- DZ_READ_WORD(sc, dr_csr) & ~(DZ_CSR_RXIE | DZ_CSR_TXIE));
-
- dzrint(sc);
- dzxint(sc);
-
- DZ_WRITE_WORD(sc, dr_csr,
- DZ_READ_WORD(sc, dr_csr) | (DZ_CSR_RXIE | DZ_CSR_TXIE));
-
- return 1;
-}
diff --git a/sys/arch/vax/mbus/files.mbus b/sys/arch/vax/mbus/files.mbus
deleted file mode 100644
index c177328494a..00000000000
--- a/sys/arch/vax/mbus/files.mbus
+++ /dev/null
@@ -1,33 +0,0 @@
-# $OpenBSD: files.mbus,v 1.3 2013/09/24 20:10:52 miod Exp $
-
-# VAXstation 3[58][24]0 internal bus
-device mbus { [mid = -1] }
-attach mbus at mainbus
-file arch/vax/mbus/mbus.c mbus
-
-# L2003 Firefox Workstation I/O Module
-device fwio {}
-attach fwio at mbus
-file arch/vax/mbus/fwio.c fwio
-
-attach dz at fwio with dz_fwio: dzcons
-file arch/vax/mbus/dz_fwio.c dz_fwio
-
-attach le at fwio with le_fwio: le24
-file arch/vax/mbus/if_le_fwio.c le_fwio
-
-attach sii at fwio with sii_fwio
-file arch/vax/mbus/sii_fwio.c sii_fwio
-
-# L2004 LEGSS video
-# (with L2005 8-plane output module and optional L2006 16-plane module)
-device legss: wsemuldisplaydev, rasops32
-attach legss at mbus
-file arch/vax/mbus/legss.c legss needs-flag
-
-# L2008 FQAM (CQBIC)
-attach uba at mbus with uba_mbus
-file arch/vax/mbus/uba_mbus.c uba_mbus
-
-# L2001 or L2010 CPU
-# L2007 memory
diff --git a/sys/arch/vax/mbus/fwio.c b/sys/arch/vax/mbus/fwio.c
deleted file mode 100644
index 10a1c46f935..00000000000
--- a/sys/arch/vax/mbus/fwio.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* $OpenBSD: fwio.c,v 1.3 2015/09/13 12:31:35 miod Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Firefox Workstation I/O Module
- *
- * This M-bus board sports:
- * - a System Support Chip implementing the (off cpu) clocks.
- * - a SII controller, in SCSI mode, with 128KB static memory.
- * - a LANCE Ethernet controller, with 128KB static memory.
- * - a DZQ11-compatible DC7085 4 lines serial controller.
- */
-
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-
-#include <machine/bus.h>
-
-#include <vax/mbus/mbusreg.h>
-#include <vax/mbus/mbusvar.h>
-#include <vax/mbus/fwioreg.h>
-#include <vax/mbus/fwiovar.h>
-
-struct fwio_softc {
- struct device sc_dev;
- long sc_loc[1]; /* locators override */
-};
-
-void fwio_attach(struct device *, struct device *, void *);
-int fwio_match(struct device *, void *, void *);
-
-struct cfdriver fwio_cd = {
- NULL, "fwio", DV_DULL
-};
-
-const struct cfattach fwio_ca = {
- sizeof(struct fwio_softc), fwio_match, fwio_attach
-};
-
-int fwio_print(void *, const char *);
-
-int
-fwio_match(struct device *parent, void *vcf, void *aux)
-{
- struct mbus_attach_args *maa = (struct mbus_attach_args *)aux;
-
- if (maa->maa_class == CLASS_IO && maa->maa_interface == INTERFACE_FBIC)
- return 1;
-
- return 0;
-}
-
-void
-fwio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct mbus_attach_args *maa = (struct mbus_attach_args *)aux;
- struct fwio_softc *sc = (struct fwio_softc *)self;
- struct fwio_attach_args faa;
-
- printf("\n");
-
- /*
- * Save our mid in locators. booted_sd() in autoconf.c depends
- * on this to find the correct boot device.
- */
- sc->sc_loc[0] = maa->maa_mid;
- self->dv_cfdata->cf_loc = sc->sc_loc;
-
- faa.faa_mid = maa->maa_mid;
- faa.faa_base = MBUS_SLOT_BASE(maa->maa_mid);
- faa.faa_vecbase = maa->maa_vecbase;
-
- faa.faa_dev = "dz";
- (void)config_found(self, &faa, fwio_print);
-
- faa.faa_dev = "le";
- (void)config_found(self, &faa, fwio_print);
-
- faa.faa_dev = "sii";
- (void)config_found(self, &faa, fwio_print);
-}
-
-int
-fwio_print(void *aux, const char *pnp)
-{
- struct fwio_attach_args *faa = (struct fwio_attach_args *)aux;
-
- if (pnp != NULL)
- printf("%s at %s", faa->faa_dev, pnp);
-
- return (UNCONF);
-}
diff --git a/sys/arch/vax/mbus/fwioreg.h b/sys/arch/vax/mbus/fwioreg.h
deleted file mode 100644
index 81b4a6986d7..00000000000
--- a/sys/arch/vax/mbus/fwioreg.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $OpenBSD: fwioreg.h,v 1.1 2008/08/18 23:19:25 miod Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Firefox Workstation I/O Module registers and memory layout
- */
-
-#define FWIO_SSC_REMAP_ADDR 0x21400000
-
-#define FWIO_SII_REG_OFFSET 0x000000
-#define FWIO_LANCE_REG_OFFSET 0x200000
-#define FWIO_SII_BUF_OFFSET 0x400000
-#define FWIO_SII_BUF_SIZE 0x020000
-#define FWIO_DZ_REG_OFFSET 0x600000
-#define FWIO_IOCSR_OFFSET 0x800000
-#define FWIO_ESAR_OFFSET 0x800000
-#define FWIO_LANCE_BUF_OFFSET 0xa00000
-#define FWIO_LANCE_BUF_SIZE 0x020000
-
-/*
- * IOCSR bits
- */
-
-#define FWIO_IOCSR_CNSL 0x80000000 /* break on line 3 asserts MHALT */
-#define FWIO_IOCSR_MRUN 0x40000000 /* assert MRUN */
-#define FWIO_IOCSR_CLKIEN 0x20000000 /* drive MCLKI */
-#define FWIO_IOCSR_RSTWS 0x10000000 /* reset workstation */
-
-#define FWIO_ESAR_MASK 0x00ff0000
-#define FWIO_ESAR_SHIFT 16
diff --git a/sys/arch/vax/mbus/fwiovar.h b/sys/arch/vax/mbus/fwiovar.h
deleted file mode 100644
index 05f5e4a26af..00000000000
--- a/sys/arch/vax/mbus/fwiovar.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $OpenBSD: fwiovar.h,v 1.1 2008/08/18 23:19:25 miod Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Firefox Workstation I/O Module subdevice attachment glue
- */
-
-struct fwio_attach_args {
- const char *faa_dev;
- unsigned int faa_mid;
- paddr_t faa_base;
- unsigned int faa_vecbase;
-};
diff --git a/sys/arch/vax/mbus/if_le_fwio.c b/sys/arch/vax/mbus/if_le_fwio.c
deleted file mode 100644
index 9b44644ed12..00000000000
--- a/sys/arch/vax/mbus/if_le_fwio.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/* $OpenBSD: if_le_fwio.c,v 1.4 2014/12/22 02:26:54 tedu Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*-
- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum and 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.
- *
- * 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) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * 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.
- *
- * @(#)if_le.c 8.2 (Berkeley) 11/16/93
- */
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <net/if.h>
-#include <net/if_media.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#include <vax/mbus/mbusreg.h>
-#include <vax/mbus/mbusvar.h>
-#include <vax/mbus/fwioreg.h>
-#include <vax/mbus/fwiovar.h>
-
-#include <dev/ic/lancereg.h>
-#include <dev/ic/lancevar.h>
-#include <dev/ic/am7990reg.h>
-#include <dev/ic/am7990var.h>
-
-struct le_fwio_softc {
- struct am7990_softc sc_am7990;
- volatile uint16_t *sc_rap;
- volatile uint16_t *sc_rdp;
-};
-
-int le_fwio_match(struct device *, void *, void *);
-void le_fwio_attach(struct device *, struct device *, void *);
-
-struct cfattach le_fwio_ca = {
- sizeof(struct le_fwio_softc), le_fwio_match, le_fwio_attach
-};
-
-int le_fwio_intr(void *);
-uint16_t le_fwio_rdcsr(struct lance_softc *, uint16_t);
-void le_fwio_wrcsr(struct lance_softc *, uint16_t, uint16_t);
-void le_fwio_wrcsr_interrupt(struct lance_softc *, uint16_t, uint16_t);
-
-int
-le_fwio_match(struct device *parent, void *vcf, void *aux)
-{
- struct fwio_attach_args *faa = (struct fwio_attach_args *)aux;
-
- return strcmp(faa->faa_dev, le_cd.cd_name) == 0 ? 1 : 0;
-}
-
-void
-le_fwio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct fwio_attach_args *faa = (struct fwio_attach_args *)aux;
- struct le_fwio_softc *lsc = (struct le_fwio_softc *)self;
- struct lance_softc *sc = &lsc->sc_am7990.lsc;
- unsigned int vec;
- uint32_t *esar;
- int i;
-
- vec = faa->faa_vecbase + FBIC_DEVIRQ1 * 4;
- printf(" vec %d", vec);
-
- /*
- * Map registers.
- */
-
- lsc->sc_rdp = (volatile uint16_t *)
- vax_map_physmem(faa->faa_base + FWIO_LANCE_REG_OFFSET, 1);
- lsc->sc_rap = lsc->sc_rdp + 2;
-
- /*
- * Register access functions.
- */
-
- sc->sc_rdcsr = le_fwio_rdcsr;
- sc->sc_wrcsr = le_fwio_wrcsr;
-
- /*
- * Map buffers.
- */
-
- sc->sc_mem = (void *)uvm_km_valloc(kernel_map, FWIO_LANCE_BUF_SIZE);
- if (sc->sc_mem == NULL) {
- vax_unmap_physmem(faa->faa_base + FWIO_LANCE_REG_OFFSET, 1);
- printf(": can't map buffers\n");
- return;
- }
-
- ioaccess((vaddr_t)sc->sc_mem, faa->faa_base +
- FWIO_LANCE_BUF_OFFSET, FWIO_LANCE_BUF_SIZE >> VAX_PGSHIFT);
-
- sc->sc_addr = FWIO_LANCE_BUF_OFFSET;
- sc->sc_memsize = FWIO_LANCE_BUF_SIZE;
- sc->sc_conf3 = 0;
-
- sc->sc_copytodesc = lance_copytobuf_contig;
- sc->sc_copyfromdesc = lance_copyfrombuf_contig;
- sc->sc_copytobuf = lance_copytobuf_contig;
- sc->sc_copyfrombuf = lance_copyfrombuf_contig;
- sc->sc_zerobuf = lance_zerobuf_contig;
-
- /*
- * Get the Ethernet address from the Station Address ROM.
- */
-
- esar = (uint32_t *)vax_map_physmem(faa->faa_base + FWIO_ESAR_OFFSET, 1);
- for (i = 0; i < 6; i++)
- sc->sc_arpcom.ac_enaddr[i] =
- (esar[i] & FWIO_ESAR_MASK) >> FWIO_ESAR_SHIFT;
- vax_unmap_physmem((vaddr_t)esar, 1);
-
- /*
- * Register interrupt handler.
- */
-
- if (mbus_intr_establish(vec, IPL_NET, le_fwio_intr, sc,
- self->dv_xname) != 0) {
- vax_unmap_physmem(faa->faa_base + FWIO_LANCE_REG_OFFSET, 1);
- uvm_km_free(kernel_map, (vaddr_t)sc->sc_mem,
- FWIO_LANCE_BUF_SIZE);
- printf(": can't establish interrupt\n");
- return;
- }
-
- /*
- * Complete attachment.
- */
-
- am7990_config(&lsc->sc_am7990);
-}
-
-int
-le_fwio_intr(void *v)
-{
- struct le_fwio_softc *lsc = (struct le_fwio_softc *)v;
- struct lance_softc *sc = &lsc->sc_am7990.lsc;
- int rc;
-
- /*
- * FBIC expects edge interrupts, while the LANCE does level
- * interrupts. To avoid missing interrupts while servicing,
- * we disable further device interrupts while servicing.
- *
- * However, am7990_intr() will flip the interrupt enable bit
- * itself; we override wrcsr with a specific version during
- * servicing, so as not to reenable interrupts accidentally...
- */
- sc->sc_wrcsr = le_fwio_wrcsr_interrupt;
-
- rc = am7990_intr(v);
-
- sc->sc_wrcsr = le_fwio_wrcsr;
- /*
- * ...but we should not forget to reenable interrupts at this point!
- */
- le_fwio_wrcsr(sc, LE_CSR0, LE_C0_INEA | le_fwio_rdcsr(sc, LE_CSR0));
-
- return rc;
-}
-
-uint16_t
-le_fwio_rdcsr(struct lance_softc *sc, uint16_t port)
-{
- struct le_fwio_softc *lsc = (struct le_fwio_softc *)sc;
-
- *lsc->sc_rap = port;
- return *lsc->sc_rdp;
-}
-
-void
-le_fwio_wrcsr(struct lance_softc *sc, uint16_t port, uint16_t val)
-{
- struct le_fwio_softc *lsc = (struct le_fwio_softc *)sc;
-
- *lsc->sc_rap = port;
- *lsc->sc_rdp = val;
-}
-
-void
-le_fwio_wrcsr_interrupt(struct lance_softc *sc, uint16_t port, uint16_t val)
-{
- if (port == LE_CSR0)
- val &= ~LE_C0_INEA;
-
- le_fwio_wrcsr(sc, port, val);
-}
diff --git a/sys/arch/vax/mbus/legss.c b/sys/arch/vax/mbus/legss.c
deleted file mode 100644
index 833059c9f20..00000000000
--- a/sys/arch/vax/mbus/legss.c
+++ /dev/null
@@ -1,758 +0,0 @@
-/* $OpenBSD: legss.c,v 1.8 2014/12/23 21:39:12 miod Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * The wsdisplay emulops routines ({copy,erase}{cols,rows}, putchar, and
- * do_cursor) are adapted from the rasops routines found in rasops.c and
- * rasops32.c, under the following licence terms:
- *
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Andrew Doran.
- *
- * 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 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.
- */
-
-/*
- * LEGSS frame buffer
- *
- * This beast is different enough from a QDSS or a GPX to need a specific
- * driver. Unfortunately, it is not yet known how this hardware works.
- *
- * The frame buffer memory is accessible linearly in 32 bit words (one
- * per pixel, although apparently only 20 bits are writable).
- *
- * We currently drive the frame buffer as a monochrome, unaccelerated
- * display.
- *
- * Note that the hardware probe is made easier since graphics can only
- * exist in the last M-Bus slot, and the terminal information in the SSC
- * will tell us whether it is properly populated or not.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-
-#include <machine/cpu.h>
-#include <machine/cvax.h>
-#include <machine/sid.h>
-
-#include <vax/mbus/mbusreg.h>
-#include <vax/mbus/mbusvar.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <dev/cons.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-#include <dev/wsfont/wsfont.h>
-
-/* Graphics can only exist at mid 7 */
-#define MID_GRAPHICS 7
-#define LEGSS_BASE MBUS_SLOT_BASE(MID_GRAPHICS)
-
-#define LEGSS_VRAM_OFFSET 0x00800000
-
-#define LEGSS_VISWIDTH 1280
-#define LEGSS_WIDTH 2048
-#define LEGSS_VISHEIGHT 1024
-#define LEGSS_HEIGHT 2048
-
-int legss_match(struct device *, void *, void *);
-void legss_attach(struct device *, struct device *, void *);
-
-struct legss_screen {
- struct rasops_info ss_ri;
- int ss_console;
- u_int ss_depth;
- vaddr_t ss_vram;
-};
-
-/* for console */
-struct legss_screen legss_consscr;
-
-struct legss_softc {
- struct device sc_dev;
- struct legss_screen *sc_scr;
- int sc_nscreens;
-};
-
-struct cfattach legss_ca = {
- sizeof(struct legss_softc), legss_match, legss_attach,
-};
-
-struct cfdriver legss_cd = {
- NULL, "legss", DV_DULL
-};
-
-struct wsscreen_descr legss_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *_legss_scrlist[] = {
- &legss_stdscreen,
-};
-
-const struct wsscreen_list legss_screenlist = {
- sizeof(_legss_scrlist) / sizeof(struct wsscreen_descr *),
- _legss_scrlist,
-};
-
-int legss_ioctl(void *, u_long, caddr_t, int, struct proc *);
-paddr_t legss_mmap(void *, off_t, int);
-int legss_alloc_screen(void *, const struct wsscreen_descr *,
- void **, int *, int *, long *);
-void legss_free_screen(void *, void *);
-int legss_show_screen(void *, void *, int,
- void (*) (void *, int, int), void *);
-int legss_load_font(void *, void *, struct wsdisplay_font *);
-int legss_list_font(void *, struct wsdisplay_font *);
-
-const struct wsdisplay_accessops legss_accessops = {
- .ioctl = legss_ioctl,
- .mmap = legss_mmap,
- .alloc_screen = legss_alloc_screen,
- .free_screen = legss_free_screen,
- .show_screen = legss_show_screen,
- .load_font = legss_load_font,
- .list_font = legss_list_font
-};
-
-int legss_setup_screen(struct legss_screen *);
-void legss_clear_screen(struct legss_screen *);
-
-int legss_copycols(void *, int, int, int, int);
-int legss_copyrows(void *, int, int, int);
-int legss_do_cursor(struct rasops_info *);
-int legss_erasecols(void *, int, int, int, long);
-int legss_eraserows(void *, int, int, long);
-int legss_putchar(void *, int, int, u_int, long);
-
-u_int legss_probe_depth(vaddr_t);
-
-/*
- * Autoconf glue
- */
-
-int
-legss_match(struct device *parent, void *vcf, void *aux)
-{
- struct mbus_attach_args *maa = (struct mbus_attach_args *)aux;
-
- if (maa->maa_class == CLASS_GRAPHICS &&
- maa->maa_interface == INTERFACE_FBIC &&
- maa->maa_mid == MID_GRAPHICS)
- return 1;
-
- return 0;
-}
-
-void
-legss_attach(struct device *parent, struct device *self, void *aux)
-{
- struct legss_softc *sc = (struct legss_softc *)self;
- struct legss_screen *scr;
- struct wsemuldisplaydev_attach_args aa;
- int console;
- vaddr_t tmp;
- extern struct consdev wsdisplay_cons;
-
- console = (vax_confdata & 0x60) != 0 && cn_tab == &wsdisplay_cons;
- if (console) {
- scr = &legss_consscr;
- sc->sc_nscreens = 1;
- } else {
- scr = malloc(sizeof(struct legss_screen), M_DEVBUF, M_NOWAIT);
- if (scr == NULL) {
- printf(": can not allocate memory\n");
- return;
- }
-
- tmp = vax_map_physmem(LEGSS_BASE + LEGSS_VRAM_OFFSET, 1);
- if (tmp == 0L) {
- printf(": can not probe depth\n");
- goto bad1;
- }
- scr->ss_depth = legss_probe_depth(tmp);
- vax_unmap_physmem(tmp, 1);
-
- if (scr->ss_depth == 0) {
- printf(": unrecognized depth\n");
- goto bad1;
- }
-
- scr->ss_vram = vax_map_physmem(LEGSS_BASE + LEGSS_VRAM_OFFSET,
- (LEGSS_VISHEIGHT * LEGSS_WIDTH * 32 / NBBY) / VAX_NBPG);
- if (scr->ss_vram == 0L) {
- printf(": can not map frame buffer\n");
- goto bad1;
- }
-
- if (legss_setup_screen(scr) != 0) {
- printf(": initialization failed\n");
- goto bad2;
- }
- }
- sc->sc_scr = scr;
-
- printf(": %dx%d %d plane color framebuffer\n",
- LEGSS_VISWIDTH, LEGSS_VISHEIGHT, scr->ss_depth);
-
- aa.console = console;
- aa.scrdata = &legss_screenlist;
- aa.accessops = &legss_accessops;
- aa.accesscookie = sc;
- aa.defaultscreens = 0;
-
- config_found(self, &aa, wsemuldisplaydevprint);
-
- return;
-
-bad2:
- vax_unmap_physmem(scr->ss_vram,
- (LEGSS_VISHEIGHT * LEGSS_WIDTH * 32 / NBBY) / VAX_NBPG);
-bad1:
- free(scr, M_DEVBUF, sizeof(struct legss_screen));
-}
-
-/*
- * wsdisplay accessops
- */
-
-int
-legss_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- struct legss_softc *sc = v;
- struct legss_screen *ss = sc->sc_scr;
- struct wsdisplay_fbinfo *wdf;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_LEGSS;
- break;
-
- case WSDISPLAYIO_GINFO:
- wdf = (struct wsdisplay_fbinfo *)data;
- wdf->height = ss->ss_ri.ri_height;
- wdf->width = ss->ss_ri.ri_width;
- wdf->depth = ss->ss_depth;
- wdf->cmsize = 0;
- break;
-
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = LEGSS_WIDTH * 32 / NBBY;
-
- case WSDISPLAYIO_GETCMAP:
- case WSDISPLAYIO_PUTCMAP:
- break;
-
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- break;
-
- default:
- return -1;
- }
-
- return 0;
-}
-
-paddr_t
-legss_mmap(void *v, off_t offset, int prot)
-{
- /* Do not allow mmap yet because of the read-only upper 12 bits */
- return -1;
-}
-
-int
-legss_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
- int *curxp, int *curyp, long *defattrp)
-{
- struct legss_softc *sc = v;
- struct legss_screen *ss = sc->sc_scr;
- struct rasops_info *ri = &ss->ss_ri;
-
- if (sc->sc_nscreens > 0)
- return ENOMEM;
-
- *cookiep = ri;
- *curxp = *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, defattrp);
- sc->sc_nscreens++;
-
- return 0;
-}
-
-void
-legss_free_screen(void *v, void *cookie)
-{
- struct legss_softc *sc = v;
-
- sc->sc_nscreens--;
-}
-
-int
-legss_show_screen(void *v, void *cookie, int waitok,
- void (*cb)(void *, int, int), void *cbarg)
-{
- return 0;
-}
-
-int
-legss_load_font(void *v, void *emulcookie, struct wsdisplay_font *font)
-{
- struct legss_softc *sc = v;
- struct legss_screen *ss = sc->sc_scr;
- struct rasops_info *ri = &ss->ss_ri;
-
- return rasops_load_font(ri, emulcookie, font);
-}
-
-int
-legss_list_font(void *v, struct wsdisplay_font *font)
-{
- struct legss_softc *sc = v;
- struct legss_screen *ss = sc->sc_scr;
- struct rasops_info *ri = &ss->ss_ri;
-
- return rasops_list_font(ri, font);
-}
-
-int
-legss_setup_screen(struct legss_screen *ss)
-{
- struct rasops_info *ri = &ss->ss_ri;
-
- bzero(ri, sizeof(*ri));
- ri->ri_depth = 32; /* masquerade as a 32 bit device for rasops */
- ri->ri_width = LEGSS_VISWIDTH;
- ri->ri_height = LEGSS_VISHEIGHT;
- ri->ri_stride = LEGSS_WIDTH * 32 / NBBY;
- ri->ri_flg = RI_FORCEMONO | RI_CENTER; /* no RI_CLEAR ! */
- ri->ri_hw = ss;
- ri->ri_bits = (u_char *)ss->ss_vram;
-
- /*
- * Ask for an unholy big display, rasops will trim this to more
- * reasonable values.
- */
- if (rasops_init(ri, 160, 160) != 0)
- return -1;
-
- /*
- * Override the rasops emulops.
- */
- ri->ri_ops.copyrows = legss_copyrows;
- ri->ri_ops.copycols = legss_copycols;
- ri->ri_ops.eraserows = legss_eraserows;
- ri->ri_ops.erasecols = legss_erasecols;
- ri->ri_ops.putchar = legss_putchar;
- ri->ri_do_cursor = legss_do_cursor;
-
- legss_stdscreen.ncols = ri->ri_cols;
- legss_stdscreen.nrows = ri->ri_rows;
- legss_stdscreen.textops = &ri->ri_ops;
- legss_stdscreen.fontwidth = ri->ri_font->fontwidth;
- legss_stdscreen.fontheight = ri->ri_font->fontheight;
- legss_stdscreen.capabilities = ri->ri_caps;
-
- /*
- * Clear display.
- */
- legss_clear_screen(ss);
-
- return 0;
-}
-
-u_int
-legss_probe_depth(vaddr_t vram)
-{
- uint32_t probe;
-
- *(volatile uint32_t *)vram = 0;
- *(volatile uint32_t *)vram = 0xffffffff;
- probe = *(volatile uint32_t *)vram;
-
- /*
- * Need to mask the upper 12 bits, they don't seem to be connected
- * to anything and latch random bus data.
- */
- switch (probe & 0x000fffff) {
- case 0x000ff:
- return 8;
- default:
- return 0;
- }
-}
-
-/*
- * Console support code
- */
-
-int legsscnprobe(void);
-int legsscninit(void);
-
-int
-legsscnprobe()
-{
- extern vaddr_t virtual_avail;
- int depth;
-
- if (vax_boardtype != VAX_BTYP_60)
- return 0; /* move along, nothing there */
-
- /* no working graphics hardware, or forced serial console? */
- if ((vax_confdata & 0x60) == 0)
- return 0;
-
- /*
- * Check for a recognized color depth.
- */
-
- ioaccess(virtual_avail, LEGSS_BASE + LEGSS_VRAM_OFFSET, 1);
- depth = legss_probe_depth(virtual_avail);
- iounaccess(virtual_avail, 1);
-
- if (depth == 0)
- return 0; /* unsupported, default to serial */
-
- return 1;
-}
-
-/*
- * Called very early to setup the glass tty as console.
- * Because it's called before the VM system is initialized, virtual memory
- * for the framebuffer can be stolen directly without disturbing anything.
- */
-int
-legsscninit()
-{
- struct legss_screen *ss = &legss_consscr;
- extern vaddr_t virtual_avail;
- vaddr_t ova;
- long defattr;
- struct rasops_info *ri;
-
- ova = virtual_avail;
-
- ioaccess(virtual_avail, LEGSS_BASE + LEGSS_VRAM_OFFSET, 1);
- ss->ss_depth = legss_probe_depth(virtual_avail);
- iounaccess(virtual_avail, 1);
- if (ss->ss_depth == 0)
- return 1;
-
- ioaccess(virtual_avail, LEGSS_BASE + LEGSS_VRAM_OFFSET,
- (LEGSS_VISHEIGHT * LEGSS_WIDTH * 32 / NBBY) / VAX_NBPG);
- ss->ss_vram = virtual_avail;
- virtual_avail += (LEGSS_VISHEIGHT * LEGSS_WIDTH * 32 / NBBY);
- virtual_avail = round_page(virtual_avail);
-
- /* this had better not fail */
- if (legss_setup_screen(ss) != 0) {
- iounaccess(ss->ss_vram,
- (LEGSS_VISHEIGHT * LEGSS_WIDTH * 32 / NBBY) / VAX_NBPG);
- virtual_avail = ova;
- return 1;
- }
-
- ri = &ss->ss_ri;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
- wsdisplay_cnattach(&legss_stdscreen, ri, 0, 0, defattr);
-
- return 0;
-}
-
-/*
- * wsdisplay emulops
- */
-
-int
-legss_putchar(void *v, int row, int col, u_int uc, long attr)
-{
- struct rasops_info *ri = v;
- struct wsdisplay_font *font = ri->ri_font;
- int width, height, cnt, fs, fb, fg, bg, ul;
- int32_t *dp, *rp;
- u_char *fr;
-
- ri->ri_ops.unpack_attr(v, attr, &fg, &bg, &ul);
-
- rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
- height = font->fontheight;
- width = font->fontwidth;
-
- if (uc == ' ') {
- while (height--) {
- dp = rp;
- DELTA(rp, ri->ri_stride, int32_t *);
-
- for (cnt = width; cnt; cnt--) {
- *(int8_t *)dp = bg;
- dp++;
- }
- }
- } else {
- uc -= font->firstchar;
- fr = (u_char *)font->data + uc * ri->ri_fontscale;
- fs = font->stride;
-
- while (height--) {
- dp = rp;
- fb = fr[3] | (fr[2] << 8) | (fr[1] << 16) |
- (fr[0] << 24);
- fr += fs;
- DELTA(rp, ri->ri_stride, int32_t *);
-
- for (cnt = width; cnt; cnt--) {
- if ((fb >> 31) & 1)
- *(int8_t *)dp = fg;
- else
- *(int8_t *)dp = bg;
- dp++;
- fb <<= 1;
- }
- }
- }
-
- /* Do underline */
- if (ul) {
- DELTA(rp, -(ri->ri_stride << 1), int32_t *);
-
- while (width--) {
- *(int8_t *)rp = fg;
- rp++;
- }
- }
-
- return 0;
-}
-
-int
-legss_copycols(void *v, int row, int src, int dst, int num)
-{
- struct rasops_info *ri = v;
- struct wsdisplay_font *font = ri->ri_font;
- u_char *sp, *dp;
- int height, cnt, delta;
-
- num *= font->fontwidth;
- row *= ri->ri_yscale;
- height = font->fontheight;
-
- sp = ri->ri_bits + row + src * ri->ri_xscale;
- dp = ri->ri_bits + row + dst * ri->ri_xscale;
-
- if (dst <= src) {
- /* non overlapping copy */
- delta = ri->ri_stride - (num << 2);
- while (height--) {
- for (cnt = num; cnt != 0; cnt--) {
- *dp = *sp;
- sp += 1 << 2;
- dp += 1 << 2;
- }
- dp += delta;
- sp += delta;
- }
- } else {
- /* possibly overlapping copy */
- delta = num << 2;
- while (height--) {
- dp += delta;
- sp += delta;
- for (cnt = num; cnt != 0; cnt--) {
- dp -= 1 << 2;
- sp -= 1 << 2;
- *dp = *sp;
- }
- dp += ri->ri_stride;
- sp += ri->ri_stride;
- }
- }
-
- return 0;
-}
-
-int
-legss_erasecols(void *v, int row, int col, int num, long attr)
-{
- struct rasops_info *ri = v;
- struct wsdisplay_font *font = ri->ri_font;
- int height, cnt, fg, bg;
- int32_t *rp, *dp;
-
- ri->ri_ops.unpack_attr(v, attr, &fg, &bg, NULL);
- rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
- height = font->fontheight;
- num *= font->fontwidth;
-
- while (height--) {
- dp = rp;
- DELTA(rp, ri->ri_stride, int32_t *);
-
- for (cnt = num; cnt; cnt--) {
- *(int8_t *)dp = bg;
- dp++;
- }
- }
-
- return 0;
-}
-
-int
-legss_copyrows(void *v, int src, int dst, int num)
-{
- struct rasops_info *ri = v;
- struct wsdisplay_font *font = ri->ri_font;
- int32_t *srp, *drp;
- int8_t *sp, *dp;
- int n, cnt, delta;
-
- num *= font->fontheight;
- n = ri->ri_emustride >> 2;
-
- if (dst < src) {
- srp = (int32_t *)(ri->ri_bits + src * ri->ri_yscale);
- drp = (int32_t *)(ri->ri_bits + dst * ri->ri_yscale);
- delta = ri->ri_stride;
- } else {
- src = font->fontheight * src + num - 1;
- dst = font->fontheight * dst + num - 1;
- srp = (int32_t *)(ri->ri_bits + src * ri->ri_stride);
- drp = (int32_t *)(ri->ri_bits + dst * ri->ri_stride);
- delta = -ri->ri_stride;
- }
-
- while (num--) {
- dp = (int8_t *)drp;
- sp = (int8_t *)srp;
- DELTA(drp, delta, int32_t *);
- DELTA(srp, delta, int32_t *);
-
- for (cnt = n; cnt; cnt--) {
- *dp = *sp;
- dp += 1 << 2;
- sp += 1 << 2;
- }
- }
-
- return 0;
-}
-
-int
-legss_eraserows(void *v, int row, int num, long attr)
-{
- struct rasops_info *ri = v;
- struct wsdisplay_font *font = ri->ri_font;
- int n, cnt, delta, fg, bg;
- int32_t *dp;
-
- ri->ri_ops.unpack_attr(v, attr, &fg, &bg, NULL);
- n = ri->ri_emustride >> 2;
- num *= font->fontheight;
- dp = (int32_t *)(ri->ri_bits + row * ri->ri_yscale);
- delta = ri->ri_delta;
-
- while (num--) {
- for (cnt = n; cnt; cnt--) {
- *(int8_t *)dp = bg;
- DELTA(dp, 4, int32_t *);
- }
-
- DELTA(dp, delta, int32_t *);
- }
-
- return 0;
-}
-
-int
-legss_do_cursor(struct rasops_info *ri)
-{
- struct wsdisplay_font *font = ri->ri_font;
- int height, cnt, row, col;
- u_char *dp, *rp;
-
- row = ri->ri_crow;
- col = ri->ri_ccol;
-
- rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
- height = font->fontheight;
-
- while (height--) {
- dp = rp;
- rp += ri->ri_stride;
-
- for (cnt = font->fontwidth; cnt; cnt--) {
- *(int8_t *)dp ^= ~0;
- dp += 4;
- }
- }
-
- return 0;
-}
-
-/* Clear the whole screen */
-void
-legss_clear_screen(struct legss_screen *ss)
-{
- struct rasops_info *ri = &ss->ss_ri;
- int n, cnt, num, delta;
- int32_t *dp, clr;
-
- n = ri->ri_stride >> 2;
- num = ri->ri_height;
- dp = (int32_t *)ri->ri_origbits;
- delta = 0;
- clr = ri->ri_devcmap[0];
-
- while (num--) {
- for (cnt = n; cnt; cnt--) {
- *(int8_t *)dp = clr;
- DELTA(dp, 4, int32_t *);
- }
-
- DELTA(dp, delta, int32_t *);
- }
-}
diff --git a/sys/arch/vax/mbus/mbus.c b/sys/arch/vax/mbus/mbus.c
deleted file mode 100644
index 7663aab4235..00000000000
--- a/sys/arch/vax/mbus/mbus.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/* $OpenBSD: mbus.c,v 1.4 2011/04/07 15:30:16 miod Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-#include <machine/nexus.h>
-#include <machine/scb.h>
-
-#include <vax/mbus/mbusreg.h>
-#include <vax/mbus/mbusvar.h>
-
-#define PR_CPUID 14
-
-/*
- * FBIC interrupt handlers
- */
-struct fbic_irq {
- int (*fi_fn)(void *);
- void *fi_arg;
- struct evcount fi_cnt;
- int fi_ipl;
-};
-
-/*
- * Generic information for each slot.
- *
- * This information is maintained at the mbus level, rather than
- * enforcing each child driver to provide it. This allows proper
- * M-bus configuration on slots where no driver attaches.
- */
-
-struct fbic {
- paddr_t base;
- vaddr_t regs;
- int vecbase;
- struct fbic_irq *firq[FBIC_DEVIRQMAX];
-};
-
-struct mbus_slot {
- uint8_t ms_interface; /* MODTYPE interface */
- uint8_t ms_class; /* MODTYPE class */
-
- unsigned int ms_nfbic;
- struct fbic ms_fbic[2];
-};
-
-struct mbus_softc {
- struct device sc_dev;
- struct mbus_slot *sc_slots[MBUS_SLOT_MAX];
-};
-
-void mbus_attach(struct device *, struct device *, void *);
-int mbus_match(struct device *, void *, void *);
-
-struct cfdriver mbus_cd = {
- NULL, "mbus", DV_DULL
-};
-
-const struct cfattach mbus_ca = {
- sizeof(struct mbus_softc), mbus_match, mbus_attach
-};
-
-void mbus_initialize_cpu(struct mbus_slot *, unsigned int, int);
-void mbus_initialize_device(struct mbus_slot *, unsigned int, uint8_t);
-void mbus_intr_dispatch(void *);
-int mbus_print(void *, const char *);
-int mbus_submatch(struct device *, void *, void *);
-
-unsigned int mbus_ioslot = (unsigned int)-1;
-
-int
-mbus_match(struct device *parent, void *vcf, void *aux)
-{
- struct mainbus_attach_args *maa = (struct mainbus_attach_args *)aux;
-
- return maa->maa_bustype == VAX_MBUS ? 1 : 0;
-}
-
-void
-mbus_attach(struct device *parent, struct device *self, void *aux)
-{
- struct mbus_softc *sc = (struct mbus_softc *)self;
- struct mbus_slot *ms;
- unsigned int mid;
- struct mbus_attach_args maa;
- paddr_t pa;
- vaddr_t fbic;
- uint32_t modtype;
- uint8_t class, interface;
-
- printf("\n");
-
- /*
- * Walk the bus and probe slots.
- * We will also record information about all occupied slots,
- * and keep a permanent mapping of their FBIC, as we will end
- * up needing to play with them often...
- */
-
- for (mid = 0; mid < MBUS_SLOT_MAX; mid++) {
-
- /*
- * Map main (and often, only) FBIC.
- */
-
- pa = MBUS_SLOT_BASE(mid);
- fbic = vax_map_physmem(pa + FBIC_BASE, 1);
- if (fbic == 0)
- panic("unable to map slot %d registers", mid);
-
- if (badaddr((caddr_t)(fbic + FBIC_MODTYPE), 4) != 0)
- modtype = 0;
- else
- modtype = *(uint32_t *)(fbic + FBIC_MODTYPE);
-
- if (modtype == 0 || modtype == 0xffffffff) {
- vax_unmap_physmem(fbic, 1);
- continue;
- }
-
- /*
- * The slot is populated. Write things down.
- */
-
- ms = (struct mbus_slot *)malloc(sizeof(*ms),
- M_DEVBUF, M_NOWAIT | M_ZERO);
- if (ms == NULL)
- panic("not enough memory to probe M-bus");
-
- sc->sc_slots[mid] = ms;
- ms->ms_nfbic = 1; /* only one so far! */
- ms->ms_fbic[0].base = pa + FBIC_BASE;
- ms->ms_fbic[0].regs = fbic;
-
- class = (modtype & MODTYPE_CLASS_MASK) >> MODTYPE_CLASS_SHIFT;
- interface = (modtype & MODTYPE_INTERFACE_MASK) >>
- MODTYPE_INTERFACE_SHIFT;
-
- ms->ms_interface = interface;
- ms->ms_class = class;
-
- /*
- * If there are two FBICs on this board, map the second one.
- */
-
- if (class == CLASS_CPU) {
- /* the FBIC we mapped is in fact the second one... */
- ms->ms_fbic[1].base = ms->ms_fbic[0].base;
- ms->ms_fbic[1].regs = ms->ms_fbic[0].regs;
- ms->ms_nfbic = 2;
- fbic = vax_map_physmem(pa + FBIC_CPUA_BASE, 1);
- if (fbic == 0)
- panic("unable to map slot %d registers", mid);
- ms->ms_fbic[0].base = pa + FBIC_CPUA_BASE;
- ms->ms_fbic[0].regs = fbic;
- }
-
- /*
- * Perform a minimal sane initialization.
- */
-
- if (class == CLASS_CPU) {
- mbus_initialize_cpu(ms, mid, 0);
- mbus_initialize_cpu(ms, mid, 1);
- } else
- mbus_initialize_device(ms, mid, interface);
-
- /*
- * Attach subdevices if possible.
- */
-
- maa.maa_mid = mid;
- maa.maa_class = class;
- maa.maa_subclass = (modtype & MODTYPE_SUBCLASS_MASK) >>
- MODTYPE_SUBCLASS_SHIFT;
- maa.maa_interface = interface;
- maa.maa_revision = (modtype & MODTYPE_REVISION_MASK) >>
- MODTYPE_REVISION_SHIFT;
- maa.maa_addr = pa;
- maa.maa_vecbase = ms->ms_fbic[0].vecbase;
-
- (void)config_found_sm(self, &maa, mbus_print, mbus_submatch);
- }
-}
-
-int
-mbus_print(void *aux, const char *pnp)
-{
- struct mbus_attach_args *maa = (struct mbus_attach_args *)aux;
- int rc = UNCONF;
- const char *descr;
-
- switch (maa->maa_class) {
- case CLASS_BA:
- descr = "Bus Adaptor";
- break;
- case CLASS_GRAPHICS:
- descr = "Graphics";
- break;
- case CLASS_IO:
- descr = "I/O Module";
- break;
- case CLASS_CPU:
- descr = "cpu";
- break;
- case CLASS_MEMORY:
- descr = maa->maa_interface == INTERFACE_FMDC ?
- "ECC memory" : "Memory";
- break;
- default:
- descr = NULL;
- rc = UNSUPP;
- break;
- }
-
- if (maa->maa_interface != INTERFACE_FBIC) {
- if (maa->maa_class != CLASS_MEMORY ||
- (maa->maa_interface != INTERFACE_FMCM &&
- maa->maa_interface != INTERFACE_FMDC))
- rc = UNSUPP;
- }
-
- if (pnp != NULL) {
- if (rc == UNSUPP) {
- printf("logic board class %02x:%02x interface %u.%u ",
- maa->maa_class, maa->maa_subclass,
- maa->maa_interface, maa->maa_revision);
- if (descr != NULL)
- printf("(%s)", descr);
- } else
- printf("%s", descr);
- printf(" at %s", pnp);
- }
- printf(" mid %u", maa->maa_mid);
-
- return (rc);
-}
-
-int
-mbus_submatch(struct device *parent, void *vcf, void *aux)
-{
- struct mbus_attach_args *maa = (struct mbus_attach_args *)aux;
- struct cfdata *cf = (struct cfdata *)vcf;
-
- /*
- * If attachment specifies the mid, it has to match.
- */
- if (cf->cf_loc[0] != -1 && cf->cf_loc[0] != maa->maa_mid)
- return 0;
-
- return (*cf->cf_attach->ca_match)(parent, vcf, aux);
-}
-
-/*
- * CPU board initialization.
- */
-
-void
-mbus_initialize_cpu(struct mbus_slot *ms, unsigned int mid, int cpu)
-{
- struct fbic *fbic = &ms->ms_fbic[cpu];
- uint32_t fbicsr;
- int cpuid;
-
- cpuid = (mid << CPUID_MID_SHIFT) |
- (cpu != 0 ? CPUID_PROC_1 : CPUID_PROC_0);
-
- /*
- * Clear error log
- */
- *(uint32_t *)(fbic->regs + FBIC_BUSCSR) = BUSCSR_RESET;
-
- /*
- * Set (IPI) interrupt vectors base, but do not enable them yet.
- */
- fbic->vecbase = MBUS_VECTOR_BASE(mid, cpu);
- *(uint32_t *)(fbic->regs + FBIC_IPDVINT) = 0 /* IPDVINT_IPUNIT */ |
- (fbic->vecbase & IPDVINT_VECTOR_MASK);
-
- /*
- * Enable all interrupt sources if on the boot processor,
- * disable them otherwise (this does not affect IPIs).
- */
- fbicsr = *(uint32_t *)(fbic->regs + FBIC_BUSCSR);
- if (cpuid == mfpr(PR_CPUID))
- fbicsr |= FBICSR_IRQEN_MASK;
- else
- fbicsr &= ~FBICSR_IRQEN_MASK;
-
- /*
- * Route interrupts from the M-bus to the CVAX.
- */
- fbicsr &= ~FBICSR_IRQC2M_MASK;
-
- /*
- * Allow the CPU to be halted.
- */
- fbicsr |= FBICSR_HALTEN;
-
- *(uint32_t *)(fbic->regs + FBIC_BUSCSR) = fbicsr;
-}
-
-/*
- * Device board initialization.
- */
-
-void
-mbus_initialize_device(struct mbus_slot *ms, unsigned int mid,
- uint8_t interface)
-{
- struct fbic *fbic = ms->ms_fbic;
- uint32_t fbicsr;
-
- /*
- * Clear error log if applicable
- */
- if (interface == INTERFACE_FBIC || interface == INTERFACE_FMDC)
- *(uint32_t *)(fbic->regs + FBIC_BUSCSR) = BUSCSR_RESET;
-
- if (interface == INTERFACE_FBIC) {
- /*
- * Set interrupt vector base.
- */
- fbic->vecbase = MBUS_VECTOR_BASE(mid, 0);
- *(uint32_t *)(fbic->regs + FBIC_IPDVINT) = IPDVINT_DEVICE |
- (fbic->vecbase & IPDVINT_VECTOR_MASK);
-
- /*
- * Disable all interrupt sources, and route them
- * from the devices to the M-bus.
- */
- fbicsr = *(uint32_t *)(fbic->regs + FBIC_BUSCSR);
- fbicsr &= ~FBICSR_IRQEN_MASK;
- fbicsr |= FBICSR_IRQC2M_MASK;
- *(uint32_t *)(fbic->regs + FBIC_BUSCSR) = fbicsr;
- }
-}
-
-/*
- * Interrupt handling.
- */
-
-int
-mbus_intr_establish(unsigned int vec, int ipl, int (*fn)(void *), void *arg,
- const char *name)
-{
- struct mbus_softc *sc;
- struct mbus_slot *ms;
- struct fbic *fbic;
- struct fbic_irq *fi;
- uint32_t fbicsr;
- unsigned int mid, fbicirq;
-
- mid = MBUS_VECTOR_TO_MID(vec);
-
-#ifdef DIAGNOSTIC
- if (mid >= MBUS_SLOT_MAX)
- return EINVAL;
- if (mbus_cd.cd_ndevs == 0)
- return ENXIO;
-#endif
- sc = (struct mbus_softc *)mbus_cd.cd_devs[0];
-#ifdef DIAGNOSTIC
- if (sc == NULL)
- return ENXIO;
-#endif
- ms = sc->sc_slots[mid];
-#ifdef DIAGNOSTIC
- if (ms == NULL)
- return ENXIO;
-#endif
- fi = (struct fbic_irq *)malloc(sizeof *fi, M_DEVBUF, M_NOWAIT);
- if (fi == NULL)
- return ENOMEM;
-
- /*
- * This interface is intended to be used for device interrupts
- * only, so there is no need to handle dual-FBIC slots.
- */
- fbic = &ms->ms_fbic[0 /* MBUS_VECTOR_TO_FBIC(vec) */];
-
- fi->fi_fn = fn;
- fi->fi_arg = arg;
- fi->fi_ipl = ipl;
- evcount_attach(&fi->fi_cnt, name, &fi->fi_ipl);
-
- fbicirq = MBUS_VECTOR_TO_IRQ(vec);
- fbic->firq[fbicirq] = fi;
- scb_vecalloc(vec, mbus_intr_dispatch, fi, SCB_ISTACK, &fi->fi_cnt);
-
- /*
- * Enable device interrupt in the module FBIC. Proper direction
- * has been setup in mbus_slot_initialize().
- */
-
- fbicsr = *(uint32_t *)(fbic->regs + FBIC_BUSCSR);
- fbicsr |= fbicirq << FBICSR_IRQEN_SHIFT;
- *(uint32_t *)(fbic + FBIC_BUSCSR) = fbicsr;
-
- return 0;
-}
-
-/*
- * Interrupt dispatcher.
- */
-
-void
-mbus_intr_dispatch(void *v)
-{
- struct fbic_irq *fi = (struct fbic_irq *)v;
- int s;
-
- /*
- * FBIC interrupts are at fixed levels. In case the level is
- * below the level the driver expects the interrupt at, we need
- * to raise spl to be safe (e.g. for sii).
- */
- s = _splraise(fi->fi_ipl);
- (void)(*fi->fi_fn)(fi->fi_arg);
- splx(s);
-}
diff --git a/sys/arch/vax/mbus/mbusreg.h b/sys/arch/vax/mbus/mbusreg.h
deleted file mode 100644
index cea06e6041e..00000000000
--- a/sys/arch/vax/mbus/mbusreg.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/* $OpenBSD: mbusreg.h,v 1.1 2008/08/18 23:19:25 miod Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * M-bus
- *
- * The M-bus connects up to 8 slots, of 32MB memory space each.
- *
- * All these modules contain a ``Firefox Bus Interface Chip'' (FBIC),
- * which provides common registers at the end of each slot address space,
- * allowing modules to recognize and configure each other.
- */
-
-#define MBUS_SLOT_MAX 8
-
-/*
- * Addressing
- *
- * The M-bus provides a 32-bit address space.
- *
- * The low half (bit 31 clear) is the physical memory space (and being on
- * vax, really stops at 512MB).
- * The high half is the I/O space, where each slot has a 32MB window.
- * In addition to its window, there are two 128MB areas, allowing a given
- * module to provide functionnality regardless of its actual position on
- * the bus.
- *
- * From the host CPU, the M-bus I/O space is remapped in the vax I/O space.
- *
- * The address map is thus:
- * M-bus address CPU address Length
- * 0000.0000 0000.0000 2000.0000 memory space
- * 8000.0000 2000.0000 0800.0000 global I/O
- * 8800.0000 2800.0000 0800.0000 local I/O
- * 9000.0000 3000.0000 0200.0000 slot 0 I/O
- * 9200.0000 3200.0000 0200.0000 slot 1 I/O
- * 9400.0000 3400.0000 0200.0000 slot 2 I/O
- * 9600.0000 3600.0000 0200.0000 slot 3 I/O
- * 9800.0000 3800.0000 0200.0000 slot 4 I/O
- * 9a00.0000 3a00.0000 0200.0000 slot 5 I/O
- * 9c00.0000 3c00.0000 0200.0000 slot 6 I/O
- * 9e00.0000 3e00.0000 0200.0000 slot 7 I/O
- */
-
-/* base address of a slot, as seen from the cpu */
-#define MBUS_SLOT_BASE(s) (0x30000000 + ((s) << 25))
-
-/* convert I/O space addresses (assumed to be in their correct range) */
-#define HOST_TO_MBUS(pa) ((pa) ^ 0xa0000000)
-#define MBUS_TO_HOST(pa) ((pa) ^ 0xa0000000)
-
-/*
- * Common FBIC slot registers
- */
-
-/* FBIC or compatible registers occupy the last page (running down)... */
-#define FBIC_BASE 0x1fffe00
-/* ...but dual-CPU modules have two of them. */
-#define FBIC_CPUA_BASE 0x0fffe00
-#define FBIC_CPUB_BASE 0x1fffe00
-
-/* module identification */
-#define FBIC_MODTYPE 0x1fc
-/* M-bus error status */
-#define FBIC_BUSCSR 0x1f8
-/* M-bus error control signal log */
-#define FBIC_BUSCTL 0x1f4
-/* M-bus error address signal log */
-#define FBIC_BUSADR 0x1f0
-/* M-bus error data signal log */
-#define FBIC_BUSDAT 0x1ec
-/* FBIC control and status */
-#define FBIC_CSR 0x1e8
-/* I/O space range decode */
-#define FBIC_RANGE 0x1e4
-/* Interprocessor and device interrupt */
-#define FBIC_IPDVINT 0x1e0
-/* Unique software ID */
-#define FBIC_WHAMI 0x1dc
-/* Unique hardware ID */
-#define FBIC_CPUID 0x1d8
-/* Interlock 1 address */
-#define FBIC_IADR1 0x1d4
-/* Interlock 2 address */
-#define FBIC_IADR2 0x1d0
-/* Console scratch register */
-#define FBIC_SAVGPR 0x1c4
-
-/*
- * Module identification
- */
-#define MODTYPE_CLASS_MASK 0x000000ff
-#define MODTYPE_CLASS_SHIFT 0
-#define CLASS_BA 0x01
-#define CLASS_GRAPHICS 0x02
-#define CLASS_IO 0x04
-#define CLASS_CPU 0x08
-#define CLASS_MEMORY 0x10
-#define MODTYPE_SUBCLASS_MASK 0x0000ff00
-#define MODTYPE_SUBCLASS_SHIFT 8
-#define MODTYPE_INTERFACE_MASK 0x00ff0000
-#define MODTYPE_INTERFACE_SHIFT 16
-#define INTERFACE_FBIC 0x01
-#define INTERFACE_FMDC 0x02 /* ECC memory */
-#define INTERFACE_FMCM 0xfe /* 8MB board */
-#define MODTYPE_REVISION_MASK 0xff000000
-#define MODTYPE_REVISION_SHIFT 24
-
-/*
- * M-bus error status and error logging
- * Conditions are active low
- */
-#define BUSCSR_FRZN 0x80000000 /* logging frozen */
-#define BUSCSR_ARB 0x40000000 /* arbitration error */
-#define BUSCSR_ICMD 0x20000000 /* invalid MCMD encoding */
-#define BUSCSR_IDAT 0x10000000 /* invalid data supplied */
-#define BUSCSR_MTPE 0x08000000 /* tag parity error */
-#define BUSCSR_MDPE 0x04000000 /* MDAL parity error */
-#define BUSCSR_MSPE 0x02000000 /* MSTATUS parity error */
-#define BUSCSR_MCPE 0x01000000 /* MCMD parity error */
-#define BUSCSR_ILCK 0x00800000 /* interlock violation */
-#define BUSCSR_MTO 0x00400000 /* slave timeout */
-#define BUSCSR_NOS 0x00200000 /* no slave response */
-#define BUSCSR_CTO 0x00100000 /* CDAL data cycle timeout */
-#define BUSCSR_CDPE 0x00080000 /* CDAL parity error */
-#define BUSCSR_CTPE 0x00040000 /* CDAL tag parity error */
-#define BUSCSR_SERR 0x00020000 /* error on MSTATUS */
-#define BUSCSR_DBLE 0x00010000 /* double M-bus error */
-
-#define BUSCSR_RESET 0xffff0000 /* reset all conditions */
-
-/*
- * FBIC control and status
- */
-#define FBICSR_MFMD_MASK 0xc0000000 /* manufacturing mode */
-#define FBICSR_CMISS 0x08000000 /* CVAX cache miss */
-#define FBICSR_EXCAEN 0x04000000 /* external cache enable */
-#define FBICSR_HALTCPU 0x02000000 /* CVAX halt */
-#define FBICSR_RESET 0x01000000 /* CVAX reset */
-#define FBICSR_IRQEN_MASK 0x00f00000 /* interrupt enables */
-#define FBICSR_IRQEN_SHIFT 20
-#define FBIC_DEVIRQ0 0
-#define FBIC_DEVIRQ1 1
-#define FBIC_DEVIRQ2 2
-#define FBIC_DEVIRQ3 3
-#define FBIC_DEVIRQMAX 4
-#define FBICSR_IRQC2M_MASK 0x000f0000 /* interrupt direction */
-#define FBICSR_IRQC2M_SHIFT 16
-#define FBICSR_LEDS_MASK 0x00003f00 /* module leds, active low */
-#define FBICSR_LEDS_SHIFT 8
-#define FBICSR_HALTEN 0x00000080 /* halt enable */
-#define FBICSR_TSTFNC_MASK 0x0000007e /* test function */
-#define FBICSR_TSTFNC_SHIFT 1
-#define TSTFNC_NORMAL_MODE 0x1f /* normal operation */
-#define FBICSR_CDPE 0x00000001 /* CVAX parity enable */
-
-/*
- * I/O Range
- *
- * This programs an M-bus address range which in the global I/O space, which
- * is answered by this module. Note that the upper bit in the match field
- * must be set, for the address to be in the I/O space; this is why the
- * upper bit of the mask field acts as an enable.
- */
-#define RANGE_MATCH 0xffff0000 /* address bits 31:16 */
-#define RANGE_ENABLE 0x00008000 /* mask address bit 31 */
-#define RANGE_MASK 0x00007fff /* address bits 30:16 */
-
-/*
- * Interprocessor and device interrupts
- */
-#define IPDVINT_IPL17 0x08000000 /* trigger IRQ3 */
-#define IPDVINT_IPL16 0x04000000 /* trigger IRQ2 */
-#define IPDVINT_IPL15 0x02000000 /* trigger IRQ1 */
-#define IPDVINT_IPL14 0x01000000 /* trigger IRQ0 */
-#define IPDVINT_IPUNIT 0x00020000 /* interrupts CPU */
-#define IPDVINT_DEVICE 0x00010000 /* interrupts M-bus */
-#define IPDVINT_VECTOR_MASK 0x0000fff0 /* interrupt vector */
-#define IPDVINT_VECTOR_SHIFT 4
-#define IPDVINT_IPL_MASK 0x0000000c /* interrupt ipl */
-#define IPDVINT_IPL_SHIFT 2
-
-/*
- * CPUID (also EPR 14)
- */
-#define CPUID_MID_MASK 0x0000001c /* slot mid */
-#define CPUID_MID_SHIFT 2
-#define CPUID_PROC_MASK 0x00000003 /* slot processor id */
-#define CPUID_PROC_SHIFT 0
-#define CPUID_PROC_0 0x00
-#define CPUID_PROC_1 0x03
-
-/*
- * FMCM registers (not FBIC compatible except for MODTYPE and BUSCSR)
- */
-
-/* module identification */
-#define FMCM_MODTYPE 0x1fc
-/* M-bus error status */
-/* NOTE: only implements FRZN, ICMD, MDPE, MSPE and MCPE */
-#define FMCM_BUSCSR 0x1f8
-/* FMCM control and status register */
-#define FMCM_FMDCSR 0x1f4
-/* Memory space base address register */
-#define FMCM_BASEADDR 0x1f0
-
-#define FMDCSR_ISOLATE 0x00008000 /* no MABORT on error */
-#define FMDCSR_DIAGNOSTIC_REFRESH_START 0x00004000
-#define FMDCSR_REFRESH_PERIOD_SELECT 0x00002000 /* set: slow (80ns) */
-#define FMDCSR_DISABLE_REFRESH 0x00001000
-
-#define BASEADDR_STARTADDR_MASK 0x7ff00000
-#define BASEADDR_MEMORY_SPACE_ENABLE 0x80000000
-
-/*
- * Interrupt vector assignments
- *
- * Since each FBIC controls four interrupts, and passes the IPI in bits
- * 3:2 of the vector number, we have to reserve them on 0x10 boundaries.
- *
- * Note that this is different from the usual scheme of using bits 5:4
- * for this purpose.
- *
- * CPU boards also use the IPDVINT to have an extra 0x10 range for IPIs.
- *
- * To make things simpler, we use a static assignment where the number is
- * computed from the mid and fbic number (for cpu boards).
- *
- * This means the 0x100..0x1fc range is used for M-bus interrupts only.
- * Q-bus interrupts will use the usual 0x200..0x3fc range.
- */
-
-#define MBUS_VECTOR_BASE(mid,fbic) (0x100 + (mid) * 0x20 + (fbic) * 0x10)
-#define MBUS_VECTOR_TO_MID(vec) (((vec) - 0x100) >> 5)
-#define MBUS_VECTOR_TO_FBIC(vec) (((vec) & 0x10) >> 4)
-#define MBUS_VECTOR_TO_IRQ(vec) (((vec) & 0xc) >> 2)
diff --git a/sys/arch/vax/mbus/mbusvar.h b/sys/arch/vax/mbus/mbusvar.h
deleted file mode 100644
index d48fdda3002..00000000000
--- a/sys/arch/vax/mbus/mbusvar.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* $OpenBSD: mbusvar.h,v 1.1 2008/08/18 23:19:25 miod Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-struct mbus_attach_args {
- unsigned int maa_mid;
- uint8_t maa_class;
- uint8_t maa_subclass;
- uint8_t maa_interface;
- uint8_t maa_revision;
- paddr_t maa_addr;
- unsigned int maa_vecbase;
-};
-
-extern unsigned int mbus_ioslot;
-
-int mbus_intr_establish(unsigned int, int, int (*)(void *), void *,
- const char *);
-uint32_t mbus_ddb_hook(int, uint32_t);
diff --git a/sys/arch/vax/mbus/sii_fwio.c b/sys/arch/vax/mbus/sii_fwio.c
deleted file mode 100644
index d961f3d10ca..00000000000
--- a/sys/arch/vax/mbus/sii_fwio.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* $OpenBSD: sii_fwio.c,v 1.2 2008/08/23 12:40:22 miod Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-#include <machine/cvax.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <vax/mbus/mbusreg.h>
-#include <vax/mbus/mbusvar.h>
-#include <vax/mbus/fwioreg.h>
-#include <vax/mbus/fwiovar.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <scsi/scsi_message.h>
-
-#include <vax/dec/siireg.h>
-#include <vax/dec/siivar.h>
-
-struct sii_fwio_softc {
- struct sii_softc sc_dev;
- u_char *sc_buf;
-};
-
-int sii_fwio_match(struct device *, void *, void *);
-void sii_fwio_attach(struct device *, struct device *, void *);
-
-struct cfattach sii_fwio_ca = {
- sizeof(struct sii_fwio_softc), sii_fwio_match, sii_fwio_attach
-};
-
-extern struct cfdriver sii_cd;
-
-void sii_fwio_copyfrombuf(void *, u_int, u_char *, int);
-void sii_fwio_copytobuf(void *, u_char *, u_int, int);
-int sii_fwio_intr(void *);
-
-int
-sii_fwio_match(struct device *parent, void *vcf, void *aux)
-{
- struct fwio_attach_args *faa = (struct fwio_attach_args *)aux;
-
- return strcmp(faa->faa_dev, sii_cd.cd_name) == 0 ? 1 : 0;
-}
-
-void
-sii_fwio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct fwio_attach_args *faa = (struct fwio_attach_args *)aux;
- struct sii_fwio_softc *sfc = (struct sii_fwio_softc *)self;
- struct sii_softc *sc = &sfc->sc_dev;
- unsigned int vec;
-
- vec = faa->faa_vecbase + FBIC_DEVIRQ0 * 4;
- printf(" vec %d", vec);
-
- /*
- * Map registers.
- */
-
- sc->sc_regs =
- (SIIRegs *)vax_map_physmem(faa->faa_base + FWIO_SII_REG_OFFSET, 1);
-
- /*
- * Map buffers.
- */
-
- sfc->sc_buf = (u_char *)uvm_km_valloc(kernel_map, FWIO_SII_BUF_SIZE);
- if (sfc->sc_buf == NULL) {
- vax_unmap_physmem(faa->faa_base + FWIO_SII_REG_OFFSET, 1);
- printf(": can't map buffers\n");
- return;
- }
-
- ioaccess((vaddr_t)sfc->sc_buf, faa->faa_base + FWIO_SII_BUF_OFFSET,
- FWIO_SII_BUF_SIZE >> VAX_PGSHIFT);
-
- sc->sii_copytobuf = sii_fwio_copytobuf;
- sc->sii_copyfrombuf = sii_fwio_copyfrombuf;
-
- /*
- * Register interrupt handler.
- */
-
- if (mbus_intr_establish(vec, IPL_BIO, sii_fwio_intr, sfc,
- self->dv_xname) != 0) {
- vax_unmap_physmem(faa->faa_base + FWIO_SII_REG_OFFSET, 1);
- uvm_km_free(kernel_map, (vaddr_t)sfc->sc_buf,
- FWIO_SII_BUF_SIZE);
- printf(": can't establish interrupt\n");
- return;
- }
-
- /*
- * Complete attachment.
- */
- sc->sc_hostid = *(uint8_t *)((vaddr_t)cvax_ssc_ptr + 0x4c0) & 07;
- sii_attach(sc);
-}
-
-int
-sii_fwio_intr(void *v)
-{
- struct sii_softc *sc = (struct sii_softc *)v;
- int rc;
- uint16_t csr;
-
- /*
- * FBIC expects edge interrupts, while the sii does level
- * interrupts. To avoid missing interrupts while servicing,
- * we disable further device interrupts while servicing.
- */
- csr = sc->sc_regs->csr;
- sc->sc_regs->csr = csr & ~SII_IE;
-
- rc = sii_intr(v);
-
- sc->sc_regs->csr = csr;
-
- return rc;
-}
-
-/*
- * Copy data between the fixed SCSI buffers. The sii driver only ``knows''
- * offsets inside the SCSI buffer.
- */
-
-void
-sii_fwio_copyfrombuf(void *v, u_int offs, u_char *dst, int len)
-{
- struct sii_fwio_softc *sc = (struct sii_fwio_softc *)v;
- u_char *src = sc->sc_buf + offs;
-
- memcpy(dst, src, len);
-}
-
-void
-sii_fwio_copytobuf(void *v, u_char *src, u_int offs, int len)
-{
- struct sii_fwio_softc *sc = (struct sii_fwio_softc *)v;
- u_char *dst = sc->sc_buf + offs;
-
- memcpy(dst, src, len);
-}
diff --git a/sys/arch/vax/mbus/uba_mbus.c b/sys/arch/vax/mbus/uba_mbus.c
deleted file mode 100644
index 0c3258ded9d..00000000000
--- a/sys/arch/vax/mbus/uba_mbus.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/* $OpenBSD: uba_mbus.c,v 1.5 2015/02/01 15:27:11 miod Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Copyright (c) 1996 Jonathan Stone.
- * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
- * Copyright (c) 1982, 1986 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.
- *
- * @(#)uba.c 7.10 (Berkeley) 12/16/90
- * @(#)autoconf.c 7.20 (Berkeley) 5/9/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/mtpr.h>
-#include <machine/sgmap.h>
-
-#include <vax/mbus/mbusreg.h>
-#include <vax/mbus/mbusvar.h>
-
-#include <arch/vax/uba/ubareg.h>
-#include <arch/vax/qbus/ubavar.h>
-#include <arch/vax/uba/uba_common.h>
-
-void uba_mbus_attach(struct device *, struct device *, void *);
-int uba_mbus_match(struct device *, void *, void *);
-
-const struct cfattach uba_mbus_ca = {
- sizeof(struct uba_vsoftc), uba_mbus_match, uba_mbus_attach
-};
-
-void uba_mbus_beforescan(struct uba_softc*);
-void uba_mbus_init(struct uba_softc*);
-
-extern struct vax_bus_space vax_mem_bus_space;
-
-int
-uba_mbus_match(struct device *parent, void *vcf, void *aux)
-{
- struct mbus_attach_args *maa = (struct mbus_attach_args *)aux;
-
- /*
- * There can only be one QBus adapter (because it uses range-mapped
- * MBus I/O), and it has to be in slot zero for connectivity reasons.
- */
- if (maa->maa_mid != 0)
- return 0;
-
- if (maa->maa_class == CLASS_BA && maa->maa_interface == INTERFACE_FBIC)
- return 1;
-
- return 0;
-}
-
-void
-uba_mbus_attach(struct device *parent, struct device *self, void *aux)
-{
- struct mbus_attach_args *maa = (struct mbus_attach_args *)aux;
- struct uba_vsoftc *sc = (void *)self;
- paddr_t modaddr;
- vaddr_t fbic;
-
- printf(": Q22\n");
-
- /*
- * Configure M-Bus I/O range.
- *
- * This will map the sgmap at 2008xxxx (QBAMAP), and the doorbell
- * registers at 2000xxxx (QIOPAGE).
- */
- modaddr = MBUS_SLOT_BASE(maa->maa_mid);
- fbic = vax_map_physmem(modaddr + FBIC_BASE, 1);
- if (fbic == 0) {
- printf("%s: can't setup M-bus range register\n",
- self->dv_xname);
- return;
- }
- *(uint32_t *)(fbic + FBIC_RANGE) =
- (HOST_TO_MBUS(QBAMAP & RANGE_MATCH)) | RANGE_ENABLE |
- ((QBAMAP ^ QIOPAGE) >> 16);
- vax_unmap_physmem(fbic, 1);
-
- /*
- * There is nothing special to do to enable interrupt routing;
- * the CQBIC will route Q-bus interrupts to the C-bus, and
- * mbus(4) has already configured our FBIC interrupt registers
- * to route C-bus interrupts to the M-bus (whether they are
- * generated by the FBIC or by the Q-bus), which will make them
- * visible to the processor.
- *
- * Note that we do not enable the boards' FBIC memory error
- * interrupt yet.
- */
-
- /*
- * Fill in bus specific data.
- */
- sc->uv_sc.uh_beforescan = uba_mbus_beforescan;
- sc->uv_sc.uh_ubainit = uba_mbus_init;
- sc->uv_sc.uh_iot = &vax_mem_bus_space;
- sc->uv_sc.uh_dmat = &sc->uv_dmat;
-
- /*
- * Fill in variables used by the sgmap system.
- */
- sc->uv_size = QBASIZE; /* Size in bytes of Qbus space */
- sc->uv_addr = QBAMAP; /* Physical address of map registers */
-
- uba_dma_init(sc);
- uba_attach(&sc->uv_sc, QIOPAGE);
-}
-
-/*
- * Called when the CQBIC is set up; to enable DMA access from
- * Q-bus devices to main memory.
- */
-void
-uba_mbus_beforescan(sc)
- struct uba_softc *sc;
-{
- /*
- * Writing to the doorbell registers causes a bus error and
- * a machine check. Don't do this for now, the built-in
- * tape drive still works without this.
- bus_space_write_2(sc->uh_iot, sc->uh_ioh, QIPCR, Q_LMEAE);
- */
-}
-
-void
-uba_mbus_init(sc)
- struct uba_softc *sc;
-{
- DELAY(500000);
- uba_mbus_beforescan(sc);
-}
diff --git a/sys/arch/vax/mscp/files.mscp b/sys/arch/vax/mscp/files.mscp
deleted file mode 100644
index 0791bca132a..00000000000
--- a/sys/arch/vax/mscp/files.mscp
+++ /dev/null
@@ -1,24 +0,0 @@
-# $OpenBSD: files.mscp,v 1.3 2000/04/27 03:14:45 bjc Exp $
-# $NetBSD: files.mscp,v 1.7 1999/06/06 19:16:18 ragge Exp $
-#
-# File and device description for MSCP devices.
-#
-
-define mscp {}
-file arch/vax/mscp/mscp.c mscp
-file arch/vax/mscp/mscp_subr.c mscp
-
-device mscpbus {drive = -1}
-attach mscpbus at mscp
-
-device rx: disk
-attach rx at mscpbus
-
-device ra: disk
-attach ra at mscpbus
-file arch/vax/mscp/mscp_disk.c ra | rx needs-flag
-
-device mt: tape
-attach mt at mscpbus
-file arch/vax/mscp/mscp_tape.c mt needs-flag
-
diff --git a/sys/arch/vax/mscp/mscp.c b/sys/arch/vax/mscp/mscp.c
deleted file mode 100644
index ed338b21059..00000000000
--- a/sys/arch/vax/mscp/mscp.c
+++ /dev/null
@@ -1,445 +0,0 @@
-/* $OpenBSD: mscp.c,v 1.13 2014/12/23 21:20:40 miod Exp $ */
-/* $NetBSD: mscp.c,v 1.16 2001/11/13 07:38:28 lukem Exp $ */
-
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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.
- *
- * @(#)mscp.c 7.5 (Berkeley) 12/16/90
- */
-
-/*
- * MSCP generic driver routines
- */
-
-#include <sys/param.h>
-#include <sys/buf.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-
-#include <machine/bus.h>
-
-#include <arch/vax/mscp/mscp.h>
-#include <arch/vax/mscp/mscpreg.h>
-#include <arch/vax/mscp/mscpvar.h>
-
-#define PCMD PSWP /* priority for command packet waits */
-
-/*
- * Get a command packet. Second argument is true iff we are
- * to wait if necessary. Return NULL if none are available and
- * we cannot wait.
- */
-struct mscp *
-mscp_getcp(mi, canwait)
- struct mscp_softc *mi;
- int canwait;
-{
-#define mri (&mi->mi_cmd)
- struct mscp *mp;
- int i;
- int s = splbio();
-
-again:
- /*
- * Ensure that we have some command credits, and
- * that the next command packet is free.
- */
- if (mi->mi_credits <= MSCP_MINCREDITS) {
- if (!canwait) {
- splx(s);
- return (NULL);
- }
- mi->mi_wantcredits = 1;
- (void) tsleep(&mi->mi_wantcredits, PCMD, "mscpwcrd", 0);
- goto again;
- }
- i = mri->mri_next;
- if (mri->mri_desc[i] & MSCP_OWN) {
- if (!canwait) {
- splx(s);
- return (NULL);
- }
- mi->mi_wantcmd = 1;
- (void) tsleep(&mi->mi_wantcmd, PCMD, "mscpwcmd", 0);
- goto again;
- }
- mi->mi_credits--;
- mri->mri_desc[i] &= ~MSCP_INT;
- mri->mri_next = (mri->mri_next + 1) % mri->mri_size;
- splx(s);
- mp = &mri->mri_ring[i];
-
- /*
- * Initialise some often-zero fields.
- * ARE THE LAST TWO NECESSARY IN GENERAL? IT SURE WOULD BE
- * NICE IF DEC SOLD DOCUMENTATION FOR THEIR OWN CONTROLLERS.
- */
- mp->mscp_msglen = MSCP_MSGLEN;
- mp->mscp_flags = 0;
- mp->mscp_modifier = 0;
- mp->mscp_seq.seq_bytecount = 0;
- mp->mscp_seq.seq_buffer = 0;
- mp->mscp_seq.seq_mapbase = 0;
-/*???*/ mp->mscp_sccc.sccc_errlgfl = 0;
-/*???*/ mp->mscp_sccc.sccc_copyspd = 0;
- return (mp);
-#undef mri
-}
-
-#ifdef AVOID_EMULEX_BUG
-int mscp_aeb_xor = 0x8000bb80;
-#endif
-
-/*
- * Handle a response ring transition.
- */
-void
-mscp_dorsp(mi)
- struct mscp_softc *mi;
-{
- struct device *drive;
- struct mscp_device *me = mi->mi_me;
- struct mscp_ctlr *mc = mi->mi_mc;
- struct buf *bp;
- struct mscp *mp;
- struct mscp_xi *mxi;
- int nextrsp;
- int st, error;
- extern int cold;
- extern struct mscp slavereply;
-
- nextrsp = mi->mi_rsp.mri_next;
-loop:
- if (mi->mi_rsp.mri_desc[nextrsp] & MSCP_OWN) {
- /*
- * No more responses. Remember the next expected
- * response index. Check to see if we have some
- * credits back, and wake up sleepers if so.
- */
- mi->mi_rsp.mri_next = nextrsp;
- if (mi->mi_wantcredits && mi->mi_credits > MSCP_MINCREDITS) {
- mi->mi_wantcredits = 0;
- wakeup((caddr_t) &mi->mi_wantcredits);
- }
- return;
- }
-
- mp = &mi->mi_rsp.mri_ring[nextrsp];
- mi->mi_credits += MSCP_CREDITS(mp->mscp_msgtc);
- /*
- * Controllers are allowed to interrupt as any drive, so we
- * must check the command before checking for a drive.
- */
- if (mp->mscp_opcode == (M_OP_SETCTLRC | M_OP_END)) {
- if ((mp->mscp_status & M_ST_MASK) == M_ST_SUCCESS) {
- mi->mi_flags |= MSC_READY;
- } else {
- printf("%s: SETCTLRC failed: %d ",
- mi->mi_dev.dv_xname, mp->mscp_status);
- mscp_printevent(mp);
- }
- goto done;
- }
-
- /*
- * Found a response. Update credit information. If there is
- * nothing else to do, jump to `done' to get the next response.
- */
- if (mp->mscp_unit >= mi->mi_driveno) { /* Must expand drive table */
- size_t tmpno = ((mp->mscp_unit + 32) & 0xffe0) * sizeof(void *);
- struct device **tmp = malloc(tmpno, M_DEVBUF, M_NOWAIT|M_ZERO);
- if (tmp == NULL)
- panic("mscp_dorsp");
- if (mi->mi_driveno) {
- bcopy(mi->mi_dp, tmp, mi->mi_driveno);
- free(mi->mi_dp, M_DEVBUF, mi->mi_driveno);
- }
- mi->mi_driveno = tmpno;
- mi->mi_dp = tmp;
- }
-
- drive = mi->mi_dp[mp->mscp_unit];
-
- switch (MSCP_MSGTYPE(mp->mscp_msgtc)) {
-
- case MSCPT_SEQ:
- break;
-
- case MSCPT_DATAGRAM:
- (*me->me_dgram)(drive, mp, mi);
- goto done;
-
- case MSCPT_CREDITS:
- goto done;
-
- case MSCPT_MAINTENANCE:
- default:
- printf("%s: unit %d: unknown message type 0x%x ignored\n",
- mi->mi_dev.dv_xname, mp->mscp_unit,
- MSCP_MSGTYPE(mp->mscp_msgtc));
- goto done;
- }
-
- /*
- * Handle individual responses.
- */
- st = mp->mscp_status & M_ST_MASK;
- error = 0;
- switch (mp->mscp_opcode) {
-
- case M_OP_END:
- /*
- * The controller presents a bogus END packet when
- * a read/write command is given with an illegal
- * block number. This is contrary to the MSCP
- * specification (ENDs are to be given only for
- * invalid commands), but that is the way of it.
- */
- if (st == M_ST_INVALCMD && mp->mscp_cmdref != 0) {
- printf("%s: bad lbn (%d)?\n", drive->dv_xname,
- (int)mp->mscp_seq.seq_lbn);
- error = EIO;
- goto rwend;
- }
- goto unknown;
-
- case M_OP_ONLINE | M_OP_END:
- /*
- * Finished an ON LINE request. Call the driver to
- * find out whether it succeeded. If so, mark it on
- * line.
- */
- (*me->me_online)(drive, mp);
- break;
-
- case M_OP_GETUNITST | M_OP_END:
- /*
- * Got unit status. If we are autoconfiguring, save
- * the mscp struct so that mscp_attach know what to do.
- * If the drive isn't configured, call config_found()
- * to set it up, otherwise it's just a "normal" unit
- * status.
- */
- if (cold)
- bcopy(mp, &slavereply, sizeof(struct mscp));
-
- if (mp->mscp_status == (M_ST_OFFLINE|M_OFFLINE_UNKNOWN))
- break;
-
- if (drive == 0) {
- struct drive_attach_args da;
-
- da.da_mp = (struct mscp *)mp;
- da.da_typ = mi->mi_type;
- config_found(&mi->mi_dev, (void *)&da, mscp_print);
- } else
- /* Hack to avoid complaints */
- if (!(((mp->mscp_event & M_ST_MASK) == M_ST_AVAILABLE)
- && cold))
- (*me->me_gotstatus)(drive, mp);
- break;
-
- case M_OP_AVAILATTN:
- /*
- * The drive went offline and we did not notice.
- * Mark it off line now, to force an on line request
- * next, so we can make sure it is still the same
- * drive.
- *
- * IF THE UDA DRIVER HAS A COMMAND AWAITING UNIBUS
- * RESOURCES, THAT COMMAND MAY GO OUT BEFORE THE ON
- * LINE. IS IT WORTH FIXING??
- */
-#ifdef notyet
- (*md->md_offline)(ui, mp);
-#endif
- break;
-
- case M_OP_POS | M_OP_END:
- case M_OP_WRITM | M_OP_END:
- case M_OP_AVAILABLE | M_OP_END:
- /*
- * A non-data transfer operation completed.
- */
- (*me->me_cmddone)(drive, mp);
- break;
-
- case M_OP_READ | M_OP_END:
- case M_OP_WRITE | M_OP_END:
- /*
- * A transfer finished. Get the buffer, and release its
- * map registers via ubadone(). If the command finished
- * with an off line or available status, the drive went
- * off line (the idiot controller does not tell us until
- * it comes back *on* line, or until we try to use it).
- */
-rwend:
-#ifdef DIAGNOSTIC
- if (mp->mscp_cmdref >= NCMD) {
- /*
- * No buffer means there is a bug somewhere!
- */
- printf("%s: io done, but bad xfer number?\n",
- drive->dv_xname);
- mscp_hexdump(mp);
- break;
- }
-#endif
-
- if (mp->mscp_cmdref == -1) {
- (*me->me_cmddone)(drive, mp);
- break;
- }
- mxi = &mi->mi_xi[mp->mscp_cmdref];
- if (mxi->mxi_inuse == 0)
- panic("mxi not inuse");
- bp = mxi->mxi_bp;
- /*
- * Mark any error-due-to-bad-LBN (via `goto rwend').
- * WHAT STATUS WILL THESE HAVE? IT SURE WOULD BE NICE
- * IF DEC SOLD DOCUMENTATION FOR THEIR OWN CONTROLLERS.
- */
- if (error) {
- bp->b_flags |= B_ERROR;
- bp->b_error = error;
- }
- if (st == M_ST_OFFLINE || st == M_ST_AVAILABLE) {
-#ifdef notyet
- (*md->md_offline)(ui, mp);
-#endif
- }
-
- /*
- * If the transfer has something to do with bad
- * block forwarding, let the driver handle the
- * rest.
- */
- if ((bp->b_flags & B_BAD) != 0 && me->me_bb != NULL) {
- (*me->me_bb)(drive, mp, bp);
- goto out;
- }
-
- /*
- * If the transfer failed, give the driver a crack
- * at fixing things up.
- */
- if (st != M_ST_SUCCESS) {
- switch ((*me->me_ioerr)(drive, mp, bp)) {
-
- case MSCP_DONE: /* fixed */
- break;
-
- case MSCP_RESTARTED: /* still working on it */
- goto out;
-
- case MSCP_FAILED: /* no luck */
- /* XXX must move to ra.c */
- mscp_printevent(mp);
- break;
- }
- }
-
- /*
- * Set the residual count and mark the transfer as
- * done. If the I/O wait queue is now empty, release
- * the shared BDP, if any.
- */
- bp->b_resid = bp->b_bcount - mp->mscp_seq.seq_bytecount;
- bus_dmamap_unload(mi->mi_dmat, mxi->mxi_dmam);
-
- (*mc->mc_ctlrdone)(mi->mi_dev.dv_parent);
- (*me->me_iodone)(drive, bp);
-out:
- mxi->mxi_inuse = 0;
- mi->mi_mxiuse |= (1 << mp->mscp_cmdref);
- break;
-
- case M_OP_REPLACE | M_OP_END:
- /*
- * A replace operation finished. Just let the driver
- * handle it (if it does replaces).
- */
- if (me->me_replace == NULL)
- printf("%s: bogus REPLACE end\n", drive->dv_xname);
- else
- (*me->me_replace)(drive, mp);
- break;
-
- default:
- /*
- * If it is not one of the above, we cannot handle it.
- * (And we should not have received it, for that matter.)
- */
-unknown:
- printf("%s: unknown opcode 0x%x status 0x%x ignored\n",
- drive->dv_xname, mp->mscp_opcode, mp->mscp_status);
-#ifdef DIAGNOSTIC
- mscp_hexdump(mp);
-#endif
- break;
- }
-
- /*
- * If the drive needs to be put back in the controller queue,
- * do that now. (`bp' below ought to be `dp', but they are all
- * struct buf *.) Note that b_active was cleared in the driver;
- * we presume that there is something to be done, hence reassert it.
- */
-#ifdef notyet /* XXX */
- if (ui->ui_flags & UNIT_REQUEUE) {
- ...
- }
-#endif
-done:
- /*
- * Give back the response packet, and take a look at the next.
- */
- mp->mscp_msglen = MSCP_MSGLEN;
- mi->mi_rsp.mri_desc[nextrsp] |= MSCP_OWN;
- nextrsp = (nextrsp + 1) % mi->mi_rsp.mri_size;
- goto loop;
-}
-
-/*
- * Requeue outstanding transfers, e.g., after bus reset.
- * Also requeue any drives that have on line or unit status
- * info pending.
- */
-void
-mscp_requeue(mi)
- struct mscp_softc *mi;
-{
- panic("mscp_requeue");
-}
-
diff --git a/sys/arch/vax/mscp/mscp.h b/sys/arch/vax/mscp/mscp.h
deleted file mode 100644
index c94f45d9b35..00000000000
--- a/sys/arch/vax/mscp/mscp.h
+++ /dev/null
@@ -1,490 +0,0 @@
-/* $OpenBSD: mscp.h,v 1.5 2003/06/02 23:27:57 millert Exp $ */
-/* $NetBSD: mscp.h,v 1.6 1999/05/29 19:11:16 ragge Exp $ */
-
-/*
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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.
- *
- * @(#)mscp.h 7.5 (Berkeley) 6/28/90
- */
-
-/*
- * Definitions for the Mass Storage Control Protocol
- * I WISH I KNEW WHAT MORE OF THESE WERE. IT SURE WOULD BE NICE
- * IF DEC SOLD DOCUMENTATION FOR THEIR OWN CONTROLLERS.
- */
-
-/*
- * Control message opcodes
- */
-#define M_OP_ABORT 0x01 /* Abort command */
-#define M_OP_GETCMDST 0x02 /* Get command status command */
-#define M_OP_GETUNITST 0x03 /* Get unit status command */
-#define M_OP_SETCTLRC 0x04 /* Set controller characteristics command */
-#define M_OP_SEREX 0x07 /* Serious exception end message */
-#define M_OP_AVAILABLE 0x08 /* Available command */
-#define M_OP_ONLINE 0x09 /* Online command */
-#define M_OP_SETUNITC 0x0a /* Set unit characteristics command */
-#define M_OP_DTACCPATH 0x0b /* Determine access paths command */
-#define M_OP_ACCESS 0x10 /* Access command */
-#define M_OP_COMPCD 0x11 /* Compare controller data command */
-#define M_OP_ERASE 0x12 /* Erase command */
-#define M_OP_FLUSH 0x13 /* Flush command */
-#define M_OP_REPLACE 0x14 /* Replace command */
-#define M_OP_COMPHD 0x20 /* Compare host data command */
-#define M_OP_READ 0x21 /* Read command */
-#define M_OP_WRITE 0x22 /* Write command */
-#define M_OP_WRITM 0x24 /* Write mark command */
-#define M_OP_POS 0x25 /* Positioning command */
-#define M_OP_AVAILATTN 0x40 /* Available attention message */
-#define M_OP_DUPUNIT 0x41 /* Duplicate unit number attention message */
-#define M_OP_ACCPATH 0x42 /* Access path attention message */
-#define M_OP_END 0x80 /* End message flag */
-
-
-/*
- * Generic command modifiers
- */
-#define M_MD_EXPRS 0x8000 /* Express request */
-#define M_MD_COMP 0x4000 /* Compare */
-#define M_MD_CLSEX 0x2000 /* Clear serious exception */
-#define M_MD_ERROR 0x1000 /* Force error */
-#define M_MD_SCCHH 0x0800 /* Suppress caching (high speed) */
-#define M_MD_SCCHL 0x0400 /* Suppress caching (low speed) */
-#define M_MD_SECOR 0x0200 /* Suppress error correction */
-#define M_MD_SEREC 0x0100 /* Suppress error recovery */
-#define M_MD_SSHDW 0x0080 /* Suppress shadowing */
-#define M_MD_WBKNV 0x0040 /* Write back (non-volatile) */
-#define M_MD_WBKVL 0x0020 /* Write back (volatile) */
-#define M_MD_WRSEQ 0x0010 /* Write shadow set one unit at a time */
-
-/*
- * tape command modifiers
- */
-#define M_MD_IMMEDIATE 0x0040 /* Immediate completion */
-#define M_MD_UNLOAD 0x0010 /* Unload tape */
-#define M_MD_REVERSE 0x0008 /* Reverse action */
-#define M_MD_OBJCOUNT 0x0004 /* Object count */
-#define M_MD_REWIND 0x0002 /* Rewind */
-
-/*
- * AVAILABLE command modifiers
- */
-#define M_AVM_ALLCD 0x0002 /* All class drivers */
-#define M_AVM_SPINDOWN 0x0001 /* Spin down */
-
-/*
- * FLUSH command modifiers
- */
-#define M_FLM_FLUSHENU 0x0001 /* Flush entire unit */
-#define M_FLM_VOLATILE 0x0002 /* Volatile only */
-
-/*
- * GET UNIT STATUS command modifiers
- */
-#define M_GUM_NEXTUNIT 0x0001 /* Next unit */
-
-/*
- * ONLINE command modifiers
- */
-#define M_OLM_RIP 0x0001 /* Allow self destruction */
-#define M_OLM_IGNMF 0x0002 /* Ignore media format error */
-
-/*
- * ONLINE and SET UNIT CHARACTERISTICS command modifiers
- */
-#define M_OSM_ALTERHI 0x0020 /* Alter host identifier */
-#define M_OSM_SHADOWSP 0x0010 /* Shadow unit specified */
-#define M_OSM_CLEARWBL 0x0008 /* Clear write-back data lost */
-#define M_OSM_SETWRPROT 0x0004 /* Set write protect */
-
-/*
- * REPLACE command modifiers
- */
-#define M_RPM_PRIMARY 0x0001 /* Primary replacement block */
-
-/*
- * End message flags
- */
-#define M_EF_BBLKR 0x80 /* Bad block reported */
-#define M_EF_BBLKU 0x40 /* Bad block unreported */
-#define M_EF_ERLOG 0x20 /* Error log generated */
-#define M_EF_SEREX 0x10 /* Serious exception */
-#define M_EF_EOT 0x08 /* at end-of-tape */
-#define M_EF_POSLOST 0x04 /* position lost */
-
-/*
- * Controller flags
- */
-#define M_CF_ATTN 0x80 /* Enable attention messages */
-#define M_CF_MISC 0x40 /* Enable miscellaneous error log messages */
-#define M_CF_OTHER 0x20 /* Enable other host's error log messages */
-#define M_CF_THIS 0x10 /* Enable this host's error log messages */
-#define M_CF_MLTHS 0x04 /* Multi-host */
-#define M_CF_SHADW 0x02 /* Shadowing */
-#define M_CF_576 0x01 /* 576 byte sectors */
-
-/*
- * Unit flags
- */
-#define M_UF_REPLC 0x8000 /* Controller initiated bad block replacement */
-#define M_UF_INACT 0x4000 /* Inactive shadow set unit */
-#define M_UF_WRTPH 0x2000 /* Write protect (hardware) */
-#define M_UF_WRTPS 0x1000 /* Write protect (software or volume) */
-#define M_UF_SCCHH 0x8000 /* Suppress caching (high speed) */
-#define M_UF_SCCHL 0x4000 /* Suppress caching (low speed) */
-#define M_UF_RMVBL 0x0080 /* Removable media */
-#define M_UF_WBKNV 0x0040 /* Write back (non-volatile) */
-#define M_UF_576 0x0004 /* 576 byte sectors */
-#define M_UF_CMPWR 0x0002 /* Compare writes */
-#define M_UF_CMPRD 0x0001 /* Compare reads */
-
-/*
- * Error Log message format codes
- */
-#define M_FM_CTLRERR 0x00 /* Controller error */
-#define M_FM_BUSADDR 0x01 /* Host memory access error */
-#define M_FM_DISKTRN 0x02 /* Disk transfer error */
-#define M_FM_SDI 0x03 /* SDI error */
-#define M_FM_SMLDSK 0x04 /* Small disk error */
-#define M_FM_TAPETRN 0x05 /* Tape transfer error */
-#define M_FM_STIERR 0x06 /* STI communication or command failure */
-#define M_FM_STIDEL 0x07 /* STI drive error log */
-#define M_FM_STIFEL 0x08 /* STI formatter error log */
-
-/*
- * Error Log message flags
- */
-#define M_LF_SUCC 0x80 /* Operation successful */
-#define M_LF_CONT 0x40 /* Operation continuing */
-#define M_LF_SQNRS 0x01 /* Sequence number reset */
-
-/*
- * Status codes
- */
-#define M_ST_MASK 0x1f /* Status code mask */
-#define M_ST_SUCCESS 0x00 /* Success */
-#define M_ST_INVALCMD 0x01 /* Invalid command */
-#define M_ST_ABORTED 0x02 /* Command aborted */
-#define M_ST_OFFLINE 0x03 /* Unit offline */
-#define M_ST_AVAILABLE 0x04 /* Unit available */
-#define M_ST_MFMTERR 0x05 /* Media format error */
-#define M_ST_WRPROT 0x06 /* Write protected */
-#define M_ST_COMPERR 0x07 /* Compare error */
-#define M_ST_DATAERR 0x08 /* Data error */
-#define M_ST_HOSTBUFERR 0x09 /* Host buffer access error */
-#define M_ST_CTLRERR 0x0a /* Controller error */
-#define M_ST_DRIVEERR 0x0b /* Drive error */
-#define M_ST_FORMATTERR 0x0c /* Formatter error */
-#define M_ST_BOT 0x0d /* Beginning-of-tape */
-#define M_ST_TAPEMARK 0x0e /* Tape mark encountered */
-#define M_ST_RDTRUNC 0x10 /* Record data truncated */
-#define M_ST_DIAG 0x1f /* Message from an internal diagnostic */
-
-/*
- * Subcodes of M_ST_OFFLINE
- */
-#define M_OFFLINE_UNKNOWN (0 << 5) /* unknown or on other ctlr */
-#define M_OFFLINE_UNMOUNTED (1 << 5) /* unmounted or RUN/STOP at STOP */
-#define M_OFFLINE_INOPERATIVE (2 << 5) /* inoperative? */
-#define M_OFFLINE_DUPLICATE (4 << 5) /* duplicate unit number */
-#define M_OFFLINE_INDIAGNOSTIC (8 << 5) /* disabled by FS or diagnostic */
-
-/*
- * An MSCP packet begins with a header giving the length of
- * the entire packet (including the header itself)(?), two bytes
- * of device specific data, and the a whole bunch of variants
- * depending on message type.
- *
- * N.B.: In most cases we distinguish between a `command' and
- * an `end' variant as well. The command variant is that which
- * is given to the controller; the `end' variant is its response.
- */
-
-/*
- * Generic sequential message variant (command and response).
- */
-struct mscpv_seq {
- long seq_bytecount; /* byte count */
-#define seq_rbn seq_bytecount /* aka RBN (replace) */
-#define seq_outref seq_bytecount /* aka outref (abort/get cmd status) */
- long seq_buffer; /* buffer descriptor */
- long seq_mapbase; /* page map (first PTE) phys address */
- long seq_xxx1; /* ? */ /* unused */
- long seq_lbn; /* logical block number */
- long seq_xxx2; /* ? */ /* unused */
- long *seq_addr; /* pointer to cmd descriptor */
- long seq_software[4]; /* reserved to software; unused */
-};
-
-/*
- * Set Controller Characteristics command variant
- */
-struct mscpv_sccc {
- u_short sccc_version; /* MSCP version number */
- u_short sccc_ctlrflags; /* controller flags */
- u_short sccc_hosttimo; /* host timeout */
- u_short sccc_usefrac; /* use fraction */
- long sccc_time; /* time and date */
- long sccc_time1; /* it's a quad field */
- long sccc_errlgfl; /* ? */
- short sccc_xxx2; /* ? */
- short sccc_copyspd; /* ? */
-};
-
-/*
- * Set Controller Characteristics end variant
- */
-struct mscpv_scce {
- u_short scce_version; /* MSCP version number */
- u_short scce_ctlrflags; /* controller flags */
- u_short scce_ctlrtimo; /* controller timeout */
- u_short scce_ctlrcmdl; /* ??? */
- quad_t scce_ctlrid; /* controller ID */
- long scce_xxx[3]; /* ? */
- long scce_volser; /* volume serial number */
-};
-
-/*
- * On Line command variant
- */
-struct mscpv_onlc {
- long onlc_xxx1[4]; /* ? */
- long onlc_errlgfl; /* error log flag? */
- short onlc_xxx2; /* ? */
- short onlc_copyspd; /* copy speed? */
-};
-
-/*
- * On Line end variant
- */
-struct mscpv_onle {
- long onle_xxx1[3]; /* ? */
-/*???*/ short onle_xxx2; /* ? */
- u_char onle_drivetype; /* drive type index (same in guse) */
- char onle_xxx3; /* ? */
- long onle_mediaid; /* media type id (same in guse) */
- long onle_xxx4; /* ? */
- long onle_unitsize; /* unit size in sectors */
- long onle_volser; /* volume serial number */
-};
-
-/*
- * Get Unit Status end variant (and Avail Attn?)
- */
-struct mscpv_guse {
- u_short guse_multunit; /* multi-unit code */
- u_short guse_unitflags; /* unit flags */
- long guse_hostid; /* host id */
- long guse_unitid0; /*???*/
- short guse_unitid1; /*???*/
- u_char guse_drivetype; /* drive type index */
- u_char guse_unitid2; /*???*/
- long guse_mediaid; /* media type id (encoded) */
- short guse_shadowunit; /* shadow unit */
- short guse_shadowstat; /* shadow status */
- u_short guse_nspt; /* sectors per track */
- u_short guse_group; /* track group size */
- u_short guse_ngpc; /* groups per cylinder */
- u_short guse_xxx; /* reserved */
- u_short guse_rctsize; /* RCT size (sectors) */
- u_char guse_nrpt; /* RBNs per track */
- u_char guse_nrct; /* number of RCTs */
-};
-
-/*
- * Macros to break up and build media IDs. An ID encodes the port
- * type in the top 10 bits, and the drive type in the remaining 22.
- * The 10 bits, and 15 of the 22, are in groups of 5, with the value
- * 0 representing space and values 1..26 representing A..Z. The low
- * 7 bits represent a number in 0..127. Hence an RA81 on a UDA50
- * is <D><U><R><A>< >81, or 0x25641051. This encoding scheme is known
- * in part in uda.c.
- *
- * The casts below are just to make pcc generate better code.
- */
-#define MSCP_MEDIA_PORT(id) (((long)(id) >> 22) & 0x3ff) /* port */
-#define MSCP_MEDIA_DRIVE(id) ((long)(id) & 0x003fffff) /* drive */
-#define MSCP_MID_ECH(n, id) (((int)(id) >> ((n) * 5 + 7)) & 0x1f)
-#define MSCP_MID_CHAR(n, id) \
- (MSCP_MID_ECH(n, id) ? MSCP_MID_ECH(n, id) + '@' : ' ')
-#define MSCP_MID_NUM(id) ((id) & 0x7f)
-/* for, e.g., RA81 */
-#define MSCP_MKDRIVE2(a, b, n) \
- (((a) - '@') << 17 | ((b) - '@') << 12 | (n))
-/* for, e.g., RRD50 */
-#define MSCP_MKDRIVE3(a, b, c, n) \
- (((a) - '@') << 17 | ((b) - '@') << 12 | ((c) - '@') << 7 | (n))
-
-/*
- * Error datagram variant.
- */
-struct mscpv_erd {
- quad_t erd_ctlrid; /* controller ID */
- u_char erd_ctlrsoftware; /* controller software version */
- u_char erd_ctlrhardware; /* controller hardware version */
- u_short erd_multiunit; /* multi-unit code (?) */
- union {
- u_long un_busaddr; /* bus address, if mem access err */
- quad_t un_unitid; /* unit id, otherwise */
- } erd_un1;
-#define erd_busaddr erd_un1.un_busaddr
-#define erd_unitid erd_un1.un_unitid
- u_char erd_unitsoftware; /* unit software version */
- u_char erd_unithardware; /* unit hardware version */
- union {
- u_char un_b[2]; /* level, retry (if disk xfer err) */
- u_short un_s; /* cylinder (if small disk error) */
- } erd_un2;
-#define erd_level erd_un2.un_b[0]
-#define erd_retry erd_un2.un_b[1]
-#define erd_sdecyl erd_un2.un_s
- long erd_volser; /* volume serial number */
- u_long erd_hdr; /* `header' (block number) */
- u_char erd_sdistat[12]; /* SDI status information (?) */
-};
-
-/*
- * I am making brash assumptions about the first four bytes of all
- * MSCP packets. These appear to be true for both UDA50s and TMSCP
- * devices (TU81, TA81, TK50). DEC claim that these four bytes are
- * not part of MSCP itself, yet at least the length is necessary
- * for, e.g., error checking.
- */
-struct mscp {
- u_short mscp_msglen; /* length in bytes */
- u_char mscp_msgtc; /* type (high 4 bits) and credits */
- u_char mscp_vcid; /* virtual circuit ID */
- long mscp_cmdref; /* command reference number */
- u_short mscp_unit; /* unit number */
- u_short mscp_seqnum; /* sequence number */
- u_char mscp_opcode; /* opcode */
-#define mscp_format mscp_opcode /* aka format (datagrams) */
- u_char mscp_flags; /* flags */
- u_short mscp_modifier; /* modifier (commands) */
-#define mscp_status mscp_modifier /* aka status (ends) */
-#define mscp_event mscp_modifier /* aka event (datagrams) */
- union {
- struct mscpv_seq un_seq; /* generic sequential msg */
- struct mscpv_sccc un_sccc; /* SCC command */
- struct mscpv_scce un_scce; /* SCC end */
- struct mscpv_onlc un_onlc; /* on line command */
- struct mscpv_onle un_onle; /* on line end */
- struct mscpv_guse un_guse; /* get unit status */
- struct mscpv_erd un_erd; /* error datagram */
- } mscp_un;
-/*???*/ long mscp_xxx; /* pad to 64 bytes */
-};
-
-/*
- * Define message length according to the DEC specifications by dropping
- * the four byte header.
- */
-#define MSCP_MSGLEN (sizeof (struct mscp) - 4)
-
-/*
- * Shorthand
- */
-
-/*
- * Generic packet
- */
-#define mscp_seq mscp_un.un_seq
-
-/*
- * Set Controller Characteristics packet
- */
-#define mscp_sccc mscp_un.un_sccc
-
-/*
- * Set Controller Characteristics end packet
- */
-#define mscp_scce mscp_un.un_scce
-
-/*
- * Online / Set Unit Characteristics command packet
- */
-#define mscp_onlc mscp_un.un_onlc
-
-/*
- * Online end packet
- */
-#define mscp_onle mscp_un.un_onle
-
-/*
- * Get Unit Status end packet
- */
-#define mscp_guse mscp_un.un_guse
-
-/*
- * MSCP Error Log packet
- */
-#define mscp_erd mscp_un.un_erd
-
-/*
- * MSCP seq_addr field actually belongs to overall packet.
- */
-#define mscp_addr mscp_seq.seq_addr
-
-/*
- * Macros to break up mscp_msgtc, and types.
- */
-#define MSCP_MSGTYPE(m) ((m) & 0xf0)
-#define MSCP_CREDITS(m) ((m) & 0x0f)
-
-#define MSCPT_SEQ 0x00 /* sequential message */
-#define MSCPT_DATAGRAM 0x10 /* error datagram */
-#define MSCPT_CREDITS 0x20 /* credit notification */
-#define MSCPT_MAINTENANCE 0xf0 /* who knows */
-
-
-/*
- * Here begin more perhaps brash assumptions about MSCP devices...
- */
-
-/*
- * MSCP controllers have `command rings' and `response rings'. A
- * command ring is a pool of MSCP packets that the host uses to give
- * commands to the controller; a response ring is a pool of MSCP
- * packets that the controller uses to give back responses. Entries
- * in the command and response rings are `owned' by either the host
- * or the controller; only the owner is allowed to alter any of the
- * fields in the MSCP packet. Thus, free command packets are owned
- * by the host, and free response packets by the controller. When
- * the host gives a packet to the controller, it tells the controller
- * by touching a device register; when the controller gives a response
- * to the host, it generates an interrupt if enabled, and sets
- * a device register as well.
- *
- * The pool is `described' by a set of pointers to the packets, along
- * with the two flags below.
- */
-#define MSCP_OWN 0x80000000 /* controller owns this packet */
-#define MSCP_INT 0x40000000 /* controller should interrupt */
diff --git a/sys/arch/vax/mscp/mscp_disk.c b/sys/arch/vax/mscp/mscp_disk.c
deleted file mode 100644
index 88c5dd4f69f..00000000000
--- a/sys/arch/vax/mscp/mscp_disk.c
+++ /dev/null
@@ -1,915 +0,0 @@
-/* $OpenBSD: mscp_disk.c,v 1.41 2014/05/08 19:06:07 miod Exp $ */
-/* $NetBSD: mscp_disk.c,v 1.30 2001/11/13 07:38:28 lukem Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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.
- *
- * @(#)uda.c 7.32 (Berkeley) 2/13/91
- */
-
-/*
- * RA disk device driver
- * RX MSCP floppy disk device driver
- */
-
-/*
- * TODO
- * write bad block forwarding code
- */
-
-#include <sys/param.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/disk.h>
-#include <sys/disklabel.h>
-#include <sys/ioctl.h>
-#include <sys/dkio.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <sys/reboot.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-
-#include <ufs/ufs/dinode.h>
-#include <ufs/ffs/fs.h>
-
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <arch/vax/mscp/mscp.h>
-#include <arch/vax/mscp/mscpreg.h>
-#include <arch/vax/mscp/mscpvar.h>
-
-#include "ra.h"
-
-struct cfdriver ra_cd = {
- NULL, "ra", DV_DISK
-};
-
-struct cfdriver rx_cd = {
- NULL, "rx", DV_DISK
-};
-
-#define RAMAJOR 9 /* RA major device number XXX */
-
-/*
- * Drive status, per drive
- */
-struct ra_softc {
- struct device ra_dev; /* autoconf struct */
- struct disk ra_disk;
- struct mscpv_guse ra_guse; /* status information */
- u_long ra_unitsize; /* unit size in sectors */
- int ra_state; /* open/closed state */
- int ra_hwunit; /* Hardware unit number */
-};
-
-#define rx_softc ra_softc
-
-void rxattach(struct device *, struct device *, void *);
-int rx_putonline(struct rx_softc *);
-
-#if NRA
-
-int ramatch(struct device *, struct cfdata *, void *);
-int raread(dev_t, struct uio *);
-int rawrite(dev_t, struct uio *);
-int ra_putonline(struct ra_softc *);
-int ragetdisklabel(dev_t, struct ra_softc *, struct disklabel *, int);
-bdev_decl(ra);
-
-const struct cfattach ra_ca = {
- sizeof(struct ra_softc), (cfmatch_t)ramatch, rxattach
-};
-
-/*
- * More driver definitions, for generic MSCP code.
- */
-
-int
-ramatch(struct device *parent, struct cfdata *cf, void *aux)
-{
- struct drive_attach_args *da = aux;
- struct mscp *mp = da->da_mp;
-
- if ((da->da_typ & MSCPBUS_DISK) == 0)
- return 0;
- if (cf->cf_loc[0] != -1 && cf->cf_loc[0] != mp->mscp_unit)
- return 0;
- /*
- * Check if this disk is a floppy; then don't configure it.
- * Seems to be a safe way to test it per Chris Torek.
- */
- if (MSCP_MID_ECH(1, mp->mscp_guse.guse_mediaid) == 'X' - '@')
- return 0;
- return 1;
-}
-
-/*
- * Read the label from the drive.
- */
-int
-ragetdisklabel(dev_t dev, struct ra_softc *ra, struct disklabel *lp,
- int spoofonly)
-{
- int n, p = 0;
-
- bzero(lp, sizeof(struct disklabel));
- lp->d_secsize = DEV_BSIZE;
- lp->d_nsectors = ra->ra_guse.guse_nspt;
- lp->d_ntracks = ra->ra_guse.guse_ngpc * ra->ra_guse.guse_group;
- lp->d_secpercyl = lp->d_nsectors * lp->d_ntracks;
- DL_SETDSIZE(lp, ra->ra_unitsize); /* XXX might be zero */
-
- if (lp->d_secpercyl) {
- lp->d_ncylinders = ra->ra_unitsize / lp->d_secpercyl;
- lp->d_type = DTYPE_MSCP;
- } else {
- lp->d_type = DTYPE_FLOPPY;
- }
-
- lp->d_bbsize = BBSIZE;
- lp->d_sbsize = SBSIZE;
-
- /* Create the disk name for disklabel. Phew... */
- lp->d_typename[p++] = MSCP_MID_CHAR(2, ra->ra_guse.guse_mediaid);
- lp->d_typename[p++] = MSCP_MID_CHAR(1, ra->ra_guse.guse_mediaid);
- if (MSCP_MID_ECH(0, ra->ra_guse.guse_mediaid))
- lp->d_typename[p++] =
- MSCP_MID_CHAR(0, ra->ra_guse.guse_mediaid);
- n = MSCP_MID_NUM(ra->ra_guse.guse_mediaid);
- if (n > 99) {
- lp->d_typename[p++] = '1';
- n -= 100;
- }
- if (n > 9) {
- lp->d_typename[p++] = (n / 10) + '0';
- n %= 10;
- }
- lp->d_typename[p++] = n + '0';
- lp->d_typename[p] = 0;
-
- lp->d_version = 1;
- lp->d_magic = lp->d_magic2 = DISKMAGIC;
- lp->d_checksum = dkcksum(lp);
-
- return readdisklabel(DISKLABELDEV(dev), rastrategy, lp, spoofonly);
-}
-
-/*
- * (Try to) put the drive online. This is done the first time the
- * drive is opened, or if it has fallen offline.
- */
-int
-ra_putonline(struct ra_softc *ra)
-{
- struct disklabel *dl;
- int rc;
-
- ra->ra_state = DK_RDLABEL;
- if (rx_putonline(ra) != MSCP_DONE)
- return MSCP_FAILED;
-
- dl = ra->ra_disk.dk_label;
- rc = ragetdisklabel(MAKEDISKDEV(RAMAJOR, ra->ra_dev.dv_unit, RAW_PART),
- ra, dl, 0);
- if (rc != EIO)
- ra->ra_state = DK_OPEN;
-
- printf("%s: %luMB, %u bytes/sector, %lu sectors\n",
- ra->ra_dev.dv_xname,
- ra->ra_unitsize / (1048576 / dl->d_secsize),
- dl->d_secsize, ra->ra_unitsize);
-
- return MSCP_DONE;
-}
-
-/*
- * Open a drive.
- */
-/*ARGSUSED*/
-int
-raopen(dev_t dev, int flag, int fmt, struct proc *p)
-{
- struct ra_softc *ra;
- int part, unit, mask;
-
- /*
- * Make sure this is a reasonable open request.
- */
- unit = DISKUNIT(dev);
- if (unit >= ra_cd.cd_ndevs)
- return ENXIO;
- ra = ra_cd.cd_devs[unit];
- if (ra == 0)
- return ENXIO;
-
- /*
- * If this is the first open; we must first try to put
- * the disk online (and read the label).
- */
- if (ra->ra_state == DK_CLOSED)
- if (ra_putonline(ra) == MSCP_FAILED)
- return ENXIO;
-
- part = DISKPART(dev);
- if (part >= ra->ra_disk.dk_label->d_npartitions)
- return ENXIO;
-
- /*
- * Wait for the state to settle
- */
-#if notyet
- while (ra->ra_state != DK_OPEN)
- if ((error = tsleep((caddr_t)ra, (PZERO + 1) | PCATCH,
- "devopen", 0))) {
- splx(s);
- return (error);
- }
-#endif
-
- mask = 1 << part;
-
- switch (fmt) {
- case S_IFCHR:
- ra->ra_disk.dk_copenmask |= mask;
- break;
- case S_IFBLK:
- ra->ra_disk.dk_bopenmask |= mask;
- break;
- }
- ra->ra_disk.dk_openmask |= mask;
- return 0;
-}
-
-/* ARGSUSED */
-int
-raclose(dev_t dev, int flags, int fmt, struct proc *p)
-{
- int unit = DISKUNIT(dev);
- struct ra_softc *ra = ra_cd.cd_devs[unit];
- int mask = (1 << DISKPART(dev));
-
- switch (fmt) {
- case S_IFCHR:
- ra->ra_disk.dk_copenmask &= ~mask;
- break;
- case S_IFBLK:
- ra->ra_disk.dk_bopenmask &= ~mask;
- break;
- }
- ra->ra_disk.dk_openmask =
- ra->ra_disk.dk_copenmask | ra->ra_disk.dk_bopenmask;
-
- /*
- * Should wait for I/O to complete on this partition even if
- * others are open, but wait for work on blkflush().
- */
-#if notyet
- if (ra->ra_openpart == 0) {
- s = spluba();
- while (BUFQ_FIRST(&udautab[unit]) != NULL)
- (void) tsleep(&udautab[unit], PZERO - 1,
- "raclose", 0);
- splx(s);
- ra->ra_state = DK_CLOSED;
- }
-#endif
- return (0);
-}
-
-/*
- * Queue a transfer request, and if possible, hand it to the controller.
- */
-void
-rastrategy(struct buf *bp)
-{
- int unit;
- struct ra_softc *ra;
- int s;
-
- /*
- * Make sure this is a reasonable drive to use.
- */
- unit = DISKUNIT(bp->b_dev);
- if (unit >= ra_cd.cd_ndevs || (ra = ra_cd.cd_devs[unit]) == NULL) {
- bp->b_error = ENXIO;
- goto bad;
- }
- /*
- * If drive is open `raw' or reading label, let it at it.
- */
- if (ra->ra_state == DK_RDLABEL) {
- s = splbio();
- disk_busy(&ra->ra_disk);
- splx(s);
- mscp_strategy(bp, ra->ra_dev.dv_parent);
- return;
- }
-
- /* If disk is not online, try to put it online */
- if (ra->ra_state == DK_CLOSED)
- if (ra_putonline(ra) == MSCP_FAILED) {
- bp->b_error = EIO;
- goto bad;
- }
-
- /* Validate the request. */
- if (bounds_check_with_label(bp, ra->ra_disk.dk_label) == -1)
- goto done;
-
- /* Make some statistics... /bqt */
- s = splbio();
- disk_busy(&ra->ra_disk);
- splx(s);
- mscp_strategy(bp, ra->ra_dev.dv_parent);
- return;
-
- bad:
- bp->b_flags |= B_ERROR;
- bp->b_resid = bp->b_bcount;
- done:
- s = splbio();
- biodone(bp);
- splx(s);
-}
-
-int
-raread(dev_t dev, struct uio *uio)
-{
-
- return (physio(rastrategy, dev, B_READ, minphys, uio));
-}
-
-int
-rawrite(dev_t dev, struct uio *uio)
-{
-
- return (physio(rastrategy, dev, B_WRITE, minphys, uio));
-}
-
-/*
- * I/O controls.
- */
-int
-raioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- int unit = DISKUNIT(dev);
- struct disklabel *lp, *tp;
- struct ra_softc *ra = ra_cd.cd_devs[unit];
- int error = 0;
-
- lp = ra->ra_disk.dk_label;
-
- switch (cmd) {
- case DIOCGPDINFO:
- ragetdisklabel(dev, ra, (struct disklabel *)data, 1);
- break;
-
- case DIOCGDINFO:
- bcopy(lp, data, sizeof (struct disklabel));
- break;
-
- case DIOCGPART:
- ((struct partinfo *)data)->disklab = lp;
- ((struct partinfo *)data)->part =
- &lp->d_partitions[DISKPART(dev)];
- break;
-
- case DIOCWDINFO:
- case DIOCSDINFO:
- tp = (struct disklabel *)data;
-
- if ((flag & FWRITE) == 0)
- error = EBADF;
- else {
- error = setdisklabel(lp, tp, 0);
- if (error == 0 && cmd == DIOCWDINFO) {
- error = writedisklabel(dev, rastrategy, lp);
- }
- }
- break;
-
- default:
- error = ENOTTY;
- break;
- }
- return (error);
-}
-
-
-int
-radump(dev_t dev, daddr_t blkno, caddr_t va, size_t size)
-{
- return ENXIO;
-}
-
-/*
- * Return the size of a partition, if known, or -1 if not.
- */
-daddr_t
-rasize(dev_t dev)
-{
- int unit = DISKUNIT(dev), part = DISKPART(dev);
- struct ra_softc *ra;
- struct disklabel *lp;
-
- if (unit >= ra_cd.cd_ndevs || ra_cd.cd_devs[unit] == NULL)
- return -1;
-
- ra = ra_cd.cd_devs[unit];
-
- if (ra->ra_state == DK_CLOSED)
- if (ra_putonline(ra) == MSCP_FAILED)
- return -1;
-
- lp = ra->ra_disk.dk_label;
- if (part >= lp->d_npartitions ||
- lp->d_partitions[part].p_fstype != FS_SWAP)
- return -1;
- else
- return DL_GETPSIZE(&lp->d_partitions[part]) *
- (lp->d_secsize / DEV_BSIZE);
-}
-
-#endif /* NRA */
-
-#if NRX
-
-int rxmatch(struct device *, struct cfdata *, void *);
-int rxopen(dev_t, int, int, struct proc *);
-int rxclose(dev_t, int, int, struct proc *);
-void rxstrategy(struct buf *);
-int rxread(dev_t, struct uio *);
-int rxwrite(dev_t, struct uio *);
-int rxioctl(dev_t, int, caddr_t, int, struct proc *);
-int rxdump(dev_t, daddr_t, caddr_t, size_t);
-daddr_t rxsize(dev_t);
-
-const struct cfattach rx_ca = {
- sizeof(struct rx_softc), (cfmatch_t)rxmatch, rxattach
-};
-
-/*
- * More driver definitions, for generic MSCP code.
- */
-
-int
-rxmatch(struct device *parent, struct cfdata *cf, void *aux)
-{
- struct drive_attach_args *da = aux;
- struct mscp *mp = da->da_mp;
-
- if ((da->da_typ & MSCPBUS_DISK) == 0)
- return 0;
- if (cf->cf_loc[0] != -1 && cf->cf_loc[0] != mp->mscp_unit)
- return 0;
- /*
- * Check if this disk is a floppy; then configure it.
- * Seems to be a safe way to test it per Chris Torek.
- */
- if (MSCP_MID_ECH(1, mp->mscp_guse.guse_mediaid) == 'X' - '@')
- return 1;
- return 0;
-}
-
-#endif /* NRX */
-
-/*
- * The attach routine only checks and prints drive type.
- * Bringing the disk online is done when the disk is accessed
- * the first time.
- */
-void
-rxattach(struct device *parent, struct device *self, void *aux)
-{
- struct rx_softc *rx = (void *)self;
- struct drive_attach_args *da = aux;
- struct mscp *mp = da->da_mp;
- struct mscp_softc *mi = (void *)parent;
-
- bcopy(&mp->mscp_guse, &rx->ra_guse, sizeof(struct mscpv_guse));
- rx->ra_state = DK_CLOSED;
- rx->ra_hwunit = mp->mscp_unit;
- mi->mi_dp[mp->mscp_unit] = self;
-
- rx->ra_disk.dk_name = rx->ra_dev.dv_xname;
- disk_attach(&rx->ra_dev, &rx->ra_disk);
-
- disk_printtype(mp->mscp_unit, mp->mscp_guse.guse_mediaid);
-#ifdef DEBUG
- printf("%s: nspt %d group %d ngpc %d rct %d nrpt %d nrct %d\n",
- self->dv_xname, mp->mscp_guse.guse_nspt, mp->mscp_guse.guse_group,
- mp->mscp_guse.guse_ngpc, mp->mscp_guse.guse_rctsize,
- mp->mscp_guse.guse_nrpt, mp->mscp_guse.guse_nrct);
-#endif
-}
-
-/*
- * (Try to) put the drive online. This is done the first time the
- * drive is opened, or if it has fallen offline.
- */
-int
-rx_putonline(struct rx_softc *rx)
-{
- struct mscp *mp;
- struct mscp_softc *mi = (struct mscp_softc *)rx->ra_dev.dv_parent;
- volatile int i;
-
- /* caller may be in DK_RDLABEL state */
- if (rx->ra_state == DK_OPEN)
- rx->ra_state = DK_CLOSED;
- mp = mscp_getcp(mi, MSCP_WAIT);
- mp->mscp_opcode = M_OP_ONLINE;
- mp->mscp_unit = rx->ra_hwunit;
- mp->mscp_cmdref = 1;
- *mp->mscp_addr |= MSCP_OWN | MSCP_INT;
- DELAY(10000); /* XXX SIMH needs this. */
-
- /* Poll away */
- i = bus_space_read_2(mi->mi_iot, mi->mi_iph, 0);
- if (tsleep(&rx->ra_dev.dv_unit, PRIBIO, "rxonline", 100*100) != 0) {
- rx->ra_state = DK_CLOSED;
- return MSCP_FAILED;
- }
-
- return MSCP_DONE;
-}
-
-#if NRX
-
-/*
- * Open a drive.
- */
-/*ARGSUSED*/
-int
-rxopen(dev_t dev, int flag, int fmt, struct proc *p)
-{
- struct rx_softc *rx;
- int unit;
-
- /*
- * Make sure this is a reasonable open request.
- */
- unit = DISKUNIT(dev);
- if (unit >= rx_cd.cd_ndevs)
- return ENXIO;
- rx = rx_cd.cd_devs[unit];
- if (rx == 0)
- return ENXIO;
-
- /*
- * If this is the first open; we must first try to put
- * the disk online (and read the label).
- */
- if (rx->ra_state == DK_CLOSED)
- if (rx_putonline(rx) == MSCP_FAILED)
- return ENXIO;
-
- return 0;
-}
-
-/* ARGSUSED */
-int
-rxclose(dev_t dev, int flags, int fmt, struct proc *p)
-{
- return (0);
-}
-
-/*
- * Queue a transfer request, and if possible, hand it to the controller.
- *
- * This routine is broken into two so that the internal version
- * udastrat1() can be called by the (nonexistent, as yet) bad block
- * revectoring routine.
- */
-void
-rxstrategy(struct buf *bp)
-{
- int unit;
- struct rx_softc *rx;
- int s;
-
- /*
- * Make sure this is a reasonable drive to use.
- */
- unit = DISKUNIT(bp->b_dev);
- if (unit >= rx_cd.cd_ndevs || (rx = rx_cd.cd_devs[unit]) == NULL) {
- bp->b_error = ENXIO;
- bp->b_flags |= B_ERROR;
- goto done;
- }
-
- /* If disk is not online, try to put it online */
- if (rx->ra_state == DK_CLOSED)
- if (rx_putonline(rx) == MSCP_FAILED) {
- bp->b_flags |= B_ERROR;
- bp->b_error = EIO;
- goto done;
- }
-
- /*
- * Determine the size of the transfer, and make sure it is
- * within the boundaries of the partition.
- */
- if (bp->b_blkno >= DL_GETDSIZE(rx->ra_disk.dk_label)) {
- bp->b_resid = bp->b_bcount;
- goto done;
- }
-
- /* Make some statistics... /bqt */
- s = splbio();
- disk_busy(&rx->ra_disk);
- splx(s);
- mscp_strategy(bp, rx->ra_dev.dv_parent);
- return;
-
-done:
- s = splbio();
- biodone(bp);
- splx(s);
-}
-
-int
-rxread(dev_t dev, struct uio *uio)
-{
-
- return (physio(rxstrategy, dev, B_READ, minphys, uio));
-}
-
-int
-rxwrite(dev_t dev, struct uio *uio)
-{
-
- return (physio(rxstrategy, dev, B_WRITE, minphys, uio));
-}
-
-/*
- * I/O controls.
- */
-int
-rxioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
-{
- int unit = DISKUNIT(dev);
- struct disklabel *lp;
- struct rx_softc *rx = rx_cd.cd_devs[unit];
- int error = 0;
-
- lp = rx->ra_disk.dk_label;
-
- switch (cmd) {
-
- case DIOCGDINFO:
- case DIOCGPDINFO: /* no separate 'physical' info available. */
- bcopy(lp, data, sizeof (struct disklabel));
- break;
-
- case DIOCGPART:
- ((struct partinfo *)data)->disklab = lp;
- ((struct partinfo *)data)->part =
- &lp->d_partitions[DISKPART(dev)];
- break;
-
-
- case DIOCWDINFO:
- case DIOCSDINFO:
- break;
-
- default:
- error = ENOTTY;
- break;
- }
- return (error);
-}
-
-int
-rxdump(dev_t dev, daddr_t blkno, caddr_t va, size_t size)
-{
-
- /* Not likely. */
- return ENXIO;
-}
-
-daddr_t
-rxsize(dev_t dev)
-{
-
- return -1;
-}
-
-#endif /* NRX */
-
-void rrdgram(struct device *, struct mscp *, struct mscp_softc *);
-void rriodone(struct device *, struct buf *);
-int rronline(struct device *, struct mscp *);
-int rrgotstatus(struct device *, struct mscp *);
-void rrreplace(struct device *, struct mscp *);
-int rrioerror(struct device *, struct mscp *, struct buf *);
-void rrfillin(struct buf *, struct mscp *);
-void rrbb(struct device *, struct mscp *, struct buf *);
-
-struct mscp_device ra_device = {
- rrdgram,
- rriodone,
- rronline,
- rrgotstatus,
- rrreplace,
- rrioerror,
- rrbb,
- rrfillin,
-};
-
-/*
- * Handle an error datagram.
- * This can come from an unconfigured drive as well.
- */
-void
-rrdgram(struct device *usc, struct mscp *mp, struct mscp_softc *mi)
-{
- if (mscp_decodeerror(usc == NULL?"unconf disk" : usc->dv_xname, mp, mi))
- return;
- /*
- * SDI status information bytes 10 and 11 are the microprocessor
- * error code and front panel code respectively. These vary per
- * drive type and are printed purely for field service information.
- */
- if (mp->mscp_format == M_FM_SDI)
- printf("\tsdi uproc error code 0x%x, front panel code 0x%x\n",
- mp->mscp_erd.erd_sdistat[10],
- mp->mscp_erd.erd_sdistat[11]);
-}
-
-void
-rriodone(struct device *usc, struct buf *bp)
-{
- int s;
- struct rx_softc *rx = NULL; /* Wall */
-
- int unit = DISKUNIT(bp->b_dev);
-#if NRA
- if (major(bp->b_dev) == RAMAJOR)
- rx = ra_cd.cd_devs[unit];
-#endif
-#if NRX
- if (major(bp->b_dev) != RAMAJOR)
- rx = rx_cd.cd_devs[unit];
-#endif
-
- s = splbio();
- disk_unbusy(&rx->ra_disk, bp->b_bcount - bp->b_resid,
- bp->b_flags & B_READ);
- biodone(bp);
- splx(s);
-}
-
-/*
- * A drive came on line. Check its type and size. Return DONE if
- * we think the drive is truly on line. In any case, awaken anyone
- * sleeping on the drive on-line-ness.
- */
-int
-rronline(struct device *usc, struct mscp *mp)
-{
- struct rx_softc *rx = (struct rx_softc *)usc;
-
- wakeup((caddr_t)&usc->dv_unit);
- if ((mp->mscp_status & M_ST_MASK) != M_ST_SUCCESS) {
- printf("%s: attempt to bring on line failed: ", usc->dv_xname);
- mscp_printevent(mp);
- return (MSCP_FAILED);
- }
-
- rx->ra_state = DK_OPEN;
- rx->ra_unitsize = mp->mscp_onle.onle_unitsize;
-
- return (MSCP_DONE);
-}
-
-/*
- * We got some (configured) unit's status. Return DONE if it succeeded.
- */
-int
-rrgotstatus(struct device *usc, struct mscp *mp)
-{
- if ((mp->mscp_status & M_ST_MASK) != M_ST_SUCCESS) {
- printf("%s: attempt to get status failed: ", usc->dv_xname);
- mscp_printevent(mp);
- return (MSCP_FAILED);
- }
- /* record for (future) bad block forwarding and whatever else */
-#ifdef notyet
- uda_rasave(ui->ui_unit, mp, 1);
-#endif
- return (MSCP_DONE);
-}
-
-/*
- * A replace operation finished.
- */
-/*ARGSUSED*/
-void
-rrreplace(struct device *usc, struct mscp *mp)
-{
-
- panic("udareplace");
-}
-
-/*
- * A transfer failed. We get a chance to fix or restart it.
- * Need to write the bad block forwaring code first....
- */
-/*ARGSUSED*/
-int
-rrioerror(struct device *usc, struct mscp *mp, struct buf *bp)
-{
- struct ra_softc *ra = (void *)usc;
- int code = mp->mscp_event;
-
- switch (code & M_ST_MASK) {
- /* The unit has fallen offline. Try to figure out why. */
- case M_ST_OFFLINE:
- bp->b_flags |= B_ERROR;
- bp->b_error = EIO;
- ra->ra_state = DK_CLOSED;
- if (code & M_OFFLINE_UNMOUNTED)
- printf("%s: not mounted/spun down\n", usc->dv_xname);
- if (code & M_OFFLINE_DUPLICATE)
- printf("%s: duplicate unit number!!!\n", usc->dv_xname);
- return MSCP_DONE;
-
- case M_ST_AVAILABLE:
- ra->ra_state = DK_CLOSED; /* Force another online */
- return MSCP_DONE;
-
- default:
- printf("%s:", usc->dv_xname);
- break;
- }
- return (MSCP_FAILED);
-}
-
-/*
- * Fill in disk addresses in a mscp packet waiting for transfer.
- */
-void
-rrfillin(struct buf *bp, struct mscp *mp)
-{
- struct rx_softc *rx = 0; /* Wall */
- struct disklabel *lp;
- int unit = DISKUNIT(bp->b_dev);
- int part = DISKPART(bp->b_dev);
-
-#if NRA
- if (major(bp->b_dev) == RAMAJOR)
- rx = ra_cd.cd_devs[unit];
-#endif
-#if NRX
- if (major(bp->b_dev) != RAMAJOR)
- rx = rx_cd.cd_devs[unit];
-#endif
- lp = rx->ra_disk.dk_label;
-
- mp->mscp_seq.seq_lbn = DL_GETPOFFSET(&lp->d_partitions[part]) + bp->b_blkno;
- mp->mscp_unit = rx->ra_hwunit;
- mp->mscp_seq.seq_bytecount = bp->b_bcount;
-}
-
-/*
- * A bad block related operation finished.
- */
-/*ARGSUSED*/
-void
-rrbb(struct device *usc, struct mscp *mp, struct buf *bp)
-{
-
- panic("udabb");
-}
diff --git a/sys/arch/vax/mscp/mscp_subr.c b/sys/arch/vax/mscp/mscp_subr.c
deleted file mode 100644
index e817b2c5aaa..00000000000
--- a/sys/arch/vax/mscp/mscp_subr.c
+++ /dev/null
@@ -1,868 +0,0 @@
-/* $OpenBSD: mscp_subr.c,v 1.14 2015/07/04 12:49:55 dlg Exp $ */
-/* $NetBSD: mscp_subr.c,v 1.18 2001/11/13 07:38:28 lukem Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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.
- *
- * @(#)mscp.c 7.5 (Berkeley) 12/16/90
- */
-
-/*
- * MSCP generic driver routines
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-
-#include <machine/bus.h>
-#include <machine/sid.h>
-
-#include <arch/vax/mscp/mscp.h>
-#include <arch/vax/mscp/mscpreg.h>
-#include <arch/vax/mscp/mscpvar.h>
-
-#include "ra.h"
-#include "mt.h"
-
-int mscp_match(struct device *, struct cfdata *, void *);
-void mscp_attach(struct device *, struct device *, void *);
-void mscp_start(struct mscp_softc *);
-int mscp_init(struct mscp_softc *);
-void mscp_initds(struct mscp_softc *);
-int mscp_waitstep(struct mscp_softc *, int, int);
-
-struct cfattach mscpbus_ca = {
- sizeof(struct mscp_softc), (cfmatch_t)mscp_match, mscp_attach
-};
-
-struct cfdriver mscpbus_cd = {
- NULL, "mscpbus", DV_DULL
-};
-
-#define READ_SA (bus_space_read_2(mi->mi_iot, mi->mi_sah, 0))
-#define READ_IP (bus_space_read_2(mi->mi_iot, mi->mi_iph, 0))
-#define WRITE_IP(x) bus_space_write_2(mi->mi_iot, mi->mi_iph, 0, (x))
-#define WRITE_SW(x) bus_space_write_2(mi->mi_iot, mi->mi_swh, 0, (x))
-
-struct mscp slavereply;
-
-/*
- * This function is for delay during init. Some MSCP clone card (Dilog)
- * can't handle fast read from its registers, and therefore need
- * a delay between them.
- */
-
-#define DELAYTEN 1000
-int
-mscp_waitstep(mi, mask, result)
- struct mscp_softc *mi;
- int mask, result;
-{
- int status = 1;
-
- if ((READ_SA & mask) != result) {
- volatile int count = 0;
- while ((READ_SA & mask) != result) {
- DELAY(10000);
- count += 1;
- if (count > DELAYTEN)
- break;
- }
- if (count > DELAYTEN)
- status = 0;
- }
- return status;
-}
-
-int
-mscp_match(parent, match, aux)
- struct device *parent;
- struct cfdata *match;
- void *aux;
-{
- struct mscp_attach_args *ma = aux;
-
-#if NRA || NRX
- if (ma->ma_type & MSCPBUS_DISK)
- return 1;
-#endif
-#if NMT
- if (ma->ma_type & MSCPBUS_TAPE)
- return 1;
-#endif
- return 0;
-};
-
-void
-mscp_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct mscp_attach_args *ma = aux;
- struct mscp_softc *mi = (void *)self;
- volatile struct mscp *mp;
- volatile int i;
- int timeout, next = 0;
-
- mi->mi_mc = ma->ma_mc;
- mi->mi_me = NULL;
- mi->mi_type = ma->ma_type;
- mi->mi_uda = ma->ma_uda;
- mi->mi_dmat = ma->ma_dmat;
- mi->mi_dmam = ma->ma_dmam;
- mi->mi_iot = ma->ma_iot;
- mi->mi_iph = ma->ma_iph;
- mi->mi_sah = ma->ma_sah;
- mi->mi_swh = ma->ma_swh;
- mi->mi_ivec = ma->ma_ivec;
- mi->mi_adapnr = ma->ma_adapnr;
- mi->mi_ctlrnr = ma->ma_ctlrnr;
- *ma->ma_softc = mi;
- /*
- * Go out to init the bus, so that we can give commands
- * to its devices.
- */
- mi->mi_cmd.mri_size = NCMD;
- mi->mi_cmd.mri_desc = mi->mi_uda->mp_ca.ca_cmddsc;
- mi->mi_cmd.mri_ring = mi->mi_uda->mp_cmd;
- mi->mi_rsp.mri_size = NRSP;
- mi->mi_rsp.mri_desc = mi->mi_uda->mp_ca.ca_rspdsc;
- mi->mi_rsp.mri_ring = mi->mi_uda->mp_rsp;
- bufq_init(&mi->mi_bufq, BUFQ_FIFO);
-
- if (mscp_init(mi)) {
- printf("%s: can't init, controller hung\n",
- mi->mi_dev.dv_xname);
- return;
- }
- for (i = 0; i < NCMD; i++) {
- mi->mi_mxiuse |= (1 << i);
- if (bus_dmamap_create(mi->mi_dmat, (64*1024), 16, (64*1024),
- 0, BUS_DMA_NOWAIT, &mi->mi_xi[i].mxi_dmam)) {
- printf("Couldn't alloc dmamap %d\n", i);
- return;
- }
- }
-
-
-#if NRA
- if (ma->ma_type & MSCPBUS_DISK) {
- extern struct mscp_device ra_device;
-
- mi->mi_me = &ra_device;
- }
-#endif
-#if NMT
- if (ma->ma_type & MSCPBUS_TAPE) {
- extern struct mscp_device mt_device;
-
- mi->mi_me = &mt_device;
- }
-#endif
- /*
- * Go out and search for sub-units on this MSCP bus,
- * and call config_found for each found.
- */
-findunit:
- mp = mscp_getcp(mi, MSCP_DONTWAIT);
- if (mp == NULL)
- panic("mscpattach: no packets");
- mp->mscp_opcode = M_OP_GETUNITST;
- mp->mscp_unit = next;
- mp->mscp_modifier = M_GUM_NEXTUNIT;
- *mp->mscp_addr |= MSCP_OWN | MSCP_INT;
- slavereply.mscp_opcode = 0;
-
- i = bus_space_read_2(mi->mi_iot, mi->mi_iph, 0);
- mp = &slavereply;
- timeout = 1000;
- while (timeout-- > 0) {
- DELAY(10000);
- if (mp->mscp_opcode)
- goto gotit;
- }
- printf("%s: no response to Get Unit Status request\n",
- mi->mi_dev.dv_xname);
- return;
-
-gotit: /*
- * Got a slave response. If the unit is there, use it.
- */
- switch (mp->mscp_status & M_ST_MASK) {
-
- case M_ST_SUCCESS: /* worked */
- case M_ST_AVAILABLE: /* found another drive */
- break; /* use it */
-
- case M_ST_OFFLINE:
- /*
- * Figure out why it is off line. It may be because
- * it is nonexistent, or because it is spun down, or
- * for some other reason.
- */
- switch (mp->mscp_status & ~M_ST_MASK) {
-
- case M_OFFLINE_UNKNOWN:
- /*
- * No such drive, and there are none with
- * higher unit numbers either, if we are
- * using M_GUM_NEXTUNIT.
- */
- mi->mi_ierr = 3;
- return;
-
- case M_OFFLINE_UNMOUNTED:
- /*
- * The drive is not spun up. Use it anyway.
- *
- * N.B.: this seems to be a common occurrance
- * after a power failure. The first attempt
- * to bring it on line seems to spin it up
- * (and thus takes several minutes). Perhaps
- * we should note here that the on-line may
- * take longer than usual.
- */
- break;
-
- default:
- /*
- * In service, or something else equally unusable.
- */
- printf("%s: unit %d off line: ", mi->mi_dev.dv_xname,
- mp->mscp_unit);
- mscp_printevent((struct mscp *)mp);
- next++;
- goto findunit;
- }
- break;
-
- default:
- printf("%s: unable to get unit status: ", mi->mi_dev.dv_xname);
- mscp_printevent((struct mscp *)mp);
- return;
- }
-
- /*
- * If we get a lower number, we have circulated around all
- * devices and are finished, otherwise try to find next unit.
- * We shouldn't ever get this, it's a workaround.
- */
- if (mp->mscp_unit < next)
- return;
-
- next = mp->mscp_unit + 1;
- goto findunit;
-}
-
-
-/*
- * The ctlr gets initialised, normally after boot but may also be
- * done if the ctlr gets in an unknown state. Returns 1 if init
- * fails, 0 otherwise.
- */
-int
-mscp_init(mi)
- struct mscp_softc *mi;
-{
- struct mscp *mp;
- volatile int i;
- int status, count;
- unsigned int j = 0;
-
- /*
- * While we are thinking about it, reset the next command
- * and response indices.
- */
- mi->mi_cmd.mri_next = 0;
- mi->mi_rsp.mri_next = 0;
-
- mi->mi_flags |= MSC_IGNOREINTR;
-
- if ((mi->mi_type & MSCPBUS_KDB) == 0)
- WRITE_IP(0); /* Kick off */;
-
- status = mscp_waitstep(mi, MP_STEP1, MP_STEP1);/* Wait to it wakes up */
- if (status == 0)
- return 1; /* Init failed */
- if (READ_SA & MP_ERR) {
- (*mi->mi_mc->mc_saerror)(mi->mi_dev.dv_parent, 0);
- return 1;
- }
-
- /* step1 */
- WRITE_SW(MP_ERR | (NCMDL2 << 11) | (NRSPL2 << 8) |
- MP_IE | (mi->mi_ivec >> 2));
- status = mscp_waitstep(mi, STEP1MASK, STEP1GOOD);
- if (status == 0) {
- (*mi->mi_mc->mc_saerror)(mi->mi_dev.dv_parent, 0);
- return 1;
- }
-
- /* step2 */
- WRITE_SW((mi->mi_dmam->dm_segs[0].ds_addr & 0xffff) +
- offsetof(struct mscp_pack, mp_ca.ca_rspdsc[0]));
- status = mscp_waitstep(mi, STEP2MASK, STEP2GOOD(mi->mi_ivec >> 2));
- if (status == 0) {
- (*mi->mi_mc->mc_saerror)(mi->mi_dev.dv_parent, 0);
- return 1;
- }
-
- /* step3 */
- WRITE_SW((mi->mi_dmam->dm_segs[0].ds_addr >> 16));
- status = mscp_waitstep(mi, STEP3MASK, STEP3GOOD);
- if (status == 0) {
- (*mi->mi_mc->mc_saerror)(mi->mi_dev.dv_parent, 0);
- return 1;
- }
- i = READ_SA & 0377;
- printf(": version %d model %d\n", i & 15, i >> 4);
-
-#define BURST 4 /* XXX */
- if (mi->mi_type & MSCPBUS_UDA) {
- WRITE_SW(MP_GO | (BURST - 1) << 2);
- printf("%s: DMA burst size set to %d\n",
- mi->mi_dev.dv_xname, BURST);
- }
- WRITE_SW(MP_GO);
-
- mscp_initds(mi);
- mi->mi_flags &= ~MSC_IGNOREINTR;
-
- /*
- * Set up all necessary info in the bus softc struct, get a
- * mscp packet and set characteristics for this controller.
- */
- mi->mi_credits = MSCP_MINCREDITS + 1;
- mp = mscp_getcp(mi, MSCP_DONTWAIT);
-
- mi->mi_credits = 0;
- mp->mscp_opcode = M_OP_SETCTLRC;
- mp->mscp_unit = mp->mscp_modifier = mp->mscp_flags =
- mp->mscp_sccc.sccc_version = mp->mscp_sccc.sccc_hosttimo =
- mp->mscp_sccc.sccc_time = mp->mscp_sccc.sccc_time1 =
- mp->mscp_sccc.sccc_errlgfl = 0;
- mp->mscp_sccc.sccc_ctlrflags = M_CF_ATTN | M_CF_MISC | M_CF_THIS;
- *mp->mscp_addr |= MSCP_OWN | MSCP_INT;
- i = READ_IP;
-
- count = 0;
- while (count < DELAYTEN) {
- if (((volatile int)mi->mi_flags & MSC_READY) != 0)
- break;
- if ((j = READ_SA) & MP_ERR)
- goto out;
- DELAY(10000);
- count += 1;
- }
- if (count == DELAYTEN) {
-out:
- printf("%s: couldn't set ctlr characteristics, sa=%x\n",
- mi->mi_dev.dv_xname, j);
- return 1;
- }
- return 0;
-}
-
-/*
- * Initialise the various data structures that control the mscp protocol.
- */
-void
-mscp_initds(mi)
- struct mscp_softc *mi;
-{
- struct mscp_pack *ud = mi->mi_uda;
- struct mscp *mp;
- int i;
-
- for (i = 0, mp = ud->mp_rsp; i < NRSP; i++, mp++) {
- ud->mp_ca.ca_rspdsc[i] = MSCP_OWN | MSCP_INT |
- (mi->mi_dmam->dm_segs[0].ds_addr +
- offsetof(struct mscp_pack, mp_rsp[i].mscp_cmdref));
- mp->mscp_addr = &ud->mp_ca.ca_rspdsc[i];
- mp->mscp_msglen = MSCP_MSGLEN;
- }
- for (i = 0, mp = ud->mp_cmd; i < NCMD; i++, mp++) {
- ud->mp_ca.ca_cmddsc[i] = MSCP_INT |
- (mi->mi_dmam->dm_segs[0].ds_addr +
- offsetof(struct mscp_pack, mp_cmd[i].mscp_cmdref));
- mp->mscp_addr = &ud->mp_ca.ca_cmddsc[i];
- mp->mscp_msglen = MSCP_MSGLEN;
- if (mi->mi_type & MSCPBUS_TAPE)
- mp->mscp_vcid = 1;
- }
-}
-
-static void mscp_kickaway(struct mscp_softc *);
-
-void
-mscp_intr(mi)
- struct mscp_softc *mi;
-{
- struct mscp_pack *ud = mi->mi_uda;
-
- if (mi->mi_flags & MSC_IGNOREINTR)
- return;
- /*
- * Check for response and command ring transitions.
- */
- if (ud->mp_ca.ca_rspint) {
- ud->mp_ca.ca_rspint = 0;
- mscp_dorsp(mi);
- }
- if (ud->mp_ca.ca_cmdint) {
- ud->mp_ca.ca_cmdint = 0;
- MSCP_DOCMD(mi);
- }
-
- /*
- * If there are any not-yet-handled request, try them now.
- */
- if (bufq_peek(&mi->mi_bufq))
- mscp_kickaway(mi);
-}
-
-int
-mscp_print(aux, name)
- void *aux;
- const char *name;
-{
- struct drive_attach_args *da = aux;
- struct mscp *mp = da->da_mp;
- int type = mp->mscp_guse.guse_mediaid;
-
- if (name) {
- printf("%c%c", MSCP_MID_CHAR(2, type), MSCP_MID_CHAR(1, type));
- if (MSCP_MID_ECH(0, type))
- printf("%c", MSCP_MID_CHAR(0, type));
- printf("%d at %s drive %d", MSCP_MID_NUM(type), name,
- mp->mscp_unit);
- }
- return UNCONF;
-}
-
-/*
- * common strategy routine for all types of MSCP devices.
- */
-void
-mscp_strategy(bp, usc)
- struct buf *bp;
- struct device *usc;
-{
- struct mscp_softc *mi = (void *)usc;
- int s = spl6();
-
- bufq_queue(&mi->mi_bufq, bp);
- mscp_kickaway(mi);
- splx(s);
-}
-
-
-void
-mscp_kickaway(mi)
- struct mscp_softc *mi;
-{
- struct buf *bp;
- struct mscp *mp;
- int next;
-
- while ((bp = bufq_dequeue(&mi->mi_bufq))) {
- /*
- * Ok; we are ready to try to start a xfer. Get a MSCP packet
- * and try to start...
- */
- if ((mp = mscp_getcp(mi, MSCP_DONTWAIT)) == NULL) {
- if (mi->mi_credits > MSCP_MINCREDITS)
- printf("%s: command ring too small\n",
- mi->mi_dev.dv_parent->dv_xname);
- /*
- * By some (strange) reason we didn't get a MSCP packet.
- * Just return and wait for free packets.
- */
- bufq_requeue(&mi->mi_bufq, bp);
- return;
- }
-
- if ((next = (ffs(mi->mi_mxiuse) - 1)) < 0)
- panic("no mxi buffers");
- mi->mi_mxiuse &= ~(1 << next);
- if (mi->mi_xi[next].mxi_inuse)
- panic("mxi inuse");
- /*
- * Set up the MSCP packet and ask the ctlr to start.
- */
- mp->mscp_opcode =
- (bp->b_flags & B_READ) ? M_OP_READ : M_OP_WRITE;
- mp->mscp_cmdref = next;
- mi->mi_xi[next].mxi_bp = bp;
- mi->mi_xi[next].mxi_mp = mp;
- mi->mi_xi[next].mxi_inuse = 1;
- bp->b_resid = next;
- (*mi->mi_me->me_fillin)(bp, mp);
- (*mi->mi_mc->mc_go)(mi->mi_dev.dv_parent, &mi->mi_xi[next]);
- }
-}
-
-void
-mscp_dgo(mi, mxi)
- struct mscp_softc *mi;
- struct mscp_xi *mxi;
-{
- volatile int i;
- struct mscp *mp;
-
- /*
- * Fill in the MSCP packet and move the buffer to the I/O wait queue.
- */
- mp = mxi->mxi_mp;
- mp->mscp_seq.seq_buffer = mxi->mxi_dmam->dm_segs[0].ds_addr;
-
- *mp->mscp_addr |= MSCP_OWN | MSCP_INT;
- i = READ_IP;
-}
-
-#ifdef DIAGNOSTIC
-/*
- * Dump the entire contents of an MSCP packet in hex. Mainly useful
- * for debugging....
- */
-void
-mscp_hexdump(mp)
- struct mscp *mp;
-{
- long *p = (long *) mp;
- int i = mp->mscp_msglen;
-
- if (i > 256) /* sanity */
- i = 256;
- i /= sizeof (*p); /* ASSUMES MULTIPLE OF sizeof(long) */
- while (--i >= 0)
- printf("0x%x ", (int)*p++);
- printf("\n");
-}
-#endif
-
-/*
- * MSCP error reporting
- */
-
-/*
- * Messages for the various subcodes.
- */
-static char unknown_msg[] = "unknown subcode";
-
-/*
- * Subcodes for Success (0)
- */
-static char *succ_msgs[] = {
- "normal", /* 0 */
- "spin down ignored", /* 1 = Spin-Down Ignored */
- "still connected", /* 2 = Still Connected */
- unknown_msg,
- "dup. unit #", /* 4 = Duplicate Unit Number */
- unknown_msg,
- unknown_msg,
- unknown_msg,
- "already online", /* 8 = Already Online */
- unknown_msg,
- unknown_msg,
- unknown_msg,
- unknown_msg,
- unknown_msg,
- unknown_msg,
- unknown_msg,
- "still online", /* 16 = Still Online */
-};
-
-/*
- * Subcodes for Invalid Command (1)
- */
-static char *icmd_msgs[] = {
- "invalid msg length", /* 0 = Invalid Message Length */
-};
-
-/*
- * Subcodes for Command Aborted (2)
- */
-/* none known */
-
-/*
- * Subcodes for Unit Offline (3)
- */
-static char *offl_msgs[] = {
- "unknown drive", /* 0 = Unknown, or online to other ctlr */
- "not mounted", /* 1 = Unmounted, or RUN/STOP at STOP */
- "inoperative", /* 2 = Unit Inoperative */
- unknown_msg,
- "duplicate", /* 4 = Duplicate Unit Number */
- unknown_msg,
- unknown_msg,
- unknown_msg,
- "in diagnosis", /* 8 = Disabled by FS or diagnostic */
-};
-
-/*
- * Subcodes for Unit Available (4)
- */
-/* none known */
-
-/*
- * Subcodes for Media Format Error (5)
- */
-static char *media_fmt_msgs[] = {
- "fct unread - edc", /* 0 = FCT unreadable */
- "invalid sector header",/* 1 = Invalid Sector Header */
- "not 512 sectors", /* 2 = Not 512 Byte Sectors */
- "not formatted", /* 3 = Not Formatted */
- "fct ecc", /* 4 = FCT ECC */
-};
-
-/*
- * Subcodes for Write Protected (6)
- * N.B.: Code 6 subcodes are 7 bits higher than other subcodes
- * (i.e., bits 12-15).
- */
-static char *wrprot_msgs[] = {
- unknown_msg,
- "software", /* 1 = Software Write Protect */
- "hardware", /* 2 = Hardware Write Protect */
-};
-
-/*
- * Subcodes for Compare Error (7)
- */
-/* none known */
-
-/*
- * Subcodes for Data Error (8)
- */
-static char *data_msgs[] = {
- "forced error", /* 0 = Forced Error (software) */
- unknown_msg,
- "header compare", /* 2 = Header Compare Error */
- "sync timeout", /* 3 = Sync Timeout Error */
- unknown_msg,
- unknown_msg,
- unknown_msg,
- "uncorrectable ecc", /* 7 = Uncorrectable ECC */
- "1 symbol ecc", /* 8 = 1 bit ECC */
- "2 symbol ecc", /* 9 = 2 bit ECC */
- "3 symbol ecc", /* 10 = 3 bit ECC */
- "4 symbol ecc", /* 11 = 4 bit ECC */
- "5 symbol ecc", /* 12 = 5 bit ECC */
- "6 symbol ecc", /* 13 = 6 bit ECC */
- "7 symbol ecc", /* 14 = 7 bit ECC */
- "8 symbol ecc", /* 15 = 8 bit ECC */
-};
-
-/*
- * Subcodes for Host Buffer Access Error (9)
- */
-static char *host_buffer_msgs[] = {
- unknown_msg,
- "odd xfer addr", /* 1 = Odd Transfer Address */
- "odd xfer count", /* 2 = Odd Transfer Count */
- "non-exist. memory", /* 3 = Non-Existent Memory */
- "memory parity", /* 4 = Memory Parity Error */
-};
-
-/*
- * Subcodes for Controller Error (10)
- */
-static char *cntlr_msgs[] = {
- unknown_msg,
- "serdes overrun", /* 1 = Serialiser/Deserialiser Overrun */
- "edc", /* 2 = Error Detection Code? */
- "inconsistent internal data struct",/* 3 = Internal Error */
-};
-
-/*
- * Subcodes for Drive Error (11)
- */
-static char *drive_msgs[] = {
- unknown_msg,
- "sdi command timeout", /* 1 = SDI Command Timeout */
- "ctlr detected protocol",/* 2 = Controller Detected Protocol Error */
- "positioner", /* 3 = Positioner Error */
- "lost rd/wr ready", /* 4 = Lost R/W Ready Error */
- "drive clock dropout", /* 5 = Lost Drive Clock */
- "lost recvr ready", /* 6 = Lost Receiver Ready */
- "drive detected error", /* 7 = Drive Error */
- "ctlr detected pulse or parity",/* 8 = Pulse or Parity Error */
-};
-
-/*
- * The following table correlates message codes with the
- * decoding strings.
- */
-struct code_decode {
- char *cdc_msg;
- int cdc_nsubcodes;
- char **cdc_submsgs;
-} code_decode[] = {
-#define SC(m) sizeof (m) / sizeof (m[0]), m
- {"success", SC(succ_msgs)},
- {"invalid command", SC(icmd_msgs)},
- {"command aborted", 0, 0},
- {"unit offline", SC(offl_msgs)},
- {"unit available", 0, 0},
- {"media format error", SC(media_fmt_msgs)},
- {"write protected", SC(wrprot_msgs)},
- {"compare error", 0, 0},
- {"data error", SC(data_msgs)},
- {"host buffer access error", SC(host_buffer_msgs)},
- {"controller error", SC(cntlr_msgs)},
- {"drive error", SC(drive_msgs)},
-#undef SC
-};
-
-/*
- * Print the decoded error event from an MSCP error datagram.
- */
-void
-mscp_printevent(mp)
- struct mscp *mp;
-{
- int event = mp->mscp_event;
- struct code_decode *cdc;
- int c, sc;
- char *cm, *scm;
-
- /*
- * The code is the lower six bits of the event number (aka
- * status). If that is 6 (write protect), the subcode is in
- * bits 12-15; otherwise, it is in bits 5-11.
- * I WONDER WHAT THE OTHER BITS ARE FOR. IT SURE WOULD BE
- * NICE IF DEC SOLD DOCUMENTATION FOR THEIR OWN CONTROLLERS.
- */
- c = event & M_ST_MASK;
- sc = (c != 6 ? event >> 5 : event >> 12) & 0x7ff;
- if (c >= sizeof code_decode / sizeof code_decode[0])
- cm = "- unknown code", scm = "??";
- else {
- cdc = &code_decode[c];
- cm = cdc->cdc_msg;
- if (sc >= cdc->cdc_nsubcodes)
- scm = unknown_msg;
- else
- scm = cdc->cdc_submsgs[sc];
- }
- printf(" %s (%s) (code %d, subcode %d)\n", cm, scm, c, sc);
-}
-
-static char *codemsg[16] = {
- "lbn", "code 1", "code 2", "code 3",
- "code 4", "code 5", "rbn", "code 7",
- "code 8", "code 9", "code 10", "code 11",
- "code 12", "code 13", "code 14", "code 15"
-};
-/*
- * Print the code and logical block number for an error packet.
- * THIS IS PROBABLY PECULIAR TO DISK DRIVES. IT SURE WOULD BE
- * NICE IF DEC SOLD DOCUMENTATION FOR THEIR OWN CONTROLLERS.
- */
-int
-mscp_decodeerror(name, mp, mi)
- char *name;
- struct mscp *mp;
- struct mscp_softc *mi;
-{
- int issoft;
- /*
- * We will get three sdi errors of type 11 after autoconfig
- * is finished; depending of searching for non-existing units.
- * How can we avoid this???
- */
- if (((mp->mscp_event & M_ST_MASK) == 11) && (mi->mi_ierr++ < 3))
- return 1;
- /*
- * For bad blocks, mp->mscp_erd.erd_hdr identifies a code and
- * the logical block number. Code 0 is a regular block; code 6
- * is a replacement block. The remaining codes are currently
- * undefined. The code is in the upper four bits of the header
- * (bits 0-27 are the lbn).
- */
- issoft = mp->mscp_flags & (M_LF_SUCC | M_LF_CONT);
-#define BADCODE(h) (codemsg[(unsigned)(h) >> 28])
-#define BADLBN(h) ((h) & 0xfffffff)
-
- printf("%s: drive %d %s error datagram%s:", name, mp->mscp_unit,
- issoft ? "soft" : "hard",
- mp->mscp_flags & M_LF_CONT ? " (continuing)" : "");
- switch (mp->mscp_format & 0377) {
-
- case M_FM_CTLRERR: /* controller error */
- break;
-
- case M_FM_BUSADDR: /* host memory access error */
- printf(" memory addr 0x%x:", (int)mp->mscp_erd.erd_busaddr);
- break;
-
- case M_FM_DISKTRN:
- printf(" unit %d: level %d retry %d, %s %d:",
- mp->mscp_unit,
- mp->mscp_erd.erd_level, mp->mscp_erd.erd_retry,
- BADCODE(mp->mscp_erd.erd_hdr),
- (int)BADLBN(mp->mscp_erd.erd_hdr));
- break;
-
- case M_FM_SDI:
- printf(" unit %d: %s %d:", mp->mscp_unit,
- BADCODE(mp->mscp_erd.erd_hdr),
- (int)BADLBN(mp->mscp_erd.erd_hdr));
- break;
-
- case M_FM_SMLDSK:
- printf(" unit %d: small disk error, cyl %d:",
- mp->mscp_unit, mp->mscp_erd.erd_sdecyl);
- break;
-
- case M_FM_TAPETRN:
- printf(" unit %d: tape transfer error, grp 0x%x event 0%o:",
- mp->mscp_unit, mp->mscp_erd.erd_sdecyl, mp->mscp_event);
- break;
-
- case M_FM_STIERR:
- printf(" unit %d: STI error, event 0%o:", mp->mscp_unit,
- mp->mscp_event);
- break;
-
- default:
- printf(" unit %d: unknown error, format 0x%x:",
- mp->mscp_unit, mp->mscp_format);
- }
- mscp_printevent(mp);
- return 0;
-#undef BADCODE
-#undef BADLBN
-}
diff --git a/sys/arch/vax/mscp/mscp_tape.c b/sys/arch/vax/mscp/mscp_tape.c
deleted file mode 100644
index ecc06966a13..00000000000
--- a/sys/arch/vax/mscp/mscp_tape.c
+++ /dev/null
@@ -1,569 +0,0 @@
-/* $OpenBSD: mscp_tape.c,v 1.16 2013/06/11 16:42:13 deraadt Exp $ */
-/* $NetBSD: mscp_tape.c,v 1.16 2001/11/13 07:38:28 lukem Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-
-/*
- * MSCP tape device driver
- */
-
-/*
- * TODO
- * Write status handling code.
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/buf.h>
-#include <sys/ioccom.h>
-#include <sys/mtio.h>
-#include <sys/fcntl.h>
-#include <sys/malloc.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/conf.h>
-
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <arch/vax/mscp/mscp.h>
-#include <arch/vax/mscp/mscpreg.h>
-#include <arch/vax/mscp/mscpvar.h>
-
-/*
- * Drive status, per drive
- */
-struct mt_softc {
- struct device mt_dev; /* Autoconf struct */
- int mt_state; /* open/closed state */
- int mt_hwunit; /* Hardware unit number */
- int mt_inuse; /* Locks the tape drive for others */
- int mt_waswrite; /* Last operation was a write op */
- int mt_serex; /* Got serious exception */
- int mt_ioctlerr; /* Error after last ioctl */
-};
-
-#define MT_OFFLINE 0
-#define MT_ONLINE 1
-
-int mtmatch(struct device *, struct cfdata *, void *);
-void mtattach(struct device *, struct device *, void *);
-void mtdgram(struct device *, struct mscp *, struct mscp_softc *);
-void mtiodone(struct device *, struct buf *);
-int mtonline(struct device *, struct mscp *);
-int mtgotstatus(struct device *, struct mscp *);
-int mtioerror(struct device *, struct mscp *, struct buf *);
-void mtfillin(struct buf *, struct mscp *);
-int mtread(dev_t, struct uio *);
-int mtwrite(dev_t, struct uio *);
-int mtcmd(struct mt_softc *, int, int, int);
-void mtcmddone(struct device *, struct mscp *);
-int mt_putonline(struct mt_softc *);
-bdev_decl(mt);
-
-struct mscp_device mt_device = {
- mtdgram,
- mtiodone,
- mtonline,
- mtgotstatus,
- 0,
- mtioerror,
- 0,
- mtfillin,
- mtcmddone,
-};
-
-/* This is not good, should allow more than 4 tapes/device type */
-#define mtunit(dev) (minor(dev) & T_UNIT)
-#define mtnorewind(dev) (dev & T_NOREWIND)
-#define mthdensity(dev) (dev & T_1600BPI)
-
-struct cfattach mt_ca = {
- sizeof(struct mt_softc), (cfmatch_t)mtmatch, mtattach
-};
-
-struct cfdriver mt_cd = {
- NULL, "mt", DV_TAPE
-};
-
-/*
- * More driver definitions, for generic MSCP code.
- */
-
-int
-mtmatch(parent, cf, aux)
- struct device *parent;
- struct cfdata *cf;
- void *aux;
-{
- struct drive_attach_args *da = aux;
- struct mscp *mp = da->da_mp;
-
- if ((da->da_typ & MSCPBUS_TAPE) == 0)
- return 0;
- if (cf->cf_loc[0] != -1 && cf->cf_loc[0] != mp->mscp_unit)
- return 0;
- return 1;
-}
-
-/*
- * The attach routine only checks and prints drive type.
- */
-void
-mtattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct mt_softc *mt = (void *)self;
- struct drive_attach_args *da = aux;
- struct mscp *mp = da->da_mp;
- struct mscp_softc *mi = (void *)parent;
-
- mt->mt_hwunit = mp->mscp_unit;
- mi->mi_dp[mp->mscp_unit] = self;
-
- disk_printtype(mp->mscp_unit, mp->mscp_guse.guse_mediaid);
-}
-
-/*
- * (Try to) put the drive online. This is done the first time the
- * drive is opened, or if it has fallen offline.
- */
-int
-mt_putonline(mt)
- struct mt_softc *mt;
-{
- struct mscp *mp;
- struct mscp_softc *mi = (struct mscp_softc *)mt->mt_dev.dv_parent;
- volatile int i;
-
- mt->mt_state = MT_OFFLINE;
- mp = mscp_getcp(mi, MSCP_WAIT);
- mp->mscp_opcode = M_OP_ONLINE;
- mp->mscp_unit = mt->mt_hwunit;
- mp->mscp_cmdref = (long)&mt->mt_state;
- *mp->mscp_addr |= MSCP_OWN | MSCP_INT;
-
- /* Poll away */
- i = bus_space_read_2(mi->mi_iot, mi->mi_iph, 0);
- if (tsleep(&mt->mt_state, PRIBIO, "mtonline", 240 * hz))
- return MSCP_FAILED;
-
- if ((volatile int)mt->mt_state != MT_ONLINE)
- return MSCP_FAILED;
-
- return MSCP_DONE;
-}
-/*
- * Open a drive.
- */
-/*ARGSUSED*/
-int
-mtopen(dev, flag, fmt, p)
- dev_t dev;
- int flag, fmt;
- struct proc *p;
-{
- struct mt_softc *mt;
- int unit;
-
- /*
- * Make sure this is a reasonable open request.
- */
- unit = mtunit(dev);
- if (unit >= mt_cd.cd_ndevs)
- return ENXIO;
- mt = mt_cd.cd_devs[unit];
- if (mt == 0)
- return ENXIO;
-
- if (mt->mt_inuse)
- return EBUSY;
- mt->mt_inuse = 1;
-
- if (mt_putonline(mt) == MSCP_FAILED) {
- mt->mt_inuse = 0;
- return EIO;
- }
-
- return 0;
-}
-
-/* ARGSUSED */
-int
-mtclose(dev, flags, fmt, p)
- dev_t dev;
- int flags, fmt;
- struct proc *p;
-{
- int unit = mtunit(dev);
- struct mt_softc *mt = mt_cd.cd_devs[unit];
-
- /*
- * If we just have finished a writing, write EOT marks.
- */
- if ((flags & FWRITE) && mt->mt_waswrite) {
- mtcmd(mt, MTWEOF, 0, 0);
- mtcmd(mt, MTWEOF, 0, 0);
- mtcmd(mt, MTBSR, 1, 0);
- }
- if (mtnorewind(dev) == 0)
- mtcmd(mt, MTREW, 0, 1);
- if (mt->mt_serex)
- mtcmd(mt, -1, 0, 0);
-
- mt->mt_inuse = 0; /* Release the tape */
- return 0;
-}
-
-void
-mtstrategy(bp)
- struct buf *bp;
-{
- int unit;
- struct mt_softc *mt;
- int s;
-
- /*
- * Make sure this is a reasonable drive to use.
- */
- unit = mtunit(bp->b_dev);
- if (unit >= mt_cd.cd_ndevs || (mt = mt_cd.cd_devs[unit]) == NULL) {
- bp->b_error = ENXIO;
- goto bad;
- }
-
- mt->mt_waswrite = bp->b_flags & B_READ ? 0 : 1;
- mscp_strategy(bp, mt->mt_dev.dv_parent);
- return;
-
-bad:
- bp->b_flags |= B_ERROR;
- s = splbio();
- biodone(bp);
- splx(s);
-}
-
-int
-mtread(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
-
- return (physio(mtstrategy, dev, B_READ, minphys, uio));
-}
-
-int
-mtwrite(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
-
- return (physio(mtstrategy, dev, B_WRITE, minphys, uio));
-}
-
-void
-mtiodone(usc, bp)
- struct device *usc;
- struct buf *bp;
-{
- int s;
-
- s = splbio();
- biodone(bp);
- splx(s);
-}
-
-/*
- * Fill in drive addresses in a mscp packet waiting for transfer.
- */
-void
-mtfillin(bp, mp)
- struct buf *bp;
- struct mscp *mp;
-{
- int unit = mtunit(bp->b_dev);
- struct mt_softc *mt = mt_cd.cd_devs[unit];
-
- mp->mscp_unit = mt->mt_hwunit;
- if (mt->mt_serex == 2) {
- mp->mscp_modifier = M_MD_CLSEX;
- mt->mt_serex = 0;
- } else
- mp->mscp_modifier = 0;
-
- mp->mscp_seq.seq_bytecount = bp->b_bcount;
-}
-
-/*
- * Handle an error datagram.
- */
-void
-mtdgram(usc, mp, mi)
- struct device *usc;
- struct mscp *mp;
- struct mscp_softc *mi;
-{
- if (mscp_decodeerror(usc == NULL?"unconf mt" : usc->dv_xname, mp, mi))
- return;
-}
-
-/*
- * A drive came on line, make sure it really _is_ on line before
- * trying to use it.
- */
-int
-mtonline(usc, mp)
- struct device *usc;
- struct mscp *mp;
-{
- struct mt_softc *mt = (void *)usc;
-
- wakeup((caddr_t)&mt->mt_state);
- if ((mp->mscp_status & M_ST_MASK) == M_ST_SUCCESS)
- mt->mt_state = MT_ONLINE;
-
- return (MSCP_DONE);
-}
-
-/*
- * We got some (configured) unit's status. Return DONE.
- */
-int
-mtgotstatus(usc, mp)
- struct device *usc;
- struct mscp *mp;
-{
- return (MSCP_DONE);
-}
-
-static char *mt_ioerrs[] = {
- "invalid command", /* 1 M_ST_INVALCMD */
- "command aborted", /* 2 M_ST_ABORTED */
- "unit offline", /* 3 M_ST_OFFLINE */
- "unknown", /* 4 M_ST_AVAILABLE */
- "unknown", /* 5 M_ST_MFMTERR */
- "unit write protected", /* 6 M_ST_WRPROT */
- "compare error", /* 7 M_ST_COMPERR */
- "data error", /* 8 M_ST_DATAERR */
- "host buffer access error", /* 9 M_ST_HOSTBUFERR */
- "controller error", /* 10 M_ST_CTLRERR */
- "drive error", /* 11 M_ST_DRIVEERR */
- "formatter error", /* 12 M_ST_FORMATTERR */
- "BOT encountered", /* 13 M_ST_BOT */
- "tape mark encountered",/* 14 M_ST_TAPEMARK */
- "unknown", /* 15 */
- "record data truncated",/* 16 M_ST_RDTRUNC */
-};
-
-/*
- * An I/O error, may be because of a tapemark encountered.
- * Check that before failing.
- */
-/*ARGSUSED*/
-int
-mtioerror(usc, mp, bp)
- struct device *usc;
- struct mscp *mp;
- struct buf *bp;
-{
- struct mt_softc *mt = (void *)usc;
- int st = mp->mscp_status & M_ST_MASK;
-
- if (mp->mscp_flags & M_EF_SEREX)
- mt->mt_serex = 1;
- if (st == M_ST_TAPEMARK)
- mt->mt_serex = 2;
- else {
- if (st && st < 17)
- printf("%s: error %d (%s)\n", mt->mt_dev.dv_xname, st,
- mt_ioerrs[st-1]);
- else
- printf("%s: error %d\n", mt->mt_dev.dv_xname, st);
- bp->b_flags |= B_ERROR;
- bp->b_error = EROFS;
- }
-
- return (MSCP_DONE);
-}
-
-/*
- * I/O controls.
- */
-int
-mtioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int unit = mtunit(dev);
- struct mt_softc *mt = mt_cd.cd_devs[unit];
- struct mtop *mtop;
- struct mtget *mtget;
- int error = 0;
-
- switch (cmd) {
-
- case MTIOCTOP:
- mtop = (void *)data;
- if (mtop->mt_op == MTWEOF) {
- while (mtop->mt_count-- > 0)
- if ((error = mtcmd(mt, mtop->mt_op, 0, 0)))
- break;
- } else
- error = mtcmd(mt, mtop->mt_op, mtop->mt_count, 0);
-
- case MTIOCGET:
- mtget = (void *)data;
- mtget->mt_type = MT_ISTMSCP;
- /* XXX we need to fill in more fields here */
- break;
-
- default:
- error = ENXIO;
- break;
- }
- return (error);
-}
-
-/*
- * No crash dump support...
- */
-int
-mtdump(dev, blkno, va, size)
- dev_t dev;
- daddr_t blkno;
- caddr_t va;
- size_t size;
-{
- return -1;
-}
-
-/*
- * Send a command to the tape drive. Wait until the command is
- * finished before returning.
- * This routine must only be called when there are no data transfer
- * active on this device. Can we be sure of this? Or does the ctlr
- * queue up all command packets and take them in sequential order?
- * It sure would be nice if my manual stated this... /ragge
- */
-int
-mtcmd(mt, cmd, count, complete)
- struct mt_softc *mt;
- int cmd, count, complete;
-{
- struct mscp *mp;
- struct mscp_softc *mi = (void *)mt->mt_dev.dv_parent;
- volatile int i;
-
- mp = mscp_getcp(mi, MSCP_WAIT);
-
- mt->mt_ioctlerr = 0;
- mp->mscp_unit = mt->mt_hwunit;
- mp->mscp_cmdref = -1;
- *mp->mscp_addr |= MSCP_OWN | MSCP_INT;
-
- switch (cmd) {
- case MTWEOF:
- mp->mscp_opcode = M_OP_WRITM;
- break;
-
- case MTBSF:
- mp->mscp_modifier = M_MD_REVERSE;
- case MTFSF:
- mp->mscp_opcode = M_OP_POS;
- mp->mscp_seq.seq_buffer = count;
- break;
-
- case MTBSR:
- mp->mscp_modifier = M_MD_REVERSE;
- case MTFSR:
- mp->mscp_opcode = M_OP_POS;
- mp->mscp_modifier |= M_MD_OBJCOUNT;
- mp->mscp_seq.seq_bytecount = count;
- break;
-
- case MTREW:
- mp->mscp_opcode = M_OP_POS;
- mp->mscp_modifier = M_MD_REWIND | M_MD_CLSEX;
- if (complete)
- mp->mscp_modifier |= M_MD_IMMEDIATE;
- mt->mt_serex = 0;
- break;
-
- case MTOFFL:
- mp->mscp_opcode = M_OP_AVAILABLE;
- mp->mscp_modifier = M_MD_UNLOAD | M_MD_CLSEX;
- mt->mt_serex = 0;
- break;
-
- case MTNOP:
- mp->mscp_opcode = M_OP_GETUNITST;
- break;
-
- case -1: /* Clear serious exception only */
- mp->mscp_opcode = M_OP_POS;
- mp->mscp_modifier = M_MD_CLSEX;
- mt->mt_serex = 0;
- break;
-
- default:
- printf("Bad ioctl %x\n", cmd);
- mp->mscp_opcode = M_OP_POS;
- break;
- }
-
- i = bus_space_read_2(mi->mi_iot, mi->mi_iph, 0);
- tsleep(&mt->mt_inuse, PRIBIO, "mtioctl", 0);
- return mt->mt_ioctlerr;
-}
-
-/*
- * Called from bus routines whenever a non-data transfer is finished.
- */
-void
-mtcmddone(usc, mp)
- struct device *usc;
- struct mscp *mp;
-{
- struct mt_softc *mt = (void *)usc;
-
- if (mp->mscp_status) {
- mt->mt_ioctlerr = EIO;
- printf("%s: bad status %x\n", mt->mt_dev.dv_xname,
- mp->mscp_status);
- }
- wakeup(&mt->mt_inuse);
-}
diff --git a/sys/arch/vax/mscp/mscpreg.h b/sys/arch/vax/mscp/mscpreg.h
deleted file mode 100644
index 68992ca277b..00000000000
--- a/sys/arch/vax/mscp/mscpreg.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* $OpenBSD: mscpreg.h,v 1.5 2003/06/02 23:27:57 millert Exp $ */
-/* $NetBSD: mscpreg.h,v 1.4 1999/05/29 19:12:53 ragge Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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.
- *
- * @(#)udareg.h 7.3 (Berkeley) 5/8/91
- */
-
-/*
- * NRSPL2 and NCMDL2 control the number of response and command
- * packets respectively. They may be any value from 0 to 7, though
- * setting them higher than 5 is unlikely to be of any value.
- * If you get warnings about your command ring being too small,
- * try increasing the values by one.
- */
-#ifndef NRSP
-#define NRSPL2 5
-#define NCMDL2 5
-#define NRSP (1 << NRSPL2)
-#define NCMD (1 << NCMDL2)
-#endif
-
-/*
- * Communication area definition. This seems to be the same for
- * all types of MSCP controllers.
- */
-
-struct mscp_ca {
- short ca_xxx1; /* unused */
- char ca_xxx2; /* unused */
- char ca_bdp; /* BDP to purge */
- short ca_cmdint; /* command ring transition flag */
- short ca_rspint; /* response ring transition flag */
- long ca_rspdsc[NRSP];/* response descriptors */
- long ca_cmddsc[NCMD];/* command descriptors */
-};
-
-/*
- * Simplified routines (e.g., uddump) reprogram the UDA50 for one command
- * and one response at a time; uda1ca is like udaca except that it provides
- * exactly one command and response descriptor.
- */
-struct mscp_1ca {
- short ca_xxx1;
- char ca_xxx2;
- char ca_bdp;
- short ca_cmdint;
- short ca_rspint;
- long ca_rspdsc;
- long ca_cmddsc;
-};
-
-/*
- * Combined communications area and MSCP packet pools, per controller.
- * NRSP and NCMD must be defined before this struct is used.
- */
-
-struct mscp_pack {
- struct mscp_ca mp_ca; /* communications area */
- struct mscp mp_rsp[NRSP]; /* response packets */
- struct mscp mp_cmd[NCMD]; /* command packets */
-};
-
-/*
- * Bits in UDA status register during initialisation
- */
-#define MP_ERR 0x8000 /* error */
-#define MP_STEP4 0x4000 /* step 4 has started */
-#define MP_STEP3 0x2000 /* step 3 has started */
-#define MP_STEP2 0x1000 /* step 2 has started */
-#define MP_STEP1 0x0800 /* step 1 has started */
-#define MP_NV 0x0400 /* no host settable interrupt vector */
-#define MP_QB 0x0200 /* controller supports Q22 bus */
-#define MP_DI 0x0100 /* controller implements diagnostics */
-#define MP_IE 0x0080 /* interrupt enable */
-#define MP_NCNRMASK 0x003f /* in STEP1, bits 0-2=NCMDL2, 3-5=NRSPL2 */
-#define MP_IVECMASK 0x007f /* in STEP2, bits 0-6 are interruptvec / 4 */
-#define MP_PI 0x0001 /* host requests adapter purge interrupts */
-#define MP_GO 0x0001 /* Go command to ctlr */
-
-#define ALLSTEPS (MP_ERR | MP_STEP4 | MP_STEP3 | MP_STEP2 | MP_STEP1)
-
-#define STEP0MASK (ALLSTEPS | MP_NV)
-
-#define STEP1MASK (ALLSTEPS | MP_IE | MP_NCNRMASK)
-#define STEP1GOOD (MP_STEP2 | MP_IE | (NCMDL2 << 3) | NRSPL2)
-
-#define STEP2MASK (ALLSTEPS | MP_IE | MP_IVECMASK)
-#define STEP2GOOD(iv) (MP_STEP3 | MP_IE | (iv))
-
-#define STEP3MASK ALLSTEPS
-#define STEP3GOOD MP_STEP4
-
diff --git a/sys/arch/vax/mscp/mscpvar.h b/sys/arch/vax/mscp/mscpvar.h
deleted file mode 100644
index 7f90c05b30c..00000000000
--- a/sys/arch/vax/mscp/mscpvar.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/* $OpenBSD: mscpvar.h,v 1.8 2015/07/04 10:27:05 dlg Exp $ */
-/* $NetBSD: mscpvar.h,v 1.7 1999/06/06 19:16:18 ragge Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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.
- *
- * @(#)mscpvar.h 7.3 (Berkeley) 6/28/90
- */
-
-/*
- * MSCP generic driver configuration
- */
-
-/*
- * Enabling MSCP_PARANOIA makes the response code perform various checks
- * on the hardware. (Right now it verifies only the buffer pointer in
- * mscp_cmdref.)
- *
- * Enabling AVOID_EMULEX_BUG selects an alternative method of identifying
- * transfers in progress, which gets around a rather peculiar bug in the
- * SC41/MS. Enabling MSCP_PARANOIA instead should work, but will cause
- * `extra' Unibus resets.
- *
- * Either of these flags can simply be included as an `options' line in
- * your configuration file.
- */
-
-/* #define MSCP_PARANOIA */
-/* #define AVOID_EMULEX_BUG */
-
-/*
- * Ring information, per ring (one each for commands and responses).
- */
-struct mscp_ri {
- int mri_size; /* ring size */
- int mri_next; /* next (expected|free) */
- long *mri_desc; /* base address of descriptors */
- struct mscp *mri_ring; /* base address of packets */
-};
-
-/*
- * Transfer info, one per command packet.
- */
-struct mscp_xi {
- bus_dmamap_t mxi_dmam; /* Allocated DMA map for this entry */
- struct buf * mxi_bp; /* Buffer used in this command */
- struct mscp * mxi_mp; /* Packet used in this command */
- int mxi_inuse;
-};
-
-struct mscp_ctlr {
- /* controller operation complete */
- void (*mc_ctlrdone)(struct device *);
- /* device-specific start routine */
- void (*mc_go)(struct device *, struct mscp_xi *);
- /* ctlr error handling */
- void (*mc_saerror)(struct device *, int);
-};
-
-struct mscp_softc;
-
-struct mscp_device {
- /* error datagram */
- void (*me_dgram)(struct device *, struct mscp *, struct mscp_softc *);
- /* normal I/O is done */
- void (*me_iodone)(struct device *, struct buf *);
- /* drive on line */
- int (*me_online)(struct device *, struct mscp *);
- /* got unit status */
- int (*me_gotstatus)(struct device *, struct mscp *);
- /* replace done */
- void (*me_replace)(struct device *, struct mscp *);
- /* read or write failed */
- int (*me_ioerr)(struct device *, struct mscp *, struct buf *);
- /* B_BAD io done */
- void (*me_bb)(struct device *, struct mscp *, struct buf *);
- /* Fill in mscp info for this drive */
- void (*me_fillin)(struct buf *,struct mscp *);
- /* Non-data transfer operation is done */
- void (*me_cmddone)(struct device *, struct mscp *);
-};
-
-/*
- * This struct is used when attaching a mscpbus.
- */
-struct mscp_attach_args {
- struct mscp_ctlr *ma_mc; /* Pointer to ctlr's mscp_ctlr */
- int ma_type; /* disk/tape bus type */
- struct mscp_pack *ma_uda; /* comm area virtual */
- struct mscp_softc **ma_softc; /* backpointer to bus softc */
- bus_dmamap_t ma_dmam; /* This comm area dma info */
- bus_dma_tag_t ma_dmat;
- bus_space_tag_t ma_iot;
- bus_space_handle_t ma_iph; /* initialisation and polling */
- bus_space_handle_t ma_sah; /* status & address (read part) */
- bus_space_handle_t ma_swh; /* status & address (write part) */
- short ma_ivec; /* Interrupt vector to use */
- char ma_ctlrnr; /* Phys ctlr nr */
- char ma_adapnr; /* Phys adapter nr */
-};
-#define MSCPBUS_DISK 001 /* Bus is used for disk mounts */
-#define MSCPBUS_TAPE 002 /* Bus is used for tape mounts */
-#define MSCPBUS_UDA 004 /* ctlr is disk on unibus/qbus */
-#define MSCPBUS_KDB 010 /* ctlr is disk on BI */
-#define MSCPBUS_KLE 020 /* ctlr is tape on unibus/qbus */
-
-/*
- * Used when going for child devices.
- */
-struct drive_attach_args {
- struct mscp *da_mp; /* this devices response struct */
- int da_typ; /* Parent of type */
-};
-
-/*
- * Return values from functions.
- * MSCP_RESTARTED is peculiar to I/O errors.
- */
-#define MSCP_DONE 0 /* all ok */
-#define MSCP_FAILED 1 /* no go */
-#define MSCP_RESTARTED 2 /* transfer restarted */
-
-/*
- * Per device information.
- *
- * mi_ip is a pointer to the inverting pointers (things that get `ui's
- * given unit numbers) FOR THIS CONTROLLER (NOT the whole set!).
- *
- * b_actf holds a queue of those transfers that were started but have
- * not yet finished. Other Unibus drivers do not need this as they hand
- * out requests one at a time. MSCP devices, however, take a slew of
- * requests and pick their own order to execute them. This means that
- * we have to have a place to move transfers that were given to the
- * controller, so we can tell those apart from those that have not yet
- * been handed out; b_actf is that place.
- */
-struct mscp_softc {
- struct device mi_dev; /* Autoconf stuff */
- struct mscp_ri mi_cmd; /* MSCP command ring info */
- struct mscp_ri mi_rsp; /* MSCP response ring info */
- bus_dma_tag_t mi_dmat;
- bus_dmamap_t mi_dmam;
- struct mscp_xi mi_xi[NCMD];
- int mi_mxiuse; /* Bitfield of inuse mxi packets */
- short mi_credits; /* transfer credits */
- char mi_wantcmd; /* waiting for command packet */
- char mi_wantcredits; /* waiting for transfer credits */
- struct mscp_ctlr *mi_mc; /* Pointer to parent's mscp_ctlr */
- struct mscp_device *mi_me; /* Pointer to child's mscp_device */
- struct device **mi_dp; /* array of backpointers */
- int mi_driveno; /* Max physical drive number found */
- char mi_ctlrnr; /* Phys ctlr nr */
- char mi_adapnr; /* Phys adapter nr */
- int mi_flags;
- struct mscp_pack *mi_uda; /* virtual address */
- int mi_type;
- short mi_ivec; /* Interrupt vector to use */
- short mi_ierr; /* Init err counter */
- bus_space_tag_t mi_iot;
- bus_space_handle_t mi_iph; /* initialisation and polling */
- bus_space_handle_t mi_sah; /* status & address (read part) */
- bus_space_handle_t mi_swh; /* status & address (write part) */
- struct bufq mi_bufq; /* While waiting for packets */
-};
-
-/* mi_flags */
-#define MSC_STARTPOLL 1
-#define MSC_INSTART 2
-#define MSC_IGNOREINTR 4
-#define MSC_READY 8
-
-/*
- * We have run out of credits when mi_credits is <= MSCP_MINCREDITS.
- * It is still possible to issue one command in this case, but it must
- * not be a data transfer. E.g., `get command status' or `abort command'
- * is legal, while `read' is not.
- */
-#define MSCP_MINCREDITS 1
-
-/*
- * Flags for mscp_getcp().
- */
-#define MSCP_WAIT 1
-#define MSCP_DONTWAIT 0
-
-/*
- * Unit flags
- */
-#define UNIT_ONLINE 0x01 /* drive is on line */
-#define UNIT_HAVESTATUS 0x02 /* got unit status */
-#define UNIT_REQUEUE 0x04 /* requeue after response */
-
-/*
- * Handle a command ring transition: wake up sleepers for command packets.
- * This is too simple to bother with a function call.
- */
-#define MSCP_DOCMD(mi) { \
- if ((mi)->mi_wantcmd) { \
- (mi)->mi_wantcmd = 0; \
- wakeup((caddr_t) &(mi)->mi_wantcmd); \
- } \
-}
-
-/* Prototypes */
-struct mscp *mscp_getcp(struct mscp_softc *, int);
-void mscp_printevent(struct mscp *);
-void mscp_go(struct mscp_softc *, struct mscp *, int);
-void mscp_requeue(struct mscp_softc *);
-void mscp_dorsp(struct mscp_softc *);
-int mscp_decodeerror(char *, struct mscp *, struct mscp_softc *);
-int mscp_print(void *, const char *);
-void mscp_hexdump(struct mscp *);
-void mscp_strategy(struct buf *, struct device *);
-void mscp_printtype(int, int);
-int mscp_waitstep(struct mscp_softc *, int, int);
-void mscp_dgo(struct mscp_softc *, struct mscp_xi *);
-void mscp_intr(struct mscp_softc *);
diff --git a/sys/arch/vax/qbus/dhu.c b/sys/arch/vax/qbus/dhu.c
deleted file mode 100644
index 5eb6aac05dd..00000000000
--- a/sys/arch/vax/qbus/dhu.c
+++ /dev/null
@@ -1,873 +0,0 @@
-/* $OpenBSD: dhu.c,v 1.19 2010/09/20 06:33:48 matthew Exp $ */
-/* $NetBSD: dhu.c,v 1.19 2000/06/04 06:17:01 matt Exp $ */
-/*
- * Copyright (c) 2003, Hugh Graham.
- * Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * 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/systm.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/proc.h>
-#include <sys/buf.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-#include <machine/scb.h>
-
-#include <arch/vax/qbus/ubavar.h>
-#include <arch/vax/qbus/dhureg.h>
-
-#define NDHULINE 16
-
-#define DHU_M2U(c) ((c)>>4) /* convert minor(dev) to unit # */
-#define DHU_LINE(u) ((u)&0xF) /* extract line # from minor(dev) */
-
-struct dhu_softc {
- struct device sc_dev; /* Device struct used by config */
- struct evcount sc_rintrcnt; /* Interrupt statistics */
- struct evcount sc_tintrcnt; /* Interrupt statistics */
- int sc_rcvec, sc_tcvec;
- int sc_type; /* controller type, DHU or DHV */
- int sc_lines; /* number of lines */
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- bus_dma_tag_t sc_dmat;
- struct {
- struct tty *dhu_tty; /* what we work on */
- bus_dmamap_t dhu_dmah;
- int dhu_state; /* to manage TX output status */
- short dhu_cc; /* character count on TX */
- short dhu_modem; /* modem bits state */
- } sc_dhu[NDHULINE];
-};
-
-#define IS_DHU 16 /* Unibus DHU-11 board linecount */
-#define IS_DHV 8 /* Q-bus DHV-11 or DHQ-11 */
-
-#define STATE_IDLE 000 /* no current output in progress */
-#define STATE_DMA_RUNNING 001 /* DMA TX in progress */
-#define STATE_DMA_STOPPED 002 /* DMA TX was aborted */
-#define STATE_TX_ONE_CHAR 004 /* did a single char directly */
-
-/* Flags used to monitor modem bits, make them understood outside driver */
-
-#define DML_DTR TIOCM_DTR
-#define DML_RTS TIOCM_RTS
-#define DML_CTS TIOCM_CTS
-#define DML_DCD TIOCM_CD
-#define DML_RI TIOCM_RI
-#define DML_DSR TIOCM_DSR
-#define DML_BRK 0100000 /* no equivalent, we will mask */
-
-#define DHU_READ_WORD(reg) \
- bus_space_read_2(sc->sc_iot, sc->sc_ioh, reg)
-#define DHU_WRITE_WORD(reg, val) \
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, reg, val)
-#define DHU_READ_BYTE(reg) \
- bus_space_read_1(sc->sc_iot, sc->sc_ioh, reg)
-#define DHU_WRITE_BYTE(reg, val) \
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, reg, val)
-
-
-/* On a stock DHV, channel pairs (0/1, 2/3, etc.) must use */
-/* a baud rate from the same group. So limiting to B is likely */
-/* best, although clone boards like the ABLE QHV allow all settings. */
-
-static const struct speedtab dhuspeedtab[] = {
- { 0, 0 }, /* Groups */
- { 50, DHU_LPR_B50 }, /* A */
- { 75, DHU_LPR_B75 }, /* B */
- { 110, DHU_LPR_B110 }, /* A and B */
- { 134, DHU_LPR_B134 }, /* A and B */
- { 150, DHU_LPR_B150 }, /* B */
- { 300, DHU_LPR_B300 }, /* A and B */
- { 600, DHU_LPR_B600 }, /* A and B */
- { 1200, DHU_LPR_B1200 }, /* A and B */
- { 1800, DHU_LPR_B1800 }, /* B */
- { 2000, DHU_LPR_B2000 }, /* B */
- { 2400, DHU_LPR_B2400 }, /* A and B */
- { 4800, DHU_LPR_B4800 }, /* A and B */
- { 7200, DHU_LPR_B7200 }, /* A */
- { 9600, DHU_LPR_B9600 }, /* A and B */
- { 19200, DHU_LPR_B19200 }, /* B */
- { 38400, DHU_LPR_B38400 }, /* A */
- { -1, -1 }
-};
-
-static int dhu_match(struct device *, struct cfdata *, void *);
-static void dhu_attach(struct device *, struct device *, void *);
-static void dhurint(void *);
-static void dhuxint(void *);
-static void dhustart(struct tty *);
-static int dhuparam(struct tty *, struct termios *);
-static int dhuiflow(struct tty *, int);
-static unsigned dhumctl(struct dhu_softc *,int, int, int);
- int dhuopen(dev_t, int, int, struct proc *);
- int dhuclose(dev_t, int, int, struct proc *);
- int dhuread(dev_t, struct uio *, int);
- int dhuwrite(dev_t, struct uio *, int);
- int dhuioctl(dev_t, u_long, caddr_t, int, struct proc *);
- void dhustop(struct tty *, int);
-struct tty * dhutty(dev_t);
-
-struct cfattach dhu_ca = {
- sizeof(struct dhu_softc), (cfmatch_t)dhu_match, dhu_attach
-};
-
-struct cfdriver dhu_cd = {
- NULL, "dhu", DV_TTY
-};
-
-/* Autoconfig handles: setup the controller to interrupt, */
-/* then complete the housecleaning for full operation */
-
-static int
-dhu_match(parent, cf, aux)
- struct device *parent;
- struct cfdata *cf;
- void *aux;
-{
- struct uba_attach_args *ua = aux;
- int n;
-
- /* Reset controller to initialize, enable TX/RX interrupts */
- /* to catch floating vector info elsewhere when completed */
-
- bus_space_write_2(ua->ua_iot, ua->ua_ioh, DHU_UBA_CSR,
- DHU_CSR_MASTER_RESET | DHU_CSR_RXIE | DHU_CSR_TXIE);
-
- /* Now wait up to 3 seconds for self-test to complete. */
-
- for (n = 0; n < 300; n++) {
- DELAY(10000);
- if ((bus_space_read_2(ua->ua_iot, ua->ua_ioh, DHU_UBA_CSR) &
- DHU_CSR_MASTER_RESET) == 0)
- break;
- }
-
- /* If the RESET did not clear after 3 seconds, */
- /* the controller must be broken. */
-
- if (n >= 300)
- return 0;
-
- /* Check whether diagnostic run has signalled a failure. */
-
- if ((bus_space_read_2(ua->ua_iot, ua->ua_ioh, DHU_UBA_CSR) &
- DHU_CSR_DIAG_FAIL) != 0)
- return 0;
-
- return 1;
-}
-
-static void
-dhu_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct dhu_softc *sc = (void *)self;
- struct uba_attach_args *ua = aux;
- unsigned c;
- int n, i;
-
- sc->sc_iot = ua->ua_iot;
- sc->sc_ioh = ua->ua_ioh;
- sc->sc_dmat = ua->ua_dmat;
- /* Process the 8 bytes of diagnostic info put into */
- /* the FIFO following the master reset operation. */
-
- printf("\n%s:", self->dv_xname);
- for (n = 0; n < 8; n++) {
- c = DHU_READ_WORD(DHU_UBA_RBUF);
-
- if ((c&DHU_DIAG_CODE) == DHU_DIAG_CODE) {
- if ((c&0200) == 0000)
- printf(" rom(%d) version %d",
- ((c>>1)&01), ((c>>2)&037));
- else if (((c>>2)&07) != 0)
- printf(" diag-error(proc%d)=%x",
- ((c>>1)&01), ((c>>2)&07));
- }
- }
-
- c = DHU_READ_WORD(DHU_UBA_STAT);
-
- sc->sc_type = (c & DHU_STAT_DHU) ? IS_DHU : IS_DHV;
-
- if (sc->sc_type == IS_DHU) {
- if (c & DHU_STAT_MDL)
- sc->sc_lines = 16; /* "Modem Low" */
- else
- sc->sc_lines = 8; /* Has modem support */
- } else
- sc->sc_lines = 8;
-
- printf("\n%s: DH%s-11 %d lines\n", self->dv_xname,
- (sc->sc_type == IS_DHU) ? "U" : "V", sc->sc_lines);
-
- for (i = 0; i < sc->sc_lines; i++) {
- struct tty *tp;
- tp = sc->sc_dhu[i].dhu_tty = ttymalloc(0);
- sc->sc_dhu[i].dhu_state = STATE_IDLE;
- bus_dmamap_create(sc->sc_dmat, tp->t_outq.c_cn, 1,
- tp->t_outq.c_cn, 0, BUS_DMA_ALLOCNOW|BUS_DMA_NOWAIT,
- &sc->sc_dhu[i].dhu_dmah);
- bus_dmamap_load(sc->sc_dmat, sc->sc_dhu[i].dhu_dmah,
- tp->t_outq.c_cs, tp->t_outq.c_cn, 0, BUS_DMA_NOWAIT);
-
- }
-
- /* Now establish RX & TX interrupt handlers */
-
- uba_intr_establish(ua->ua_icookie, ua->ua_cvec,
- dhurint, sc, &sc->sc_rintrcnt);
- uba_intr_establish(ua->ua_icookie, ua->ua_cvec + 4,
- dhuxint, sc, &sc->sc_tintrcnt);
-
- sc->sc_rcvec = ua->ua_cvec;
- evcount_attach(&sc->sc_rintrcnt, sc->sc_dev.dv_xname, &sc->sc_rcvec);
- sc->sc_tcvec = ua->ua_cvec + 4;
- evcount_attach(&sc->sc_tintrcnt, sc->sc_dev.dv_xname, &sc->sc_tcvec);
-}
-
-/* Receiver Interrupt */
-
-static void
-dhurint(arg)
- void *arg;
-{
- struct dhu_softc *sc = arg;
- struct tty *tp;
- int cc, line;
- unsigned c, delta;
- int overrun = 0;
-
- while ((c = DHU_READ_WORD(DHU_UBA_RBUF)) & DHU_RBUF_DATA_VALID) {
-
- /* Ignore diagnostic FIFO entries. */
-
- if ((c & DHU_DIAG_CODE) == DHU_DIAG_CODE)
- continue;
-
- cc = c & 0xFF;
- line = DHU_LINE(c>>8);
- tp = sc->sc_dhu[line].dhu_tty;
-
- /* LINK.TYPE is set so we get modem control FIFO entries */
-
- if ((c & DHU_DIAG_CODE) == DHU_MODEM_CODE) {
- c = (c << 8);
- /* Do MDMBUF flow control, wakeup sleeping opens */
- if (c & DHU_STAT_DCD) {
- if (!(tp->t_state & TS_CARR_ON))
- (void)(*linesw[tp->t_line].l_modem)(tp, 1);
- }
- else if ((tp->t_state & TS_CARR_ON) &&
- (*linesw[tp->t_line].l_modem)(tp, 0) == 0)
- (void) dhumctl(sc, line, 0, DMSET);
-
- /* Do CRTSCTS flow control */
- delta = c ^ sc->sc_dhu[line].dhu_modem;
- sc->sc_dhu[line].dhu_modem = c;
- if ((delta & DHU_STAT_CTS) &&
- (tp->t_state & TS_ISOPEN) &&
- (tp->t_cflag & CRTSCTS)) {
- if (c & DHU_STAT_CTS) {
- tp->t_state &= ~TS_TTSTOP;
- ttstart(tp);
- } else {
- tp->t_state |= TS_TTSTOP;
- dhustop(tp, 0);
- }
- }
- continue;
- }
-
- if (!(tp->t_state & TS_ISOPEN)) {
- wakeup((caddr_t)&tp->t_rawq);
- continue;
- }
-
- if ((c & DHU_RBUF_OVERRUN_ERR) && overrun == 0) {
- log(LOG_WARNING, "%s: silo overflow, line %d\n",
- sc->sc_dev.dv_xname, line);
- overrun = 1;
- }
- /* A BREAK key will appear as a NULL with a framing error */
- if (c & DHU_RBUF_FRAMING_ERR)
- cc |= TTY_FE;
- if (c & DHU_RBUF_PARITY_ERR)
- cc |= TTY_PE;
-
- (*linesw[tp->t_line].l_rint)(cc, tp);
- }
-}
-
-/* Transmitter Interrupt */
-
-static void
-dhuxint(arg)
- void *arg;
-{
- struct dhu_softc *sc = arg;
- struct tty *tp;
- int line, i;
-
- while ((i = DHU_READ_BYTE(DHU_UBA_CSR_HI)) & (DHU_CSR_TX_ACTION >> 8)) {
-
- line = DHU_LINE(i);
-
- tp = sc->sc_dhu[line].dhu_tty;
-
- if (i & (DHU_CSR_TX_DMA_ERROR >> 8))
- printf("dhu%d: DMA ERROR on line: %d\n",
- DHU_M2U(minor(tp->t_dev)), line);
-
- if (i & (DHU_CSR_DIAG_FAIL >> 8))
- printf("dhu%d: DIAG FAIL on line: %d\n",
- DHU_M2U(minor(tp->t_dev)), line);
-
- tp->t_state &= ~TS_BUSY;
-
- if (tp->t_state & TS_FLUSH)
- tp->t_state &= ~TS_FLUSH;
- else {
- if (sc->sc_dhu[line].dhu_state == STATE_DMA_STOPPED)
- sc->sc_dhu[line].dhu_cc -=
- DHU_READ_WORD(DHU_UBA_TBUFCNT);
- ndflush(&tp->t_outq, sc->sc_dhu[line].dhu_cc);
- sc->sc_dhu[line].dhu_cc = 0;
- }
-
- sc->sc_dhu[line].dhu_state = STATE_IDLE;
-
- if (tp->t_line)
- (*linesw[tp->t_line].l_start)(tp);
- else
- dhustart(tp);
- }
-}
-
-int
-dhuopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct tty *tp;
- int unit, line;
- struct dhu_softc *sc;
- int s, error = 0;
-
- unit = DHU_M2U(minor(dev));
- line = DHU_LINE(minor(dev));
-
- if (unit >= dhu_cd.cd_ndevs || dhu_cd.cd_devs[unit] == NULL)
- return (ENXIO);
-
- sc = dhu_cd.cd_devs[unit];
-
- if (line >= sc->sc_lines)
- return ENXIO;
-
- if (sc->sc_type == IS_DHU) {
- s = spltty(); /* CSR 3:0 must be 0 */
- DHU_WRITE_BYTE(DHU_UBA_CSR, DHU_CSR_RXIE);
- DHU_WRITE_BYTE(DHU_UBA_RXTIME, 10);
- splx(s); /* RX int delay 10ms */
- }
-
- s = spltty();
- DHU_WRITE_BYTE(DHU_UBA_CSR, DHU_CSR_RXIE | line);
- sc->sc_dhu[line].dhu_modem = DHU_READ_WORD(DHU_UBA_STAT);
- splx(s);
-
- tp = sc->sc_dhu[line].dhu_tty;
-
- tp->t_oproc = dhustart;
- tp->t_param = dhuparam;
- tp->t_hwiflow = dhuiflow;
- tp->t_dev = dev;
- if ((tp->t_state & TS_ISOPEN) == 0) {
- tp->t_state |= TS_WOPEN; /* XXX */
- ttychars(tp);
- if (tp->t_ispeed == 0) {
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_cflag = TTYDEF_CFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
- }
- (void) dhuparam(tp, &tp->t_termios);
- ttsetwater(tp);
- } else if ((tp->t_state & TS_XCLUDE) && suser(curproc, 0) != 0)
- return (EBUSY);
- /* Use DMBIS and *not* DMSET or else we clobber incoming bits */
- if (dhumctl(sc, line, DML_DTR|DML_RTS, DMBIS) & DML_DCD)
- tp->t_state |= TS_CARR_ON;
- s = spltty();
- while (!(flag & O_NONBLOCK) && !(tp->t_cflag & CLOCAL) &&
- !(tp->t_state & TS_CARR_ON)) {
- tp->t_state |= TS_WOPEN; /* XXX */
- error = ttysleep(tp, (caddr_t)&tp->t_rawq,
- TTIPRI | PCATCH, ttopen, 0);
- if (error)
- break;
- }
- splx(s);
- if (error)
- return (error);
- return ((*linesw[tp->t_line].l_open)(dev, tp, p));
-}
-
-/*ARGSUSED*/
-int
-dhuclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct tty *tp;
- int unit, line;
- struct dhu_softc *sc;
-
- unit = DHU_M2U(minor(dev));
- line = DHU_LINE(minor(dev));
-
- sc = dhu_cd.cd_devs[unit];
-
- tp = sc->sc_dhu[line].dhu_tty;
-
- (*linesw[tp->t_line].l_close)(tp, flag, p);
-
- /* Make sure a BREAK state is not left enabled. */
-
- (void) dhumctl(sc, line, DML_BRK, DMBIC);
-
- /* Do a hangup if so required. */
-
- if ((tp->t_cflag & HUPCL) || (tp->t_state & TS_WOPEN) || /* XXX */
- !(tp->t_state & TS_ISOPEN))
- (void) dhumctl(sc, line, 0, DMSET);
-
- return (ttyclose(tp));
-}
-
-int
-dhuread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
-{
- struct dhu_softc *sc;
- struct tty *tp;
-
- sc = dhu_cd.cd_devs[DHU_M2U(minor(dev))];
-
- tp = sc->sc_dhu[DHU_LINE(minor(dev))].dhu_tty;
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-dhuwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
-{
- struct dhu_softc *sc;
- struct tty *tp;
-
- sc = dhu_cd.cd_devs[DHU_M2U(minor(dev))];
-
- tp = sc->sc_dhu[DHU_LINE(minor(dev))].dhu_tty;
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-/*ARGSUSED*/
-int
-dhuioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct dhu_softc *sc;
- struct tty *tp;
- int unit, line;
- int error;
-
- unit = DHU_M2U(minor(dev));
- line = DHU_LINE(minor(dev));
- sc = dhu_cd.cd_devs[unit];
- tp = sc->sc_dhu[line].dhu_tty;
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
-
- switch (cmd) {
-
- case TIOCSBRK:
- (void) dhumctl(sc, line, DML_BRK, DMBIS);
- break;
-
- case TIOCCBRK:
- (void) dhumctl(sc, line, DML_BRK, DMBIC);
- break;
-
- case TIOCSDTR:
- (void) dhumctl(sc, line, DML_DTR|DML_RTS, DMBIS);
- break;
-
- case TIOCCDTR:
- (void) dhumctl(sc, line, DML_DTR|DML_RTS, DMBIC);
- break;
-
- case TIOCMSET:
- (void) dhumctl(sc, line, *(int *)data, DMSET);
- break;
-
- case TIOCMBIS:
- (void) dhumctl(sc, line, *(int *)data, DMBIS);
- break;
-
- case TIOCMBIC:
- (void) dhumctl(sc, line, *(int *)data, DMBIC);
- break;
-
- case TIOCMGET:
- *(int *)data = (dhumctl(sc, line, 0, DMGET) & ~DML_BRK);
- break;
-
- default:
- return (ENOTTY);
- }
- return (0);
-}
-
-struct tty *
-dhutty(dev)
- dev_t dev;
-{
- struct dhu_softc *sc = dhu_cd.cd_devs[DHU_M2U(minor(dev))];
- struct tty *tp = sc->sc_dhu[DHU_LINE(minor(dev))].dhu_tty;
- return (tp);
-}
-
-/*ARGSUSED*/
-void
-dhustop(tp, flag)
- struct tty *tp;
-{
- struct dhu_softc *sc;
- int line;
- int s;
-
- s = spltty();
-
- if (tp->t_state & TS_BUSY) {
-
- sc = dhu_cd.cd_devs[DHU_M2U(minor(tp->t_dev))];
- line = DHU_LINE(minor(tp->t_dev));
-
- if (sc->sc_dhu[line].dhu_state == STATE_DMA_RUNNING) {
-
- sc->sc_dhu[line].dhu_state = STATE_DMA_STOPPED;
-
- DHU_WRITE_BYTE(DHU_UBA_CSR, DHU_CSR_RXIE | line);
- DHU_WRITE_WORD(DHU_UBA_LNCTRL,
- DHU_READ_WORD(DHU_UBA_LNCTRL) |
- DHU_LNCTRL_DMA_ABORT);
- }
-
- if (!(tp->t_state & TS_TTSTOP))
- tp->t_state |= TS_FLUSH;
- }
- splx(s);
-}
-
-static void
-dhustart(tp)
- struct tty *tp;
-{
- struct dhu_softc *sc;
- int line, cc;
- int addr;
- int s;
-
- s = spltty();
-
- if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
- goto out;
- ttwakeupwr(tp);
- if (tp->t_outq.c_cc == 0)
- goto out;
- cc = ndqb(&tp->t_outq, 0);
- if (cc == 0)
- goto out;
-
- tp->t_state |= TS_BUSY;
-
- sc = dhu_cd.cd_devs[DHU_M2U(minor(tp->t_dev))];
-
- line = DHU_LINE(minor(tp->t_dev));
-
- DHU_WRITE_BYTE(DHU_UBA_CSR, DHU_CSR_RXIE | line);
-
- sc->sc_dhu[line].dhu_cc = cc;
-
- if (cc == 1 && sc->sc_type == IS_DHV) {
-
- sc->sc_dhu[line].dhu_state = STATE_TX_ONE_CHAR;
-
- DHU_WRITE_WORD(DHU_UBA_TXCHAR,
- DHU_TXCHAR_DATA_VALID | *tp->t_outq.c_cf);
- } else {
- sc->sc_dhu[line].dhu_state = STATE_DMA_RUNNING;
-
- addr = sc->sc_dhu[line].dhu_dmah->dm_segs[0].ds_addr +
- (tp->t_outq.c_cf - tp->t_outq.c_cs);
-
- DHU_WRITE_WORD(DHU_UBA_TBUFCNT, cc);
- DHU_WRITE_WORD(DHU_UBA_TBUFAD1, addr & 0xFFFF);
- DHU_WRITE_WORD(DHU_UBA_TBUFAD2, ((addr>>16) & 0x3F) |
- DHU_TBUFAD2_TX_ENABLE);
- DHU_WRITE_WORD(DHU_UBA_LNCTRL,
- DHU_READ_WORD(DHU_UBA_LNCTRL) & ~DHU_LNCTRL_DMA_ABORT);
- DHU_WRITE_WORD(DHU_UBA_TBUFAD2,
- DHU_READ_WORD(DHU_UBA_TBUFAD2) | DHU_TBUFAD2_DMA_START);
- }
-out:
- splx(s);
- return;
-}
-
-static int
-dhuparam(tp, t)
- struct tty *tp;
- struct termios *t;
-{
- struct dhu_softc *sc;
- int cflag = t->c_cflag;
- int ispeed = ttspeedtab(t->c_ispeed, dhuspeedtab);
- int ospeed = ttspeedtab(t->c_ospeed, dhuspeedtab);
- unsigned lpr, lnctrl;
- int unit, line;
- int s;
-
- unit = DHU_M2U(minor(tp->t_dev));
- line = DHU_LINE(minor(tp->t_dev));
-
- sc = dhu_cd.cd_devs[unit];
-
- /* check requested parameters */
- if (ospeed < 0 || ispeed < 0)
- return (EINVAL);
-
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = cflag;
-
- if (ospeed == 0) {
- (void) dhumctl(sc, line, 0, DMSET); /* hang up line */
- return (0);
- }
-
- s = spltty();
- DHU_WRITE_BYTE(DHU_UBA_CSR, DHU_CSR_RXIE | line);
-
- lpr = ((ispeed&017)<<8) | ((ospeed&017)<<12) ;
-
- switch (cflag & CSIZE) {
-
- case CS5:
- lpr |= DHU_LPR_5_BIT_CHAR;
- break;
-
- case CS6:
- lpr |= DHU_LPR_6_BIT_CHAR;
- break;
-
- case CS7:
- lpr |= DHU_LPR_7_BIT_CHAR;
- break;
-
- default:
- lpr |= DHU_LPR_8_BIT_CHAR;
- break;
- }
-
- if (cflag & PARENB)
- lpr |= DHU_LPR_PARENB;
- if (!(cflag & PARODD))
- lpr |= DHU_LPR_EPAR;
- if (cflag & CSTOPB)
- lpr |= DHU_LPR_2_STOP;
-
- DHU_WRITE_WORD(DHU_UBA_LPR, lpr);
-
- DHU_WRITE_WORD(DHU_UBA_TBUFAD2,
- DHU_READ_WORD(DHU_UBA_TBUFAD2) | DHU_TBUFAD2_TX_ENABLE);
-
- lnctrl = DHU_READ_WORD(DHU_UBA_LNCTRL);
-
- /* Setting LINK.TYPE enables modem signal change interrupts. */
-
- lnctrl |= (DHU_LNCTRL_RX_ENABLE | DHU_LNCTRL_LINK_TYPE);
-
- /* Enable the auto XON/XOFF feature on the controller */
-
- if (t->c_iflag & IXON)
- lnctrl |= DHU_LNCTRL_OAUTO;
- else
- lnctrl &= ~DHU_LNCTRL_OAUTO;
-
- if (t->c_iflag & IXOFF)
- lnctrl |= DHU_LNCTRL_IAUTO;
- else
- lnctrl &= ~DHU_LNCTRL_IAUTO;
-
- DHU_WRITE_WORD(DHU_UBA_LNCTRL, lnctrl);
-
- splx(s);
- return (0);
-}
-
-static int
-dhuiflow(tp, flag)
- struct tty *tp;
- int flag;
-{
- struct dhu_softc *sc;
- int line = DHU_LINE(minor(tp->t_dev));
-
- if (tp->t_cflag & CRTSCTS) {
- sc = dhu_cd.cd_devs[DHU_M2U(minor(tp->t_dev))];
- (void) dhumctl(sc, line, DML_RTS, ((flag)? DMBIC: DMBIS));
- return (1);
- }
- return (0);
-}
-
-static unsigned
-dhumctl(sc, line, bits, how)
- struct dhu_softc *sc;
- int line, bits, how;
-{
- unsigned status;
- unsigned lnctrl;
- unsigned mbits;
- int s;
-
- s = spltty();
-
- DHU_WRITE_BYTE(DHU_UBA_CSR, DHU_CSR_RXIE | line);
-
- mbits = 0;
-
- /* external signals as seen from the port */
-
- status = DHU_READ_WORD(DHU_UBA_STAT);
-
- if (status & DHU_STAT_CTS)
- mbits |= DML_CTS;
-
- if (status & DHU_STAT_DCD)
- mbits |= DML_DCD;
-
- if (status & DHU_STAT_DSR)
- mbits |= DML_DSR;
-
- if (status & DHU_STAT_RI)
- mbits |= DML_RI;
-
- /* internal signals/state delivered to port */
-
- lnctrl = DHU_READ_WORD(DHU_UBA_LNCTRL);
-
- if (lnctrl & DHU_LNCTRL_RTS)
- mbits |= DML_RTS;
-
- if (lnctrl & DHU_LNCTRL_DTR)
- mbits |= DML_DTR;
-
- if (lnctrl & DHU_LNCTRL_BREAK)
- mbits |= DML_BRK;
-
- switch (how) {
-
- case DMSET:
- mbits = bits;
- break;
-
- case DMBIS:
- mbits |= bits;
- break;
-
- case DMBIC:
- mbits &= ~bits;
- break;
-
- case DMGET:
- splx(s);
- return (mbits);
- }
-
- if (mbits & DML_RTS)
- lnctrl |= DHU_LNCTRL_RTS;
- else
- lnctrl &= ~DHU_LNCTRL_RTS;
-
- if (mbits & DML_DTR)
- lnctrl |= DHU_LNCTRL_DTR;
- else
- lnctrl &= ~DHU_LNCTRL_DTR;
-
- if (mbits & DML_BRK)
- lnctrl |= DHU_LNCTRL_BREAK;
- else
- lnctrl &= ~DHU_LNCTRL_BREAK;
-
- DHU_WRITE_WORD(DHU_UBA_LNCTRL, lnctrl);
-
- splx(s);
- return (mbits);
-}
diff --git a/sys/arch/vax/qbus/dhureg.h b/sys/arch/vax/qbus/dhureg.h
deleted file mode 100644
index 4039fd13b13..00000000000
--- a/sys/arch/vax/qbus/dhureg.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/* $OpenBSD: dhureg.h,v 1.4 2003/04/06 01:33:32 hugh Exp $ */
-/* $NetBSD: dhureg.h,v 1.4 1999/05/28 20:17:29 ragge Exp $ */
-/*
- * Copyright (c) 1996 Ken C. Wellsch. 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 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.
- */
-
-#ifdef notdef
-union w_b
-{
- u_short word;
- struct {
- u_char byte_lo;
- u_char byte_hi;
- } bytes;
-};
-
-struct DHUregs
-{
- volatile union w_b u_csr; /* Control/Status Register (R/W) */
- volatile u_short dhu_rbuf; /* Receive Buffer (R only) */
-#define dhu_txchar dhu_rbuf /* Transmit Character (W only) */
- volatile u_short dhu_lpr; /* Line Parameter Register (R/W) */
- volatile u_short dhu_stat; /* Line Status (R only) */
- volatile u_short dhu_lnctrl; /* Line Control (R/W) */
- volatile u_short dhu_tbufad1; /* Transmit Buffer Address 1 (R/W) */
- volatile u_short dhu_tbufad2; /* Transmit Buffer Address 2 (R/W) */
- volatile u_short dhu_tbufcnt; /* Transmit Buffer Count (R/W) */
-};
-
-#define dhu_csr u_csr.word
-#define dhu_csr_lo u_csr.bytes.byte_lo
-#define dhu_csr_hi u_csr.bytes.byte_hi
-
-typedef struct DHUregs dhuregs;
-#endif
-
-#define DHU_UBA_CSR 0
-#define DHU_UBA_CSR_HI 1
-#define DHU_UBA_RBUF 2
-#define DHU_UBA_TXCHAR 2
-#define DHU_UBA_RXTIME DHU_UBA_TXCHAR /* on a real dhu only */
-#define DHU_UBA_LPR 4
-#define DHU_UBA_STAT 6
-#define DHU_UBA_FIFO DHU_UBA_STAT /* on a real dhu only */
-#define DHU_UBA_LNCTRL 8
-#define DHU_UBA_TBUFAD1 10
-#define DHU_UBA_TBUFAD2 12
-#define DHU_UBA_TBUFCNT 14
-
-/* CSR bits */
-
-#define DHU_CSR_TX_ACTION 0100000
-#define DHU_CSR_TXIE 0040000
-#define DHU_CSR_DIAG_FAIL 0020000
-#define DHU_CSR_TX_DMA_ERROR 0010000
-#define DHU_CSR_TX_LINE_MASK 0007400
-#define DHU_CSR_RX_DATA_AVAIL 0000200
-#define DHU_CSR_RXIE 0000100
-#define DHU_CSR_MASTER_RESET 0000040
-#define DHU_CSR_UNUSED 0000020
-#define DHU_CSR_CHANNEL_MASK 0000017
-
-/* RBUF bits */
-
-#define DHU_RBUF_DATA_VALID 0100000
-#define DHU_RBUF_OVERRUN_ERR 0040000
-#define DHU_RBUF_FRAMING_ERR 0020000
-#define DHU_RBUF_PARITY_ERR 0010000
-#define DHU_RBUF_RX_LINE_MASK 0007400
-
-#define DHU_DIAG_CODE 0070001
-#define DHU_MODEM_CODE 0070000
-
-/* TXCHAR bits */
-
-#define DHU_TXCHAR_DATA_VALID 0100000
-
-/* LPR bits */
-
-#define DHU_LPR_B50 0x0
-#define DHU_LPR_B75 0x1
-#define DHU_LPR_B110 0x2
-#define DHU_LPR_B134 0x3
-#define DHU_LPR_B150 0x4
-#define DHU_LPR_B300 0x5
-#define DHU_LPR_B600 0x6
-#define DHU_LPR_B1200 0x7
-#define DHU_LPR_B1800 0x8
-#define DHU_LPR_B2000 0x9
-#define DHU_LPR_B2400 0xA
-#define DHU_LPR_B4800 0xB
-#define DHU_LPR_B7200 0xC
-#define DHU_LPR_B9600 0xD
-#define DHU_LPR_B19200 0xE
-#define DHU_LPR_B38400 0xF
-
-#define DHU_LPR_5_BIT_CHAR 0000000
-#define DHU_LPR_6_BIT_CHAR 0000010
-#define DHU_LPR_7_BIT_CHAR 0000020
-#define DHU_LPR_8_BIT_CHAR 0000030
-#define DHU_LPR_PARENB 0000040
-#define DHU_LPR_EPAR 0000100
-#define DHU_LPR_2_STOP 0000200
-
-/* STAT bits */
-
-#define DHU_STAT_DSR 0100000
-#define DHU_STAT_RI 0020000
-#define DHU_STAT_DCD 0010000
-#define DHU_STAT_CTS 0004000
-#define DHU_STAT_MDL 0001000
-#define DHU_STAT_DHU 0000400
-
-/* LNCTRL bits */
-
-#define DHU_LNCTRL_DMA_ABORT 0000001
-#define DHU_LNCTRL_IAUTO 0000002
-#define DHU_LNCTRL_RX_ENABLE 0000004
-#define DHU_LNCTRL_BREAK 0000010
-#define DHU_LNCTRL_OAUTO 0000020
-#define DHU_LNCTRL_FORCE_XOFF 0000040
-#define DHU_LNCTRL_LINK_TYPE 0000400
-#define DHU_LNCTRL_DTR 0001000
-#define DHU_LNCTRL_RTS 0010000
-
-/* TBUFAD2 bits */
-
-#define DHU_TBUFAD2_DMA_START 0000200
-#define DHU_TBUFAD2_TX_ENABLE 0100000
diff --git a/sys/arch/vax/qbus/dl.c b/sys/arch/vax/qbus/dl.c
deleted file mode 100644
index e87ab207c59..00000000000
--- a/sys/arch/vax/qbus/dl.c
+++ /dev/null
@@ -1,503 +0,0 @@
-/* $OpenBSD: dl.c,v 1.12 2010/07/02 17:27:01 nicm Exp $ */
-/* $NetBSD: dl.c,v 1.11 2000/01/24 02:40:29 matt Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997 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.
- *
- * 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 Ben Harris. All rights reserved.
- * Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
- * Copyright (c) 1982, 1986, 1990, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * 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.
- */
-
-/*
- * dl.c -- Device driver for the DL11 and DLV11 serial cards.
- *
- * OS-interface code derived from the dz and dca (hp300) drivers.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/proc.h>
-#include <sys/buf.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-#include <machine/scb.h>
-
-#include <arch/vax/qbus/ubavar.h>
-#include <arch/vax/qbus/dlreg.h>
-
-struct dl_softc {
- struct device sc_dev;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- struct tty *sc_tty;
-};
-
-static int dl_match(struct device *, struct cfdata *, void *);
-static void dl_attach(struct device *, struct device *, void *);
-static void dlrint(void *);
-static void dlxint(void *);
-static void dlstart(struct tty *);
-static int dlparam(struct tty *, struct termios *);
-static void dlbrk(struct dl_softc *, int);
-struct tty * dltty(dev_t);
- int dlopen(dev_t, int, int, struct proc *);
- int dlclose(dev_t, int, int, struct proc *);
- int dlread(dev_t, struct uio *, int);
- int dlwrite(dev_t, struct uio *, int);
- int dlioctl(dev_t, int, caddr_t, int, struct proc *);
- void dlstop(struct tty *, int);
-
-struct cfattach dl_ca = {
- sizeof(struct dl_softc), (cfmatch_t)dl_match, dl_attach
-};
-
-struct cfdriver dl_cd = {
- NULL, "dl", DV_TTY
-};
-
-#define DL_READ_WORD(reg) \
- bus_space_read_2(sc->sc_iot, sc->sc_ioh, reg)
-#define DL_WRITE_WORD(reg, val) \
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, reg, val)
-#define DL_WRITE_BYTE(reg, val) \
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, reg, val)
-
-/* Autoconfig handles: setup the controller to interrupt, */
-/* then complete the housecleaning for full operation */
-
-static int
-dl_match (parent, cf, aux)
- struct device * parent;
- struct cfdata *cf;
- void *aux;
-{
- struct uba_attach_args *ua = aux;
-
-#ifdef DL_DEBUG
- printf("Probing for dl at %lo ... ", (long)ua->ua_iaddr);
-#endif
-
- bus_space_write_2(ua->ua_iot, ua->ua_ioh, DL_UBA_XCSR, DL_XCSR_TXIE);
- if (bus_space_read_2(ua->ua_iot, ua->ua_ioh, DL_UBA_XCSR) !=
- (DL_XCSR_TXIE | DL_XCSR_TX_READY)) {
-#ifdef DL_DEBUG
- printf("failed (step 1; XCSR = %.4b)\n",
- bus_space_read_2(ua->ua_iot, ua->ua_ioh, DL_UBA_XCSR),
- DL_XCSR_BITS);
-#endif
- return 0;
- }
-
- /*
- * We have to force an interrupt so the uba driver can work
- * out where we are. Unfortunately, the only way to make a
- * DL11 interrupt is to get it to send or receive a
- * character. We'll send a NUL and hope it doesn't hurt
- * anything.
- */
-
- bus_space_write_1(ua->ua_iot, ua->ua_ioh, DL_UBA_XBUFL, '\0');
-#if 0 /* This test seems to fail 2/3 of the time :-( */
- if (dladdr->dl_xcsr != (DL_XCSR_TXIE)) {
-#ifdef DL_DEBUG
- printf("failed (step 2; XCSR = %.4b)\n", dladdr->dl_xcsr,
- DL_XCSR_BITS);
-#endif
- return 0;
- }
-#endif
- DELAY(100000); /* delay 1/10 s for character to transmit */
- if (bus_space_read_2(ua->ua_iot, ua->ua_ioh, DL_UBA_XCSR) !=
- (DL_XCSR_TXIE | DL_XCSR_TX_READY)) {
-#ifdef DL_DEBUG
- printf("failed (step 3; XCSR = %.4b)\n",
- bus_space_read_2(ua->ua_iot, ua->ua_ioh, DL_UBA_XCSR),
- DL_XCSR_BITS);
-#endif
- return 0;
- }
-
-
- /* What else do I need to do? */
-
- return 1;
-
-}
-
-static void
-dl_attach (parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct dl_softc *sc = (void *)self;
- register struct uba_attach_args *ua = aux;
-
- sc->sc_iot = ua->ua_iot;
- sc->sc_ioh = ua->ua_ioh;
-
- /* Tidy up the device */
-
- DL_WRITE_WORD(DL_UBA_RCSR, DL_RCSR_RXIE);
- DL_WRITE_WORD(DL_UBA_XCSR, DL_XCSR_TXIE);
-
- /* Initialize our softc structure. Should be done in open? */
-
- sc->sc_tty = ttymalloc(0);
-
- /* Now register the TX & RX interrupt handlers */
- uba_intr_establish(ua->ua_icookie, ua->ua_cvec , dlxint, sc);
- uba_intr_establish(ua->ua_icookie, ua->ua_cvec - 4, dlrint, sc);
-
- printf("\n");
-}
-
-/* Receiver Interrupt Handler */
-
-static void
-dlrint(arg)
- void *arg;
-{
- struct dl_softc *sc = arg;
- register struct tty *tp;
- register int cc;
- register unsigned c;
-
- if (DL_READ_WORD(DL_UBA_RCSR) & DL_RCSR_RX_DONE) {
- c = DL_READ_WORD(DL_UBA_RBUF);
- cc = c & 0xFF;
- tp = sc->sc_tty;
-
- if (!(tp->t_state & TS_ISOPEN)) {
- wakeup((caddr_t)&tp->t_rawq);
- return;
- }
-
- if (c & DL_RBUF_OVERRUN_ERR)
- /*
- * XXX: This should really be logged somwhere
- * else where we can afford the time.
- */
- log(LOG_WARNING, "%s: rx overrun\n",
- sc->sc_dev.dv_xname);
- if (c & DL_RBUF_FRAMING_ERR)
- cc |= TTY_FE;
- if (c & DL_RBUF_PARITY_ERR)
- cc |= TTY_PE;
-
- (*linesw[tp->t_line].l_rint)(cc, tp);
- } else
- log(LOG_WARNING, "%s: stray rx interrupt\n",
- sc->sc_dev.dv_xname);
- return;
-}
-
-/* Transmitter Interrupt Handler */
-
-static void
-dlxint(arg)
- void *arg;
-{
- struct dl_softc *sc = arg;
- register struct tty *tp;
-
- tp = sc->sc_tty;
- tp->t_state &= ~(TS_BUSY | TS_FLUSH);
- if (tp->t_line)
- (*linesw[tp->t_line].l_start)(tp);
- else
- dlstart(tp);
-
- return;
-}
-
-int
-dlopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- register struct tty *tp;
- register int unit;
- struct dl_softc *sc;
-
- unit = minor(dev);
-
- if (unit >= dl_cd.cd_ndevs || dl_cd.cd_devs[unit] == NULL)
- return ENXIO;
- sc = dl_cd.cd_devs[unit];
-
- tp = sc->sc_tty;
- if (tp == NULL)
- return ENODEV;
- tp->t_oproc = dlstart;
- tp->t_param = dlparam;
- tp->t_dev = dev;
-
- if (!(tp->t_state & TS_ISOPEN)) {
- ttychars(tp);
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- /* No modem control, so set CLOCAL. */
- tp->t_cflag = TTYDEF_CFLAG | CLOCAL;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
-
- dlparam(tp, &tp->t_termios);
- ttsetwater(tp);
-
- } else if ((tp->t_state & TS_XCLUDE) && suser(p, 0) != 0)
- return EBUSY;
-
- return ((*linesw[tp->t_line].l_open)(dev, tp, p));
-}
-
-/*ARGSUSED*/
-int
-dlclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct dl_softc *sc;
- register struct tty *tp;
- register int unit;
-
- unit = minor(dev);
- sc = dl_cd.cd_devs[unit];
- tp = sc->sc_tty;
-
- (*linesw[tp->t_line].l_close)(tp, flag, p);
-
- /* Make sure a BREAK state is not left enabled. */
- dlbrk(sc, 0);
-
- return (ttyclose(tp));
-}
-
-int
-dlread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- register struct tty *tp;
- struct dl_softc *sc;
- register int unit;
-
- unit = minor(dev);
- sc = dl_cd.cd_devs[unit];
- tp = sc->sc_tty;
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-dlwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- register struct tty *tp;
- struct dl_softc *sc;
- register int unit;
-
- unit = minor(dev);
- sc = dl_cd.cd_devs[unit];
- tp = sc->sc_tty;
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-int
-dlioctl(dev, cmd, data, flag, p)
- dev_t dev;
- int cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct dl_softc *sc;
- register struct tty *tp;
- register int unit;
- int error;
-
- unit = minor(dev);
- sc = dl_cd.cd_devs[unit];
- tp = sc->sc_tty;
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
-
- switch (cmd) {
-
- case TIOCSBRK:
- dlbrk(sc, 1);
- break;
-
- case TIOCCBRK:
- dlbrk(sc, 0);
- break;
-
- case TIOCMGET:
- /* No modem control, assume they're all low. */
- *(int *)data = 0;
- break;
-
- default:
- return (ENOTTY);
- }
- return (0);
-}
-
-struct tty *
-dltty(dev)
- dev_t dev;
-{
- register struct dl_softc* sc;
-
- sc = dl_cd.cd_devs[minor(dev)];
- return sc->sc_tty;
-}
-
-void
-dlstop(tp, flag)
- register struct tty *tp;
- int flag;
-{
- register struct dl_softc *sc;
- int unit, s;
-
- unit = minor(tp->t_dev);
- sc = dl_cd.cd_devs[unit];
-
- s = spltty();
-
- if (tp->t_state & TS_BUSY)
- if (!(tp->t_state & TS_TTSTOP))
- tp->t_state |= TS_FLUSH;
- splx(s);
-}
-
-static void
-dlstart(tp)
- register struct tty *tp;
-{
- register struct dl_softc *sc;
- register int unit;
- int s;
-
- unit = minor(tp->t_dev);
- sc = dl_cd.cd_devs[unit];
-
- s = spltty();
- if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
- goto out;
- ttwakeupwr(tp);
- if (tp->t_outq.c_cc == 0)
- goto out;
-
- if (DL_READ_WORD(DL_UBA_XCSR) & DL_XCSR_TX_READY) {
- tp->t_state |= TS_BUSY;
- DL_WRITE_BYTE(DL_UBA_XBUFL, getc(&tp->t_outq));
- }
-out:
- splx(s);
- return;
-}
-
-/*ARGSUSED*/
-static int
-dlparam(tp, t)
- register struct tty *tp;
- register struct termios *t;
-{
- /*
- * All this kind of stuff (speed, character format, whatever)
- * is set by jumpers on the card. Changing it is thus rather
- * tricky for a mere device driver.
- */
- return 0;
-}
-
-static void
-dlbrk(sc, state)
- register struct dl_softc *sc;
- int state;
-{
- int s = spltty();
-
- if (state) {
- DL_WRITE_WORD(DL_UBA_XCSR, DL_READ_WORD(DL_UBA_XCSR) |
- DL_XCSR_TX_BREAK);
- } else {
- DL_WRITE_WORD(DL_UBA_XCSR, DL_READ_WORD(DL_UBA_XCSR) &
- ~DL_XCSR_TX_BREAK);
- }
- splx(s);
-}
diff --git a/sys/arch/vax/qbus/dlreg.h b/sys/arch/vax/qbus/dlreg.h
deleted file mode 100644
index 42462cb38e2..00000000000
--- a/sys/arch/vax/qbus/dlreg.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $OpenBSD: dlreg.h,v 1.1 2000/04/27 03:14:47 bjc Exp $ */
-/* $NetBSD: dlreg.h,v 1.3 1999/05/27 16:02:04 ragge Exp $ */
-/*
- * Copyright (c) 1997 Ben Harris. 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 Ben Harris.
- * 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.
- */
-
-/*
- * dlreg.h -- Definitions for the DL11 and DLV11 serial cards.
- *
- * Style in imitation of dzreg.h.
- */
-
-#ifdef notdef
-union w_b
-{
- u_short word;
- struct {
- u_char byte_lo;
- u_char byte_hi;
- } bytes;
-};
-
-struct DLregs
-{
- volatile u_short dl_rcsr; /* Receive Control/Status Register (R/W) */
- volatile u_short dl_rbuf; /* Receive Buffer (R) */
- volatile u_short dl_xcsr; /* Transmit Control/Status Register (R/W) */
- volatile union w_b u_xbuf; /* Transmit Buffer (W) */
-#define dl_xbuf u_xbuf.bytes.byte_lo
-};
-
-typedef struct DLregs dlregs;
-#endif
-
-#define DL_UBA_RCSR 0
-#define DL_UBA_RBUF 2
-#define DL_UBA_XCSR 4
-#define DL_UBA_XBUFL 6
-
-/* RCSR bits */
-
-#define DL_RCSR_RX_DONE 0x0080 /* Receiver Done (R) */
-#define DL_RCSR_RXIE 0x0040 /* Receiver Interrupt Enable (R/W) */
-#define DL_RCSR_READER_ENABLE 0x0001 /* [paper-tape] Reader Enable (W) */
-#define DL_RCSR_BITS "\20\1READER_ENABLE\7RXIE\10RX_DONE\n"
-
-/* RBUF bits */
-
-#define DL_RBUF_ERR 0x8000 /* Error (R) */
-#define DL_RBUF_OVERRUN_ERR 0x4000 /* Overrun Error (R) */
-#define DL_RBUF_FRAMING_ERR 0x2000 /* Framing Error (R) */
-#define DL_RBUF_PARITY_ERR 0x1000 /* Parity Error (R) */
-#define DL_RBUF_DATA_MASK 0x00FF /* Receive Data (R) */
-#define DL_RBUF_BITS "\20\15PARITY_ERR\16FRAMING_ERR\17OVERRUN_ERR\20ERR\n"
-
-/* XCSR bits */
-
-#define DL_XCSR_TX_READY 0x0080 /* Transmitter Ready (R) */
-#define DL_XCSR_TXIE 0x0040 /* Transmit Interrupt Enable (R/W) */
-#define DL_XCSR_TX_BREAK 0x0001 /* Transmit Break (R/W) */
-#define DL_XCSR_BITS "\20\1TX_BREAK\7TXIE\10TX_READY\n"
-
-/* XBUF is just data byte right justified. */
diff --git a/sys/arch/vax/qbus/dz.c b/sys/arch/vax/qbus/dz.c
deleted file mode 100644
index a9ffa096858..00000000000
--- a/sys/arch/vax/qbus/dz.c
+++ /dev/null
@@ -1,734 +0,0 @@
-/* $OpenBSD: dz.c,v 1.22 2010/06/28 14:13:31 deraadt Exp $ */
-/* $NetBSD: dz.c,v 1.23 2000/06/04 02:14:12 matt Exp $ */
-/*
- * Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * 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/systm.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/proc.h>
-#include <sys/buf.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-#include <sys/timeout.h>
-
-#ifdef DDB
-#include <dev/cons.h>
-#endif
-
-#include <machine/bus.h>
-#include <machine/pte.h>
-#include <machine/trap.h>
-#include <machine/cpu.h>
-
-#include <arch/vax/qbus/dzreg.h>
-#include <arch/vax/qbus/dzvar.h>
-
-/* Flags used to monitor modem bits, make them understood outside driver */
-
-#define DML_DTR TIOCM_DTR
-#define DML_DCD TIOCM_CD
-#define DML_RI TIOCM_RI
-#define DML_BRK 0100000 /* no equivalent, we will mask */
-
-static const struct speedtab dzspeedtab[] =
-{
- { 0, 0 },
- { 50, DZ_LPR_B50 },
- { 75, DZ_LPR_B75 },
- { 110, DZ_LPR_B110 },
- { 134, DZ_LPR_B134 },
- { 150, DZ_LPR_B150 },
- { 300, DZ_LPR_B300 },
- { 600, DZ_LPR_B600 },
- { 1200, DZ_LPR_B1200 },
- { 1800, DZ_LPR_B1800 },
- { 2000, DZ_LPR_B2000 },
- { 2400, DZ_LPR_B2400 },
- { 3600, DZ_LPR_B3600 },
- { 4800, DZ_LPR_B4800 },
- { 7200, DZ_LPR_B7200 },
- { 9600, DZ_LPR_B9600 },
- { 19200, DZ_LPR_B19200 },
- { -1, -1 }
-};
-
-static void dzstart(struct tty *);
-static int dzparam(struct tty *, struct termios *);
-static unsigned dzmctl(struct dz_softc *, int, int, int);
-static void dzscan(void *);
-static void dzdrain(struct dz_softc *);
-
-struct cfdriver dz_cd = {
- NULL, "dz", DV_TTY
-};
-
-cdev_decl(dz);
-
-/*
- * The DZ series doesn't interrupt on carrier transitions,
- * so we have to use a timer to watch it.
- */
-int dz_timer = 0; /* true if timer started */
-
-struct timeout dz_timeout;
-
-void
-dzattach(struct dz_softc *sc)
-{
- int n;
-
- sc->sc_rxint = sc->sc_brk = 0;
-
- sc->sc_dr.dr_tcrw = sc->sc_dr.dr_tcr;
- DZ_WRITE_WORD(sc, dr_csr, DZ_CSR_MSE | DZ_CSR_RXIE | DZ_CSR_TXIE);
- dzdrain(sc);
- DZ_WRITE_BYTE(sc, dr_dtr, 0);
- DZ_WRITE_BYTE(sc, dr_break, 0);
-
- /* Initialize our softc structure. Should be done in open? */
-
- for (n = 0; n < sc->sc_type; n++) {
- sc->sc_dz[n].dz_sc = sc;
- sc->sc_dz[n].dz_line = n;
- sc->sc_dz[n].dz_tty = ttymalloc(0);
- }
-
- /* Alas no interrupt on modem bit changes, so we manually scan */
-
- if (dz_timer == 0) {
- dz_timer = 1;
- timeout_set(&dz_timeout, dzscan, NULL);
- timeout_add_sec(&dz_timeout, 1);
- }
- printf("\n");
-}
-
-/* Receiver Interrupt */
-
-void
-dzrint(void *arg)
-{
- struct dz_softc *sc = arg;
- struct tty *tp;
- int cc, line;
- unsigned c;
- int overrun = 0;
-
- sc->sc_rxint++;
-
- while ((c = DZ_READ_WORD(sc, dr_rbuf)) & DZ_RBUF_DATA_VALID) {
- cc = c & 0xFF;
- line = DZ_PORT(c>>8);
- tp = sc->sc_dz[line].dz_tty;
-
- /* Must be caught early */
- if (sc->sc_dz[line].dz_catch &&
- (*sc->sc_dz[line].dz_catch)(sc->sc_dz[line].dz_private, cc))
- continue;
-
- if (!(tp->t_state & TS_ISOPEN)) {
- wakeup((caddr_t)&tp->t_rawq);
- continue;
- }
-
- if ((c & DZ_RBUF_OVERRUN_ERR) && overrun == 0) {
- log(LOG_WARNING, "%s: silo overflow, line %d\n",
- sc->sc_dev.dv_xname, line);
- overrun = 1;
- }
-
- /* A BREAK key will appear as a NULL with a framing error */
- if (c & DZ_RBUF_FRAMING_ERR)
- cc |= TTY_FE;
- if (c & DZ_RBUF_PARITY_ERR)
- cc |= TTY_PE;
-
-#if defined(DDB) && (defined(VAX410) || defined(VAX43) || defined(VAX46) || defined(VAX48) || defined(VAX49) || defined(VAX53) || defined(VAX60))
- if (tp->t_dev == cn_tab->cn_dev) {
- int j = kdbrint(cc);
-
- if (j == 1) /* Escape received, just return */
- continue;
-
- if (j == 2) /* Second char wasn't 'D' */
- (*linesw[tp->t_line].l_rint)(27, tp);
- }
-#endif
-
- (*linesw[tp->t_line].l_rint)(cc, tp);
- }
-}
-
-/* Transmitter Interrupt */
-
-void
-dzxint(void *arg)
-{
- struct dz_softc *sc = arg;
- struct tty *tp;
- struct clist *cl;
- int line, ch, csr;
- u_char tcr;
-
- /*
- * Switch to POLLED mode.
- * Some simple measurements indicated that even on
- * one port, by freeing the scanner in the controller
- * by either providing a character or turning off
- * the port when output is complete, the transmitter
- * was ready to accept more output when polled again.
- * With just two ports running the game "worms,"
- * almost every interrupt serviced both transmitters!
- * Each UART is double buffered, so if the scanner
- * is quick enough and timing works out, we can even
- * feed the same port twice.
- *
- * Ragge 980517:
- * Do not need to turn off interrupts, already at interrupt level.
- * Remove the pdma stuff; no great need of it right now.
- */
-
- while (((csr = DZ_READ_WORD(sc, dr_csr)) & DZ_CSR_TX_READY) != 0) {
-
- line = DZ_PORT(csr>>8);
-
- tp = sc->sc_dz[line].dz_tty;
- cl = &tp->t_outq;
- tp->t_state &= ~TS_BUSY;
-
- /* Just send out a char if we have one */
- /* As long as we can fill the chip buffer, we just loop here */
- if (cl->c_cc) {
- tp->t_state |= TS_BUSY;
- ch = getc(cl);
- DZ_WRITE_BYTE(sc, dr_tbuf, ch);
- continue;
- }
- /* Nothing to send; clear the scan bit */
- /* Clear xmit scanner bit; dzstart may set it again */
- tcr = DZ_READ_WORD(sc, dr_tcrw);
- tcr &= 255;
- tcr &= ~(1 << line);
- DZ_WRITE_BYTE(sc, dr_tcr, tcr);
- if (sc->sc_dz[line].dz_catch)
- continue;
-
- if (tp->t_state & TS_FLUSH)
- tp->t_state &= ~TS_FLUSH;
- else
- ndflush(&tp->t_outq, cl->c_cc);
-
- (*linesw[tp->t_line].l_start)(tp);
- }
-}
-
-int
-dzopen(dev_t dev, int flag, int mode, struct proc *p)
-{
- struct tty *tp;
- int unit, line;
- struct dz_softc *sc;
- int s, error = 0;
-
- unit = DZ_I2C(minor(dev));
- line = DZ_PORT(minor(dev));
- if (unit >= dz_cd.cd_ndevs || dz_cd.cd_devs[unit] == NULL)
- return (ENXIO);
-
- sc = dz_cd.cd_devs[unit];
-
- if (line >= sc->sc_type)
- return ENXIO;
-
- /* if some other device is using the line, it's not available */
- if (sc->sc_dz[line].dz_catch)
- return ENXIO;
-
- if (sc->sc_openings++ == 0)
- dzdrain(sc);
-
- tp = sc->sc_dz[line].dz_tty;
- if (tp == NULL)
- return (ENODEV);
- tp->t_oproc = dzstart;
- tp->t_param = dzparam;
- tp->t_dev = dev;
- if ((tp->t_state & TS_ISOPEN) == 0) {
- ttychars(tp);
- if (tp->t_ispeed == 0) {
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_cflag = TTYDEF_CFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
- }
- (void) dzparam(tp, &tp->t_termios);
- ttsetwater(tp);
- } else if ((tp->t_state & TS_XCLUDE) && suser(p, 0) != 0)
- return (EBUSY);
- /* Use DMBIS and *not* DMSET or else we clobber incoming bits */
- if (dzmctl(sc, line, DML_DTR, DMBIS) & DML_DCD)
- tp->t_state |= TS_CARR_ON;
- s = spltty();
- while (!(flag & O_NONBLOCK) && !(tp->t_cflag & CLOCAL) &&
- !(tp->t_state & TS_CARR_ON)) {
- error = ttysleep(tp, (caddr_t)&tp->t_rawq,
- TTIPRI | PCATCH, ttopen, 0);
- if (error)
- break;
- }
- splx(s);
- if (error)
- return (error);
- return ((*linesw[tp->t_line].l_open)(dev, tp, p));
-}
-
-/*ARGSUSED*/
-int
-dzclose(dev_t dev, int flag, int mode, struct proc *p)
-{
- struct dz_softc *sc;
- struct tty *tp;
- int unit, line;
-
-
- unit = DZ_I2C(minor(dev));
- line = DZ_PORT(minor(dev));
- sc = dz_cd.cd_devs[unit];
-
- tp = sc->sc_dz[line].dz_tty;
-
- (*linesw[tp->t_line].l_close)(tp, flag, p);
-
- /* Make sure a BREAK state is not left enabled. */
- (void) dzmctl(sc, line, DML_BRK, DMBIC);
-
- /* Do a hangup if so required. */
- if ((tp->t_cflag & HUPCL) || !(tp->t_state & TS_ISOPEN))
- (void) dzmctl(sc, line, 0, DMSET);
-
- sc->sc_openings--;
- return (ttyclose(tp));
-}
-
-int
-dzread(dev_t dev, struct uio *uio, int flag)
-{
- struct tty *tp;
- struct dz_softc *sc;
-
- sc = dz_cd.cd_devs[DZ_I2C(minor(dev))];
-
- tp = sc->sc_dz[DZ_PORT(minor(dev))].dz_tty;
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-dzwrite(dev_t dev, struct uio *uio, int flag)
-{
- struct tty *tp;
- struct dz_softc *sc;
-
- sc = dz_cd.cd_devs[DZ_I2C(minor(dev))];
-
- tp = sc->sc_dz[DZ_PORT(minor(dev))].dz_tty;
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-/*ARGSUSED*/
-int
-dzioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- struct dz_softc *sc;
- struct tty *tp;
- int unit, line;
- int error;
-
- unit = DZ_I2C(minor(dev));
- line = DZ_PORT(minor(dev));
- sc = dz_cd.cd_devs[unit];
- tp = sc->sc_dz[line].dz_tty;
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
-
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
-
- switch (cmd) {
-
- case TIOCSBRK:
- (void) dzmctl(sc, line, DML_BRK, DMBIS);
- break;
-
- case TIOCCBRK:
- (void) dzmctl(sc, line, DML_BRK, DMBIC);
- break;
-
- case TIOCSDTR:
- (void) dzmctl(sc, line, DML_DTR, DMBIS);
- break;
-
- case TIOCCDTR:
- (void) dzmctl(sc, line, DML_DTR, DMBIC);
- break;
-
- case TIOCMSET:
- (void) dzmctl(sc, line, *(int *)data, DMSET);
- break;
-
- case TIOCMBIS:
- (void) dzmctl(sc, line, *(int *)data, DMBIS);
- break;
-
- case TIOCMBIC:
- (void) dzmctl(sc, line, *(int *)data, DMBIC);
- break;
-
- case TIOCMGET:
- *(int *)data = (dzmctl(sc, line, 0, DMGET) & ~DML_BRK);
- break;
-
- default:
- return (ENOTTY);
- }
- return (0);
-}
-
-struct tty *
-dztty(dev_t dev)
-{
- struct dz_softc *sc = dz_cd.cd_devs[DZ_I2C(minor(dev))];
- struct tty *tp = sc->sc_dz[DZ_PORT(minor(dev))].dz_tty;
-
- return (tp);
-}
-
-/*ARGSUSED*/
-int
-dzstop(struct tty *tp, int flag)
-{
- int s;
-
- s = spltty();
- if (tp->t_state & TS_BUSY)
- if (!(tp->t_state & TS_TTSTOP))
- tp->t_state |= TS_FLUSH;
- splx(s);
- return(0);
-}
-
-void
-dzstart(struct tty *tp)
-{
- struct dz_softc *sc;
- struct clist *cl;
- int unit, line, s;
- char state;
-
- unit = DZ_I2C(minor(tp->t_dev));
- line = DZ_PORT(minor(tp->t_dev));
- sc = dz_cd.cd_devs[unit];
-
- s = spltty();
- if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) {
- splx(s);
- return;
- }
- cl = &tp->t_outq;
- if (cl->c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)cl);
- }
- selwakeup(&tp->t_wsel);
- }
- if (cl->c_cc == 0) {
- splx(s);
- return;
- }
-
- tp->t_state |= TS_BUSY;
-
- state = DZ_READ_WORD(sc, dr_tcrw) & 255;
- if ((state & (1 << line)) == 0) {
- DZ_WRITE_BYTE(sc, dr_tcr, state | (1 << line));
- }
- dzxint(sc);
- splx(s);
-}
-
-static int
-dzparam(struct tty *tp, struct termios *t)
-{
- struct dz_softc *sc;
- int cflag = t->c_cflag;
- int unit, line;
- int ispeed = ttspeedtab(t->c_ispeed, dzspeedtab);
- int ospeed = ttspeedtab(t->c_ospeed, dzspeedtab);
- unsigned lpr;
- int s;
-
- unit = DZ_I2C(minor(tp->t_dev));
- line = DZ_PORT(minor(tp->t_dev));
- sc = dz_cd.cd_devs[unit];
-
- /* check requested parameters */
- if (ospeed < 0 || ispeed < 0 || ispeed != ospeed)
- return (EINVAL);
-
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = cflag;
-
- if (ospeed == 0) {
- (void) dzmctl(sc, line, 0, DMSET); /* hang up line */
- return (0);
- }
-
- s = spltty();
-
- lpr = DZ_LPR_RX_ENABLE | ((ispeed&0xF)<<8) | line;
-
- switch (cflag & CSIZE)
- {
- case CS5:
- lpr |= DZ_LPR_5_BIT_CHAR;
- break;
- case CS6:
- lpr |= DZ_LPR_6_BIT_CHAR;
- break;
- case CS7:
- lpr |= DZ_LPR_7_BIT_CHAR;
- break;
- default:
- lpr |= DZ_LPR_8_BIT_CHAR;
- break;
- }
- if (cflag & PARENB)
- lpr |= DZ_LPR_PARENB;
- if (cflag & PARODD)
- lpr |= DZ_LPR_OPAR;
- if (cflag & CSTOPB)
- lpr |= DZ_LPR_2_STOP;
-
- DZ_WRITE_WORD(sc, dr_lpr, lpr);
-
- splx(s);
- return (0);
-}
-
-static unsigned
-dzmctl(struct dz_softc *sc, int line, int bits, int how)
-{
- unsigned status;
- unsigned mbits;
- unsigned bit;
- int8_t tcr;
- int s;
-
- s = spltty();
-
- tcr = DZ_READ_BYTE(sc, dr_tcr);
- bit = (1 << line);
-
- mbits = 0;
-
- /* external signals as seen from the port */
-
- status = DZ_READ_BYTE(sc, dr_dcd) | sc->sc_dsr;
-
- if (status & bit)
- mbits |= DML_DCD;
-
- status = DZ_READ_BYTE(sc, dr_ring);
-
- if (status & bit)
- mbits |= DML_RI;
-
- /* internal signals/state delivered to port */
-
- status = DZ_READ_BYTE(sc, dr_dtr);
-
- if (status & bit)
- mbits |= DML_DTR;
-
- if (sc->sc_brk & bit)
- mbits |= DML_BRK;
-
- switch (how)
- {
- case DMSET:
- mbits = bits;
- break;
-
- case DMBIS:
- mbits |= bits;
- break;
-
- case DMBIC:
- mbits &= ~bits;
- break;
-
- case DMGET:
- splx(s);
- return (mbits);
- }
-
- if (mbits & DML_DTR) {
- DZ_WRITE_BYTE(sc, dr_dtr, DZ_READ_BYTE(sc, dr_dtr) | bit);
- } else {
- DZ_WRITE_BYTE(sc, dr_dtr, DZ_READ_BYTE(sc, dr_dtr) & ~bit);
- }
-
- if (mbits & DML_BRK) {
- sc->sc_brk |= bit;
- DZ_WRITE_BYTE(sc, dr_break, sc->sc_brk);
- } else {
- sc->sc_brk &= ~bit;
- DZ_WRITE_BYTE(sc, dr_break, sc->sc_brk);
- }
-
- /*
- * On VAXstation 35x0/38x0, writing to the DTR register apparently
- * affects the TCR register. Restore its value unconditionally.
- */
- DZ_WRITE_BYTE(sc, dr_tcr, tcr);
-
- splx(s);
- return (mbits);
-}
-
-/*
- * This is called by timeout() periodically.
- * Check to see if modem status bits have changed.
- */
-static void
-dzscan(void *arg)
-{
- struct dz_softc *sc;
- struct tty *tp;
- int n, bit, port;
- unsigned csr;
- int s;
-
- s = spltty();
-
- for (n = 0; n < dz_cd.cd_ndevs; n++) {
-
- if (dz_cd.cd_devs[n] == NULL)
- continue;
-
- sc = dz_cd.cd_devs[n];
-
- for (port = 0; port < sc->sc_type; port++) {
-
- tp = sc->sc_dz[port].dz_tty;
- bit = (1 << port);
-
- if ((DZ_READ_BYTE(sc, dr_dcd) | sc->sc_dsr) & bit) {
- if (!(tp->t_state & TS_CARR_ON))
- (*linesw[tp->t_line].l_modem) (tp, 1);
- } else if ((tp->t_state & TS_CARR_ON) &&
- (*linesw[tp->t_line].l_modem)(tp, 0) == 0) {
- DZ_WRITE_BYTE(sc, dr_tcr,
- (DZ_READ_WORD(sc, dr_tcrw) & 255) & ~bit);
- }
- }
-
- /*
- * If the RX interrupt rate is this high, switch
- * the controller to Silo Alarm - which means don't
- * interrupt until the RX silo has 16 characters in
- * it (the silo is 64 characters in all).
- * Avoid oscillating SA on and off by not turning
- * if off unless the rate is appropriately low.
- */
-
- csr = DZ_READ_WORD(sc, dr_csr);
-
- if (sc->sc_rxint > (16*10)) {
- if ((csr & DZ_CSR_SAE) == 0)
- DZ_WRITE_WORD(sc, dr_csr, csr | DZ_CSR_SAE);
- } else if ((csr & DZ_CSR_SAE) != 0)
- if (sc->sc_rxint < 10)
- DZ_WRITE_WORD(sc, dr_csr, csr & ~(DZ_CSR_SAE));
-
- sc->sc_rxint = 0;
- }
- splx(s);
- timeout_add_sec(&dz_timeout, 1);
-}
-
-/*
- * Called after an ubareset. The DZ card is reset, but the only thing
- * that must be done is to start the receiver and transmitter again.
- * No DMA setup to care about.
- */
-void
-dzreset(struct device *dev)
-{
- struct dz_softc *sc = (void *)dev;
- struct tty *tp;
- int i;
-
- for (i = 0; i < sc->sc_type; i++) {
- tp = sc->sc_dz[i].dz_tty;
-
- if ((tp->t_state & TS_ISOPEN) == 0)
- continue;
-
- dzparam(tp, &tp->t_termios);
- dzmctl(sc, i, DML_DTR, DMSET);
- tp->t_state &= ~TS_BUSY;
- dzstart(tp); /* Kick off transmitter again */
- }
-}
-
-/*
- * Drain RX fifo.
- */
-static void
-dzdrain(struct dz_softc *sc)
-{
- while (DZ_READ_WORD(sc, dr_rbuf) & DZ_RBUF_DATA_VALID)
- /*EMPTY*/;
-}
diff --git a/sys/arch/vax/qbus/dz_uba.c b/sys/arch/vax/qbus/dz_uba.c
deleted file mode 100644
index 151c29865f9..00000000000
--- a/sys/arch/vax/qbus/dz_uba.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/* $OpenBSD: dz_uba.c,v 1.7 2010/09/20 06:33:48 matthew Exp $ */
-/* $NetBSD: dz_uba.c,v 1.11 2000/06/04 06:17:02 matt Exp $ */
-/*
- * Copyright (c) 1998 Ludd, University of Lule}, Sweden. All rights reserved.
- * Copyright (c) 1996 Ken C. Wellsch. 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/ioctl.h>
-#include <sys/tty.h>
-#include <sys/proc.h>
-#include <sys/buf.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-#include <machine/pte.h>
-#include <machine/trap.h>
-#include <machine/scb.h>
-
-#include <arch/vax/qbus/ubavar.h>
-
-#include <arch/vax/qbus/dzreg.h>
-#include <arch/vax/qbus/dzvar.h>
-
-static int dz_uba_match(struct device *, struct cfdata *, void *);
-static void dz_uba_attach(struct device *, struct device *, void *);
-
-struct cfattach dz_uba_ca = {
- sizeof(struct dz_softc), (cfmatch_t)dz_uba_match, dz_uba_attach
-};
-
-/* Autoconfig handles: setup the controller to interrupt, */
-/* then complete the housecleaning for full operation */
-
-static int
-dz_uba_match(parent, cf, aux)
- struct device *parent;
- struct cfdata *cf;
- void *aux;
-{
- struct uba_attach_args *ua = aux;
-#ifdef notdef
- bus_space_tag_t iot = ua->ua_iot;
-#endif
- bus_space_handle_t ioh = ua->ua_ioh;
- int n;
-
- /* Reset controller to initialize, enable TX interrupts */
- /* to catch floating vector info elsewhere when completed */
-
- bus_space_write_2(iot, ioh, DZ_UBA_CSR, DZ_CSR_MSE | DZ_CSR_TXIE);
- bus_space_write_1(iot, ioh, DZ_UBA_TCR, 1);
-
- DELAY(100000); /* delay 1/10 second */
-
- bus_space_write_2(iot, ioh, DZ_UBA_CSR, DZ_CSR_RESET);
-
- /* Now wait up to 3 seconds for reset/clear to complete. */
-
- for (n = 0; n < 300; n++) {
- DELAY(10000);
- if ((bus_space_read_2(iot, ioh, DZ_UBA_CSR)&DZ_CSR_RESET) == 0)
- break;
- }
-
- /* If the RESET did not clear after 3 seconds, */
- /* the controller must be broken. */
-
- if (n >= 300)
- return (0);
-
- /* Register the TX interrupt handler */
-
-
- return (1);
-}
-
-static void
-dz_uba_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct dz_softc *sc = (void *)self;
- struct uba_attach_args *ua = aux;
-
- sc->sc_iot = ua->ua_iot;
- sc->sc_ioh = ua->ua_ioh;
-
- sc->sc_dr.dr_csr = DZ_UBA_CSR;
- sc->sc_dr.dr_rbuf = DZ_UBA_RBUF;
- sc->sc_dr.dr_dtr = DZ_UBA_DTR;
- sc->sc_dr.dr_break = DZ_UBA_BREAK;
- sc->sc_dr.dr_tbuf = DZ_UBA_TBUF;
- sc->sc_dr.dr_tcr = DZ_UBA_TCR;
- sc->sc_dr.dr_dcd = DZ_UBA_DCD;
- sc->sc_dr.dr_ring = DZ_UBA_RING;
-
- sc->sc_type = DZ_DZ;
-
- /* Now register the TX & RX interrupt handlers */
- sc->sc_tcvec = ua->ua_cvec;
- uba_intr_establish(ua->ua_icookie, sc->sc_tcvec,
- dzxint, sc, &sc->sc_tintrcnt);
- sc->sc_rcvec = ua->ua_cvec - 4;
- uba_intr_establish(ua->ua_icookie, sc->sc_rcvec,
- dzrint, sc, &sc->sc_rintrcnt);
- uba_reset_establish(dzreset, self);
-
- evcount_attach(&sc->sc_rintrcnt, sc->sc_dev.dv_xname, &sc->sc_rcvec);
- evcount_attach(&sc->sc_tintrcnt, sc->sc_dev.dv_xname, &sc->sc_tcvec);
-
- dzattach(sc);
-}
diff --git a/sys/arch/vax/qbus/dzreg.h b/sys/arch/vax/qbus/dzreg.h
deleted file mode 100644
index 4a1b9811348..00000000000
--- a/sys/arch/vax/qbus/dzreg.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* $OpenBSD: dzreg.h,v 1.3 2006/07/31 18:51:06 miod Exp $ */
-/* $NetBSD: dzreg.h,v 1.4 1999/05/27 16:03:13 ragge Exp $ */
-/*
- * Copyright (c) 1996 Ken C. Wellsch. 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. 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.
- */
-
-struct dz_regs {
- bus_addr_t dr_csr;
- bus_addr_t dr_rbuf;
-#define dr_lpr dr_rbuf
- bus_addr_t dr_dtr;
- bus_addr_t dr_break;
- bus_addr_t dr_tbuf;
- bus_addr_t dr_tcr;
- bus_addr_t dr_tcrw;
- bus_addr_t dr_ring;
- bus_addr_t dr_dcd;
-};
-#define DZ_UBA_CSR 0
-#define DZ_UBA_RBUF 2
-#define DZ_UBA_DTR 5
-#define DZ_UBA_BREAK 7
-#define DZ_UBA_TBUF 6
-#define DZ_UBA_TCR 4
-#define DZ_UBA_DCD 7
-#define DZ_UBA_RING 6
-
-/* CSR bits */
-
-#define DZ_CSR_TX_READY 0100000 /* Transmitter Ready */
-#define DZ_CSR_TXIE 0040000 /* Transmitter Interrupt Enable */
-#define DZ_CSR_SA 0020000 /* Silo Alarm */
-#define DZ_CSR_SAE 0010000 /* Silo Alarm Enable */
-#define DZ_CSR_TX_LINE_MASK 0007400 /* Which TX line */
-
-#define DZ_CSR_RX_DONE 0000200 /* Receiver Done */
-#define DZ_CSR_RXIE 0000100 /* Receiver Interrupt Enable */
-#define DZ_CSR_MSE 0000040 /* Master Scan Enable */
-#define DZ_CSR_RESET 0000020 /* Clear (reset) Controller */
-#define DZ_CSR_MAINTENANCE 0000010
-#define DZ_CSR_UNUSED 0000007
-
-/* RBUF bits */
-
-#define DZ_RBUF_DATA_VALID 0100000
-#define DZ_RBUF_OVERRUN_ERR 0040000
-#define DZ_RBUF_FRAMING_ERR 0020000
-#define DZ_RBUF_PARITY_ERR 0010000
-#define DZ_RBUF_RX_LINE_MASK 0007400
-
-/* LPR bits */
-
-#define DZ_LPR_UNUSED 0160000
-#define DZ_LPR_RX_ENABLE 0010000
-
-#define DZ_LPR_B50 0x0
-#define DZ_LPR_B75 0x1
-#define DZ_LPR_B110 0x2
-#define DZ_LPR_B134 0x3
-#define DZ_LPR_B150 0x4
-#define DZ_LPR_B300 0x5
-#define DZ_LPR_B600 0x6
-#define DZ_LPR_B1200 0x7
-#define DZ_LPR_B1800 0x8
-#define DZ_LPR_B2000 0x9
-#define DZ_LPR_B2400 0xA
-#define DZ_LPR_B3600 0xB
-#define DZ_LPR_B4800 0xC
-#define DZ_LPR_B7200 0xD
-#define DZ_LPR_B9600 0xE
-#define DZ_LPR_B19200 0xF
-
-#define DZ_LPR_OPAR 0000200
-#define DZ_LPR_PARENB 0000100
-#define DZ_LPR_2_STOP 0000040
-
-#define DZ_LPR_5_BIT_CHAR 0000000
-#define DZ_LPR_6_BIT_CHAR 0000010
-#define DZ_LPR_7_BIT_CHAR 0000020
-#define DZ_LPR_8_BIT_CHAR 0000030
-
-#define DZ_LPR_CHANNEL_MASK 0000007
diff --git a/sys/arch/vax/qbus/dzvar.h b/sys/arch/vax/qbus/dzvar.h
deleted file mode 100644
index 97431782072..00000000000
--- a/sys/arch/vax/qbus/dzvar.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* $OpenBSD: dzvar.h,v 1.7 2008/08/15 22:50:25 miod Exp $ */
-/* $NetBSD: dzvar.h,v 1.8 2000/06/04 02:14:12 matt Exp $ */
-/*
- * Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * 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.
- */
-
-/* A DZ-11 has 8 ports while a DZV/DZQ-11 has only 4. We use 8 by default */
-
-#define NDZLINE 8
-
-#define DZ_DZ 8
-#define DZ_DZV 4
-#define DZ_DC 4
-
-#define DZ_C2I(c) ((c)<<3) /* convert controller # to index */
-#define DZ_I2C(c) ((c)>>3) /* convert minor to controller # */
-#define DZ_PORT(u) ((u)&07) /* extract the port # */
-
-struct dz_softc {
- struct device sc_dev; /* Autoconf blaha */
- struct evcount sc_rintrcnt; /* receive interrupt counts */
- struct evcount sc_tintrcnt; /* transmit interrupt counts */
- int sc_rcvec, sc_tcvec; /* XXX used by attachment glue only */
- struct dz_regs sc_dr; /* reg pointers */
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- int sc_type; /* DZ11 or DZV11? */
- int sc_rxint; /* Receive interrupt count XXX */
- int sc_openings; /* # of times we've been opened */
- u_char sc_brk; /* Break asserted on some lines */
- u_char sc_dsr; /* DSR set bits if no mdm ctrl */
- struct dz_linestate {
- struct dz_softc *dz_sc; /* backpointer to softc */
- int dz_line; /* sub-driver unit number */
- void *dz_private; /* sub-driver data pointer */
- int (*dz_catch)(void *, int); /* Fast catch recv */
- struct tty * dz_tty; /* what we work on */
-#ifdef notyet
- caddr_t dz_mem; /* pointers to clist output */
- caddr_t dz_end; /* allowing pdma action */
-#endif
- } sc_dz[NDZLINE];
-};
-
-void dzattach(struct dz_softc *);
-void dzrint(void *);
-void dzxint(void *);
-void dzreset(struct device *);
-
-#define DZ_READ_BYTE(sc, adr) \
- bus_space_read_1((sc)->sc_iot, (sc)->sc_ioh, (sc)->sc_dr.adr)
-#define DZ_READ_WORD(sc, adr) \
- bus_space_read_2((sc)->sc_iot, (sc)->sc_ioh, (sc)->sc_dr.adr)
-#define DZ_WRITE_BYTE(sc, adr, val) \
- bus_space_write_1((sc)->sc_iot, (sc)->sc_ioh, (sc)->sc_dr.adr, val)
-#define DZ_WRITE_WORD(sc, adr, val) \
- bus_space_write_2((sc)->sc_iot, (sc)->sc_ioh, (sc)->sc_dr.adr, val)
diff --git a/sys/arch/vax/qbus/files.uba b/sys/arch/vax/qbus/files.uba
deleted file mode 100644
index 4c9b72ab88b..00000000000
--- a/sys/arch/vax/qbus/files.uba
+++ /dev/null
@@ -1,44 +0,0 @@
-# $OpenBSD: files.uba,v 1.4 2011/07/06 18:32:59 miod Exp $
-# $NetBSD: files.uba,v 1.6 1999/06/20 18:09:22 ragge Exp $
-#
-# Config file and device description for machine-independent
-# code for devices Digital Equipment Corp. Unibus and Q22 bus.
-# Included by ports that need it.
-device uba {csr}
-
-define qfont
-
-file arch/vax/qbus/uba.c uba
-
-# DZ-11 (-compatible) tty device driver.
-device dz {line = -1}: tty
-attach dz at uba with dz_uba
-file arch/vax/qbus/dz.c dz needs-flag
-file arch/vax/qbus/dz_uba.c dz_uba
-
-# DL-11 at UBA
-device dl: tty
-attach dl at uba
-file arch/vax/qbus/dl.c dl needs-flag
-
-# DHU-11 at UBA
-device dhu: tty
-attach dhu at uba
-file arch/vax/qbus/dhu.c dhu needs-flag
-
-# UDA50/whatever disk/tape MSCP controller
-device mtc: mscp
-attach mtc at uba
-device uda: mscp
-attach uda at uba
-file arch/vax/qbus/uda.c uda | mtc
-
-# DEQNA/DELQA Ethernet controller
-device qe: ifnet, ether
-attach qe at uba
-file arch/vax/if/if_qe.c qe
-
-# DEUNA/DELUA Ethernet controller
-device de: ifnet, ether
-attach de at uba
-file arch/vax/if/if_de.c de
diff --git a/sys/arch/vax/qbus/qdreg.h b/sys/arch/vax/qbus/qdreg.h
deleted file mode 100644
index 265ce48d803..00000000000
--- a/sys/arch/vax/qbus/qdreg.h
+++ /dev/null
@@ -1,379 +0,0 @@
-/* $OpenBSD: qdreg.h,v 1.5 2007/05/25 21:27:15 krw Exp $ */
-/* $NetBSD: qdreg.h,v 1.1 1998/03/21 10:02:39 ragge Exp $ */
-/*-
- * Copyright (c) 1982, 1986 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.
- *
- * @(#)qdreg.h 7.1 (Berkeley) 5/9/91
- */
-
-/************************************************************************
- * *
- * Copyright (c) 1985, 1986 by *
- * Digital Equipment Corporation, Maynard, MA *
- * All rights reserved. *
- * *
- * This software is furnished under a license and may be used and *
- * copied only in accordance with the terms of such license and *
- * with the inclusion of the above copyright notice. This *
- * software or any other copies thereof may not be provided or *
- * otherwise made available to any other person. No title to and *
- * ownership of the software is hereby transferred. *
- * *
- * The information in this software is subject to change without *
- * notice and should not be construed as a commitment by Digital *
- * Equipment Corporation. *
- * *
- * Digital assumes no responsibility for the use or reliability *
- * of its software on equipment which is not supplied by Digital. *
- * *
- ************************************************************************/
-
-/* Dragon ADDER reg map */
-/* ADDER register bit definitions */
-/* Y_SCROLL_CONSTANT */
-
-#define SCROLL_ERASE 0x2000
-#define ADDER_SCROLL_DOWN 0x1000
-
-/* ADDER status and interrupt enable registers [1], [2], [3] */
-
-#define DISABLE 0x0000
-#define PAUSE_COMPLETE 0x0001
-#define FRAME_SYNC 0x0002
-#define INIT_COMPLETE 0x0004
-#define RASTEROP_COMPLETE 0x0008
-
-#define ADDRESS_COMPLETE 0x0010
-#define RX_READY 0x0020
-#define TX_READY 0x0040
-#define ID_SCROLL_READY 0x0080
-
-#define TOP_CLIP 0x0100
-#define BOTTOM_CLIP 0x0200
-#define LEFT_CLIP 0x0400
-#define RIGHT_CLIP 0x0800
-#define NO_CLIP 0x1000
-#define VSYNC 0x2000
-
-/* ADDER command register [8], [10] */
-
-#define OCR_zero 0x0000
-#define Z_BLOCK0 0x0000
-#define OCRA 0x0000
-#define OCRB 0x0004
-#define RASTEROP 0x02c0
-#define PBT 0x03c0
-#define BTPZ 0x0bb0
-#define PTBZ 0x07a0
-#define DTE 0x0400
-#define S1E 0x0800
-#define S2E 0x1000
-#define VIPER_Z_LOAD 0x01A0
-#define ID_LOAD 0x0100
-#define CANCEL 0x0000
-#define LF_R1 0x0000
-#define LF_R2 0x0010
-#define LF_R3 0x0020
-#define LF_R4 0x0030
-
-/* ADDER rasterop mode register [9] */
-
-#define NORMAL 0x0000
-#define LINEAR_PATTERN 0x0002
-#define X_FILL 0x0003
-#define Y_FILL 0x0007
-#define BASELINE 0x0008
-#define HOLE_ENABLE 0x0010
-#define SRC_1_INDEX_ENABLE 0x0020
-#define DST_INDEX_ENABLE 0x0040
-#define DST_WRITE_ENABLE 0x0080
-
-/* ADDER source 2 size register */
-
-#define NO_TILE 0x0080
-
-/* External registers base addresses */
-
-#define CS_UPDATE_MASK 0x0060
-#define CS_SCROLL_MASK 0x0040
-
-/* VIPER registers */
-
-#define RESOLUTION_MODE 0x0080
-#define MEMORY_BUS_WIDTH 0x0081
-#define PLANE_ADDRESS 0x0083
-#define LU_FUNCTION_R1 0x0084
-#define LU_FUNCTION_R2 0x0085
-#define LU_FUNCTION_R3 0x0086
-#define LU_FUNCTION_R4 0x0087
-#define MASK_1 0x0088
-#define MASK_2 0x0089
-#define SOURCE 0x008a
-#define SOURCE_Z 0x0000
-#define BACKGROUND_COLOR 0x008e
-#define BACKGROUND_COLOR_Z 0x000C
-#define FOREGROUND_COLOR 0x008f
-#define FOREGROUND_COLOR_Z 0x0004
-#define SRC1_OCR_A 0x0090
-#define SRC2_OCR_A 0x0091
-#define DST_OCR_A 0x0092
-#define SRC1_OCR_B 0x0094
-#define SRC2_OCR_B 0x0095
-#define DST_OCR_B 0x0096
-
-/* VIPER scroll registers */
-
-#define SCROLL_CONSTANT 0x0082
-#define SCROLL_FILL 0x008b
-#define SCROLL_FILL_Z 0x0008
-#define LEFT_SCROLL_MASK 0x008c
-#define RIGHT_SCROLL_MASK 0x008d
-
-/* VIPER register bit definitions */
-
-#define EXT_NONE 0x0000
-#define EXT_SOURCE 0x0001
-#define EXT_M1_M2 0x0002
-#define INT_NONE 0x0000
-#define INT_SOURCE 0x0004
-#define INT_M1_M2 0x0008
-#define ID 0x0010
-#define NO_ID 0x0000
-#define WAIT 0x0020
-#define NO_WAIT 0x0000
-#define BAR_SHIFT_DELAY WAIT
-#define NO_BAR_SHIFT_DELAY NO_WAIT
-
-
-/* VIPER logical function unit codes */
-
-#define LF_ZEROS 0x0000
-#define LF_NOT_D 0x0003
-#define LF_D_XOR_S 0x0006
-#define LF_D 0x000c
-#define LF_SOURCE 0x000a
-#define LF_D_OR_S 0x000d
-#define LF_ONES 0x000f
-#define INV_M1_M2 0x0030
-#define FULL_SRC_RESOLUTION 0X00C0 /* makes second pass like first pass */
-
-/* VIPER scroll register [2] */
-
-#define SCROLL_DISABLE 0x0040
-#define SCROLL_ENABLE 0x0020
-#define VIPER_LEFT 0x0000
-#define VIPER_RIGHT 0x0010
-#define VIPER_UP 0x0040
-#define VIPER_DOWN 0x0000
-
-/* Adder scroll register */
-
-#define ADDER_UP 0x0000
-#define ADDER_DOWN 0x1000
-
-/* Misc scroll definitions */
-
-#define UP 0
-#define DOWN 1
-#define LEFT 2
-#define RIGHT 3
-#define NODIR 4
-#define SCROLL_VMAX 31
-#define SCROLL_HMAX 15
-#define NEW 2
-#define OLD 1
-#define BUSY 1
-#define DRAG 1
-#define SCROLL 0
-
-/* miscellaneous defines */
-
-#define ALL_PLANES 0xffffffff
-#define UNITY 0x1fff /* Adder scale factor */
-#define MAX_SCREEN_X 1024
-#define MAX_SCREEN_Y 864
-#define FONT_HEIGHT 32
-
- struct adder {
-
- /* adder control registers */
-
- u_short register_address; /* ADDER reg pntr for use by DGA */
- u_short request_enable; /* DMA request enables */
- u_short interrupt_enable; /* interrupt enables */
- u_short status; /* ADDER status bits */
- u_short reserved1; /* test function only */
- u_short spare1; /* spare address (what else?) */
-
- u_short reserved2; /* test function only */
- u_short id_data; /* data path to I/D bus */
- u_short command; /* ADDER chip command register */
- u_short rasterop_mode; /* sets rasterop execution modes */
- u_short cmd; /* duplicate path to above cmd reg */
- u_short reserved3; /* test function only */
-
- /* scroll registers */
-
- u_short ID_scroll_data; /* I/D bus scroll data */
- u_short ID_scroll_command; /* I/D bus scroll command */
- u_short scroll_x_min; /* X scroll min - left boundary */
- u_short scroll_x_max; /* X scroll max - right boundary */
- u_short scroll_y_min; /* Y scroll min - upper boundary */
- u_short scroll_y_max; /* Y scroll max - lower boundary */
- u_short pause; /* Y coord to set stat when scanned */
- u_short y_offset_pending; /* vertical scroll control */
- u_short y_scroll_constant;
-
- /* update control registers */
-
- u_short x_index_pending; /* x pending index */
- u_short y_index_pending; /* y pending index */
- u_short x_index_new; /* new x index */
- u_short y_index_new; /* new y index */
- u_short x_index_old; /* old x index */
- u_short y_index_old; /* old y index */
- u_short x_clip_min; /* left clipping boundary */
- u_short x_clip_max; /* right clipping boundary */
- u_short y_clip_min; /* upper clipping boundary */
- u_short y_clip_max; /* lower clipping boundary */
- u_short spare2; /* spare address (another!) */
-
- /* rasterop control registers */
-
- u_short source_1_dx; /* source #1 x vector */
- u_short source_1_dy; /* source #1 y vector*/
- u_short source_1_x; /* source #1 x origin */
- u_short source_1_y; /* source #1 y origin */
- u_short destination_x; /* destination x origin */
- u_short destination_y; /* destination y origin */
- u_short fast_dest_dx; /* destination x fast vector */
- u_short fast_dest_dy; /* destination y fast vector */
- u_short slow_dest_dx; /* destination x slow vector */
- u_short slow_dest_dy; /* destination y slow vector */
- u_short fast_scale; /* scale factor for fast vector */
- u_short slow_scale; /* scale factor for slow vector */
- u_short source_2_x; /* source #2 x origin */
- u_short source_2_y; /* source #2 y origin */
- u_short source_2_size; /* source #2 height & width */
- u_short error_1; /* error regs (?) */
- u_short error_2;
-
- /* screen format control registers */
-
- u_short y_scan_count_0; /* y scan counts for vert timing */
- u_short y_scan_count_1;
- u_short y_scan_count_2;
- u_short y_scan_count_3;
- u_short x_scan_conf; /* x scan configuration */
- u_short x_limit;
- u_short y_limit;
- u_short x_scan_count_0; /* x scan count for horiz timing */
- u_short x_scan_count_1;
- u_short x_scan_count_2;
- u_short x_scan_count_3;
- u_short x_scan_count_4;
- u_short x_scan_count_5;
- u_short x_scan_count_6;
- u_short sync_phase_adj; /* sync phase (horiz sync count) */
- };
-
-/*---------------------
-* DUART definitions */
-
- /* command definitions */
-
-#define EN_RCV 0x01
-#define DIS_RCV 0x02
-#define EN_XMT 0x04
-#define DIS_XMT 0x08
-#define RESET_M 0x10
-#define RESET_RCV 0x20
-#define RESET_XMT 0x30
-#define RESET_ERR 0x40
-#define RESET_BD 0x50
-#define START_BREAK 0x60
-#define STOP_BREAK 0x70
-
- /* interrupt bit definitions */
-
-#define EI_XMT_A 0x01
-#define EI_RCV_A 0x02
-#define EI_XMT_B 0x10
-#define EI_RCV_B 0x20
-
-#define XMT_RDY_A 0x01
-#define RCV_RDY_A 0x02
-#define XMT_RDY_B 0x10
-#define RCV_RDY_B 0x20
-
- /* status register bit definitions */
-
-#define RCV_RDY 0x01
-#define FIFO_FULL 0x02
-#define XMT_RDY 0x04
-#define XMT_EMT 0x08
-#define OVER_ERR 0x10
-#define ERR_PARITY 0x20
-#define FRAME_ERR 0x40
-#define RCVD_BREAK 0x80
-
-
- struct duart {
-
- /* channel A - LK201 */
-
- short modeA; /* ch.A mode reg (read/write) */
- short statusA; /* ch.A status reg (read) */
-#define clkselA statusA /* ch.A clock slect reg (write) */
- short cmdA; /* ch.A command reg (write) */
- short dataA; /* rcv/xmt data ch.A (read/write) */
- short inchng; /* input change state reg (read) */
-#define auxctl inchng /* auxiliary control reg (write) */
- short istatus; /* interrupt status reg (read) */
-#define imask istatus /* interrupt mask reg (write) */
- short CThi; /* counter/timer hi byte (read) */
-#define CTRhi CThi /* counter/timer hi reg (write) */
- short CTlo; /* counter/timer lo byte (read) */
-#define CTRlo CTlo /* counter/timer lo reg (write) */
-
- /* channel B - pointing device */
-
- short modeB; /* ch.B mode reg (read/write) */
- short statusB; /* ch.B status reg (read) */
-#define clkselB statusB /* ch.B clock select reg (write) */
- short cmdB; /* ch.B command reg (write) */
- short dataB; /* ch.B rcv/xmt data (read/write) */
- short rsrvd;
- short inport; /* input port (read) */
-#define outconf inport /* output port config reg (write) */
- short strctr; /* start counter command (read) */
-#define setbits setctr /* output bits set command (write) */
- short stpctr; /* stop counter command (read) */
-#define resetbits stpctr /* output bits reset cmd (write) */
-
-};
diff --git a/sys/arch/vax/qbus/qevent.h b/sys/arch/vax/qbus/qevent.h
deleted file mode 100644
index 6353d2afc6b..00000000000
--- a/sys/arch/vax/qbus/qevent.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $OpenBSD: qevent.h,v 1.2 2003/06/02 23:27:58 millert Exp $ */
-/* $NetBSD: qevent.h,v 1.1 1998/03/21 10:02:39 ragge Exp $ */
-/*-
- * Copyright (c) 1982, 1986 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.
- *
- * @(#)qevent.h 7.1 (Berkeley) 5/9/91
- */
-
-/************************************************************************
-* *
-* Copyright (c) 1985 by *
-* Digital Equipment Corporation, Maynard, MA *
-* All rights reserved. *
-* *
-* This software is furnished under a license and may be used and *
-* copied only in accordance with the terms of such license and *
-* with the inclusion of the above copyright notice. This *
-* software or any other copies thereof may not be provided or *
-* otherwise made available to any other person. No title to and *
-* ownership of the software is hereby transferred. *
-* *
-* The information in this software is subject to change without *
-* notice and should not be construed as a commitment by Digital *
-* Equipment Corporation. *
-* *
-* Digital assumes no responsibility for the use or reliability *
-* of its software on equipment which is not supplied by Digital. *
-* *
-************************************************************************/
-
-/*
- * Event queue entries
- */
-
-#ifndef _QEVENT_
-#define _QEVENT_
-
-typedef struct _vs_event {
- unsigned short vse_x; /* x position */
- unsigned short vse_y; /* y position */
- unsigned short vse_time;/* 10 millisecond units (button only) */
- char vse_type; /* button or motion? */
- unsigned char vse_key; /* the key (button only) */
- char vse_direction; /* which direction (button only) */
- char vse_device; /* which device (button only) */
-} vsEvent;
-
-/* vse_type field */
-#define VSE_BUTTON 0 /* button moved */
-#define VSE_MMOTION 1 /* mouse moved */
-#define VSE_TMOTION 2 /* tablet moved */
-
-/* vse_direction field */
-#define VSE_KBTUP 0 /* up */
-#define VSE_KBTDOWN 1 /* down */
-#define VSE_KBTRAW 2 /* undetermined */
-
-/* vse_device field */
-#define VSE_NULL 0 /* NULL event (for QD_GETEVENT ret) */
-#define VSE_MOUSE 1 /* mouse */
-#define VSE_DKB 2 /* main keyboard */
-#define VSE_TABLET 3 /* graphics tablet */
-#define VSE_AUX 4 /* auxiliary */
-#define VSE_CONSOLE 5 /* console */
-
-/* The event queue */
-
-typedef struct _vs_eventqueue {
- vsEvent *events; /* input event buffer */
- int size; /* size of event buffer */
- int head; /* index into events */
- int tail; /* index into events */
-} vsEventQueue;
-
-/* mouse cursor position */
-
-typedef struct _vs_cursor {
- short x;
- short y;
-} vsCursor;
-
-/* mouse motion rectangle */
-
-typedef struct _vs_box {
- short bottom;
- short right;
- short left;
- short top;
-} vsBox;
-
-#endif /*_QEVENT_*/
diff --git a/sys/arch/vax/qbus/uba.c b/sys/arch/vax/qbus/uba.c
deleted file mode 100644
index 893b064c3c0..00000000000
--- a/sys/arch/vax/qbus/uba.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/* $OpenBSD: uba.c,v 1.15 2015/09/13 12:31:35 miod Exp $ */
-/* $NetBSD: uba.c,v 1.57 2001/04/26 19:16:07 ragge Exp $ */
-/*
- * Copyright (c) 1996 Jonathan Stone.
- * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
- * Copyright (c) 1982, 1986 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.
- *
- * @(#)uba.c 7.10 (Berkeley) 12/16/90
- * @(#)autoconf.c 7.20 (Berkeley) 5/9/91
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/bus.h>
-#include <machine/scb.h>
-#include <machine/cpu.h>
-
-#include <arch/vax/uba/ubareg.h>
-#include <arch/vax/qbus/ubavar.h>
-
-static int ubasearch (struct device *, struct cfdata *, void *);
-static int ubaprint (void *, const char *);
-
-struct cfdriver uba_cd = {
- NULL, "uba", DV_DULL
-};
-
-/*
- * If we failed to allocate uba resources, put us on a queue to wait
- * until there is available resources. Resources to compete about
- * are map registers and BDPs. This is normally only a problem on
- * Unibus systems, Qbus systems have more map registers than usable.
- */
-void
-uba_enqueue(struct uba_unit *uu)
-{
- struct uba_softc *uh;
- int s;
-
- uh = (void *)((struct device *)(uu->uu_softc))->dv_parent;
-
- s = splvm();
- SIMPLEQ_INSERT_TAIL(&uh->uh_resq, uu, uu_resq);
- splx(s);
-}
-
-/*
- * When a routine that uses resources is finished, the next device
- * in queue for map registers etc is called. If it succeeds to get
- * resources, call next, and next, and next...
- * This routine must be called at splvm.
- */
-void
-uba_done(struct uba_softc *uh)
-{
- struct uba_unit *uu;
-
- while ((uu = SIMPLEQ_FIRST(&uh->uh_resq))) {
- SIMPLEQ_REMOVE_HEAD(&uh->uh_resq, uu_resq);
- if ((*uu->uu_ready)(uu) == 0) {
- SIMPLEQ_INSERT_HEAD(&uh->uh_resq, uu, uu_resq);
- break;
- }
- }
-}
-
-/*
- * Each device that needs some handling if an ubareset occurs must
- * register for reset first through this routine.
- */
-void
-uba_reset_establish(void (*reset)(struct device *), struct device *dev)
-{
- struct uba_softc *uh = (void *)dev->dv_parent;
- struct uba_reset *ur;
-
- ur = malloc(sizeof(struct uba_reset), M_DEVBUF, M_NOWAIT);
- if (ur == NULL)
- panic("uba_reset_establish");
- ur->ur_dev = dev;
- ur->ur_reset = reset;
-
- SIMPLEQ_INSERT_TAIL(&uh->uh_resetq, ur, ur_resetq);
-}
-
-/*
- * Allocate a bunch of map registers and map them to the given address.
- */
-int
-uballoc(struct uba_softc *uh, struct ubinfo *ui, int flags)
-{
- int waitok = (flags & UBA_CANTWAIT) == 0;
- int error;
-
- if ((error = bus_dmamap_create(uh->uh_dmat, ui->ui_size, 1,
- ui->ui_size, 0, (waitok ? BUS_DMA_WAITOK : BUS_DMA_NOWAIT),
- &ui->ui_dmam)))
- return error;
-
- if ((error = bus_dmamap_load(uh->uh_dmat, ui->ui_dmam, ui->ui_vaddr,
- ui->ui_size, NULL, (waitok ? BUS_DMA_WAITOK : BUS_DMA_NOWAIT)))) {
- bus_dmamap_destroy(uh->uh_dmat, ui->ui_dmam);
- return error;
- }
- ui->ui_baddr = ui->ui_dmam->dm_segs[0].ds_addr;
- return 0;
-}
-
-/*
- * Allocate DMA-able memory and map it on the unibus.
- */
-int
-ubmemalloc(struct uba_softc *uh, struct ubinfo *ui, int flags)
-{
- int waitok = (flags & UBA_CANTWAIT ? BUS_DMA_NOWAIT : BUS_DMA_WAITOK);
- int error;
-
- if ((error = bus_dmamem_alloc(uh->uh_dmat, ui->ui_size, NBPG, 0,
- &ui->ui_seg, 1, &ui->ui_rseg, waitok)))
- return error;
- if ((error = bus_dmamem_map(uh->uh_dmat, &ui->ui_seg, ui->ui_rseg,
- ui->ui_size, &ui->ui_vaddr, waitok|BUS_DMA_COHERENT))) {
- bus_dmamem_free(uh->uh_dmat, &ui->ui_seg, ui->ui_rseg);
- return error;
- }
- if ((error = uballoc(uh, ui, flags))) {
- bus_dmamem_unmap(uh->uh_dmat, ui->ui_vaddr, ui->ui_size);
- bus_dmamem_free(uh->uh_dmat, &ui->ui_seg, ui->ui_rseg);
- }
- return error;
-}
-
-void
-ubfree(struct uba_softc *uh, struct ubinfo *ui)
-{
- bus_dmamap_unload(uh->uh_dmat, ui->ui_dmam);
- bus_dmamap_destroy(uh->uh_dmat, ui->ui_dmam);
-}
-
-void
-ubmemfree(struct uba_softc *uh, struct ubinfo *ui)
-{
- bus_dmamem_unmap(uh->uh_dmat, ui->ui_vaddr, ui->ui_size);
- bus_dmamem_free(uh->uh_dmat, &ui->ui_seg, ui->ui_rseg);
- ubfree(uh, ui);
-}
-
-/*
- * Generate a reset on uba number uban. Then
- * call each device that asked to be called during attach,
- * giving it a chance to clean up so as to be able to continue.
- */
-void
-ubareset(struct uba_softc *uh)
-{
- struct uba_reset *ur;
- int s;
-
- s = splvm();
- SIMPLEQ_INIT(&uh->uh_resq);
- printf("%s: reset", uh->uh_dev.dv_xname);
- (*uh->uh_ubainit)(uh);
-
- ur = SIMPLEQ_FIRST(&uh->uh_resetq);
- if (ur) do {
- printf(" %s", ur->ur_dev->dv_xname);
- (*ur->ur_reset)(ur->ur_dev);
- } while ((ur = SIMPLEQ_NEXT(ur, ur_resetq)));
-
- printf("\n");
- splx(s);
-}
-
-/*
- * The common attach routine:
- * Calls the scan routine to search for uba devices.
- */
-void
-uba_attach(struct uba_softc *sc, paddr_t iopagephys)
-{
-
- /*
- * Set last free interrupt vector for devices with
- * programmable interrupt vectors. Use is to decrement
- * this number and use result as interrupt vector.
- */
- sc->uh_lastiv = 0x200;
- SIMPLEQ_INIT(&sc->uh_resq);
- SIMPLEQ_INIT(&sc->uh_resetq);
-
- /*
- * Allocate place for unibus I/O space in virtual space.
- */
- if (bus_space_map(sc->uh_iot, iopagephys, UBAIOSIZE, 0, &sc->uh_ioh))
- return;
-
- if (sc->uh_beforescan)
- (*sc->uh_beforescan)(sc);
- /*
- * Now start searching for devices.
- */
- config_search((cfmatch_t)ubasearch,(struct device *)sc, NULL);
-
- if (sc->uh_afterscan)
- (*sc->uh_afterscan)(sc);
-}
-
-int
-ubasearch(struct device *parent, struct cfdata *cf, void *aux)
-{
- struct uba_softc *sc = (struct uba_softc *)parent;
- struct uba_attach_args ua;
- int i, vec, br;
-
- ua.ua_ioh = ubdevreg(cf->cf_loc[0]) + sc->uh_ioh;
- ua.ua_iot = sc->uh_iot;
- ua.ua_dmat = sc->uh_dmat;
-
- if (badaddr((caddr_t)ua.ua_ioh, 2) ||
- (sc->uh_errchk ? (*sc->uh_errchk)(sc):0))
- goto forgetit;
-
- scb_vecref(0, 0); /* Clear vector ref */
- i = (*cf->cf_attach->ca_match) (parent, cf, &ua);
-
- if (sc->uh_errchk)
- if ((*sc->uh_errchk)(sc))
- goto forgetit;
- if (i == 0)
- goto forgetit;
-
- i = scb_vecref(&vec, &br);
- if (i == 0)
- goto fail;
- if (vec == 0)
- goto fail;
-
- ua.ua_br = br;
- ua.ua_cvec = vec;
- ua.ua_iaddr = cf->cf_loc[0];
-
- config_attach(parent, cf, &ua, ubaprint);
- return 0;
-
-fail:
- printf("%s%d at %s csr %lo %s\n",
- cf->cf_driver->cd_name, cf->cf_unit, parent->dv_xname,
- cf->cf_loc[0], (i ? "zero vector" : "didn't interrupt"));
-
-forgetit:
- return 0;
-}
-
-/*
- * Print out some interesting info common to all unibus devices.
- */
-int
-ubaprint(void *aux, const char *uba)
-{
- struct uba_attach_args *ua = aux;
-
- printf(" csr %o vec %d ipl %x", ua->ua_iaddr,
- ua->ua_cvec & 511, ua->ua_br);
- return UNCONF;
-}
-
-/*
- * Move to machdep eventually
- */
-void
-uba_intr_establish(icookie, vec, ifunc, iarg, ev)
- void *icookie;
- int vec;
- void (*ifunc)(void *iarg);
- void *iarg;
- struct evcount *ev;
-{
- scb_vecalloc(vec, ifunc, iarg, SCB_ISTACK, ev);
-}
diff --git a/sys/arch/vax/qbus/ubavar.h b/sys/arch/vax/qbus/ubavar.h
deleted file mode 100644
index 76dfc731345..00000000000
--- a/sys/arch/vax/qbus/ubavar.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/* $OpenBSD: ubavar.h,v 1.9 2015/02/01 15:27:11 miod Exp $ */
-/* $NetBSD: ubavar.h,v 1.31 2001/04/26 19:16:07 ragge Exp $ */
-
-/*
- * Copyright (c) 1982, 1986 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.
- *
- * @(#)ubavar.h 7.7 (Berkeley) 6/28/90
- */
-#ifndef _QBUS_UBAVAR_H
-#define _QBUS_UBAVAR_H
-
-/*
- * This file contains definitions related to the kernel structures
- * for dealing with the unibus adapters.
- *
- * Each uba has a uba_softc structure.
- * Each unibus controller which is not a device has a uba_ctlr structure.
- * Each unibus device has a uba_device structure.
- */
-
-/*
- * Per-uba structure.
- *
- * This structure holds the interrupt vector for the uba,
- * and its address in physical and virtual space. At boot time
- * we determine the devices attached to the uba's and their
- * interrupt vectors, filling in uh_vec. We free the map
- * register and bdp resources of the uba into the structures
- * defined here.
- *
- * During normal operation, resources are allocated and returned
- * to the structures here. We watch the number of passive releases
- * on each uba, and if the number is excessive may reset the uba.
- *
- * When uba resources are needed and not available, or if a device
- * which can tolerate no other uba activity (rk07) gets on the bus,
- * then device drivers may have to wait to get to the bus and are
- * queued here. It is also possible for processes to block in
- * the unibus driver in resource wait (mrwant, bdpwant); these
- * wait states are also recorded here.
- */
-struct uba_softc {
- struct device uh_dev; /* Device struct, autoconfig */
- struct evcount uh_intrcnt; /* interrupt counting */
- SIMPLEQ_HEAD(, uba_unit) uh_resq; /* resource wait chain */
- SIMPLEQ_HEAD(, uba_reset) uh_resetq; /* ubareset queue */
- int uh_lastiv; /* last free interrupt vector */
- int (*uh_errchk)(struct uba_softc *);
- void (*uh_beforescan)(struct uba_softc *);
- void (*uh_afterscan)(struct uba_softc *);
- void (*uh_ubainit)(struct uba_softc *);
- void (*uh_ubapurge)(struct uba_softc *, int);
- short uh_nr; /* Unibus sequential number */
- bus_space_tag_t uh_iot; /* Tag for this Unibus */
- bus_space_handle_t uh_ioh; /* Handle for I/O space */
- bus_dma_tag_t uh_dmat;
-};
-
-/*
- * Per-controller structure.
- * The unit struct is common to both the adapter and the controller
- * to which it belongs. It is only used on controllers that handles
- * BDP's, and calls the adapter queueing subroutines.
- */
-struct uba_unit {
- SIMPLEQ_ENTRY(uba_unit) uu_resq;/* Queue while waiting for resources */
- void *uu_softc; /* Pointer to units softc */
- int uu_bdp; /* for controllers that hang on to bdp's */
- int (*uu_ready)(struct uba_unit *);
- void *uu_ref; /* Buffer this is related to */
- short uu_xclu; /* want exclusive use of bdp's */
-};
-
-/*
- * Reset structure. All devices that needs to be reinitialized
- * after an ubareset registers with this struct.
- */
-struct uba_reset {
- SIMPLEQ_ENTRY(uba_reset) ur_resetq;
- void (*ur_reset)(struct device *);
- struct device *ur_dev;
-};
-
-/*
- * uba_attach_args is used during autoconfiguration. It is sent
- * from ubascan() to each (possible) device.
- */
-struct uba_attach_args {
- bus_space_tag_t ua_iot; /* Tag for this bus I/O-space */
- bus_addr_t ua_ioh; /* I/O regs addr */
- bus_dma_tag_t ua_dmat;
- void *ua_icookie; /* Cookie for interrupt establish */
- int ua_iaddr; /* Full CSR address of device */
- int ua_br; /* IPL this dev interrupted on */
- int ua_cvec; /* Vector for this device */
-};
-
-/*
- * Flags to UBA map/bdp allocation routines
- */
-#define UBA_NEEDBDP 0x01 /* transfer needs a bdp */
-#define UBA_CANTWAIT 0x02 /* don't block me */
-#define UBA_NEED16 0x04 /* need 16 bit addresses only */
-#define UBA_HAVEBDP 0x08 /* use bdp specified in high bits */
-#define UBA_DONTQUE 0x10 /* Do not enqueue xfer */
-
-/*
- * Struct for unibus allocation.
- */
-struct ubinfo {
- bus_dmamap_t ui_dmam;
- bus_dma_segment_t ui_seg;
- int ui_rseg;
- caddr_t ui_vaddr;
- bus_addr_t ui_baddr;
- bus_size_t ui_size;
-};
-
-/*
- * Some common defines for all subtypes of U/Q-buses/adapters.
- */
-#define ubdevreg(addr) ((addr) & 017777)
-
-#ifdef _KERNEL
-void uba_intr_establish(void *, int, void (*)(void *), void *, struct evcount *);
-void uba_reset_establish(void (*)(struct device *), struct device *);
-void uba_attach(struct uba_softc *, unsigned long);
-void uba_enqueue(struct uba_unit *);
-void uba_done(struct uba_softc *);
-void ubareset(struct uba_softc *);
-int uballoc(struct uba_softc *, struct ubinfo *, int);
-int ubmemalloc(struct uba_softc *, struct ubinfo *, int);
-void ubfree(struct uba_softc *, struct ubinfo *);
-void ubmemfree(struct uba_softc *, struct ubinfo *);
-#endif /* _KERNEL */
-
-#endif /* _QBUS_UBAVAR_H */
diff --git a/sys/arch/vax/qbus/uda.c b/sys/arch/vax/qbus/uda.c
deleted file mode 100644
index 91179b2d827..00000000000
--- a/sys/arch/vax/qbus/uda.c
+++ /dev/null
@@ -1,487 +0,0 @@
-/* $OpenBSD: uda.c,v 1.11 2014/12/23 21:39:12 miod Exp $ */
-/* $NetBSD: uda.c,v 1.36 2000/06/04 06:17:05 matt Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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.
- *
- * @(#)uda.c 7.32 (Berkeley) 2/13/91
- */
-
-/*
- * UDA50 disk device driver
- */
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <sys/malloc.h>
-
-#include <machine/bus.h>
-#include <machine/sid.h>
-
-#include <arch/vax/qbus/ubavar.h>
-#include <arch/vax/mscp/mscp.h>
-#include <arch/vax/mscp/mscpreg.h>
-#include <arch/vax/mscp/mscpvar.h>
-
-/*
- * Software status, per controller.
- */
-struct uda_softc {
- struct device sc_dev; /* Autoconfig info */
- struct evcount sc_intrcnt; /* Interrupt counting */
- int sc_cvec;
- struct uba_unit sc_unit; /* Struct common for UBA to communicate */
- struct mscp_pack *sc_uuda; /* Unibus address of uda struct */
- struct mscp_pack sc_uda; /* Struct for uda communication */
- bus_dma_tag_t sc_dmat;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_iph;
- bus_space_handle_t sc_sah;
- bus_dmamap_t sc_cmap;/* Control structures */
- struct mscp *sc_mscp; /* Keep pointer to active mscp */
- struct mscp_softc *sc_softc; /* MSCP info (per mscpvar.h) */
- int sc_wticks; /* watchdog timer ticks */
- int sc_inq;
-};
-
-static int udamatch(struct device *, struct cfdata *, void *);
-static void udaattach(struct device *, struct device *, void *);
-static void udareset(struct device *);
-static void udaintr(void *);
-int udaready(struct uba_unit *);
-void udactlrdone(struct device *);
-int udaprint(void *, const char *);
-void udasaerror(struct device *, int);
-void udago(struct device *, struct mscp_xi *);
-
-struct cfattach mtc_ca = {
- sizeof(struct uda_softc), (cfmatch_t)udamatch, udaattach
-};
-
-struct cfdriver mtc_cd = {
- NULL, "mtc", DV_TAPE
-};
-
-struct cfattach uda_ca = {
- sizeof(struct uda_softc), (cfmatch_t)udamatch, udaattach
-};
-
-struct cfdriver uda_cd = {
- NULL, "uda", DV_DISK
-};
-
-/*
- * More driver definitions, for generic MSCP code.
- */
-struct mscp_ctlr uda_mscp_ctlr = {
- udactlrdone,
- udago,
- udasaerror,
-};
-
-/*
- * Miscellaneous private variables.
- */
-static int ivec_no;
-
-int
-udaprint(aux, name)
- void *aux;
- const char *name;
-{
- if (name)
- printf("%s: mscpbus", name);
- return UNCONF;
-}
-
-/*
- * Poke at a supposed UDA50 to see if it is there.
- */
-int
-udamatch(parent, cf, aux)
- struct device *parent;
- struct cfdata *cf;
- void *aux;
-{
- struct uba_attach_args *ua = aux;
- struct mscp_softc mi; /* Nice hack */
- struct uba_softc *ubasc;
- int tries;
-
- /* Get an interrupt vector. */
- ubasc = (void *)parent;
- ivec_no = ubasc->uh_lastiv - 4;
-
- mi.mi_iot = ua->ua_iot;
- mi.mi_iph = ua->ua_ioh;
- mi.mi_sah = ua->ua_ioh + 2;
- mi.mi_swh = ua->ua_ioh + 2;
-
- /*
- * Initialise the controller (partially). The UDA50 programmer's
- * manual states that if initialisation fails, it should be retried
- * at least once, but after a second failure the port should be
- * considered `down'; it also mentions that the controller should
- * initialise within ten seconds. Or so I hear; I have not seen
- * this manual myself.
- */
- tries = 0;
-again:
-
- bus_space_write_2(mi.mi_iot, mi.mi_iph, 0, 0); /* Start init */
- if (mscp_waitstep(&mi, MP_STEP1, MP_STEP1) == 0)
- return 0; /* Nothing here... */
-
- bus_space_write_2(mi.mi_iot, mi.mi_sah, 0,
- MP_ERR | (NCMDL2 << 11) | (NRSPL2 << 8) | MP_IE | (ivec_no >> 2));
-
- if (mscp_waitstep(&mi, MP_STEP2, MP_STEP2) == 0) {
- printf("udaprobe: init step2 no change. sa=%x\n",
- bus_space_read_2(mi.mi_iot, mi.mi_sah, 0));
- goto bad;
- }
-
- /* should have interrupted by now */
- return 1;
-bad:
- if (++tries < 2)
- goto again;
- return 0;
-}
-
-void
-udaattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct uda_softc *sc = (void *)self;
- struct uba_attach_args *ua = aux;
- struct uba_softc *uh = (void *)parent;
- struct mscp_attach_args ma;
- int ctlr, error, rseg;
- bus_dma_segment_t seg;
-
- printf("\n");
-
- uh->uh_lastiv -= 4; /* remove dynamic interrupt vector */
-
- uba_intr_establish(ua->ua_icookie, ua->ua_cvec,
- udaintr, sc, &sc->sc_intrcnt);
- uba_reset_establish(udareset, &sc->sc_dev);
- sc->sc_cvec = ua->ua_cvec;
- evcount_attach(&sc->sc_intrcnt, sc->sc_dev.dv_xname, &sc->sc_cvec);
-
- sc->sc_iot = ua->ua_iot;
- sc->sc_iph = ua->ua_ioh;
- sc->sc_sah = ua->ua_ioh + 2;
- sc->sc_dmat = ua->ua_dmat;
- ctlr = sc->sc_dev.dv_unit;
-
- /*
- * Fill in the uba_unit struct, so we can communicate with the uba.
- */
- sc->sc_unit.uu_softc = sc; /* Backpointer to softc */
- sc->sc_unit.uu_ready = udaready;/* go routine called from adapter */
-
- /*
- * Map the communication area and command and
- * response packets into Unibus space.
- */
- if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct mscp_pack),
- NBPG, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) {
- printf("Alloc ctrl area %d\n", error);
- return;
- }
- if ((error = bus_dmamem_map(sc->sc_dmat, &seg, rseg,
- sizeof(struct mscp_pack), (caddr_t *) &sc->sc_uda,
- BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) {
- printf("Map ctrl area %d\n", error);
-err: bus_dmamem_free(sc->sc_dmat, &seg, rseg);
- return;
- }
- if ((error = bus_dmamap_create(sc->sc_dmat, sizeof(struct mscp_pack),
- 1, sizeof(struct mscp_pack), 0, BUS_DMA_NOWAIT, &sc->sc_cmap))) {
- printf("Create DMA map %d\n", error);
-err2: bus_dmamem_unmap(sc->sc_dmat, (caddr_t)&sc->sc_uda,
- sizeof(struct mscp_pack));
- goto err;
- }
- if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_cmap,
- &sc->sc_uda, sizeof(struct mscp_pack), 0, BUS_DMA_NOWAIT))) {
- printf("Load ctrl map %d\n", error);
- bus_dmamap_destroy(sc->sc_dmat, sc->sc_cmap);
- goto err2;
- }
-
- bzero(&sc->sc_uda, sizeof (struct mscp_pack));
-
- /*
- * The only thing that differ UDA's and Tape ctlr's is
- * their vcid. Because there is no way to determine which
- * ctlr type it is, we check what is generated and later
- * set the correct vcid.
- */
- ma.ma_type = (strcmp(self->dv_cfdata->cf_driver->cd_name,
- mtc_cd.cd_name) ? MSCPBUS_DISK : MSCPBUS_TAPE);
-
- ma.ma_mc = &uda_mscp_ctlr;
- ma.ma_type |= MSCPBUS_UDA;
- ma.ma_uda = &sc->sc_uda;
- ma.ma_softc = &sc->sc_softc;
- ma.ma_iot = sc->sc_iot;
- ma.ma_iph = sc->sc_iph;
- ma.ma_sah = sc->sc_sah;
- ma.ma_swh = sc->sc_sah;
- ma.ma_dmat = sc->sc_dmat;
- ma.ma_dmam = sc->sc_cmap;
- ma.ma_ivec = ivec_no;
- ma.ma_ctlrnr = (ua->ua_iaddr == 0172150 ? 0 : 1); /* XXX */
- ma.ma_adapnr = uh->uh_nr;
- config_found(&sc->sc_dev, &ma, udaprint);
-}
-
-/*
- * Start a transfer if there are free resources available, otherwise
- * let it go in udaready, forget it for now.
- * Called from mscp routines.
- */
-void
-udago(usc, mxi)
- struct device *usc;
- struct mscp_xi *mxi;
-{
- struct uda_softc *sc = (void *)usc;
- struct uba_unit *uu;
- struct buf *bp = mxi->mxi_bp;
- int err;
-
- /*
- * If we already have transfers queued, don't try to load
- * the map again.
- */
- if (sc->sc_inq == 0) {
- err = bus_dmamap_load(sc->sc_dmat, mxi->mxi_dmam, bp->b_data,
- bp->b_bcount, (bp->b_flags & B_PHYS ? bp->b_proc : NULL),
- BUS_DMA_NOWAIT);
- if (err == 0) {
- mscp_dgo(sc->sc_softc, mxi);
- return;
- }
- }
- uu = malloc(sizeof(struct uba_unit), M_DEVBUF, M_NOWAIT);
- if (uu == 0)
- panic("udago: no mem");
- uu->uu_ready = udaready;
- uu->uu_softc = sc;
- uu->uu_ref = mxi;
- uba_enqueue(uu);
- sc->sc_inq++;
-}
-
-/*
- * Called if we have been blocked for resources, and resources
- * have been freed again. Return 1 if we could start all
- * transfers again, 0 if we still are waiting.
- * Called from uba resource free routines.
- */
-int
-udaready(uu)
- struct uba_unit *uu;
-{
- struct uda_softc *sc = uu->uu_softc;
- struct mscp_xi *mxi = uu->uu_ref;
- struct buf *bp = mxi->mxi_bp;
- int err;
-
- err = bus_dmamap_load(sc->sc_dmat, mxi->mxi_dmam, bp->b_data,
- bp->b_bcount, (bp->b_flags & B_PHYS ? bp->b_proc : NULL),
- BUS_DMA_NOWAIT);
- if (err)
- return 0;
- mscp_dgo(sc->sc_softc, mxi);
- sc->sc_inq--;
- free(uu, M_DEVBUF, sizeof(struct uba_unit));
- return 1;
-}
-
-static struct saerr {
- int code; /* error code (including UDA_ERR) */
- char *desc; /* what it means: Efoo => foo error */
-} saerr[] = {
- { 0100001, "Eunibus packet read" },
- { 0100002, "Eunibus packet write" },
- { 0100003, "EUDA ROM and RAM parity" },
- { 0100004, "EUDA RAM parity" },
- { 0100005, "EUDA ROM parity" },
- { 0100006, "Eunibus ring read" },
- { 0100007, "Eunibus ring write" },
- { 0100010, " unibus interrupt master failure" },
- { 0100011, "Ehost access timeout" },
- { 0100012, " host exceeded command limit" },
- { 0100013, " unibus bus master failure" },
- { 0100014, " DM XFC fatal error" },
- { 0100015, " hardware timeout of instruction loop" },
- { 0100016, " invalid virtual circuit id" },
- { 0100017, "Eunibus interrupt write" },
- { 0104000, "Efatal sequence" },
- { 0104040, " D proc ALU" },
- { 0104041, "ED proc control ROM parity" },
- { 0105102, "ED proc w/no BD#2 or RAM parity" },
- { 0105105, "ED proc RAM buffer" },
- { 0105152, "ED proc SDI" },
- { 0105153, "ED proc write mode wrap serdes" },
- { 0105154, "ED proc read mode serdes, RSGEN & ECC" },
- { 0106040, "EU proc ALU" },
- { 0106041, "EU proc control reg" },
- { 0106042, " U proc DFAIL/cntl ROM parity/BD #1 test CNT" },
- { 0106047, " U proc const PROM err w/D proc running SDI test" },
- { 0106055, " unexpected trap" },
- { 0106071, "EU proc const PROM" },
- { 0106072, "EU proc control ROM parity" },
- { 0106200, "Estep 1 data" },
- { 0107103, "EU proc RAM parity" },
- { 0107107, "EU proc RAM buffer" },
- { 0107115, " test count wrong (BD 12)" },
- { 0112300, "Estep 2" },
- { 0122240, "ENPR" },
- { 0122300, "Estep 3" },
- { 0142300, "Estep 4" },
- { 0, " unknown error code" }
-};
-
-/*
- * If the error bit was set in the controller status register, gripe,
- * then (optionally) reset the controller and requeue pending transfers.
- */
-void
-udasaerror(usc, doreset)
- struct device *usc;
- int doreset;
-{
- struct uda_softc *sc = (void *)usc;
- int code = bus_space_read_2(sc->sc_iot, sc->sc_sah, 0);
- struct saerr *e;
-
- if ((code & MP_ERR) == 0)
- return;
- for (e = saerr; e->code; e++)
- if (e->code == code)
- break;
- printf("%s: controller error, sa=0%o (%s%s)\n",
- sc->sc_dev.dv_xname, code, e->desc + 1,
- *e->desc == 'E' ? " error" : "");
-#if 0 /* XXX we just avoid panic when autoconfig non-existent KFQSA devices */
- if (doreset) {
- mscp_requeue(sc->sc_softc);
-/* (void) udainit(sc); XXX */
- }
-#endif
-}
-
-/*
- * Interrupt routine. Depending on the state of the controller,
- * continue initialisation, or acknowledge command and response
- * interrupts, and process responses.
- */
-static void
-udaintr(arg)
- void *arg;
-{
- struct uda_softc *sc = arg;
- struct uba_softc *uh;
- struct mscp_pack *ud;
-
- sc->sc_wticks = 0; /* reset interrupt watchdog */
-
- /* ctlr fatal error */
- if (bus_space_read_2(sc->sc_iot, sc->sc_sah, 0) & MP_ERR) {
- udasaerror(&sc->sc_dev, 1);
- return;
- }
- ud = &sc->sc_uda;
- /*
- * Handle buffer purge requests.
- * XXX - should be done in bus_dma_sync().
- */
- uh = (void *)sc->sc_dev.dv_parent;
- if (ud->mp_ca.ca_bdp) {
- if (uh->uh_ubapurge)
- (*uh->uh_ubapurge)(uh, ud->mp_ca.ca_bdp);
- ud->mp_ca.ca_bdp = 0;
- /* signal purge complete */
- bus_space_write_2(sc->sc_iot, sc->sc_sah, 0, 0);
- }
-
- mscp_intr(sc->sc_softc);
-}
-
-/*
- * A Unibus reset has occurred on UBA uban. Reinitialise the controller(s)
- * on that Unibus, and requeue outstanding I/O.
- */
-static void
-udareset(struct device *dev)
-{
- struct uda_softc *sc = (void *)dev;
- /*
- * Our BDP (if any) is gone; our command (if any) is
- * flushed; the device is no longer mapped; and the
- * UDA50 is not yet initialised.
- */
- if (sc->sc_unit.uu_bdp) {
- /* printf("<%d>", UBAI_BDP(sc->sc_unit.uu_bdp)); */
- sc->sc_unit.uu_bdp = 0;
- }
-
- /* reset queues and requeue pending transfers */
- mscp_requeue(sc->sc_softc);
-
- /*
- * If it fails to initialise we will notice later and
- * try again (and again...). Do not call udastart()
- * here; it will be done after the controller finishes
- * initialisation.
- */
-/* XXX if (udainit(sc)) */
- printf(" (hung)");
-}
-
-void
-udactlrdone(usc)
- struct device *usc;
-{
- struct uda_softc *sc = (void *)usc;
-
- uba_done((struct uba_softc *)sc->sc_dev.dv_parent);
-}
diff --git a/sys/arch/vax/stand/Makefile b/sys/arch/vax/stand/Makefile
deleted file mode 100644
index 6ff6d5151a6..00000000000
--- a/sys/arch/vax/stand/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# $OpenBSD: Makefile,v 1.13 2014/07/13 21:18:44 jasper Exp $
-# $NetBSD: Makefile,v 1.21 1999/03/06 16:36:04 ragge Exp $
-#
-
-.if ${MACHINE} == "vax"
-SUBDIR= boot xxboot
-.endif
-
-.include <bsd.subdir.mk>
diff --git a/sys/arch/vax/stand/Makefile.inc b/sys/arch/vax/stand/Makefile.inc
deleted file mode 100644
index e2e9b5aee37..00000000000
--- a/sys/arch/vax/stand/Makefile.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.5 2013/11/15 03:10:33 uebayasi Exp $
-# $NetBSD: Makefile.inc,v 1.6 2002/02/24 01:04:23 matt Exp $
-
-RELOC=0x39F000
-.PATH: ${.CURDIR}/../../vax ${.CURDIR}/../common
-
-CFLAGS+= -fno-stack-protector
-CPPFLAGS+=-I. -I${.CURDIR}/../../../../ -I${.CURDIR}/../../ -I${.CURDIR}/../common -I${.CURDIR}/../../include
-CPPFLAGS+=-DRELOC=${RELOC}
-
-# Private handling of assembler files.
-.s.o:
- ${CC} -x assembler-with-cpp ${CPPFLAGS} -E ${.IMPSRC} | ${AS} -o ${.TARGET}
diff --git a/sys/arch/vax/stand/boot/Makefile b/sys/arch/vax/stand/boot/Makefile
deleted file mode 100644
index 843ffbb3272..00000000000
--- a/sys/arch/vax/stand/boot/Makefile
+++ /dev/null
@@ -1,58 +0,0 @@
-# $OpenBSD: Makefile,v 1.13 2014/07/13 21:18:44 jasper Exp $
-# $NetBSD: Makefile,v 1.27 2002/04/07 07:00:25 matt Exp $
-
-S!= cd ${.CURDIR}/../../../../; pwd
-NOMAN= # defined
-NOPIE=
-
-.include <bsd.own.mk>
-
-PROG= boot
-DEVS= ra.c mfm.c if_qe.c if_le.c if_ze.c if_de.c
-SRCS= srt0.S boot.c devopen.c conf.c autoconf.c netio.c rom.c romread.S \
- urem.s udiv.s consio.c consio2.S str.S ${DEVS} findcpu.c
-
-CPPFLAGS+=-DSUPPORT_BOOTPARAMS -DSUPPORT_DHCP -D_STANDALONE \
- -DNO_MID_CHECK
-#CPPFLAGS+=-DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG -DDEV_DEBUG \
-# -DRPC_DEBUG -DRARP_DEBUG -DPARANOID
-
-BINDIR=/usr/mdec
-
-SA_ZLIB= yes
-USE_LOADFILE= yes
-SAREL=
-.include "${S}/lib/libsa/Makefile.inc"
-LIBSA= ${SALIB}
-
-Z_AS= library
-CFLAGS+=-I${S}/lib/libsa
-.include "${S}/lib/libz/Makefile.inc"
-LIBZ= ${ZLIB}
-
-.PATH: ${S}/lib/libkern/arch/vax ${S}/lib/libkern
-SRCS+= moddi3.c negdi2.c
-
-.if ${MACHINE} == "vax"
-.if !make(obj)
-.BEGIN:
- @([ -h machine ] || ln -s ${.CURDIR}/../../../${MACHINE}/include machine)
-.NOPATH: machine
-CLEANFILES+= machine
-.endif
-.endif
-
-START=start
-STRIP?=strip
-CLEANFILES+= ${PROG}.sym
-
-${PROG}: ${OBJS} ${LIBSA} ${LIBZ}
- ${LD} -N -Ttext ${RELOC} -e ${START} -o ${PROG}.sym ${OBJS} \
- -Llib/sa -L. ${LIBSA} ${LIBZ} ${LIBSA}
- ${STRIP} -o ${PROG} ${PROG}.sym
-
-clean::
- rm -f a.out [Ee]rrs mklog *.core ${PROG} ${OBJS} ${LOBJS} \
- ${CLEANFILES}
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/vax/stand/boot/autoconf.c b/sys/arch/vax/stand/boot/autoconf.c
deleted file mode 100644
index 11f46c07a2a..00000000000
--- a/sys/arch/vax/stand/boot/autoconf.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/* $OpenBSD: autoconf.c,v 1.16 2013/08/15 13:00:48 otto Exp $ */
-/* $NetBSD: autoconf.c,v 1.19 2002/06/01 15:33:22 ragge Exp $ */
-/*
- * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- */
-
- /* All bugs are subject to removal without further notice */
-
-
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include <machine/mtpr.h>
-#include <machine/sid.h>
-#include <machine/intr.h>
-#include <machine/rpb.h>
-#include <machine/scb.h>
-#include <arch/vax/mbus/mbusreg.h>
-#include <arch/vax/mbus/fwioreg.h>
-#include "vaxstand.h"
-
-void autoconf(void);
-void findcpu(void);
-void consinit(void);
-void scbinit(void);
-void clkstart(void);
-time_t getsecs(void);
-void scb_stray(void *);
-void scb_silent(void *);
-void longjmp(int *);
-void rtimer(void *);
-
-long *bootregs;
-
-/*
- * Do some initial setup. Also create a fake RPB for net-booted machines
- * that don't have an in-prom VMB.
- */
-
-void
-autoconf(void)
-{
- int copyrpb = 1;
- int fromnet = (bootregs[12] != -1);
-
- findcpu(); /* Configures CPU variables */
- scbinit(); /* Setup interrupts */
- consinit(); /* Allow us to print out things */
- clkstart(); /* Fix interval clock etc */
-
-#ifdef DEV_DEBUG
- printf("Register contents:\n");
- for (copyrpb = 0; copyrpb < 13; copyrpb++)
- printf("r%d: %lx\n", copyrpb, bootregs[copyrpb]);
-#endif
- switch (vax_boardtype) {
-
- case VAX_BTYP_780:
- case VAX_BTYP_790:
- case VAX_BTYP_8000:
- case VAX_BTYP_9CC:
- case VAX_BTYP_9RR:
- case VAX_BTYP_1202:
- if (fromnet == 0)
- break;
- copyrpb = 0;
- bootrpb.devtyp = bootregs[0];
- bootrpb.adpphy = bootregs[1];
- bootrpb.csrphy = bootregs[2];
- bootrpb.unit = bootregs[3];
- bootrpb.rpb_bootr5 = bootregs[5];
- bootrpb.pfncnt = 0;
- break;
-
- case VAX_BTYP_46:
- case VAX_BTYP_48:
- {int *map, i;
-
- /* Map all 16MB of I/O space to low 16MB of memory */
- map = (int *)0x700000; /* XXX */
- *(int *)0x20080008 = (int)map; /* XXX */
- for (i = 0; i < 0x8000; i++)
- map[i] = 0x80000000 | i;
- }break;
-
- break;
- }
-
- if (copyrpb) {
- struct rpb *prpb = (struct rpb *)bootregs[11];
- bcopy((caddr_t)prpb, &bootrpb, sizeof(struct rpb));
- if (prpb->iovec) {
- bootrpb.iovec = (int)alloc(prpb->iovecsz);
- bcopy((caddr_t)prpb->iovec, (caddr_t)bootrpb.iovec,
- prpb->iovecsz);
- }
- }
-}
-
-/*
- * Clock handling routines, needed to do timing in standalone programs.
- */
-
-volatile int tickcnt;
-
-time_t
-getsecs(void)
-{
- return tickcnt/100;
-}
-
-struct ivec_dsp **scb;
-struct ivec_dsp *scb_vec;
-extern struct ivec_dsp idsptch;
-extern int jbuf[10];
-extern int mcheck_silent;
-
-static void
-mcheck(void *arg)
-{
- int off, *mfp = (int *)&arg;
-
- if (!mcheck_silent) {
- off = (mfp[7]/4 + 8);
- printf("Machine check, pc=%x, psl=%x\n", mfp[off], mfp[off+1]);
- }
- longjmp(jbuf);
-}
-
-/*
- * Init the SCB and set up a handler for all vectors in the lower space,
- * to detect unwanted interrupts.
- */
-void
-scbinit(void)
-{
- int i;
-
- /*
- * Allocate space. We need one page for the SCB, and 128*20 == 2.5k
- * for the vectors. The SCB must be on a page boundary.
- */
- i = (int)alloc(VAX_NBPG + 128*sizeof(scb_vec[0])) + VAX_PGOFSET;
- i &= ~VAX_PGOFSET;
-
- mtpr(i, PR_SCBB);
- scb = (void *)i;
- scb_vec = (struct ivec_dsp *)(i + VAX_NBPG);
-
- for (i = 0; i < 128; i++) {
- scb[i] = &scb_vec[i];
- (int)scb[i] |= SCB_ISTACK; /* Only interrupt stack */
- scb_vec[i] = idsptch;
- scb_vec[i].hoppaddr = scb_stray;
- scb_vec[i].pushlarg = (void *) (i * 4);
- scb_vec[i].ev = NULL;
- }
- scb_vec[4/4].hoppaddr = mcheck;
- if (vax_boardtype == VAX_BTYP_60)
- scb_vec[0x60/4].hoppaddr = scb_silent;
-}
-
-void
-clkstart(void)
-{
- scb_vec[0xc0/4].hoppaddr = rtimer;
- if (vax_boardtype != VAX_BTYP_VXT)
- mtpr(-10000, PR_NICR); /* Load in count register */
- mtpr(0x800000d1, PR_ICCS); /* Start clock and enable interrupt */
-
- if (vax_boardtype == VAX_BTYP_60) {
- extern int ka60_ioslot;
-
- /* enable M-Bus clock in IOCSR */
- *(unsigned int *)(MBUS_SLOT_BASE(ka60_ioslot) +
- FWIO_IOCSR_OFFSET) |= FWIO_IOCSR_CLKIEN;
- }
-
- mtpr(20, PR_IPL);
-}
-
-extern int sluttid, senast, skip;
-
-void
-rtimer(void *arg)
-{
- mtpr(31, PR_IPL);
- tickcnt++;
- mtpr(0xc1, PR_ICCS);
- if (skip)
- return;
- if ((vax_boardtype == VAX_BTYP_46) ||
- (vax_boardtype == VAX_BTYP_48) ||
- (vax_boardtype == VAX_BTYP_49)) {
- int nu = sluttid - getsecs();
- if (senast != nu) {
- mtpr(20, PR_IPL);
- longjmp(jbuf);
- }
- }
-}
-
-#ifdef __ELF__
-#define IDSPTCH "idsptch"
-#define EIDSPTCH "eidsptch"
-#define CMN_IDSPTCH "cmn_idsptch"
-#else
-#define IDSPTCH "_idsptch"
-#define EIDSPTCH "_eidsptch"
-#define CMN_IDSPTCH "_cmn_idsptch"
-#endif
-
-asm(
- ".text\n"
- ".align 2\n"
- ".globl " IDSPTCH ", " EIDSPTCH "\n"
-IDSPTCH ":\n"
- "pushr $0x3f\n"
- ".word 0x9f16\n"
- ".long " CMN_IDSPTCH "\n"
- ".long 0\n"
- ".long 0\n"
- ".long 0\n"
-EIDSPTCH ":\n"
-
-CMN_IDSPTCH ":\n"
- "movl (%sp)+,%r0\n"
- "pushl 4(%r0)\n"
- "calls $1,*(%r0)\n"
- "popr $0x3f\n"
- "rei\n"
-);
-
-/*
- * Stray interrupt handler.
- * This function must _not_ save any registers (in the reg save mask).
- */
-void
-scb_stray(void *arg)
-{
- static int vector, ipl;
-
- ipl = mfpr(PR_IPL);
- vector = (int) arg;
- printf("stray interrupt: vector 0x%x, ipl %d\n", vector, ipl);
-}
-
-void
-scb_silent(void *arg)
-{
- /* nothing */
-}
diff --git a/sys/arch/vax/stand/boot/boot.c b/sys/arch/vax/stand/boot/boot.c
deleted file mode 100644
index ebd0823f829..00000000000
--- a/sys/arch/vax/stand/boot/boot.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/* $OpenBSD: boot.c,v 1.26 2015/11/16 19:33:52 miod Exp $ */
-/* $NetBSD: boot.c,v 1.18 2002/05/31 15:58:26 ragge Exp $ */
-/*-
- * Copyright (c) 1982, 1986 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.
- *
- * @(#)boot.c 7.15 (Berkeley) 5/4/91
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <sys/stat.h>
-#define _KERNEL
-#include <sys/fcntl.h>
-#undef _KERNEL
-
-#include <lib/libkern/libkern.h>
-#include <lib/libsa/stand.h>
-#include <lib/libsa/loadfile.h>
-
-#include "machine/rpb.h"
-#include "machine/sid.h"
-
-#include "vaxstand.h"
-
-/*
- * Boot program... arguments passed in r10 and r11 determine
- * whether boot stops to ask for system name and which device
- * boot comes from.
- */
-
-char line[100];
-int bootdev, debug;
-extern unsigned opendev;
-
-char rnddata[BOOTRANDOM_MAX];
-
-void usage(char *), boot(char *), halt(char *);
-void Xmain(void);
-void autoconf(void);
-time_t getsecs(void);
-int loadrandom(const char *, char *, size_t);
-int setjmp(int *);
-int testkey(void);
-
-const struct vals {
- char *namn;
- void (*func)(char *);
- char *info;
-} val[] = {
- {"?", usage, "Show this help menu"},
- {"help", usage, "Same as '?'"},
- {"boot", boot, "Load and execute file"},
- {"halt", halt, "Halts the system"},
- {0, 0},
-};
-
-int jbuf[10];
-int sluttid, senast, skip, askname;
-int mcheck_silent;
-struct rpb bootrpb;
-
-void
-Xmain(void)
-{
- int io;
- int j, nu;
- char transition = '\010';
- u_long marks[MARK_MAX];
-
- io = 0;
- skip = 1;
- autoconf();
-
- /*
- * Some VAXstation 4000 PROMs slowly erase the whole screen with \010
- * if running with glass console - at least VS4000/60 and VS4000/VLC;
- * this is probably the LCG PROM at fault. Use a different transition
- * pattern, it's not as nice but it does not take 3(!) seconds to
- * display...
- */
- if (((vax_boardtype == VAX_BTYP_46 &&
- (vax_siedata & 0xff) == VAX_VTYP_46) ||
- (vax_boardtype == VAX_BTYP_48 &&
- vax_cpustype == VAX_STYP_48)) &&
- (vax_confdata & 0x100) == 0)
- transition = ' ';
-
- askname = bootrpb.rpb_bootr5 & RB_ASKNAME;
- printf("\n\r>> OpenBSD/vax boot [%s] <<\n", "1.18");
- printf(">> Press enter to autoboot now, or any other key to abort: ");
- sluttid = getsecs() + 5;
- senast = 0;
- skip = 0;
- setjmp(jbuf);
- for (;;) {
- nu = sluttid - getsecs();
- if (senast != nu)
- printf("%c%d", transition, nu);
- if (nu <= 0)
- break;
- senast = nu;
- if ((j = (testkey() & 0177))) {
- skip = 1;
- if (j != 10 && j != 13) {
- printf("\nPress '?' for help");
- askname = 1;
- }
- break;
- }
- }
- skip = 1;
- printf("\n");
-
- if (setjmp(jbuf))
- askname = 1;
-
- /* First try to autoboot */
- if (askname == 0) {
- int err;
-
- errno = 0;
- printf("> boot bsd\n");
- boot(NULL);
- }
-
- /* If any key pressed, or autoboot failed, go to conversational boot */
- for (;;) {
- const struct vals *v = &val[0];
- char *c, *d;
-
- printf("> ");
- getln(line, sizeof line);
-
- c = line;
- while (*c == ' ')
- c++;
-
- if (c[0] == 0)
- continue;
-
- if ((d = strchr(c, ' ')))
- *d++ = 0;
-
- while (v->namn) {
- if (strcmp(v->namn, c) == 0)
- break;
- v++;
- }
- if (v->namn)
- (*v->func)(d);
- else
- printf("Unknown command: %s\n", c);
- }
-}
-
-void
-halt(char *hej)
-{
- asm("halt");
-}
-
-void
-boot(char *arg)
-{
- char *fn = "bsd";
- int howto, err;
- u_long marks[MARK_MAX];
- static int rnd_loaded = 0;
-
- if (arg) {
- while (*arg == ' ')
- arg++;
-
- if (*arg != '-') {
- fn = arg;
- if ((arg = strchr(arg, ' '))) {
- *arg++ = 0;
- while (*arg == ' ')
- arg++;
- } else
- goto load;
- }
- if (*arg != '-') {
-fail: printf("usage: boot [filename] [-acsd]\n");
- return;
- }
-
- howto = 0;
-
- while (*++arg) {
- if (*arg == 'a')
- howto |= RB_ASKNAME;
- else if (*arg == 'c')
- howto |= RB_CONFIG;
- else if (*arg == 'd')
- howto |= RB_KDB;
- else if (*arg == 's')
- howto |= RB_SINGLE;
- else
- goto fail;
- }
- bootrpb.rpb_bootr5 = howto;
- }
-load:
- /*
- * Attempt to load /etc/random.seed if loading from a disk.
- */
- switch (bootrpb.devtyp) {
- default:
- break;
- case BDEV_UDA:
- case BDEV_RD:
- case BDEV_SD:
- case BDEV_SDN:
- case BDEV_SDS:
- if (rnd_loaded == 0)
- rnd_loaded = loadrandom(BOOTRANDOM, rnddata,
- sizeof(rnddata));
- break;
- }
-
- marks[MARK_START] = 0;
- err = loadfile(fn, marks, LOAD_KERNEL|COUNT_KERNEL);
- if (err == 0) {
- machdep_start((char *)marks[MARK_ENTRY],
- marks[MARK_NSYM],
- (void *)marks[MARK_START],
- (void *)marks[MARK_SYM],
- (void *)marks[MARK_END]);
- }
- printf("%s: boot failed: %s\n", fn, strerror(errno));
-}
-
-void
-usage(char *hej)
-{
- const struct vals *v = &val[0];
- int i;
-
- printf("Commands:\n");
- while (v->namn) {
- printf("%s ", v->namn);
- for (i = 1 + strlen(v->namn); (i & 7) != 0; i++)
- printf(" ");
- printf("%s\n", v->info);
- v++;
- }
-}
-
-int
-loadrandom(const char *name, char *buf, size_t buflen)
-{
- struct stat sb;
- int fd;
- int rc = 0;
-
- fd = open(name, O_RDONLY);
- if (fd == -1) {
- if (errno != EPERM)
- printf("cannot open %s: %s\n", name, strerror(errno));
- return 0;
- }
- if (fstat(fd, &sb) == -1 || sb.st_uid != 0 || !S_ISREG(sb.st_mode) ||
- (sb.st_mode & (S_IWOTH|S_IROTH)))
- goto fail;
- (void) read(fd, buf, buflen);
- rc = 1;
-fail:
- close(fd);
- return rc;
-}
diff --git a/sys/arch/vax/stand/boot/conf.c b/sys/arch/vax/stand/boot/conf.c
deleted file mode 100644
index ea8ad1df942..00000000000
--- a/sys/arch/vax/stand/boot/conf.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* $OpenBSD: conf.c,v 1.6 2011/07/06 18:32:59 miod Exp $ */
-/* $NetBSD: conf.c,v 1.10 2000/06/15 19:53:23 ragge Exp $ */
-/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- */
-
- /* All bugs are subject to removal without further notice */
-
-#include "sys/param.h"
-
-#include <netinet/in.h>
-
-#include "../../include/rpb.h"
-
-#include "lib/libkern/libkern.h"
-
-#include "lib/libsa/stand.h"
-#include "lib/libsa/ufs.h"
-#include "lib/libsa/nfs.h"
-#include "lib/libsa/cd9660.h"
-
-#include "vaxstand.h"
-
-static int nostrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-
-struct devsw devsw[]={
- SADEV("qe",nostrategy, qeopen, qeclose, noioctl), /* DEQNA */
- SADEV("ra",rastrategy, raopen, nullsys, noioctl),
- SADEV("mt",rastrategy, raopen, nullsys, noioctl),
- SADEV("rom",romstrategy, romopen, nullsys, noioctl),
- SADEV("hd",mfmstrategy, mfmopen, nullsys, noioctl),
- SADEV("sd",romstrategy, romopen, nullsys, noioctl),
- SADEV("sd",romstrategy, romopen, nullsys, noioctl), /* SDN */
- SADEV("sd",romstrategy, romopen, nullsys, noioctl), /* SDS */
- SADEV("st",nullsys, nullsys, nullsys, noioctl),
- SADEV("le",nostrategy, leopen, leclose, noioctl), /* LANCE */
- SADEV("ze",nostrategy, zeopen, zeclose, noioctl), /* SGEC */
- SADEV("de",nostrategy, deopen, declose, noioctl), /* DEUNA */
-};
-
-int cnvtab[] = {
- BDEV_QE,
- BDEV_UDA,
- BDEV_TK,
- -1,
- BDEV_RD,
- BDEV_SD,
- BDEV_SDN,
- BDEV_SDS,
- BDEV_ST,
- BDEV_LE,
- BDEV_ZE,
- BDEV_DE,
-};
-
-int ndevs = (sizeof(devsw)/sizeof(devsw[0]));
-
-struct fs_ops file_system[] = {
- { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
- { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
- { cd9660_open, cd9660_close, cd9660_read, cd9660_write,
- cd9660_seek, cd9660_stat },
-};
-
-int nfsys = (sizeof(file_system) / sizeof(struct fs_ops));
-
-int
-nostrategy(void *f, int func, daddr32_t dblk,
- size_t size, void *buf, size_t *rsize)
-{
- *rsize = size;
- bzero(buf, size);
- return 0;
-}
diff --git a/sys/arch/vax/stand/boot/consio.c b/sys/arch/vax/stand/boot/consio.c
deleted file mode 100644
index 09ccee06755..00000000000
--- a/sys/arch/vax/stand/boot/consio.c
+++ /dev/null
@@ -1,428 +0,0 @@
-/* $OpenBSD: consio.c,v 1.10 2008/08/18 23:20:44 miod Exp $ */
-/* $NetBSD: consio.c,v 1.13 2002/05/24 21:40:59 ragge Exp $ */
-/*
- * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- */
-
- /* All bugs are subject to removal without further notice */
-
-#include <sys/param.h>
-
-#include "../vax/gencons.h"
-
-#include "mtpr.h"
-#include "sid.h"
-#include "rpb.h"
-#include "ka630.h"
-
-#include "data.h"
-
-#include <machine/cvax.h>
-#include <arch/vax/mbus/mbusreg.h>
-
-void setup(void);
-
-static void (*put_fp)(int) = NULL;
-static int (*get_fp)(void) = NULL;
-static int (*test_fp)(void) = NULL;
-
-/*
- * I/O using mtpr/mfpr
- */
-
-void pr_putchar(int c);
-int pr_getchar(void);
-int pr_testchar(void);
-
-/*
- * I/O using ROM routines
- */
-
-void rom_putchar(int c);
-int rom_getchar(void);
-int rom_testchar(void);
-
-int rom_putc; /* ROM-address of put-routine */
-int rom_getc; /* ROM-address of get-routine */
-
-/*
- * I/O using the KA630 ROM console routines
- */
-
-/* Pointer to KA630 console page, initialized by ka630_consinit */
-unsigned char *ka630_conspage;
-void ka630_consinit(void);
-
-void ka630_rom_putchar(int c);
-int ka630_rom_getchar(void);
-int ka630_rom_testchar(void);
-
-/*
- * I/O using the KA53 ROM console routines
- */
-
-unsigned char *ka53_conspage;
-void ka53_consinit(void);
-
-void ka53_rom_putchar(int c);
-int ka53_rom_getchar(void);
-int ka53_rom_testchar(void);
-
-/*
- * I/O using the VXT2000 serial ports
- */
-
-void vxt_putchar(int c);
-int vxt_getchar(void);
-int vxt_testchar(void);
-
-/*
- * I/O using the KA60 ROM console routines
- */
-
-unsigned char *ka60_conspage;
-void ka60_consinit(void);
-
-void ka60_rom_putchar(int c);
-int ka60_rom_getchar(void);
-int ka60_rom_testchar(void);
-
-void putchar(int);
-int getchar(void);
-int testkey(void);
-void consinit(void);
-void _rtt(void);
-
-void
-putchar(int c)
-{
- (*put_fp)(c);
- if (c == 10)
- (*put_fp)(13); /* CR/LF */
-}
-
-int
-getchar(void)
-{
- int c;
-
- do
- c = (*get_fp)() & 0177;
- while (c == 17 || c == 19); /* ignore XON/XOFF */
- if (c < 96 && c > 64)
- c += 32; /* force lowercase */
- return c;
-}
-
-int
-testkey(void)
-{
- return (*test_fp)();
-}
-
-/*
- * setup() is called out of the startup files (start.s, srt0.s) and
- * initializes data which are globally used and is called before main().
- */
-void
-consinit(void)
-{
- put_fp = pr_putchar; /* Default */
- get_fp = pr_getchar;
- test_fp = pr_testchar;
-
- /*
- * According to the vax_boardtype (vax_cputype is not specific
- * enough to do that) we decide which method/routines to use
- * for console I/O.
- * mtpr/mfpr are restricted to serial consoles, ROM-based routines
- * support both serial and graphical consoles.
- * We default to mtpr routines; so that we don't crash if
- * it isn't a supported system.
- */
- switch (vax_boardtype) {
-
- case VAX_BTYP_43:
- case VAX_BTYP_410:
- case VAX_BTYP_420:
- put_fp = rom_putchar;
- get_fp = rom_getchar;
- test_fp = rom_testchar;
- rom_putc = 0x20040058; /* 537133144 */
- rom_getc = 0x20040044; /* 537133124 */
- break;
-
- case VAX_BTYP_VXT:
- put_fp = rom_putchar;
- get_fp = vxt_getchar;
- test_fp = vxt_testchar;
- rom_putc = 0x20040058; /* 537133144 */
- rom_getc = 0x20040044; /* 537133124 */
- break;
-
- case VAX_BTYP_630:
- ka630_consinit();
- break;
-
- case VAX_BTYP_46:
- case VAX_BTYP_48:
- case VAX_BTYP_49:
- put_fp = rom_putchar;
- get_fp = rom_getchar;
- test_fp = rom_testchar;
- rom_putc = 0x20040068;
- rom_getc = 0x20040054;
- break;
-
- case VAX_BTYP_1303:
- ka53_consinit();
- break;
-
- case VAX_BTYP_60:
- ka60_consinit();
- break;
-
-#ifdef notdef
- case VAX_BTYP_630:
- case VAX_BTYP_650:
- case VAX_BTYP_9CC:
- put_fp = pr_putchar;
- get_fp = pr_getchar;
- break
-#endif
- }
- return;
-}
-
-/*
- * putchar() using MTPR
- */
-void
-pr_putchar(int c)
-{
- int timeout = 1<<15; /* don't hang the machine! */
-
- /*
- * On KA88 we may get C-S/C-Q from the console.
- * Must obey it.
- */
- while (mfpr(PR_RXCS) & GC_DON) {
- if ((mfpr(PR_RXDB) & 0x7f) == 19) {
- while (1) {
- while ((mfpr(PR_RXCS) & GC_DON) == 0)
- ;
- if ((mfpr(PR_RXDB) & 0x7f) == 17)
- break;
- }
- }
- }
-
- while ((mfpr(PR_TXCS) & GC_RDY) == 0) /* Wait until xmit ready */
- if (--timeout < 0)
- break;
- mtpr(c, PR_TXDB); /* xmit character */
-}
-
-/*
- * getchar() using MFPR
- */
-int
-pr_getchar(void)
-{
- while ((mfpr(PR_RXCS) & GC_DON) == 0)
- ; /* wait for char */
- return (mfpr(PR_RXDB)); /* now get it */
-}
-
-int
-pr_testchar(void)
-{
- if (mfpr(PR_RXCS) & GC_DON)
- return mfpr(PR_RXDB);
- else
- return 0;
-}
-
-/*
- * void ka630_consinit (void) ==> initialize KA630 ROM console I/O
- */
-void ka630_consinit(void)
-{
- short *NVR;
- int i;
-
- /* Find the console page */
- NVR = (short *) KA630_NVR_ADRS;
-
- i = *NVR++ & 0xFF;
- i |= (*NVR++ & 0xFF) << 8;
- i |= (*NVR++ & 0xFF) << 16;
- i |= (*NVR++ & 0xFF) << 24;
-
- ka630_conspage = (char *) i;
-
- /* Go to last row to minimize confusion */
- ka630_conspage[KA630_ROW] = ka630_conspage[KA630_MAXROW];
- ka630_conspage[KA630_COL] = ka630_conspage[KA630_MINCOL];
-
- /* Use KA630 ROM console I/O routines */
- put_fp = ka630_rom_putchar;
- get_fp = ka630_rom_getchar;
- test_fp = ka630_rom_testchar;
-}
-
-
-/*
- * void ka53_consinit (void) ==> initialize KA53 ROM console I/O
- */
-void ka53_consinit(void)
-{
- ka53_conspage = (char *) 0x2014044b;
-
- put_fp = ka53_rom_putchar;
- get_fp = ka53_rom_getchar;
- test_fp = ka53_rom_testchar;
-}
-
-/*
- * VXT2000 console routines.
- *
- * While we can use the rom putchar routine, the rom getchar routine
- * will happily return the last key pressed, even if it is not pressed
- * anymore.
- *
- * To guard against this, we monitor the keyboard serial port and will
- * only invoke the rom function (which will do the keyboard layout
- * translation for us) if there is indeed a new keyboard event (we still
- * need to guard against dead keys, hence the while() condition in
- * vxt_getchar). This still unfortunately causes phantom characters to
- * appear when playing with the shift keys, but nothing backspace can't
- * erase, so this will be a minor annoyance.
- *
- * If console is on the serial port, we do not use the prom routines at
- * all.
- */
-static volatile int *vxtregs = (int *)0x200A0000;
-
-#define CH_SRA 0x01
-#define CH_CRA 0x02
-#define CH_DATA 0x03
-#define CH_SRC 0x11
-#define CH_CRC 0x12
-#define CH_DATC 0x13
-
-#define CR_RX_ENA 0x01
-#define CR_TX_ENA 0x04
-#define SR_RX_RDY 0x01
-#define SR_TX_RDY 0x04
-
-int
-vxt_getchar(void)
-{
- if (vax_confdata & 2) {
- vxtregs[CH_CRC] = CR_RX_ENA;
- while ((vxtregs[CH_SRC] & SR_RX_RDY) == 0 ||
- rom_testchar() == 0)
- ;
- return rom_getchar();
- } else {
- vxtregs[CH_CRA] = CR_RX_ENA;
- while ((vxtregs[CH_SRA] & SR_RX_RDY) == 0)
- ;
- return vxtregs[CH_DATA];
- }
-}
-
-int
-vxt_testchar(void)
-{
- if (vax_confdata & 2) {
- vxtregs[CH_CRC] = CR_RX_ENA;
- if ((vxtregs[CH_SRC] & SR_RX_RDY) == 0)
- return 0;
- return rom_testchar();
- } else {
- vxtregs[CH_CRA] = CR_RX_ENA;
- if ((vxtregs[CH_SRA] & SR_RX_RDY) == 0)
- return 0;
- return vxtregs[CH_DATA];
- }
-}
-
-int ka60_ioslot = -1;
-
-/*
- * void ka60_consinit (void) ==> initialize KA60 ROM console I/O
- */
-void ka60_consinit(void)
-{
- extern int jbuf[10];
- extern int mcheck_silent;
- extern int setjmp(int *);
-
- int mid, fbicaddr;
- uint32_t modtype, fbicrange;
-
- for (mid = 0; mid < MBUS_SLOT_MAX; mid++) {
- fbicaddr = MBUS_SLOT_BASE(mid) + FBIC_BASE;
-
- if (setjmp(jbuf)) {
- /* this slot is empty */
- continue;
- }
- mcheck_silent = 1;
- modtype = *(uint32_t *)(fbicaddr + FBIC_MODTYPE);
- mcheck_silent = 0;
-
- if ((modtype & MODTYPE_CLASS_MASK) >> MODTYPE_CLASS_SHIFT !=
- CLASS_IO)
- continue;
-
- ka60_ioslot = mid;
-
- fbicrange = *(uint32_t *)(fbicaddr + FBIC_RANGE);
- if (fbicrange ==
- ((HOST_TO_MBUS(CVAX_SSC) & RANGE_MATCH) | RANGE_ENABLE))
- break;
- }
- mcheck_silent = 0;
-
- if (ka60_ioslot < 0) {
- /*
- * This shouldn't happen. Try mid #5 (enclosure slot #4) as a
- * supposedly sane default.
- */
- ka60_ioslot = 5;
- }
-
- ka60_conspage = (char *) *(unsigned int *)0x20140514;
- put_fp = ka60_rom_putchar;
- get_fp = ka60_rom_getchar;
- test_fp = ka60_rom_testchar;
-}
diff --git a/sys/arch/vax/stand/boot/consio2.S b/sys/arch/vax/stand/boot/consio2.S
deleted file mode 100644
index 689b08da3a2..00000000000
--- a/sys/arch/vax/stand/boot/consio2.S
+++ /dev/null
@@ -1,160 +0,0 @@
-/* $OpenBSD: consio2.S,v 1.3 2013/07/05 21:13:06 miod Exp $ */
-/* $NetBSD: consio2.S,v 1.1 2002/02/24 01:04:24 matt Exp $ */
-/*
- * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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 <machine/asm.h>
-
-/*
- * int rom_putchar (int c) ==> putchar() using ROM-routines
- */
-ENTRY(rom_putchar, R2)
- movl 4(%ap), %r2 # move argument to R2
- jsb *_C_LABEL(rom_putc) # write it
- ret # that is all
-
-
-/*
- * int rom_getchar (void) ==> getchar() using ROM-routines
- */
-ENTRY(rom_getchar, R1)
-loop: # do {
- jsb *_C_LABEL(rom_getc) # call the getc-routine
- tstl %r0 # check if char ready
- beql loop # } while (R0 == 0)
- movl %r1, %r0 # R1 holds char
- ret # we are done
-
-ENTRY(rom_testchar, 0)
- mnegl $1,%r0
- jsb *_C_LABEL(rom_getc)
- tstl %r0
- beql 1f
- movl %r1,%r0
-1: ret
-
-ENTRY(_rtt, 0)
- halt
-
-
-/*
- * int ka630_rom_getchar (void) ==> getchar() using ROM-routines on KA630
- */
-ENTRY(ka630_rom_getchar, R11|R1)
- movl _C_LABEL(ka630_conspage),%r11 # load location of console page
-1: # do {
- jsb *0x1C(%r11) # call the getc-routine (KA630_GETC)
- blbc %r0,1b # } while (R0 == 0)
- movl %r1,%r0 # R1 holds char
- ret # we are done
-
-ENTRY(ka630_rom_testchar, R3|R1)
- movl _C_LABEL(ka630_conspage),%r3
- jsb *0x1C(%r3)
- blbc %r0,1f
- movl %r1,%r0
-1: ret
-
-/*
- * int ka630_rom_putchar (int c) ==> putchar() using ROM-routines on KA630
- */
-ENTRY(ka630_rom_putchar, R11|R1)
- movl _C_LABEL(ka630_conspage),%r11
- # load location of console page
-1: # do {
- jsb *0x20(%r11) # is rom ready? (KA630_PUTC_POLL)
- blbc %r0,1b # } while (R0 == 0)
- movl 4(%ap),%r1 # R1 holds char
- jsb *0x24(%r11) # output character (KA630_PUTC)
- ret # we are done
-
-/*
- * int ka53_rom_getchar (void) ==> getchar() using ROM-routines on KA53
- */
-ENTRY(ka53_rom_getchar, R11|R1)
- movl _C_LABEL(ka53_conspage),%r11
- # load location of console page
-1: # do {
- jsb *0x64(%r11) # test for char
- blbc %r0,1b # } while (R0 == 0)
- jsb *0x6c(%r11) # get the char
- ret # we are done
-
-ENTRY(ka53_rom_testchar, R3|R1)
- movl _C_LABEL(ka53_conspage),%r3
- jsb *0x64(%r3)
- blbc %r0,1f
- jsb *0x6c(%r3) # get the char
-1: ret
-
-/*
- * int ka53_rom_putchar (int c) ==> putchar() using ROM-routines on KA53
- */
-ENTRY(ka53_rom_putchar, R11|R1)
- movl _C_LABEL(ka53_conspage),%r11
- # load location of console page
-1: # do {
- jsb *0x20(%r11) # is rom ready?
- blbc %r0,1b # } whi le (R0 == 0)
- movl 4(%ap),%r1 # R1 holds char
- jsb *0x24(%r11) # output character
- ret # we are done
-
-/*
- * int ka60_rom_getchar (void) ==> getchar() using ROM-routines on KA60
- */
-ENTRY(ka60_rom_getchar, R11|R10|R9|R8|R7|R6|R5|R4|R3|R2|R1)
-1:
- movl _C_LABEL(ka60_conspage),%r0
- # load location of console page
- # do {
- jsb *0xfc(%r0) # get the char, if any
- blbc %r0,1b # } while (R0 == 0)
- movl %r1,%r0
- ret # we are done
-
-ENTRY(ka60_rom_testchar, R11|R10|R9|R8|R7|R6|R5|R4|R3|R2|R1)
- movl _C_LABEL(ka60_conspage),%r0
- jsb *0xfc(%r0)
- blbc %r0,1f
- movl %r1,%r0
-1: ret
-
-/*
- * int ka60_rom_putchar (int c) ==> putchar() using ROM-routines on KA60
- */
-ENTRY(ka60_rom_putchar, R11|R10|R9|R8|R7|R6|R5|R4|R3|R2|R1)
-1:
- movl _C_LABEL(ka60_conspage),%r0
- # load location of console page
- movl 4(%ap),%r1 # R1 holds char
- jsb *0x114(%r0) # output character
- blbc %r0, 1b # failed? retry
- ret # we are done
diff --git a/sys/arch/vax/stand/boot/data.h b/sys/arch/vax/stand/boot/data.h
deleted file mode 100644
index e91bfaf789d..00000000000
--- a/sys/arch/vax/stand/boot/data.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $OpenBSD: data.h,v 1.2 2002/06/11 09:36:23 hugh Exp $ */
-/* $NetBSD: data.h,v 1.3 2001/07/26 15:05:09 wiz Exp $ */
-/*
- * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by
- * Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
- /* All bugs are subject to removal without further notice */
-
-
-
-/*
- * rpb->iovec gives pointer to this structure.
- *
- * bqo->unit_init() is used to initialize the controller,
- * bqo->qio() is used to read from boot-device
- */
-
-struct bqo {
- long qio; /* 4 QIO entry */
- long map; /* 4 Mapping entry */
- long select; /* 4 Selection entry */
- long drivrname; /* 4 Offset to driver name */
- short version; /* 2 Version number of VMB */
- short vercheck; /* 2 Check field */
- /* offset: 20 */
- long reselect; /* 4 Reselection entry */
- long move; /* 4 Move driver entry */
- long unit_init; /* 4 Unit initialization entry */
- long auxdrname; /* 4 Offset to auxiliary driver name */
- long umr_dis; /* 4 UNIBUS Map Registers to disable */
- /* offset: 40 */
- long ucode; /* 4 Absolute address of booting microcode */
- long unit_disc; /* 4 Unit disconnecting entry */
- long devname; /* 4 Offset to boot device name */
- long umr_tmpl; /* 4 UNIBUS map register template */
- /* offset: 60 */
- /*
- * the rest is unknown / unnecessary ...
- */
- long xxx[6]; /* 24 -- total: 84 bytes */
-};
-
-extern struct bqo *bqo;
diff --git a/sys/arch/vax/stand/boot/devopen.c b/sys/arch/vax/stand/boot/devopen.c
deleted file mode 100644
index 4a3bbe7b784..00000000000
--- a/sys/arch/vax/stand/boot/devopen.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* $OpenBSD: devopen.c,v 1.5 2011/07/06 18:32:59 miod Exp $ */
-/* $NetBSD: devopen.c,v 1.10 2002/05/24 21:40:59 ragge Exp $ */
-/*
- * Copyright (c) 1997 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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 <lib/libsa/stand.h>
-
-#include "machine/rpb.h"
-#include "machine/sid.h"
-#include "machine/pte.h"
-
-#include "vaxstand.h"
-
-int atoi(char *);
-int nexaddr, csrbase;
-
-int
-devopen(f, fname, file)
- struct open_file *f;
- const char *fname;
- char **file;
-{
- int dev, unit, ctlr, part, adapt, i, a[4], x;
- int *mapregs;
- struct devsw *dp;
- extern int cnvtab[];
- char *s, *c;
-
- part = 0;
-
- /*
- * Adaptor and controller are normally zero (or uninteresting),
- * but we need to do some conversion here anyway (if it's a
- * manual boot, but that's checked by the device driver).
- * Set them to -1 to tell if it's a set number or default.
- */
- dev = bootrpb.devtyp;
- unit = bootrpb.unit;
- adapt = ctlr = -1;
-
- if (dev == BDEV_KDB)
- dev = BDEV_UDA; /* use the same driver */
-
- for (i = 0, dp = 0; i < ndevs; i++)
- if (cnvtab[i] == dev)
- dp = devsw + i;
-
- if ((s = index((char *)fname, '('))) {
- *s++ = 0;
-
- for (i = 0, dp = devsw; i < ndevs; i++, dp++)
- if (dp->dv_name && strcmp(dp->dv_name, fname) == 0)
- break;
-
- if (i == ndevs) {
- printf("No such device - Configured devices are:\n");
- for (dp = devsw, i = 0; i < ndevs; i++, dp++)
- if (dp->dv_name && (i == 0 ||
- strcmp(dp->dv_name, (dp[-1]).dv_name) != 0))
- printf(" %s", dp->dv_name);
- printf("\n");
- return EINVAL;
- }
-
- dev = cnvtab[i];
- if ((c = index(s, ')')) == 0)
- goto usage;
- *c++ = 0;
-
- /*
- * If the user has specified sd(), we need to pick the
- * correct BDEV_SDx value, depending on the machine type.
- */
- if (dev == BDEV_SD) {
- switch (vax_boardtype) {
- case VAX_BTYP_46:
- case VAX_BTYP_48:
- case VAX_BTYP_49:
- case VAX_BTYP_1303:
- dev = BDEV_SDN; /* asc(4) */
- break;
- case VAX_BTYP_60:
- dev = BDEV_SDS; /* sii(4) */
- break;
- }
- }
-
- x = 0;
- if (*s) do {
- a[x++] = atoi(s);
- while (*s >= '0' && *s <= '9')
- s++;
-
- if (*s != ',' && *s != 0)
- goto usage;
- } while (*s++);
-
- if (x)
- part = a[x - 1];
- if (x > 1)
- unit = a[x - 2];
- if (x > 2)
- ctlr = a[x - 3];
- if (x > 3)
- adapt = a[0];
- *file = c;
- } else {
- *file = (char *)fname;
- c = (char *)fname;
- }
-
- if (!dp->dv_open) {
- printf("Can't open device type %d\n", dev);
- return ENXIO;
- }
- f->f_dev = dp;
- bootrpb.unit = unit;
- bootrpb.devtyp = dev;
-
- nexaddr = bootrpb.adpphy;
- switch (vax_boardtype) {
- case VAX_BTYP_610:
- nexaddr = 0; /* No map regs */
- csrbase = 0x20000000;
- break;
-
- case VAX_BTYP_VXT:
- nexaddr = 0;
- csrbase = bootrpb.csrphy;
- break;
- default:
- nexaddr = 0; /* No map regs */
- csrbase = 0x20000000;
- /* Always map in the lowest 4M on qbus-based machines */
- mapregs = (void *)0x20088000;
- if (bootrpb.adpphy == 0x20087800)
- for (i = 0; i < 8192; i++)
- mapregs[i] = PG_V | i;
- break;
- }
-
-#ifdef DEV_DEBUG
- printf("rpb.type %d rpb.unit %d rpb.csr %lx rpb.adp %lx\n",
- bootrpb.devtyp, bootrpb.unit, bootrpb.csrphy, bootrpb.adpphy);
- printf("adapter %d ctlr %d unit %d part %d\n", adapt, ctlr, unit, part);
- printf("nexaddr %x csrbase %x\n", nexaddr, csrbase);
-#endif
-
- return (*dp->dv_open)(f, adapt, ctlr, unit, part);
-
-usage:
- printf("usage: dev(adapter,controller,unit,partition)file -asd\n");
- return EINVAL;
-}
diff --git a/sys/arch/vax/stand/boot/if_de.c b/sys/arch/vax/stand/boot/if_de.c
deleted file mode 100644
index c7c5a3b0d73..00000000000
--- a/sys/arch/vax/stand/boot/if_de.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/* $OpenBSD: if_de.c,v 1.4 2014/08/21 14:24:08 mpi Exp $ */
-/* $NetBSD: if_de.c,v 1.2 2002/05/24 21:41:40 ragge Exp $ */
-
-/*
- * Copyright (c) 2000 Ludd, University of Lule}, Sweden. 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- *
- * Standalone routine for the DEUNA Ethernet controller.
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/queue.h>
-
-#include <net/if.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#include <lib/libsa/netif.h>
-#include <lib/libsa/stand.h>
-
-#include <arch/vax/if/if_dereg.h>
-
-#define DE_PCSR0 0
-#define DE_PCSR1 2
-#define DE_PCSR2 4
-#define DE_PCSR3 6
-
-#include "arch/vax/include/sid.h"
-#include "arch/vax/include/rpb.h"
-#include "arch/vax/include/pte.h"
-
-#include "vaxstand.h"
-
-static int de_get(struct iodesc *, void *, size_t, time_t);
-static int de_put(struct iodesc *, void *, size_t);
-static void dewait(char *);
-
-struct netif_driver de_driver = {
- 0, 0, 0, 0, de_get, de_put,
-};
-
-#define NRCV 8 /* allocate 8 receive descriptors */
-#define NXMT 4 /* and 4 transmit - must be >1 */
-
-struct de_cdata {
- /* the following structures are always mapped in */
- struct de_pcbb dc_pcbb; /* port control block */
- struct de_ring dc_xrent[NXMT]; /* transmit ring entries */
- struct de_ring dc_rrent[NRCV]; /* receive ring entries */
- struct de_udbbuf dc_udbbuf; /* UNIBUS data buffer */
- char dc_rbuf[NRCV][ETHER_MAX_LEN];
- char dc_xbuf[NXMT][ETHER_MAX_LEN];
- /* end mapped area */
-};
-
-static volatile struct de_cdata *dc, *pdc;
-static volatile char *addr;
-static int crx, ctx;
-#define DE_WCSR(csr, val) *(volatile u_short *)(addr + (csr)) = (val)
-#define DE_WLOW(val) *(volatile u_char *)(addr + DE_PCSR0) = (val)
-#define DE_WHIGH(val) *(volatile u_char *)(addr + DE_PCSR0 + 1) = (val)
-#define DE_RCSR(csr) *(volatile u_short *)(addr + (csr))
-#define LOWORD(x) ((u_int)(x) & 0xffff)
-#define HIWORD(x) (((u_int)(x) >> 16) & 0x3)
-#define dereg(x) ((x) & 017777)
-
-int
-deopen(struct open_file *f, int adapt, int ctlr, int unit, int part)
-{
- int i, cdata, *map, npgs;
- char eaddr[6];
-
- /* point to the device in memory */
- if (askname == 0) /* Override if autoboot */
- addr = (char *)bootrpb.csrphy;
- else {
- addr = (char *)csrbase + dereg(0174510);
- bootrpb.csrphy = (int)addr;
- }
-#ifdef DEV_DEBUG
- printf("deopen: csrbase %x addr %p nexaddr %x\n",
- csrbase, addr, nexaddr);
-#endif
- /* reset the device and wait for completion */
- DE_WCSR(DE_PCSR0, 0);
- {volatile int j = 100; while (--j);}
- DE_WCSR(DE_PCSR0, PCSR0_RSET);
- dewait("reset");
-
- /* Map in the control structures and buffers */
- dc = alloc(sizeof(struct de_cdata));
- (int)pdc = (int)dc & VAX_PGOFSET;
- map = (int *)nexaddr + 512;
- npgs = (sizeof(struct de_cdata) >> VAX_PGSHIFT) + 1;
- cdata = (int)dc >> VAX_PGSHIFT;
- for (i = 0; i < npgs; i++) {
- map[i] = PG_V | (cdata + i);
- }
-
- bzero((char *)dc, sizeof(struct de_cdata));
-
- /* Tell the DEUNA about our PCB */
- DE_WCSR(DE_PCSR2, LOWORD(pdc));
- DE_WCSR(DE_PCSR3, HIWORD(pdc));
- DE_WLOW(CMD_GETPCBB);
- dewait("pcbb");
-
- /* Get our address */
- dc->dc_pcbb.pcbb0 = FC_RDPHYAD;
- DE_WLOW(CMD_GETCMD);
- dewait("read physaddr");
- bcopy((char *)&dc->dc_pcbb.pcbb2, eaddr, 6);
-
- /* Create and link the descriptors */
- for (i=0; i < NRCV; i++) {
- volatile struct de_ring *rp = &dc->dc_rrent[i];
-
- rp->r_lenerr = 0;
- rp->r_segbl = LOWORD(&pdc->dc_rbuf[i][0]);
- rp->r_segbh = HIWORD(&pdc->dc_rbuf[i][0]);
- rp->r_flags = RFLG_OWN;
- rp->r_slen = ETHER_MAX_LEN;
- }
- for (i=0; i < NXMT; i++) {
- volatile struct de_ring *rp = &dc->dc_xrent[i];
-
- rp->r_segbl = LOWORD(&pdc->dc_xbuf[i][0]);
- rp->r_segbh = HIWORD(&pdc->dc_xbuf[i][0]);
- rp->r_tdrerr = 0;
- rp->r_flags = 0;
- }
- crx = ctx = 0;
-
- /* set the transmit and receive ring header addresses */
- dc->dc_pcbb.pcbb0 = FC_WTRING;
- dc->dc_pcbb.pcbb2 = LOWORD(&pdc->dc_udbbuf);
- dc->dc_pcbb.pcbb4 = HIWORD(&pdc->dc_udbbuf);
-
- dc->dc_udbbuf.b_tdrbl = LOWORD(&pdc->dc_xrent[0]);
- dc->dc_udbbuf.b_tdrbh = HIWORD(&pdc->dc_xrent[0]);
- dc->dc_udbbuf.b_telen = sizeof (struct de_ring) / sizeof(u_int16_t);
- dc->dc_udbbuf.b_trlen = NXMT;
- dc->dc_udbbuf.b_rdrbl = LOWORD(&pdc->dc_rrent[0]);
- dc->dc_udbbuf.b_rdrbh = HIWORD(&pdc->dc_rrent[0]);
- dc->dc_udbbuf.b_relen = sizeof (struct de_ring) / sizeof(u_int16_t);
- dc->dc_udbbuf.b_rrlen = NRCV;
-
- DE_WLOW(CMD_GETCMD);
- dewait("wtring");
-
- dc->dc_pcbb.pcbb0 = FC_WTMODE;
- dc->dc_pcbb.pcbb2 = MOD_DRDC|MOD_TPAD|MOD_HDX;
- DE_WLOW(CMD_GETCMD);
- dewait("wtmode");
-
- DE_WLOW(CMD_START);
- dewait("start");
-
- DE_WLOW(CMD_PDMD);
- dewait("initpoll");
- /* Should be running by now */
-
- net_devinit(f, &de_driver, eaddr);
-
- return 0;
-}
-
-int
-de_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timeout)
-{
- volatile int to = 100000 * timeout;
- int len, csr0;
-
- if ((csr0 = DE_RCSR(DE_PCSR0)) & PCSR0_INTR)
- DE_WHIGH(csr0 >> 8);
-retry:
- if (to-- == 0)
- return 0;
-
- if (dc->dc_rrent[crx].r_flags & RFLG_OWN)
- goto retry;
-
- if (dc->dc_rrent[crx].r_flags & RFLG_ERRS)
- len = 0;
- else
- len = dc->dc_rrent[crx].r_lenerr & RERR_MLEN;
-
- if (len > maxlen)
- len = maxlen;
- if (len)
- bcopy((char *)&dc->dc_rbuf[crx][0], pkt, len);
-
- dc->dc_rrent[crx].r_flags = RFLG_OWN;
- dc->dc_rrent[crx].r_lenerr = 0;
-#ifdef DEV_DEBUG
- printf("Got packet: len %d idx %d maxlen %ld\n", len, crx, maxlen);
-#endif
- if (++crx == NRCV)
- crx = 0;
-
- if (len == 0)
- goto retry;
- return len;
-}
-
-
-int
-de_put(struct iodesc *desc, void *pkt, size_t len)
-{
- volatile int to = 100000;
- int csr0;
-
- if ((csr0 = DE_RCSR(DE_PCSR0)) & PCSR0_INTR)
- DE_WHIGH(csr0 >> 8);
-#ifdef DEV_DEBUG
- printf("de_put: len %ld\n", len);
-#endif
-retry:
- if (to-- == 0)
- return -1;
-
- if (dc->dc_xrent[ctx].r_flags & RFLG_OWN)
- goto retry;
-
- bcopy(pkt, (char *)&dc->dc_xbuf[ctx][0], len);
-
- dc->dc_xrent[ctx].r_slen = len;
- dc->dc_xrent[ctx].r_tdrerr = 0;
- dc->dc_xrent[ctx].r_flags = XFLG_OWN|XFLG_STP|XFLG_ENP;
-
- DE_WLOW(CMD_PDMD);
- dewait("start");
-
- if (++ctx == NXMT)
- ctx = 0;
- return len;
-}
-
-int
-declose(struct open_file *f)
-{
- DE_WCSR(DE_PCSR0, PCSR0_RSET);
- dewait("close");
- return 0;
-}
-
-void
-dewait(char *fn)
-{
- int csr0;
-
-#ifdef DEV_DEBUG
- printf("dewait: %s...", fn);
-#endif
- while ((DE_RCSR(DE_PCSR0) & PCSR0_INTR) == 0)
- ;
- csr0 = DE_RCSR(DE_PCSR0);
- DE_WHIGH(csr0 >> 8);
-#ifdef DEV_DEBUG
- if (csr0 & PCSR0_PCEI)
- printf("failed! CSR0 %x", csr0);
- else
- printf("done");
- printf(", PCSR1 %x\n", DE_RCSR(DE_PCSR1));
-#endif
-}
diff --git a/sys/arch/vax/stand/boot/if_le.c b/sys/arch/vax/stand/boot/if_le.c
deleted file mode 100644
index fb3651f1fef..00000000000
--- a/sys/arch/vax/stand/boot/if_le.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/* $OpenBSD: if_le.c,v 1.9 2014/08/21 14:24:08 mpi Exp $ */
-/* $NetBSD: if_le.c,v 1.6 2000/05/20 13:30:03 ragge Exp $ */
-/*
- * Copyright (c) 1997, 1999 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * Standalone routine for MicroVAX LANCE chip.
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/queue.h>
-#include <sys/socket.h>
-
-#include <net/if.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#include <machine/sid.h>
-#include <machine/rpb.h>
-
-#include <lib/libsa/netif.h>
-#include <lib/libsa/stand.h>
-
-#include <arch/vax/mbus/mbusreg.h>
-#include <arch/vax/mbus/fwioreg.h>
-
-#include <dev/ic/lancereg.h>
-#include <dev/ic/am7990reg.h>
-
-#include "vaxstand.h"
-
-/*
- * Buffer sizes.
- */
-#define TLEN 1
-#define NTBUF (1 << TLEN)
-#define RLEN 3
-#define NRBUF (1 << RLEN)
-#define BUFSIZE 1518
-
-#define ETHER_MIN_LEN 64 /* minimum frame length, including CRC */
-
-#define QW_ALLOC(x) (((int)alloc((x) + 7) + 7) & ~7)
-
-static int le_get(struct iodesc *, void *, size_t, time_t);
-static int le_put(struct iodesc *, void *, size_t);
-static void copyout(void *from, int dest, int len);
-static void copyin(int src, void *to, int len);
-
-struct netif_driver le_driver = {
- 0, 0, 0, 0, le_get, le_put,
-};
-
-/*
- * Init block & buffer descriptors according to DEC system
- * specification documentation.
- */
-struct initblock {
- short ib_mode;
- char ib_padr[6]; /* Ethernet address */
- int ib_ladrf1;
- int ib_ladrf2;
- int ib_rdr; /* Receive address */
- int ib_tdr; /* Transmit address */
-} *initblock = NULL;
-
-struct nireg {
- volatile u_short ni_rdp; /* data port */
- volatile short ni_pad0;
- volatile short ni_rap; /* register select port */
-} *nireg;
-
-
-volatile struct buffdesc {
- int bd_adrflg;
- short bd_bcnt;
- short bd_mcnt;
-} *rdesc, *tdesc;
-
-static int addoff;
-static int lebufaddr;
-
-/* Flags in the address field */
-#define BR_OWN 0x80000000
-#define BR_ERR 0x40000000
-#define BR_FRAM 0x20000000
-#define BR_OFLO 0x10000000
-#define BR_CRC 0x08000000
-#define BR_BUFF 0x04000000
-#define BR_STP 0x02000000
-#define BR_ENP 0x01000000
-
-#define BT_OWN 0x80000000
-#define BT_ERR 0x40000000
-#define BT_MORE 0x10000000
-#define BT_ONE 0x08000000
-#define BT_DEF 0x04000000
-#define BT_STP 0x02000000
-#define BT_ENP 0x01000000
-
-int next_rdesc, next_tdesc;
-
-#define LEWRCSR(port, val) { \
- nireg->ni_rap = (port); \
- nireg->ni_rdp = (val); \
-}
-
-#define LERDCSR(port) \
- (nireg->ni_rap = port, nireg->ni_rdp)
-
-int
-leopen(struct open_file *f, int adapt, int ctlr, int unit, int part)
-{
- int i, *ea;
- volatile int to = 100000;
- u_char eaddr[6];
-
- next_rdesc = next_tdesc = 0;
-
- if (vax_boardtype == VAX_BTYP_650 &&
- vax_cpustype == VAX_STYP_640) {
- lebufaddr = 0x20120000;
- ea = (void *)0x20084200;
- nireg = (void *)0x20084400;
- } else if (vax_boardtype == VAX_BTYP_60) {
- extern int ka60_ioslot;
- lebufaddr = MBUS_SLOT_BASE(ka60_ioslot) + FWIO_LANCE_BUF_OFFSET;
- ea = (int *)(MBUS_SLOT_BASE(ka60_ioslot) + FWIO_ESAR_OFFSET);
- for (i = 0; i < 6; i++) {
- eaddr[i] = *(u_char *)((int)ea + 2);
- ea++;
- }
- ea = NULL;
- nireg = (void *)(MBUS_SLOT_BASE(ka60_ioslot) +
- FWIO_LANCE_REG_OFFSET);
- } else {
- *(int *)0x20080014 = 0; /* Be sure we do DMA in low 16MB */
- ea = (void *)0x20090000; /* XXX Ethernet address */
- nireg = (void *)0x200e0000;
- }
- if (askname == 0) /* Override if autoboot */
- nireg = (void *)bootrpb.csrphy;
- else /* Tell kernel from where we booted */
- bootrpb.csrphy = (int)nireg;
-
- if (vax_boardtype == VAX_BTYP_43)
- addoff = 0x28000000;
- else
- addoff = 0;
-igen:
- LEWRCSR(LE_CSR0, LE_C0_STOP);
- while (to--)
- ;
-
- if (ea != NULL) {
- for (i = 0; i < 6; i++)
- eaddr[i] = ea[i] & 0377;
- }
-
- if (initblock == NULL) {
- (void *)initblock =
- (char *)QW_ALLOC(sizeof(struct initblock)) + addoff;
- initblock->ib_mode = LE_MODE_NORMAL;
- bcopy(eaddr, initblock->ib_padr, 6);
- initblock->ib_ladrf1 = 0;
- initblock->ib_ladrf2 = 0;
-
- (int)rdesc = QW_ALLOC(sizeof(struct buffdesc) * NRBUF) + addoff;
- initblock->ib_rdr = (RLEN << 29) | (int)rdesc;
- if (lebufaddr)
- initblock->ib_rdr -= (int)initblock;
- (int)tdesc = QW_ALLOC(sizeof(struct buffdesc) * NTBUF) + addoff;
- initblock->ib_tdr = (TLEN << 29) | (int)tdesc;
- if (lebufaddr)
- initblock->ib_tdr -= (int)initblock;
- if (lebufaddr)
- copyout(initblock, 0, sizeof(struct initblock));
-
- for (i = 0; i < NRBUF; i++) {
- rdesc[i].bd_adrflg = QW_ALLOC(BUFSIZE) | BR_OWN;
- if (lebufaddr)
- rdesc[i].bd_adrflg -= (int)initblock;
- rdesc[i].bd_bcnt = -BUFSIZE;
- rdesc[i].bd_mcnt = 0;
- }
- if (lebufaddr)
- copyout((void *)rdesc, (int)rdesc - (int)initblock,
- sizeof(struct buffdesc) * NRBUF);
-
- for (i = 0; i < NTBUF; i++) {
- tdesc[i].bd_adrflg = QW_ALLOC(BUFSIZE);
- if (lebufaddr)
- tdesc[i].bd_adrflg -= (int)initblock;
- tdesc[i].bd_bcnt = 0xf000;
- tdesc[i].bd_mcnt = 0;
- }
- if (lebufaddr)
- copyout((void *)tdesc, (int)tdesc - (int)initblock,
- sizeof(struct buffdesc) * NTBUF);
- }
-
- if (lebufaddr) {
- LEWRCSR(LE_CSR1, 0);
- LEWRCSR(LE_CSR2, 0);
- } else {
- LEWRCSR(LE_CSR1, (int)initblock & 0xffff);
- LEWRCSR(LE_CSR2, ((int)initblock >> 16) & 0xff);
- }
-
- LEWRCSR(LE_CSR0, LE_C0_INIT);
-
- to = 100000;
- while (to--) {
- if (LERDCSR(LE_CSR0) & LE_C0_IDON)
- break;
- if (LERDCSR(LE_CSR0) & LE_C0_ERR) {
- printf("lance init error: csr0 %x\n", LERDCSR(LE_CSR0));
- goto igen;
- }
- }
-
- LEWRCSR(LE_CSR0, LE_C0_INEA | LE_C0_STRT | LE_C0_IDON);
-
- net_devinit(f, &le_driver, eaddr);
- return 0;
-}
-
-int
-le_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timeout)
-{
- int csr, len;
- volatile int to = 100000 * timeout;
-
-retry:
- if (to-- == 0)
- return 0;
-
- csr = LERDCSR(LE_CSR0);
- LEWRCSR(LE_CSR0, csr & (LE_C0_BABL|LE_C0_MISS|LE_C0_MERR|LE_C0_RINT));
-
- if (lebufaddr)
- copyin((int)&rdesc[next_rdesc] - (int)initblock,
- (void *)&rdesc[next_rdesc], sizeof(struct buffdesc));
- if (rdesc[next_rdesc].bd_adrflg & BR_OWN)
- goto retry;
-
- if (rdesc[next_rdesc].bd_adrflg & BR_ERR)
- len = 0;
- else {
- if ((len = rdesc[next_rdesc].bd_mcnt - 4) > maxlen)
- len = maxlen;
-
- if (lebufaddr)
- copyin((rdesc[next_rdesc].bd_adrflg&0xffffff),
- pkt, len);
- else
- bcopy((char *)(rdesc[next_rdesc].bd_adrflg&0xffffff) +
- addoff, pkt, len);
- }
-
- rdesc[next_rdesc].bd_mcnt = 0;
- rdesc[next_rdesc].bd_adrflg |= BR_OWN;
- if (lebufaddr)
- copyout((void *)&rdesc[next_rdesc], (int)&rdesc[next_rdesc] -
- (int)initblock, sizeof(struct buffdesc));
- if (++next_rdesc >= NRBUF)
- next_rdesc = 0;
-
-
- if (len == 0)
- goto retry;
- return len;
-}
-
-int
-le_put(struct iodesc *desc, void *pkt, size_t len)
-{
- volatile int to = 100000;
- int csr;
-
-retry:
- if (--to == 0)
- return -1;
-
- csr = LERDCSR(LE_CSR0);
- LEWRCSR(LE_CSR0, csr & (LE_C0_MISS|LE_C0_CERR|LE_C0_TINT));
-
- if (lebufaddr)
- copyin((int)&tdesc[next_tdesc] - (int)initblock,
- (void *)&tdesc[next_tdesc], sizeof(struct buffdesc));
- if (tdesc[next_tdesc].bd_adrflg & BT_OWN)
- goto retry;
-
- if (lebufaddr)
- copyout(pkt, (tdesc[next_tdesc].bd_adrflg & 0xffffff), len);
- else
- bcopy(pkt, (char *)(tdesc[next_tdesc].bd_adrflg & 0xffffff) +
- addoff, len);
- tdesc[next_tdesc].bd_bcnt =
- (len < ETHER_MIN_LEN ? -ETHER_MIN_LEN : -len);
- tdesc[next_tdesc].bd_mcnt = 0;
- tdesc[next_tdesc].bd_adrflg |= BT_OWN | BT_STP | BT_ENP;
- if (lebufaddr)
- copyout((void *)&tdesc[next_tdesc], (int)&tdesc[next_tdesc] -
- (int)initblock, sizeof(struct buffdesc));
-
- LEWRCSR(LE_CSR0, LE_C0_TDMD);
-
- to = 100000;
- while (((LERDCSR(LE_CSR0) & LE_C0_TINT) == 0) && --to)
- ;
-
- LEWRCSR(LE_CSR0, LE_C0_TINT);
- if (++next_tdesc >= NTBUF)
- next_tdesc = 0;
-
- if (to)
- return len;
-
- return -1;
-}
-
-int
-leclose(struct open_file *f)
-{
- LEWRCSR(LE_CSR0, LE_C0_STOP);
-
- return 0;
-}
-
-void
-copyout(void *f, int dest, int len)
-{
- if (vax_boardtype == VAX_BTYP_60) {
- u_char *from = f;
- u_char *toaddr = (u_char *)lebufaddr + dest;
-
- while (len-- > 0)
- *toaddr++ = *from++;
- } else {
- short *from = f;
- short *toaddr;
-
- toaddr = (short *)lebufaddr + dest;
-
- while (len > 0) {
- *toaddr = *from++;
- toaddr += 2;
- len -= 2;
- }
- }
-}
-
-void
-copyin(int src, void *f, int len)
-{
- if (vax_boardtype == VAX_BTYP_60) {
- u_char *to = f;
- u_char *fromaddr;
-
- fromaddr = (u_char *)lebufaddr + src;
-
- while (len-- > 0)
- *to++ = *fromaddr++;
- } else {
- short *to = f;
- short *fromaddr;
-
- fromaddr = (short *)lebufaddr + src;
-
- while (len > 0) {
- *to++ = *fromaddr;
- fromaddr += 2;
- len -= 2;
- }
- }
-}
diff --git a/sys/arch/vax/stand/boot/if_qe.c b/sys/arch/vax/stand/boot/if_qe.c
deleted file mode 100644
index c52e046c470..00000000000
--- a/sys/arch/vax/stand/boot/if_qe.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/* $OpenBSD: if_qe.c,v 1.4 2014/08/21 14:24:08 mpi Exp $ */
-/* $NetBSD: if_qe.c,v 1.3 2000/05/20 13:30:03 ragge Exp $ */
-
-/*
- * Copyright (c) 1998 Roar Thronæs. 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 Roar Thronæs.
- * 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 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.
- *
- * Standalone routine for the DEQNA.
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-
-#include <netinet/in.h>
-
-#include <lib/libsa/netif.h>
-#include <lib/libsa/stand.h>
-
-#include <arch/vax/if/if_qereg.h>
-
-#include "../include/rpb.h"
-
-#include "vaxstand.h"
-
-static int qe_get(struct iodesc *desc, void *pkt, size_t, time_t timeout);
-static int qe_put(struct iodesc *desc, void *pkt, size_t);
-static void qe_init(u_char *eaddr);
-
-struct netif_driver qe_driver = {
- 0, 0, 0, 0, qe_get, qe_put,
-};
-
-#define NRCV 1 /* Receive descriptors */
-#define NXMT 1 /* Transmit descriptors */
-
-#define QE_INTS (QE_RCV_INT | QE_XMIT_INT)
-#define MAXPACKETSIZE 0x800 /* Because of (buggy) DEQNA */
-
-static struct qe_softc {
- struct qe_ring rring[NRCV+2]; /* Receive ring descriptors */
- struct qe_ring tring[NXMT+2]; /* Xmit ring descriptors */
- u_char setup_pkt[16][8]; /* Setup packet */
- char qein[2048], qeout[2048];/* Packet buffers */
-} qe_softc;
-
-static struct qe_softc *sc = &qe_softc;
-static int addr;
-
-#define QE_WCSR(csr, val) \
- (*((volatile u_short *)(addr + (csr))) = (val))
-#define QE_RCSR(csr) \
- *((volatile u_short *)(addr + (csr)))
-#define DELAY(x) {volatile int i = x;while (--i);}
-#define LOWORD(x) ((int)(x) & 0xffff)
-#define HIWORD(x) (((int)(x) >> 16) & 0x3f)
-#define qereg(x) ((x) & 017777)
-
-int
-qeopen(struct open_file *f, int adapt, int ctlr, int unit, int part) {
- u_char eaddr[6];
-
- if (askname == 0)
- addr = bootrpb.csrphy; /* Autoboot; use RPB instead */
- else {
- addr = 0x20000000;
- if (unit == 0)
- addr += qereg(0774440); /* XQA0 */
- else if (unit == 1)
- addr += qereg(0174460); /* XQB0 */
- else
- return ECTLR;
- }
-
- qe_init(eaddr);
-
- net_devinit(f, &qe_driver, eaddr);
- return 0;
-}
-
-void
-qe_init(u_char *eaddr)
-{
- int i,j;
-
- QE_WCSR(QE_CSR_CSR, QE_RESET);
- QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) & ~QE_RESET);
-
- for (i = 0; i < 6; i++) {
- sc->setup_pkt[i][1] = QE_RCSR(i * 2);
- sc->setup_pkt[i+8][1] = QE_RCSR(i * 2);
- sc->setup_pkt[i][2] = 0xff;
- sc->setup_pkt[i+8][2] = QE_RCSR(i * 2);
- for (j=3; j < 8; j++) {
- sc->setup_pkt[i][j] = QE_RCSR(i * 2);
- sc->setup_pkt[i+8][j] = QE_RCSR(i * 2);
- }
- eaddr[i] = QE_RCSR(i * 2);
- }
-
- bzero((caddr_t)sc->rring, sizeof(struct qe_ring));
- sc->rring->qe_buf_len = -64;
- sc->rring->qe_addr_lo = (short)((int)sc->setup_pkt);
- sc->rring->qe_addr_hi = (short)((int)sc->setup_pkt >> 16);
-
- bzero((caddr_t)sc->tring, sizeof(struct qe_ring));
- sc->tring->qe_buf_len = -64;
- sc->tring->qe_addr_lo = (short)((int)sc->setup_pkt);
- sc->tring->qe_addr_hi = (short)((int)sc->setup_pkt >> 16);
-
- sc->rring[0].qe_flag = sc->rring[0].qe_status1 = QE_NOTYET;
- sc->rring->qe_addr_hi |= QE_VALID;
-
- sc->tring[0].qe_flag = sc->tring[0].qe_status1 = QE_NOTYET;
- sc->tring->qe_addr_hi |= QE_VALID | QE_SETUP | QE_EOMSG;
-
- QE_WCSR(QE_CSR_CSR, QE_XMIT_INT | QE_RCV_INT);
-
- QE_WCSR(QE_CSR_RCLL, LOWORD(sc->rring));
- QE_WCSR(QE_CSR_RCLH, HIWORD(sc->rring));
- QE_WCSR(QE_CSR_XMTL, LOWORD(sc->tring));
- QE_WCSR(QE_CSR_XMTH, HIWORD(sc->tring));
-
- while ((QE_RCSR(QE_CSR_CSR) & QE_INTS) != QE_INTS)
- ;
- QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) | QE_INTS);
- QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) & ~(QE_INT_ENABLE|QE_ELOOP));
- QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) | QE_ILOOP);
-
- sc->rring[0].qe_addr_lo = (short)((int)sc->qein & 0xffff);
- sc->rring[0].qe_addr_hi = (short)((int)sc->qein >> 16);
- sc->rring[0].qe_buf_len=-MAXPACKETSIZE/2;
- sc->rring[0].qe_addr_hi |= QE_VALID;
- sc->rring[0].qe_flag=sc->rring[0].qe_status1=QE_NOTYET;
- sc->rring[0].qe_status2=1;
-
- sc->rring[1].qe_addr_lo = 0;
- sc->rring[1].qe_addr_hi = 0;
- sc->rring[1].qe_flag=sc->rring[1].qe_status1=QE_NOTYET;
- sc->rring[1].qe_status2=1;
-
- sc->tring[0].qe_addr_lo = (short)((int)sc->qeout & 0xffff);
- sc->tring[0].qe_addr_hi = (short)((int)sc->qeout >> 16);
- sc->tring[0].qe_buf_len=0;
- sc->tring[0].qe_flag=sc->tring[0].qe_status1=QE_NOTYET;
- sc->tring[0].qe_addr_hi |= QE_EOMSG|QE_VALID;
-
- sc->tring[1].qe_flag=sc->tring[1].qe_status1=QE_NOTYET;
- sc->tring[1].qe_addr_lo = 0;
- sc->tring[1].qe_addr_hi = 0;
-
- QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) | QE_RCV_ENABLE);
- QE_WCSR(QE_CSR_RCLL, LOWORD(sc->rring));
- QE_WCSR(QE_CSR_RCLH, HIWORD(sc->rring));
-}
-
-int
-qe_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timeout) {
- int len, j;
-
-retry:
- for(j = 0x10000;j && (QE_RCSR(QE_CSR_CSR) & QE_RCV_INT) == 0; j--)
- ;
-
- if ((QE_RCSR(QE_CSR_CSR) & QE_RCV_INT) == 0)
- goto fail;
-
- QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) & ~(QE_RCV_ENABLE|QE_XMIT_INT));
-
- len= ((sc->rring[0].qe_status1 & QE_RBL_HI) |
- (sc->rring[0].qe_status2 & QE_RBL_LO)) + 60;
-
- if (sc->rring[0].qe_status1 & 0xc000)
- goto fail;
-
- if (len == 0)
- goto retry;
-
- bcopy((void*)sc->qein,pkt,len);
-
-
-end:
- sc->rring[0].qe_status2 = sc->rring[1].qe_status2 = 1;
- sc->rring[0].qe_flag=sc->rring[0].qe_status1=QE_NOTYET;
- sc->rring[1].qe_flag=sc->rring[1].qe_status1=QE_NOTYET;
- QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) | QE_RCV_ENABLE);
-
- QE_WCSR(QE_CSR_RCLL, LOWORD(sc->rring));
- QE_WCSR(QE_CSR_RCLH, HIWORD(sc->rring));
- return len;
-
-fail: len = -1;
- goto end;
-}
-
-int
-qe_put(struct iodesc *desc, void *pkt, size_t len) {
- int j;
-
- bcopy(pkt, (char *)sc->qeout, len);
- sc->tring[0].qe_buf_len=-len/2;
- sc->tring[0].qe_flag=sc->tring[0].qe_status1=QE_NOTYET;
- sc->tring[1].qe_flag=sc->tring[1].qe_status1=QE_NOTYET;
-
- QE_WCSR(QE_CSR_XMTL, LOWORD(sc->tring));
- QE_WCSR(QE_CSR_XMTH, HIWORD(sc->tring));
-
- for(j = 0; (j < 0x10000) && ((QE_RCSR(QE_CSR_CSR) & QE_XMIT_INT) == 0); j++)
- ;
-
- if ((QE_RCSR(QE_CSR_CSR) & QE_XMIT_INT) == 0) {
- char eaddr[6];
-
- qe_init(eaddr);
- return -1;
- }
- QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) & ~QE_RCV_INT);
-
- if (sc->tring[0].qe_status1 & 0xc000) {
- char eaddr[6];
-
- qe_init(eaddr);
- return -1;
- }
- return len;
-}
-
-int
-qeclose(struct open_file *nif)
-{
- QE_WCSR(QE_CSR_CSR, QE_RESET);
- QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) & ~QE_RESET);
-
- return 0;
-}
diff --git a/sys/arch/vax/stand/boot/if_ze.c b/sys/arch/vax/stand/boot/if_ze.c
deleted file mode 100644
index 1e23e346b56..00000000000
--- a/sys/arch/vax/stand/boot/if_ze.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/* $OpenBSD: if_ze.c,v 1.6 2014/08/21 14:24:08 mpi Exp $ */
-/* $NetBSD: if_ze.c,v 1.12 2002/05/27 16:54:18 ragge Exp $ */
-/*
- * Copyright (c) 1998 James R. Maynard III. 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 James R. Maynard III.
- * 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 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.
- *
- * Standalone routine for the SGEC Ethernet controller.
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/queue.h>
-
-#include <net/if.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#include <lib/libsa/netif.h>
-#include <lib/libsa/stand.h>
-#include <lib/libsa/net.h>
-
-#include <arch/vax/if/sgecreg.h>
-
-#include "arch/vax/include/sid.h"
-#include "arch/vax/include/rpb.h"
-
-#include "vaxstand.h"
-
-static int ze_get(struct iodesc *, void *, size_t, time_t);
-static int ze_put(struct iodesc *, void *, size_t);
-
-#define ETHER_MIN_LEN 64
-#define ETHER_MAX_LEN 1518
-
-struct netif_driver ze_driver = {
- 0, 0, 0, 0, ze_get, ze_put,
-};
-
-#define NRCV 8 /* allocate 8 receive descriptors */
-#define NXMT 4 /* and 4 transmit - must be >1 */
-#define SETUP_FRAME_LEN 128 /* length of the setup frame */
-
-/* allocate a buffer on an octaword boundary */
-#define OW_ALLOC(x) ((void *)((int)((int)alloc((x) + 15) + 15) & ~15))
-
-static volatile struct zedevice *addr;
-
-struct ze_tdes *ze_tdes_list; /* transmit desc list */
-struct ze_rdes *ze_rdes_list; /* and receive desc list */
-u_char ze_myaddr[ETHER_ADDR_LEN]; /* my Ethernet address */
-
-int
-zeopen(struct open_file *f, int adapt, int ctlr, int unit, int part)
-{
- u_long nicsr0_work, *nisa_rom;
- struct ze_tdes *ze_setup_tdes_list;
- int i;
-
- /* point to the device in memory */
- if (askname == 0) /* Override if autoboot */
- addr = (struct zedevice *)bootrpb.csrphy;
- else
- addr = (struct zedevice *)0x20008000;
-
- /* reset the device and wait for completion */
- addr->ze_nicsr6 = ZE_NICSR6_MBO | ZE_NICSR6_RE;
- while ((addr->ze_nicsr5 & ZE_NICSR5_ID) == 0)
- ;
- if (addr->ze_nicsr5 & ZE_NICSR5_SF) {
- printf("SGEC self-test failed...\n");
- return 1;
- }
-
- /* Get our Ethernet address */
- if (vax_boardtype == VAX_BTYP_49) {
- nisa_rom = (u_long *)0x27800000;
- for (i=0; i<ETHER_ADDR_LEN; i++)
- ze_myaddr[i] = nisa_rom[i] & 0377;
- } else if (vax_boardtype == VAX_BTYP_VXT) {
- nisa_rom = (u_long *)0x200c4000;
- for (i=0; i<ETHER_ADDR_LEN; i++)
- ze_myaddr[i] = nisa_rom[i] & 0xff;
- } else {
- nisa_rom = (u_long *)0x20084000;
- for (i=0; i<ETHER_ADDR_LEN; i++)
- if (vax_boardtype == VAX_BTYP_660)
- ze_myaddr[i] = (nisa_rom[i] & 0xff000000) >> 24;
- else
- ze_myaddr[i] = (nisa_rom[i] & 0x0000ff00) >> 8;
- }
- printf("SGEC: Ethernet address %s", ether_sprintf(ze_myaddr));
-
- /* initialize SGEC operating mode */
- /* disable interrupts here */
- nicsr0_work = ZE_NICSR0_IPL14 | ZE_NICSR0_SA | ZE_NICSR0_MBO |
- (ZE_NICSR0_IV_MASK & 0x0108);
- do {
- addr->ze_nicsr0 = nicsr0_work;
- } while (addr->ze_nicsr0 != nicsr0_work);
- if (addr->ze_nicsr5 & ZE_NICSR5_ME)
- addr->ze_nicsr5 |= ZE_NICSR5_ME;
- /* reenable interrupts here */
-
- /* Allocate space for descriptor lists and buffers,
- then initialize them. Set up both lists as a ring. */
- ze_rdes_list = OW_ALLOC((NRCV+1) * sizeof(struct ze_rdes));
- ze_tdes_list = OW_ALLOC((NXMT+1) * sizeof(struct ze_tdes));
- for (i=0; i < NRCV; i++) {
- bzero(ze_rdes_list+i,sizeof(struct ze_rdes));
- ze_rdes_list[i].ze_framelen = ZE_FRAMELEN_OW;
- ze_rdes_list[i].ze_bufsize = ETHER_MAX_LEN;
- ze_rdes_list[i].ze_bufaddr = alloc(ETHER_MAX_LEN);
- }
- bzero(ze_rdes_list+NRCV,sizeof(struct ze_rdes));
- ze_rdes_list[NRCV].ze_framelen = ZE_FRAMELEN_OW;
- ze_rdes_list[NRCV].ze_rdes1 = ZE_RDES1_CA;
- ze_rdes_list[NRCV].ze_bufaddr = (u_char *)ze_rdes_list;
- for (i=0; i < NXMT; i++) {
- bzero(ze_tdes_list+i,sizeof(struct ze_tdes));
- ze_tdes_list[i].ze_tdes1 = ZE_TDES1_FS | ZE_TDES1_LS;
- ze_tdes_list[i].ze_bufsize = ETHER_MAX_LEN;
- ze_tdes_list[i].ze_bufaddr = alloc(ETHER_MAX_LEN);
- }
- bzero(ze_tdes_list+NXMT,sizeof(struct ze_tdes));
- ze_tdes_list[NXMT].ze_tdes1 = ZE_TDES1_CA;
- ze_tdes_list[NXMT].ze_tdr = ZE_TDR_OW;
- ze_tdes_list[NXMT].ze_bufaddr = (u_char *)ze_tdes_list;
-
- printf("."); /* XXX VXT */
-
- /* Build setup frame. We set the SGEC to do a
- perfect filter on our own address. */
- ze_setup_tdes_list = OW_ALLOC(2*sizeof(struct ze_tdes));
- bzero(ze_setup_tdes_list+0,2*sizeof(struct ze_tdes));
- ze_setup_tdes_list[0].ze_tdr = ZE_TDR_OW;
- ze_setup_tdes_list[0].ze_tdes1 = ZE_TDES1_DT_SETUP;
- ze_setup_tdes_list[0].ze_bufsize = SETUP_FRAME_LEN;
- ze_setup_tdes_list[0].ze_bufaddr = alloc(SETUP_FRAME_LEN);
- bzero(ze_setup_tdes_list[0].ze_bufaddr,SETUP_FRAME_LEN);
- for (i=0; i < 16; i++)
- bcopy(ze_myaddr,ze_setup_tdes_list[0].ze_bufaddr+(8*i),
- ETHER_ADDR_LEN);
- ze_setup_tdes_list[1].ze_tdes1 = ZE_TDES1_CA;
- ze_setup_tdes_list[1].ze_bufaddr = (u_char *)ze_setup_tdes_list;
-
- printf("."); /* XXX VXT */
-
- /* Start the transmitter and initialize almost everything else. */
- addr->ze_nicsr4 = ze_setup_tdes_list;
- addr->ze_nicsr6 = ZE_NICSR6_MBO | ZE_NICSR6_SE | ZE_NICSR6_ST |
- ZE_NICSR6_DC | ZE_NICSR6_BL_4;
- while ((addr->ze_nicsr5 & ZE_NICSR5_TS) != ZE_NICSR5_TS_SUSP)
- ; /* wait for the frame to be processed */
-
- printf("."); /* XXX VXT */
-
- /* Setup frame is done processing, initialize the receiver and
- point the transmitter to the real tdes list. */
- addr->ze_nicsr4 = ze_tdes_list;
- addr->ze_nicsr3 = ze_rdes_list;
- addr->ze_nicsr6 |= ZE_NICSR6_SR;
-
- /* And away-y-y we go! */
-
- printf("\n");
- net_devinit(f, &ze_driver, ze_myaddr);
- return 0;
-}
-
-int
-ze_get(desc, pkt, maxlen, timeout)
- struct iodesc *desc;
- void *pkt;
- size_t maxlen;
- time_t timeout;
-{
- int timeout_ctr=100000*timeout, len, rdes;
-
- while (timeout_ctr-- > 0) {
-
- /* If there's not a packet waiting for us, just decrement the
- timeout counter. */
- if (!(addr->ze_nicsr5 & ZE_NICSR5_RI))
- continue;
-
- /* Look through the receive descriptor list for the packet. */
- for (rdes=0; rdes<NRCV; rdes++) {
- if (ze_rdes_list[rdes].ze_framelen & ZE_FRAMELEN_OW)
- continue;
-
- /* If the packet has an error, ignore it. */
- if (ze_rdes_list[rdes].ze_rdes0 & ZE_RDES0_ES)
- len = 0;
-
- /* Copy the packet, up to the length supplied by the caller, to
- the caller's buffer. */
- else {
- if ((len = (ze_rdes_list[rdes].ze_framelen &
- (~ ZE_FRAMELEN_OW))) > maxlen)
- len = maxlen;
- bcopy((void *)ze_rdes_list[rdes].ze_bufaddr,
- pkt,len);
- }
-
- /* Give ownership of this descriptor back to the SGEC. */
- ze_rdes_list[rdes].ze_framelen = ZE_FRAMELEN_OW;
-
- /* If we actually got a good packet, reset the error flags and
- tell the SGEC to look for more before returning. */
- if (len > 0) {
- addr->ze_nicsr5=ZE_NICSR5_RU | ZE_NICSR5_RI |
- ZE_NICSR5_IS;
- addr->ze_nicsr2=ZE_NICSR2_RXPD;
- return len;
- }
- }
- }
-
- /* If we're going to return an error indication, at least reset the
- error flags and tell the SGEC to keep receiving first. */
- addr->ze_nicsr5=ZE_NICSR5_RU | ZE_NICSR5_RI | ZE_NICSR5_IS;
- addr->ze_nicsr2=ZE_NICSR2_RXPD;
- return 0;
-}
-
-int
-ze_put(desc, pkt, len)
- struct iodesc *desc;
- void *pkt;
- size_t len;
-{
- int timeout=100000;
-
- /* The SGEC maintains its position in the transmit descriptor list
- for the next frame to transmit. Unfortunately, there's no way to tell
- from software just where that is. We're forced to reset the position
- whenever we send a frame, which requires waiting for the previous
- frame to be sent. Argh. */
- while ((addr->ze_nicsr5 & ZE_NICSR5_TS) == ZE_NICSR5_TS_RUN)
- ;
-
- /* Copy the packet to the buffer we allocated. */
- bcopy(pkt, (void *)ze_tdes_list[0].ze_bufaddr, len);
-
- /* Set the packet length in the descriptor, increasing it to the
- minimum size if needed. */
- ze_tdes_list[0].ze_bufsize = len;
- if (len < ETHER_MIN_LEN)
- ze_tdes_list[0].ze_bufsize = ETHER_MIN_LEN;
-
- /* Give ownership of the descriptor to the SGEC and tell it to start
- transmitting. */
- ze_tdes_list[0].ze_tdr = ZE_TDR_OW;
- addr->ze_nicsr4 = ze_tdes_list;
- addr->ze_nicsr1 = ZE_NICSR1_TXPD;
-
- /* Wait for the frame to be sent, but not too long. */
- timeout = 100000;
- while (((addr->ze_nicsr5 & ZE_NICSR5_TI) == 0) && (--timeout>0))
- ;
-
- /* Reset the transmitter interrupt pending flag. */
- addr->ze_nicsr5 |= ZE_NICSR5_TI;
-
- /* Return good if we didn't timeout, or error if we did. */
- if (timeout>0) return len;
- return -1;
-}
-
-int
-zeclose(struct open_file *f)
-{
- addr->ze_nicsr6 = ZE_NICSR6_RE;
-
- return 0;
-}
diff --git a/sys/arch/vax/stand/boot/mfm.c b/sys/arch/vax/stand/boot/mfm.c
deleted file mode 100644
index 5a3eb017a1f..00000000000
--- a/sys/arch/vax/stand/boot/mfm.c
+++ /dev/null
@@ -1,650 +0,0 @@
-/* $OpenBSD: mfm.c,v 1.5 2011/03/13 00:13:53 deraadt Exp $ */
-/* $NetBSD: mfm.c,v 1.4 2001/07/26 22:55:13 wiz Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by
- * Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * ToDo:
- *
- * - insert appropriate delays for diskette-drive where needed
- * - allow more than one sector per diskette-read
- * - check for and handle bad sectors
- * - ???
- */
-
-#include "sys/param.h"
-#include "sys/reboot.h"
-#include "sys/disklabel.h"
-
-#include "lib/libsa/stand.h"
-#include "lib/libsa/ufs.h"
-
-#include "../include/pte.h"
-#include "../include/sid.h"
-#include "../include/mtpr.h"
-#include "../include/reg.h"
-#include "../include/rpb.h"
-
-#include "ka410.h"
-#include "../vsa/hdc9224.h"
-
-#include "data.h"
-#include "vaxstand.h"
-
-#define MAX_WAIT (1000*1000) /* # of loop-instructions in seconds */
-
-struct mfm_softc {
- int part;
- int unit;
-};
-
-static struct disklabel mfmlabel;
-static struct mfm_softc mfm_softc;
-static char io_buf[DEV_BSIZE];
-
-/*
- * These should probably be somewhere else, but ka410 is the only
- * one with mfm disks anyway...
- */
-volatile unsigned char *ka410_intreq = (void*)0x2008000f;
-volatile unsigned char *ka410_intclr = (void*)0x2008000f;
-volatile unsigned char *ka410_intmsk = (void*)0x2008000c;
-
-static volatile struct hdc9224_DKCreg *dkc = (void *) 0x200c0000;
-static volatile struct hdc9224_UDCreg sreg; /* input */
-static volatile struct hdc9224_UDCreg creg; /* output */
-
-static void sreg_read(void);
-static void creg_write(void);
-static int mfm_rxprepare(void);
-static int mfm_command(int cmd);
-static int mfm_rxselect(int unit);
-static int mfm_rdselect(int unit);
-static int mfm_rxstrategy(void *f, int func, daddr32_t dblk, size_t size, void *buf, size_t *rsize);
-static int mfm_rdstrategy(void *f, int func, daddr32_t dblk, size_t size, void *buf, size_t *rsize);
-/*
- * we have to wait 0.7 usec between two accesses to any of the
- * dkc-registers, on a VS2000 with 1 MIPS, this is roughly one
- * instruction. Thus the loop-overhead will be enough...
- */
-static void
-sreg_read(void)
-{
- int i;
- char *p;
-
- dkc->dkc_cmd = 0x40; /* set internal counter to zero */
- p = (void *) &sreg;
- for (i = 0; i < 10; i++)
- *p++ = dkc->dkc_reg; /* dkc_reg auto-increments */
-}
-
-static void
-creg_write(void)
-{
- int i;
- char *p;
-
- dkc->dkc_cmd = 0x40; /* set internal counter to zero */
- p = (void *) &creg;
- for (i = 0; i < 10; i++)
- dkc->dkc_reg = *p++; /* dkc_reg auto-increments */
-}
-
-/*
- * floppies are handled in a quite strange way by this controller...
- *
- * before reading/writing a sector from/to floppy, we use the SEEK/READ_ID
- * command to place the head at the desired location. Then we wait some
- * time before issuing the real command in order to let the drive become
- * ready...
- */
-int
-mfm_rxprepare(void)
-{
- int error;
-
- error = mfm_command(DKC_CMD_SEEKREADID | 0x04); /* step=1, verify=0 */
- if (error) {
- printf("error while stepping to position %d/%d/%x. Retry...\n",
- creg.udc_dsect, creg.udc_dhead, creg.udc_dcyl);
- error = mfm_command(DKC_CMD_SEEKREADID | 0x04);
- }
- return error;
-}
-
-int
-mfm_rxselect(int unit)
-{
- int error;
-
- /*
- * bring "creg" in some known-to-work state and
- * select the drive with the DRIVE SELECT command.
- */
- creg.udc_dma7 = 0;
- creg.udc_dma15 = 0;
- creg.udc_dma23 = 0;
- creg.udc_dsect = 1; /* sectors are numbered 1..15 !!! */
- creg.udc_dhead = 0;
- creg.udc_dcyl = 0;
- creg.udc_scnt = 0;
-
- creg.udc_rtcnt = UDC_RC_RX33READ;
- creg.udc_mode = UDC_MD_RX33;
- creg.udc_term = UDC_TC_FDD;
-
- /*
- * this is ...
- */
- error = mfm_command(DKC_CMD_DRSEL_RX33 | unit);
-
- if ((error != 0) || ((sreg.udc_dstat & UDC_DS_READY) == 0)) {
- printf("\nfloppy-drive not ready (new floppy inserted?)\n\n");
-
- creg.udc_rtcnt &= ~UDC_RC_INVRDY; /* clear INVRDY-flag */
- error = mfm_command(DKC_CMD_DRSEL_RX33 | unit);
- if ((error != 0) || ((sreg.udc_dstat & UDC_DS_READY) == 0)) {
- printf("diskette not ready(1): %x/%x\n",
- error, sreg.udc_dstat);
- printf("floppy-drive offline?\n");
- return (-1);
- }
- if (sreg.udc_dstat & UDC_DS_TRK00)
- error = mfm_command(DKC_CMD_STEPIN_FDD);
- else
- error = mfm_command(DKC_CMD_STEPOUT_FDD);
-
- /*
- * now ready should be 0, cause INVRDY is not set
- * (retrying a command makes this fail...)
- */
- if ((error != 0) || ((sreg.udc_dstat & UDC_DS_READY) == 1)) {
- printf("diskette not ready(2): %x/%x\n",
- error, sreg.udc_dstat);
- }
- creg.udc_rtcnt |= UDC_RC_INVRDY;
- error = mfm_command(DKC_CMD_DRSEL_RX33 | unit);
-
- if ((error != 0) || ((sreg.udc_dstat & UDC_DS_READY) == 0)) {
- printf("diskette not ready(3): %x/%x\n",
- error, sreg.udc_dstat);
- printf("no floppy inserted or floppy-door open\n");
- return (-1);
- }
- printf("floppy-drive reselected.\n");
- }
- return (error);
-}
-
-int
-mfm_rdselect(int unit)
-{
- int error;
-
- /*
- * bring "creg" in some known-to-work state and
- * select the drive with the DRIVE SELECT command.
- */
- creg.udc_dma7 = 0;
- creg.udc_dma15 = 0;
- creg.udc_dma23 = 0;
- creg.udc_dsect = 0; /* sectors are numbered 0..16 */
- creg.udc_dhead = 0;
- creg.udc_dcyl = 0;
- creg.udc_scnt = 0;
-
- creg.udc_rtcnt = UDC_RC_HDD_READ;
- creg.udc_mode = UDC_MD_HDD;
- creg.udc_term = UDC_TC_HDD;
-
- error = mfm_command(DKC_CMD_DRSEL_HDD | unit);
-
- return (error);
-}
-
-static int mfm_retry = 0;
-
-int
-mfm_command(int cmd)
-{
- int termcode, ready, i;
-
- creg_write(); /* write command-registers */
- *ka410_intclr = INTR_DC;
- dkc->dkc_cmd = cmd; /* issue command */
- for (i = 0; i < MAX_WAIT; i++) {
- if (*ka410_intreq & INTR_DC) /* wait for interrupt */
- break;
- }
- if ((*ka410_intreq & INTR_DC) == 0)
- printf("timeout in mfm_command...\n");
-
- sreg_read(); /* read status-registers */
-
- if (dkc->dkc_stat == (DKC_ST_DONE | DKC_TC_SUCCESS))
- return (0);
-
- if (sreg.udc_cstat & UDC_CS_ECCERR) {
- printf(
-"\nspurious(?) ECC/CRC error at s%d/t%d/c%d [s%d/t%d/c%d(%d)]\n",
- sreg.udc_csect, sreg.udc_chead, sreg.udc_ccyl,
- creg.udc_dsect, creg.udc_dhead, creg.udc_dcyl,creg.udc_scnt);
- if (sreg.udc_csect != creg.udc_dsect + creg.udc_scnt - 1) {
- printf("DMA: %x %x %x [%x]\n",
- sreg.udc_dma23, sreg.udc_dma15,
- sreg.udc_dma7, 512 * (sreg.udc_csect -
- creg.udc_dsect));
- creg.udc_scnt = creg.udc_scnt -
- (sreg.udc_csect - creg.udc_dsect) - 1;
- creg.udc_dsect = sreg.udc_csect + 1;
- creg.udc_dma23 = sreg.udc_dma23;
- creg.udc_dma15 = sreg.udc_dma15 + 2;
- creg.udc_dma7 = 0;
- printf("Retry starting from s%d/t%d/c%d (%d). ",
- creg.udc_dsect, creg.udc_dhead, creg.udc_dcyl,
- creg.udc_scnt);
- }
- goto retry;
- }
- termcode = (dkc->dkc_stat & DKC_ST_TERMCOD) >> 3;
- ready = sreg.udc_dstat & UDC_DS_READY;
-
- printf("cmd:0x%x: termcode=0x%x, status=0x%x, cstat=0x%x, dstat=0x%x\n",
- cmd, termcode, dkc->dkc_stat, sreg.udc_cstat, sreg.udc_dstat);
-
- if (dkc->dkc_stat & DKC_ST_BADSECT)
- printf("bad sector found: s%d/t%d/c%d\n", creg.udc_dsect,
- creg.udc_dhead, creg.udc_dcyl);
-retry:
- if ((mfm_retry == 0) && (sreg.udc_cstat & UDC_CS_RETREQ)) {
- mfm_retry = 1;
- printf("Retrying... ");
- mfm_command(cmd);
- printf("Retry done.\n");
- mfm_retry = 0;
- }
- return ((dkc->dkc_stat & DKC_ST_TERMCOD) >> 3);
-}
-
-/*
- * on-disk geometry block
- */
-#define _aP __attribute__ ((packed)) /* force byte-alignment */
-
-volatile struct mfm_xbn {
- char mbz[10];/* 10 bytes of zero */
- long xbn_count _aP; /* number of XBNs */
- long dbn_count _aP; /* number of DBNs */
- long lbn_count _aP; /* number of LBNs (Logical-Block-Numbers) */
- long rbn_count _aP; /* number of RBNs (Replacement-Block-Numbers) */
- short nspt; /* number of sectors per track */
- short ntracks;/* number of tracks */
- short ncylinders; /* number of cylinders */
- short precomp;/* first cylinder for write precompensation */
- short reduced;/* first cylinder for reduced write current */
- short seek_rate; /* seek rate or zero for buffered
- * seeks */
- short crc_eec;/* 0 if CRC is being used or 1 if ECC is
- * being used */
- short rct; /* "replacement control table" (RCT) */
- short rct_ncopies; /* number of copies of the RCT */
- long media_id _aP; /* media identifier */
- short interleave; /* sector-to-sector interleave */
- short headskew; /* head-to-head skew */
- short cylskew;/* cylinder-to-cylinder skew */
- short gap0_size; /* size of GAP 0 in the MFM format */
- short gap1_size; /* size of GAP 1 in the MFM format */
- short gap2_size; /* size of GAP 2 in the MFM format */
- short gap3_size; /* size of GAP 3 in the MFM format */
- short sync_value; /* sync value used to start a track
- * when formatting */
- char reserved[32]; /* reserved for use by the RQDX1/2/3
- * formatter */
- short serial_number; /* serial number */
- char fill[412]; /* Filler bytes to the end of the
- * block */
- short checksum; /* checksum over the XBN */
-} mfm_xbn;
-
-#ifdef verbose
-display_xbn(struct mfm_xbn *p)
-{
- printf("**DiskData** XBNs: %d, DBNs: %d, LBNs: %d, RBNs: %d\n",
- p->xbn_count, p->dbn_count, p->lbn_count, p->rbn_count);
- printf("sect/track: %d, tracks: %d, cyl: %d, precomp/reduced: %d/%d\n",
- p->nspt, p->ntracks, p->ncylinders, p->precomp, p->reduced);
- printf("seek-rate: %d, crc/eec: %s, RCT: %d, RCT-copies: %d\n",
- p->seek_rate, p->crc_eec ? "EEC" : "CRC", p->rct, p->rct_ncopies);
- printf("media-ID: 0x%x, interleave: %d, headskew: %d, cylskew: %d\n",
- &p->media_id, p->interleave, p->headskew, p->cylskew);
- printf("gap0: %d, gap1: %d, gap2: %d, gap3: %d, sync-value: %d\n",
- p->gap0_size, p->gap1_size, p->gap2_size, p->gap3_size,
- p->sync_value);
- printf("serial: %d, checksum: %d, size: %d, reserved: %32c\n",
- p->serial_number, p->checksum, sizeof(*p), p->reserved);
-}
-#endif
-
-int
-mfmopen(struct open_file *f, int adapt, int ctlr, int unit, int part)
-{
- char *msg;
- struct disklabel *lp = &mfmlabel;
- struct mfm_softc *msc = &mfm_softc;
- int err;
- size_t i;
-
- bzero(lp, sizeof(struct disklabel));
- msc->unit = unit;
- msc->part = part;
-
- err = mfmstrategy(msc, F_READ, LABELSECTOR, DEV_BSIZE, io_buf, &i);
- if (err) {
- printf("reading disklabel: %s\n", strerror(err));
- return 0;
- }
- msg = getdisklabel(io_buf + LABELOFFSET, lp);
- if (msg)
- printf("getdisklabel: %s\n", msg);
-
- f->f_devdata = (void *) msc;
-
- {
-#ifdef verbose
- int k;
- unsigned char *ucp;
- struct mfm_xbn *xp;
-#endif
-
- /* mfmstrategy(msc, F_READ, -16, 8192, io_buf, &i); */
- mfmstrategy(msc, F_READ, -16, 512, io_buf, &i);
-#ifdef verbose
- printf("dumping raw disk-block #0:\n");
- ucp = io_buf;
- for (k = 0; k < 128; k++) {
- if (ucp[k] < 0x10)
- printf("0");
- printf("%x ", ucp[k]);
- if (k % 8 == 7)
- printf(" ");
- if (k % 16 == 15)
- printf("\n");
- }
- printf("\n");
-
- xp = (void *) io_buf;
- display_xbn(xp);
- printf("\n");
-#endif
- }
-
- if (unit == 2) { /* floppy! */
- if (lp->d_ntracks != 2) {
-#ifdef verbose
- printf("changing number of tracks from %d to %d.\n",
- lp->d_ntracks, 2);
-#endif
- lp->d_ntracks = 2;
- }
- } else { /* hard-disk */
- unsigned short *usp = (void *) io_buf;
-#ifdef verbose
- printf("label says: s/t/c = %d/%d/%d\n",
- lp->d_nsectors, lp->d_ntracks, lp->d_ncylinders);
-#endif
- if (lp->d_nsectors != usp[13]) {
-#ifdef verbose
- printf("changing number of sectors from %d to %d.\n",
- lp->d_nsectors, usp[13]);
-#endif
- lp->d_nsectors = usp[13];
- }
- if (lp->d_ntracks != usp[14]) {
-#ifdef verbose
- printf("changing number of heads/tracks from %d to %d.\n",
- lp->d_ntracks, usp[14]);
-#endif
- lp->d_ntracks = usp[14];
- }
- if (lp->d_ncylinders != usp[15]) {
-#ifdef verbose
- printf("changing number of cylinders from %d to %d.\n",
- lp->d_ncylinders, usp[15]);
-#endif
- lp->d_ncylinders = usp[15];
- }
- lp->d_secpercyl = lp->d_nsectors * lp->d_ntracks;
- }
-
- return (0);
-}
-
-int
-mfm_rxstrategy(void *f, int func, daddr32_t dblk, size_t size, void *buf, size_t *rsize)
-{
- struct mfm_softc *msc = f;
- struct disklabel *lp;
- int block, sect, head, cyl, scount, res;
-
- lp = &mfmlabel;
- block = (dblk < 0 ? 0 : dblk + lp->d_partitions[msc->part].p_offset);
-
- mfm_rxselect(msc->unit);
-
- /*
- * if label is empty, assume RX33
- */
- if (lp->d_nsectors == 0)
- lp->d_nsectors = 15;
- if (lp->d_ntracks == 0)
- lp->d_ntracks = 2;
- if (lp->d_secpercyl == 0)
- lp->d_secpercyl = 30;
-
- bzero((void *) 0x200D0000, size);
- scount = size / 512;
-
- while (scount) {
- /*
- * prepare drive/operation parameter
- */
- cyl = block / lp->d_secpercyl;
- sect = block % lp->d_secpercyl;
- head = sect / lp->d_nsectors;
- sect = sect % lp->d_nsectors;
-
- /*
- * *rsize = 512; one sector after the other
- * ...
- */
- *rsize = 512 * min(scount, lp->d_nsectors - sect);
-
- /*
- * now initialize the register values ...
- */
- creg.udc_dma7 = 0;
- creg.udc_dma15 = 0;
- creg.udc_dma23 = 0;
-
- creg.udc_dsect = sect + 1; /* sectors are numbered 1..15
- * !!! */
- head |= (cyl >> 4) & 0x70;
- creg.udc_dhead = head;
- creg.udc_dcyl = cyl;
-
- creg.udc_scnt = *rsize / 512;
-
- if (func == F_WRITE) {
- creg.udc_rtcnt = UDC_RC_RX33WRT;
- creg.udc_mode = UDC_MD_RX33;
- creg.udc_term = UDC_TC_FDD;
-
- mfm_rxprepare();
- /* copy from buf */
- bcopy(buf, (void *) 0x200D0000, *rsize);
- res = mfm_command(DKC_CMD_WRITE_RX33);
- } else {
- creg.udc_rtcnt = UDC_RC_RX33READ;
- creg.udc_mode = UDC_MD_RX33;
- creg.udc_term = UDC_TC_FDD;
-
- mfm_rxprepare();
- /* clear disk buffer */
- bzero((void *) 0x200D0000, *rsize);
- res = mfm_command(DKC_CMD_READ_RX33);
- /* copy to buf */
- bcopy((void *) 0x200D0000, buf, *rsize);
- }
-
- scount -= *rsize / 512;
- block += *rsize / 512;
- (char *)buf += *rsize;
- }
-
- *rsize = size;
- return 0;
-}
-
-int
-mfm_rdstrategy(void *f, int func, daddr32_t dblk, size_t size, void *buf, size_t *rsize)
-{
- struct mfm_softc *msc = f;
- struct disklabel *lp;
- int block, sect, head, cyl, scount, cmd, res;
-
- lp = &mfmlabel;
- block = (dblk < 0 ? 0 : dblk + lp->d_partitions[msc->part].p_offset);
-
- /*
- * if label is empty, assume RD32 (XXX this must go away!!!)
- */
- if (lp->d_nsectors == 0)
- lp->d_nsectors = 17;
- if (lp->d_ntracks == 0)
- lp->d_ntracks = 6;
- if (lp->d_secpercyl == 0)
- lp->d_secpercyl = 102;
-
- mfm_rdselect(msc->unit);
-
- bzero((void *) 0x200D0000, size);
- scount = size / 512;
-
- while (scount) {
- /*
- * prepare drive/operation parameter
- */
- cyl = block / lp->d_secpercyl;
- sect = block % lp->d_secpercyl;
- head = sect / lp->d_nsectors;
- sect = sect % lp->d_nsectors;
-
- if (dblk < 0) {
-#ifdef verbose
- printf("using raw diskblock-data!\n");
- printf("block %d, dblk %d ==> cyl %d, head %d, sect %d\n",
- block, dblk, cyl, sect, head);
-#endif
- } else
- cyl += 1; /* first cylinder is reserved for
- * controller! */
-
- *rsize = 512 * min(scount, lp->d_nsectors - sect);
- /*
- * now re-initialize the register values ...
- */
- creg.udc_dma7 = 0;
- creg.udc_dma15 = 0;
- creg.udc_dma23 = 0;
-
- creg.udc_dsect = sect;
- head |= (cyl >> 4) & 0x70;
- creg.udc_dhead = head;
- creg.udc_dcyl = cyl;
-
- creg.udc_scnt = *rsize / 512;
-
- if (func == F_WRITE) {
- creg.udc_rtcnt = UDC_RC_HDD_WRT;
- creg.udc_mode = UDC_MD_HDD;
- creg.udc_term = UDC_TC_HDD;
- cmd = DKC_CMD_WRITE_HDD;
-
- bcopy(buf, (void *) 0x200D0000, *rsize);
- res = mfm_command(cmd);
- } else {
- creg.udc_rtcnt = UDC_RC_HDD_READ;
- creg.udc_mode = UDC_MD_HDD;
- creg.udc_term = UDC_TC_HDD;
- cmd = DKC_CMD_READ_HDD;
-
- bzero((void *) 0x200D0000, *rsize);
- res = mfm_command(cmd);
- bcopy((void *) 0x200D0000, buf, *rsize);
- }
-
- scount -= *rsize / 512;
- block += *rsize / 512;
- (char *)buf += *rsize;
- }
-
- /*
- * unselect the drive ...
- */
- mfm_command(DKC_CMD_DRDESELECT);
-
- *rsize = size;
- return 0;
-}
-
-int
-mfmstrategy(void *f, int func, daddr32_t dblk, size_t size, void *buf, size_t *rsize)
-{
- struct mfm_softc *msc = f;
- int res = -1;
-
- switch (msc->unit) {
- case 0:
- case 1:
- res = mfm_rdstrategy(f, func, dblk, size, buf, rsize);
- break;
- case 2:
- res = mfm_rxstrategy(f, func, dblk, size, buf, rsize);
- break;
- default:
- printf("invalid unit %d in mfmstrategy()\n", msc->unit);
- }
- return (res);
-}
diff --git a/sys/arch/vax/stand/boot/netio.c b/sys/arch/vax/stand/boot/netio.c
deleted file mode 100644
index 91c6745eea2..00000000000
--- a/sys/arch/vax/stand/boot/netio.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* $OpenBSD: netio.c,v 1.6 2014/08/21 14:24:08 mpi Exp $ */
-/* $NetBSD: netio.c,v 1.6 2000/05/26 20:16:46 ragge Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997 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.
- *
- * 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) 1995 Gordon W. Ross
- * 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.
- * 4. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Gordon W. Ross
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This module implements a "raw device" interface suitable for
- * use by the stand-alone I/O library NFS code. This interface
- * does not support any "block" access, and exists only for the
- * purpose of initializing the network interface, getting boot
- * parameters, and performing the NFS mount.
- *
- * At open time, this does:
- *
- * find interface - netif_open()
- * RARP for IP address - rarp_getipaddress()
- * RPC/bootparams - callrpc(d, RPC_BOOTPARAMS, ...)
- * RPC/mountd - nfs_mount(sock, ip, path)
- *
- * the root file handle from mountd is saved in a global
- * for use by the NFS open code (NFS/lookup).
- */
-
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#include "lib/libsa/stand.h"
-#include "lib/libsa/net.h"
-#include "lib/libsa/netif.h"
-#include "lib/libsa/bootparam.h"
-#include "lib/libsa/nfs.h"
-#include "lib/libsa/bootp.h"
-
-#include "vaxstand.h"
-
-static struct iodesc desc;
-static int inited = 0;
-
-struct iodesc *
-socktodesc(sock)
-{
- return &desc;
-}
-
-int
-net_devinit(struct open_file *f, struct netif_driver *drv, u_char *eaddr) {
- static struct netif best_if;
- struct iodesc *s;
- int r;
-
- if (inited)
- return 0;
- /* find a free socket */
- s = &desc;
-
- bzero(s, sizeof(*s));
- best_if.nif_driver = drv;
- s->io_netif = &best_if;
- bcopy(eaddr, s->myea, 6);
-
- /*
- * Get info for NFS boot: our IP address, our hostname,
- * server IP address, and our root path on the server.
- * There are two ways to do this: The old, Sun way,
- * and the more modern, BOOTP way. (RFC951, RFC1048)
- */
-
-#ifdef SUPPORT_BOOTP
-
- /* Get boot info using BOOTP way. (RFC951, RFC1048) */
- printf("Trying BOOTP\n");
- bootp(0);
-
- if (myip.s_addr) {
- printf("Using IP address: %s\n", inet_ntoa(myip));
-
- printf("myip: %s (%s)\n", hostname, inet_ntoa(myip));
- } else
-
-#endif /* SUPPORT_BOOTP */
- {
-#ifdef SUPPORT_BOOTPARAMS
- /* Get boot info using RARP and Sun bootparams. */
-
- printf("Trying BOOTPARAMS\n");
- /* Get our IP address. (rarp.c) */
- if (rarp_getipaddress(0) == -1)
- return (errno);
-
- printf("boot: client IP address: %s\n", inet_ntoa(myip));
-
- /* Get our hostname, server IP address. */
- if (bp_whoami(0))
- return (errno);
-
- printf("boot: client name: %s\n", hostname);
-
- /* Get the root pathname. */
- if (bp_getfile(0, "root", &rootip, rootpath))
- return (errno);
-#endif
- }
- printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath);
- f->f_devdata = s;
-
- /* Get the NFS file handle (mount). */
- r = nfs_mount(0, rootip, rootpath);
- if (r)
- return r;
-
- inited = 1;
- return 0;
-}
-
-ssize_t
-netif_put(struct iodesc *desc, void *pkt, size_t len)
-{
- return (*desc->io_netif->nif_driver->netif_put)(desc, pkt, len);
-}
-
-ssize_t
-netif_get(struct iodesc *desc, void *pkt, size_t len, time_t timo)
-{
- return (*desc->io_netif->nif_driver->netif_get)(desc, pkt, len, timo);
-}
diff --git a/sys/arch/vax/stand/boot/ra.c b/sys/arch/vax/stand/boot/ra.c
deleted file mode 100644
index da113386fe7..00000000000
--- a/sys/arch/vax/stand/boot/ra.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/* $OpenBSD: ra.c,v 1.6 2015/10/01 16:08:20 krw Exp $ */
-/* $NetBSD: ra.c,v 1.11 2002/06/04 15:13:55 ragge Exp $ */
-/*
- * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- */
-
- /* All bugs are subject to removal without further notice */
-
-#define NRSP 1 /* Kludge */
-#define NCMD 1 /* Kludge */
-
-#include "sys/param.h"
-#include "sys/disklabel.h"
-
-#include "lib/libsa/stand.h"
-
-#include "../include/pte.h"
-#include "../include/rpb.h"
-
-#include "arch/vax/mscp/mscp.h"
-#include "arch/vax/mscp/mscpreg.h"
-
-#include "vaxstand.h"
-
-static void command(int, int);
-
-/*
- * These routines for RA disk standalone boot is wery simple,
- * assuming a lots of thing like that we only working at one ra disk
- * a time, no separate routines for uba driver etc..
- * This code is foolish and should need a cleanup.
- * But it works :)
- */
-
-static volatile struct uda {
- struct mscp_1ca uda_ca; /* communications area */
- struct mscp uda_rsp; /* response packets */
- struct mscp uda_cmd; /* command packets */
-} uda;
-
-static struct disklabel ralabel;
-static char io_buf[DEV_BSIZE];
-static int dpart, dunit, is_tmscp, curblock;
-static volatile u_short *ra_ip, *ra_sa, *ra_sw;
-static volatile u_int *mapregs;
-
-int
-raopen(struct open_file *f, int adapt, int ctlr, int unit, int part)
-{
- static volatile struct uda *ubauda;
- unsigned short johan, johan2;
- size_t i;
- int err;
- char *msg;
-
-#ifdef DEV_DEBUG
- printf("raopen: adapter %d ctlr %d unit %d part %d\n",
- adapt, ctlr, unit, part);
- printf("raopen: csrbase %x nexaddr %x\n", csrbase, nexaddr);
-#endif
- bzero(&ralabel, sizeof(struct disklabel));
- bzero((void *)&uda, sizeof(struct uda));
- if (bootrpb.devtyp == BDEV_TK)
- is_tmscp = 1;
- dunit = unit;
- dpart = part;
- if (ctlr < 0)
- ctlr = 0;
- curblock = 0;
- /* Assume uda-alike adapter */
- if (askname == 0) {
- csrbase = bootrpb.csrphy;
- dunit = bootrpb.unit;
- nexaddr = bootrpb.adpphy;
- } else
- csrbase += (ctlr ? 000334 : 012150);
- ra_ip = (short *)csrbase;
- ra_sa = ra_sw = (short *)csrbase + 1;
- if (nexaddr) { /* have map registers */
- mapregs = (int *)nexaddr + 512;
- mapregs[494] = PG_V | (((u_int)&uda) >> 9);
- mapregs[495] = mapregs[494] + 1;
- (char *)ubauda = (char *)0x3dc00 +
- (((u_int)(&uda))&0x1ff);
- } else
- ubauda = &uda;
- johan = (((u_int)ubauda) & 0xffff) + 8;
- johan2 = (((u_int)ubauda) >> 16) & 077;
- *ra_ip = 0; /* Start init */
- bootrpb.csrphy = csrbase;
-
-#ifdef DEV_DEBUG
- printf("start init\n");
-#endif
- /* Init of this uda */
- while ((*ra_sa & MP_STEP1) == 0)
- ;
-#ifdef DEV_DEBUG
- printf("MP_STEP1...");
-#endif
- *ra_sw = 0x8000;
- while ((*ra_sa & MP_STEP2) == 0)
- ;
-#ifdef DEV_DEBUG
- printf("MP_STEP2...");
-#endif
-
- *ra_sw = johan;
- while ((*ra_sa & MP_STEP3) == 0)
- ;
-#ifdef DEV_DEBUG
- printf("MP_STEP3...");
-#endif
-
- *ra_sw = johan2;
- while ((*ra_sa & MP_STEP4) == 0)
- ;
-#ifdef DEV_DEBUG
- printf("MP_STEP4\n");
-#endif
-
- *ra_sw = 0x0001;
- uda.uda_ca.ca_rspdsc = (int)&ubauda->uda_rsp.mscp_cmdref;
- uda.uda_ca.ca_cmddsc = (int)&ubauda->uda_cmd.mscp_cmdref;
- if (is_tmscp) {
- uda.uda_cmd.mscp_un.un_seq.seq_addr =
- (long *)&uda.uda_ca.ca_cmddsc;
- uda.uda_rsp.mscp_un.un_seq.seq_addr =
- (long *)&uda.uda_ca.ca_rspdsc;
- uda.uda_cmd.mscp_vcid = 1;
- uda.uda_cmd.mscp_un.un_sccc.sccc_ctlrflags = 0;
- }
-
- command(M_OP_SETCTLRC, 0);
- uda.uda_cmd.mscp_unit = dunit;
- command(M_OP_ONLINE, 0);
-
- if (is_tmscp) {
- if (part) {
-#ifdef DEV_DEBUG
- printf("Repos of tape...");
-#endif
- uda.uda_cmd.mscp_un.un_seq.seq_buffer = part;
- command(M_OP_POS, 0);
- uda.uda_cmd.mscp_un.un_seq.seq_buffer = 0;
-#ifdef DEV_DEBUG
- printf("Done!\n");
-#endif
- }
- return 0;
- }
-#ifdef DEV_DEBUG
- printf("reading disklabel\n");
-#endif
- err = rastrategy(0, F_READ, LABELSECTOR, DEV_BSIZE, io_buf, &i);
- if(err){
- printf("reading disklabel: %s\n",strerror(err));
- return 0;
- }
-
-#ifdef DEV_DEBUG
- printf("getting disklabel\n");
-#endif
- msg = getdisklabel(io_buf+LABELOFFSET, &ralabel);
- if (msg)
- printf("getdisklabel: %s\n", msg);
- return(0);
-}
-
-static void
-command(int cmd, int arg)
-{
- volatile short hej;
- int to;
-
-igen: uda.uda_cmd.mscp_opcode = cmd;
- uda.uda_cmd.mscp_modifier = arg;
-
- uda.uda_cmd.mscp_msglen = MSCP_MSGLEN;
- uda.uda_rsp.mscp_msglen = MSCP_MSGLEN;
- uda.uda_ca.ca_rspdsc |= MSCP_OWN|MSCP_INT;
- uda.uda_ca.ca_cmddsc |= MSCP_OWN|MSCP_INT;
-#ifdef DEV_DEBUG
- printf("sending cmd %x...", cmd);
-#endif
- hej = *ra_ip;
- to = 10000000;
- while (uda.uda_ca.ca_rspdsc < 0) {
-// if (uda.uda_ca.ca_cmdint)
-// uda.uda_ca.ca_cmdint = 0;
- if (--to < 0) {
-#ifdef DEV_DEBUG
- printf("timing out, retry\n");
-#endif
- goto igen;
- }
- }
-#ifdef DEV_DEBUG
- printf("sent.\n");
-#endif
-}
-
-int
-rastrategy(void *f, int func, daddr32_t dblk,
- size_t size, void *buf, size_t *rsize)
-{
- u_int pfnum, mapnr, nsize;
-
-#ifdef DEV_DEBUG
- printf("rastrategy: buf %p is_tmscp %d\n",
- buf, is_tmscp);
-#endif
- pfnum = (u_int)buf >> VAX_PGSHIFT;
-
- for(mapnr = 0, nsize = size; (nsize + VAX_NBPG) > 0; nsize -= VAX_NBPG)
- mapregs[mapnr++] = PG_V | pfnum++;
- uda.uda_cmd.mscp_seq.seq_buffer = ((u_int)buf) & 0x1ff;
-
- if (is_tmscp) {
- int i;
-
- /*
- * First position tape. Remember where we are.
- */
- if (dblk < curblock) {
- uda.uda_cmd.mscp_seq.seq_bytecount = curblock - dblk;
- command(M_OP_POS, 12); /* 12 == step block backward */
- } else {
- uda.uda_cmd.mscp_seq.seq_bytecount = dblk - curblock;
- command(M_OP_POS, 4); /* 4 == step block forward */
- }
- curblock = size/512 + dblk;
-
- /*
- * Read in the number of blocks we need.
- * Why doesn't read of multiple blocks work?????
- */
- for (i = 0 ; i < size/512 ; i++) {
- uda.uda_cmd.mscp_seq.seq_lbn = 1;
- uda.uda_cmd.mscp_seq.seq_bytecount = 512;
- uda.uda_cmd.mscp_seq.seq_buffer =
- (((u_int)buf) & 0x1ff) + i * 512;
- uda.uda_cmd.mscp_unit = dunit;
- command(M_OP_READ, 0);
- }
- } else {
-
- uda.uda_cmd.mscp_seq.seq_lbn =
- dblk + ralabel.d_partitions[dpart].p_offset;
- uda.uda_cmd.mscp_seq.seq_bytecount = size;
- uda.uda_cmd.mscp_unit = dunit;
-#ifdef DEV_DEBUG
- printf("rastrategy: blk 0x%lx count %lx unit %x\n",
- uda.uda_cmd.mscp_seq.seq_lbn, size, dunit);
-#endif
-#ifdef notdef
- if (func == F_WRITE)
- command(M_OP_WRITE, 0);
- else
-#endif
- command(M_OP_READ, 0);
- }
-
- *rsize = size;
- return 0;
-}
diff --git a/sys/arch/vax/stand/boot/rom.c b/sys/arch/vax/stand/boot/rom.c
deleted file mode 100644
index fc64ca13565..00000000000
--- a/sys/arch/vax/stand/boot/rom.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $OpenBSD: rom.c,v 1.6 2015/10/01 16:08:20 krw Exp $ */
-/* $NetBSD: rom.c,v 1.3 2000/07/19 00:58:25 matt Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by
- * Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/reboot.h"
-#include "sys/disklabel.h"
-
-#include "lib/libsa/stand.h"
-#include "lib/libsa/ufs.h"
-
-#include "../include/pte.h"
-#include "../include/sid.h"
-#include "../include/mtpr.h"
-#include "../include/reg.h"
-#include "../include/rpb.h"
-
-#include "data.h"
-#include "vaxstand.h"
-
-static struct disklabel romlabel;
-static char io_buf[DEV_BSIZE];
-static struct bqo *bqo;
-static int dpart, dunit;
-
-int
-romopen(struct open_file *f, int adapt, int ctlr, int unit, int part)
-{
- char *msg;
- struct disklabel *lp = &romlabel;
- size_t i;
- int err;
-
- bqo = (void *)bootrpb.iovec;
-
- if (bootrpb.unit > 0 && (bootrpb.unit % 100) == 0) {
- printf ("changing bootrpb.unit from %d ", bootrpb.unit);
- bootrpb.unit /= 100;
- printf ("to %d\n", bootrpb.unit);
- }
-
- bzero(lp, sizeof(struct disklabel));
- dunit = unit;
- dpart = part;
-
- err = romstrategy(0, F_READ, LABELSECTOR, DEV_BSIZE, io_buf, &i);
- if (err) {
- printf("reading disklabel: %s\n",strerror(err));
- return 0;
- }
- msg = getdisklabel(io_buf+LABELOFFSET, lp);
- if (msg)
- printf("getdisklabel: %s\n",msg);
- return(0);
-}
-
-int romwrite_uvax(int, int, void *, struct rpb *);
-int romread_uvax(int, int, void *, struct rpb *);
-
-int
-romstrategy (f, func, dblk, size, buf, rsize)
- void *f;
- int func;
- daddr32_t dblk;
- size_t size;
- void *buf;
- size_t *rsize;
-{
- struct disklabel *lp;
- int block;
-
- lp = &romlabel;
- block = dblk + lp->d_partitions[dpart].p_offset;
- if (dunit >= 0 && dunit < 10)
- bootrpb.unit = dunit;
-
- if (func == F_WRITE)
- romwrite_uvax(block, size, buf, &bootrpb);
- else
- romread_uvax(block, size, buf, &bootrpb);
-
- *rsize = size;
- return 0;
-}
-
diff --git a/sys/arch/vax/stand/boot/vaxstand.h b/sys/arch/vax/stand/boot/vaxstand.h
deleted file mode 100644
index c8b41c4bfab..00000000000
--- a/sys/arch/vax/stand/boot/vaxstand.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $OpenBSD: vaxstand.h,v 1.3 2011/07/06 18:32:59 miod Exp $ */
-/* $NetBSD: vaxstand.h,v 1.5 2000/06/15 19:53:23 ragge Exp $ */
-/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- */
-
-/* Variables used in autoconf */
-extern int askname;
-extern struct rpb bootrpb;
-extern int csrbase, nexaddr;
-
-/* devsw type definitions, used in bootxx and conf */
-#define SADEV(name,strategy,open,close,ioctl) \
- { (char *)name, \
- (int(*)(void *, int, daddr32_t, size_t, void *, size_t *))strategy, \
- (int(*)(struct open_file *, ...))open, \
- (int(*)(struct open_file *))close, \
- (int(*)(struct open_file *,u_long, void *))ioctl}
-
-#define SDELAY(count) {volatile int i; for (i = count; i; i--);}
-/*
- * Easy-to-use definitions
- */
-#ifndef min
-#define min(x,y) (x < y ? x : y)
-#endif /* min */
-
-struct netif_driver;
-
-char *index(char *, int);
-int net_devinit(struct open_file *f, struct netif_driver *drv, u_char *eaddr);
-
-/* device calls */
-int raopen(struct open_file *, int, int, int, int),
- rastrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int romopen(struct open_file *, int, int, int, int),
- romstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int mfmopen(struct open_file *, int, int, int, int),
- mfmstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int sdopen(struct open_file *),
- sdstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int leopen(struct open_file *, int, int, int, int),
- leclose(struct open_file *);
-int qeopen(struct open_file *, int, int, int, int),
- qeclose(struct open_file *);
-int zeopen(struct open_file *, int, int, int, int),
- zeclose(struct open_file *);
-int deopen(struct open_file *, int, int, int, int),
- declose(struct open_file *);
-int netopen(struct open_file *), netclose(struct open_file *);
-
diff --git a/sys/arch/vax/stand/boot/version b/sys/arch/vax/stand/boot/version
deleted file mode 100644
index 13a147212dc..00000000000
--- a/sys/arch/vax/stand/boot/version
+++ /dev/null
@@ -1,42 +0,0 @@
-$OpenBSD: version,v 1.11 2014/02/19 22:13:53 miod Exp $
-$NetBSD: version,v 1.4 2001/11/09 19:53:15 scw Exp $
-
-NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this
-file is important - make sure the entries are appended on end, last item
-is taken as the current.
-
-1.0: Initial import.
-1.1: Bunch of small fixes to make boot work on most VAXen.
-1.2: Use common routines to identify cpu type.
- Set up a SCB to be able to handle clock interrupts in the boot program.
- Now timer countdown should work on all types of vaxen.
-1.3: Unify the ra and tmscp driver.
- Standalone driver for the Digital Equipment Unibus Network Adapter
- (DEUNA). This allows 11/750 owners to install from a single TU58
- cassette.
- Adapt to the RPB changes. Complete change of how network devices are
- handled. No more hacks to find bus addresses.
-1.5: Standalone device driver for DEBNx (ni) ethernet controllers.
-1.6: Add support for VAX 6000 + VAX 8000. Tweak console routines.
- Create a fake RPB if either netbooted (on machine without RPB) or
- loaded from console storage (without VMB intervention).
-1.7: Add support for loading a 2nd stage boot in either a.out or ELF.
- Add support for loading a 2nd stage boot directly to its desired
- address if possible.
- Cleanup use of u_int/size_t.
-1.8: Switch to loadfile instead of exec. Now we can load a.out or ELF
- kernels. (disabled in OpenBSD)
-1.9: Support verbose/quiet boot.
-1.10: Remove the 11/750 pcs code and the list of kernels to try to boot
- in order.
- Work around some PROM bugs in graphics mode which cause \h and \t not
- to behave as expected.
-1.11: Better VXT2000{,+} support.
-1.12: Glass console support on VXT2000{,+}.
-1.13: Enable the loadfile code added in revision 1.8.
-1.14: Support for VaxStation 3[58][24]0.
-1.15: Restore boot sd()... functionality on machines with asc(4) or sii(4)
- controllers.
-1.16: Remove support for VAX 11/7x0, VAX6000 and VAX8000
-1.17: ELF bootblocks.
-1.18: /etc/random.seed support
diff --git a/sys/arch/vax/stand/common/romread.S b/sys/arch/vax/stand/common/romread.S
deleted file mode 100644
index 1e44ac0ff27..00000000000
--- a/sys/arch/vax/stand/common/romread.S
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: romread.S,v 1.3 2013/07/05 21:13:06 miod Exp $ */
-/* $NetBSD: romread.S,v 1.1 2002/02/24 01:04:25 matt Exp $ */
-/*
- * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by
- * Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
- /* All bugs are subject to removal without further notice */
-
-
-
-#include "../include/asm.h"
-
-/*
- * romread_uvax (int lbn, int size, void *buf, struct rpb *rpb)
- */
-ENTRY(romread_uvax, 0xFFE)
- movl 16(%ap),%r11 # restore boot-contents of %r11 (rpb)
- movl 52(%r11), %r7 # load iovec/bqo into %r7
- addl3 (%r7), %r7, %r6 # load qio into %r6
- pushl %r11 # base of rpb
- pushl $0 # virtual-flag
- pushl $33 # read-logical-block
- pushl 4(%ap) # lbn to start reading
- pushl 8(%ap) # number of bytes to read
- pushl 12(%ap) # buffer-address
- calls $6, (%r6) # call the qio-routine
- ret # %r0 holds the result
-
-/*
- * romwrite_uvax (int lbn, int size, void *buf, struct rpb *rpb)
- */
-ENTRY(romwrite_uvax, 0xFFE)
- movl 16(%ap), %r11 # restore boot-contents of %r11 (rpb)
- movl 52(%r11), %r7 # load iovec/bqo into %r7
- addl3 (%r7), %r7, %r6 # load qio into %r6
- pushl %r11 # base of rpb
- pushl $0 # virtual-flag
- pushl $32 # write-logical-block
- pushl 4(%ap) # lbn to start reading
- pushl 8(%ap) # number of bytes to read
- pushl 12(%ap) # buffer-address
- calls $6, (%r6) # call the qio-routine
- ret # %r0 holds the result
-
diff --git a/sys/arch/vax/stand/common/srt0.S b/sys/arch/vax/stand/common/srt0.S
deleted file mode 100644
index 751d965e57f..00000000000
--- a/sys/arch/vax/stand/common/srt0.S
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: srt0.S,v 1.3 2013/07/05 21:13:06 miod Exp $ */
-/* $NetBSD: srt0.S,v 1.2 2002/03/31 00:11:14 matt Exp $ */
-/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- */
-
- /* All bugs are subject to removal without further notice */
-
-#include "../include/asm.h"
-
-/*
- * Auto-moving startup code for standalone programs. Can be loaded
- * (almost) anywhere in memory but moves itself to the position
- * it is linked for. Must be started at first position, recommended
- * is phys addr 0 (boot loads programs at 0, but starts them at the
- * position set in a.out header.
- */
-
-ALTENTRY(start)
- nop;nop;
- movl $_C_LABEL(start), %sp # Probably safe place for stack
- pushr $0x1fff # save for later usage
-
- subl3 $_C_LABEL(start), $_C_LABEL(edata), %r0
- movab _C_LABEL(start), %r1 # get where we are
- movl $_C_LABEL(start), %r3 # get where we want to be
- cmpl %r1,%r3 # are we where we want to be?
- beql relocated # already relocated, skip copy
- movc3 %r0,(%r1),(%r3) # copy
- subl3 $_C_LABEL(edata), $_C_LABEL(end), %r2
- movc5 $0,(%r3),$0,%r2,(%r3) # Zero bss
-
- movpsl -(%sp)
- pushl $relocated
- rei
-relocated: # now relocation is done !!!
- movl %sp,_C_LABEL(bootregs) # *bootregs
- calls $0, _C_LABEL(Xmain) # Were here!
- halt # no return
-
-ENTRY(machdep_start, 0)
- mtpr $0x1f,$0x12 # Block all interrupts
- mtpr $0,$0x18 # stop real time interrupt clock
- movl 4(%ap), %r6
- movl 20(%ap), %r9 # end of symbol table
- pushl 8(%ap) # number of symbols
- pushl 16(%ap) # start of symbols
- movab _C_LABEL(bootrpb),%r10 # get RPB address
- pushl %r10 # argument for new boot
- ashl $9,76(%r10),%r8 # memory size (COMPAT)
- movl $3,%r11 # ask boot (COMPAT)
- clrl %r10 # no boot dev (COMPAT)
-
- calls $3,(%r6)
- halt
diff --git a/sys/arch/vax/stand/common/str.S b/sys/arch/vax/stand/common/str.S
deleted file mode 100644
index e6967467d8b..00000000000
--- a/sys/arch/vax/stand/common/str.S
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $OpenBSD: str.S,v 1.4 2013/07/05 21:13:06 miod Exp $ */
-/* $NetBSD: str.S,v 1.1 2002/02/24 01:04:25 matt Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * Small versions of the most common functions not using any
- * emulated instructions.
- */
-
-#include "asm.h"
-
-/*
- * atoi() used in devopen.
- */
-ENTRY(atoi, 0)
- movl 4(%ap),%r1
- clrl %r0
-
-2: movzbl (%r1)+,%r2
- cmpb %r2,$48
- blss 1f
- cmpb %r2,$57
- bgtr 1f
- subl2 $48,%r2
- mull2 $10,%r0
- addl2 %r2,%r0
- brb 2b
-1: ret
-
-/*
- * index() small and easy.
- * doesnt work if we search for null.
- */
-ENTRY(index, 0)
- movq 4(%ap),%r0
-1: cmpb (%r0), %r1
- beql 2f
- tstb (%r0)+
- bneq 1b
- clrl %r0
-2: ret
-
-/*
- * cmpc3 is emulated on MVII.
- */
-ENTRY(bcmp, 0)
- movl 4(%ap), %r2
- movl 8(%ap), %r1
- movl 12(%ap), %r0
-2: cmpb (%r2)+, (%r1)+
- bneq 1f
- decl %r0
- bneq 2b
-1: ret
-
-/*
- * Is movc3/movc5 emulated on any CPU? I dont think so; use them here.
- */
-ENTRY(bzero,0)
- movc5 $0,*4(%ap),$0,8(%ap),*4(%ap)
- ret
-
-ENTRY(bcopy,0)
- movc3 12(%ap), *4(%ap), *8(%ap)
- ret
-
-ENTRY(strlen, 0)
- movl 4(%ap), %r0
-1: tstb (%r0)+
- bneq 1b
- decl %r0
- subl2 4(%ap), %r0
- ret
-
-ENTRY(strcmp, 0)
- movl $250, %r3 # max string len to compare
-5: movl 4(%ap), %r2
- movl 8(%ap), %r1
- movl $1, %r0
-
-2: cmpb (%r2),(%r1)+
- bneq 1f # something differ
- tstb (%r2)+
- beql 4f # continue, strings unequal
- decl %r3 # max string len encountered?
- bneq 2b
-
-4: clrl %r0 # We are done, strings equal.
- ret
-
-1: bgtr 3f
- mnegl %r0, %r0
-3: ret
-
-ENTRY(strncpy, 0)
- movl 4(%ap), %r1
- movl 8(%ap), %r2
- movl 12(%ap), %r3
- bleq 2f
-
-1: movb (%r2)+, (%r1)+
- beql 2f
- decl %r3
- bneq 1b
-2: ret
-
-ENTRY(setjmp, 0)
- movl 4(%ap), %r0
- movl 8(%fp), (%r0)
- movl 12(%fp), 4(%r0)
- movl 16(%fp), 8(%r0)
- addl3 %fp,$28,12(%r0)
- clrl %r0
- ret
-
-ENTRY(longjmp, 0)
- movl 4(%ap), %r1
- movl $1, %r0
- movl (%r1), %ap
- movl 4(%r1), %fp
- movl 12(%r1), %sp
- jmp *8(%r1)
diff --git a/sys/arch/vax/stand/common/vaxstand.h b/sys/arch/vax/stand/common/vaxstand.h
deleted file mode 100644
index 0db8d099de8..00000000000
--- a/sys/arch/vax/stand/common/vaxstand.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $OpenBSD: vaxstand.h,v 1.3 2011/07/06 18:32:59 miod Exp $ */
-/* $NetBSD: vaxstand.h,v 1.1 1999/03/06 16:36:05 ragge Exp $ */
-/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- */
-
- /* All bugs are subject to removal without further notice */
-
-
-#define MAXNUBA 8 /* Unibusadapters */
-
-/* Variables used in autoconf */
-extern int *ubaaddr, *mbaaddr, *udaaddr;
-extern int cpunumber, howto;
-extern dev_t bootdev;
-
-/* devsw type definitions, used in bootxx and conf */
-#define SADEV(name,strategy,open,close,ioctl) \
- { (char *)name, \
- (int(*)(void *, int, daddr32_t, size_t, void *, size_t *))strategy, \
- (int(*)(struct open_file *, ...))open, \
- (int(*)(struct open_file *))close, \
- (int(*)(struct open_file *,u_long, void *))ioctl}
-
-#define SDELAY(count) {volatile int i; for (i = count; i; i--);}
-/*
- * Easy-to-use definitions
- */
-
-char *index();
diff --git a/sys/arch/vax/stand/xxboot/Makefile b/sys/arch/vax/stand/xxboot/Makefile
deleted file mode 100644
index cd82e81c324..00000000000
--- a/sys/arch/vax/stand/xxboot/Makefile
+++ /dev/null
@@ -1,59 +0,0 @@
-# $OpenBSD: Makefile,v 1.15 2015/10/15 19:29:32 miod Exp $
-# $NetBSD: Makefile,v 1.12 2002/02/24 01:04:25 matt Exp $
-
-S= ${.CURDIR}/../../../../
-
-PROG= xxboot
-WARNS?= 1
-
-SRCS= start.S bootxx.c romread.S str.S urem.s udiv.s
-
-INSTALL_STRIP=
-CPPFLAGS+=-D_STANDALONE -DLIBSA_NO_FD_CHECKING -DLIBSA_NO_RAW_ACCESS \
- -DLIBSA_NO_TWIDDLE -DLIBSA_SINGLE_DEVICE=rom \
- -DLIBSA_NO_COMPAT_UFS \
- -DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_CLOSE \
- -DLIBSA_NO_FS_WRITE -DLIBSA_NO_FS_SEEK \
- -DNEED_UFS
-AFLAGS+=-D_LOCORE
-BINDIR= /usr/mdec
-NOMAN= # defined
-NOPIE=
-
-CFLAGS= -Os
-
-SAREL=
-SA_AS= library
-.include "${S}/lib/libsa/Makefile.inc"
-LIBSA= ${SALIB}
-
-STRIP?=strip
-OBJCOPY?=objcopy
-
-.if ${MACHINE} == "vax"
-.PHONY: machine-links
-beforedepend: machine-links
-machine-links:
- @[ -h machine ] || ln -s ${S}/arch/${MACHINE}/include machine
- @[ -h ${MACHINE_ARCH} ] || ln -s ${S}/arch/${MACHINE_ARCH}/include ${MACHINE_ARCH}
-.NOPATH: machine ${MACHINE_ARCH}
-CLEANFILES+= machine ${MACHINE_ARCH} ${PROG}.out assym.h
-.endif
-
-start.o: assym.h
-
-assym.h: $S/kern/genassym.sh Makefile ${.CURDIR}/genassym.cf
- sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} \
- < ${.CURDIR}/genassym.cf | sort -u > assym.h
-
-${PROG}: ${OBJS} ${LIBSA}
- ${LD} -N -Ttext 100000 -o ${PROG}.out ${OBJS} ${LIBSA}
- ${STRIP} ${PROG}.out
- /usr/bin/size ${PROG}.out
- ${OBJCOPY} -O binary ${PROG}.out ${PROG}
-
-clean::
- rm -f a.out [Ee]rrs mklog *.core ${PROG} ${OBJS} ${LOBJS} \
- ${CLEANFILES}
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/vax/stand/xxboot/bootxx.c b/sys/arch/vax/stand/xxboot/bootxx.c
deleted file mode 100644
index 702376080a0..00000000000
--- a/sys/arch/vax/stand/xxboot/bootxx.c
+++ /dev/null
@@ -1,329 +0,0 @@
-/* $OpenBSD: bootxx.c,v 1.13 2013/07/05 21:13:07 miod Exp $ */
-/* $NetBSD: bootxx.c,v 1.16 2002/03/29 05:45:08 matt Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986 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.
- *
- * @(#)boot.c 7.15 (Berkeley) 5/4/91
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <sys/disklabel.h>
-#include <sys/exec.h>
-#include <sys/exec_elf.h>
-
-#include <lib/libsa/stand.h>
-#include <lib/libsa/ufs.h>
-#include <lib/libsa/cd9660.h>
-
-#include <machine/pte.h>
-#include <machine/sid.h>
-#include <machine/mtpr.h>
-#include <machine/reg.h>
-#include <machine/rpb.h>
-#include <arch/vax/vax/gencons.h>
-
-#define NRSP 1 /* Kludge */
-#define NCMD 1 /* Kludge */
-#define LIBSA_TOO_OLD
-
-#include <arch/vax/mscp/mscp.h>
-#include <arch/vax/mscp/mscpreg.h>
-
-#include "../boot/data.h"
-
-#define RF_PROTECTED_SECTORS 64 /* XXX refer to <.../rf_optnames.h> */
-
-void Xmain(void);
-void hoppabort(int);
-void romread_uvax(int lbn, int size, void *buf, struct rpb *rpb);
-int unit_init(int, struct rpb *, int);
-
-struct open_file file;
-
-unsigned *bootregs;
-struct rpb *rpb;
-struct bqo *bqo;
-int vax_cputype;
-int vax_load_failure;
-struct udadevice {u_short udaip;u_short udasa;};
-volatile struct udadevice *csr;
-static int moved;
-
-extern int from;
-#define FROMMV 2
-#define FROMVMB 4
-
-/*
- * The boot blocks are used by MicroVAX II/III, VS2000,
- * VS3100, VS4000, and only when booting from disk.
- */
-void
-Xmain(void)
-{
- union {
- struct exec aout;
- Elf32_Ehdr elf;
- } hdr;
- int io;
- u_long entry;
-
- vax_cputype = (mfpr(PR_SID) >> 24) & 0xFF;
- moved = 0;
- /*
- */
- rpb = (void *)0xf0000; /* Safe address right now */
- bqo = (void *)0xf1000;
- if (from == FROMMV) {
- /*
- * now relocate rpb/bqo (which are used by ROM-routines)
- */
- bcopy ((void *)bootregs[11], rpb, sizeof(struct rpb));
- bcopy ((void*)rpb->iovec, bqo, rpb->iovecsz);
-#if 0
- if (rpb->devtyp == BDEV_SDN)
- rpb->devtyp = BDEV_SD; /* XXX until driver fixed */
-#endif
- } else {
- bzero(rpb, sizeof(struct rpb));
- rpb->devtyp = bootregs[0];
- rpb->unit = bootregs[3];
- rpb->rpb_bootr5 = bootregs[5];
- rpb->csrphy = bootregs[2];
- rpb->adpphy = bootregs[1]; /* BI node on 8200 */
- }
- rpb->rpb_base = rpb;
- rpb->iovec = (int)bqo;
-
- io = open("/boot.vax", 0);
- if (io < 0)
- io = open("/boot", 0);
- if (io < 0)
- asm("movl $0xbeef1, %r0; halt");
-
- read(io, (void *)&hdr.aout, sizeof(hdr.aout));
- if (N_GETMAGIC(hdr.aout) == OMAGIC && N_GETMID(hdr.aout) == MID_VAX) {
- vax_load_failure++;
- entry = hdr.aout.a_entry;
- if (entry < sizeof(hdr.aout))
- entry = sizeof(hdr.aout);
- read(io, (void *) entry, hdr.aout.a_text + hdr.aout.a_data);
- memset((void *) (entry + hdr.aout.a_text + hdr.aout.a_data),
- 0, hdr.aout.a_bss);
- } else if (memcmp(hdr.elf.e_ident, ELFMAG, SELFMAG) == 0) {
- Elf32_Phdr ph;
- size_t off = sizeof(hdr.elf);
- vax_load_failure += 2;
- read(io, (caddr_t)(&hdr.elf) + sizeof(hdr.aout),
- sizeof(hdr.elf) - sizeof(hdr.aout));
- if (hdr.elf.e_machine != EM_VAX || hdr.elf.e_type != ET_EXEC
- || hdr.elf.e_phnum != 1)
- goto die;
- vax_load_failure++;
- entry = hdr.elf.e_entry;
- if (hdr.elf.e_phoff != sizeof(hdr.elf))
- goto die;
- vax_load_failure++;
- read(io, &ph, sizeof(ph));
- off += sizeof(ph);
- if (ph.p_type != PT_LOAD)
- goto die;
- vax_load_failure++;
- while (off < ph.p_offset) {
- u_int32_t tmp;
- read(io, &tmp, sizeof(tmp));
- off += sizeof(tmp);
- }
- read(io, (void *) ph.p_paddr, ph.p_filesz);
- memset((void *) (ph.p_paddr + ph.p_filesz), 0,
- ph.p_memsz - ph.p_filesz);
- } else {
- goto die;
- }
- hoppabort(entry);
-die:
- asm("movl $0xbeef2, %r0; halt");
-}
-
-/*
- * Write an extremely limited version of a (us)tar filesystem, suitable
- * for loading secondary-stage boot loader.
- * - Can only load file "boot".
- * - Must be the first file on tape.
- */
-struct fs_ops file_system[] = {
-#ifdef NEED_UFS
- { ufs_open, 0, ufs_read, 0, 0, ufs_stat },
-#endif
-#ifdef NEED_CD9660
- { cd9660_open, 0, cd9660_read, 0, 0, cd9660_stat },
-#endif
-#ifdef NEED_USTARFS
- { ustarfs_open, 0, ustarfs_read, 0, 0, ustarfs_stat },
-#endif
-};
-
-int nfsys = (sizeof(file_system) / sizeof(struct fs_ops));
-
-#ifdef LIBSA_TOO_OLD
-#include "../boot/vaxstand.h"
-
-struct rom_softc {
- int part;
- int unit;
-} rom_softc;
-
-int romstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int romopen(struct open_file *, int, int, int, int);
-struct devsw devsw[] = {
- SADEV("rom", romstrategy, romopen, nullsys, noioctl),
-};
-int ndevs = (sizeof(devsw)/sizeof(devsw[0]));
-
-int
-romopen(struct open_file *f, int adapt, int ctlr, int unit, int part)
-{
- rom_softc.unit = unit;
- rom_softc.part = part;
-
- f->f_devdata = (void *)&rom_softc;
-
- return 0;
-}
-
-#endif
-
-int
-devopen(struct open_file *f, const char *fname, char **file)
-{
-
-#ifdef LIBSA_TOO_OLD
- f->f_dev = &devsw[0];
-#endif
- *file = (char *)fname;
-
- /*
- * Reinit the VMB boot device.
- */
- if (bqo->unit_init && (moved++ == 0)) {
- int initfn;
-
- initfn = rpb->iovec + bqo->unit_init;
- if (rpb->devtyp == BDEV_UDA || rpb->devtyp == BDEV_TK) {
- /*
- * This reset do not seem to be done in the
- * ROM routines, so we have to do it manually.
- */
- csr = (struct udadevice *)rpb->csrphy;
- csr->udaip = 0;
- while ((csr->udasa & MP_STEP1) == 0)
- ;
- }
- /*
- * AP (R12) have a pointer to the VMB argument list,
- * wanted by bqo->unit_init.
- */
- unit_init(initfn, rpb, bootregs[12]);
- }
- return 0;
-}
-
-extern struct disklabel romlabel;
-
-int
-romstrategy(sc, func, dblk, size, buf, rsize)
- void *sc;
- int func;
- daddr32_t dblk;
- size_t size;
- void *buf;
- size_t *rsize;
-{
- int block = dblk;
- int nsize = size;
-
- if (romlabel.d_magic == DISKMAGIC && romlabel.d_magic2 == DISKMAGIC) {
- if (romlabel.d_npartitions > 1) {
- block += romlabel.d_partitions[0].p_offset;
- if (romlabel.d_partitions[0].p_fstype == FS_RAID) {
- block += RF_PROTECTED_SECTORS;
- }
- }
- }
-
- romread_uvax(block, size, buf, rpb);
-
- if (rsize)
- *rsize = nsize;
- return 0;
-}
-
-extern char end[];
-static char *top = (char*)end;
-
-void *
-alloc(unsigned int size)
-{
- void *ut = top;
- top += size;
- return ut;
-}
-
-void
-free(void *ptr, unsigned int size)
-{
-}
-
-#ifdef USE_PRINTF
-void
-putchar(int ch)
-{
- /*
- * On KA88 we may get C-S/C-Q from the console.
- * Must obey it.
- */
- while (mfpr(PR_RXCS) & GC_DON) {
- if ((mfpr(PR_RXDB) & 0x7f) == 19) {
- while (1) {
- while ((mfpr(PR_RXCS) & GC_DON) == 0)
- ;
- if ((mfpr(PR_RXDB) & 0x7f) == 17)
- break;
- }
- }
- }
-
- while ((mfpr(PR_TXCS) & GC_RDY) == 0)
- ;
- mtpr(0, PR_TXCS);
- mtpr(ch & 0377, PR_TXDB);
- if (ch == 10)
- putchar(13);
-}
-#endif
diff --git a/sys/arch/vax/stand/xxboot/genassym.cf b/sys/arch/vax/stand/xxboot/genassym.cf
deleted file mode 100644
index da511b58c0d..00000000000
--- a/sys/arch/vax/stand/xxboot/genassym.cf
+++ /dev/null
@@ -1,21 +0,0 @@
-# $OpenBSD: genassym.cf,v 1.1 2011/09/29 18:02:41 miod Exp $
-#
-# Copyright (c) 2011 Miodrag Vallat.
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-include <sys/param.h>
-include <sys/disklabel.h>
-
-struct disklabel
-export LABELOFFSET
diff --git a/sys/arch/vax/stand/xxboot/start.S b/sys/arch/vax/stand/xxboot/start.S
deleted file mode 100644
index 0c0620d4256..00000000000
--- a/sys/arch/vax/stand/xxboot/start.S
+++ /dev/null
@@ -1,199 +0,0 @@
-/* $OpenBSD: start.S,v 1.5 2013/07/05 21:13:07 miod Exp $ */
-/* $NetBSD: start.S,v 1.1 2002/02/24 01:04:26 matt Exp $ */
-/*
- * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by
- * Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
- /* All bugs are subject to removal without further notice */
-
-
-#include "../include/mtpr.h"
-#include "../include/asm.h"
-
-#include "assym.h"
-
-_C_LABEL(_start):
-_C_LABEL(start):
- .globl _C_LABEL(start) # this is the symbolic name for the start
- .globl _C_LABEL(_start) # of code to be relocated. We can use this
- # to get the actual/real address (pc-rel)
- # or to get the relocated address (abs).
-
-.org 0x00 # uVAX booted from TK50 starts here
- brb from_0x00 # continue behind dispatch-block
-
-.org 0x02 # information used by uVAX-ROM
- .byte 0xff # offset in words to identification area
- .byte 1 # this byte must be 1
- .word 0 # logical block number (word swapped)
- .word 0 # of the secondary image
-
-.org 0x08 #
- brb from_0x08 # skip ...
-
-.org 0x0C # 11/750 & 8200 starts here
- halt # not supported
-
-
-from_0x00: # uVAX from TK50
- brw start_uvax # all uVAXen continue there
-
-from_0x08: # Any machine from VMB
- movzbl $4,_C_LABEL(from) # Booted from full VMB
- brw start_vmb
-
-# the complete area reserved for label
-# must be empty (i.e. filled with zeroes).
-# disklabel(8) checks that before installing
-# the bootblocks over existing label.
-
-.org LABELOFFSET
- .globl _C_LABEL(romlabel)
-_C_LABEL(romlabel):
- .long 0
-
-.org LABELOFFSET + DISKLABEL_SIZEOF
-start_vmb:
- /*
- * Read in block 1-15.
- */
- movl 52(%r11), %r7 # load iovec/bqo into %r7
- addl3 (%r7), %r7, %r6 # load qio into %r6
- pushl %r11 # base of rpb
- pushl $0 # virtual-flag
- pushl $33 # read-logical-block
- pushl $1 # lbn to start reading
- pushl $7680 # number of bytes to read
- pushab start_uvax # buffer-address
- calls $6, (%r6) # call the qio-routine
- brw start_uvax
-
-/*
- * Parameter block for uVAX boot.
- */
-#define VOLINFO 0 /* 1=single-sided 81=double-sided volumes */
-#define SISIZE 16 /* size in blocks of secondary image */
-#define SILOAD 0 /* load offset (usually 0) from the default */
-#define SIOFF 0x260 /* byte offset into secondary image */
-
-.org 0x1fe
- .byte 0x18 # must be 0x18
- .byte 0x00 # must be 0x00 (MBZ)
- .byte 0x00 # any value
- .byte 0xFF - (0x18 + 0x00 + 0x00)
- /* 4th byte holds 1s' complement of sum of previous 3 bytes */
-
- .byte 0x00 # must be 0x00 (MBZ)
- .byte VOLINFO
- .byte 0x00 # any value
- .byte 0x00 # any value
-
- .long SISIZE # size in blocks of secondary image
- .long SILOAD # load offset (usually 0)
- .long SIOFF # byte offset into secondary image
- .long (SISIZE + SILOAD + SIOFF) # sum of previous 3
-
-
- .p2align 2
- .globl _C_LABEL(from)
-_C_LABEL(from):
- .long 0
-
-/* uVAX main entry is at the start of the second disk block. This is
- * needed for multi-arch CD booting where multiple architecture need
- * to shove stuff in boot block 0.
- */
- .org 0x260 # uVAX booted from disk starts here
-
-start_uvax:
- movzbl $2,_C_LABEL(from) # Booted from subset-VMB
- brb start_all
-
-/*
- * start_all: stack already at RELOC, we save registers, move ourself
- * to RELOC and loads boot.
- */
-start_all:
- movl $_C_LABEL(start), %sp # move stack to a better
- pushr $0x1fff # save all regs, used later.
-
- subl3 $_C_LABEL(start), $_C_LABEL(edata), %r0
- # get size of text+data (w/o bss)
- moval _C_LABEL(start), %r1 # get actual base-address of code
- subl3 $_C_LABEL(start), $_C_LABEL(end), %r2
- # get complete size (incl. bss)
- movl $_C_LABEL(start), %r3 # get relocated base-address of code
- movc5 %r0, (%r1), $0, %r2, (%r3) # copy code to new location
-
- movpsl -(%sp)
- movl $relocated, -(%sp) # return-address on top of stack
- rei # can be replaced with new address
-relocated: # now relocation is done !!!
- movl %sp, _C_LABEL(bootregs)
- calls $0, _C_LABEL(Xmain) # call Xmain (gcc workaround)which is
- halt # not intended to return ...
-
-/*
- * hoppabort() is called when jumping to the newly loaded program.
- */
-ENTRY(hoppabort, 0)
- movl 4(%ap),%r6
- movl _C_LABEL(rpb),%r11
- mnegl $1,%ap # Hack to figure out boot device.
- movpsl -(%sp)
- pushab 2(%r6)
- mnegl $1,_C_LABEL(vax_load_failure)
- rei
-# calls $0,(%r6)
- halt
-
-ENTRY(unit_init, R6|R7|R8|R9|R10|R11)
- mfpr $17,%r7 # Wanted bu KDB
- movl 4(%ap),%r0 # init routine address
- movl 8(%ap),%r9 # RPB in %r9
- movl 12(%ap),%r1 # VMB argument list
- callg (%r1),(%r0)
- ret
-
-# A bunch of functions unwanted in boot blocks.
-ENTRY(getchar, 0)
- halt
-
-#ifndef USE_PRINTF
-ENTRY(putchar, 0)
- ret
-
-#endif
-
-ENTRY(panic, 0)
- halt
diff --git a/sys/arch/vax/uba/uba_common.h b/sys/arch/vax/uba/uba_common.h
deleted file mode 100644
index 8f7df024270..00000000000
--- a/sys/arch/vax/uba/uba_common.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $OpenBSD: uba_common.h,v 1.6 2015/02/01 15:27:12 miod Exp $ */
-/* $NetBSD: uba_common.h,v 1.2 1999/06/21 16:23:01 ragge Exp $ */
-/*-
- * Copyright (c) 1982, 1986 The Regents of the University of California.
- * All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * 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.
- *
- * @(#)ubareg.h 7.8 (Berkeley) 5/9/91
- */
-
-/*
- * VAX-specific parts of the Unibus softc.
- */
-
-struct uba_vsoftc {
- struct uba_softc uv_sc;/* Common vars from arch/vax/qbus/ubavar.h */
- struct vax_bus_dma_tag uv_dmat;
- struct vax_sgmap uv_sgmap;
- int uv_size; /* Size of UBA addressable memory */
- paddr_t uv_addr; /* Physical address of map registers */
-};
-
-void uba_dma_init(struct uba_vsoftc *);
diff --git a/sys/arch/vax/uba/uba_dma.c b/sys/arch/vax/uba/uba_dma.c
deleted file mode 100644
index 9e735f34e3e..00000000000
--- a/sys/arch/vax/uba/uba_dma.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/* $OpenBSD: uba_dma.c,v 1.5 2008/06/26 05:42:14 ray Exp $ */
-/* $NetBSD: uba_dma.c,v 1.2 1999/06/20 00:59:55 ragge Exp $ */
-
-/*-
- * Copyright (c) 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.
- *
- * 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, SPEUBAL, 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/kernel.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <uvm/uvm_extern.h>
-
-#define _VAX_BUS_DMA_PRIVATE
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/sgmap.h>
-
-#include <arch/vax/qbus/ubavar.h>
-
-#include <arch/vax/uba/uba_common.h>
-
-int uba_bus_dmamap_create_sgmap(bus_dma_tag_t, bus_size_t, int,
- bus_size_t, bus_size_t, int, bus_dmamap_t *);
-
-void uba_bus_dmamap_destroy_sgmap(bus_dma_tag_t, bus_dmamap_t);
-
-int uba_bus_dmamap_load_sgmap(bus_dma_tag_t, bus_dmamap_t, void *,
- bus_size_t, struct proc *, int);
-
-int uba_bus_dmamap_load_mbuf_sgmap(bus_dma_tag_t, bus_dmamap_t,
- struct mbuf *, int);
-
-int uba_bus_dmamap_load_uio_sgmap(bus_dma_tag_t, bus_dmamap_t,
- struct uio *, int);
-
-int uba_bus_dmamap_load_raw_sgmap(bus_dma_tag_t, bus_dmamap_t,
- bus_dma_segment_t *, int, bus_size_t, int);
-
-void uba_bus_dmamap_unload_sgmap(bus_dma_tag_t, bus_dmamap_t);
-
-void uba_bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
- bus_size_t, int);
-
-void
-uba_dma_init(sc)
- struct uba_vsoftc *sc;
-{
- bus_dma_tag_t t;
- pt_entry_t *pte;
-
- /*
- * Initialize the DMA tag used for sgmap-mapped DMA.
- */
- t = &sc->uv_dmat;
- t->_cookie = sc;
- t->_wbase = 0;
- t->_wsize = sc->uv_size;
- t->_boundary = 0;
- t->_sgmap = &sc->uv_sgmap;
- t->_dmamap_create = uba_bus_dmamap_create_sgmap;
- t->_dmamap_destroy = uba_bus_dmamap_destroy_sgmap;
- t->_dmamap_load = uba_bus_dmamap_load_sgmap;
- t->_dmamap_load_mbuf = uba_bus_dmamap_load_mbuf_sgmap;
- t->_dmamap_load_uio = uba_bus_dmamap_load_uio_sgmap;
- t->_dmamap_load_raw = uba_bus_dmamap_load_raw_sgmap;
- t->_dmamap_unload = uba_bus_dmamap_unload_sgmap;
- t->_dmamap_sync = uba_bus_dmamap_sync;
-
- t->_dmamem_alloc = _bus_dmamem_alloc;
- t->_dmamem_free = _bus_dmamem_free;
- t->_dmamem_map = _bus_dmamem_map;
- t->_dmamem_unmap = _bus_dmamem_unmap;
- t->_dmamem_mmap = _bus_dmamem_mmap;
-
- /*
- * Map in Unibus map registers.
- */
- pte = (pt_entry_t *)vax_map_physmem(sc->uv_addr, sc->uv_size/VAX_NBPG);
- if (pte == NULL)
- panic("uba_dma_init");
- /*
- * Initialize the SGMAP.
- */
- vax_sgmap_init(t, &sc->uv_sgmap, "uba_sgmap", 0, sc->uv_size, pte, 0);
-
-}
-
-/*
- * Create a UBA SGMAP-mapped DMA map.
- */
-int
-uba_bus_dmamap_create_sgmap(t, size, nsegments, maxsegsz, boundary,
- flags, dmamp)
- bus_dma_tag_t t;
- bus_size_t size;
- int nsegments;
- bus_size_t maxsegsz;
- bus_size_t boundary;
- int flags;
- bus_dmamap_t *dmamp;
-{
- bus_dmamap_t map;
- int error;
-
- error = _bus_dmamap_create(t, size, nsegments, maxsegsz,
- boundary, flags, dmamp);
- if (error)
- return (error);
-
- map = *dmamp;
-
- if (flags & BUS_DMA_ALLOCNOW) {
- error = vax_sgmap_alloc(map, vax_round_page(size),
- t->_sgmap, flags);
- if (error)
- uba_bus_dmamap_destroy_sgmap(t, map);
- }
-
- return (error);
-}
-
-/*
- * Destroy a UBA SGMAP-mapped DMA map.
- */
-void
-uba_bus_dmamap_destroy_sgmap(t, map)
- bus_dma_tag_t t;
- bus_dmamap_t map;
-{
-
- if (map->_dm_flags & DMAMAP_HAS_SGMAP)
- vax_sgmap_free(map, t->_sgmap);
-
- _bus_dmamap_destroy(t, map);
-}
-
-/*
- * Load a UBA SGMAP-mapped DMA map with a linear buffer.
- */
-int
-uba_bus_dmamap_load_sgmap(t, map, buf, buflen, p, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- void *buf;
- bus_size_t buflen;
- struct proc *p;
- int flags;
-{
- int error;
-
- error = vax_sgmap_load(t, map, buf, buflen, p, flags, t->_sgmap);
- /*
- * XXX - Set up BDPs.
- */
-
- return (error);
-}
-
-/*
- * Load a UBA SGMAP-mapped DMA map with an mbuf chain.
- */
-int
-uba_bus_dmamap_load_mbuf_sgmap(t, map, m, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- struct mbuf *m;
- int flags;
-{
- int error;
-
- error = vax_sgmap_load_mbuf(t, map, m, flags, t->_sgmap);
-
- return (error);
-}
-
-/*
- * Load a UBA SGMAP-mapped DMA map with a uio.
- */
-int
-uba_bus_dmamap_load_uio_sgmap(t, map, uio, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- struct uio *uio;
- int flags;
-{
- int error;
-
- error = vax_sgmap_load_uio(t, map, uio, flags, t->_sgmap);
-
- return (error);
-}
-
-/*
- * Load a UBA SGMAP-mapped DMA map with raw memory.
- */
-int
-uba_bus_dmamap_load_raw_sgmap(t, map, segs, nsegs, size, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- bus_dma_segment_t *segs;
- int nsegs;
- bus_size_t size;
- int flags;
-{
- int error;
-
- error = vax_sgmap_load_raw(t, map, segs, nsegs, size, flags,
- t->_sgmap);
-
- return (error);
-}
-
-/*
- * Unload a UBA DMA map.
- */
-void
-uba_bus_dmamap_unload_sgmap(t, map)
- bus_dma_tag_t t;
- bus_dmamap_t map;
-{
-
- /*
- * Invalidate any SGMAP page table entries used by this
- * mapping.
- */
- vax_sgmap_unload(t, map, t->_sgmap);
-
- /*
- * Do the generic bits of the unload.
- */
- _bus_dmamap_unload(t, map);
-}
-
-/*
- * Sync the bus map. This is only needed if BDP's are used.
- */
-void
-uba_bus_dmamap_sync(tag, dmam, offset, len, ops)
- bus_dma_tag_t tag;
- bus_dmamap_t dmam;
- bus_addr_t offset;
- bus_size_t len;
- int ops;
-{
- /* Only BDP handling, but not yet. */
-}
diff --git a/sys/arch/vax/uba/uba_ibus.c b/sys/arch/vax/uba/uba_ibus.c
deleted file mode 100644
index d8dc289d877..00000000000
--- a/sys/arch/vax/uba/uba_ibus.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $OpenBSD: uba_ibus.c,v 1.4 2015/02/01 15:27:12 miod Exp $ */
-/* $NetBSD: uba_ibus.c,v 1.1 1999/08/07 10:36:47 ragge Exp $ */
-/*
- * Copyright (c) 1996 Jonathan Stone.
- * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
- * Copyright (c) 1982, 1986 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.
- *
- * @(#)uba.c 7.10 (Berkeley) 12/16/90
- * @(#)autoconf.c 7.20 (Berkeley) 5/9/91
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-
-#define _VAX_BUS_DMA_PRIVATE
-#include <machine/bus.h>
-#include <machine/mtpr.h>
-#include <machine/nexus.h>
-#include <machine/cpu.h>
-#include <machine/sgmap.h>
-
-#include <arch/vax/uba/ubareg.h>
-#include <arch/vax/qbus/ubavar.h>
-#include <arch/vax/uba/uba_common.h>
-
-/*
- * The Q22 bus is the main IO bus on MicroVAX II/MicroVAX III systems.
- * It has an address space of 4MB (22 address bits), therefore the name,
- * and is hardware compatible with all 16 and 18 bits Q-bus devices.
- */
-static int qba_match(struct device *, struct cfdata *, void *);
-static void qba_attach(struct device *, struct device *, void *);
-static void qba_beforescan(struct uba_softc*);
-static void qba_init(struct uba_softc*);
-
-struct cfattach uba_ibus_ca = {
- sizeof(struct uba_vsoftc), (cfmatch_t)qba_match, qba_attach
-};
-
-extern struct vax_bus_space vax_mem_bus_space;
-
-int
-qba_match(parent, vcf, aux)
- struct device *parent;
- struct cfdata *vcf;
- void *aux;
-{
- struct bp_conf *bp = aux;
-
- if (strcmp(bp->type, "uba"))
- return 0;
-
- return 1;
-}
-
-void
-qba_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct uba_vsoftc *sc = (void *)self;
-
- printf(": Q22\n");
- /*
- * Fill in bus specific data.
- */
- sc->uv_sc.uh_beforescan = qba_beforescan;
- sc->uv_sc.uh_ubainit = qba_init;
- sc->uv_sc.uh_iot = &vax_mem_bus_space;
- sc->uv_sc.uh_dmat = &sc->uv_dmat;
-
- /*
- * Fill in variables used by the sgmap system.
- */
- sc->uv_size = QBASIZE; /* Size in bytes of Qbus space */
- sc->uv_addr = QBAMAP; /* Physical address of map registers */
-
- uba_dma_init(sc);
- uba_attach(&sc->uv_sc, QIOPAGE);
-}
-
-/*
- * Called when the QBA is set up; to enable DMA access from
- * QBA devices to main memory.
- */
-void
-qba_beforescan(sc)
- struct uba_softc *sc;
-{
- bus_space_write_2(sc->uh_tag, sc->uh_ioh, QIPCR, Q_LMEAE);
-}
-
-void
-qba_init(sc)
- struct uba_softc *sc;
-{
- mtpr(0, PR_IUR);
- DELAY(500000);
- qba_beforescan(sc);
-}
diff --git a/sys/arch/vax/uba/ubareg.h b/sys/arch/vax/uba/ubareg.h
deleted file mode 100644
index 66ed70d2c26..00000000000
--- a/sys/arch/vax/uba/ubareg.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $OpenBSD: ubareg.h,v 1.15 2015/02/01 15:27:12 miod Exp $ */
-/* $NetBSD: ubareg.h,v 1.11 2000/01/24 02:40:36 matt Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986 The Regents of the University of California.
- * All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * 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.
- *
- * @(#)ubareg.h 7.8 (Berkeley) 5/9/91
- */
-
-/*
- * VAX UNIBUS adapter registers
- */
-
-/*
- * Size of unibus memory address space in pages
- * (also number of map registers).
- */
-#define UBAPAGES 496
-#define UBAIOADDR 0760000 /* start of I/O page */
-#define UBAIOPAGES 16
-#define UBAIOSIZE (UBAIOPAGES * VAX_NBPG) /* 8K I/O space */
-
-/* Some Qbus-specific defines */
-#define QBAPAGES 8192
-#define QBASIZE (QBAPAGES * VAX_NBPG)
-#define QBAMAP 0x20088000
-#define QIOPAGE 0x20000000
-
-/*
- * Q-bus control registers
- */
-#define QIPCR 0x1f40 /* from start of iopage */
-/* bits in QIPCR */
-#define Q_DBIRQ 0x0001 /* doorbell interrupt request */
-#define Q_LMEAE 0x0020 /* local mem external access enable */
-#define Q_DBIIE 0x0040 /* doorbell interrupt enable */
-#define Q_AUXHLT 0x0100 /* auxiliary processor halt */
-#define Q_DMAQPE 0x8000 /* Q22 bus address space parity error */
diff --git a/sys/arch/vax/vax/autoconf.c b/sys/arch/vax/vax/autoconf.c
deleted file mode 100644
index 8d58d0405be..00000000000
--- a/sys/arch/vax/vax/autoconf.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/* $OpenBSD: autoconf.c,v 1.40 2015/07/04 10:27:05 dlg Exp $ */
-/* $NetBSD: autoconf.c,v 1.45 1999/10/23 14:56:05 ragge Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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/types.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/reboot.h>
-#include <sys/disklabel.h>
-#include <sys/conf.h>
-#include <sys/buf.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/cpu.h>
-#include <machine/sid.h>
-#include <machine/vmparam.h>
-#include <machine/nexus.h>
-#include <machine/clock.h>
-#include <machine/rpb.h>
-#ifdef VAX60
-#include <vax/mbus/mbusreg.h>
-#endif
-
-#include <dev/cons.h>
-
-#include "led.h"
-
-#include <vax/vax/gencons.h>
-
-void dumpconf(void); /* machdep.c */
-
-struct cpu_dep *dep_call;
-
-int mastercpu; /* chief of the system */
-
-struct device *bootdv;
-int booted_partition; /* defaults to 0 (aka 'a' partition) */
-
-void
-cpu_configure(void)
-{
- softintr_init();
-
- if (config_rootfound("mainbus", NULL) == NULL)
- panic("mainbus not configured");
-
- /*
- * We're ready to start up. Clear CPU cold start flag.
- */
- cold = 0;
-
- if (dep_call->cpu_clrf)
- (*dep_call->cpu_clrf)();
-}
-
-void
-diskconf(void)
-{
- if (bootdv == NULL)
- printf("boot device: unknown (rpb %d/%d)\n",
- rpb.devtyp, rpb.unit);
- else
- printf("boot device: %s\n", bootdv->dv_xname);
-
- setroot(bootdv, booted_partition, RB_USERREQ);
- dumpconf();
-}
-
-int mainbus_print(void *, const char *);
-int mainbus_match(struct device *, struct cfdata *, void *);
-void mainbus_attach(struct device *, struct device *, void *);
-
-int
-mainbus_print(void *aux, const char *hej)
-{
- struct mainbus_attach_args *maa = aux;
-
- if (maa->maa_bustype == VAX_LEDS)
- return (QUIET);
-
- if (hej) {
- printf("nothing at %s", hej);
- }
- return (UNCONF);
-}
-
-int
-mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
-{
- if (cf->cf_unit == 0 &&
- strcmp(cf->cf_driver->cd_name, "mainbus") == 0)
- return 1; /* First (and only) mainbus */
-
- return (0);
-}
-
-void
-mainbus_attach(struct device *parent, struct device *self, void *hej)
-{
- struct mainbus_attach_args maa;
-
- printf("\n");
-
- maa.maa_bustype = vax_bustype;
- config_found(self, &maa, mainbus_print);
-
-#if VAX53
- /* These models have both vsbus and ibus */
- if (vax_boardtype == VAX_BTYP_1303) {
- maa.maa_bustype = VAX_VSBUS;
- config_found(self, &maa, mainbus_print);
- }
-#endif
-
-#if NLED > 0
- maa.maa_bustype = VAX_LEDS;
- config_found(self, &maa, mainbus_print);
-#endif
-
-#if 1 /* boot blocks too old */
- if (rpb.rpb_base == (void *)-1)
- printf("\nWARNING: you must update your boot blocks.\n\n");
-#endif
-
-}
-
-struct cfattach mainbus_ca = {
- sizeof(struct device), (cfmatch_t) mainbus_match, mainbus_attach
-};
-
-struct cfdriver mainbus_cd = {
- NULL, "mainbus", DV_DULL
-};
-
-#include "sd.h"
-#include "cd.h"
-#include "ra.h"
-
-static int ubtest(void *);
-static int jmfr(char *, struct device *, int);
-static int booted_qe(struct device *, void *);
-static int booted_le(struct device *, void *);
-static int booted_ze(struct device *, void *);
-static int booted_de(struct device *, void *);
-#if NSD > 0 || NCD > 0
-static int booted_sd(struct device *, void *);
-#endif
-#if NRA
-static int booted_ra(struct device *, void *);
-#endif
-#if NRD
-static int booted_rd(struct device *, void *);
-#endif
-
-int (*devreg[])(struct device *, void *) = {
- booted_qe,
- booted_le,
- booted_ze,
- booted_de,
-#if NSD > 0 || NCD > 0
- booted_sd,
-#endif
-#if NRA
- booted_ra,
-#endif
-#if NRD
- booted_hd,
-#endif
- 0,
-};
-
-void
-device_register(struct device *dev, void *aux)
-{
- int (**dp)(struct device *, void *) = devreg;
-
- /* If there's a synthetic RPB, we can't trust it */
- if (rpb.rpb_base == (void *)-1)
- return;
-
- while (*dp) {
- if ((*dp)(dev, aux)) {
- if (bootdv == NULL)
- bootdv = dev;
- break;
- }
- dp++;
- }
-}
-
-/*
- * Simple checks. Return 1 on fail.
- */
-int
-jmfr(char *n, struct device *dev, int nr)
-{
- if (rpb.devtyp != nr)
- return 1;
- return strcmp(n, dev->dv_cfdata->cf_driver->cd_name);
-}
-
-#include <arch/vax/qbus/ubavar.h>
-int
-ubtest(void *aux)
-{
- paddr_t p;
-
- p = kvtophys(((struct uba_attach_args *)aux)->ua_ioh);
- if (rpb.csrphy != p)
- return 1;
- return 0;
-}
-
-#if 1 /* NDE */
-int
-booted_de(struct device *dev, void *aux)
-{
-
- if (jmfr("de", dev, BDEV_DE) || ubtest(aux))
- return 0;
-
- return 1;
-}
-#endif /* NDE */
-
-int
-booted_le(struct device *dev, void *aux)
-{
- if (jmfr("le", dev, BDEV_LE))
- return 0;
- return 1;
-}
-
-int
-booted_ze(struct device *dev, void *aux)
-{
- if (jmfr("ze", dev, BDEV_ZE))
- return 0;
- return 1;
-}
-
-#if 1 /* NQE */
-int
-booted_qe(struct device *dev, void *aux)
-{
- if (jmfr("qe", dev, BDEV_QE) || ubtest(aux))
- return 0;
-
- return 1;
-}
-#endif /* NQE */
-
-#if NSD > 0 || NCD > 0
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-int
-booted_sd(struct device *dev, void *aux)
-{
- struct scsi_attach_args *sa = aux;
- struct device *ppdev;
-
- /* Is this a SCSI device? */
- if (jmfr("sd", dev, BDEV_SD) && jmfr("cd", dev, BDEV_SD) &&
- jmfr("sd", dev, BDEV_SDN) && jmfr("cd", dev, BDEV_SDN) &&
- jmfr("sd", dev, BDEV_SDS) && jmfr("cd", dev, BDEV_SDS))
- return 0;
-
- if (sa->sa_sc_link->target != rpb.unit)
- return 0; /* Wrong unit */
-
- ppdev = dev->dv_parent->dv_parent;
-
- /* VS3100 NCR 53C80 (si) & VS4000 NCR 53C94 (asc) */
- if (((jmfr("ncr", ppdev, BDEV_SD) == 0) || /* old name */
- (jmfr("asc", ppdev, BDEV_SD) == 0) ||
- (jmfr("asc", ppdev, BDEV_SDN) == 0)) &&
- (ppdev->dv_cfdata->cf_loc[0] == rpb.csrphy))
- return 1;
-
-#ifdef VAX60
- /* VS35x0 (sii) */
- if (jmfr("sii", ppdev, BDEV_SDS) == 0 && rpb.csrphy ==
- MBUS_SLOT_BASE(ppdev->dv_parent->dv_cfdata->cf_loc[0]))
- return 1;
-#endif
-
- return 0; /* Where did we come from??? */
-}
-#endif
-
-#if NRA
-#include <arch/vax/mscp/mscp.h>
-#include <arch/vax/mscp/mscpreg.h>
-#include <arch/vax/mscp/mscpvar.h>
-int
-booted_ra(struct device *dev, void *aux)
-{
- struct drive_attach_args *da = aux;
- struct mscp_softc *pdev = (void *)dev->dv_parent;
- paddr_t ioaddr;
-
- if (jmfr("ra", dev, BDEV_UDA))
- return 0;
-
- if (da->da_mp->mscp_unit != rpb.unit)
- return 0; /* Wrong unit number */
-
- ioaddr = kvtophys(pdev->mi_iph); /* Get phys addr of CSR */
- if (rpb.devtyp == BDEV_UDA && rpb.csrphy == ioaddr)
- return 1; /* Did match CSR */
-
- return 0;
-}
-#endif
-#if NHD
-int
-booted_hd(struct device *dev, void *aux)
-{
- int *nr = aux; /* XXX - use the correct attach struct */
-
- if (jmfr("hd", dev, BDEV_RD))
- return 0;
-
- if (*nr != rpb.unit)
- return 0;
-
- return 1;
-}
-#endif
-
-struct nam2blk nam2blk[] = {
- { "ra", 9 },
- { "rx", 12 },
- { "hd", 19 },
- { "sd", 20 },
- { "cd", 22 },
- { "rd", 23 },
- { "raid", 25 },
- { "vnd", 18 },
- { NULL, -1 }
-};
diff --git a/sys/arch/vax/vax/bus_dma.c b/sys/arch/vax/vax/bus_dma.c
deleted file mode 100644
index f9661503e1a..00000000000
--- a/sys/arch/vax/vax/bus_dma.c
+++ /dev/null
@@ -1,782 +0,0 @@
-/* $OpenBSD: bus_dma.c,v 1.32 2014/12/23 21:39:12 miod Exp $ */
-/* $NetBSD: bus_dma.c,v 1.5 1999/11/13 00:32:20 thorpej 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.
- *
- * 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.
- */
-/*
- * bus_dma routines for vax. File copied from arm32/bus_dma.c.
- * NetBSD: bus_dma.c,v 1.11 1998/09/21 22:53:35 thorpej Exp
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/buf.h>
-#include <sys/reboot.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/vnode.h>
-#include <sys/device.h>
-
-#include <uvm/uvm_extern.h>
-
-#define _VAX_BUS_DMA_PRIVATE
-#include <machine/bus.h>
-
-#include <machine/ka43.h>
-#include <machine/sid.h>
-
-extern vaddr_t virtual_avail;
-
-int _bus_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,
- bus_size_t, struct proc *, int, paddr_t *, int *, int);
-int _bus_dma_inrange(bus_dma_segment_t *, int, bus_addr_t);
-int _bus_dmamem_alloc_range(bus_dma_tag_t, bus_size_t, bus_size_t,
- bus_size_t, bus_dma_segment_t*, int, int *, int, vaddr_t, vaddr_t);
-/*
- * Common function for DMA map creation. May be called by bus-specific
- * DMA map creation functions.
- */
-int
-_bus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
- bus_dma_tag_t t;
- bus_size_t size;
- int nsegments;
- bus_size_t maxsegsz;
- bus_size_t boundary;
- int flags;
- bus_dmamap_t *dmamp;
-{
- struct vax_bus_dmamap *map;
- void *mapstore;
- size_t mapsize;
-
-#ifdef DEBUG_DMA
- printf("dmamap_create: t=%p size=%lx nseg=%x msegsz=%lx boundary=%lx flags=%x\n",
- t, size, nsegments, maxsegsz, boundary, flags);
-#endif /* DEBUG_DMA */
-
- /*
- * Allocate and initialize the DMA map. The end of the map
- * is a variable-sized array of segments, so we allocate enough
- * room for them in one shot.
- *
- * Note we don't preserve the WAITOK or NOWAIT flags. Preservation
- * of ALLOCNOW notifies others that we've reserved these resources,
- * and they are not to be freed.
- *
- * The bus_dmamap_t includes one bus_dma_segment_t, hence
- * the (nsegments - 1).
- */
- mapsize = sizeof(struct vax_bus_dmamap) +
- (sizeof(bus_dma_segment_t) * (nsegments - 1));
- if ((mapstore = malloc(mapsize, M_DEVBUF, (flags & BUS_DMA_NOWAIT) ?
- (M_NOWAIT | M_ZERO) : (M_WAITOK | M_ZERO))) == NULL)
- return (ENOMEM);
-
- map = (struct vax_bus_dmamap *)mapstore;
- map->_dm_size = size;
- map->_dm_segcnt = nsegments;
- map->_dm_maxsegsz = maxsegsz;
- map->_dm_boundary = boundary;
- map->_dm_flags = flags & ~(BUS_DMA_WAITOK|BUS_DMA_NOWAIT);
- map->dm_mapsize = 0; /* no valid mappings */
- map->dm_nsegs = 0;
-
- *dmamp = map;
-#ifdef DEBUG_DMA
- printf("dmamap_create:map=%p\n", map);
-#endif /* DEBUG_DMA */
- return (0);
-}
-
-/*
- * Common function for DMA map destruction. May be called by bus-specific
- * DMA map destruction functions.
- */
-void
-_bus_dmamap_destroy(t, map)
- bus_dma_tag_t t;
- bus_dmamap_t map;
-{
- size_t mapsize;
-
-#ifdef DEBUG_DMA
- printf("dmamap_destroy: t=%p map=%p\n", t, map);
-#endif /* DEBUG_DMA */
-#ifdef DIAGNOSTIC
- if (map->dm_nsegs > 0)
- printf("bus_dmamap_destroy() called for map with valid mappings\n");
-#endif /* DIAGNOSTIC */
- mapsize = sizeof(struct vax_bus_dmamap) +
- (sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1));
- free(map, M_DEVBUF, mapsize);
-}
-
-/*
- * Common function for loading a DMA map with a linear buffer. May
- * be called by bus-specific DMA map load functions.
- */
-int
-_bus_dmamap_load(t, map, buf, buflen, p, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- void *buf;
- bus_size_t buflen;
- struct proc *p;
- int flags;
-{
- paddr_t lastaddr;
- int seg, error;
-
-#ifdef DEBUG_DMA
- printf("dmamap_load: t=%p map=%p buf=%p len=%lx p=%p f=%d\n",
- t, map, buf, buflen, p, flags);
-#endif /* DEBUG_DMA */
-
- /*
- * Make sure that on error condition we return "no valid mappings".
- */
- map->dm_mapsize = 0;
- map->dm_nsegs = 0;
-
- if (buflen > map->_dm_size)
- return (EINVAL);
-
- seg = 0;
- error = _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags,
- &lastaddr, &seg, 1);
- if (error == 0) {
- map->dm_mapsize = buflen;
- map->dm_nsegs = seg + 1;
- }
-#ifdef DEBUG_DMA
- printf("dmamap_load: error=%d\n", error);
-#endif /* DEBUG_DMA */
- return (error);
-}
-
-/*
- * Like _bus_dmamap_load(), but for mbufs.
- */
-int
-_bus_dmamap_load_mbuf(t, map, m0, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- struct mbuf *m0;
- int flags;
-{
- paddr_t lastaddr;
- int seg, error, first;
- struct mbuf *m;
-
-#ifdef DEBUG_DMA
- printf("dmamap_load_mbuf: t=%p map=%p m0=%p f=%d\n",
- t, map, m0, flags);
-#endif /* DEBUG_DMA */
-
- /*
- * Make sure that on error condition we return "no valid mappings."
- */
- map->dm_mapsize = 0;
- map->dm_nsegs = 0;
-
-#ifdef DIAGNOSTIC
- if ((m0->m_flags & M_PKTHDR) == 0)
- panic("_bus_dmamap_load_mbuf: no packet header");
-#endif /* DIAGNOSTIC */
-
- if (m0->m_pkthdr.len > map->_dm_size)
- return (EINVAL);
-
- first = 1;
- seg = 0;
- error = 0;
- for (m = m0; m != NULL && error == 0; m = m->m_next) {
- if (m->m_len == 0)
- continue;
- error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
- NULL, flags, &lastaddr, &seg, first);
- first = 0;
- }
- if (error == 0) {
- map->dm_mapsize = m0->m_pkthdr.len;
- map->dm_nsegs = seg + 1;
- }
-#ifdef DEBUG_DMA
- printf("dmamap_load_mbuf: error=%d\n", error);
-#endif /* DEBUG_DMA */
- return (error);
-}
-
-/*
- * Like _bus_dmamap_load(), but for uios.
- */
-int
-_bus_dmamap_load_uio(t, map, uio, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- struct uio *uio;
- int flags;
-{
- paddr_t lastaddr;
- int seg, i, error, first;
- bus_size_t minlen, resid;
- struct proc *p = NULL;
- struct iovec *iov;
- caddr_t addr;
-
- /*
- * Make sure that on error condition we return "no valid mappings."
- */
- map->dm_mapsize = 0;
- map->dm_nsegs = 0;
-
- resid = uio->uio_resid;
- iov = uio->uio_iov;
-
- if (uio->uio_segflg == UIO_USERSPACE) {
- p = uio->uio_procp;
-#ifdef DIAGNOSTIC
- if (p == NULL)
- panic("_bus_dmamap_load_uio: USERSPACE but no proc");
-#endif
- }
-
- first = 1;
- seg = 0;
- error = 0;
- for (i = 0; i < uio->uio_iovcnt && resid != 0 && error == 0; i++) {
- /*
- * Now at the first iovec to load. Load each iovec
- * until we have exhausted the residual count.
- */
- minlen = resid < iov[i].iov_len ? resid : iov[i].iov_len;
- addr = (caddr_t)iov[i].iov_base;
-
- error = _bus_dmamap_load_buffer(t, map, addr, minlen,
- p, flags, &lastaddr, &seg, first);
- first = 0;
-
- resid -= minlen;
- }
- if (error == 0) {
- map->dm_mapsize = uio->uio_resid;
- map->dm_nsegs = seg + 1;
- }
- return (error);
-}
-
-/*
- * Like _bus_dmamap_load(), but for raw memory allocated with
- * bus_dmamem_alloc().
- */
-int
-_bus_dmamap_load_raw(t, map, segs, nsegs, size, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- bus_dma_segment_t *segs;
- int nsegs;
- bus_size_t size;
- int flags;
-{
-
- panic("_bus_dmamap_load_raw: not implemented");
-}
-
-/*
- * Common function for unloading a DMA map. May be called by
- * bus-specific DMA map unload functions.
- */
-void
-_bus_dmamap_unload(t, map)
- bus_dma_tag_t t;
- bus_dmamap_t map;
-{
-
-#ifdef DEBUG_DMA
- printf("dmamap_unload: t=%p map=%p\n", t, map);
-#endif /* DEBUG_DMA */
-
- /*
- * No resources to free; just mark the mappings as
- * invalid.
- */
- map->dm_mapsize = 0;
- map->dm_nsegs = 0;
-}
-
-/*
- * Common function for DMA map synchronization. May be called
- * by bus-specific DMA map synchronization functions.
- */
-void
-_bus_dmamap_sync(t, map, offset, len, ops)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- bus_addr_t offset;
- bus_size_t len;
- int ops;
-{
-#ifdef DEBUG_DMA
- printf("dmamap_sync: t=%p map=%p offset=%lx len=%lx ops=%x\n",
- t, map, offset, len, ops);
-#endif /* DEBUG_DMA */
- /*
- * A vax only has snoop-cache, so this routine is a no-op.
- */
- return;
-}
-
-/*
- * Common function for DMA-safe memory allocation. May be called
- * by bus-specific DMA memory allocation functions.
- */
-
-int
-_bus_dmamem_alloc(t, size, alignment, boundary, segs, nsegs, rsegs, flags)
- bus_dma_tag_t t;
- bus_size_t size, alignment, boundary;
- bus_dma_segment_t *segs;
- int nsegs;
- int *rsegs;
- int flags;
-{
- int error;
-
- error = _bus_dmamem_alloc_range(t, size, alignment, boundary,
- segs, nsegs, rsegs, flags, 0, -1);
- return(error);
-}
-
-/*
- * Common function for freeing DMA-safe memory. May be called by
- * bus-specific DMA memory free functions.
- */
-void
-_bus_dmamem_free(t, segs, nsegs)
- bus_dma_tag_t t;
- bus_dma_segment_t *segs;
- int nsegs;
-{
- struct vm_page *m;
- bus_addr_t addr;
- struct pglist mlist;
- int curseg;
-
-#ifdef DEBUG_DMA
- printf("dmamem_free: t=%p segs=%p nsegs=%x\n", t, segs, nsegs);
-#endif /* DEBUG_DMA */
-
- /*
- * Build a list of pages to free back to the VM system.
- */
- TAILQ_INIT(&mlist);
- for (curseg = 0; curseg < nsegs; curseg++) {
- for (addr = segs[curseg].ds_addr;
- addr < (segs[curseg].ds_addr + segs[curseg].ds_len);
- addr += PAGE_SIZE) {
- m = PHYS_TO_VM_PAGE(addr);
- TAILQ_INSERT_TAIL(&mlist, m, pageq);
- }
- }
- uvm_pglistfree(&mlist);
-}
-
-/*
- * Common function for mapping DMA-safe memory. May be called by
- * bus-specific DMA memory map functions.
- */
-int
-_bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
- bus_dma_tag_t t;
- bus_dma_segment_t *segs;
- int nsegs;
- size_t size;
- caddr_t *kvap;
- int flags;
-{
- vaddr_t va, sva;
- size_t ssize;
- bus_addr_t addr;
- int curseg, error;
- const struct kmem_dyn_mode *kd;
-
- /*
- * Special case (but common):
- * If there is only one physical segment then the already-mapped
- * virtual address is returned, since all physical memory is already
- * in the beginning of kernel virtual memory.
- */
- if (nsegs == 1) {
- *kvap = (caddr_t)(segs[0].ds_addr | KERNBASE);
- /*
- * KA43 (3100/m76) must have its DMA-safe memory accessed
- * through DIAGMEM. Remap it here.
- */
- if (vax_boardtype == VAX_BTYP_43) {
- pmap_map((vaddr_t)*kvap, segs[0].ds_addr|KA43_DIAGMEM,
- (segs[0].ds_addr|KA43_DIAGMEM) + size,
- PROT_READ | PROT_WRITE);
- }
- return 0;
- }
- size = round_page(size);
- kd = flags & BUS_DMA_NOWAIT ? &kd_trylock : &kd_waitok;
- va = (vaddr_t)km_alloc(size, &kv_any, &kp_none, kd);
- if (va == 0)
- return (ENOMEM);
-
- *kvap = (caddr_t)va;
-
- sva = va;
- ssize = size;
- for (curseg = 0; curseg < nsegs; curseg++) {
- for (addr = segs[curseg].ds_addr;
- addr < (segs[curseg].ds_addr + segs[curseg].ds_len);
- addr += NBPG, va += NBPG, size -= NBPG) {
- if (size == 0)
- panic("_bus_dmamem_map: size botch");
- if (vax_boardtype == VAX_BTYP_43)
- addr |= KA43_DIAGMEM;
- error = pmap_enter(pmap_kernel(), va, addr,
- PROT_READ | PROT_WRITE,
- PROT_READ | PROT_WRITE | PMAP_WIRED | PMAP_CANFAIL);
- if (error) {
- pmap_update(pmap_kernel());
- km_free((void *)sva, ssize, &kv_any, &kp_none);
- return (error);
- }
- }
- }
- pmap_update(pmap_kernel());
- return (0);
-}
-
-/*
- * Common function for unmapping DMA-safe memory. May be called by
- * bus-specific DMA memory unmapping functions.
- */
-void
-_bus_dmamem_unmap(t, kva, size)
- bus_dma_tag_t t;
- caddr_t kva;
- size_t size;
-{
-
-#ifdef DEBUG_DMA
- printf("dmamem_unmap: t=%p kva=%p size=%x\n", t, kva, size);
-#endif /* DEBUG_DMA */
-#ifdef DIAGNOSTIC
- if ((u_long)kva & PGOFSET)
- panic("_bus_dmamem_unmap");
-#endif /* DIAGNOSTIC */
-
- /* Avoid free'ing if not mapped */
- if (kva >= (caddr_t)virtual_avail)
- km_free(kva, round_page(size), &kv_any, &kp_none);
-}
-
-/*
- * Common function for mmap(2)'ing DMA-safe memory. May be called by
- * bus-specific DMA mmap(2)'ing functions.
- */
-paddr_t
-_bus_dmamem_mmap(t, segs, nsegs, off, prot, flags)
- bus_dma_tag_t t;
- bus_dma_segment_t *segs;
- int nsegs;
- off_t off;
- int prot, flags;
-{
- int i;
-
- for (i = 0; i < nsegs; i++) {
-#ifdef DIAGNOSTIC
- if (off & PGOFSET)
- panic("_bus_dmamem_mmap: offset unaligned");
- if (segs[i].ds_addr & PGOFSET)
- panic("_bus_dmamem_mmap: segment unaligned");
- if (segs[i].ds_len & PGOFSET)
- panic("_bus_dmamem_mmap: segment size not multiple"
- " of page size");
-#endif /* DIAGNOSTIC */
- if (off >= segs[i].ds_len) {
- off -= segs[i].ds_len;
- continue;
- }
-
- return (segs[i].ds_addr + off);
- }
-
- /* Page not found. */
- return (-1);
-}
-
-/**********************************************************************
- * DMA utility functions
- **********************************************************************/
-
-/*
- * Utility function to load a linear buffer. lastaddrp holds state
- * between invocations (for multiple-buffer loads). segp contains
- * the starting segment on entrance, and the ending segment on exit.
- * first indicates if this is the first invocation of this function.
- */
-int
-_bus_dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- void *buf;
- bus_size_t buflen;
- struct proc *p;
- int flags;
- paddr_t *lastaddrp;
- int *segp;
- int first;
-{
- bus_size_t sgsize;
- bus_addr_t curaddr, lastaddr, baddr, bmask;
- vaddr_t vaddr = (vaddr_t)buf;
- int seg;
- pmap_t pmap;
-
-#ifdef DEBUG_DMA
- printf("_bus_dmamem_load_buffer(buf=%p, len=%lx, flags=%d, 1st=%d)\n",
- buf, buflen, flags, first);
-#endif /* DEBUG_DMA */
-
- if (p != NULL)
- pmap = p->p_vmspace->vm_map.pmap;
- else
- pmap = pmap_kernel();
-
- lastaddr = *lastaddrp;
- bmask = ~(map->_dm_boundary - 1);
-
- for (seg = *segp; buflen > 0; ) {
- /*
- * Get the physical address for this segment.
- */
- pmap_extract(pmap, (vaddr_t)vaddr, &curaddr);
-#if 0
- /*
- * Make sure we're in an allowed DMA range.
- */
- if (t->_ranges != NULL &&
- _bus_dma_inrange(t->_ranges, t->_nranges, curaddr) == 0)
- return (EINVAL);
-#endif
-
- /*
- * Compute the segment size, and adjust counts.
- */
- sgsize = NBPG - ((u_long)vaddr & PGOFSET);
- if (buflen < sgsize)
- sgsize = buflen;
-
- /*
- * Make sure we don't cross any boundaries.
- */
- if (map->_dm_boundary > 0) {
- baddr = (curaddr + map->_dm_boundary) & bmask;
- if (sgsize > (baddr - curaddr))
- sgsize = (baddr - curaddr);
- }
-
- /*
- * Insert chunk into a segment, coalescing with
- * previous segment if possible.
- */
- if (first) {
- map->dm_segs[seg].ds_addr = curaddr;
- map->dm_segs[seg].ds_len = sgsize;
- first = 0;
- } else {
- if (curaddr == lastaddr &&
- (map->dm_segs[seg].ds_len + sgsize) <=
- map->_dm_maxsegsz &&
- (map->_dm_boundary == 0 ||
- (map->dm_segs[seg].ds_addr & bmask) ==
- (curaddr & bmask)))
- map->dm_segs[seg].ds_len += sgsize;
- else {
- if (++seg >= map->_dm_segcnt)
- break;
- map->dm_segs[seg].ds_addr = curaddr;
- map->dm_segs[seg].ds_len = sgsize;
- }
- }
-
- lastaddr = curaddr + sgsize;
- vaddr += sgsize;
- buflen -= sgsize;
- }
-
- *segp = seg;
- *lastaddrp = lastaddr;
-
- /*
- * Did we fit?
- */
- if (buflen != 0)
- return (EFBIG); /* XXX better return value here? */
- return (0);
-}
-
-/*
- * Check to see if the specified page is in an allowed DMA range.
- */
-int
-_bus_dma_inrange(ranges, nranges, curaddr)
- bus_dma_segment_t *ranges;
- int nranges;
- bus_addr_t curaddr;
-{
- bus_dma_segment_t *ds;
- int i;
-
- for (i = 0, ds = ranges; i < nranges; i++, ds++) {
- if (curaddr >= ds->ds_addr &&
- round_page(curaddr) <= (ds->ds_addr + ds->ds_len))
- return (1);
- }
-
- return (0);
-}
-
-/*
- * Allocate physical memory from the given physical address range.
- * Called by DMA-safe memory allocation methods.
- */
-int
-_bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
- flags, low, high)
- bus_dma_tag_t t;
- bus_size_t size, alignment, boundary;
- bus_dma_segment_t *segs;
- int nsegs;
- int *rsegs;
- int flags;
- vaddr_t low;
- vaddr_t high;
-{
- paddr_t curaddr, lastaddr;
- struct vm_page *m;
- struct pglist mlist;
- int curseg, error, plaflag;
-
-#ifdef DEBUG_DMA
- printf("alloc_range: t=%p size=%lx align=%lx boundary=%lx segs=%p nsegs=%x rsegs=%p flags=%x lo=%lx hi=%lx\n",
- t, size, alignment, boundary, segs, nsegs, rsegs, flags, low, high);
-#endif /* DEBUG_DMA */
-
- /* Always round the size. */
- size = round_page(size);
-
- /*
- * Allocate pages from the VM system.
- */
- plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
- if (flags & BUS_DMA_ZERO)
- plaflag |= UVM_PLA_ZERO;
-
- TAILQ_INIT(&mlist);
- error = uvm_pglistalloc(size, low, high, alignment, boundary,
- &mlist, nsegs, plaflag);
- if (error)
- return (error);
-
- /*
- * Compute the location, size, and number of segments actually
- * returned by the VM code.
- */
- m = TAILQ_FIRST(&mlist);
- curseg = 0;
- lastaddr = segs[curseg].ds_addr = VM_PAGE_TO_PHYS(m);
- segs[curseg].ds_len = PAGE_SIZE;
-#ifdef DEBUG_DMA
- printf("alloc: page %lx\n", lastaddr);
-#endif /* DEBUG_DMA */
- m = TAILQ_NEXT(m, pageq);
-
- for (; m != NULL; m = TAILQ_NEXT(m, pageq)) {
- curaddr = VM_PAGE_TO_PHYS(m);
-#ifdef DIAGNOSTIC
- if (curaddr < low || curaddr >= high) {
- printf("vm_page_alloc_memory returned non-sensical"
- " address 0x%lx\n", curaddr);
- panic("_bus_dmamem_alloc_range");
- }
-#endif /* DIAGNOSTIC */
-#ifdef DEBUG_DMA
- printf("alloc: page %lx\n", curaddr);
-#endif /* DEBUG_DMA */
- if (curaddr == (lastaddr + PAGE_SIZE))
- segs[curseg].ds_len += PAGE_SIZE;
- else {
- curseg++;
- segs[curseg].ds_addr = curaddr;
- segs[curseg].ds_len = PAGE_SIZE;
- }
- lastaddr = curaddr;
- }
-
- *rsegs = curseg + 1;
-
- return (0);
-}
-
-/*
- * "generic" DMA struct, nothing special.
- */
-struct vax_bus_dma_tag vax_bus_dma_tag = {
- NULL,
- 0,
- 0,
- 0,
- NULL,
- _bus_dmamap_create,
- _bus_dmamap_destroy,
- _bus_dmamap_load,
- _bus_dmamap_load_mbuf,
- _bus_dmamap_load_uio,
- _bus_dmamap_load_raw,
- _bus_dmamap_unload,
- _bus_dmamap_sync,
- _bus_dmamem_alloc,
- _bus_dmamem_free,
- _bus_dmamem_map,
- _bus_dmamem_unmap,
- _bus_dmamem_mmap,
-};
diff --git a/sys/arch/vax/vax/bus_mem.c b/sys/arch/vax/vax/bus_mem.c
deleted file mode 100644
index 12420c324eb..00000000000
--- a/sys/arch/vax/vax/bus_mem.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $OpenBSD: bus_mem.c,v 1.7 2009/12/26 14:45:36 miod Exp $ */
-/* $NetBSD: bus_mem.c,v 1.8 2000/06/29 07:14:23 mrg Exp $ */
-/*
- * Copyright (c) 1998 Matt Thomas
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/types.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/cpu.h>
-#include <machine/pmap.h>
-#include <machine/bus.h>
-#include <machine/intr.h>
-
-int vax_mem_bus_space_map(void *, bus_addr_t, bus_size_t, int,
- bus_space_handle_t *);
-void vax_mem_bus_space_unmap(void *, bus_space_handle_t, bus_size_t);
-int vax_mem_bus_space_subregion(void *, bus_space_handle_t, bus_size_t,
- bus_size_t, bus_space_handle_t *);
-int vax_mem_bus_space_alloc(void *, bus_addr_t, bus_addr_t, bus_size_t,
- bus_size_t, bus_size_t, int, bus_addr_t *, bus_space_handle_t *);
-void vax_mem_bus_space_free(void *, bus_space_handle_t, bus_size_t);
-void *vax_mem_bus_space_vaddr(void *, bus_space_handle_t);
-
-int
-vax_mem_bus_space_map(void *t, bus_addr_t pa, bus_size_t size, int flags,
- bus_space_handle_t *bshp)
-{
- vaddr_t va;
-
- size += (pa & VAX_PGOFSET); /* have to include the byte offset */
- va = uvm_km_valloc(kernel_map, size);
- if (va == 0)
- return (ENOMEM);
-
- *bshp = (bus_space_handle_t)(va + (pa & VAX_PGOFSET));
-
- ioaccess(va, pa, (size + VAX_NBPG - 1) >> VAX_PGSHIFT);
-
- return 0;
-}
-
-int
-vax_mem_bus_space_subregion(void *t, bus_space_handle_t h, bus_size_t o,
- bus_size_t s, bus_space_handle_t *hp)
-{
- *hp = h + o;
- return (0);
-}
-
-void
-vax_mem_bus_space_unmap(void *t, bus_space_handle_t h, bus_size_t size)
-{
- u_long va = trunc_page(h);
- u_long endva = round_page(h + size);
-
- /*
- * Free the kernel virtual mapping.
- */
- iounaccess(va, size >> VAX_PGSHIFT);
- uvm_km_free(kernel_map, va, endva - va);
-}
-
-int
-vax_mem_bus_space_alloc(void *t, bus_addr_t rs, bus_addr_t re, bus_size_t s,
- bus_size_t a, bus_size_t b, int f, bus_addr_t *ap, bus_space_handle_t *hp)
-{
- panic("vax_mem_bus_alloc not implemented");
-}
-
-void
-vax_mem_bus_space_free(void *t, bus_space_handle_t h, bus_size_t s)
-{
- panic("vax_mem_bus_free not implemented");
-}
-
-void *
-vax_mem_bus_space_vaddr(void *t, bus_space_handle_t h)
-{
- return ((void *)h);
-}
-
-struct vax_bus_space vax_mem_bus_space = {
- NULL,
- vax_mem_bus_space_map,
- vax_mem_bus_space_unmap,
- vax_mem_bus_space_subregion,
- vax_mem_bus_space_alloc,
- vax_mem_bus_space_free,
- vax_mem_bus_space_vaddr
-};
diff --git a/sys/arch/vax/vax/clock.c b/sys/arch/vax/vax/clock.c
deleted file mode 100644
index fbf57bd4da5..00000000000
--- a/sys/arch/vax/vax/clock.c
+++ /dev/null
@@ -1,399 +0,0 @@
-/* $OpenBSD: clock.c,v 1.25 2015/02/07 00:09:09 miod Exp $ */
-/* $NetBSD: clock.c,v 1.35 2000/06/04 06:16:58 matt Exp $ */
-/*
- * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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/kernel.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/timetc.h>
-
-#include <dev/clock_subr.h>
-
-#include <machine/mtpr.h>
-#include <machine/sid.h>
-#include <machine/clock.h>
-#include <machine/cpu.h>
-#include <machine/uvax.h>
-
-struct evcount clock_intrcnt;
-uint32_t icr_count;
-
-#if defined(VAX46) || defined(VAX48)
-u_int vax_diagtmr_get_tc(struct timecounter *);
-
-/*
- * This counter is only reliable in millisecond units. See comments in
- * vax_diagtmr_get_tc() for details.
- */
-struct timecounter vax_diagtmr_tc = {
- .tc_get_timecount = vax_diagtmr_get_tc,
- .tc_counter_mask = 0xffff, /* 16 bits */
- .tc_frequency = 1000, /* 1kHz */
- /* tc_name will be filled in */
- .tc_quality = 100
-};
-#endif
-
-#ifdef VXT
-u_int vax_vxt_get_tc(struct timecounter *);
-
-struct timecounter vax_vxt_tc = {
- .tc_get_timecount = vax_vxt_get_tc,
- .tc_counter_mask = 0xffffffff,
- .tc_frequency = 100, /* 100Hz */
- .tc_name = "vxt",
- .tc_quality = 0
-};
-#endif
-
-u_int vax_icr_get_tc(struct timecounter *);
-
-struct timecounter vax_icr_tc = {
- .tc_get_timecount = vax_icr_get_tc,
- .tc_counter_mask = 0xffffffff,
- .tc_frequency = 1000000, /* 1MHz */
- .tc_name = "icr",
- .tc_quality = 100
-};
-
-/*
- * Sets year to the year in fs_time and then calculates the number of
- * 100th of seconds in the current year and saves that info in year_len.
- * fs_time contains the time set in the superblock in the root filesystem.
- * If the clock is started, it then checks if the time is valid
- * compared with the time in fs_time. If the clock is stopped, an
- * alert is printed and the time is temporary set to the time in fs_time.
- */
-
-void
-inittodr(time_t fs_time)
-{
- int rv, deltat;
- struct timespec ts;
-
- rv = (*dep_call->cpu_clkread)(&ts, fs_time);
- if (rv != 0) {
- /* No useable information from system clock */
- ts.tv_sec = fs_time;
- ts.tv_nsec = 0;
- resettodr();
- } else {
- /* System clock OK, no warning if we don't want to. */
- deltat = ts.tv_sec - fs_time;
-
- if (deltat < 0)
- deltat = -deltat;
- if (deltat >= 2 * SEC_PER_DAY) {
- printf("clock has %s %d days",
- ts.tv_sec < fs_time ? "lost" : "gained",
- deltat / SEC_PER_DAY);
- rv = EINVAL;
- }
- }
-
- if (rv != 0)
- printf(" -- CHECK AND RESET THE DATE!\n");
-
- tc_setclock(&ts);
-}
-
-/*
- * Resettodr restores the time of day hardware after a time change.
- */
-
-void
-resettodr()
-{
- (*dep_call->cpu_clkwrite)();
-}
-
-/*
- * A delayloop that delays about the number of milliseconds that is
- * given as argument.
- */
-void
-delay(int i)
-{
- asm ("1: sobgtr %0, 1b" : : "r" (dep_call->cpu_vups * i));
-}
-
-/*
- * On all VAXen there are a microsecond clock that should
- * be used for interval interrupts. We have to be wary of the few CPUs
- * which don't implement the ICR interval register.
- */
-void
-cpu_initclocks()
-{
- switch (vax_boardtype) {
-#ifdef VAX46
- /* VAXstation 4000/60: no ICR register but a specific timer */
- case VAX_BTYP_46:
- {
- extern struct vs_cpu *ka46_cpu;
-
- vax_diagtmr_tc.tc_priv = ka46_cpu;
- vax_diagtmr_tc.tc_name = "KA46";
- tc_init(&vax_diagtmr_tc);
- }
- break;
-#endif
-#ifdef VAX48
- /* VAXstation 4000/VLC: no ICR register but a specific timer */
- case VAX_BTYP_48:
- {
- extern struct vs_cpu *ka48_cpu;
-
- vax_diagtmr_tc.tc_priv = ka48_cpu;
- vax_diagtmr_tc.tc_name = "KA48";
- tc_init(&vax_diagtmr_tc);
- }
- break;
-#endif
-#ifdef VXT
- /* VXT2000: neither NICR nor ICR registers, no known other timer. */
- case VAX_BTYP_VXT:
- tc_init(&vax_vxt_tc);
- break;
-#endif
- /* all other systems: NICR+ICR registers implementing a 1MHz timer. */
- default:
- tc_init(&vax_icr_tc);
- break;
- }
-
- evcount_attach(&clock_intrcnt, "clock", NULL);
- if (vax_boardtype != VAX_BTYP_VXT)
- mtpr(-tick, PR_NICR); /* Load in count register */
- mtpr(ICCS_ERR | ICCS_OFLOW | ICCS_INTENA | ICCS_RESET | ICCS_RUN,
- PR_ICCS); /* Reset errors, start clock and enable interrupt */
-}
-
-void
-icr_hardclock(struct clockframe *cf)
-{
- icr_count += 10000; /* tick */
- hardclock(cf);
-}
-
-/*
- * There are two types of real-time battery-backed up clocks on
- * VAX computers, one with a register that counts up every 1/100 second,
- * one with a clock chip that delivers time. For the register clock
- * we have a generic version, and for the chip clock there are
- * support routines for time conversion.
- */
-/*
- * Converts a year to corresponding number of ticks.
- */
-int
-yeartonum(int y)
-{
- int n;
-
- for (n = 0, y -= 1; y > 69; y--)
- n += SECPERYEAR(y);
- return n;
-}
-
-/*
- * Converts tick number to a year 70 ->
- */
-int
-numtoyear(int num)
-{
- int y = 70, j;
- while (num >= (j = SECPERYEAR(y))) {
- y++;
- num -= j;
- }
- return y;
-}
-
-#if VAX650 || VAX660 || VAX670 || VAX680 || VAX53
-/*
- * Reads the TODR register; returns 0 if a valid time has been found, EINVAL
- * otherwise. The year is based on the argument year; the TODR doesn't hold
- * years.
- */
-int
-generic_clkread(struct timespec *ts, time_t base)
-{
- uint32_t klocka = mfpr(PR_TODR);
-
- /*
- * Sanity check.
- */
- if (klocka < TODRBASE) {
- if (klocka == 0)
- printf("TODR stopped");
- else
- printf("TODR too small");
- return EINVAL;
- }
-
- ts->tv_sec =
- yeartonum(numtoyear(base)) + (klocka - TODRBASE) / 100;
- ts->tv_nsec = 0;
- return 0;
-}
-
-/*
- * Takes the current system time and writes it to the TODR.
- */
-void
-generic_clkwrite()
-{
- uint32_t tid = time_second, bastid;
-
- bastid = tid - yeartonum(numtoyear(tid));
- mtpr((bastid * 100) + TODRBASE, PR_TODR);
-}
-#endif
-
-#if VAX630 || VAX410 || VAX43 || VAX46 || VAX48 || VAX49
-
-volatile short *clk_page; /* where the chip is mapped in virtual memory */
-int clk_adrshift; /* how much to multiply the in-page address with */
-int clk_tweak; /* Offset of time into word. */
-
-#define REGPEEK(off) (clk_page[off << clk_adrshift] >> clk_tweak)
-#define REGPOKE(off, v) (clk_page[off << clk_adrshift] = ((v) << clk_tweak))
-
-int
-chip_clkread(struct timespec *ts, time_t base)
-{
- struct clock_ymdhms c;
- int timeout = 1<<15, s;
-
-#ifdef DIAGNOSTIC
- if (clk_page == 0)
- panic("trying to use unset chip clock page");
-#endif
-
- if ((REGPEEK(CSRD_OFF) & CSRD_VRT) == 0) {
- printf("WARNING: TOY clock not marked valid");
- return EINVAL;
- }
- while (REGPEEK(CSRA_OFF) & CSRA_UIP)
- if (--timeout == 0) {
- printf ("TOY clock timed out");
- return EINVAL;
- }
-
- s = splhigh();
- c.dt_year = ((u_char)REGPEEK(YR_OFF)) + 1970;
- c.dt_mon = REGPEEK(MON_OFF);
- c.dt_day = REGPEEK(DAY_OFF);
- c.dt_wday = REGPEEK(WDAY_OFF);
- c.dt_hour = REGPEEK(HR_OFF);
- c.dt_min = REGPEEK(MIN_OFF);
- c.dt_sec = REGPEEK(SEC_OFF);
- splx(s);
-
- ts->tv_sec = clock_ymdhms_to_secs(&c);
- ts->tv_nsec = 0;
- return 0;
-}
-
-void
-chip_clkwrite()
-{
- struct clock_ymdhms c;
-
-#ifdef DIAGNOSTIC
- if (clk_page == 0)
- panic("trying to use unset chip clock page");
-#endif
-
- REGPOKE(CSRB_OFF, CSRB_SET);
-
- clock_secs_to_ymdhms(time_second, &c);
-
- REGPOKE(YR_OFF, ((u_char)(c.dt_year - 1970)));
- REGPOKE(MON_OFF, c.dt_mon);
- REGPOKE(DAY_OFF, c.dt_day);
- REGPOKE(WDAY_OFF, c.dt_wday);
- REGPOKE(HR_OFF, c.dt_hour);
- REGPOKE(MIN_OFF, c.dt_min);
- REGPOKE(SEC_OFF, c.dt_sec);
-
- REGPOKE(CSRB_OFF, CSRB_DM|CSRB_24);
-};
-#endif
-
-#if defined(VAX46) || defined(VAX48)
-u_int
-vax_diagtmr_get_tc(struct timecounter *tc)
-{
- /*
- * The diagnostic timer runs at about 1024kHz.
- * The microsecond counter counts from 0 to 1023 inclusive (so it
- * really is a 1/1024th millisecond counter) and increments the
- * millisecond counter, which is a free-running 16 bit counter.
- *
- * To compensate for the timer not running at exactly 1024kHz,
- * the microsecond counter is reset (to zero) every clock interrupt,
- * i.e. every 10 millisecond.
- *
- * Without resetting the microsecond counter, experiments show that,
- * on KA48, the millisecond counter increments of 960 in a second,
- * instead of the expected 1000 (i.e. a 24/25 ratio). But resetting
- * the microsecond counter (which does not affect the millisecond
- * counter value) ought to make it __slower__ - who can explain
- * this behaviour?
- *
- * Because we reset the ``binary microsecond'' counter and can not
- * afford time moving backwards, we only return the millisecond
- * counter here.
- */
- struct vs_cpu *vscpu;
-
- vscpu = (struct vs_cpu *)tc->tc_priv;
- return *(volatile uint16_t *)&vscpu->vc_diagtimm;
-}
-#endif
-
-#ifdef VXT
-u_int
-vax_vxt_get_tc(struct timecounter *tc)
-{
- return (u_int)clock_intrcnt.ec_count;
-}
-#endif
-
-u_int
-vax_icr_get_tc(struct timecounter *tc)
-{
- return icr_count + (u_int)(tick + (int)mfpr(PR_ICR));
-}
diff --git a/sys/arch/vax/vax/conf.c b/sys/arch/vax/vax/conf.c
deleted file mode 100644
index 4cbad2dc390..00000000000
--- a/sys/arch/vax/vax/conf.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/* $OpenBSD: conf.c,v 1.72 2016/02/26 09:10:05 natano Exp $ */
-/* $NetBSD: conf.c,v 1.44 1999/10/27 16:38:54 ragge Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986 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.
- *
- * @(#)conf.c 7.18 (Berkeley) 5/9/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-#include <sys/vnode.h>
-
-#include "mt.h"
-bdev_decl(mt);
-
-#include "rd.h"
-
-#include "ra.h"
-bdev_decl(ra);
-bdev_decl(rx);
-
-#include "vnd.h"
-
-#include "hdc.h"
-bdev_decl(hd);
-bdev_decl(ry);
-
-#include "sd.h"
-#include "st.h"
-#include "cd.h"
-
-#include "ksyms.h"
-
-struct bdevsw bdevsw[] =
-{
- bdev_notdef(), /* 0 */
- bdev_notdef(), /* 1 */
- bdev_notdef(), /* 2 */
- bdev_notdef(), /* 3 */
- bdev_swap_init(1,sw), /* 4: swap pseudo-device */
- bdev_notdef(), /* 5 */
- bdev_notdef(), /* 6 */
- bdev_notdef(), /* 7 */
- bdev_notdef(), /* 8 */
- bdev_disk_init(NRA,ra), /* 9: MSCP disk */
- bdev_notdef(), /* 10 */
- bdev_notdef(), /* 11 */
- bdev_disk_init(NRX,rx), /* 12: RX?? on MSCP */
- bdev_notdef(), /* 13 */
- bdev_notdef(), /* 14 */
- bdev_tape_init(NMT,mt), /* 15: MSCP tape */
- bdev_notdef(), /* 16: was: KDB50/RA?? */
- bdev_notdef(), /* 17: was: concatenated disk driver */
- bdev_disk_init(NVND,vnd), /* 18: vnode disk driver */
- bdev_disk_init(NHD,hd), /* 19: VS3100 ST506 disk */
- bdev_disk_init(NSD,sd), /* 20: SCSI disk */
- bdev_tape_init(NST,st), /* 21: SCSI tape */
- bdev_disk_init(NCD,cd), /* 22: SCSI CD-ROM */
- bdev_disk_init(NRD,rd), /* 23: ram disk driver */
- bdev_disk_init(NRY,ry), /* 24: VS3100 floppy */
- bdev_notdef(), /* 25 was: RAIDframe disk driver */
-};
-int nblkdev = nitems(bdevsw);
-
-/*
- * Console routines for VAX console.
- */
-#include <dev/cons.h>
-
-cons_decl(dz);
-cons_decl(gen);
-cons_decl(qsc);
-cons_decl(ws);
-
-#include "dz.h"
-#include "qsc.h"
-#include "wsdisplay.h"
-#include "wskbd.h"
-
-struct consdev constab[]={
-#if VAX650 || VAX630 || VAX660 || VAX670 || VAX680
-#define NGEN 1
- cons_init(gen), /* Generic console type; mtpr/mfpr */
-#else
-#define NGEN 0
-#endif
-#if VAX410 || VAX43 || VAX46 || VAX48 || VAX49 || VAX53 || VAX60
-#if NDZ > 0
- cons_init(dz), /* DZ11-like serial console on VAXstations */
-#endif
-#endif
-#ifdef VXT
-#if NQSC > 0
- cons_init(qsc), /* SC26C94 serial console on VXT2000 */
-#endif
-#endif
-#if NWSDISPLAY > 0 || NWSKBD > 0
- cons_init(ws), /* any other frame buffer console */
-#endif
-
-#ifdef notyet
-/* We may not always use builtin console, sometimes RD */
- { hdcnprobe, hdcninit, hdcngetc, hdcnputc },
-#endif
- { 0 }
-};
-
-#define mmread mmrw
-#define mmwrite mmrw
-cdev_decl(mm);
-#include "bio.h"
-#include "pty.h"
-
-cdev_decl(mt);
-cdev_decl(ra);
-cdev_decl(gencn);
-cdev_decl(rx);
-cdev_decl(hd);
-cdev_decl(ry);
-
-cdev_decl(qsc);
-
-cdev_decl(dz);
-
-#include "dhu.h"
-cdev_decl(dhu);
-
-#include "dl.h"
-cdev_decl(dl);
-
-#include "bpfilter.h"
-
-#include "tun.h"
-#include "ch.h"
-#include "uk.h"
-
-#include "wsdisplay.h"
-#include "wskbd.h"
-#include "wsmouse.h"
-
-#include "pf.h"
-
-#include "systrace.h"
-
-#include "vscsi.h"
-#include "pppx.h"
-#include "audio.h"
-#include "fuse.h"
-
-struct cdevsw cdevsw[] =
-{
- cdev_cn_init(1,cn), /* 0: virtual console */
- cdev_tty_init(NDZ,dz), /* 1: DZ11 */
- cdev_ctty_init(1,ctty), /* 2: controlling terminal */
- cdev_mm_init(1,mm), /* 3: /dev/{null,mem,kmem,...} */
- cdev_notdef(), /* 4 */
- cdev_notdef(), /* 5 */
- cdev_notdef(), /* 6 */
- cdev_notdef(), /* 7 was /dev/drum */
- cdev_notdef(), /* 8 */
- cdev_disk_init(NRA,ra), /* 9: MSCP disk interface */
- cdev_notdef(), /* 10 */
- cdev_notdef(), /* 11 */
- cdev_notdef(), /* 12 */
- cdev_notdef(), /* 13 */
- cdev_notdef(), /* 14 */
- cdev_notdef(), /* 15 */
- cdev_notdef(), /* 16 */
- cdev_notdef(), /* 17 */
- cdev_notdef(), /* 18 */
- cdev_notdef(), /* 19 */
- cdev_tty_init(NPTY,pts), /* 20: pseudo-tty slave */
- cdev_ptc_init(NPTY,ptc), /* 21: pseudo-tty master */
- cdev_notdef(), /* 22 */
- cdev_notdef(), /* 23 */
- cdev_notdef(), /* 24 */
- cdev_tty_init(NGEN,gencn), /* 25: Generic console (mtpr...) */
- cdev_notdef(), /* 26 */
- cdev_notdef(), /* 27 */
- cdev_notdef(), /* 28 was LKM */
- cdev_notdef(), /* 29 */
- cdev_disk_init(NRX,rx), /* 30: RX?? on MSCP */
- cdev_notdef(), /* 31 */
- cdev_notdef(), /* 32: RL01/02 on unibus */
- cdev_log_init(1,log), /* 33: /dev/klog */
- cdev_tty_init(NDHU,dhu), /* 34: DHU-11 */
- cdev_notdef(), /* 35 */
- cdev_notdef(), /* 36 */
- cdev_notdef(), /* 37 */
- cdev_tape_init(NMT,mt), /* 38: MSCP tape */
- cdev_notdef(), /* 39 */
- cdev_notdef(), /* 40 */
- cdev_notdef(), /* 41 */
- cdev_pf_init(NPF,pf), /* 42: packet filter */
- cdev_notdef(), /* 43 */
- cdev_notdef(), /* 44 was Datakit */
- cdev_notdef(), /* 45 was Datakit */
- cdev_notdef(), /* 46 was Datakit */
- cdev_notdef(), /* 47 */
- cdev_tty_init(NQSC,qsc), /* 48: SC26C94 on VXT2000 */
- cdev_systrace_init(NSYSTRACE,systrace), /* 49: system call tracing */
- cdev_ksyms_init(NKSYMS,ksyms), /* 50: Kernel symbols device */
- cdev_notdef(), /* 51 */
- cdev_notdef(), /* 52: was: KDB50/RA?? */
- cdev_fd_init(1,filedesc), /* 53: file descriptor pseudo-device */
- cdev_notdef(), /* 54: was: concatenated disk driver */
- cdev_disk_init(NVND,vnd), /* 55: vnode disk driver */
- cdev_bpf_init(NBPFILTER,bpf), /* 56: berkeley packet filter */
- cdev_tun_init(NTUN,tun), /* 57: tunnel filter */
- cdev_disk_init(NHD,hd), /* 58: HDC9224/RD?? */
- cdev_disk_init(NSD,sd), /* 59: SCSI disk */
- cdev_tape_init(NST,st), /* 60: SCSI tape */
- cdev_disk_init(NCD,cd), /* 61: SCSI CD-ROM */
- cdev_disk_init(NRD,rd), /* 62: memory disk driver */
- cdev_ch_init(NCH,ch), /* 63: SCSI autochanger */
- cdev_notdef(), /* 64 */
- cdev_uk_init(NUK,uk), /* 65: SCSI unknown */
- cdev_tty_init(NDL,dl), /* 66: DL11 */
- cdev_random_init(1,random), /* 67: random data source */
- cdev_wsdisplay_init(NWSDISPLAY, wsdisplay), /* 68: frame buffers */
- cdev_mouse_init(NWSKBD, wskbd), /* 69: keyboards */
- cdev_mouse_init(NWSMOUSE, wsmouse), /* 70: mice */
- cdev_disk_init(NRY,ry), /* 71: VS floppy */
- cdev_bio_init(NBIO,bio), /* 72: ioctl tunnel */
- cdev_notdef(), /* 73 was: RAIDframe disk driver */
- cdev_notdef(), /* 74 */
- cdev_ptm_init(NPTY,ptm), /* 75: pseudo-tty ptm device */
- cdev_notdef(), /* 76 */
- cdev_notdef(), /* 77 */
- cdev_vscsi_init(NVSCSI,vscsi), /* 78: vscsi */
- cdev_disk_init(1,diskmap), /* 79: disk mapper */
- cdev_pppx_init(NPPPX,pppx), /* 80: pppx */
- cdev_audio_init(NAUDIO,audio), /* 81: /dev/audio */
- cdev_fuse_init(NFUSE,fuse), /* 82: fuse */
- cdev_tun_init(NTUN,tap), /* 83: Ethernet network tunnel */
-};
-int nchrdev = nitems(cdevsw);
-
-int mem_no = 3; /* major device number of memory special file */
-
-/*
- * Swapdev is a fake device implemented
- * in sw.c used only internally to get to swstrategy.
- * It cannot be provided to the users, because the
- * swstrategy routine munches the b_dev and b_blkno entries
- * before calling the appropriate driver. This would horribly
- * confuse, e.g. the hashing routines. Instead, /dev/drum is
- * provided as a character (raw) device.
- */
-dev_t swapdev = makedev(4, 0);
-
-int chrtoblktbl[] = {
- NODEV, /* 0 */
- NODEV, /* 1 */
- NODEV, /* 2 */
- NODEV, /* 3 */
- NODEV, /* 4 */
- NODEV, /* 5 */
- NODEV, /* 6 */
- NODEV, /* 7 */
- NODEV, /* 8 */
- 9, /* 9 ra */
- NODEV, /* 10 */
- NODEV, /* 11 */
- NODEV, /* 12 */
- NODEV, /* 13 */
- NODEV, /* 14 */
- NODEV, /* 15 */
- NODEV, /* 16 */
- NODEV, /* 17 */
- NODEV, /* 18 */
- NODEV, /* 19 */
- NODEV, /* 20 */
- NODEV, /* 21 */
- NODEV, /* 22 */
- NODEV, /* 23 */
- NODEV, /* 24 */
- NODEV, /* 25 */
- NODEV, /* 26 */
- NODEV, /* 27 */
- NODEV, /* 28 */
- NODEV, /* 29 */
- 12, /* 30 rx */
- NODEV, /* 31 */
- NODEV, /* 32 */
- NODEV, /* 33 */
- NODEV, /* 34 */
- NODEV, /* 35 */
- NODEV, /* 36 */
- NODEV, /* 37 */
- 15, /* 38 mt */
- NODEV, /* 39 */
- NODEV, /* 40 */
- NODEV, /* 41 */
- NODEV, /* 42 */
- NODEV, /* 43 */
- NODEV, /* 44 */
- NODEV, /* 45 */
- NODEV, /* 46 */
- NODEV, /* 47 */
- NODEV, /* 48 */
- NODEV, /* 49 */
- NODEV, /* 50 */
- NODEV, /* 51 */
- NODEV, /* 52 */
- NODEV, /* 53 */
- NODEV, /* 54 */
- 18, /* 55 vnd */
- NODEV, /* 56 */
- NODEV, /* 57 */
- 19, /* 58 hd */
- 20, /* 59 sd */
- 21, /* 60 st */
- 22, /* 61 cd */
- 23, /* 62 rd */
- NODEV, /* 63 ch */
- NODEV, /* 64 */
- NODEV, /* 65 uk */
- NODEV, /* 66 */
- NODEV, /* 67 */
- NODEV, /* 68 */
- NODEV, /* 69 */
- NODEV, /* 70 */
- 24, /* 71 ry */
-};
-int nchrtoblktbl = nitems(chrtoblktbl);
-
-/*
- * Returns true if dev is /dev/mem or /dev/kmem.
- */
-int
-iskmemdev(dev)
- dev_t dev;
-{
- return (major(dev) == 3 && minor(dev) < 2);
-}
-
-/*
- * Returns true if dev is /dev/zero.
- * ?? Shall I use 12 as /dev/zero?
- */
-int
-iszerodev(dev)
- dev_t dev;
-{
-
- return (major(dev) == 3 && minor(dev) == 12);
-}
-
-int getmajor(void *); /* XXX used by dz_ibus and wscons, die die die */
-
-int
-getmajor(void *ptr)
-{
- int i;
-
- for (i = 0; i < nchrdev; i++)
- if (cdevsw[i].d_open == ptr)
- return i;
-
- return (-1);
-}
-
-dev_t
-getnulldev()
-{
- return makedev(3, 2);
-}
diff --git a/sys/arch/vax/vax/cvax.c b/sys/arch/vax/vax/cvax.c
deleted file mode 100644
index 805b42baebe..00000000000
--- a/sys/arch/vax/vax/cvax.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/* $OpenBSD: cvax.c,v 1.1 2008/08/18 23:07:26 miod Exp $ */
-/* $NetBSD: ka650.c,v 1.25 2001/04/27 15:02:37 ragge Exp $ */
-/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mt. Xinu.
- *
- * 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.
- *
- * @(#)ka650.c 7.7 (Berkeley) 12/16/90
- */
-
-/*
- * CVAX-specific code.
- */
-
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <uvm/uvm_extern.h>
-
-#include <machine/cvax.h>
-#include <machine/clock.h>
-#include <machine/cpu.h>
-#include <machine/psl.h>
-#include <machine/mtpr.h>
-#include <machine/sid.h>
-
-struct cvax_ssc *cvax_ssc_ptr;
-
-/*
- * Machine Check descriptions
- */
-const char *cvax_mcheck[] = {
- NULL, /* 00 */
- "FPA proto err", /* 01 */
- "FPA resv inst", /* 02 */
- "FPA Ill Stat 2", /* 03 */
- "FPA Ill Stat 1", /* 04 */
- "PTE in P0, TB miss", /* 05 */
- "PTE in P1, TB miss", /* 06 */
- "PTE in P0, Mod", /* 07 */
- "PTE in P1, Mod", /* 08 */
- "Illegal intr IPL", /* 09 */
- "MOVC state error", /* 0a */
-
- "bus read error", /* 80 */
- "SCB read error", /* 81 */
- "bus write error", /* 82 */
- "PCB write error" /* 83 */
-};
-
-const char *
-cvax_mchk_descr(int summary)
-{
- if ((unsigned int)summary < 11)
- return cvax_mcheck[summary];
-
- if (summary >= 0x80 && summary <= 0x83)
- return cvax_mcheck[summary - 0x80 + 11];
-
- return NULL;
-}
-
-/*
- * CVAX Mailbox routines
- */
-
-void
-cvax_halt()
-{
- cvax_ssc_ptr->ssc_cpmbx = CPMB_CVAX_DOTHIS | CPMB_CVAX_HALT;
- asm("halt");
-}
-
-void
-cvax_reboot(arg)
- int arg;
-{
- cvax_ssc_ptr->ssc_cpmbx = CPMB_CVAX_DOTHIS | CPMB_CVAX_REBOOT;
-}
diff --git a/sys/arch/vax/vax/db_disasm.c b/sys/arch/vax/vax/db_disasm.c
deleted file mode 100644
index 3cc3573b5e8..00000000000
--- a/sys/arch/vax/vax/db_disasm.c
+++ /dev/null
@@ -1,554 +0,0 @@
-/* $OpenBSD: db_disasm.c,v 1.16 2008/08/15 22:41:02 miod Exp $ */
-/* $NetBSD: db_disasm.c,v 1.10 1998/04/13 12:10:27 ragge Exp $ */
-/*
- * Copyright (c) 2002, Miodrag Vallat.
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by
- * Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/proc.h>
-#include <sys/reboot.h>
-#include <sys/systm.h>
-
-#include <machine/db_machdep.h>
-#include <ddb/db_sym.h>
-#include <ddb/db_variables.h>
-#include <ddb/db_interface.h>
-#include <ddb/db_output.h>
-
-#include <vax/vax/db_disasm.h>
-
-#ifdef VMS_MODE
-#define DEFERRED "@"
-#define LITERAL "#"
-#else
-#define DEFERRED "*"
-#define LITERAL "$"
-#endif
-/*
- * disassembling vax instructions works as follows:
- *
- * 1. get first byte as opcode (check for two-byte opcodes!)
- * 2. lookup in op-table for mnemonic and operand-list
- * 2.a store the mnemonic
- * 3. for each operand in list: get the size/type
- * 3.a evaluate addressing mode for this operand
- * 3.b store each operand(s)
- * 4. db_printf the opcode and the (value of the) operands
- * 5. return the start of the next instruction
- *
- * - if jump/branch calculate (and display) the target-address
- */
-
-/*
-#define BROKEN_DB_REGS
-*/
-#ifdef BROKEN_DB_REGS
-struct { /* Due to order and contents of db_regs[], we can't */
- char *name; /* use this array to extract register-names. */
- void *valuep; /* eg. "psl" vs "pc", "pc" vs "sp" */
-} my_db_regs[16] = {
- { "r0", NULL },
- { "r1", NULL },
- { "r2", NULL },
- { "r3", NULL },
- { "r4", NULL },
- { "r5", NULL },
- { "r6", NULL },
- { "r7", NULL },
- { "r8", NULL },
- { "r9", NULL },
- { "r10", NULL },
- { "r11", NULL },
- { "ap", NULL }, /* aka "r12" */
- { "fp", NULL }, /* aka "r13" */
- { "sp", NULL }, /* aka "r14" */
- { "pc", NULL }, /* aka "r15" */
-};
-#else
-#define my_db_regs db_regs
-#endif
-
-typedef struct {
- char dasm[256]; /* disassembled instruction as text */
- char *ppc; /* pseudo PC */
- u_int opc; /* op-code */
- char *argp; /* pointer into argument-list */
- int off; /* offset specified by last argument */
- int addr; /* address specified by last argument */
-} inst_buffer;
-
-int get_byte(inst_buffer * ib);
-int get_word(inst_buffer * ib);
-int get_long(inst_buffer * ib);
-
-int get_opcode(inst_buffer * ib);
-int get_operands(inst_buffer * ib);
-int get_operand(inst_buffer * ib, int size);
-
-void add_str(inst_buffer * ib, char *s);
-void add_int(inst_buffer * ib, int i);
-void add_xint(inst_buffer * ib, int i);
-void add_sym(inst_buffer * ib, int i);
-void add_off(inst_buffer * ib, int i);
-
-#define err_print printf
-
-/*
- * Disassemble instruction at 'loc'. 'altfmt' specifies an
- * (optional) alternate format (altfmt for vax: don't assume
- * that each external label is a procedure entry mask).
- * Return address of start of next instruction.
- * Since this function is used by 'examine' and by 'step'
- * "next instruction" does NOT mean the next instruction to
- * be executed but the 'linear' next instruction.
- */
-db_addr_t
-db_disasm(loc, altfmt)
- db_addr_t loc;
- boolean_t altfmt;
-{
- db_expr_t diff;
- db_sym_t sym;
- char *symname;
-
- inst_buffer ib;
-
- bzero(&ib, sizeof(ib));
- ib.ppc = (void *)loc;
-
- if (!altfmt) { /* ignore potential entry masks in altfmt */
- diff = INT_MAX;
- symname = NULL;
- sym = db_search_symbol(loc, DB_STGY_PROC, &diff);
- db_symbol_values(sym, &symname, 0);
-
- if (symname && diff == 0) { /* symbol at loc */
- db_printf("function \"%s()\", entry-mask 0x%x\n",
- symname, (unsigned short) get_word(&ib));
- db_printsym((db_addr_t)ib.ppc, DB_STGY_ANY, db_printf);
- db_printf(":\t");
- }
- }
-
- get_opcode(&ib);
- get_operands(&ib);
- db_printf("%s\n", ib.dasm);
-
- return ((u_int) ib.ppc);
-}
-
-int
-get_opcode(ib)
- inst_buffer *ib;
-{
- ib->opc = get_byte(ib);
- if (ib->opc >= 0xfd) {
- /* two byte op-code */
- ib->opc = ib->opc << 8;
- ib->opc += get_byte(ib);
- }
-
- if (ib->opc > 0xffff) {
- add_str(ib, "invalid opcode ");
- add_xint(ib, ib->opc);
- } else {
- if (ib->opc > 0xff)
- add_str(ib, vax_inst2[INDEX_OPCODE(ib->opc)].mnemonic);
- else
- add_str(ib, vax_inst[ib->opc].mnemonic);
- add_str(ib, "\t");
- }
- return (ib->opc);
-}
-
-int
-get_operands(ib)
- inst_buffer *ib;
-{
- int aa = 0; /* absolute address mode ? */
- int size;
-
- if (ib->opc > 0xffff) {
- /* invalid opcode */
- ib->argp = NULL;
- return (-1);
- } else if (ib->opc > 0xff) {
- /* two-byte opcode */
- ib->argp = vax_inst2[INDEX_OPCODE(ib->opc)].argdesc;
- } else
- ib->argp = vax_inst[ib->opc].argdesc;
-
- if (ib->argp == NULL)
- return (0);
-
- while (*ib->argp) {
- switch (*ib->argp) {
-
- case 'b': /* branch displacement */
- switch (*(++ib->argp)) {
- case 'b':
- ib->off = (signed char) get_byte(ib);
- break;
- case 'w':
- ib->off = (short) get_word(ib);
- break;
- case 'l':
- ib->off = get_long(ib);
- break;
- default:
- err_print("invalid branch-type %X (%c) found.\n",
- *ib->argp, *ib->argp);
- }
- /* add_int(ib, ib->off); */
- ib->addr = (u_int) ib->ppc + ib->off;
- add_off(ib, ib->addr);
- break;
-
- case 'a': /* absolute addressing mode */
- aa = 1;
- /* FALLTHROUGH */
-
- default:
- switch (*(++ib->argp)) {
- case 'b': /* Byte */
- size = SIZE_BYTE;
- break;
- case 'w': /* Word */
- size = SIZE_WORD;
- break;
- case 'l': /* Long-Word */
- case 'f': /* F_Floating */
- size = SIZE_LONG;
- break;
- case 'q': /* Quad-Word */
- case 'd': /* D_Floating */
- case 'g': /* G_Floating */
- size = SIZE_QWORD;
- break;
- case 'o': /* Octa-Word */
- case 'h': /* H_Floating */
- size = SIZE_OWORD;
- break;
- default:
- err_print("invalid op-type %X (%c) found.\n",
- *ib->argp, *ib->argp);
- size = 0;
- }
- if (aa) {
- /* get the address */
- ib->addr = get_operand(ib, size);
- add_sym(ib, ib->addr);
- } else {
- /* get the operand */
- ib->addr = get_operand(ib, size);
- add_off(ib, ib->addr);
- }
- }
-
- if (!*ib->argp || !*++ib->argp)
- break;
- if (*ib->argp++ == ',') {
- add_str(ib, ", ");
- } else {
- err_print("error in opcodes.c\n");
- return (-1);
- }
- }
-
- return (0);
-}
-
-int
-get_operand(ib, size)
- inst_buffer *ib;
- int size;
-{
- int c = get_byte(ib);
- int mode = c >> 4;
- int reg = c & 0x0F;
- int lit = c & 0x3F;
- int tmp = 0;
- char buf[16];
-
- switch (mode) {
- case 0: /* literal */
- case 1: /* literal */
- case 2: /* literal */
- case 3: /* literal */
- add_str(ib, LITERAL);
- add_int(ib, lit);
- tmp = lit;
- break;
-
- case 4: /* indexed */
- snprintf(buf, sizeof buf, "[%s]", my_db_regs[reg].name);
- get_operand(ib, 0);
- add_str(ib, buf);
- break;
-
- case 5: /* register */
- add_str(ib, my_db_regs[reg].name);
- break;
-
- case 6: /* register deferred */
- add_str(ib, "(");
- add_str(ib, my_db_regs[reg].name);
- add_str(ib, ")");
- break;
-
- case 7: /* autodecrement */
- add_str(ib, "-(");
- add_str(ib, my_db_regs[reg].name);
- add_str(ib, ")");
- if (reg == 0x0F) { /* pc is not allowed in this mode */
- err_print("autodecrement not allowed for PC.\n");
- }
- break;
-
- case 9: /* autoincrement deferred */
- add_str(ib, DEFERRED);
- if (reg == 0x0F) { /* pc: immediate deferred */
- /*
- * addresses are always longwords!
- */
- tmp = get_long(ib);
- add_off(ib, tmp);
- break;
- }
- /* FALLTHROUGH */
- case 8: /* autoincrement */
- if (reg == 0x0F) { /* pc: immediate ==> special syntax */
- switch (size) {
- case SIZE_BYTE:
- tmp = (signed char) get_byte(ib);
- break;
- case SIZE_WORD:
- tmp = (signed short) get_word(ib);
- break;
- case SIZE_LONG:
- tmp = get_long(ib);
- break;
- default:
- err_print("illegal op-type %d\n", size);
- tmp = -1;
- }
- if (mode == 8)
- add_str(ib, LITERAL);
- add_int(ib, tmp);
- break;
- }
- add_str(ib, "(");
- add_str(ib, my_db_regs[reg].name);
- add_str(ib, ")+");
- break;
-
- case 11: /* byte displacement deferred/ relative deferred */
- add_str(ib, DEFERRED);
- case 10: /* byte displacement / relative mode */
- tmp = (signed char) get_byte(ib);
- if (reg == 0x0F) {
- add_off(ib, (u_int) ib->ppc + tmp);
- break;
- }
- /* add_str (ib, "b^"); */
- add_int(ib, tmp);
- add_str(ib, "(");
- add_str(ib, my_db_regs[reg].name);
- add_str(ib, ")");
- break;
-
- case 13: /* word displacement deferred */
- add_str(ib, DEFERRED);
- case 12: /* word displacement */
- tmp = (signed short) get_word(ib);
- if (reg == 0x0F) {
- add_off(ib, (u_int) ib->ppc + tmp);
- break;
- }
- /* add_str (ib, "w^"); */
- add_int(ib, tmp);
- add_str(ib, "(");
- add_str(ib, my_db_regs[reg].name);
- add_str(ib, ")");
- break;
-
- case 15: /* long displacement deferred */
- add_str(ib, DEFERRED);
- case 14: /* long displacement */
- tmp = get_long(ib);
- if (reg == 0x0F) {
- add_off(ib, (u_int) ib->ppc + tmp);
- break;
- }
- /* add_str (ib, "l^"); */
- add_int(ib, tmp);
- add_str(ib, "(");
- add_str(ib, my_db_regs[reg].name);
- add_str(ib, ")");
- break;
-
- default:
- err_print("can\'t evaluate operand (%02X).\n", lit);
- break;
- }
-
- return (0);
-}
-
-int
-get_byte(ib)
- inst_buffer *ib;
-{
- return ((unsigned char) *(ib->ppc++));
-}
-
-int
-get_word(ib)
- inst_buffer *ib;
-{
- int tmp;
- char *p = (void *) &tmp;
-
- *p++ = get_byte(ib);
- *p++ = get_byte(ib);
- return (tmp);
-}
-
-int
-get_long(ib)
- inst_buffer *ib;
-{
- int tmp;
- char *p = (void *) &tmp;
-
- *p++ = get_byte(ib);
- *p++ = get_byte(ib);
- *p++ = get_byte(ib);
- *p++ = get_byte(ib);
- return (tmp);
-}
-
-void
-add_str(ib, s)
- inst_buffer *ib;
- char *s;
-{
-
- if (s == NULL)
- s = "-reserved-";
-
- strlcat(ib->dasm, s, sizeof(ib->dasm));
-}
-
-void
-add_int(ib, i)
- inst_buffer *ib;
- int i;
-{
- char buf[32];
-
- if (i < 100 && i > -100)
- snprintf(buf, sizeof buf, "%d", i);
- else
- snprintf(buf, sizeof buf, "0x%x", i);
- add_str(ib, buf);
-}
-
-void
-add_xint(ib, val)
- inst_buffer *ib;
- int val;
-{
- char buf[32];
-
- snprintf(buf, sizeof buf, "0x%x", val);
- add_str(ib, buf);
-}
-
-void
-add_sym(ib, loc)
- inst_buffer *ib;
- int loc;
-{
- db_expr_t diff;
- db_sym_t sym;
- char *symname;
-
- if (!loc)
- return;
-
- diff = INT_MAX;
- symname = NULL;
- sym = db_search_symbol(loc, DB_STGY_ANY, &diff);
- db_symbol_values(sym, &symname, 0);
-
- if (symname && !diff) {
- /* add_str(ib, "<"); */
- add_str(ib, symname);
- /* add_str(ib, ">"); */
- }
- else
- add_xint(ib, loc);
-}
-
-void
-add_off(ib, loc)
- inst_buffer *ib;
- int loc;
-{
- db_expr_t diff;
- db_sym_t sym;
- char *symname;
-
- if (!loc)
- return;
-
- diff = INT_MAX;
- symname = NULL;
- sym = db_search_symbol(loc, DB_STGY_ANY, &diff);
- db_symbol_values(sym, &symname, 0);
-
- if (symname) {
- /* add_str(ib, "<"); */
- add_str(ib, symname);
- if (diff) {
- add_str(ib, "+");
- add_xint(ib, diff);
- }
- /* add_str(ib, ">"); */
- }
- else
- add_xint(ib, loc);
-}
diff --git a/sys/arch/vax/vax/db_disasm.h b/sys/arch/vax/vax/db_disasm.h
deleted file mode 100644
index 80fc8d7716d..00000000000
--- a/sys/arch/vax/vax/db_disasm.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* $OpenBSD: db_disasm.h,v 1.5 2015/02/07 23:30:13 miod Exp $ */
-/* $NetBSD: db_disasm.h,v 1.1 1996/01/28 11:31:27 ragge Exp $ */
-/*
- * Copyright (c) 2002, Miodrag Vallat.
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by
- * Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-#define SIZE_BYTE 1 /* Byte */
-#define SIZE_WORD 2 /* Word */
-#define SIZE_LONG 4 /* Longword */
-#define SIZE_QWORD 8 /* Quadword */
-#define SIZE_OWORD 16 /* Octaword */
-
-/*
- * The VAX instruction set has a variable length instruction format which
- * may be as short as one byte and as long as needed depending on the type
- * of instruction. [...] Each instruction consists of an opcode followed
- * by zero to six operand specifiers whose number and type depend on the
- * opcode. All operand specifiers are, themselves, of the same format --
- * i.e. an address mode plus additional information.
- *
- * [VAX Architecture Handbook, p.52: Instruction Format]
- * two-byte instruction set from
- * [VAX Architecture Reference Manual, appendix A: Opcode Assignments]
- */
-
-/*
- * argdesc describes each arguments by two characters denoting
- * the access-type and the data-type.
- *
- * Arguments (Access-Types):
- * r: operand is read only
- * w: operand is written only
- * m: operand is modified (both R and W)
- * b: no operand reference. Branch displacement is specified.
- * a: calculate the address of the specified operand
- * v: if not "Rn", same as a. If "RN," R[n+1]R[n]
- * Arguments (Data-Types):
- * b: Byte
- * w: Word
- * l: Longword
- * q: Quadword
- * o: Octaword
- * d: D_floating
- * f: F_floating
- * g: G_floating
- * h: H_floating
- * r: Register
- * x: first data type specified by instruction
- * y: second data type spcified by instructin
- * -: no-args
- * ?: unknown (variable?)
- */
-
-typedef struct vax_instr_t {
- char *mnemonic;
- char *argdesc;
-} vax_instr_t;
-
-/* one-byte instructions */
-extern vax_instr_t vax_inst[];
-
-/* two-byte instructions */
-
-/*
- * reasonably simple macro to gather all the reserved two-byte opcodes
- * into only a few table entries...
- */
-#define INDEX_OPCODE(x) \
- (((x) & 0xff00) == 0xfe00) ? 0 : \
- ((x) < 0xfd30) ? 0 : \
- ((x) < 0xfd80) ? (x) - 0xfd30 : \
- ((x) == 0xfd98) ? 0x50 : \
- ((x) == 0xfd99) ? 0x51 : \
- ((x) == 0xfdf6) ? 0x52 : \
- ((x) == 0xfdf7) ? 0x53 : \
- ((x) == 0xfffd) ? 0x54 : \
- ((x) == 0xfffe) ? 0x55 : 0
-
-extern vax_instr_t vax_inst2[];
diff --git a/sys/arch/vax/vax/db_machdep.c b/sys/arch/vax/vax/db_machdep.c
deleted file mode 100644
index 9b2cbdb6a2b..00000000000
--- a/sys/arch/vax/vax/db_machdep.c
+++ /dev/null
@@ -1,440 +0,0 @@
-/* $OpenBSD: db_machdep.c,v 1.20 2016/02/27 13:08:07 mpi Exp $ */
-/* $NetBSD: db_machdep.c,v 1.17 1999/06/20 00:58:23 ragge Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- *
- * db_interface.c,v 2.4 1991/02/05 17:11:13 mrt (CMU)
- *
- * VAX enhancements by cmcmanis@mcmanis.com no rights reserved :-)
- *
- */
-
-/*
- * Interface to new debugger.
- * Taken from i386 port and modified for vax.
- */
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/reboot.h>
-#include <sys/systm.h> /* just for boothowto --eichin */
-
-#include <uvm/uvm_extern.h>
-
-#include <dev/cons.h>
-
-#include <machine/db_machdep.h>
-#include <machine/trap.h>
-#include <machine/frame.h>
-#include <machine/pcb.h>
-#include <machine/cpu.h>
-#include <machine/../vax/gencons.h>
-
-#include <ddb/db_sym.h>
-#include <ddb/db_command.h>
-#include <ddb/db_output.h>
-#include <ddb/db_extern.h>
-#include <ddb/db_access.h>
-#include <ddb/db_interface.h>
-#include <ddb/db_var.h>
-#include <ddb/db_variables.h>
-
-extern label_t *db_recover;
-
-void kdbprinttrap(int, int);
-
-int db_active = 0;
-db_regs_t ddb_regs; /* register state */
-
-extern int qdpolling;
-static int splsave; /* IPL before entering debugger */
-
-/*
- * VAX Call frame on the stack, this from
- * "Computer Programming and Architecture, The VAX-11"
- * Henry Levy & Richard Eckhouse Jr.
- * ISBN 0-932376-07-X
- */
-typedef struct __vax_frame {
- u_int vax_cond; /* condition handler */
- u_int vax_psw:16; /* 16 bit processor status word */
- u_int vax_regs:12; /* Register save mask. */
- u_int vax_zero:1; /* Always zero */
- u_int vax_calls:1; /* True if CALLS, false if CALLG */
- u_int vax_spa:2; /* Stack pointer alignment */
- u_int *vax_ap; /* argument pointer */
- struct __vax_frame *vax_fp; /* frame pointer of previous frame */
- u_int vax_pc; /* program counter */
- u_int vax_args[1]; /* 0 or more arguments */
-} VAX_CALLFRAME;
-
-/*
- * DDB is called by either <ESC> - D on keyboard, via a TRACE or
- * BPT trap or from kernel, normally as a result of a panic.
- * If it is the result of a panic, set the ddb register frame to
- * contain the registers when panic was called. (easy to debug).
- */
-void
-db_ktrap(frame)
- struct trapframe *frame;
-{
- int s;
-
- switch (frame->trap) {
- case T_BPTFLT: /* breakpoint */
- case T_TRCTRAP: /* single_step */
- break;
-
- /* XXX todo: should be migrated to use VAX_CALLFRAME at some point */
- case T_KDBTRAP:
- if (panicstr) {
- struct callsframe *pf, *df;
-
- df = (void *)frame->fp; /* start of debug's calls */
- pf = (void *)df->ca_fp; /* start of panic's calls */
- bcopy(&pf->ca_argno, &ddb_regs.r0, sizeof(int) * 12);
- ddb_regs.fp = pf->ca_fp;
- ddb_regs.pc = pf->ca_pc;
- ddb_regs.ap = pf->ca_ap;
- ddb_regs.sp = (unsigned)pf;
- ddb_regs.psl = frame->psl & ~0x1fffe0;
- ddb_regs.psl |= pf->ca_maskpsw & 0xffe0;
- ddb_regs.psl |= (splsave << 16);
- }
- break;
-
- default:
- if ((boothowto & RB_KDB) == 0)
- return;
-
- kdbprinttrap(frame->trap, frame->code);
- if (db_recover != 0) {
- db_error("Faulted in DDB; continuing...\n");
- /*NOTREACHED*/
- }
- }
-
- if (!panicstr)
- bcopy(frame, &ddb_regs, sizeof(struct trapframe));
-
- /* XXX Should switch to interrupt stack here, if needed. */
-
- s = splhigh();
- db_active++;
- cnpollc(TRUE);
- db_trap(frame->trap, frame->code);
- cnpollc(FALSE);
- db_active--;
- splx(s);
-
- if (!panicstr)
- bcopy(&ddb_regs, frame, sizeof(struct trapframe));
- frame->sp = mfpr(PR_USP);
-}
-
-extern char *traptypes[];
-extern int no_traps;
-
-/*
- * Print trap reason.
- */
-void
-kdbprinttrap(type, code)
- int type, code;
-{
- db_printf("kernel: ");
- if (type >= no_traps || type < 0)
- db_printf("type %d", type);
- else
- db_printf("%s", traptypes[type]);
- db_printf(" trap, code=%x\n", code);
-}
-
-/*
- * Read bytes from kernel address space for debugger.
- */
-void
-db_read_bytes(addr, size, data)
- db_addr_t addr;
- size_t size;
- char *data;
-{
- bcopy((caddr_t)addr, data, size);
-}
-
-/*
- * Write bytes to kernel address space for debugger.
- */
-void
-db_write_bytes(addr, size, data)
- db_addr_t addr;
- size_t size;
- char *data;
-{
- memcpy((caddr_t)addr, data, size);
-}
-
-void
-Debugger()
-{
- splsave = _splset(0xe);
- mtpr(0xf, PR_SIRR); /* beg for debugger */
- splx(splsave);
-}
-
-/*
- * Machine register set.
- */
-struct db_variable db_regs[] = {
- {"r0", (long *)&ddb_regs.r0, FCN_NULL},
- {"r1", (long *)&ddb_regs.r1, FCN_NULL},
- {"r2", (long *)&ddb_regs.r2, FCN_NULL},
- {"r3", (long *)&ddb_regs.r3, FCN_NULL},
- {"r4", (long *)&ddb_regs.r4, FCN_NULL},
- {"r5", (long *)&ddb_regs.r5, FCN_NULL},
- {"r6", (long *)&ddb_regs.r6, FCN_NULL},
- {"r7", (long *)&ddb_regs.r7, FCN_NULL},
- {"r8", (long *)&ddb_regs.r8, FCN_NULL},
- {"r9", (long *)&ddb_regs.r9, FCN_NULL},
- {"r10", (long *)&ddb_regs.r10, FCN_NULL},
- {"r11", (long *)&ddb_regs.r11, FCN_NULL},
- {"ap", (long *)&ddb_regs.ap, FCN_NULL},
- {"fp", (long *)&ddb_regs.fp, FCN_NULL},
- {"sp", (long *)&ddb_regs.sp, FCN_NULL},
- {"pc", (long *)&ddb_regs.pc, FCN_NULL},
- {"psl", (long *)&ddb_regs.psl, FCN_NULL},
-};
-struct db_variable *db_eregs = db_regs + nitems(db_regs);
-
-#define IN_USERLAND(x) (((u_int)(x) & 0x80000000) == 0)
-
-/*
- * Dump a stack traceback. Takes two arguments:
- * fp - CALL FRAME pointer
- * stackbase - Lowest stack value
- */
-static void
-db_dump_stack(VAX_CALLFRAME *fp, u_int stackbase, int (*pr)(const char *, ...))
-{
- u_int nargs, arg_base, regs;
- VAX_CALLFRAME *tmp_frame;
- db_expr_t diff;
- db_sym_t sym;
- char *symname;
-
- (*pr)("Stack traceback : \n");
- if (IN_USERLAND(fp)) {
- (*pr)(" Process is executing in user space.\n");
- return;
- }
-
- while ((u_int)(fp->vax_fp) > stackbase &&
- (u_int)(fp->vax_fp) <= (stackbase + USPACE)) {
- diff = INT_MAX;
- symname = NULL;
- sym = db_search_symbol(fp->vax_pc, DB_STGY_ANY, &diff);
- db_symbol_values(sym, &symname, 0);
- (*pr)("%s+0x%lx(", symname, diff);
-
- /*
- * Figure out the arguments by using a bit of subtlety.
- * As the argument pointer may have been used as a temporary
- * by the callee ... recreate what it would have pointed to
- * as follows:
- * The vax_regs value has a 12 bit bitmask of the registers
- * that were saved on the stack.
- * Store that in 'regs' and then for every bit that is
- * on (indicates the register contents are on the stack)
- * increment the argument base (arg_base) by one.
- * When that is done, args[arg_base] points to the longword
- * that identifies the number of arguments.
- * arg_base+1 - arg_base+n are the argument pointers/contents.
- */
-
- /* First get the frame that called this function ... */
- tmp_frame = fp->vax_fp;
-
- /* Isolate the saved register bits, and count them */
- regs = tmp_frame->vax_regs;
- for (arg_base = 0; regs != 0; regs >>= 1) {
- if (regs & 1)
- arg_base++;
- }
-
- /* number of arguments is then pointed to by vax_args[arg_base] */
- nargs = tmp_frame->vax_args[arg_base];
- if (nargs) {
- nargs--; /* reduce by one for formatting niceties */
- arg_base++; /* skip past the actual number of arguments */
- while (nargs--)
- (*pr)("0x%x,", tmp_frame->vax_args[arg_base++]);
-
- /* now print out the last arg with closing brace and \n */
- (*pr)("0x%x)\n", tmp_frame->vax_args[arg_base]);
- } else
- (*pr)("void)\n");
- /* move to the next frame */
- fp = fp->vax_fp;
- }
-}
-
-/*
- * Implement the trace command which has the form:
- *
- * trace <-- Trace panic (same as before)
- * trace 0x88888 <-- Trace process whose address is 888888
- * trace/t <-- Trace current process (0 if no current proc)
- * trace/t 0tnn <-- Trace process nn (0t for decimal)
- */
-void
-db_stack_trace_print(addr, have_addr, count, modif, pr)
- db_expr_t addr; /* Address parameter */
- boolean_t have_addr; /* True if addr is valid */
- db_expr_t count; /* Optional count */
- char *modif; /* pointer to flag modifier 't' */
- int (*pr)(const char *, ...);
-{
- extern vaddr_t proc0paddr, istack;
- struct proc *p = curproc;
- struct user *uarea;
- int trace_proc;
- pid_t curpid;
- char *s;
-
- /* Check to see if we're tracing a process */
- trace_proc = 0;
- s = modif;
- while (!trace_proc && *s) {
- if (*s++ == 't')
- trace_proc++; /* why yes we are */
- }
-
- /* Trace a panic */
- if (! trace_proc) {
- if (have_addr == 0)
- db_dump_stack((VAX_CALLFRAME *)ddb_regs.fp,
- ddb_regs.ap, pr);
- else
- db_dump_stack((VAX_CALLFRAME *)addr, istack, pr);
- return;
- }
-
- /*
- * If user typed an address its either a PID, or a Frame
- * if no address then either current proc or panic
- */
- if (have_addr) {
- p = pfind((int)addr);
- /* Try to be helpful by looking at it as if it were decimal */
- if (p == NULL) {
- u_int tpid = 0;
- u_int foo = addr;
-
- while (foo != 0) {
- int digit = (foo >> 28) & 0xf;
- if (digit > 9) {
- (*pr)(" No such process.\n");
- return;
- }
- tpid = tpid * 10 + digit;
- foo = foo << 4;
- }
- p = pfind(tpid);
- if (p == NULL) {
- (*pr)(" No such process.\n");
- return;
- }
- }
- } else {
- p = curproc;
- if (p == NULL) {
- (*pr)("trace: no current process! (ignored)\n");
- return;
- }
- }
- if (p == NULL) {
- uarea = (struct user *)proc0paddr;
- curpid = 0;
- } else {
- uarea = p->p_addr;
- curpid = p->p_pid;
- }
- (*pr)("Process %d\n", curpid);
- (*pr)(" PCB contents:\n");
- (*pr)(" KSP = 0x%x\n", (unsigned int)(uarea->u_pcb.KSP));
- (*pr)(" ESP = 0x%x\n", (unsigned int)(uarea->u_pcb.ESP));
- (*pr)(" SSP = 0x%x\n", (unsigned int)(uarea->u_pcb.SSP));
- (*pr)(" USP = 0x%x\n", (unsigned int)(uarea->u_pcb.USP));
- (*pr)(" R[00] = 0x%08x R[06] = 0x%08x\n",
- (unsigned int)(uarea->u_pcb.R[0]), (unsigned int)(uarea->u_pcb.R[6]));
- (*pr)(" R[01] = 0x%08x R[07] = 0x%08x\n",
- (unsigned int)(uarea->u_pcb.R[1]), (unsigned int)(uarea->u_pcb.R[7]));
- (*pr)(" R[02] = 0x%08x R[08] = 0x%08x\n",
- (unsigned int)(uarea->u_pcb.R[2]), (unsigned int)(uarea->u_pcb.R[8]));
- (*pr)(" R[03] = 0x%08x R[09] = 0x%08x\n",
- (unsigned int)(uarea->u_pcb.R[3]), (unsigned int)(uarea->u_pcb.R[9]));
- (*pr)(" R[04] = 0x%08x R[10] = 0x%08x\n",
- (unsigned int)(uarea->u_pcb.R[4]), (unsigned int)(uarea->u_pcb.R[10]));
- (*pr)(" R[05] = 0x%08x R[11] = 0x%08x\n",
- (unsigned int)(uarea->u_pcb.R[5]), (unsigned int)(uarea->u_pcb.R[11]));
- (*pr)(" AP = 0x%x\n", (unsigned int)(uarea->u_pcb.AP));
- (*pr)(" FP = 0x%x\n", (unsigned int)(uarea->u_pcb.FP));
- (*pr)(" PC = 0x%x\n", (unsigned int)(uarea->u_pcb.PC));
- (*pr)(" PSL = 0x%x\n", (unsigned int)(uarea->u_pcb.PSL));
- (*pr)(" Trap frame pointer: 0x%x\n",
- (unsigned int)(uarea->u_pcb.framep));
- db_dump_stack((VAX_CALLFRAME *)(uarea->u_pcb.FP),
- (u_int)uarea->u_pcb.KSP, pr);
-}
-
-static int ddbescape = 0;
-
-int
-kdbrint(tkn)
- int tkn;
-{
-
- if (ddbescape && ((tkn & 0x7f) == 'D')) {
- if (db_console)
- mtpr(0xf, PR_SIRR);
- ddbescape = 0;
- return 1;
- }
-
- if ((ddbescape == 0) && ((tkn & 0x7f) == 27)) {
- ddbescape = 1;
- return 1;
- }
-
- if (ddbescape) {
- ddbescape = 0;
- return 2;
- }
-
- ddbescape = 0;
- return 0;
-}
-
diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c
deleted file mode 100644
index 0d2a4c352b6..00000000000
--- a/sys/arch/vax/vax/disksubr.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* $OpenBSD: disksubr.c,v 1.67 2015/09/28 15:17:08 krw Exp $ */
-/* $NetBSD: disksubr.c,v 1.21 1999/06/30 18:48:06 ragge Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1988 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.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/disklabel.h>
-#include <sys/syslog.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/disk.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/macros.h>
-#include <machine/pte.h>
-#include <machine/pcb.h>
-#include <machine/cpu.h>
-
-#include <vax/mscp/mscp.h> /* For disk encoding scheme */
-
-/*
- * Attempt to read a disk label from a device
- * using the indicated strategy routine.
- * The label must be partly set up before this:
- * secpercyl and anything required in the strategy routine
- * (e.g., sector size) must be filled in before calling us.
- */
-int
-readdisklabel(dev_t dev, void (*strat)(struct buf *),
- struct disklabel *lp, int spoofonly)
-{
- struct buf *bp = NULL;
- char error;
-
- if ((error = initdisklabel(lp)))
- goto done;
-
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
-
- DL_SETBSTART(lp, 16);
-
- if (spoofonly)
- goto done;
-
- error = readdisksector(bp, strat, lp, DL_BLKTOSEC(lp, LABELSECTOR));
- if (error)
- goto done;
-
- error = checkdisklabel(bp->b_data + LABELOFFSET, lp,
- 16, DL_GETDSIZE(lp));
- if (error == 0)
- goto done;
-
-#if defined(CD9660)
- error = iso_disklabelspoof(dev, strat, lp);
- if (error == 0)
- goto done;
-#endif
-#if defined(UDF)
- error = udf_disklabelspoof(dev, strat, lp);
- if (error == 0)
- goto done;
-#endif
-
-done:
- if (bp) {
- bp->b_flags |= B_INVAL;
- brelse(bp);
- }
- disk_change = 1;
- return (error);
-}
-
-/*
- * Write disk label back to device after modification.
- * Always allow writing of disk label; even if the disk is unlabeled.
- */
-int
-writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp)
-{
- struct buf *bp = NULL;
- struct disklabel *dlp;
- int error = 0;
-
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
-
- /* Read it in, slap the new label in, and write it back out */
- error = readdisksector(bp, strat, lp, DL_BLKTOSEC(lp, LABELSECTOR));
- if (error)
- goto done;
-
- dlp = (struct disklabel *)(bp->b_data + LABELOFFSET);
- *dlp = *lp;
- CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
- SET(bp->b_flags, B_BUSY | B_WRITE | B_RAW);
- (*strat)(bp);
- error = biowait(bp);
-
-done:
- if (bp) {
- bp->b_flags |= B_INVAL;
- brelse(bp);
- }
- disk_change = 1;
- return (error);
-}
-
-/*
- * Print out the name of the device; ex. TK50, RA80. DEC uses a common
- * disk type encoding scheme for most of its disks.
- */
-void
-disk_printtype(int unit, int type)
-{
- printf(" drive %d: %c%c", unit, (int)MSCP_MID_CHAR(2, type),
- (int)MSCP_MID_CHAR(1, type));
- if (MSCP_MID_ECH(0, type))
- printf("%c", (int)MSCP_MID_CHAR(0, type));
- printf("%d\n", MSCP_MID_NUM(type));
-}
diff --git a/sys/arch/vax/vax/emulate.s b/sys/arch/vax/vax/emulate.s
deleted file mode 100644
index 8626606bf8b..00000000000
--- a/sys/arch/vax/vax/emulate.s
+++ /dev/null
@@ -1,1267 +0,0 @@
-/* $OpenBSD: emulate.s,v 1.5 2013/07/05 21:11:57 miod Exp $ */
-/* $NetBSD: emulate.s,v 1.2 1997/03/15 16:14:25 ragge Exp $ */
-/*
- * Copyright (c) 1986, 1987 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mt. Xinu.
- *
- * 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.
- *
- * @(#)emulate.s 7.5 (Berkeley) 6/28/90
- */
-
-#include <machine/asm.h>
-
-/*
- * String instruction emulation - MicroVAX only. These routines are called
- * from locore.s when an "emulate" fault occurs on the MicroVAX. They are
- * called with the stack set up as follows:
- *
- * (sp): Return address of trap handler
- * 4(sp): Instruction Opcode (also holds PSL result from emulator)
- * 8(sp): Instruction PC
- * 12(sp): Operand 1
- * 16(sp): Operand 2
- * 20(sp): Operand 3
- * 24(sp): Operand 4
- * 28(sp): Operand 5
- * 32(sp): Operand 6
- * 36(sp): old Register 11
- * 40(sp): old Register 10
- * 44(sp): Return PC
- * 48(sp): Return PSL
- * 52(sp): TOS before instruction
- *
- * R11 and r10 are available for use. If any routine needs to use r9-r1
- * they need to save them first (unless those registers are SUPPOSED to be
- * messed with by the "instruction"). These routines leave their results
- * in registers 0-5 explicitly, as needed, and use the macros defined below
- * to link up with calling routine.
- */
-
-#define return rsb
-#define savepsl movpsl 4(%sp)
-#define setpsl(reg) movl reg,4(%sp)
-#define overflowpsl movl $2,4(%sp)
-#define arg1 12(%sp)
-#define arg2 16(%sp)
-#define arg3 20(%sp)
-#define arg4 24(%sp)
-#define arg5 28(%sp)
-#define arg6 32(%sp)
-#define argub(num,reg) movzbl 8+4*num(%sp),reg
-#define arguw(num,reg) movzwl 8+4*num(%sp),reg
-#define argul(num,reg) movl 8+4*num(%sp),reg
-#define argb(num,reg) cvtbl 8+4*num(%sp),reg
-#define argw(num,reg) cvtwl 8+4*num(%sp),reg
-#define argl(num,reg) movl 8+4*num(%sp),reg
-#define toarg(reg,num) movl reg,8+4*num(%sp)
-
-
- .text
- _ALIGN_TEXT
-ALTENTRY(EMcrc)
- argl(1,%r11) # (1) table address == r11
- argl(2,%r0) # (2) initial crc == r0
- argl(4,%r3) # (4) source address == r3
- arguw(3,%r2) # (3) source length == r2
- jeql Lcrc_out
-Lcrc_loop:
- xorb2 (%r3)+,%r0
- extzv $0,$4,%r0,%r10
- extzv $4,$28,%r0,%r1
- xorl3 %r1,(%r11)[%r10],%r0
- extzv $0,$4,%r0,%r10
- extzv $4,$28,%r0,%r1
- xorl3 %r1,(%r11)[%r10],%r0
- sobgtr %r2,Lcrc_loop
- tstl %r0
-Lcrc_out:
- savepsl
- clrl %r1
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMmovtc)
- arguw(1,%r0) # (1) source length == r0
- argl(2,%r1) # (2) source address == r1
- argub(3,%r11) # (3) fill character == r11
- argl(4,%r3) # (4) table address == r3
- argl(6,%r5) # (6) destination address == r5
- arguw(5,%r4) # (5) destination length == r4
- jeql Lmovtc_out
-Lmovtc_loop:
- tstl %r0
- jeql Lmovtc_2loop
- movzbl (%r1)+,%r2
- movb (%r3)[%r2],(%r5)+
- decl %r0
- sobgtr %r4,Lmovtc_loop
- jbr Lmovtc_out
-Lmovtc_2loop:
- movb %r11,(%r5)+
- sobgtr %r4,Lmovtc_2loop
-Lmovtc_out:
- cmpl %r4,%r0
- savepsl
- clrl %r2
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMmovtuc)
- arguw(1,%r0) # (1) source length == r0
- argl(2,%r1) # (2) source address == r1
- argub(3,%r11) # (3) escape character == r11
- argl(4,%r3) # (4) table address == r3
- argl(6,%r5) # (6) destination address == r5
- arguw(5,%r4) # (5) destination length == r4
- jeql Lmovtuc_out
-Lmovtuc_loop:
- tstl %r0
- jeql Lmovtuc_out
- movzbl (%r1),%r2
- movzbl (%r3)[%r2],%r2
- cmpl %r2,%r11
- jeql Lmovtuc_out
- movzbl (%r1)+,%r2
- movb (%r3)[%r2],(%r5)+
- decl %r0
- sobgtr %r4,Lmovtuc_loop
-Lmovtuc_out:
- cmpl %r4,%r0
- savepsl
- clrl %r2
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMmatchc)
- argl(2,%r10) # (2) substring address == r10
- arguw(3,%r2) # (3) source length == r2
- argl(4,%r3) # (4) source address == r3
- arguw(1,%r11) # (1) substring length == r11
- jeql Lmatchc_out # temp source address == r1
- addl2 %r10,%r11 # temp substring address == r0
- tstl %r2
- jeql Lmatchc_out
-Lmatchc_loop:
- cmpb (%r10),(%r3)
- jneq Lmatchc_fail
- movl %r3,%r1
- movl %r10,%r0
-Lmatchc_2loop:
- cmpl %r0,%r11
- jeql Lmatchc_succ
- cmpb (%r0)+,(%r1)+
- jeql Lmatchc_2loop
-Lmatchc_fail:
- incl %r3
- sobgtr %r2,Lmatchc_loop
- movl %r10,%r1
- subl3 %r10,%r11,%r0
- jbr Lmatchc_out
-Lmatchc_succ:
- movl %r1,%r3
- movl %r11,%r1
- clrl %r0
-Lmatchc_out:
- savepsl
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMspanc)
- argl(2,%r1) # (2) string address == r1
- argub(4,%r2) # (4) character-mask == r2
- argl(3,%r3) # (3) table address == r3
- arguw(1,%r0) # (1) string length == r0
- jeql Lspanc_out
-Lspanc_loop:
- movzbl (%r1),%r11
- mcomb (%r3)[%r11],%r11
- bicb3 %r11,%r2,%r11
- jeql Lspanc_out
- incl %r1
- sobgtr %r0,Lspanc_loop
-Lspanc_out:
- savepsl
- clrl %r2
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMscanc)
- argl(2,%r1) # (2) string address == r1
- argub(4,%r2) # (4) character-mask == r2
- argl(3,%r3) # (3) table address == r3
- arguw(1,%r0) # (1) string length == r0
- jeql Lscanc_out
-Lscanc_loop:
- movzbl (%r1),%r11
- mcomb (%r3)[%r11],%r11
- bicb3 %r11,%r2,%r11
- jneq Lscanc_out
- incl %r1
- sobgtr %r0,Lscanc_loop
-Lscanc_out:
- savepsl
- clrl %r2
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMskpc)
- argub(1,%r11) # (1) character == r11
- argl(3,%r1) # (3) string address == r1
- arguw(2,%r0) # (2) string length == r0
- jeql Lskpc_out # forget zero length strings
-Lskpc_loop:
- cmpb (%r1),%r11
- jneq Lskpc_out
- incl %r1
- sobgtr %r0,Lskpc_loop
-Lskpc_out:
- tstl %r0 # be sure of condition codes
- savepsl
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMlocc)
- argub(1,%r11) # (1) character == r11
- argl(3,%r1) # (3) string address == r1
- arguw(2,%r0) # (2) string length == r0
- jeql Lskpc_out # forget zero length strings
-Llocc_loop:
- cmpb (%r1),%r11
- jeql Llocc_out
- incl %r1
- sobgtr %r0,Llocc_loop
-Llocc_out:
- tstl %r0 # be sure of condition codes
- savepsl
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMcmpc3)
- argl(2,%r1) # (2) string1 address == r1
- argl(3,%r3) # (3) string2 address == r3
- arguw(1,%r0) # (1) strings length == r0
- jeql Lcmpc3_out
-Lcmpc3_loop:
- cmpb (%r1),(%r3)
- jneq Lcmpc3_out
- incl %r1
- incl %r3
- sobgtr %r0,Lcmpc3_loop
-Lcmpc3_out:
- savepsl
- movl %r0,%r2
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMcmpc5)
- argl(2,%r1) # (2) string1 address == r1
- argub(3,%r11) # (1) fill character == r11
- arguw(4,%r2) # (1) string2 length == r2
- argl(5,%r3) # (3) string2 address == r3
- arguw(1,%r0) # (1) string1 length == r0
- jeql Lcmpc5_str2
-Lcmpc5_loop:
- tstl %r2
- jeql Lcmpc5_str1loop
- cmpb (%r1),(%r3)
- jneq Lcmpc5_out
- incl %r1
- incl %r3
- decl %r2
- sobgtr %r0,Lcmpc5_loop
-Lcmpc5_str2:
- tstl %r2
- jeql Lcmpc5_out
-Lcmpc5_str2loop:
- cmpb %r11,(%r3)
- jneq Lcmpc5_out
- incl %r3
- sobgtr %r2,Lcmpc5_str2loop
- jbr Lcmpc5_out
-Lcmpc5_str1loop:
- cmpb (%r1),%r11
- jneq Lcmpc5_out
- incl %r1
- sobgtr %r0,Lcmpc5_str1loop
-Lcmpc5_out:
- savepsl
- return
-
-
-/*
- * Packed Decimal string operations
- */
-
-#define POSITIVE $12
-#define NEGATIVE $13
-#define NEGATIVEalt $11
-
-
- _ALIGN_TEXT
-ALTENTRY(EMaddp4)
- toarg(%r9,6) # save register r9 in arg6 spot
- arguw(1,%r11) # (1) source length == r11
- argl(2,%r10) # (2) source address == r10
- arguw(3,%r9) # (3) destination length == r9
- argl(4,%r3) # (4) destination address == r3
- ashl $-1,%r11,%r11
- addl2 %r11,%r10 # source address of LSNibble
- incl %r11 # source length is in bytes
- ashl $-1,%r9,%r9
- addl2 %r9,%r3 # r3 = destination address of LSNibble
- incl %r9 # destination length is in bytes
- toarg(%r3,5)
- extzv $0,$4,(%r3),%r2 # set standard +/- indicators in destination
- cmpl %r2,NEGATIVE
- jeql L112
- cmpl %r2,NEGATIVEalt
- jeql L111
- insv POSITIVE,$0,$4,(%r3)
- jbr L112
-L111:
- insv NEGATIVE,$0,$4,(%r3)
-L112:
- extzv $0,$4,(%r10),%r2 # r2 = standard +/- of source
- cmpl %r2,NEGATIVE
- jeql L114
- cmpl %r2,NEGATIVEalt
- jeql L113
- movl POSITIVE,%r2
- jbr L114
-L113:
- movl NEGATIVE,%r2
-L114:
- cmpl %r11,%r9 # if source is longer than destination
- jleq L115
- movl %r9,%r11 # set source length == destination length
-L115:
- extzv $4,$4,(%r3),%r9 # r9 = LSDigit of destination
- extzv $4,$4,(%r10),%r1 # r1 = LSDigit of source
- extzv $0,$4,(%r3),%r0
- cmpl %r0,%r2 # if signs of operands are not equal
- jeql Laddp4_same # do a subtraction
- clrl %r2 # r2 is non-zero if result is non-zero
- subl2 %r1,%r9 # r9 = "addition" of operands high nibble
- jbr L119 # jump into addition loop
-Laddp4_diff_loop:
- decl %r3
- extzv $0,$4,(%r3),%r0
- addl2 %r0,%r1 # r1 = carry + next (low) nibble of source
- decl %r10
- extzv $0,$4,(%r10),%r0
- subl2 %r0,%r1 # r1 -= next (low) nibble of destination
- jgeq L121 # if negative result
- mnegl $1,%r9 # r9 == carry = -1
- addl2 $10,%r1 # r1 == result += 10
- jbr L122 # else
-L121:
- clrl %r9 # r9 == carry = 0
-L122:
- insv %r1,$0,$4,(%r3) # store result low nibble
- bisl2 %r1,%r2
- extzv $4,$4,(%r3),%r0
- addl2 %r0,%r9 # r9 = carry + next (high) nibble of source
- extzv $4,$4,(%r10),%r0
- subl2 %r0,%r9 # r9 -= next (high) nibble of destination
-L119:
- jgeq L117 # if negative result
- mnegl $1,%r1 # r1 == carry = -1
- addl2 $10,%r9 # r9 == result += 10
- jbr L118 # else
-L117:
- clrl %r1 # r1 == carry = 0
-L118:
- insv %r9,$4,$4,(%r3) # store result high nibble
- bisl2 %r9,%r2 # r2 is non-zero if result is non-zero
- decl %r11 # while (--source length)
- jneq Laddp4_diff_loop
- argl(4,%r10) # r10 = address of destination MSNibble
- jbr Laddp4_diff_carry
-Laddp4_diff_carlop:
- decl %r3
- extzv $0,$4,(%r3),%r0
- addl2 %r0,%r1 # r1 == carry += next (low) nibble
- jgeq L127 # if less than zero
- movl %r1,%r9 # r9 == carry (must be -1)
- movl $9,%r1 # r1 == result = 9
- jbr L128
-L127: # else
- clrl %r9 # r9 == carry = 0
-L128:
- insv %r1,$0,$4,(%r3) # store result
- bisl2 %r1,%r2
- extzv $4,$4,(%r3),%r0
- addl2 %r0,%r9 # r9 == carry += next (high) nibble
- jgeq L129 # if less than zero
- movl %r9,%r1 # r1 == carry (must be -1)
- movl $9,%r9 # r9 == result = 9
- jbr L130
-L129:
- clrl %r1
-L130:
- insv %r9,$4,$4,(%r3) # store result
- bisl2 %r9,%r2
-Laddp4_diff_carry:
- cmpl %r3,%r10
- jneq Laddp4_diff_carlop
- tstl %r1 # if carry out of MSN then fix up result
- jeql Laddp4_add_done
- argl(5,%r3) # r3 == address of LSN of destination
- extzv $0,$4,(%r3),%r0
- cmpl %r0,NEGATIVE # switch sign of result
- jneq L132
- insv POSITIVE,$0,$4,(%r3)
- jbr L133
-L132:
- insv NEGATIVE,$0,$4,(%r3)
-L133:
- extzv $4,$4,(%r3),%r0 # normalize result (carry out of MSN into LSN)
- subl3 %r0,$10,%r9 # r9 = 10 - destination LSNibble
- jbr L134
-L137:
- movl $9,%r1
-Laddp4_diff_norm:
- insv %r9,$4,$4,(%r3)
- cmpl %r3,%r10 # while (not at MSNibble)
- jeql Laddp4_add_done
- decl %r3
- extzv $0,$4,(%r3),%r0 # low nibble = (9 + carry) - low nibble
- subl2 %r0,%r1
- cmpl %r1,$9
- jleq L135
- clrl %r1
- movl $10,%r9
- jbr L136
-L135:
- movl $9,%r9
-L136:
- insv %r1,$0,$4,(%r3)
- extzv $4,$4,(%r3),%r0 # high nibble = (9 + carry) - high nibble
- subl2 %r0,%r9
-L134:
- cmpl %r9,$9
- jleq L137
- clrl %r9
- movl $10,%r1
- jbr Laddp4_diff_norm
-
-Laddp4_same: # operands are of the same sign
- clrl %r2
- addl2 %r1,%r9
- jbr L139
-Laddp4_same_loop:
- decl %r3
- extzv $0,$4,(%r3),%r0
- addl2 %r0,%r1 # r1 == carry += next (low) nibble of dest
- decl %r10
- extzv $0,$4,(%r10),%r0
- addl2 %r0,%r1 # r1 += next (low) nibble of source
- cmpl %r1,$9 # if result > 9
- jleq L141
- movl $1,%r9 # r9 == carry = 1
- subl2 $10,%r1 # r1 == result -= 10
- jbr L142
-L141: # else
- clrl %r9 # r9 == carry = 0
-L142:
- insv %r1,$0,$4,(%r3) # store result
- bisl2 %r1,%r2
- extzv $4,$4,(%r10),%r0
- addl2 %r0,%r9 # ditto for high nibble
- extzv $4,$4,(%r3),%r0
- addl2 %r0,%r9
-L139:
- cmpl %r9,$9
- jleq L143
- movl $1,%r1
- subl2 $10,%r9
- jbr L144
-L143:
- clrl %r1
-L144:
- insv %r9,$4,$4,(%r3)
- bisl2 %r9,%r2
- sobgtr %r11,Laddp4_same_loop # while (--source length)
- argl(4,%r10) # r10 = destination address of MSNibble
- jbr Laddp4_same_carry
-Laddp4_same_cloop:
- decl %r3
- extzv $0,$4,(%r3),%r0 # propagate carry up to MSNibble of destination
- addl2 %r0,%r1
- cmpl %r1,$10
- jneq L147
- movl $1,%r9
- clrl %r1
- jbr L148
-L147:
- clrl %r9
-L148:
- insv %r1,$0,$4,(%r3)
- bisl2 %r1,%r2
- extzv $4,$4,(%r3),%r0
- addl2 %r0,%r9
- cmpl %r9,$10
- jneq L149
- movl $1,%r1
- clrl %r9
- jbr L150
-L149:
- clrl %r1
-L150:
- insv %r9,$4,$4,(%r3)
- bisl2 %r9,%r2
-Laddp4_same_carry:
- cmpl %r3,%r10
- jneq Laddp4_same_cloop
-
-Laddp4_add_done:
- argl(5,%r3) # r3 = destination address of LSNibble
- tstl %r2 # if zero result
- jneq L151
- savepsl # remember that for condition codes
- insv POSITIVE,$0,$4,(%r3) # make sure sign of result is positive
- jbr Laddp4_out
-L151: # else
- extzv $0,$4,(%r3),%r0
- cmpl %r0,NEGATIVE # if result is negative
- jneq Laddp4_out
- mnegl %r2,%r2 # remember THAT in Cond Codes
- savepsl
-Laddp4_out:
- argl(4,%r3)
- argl(2,%r1)
- clrl %r0
- clrl %r2
- argl(6,%r9) # restore r9 from stack
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMmovp)
- arguw(1,%r11) # (1) string length == r11
- argl(2,%r10) # (1) source address == r10
- argl(3,%r3) # (1) destination address == r3
- # we will need arg2 and arg3 later
- clrl %r2 # r2 == non-zero if source is non-zero
- ashl $-1,%r11,%r11 # length is number of bytes, not nibbles
- jeql Lmovp_zlen
-Lmovp_copy:
- bisb2 (%r10),%r2 # keep track of non-zero source
- movb (%r10)+,(%r3)+ # move two nibbles
- sobgtr %r11,Lmovp_copy # loop for length of source
-Lmovp_zlen:
- extzv $4,$4,(%r10),%r0 # look at least significant nibble
- bisl2 %r0,%r2
- extzv $0,$4,(%r10),%r0 # check sign nibble
- cmpl %r0,NEGATIVEalt
- jeql Lmovp_neg
- cmpl %r0,NEGATIVE
- jneq Lmovp_pos
-Lmovp_neg: # source was negative
- mnegl %r2,%r2
-Lmovp_pos:
- tstl %r2 # set condition codes
- savepsl
- jeql Lmovp_zero
- movb (%r10),(%r3) # move last byte if non-zero result
- jbr Lmovp_out
-Lmovp_zero:
- movb POSITIVE,(%r3) # otherwise, make result zero and positive
-Lmovp_out:
- clrl %r0
- argl(2,%r1)
- clrl %r2
- argl(3,%r3)
- return
-
-
-/*
- * Definitions for Editpc instruction
- *
- * Here are the commands and their corresponding hex values:
- *
- * EPend 0x00
- * EPend_float 0x01
- * EPclear_signif 0x02
- * EPset_signif 0x03
- * EPstore_sign 0x04
- * EPload_fill 0x40
- * EPload_sign 0x41
- * EPload_plus 0x42
- * EPload_minus 0x43
- * EPinsert 0x44
- * EPblank_zero 0x45
- * EPreplace_sign 0x46
- * EPadjust_input 0x47
- * EPfill 0x80
- * EPmove 0x90
- * EPfloat 0xa0
- *
- *
- * r4 is carved up as follows:
- *
- * -------------------------------------------
- * | N Z V C |
- * -------------------------------------------
- *
- * fill character is stuffed into arg5 space
- * sign character is stuffed into arg6 space
- */
-
-#define SIGNIFBIT $0
-#define setsignif bisl2 $1,%r4
-#define clsignif bicl2 $1,%r4
-#define OVERFLOWBIT $1
-#define setoverflow bisl2 $2,%r4
-#define cloverflow bicl2 $2,%r4
-#define ZEROBIT $2
-#define setzero bisl2 $4,%r4
-#define clzero bicl2 $4,%r4
-#define NEGATIVEBIT $3
-#define setnegative bisl2 $8,%r4
-#define clnegative bicl2 $8,%r4
-#define putfill movb arg5,(%r5)+
-#define setfill(reg) movb reg,arg5
-#define putsign movb arg6,(%r5)+
-#define setsign(reg) movb reg,arg6
-
-
- _ALIGN_TEXT
-ALTENTRY(EMeditpc)
- arguw(1,%r11) # (1) source length == r11
- argl(2,%r10) # (2) source address == r10
- argl(3,%r3) # (3) pattern address == r3
- argl(4,%r5) # (4) destination address == r5
-/* # we will need arg1 and arg2 later */
-/* # arg5 and arg6 are used for fill and sign - r0 is free */
- setfill($32) # fill character is ' '
- setsign($32) # sign character is ' '
- clrl %r4 # clear flags
- ashl $-1,%r11,%r11 # source length / 2
- addl3 %r11,%r10,%r2
- extzv $4,$4,(%r2),%r1 # r1 == least significant nibble of source
-L169:
- cmpl %r2,%r10
- jeql L170
- tstb -(%r2) # loop over source packed decimal number
- jeql L169
- incl %r1 # r1 is non-zero if source is non-zero
-L170:
- addl3 %r11,%r10,%r2
- tstl %r1
- jeql L172 # source is zero - set flags
- extzv $0,$4,(%r2),%r11
- cmpl %r11,NEGATIVEalt
- jeql L9998 # source is negative - set sign and flags
- cmpl %r11,NEGATIVE
- jneq L175
-L9998:
- setnegative
- setsign($45) # sign character is '-'
- jbr L175
-L172:
- setzero
-L175:
- arguw(1,%r2) # (1) source length == r2
-Ledit_case:
- movzbl (%r3)+,%r11 # get next edit command (pattern)
- cmpl %r11,$128
- jlss L180
- extzv $0,$4,%r11,%r1 # command has a "count" arg - into r1
- ashl $-4,%r11,%r11 # and shift over
-L180:
- jbc $6,%r11,L181 # "shift" those commands > 64 to 16 and up
- subl2 $48,%r11
-L181:
- caseb %r11,$0,$0x18 # "do" the command
- # r11 is available for use, r1 has "count" in it
-Lcaseb_label:
- .word Le_end - Lcaseb_label # 00
- .word Le_end_float - Lcaseb_label # 01
- .word Le_clear_signif - Lcaseb_label # 02
- .word Le_set_signif - Lcaseb_label # 03
- .word Le_store_sign - Lcaseb_label # 04
- .word Le_end - Lcaseb_label # 05
- .word Le_end - Lcaseb_label # 06
- .word Le_end - Lcaseb_label # 07
- .word Le_fill - Lcaseb_label # 80
- .word Le_move - Lcaseb_label # 90
- .word Le_float - Lcaseb_label # a0
- .word Le_end - Lcaseb_label # b0
- .word Le_end - Lcaseb_label # c0
- .word Le_end - Lcaseb_label # d0
- .word Le_end - Lcaseb_label # e0
- .word Le_end - Lcaseb_label # f0
- .word Le_load_fill - Lcaseb_label # 40
- .word Le_load_sign - Lcaseb_label # 41
- .word Le_load_plus - Lcaseb_label # 42
- .word Le_load_minus - Lcaseb_label # 43
- .word Le_insert - Lcaseb_label # 44
- .word Le_blank_zero - Lcaseb_label # 45
- .word Le_replace_sign - Lcaseb_label # 46
- .word Le_adjust_input - Lcaseb_label # 47
-Le_end:
- arguw(1,%r0)
- argl(2,%r1)
- clrl %r2
- decl %r3
- setpsl(%r4)
- clrl %r4
- return
-
-Le_end_float:
- jbs SIGNIFBIT,%r4,Ledit_case # if significance not set
- putsign # drop in the sign
- # fall into...
-Le_set_signif:
- setsignif
- jbr Ledit_case
-
-Le_clear_signif:
- clsignif
- jbr Ledit_case
-
-Le_store_sign:
- putsign
- jbr Ledit_case
-
-Le_load_fill:
- setfill((%r3)+)
- jbr Ledit_case
-
-Le_load_plus:
- jbs NEGATIVEBIT,%r4,Lpattern_inc # if non-negative
- # fall into...
-Le_load_sign:
- setsign((%r3)+)
- jbr Ledit_case
-
-Le_load_minus:
- jbs NEGATIVEBIT,%r4,Le_load_sign # if negative load the sign
- incl %r3 # else increment pattern
- jbr Ledit_case
-
-Le_insert:
- jbc SIGNIFBIT,%r4,L196 # if significance set, put next byte
- movb (%r3)+,(%r5)+
- jbr Ledit_case
-L196: # else put in fill character
- putfill
- # and throw away character in pattern
-Le_replace_sign: # we dont do anything with
-Lpattern_inc: # replace sign cause we dont
- incl %r3 # get negative zero
- jbr Ledit_case
-
-Le_blank_zero:
- jbc ZEROBIT,%r4,Lpattern_inc # if zero
- movzbl (%r3)+,%r11 # next byte is a count
- jeql Ledit_case
- subl2 %r11,%r5 # to back up over output and replace
-L200:
- putfill # with fill character
- sobgtr %r11,L200
- jbr Ledit_case
-
-Le_adjust_input:
- movzbl (%r3)+,%r0 # get count of nibbles from pattern
- subl3 %r2,%r0,%r11
- jgeq Ledit_case # if length of source is > this number
-L204: # discard digits in source
- jlbc %r2,L206 # use low bit of length to choose nibble
- bitb $0xf0,(%r10) # high nibble
- jeql L208
- setsignif # set significance and overflow if
- setoverflow # wasted digit is non-zero
- jbr L208
-L206:
- bitb $0xf,(%r10) # low nibble
- jeql L209
- setsignif
- setoverflow
-L209:
- incl %r10 # increment to next byte
-L208:
- decl %r2 # decrement source length
- incl %r11 # continue till were out of excess
- jlss L204
- jbr Ledit_case
-
-Le_fill:
- tstl %r1 # put (count in r1) fill characters
- jeql Ledit_case
-Le_fill_loop:
- putfill
- sobgtr %r1,Le_fill_loop
- jbr Ledit_case
-
-Le_move:
- tstl %r1 # move (count in r1) characters
- jeql Ledit_case # from source to destination
-L214:
- jlbc %r2,L215 # read a nibble
- extzv $4,$4,(%r10),%r11
- jbr L216
-L215:
- extzv $0,$4,(%r10),%r11
- incl %r10
-L216:
- decl %r2 # source length CAN go negative here...
- tstl %r11
- jeql L218 # if non-zero
- setsignif # set significance
-L218:
- jbc SIGNIFBIT,%r4,L219 # if significance set
- addb3 $48,%r11,(%r5)+ # put 0 + digit into destination
- jbr L220
-L219: # else put fill character
- putfill
-L220:
- sobgtr %r1,L214
- jbr Ledit_case
-
-Le_float: # move with floating sign character
- tstl %r1
- jeql Ledit_case
-L221:
- jlbc %r2,L222
- extzv $4,$4,(%r10),%r11
- jbr L223
-L222:
- extzv $0,$4,(%r10),%r11
- incl %r10
-L223:
- decl %r2 # source length CAN go negative here...
- tstl %r11
- jeql L225
- jbs SIGNIFBIT,%r4,L226
- putsign
-L226:
- setsignif
-L225:
- jbc SIGNIFBIT,%r4,L227
- addb3 $48,%r11,(%r5)+
- jbr L228
-L227:
- putfill
-L228:
- sobgtr %r1,L221
- jbr Ledit_case
-
-
- _ALIGN_TEXT
-ALTENTRY(EMashp)
- argb(1,%r11) # (1) scale (number to shift) == r11
- arguw(2,%r10) # (2) source length == r10
- argl(3,%r1) # (3) source address == r1
- argub(4,%r2) # (4) rounding factor == r2
- arguw(5,%r3) # (5) destination length == r3
- toarg(%r6,3)/* # arg3 holds register 6 from caller */
- argl(6,%r6) # (6) destination address == r6
-/*
- # we need arg6 for later
- # arg1 is used for temporary storage
- # arg2 holds "even or odd" destination length
- # arg4 is used as general storage
- # arg5 is used as general storage
-*/
- ashl $-1,%r3,%r0 # destination length is number of bytes
- addl2 %r0,%r6 # destination address == least sig nibble
- toarg(%r6,1) # save in arg1 spot for later
- ashl $-1,%r10,%r0
- addl2 %r0,%r1 # source address == least sig nibble
- extzv $0,$4,(%r1),%r0 # determine sign of source
- cmpl %r0,NEGATIVEalt
- jeql Lashp_neg
- cmpl %r0,NEGATIVE
- jeql Lashp_neg
- movb POSITIVE,(%r6)
- jbr L245
-Lashp_neg:
- movb NEGATIVE,(%r6)
-L245:
- clrl arg2 # arg2 is 1 if dstlen is even, 0 if odd
- blbs %r3,L246
- incl arg2
- bisl2 $1,%r3 # r3<0> counts digits going into destination
-L246: # and is flip-flop for which nibble to
- tstl %r11 # write in destination (1 = high, 0 = low)
- jgeq Lashp_left # (it must start out odd)
- addl2 %r11,%r10 # scale is negative (right shift)
- jgeq Lashp_right
- clrl %r10 # test for shifting whole number out
- jbr Lashp_setround
-Lashp_right:
- divl3 $2,%r11,%r0
- addl2 %r0,%r1 # source address == MSNibble to be shifted off
- jlbc %r11,L249
- extzv $4,$4,(%r1),%r0
- addl2 %r0,%r2 # round = last nibble to be shifted off + round
- jbr Lashp_setround
-L249:
- extzv $0,$4,(%r1),%r0
- addl2 %r0,%r2 # round = last nibble to be shifted off + round
-Lashp_setround: # r11<0> now is flip-flop for which nibble to
- incl %r11 # read from source (1 == high, 0 == low)
- cmpl %r2,$9 # set rounding factor to one if nibble shifted
- jleq Lashp_noround # off + round argument was 10 or greater
- movl $1,%r2
- jbr Lashp_shift
-Lashp_zloop:
- jlbs %r3,L257 # dont need to clear high nibble twice
- clrb -(%r6) # clear low (and high) nib of next byte in dest
-L257:
- sobgtr %r3,L258 # move to next nibble in destination, but
- incl %r3 # dont go beyond the end.
-L258:
- decl %r11
-Lashp_left: # while scale is positive
- jneq Lashp_zloop
- incl %r11 # r11<0> is flip-plop ... (incl sets it to one)
-Lashp_noround:
- clrl %r2 # no more rounding
-Lashp_shift:
- clrl arg4 # arg4 will be used for result condition codes
- tstl %r10
- jeql Lashp_round
-Lashp_shloop:
- jlbc %r11,L260
- extzv $4,$4,(%r1),%r0
- jbr L261
-L260:
- decl %r1
- extzv $0,$4,(%r1),%r0
-L261:
- incl %r11 # flip the source nibble flip/flop
- addl2 %r0,%r2 # round += next nibble
- cmpl %r2,$10 # if round == 10
- jneq L262
- clrl arg5 # then result = 0 and round = 1
- movl $1,%r2
- jbr L263
-L262: # else
- movl %r2,arg5 # store result and round = 0
- clrl %r2
-L263:
- bisl2 arg5,arg4 # remember if result was nonzero in arg4
- decl %r3 # move to next nibble early to check
- cmpl %r3,arg2 # if weve moved passed destination limits
- jgeq Lashp_noovfl # test the result for possible overflow
- movl arg2,%r3 # ignore zero nibbles
- tstl arg5 # if the nibble was non-zero, overflow
- jeql L265
- jbr Lashp_overfl
-Lashp_noovfl: # else
- jlbs %r3,L264
- insv arg5,$4,$4,(%r6) # put the result into destination (high or low)
- jbr L265
-L264:
- movb arg5,-(%r6)
-L265:
- sobgtr %r10,Lashp_shloop # loop for length of source
-
-Lashp_round:
- tstl %r2 # take care of round out of high nibble
- jeql Lashp_zeroround
- decl %r3
- cmpl %r3,arg2 # if weve moved passed destination limits
- jlss Lashp_overfl # then overflow
- jlbs %r3,L266
- insv arg5,$4,$4,(%r6) # put the round into destination (high or low)
- jbr Lashp_zeroround
-L266:
- movb arg5,-(%r6)
-
-Lashp_zeroround:
- argl(1,%r10) # r10 = address of destination LSNibble
- argl(6,%r3) # r3 = address of destination MSNibble
- movl arg4,%r11 # r11 = non-zero if destination == non-zero
- savepsl
- jbr L267
-Lashp_zerofill:
- clrb -(%r6) # fill up MSNs of destination with zeros
-L267:
- cmpl %r3,%r6
- jneq Lashp_zerofill
- extzv $0,$4,(%r10),%r0 # test for negative result
- cmpl %r0,NEGATIVE
- jneq Lashp_out
- mnegl %r11,%r11
- savepsl
- jneq Lashp_out # turn -0 into 0
- insv POSITIVE,$0,$4,(%r10)
-Lashp_out:
- clrl %r0
- argl(3,%r6) # restore r6 from stack
- return
-Lashp_overfl: # do overflow
- clrl %r2
- overflowpsl
- jbr Lashp_out
-
-
- _ALIGN_TEXT
-ALTENTRY(EMcvtlp)
- arguw(2,%r10) # (2) destination length == r10
- argl(3,%r3) # (3) destination address == r3
- ashl $-1,%r10,%r10
- addl2 %r10,%r3 # destination address points to Least Sig byte
- incl %r10 # length is # of bytes, not nibbles
- argl(1,%r11) # (1) source == r11
- savepsl
- jgeq Lcvtlp_pos
- movb NEGATIVE,(%r3) # source is negative
- divl3 $10,%r11,%r0
- mull3 $10,%r0,%r1
- subl3 %r11,%r1,%r2 # r2 = source mod 10
- mnegl %r0,%r11 # source = -(source / 10)
- jbr Lcvtlp_cvt
-Lcvtlp_pos:
- movb POSITIVE,(%r3) # source is non-negative
- divl3 $10,%r11,%r0
- mull3 $10,%r0,%r1
- subl3 %r1,%r11,%r2 # r2 = source mod 10
- movl %r0,%r11 # source = source / 10
-Lcvtlp_cvt:
- insv %r2,$4,$4,(%r3) # store least significant digit
- tstl %r11
- jeql Lcvtlp_zloop
-Lcvtlp_loop: # while source is non-zero
- decl %r10 # and for length of destination ...
- jeql Lcvtlp_over
- divl3 $10,%r11,%r1 # r1 = source / 10
- mull3 $10,%r1,%r0
- subl2 %r0,%r11 # source = source mod 10
- movb %r11,-(%r3) # store low "nibble" in next significant byte
- divl3 $10,%r1,%r11 # source = r1 / 10
- mull3 $10,%r11,%r0
- subl2 %r0,%r1 # r1 = source mod 10
- insv %r1,$4,$4,(%r3) # store high nibble
- tstl %r11
- jneq Lcvtlp_loop # quit if source becomes zero
-Lcvtlp_zloop: # fill any remaining bytes with zeros
- decl %r10
- jeql Lcvtlp_out
- clrb -(%r3)
- jbr Lcvtlp_zloop
-Lcvtlp_over:
- overflowpsl
-Lcvtlp_out:
- clrl %r1 # r0 is already zero
- clrl %r2
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMcvtpl)
- arguw(1,%r11) # (1) source length == r11
- argl(2,%r10) # (2) source address == r10
- clrl %r3 # r3 == destination
- movl %r10,%r1 # r1 set up now for return
- ashl $-1,%r11,%r11 # source length is number of bytes
- jeql Lcvtpl_zero
-Lcvtpl_loop: # for source length
- mull2 $10,%r3 # destination *= 10
- extzv $4,$4,(%r10),%r0
- addl2 %r0,%r3 # destination += high nibble
- mull2 $10,%r3 # destination *= 10
- extzv $0,$4,(%r10),%r0
- addl2 %r0,%r3 # destination += low nibble
- incl %r10
- sobgtr %r11,Lcvtpl_loop
-Lcvtpl_zero: # least significant byte
- mull2 $10,%r3
- extzv $4,$4,(%r10),%r0
- addl2 %r0,%r3 # dest = 10 * dest + high nibble
- savepsl
- extzv $0,$4,(%r10),%r2 # test sign nibble
- cmpl %r2,NEGATIVE
- jeql Lcvtpl_neg
- cmpl %r2,NEGATIVEalt
- jneq Lcvtpl_out
-Lcvtpl_neg: # source was negative - negate destination
- mnegl %r3,%r3
- savepsl
-Lcvtpl_out:
- toarg(%r3,3)
- clrl %r0
- clrl %r2
- clrl %r3
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMcvtps)
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMcvtsp)
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMaddp6)
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMsubp4)
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMsubp6)
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMcvtpt)
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMmulp)
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMcvttp)
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMdivp)
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMcmpp3)
- return
-
-
- _ALIGN_TEXT
-ALTENTRY(EMcmpp4)
- return
-
-
-
-#ifdef notdef
-/*
- * Emulation OpCode jump table:
- * ONLY GOES FROM 0xf8 (-8) TO 0x3B (59)
- */
-#define EMUTABLE 0x43
-#define NOEMULATE .long noemulate
-#define EMULATE(a) .long _C_LABEL(__CONCAT(EM,a))
- .globl _C_LABEL(emJUMPtable)
-_C_LABEL(emJUMPtable):
-/* f8 */ EMULATE(ashp); EMULATE(cvtlp); NOEMULATE; NOEMULATE
-/* fc */ NOEMULATE; NOEMULATE; NOEMULATE; NOEMULATE
-/* 00 */ NOEMULATE; NOEMULATE; NOEMULATE; NOEMULATE
-/* 04 */ NOEMULATE; NOEMULATE; NOEMULATE; NOEMULATE
-/* 08 */ EMULATE(cvtps); EMULATE(cvtsp); NOEMULATE; EMULATE(crc)
-/* 0c */ NOEMULATE; NOEMULATE; NOEMULATE; NOEMULATE
-/* 10 */ NOEMULATE; NOEMULATE; NOEMULATE; NOEMULATE
-/* 14 */ NOEMULATE; NOEMULATE; NOEMULATE; NOEMULATE
-/* 18 */ NOEMULATE; NOEMULATE; NOEMULATE; NOEMULATE
-/* 1c */ NOEMULATE; NOEMULATE; NOEMULATE; NOEMULATE
-/* 20 */ EMULATE(addp4); EMULATE(addp6); EMULATE(subp4); EMULATE(subp6)
-/* 24 */ EMULATE(cvtpt); EMULATE(mulp); EMULATE(cvttp); EMULATE(divp)
-/* 28 */ NOEMULATE; EMULATE(cmpc3); EMULATE(scanc); EMULATE(spanc)
-/* 2c */ NOEMULATE; EMULATE(cmpc5); EMULATE(movtc); EMULATE(movtuc)
-/* 30 */ NOEMULATE; NOEMULATE; NOEMULATE; NOEMULATE
-/* 34 */ EMULATE(movp); EMULATE(cmpp3); EMULATE(cvtpl); EMULATE(cmpp4)
-/* 38 */ EMULATE(editpc); EMULATE(matchc); EMULATE(locc); EMULATE(skpc)
-
-/*
- * The following is called with the stack set up as follows:
- *
- * (sp): Opcode
- * 4(sp): Instruction PC
- * 8(sp): Operand 1
- * 12(sp): Operand 2
- * 16(sp): Operand 3
- * 20(sp): Operand 4
- * 24(sp): Operand 5
- * 28(sp): Operand 6
- * 32(sp): Operand 7 (unused)
- * 36(sp): Operand 8 (unused)
- * 40(sp): Return PC
- * 44(sp): Return PSL
- * 48(sp): TOS before instruction
- *
- * Each individual routine is called with the stack set up as follows:
- *
- * (sp): Return address of trap handler
- * 4(sp): Opcode (will get return PSL)
- * 8(sp): Instruction PC
- * 12(sp): Operand 1
- * 16(sp): Operand 2
- * 20(sp): Operand 3
- * 24(sp): Operand 4
- * 28(sp): Operand 5
- * 32(sp): Operand 6
- * 36(sp): saved register 11
- * 40(sp): saved register 10
- * 44(sp): Return PC
- * 48(sp): Return PSL
- * 52(sp): TOS before instruction
- */
-
-SCBVEC(emulate):
- movl %r11,32(%sp) # save register r11 in unused operand
- movl %r10,36(%sp) # save register r10 in unused operand
- cvtbl (%sp),%r10 # get opcode
- addl2 $8,%r10 # shift negative opcodes
- subl3 %r10,$EMUTABLE,%r11 # forget it if opcode is out of range
- bcs noemulate
- movl _C_LABEL(emJUMPtable)[%r10],%r10
- # call appropriate emulation routine
- jsb (%r10) # routines put return values into regs 0-5
- movl 32(%sp),%r11 # restore register r11
- movl 36(%sp),%r10 # restore register r10
- insv (%sp),$0,$4,44(%sp) # and condition codes in Opcode spot
- addl2 $40,%sp # adjust stack for return
- rei
-noemulate:
- addl2 $48,%sp # adjust stack for
- .word 0xffff # "reserved instruction fault"
-SCBVEC(emulateFPD):
- .word 0xffff # "reserved instruction fault"
-#endif
diff --git a/sys/arch/vax/vax/findcpu.c b/sys/arch/vax/vax/findcpu.c
deleted file mode 100644
index e7ee36186b6..00000000000
--- a/sys/arch/vax/vax/findcpu.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $OpenBSD: findcpu.c,v 1.16 2011/09/19 21:53:02 miod Exp $ */
-/* $NetBSD: findcpu.c,v 1.5 1999/08/23 19:10:43 ragge Exp $ */
-/*
- * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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/device.h>
-
-#include <machine/sid.h>
-#include <machine/nexus.h>
-#include <machine/mtpr.h>
-#include <machine/cpu.h>
-#include <machine/cvax.h>
-
-/*
- * We set up some information about the machine we're
- * running on and thus initializes/uses vax_cputype and vax_boardtype.
- * There should be no need to change/reinitialize these variables
- * outside of this routine, they should be read only!
- */
-int vax_cputype; /* highest byte of SID register */
-int vax_cpustype; /* second byte of SIE register */
-int vax_bustype; /* holds/defines the main bus type on this machine */
-int vax_boardtype; /* machine dependent, combination of SID and SIE */
-
-int vax_cpudata = 0; /* contents of the SID register */
-int vax_siedata = 0; /* contents of the SIE register */
-int vax_confdata; /* machine dependent, configuration/setup data */
-
-void findcpu(void);
-
-/*
- * Try to figure out which type of system this is.
- */
-void
-findcpu(void)
-{
- vax_cpudata = mfpr(PR_SID);
- vax_cputype = vax_cpudata >> 24;
- vax_boardtype = vax_cputype << 24;
-
- switch (vax_cputype) {
- case VAX_TYP_UV2:
- case VAX_TYP_CVAX:
- case VAX_TYP_RIGEL:
- case VAX_TYP_MARIAH:
- case VAX_TYP_NVAX:
- case VAX_TYP_SOC:
- vax_siedata = *(int *)(0x20040004); /* SIE address */
- vax_cpustype = (vax_siedata >> 8) & 0xff;
- vax_boardtype |= vax_siedata >> 24;
-
- switch (vax_boardtype) {
- case VAX_BTYP_420: /* They are very similar */
- case VAX_BTYP_410:
- case VAX_BTYP_43:
- case VAX_BTYP_46:
- case VAX_BTYP_48:
- case VAX_BTYP_IS1:
- vax_confdata = *(int *)(0x20020000);
- vax_bustype = VAX_VSBUS;
- break;
- case VAX_BTYP_49:
- vax_confdata = *(int *)(0x25800000);
- vax_bustype = VAX_VSBUS;
- break;
- case VAX_BTYP_VXT:
- vax_confdata = *(int *)(0x200c0000);
- vax_bustype = VAX_VXTBUS;
- break;
-
- case VAX_BTYP_60:
- vax_confdata =
- ((struct cvax_ssc *)CVAX_SSC)->ssc_terminfo;
- vax_bustype = VAX_MBUS;
- break;
-
- case VAX_BTYP_630:
- case VAX_BTYP_650:
- case VAX_BTYP_660:
- case VAX_BTYP_670:
- case VAX_BTYP_1301:
- case VAX_BTYP_1303:
- case VAX_BTYP_1305:
- vax_bustype = VAX_IBUS;
- break;
-
- default:
- /* CPU not supported, just give up */
- asm("halt");
- }
- break;
-
- default:
- /* CPU not supported, just give up */
- asm("halt");
- }
-}
diff --git a/sys/arch/vax/vax/genassym.cf b/sys/arch/vax/vax/genassym.cf
deleted file mode 100644
index 584009a3fe3..00000000000
--- a/sys/arch/vax/vax/genassym.cf
+++ /dev/null
@@ -1,117 +0,0 @@
-# $OpenBSD: genassym.cf,v 1.12 2013/11/24 22:08:25 miod Exp $
-# $NetBSD: genassym.cf,v 1.10 1999/11/19 22:09:55 ragge Exp $
-#
-# Copyright (c) 1997 Ludd, University of Lule}, Sweden.
-# 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 at Ludd, University of
-# Lule}, Sweden and its contributors.
-# 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 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/proc.h>
-include <sys/errno.h>
-include <sys/syscall.h>
-include <sys/evcount.h>
-
-include <machine/mtpr.h>
-include <machine/pcb.h>
-include <machine/sid.h>
-include <machine/trap.h>
-include <machine/cpu.h>
-
-struct proc
-member p_priority
-member p_addr
-member p_vmspace
-member p_stat
-
-export SONPROC
-
-struct pcb
-member P0BR
-member P0LR
-member P1BR
-member P1LR
-member iftrap
-member pcb_paddr
-
-struct cpu_dep
-member MCHK cpu_mchk
-member MEMERR cpu_memerr
-member HARDCLOCK cpu_hardclock
-
-struct cpu_info
-member ci_curproc
-
-export KERNBASE
-
-# mtpr register numbers
-export PR_KSP
-export PR_USP
-export PR_ICCS
-export PR_PCBB
-export PR_IPL
-export PR_SBIFS
-export PR_EHSR
-export PR_MCESR
-export PR_P0BR
-export PR_P1BR
-export PR_P0LR
-export PR_P1LR
-export PR_SCBB
-
-# trap numbering
-export T_KSPNOTVAL
-export T_PRIVINFLT
-export T_XFCFLT
-export T_RESOPFLT
-export T_RESADFLT
-export T_TRANSFLT
-export T_PTEFETCH
-export T_WRITE
-export T_ACCFLT
-export T_PTELEN
-export T_TRCTRAP
-export T_BPTFLT
-export T_ARITHFLT
-export T_SYSCALL
-export T_ASTFLT
-export T_KDBTRAP
-
-export USPACE
-
-export EFAULT
-export ENAMETOOLONG
-
-struct evcount
-member ec_count
-
-export SYS_sigreturn
-export SYS_exit
-
-export VAX_TYP_SOC
-export VAX_TYP_UV2
diff --git a/sys/arch/vax/vax/gencons.c b/sys/arch/vax/vax/gencons.c
deleted file mode 100644
index bd92353e410..00000000000
--- a/sys/arch/vax/vax/gencons.c
+++ /dev/null
@@ -1,325 +0,0 @@
-/* $OpenBSD: gencons.c,v 1.24 2011/07/06 18:32:59 miod Exp $ */
-/* $NetBSD: gencons.c,v 1.22 2000/01/24 02:40:33 matt Exp $ */
-
-/*
- * Copyright (c) 1994 Gordon W. Ross
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- *
- * kd.c,v 1.2 1994/05/05 04:46:51 gwr Exp $
- */
-
- /* All bugs are subject to removal without further notice */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/file.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/reboot.h>
-
-#include <dev/cons.h>
-
-#include <machine/mtpr.h>
-#include <machine/sid.h>
-#include <machine/cpu.h>
-#include <machine/scb.h>
-#include <machine/../vax/gencons.h>
-
-struct tty *gencn_tty[4];
-
-int consopened = 0;
-int maxttys = 1;
-
-int pr_txcs[4] = {PR_TXCS, PR_TXCS1, PR_TXCS2, PR_TXCS3};
-int pr_rxcs[4] = {PR_RXCS, PR_RXCS1, PR_RXCS2, PR_RXCS3};
-int pr_txdb[4] = {PR_TXDB, PR_TXDB1, PR_TXDB2, PR_TXDB3};
-int pr_rxdb[4] = {PR_RXDB, PR_RXDB1, PR_RXDB2, PR_RXDB3};
-
-cons_decl(gen);
-cdev_decl(gencn);
-
-int gencnparam(struct tty *, struct termios *);
-void gencnstart(struct tty *);
-void gencnrint(void *);
-void gencntint(void *);
-
-int
-gencnopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int unit;
- struct tty *tp;
-
- unit = minor(dev);
- if (unit >= maxttys)
- return ENXIO;
-
- if (gencn_tty[unit] == NULL)
- gencn_tty[unit] = ttymalloc(0);
-
- tp = gencn_tty[unit];
-
- tp->t_oproc = gencnstart;
- tp->t_param = gencnparam;
- 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 = TTYDEF_CFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
- gencnparam(tp, &tp->t_termios);
- ttsetwater(tp);
- } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0)
- return EBUSY;
- tp->t_state |= TS_CARR_ON;
- if (unit == 0)
- consopened = 1;
- mtpr(GC_RIE, pr_rxcs[unit]); /* Turn on interrupts */
- mtpr(GC_TIE, pr_txcs[unit]);
-
- return ((*linesw[tp->t_line].l_open)(dev, tp, p));
-}
-
-int
-gencnclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct tty *tp = gencn_tty[minor(dev)];
-
- if (minor(dev) == 0)
- consopened = 0;
- (*linesw[tp->t_line].l_close)(tp, flag, p);
- ttyclose(tp);
- return (0);
-}
-
-struct tty *
-gencntty(dev_t dev)
-{
- return gencn_tty[minor(dev)];
-}
-
-int
-gencnread(dev_t dev, struct uio *uio, int flag)
-{
- struct tty *tp = gencn_tty[minor(dev)];
-
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-gencnwrite(dev_t dev, struct uio *uio, int flag)
-{
- struct tty *tp = gencn_tty[minor(dev)];
-
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-int
-gencnioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct tty *tp = gencn_tty[minor(dev)];
- int error;
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return error;
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return error;
-
- return ENOTTY;
-}
-
-void
-gencnstart(struct tty *tp)
-{
- struct clist *cl;
- int s, ch;
-
- s = spltty();
- if (tp->t_state & (TS_BUSY|TS_TTSTOP|TS_TIMEOUT))
- goto out;
- cl = &tp->t_outq;
-
- if(cl->c_cc){
- tp->t_state |= TS_BUSY;
- ch = getc(cl);
- mtpr(ch, pr_txdb[minor(tp->t_dev)]);
- } else {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)cl);
- }
- selwakeup(&tp->t_wsel);
- }
-
-out: splx(s);
-}
-
-void
-gencnrint(void *arg)
-{
- struct tty *tp = *(struct tty **) arg;
- int unit = (struct tty **) arg - gencn_tty;
- int i;
-
- i = mfpr(pr_rxdb[unit]) & 0377; /* Mask status flags etc... */
-
-#ifdef DDB
- if (tp->t_dev == cn_tab->cn_dev) {
- int j = kdbrint(i);
-
- if (j == 1) /* Escape received, just return */
- return;
-
- if (j == 2) /* Second char wasn't 'D' */
- (*linesw[tp->t_line].l_rint)(27, tp);
- }
-#endif
-
- (*linesw[tp->t_line].l_rint)(i, tp);
- return;
-}
-
-int
-gencnstop(struct tty *tp, int flag)
-{
- return 0;
-}
-
-void
-gencntint(void *arg)
-{
- struct tty *tp = *(struct tty **) arg;
-
- tp->t_state &= ~TS_BUSY;
-
- gencnstart(tp);
-}
-
-int
-gencnparam(struct tty *tp, struct termios *t)
-{
- /* XXX - These are ignored... */
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = t->c_cflag;
- return 0;
-}
-
-void
-gencnprobe(struct consdev *cndev)
-{
- if ((vax_cputype < VAX_TYP_UV2) || /* All older has MTPR console */
- (vax_boardtype == VAX_BTYP_9RR) ||
- (vax_boardtype == VAX_BTYP_630) ||
- (vax_boardtype == VAX_BTYP_650) ||
- (vax_boardtype == VAX_BTYP_660) ||
- (vax_boardtype == VAX_BTYP_670) ||
- (vax_boardtype == VAX_BTYP_1301) ||
- (vax_boardtype == VAX_BTYP_1305)) {
- cndev->cn_dev = makedev(25, 0);
- cndev->cn_pri = CN_LOWPRI;
- }
-}
-
-void
-gencninit(struct consdev *cndev)
-{
-
- /* Allocate interrupt vectors */
- scb_vecalloc(SCB_G0R, gencnrint, &gencn_tty[0], SCB_ISTACK, NULL);
- scb_vecalloc(SCB_G0T, gencntint, &gencn_tty[0], SCB_ISTACK, NULL);
-
- if (vax_cputype == VAX_TYP_8SS) {
- maxttys = 4;
- scb_vecalloc(SCB_G1R, gencnrint, &gencn_tty[1], SCB_ISTACK, NULL);
- scb_vecalloc(SCB_G1T, gencntint, &gencn_tty[1], SCB_ISTACK, NULL);
-
- scb_vecalloc(SCB_G2R, gencnrint, &gencn_tty[2], SCB_ISTACK, NULL);
- scb_vecalloc(SCB_G2T, gencntint, &gencn_tty[2], SCB_ISTACK, NULL);
-
- scb_vecalloc(SCB_G3R, gencnrint, &gencn_tty[3], SCB_ISTACK, NULL);
- scb_vecalloc(SCB_G3T, gencntint, &gencn_tty[3], SCB_ISTACK, NULL);
- }
- mtpr(0, PR_RXCS);
- mtpr(0, PR_TXCS);
- mtpr(0, PR_TBIA); /* ??? */
-}
-
-void
-gencnputc(dev_t dev, int ch)
-{
- while ((mfpr(PR_TXCS) & GC_RDY) == 0) /* Wait until xmit ready */
- ;
- mtpr(ch, PR_TXDB); /* xmit character */
- if(ch == 10)
- gencnputc(dev, 13); /* CR/LF */
-
-}
-
-int
-gencngetc(dev_t dev)
-{
- int i;
-
- while ((mfpr(PR_RXCS) & GC_DON) == 0) /* Receive chr */
- ;
- i = mfpr(PR_RXDB) & 0x7f;
- if (i == 13)
- i = 10;
- return i;
-}
-
-void
-gencnpollc(dev_t dev, int pollflag)
-{
- if (pollflag) {
- mtpr(0, PR_RXCS);
- mtpr(0, PR_TXCS);
- } else if (consopened) {
- mtpr(GC_RIE, PR_RXCS);
- mtpr(GC_TIE, PR_TXCS);
- }
-}
diff --git a/sys/arch/vax/vax/gencons.h b/sys/arch/vax/vax/gencons.h
deleted file mode 100644
index f9ac7881653..00000000000
--- a/sys/arch/vax/vax/gencons.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $OpenBSD: gencons.h,v 1.6 2011/07/06 18:32:59 miod Exp $ */
-/* $NetBSD: gencons.h,v 1.9 2000/01/20 00:07:49 matt Exp $ */
-
-/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- *
- */
-
- /* All bugs are subject to removal without further notice */
-
-/*
- * Some definitions for generic console interface (PR 32-35)
- */
-
-/* PR_TXCS */
-#define GC_RDY 0x80 /* Console ready to xmit chr */
-#define GC_TIE 0x40 /* xmit interrupt enable */
-
-/* PR_RXCS */
-#define GC_DON 0x80 /* character received */
-#define GC_RIE 0x40 /* recv interrupt enable */
-
-/* PR_RXDB */
-#define GC_ERR 0x8000 /* received character error */
-#define GC_CON 0xf00 /* mfpr($PR_RXDB)&GC_CON==0 then console chr */
-
-/* PR_TXDB */
-#define GC_CONS 0xf00 /* Console software !8600 */
-#define GC_BTFL 0x2 /* boot machine */
-#define GC_CWFL 0x3 /* clear warm start flag */
-#define GC_CCFL 0x4 /* clear cold start flag */
-
-/* Interrupt vectors used */
-#define SCB_G0R 0xf8
-#define SCB_G0T 0xfc
-#define SCB_G1R 0xc8
-#define SCB_G1T 0xcc
-#define SCB_G2R 0xd0
-#define SCB_G2T 0xd4
-#define SCB_G3R 0xd8
-#define SCB_G3T 0xdc
-
-/* Prototypes */
-void gencnputc(dev_t, int);
diff --git a/sys/arch/vax/vax/ibus.c b/sys/arch/vax/vax/ibus.c
deleted file mode 100644
index 4a36c247121..00000000000
--- a/sys/arch/vax/vax/ibus.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* $OpenBSD: ibus.c,v 1.9 2011/09/19 21:53:02 miod Exp $ */
-/* $NetBSD: ibus.c,v 1.7 2001/02/04 20:36:32 ragge Exp $ */
-/*
- * Copyright (c) 1999 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/device.h>
-#include <sys/systm.h>
-
-#include <machine/nexus.h>
-#include <machine/cpu.h>
-#include <machine/sid.h>
-
-static int ibus_print(void *, const char *);
-static int ibus_match(struct device *, struct cfdata *, void *);
-static void ibus_attach(struct device *, struct device *, void *);
-
-struct cfdriver ibus_cd = {
- NULL, "ibus", DV_DULL
-};
-
-struct cfattach ibus_ca = {
- sizeof(struct device), (cfmatch_t)ibus_match, ibus_attach
-};
-
-int
-ibus_print(void *aux, const char *name)
-{
- struct bp_conf *bp = aux;
-
- if (name)
- printf("%s at %s", bp->type, name);
-
- return (UNCONF);
-}
-
-
-int
-ibus_match(struct device *parent, struct cfdata *cf, void *aux)
-{
- struct mainbus_attach_args *maa = aux;
-
- if (maa->maa_bustype == VAX_IBUS)
- return 1;
- return 0;
-}
-
-#define MVNIADDR 0x20084400
-#define SGECADDR 0x20008000
-#define SHACADDR 0x20004200
-#define SHAC1303ADDR 0x20008200
-
-void
-ibus_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct bp_conf bp;
- vaddr_t va;
-
- printf("\n");
-
- /*
- * There may be a SGEC. Is badaddr() enough here?
- */
- bp.type = "sgec";
- va = vax_map_physmem(SGECADDR, 1);
- if (badaddr((caddr_t)va, 4) == 0)
- config_found(self, &bp, ibus_print);
- vax_unmap_physmem(va, 1);
-
- /*
- * There may be a LANCE.
- */
- bp.type = "lance";
- va = vax_map_physmem(MVNIADDR, 1);
- if (badaddr((caddr_t)va, 2) == 0)
- config_found(self, &bp, ibus_print);
- vax_unmap_physmem(va, 1);
-
- /*
- * The same procedure for SHAC.
- */
- bp.type = "shac";
- /*
- * XXX Clearly the address on Cheetah machines varies between models,
- * XXX but I could only check the address on a 4000 106 so far. -- miod
- */
- if (vax_boardtype == VAX_BTYP_1303 && vax_cpustype != VAX_STYP_53)
- va = vax_map_physmem(SHAC1303ADDR, 1);
- else
- va = vax_map_physmem(SHACADDR, 1);
- if (badaddr((caddr_t)va + 0x48, 4) == 0)
- config_found(self, &bp, ibus_print);
- vax_unmap_physmem(va, 1);
-
- /*
- * All MV's have a Qbus.
- */
- bp.type = "uba";
- config_found(self, &bp, ibus_print);
-
-}
diff --git a/sys/arch/vax/vax/in4_cksum.c b/sys/arch/vax/vax/in4_cksum.c
deleted file mode 100644
index 4997b04e0a1..00000000000
--- a/sys/arch/vax/vax/in4_cksum.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/* $OpenBSD: in4_cksum.c,v 1.6 2014/08/21 14:24:08 mpi Exp $ */
-/* $NetBSD: in4_cksum.c,v 1.8 2003/09/29 22:54:28 matt Exp $ */
-
-/*
- * Copyright (C) 1999 WIDE Project.
- * 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 project 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 PROJECT 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 PROJECT 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) 1988, 1992, 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.
- *
- * @(#)in_cksum.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/socketvar.h>
-#include <netinet/in.h>
-#include <netinet/ip.h>
-#include <netinet/ip_var.h>
-
-#ifdef CKSUMDEBUG
-int in4_cksum_md_debug(struct mbuf *m, u_int8_t nxt, int off, int len);
-#define in4_cksum in4_cksum_md_debug
-#include <netinet/in4_cksum.c>
-#undef in4_cksum
-#undef ADDCARRY
-#undef REDUCE
-#endif
-
-/*
- * Checksum routine for Internet Protocol family headers.
- * This is only for IPv4 pseudo header checksum.
- * No need to clear non-pseudo-header fields in IPv4 header.
- * len is for actual payload size, and does not include IPv4 header and
- * skipped header chain (off + len should be equal to the whole packet).
- *
- * This implementation is VAX version.
- */
-
-
-#define REDUCE {sum = (sum & 0xffff) + (sum >> 16);}
-#define ADDCARRY {if (sum > 0xffff) sum -= 0xffff;}
-#define ADVANCE(n) {w += n; mlen -= n;}
-#define SWAP {sum <<= 8;} /* depends on recent REDUCE */
-
-#define Asm __asm volatile
-#define ADDL Asm("addl2 (%2)+,%0" : "=r" (sum) : "0" (sum), "r" (w))
-#define ADWC Asm("adwc (%2)+,%0" : "=r" (sum) : "0" (sum), "r" (w))
-#define ADDC Asm("adwc $0,%0" : "=r" (sum) : "0" (sum))
-#define UNSWAP Asm("rotl $8,%0,%0" : "=r" (sum) : "0" (sum))
-#define ADDBYTE {sum += *w; SWAP; byte_swapped ^= 1;}
-#define ADDWORD {sum += *(u_short *)w;}
-
-int
-in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len)
-{
- u_int8_t *w;
- u_int32_t sum = 0;
- int mlen = 0;
- int byte_swapped = 0;
-#ifdef CKSUMDEBUG
- int debugrv = in4_cksum_md_debug(m, nxt, off, len);
-#endif
-
- if (nxt != 0) {
-#ifdef DEBUG
- if (off < sizeof(struct ipovly))
- panic("in4_cksum: offset too short");
- if (m->m_len < sizeof(struct ip))
- panic("in4_cksum: bad mbuf chain");
-#endif
-
- __asm volatile(
- "movzwl %3,%0;" /* mov len to sum */
- "addb2 %4,%0;" /* add proto to sum */
- "rotl $8,%0,%0;" /* htons, carry is preserved */
- "adwc 12(%2),%0;" /* add src ip */
- "adwc 16(%2),%0;" /* add dst ip */
- "adwc $0,%0;" /* clean up carry */
- : "=r" (sum)
- : "0" (sum), "r" (mtod(m, void *)), "r" (len), "r"(nxt));
- }
-
- /* skip unnecessary part */
- while (m && off > 0) {
- if (m->m_len > off)
- break;
- off -= m->m_len;
- m = m->m_next;
- }
-
- for (;m && len; m = m->m_next) {
- if ((mlen = m->m_len) == 0)
- continue;
- w = mtod(m, u_int8_t *);
- if (off) {
- w += off;
- mlen -= off;
- off = 0;
- }
- if (len < mlen)
- mlen = len;
- len -= mlen;
- if (mlen < 16)
- goto short_mbuf;
- /*
- * Ensure that we're aligned on a word boundary here so
- * that we can do 32 bit operations below.
- */
- if ((3 & (u_long) w) != 0) {
- REDUCE;
- if ((1 & (u_long) w) != 0) {
- ADDBYTE;
- ADVANCE(1);
- }
- if ((2 & (u_long) w) != 0) {
- ADDWORD;
- ADVANCE(2);
- }
- }
- /*
- * Do as much of the checksum as possible 32 bits at at time.
- * In fact, this loop is unrolled to make overhead from
- * branches &c small.
- */
- while ((mlen -= 32) >= 0) {
- /*
- * Add with carry 16 words and fold in the last carry
- * by adding a 0 with carry.
- */
- ADDL; ADWC; ADWC; ADWC;
- ADWC; ADWC; ADWC; ADWC;
- ADDC;
- }
- mlen += 32;
- if (mlen >= 16) {
- ADDL; ADWC; ADWC; ADWC;
- ADDC;
- mlen -= 16;
- }
- short_mbuf:
- if (mlen >= 8) {
- ADDL; ADWC;
- ADDC;
- mlen -= 8;
- }
- if (mlen >= 4) {
- ADDL;
- ADDC;
- mlen -= 4;
- }
- if (mlen > 0) {
- REDUCE;
- if (mlen >= 2) {
- ADDWORD;
- ADVANCE(2);
- }
- if (mlen >= 1) {
- ADDBYTE;
- }
- }
- }
-
- if (len)
- printf("cksum4: out of data\n");
- if (byte_swapped) {
- UNSWAP;
- }
- REDUCE;
- ADDCARRY;
-#ifdef CKSUMDEBUG
- if ((sum ^ 0xffff) != debugrv)
- printf("in4_cksum: rv != debugrv (rv %x debugrv %x)\n",
- (sum ^ 0xffff), debugrv);
-#endif
- return (sum ^ 0xffff);
-}
diff --git a/sys/arch/vax/vax/in_cksum.c b/sys/arch/vax/vax/in_cksum.c
deleted file mode 100644
index 1af9719c9d5..00000000000
--- a/sys/arch/vax/vax/in_cksum.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/* $OpenBSD: in_cksum.c,v 1.6 2014/03/29 18:09:30 guenther Exp $ */
-/* $NetBSD: in_cksum.c,v 1.7 2003/08/07 16:30:19 agc Exp $ */
-
-/*
- * Copyright (c) 1988, 1992, 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.
- *
- * @(#)in_cksum.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/mbuf.h>
-#include <sys/systm.h>
-
-#include <netinet/in.h>
-
-/*
- * Checksum routine for Internet Protocol family headers.
- *
- * This routine is very heavily used in the network
- * code and should be modified for each CPU to be as fast as possible.
- *
- * This implementation is VAX version.
- */
-
-#define REDUCE {sum = (sum & 0xffff) + (sum >> 16);}
-#define ADDCARRY {if (sum > 0xffff) sum -= 0xffff;}
-#define ADVANCE(n) {w += n; mlen -= n;}
-#define SWAP {sum <<= 8;} /* depends on recent REDUCE */
-
-#define Asm __asm volatile
-#define ADDL Asm("addl2 (%2)+,%0" : "=r" (sum) : "0" (sum), "r" (w))
-#define ADWC Asm("adwc (%2)+,%0" : "=r" (sum) : "0" (sum), "r" (w))
-#define ADDC Asm("adwc $0,%0" : "=r" (sum) : "0" (sum))
-#define UNSWAP Asm("rotl $8,%0,%0" : "=r" (sum) : "0" (sum))
-#define ADDBYTE {sum += *w; SWAP; byte_swapped ^= 1;}
-#define ADDWORD {sum += *(u_short *)w;}
-
-int
-in_cksum(struct mbuf *m, int len)
-{
- u_int8_t *w;
- u_int32_t sum = 0;
- int mlen = 0;
- int byte_swapped = 0;
-
- for (;m && len; m = m->m_next) {
- if ((mlen = m->m_len) == 0)
- continue;
- w = mtod(m, u_int8_t *);
- if (len < mlen)
- mlen = len;
- len -= mlen;
- if (mlen < 16)
- goto short_mbuf;
- /*
- * Ensure that we're aligned on a word boundary here so
- * that we can do 32 bit operations below.
- */
- if ((3 & (u_long) w) != 0) {
- REDUCE;
- if ((1 & (u_long) w) != 0) {
- ADDBYTE;
- ADVANCE(1);
- }
- if ((2 & (u_long) w) != 0) {
- ADDWORD;
- ADVANCE(2);
- }
- }
- /*
- * Do as much of the checksum as possible 32 bits at at time.
- * In fact, this loop is unrolled to make overhead from
- * branches &c small.
- */
- while ((mlen -= 32) >= 0) {
- /*
- * Add with carry 16 words and fold in the last carry
- * by adding a 0 with carry.
- */
- ADDL; ADWC; ADWC; ADWC;
- ADWC; ADWC; ADWC; ADWC;
- ADDC;
- }
- mlen += 32;
- if (mlen >= 16) {
- ADDL; ADWC; ADWC; ADWC;
- ADDC;
- mlen -= 16;
- }
- short_mbuf:
- if (mlen >= 8) {
- ADDL; ADWC;
- ADDC;
- mlen -= 8;
- }
- if (mlen >= 4) {
- ADDL;
- ADDC;
- mlen -= 4;
- }
- if (mlen > 0) {
- REDUCE;
- if (mlen >= 2) {
- ADDWORD;
- ADVANCE(2);
- }
- if (mlen >= 1) {
- ADDBYTE;
- }
- }
- }
-
- if (len)
- printf("cksum: out of data\n");
- if (byte_swapped) {
- UNSWAP;
- }
- REDUCE;
- ADDCARRY;
- return (sum ^ 0xffff);
-}
diff --git a/sys/arch/vax/vax/ka410.c b/sys/arch/vax/vax/ka410.c
deleted file mode 100644
index ec8e9616ede..00000000000
--- a/sys/arch/vax/vax/ka410.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/* $OpenBSD: ka410.c,v 1.13 2011/09/15 00:48:24 miod Exp $ */
-/* $NetBSD: ka410.c,v 1.21 1999/09/06 19:52:53 ragge Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/types.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/mtpr.h>
-#include <machine/sid.h>
-#include <machine/pmap.h>
-#include <machine/uvax.h>
-#include <machine/ka410.h>
-#include <machine/ka420.h>
-#include <machine/cvax.h>
-#include <machine/clock.h>
-#include <machine/vsbus.h>
-
-static void ka410_conf(void);
-static void ka410_memerr(void);
-static int ka410_mchk(caddr_t);
-static void ka410_halt(void);
-static void ka410_reboot(int);
-static void ka41_cache_enable(void);
-static void ka410_clrf(void);
-
-static caddr_t l2cache; /* mapped in address */
-static long *cacr; /* l2csche ctlr reg */
-
-/*
- * Declaration of 410-specific calls.
- */
-struct cpu_dep ka410_calls = {
- 0,
- ka410_mchk,
- ka410_memerr,
- ka410_conf,
- chip_clkread,
- chip_clkwrite,
- 1, /* ~VUPS */
- 2, /* SCB pages */
- ka410_halt,
- ka410_reboot,
- ka410_clrf,
- icr_hardclock
-};
-
-
-void
-ka410_conf()
-{
- struct vs_cpu *ka410_cpu;
-
- ka410_cpu = (struct vs_cpu *)vax_map_physmem(VS_REGS, 1);
-
- switch (vax_cputype) {
- case VAX_TYP_UV2:
- ka410_cpu->vc_410mser = 1;
- printf("cpu: KA410\n");
- break;
-
- case VAX_TYP_CVAX:
- printf("cpu: KA41/42\n");
- ka410_cpu->vc_vdcorg = 0; /* XXX */
- ka410_cpu->vc_parctl = PARCTL_CPEN | PARCTL_DPEN ;
- printf("cpu: Enabling primary cache, ");
- mtpr(CADR_SEN2 | CADR_SEN1 | CADR_CENI | CADR_CEND, PR_CADR);
- if (vax_confdata & KA420_CFG_CACHPR) {
- l2cache = (void *)vax_map_physmem(KA420_CH2_BASE,
- (KA420_CH2_SIZE / VAX_NBPG));
- cacr = (void *)vax_map_physmem(KA420_CACR, 1);
- printf("secondary cache\n");
- ka41_cache_enable();
- } else
- printf("no secondary cache present\n");
- }
- /* Done with ka410_cpu - release it */
- vax_unmap_physmem((vaddr_t)ka410_cpu, 1);
- /*
- * Setup parameters necessary to read time from clock chip.
- */
- clk_adrshift = 1; /* Addressed at long's... */
- clk_tweak = 2; /* ...and shift two */
- clk_page = (short *)vax_map_physmem(KA420_WAT_BASE, 1);
-}
-
-void
-ka41_cache_enable()
-{
- *cacr = KA420_CACR_TPE; /* Clear any error, disable cache */
- bzero(l2cache, KA420_CH2_SIZE); /* Clear whole cache */
- *cacr = KA420_CACR_CEN; /* Enable cache */
-}
-
-void
-ka410_memerr()
-{
- printf("Memory err!\n");
-}
-
-int
-ka410_mchk(addr)
- caddr_t addr;
-{
- panic("Machine check");
- return 0;
-}
-
-static void
-ka410_halt()
-{
- asm("movl $0xc, (%0)"::"r"((int)clk_page + 0x38)); /* Don't ask */
- asm("halt");
-}
-
-static void
-ka410_reboot(arg)
- int arg;
-{
- asm("movl $0xc, (%0)"::"r"((int)clk_page + 0x38)); /* Don't ask */
- asm("halt");
-}
-
-static void
-ka410_clrf()
-{
- struct ka410_clock *clk = (void *)clk_page;
-
- /*
- * Clear restart and boot in progress flags
- * in the CPMBX. (ie. clear bits 4 and 5)
- */
- clk->cpmbx = (clk->cpmbx & ~0x30);
-}
diff --git a/sys/arch/vax/vax/ka43.c b/sys/arch/vax/vax/ka43.c
deleted file mode 100644
index 05c7ad6b343..00000000000
--- a/sys/arch/vax/vax/ka43.c
+++ /dev/null
@@ -1,373 +0,0 @@
-/* $OpenBSD: ka43.c,v 1.16 2014/05/08 19:06:07 miod Exp $ */
-/* $NetBSD: ka43.c,v 1.19 1999/09/06 19:52:53 ragge Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/types.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/mtpr.h>
-#include <machine/sid.h>
-#include <machine/pmap.h>
-#include <machine/uvax.h>
-#include <machine/vsbus.h>
-#include <machine/ka43.h>
-#include <machine/clock.h>
-
-static void ka43_conf(void);
-static void ka43_init(void);
-
-static int ka43_mchk(caddr_t);
-static void ka43_memerr(void);
-#if 0
-static void ka43_clear_errors(void);
-#endif
-static int ka43_cache_init(void); /* "int mapen" as argument? */
-static int ka43_cache_reset(int);
-static int ka43_cache_enable(void);
-static int ka43_cache_disable(void);
-static int ka43_cache_invalidate(void);
-static void ka43_halt(void);
-static void ka43_reboot(int);
-static void ka43_clrf(void);
-
-
-struct cpu_dep ka43_calls = {
- ka43_init,
- ka43_mchk,
- ka43_memerr,
- ka43_conf,
- chip_clkread,
- chip_clkwrite,
- 7, /* 7.6 VUP */
- 2, /* SCB pages */
- ka43_halt,
- ka43_reboot,
- ka43_clrf,
- icr_hardclock
-};
-
-static volatile struct ka43_cpu *ka43_cpu = (void *)KA43_CPU_BASE;
-static volatile u_int *ka43_creg = (void *)KA43_CH2_CREG;
-static volatile u_int *ka43_ctag = (void *)KA43_CT2_BASE;
-
-#define KA43_MC_RESTART 0x00008000 /* Restart possible*/
-#define KA43_PSL_FPDONE 0x00010000 /* First Part Done */
-
-struct ka43_mcframe { /* Format of RigelMAX machine check frame: */
- int mc43_bcnt; /* byte count, always 24 (0x18) */
- int mc43_code; /* machine check type code and restart bit */
- int mc43_addr; /* most recent (faulting?) virtual address */
- int mc43_viba; /* contents of VIBA register */
- int mc43_sisr; /* ICCS bit 6 and SISR bits 15:0 */
- int mc43_istate; /* internal state */
- int mc43_sc; /* shift count register */
- int mc43_pc; /* trapped PC */
- int mc43_psl; /* trapped PSL */
-};
-
-static char *ka43_mctype[] = {
- "no error (0)", /* Code 0: No error */
- "FPA: protocol error", /* Code 1-5: FPA errors */
- "FPA: illegal opcode",
- "FPA: operand parity error",
- "FPA: unknown status",
- "FPA: result parity error",
- "unused (6)", /* Code 6-7: Unused */
- "unused (7)",
- "MMU error (TLB miss)", /* Code 8-9: MMU errors */
- "MMU error (TLB hit)",
- "HW interrupt at unused IPL", /* Code 10: Interrupt error */
- "MOVCx impossible state", /* Code 11-13: Microcode errors */
- "undefined trap code (i-box)",
- "undefined control store address",
- "unused (14)", /* Code 14-15: Unused */
- "unused (15)",
- "PC tag or data parity error", /* Code 16: Cache error */
- "data bus parity error", /* Code 17: Read error */
- "data bus error (NXM)", /* Code 18: Write error */
- "undefined data bus state", /* Code 19: Bus error */
-};
-#define MC43_MAX 19
-
-static int ka43_error_count = 0;
-
-int
-ka43_mchk(addr)
- caddr_t addr;
-{
- register struct ka43_mcframe *mcf = (void *)addr;
-
- mtpr(0x00, PR_MCESR); /* Acknowledge the machine check */
- printf("machine check %d (0x%x)\n", mcf->mc43_code, mcf->mc43_code);
- printf("reason: %s\n", ka43_mctype[mcf->mc43_code & 0xff]);
- if (++ka43_error_count > 10) {
- printf("error_count exceeded: %d\n", ka43_error_count);
- return (-1);
- }
-
- /*
- * If either the Restart flag is set or the First-Part-Done flag
- * is set, and the TRAP2 (double error) bit is not set, then the
- * error is recoverable.
- */
- if (mfpr(PR_PCSTS) & KA43_PCS_TRAP2) {
- printf("TRAP2 (double error) in ka43_mchk.\n");
- panic("unrecoverable state in ka43_mchk.");
- return (-1);
- }
- if ((mcf->mc43_code & KA43_MC_RESTART) ||
- (mcf->mc43_psl & KA43_PSL_FPDONE)) {
- printf("ka43_mchk: recovering from machine-check.\n");
- ka43_cache_reset(0); /* reset caches */
- return (0); /* go on; */
- }
-
- /*
- * Unknown error state, panic/halt the machine!
- */
- printf("ka43_mchk: unknown error state!\n");
- return (-1);
-}
-
-void
-ka43_memerr()
-{
- /*
- * Don\'t know what to do here. So just print some messages
- * and try to go on...
- */
- printf("memory error!\n");
- printf("primary cache status: %lb\n", mfpr(PR_PCSTS), KA43_PCSTS_BITS);
- printf("secondary cache status: %b\n", *ka43_creg, KA43_SESR_BITS);
-}
-
-int
-ka43_cache_init()
-{
- return (ka43_cache_reset(1));
-}
-
-#if 0
-void
-ka43_clear_errors()
-{
- int val = *ka43_creg;
- val |= KA43_SESR_SERR | KA43_SESR_LERR | KA43_SESR_CERR;
- *ka43_creg = val;
-}
-#endif
-
-int
-ka43_cache_reset(int silent)
-{
- /*
- * resetting primary and secondary caches is done in three steps:
- * 1. disable both caches
- * 2. manually clear secondary cache
- * 3. enable both caches
- */
- ka43_cache_disable();
- ka43_cache_invalidate();
- ka43_cache_enable();
-
- if (silent == 0) {
- printf("primary cache status: %lb\n", mfpr(PR_PCSTS),
- KA43_PCSTS_BITS);
- printf("secondary cache status: %b\n", *ka43_creg,
- KA43_SESR_BITS);
- }
-
- return (0);
-}
-
-int
-ka43_cache_disable()
-{
- int val;
-
- /*
- * first disable primary cache and clear error flags
- */
- mtpr(KA43_PCS_REFRESH, PR_PCSTS); /* disable primary cache */
- val = mfpr(PR_PCSTS);
- mtpr(val, PR_PCSTS); /* clear error flags */
-
- /*
- * now disable secondary cache and clear error flags
- */
- val = *ka43_creg & ~KA43_SESR_CENB; /* BICL !!! */
- *ka43_creg = val; /* disable secondary cache */
- val = KA43_SESR_SERR | KA43_SESR_LERR | KA43_SESR_CERR;
- *ka43_creg = val; /* clear error flags */
-
- return (0);
-}
-
-int
-ka43_cache_invalidate()
-{
- int i, val;
-
- val = KA43_PCTAG_PARITY; /* clear valid flag, set parity bit */
- for (i = 0; i < 256; i++) { /* 256 Quadword entries */
- mtpr(i*8, PR_PCIDX); /* write index of tag */
- mtpr(val, PR_PCTAG); /* write value into tag */
- }
- val = KA43_PCS_FLUSH | KA43_PCS_REFRESH;
- mtpr(val, PR_PCSTS); /* flush primary cache */
-
- /*
- * Rigel\'s secondary cache doesn\'t implement a valid-flag.
- * Thus we initialize all entries with out-of-range/dummy
- * addresses which will never be referenced (ie. never hit).
- * After enabling cache we also access 128K of memory starting
- * at 0x00 so that secondary cache will be filled with these
- * valid addresses...
- */
- val = 0xff;
- /* if (memory > 28 MB) val = 0x55; */
- for (i = 0; i < KA43_CT2_SIZE; i+= 4) { /* Quadword entries ?? */
- ka43_ctag[i/4] = val; /* reset upper and lower */
- }
-
- return (0);
-}
-
-
-int
-ka43_cache_enable()
-{
- volatile char *membase = (void *)0x80000000; /* physical 0x00 */
- int i, val;
-
- val = KA43_PCS_FLUSH | KA43_PCS_REFRESH;
- mtpr(val, PR_PCSTS); /* flush primary cache */
-
- /*
- * now we enable secondary cache and access first 128K of memory
- * so that secondary cache gets really initialized and holds
- * valid addresses/data...
- */
- *ka43_creg = KA43_SESR_CENB; /* enable secondary cache */
- for (i=0; i<128*1024; i++) {
- val += membase[i]; /* some dummy operation... */
- }
-
- val = KA43_PCS_ENABLE | KA43_PCS_REFRESH;
- mtpr(val, PR_PCSTS); /* enable primary cache */
-
- return (0);
-}
-
-void
-ka43_conf()
-{
- printf("cpu: KA43\n");
- ka43_cpu = (void *)vax_map_physmem(VS_REGS, 1);
-
- ka43_creg = (void *)vax_map_physmem(KA43_CH2_CREG, 1);
- ka43_ctag = (void *)vax_map_physmem(KA43_CT2_BASE,
- (KA43_CT2_SIZE/VAX_NBPG));
-
- /*
- * ka43_conf() gets called with MMU enabled, now it's safe to
- * init/reset the caches.
- */
- ka43_cache_init();
-
- clk_adrshift = 1; /* Addressed at long's... */
- clk_tweak = 2; /* ...and shift two */
- clk_page = (short *)vax_map_physmem(VS_CLOCK, 1);
-}
-
-
-void
-ka43_init()
-{
- int val;
-
-
- /*
- * if LANCE\'s io-buffer is above 16 MB, then the appropriate flag
- * in the parity control register has to be set (it works as an
- * additional address bit). In any case, don\'t enable CPEN and
- * DPEN in the PARCTL register, somewhow they are internally managed
- * by the RIGEL chip itself!?!
- */
- val = ka43_cpu->parctl & 0x03; /* read the old value */
- ka43_cpu->parctl = val; /* and write new value */
-}
-
-static void
-ka43_clrf()
-{
- volatile struct ka43_clock *clk = (void *)clk_page;
-
- /*
- * Clear restart and boot in progress flags in the CPMBX.
- * The cpmbx is split into two 4-bit fields.
- * One for the current restart/boot in progress flags, and
- * one for the permanent halt flag.
- * The restart/boot in progress flag is also used as the action request
- * for the CPU at a halt. /BQT
- */
- clk->req = 0;
-}
-
-static void
-ka43_halt()
-{
- volatile struct ka43_clock *clk = (void *)clk_page;
-
- clk->req = 3; /* 3 is halt. */
- asm("halt");
-}
-
-static void
-ka43_reboot(arg)
- int arg;
-{
- volatile struct ka43_clock *clk = (void *)clk_page;
-
- clk->req = 2; /* 2 is reboot. */
- asm("halt");
-}
-
diff --git a/sys/arch/vax/vax/ka46.c b/sys/arch/vax/vax/ka46.c
deleted file mode 100644
index 3b17ed2eead..00000000000
--- a/sys/arch/vax/vax/ka46.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* $OpenBSD: ka46.c,v 1.12 2014/05/17 12:13:44 miod Exp $ */
-/* $NetBSD: ka46.c,v 1.12 2000/03/04 07:27:49 matt Exp $ */
-/*
- * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/types.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/mtpr.h>
-#include <machine/sid.h>
-#include <machine/pmap.h>
-#include <machine/uvax.h>
-#include <machine/ka410.h>
-#include <machine/ka420.h>
-#include <machine/ka46.h>
-#include <machine/clock.h>
-#include <machine/vsbus.h>
-
-static void ka46_conf(void);
-static void ka46_init(void);
-static void ka46_memerr(void);
-static int ka46_mchk(caddr_t);
-static void ka46_halt(void);
-static void ka46_reboot(int);
-static void ka46_cache_enable(void);
-static void ka46_hardclock(struct clockframe *);
-
-struct vs_cpu *ka46_cpu;
-
-/*
- * Declaration of 46-specific calls.
- */
-struct cpu_dep ka46_calls = {
- ka46_init,
- ka46_mchk,
- ka46_memerr,
- ka46_conf,
- chip_clkread,
- chip_clkwrite,
- 8, /* ~VUPS */
- 2, /* SCB pages */
- ka46_halt,
- ka46_reboot,
- NULL,
- ka46_hardclock
-};
-
-
-void
-ka46_conf()
-{
- switch (vax_siedata & 0xFF) {
- case VAX_VTYP_47:
- printf("cpu: KA47\n");
- break;
- case VAX_VTYP_46:
- printf("cpu: KA46\n");
- break;
- default:
- printf("cpu: Unknown Mariah\n");
- }
-
- ka46_cpu = (void *)vax_map_physmem(VS_REGS, 1);
- printf("cpu: turning on floating point chip\n");
- mtpr(2, PR_ACCS); /* Enable floating points */
- /*
- * Setup parameters necessary to read time from clock chip.
- */
- clk_adrshift = 1; /* Addressed at long's... */
- clk_tweak = 2; /* ...and shift two */
- clk_page = (short *)vax_map_physmem(VS_CLOCK, 1);
-}
-
-void
-ka46_cache_enable()
-{
- int i, *tmp;
-
- /* Disable caches */
- *(int *)KA46_CCR &= ~CCR_SPECIO;/* secondary */
- mtpr(PCSTS_FLUSH, PR_PCSTS); /* primary */
- *(int *)KA46_BWF0 &= ~BWF0_FEN; /* invalidate filter */
-
- /* Clear caches */
- tmp = (void *)KA46_INVFLT; /* inv filter */
- for (i = 0; i < 32768; i++)
- tmp[i] = 0;
-
- /* Write valid parity to all primary cache entries */
- for (i = 0; i < 256; i++) {
- mtpr(i << 3, PR_PCIDX);
- mtpr(PCTAG_PARITY, PR_PCTAG);
- }
-
- /* Secondary cache */
- tmp = (void *)KA46_TAGST;
- for (i = 0; i < KA46_TAGSZ*2; i+=2)
- tmp[i] = 0;
-
- /* Enable cache */
- *(int *)KA46_BWF0 |= BWF0_FEN; /* invalidate filter */
- mtpr(PCSTS_ENABLE, PR_PCSTS);
- *(int *)KA46_CCR = CCR_SPECIO | CCR_CENA;
-}
-
-void
-ka46_memerr()
-{
- printf("Memory err!\n");
-}
-
-int
-ka46_mchk(addr)
- caddr_t addr;
-{
- panic("Machine check");
- return 0;
-}
-
-void
-ka46_init()
-{
-
- /* Turn on caches (to speed up execution a bit) */
- ka46_cache_enable();
-}
-
-#define KA46_CPMBX 0x38
-#define KA46_HLT_HALT 0xcf
-#define KA46_HLT_BOOT 0x8b
-
-static void
-ka46_halt()
-{
- if (((u_int8_t *) clk_page)[KA46_CPMBX] != KA46_HLT_HALT)
- ((u_int8_t *) clk_page)[KA46_CPMBX] = KA46_HLT_HALT;
- asm("halt");
-}
-
-static void
-ka46_reboot(arg)
- int arg;
-{
- if (((u_int8_t *) clk_page)[KA46_CPMBX] != KA46_HLT_BOOT)
- ((u_int8_t *) clk_page)[KA46_CPMBX] = KA46_HLT_BOOT;
- asm("halt");
-}
-
-static void
-ka46_hardclock(struct clockframe *cf)
-{
- ka46_cpu->vc_diagtimu = 0;
- hardclock(cf);
-}
diff --git a/sys/arch/vax/vax/ka48.c b/sys/arch/vax/vax/ka48.c
deleted file mode 100644
index 194363e960f..00000000000
--- a/sys/arch/vax/vax/ka48.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* $OpenBSD: ka48.c,v 1.15 2014/05/17 12:13:44 miod Exp $ */
-/*
- * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*** needs to be completed MK-990306 ***/
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/mtpr.h>
-#include <machine/sid.h>
-#include <machine/pmap.h>
-#include <machine/uvax.h>
-#include <machine/ka410.h>
-#include <machine/ka420.h>
-#include <machine/ka48.h>
-#include <machine/clock.h>
-#include <machine/vsbus.h>
-
-static void ka48_conf(void);
-static void ka48_init(void);
-static void ka48_memerr(void);
-static int ka48_mchk(caddr_t);
-static void ka48_halt(void);
-static void ka48_reboot(int);
-static void ka48_cache_enable(void);
-static void ka48_hardclock(struct clockframe *);
-
-struct vs_cpu *ka48_cpu;
-
-/*
- * Declaration of 48-specific calls.
- */
-struct cpu_dep ka48_calls = {
- ka48_init,
- ka48_mchk,
- ka48_memerr,
- ka48_conf,
- chip_clkread,
- chip_clkwrite,
- 4, /* ~VUPS */
- 2, /* SCB pages */
- ka48_halt,
- ka48_reboot,
- NULL,
- ka48_hardclock
-};
-
-
-void
-ka48_conf()
-{
- char *cpuname;
- switch (vax_cpustype) {
- case VAX_STYP_45:
- cpuname = "KA45";
- break;
- case VAX_STYP_48:
- cpuname = "KA48";
- break;
- default:
- cpuname = "Unknown SOC";
- }
- printf("cpu: %s\n", cpuname);
- ka48_cpu = (void *)vax_map_physmem(VS_REGS, 1);
- /*
- * Setup parameters necessary to read time from clock chip.
- */
- clk_adrshift = 1; /* Addressed at long's... */
- clk_tweak = 2; /* ...and shift two */
- clk_page = (short *)vax_map_physmem(VS_CLOCK, 1);
-}
-
-void
-ka48_cache_enable()
-{
- int i, *tmp;
- long *par_ctl = (long *)KA48_PARCTL;
-
- /* Disable cache */
- mtpr(0, PR_CADR); /* disable */
- *par_ctl &= ~KA48_PARCTL_INVENA; /* clear ? invalid enable */
- mtpr(2, PR_CADR); /* flush */
-
- /* Clear caches */
- tmp = (void *)KA48_INVFLT; /* inv filter */
- for (i = 0; i < KA48_INVFLTSZ / sizeof(int); i++)
- tmp[i] = 0;
- *par_ctl |= KA48_PARCTL_INVENA; /* Enable ???? */
- mtpr(4, PR_CADR); /* enable cache */
- *par_ctl |= (KA48_PARCTL_AGS | /* AGS? */
- KA48_PARCTL_NPEN | /* N? Parity Enable */
- KA48_PARCTL_CPEN); /* Cpu parity enable */
-}
-
-void
-ka48_memerr()
-{
- printf("Memory err!\n");
-}
-
-int
-ka48_mchk(addr)
- caddr_t addr;
-{
- panic("Machine check");
- return 0;
-}
-
-void
-ka48_init()
-{
- /* Turn on caches (to speed up execution a bit) */
- ka48_cache_enable();
-}
-
-#define KA48_CPMBX 0x38
-#define KA48_HLT_HALT 0xcf /* 11001111 */
-#define KA48_HLT_BOOT 0x8b /* 10001011 */
-
-static void
-ka48_halt()
-{
- if (((u_int8_t *) clk_page)[KA48_CPMBX] != KA48_HLT_HALT)
- ((u_int8_t *) clk_page)[KA48_CPMBX] = KA48_HLT_HALT;
- asm("halt");
-}
-
-static void
-ka48_reboot(arg)
- int arg;
-{
- if (((u_int8_t *) clk_page)[KA48_CPMBX] != KA48_HLT_BOOT)
- ((u_int8_t *) clk_page)[KA48_CPMBX] = KA48_HLT_BOOT;
- asm("halt");
-}
-
-static void
-ka48_hardclock(struct clockframe *cf)
-{
- ka48_cpu->vc_diagtimu = 0;
- hardclock(cf);
-}
diff --git a/sys/arch/vax/vax/ka49.c b/sys/arch/vax/vax/ka49.c
deleted file mode 100644
index 87e66c1344f..00000000000
--- a/sys/arch/vax/vax/ka49.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/* $OpenBSD: ka49.c,v 1.12 2013/07/05 21:11:57 miod Exp $ */
-/*
- * Copyright (c) 1999 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/device.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-
-#include <machine/clock.h>
-#include <machine/cpu.h>
-#include <machine/scb.h>
-
-static void ka49_conf(void);
-static void ka49_memerr(void);
-static int ka49_mchk(caddr_t);
-static void ka49_halt(void);
-static void ka49_reboot(int);
-static void ka49_softmem(void *);
-static void ka49_hardmem(void *);
-static void ka49_init(void);
-static void ka49_cache_enable(void);
-static void ka49_halt(void);
-
-/*
- * Declaration of 49-specific calls.
- */
-struct cpu_dep ka49_calls = {
- ka49_init,
- ka49_mchk,
- ka49_memerr,
- ka49_conf,
- chip_clkread,
- chip_clkwrite,
- 32, /* ~VUPS */
- 2, /* SCB pages */
- ka49_halt,
- ka49_reboot,
- NULL,
- icr_hardclock
-};
-
-
-void
-ka49_conf()
-{
- printf("cpu0: KA49\n");
-
-/* Why??? */
-{ volatile int *hej = (void *)mfpr(PR_ISP); *hej = *hej; hej[-1] = hej[-1];}
-
- /* This vector shows up during shutdown, ignore it for now. */
- scb_vecalloc(0x0, (void *)nullop, NULL, SCB_ISTACK, NULL);
-
- /*
- * Setup parameters necessary to read time from clock chip.
- */
- clk_adrshift = 1; /* Addressed at long's... */
- clk_tweak = 2; /* ...and shift two */
- clk_page = (short *)vax_map_physmem(0x25400000, 1);
-}
-
-/*
- * Why may we get memory errors during startup???
- */
-void
-ka49_hardmem(arg)
- void *arg;
-{
- if (cold == 0)
- printf("Hard memory error\n");
- splhigh();
-}
-
-void
-ka49_softmem(arg)
- void *arg;
-{
- if (cold == 0)
- printf("Soft memory error\n");
- splhigh();
-}
-
-/*
- * KA49-specific IPRs. KA49 has the funny habit to control all caches
- * via IPRs.
- */
-#define PR_CCTL 0xa0
-#define CCTL_ENABLE 0x00000001
-#define CCTL_SSIZE 0x00000002
-#define CCTL_VSIZE 0x00000004
-#define CCTL_SW_ETM 0x40000000
-#define CCTL_HW_ETM 0x80000000
-
-#define PR_BCETSTS 0xa3
-#define PR_BCEDSTS 0xa6
-#define PR_NESTS 0xae
-
-#define PR_VMAR 0xd0
-#define PR_VTAG 0xd1
-#define PR_ICSR 0xd3
-#define ICSR_ENABLE 0x01
-
-#define PR_PCCTL 0xf8
-#define PCCTL_P_EN 0x10
-#define PCCTL_I_EN 0x02
-#define PCCTL_D_EN 0x01
-
-void
-ka49_cache_enable()
-{
- int start, slut;
-
- /*
- * Turn caches off.
- */
- mtpr(0, PR_ICSR);
- mtpr(0, PR_PCCTL);
- mtpr(mfpr(PR_CCTL) | CCTL_SW_ETM, PR_CCTL);
-
- /*
- * Invalidate caches.
- */
- mtpr(mfpr(PR_CCTL) | 0x10, PR_CCTL); /* Set cache size */
- mtpr(mfpr(PR_BCETSTS), PR_BCETSTS); /* Clear error bits */
- mtpr(mfpr(PR_BCEDSTS), PR_BCEDSTS); /* Clear error bits */
- mtpr(mfpr(PR_NESTS), PR_NESTS); /* Clear error bits */
-
- start = 0x01400000;
- slut = 0x01440000;
-
- /* Flush cache lines */
- for (; start < slut; start += 0x20)
- mtpr(0, start);
-
- mtpr((mfpr(PR_CCTL) & ~(CCTL_SW_ETM|CCTL_ENABLE)) | CCTL_HW_ETM,
- PR_CCTL);
-
- start = 0x01000000;
- slut = 0x01040000;
-
- /* clear tag and valid */
- for (; start < slut; start += 0x20)
- mtpr(0, start);
-
- mtpr(mfpr(PR_CCTL) | 0x10 | CCTL_ENABLE, PR_CCTL); /* enab. bcache */
-
- start = 0x01800000;
- slut = 0x01802000;
-
- /* Clear primary cache */
- for (; start < slut; start += 0x20)
- mtpr(0, start);
-
- /* Flush the pipes (via REI) */
- asm("movpsl -(%sp); movab 1f,-(%sp); rei; 1:;");
-
- /* Enable primary cache */
- mtpr(PCCTL_P_EN|PCCTL_I_EN|PCCTL_D_EN, PR_PCCTL);
-
- /* Enable the VIC */
- start = 0;
- slut = 0x800;
- for (; start < slut; start += 0x20) {
- mtpr(start, PR_VMAR);
- mtpr(0, PR_VTAG);
- }
- mtpr(ICSR_ENABLE, PR_ICSR);
-}
-
-void
-ka49_memerr()
-{
- printf("Memory err!\n");
-}
-
-int
-ka49_mchk(addr)
- caddr_t addr;
-{
- panic("Machine check");
- return 0;
-}
-
-void
-ka49_init()
-{
- /*
- * Get the soft and hard memory error vectors now.
- */
- scb_vecalloc(0x54, ka49_softmem, NULL, 0, NULL);
- scb_vecalloc(0x60, ka49_hardmem, NULL, 0, NULL);
-
- /* Turn on caches (to speed up execution a bit) */
- ka49_cache_enable();
-}
-
-#define KA49_CPMBX 0x38
-#define KA49_HLT_HALT 0xcf
-#define KA49_HLT_BOOT 0x8b
-
-static void
-ka49_halt()
-{
- if (((u_int8_t *) clk_page)[KA49_CPMBX] != KA49_HLT_HALT)
- ((u_int8_t *) clk_page)[KA49_CPMBX] = KA49_HLT_HALT;
- asm("halt");
-}
-
-static void
-ka49_reboot(arg)
- int arg;
-{
- if (((u_int8_t *) clk_page)[KA49_CPMBX] != KA49_HLT_BOOT)
- ((u_int8_t *) clk_page)[KA49_CPMBX] = KA49_HLT_BOOT;
- asm("halt");
-}
diff --git a/sys/arch/vax/vax/ka53.c b/sys/arch/vax/vax/ka53.c
deleted file mode 100644
index b7ff8169377..00000000000
--- a/sys/arch/vax/vax/ka53.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/* $OpenBSD: ka53.c,v 1.11 2013/07/05 21:11:57 miod Exp $ */
-/* $NetBSD: ka53.c,v 1.2 2000/06/04 02:19:27 matt Exp $ */
-/*
- * Copyright (c) 2002 Hugh Graham.
- * Copyright (c) 2000 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/device.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-
-#include <machine/clock.h>
-#include <machine/cpu.h>
-#include <machine/scb.h>
-#include <machine/sid.h>
-#include <machine/mtpr.h>
-
-static void ka53_conf(void);
-static void ka53_memerr(void);
-static int ka53_mchk(caddr_t);
-static void ka53_softmem(void *);
-static void ka53_hardmem(void *);
-static void ka53_init(void);
-static void ka53_cache_enable(void);
-
-/*
- * Declaration of 680-specific calls.
- */
-struct cpu_dep ka53_calls = {
- ka53_init,
- ka53_mchk,
- ka53_memerr,
- ka53_conf,
- generic_clkread,
- generic_clkwrite,
- 32, /* ~VUPS */
- 2, /* SCB pages */
- generic_halt,
- generic_reboot,
- NULL,
- icr_hardclock
-};
-
-void
-ka53_conf()
-{
- char *cpuname;
-
- /* This initialises ISP, avoiding interrupt exceptions */
- {volatile int *hej = (void *)mfpr(PR_ISP); *hej = *hej; hej[-1] = hej[-1];}
-
- /* This vector (qbus related?) comes out of nowhere, ignore it for now */
- scb_vecalloc(0x0, (void *)nullop, NULL, SCB_ISTACK, NULL);
-
- cpmbx = (struct cpmbx *)vax_map_physmem(0x20140400, 1);
-
- switch (vax_cpustype) {
- case VAX_STYP_50:
- cpuname = "KA50";
- break;
- case VAX_STYP_51:
- cpuname = "KA51";
- break;
- case VAX_STYP_52:
- cpuname = "KA52";
- break;
- case VAX_STYP_53:
- cpuname = "KA53";
- break;
- default:
- cpuname = "unknown NVAX";
- }
- printf("cpu0: %s, ucode rev %d\n", cpuname, vax_cpudata & 0xff);
-}
-
-/*
- * Why may we get memory errors during startup???
- */
-
-void
-ka53_hardmem(void *arg)
-{
- if (cold == 0)
- printf("Hard memory error\n");
- splhigh();
-}
-
-void
-ka53_softmem(void *arg)
-{
- if (cold == 0)
- printf("Soft memory error\n");
- splhigh();
-}
-
-
-/*
- * KA53-specific IPRs. KA53 has the funny habit to control all caches
- * via IPRs.
- */
-#define PR_CCTL 0xa0
-#define CCTL_ENABLE 0x00000001
-#define CCTL_SW_ETM 0x40000000
-#define CCTL_HW_ETM 0x80000000
-
-#define PR_BCETSTS 0xa3
-#define PR_BCEDSTS 0xa6
-#define PR_NESTS 0xae
-
-#define PR_VMAR 0xd0
-#define PR_VTAG 0xd1
-#define PR_ICSR 0xd3
-#define ICSR_ENABLE 0x01
-
-#define PR_PCCTL 0xf8
-#define PCCTL_P_EN 0x10
-#define PCCTL_I_EN 0x02
-#define PCCTL_D_EN 0x01
-
-void
-ka53_cache_enable()
-{
- int start, slut;
-
- /*
- * Turn caches off.
- */
- mtpr(0, PR_ICSR);
- mtpr(0, PR_PCCTL);
- mtpr(mfpr(PR_CCTL) | CCTL_SW_ETM, PR_CCTL);
-
- /*
- * Invalidate caches.
- */
- mtpr(mfpr(PR_CCTL) | 6, PR_CCTL); /* Set cache size and speed */
- mtpr(mfpr(PR_BCETSTS), PR_BCETSTS); /* Clear error bits */
- mtpr(mfpr(PR_BCEDSTS), PR_BCEDSTS); /* Clear error bits */
- mtpr(mfpr(PR_NESTS), PR_NESTS); /* Clear error bits */
-
-
- start = 0x01400000;
- slut = 0x01420000;
-
- /* Flush cache lines */
- for (; start < slut; start += 0x20)
- mtpr(0, start);
-
- mtpr((mfpr(PR_CCTL) & ~(CCTL_SW_ETM|CCTL_ENABLE)) | CCTL_HW_ETM,
- PR_CCTL);
-
- start = 0x01000000;
- slut = 0x01020000;
-
- /* clear tag and valid */
- for (; start < slut; start += 0x20)
- mtpr(0, start);
-
- mtpr(mfpr(PR_CCTL) | 6 | CCTL_ENABLE, PR_CCTL); /* enab. bcache */
-
- start = 0x01800000;
- slut = 0x01802000;
-
- /* Clear primary cache */
- for (; start < slut; start += 0x20)
- mtpr(0, start);
-
- /* Flush the pipes (via REI) */
- asm("movpsl -(%sp); movab 1f,-(%sp); rei; 1:;");
-
- /* Enable primary cache */
- mtpr(PCCTL_P_EN|PCCTL_I_EN|PCCTL_D_EN, PR_PCCTL);
-
- /* Enable the VIC */
- start = 0;
- slut = 0x800;
- for (; start < slut; start += 0x20) {
- mtpr(start, PR_VMAR);
- mtpr(0, PR_VTAG);
- }
- mtpr(ICSR_ENABLE, PR_ICSR);
-}
-
-void
-ka53_memerr()
-{
- printf("Memory err!\n");
-}
-
-int
-ka53_mchk(caddr_t addr)
-{
- mtpr(0x00, PR_MCESR);
- printf("Machine Check\n");
- return 0;
-}
-
-void
-ka53_init()
-{
-
- /*
- * Get the soft and hard memory error vectors now.
- */
-
- scb_vecalloc(0x54, ka53_softmem, NULL, 0, NULL);
- scb_vecalloc(0x60, ka53_hardmem, NULL, 0, NULL);
-
-
- /* Turn on caches (to speed up execution a bit) */
- ka53_cache_enable();
-}
diff --git a/sys/arch/vax/vax/ka60.c b/sys/arch/vax/vax/ka60.c
deleted file mode 100644
index 4896f44042c..00000000000
--- a/sys/arch/vax/vax/ka60.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/* $OpenBSD: ka60.c,v 1.3 2011/09/15 00:48:24 miod Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mt. Xinu.
- *
- * 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.
- *
- * @(#)ka650.c 7.7 (Berkeley) 12/16/90
- */
-
-/*
- * VAXstation 3500 (KA60) specific code. Based on the KA650 specific code.
- */
-
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <uvm/uvm_extern.h>
-
-#include <machine/cvax.h>
-#include <machine/clock.h>
-#include <machine/cpu.h>
-#include <machine/mtpr.h>
-#include <machine/nexus.h>
-#include <machine/psl.h>
-#include <machine/sid.h>
-#include <machine/rpb.h>
-#include <machine/cca.h>
-#include <machine/scb.h>
-
-#include <vax/mbus/mbusreg.h>
-#include <vax/mbus/mbusvar.h>
-#include <vax/mbus/fwioreg.h>
-
-int ka60_clkread(struct timespec *, time_t);
-void ka60_clkwrite(void);
-void ka60_clrf(void);
-void ka60_conf(void);
-void ka60_halt(void);
-void ka60_hardclock(struct clockframe *);
-void ka60_init(void);
-int ka60_mchk(caddr_t);
-void ka60_memerr(void);
-void ka60_reboot(int);
-
-struct cpu_dep ka60_calls = {
- ka60_init,
- ka60_mchk,
- ka60_memerr,
- ka60_conf,
- ka60_clkread,
- ka60_clkwrite,
- 3, /* ~VUPS */
- 2, /* SCB pages */
-#if 0 /* this ought to work, dammit! */
- cvax_halt,
- cvax_reboot,
-#else
- ka60_halt,
- ka60_reboot,
-#endif
- ka60_clrf,
- ka60_hardclock
-};
-
-void ka60_memwrtmo(void *);
-
-struct cca *cca;
-unsigned int cca_size;
-
-unsigned int ka60cpus = 1;
-uint32_t *ka60_iocsr;
-
-/*
- * Early system initialization, while still running physical.
- *
- * The PROM will have enabled the L2 cache, but each individual
- * CPU still has its own L1 cache disabled.
- *
- * L1 cache configuration is similar to KA650, without external
- * configuration registers.
- */
-void
-ka60_init()
-{
- unsigned int mid;
- paddr_t fbicaddr;
- uint32_t modtype, fbicrange;
- int i;
-
- /*
- * Enable CPU cache.
- */
- mtpr(CADR_SEN2 | CADR_SEN1 | CADR_CENI | CADR_CEND, PR_CADR);
-
- cca = (struct cca *)rpb.cca_addr; /* physical!!! */
- if (cca == NULL) {
- /*
- * If things are *that* wrong, stick to 2 cpus and a
- * monoprocessor kernel, really. We could try looking
- * for a CCA signature from the top of memory downwards,
- * or count CPU boards to get the correct number of
- * processors, but is it really worth doing? I don't
- * think we are in Kansas anymore anyway...
- */
- ka60cpus = 2;
- } else {
- cca_size = vax_atop(cca->cca_size);
-
- /*
- * Count the other processors.
- */
- for (i = 0; i < cca->cca_nproc; i++)
- if (cca->cca_console & (1 << i))
- ka60cpus++;
- }
-
- snprintf(cpu_model, sizeof cpu_model, "VAXstation 35%d0", ka60cpus);
-
- /*
- * Silence memory write timeout errors now.
- */
- scb_vecalloc(0x60, ka60_memwrtmo, NULL, 0, NULL);
-
- /*
- * We need to find out which M-bus slot contains the I/O
- * module. This could not have been done before because
- * we were not able to handle machine check (and thus run
- * badaddr() on each slot), and this has to be done before
- * consinit() may try to talk to the serial ports.
- *
- * Note that there might be multiple I/O modules in the system.
- * We do not know which I/O module the PROM will prefer; however
- * since only one module should be configured to map the SSC at
- * its preferred address, it is possible to find out which one
- * has been selected.
- */
-
- for (mid = 0; mid < MBUS_SLOT_MAX; mid++) {
- fbicaddr = MBUS_SLOT_BASE(mid) + FBIC_BASE;
- if (badaddr((caddr_t)(fbicaddr + FBIC_MODTYPE), 4) != 0)
- continue;
- modtype = *(uint32_t *)(fbicaddr + FBIC_MODTYPE);
- if ((modtype & MODTYPE_CLASS_MASK) >> MODTYPE_CLASS_SHIFT !=
- CLASS_IO)
- continue;
-
- mbus_ioslot = mid;
-
- fbicrange = *(uint32_t *)(fbicaddr + FBIC_RANGE);
- if (fbicrange ==
- ((HOST_TO_MBUS(CVAX_SSC) & RANGE_MATCH) | RANGE_ENABLE))
- break;
- }
-
- if ((int)mbus_ioslot < 0) {
- /*
- * This shouldn't happen. Try mid #5 (enclosure slot #4) as a
- * supposedly sane default.
- */
- mbus_ioslot = 5;
- }
-}
-
-/*
- * Early system initialization, while running virtual, and before
- * devices are probed.
- */
-void
-ka60_conf()
-{
- printf("cpu0: KA60\n");
-
- cvax_ssc_ptr = (void *)vax_map_physmem(CVAX_SSC, 3);
-
- /*
- * Remap the CCA now we're running virtual.
- */
- if (cca != NULL)
- cca = (void *)vax_map_physmem((paddr_t)cca, cca_size);
-
- /*
- * Map the IOCSR register of the main I/O module, and enable
- * CPU clock. We'll need this mapping for reset as well.
- */
- ka60_iocsr = (uint32_t *)vax_map_physmem(MBUS_SLOT_BASE(mbus_ioslot) +
- FWIO_IOCSR_OFFSET, 1);
- if (ka60_iocsr == 0)
- panic("can not map IOCSR");
-
- *ka60_iocsr |= FWIO_IOCSR_CLKIEN | FWIO_IOCSR_MRUN | FWIO_IOCSR_CNSL;
-}
-
-/*
- * Corrected memory error trap.
- */
-void
-ka60_memerr()
-{
- printf("cpu0: corrected memory error\n");
- /*
- * Need to peek at the M-bus error logs, display anything
- * interesting, and clear them.
- */
-}
-
-/*
- * Machine check trap.
- */
-int
-ka60_mchk(caddr_t mcef)
-{
- struct cvax_mchk_frame *mcf = (struct cvax_mchk_frame *)mcef;
- u_int type = mcf->cvax_summary;
- const char *descr;
-
- printf("machine check %x", type);
- descr = cvax_mchk_descr(type);
- if (descr != NULL)
- printf(": %s", descr);
- printf("\n\tvap %x istate1 %x istate2 %x pc %x psl %x\n",
- mcf->cvax_mrvaddr, mcf->cvax_istate1, mcf->cvax_istate2,
- mcf->cvax_pc, mcf->cvax_psl);
-
- return MCHK_PANIC;
-}
-
-/*
- * Clock routines. They need to access the TODR through the SSC.
- */
-int
-ka60_clkread(struct timespec *ts, time_t base)
-{
- unsigned klocka = cvax_ssc_ptr->ssc_todr;
-
- /*
- * Sanity check.
- */
- if (klocka < TODRBASE) {
- if (klocka == 0) {
- printf("TODR stopped");
- cvax_ssc_ptr->ssc_todr = 1; /* spin it */
- } else
- printf("TODR too small");
- return EINVAL;
- }
-
- ts->tv_sec = yeartonum(numtoyear(base)) + (klocka - TODRBASE) / 100;
- ts->tv_nsec = 0;
- return 0;
-}
-
-void
-ka60_clkwrite()
-{
- uint32_t tid = time_second, bastid;
-
- bastid = tid - yeartonum(numtoyear(tid));
- cvax_ssc_ptr->ssc_todr = (bastid * 100) + TODRBASE;
-}
-
-void
-ka60_halt()
-{
- printf("system halted.\n");
- asm("halt");
-}
-
-void
-ka60_reboot(arg)
- int arg;
-{
- printf("resetting system...\n");
- delay(500000);
- *ka60_iocsr |= FWIO_IOCSR_RSTWS;
-}
-
-/*
- * Probing empty M-bus slots causes this vector to be triggered.
- *
- * We get one after the first spl0(), if probing for the console
- * slot caused us to look at empty slots, and then one per empty
- * slot during autoconf.
- *
- * There shouldn't be any such error after autoconf, though.
- */
-void
-ka60_memwrtmo(void *arg)
-{
- /* do nothing */
-}
-
-void
-ka60_clrf(void)
-{
- /*
- * Restore the memory write timeout vector.
- */
- scb_vecalloc(0x60, scb_stray, (void *)0x60, SCB_ISTACK, NULL);
-}
-
-/*
- * SSC clock interrupts come at level 0x16, which is not enough for
- * our needs, so raise the level here before invoking hardclock().
- */
-void
-ka60_hardclock(struct clockframe *cf)
-{
- int s;
-
- s = splclock();
- icr_hardclock(cf);
- splx(s);
-}
diff --git a/sys/arch/vax/vax/ka630.c b/sys/arch/vax/vax/ka630.c
deleted file mode 100644
index d420cecd880..00000000000
--- a/sys/arch/vax/vax/ka630.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/* $OpenBSD: ka630.c,v 1.12 2011/09/15 00:48:24 miod Exp $ */
-/* $NetBSD: ka630.c,v 1.17 1999/09/06 19:52:52 ragge Exp $ */
-/*-
- * Copyright (c) 1982, 1988, 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.
- *
- * @(#)ka630.c 7.8 (Berkeley) 5/9/91
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/time.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/cpu.h>
-#include <machine/pmap.h>
-#include <machine/ka630.h>
-#include <machine/clock.h>
-#include <machine/vsbus.h>
-
-static struct uvaxIIcpu *uvaxIIcpu_ptr;
-
-static void ka630_conf(void);
-static void ka630_memerr(void);
-static int ka630_mchk(caddr_t);
-static void ka630_halt(void);
-static void ka630_reboot(int);
-static void ka630_clrf(void);
-
-struct cpu_dep ka630_calls = {
- 0,
- ka630_mchk,
- ka630_memerr,
- ka630_conf,
- chip_clkread,
- chip_clkwrite,
- 1, /* ~VUPS */
- 2, /* SCB pages */
- ka630_halt,
- ka630_reboot,
- ka630_clrf,
- icr_hardclock
-};
-
-/*
- * uvaxII_conf() is called by cpu_attach to do the cpu_specific setup.
- */
-void
-ka630_conf()
-{
- clk_adrshift = 0; /* Addressed at short's... */
- clk_tweak = 0; /* ...and no shifting */
- clk_page = (short *)vax_map_physmem((paddr_t)KA630CLK, 1);
-
- uvaxIIcpu_ptr = (void *)vax_map_physmem(VS_REGS, 1);
-
- /*
- * Enable memory parity error detection and clear error bits.
- */
- uvaxIIcpu_ptr->uvaxII_mser = (UVAXIIMSER_PEN | UVAXIIMSER_MERR |
- UVAXIIMSER_LEB);
-}
-
-/* log crd errors */
-void
-ka630_memerr()
-{
- printf("memory err!\n");
-}
-
-#define NMC78032 10
-char *mc78032[] = {
- 0, "immcr (fsd)", "immcr (ssd)", "fpu err 0",
- "fpu err 7", "mmu st(tb)", "mmu st(m=0)", "pte in p0",
- "pte in p1", "un intr id",
-};
-
-struct mc78032frame {
- int mc63_bcnt; /* byte count == 0xc */
- int mc63_summary; /* summary parameter */
- int mc63_mrvaddr; /* most recent vad */
- int mc63_istate; /* internal state */
- int mc63_pc; /* trapped pc */
- int mc63_psl; /* trapped psl */
-};
-
-int
-ka630_mchk(cmcf)
- caddr_t cmcf;
-{
- register struct mc78032frame *mcf = (struct mc78032frame *)cmcf;
- register u_int type = mcf->mc63_summary;
-
- printf("machine check %x", type);
- if (type < NMC78032 && mc78032[type])
- printf(": %s", mc78032[type]);
- printf("\n\tvap %x istate %x pc %x psl %x\n",
- mcf->mc63_mrvaddr, mcf->mc63_istate,
- mcf->mc63_pc, mcf->mc63_psl);
- if (uvaxIIcpu_ptr && uvaxIIcpu_ptr->uvaxII_mser & UVAXIIMSER_MERR) {
- printf("\tmser=0x%lx ", uvaxIIcpu_ptr->uvaxII_mser);
- if (uvaxIIcpu_ptr->uvaxII_mser & UVAXIIMSER_CPUE)
- printf("page=%ld", uvaxIIcpu_ptr->uvaxII_cear);
- if (uvaxIIcpu_ptr->uvaxII_mser & UVAXIIMSER_DQPE)
- printf("page=%ld", uvaxIIcpu_ptr->uvaxII_dear);
- printf("\n");
- }
- return (-1);
-}
-
-static void
-ka630_halt()
-{
- ((struct ka630clock *)clk_page)->cpmbx = KA630CLK_DOTHIS|KA630CLK_HALT;
- asm("halt");
-}
-
-static void
-ka630_reboot(arg)
- int arg;
-{
- ((struct ka630clock *)clk_page)->cpmbx =
- KA630CLK_DOTHIS | KA630CLK_REBOOT;
-}
-
-/*
- * Clear restart and boot in progress flags in the CPMBX.
- */
-static void
-ka630_clrf()
-{
- short i = ((struct ka630clock *)clk_page)->cpmbx;
-
- ((struct ka630clock *)clk_page)->cpmbx = i & KA630CLK_LANG;
-}
diff --git a/sys/arch/vax/vax/ka650.c b/sys/arch/vax/vax/ka650.c
deleted file mode 100644
index d9e4491ec35..00000000000
--- a/sys/arch/vax/vax/ka650.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/* $OpenBSD: ka650.c,v 1.22 2014/05/08 19:06:07 miod Exp $ */
-/* $NetBSD: ka650.c,v 1.25 2001/04/27 15:02:37 ragge Exp $ */
-/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mt. Xinu.
- *
- * 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.
- *
- * @(#)ka650.c 7.7 (Berkeley) 12/16/90
- */
-
-/*
- * vax650-specific code.
- */
-
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <uvm/uvm_extern.h>
-
-#include <machine/cvax.h>
-#include <machine/ka650.h>
-#include <machine/clock.h>
-#include <machine/cpu.h>
-#include <machine/psl.h>
-#include <machine/mtpr.h>
-#include <machine/sid.h>
-#include <machine/nexus.h>
-
-struct ka650_merr *ka650merr_ptr;
-struct ka650_cbd *ka650cbd_ptr;
-struct ka650_ipcr *ka650ipcr_ptr;
-int *KA650_CACHE_ptr;
-
-#define CACHEOFF 0
-#define CACHEON 1
-
-static void ka650setcache(int);
-static void uvaxIII_conf(void);
-static void uvaxIII_memerr(void);
-static int uvaxIII_mchk(caddr_t);
-
-struct cpu_dep ka650_calls = {
- NULL,
- uvaxIII_mchk,
- uvaxIII_memerr,
- uvaxIII_conf,
- generic_clkread,
- generic_clkwrite,
- 4, /* ~VUPS */
- 2, /* SCB pages */
- cvax_halt,
- cvax_reboot,
- NULL,
- icr_hardclock
-};
-
-/*
- * uvaxIII_conf() is called by cpu_attach to do the cpu_specific setup.
- */
-void
-uvaxIII_conf()
-{
- /*
- * MicroVAX III: We map in memory error registers,
- * cache control registers, SSC registers,
- * interprocessor registers and cache diag space.
- */
- ka650merr_ptr = (void *)vax_map_physmem(KA650_MERR, 1);
- ka650cbd_ptr = (void *)vax_map_physmem(KA650_CBD, 1);
- cvax_ssc_ptr = (void *)vax_map_physmem(CVAX_SSC, 3);
- ka650ipcr_ptr = (void *)vax_map_physmem(KA650_IPCR, 1);
- KA650_CACHE_ptr = (void *)vax_map_physmem(KA650_CACHE,
- (KA650_CACHESIZE/VAX_NBPG));
-
- printf("cpu: KA6%d%d, CVAX microcode rev %d Firmware rev %d\n",
- vax_cpustype == VAX_STYP_640 ? 4 : 5,
- vax_cpustype == VAX_STYP_655 ? 5 : 0,
- (vax_cpudata & 0xff), GETFRMREV(vax_siedata));
- ka650setcache(CACHEON);
- if (ptoa(physmem) > ka650merr_ptr->merr_qbmbr) {
- printf("physmem(0x%lx) > qbmbr(0x%lx)\n",
- ptoa(physmem), ka650merr_ptr->merr_qbmbr);
- panic("qbus map unprotected");
- }
- if (mfpr(PR_TODR) == 0)
- mtpr(1, PR_TODR);
-}
-
-void
-uvaxIII_memerr()
-{
- printf("memory err!\n");
-#if 0 /* XXX Fix this */
- register char *cp = (char *)0;
- register int m;
- extern u_int cache2tag;
-
- if (ka650cbd.cbd_cacr & CACR_CPE) {
- printf("cache 2 tag parity error: ");
- if (time_second - cache2tag < 7) {
- ka650setcache(CACHEOFF);
- printf("caching disabled\n");
- } else {
- cache2tag = time_second;
- printf("flushing cache\n");
- ka650setcache(CACHEON);
- }
- }
- m = ka650merr.merr_errstat;
- ka650merr.merr_errstat = MEM_EMASK;
- if (m & MEM_CDAL) {
- cp = "Bus Parity";
- } else if (m & MEM_RDS) {
- cp = "Hard ECC";
- } else if (m & MEM_CRD) {
- cp = "Soft ECC";
- }
- if (cp) {
- printf("%sMemory %s Error: page 0x%x\n",
- (m & MEM_DMA) ? "DMA " : "", cp,
- (m & MEM_PAGE) >> MEM_PAGESHFT);
- }
-#endif
-}
-
-u_int cache1tag;
-u_int cache1data;
-u_int cdalerr;
-u_int cache2tag;
-
-int
-uvaxIII_mchk(cmcf)
- caddr_t cmcf;
-{
- struct cvax_mchk_frame *mcf = (struct cvax_mchk_frame *)cmcf;
- u_int type = mcf->cvax_summary;
- const char *descr;
- u_int i;
-
- printf("machine check %x", type);
- descr = cvax_mchk_descr(type);
- if (descr != NULL)
- printf(": %s", descr);
- printf("\n\tvap %x istate1 %x istate2 %x pc %x psl %x\n",
- mcf->cvax_mrvaddr, mcf->cvax_istate1, mcf->cvax_istate2,
- mcf->cvax_pc, mcf->cvax_psl);
- printf("dmaser=0x%lb qbear=0x%lx dmaear=0x%lx\n",
- ka650merr_ptr->merr_dser, DMASER_BITS,
- ka650merr_ptr->merr_qbear,
- ka650merr_ptr->merr_dear);
- ka650merr_ptr->merr_dser = DSER_CLEAR;
-
- i = mfpr(PR_CAER);
- mtpr(CAER_MCC | CAER_DAT | CAER_TAG, PR_CAER);
- if (i & CAER_MCC) {
- printf("cache 1 ");
- if (i & CAER_DAT) {
- printf("data");
- i = cache1data;
- cache1data = time_second;
- }
- if (i & CAER_TAG) {
- printf("tag");
- i = cache1tag;
- cache1tag = time_second;
- }
- } else if ((i & CAER_MCD) || (ka650merr_ptr->merr_errstat & MEM_CDAL)) {
- printf("CDAL");
- i = cdalerr;
- cdalerr = time_second;
- }
- if (time_second - i < 7) {
- ka650setcache(CACHEOFF);
- printf(" parity error: caching disabled\n");
- } else {
- printf(" parity error: flushing cache\n");
- ka650setcache(CACHEON);
- }
- /*
- * May be able to recover if type is 1-4, 0x80 or 0x81, but
- * only if FPD is set in the saved PSL, or bit VCR in Istate2
- * is clear.
- */
- if ((type > 0 && type < 5) || type == 0x80 || type == 0x81) {
- if ((mcf->cvax_psl & PSL_FPD)
- || !(mcf->cvax_istate2 & IS2_VCR)) {
- uvaxIII_memerr();
- return MCHK_RECOVERED;
- }
- }
- return MCHK_PANIC;
-}
-
-/*
- * Make sure both caches are off and not in diagnostic mode. Clear the
- * 2nd level cache (by writing to each quadword entry), then enable it.
- * Enable 1st level cache too.
- */
-void
-ka650setcache(int state)
-{
- int i;
-
- /*
- * Before doing anything, disable the cache.
- */
- mtpr(0, PR_CADR);
- if (vax_cpustype != VAX_STYP_640)
- ka650cbd_ptr->cbd_cacr = CACR_CPE;
-
- /*
- * Check what we want to do, enable or disable.
- */
- if (state == CACHEON) {
- mtpr(CADR_SEN2 | CADR_SEN1 | CADR_CENI | CADR_CEND, PR_CADR);
- if (vax_cpustype != VAX_STYP_640) {
- for (i = 0;
- i < (KA650_CACHESIZE / sizeof(KA650_CACHE_ptr[0]));
- i += 2)
- KA650_CACHE_ptr[i] = 0;
- ka650cbd_ptr->cbd_cacr = CACR_CEN;
- }
- }
-}
diff --git a/sys/arch/vax/vax/ka660.c b/sys/arch/vax/vax/ka660.c
deleted file mode 100644
index 1d494421ab6..00000000000
--- a/sys/arch/vax/vax/ka660.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* $OpenBSD: ka660.c,v 1.8 2011/09/15 00:48:24 miod Exp $ */
-/* $NetBSD: ka660.c,v 1.3 2000/06/29 07:14:27 mrg Exp $ */
-/*
- * Copyright (c) 2000 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/types.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/mtpr.h>
-#include <machine/sid.h>
-#include <machine/pmap.h>
-#include <machine/uvax.h>
-#include <machine/ka410.h>
-#include <machine/ka420.h>
-#include <machine/clock.h>
-#include <machine/vsbus.h>
-
-#define KA660_CCR 37 /* Cache Control Register */
-#define KA660_CTAG 0x20150000 /* Cache Tags */
-#define KA660_CDATA 0x20150400 /* Cache Data */
-#define KA660_BEHR 0x20150800 /* Bank Enable/Hit Register */
-#define CCR_WWP 8 /* Write Wrong Parity */
-#define CCR_ENA 4 /* Cache Enable */
-#define CCR_FLU 2 /* Cache Flush */
-#define CCR_DIA 1 /* Diagnostic mode */
-
-static void ka660_conf(void);
-static void ka660_memerr(void);
-static int ka660_mchk(caddr_t);
-static void ka660_cache_enable(void);
-
-/*
- * Declaration of 660-specific calls.
- */
-struct cpu_dep ka660_calls = {
- ka660_cache_enable,
- ka660_mchk,
- ka660_memerr,
- ka660_conf,
- generic_clkread,
- generic_clkwrite,
- 6, /* ~VUPS */
- 2, /* SCB pages */
- generic_halt,
- generic_reboot,
- NULL,
- icr_hardclock
-};
-
-
-void
-ka660_conf()
-{
- printf("cpu0: KA660, microcode Rev. %d\n", vax_cpudata & 0377);
-
- cpmbx = (struct cpmbx *)vax_map_physmem(0x20140400, 1);
-}
-
-void
-ka660_cache_enable()
-{
- unsigned int *p;
- int cnt, bnk, behrtmp;
-
- mtpr(0, KA660_CCR); /* Disable cache */
- mtpr(CCR_DIA, KA660_CCR); /* Switch to diag mode */
- bnk = 1;
- behrtmp = 0;
- while(bnk <= 0x80)
- {
- *(int *)KA660_BEHR = bnk;
- p = (int *)KA660_CDATA;
- *p = 0x55aaff00L;
- if(*p == 0x55aaff00L) behrtmp |= bnk;
- *p = 0xffaa0055L;
- if(*p != 0xffaa0055L) behrtmp &= ~bnk;
- cnt = 256;
- while(cnt--) *p++ = 0L;
- p = (int *) KA660_CTAG;
- cnt =128;
- while(cnt--) { *p++ = 0x80000000L; p++; }
- bnk <<= 1;
- }
- *(int *)KA660_BEHR = behrtmp;
-
- mtpr(CCR_DIA|CCR_FLU, KA660_CCR); /* Flush tags */
- mtpr(CCR_ENA, KA660_CCR); /* Enable cache */
-}
-
-void
-ka660_memerr()
-{
- printf("Memory err!\n");
-}
-
-int
-ka660_mchk(addr)
- caddr_t addr;
-{
- panic("Machine check");
- return 0;
-}
diff --git a/sys/arch/vax/vax/ka670.c b/sys/arch/vax/vax/ka670.c
deleted file mode 100644
index 0f3ee6ef380..00000000000
--- a/sys/arch/vax/vax/ka670.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/* $OpenBSD: ka670.c,v 1.12 2014/05/08 19:06:07 miod Exp $ */
-/* $NetBSD: ka670.c,v 1.4 2000/03/13 23:52:35 soren Exp $ */
-/*
- * Copyright (c) 1999 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/types.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/mtpr.h>
-#include <machine/sid.h>
-#include <machine/pmap.h>
-#include <machine/uvax.h>
-#include <machine/vsbus.h>
-#include <machine/ka670.h>
-#include <machine/clock.h>
-
-static void ka670_conf(void);
-
-static int ka670_mchk(caddr_t);
-static void ka670_memerr(void);
-static int ka670_cache_init(void); /* "int mapen" as argument? */
-
-struct cpu_dep ka670_calls = {
- 0,
- ka670_mchk,
- ka670_memerr,
- ka670_conf,
- generic_clkread,
- generic_clkwrite,
- 8, /* 8 VUP */
- 2, /* SCB pages */
- generic_halt,
- generic_reboot,
- NULL,
- icr_hardclock
-};
-
-#define KA670_MC_RESTART 0x00008000 /* Restart possible*/
-#define KA670_PSL_FPDONE 0x00010000 /* First Part Done */
-
-struct ka670_mcframe { /* Format of RigelMAX machine check frame: */
- int mc670_bcnt; /* byte count, always 24 (0x18) */
- int mc670_code; /* machine check type code and restart bit */
- int mc670_addr; /* most recent (faulting?) virtual address */
- int mc670_viba; /* contents of VIBA register */
- int mc670_sisr; /* ICCS bit 6 and SISR bits 15:0 */
- int mc670_istate; /* internal state */
- int mc670_sc; /* shift count register */
- int mc670_pc; /* trapped PC */
- int mc670_psl; /* trapped PSL */
-};
-
-#if 0
-
-/*
- * This is not the mchk types on KA670.
- */
-static char *ka670_mctype[] = {
- "no error (0)", /* Code 0: No error */
- "FPA: protocol error", /* Code 1-5: FPA errors */
- "FPA: illegal opcode",
- "FPA: operand parity error",
- "FPA: unknown status",
- "FPA: result parity error",
- "unused (6)", /* Code 6-7: Unused */
- "unused (7)",
- "MMU error (TLB miss)", /* Code 8-9: MMU errors */
- "MMU error (TLB hit)",
- "HW interrupt at unused IPL", /* Code 10: Interrupt error */
- "MOVCx impossible state", /* Code 11-13: Microcode errors */
- "undefined trap code (i-box)",
- "undefined control store address",
- "unused (14)", /* Code 14-15: Unused */
- "unused (15)",
- "PC tag or data parity error", /* Code 16: Cache error */
- "data bus parity error", /* Code 17: Read error */
- "data bus error (NXM)", /* Code 18: Write error */
- "undefined data bus state", /* Code 19: Bus error */
-};
-#define MC670_MAX 19
-#endif
-
-static int ka670_error_count = 0;
-
-int
-ka670_mchk(addr)
- caddr_t addr;
-{
- register struct ka670_mcframe *mcf = (void *)addr;
-
- mtpr(0x00, PR_MCESR); /* Acknowledge the machine check */
- printf("machine check %d (0x%x)\n", mcf->mc670_code, mcf->mc670_code);
- printf("PC %x PSL %x\n", mcf->mc670_pc, mcf->mc670_psl);
- if (++ka670_error_count > 10) {
- printf("error_count exceeded: %d\n", ka670_error_count);
- return (-1);
- }
-
- /*
- * If either the Restart flag is set or the First-Part-Done flag
- * is set, and the TRAP2 (double error) bit is not set, then the
- * error is recoverable.
- */
- if (mfpr(PR_PCSTS) & KA670_PCS_TRAP2) {
- printf("TRAP2 (double error) in ka670_mchk.\n");
- panic("unrecoverable state in ka670_mchk.");
- return (-1);
- }
- if ((mcf->mc670_code & KA670_MC_RESTART) ||
- (mcf->mc670_psl & KA670_PSL_FPDONE)) {
- printf("ka670_mchk: recovering from machine-check.\n");
- ka670_cache_init(); /* reset caches */
- return (0); /* go on; */
- }
-
- /*
- * Unknown error state, panic/halt the machine!
- */
- printf("ka670_mchk: unknown error state!\n");
- return (-1);
-}
-
-void
-ka670_memerr()
-{
- /*
- * Don\'t know what to do here. So just print some messages
- * and try to go on...
- */
- printf("memory error!\n");
- printf("primary cache status: %lb\n", mfpr(PR_PCSTS), KA670_PCSTS_BITS);
- printf("secondary cache status: %lb\n", mfpr(PR_BCSTS),
- KA670_BCSTS_BITS);
-}
-
-int
-ka670_cache_init()
-{
- int val;
-
- mtpr(KA670_PCS_REFRESH, PR_PCSTS); /* disable primary cache */
- val = mfpr(PR_PCSTS);
- mtpr(val, PR_PCSTS); /* clear error flags */
- mtpr(8, PR_BCCTL); /* disable backup cache */
- mtpr(0, PR_BCFBTS); /* flush backup cache tag store */
- mtpr(0, PR_BCFPTS); /* flush primary cache tag store */
- mtpr(0x0e, PR_BCCTL); /* enable backup cache */
- mtpr(KA670_PCS_FLUSH | KA670_PCS_REFRESH, PR_PCSTS); /* flush primary cache */
- mtpr(KA670_PCS_ENABLE | KA670_PCS_REFRESH, PR_PCSTS); /* flush primary cache */
-
-#ifdef DEBUG
- printf("primary cache status: %b\n", mfpr(PR_PCSTS), KA670_PCSTS_BITS);
- printf("secondary cache status: %b\n", mfpr(PR_BCSTS), KA670_BCSTS_BITS);
-#endif
-
- return (0);
-}
-void
-ka670_conf()
-{
- printf("cpu0: KA670, ucode rev %d\n", vax_cpudata % 0377);
-
- /*
- * ka670_conf() gets called with MMU enabled, now it's safe to
- * init/reset the caches.
- */
- ka670_cache_init();
-
- cpmbx = (struct cpmbx *)vax_map_physmem(0x20140400, 1);
-}
diff --git a/sys/arch/vax/vax/ka680.c b/sys/arch/vax/vax/ka680.c
deleted file mode 100644
index 1ba28b59e44..00000000000
--- a/sys/arch/vax/vax/ka680.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/* $OpenBSD: ka680.c,v 1.16 2013/07/05 21:11:57 miod Exp $ */
-/* $NetBSD: ka680.c,v 1.3 2001/01/28 21:01:53 ragge Exp $ */
-/*
- * Copyright (c) 2002 Hugh Graham.
- * Copyright (c) 2000 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/* Done by Michael Kukat (michael@unixiron.org) */
-/* minor modifications for KA690 cache support by isildur@vaxpower.org */
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/mtpr.h>
-#include <machine/sid.h>
-#include <machine/uvax.h>
-#include <machine/ka680.h>
-#include <machine/clock.h>
-#include <machine/scb.h>
-
-static void ka680_conf(void);
-static void ka680_cache_enable(void);
-static void ka680_softmem(void *);
-static void ka680_hardmem(void *);
-static void ka680_init(void);
-static void ka680_memerr(void);
-static int ka680_mchk(caddr_t);
-
-/*
- * KA680-specific IPRs. KA680 has the funny habit to control all caches
- * via IPRs.
- */
-#define PR_CCTL 0xa0
-#define CCTL_ENABLE 0x00000001
-#define CCTL_SW_ETM 0x40000000
-#define CCTL_HW_ETM 0x80000000
-
-#define PR_BCETSTS 0xa3
-#define PR_BCEDSTS 0xa6
-#define PR_NESTS 0xae
-
-#define PR_VMAR 0xd0
-#define PR_VTAG 0xd1
-#define PR_ICSR 0xd3
-#define ICSR_ENABLE 0x01
-
-#define PR_PCCTL 0xf8
-#define PCCTL_P_EN 0x10
-#define PCCTL_I_EN 0x02
-#define PCCTL_D_EN 0x01
-
-
-/*
- * Declaration of KA680-specific calls.
- */
-struct cpu_dep ka680_calls = {
- ka680_init,
- ka680_mchk,
- ka680_memerr,
- ka680_conf,
- generic_clkread,
- generic_clkwrite,
- 24, /* ~VUPS */
- 2, /* SCB pages */
- generic_halt,
- generic_reboot,
- NULL,
- icr_hardclock
-};
-
-void
-ka680_conf()
-{
- char *cpuname;
-
- /* Don't ask why, but we seem to need this... */
-
- volatile int *hej = (void *)mfpr(PR_ISP);
- *hej = *hej;
- hej[-1] = hej[-1];
-
- cpmbx = (struct cpmbx *)vax_map_physmem(0x20140400, 1);
-
- switch(vax_boardtype) {
- case VAX_BTYP_1301:
- switch (vax_cpustype) {
- case VAX_STYP_675:
- cpuname = "KA675";
- break;
- case VAX_STYP_680:
- cpuname = "KA680";
- break;
- case VAX_STYP_690:
- cpuname = "KA690";
- break;
- default:
- cpuname = "unknown NVAX 1301";
- }
- break;
- case VAX_BTYP_1305:
- switch (vax_cpustype) {
- case VAX_STYP_681:
- cpuname = "KA681";
- break;
- case VAX_STYP_691:
- cpuname = "KA691";
- break;
- case VAX_STYP_694:
- if (vax_cpudata & 0x1000)
- cpuname = "KA694";
- else
- cpuname = "KA692";
- break;
- default:
- cpuname = "unknown NVAX 1305";
- }
- }
- printf("cpu0: %s, ucode rev %d\n", cpuname, vax_cpudata & 0xff);
-}
-
-void
-ka680_cache_enable()
-{
- int start, pslut, fslut, cslut, havevic;
-
- /*
- * Turn caches off.
- */
- mtpr(0, PR_ICSR);
- mtpr(0, PR_PCCTL);
- mtpr(mfpr(PR_CCTL) | CCTL_SW_ETM, PR_CCTL);
-
- /*
- * Invalidate caches.
- */
- mtpr(mfpr(PR_CCTL) | 6, PR_CCTL); /* Set cache size and speed */
- mtpr(mfpr(PR_BCETSTS), PR_BCETSTS); /* Clear error bits */
- mtpr(mfpr(PR_BCEDSTS), PR_BCEDSTS); /* Clear error bits */
- mtpr(mfpr(PR_NESTS), PR_NESTS); /* Clear error bits */
-
- switch (vax_cpustype) {
- case VAX_STYP_680:
- case VAX_STYP_681: /* XXX untested */
- fslut = 0x01420000;
- cslut = 0x01020000;
- havevic = 1;
- break;
- case VAX_STYP_690:
- fslut = 0x01440000;
- cslut = 0x01040000;
- havevic = 1;
- break;
- case VAX_STYP_691: /* XXX untested */
- fslut = 0x01420000;
- cslut = 0x01020000;
- havevic = 1;
- break;
- case VAX_STYP_694: /* XXX untested */
- fslut = 0x01440000;
- cslut = 0x01040000;
- havevic = 1;
- break;
- case VAX_STYP_675:
- default: /* unknown cpu; cross fingers */
- fslut = 0x01420000;
- cslut = 0x01020000;
- havevic = 0;
- break;
- }
-
- start = 0x01400000;
-
- /* Flush cache lines */
- for (; start < fslut; start += 0x20)
- mtpr(0, start);
-
- mtpr((mfpr(PR_CCTL) & ~(CCTL_SW_ETM|CCTL_ENABLE)) | CCTL_HW_ETM,
- PR_CCTL);
-
- start = 0x01000000;
-
- /* clear tag and valid */
- for (; start < cslut; start += 0x20)
- mtpr(0, start);
-
- mtpr(mfpr(PR_CCTL) | 6 | CCTL_ENABLE, PR_CCTL); /* enab. bcache */
-
- start = 0x01800000;
- pslut = 0x01802000;
-
- /* Clear primary cache */
- for (; start < pslut; start += 0x20)
- mtpr(0, start);
-
- /* Flush the pipes (via REI) */
- asm("movpsl -(%sp); movab 1f,-(%sp); rei; 1:;");
-
- /* Enable primary cache */
- mtpr(PCCTL_P_EN|PCCTL_I_EN|PCCTL_D_EN, PR_PCCTL);
-
- /* Enable the VIC */
- if (havevic) {
- int slut;
-
- start = 0;
- slut = 0x800;
- for (; start < slut; start += 0x20) {
- mtpr(start, PR_VMAR);
- mtpr(0, PR_VTAG);
- }
- mtpr(ICSR_ENABLE, PR_ICSR);
- }
-}
-
-/*
- * Why may we get memory errors during startup???
- */
-
-void
-ka680_hardmem(void *arg)
-{
- if (cold == 0)
- printf("Hard memory error\n");
- splhigh();
-}
-
-void
-ka680_softmem(void *arg)
-{
- if (cold == 0)
- printf("Soft memory error\n");
- splhigh();
-}
-
-void
-ka680_init()
-{
- /*
- * Get the soft and hard memory error vectors now.
- */
- scb_vecalloc(0x54, ka680_softmem, NULL, 0, NULL);
- scb_vecalloc(0x60, ka680_hardmem, NULL, 0, NULL);
-
- /* Turn on caches (to speed up execution a bit) */
- ka680_cache_enable();
-}
-
-void
-ka680_memerr()
-{
- printf("Memory err!\n");
-}
-
-int
-ka680_mchk(caddr_t addr)
-{
- panic("Machine check");
- return 0;
-}
diff --git a/sys/arch/vax/vax/led.c b/sys/arch/vax/vax/led.c
deleted file mode 100644
index 078213df89c..00000000000
--- a/sys/arch/vax/vax/led.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/* $OpenBSD: led.c,v 1.6 2008/08/20 18:50:17 miod Exp $ */
-/* $NetBSD: leds.c,v 1.4 2005/12/11 12:19:37 christos Exp $ */
-
-/*
- * Copyright (c) 1998 Jason L. Wright (jason@thought.net)
- * 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) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Gordon W. Ross and der Mouse.
- *
- * 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 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.
- */
-
-/*
- * Functions to flash the LEDs with some pattern.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/conf.h>
-#include <sys/timeout.h>
-
-#include <machine/cpu.h>
-#include <machine/nexus.h>
-#include <machine/sid.h>
-
-#if VAX60
-#include <arch/vax/mbus/mbusreg.h>
-#include <arch/vax/mbus/mbusvar.h>
-#endif
-
-struct led_softc {
- struct device sc_dev;
- struct timeout sc_tmo;
- volatile u_short *sc_reg;
- const u_int8_t *sc_pat, *sc_patpos;
-};
-
-/*
- * Patterns for 8 and 4 led displays.
- */
-static const u_int8_t led_pattern8[] = {
- 0xfe, 0xfd, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, 0x7f,
- 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0x00
-};
-static const u_int8_t led_pattern4[] = {
- 0x0e, 0x0d, 0x0b, 0x07, 0x0b, 0x0d, 0x00
-};
-
-int ledmatch(struct device *, void *, void *);
-void ledattach(struct device *, struct device *, void *);
-void led_blink(void *);
-
-struct cfattach led_ca = {
- sizeof(struct led_softc), ledmatch, ledattach
-};
-
-struct cfdriver led_cd = {
- NULL, "led", DV_DULL
-};
-
-int
-ledmatch(struct device *parent, void *cf, void *aux)
-{
- struct mainbus_attach_args *maa = aux;
-
- if (maa->maa_bustype != VAX_LEDS)
- return (0);
-
- switch (vax_boardtype) {
-#if VAX46 || VAX48 || VAX49 || VAX53 || VAX60 || VXT
-#if VAX46
- case VAX_BTYP_46:
-#endif
-#if VAX48
- case VAX_BTYP_48:
-#endif
-#if VAX49
- case VAX_BTYP_49:
-#endif
-#if VAX53
- case VAX_BTYP_1303:
-#endif
-#if VAX60
- case VAX_BTYP_60:
-#endif
-#if VXT
- case VAX_BTYP_VXT:
-#endif
- return (1);
-#endif
- default:
- return (0);
- }
-}
-
-void
-ledattach(struct device *parent, struct device *self, void *aux)
-{
- struct led_softc *sc = (void *)self;
-#if VAX49 || VAX53 || VXT
- vaddr_t pgva;
-#endif
-
- printf("\n");
-
- switch (vax_boardtype) {
-#if VAX46
- case VAX_BTYP_46:
- {
- extern struct vs_cpu *ka46_cpu;
- sc->sc_reg = (volatile u_short *)(&ka46_cpu->vc_diagdsp);
- sc->sc_pat = led_pattern8;
- }
- break;
-#endif
-#if VAX48
- case VAX_BTYP_48:
- {
- extern struct vs_cpu *ka48_cpu;
- sc->sc_reg = (volatile u_short *)(&ka48_cpu->vc_diagdsp);
- sc->sc_pat = led_pattern8;
- }
- break;
-#endif
-#if VAX49
- case VAX_BTYP_49:
- pgva = vax_map_physmem(0x25800000, 1);
- sc->sc_reg = (volatile u_short *)(pgva + 4);
- sc->sc_pat = led_pattern8;
- break;
-#endif
-#if VAX53
- case VAX_BTYP_1303:
- pgva = vax_map_physmem(0x20140000, 1);
- sc->sc_reg = (volatile u_short *)(pgva + 0x30);
- sc->sc_pat = led_pattern4;
- break;
-#endif
-#if VAX60
- case VAX_BTYP_60:
- pgva = vax_map_physmem(MBUS_SLOT_BASE(mbus_ioslot) + FBIC_BASE,
- 1);
- sc->sc_reg = (volatile u_short *)(pgva + FBIC_CSR);
- sc->sc_pat = NULL;
- break;
-#endif
-#if VXT
- case VAX_BTYP_VXT:
- pgva = vax_map_physmem(0x200c1000, 1);
- sc->sc_reg = (volatile u_short *)pgva;
- sc->sc_pat = led_pattern8;
- break;
-#endif
- }
-
- sc->sc_patpos = sc->sc_pat;
- timeout_set(&sc->sc_tmo, led_blink, sc);
- led_blink(sc);
-}
-
-void
-led_blink(void *v)
-{
- struct led_softc *sc = v;
- extern int vax_led_blink;
-
- if (sc == NULL) {
- /* find our softc if we come from cpu_sysctl */
- if (led_cd.cd_ndevs != 0)
- sc = (struct led_softc *)led_cd.cd_devs[0];
- if (sc == NULL)
- return;
- }
-
- if (sc->sc_pat != NULL) {
- if (vax_led_blink == 0) {
- *sc->sc_reg = 0xff;
- return;
- }
-
- *sc->sc_reg = *sc->sc_patpos++;
- if (*sc->sc_patpos == 0)
- sc->sc_patpos = sc->sc_pat;
- } else {
-#if VAX60
- uint32_t fbicsr, dot, digit;
-
- fbicsr= *(volatile uint32_t *)sc->sc_reg;
- dot = ((fbicsr & FBICSR_LEDS_MASK) >> FBICSR_LEDS_SHIFT) & 0x10;
- fbicsr &= ~FBICSR_LEDS_MASK;
-
- if (vax_led_blink == 0) {
- fbicsr |= 0x1f << FBICSR_LEDS_SHIFT;
- *(volatile uint32_t *)sc->sc_reg = fbicsr;
- return;
- }
-
- /* this is supposed to flip the decimal dot... doesn't work */
- fbicsr |= (dot ^ 0x10) << FBICSR_LEDS_SHIFT;
- /* display the load average in the hex digit */
- digit = averunnable.ldavg[0] >> FSHIFT;
- if (digit > 0x0f)
- digit = 0x0f;
- fbicsr |= (0x0f ^ digit) << FBICSR_LEDS_SHIFT;
-
- *(volatile uint32_t *)sc->sc_reg = fbicsr;
-#endif
- }
-
- timeout_add(&sc->sc_tmo,
- (((averunnable.ldavg[0] + FSCALE) * hz) >> (FSHIFT + 3)));
-}
diff --git a/sys/arch/vax/vax/locore.S b/sys/arch/vax/vax/locore.S
deleted file mode 100644
index 1a86017041d..00000000000
--- a/sys/arch/vax/vax/locore.S
+++ /dev/null
@@ -1,742 +0,0 @@
-/* $OpenBSD: locore.S,v 1.10 2016/01/23 17:30:24 ajacoutot Exp $ */
-/* $NetBSD: intvec.s,v 1.39 1999/06/28 08:20:48 itojun Exp $ */
-
-/*
- * Copyright (c) 1994, 1997 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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 "assym.h"
-
-#include <machine/asm.h>
-
-#define JSBENTRY(x) \
- .text; \
- _ALIGN_TEXT; \
- .globl x; \
- .type x,@function; \
-x:
-
-#define SCBENTRY(x) JSBENTRY(__CONCAT(X,x))
-
-#define TRAPCALL(namn, typ) \
-SCBENTRY(namn) ; \
- pushl $0 ; \
- pushl $typ ; \
- jbr trap
-
-#define TRAPARGC(namn, typ) \
-SCBENTRY(namn) ; \
- pushl $typ ; \
- jbr trap
-
-#define FASTINTR(namn, rutin) \
-SCBENTRY(namn) ; \
- pushr $0x3f ; \
- calls $0,_C_LABEL(rutin); \
- popr $0x3f ; \
- rei
-
-#define PUSHR pushr $0x3f
-#define POPR popr $0x3f
-
-#define KSTACK 0
-#define ISTACK 1
-#define NOVEC .long 0
-#define INTVEC(label,stack) \
- .long __CONCAT(X,label) + stack;
-
- .text
-
- .globl _C_LABEL(kernbase), _C_LABEL(rpb), _C_LABEL(kernel_text)
- .set _C_LABEL(kernel_text),KERNBASE
-_C_LABEL(kernbase):
-_C_LABEL(rpb):
-/*
- * First page in memory we have rpb; so that we know where
- * (must be on a 64k page boundary, easiest here). We use it
- * to store SCB vectors generated when compiling the kernel,
- * and move the SCB later to somewhere else.
- */
-
- NOVEC; # Unused, 0
- INTVEC(mcheck, ISTACK) # Machine Check., 4
- INTVEC(invkstk, ISTACK) # Kernel Stack Invalid., 8
- NOVEC; # Power Failed., C
- INTVEC(privinflt, KSTACK) # Privileged/Reserved Instruction.
- INTVEC(xfcflt, KSTACK) # Customer Reserved Instruction, 14
- INTVEC(resopflt, KSTACK) # Reserved Operand/Boot Vector(?), 18
- INTVEC(resadflt, KSTACK) # Reserved Address Mode., 1C
- INTVEC(access_v, KSTACK) # Access Control Violation, 20
- INTVEC(transl_v, KSTACK) # Translation Invalid, 24
- INTVEC(tracep, KSTACK) # Trace Pending, 28
- INTVEC(breakp, KSTACK) # Breakpoint Instruction, 2C
- NOVEC; # Compatibility Exception, 30
- INTVEC(arithflt, KSTACK) # Arithmetic Fault, 34
- NOVEC; # Unused, 38
- NOVEC; # Unused, 3C
- INTVEC(syscall, KSTACK) # main syscall trap, chmk, 40
- INTVEC(resopflt, KSTACK) # chme, 44
- INTVEC(resopflt, KSTACK) # chms, 48
- INTVEC(resopflt, KSTACK) # chmu, 4C
- NOVEC; # System Backplane Exception/BIerror, 50
- INTVEC(cmrerr, ISTACK) # Corrected Memory Read, 54
- NOVEC; # System Backplane Alert/RXCD, 58
- INTVEC(sbiflt, ISTACK) # System Backplane Fault, 5C
- NOVEC; # Memory Write Timeout, 60
- NOVEC; # Unused, 64
- NOVEC; # Unused, 68
- NOVEC; # Unused, 6C
- NOVEC; # Unused, 70
- NOVEC; # Unused, 74
- NOVEC; # Unused, 78
- NOVEC; # Unused, 7C
- NOVEC; # Unused, 80
- NOVEC; # Unused, 84
- INTVEC(astintr, KSTACK) # Asynchronous System Trap, AST
- NOVEC; # Unused, 8C
- NOVEC; # Unused, 90
- NOVEC; # Unused, 94
- NOVEC; # Unused, 98
- NOVEC; # Unused, 9C
- INTVEC(softintr,ISTACK) # Software interrupts (IPL_SOFT)
- INTVEC(softintr,ISTACK) # Software interrupts (IPL_SOFTCLOCK)
- INTVEC(softintr,ISTACK) # Software interrupts (IPL_SOFTNET)
- INTVEC(softintr,ISTACK) # Software interrupts (IPL_SOFTTTY)
- NOVEC; # Unused, B0
- NOVEC; # Unused, B4
- NOVEC; # Unused, B8
- INTVEC(ddbtrap, ISTACK) # Kernel debugger trap, BC
- INTVEC(hardclock,ISTACK) # Interval Timer
- NOVEC; # Unused, C4
- INTVEC(emulate, KSTACK) # Subset instruction emulation, C8
- NOVEC; # Unused, CC
- NOVEC; # Unused, D0
- NOVEC; # Unused, D4
- NOVEC; # Unused, D8
- NOVEC; # Unused, DC
- NOVEC; # Unused, E0
- NOVEC; # Unused, E4
- NOVEC; # Unused, E8
- NOVEC; # Unused, EC
- NOVEC;
- NOVEC;
- NOVEC;
- NOVEC;
-
- /* space for adapter vectors */
- .space 0x100
-
- .align 2
-#
-# mcheck is the badaddress trap, also called when referencing
-# a invalid address (busserror)
-# memtest holds the address to continue execution at when returning
-# from a intentional test.
-#
-SCBENTRY(mcheck)
- tstl _ASM_LABEL(memtest) # Are we expecting a machine check?
- bneq L4 # Yes.
-
- pushr $0x7f
- pushab 28(%sp)
- movl _C_LABEL(dep_call),%r6 # CPU dependent mchk handling
- calls $1,*MCHK(%r6)
- tstl %r0 # If not machine check, try memory error
- beql 1f
- calls $0,*MEMERR(%r6)
- pushab 2f
- calls $1,_C_LABEL(panic)
-2: .asciz "mchk"
-1: popr $0x7f
- addl2 (%sp)+,%sp
-
- rei
-
-L4: addl2 (%sp)+,%sp # remove info pushed on stack
- # Clear the machine check condition by writing to the
- # MCESR register if available.
- cmpl $VAX_TYP_UV2, _C_LABEL(vax_cputype)
- beql 2f
- cmpl $VAX_TYP_SOC, _C_LABEL(vax_cputype)
- beql 2f
- mtpr $0,$PR_MCESR # clear the bus error bit
-2: movl _ASM_LABEL(memtest),(%sp) # REI to new address
- rei
-
-TRAPCALL(invkstk, T_KSPNOTVAL)
-
-SCBENTRY(privinflt) # Privileged/unimplemented instruction
-#ifdef INSN_EMULATE
- jsb unimemu # do not return if insn emulated
-#endif
- pushl $0
- pushl $T_PRIVINFLT
- jbr trap
-
-TRAPCALL(xfcflt, T_XFCFLT);
-TRAPCALL(resopflt, T_RESOPFLT)
-TRAPCALL(resadflt, T_RESADFLT)
-
-/*
- * Translation fault, used only when simulating page reference bit.
- * Therefore it is done a fast revalidation of the page if it is
- * referenced. Trouble here is the hardware bug on KA650 CPUs that
- * put in a need for an extra check when the fault is gotten during
- * PTE reference. Handled in pmap.c.
- */
-SCBENTRY(transl_v) # 20: Translation violation
- PUSHR
- pushl 28(%sp)
- pushl 28(%sp)
- calls $2,_C_LABEL(pmap_simulref)
- tstl %r0
- bneq 1f
- POPR
- addl2 $8,%sp
- rei
-1: POPR
- brb access_v
-
-SCBENTRY(access_v) # 24: Access cntrl viol fault
-access_v:
- blbs (%sp), ptelen
- pushl $T_ACCFLT
- bbc $1,4(%sp),1f
- bisl2 $T_PTEFETCH,(%sp)
-1: bbc $2,4(%sp),2f
- bisl2 $T_WRITE,(%sp)
-2: movl (%sp), 4(%sp)
- addl2 $4, %sp
- jbr trap
-
-ptelen: movl $T_PTELEN, (%sp) # PTE must expand (or send segv)
- jbr trap
-
-TRAPCALL(tracep, T_TRCTRAP)
-TRAPCALL(breakp, T_BPTFLT)
-
-TRAPARGC(arithflt, T_ARITHFLT)
-
-SCBENTRY(syscall) # Main system call
- pushl $T_SYSCALL
- pushr $0xfff
- mfpr $PR_USP, -(%sp)
- pushl %ap
- pushl %fp
- pushl %sp # pointer to syscall frame; defined in trap.h
- calls $1, _C_LABEL(syscall)
- movl (%sp)+, %fp
- movl (%sp)+, %ap
- mtpr (%sp)+, $PR_USP
- popr $0xfff
- addl2 $8, %sp
- mtpr $0x1f, $PR_IPL # Be sure we can REI
- rei
-
-SCBENTRY(cmrerr)
- PUSHR
- movl _C_LABEL(dep_call),%r0
- calls $0,*MEMERR(%r0)
- POPR
- rei
-
-SCBENTRY(sbiflt)
- pushab sbifltmsg
- calls $1,_C_LABEL(panic)
-
-TRAPCALL(astintr, T_ASTFLT)
-
-FASTINTR(softintr,softintr_dispatch)
-
-TRAPCALL(ddbtrap, T_KDBTRAP)
-
-SCBENTRY(hardclock)
- mtpr $0xc1,$PR_ICCS # Reset interrupt flag
- PUSHR
- pushl %sp
- addl2 $24,(%sp)
- movl _C_LABEL(dep_call),%r0
- calls $1,*HARDCLOCK(%r0)
- incl _C_LABEL(clock_intrcnt)+EC_COUNT # increment low longword
- adwc $0,_C_LABEL(clock_intrcnt)+EC_COUNT+4 # add any carry to hi
- # longword
- POPR
- rei
-
-/*
- * Main routine for traps; all go through this.
- * Note that we put USP on the frame here, which sometimes should
- * be KSP to be correct, but because we only alter it when we are
- * called from user space it doesn't care.
- * _sret is used in cpu_set_kpc to jump out to user space first time.
- */
-trap: pushr $0xfff
- mfpr $PR_USP, -(%sp)
- pushl %ap
- pushl %fp
- pushl %sp
- calls $1, _C_LABEL(arithflt)
- .globl _C_LABEL(sret)
-_C_LABEL(sret):
- movl (%sp)+, %fp
- movl (%sp)+, %ap
- mtpr (%sp)+, $PR_USP
- popr $0xfff
- addl2 $8, %sp
- mtpr $0x1f, $PR_IPL # Be sure we can REI
- rei
-
-sbifltmsg:
- .asciz "SBI fault"
-
-#if INSN_EMULATE
-/*
- * Table of emulated Microvax instructions supported by emulate.s.
- * Use noemulate to convert unimplemented ones to reserved instruction faults.
- */
- .globl _C_LABEL(emtable)
-_C_LABEL(emtable):
-/* f8 */ .long _C_LABEL(EMashp); .long _C_LABEL(EMcvtlp)
- .long noemulate; .long noemulate
-/* fc */ .long noemulate; .long noemulate
- .long noemulate; .long noemulate
-/* 00 */ .long noemulate; .long noemulate
- .long noemulate; .long noemulate
-/* 04 */ .long noemulate; .long noemulate
- .long noemulate; .long noemulate
-/* 08 */ .long _C_LABEL(EMcvtps); .long _C_LABEL(EMcvtsp)
- .long noemulate; .long _C_LABEL(EMcrc)
-/* 0c */ .long noemulate; .long noemulate
- .long noemulate; .long noemulate
-/* 10 */ .long noemulate; .long noemulate
- .long noemulate; .long noemulate
-/* 14 */ .long noemulate; .long noemulate
- .long noemulate; .long noemulate
-/* 18 */ .long noemulate; .long noemulate
- .long noemulate; .long noemulate
-/* 1c */ .long noemulate; .long noemulate
- .long noemulate; .long noemulate
-/* 20 */ .long _C_LABEL(EMaddp4); .long _C_LABEL(EMaddp6)
- .long _C_LABEL(EMsubp4); .long _C_LABEL(EMsubp6)
-/* 24 */ .long _C_LABEL(EMcvtpt); .long _C_LABEL(EMmulp)
- .long _C_LABEL(EMcvttp); .long _C_LABEL(EMdivp)
-/* 28 */ .long noemulate; .long _C_LABEL(EMcmpc3)
- .long _C_LABEL(EMscanc); .long _C_LABEL(EMspanc)
-/* 2c */ .long noemulate; .long _C_LABEL(EMcmpc5)
- .long _C_LABEL(EMmovtc); .long _C_LABEL(EMmovtuc)
-/* 30 */ .long noemulate; .long noemulate;
- .long noemulate; .long noemulate
-/* 34 */ .long _C_LABEL(EMmovp); .long _C_LABEL(EMcmpp3)
- .long _C_LABEL(EMcvtpl); .long _C_LABEL(EMcmpp4)
-/* 38 */ .long _C_LABEL(EMeditpc); .long _C_LABEL(EMmatchc);
- .long _C_LABEL(EMlocc); .long _C_LABEL(EMskpc)
-#endif
-/*
- * The following is called with the stack set up as follows:
- *
- * (sp): Opcode
- * 4(sp): Instruction PC
- * 8(sp): Operand 1
- * 12(sp): Operand 2
- * 16(sp): Operand 3
- * 20(sp): Operand 4
- * 24(sp): Operand 5
- * 28(sp): Operand 6
- * 32(sp): Operand 7 (unused)
- * 36(sp): Operand 8 (unused)
- * 40(sp): Return PC
- * 44(sp): Return PSL
- * 48(sp): TOS before instruction
- *
- * Each individual routine is called with the stack set up as follows:
- *
- * (sp): Return address of trap handler
- * 4(sp): Opcode (will get return PSL)
- * 8(sp): Instruction PC
- * 12(sp): Operand 1
- * 16(sp): Operand 2
- * 20(sp): Operand 3
- * 24(sp): Operand 4
- * 28(sp): Operand 5
- * 32(sp): Operand 6
- * 36(sp): saved register 11
- * 40(sp): saved register 10
- * 44(sp): Return PC
- * 48(sp): Return PSL
- * 52(sp): TOS before instruction
- * See the VAX Architecture Reference Manual, Section B-5 for more
- * information.
- */
-
-SCBENTRY(emulate)
-#if INSN_EMULATE
- movl %r11,32(%sp) # save register r11 in unused operand
- movl %r10,36(%sp) # save register r10 in unused operand
- cvtbl (%sp),%r10 # get opcode
- addl2 $8,%r10 # shift negative opcodes
- subl3 %r10,$0x43,%r11 # forget it if opcode is out of range
- bcs noemulate
- movl _C_LABEL(emtable)[%r10],%r10 # call appropriate emulation routine
- jsb (%r10) # routines put return values into regs 0-5
- movl 32(%sp),%r11 # restore register r11
- movl 36(%sp),%r10 # restore register r10
- insv (%sp),$0,$4,44(%sp) # and condition codes in Opcode spot
- addl2 $40,%sp # adjust stack for return
- rei
-noemulate:
- addl2 $48,%sp # adjust stack for
-#endif
- .word 0xffff # "reserved instruction fault"
-
- .text
-
-/*
- * First entry routine from boot. This should be in a file called locore.
- */
-ASENTRY_NOPROFILE(__start, 0)
- bisl3 $0x80000000,%r9,_C_LABEL(esym) # End of loaded code
- pushl $0x1f0000 # Push a nice PSL
- pushl $to # Address to jump to
- rei # change to kernel stack
-to: movw $0xfff,_C_LABEL(panic) # Save all regs in panic
- moval _C_LABEL(end), %r0 # Get kernel end address
- addl2 $0x3ff, %r0 # Round it up
- cmpl _C_LABEL(esym), %r0 # Compare with symbol table end
- bleq eskip # Symbol table not present
- addl3 _C_LABEL(esym), $0x3ff, %r0 # Use symbol end and round
-eskip:
- bicl3 $0x3ff,%r0,%r1
- movl %r1,_C_LABEL(proc0paddr) # save proc0 uarea pointer
- bicl3 $0x80000000,%r1,%r0 # get phys proc0 uarea addr
-#if 0
- movl %r0,PCB_PADDR(%r1) # save PCB physical address
-#endif
- mtpr %r0,$PR_PCBB # Save in IPR PCBB
- addl3 $USPACE,%r1,%r0 # Get kernel stack top
- mtpr %r0,$PR_KSP # put in IPR KSP
- movl %r0,_C_LABEL(Sysmap) # SPT start addr after KSP
-
-# Set some registers in known state
- movl %r1,%r0
- clrl P0LR(%r0)
- clrl P1LR(%r0)
- mtpr $0,$PR_P0LR
- mtpr $0,$PR_P1LR
- movl $0x80000000,%r1
- movl %r1,P0BR(%r0)
- movl %r1,P1BR(%r0)
- mtpr %r1,$PR_P0BR
- mtpr %r1,$PR_P1BR
- clrl IFTRAP(%r0)
- mtpr $0,$PR_SCBB
-
-# Copy the RPB to its new position
-#if 1 /* compat with old bootblocks */
- tstl (%ap) # Any arguments?
- bneq 1f # Yes, called from new boot
- movl %r11,_C_LABEL(boothowto) # Howto boot (single etc...)
-# movl %r10,_C_LABEL(bootdev) # uninteresting, will complain
- movl %r8,_C_LABEL(avail_end) # Usable memory (from VMB)
- clrl -(%sp) # Have no RPB
- brb 2f
-#endif
-
-1: pushl 4(%ap) # Address of old rpb
-2: calls $1,_C_LABEL(_start) # Jump away.
- /* NOTREACHED */
-
-
-/*
- * Signal handler code.
- */
-
- .globl _C_LABEL(sigcode),_C_LABEL(esigcode)
-_C_LABEL(sigcode):
- movl 0x0c(%sp),%r0 /* get signal handler */
- calls $3,(%r0) /* and call it */
- chmk $SYS_sigreturn /* sigreturn frame set up by sendsig */
- chmk $SYS_exit
- halt
- _ALIGN_TEXT
-_C_LABEL(esigcode):
-
- .globl _C_LABEL(idsptch), _C_LABEL(eidsptch)
-_C_LABEL(idsptch):
- pushr $0x3f
- .word 0x9f16 # jsb to absolute address
- .long _cmn_idsptch # the absolute address
- .long 0 # the callback interrupt routine
- .long 0 # its argument
- .long 0 # ptr to correspond evcount struct
-_C_LABEL(eidsptch):
-
-_cmn_idsptch:
- movl (%sp)+,%r0 # get pointer to idspvec
- movl 8(%r0),%r1 # get evcount pointer
- beql 1f # no ptr, skip increment
- incl EC_COUNT(%r1) # increment low longword
- adwc $0,EC_COUNT+4(%r1) # add any carry to hi longword
-1: pushl 4(%r0) # push argument
- calls $1,*(%r0) # call interrupt routine
- popr $0x3f # pop registers
- rei # return from interrut
-
-ENTRY_NOPROFILE(badaddr,R2|R3) # Called with addr,b/w/l
- mfpr $0x12,%r0 # splhigh()
- mtpr $0x1f,$0x12
- movl 4(%ap),%r2 # First argument, the address
- movl 8(%ap),%r1 # Sec arg, b,w,l
- pushl %r0 # Save old IPL
- clrl %r3
- movab 4f,_ASM_LABEL(memtest) # Set the return address
-
- caseb %r1,$1,$4 # What is the size
-1: .word 1f-1b
- .word 2f-1b
- .word 3f-1b # This is unused
- .word 3f-1b
-
-1: movb (%r2),%r1 # Test a byte
- brb 5f
-
-2: movw (%r2),%r1 # Test a word
- brb 5f
-
-3: movl (%r2),%r1 # Test a long
- brb 5f
-
-4: incl %r3 # Got machine chk => addr bad
-5: clrl _ASM_LABEL(memtest) # do not ignore further mchk
- mtpr (%sp)+,$0x12
- movl %r3,%r0
- ret
-
-#ifdef DDB
-/*
- * DDB is the only routine that uses setjmp/longjmp.
- */
-ENTRY_NOPROFILE(setjmp, 0)
- movl 4(%ap), %r0
- movl 8(%fp), (%r0)
- movl 12(%fp), 4(%r0)
- movl 16(%fp), 8(%r0)
- addl3 %fp,$28,12(%r0)
- clrl %r0
- ret
-
-ENTRY_NOPROFILE(longjmp, 0)
- movl 4(%ap), %r1
- movl $1, %r0
- movl (%r1), %ap
- movl 4(%r1), %fp
- movl 12(%r1), %sp
- jmp *8(%r1)
-#endif
-
-#
-# void
-# cpu_switchto(struct proc *oldproc = r0, struct proc *newproc = r1);
-#
-
-#define CURPROC _C_LABEL(cpu_info_store) + CI_CURPROC
-
-JSBENTRY(__cpu_switchto)
- svpctx
-
- movb $SONPROC,P_STAT(%r1) # p->p_stat = SONPROC
- movl %r1, CURPROC # set new process running
-
- movl P_ADDR(%r1),%r0 # Get pointer to new pcb.
- addl3 %r0,$IFTRAP,pcbtrap # Save for copy* functions.
-
-#
-# Do the actual process switch. pc + psl are already on stack, from
-# the beginning of this routine.
-#
- mtpr PCB_PADDR(%r0),$PR_PCBB
-
- pushl CURPROC
- calls $1, _C_LABEL(pmap_activate)
-
- ldpctx
- rei
-
-#
-# copy/fetch/store routines.
-#
- .align 2
-ENTRY_NOPROFILE(copyin, R2|R3|R4|R5|R6)
- movl 4(%ap), %r0
- blss 3f # kernel space
- movl 8(%ap), %r1
- brb 2f
-
-ENTRY_NOPROFILE(copyout, R2|R3|R4|R5|R6)
- movl 8(%ap), %r1
- blss 3f # kernel space
- movl 4(%ap), %r0
-2: movab 1f,*pcbtrap
- movzwl 12(%ap), %r2
- movzwl 14(%ap), %r6
-
- movc3 %r2, (%r0), (%r1)
-
- tstl %r6
- bleq 1f
-0: movb (%r1)+, (%r3)+
- movc3 $0xffff, (%r1), (%r3)
- sobgtr %r6,0b
-
-1: clrl *pcbtrap
- ret
-
-3: movl $EFAULT, %r0
- ret
-
-/* kcopy: just like bcopy, except return EFAULT upon failure */
-ENTRY_NOPROFILE(kcopy,R2|R3|R4|R5|R6)
- movl *pcbtrap,-(%sp)
- movab 1f,*pcbtrap
- movl 4(%ap), %r0
- movl 8(%ap), %r1
- movzwl 12(%ap), %r2
- movzwl 14(%ap), %r6
-
- movc3 %r2, (%r0), (%r1)
-
- tstl %r6
- bleq 1f
-0: movb (%r1)+, (%r3)+
- movc3 $0xffff, (%r1), (%r3)
- sobgtr %r6, 0b
-
- /*
- * If there is a failure, trap.c will set r0 to EFAULT, and jump
- * to the following 1. If not, we return 0 (movc3 sets r0 to 0).
- */
-1:
- movl (%sp)+,*pcbtrap
- ret
-
-ENTRY_NOPROFILE(copyinstr,0)
- tstl 4(%ap) # is from a kernel address?
- bgeq 8f # no, continue
-
-6: movl $EFAULT,%r0
- ret
-
-ENTRY_NOPROFILE(copyoutstr,0)
- tstl 8(%ap) # is to a kernel address?
- bgeq 8f # no, continue
- brb 6b
-
-ENTRY_NOPROFILE(copystr,0)
-8: movl 4(%ap),%r4 # from
- movl 8(%ap),%r5 # to
- movl 16(%ap),%r3 # copied
- movl 12(%ap),%r2 # len
-
- bneq 1f # nothing to copy?
- movl $ENAMETOOLONG,%r0
- tstl %r3
- beql 0f
- movl $0,(%r3)
-0: ret
-
-1: movab 2f,*pcbtrap
-
-/*
- * This routine consists of two parts: One is for MV2 that doesn't have
- * locc in hardware, the other is a fast version with locc. But because
- * locc only handles <64k strings, we default to the slow version if the
- * string is longer.
- */
- cmpl _C_LABEL(vax_cputype),$VAX_TYP_UV2
- bneq 4f # Check if locc emulated
-
-9: movl %r2,%r0
-7: movb (%r4)+,(%r5)+
- beql 6f # end of string
- sobgtr %r0,7b # no null byte in the len first bytes?
- brb 1f
-
-6: tstl %r3
- beql 5f
- incl %r2
- subl3 %r0,%r2,(%r3)
-5: clrl %r0
- clrl *pcbtrap
- ret
-
-4: cmpl %r2,$65535 # maxlen < 64k?
- blss 8f # then use fast code.
-
- locc $0,$65535,(%r4) # is strlen < 64k?
- beql 9b # No, use slow code
- subl3 %r0,$65535,%r1 # Get string len
- brb 0f # do the copy
-
-8: locc $0,%r2,(%r4) # check for null byte
- beql 1f
-
- subl3 %r0,%r2,%r1 # Calculate len to copy
-0: incl %r1 # Copy null byte also
- tstl %r3
- beql 3f
- movl %r1,(%r3) # save len copied
-3: movc3 %r1,(%r4),(%r5)
- brb 4f
-
-1: movl $ENAMETOOLONG,%r0
-2: movab 4f,*pcbtrap # if we fault again, don't resume there
- subl3 8(%ap),%r5,%r1 # did we write to the string?
- beql 3f
- decl %r5
-3: movb $0,(%r5) # null terminate the output string
- tstl %r3
- beql 4f
- incl %r1 # null byte accounts for outlen...
- movl %r1,(%r3) # save len copied
-4: clrl *pcbtrap
- ret
-
-#
-# data department
-#
- .data
-
-_ASM_LABEL(memtest): # badaddr() in progress
- .long 0
-pcbtrap:
- .long 0x800001fc # Safe place
-
- .globl _C_LABEL(bootdev)
-_C_LABEL(bootdev):
- .long 0
diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c
deleted file mode 100644
index 2cea0657cd4..00000000000
--- a/sys/arch/vax/vax/machdep.c
+++ /dev/null
@@ -1,1343 +0,0 @@
-/* $OpenBSD: machdep.c,v 1.150 2015/10/21 07:59:18 mpi Exp $ */
-/* $NetBSD: machdep.c,v 1.108 2000/09/13 15:00:23 thorpej Exp $ */
-
-/*
- * Copyright (c) 2002, Hugh Graham.
- * Copyright (c) 2002, Miodrag Vallat.
- * Copyright (c) 1994, 1996, 1998 Ludd, University of Lule}, Sweden.
- * Copyright (c) 1993 Adam Glass
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Changed for the VAX port (and for readability) /IC
- *
- * This code is derived from software contributed to Ludd by
- * Bertram Barth.
- *
- * 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: machdep.c 1.63 91/04/24
- *
- * @(#)machdep.c 7.16 (Berkeley) 6/3/91
- */
-
-#include <sys/signal.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/extent.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/user.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/msgbuf.h>
-#include <sys/buf.h>
-#include <sys/mbuf.h>
-#include <sys/reboot.h>
-#include <sys/conf.h>
-#include <sys/timeout.h>
-#include <sys/device.h>
-#include <sys/exec.h>
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-#include <sys/ptrace.h>
-#include <sys/sysctl.h>
-#include <sys/core.h>
-#include <sys/kcore.h>
-
-#include <dev/cons.h>
-
-#include <net/if.h>
-#include <uvm/uvm.h>
-
-#include <netinet/in.h>
-#include <netinet/ip_var.h>
-#include "ppp.h" /* For NPPP */
-#if NPPP > 0
-#include <net/ppp_defs.h>
-#include <net/if_ppp.h>
-#endif
-
-#include <machine/sid.h>
-#include <machine/db_machdep.h>
-#include <machine/kcore.h>
-#include <vax/vax/gencons.h>
-#include <machine/rpb.h>
-#include <machine/cca.h>
-
-#ifdef DDB
-#include <ddb/db_sym.h>
-#include <ddb/db_extern.h>
-#endif
-#include <vax/vax/db_disasm.h>
-
-#include "led.h"
-
-extern int virtual_avail, virtual_end;
-/*
- * We do these external declarations here, maybe they should be done
- * somewhere else...
- */
-int want_resched;
-char machine[] = MACHINE; /* from <machine/param.h> */
-int physmem;
-int cold = 1; /* coldstart */
-struct cpmbx *cpmbx;
-
-/*
- * safepri is a safe priority for sleep to set for a spin-wait
- * during autoconfiguration or after a panic.
- */
-int safepri = 0;
-
-/*
- * XXX some storage space must be allocated statically because of
- * early console init
- */
-#define IOMAPSZ 100
-char extiospace[EXTENT_FIXED_STORAGE_SIZE(IOMAPSZ)];
-
-struct extent *extio;
-extern vaddr_t iospace;
-
-struct vm_map *exec_map = NULL;
-struct vm_map *phys_map = NULL;
-
-#ifdef DEBUG
-int iospace_inited = 0;
-#endif
-
-/* sysctl settable */
-#if NLED > 0
-int vax_led_blink = 1;
-#endif
-
-struct cpu_info cpu_info_store;
-
-struct uvm_constraint_range dma_constraint = { 0x0, (paddr_t)-1 };
-struct uvm_constraint_range *uvm_md_constraints[] = { NULL };
-
-void dumpconf(void);
-
-void
-cpu_startup()
-{
- vaddr_t minaddr, maxaddr;
- extern char cpu_model[];
-
- /*
- * Initialize error message buffer.
- */
- initmsgbuf((caddr_t)msgbufp, round_page(MSGBUFSIZE));
-
- /*
- * Good {morning,afternoon,evening,night}.
- * Also call CPU init on systems that need that.
- */
- printf("%s%s [%08X %08X]\n", version,
- cpu_model, vax_cpudata, vax_siedata);
- if (dep_call->cpu_conf)
- (*dep_call->cpu_conf)();
-
- printf("real mem = %lu (%luMB)\n", ptoa(physmem),
- ptoa(physmem)/1024/1024);
- mtpr(AST_NO, PR_ASTLVL);
- spl0();
-
- /*
- * Allocate a submap for exec arguments. This map effectively limits
- * the number of processes exec'ing at any time.
- */
- minaddr = vm_map_min(kernel_map);
- exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
- 16 * NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
-
-#if VAX46 || VAX48 || VAX49 || VAX53 || VAX60
- /*
- * Allocate a submap for physio. This map effectively limits the
- * number of processes doing physio at any one time.
- *
- * Note that machines on which all mass storage I/O controllers
- * can perform address translation, do not need this.
- */
- if (vax_boardtype == VAX_BTYP_46 || vax_boardtype == VAX_BTYP_48 ||
- vax_boardtype == VAX_BTYP_49 || vax_boardtype == VAX_BTYP_1303 ||
- vax_boardtype == VAX_BTYP_60)
- phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
- VM_PHYS_SIZE, 0, FALSE, NULL);
-#endif
-
- printf("avail mem = %lu (%luMB)\n", ptoa(uvmexp.free),
- ptoa(uvmexp.free)/1024/1024);
-
- /*
- * Set up buffers, so they can be used to read disk labels.
- */
-
- bufinit();
-#ifdef DDB
- if (boothowto & RB_KDB)
- Debugger();
-#endif
-
- /*
- * Configure the system.
- */
- if (boothowto & RB_CONFIG) {
-#ifdef BOOT_CONFIG
- user_config();
-#else
- printf("kernel does not support -c; continuing..\n");
-#endif
- }
-}
-
-long dumpmag = 0x8fca0101;
-int dumpsize = 0;
-long dumplo = 0;
-cpu_kcore_hdr_t cpu_kcore_hdr;
-
-void
-dumpconf(void)
-{
- int nblks;
-
- if (dumpdev == NODEV ||
- (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0)
- return;
- if (nblks <= ctod(1))
- return;
-
- dumpsize = physmem;
- if (dumpsize > atop(dbtob(nblks - dumplo)))
- dumpsize = atop(dbtob(nblks - dumplo));
- else if (dumplo == 0)
- dumplo = nblks - btodb(ptoa(dumpsize));
-
- /*
- * Don't dump on the first block in case the dump
- * device includes a disk label.
- */
- if (dumplo < btodb(PAGE_SIZE))
- dumplo = btodb(PAGE_SIZE);
-
- /* Put dump at the end of partition, and make it fit. */
- if (dumpsize + 1 > dtoc(nblks - dumplo))
- dumpsize = dtoc(nblks - dumplo) - 1;
- if (dumplo < nblks - ctod(dumpsize) - 1)
- dumplo = nblks - ctod(dumpsize) - 1;
-
- /* memory is contiguous on vax */
- cpu_kcore_hdr.ram_segs[0].start = 0;
- cpu_kcore_hdr.ram_segs[0].size = ptoa(physmem);
- cpu_kcore_hdr.sysmap = (vaddr_t)Sysmap;
-}
-
-int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
- int *name;
- u_int namelen;
- void *oldp;
- size_t *oldlenp;
- void *newp;
- size_t newlen;
- struct proc *p;
-{
-#if NLED > 0
- int oldval, ret;
-#endif
- dev_t consdev;
-
- /* all sysctl names at this level are terminal */
- if (namelen != 1)
- return (ENOTDIR); /* overloaded */
-
- switch (name[0]) {
- case CPU_CONSDEV:
- if (cn_tab != NULL)
- consdev = cn_tab->cn_dev;
- else
- consdev = NODEV;
- return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev,
- sizeof consdev));
- case CPU_LED_BLINK:
-#if NLED > 0
- oldval = vax_led_blink;
- ret = sysctl_int(oldp, oldlenp, newp, newlen, &vax_led_blink);
- if (oldval != vax_led_blink) {
- extern void led_blink(void *);
- led_blink(NULL);
- }
- return (ret);
-#else
- return (EOPNOTSUPP);
-#endif
- default:
- return (EOPNOTSUPP);
- }
- /* NOTREACHED */
-}
-
-void
-setstatclockrate(hzrate)
- int hzrate;
-{
- /* nothing to do */
-}
-
-void
-consinit()
-{
- /*
- * Init I/O memory extent. Must be done before cninit()
- * is called; we may want to use iospace in the console routines.
- *
- * XXX console code uses the first page at iospace, so do not make
- * the extent start at iospace.
- */
- extio = extent_create("extio",
- (u_long)iospace + VAX_NBPG, (u_long)iospace + IOSPSZ * VAX_NBPG,
- M_DEVBUF, extiospace, sizeof(extiospace), EX_NOWAIT);
-#ifdef DEBUG
- iospace_inited = 1;
-#endif
- cninit();
-#ifdef DDB
- ddb_init();
-#ifdef DEBUG
- if (sizeof(struct user) > REDZONEADDR)
- panic("struct user inside red zone");
-#endif
-#endif
-}
-
-/*
- * Old sigcontext structure, still used by userland until setjmp is fixed.
- */
-struct osigcontext {
- int __sc_unused;
- int sc_mask; /* signal mask to restore */
- int sc_sp; /* sp to restore */
- int sc_fp; /* fp to restore */
- int sc_ap; /* ap to restore */
- int sc_pc; /* pc to restore */
- int sc_ps; /* psl to restore */
-};
-
-/*
- * Internal flags in the low order bits of sc_ap, to know whether this
- * is an osigcontext or a sigcontext.
- */
-#define SIGCONTEXT_NEW 0x01
-
-int
-sys_sigreturn(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_sigreturn_args {
- syscallarg(struct sigcontext *) sigcntxp;
- } *uap = v;
- struct trapframe *scf;
- struct sigcontext *cntx;
- struct sigcontext ksc;
- int error;
-
- scf = p->p_addr->u_pcb.framep;
- cntx = SCARG(uap, sigcntxp);
-
- error = copyin((caddr_t)cntx, (caddr_t)&ksc,
- sizeof(struct osigcontext));
- if (error == 0 && (ksc.sc_ap & SIGCONTEXT_NEW)) {
- error = copyin((caddr_t)cntx + sizeof(struct osigcontext),
- (caddr_t)&ksc.sc_r,
- sizeof(struct sigcontext) - sizeof(struct osigcontext));
- }
- if (error != 0)
- return (error);
-
- /* Compatibility mode? */
- if ((ksc.sc_ps & (PSL_IPL | PSL_IS)) ||
- ((ksc.sc_ps & (PSL_U | PSL_PREVU)) != (PSL_U | PSL_PREVU)) ||
- (ksc.sc_ps & PSL_CM)) {
- return (EINVAL);
- }
- /* Restore signal mask. */
- p->p_sigmask = ksc.sc_mask & ~sigcantmask;
-
- scf->fp = ksc.sc_fp;
- scf->ap = ksc.sc_ap & ~SIGCONTEXT_NEW;
- scf->sp = ksc.sc_sp;
- if (ksc.sc_ap & SIGCONTEXT_NEW) {
- scf->r0 = ksc.sc_r[0];
- scf->r1 = ksc.sc_r[1];
- scf->r2 = ksc.sc_r[2];
- scf->r3 = ksc.sc_r[3];
- scf->r4 = ksc.sc_r[4];
- scf->r5 = ksc.sc_r[5];
- scf->r6 = ksc.sc_r[6];
- scf->r7 = ksc.sc_r[7];
- scf->r8 = ksc.sc_r[8];
- scf->r9 = ksc.sc_r[9];
- scf->r10 = ksc.sc_r[10];
- scf->r11 = ksc.sc_r[11];
- }
- scf->pc = ksc.sc_pc;
- scf->psl = ksc.sc_ps;
- return (EJUSTRETURN);
-}
-
-struct sigframe {
- /* arguments of the signal handler */
- int sf_signum;
- siginfo_t *sf_sip;
- struct sigcontext *sf_scp;
- /* address of the signal handler */
- register_t sf_pc;
- /* sigcontext pointer for sigreturn */
- register_t sf_arg;
-
- siginfo_t sf_si;
- struct sigcontext sf_sc;
-};
-
-void
-sendsig(catcher, sig, mask, code, type, val)
- sig_t catcher;
- int sig, mask;
- u_long code;
- int type;
- union sigval val;
-{
- struct proc *p = curproc;
- struct sigacts *psp = p->p_p->ps_sigacts;
- struct trapframe *syscf;
- struct sigframe *sigf, gsigf;
- unsigned int cursp;
-
- syscf = p->p_addr->u_pcb.framep;
-
- /* Allocate space for the signal handler context. */
- if ((p->p_sigstk.ss_flags & SS_DISABLE) == 0 &&
- !sigonstack(syscf->sp) && (psp->ps_sigonstack & sigmask(sig)))
- cursp = ((int)p->p_sigstk.ss_sp + p->p_sigstk.ss_size);
- else
- cursp = syscf->sp;
-
- /* Set up positions for structs on stack */
- sigf = (struct sigframe *) (cursp - sizeof(struct sigframe));
-
- bzero(&gsigf, sizeof gsigf);
- gsigf.sf_pc = (register_t)catcher;
- gsigf.sf_scp = &sigf->sf_sc;
- gsigf.sf_arg = (register_t)&sigf->sf_sc;
- gsigf.sf_signum = sig;
-
- if (psp->ps_siginfo & sigmask(sig)) {
- gsigf.sf_sip = &sigf->sf_si;
- initsiginfo(&gsigf.sf_si, sig, code, type, val);
- }
-
- gsigf.sf_sc.sc_mask = mask;
- gsigf.sf_sc.sc_sp = syscf->sp;
- gsigf.sf_sc.sc_fp = syscf->fp;
- gsigf.sf_sc.sc_ap = syscf->ap | SIGCONTEXT_NEW;
- gsigf.sf_sc.sc_pc = syscf->pc;
- gsigf.sf_sc.sc_ps = syscf->psl;
- gsigf.sf_sc.sc_r[0] = syscf->r0;
- gsigf.sf_sc.sc_r[1] = syscf->r1;
- gsigf.sf_sc.sc_r[2] = syscf->r2;
- gsigf.sf_sc.sc_r[3] = syscf->r3;
- gsigf.sf_sc.sc_r[4] = syscf->r4;
- gsigf.sf_sc.sc_r[5] = syscf->r5;
- gsigf.sf_sc.sc_r[6] = syscf->r6;
- gsigf.sf_sc.sc_r[7] = syscf->r7;
- gsigf.sf_sc.sc_r[8] = syscf->r8;
- gsigf.sf_sc.sc_r[9] = syscf->r9;
- gsigf.sf_sc.sc_r[10] = syscf->r10;
- gsigf.sf_sc.sc_r[11] = syscf->r11;
-
- if (copyout(&gsigf, sigf, sizeof(gsigf)))
- sigexit(p, SIGILL);
-
- syscf->pc = p->p_p->ps_sigcode;
- syscf->psl = PSL_U | PSL_PREVU;
- /*
- * Place sp at the beginning of sigf; this ensures that possible
- * further calls to sendsig won't overwrite this struct
- * sigframe/struct sigcontext pair with their own. Also, set up
- * ap for the sigreturn call from sigcode.
- */
- syscf->sp = (unsigned)sigf;
- syscf->ap = (unsigned)sigf + offsetof(struct sigframe, sf_pc);
-}
-
-int waittime = -1;
-static volatile int showto; /* Must be volatile to survive MM on -> MM off */
-
-__dead void
-boot(int howto)
-{
- if (cold) {
- if ((howto & RB_USERREQ) == 0)
- howto |= RB_HALT;
- goto haltsys;
- }
-
- if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
- waittime = 0;
- vfs_shutdown();
-
- if ((howto & RB_TIMEBAD) == 0) {
- resettodr();
- } else {
- printf("WARNING: not updating battery clock\n");
- }
- }
- if_downall();
-
- uvm_shutdown();
- splhigh();
- cold = 1;
-
- if ((howto & RB_DUMP) != 0)
- dumpsys();
-
-haltsys:
- config_suspend_all(DVACT_POWERDOWN);
-
- if ((howto & RB_HALT) != 0) {
- if (dep_call->cpu_halt)
- (*dep_call->cpu_halt) ();
- printf("halting (in tight loop); hit\n\t^P\n\tHALT\n\n");
- for (;;) ;
- } else {
- showto = howto;
-#ifdef notyet
- /*
- * If we are provided with a bootstring, parse it and send
- * it to the boot program.
- */
- if (b)
- while (*b) {
- showto |= (*b == 'a' ? RB_ASKBOOT : (*b == 'd' ?
- RB_DEBUG : (*b == 's' ? RB_SINGLE : 0)));
- b++;
- }
-#endif
- /*
- * Now it's time to:
- * 0. Save some registers that are needed in new world.
- * 1. Change stack to somewhere that will survive MM off.
- * (RPB page is good page to save things in).
- * 2. Actually turn MM off.
- * 3. Dump away memory to disk, if asked.
- * 4. Reboot as asked.
- * The RPB page is _always_ first page in memory, we can
- * rely on that.
- */
-#ifdef notyet
- asm(" movl sp, (0x80000200);"
- " movl 0x80000200, sp;"
- " mfpr $0x10, -(sp); # PR_PCBB"
- " mfpr $0x11, -(sp); # PR_SCBB"
- " mfpr $0xc, -(sp); # PR_SBR"
- " mfpr $0xd, -(sp); # PR_SLR"
- " mtpr $0, $0x38; # PR_MAPEN"
- );
-#endif
-
- if (dep_call->cpu_reboot)
- (*dep_call->cpu_reboot)(showto);
-
- /* cpus that don't handle reboots get the standard reboot. */
- while ((mfpr(PR_TXCS) & GC_RDY) == 0)
- ;
-
- mtpr(GC_CONS|GC_BTFL, PR_TXDB);
- }
- asm("movl %0, %%r5":: "g" (showto)); /* How to boot */
- asm("movl %0, %%r11":: "r"(showto)); /* ??? */
- asm("halt");
- for (;;) ;
- /* NOTREACHED */
-}
-
-void
-dumpsys()
-{
- int maj, psize, pg;
- daddr_t blkno;
- int (*dump)(dev_t, daddr_t, caddr_t, size_t);
- paddr_t maddr;
- int error;
- kcore_seg_t *kseg_p;
- cpu_kcore_hdr_t *chdr_p;
- char dump_hdr[dbtob(1)]; /* XXX assume hdr fits in 1 block */
- extern int msgbufmapped;
-
- msgbufmapped = 0;
- if (dumpdev == NODEV)
- return;
- /*
- * For dumps during autoconfiguration, if dump device has already
- * configured...
- */
- if (dumpsize == 0) {
- dumpconf();
- if (dumpsize == 0)
- return;
- }
- maj = major(dumpdev);
- if (dumplo <= 0) {
- printf("\ndump to dev %u,%u not possible\n", maj,
- minor(dumpdev));
- return;
- }
- dump = bdevsw[maj].d_dump;
- blkno = dumplo;
-
- printf("\ndumping to dev %u,%u offset %ld\n", major(dumpdev),
- minor(dumpdev), dumplo);
-
- /* Setup the dump header */
- kseg_p = (kcore_seg_t *)dump_hdr;
- chdr_p = (cpu_kcore_hdr_t *)&dump_hdr[ALIGN(sizeof(*kseg_p))];
- bzero(dump_hdr, sizeof(dump_hdr));
-
- CORE_SETMAGIC(*kseg_p, KCORE_MAGIC, MID_MACHINE, CORE_CPU);
- kseg_p->c_size = dbtob(1) - ALIGN(sizeof(*kseg_p));
- *chdr_p = cpu_kcore_hdr;
-
- printf("dump ");
- psize = (*bdevsw[maj].d_psize)(dumpdev);
- if (psize == -1) {
- printf("area unavailable\n");
- return;
- }
-
- /* Dump the header. */
- error = (*dump)(dumpdev, blkno++, (caddr_t)dump_hdr, dbtob(1));
- if (error != 0)
- goto abort;
-
- maddr = (paddr_t)0;
- for (pg = 0; pg < dumpsize; pg++) {
-#define NPGMB (1024 * 1024 / PAGE_SIZE)
- /* print out how many MBs we have dumped */
- if (pg != 0 && (pg % NPGMB) == 0)
- printf("%d ", pg / NPGMB);
-#undef NPGMB
- error = (*dump)(dumpdev, blkno, (caddr_t)maddr + KERNBASE,
- PAGE_SIZE);
- if (error == 0) {
- maddr += PAGE_SIZE;
- blkno += btodb(PAGE_SIZE);
- } else
- break;
- }
-abort:
- switch (error) {
- case 0:
- printf("succeeded\n");
- break;
-
- case ENXIO:
- printf("device bad\n");
- break;
-
- case EFAULT:
- printf("device not ready\n");
- break;
-
- case EINVAL:
- printf("area improper\n");
- break;
-
- case EIO:
- printf("i/o error\n");
- break;
-
- case EINTR:
- printf("aborted from console\n");
- break;
-
- default:
- printf("error %d\n", error);
- break;
- }
-}
-
-int
-process_read_regs(p, regs)
- struct proc *p;
- struct reg *regs;
-{
- struct trapframe *tf = p->p_addr->u_pcb.framep;
-
- bcopy(&tf->r0, &regs->r0, 12 * sizeof(int));
- regs->ap = tf->ap;
- regs->fp = tf->fp;
- regs->sp = tf->sp;
- regs->pc = tf->pc;
- regs->psl = tf->psl;
- return 0;
-}
-
-#ifdef PTRACE
-
-int
-process_write_regs(p, regs)
- struct proc *p;
- struct reg *regs;
-{
- struct trapframe *tf = p->p_addr->u_pcb.framep;
-
- bcopy(&regs->r0, &tf->r0, 12 * sizeof(int));
- tf->ap = regs->ap;
- tf->fp = regs->fp;
- tf->sp = regs->sp;
- tf->pc = regs->pc;
- tf->psl = (regs->psl|PSL_U|PSL_PREVU) &
- ~(PSL_MBZ|PSL_IS|PSL_IPL1F|PSL_CM);
- return 0;
-}
-
-int
-process_set_pc(p, addr)
- struct proc *p;
- caddr_t addr;
-{
- struct trapframe *tf;
- void *ptr;
-
- ptr = (char *) p->p_addr->u_pcb.framep;
- tf = ptr;
-
- tf->pc = (unsigned) addr;
-
- return (0);
-}
-
-int
-process_sstep(p, sstep)
- struct proc *p;
-{
- void *ptr;
- struct trapframe *tf;
-
- ptr = p->p_addr->u_pcb.framep;
- tf = ptr;
-
- if (sstep)
- tf->psl |= PSL_T;
- else
- tf->psl &= ~PSL_T;
-
- return (0);
-}
-
-#endif /* PTRACE */
-
-#undef PHYSMEMDEBUG
-/*
- * Allocates a virtual range suitable for mapping in physical memory.
- * This differs from the bus_space routines in that it allocates on
- * physical page sizes instead of logical sizes. This implementation
- * uses an extent to manage allocated space from the IOMAP submap.
- * The implementation is similar to the uba resource map handling. Size
- * is given in pages.
- * If the page requested is bigger than a logical page, space is
- * allocated from the kernel map instead.
- *
- * It is known that the first page in the iospace area is unused; it may
- * be use by console device drivers (before the map system is initted).
- */
-vaddr_t
-vax_map_physmem(phys, size)
- paddr_t phys;
- int size;
-{
- vaddr_t addr;
- int error;
- static int warned = 0;
-
-#ifdef DEBUG
- if (!iospace_inited)
- panic("vax_map_physmem: called before rminit()?!?");
-#endif
- if (size >= LTOHPN) {
- addr = uvm_km_valloc(kernel_map, size * VAX_NBPG);
- if (addr == 0)
- panic("vax_map_physmem: kernel map full");
- } else {
- error = extent_alloc(extio, size * VAX_NBPG, VAX_NBPG, 0,
- EX_NOBOUNDARY, EX_NOWAIT | EX_MALLOCOK, (u_long *)&addr);
- if (error != 0) {
- if (warned++ == 0) /* Warn only once */
- printf("vax_map_physmem: iomap too small");
- return 0;
- }
- }
- ioaccess(addr, phys, size);
-#ifdef PHYSMEMDEBUG
- printf("vax_map_physmem: alloc'ed %d pages for paddr %lx, at %lx\n",
- size, phys, addr);
-#endif
- return addr | (phys & VAX_PGOFSET);
-}
-
-/*
- * Unmaps the previous mapped (addr, size) pair.
- */
-void
-vax_unmap_physmem(addr, size)
- vaddr_t addr;
- int size;
-{
-#ifdef PHYSMEMDEBUG
- printf("vax_unmap_physmem: unmapping %d pages at addr %lx\n",
- size, addr);
-#endif
- iounaccess(addr, size);
- if (size >= LTOHPN)
- uvm_km_free(kernel_map, addr, size * VAX_NBPG);
- else
- extent_free(extio, (u_long)addr & ~VAX_PGOFSET,
- size * VAX_NBPG, EX_NOWAIT);
-}
-
-/*
- * The following is a very stripped-down db_disasm.c, with only the logic
- * to skip instructions.
- */
-
-long skip_operand(long, int);
-long skip_opcode(long);
-
-static u_int8_t get_byte(long);
-
-static __inline__ u_int8_t
-get_byte(ib)
- long ib;
-{
- return *((u_int8_t *)ib);
-}
-
-long
-skip_opcode(ib)
- long ib;
-{
- u_int opc;
- int size;
- char *argp; /* pointer into argument-list */
-
- opc = get_byte(ib++);
- if (opc >= 0xfd) {
- /* two byte op-code */
- opc = opc << 8;
- opc += get_byte(ib++);
- argp = vax_inst2[INDEX_OPCODE(opc)].argdesc;
- } else
- argp = vax_inst[opc].argdesc;
-
- if (argp == NULL)
- return ib;
-
- while (*argp) {
- switch (*argp) {
-
- case 'b': /* branch displacement */
- switch (*(++argp)) {
- case 'b':
- ib++;
- break;
- case 'w':
- ib += 2;
- break;
- case 'l':
- ib += 4;
- break;
- }
- break;
-
- case 'a': /* absolute addressing mode */
- /* FALLTHROUGH */
- default:
- switch (*(++argp)) {
- case 'b': /* Byte */
- size = 1;
- break;
- case 'w': /* Word */
- size = 2;
- break;
- case 'l': /* Long-Word */
- case 'f': /* F_Floating */
- size = 4;
- break;
- case 'q': /* Quad-Word */
- case 'd': /* D_Floating */
- case 'g': /* G_Floating */
- size = 8;
- break;
- case 'o': /* Octa-Word */
- case 'h': /* H_Floating */
- size = 16;
- break;
- default:
- size = 0;
- }
- ib = skip_operand(ib, size);
- }
-
- if (!*argp || !*++argp)
- break;
- if (*argp++ != ',')
- break;
- }
-
- return ib;
-}
-
-long
-skip_operand(ib, size)
- long ib;
- int size;
-{
- int c = get_byte(ib++);
-
- switch (c >> 4) { /* mode */
- case 4: /* indexed */
- ib = skip_operand(ib, 0);
- break;
-
- case 9: /* autoincrement deferred */
- if (c == 0x9f) { /* pc: immediate deferred */
- /*
- * addresses are always longwords!
- */
- ib += 4;
- }
- break;
- case 8: /* autoincrement */
- if (c == 0x8f) { /* pc: immediate ==> special syntax */
- ib += size;
- }
- break;
-
- case 11: /* byte displacement deferred/ relative deferred */
- case 10: /* byte displacement / relative mode */
- ib++;
- break;
-
- case 13: /* word displacement deferred */
- case 12: /* word displacement */
- ib += 2;
- break;
-
- case 15: /* long displacement referred */
- case 14: /* long displacement */
- ib += 4;
- break;
- }
-
- return ib;
-}
-
-void
-generic_halt()
-{
- if (cpmbx->user_halt != UHALT_DEFAULT) {
- if (cpmbx->mbox_halt != 0)
- cpmbx->mbox_halt = 0; /* let console override */
- } else if (cpmbx->mbox_halt != MHALT_HALT)
- cpmbx->mbox_halt = MHALT_HALT; /* the os decides */
-
- asm("halt");
-}
-
-void
-generic_reboot(int arg)
-{
- if (cpmbx->user_halt != UHALT_DEFAULT) {
- if (cpmbx->mbox_halt != 0)
- cpmbx->mbox_halt = 0;
- } else if (cpmbx->mbox_halt != MHALT_REBOOT)
- cpmbx->mbox_halt = MHALT_REBOOT;
-
- asm("halt");
-}
-
-#ifdef DIAGNOSTIC
-void
-splassert_check(int wantipl, const char *func)
-{
- extern int oldvsbus;
- int oldipl = mfpr(PR_IPL);
-
- /*
- * Do not complain for older vsbus systems where vsbus interrupts
- * at 0x14, instead of the expected 0x15. Since these systems are
- * not expandable and all their devices interrupt at the same
- * level, there is no risk of them interrupting each other while
- * they are servicing an interrupt, even at level 0x14.
- */
- if (oldvsbus != 0 && oldipl == 0x14)
- oldipl = 0x15;
-
- /*
- * ... and then, IPL_TYY is now 0x16 because of KA60 interrupt
- * assignments, so we should not mind if splassert(IPL_TTY) and
- * IPL 0x15 on other machines.
- */
- if (wantipl == IPL_TTY && oldipl == 0x15) {
-#ifdef VAX60
- if (vax_boardtype != VAX_BTYP_60)
-#endif
- oldipl = 0x16;
- }
-
- if (oldipl < wantipl) {
- splassert_fail(wantipl, oldipl, func);
- /*
- * If the splassert_ctl is set to not panic, raise the ipl
- * in a feeble attempt to reduce damage.
- */
- mtpr(wantipl, PR_IPL);
- }
-}
-#endif
-
-void _start(struct rpb *);
-void main(void);
-
-extern paddr_t avail_end;
-extern int physmem;
-paddr_t esym;
-u_int proc0paddr;
-char cpu_model[100];
-
-/*
- * The strict cpu-dependent information is set up here, in
- * form of a pointer to a struct that is specific for each cpu.
- */
-extern struct cpu_dep ka43_calls;
-extern struct cpu_dep ka46_calls;
-extern struct cpu_dep ka48_calls;
-extern struct cpu_dep ka49_calls;
-extern struct cpu_dep ka53_calls;
-extern struct cpu_dep ka410_calls;
-extern struct cpu_dep ka630_calls;
-extern struct cpu_dep ka650_calls;
-extern struct cpu_dep ka660_calls;
-extern struct cpu_dep ka670_calls;
-extern struct cpu_dep ka680_calls;
-extern struct cpu_dep ka60_calls;
-extern struct cpu_dep vxt_calls;
-
-/*
- * Start is called from boot; the first routine that is called
- * in kernel. Kernel stack is setup somewhere in a safe place;
- * but we need to move it to a better known place. Memory
- * management is disabled, and no interrupt system is active.
- */
-void
-_start(struct rpb *prpb)
-{
- extern vaddr_t scratch;
- int preserve_cca = 0;
-
- mtpr(AST_NO, PR_ASTLVL); /* Turn off ASTs */
-
- findcpu(); /* Set up the CPU identifying variables */
-
- if (vax_confdata & 0x80)
- strlcpy(cpu_model, "MicroVAX ", sizeof cpu_model);
- else
- strlcpy(cpu_model, "VAXstation ", sizeof cpu_model);
-
- switch (vax_boardtype) {
-#if VAX410
- case VAX_BTYP_420: /* They are very similar */
- dep_call = &ka410_calls;
- strlcat(cpu_model, "3100", sizeof cpu_model);
- switch (vax_cpustype) {
- case 0x00:
- strlcat(cpu_model, "/m{30,40}", sizeof cpu_model);
- break;
- case 0x01:
- strlcat(cpu_model, "/m{38,48}", sizeof cpu_model);
- break;
- case 0x02:
- strlcat(cpu_model, "/m{10,20}{,e}", sizeof cpu_model);
- break;
- }
- break;
-
- case VAX_BTYP_410:
- dep_call = &ka410_calls;
- strlcat(cpu_model, "2000", sizeof cpu_model);
- break;
-#endif
-#if VAX43
- case VAX_BTYP_43:
- dep_call = &ka43_calls;
- strlcat(cpu_model, "3100/m76", sizeof cpu_model);
- break;
-#endif
-#if VAX46
- case VAX_BTYP_46:
- dep_call = &ka46_calls;
- switch (vax_siedata & 0xff) {
- case VAX_VTYP_47:
- strlcpy(cpu_model, "MicroVAX 3100 m80", sizeof cpu_model);
- break;
- case VAX_VTYP_46:
- strlcpy(cpu_model, "VAXstation 4000/60", sizeof cpu_model);
- break;
- default:
- strlcat(cpu_model, " - Unknown Mariah", sizeof cpu_model);
- }
- break;
-#endif
-#ifdef VXT
- case VAX_BTYP_VXT:
- dep_call = &vxt_calls;
- strlcpy(cpu_model, "VXT2000", sizeof cpu_model);
- break;
-#endif
-#if VAX48
- case VAX_BTYP_48:
- dep_call = &ka48_calls;
- switch (vax_cpustype) {
- case VAX_STYP_45:
- strlcpy(cpu_model, "MicroVAX 3100/m{30,40}", sizeof cpu_model);
- break;
- case VAX_STYP_48:
- strlcpy(cpu_model, "VAXstation 4000/VLC", sizeof cpu_model);
- break;
- default:
- strlcat(cpu_model, " - Unknown SOC", sizeof cpu_model);
- }
- break;
-#endif
-#if VAX49
- case VAX_BTYP_49:
- dep_call = &ka49_calls;
- strlcpy(cpu_model, "VAXstation 4000/90", sizeof cpu_model);
- break;
-#endif
-#if VAX53
- case VAX_BTYP_1303:
- dep_call = &ka53_calls;
- switch (vax_cpustype) {
- case VAX_STYP_50:
- strlcpy(cpu_model, "MicroVAX 3100 model 85 or 90", sizeof cpu_model);
- break;
- case VAX_STYP_51:
- strlcpy(cpu_model, "MicroVAX 3100 model 90 or 95", sizeof cpu_model);
- break;
- case VAX_STYP_52:
- strlcpy(cpu_model, "VAX 4000 100", sizeof cpu_model);
- break;
- case VAX_STYP_53:
- strlcpy(cpu_model, "VAX 4000 105A", sizeof cpu_model);
- break;
- default:
- strlcpy(cpu_model, "VAX - Unknown Cheetah Class", sizeof cpu_model);
- }
- break;
-#endif
-#if VAX630
- case VAX_BTYP_630:
- dep_call = &ka630_calls;
- strlcpy(cpu_model,"MicroVAX II", sizeof cpu_model);
- break;
-#endif
-#if VAX650
- case VAX_BTYP_650:
- dep_call = &ka650_calls;
- strlcpy(cpu_model,"MicroVAX ", sizeof cpu_model);
- switch (vax_cpustype) {
- case VAX_STYP_640:
- strlcat(cpu_model, "3300/3400", sizeof cpu_model);
- break;
-
- case VAX_STYP_650:
- strlcat(cpu_model, "3500/3600", sizeof cpu_model);
- break;
-
- case VAX_STYP_655:
- strlcat(cpu_model, "3800/3900", sizeof cpu_model);
- break;
-
- default:
- strlcat(cpu_model, "III", sizeof cpu_model);
- break;
- }
- break;
-#endif
-#if VAX660
- case VAX_BTYP_660:
- dep_call = &ka660_calls;
- strlcpy(cpu_model,"VAX 4000 200", sizeof cpu_model);
- break;
-#endif
-#if VAX670
- case VAX_BTYP_670:
- dep_call = &ka670_calls;
- strlcpy(cpu_model,"VAX 4000 300", sizeof cpu_model);
- break;
-#endif
-#if VAX680
- case VAX_BTYP_1301:
- dep_call = &ka680_calls;
- strlcpy(cpu_model,"VAX 4000 ", sizeof cpu_model);
- switch (vax_cpustype) {
- case VAX_STYP_675:
- strlcat(cpu_model,"400", sizeof cpu_model);
- break;
- case VAX_STYP_680:
- strlcat(cpu_model,"500", sizeof cpu_model);
- break;
- case VAX_STYP_690:
- strlcat(cpu_model,"600", sizeof cpu_model);
- break;
- default:
- strlcat(cpu_model,"- Unknown Omega Class", sizeof cpu_model);
- }
- break;
- case VAX_BTYP_1305:
- dep_call = &ka680_calls;
- strlcpy(cpu_model,"VAX 4000 ", sizeof cpu_model);
- switch (vax_cpustype) {
- case VAX_STYP_681:
- strlcat(cpu_model,"500A", sizeof cpu_model);
- break;
- case VAX_STYP_691:
- strlcat(cpu_model,"605A", sizeof cpu_model);
- break;
- case VAX_STYP_694:
- if (vax_cpudata & 0x1000)
- strlcat(cpu_model,"705A", sizeof cpu_model);
- else
- strlcat(cpu_model,"700A", sizeof cpu_model);
- break;
- default:
- strlcat(cpu_model,"- Unknown Legacy Class", sizeof cpu_model);
- }
- break;
-#endif
-#ifdef VAX60
- case VAX_BTYP_60:
- dep_call = &ka60_calls;
- preserve_cca = 1;
- /* cpu_model will be set in ka60_init */
- break;
-#endif
- default:
- /* CPU not supported, just give up */
- asm("halt");
- }
-
- /*
- * Machines older than MicroVAX II have their boot blocks
- * loaded directly or the boot program loaded from console
- * media, so we need to figure out their memory size.
- * This is not easily done on MicroVAXen, so we get it from
- * VMB instead.
- *
- * In post-1.4 a RPB is always provided from the boot blocks.
- */
-#if 1 /* compat with old bootblocks */
- if (prpb == 0) {
- bzero((caddr_t)proc0paddr + REDZONEADDR, sizeof(struct rpb));
- prpb = (struct rpb *)(proc0paddr + REDZONEADDR);
- prpb->pfncnt = avail_end >> VAX_PGSHIFT;
- prpb->rpb_base = (void *)-1; /* RPB is fake */
- } else
-#endif
- bcopy(prpb, (caddr_t)proc0paddr + REDZONEADDR, sizeof(struct rpb));
- if (prpb->pfncnt)
- avail_end = prpb->pfncnt << VAX_PGSHIFT;
- else
- while (badaddr((caddr_t)avail_end, 4) == 0)
- avail_end += VAX_NBPG * 128;
- boothowto = prpb->rpb_bootr5;
-
- physmem = atop(avail_end);
-
- /*
- * If we need to use the Console Communication Area, make sure
- * we will not stomp over it.
- *
- * On KA60 systems, the PROM apparently forgets to keep the CCA
- * out of the reported memory size. It's no real surprise, as
- * the memory bitmap pointed to by the CCA reports all physical
- * memory (including itself and the CCA) as available!
- * (which means the bitmap is not worth looking at either)
- */
-
- if (preserve_cca) {
- if (prpb->cca_addr != 0 && avail_end > prpb->cca_addr) {
- struct cca *cca = (struct cca *)prpb->cca_addr;
-
- /*
- * XXX Should validate the CCA image here.
- */
-
- avail_end = prpb->cca_addr;
- if (cca->cca_bitmap != 0 && avail_end > cca->cca_bitmap)
- avail_end = cca->cca_bitmap;
- }
- }
-
- avail_end = trunc_page(avail_end); /* be sure */
-
- proc0.p_addr = (struct user *)proc0paddr; /* XXX */
- bzero((struct user *)proc0paddr, sizeof(struct user));
- proc0.p_addr->u_pcb.pcb_paddr = (paddr_t)proc0paddr - KERNBASE;
-
- pmap_bootstrap();
-
- /* Now running virtual. set red zone for proc0 */
- *kvtopte((u_int)proc0.p_addr + REDZONEADDR) &= ~PG_V;
-
- ((struct pcb *)proc0paddr)->framep = (void *)scratch;
-
- /*
- * Change mode down to userspace is done by faking a stack
- * frame that is setup in cpu_set_kpc(). Not done by returning
- * from main anymore.
- */
- main();
- /* NOTREACHED */
-}
diff --git a/sys/arch/vax/vax/mem.c b/sys/arch/vax/vax/mem.c
deleted file mode 100644
index 431ce2649bd..00000000000
--- a/sys/arch/vax/vax/mem.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/* $OpenBSD: mem.c,v 1.18 2015/02/10 22:44:35 miod Exp $ */
-/* $NetBSD: mem.c,v 1.15 1999/03/24 05:51:17 mrg Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 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.
- *
- * @(#)mem.c 8.3 (Berkeley) 1/12/94
- */
-
-/*
- * Memory special file
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/buf.h>
-#include <sys/systm.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-
-#include <machine/pte.h>
-#include <machine/mtpr.h>
-
-#include <uvm/uvm_extern.h>
-
-caddr_t zeropage;
-
-#define mmread mmrw
-#define mmwrite mmrw
-cdev_decl(mm);
-
-/*ARGSUSED*/
-int
-mmopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- switch (minor(dev)) {
- case 0:
- case 1:
- case 2:
- case 12:
- return (0);
- default:
- return (ENXIO);
- }
-}
-
-/*ARGSUSED*/
-int
-mmclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-mmrw(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- vaddr_t v;
- size_t c;
- struct iovec *iov;
- int error = 0;
-
- while (uio->uio_resid > 0 && error == 0) {
- iov = uio->uio_iov;
- if (iov->iov_len == 0) {
- uio->uio_iov++;
- uio->uio_iovcnt--;
- if (uio->uio_iovcnt < 0)
- panic("mmrw");
- continue;
- }
- switch (minor(dev)) {
-
-/* minor device 0 is physical memory */
- case 0:
- v = uio->uio_offset;
- if (v < 0 || v >= ptoa(physmem)) {
- return (EFAULT);
- }
-
- c = ulmin(iov->iov_len, MAXPHYS);
- error = uiomove((caddr_t)v + KERNBASE, c, uio);
- continue;
-/* minor device 1 is kernel memory */
- case 1:
- v = uio->uio_offset;
- c = ulmin(iov->iov_len, MAXPHYS);
- if (!uvm_kernacc((caddr_t)v, c,
- uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
- return (EFAULT);
- error = uiomove((caddr_t)v, c, uio);
- continue;
-
-/* minor device 2 is EOF/RATHOLE */
- case 2:
- if (uio->uio_rw == UIO_WRITE)
- uio->uio_resid = 0;
- return (0);
-
-/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */
- case 12:
- if (uio->uio_rw == UIO_WRITE) {
- c = iov->iov_len;
- break;
- }
- if (zeropage == NULL)
- zeropage = malloc(PAGE_SIZE, M_TEMP,
- M_WAITOK | M_ZERO);
- c = ulmin(iov->iov_len, PAGE_SIZE);
- error = uiomove(zeropage, c, uio);
- continue;
-
- default:
- return (ENXIO);
- }
- if (error)
- break;
- iov->iov_base = (caddr_t)iov->iov_base + c;
- iov->iov_len -= c;
- uio->uio_offset += c;
- uio->uio_resid -= c;
- }
- return (error);
-}
-
-paddr_t
-mmmmap(dev, off, prot)
- dev_t dev;
- off_t off;
- int prot;
-{
-
- return (-1);
-}
-
-int
-mmioctl(dev, cmd, data, flags, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flags;
- struct proc *p;
-{
- return (EOPNOTSUPP);
-}
diff --git a/sys/arch/vax/vax/mutex.c b/sys/arch/vax/vax/mutex.c
deleted file mode 100644
index 60ffe07b827..00000000000
--- a/sys/arch/vax/vax/mutex.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* $OpenBSD: mutex.c,v 1.7 2011/04/21 04:34:12 miod Exp $ */
-
-/*
- * Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
- * 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. 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 ``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/mutex.h>
-#include <sys/systm.h>
-
-#include <machine/intr.h>
-
-#ifdef MULTIPROCESSOR
-#error This code needs more work
-#endif
-
-/*
- * Single processor systems don't need any mutexes, but they need the spl
- * raising semantics of the mutexes.
- */
-void
-mtx_init(struct mutex *mtx, int wantipl)
-{
- mtx->mtx_oldipl = 0;
- mtx->mtx_wantipl = wantipl;
- mtx->mtx_lock = 0;
-}
-
-void
-mtx_enter(struct mutex *mtx)
-{
- if (mtx->mtx_wantipl != IPL_NONE)
- mtx->mtx_oldipl = _splraise(mtx->mtx_wantipl);
-
- MUTEX_ASSERT_UNLOCKED(mtx);
- mtx->mtx_lock = 1;
-#ifdef DIAGNOSTIC
- curcpu()->ci_mutex_level++;
-#endif
-}
-
-int
-mtx_enter_try(struct mutex *mtx)
-{
- if (mtx->mtx_wantipl != IPL_NONE)
- mtx->mtx_oldipl = _splraise(mtx->mtx_wantipl);
- MUTEX_ASSERT_UNLOCKED(mtx);
- mtx->mtx_lock = 1;
-#ifdef DIAGNOSTIC
- curcpu()->ci_mutex_level++;
-#endif
-
- return 1;
-}
-
-void
-mtx_leave(struct mutex *mtx)
-{
- MUTEX_ASSERT_LOCKED(mtx);
-#ifdef DIAGNOSTIC
- curcpu()->ci_mutex_level--;
-#endif
- mtx->mtx_lock = 0;
- if (mtx->mtx_wantipl != IPL_NONE)
- splx(mtx->mtx_oldipl);
-}
diff --git a/sys/arch/vax/vax/opcodes.c b/sys/arch/vax/vax/opcodes.c
deleted file mode 100644
index cb886583e04..00000000000
--- a/sys/arch/vax/vax/opcodes.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/* $OpenBSD: opcodes.c,v 1.1 2002/05/16 07:37:44 miod Exp $ */
-
-/*
- * Copyright (c) 2002, Miodrag Vallat.
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by
- * Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/types.h>
-
-#include <vax/vax/db_disasm.h>
-
-/* one-byte instructions */
-vax_instr_t vax_inst[256] = {
-/* 0x00 */ { "halt", NULL },
-/* 0x01 */ { "nop", NULL },
-/* 0x02 */ { "rei", NULL },
-/* 0x03 */ { "bpt", NULL },
-/* 0x04 */ { "ret", NULL },
-/* 0x05 */ { "rsb", NULL },
-/* 0x06 */ { "ldpctx", NULL },
-/* 0x07 */ { "svpctx", NULL },
-/* 0x08 */ { "cvtps", "rw,ab,rw,ab" },
-/* 0x09 */ { "cvtsp", "rw,ab,rw,ab" },
-/* 0x0a */ { "index", "rl,rl,rl,rl,rl,wl" },
-/* 0x0b */ { "crc", "ab,rl,rw,ab" },
-/* 0x0c */ { "prober", "rb,rw,ab" },
-/* 0x0d */ { "probew", "rb,rw,ab" },
-/* 0x0e */ { "insque", "ab,wl" },
-/* 0x0f */ { "remque", "ab,wl" },
-
-/* 0x10 */ { "bsbb", "bb" },
-/* 0x11 */ { "brb", "bb" },
-/* 0x12 */ { "*bneq", "bb" },
-/* 0x13 */ { "*beql", "bb" },
-/* 0x14 */ { "bgtr", "bb" },
-/* 0x15 */ { "bleq", "bb" },
-/* 0x16 */ { "jsb", "ab" },
-/* 0x17 */ { "jmp", "ab" },
-/* 0x18 */ { "bgeq", "bb" },
-/* 0x19 */ { "blss", "bb" },
-/* 0x1a */ { "bgtru", "bb" },
-/* 0x1b */ { "blequ", "bb" },
-/* 0x1c */ { "bvc", "bb" },
-/* 0x1d */ { "bvs", "bb" },
-/* 0x1e */ { "*bcc", "bb" },
-/* 0x1f */ { "*bcs", "bb" },
-
-/* 0x20 */ { "addp4", "rw,ab,rw,ab" },
-/* 0x21 */ { "addp6", "rw,ab,rw,ab,rw,ab" },
-/* 0x22 */ { "subp4", "rw,ab,rw,ab" },
-/* 0x23 */ { "subp6", "rw,ab,rw,ab,rw,ab" },
-/* 0x24 */ { "cvtpt", "rw,ab,ab,rw,ab" },
-/* 0x25 */ { "mulp", "rw,ab,rw,ab,rw,ab" },
-/* 0x26 */ { "cvttp", "rw,ab,ab,rw,ab" },
-/* 0x27 */ { "divp", "rw,ab,rw,ab,rw,ab" },
-/* 0x28 */ { "movc3", "rw,ab,ab" },
-/* 0x29 */ { "cmpc3", "rw,ab,ab" },
-/* 0x2a */ { "scanc", "rw,ab,ab,rb" },
-/* 0x2b */ { "spanc", "rw,ab,ab,rb" },
-/* 0x2c */ { "movc5", "rw,ab,rb,rw,ab" },
-/* 0x2d */ { "cmpc5", "rw,ab,rb,rw,ab" },
-/* 0x2e */ { "movtc", "rw,ab,rb,ab,rw,ab" },
-/* 0x2f */ { "movtuc", "rw,ab,rb,ab,rw,ab" },
-
-/* 0x30 */ { "bsbw", "bw" },
-/* 0x31 */ { "brw", "bw" },
-/* 0x32 */ { "cvtwl", "rw,wl" },
-/* 0x33 */ { "cvtwb", "rw,wb" },
-/* 0x34 */ { "movp", "rw,ab,ab" },
-/* 0x35 */ { "cmpp3", "rw,ab,ab" },
-/* 0x36 */ { "cvtpl", "rw,ab,wl" },
-/* 0x37 */ { "cmpp4", "rw,ab,rw,ab" },
-/* 0x38 */ { "editpc", "rw,ab,ab,ab" },
-/* 0x39 */ { "matchc", "rw,ab,rw,ab" },
-/* 0x3a */ { "locc", "rb,rw,ab" },
-/* 0x3b */ { "skpc", "rb,rw,ab" },
-/* 0x3c */ { "movzwl", "rw,wl" },
-/* 0x3d */ { "acbw", "rw,rw,mw,bw" },
-/* 0x3e */ { "movaw", "aw,wl" },
-/* 0x3f */ { "pushaw", "aw" },
-
-/* 0x40 */ { "addf2", "rf,mf" },
-/* 0x41 */ { "addf3", "rf,rf,wf" },
-/* 0x42 */ { "subf2", "rf,mf" },
-/* 0x43 */ { "subf3", "rf,rf,wf" },
-/* 0x44 */ { "mulf2", "rf,mf" },
-/* 0x45 */ { "mulf3", "rf,rf,wf" },
-/* 0x46 */ { "divf2", "rf,mf" },
-/* 0x47 */ { "divf3", "rf,rf,wf" },
-/* 0x48 */ { "cvtfb", "rf,wb" },
-/* 0x49 */ { "cvtfw", "rf,ww" },
-/* 0x4a */ { "cvtfl", "rf,wl" },
-/* 0x4b */ { "cvtrfl", "rf,wl" },
-/* 0x4c */ { "cvtbf", "rb,wf" },
-/* 0x4d */ { "cvtwf", "rw,wf" },
-/* 0x4e */ { "cvtlf", "rl,wf" },
-/* 0x4f */ { "acbf", "rf,rf,rf,bw" },
-
-/* 0x50 */ { "movf", "rf,wf" },
-/* 0x51 */ { "cmpf", "rf,rf" },
-/* 0x52 */ { "mnegf", "rf,wf" },
-/* 0x53 */ { "tstf", "rf" },
-/* 0x54 */ { "emodf", "rf,rb,rf,wl,wf" },
-/* 0x55 */ { "polyf", "rf,rw,ab" },
-/* 0x56 */ { "cvtfd", "rf,wd" },
-/* 0x57 */ { NULL, NULL },
-/* 0x58 */ { "adawi", "rw,mw" },
-/* 0x59 */ { NULL, NULL },
-/* 0x5a */ { NULL, NULL },
-/* 0x5b */ { NULL, NULL },
-/* 0x5c */ { "insqhi", "ab,aq" },
-/* 0x5d */ { "insqti", "ab,aq" },
-/* 0x5e */ { "remqhi", "aq,wl" },
-/* 0x5f */ { "remqti", "aq,wl" },
-
-/* 0x60 */ { "addd2", "rd,md" },
-/* 0x61 */ { "addd3", "rd,rd,wd" },
-/* 0x62 */ { "subd2", "rd,md" },
-/* 0x63 */ { "subd3", "rd,rd,wd" },
-/* 0x64 */ { "muld2", "rd,md" },
-/* 0x65 */ { "muld3", "rd,rd,wd" },
-/* 0x66 */ { "divd2", "rd,md" },
-/* 0x67 */ { "divd3", "rd,rd,wd" },
-/* 0x68 */ { "cvtdb", "rd,wb" },
-/* 0x69 */ { "cvtdw", "rd,ww" },
-/* 0x6a */ { "cvtdl", "rd,wl" },
-/* 0x6b */ { "cvtrdl", "rd,wl" },
-/* 0x6c */ { "cvtbd", "rb,wd" },
-/* 0x6d */ { "cvtwd", "rw,wd" },
-/* 0x6e */ { "cvtld", "rl,wd" },
-/* 0x6f */ { "acbd", "rd,rd,md,bw" },
-
-/* 0x70 */ { "movd", "rd,wd" },
-/* 0x71 */ { "cmpd", "rd,rd" },
-/* 0x72 */ { "mnegd", "rd,wd" },
-/* 0x73 */ { "tstd", "rd" },
-/* 0x74 */ { "emodd", "rd,rb,rd,wl,wd" },
-/* 0x75 */ { "polyd", "rd,rw,ab" },
-/* 0x76 */ { "cvtdf", "rd,wf" },
-/* 0x77 */ { NULL, NULL },
-/* 0x78 */ { "ashl", "rb,rl,wl" },
-/* 0x79 */ { "ashq", "rb,rq,wq" },
-/* 0x7a */ { "emul", "rl,rl,rl,wq" },
-/* 0x7b */ { "ediv", "rl,rq,wl,wl" },
-/* 0x7c */ { "*clrq", "wq" },
-/* 0x7d */ { "movq", "rq,wq" },
-/* 0x7e */ { "*movaq", "aq,wl" },
-/* 0x7f */ { "*pushaq", "aq" },
-
-/* 0x80 */ { "addb2", "rb,mb" },
-/* 0x81 */ { "addb3", "rb,rb,wb" },
-/* 0x82 */ { "subb2", "rb,mb" },
-/* 0x83 */ { "subb3", "rb,rb,wb" },
-/* 0x84 */ { "mulb2", "rb,mb" },
-/* 0x85 */ { "mulb3", "rb,rb,wb" },
-/* 0x86 */ { "divb2", "rb,mb" },
-/* 0x87 */ { "divb3", "rb,rb,wb" },
-/* 0x88 */ { "bisb2", "rb,mb" },
-/* 0x89 */ { "bisb3", "rb,rb,wb" },
-/* 0x8a */ { "bicb2", "rb,mb" },
-/* 0x8b */ { "bicb3", "rb,rb,wb" },
-/* 0x8c */ { "xorb2", "rb,mb" },
-/* 0x8d */ { "xorb3", "rb,rb,wb" },
-/* 0x8e */ { "mnegb", "rb,wb" },
-/* 0x8f */ { "caseb", "rb,rb,rb,bw-list" },
-
-/* 0x90 */ { "movb", "rb,wb" },
-/* 0x91 */ { "cmpb", "rb,rb" },
-/* 0x92 */ { "mcomb", "rb,wb" },
-/* 0x93 */ { "bitb", "rb,rb" },
-/* 0x94 */ { "clrb", "wb" },
-/* 0x95 */ { "tstb", "rb" },
-/* 0x96 */ { "incb", "mb" },
-/* 0x97 */ { "decb", "mb" },
-/* 0x98 */ { "cvtbl", "rb,wl" },
-/* 0x99 */ { "cvtbw", "rb,ww" },
-/* 0x9a */ { "movzbl", "rb,wl" },
-/* 0x9b */ { "movzbw", "wb,ww" },
-/* 0x9c */ { "rotl", "rb,rl,wl" },
-/* 0x9d */ { "acbb", "rb,rb,mb,bw" },
-/* 0x9e */ { "movab", "ab,wl" },
-/* 0x9f */ { "pushab", "ab" },
-
-/* 0xa0 */ { "addw2", "rw,mw" },
-/* 0xa1 */ { "addw3", "rw,rw,ww" },
-/* 0xa2 */ { "subw2", "rw,mw" },
-/* 0xa3 */ { "subw3", "rw,rw,ww" },
-/* 0xa4 */ { "mulw2", "rw,mw" },
-/* 0xa5 */ { "mulw3", "rw,rw,ww" },
-/* 0xa6 */ { "divw2", "rw,mw" },
-/* 0xa7 */ { "divw3", "rw,rw,ww" },
-/* 0xa8 */ { "bisw2", "rw,mw" },
-/* 0xa9 */ { "bisw3", "rw,rw,ww" },
-/* 0xaa */ { "bicw2", "rw,mw" },
-/* 0xab */ { "bicw3", "rw,rw,ww" },
-/* 0xac */ { "xorw2", "rw,mw" },
-/* 0xad */ { "xorw3", "rw,rw,ww" },
-/* 0xae */ { "mnegw", "rw,ww" },
-/* 0xaf */ { "casew", "rw,rw,rw,bw-list" },
-
-/* 0xb0 */ { "movw", "rw,ww" },
-/* 0xb1 */ { "cmpw", "rw,rw" },
-/* 0xb2 */ { "mcomw", "rw,ww" },
-/* 0xb3 */ { "bitw", "rw,rw" },
-/* 0xb4 */ { "clrw", "mw" },
-/* 0xb5 */ { "tstw", "rw" },
-/* 0xb6 */ { "incw", "mw" },
-/* 0xb7 */ { "decw", "mw" },
-/* 0xb8 */ { "bispsw", "rw" },
-/* 0xb9 */ { "bicpsw", "rw" },
-/* 0xba */ { "popr", "rw" },
-/* 0xbb */ { "pushr", "rw" },
-/* 0xbc */ { "chmk", "rw" },
-/* 0xbd */ { "chme", "rw" },
-/* 0xbe */ { "chms", "rw" },
-/* 0xbf */ { "chmu", "rw" },
-
-/* 0xc0 */ { "addl2", "rl,ml" },
-/* 0xc1 */ { "addl3", "rl,rl,wl" },
-/* 0xc2 */ { "subl2", "rl,ml" },
-/* 0xc3 */ { "subl3", "rl,rl,wl" },
-/* 0xc4 */ { "mull2", "rl,ml" },
-/* 0xc5 */ { "mull3", "rl,rl,wl" },
-/* 0xc6 */ { "divl2", "rl,ml" },
-/* 0xc7 */ { "divl3", "rl,rl,wl" },
-/* 0xc8 */ { "bisl2", "rl,ml" },
-/* 0xc9 */ { "bisl3", "rl,rl,wl" },
-/* 0xca */ { "bicl2", "rl,ml" },
-/* 0xcb */ { "bicl3", "rl,rl,wl" },
-/* 0xcc */ { "xorl2", "rl,ml" },
-/* 0xcd */ { "xorl3", "rl,rl,wl" },
-/* 0xce */ { "mnegl", "rl,wl" },
-/* 0xcf */ { "casel", "rl,rl,rl,bw-list" },
-
-/* 0xd0 */ { "movl", "rl,wl" },
-/* 0xd1 */ { "cmpl", "rl,rl" },
-/* 0xd2 */ { "mcoml", "rl,wl" },
-/* 0xd3 */ { "bitl", "rl,rl" },
-/* 0xd4 */ { "*clrl", "wl" },
-/* 0xd5 */ { "tstl", "rl" },
-/* 0xd6 */ { "incl", "ml" },
-/* 0xd7 */ { "decl", "ml" },
-/* 0xd8 */ { "adwc", "rl,ml" },
-/* 0xd9 */ { "sbwc", "rl,ml" },
-/* 0xda */ { "mtpr", "rl,rl" },
-/* 0xdb */ { "mfpr", "rl,wl" },
-/* 0xdc */ { "movpsl", "wl" },
-/* 0xdd */ { "pushl", "rl" },
-/* 0xde */ { "*moval", "al,wl" },
-/* 0xdf */ { "*pushal", "al" },
-
-/* 0xe0 */ { "bbs", "rl,vb,bb" },
-/* 0xe1 */ { "bbc", "rl,vb,bb" },
-/* 0xe2 */ { "bbss", "rl,vb,bb" },
-/* 0xe3 */ { "bbcs", "rl,vb,bb" },
-/* 0xe4 */ { "bbsc", "rl,vb,bb" },
-/* 0xe5 */ { "bbcc", "rl,vb,bb" },
-/* 0xe6 */ { "bbssi", "rl,vb,bb" },
-/* 0xe7 */ { "bbcci", "rl,vb,bb" },
-/* 0xe8 */ { "blbs", "rl,bb" },
-/* 0xe9 */ { "blbc", "rl,bb" },
-/* 0xea */ { "ffs", "rl,rb,vb" },
-/* 0xeb */ { "ffc", "rl,rb,vb" },
-/* 0xec */ { "cmpv", "rl,rb,vb,rl" },
-/* 0xed */ { "cmpzv", "rl,rb,vb,rl" },
-/* 0xee */ { "extv", "rl,rb,vb,wl" },
-/* 0xef */ { "extzv", "rl,rb,vb,wl" },
-
-/* 0xf0 */ { "insv", "rl,rl,rb,vb" },
-/* 0xf1 */ { "acbl", "rl,rl,ml,bw" },
-/* 0xf2 */ { "aoblss", "rl,ml,bb" },
-/* 0xf3 */ { "aobleq", "rl,ml,bb" },
-/* 0xf4 */ { "sobgeq", "ml,bb" },
-/* 0xf5 */ { "sobgtr", "ml,bb" },
-/* 0xf6 */ { "cvtlb", "rl,wb" },
-/* 0xf7 */ { "cvtlw", "rl,ww" },
-/* 0xf8 */ { "ashp", "rb,rw,ab,rb,rw,ab" },
-/* 0xf9 */ { "cvtlp", "rl,rw,ab" },
-/* 0xfa */ { "callg", "ab,ab" },
-/* 0xfb */ { "calls", "rl,ab" },
-/* 0xfc */ { "xfc", "?" },
-/* 0xfd */ { "-two-byte-", NULL },
-/* 0xfe */ { "-two-byte-", NULL },
-/* 0xff */ { "-two-byte-", NULL },
-};
-
-/* two-byte instructions */
-vax_instr_t vax_inst2[0x56] = {
-/* reserved */ { NULL, NULL },
-/* 0xfd31 */ { NULL, NULL },
-/* 0xfd32 */ { "cvtdh", "rd,wh" },
-/* 0xfd33 */ { "cvtgf", "rg,wf" },
-/* 0xfd34 */ { NULL, NULL },
-/* 0xfd35 */ { NULL, NULL },
-/* 0xfd36 */ { NULL, NULL },
-/* 0xfd37 */ { NULL, NULL },
-/* 0xfd38 */ { NULL, NULL },
-/* 0xfd39 */ { NULL, NULL },
-/* 0xfd3a */ { NULL, NULL },
-/* 0xfd3b */ { NULL, NULL },
-/* 0xfd3c */ { NULL, NULL },
-/* 0xfd3d */ { NULL, NULL },
-/* 0xfd3e */ { NULL, NULL },
-/* 0xfd3f */ { NULL, NULL },
-
-/* 0xfd40 */ { "addg2", "rg,mg" },
-/* 0xfd41 */ { "addg3", "rg,rg,wg" },
-/* 0xfd42 */ { "subg2", "rg,mg" },
-/* 0xfd43 */ { "subg3", "rg,rg,wg" },
-/* 0xfd44 */ { "mulg2", "rg,mg" },
-/* 0xfd45 */ { "mulg3", "rg,rg,wg" },
-/* 0xfd46 */ { "divg2", "rg,mg" },
-/* 0xfd47 */ { "divg3", "rg,rg,wg" },
-/* 0xfd48 */ { "cvtgb", "rg,wb" },
-/* 0xfd49 */ { "cvtgw", "rg,ww" },
-/* 0xfd4a */ { "cvtgl", "rg,wl" },
-/* 0xfd4b */ { "cvtrgl", "rg,wl" },
-/* 0xfd4c */ { "cvtbg", "rb,wg" },
-/* 0xfd4d */ { "cvtwg", "rw,wg" },
-/* 0xfd4e */ { "cvtlg", "rl,wg" },
-/* 0xfd4f */ { "acbg", "rg,rg,mg,bg" },
-
-/* 0xfd50 */ { "movg", "rg,wg" },
-/* 0xfd51 */ { "cmpg", "rg,rg" },
-/* 0xfd52 */ { "mnegg", "rg,wg" },
-/* 0xfd53 */ { "tstg", "rg" },
-/* 0xfd54 */ { "emodg", "rg,rb,rg,wl,wg" },
-/* 0xfd55 */ { "polyg", "rg,rw,ab" },
-/* 0xfd56 */ { "cvtgh", "rg,wh" },
-/* 0xfd57 */ { NULL, NULL },
-/* 0xfd58 */ { NULL, NULL },
-/* 0xfd59 */ { NULL, NULL },
-/* 0xfd5a */ { NULL, NULL },
-/* 0xfd5b */ { NULL, NULL },
-/* 0xfd5c */ { NULL, NULL },
-/* 0xfd5d */ { NULL, NULL },
-/* 0xfd5e */ { NULL, NULL },
-/* 0xfd5f */ { NULL, NULL },
-
-/* 0xfd60 */ { "addh2", "rh,mh" },
-/* 0xfd61 */ { "addh3", "rh,rh,wh" },
-/* 0xfd62 */ { "subh2", "rh,mh" },
-/* 0xfd63 */ { "subh3", "rh,rh,wh" },
-/* 0xfd64 */ { "mulh2", "rh,mh" },
-/* 0xfd65 */ { "mulh3", "rh,rh,wh" },
-/* 0xfd66 */ { "divh2", "rh,mh" },
-/* 0xfd67 */ { "divh3", "rh,rh,wh" },
-/* 0xfd68 */ { "cvthb", "wh,rb" },
-/* 0xfd69 */ { "cvthw", "rh,ww" },
-/* 0xfd6a */ { "cvthl", "rh,wl" },
-/* 0xfd6b */ { "cvtrhl", "rh,wl" },
-/* 0xfd6c */ { "cvtbh", "rb,wh" },
-/* 0xfd6d */ { "cvtwh", "rw,wh" },
-/* 0xfd6e */ { "cvtlh", "rl,wh" },
-/* 0xfd6f */ { "acbh", "rh,rh,mh,bh" },
-
-/* 0xfd70 */ { "movh", "rh,wh" },
-/* 0xfd71 */ { "cmph", "rh,rh" },
-/* 0xfd72 */ { "mnegh", "rh,wh" },
-/* 0xfd73 */ { "tsth", "rh" },
-/* 0xfd74 */ { "emodh" "rh,rb,rh,wl,wh" },
-/* 0xfd75 */ { "polyh", "rh,rw,ab" },
-/* 0xfd76 */ { "cvthg", "rh,wg" },
-/* 0xfd77 */ { NULL, NULL },
-/* 0xfd78 */ { NULL, NULL },
-/* 0xfd79 */ { NULL, NULL },
-/* 0xfd7a */ { NULL, NULL },
-/* 0xfd7b */ { NULL, NULL },
-/* 0xfd7c */ { "clrh", "wh" },
-/* 0xfd7d */ { "movo", "ro,wo" },
-/* 0xfd7e */ { "*mova", "ao,wl" },
-/* 0xfd7f */ { "*pusha", "ao" },
-
-/* 0xfd98 */ { "cvtfh", "rf,wh" },
-/* 0xfd99 */ { "cvtfg", "rf,wg" },
-/* 0xfdf6 */ { "cvthf", "rh,wf" },
-/* 0xfdf7 */ { "cvthd", "rh,wd" },
-/* 0xfffd */ { "bugl", "bl" },
-/* 0xfffe */ { "bugw", "bw" },
-};
diff --git a/sys/arch/vax/vax/pmap.c b/sys/arch/vax/vax/pmap.c
deleted file mode 100644
index 22dddf72887..00000000000
--- a/sys/arch/vax/vax/pmap.c
+++ /dev/null
@@ -1,1697 +0,0 @@
-/* $OpenBSD: pmap.c,v 1.77 2015/06/17 17:15:07 miod Exp $ */
-/* $NetBSD: pmap.c,v 1.74 1999/11/13 21:32:25 matt Exp $ */
-/*
- * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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/types.h>
-#include <sys/param.h>
-#include <sys/queue.h>
-#include <sys/malloc.h>
-#include <sys/extent.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/msgbuf.h>
-#include <sys/pool.h>
-
-#ifdef PMAPDEBUG
-#include <dev/cons.h>
-#endif
-
-#include <uvm/uvm.h>
-
-#include <machine/pte.h>
-#include <machine/pcb.h>
-#include <machine/mtpr.h>
-#include <machine/macros.h>
-#include <machine/sid.h>
-#include <machine/cpu.h>
-#include <machine/scb.h>
-#include <machine/rpb.h>
-
-#define ISTACK_SIZE (NBPG * 2)
-vaddr_t istack;
-
-struct pmap kernel_pmap_store;
-
-pt_entry_t *Sysmap; /* System page table */
-u_int sysptsize;
-
-/*
- * Scratch pages usage:
- * Page 1: initial frame pointer during autoconfig. Stack and pcb for
- * processes during exit on boot CPU only.
- * Page 2: unused
- * Page 3: unused
- * Page 4: unused
- */
-vaddr_t scratch;
-#define SCRATCHPAGES 4
-
-vaddr_t iospace;
-
-vaddr_t ptemapstart, ptemapend;
-struct extent *ptemap;
-#define PTMAPSZ EXTENT_FIXED_STORAGE_SIZE(100)
-char ptmapstorage[PTMAPSZ];
-
-struct pool pmap_pmap_pool;
-struct pool pmap_ptp_pool;
-struct pool pmap_pv_pool;
-
-#define NPTEPG 0x80 /* # of PTEs per page (logical or physical) */
-#define PPTESZ sizeof(pt_entry_t)
-#define NPTEPERREG 0x200000
-
-#define SEGTYPE(x) (((vaddr_t)(x)) >> 30)
-#define P0SEG 0
-#define P1SEG 1
-#define SYSSEG 2
-
-#define USRPTSIZE ((MAXTSIZ + MAXDSIZ + BRKSIZ + MAXSSIZ) / VAX_NBPG)
-#define NPTEPGS (USRPTSIZE / (NBPG / (sizeof(pt_entry_t) * LTOHPN)))
-
-/* Mapping macros used when allocating SPT */
-#define MAPVIRT(ptr, count) \
-do { \
- ptr = virtual_avail; \
- virtual_avail += (count) * VAX_NBPG; \
-} while (0)
-
-#ifdef PMAPDEBUG
-volatile int recurse;
-#define RECURSESTART \
-do { \
- if (recurse) \
- printf("enter at %d, previous %d\n", __LINE__, recurse);\
- recurse = __LINE__; \
-} while (0)
-#define RECURSEEND \
-do { \
- recurse = 0; \
-} while (0)
-int startpmapdebug = 0;
-#define PMDEBUG(x) if (startpmapdebug) printf x
-#else
-#define RECURSESTART
-#define RECURSEEND
-#define PMDEBUG(x)
-#endif
-
-vsize_t calc_kvmsize(vsize_t);
-u_long pmap_extwrap(vsize_t);
-void rmpage(struct pmap *, pt_entry_t *);
-void update_pcbs(struct pmap *);
-void rmspace(struct pmap *);
-int pmap_rmproc(struct pmap *);
-vaddr_t pmap_getusrptes(struct pmap *, vsize_t, int);
-void rmptep(pt_entry_t *);
-boolean_t grow_p0(struct pmap *, u_long, int);
-boolean_t grow_p1(struct pmap *, u_long, int);
-pt_entry_t *vaddrtopte(const struct pv_entry *pv);
-void pmap_remove_pcb(struct pmap *, struct pcb *);
-
-/*
- * Map in a virtual page.
- */
-static inline void
-mapin8(pt_entry_t *ptep, pt_entry_t pte)
-{
- ptep[0] = pte;
- ptep[1] = pte + 1;
- ptep[2] = pte + 2;
- ptep[3] = pte + 3;
- ptep[4] = pte + 4;
- ptep[5] = pte + 5;
- ptep[6] = pte + 6;
- ptep[7] = pte + 7;
-}
-
-/*
- * Check if page table page is in use.
- */
-static inline int
-ptpinuse(pt_entry_t *pte)
-{
- pt_entry_t *pve = (pt_entry_t *)vax_trunc_page(pte);
- uint i;
-
- for (i = 0; i < NPTEPG; i += LTOHPN)
- if (pve[i] != PG_NV)
- return 1;
- return 0;
-}
-
-vaddr_t avail_start, avail_end;
-vaddr_t virtual_avail, virtual_end; /* Available virtual memory */
-
-#define get_pventry() (struct pv_entry *)pool_get(&pmap_pv_pool, PR_NOWAIT)
-#define free_pventry(pv) pool_put(&pmap_pv_pool, (void *)pv)
-
-static inline
-paddr_t
-get_ptp(boolean_t waitok)
-{
- pt_entry_t *ptp;
-
- ptp = (pt_entry_t *)pool_get(&pmap_ptp_pool,
- PR_ZERO | (waitok ? PR_WAITOK : PR_NOWAIT));
- if (ptp == NULL)
- return 0;
- return ((paddr_t)ptp) & ~KERNBASE;
-}
-
-#define free_ptp(pa) pool_put(&pmap_ptp_pool, (void *)(pa | KERNBASE))
-
-/*
- * Calculation of the System Page Table is somewhat a pain, because it
- * must be in contiguous physical memory and all size calculations must
- * be done before memory management is turned on.
- * Arg is usrptsize in ptes.
- */
-vsize_t
-calc_kvmsize(vsize_t usrptsize)
-{
- vsize_t kvmsize;
-
- /*
- * Compute the number of pages kmem_map will have.
- */
- kmeminit_nkmempages();
-
- /* All physical memory (reverse mapping struct) */
- kvmsize = avail_end;
- /* User Page table area. This may be large */
- kvmsize += usrptsize * sizeof(pt_entry_t);
- /* Kernel stacks per process */
- kvmsize += USPACE * maxthread;
- /* kernel malloc arena */
- kvmsize += nkmempages * PAGE_SIZE;
- /* IO device register space */
- kvmsize += IOSPSZ * VAX_NBPG;
- /* Pager allocations */
- kvmsize += PAGER_MAP_SIZE;
- /* kernel malloc arena */
- kvmsize += avail_end;
-
- /* Exec arg space */
- kvmsize += 16 * NCARGS;
-#if VAX46 || VAX48 || VAX49 || VAX53 || VAX60
- /* Physmap */
- kvmsize += VM_PHYS_SIZE;
-#endif
-
- return round_page(kvmsize);
-}
-
-/*
- * pmap_bootstrap().
- * Called as part of vm bootstrap, allocates internal pmap structures.
- * Assumes that nothing is mapped, and that kernel stack is located
- * immediately after end.
- */
-void
-pmap_bootstrap()
-{
- unsigned int i;
- extern unsigned int etext, proc0paddr;
- struct pcb *pcb = (struct pcb *)proc0paddr;
- struct pmap *pmap = pmap_kernel();
- vsize_t kvmsize, usrptsize, minusrptsize;
-
- /* Set logical page size */
- uvmexp.pagesize = NBPG;
- uvm_setpagesize();
-
- /*
- * Compute how much page table space a process reaching all its
- * limits would need. Try to afford four times such this space,
- * but try and limit ourselves to 5% of the free memory.
- */
- minusrptsize = (MAXTSIZ + MAXDSIZ + BRKSIZ + MAXSSIZ) / VAX_NBPG;
- usrptsize = 4 * minusrptsize;
- if (vax_btop(usrptsize * PPTESZ) > avail_end / 20)
- usrptsize = (avail_end / (20 * PPTESZ)) * VAX_NBPG;
- if (usrptsize < minusrptsize)
- usrptsize = minusrptsize;
-
- kvmsize = calc_kvmsize(usrptsize);
- sysptsize = vax_btop(kvmsize);
-
- /*
- * Virtual_* and avail_* is used for mapping of system page table.
- * The need for kernel virtual memory is linear dependent of the
- * amount of physical memory also, therefore sysptsize is
- * a variable here that is changed dependent of the physical
- * memory size.
- */
- virtual_avail = avail_end + KERNBASE;
- virtual_end = KERNBASE + sysptsize * VAX_NBPG;
- /* clear SPT before using it */
- memset(Sysmap, 0, sysptsize * sizeof(pt_entry_t));
-
- /*
- * The first part of Kernel Virtual memory is the physical
- * memory mapped in. This makes some mm routines both simpler
- * and faster, but takes ~0.75% more memory.
- */
- pmap_map(KERNBASE, 0, avail_end, PROT_READ | PROT_WRITE);
-
- /* make sure kernel text is read-only */
- for (i = 0; i < ((unsigned)&etext & ~KERNBASE) >> VAX_PGSHIFT; i++)
- Sysmap[i] = (Sysmap[i] & ~PG_PROT) | PG_KR;
-
- /* Map System Page Table and zero it, Sysmap already set. */
- mtpr((vaddr_t)Sysmap - KERNBASE, PR_SBR);
-
- /* Map Interrupt stack and set red zone */
- istack = (vaddr_t)Sysmap + round_page(sysptsize * sizeof(pt_entry_t));
- mtpr(istack + ISTACK_SIZE, PR_ISP);
- *kvtopte(istack) &= ~PG_V;
-
- /* Some scratch pages */
- scratch = istack + ISTACK_SIZE;
-
- avail_start = (vaddr_t)(scratch + SCRATCHPAGES * VAX_NBPG) - KERNBASE;
-
- /* Kernel message buffer */
- avail_end -= round_page(MSGBUFSIZE);
- msgbufp = (void *)(avail_end + KERNBASE);
- msgbufp->msg_magic = MSG_MAGIC-1; /* ensure that it will be zeroed */
-
- /* zero all mapped physical memory from Sysmap to here */
- memset((void *)istack, 0, (avail_start + KERNBASE) - istack);
-
- /* User page table map. This is big. */
- MAPVIRT(ptemapstart, vax_atop(usrptsize * sizeof(pt_entry_t)));
- ptemapend = virtual_avail;
-
- MAPVIRT(iospace, IOSPSZ); /* Device iospace mapping area */
-
- /* Init SCB and set up stray vectors. */
- avail_start = scb_init(avail_start);
- bcopy((caddr_t)proc0paddr + REDZONEADDR, 0, sizeof(struct rpb));
-
- if (dep_call->cpu_init)
- (*dep_call->cpu_init)();
-
- avail_start = round_page(avail_start);
- virtual_avail = round_page(virtual_avail);
- virtual_end = trunc_page(virtual_end);
-
-
-#if 0 /* Breaks cninit() on some machines */
- cninit();
- printf("Sysmap %p, istack %p, scratch %p\n", Sysmap, istack, scratch);
- printf("etext %p\n", &etext);
- printf("SYSPTSIZE %x usrptsize %lx\n",
- sysptsize, usrptsize * sizeof(pt_entry_t));
- printf("ptemapstart %lx ptemapend %lx\n", ptemapstart, ptemapend);
- printf("avail_start %lx, avail_end %lx\n", avail_start, avail_end);
- printf("virtual_avail %lx,virtual_end %lx\n",
- virtual_avail, virtual_end);
- printf("startpmapdebug %p\n",&startpmapdebug);
-#endif
-
- /* Init kernel pmap */
- pmap->pm_p1br = (pt_entry_t *)KERNBASE;
- pmap->pm_p0br = (pt_entry_t *)KERNBASE;
- pmap->pm_p1lr = NPTEPERREG;
- pmap->pm_p0lr = 0;
- pmap->pm_stats.wired_count = pmap->pm_stats.resident_count = 0;
- /* btop(virtual_avail - KERNBASE); */
-
- pmap->pm_count = 1;
-
- /* Activate the kernel pmap. */
- pcb->P1BR = pmap->pm_p1br;
- pcb->P0BR = pmap->pm_p0br;
- pcb->P1LR = pmap->pm_p1lr;
- pcb->P0LR = pmap->pm_p0lr | AST_PCB;
- pcb->pcb_pm = pmap;
- pcb->pcb_pmnext = pmap->pm_pcbs;
- pmap->pm_pcbs = pcb;
- mtpr((register_t)pcb->P1BR, PR_P1BR);
- mtpr((register_t)pcb->P0BR, PR_P0BR);
- mtpr(pcb->P1LR, PR_P1LR);
- mtpr(pcb->P0LR, PR_P0LR);
-
- /* Create the pmap, ptp and pv_entry pools. */
- pool_init(&pmap_pmap_pool, sizeof(struct pmap), 0, 0, 0,
- "pmap_pool", NULL);
- pool_init(&pmap_ptp_pool, VAX_NBPG, 0, 0, 0, "ptp_pool", NULL);
- pool_init(&pmap_pv_pool, sizeof(struct pv_entry), 0, 0, 0,
- "pv_pool", NULL);
-
- /*
- * Now everything should be complete, start virtual memory.
- */
- uvm_page_physload(atop(avail_start), atop(avail_end),
- atop(avail_start), atop(avail_end), 0);
- mtpr(sysptsize, PR_SLR);
- rpb.sbr = mfpr(PR_SBR);
- rpb.slr = mfpr(PR_SLR);
- mtpr(1, PR_MAPEN);
-}
-
-void
-pmap_virtual_space(vaddr_t *vstartp, vaddr_t *vendp)
-{
- *vstartp = virtual_avail;
- *vendp = virtual_end;
-}
-
-/*
- * Let the VM system do early memory allocation from the direct-mapped
- * physical memory instead.
- */
-vaddr_t
-pmap_steal_memory(vsize_t size, vaddr_t *vstartp, vaddr_t *vendp)
-{
- vaddr_t v;
- int npgs;
-
- PMDEBUG(("pmap_steal_memory: size 0x%lx start %p end %p\n",
- size, vstartp, vendp));
-
- size = round_page(size);
- npgs = atop(size);
-
-#ifdef DIAGNOSTIC
- if (uvm.page_init_done == TRUE)
- panic("pmap_steal_memory: called _after_ bootstrap");
-#endif
-
- /*
- * A vax only has one segment of memory.
- */
-
- v = (vm_physmem[0].avail_start << PAGE_SHIFT) | KERNBASE;
- vm_physmem[0].avail_start += npgs;
- vm_physmem[0].start += npgs;
- if (vstartp)
- *vstartp = virtual_avail;
- if (vendp)
- *vendp = virtual_end;
- bzero((caddr_t)v, size);
- return v;
-}
-
-/*
- * pmap_init() is called as part of vm init after memory management
- * is enabled. It is meant to do machine-specific allocations.
- * The extent for the user page tables is initialized here.
- */
-void
-pmap_init()
-{
- /*
- * Create the extent map used to manage the page table space.
- */
- ptemap = extent_create("ptemap", ptemapstart, ptemapend,
- M_VMPMAP, ptmapstorage, PTMAPSZ, EX_NOCOALESCE);
- if (ptemap == NULL)
- panic("pmap_init");
-}
-
-u_long
-pmap_extwrap(vsize_t nsize)
-{
- int res;
- u_long rv;
-
- for (;;) {
- res = extent_alloc(ptemap, nsize, PAGE_SIZE, 0, 0,
- EX_WAITOK | EX_MALLOCOK, &rv);
- if (res == 0)
- return rv;
- if (res == EAGAIN)
- return 0;
- }
-}
-
-/*
- * Do a page removal from the pv list. A page is identified by its
- * virtual address combined with its struct pmap in the page's pv list.
- */
-void
-rmpage(struct pmap *pm, pt_entry_t *br)
-{
- struct pv_entry *pv, *pl, *pf;
- vaddr_t vaddr;
- struct vm_page *pg;
- int s, found = 0;
-
- /*
- * Check that we are working on a managed page.
- */
- pg = PHYS_TO_VM_PAGE((*br & PG_FRAME) << VAX_PGSHIFT);
- if (pg == NULL)
- return;
-
- if (pm == pmap_kernel()) {
-#ifdef DIAGNOSTIC
- if (br - Sysmap >= sysptsize)
- panic("%s: bogus Sysmap pte pointer %p", __func__, br);
-#endif
- vaddr = (br - Sysmap) * VAX_NBPG + 0x80000000;
- } else if (br >= pm->pm_p0br && br < pm->pm_p0br + pm->pm_p0lr)
- vaddr = (br - pm->pm_p0br) * VAX_NBPG;
- else {
- vaddr = (br - pm->pm_p1br) * VAX_NBPG + 0x40000000;
-#ifdef DIAGNOSTIC
- if (vaddr < 0x40000000 || vaddr >= 0x80000000)
- panic("%s: bogus pmap %p P1 pte pointer %p", __func__, pm, br);
-#endif
- }
-
- s = splvm();
- for (pl = NULL, pv = pg->mdpage.pv_head; pv != NULL; pl = pv, pv = pf) {
- pf = pv->pv_next;
- if (pv->pv_pmap == pm && pv->pv_va == vaddr) {
- if ((pg->mdpage.pv_attr & (PG_V|PG_M)) != (PG_V|PG_M)) {
- switch (br[0] & PG_PROT) {
- case PG_URKW:
- case PG_KW:
- case PG_RW:
- pg->mdpage.pv_attr |=
- br[0] | br[1] | br[2] | br[3] |
- br[4] | br[5] | br[6] | br[7];
- break;
- }
- }
- if (pf != NULL) {
- *pv = *pf;
- free_pventry(pf);
- } else {
- if (pl != NULL)
- pl->pv_next = pv->pv_next;
- else
- pg->mdpage.pv_head = NULL;
- free_pventry(pv);
- }
- found++;
- break;
- }
- }
- splx(s);
- if (found == 0)
- panic("rmpage: pg %p br %p", pg, br);
-}
-
-/*
- * Update the PCBs using this pmap after a change.
- */
-void
-update_pcbs(struct pmap *pm)
-{
- struct pcb *pcb;
-
- PMDEBUG(("update_pcbs pm %p\n", pm));
-
- for (pcb = pm->pm_pcbs; pcb != NULL; pcb = pcb->pcb_pmnext) {
- KASSERT(pcb->pcb_pm == pm);
- pcb->P0BR = pm->pm_p0br;
- pcb->P0LR = pm->pm_p0lr | AST_PCB;
- pcb->P1BR = pm->pm_p1br;
- pcb->P1LR = pm->pm_p1lr;
- }
-
- /* If curproc uses this pmap update the regs too */
- if (pm == curproc->p_vmspace->vm_map.pmap) {
- PMDEBUG(("update_pcbs: %08x %08x %08x %08x\n",
- pm->pm_p0br, pm->pm_p0lr, pm->pm_p1br, pm->pm_p1lr));
- mtpr((register_t)pm->pm_p0br, PR_P0BR);
- mtpr(pm->pm_p0lr | AST_PCB, PR_P0LR);
- mtpr((register_t)pm->pm_p1br, PR_P1BR);
- mtpr(pm->pm_p1lr, PR_P1LR);
- }
-}
-
-/*
- * Remove a full process space. Update all processes pcbs.
- */
-void
-rmspace(struct pmap *pm)
-{
- u_long lr, i, j;
- pt_entry_t *ptpp, *br;
- int s;
-
- if (pm->pm_p0lr == 0 && pm->pm_p1lr == NPTEPERREG)
- return; /* Already free */
-
- lr = pm->pm_p0lr / NPTEPG;
- for (i = 0; i < lr; i++) {
- ptpp = kvtopte((vaddr_t)&pm->pm_p0br[i * NPTEPG]);
- if (*ptpp == PG_NV)
- continue;
- br = &pm->pm_p0br[i * NPTEPG];
- for (j = 0; j < NPTEPG; j += LTOHPN) {
- if (br[j] == 0)
- continue;
- rmpage(pm, &br[j]);
- }
- free_ptp((*ptpp & PG_FRAME) << VAX_PGSHIFT);
- *ptpp = PG_NV;
- }
- lr = pm->pm_p1lr / NPTEPG;
- for (i = lr; i < NPTEPERREG / NPTEPG; i++) {
- ptpp = kvtopte((vaddr_t)&pm->pm_p1br[i * NPTEPG]);
- if (*ptpp == PG_NV)
- continue;
- br = &pm->pm_p1br[i * NPTEPG];
- for (j = 0; j < NPTEPG; j += LTOHPN) {
- if (br[j] == 0)
- continue;
- rmpage(pm, &br[j]);
- }
- free_ptp((*ptpp & PG_FRAME) << VAX_PGSHIFT);
- *ptpp = PG_NV;
- }
-
- s = splsched();
-
- if (pm->pm_p0lr != 0)
- extent_free(ptemap, (u_long)pm->pm_p0br,
- pm->pm_p0lr * PPTESZ, EX_WAITOK);
- if (pm->pm_p1lr != NPTEPERREG)
- extent_free(ptemap, (u_long)pm->pm_p1ap,
- (NPTEPERREG - pm->pm_p1lr) * PPTESZ, EX_WAITOK);
- pm->pm_p0br = pm->pm_p1br = (pt_entry_t *)KERNBASE;
- pm->pm_p0lr = 0;
- pm->pm_p1lr = NPTEPERREG;
- pm->pm_p1ap = NULL;
- update_pcbs(pm);
-
- splx(s);
-}
-
-/*
- * Find a process to remove the process space for. *sigh*
- * Avoid to remove ourselves. Logic is designed after uvm_swapout_threads().
- */
-
-int
-pmap_rmproc(struct pmap *pm)
-{
- struct process *pr, *outpr;
- struct pmap *ppm;
- struct proc *p, *slpp;
- int outpri;
- int didswap = 0;
- extern int maxslp;
-
- outpr = NULL;
- outpri = 0;
- LIST_FOREACH(pr, &allprocess, ps_list) {
- if (pr->ps_flags & (PS_SYSTEM | PS_EXITING))
- continue;
- ppm = pr->ps_vmspace->vm_map.pmap;
- if (ppm == pm) /* Don't swap ourself */
- continue;
- if (ppm->pm_p0lr == 0 && ppm->pm_p1lr == NPTEPERREG)
- continue; /* Already swapped */
-
- /*
- * slpp: the sleeping or stopped thread in pr with
- * the smallest p_slptime
- */
- slpp = NULL;
- TAILQ_FOREACH(p, &pr->ps_threads, p_thr_link) {
- switch (p->p_stat) {
- case SRUN:
- case SONPROC:
- goto next_process;
-
- case SSLEEP:
- case SSTOP:
- if (slpp == NULL ||
- slpp->p_slptime < p->p_slptime)
- slpp = p;
- continue;
- }
- }
- if (slpp != NULL) {
- if (slpp->p_slptime >= maxslp) {
- rmspace(ppm);
- didswap++;
- } else if (slpp->p_slptime > outpri) {
- outpr = pr;
- outpri = slpp->p_slptime;
- }
- }
- if (didswap)
- break;
-next_process: ;
- }
-
- if (didswap == 0 && outpr != NULL) {
- rmspace(outpr->ps_vmspace->vm_map.pmap);
- didswap++;
- }
- return didswap;
-}
-
-/*
- * Allocate space for user page tables, from ptemap.
- * If the map is full then:
- * 1) Remove processes idle for more than 20 seconds or stopped.
- * 2) Remove processes idle for less than 20 seconds.
- *
- * Argument is needed space, in bytes.
- * Returns a pointer to the newly allocated space, or zero if space could not
- * be allocated and failure is allowed. Panics otherwise.
- */
-vaddr_t
-pmap_getusrptes(struct pmap *pm, vsize_t nsize, int canfail)
-{
- u_long rv;
-
-#ifdef DEBUG
- if (nsize & PAGE_MASK)
- panic("pmap_getusrptes: bad size %lx", nsize);
-#endif
- for (;;) {
- rv = pmap_extwrap(nsize);
- if (rv != 0)
- return rv;
- if (pmap_rmproc(pm) == 0) {
- if (canfail)
- return 0;
- else
- panic("out of space in usrptmap");
- }
- }
-}
-
-/*
- * Remove a pte page when all references are gone.
- */
-void
-rmptep(pt_entry_t *pte)
-{
- pt_entry_t *ptpp = kvtopte((vaddr_t)pte);
-
- PMDEBUG(("rmptep: pte %p -> ptpp %p\n", pte, ptpp));
-
-#ifdef DEBUG
- {
- int i;
- pt_entry_t *ptr = (pt_entry_t *)vax_trunc_page(pte);
- for (i = 0; i < NPTEPG; i++)
- if (ptr[i] != 0)
- panic("rmptep: ptr[%d] != 0", i);
- }
-#endif
-
- free_ptp((*ptpp & PG_FRAME) << VAX_PGSHIFT);
- *ptpp = PG_NV;
-}
-
-boolean_t
-grow_p0(struct pmap *pm, u_long reqlen, int canfail)
-{
- vaddr_t nptespc;
- pt_entry_t *from, *to;
- size_t srclen, dstlen;
- u_long p0br, p0lr, len;
- int inuse;
- int s;
-
- PMDEBUG(("grow_p0: pmap %p reqlen %x\n", pm, reqlen));
-
- /* Get new pte space */
- p0lr = pm->pm_p0lr;
- inuse = p0lr != 0;
- len = round_page((reqlen + 1) * PPTESZ);
- RECURSEEND;
- nptespc = pmap_getusrptes(pm, len, canfail);
- if (nptespc == 0)
- return FALSE;
- RECURSESTART;
-
- s = splsched();
-
- /*
- * Copy the old ptes to the new space.
- * Done by moving on system page table.
- */
- srclen = vax_btop(p0lr * PPTESZ) * PPTESZ;
- dstlen = vax_atop(len) * PPTESZ;
- from = kvtopte((vaddr_t)pm->pm_p0br);
- to = kvtopte(nptespc);
-
- PMDEBUG(("grow_p0: from %p to %p src %x dst %x\n",
- from, to, srclen, dstlen));
-
- if (inuse)
- memcpy(to, from, srclen);
- bzero((char *)to + srclen, dstlen - srclen);
-
- p0br = (u_long)pm->pm_p0br;
- pm->pm_p0br = (pt_entry_t *)nptespc;
- pm->pm_p0lr = len / PPTESZ;
- update_pcbs(pm);
-
- splx(s);
-
- if (inuse)
- extent_free(ptemap, p0br, p0lr * PPTESZ, EX_WAITOK);
-
- return TRUE;
-}
-
-boolean_t
-grow_p1(struct pmap *pm, u_long len, int canfail)
-{
- vaddr_t nptespc, optespc;
- pt_entry_t *from, *to;
- size_t nlen, olen;
- int s;
-
- PMDEBUG(("grow_p1: pm %p len %x\n", pm, len));
-
- /* Get new pte space */
- nlen = (NPTEPERREG * PPTESZ) - trunc_page(len * PPTESZ);
- RECURSEEND;
- nptespc = pmap_getusrptes(pm, nlen, canfail);
- if (nptespc == 0)
- return FALSE;
- RECURSESTART;
-
- s = splsched();
-
- olen = (NPTEPERREG - pm->pm_p1lr) * PPTESZ;
- optespc = (vaddr_t)pm->pm_p1ap;
-
- /*
- * Copy the old ptes to the new space.
- * Done by moving on system page table.
- */
- from = kvtopte(optespc);
- to = kvtopte(nptespc);
-
- PMDEBUG(("grow_p1: from %p to %p src %x dst %x\n",
- from, to, vax_btop(olen), vax_btop(nlen)));
-
- bzero(to, vax_btop(nlen - olen) * PPTESZ);
- if (optespc)
- memcpy(kvtopte(nptespc + nlen - olen), from,
- vax_btop(olen) * PPTESZ);
-
- pm->pm_p1ap = (pt_entry_t *)nptespc;
- pm->pm_p1br = (pt_entry_t *)(nptespc + nlen - (NPTEPERREG * PPTESZ));
- pm->pm_p1lr = NPTEPERREG - nlen / PPTESZ;
- update_pcbs(pm);
-
- splx(s);
-
- if (optespc)
- extent_free(ptemap, optespc, olen, EX_WAITOK);
-
- return TRUE;
-}
-
-/*
- * pmap_create() creates a pmap for a new task.
- */
-struct pmap *
-pmap_create()
-{
- struct pmap *pmap;
-
- pmap = pool_get(&pmap_pmap_pool, PR_WAITOK | PR_ZERO);
-
- /*
- * Do not allocate any pte's here, we don't know the size and
- * we'll get a page fault anyway when some page is referenced,
- * so defer until then.
- */
- pmap->pm_p0br = pmap->pm_p1br = (pt_entry_t *)KERNBASE;
- pmap->pm_p0lr = 0;
- pmap->pm_p1lr = NPTEPERREG;
- pmap->pm_p1ap = NULL;
-
- PMDEBUG(("pmap_create: pmap %p p0br=%p p0lr=0x%lx p1br=%p p1lr=0x%lx\n",
- pmap, pmap->pm_p0br, pmap->pm_p0lr, pmap->pm_p1br, pmap->pm_p1lr));
-
- pmap->pm_count = 1;
- /* pmap->pm_stats.resident_count = pmap->pm_stats.wired_count = 0; */
-
- return pmap;
-}
-
-void
-pmap_remove_holes(struct vmspace *vm)
-{
- struct vm_map *map = &vm->vm_map;
- struct pmap *pmap = map->pmap;
- vaddr_t shole, ehole;
-
- if (pmap == pmap_kernel()) /* can of worms */
- return;
-
- shole = MAXTSIZ + MAXDSIZ + BRKSIZ;
- ehole = (vaddr_t)vm->vm_maxsaddr;
- shole = max(vm_map_min(map), shole);
- ehole = min(vm_map_max(map), ehole);
-
- if (ehole <= shole)
- return;
-
- (void)uvm_map(map, &shole, ehole - shole, NULL, UVM_UNKNOWN_OFFSET, 0,
- UVM_MAPFLAG(PROT_NONE, PROT_NONE, MAP_INHERIT_SHARE, MADV_RANDOM,
- UVM_FLAG_NOMERGE | UVM_FLAG_HOLE | UVM_FLAG_FIXED));
-}
-
-void
-pmap_unwire(struct pmap *pmap, vaddr_t va)
-{
- pt_entry_t *pte;
- uint i;
-
- RECURSESTART;
- if (va & KERNBASE) {
- pte = Sysmap;
- i = vax_btop(va - KERNBASE);
- } else {
- if (va < 0x40000000)
- pte = pmap->pm_p0br;
- else
- pte = pmap->pm_p1br;
- i = PG_PFNUM(va);
- }
-
- pte[i] &= ~PG_W;
- RECURSEEND;
- pmap->pm_stats.wired_count--;
-}
-
-/*
- * pmap_destroy(pmap): Remove a reference from the pmap.
- * If this was the last reference, release all its resources.
- */
-void
-pmap_destroy(struct pmap *pmap)
-{
- int count;
-#ifdef DEBUG
- vaddr_t saddr, eaddr;
-#endif
-
- PMDEBUG(("pmap_destroy: pmap %p\n",pmap));
-
- count = --pmap->pm_count;
- if (count != 0)
- return;
-
-#ifdef DIAGNOSTIC
- if (pmap->pm_pcbs)
- panic("pmap_destroy used pmap");
-#endif
-
- if (pmap->pm_p0br != 0) {
-#ifdef DEBUG
- saddr = (vaddr_t)pmap->pm_p0br;
- eaddr = saddr + pmap->pm_p0lr * PPTESZ;
- for (; saddr < eaddr; saddr += PAGE_SIZE)
- if ((*kvtopte(saddr) & PG_FRAME) != 0)
- panic("pmap_release: P0 page mapped");
- saddr = (vaddr_t)pmap->pm_p1br + pmap->pm_p1lr * PPTESZ;
- eaddr = VM_MAXUSER_ADDRESS;
- for (; saddr < eaddr; saddr += PAGE_SIZE)
- if ((*kvtopte(saddr) & PG_FRAME) != 0)
- panic("pmap_release: P1 page mapped");
-#endif
- }
-
- if (pmap->pm_p0lr != 0)
- extent_free(ptemap, (u_long)pmap->pm_p0br,
- pmap->pm_p0lr * PPTESZ, EX_WAITOK);
- if (pmap->pm_p1lr != NPTEPERREG)
- extent_free(ptemap, (u_long)pmap->pm_p1ap,
- (NPTEPERREG - pmap->pm_p1lr) * PPTESZ, EX_WAITOK);
-
- pool_put(&pmap_pmap_pool, pmap);
-}
-
-pt_entry_t *
-vaddrtopte(const struct pv_entry *pv)
-{
- struct pmap *pm;
-
- if (pv->pv_va & KERNBASE)
- return &Sysmap[(pv->pv_va & ~KERNBASE) >> VAX_PGSHIFT];
- pm = pv->pv_pmap;
- if (pv->pv_va & 0x40000000)
- return &pm->pm_p1br[vax_btop(pv->pv_va & ~0x40000000)];
- else
- return &pm->pm_p0br[vax_btop(pv->pv_va)];
-}
-
-/*
- * New (real nice!) function that allocates memory in kernel space
- * without tracking it in the MD code.
- */
-void
-pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot)
-{
- pt_entry_t *ptp, opte;
-
- ptp = kvtopte(va);
-
- PMDEBUG(("pmap_kenter_pa: va: %lx, pa %lx, prot %x ptp %p\n",
- va, pa, prot, ptp));
-
- opte = ptp[0];
- if ((opte & PG_FRAME) == 0) {
- pmap_kernel()->pm_stats.resident_count++;
- pmap_kernel()->pm_stats.wired_count++;
- }
- mapin8(ptp, PG_V | ((prot & PROT_WRITE) ? PG_KW : PG_KR) |
- PG_PFNUM(pa) | PG_W | PG_SREF);
- if (opte & PG_V) {
- mtpr(0, PR_TBIA);
- }
-}
-
-void
-pmap_kremove(vaddr_t va, vsize_t len)
-{
- pt_entry_t *pte;
-#ifdef PMAPDEBUG
- int i;
-#endif
-
- PMDEBUG(("pmap_kremove: va: %lx, len %lx, ptp %p\n",
- va, len, kvtopte(va)));
-
- pte = kvtopte(va);
-
-#ifdef PMAPDEBUG
- /*
- * Check if any pages are on the pv list.
- * This shouldn't happen anymore.
- */
- len >>= PAGE_SHIFT;
- for (i = 0; i < len; i++) {
- if ((*pte & PG_FRAME) == 0)
- continue;
- pmap_kernel()->pm_stats.resident_count--;
- pmap_kernel()->pm_stats.wired_count--;
- if ((*pte & PG_SREF) == 0)
- panic("pmap_kremove");
- bzero(pte, LTOHPN * sizeof(pt_entry_t));
- pte += LTOHPN;
- }
-#else
- len >>= PAGE_SHIFT;
- pmap_kernel()->pm_stats.resident_count -= len;
- pmap_kernel()->pm_stats.wired_count -= len;
- bzero(pte, len * LTOHPN * sizeof(pt_entry_t));
-#endif
- mtpr(0, PR_TBIA);
-}
-
-/*
- * pmap_enter() is the main routine that puts in mappings for pages, or
- * upgrades mappings to more "rights".
- */
-int
-pmap_enter(struct pmap *pmap, vaddr_t v, paddr_t p, vm_prot_t prot, int flags)
-{
- struct pv_entry *pv;
- struct vm_page *pg;
- pt_entry_t newpte, oldpte;
- pt_entry_t *pteptr; /* current pte to write mapping info to */
- pt_entry_t *ptpptr; /* ptr to page table page */
- u_long pteidx;
- int s;
-
- PMDEBUG(("pmap_enter: pmap %p v %lx p %lx prot %x wired %d flags %x\n",
- pmap, v, p, prot, (flags & PMAP_WIRED) != 0, flags));
-
- RECURSESTART;
-
- /* Find address of correct pte */
- switch (SEGTYPE(v)) {
- case SYSSEG:
- pteptr = Sysmap + vax_btop(v - KERNBASE);
- newpte = prot & PROT_WRITE ? PG_KW : PG_KR;
- break;
- case P0SEG:
- pteidx = vax_btop(v);
- if (pteidx >= pmap->pm_p0lr) {
- if (!grow_p0(pmap, pteidx, flags & PMAP_CANFAIL))
- return ENOMEM;
- }
- pteptr = pmap->pm_p0br + pteidx;
- newpte = prot & PROT_WRITE ? PG_RW : PG_RO;
- break;
- case P1SEG:
- pteidx = vax_btop(v - 0x40000000);
- if (pteidx < pmap->pm_p1lr) {
- if (!grow_p1(pmap, pteidx, flags & PMAP_CANFAIL))
- return ENOMEM;
- }
- pteptr = pmap->pm_p1br + pteidx;
- newpte = prot & PROT_WRITE ? PG_RW : PG_RO;
- break;
- default:
- panic("bad seg");
- }
- newpte |= vax_btop(p);
-
- if (SEGTYPE(v) != SYSSEG) {
- /*
- * Check if a pte page must be mapped in.
- */
- ptpptr = kvtopte((vaddr_t)pteptr);
-
- if (*ptpptr == PG_NV) {
- paddr_t pa;
-
- pa = get_ptp((flags & PMAP_CANFAIL) != 0);
- if (pa == 0) {
- RECURSEEND;
- return ENOMEM;
- }
- *ptpptr = PG_V | PG_KW | PG_PFNUM(pa);
- }
- }
-
- /*
- * Do not keep track of anything if mapping IO space.
- */
- pg = PHYS_TO_VM_PAGE(p);
- if (pg == NULL) {
- mapin8(pteptr, newpte);
- RECURSEEND;
- return 0;
- }
-
- if (flags & PMAP_WIRED)
- newpte |= PG_W;
-
- oldpte = *pteptr & ~(PG_V | PG_M);
-
- /* just a wiring change ? */
- if ((newpte ^ oldpte) == PG_W) {
- if (flags & PMAP_WIRED) {
- pmap->pm_stats.wired_count++;
- *pteptr |= PG_W;
- } else {
- pmap->pm_stats.wired_count--;
- *pteptr &= ~PG_W;
- }
- RECURSEEND;
- return 0;
- }
-
- /* mapping unchanged? just return. */
- if (newpte == oldpte) {
- RECURSEEND;
- return 0;
- }
-
- /* Changing mapping? */
- if ((newpte & PG_FRAME) == (oldpte & PG_FRAME)) {
- /* protection change. */
-#if 0 /* done below */
- mtpr(0, PR_TBIA);
-#endif
- } else {
- /*
- * Mapped before? Remove it then.
- */
- if (oldpte & PG_FRAME) {
- pmap->pm_stats.resident_count--;
- if (oldpte & PG_W)
- pmap->pm_stats.wired_count--;
- RECURSEEND;
- if ((oldpte & PG_SREF) == 0)
- rmpage(pmap, pteptr);
- else
- panic("pmap_enter on PG_SREF page");
- RECURSESTART;
- }
-
- s = splvm();
- pv = get_pventry();
- if (pv == NULL) {
- if (flags & PMAP_CANFAIL) {
- splx(s);
- RECURSEEND;
- return ENOMEM;
- }
- panic("pmap_enter: could not allocate pv_entry");
- }
- pv->pv_va = v;
- pv->pv_pmap = pmap;
- pv->pv_next = pg->mdpage.pv_head;
- pg->mdpage.pv_head = pv;
- splx(s);
- pmap->pm_stats.resident_count++;
- if (newpte & PG_W)
- pmap->pm_stats.wired_count++;
- }
-
- if (flags & PROT_READ) {
- pg->mdpage.pv_attr |= PG_V;
- newpte |= PG_V;
- }
- if (flags & PROT_WRITE)
- pg->mdpage.pv_attr |= PG_M;
-
- if (flags & PMAP_WIRED)
- newpte |= PG_V; /* Not allowed to be invalid */
-
- mapin8(pteptr, newpte);
- RECURSEEND;
-
- mtpr(0, PR_TBIA); /* Always; safety belt */
- return 0;
-}
-
-vaddr_t
-pmap_map(vaddr_t va, paddr_t pstart, paddr_t pend, int prot)
-{
- vaddr_t count;
- pt_entry_t *pentry;
-
- PMDEBUG(("pmap_map: virt %lx, pstart %lx, pend %lx, Sysmap %p\n",
- va, pstart, pend, Sysmap));
-
- pstart &= 0x7fffffffUL;
- pend &= 0x7fffffffUL;
- va &= 0x7fffffffUL;
- pentry = Sysmap + vax_btop(va);
- for (count = pstart; count < pend; count += VAX_NBPG) {
- *pentry++ = vax_btop(count) | PG_V |
- (prot & PROT_WRITE ? PG_KW : PG_KR);
- }
- return va + (count - pstart) + KERNBASE;
-}
-
-boolean_t
-pmap_extract(struct pmap *pmap, vaddr_t va, paddr_t *pap)
-{
- pt_entry_t *pte;
- ulong sva;
-
- PMDEBUG(("pmap_extract: pmap %p, va %lx",pmap, va));
-
- sva = PG_PFNUM(va);
- if (va & KERNBASE) {
- if (sva >= sysptsize || (Sysmap[sva] & PG_V) == 0)
- goto fail;
- *pap = ((Sysmap[sva] & PG_FRAME) << VAX_PGSHIFT) |
- (va & VAX_PGOFSET);
- PMDEBUG((" -> pa %lx\n", *pap));
- return TRUE;
- }
-
- if (va < 0x40000000) {
- if (sva >= pmap->pm_p0lr)
- goto fail;
- pte = pmap->pm_p0br;
- } else {
- if (sva < pmap->pm_p1lr)
- goto fail;
- pte = pmap->pm_p1br;
- }
- /*
- * Since the PTE tables are sparsely allocated, make sure the page
- * table page actually exists before dereferencing the pte itself.
- */
- if ((*kvtopte((vaddr_t)&pte[sva]) & PG_V) && (pte[sva] & PG_V)) {
- *pap = ((pte[sva] & PG_FRAME) << VAX_PGSHIFT) |
- (va & VAX_PGOFSET);
- PMDEBUG((" -> pa %lx\n", *pap));
- return TRUE;
- }
-
-fail:
- PMDEBUG((" -> no mapping\n"));
- return FALSE;
-}
-
-/*
- * Sets protection for a given region to prot. If prot == none then
- * unmap region. pmap_remove is implemented as pmap_protect with
- * protection none.
- */
-void
-pmap_protect(struct pmap *pmap, vaddr_t start, vaddr_t end, vm_prot_t prot)
-{
- pt_entry_t *pt, *pts, *ptd;
- pt_entry_t pr, lr;
-
- PMDEBUG(("pmap_protect: pmap %p, start %lx, end %lx, prot %x\n",
- pmap, start, end,prot));
-
- RECURSESTART;
-
- switch (SEGTYPE(start)) {
- case SYSSEG:
- pt = Sysmap;
-#ifdef DIAGNOSTIC
- if (PG_PFNUM(end) > mfpr(PR_SLR))
- panic("pmap_protect: outside SLR: %lx", end);
-#endif
- start &= ~KERNBASE;
- end &= ~KERNBASE;
- pr = (prot & PROT_WRITE ? PG_KW : PG_KR);
- break;
-
- case P1SEG:
- if (vax_btop(end - 0x40000000) <= pmap->pm_p1lr) {
- RECURSEEND;
- return;
- }
- if (vax_btop(start - 0x40000000) < pmap->pm_p1lr)
- start = pmap->pm_p1lr * VAX_NBPG;
- pt = pmap->pm_p1br;
- start &= 0x3fffffff;
- end = (end == KERNBASE ? 0x40000000 : end & 0x3fffffff);
- pr = (prot & PROT_WRITE ? PG_RW : PG_RO);
- break;
-
- case P0SEG:
- lr = pmap->pm_p0lr;
-
- /* Anything to care about at all? */
- if (vax_btop(start) > lr) {
- RECURSEEND;
- return;
- }
- if (vax_btop(end) > lr)
- end = lr * VAX_NBPG;
- pt = pmap->pm_p0br;
- pr = (prot & PROT_WRITE ? PG_RW : PG_RO);
- break;
- default:
- panic("unsupported segtype: %d", (int)SEGTYPE(start));
- }
-
- pts = &pt[start >> VAX_PGSHIFT];
- ptd = &pt[end >> VAX_PGSHIFT];
-#ifdef DEBUG
- if (((int)pts - (int)pt) & 7)
- panic("pmap_remove: pts not even");
- if (((int)ptd - (int)pt) & 7)
- panic("pmap_remove: ptd not even");
-#endif
-
- while (pts < ptd) {
- if ((*kvtopte((vaddr_t)pts) & PG_FRAME) != 0 && *pts != PG_NV) {
- if (prot == PROT_NONE) {
- pmap->pm_stats.resident_count--;
- if ((*pts & PG_W))
- pmap->pm_stats.wired_count--;
- RECURSEEND;
- if ((*pts & PG_SREF) == 0)
- rmpage(pmap, pts);
- RECURSESTART;
- bzero(pts, sizeof(pt_entry_t) * LTOHPN);
- if (pt != Sysmap) {
- if (ptpinuse(pts) == 0)
- rmptep(pts);
- }
- } else {
- pts[0] = (pts[0] & ~PG_PROT) | pr;
- pts[1] = (pts[1] & ~PG_PROT) | pr;
- pts[2] = (pts[2] & ~PG_PROT) | pr;
- pts[3] = (pts[3] & ~PG_PROT) | pr;
- pts[4] = (pts[4] & ~PG_PROT) | pr;
- pts[5] = (pts[5] & ~PG_PROT) | pr;
- pts[6] = (pts[6] & ~PG_PROT) | pr;
- pts[7] = (pts[7] & ~PG_PROT) | pr;
- }
- }
- pts += LTOHPN;
- }
- RECURSEEND;
- mtpr(0,PR_TBIA);
-}
-
-/*
- * Called from interrupt vector routines if we get a page invalid fault.
- * Returns 0 if normal call, 1 if CVAX bug detected.
- */
-int pmap_simulref(int, vaddr_t);
-int
-pmap_simulref(int bits, vaddr_t va)
-{
- pt_entry_t *pte;
- struct vm_page *pg;
- paddr_t pa;
-
- PMDEBUG(("pmap_simulref: bits %x addr %x\n", bits, va));
-#ifdef DEBUG
- if (bits & 1)
- panic("pte trans len");
-#endif
- /* Set address to logical page boundary */
- va &= ~PGOFSET;
-
- if (va & KERNBASE) {
- pte = kvtopte(va);
- pa = (paddr_t)pte & ~KERNBASE;
- } else {
- if (va < 0x40000000)
- pte = (pt_entry_t *)mfpr(PR_P0BR);
- else
- pte = (pt_entry_t *)mfpr(PR_P1BR);
- pte += PG_PFNUM(va);
- if (bits & 2) { /* PTE reference */
- pte = kvtopte(vax_trunc_page(pte));
- if (pte[0] == 0) /* Check for CVAX bug */
- return 1;
- pa = (paddr_t)pte & ~KERNBASE;
- } else
- pa = (Sysmap[PG_PFNUM(pte)] & PG_FRAME) << VAX_PGSHIFT;
- }
-
- pte[0] |= PG_V;
- pte[1] |= PG_V;
- pte[2] |= PG_V;
- pte[3] |= PG_V;
- pte[4] |= PG_V;
- pte[5] |= PG_V;
- pte[6] |= PG_V;
- pte[7] |= PG_V;
-
- pa = trunc_page(pa);
- pg = PHYS_TO_VM_PAGE(pa);
- if (pg != NULL) {
- pg->mdpage.pv_attr |= PG_V; /* Referenced */
- if (bits & 4) /* (will be) modified. XXX page tables */
- pg->mdpage.pv_attr |= PG_M;
- }
- return 0;
-}
-
-/*
- * Checks if page is referenced; returns true or false depending on result.
- */
-boolean_t
-pmap_is_referenced(struct vm_page *pg)
-{
- PMDEBUG(("pmap_is_referenced: pg %p pv_attr %x\n",
- pg, pg->mdpage.pv_attr));
-
- if (pg->mdpage.pv_attr & PG_V)
- return 1;
-
- return 0;
-}
-
-/*
- * Clears valid bit in all ptes referenced to this physical page.
- */
-boolean_t
-pmap_clear_reference(struct vm_page *pg)
-{
- struct pv_entry *pv;
- pt_entry_t *pte;
- boolean_t ref = FALSE;
- int s;
-
- PMDEBUG(("pmap_clear_reference: pg %p\n", pg));
-
- if (pg->mdpage.pv_attr & PG_V)
- ref = TRUE;
-
- pg->mdpage.pv_attr &= ~PG_V;
-
- RECURSESTART;
- s = splvm();
- for (pv = pg->mdpage.pv_head; pv != NULL; pv = pv->pv_next) {
- pte = vaddrtopte(pv);
- pte[0] &= ~PG_V;
- pte[1] &= ~PG_V;
- pte[2] &= ~PG_V;
- pte[3] &= ~PG_V;
- pte[4] &= ~PG_V;
- pte[5] &= ~PG_V;
- pte[6] &= ~PG_V;
- pte[7] &= ~PG_V;
- }
- splx(s);
-
- RECURSEEND;
- mtpr(0, PR_TBIA);
- return ref;
-}
-
-/*
- * Checks if page is modified; returns true or false depending on result.
- */
-boolean_t
-pmap_is_modified(struct vm_page *pg)
-{
- struct pv_entry *pv;
- pt_entry_t *pte;
- boolean_t rv = FALSE;
- int s;
-
- PMDEBUG(("pmap_is_modified: pg %p pv_attr %x\n",
- pg, pg->mdpage.pv_attr));
-
- if (pg->mdpage.pv_attr & PG_M)
- return TRUE;
-
- s = splvm();
- for (pv = pg->mdpage.pv_head; pv != NULL; pv = pv->pv_next) {
- pte = vaddrtopte(pv);
- if ((pte[0] | pte[1] | pte[2] | pte[3] | pte[4] | pte[5] |
- pte[6] | pte[7]) & PG_M) {
- rv = TRUE;
- break;
- }
- }
- splx(s);
-
- return rv;
-}
-
-/*
- * Clears modify bit in all ptes referenced to this physical page.
- */
-boolean_t
-pmap_clear_modify(struct vm_page *pg)
-{
- struct pv_entry *pv;
- pt_entry_t *pte;
- boolean_t rv = FALSE;
- int s;
-
- PMDEBUG(("pmap_clear_modify: pg %p\n", pg));
-
- if (pg->mdpage.pv_attr & PG_M)
- rv = TRUE;
- pg->mdpage.pv_attr &= ~PG_M;
-
- s = splvm();
- for (pv = pg->mdpage.pv_head; pv != NULL; pv = pv->pv_next) {
- pte = vaddrtopte(pv);
- if ((pte[0] | pte[1] | pte[2] | pte[3] | pte[4] | pte[5] |
- pte[6] | pte[7]) & PG_M) {
- rv = TRUE;
-
- pte[0] &= ~PG_M;
- pte[1] &= ~PG_M;
- pte[2] &= ~PG_M;
- pte[3] &= ~PG_M;
- pte[4] &= ~PG_M;
- pte[5] &= ~PG_M;
- pte[6] &= ~PG_M;
- pte[7] &= ~PG_M;
- }
- }
- splx(s);
-
- return rv;
-}
-
-/*
- * Lower the permission for all mappings to a given page.
- * Lower permission can only mean setting protection to either read-only
- * or none; where none is unmapping of the page.
- */
-void
-pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
-{
- pt_entry_t *pte;
- struct pv_entry *pv, *npv;
- int s;
-
- PMDEBUG(("pmap_page_protect: pg %p, prot %x\n", pg, prot));
-
- if (pg->mdpage.pv_head == NULL)
- return;
-
- if (prot == PROT_MASK) /* 'cannot happen' */
- return;
-
- RECURSESTART;
- s = splvm();
- if (prot == PROT_NONE) {
- npv = pg->mdpage.pv_head;
- pg->mdpage.pv_head = NULL;
- while ((pv = npv) != NULL) {
- npv = pv->pv_next;
- pte = vaddrtopte(pv);
- pv->pv_pmap->pm_stats.resident_count--;
- if (pte[0] & PG_W)
- pv->pv_pmap->pm_stats.wired_count--;
- if ((pg->mdpage.pv_attr & (PG_V|PG_M)) != (PG_V|PG_M))
- pg->mdpage.pv_attr |=
- pte[0] | pte[1] | pte[2] | pte[3] |
- pte[4] | pte[5] | pte[6] | pte[7];
- bzero(pte, sizeof(pt_entry_t) * LTOHPN);
- if (pv->pv_pmap != pmap_kernel()) {
- if (ptpinuse(pte) == 0)
- rmptep(pte);
- }
- free_pventry(pv);
- }
- } else { /* read-only */
- for (pv = pg->mdpage.pv_head; pv != NULL; pv = pv->pv_next) {
- pt_entry_t pr;
-
- pte = vaddrtopte(pv);
- pr = (vaddr_t)pte < ptemapstart ?
- PG_KR : PG_RO;
-
- pte[0] = (pte[0] & ~PG_PROT) | pr;
- pte[1] = (pte[1] & ~PG_PROT) | pr;
- pte[2] = (pte[2] & ~PG_PROT) | pr;
- pte[3] = (pte[3] & ~PG_PROT) | pr;
- pte[4] = (pte[4] & ~PG_PROT) | pr;
- pte[5] = (pte[5] & ~PG_PROT) | pr;
- pte[6] = (pte[6] & ~PG_PROT) | pr;
- pte[7] = (pte[7] & ~PG_PROT) | pr;
- }
- }
- splx(s);
- RECURSEEND;
- mtpr(0, PR_TBIA);
-}
-
-void
-pmap_remove_pcb(struct pmap *pm, struct pcb *thispcb)
-{
- struct pcb *pcb, **pcbp;
-
- PMDEBUG(("pmap_remove_pcb pm %p pcb %p\n", pm, thispcb));
-
- for (pcbp = &pm->pm_pcbs; (pcb = *pcbp) != NULL;
- pcbp = &pcb->pcb_pmnext) {
-#ifdef DIAGNOSTIC
- if (pcb->pcb_pm != pm)
- panic("%s: pcb %p (pm %p) not owned by pmap %p",
- __func__, pcb, pcb->pcb_pm, pm);
-#endif
- if (pcb == thispcb) {
- *pcbp = pcb->pcb_pmnext;
- thispcb->pcb_pm = NULL;
- return;
- }
- }
-#ifdef DIAGNOSTIC
- panic("%s: pmap %p: pcb %p not in list", __func__, pm, thispcb);
-#endif
-}
-
-/*
- * Activate the address space for the specified process.
- * Note that if the process to activate is the current process, then
- * the processor internal registers must also be loaded; otherwise
- * the current process will have wrong pagetables.
- */
-void
-pmap_activate(struct proc *p)
-{
- struct pcb *pcb = &p->p_addr->u_pcb;
- struct pmap *pmap = p->p_vmspace->vm_map.pmap;
- int s;
-
- PMDEBUG(("pmap_activate: p %p pcb %p pm %p (%08x %08x %08x %08x)\n",
- p, pcb, pmap, pmap->pm_p0br, pmap->pm_p0lr, pmap->pm_p1br,
- pmap->pm_p1lr));
-
- pcb->P0BR = pmap->pm_p0br;
- pcb->P0LR = pmap->pm_p0lr | AST_PCB;
- pcb->P1BR = pmap->pm_p1br;
- pcb->P1LR = pmap->pm_p1lr;
-
- if (pcb->pcb_pm != pmap) {
- s = splsched();
- if (pcb->pcb_pm != NULL)
- pmap_remove_pcb(pcb->pcb_pm, pcb);
- pcb->pcb_pmnext = pmap->pm_pcbs;
- pmap->pm_pcbs = pcb;
- pcb->pcb_pm = pmap;
- splx(s);
- }
-
- if (p == curproc) {
- mtpr((register_t)pmap->pm_p0br, PR_P0BR);
- mtpr(pmap->pm_p0lr | AST_PCB, PR_P0LR);
- mtpr((register_t)pmap->pm_p1br, PR_P1BR);
- mtpr(pmap->pm_p1lr, PR_P1LR);
- mtpr(0, PR_TBIA);
- }
-}
-
-void
-pmap_deactivate(struct proc *p)
-{
- struct pcb *pcb = &p->p_addr->u_pcb;
- struct pmap *pmap = p->p_vmspace->vm_map.pmap;
- int s;
-
- PMDEBUG(("pmap_deactivate: p %p pcb %p\n", p, pcb));
-
- if (pcb->pcb_pm != NULL) {
- s = splsched();
-#ifdef DIAGNOSTIC
- if (pcb->pcb_pm != pmap)
- panic("%s: proc %p pcb %p not owned by pmap %p",
- __func__, p, pcb, pmap);
-#endif
- pmap_remove_pcb(pmap, pcb);
- splx(s);
- }
-}
diff --git a/sys/arch/vax/vax/scb.c b/sys/arch/vax/vax/scb.c
deleted file mode 100644
index 52488a9ff87..00000000000
--- a/sys/arch/vax/vax/scb.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/* $OpenBSD: scb.c,v 1.7 2012/11/25 22:13:46 jsg Exp $ */
-/* $NetBSD: scb.c,v 1.12 2000/06/04 06:16:59 matt Exp $ */
-/*
- * Copyright (c) 1999 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-/*
- * Routines for dynamic allocation/release of SCB vectors.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-
-#include <machine/trap.h>
-#include <machine/scb.h>
-#include <machine/frame.h>
-#include <machine/cpu.h>
-#include <machine/sid.h>
-#include <machine/mtpr.h>
-
-struct scb *scb;
-struct ivec_dsp *scb_vec;
-
-static volatile int vector, ipl, gotintr;
-
-/*
- * Generates a new SCB.
- */
-paddr_t
-scb_init(paddr_t avail_start)
-{
- struct ivec_dsp **ivec = (struct ivec_dsp **)avail_start;
- struct ivec_dsp **old = (struct ivec_dsp **)KERNBASE;
- vaddr_t vavail = avail_start + KERNBASE;
- int scb_size = dep_call->cpu_scbsz;
- int i;
-
- scb = (struct scb *)vavail;
- scb_vec = (struct ivec_dsp *)(vavail + (scb_size * VAX_NBPG));
-
- /* Init the whole SCB with interrupt catchers */
- for (i = 0; i < (scb_size * VAX_NBPG)/4; i++) {
- ivec[i] = (struct ivec_dsp *)
- ((vaddr_t)&scb_vec[i] | SCB_ISTACK); /* On istack, please */
- scb_vec[i] = idsptch;
- scb_vec[i].hoppaddr = scb_stray;
- scb_vec[i].pushlarg = (void *) (i * 4);
- scb_vec[i].ev = NULL;
- }
- /*
- * Copy all pre-set interrupt vectors to the new SCB.
- * It is known that these vectors is at KERNBASE from the
- * beginning, and that if the vector is zero it should call
- * stray instead.
- */
- for (i = 0; i < 64; i++)
- if (old[i])
- ivec[i] = old[i];
-
- /* Last action: set the SCB */
- mtpr(avail_start, PR_SCBB);
-
- /* Return new avail_start. Also save space for the dispatchers. */
- return avail_start + (1 + sizeof(struct ivec_dsp) / sizeof(void *))
- * scb_size * VAX_NBPG;
-};
-
-/*
- * Stray interrupt handler.
- * This function must _not_ save any registers (in the reg save mask).
- */
-void
-scb_stray(void *arg)
-{
- gotintr = 1;
- vector = ((int) arg) & ~3;
- ipl = mfpr(PR_IPL);
-
- if (cold == 0)
- printf("stray interrupt: vector %d, ipl %d\n", vector, ipl);
- else {
- struct icallsframe *icf = (void *) __builtin_frame_address(0);
-
- icf->ica_psl = (icf->ica_psl & ~PSL_IPL) | ipl << 16;
- }
-
- mtpr(ipl + 1, PR_IPL);
-}
-
-/*
- * Fake interrupt handler, to fool some bus' autodetect system.
- * (May I say DW780? :-)
- */
-void
-scb_fake(vec, br)
- int vec, br;
-{
- vector = vec;
- ipl = br;
- gotintr = 1;
-}
-
-/*
- * Returns last vector/ipl referenced. Clears vector/ipl after reading.
- */
-int
-scb_vecref(rvec, ripl)
- int *rvec, *ripl;
-{
- int save;
-
- if (rvec)
- *rvec = vector;
- if (ripl)
- *ripl = ipl;
- save = gotintr;
- gotintr = vector = ipl = 0;
- mtpr(0, PR_IPL);
- return save;
-}
-
-/*
- * Sets a vector to the specified function.
- * Arg may not be greater than 63.
- */
-
-void
-scb_vecalloc(vecno, func, arg, stack, ev)
- int vecno;
- void (*func)(void *);
- void *arg;
- int stack;
- struct evcount *ev;
-{
- struct ivec_dsp *dsp = &scb_vec[vecno / 4];
- dsp->hoppaddr = func;
- dsp->pushlarg = arg;
- dsp->ev = ev;
- ((u_int *) scb)[vecno/4] = (u_int)(dsp) | stack;
-}
diff --git a/sys/arch/vax/vax/sgmap.c b/sys/arch/vax/vax/sgmap.c
deleted file mode 100644
index 8cc63758db5..00000000000
--- a/sys/arch/vax/vax/sgmap.c
+++ /dev/null
@@ -1,329 +0,0 @@
-/* $OpenBSD: sgmap.c,v 1.10 2008/09/30 20:00:29 miod Exp $ */
-/* $NetBSD: sgmap.c,v 1.8 2000/06/29 07:14:34 mrg Exp $ */
-
-/*-
- * Copyright (c) 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.
- *
- * 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.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/bus.h>
-#include <machine/sgmap.h>
-
-void
-vax_sgmap_init(t, sgmap, name, sgvabase, sgvasize, ptva, minptalign)
- bus_dma_tag_t t;
- struct vax_sgmap *sgmap;
- const char *name;
- bus_addr_t sgvabase;
- bus_size_t sgvasize;
- pt_entry_t *ptva;
- bus_size_t minptalign;
-{
- bus_dma_segment_t seg;
- size_t ptsize;
- int rseg;
-
- if (sgvasize & PGOFSET) {
- printf("size botch for sgmap `%s'\n", name);
- goto die;
- }
-
- sgmap->aps_sgvabase = sgvabase;
- sgmap->aps_sgvasize = sgvasize;
-
- if (ptva != NULL) {
- /*
- * We already have a page table; this may be a system
- * where the page table resides in bridge-resident SRAM.
- */
- sgmap->aps_pt = ptva;
- } else {
- /*
- * Compute the page table size and allocate it. At minimum,
- * this must be aligned to the page table size. However,
- * some platforms have more strict alignment reqirements.
- */
- ptsize = (sgvasize / VAX_NBPG) * sizeof(pt_entry_t);
- if (minptalign != 0) {
- if (minptalign < ptsize)
- minptalign = ptsize;
- } else
- minptalign = ptsize;
- if (bus_dmamem_alloc(t, ptsize, minptalign, 0, &seg, 1, &rseg,
- BUS_DMA_NOWAIT)) {
- panic("unable to allocate page table for sgmap `%s'",
- name);
- goto die;
- }
- sgmap->aps_pt = (pt_entry_t *)(seg.ds_addr | KERNBASE);
- }
-
- /*
- * Create the extent map used to manage the virtual address
- * space.
- */
- sgmap->aps_ex = extent_create((char *)name, sgvabase, sgvasize - 1,
- M_DEVBUF, NULL, 0, EX_NOWAIT|EX_NOCOALESCE);
- if (sgmap->aps_ex == NULL) {
- printf("unable to create extent map for sgmap `%s'\n", name);
- goto die;
- }
-
- return;
- die:
- panic("vax_sgmap_init");
-}
-
-int
-vax_sgmap_alloc(map, origlen, sgmap, flags)
- bus_dmamap_t map;
- bus_size_t origlen;
- struct vax_sgmap *sgmap;
- int flags;
-{
- int error;
- bus_size_t len = origlen;
-
-#ifdef DIAGNOSTIC
- if (map->_dm_flags & DMAMAP_HAS_SGMAP)
- panic("vax_sgmap_alloc: already have sgva space");
-#endif
-
- /* If we need a spill page (for the VS4000 SCSI), make sure we
- * allocate enough space for an extra page.
- */
- if (flags & VAX_BUS_DMA_SPILLPAGE) {
- len += VAX_NBPG;
- }
-
- map->_dm_sgvalen = vax_round_page(len);
-#if 0
- printf("len %x -> %x, _dm_sgvalen %x _dm_boundary %x boundary %x -> ",
- origlen, len, map->_dm_sgvalen, map->_dm_boundary, boundary);
-#endif
-
- error = extent_alloc(sgmap->aps_ex, map->_dm_sgvalen, VAX_NBPG, 0,
- 0, (flags & BUS_DMA_NOWAIT) ? EX_NOWAIT : EX_WAITOK,
- &map->_dm_sgva);
-#if 0
- printf("error %d _dm_sgva %x\n", error, map->_dm_sgva);
-#endif
-
- if (error == 0)
- map->_dm_flags |= DMAMAP_HAS_SGMAP;
- else
- map->_dm_flags &= ~DMAMAP_HAS_SGMAP;
-
- return (error);
-}
-
-void
-vax_sgmap_free(map, sgmap)
- bus_dmamap_t map;
- struct vax_sgmap *sgmap;
-{
-
-#ifdef DIAGNOSTIC
- if ((map->_dm_flags & DMAMAP_HAS_SGMAP) == 0)
- panic("vax_sgmap_free: no sgva space to free");
-#endif
-
- if (extent_free(sgmap->aps_ex, map->_dm_sgva, map->_dm_sgvalen,
- EX_NOWAIT))
- panic("vax_sgmap_free");
-
- map->_dm_flags &= ~DMAMAP_HAS_SGMAP;
-}
-
-int
-vax_sgmap_load(t, map, buf, buflen, p, flags, sgmap)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- void *buf;
- bus_size_t buflen;
- struct proc *p;
- int flags;
- struct vax_sgmap *sgmap;
-{
- vaddr_t endva, va = (vaddr_t)buf;
- paddr_t pa;
- bus_addr_t dmaoffset;
- bus_size_t dmalen;
- long *pte, *page_table = (long *)sgmap->aps_pt;
- int pteidx, error;
- struct pmap *pmap;
-
- if (p != NULL)
- pmap = p->p_vmspace->vm_map.pmap;
- else
- pmap = pmap_kernel();
-
- /*
- * Make sure that on error condition we return "no valid mappings".
- */
- map->dm_mapsize = 0;
- map->dm_nsegs = 0;
-
- if (buflen > map->_dm_size)
- return (EINVAL);
-
- /*
- * Remember the offset into the first page and the total
- * transfer length.
- */
- dmaoffset = ((u_long)buf) & VAX_PGOFSET;
- dmalen = buflen;
-
-
- /*
- * Allocate the necessary virtual address space for the
- * mapping. Round the size, since we deal with whole pages.
- */
- endva = vax_round_page(va + buflen);
- va = vax_trunc_page(va);
- if ((map->_dm_flags & DMAMAP_HAS_SGMAP) == 0) {
- error = vax_sgmap_alloc(map, (endva - va), sgmap, flags);
- if (error)
- return (error);
- }
-
- pteidx = map->_dm_sgva >> VAX_PGSHIFT;
- pte = &page_table[pteidx];
-
- /*
- * Generate the DMA address.
- */
- map->dm_segs[0].ds_addr = map->_dm_sgva + dmaoffset;
- map->dm_segs[0].ds_len = dmalen;
-
- map->_dm_pteidx = pteidx;
- map->_dm_ptecnt = 0;
-
- /*
- * Create the bus-specific page tables.
- * Can be done much more efficient than this.
- */
- for (; va < endva; va += VAX_NBPG, pte++, map->_dm_ptecnt++) {
- /*
- * Get the physical address for this segment.
- */
- (void)pmap_extract(pmap, va, &pa);
-
- /*
- * Load the current PTE with this page.
- */
- *pte = (pa >> VAX_PGSHIFT) | PG_V;
- }
- /* The VS4000 SCSI prefetcher doesn't like to end on a page boundary
- * so add an extra page to quiet it down.
- */
- if (flags & VAX_BUS_DMA_SPILLPAGE) {
- *pte = pte[-1];
- map->_dm_ptecnt++;
- }
-
- map->dm_mapsize = buflen;
- map->dm_nsegs = 1;
- return (0);
-}
-
-int
-vax_sgmap_load_mbuf(t, map, m, flags, sgmap)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- struct mbuf *m;
- int flags;
- struct vax_sgmap *sgmap;
-{
-
- panic("vax_sgmap_load_mbuf : not implemented");
-}
-
-int
-vax_sgmap_load_uio(t, map, uio, flags, sgmap)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- struct uio *uio;
- int flags;
- struct vax_sgmap *sgmap;
-{
-
- panic("vax_sgmap_load_uio : not implemented");
-}
-
-int
-vax_sgmap_load_raw(t, map, segs, nsegs, size, flags, sgmap)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- bus_dma_segment_t *segs;
- int nsegs;
- bus_size_t size;
- int flags;
- struct vax_sgmap *sgmap;
-{
-
- panic("vax_sgmap_load_raw : not implemented");
-}
-
-void
-vax_sgmap_unload(t, map, sgmap)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- struct vax_sgmap *sgmap;
-{
- long *pte, *page_table = (long *)sgmap->aps_pt;
- int ptecnt;
-
- /*
- * Invalidate the PTEs for the mapping.
- */
- for (ptecnt = map->_dm_ptecnt, pte = &page_table[map->_dm_pteidx];
- ptecnt-- != 0; ) {
- *pte++ = 0;
- }
-
- /*
- * Free the virtual address space used by the mapping
- * if necessary.
- */
- if ((map->_dm_flags & BUS_DMA_ALLOCNOW) == 0)
- vax_sgmap_free(map, sgmap);
- /*
- * Mark the mapping invalid.
- */
- map->dm_mapsize = 0;
- map->dm_nsegs = 0;
-}
diff --git a/sys/arch/vax/vax/softintr.c b/sys/arch/vax/vax/softintr.c
deleted file mode 100644
index 6f7555f7372..00000000000
--- a/sys/arch/vax/vax/softintr.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/* $OpenBSD: softintr.c,v 1.5 2014/12/23 21:39:12 miod Exp $ */
-/* $NetBSD: softintr.c,v 1.2 2003/07/15 00:24:39 lukem Exp $ */
-
-/*
- * Copyright (c) 2001 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Jason R. Thorpe for Wasabi Systems, Inc.
- *
- * 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 for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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/mutex.h>
-#include <sys/malloc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/atomic.h>
-#include <machine/intr.h>
-#include <machine/mtpr.h>
-
-void softintr_dispatch(void);
-
-struct soft_intrq soft_intrq[SI_NQUEUES];
-
-struct soft_intrhand *softnet_intrhand;
-
-void netintr(void);
-
-/*
- * Initialize the software interrupt system.
- */
-void
-softintr_init(void)
-{
- struct soft_intrq *siq;
- int i;
-
- for (i = 0; i < SI_NQUEUES; i++) {
- siq = &soft_intrq[i];
- TAILQ_INIT(&siq->siq_list);
- siq->siq_si = IPL_SOFT + i;
- mtx_init(&siq->siq_mtx, IPL_HIGH);
- }
-
- /* XXX Establish legacy software interrupt handlers. */
- softnet_intrhand = softintr_establish(IPL_SOFTNET,
- (void (*)(void *))netintr, NULL);
-}
-
-/*
- * Process pending software interrupts. The corresponding queue is
- * computed from the current interrupt level.
- */
-void
-softintr_dispatch()
-{
- struct soft_intrq *siq;
- struct soft_intrhand *sih;
- int si;
-
- si = mfpr(PR_IPL) - IPL_SOFT;
- siq = &soft_intrq[si];
-
- for (;;) {
- mtx_enter(&siq->siq_mtx);
- sih = TAILQ_FIRST(&siq->siq_list);
- if (sih == NULL) {
- mtx_leave(&siq->siq_mtx);
- break;
- }
-
- TAILQ_REMOVE(&siq->siq_list, sih, sih_list);
- sih->sih_pending = 0;
-
- uvmexp.softs++;
-
- mtx_leave(&siq->siq_mtx);
-
- (*sih->sih_func)(sih->sih_arg);
- }
-}
-
-/*
- * Register a software interrupt handler.
- */
-void *
-softintr_establish(int ipl, void (*func)(void *), void *arg)
-{
- struct soft_intrhand *sih;
- int si;
-
- si = ipl - IPL_SOFT;
- if (si < 0 || si > SI_NQUEUES) {
- printf("softintr_establish: unknown soft IPL %d\n", ipl);
- return NULL;
- }
-
- sih = malloc(sizeof(*sih), M_DEVBUF, M_NOWAIT);
- if (__predict_true(sih != NULL)) {
- sih->sih_func = func;
- sih->sih_arg = arg;
- sih->sih_siq = &soft_intrq[si];
- sih->sih_pending = 0;
- }
- return (sih);
-}
-
-/*
- * Unregister a software interrupt handler.
- */
-void
-softintr_disestablish(void *arg)
-{
- struct soft_intrhand *sih = arg;
- struct soft_intrq *siq = sih->sih_siq;
-
- mtx_enter(&siq->siq_mtx);
- if (sih->sih_pending) {
- TAILQ_REMOVE(&siq->siq_list, sih, sih_list);
- sih->sih_pending = 0;
- }
- mtx_leave(&siq->siq_mtx);
-
- free(sih, M_DEVBUF, sizeof(*sih));
-}
-
-/*
- * Schedule a software interrupt.
- */
-void
-softintr_schedule(void *arg)
-{
- struct soft_intrhand *sih = (struct soft_intrhand *)arg;
- struct soft_intrq *siq = sih->sih_siq;
-
- mtx_enter(&siq->siq_mtx);
- if (sih->sih_pending == 0) {
- TAILQ_INSERT_TAIL(&siq->siq_list, sih, sih_list);
- sih->sih_pending = 1;
- mtpr(siq->siq_si, PR_SIRR);
- }
- mtx_leave(&siq->siq_mtx);
-}
diff --git a/sys/arch/vax/vax/trap.c b/sys/arch/vax/vax/trap.c
deleted file mode 100644
index f24fb399cc0..00000000000
--- a/sys/arch/vax/vax/trap.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/* $OpenBSD: trap.c,v 1.57 2016/02/27 13:08:07 mpi Exp $ */
-/* $NetBSD: trap.c,v 1.47 1999/08/21 19:26:20 matt Exp $ */
-/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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.
- */
-
- /* All bugs are subject to removal without further notice */
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/syscall.h>
-#include <sys/systm.h>
-#include <sys/syscall_mi.h>
-#include <sys/signalvar.h>
-#include <sys/exec.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/mtpr.h>
-#include <machine/pte.h>
-#include <machine/pcb.h>
-#include <machine/trap.h>
-#include <machine/pmap.h>
-#include <machine/cpu.h>
-
-#ifdef DDB
-#include <machine/db_machdep.h>
-#endif
-#include <kern/syscalls.c>
-
-#ifdef TRAPDEBUG
-volatile int startsysc = 0, faultdebug = 0;
-#endif
-
-void arithflt(struct trapframe *);
-void syscall(struct trapframe *);
-
-char *traptypes[]={
- "reserved addressing",
- "privileged instruction",
- "reserved operand",
- "breakpoint instruction",
- "XFC instruction",
- "system call ",
- "arithmetic trap",
- "asynchronous system trap",
- "page table length fault",
- "translation violation fault",
- "trace trap",
- "compatibility mode fault",
- "access violation fault",
- "",
- "",
- "KSP invalid",
- "",
- "kernel debugger trap"
-};
-int no_traps = 18;
-
-#define USERMODE(framep) ((((framep)->psl) & (PSL_U)) == PSL_U)
-#define FAULTCHK \
- do if (p->p_addr->u_pcb.iftrap) { \
- frame->pc = (unsigned)p->p_addr->u_pcb.iftrap; \
- frame->psl &= ~PSL_FPD; \
- frame->r0 = EFAULT; \
- return; \
- } while (0)
-
-void
-arithflt(frame)
- struct trapframe *frame;
-{
- u_int sig = 0, type = frame->trap, trapsig = 1;
- u_int rv, addr, umode;
- struct proc *p = curproc;
- struct vm_map *map;
- vm_prot_t ftype;
- int typ;
- union sigval sv;
-
- sv.sival_int = frame->pc;
- uvmexp.traps++;
- if ((umode = USERMODE(frame))) {
- type |= T_USER;
- p->p_addr->u_pcb.framep = frame;
- refreshcreds(p);
- }
-
- type&=~(T_WRITE|T_PTEFETCH);
-
-
-#ifdef TRAPDEBUG
-if(frame->trap==7) goto fram;
-if(faultdebug)printf("Trap: type %lx, code %lx, pc %lx, psl %lx\n",
- frame->trap, frame->code, frame->pc, frame->psl);
-fram:
-#endif
- switch (type){
-
- default:
-#ifdef DDB
- db_ktrap(frame);
-#endif
- printf("Trap: type %x, code %x, pc %x, psl %x\n",
- (u_int)frame->trap, (u_int)frame->code,
- (u_int)frame->pc, (u_int)frame->psl);
- panic("trap");
-
- case T_KSPNOTVAL:
- panic("kernel stack invalid");
-
- case T_TRANSFLT|T_USER:
- case T_TRANSFLT:
- /*
- * BUG! BUG! BUG! BUG! BUG!
- * Due to a hardware bug (at in least KA65x CPUs) a double
- * page table fetch trap will cause a translation fault
- * even if access in the SPT PTE entry specifies 'no access'.
- * In for example section 6.4.2 in VAX Architecture
- * Reference Manual it states that if a page both are invalid
- * and have no access set, a 'access violation fault' occurs.
- * Therefore, we must fall through here...
- */
-#ifdef nohwbug
- panic("translation fault");
-#endif
- case T_PTELEN|T_USER: /* Page table length exceeded */
- case T_ACCFLT|T_USER:
- if (frame->code < 0) { /* Check for kernel space */
- sv.sival_int = frame->code;
- sig = SIGSEGV;
- typ = SEGV_ACCERR;
- break;
- }
- /* FALLTHROUGH */
-
- case T_PTELEN:
- case T_ACCFLT:
-#ifdef TRAPDEBUG
-if(faultdebug)printf("trap accflt type %lx, code %lx, pc %lx, psl %lx\n",
- frame->trap, frame->code, frame->pc, frame->psl);
-#endif
-#ifdef DIAGNOSTIC
- if (p == 0)
- panic("trap: access fault: addr %lx code %lx",
- frame->pc, frame->code);
-#endif
-
- /*
- * Page tables are allocated in pmap_enter(). We get
- * info from below if it is a page table fault, but
- * UVM may want to map in pages without faults, so
- * because we must check for PTE pages anyway we don't
- * bother doing it here.
- */
- sv.sival_int = frame->code;
- if ((umode == 0) && (frame->code < 0))
- map = kernel_map;
- else
- map = &p->p_vmspace->vm_map;
-
- if (frame->trap & T_WRITE)
- ftype = PROT_READ | PROT_WRITE;
- else
- ftype = PROT_READ;
-
- addr = trunc_page((vaddr_t)frame->code);
- rv = uvm_fault(map, addr, 0, ftype);
- if (rv) {
- if (umode == 0) {
- FAULTCHK;
- panic("Segv in kernel mode: pc %x addr %x",
- (u_int)frame->pc, (u_int)frame->code);
- }
- if (rv == ENOMEM) {
- printf("UVM: pid %d (%s), uid %d killed: "
- "out of swap\n", p->p_pid, p->p_comm,
- p->p_ucred ? (int)p->p_ucred->cr_uid : -1);
- sig = SIGKILL;
- typ = 0;
- } else {
- sig = SIGSEGV;
- typ = SEGV_MAPERR;
- }
- } else {
- trapsig = 0;
- if (umode != 0)
- uvm_grow(p, addr);
- }
- break;
-
- case T_BPTFLT|T_USER:
- typ = TRAP_BRKPT;
- sig = SIGTRAP;
- frame->psl &= ~PSL_T;
- break;
-
- case T_TRCTRAP|T_USER:
- typ = TRAP_TRACE;
- sig = SIGTRAP;
- frame->psl &= ~PSL_T;
- break;
-
- case T_PRIVINFLT|T_USER:
- case T_RESOPFLT|T_USER:
- typ = ILL_ILLOPC;
- sig = SIGILL;
- break;
-
- case T_RESADFLT|T_USER:
- typ = ILL_ILLADR;
- sig = SIGILL;
- break;
-
- case T_XFCFLT|T_USER:
- typ = EMT_TAGOVF;
- sig = SIGEMT;
- break;
-
- case T_ARITHFLT|T_USER:
- sv.sival_int = frame->code;
- typ = FPE_FLTINV;
- sig = SIGFPE;
- break;
-
- case T_ASTFLT|T_USER:
- mtpr(AST_NO,PR_ASTLVL);
- trapsig = 0;
- uvmexp.softs++;
- mi_ast(p, want_resched);
- break;
-
-#ifdef DDB
- case T_BPTFLT: /* Kernel breakpoint */
- case T_KDBTRAP:
- case T_KDBTRAP|T_USER:
- case T_TRCTRAP:
- db_ktrap(frame);
- return;
-#endif
- }
-
- if (trapsig) {
- /*
- * Arithmetic exceptions can be of two kinds:
- * - traps (codes 1..7), where pc points to the
- * next instruction to execute.
- * - faults (codes 8..10), where pc points to the
- * faulting instruction.
- * In the latter case, we need to advance pc by ourselves
- * to prevent a signal loop.
- *
- * XXX this is gross -- miod
- */
- if (type == (T_ARITHFLT | T_USER) && frame->code >= 8) {
- extern long skip_opcode(long);
-
- frame->pc = skip_opcode(frame->pc);
- }
-
- trapsignal(p, sig, frame->code, typ, sv);
- }
-
- if (umode == 0)
- return;
-
- userret(p);
-}
-
-void
-setregs(p, pack, stack, retval)
- struct proc *p;
- struct exec_package *pack;
- u_long stack;
- register_t *retval;
-{
- struct trapframe *exptr;
-
- exptr = p->p_addr->u_pcb.framep;
- exptr->pc = pack->ep_entry + 2;
- exptr->sp = stack;
- exptr->r6 = stack; /* for ELF */
- exptr->r7 = 0; /* for ELF */
- exptr->r8 = 0; /* for ELF */
- exptr->r9 = p->p_p->ps_strings; /* for ELF */
-
- retval[1] = 0;
-}
-
-void
-syscall(frame)
- struct trapframe *frame;
-{
- struct sysent *callp;
- int nsys, err;
- long rval[2], args[8];
- struct trapframe *exptr;
- struct proc *p = curproc;
-
-#ifdef TRAPDEBUG
-if(startsysc)printf("trap syscall %s pc %lx, psl %lx, sp %lx, pid %d, frame %p\n",
- syscallnames[frame->code], frame->pc, frame->psl,frame->sp,
- curproc->p_pid,frame);
-#endif
- uvmexp.syscalls++;
-
- exptr = p->p_addr->u_pcb.framep = frame;
- callp = p->p_p->ps_emul->e_sysent;
- nsys = p->p_p->ps_emul->e_nsysent;
-
- if(frame->code == SYS___syscall){
- int g = *(int *)(frame->ap);
-
- frame->code = *(int *)(frame->ap + 4);
- frame->ap += 8;
- *(int *)(frame->ap) = g - 2;
- }
-
- if(frame->code < 0 || frame->code >= nsys)
- callp += p->p_p->ps_emul->e_nosys;
- else
- callp += frame->code;
-
- rval[0] = 0;
- rval[1] = frame->r1;
- if(callp->sy_narg) {
- if ((err = copyin((char *)frame->ap + 4, args,
- callp->sy_argsize)))
- goto bad;
- }
-
- err = mi_syscall(p, frame->code, callp, args, rval);
-
-#ifdef TRAPDEBUG
-if(startsysc)
- printf("retur %s pc %lx, psl %lx, sp %lx, pid %d, v{rde %d r0 %d, r1 %d, frame %p\n",
- syscallnames[exptr->code], exptr->pc, exptr->psl,exptr->sp,
- curproc->p_pid,err,rval[0],rval[1],exptr);
-#endif
-
- switch (err) {
- case 0:
- exptr->r1 = rval[1];
- exptr->r0 = rval[0];
- exptr->psl &= ~PSL_C;
- break;
-
- case EJUSTRETURN:
- return;
-
- case ERESTART:
- exptr->pc -= (exptr->code > 63 ? 4 : 2);
- break;
-
- default:
- bad:
- exptr->r0 = err;
- exptr->psl |= PSL_C;
- break;
- }
-
- mi_syscall_return(p, frame->code, err, rval);
-}
-
-void
-child_return(arg)
- void *arg;
-{
- struct proc *p = arg;
- struct trapframe *frame;
-
- frame = p->p_addr->u_pcb.framep;
- frame->r1 = frame->r0 = 0;
- frame->psl &= ~PSL_C;
-
- mi_child_return(p);
-}
diff --git a/sys/arch/vax/vax/udiv.s b/sys/arch/vax/vax/udiv.s
deleted file mode 100644
index 28a5db508ec..00000000000
--- a/sys/arch/vax/vax/udiv.s
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $OpenBSD: udiv.s,v 1.5 2013/07/05 21:11:57 miod Exp $ */
-/* $NetBSD: udiv.s,v 1.2 1994/10/26 08:03:34 cgd Exp $ */
-
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Donn Seeley at UUNET Technologies, Inc.
- *
- * 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.
- *
- * @(#)udiv.s 5.6 (Berkeley) 4/15/91
- */
-
-#include <machine/asm.h>
-
-/*
- * Unsigned division, PCC flavor.
- * udiv() takes an ordinary dividend/divisor pair;
- * audiv() takes a pointer to a dividend and an ordinary divisor.
- */
-
-
-#define DIVIDEND 4(%ap)
-#define DIVISOR 8(%ap)
-
-ASENTRY(__udiv, 0)
- movl DIVISOR,%r2
- jlss Leasy # big divisor: settle by comparison
- movl DIVIDEND,%r0
- jlss Lhard # big dividend: extended division
- divl2 %r2,%r0 # small divisor and dividend: signed division
- ret
-Lhard:
- clrl %r1
- ediv %r2,%r0,%r0,%r1
- ret
-Leasy:
- cmpl DIVIDEND,%r2
- jgequ Lone # if dividend is as big or bigger, return 1
- clrl %r0 # else return 0
- ret
-Lone:
- movl $1,%r0
- ret
diff --git a/sys/arch/vax/vax/unimpl_emul.s b/sys/arch/vax/vax/unimpl_emul.s
deleted file mode 100644
index c479b27a60d..00000000000
--- a/sys/arch/vax/vax/unimpl_emul.s
+++ /dev/null
@@ -1,848 +0,0 @@
-/* $OpenBSD: unimpl_emul.s,v 1.9 2013/07/05 21:11:57 miod Exp $ */
-/* $NetBSD: unimpl_emul.s,v 1.2 2000/08/14 11:16:52 ragge Exp $ */
-
-/*
- * Copyright (c) 2001 Brandon Creighton. All rights reserved.
- * Copyright (c) 2000 Ludd, University of Lule}, Sweden. 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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 "assym.h"
-
-#include <machine/asm.h>
-#include <machine/psl.h>
-
-# Only intended for debugging emulation code (security hole)
-#undef EMULATE_INKERNEL
-
-# Defines to fetch register operands
-#define S_R0 (%fp)
-#define S_R1 4(%fp)
-#define S_R2 8(%fp)
-#define S_R3 12(%fp)
-#define S_R4 16(%fp)
-#define S_R5 20(%fp)
-#define S_R6 24(%fp)
-#define S_R7 28(%fp)
-#define S_R8 32(%fp)
-#define S_R9 36(%fp)
-#define S_R10 40(%fp)
-#define S_R11 44(%fp)
-#define S_AP 48(%fp)
-#define S_FP 52(%fp)
-#define S_SP 56(%fp)
-#define S_PC 60(%fp)
-#define S_PSL 64(%fp)
-
-#define PSL_Q (PSL_N | PSL_Z | PSL_V | PSL_C)
-
-#
-# Emulation of instruction trapped via SCB vector 0x18. (reserved op)
-#
-.globl unimemu; unimemu:
- pushl %r0
- movl 8(%sp),%r0 # get trap address
- movzbl (%r0),%r0 # fetch insn generating trap
- caseb %r0,$0x74,$1 # case to jump to address
-0: .word emodd-0b
- .word polyd-0b
-
-1: movl (%sp)+,%r0 # restore reg
- rsb # continue fault
-
-#
-# switch the code back over to user mode.
-# puts the psl + pc (+ jsb return address) on top of user stack.
-#
-#ifdef EMULATE_INKERNEL
-touser: movl (%sp),-52(%sp) # save rsb address on top of new stack
- movl 4(%sp),%r0 # restore saved reg
- addl2 $12,%sp # pop junk from stack
- pushr $0x7fff # save all regs
- movl %sp,%fp # new frame pointer
- tstl -(%sp) # remember old rsb address
- incl S_PC # skip matching insn
- rsb
-#else
-touser: mfpr $PR_USP,%r0 # get user stack pointer
- movl 4(%sp),-68(%r0) # move already saved r0
- movl (%sp),-72(%r0) # move return address
- movq 12(%sp),-8(%r0) # move pc + psl
- addl2 $12,%sp # remove moved fields from stack
- movl $1f,(%sp) # change return address
- rei
-1: subl2 $8,%sp # trapaddr + psl already on stack
- pushr $0x7ffe # r0 already saved
- subl2 $8,%sp # do not trash r0 + retaddr
- movab 4(%sp),%fp
- incl S_PC # skip matching insn
- rsb
-#endif
-
-#
-# Restore registers, cleanup and continue
-#
-goback: movl %fp,%sp # be sure
- popr $0x7fff # restore all regs
- rei
-
-/*
- * getval: is used by the getval_* functions. Gets the value specified by the
- * current operand specifier pointed to by S_PC. It also increments S_PC.
- */
-getval:
- clrq %r0
- pushr $(R2+R3+R4+R5+R6)
- movl S_PC,%r3 # argument address
- extzv $4,$4,(%r3),%r2 # get mode
- caseb %r2,$0,$0xf
-0: .word getval_literal-0b # 0-3 literal
- .word getval_literal-0b
- .word getval_literal-0b
- .word getval_literal-0b
- .word 2f-0b # 4 indexed
- .word getval_reg-0b # 5 register
- .word getval_regdefer-0b # 6 register deferred
- .word 2f-0b # 7 register deferred
- .word getval_ai-0b # 8 autoincrement
- .word 2f-0b # 9 autoincrement deferred
- .word getval_bytedis-0b # A byte displacement
- .word 2f-0b # B byte displacement deferred
- .word 2f-0b # C word displacement
- .word 2f-0b # D word displacement deferred
- .word getval_longdis-0b # E longword displacement
- .word 2f-0b # F longword displacement deferred
-#ifdef EMULATE_INKERNEL
-2: movab 0f,%r0
- movl %r2,%r1
- brw die
-0: .asciz "getval: missing address mode %d\n"
-#else
-2: .word 0xffff # reserved operand
-#endif
-
- /*
- * 0x00-0x03
- * Literal mode. Note: getval_{d,f}float will *never* use this routine
- * to get literal values, since they treat them differently (see those routines
- * for details).
- */
-getval_literal:
- movzbl (%r3)+,%r0 # correct operand
- brw 4f
-
- /*
- * 0x05
- * Register mode. Grab the register number, yank the value out.
- */
-getval_reg:
- extzv $0,$4,(%r3),%r2 # Get reg number
- incl %r3
- ashl $2,%r2,%r2
- addl3 %fp,%r2,%r5
- bsbw emul_extract
- brw 4f
-
- /*
- * 0x06
- * Register deferred mode. Grab the register number, yank the value out,
- * use that as the address to get the real value.
- */
-getval_regdefer:
- extzv $0,$4,(%r3),%r2 # Get reg number
- incl %r3
- ashl $2,%r2,%r2
- addl2 %fp,%r2
- movl (%r2),%r5
- bsbw emul_extract
- brw 4f
-
- /*
- * 0x08 Autoincrement mode
- * Get the value in the register, use that as the address of our target,
- * then increment the register.
- */
-getval_ai:
- extzv $0,$4,(%r3),%r2 # Get reg number
- incl %r3
-
- /*
- * In the case of the register being PC (0xf), this is called immediate mode;
- * we can treat it the same as any other register, as long as we keep r3
- * and S_PC in sync. We do that here.
- */
- movl %r3,S_PC
-
- ashl $2,%r2,%r2
- addl2 %fp,%r2
- movl (%r2),%r5
- bsbw emul_extract
- addl2 %r6,(%r2)
-
- movl S_PC,%r3 /* if PC did change, S_PC was changed too */
- brw 4f
-
- /*
- * 0xA
- * Byte displacement mode.
- */
-getval_bytedis:
- extzv $0, $4, (%r3), %r2 # get register
- incl %r3
- ashl $2,%r2,%r2
- addl2 %fp,%r2
- movl (%r2),%r5
- movzbl (%r3),%r4
- incl %r3
- addl2 %r4, %r5
- bsbw emul_extract
- brw 4f
-
- /*
- * 0xE
- * Longword displacement mode.
- */
-getval_longdis:
- extzv $0, $4, (%r3), %r2 # get register
- incl %r3
- ashl $2,%r2,%r2
- addl2 %fp,%r2
- movl (%r2),%r5
- movl (%r3)+,%r4
- addl2 %r4, %r5
- bsbw emul_extract
-
-4: movl %r3,S_PC
- popr $(R2+R3+R4+R5+R6)
- rsb
-
-/*
- * emul_extract: used by the getval functions. This extracts exactly r6 bytes
- * from the address in r5 and places them in r0 and r1 (if necessary).
- * 8 is the current maximum length.
- */
-emul_extract:
- cmpl $0x8, %r6
- bgeq 1f
- .word 0xffff # reserved operand
-1:
- caseb %r6, $0x1, $0x7
-0: .word 1f-0b # 1: byte
- .word 2f-0b # 2: word
- .word 9f-0b # unknown
- .word 4f-0b # 4: longword
- .word 9f-0b # unknown
- .word 9f-0b # unknown
- .word 9f-0b # unknown
- .word 8f-0b # 8: quadword
-
-1: movzbl (%r5), %r0
- rsb
-
-2: movzwl (%r5), %r0
- rsb
-
-4: movl (%r5), %r0
- rsb
-
-8: movq (%r5), %r0
- rsb
-
-9:
- .word 0xffff # reserved operand
- rsb
-
-getval_dfloat:
- clrq %r0
- pushr $(R2+R3+R6) # use r2+r3 as scratch reg
- movl S_PC,%r3 # argument address
- extzv $4,$4,(%r3),%r2 # get mode
- caseb %r2,$0,$0x3
-0: .word 1f-0b # 0-3 literal
- .word 1f-0b
- .word 1f-0b
- .word 1f-0b
-
- movl $0x8, %r6
- bsbw getval
- brw 4f
-
-1: insv (%r3),$0,$3,%r0 # insert fraction
- extzv $3,$3,(%r3),%r2 # get exponent
- addl2 $128,%r2 # bias the exponent
- insv %r2,$7,$8,%r0 # insert exponent
- tstb (%r3)+
- movl %r3,S_PC
-4:
- popr $(R2+R3+R6)
- rsb
-
-getval_long:
- clrl %r0
- pushr $(R6+R1)
- movl $0x4, %r6
- bsbw getval
- popr $(R6+R1)
- rsb
-
-getval_word:
- clrl %r0
- pushr $(R6+R1)
- movl $0x2, %r6
- bsbw getval
- popr $(R6+R1)
- rsb
-
-getval_byte:
- clrl %r0
- pushr $(R6+R1) # use r2+r3 as scratch reg
- movl $0x1, %r6
- bsbw getval
- popr $(R6+R1)
- rsb
-
-#
-# getaddr_byte get 4 bytes and stores them in r0. Increases PC.
-#
-getaddr_byte:
- clrl %r0
- pushr $(R2+R3) # use r2+r3 as scratch reg
- movl S_PC,%r3 # argument address
- extzv $4,$4,(%r3),%r2 # get mode
- caseb %r2,$0,$0xf
-0: .word 2f-0b # 0-3 literal
- .word 2f-0b
- .word 2f-0b
- .word 2f-0b
- .word 2f-0b # 4
- .word 6f-0b # 5 register
- .word 5f-0b # 6 deferred
- .word 2f-0b # 7 autodecr (missing)
- .word 2f-0b # 8 autoincr (missing)
- .word 2f-0b # 9 autoincr deferred (missing)
- .word 7f-0b # 10 byte disp
- .word 2f-0b # 11 byte disp deferred (missing)
- .word 8f-0b # 12 word disp
- .word 2f-0b # 13 word disp deferred (missing)
- .word 1f-0b # 14 long disp
- .word 2f-0b # 15 long disp deferred (missing)
-#ifdef EMULATE_INKERNEL
-2: movab 3f,%r0
- movl %r2,%r1
- brw die # reserved operand
-3: .asciz "getaddr_byte: missing address mode %d\n"
-#else
-2: .word 0xffff # reserved operand
-#endif
-
-1: extzv $0,$4,(%r3),%r2 # Get reg number
- incl %r3
- movl (%fp)[%r2],%r0 # Register contents
- addl2 (%r3),%r0 # add displacement
- cmpl %r2,$15 # pc?
- bneq 0f # no, skip
- addl2 $5,%r0 # compensate for displacement size
-0: addl2 $4,%r3 # increase pc
- brw 4f
-
-5: extzv $0,$4,(%r3),%r2 # Get reg number
- incl %r3
- movl (%fp)[%r2],%r0
- brw 4f
-
-7:
- extzv $0, $4, (%r3), %r2 # get register
- incl %r3
- movl (%fp)[%r2],%r0 # Register contents
- pushl %r4
- cvtbl (%r3),%r4
- addl2 %r4,%r0 # add displacement
- movl (%sp)+,%r4
- cmpl %r2,$15 # pc?
- bneq 0f # no, skip
- addl2 $2,%r0 # compensate for displacement size
-0: incl %r3 # increase pc
- brw 4f
-
-8:
- extzv $0, $4, (%r3), %r2 # get register
- incl %r3
- movl (%fp)[%r2],%r0 # Register contents
- pushl %r4
- cvtwl (%r3),%r4
- addl2 %r4,%r0 # add displacement
- movl (%sp)+,%r4
- cmpl %r2,$15 # pc?
- bneq 0f # no, skip
- addl2 $3,%r0 # compensate for displacement size
-0: addl2 $2,%r3 # increase pc
- brw 4f
-
-6: extzv $0,$4,(%r3),%r2 # Get reg number
- incl %r3
- moval (%fp)[%r2],%r0
-
-4: movl %r3,S_PC
- popr $(R2+R3)
- rsb
-
-#
-# Polynomial calculation, d-float
-# Uses d-float instructions, so hopefully d-float is available.
-#
-# polyd MISSING:
-# - check for bad arguments
-# - set PSL flags
-# - do not use d-float instructions (may be emulated)
-#
-polyd: bsbw touser # go back to user mode
- bsbw getval_dfloat # fetches argument to r0/r1
- movq %r0,%r6
- bsbw getval_word
- movl %r0,%r4
- bsbw getaddr_byte
- movl %r0,%r3
- clrq %r0
-# Ok, do the real calculation (Horner's method)
-0: addd2 (%r3)+,%r0 # add constant
- tstl %r4 # more?
- beql 1f # no, exit
- muld2 %r6,%r0 # multiply with arg
- decl %r4 # lower degree
- brb 0b
-
-1: movq %r0,(%fp)
- clrl S_R2
- movl %r3,S_R3
- clrq S_R4
- brw goback
-
-
-#ifdef EMULATE_INKERNEL
-# When we end up somewhere we don't want.
-die: pushl %r1
- pushl %r0
- calls $2,_printf
- movl %fp,%sp
- brw goback # anything may happen
-#endif
-
-# these emodd-related
-#define TMPSIZE 0x20 /* temp bytes -- be careful with this! */
-#define PRECIS 0x7
-#define TMPFRAC1 (%ap)
-#define TMPFRAC2 32(%ap)
-#define TMPFRACTGT 64(%ap)
-#
-# Extended multiply/modulus
-# XXX just EMODD for now
-emodd: bsbw touser
-
- /* Clear the condition codes; we will set them as needed later. */
- bicl2 $PSL_Q, S_PSL
-
- /*
- * We temporarily appropriate ap for the use of TMPFRAC*.
- */
- pushl %ap
- subl2 $(3*TMPSIZE), %sp
- movl %sp, %ap
-
- movc5 $0x0, TMPFRAC1, $0x0, $TMPSIZE, TMPFRAC1
- movc5 $0x0, TMPFRAC2, $0x0, $TMPSIZE, TMPFRAC2
- movc5 $0x0, TMPFRACTGT, $0x0, $TMPSIZE, TMPFRACTGT
-
- clrl -(%sp)
- movl %sp, %r3 /* r3 = addr of exp space (1) */
- clrl -(%sp)
- movl %sp, %r5 /* r5 = addr of exp space (2) */
- subl2 $0x10, %sp
- movl %sp, %r6 /* r6 = addr of allocated target space */
-
- /*
- * Now we package both numbers up and call fltext_De, which
- * will remove the exponent and sign; this will make them
- * easier to work with. They will be in TMPFRAC1 and
- * TMPFRAC2 when done.
- */
- bsbw getval_dfloat # get operand into r0 and r1
-
- /* Check for sign = 0 and exp = 0; if it is, zeroexit. */
- bicl3 $0x7f, %r0, %r4
- cmpl %r4, $0x0
- bneq 1f
- bsbw getval_byte # get multiplier extension operand
- bsbw getval_dfloat # get target operand
- jmp zeroexit
-1:
-
- /* Check for sign = 1 and exp = 0; if it is, do a resopflt. */
- cmpw %r0, $0x8000
- bneq 1f
- bsbw getval_byte # get multiplier extension operand
- bsbw getval_dfloat # get operand into r0 and r1
- extzv $0, $0xff, %r0, %r0 # generate a resopflt -- XXX is this ok?
-1:
- movd %r0, TMPFRACTGT
- bicl3 $0xffff7fff, %r0, %r6 # Extract the sign while we're here.
- bsbw getval_byte # get multiplier extension operand
- movzbl %r0, -(%sp)
- movd %r9, %r0
- pushl %r3
- pushab TMPFRAC1
- movab TMPFRACTGT, -(%sp)
- calls $0x4, fltext_De
-
- bsbw getval_dfloat # get operand into r0 and r1
-
- /* Check for sign = 0 and exp = 0; if it is, zeroexit. */
- bicl3 $0x7f, %r0, %r4
- cmpl %r4, $0x0
- bneq 1f
- bsbw getval_byte # get multiplier extension operand
- bsbw getval_dfloat # get target operand
- jmp zeroexit
-1:
- /* Check for sign = 1 and exp = 0; if it is, do a resopflt. */
- cmpw %r0, $0x8000
- bneq 1f
- bsbw getval_byte # get multiplier extension operand
- bsbw getval_dfloat # get operand into r0 and r1
- extzv $0, $0xff, %r0, %r0 # generate a resopflt -- XXX is this ok?
-1:
-
- movd %r0, TMPFRACTGT
- bicl3 $0xffff7fff, %r0, %r7 # Extract the sign while we're here.
- movzbl $0x0, -(%sp) # no multiplier extension here
- pushl %r5
- pushab TMPFRAC2
- movab TMPFRACTGT, -(%sp)
- calls $0x4, fltext_De
-
- /* first, add exponents */
- addl3 (%r5), (%r3), %r9 /* r9 = exponent (used later) */
- subl2 $0x80, %r9 /* we are excess-128 */
-
- /*
- * Let's calculate the target sign. Signs from multipliers are in r6 and
- * r7, and both the fraction and integer parts have the same sign.
- */
- xorl2 %r7, %r6
-
- pushab TMPFRAC1
- calls $0x1, bitcnt
- movl %r0, %r1 /* r1 = bitcount of TMPFRAC1 */
- pushab TMPFRAC2
- calls $0x1, bitcnt
- movl %r0, %r2 /* r2 = bitcount of TMPFRAC2 */
-
- /*
- * Now we get ready to multiply. This multiplies a byte at a time,
- * converting to double with CVTLD and adding partial results to
- * TMPFRACTGT. There's probably a faster way to do this.
- */
- clrd TMPFRACTGT
- pushr $0x7fc
- subl2 $0x8, %sp /* make some temporary space */
- movl %sp, %r1
- subl2 $0x8, %sp
- movl %sp, %r2
-
- movl $PRECIS, %r5 /* r5 = TMPFRAC1 byte count */
- movl $PRECIS, %r6 /* r6 = TMPFRAC2 byte count */
- clrl %r7
-
-1:
-# addl3 %r5, $TMPFRAC1, %r3 /* r3 - current byte in tmpfrac1 */
- movab TMPFRAC1, %r7
- addl3 %r5, %r7, %r3
-# addl3 %r6, $TMPFRAC2, %r4 /* r4 - current byte in tmpfrac2 */
- movab TMPFRAC2, %r7
- addl3 %r6, %r7, %r4
-
- movzbl (%r3), %r10
- movzbl (%r4), %r11
- mull3 %r10, %r11, %r7
- movl %r7, %r3
- cvtld %r7, (%r2)
-
- subl3 %r5, $0x8, %r8
- subl3 %r6, $0x8, %r9
- addl2 %r8, %r9
- mull2 $0x8, %r9
- subl2 $0x40, %r9
- blss 9f
-
- /* This may be bigger than a longword. Break it up. */
-5: cmpl %r9, $0x1e
- bleq 6f
- subl2 $0x1e, %r9
-
- ashl $0x1e, $0x1, %r8
- cvtld %r8, (%r1)
- muld2 (%r1), (%r2)
- jmp 5b
-6:
- ashl %r9, $0x1, %r8
- cvtld %r8, (%r1)
- muld2 (%r1), (%r2)
- addd2 (%r2), TMPFRACTGT
-
-9:
- cmpl %r5, $0x0
- beql 2f
- decl %r5
- jmp 1b
-2: cmpl %r6, $0x0
- beql 3f
- decl %r6
- movl $PRECIS, %r5
- jmp 1b
-3:
-
- /*
- * At this point, r9 might not reflect the final exponent we will use;
- * i.e., we need post-normalization. Luckily, we still have (in r7)
- * the results from the last individual multiplication handy. Here
- * we calculate how many bits it will take to shift the value in r7
- * so that bit 15 = 1.
- */
- addl2 $0x10, %sp
- movl %r7, 0x14(%sp) /* move r7 onto the frame we're about to pop off */
- popr $0x7fc
-
- clrl %r3 /* r3 = counter */
- movl %r7, %r8 /* r8 = temp */
-1:
- bicl3 $0xffff7fff, %r8, %r5
- bneq 2f
- incl %r3
- ashl $0x1, %r8, %r5
- movl %r5, %r8
- jmp 1b
-2:
-
- /*
- * Now we do post-normalization (by subtracting r3) and
- * put the exponent (in r9) into TMPFRACTGT.
- */
- subl2 %r3, %r9
- insv %r9, $0x7, $0x8, TMPFRACTGT
-
- bisl2 %r6, TMPFRACTGT # set the sign
-
- /*
- * Now we need to separate. CVT* won't work in the case of a
- * >32-bit integer, so we count the integer bits and use ASHQ to
- * shift them away.
- */
- cmpl $0x80, %r9
- blss 7f /* if we are less than 1.0, we can avoid this */
- brw 8f
-7:
- subl3 $0x80, %r9, %r8
-
- movq TMPFRACTGT, TMPFRAC1
- /*
- * Check for integer overflow by comparing the integer bit count.
- * If this is the case, set V in PSL.
- */
- cmpl %r8, $0x20
- blss 3f
- bisl2 $PSL_V, S_PSL
-3:
- cmpl %r8, $0x38
- blss 1f
- /*
- * In the case where we have more than 55 bits in the integer,
- * there aren't any bits left for the fraction. Therefore we're
- * done here; TMPFRAC1 is equal to TMPFRACTGT and TMPFRAC2 is 0.
- */
- movq $0f0.0, TMPFRAC2
- jmp 9f /* we're done, move on */
-1:
- /*
- * We do the mod by using ASHQ to shift and truncate the bits.
- * Before that happens, we have to arrange the bits in a quadword such
- * that the significance increases from start to finish.
- */
-
- movab TMPFRACTGT, %r0
- movab TMPFRAC1, %r1
- movb (%r0), 7(%r1)
- bisb2 $0x80, 7(%r1)
- movw 2(%r0), 5(%r1)
- movw 4(%r0), 3(%r1)
- movb 7(%r0), 2(%r1)
- movb 6(%r0), 1(%r1)
-
- /* Calculate exactly how many bits to shift. */
- subl3 %r8, $0x40, %r7
- mnegl %r7, %r6
- ashq %r6, TMPFRAC1, %r0 # shift right
- ashq %r7, %r0, TMPFRAC2 # shift left
-
- /* Now put it back into a D_. */
- movab TMPFRAC2, %r0
- movab TMPFRAC1, %r1
- extv $0x18, $0x7, 4(%r0), (%r1)
- extzv $0x7, $0x9, TMPFRACTGT, %r2
- insv %r2, $0x7, $0x9, (%r1)
-
- movw 5(%r0), 2(%r1)
- movw 3(%r0), 4(%r1)
- movw 1(%r0), 6(%r1)
-
- # we have the integer in TMPFRAC1, now get the fraction in TMPFRAC2
- subd3 TMPFRAC1, TMPFRACTGT, TMPFRAC2
- jmp 9f
-
-8:
- /*
- * We are less than 1.0; TMPFRAC1 should be 0, and TMPFRAC2 should
- * be equal to TMPFRACTGT.
- */
- movd $0f0.0, TMPFRAC1
- movd TMPFRACTGT, TMPFRAC2
-9:
- /*
- * We're done. We can use CVTDL here, since EMODD is supposed to
- * truncate.
- */
- cvtdl TMPFRAC1, %r4
- bsbw getaddr_byte
- movl %r4, (%r0)
-
- bsbw getaddr_byte
- movq TMPFRAC2, (%r0)
- movd TMPFRAC2, %r0 /* move this here so we can test it later */
-
- /* Clean up sp. */
-
- addl2 $0x74, %sp
- movl (%sp)+, %ap
-
- /*
- * Now set condition codes. We know Z == 0; C is always 0; and V
- * is set above as necessary. Check to see if TMPFRAC2 is
- * negative; if it is, set N.
- */
- tstd %r0
- bgeq 1f /* branch if N == 0 */
- bisl2 $PSL_N, S_PSL
-1:
- brw goback
-zeroexit:
- /* Z == 1, everything else has been cleared already */
- bisl2 $PSL_Z, S_PSL
- bsbw getaddr_byte
- movl $0x0, (%r0)
- bsbw getaddr_byte
- movd $0f0, (%r0)
- brw goback
-
-
-
-/*
- * bitcnt: counts significant bits backwards in a quadword
- * returns number of bits, unless there aren't any;
- * in that case it will return $0xffffffff
- */
-ASENTRY(bitcnt, R1|R2|R3|R4|R5|R6|R7|R8|R9|R10|R11)
- /*
- * Our goal is to factor a common power of 2 out of each of the
- * two factors involved in the multiplication. Once we have that,
- * we can multiply them as integers. More below.
- * Right now we are counting bits, starting from the highest octet
- * of each (the *least* significant bit at this point!) and doing
- * FFSes until we find a bit set.
- */
- movl 4(%ap), %r0
- movl $0x8, %r1
-1: decl %r1
- addl3 %r1, %r0, %r4
- movzbl (%r4), %r2
- ffs $0, $0x20, %r2, %r3
- bneq 2f /* if we found a bit, Z == 0, continue */
- cmpl %r1, $0x0
- jeql 3f /* if r1 is zero and there's no bit set, qw is 0 */
- jmp 1b /* else continue with the loop */
-
-2: /*
- * We found a bit; its position in the byte is in r3, and r1 is the
- * position of the byte in the quadword.
- */
- subl3 %r3, $0x8, %r0
- ashl $0x5, %r1, %r2
- addl2 %r2, %r0
- ret
-
-3: /* this quadword is 0 */
- movl $0xffffffff, %r0
- ret
-
-
-/*
- * The fltext_X routines separate fraction and exponent* bits.
- * They return (via r0) the amount of bits in the fraction.
- *
- * *: exponents are left in excess-128 form
- * D_ floating point first word:
- * F E 7 6 0
- * +-+--------+-------+
- * sign-> |s|exponent| fract.| (10-3F = fraction bits)
- * +-+--------+-------+
- * Significance order: 0-6, 10-1F, 20-2F, 30-3F
- *
- * The fourth argument to fltext_De is the eight extra bits for use
- * in EMOD*, et al. If these bits are not in use, specify 0.
- */
-ASENTRY(fltext_De, R0|R1|R2)
- movl 0x4(%ap), %r0 # r0 - addr of source
- movl 0x8(%ap), %r1 # r1 - addr of fraction destination
-
- movb (%r0), (%r1)
- bisb2 $0x80, (%r1)+ # This is the hidden bit.
-
- movb 3(%r0), (%r1)+
- movb 2(%r0), (%r1)+
- movb 5(%r0), (%r1)+
- movb 4(%r0), (%r1)+
- movb 7(%r0), (%r1)+
- movb 6(%r0), (%r1)+
-
- /*
- * if there are extension bits (EMOD EDIV etc.) they are
- * low-order
- */
- movb 0x10(%ap), (%r1)
-
- movl 0x4(%ap), %r0 # r0 - addr of source
- movl 0xc(%ap), %r2 # r2 - addr of exponent destination
- extzv $0x7, $0x8, (%r0), (%r2) # get exponent out
- ret
diff --git a/sys/arch/vax/vax/urem.s b/sys/arch/vax/vax/urem.s
deleted file mode 100644
index c4730195964..00000000000
--- a/sys/arch/vax/vax/urem.s
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $OpenBSD: urem.s,v 1.5 2013/07/05 21:11:57 miod Exp $ */
-/* $NetBSD: urem.s,v 1.2 1994/10/26 08:03:37 cgd Exp $ */
-
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Donn Seeley at UUNET Technologies, Inc.
- *
- * 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.
- *
- * @(#)urem.s 5.6 (Berkeley) 4/15/91
- */
-
-#include <machine/asm.h>
-
-/*
- * Unsigned modulus, PCC flavor.
- * urem() takes an ordinary dividend/divisor pair;
- */
-
-#define DIVIDEND 4(%ap)
-#define DIVISOR 8(%ap)
-
-ASENTRY(__urem, 0)
- movl 8(%ap),%r2
- jlss Leasy # big divisor: settle by comparison
- movl 4(%ap),%r0
- jlss Lhard # big dividend: need extended division
- divl3 %r2,%r0,%r1 # small divisor and dividend: signed modulus
- mull2 %r2,%r1
- subl2 %r1,%r0
- ret
-Lhard:
- clrl %r1
- ediv %r2,%r0,%r1,%r0
- ret
-Leasy:
- subl3 %r2,DIVIDEND,%r0
- jcc Ldifference # if divisor goes in once, return difference
- movl DIVIDEND,%r0 # if divisor is bigger, return dividend
-Ldifference:
- ret
diff --git a/sys/arch/vax/vax/vm_machdep.c b/sys/arch/vax/vax/vm_machdep.c
deleted file mode 100644
index a47c00ae0c3..00000000000
--- a/sys/arch/vax/vax/vm_machdep.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/* $OpenBSD: vm_machdep.c,v 1.43 2015/05/05 02:13:47 guenther Exp $ */
-/* $NetBSD: vm_machdep.c,v 1.67 2000/06/29 07:14:34 mrg Exp $ */
-
-/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of Lule}.
- * 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 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/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/user.h>
-#include <sys/exec.h>
-#include <sys/vnode.h>
-#include <sys/mount.h>
-#include <sys/device.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/vmparam.h>
-#include <machine/mtpr.h>
-#include <machine/pmap.h>
-#include <machine/pte.h>
-#include <machine/macros.h>
-#include <machine/trap.h>
-#include <machine/pcb.h>
-#include <machine/frame.h>
-#include <machine/cpu.h>
-#include <machine/sid.h>
-
-#include <sys/syscallargs.h>
-
-void
-cpu_exit(struct proc *p)
-{
- pmap_deactivate(p);
- sched_exit(p);
-}
-
-/*
- * Finish a fork operation, with process p2 nearly set up.
- * Copy and update the pcb and trap frame, making the child ready to run.
- *
- * Rig the child's kernel stack so that it will start out in
- * proc_trampoline() and call child_return() with p2 as an
- * argument. This causes the newly-created child process to go
- * directly to user level with an apparent return value of 0 from
- * fork(), while the parent process returns normally.
- *
- * p1 is the process being forked;
- *
- * If an alternate user-level stack is requested (with non-zero values
- * in both the stack and stacksize args), set up the user stack pointer
- * accordingly.
- *
- * cpu_fork() copies parent process trapframe directly into child PCB
- * so that when we swtch() to the child process it will go directly
- * back to user mode without any need to jump back through kernel.
- * We also take away mapping for the second page after pcb, so that
- * we get something like a "red zone".
- * No need for either double-map kernel stack or relocate it when
- * forking.
- */
-void
-cpu_fork(p1, p2, stack, stacksize, func, arg)
- struct proc *p1, *p2;
- void *stack;
- size_t stacksize;
- void (*func)(void *);
- void *arg;
-{
- struct pcb *pcb;
- struct trapframe *tf;
- struct callsframe *cf;
- extern int sret; /* Return address in trap routine */
-
-#ifdef DIAGNOSTIC
- /*
- * if p1 != curproc && p1 == &proc0, we're creating a kernel thread.
- */
- if (p1 != curproc && p1 != &proc0)
- panic("cpu_fork: curproc");
-#endif
-
- /*
- * Clear new pcb
- */
- pcb = &p2->p_addr->u_pcb;
- bzero(pcb, sizeof (*pcb));
-
- /*
- * Copy the trap frame.
- */
- tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) - 1;
- p2->p_addr->u_pcb.framep = tf;
- bcopy(p1->p_addr->u_pcb.framep, tf, sizeof(*tf));
-
- /*
- * Activate address space for the new process.
- * This writes the page table registers to the PCB.
- */
- pcb->pcb_pm = NULL;
- pmap_activate(p2);
-
- /* Mark guard page invalid in kernel stack */
- *kvtopte((u_int)p2->p_addr + REDZONEADDR) &= ~PG_V;
-
- /*
- * Set up the calls frame above (below) the trapframe
- * and populate it with something good.
- * This is so that we can simulate that we were called by a
- * CALLS insn in the function given as argument.
- */
- cf = (struct callsframe *)tf - 1;
- cf->ca_cond = 0;
- cf->ca_maskpsw = 0x20000000; /* CALLS stack frame, no registers */
- cf->ca_pc = (unsigned)&sret; /* return PC; userspace trampoline */
- cf->ca_argno = 1;
- cf->ca_arg1 = (int)arg;
-
- /*
- * Set up internal defs in PCB. This matches the "fake" CALLS frame
- * that we constructed earlier.
- */
- pcb->iftrap = NULL;
- pcb->KSP = (long)cf;
- pcb->FP = (long)cf;
- pcb->AP = (long)&cf->ca_argno;
- pcb->PC = (int)func + 2; /* Skip save mask */
- pcb->pcb_paddr = kvtophys((vaddr_t)pcb);
-
- /*
- * If specified, give the child a different stack.
- */
- if (stack != NULL)
- tf->sp = (u_long)stack + stacksize;
-
- tf->r0 = p1->p_pid; /* parent pid. (shouldn't be needed) */
- tf->r1 = 1;
- tf->psl = PSL_U|PSL_PREVU;
-}
-
-int
-sys_sysarch(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
-
- return (ENOSYS);
-};
-
-/*
- * Map in a bunch of pages read/writeable for the kernel.
- */
-void
-ioaccess(vaddr, paddr, npgs)
- vaddr_t vaddr;
- paddr_t paddr;
- int npgs;
-{
- u_int *pte = (u_int *)kvtopte(vaddr), template;
-
- template = PG_V | PG_KW | PG_PFNUM(paddr);
- while (npgs-- != 0)
- *pte++ = template++;
- mtpr(0, PR_TBIA);
-}
-
-/*
- * Opposite to the above: just forget their mapping.
- */
-void
-iounaccess(vaddr, npgs)
- vaddr_t vaddr;
- int npgs;
-{
- u_int *pte = (u_int *)kvtopte(vaddr);
-
- while (npgs-- != 0)
- *pte++ = PG_NV;
- mtpr(0, PR_TBIA);
-}
-
-/*
- * Map a user I/O request into kernel virtual address space.
- * Note: the pages are already locked by uvm_vslock(), so we
- * do not need to pass an access_type to pmap_enter().
- */
-void
-vmapbuf(bp, len)
- struct buf *bp;
- vsize_t len;
-{
-#if VAX46 || VAX48 || VAX49 || VAX53 || VAX60
- vaddr_t faddr, taddr, off;
- paddr_t pa;
- struct proc *p;
-
- if (phys_map == NULL)
- return;
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vmapbuf");
- p = bp->b_proc;
- faddr = trunc_page((vaddr_t)(bp->b_saveaddr = bp->b_data));
- off = (vaddr_t)bp->b_data - faddr;
- len = round_page(off + len);
- taddr = uvm_km_valloc_wait(phys_map, len);
- bp->b_data = (caddr_t)(taddr + off);
- len = atop(len);
- while (len--) {
- if (pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map), faddr,
- &pa) == FALSE)
- panic("vmapbuf: null page frame");
- pmap_enter(vm_map_pmap(phys_map), taddr, trunc_page(pa),
- PROT_READ | PROT_WRITE,
- PROT_READ | PROT_WRITE | PMAP_WIRED);
- faddr += PAGE_SIZE;
- taddr += PAGE_SIZE;
- }
- pmap_update(vm_map_pmap(phys_map));
-#endif
-}
-
-/*
- * Unmap a previously-mapped user I/O request.
- */
-void
-vunmapbuf(bp, len)
- struct buf *bp;
- vsize_t len;
-{
-#if VAX46 || VAX48 || VAX49 || VAX53 || VAX60
- vaddr_t addr, off;
-
- if (phys_map == NULL)
- return;
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vunmapbuf");
- addr = trunc_page((vaddr_t)bp->b_data);
- off = (vaddr_t)bp->b_data - addr;
- len = round_page(off + len);
- pmap_remove(vm_map_pmap(phys_map), addr, addr + len);
- pmap_update(vm_map_pmap(phys_map));
- uvm_km_free_wakeup(phys_map, addr, len);
- bp->b_data = bp->b_saveaddr;
- bp->b_saveaddr = NULL;
-#endif
-}
diff --git a/sys/arch/vax/vax/vxt.c b/sys/arch/vax/vax/vxt.c
deleted file mode 100644
index 2c8faf9230b..00000000000
--- a/sys/arch/vax/vax/vxt.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* $OpenBSD: vxt.c,v 1.8 2011/09/15 00:48:24 miod Exp $ */
-/*
- * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/types.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/cpu.h>
-#include <machine/mtpr.h>
-#include <machine/ka48.h>
-#include <machine/clock.h>
-
-static void vxt_conf(void);
-static void vxt_init(void);
-static void vxt_memerr(void);
-static int vxt_mchk(caddr_t);
-static void vxt_halt(void);
-static void vxt_reboot(int);
-static void vxt_cache_enable(void);
-static int missing_clkread(struct timespec *, time_t);
-static void missing_clkwrite(void);
-
-/*
- * Declaration of vxt-specific calls.
- */
-
-struct cpu_dep vxt_calls = {
- vxt_init,
- vxt_mchk,
- vxt_memerr,
- vxt_conf,
- missing_clkread,
- missing_clkwrite,
- 6, /* ~VUPS */
- 2, /* SCB pages */
- vxt_halt,
- vxt_reboot,
- NULL,
- hardclock
-};
-
-void
-vxt_conf()
-{
- printf("cpu: VXT\n");
-}
-
-void
-vxt_cache_enable()
-{
- int i, *tmp;
- long *par_ctl = (long *)KA48_PARCTL;
-
- /* Disable cache */
- mtpr(0, PR_CADR); /* disable */
- *par_ctl &= ~KA48_PARCTL_INVENA; /* clear ? invalid enable */
- mtpr(2, PR_CADR); /* flush */
-
- /* Clear caches */
- tmp = (void *)KA48_INVFLT; /* inv filter */
- for (i = 0; i < KA48_INVFLTSZ / sizeof(int); i++)
- tmp[i] = 0;
- *par_ctl |= KA48_PARCTL_INVENA; /* Enable ???? */
- mtpr(4, PR_CADR); /* enable cache */
- *par_ctl |= (KA48_PARCTL_AGS | /* AGS? */
- KA48_PARCTL_NPEN | /* N? Parity Enable */
- KA48_PARCTL_CPEN); /* Cpu parity enable */
-}
-
-void
-vxt_memerr()
-{
- printf("Memory err!\n");
-}
-
-int
-vxt_mchk(addr)
- caddr_t addr;
-{
- panic("Machine check");
- return 0;
-}
-
-void
-vxt_init()
-{
- /* Turn on caches (to speed up execution a bit) */
- vxt_cache_enable();
-}
-
-static void
-vxt_halt()
-{
- asm("halt");
-}
-
-static void
-vxt_reboot(arg)
- int arg;
-{
- asm("halt");
-}
-
-int
-missing_clkread(struct timespec *ts, time_t base)
-{
- printf("WARNING: no TOY clock");
- return EINVAL;
-}
-
-void
-missing_clkwrite()
-{
-}
diff --git a/sys/arch/vax/vax/wscons_machdep.c b/sys/arch/vax/vax/wscons_machdep.c
deleted file mode 100644
index 77308d6a892..00000000000
--- a/sys/arch/vax/vax/wscons_machdep.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/* $OpenBSD: wscons_machdep.c,v 1.6 2008/08/20 19:00:01 miod Exp $ */
-/*
- * Copyright (c) 2006 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice, this permission notice, and the disclaimer below
- * appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-
-#include <machine/nexus.h>
-#include <machine/vsbus.h>
-#include <machine/scb.h>
-#include <machine/sid.h>
-#include <machine/cpu.h>
-
-#include "wsdisplay.h"
-#include "wskbd.h"
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/wscons/wskbdvar.h>
-
-#include "dzkbd.h"
-
-#include <vax/qbus/dzreg.h>
-#include <vax/qbus/dzvar.h>
-#include <vax/dec/dzkbdvar.h>
-
-#include "qsckbd.h"
-
-#include <vax/vxt/qscvar.h>
-
-#include "gpx.h"
-#include "lcg.h"
-#include "lcspx.h"
-#include "legss.h"
-#include "smg.h"
-
-int (*wsfbcninit)(void) = NULL;
-
-#define FRAMEBUFFER_PROTOS(fb) \
-extern int fb##cnprobe(void); \
-extern int fb##cninit(void);
-
-#define FRAMEBUFFER_PROBE(fb) \
-do { \
- if (fb##cnprobe()) { \
- wsfbcninit = fb##cninit; \
- goto found; \
- } \
-} while (0)
-
-FRAMEBUFFER_PROTOS(gpx);
-FRAMEBUFFER_PROTOS(lcg);
-FRAMEBUFFER_PROTOS(lcspx);
-FRAMEBUFFER_PROTOS(legss);
-FRAMEBUFFER_PROTOS(smg);
-
-#include <dev/cons.h>
-cons_decl(ws);
-
-int wscn_ignore = 0; /* nonzero if forcing a new console election */
-
-void
-wscnprobe(struct consdev *cp)
-{
- extern int getmajor(void *); /* conf.c */
- int major;
-
- /*
- * If we forced a console device reelection, mark ourselves as
- * non-working.
- */
- if (wscn_ignore != 0) {
- cp->cn_pri = CN_DEAD;
- return;
- }
-
- major = getmajor(wsdisplayopen);
- if (major < 0)
- return;
-
-#if NGPX > 0
- FRAMEBUFFER_PROBE(gpx);
-#endif
-#if NLCG > 0
- FRAMEBUFFER_PROBE(lcg);
-#endif
-#if NLCSPX > 0
- FRAMEBUFFER_PROBE(lcspx);
-#endif
-#if NLEGSS > 0
- FRAMEBUFFER_PROBE(legss);
-#endif
-#if NSMG > 0
- FRAMEBUFFER_PROBE(smg);
-#endif
- return;
-
-found:
- cp->cn_pri = CN_MIDPRI;
- cp->cn_dev = makedev(major, 0);
-}
-
-void
-wscninit(struct consdev *cp)
-{
- if ((*wsfbcninit)()) {
- /*
- * For some reason, the console initialization failed.
- * Fallback to serial console, by re-electing a console.
- */
- wscn_ignore = 1;
- cninit();
- return;
- }
-
- switch (vax_bustype) {
- case VAX_MBUS:
- case VAX_VSBUS:
-#if NDZKBD > 0
- dzkbd_cnattach();
-#endif
- break;
- case VAX_VXTBUS:
-#if NQSCKBD > 0
- qsckbd_cnattach(QSC_LINE_KEYBOARD);
-#endif
- break;
- }
-}
-
-void
-wscnputc(dev_t dev, int c)
-{
-#if NWSDISPLAY > 0
- wsdisplay_cnputc(dev, c);
-#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/vax/vsa/asc_vsbus.c b/sys/arch/vax/vsa/asc_vsbus.c
deleted file mode 100644
index 8a64411f4a7..00000000000
--- a/sys/arch/vax/vsa/asc_vsbus.c
+++ /dev/null
@@ -1,492 +0,0 @@
-/* $OpenBSD: asc_vsbus.c,v 1.17 2015/02/09 22:38:18 miod Exp $ */
-/* $NetBSD: asc_vsbus.c,v 1.22 2001/02/04 20:36:32 ragge Exp $ */
-
-/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum.
- *
- * 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 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.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <sys/reboot.h>
-#include <sys/queue.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <scsi/scsi_message.h>
-
-#include <machine/bus.h>
-#include <machine/vmparam.h>
-
-#include <dev/ic/ncr53c9xreg.h>
-#include <dev/ic/ncr53c9xvar.h>
-
-#include <machine/cpu.h>
-#include <machine/sid.h>
-#include <machine/scb.h>
-#include <machine/vsbus.h>
-#include <machine/clock.h> /* for SCSI ctlr ID# XXX */
-
-struct asc_vsbus_softc {
- struct ncr53c9x_softc sc_ncr53c9x; /* Must be first */
- struct evcount sc_intrcnt; /* count interrupts */
- int sc_cvec; /* vector */
- bus_space_tag_t sc_bst; /* bus space tag */
- bus_space_handle_t sc_bsh; /* bus space handle */
- bus_space_handle_t sc_dirh; /* scsi direction handle */
- bus_space_handle_t sc_adrh; /* scsi address handle */
- bus_space_handle_t sc_ncrh; /* ncr bus space handle */
- bus_dma_tag_t sc_dmat; /* bus dma tag */
- bus_dmamap_t sc_dmamap;
- caddr_t *sc_dmaaddr;
- size_t *sc_dmalen;
- size_t sc_dmasize;
- unsigned int sc_flags;
-#define ASC_FROMMEMORY 0x0001 /* Must be 1 */
-#define ASC_DMAACTIVE 0x0002
-#define ASC_MAPLOADED 0x0004
- unsigned long sc_xfers;
-};
-
-#define ASC_REG_KA46_ADR 0x0000
-#define ASC_REG_KA46_DIR 0x000C
-#define ASC_REG_KA49_ADR 0x0000
-#define ASC_REG_KA49_DIR 0x0004
-#define ASC_REG_NCR 0x0080
-#define ASC_REG_END 0x00B0
-
-#define ASC_MAXXFERSIZE 65536
-#define ASC_FREQUENCY 25000000
-
-extern struct cfdriver sd_cd;
-
-int asc_vsbus_match(struct device *, void *, void *);
-void asc_vsbus_attach(struct device *, struct device *, void *);
-
-struct cfattach asc_vsbus_ca = {
- sizeof(struct asc_vsbus_softc), asc_vsbus_match, asc_vsbus_attach
-};
-
-struct cfdriver asc_cd = {
- NULL, "asc", DV_DULL
-};
-
-/*
- * Functions and the switch for the MI code
- */
-u_char asc_vsbus_read_reg(struct ncr53c9x_softc *, int);
-void asc_vsbus_write_reg(struct ncr53c9x_softc *, int, u_char);
-int asc_vsbus_dma_isintr(struct ncr53c9x_softc *);
-void asc_vsbus_dma_reset(struct ncr53c9x_softc *);
-int asc_vsbus_dma_intr(struct ncr53c9x_softc *);
-int asc_vsbus_dma_setup(struct ncr53c9x_softc *, caddr_t *,
- size_t *, int, size_t *);
-void asc_vsbus_dma_go(struct ncr53c9x_softc *);
-void asc_vsbus_dma_stop(struct ncr53c9x_softc *);
-int asc_vsbus_dma_isactive(struct ncr53c9x_softc *);
-int asc_vsbus_controller_id(void);
-
-static struct ncr53c9x_glue asc_vsbus_glue = {
- asc_vsbus_read_reg,
- asc_vsbus_write_reg,
- asc_vsbus_dma_isintr,
- asc_vsbus_dma_reset,
- asc_vsbus_dma_intr,
- asc_vsbus_dma_setup,
- asc_vsbus_dma_go,
- asc_vsbus_dma_stop,
- asc_vsbus_dma_isactive,
- NULL,
-};
-
-static u_int8_t asc_attached; /* can't have more than one asc */
-
-int
-asc_vsbus_match(struct device *parent, void *conf, void *aux)
-{
- struct vsbus_attach_args *va = aux;
- struct cfdata *cf = conf;
- volatile u_int8_t *ncr_regs;
- volatile int dummy;
-
- if (asc_attached)
- return 0;
-
- switch (vax_boardtype) {
- case VAX_BTYP_46:
- case VAX_BTYP_48:
- if (cf->cf_loc[0] != (SCA_REGS | 0x80))
- return 0;
- break;
- case VAX_BTYP_49:
- case VAX_BTYP_1303:
- if (cf->cf_loc[0] != (SCA_REGS_KA49 | 0x80))
- return 0;
- break;
- default:
- return 0;
- }
-
- ncr_regs = (volatile u_int8_t *) va->va_addr;
-
- /* *** need to generate an interrupt here
- * From trial and error, I've determined that an INT is generated
- * only when the following sequence of events occurs:
- * 1) The interrupt status register (0x05) must be read.
- * 2) SCSI bus reset interrupt must be enabled
- * 3) SCSI bus reset command must be sent
- * 4) NOP command must be sent
- */
-
- dummy = ncr_regs[NCR_INTR << 2] & 0xFF;
- ncr_regs[NCR_CFG1 << 2] = asc_vsbus_controller_id(); /* turn on INT
- for SCSI reset */
- ncr_regs[NCR_CMD << 2] = NCRCMD_RSTSCSI; /* send the reset */
- ncr_regs[NCR_CMD << 2] = NCRCMD_NOP; /* send a NOP */
- DELAY(10000);
-
- dummy = ncr_regs[NCR_INTR << 2] & 0xFF;
- return (dummy & NCRINTR_SBR) != 0;
-}
-
-
-/*
- * Attach this instance, and then all the sub-devices
- */
-void
-asc_vsbus_attach(struct device *parent, struct device *self, void *aux)
-{
- struct vsbus_attach_args *va = aux;
- struct asc_vsbus_softc *asc = (void *)self;
- struct ncr53c9x_softc *sc = &asc->sc_ncr53c9x;
- int error;
-
- asc_attached = 1;
- /*
- * Set up glue for MI code early; we use some of it here.
- */
- sc->sc_glue = &asc_vsbus_glue;
-
- asc->sc_bst = va->va_iot;
- asc->sc_dmat = va->va_dmat;
-
- error = bus_space_map(asc->sc_bst, va->va_paddr - ASC_REG_NCR,
- ASC_REG_END, 0, &asc->sc_bsh);
- if (error) {
- printf(": failed to map registers: error=%d\n", error);
- return;
- }
- error = bus_space_subregion(asc->sc_bst, asc->sc_bsh, ASC_REG_NCR,
- ASC_REG_END - ASC_REG_NCR, &asc->sc_ncrh);
- if (error) {
- printf(": failed to map ncr registers: error=%d\n", error);
- return;
- }
- if (vax_boardtype == VAX_BTYP_46 || vax_boardtype == VAX_BTYP_48) {
- error = bus_space_subregion(asc->sc_bst, asc->sc_bsh,
- ASC_REG_KA46_ADR, sizeof(u_int32_t), &asc->sc_adrh);
- if (error) {
- printf(": failed to map adr register: error=%d\n",
- error);
- return;
- }
- error = bus_space_subregion(asc->sc_bst, asc->sc_bsh,
- ASC_REG_KA46_DIR, sizeof(u_int32_t), &asc->sc_dirh);
- if (error) {
- printf(": failed to map dir register: error=%d\n",
- error);
- return;
- }
- } else {
- /* This is a gross and disgusting kludge but it'll
- * save a bunch of ugly code. Unlike the VS4000/60,
- * the SCSI Address and direction registers are not
- * near the SCSI NCR registers and are inside the
- * block of general VAXstation registers. So we grab
- * them from there and knowing the internals of the
- * bus_space implementation, we cast to bus_space_handles.
- */
- struct vsbus_softc *vsc = (struct vsbus_softc *) parent;
- asc->sc_adrh = (bus_space_handle_t) (vsc->sc_vsregs + ASC_REG_KA49_ADR);
- asc->sc_dirh = (bus_space_handle_t) (vsc->sc_vsregs + ASC_REG_KA49_DIR);
-#if 0
- printf("\n%s: adrh=0x%08lx dirh=0x%08lx", self->dv_xname,
- asc->sc_adrh, asc->sc_dirh);
- ncr53c9x_debug = NCR_SHOWDMA|NCR_SHOWINTS|NCR_SHOWCMDS|NCR_SHOWPHASE|NCR_SHOWSTART|NCR_SHOWMSGS;
-#endif
- }
- error = bus_dmamap_create(asc->sc_dmat, ASC_MAXXFERSIZE, 1,
- ASC_MAXXFERSIZE, 0, BUS_DMA_NOWAIT, &asc->sc_dmamap);
-
- sc->sc_id = asc_vsbus_controller_id();
- sc->sc_freq = ASC_FREQUENCY;
-
- /* gimme MHz */
- sc->sc_freq /= 1000000;
-
- scb_vecalloc(va->va_cvec, (void (*)(void *)) ncr53c9x_intr,
- &asc->sc_ncr53c9x, SCB_ISTACK, &asc->sc_intrcnt);
- asc->sc_cvec = va->va_cvec;
- evcount_attach(&asc->sc_intrcnt, self->dv_xname, &asc->sc_cvec);
-
- /*
- * XXX More of this should be in ncr53c9x_attach(), but
- * XXX should we really poke around the chip that much in
- * XXX the MI code? Think about this more...
- */
-
- /*
- * Set up static configuration info.
- */
- sc->sc_cfg1 = sc->sc_id | NCRCFG1_PARENB;
- sc->sc_cfg2 = NCRCFG2_SCSI2;
- sc->sc_cfg3 = 0;
- sc->sc_rev = NCR_VARIANT_NCR53C94;
-
- /*
- * XXX minsync and maxxfer _should_ be set up in MI code,
- * XXX but it appears to have some dependency on what sort
- * XXX of DMA we're hooked up to, etc.
- */
-
- /*
- * This is the value used to start sync negotiations
- * Note that the NCR register "SYNCTP" is programmed
- * in "clocks per byte", and has a minimum value of 4.
- * The SCSI period used in negotiation is one-fourth
- * of the time (in nanoseconds) needed to transfer one byte.
- * Since the chip's clock is given in MHz, we have the following
- * formula: 4 * period = (1000 / freq) * 4
- */
- sc->sc_minsync = (1000 / sc->sc_freq);
- sc->sc_maxxfer = 64 * 1024;
-
- /* Do the common parts of attachment. */
- ncr53c9x_attach(sc);
-}
-
-/*
- * Return the host controllers SCSI ID.
- * The factory default is 6 (unlike most vendors who use 7), but this can
- * be changed in the prom.
- */
-int
-asc_vsbus_controller_id()
-{
- switch (vax_boardtype) {
-#if defined(VAX46) || defined(VAX48) || defined(VAX49)
- case VAX_BTYP_46:
- case VAX_BTYP_48:
- case VAX_BTYP_49:
- return (clk_page[0xbc / 2] >> clk_tweak) & 7;
-#endif
- default:
- return 6; /* XXX need to get this from VMB */
- }
-}
-
-/*
- * Glue functions.
- */
-
-u_char
-asc_vsbus_read_reg(struct ncr53c9x_softc *sc, int reg)
-{
- struct asc_vsbus_softc *asc = (struct asc_vsbus_softc *)sc;
-
- return bus_space_read_1(asc->sc_bst, asc->sc_ncrh,
- reg * sizeof(u_int32_t));
-}
-
-void
-asc_vsbus_write_reg(struct ncr53c9x_softc *sc, int reg, u_char val)
-{
- struct asc_vsbus_softc *asc = (struct asc_vsbus_softc *)sc;
-
- bus_space_write_1(asc->sc_bst, asc->sc_ncrh,
- reg * sizeof(u_int32_t), val);
-}
-
-int
-asc_vsbus_dma_isintr(struct ncr53c9x_softc *sc)
-{
- struct asc_vsbus_softc *asc = (struct asc_vsbus_softc *)sc;
- return bus_space_read_1(asc->sc_bst, asc->sc_ncrh,
- NCR_STAT * sizeof(u_int32_t)) & NCRSTAT_INT;
-}
-
-void
-asc_vsbus_dma_reset(struct ncr53c9x_softc *sc)
-{
- struct asc_vsbus_softc *asc = (struct asc_vsbus_softc *)sc;
-
- if (asc->sc_flags & ASC_MAPLOADED)
- bus_dmamap_unload(asc->sc_dmat, asc->sc_dmamap);
- asc->sc_flags &= ~(ASC_DMAACTIVE|ASC_MAPLOADED);
-}
-
-int
-asc_vsbus_dma_intr(struct ncr53c9x_softc *sc)
-{
- struct asc_vsbus_softc *asc = (struct asc_vsbus_softc *)sc;
- u_int tcl, tcm;
- int trans, resid;
-
- if ((asc->sc_flags & ASC_DMAACTIVE) == 0)
- panic("asc_vsbus_dma_intr: DMA wasn't active");
-
- asc->sc_flags &= ~ASC_DMAACTIVE;
-
- if (asc->sc_dmasize == 0) {
- /* A "Transfer Pad" operation completed */
- tcl = NCR_READ_REG(sc, NCR_TCL);
- tcm = NCR_READ_REG(sc, NCR_TCM);
- NCR_DMA(("asc_vsbus_intr: discarded %d bytes (tcl=%d, tcm=%d)\n",
- tcl | (tcm << 8), tcl, tcm));
- return 0;
- }
-
- resid = 0;
- if ((resid = (NCR_READ_REG(sc, NCR_FFLAG) & NCRFIFO_FF)) != 0) {
- NCR_DMA(("asc_vsbus_intr: empty FIFO of %d ", resid));
- DELAY(1);
- }
- if (asc->sc_flags & ASC_MAPLOADED) {
- bus_dmamap_sync(asc->sc_dmat, asc->sc_dmamap,
- 0, asc->sc_dmasize,
- asc->sc_flags & ASC_FROMMEMORY
- ? BUS_DMASYNC_POSTWRITE
- : BUS_DMASYNC_POSTREAD);
- bus_dmamap_unload(asc->sc_dmat, asc->sc_dmamap);
- }
- asc->sc_flags &= ~ASC_MAPLOADED;
-
- resid += (tcl = NCR_READ_REG(sc, NCR_TCL));
- resid += (tcm = NCR_READ_REG(sc, NCR_TCM)) << 8;
-
- trans = asc->sc_dmasize - resid;
- if (trans < 0) { /* transferred < 0 ? */
- printf("%s: xfer (%d) > req (%lu)\n",
- __func__, trans, (u_long) asc->sc_dmasize);
- trans = asc->sc_dmasize;
- }
- NCR_DMA(("asc_vsbus_intr: tcl=%d, tcm=%d; trans=%d, resid=%d\n",
- tcl, tcm, trans, resid));
-
- *asc->sc_dmalen -= trans;
- *asc->sc_dmaaddr += trans;
-
- asc->sc_xfers++;
- return 0;
-}
-
-int
-asc_vsbus_dma_setup(struct ncr53c9x_softc *sc, caddr_t *addr, size_t *len,
- int datain, size_t *dmasize)
-{
- struct asc_vsbus_softc *asc = (struct asc_vsbus_softc *)sc;
-
- asc->sc_dmaaddr = addr;
- asc->sc_dmalen = len;
- if (datain) {
- asc->sc_flags &= ~ASC_FROMMEMORY;
- } else {
- asc->sc_flags |= ASC_FROMMEMORY;
- }
-#ifdef DIAGNOSTIC
- if ((vaddr_t) *asc->sc_dmaaddr < VM_MIN_KERNEL_ADDRESS)
- panic("asc_vsbus_dma_setup: dma address (%p) outside of kernel",
- *asc->sc_dmaaddr);
-#endif
-
- NCR_DMA(("%s: start %d@%p,%d\n", sc->sc_dev.dv_xname,
- (int)*asc->sc_dmalen, *asc->sc_dmaaddr, (asc->sc_flags & ASC_FROMMEMORY)));
- *dmasize = asc->sc_dmasize = min(*dmasize, ASC_MAXXFERSIZE);
-
- if (asc->sc_dmasize) {
- if (bus_dmamap_load(asc->sc_dmat, asc->sc_dmamap,
- *asc->sc_dmaaddr, asc->sc_dmasize,
- NULL /* kernel address */,
- BUS_DMA_NOWAIT|VAX_BUS_DMA_SPILLPAGE))
- panic("%s: cannot load dma map", sc->sc_dev.dv_xname);
- bus_dmamap_sync(asc->sc_dmat, asc->sc_dmamap,
- 0, asc->sc_dmasize,
- asc->sc_flags & ASC_FROMMEMORY
- ? BUS_DMASYNC_PREWRITE
- : BUS_DMASYNC_PREREAD);
- bus_space_write_4(asc->sc_bst, asc->sc_adrh, 0,
- asc->sc_dmamap->dm_segs[0].ds_addr);
- bus_space_write_4(asc->sc_bst, asc->sc_dirh, 0,
- asc->sc_flags & ASC_FROMMEMORY);
- NCR_DMA(("%s: dma-load %lu@0x%08lx\n", sc->sc_dev.dv_xname,
- asc->sc_dmamap->dm_segs[0].ds_len,
- asc->sc_dmamap->dm_segs[0].ds_addr));
- asc->sc_flags |= ASC_MAPLOADED;
- }
-
- return 0;
-}
-
-void
-asc_vsbus_dma_go(struct ncr53c9x_softc *sc)
-{
- struct asc_vsbus_softc *asc = (struct asc_vsbus_softc *)sc;
-
- asc->sc_flags |= ASC_DMAACTIVE;
-}
-
-void
-asc_vsbus_dma_stop(struct ncr53c9x_softc *sc)
-{
- struct asc_vsbus_softc *asc = (struct asc_vsbus_softc *)sc;
-
- if (asc->sc_flags & ASC_MAPLOADED) {
- bus_dmamap_sync(asc->sc_dmat, asc->sc_dmamap,
- 0, asc->sc_dmasize,
- asc->sc_flags & ASC_FROMMEMORY
- ? BUS_DMASYNC_POSTWRITE
- : BUS_DMASYNC_POSTREAD);
- bus_dmamap_unload(asc->sc_dmat, asc->sc_dmamap);
- }
-
- asc->sc_flags &= ~(ASC_DMAACTIVE|ASC_MAPLOADED);
-}
-
-int
-asc_vsbus_dma_isactive(struct ncr53c9x_softc *sc)
-{
- struct asc_vsbus_softc *asc = (struct asc_vsbus_softc *)sc;
-
- return (asc->sc_flags & ASC_DMAACTIVE) != 0;
-}
diff --git a/sys/arch/vax/vsa/dz_ibus.c b/sys/arch/vax/vsa/dz_ibus.c
deleted file mode 100644
index aab44e9705b..00000000000
--- a/sys/arch/vax/vsa/dz_ibus.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/* $OpenBSD: dz_ibus.c,v 1.29 2011/09/11 19:29:01 miod Exp $ */
-/* $NetBSD: dz_ibus.c,v 1.15 1999/08/27 17:50:42 ragge Exp $ */
-/*
- * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/sid.h>
-#include <machine/vsbus.h>
-#include <machine/cpu.h>
-#include <machine/scb.h>
-
-#include <vax/qbus/dzreg.h>
-#include <vax/qbus/dzvar.h>
-
-#include <vax/dec/dzkbdvar.h>
-
-#include <dev/cons.h>
-
-#include "dzkbd.h"
-#include "dzms.h"
-
-int dz_vsbus_match(struct device *, struct cfdata *, void *);
-void dz_vsbus_attach(struct device *, struct device *, void *);
-
-struct cfattach dz_vsbus_ca = {
- sizeof(struct dz_softc), (cfmatch_t)dz_vsbus_match, dz_vsbus_attach
-};
-
-#define DZ_VSBUS_CSR 0
-#define DZ_VSBUS_RBUF 4
-#define DZ_VSBUS_DTR 9
-#define DZ_VSBUS_BREAK 13
-#define DZ_VSBUS_TBUF 12
-#define DZ_VSBUS_TCR 8
-#define DZ_VSBUS_DCD 13
-#define DZ_VSBUS_RING 13
-
-int
-dz_vsbus_match(parent, cf, aux)
- struct device *parent;
- struct cfdata *cf;
- void *aux;
-{
- struct vsbus_attach_args *va = aux;
- volatile uint16_t *dzP;
- short i;
-
-#if VAX53 || VAX49
- if (vax_boardtype == VAX_BTYP_49 ||
- vax_boardtype == VAX_BTYP_1303)
- if (cf->cf_loc[0] != DZ_CSR_KA49)
- return 0; /* don't probe unnecessarily */
-#endif
-
- dzP = (volatile uint16_t *)va->va_addr;
- i = dzP[DZ_VSBUS_TCR / 2];
- dzP[DZ_VSBUS_CSR / 2] = DZ_CSR_MSE|DZ_CSR_TXIE;
- dzP[DZ_VSBUS_TCR / 2] = 0;
- DELAY(1000);
- dzP[DZ_VSBUS_TCR / 2] = 1;
- DELAY(100000);
- dzP[DZ_VSBUS_TCR / 2] = i;
-
- /* If the device doesn't exist, no interrupt has been generated */
-
- return 1;
-}
-
-void
-dz_vsbus_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct dz_softc *sc = (void *)self;
- struct vsbus_attach_args *va = aux;
-#if NDZKBD > 0 || NDZMS > 0
- struct dzkm_attach_args daa;
-#endif
- extern vaddr_t dz_console_regs;
- vaddr_t dz_regs;
-
- printf(": ");
-
- /*
- * This assumes that systems where dz@vsbus exist and can be
- * the console device, can only have one instance of dz@vsbus.
- * So far, so good.
- */
- if (dz_console_regs != 0) {
- dz_regs = dz_console_regs;
- printf("console, ");
- } else
- dz_regs = vax_map_physmem(va->va_paddr, 1);
-
- /*
- * XXX - This is evil and ugly, but...
- * due to the nature of how bus_space_* works on VAX, this will
- * be perfectly good until everything is converted.
- */
- sc->sc_ioh = dz_regs;
- sc->sc_dr.dr_csr = DZ_VSBUS_CSR;
- sc->sc_dr.dr_rbuf = DZ_VSBUS_RBUF;
- sc->sc_dr.dr_dtr = DZ_VSBUS_DTR;
- sc->sc_dr.dr_break = DZ_VSBUS_BREAK;
- sc->sc_dr.dr_tbuf = DZ_VSBUS_TBUF;
- sc->sc_dr.dr_tcr = DZ_VSBUS_TCR;
- sc->sc_dr.dr_dcd = DZ_VSBUS_DCD;
- sc->sc_dr.dr_ring = DZ_VSBUS_RING;
-
- sc->sc_type = DZ_DZV;
-
- /* no modem control bits except on line 2 */
- sc->sc_dsr = (1 << 0) | (1 << 1) | (1 << 3);
-
- sc->sc_rcvec = va->va_cvec;
- scb_vecalloc(sc->sc_rcvec, dzxint, sc, SCB_ISTACK, &sc->sc_tintrcnt);
- sc->sc_tcvec = va->va_cvec - 4;
- scb_vecalloc(sc->sc_tcvec, dzrint, sc, SCB_ISTACK, &sc->sc_rintrcnt);
- evcount_attach(&sc->sc_rintrcnt, sc->sc_dev.dv_xname, &sc->sc_rcvec);
- evcount_attach(&sc->sc_tintrcnt, sc->sc_dev.dv_xname, &sc->sc_tcvec);
-
- printf("4 lines");
-
- dzattach(sc);
-
- if (dz_can_have_kbd()) {
-#if NDZKBD > 0
- extern struct consdev wsdisplay_cons;
-
- daa.daa_line = 0;
- DZ_WRITE_WORD(sc, dr_rbuf, DZ_LPR_RX_ENABLE |
- (DZ_LPR_B4800 << 8) | DZ_LPR_8_BIT_CHAR | daa.daa_line);
- daa.daa_flags =
- (cn_tab == &wsdisplay_cons ? DZKBD_CONSOLE : 0);
- config_found(self, &daa, dz_print);
-#endif
-#if NDZMS > 0
- daa.daa_line = 1;
- DZ_WRITE_WORD(sc, dr_rbuf, DZ_LPR_RX_ENABLE |
- (DZ_LPR_B4800 << 8) | DZ_LPR_8_BIT_CHAR | DZ_LPR_PARENB |
- DZ_LPR_OPAR | daa.daa_line);
- daa.daa_flags = 0;
- config_found(self, &daa, dz_print);
-#endif
- }
-
-#if 0
- s = spltty();
- dzrint(sc);
- dzxint(sc);
- splx(s);
-#endif
-}
diff --git a/sys/arch/vax/vsa/gpx.c b/sys/arch/vax/vsa/gpx.c
deleted file mode 100644
index ad2b732ce31..00000000000
--- a/sys/arch/vax/vsa/gpx.c
+++ /dev/null
@@ -1,1405 +0,0 @@
-/* $OpenBSD: gpx.c,v 1.25 2014/12/23 21:39:12 miod Exp $ */
-/*
- * Copyright (c) 2006 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice, this permission notice, and the disclaimer below
- * appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*-
- * Copyright (c) 1988 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.
- *
- * @(#)qd.c 7.1 (Berkeley) 6/28/91
- */
-
-/************************************************************************
-* *
-* Copyright (c) 1985-1988 by *
-* Digital Equipment Corporation, Maynard, MA *
-* All rights reserved. *
-* *
-* This software is furnished under a license and may be used and *
-* copied only in accordance with the terms of such license and *
-* with the inclusion of the above copyright notice. This *
-* software or any other copies thereof may not be provided or *
-* otherwise made available to any other person. No title to and *
-* ownership of the software is hereby transferred. *
-* *
-* The information in this software is subject to change without *
-* notice and should not be construed as a commitment by Digital *
-* Equipment Corporation. *
-* *
-* Digital assumes no responsibility for the use or reliability *
-* of its software on equipment which is not supplied by Digital. *
-* *
-*************************************************************************/
-
-/*
- * Driver for the GPX color option on VAXstation 3100, based on the
- * MicroVAX II qdss driver.
- *
- * The frame buffer memory itself is not directly accessible (unlike
- * the on-board monochrome smg frame buffer), and writes through the
- * Dragon chip can only happen in multiples of 16 pixels, horizontally.
- *
- * Because of this limitation, the font image is copied to offscreen
- * memory (which there is plenty of), and screen to screen blt operations
- * are done for everything.
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-
-#include <machine/sid.h>
-#include <machine/cpu.h>
-#include <machine/ka420.h>
-#include <machine/scb.h>
-#include <machine/vsbus.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <dev/cons.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-#include <dev/wsfont/wsfont.h>
-
-#include <dev/ic/bt458reg.h>
-#if 0
-#include <dev/ic/dc503reg.h>
-#endif
-#include <vax/qbus/qdreg.h>
-
-#define GPXADDR 0x3c000000 /* base address on VAXstation 3100 */
-
-#define GPX_ADDER_OFFSET 0x0000
-#define GPX_VDAC_OFFSET 0x0300
-#define GPX_CURSOR_OFFSET 0x0400 /* DC503 */
-#define GPX_READBACK_OFFSET 0x0500
-
-#define GPX_WIDTH 1024
-#define GPX_VISHEIGHT 864
-#define GPX_HEIGHT 2048
-
-/* 4 plane option RAMDAC */
-struct ramdac4 {
- u_int16_t colormap[16];
- u_int8_t unknown[0x20];
- u_int16_t cursormap[4];
- u_int8_t unknown2[0x18];
- u_int16_t control;
-#define RAMDAC4_INIT 0x0047
-#define RAMDAC4_ENABLE 0x0002
-};
-
-/* 8 plane option RAMDAC - Bt458 or compatible */
-struct ramdac8 {
- u_int16_t address;
- u_int16_t cmapdata;
- u_int16_t control;
- u_int16_t omapdata;
-};
-
-int gpx_match(struct device *, void *, void *);
-void gpx_attach(struct device *, struct device *, void *);
-
-struct gpx_screen {
- struct rasops_info ss_ri;
- int ss_console;
- u_int ss_depth;
- u_int ss_gpr; /* font glyphs per row */
- struct adder *ss_adder;
- void *ss_vdac;
- u_int8_t ss_cmap[256 * 3];
-#if 0
- struct dc503reg *ss_cursor;
- u_int16_t ss_curcmd;
-#endif
-};
-
-/* for console */
-struct gpx_screen gpx_consscr;
-
-struct gpx_softc {
- struct device sc_dev;
- struct gpx_screen *sc_scr;
- int sc_nscreens;
-};
-
-struct cfattach gpx_ca = {
- sizeof(struct gpx_softc), gpx_match, gpx_attach,
-};
-
-struct cfdriver gpx_cd = {
- NULL, "gpx", DV_DULL
-};
-
-struct wsscreen_descr gpx_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *_gpx_scrlist[] = {
- &gpx_stdscreen,
-};
-
-const struct wsscreen_list gpx_screenlist = {
- sizeof(_gpx_scrlist) / sizeof(struct wsscreen_descr *),
- _gpx_scrlist,
-};
-
-int gpx_ioctl(void *, u_long, caddr_t, int, struct proc *);
-paddr_t gpx_mmap(void *, off_t, int);
-int gpx_alloc_screen(void *, const struct wsscreen_descr *,
- void **, int *, int *, long *);
-void gpx_free_screen(void *, void *);
-int gpx_show_screen(void *, void *, int,
- void (*) (void *, int, int), void *);
-int gpx_load_font(void *, void *, struct wsdisplay_font *);
-int gpx_list_font(void *, struct wsdisplay_font *);
-void gpx_burner(void *, u_int, u_int);
-
-const struct wsdisplay_accessops gpx_accessops = {
- .ioctl = gpx_ioctl,
- .mmap = gpx_mmap,
- .alloc_screen = gpx_alloc_screen,
- .free_screen = gpx_free_screen,
- .show_screen = gpx_show_screen,
- .load_font = gpx_load_font,
- .list_font = gpx_list_font,
- .burn_screen = gpx_burner
-};
-
-void gpx_clear_screen(struct gpx_screen *);
-void gpx_copyrect(struct gpx_screen *, int, int, int, int, int, int);
-void gpx_fillrect(struct gpx_screen *, int, int, int, int, long, u_int);
-int gpx_getcmap(struct gpx_screen *, struct wsdisplay_cmap *);
-void gpx_loadcmap(struct gpx_screen *, int, int);
-int gpx_putcmap(struct gpx_screen *, struct wsdisplay_cmap *);
-void gpx_resetcmap(struct gpx_screen *);
-void gpx_reset_viper(struct gpx_screen *);
-int gpx_setup_screen(struct gpx_screen *);
-void gpx_upload_font(struct gpx_screen *);
-int gpx_viper_write(struct gpx_screen *, u_int, u_int16_t);
-int gpx_wait(struct gpx_screen *, int);
-
-int gpx_copycols(void *, int, int, int, int);
-int gpx_copyrows(void *, int, int, int);
-int gpx_do_cursor(struct rasops_info *);
-int gpx_erasecols(void *, int, int, int, long);
-int gpx_eraserows(void *, int, int, long);
-int gpx_putchar(void *, int, int, u_int, long);
-
-/*
- * Autoconf glue
- */
-
-int
-gpx_match(struct device *parent, void *vcf, void *aux)
-{
- struct vsbus_attach_args *va = aux;
- volatile struct adder *adder;
- vaddr_t tmp;
- u_int depth;
- u_short status;
- extern struct consdev wsdisplay_cons;
- extern int oldvsbus;
-
- switch (vax_boardtype) {
- default:
- return (0);
-
- case VAX_BTYP_410:
- case VAX_BTYP_420:
- case VAX_BTYP_43:
- if (va->va_paddr != GPXADDR)
- return (0);
-
- /* not present on microvaxes */
- if ((vax_confdata & KA420_CFG_MULTU) != 0)
- return (0);
-
- if ((vax_confdata & KA420_CFG_VIDOPT) == 0)
- return (0);
- break;
- }
-
- /* Check for hardware */
- adder = (volatile struct adder *)
- vax_map_physmem(va->va_paddr + GPX_ADDER_OFFSET, 1);
- if (adder == NULL)
- return (0);
- adder->status = 0;
- status = adder->status;
- vax_unmap_physmem((vaddr_t)adder, 1);
- if (status == offsetof(struct adder, status))
- return (0);
-
- /* Check for a recognized color depth */
- tmp = vax_map_physmem(va->va_paddr + GPX_READBACK_OFFSET, 1);
- if (tmp == 0L)
- return (0);
- depth = (*(u_int16_t *)tmp) & 0x00f0;
- vax_unmap_physmem(tmp, 1);
- if (depth != 0x00f0 && depth != 0x0080)
- return (0);
-
- /* when already running as console, always fake things */
- if ((vax_confdata & KA420_CFG_L3CON) == 0 &&
- cn_tab == &wsdisplay_cons) {
- struct vsbus_softc *sc = (void *)parent;
- sc->sc_mask = 0x08;
- scb_fake(0x44, oldvsbus ? 0x14 : 0x15);
- } else {
- adder = (struct adder *)vax_map_physmem(va->va_paddr +
- GPX_ADDER_OFFSET, 1);
- if (adder == NULL)
- return (0);
- adder->interrupt_enable = FRAME_SYNC;
- DELAY(100000); /* enough to get a retrace interrupt */
- adder->interrupt_enable = 0;
- vax_unmap_physmem((vaddr_t)adder, 1);
- }
- return (20);
-}
-
-void
-gpx_attach(struct device *parent, struct device *self, void *aux)
-{
- struct gpx_softc *sc = (struct gpx_softc *)self;
- struct vsbus_attach_args *va = aux;
- struct gpx_screen *scr;
- struct wsemuldisplaydev_attach_args aa;
- int console;
- vaddr_t tmp;
- extern struct consdev wsdisplay_cons;
-
- console = (vax_confdata & KA420_CFG_L3CON) == 0 &&
- cn_tab == &wsdisplay_cons;
- if (console) {
- scr = &gpx_consscr;
- sc->sc_nscreens = 1;
- } else {
- scr = malloc(sizeof(struct gpx_screen), M_DEVBUF, M_NOWAIT);
- if (scr == NULL) {
- printf(": can not allocate memory\n");
- return;
- }
-
- tmp = vax_map_physmem(va->va_paddr + GPX_READBACK_OFFSET, 1);
- if (tmp == 0L) {
- printf(": can not probe depth\n");
- goto bad1;
- }
- scr->ss_depth = (*(u_int16_t *)tmp & 0x00f0) == 0x00f0 ? 4 : 8;
- vax_unmap_physmem(tmp, 1);
-
- scr->ss_adder = (struct adder *)vax_map_physmem(va->va_paddr +
- GPX_ADDER_OFFSET, 1);
- if (scr->ss_adder == NULL) {
- printf(": can not map frame buffer registers\n");
- goto bad1;
- }
-
- scr->ss_vdac = (void *)vax_map_physmem(va->va_paddr +
- GPX_VDAC_OFFSET, 1);
- if (scr->ss_vdac == NULL) {
- printf(": can not map RAMDAC\n");
- goto bad2;
- }
-
-#if 0
- scr->ss_cursor =
- (struct dc503reg *)vax_map_physmem(va->va_paddr +
- GPX_CURSOR_OFFSET, 1);
- if (scr->ss_cursor == NULL) {
- printf(": can not map cursor chip\n");
- goto bad3;
- }
-#endif
-
- if (gpx_setup_screen(scr) != 0) {
- printf(": initialization failed\n");
- goto bad4;
- }
- }
- sc->sc_scr = scr;
-
- printf("\n%s: %dx%d %d plane color framebuffer\n",
- self->dv_xname, GPX_WIDTH, GPX_VISHEIGHT, scr->ss_depth);
-
- aa.console = console;
- aa.scrdata = &gpx_screenlist;
- aa.accessops = &gpx_accessops;
- aa.accesscookie = sc;
- aa.defaultscreens = 0;
-
- config_found(self, &aa, wsemuldisplaydevprint);
-
- return;
-
-bad4:
-#if 0
- vax_unmap_physmem((vaddr_t)scr->ss_cursor, 1);
-bad3:
-#endif
- vax_unmap_physmem((vaddr_t)scr->ss_vdac, 1);
-bad2:
- vax_unmap_physmem((vaddr_t)scr->ss_adder, 1);
-bad1:
- free(scr, M_DEVBUF, sizeof(struct gpx_screen));
-}
-
-/*
- * wsdisplay accessops
- */
-
-int
-gpx_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- struct gpx_softc *sc = v;
- struct gpx_screen *ss = sc->sc_scr;
- struct wsdisplay_fbinfo *wdf;
- struct wsdisplay_cmap *cm;
- int error;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_GPX;
- break;
-
- case WSDISPLAYIO_GINFO:
- wdf = (struct wsdisplay_fbinfo *)data;
- wdf->height = ss->ss_ri.ri_height;
- wdf->width = ss->ss_ri.ri_width;
- wdf->depth = ss->ss_depth;
- wdf->cmsize = 1 << ss->ss_depth;
- break;
-
- case WSDISPLAYIO_GETCMAP:
- cm = (struct wsdisplay_cmap *)data;
- error = gpx_getcmap(ss, cm);
- if (error != 0)
- return (error);
- break;
- case WSDISPLAYIO_PUTCMAP:
- cm = (struct wsdisplay_cmap *)data;
- error = gpx_putcmap(ss, cm);
- if (error != 0)
- return (error);
- gpx_loadcmap(ss, cm->index, cm->count);
- break;
-
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- break;
-
- case WSDISPLAYIO_LINEBYTES: /* no linear mapping */
- default:
- return (-1);
- }
-
- return (0);
-}
-
-paddr_t
-gpx_mmap(void *v, off_t offset, int prot)
-{
- return (-1);
-}
-
-int
-gpx_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
- int *curxp, int *curyp, long *defattrp)
-{
- struct gpx_softc *sc = v;
- struct gpx_screen *ss = sc->sc_scr;
- struct rasops_info *ri = &ss->ss_ri;
-
- if (sc->sc_nscreens > 0)
- return (ENOMEM);
-
- *cookiep = ri;
- *curxp = *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, defattrp);
- sc->sc_nscreens++;
-
- return (0);
-}
-
-void
-gpx_free_screen(void *v, void *cookie)
-{
- struct gpx_softc *sc = v;
-
- sc->sc_nscreens--;
-}
-
-int
-gpx_show_screen(void *v, void *cookie, int waitok,
- void (*cb)(void *, int, int), void *cbarg)
-{
- return (0);
-}
-
-int
-gpx_load_font(void *v, void *emulcookie, struct wsdisplay_font *font)
-{
- struct gpx_softc *sc = v;
- struct gpx_screen *ss = sc->sc_scr;
- struct rasops_info *ri = &ss->ss_ri;
- int wsfcookie;
- struct wsdisplay_font *wsf;
- const char *name;
-
- /*
- * We can't use rasops_load_font() directly, as we need to make
- * sure that, when switching fonts, the font bits are set up in
- * the correct bit order, and uploaded off-screen.
- */
-
- if (font->data != NULL)
- return rasops_load_font(ri, emulcookie, font);
-
- /* allow an empty font name to revert to the initial font choice */
- name = font->name;
- if (*name == '\0')
- name = NULL;
-
- wsfcookie = wsfont_find(name, ri->ri_font->fontwidth,
- ri->ri_font->fontheight, 0);
- if (wsfcookie < 0) {
- wsfcookie = wsfont_find(name, 0, 0, 0);
- if (wsfcookie < 0)
- return ENOENT;
- else
- return EINVAL;
- }
- if (wsfont_lock(wsfcookie, &wsf,
- WSDISPLAY_FONTORDER_R2L, WSDISPLAY_FONTORDER_L2R) <= 0)
- return EINVAL;
-
- /* if (ri->ri_wsfcookie >= 0) */
- wsfont_unlock(ri->ri_wsfcookie);
- ri->ri_wsfcookie = wsfcookie;
- ri->ri_font = wsf;
- ri->ri_fontscale = ri->ri_font->fontheight * ri->ri_font->stride;
-
- gpx_upload_font(ss);
-
- return 0;
-}
-
-int
-gpx_list_font(void *v, struct wsdisplay_font *font)
-{
- struct gpx_softc *sc = v;
- struct gpx_screen *ss = sc->sc_scr;
- struct rasops_info *ri = &ss->ss_ri;
-
- return rasops_list_font(ri, font);
-}
-
-void
-gpx_burner(void *v, u_int on, u_int flags)
-{
- struct gpx_softc *sc = v;
- struct gpx_screen *ss = sc->sc_scr;
-
- if (ss->ss_depth == 8) {
- struct ramdac8 *rd = ss->ss_vdac;
- rd->address = BT_CR;
- if (on)
- rd->control = BTCR_RAMENA | BTCR_BLINK_1648 |
- BTCR_MPLX_4;
- else
- /* fade colormap to black as well? */
- rd->control = BTCR_BLINK_1648 | BTCR_MPLX_4;
- } else {
- struct ramdac4 *rd = ss->ss_vdac;
- if (on)
- rd->control = RAMDAC4_INIT;
- else
- rd->control = RAMDAC4_INIT & ~RAMDAC4_ENABLE;
- }
-}
-
-/*
- * wsdisplay emulops
- */
-
-int
-gpx_putchar(void *v, int row, int col, u_int uc, long attr)
-{
- struct rasops_info *ri = v;
- struct gpx_screen *ss = ri->ri_hw;
- struct wsdisplay_font *font = ri->ri_font;
- int dx, dy, sx, sy, fg, bg, ul;
-
- ri->ri_ops.unpack_attr(v, attr, &fg, &bg, &ul);
-
- /* find where to output the glyph... */
- dx = col * font->fontwidth + ri->ri_xorigin;
- dy = row * font->fontheight + ri->ri_yorigin;
- /* ... and where to pick it from */
- uc -= font->firstchar;
- sx = (uc % ss->ss_gpr) * font->stride * NBBY;
- sy = GPX_HEIGHT - (1 + uc / ss->ss_gpr) * font->fontheight;
-
- /* setup VIPER operand control registers */
- while (gpx_viper_write(ss, CS_UPDATE_MASK, 0x00ff));
- gpx_viper_write(ss, SRC1_OCR_B,
- EXT_NONE | INT_SOURCE | ID | BAR_SHIFT_DELAY);
- gpx_viper_write(ss, DST_OCR_B,
- EXT_NONE | INT_NONE | NO_ID | NO_BAR_SHIFT_DELAY);
- gpx_viper_write(ss, MASK_1, 0xffff);
- gpx_viper_write(ss, VIPER_Z_LOAD | FOREGROUND_COLOR_Z, fg);
- gpx_viper_write(ss, VIPER_Z_LOAD | BACKGROUND_COLOR_Z, bg);
- ss->ss_adder->x_clip_min = 0;
- ss->ss_adder->x_clip_max = GPX_WIDTH;
- ss->ss_adder->y_clip_min = 0;
- ss->ss_adder->y_clip_max = GPX_VISHEIGHT;
- /* load DESTINATION origin and vectors */
- ss->ss_adder->fast_dest_dy = 0;
- ss->ss_adder->slow_dest_dx = 0;
- ss->ss_adder->error_1 = 0;
- ss->ss_adder->error_2 = 0;
- ss->ss_adder->rasterop_mode = DST_WRITE_ENABLE | NORMAL;
- gpx_wait(ss, RASTEROP_COMPLETE);
- ss->ss_adder->destination_x = dx;
- ss->ss_adder->fast_dest_dx = font->fontwidth;
- ss->ss_adder->destination_y = dy;
- ss->ss_adder->slow_dest_dy = font->fontheight;
- /* load SOURCE origin and vectors */
- ss->ss_adder->source_1_x = sx;
- ss->ss_adder->source_1_y = sy;
- ss->ss_adder->source_1_dx = font->fontwidth;
- ss->ss_adder->source_1_dy = font->fontheight;
- ss->ss_adder->cmd = RASTEROP | OCRB | S1E | DTE | LF_R1;
-
- if (ul != 0) {
- gpx_fillrect(ss, dx, dy + font->fontheight - 2, font->fontwidth,
- 1, attr, LF_R3); /* fg fill */
- }
-
- return 0;
-}
-
-int
-gpx_copycols(void *v, int row, int src, int dst, int cnt)
-{
- struct rasops_info *ri = v;
- struct gpx_screen *ss = ri->ri_hw;
- struct wsdisplay_font *font = ri->ri_font;
- int sx, y, dx, w, h;
-
- sx = ri->ri_xorigin + src * font->fontwidth;
- dx = ri->ri_xorigin + dst * font->fontwidth;
- w = cnt * font->fontwidth;
- y = ri->ri_yorigin + row * font->fontheight;
- h = font->fontheight;
-
- gpx_copyrect(ss, sx, y, dx, y, w, h);
-
- return 0;
-}
-
-int
-gpx_erasecols(void *v, int row, int col, int cnt, long attr)
-{
- struct rasops_info *ri = v;
- struct gpx_screen *ss = ri->ri_hw;
- struct wsdisplay_font *font = ri->ri_font;
- int x, y, dx, dy;
-
- x = ri->ri_xorigin + col * font->fontwidth;
- dx = cnt * font->fontwidth;
- y = ri->ri_yorigin + row * font->fontheight;
- dy = font->fontheight;
-
- gpx_fillrect(ss, x, y, dx, dy, attr, LF_R2); /* bg fill */
-
- return 0;
-}
-
-int
-gpx_copyrows(void *v, int src, int dst, int cnt)
-{
- struct rasops_info *ri = v;
- struct gpx_screen *ss = ri->ri_hw;
- struct wsdisplay_font *font = ri->ri_font;
- int x, sy, dy, w, h;
-
- x = ri->ri_xorigin;
- w = ri->ri_emustride;
- sy = ri->ri_yorigin + src * font->fontheight;
- dy = ri->ri_yorigin + dst * font->fontheight;
- h = cnt * font->fontheight;
-
- gpx_copyrect(ss, x, sy, x, dy, w, h);
-
- return 0;
-}
-
-int
-gpx_eraserows(void *v, int row, int cnt, long attr)
-{
- struct rasops_info *ri = v;
- struct gpx_screen *ss = ri->ri_hw;
- struct wsdisplay_font *font = ri->ri_font;
- int x, y, dx, dy;
-
- x = ri->ri_xorigin;
- dx = ri->ri_emustride;
- y = ri->ri_yorigin + row * font->fontheight;
- dy = cnt * font->fontheight;
-
- gpx_fillrect(ss, x, y, dx, dy, attr, LF_R2); /* bg fill */
-
- return 0;
-}
-
-int
-gpx_do_cursor(struct rasops_info *ri)
-{
- struct gpx_screen *ss = ri->ri_hw;
- int x, y, w, h;
-
- x = ri->ri_ccol * ri->ri_font->fontwidth + ri->ri_xorigin;
- y = ri->ri_crow * ri->ri_font->fontheight + ri->ri_yorigin;
- w = ri->ri_font->fontwidth;
- h = ri->ri_font->fontheight;
-
- gpx_fillrect(ss, x, y, w, h, WSCOL_WHITE << 24, LF_R4); /* invert */
-
- return 0;
-}
-
-/*
- * low-level programming routines
- */
-
-int
-gpx_wait(struct gpx_screen *ss, int bits)
-{
- int i;
-
- ss->ss_adder->status = 0;
- for (i = 100000; i != 0; i--) {
- if ((ss->ss_adder->status & bits) == bits)
- break;
- DELAY(1);
- }
-
- return (i == 0);
-}
-
-int
-gpx_viper_write(struct gpx_screen *ss, u_int reg, u_int16_t val)
-{
- if (gpx_wait(ss, ADDRESS_COMPLETE) == 0 &&
- gpx_wait(ss, TX_READY) == 0) {
- ss->ss_adder->id_data = val;
- ss->ss_adder->command = ID_LOAD | reg;
- return (0);
- }
-#ifdef DEBUG
- if (ss->ss_console == 0) /* don't make things worse! */
- printf("gpx_viper_write failure, reg %x val %x\n", reg, val);
-#endif
- return (1);
-}
-
-/* Initialize the damned beast. Straight from qdss. */
-void
-gpx_reset_viper(struct gpx_screen *ss)
-{
- int i;
-
- ss->ss_adder->interrupt_enable = 0;
- ss->ss_adder->command = CANCEL;
- /* set monitor timing */
- ss->ss_adder->x_scan_count_0 = 0x2800;
- ss->ss_adder->x_scan_count_1 = 0x1020;
- ss->ss_adder->x_scan_count_2 = 0x003a;
- ss->ss_adder->x_scan_count_3 = 0x38f0;
- ss->ss_adder->x_scan_count_4 = 0x6128;
- ss->ss_adder->x_scan_count_5 = 0x093a;
- ss->ss_adder->x_scan_count_6 = 0x313c;
- ss->ss_adder->sync_phase_adj = 0x0100;
- ss->ss_adder->x_scan_conf = 0x00c8;
- /*
- * got a bug in second pass ADDER! lets take care of it...
- *
- * normally, just use the code in the following bug fix code, but to
- * make repeated demos look pretty, load the registers as if there was
- * no bug and then test to see if we are getting sync
- */
- ss->ss_adder->y_scan_count_0 = 0x135f;
- ss->ss_adder->y_scan_count_1 = 0x3363;
- ss->ss_adder->y_scan_count_2 = 0x2366;
- ss->ss_adder->y_scan_count_3 = 0x0388;
- /*
- * if no sync, do the bug fix code
- */
- if (gpx_wait(ss, FRAME_SYNC) != 0) {
- /*
- * First load all Y scan registers with very short frame and
- * wait for scroll service. This guarantees at least one SYNC
- * to fix the pass 2 Adder initialization bug (synchronizes
- * XCINCH with DMSEEDH)
- */
- ss->ss_adder->y_scan_count_0 = 0x01;
- ss->ss_adder->y_scan_count_1 = 0x01;
- ss->ss_adder->y_scan_count_2 = 0x01;
- ss->ss_adder->y_scan_count_3 = 0x01;
- /* delay at least 1 full frame time */
- gpx_wait(ss, FRAME_SYNC);
- gpx_wait(ss, FRAME_SYNC);
- /*
- * now load the REAL sync values (in reverse order just to
- * be safe).
- */
- ss->ss_adder->y_scan_count_3 = 0x0388;
- ss->ss_adder->y_scan_count_2 = 0x2366;
- ss->ss_adder->y_scan_count_1 = 0x3363;
- ss->ss_adder->y_scan_count_0 = 0x135f;
- }
- /* zero the index registers */
- ss->ss_adder->x_index_pending = 0;
- ss->ss_adder->y_index_pending = 0;
- ss->ss_adder->x_index_new = 0;
- ss->ss_adder->y_index_new = 0;
- ss->ss_adder->x_index_old = 0;
- ss->ss_adder->y_index_old = 0;
- ss->ss_adder->pause = 0;
- /* set rasterop mode to normal pen down */
- ss->ss_adder->rasterop_mode =
- DST_WRITE_ENABLE | DST_INDEX_ENABLE | NORMAL;
- /* set the rasterop registers to default values */
- ss->ss_adder->source_1_dx = 1;
- ss->ss_adder->source_1_dy = 1;
- ss->ss_adder->source_1_x = 0;
- ss->ss_adder->source_1_y = 0;
- ss->ss_adder->destination_x = 0;
- ss->ss_adder->destination_y = 0;
- ss->ss_adder->fast_dest_dx = 1;
- ss->ss_adder->fast_dest_dy = 0;
- ss->ss_adder->slow_dest_dx = 0;
- ss->ss_adder->slow_dest_dy = 1;
- ss->ss_adder->error_1 = 0;
- ss->ss_adder->error_2 = 0;
- /* scale factor = UNITY */
- ss->ss_adder->fast_scale = UNITY;
- ss->ss_adder->slow_scale = UNITY;
- /* set the source 2 parameters */
- ss->ss_adder->source_2_x = 0;
- ss->ss_adder->source_2_y = 0;
- ss->ss_adder->source_2_size = 0x0022;
- /* initialize plane addresses for eight vipers */
- for (i = 0; i < 8; i++) {
- gpx_viper_write(ss, CS_UPDATE_MASK, 1 << i);
- gpx_viper_write(ss, PLANE_ADDRESS, i);
- }
- /* initialize the external registers. */
- gpx_viper_write(ss, CS_UPDATE_MASK, 0x00ff);
- gpx_viper_write(ss, CS_SCROLL_MASK, 0x00ff);
- /* initialize resolution mode */
- gpx_viper_write(ss, MEMORY_BUS_WIDTH, 0x000c); /* bus width = 16 */
- gpx_viper_write(ss, RESOLUTION_MODE, 0x0000); /* one bit/pixel */
- /* initialize viper registers */
- gpx_viper_write(ss, SCROLL_CONSTANT,
- SCROLL_ENABLE | VIPER_LEFT | VIPER_UP);
- gpx_viper_write(ss, SCROLL_FILL, 0x0000);
- /* set clipping and scrolling limits to full screen */
- gpx_wait(ss, ADDRESS_COMPLETE);
- ss->ss_adder->x_clip_min = 0;
- ss->ss_adder->x_clip_max = GPX_WIDTH;
- ss->ss_adder->y_clip_min = 0;
- ss->ss_adder->y_clip_max = GPX_HEIGHT;
- ss->ss_adder->scroll_x_min = 0;
- ss->ss_adder->scroll_x_max = GPX_WIDTH;
- ss->ss_adder->scroll_y_min = 0;
- ss->ss_adder->scroll_y_max = GPX_HEIGHT;
- gpx_wait(ss, FRAME_SYNC); /* wait at LEAST 1 full frame */
- gpx_wait(ss, FRAME_SYNC);
- ss->ss_adder->x_index_pending = 0;
- ss->ss_adder->y_index_pending = 0;
- ss->ss_adder->x_index_new = 0;
- ss->ss_adder->y_index_new = 0;
- ss->ss_adder->x_index_old = 0;
- ss->ss_adder->y_index_old = 0;
- gpx_wait(ss, ADDRESS_COMPLETE);
- gpx_viper_write(ss, LEFT_SCROLL_MASK, 0x0000);
- gpx_viper_write(ss, RIGHT_SCROLL_MASK, 0x0000);
- /* set source and the mask register to all ones */
- gpx_viper_write(ss, SOURCE, 0xffff);
- gpx_viper_write(ss, MASK_1, 0xffff);
- gpx_viper_write(ss, VIPER_Z_LOAD | FOREGROUND_COLOR_Z, 255);
- gpx_viper_write(ss, VIPER_Z_LOAD | BACKGROUND_COLOR_Z, 0);
- /* initialize Operand Control Register banks for fill command */
- gpx_viper_write(ss, SRC1_OCR_A, EXT_NONE | INT_M1_M2 | NO_ID | WAIT);
- gpx_viper_write(ss, SRC2_OCR_A, EXT_NONE | INT_SOURCE | NO_ID | NO_WAIT);
- gpx_viper_write(ss, DST_OCR_A, EXT_NONE | INT_NONE | NO_ID | NO_WAIT);
- gpx_viper_write(ss, SRC1_OCR_B, EXT_NONE | INT_SOURCE | NO_ID | WAIT);
- gpx_viper_write(ss, SRC2_OCR_B, EXT_NONE | INT_M1_M2 | NO_ID | NO_WAIT);
- gpx_viper_write(ss, DST_OCR_B, EXT_NONE | INT_NONE | NO_ID | NO_WAIT);
-
- /*
- * Init Logic Unit Function registers.
- */
- /* putchar */
- gpx_viper_write(ss, LU_FUNCTION_R1, FULL_SRC_RESOLUTION | LF_SOURCE);
- /* erase{cols,rows} */
- gpx_viper_write(ss, LU_FUNCTION_R2, FULL_SRC_RESOLUTION | LF_ZEROS);
- /* underline */
- gpx_viper_write(ss, LU_FUNCTION_R3, FULL_SRC_RESOLUTION | LF_ONES);
- /* cursor */
- gpx_viper_write(ss, LU_FUNCTION_R4, FULL_SRC_RESOLUTION | LF_NOT_D);
-}
-
-/* Clear the whole screen. Straight from qdss. */
-void
-gpx_clear_screen(struct gpx_screen *ss)
-{
- ss->ss_adder->x_limit = GPX_WIDTH;
- ss->ss_adder->y_limit = GPX_HEIGHT;
- ss->ss_adder->y_offset_pending = 0;
- gpx_wait(ss, FRAME_SYNC); /* wait at LEAST 1 full frame */
- gpx_wait(ss, FRAME_SYNC);
- ss->ss_adder->y_scroll_constant = SCROLL_ERASE;
- gpx_wait(ss, FRAME_SYNC);
- gpx_wait(ss, FRAME_SYNC);
- ss->ss_adder->y_offset_pending = GPX_VISHEIGHT;
- gpx_wait(ss, FRAME_SYNC);
- gpx_wait(ss, FRAME_SYNC);
- ss->ss_adder->y_scroll_constant = SCROLL_ERASE;
- gpx_wait(ss, FRAME_SYNC);
- gpx_wait(ss, FRAME_SYNC);
- ss->ss_adder->y_offset_pending = 2 * GPX_VISHEIGHT;
- gpx_wait(ss, FRAME_SYNC);
- gpx_wait(ss, FRAME_SYNC);
- ss->ss_adder->y_scroll_constant = SCROLL_ERASE;
- gpx_wait(ss, FRAME_SYNC);
- gpx_wait(ss, FRAME_SYNC);
- ss->ss_adder->y_offset_pending = 0; /* back to normal */
- gpx_wait(ss, FRAME_SYNC);
- gpx_wait(ss, FRAME_SYNC);
- ss->ss_adder->x_limit = GPX_WIDTH;
- ss->ss_adder->y_limit = GPX_VISHEIGHT;
-}
-
-int
-gpx_setup_screen(struct gpx_screen *ss)
-{
- struct rasops_info *ri = &ss->ss_ri;
- int cookie;
-
- bzero(ri, sizeof(*ri));
- ri->ri_depth = 8; /* masquerade as a 8 bit device for rasops */
- ri->ri_width = GPX_WIDTH;
- ri->ri_height = GPX_VISHEIGHT;
- ri->ri_stride = GPX_WIDTH;
- ri->ri_flg = RI_CENTER; /* no RI_CLEAR as ri_bits is NULL! */
- ri->ri_hw = ss;
-
- /*
- * We can not let rasops select our font, because we need to use
- * a font with right-to-left bit order on this frame buffer.
- */
- wsfont_init();
- cookie = wsfont_find(NULL, 12, 0, 0);
- if (cookie <= 0)
- cookie = wsfont_find(NULL, 8, 0, 0);
- if (cookie <= 0)
- cookie = wsfont_find(NULL, 0, 0, 0);
- if (cookie <= 0)
- return (-1);
- if (wsfont_lock(cookie, &ri->ri_font,
- WSDISPLAY_FONTORDER_R2L, WSDISPLAY_FONTORDER_L2R) <= 0)
- return (-1);
- ri->ri_wsfcookie = cookie;
-
- /*
- * Ask for an unholy big display, rasops will trim this to more
- * reasonable values.
- */
- if (rasops_init(ri, 160, 160) != 0)
- return (-1);
-
- /*
- * Override the rasops emulops.
- */
- ri->ri_ops.copyrows = gpx_copyrows;
- ri->ri_ops.copycols = gpx_copycols;
- ri->ri_ops.eraserows = gpx_eraserows;
- ri->ri_ops.erasecols = gpx_erasecols;
- ri->ri_ops.putchar = gpx_putchar;
- ri->ri_do_cursor = gpx_do_cursor;
-
- gpx_stdscreen.ncols = ri->ri_cols;
- gpx_stdscreen.nrows = ri->ri_rows;
- gpx_stdscreen.textops = &ri->ri_ops;
- gpx_stdscreen.fontwidth = ri->ri_font->fontwidth;
- gpx_stdscreen.fontheight = ri->ri_font->fontheight;
- gpx_stdscreen.capabilities = ri->ri_caps;
-
- /*
- * Initialize RAMDAC.
- */
- if (ss->ss_depth == 8) {
- struct ramdac8 *rd = ss->ss_vdac;
- rd->address = BT_CR;
- rd->control = BTCR_RAMENA | BTCR_BLINK_1648 | BTCR_MPLX_4;
- } else {
- struct ramdac4 *rd = ss->ss_vdac;
- rd->control = RAMDAC4_INIT;
- }
-
- /*
- * Put the ADDER and VIPER in a good state.
- */
- gpx_reset_viper(ss);
-
- /*
- * Initialize colormap.
- */
- gpx_resetcmap(ss);
-
- /*
- * Clear display (including non-visible area), in 864 lines chunks.
- */
- gpx_clear_screen(ss);
-
- /*
- * Copy our font to the offscreen area.
- */
- gpx_upload_font(ss);
-
-#if 0
- ss->ss_cursor->cmdr = ss->ss_curcmd = PCCCMD_HSHI;
-#endif
-
- return (0);
-}
-
-/*
- * Copy the selected wsfont to non-visible frame buffer area.
- * This is necessary since the only way to send data to the frame buffer
- * is through the ID interface, which is slow and needs 16 bit wide data.
- * Adapted from qdss.
- */
-void
-gpx_upload_font(struct gpx_screen *ss)
-{
- struct rasops_info *ri = &ss->ss_ri;
- struct wsdisplay_font *font = ri->ri_font;
- u_int8_t *fontbits, *fb;
- u_int remaining, nchars, row;
- u_int i, j;
- u_int16_t data;
-
- /* setup VIPER operand control registers */
-
- gpx_viper_write(ss, MASK_1, 0xffff);
- gpx_viper_write(ss, VIPER_Z_LOAD | FOREGROUND_COLOR_Z, 255);
- gpx_viper_write(ss, VIPER_Z_LOAD | BACKGROUND_COLOR_Z, 0);
-
- gpx_viper_write(ss, SRC1_OCR_B,
- EXT_NONE | INT_NONE | ID | BAR_SHIFT_DELAY);
- gpx_viper_write(ss, SRC2_OCR_B,
- EXT_NONE | INT_NONE | ID | BAR_SHIFT_DELAY);
- gpx_viper_write(ss, DST_OCR_B,
- EXT_SOURCE | INT_NONE | NO_ID | NO_BAR_SHIFT_DELAY);
-
- ss->ss_adder->rasterop_mode =
- DST_WRITE_ENABLE | DST_INDEX_ENABLE | NORMAL;
- gpx_wait(ss, RASTEROP_COMPLETE);
-
- /*
- * Load font data. The font is uploaded in 8 or 16 bit wide cells, on
- * as many ``lines'' as necessary at the end of the display.
- */
- ss->ss_gpr = MIN(GPX_WIDTH / (NBBY * font->stride), font->numchars);
- if (ss->ss_gpr & 1)
- ss->ss_gpr--;
- fontbits = font->data;
- for (row = 1, remaining = font->numchars; remaining != 0;
- row++, remaining -= nchars) {
- nchars = MIN(ss->ss_gpr, remaining);
-
- ss->ss_adder->destination_x = 0;
- ss->ss_adder->destination_y =
- GPX_HEIGHT - row * font->fontheight;
- ss->ss_adder->fast_dest_dx = nchars * 16;
- ss->ss_adder->slow_dest_dy = font->fontheight;
-
- /* setup for processor to bitmap xfer */
- gpx_viper_write(ss, CS_UPDATE_MASK, 0x00ff);
- ss->ss_adder->cmd = PBT | OCRB | DTE | LF_R1 | 2; /*XXX why 2?*/
-
- /* iteratively do the processor to bitmap xfer */
- for (i = font->fontheight; i != 0; i--) {
- fb = fontbits;
- fontbits += font->stride;
- /* PTOB a scan line */
- for (j = nchars; j != 0; j--) {
- /* PTOB one scan of a char cell */
- if (font->stride == 1) {
- data = *fb;
- fb += font->fontheight;
- /*
- * Do not access past font memory if
- * it has an odd number of characters
- * and this is the last pair.
- */
- if (j != 1 || (nchars & 1) == 0 ||
- remaining != nchars) {
- data |= ((u_int16_t)*fb) << 8;
- fb += font->fontheight;
- }
- } else {
- data =
- fb[0] | (((u_int16_t)fb[1]) << 8);
- fb += font->fontheight * font->stride;
- }
-
- gpx_wait(ss, TX_READY);
- ss->ss_adder->id_data = data;
- }
- }
- fontbits += (nchars - 1) * font->stride * font->fontheight;
- }
-}
-
-void
-gpx_copyrect(struct gpx_screen *ss,
- int sx, int sy, int dx, int dy, int w, int h)
-{
- while (gpx_viper_write(ss, CS_UPDATE_MASK, 0x00ff));
- gpx_viper_write(ss, MASK_1, 0xffff);
- gpx_viper_write(ss, VIPER_Z_LOAD | FOREGROUND_COLOR_Z, 255);
- gpx_viper_write(ss, VIPER_Z_LOAD | BACKGROUND_COLOR_Z, 0);
- gpx_viper_write(ss, SRC1_OCR_B,
- EXT_NONE | INT_SOURCE | ID | BAR_SHIFT_DELAY);
- gpx_viper_write(ss, DST_OCR_B,
- EXT_NONE | INT_NONE | NO_ID | NO_BAR_SHIFT_DELAY);
- ss->ss_adder->fast_dest_dy = 0;
- ss->ss_adder->slow_dest_dx = 0;
- ss->ss_adder->error_1 = 0;
- ss->ss_adder->error_2 = 0;
- ss->ss_adder->rasterop_mode = DST_WRITE_ENABLE | NORMAL;
- gpx_wait(ss, RASTEROP_COMPLETE);
- ss->ss_adder->destination_x = dx;
- ss->ss_adder->fast_dest_dx = w;
- ss->ss_adder->destination_y = dy;
- ss->ss_adder->slow_dest_dy = h;
- ss->ss_adder->source_1_x = sx;
- ss->ss_adder->source_1_dx = w;
- ss->ss_adder->source_1_y = sy;
- ss->ss_adder->source_1_dy = h;
- ss->ss_adder->cmd = RASTEROP | OCRB | S1E | DTE | LF_R1;
-}
-
-/*
- * Fill a rectangle with the given attribute and function (i.e. rop).
- */
-void
-gpx_fillrect(struct gpx_screen *ss, int x, int y, int dx, int dy, long attr,
- u_int function)
-{
- struct rasops_info *ri = &ss->ss_ri;
- int fg, bg;
-
- ri->ri_ops.unpack_attr(ri, attr, &fg, &bg, NULL);
-
- while (gpx_viper_write(ss, CS_UPDATE_MASK, 0x00ff));
- gpx_viper_write(ss, MASK_1, 0xffff);
- gpx_viper_write(ss, SOURCE, 0xffff);
- gpx_viper_write(ss, VIPER_Z_LOAD | FOREGROUND_COLOR_Z, fg);
- gpx_viper_write(ss, VIPER_Z_LOAD | BACKGROUND_COLOR_Z, bg);
- gpx_viper_write(ss, SRC1_OCR_B,
- EXT_NONE | INT_SOURCE | ID | BAR_SHIFT_DELAY);
- gpx_viper_write(ss, DST_OCR_B,
- EXT_NONE | INT_NONE | NO_ID | NO_BAR_SHIFT_DELAY);
- ss->ss_adder->fast_dest_dx = 0;
- ss->ss_adder->fast_dest_dy = 0;
- ss->ss_adder->slow_dest_dx = 0;
- ss->ss_adder->error_1 = 0;
- ss->ss_adder->error_2 = 0;
- ss->ss_adder->rasterop_mode = DST_WRITE_ENABLE | NORMAL;
- gpx_wait(ss, RASTEROP_COMPLETE);
- ss->ss_adder->destination_x = x;
- ss->ss_adder->fast_dest_dx = dx;
- ss->ss_adder->destination_y = y;
- ss->ss_adder->slow_dest_dy = dy;
- ss->ss_adder->source_1_x = x;
- ss->ss_adder->source_1_dx = dx;
- ss->ss_adder->source_1_y = y;
- ss->ss_adder->source_1_dy = dy;
- ss->ss_adder->cmd = RASTEROP | OCRB | S1E | DTE | function;
-}
-
-/*
- * Colormap handling routines
- */
-
-int
-gpx_getcmap(struct gpx_screen *ss, struct wsdisplay_cmap *cm)
-{
- u_int index = cm->index, count = cm->count, i;
- u_int colcount = 1 << ss->ss_depth;
- int error;
- u_int8_t ramp[256], *c, *r;
-
- if (index >= colcount || count > colcount - index)
- return (EINVAL);
-
- /* extract reds */
- c = ss->ss_cmap + 0 + index * 3;
- for (i = count, r = ramp; i != 0; i--)
- *r++ = *c << (8 - ss->ss_depth), c += 3;
- if ((error = copyout(ramp, cm->red, count)) != 0)
- return (error);
-
- /* extract greens */
- c = ss->ss_cmap + 1 + index * 3;
- for (i = count, r = ramp; i != 0; i--)
- *r++ = *c << (8 - ss->ss_depth), c += 3;
- if ((error = copyout(ramp, cm->green, count)) != 0)
- return (error);
-
- /* extract blues */
- c = ss->ss_cmap + 2 + index * 3;
- for (i = count, r = ramp; i != 0; i--)
- *r++ = *c << (8 - ss->ss_depth), c += 3;
- if ((error = copyout(ramp, cm->blue, count)) != 0)
- return (error);
-
- return (0);
-}
-
-int
-gpx_putcmap(struct gpx_screen *ss, struct wsdisplay_cmap *cm)
-{
- u_int index = cm->index, count = cm->count;
- u_int colcount = 1 << ss->ss_depth;
- int i, error;
- u_int8_t r[256], g[256], b[256], *nr, *ng, *nb, *c;
-
- if (index >= colcount || count > colcount - index)
- return (EINVAL);
-
- if ((error = copyin(cm->red, r, count)) != 0)
- return (error);
- if ((error = copyin(cm->green, g, count)) != 0)
- return (error);
- if ((error = copyin(cm->blue, b, count)) != 0)
- return (error);
-
- nr = r, ng = g, nb = b;
- c = ss->ss_cmap + index * 3;
- for (i = count; i != 0; i--) {
- *c++ = *nr++ >> (8 - ss->ss_depth);
- *c++ = *ng++ >> (8 - ss->ss_depth);
- *c++ = *nb++ >> (8 - ss->ss_depth);
- }
-
- return (0);
-}
-
-void
-gpx_loadcmap(struct gpx_screen *ss, int from, int count)
-{
- u_int8_t *cmap = ss->ss_cmap;
- int i, color12;
-
- gpx_wait(ss, FRAME_SYNC);
- if (ss->ss_depth == 8) {
- struct ramdac8 *rd = ss->ss_vdac;
-
- cmap += from * 3;
- rd->address = from;
- for (i = 0; i < count * 3; i++)
- rd->cmapdata = *cmap++;
- } else {
- struct ramdac4 *rd = ss->ss_vdac;
-
- cmap = ss->ss_cmap + from;
- for (i = from; i < from + count; i++) {
- color12 = (*cmap++ >> 4) << 0;
- color12 |= (*cmap++ >> 4) << 8;
- color12 |= (*cmap++ >> 4) << 4;
- rd->colormap[i] = color12;
- }
- }
-}
-
-void
-gpx_resetcmap(struct gpx_screen *ss)
-{
- if (ss->ss_depth == 8)
- bcopy(rasops_cmap, ss->ss_cmap, sizeof(ss->ss_cmap));
- else {
- bcopy(rasops_cmap, ss->ss_cmap, 8 * 3);
- bcopy(rasops_cmap + 0xf8 * 3, ss->ss_cmap + 8 * 3, 8 * 3);
- }
- gpx_loadcmap(ss, 0, 1 << ss->ss_depth);
-
- /*
- * On the 4bit RAMDAC, make the hardware cursor black on black
- */
- if (ss->ss_depth != 8) {
- struct ramdac4 *rd = ss->ss_vdac;
-
- rd->cursormap[0] = rd->cursormap[1] =
- rd->cursormap[2] = rd->cursormap[3] = 0x0000;
- }
-}
-
-/*
- * Console support code
- */
-
-int gpxcnprobe(void);
-int gpxcninit(void);
-
-int
-gpxcnprobe()
-{
- extern vaddr_t virtual_avail;
- volatile struct adder *adder;
- vaddr_t tmp;
- int depth;
- u_short status;
-
- switch (vax_boardtype) {
- case VAX_BTYP_410:
- case VAX_BTYP_420:
- case VAX_BTYP_43:
- if ((vax_confdata & (KA420_CFG_L3CON | KA420_CFG_MULTU)) != 0)
- break; /* doesn't use graphics console */
-
- if ((vax_confdata & KA420_CFG_VIDOPT) == 0)
- break; /* no color option */
-
- /* Check for hardware */
- tmp = virtual_avail;
- ioaccess(tmp, vax_trunc_page(GPXADDR + GPX_ADDER_OFFSET), 1);
- adder = (struct adder *)tmp;
- adder->status = 0;
- status = adder->status;
- iounaccess(tmp, 1);
- if (status == offsetof(struct adder, status))
- return (0);
-
- /* Check for a recognized color depth */
- tmp = virtual_avail;
- ioaccess(tmp, vax_trunc_page(GPXADDR + GPX_READBACK_OFFSET), 1);
- depth = *(u_int16_t *)
- (tmp + (GPX_READBACK_OFFSET & VAX_PGOFSET)) & 0x00f0;
- iounaccess(tmp, 1);
- if (depth == 0x00f0 || depth == 0x0080)
- return (1);
-
- break;
-
- default:
- break;
- }
-
- return (0);
-}
-
-/*
- * Called very early to setup the glass tty as console.
- * Because it's called before the VM system is initialized, virtual memory
- * for the framebuffer can be stolen directly without disturbing anything.
- */
-int
-gpxcninit()
-{
- struct gpx_screen *ss = &gpx_consscr;
- extern vaddr_t virtual_avail;
- vaddr_t ova;
- long defattr;
- struct rasops_info *ri;
-
- ova = virtual_avail;
-
- ioaccess(virtual_avail,
- vax_trunc_page(GPXADDR + GPX_READBACK_OFFSET), 1);
- ss->ss_depth = (0x00f0 & *(u_int16_t *)(virtual_avail +
- (GPX_READBACK_OFFSET & VAX_PGOFSET))) == 0x00f0 ? 4 : 8;
-
- ioaccess(virtual_avail, GPXADDR + GPX_ADDER_OFFSET, 1);
- ss->ss_adder = (struct adder *)virtual_avail;
- virtual_avail += VAX_NBPG;
-
- ioaccess(virtual_avail, vax_trunc_page(GPXADDR + GPX_VDAC_OFFSET), 1);
- ss->ss_vdac = (void *)(virtual_avail + (GPX_VDAC_OFFSET & VAX_PGOFSET));
- virtual_avail += VAX_NBPG;
-
-#if 0
- ioaccess(virtual_avail, GPXADDR + GPX_CURSOR_OFFSET, 1);
- ss->ss_cursor = (struct dc503reg *)virtual_avail;
- virtual_avail += VAX_NBPG;
-#endif
-
- virtual_avail = round_page(virtual_avail);
-
- /* this had better not fail */
- if (gpx_setup_screen(ss) != 0) {
-#if 0
- iounaccess((vaddr_t)ss->ss_cursor, 1);
-#endif
- iounaccess((vaddr_t)ss->ss_vdac, 1);
- iounaccess((vaddr_t)ss->ss_adder, 1);
- virtual_avail = ova;
- return (1);
- }
-
- ri = &ss->ss_ri;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
- wsdisplay_cnattach(&gpx_stdscreen, ri, 0, 0, defattr);
-
- return (0);
-}
diff --git a/sys/arch/vax/vsa/hdc9224.c b/sys/arch/vax/vsa/hdc9224.c
deleted file mode 100644
index 9cd6b2f7ec9..00000000000
--- a/sys/arch/vax/vsa/hdc9224.c
+++ /dev/null
@@ -1,874 +0,0 @@
-/* $OpenBSD: hdc9224.c,v 1.42 2013/11/20 00:13:54 dlg Exp $ */
-/* $NetBSD: hdc9224.c,v 1.16 2001/07/26 15:05:09 wiz Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-/*
- * with much help from (in alphabetical order):
- * Jeremy
- * Roger Ivie
- * Rick Macklem
- * Mike Young
- *
- * Rewritten by Ragge 25 Jun 2000. New features:
- * - Uses interrupts instead of polling to signal ready.
- * - Can cooperate with the SCSI routines WRT. the DMA area.
- *
- * TODO:
- * - Floppy support missing.
- * - Bad block forwarding missing.
- * - Statistics collection.
- */
-#undef HDDEBUG
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/dkio.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <sys/disk.h>
-#include <sys/syslog.h>
-#include <sys/reboot.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <ufs/ufs/dinode.h> /* For BBSIZE */
-#include <ufs/ffs/fs.h>
-
-#include <machine/pte.h>
-#include <machine/sid.h>
-#include <machine/cpu.h>
-#include <machine/uvax.h>
-#include <machine/ka410.h>
-#include <machine/vsbus.h>
-#include <machine/scb.h>
-
-#include <arch/vax/mscp/mscp.h> /* For DEC disk encoding */
-
-#include <vax/vsa/hdc9224.h>
-
-/*
- * on-disk geometry block
- */
-struct hdgeom {
- char mbz[10]; /* 10 bytes of zero */
- long xbn_count; /* number of XBNs */
- long dbn_count; /* number of DBNs */
- long lbn_count; /* number of LBNs (Logical-Block-Numbers) */
- long rbn_count; /* number of RBNs (Replacement-Block-Numbers) */
- short nspt; /* number of sectors per track */
- short ntracks; /* number of tracks */
- short ncylinders; /* number of cylinders */
- short precomp; /* first cylinder for write precompensation */
- short reduced; /* first cylinder for reduced write current */
- short seek_rate; /* seek rate or zero for buffered seeks */
- short crc_eec; /* 0 if CRC, 1 if ECC is being used */
- short rct; /* "replacement control table" (RCT) */
- short rct_ncopies; /* number of copies of the RCT */
- long media_id; /* media identifier */
- short interleave; /* sector-to-sector interleave */
- short headskew; /* head-to-head skew */
- short cylskew; /* cylinder-to-cylinder skew */
- short gap0_size; /* size of GAP 0 in the MFM format */
- short gap1_size; /* size of GAP 1 in the MFM format */
- short gap2_size; /* size of GAP 2 in the MFM format */
- short gap3_size; /* size of GAP 3 in the MFM format */
- short sync_value; /* sync value used when formatting */
- char reserved[32]; /* reserved for use by the RQDX formatter */
- short serial_number; /* serial number */
-#if 0 /* we don't need these 412 useless bytes ... */
- char fill[412-2]; /* Filler bytes to the end of the block */
- short checksum; /* checksum over the XBN */
-#endif
-} __packed;
-
-/*
- * Software status
- */
-struct hdsoftc {
- struct device sc_dev; /* must be here! (pseudo-OOP:) */
- struct disk sc_disk; /* disklabel etc. */
- struct hdgeom sc_xbn; /* on-disk geometry information */
- int sc_drive; /* physical unit number */
-};
-
-struct hdcsoftc {
- struct device sc_dev; /* must be here (pseudo-OOP:) */
- struct evcount sc_intrcnt;
- struct vsbus_dma sc_vd;
- vaddr_t sc_regs; /* register addresses */
- struct bufq sc_bufq;
- struct buf *sc_active;
- struct hdc9224_UDCreg sc_creg; /* (command) registers to be written */
- struct hdc9224_UDCreg sc_sreg; /* (status) registers being read */
- caddr_t sc_dmabase; /* */
- int sc_dmasize;
- caddr_t sc_bufaddr; /* Current in-core address */
- daddr_t sc_diskblk; /* Current block on disk */
- int sc_bytecnt; /* How much left to transfer */
- int sc_xfer; /* Current transfer size */
- int sc_retries;
- volatile u_char sc_status; /* last status from interrupt */
- char sc_intbit;
-};
-
-struct hdc_attach_args {
- int ha_drive;
-};
-
-/*
- * prototypes for (almost) all the internal routines
- */
-int hdcmatch(struct device *, void *, void *);
-void hdcattach(struct device *, struct device *, void *);
-int hdcprint(void *, const char *);
-int hdmatch(struct device *, void *, void *);
-void hdattach(struct device *, struct device *, void *);
-void hdcintr(void *);
-int hdc_command(struct hdcsoftc *, int);
-void hd_readgeom(struct hdcsoftc *, struct hdsoftc *);
-int hdgetdisklabel(dev_t, struct hdsoftc *, struct disklabel *, int);
-#ifdef HDDEBUG
-void hdc_printgeom(struct hdgeom *);
-#endif
-void hdc_writeregs(struct hdcsoftc *);
-void hdcstart(struct hdcsoftc *, struct buf *);
-int hdc_hdselect(struct hdcsoftc *, int);
-void hdmakelabel(struct disklabel *, struct hdgeom *);
-void hdc_writeregs(struct hdcsoftc *);
-void hdc_readregs(struct hdcsoftc *);
-void hdc_qstart(void *);
-
-bdev_decl(hd);
-cdev_decl(hd);
-
-const struct cfattach hdc_ca = {
- sizeof(struct hdcsoftc), hdcmatch, hdcattach
-};
-
-struct cfdriver hdc_cd = {
- NULL, "hdc", DV_DULL
-};
-
-const struct cfattach hd_ca = {
- sizeof(struct hdsoftc), hdmatch, hdattach
-};
-
-struct cfdriver hd_cd = {
- NULL, "hd", DV_DISK
-};
-
-/* At least 0.7 uS between register accesses */
-static int hd_dmasize, inq = 0; /* XXX should be in softc... but only 1 ctrl */
-static int u;
-#define WAIT asm("movl %0,%0;movl %0,%0;movl %0,%0; movl %0,%0" :: "m"(u))
-
-#define HDC_WREG(x) *(volatile char *)(sc->sc_regs) = (x)
-#define HDC_RREG *(volatile char *)(sc->sc_regs)
-#define HDC_WCMD(x) *(volatile char *)(sc->sc_regs + 4) = (x)
-#define HDC_RSTAT *(volatile char *)(sc->sc_regs + 4)
-
-/*
- * new-config's hdcmatch() is similar to old-config's hdcprobe(),
- * thus we probe for the existence of the controller and reset it.
- * NB: we can't initialize the controller yet, since space for hdcsoftc
- * is not yet allocated. Thus we do this in hdcattach()...
- */
-int
-hdcmatch(struct device *parent, void *vcf, void *aux)
-{
- static int matched = 0;
- struct vsbus_attach_args *va = aux;
- volatile char *hdc_csr = (char *)va->va_addr;
- int i;
-
- if (vax_boardtype == VAX_BTYP_49 || vax_boardtype == VAX_BTYP_46 ||
- vax_boardtype == VAX_BTYP_48 || vax_boardtype == VAX_BTYP_1303)
- return (0);
-
- /* Can only match once due to DMA setup. This should not be an issue. */
- if (matched != 0)
- return (0);
-
- hdc_csr[4] = DKC_CMD_RESET; /* reset chip */
- for (i = 0; i < 1000; i++) {
- DELAY(1000);
- if (hdc_csr[4] & DKC_ST_DONE)
- break;
- }
- if (i == 100)
- return 0; /* No response to reset */
-
- hdc_csr[4] = DKC_CMD_SETREGPTR|UDC_TERM;
- WAIT;
- hdc_csr[0] = UDC_TC_CRCPRE|UDC_TC_INTDONE;
- WAIT;
- hdc_csr[4] = DKC_CMD_DRDESELECT; /* Should be harmless */
- DELAY(1000);
- return (matched = 1);
-}
-
-int
-hdcprint(void *aux, const char *pnp)
-{
- struct hdc_attach_args *ha = aux;
-
- if (pnp != NULL)
- printf("%s at %s drive %d",
- ha->ha_drive == 2 ? "ry" : "hd", pnp, ha->ha_drive);
-
- return (UNCONF);
-}
-
-/*
- * hdc_attach() probes for all possible devices
- */
-void
-hdcattach(struct device *parent, struct device *self, void *aux)
-{
- struct vsbus_attach_args *va = aux;
- struct hdcsoftc *sc = (void *)self;
- struct hdc_attach_args ha;
- int status, i;
-
- u = 0; /* !!! - GCC */
-
- printf("\n");
-
- /*
- * Get interrupt vector, enable instrumentation.
- */
- scb_vecalloc(va->va_cvec, hdcintr, sc, SCB_ISTACK, &sc->sc_intrcnt);
- evcount_attach(&sc->sc_intrcnt, self->dv_xname, (void *)va->va_cvec);
-
- sc->sc_regs = vax_map_physmem(va->va_paddr, 1);
- sc->sc_dmabase = (caddr_t)va->va_dmaaddr;
- sc->sc_dmasize = va->va_dmasize;
- sc->sc_intbit = va->va_maskno;
- hd_dmasize = min(MAXPHYS, sc->sc_dmasize); /* Used in hd_minphys */
-
- sc->sc_vd.vd_go = hdc_qstart;
- sc->sc_vd.vd_arg = sc;
-
- /*
- * Reset controller.
- */
- HDC_WCMD(DKC_CMD_RESET);
- DELAY(1000);
- status = HDC_RSTAT;
- if (status != (DKC_ST_DONE|DKC_TC_SUCCESS)) {
- printf("%s: RESET failed, status 0x%x\n",
- sc->sc_dev.dv_xname, status);
- return;
- }
-
- /*
- * now probe for all possible hard drives
- */
- for (i = 0; i < 4; i++) {
- if (i == 2) /* Floppy, needs special handling */
- continue;
- HDC_WCMD(DKC_CMD_DRSELECT | i);
- DELAY(1000);
- status = HDC_RSTAT;
- ha.ha_drive = i;
- if ((status & DKC_ST_TERMCOD) == DKC_TC_SUCCESS)
- config_found(self, (void *)&ha, hdcprint);
- }
-}
-
-/*
- * hdmatch() probes for the existence of a HD-type disk/floppy
- */
-int
-hdmatch(parent, vcf, aux)
- struct device *parent;
- void *vcf;
- void *aux;
-{
- struct hdc_attach_args *ha = aux;
- struct cfdata *cf = vcf;
-
- if (cf->cf_loc[0] != -1 &&
- cf->cf_loc[0] != ha->ha_drive)
- return 0;
-
- if (ha->ha_drive == 2) /* Always floppy, not supported */
- return 0;
-
- return 1;
-}
-
-#define HDMAJOR 19
-
-int
-hdgetdisklabel(dev_t dev, struct hdsoftc *hd, struct disklabel *lp,
- int spoofonly)
-{
- hdmakelabel(lp, &hd->sc_xbn);
-
- return readdisklabel(dev, hdstrategy, lp, spoofonly);
-}
-
-void
-hdattach(struct device *parent, struct device *self, void *aux)
-{
- struct hdcsoftc *sc = (void*)parent;
- struct hdsoftc *hd = (void*)self;
- struct hdc_attach_args *ha = aux;
- struct disklabel *dl;
- int error;
-
- hd->sc_drive = ha->ha_drive;
- /*
- * Initialize and attach the disk structure.
- */
- hd->sc_disk.dk_name = hd->sc_dev.dv_xname;
- disk_attach(&hd->sc_dev, &hd->sc_disk);
-
- /*
- * if it's not a floppy then evaluate the on-disk geometry.
- * if necessary correct the label...
- */
- hd_readgeom(sc, hd);
- disk_printtype(hd->sc_drive, hd->sc_xbn.media_id);
- dl = hd->sc_disk.dk_label;
- error = hdgetdisklabel(MAKEDISKDEV(HDMAJOR, hd->sc_dev.dv_unit, RAW_PART),
- hd, dl, 0);
- printf("%s: %lluMB, %llu sectors\n",
- hd->sc_dev.dv_xname, DL_GETDSIZE(dl) / (1048576 / DEV_BSIZE),
- DL_GETDSIZE(dl));
-#ifdef HDDEBUG
- hdc_printgeom(&hd->sc_xbn);
-#endif
-}
-
-void
-hdcintr(void *arg)
-{
- struct hdcsoftc *sc = arg;
- struct buf *bp;
-
- sc->sc_status = HDC_RSTAT;
- if (sc->sc_active == NULL)
- return; /* Complain? */
-
- if ((sc->sc_status & (DKC_ST_INTPEND | DKC_ST_DONE)) !=
- (DKC_ST_INTPEND | DKC_ST_DONE))
- return; /* Why spurious ints sometimes??? */
-
- bp = sc->sc_active;
- sc->sc_active = NULL;
- if ((sc->sc_status & DKC_ST_TERMCOD) != DKC_TC_SUCCESS) {
- int i;
- u_char *g = (u_char *)&sc->sc_sreg;
-
- if (sc->sc_retries++ < 3) { /* Allow 3 retries */
- hdcstart(sc, bp);
- return;
- }
- printf("%s: failed, status 0x%x\n",
- sc->sc_dev.dv_xname, sc->sc_status);
- hdc_readregs(sc);
- for (i = 0; i < 10; i++)
- printf("%i: %x\n", i, g[i]);
- bp->b_flags |= B_ERROR;
- bp->b_error = ENXIO;
- bp->b_resid = bp->b_bcount;
- biodone(bp);
- vsbus_dma_intr();
- return;
- }
-
- if (bp->b_flags & B_READ) {
- vsbus_copytoproc(bp->b_proc, sc->sc_dmabase, sc->sc_bufaddr,
- sc->sc_xfer);
- }
- sc->sc_diskblk += (sc->sc_xfer/DEV_BSIZE);
- sc->sc_bytecnt -= sc->sc_xfer;
- sc->sc_bufaddr += sc->sc_xfer;
-
- if (sc->sc_bytecnt == 0) { /* Finished transfer */
- biodone(bp);
- vsbus_dma_intr();
- } else
- hdcstart(sc, bp);
-}
-
-/*
- *
- */
-void
-hdstrategy(struct buf *bp)
-{
- struct hdsoftc *hd;
- struct hdcsoftc *sc;
- int unit, s;
-
- unit = DISKUNIT(bp->b_dev);
- if (unit > hd_cd.cd_ndevs || (hd = hd_cd.cd_devs[unit]) == NULL) {
- bp->b_error = ENXIO;
- bp->b_flags |= B_ERROR;
- bp->b_resid = bp->b_bcount;
- goto done;
- }
- sc = (void *)hd->sc_dev.dv_parent;
-
- /* Validate the request. */
- if (bounds_check_with_label(bp, hd->sc_disk.dk_label) == -1)
- goto done;
-
- bufq_queue(&sc->sc_bufq, bp);
-
- s = splbio();
- if (inq == 0) {
- inq = 1;
- vsbus_dma_start(&sc->sc_vd);
- }
- splx(s);
- return;
-
-done:
- s = splbio();
- biodone(bp);
- splx(s);
-}
-
-void
-hdc_qstart(void *arg)
-{
- struct hdcsoftc *sc = arg;
-
- inq = 0;
-
- hdcstart(sc, NULL);
- if (bufq_peek(&sc->sc_bufq)) {
- vsbus_dma_start(&sc->sc_vd); /* More to go */
- inq = 1;
- }
-}
-
-void
-hdcstart(struct hdcsoftc *sc, struct buf *ob)
-{
- struct hdc9224_UDCreg *p = &sc->sc_creg;
- struct disklabel *lp;
- struct hdsoftc *hd;
- struct buf *bp;
- int cn, sn, tn, blks;
- volatile char ch;
- daddr_t bn;
-
- splassert(IPL_BIO);
-
- if (sc->sc_active != NULL)
- return; /* Already doing something */
-
- if (ob == NULL) {
- bp = bufq_dequeue(&sc->sc_bufq);
- if (bp == NULL)
- return; /* Nothing to do */
-
- sc->sc_bufaddr = bp->b_data;
- sc->sc_bytecnt = bp->b_bcount;
- sc->sc_retries = 0;
- bp->b_resid = 0;
- } else
- bp = ob;
-
- hd = hd_cd.cd_devs[DISKUNIT(bp->b_dev)];
- lp = hd->sc_disk.dk_label;
- hdc_hdselect(sc, hd->sc_drive);
- sc->sc_active = bp;
-
- if (ob == NULL) {
- sc->sc_diskblk = bp->b_blkno +
- DL_GETPOFFSET(&lp->d_partitions[DISKPART(bp->b_dev)]);
- }
- bn = sc->sc_diskblk;
-
- if (bn != 0) {
- cn = bn / lp->d_secpercyl;
- sn = bn % lp->d_secpercyl;
- tn = sn / lp->d_nsectors;
- sn = sn % lp->d_nsectors;
- } else
- cn = sn = tn = 0;
-
- cn++; /* first cylinder is reserved */
-
- bzero(p, sizeof(struct hdc9224_UDCreg));
-
- /*
- * Tricky thing: the controller itself only increases the sector
- * number, not the track or cylinder number. Therefore the driver
- * is not allowed to have transfers that crosses track boundaries.
- */
- blks = sc->sc_bytecnt / DEV_BSIZE;
- if ((sn + blks) > lp->d_nsectors)
- blks = lp->d_nsectors - sn;
-
- p->udc_dsect = sn;
- p->udc_dcyl = cn & 0xff;
- p->udc_dhead = ((cn >> 4) & 0x70) | tn;
- p->udc_scnt = blks;
-
- p->udc_rtcnt = UDC_RC_RTRYCNT;
- p->udc_mode = UDC_MD_HDD;
- p->udc_term = UDC_TC_CRCPRE|UDC_TC_INTDONE|UDC_TC_TDELDAT|UDC_TC_TWRFLT;
- hdc_writeregs(sc);
-
- /* Count up vars */
- sc->sc_xfer = blks * DEV_BSIZE;
-
- ch = HDC_RSTAT; /* Avoid pending interrupts */
- WAIT;
- vsbus_clrintr(sc->sc_intbit); /* Clear pending int's */
-
- if (bp->b_flags & B_READ) {
- HDC_WCMD(DKC_CMD_READ_HDD);
- } else {
- vsbus_copyfromproc(bp->b_proc, sc->sc_bufaddr, sc->sc_dmabase,
- sc->sc_xfer);
- HDC_WCMD(DKC_CMD_WRITE_HDD);
- }
-}
-
-void
-hd_readgeom(struct hdcsoftc *sc, struct hdsoftc *hd)
-{
- struct hdc9224_UDCreg *p = &sc->sc_creg;
-
- hdc_hdselect(sc, hd->sc_drive); /* select drive right now */
-
- bzero(p, sizeof(struct hdc9224_UDCreg));
-
- p->udc_scnt = 1;
- p->udc_rtcnt = UDC_RC_RTRYCNT;
- p->udc_mode = UDC_MD_HDD;
- p->udc_term = UDC_TC_CRCPRE|UDC_TC_INTDONE|UDC_TC_TDELDAT|UDC_TC_TWPROT;
- hdc_writeregs(sc);
- sc->sc_status = 0;
- HDC_WCMD(DKC_CMD_READ_HDD|2);
- while ((sc->sc_status & DKC_ST_INTPEND) == 0)
- ;
- bcopy(sc->sc_dmabase, &hd->sc_xbn, sizeof(struct hdgeom));
-}
-
-#ifdef HDDEBUG
-/*
- * display the contents of the on-disk geometry structure
- */
-void
-hdc_printgeom(p)
- struct hdgeom *p;
-{
- printf("**DiskData** XBNs: %ld, DBNs: %ld, LBNs: %ld, RBNs: %ld\n",
- p->xbn_count, p->dbn_count, p->lbn_count, p->rbn_count);
- printf("sec/track: %d, tracks: %d, cyl: %d, precomp/reduced: %d/%d\n",
- p->nspt, p->ntracks, p->ncylinders, p->precomp, p->reduced);
- printf("seek-rate: %d, crc/eec: %s, RCT: %d, RCT-copies: %d\n",
- p->seek_rate, p->crc_eec?"EEC":"CRC", p->rct, p->rct_ncopies);
- printf("media-ID: %lx, interleave: %d, headskew: %d, cylskew: %d\n",
- p->media_id, p->interleave, p->headskew, p->cylskew);
- printf("gap0: %d, gap1: %d, gap2: %d, gap3: %d, sync-value: %d\n",
- p->gap0_size, p->gap1_size, p->gap2_size, p->gap3_size,
- p->sync_value);
-}
-#endif
-
-/*
- * Return the size of a partition, if known, or -1 if not.
- */
-daddr_t
-hdsize(dev_t dev)
-{
- struct hdsoftc *hd;
- int unit = DISKUNIT(dev);
- daddr_t size;
-
- if (unit >= hd_cd.cd_ndevs || hd_cd.cd_devs[unit] == 0)
- return -1;
- hd = hd_cd.cd_devs[unit];
- size = DL_GETPSIZE(&hd->sc_disk.dk_label->d_partitions[DISKPART(dev)]) *
- (hd->sc_disk.dk_label->d_secsize / DEV_BSIZE);
-
- return (size);
-}
-
-/*
- *
- */
-int
-hdopen(dev_t dev, int flag, int fmt, struct proc *p)
-{
- struct hdsoftc *hd;
- int unit, part;
-
- unit = DISKUNIT(dev);
- if (unit >= hd_cd.cd_ndevs)
- return ENXIO;
- hd = hd_cd.cd_devs[unit];
- if (hd == 0)
- return ENXIO;
-
- part = DISKPART(dev);
- if (part >= hd->sc_disk.dk_label->d_npartitions)
- return ENXIO;
-
- switch (fmt) {
- case S_IFCHR:
- hd->sc_disk.dk_copenmask |= (1 << part);
- break;
- case S_IFBLK:
- hd->sc_disk.dk_bopenmask |= (1 << part);
- break;
- }
- hd->sc_disk.dk_openmask =
- hd->sc_disk.dk_copenmask | hd->sc_disk.dk_bopenmask;
-
- return 0;
-}
-
-/*
- *
- */
-int
-hdclose(dev_t dev, int flag, int fmt, struct proc *p)
-{
- struct hdsoftc *hd;
- int part;
-
- hd = hd_cd.cd_devs[DISKUNIT(dev)];
- part = DISKPART(dev);
-
- switch (fmt) {
- case S_IFCHR:
- hd->sc_disk.dk_copenmask &= ~(1 << part);
- break;
- case S_IFBLK:
- hd->sc_disk.dk_bopenmask &= ~(1 << part);
- break;
- }
- hd->sc_disk.dk_openmask =
- hd->sc_disk.dk_copenmask | hd->sc_disk.dk_bopenmask;
-
- return (0);
-}
-
-/*
- *
- */
-int
-hdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
-{
- struct hdsoftc *hd = hd_cd.cd_devs[DISKUNIT(dev)];
- struct disklabel *lp = hd->sc_disk.dk_label;
- int error = 0;
-
- switch (cmd) {
- case DIOCGPDINFO:
- hdgetdisklabel(dev, hd, (struct disklabel *)addr, 1);
- break;
-
- case DIOCGDINFO:
- bcopy(lp, addr, sizeof (struct disklabel));
- break;
-
- case DIOCGPART:
- ((struct partinfo *)addr)->disklab = lp;
- ((struct partinfo *)addr)->part =
- &lp->d_partitions[DISKPART(dev)];
- break;
-
- case DIOCWDINFO:
- case DIOCSDINFO:
- if ((flag & FWRITE) == 0)
- return EBADF;
- error = setdisklabel(lp, (struct disklabel *)addr, 0);
- if (error == 0) {
- if (cmd == DIOCWDINFO)
- error = writedisklabel(dev, hdstrategy, lp);
- }
- break;
-
- default:
- error = ENOTTY;
- break;
- }
- return error;
-}
-
-/*
- *
- */
-int
-hdread(dev_t dev, struct uio *uio, int flag)
-{
- return (physio(hdstrategy, dev, B_READ, minphys, uio));
-}
-
-/*
- *
- */
-int
-hdwrite(dev_t dev, struct uio *uio, int flag)
-{
- return (physio(hdstrategy, dev, B_WRITE, minphys, uio));
-}
-
-/*
- *
- */
-int
-hddump(dev_t dev, daddr_t daddr, caddr_t addr, size_t size)
-{
- return 0;
-}
-
-/*
- * we have to wait 0.7 usec between two accesses to any of the
- * dkc-registers, on a VS2000 with 1 MIPS, this is roughly one
- * instruction. Thus the loop-overhead will be enough...
- */
-void
-hdc_readregs(struct hdcsoftc *sc)
-{
- int i;
- char *p;
-
- HDC_WCMD(DKC_CMD_SETREGPTR);
- WAIT;
- p = (void *)&sc->sc_sreg;
- for (i = 0; i < 10; i++) {
- *p++ = HDC_RREG; /* dkc_reg auto-increments */
- WAIT;
- }
-}
-
-void
-hdc_writeregs(struct hdcsoftc *sc)
-{
- int i;
- char *p;
-
- HDC_WCMD(DKC_CMD_SETREGPTR);
- p = (void *)&sc->sc_creg;
- for (i = 0; i < 10; i++) {
- HDC_WREG(*p++); /* dkc_reg auto-increments */
- WAIT;
- }
-}
-
-/*
- * hdc_command() issues a command and polls the intreq-register
- * to find when command has completed
- */
-int
-hdc_command(struct hdcsoftc *sc, int cmd)
-{
- hdc_writeregs(sc); /* write the prepared registers */
- HDC_WCMD(cmd);
- WAIT;
- return (0);
-}
-
-int
-hdc_hdselect(struct hdcsoftc *sc, int unit)
-{
- struct hdc9224_UDCreg *p = &sc->sc_creg;
- int error;
-
- /*
- * bring "creg" in some known-to-work state and
- * select the drive with the DRIVE SELECT command.
- */
- bzero(p, sizeof(struct hdc9224_UDCreg));
-
- p->udc_rtcnt = UDC_RC_HDD_READ;
- p->udc_mode = UDC_MD_HDD;
- p->udc_term = UDC_TC_HDD;
-
- error = hdc_command(sc, DKC_CMD_DRSEL_HDD | unit);
-
- return (error);
-}
-
-void
-hdmakelabel(struct disklabel *dl, struct hdgeom *g)
-{
- int n, p = 0;
-
- dl->d_bbsize = BBSIZE;
- dl->d_sbsize = SBSIZE;
- dl->d_typename[p++] = MSCP_MID_CHAR(2, g->media_id);
- dl->d_typename[p++] = MSCP_MID_CHAR(1, g->media_id);
- if (MSCP_MID_ECH(0, g->media_id))
- dl->d_typename[p++] = MSCP_MID_CHAR(0, g->media_id);
- n = MSCP_MID_NUM(g->media_id);
- if (n > 99) {
- dl->d_typename[p++] = '1';
- n -= 100;
- }
- if (n > 9) {
- dl->d_typename[p++] = (n / 10) + '0';
- n %= 10;
- }
- dl->d_typename[p++] = n + '0';
- dl->d_typename[p] = 0;
- dl->d_type = DTYPE_MSCP; /* XXX - what to use here??? */
- dl->d_secsize = DEV_BSIZE;
-
- DL_SETDSIZE(dl, g->lbn_count);
- dl->d_nsectors = g->nspt;
- dl->d_ntracks = g->ntracks;
- dl->d_secpercyl = dl->d_nsectors * dl->d_ntracks;
- dl->d_ncylinders = DL_GETDSIZE(dl) / dl->d_secpercyl;
-
- dl->d_npartitions = MAXPARTITIONS;
- DL_SETPSIZE(&dl->d_partitions[0], DL_GETDSIZE(dl));
- DL_SETPSIZE(&dl->d_partitions[2], DL_GETDSIZE(dl));
-
- DL_SETPOFFSET(&dl->d_partitions[0], 0);
- DL_SETPOFFSET(&dl->d_partitions[2], 0);
- dl->d_version = 1;
- dl->d_magic = dl->d_magic2 = DISKMAGIC;
- dl->d_checksum = dkcksum(dl);
-}
diff --git a/sys/arch/vax/vsa/hdc9224.h b/sys/arch/vax/vsa/hdc9224.h
deleted file mode 100644
index bbb05c429df..00000000000
--- a/sys/arch/vax/vsa/hdc9224.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/* $OpenBSD: hdc9224.h,v 1.7 2006/11/06 22:16:28 miod Exp $ */
-/* $NetBSD: hdc9224.h,v 1.5 2003/11/10 08:51:52 wiz Exp $ */
-/*
- * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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.
- */
-
-struct hdc9224_DKCreg {
- unsigned char dkc_reg; /* Disk Register Data Access Port (rw)*/
- unsigned char fill[3]; /* bytes are longword aligned */
- unsigned char dkc_cmd; /* Disk Controller Command Port (wo) */
-#define dkc_stat dkc_cmd /* Interrupt Status Port (ro) */
-};
-
-/*
- * definition of some commands (constant bits only, incomplete!)
- */
-#define DKC_CMD_RESET 0x00 /* terminate non-data-transfer cmds */
-#define DKC_CMD_DRDESELECT 0x01 /* done when no drive is in use */
-#define DKC_CMD_SETREGPTR 0x40 /* logically or-ed with reg-number */
-#define DKC_CMD_DRSELECT 0x20
-#define DKC_CMD_DRSEL_HDD 0x24 /* select HDD, or-ed with unit-numb. */
-#define DKC_CMD_DRSEL_RX33 0x28 /* or-ed with unit-number of RX33 */
-#define DKC_CMD_DRSEL_RX50 0x2C /* or-ed with unit-number of RX50 */
-#define DKC_CMD_RESTORE 0x02
-#define DKC_CMD_STEP 0x04
-#define DKC_CMD_STEPIN_FDD 0x04 /* one step inward for floppy */
-#define DKC_CMD_STEPOUT_FDD 0x06 /* one step outward (toward cyl #0) */
-#define DKC_CMD_POLLDRIVE 0x10
-#define DKC_CMD_SEEKREADID 0x50
-#define DKC_CMD_FORMATTRACK 0x60
-#define DKC_CMD_READTRACK 0x5A
-#define DKC_CMD_READPHYSICAL 0x58
-#define DKC_CMD_READLOGICAL 0x5C
-#define DKC_CMD_READ_HDD 0x5D /* read-logical, bypass=0, xfer=1 */
-#define DKC_CMD_READ_RX33 0x5D /* ??? */
-#define DKC_CMD_WRITEPHYSICAL 0x80
-#define DKC_CMD_WRITELOGICAL 0xC0
-#define DKC_CMD_WRITE_HDD 0xA0 /* bypass=0, ddmark=0 */
-#define DKC_CMD_WRITE_RX33 0xA1 /* precompensation differs... */
-#define DKC_CMD_WRITE_RX50 0xA4
-
-/*
- * Definition of bits in the DKC_STAT register
- */
-#define DKC_ST_INTPEND (1<<7) /* interrupt pending */
-#define DKC_ST_DMAREQ (1<<6) /* DMA request */
-#define DKC_ST_DONE (1<<5) /* command done */
-#define DKC_ST_TERMCOD (3<<3) /* termination code (see below) */
-#define DKC_ST_RDYCHNG (1<<2) /* ready change */
-#define DKC_ST_OVRUN (1<<1) /* overrun/underrun */
-#define DKC_ST_BADSECT (1<<0) /* bad sector */
-
-/*
- * Definition of the termination codes
- */
-#define DKC_TC_SUCCESS (0<<3) /* Successful completion */
-#define DKC_TC_RDIDERR (1<<3) /* Error in READ-ID sequence */
-#define DKC_TC_VRFYERR (2<<3) /* Error in VERIFY sequence */
-#define DKC_TC_DATAERR (3<<3) /* Error in DATA-TRANSFER seq. */
-
-/*
- * Definitions of delays necessary for floppy-operation
- */
-#define DKC_DELAY_MOTOR 500 /* allow 500 ms to reach speed */
-#define DKC_DELAY_SELECT 70 /* 70 ms for data-recovery-circuit */
-#define DKC_DELAY_POSITION 59 /* 59 ms for RX33, 100 ms for RX50 */
-#define DKC_DELAY_HEADSET 18 /* 18 ms when changing head-number */
-
-/*
- * The HDC9224 has 11/15(?) internal registers which are accessible via
- * the Disk-Register-Data-Access-Port DKC_REG
- */
-struct hdc9224_UDCreg { /* internal disk controller registers */
- u_char udc_dma7; /* 0: DMA address bits 0 - 7 */
- u_char udc_dma15; /* 1: DMA address bits 8 - 15 */
- u_char udc_dma23; /* 2: DMA address bits 16 - 23 */
- u_char udc_dsect; /* 3: desired/starting sector number */
-#define udc_csect udc_dsect /* current sector number */
- u_char udc_dhead; /* 4: cyl-bits 8-10, desired head number */
-#define udc_chead udc_dhead /* current head number */
- u_char udc_dcyl; /* 5: desired cylinder number */
-#define udc_ccyl udc_dcyl /* current cylinder number */
- u_char udc_scnt; /* 6: sector count register */
- u_char udc_rtcnt; /* 7: retry count register */
- u_char udc_mode; /* 8: operation mode/chip status */
-#define udc_cstat udc_mode /* chip status register */
- u_char udc_term; /* 9: termination conditions/drive status */
-#define udc_dstat udc_term /* drive status register */
- u_char udc_data; /* 10: data */
-};
-
-/* UDC regs */
-#define UDC_TERM 9
-
-/*
- * Definition of bits in the Current-Head register
- */
-#define UDC_CH_BADSECT (1<<7) /* indicates a bad sector (if bypass=0) */
-#define UDC_CH_CYLBITS (0x70) /* bits 10-8 of current cylinder number */
-#define UDC_CH_HEADNO (0x0F) /* current head number */
-
-/*
- * Definition of bits in the Retry-Count register
- */
-#define UDC_RC_RTRYCNT (0xF0) /* 1's compl. in read-log, 0 all others */
-#define UDC_RC_RXDISAB (1<<3) /* must/should be 0 for normal operation */
-#define UDC_RC_INVRDY (1<<2) /* polarity of floppy-status, important! */
-#define UDC_RC_MOTOR (1<<1) /* turn on floppy-motor, no effect on HDD */
-#define UDC_RC_LOSPEED (1<<0) /* floppy-speed select, RX33: 0, RX50: 1 */
-
-#define UDC_RC_HDD_READ 0xF2 /* 0x72 ??? */
-#define UDC_RC_HDD_WRT 0xF2 /* 0xF0 ??? */
-#define UDC_RC_RX33READ 0x76 /* enable retries when reading floppies */
-#define UDC_RC_RX33WRT 0xF6
-#define UDC_RC_RX50READ 0x77 /* enable retries when reading floppies */
-#define UDC_RC_RX50WRT 0xF7
-
-/*
- * Definition of bits in the Operating-Mode register
- */
-#define UDC_MD_HDMODE (1<<7) /* must be 1 for all FDD and HDD */
-#define UDC_MD_CHKCOD (3<<5) /* error-check: FDD/CRC: 0, HDD/ECC: 1 */
-#define UDC_MD_DENS (1<<4) /* density select, must be 0 */
-#define UDC_MD_UNUSED (1<<3) /* bit 3 is not used and must be 0 */
-#define UDC_MD_SRATE (7<<0) /* seek step rate */
-
-#define UDC_MD_HDD 0xC0
-#define UDC_MD_RX33 0x82
-#define UDC_MD_RX50 0x81
-
-/*
- * Definition of bits in the Chip-Status register
- */
-#define UDC_CS_RETREQ (1<<7) /* retry required */
-#define UDC_CS_ECCATT (1<<6) /* error correction attempted */
-#define UDC_CS_ECCERR (1<<5) /* ECC/CRC error */
-#define UDC_CS_DELDATA (1<<4) /* deleted data mark */
-#define UDC_CS_SYNCERR (1<<3) /* synchronization error */
-#define UDC_CS_COMPERR (1<<2) /* compare error */
-#define UDC_CS_PRESDRV (0x3) /* present drive selected */
-
-/*
- * Definition of bits in the Termination-Conditions register
- */
-#define UDC_TC_CRCPRE (1<<7) /* CRC register preset, must be 1 */
-#define UDC_TC_UNUSED (1<<6) /* bit 6 is not used and must be 0 */
-#define UDC_TC_INTDONE (1<<5) /* interrupt on done */
-#define UDC_TC_TDELDAT (1<<4) /* terminate on deleted data */
-#define UDC_TC_TDSTAT3 (1<<3) /* terminate on drive status 3 change */
-#define UDC_TC_TWPROT (1<<2) /* terminate on write-protect (FDD only) */
-#define UDC_TC_INTRDCH (1<<1) /* interrupt on ready change (FDD only) */
-#define UDC_TC_TWRFLT (1<<0) /* interrupt on write-fault (HDD only) */
-
-#define UDC_TC_HDD 0xA5 /* 0xB5 ??? */
-#define UDC_TC_FDD 0xA0 /* 0xAA ??? 0xB4 ??? */
-
-/*
- * Definition of bits in the Disk-Status register
- */
-#define UDC_DS_SELACK (1<<7) /* select acknowledge (harddisk only!) */
-#define UDC_DS_INDEX (1<<6) /* index point */
-#define UDC_DS_SKCOM (1<<5) /* seek complete */
-#define UDC_DS_TRK00 (1<<4) /* track 0 */
-#define UDC_DS_DSTAT3 (1<<3) /* drive status 3 (MBZ) */
-#define UDC_DS_WRPROT (1<<2) /* write protect (floppy only!) */
-#define UDC_DS_READY (1<<1) /* drive ready bit */
-#define UDC_DS_WRFAULT (1<<0) /* write fault */
diff --git a/sys/arch/vax/vsa/if_le_vsbus.c b/sys/arch/vax/vsa/if_le_vsbus.c
deleted file mode 100644
index 59198c35815..00000000000
--- a/sys/arch/vax/vsa/if_le_vsbus.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/* $OpenBSD: if_le_vsbus.c,v 1.15 2014/12/22 02:26:54 tedu Exp $ */
-/* $NetBSD: if_le_vsbus.c,v 1.10 2000/06/29 07:14:18 mrg Exp $ */
-
-/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum.
- *
- * 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 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) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * 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.
- *
- * @(#)if_le.c 8.2 (Berkeley) 11/16/93
- */
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#include <sys/syslog.h>
-#include <sys/socket.h>
-#include <sys/device.h>
-#include <sys/reboot.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <net/if.h>
-#include <net/if_media.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#include <machine/cpu.h>
-#include <machine/sid.h>
-#include <machine/scb.h>
-#include <machine/bus.h>
-#include <machine/vsbus.h>
-
-#include <dev/ic/lancereg.h>
-#include <dev/ic/lancevar.h>
-#include <dev/ic/am7990reg.h>
-#include <dev/ic/am7990var.h>
-
-struct le_softc {
- struct am7990_softc sc_am7990; /* Must be first */
- struct evcount sc_intrcnt;
- bus_dmamap_t sc_dm;
- volatile u_short *sc_rap;
- volatile u_short *sc_rdp;
-};
-
-static int le_vsbus_match(struct device *, struct cfdata *, void *);
-static void le_vsbus_attach(struct device *, struct device *, void *);
-static void lewrcsr(struct lance_softc *, uint16_t, uint16_t);
-static uint16_t lerdcsr(struct lance_softc *, uint16_t);
-
-struct cfattach le_vsbus_ca = {
- sizeof(struct le_softc), (cfmatch_t)le_vsbus_match, le_vsbus_attach
-};
-
-static void
-lewrcsr(struct lance_softc *ls, uint16_t port, uint16_t val)
-{
- struct le_softc *sc = (void *)ls;
-
- *sc->sc_rap = port;
- *sc->sc_rdp = val;
-}
-
-static uint16_t
-lerdcsr(struct lance_softc *ls, uint16_t port)
-{
- struct le_softc *sc = (void *)ls;
-
- *sc->sc_rap = port;
- return *sc->sc_rdp;
-}
-
-static int
-le_vsbus_match(struct device *parent, struct cfdata *cf, void *aux)
-{
- struct vsbus_attach_args *va = aux;
- volatile short *rdp, *rap;
- struct leinit initblock;
- bus_dmamap_t map;
- int i;
- int rv = 0;
- int error;
-
- if (vax_boardtype == VAX_BTYP_49 || vax_boardtype == VAX_BTYP_1303)
- return 0;
-
- error = bus_dmamap_create(va->va_dmat, sizeof(initblock), 1,
- sizeof(initblock), 0, BUS_DMA_NOWAIT, &map);
- if (error) {
- return 0;
- }
-
- error = bus_dmamap_load(va->va_dmat, map, &initblock,
- sizeof(initblock), NULL, BUS_DMA_NOWAIT|BUS_DMA_COHERENT);
- if (error) {
- bus_dmamap_destroy(va->va_dmat, map);
- return 0;
- }
-
- memset(&initblock, 0, sizeof(initblock));
-
- rdp = (short *)va->va_addr;
- rap = rdp + 2;
-
- /* Make sure the chip is stopped. */
- *rap = LE_CSR0;
- *rdp = LE_C0_STOP;
- DELAY(100);
- *rap = LE_CSR1;
- *rdp = map->dm_segs->ds_addr & 0xffff;
- *rap = LE_CSR2;
- *rdp = (map->dm_segs->ds_addr >> 16) & 0xffff;
- *rap = LE_CSR0;
- *rdp = LE_C0_INIT|LE_C0_INEA;
-
- /* Wait for initialization to finish. */
- for (i = 100; i >= 0; i--) {
- DELAY(1000);
- /* Should have interrupted by now */
- *rap = LE_CSR0;
- if (*rdp & LE_C0_IDON)
- rv = 1;
- }
- *rap = LE_CSR0;
- *rdp = LE_C0_STOP;
-
- bus_dmamap_unload(va->va_dmat, map);
- bus_dmamap_destroy(va->va_dmat, map);
- return rv;
-}
-
-static void
-le_vsbus_attach(struct device *parent, struct device *self, void *aux)
-{
- struct vsbus_attach_args *va = aux;
- struct le_softc *lesc = (void *)self;
- struct lance_softc *sc = &lesc->sc_am7990.lsc;
- bus_dma_segment_t seg;
- int *lance_addr;
- int i, err, rseg;
- static int cvec;
-
- lesc->sc_rdp = (short *)vax_map_physmem(NI_BASE, 1);
- lesc->sc_rap = lesc->sc_rdp + 2;
-
- /*
- * MD functions.
- */
- sc->sc_rdcsr = lerdcsr;
- sc->sc_wrcsr = lewrcsr;
- sc->sc_nocarrier = NULL;
-
- scb_vecalloc(va->va_cvec, (void (*)(void *))am7990_intr, sc,
- SCB_ISTACK, &lesc->sc_intrcnt);
- cvec = va->va_cvec;
- evcount_attach(&lesc->sc_intrcnt, self->dv_xname, &cvec);
-
- /*
- * Allocate a (DMA-safe) block for all descriptors and buffers.
- */
-
-#define ALLOCSIZ (64 * 1024)
- err = bus_dmamem_alloc(va->va_dmat, ALLOCSIZ, NBPG, 0,
- &seg, 1, &rseg, BUS_DMA_NOWAIT);
- if (err) {
- printf(": unable to alloc buffer block: err %d\n", err);
- return;
- }
- err = bus_dmamem_map(va->va_dmat, &seg, rseg, ALLOCSIZ,
- (caddr_t *)&sc->sc_mem, BUS_DMA_NOWAIT | BUS_DMA_COHERENT);
- if (err) {
- printf(": unable to map buffer block: err %d\n", err);
- bus_dmamem_free(va->va_dmat, &seg, rseg);
- return;
- }
- err = bus_dmamap_create(va->va_dmat, ALLOCSIZ, rseg, ALLOCSIZ,
- 0, BUS_DMA_NOWAIT, &lesc->sc_dm);
- if (err) {
- printf(": unable to create dma map: err %d\n", err);
- bus_dmamem_free(va->va_dmat, &seg, rseg);
- return;
- }
- err = bus_dmamap_load(va->va_dmat, lesc->sc_dm, sc->sc_mem,
- ALLOCSIZ, NULL, BUS_DMA_NOWAIT);
- if (err) {
- printf(": unable to load dma map: err %d\n", err);
- bus_dmamap_destroy(va->va_dmat, lesc->sc_dm);
- bus_dmamem_free(va->va_dmat, &seg, rseg);
- return;
- }
- printf(" buf 0x%lx-0x%lx", lesc->sc_dm->dm_segs->ds_addr,
- lesc->sc_dm->dm_segs->ds_addr + lesc->sc_dm->dm_segs->ds_len - 1);
- sc->sc_addr = lesc->sc_dm->dm_segs->ds_addr & 0xffffff;
- sc->sc_memsize = lesc->sc_dm->dm_segs->ds_len;
-
- sc->sc_copytodesc = lance_copytobuf_contig;
- sc->sc_copyfromdesc = lance_copyfrombuf_contig;
- sc->sc_copytobuf = lance_copytobuf_contig;
- sc->sc_copyfrombuf = lance_copyfrombuf_contig;
- sc->sc_zerobuf = lance_zerobuf_contig;
-
-#ifdef LEDEBUG
- sc->sc_debug = 1;
-#endif
- /*
- * Get the ethernet address out of rom
- */
- lance_addr = (int *)vax_map_physmem(NI_ADDR, 1);
- for (i = 0; i < 6; i++)
- sc->sc_arpcom.ac_enaddr[i] = (u_char)lance_addr[i];
- vax_unmap_physmem((vaddr_t)lance_addr, 1);
-
- /* Prettier printout */
- printf("\n%s", self->dv_xname);
-
- am7990_config(&lesc->sc_am7990);
-}
diff --git a/sys/arch/vax/vsa/if_ze_vsbus.c b/sys/arch/vax/vsa/if_ze_vsbus.c
deleted file mode 100644
index 0e8c91dea1a..00000000000
--- a/sys/arch/vax/vsa/if_ze_vsbus.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $OpenBSD: if_ze_vsbus.c,v 1.8 2015/11/24 17:11:39 mpi Exp $ */
-/* $NetBSD: if_ze_vsbus.c,v 1.5 2000/07/26 21:50:49 matt Exp $ */
-/*
- * Copyright (c) 1999 Ludd, University of Lule}, Sweden. 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/socket.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-#include <sys/sockio.h>
-
-#include <net/if.h>
-#include <net/if_media.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#include <machine/bus.h>
-#include <machine/vsbus.h>
-#include <machine/cpu.h>
-#include <machine/scb.h>
-#include <machine/sid.h>
-
-#include <arch/vax/if/sgecreg.h>
-#include <arch/vax/if/sgecvar.h>
-
-/*
- * Addresses.
- */
-#define SGECADDR 0x20008000
-#define NISA_ROM 0x27800000
-#define SGECVEC 0x108
-
-static int zematch(struct device *, void *, void *);
-static void zeattach(struct device *, struct device *, void *);
-
-struct cfattach ze_vsbus_ca = {
- sizeof(struct ze_softc), zematch, zeattach
-};
-
-/*
- * Check for present SGEC.
- */
-int
-zematch(parent, cf, aux)
- struct device *parent;
- void *cf;
- void *aux;
-{
- /*
- * Should some more intelligent checking be done???
- * Should for sure force an interrupt instead...
- */
- if (vax_boardtype != VAX_BTYP_49)
- return 0;
-
- /* Fool the interrupt system. */
- scb_fake(SGECVEC, 0x15);
- return 12;
-}
-
-/*
- * Interface exists: make available by filling in network interface
- * record. System will initialize the interface when it is ready
- * to accept packets.
- */
-void
-zeattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct ze_softc *sc = (struct ze_softc *)self;
- struct vsbus_attach_args *va = aux;
- extern struct vax_bus_dma_tag vax_bus_dma_tag;
- int *ea, i;
-
- /*
- * Map in SGEC registers.
- */
- sc->sc_ioh = vax_map_physmem(SGECADDR, 1);
- sc->sc_iot = 0; /* :-) */
- sc->sc_dmat = &vax_bus_dma_tag;
-
- sc->sc_intvec = SGECVEC;
- scb_vecalloc(va->va_cvec, (void (*)(void *)) sgec_intr,
- sc, SCB_ISTACK, &sc->sc_intrcnt);
- evcount_attach(&sc->sc_intrcnt, sc->sc_dev.dv_xname, &sc->sc_intvec);
-
- /*
- * Map in, read and release ethernet rom address.
- */
- ea = (int *)vax_map_physmem(NISA_ROM, 1);
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- sc->sc_ac.ac_enaddr[i] = ea[i] & 0377;
- vax_unmap_physmem((vaddr_t)ea, 1);
-
- sgec_attach(sc);
-}
diff --git a/sys/arch/vax/vsa/lcg.c b/sys/arch/vax/vsa/lcg.c
deleted file mode 100644
index f1991c16005..00000000000
--- a/sys/arch/vax/vsa/lcg.c
+++ /dev/null
@@ -1,845 +0,0 @@
-/* $OpenBSD: lcg.c,v 1.23 2014/12/23 21:39:12 miod Exp $ */
-/*
- * Copyright (c) 2006 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice, this permission notice, and the disclaimer below
- * appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Copyright (c) 2003, 2004 Blaz Antonic
- * 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 abovementioned copyrights
- * 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 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/device.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-
-#include <machine/vsbus.h>
-#include <machine/scb.h>
-#include <machine/sid.h>
-#include <machine/cpu.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <dev/cons.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <vax/vsa/lcgreg.h>
-
-#define LCG_CONFIG_ADDR 0x200f0010 /* configuration register */
-#define LCG_REG_ADDR 0x20100000 /* registers */
-#define LCG_REG_SIZE 0x4000
-#define LCG_LUT_ADDR 0x21800000 /* colormap */
-#define LCG_LUT_OFFSET 0x0800
-#define LCG_LUT_SIZE 0x0800
-#define LCG_FB_ADDR 0x21801000 /* frame buffer */
-
-int lcg_match(struct device *, void *, void *);
-void lcg_attach(struct device *, struct device *, void *);
-
-struct lcg_screen {
- struct rasops_info ss_ri;
- u_int32_t ss_cfg;
- u_int ss_width, ss_height, ss_depth;
- u_int ss_fbsize; /* visible part only */
- caddr_t ss_addr; /* frame buffer address */
- vaddr_t ss_reg;
- volatile u_int8_t *ss_lut;
- u_int8_t ss_cmap[256 * 3];
-};
-
-/* for console */
-struct lcg_screen lcg_consscr;
-
-struct lcg_softc {
- struct device sc_dev;
- struct lcg_screen *sc_scr;
- int sc_nscreens;
-};
-
-struct cfattach lcg_ca = {
- sizeof(struct lcg_softc), lcg_match, lcg_attach,
-};
-
-struct cfdriver lcg_cd = {
- NULL, "lcg", DV_DULL
-};
-
-struct wsscreen_descr lcg_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *_lcg_scrlist[] = {
- &lcg_stdscreen,
-};
-
-const struct wsscreen_list lcg_screenlist = {
- sizeof(_lcg_scrlist) / sizeof(struct wsscreen_descr *),
- _lcg_scrlist,
-};
-
-int lcg_ioctl(void *, u_long, caddr_t, int, struct proc *);
-paddr_t lcg_mmap(void *, off_t, int);
-int lcg_alloc_screen(void *, const struct wsscreen_descr *,
- void **, int *, int *, long *);
-void lcg_free_screen(void *, void *);
-int lcg_show_screen(void *, void *, int,
- void (*) (void *, int, int), void *);
-int lcg_load_font(void *, void *, struct wsdisplay_font *);
-int lcg_list_font(void *, struct wsdisplay_font *);
-void lcg_burner(void *, u_int, u_int);
-
-const struct wsdisplay_accessops lcg_accessops = {
- .ioctl = lcg_ioctl,
- .mmap = lcg_mmap,
- .alloc_screen = lcg_alloc_screen,
- .free_screen = lcg_free_screen,
- .show_screen = lcg_show_screen,
- .load_font = lcg_load_font,
- .list_font = lcg_list_font,
- .burn_screen = lcg_burner
-};
-
-int lcg_alloc_attr(void *, int, int, int, long *);
-int lcg_getcmap(struct lcg_screen *, struct wsdisplay_cmap *);
-void lcg_loadcmap(struct lcg_screen *, int, int);
-int lcg_probe_screen(u_int32_t, u_int *, u_int *);
-int lcg_putcmap(struct lcg_screen *, struct wsdisplay_cmap *);
-void lcg_resetcmap(struct lcg_screen *);
-int lcg_setup_screen(struct lcg_screen *);
-
-#define lcg_read_reg(ss, regno) \
- *(volatile u_int32_t *)((ss)->ss_reg + (regno))
-#define lcg_write_reg(ss, regno, val) \
- *(volatile u_int32_t *)((ss)->ss_reg + (regno)) = (val)
-
-int
-lcg_match(struct device *parent, void *vcf, void *aux)
-{
- struct vsbus_softc *sc = (void *)parent;
- struct vsbus_attach_args *va = aux;
- vaddr_t cfgreg;
- int depth;
-#ifdef PARANOIA
- int missing;
- volatile u_int8_t *ch;
-#endif
-
- if (va->va_paddr != LCG_REG_ADDR)
- return (0);
-
- switch (vax_boardtype) {
- default:
- return (0);
-
- case VAX_BTYP_46:
- if ((vax_confdata & 0x40) == 0)
- return (0);
- break;
- case VAX_BTYP_48:
- if (vax_cpustype != VAX_STYP_48)
- return (0);
- /* KA48 can't boot without the frame buffer board */
- break;
- }
-
- /*
- * Check the configuration register. The frame buffer might not be
- * an lcg board.
- */
- cfgreg = vax_map_physmem(LCG_CONFIG_ADDR, 1);
- depth = lcg_probe_screen(*(volatile u_int32_t *)cfgreg, NULL, NULL);
- vax_unmap_physmem(cfgreg, 1);
- if (depth < 0) /* no lcg frame buffer */
- return (0);
-
-#ifdef PARANOIA
- /*
- * Check for video memory.
- * We can not use badaddr() on these models.
- */
- missing = 0;
- ch = (volatile u_int8_t *)vax_map_physmem(LCG_FB_ADDR, 1);
- *ch = 0x01;
- if ((*ch & 0x01) == 0)
- missing = 1;
- else {
- *ch = 0x00;
- if ((*ch & 0x01) != 0)
- missing = 1;
- }
- vax_unmap_physmem((vaddr_t)ch, 1);
- if (missing != 0)
- return (0);
-#endif
-
- sc->sc_mask = 0x04; /* XXX - should be generated */
- scb_fake(0x120, 0x15);
- return (20);
-}
-
-void
-lcg_attach(struct device *parent, struct device *self, void *aux)
-{
- struct lcg_softc *sc = (struct lcg_softc *)self;
- struct lcg_screen *ss;
- struct wsemuldisplaydev_attach_args aa;
- vaddr_t tmp;
- u_int32_t cfg;
- int console;
- extern struct consdev wsdisplay_cons;
-
- console = (vax_confdata & 0x100) == 0 && cn_tab == &wsdisplay_cons;
-
- /*
- * Check for a recognized configuration register.
- * If we do not recognize it, print it and do not attach - so that
- * this gets noticed...
- */
- if (!console) {
- tmp = vax_map_physmem(LCG_CONFIG_ADDR, 1);
- if (tmp == 0) {
- printf("\n%s: can not map configuration register\n",
- self->dv_xname);
- return;
- }
- cfg = *(volatile u_int32_t *)tmp;
- vax_unmap_physmem(tmp, 1);
-
- if (lcg_probe_screen(cfg, NULL, NULL) <= 0) {
- printf("\n%s:"
- " unrecognized configuration register %08x\n",
- self->dv_xname, cfg);
- return;
- }
- }
-
- if (console) {
- ss = &lcg_consscr;
- sc->sc_nscreens = 1;
- } else {
- ss = malloc(sizeof(*ss), M_DEVBUF, M_NOWAIT | M_ZERO);
- if (ss == NULL) {
- printf(": can not allocate memory\n");
- return;
- }
-
- ss->ss_cfg = cfg;
- ss->ss_depth = lcg_probe_screen(ss->ss_cfg,
- &ss->ss_width, &ss->ss_height);
- ss->ss_fbsize =
- roundup(ss->ss_width * ss->ss_height, PAGE_SIZE);
-
- ss->ss_addr = (caddr_t)vax_map_physmem(LCG_FB_ADDR,
- ss->ss_fbsize / VAX_NBPG);
- if (ss->ss_addr == NULL) {
- printf(": can not map frame buffer\n");
- goto fail1;
- }
-
- ss->ss_reg = vax_map_physmem(LCG_REG_ADDR,
- LCG_REG_SIZE / VAX_NBPG);
- if (ss->ss_reg == 0L) {
- printf(": can not map registers\n");
- goto fail2;
- }
-
- ss->ss_lut = (volatile u_int8_t *)vax_map_physmem(LCG_LUT_ADDR +
- LCG_LUT_OFFSET, LCG_LUT_SIZE / VAX_NBPG);
- if (ss->ss_lut == NULL) {
- printf(": can not map color LUT\n");
- goto fail3;
- }
-
- if (lcg_setup_screen(ss) != 0) {
- printf(": initialization failed\n");
- goto fail4;
- }
- }
- sc->sc_scr = ss;
-
- printf(": %dx%dx%d frame buffer\n",
- ss->ss_width, ss->ss_height, ss->ss_depth);
-
- aa.console = console;
- aa.scrdata = &lcg_screenlist;
- aa.accessops = &lcg_accessops;
- aa.accesscookie = sc;
- aa.defaultscreens = 0;
-
- config_found(self, &aa, wsemuldisplaydevprint);
- return;
-
-fail4:
- vax_unmap_physmem((vaddr_t)ss->ss_lut, LCG_LUT_SIZE / VAX_NBPG);
-fail3:
- vax_unmap_physmem(ss->ss_reg, LCG_REG_SIZE / VAX_NBPG);
-fail2:
- vax_unmap_physmem((vaddr_t)ss->ss_addr, ss->ss_fbsize / VAX_NBPG);
-fail1:
- free(ss, M_DEVBUF, sizeof(*ss));
-}
-
-/*
- * Determine if we have a recognized frame buffer, its resolution and
- * color depth.
- */
-int
-lcg_probe_screen(u_int32_t cfg, u_int *width, u_int *height)
-{
- u_int w, h, d = 8;
-
- switch (vax_boardtype) {
- case VAX_BTYP_46:
- switch (cfg & 0xf0) {
- case 0x00:
- return (-1); /* no hardware */
- case 0x20:
- case 0x60:
- w = 1024; h = 864;
- break;
- case 0x40:
- w = 1024; h = 768;
- break;
- case 0x80:
- d = 4;
- /* FALLTHROUGH */
- case 0x90:
- case 0xb0:
- w = 1280; h = 1024;
- break;
- default:
- return (0); /* unknown configuration, please help */
- }
- break;
- case VAX_BTYP_48:
- switch (cfg & 0x07) {
- case 0x00:
- return (-1); /* no hardware */
- case 0x05:
- w = 1280; h = 1024;
- break;
- case 0x06:
- if (vax_confdata & 0x80) {
- w = 1024; h = 768;
- } else {
- w = 640; h = 480;
- }
- break;
- case 0x07:
- if (vax_confdata & 0x80) {
- w = 1024; h = 768;
- } else {
- w = 1024; h = 864;
- }
- break;
- default:
- return (0); /* unknown configuration, please help */
- }
- break;
- }
-
- if (width != NULL)
- *width = w;
- if (height != NULL)
- *height = h;
-
- return (d);
-}
-
-/*
- * Initialize anything necessary for an emulating wsdisplay to work (i.e.
- * pick a font, initialize a rasops structure, setup the accessops callbacks.)
- */
-int
-lcg_setup_screen(struct lcg_screen *ss)
-{
- struct rasops_info *ri = &ss->ss_ri;
-
- bzero(ri, sizeof(*ri));
- /*
- * Since the frame buffer memory is byte addressed, even in low-bpp
- * mode, initialize a 8bpp rasops engine. We will report a shorter
- * colormap if necessary, which will allow X to do TRT.
- */
- ri->ri_depth = 8;
- ri->ri_width = ss->ss_width;
- ri->ri_height = ss->ss_height;
- ri->ri_stride = ss->ss_width;
- ri->ri_flg = RI_CLEAR | RI_CENTER;
- ri->ri_bits = (void *)ss->ss_addr;
- ri->ri_hw = ss;
-
- /*
- * Ask for an unholy big display, rasops will trim this to more
- * reasonable values.
- */
- if (rasops_init(ri, 160, 160) != 0)
- return (-1);
-
- if (ss->ss_depth < 8) {
- ri->ri_ops.alloc_attr = lcg_alloc_attr;
- ri->ri_caps &= ~WSSCREEN_HILIT;
- }
-
- lcg_stdscreen.ncols = ri->ri_cols;
- lcg_stdscreen.nrows = ri->ri_rows;
- lcg_stdscreen.textops = &ri->ri_ops;
- lcg_stdscreen.fontwidth = ri->ri_font->fontwidth;
- lcg_stdscreen.fontheight = ri->ri_font->fontheight;
- lcg_stdscreen.capabilities = ri->ri_caps;
-
- lcg_resetcmap(ss);
-
- return (0);
-}
-
-int
-lcg_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- struct lcg_softc *sc = v;
- struct lcg_screen *ss = sc->sc_scr;
- struct wsdisplay_fbinfo *wdf;
- struct wsdisplay_cmap *cm;
- int error;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_LCG;
- break;
-
- case WSDISPLAYIO_GINFO:
- wdf = (struct wsdisplay_fbinfo *)data;
- wdf->height = ss->ss_height;
- wdf->width = ss->ss_width;
- wdf->depth = 8;
- wdf->cmsize = 1 << ss->ss_depth;
- break;
-
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = ss->ss_ri.ri_stride;
- break;
-
- case WSDISPLAYIO_GETCMAP:
- cm = (struct wsdisplay_cmap *)data;
- error = lcg_getcmap(ss, cm);
- if (error != 0)
- return (error);
- break;
- case WSDISPLAYIO_PUTCMAP:
- cm = (struct wsdisplay_cmap *)data;
- error = lcg_putcmap(ss, cm);
- if (error != 0)
- return (error);
- lcg_loadcmap(ss, cm->index, cm->count);
- break;
-
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- break;
-
- default:
- return (-1);
- }
-
- return (0);
-}
-
-paddr_t
-lcg_mmap(void *v, off_t offset, int prot)
-{
- struct lcg_softc *sc = v;
- struct lcg_screen *ss = sc->sc_scr;
-
- if (offset >= ss->ss_fbsize || offset < 0)
- return (-1);
-
- return (LCG_FB_ADDR + offset);
-}
-
-int
-lcg_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
- int *curxp, int *curyp, long *defattrp)
-{
- struct lcg_softc *sc = v;
- struct lcg_screen *ss = sc->sc_scr;
- struct rasops_info *ri = &ss->ss_ri;
-
- if (sc->sc_nscreens > 0)
- return (ENOMEM);
-
- *cookiep = ri;
- *curxp = *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, defattrp);
- sc->sc_nscreens++;
-
- return (0);
-}
-
-void
-lcg_free_screen(void *v, void *cookie)
-{
- struct lcg_softc *sc = v;
-
- sc->sc_nscreens--;
-}
-
-int
-lcg_show_screen(void *v, void *cookie, int waitok,
- void (*cb)(void *, int, int), void *cbarg)
-{
- return (0);
-}
-
-int
-lcg_load_font(void *v, void *emulcookie, struct wsdisplay_font *font)
-{
- struct lcg_softc *sc = v;
- struct lcg_screen *ss = sc->sc_scr;
- struct rasops_info *ri = &ss->ss_ri;
-
- return rasops_load_font(ri, emulcookie, font);
-}
-
-int
-lcg_list_font(void *v, struct wsdisplay_font *font)
-{
- struct lcg_softc *sc = v;
- struct lcg_screen *ss = sc->sc_scr;
- struct rasops_info *ri = &ss->ss_ri;
-
- return rasops_list_font(ri, font);
-}
-
-void
-lcg_burner(void *v, u_int on, u_int flags)
-{
- struct lcg_softc *sc = v;
- struct lcg_screen *ss = sc->sc_scr;
- u_int32_t vidcfg;
-
- vidcfg = lcg_read_reg(ss, LCG_REG_VIDEO_CONFIG);
- if (on)
- vidcfg |= VIDEO_ENABLE_VIDEO | VIDEO_SYNC_ENABLE;
- else {
- vidcfg &= ~VIDEO_ENABLE_VIDEO;
- if (flags & WSDISPLAY_BURN_VBLANK)
- vidcfg &= ~VIDEO_SYNC_ENABLE;
- }
- lcg_write_reg(ss, LCG_REG_VIDEO_CONFIG, vidcfg);
-}
-
-/*
- * Attribute allocator for 4bpp frame buffers.
- * In such modes, highlighting is not available.
- */
-int
-lcg_alloc_attr(void *cookie, int fg, int bg, int flg, long *attr)
-{
- extern int rasops_alloc_cattr(void *, int, int, int, long *);
-
- if ((flg & (WSATTR_BLINK | WSATTR_HILIT)) != 0)
- return (EINVAL);
-
- return (rasops_alloc_cattr(cookie, fg, bg, flg, attr));
-}
-
-/*
- * Colormap handling routines
- */
-
-int
-lcg_getcmap(struct lcg_screen *ss, struct wsdisplay_cmap *cm)
-{
- u_int index = cm->index, count = cm->count, i;
- u_int colcount = 1 << ss->ss_depth;
- int error;
- u_int8_t ramp[256], *c, *r;
-
- if (index >= colcount || count > colcount - index)
- return (EINVAL);
-
- /* extract reds */
- c = ss->ss_cmap + 0 + index * 3;
- for (i = count, r = ramp; i != 0; i--)
- *r++ = *c, c += 3;
- if ((error = copyout(ramp, cm->red, count)) != 0)
- return (error);
-
- /* extract greens */
- c = ss->ss_cmap + 1 + index * 3;
- for (i = count, r = ramp; i != 0; i--)
- *r++ = *c, c += 3;
- if ((error = copyout(ramp, cm->green, count)) != 0)
- return (error);
-
- /* extract blues */
- c = ss->ss_cmap + 2 + index * 3;
- for (i = count, r = ramp; i != 0; i--)
- *r++ = *c, c += 3;
- if ((error = copyout(ramp, cm->blue, count)) != 0)
- return (error);
-
- return (0);
-}
-
-int
-lcg_putcmap(struct lcg_screen *ss, struct wsdisplay_cmap *cm)
-{
- u_int index = cm->index, count = cm->count;
- u_int colcount = 1 << ss->ss_depth;
- int i, error;
- u_int8_t r[256], g[256], b[256], *nr, *ng, *nb, *c;
-
- if (index >= colcount || count > colcount - index)
- return (EINVAL);
-
- if ((error = copyin(cm->red, r, count)) != 0)
- return (error);
- if ((error = copyin(cm->green, g, count)) != 0)
- return (error);
- if ((error = copyin(cm->blue, b, count)) != 0)
- return (error);
-
- nr = r, ng = g, nb = b;
- c = ss->ss_cmap + index * 3;
- for (i = count; i != 0; i--) {
- *c++ = *nr++;
- *c++ = *ng++;
- *c++ = *nb++;
- }
-
- return (0);
-}
-
-/* Fill the given colormap (LUT) entry. */
-#define lcg_set_lut_entry(lutptr, cmap, idx, shift) \
-do { \
- *(lutptr)++ = LUT_ADRS_REG; \
- *(lutptr)++ = (idx); \
- *(lutptr)++ = LUT_COLOR_AUTOINC; \
- *(lutptr)++ = (*(cmap)++) >> (shift); \
- *(lutptr)++ = LUT_COLOR_AUTOINC; \
- *(lutptr)++ = (*(cmap)++) >> (shift); \
- *(lutptr)++ = LUT_COLOR_AUTOINC; \
- *(lutptr)++ = (*(cmap)++) >> (shift); \
-} while (0)
-
-void
-lcg_loadcmap(struct lcg_screen *ss, int from, int count)
-{
- const u_int8_t *cmap;
- u_int i;
- volatile u_int8_t *lutptr;
- u_int32_t vidcfg;
-
- /* partial updates ignored for now */
- cmap = ss->ss_cmap;
- lutptr = ss->ss_lut;
- if (ss->ss_depth == 8) {
- for (i = 0; i < 256; i++) {
- lcg_set_lut_entry(lutptr, cmap, i, 0);
- }
- } else {
- for (i = 0; i < 16; i++) {
- lcg_set_lut_entry(lutptr, cmap, i, 4);
- }
- }
-
- /*
- * Wait for retrace
- */
- while (((vidcfg = lcg_read_reg(ss, LCG_REG_VIDEO_CONFIG)) &
- VIDEO_VSTATE) != VIDEO_VSYNC)
- DELAY(1);
-
- vidcfg &= ~(VIDEO_SHIFT_SEL | VIDEO_MEM_REFRESH_SEL_MASK |
- VIDEO_LUT_SHIFT_SEL);
- /* Do full loads if width is 1024 or 2048, split loads otherwise. */
- if (ss->ss_width == 1024 || ss->ss_width == 2048)
- vidcfg |= VIDEO_SHIFT_SEL | (1 << VIDEO_MEM_REFRESH_SEL_SHIFT) |
- VIDEO_LUT_SHIFT_SEL;
- else
- vidcfg |= (2 << VIDEO_MEM_REFRESH_SEL_SHIFT);
- vidcfg |= VIDEO_LUT_LOAD_SIZE; /* 2KB lut */
- lcg_write_reg(ss, LCG_REG_VIDEO_CONFIG, vidcfg);
- lcg_write_reg(ss, LCG_REG_LUT_CONSOLE_SEL, LUT_SEL_COLOR);
- lcg_write_reg(ss, LCG_REG_LUT_COLOR_BASE_W, LCG_LUT_OFFSET);
- /* Wait for end of retrace */
- while (((vidcfg = lcg_read_reg(ss, LCG_REG_VIDEO_CONFIG)) &
- VIDEO_VSTATE) == VIDEO_VSYNC)
- DELAY(1);
- lcg_write_reg(ss, LCG_REG_LUT_CONSOLE_SEL, LUT_SEL_CONSOLE);
-}
-
-void
-lcg_resetcmap(struct lcg_screen *ss)
-{
- if (ss->ss_depth == 8)
- bcopy(rasops_cmap, ss->ss_cmap, sizeof(ss->ss_cmap));
- else {
- bcopy(rasops_cmap, ss->ss_cmap, 8 * 3);
- bcopy(rasops_cmap + 0xf8 * 3, ss->ss_cmap + 8 * 3, 8 * 3);
- }
- lcg_loadcmap(ss, 0, 1 << ss->ss_depth);
-}
-
-/*
- * Console support code
- */
-
-int lcgcnprobe(void);
-int lcgcninit(void);
-
-int
-lcgcnprobe()
-{
- extern vaddr_t virtual_avail;
- u_int32_t cfg;
- vaddr_t tmp;
-#ifdef PARANOIA
- volatile u_int8_t *ch;
- int rc;
-#endif
-
- switch (vax_boardtype) {
- case VAX_BTYP_46:
- if ((vax_confdata & 0x40) == 0)
- return (0); /* no frame buffer */
- break;
- case VAX_BTYP_48:
- if (vax_cpustype != VAX_STYP_48)
- return (0);
- break;
- default:
- return (0);
- }
-
- if ((vax_confdata & 0x100) != 0)
- return (0); /* doesn't use graphics console */
-
- tmp = virtual_avail;
- ioaccess(tmp, vax_trunc_page(LCG_CONFIG_ADDR), 1);
- cfg = *(volatile u_int32_t *)(tmp + (LCG_CONFIG_ADDR & VAX_PGOFSET));
- iounaccess(tmp, 1);
-
- if (lcg_probe_screen(cfg, NULL, NULL) <= 0)
- return (0); /* no lcg or unsupported configuration */
-
-#ifdef PARANOIA
- /*
- * Check for video memory.
- * We can not use badaddr() on these models.
- */
- rc = 0;
- ioaccess(tmp, LCG_FB_ADDR, 1);
- ch = (volatile u_int8_t *)tmp;
- *ch = 0x01;
- if ((*ch & 0x01) != 0) {
- *ch = 0x00;
- if ((*ch & 0x01) == 0)
- rc = 1;
- }
- iounaccess(tmp, 1);
- if (rc == 0)
- return (0);
-#endif
-
- return (1);
-}
-
-/*
- * Called very early to setup the glass tty as console.
- * Because it's called before the VM system is initialized, virtual memory
- * for the framebuffer can be stolen directly without disturbing anything.
- */
-int
-lcgcninit()
-{
- struct lcg_screen *ss = &lcg_consscr;
- extern vaddr_t virtual_avail;
- vaddr_t ova;
- long defattr;
- struct rasops_info *ri;
-
- ova = virtual_avail;
- ioaccess(virtual_avail, vax_trunc_page(LCG_CONFIG_ADDR), 1);
- ss->ss_cfg = *(volatile u_int32_t *)
- (virtual_avail + (LCG_CONFIG_ADDR & VAX_PGOFSET));
- iounaccess(virtual_avail, 1);
-
- ss->ss_depth = lcg_probe_screen(ss->ss_cfg,
- &ss->ss_width, &ss->ss_height);
-
- ss->ss_fbsize = roundup(ss->ss_width * ss->ss_height, PAGE_SIZE);
-
- ss->ss_addr = (caddr_t)virtual_avail;
- ioaccess(virtual_avail, LCG_FB_ADDR, ss->ss_fbsize / VAX_NBPG);
- virtual_avail += ss->ss_fbsize;
-
- ss->ss_reg = virtual_avail;
- ioaccess(virtual_avail, LCG_REG_ADDR, LCG_REG_SIZE / VAX_NBPG);
- virtual_avail += LCG_REG_SIZE;
-
- ss->ss_lut = (volatile u_int8_t *)virtual_avail;
- ioaccess(virtual_avail, LCG_LUT_ADDR + LCG_LUT_OFFSET,
- LCG_LUT_SIZE / VAX_NBPG);
- virtual_avail += LCG_LUT_SIZE;
-
- virtual_avail = round_page(virtual_avail);
-
- /* this had better not fail */
- if (lcg_setup_screen(ss) != 0) {
- iounaccess((vaddr_t)ss->ss_lut, LCG_LUT_SIZE / VAX_NBPG);
- iounaccess((vaddr_t)ss->ss_reg, LCG_REG_SIZE / VAX_NBPG);
- iounaccess((vaddr_t)ss->ss_addr, ss->ss_fbsize / VAX_NBPG);
- virtual_avail = ova;
- return (1);
- }
-
- ri = &ss->ss_ri;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
- wsdisplay_cnattach(&lcg_stdscreen, ri, 0, 0, defattr);
-
- return (0);
-}
diff --git a/sys/arch/vax/vsa/lcgreg.h b/sys/arch/vax/vsa/lcgreg.h
deleted file mode 100644
index d0df3d7a276..00000000000
--- a/sys/arch/vax/vsa/lcgreg.h
+++ /dev/null
@@ -1,282 +0,0 @@
-/* $OpenBSD: lcgreg.h,v 1.4 2008/06/26 05:42:14 ray Exp $ */
-/* $NetBSD: lcgreg.h,v 1.4 2005/12/11 12:19:34 christos Exp $ */
-
-/*-
- * Copyright (c) 2000 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Matt Thomas of 3am Software Foundry.
- *
- * 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 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.
- */
-
-/*
- * The registers of the LCG used in the VS4000/60 and VS4000/VLC.
- * All relative to 0x20100000
- */
-
-/* Memory Control, Flow Control, Configuration Registers
- */
-#define LCG_REG_MEM_CONFIG 0x001800
-#define LCG_REG_MEM_STATUS 0x001804
-#define LCG_REG_MEM_CURRENT_STATE 0x001808
-#define LCG_REG_MEM_ERROR 0x00180c
-#define LCG_REG_SLOW_CONTROL_STATUS 0x001810
-
-/* Video Control Registers
- */
-#define LCG_REG_VIDEO_CONFIG 0x001e00
-#define VIDEO_VSTATE 0xc0000000
-#define VIDEO_VFRONT_PORCH 0x00000000
-#define VIDEO_VSYNC 0x40000000
-#define VIDEO_VBACK_PORCH 0x80000000
-#define VIDEO_VACTIVE 0xc0000000
-#define VIDEO_HSTATE 0x30000000
-#define VIDEO_HFRONT_PORCH 0x00000000
-#define VIDEO_HSYNC 0x10000000
-#define VIDEO_HBACK_PORCH 0x20000000
-#define VIDEO_HACTIVE 0x30000000
-#define VIDEO_CONSOLE_LUT 0x02000000
-#define VIDEO_CONTROL_LUT 0x01000000
-#define VIDEO_CURSOR_ACTIVE 0x00400000
-#define VIDEO_CURSOR_SCANLINE 0x003f0000
-#define VIDEO_RESET 0x00008000
-#define VIDEO_LUT_LOAD_SIZE 0x00002000
-#define VIDEO_SYNC_ENABLE 0x00001000
-#define VIDEO_LUT_SHIFT_SEL 0x00000800
-#define VIDEO_CLOCK_SEL 0x00000400
-#define VIDEO_MEM_REFRESH_SEL_MASK 0x00000300
-#define VIDEO_MEM_REFRESH_SEL_SHIFT 8
-#define VIDEO_REFRESH_SEL 0x000000c0
-#define VIDEO_SHIFT_SEL 0x00000020
-#define VIDEO_CURSOR_PIN_TYPE 0x00000010
-#define VIDEO_LUT_LOAD_ENABLE 0x00000008
-#define VIDEO_CURSOR_ENABLE 0x00000004
-#define VIDEO_ENABLE_VIDEO 0x00000002
-#define VIDEO_TIMING_ENABLE 0x00000001
-#define LCG_REG_VIDEO_HTIMING 0x001e10
-#define LCG_REG_VIDEO_VTIMING 0x001e14
-#define LCG_REG_VIDEO_TIMING 0x001e18
-#define LCG_REG_VIDEO_X 0x000e30
-#define LCG_REG_VIDEO_Y 0x000e30
-#define LCG_REG_VIDEO_REFRESH_BASE 0x000e34
-#define LCG_REG_VIDEO_REFRESH_SHIFT 0x000e40
-#define LCG_REG_VIDEO_LUT_LOAD_COUNT 0x000e40
-#define LCG_REG_CURSOR_SCANLINE_LW0 0x000e50
-#define LCG_REG_CURSOR_SCANLINE_LW1 0x000e54
-#define LCG_REG_CURSOR_SCANLINE_LW2 0x000e58
-#define LCG_REG_CURSOR_SCANLINE_LW3 0x000e5c
-#define LCG_REG_CURSOR_BASE 0x000e80
-#define LCG_REG_CURSOR_XY 0x000e84
-#define LCG_REG_CURSOR_X 0x000e84
-#define LCG_REG_CURSOR_Y 0x000e84
-#define LCG_REG_LUT_CONSOLE_SEL 0x000ee0
-#define LUT_SEL_CONSOLE 0x00000000
-#define LUT_SEL_COLOR 0x00000001
-#define LCG_REG_LUT_COLOR_BASE_W 0x0006e4
-#define LCG_REG_LUT_COLOR_BASE_R 0x0006e4
-#define LCG_REG_LUT_CONTROL_BASE 0x000ee8
-#define LCG_REG_VIDEO_COUNTER_TEST 0x000f00
-#define LCG_REG_MEM_REFRESH_BASE 0x000f04
-
-/* Graphics Control and VM Registers
- */
-#define LCG_REG_LCG_GO 0x000c80
-#define GO_VM 0x00000008
-#define GO_AG 0x00000002
-#define GO_FIFO 0x00000001
-#define LCG_REG_NEXT_ADDRESS 0x001334
-#define LCG_REG_PA_SPTE_PTE 0x001338
-#define LCG_REG_TB_INVALIDATE_SINGLE 0x001a00
-#define LCG_REG_TB_INVALIDATE_ALL 0x001a08
-#define LCG_REG_TB_INVALIDATE_STATUS 0x001a10
-#define LCG_REG_TB_STATUS 0x001c00
-#define LCG_REG_TB_VPN_COUNT 0x001c04
-#define LCG_REG_TB_DEST_VPN 0x001c14
-#define LCG_REG_TB_SOURCE_VPN 0x001c18
-#define LCG_REG_TB_STENCIL_VPN 0x001c1c
-#define LCG_REG_TB_DEST_DATA_PFN_R 0x001c24
-#define LCG_REG_TB_DEST_DATA_PFN_W 0x001c24
-#define LCG_REG_TB_SOURCE_DATA_PFN_R 0x001c28
-#define LCG_REG_TB_SOURCE_DATA_PFN_W 0x001c28
-#define LCG_REG_TB_STENCIL_DATA_PFN_R 0x001c2c
-#define LCG_REG_TB_STENCIL_DATA_PFN_W 0x001c2c
-#define LCG_REG_TB_DEST_PRE_PFN_R 0x001c34
-#define LCG_REG_TB_DEST_PRE_PFN_W 0x001c34
-#define LCG_REG_TB_SOURCE_PTE_PFN_R 0x001c38
-#define LCG_REG_TB_SOURCE_PTE_PFN_W 0x001c38
-#define LCG_REG_TB_STENCIL_PTE_PFN_R 0x001c3c
-#define LCG_REG_TB_STENCIL_PTE_PFN_W 0x001c3c
-#define LCG_REG_GRAPHICS_CONFIG 0x001c90
-#define LCG_REG_GRAPHICS_INT_STATUS 0x001c94
-#define LCG_REG_GRAPHICS_INT_SET_ENABLE 0x001c98
-#define LCG_REG_GRAPHICS_INT_CLR_ENABLE 0x001c9c
-#define LCG_REG_GRAPHICS_SUB_STATUS 0x001ca0
-#define GSS_AG_BUSY 0x80000000
-#define GSS_SHORT_CIRCUIT 0x20000000
-#define GSS_VALID_PACKET 0x10000000
-#define GSS_1ST_LONGWORD 0x08000000
-#define GSS_FIFO_ARBITRATE 0x04000000
-#define GSS_FIFO_COMMANDER 0x03000000
-#define GSS_AG_BACKWARDS 0x00800000
-#define GSS_AG_VIRTUAL 0x00400000
-#define GSS_AG_ARBITRATE 0x00200000
-#define GSS_AG_READ_ID 0x00100000
-#define GSS_AG_ACCESS_TYPE 0x000c0000
-#define GSS_AG_ACCESS_SIZE 0x00030000
-#define GSS_RESIDUE_LW0 0x00008000
-#define GSS_RESIDUE_LW1 0x00004000
-#define GSS_RESIDUE_LW2 0x00002000
-#define GSS_FIFO_TAIL_BITS 0x00001800
-#define GSS_FIFO_IDU 0x00000400
-#define GSS_EXECUTING_CLIP 0x00000200
-#define GSS_FIFO_BPT_STALL 0x00000100
-#define GSS_FIFO_WFSYNC_STALL 0x00000080
-#define GSS_FIFO_AGBUSY_STALL 0x00000040
-#define GSS_ADRS_BPT_VIRTUAL 0x00000010
-#define GSS_VM 0x00000008
-#define GSS_FIFO_IDLE 0x00000004
-#define GSS_AG_ACCESS 0x00000002
-#define GSS_FIFO 0x00000001
-#define LCG_REG_GRAPHICS_CONTROL 0x001ca4
-#define CTRL_RESET 0x80000000
-#define CTRL_AG 0x40000000
-#define CTRL_CLIP_LIST 0x20000000
-#define CTRL_FIFO 0x10000000
-#define CTRL_SHORT_CIRCUIT 0x08000000
-#define CTRL_VM 0x04000000
-#define CTRL_VM_PROTECTION 0x02000000
-#define CTRL_OPT_INTERFACE 0x01000000
-#define CTRL_OPT_TIMEOUT_SEL 0x00c00000
-#define CTRL_OPT_RESET 0x00200000
-#define CTRL_OPTION_NORESET 0x00100000
-#define CTRL_AG_ACCESS_BPT_ARM 0x00000800
-#define CTRL_PACKET_BPT_ARM 0x00000200
-#define CTRL_ADDRESS_BPT_ARM 0x00000100
-#define LCG_REG_BREAKPT_ADDRESS 0x001cb0
-#define LCG_REG_BREAKPT_VIRTUAL 0x001cb0
-#define LCG_REG_WRITE_PROTECT_LOW_HIGH 0x001cc0
-#define LCG_REG_WRITE_PROTECT_LOW 0x001cc0
-#define LCG_REG_WRITE_PROTECT_HIGH 0x001cc0
-#define LCG_REG_MAX_VIRTUAL_ADDRESS 0x002350
-#define LCG_REG_PA_SPTE_POBR 0x002354
-
-/* Clip List / Command FIFO Registers
- */
-#define LCG_REG_CLIP_LIST_OFFSET 0x0004e4
-#define LCG_REG_CLIP_LIST_BASE 0x0004e4
-#define LCG_REG_CLIP_LIST 0x0004e4
-#define LCG_REG_FIFO_MASKS 0x000570
-#define FIFO_16K 0x00000000
-#define FIFO_32K 0x00004000
-#define FIFO_64K 0x0000c000
-#define FIFO_AFULL_AT_64 0x00000000
-#define FIFO_AFULL_AT_128 0x00002000
-#define FIFO_AFULL_AT_256 0x00003000
-#define FIFO_AFULL_AT_512 0x00003800
-#define FIFO_AFULL_AT_1024 0x00003c00
-#define FIFO_AFULL_AT_2048 0x00003e00
-#define FIFO_AFULL_AT_4096 0x00003f00
-#define FIFO_AEMPTY_AT_32 0x00000000
-#define FIFO_AEMPTY_AT_64 0x00000080
-#define FIFO_AEMPTY_AT_128 0x00000040
-#define FIFO_AEMPTY_AT_256 0x00000020
-#define FIFO_AEMPTY_AT_512 0x00000010
-#define FIFO_AEMPTY_AT_1024 0x00000008
-#define FIFO_AEMPTY_AT_2048 0x00000004
-#define FIFO_AEMPTY_AT_4096 0x00000002
-#define FIFO_AEMPTY_AT_8192 0x00000001
-#define LCG_REG_FIFO_HEAD_OFFSET 0x000574
-#define LCG_REG_FIFO_BASE 0x000574
-#define LCG_REG_FIFO_HEAD 0x000574
-#define LCG_REG_FIFO_TAIL_OFFSET 0x000578
-#define LCG_REG_FIFO_BASE2 0x000578
-#define LCG_REG_FIFO_TAIL 0x000578
-#define LCG_REG_CLIP_LIST_SAVE_OFFSET 0x000ce4
-#define LCG_REG_FIFO_RESIDUE_LW0 0x000d04
-#define LCG_REG_FIFO_RESIDUE_LW1 0x000d08
-#define LCG_REG_FIFO_RESIDUE_LW2 0x000d0c
-#define LCG_REG_FIFO_LENGTH 0x000d70
-#define LCG_REG_FIFO_SAVE_HEAD_OFFSET 0x000d74
-#define LCG_REG_FIFO_WINDOW_BASE 0x080000
-#define LCG_REG_FIFO_WINDOW_END 0x100000
-
-/* Graphics Data Buffer and Pixel SLU Registers
- */
-#define LCG_REG_LOGICAL_FUNCTION 0x000220
-#define LCG_REG_PLANE_MASK 0x000234
-#define LCG_REG_SOURCE_PLANE_INDEX 0x00026c
-#define LCG_REG_FOREGROUND_PIXEL 0x0002c0
-#define LCG_REG_BACKGROUND_PIXEL 0x0004c0
-#define LCG_REG_GDB_LW0 0x000d80
-#define LCG_REG_GDB_LW1 0x000d84
-#define LCG_REG_GDB_LW2 0x000d88
-#define LCG_REG_GDB_LW3 0x000d8c
-#define LCG_REG_GDB_LW4 0x000d90
-#define LCG_REG_GDB_LW5 0x000d94
-#define LCG_REG_GDB_LW6 0x000d98
-#define LCG_REG_GDB_LW7 0x000d9c
-#define LCG_REG_SLU_STATE 0x000da0
-
-/* Address Generator Registers
- */
-#define LCG_REG_CLIP_MIN_Y 0x000244
-#define LCG_REG_CLIP_MIN_MAX_X 0x000248
-#define LCG_REG_CLIP_MIN_X 0x000248
-#define LCG_REG_CLIP_MAX_X 0x000248
-#define LCG_REG_CLIP_MAX_Y 0x00024c
-#define LCG_REG_DEST_X_BIAS 0x000250
-#define LCG_REG_DEST_Y_ORIGIN 0x000254
-#define LCG_REG_DEST_Y_STEP 0x000258
-#define LCG_REG_SOURCE_X_BIAS 0x000260
-#define LCG_REG_SOURCE_Y_BASE 0x000264
-#define LCG_REG_SOURCE_Y_STEP_WIDTH 0x000268
-#define LCG_REG_SOURCE_Y_STEP 0x000268
-#define LCG_REG_SOURCE_WIDTH 0x000268
-#define LCG_REG_STENCIL_X_BIAS 0x000270
-#define LCG_REG_STENCIL_Y_BASE 0x000274
-#define LCG_REG_STENCIL_Y_STEP 0x000278
-#define LCG_REG_DEST_Y_BASE 0x000284
-#define LCG_REG_DEST_X 0x000290
-#define LCG_REG_DEST_WIDTH_HEIGHT 0x000294
-#define LCG_REG_DEST_WIDTH 0x000294
-#define LCG_REG_DEST_HEIGHT 0x000294
-#define LCG_REG_AG_STATUS2 0x000320
-#define LCG_REG_AG_CURRENT_STATE 0x000320
-#define LCG_REG_CURRENT_OPCODE 0x000320
-#define LCG_REG_OP_ACTION_CODE 0x000320
-#define LCG_REG_AG_STATUS 0x000324
-#define LCG_REG_NEXT_X 0x000330
-#define LCG_REG_CLIP_X_DIFF 0x000330
-#define LCG_REG_SOURCE_X_BIAS0 0x000460
-#define LCG_REG_SOURCE_WIDTH0 0x000468
-#define LCG_REG_DEST_X0 0x000490
-#define LCG_REG_DEST_WIDTH0 0x000494
-#define LCG_REG_TILE_ROTATION 0x000660
-#define LCG_REG_TILE_WIDTH 0x000668
-
-/*
- * LUT data bits
- */
-#define LUT_ADRS_REG 0x00 /* write to address register */
-#define LUT_COLOR_AUTOINC 0x01 /* write to LUT and autoincrement */
diff --git a/sys/arch/vax/vsa/lcspx.c b/sys/arch/vax/vsa/lcspx.c
deleted file mode 100644
index 026e80733f4..00000000000
--- a/sys/arch/vax/vsa/lcspx.c
+++ /dev/null
@@ -1,807 +0,0 @@
-/* $OpenBSD: lcspx.c,v 1.21 2014/12/23 21:39:12 miod Exp $ */
-/*
- * Copyright (c) 2006 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice, this permission notice, and the disclaimer below
- * appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Copyright (c) 2004 Blaz Antonic
- * All rights reserved.
- *
- * This software contains code written by Michael L. Hitch.
- *
- * 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 abovementioned copyrights
- * 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 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/device.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-
-#include <machine/nexus.h>
-#include <machine/vsbus.h>
-#include <machine/scb.h>
-#include <machine/sid.h>
-#include <machine/cpu.h>
-#include <machine/ka420.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <dev/cons.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <dev/ic/bt463reg.h> /* actually it's a 459 here... */
-
-#define GPXADDR 0x3c000000 /* XXX */
-#define GPX_ADDER_OFFSET 0x0000 /* XXX */
-#include <vax/qbus/qdreg.h> /* XXX */
-
-#define LCSPX_REG_ADDR 0x39302000 /* registers */
-#define LCSPX_REG_SIZE 0x2000
-#define LCSPX_REG1_ADDR 0x39b00000 /* more registers */
-#define LCSPX_RAMDAC_ADDR 0x39b10000 /* RAMDAC */
-#define LCSPX_RAMDAC_INTERLEAVE 0x00004000
-#define LCSPX_FB_ADDR 0x38000000 /* frame buffer */
-
-void lcspx_attach(struct device *, struct device *, void *);
-int lcspx_vsbus_match(struct device *, void *, void *);
-int lcspx_vxtbus_match(struct device *, void *, void *);
-
-struct lcspx_screen {
- struct rasops_info ss_ri;
- u_int ss_fbsize;
- caddr_t ss_addr; /* frame buffer address */
- volatile u_int8_t *ss_ramdac[4];
- vaddr_t ss_reg;
- u_int8_t ss_cmap[256 * 3];
-};
-
-#define lcspx_reg_read(ss, reg) \
- *(volatile u_int32_t *)((ss)->ss_reg + (reg))
-#define lcspx_reg_write(ss, reg, val) \
- *(volatile u_int32_t *)((ss)->ss_reg + (reg)) = (val)
-
-/* for console */
-struct lcspx_screen lcspx_consscr;
-
-struct lcspx_softc {
- struct device sc_dev;
- struct lcspx_screen *sc_scr;
- int sc_nscreens;
-};
-
-struct cfattach lcspx_vsbus_ca = {
- sizeof(struct lcspx_softc), lcspx_vsbus_match, lcspx_attach,
-};
-
-struct cfattach lcspx_vxtbus_ca = {
- sizeof(struct lcspx_softc), lcspx_vxtbus_match, lcspx_attach,
-};
-
-struct cfdriver lcspx_cd = {
- NULL, "lcspx", DV_DULL
-};
-
-struct wsscreen_descr lcspx_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *_lcspx_scrlist[] = {
- &lcspx_stdscreen,
-};
-
-const struct wsscreen_list lcspx_screenlist = {
- sizeof(_lcspx_scrlist) / sizeof(struct wsscreen_descr *),
- _lcspx_scrlist,
-};
-
-int lcspx_ioctl(void *, u_long, caddr_t, int, struct proc *);
-paddr_t lcspx_mmap(void *, off_t, int);
-int lcspx_alloc_screen(void *, const struct wsscreen_descr *,
- void **, int *, int *, long *);
-void lcspx_free_screen(void *, void *);
-int lcspx_show_screen(void *, void *, int,
- void (*) (void *, int, int), void *);
-int lcspx_load_font(void *, void *, struct wsdisplay_font *);
-int lcspx_list_font(void *, struct wsdisplay_font *);
-
-const struct wsdisplay_accessops lcspx_accessops = {
- .ioctl = lcspx_ioctl,
- .mmap = lcspx_mmap,
- .alloc_screen = lcspx_alloc_screen,
- .free_screen = lcspx_free_screen,
- .show_screen = lcspx_show_screen,
- .load_font = lcspx_load_font,
- .list_font = lcspx_list_font
-};
-
-int lcspx_getcmap(struct lcspx_screen *, struct wsdisplay_cmap *);
-void lcspx_loadcmap(struct lcspx_screen *, int, int);
-int lcspx_putcmap(struct lcspx_screen *, struct wsdisplay_cmap *);
-static __inline__
-void lcspx_ramdac_wraddr(struct lcspx_screen *, u_int);
-void lcspx_resetcmap(struct lcspx_screen *);
-int lcspx_setup_screen(struct lcspx_screen *, u_int, u_int);
-
-int
-lcspx_vsbus_match(struct device *parent, void *vcf, void *aux)
-{
- extern int oldvsbus;
- struct vsbus_softc *sc = (void *)parent;
- struct vsbus_attach_args *va = aux;
- volatile struct adder *adder;
- u_short status;
-
- if (va->va_paddr != LCSPX_REG_ADDR)
- return (0);
-
- switch (vax_boardtype) {
- default:
- return (0);
-
- case VAX_BTYP_420:
- case VAX_BTYP_43:
- /* not present on microvaxes */
- if ((vax_confdata & KA420_CFG_MULTU) != 0)
- return (0);
-
- if ((vax_confdata & KA420_CFG_VIDOPT) == 0)
- return (0);
-
- /*
- * We can not check for video memory at the SPX address,
- * because if no SPX board is installed, the probe will
- * just hang.
- * Instead, check for a GPX board and skip probe if the
- * video option really is a GPX.
- */
- adder = (volatile struct adder *)
- vax_map_physmem(GPXADDR + GPX_ADDER_OFFSET, 1);
- if (adder == NULL)
- return (0);
- adder->status = 0;
- status = adder->status;
- vax_unmap_physmem((vaddr_t)adder, 1);
- if (status != offsetof(struct adder, status))
- return (0);
-
- /* XXX do not attach if not console... yet */
- if ((vax_confdata & KA420_CFG_L3CON) != 0)
- return (0);
-
- break;
-
- case VAX_BTYP_49:
- if ((vax_confdata & 0x12) != 0x02)
- return (0);
-
- break;
- }
-
- sc->sc_mask = 0x04; /* XXX - should be generated */
- scb_fake(0x120, oldvsbus ? 0x14 : 0x15);
- return (20);
-}
-
-int
-lcspx_vxtbus_match(struct device *parent, void *vcf, void *aux)
-{
- struct bp_conf *bp = aux;
- int missing;
- volatile u_int8_t *ch;
-
- if (strcmp(bp->type, lcspx_cd.cd_name) != 0)
- return (0);
-
- /*
- * Check for video memory at SPX address.
- */
- missing = 0;
- ch = (volatile u_int8_t *)vax_map_physmem(LCSPX_FB_ADDR, 1);
- *ch = 0x01;
- if ((*ch & 0x01) == 0)
- missing = 1;
- else {
- *ch = 0x00;
- if ((*ch & 0x01) != 0)
- missing = 1;
- }
- vax_unmap_physmem((vaddr_t)ch, 1);
-
- return (missing ? 0 : 1);
-}
-
-void
-lcspx_attach(struct device *parent, struct device *self, void *aux)
-{
- struct lcspx_softc *sc = (struct lcspx_softc *)self;
- struct lcspx_screen *ss;
- struct wsemuldisplaydev_attach_args aa;
- int i, console;
- vaddr_t reg1;
- u_int32_t magic;
- u_int width, height;
- extern struct consdev wsdisplay_cons;
-
- if (cn_tab == &wsdisplay_cons) {
- switch (vax_boardtype) {
- case VAX_BTYP_420:
- case VAX_BTYP_43:
- console = (vax_confdata & KA420_CFG_L3CON) == 0;
- break;
- case VAX_BTYP_49:
- console = (vax_confdata & 8) == 0;
- break;
- default: /* VXT2000 */
- console = (vax_confdata & 2) != 0;
- break;
- }
- } else
- console = 0;
- if (console) {
- ss = &lcspx_consscr;
- sc->sc_nscreens = 1;
- } else {
- ss = malloc(sizeof(*ss), M_DEVBUF, M_NOWAIT | M_ZERO);
- if (ss == NULL) {
- printf(": can not allocate memory\n");
- return;
- }
-
- switch (vax_boardtype) {
- case VAX_BTYP_420:
- case VAX_BTYP_43:
- /*
- * See ``EVIL KLUGE ALERT!'' comments in
- * lcspxcninit() at the end of this file
- * for meaningless details.
- */
- reg1 = vax_map_physmem(LCSPX_REG1_ADDR, 1);
- if (reg1 == 0L) {
- printf(": can not map registers\n");
- goto fail1;
- }
- magic = *(u_int32_t *)(reg1 + 0x11c);
- vax_unmap_physmem(reg1, 1);
-
- if (magic & 0x80) {
- width = 1280;
- height = 1024;
- } else {
- width = 1024;
- height = 864;
- }
- break;
- default:
- width = 1280;
- height = 1024;
- break;
- }
-
- ss->ss_reg = vax_map_physmem(LCSPX_REG_ADDR,
- LCSPX_REG_SIZE / VAX_NBPG);
- if (ss->ss_reg == 0L) {
- printf(": can not map registers\n");
- goto fail1;
- }
-
- for (i = 0; i < 4; i++) {
- ss->ss_ramdac[i] = (volatile u_int8_t *)vax_map_physmem(
- LCSPX_RAMDAC_ADDR + i * LCSPX_RAMDAC_INTERLEAVE, 1);
- if (ss->ss_ramdac[i] == NULL) {
- printf(": can not map RAMDAC registers\n");
- goto fail2;
- }
- }
-
- ss->ss_fbsize = width * height;
- ss->ss_addr = (caddr_t)vax_map_physmem(LCSPX_FB_ADDR,
- ss->ss_fbsize / VAX_NBPG);
- if (ss->ss_addr == NULL) {
- printf(": can not map frame buffer\n");
- goto fail3;
- }
-
- if (lcspx_setup_screen(ss, width, height) != 0) {
- printf(": initialization failed\n");
- goto fail3;
- }
- }
- sc->sc_scr = ss;
-
- printf("\n%s: %dx%dx8 frame buffer\n", self->dv_xname,
- ss->ss_ri.ri_width, ss->ss_ri.ri_height);
-
- aa.console = console;
- aa.scrdata = &lcspx_screenlist;
- aa.accessops = &lcspx_accessops;
- aa.accesscookie = sc;
- aa.defaultscreens = 0;
-
- config_found(self, &aa, wsemuldisplaydevprint);
- return;
-
-fail3:
- vax_unmap_physmem((vaddr_t)ss->ss_addr, ss->ss_fbsize / VAX_NBPG);
-fail2:
- for (i = 0; i < 4; i++)
- if (ss->ss_ramdac[i] != NULL)
- vax_unmap_physmem((vaddr_t)ss->ss_ramdac[i], 1);
- vax_unmap_physmem(ss->ss_reg, LCSPX_REG_SIZE / VAX_NBPG);
-fail1:
- free(ss, M_DEVBUF, sizeof(*ss));
-}
-
-static __inline__ void
-lcspx_ramdac_wraddr(struct lcspx_screen *ss, u_int addr)
-{
- *(ss->ss_ramdac[BT463_REG_ADDR_LOW]) = addr & 0xff;
- *(ss->ss_ramdac[BT463_REG_ADDR_HIGH]) = (addr >> 8) & 0xff;
-}
-
-/*
- * Initialize anything necessary for an emulating wsdisplay to work (i.e.
- * pick a font, initialize a rasops structure, setup the accessops callbacks.)
- */
-int
-lcspx_setup_screen(struct lcspx_screen *ss, u_int width, u_int height)
-{
- struct rasops_info *ri = &ss->ss_ri;
-
- bzero(ri, sizeof(*ri));
- ri->ri_depth = 8;
- ri->ri_width = width;
- ri->ri_height = height;
- ri->ri_stride = width;
- ri->ri_flg = RI_CLEAR | RI_CENTER;
- ri->ri_bits = (void *)ss->ss_addr;
- ri->ri_hw = ss;
-
- /*
- * Enable all planes for reading and writing
- */
- lcspx_reg_write(ss, 0x1170, 0xffffffff);
- lcspx_reg_write(ss, 0x1174, 0xffffffff);
- lcspx_ramdac_wraddr(ss, 0x0204); /* plane mask */
- *(ss->ss_ramdac[BT463_REG_IREG_DATA]) = 0xff;
-
- /*
- * Ask for an unholy big display, rasops will trim this to more
- * reasonable values.
- */
- if (rasops_init(ri, 160, 160) != 0)
- return (-1);
-
- lcspx_resetcmap(ss);
-
- lcspx_stdscreen.ncols = ri->ri_cols;
- lcspx_stdscreen.nrows = ri->ri_rows;
- lcspx_stdscreen.textops = &ri->ri_ops;
- lcspx_stdscreen.fontwidth = ri->ri_font->fontwidth;
- lcspx_stdscreen.fontheight = ri->ri_font->fontheight;
- lcspx_stdscreen.capabilities = ri->ri_caps;
-
- return (0);
-}
-
-int
-lcspx_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- struct lcspx_softc *sc = v;
- struct lcspx_screen *ss = sc->sc_scr;
- struct wsdisplay_fbinfo *wdf;
- struct wsdisplay_cmap *cm;
- int error;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_LCSPX;
- break;
-
- case WSDISPLAYIO_GINFO:
- wdf = (struct wsdisplay_fbinfo *)data;
- wdf->height = ss->ss_ri.ri_height;
- wdf->width = ss->ss_ri.ri_width;
- wdf->depth = 8;
- wdf->cmsize = 256;
- break;
-
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = ss->ss_ri.ri_stride;
- break;
-
- case WSDISPLAYIO_GETCMAP:
- cm = (struct wsdisplay_cmap *)data;
- error = lcspx_getcmap(ss, cm);
- if (error != 0)
- return (error);
- break;
- case WSDISPLAYIO_PUTCMAP:
- cm = (struct wsdisplay_cmap *)data;
- error = lcspx_putcmap(ss, cm);
- if (error != 0)
- return (error);
- lcspx_loadcmap(ss, cm->index, cm->count);
- break;
-
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- break;
-
- default:
- return (-1);
- }
-
- return (0);
-}
-
-paddr_t
-lcspx_mmap(void *v, off_t offset, int prot)
-{
- struct lcspx_softc *sc = v;
- struct lcspx_screen *ss = sc->sc_scr;
-
- if (offset >= ss->ss_fbsize || offset < 0)
- return (-1);
-
- return (LCSPX_FB_ADDR + offset);
-}
-
-int
-lcspx_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
- int *curxp, int *curyp, long *defattrp)
-{
- struct lcspx_softc *sc = v;
- struct lcspx_screen *ss = sc->sc_scr;
- struct rasops_info *ri = &ss->ss_ri;
-
- if (sc->sc_nscreens > 0)
- return (ENOMEM);
-
- *cookiep = ri;
- *curxp = *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, defattrp);
- sc->sc_nscreens++;
-
- return (0);
-}
-
-void
-lcspx_free_screen(void *v, void *cookie)
-{
- struct lcspx_softc *sc = v;
-
- sc->sc_nscreens--;
-}
-
-int
-lcspx_show_screen(void *v, void *cookie, int waitok,
- void (*cb)(void *, int, int), void *cbarg)
-{
- return (0);
-}
-
-int
-lcspx_load_font(void *v, void *emulcookie, struct wsdisplay_font *font)
-{
- struct lcspx_softc *sc = v;
- struct lcspx_screen *ss = sc->sc_scr;
- struct rasops_info *ri = &ss->ss_ri;
-
- return rasops_load_font(ri, emulcookie, font);
-}
-
-int
-lcspx_list_font(void *v, struct wsdisplay_font *font)
-{
- struct lcspx_softc *sc = v;
- struct lcspx_screen *ss = sc->sc_scr;
- struct rasops_info *ri = &ss->ss_ri;
-
- return rasops_list_font(ri, font);
-}
-
-/*
- * Colormap handling routines
- */
-
-int
-lcspx_getcmap(struct lcspx_screen *ss, struct wsdisplay_cmap *cm)
-{
- u_int index = cm->index, count = cm->count, i;
- int error;
- u_int8_t ramp[256], *c, *r;
-
- if (index >= 256 || count > 256 - index)
- return (EINVAL);
-
- /* extract reds */
- c = ss->ss_cmap + 0 + index * 3;
- for (i = count, r = ramp; i != 0; i--)
- *r++ = *c, c += 3;
- if ((error = copyout(ramp, cm->red, count)) != 0)
- return (error);
-
- /* extract greens */
- c = ss->ss_cmap + 1 + index * 3;
- for (i = count, r = ramp; i != 0; i--)
- *r++ = *c, c += 3;
- if ((error = copyout(ramp, cm->green, count)) != 0)
- return (error);
-
- /* extract blues */
- c = ss->ss_cmap + 2 + index * 3;
- for (i = count, r = ramp; i != 0; i--)
- *r++ = *c, c += 3;
- if ((error = copyout(ramp, cm->blue, count)) != 0)
- return (error);
-
- return (0);
-}
-
-int
-lcspx_putcmap(struct lcspx_screen *ss, struct wsdisplay_cmap *cm)
-{
- u_int index = cm->index, count = cm->count;
- int i, error;
- u_int8_t r[256], g[256], b[256], *nr, *ng, *nb, *c;
-
- if (index >= 256 || count > 256 - index)
- return (EINVAL);
-
- if ((error = copyin(cm->red, r, count)) != 0)
- return (error);
- if ((error = copyin(cm->green, g, count)) != 0)
- return (error);
- if ((error = copyin(cm->blue, b, count)) != 0)
- return (error);
-
- nr = r, ng = g, nb = b;
- c = ss->ss_cmap + index * 3;
- for (i = count; i != 0; i--) {
- *c++ = *nr++;
- *c++ = *ng++;
- *c++ = *nb++;
- }
-
- return (0);
-}
-
-void
-lcspx_loadcmap(struct lcspx_screen *ss, int from, int count)
-{
- u_int8_t *cmap = ss->ss_cmap;
- int i;
-
- cmap += from * 3;
- for (i = from; i < from + count; i++) {
- /*
- * Reprogram the index every iteration, because the RAMDAC
- * may not be in autoincrement mode. XXX fix this
- */
- lcspx_ramdac_wraddr(ss, i);
- *(ss->ss_ramdac[BT463_REG_CMAP_DATA]) = *cmap++;
- *(ss->ss_ramdac[BT463_REG_CMAP_DATA]) = *cmap++;
- *(ss->ss_ramdac[BT463_REG_CMAP_DATA]) = *cmap++;
- }
-}
-
-void
-lcspx_resetcmap(struct lcspx_screen *ss)
-{
- bcopy(rasops_cmap, ss->ss_cmap, sizeof(ss->ss_cmap));
- lcspx_loadcmap(ss, 0, 256);
-}
-
-/*
- * Console support code
- */
-
-int lcspxcnprobe(void);
-int lcspxcninit(void);
-
-int
-lcspxcnprobe()
-{
- extern vaddr_t virtual_avail;
- volatile struct adder *adder;
- volatile u_int8_t *ch;
- u_short status;
- int rc;
-
- switch (vax_boardtype) {
- case VAX_BTYP_420:
- case VAX_BTYP_43:
- if ((vax_confdata & KA420_CFG_L3CON) != 0)
- break; /* doesn't use graphics console */
-
- /* not present on microvaxes */
- if ((vax_confdata & KA420_CFG_MULTU) != 0)
- break;
-
- if ((vax_confdata & KA420_CFG_VIDOPT) == 0)
- break;
-
- /*
- * We can not check for video memory at the SPX address,
- * because if no SPX board is installed, the probe will
- * just hang.
- * Instead, check for a GPX board and skip probe if the
- * video option really is a GPX.
- */
- ioaccess(virtual_avail, GPXADDR + GPX_ADDER_OFFSET, 1);
- adder = (volatile struct adder *)virtual_avail;
- adder->status = 0;
- status = adder->status;
- iounaccess(virtual_avail, 1);
- if (status != offsetof(struct adder, status))
- break;
-
- return (1);
-
- case VAX_BTYP_49:
- if ((vax_confdata & 8) != 0)
- break; /* doesn't use graphics console */
-
- if ((vax_confdata & 0x12) != 0x02)
- break;
-
- return (1);
-
- case VAX_BTYP_VXT:
- if ((vax_confdata & 2) == 0)
- break; /* doesn't use graphics console */
-
- /*
- * Check for video memory at SPX address.
- */
- rc = 0;
- ioaccess(virtual_avail, LCSPX_FB_ADDR, 1);
- ch = (volatile u_int8_t *)virtual_avail;
- *ch = 0x01;
- if ((*ch & 0x01) != 0) {
- *ch = 0x00;
- if ((*ch & 0x01) == 0)
- rc = 1;
- }
- iounaccess(virtual_avail, 1);
-
- if (rc == 0)
- break;
-
- return (1);
-
- default:
- break;
- }
-
- return (0);
-}
-
-/*
- * Called very early to setup the glass tty as console.
- * Because it's called before the VM system is initialized, virtual memory
- * for the framebuffer can be stolen directly without disturbing anything.
- */
-int
-lcspxcninit()
-{
- struct lcspx_screen *ss = &lcspx_consscr;
- extern vaddr_t virtual_avail;
- int i;
- u_int width, height;
- vaddr_t ova, reg1;
- u_int32_t magic;
- long defattr;
- struct rasops_info *ri;
-
- ova = virtual_avail;
-
- switch (vax_boardtype) {
- case VAX_BTYP_420:
- case VAX_BTYP_43:
- /*
- * XXX EVIL KLUGE ALERT!
- *
- * The spx jumper settings do not show up in vax_confdata.
- * I don't know which spx register sports their values,
- * but I have noticed that, after the ROM has initialized
- * the board, bit 0x80 at 39b0011c will reflect the
- * resolution setting.
- *
- * This register is not read-only, so one could DEPOSIT
- * a bogus value in it from the console before starting
- * OpenBSD. If you do this, you deserve to be bitten
- * if things go wrong.
- */
- reg1 = virtual_avail;
- ioaccess(virtual_avail, LCSPX_REG1_ADDR, 1);
- magic = *(u_int32_t *)(reg1 + 0x11c);
- iounaccess(virtual_avail, 1);
-
- if (magic & 0x80) {
- width = 1280;
- height = 1024;
- } else {
- width = 1024;
- height = 864;
- }
- break;
- default:
- width = 1280;
- height = 1024;
- break;
- }
-
- ss->ss_fbsize = width * height;
- ss->ss_addr = (caddr_t)virtual_avail;
- ioaccess(virtual_avail, LCSPX_FB_ADDR, ss->ss_fbsize / VAX_NBPG);
- virtual_avail += ss->ss_fbsize;
-
- ss->ss_reg = virtual_avail;
- ioaccess(virtual_avail, LCSPX_REG_ADDR, LCSPX_REG_SIZE / VAX_NBPG);
- virtual_avail += LCSPX_REG_SIZE;
-
- for (i = 0; i < 4; i++) {
- ss->ss_ramdac[i] = (volatile u_int8_t *)virtual_avail;
- ioaccess(virtual_avail,
- LCSPX_RAMDAC_ADDR + i * LCSPX_RAMDAC_INTERLEAVE, 1);
- virtual_avail += VAX_NBPG;
- }
-
- virtual_avail = round_page(virtual_avail);
-
- /* this had better not fail */
- if (lcspx_setup_screen(ss, width, height) != 0) {
- for (i = 3; i >= 0; i--)
- iounaccess((vaddr_t)ss->ss_ramdac[i], 1);
- iounaccess(ss->ss_reg, LCSPX_REG_SIZE / VAX_NBPG);
- iounaccess((vaddr_t)ss->ss_addr, ss->ss_fbsize / VAX_NBPG);
- virtual_avail = ova;
- return (1);
- }
-
- ri = &ss->ss_ri;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
- wsdisplay_cnattach(&lcspx_stdscreen, ri, 0, 0, defattr);
-
- return (0);
-}
diff --git a/sys/arch/vax/vsa/maskbits.h b/sys/arch/vax/vsa/maskbits.h
deleted file mode 100644
index 018b8b81060..00000000000
--- a/sys/arch/vax/vsa/maskbits.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* $OpenBSD: maskbits.h,v 1.1 2006/08/05 10:00:30 miod Exp $ */
-
-/*-
- * Copyright (c) 1994
- * 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.
- *
- * @(#)maskbits.h 8.2 (Berkeley) 3/21/94
- */
-
-/*
- * Derived from X11R4
- */
-
-/* the following notes use the following conventions:
-SCREEN LEFT SCREEN RIGHT
-in this file and maskbits.c, left and right refer to screen coordinates,
-NOT bit numbering in registers.
-
-rasops_lmask[n]
- bits[0,n-1] = 0 bits[n,31] = 1
-rasops_rmask[n] =
- bits[0,n-1] = 1 bits[n,31] = 0
-
-maskbits(x, w, startmask, endmask, nlw)
- for a span of width w starting at position x, returns
-a mask for ragged bits at start, mask for ragged bits at end,
-and the number of whole longwords between the ends.
-
-*/
-
-#define maskbits(x, w, startmask, endmask, nlw) \
-do { \
- startmask = rasops_lmask[(x) & 0x1f]; \
- endmask = rasops_rmask[((x) + (w)) & 0x1f]; \
- if (startmask) \
- nlw = (((w) - (32 - ((x) & 0x1f))) >> 5); \
- else \
- nlw = (w) >> 5; \
-} while (0)
-
-#define FASTGETBITS(psrc,x,w,dst) \
- __asm__ ("extzv %1,%2,%3,%0" \
- : "=g" (dst) \
- : "g" (x), "g" (w), "m" (*(char *)(psrc)))
-
-#define FASTPUTBITS(src, x, w, pdst) \
- __asm__ ("insv %3,%1,%2,%0" \
- : "=m" (*(char *)(pdst)) \
- : "g" (x), "g" (w), "g" (src))
-
-#define RR_CLEAR 0x00
-#define RR_SET 0x01
-#define RR_COPY 0x02
-
-#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \
-do { \
- unsigned int _tmpdst; \
- switch (rop) { \
- case RR_CLEAR: \
- _tmpdst = 0; \
- break; \
- case RR_SET: \
- _tmpdst = ~0; \
- break; \
- default: \
- FASTGETBITS(psrc, srcbit, width, _tmpdst); \
- break; \
- } \
- FASTPUTBITS(_tmpdst, dstbit, width, pdst); \
-} while (0)
-
-#define getunalignedword(psrc, x, dst) \
-do { \
- int _tmp; \
- FASTGETBITS(psrc, x, 32, _tmp); \
- dst = _tmp; \
-} while (0)
diff --git a/sys/arch/vax/vsa/ncr.c b/sys/arch/vax/vsa/ncr.c
deleted file mode 100644
index 3be30b4692e..00000000000
--- a/sys/arch/vax/vsa/ncr.c
+++ /dev/null
@@ -1,465 +0,0 @@
-/* $OpenBSD: ncr.c,v 1.28 2010/09/20 06:33:48 matthew Exp $ */
-/* $NetBSD: ncr.c,v 1.32 2000/06/25 16:00:43 ragge Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Adam Glass, David Jones, Gordon W. Ross, and Jens A. Nilsson.
- *
- * 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 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.
- */
-
-/*
- * This file contains the machine-dependent parts of the NCR-5380
- * controller. The machine-independent parts are in ncr5380sbc.c.
- *
- * Jens A. Nilsson.
- *
- * Credits:
- *
- * This code is based on arch/sun3/dev/si*
- * Written by David Jones, Gordon Ross, and Adam Glass.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <sys/disk.h>
-#include <sys/proc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsi_debug.h>
-#include <scsi/scsiconf.h>
-#include <scsi/sdvar.h>
-
-#include <dev/ic/ncr5380reg.h>
-#include <dev/ic/ncr5380var.h>
-
-#include <machine/cpu.h>
-#include <machine/vsbus.h>
-#include <machine/bus.h>
-#include <machine/sid.h>
-#include <machine/scb.h>
-#include <machine/clock.h>
-
-#define MIN_DMA_LEN 128
-
-struct si_dma_handle {
- int dh_flags;
-#define SIDH_BUSY 1
-#define SIDH_OUT 2
- caddr_t dh_addr;
- int dh_len;
- struct proc *dh_proc;
-};
-
-struct si_softc {
- struct ncr5380_softc ncr_sc;
- struct evcount ncr_intrcnt;
- int ncr_cvec;
- caddr_t ncr_addr;
- int ncr_off;
- int ncr_dmaaddr;
- int ncr_dmacount;
- int ncr_dmadir;
-
- /* Pointers to bus_space */
- bus_space_tag_t sc_regt;
- bus_space_handle_t sc_regh;
-
- struct si_dma_handle ncr_dma[SCI_OPENINGS];
- struct vsbus_dma sc_vd;
- int onlyscsi; /* This machine needs no queueing */
-};
-
-static int ncr_dmasize;
-
-static int si_match(struct device *, void *, void *);
-static void si_attach(struct device *, struct device *, void *);
-static void si_minphys(struct buf *, struct scsi_link *);
-
-static void si_dma_alloc(struct ncr5380_softc *);
-static void si_dma_free(struct ncr5380_softc *);
-static void si_dma_setup(struct ncr5380_softc *);
-static void si_dma_start(struct ncr5380_softc *);
-static void si_dma_poll(struct ncr5380_softc *);
-static void si_dma_stop(struct ncr5380_softc *);
-static void si_dma_go(void *);
-
-#define NCR5380_READ(sc, reg) bus_space_read_1(sc->sc_regt, \
- 0, sc->ncr_sc.reg)
-#define NCR5380_WRITE(sc, reg, val) bus_space_write_1(sc->sc_regt, \
- 0, sc->ncr_sc.reg, val)
-
-struct scsi_adapter si_ops = {
- ncr5380_scsi_cmd, /* scsi_cmd() */
- si_minphys, /* scsi_minphys() */
- NULL, /* probe_dev() */
- NULL /* free_dev() */
-};
-
-struct cfattach ncr_ca = {
- sizeof(struct si_softc), si_match, si_attach
-};
-
-struct cfdriver ncr_cd = {
- NULL, "ncr", DV_DULL
-};
-
-static int
-si_match(parent, cf, aux)
- struct device *parent;
- void *cf;
- void *aux;
-{
- struct vsbus_attach_args *va = aux;
- volatile char *si_csr = (char *) va->va_addr;
-
- if (vax_boardtype == VAX_BTYP_49 || vax_boardtype == VAX_BTYP_46
- || vax_boardtype == VAX_BTYP_48 || vax_boardtype == VAX_BTYP_1303)
- return 0;
- /* This is the way Linux autoprobes the interrupt MK-990321 */
- si_csr[12] = 0;
- si_csr[16] = 0x80;
- si_csr[0] = 0x80;
- si_csr[4] = 5; /* 0xcf */
- DELAY(100000);
- return 1;
-}
-
-static void
-si_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct vsbus_attach_args *va = aux;
- struct si_softc *sc = (struct si_softc *) self;
- struct ncr5380_softc *ncr_sc = &sc->ncr_sc;
- struct scsibus_attach_args saa;
- int tweak, target;
-
- printf("\n");
-
- /* enable interrupts on vsbus too */
- scb_vecalloc(va->va_cvec, (void (*)(void *)) ncr5380_intr, sc,
- SCB_ISTACK, &sc->ncr_intrcnt);
- sc->ncr_cvec = va->va_cvec;
- evcount_attach(&sc->ncr_intrcnt, self->dv_xname, &sc->ncr_cvec);
-
- /*
- * DMA area mapin.
- * On VS3100, split the 128K block between the two devices.
- * On VS2000, don't care for now.
- */
-#define DMASIZE (64*1024)
- if (va->va_paddr & 0x100) { /* Secondary SCSI controller */
- sc->ncr_off = DMASIZE;
- sc->onlyscsi = 1;
- }
- sc->ncr_addr = (caddr_t)va->va_dmaaddr;
- ncr_dmasize = min(va->va_dmasize, MAXPHYS);
-
- /*
- * MD function pointers used by the MI code.
- */
- ncr_sc->sc_dma_alloc = si_dma_alloc;
- ncr_sc->sc_dma_free = si_dma_free;
- ncr_sc->sc_dma_setup = si_dma_setup;
- ncr_sc->sc_dma_start = si_dma_start;
- ncr_sc->sc_dma_poll = si_dma_poll;
- ncr_sc->sc_dma_stop = si_dma_stop;
-
- /* DMA control register offsets */
- sc->ncr_dmaaddr = 32; /* DMA address in buffer, longword */
- sc->ncr_dmacount = 64; /* DMA count register */
- sc->ncr_dmadir = 68; /* Direction of DMA transfer */
-
- ncr_sc->sc_pio_out = ncr5380_pio_out;
- ncr_sc->sc_pio_in = ncr5380_pio_in;
-
- ncr_sc->sc_min_dma_len = MIN_DMA_LEN;
-
- /*
- * Initialize fields used by the MI code.
- */
-/* sc->sc_regt = Unused on VAX */
- sc->sc_regh = vax_map_physmem(va->va_paddr, 1);
-
- /* Register offsets */
- ncr_sc->sci_r0 = (void *)sc->sc_regh+0;
- ncr_sc->sci_r1 = (void *)sc->sc_regh+4;
- ncr_sc->sci_r2 = (void *)sc->sc_regh+8;
- ncr_sc->sci_r3 = (void *)sc->sc_regh+12;
- ncr_sc->sci_r4 = (void *)sc->sc_regh+16;
- ncr_sc->sci_r5 = (void *)sc->sc_regh+20;
- ncr_sc->sci_r6 = (void *)sc->sc_regh+24;
- ncr_sc->sci_r7 = (void *)sc->sc_regh+28;
-
- ncr_sc->sc_no_disconnect = 0xff;
-
- /*
- * Get the SCSI chip target address out of NVRAM.
- * This do not apply to the VS2000.
- */
- tweak = clk_tweak + (va->va_paddr & 0x100 ? 3 : 0);
- if (vax_boardtype == VAX_BTYP_410)
- target = 7;
- else
- target = (clk_page[0xbc/2] >> tweak) & 7;
-
- ncr_sc->sc_link.adapter_softc = sc;
- ncr_sc->sc_link.adapter_target = target;
- ncr_sc->sc_link.adapter = &si_ops;
- ncr_sc->sc_link.openings = 4;
-
- /*
- * Init the vsbus DMA resource queue struct */
- sc->sc_vd.vd_go = si_dma_go;
- sc->sc_vd.vd_arg = sc;
-
- bzero(&saa, sizeof(saa));
- saa.saa_sc_link = &(ncr_sc->sc_link);
-
- /*
- * Initialize si board itself.
- */
- ncr5380_init(ncr_sc);
- ncr5380_reset_scsibus(ncr_sc);
- DELAY(2000000);
- config_found(&(ncr_sc->sc_dev), &saa, scsiprint);
-
-}
-
-/*
- * Adjust the max transfer size. The DMA buffer is only 16k on VS2000.
- */
-static void
-si_minphys(struct buf *bp, struct scsi_link *sl)
-{
- if (bp->b_bcount > ncr_dmasize)
- bp->b_bcount = ncr_dmasize;
- minphys(bp);
-}
-
-void
-si_dma_alloc(ncr_sc)
- struct ncr5380_softc *ncr_sc;
-{
- struct si_softc *sc = (struct si_softc *)ncr_sc;
- struct sci_req *sr = ncr_sc->sc_current;
- struct scsi_xfer *xs = sr->sr_xs;
- struct si_dma_handle *dh;
- struct buf *bp;
- int xlen, i;
-
-#ifdef DIAGNOSTIC
- if (sr->sr_dma_hand != NULL)
- panic("si_dma_alloc: already have DMA handle");
-#endif
-
- /* Polled transfers shouldn't allocate a DMA handle. */
- if (sr->sr_flags & SR_IMMED)
- return;
-
- xlen = ncr_sc->sc_datalen;
-
- /* Make sure our caller checked sc_min_dma_len. */
- if (xlen < MIN_DMA_LEN)
- panic("si_dma_alloc: len=0x%x", xlen);
-
- /*
- * Find free PDMA handle. Guaranteed to find one since we
- * have as many PDMA handles as the driver has processes.
- * (instances?)
- */
- for (i = 0; i < SCI_OPENINGS; i++) {
- if ((sc->ncr_dma[i].dh_flags & SIDH_BUSY) == 0)
- goto found;
- }
- panic("ncr: no free PDMA handles");
-found:
- dh = &sc->ncr_dma[i];
- dh->dh_flags = SIDH_BUSY;
- dh->dh_addr = ncr_sc->sc_dataptr;
- dh->dh_len = xlen;
- bp = xs->bp;
- if (bp != NULL)
- dh->dh_proc = (bp->b_flags & B_PHYS ? bp->b_proc : NULL);
- else
- dh->dh_proc = NULL;
-
- /* Remember dest buffer parameters */
- if (xs->flags & SCSI_DATA_OUT)
- dh->dh_flags |= SIDH_OUT;
-
- sr->sr_dma_hand = dh;
-}
-
-void
-si_dma_free(ncr_sc)
- struct ncr5380_softc *ncr_sc;
-{
- struct sci_req *sr = ncr_sc->sc_current;
- struct si_dma_handle *dh = sr->sr_dma_hand;
-
-#ifdef DIAGNOSTIC
- if (dh == NULL)
- panic("si_dma_free: no DMA handle");
-#endif
-
- if (ncr_sc->sc_state & NCR_DOINGDMA)
- panic("si_dma_free: free while DMA in progress");
-
- if (dh->dh_flags & SIDH_BUSY)
- dh->dh_flags = 0;
- else
- printf("si_dma_free: free'ing unused buffer\n");
-
- sr->sr_dma_hand = NULL;
-}
-
-void
-si_dma_setup(ncr_sc)
- struct ncr5380_softc *ncr_sc;
-{
- /* Do nothing here */
-}
-
-void
-si_dma_start(ncr_sc)
- struct ncr5380_softc *ncr_sc;
-{
- struct si_softc *sc = (struct si_softc *)ncr_sc;
-
- /* Just put on queue; will call go() from below */
- if (sc->onlyscsi)
- si_dma_go(ncr_sc);
- else
- vsbus_dma_start(&sc->sc_vd);
-}
-
-/*
- * go() routine called when another transfer somewhere is finished.
- */
-void
-si_dma_go(arg)
- void *arg;
-{
- struct ncr5380_softc *ncr_sc = arg;
- struct si_softc *sc = (struct si_softc *)ncr_sc;
- struct sci_req *sr = ncr_sc->sc_current;
- struct si_dma_handle *dh = sr->sr_dma_hand;
-
- /*
- * Set the VAX-DMA-specific registers, and copy the data if
- * it is directed "outbound".
- */
- if (dh->dh_flags & SIDH_OUT) {
- vsbus_copyfromproc(dh->dh_proc, dh->dh_addr,
- sc->ncr_addr + sc->ncr_off, dh->dh_len);
- bus_space_write_1(sc->sc_regt, sc->sc_regh,
- sc->ncr_dmadir, 0);
- } else {
- bus_space_write_1(sc->sc_regt, sc->sc_regh,
- sc->ncr_dmadir, 1);
- }
- bus_space_write_4(sc->sc_regt, sc->sc_regh,
- sc->ncr_dmacount, -dh->dh_len);
- bus_space_write_4(sc->sc_regt, sc->sc_regh,
- sc->ncr_dmaaddr, sc->ncr_off);
- /*
- * Now from the 5380-internal DMA registers.
- */
- if (dh->dh_flags & SIDH_OUT) {
- NCR5380_WRITE(sc, sci_tcmd, PHASE_DATA_OUT);
- NCR5380_WRITE(sc, sci_icmd, SCI_ICMD_DATA);
- NCR5380_WRITE(sc, sci_mode, NCR5380_READ(sc, sci_mode)
- | SCI_MODE_DMA | SCI_MODE_DMA_IE);
- NCR5380_WRITE(sc, sci_dma_send, 0);
- } else {
- NCR5380_WRITE(sc, sci_tcmd, PHASE_DATA_IN);
- NCR5380_WRITE(sc, sci_icmd, 0);
- NCR5380_WRITE(sc, sci_mode, NCR5380_READ(sc, sci_mode)
- | SCI_MODE_DMA | SCI_MODE_DMA_IE);
- NCR5380_WRITE(sc, sci_irecv, 0);
- }
- ncr_sc->sc_state |= NCR_DOINGDMA;
-}
-
-/*
- * When?
- */
-void
-si_dma_poll(ncr_sc)
- struct ncr5380_softc *ncr_sc;
-{
- printf("si_dma_poll\n");
-}
-
-void
-si_dma_stop(ncr_sc)
- struct ncr5380_softc *ncr_sc;
-{
- struct si_softc *sc = (struct si_softc *)ncr_sc;
- struct sci_req *sr = ncr_sc->sc_current;
- struct si_dma_handle *dh = sr->sr_dma_hand;
- int count, i;
-
- if (ncr_sc->sc_state & NCR_DOINGDMA)
- ncr_sc->sc_state &= ~NCR_DOINGDMA;
-
- /*
- * Sometimes the FIFO buffer isn't drained when the
- * interrupt is posted. Just loop here and hope that
- * it will drain soon.
- */
- for (i = 0; i < 20000; i++) {
- count = bus_space_read_4(sc->sc_regt,
- sc->sc_regh, sc->ncr_dmacount);
- if (count == 0)
- break;
- DELAY(100);
- }
- if (count == 0) {
- if (((dh->dh_flags & SIDH_OUT) == 0)) {
- vsbus_copytoproc(dh->dh_proc,
- sc->ncr_addr + sc->ncr_off,
- dh->dh_addr, dh->dh_len);
- }
- ncr_sc->sc_dataptr += dh->dh_len;
- ncr_sc->sc_datalen -= dh->dh_len;
- }
-
- NCR5380_WRITE(sc, sci_mode, NCR5380_READ(sc, sci_mode) &
- ~(SCI_MODE_DMA | SCI_MODE_DMA_IE));
- NCR5380_WRITE(sc, sci_icmd, 0);
- if (sc->onlyscsi == 0)
- vsbus_dma_intr(); /* Try to start more transfers */
-}
diff --git a/sys/arch/vax/vsa/smg.c b/sys/arch/vax/vsa/smg.c
deleted file mode 100644
index b39f75aac6f..00000000000
--- a/sys/arch/vax/vsa/smg.c
+++ /dev/null
@@ -1,901 +0,0 @@
-/* $OpenBSD: smg.c,v 1.28 2014/12/23 21:39:12 miod Exp $ */
-/* $NetBSD: smg.c,v 1.21 2000/03/23 06:46:44 thorpej Exp $ */
-/*
- * Copyright (c) 2006, 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) 1998 Ludd, University of Lule}, Sweden.
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-
-#include <machine/vsbus.h>
-#include <machine/sid.h>
-#include <machine/cpu.h>
-#include <machine/ka420.h>
-#include <machine/scb.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <dev/cons.h>
-
-#include <dev/ic/dc503reg.h>
-
-#include <vax/qbus/dzreg.h>
-#include <vax/qbus/dzvar.h>
-#include <vax/dec/dzkbdvar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-#include <dev/rasops/rasops_masks.h>
-
-/* Screen hardware defs */
-#define SM_XWIDTH 1024
-#define SM_YWIDTH 864
-
-#define CUR_XBIAS 216 /* Add to cursor position */
-#define CUR_YBIAS 33
-
-int smg_match(struct device *, void *, void *);
-void smg_attach(struct device *, struct device *, void *);
-
-struct smg_screen {
- struct rasops_info ss_ri;
- caddr_t ss_addr; /* frame buffer address */
- struct dc503reg *ss_cursor; /* cursor registers */
- u_int16_t ss_curcmd;
- struct wsdisplay_curpos ss_curpos, ss_curhot;
- u_int16_t ss_curimg[PCC_CURSOR_SIZE];
- u_int16_t ss_curmask[PCC_CURSOR_SIZE];
-};
-
-/* for console */
-struct smg_screen smg_consscr;
-
-struct smg_softc {
- struct device sc_dev;
- struct smg_screen *sc_scr;
- int sc_nscreens;
-};
-
-struct cfattach smg_ca = {
- sizeof(struct smg_softc), smg_match, smg_attach,
-};
-
-struct cfdriver smg_cd = {
- NULL, "smg", DV_DULL
-};
-
-struct wsscreen_descr smg_stdscreen = {
- "std",
-};
-
-const struct wsscreen_descr *_smg_scrlist[] = {
- &smg_stdscreen,
-};
-
-const struct wsscreen_list smg_screenlist = {
- sizeof(_smg_scrlist) / sizeof(struct wsscreen_descr *),
- _smg_scrlist,
-};
-
-int smg_ioctl(void *, u_long, caddr_t, int, struct proc *);
-paddr_t smg_mmap(void *, off_t, int);
-int smg_alloc_screen(void *, const struct wsscreen_descr *,
- void **, int *, int *, long *);
-void smg_free_screen(void *, void *);
-int smg_show_screen(void *, void *, int,
- void (*) (void *, int, int), void *);
-int smg_load_font(void *, void *, struct wsdisplay_font *);
-int smg_list_font(void *, struct wsdisplay_font *);
-void smg_burner(void *, u_int, u_int);
-
-const struct wsdisplay_accessops smg_accessops = {
- .ioctl = smg_ioctl,
- .mmap = smg_mmap,
- .alloc_screen = smg_alloc_screen,
- .free_screen = smg_free_screen,
- .show_screen = smg_show_screen,
- .load_font = smg_load_font,
- .list_font = smg_list_font,
- .burn_screen = smg_burner
-};
-
-void smg_blockmove(struct rasops_info *, u_int, u_int, u_int, u_int, u_int,
- int);
-int smg_copycols(void *, int, int, int, int);
-int smg_erasecols(void *, int, int, int, long);
-
-int smg_getcursor(struct smg_screen *, struct wsdisplay_cursor *);
-int smg_setup_screen(struct smg_screen *);
-int smg_setcursor(struct smg_screen *, struct wsdisplay_cursor *);
-void smg_updatecursor(struct smg_screen *, u_int);
-
-int
-smg_match(struct device *parent, void *vcf, void *aux)
-{
- struct cfdata *cf = vcf;
- struct vsbus_attach_args *va = aux;
- volatile short *curcmd;
- volatile short *cfgtst;
- short tmp, tmp2;
- extern struct consdev wsdisplay_cons;
-
- switch (vax_boardtype) {
- default:
- return (0);
-
- case VAX_BTYP_410:
- case VAX_BTYP_420:
- case VAX_BTYP_43:
- if (va->va_paddr != KA420_CUR_BASE)
- return (0);
-
- /* not present on microvaxes */
- if ((vax_confdata & KA420_CFG_MULTU) != 0)
- return (0);
-
- /*
- * If the color option board is present, do not attach
- * unless we are explicitely asked to via device flags.
- */
- if ((vax_confdata & KA420_CFG_VIDOPT) != 0 &&
- (cf->cf_flags & 1) == 0)
- return (0);
- break;
- }
-
- /* when already running as console, always fake things */
- if ((vax_confdata & (KA420_CFG_L3CON | KA420_CFG_VIDOPT)) == 0 &&
- cn_tab == &wsdisplay_cons) {
- struct vsbus_softc *sc = (void *)parent;
- extern int oldvsbus;
-
- sc->sc_mask = 0x08;
- scb_fake(0x44, oldvsbus ? 0x14 : 0x15);
- return (20);
- } else {
- /*
- * Try to find the cursor chip by testing the flip-flop.
- * If nonexistent, no glass tty.
- */
- curcmd = (short *)va->va_addr;
- cfgtst = (short *)vax_map_physmem(VS_CFGTST, 1);
- curcmd[0] = PCCCMD_HSHI | PCCCMD_FOPB;
- DELAY(300000);
- tmp = cfgtst[0];
- curcmd[0] = PCCCMD_TEST | PCCCMD_HSHI;
- DELAY(300000);
- tmp2 = cfgtst[0];
- vax_unmap_physmem((vaddr_t)cfgtst, 1);
-
- if (tmp2 != tmp)
- return (20); /* Using periodic interrupt */
- else
- return (0);
- }
-}
-
-void
-smg_attach(struct device *parent, struct device *self, void *aux)
-{
- struct smg_softc *sc = (struct smg_softc *)self;
- struct smg_screen *scr;
- struct wsemuldisplaydev_attach_args aa;
- int console;
- extern struct consdev wsdisplay_cons;
-
- console = (vax_confdata & (KA420_CFG_L3CON | KA420_CFG_VIDOPT)) == 0 &&
- cn_tab == &wsdisplay_cons;
- if (console) {
- scr = &smg_consscr;
- sc->sc_nscreens = 1;
- } else {
- scr = malloc(sizeof(*scr), M_DEVBUF, M_NOWAIT | M_ZERO);
- if (scr == NULL) {
- printf(": can not allocate memory\n");
- return;
- }
-
- scr->ss_addr =
- (caddr_t)vax_map_physmem(SMADDR, SMSIZE / VAX_NBPG);
- if (scr->ss_addr == NULL) {
- printf(": can not map frame buffer\n");
- free(scr, M_DEVBUF, sizeof(*scr));
- return;
- }
-
- scr->ss_cursor =
- (struct dc503reg *)vax_map_physmem(KA420_CUR_BASE, 1);
- if (scr->ss_cursor == NULL) {
- printf(": can not map cursor chip\n");
- vax_unmap_physmem((vaddr_t)scr->ss_addr,
- SMSIZE / VAX_NBPG);
- free(scr, M_DEVBUF, sizeof(*scr));
- return;
- }
-
- if (smg_setup_screen(scr) != 0) {
- printf(": initialization failed\n");
- vax_unmap_physmem((vaddr_t)scr->ss_cursor, 1);
- vax_unmap_physmem((vaddr_t)scr->ss_addr,
- SMSIZE / VAX_NBPG);
- free(scr, M_DEVBUF, sizeof(*scr));
- return;
- }
- }
- sc->sc_scr = scr;
-
- printf("\n%s: %dx%d on-board monochrome framebuffer\n",
- self->dv_xname, SM_XWIDTH, SM_YWIDTH);
-
- aa.console = console;
- aa.scrdata = &smg_screenlist;
- aa.accessops = &smg_accessops;
- aa.accesscookie = sc;
- aa.defaultscreens = 0;
-
- config_found(self, &aa, wsemuldisplaydevprint);
-}
-
-/*
- * Initialize anything necessary for an emulating wsdisplay to work (i.e.
- * pick a font, initialize a rasops structure, setup the accessops callbacks.)
- */
-int
-smg_setup_screen(struct smg_screen *ss)
-{
- struct rasops_info *ri = &ss->ss_ri;
-
- bzero(ri, sizeof(*ri));
- ri->ri_depth = 1;
- ri->ri_width = SM_XWIDTH;
- ri->ri_height = SM_YWIDTH;
- ri->ri_stride = SM_XWIDTH >> 3;
- ri->ri_flg = RI_CLEAR | RI_CENTER;
- ri->ri_bits = (void *)ss->ss_addr;
- ri->ri_hw = ss;
-
- /*
- * Ask for an unholy big display, rasops will trim this to more
- * reasonable values.
- */
- if (rasops_init(ri, 160, 160) != 0)
- return (-1);
-
- ri->ri_ops.copycols = smg_copycols;
- ri->ri_ops.erasecols = smg_erasecols;
-
- smg_stdscreen.ncols = ri->ri_cols;
- smg_stdscreen.nrows = ri->ri_rows;
- smg_stdscreen.textops = &ri->ri_ops;
- smg_stdscreen.fontwidth = ri->ri_font->fontwidth;
- smg_stdscreen.fontheight = ri->ri_font->fontheight;
- smg_stdscreen.capabilities = ri->ri_caps;
-
- ss->ss_curcmd = PCCCMD_HSHI;
- ss->ss_cursor->cmdr = ss->ss_curcmd;
-
- return (0);
-}
-
-int
-smg_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- struct smg_softc *sc = v;
- struct smg_screen *ss = sc->sc_scr;
- struct wsdisplay_fbinfo *wdf;
- struct wsdisplay_curpos *pos;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_VAX_MONO;
- break;
-
- case WSDISPLAYIO_GINFO:
- wdf = (struct wsdisplay_fbinfo *)data;
- wdf->height = ss->ss_ri.ri_height;
- wdf->width = ss->ss_ri.ri_width;
- wdf->depth = ss->ss_ri.ri_depth;
- wdf->cmsize = 0;
- break;
-
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = ss->ss_ri.ri_stride;
- break;
-
- case WSDISPLAYIO_GETCMAP:
- case WSDISPLAYIO_PUTCMAP:
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- break;
-
- case WSDISPLAYIO_GCURPOS:
- pos = (struct wsdisplay_curpos *)data;
- pos->x = ss->ss_curpos.x;
- pos->y = ss->ss_curpos.y;
- break;
- case WSDISPLAYIO_SCURPOS:
- pos = (struct wsdisplay_curpos *)data;
- ss->ss_curpos.x = pos->x;
- ss->ss_curpos.y = pos->y;
- smg_updatecursor(ss, WSDISPLAY_CURSOR_DOPOS);
- break;
- case WSDISPLAYIO_GCURMAX:
- pos = (struct wsdisplay_curpos *)data;
- pos->x = pos->y = PCC_CURSOR_SIZE;
- case WSDISPLAYIO_GCURSOR:
- return (smg_getcursor(ss, (struct wsdisplay_cursor *)data));
- case WSDISPLAYIO_SCURSOR:
- return (smg_setcursor(ss, (struct wsdisplay_cursor *)data));
- break;
-
- default:
- return (-1);
- }
-
- return (0);
-}
-
-paddr_t
-smg_mmap(void *v, off_t offset, int prot)
-{
- if (offset >= SMSIZE || offset < 0)
- return (-1);
-
- return (SMADDR + offset);
-}
-
-int
-smg_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
- int *curxp, int *curyp, long *defattrp)
-{
- struct smg_softc *sc = v;
- struct smg_screen *ss = sc->sc_scr;
- struct rasops_info *ri = &ss->ss_ri;
-
- if (sc->sc_nscreens > 0)
- return (ENOMEM);
-
- *cookiep = ri;
- *curxp = *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, defattrp);
- sc->sc_nscreens++;
-
- return (0);
-}
-
-void
-smg_free_screen(void *v, void *cookie)
-{
- struct smg_softc *sc = v;
-
- sc->sc_nscreens--;
-}
-
-int
-smg_show_screen(void *v, void *cookie, int waitok,
- void (*cb)(void *, int, int), void *cbarg)
-{
- return (0);
-}
-
-int
-smg_load_font(void *v, void *emulcookie, struct wsdisplay_font *font)
-{
- struct smg_softc *sc = v;
- struct smg_screen *ss = sc->sc_scr;
- struct rasops_info *ri = &ss->ss_ri;
-
- return rasops_load_font(ri, emulcookie, font);
-}
-
-int
-smg_list_font(void *v, struct wsdisplay_font *font)
-{
- struct smg_softc *sc = v;
- struct smg_screen *ss = sc->sc_scr;
- struct rasops_info *ri = &ss->ss_ri;
-
- return rasops_list_font(ri, font);
-}
-
-void
-smg_burner(void *v, u_int on, u_int flags)
-{
- struct smg_softc *sc = v;
- struct smg_screen *ss = sc->sc_scr;
-
- ss->ss_cursor->cmdr = on ? ss->ss_curcmd :
- (ss->ss_curcmd & ~(PCCCMD_FOPA | PCCCMD_ENPA)) | PCCCMD_FOPB;
-}
-
-int
-smg_getcursor(struct smg_screen *ss, struct wsdisplay_cursor *wdc)
-{
- int error;
-
- if (wdc->which & WSDISPLAY_CURSOR_DOCUR)
- wdc->enable = ss->ss_curcmd & PCCCMD_ENPA ? 1 : 0;
- if (wdc->which & WSDISPLAY_CURSOR_DOPOS) {
- wdc->pos.x = ss->ss_curpos.x;
- wdc->pos.y = ss->ss_curpos.y;
- }
- if (wdc->which & WSDISPLAY_CURSOR_DOHOT) {
- wdc->hot.x = ss->ss_curhot.x;
- wdc->hot.y = ss->ss_curhot.y;
- }
- if (wdc->which & WSDISPLAY_CURSOR_DOCMAP) {
- wdc->cmap.index = 0;
- wdc->cmap.count = 0;
- }
- if (wdc->which & WSDISPLAY_CURSOR_DOSHAPE) {
- wdc->size.x = wdc->size.y = PCC_CURSOR_SIZE;
- error = copyout(ss->ss_curimg, wdc->image,
- sizeof(ss->ss_curimg));
- if (error != 0)
- return (error);
- error = copyout(ss->ss_curmask, wdc->mask,
- sizeof(ss->ss_curmask));
- if (error != 0)
- return (error);
- }
-
- return (0);
-}
-
-int
-smg_setcursor(struct smg_screen *ss, struct wsdisplay_cursor *wdc)
-{
- u_int16_t curfg[PCC_CURSOR_SIZE], curmask[PCC_CURSOR_SIZE];
- int error;
-
- if (wdc->which & WSDISPLAY_CURSOR_DOCMAP) {
- /* No cursor colormap since we are a B&W device. */
- if (wdc->cmap.count != 0)
- return (EINVAL);
- }
-
- /*
- * First, do the userland-kernel data transfers, so that we can fail
- * if necessary before altering anything.
- */
- if (wdc->which & WSDISPLAY_CURSOR_DOSHAPE) {
- if (wdc->size.x != PCC_CURSOR_SIZE ||
- wdc->size.y != PCC_CURSOR_SIZE)
- return (EINVAL);
- error = copyin(wdc->image, curfg, sizeof(curfg));
- if (error != 0)
- return (error);
- error = copyin(wdc->mask, curmask, sizeof(curmask));
- if (error != 0)
- return (error);
- }
-
- /*
- * Now update our variables...
- */
- if (wdc->which & WSDISPLAY_CURSOR_DOCUR) {
- if (wdc->enable)
- ss->ss_curcmd |= PCCCMD_ENPB | PCCCMD_ENPA;
- else
- ss->ss_curcmd &= ~(PCCCMD_ENPB | PCCCMD_ENPA);
- }
- if (wdc->which & WSDISPLAY_CURSOR_DOPOS) {
- ss->ss_curpos.x = wdc->pos.x;
- ss->ss_curpos.y = wdc->pos.y;
- }
- if (wdc->which & WSDISPLAY_CURSOR_DOHOT) {
- ss->ss_curhot.x = wdc->hot.x;
- ss->ss_curhot.y = wdc->hot.y;
- }
- if (wdc->which & WSDISPLAY_CURSOR_DOSHAPE) {
- bcopy(curfg, ss->ss_curimg, sizeof ss->ss_curimg);
- bcopy(curmask, ss->ss_curmask, sizeof ss->ss_curmask);
- }
-
- /*
- * ...and update the cursor
- */
- smg_updatecursor(ss, wdc->which);
-
- return (0);
-}
-
-void
-smg_updatecursor(struct smg_screen *ss, u_int which)
-{
- u_int i;
-
- if (which & (WSDISPLAY_CURSOR_DOPOS | WSDISPLAY_CURSOR_DOHOT)) {
- ss->ss_cursor->xpos =
- ss->ss_curpos.x - ss->ss_curhot.x + CUR_XBIAS;
- ss->ss_cursor->ypos =
- ss->ss_curpos.y - ss->ss_curhot.y + CUR_YBIAS;
- }
- if (which & WSDISPLAY_CURSOR_DOSHAPE) {
- ss->ss_cursor->cmdr = ss->ss_curcmd | PCCCMD_LODSA;
- for (i = 0; i < PCC_CURSOR_SIZE; i++)
- ss->ss_cursor->load = ss->ss_curimg[i];
- for (i = 0; i < PCC_CURSOR_SIZE; i++)
- ss->ss_cursor->load = ss->ss_curmask[i];
- ss->ss_cursor->cmdr = ss->ss_curcmd;
- } else
- if (which & WSDISPLAY_CURSOR_DOCUR)
- ss->ss_cursor->cmdr = ss->ss_curcmd;
-}
-
-/*
- * Faster console operations
- */
-
-#include <vax/vsa/maskbits.h>
-
-void
-smg_blockmove(struct rasops_info *ri, u_int sx, u_int y, u_int dx, u_int cx,
- u_int 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 */
- 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 = SM_XWIDTH >> 5;
-
- /* start at first scanline */
- psrcLine = pdstLine = ((u_int *)ri->ri_bits) + (y * 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--) {
- switch (rop) {
- case RR_CLEAR:
- *pdst = 0;
- break;
- case RR_SET:
- *pdst = ~0;
- break;
- default:
- *pdst = *psrc;
- break;
- }
- psrc++;
- pdst++;
- }
- } else {
- nl = nlMiddle + 1;
- while (--nl) {
- switch (rop) {
- case RR_CLEAR:
- *pdst = 0;
- break;
- case RR_SET:
- *pdst = ~0;
- break;
- default:
- getunalignedword(psrc,
- xoffSrc, *pdst);
- break;
- }
- pdst++;
- psrc++;
- }
- }
-
- if (endmask) {
- getandputrop(psrc, xoffSrc, 0, 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) {
- getandputrop(psrc, xoffSrc, 0, nend,
- pdst, rop);
- }
-
- nl = nlMiddle + 1;
- while (--nl) {
- --psrc;
- --pdst;
- switch (rop) {
- case RR_CLEAR:
- *pdst = 0;
- break;
- case RR_SET:
- *pdst = ~0;
- break;
- default:
- getunalignedword(psrc, xoffSrc,
- *pdst);
- break;
- }
- }
-
- if (startmask) {
- if (srcStartOver)
- --psrc;
- --pdst;
- getandputrop(psrc, (sx & 0x1f),
- (dx & 0x1f), nstart, pdst, rop);
- }
-
- pdstLine += width;
- psrcLine += width;
- }
- }
- }
-}
-
-int
-smg_copycols(void *cookie, int row, int src, int dst, int n)
-{
- struct rasops_info *ri = cookie;
-
- n *= ri->ri_font->fontwidth;
- src *= ri->ri_font->fontwidth;
- dst *= ri->ri_font->fontwidth;
- row *= ri->ri_font->fontheight;
-
- smg_blockmove(ri, src, row, dst, n, ri->ri_font->fontheight,
- RR_COPY);
-
- return 0;
-}
-
-int
-smg_erasecols(void *cookie, int row, int col, int num, long attr)
-{
- struct rasops_info *ri = cookie;
- int fg, bg;
-
- ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
-
- num *= ri->ri_font->fontwidth;
- col *= ri->ri_font->fontwidth;
- row *= ri->ri_font->fontheight;
-
- smg_blockmove(ri, col, row, col, num, ri->ri_font->fontheight,
- bg == 0 ? RR_CLEAR : RR_SET);
-
- return 0;
-}
-
-/*
- * Console support code
- */
-
-int smgcnprobe(void);
-int smgcninit(void);
-
-int
-smgcnprobe()
-{
- switch (vax_boardtype) {
- case VAX_BTYP_410:
- case VAX_BTYP_420:
- case VAX_BTYP_43:
- if ((vax_confdata & (KA420_CFG_L3CON | KA420_CFG_MULTU)) != 0)
- break; /* doesn't use graphics console */
-
- if ((vax_confdata & KA420_CFG_VIDOPT) != 0)
- break; /* there is a color option */
-
- return (1);
-
- default:
- break;
- }
-
- return (0);
-}
-
-/*
- * Called very early to setup the glass tty as console.
- * Because it's called before the VM system is initialized, virtual memory
- * for the framebuffer can be stolen directly without disturbing anything.
- */
-int
-smgcninit()
-{
- struct smg_screen *ss = &smg_consscr;
- extern vaddr_t virtual_avail;
- vaddr_t ova;
- long defattr;
- struct rasops_info *ri;
-
- ova = virtual_avail;
-
- ss->ss_addr = (caddr_t)virtual_avail;
- ioaccess(virtual_avail, SMADDR, SMSIZE / VAX_NBPG);
- virtual_avail += SMSIZE;
-
- ss->ss_cursor = (struct dc503reg *)virtual_avail;
- ioaccess(virtual_avail, KA420_CUR_BASE, 1);
- virtual_avail += VAX_NBPG;
-
- virtual_avail = round_page(virtual_avail);
-
- /* this had better not fail */
- if (smg_setup_screen(ss) != 0) {
- iounaccess((vaddr_t)ss->ss_addr, SMSIZE / VAX_NBPG);
- iounaccess((vaddr_t)ss->ss_cursor, 1);
- virtual_avail = ova;
- return (1);
- }
-
- ri = &ss->ss_ri;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
- wsdisplay_cnattach(&smg_stdscreen, ri, 0, 0, defattr);
-
- return (0);
-}
diff --git a/sys/arch/vax/vsa/vsaudio.c b/sys/arch/vax/vsa/vsaudio.c
deleted file mode 100644
index eb03cf56baf..00000000000
--- a/sys/arch/vax/vsa/vsaudio.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/* $OpenBSD: vsaudio.c,v 1.5 2015/05/11 06:46:21 ratchov Exp $ */
-
-/*
- * Copyright (c) 2011 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Copyright (c) 1995 Rolf Grossmann
- * 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 Rolf Grossmann.
- * 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 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.
- */
-
-/*
- * Audio backend for the VAXstation 4000 AMD79C30 audio chip.
- * Currently working in pseudo-DMA mode; DMA operation may be possible and
- * needs to be investigated.
- */
-/*
- * Although he did not claim copyright for his work, this code owes a lot
- * to Blaz Antonic <blaz.antonic@siol.net> who figured out a working
- * interrupt triggering routine in vsaudio_match().
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/device.h>
-
-#include <machine/cpu.h>
-#include <machine/sid.h>
-#include <machine/scb.h>
-#include <machine/vsbus.h>
-
-#include <sys/audioio.h>
-#include <dev/audio_if.h>
-
-#include <dev/ic/am7930reg.h>
-#include <dev/ic/am7930var.h>
-
-#ifdef AUDIO_DEBUG
-#define DPRINTF(x) if (am7930debug) printf x
-#define DPRINTFN(n,x) if (am7930debug>(n)) printf x
-#else
-#define DPRINTF(x)
-#define DPRINTFN(n,x)
-#endif /* AUDIO_DEBUG */
-
-/* physical addresses of the AM79C30 chip */
-#define VSAUDIO_CSR 0x200d0000
-#define VSAUDIO_CSR_KA49 0x26800000
-
-struct vsaudio_softc {
- struct am7930_softc sc_am7930; /* base device */
- bus_space_tag_t sc_bt;
- bus_space_handle_t sc_bh; /* device registers */
-
- void (*sc_rintr)(void*); /* input completion intr handler */
- void *sc_rarg; /* arg for sc_rintr() */
- void (*sc_pintr)(void*); /* output completion intr handler */
- void *sc_parg; /* arg for sc_pintr() */
-
- uint8_t *sc_rdata; /* record data */
- uint8_t *sc_rend; /* end of record data */
- uint8_t *sc_pdata; /* play data */
- uint8_t *sc_pend; /* end of play data */
-
- void *sc_swintr; /* soft interrupt cookie */
- int sc_cvec;
- struct evcount sc_intrcnt;
-};
-
-void vsaudio_attach(struct device *, struct device *, void *);
-int vsaudio_match(struct device *, void *, void *);
-
-struct cfdriver vsaudio_cd = {
- NULL, "vsaudio", DV_DULL
-};
-
-const struct cfattach vsaudio_ca = {
- sizeof(struct vsaudio_softc), vsaudio_match, vsaudio_attach
-};
-
-/*
- * Hardware access routines for the MI code.
- */
-
-uint8_t vsaudio_codec_iread(struct am7930_softc *, int);
-uint16_t vsaudio_codec_iread16(struct am7930_softc *, int);
-uint8_t vsaudio_codec_dread(struct vsaudio_softc *, int);
-void vsaudio_codec_iwrite(struct am7930_softc *, int, uint8_t);
-void vsaudio_codec_iwrite16(struct am7930_softc *, int, uint16_t);
-void vsaudio_codec_dwrite(struct vsaudio_softc *, int, uint8_t);
-void vsaudio_onopen(struct am7930_softc *sc);
-void vsaudio_onclose(struct am7930_softc *sc);
-
-struct am7930_glue vsaudio_glue = {
- vsaudio_codec_iread,
- vsaudio_codec_iwrite,
- vsaudio_codec_iread16,
- vsaudio_codec_iwrite16,
- vsaudio_onopen,
- vsaudio_onclose,
- 8
-};
-
-/*
- * Interface to the MI audio layer.
- */
-int vsaudio_start_output(void *, void *, int, void (*)(void *), void *);
-int vsaudio_start_input(void *, void *, int, void (*)(void *), void *);
-int vsaudio_getdev(void *, struct audio_device *);
-
-struct audio_hw_if vsaudio_hw_if = {
- am7930_open,
- am7930_close,
- NULL,
- am7930_query_encoding,
- am7930_set_params,
- am7930_round_blocksize,
- am7930_commit_settings,
- NULL,
- NULL,
- vsaudio_start_output,
- vsaudio_start_input,
- am7930_halt_output,
- am7930_halt_input,
- NULL,
- vsaudio_getdev,
- NULL,
- am7930_set_port,
- am7930_get_port,
- am7930_query_devinfo,
- NULL,
- NULL,
- NULL,
- NULL,
- am7930_get_props,
- NULL,
- NULL,
- NULL
-};
-
-struct audio_device vsaudio_device = {
- "am7930",
- "x",
- "vsaudio"
-};
-
-void vsaudio_hwintr(void *);
-void vsaudio_swintr(void *);
-
-int
-vsaudio_match(struct device *parent, void *vcf, void *aux)
-{
- struct vsbus_attach_args *va = aux;
- volatile uint32_t *regs;
- int i;
-
- switch (vax_boardtype) {
-#if defined(VAX46) || defined(VAX48)
- case VAX_BTYP_46:
- case VAX_BTYP_48:
- if (va->va_paddr != VSAUDIO_CSR)
- return 0;
- break;
-#endif
-#if defined(VAX49)
- case VAX_BTYP_49:
- if (va->va_paddr != VSAUDIO_CSR_KA49)
- return 0;
- break;
-#endif
- default:
- return 0;
- }
-
- regs = (volatile uint32_t *)va->va_addr;
- regs[AM7930_DREG_CR] = AM7930_IREG_INIT;
- regs[AM7930_DREG_DR] = AM7930_INIT_PMS_ACTIVE | AM7930_INIT_INT_ENABLE;
-
- regs[AM7930_DREG_CR] = AM7930_IREG_MUX_MCR1;
- regs[AM7930_DREG_DR] = 0;
-
- regs[AM7930_DREG_CR] = AM7930_IREG_MUX_MCR2;
- regs[AM7930_DREG_DR] = 0;
-
- regs[AM7930_DREG_CR] = AM7930_IREG_MUX_MCR3;
- regs[AM7930_DREG_DR] = (AM7930_MCRCHAN_BB << 4) | AM7930_MCRCHAN_BA;
-
- regs[AM7930_DREG_CR] = AM7930_IREG_MUX_MCR4;
- regs[AM7930_DREG_DR] = AM7930_MCR4_INT_ENABLE;
-
- for (i = 10; i < 20; i++)
- regs[AM7930_DREG_BBTB] = i;
- delay(1000000); /* XXX too large */
-
- return 1;
-}
-
-void
-vsaudio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct vsbus_attach_args *va = aux;
- struct vsaudio_softc *sc = (struct vsaudio_softc *)self;
-
- if (bus_space_map(va->va_iot, va->va_paddr, AM7930_DREG_SIZE << 2, 0,
- &sc->sc_bh) != 0) {
- printf(": can't map registers\n");
- return;
- }
- sc->sc_bt = va->va_iot;
-
- /*
- * Set up glue for MI code early; we use some of it here.
- */
- sc->sc_am7930.sc_glue = &vsaudio_glue;
- am7930_init(&sc->sc_am7930, AUDIOAMD_POLL_MODE);
-
- scb_vecalloc(va->va_cvec, vsaudio_hwintr, sc, SCB_ISTACK,
- &sc->sc_intrcnt);
- sc->sc_cvec = va->va_cvec;
- evcount_attach(&sc->sc_intrcnt, self->dv_xname, &sc->sc_cvec);
-
- sc->sc_swintr = softintr_establish(IPL_SOFT, &vsaudio_swintr, sc);
-
- printf("\n");
- audio_attach_mi(&vsaudio_hw_if, sc, &sc->sc_am7930.sc_dev);
-}
-
-void
-vsaudio_onopen(struct am7930_softc *sc)
-{
- struct vsaudio_softc *vssc = (struct vsaudio_softc *)sc;
-
- /* reset pdma state */
- vssc->sc_rintr = NULL;
- vssc->sc_rarg = 0;
- vssc->sc_pintr = NULL;
- vssc->sc_parg = 0;
-
- vssc->sc_rdata = NULL;
- vssc->sc_pdata = NULL;
-}
-
-void
-vsaudio_onclose(struct am7930_softc *sc)
-{
- am7930_halt_input(sc);
- am7930_halt_output(sc);
-}
-
-/*
- * this is called by interrupt code-path, don't lock
- */
-int
-vsaudio_start_output(void *addr, void *p, int cc,
- void (*intr)(void *), void *arg)
-{
- struct vsaudio_softc *sc = addr;
-
- DPRINTFN(1, ("sa_start_output: cc=%d %p (%p)\n", cc, intr, arg));
-
- if (!sc->sc_am7930.sc_locked) {
- vsaudio_codec_iwrite(&sc->sc_am7930,
- AM7930_IREG_INIT, AM7930_INIT_PMS_ACTIVE);
- sc->sc_am7930.sc_locked = 1;
- DPRINTF(("sa_start_output: started intrs.\n"));
- }
- sc->sc_pintr = intr;
- sc->sc_parg = arg;
- sc->sc_pdata = p;
- sc->sc_pend = (char *)p + cc - 1;
- return 0;
-}
-
-/*
- * this is called by interrupt code-path, don't lock
- */
-int
-vsaudio_start_input(void *addr, void *p, int cc,
- void (*intr)(void *), void *arg)
-{
- struct vsaudio_softc *sc = addr;
-
- DPRINTFN(1, ("sa_start_input: cc=%d %p (%p)\n", cc, intr, arg));
-
- if (!sc->sc_am7930.sc_locked) {
- vsaudio_codec_iwrite(&sc->sc_am7930,
- AM7930_IREG_INIT, AM7930_INIT_PMS_ACTIVE);
- sc->sc_am7930.sc_locked = 1;
- DPRINTF(("sa_start_input: started intrs.\n"));
- }
- sc->sc_rintr = intr;
- sc->sc_rarg = arg;
- sc->sc_rdata = p;
- sc->sc_rend = (char *)p + cc -1;
- return 0;
-}
-
-/*
- * Pseudo-DMA support
- */
-
-void
-vsaudio_hwintr(void *v)
-{
- struct vsaudio_softc *sc = v;
- uint8_t *d, *e;
- int k;
-
- mtx_enter(&audio_lock);
- /* clear interrupt */
- k = vsaudio_codec_dread(sc, AM7930_DREG_IR);
-#if 0 /* interrupt is not shared, this shouldn't happen */
- if ((k & (AM7930_IR_DTTHRSH | AM7930_IR_DRTHRSH | AM7930_IR_DSRI |
- AM7930_IR_DERI | AM7930_IR_BBUFF)) == 0) {
- mtx_leave(&audio_lock);
- return 0;
- }
-#endif
-
- /* receive incoming data */
- d = sc->sc_rdata;
- e = sc->sc_rend;
- if (d != NULL && d <= e) {
- *d = vsaudio_codec_dread(sc, AM7930_DREG_BBRB);
- sc->sc_rdata++;
- if (d == e) {
- DPRINTFN(1, ("vsaudio_hwintr: swintr(r) requested"));
- softintr_schedule(sc->sc_swintr);
- }
- }
-
- /* send outgoing data */
- d = sc->sc_pdata;
- e = sc->sc_pend;
- if (d != NULL && d <= e) {
- vsaudio_codec_dwrite(sc, AM7930_DREG_BBTB, *d);
- sc->sc_pdata++;
- if (d == e) {
- DPRINTFN(1, ("vsaudio_hwintr: swintr(p) requested"));
- softintr_schedule(sc->sc_swintr);
- }
- }
- mtx_leave(&audio_lock);
-}
-
-void
-vsaudio_swintr(void *v)
-{
- struct vsaudio_softc *sc = v;
- int dor, dow;
-
- DPRINTFN(1, ("audiointr: sc=%p\n", sc));
-
- dor = dow = 0;
- mtx_enter(&audio_lock);
- if (sc->sc_rdata > sc->sc_rend && sc->sc_rintr != NULL)
- dor = 1;
- if (sc->sc_pdata > sc->sc_pend && sc->sc_pintr != NULL)
- dow = 1;
- mtx_leave(&audio_lock);
-
- if (dor != 0)
- (*sc->sc_rintr)(sc->sc_rarg);
- if (dow != 0)
- (*sc->sc_pintr)(sc->sc_parg);
-}
-
-/* indirect write */
-void
-vsaudio_codec_iwrite(struct am7930_softc *sc, int reg, uint8_t val)
-{
- struct vsaudio_softc *vssc = (struct vsaudio_softc *)sc;
-
- vsaudio_codec_dwrite(vssc, AM7930_DREG_CR, reg);
- vsaudio_codec_dwrite(vssc, AM7930_DREG_DR, val);
-}
-
-void
-vsaudio_codec_iwrite16(struct am7930_softc *sc, int reg, uint16_t val)
-{
- struct vsaudio_softc *vssc = (struct vsaudio_softc *)sc;
-
- vsaudio_codec_dwrite(vssc, AM7930_DREG_CR, reg);
- vsaudio_codec_dwrite(vssc, AM7930_DREG_DR, val);
- vsaudio_codec_dwrite(vssc, AM7930_DREG_DR, val >> 8);
-}
-
-/* indirect read */
-uint8_t
-vsaudio_codec_iread(struct am7930_softc *sc, int reg)
-{
- struct vsaudio_softc *vssc = (struct vsaudio_softc *)sc;
-
- vsaudio_codec_dwrite(vssc, AM7930_DREG_CR, reg);
- return vsaudio_codec_dread(vssc, AM7930_DREG_DR);
-}
-
-uint16_t
-vsaudio_codec_iread16(struct am7930_softc *sc, int reg)
-{
- struct vsaudio_softc *vssc = (struct vsaudio_softc *)sc;
- uint lo, hi;
-
- vsaudio_codec_dwrite(vssc, AM7930_DREG_CR, reg);
- lo = vsaudio_codec_dread(vssc, AM7930_DREG_DR);
- hi = vsaudio_codec_dread(vssc, AM7930_DREG_DR);
- return (hi << 8) | lo;
-}
-
-/* direct read */
-uint8_t
-vsaudio_codec_dread(struct vsaudio_softc *sc, int reg)
-{
- return bus_space_read_1(sc->sc_bt, sc->sc_bh, reg << 2);
-}
-
-/* direct write */
-void
-vsaudio_codec_dwrite(struct vsaudio_softc *sc, int reg, uint8_t val)
-{
- bus_space_write_1(sc->sc_bt, sc->sc_bh, reg << 2, val);
-}
-
-int
-vsaudio_getdev(void *addr, struct audio_device *retp)
-{
- *retp = vsaudio_device;
- return 0;
-}
diff --git a/sys/arch/vax/vsa/vsbus.c b/sys/arch/vax/vsa/vsbus.c
deleted file mode 100644
index c482b0ad6f3..00000000000
--- a/sys/arch/vax/vsa/vsbus.c
+++ /dev/null
@@ -1,417 +0,0 @@
-/* $OpenBSD: vsbus.c,v 1.24 2015/09/13 12:31:35 miod Exp $ */
-/* $NetBSD: vsbus.c,v 1.29 2000/06/29 07:14:37 mrg Exp $ */
-/*
- * Copyright (c) 1996, 1999 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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/buf.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <sys/syslog.h>
-#include <sys/stat.h>
-
-#include <uvm/uvm_extern.h>
-
-#define _VAX_BUS_DMA_PRIVATE
-#include <machine/bus.h>
-#include <machine/pte.h>
-#include <machine/sid.h>
-#include <machine/scb.h>
-#include <machine/cpu.h>
-#include <machine/trap.h>
-#include <machine/nexus.h>
-
-#include <machine/uvax.h>
-#include <machine/ka410.h>
-#include <machine/ka420.h>
-
-#include <machine/vsbus.h>
-
-int vsbus_match(struct device *, struct cfdata *, void *);
-void vsbus_attach(struct device *, struct device *, void *);
-int vsbus_print(void *, const char *);
-int vsbus_search(struct device *, void *, void *);
-
-static struct vax_bus_dma_tag vsbus_bus_dma_tag = {
- NULL,
- 0,
- 0,
- 0,
- NULL,
- _bus_dmamap_create,
- _bus_dmamap_destroy,
- _bus_dmamap_load,
- _bus_dmamap_load_mbuf,
- _bus_dmamap_load_uio,
- _bus_dmamap_load_raw,
- _bus_dmamap_unload,
- _bus_dmamap_sync,
- _bus_dmamem_alloc,
- _bus_dmamem_free,
- _bus_dmamem_map,
- _bus_dmamem_unmap,
- _bus_dmamem_mmap,
-};
-
-extern struct vax_bus_space vax_mem_bus_space;
-static SIMPLEQ_HEAD(, vsbus_dma) vsbus_dma;
-
-struct cfattach vsbus_ca = {
- sizeof(struct vsbus_softc), (cfmatch_t)vsbus_match, vsbus_attach
-};
-
-struct cfdriver vsbus_cd = {
- NULL, "vsbus", DV_DULL
-};
-
-int oldvsbus;
-
-int
-vsbus_print(aux, name)
- void *aux;
- const char *name;
-{
- struct vsbus_attach_args *va = aux;
-
- printf(" csr 0x%lx vec %d ipl %x maskbit %d", va->va_paddr,
- va->va_cvec & 511, va->va_br, va->va_maskno - 1);
- return(UNCONF);
-}
-
-int
-vsbus_match(parent, cf, aux)
- struct device *parent;
- struct cfdata *cf;
- void *aux;
-{
- struct mainbus_attach_args *maa = aux;
-
- if (maa->maa_bustype == VAX_VSBUS)
- return 1;
- return 0;
-}
-
-void
-vsbus_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct vsbus_softc *sc = (void *)self;
- int dbase, dsize;
-
- printf("\n");
-
- sc->sc_dmatag = vsbus_bus_dma_tag;
-
- switch (vax_boardtype) {
-#if VAX49 || VAX53
- case VAX_BTYP_1303:
- case VAX_BTYP_49:
- sc->sc_vsregs = vax_map_physmem(VS_REGS_KA49, 1);
- sc->sc_intreq = (char *)sc->sc_vsregs + 12;
- sc->sc_intclr = (char *)sc->sc_vsregs + 12;
- sc->sc_intmsk = (char *)sc->sc_vsregs + 8;
- vsbus_dma_init(sc, 8192);
- break;
-#endif
-
-#if VAX46 || VAX48
- case VAX_BTYP_48:
- case VAX_BTYP_46:
- sc->sc_vsregs = vax_map_physmem(VS_REGS, 1);
- sc->sc_intreq = (char *)sc->sc_vsregs + 15;
- sc->sc_intclr = (char *)sc->sc_vsregs + 15;
- sc->sc_intmsk = (char *)sc->sc_vsregs + 12;
- vsbus_dma_init(sc, 32768);
- break;
-#endif
-
- default:
- sc->sc_vsregs = vax_map_physmem(VS_REGS, 1);
- sc->sc_intreq = (char *)sc->sc_vsregs + 15;
- sc->sc_intclr = (char *)sc->sc_vsregs + 15;
- sc->sc_intmsk = (char *)sc->sc_vsregs + 12;
- if (vax_boardtype == VAX_BTYP_410) {
- dbase = KA410_DMA_BASE;
- dsize = KA410_DMA_SIZE;
- } else {
- dbase = KA420_DMA_BASE;
- dsize = KA420_DMA_SIZE;
- *(char *)(sc->sc_vsregs + 0xe0) = 1; /* Big DMA */
- }
- sc->sc_dmasize = dsize;
- sc->sc_dmaaddr = uvm_km_valloc(kernel_map, dsize);
- ioaccess(sc->sc_dmaaddr, dbase, dsize/VAX_NBPG);
- break;
- }
-
- SIMPLEQ_INIT(&vsbus_dma);
- /*
- * First: find which interrupts we won't care about.
- * There are interrupts that interrupt on a periodic basic
- * that we don't want to interfere with the rest of the
- * interrupt probing.
- */
- *sc->sc_intmsk = 0;
- *sc->sc_intclr = 0xff;
- DELAY(1000000); /* Wait a second */
- sc->sc_mask = *sc->sc_intreq;
-
-#if VAX48
- /*
- * It's possible for the 4000/VLC to generate an DZ-11 rx interrupt
- * (0x20) during the delay period, unmask that bit.
- */
- if (vax_boardtype == VAX_BTYP_48)
- sc->sc_mask &= ~0x20;
-#endif
-
- printf("%s: interrupt mask %x\n", self->dv_xname, sc->sc_mask);
-
- /*
- * now check for all possible devices on this "bus"
- */
- config_search(vsbus_search, self, NULL);
-
- /* Autoconfig finished, enable interrupts */
- *sc->sc_intmsk = ~sc->sc_mask;
-}
-
-int
-vsbus_search(parent, cfd, aux)
- struct device *parent;
- void *cfd;
- void *aux;
-{
- struct vsbus_softc *sc = (void *)parent;
- struct vsbus_attach_args va;
- struct cfdata *cf = cfd;
- int rc, i, vec, br;
- u_char c;
-
- va.va_paddr = cf->cf_loc[0];
- va.va_addr = vax_map_physmem(va.va_paddr, 1);
- va.va_dmat = &sc->sc_dmatag;
- va.va_iot = &vax_mem_bus_space;
-
- *sc->sc_intmsk = 0;
- *sc->sc_intclr = 0xff;
- scb_vecref(0, 0); /* Clear vector ref */
-
- rc = (*cf->cf_attach->ca_match) (parent, cf, &va);
- vax_unmap_physmem(va.va_addr, 1);
- c = *sc->sc_intreq & ~sc->sc_mask;
-
- if (rc == 0)
- goto forgetit;
- if (rc > 10)
- c = sc->sc_mask; /* Fooling interrupt */
- else if (c == 0)
- goto forgetit;
-
- *sc->sc_intmsk = c;
- DELAY(1000);
- *sc->sc_intmsk = 0;
- va.va_maskno = ffs((u_int)c);
- i = scb_vecref(&vec, &br);
- if (i == 0)
- goto fail;
- if (vec == 0)
- goto fail;
-
- /*
- * For proper splassert operation, we need to know if we are on
- * a vsbus system where its devices interrupt at level 0x14 instead
- * of 0x15.
- */
- if (br == 0x14)
- oldvsbus = 1;
-
- va.va_br = br;
- va.va_cvec = vec;
- va.va_dmaaddr = sc->sc_dmaaddr;
- va.va_dmasize = sc->sc_dmasize;
- *sc->sc_intmsk = c; /* Allow interrupts during attach */
- config_attach(parent, cf, &va, vsbus_print);
- *sc->sc_intmsk = 0;
- return rc;
-
-fail:
- printf("%s%d at %s csr 0x%lx %s\n",
- cf->cf_driver->cd_name, cf->cf_unit, parent->dv_xname,
- cf->cf_loc[0], (i ? "zero vector" : "didn't interrupt"));
-forgetit:
- return 0;
-}
-
-/*
- * Sets a new interrupt mask. Returns the old one.
- * Works like spl functions.
- */
-unsigned char
-vsbus_setmask(mask)
- unsigned char mask;
-{
- struct vsbus_softc *sc;
- unsigned char ch;
-
- if (vsbus_cd.cd_ndevs == 0)
- return 0;
- sc = vsbus_cd.cd_devs[0];
-
- ch = *sc->sc_intmsk;
- *sc->sc_intmsk = mask;
- return ch;
-}
-
-/*
- * Clears the interrupts in mask.
- */
-void
-vsbus_clrintr(mask)
- unsigned char mask;
-{
- struct vsbus_softc *sc;
-
- if (vsbus_cd.cd_ndevs == 0)
- return;
- sc = vsbus_cd.cd_devs[0];
-
- *sc->sc_intclr = mask;
-}
-
-/*
- * Copy data from/to a user process' space from the DMA area.
- * Use the physical memory directly.
- */
-void
-vsbus_copytoproc(struct proc *p, caddr_t from, caddr_t to, int len)
-{
- pt_entry_t *pte;
- paddr_t pa;
-
- if ((vaddr_t)to & KERNBASE) { /* In kernel space */
- bcopy(from, to, len);
- return;
- }
- pte = uvtopte(trunc_page((vaddr_t)to), (&p->p_addr->u_pcb));
- if ((vaddr_t)to & PGOFSET) {
- int cz = round_page((vaddr_t)to) - (vaddr_t)to;
-
- pa = ((*pte & PG_FRAME) << VAX_PGSHIFT) |
- (NBPG - cz) | KERNBASE;
- bcopy(from, (caddr_t)pa, min(cz, len));
- from += cz;
- to += cz;
- len -= cz;
- pte += 8; /* XXX */
- }
- while (len > 0) {
- pa = ((*pte & PG_FRAME) << VAX_PGSHIFT) | KERNBASE;
- bcopy(from, (caddr_t)pa, min(NBPG, len));
- from += NBPG;
- to += NBPG;
- len -= NBPG;
- pte += 8; /* XXX */
- }
-}
-
-void
-vsbus_copyfromproc(struct proc *p, caddr_t from, caddr_t to, int len)
-{
- pt_entry_t *pte;
- paddr_t pa;
-
- if ((vaddr_t)from & KERNBASE) { /* In kernel space */
- bcopy(from, to, len);
- return;
- }
- pte = uvtopte(trunc_page((vaddr_t)from), (&p->p_addr->u_pcb));
- if ((vaddr_t)from & PGOFSET) {
- int cz = round_page((vaddr_t)from) - (vaddr_t)from;
-
- pa = ((*pte & PG_FRAME) << VAX_PGSHIFT) |
- (NBPG - cz) | KERNBASE;
- bcopy((caddr_t)pa, to, min(cz, len));
- from += cz;
- to += cz;
- len -= cz;
- pte += 8; /* XXX */
- }
- while (len > 0) {
- pa = ((*pte & PG_FRAME) << VAX_PGSHIFT) | KERNBASE;
- bcopy((caddr_t)pa, to, min(NBPG, len));
- from += NBPG;
- to += NBPG;
- len -= NBPG;
- pte += 8; /* XXX */
- }
-}
-
-/*
- * There can only be one user of the DMA area on VS2k/VS3100 at one
- * time, so keep track of it here.
- */
-static int vsbus_active = 0;
-
-void
-vsbus_dma_start(struct vsbus_dma *vd)
-{
-
- SIMPLEQ_INSERT_TAIL(&vsbus_dma, vd, vd_q);
-
- if (vsbus_active == 0)
- vsbus_dma_intr();
-}
-
-void
-vsbus_dma_intr(void)
-{
- struct vsbus_dma *vd;
-
- vd = SIMPLEQ_FIRST(&vsbus_dma);
- if (vd == NULL) {
- vsbus_active = 0;
- return;
- }
- vsbus_active = 1;
- SIMPLEQ_REMOVE_HEAD(&vsbus_dma, vd_q);
- (*vd->vd_go)(vd->vd_arg);
-}
-
diff --git a/sys/arch/vax/vsa/vsbus_dma.c b/sys/arch/vax/vsa/vsbus_dma.c
deleted file mode 100644
index e03f968942f..00000000000
--- a/sys/arch/vax/vsa/vsbus_dma.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/* $OpenBSD: vsbus_dma.c,v 1.5 2008/06/26 05:42:14 ray Exp $ */
-/* $NetBSD: vsbus_dma.c,v 1.7 2000/07/26 21:50:49 matt Exp $ */
-
-/*-
- * Copyright (c) 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.
- *
- * 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.
- */
-
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-
-#include <uvm/uvm_extern.h>
-
-#define _VAX_BUS_DMA_PRIVATE
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/sid.h>
-#include <machine/sgmap.h>
-#include <machine/vsbus.h>
-
-static int vsbus_bus_dmamap_create_sgmap(bus_dma_tag_t, bus_size_t, int,
- bus_size_t, bus_size_t, int, bus_dmamap_t *);
-
-static void vsbus_bus_dmamap_destroy_sgmap(bus_dma_tag_t, bus_dmamap_t);
-
-static int vsbus_bus_dmamap_load_sgmap(bus_dma_tag_t, bus_dmamap_t, void *,
- bus_size_t, struct proc *, int);
-
-static int vsbus_bus_dmamap_load_mbuf_sgmap(bus_dma_tag_t, bus_dmamap_t,
- struct mbuf *, int);
-
-static int vsbus_bus_dmamap_load_uio_sgmap(bus_dma_tag_t, bus_dmamap_t,
- struct uio *, int);
-
-static int vsbus_bus_dmamap_load_raw_sgmap(bus_dma_tag_t, bus_dmamap_t,
- bus_dma_segment_t *, int, bus_size_t, int);
-
-static void vsbus_bus_dmamap_unload_sgmap(bus_dma_tag_t, bus_dmamap_t);
-
-static void vsbus_bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
- bus_size_t, int);
-
-void
-vsbus_dma_init(sc, ptecnt)
- struct vsbus_softc *sc;
- unsigned ptecnt;
-{
- bus_dma_tag_t t;
- bus_dma_segment_t segs[1];
- pt_entry_t *pte;
- int nsegs, error;
- unsigned mapsize = ptecnt * sizeof(pt_entry_t);
-
- /*
- * Initialize the DMA tag used for sgmap-mapped DMA.
- */
- t = &sc->sc_dmatag;
- t->_cookie = sc;
- t->_wbase = 0;
- t->_wsize = ptecnt * VAX_NBPG;
- t->_boundary = 0;
- t->_sgmap = &sc->sc_sgmap;
- t->_dmamap_create = vsbus_bus_dmamap_create_sgmap;
- t->_dmamap_destroy = vsbus_bus_dmamap_destroy_sgmap;
- t->_dmamap_load = vsbus_bus_dmamap_load_sgmap;
- t->_dmamap_load_mbuf = vsbus_bus_dmamap_load_mbuf_sgmap;
- t->_dmamap_load_uio = vsbus_bus_dmamap_load_uio_sgmap;
- t->_dmamap_load_raw = vsbus_bus_dmamap_load_raw_sgmap;
- t->_dmamap_unload = vsbus_bus_dmamap_unload_sgmap;
- t->_dmamap_sync = vsbus_bus_dmamap_sync;
-
- t->_dmamem_alloc = _bus_dmamem_alloc;
- t->_dmamem_free = _bus_dmamem_free;
- t->_dmamem_map = _bus_dmamem_map;
- t->_dmamem_unmap = _bus_dmamem_unmap;
- t->_dmamem_mmap = _bus_dmamem_mmap;
-
- if (vax_boardtype == VAX_BTYP_46 || vax_boardtype == VAX_BTYP_48) {
- /*
- * Allocate and map the VS4000 scatter gather map.
- */
- error = bus_dmamem_alloc(t, mapsize, mapsize, mapsize,
- segs, 1, &nsegs, BUS_DMA_NOWAIT);
- if (error) {
- panic("vsbus_dma_init: error allocating memory for "
- "hw sgmap: error=%d", error);
- }
-
- error = bus_dmamem_map(t, segs, nsegs, mapsize,
- (caddr_t *) &pte, BUS_DMA_NOWAIT|BUS_DMA_COHERENT);
- if (error) {
- panic("vsbus_dma_init: error mapping memory for "
- "hw sgmap: error=%d", error);
- }
- memset(pte, 0, mapsize);
- *(int *) (sc->sc_vsregs + 8) = segs->ds_addr; /* set MAP BASE 0x2008008 */
- } else {
- pte = (pt_entry_t *) vax_map_physmem(KA49_SCSIMAP, mapsize / VAX_NBPG);
- for (nsegs = ptecnt; nsegs > 0; ) {
- ((u_int32_t *) pte)[--nsegs] = 0;
- }
- segs->ds_addr = KA49_SCSIMAP;
- }
- printf("%s: %uK entry DMA SGMAP at PA 0x%lx (VA %p)\n",
- sc->sc_dev.dv_xname, ptecnt / 1024, segs->ds_addr, pte);
-
- /*
- * Initialize the SGMAP.
- */
- vax_sgmap_init(t, &sc->sc_sgmap, "vsbus_sgmap", t->_wbase, t->_wsize, pte, 0);
-
-}
-
-/*
- * Create a VSBUS SGMAP-mapped DMA map.
- */
-int
-vsbus_bus_dmamap_create_sgmap(t, size, nsegments, maxsegsz, boundary,
- flags, dmamp)
- bus_dma_tag_t t;
- bus_size_t size;
- int nsegments;
- bus_size_t maxsegsz;
- bus_size_t boundary;
- int flags;
- bus_dmamap_t *dmamp;
-{
- bus_dmamap_t map;
- int error;
-
- error = _bus_dmamap_create(t, size, nsegments, maxsegsz,
- boundary, flags, dmamp);
- if (error)
- return (error);
-
- map = *dmamp;
-
- if (flags & BUS_DMA_ALLOCNOW) {
- error = vax_sgmap_alloc(map, vax_round_page(size),
- t->_sgmap, flags);
- if (error)
- vsbus_bus_dmamap_destroy_sgmap(t, map);
- }
-
- return (error);
-}
-
-/*
- * Destroy a VSBUS SGMAP-mapped DMA map.
- */
-static void
-vsbus_bus_dmamap_destroy_sgmap(t, map)
- bus_dma_tag_t t;
- bus_dmamap_t map;
-{
-
- if (map->_dm_flags & DMAMAP_HAS_SGMAP)
- vax_sgmap_free(map, t->_sgmap);
-
- _bus_dmamap_destroy(t, map);
-}
-
-/*
- * Load a VSBUS SGMAP-mapped DMA map with a linear buffer.
- */
-static int
-vsbus_bus_dmamap_load_sgmap(t, map, buf, buflen, p, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- void *buf;
- bus_size_t buflen;
- struct proc *p;
- int flags;
-{
- return vax_sgmap_load(t, map, buf, buflen, p, flags, t->_sgmap);
-}
-
-/*
- * Load a VSBUS SGMAP-mapped DMA map with an mbuf chain.
- */
-static int
-vsbus_bus_dmamap_load_mbuf_sgmap(t, map, m, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- struct mbuf *m;
- int flags;
-{
- return vax_sgmap_load_mbuf(t, map, m, flags, t->_sgmap);
-}
-
-/*
- * Load a VSBUS SGMAP-mapped DMA map with a uio.
- */
-static int
-vsbus_bus_dmamap_load_uio_sgmap(t, map, uio, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- struct uio *uio;
- int flags;
-{
- return vax_sgmap_load_uio(t, map, uio, flags, t->_sgmap);
-}
-
-/*
- * Load a VSBUS SGMAP-mapped DMA map with raw memory.
- */
-static int
-vsbus_bus_dmamap_load_raw_sgmap(t, map, segs, nsegs, size, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- bus_dma_segment_t *segs;
- int nsegs;
- bus_size_t size;
- int flags;
-{
- return vax_sgmap_load_raw(t, map, segs, nsegs, size, flags, t->_sgmap);
-}
-
-/*
- * Unload a VSBUS DMA map.
- */
-static void
-vsbus_bus_dmamap_unload_sgmap(t, map)
- bus_dma_tag_t t;
- bus_dmamap_t map;
-{
- /*
- * Invalidate any SGMAP page table entries used by this
- * mapping.
- */
- vax_sgmap_unload(t, map, t->_sgmap);
-
- /*
- * Do the generic bits of the unload.
- */
- _bus_dmamap_unload(t, map);
-}
-
-/*
- * Sync the bus map.
- */
-static void
-vsbus_bus_dmamap_sync(tag, dmam, offset, len, ops)
- bus_dma_tag_t tag;
- bus_dmamap_t dmam;
- bus_addr_t offset;
- bus_size_t len;
- int ops;
-{
- /* not needed */
-}
diff --git a/sys/arch/vax/vxt/if_ze_vxtbus.c b/sys/arch/vax/vxt/if_ze_vxtbus.c
deleted file mode 100644
index 975e1bf312f..00000000000
--- a/sys/arch/vax/vxt/if_ze_vxtbus.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* $OpenBSD: if_ze_vxtbus.c,v 1.4 2015/11/24 17:11:39 mpi Exp $ */
-/*
- * Copyright (c) 1999 Ludd, University of Lule}, Sweden. 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 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 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 <sys/socket.h>
-
-#include <net/if.h>
-#include <net/if_media.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/nexus.h>
-
-#include <vax/if/sgecreg.h>
-#include <vax/if/sgecvar.h>
-
-#include <vax/vxt/vxtbusvar.h>
-
-int ze_vxt_match(struct device *, void *, void *);
-void ze_vxt_attach(struct device *, struct device *, void *);
-
-struct cfattach ze_vxtbus_ca = {
- sizeof(struct ze_softc), ze_vxt_match, ze_vxt_attach
-};
-
-int
-ze_vxt_match(struct device *parent, void *vcf, void *aux)
-{
- struct bp_conf *bp = aux;
-
- if (strcmp(bp->type, "sgec") == 0)
- return (1);
- return (0);
-}
-
-void
-ze_vxt_attach(struct device *parent, struct device *self, void *aux)
-{
- extern struct vax_bus_dma_tag vax_bus_dma_tag;
- struct ze_softc *sc = (void *)self;
- int *ea, i;
-
- /*
- * Map in SGEC registers.
- */
- sc->sc_ioh = vax_map_physmem(SGECADDR_VXT, 1);
- sc->sc_iot = 0; /* :-) */
- sc->sc_dmat = &vax_bus_dma_tag;
-
- sc->sc_intvec = VXT_INTRVEC;
- vxtbus_intr_establish(self->dv_xname, IPL_NET,
- (int (*)(void *))sgec_intr, sc);
-
- /*
- * Map in, read and release ethernet rom address.
- */
- ea = (int *)vax_map_physmem(NISA_ROM_VXT, 1);
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- sc->sc_ac.ac_enaddr[i] = ea[i] & 0xff;
- vax_unmap_physmem((vaddr_t)ea, 1);
-
- SET(sc->sc_flags, SGECF_VXTQUIRKS);
- sgec_attach(sc);
-}
diff --git a/sys/arch/vax/vxt/qsc.c b/sys/arch/vax/vxt/qsc.c
deleted file mode 100644
index 9389fe60f3d..00000000000
--- a/sys/arch/vax/vxt/qsc.c
+++ /dev/null
@@ -1,1072 +0,0 @@
-/* $OpenBSD: qsc.c,v 1.8 2010/07/02 17:27:01 nicm Exp $ */
-/*
- * Copyright (c) 2006 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice, this permission notice, and the disclaimer below
- * appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Mach Operating System
- * Copyright (c) 1993-1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/syslog.h>
-#include <sys/conf.h>
-
-#include <machine/bus.h>
-#include <machine/nexus.h>
-#include <machine/sid.h>
-
-#include <dev/cons.h>
-
-#include <vax/vxt/vxtbusvar.h>
-
-#include <vax/vxt/qscreg.h>
-#include <vax/vxt/qscvar.h>
-
-#ifdef DDB
-#include <machine/cpu.h>
-#include <ddb/db_var.h>
-#endif
-
-#include "qsckbd.h"
-#include "qscms.h"
-
-struct cfdriver qsc_cd = {
- NULL, "qsc", DV_TTY
-};
-
-/* console storage */
-struct qsc_sv_reg qsccn_sv;
-
-/* prototypes */
-cdev_decl(qsc);
-cons_decl(qsc);
-int qscintr(void *);
-int qscparam(struct tty *, struct termios *);
-void qscrint(struct qscsoftc *, u_int);
-int qscspeed(int);
-void qscstart(struct tty *);
-struct tty *qsctty(dev_t);
-void qscxint(struct qscsoftc *, u_int);
-
-/*
- * Registers are mapped as the least-significant byte of 32-bit
- * addresses. The following macros hide this.
- */
-
-#define qsc_readp(sc, reg) \
- bus_space_read_1((sc)->sc_iot, (sc)->sc_ioh, 4 * (reg))
-#define qsc_read(sc, line, reg) \
- bus_space_read_1((sc)->sc_iot, (sc)->sc_ioh, \
- (sc)->sc_regaddr[line][reg])
-#define qsc_writep(sc, reg, val) \
- bus_space_write_1((sc)->sc_iot, (sc)->sc_ioh, 4 * (reg), (val))
-#define qsc_write(sc, line, reg, val) \
- bus_space_write_1((sc)->sc_iot, (sc)->sc_ioh, \
- (sc)->sc_regaddr[line][reg], (val))
-
-#define SC_LINE(dev) (minor(dev))
-
-/*
- * Attachment glue.
- */
-
-int qsc_match(struct device *parent, void *self, void *aux);
-void qsc_attach(struct device *parent, struct device *self, void *aux);
-int qsc_print(void *, const char *);
-
-struct cfattach qsc_ca = {
- sizeof(struct qscsoftc), qsc_match, qsc_attach
-};
-
-int
-qsc_match(struct device *parent, void *cf, void *aux)
-{
- struct bp_conf *bp = aux;
-
- if (strcmp(bp->type, qsc_cd.cd_name) == 0)
- return (1);
- return (0);
-}
-
-void
-qsc_attach(struct device *parent, struct device *self, void *aux)
-{
- extern struct vax_bus_space vax_mem_bus_space;
- struct qscsoftc *sc = (struct qscsoftc *)self;
- bus_space_handle_t ioh;
- u_int line, pair, reg;
-#if NQSCKBD > 0 || NQSCMS > 0
- struct qsc_attach_args qa;
-#endif
-
- sc->sc_iot = &vax_mem_bus_space;
- if (bus_space_map(sc->sc_iot, QSCADDR, VAX_NBPG, 0, &ioh) != 0) {
- printf(": can't map registers!\n");
- return;
- }
- sc->sc_ioh = ioh;
-
- if (cn_tab->cn_putc == qsccnputc) {
- sc->sc_console = 1;
- printf(": console");
- }
-
- /*
- * Initialize line-specific data (register addresses)
- */
-
- for (line = 0; line < SC_NLINES; line++) {
- sc->sc_regaddr[line][SC_MR] = line * 8 + SC_MRA;
- sc->sc_regaddr[line][SC_CSR] = line * 8 + SC_CSRA;
- sc->sc_regaddr[line][SC_CR] = line * 8 + SC_CRA;
- sc->sc_regaddr[line][SC_TXFIFO] = line * 8 + SC_TXFIFOA;
-
- sc->sc_regaddr[line][SC_IOPCR] = (line < 2 ? 0 : 0x10) +
- (line & 1) + SC_IOPCRA;
-
- sc->sc_regaddr[line][SC_ACR] = (line < 2 ? 0 : 0x10) + SC_ACRAB;
- sc->sc_regaddr[line][SC_IMR] = (line < 2 ? 0 : 0x10) + SC_IMRAB;
- sc->sc_regaddr[line][SC_OPR] = (line < 2 ? 0 : 0x10) + SC_OPRAB;
- }
- for (line = 0; line < SC_NLINES; line++)
- for (reg = 0; reg < SC_LOGICAL; reg++)
- sc->sc_regaddr[line][reg] =
- 0 + 4 * sc->sc_regaddr[line][reg];
-
- /*
- * Initialize all lines.
- */
- sc->sc_sv_reg = sc->sc_console ? &qsccn_sv : &sc->sc_sv_reg_storage;
- for (line = 0; line < SC_NLINES; line++) {
- /* do not reinitialize the console line... */
- if (sc->sc_console && line == QSC_LINE_SERIAL)
- continue;
-
- sc->sc_sv_reg->sv_mr1[line] =
- (line == 3 ? ODDPAR | PAREN : PARDIS) | RXRTS | CL8;
- sc->sc_sv_reg->sv_mr2[line] = /* TXCTS | */ SB1;
- sc->sc_sv_reg->sv_csr[line] = line < 2 ? BD9600 : BD4800;
- sc->sc_sv_reg->sv_cr[line] = TXEN | RXEN;
-
- pair = line >> 1;
-
- if (sc->sc_console && pair == (QSC_LINE_SERIAL >> 1))
- continue;
-
- /* Start out with Tx and RX interrupts disabled */
- sc->sc_sv_reg->sv_imr[pair] = 0;
- }
-
- for (line = 0; line < SC_NLINES; line++) {
- /* do not reset the console line... */
- if (sc->sc_console && line == QSC_LINE_SERIAL)
- continue;
-
- qsc_write(sc, line, SC_CR, RXRESET | TXDIS | RXDIS);
- DELAY(1);
- qsc_write(sc, line, SC_CR, TXRESET | TXDIS | RXDIS);
- DELAY(1);
- qsc_write(sc, line, SC_CR, ERRRESET | TXDIS | RXDIS);
- DELAY(1);
- qsc_write(sc, line, SC_CR, BRKINTRESET | TXDIS | RXDIS);
- DELAY(1);
- qsc_write(sc, line, SC_CR, MRZERO | TXDIS | RXDIS);
- DELAY(1);
-
- qsc_write(sc, line, SC_MR, 0);
- qsc_write(sc, line, SC_MR, sc->sc_sv_reg->sv_mr1[line]);
- qsc_write(sc, line, SC_MR, sc->sc_sv_reg->sv_mr2[line]);
- qsc_write(sc, line, SC_CSR, sc->sc_sv_reg->sv_csr[line]);
- qsc_write(sc, line, SC_CR, sc->sc_sv_reg->sv_cr[line]);
- DELAY(1);
- }
-
- for (pair = 0; pair < SC_NLINES / 2; pair++)
- qsc_write(sc, pair << 1, SC_IMR,
- sc->sc_sv_reg->sv_imr[pair]);
-
- for (line = 0; line < SC_NLINES; line++) {
- sc->sc_tty[line] = NULL;
- sc->sc_swflags[line] = 0;
- }
- if (sc->sc_console)
- sc->sc_swflags[QSC_LINE_SERIAL] |= TIOCFLAG_SOFTCAR;
-
- printf("\n");
-
- /*
- * Configure interrupts. We are bidding in 2681 mode for now.
- */
-
- qsc_writep(sc, SC_ICR, 0x00);
- for (line = SC_BIDCRA; line <= SC_BIDCRD; line++)
- qsc_writep(sc, line, 0x00);
- qsc_writep(sc, SC_IVR, VXT_INTRVEC >> 2);
-
- vxtbus_intr_establish(self->dv_xname, IPL_TTY, qscintr, sc);
-
- /*
- * Attach subdevices, and enable RX and TX interrupts on their lines
- * if successful.
- */
-#if NQSCKBD > 0
- /* keyboard */
- qa.qa_line = QSC_LINE_KEYBOARD;
- qa.qa_console = !sc->sc_console;
- qa.qa_hook = &sc->sc_hook[QSC_LINE_KEYBOARD];
- if (config_found(self, &qa, qsc_print) != NULL)
- sc->sc_sv_reg->sv_imr[QSC_LINE_KEYBOARD >> 1] |= IRXRDYA;
-#endif
-#if NQSCMS > 0
- /* mouse */
- qa.qa_line = QSC_LINE_MOUSE;
- qa.qa_console = 0;
- qa.qa_hook = &sc->sc_hook[QSC_LINE_MOUSE];
- if (config_found(self, &qa, qsc_print) != NULL)
- sc->sc_sv_reg->sv_imr[QSC_LINE_MOUSE >> 1] |= IRXRDYB;
-#endif
-
- for (pair = 0; pair < SC_NLINES / 2; pair++)
- qsc_write(sc, pair << 1, SC_IMR,
- sc->sc_sv_reg->sv_imr[pair]);
-
- sc->sc_rdy = 1;
-}
-
-/* speed tables */
-const struct qsc_s {
- int kspeed;
- int dspeed;
-} qsc_speeds[] = {
- { B0, 0 }, /* 0 baud, special HUP condition */
- { B50, NOBAUD }, /* 50 baud, not implemented */
- { B75, BD75 }, /* 75 baud */
- { B110, BD110 }, /* 110 baud */
- { B134, BD134 }, /* 134.5 baud */
- { B150, BD150 }, /* 150 baud */
- { B200, NOBAUD }, /* 200 baud, not implemented */
- { B300, BD300 }, /* 300 baud */
- { B600, BD600 }, /* 600 baud */
- { B1200, BD1200 }, /* 1200 baud */
- { B1800, BD1800 }, /* 1800 baud */
- { B2400, BD2400 }, /* 2400 baud */
- { B4800, BD4800 }, /* 4800 baud */
- { B9600, BD9600 }, /* 9600 baud */
- { B19200, BD19200 }, /* 19200 baud */
- { -1, NOBAUD }, /* anything more is uncivilized */
-};
-
-int
-qscspeed(int speed)
-{
- const struct qsc_s *ds;
-
- for (ds = qsc_speeds; ds->kspeed != -1; ds++)
- if (ds->kspeed == speed)
- return ds->dspeed;
-
- return NOBAUD;
-}
-
-struct tty *
-qsctty(dev_t dev)
-{
- u_int line;
- struct qscsoftc *sc;
-
- line = SC_LINE(dev);
- if (qsc_cd.cd_ndevs == 0 || line >= SC_NLINES)
- return (NULL);
-
- sc = (struct qscsoftc *)qsc_cd.cd_devs[0];
- if (sc == NULL)
- return (NULL);
-
- return sc->sc_tty[line];
-}
-
-void
-qscstart(struct tty *tp)
-{
- struct qscsoftc *sc;
- dev_t dev;
- int s;
- u_int line;
- int c, tries;
-
- if ((tp->t_state & TS_ISOPEN) == 0)
- return;
-
- dev = tp->t_dev;
- line = SC_LINE(dev);
- sc = (struct qscsoftc *)qsc_cd.cd_devs[0];
-
- s = spltty();
-
- if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))
- goto bail;
-
- ttwakeupwr(tp);
- if (tp->t_outq.c_cc == 0)
- goto bail;
-
- tp->t_state |= TS_BUSY;
- while (tp->t_outq.c_cc != 0) {
-
- /* load transmitter until it is full */
- for (tries = 10000; tries != 0; tries --)
- if (qsc_read(sc, line, SC_SR) & TXRDY)
- break;
-
- if (tries == 0) {
- timeout_add(&tp->t_rstrt_to, 1);
- tp->t_state |= TS_TIMEOUT;
- break;
- } else {
- c = getc(&tp->t_outq);
-
- qsc_write(sc, line, SC_TXFIFO, c & 0xff);
-
- sc->sc_sv_reg->sv_imr[line >> 1] |=
- line & 1 ? ITXRDYB : ITXRDYA;
- qsc_write(sc, line, SC_IMR,
- sc->sc_sv_reg->sv_imr[line >> 1]);
- }
- }
- tp->t_state &= ~TS_BUSY;
-
-bail:
- splx(s);
-}
-
-int
-qscstop(struct tty *tp, int flag)
-{
- int s;
-
- s = spltty();
- if (tp->t_state & TS_BUSY) {
- if ((tp->t_state & TS_TTSTOP) == 0)
- tp->t_state |= TS_FLUSH;
- }
- splx(s);
-
- return 0;
-}
-
-int
-qscioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- int error;
- u_int line;
- struct tty *tp;
- struct qscsoftc *sc;
-
- line = SC_LINE(dev);
- sc = (struct qscsoftc *)qsc_cd.cd_devs[0];
-
- tp = sc->sc_tty[line];
- if (tp == NULL)
- return (ENXIO);
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return(error);
-
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return(error);
-
- switch (cmd) {
- case TIOCGFLAGS:
- *(int *)data = sc->sc_swflags[line];
- break;
- case TIOCSFLAGS:
- error = suser(p, 0);
- if (error != 0)
- return (EPERM);
-
- sc->sc_swflags[line] = *(int *)data &
- /* only allow valid flags */
- (TIOCFLAG_SOFTCAR | TIOCFLAG_CLOCAL | TIOCFLAG_CRTSCTS);
- break;
- default:
- return (ENOTTY);
- }
-
- return (0);
-}
-
-int
-qscparam(struct tty *tp, struct termios *t)
-{
- int flags;
- u_int line, pair;
- int speeds;
- u_int8_t mr1, mr2;
- struct qscsoftc *sc;
- dev_t dev;
-
- dev = tp->t_dev;
- line = SC_LINE(dev);
- pair = line >> 1;
- sc = (struct qscsoftc *)qsc_cd.cd_devs[0];
-
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = t->c_cflag;
-
- flags = tp->t_flags;
-
- /* disable Tx and Rx */
- if (sc->sc_console == 0 || line != QSC_LINE_SERIAL) {
- if (line & 1)
- sc->sc_sv_reg->sv_imr[pair] &= ~(ITXRDYB | IRXRDYB);
- else
- sc->sc_sv_reg->sv_imr[pair] &= ~(ITXRDYA | IRXRDYA);
- qsc_write(sc, line, SC_IMR, sc->sc_sv_reg->sv_imr[pair]);
-
- /* set baudrate */
- speeds = qscspeed(tp->t_ispeed);
- if (speeds == NOBAUD)
- speeds = DEFBAUD;
- qsc_write(sc, line, SC_CSR, speeds);
- sc->sc_sv_reg->sv_csr[line] = speeds;
-
- /* get saved mode registers and clear set up parameters */
- mr1 = sc->sc_sv_reg->sv_mr1[line];
- mr1 &= ~(CLMASK | PARTYPEMASK | PARMODEMASK);
-
- mr2 = sc->sc_sv_reg->sv_mr2[line];
- mr2 &= ~SBMASK;
-
- /* set up character size */
- switch (t->c_cflag & CSIZE) {
- case CL8:
- mr1 |= CL8;
- break;
- case CL7:
- mr1 |= CL7;
- break;
- case CL6:
- mr1 |= CL6;
- break;
- case CL5:
- mr1 |= CL5;
- break;
- }
-
- /* set up stop bits */
- if (tp->t_ospeed == B110)
- mr2 |= SB2;
- else
- mr2 |= SB1;
-
- /* set up parity */
- if (t->c_cflag & PARENB) {
- mr1 |= PAREN;
- if (t->c_cflag & PARODD)
- mr1 |= ODDPAR;
- else
- mr1 |= EVENPAR;
- } else
- mr1 |= PARDIS;
-
- if (sc->sc_sv_reg->sv_mr1[line] != mr1 ||
- sc->sc_sv_reg->sv_mr2[line] != mr2) {
- /* write mode registers to duart */
- qsc_write(sc, line, SC_CR, MRONE);
- DELAY(1);
- qsc_write(sc, line, SC_MR, mr1);
- qsc_write(sc, line, SC_MR, mr2);
-
- /* save changed mode registers */
- sc->sc_sv_reg->sv_mr1[line] = mr1;
- sc->sc_sv_reg->sv_mr2[line] = mr2;
- }
- }
-
- /* enable transmitter? */
- if (tp->t_state & TS_BUSY) {
- sc->sc_sv_reg->sv_imr[pair] |= line & 1 ? ITXRDYB : ITXRDYA;
- }
-
- /* re-enable the receiver */
- sc->sc_sv_reg->sv_imr[pair] |= line & 1 ? IRXRDYB : IRXRDYA;
- qsc_write(sc, line, SC_IMR, sc->sc_sv_reg->sv_imr[pair]);
-
- return (0);
-}
-
-int
-qscopen(dev_t dev, int flag, int mode, struct proc *p)
-{
- int s;
- u_int line;
- struct qscsoftc *sc;
- struct tty *tp;
-
- line = SC_LINE(dev);
- if (qsc_cd.cd_ndevs == 0 || line >= SC_NLINES)
- return (ENXIO);
- /* Line B is not wired... */
- if (line == QSC_LINE_DEAD)
- return (ENXIO);
- sc = (struct qscsoftc *)qsc_cd.cd_devs[0];
- if (sc == NULL)
- return (ENXIO);
-
- /* if some other device is using the line, it's not available */
- if (sc->sc_hook[line].fn != NULL)
- return (ENXIO);
-
- s = spltty();
- if (sc->sc_tty[line] != NULL)
- tp = sc->sc_tty[line];
- else
- tp = sc->sc_tty[line] = ttymalloc(0);
-
- tp->t_oproc = qscstart;
- tp->t_param = qscparam;
- tp->t_dev = dev;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
- ttychars(tp);
-
- if (tp->t_ispeed == 0) {
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = B9600;
- if (sc->sc_console && line == QSC_LINE_SERIAL) {
- /* console is 8N1 */
- tp->t_cflag = (CREAD | CS8 | HUPCL);
- } else {
- tp->t_cflag = TTYDEF_CFLAG;
- }
- }
-
- if (sc->sc_swflags[line] & TIOCFLAG_CLOCAL)
- tp->t_cflag |= CLOCAL;
- if (sc->sc_swflags[line] & TIOCFLAG_CRTSCTS)
- tp->t_cflag |= CRTSCTS;
- if (sc->sc_swflags[line] & TIOCFLAG_MDMBUF)
- tp->t_cflag |= MDMBUF;
-
- qscparam(tp, &tp->t_termios);
- ttsetwater(tp);
-
- tp->t_state |= TS_CARR_ON;
- } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) {
- splx(s);
- return (EBUSY);
- }
-
- /*
- * Reset the tty pointer, as there could have been a dialout
- * use of the tty with a dialin open waiting.
- */
- tp->t_dev = dev;
- splx(s);
- return ((*linesw[tp->t_line].l_open)(dev, tp, p));
-}
-
-int
-qscclose(dev_t dev, int flag, int mode, struct proc *p)
-{
- struct tty *tp;
- struct qscsoftc *sc;
- u_int line;
-
- line = SC_LINE(dev);
- sc = (struct qscsoftc *)qsc_cd.cd_devs[0];
-
- tp = sc->sc_tty[line];
- (*linesw[tp->t_line].l_close)(tp, flag, p);
- ttyclose(tp);
-
- return (0);
-}
-
-int
-qscread(dev_t dev, struct uio *uio, int flag)
-{
- u_int line;
- struct tty *tp;
- struct qscsoftc *sc;
-
- line = SC_LINE(dev);
- sc = (struct qscsoftc *)qsc_cd.cd_devs[0];
-
- tp = sc->sc_tty[line];
- if (tp == NULL)
- return (ENXIO);
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-qscwrite(dev_t dev, struct uio *uio, int flag)
-{
- u_int line;
- struct tty *tp;
- struct qscsoftc *sc;
-
- line = SC_LINE(dev);
- sc = (struct qscsoftc *)qsc_cd.cd_devs[0];
-
- tp = sc->sc_tty[line];
- if (tp == NULL)
- return (ENXIO);
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-void
-qscrint(struct qscsoftc *sc, u_int line)
-{
- struct tty *tp;
- int data;
- unsigned char sr;
- int overrun = 0;
-
- tp = sc->sc_tty[line];
-
- /* read status reg */
- while ((sr = qsc_read(sc, line, SC_SR)) & RXRDY) {
- /* read data and reset receiver */
- data = qsc_read(sc, line, SC_RXFIFO);
-
- if (sr & RBRK) {
- /* clear break state */
- qsc_write(sc, line, SC_CR, BRKINTRESET);
- DELAY(1);
- qsc_write(sc, line, SC_CR, ERRRESET);
- DELAY(1);
- continue;
- }
-
- if ((sr & ROVRN) && cold == 0 && overrun == 0) {
- log(LOG_WARNING, "%s line %d: receiver overrun\n",
- sc->sc_dev.dv_xname, line);
- overrun = 1;
- }
-
- if (sr & FRERR)
- data |= TTY_FE;
- if (sr & PERR)
- data |= TTY_PE;
-
- /* clear error state */
- if (sr & (ROVRN | FRERR | PERR)) {
- qsc_write(sc, line, SC_CR, ERRRESET);
- DELAY(1);
- }
-
- if (sc->sc_hook[line].fn != NULL) {
- if ((data & TTY_ERRORMASK) != 0 ||
- (*sc->sc_hook[line].fn)(sc->sc_hook[line].arg, data))
- continue;
- }
-
- if ((tp->t_state & (TS_ISOPEN|TS_WOPEN)) == 0 &&
- (sc->sc_console == 0 || line != QSC_LINE_SERIAL)) {
- continue;
- }
-
- /* no errors */
-#if defined(DDB)
- if (tp->t_dev == cn_tab->cn_dev) {
- int j = kdbrint(data);
-
- if (j == 1)
- continue;
-
- if (j == 2)
- (*linesw[tp->t_line].l_rint)(27, tp);
- }
-#endif
- (*linesw[tp->t_line].l_rint)(data, tp);
- }
-}
-
-void
-qscxint(struct qscsoftc *sc, u_int line)
-{
- struct tty *tp;
- u_int pair;
-
- tp = sc->sc_tty[line];
-
- if ((tp->t_state & (TS_ISOPEN|TS_WOPEN))==0)
- goto out;
-
- if (tp->t_state & TS_BUSY) {
- tp->t_state &= ~(TS_BUSY | TS_FLUSH);
- qscstart(tp);
- if (tp->t_state & TS_BUSY) {
- /* do not disable transmitter, yet */
- return;
- }
- }
-out:
-
- /* disable transmitter */
- pair = line >> 1;
- sc->sc_sv_reg->sv_imr[pair] &= line & 1 ? ~ITXRDYB : ~ITXRDYA;
- qsc_write(sc, line, SC_IMR, sc->sc_sv_reg->sv_imr[pair]);
-}
-
-int
-qscintr(void *arg)
-{
- struct qscsoftc *sc = arg;
- u_int8_t isr[SC_NLINES >> 1], curisr;
- u_int pair, line;
- int rc = 0;
-
- for (pair = 0; pair < SC_NLINES >> 1; pair++) {
- line = pair << 1;
-
- /* read interrupt status register and mask with imr */
- isr[pair] = curisr = qsc_read(sc, line, SC_ISR);
- curisr &= sc->sc_sv_reg->sv_imr[pair];
- if (curisr == 0)
- continue;
-
- rc = 1;
-
- if (curisr & IRXRDYA)
- qscrint(sc, line);
- if (curisr & ITXRDYA)
- qscxint(sc, line);
- if (curisr & IBRKA) {
- qsc_write(sc, line, SC_CR, BRKINTRESET);
- DELAY(1);
- }
-
- if (curisr & IRXRDYB)
- qscrint(sc, line + 1);
- if (curisr & ITXRDYB)
- qscxint(sc, line + 1);
- if (curisr & IBRKB) {
- qsc_write(sc, line + 1, SC_CR, BRKINTRESET);
- DELAY(1);
- }
- }
-
- return (rc);
-}
-
-/*
- * Console interface routines.
- */
-
-vaddr_t qsc_cnregs;
-#define qsc_cnread(reg) \
- *(volatile u_int8_t *)(qsc_cnregs + 4 * (reg))
-#define qsc_cnwrite(reg, val) \
- *(volatile u_int8_t *)(qsc_cnregs + 4 * (reg)) = (val)
-
-void
-qsccnprobe(struct consdev *cp)
-{
- int maj;
- extern int getmajor(void *);
- extern vaddr_t iospace;
-
- if (vax_boardtype != VAX_BTYP_VXT)
- return;
-
- /* locate the major number */
- if ((maj = getmajor(qscopen)) < 0)
- return;
-
- qsc_cnregs = iospace;
- ioaccess(iospace, QSCADDR, 1);
-
- cp->cn_dev = makedev(maj, QSC_LINE_SERIAL);
- cp->cn_pri = vax_confdata & 2 ? CN_LOWPRI : CN_HIGHPRI;
-}
-
-void
-qsccninit(cp)
- struct consdev *cp;
-{
- qsccn_sv.sv_mr1[QSC_LINE_SERIAL] = PARDIS | RXRTS | CL8;
- qsccn_sv.sv_mr2[QSC_LINE_SERIAL] = /* TXCTS | */ SB1;
- qsccn_sv.sv_csr[QSC_LINE_SERIAL] = BD9600;
- qsccn_sv.sv_cr[QSC_LINE_SERIAL] = TXEN | RXEN;
- qsccn_sv.sv_imr[QSC_LINE_SERIAL] = 0;
-
- qsc_cnwrite(SC_CRA, RXRESET | TXDIS | RXDIS);
- DELAY(1);
- qsc_cnwrite(SC_CRA, TXRESET | TXDIS | RXDIS);
- DELAY(1);
- qsc_cnwrite(SC_CRA, ERRRESET | TXDIS | RXDIS);
- DELAY(1);
- qsc_cnwrite(SC_CRA, BRKINTRESET | TXDIS | RXDIS);
- DELAY(1);
- qsc_cnwrite(SC_CRA, MRZERO | TXDIS | RXDIS);
- DELAY(1);
-
- qsc_cnwrite(SC_MRA, 0);
- qsc_cnwrite(SC_MRA, qsccn_sv.sv_mr1[QSC_LINE_SERIAL]);
- qsc_cnwrite(SC_MRA, qsccn_sv.sv_mr2[QSC_LINE_SERIAL]);
- qsc_cnwrite(SC_CSRA, qsccn_sv.sv_csr[QSC_LINE_SERIAL]);
- qsc_cnwrite(SC_CRA, qsccn_sv.sv_cr[QSC_LINE_SERIAL]);
- DELAY(1);
-
- qsc_cnwrite(SC_IMRAB, qsccn_sv.sv_imr[QSC_LINE_SERIAL]);
- qsc_cnwrite(SC_IMRCD, 0);
-}
-
-int
-qsccngetc(dev_t dev)
-{
- unsigned char sr; /* status reg of line a/b */
- u_char c; /* received character */
- int s;
-
- s = spltty();
-
- /* disable interrupts for this line and enable receiver */
- qsc_cnwrite(SC_IMRAB, qsccn_sv.sv_imr[QSC_LINE_SERIAL] & ~ITXRDYA);
- qsc_cnwrite(SC_CRA, RXEN);
- DELAY(1);
-
- for (;;) {
- /* read status reg */
- sr = qsc_cnread(SC_SRA);
-
- /* receiver interrupt handler*/
- if (sr & RXRDY) {
- /* read character from line */
- c = qsc_cnread(SC_RXFIFOA);
-
- /* check break condition */
- if (sr & RBRK) {
- /* clear break state */
- qsc_cnwrite(SC_CRA, BRKINTRESET);
- DELAY(1);
- qsc_cnwrite(SC_CRA, ERRRESET);
- DELAY(1);
- break;
- }
-
- if (sr & (FRERR | PERR | ROVRN)) {
- /* clear error state */
- qsc_cnwrite(SC_CRA, ERRRESET);
- DELAY(1);
- } else {
- break;
- }
- }
- }
-
- /* restore the previous state */
- qsc_cnwrite(SC_IMRAB, qsccn_sv.sv_imr[QSC_LINE_SERIAL]);
- qsc_cnwrite(SC_CRA, qsccn_sv.sv_cr[QSC_LINE_SERIAL]);
-
- splx(s);
-
- return ((int)c);
-}
-
-void
-qsccnputc(dev_t dev, int c)
-{
- int s;
-
- if (mfpr(PR_MAPEN) == 0)
- return;
-
- s = spltty();
-
- /* disable interrupts for this line and enable transmitter */
- qsc_cnwrite(SC_IMRAB, qsccn_sv.sv_imr[QSC_LINE_SERIAL] & ~ITXRDYA);
- qsc_cnwrite(SC_CRA, TXEN);
- DELAY(1);
-
- while ((qsc_cnread(SC_SRA) & TXRDY) == 0)
- ;
- qsc_cnwrite(SC_TXFIFOA, c);
-
- /* wait for transmitter to empty */
- while ((qsc_cnread(SC_SRA) & TXEMT) == 0)
- ;
-
- /* restore the previous state */
- qsc_cnwrite(SC_IMRAB, qsccn_sv.sv_imr[QSC_LINE_SERIAL]);
- qsc_cnwrite(SC_CRA, qsccn_sv.sv_cr[QSC_LINE_SERIAL]);
- DELAY(1);
-
- splx(s);
-}
-
-void
-qsccnpollc(dev, pollflag)
- dev_t dev;
- int pollflag;
-{
-}
-
-/*
- * Keyboard and mouse helper routines
- */
-
-#if NQSCKBD > 0 || NQSCMS > 0
-int
-qsc_print(void *aux, const char *name)
-{
- struct qsc_attach_args *qa = aux;
-
- if (name != NULL)
- printf(qa->qa_line == QSC_LINE_KEYBOARD ?
- "lkkbd at %s" : "lkms at %s", name);
- else
- printf(" line %d", qa->qa_line);
-
- return (UNCONF);
-}
-
-int
-qscgetc(u_int line)
-{
- bus_addr_t craddr;
- struct qscsoftc *sc = NULL;
- int s;
- u_int8_t sr, imr, imrmask, cr, c;
-
- s = spltty();
-
- craddr = line == QSC_LINE_KEYBOARD ? SC_CRC : SC_CRD;
- imrmask = line & 1 ? ~IRXRDYB : ~IRXRDYA;
- imr = sc != NULL ? sc->sc_sv_reg->sv_imr[line / 2] : 0;
- cr = sc != NULL ? sc->sc_sv_reg->sv_cr[line] : 0;
-
- /* disable interrupts for this line and enable receiver */
- qsc_cnwrite(SC_IMRCD, imr & imrmask);
- qsc_cnwrite(craddr, RXEN);
- DELAY(1);
-
- for (;;) {
- /* read status reg */
- sr = qsc_cnread(line == QSC_LINE_KEYBOARD ? SC_SRC : SC_SRD);
-
- /* receiver interrupt handler*/
- if (sr & RXRDY) {
- /* read character from line */
- c = qsc_cnread(line == QSC_LINE_KEYBOARD ?
- SC_RXFIFOC : SC_RXFIFOD);
-
- /* check break condition */
- if (sr & RBRK) {
- /* clear break state */
- qsc_cnwrite(craddr, BRKINTRESET);
- DELAY(1);
- qsc_cnwrite(craddr, ERRRESET);
- DELAY(1);
- break;
- }
-
- if (sr & (FRERR | PERR | ROVRN)) {
- /* clear error state */
- qsc_cnwrite(craddr, ERRRESET);
- DELAY(1);
- } else {
- break;
- }
- }
- }
-
- /* restore the previous state */
- qsc_cnwrite(SC_IMRCD, imr);
- qsc_cnwrite(craddr, cr);
- DELAY(1);
-
- splx(s);
-
- return ((int)c);
-}
-
-void
-qscputc(u_int line, int c)
-{
- bus_addr_t craddr;
- struct qscsoftc *sc = NULL;
- int s;
- u_int8_t imr, imrmask, cr;
-
- s = spltty();
-
- if (qsc_cd.cd_ndevs != 0 &&
- (sc = (struct qscsoftc *)qsc_cd.cd_devs[0]) != NULL)
- if (sc->sc_rdy == 0)
- sc = NULL;
-
- craddr = line == QSC_LINE_KEYBOARD ? SC_CRC : SC_CRD;
- imrmask = line & 1 ? ~ITXRDYB : ~ITXRDYA;
- imr = sc != NULL ? sc->sc_sv_reg->sv_imr[line / 2] : 0;
- cr = sc != NULL ? sc->sc_sv_reg->sv_cr[line] : 0;
-
- /* disable interrupts for this line and enable transmitter */
- qsc_cnwrite(SC_IMRCD, imr & imrmask);
- qsc_cnwrite(craddr, TXEN);
- DELAY(1);
-
- while ((qsc_cnread(line == QSC_LINE_KEYBOARD ? SC_SRC : SC_SRD) &
- TXRDY) == 0)
- ;
- qsc_cnwrite(line == QSC_LINE_KEYBOARD ? SC_TXFIFOC : SC_TXFIFOD, c);
-
- /* wait for transmitter to empty */
- while ((qsc_cnread(line == QSC_LINE_KEYBOARD ? SC_SRC : SC_SRD) &
- TXEMT) == 0)
- ;
-
- /* restore the previous state */
- qsc_cnwrite(SC_IMRCD, imr);
- qsc_cnwrite(craddr, cr);
- DELAY(1);
-
- splx(s);
-}
-#endif
diff --git a/sys/arch/vax/vxt/qsckbd.c b/sys/arch/vax/vxt/qsckbd.c
deleted file mode 100644
index a65f1810970..00000000000
--- a/sys/arch/vax/vxt/qsckbd.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/* $OpenBSD: qsckbd.c,v 1.2 2014/01/26 17:48:07 miod Exp $ */
-/* from OpenBSD: dzkbd.c,v 1.11 2006/08/05 22:05:55 miod Exp */
-/*
- * Copyright (c) 2006 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice, this permission notice, and the disclaimer below
- * appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * 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, Lawrence Berkeley Laboratory.
- *
- * 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.
- *
- * @(#)kbd.c 8.2 (Berkeley) 10/30/93
- */
-
-/*
- * LK200/LK400 keyboard attached to line C of the SC26C94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/syslog.h>
-#include <sys/malloc.h>
-#include <sys/timeout.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wskbdvar.h>
-#include <dev/wscons/wsksymdef.h>
-#include <dev/wscons/wsksymvar.h>
-#include <vax/dec/wskbdmap_lk201.h>
-
-#include <machine/bus.h>
-
-#include <vax/dec/lk201reg.h>
-#include <vax/dec/lk201var.h>
-
-#include <vax/vxt/qscvar.h>
-
-struct qsckbd_internal {
- u_int dzi_line;
- struct lk201_state dzi_ks;
-};
-
-struct qsckbd_internal qsckbd_console_internal;
-
-struct qsckbd_softc {
- struct device qsckbd_dev; /* required first: base device */
-
- struct qsckbd_internal *sc_itl;
- int sc_enabled;
- struct device *sc_wskbddev;
-};
-
-int qsckbd_match(struct device *, void *, void *);
-void qsckbd_attach(struct device *, struct device *, void *);
-
-struct cfattach qsckbd_ca = {
- sizeof(struct qsckbd_softc), qsckbd_match, qsckbd_attach,
-};
-
-int qsckbd_enable(void *, int);
-void qsckbd_set_leds(void *, int);
-int qsckbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
-
-const struct wskbd_accessops qsckbd_accessops = {
- qsckbd_enable,
- qsckbd_set_leds,
- qsckbd_ioctl,
-};
-
-void qsckbd_cngetc(void *, u_int *, int *);
-void qsckbd_cnpollc(void *, int);
-
-const struct wskbd_consops qsckbd_consops = {
- qsckbd_cngetc,
- qsckbd_cnpollc,
-};
-
-const struct wskbd_mapdata qsckbd_keymapdata = {
- lkkbd_keydesctab,
-#ifdef LKKBD_LAYOUT
- LKKBD_LAYOUT,
-#else
- KB_US | KB_DEFAULT,
-#endif
-};
-
-int qsckbd_input(void *, int);
-int qsckbd_sendchar(void *, int);
-
-int
-qsckbd_match(struct device *parent, void *vcf, void *aux)
-{
- struct qsc_attach_args *qa = aux;
- struct cfdata *cf = vcf;
-
- if (cf->cf_loc[0] == qa->qa_line)
- return 1;
-
- return 0;
-}
-
-void
-qsckbd_attach(struct device *parent, struct device *self, void *aux)
-{
- struct qsckbd_softc *sc = (void *)self;
- struct qsc_attach_args *qa = aux;
- struct qsckbd_internal *dzi;
- struct wskbddev_attach_args a;
- int isconsole;
-
- qa->qa_hook->fn = qsckbd_input;
- qa->qa_hook->arg = self;
-
- isconsole = qa->qa_console;
-
- if (isconsole) {
- dzi = &qsckbd_console_internal;
- sc->sc_enabled = 1;
- } else {
- dzi = malloc(sizeof(struct qsckbd_internal), M_DEVBUF, M_NOWAIT);
- if (dzi == NULL) {
- printf(": out of memory\n");
- return;
- }
- dzi->dzi_ks.attmt.sendchar = qsckbd_sendchar;
- dzi->dzi_ks.attmt.cookie = (void *)qa->qa_line;
- }
- dzi->dzi_ks.device = self;
- dzi->dzi_line = qa->qa_line;
- sc->sc_itl = dzi;
-
- printf("\n");
-
- if (!isconsole)
- lk201_init(&dzi->dzi_ks);
-
- a.console = dzi == &qsckbd_console_internal;
- a.keymap = &qsckbd_keymapdata;
- a.accessops = &qsckbd_accessops;
- a.accesscookie = sc;
-
- sc->sc_wskbddev = config_found(self, &a, wskbddevprint);
-}
-
-int
-qsckbd_cnattach(u_int line)
-{
-
- qsckbd_console_internal.dzi_ks.attmt.sendchar = qsckbd_sendchar;
- qsckbd_console_internal.dzi_ks.attmt.cookie = (void *)line;
- lk201_init(&qsckbd_console_internal.dzi_ks);
- qsckbd_console_internal.dzi_line = line;
-
- wskbd_cnattach(&qsckbd_consops, &qsckbd_console_internal,
- &qsckbd_keymapdata);
-
- return 0;
-}
-
-int
-qsckbd_enable(void *v, int on)
-{
- struct qsckbd_softc *sc = v;
-
- sc->sc_enabled = on;
- return 0;
-}
-
-void
-qsckbd_cngetc(void *v, u_int *type, int *data)
-{
- struct qsckbd_internal *dzi = v;
- int c;
-
- do {
- c = qscgetc(dzi->dzi_line);
- } while (lk201_decode(&dzi->dzi_ks, 1, 0, c, type, data) == LKD_NODATA);
-}
-
-void
-qsckbd_cnpollc(void *v, int on)
-{
-}
-
-void
-qsckbd_set_leds(void *v, int leds)
-{
- struct qsckbd_softc *sc = (struct qsckbd_softc *)v;
-
- lk201_set_leds(&sc->sc_itl->dzi_ks, leds);
-}
-
-int
-qsckbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- struct qsckbd_softc *sc = (struct qsckbd_softc *)v;
-
- switch (cmd) {
- case WSKBDIO_GTYPE:
- *(int *)data = lk201_get_type(&sc->sc_itl->dzi_ks);
- return 0;
- case WSKBDIO_SETLEDS:
- lk201_set_leds(&sc->sc_itl->dzi_ks, *(int *)data);
- return 0;
- case WSKBDIO_GETLEDS:
- *(int *)data = lk201_get_leds(&sc->sc_itl->dzi_ks);
- return 0;
- case WSKBDIO_COMPLEXBELL:
- lk201_bell(&sc->sc_itl->dzi_ks,
- (struct wskbd_bell_data *)data);
- return 0;
- }
- return -1;
-}
-
-int
-qsckbd_input(void *v, int data)
-{
- struct qsckbd_softc *sc = (struct qsckbd_softc *)v;
- u_int type;
- int val;
- int decode;
-
- /*
- * We want to run through lk201_decode always, so that a late plugged
- * keyboard will get configured correctly.
- */
- do {
- decode = lk201_decode(&sc->sc_itl->dzi_ks, sc->sc_enabled, 1,
- data, &type, &val);
- if (decode != LKD_NODATA)
- wskbd_input(sc->sc_wskbddev, type, val);
- } while (decode == LKD_MORE);
-
- return(1);
-}
-
-int
-qsckbd_sendchar(void *v, int c)
-{
- qscputc((u_int)v, c);
- return (0);
-}
diff --git a/sys/arch/vax/vxt/qscms.c b/sys/arch/vax/vxt/qscms.c
deleted file mode 100644
index 798a8f9f163..00000000000
--- a/sys/arch/vax/vxt/qscms.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* $OpenBSD: qscms.c,v 1.2 2008/08/22 21:05:07 miod Exp $ */
-/* from OpenBSD: qscms.c,v 1.6 2006/07/31 18:50:13 miod Exp */
-/*
- * Copyright (c) 2006 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice, this permission notice, and the disclaimer below
- * appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * 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, Lawrence Berkeley Laboratory.
- *
- * 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.
- *
- * @(#)ms.c 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * VSXXX mouse or tablet, attached to line D of the SC26C94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/syslog.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-
-#include <machine/bus.h>
-
-#include <vax/qbus/dzreg.h>
-#include <vax/qbus/dzvar.h>
-
-#include <vax/vxt/qscvar.h>
-#include <vax/dec/vsmsvar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsmousevar.h>
-
-struct qscms_softc {
- struct lkms_softc sc_base;
- u_int sc_line;
-};
-
-int qscms_match(struct device *, void *, void *);
-void qscms_attach(struct device *, struct device *, void *);
-
-struct cfattach qscms_ca = {
- sizeof(struct qscms_softc), qscms_match, qscms_attach,
-};
-
-int qscms_enable(void *);
-void qscms_disable(void *);
-
-const struct wsmouse_accessops qscms_accessops = {
- qscms_enable,
- lkms_ioctl,
- qscms_disable,
-};
-
-int
-qscms_match(struct device *parent, void *vcf, void *aux)
-{
- struct qsc_attach_args *qa = aux;
- struct cfdata *cf = vcf;
-
- if (cf->cf_loc[0] == qa->qa_line)
- return 1;
-
- return 0;
-}
-
-void
-qscms_attach(struct device *parent, struct device *self, void *aux)
-{
- struct qscms_softc *qscms = (void *)self;
- struct lkms_softc *sc = (void *)self;
- struct qsc_attach_args *qa = aux;
- struct wsmousedev_attach_args a;
-
- qa->qa_hook->fn = lkms_input;
- qa->qa_hook->arg = self;
- qscms->sc_line = qa->qa_line;
-
- printf("\n");
-
- a.accessops = &qscms_accessops;
- a.accesscookie = qscms;
-
- sc->sc_flags = 0;
- sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint);
-}
-
-int
-qscms_enable(void *v)
-{
- struct qscms_softc *qscms = v;
- struct lkms_softc *sc = v;
-
- if (ISSET(sc->sc_flags, MS_ENABLED))
- return EBUSY;
-
- SET(sc->sc_flags, MS_SELFTEST);
- qscputc(qscms->sc_line, VS_SELF_TEST);
- /* selftest is supposed to complete within 500ms */
- (void)tsleep(&sc->sc_flags, TTIPRI, "qscmsopen", hz / 2);
- if (ISSET(sc->sc_flags, MS_SELFTEST)) {
- CLR(sc->sc_flags, MS_SELFTEST);
- return ENXIO;
- }
- DELAY(150);
- qscputc(qscms->sc_line, VS_INCREMENTAL);
- SET(sc->sc_flags, MS_ENABLED);
- return 0;
-}
-
-void
-qscms_disable(void *v)
-{
- struct lkms_softc *sc = v;
-
- CLR(sc->sc_flags, MS_ENABLED);
-}
diff --git a/sys/arch/vax/vxt/qscreg.h b/sys/arch/vax/vxt/qscreg.h
deleted file mode 100644
index bb15a4a84c1..00000000000
--- a/sys/arch/vax/vxt/qscreg.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/* $OpenBSD: qscreg.h,v 1.1 2006/08/27 16:55:41 miod Exp $ */
-/*
- * Copyright (c) 2006 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice, this permission notice, and the disclaimer below
- * appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * SC26C94 registers
- */
-
-#define SC_MRA 0x00 /* R/W Mode Register A */
-#define SC_SRA 0x01 /* R Status Register A */
-#define SC_CSRA 0x01 /* W Clock Select Register A */
-#define SC_CRA 0x02 /* W Command Register A */
-#define SC_RXFIFOA 0x03 /* R Receive Holding Register A */
-#define SC_TXFIFOA 0x03 /* W Transmit Holding Register A */
-#define SC_IPCRAB 0x04 /* R Input Port Change Register AB */
-#define SC_ACRAB 0x04 /* W Auxiliary Control Register AB */
-#define SC_ISRAB 0x05 /* R Interrupt Status Register AB */
-#define SC_IMRAB 0x05 /* W Interrupt Mask Register AB */
-#define SC_CTURAB 0x06 /* R/W Counter/Timer Upper Register AB */
-#define SC_CTLRAB 0x07 /* R/W Counter/Timer Lower Register AB */
-#define SC_MRB 0x08 /* R/W Mode Register A */
-#define SC_SRB 0x09 /* R Status Register A */
-#define SC_CSRB 0x09 /* W Clock Select Register A */
-#define SC_CRB 0x0a /* W Command Register A */
-#define SC_RXFIFOB 0x0b /* R Receive Holding Register A */
-#define SC_TXFIFOB 0x0b /* W Transmit Holding Register A */
-#define SC_OPRAB 0x0c /* R/W Output Port Register AB */
-#define SC_IPRAB 0x0d /* R Input Port Register AB */
-#define SC_IOPCRA 0x0d /* W I/O Port Control Register A */
-#define SC_IOPCRB 0x0e /* W I/O Port Control Register A */
-#define SC_CTSTARTAB 0x0e /* R Start Counter AB */
-#define SC_CTSTOPAB 0x0f /* R Start Counter AB */
-
-#define SC_MRC 0x10 /* R/W Mode Register C */
-#define SC_SRC 0x11 /* R Status Register C */
-#define SC_CSRC 0x11 /* W Clock Select Register C */
-#define SC_CRC 0x12 /* W Command Register C */
-#define SC_RXFIFOC 0x13 /* R Receive Holding Register C */
-#define SC_TXFIFOC 0x13 /* W Transmit Holding Register C */
-#define SC_IPCRCD 0x14 /* R Input Port Change Register CD */
-#define SC_ACRCD 0x14 /* W Auxiliary Control Register CD */
-#define SC_ISRCD 0x15 /* R Interrupt Status Register CD */
-#define SC_IMRCD 0x15 /* W Interrupt Mask Register CD */
-#define SC_CTURCD 0x16 /* R/W Counter/Timer Upper Register CD */
-#define SC_CTLRCD 0x17 /* R/W Counter/Timer Lower Register CD */
-#define SC_MRD 0x18 /* R/W Mode Register C */
-#define SC_SRD 0x19 /* R Status Register C */
-#define SC_CSRD 0x19 /* W Clock Select Register C */
-#define SC_CRD 0x1a /* W Command Register C */
-#define SC_RXFIFOD 0x1b /* R Receive Holding Register C */
-#define SC_TXFIFOD 0x1b /* W Transmit Holding Register C */
-#define SC_OPRCD 0x1c /* R/W Output Port Register CD */
-#define SC_IPRCD 0x1d /* R Input Port Register CD */
-#define SC_IOPCRC 0x1d /* W I/O Port Control Register C */
-#define SC_IOPCRD 0x1e /* W I/O Port Control Register C */
-#define SC_CTSTARTCD 0x1e /* R Start Counter CD */
-#define SC_CTSTOPCD 0x1f /* R Start Counter CD */
-
-#define SC_BIDCRA 0x20 /* R/W Bidding Control Register A */
-#define SC_BIDCRB 0x21 /* R/W Bidding Control Register B */
-#define SC_BIDCRC 0x22 /* R/W Bidding Control Register C */
-#define SC_BIDCRD 0x23 /* R/W Bidding Control Register D */
-#define SC_POWERDOWN 0x24 /* W Power Down */
-#define SC_POWERUP 0x25 /* W Power Up */
-#define SC_DDACKN 0x26 /* W Disable DACKN */
-#define SC_EDACKN 0x27 /* W Enable DACKN */
-
-#define SC_CIR 0x28 /* R Current Interrupt Register */
-#define SC_GICR 0x29 /* R Global Interrupting Channel Register */
-#define SC_IVR 0x29 /* W Interrupt Vector Register */
-#define SC_GBICR 0x2a /* R Global Int Byte Count Register */
-#define SC_UCIR 0x2a /* W Update CIR */
-#define SC_GRXFIFO 0x2b /* R Global Receive Holding Register */
-#define SC_GTXFIFO 0x2b /* W Global Transmit Holding Register */
-#define SC_ICR 0x2c /* R/W Interrupt Control Register */
-#define SC_BRGRATE 0x2d /* W BRG Rate */
-#define SC_X1DIV2 0x2e /* W Set X1/CLK divide by two */
-#define SC_X1NORM 0x2f /* W Set X1/CLK normal */
-
-/* mode register 1: MR1x operations */
-#define RXRTS 0x80 /* enable receiver RTS */
-#define PAREN 0x00 /* with parity */
-#define PARDIS 0x10 /* no parity */
-#define EVENPAR 0x00 /* even parity */
-#define ODDPAR 0x04 /* odd parity */
-#define CL5 0x00 /* 5 bits per char */
-#define CL6 0x01 /* 6 bits per char */
-#define CL7 0x02 /* 7 bits per char */
-#define CL8 0x03 /* 8 bits per char */
-#define PARMODEMASK 0x18 /* parity mode mask */
-#define PARTYPEMASK 0x04 /* parity type mask */
-#define CLMASK 0x03 /* character length mask */
-
-/* mode register 2: MR2x operations */
-#define TXRTS 0x20 /* enable transmitter RTS */
-#define TXCTS 0x10 /* enable transmitter CTS */
-#define SB2 0x0f /* 2 stop bits */
-#define SB1 0x07 /* 1 stop bit */
-#define SB1L5 0x00 /* 1 stop bit at 5 bits per character */
-
-#define SBMASK 0x0f /* stop bit mask */
-
-/* clock-select register: CSRx operations */
-#define NOBAUD -1 /* 50 and 200 baud are not possible */
-/* they are not in Baud register set 2 */
-#define BD75 0x00 /* 75 baud */
-#define BD110 0x11 /* 110 baud */
-#define BD134 0x22 /* 134.5 baud */
-#define BD150 0x33 /* 150 baud */
-#define BD300 0x44 /* 300 baud */
-#define BD600 0x55 /* 600 baud */
-#define BD1200 0x66 /* 1200 baud */
-#define BD1800 0xaa /* 1800 baud */
-#define BD2400 0x88 /* 2400 baud */
-#define BD4800 0x99 /* 4800 baud */
-#define BD9600 0xbb /* 9600 baud */
-#define BD19200 0xcc /* 19200 baud */
-
-#define DEFBAUD BD9600 /* default value if baudrate is not possible */
-
-/* channel command register: CRx operations */
-#define MRONE 0x10 /* reset mr pointer to mr1 */
-#define RXRESET 0x20 /* reset receiver */
-#define TXRESET 0x30 /* reset transmitter */
-#define ERRRESET 0x40 /* reset error status */
-#define BRKINTRESET 0x50 /* reset channel's break interrupt */
-#define BRKSTART 0x60 /* start break */
-#define BRKSTOP 0x70 /* stop break */
-#define MRZERO 0xb0 /* reset mr pointer to mr0 */
-#define TXDIS 0x08 /* disable transmitter */
-#define TXEN 0x04 /* enable transmitter */
-#define RXDIS 0x02 /* disable receiver */
-#define RXEN 0x01 /* enable receiver */
-
-/* status register: SRx status */
-#define RBRK 0x80 /* received break */
-#define FRERR 0x40 /* frame error */
-#define PERR 0x20 /* parity error */
-#define ROVRN 0x10 /* receiver overrun error */
-#define TXEMT 0x08 /* transmitter empty */
-#define TXRDY 0x04 /* transmitter ready */
-#define FFULL 0x02 /* receiver FIFO full */
-#define RXRDY 0x01 /* receiver ready */
-
-/* auxiliary control register: ACR operations */
-#define BDSET1 0x00 /* baudrate generator set 1 */
-#define BDSET2 0x80 /* baudrate generator set 2 */
-#define CCLK1 0x60 /* timer clock: external rate. TA */
-#define CCLK16 0x30 /* counter clock: x1 clk divided by 16 */
-
-/* interrupt status and mask register: ISR status and IMR mask */
-#define IIPCHG 0x80 /* I/O Port Change */
-#define IBRKB 0x40 /* delta break b */
-#define IRXRDYB 0x20 /* receiver ready b */
-#define ITXRDYB 0x10 /* transmitter ready b */
-#define ITIMER 0x08 /* Counter Ready */
-#define IBRKA 0x04 /* delta break a */
-#define IRXRDYA 0x02 /* receiver ready a */
-#define ITXRDYA 0x01 /* transmitter ready a */
diff --git a/sys/arch/vax/vxt/qscvar.h b/sys/arch/vax/vxt/qscvar.h
deleted file mode 100644
index 4b13fbcd1a0..00000000000
--- a/sys/arch/vax/vxt/qscvar.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* $OpenBSD: qscvar.h,v 1.1 2006/08/27 16:55:41 miod Exp $ */
-/*
- * Copyright (c) 2006 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice, this permission notice, and the disclaimer below
- * appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Mach Operating System
- * Copyright (c) 1993-1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-/*
- * Logical, per port, registers (serial functions only)
- */
-
-#define SC_MR 0x00 /* R/W Mode Register */
-#define SC_SR 0x01 /* R Status Register */
-#define SC_CSR 0x01 /* W Clock Select Register */
-#define SC_CR 0x02 /* W Command Register */
-#define SC_RXFIFO 0x03 /* R Receive Holding Register */
-#define SC_TXFIFO 0x03 /* W Transmit Holding Register */
-#define SC_IPCR 0x04 /* R Input Port Change Register */
-#define SC_ACR 0x04 /* W Auxiliary Control Register */
-#define SC_ISR 0x05 /* R Interrupt Status Register */
-#define SC_IMR 0x05 /* W Interrupt Mask Register */
-#define SC_OPR 0x06 /* R/W Output Port Register */
-#define SC_IPR 0x07 /* R Input Port Register */
-#define SC_IOPCR 0x07 /* W I/O Port Control Register */
-#define SC_LOGICAL 0x08
-
-#define SC_NLINES 4
-
-/* saved registers */
-struct qsc_sv_reg {
- u_int8_t sv_mr1[SC_NLINES];
- u_int8_t sv_mr2[SC_NLINES];
- u_int8_t sv_csr[SC_NLINES];
- u_int8_t sv_cr[SC_NLINES];
- u_int8_t sv_imr[SC_NLINES / 2];
-};
-
-struct qsc_input_hook {
- int (*fn)(void *, int);
- void *arg;
-};
-
-struct qscsoftc {
- struct device sc_dev;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- bus_addr_t sc_regaddr[SC_NLINES][SC_LOGICAL];
-
- int sc_console;
- int sc_rdy;
-
- struct qsc_sv_reg *sc_sv_reg;
- struct qsc_sv_reg sc_sv_reg_storage;
-
- struct tty *sc_tty[SC_NLINES];
- u_int sc_swflags[SC_NLINES];
-
- struct qsc_input_hook sc_hook[SC_NLINES];
-};
-
-/*
- * Line assignments on the VXT2000
- */
-
-#define QSC_LINE_SERIAL 0
-#define QSC_LINE_DEAD 1
-#define QSC_LINE_KEYBOARD 2
-#define QSC_LINE_MOUSE 3
-
-struct qsc_attach_args {
- u_int qa_line;
- int qa_console; /* for keyboard attachment */
- struct qsc_input_hook *qa_hook;
-};
-
-int qscgetc(u_int);
-void qscputc(u_int, int);
-
-int qsckbd_cnattach(u_int);
diff --git a/sys/arch/vax/vxt/vxtbus.c b/sys/arch/vax/vxt/vxtbus.c
deleted file mode 100644
index 5f676693cd3..00000000000
--- a/sys/arch/vax/vxt/vxtbus.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* $OpenBSD: vxtbus.c,v 1.3 2010/09/20 06:33:48 matthew Exp $ */
-/*
- * Copyright (c) 2006 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice, this permission notice, and the disclaimer below
- * appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/evcount.h>
-#include <sys/queue.h>
-
-#include <machine/cpu.h>
-#include <machine/nexus.h>
-#include <machine/scb.h>
-
-#include <vax/vxt/vxtbusvar.h>
-
-struct vxtbus_softc {
- struct device sc_dev;
- LIST_HEAD(, vxtbus_ih) sc_intrlist;
-};
-
-void vxtbus_attach(struct device *, struct device *, void *);
-int vxtbus_match(struct device *, void*, void *);
-
-struct cfdriver vxtbus_cd = {
- NULL, "vxtbus", DV_DULL
-};
-
-struct cfattach vxtbus_ca = {
- sizeof(struct vxtbus_softc), vxtbus_match, vxtbus_attach
-};
-
-void vxtbus_intr(void *);
-int vxtbus_print(void *, const char *);
-
-int
-vxtbus_match(struct device *parent, void *vcf, void *aux)
-{
- struct mainbus_attach_args *maa = aux;
-
- return (maa->maa_bustype == VAX_VXTBUS ? 1 : 0);
-}
-
-void
-vxtbus_attach(struct device *parent, struct device *self, void *aux)
-{
- struct vxtbus_softc *sc = (void *)self;
- struct bp_conf bp;
-
- LIST_INIT(&sc->sc_intrlist);
- scb_vecalloc(VXT_INTRVEC, vxtbus_intr, sc, SCB_ISTACK, NULL);
-
- printf("\n");
-
- bp.type = "sgec";
- config_found(self, &bp, vxtbus_print);
-
- bp.type = "qsc";
- config_found(self, &bp, vxtbus_print);
-
- bp.type = "lcspx";
- config_found(self, &bp, vxtbus_print);
-}
-
-int
-vxtbus_print(void *aux, const char *name)
-{
- struct bp_conf *bp = aux;
-
- if (name)
- printf("%s at %s", bp->type, name);
-
- return (UNCONF);
-}
-
-/*
- * VXT2000 interrupt code.
- *
- * All device interrupts end up on the same vector, which is controllable
- * by the SC26C94 chip.
- *
- * Interrupts are handled at spl4 (ipl 0x14).
- *
- * The following routines implement shared interrupts for vxtbus subdevices.
- */
-
-struct vxtbus_ih {
- LIST_ENTRY(vxtbus_ih) ih_link;
- int (*ih_fn)(void *);
- void * ih_arg;
- int ih_vec;
- struct evcount ih_cnt;
-};
-
-void
-vxtbus_intr_establish(const char *name, int ipl, int (*fn)(void *), void *arg)
-{
- struct vxtbus_softc *sc = (void *)vxtbus_cd.cd_devs[0];
- struct vxtbus_ih *ih;
-
- ih = (struct vxtbus_ih *)malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
-
- ih->ih_fn = fn;
- ih->ih_arg = arg;
- ih->ih_vec = VXT_INTRVEC;
- evcount_attach(&ih->ih_cnt, name, &ih->ih_vec);
-
- LIST_INSERT_HEAD(&sc->sc_intrlist, ih, ih_link);
-}
-
-void
-vxtbus_intr(void *arg)
-{
- struct vxtbus_softc *sc = arg;
- struct vxtbus_ih *ih;
- int rc;
-#ifdef DIAGNOSTIC
- int handled = 0;
- static int strayintr = 0;
-#endif
-
- LIST_FOREACH(ih, &sc->sc_intrlist, ih_link) {
- rc = (*ih->ih_fn)(ih->ih_arg);
- if (rc != 0) {
-#ifdef DIAGNOSTIC
- handled = 1;
-#endif
- ih->ih_cnt.ec_count++;
- if (rc > 0)
- break;
- }
- }
-
-#ifdef DIAGNOSTIC
- if (handled == 0) {
- if (++strayintr == 10)
- panic("%s: too many stray interrupts",
- sc->sc_dev.dv_xname);
- else
- printf("%s: stray interrupt\n", sc->sc_dev.dv_xname);
- }
-#endif
-}
diff --git a/sys/arch/vax/vxt/vxtbusvar.h b/sys/arch/vax/vxt/vxtbusvar.h
deleted file mode 100644
index 64e5e9543fc..00000000000
--- a/sys/arch/vax/vxt/vxtbusvar.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $OpenBSD: vxtbusvar.h,v 1.1 2006/08/27 16:55:41 miod Exp $ */
-/*
- * Copyright (c) 2006 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice, this permission notice, and the disclaimer below
- * appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * VXT2000 Hardware addresses
- */
-#define SGECADDR_VXT 0x20008000
-#define QSCADDR 0x200a0000
-#define NISA_ROM_VXT 0x200c4000
-
-#define VXT_INTRVEC 0x200
-
-void vxtbus_intr_establish(const char *, int, int (*)(void *), void *);