summaryrefslogtreecommitdiff
path: root/sys/arch/hp300
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-03-18 22:36:38 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-03-18 22:36:38 +0000
commit954b1a417ec63f20d2dde0645d24641005375a40 (patch)
tree4d3b982016a572dbb41f88eb76f38a29039036bb /sys/arch/hp300
parent7e9918e631c8d89e4daeae75c43b6381c34a8610 (diff)
Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the message sent by the three disks which have died on me over the last few days. Noone sane will mourn these ports anyway. So long, and thanks for the fish.
Diffstat (limited to 'sys/arch/hp300')
-rw-r--r--sys/arch/hp300/Makefile45
-rw-r--r--sys/arch/hp300/compile/.cvsignore2
-rw-r--r--sys/arch/hp300/conf/GENERIC144
-rw-r--r--sys/arch/hp300/conf/Makefile.hp300195
-rw-r--r--sys/arch/hp300/conf/RAMDISK144
-rw-r--r--sys/arch/hp300/conf/files.hp300227
-rw-r--r--sys/arch/hp300/dev/Makefile8
-rw-r--r--sys/arch/hp300/dev/apci.c978
-rw-r--r--sys/arch/hp300/dev/apci_subr.c119
-rw-r--r--sys/arch/hp300/dev/apcireg.h60
-rw-r--r--sys/arch/hp300/dev/apcivar.h65
-rw-r--r--sys/arch/hp300/dev/arcofi_dio.c105
-rw-r--r--sys/arch/hp300/dev/ct.c959
-rw-r--r--sys/arch/hp300/dev/ctreg.h152
-rw-r--r--sys/arch/hp300/dev/dca.c1114
-rw-r--r--sys/arch/hp300/dev/dcareg.h150
-rw-r--r--sys/arch/hp300/dev/dcm.c1672
-rw-r--r--sys/arch/hp300/dev/dcmreg.h253
-rw-r--r--sys/arch/hp300/dev/devlist2h.awk167
-rw-r--r--sys/arch/hp300/dev/dio.c366
-rw-r--r--sys/arch/hp300/dev/diodevs101
-rw-r--r--sys/arch/hp300/dev/diodevs.h198
-rw-r--r--sys/arch/hp300/dev/diodevs_data.h144
-rw-r--r--sys/arch/hp300/dev/diofb.c546
-rw-r--r--sys/arch/hp300/dev/diofb_mono.c245
-rw-r--r--sys/arch/hp300/dev/diofbreg.h94
-rw-r--r--sys/arch/hp300/dev/diofbvar.h148
-rw-r--r--sys/arch/hp300/dev/dioreg.h138
-rw-r--r--sys/arch/hp300/dev/diovar.h81
-rw-r--r--sys/arch/hp300/dev/dma.c572
-rw-r--r--sys/arch/hp300/dev/dmareg.h136
-rw-r--r--sys/arch/hp300/dev/dmavar.h75
-rw-r--r--sys/arch/hp300/dev/dnkbd.c1063
-rw-r--r--sys/arch/hp300/dev/dnkbdmap.c508
-rw-r--r--sys/arch/hp300/dev/dnkbdmap.h28
-rw-r--r--sys/arch/hp300/dev/dvbox.c431
-rw-r--r--sys/arch/hp300/dev/dvboxreg.h164
-rw-r--r--sys/arch/hp300/dev/fhpib.c673
-rw-r--r--sys/arch/hp300/dev/fhpibreg.h86
-rw-r--r--sys/arch/hp300/dev/frodo.c484
-rw-r--r--sys/arch/hp300/dev/frodoreg.h123
-rw-r--r--sys/arch/hp300/dev/frodovar.h49
-rw-r--r--sys/arch/hp300/dev/gbox.c452
-rw-r--r--sys/arch/hp300/dev/gboxreg.h105
-rw-r--r--sys/arch/hp300/dev/hd.c1330
-rw-r--r--sys/arch/hp300/dev/hdreg.h251
-rw-r--r--sys/arch/hp300/dev/hdvar.h90
-rw-r--r--sys/arch/hp300/dev/hil_intio.c105
-rw-r--r--sys/arch/hp300/dev/hp98265reg.h71
-rw-r--r--sys/arch/hp300/dev/hpib.c412
-rw-r--r--sys/arch/hp300/dev/hpibvar.h212
-rw-r--r--sys/arch/hp300/dev/hyper.c256
-rw-r--r--sys/arch/hp300/dev/hyperreg.h51
-rw-r--r--sys/arch/hp300/dev/if_le.c227
-rw-r--r--sys/arch/hp300/dev/if_lereg.h63
-rw-r--r--sys/arch/hp300/dev/if_levar.h52
-rw-r--r--sys/arch/hp300/dev/intio.c113
-rw-r--r--sys/arch/hp300/dev/intiovar.h44
-rw-r--r--sys/arch/hp300/dev/iotypes.h54
-rw-r--r--sys/arch/hp300/dev/isa_machdep.h40
-rw-r--r--sys/arch/hp300/dev/isabr.c1003
-rw-r--r--sys/arch/hp300/dev/isabrreg.h40
-rw-r--r--sys/arch/hp300/dev/maskbits.h90
-rw-r--r--sys/arch/hp300/dev/mb89352.c2010
-rw-r--r--sys/arch/hp300/dev/mb89352reg.h231
-rw-r--r--sys/arch/hp300/dev/mb89352var.h222
-rw-r--r--sys/arch/hp300/dev/mt.c981
-rw-r--r--sys/arch/hp300/dev/mtreg.h297
-rw-r--r--sys/arch/hp300/dev/nhpib.c555
-rw-r--r--sys/arch/hp300/dev/nhpibreg.h118
-rw-r--r--sys/arch/hp300/dev/ppi.c466
-rw-r--r--sys/arch/hp300/dev/ppiioctl.h61
-rw-r--r--sys/arch/hp300/dev/rbox.c394
-rw-r--r--sys/arch/hp300/dev/rboxreg.h120
-rw-r--r--sys/arch/hp300/dev/sgc.c147
-rw-r--r--sys/arch/hp300/dev/sgcreg.h41
-rw-r--r--sys/arch/hp300/dev/sgcvar.h45
-rw-r--r--sys/arch/hp300/dev/spc.c330
-rw-r--r--sys/arch/hp300/dev/sti_dio.c176
-rw-r--r--sys/arch/hp300/dev/sti_machdep.c85
-rw-r--r--sys/arch/hp300/dev/sti_machdep.h43
-rw-r--r--sys/arch/hp300/dev/sti_sgc.c149
-rw-r--r--sys/arch/hp300/dev/topcat.c522
-rw-r--r--sys/arch/hp300/dev/topcatreg.h117
-rw-r--r--sys/arch/hp300/dev/tvrx.c393
-rw-r--r--sys/arch/hp300/hp300/autoconf.c871
-rw-r--r--sys/arch/hp300/hp300/bus_space.c714
-rw-r--r--sys/arch/hp300/hp300/clock.c628
-rw-r--r--sys/arch/hp300/hp300/clockreg.h129
-rw-r--r--sys/arch/hp300/hp300/conf.c294
-rw-r--r--sys/arch/hp300/hp300/db_memrw.c207
-rw-r--r--sys/arch/hp300/hp300/disksubr.c141
-rw-r--r--sys/arch/hp300/hp300/genassym.cf171
-rw-r--r--sys/arch/hp300/hp300/intr.c304
-rw-r--r--sys/arch/hp300/hp300/kgdb_machdep.c80
-rw-r--r--sys/arch/hp300/hp300/leds.c95
-rw-r--r--sys/arch/hp300/hp300/leds.h52
-rw-r--r--sys/arch/hp300/hp300/locore.s1861
-rw-r--r--sys/arch/hp300/hp300/machdep.c1038
-rw-r--r--sys/arch/hp300/hp300/mem.c268
-rw-r--r--sys/arch/hp300/hp300/pmap_bootstrap.c123
-rw-r--r--sys/arch/hp300/hp300/sys_machdep.c64
-rw-r--r--sys/arch/hp300/hp300/trap.c1002
-rw-r--r--sys/arch/hp300/hp300/vectors.s147
-rw-r--r--sys/arch/hp300/hp300/vm_machdep.c258
-rw-r--r--sys/arch/hp300/hp300/wscons_machdep.c359
-rw-r--r--sys/arch/hp300/include/_float.h3
-rw-r--r--sys/arch/hp300/include/_types.h10
-rw-r--r--sys/arch/hp300/include/asm.h4
-rw-r--r--sys/arch/hp300/include/atomic.h10
-rw-r--r--sys/arch/hp300/include/autoconf.h45
-rw-r--r--sys/arch/hp300/include/bus.h281
-rw-r--r--sys/arch/hp300/include/cdefs.h8
-rw-r--r--sys/arch/hp300/include/cpu.h200
-rw-r--r--sys/arch/hp300/include/db_machdep.h5
-rw-r--r--sys/arch/hp300/include/disklabel.h40
-rw-r--r--sys/arch/hp300/include/endian.h5
-rw-r--r--sys/arch/hp300/include/exec.h31
-rw-r--r--sys/arch/hp300/include/fenv.h3
-rw-r--r--sys/arch/hp300/include/frame.h4
-rw-r--r--sys/arch/hp300/include/hil_machdep.h57
-rw-r--r--sys/arch/hp300/include/hp300spu.h77
-rw-r--r--sys/arch/hp300/include/ieee.h3
-rw-r--r--sys/arch/hp300/include/ieeefp.h5
-rw-r--r--sys/arch/hp300/include/intr.h111
-rw-r--r--sys/arch/hp300/include/kcore.h9
-rw-r--r--sys/arch/hp300/include/limits.h10
-rw-r--r--sys/arch/hp300/include/loadfile_machdep.h47
-rw-r--r--sys/arch/hp300/include/lock.h3
-rw-r--r--sys/arch/hp300/include/mutex.h3
-rw-r--r--sys/arch/hp300/include/param.h58
-rw-r--r--sys/arch/hp300/include/pcb.h42
-rw-r--r--sys/arch/hp300/include/pmap.h20
-rw-r--r--sys/arch/hp300/include/proc.h35
-rw-r--r--sys/arch/hp300/include/profile.h4
-rw-r--r--sys/arch/hp300/include/psl.h4
-rw-r--r--sys/arch/hp300/include/pte.h14
-rw-r--r--sys/arch/hp300/include/ptrace.h5
-rw-r--r--sys/arch/hp300/include/reg.h9
-rw-r--r--sys/arch/hp300/include/reloc.h3
-rw-r--r--sys/arch/hp300/include/setjmp.h4
-rw-r--r--sys/arch/hp300/include/signal.h5
-rw-r--r--sys/arch/hp300/include/spinlock.h3
-rw-r--r--sys/arch/hp300/include/stdarg.h5
-rw-r--r--sys/arch/hp300/include/tcb.h3
-rw-r--r--sys/arch/hp300/include/trap.h4
-rw-r--r--sys/arch/hp300/include/varargs.h5
-rw-r--r--sys/arch/hp300/include/vmparam.h64
-rw-r--r--sys/arch/hp300/stand/Makefile8
-rw-r--r--sys/arch/hp300/stand/Makefile.inc94
-rw-r--r--sys/arch/hp300/stand/cdboot/Makefile43
-rw-r--r--sys/arch/hp300/stand/cdboot/cdboot.c103
-rw-r--r--sys/arch/hp300/stand/cdboot/conf.c100
-rw-r--r--sys/arch/hp300/stand/cdboot/cons.c81
-rw-r--r--sys/arch/hp300/stand/cdboot/devopen.c260
-rw-r--r--sys/arch/hp300/stand/common/Makefile22
-rw-r--r--sys/arch/hp300/stand/common/apci.c159
-rw-r--r--sys/arch/hp300/stand/common/autoconf.c272
-rw-r--r--sys/arch/hp300/stand/common/cons.c104
-rw-r--r--sys/arch/hp300/stand/common/ct.c316
-rw-r--r--sys/arch/hp300/stand/common/dca.c129
-rw-r--r--sys/arch/hp300/stand/common/dcm.c156
-rw-r--r--sys/arch/hp300/stand/common/dnkbd.c179
-rw-r--r--sys/arch/hp300/stand/common/fhpib.c194
-rw-r--r--sys/arch/hp300/stand/common/hd.c362
-rw-r--r--sys/arch/hp300/stand/common/hil.c186
-rw-r--r--sys/arch/hp300/stand/common/hpib.c152
-rw-r--r--sys/arch/hp300/stand/common/if_le.c601
-rw-r--r--sys/arch/hp300/stand/common/ite.c344
-rw-r--r--sys/arch/hp300/stand/common/ite_dv.c202
-rw-r--r--sys/arch/hp300/stand/common/ite_gb.c145
-rw-r--r--sys/arch/hp300/stand/common/ite_hy.c80
-rw-r--r--sys/arch/hp300/stand/common/ite_rb.c145
-rw-r--r--sys/arch/hp300/stand/common/ite_sti.c358
-rw-r--r--sys/arch/hp300/stand/common/ite_subr.c404
-rw-r--r--sys/arch/hp300/stand/common/ite_tc.c133
-rw-r--r--sys/arch/hp300/stand/common/ite_tvrx.c74
-rw-r--r--sys/arch/hp300/stand/common/kbd.c95
-rw-r--r--sys/arch/hp300/stand/common/kbdconf.c62
-rw-r--r--sys/arch/hp300/stand/common/machdep.c208
-rw-r--r--sys/arch/hp300/stand/common/nhpib.c208
-rw-r--r--sys/arch/hp300/stand/common/scsi.c414
-rw-r--r--sys/arch/hp300/stand/common/sd.c260
-rw-r--r--sys/arch/hp300/stand/common/version.c33
-rw-r--r--sys/arch/hp300/stand/include/consdefs.h71
-rw-r--r--sys/arch/hp300/stand/include/device.h56
-rw-r--r--sys/arch/hp300/stand/include/grf_dvreg.h190
-rw-r--r--sys/arch/hp300/stand/include/grf_gbreg.h123
-rw-r--r--sys/arch/hp300/stand/include/grf_hyreg.h79
-rw-r--r--sys/arch/hp300/stand/include/grf_rbreg.h142
-rw-r--r--sys/arch/hp300/stand/include/grf_tcreg.h142
-rw-r--r--sys/arch/hp300/stand/include/hilreg.h150
-rw-r--r--sys/arch/hp300/stand/include/hpibvar.h102
-rw-r--r--sys/arch/hp300/stand/include/if_lereg.h159
-rw-r--r--sys/arch/hp300/stand/include/itereg.h52
-rw-r--r--sys/arch/hp300/stand/include/itevar.h136
-rw-r--r--sys/arch/hp300/stand/include/kbdvar.h63
-rw-r--r--sys/arch/hp300/stand/include/maskbits.h115
-rw-r--r--sys/arch/hp300/stand/include/rominfo.h65
-rw-r--r--sys/arch/hp300/stand/include/samachdep.h86
-rw-r--r--sys/arch/hp300/stand/include/scsireg.h483
-rw-r--r--sys/arch/hp300/stand/include/scsivar.h48
-rw-r--r--sys/arch/hp300/stand/include/volhdr.h78
-rw-r--r--sys/arch/hp300/stand/installboot/Makefile11
-rw-r--r--sys/arch/hp300/stand/installboot/installboot.sh27
-rw-r--r--sys/arch/hp300/stand/libsa/Makefile41
-rw-r--r--sys/arch/hp300/stand/libsa/devopen.c288
-rw-r--r--sys/arch/hp300/stand/libsa/exec_hp300.c60
-rw-r--r--sys/arch/hp300/stand/libsa/rawfs.c206
-rw-r--r--sys/arch/hp300/stand/libsa/rawfs.h16
-rw-r--r--sys/arch/hp300/stand/libsaz/Makefile13
-rw-r--r--sys/arch/hp300/stand/libz/Makefile14
-rw-r--r--sys/arch/hp300/stand/mkboot/Makefile13
-rw-r--r--sys/arch/hp300/stand/mkboot/mkboot.c277
-rw-r--r--sys/arch/hp300/stand/uboot/Makefile56
-rw-r--r--sys/arch/hp300/stand/uboot/clock.c156
-rw-r--r--sys/arch/hp300/stand/uboot/conf.c153
-rw-r--r--sys/arch/hp300/stand/uboot/netio.c179
-rw-r--r--sys/arch/hp300/stand/uboot/prf.c63
-rw-r--r--sys/arch/hp300/stand/uboot/srt0.S328
-rw-r--r--sys/arch/hp300/stand/uboot/tgets.c111
-rw-r--r--sys/arch/hp300/stand/uboot/uboot.c217
222 files changed, 0 insertions, 46898 deletions
diff --git a/sys/arch/hp300/Makefile b/sys/arch/hp300/Makefile
deleted file mode 100644
index 353fc02b06d..00000000000
--- a/sys/arch/hp300/Makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-# $OpenBSD: Makefile,v 1.13 2013/12/08 14:46:39 espie Exp $
-
-S= ${.CURDIR}/../..
-KFILE= GENERIC
-.if exists(conf/GENERIC.MP)
-KFILE= GENERIC.MP
-.endif
-TDIRS= ${_arch} include
-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/hp300/compile/.cvsignore b/sys/arch/hp300/compile/.cvsignore
deleted file mode 100644
index b72af3039e6..00000000000
--- a/sys/arch/hp300/compile/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-GENERIC
-RAMDISK
diff --git a/sys/arch/hp300/conf/GENERIC b/sys/arch/hp300/conf/GENERIC
deleted file mode 100644
index 2457542053a..00000000000
--- a/sys/arch/hp300/conf/GENERIC
+++ /dev/null
@@ -1,144 +0,0 @@
-# $OpenBSD: GENERIC,v 1.55 2011/12/21 23:12:03 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 hp300 m68k
-include "../../../conf/GENERIC"
-maxusers 32 # estimated number of users
-
-# Support for various CPU types
-option HP340
-option HP345
-option HP360
-option HP362
-option HP370
-option HP375
-option HP380
-option HP382
-option HP385
-option HP400
-option HP425
-option HP433
-
-# Options for HP hardware
-option USELEDS # make the lights twinkle
-#option CONSCODE="9" # force console at this select code for DIO
- # or DIO-II devices, or 256 + slot number
- # for SGC devices
-
-option WSDISPLAY_COMPAT_RAWKBD # provide raw scancodes; needed for X11
-
-# Verbose descriptions of unconfigured DIO devices
-# (Warning: this compiles in a large string table)
-option DIOVERBOSE # recognize "unknown" DIO devices
-
-config bsd swap generic
-
-mainbus0 at root # root "bus"
-
-intio0 at mainbus0 # internal i/o space
-dio0 at mainbus0 # DIO/DIO-II bus
-sgc0 at mainbus0 # SGC bus on some 4xx models
-
-# Human Interface Loop devices
-hil0 at intio? # HIL controller
-hilkbd* at hil? # keyboards
-wskbd* at hilkbd? mux 1
-hilms* at hil? # mice, buttons and tablets
-wsmouse* at hilms? mux 0
-hilid* at hil? # ID module
-
-# Frodo utility chip found on 382 and 4xx's
-frodo0 at intio?
-#isabr0 at frodo0 # ISA slot on some 4xx models
-
-# 8250-like serial ports found on Frodo ASIC
-dnkbd0 at frodo? # Domain keyboard flavor
-wskbd* at dnkbd? mux 1
-wsmouse* at dnkbd? mux 0
-apci* at frodo? # tty flavor
-
-# Davinci framebuffer
-dvbox* at intio?
-dvbox* at dio?
-wsdisplay* at dvbox?
-
-# Gatorbox framebuffer
-gbox* at intio?
-gbox* at dio?
-wsdisplay* at gbox?
-
-# Hyperion framebuffer
-hyper* at dio?
-wsdisplay* at hyper?
-
-# Renaissance framebuffer
-rbox* at intio?
-rbox* at dio?
-wsdisplay* at rbox?
-
-# Topcat/catseye framebuffers
-topcat* at intio?
-topcat* at dio?
-wsdisplay* at topcat?
-
-# TurboVRX framebuffer
-tvrx* at dio?
-wsdisplay* at tvrx?
-
-# 362/382 built-in framebuffer
-sti* at dio?
-wsdisplay* at sti?
-
-# SGC framebuffers
-sti* at sgc?
-#wsdisplay* at sti? # already done above
-
-dca0 at dio? scode 9 flags 1 # DCA serial interfaces
-dca* at dio?
-
-dcm* at dio? flags 0xe # DCM 4- or 8-port serial interfaces
-
-le* at dio? # LANCE ethernet interfaces
-
-nhpib0 at dio? scode 7 # slow internal HP-IB
-nhpib* at dio?
-
-fhpib* at dio? # `fast' HP-IB
-
-hpibbus0 at nhpib0
-hpibbus* at nhpib?
-hpibbus* at fhpib?
-
-hd* at hpibbus? # HP-IB disks
-ct* at hpibbus? # HP-IB cartridge tapes
-mt* at hpibbus? # HP-IB 9-track tape
-ppi0 at hpibbus0 slave 5 punit 0 # HP-IB plotter
-
-spc* at dio? flags 0x00 # SCSI controller
-
-scsibus* at scsi?
-sd* at scsibus? # SCSI disks
-st* at scsibus? # SCSI tapes
-cd* at scsibus? # SCSI CD-ROMs
-ch* at scsibus? # SCSI changer devices
-safte* at scsibus? # SCSI AF-TE
-ses* at scsibus? # SCSI enclosure services
-uk* at scsibus? # unknown SCSI devices
-
-# 425e digital audio
-arcofi* at dio?
-audio* at arcofi?
-
-# ISA devices
-#isa* at isabr?
-
-pseudo-device hotplug 1 # devices hot plugging
-pseudo-device wsmux 2 # mouse and keyboard multiplexor
diff --git a/sys/arch/hp300/conf/Makefile.hp300 b/sys/arch/hp300/conf/Makefile.hp300
deleted file mode 100644
index 7a5c51bfead..00000000000
--- a/sys/arch/hp300/conf/Makefile.hp300
+++ /dev/null
@@ -1,195 +0,0 @@
-# $OpenBSD: Makefile.hp300,v 1.83 2013/10/15 19:23:26 guenther 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 -D__${_mach}__ -MD -MP
-CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
- -Wno-main -Wno-uninitialized -Wno-format \
- -Wstack-larger-than-2047
-
-CMACHFLAGS= -msoft-float
-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 ${CWARNFLAGS} ${CMACHFLAGS}
-LINKFLAGS= -Ttext 0 -e start --warn-common -nopie
-
-.if ${IDENT:M-DDDB_STRUCT}
-DB_STRUCTINFO= db_structinfo.h
-.else
-DB_STRUCTINFO=
-.endif
-
-.if (${IDENT:M-DHP330} != "")
-_OPTIONS+= -DM68020
-.endif
-.if (${IDENT:M-DHP340} != "" || ${IDENT:M-DHP360} != "" || \
- ${IDENT:M-DHP362} != "")
-_OPTIONS+= -DM68030
-.endif
-.if (${IDENT:M-DHP345} != "" || ${IDENT:M-DHP370} != "" || \
- ${IDENT:M-DHP375} != "" || ${IDENT:M-DHP400} != "")
-_OPTIONS+= -DM68030
-CPPFLAGS+= -DCACHE_HAVE_PAC
-.endif
-.if (${IDENT:M-DHP380} != "" || ${IDENT:M-DHP382} != "" || \
- ${IDENT:M-DHP385} != "" || ${IDENT:M-DHP425} != "" || \
- ${IDENT:M-DHP433} != "")
-CPPFLAGS+= -DM68040 -DFPSP
-.endif
-.if ${_OPTIONS:M-DM68020} != ""
-CPPFLAGS+= -DM68020
-.endif
-.if ${_OPTIONS:M-DM68030} != ""
-CPPFLAGS+= -DM68030
-.endif
-
-.include "${_archdir}/fpsp/Makefile.inc"
-
-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 ${FPSP}
-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
-SYSTEM_LD_TAIL+=; \
- echo mv $@ $@.gdb; rm -f $@.gdb; mv $@ $@.gdb; \
- echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
- ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
-.else
-LINKFLAGS+= -S
-.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
-copy.o copypage.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}:
- rm -f /obsd
- ln /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/hp300/conf/RAMDISK b/sys/arch/hp300/conf/RAMDISK
deleted file mode 100644
index 25cc529b7ae..00000000000
--- a/sys/arch/hp300/conf/RAMDISK
+++ /dev/null
@@ -1,144 +0,0 @@
-# $OpenBSD: RAMDISK,v 1.34 2011/11/08 19:22:13 deraadt Exp $
-#
-# Ram disk kernel.
-#
-
-machine hp300 m68k
-
-# Support for various CPU types
-option HP340
-option HP345
-option HP360
-option HP362
-option HP370
-option HP375
-option HP380
-option HP382
-option HP385
-option HP400
-option HP425
-option HP433
-
-maxusers 32
-
-option TIMEZONE=0 # time zone to adjust RTC time by
-option DST=0 # daylight saving time used by RTC
-
-option FFS # UFS
-#option EXT2FS # Linux ext2fs
-
-option NFSCLIENT # Network File System client
-
-option CD9660 # ISO 9660 + Rock Ridge file system
-#option MSDOSFS # MS-DOS file system
-
-option INET # IP + ICMP + TCP + UDP
-
-option BOOT_CONFIG # add support for boot -c
-
-# Options for HP hardware
-option USELEDS # make the lights twinkle
-#option CONSCODE="9" # force console at this select code for DIO
- # or DIO-II devices, or 256 + slot number
- # for SGC devices
-
-# Verbose descriptions of unconfigured DIO devices
-# (Warning: this compiles in a large string table)
-option DIOVERBOSE # recognize "unknown" DIO devices
-
-# Options for the ramdisk.
-option MINIROOTSIZE=4096
-option RAMDISK_HOOKS
-
-config bsd root on rd0a swap on rd0b and hd0b and sd0b
-
-mainbus0 at root # root "bus"
-
-intio0 at mainbus0 # internal i/o space
-dio0 at mainbus0 # DIO/DIO-II bus
-sgc0 at mainbus0 # SGC bus on some 4xx models
-
-# Human Interface Loop devices
-hil0 at intio? # HIL controller
-hilkbd* at hil? # keyboards
-wskbd* at hilkbd? mux 1
-#hilms* at hil? # mice, buttons and tablets
-#wsmouse* at hilms? mux 0
-#hilid* at hil? # ID module
-
-# Frodo utility chip found on 382 and 4xx's
-frodo0 at intio?
-
-# 8250-like serial ports found on Frodo ASIC
-dnkbd0 at frodo? # Domain keyboard flavor
-wskbd* at dnkbd? mux 1
-#wsmouse* at dnkbd? mux 0
-apci* at frodo? # tty flavor
-
-# Davinci framebuffer
-dvbox* at intio?
-dvbox* at dio?
-wsdisplay* at dvbox?
-
-# Gatorbox framebuffer
-gbox* at intio?
-gbox* at dio?
-wsdisplay* at gbox?
-
-# Hyperion framebuffer
-hyper* at dio?
-wsdisplay* at hyper?
-
-# Renaissance framebuffer
-rbox* at intio?
-rbox* at dio?
-wsdisplay* at rbox?
-
-# Topcat/catseye framebuffers
-topcat* at intio?
-topcat* at dio?
-wsdisplay* at topcat?
-
-# TurboVRX framebuffer
-tvrx* at dio?
-wsdisplay* at tvrx?
-
-# 362/382 built-in framebuffer
-sti* at dio?
-wsdisplay* at sti?
-
-# SGC framebuffers
-sti* at sgc?
-#wsdisplay* at sti? # already done above
-
-dca0 at dio? scode 9 flags 1 # DCA serial interfaces
-dca* at dio?
-
-dcm* at dio? flags 0xe # DCM 4- or 8-port serial interfaces
-
-le* at dio? # LANCE ethernet interfaces
-
-nhpib0 at dio? scode 7 # slow internal HP-IB
-nhpib* at dio?
-
-fhpib* at dio? # `fast' HP-IB
-
-hpibbus0 at nhpib0
-hpibbus* at nhpib?
-hpibbus* at fhpib?
-
-hd* at hpibbus? # HP-IB disks
-ct* at hpibbus? # HP-IB cartridge tapes
-mt* at hpibbus? # HP-IB 9-track tape
-
-spc* at dio? flags 0x00 # SCSI controller
-
-scsibus* at scsi?
-sd* at scsibus? # SCSI disks
-st* at scsibus? # SCSI tapes
-cd* at scsibus? # SCSI CD-ROMs
-
-pseudo-device loop 1 # network loopback
-pseudo-device pty 16 # pseudo-terminals
-pseudo-device bpfilter 1 # packet filter
-pseudo-device rd 1 # ramdisk
diff --git a/sys/arch/hp300/conf/files.hp300 b/sys/arch/hp300/conf/files.hp300
deleted file mode 100644
index 99c49a44621..00000000000
--- a/sys/arch/hp300/conf/files.hp300
+++ /dev/null
@@ -1,227 +0,0 @@
-# $OpenBSD: files.hp300,v 1.36 2013/09/24 20:10:42 miod Exp $
-# $NetBSD: files.hp300,v 1.28 1997/05/12 08:23:28 thorpej Exp $
-#
-# hp300-specific configuration info
-
-# maxpartitions must be the first item in files.${ARCH}
-maxpartitions 16
-
-maxusers 2 8 64
-
-#
-# Mainbus
-#
-
-device mainbus {}
-attach mainbus at root
-
-#
-# Internal i/o space
-#
-
-device intio {}
-attach intio at mainbus
-file arch/hp300/dev/intio.c intio
-
-#
-# DIO bus
-#
-
-device dio {[scode = -1]}
-attach dio at mainbus
-file arch/hp300/dev/dio.c dio
-
-#
-# SGC bus
-#
-
-device sgc {[slot = -1]}
-attach sgc at mainbus
-file arch/hp300/dev/sgc.c sgc needs-flag
-
-#
-# Devices in Internal i/o space
-#
-
-# Apollo Utilility Chip (a.k.a. "Frodo") found on 4xx workstations
-device frodo {[offset = -1]}
-attach frodo at intio
-file arch/hp300/dev/frodo.c frodo
-
-# Apollo Keyboard and mouse
-device dnkbd: wskbddev, wsmousedev
-attach dnkbd at frodo
-file arch/hp300/dev/dnkbd.c dnkbd needs-flag
-file arch/hp300/dev/dnkbdmap.c dnkbd
-
-# Apollo APCI 8250-like UARTs
-device apci
-attach apci at frodo
-file arch/hp300/dev/apci.c apci needs-flag
-file arch/hp300/dev/apci_subr.c apci | dnkbd
-
-# "workstation console" routines
-include "dev/rasops/files.rasops"
-include "dev/wscons/files.wscons"
-include "dev/wsfont/files.wsfont"
-file arch/hp300/hp300/wscons_machdep.c wsdisplay
-
-#
-# Frame buffer devices
-#
-file arch/hp300/dev/sti_machdep.c sti
-
-define diofb
-define diofb_mono
-file arch/hp300/dev/diofb.c diofb | diofb_mono
-file arch/hp300/dev/diofb_mono.c diofb_mono
-
-device dvbox: wsemuldisplaydev, diofb, rasops8
-attach dvbox at intio with dvbox_intio
-attach dvbox at dio with dvbox_dio
-file arch/hp300/dev/dvbox.c dvbox needs-flag
-
-device gbox: wsemuldisplaydev, diofb, rasops8
-attach gbox at intio with gbox_intio
-attach gbox at dio with gbox_dio
-file arch/hp300/dev/gbox.c gbox needs-flag
-
-device hyper: wsemuldisplaydev, diofb_mono, rasops1
-attach hyper at dio
-file arch/hp300/dev/hyper.c hyper needs-flag
-
-device rbox: wsemuldisplaydev, diofb, rasops8
-attach rbox at intio with rbox_intio
-attach rbox at dio with rbox_dio
-file arch/hp300/dev/rbox.c rbox needs-flag
-
-attach sti at dio with sti_dio
-file arch/hp300/dev/sti_dio.c sti_dio
-
-device topcat: wsemuldisplaydev, diofb, rasops8
-attach topcat at intio with topcat_intio
-attach topcat at dio with topcat_dio
-file arch/hp300/dev/topcat.c topcat needs-flag
-
-device tvrx: wsemuldisplaydev, diofb_mono, rasops1
-attach tvrx at dio
-file arch/hp300/dev/tvrx.c tvrx needs-flag
-
-#
-# Other devices on the DIO bus
-#
-
-# DCA serial interface
-device dca: tty
-attach dca at dio
-file arch/hp300/dev/dca.c dca needs-flag
-
-# DCM serial interface
-device dcm: tty
-attach dcm at dio
-file arch/hp300/dev/dcm.c dcm needs-flag
-
-# LANCE ethernet
-attach le at dio: le24
-file arch/hp300/dev/if_le.c le
-
-# 425e digital audio
-attach arcofi at dio with arcofi_dio
-file arch/hp300/dev/arcofi_dio.c arcofi_dio
-
-# HP-IB interfaces
-define hpibdev {}
-
-device nhpib: hpibdev
-attach nhpib at dio
-file arch/hp300/dev/nhpib.c nhpib
-
-device fhpib: hpibdev
-attach fhpib at dio
-file arch/hp300/dev/fhpib.c fhpib
-
-# HP-IB bus layer
-device hpibbus {[slave = -1], [punit = -1]}
-attach hpibbus at hpibdev
-file arch/hp300/dev/hpib.c hpibbus
-
-# HP-IB devices
-device ct: tape
-attach ct at hpibbus
-file arch/hp300/dev/ct.c ct needs-flag
-
-device mt: tape
-attach mt at hpibbus
-file arch/hp300/dev/mt.c mt needs-flag
-
-device hd: disk
-attach hd at hpibbus
-file arch/hp300/dev/hd.c hd needs-flag
-major {hd = 2}
-
-device ppi
-attach ppi at hpibbus
-file arch/hp300/dev/ppi.c ppi needs-flag
-
-# RAM disk
-major {rd = 8}
-
-# SCSI devices
-include "scsi/files.scsi"
-
-device spc: scsi
-attach spc at dio
-file arch/hp300/dev/spc.c spc needs-flag
-file arch/hp300/dev/mb89352.c spc
-
-major {sd = 4}
-major {cd = 9}
-
-#
-# Devices on the SGC bus
-#
-
-attach sti at sgc with sti_sgc
-file arch/hp300/dev/sti_sgc.c sti_sgc
-
-# ISA devices
-include "dev/isa/files.isa"
-include "dev/isa/files.isapnp"
-
-#
-# ISA bridge
-#
-
-device isabr: isabus
-attach isabr at frodo
-file arch/hp300/dev/isabr.c isabr needs-flag
-
-#
-# HIL Human Interface Loop devices
-#
-include "dev/hil/files.hil"
-
-attach hil at intio with hil_intio
-file arch/hp300/dev/hil_intio.c hil_intio
-
-#
-# Non-device files
-#
-
-file arch/hp300/hp300/autoconf.c
-file arch/hp300/hp300/bus_space.c
-file arch/hp300/hp300/clock.c
-file arch/hp300/hp300/conf.c
-file arch/hp300/hp300/db_memrw.c ddb | kgdb
-file arch/hp300/hp300/disksubr.c
-file arch/hp300/hp300/kgdb_machdep.c kgdb
-file arch/hp300/hp300/machdep.c
-file arch/hp300/hp300/intr.c
-file arch/hp300/hp300/leds.c useleds
-file arch/hp300/hp300/mem.c
-file arch/m68k/m68k/pmap_motorola.c
-file arch/hp300/hp300/pmap_bootstrap.c
-file arch/hp300/hp300/sys_machdep.c
-file arch/hp300/hp300/trap.c
-file arch/hp300/hp300/vm_machdep.c
-file arch/hp300/dev/dma.c
diff --git a/sys/arch/hp300/dev/Makefile b/sys/arch/hp300/dev/Makefile
deleted file mode 100644
index 683bed14833..00000000000
--- a/sys/arch/hp300/dev/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 1997/02/03 04:47:10 downsj Exp $
-# $NetBSD: Makefile,v 1.2 1997/01/30 09:18:33 thorpej Exp $
-
-AWK= awk
-
-diodevs.h diodevs_data.h: diodevs devlist2h.awk
- /bin/rm -f diodevs.h diodevs_data.h
- ${AWK} -f devlist2h.awk diodevs
diff --git a/sys/arch/hp300/dev/apci.c b/sys/arch/hp300/dev/apci.c
deleted file mode 100644
index 6bc333b4f4d..00000000000
--- a/sys/arch/hp300/dev/apci.c
+++ /dev/null
@@ -1,978 +0,0 @@
-/* $OpenBSD: apci.c,v 1.41 2010/07/02 17:27:01 nicm Exp $ */
-/* $NetBSD: apci.c,v 1.9 2000/11/02 00:35:05 eeh Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997, 1999 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 Michael Smith. All rights reserved.
- * Copyright (c) 1982, 1986, 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.
- *
- * @(#)dca.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * Device driver for the APCI 8250-like UARTs found on the Apollo
- * Utility Chip on HP 9000/400-series workstations.
- *
- * There are 4 APCI UARTs on the Frodo ASIC. The first one
- * is used to communicate with the Domain keyboard. The second
- * one is the serial console port when the firmware is in Domain/OS
- * mode, and is mapped to select code 9 by the HP-UX firmware (except
- * on 425e models).
- *
- * We don't bother attaching a tty to the first UART; it lacks modem/flow
- * control, and is directly connected to the keyboard connector anyhow.
- */
-
-/*
- * XXX This driver is very similar to the dca driver, and much
- * XXX more code could be shared. (Currently, no code is shared.)
- * XXX FIXME!
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.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>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-
-#include <dev/cons.h>
-
-#include <hp300/dev/dioreg.h> /* to check for dca at 9 */
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-
-#include <hp300/dev/frodoreg.h>
-#include <hp300/dev/frodovar.h>
-#include <hp300/dev/apcireg.h>
-#include <hp300/dev/apcivar.h>
-#include <hp300/dev/dcareg.h> /* register bit definitions */
-
-#ifdef DDB
-#include <ddb/db_var.h>
-#endif
-
-struct apci_softc {
- struct device sc_dev; /* generic device glue */
- struct isr sc_isr;
- struct apciregs *sc_apci; /* device registers */
- struct tty *sc_tty; /* tty glue */
- struct timeout sc_timeout; /* timeout */
- int sc_ferr,
- sc_perr,
- sc_oflow,
- sc_toterr; /* stats */
- int sc_flags;
- u_char sc_cua; /* callout mode */
-};
-
-/* sc_flags */
-#define APCI_HASFIFO 0x01 /* unit has a fifo */
-#define APCI_ISCONSOLE 0x02 /* unit is console */
-#define APCI_SOFTCAR 0x04 /* soft carrier */
-
-int apcimatch(struct device *, void *, void *);
-void apciattach(struct device *, struct device *, void *);
-
-struct cfattach apci_ca = {
- sizeof(struct apci_softc), apcimatch, apciattach
-};
-
-struct cfdriver apci_cd = {
- NULL, "apci", DV_TTY
-};
-
-int apciintr(void *);
-void apcieint(struct apci_softc *, int);
-void apcimint(struct apci_softc *, u_char);
-int apciparam(struct tty *, struct termios *);
-void apcistart(struct tty *);
-int apcimctl(struct apci_softc *, int, int);
-void apcitimeout(void *);
-
-cdev_decl(apci);
-
-#define APCIUNIT(x) (minor(x) & 0x7f)
-#define APCICUA(x) (minor(x) & 0x80)
-
-int apcidefaultrate = TTYDEF_SPEED;
-
-/*
- * Console support.
- */
-struct apciregs *apci_cn = NULL; /* console hardware */
-int apciconsinit; /* has been initialized */
-int apcimajor; /* our major number */
-
-cons_decl(apci);
-
-int
-apcimatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct frodo_attach_args *fa = aux;
-
- /* Looking for an apci? */
- if (strcmp(fa->fa_name, apci_cd.cd_name) != 0)
- return (0);
-
- /* Are we checking a valid APCI offset? */
- switch (fa->fa_offset) {
- case FRODO_APCI_OFFSET(1):
- case FRODO_APCI_OFFSET(2):
- case FRODO_APCI_OFFSET(3):
- /* Yup, we exist! */
- return (1);
- }
-
- return (0);
-}
-
-void
-apciattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct apci_softc *sc = (struct apci_softc *)self;
- struct apciregs *apci;
- struct frodo_attach_args *fa = aux;
-
- sc->sc_apci = apci =
- (struct apciregs *)IIOV(FRODO_BASE + fa->fa_offset);
- sc->sc_flags = 0;
-
- /* Initialize timeout structure */
- timeout_set(&sc->sc_timeout, apcitimeout, sc);
-
- /* Are we the console? */
- if (apci == apci_cn) {
- sc->sc_flags |= APCI_ISCONSOLE;
- delay(100000);
-
- /*
- * We didn't know which unit this would be during
- * the console probe, so we have to fixup cn_dev here.
- */
- cn_tab->cn_dev = makedev(apcimajor, self->dv_unit);
- }
-
- /* Look for a FIFO. */
- apci->ap_fifo = FIFO_ENABLE|FIFO_RCV_RST|FIFO_XMT_RST|FIFO_TRIGGER_14;
- delay(100);
- if ((apci->ap_iir & IIR_FIFO_MASK) == IIR_FIFO_MASK)
- sc->sc_flags |= APCI_HASFIFO;
-
- /* Establish our interrupt handler. */
- sc->sc_isr.isr_func = apciintr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_priority = IPL_TTY;
- frodo_intr_establish(parent, fa->fa_line, &sc->sc_isr, self->dv_xname);
-
- /* Set soft carrier if requested by operator. */
- if (self->dv_cfdata->cf_flags)
- sc->sc_flags |= APCI_SOFTCAR;
-
- /*
- * Need to reset baud rate, etc. of next print, so reset apciconsinit.
- * Also make sure console is always "hardwired".
- */
- if (sc->sc_flags & APCI_ISCONSOLE) {
- apciconsinit = 0;
- sc->sc_flags |= APCI_SOFTCAR;
- printf(": console, ");
- } else
- printf(": ");
-
- if (sc->sc_flags & APCI_HASFIFO)
- printf("working fifo\n");
- else
- printf("no fifo\n");
-}
-
-/* ARGSUSED */
-int
-apciopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int unit = APCIUNIT(dev);
- struct apci_softc *sc;
- struct tty *tp;
- struct apciregs *apci;
- u_char code;
- int s, error = 0;
-
- if (unit >= apci_cd.cd_ndevs ||
- (sc = apci_cd.cd_devs[unit]) == NULL)
- return (ENXIO);
-
- apci = sc->sc_apci;
-
- s = spltty();
- if (sc->sc_tty == NULL) {
- tp = sc->sc_tty = ttymalloc(0);
- } else
- tp = sc->sc_tty;
- splx(s);
-
- tp->t_oproc = apcistart;
- tp->t_param = apciparam;
- tp->t_dev = dev;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
- /*
- * Sanity clause: reset the chip on first open.
- * The chip might be left in an inconsistent state
- * if it is read inadventently.
- */
- apciinit(apci, apcidefaultrate, CFCR_8BITS);
-
- tp->t_state |= TS_WOPEN;
- 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 = apcidefaultrate;
-
- s = spltty();
-
- apciparam(tp, &tp->t_termios);
- ttsetwater(tp);
-
- /* Set the FIFO threshold based on the receive speed. */
- if (sc->sc_flags & APCI_HASFIFO)
- apci->ap_fifo = FIFO_ENABLE | FIFO_RCV_RST |
- FIFO_XMT_RST |
- (tp->t_ispeed <= 1200 ? FIFO_TRIGGER_1 :
- FIFO_TRIGGER_14);
-
- /* Flush any pending I/O. */
- while ((apci->ap_iir & IIR_IMASK) == IIR_RXRDY)
- code = apci->ap_data;
- } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0)
- return (EBUSY);
- else
- s = spltty();
-
- /* Set the modem control state. */
- (void) apcimctl(sc, MCR_DTR | MCR_RTS, DMSET);
-
- /* Set soft-carrier if so configured. */
- if ((sc->sc_flags & APCI_SOFTCAR) || APCICUA(dev) ||
- (apcimctl(sc, 0, DMGET) & MSR_DCD))
- tp->t_state |= TS_CARR_ON;
-
- if (APCICUA(dev)) {
- if (tp->t_state & TS_ISOPEN) {
- /* Ah, but someone already is dialed in... */
- splx(s);
- return (EBUSY);
- }
- sc->sc_cua = 1; /* We go into CUA mode */
- }
-
- /* Wait for carrier if necessary. */
- if (flag & O_NONBLOCK) {
- if (!APCICUA(dev) && sc->sc_cua) {
- /* Opening TTY non-blocking... but the CUA is busy */
- splx(s);
- return (EBUSY);
- }
- } else {
- while (sc->sc_cua ||
- ((tp->t_cflag & CLOCAL) == 0 &&
- (tp->t_state & TS_CARR_ON) == 0)) {
- tp->t_state |= TS_WOPEN;
- error = ttysleep(tp, (caddr_t)&tp->t_rawq,
- TTIPRI | PCATCH, ttopen, 0);
- if (!APCICUA(dev) && sc->sc_cua && error == EINTR)
- continue;
- if (error) {
- if (APCICUA(dev))
- sc->sc_cua = 0;
- splx(s);
- return (error);
- }
- if (!APCICUA(dev) && sc->sc_cua)
- continue;
- }
- }
-
- splx(s);
-
- if (error == 0)
- error = (*linesw[tp->t_line].l_open)(dev, tp, p);
-
- if (error == 0) {
- /* clear errors, start timeout */
- sc->sc_ferr = sc->sc_perr = sc->sc_oflow = sc->sc_toterr = 0;
- timeout_add_sec(&sc->sc_timeout, 1);
- }
-
- return (error);
-}
-
-/* ARGSUSED */
-int
-apciclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct apci_softc *sc;
- struct tty *tp;
- struct apciregs *apci;
- int unit = APCIUNIT(dev);
- int s;
-
- sc = apci_cd.cd_devs[unit];
- apci = sc->sc_apci;
- tp = sc->sc_tty;
-
- (*linesw[tp->t_line].l_close)(tp, flag, p);
-
- s = spltty();
-
- apci->ap_cfcr &= ~CFCR_SBREAK;
- apci->ap_ier = 0;
- if (tp->t_cflag & HUPCL && (sc->sc_flags & APCI_SOFTCAR) == 0) {
- /* XXX perhaps only clear DTR */
- (void) apcimctl(sc, 0, DMSET);
- }
- tp->t_state &= ~(TS_BUSY | TS_FLUSH);
- sc->sc_cua = 0;
- splx(s);
- ttyclose(tp);
-#if 0
- ttyfree(tp);
- sc->sc_tty = NULL;
-#endif
- return (0);
-}
-
-int
-apciread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct apci_softc *sc = apci_cd.cd_devs[APCIUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-apciwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct apci_softc *sc = apci_cd.cd_devs[APCIUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-struct tty *
-apcitty(dev)
- dev_t dev;
-{
- struct apci_softc *sc = apci_cd.cd_devs[APCIUNIT(dev)];
-
- return (sc->sc_tty);
-}
-
-int
-apciintr(arg)
- void *arg;
-{
- struct apci_softc *sc = arg;
- struct apciregs *apci = sc->sc_apci;
- struct tty *tp = sc->sc_tty;
- u_char iir, lsr, c;
- int iflowdone = 0, claimed = 0;
-
-#define RCVBYTE() \
- c = apci->ap_data; \
- if (tp != NULL && (tp->t_state & TS_ISOPEN) != 0) \
- (*linesw[tp->t_line].l_rint)(c, tp)
-
- for (;;) {
- iir = apci->ap_iir; /* get UART status */
-
- switch (iir & IIR_IMASK) {
- case IIR_RLS:
- apcieint(sc, apci->ap_lsr);
- break;
-
- case IIR_RXRDY:
- case IIR_RXTOUT:
- RCVBYTE();
- if (sc->sc_flags & APCI_HASFIFO) {
- while ((lsr = apci->ap_lsr) & LSR_RCV_MASK) {
- if (lsr == LSR_RXRDY) {
- RCVBYTE();
- } else
- apcieint(sc, lsr);
- }
- }
- if (iflowdone == 0 && tp != NULL &&
- (tp->t_cflag & CRTS_IFLOW) &&
- tp->t_rawq.c_cc > (TTYHOG(tp) / 2)) {
- apci->ap_mcr &= ~MCR_RTS;
- iflowdone = 1;
- }
- break;
-
- case IIR_TXRDY:
- if (tp != NULL) {
- tp->t_state &=~ (TS_BUSY|TS_FLUSH);
- if (tp->t_line)
- (*linesw[tp->t_line].l_start)(tp);
- else
- apcistart(tp);
- }
- break;
-
- default:
- if (iir & IIR_NOPEND)
- return (claimed);
- log(LOG_WARNING, "%s: weird interrupt: 0x%x\n",
- sc->sc_dev.dv_xname, iir);
- /* FALLTHROUGH */
-
- case IIR_MLSC:
- apcimint(sc, apci->ap_msr);
- break;
- }
-
- claimed = 1;
- }
-}
-
-void
-apcieint(sc, stat)
- struct apci_softc *sc;
- int stat;
-{
- struct tty *tp = sc->sc_tty;
- struct apciregs *apci = sc->sc_apci;
- int c;
-
- c = apci->ap_data;
-
-#ifdef DDB
- if ((sc->sc_flags & APCI_ISCONSOLE) && db_console && (stat & LSR_BI)) {
- Debugger();
- return;
- }
-#endif
-
- if (tp == NULL || (tp->t_state & TS_ISOPEN) == 0)
- return;
-
- if (stat & (LSR_BI | LSR_FE)) {
- c |= TTY_FE;
- sc->sc_ferr++;
- } else if (stat & LSR_PE) {
- c |= TTY_PE;
- sc->sc_perr++;
- } else if (stat & LSR_OE)
- sc->sc_oflow++;
- (*linesw[tp->t_line].l_rint)(c, tp);
-}
-
-void
-apcimint(sc, stat)
- struct apci_softc *sc;
- u_char stat;
-{
- struct tty *tp = sc->sc_tty;
- struct apciregs *apci = sc->sc_apci;
-
- if (tp == NULL)
- return;
-
- if ((stat & MSR_DDCD) &&
- (sc->sc_flags & APCI_SOFTCAR) == 0) {
- if (stat & MSR_DCD)
- (void)(*linesw[tp->t_line].l_modem)(tp, 1);
- else if ((*linesw[tp->t_line].l_modem)(tp, 0) == 0)
- apci->ap_mcr &= ~(MCR_DTR | MCR_RTS);
- }
-
- /*
- * CTS change.
- * If doing HW output flow control, start/stop output as appropriate.
- */
- if ((stat & MSR_DCTS) &&
- (tp->t_state & TS_ISOPEN) && (tp->t_cflag & CCTS_OFLOW)) {
- if (stat & MSR_CTS) {
- tp->t_state &=~ TS_TTSTOP;
- apcistart(tp);
- } else
- tp->t_state |= TS_TTSTOP;
- }
-}
-
-int
-apciioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct apci_softc *sc = apci_cd.cd_devs[APCIUNIT(dev)];
- struct tty *tp = sc->sc_tty;
- struct apciregs *apci = sc->sc_apci;
- 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);
-
- switch (cmd) {
- case TIOCSBRK:
- apci->ap_cfcr |= CFCR_SBREAK;
- break;
-
- case TIOCCBRK:
- apci->ap_cfcr &= ~CFCR_SBREAK;
- break;
-
- case TIOCSDTR:
- (void) apcimctl(sc, MCR_DTR | MCR_RTS, DMBIS);
- break;
-
- case TIOCCDTR:
- (void) apcimctl(sc, MCR_DTR | MCR_RTS, DMBIC);
- break;
-
- case TIOCMSET:
- (void) apcimctl(sc, *(int *)data, DMSET);
- break;
-
- case TIOCMBIS:
- (void) apcimctl(sc, *(int *)data, DMBIS);
- break;
-
- case TIOCMBIC:
- (void) apcimctl(sc, *(int *)data, DMBIC);
- break;
-
- case TIOCMGET:
- *(int *)data = apcimctl(sc, 0, DMGET);
- break;
-
- case TIOCGFLAGS: {
- int bits = 0;
-
- if (sc->sc_flags & APCI_SOFTCAR)
- bits |= TIOCFLAG_SOFTCAR;
-
- if (tp->t_cflag & CLOCAL)
- bits |= TIOCFLAG_CLOCAL;
-
- *(int *)data = bits;
- break;
- }
-
- case TIOCSFLAGS: {
- int userbits;
-
- error = suser(p, 0);
- if (error)
- return (EPERM);
-
- userbits = *(int *)data;
-
- if ((userbits & TIOCFLAG_SOFTCAR) ||
- (sc->sc_flags & APCI_ISCONSOLE))
- sc->sc_flags |= APCI_SOFTCAR;
-
- if (userbits & TIOCFLAG_CLOCAL)
- tp->t_cflag |= CLOCAL;
-
- break;
- }
-
- default:
- return (ENOTTY);
- }
- return (0);
-}
-
-int
-apciparam(tp, t)
- struct tty *tp;
- struct termios *t;
-{
- struct apci_softc *sc = apci_cd.cd_devs[APCIUNIT(tp->t_dev)];
- struct apciregs *apci = sc->sc_apci;
- int cfcr, cflag = t->c_cflag;
- int ospeed = ttspeedtab(t->c_ospeed, apcispeedtab);
- int s;
-
- /* check requested parameters */
- if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed))
- return (EINVAL);
-
- switch (cflag & CSIZE) {
- case CS5:
- cfcr = CFCR_5BITS;
- break;
-
- case CS6:
- cfcr = CFCR_6BITS;
- break;
-
- case CS7:
- cfcr = CFCR_7BITS;
- break;
-
- case CS8:
- default: /* XXX gcc whines about cfcr being uninitialized... */
- cfcr = CFCR_8BITS;
- break;
- }
- if (cflag & PARENB) {
- cfcr |= CFCR_PENAB;
- if ((cflag & PARODD) == 0)
- cfcr |= CFCR_PEVEN;
- }
- if (cflag & CSTOPB)
- cfcr |= CFCR_STOPB;
-
- s = spltty();
-
- if (ospeed == 0)
- (void) apcimctl(sc, 0, DMSET); /* hang up line */
-
- /*
- * Set the FIFO threshold based on the receive speed, if we
- * are changing it.
- */
- if (tp->t_ispeed != t->c_ispeed) {
- if (sc->sc_flags & APCI_HASFIFO)
- apci->ap_fifo = FIFO_ENABLE |
- (t->c_ispeed <= 1200 ? FIFO_TRIGGER_1 :
- FIFO_TRIGGER_14);
- }
-
- if (ospeed != 0) {
- apci->ap_cfcr |= CFCR_DLAB;
- apci->ap_data = ospeed & 0xff;
- apci->ap_ier = (ospeed >> 8) & 0xff;
- apci->ap_cfcr = cfcr;
- } else
- apci->ap_cfcr = cfcr;
-
- /* and copy to tty */
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = cflag;
-
- apci->ap_ier = IER_ERXRDY | IER_ETXRDY | IER_ERLS | IER_EMSC;
-
- splx(s);
- return (0);
-}
-
-void
-apcistart(tp)
- struct tty *tp;
-{
- struct apci_softc *sc = apci_cd.cd_devs[APCIUNIT(tp->t_dev)];
- struct apciregs *apci = sc->sc_apci;
- int s, c;
-
- s = spltty();
-
- if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP))
- goto out;
- ttwakeupwr(tp);
- if (tp->t_outq.c_cc == 0)
- goto out;
- if (apci->ap_lsr & LSR_TXRDY) {
- tp->t_state |= TS_BUSY;
- if (sc->sc_flags & APCI_HASFIFO) {
- for (c = 0; c < 16 && tp->t_outq.c_cc; ++c)
- apci->ap_data = getc(&tp->t_outq);
- } else
- apci->ap_data = getc(&tp->t_outq);
- }
-
- out:
- splx(s);
-}
-
-/*
- * Stop output on a line.
- */
-/* ARGSUSED */
-int
-apcistop(tp, flag)
- 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
-apcimctl(sc, bits, how)
- struct apci_softc *sc;
- int bits, how;
-{
- struct apciregs *apci = sc->sc_apci;
- int s;
-
- s = spltty();
-
- switch (how) {
- case DMSET:
- apci->ap_mcr = bits;
- break;
-
- case DMBIS:
- apci->ap_mcr |= bits;
- break;
-
- case DMBIC:
- apci->ap_mcr &= ~bits;
- break;
-
- case DMGET:
- bits = apci->ap_msr;
- break;
- }
-
- splx(s);
- return (bits);
-}
-
-void
-apcitimeout(arg)
- void *arg;
-{
- struct apci_softc *sc = arg;
- int ferr, perr, oflow, s;
-
- if (sc->sc_tty == NULL ||
- (sc->sc_tty->t_state & TS_ISOPEN) == 0)
- return;
-
- /* Log any errors. */
- if (sc->sc_ferr || sc->sc_perr || sc->sc_oflow) {
- s = spltty(); /* XXX necessary? */
- ferr = sc->sc_ferr;
- perr = sc->sc_perr;
- oflow = sc->sc_oflow;
- sc->sc_ferr = sc->sc_perr = sc->sc_oflow = 0;
- splx(s);
- sc->sc_toterr += ferr + perr + oflow;
- log(LOG_WARNING,
- "%s: %d frame, %d parity, %d overflow, %d total errors\n",
- sc->sc_dev.dv_xname, ferr, perr, oflow, sc->sc_toterr);
- }
-
- timeout_add_sec(&sc->sc_timeout, 1);
-}
-
-/*
- * The following routines are required for the APCI to act as the console.
- */
-
-void
-apcicnprobe(cp)
- struct consdev *cp;
-{
- volatile u_int8_t *frodoregs;
-
- /* locate the major number */
- for (apcimajor = 0; apcimajor < nchrdev; apcimajor++)
- if (cdevsw[apcimajor].d_open == apciopen)
- break;
-
- /* initialize the required fields */
- cp->cn_dev = makedev(apcimajor, 0); /* XXX */
-
- /*
- * The APCI can only be a console on a 425e; on other 4xx
- * models, the "first" serial port is mapped to the DCA
- * at select code 9. See frodo.c for the autoconfiguration
- * version of this check.
- */
- if (machineid != HP_425 || mmuid != MMUID_425_E)
- return;
-
- /*
- * Check the service switch. On the 425e, this is a physical
- * switch, unlike other frodo-based machines, so we can use it
- * as a serial vs internal video selector, since the PROM can not
- * be configured for serial console.
- */
- frodoregs = (volatile u_int8_t *)IIOV(FRODO_BASE);
- if (badaddr((caddr_t)frodoregs) == 0 &&
- !ISSET(frodoregs[FRODO_IISR], FRODO_IISR_SERVICE))
- cp->cn_pri = CN_HIGHPRI;
- else
- cp->cn_pri = CN_LOWPRI;
-
- /*
- * If our priority is higher than the currently-remembered
- * console, install ourselves.
- */
- if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) {
- cn_tab = cp;
- conscode = CONSCODE_INVALID;
- }
-}
-
-/* ARGSUSED */
-void
-apcicninit(cp)
- struct consdev *cp;
-{
-
- /*
- * We are not interested by the second console pass.
- */
- if (consolepass != 0)
- return;
-
- apci_cn = (struct apciregs *)IIOV(FRODO_BASE + FRODO_APCI_OFFSET(1));
- apciinit(apci_cn, apcidefaultrate, CFCR_8BITS);
- apciconsinit = 1;
-}
-
-/* ARGSUSED */
-int
-apcicngetc(dev)
- dev_t dev;
-{
- u_char stat;
- int c, s;
-
- s = splhigh();
- while (((stat = apci_cn->ap_lsr) & LSR_RXRDY) == 0)
- ;
- c = apci_cn->ap_data;
-
- /* clear any interrupts generated by this transmission */
- stat = apci_cn->ap_iir;
- splx(s);
- return (c);
-}
-
-/* ARGSUSED */
-void
-apcicnputc(dev, c)
- dev_t dev;
- int c;
-{
- int timo;
- u_char stat;
- int s;
-
- s = splhigh();
-
- if (apciconsinit == 0) {
- apciinit(apci_cn, apcidefaultrate, CFCR_8BITS);
- apciconsinit = 1;
- }
-
- /* wait for any pending transmission to finish */
- timo = 50000;
- while (((stat = apci_cn->ap_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
-
- apci_cn->ap_data = c & 0xff;
-
- /* wait for this transmission to complete */
- timo = 1500000;
- while (((stat = apci_cn->ap_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
-
- /* clear any interrupts generated by this transmission */
- stat = apci_cn->ap_iir;
- splx(s);
-}
diff --git a/sys/arch/hp300/dev/apci_subr.c b/sys/arch/hp300/dev/apci_subr.c
deleted file mode 100644
index 76f86490172..00000000000
--- a/sys/arch/hp300/dev/apci_subr.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* $OpenBSD: apci_subr.c,v 1.2 2008/06/26 05:42:10 ray Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997, 1999 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 Michael Smith. All rights reserved.
- * Copyright (c) 1982, 1986, 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.
- *
- * @(#)dca.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * Routines shared by the apci and dnkbd drivers.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/tty.h>
-#include <sys/kernel.h>
-
-#include <hp300/dev/apcireg.h>
-#include <hp300/dev/apcivar.h>
-#include <hp300/dev/dcareg.h>
-
-const struct speedtab apcispeedtab[] = {
- { 0, 0 },
- { 50, APCIBRD(50) },
- { 75, APCIBRD(75) },
- { 110, APCIBRD(110) },
- { 134, APCIBRD(134) },
- { 150, APCIBRD(150) },
- { 200, APCIBRD(200) },
- { 300, APCIBRD(300) },
- { 600, APCIBRD(600) },
- { 1200, APCIBRD(1200) },
- { 1800, APCIBRD(1800) },
- { 2400, APCIBRD(2400) },
- { 4800, APCIBRD(4800) },
- { 9600, APCIBRD(9600) },
- { 19200, APCIBRD(19200) },
- { 38400, APCIBRD(38400) },
- { -1, -1 },
-};
-
-int
-apciinit(struct apciregs *apci, u_int16_t rate, u_int16_t cfcr)
-{
- int s, stat;
-
- s = splhigh();
-
- rate = ttspeedtab(rate, apcispeedtab);
-
- apci->ap_cfcr = CFCR_DLAB;
- apci->ap_data = rate & 0xff;
- apci->ap_ier = (rate >> 8) & 0xff;
- apci->ap_cfcr = cfcr;
- apci->ap_ier = IER_ERXRDY | IER_ETXRDY;
- apci->ap_fifo =
- FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1;
- apci->ap_mcr = MCR_DTR | MCR_RTS;
- delay(100);
- stat = apci->ap_iir;
- splx(s);
-
- return (stat);
-}
diff --git a/sys/arch/hp300/dev/apcireg.h b/sys/arch/hp300/dev/apcireg.h
deleted file mode 100644
index aab1b8e22ca..00000000000
--- a/sys/arch/hp300/dev/apcireg.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $OpenBSD: apcireg.h,v 1.2 1997/07/06 08:01:45 downsj Exp $ */
-/* $NetBSD: apcireg.h,v 1.2 1997/05/12 08:14:01 thorpej Exp $ */
-
-/*
- * Copyright (c) 1997 Michael Smith. 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 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 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.
- */
-
-#include <hp300/dev/iotypes.h>
-
-struct apciregs {
- vu_char ap_data;
- u_char pad0[3];
- vu_char ap_ier;
- u_char pad1[3];
- vu_char ap_iir;
-#define ap_fifo ap_iir
- u_char pad2[3];
- vu_char ap_cfcr;
- u_char pad3[3];
- vu_char ap_mcr;
- u_char pad4[3];
- vu_char ap_lsr;
- u_char pad5[3];
- vu_char ap_msr;
- u_char pad6[3];
- vu_char ap_scratch;
-};
-
-/* max number of apci ports */
-#define APCI_MAXPORT 4
-
-/*
- * baudrate divisor calculations.
- *
- * The input clock frequency appears to be 8.0064MHz, giving a scale
- * factor of 500400. (Using exactly 8MHz gives framing errors with
- * the Apollo keyboard.)
- */
-#define APCIBRD(x) (500000 / (x))
diff --git a/sys/arch/hp300/dev/apcivar.h b/sys/arch/hp300/dev/apcivar.h
deleted file mode 100644
index 84e44978f61..00000000000
--- a/sys/arch/hp300/dev/apcivar.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $OpenBSD: apcivar.h,v 1.2 2008/06/26 05:42:10 ray Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997, 1999 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 Michael Smith. All rights reserved.
- * Copyright (c) 1982, 1986, 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.
- *
- * @(#)dca.c 8.2 (Berkeley) 1/12/94
- */
-
-int apciinit(struct apciregs *, u_int16_t, u_int16_t);
-extern const struct speedtab apcispeedtab[];
diff --git a/sys/arch/hp300/dev/arcofi_dio.c b/sys/arch/hp300/dev/arcofi_dio.c
deleted file mode 100644
index 56b07af0137..00000000000
--- a/sys/arch/hp300/dev/arcofi_dio.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $OpenBSD: arcofi_dio.c,v 1.1 2011/12/21 23:12:03 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/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/intr.h>
-
-#include <sys/audioio.h>
-#include <dev/audio_if.h>
-#include <dev/ic/arcofivar.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-
-#include <hp300/dev/diodevs.h>
-
-void arcofi_dio_attach(struct device *, struct device *, void *);
-int arcofi_dio_match(struct device *, void *, void *);
-
-struct arcofi_dio_softc {
- struct arcofi_softc sc_arcofi;
-
- struct isr sc_isr;
-};
-
-const struct cfattach arcofi_dio_ca = {
- sizeof(struct arcofi_dio_softc),
- arcofi_dio_match,
- arcofi_dio_attach
-};
-
-extern struct hp300_bus_space_tag hp300_mem_tag; /* XXX */
-
-int
-arcofi_dio_match(struct device *parent, void *match, void *vaa)
-{
- struct dio_attach_args *da = vaa;
-
- if (da->da_id != DIO_DEVICE_ID_AUDIO)
- return 0;
-
- return 1;
-}
-
-void
-arcofi_dio_attach(struct device *parent, struct device *self, void *vaa)
-{
- struct arcofi_dio_softc *adsc = (struct arcofi_dio_softc *)self;
- struct arcofi_softc *sc = &adsc->sc_arcofi;
- struct dio_attach_args *da = vaa;
- bus_addr_t base;
- unsigned int u;
- int ipl;
-
- for (u = 0; u < ARCOFI_NREGS; u++)
- sc->sc_reg[u] = (u << 1) | 0x01;
-
- base = (bus_addr_t)dio_scodetopa(da->da_scode);
- sc->sc_iot = &hp300_mem_tag;
- /*
- * XXX We request BUS_SPACE_MAP_LINEAR only to be able to use DIO_IPL
- * XXX below; this ought to be provided in the attach_args
- */
- if (bus_space_map(sc->sc_iot, base, DIOII_SIZEOFF, BUS_SPACE_MAP_LINEAR,
- &sc->sc_ioh) != 0) {
- printf(": can't map registers\n");
- return;
- }
- ipl = DIO_IPL(bus_space_vaddr(sc->sc_iot, sc->sc_ioh));
-
- sc->sc_sih = softintr_establish(IPL_SOFT, &arcofi_swintr, sc);
- if (sc->sc_sih == NULL) {
- printf(": can't register soft interrupt\n");
- return;
- }
- adsc->sc_isr.isr_func = arcofi_hwintr;
- adsc->sc_isr.isr_arg = sc;
- adsc->sc_isr.isr_ipl = ipl;
- adsc->sc_isr.isr_priority = IPL_AUDIO;
- dio_intr_establish(&adsc->sc_isr, self->dv_xname);
-
- printf(" ipl %d\n", ipl);
-
- arcofi_attach(sc, "dio");
-}
diff --git a/sys/arch/hp300/dev/ct.c b/sys/arch/hp300/dev/ct.c
deleted file mode 100644
index 39d33097809..00000000000
--- a/sys/arch/hp300/dev/ct.c
+++ /dev/null
@@ -1,959 +0,0 @@
-/* $OpenBSD: ct.c,v 1.23 2013/06/11 16:42:07 deraadt Exp $ */
-/* $NetBSD: ct.c,v 1.21 1997/04/02 22:37:23 scottr Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ct.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * CS80 cartridge tape driver (9144, 88140, 9145)
- *
- * Reminder:
- * C_CC bit (character count option) when used in the CS/80 command
- * 'set options' will cause the tape not to stream.
- *
- * TODO:
- * make filesystem compatible
- * make block mode work according to mtio(4) spec. (if possible)
- * merge with cs80 disk driver
- * finish support of 9145
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/mtio.h>
-#include <sys/proc.h>
-
-#include <hp300/dev/hpibvar.h>
-
-#include <hp300/dev/ctreg.h>
-
-/* number of eof marks to remember */
-#define EOFS 128
-
-struct ct_softc {
- struct device sc_dev;
- int sc_slave; /* HP-IB slave ID */
- int sc_punit; /* physical unit */
- struct ct_iocmd sc_ioc;
- struct ct_rscmd sc_rsc;
- struct ct_stat sc_stat;
- struct ct_ssmcmd sc_ssmc;
- struct ct_srcmd sc_src;
- struct ct_soptcmd sc_soptc;
- struct ct_ulcmd sc_ul;
- struct ct_wfmcmd sc_wfm;
- struct ct_clearcmd sc_clear;
- struct buf sc_tab;
- struct buf *sc_bp;
- struct buf sc_bufstore; /* XXX */
- int sc_blkno;
- int sc_cmd;
- int sc_resid;
- char *sc_addr;
- int sc_flags;
- short sc_type;
- struct hpibqueue sc_hq; /* entry on hpib job queue */
- int sc_eofp;
- int sc_eofs[EOFS];
-};
-
-/* flags */
-#define CTF_OPEN 0x01
-#define CTF_ALIVE 0x02
-#define CTF_WRT 0x04
-#define CTF_CMD 0x08
-#define CTF_IO 0x10
-#define CTF_BEOF 0x20
-#define CTF_AEOF 0x40
-#define CTF_EOT 0x80
-#define CTF_STATWAIT 0x100
-#define CTF_CANSTREAM 0x200
-#define CTF_WRTTN 0x400
-
-int ctmatch(struct device *, void *, void *);
-void ctattach(struct device *, struct device *, void *);
-
-struct cfattach ct_ca = {
- sizeof(struct ct_softc), ctmatch, ctattach
-};
-
-struct cfdriver ct_cd = {
- NULL, "ct", DV_TAPE
-};
-
-int ctident(struct device *, struct ct_softc *,
- struct hpibbus_attach_args *);
-
-void ctreset(struct ct_softc *);
-void ctaddeof(struct ct_softc *);
-void ctustart(struct ct_softc *);
-void cteof(struct ct_softc *, struct buf *);
-void ctdone(struct ct_softc *, struct buf *);
-
-void ctstart(void *);
-void ctgo(void *);
-void ctintr(void *);
-
-void ctcommand(dev_t, int, int);
-
-cdev_decl(ct);
-bdev_decl(ct);
-
-const struct ctinfo {
- short hwid;
- short punit;
- char *desc;
-} ctinfo[] = {
- { CT7946ID, 1, "7946A" },
- { CT7912PID, 1, "7912P" },
- { CT7914PID, 1, "7914P" },
- { CT9144ID, 0, "9144" },
- { CT9145ID, 0, "9145" },
-};
-int nctinfo = sizeof(ctinfo) / sizeof(ctinfo[0]);
-
-#define CT_NOREW 4
-#define CT_STREAM 8
-#define UNIT(x) (minor(x) & 3)
-#define ctpunit(x) ((x) & 7)
-
-#ifdef DEBUG
-int ctdebug = 0;
-#define CDB_FILES 0x01
-#define CT_BSF 0x02
-#endif
-
-int
-ctmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct hpibbus_attach_args *ha = aux;
-
- return (ctident(parent, NULL, ha));
-}
-
-void
-ctattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct ct_softc *sc = (struct ct_softc *)self;
- struct hpibbus_attach_args *ha = aux;
-
- if (ctident(parent, sc, ha) == 0) {
- /* can't happen */
- printf("\n%s: didn't respond to describe command!\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- sc->sc_slave = ha->ha_slave;
- sc->sc_punit = ha->ha_punit;
-
- sc->sc_tab.b_actb = &sc->sc_tab.b_actf;
-
- /* Initialize hpib job queue entry. */
- sc->sc_hq.hq_softc = sc;
- sc->sc_hq.hq_slave = sc->sc_slave;
- sc->sc_hq.hq_start = ctstart;
- sc->sc_hq.hq_go = ctgo;
- sc->sc_hq.hq_intr = ctintr;
-
- ctreset(sc);
- sc->sc_flags |= CTF_ALIVE;
-}
-
-int
-ctident(parent, sc, ha)
- struct device *parent;
- struct ct_softc *sc;
- struct hpibbus_attach_args *ha;
-{
- struct cs80_describe desc;
- u_char stat, cmd[3];
- char name[7];
- int i, id, n, type, canstream;
-
- type = canstream = 0;
-
- /* Verify that we have a CS80 device. */
- if ((ha->ha_id & 0x200) == 0)
- return (0);
-
- /* Is it one of the tapes we support? */
- for (id = 0; id < nctinfo; id++)
- if (ha->ha_id == ctinfo[id].hwid &&
- ha->ha_punit == ctinfo[id].punit)
- break;
- if (id == nctinfo)
- return (0);
-
- /*
- * So far, so good. Get drive parameters. Note command
- * is always issued to unit 0.
- */
- bzero(&desc, sizeof(desc));
- stat = 0;
- cmd[0] = C_SUNIT(0);
- cmd[1] = C_SVOL(0);
- cmd[2] = C_DESC;
- hpibsend(parent->dv_unit, ha->ha_slave, C_CMD, cmd, sizeof(cmd));
- hpibrecv(parent->dv_unit, ha->ha_slave, C_EXEC, &desc, sizeof(desc));
- hpibrecv(parent->dv_unit, ha->ha_slave, C_QSTAT, &stat, sizeof(stat));
-
- if (desc.d_name == 0 && stat != 0)
- return (0);
-
- bzero(name, sizeof(name));
- n = desc.d_name;
- for (i = 5; i >= 0; i--) {
- name[i] = (n & 0xf) + '0';
- n >>= 4;
- }
-
- switch (ha->ha_id) {
- case CT7946ID:
- if (bcmp(name, "079450", 6) == 0)
- return (0); /* not really a 7946 */
- /* FALLTHROUGH */
- case CT9144ID:
- case CT9145ID:
- type = CT9144;
- canstream = 1;
- break;
-
- case CT7912PID:
- case CT7914PID:
- type = CT88140;
- break;
- }
-
- if (sc != NULL) {
- sc->sc_type = type;
- sc->sc_flags = canstream ? CTF_CANSTREAM : 0;
- printf(": %s %stape\n", ctinfo[id].desc,
- canstream ? "streaming " : "");
- }
-
- return (1);
-}
-
-void
-ctreset(sc)
- struct ct_softc *sc;
-{
- int ctlr, slave;
- u_char stat;
-
- ctlr = sc->sc_dev.dv_parent->dv_unit;
- slave = sc->sc_slave;
-
- sc->sc_clear.unit = C_SUNIT(sc->sc_punit);
- sc->sc_clear.cmd = C_CLEAR;
- hpibsend(ctlr, slave, C_TCMD, &sc->sc_clear, sizeof(sc->sc_clear));
- hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-
- sc->sc_src.unit = C_SUNIT(CTCTLR);
- sc->sc_src.nop = C_NOP;
- sc->sc_src.cmd = C_SREL;
- sc->sc_src.param = C_REL;
- hpibsend(ctlr, slave, C_CMD, &sc->sc_src, sizeof(sc->sc_src));
- hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-
- sc->sc_ssmc.unit = C_SUNIT(sc->sc_punit);
- sc->sc_ssmc.cmd = C_SSM;
- sc->sc_ssmc.refm = REF_MASK;
- sc->sc_ssmc.fefm = FEF_MASK;
- sc->sc_ssmc.aefm = AEF_MASK;
- sc->sc_ssmc.iefm = IEF_MASK;
- hpibsend(ctlr, slave, C_CMD, &sc->sc_ssmc, sizeof(sc->sc_ssmc));
- hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-
- sc->sc_soptc.unit = C_SUNIT(sc->sc_punit);
- sc->sc_soptc.nop = C_NOP;
- sc->sc_soptc.cmd = C_SOPT;
- sc->sc_soptc.opt = C_SPAR;
- hpibsend(ctlr, slave, C_CMD, &sc->sc_soptc, sizeof(sc->sc_soptc));
- hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-}
-
-/*ARGSUSED*/
-int
-ctopen(dev, flag, type, p)
- dev_t dev;
- int flag, type;
- struct proc *p;
-{
- struct ct_softc *sc;
- u_char stat;
- int cc, ctlr, slave;
-
- if (UNIT(dev) >= ct_cd.cd_ndevs ||
- (sc = ct_cd.cd_devs[UNIT(dev)]) == NULL ||
- (sc->sc_flags & CTF_ALIVE) == 0)
- return (ENXIO);
-
- if (sc->sc_flags & CTF_OPEN)
- return (EBUSY);
-
- ctlr = sc->sc_dev.dv_parent->dv_unit;
- slave = sc->sc_slave;
-
- sc->sc_soptc.unit = C_SUNIT(sc->sc_punit);
- sc->sc_soptc.nop = C_NOP;
- sc->sc_soptc.cmd = C_SOPT;
- if ((dev & CT_STREAM) && (sc->sc_flags & CTF_CANSTREAM))
- sc->sc_soptc.opt = C_SPAR | C_IMRPT;
- else
- sc->sc_soptc.opt = C_SPAR;
-
- /*
- * Check the return of hpibsend() and hpibswait().
- * Drive could be loading/unloading a tape. If not checked,
- * driver hangs.
- */
- cc = hpibsend(ctlr, slave, C_CMD, &sc->sc_soptc, sizeof(sc->sc_soptc));
- if (cc != sizeof(sc->sc_soptc))
- return (EBUSY);
-
- hpibswait(ctlr, slave);
- cc = hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
- if (cc != sizeof(stat))
- return(EBUSY);
-
- sc->sc_flags |= CTF_OPEN;
- return(0);
-}
-
-/*ARGSUSED*/
-int
-ctclose(dev, flag, fmt, p)
- dev_t dev;
- int flag, fmt;
- struct proc *p;
-{
- struct ct_softc *sc = ct_cd.cd_devs[UNIT(dev)];
-
- if ((sc->sc_flags & (CTF_WRT|CTF_WRTTN)) == (CTF_WRT|CTF_WRTTN) &&
- (sc->sc_flags & CTF_EOT) == 0 ) { /* XXX return error if EOT ?? */
- ctcommand(dev, MTWEOF, 2);
- ctcommand(dev, MTBSR, 1);
- if (sc->sc_eofp == EOFS - 1)
- sc->sc_eofs[EOFS - 1]--;
- else
- sc->sc_eofp--;
-#ifdef DEBUG
- if(ctdebug & CT_BSF)
- printf("%s: ctclose backup eofs prt %d blk %d\n",
- sc->sc_dev.dv_xname, sc->sc_eofp,
- sc->sc_eofs[sc->sc_eofp]);
-#endif
- }
- if ((minor(dev) & CT_NOREW) == 0)
- ctcommand(dev, MTREW, 1);
- sc->sc_flags &= ~(CTF_OPEN | CTF_WRT | CTF_WRTTN);
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("ctclose: flags %x\n", sc->sc_flags);
-#endif
- return(0); /* XXX */
-}
-
-void
-ctcommand(dev, cmd, cnt)
- dev_t dev;
- int cmd;
- int cnt;
-{
- struct ct_softc *sc = ct_cd.cd_devs[UNIT(dev)];
- struct buf *bp = &sc->sc_bufstore;
- struct buf *nbp = 0;
-
- if (cmd == MTBSF && sc->sc_eofp == EOFS - 1) {
- cnt = sc->sc_eofs[EOFS - 1] - cnt;
- ctcommand(dev, MTREW, 1);
- ctcommand(dev, MTFSF, cnt);
- cnt = 2;
- cmd = MTBSR;
- }
-
- if (cmd == MTBSF && sc->sc_eofp - cnt < 0) {
- cnt = 1;
- cmd = MTREW;
- }
-
- sc->sc_flags |= CTF_CMD;
- sc->sc_bp = bp;
- sc->sc_cmd = cmd;
- bp->b_dev = dev;
- if (cmd == MTFSF) {
- nbp = (struct buf *)geteblk(MAXBSIZE);
- bp->b_data = nbp->b_data;
- bp->b_bcount = MAXBSIZE;
- }
-
- while (cnt-- > 0) {
- bp->b_flags = B_BUSY | B_RAW;
- if (cmd == MTBSF) {
- sc->sc_blkno = sc->sc_eofs[sc->sc_eofp];
- sc->sc_eofp--;
-#ifdef DEBUG
- if (ctdebug & CT_BSF)
- printf("%s: backup eof pos %d blk %d\n",
- sc->sc_dev.dv_xname, sc->sc_eofp,
- sc->sc_eofs[sc->sc_eofp]);
-#endif
- }
- ctstrategy(bp);
- biowait(bp);
- }
- bp->b_flags = 0;
- sc->sc_flags &= ~CTF_CMD;
- if (nbp)
- brelse(nbp);
-}
-
-void
-ctstrategy(bp)
- struct buf *bp;
-{
- struct buf *dp;
- int s, unit;
- struct ct_softc *sc;
-
- unit = UNIT(bp->b_dev);
- sc = ct_cd.cd_devs[unit];
-
- dp = &sc->sc_tab;
- bp->b_actf = NULL;
- s = splbio();
- bp->b_actb = dp->b_actb;
- *(dp->b_actb) = bp;
- dp->b_actb = &bp->b_actf;
- if (dp->b_active == 0) {
- dp->b_active = 1;
- ctustart(sc);
- }
- splx(s);
-}
-
-void
-ctustart(sc)
- struct ct_softc *sc;
-{
- struct buf *bp;
-
- bp = sc->sc_tab.b_actf;
- sc->sc_addr = bp->b_data;
- sc->sc_resid = bp->b_bcount;
- if (hpibreq(sc->sc_dev.dv_parent, &sc->sc_hq))
- ctstart(sc);
-}
-
-void
-ctstart(arg)
- void *arg;
-{
- struct ct_softc *sc = arg;
- struct buf *bp;
- int i, ctlr, slave;
-
- ctlr = sc->sc_dev.dv_parent->dv_unit;
- slave = sc->sc_slave;
-
- bp = sc->sc_tab.b_actf;
- if ((sc->sc_flags & CTF_CMD) && sc->sc_bp == bp) {
- switch(sc->sc_cmd) {
- case MTFSF:
- bp->b_flags |= B_READ;
- goto mustio;
-
- case MTBSF:
- goto gotaddr;
-
- case MTOFFL:
- sc->sc_blkno = 0;
- sc->sc_ul.unit = C_SUNIT(sc->sc_punit);
- sc->sc_ul.cmd = C_UNLOAD;
- hpibsend(ctlr, slave, C_CMD, &sc->sc_ul,
- sizeof(sc->sc_ul));
- break;
-
- case MTWEOF:
- sc->sc_blkno++;
- sc->sc_flags |= CTF_WRT;
- sc->sc_wfm.unit = C_SUNIT(sc->sc_punit);
- sc->sc_wfm.cmd = C_WFM;
- hpibsend(ctlr, slave, C_CMD, &sc->sc_wfm,
- sizeof(sc->sc_wfm));
- ctaddeof(sc);
- break;
-
- case MTBSR:
- sc->sc_blkno--;
- goto gotaddr;
-
- case MTFSR:
- sc->sc_blkno++;
- goto gotaddr;
-
- case MTREW:
- sc->sc_blkno = 0;
-#ifdef DEBUG
- if(ctdebug & CT_BSF)
- printf("%s: clearing eofs\n",
- sc->sc_dev.dv_xname);
-#endif
- for (i=0; i<EOFS; i++)
- sc->sc_eofs[i] = 0;
- sc->sc_eofp = 0;
-
-gotaddr:
- sc->sc_ioc.saddr = C_SADDR;
- sc->sc_ioc.addr0 = 0;
- sc->sc_ioc.addr = sc->sc_blkno;
- sc->sc_ioc.unit = C_SUNIT(sc->sc_punit);
- sc->sc_ioc.nop2 = C_NOP;
- sc->sc_ioc.slen = C_SLEN;
- sc->sc_ioc.len = 0;
- sc->sc_ioc.nop3 = C_NOP;
- sc->sc_ioc.cmd = C_READ;
- hpibsend(ctlr, slave, C_CMD, &sc->sc_ioc,
- sizeof(sc->sc_ioc));
- break;
- }
- } else {
-mustio:
- if ((bp->b_flags & B_READ) &&
- sc->sc_flags & (CTF_BEOF|CTF_EOT)) {
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("ctstart: before flags %x\n",
- sc->sc_flags);
-#endif
- if (sc->sc_flags & CTF_BEOF) {
- sc->sc_flags &= ~CTF_BEOF;
- sc->sc_flags |= CTF_AEOF;
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("ctstart: after flags %x\n",
- sc->sc_flags);
-#endif
- }
- bp->b_resid = bp->b_bcount;
- ctdone(sc, bp);
- return;
- }
- sc->sc_flags |= CTF_IO;
- sc->sc_ioc.unit = C_SUNIT(sc->sc_punit);
- sc->sc_ioc.saddr = C_SADDR;
- sc->sc_ioc.addr0 = 0;
- sc->sc_ioc.addr = sc->sc_blkno;
- sc->sc_ioc.nop2 = C_NOP;
- sc->sc_ioc.slen = C_SLEN;
- sc->sc_ioc.len = sc->sc_resid;
- sc->sc_ioc.nop3 = C_NOP;
- if (bp->b_flags & B_READ)
- sc->sc_ioc.cmd = C_READ;
- else {
- sc->sc_ioc.cmd = C_WRITE;
- sc->sc_flags |= (CTF_WRT | CTF_WRTTN);
- }
- hpibsend(ctlr, slave, C_CMD, &sc->sc_ioc, sizeof(sc->sc_ioc));
- }
- hpibawait(ctlr);
-}
-
-void
-ctgo(arg)
- void *arg;
-{
- struct ct_softc *sc = arg;
- struct buf *bp;
- int rw;
-
- bp = sc->sc_tab.b_actf;
- rw = bp->b_flags & B_READ;
- hpibgo(sc->sc_dev.dv_parent->dv_unit, sc->sc_slave, C_EXEC,
- sc->sc_addr, sc->sc_resid, rw, rw != 0);
-}
-
-/*
- * Hideous grue to handle EOF/EOT (mostly for reads)
- */
-void
-cteof(sc, bp)
- struct ct_softc *sc;
- struct buf *bp;
-{
- long blks;
-
- /*
- * EOT on a write is an error.
- */
- if ((bp->b_flags & B_READ) == 0) {
- bp->b_resid = bp->b_bcount;
- bp->b_flags |= B_ERROR;
- bp->b_error = ENOSPC;
- sc->sc_flags |= CTF_EOT;
- return;
- }
- /*
- * Use returned block position to determine how many blocks
- * we really read and update b_resid.
- */
- blks = sc->sc_stat.c_blk - sc->sc_blkno - 1;
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("cteof: bc %ld oblk %d nblk %ld read %ld, resid %ld\n",
- bp->b_bcount, sc->sc_blkno, sc->sc_stat.c_blk,
- blks, bp->b_bcount - CTKTOB(blks));
-#endif
- if (blks == -1) { /* 9145 on EOF does not change sc_stat.c_blk */
- blks = 0;
- sc->sc_blkno++;
- }
- else {
- sc->sc_blkno = sc->sc_stat.c_blk;
- }
- bp->b_resid = bp->b_bcount - CTKTOB(blks);
- /*
- * If we are at physical EOV or were after an EOF,
- * we are now at logical EOT.
- */
- if ((sc->sc_stat.c_aef & AEF_EOV) ||
- (sc->sc_flags & CTF_AEOF)) {
- sc->sc_flags |= CTF_EOT;
- sc->sc_flags &= ~(CTF_AEOF|CTF_BEOF);
- }
- /*
- * If we were before an EOF or we have just completed a FSF,
- * we are now after EOF.
- */
- else if ((sc->sc_flags & CTF_BEOF) ||
- ((sc->sc_flags & CTF_CMD) && sc->sc_cmd == MTFSF)) {
- sc->sc_flags |= CTF_AEOF;
- sc->sc_flags &= ~CTF_BEOF;
- }
- /*
- * Otherwise if we read something we are now before EOF
- * (and no longer after EOF).
- */
- else if (blks) {
- sc->sc_flags |= CTF_BEOF;
- sc->sc_flags &= ~CTF_AEOF;
- }
- /*
- * Finally, if we didn't read anything we just passed an EOF
- */
- else
- sc->sc_flags |= CTF_AEOF;
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("cteof: leaving flags %x\n", sc->sc_flags);
-#endif
-}
-
-/* ARGSUSED */
-void
-ctintr(arg)
- void *arg;
-{
- struct ct_softc *sc = arg;
- struct buf *bp;
- u_char stat;
- int ctlr, slave, unit;
-
- ctlr = sc->sc_dev.dv_parent->dv_unit;
- slave = sc->sc_slave;
- unit = sc->sc_dev.dv_unit;
-
- bp = sc->sc_tab.b_actf;
- if (bp == NULL) {
- printf("%s: bp == NULL\n", sc->sc_dev.dv_xname);
- return;
- }
- if (sc->sc_flags & CTF_IO) {
- sc->sc_flags &= ~CTF_IO;
- if (hpibustart(ctlr))
- ctgo(sc);
- return;
- }
- if ((sc->sc_flags & CTF_STATWAIT) == 0) {
- if (hpibpptest(ctlr, slave) == 0) {
- sc->sc_flags |= CTF_STATWAIT;
- hpibawait(ctlr);
- return;
- }
- } else
- sc->sc_flags &= ~CTF_STATWAIT;
- hpibrecv(ctlr, slave, C_QSTAT, &stat, 1);
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("ctintr: before flags %x\n", sc->sc_flags);
-#endif
- if (stat) {
- sc->sc_rsc.unit = C_SUNIT(sc->sc_punit);
- sc->sc_rsc.cmd = C_STATUS;
- hpibsend(ctlr, slave, C_CMD, &sc->sc_rsc, sizeof(sc->sc_rsc));
- hpibrecv(ctlr, slave, C_EXEC, &sc->sc_stat,
- sizeof(sc->sc_stat));
- hpibrecv(ctlr, slave, C_QSTAT, &stat, 1);
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("ctintr: return stat 0x%x, A%x F%x blk %ld\n",
- stat, sc->sc_stat.c_aef,
- sc->sc_stat.c_fef, sc->sc_stat.c_blk);
-#endif
- if (stat == 0) {
- if (sc->sc_stat.c_aef & (AEF_EOF | AEF_EOV)) {
- cteof(sc, bp);
- ctaddeof(sc);
- goto done;
- }
- if (sc->sc_stat.c_fef & FEF_PF) {
- ctreset(sc);
- ctstart(sc);
- return;
- }
- if (sc->sc_stat.c_fef & FEF_REXMT) {
- ctstart(sc);
- return;
- }
- if (sc->sc_stat.c_aef & 0x5800) {
- if (sc->sc_stat.c_aef & 0x4000)
- printf("%s: uninitialized media\n",
- sc->sc_dev.dv_xname);
- if (sc->sc_stat.c_aef & 0x1000)
- printf("%s: not ready\n",
- sc->sc_dev.dv_xname);
- if (sc->sc_stat.c_aef & 0x0800)
- printf("%s: write protect\n",
- sc->sc_dev.dv_xname);
- } else {
- printf("%s err: v%d u%d ru%d bn%ld, ",
- sc->sc_dev.dv_xname,
- (sc->sc_stat.c_vu>>4)&0xF,
- sc->sc_stat.c_vu&0xF,
- sc->sc_stat.c_pend,
- sc->sc_stat.c_blk);
- printf("R0x%x F0x%x A0x%x I0x%x\n",
- sc->sc_stat.c_ref,
- sc->sc_stat.c_fef,
- sc->sc_stat.c_aef,
- sc->sc_stat.c_ief);
- }
- } else
- printf("%s: request status failed\n",
- sc->sc_dev.dv_xname);
- bp->b_flags |= B_ERROR;
- bp->b_error = EIO;
- goto done;
- } else
- bp->b_resid = 0;
- if (sc->sc_flags & CTF_CMD) {
- switch (sc->sc_cmd) {
- case MTFSF:
- sc->sc_flags &= ~(CTF_BEOF|CTF_AEOF);
- sc->sc_blkno += CTBTOK(sc->sc_resid);
- ctstart(sc);
- return;
- case MTBSF:
- sc->sc_flags &= ~(CTF_AEOF|CTF_BEOF|CTF_EOT);
- break;
- case MTBSR:
- sc->sc_flags &= ~CTF_BEOF;
- if (sc->sc_flags & CTF_EOT) {
- sc->sc_flags |= CTF_AEOF;
- sc->sc_flags &= ~CTF_EOT;
- } else if (sc->sc_flags & CTF_AEOF) {
- sc->sc_flags |= CTF_BEOF;
- sc->sc_flags &= ~CTF_AEOF;
- }
- break;
- case MTWEOF:
- sc->sc_flags &= ~CTF_BEOF;
- if (sc->sc_flags & (CTF_AEOF|CTF_EOT)) {
- sc->sc_flags |= CTF_EOT;
- sc->sc_flags &= ~CTF_AEOF;
- } else
- sc->sc_flags |= CTF_AEOF;
- break;
- case MTREW:
- case MTOFFL:
- sc->sc_flags &= ~(CTF_BEOF|CTF_AEOF|CTF_EOT);
- break;
- }
- } else {
- sc->sc_flags &= ~CTF_AEOF;
- sc->sc_blkno += CTBTOK(sc->sc_resid);
- }
-done:
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("ctintr: after flags %x\n", sc->sc_flags);
-#endif
- ctdone(sc, bp);
-}
-
-void
-ctdone(sc, bp)
- struct ct_softc *sc;
- struct buf *bp;
-{
- struct buf *dp;
- int s;
-
- if ((dp = bp->b_actf) != NULL)
- dp->b_actb = bp->b_actb;
- else
- sc->sc_tab.b_actb = bp->b_actb;
- *bp->b_actb = dp;
- s = splbio();
- biodone(bp);
- splx(s);
- hpibfree(sc->sc_dev.dv_parent, &sc->sc_hq);
- if (sc->sc_tab.b_actf == NULL) {
- sc->sc_tab.b_active = 0;
- return;
- }
- ctustart(sc);
-}
-
-int
-ctread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- return (physio(ctstrategy, dev, B_READ, minphys, uio));
-}
-
-int
-ctwrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- /* XXX: check for hardware write-protect? */
- return (physio(ctstrategy, dev, B_WRITE, minphys, uio));
-}
-
-/*ARGSUSED*/
-int
-ctioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- int flag;
- caddr_t data;
- struct proc *p;
-{
- struct mtop *op;
- int cnt;
-
- switch (cmd) {
-
- case MTIOCTOP:
- op = (struct mtop *)data;
- switch(op->mt_op) {
-
- case MTWEOF:
- case MTFSF:
- case MTBSR:
- case MTBSF:
- case MTFSR:
- cnt = op->mt_count;
- break;
-
- case MTREW:
- case MTOFFL:
- cnt = 1;
- break;
-
- default:
- return(EINVAL);
- }
- ctcommand(dev, op->mt_op, cnt);
- break;
-
- case MTIOCGET:
- break;
-
- default:
- return(EINVAL);
- }
- return(0);
-}
-
-/* ARGSUSED */
-int
-ctdump(dev, blkno, va, size)
- dev_t dev;
- daddr_t blkno;
- caddr_t va;
- size_t size;
-{
-
- return (ENODEV);
-}
-
-void
-ctaddeof(sc)
- struct ct_softc *sc;
-{
-
- if (sc->sc_eofp == EOFS - 1)
- sc->sc_eofs[EOFS - 1]++;
- else {
- sc->sc_eofp++;
- if (sc->sc_eofp == EOFS - 1)
- sc->sc_eofs[EOFS - 1] = EOFS;
- else
- /* save blkno */
- sc->sc_eofs[sc->sc_eofp] = sc->sc_blkno - 1;
- }
-#ifdef DEBUG
- if (ctdebug & CT_BSF)
- printf("%s: add eof pos %d blk %d\n",
- sc->sc_dev.dv_xname, sc->sc_eofp,
- sc->sc_eofs[sc->sc_eofp]);
-#endif
-}
diff --git a/sys/arch/hp300/dev/ctreg.h b/sys/arch/hp300/dev/ctreg.h
deleted file mode 100644
index 880818900d3..00000000000
--- a/sys/arch/hp300/dev/ctreg.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/* $OpenBSD: ctreg.h,v 1.8 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: ctreg.h,v 1.6 1996/02/09 18:00:35 scottr Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ctreg.h 8.1 (Berkeley) 6/10/93
- */
-
-struct ct_iocmd {
- char unit;
- char saddr;
- short addr0;
- long addr;
- char nop2;
- char slen;
- long len;
- char nop3;
- char cmd;
-} __packed;
-
-struct ct_rscmd {
- char unit;
- char cmd;
-} __packed;
-
-struct ct_stat {
- char c_vu;
- char c_pend;
- short c_ref;
- short c_fef;
- short c_aef;
- short c_ief;
- short c_blk0;
- long c_blk;
- char c_pad[4];
-} __packed;
-
-struct ct_ssmcmd {
- char unit;
- char cmd;
- short refm;
- short fefm;
- short aefm;
- short iefm;
-} __packed;
-
-struct ct_srcmd {
- char unit;
- char nop;
- char cmd;
- char param;
-} __packed;
-
-struct ct_soptcmd {
- char unit;
- char nop;
- char cmd;
- char opt;
-} __packed;
-
-struct ct_ulcmd {
- char unit;
- char cmd;
-} __packed;
-
-struct ct_wfmcmd {
- char unit;
- char cmd;
-} __packed;
-
-struct ct_clearcmd {
- char unit;
- char cmd;
-} __packed;
-
-#define CT7946ID 0x220
-#define CT9145ID 0x268
-#define CT9144ID 0x260
-#define CT9144 0
-#define CT7912PID 0x209
-#define CT7914PID 0x20B
-#define CT88140 1
-
-/* convert bytes to 1k tape block and back */
-#define CTBTOK(x) ((x) >> 10)
-#define CTKTOB(x) ((x) << 10)
-
-#define CTCTLR 15
-
-#define REF_MASK 0x0
-#define FEF_MASK 0x0
-#define AEF_MASK 0x0
-#define IEF_MASK 0xF970
-
-#define FEF_PF 0x0002
-#define FEF_REXMT 0x0001
-#define AEF_EOF 0x0010
-#define AEF_EOV 0x0008
-
-#define C_READ 0x00
-#define C_WRITE 0x02
-#define C_CLEAR 0x08
-#define C_STATUS 0x0d
-#define C_SADDR 0x10
-#define C_SLEN 0x18
-#define C_SUNIT(x) (0x20 | (x))
-#define C_SVOL(x) (0x40 | (x))
-#define C_NOP 0x34
-#define C_DESC 0x35
-#define C_SOPT 0x38
-#define C_SREL 0x3b
-#define C_SSM 0x3e
-#define C_WFM 0x49
-#define C_UNLOAD 0x4a
-#define C_REL 0xc0
-
-#define C_CMD 0x05
-#define C_EXEC 0x0e
-#define C_QSTAT 0x10
-#define C_TCMD 0x12
-
-#define C_CC 1
-#define C_SKSPAR 2
-#define C_OPT 4
-#define C_SPAR 4
-#define C_IMRPT 8
diff --git a/sys/arch/hp300/dev/dca.c b/sys/arch/hp300/dev/dca.c
deleted file mode 100644
index 7653fa6a7a8..00000000000
--- a/sys/arch/hp300/dev/dca.c
+++ /dev/null
@@ -1,1114 +0,0 @@
-/* $OpenBSD: dca.c,v 1.44 2014/03/11 19:45:27 guenther Exp $ */
-/* $NetBSD: dca.c,v 1.35 1997/05/05 20:58:18 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995, 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1986, 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.
- *
- * @(#)dca.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * Driver for the 98626/98644/internal serial interface on hp300/hp400,
- * based on the National Semiconductor INS8250/NS16550AF/WD16C552 UARTs.
- *
- * N.B. On the hp700 and some hp300s, there is a "secret bit" with
- * undocumented behavior. The third bit of the Modem Control Register
- * (MCR_IEN == 0x08) must be set to enable interrupts. Failure to do
- * so can result in deadlock on those machines, whereas the don't seem to
- * be any harmful side-effects from setting this bit on non-affected
- * machines.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.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/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-
-#include <dev/cons.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/dcareg.h>
-
-#ifdef DDB
-#include <ddb/db_var.h>
-#endif
-
-struct dca_softc {
- struct device sc_dev; /* generic device glue */
- struct isr sc_isr;
- struct dcadevice *sc_dca; /* pointer to hardware */
- struct tty *sc_tty; /* our tty instance */
- int sc_oflows; /* overflow counter */
- short sc_flags; /* state flags */
- u_char sc_cua; /* callout mode */
-
- /*
- * Bits for sc_flags.
- */
-#define DCA_ACTIVE 0x0001 /* indicates live unit */
-#define DCA_SOFTCAR 0x0002 /* indicates soft-carrier */
-#define DCA_HASFIFO 0x0004 /* indicates unit has FIFO */
-#define DCA_ISCONSOLE 0x0008 /* indicates unit is console */
-
-};
-
-int dcamatch(struct device *, void *, void *);
-void dcaattach(struct device *, struct device *, void *);
-
-struct cfattach dca_ca = {
- sizeof(struct dca_softc), dcamatch, dcaattach
-};
-
-struct cfdriver dca_cd = {
- NULL, "dca", DV_TTY
-};
-
-int dcadefaultrate = TTYDEF_SPEED;
-int dcamajor;
-
-cdev_decl(dca);
-
-int dcaintr(void *);
-void dcaeint(struct dca_softc *, int);
-void dcamint(struct dca_softc *);
-
-int dcaparam(struct tty *, struct termios *);
-void dcastart(struct tty *);
-int dcastop(struct tty *, int);
-int dcamctl(struct dca_softc *, int, int);
-void dcainit(struct dcadevice *, int);
-
-int dca_console_scan(int, caddr_t, void *);
-cons_decl(dca);
-
-/*
- * Stuff for DCA console support.
- */
-static struct dcadevice *dca_cn = NULL; /* pointer to hardware */
-static int dcaconsinit; /* has been initialized */
-
-const struct speedtab dcaspeedtab[] = {
- { 0, 0 },
- { 50, DCABRD(50) },
- { 75, DCABRD(75) },
- { 110, DCABRD(110) },
- { 134, DCABRD(134) },
- { 150, DCABRD(150) },
- { 200, DCABRD(200) },
- { 300, DCABRD(300) },
- { 600, DCABRD(600) },
- { 1200, DCABRD(1200) },
- { 1800, DCABRD(1800) },
- { 2400, DCABRD(2400) },
- { 4800, DCABRD(4800) },
- { 9600, DCABRD(9600) },
- { 19200, DCABRD(19200) },
- { 38400, DCABRD(38400) },
- { -1, -1 },
-};
-
-#ifdef KGDB
-#include <machine/remote-sl.h>
-
-extern dev_t kgdb_dev;
-extern int kgdb_rate;
-extern int kgdb_debug_init;
-#endif
-
-#define DCAUNIT(x) (minor(x) & 0x7f)
-#define DCACUA(x) (minor(x) & 0x80)
-
-#ifdef DEBUG
-long fifoin[17];
-long fifoout[17];
-long dcaintrcount[16];
-long dcamintcount[16];
-#endif
-
-void dcainit(struct dcadevice *, int);
-
-int
-dcamatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- switch (da->da_id) {
- case DIO_DEVICE_ID_DCA0:
- case DIO_DEVICE_ID_DCA0REM:
- case DIO_DEVICE_ID_DCA1:
- case DIO_DEVICE_ID_DCA1REM:
- return (1);
- }
-
- return (0);
-}
-
-void
-dcaattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct dca_softc *sc = (struct dca_softc *)self;
- struct dio_attach_args *da = aux;
- struct dcadevice *dca;
- int unit = self->dv_unit;
- int scode = da->da_scode;
- int ipl;
-
- if (scode == conscode) {
- dca = (struct dcadevice *)conaddr;
- sc->sc_flags |= DCA_ISCONSOLE;
- DELAY(100000);
-
- /*
- * We didn't know which unit this would be during
- * the console probe, so we have to fixup cn_dev here.
- */
- cn_tab->cn_dev = makedev(dcamajor, unit);
- } else {
- dca = (struct dcadevice *)iomap(dio_scodetopa(da->da_scode),
- da->da_size);
- if (dca == NULL) {
- printf("\n%s: can't map registers\n",
- sc->sc_dev.dv_xname);
- return;
- }
- }
-
- sc->sc_dca = dca;
-
- ipl = DIO_IPL(dca);
- printf(" ipl %d", ipl);
-
- dca->dca_reset = 0xFF;
- DELAY(100);
-
- /* look for a NS 16550AF UART with FIFOs */
- dca->dca_fifo = FIFO_ENABLE|FIFO_RCV_RST|FIFO_XMT_RST|FIFO_TRIGGER_14;
- DELAY(100);
- if ((dca->dca_iir & IIR_FIFO_MASK) == IIR_FIFO_MASK)
- sc->sc_flags |= DCA_HASFIFO;
-
- /* Establish interrupt handler. */
- sc->sc_isr.isr_func = dcaintr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_ipl = ipl;
- sc->sc_isr.isr_priority = IPL_TTY;
- dio_intr_establish(&sc->sc_isr, self->dv_xname);
-
- sc->sc_flags |= DCA_ACTIVE;
- if (self->dv_cfdata->cf_flags)
- sc->sc_flags |= DCA_SOFTCAR;
-
- /* Enable interrupts. */
- dca->dca_ic = IC_IE;
-
- /*
- * Need to reset baud rate, etc. of next print so reset dcaconsinit.
- * Also make sure console is always "hardwired."
- */
- if (sc->sc_flags & DCA_ISCONSOLE) {
- dcaconsinit = 0;
- sc->sc_flags |= DCA_SOFTCAR;
- printf(": console, ");
- } else
- printf(": ");
-
- if (sc->sc_flags & DCA_HASFIFO)
- printf("working fifo\n");
- else
- printf("no fifo\n");
-
-#ifdef KGDB
- if (kgdb_dev == makedev(dcamajor, unit)) {
- if (sc->sc_flags & DCA_ISCONSOLE)
- kgdb_dev = NODEV; /* can't debug over console port */
- else {
- dcainit(dca, kgdb_rate);
- dcaconsinit = 1; /* don't re-init in dcaputc */
- if (kgdb_debug_init) {
- /*
- * Print prefix of device name,
- * let kgdb_connect print the rest.
- */
- printf("%s: ", sc->sc_dev.dv_xname);
- kgdb_connect(1);
- } else
- printf("%s: kgdb enabled\n",
- sc->sc_dev.dv_xname);
- }
- }
-#endif
-}
-
-/* ARGSUSED */
-int
-dcaopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int unit = DCAUNIT(dev);
- struct dca_softc *sc;
- struct tty *tp;
- struct dcadevice *dca;
- u_char code;
- int s, error = 0;
-
- if (unit >= dca_cd.cd_ndevs ||
- (sc = dca_cd.cd_devs[unit]) == NULL)
- return (ENXIO);
-
- if ((sc->sc_flags & DCA_ACTIVE) == 0)
- return (ENXIO);
-
- dca = sc->sc_dca;
-
- s = spltty();
- if (sc->sc_tty == NULL) {
- tp = sc->sc_tty = ttymalloc(0);
- } else
- tp = sc->sc_tty;
- splx(s);
-
- tp->t_oproc = dcastart;
- tp->t_param = dcaparam;
- tp->t_dev = dev;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
- /*
- * Sanity clause: reset the card on first open.
- * The card might be left in an inconsistent state
- * if card memory is read inadvertently.
- */
- dcainit(dca, dcadefaultrate);
-
- tp->t_state |= TS_WOPEN;
- 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 = dcadefaultrate;
-
- s = spltty();
-
- dcaparam(tp, &tp->t_termios);
- ttsetwater(tp);
-
- /* Set the FIFO threshold based on the receive speed. */
- if (sc->sc_flags & DCA_HASFIFO)
- dca->dca_fifo = FIFO_ENABLE | FIFO_RCV_RST |
- FIFO_XMT_RST |
- (tp->t_ispeed <= 1200 ? FIFO_TRIGGER_1 :
- FIFO_TRIGGER_14);
-
- /* Flush any pending I/O */
- while ((dca->dca_iir & IIR_IMASK) == IIR_RXRDY)
- code = dca->dca_data;
-
- } else if (tp->t_state&TS_XCLUDE && suser(p, 0) != 0)
- return (EBUSY);
- else
- s = spltty();
-
- /* Set modem control state. */
- (void) dcamctl(sc, MCR_DTR | MCR_RTS, DMSET);
-
- /* Set soft-carrier if so configured. */
- if ((sc->sc_flags & DCA_SOFTCAR) || DCACUA(dev) ||
- (dcamctl(sc, 0, DMGET) & MSR_DCD))
- tp->t_state |= TS_CARR_ON;
-
- if (DCACUA(dev)) {
- if (tp->t_state & TS_ISOPEN) {
- /* Ah, but someone already is dialed in... */
- splx(s);
- return (EBUSY);
- }
- sc->sc_cua = 1; /* We go into CUA mode */
- }
-
- /* Wait for carrier if necessary. */
- if (flag & O_NONBLOCK) {
- if (!DCACUA(dev) && sc->sc_cua) {
- /* Opening TTY non-blocking... but the CUA is busy */
- splx(s);
- return (EBUSY);
- }
- } else {
- while (sc->sc_cua ||
- ((tp->t_cflag & CLOCAL) == 0 &&
- (tp->t_state & TS_CARR_ON) == 0)) {
- tp->t_state |= TS_WOPEN;
- error = ttysleep(tp, (caddr_t)&tp->t_rawq,
- TTIPRI | PCATCH, ttopen, 0);
- if (!DCACUA(dev) && sc->sc_cua && error == EINTR)
- continue;
- if (error) {
- if (DCACUA(dev))
- sc->sc_cua = 0;
- splx(s);
- return (error);
- }
- if (!DCACUA(dev) && sc->sc_cua)
- continue;
- }
- }
- splx(s);
-
- if (error == 0)
- error = (*linesw[tp->t_line].l_open)(dev, tp, p);
-
- return (error);
-}
-
-/*ARGSUSED*/
-int
-dcaclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct dca_softc *sc;
- struct tty *tp;
- struct dcadevice *dca;
- int unit;
- int s;
-
- unit = DCAUNIT(dev);
-
- sc = dca_cd.cd_devs[unit];
-
- dca = sc->sc_dca;
- tp = sc->sc_tty;
- (*linesw[tp->t_line].l_close)(tp, flag, p);
-
- s = spltty();
-
- dca->dca_cfcr &= ~CFCR_SBREAK;
-#ifdef KGDB
- /* do not disable interrupts if debugging */
- if (dev != kgdb_dev)
-#endif
- dca->dca_ier = 0;
- if (tp->t_cflag & HUPCL && (sc->sc_flags & DCA_SOFTCAR) == 0) {
- /* XXX perhaps only clear DTR */
- (void) dcamctl(sc, 0, DMSET);
- }
- tp->t_state &= ~(TS_BUSY | TS_FLUSH);
- sc->sc_cua = 0;
- splx(s);
- ttyclose(tp);
-#if 0
- ttyfree(tp);
- sc->sc_tty = NULL;
-#endif
- return (0);
-}
-
-int
-dcaread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit = DCAUNIT(dev);
- struct dca_softc *sc;
- struct tty *tp;
- int error, of;
-
- sc = dca_cd.cd_devs[unit];
-
- tp = sc->sc_tty;
- of = sc->sc_oflows;
- error = (*linesw[tp->t_line].l_read)(tp, uio, flag);
- /*
- * XXX hardly a reasonable thing to do, but reporting overflows
- * at interrupt time just exacerbates the problem.
- */
- if (sc->sc_oflows != of)
- log(LOG_WARNING, "%s: silo overflow\n", sc->sc_dev.dv_xname);
- return (error);
-}
-
-int
-dcawrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct dca_softc *sc = dca_cd.cd_devs[DCAUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-struct tty *
-dcatty(dev)
- dev_t dev;
-{
- struct dca_softc *sc = dca_cd.cd_devs[DCAUNIT(dev)];
-
- return (sc->sc_tty);
-}
-
-int
-dcaintr(arg)
- void *arg;
-{
- struct dca_softc *sc = arg;
-#ifdef KGDB
- int unit = sc->sc_dev.dv_unit;
-#endif
- struct dcadevice *dca = sc->sc_dca;
- struct tty *tp = sc->sc_tty;
- u_char code;
- int iflowdone = 0;
-
- /*
- * If interrupts aren't enabled, then the interrupt can't
- * be for us.
- */
- if ((dca->dca_ic & (IC_IR|IC_IE)) != (IC_IR|IC_IE))
- return (0);
-
- for (;;) {
- code = dca->dca_iir;
-#ifdef DEBUG
- dcaintrcount[code & IIR_IMASK]++;
-#endif
-
- switch (code & IIR_IMASK) {
- case IIR_NOPEND:
- return (1);
- case IIR_RXTOUT:
- case IIR_RXRDY:
- /* do time-critical read in-line */
-/*
- * Process a received byte. Inline for speed...
- */
-#ifdef KGDB
-#define RCVBYTE() \
- code = dca->dca_data; \
- if (tp != NULL) { \
- if ((tp->t_state & TS_ISOPEN) == 0) { \
- if (code == FRAME_END && \
- kgdb_dev == makedev(dcamajor, unit)) \
- kgdb_connect(0); /* trap into kgdb */ \
- } else \
- (*linesw[tp->t_line].l_rint)(code, tp) \
- }
-#else
-#define RCVBYTE() \
- code = dca->dca_data; \
- if (tp != NULL && (tp->t_state & TS_ISOPEN) != 0) \
- (*linesw[tp->t_line].l_rint)(code, tp)
-#endif
- RCVBYTE();
- if (sc->sc_flags & DCA_HASFIFO) {
-#ifdef DEBUG
- int fifocnt = 1;
-#endif
- while ((code = dca->dca_lsr) & LSR_RCV_MASK) {
- if (code == LSR_RXRDY) {
- RCVBYTE();
- } else
- dcaeint(sc, code);
-#ifdef DEBUG
- fifocnt++;
-#endif
- }
-#ifdef DEBUG
- if (fifocnt > 16)
- fifoin[0]++;
- else
- fifoin[fifocnt]++;
-#endif
- }
- if (iflowdone == 0 && tp != NULL &&
- (tp->t_cflag & CRTS_IFLOW) &&
- tp->t_rawq.c_cc > (TTYHOG(tp) / 2)) {
- dca->dca_mcr &= ~MCR_RTS;
- iflowdone = 1;
- }
- break;
- case IIR_TXRDY:
- if (tp != NULL) {
- tp->t_state &=~ (TS_BUSY|TS_FLUSH);
- if (tp->t_line)
- (*linesw[tp->t_line].l_start)(tp);
- else
- dcastart(tp);
- }
- break;
- case IIR_RLS:
- dcaeint(sc, dca->dca_lsr);
- break;
- default:
- if (code & IIR_NOPEND)
- return (1);
- log(LOG_WARNING, "%s: weird interrupt: 0x%x\n",
- sc->sc_dev.dv_xname, code);
- /* FALLTHROUGH */
- case IIR_MLSC:
- dcamint(sc);
- break;
- }
- }
-}
-
-void
-dcaeint(sc, stat)
- struct dca_softc *sc;
- int stat;
-{
- struct tty *tp = sc->sc_tty;
- struct dcadevice *dca = sc->sc_dca;
- int c;
-
- c = dca->dca_data;
-
-#if defined(DDB) && !defined(KGDB)
- if ((sc->sc_flags & DCA_ISCONSOLE) && db_console && (stat & LSR_BI)) {
- Debugger();
- return;
- }
-#endif
-
- if (tp == NULL)
- return;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
-#ifdef KGDB
- /* we don't care about parity errors */
- if (((stat & (LSR_BI|LSR_FE|LSR_PE)) == LSR_PE) &&
- kgdb_dev == makedev(dcamajor, sc->sc_hd->hp_unit) &&
- c == FRAME_END)
- kgdb_connect(0); /* trap into kgdb */
-#endif
- return;
- }
-
- if (stat & (LSR_BI | LSR_FE))
- c |= TTY_FE;
- else if (stat & LSR_PE)
- c |= TTY_PE;
- else if (stat & LSR_OE)
- sc->sc_oflows++;
- (*linesw[tp->t_line].l_rint)(c, tp);
-}
-
-void
-dcamint(sc)
- struct dca_softc *sc;
-{
- struct tty *tp = sc->sc_tty;
- struct dcadevice *dca = sc->sc_dca;
- u_char stat;
-
- stat = dca->dca_msr;
-#ifdef DEBUG
- dcamintcount[stat & 0xf]++;
-#endif
-
- if (tp == NULL)
- return;
-
- if ((stat & MSR_DDCD) &&
- (sc->sc_flags & DCA_SOFTCAR) == 0) {
- if (stat & MSR_DCD)
- (void)(*linesw[tp->t_line].l_modem)(tp, 1);
- else if ((*linesw[tp->t_line].l_modem)(tp, 0) == 0)
- dca->dca_mcr &= ~(MCR_DTR | MCR_RTS);
- }
- /*
- * CTS change.
- * If doing HW output flow control start/stop output as appropriate.
- */
- if ((stat & MSR_DCTS) &&
- (tp->t_state & TS_ISOPEN) && (tp->t_cflag & CCTS_OFLOW)) {
- if (stat & MSR_CTS) {
- tp->t_state &=~ TS_TTSTOP;
- dcastart(tp);
- } else {
- tp->t_state |= TS_TTSTOP;
- }
- }
-}
-
-int
-dcaioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int unit = DCAUNIT(dev);
- struct dca_softc *sc = dca_cd.cd_devs[unit];
- struct tty *tp = sc->sc_tty;
- struct dcadevice *dca = sc->sc_dca;
- int error;
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
-
- switch (cmd) {
- case TIOCSBRK:
- dca->dca_cfcr |= CFCR_SBREAK;
- break;
-
- case TIOCCBRK:
- dca->dca_cfcr &= ~CFCR_SBREAK;
- break;
-
- case TIOCSDTR:
- (void) dcamctl(sc, MCR_DTR | MCR_RTS, DMBIS);
- break;
-
- case TIOCCDTR:
- (void) dcamctl(sc, MCR_DTR | MCR_RTS, DMBIC);
- break;
-
- case TIOCMSET:
- (void) dcamctl(sc, *(int *)data, DMSET);
- break;
-
- case TIOCMBIS:
- (void) dcamctl(sc, *(int *)data, DMBIS);
- break;
-
- case TIOCMBIC:
- (void) dcamctl(sc, *(int *)data, DMBIC);
- break;
-
- case TIOCMGET:
- *(int *)data = dcamctl(sc, 0, DMGET);
- break;
-
- case TIOCGFLAGS: {
- int bits = 0;
-
- if (sc->sc_flags & DCA_SOFTCAR)
- bits |= TIOCFLAG_SOFTCAR;
-
- if (tp->t_cflag & CLOCAL)
- bits |= TIOCFLAG_CLOCAL;
-
- *(int *)data = bits;
- break;
- }
-
- case TIOCSFLAGS: {
- int userbits;
-
- error = suser(p, 0);
- if (error)
- return (EPERM);
-
- userbits = *(int *)data;
-
- if ((userbits & TIOCFLAG_SOFTCAR) ||
- (sc->sc_flags & DCA_ISCONSOLE))
- sc->sc_flags |= DCA_SOFTCAR;
-
- if (userbits & TIOCFLAG_CLOCAL)
- tp->t_cflag |= CLOCAL;
-
- break;
- }
-
- default:
- return (ENOTTY);
- }
- return (0);
-}
-
-int
-dcaparam(tp, t)
- struct tty *tp;
- struct termios *t;
-{
- int unit = DCAUNIT(tp->t_dev);
- struct dca_softc *sc = dca_cd.cd_devs[unit];
- struct dcadevice *dca = sc->sc_dca;
- int cfcr, cflag = t->c_cflag;
- int ospeed = ttspeedtab(t->c_ospeed, dcaspeedtab);
- int s;
-
- /* check requested parameters */
- if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed))
- return (EINVAL);
-
- switch (cflag & CSIZE) {
- case CS5:
- cfcr = CFCR_5BITS;
- break;
-
- case CS6:
- cfcr = CFCR_6BITS;
- break;
-
- case CS7:
- cfcr = CFCR_7BITS;
- break;
-
- case CS8:
- default: /* XXX gcc whines about cfcr being unitialized... */
- cfcr = CFCR_8BITS;
- break;
- }
- if (cflag & PARENB) {
- cfcr |= CFCR_PENAB;
- if ((cflag & PARODD) == 0)
- cfcr |= CFCR_PEVEN;
- }
- if (cflag & CSTOPB)
- cfcr |= CFCR_STOPB;
-
- s = spltty();
-
- if (ospeed == 0)
- (void) dcamctl(sc, 0, DMSET); /* hang up line */
-
- /*
- * Set the FIFO threshold based on the receive speed, if we
- * are changing it.
- */
- if (tp->t_ispeed != t->c_ispeed) {
- if (sc->sc_flags & DCA_HASFIFO)
- dca->dca_fifo = FIFO_ENABLE |
- (t->c_ispeed <= 1200 ? FIFO_TRIGGER_1 :
- FIFO_TRIGGER_14);
- }
-
- if (ospeed != 0) {
- dca->dca_cfcr |= CFCR_DLAB;
- dca->dca_data = ospeed & 0xFF;
- dca->dca_ier = ospeed >> 8;
- dca->dca_cfcr = cfcr;
- } else
- dca->dca_cfcr = cfcr;
-
- /* and copy to tty */
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = cflag;
-
- dca->dca_ier = IER_ERXRDY | IER_ETXRDY | IER_ERLS | IER_EMSC;
- dca->dca_mcr |= MCR_IEN;
-
- splx(s);
- return (0);
-}
-
-void
-dcastart(tp)
- struct tty *tp;
-{
- int s, c, unit = DCAUNIT(tp->t_dev);
- struct dca_softc *sc = dca_cd.cd_devs[unit];
- struct dcadevice *dca = sc->sc_dca;
-
- s = spltty();
-
- if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP))
- goto out;
- ttwakeupwr(tp);
- if (tp->t_outq.c_cc == 0)
- goto out;
- if (dca->dca_lsr & LSR_TXRDY) {
- tp->t_state |= TS_BUSY;
- if (sc->sc_flags & DCA_HASFIFO) {
- for (c = 0; c < 16 && tp->t_outq.c_cc; ++c)
- dca->dca_data = getc(&tp->t_outq);
-#ifdef DEBUG
- if (c > 16)
- fifoout[0]++;
- else
- fifoout[c]++;
-#endif
- } else
- dca->dca_data = getc(&tp->t_outq);
- }
-
-out:
- splx(s);
-}
-
-/*
- * Stop output on a line.
- */
-/*ARGSUSED*/
-int
-dcastop(tp, flag)
- 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
-dcamctl(sc, bits, how)
- struct dca_softc *sc;
- int bits, how;
-{
- struct dcadevice *dca = sc->sc_dca;
- int s;
-
- /*
- * Always make sure MCR_IEN is set (unless setting to 0)
- */
-#ifdef KGDB
- if (how == DMSET && kgdb_dev == makedev(dcamajor, sc->sc_hd->hp_unit))
- bits |= MCR_IEN;
- else
-#endif
- if (how == DMBIS || (how == DMSET && bits))
- bits |= MCR_IEN;
- else if (how == DMBIC)
- bits &= ~MCR_IEN;
- s = spltty();
-
- switch (how) {
- case DMSET:
- dca->dca_mcr = bits;
- break;
-
- case DMBIS:
- dca->dca_mcr |= bits;
- break;
-
- case DMBIC:
- dca->dca_mcr &= ~bits;
- break;
-
- case DMGET:
- bits = dca->dca_msr;
- break;
- }
- splx(s);
- return (bits);
-}
-
-void
-dcainit(dca, rate)
- struct dcadevice *dca;
- int rate;
-{
- int s;
- short stat;
-
- s = splhigh();
-
- dca->dca_reset = 0xFF;
- DELAY(100);
- dca->dca_ic = IC_IE;
-
- dca->dca_cfcr = CFCR_DLAB;
- rate = ttspeedtab(rate, dcaspeedtab);
- dca->dca_data = rate & 0xFF;
- dca->dca_ier = rate >> 8;
- dca->dca_cfcr = CFCR_8BITS;
- dca->dca_ier = IER_ERXRDY | IER_ETXRDY;
- dca->dca_fifo =
- FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1;
- dca->dca_mcr = MCR_DTR | MCR_RTS;
- DELAY(100);
- stat = dca->dca_iir;
- splx(s);
-}
-
-/*
- * Following are all routines needed for DCA to act as console
- */
-
-int
-dca_console_scan(scode, va, arg)
- int scode;
- caddr_t va;
- void *arg;
-{
- struct dcadevice *dca = (struct dcadevice *)va;
- struct consdev *cp = arg;
- u_int pri;
-
- switch (dca->dca_id) {
- case DCAID0:
- case DCAID1:
- pri = CN_LOWPRI;
- break;
-
- case DCAID0 | DCACON:
- case DCAID1 | DCACON:
- pri = CN_HIGHPRI;
- break;
-
- default:
- return (0);
- }
-
-#ifdef CONSCODE
- /*
- * Raise our priority, if appropriate.
- */
- if (scode == CONSCODE)
- pri = CN_FORCED;
-#endif
-
- /* Only raise priority. */
- if (pri > cp->cn_pri)
- cp->cn_pri = pri;
-
- /*
- * If our priority is higher than the currently-remembered
- * console, stash our priority, for the benefit of dcacninit().
- */
- if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) {
- cn_tab = cp;
- conscode = scode;
- return (DIO_SIZE(scode, va));
- }
- return (0);
-}
-
-void
-dcacnprobe(cp)
- struct consdev *cp;
-{
-
- /* locate the major number */
- for (dcamajor = 0; dcamajor < nchrdev; dcamajor++)
- if (cdevsw[dcamajor].d_open == dcaopen)
- break;
-
- /* initialize required fields */
- cp->cn_dev = makedev(dcamajor, 0); /* XXX */
-
- console_scan(dca_console_scan, cp);
-
-#ifdef KGDB
- /* XXX this needs to be fixed. */
- if (major(kgdb_dev) == 1) /* XXX */
- kgdb_dev = makedev(dcamajor, minor(kgdb_dev));
-#endif
-}
-
-/* ARGSUSED */
-void
-dcacninit(cp)
- struct consdev *cp;
-{
-
- /*
- * We are not interested by the second console pass.
- */
- if (consolepass != 0)
- return;
-
- dca_cn = (struct dcadevice *)conaddr;
- dcainit(dca_cn, dcadefaultrate);
- dcaconsinit = 1;
-}
-
-/* ARGSUSED */
-int
-dcacngetc(dev)
- dev_t dev;
-{
- u_char stat;
- int c, s;
-
- s = splhigh();
- while (((stat = dca_cn->dca_lsr) & LSR_RXRDY) == 0)
- ;
- c = dca_cn->dca_data;
- stat = dca_cn->dca_iir;
- splx(s);
- return (c);
-}
-
-/*
- * Console kernel output character routine.
- */
-/* ARGSUSED */
-void
-dcacnputc(dev, c)
- dev_t dev;
- int c;
-{
- int timo;
- u_char stat;
- int s = splhigh();
-
- if (dcaconsinit == 0) {
- dcainit(dca_cn, dcadefaultrate);
- dcaconsinit = 1;
- }
- /* wait for any pending transmission to finish */
- timo = 50000;
- while (((stat = dca_cn->dca_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
- dca_cn->dca_data = c;
- /* wait for this transmission to complete */
- timo = 1500000;
- while (((stat = dca_cn->dca_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
- /* clear any interrupts generated by this transmission */
- stat = dca_cn->dca_iir;
- splx(s);
-}
diff --git a/sys/arch/hp300/dev/dcareg.h b/sys/arch/hp300/dev/dcareg.h
deleted file mode 100644
index 66dcd3e4ea4..00000000000
--- a/sys/arch/hp300/dev/dcareg.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/* $OpenBSD: dcareg.h,v 1.8 2010/05/22 13:04:25 deraadt Exp $ */
-/* $NetBSD: dcareg.h,v 1.6 1996/02/24 00:55:02 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 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.
- *
- * @(#)dcareg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-struct dcadevice {
- /* card registers */
- u_char dca_pad0;
- vu_char dca_id; /* 0x01 (read) */
-#define dca_reset dca_id /* 0x01 (write) */
- u_char dca_pad1;
- vu_char dca_ic; /* 0x03 */
- u_char dca_pad2;
- vu_char dca_ocbrc; /* 0x05 */
- u_char dca_pad3;
- vu_char dca_lcsm; /* 0x07 */
- u_char dca_pad4[8];
- /* chip registers */
- u_char dca_pad5;
- vu_char dca_data; /* 0x11 */
- u_char dca_pad6;
- vu_char dca_ier; /* 0x13 */
- u_char dca_pad7;
- vu_char dca_iir; /* 0x15 (read) */
-#define dca_fifo dca_iir /* 0x15 (write) */
- u_char dca_pad8;
- vu_char dca_cfcr; /* 0x17 */
- u_char dca_pad9;
- vu_char dca_mcr; /* 0x19 */
- u_char dca_padA;
- vu_char dca_lsr; /* 0x1B */
- u_char dca_padB;
- vu_char dca_msr; /* 0x1D */
-};
-
-/* interface reset/id (300 only) */
-#define DCAID0 0x02
-#define DCAID1 0x42
-#define DCACON 0x80 /* REMOTE/LOCAL switch */
-
-/* interrupt control (300 only) */
-#define DCAIPL(x) ((((x) >> 4) & 3) + 3)
-#define IC_IR 0x40
-#define IC_IE 0x80
-
-/*
- * 16 bit baud rate divisor (lower byte in dca_data, upper in dca_ier)
- * NB: This constant is for a 7.3728 clock frequency. The 300 clock
- * frequency is 2.4576, giving a constant of 153600.
- */
-#define DCABRD(x) (153600 / (x))
-
-/* interrupt enable register */
-#define IER_ERXRDY 0x1 /* Enable receiver interrupt */
-#define IER_ETXRDY 0x2 /* Enable transmitter empty interrupt */
-#define IER_ERLS 0x4 /* Enable line status interrupt */
-#define IER_EMSC 0x8 /* Enable modem status interrupt */
-
-/* interrupt identification register */
-#define IIR_IMASK 0xf
-#define IIR_RXTOUT 0xc
-#define IIR_RLS 0x6 /* Line status change */
-#define IIR_RXRDY 0x4 /* Receiver ready */
-#define IIR_TXRDY 0x2 /* Transmitter ready */
-#define IIR_NOPEND 0x1 /* No pending interrupts */
-#define IIR_MLSC 0x0 /* Modem status */
-#define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */
-
-/* fifo control register */
-#define FIFO_ENABLE 0x01 /* Turn the FIFO on */
-#define FIFO_RCV_RST 0x02 /* Reset RX FIFO */
-#define FIFO_XMT_RST 0x04 /* Reset TX FIFO */
-#define FIFO_DMA_MODE 0x08
-#define FIFO_TRIGGER_1 0x00 /* Trigger RXRDY intr on 1 character */
-#define FIFO_TRIGGER_4 0x40 /* ibid 4 */
-#define FIFO_TRIGGER_8 0x80 /* ibid 8 */
-#define FIFO_TRIGGER_14 0xc0 /* ibid 14 */
-
-/* character format control register */
-#define CFCR_DLAB 0x80
-#define CFCR_SBREAK 0x40
-#define CFCR_PZERO 0x30
-#define CFCR_PONE 0x20
-#define CFCR_PEVEN 0x10
-#define CFCR_PODD 0x00
-#define CFCR_PENAB 0x08
-#define CFCR_STOPB 0x04
-#define CFCR_8BITS 0x03
-#define CFCR_7BITS 0x02
-#define CFCR_6BITS 0x01
-#define CFCR_5BITS 0x00
-
-/* modem control register */
-#define MCR_LOOPBACK 0x10 /* Loop test: echos from TX to RX */
-#define MCR_IEN 0x08 /* Out2: enables UART interrupts */
-#define MCR_DRS 0x04 /* Out1: resets some internal modems */
-#define MCR_RTS 0x02 /* Request To Send */
-#define MCR_DTR 0x01 /* Data Terminal Ready */
-
-/* line status register */
-#define LSR_RCV_FIFO 0x80
-#define LSR_TSRE 0x40 /* Transmitter empty: byte sent */
-#define LSR_TXRDY 0x20 /* Transmitter buffer empty */
-#define LSR_BI 0x10 /* Break detected */
-#define LSR_FE 0x08 /* Framing error: bad stop bit */
-#define LSR_PE 0x04 /* Parity error */
-#define LSR_OE 0x02 /* Overrun, lost incoming byte */
-#define LSR_RXRDY 0x01 /* Byte ready in Receive Buffer */
-#define LSR_RCV_MASK 0x1f /* Mask for incoming data or error */
-
-/* modem status register */
-#define MSR_DCD 0x80 /* Current Data Carrier Detect */
-#define MSR_RI 0x40 /* Current Ring Indicator */
-#define MSR_DSR 0x20 /* Current Data Set Ready */
-#define MSR_CTS 0x10 /* Current Clear to Send */
-#define MSR_DDCD 0x08 /* DCD has changed state */
-#define MSR_TERI 0x04 /* RI has toggled low to high */
-#define MSR_DDSR 0x02 /* DSR has changed state */
-#define MSR_DCTS 0x01 /* CTS has changed state */
diff --git a/sys/arch/hp300/dev/dcm.c b/sys/arch/hp300/dev/dcm.c
deleted file mode 100644
index 6346eeb1f38..00000000000
--- a/sys/arch/hp300/dev/dcm.c
+++ /dev/null
@@ -1,1672 +0,0 @@
-/* $OpenBSD: dcm.c,v 1.36 2012/09/08 19:24:28 miod Exp $ */
-/* $NetBSD: dcm.c,v 1.41 1997/05/05 20:59:16 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995, 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * 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: dcm.c 1.29 92/01/21$
- *
- * @(#)dcm.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * TODO:
- * Timeouts
- * Test console support.
- */
-
-/*
- * 98642/MUX
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/time.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-
-#include <dev/cons.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/dcmreg.h>
-
-#ifndef DEFAULT_BAUD_RATE
-#define DEFAULT_BAUD_RATE 9600
-#endif
-
-const struct speedtab dcmspeedtab[] = {
- { 0, BR_0 },
- { 50, BR_50 },
- { 75, BR_75 },
- { 110, BR_110 },
- { 134, BR_134 },
- { 150, BR_150 },
- { 300, BR_300 },
- { 600, BR_600 },
- { 1200, BR_1200 },
- { 1800, BR_1800 },
- { 2400, BR_2400 },
- { 4800, BR_4800 },
- { 9600, BR_9600 },
- { 19200, BR_19200 },
- { 38400, BR_38400 },
- { -1, -1 },
-};
-
-/* u-sec per character based on baudrate (assumes 1 start/8 data/1 stop bit) */
-#define DCM_USPERCH(s) (10000000 / (s))
-
-/*
- * Per board interrupt scheme. 16.7ms is the polling interrupt rate
- * (16.7ms is about 550 baud, 38.4k is 72 chars in 16.7ms).
- */
-#define DIS_TIMER 0
-#define DIS_PERCHAR 1
-#define DIS_RESET 2
-
-int dcmistype = -1; /* -1 == dynamic, 0 == timer, 1 == perchar */
-int dcminterval = 5; /* interval (secs) between checks */
-struct dcmischeme {
- int dis_perchar; /* non-zero if interrupting per char */
- long dis_time; /* last time examined */
- int dis_intr; /* recv interrupts during last interval */
- int dis_char; /* characters read during last interval */
-};
-
-/*
- * Stuff for DCM console support. This could probably be done a little
- * better.
- */
-static struct dcmdevice *dcm_cn = NULL; /* pointer to hardware */
-static int dcmconsinit; /* has been initialized */
-
-int dcmdefaultrate = DEFAULT_BAUD_RATE;
-int dcmconbrdbusy = 0;
-int dcmmajor;
-
-#ifdef KGDB
-/*
- * Kernel GDB support
- */
-#include <machine/remote-sl.h>
-
-extern dev_t kgdb_dev;
-extern int kgdb_rate;
-extern int kgdb_debug_init;
-#endif
-
-/* #define DCMSTATS */
-
-#ifdef DEBUG
-int dcmdebug = 0x0;
-#define DDB_SIOERR 0x01
-#define DDB_PARAM 0x02
-#define DDB_INPUT 0x04
-#define DDB_OUTPUT 0x08
-#define DDB_INTR 0x10
-#define DDB_IOCTL 0x20
-#define DDB_INTSCHM 0x40
-#define DDB_MODEM 0x80
-#define DDB_OPENCLOSE 0x100
-#endif
-
-#ifdef DCMSTATS
-#define DCMRBSIZE 94
-#define DCMXBSIZE 24
-
-struct dcmstats {
- long xints; /* # of xmit ints */
- long xchars; /* # of xmit chars */
- long xempty; /* times outq is empty in dcmstart */
- long xrestarts; /* times completed while xmitting */
- long rints; /* # of recv ints */
- long rchars; /* # of recv chars */
- long xsilo[DCMXBSIZE+2]; /* times this many chars xmit on one int */
- long rsilo[DCMRBSIZE+2]; /* times this many chars read on one int */
-};
-#endif
-
-#define DCMUNIT(x) (minor(x) & 0x7f)
-#define DCMCUA(x) (minor(x) & 0x80)
-#define DCMBOARD(x) (((x) >> 2) & 0x3f)
-#define DCMPORT(x) ((x) & 3)
-
-/*
- * Conversion from "HP DCE" to almost-normal DCE: on the 638 8-port mux,
- * the distribution panel uses "HP DCE" conventions. If requested via
- * the device flags, we swap the inputs to something closer to normal DCE,
- * allowing a straight-through cable to a DTE or a reversed cable
- * to a DCE (reversing 2-3, 4-5, 8-20 and leaving 6 unconnected;
- * this gets "DCD" on pin 20 and "CTS" on 4, but doesn't connect
- * DSR or make RTS work, though). The following gives the full
- * details of a cable from this mux panel to a modem:
- *
- * HP modem
- * name pin pin name
- * HP inputs:
- * "Rx" 2 3 Tx
- * CTS 4 5 CTS (only needed for CCTS_OFLOW)
- * DCD 20 8 DCD
- * "DSR" 9 6 DSR (unneeded)
- * RI 22 22 RI (unneeded)
- *
- * HP outputs:
- * "Tx" 3 2 Rx
- * "DTR" 6 not connected
- * "RTS" 8 20 DTR
- * "SR" 23 4 RTS (often not needed)
- */
-#define hp2dce_in(ibits) (iconv[(ibits) & 0xf])
-static char iconv[16] = {
- 0, MI_DM, MI_CTS, MI_CTS|MI_DM,
- MI_CD, MI_CD|MI_DM, MI_CD|MI_CTS, MI_CD|MI_CTS|MI_DM,
- MI_RI, MI_RI|MI_DM, MI_RI|MI_CTS, MI_RI|MI_CTS|MI_DM,
- MI_RI|MI_CD, MI_RI|MI_CD|MI_DM, MI_RI|MI_CD|MI_CTS,
- MI_RI|MI_CD|MI_CTS|MI_DM
-};
-
-/*
- * Note that 8-port boards appear as 2 4-port boards at consecutive
- * select codes.
- */
-#define NDCMPORT 4
-
-struct dcm_softc {
- struct device sc_dev; /* generic device glue */
- struct isr sc_isr;
- struct dcmdevice *sc_dcm; /* pointer to hardware */
- struct tty *sc_tty[NDCMPORT]; /* our tty instances */
- struct modemreg *sc_modem[NDCMPORT]; /* modem control */
- char sc_mcndlast[NDCMPORT]; /* XXX last modem status for port */
- short sc_softCAR; /* mask of ports with soft-carrier */
- struct dcmischeme sc_scheme; /* interrupt scheme for board */
- u_char sc_cua; /* callout mode */
-
- /*
- * Mask of soft-carrier bits in config flags.
- */
-#define DCM_SOFTCAR 0x0000000f
-
- int sc_flags; /* misc. configuration info */
-
- /*
- * Bits for sc_flags
- */
-#define DCM_ACTIVE 0x00000001 /* indicates board is alive */
-#define DCM_ISCONSOLE 0x00000002 /* indicates board is console */
-#define DCM_STDDCE 0x00000010 /* re-map DCE to standard */
-#define DCM_FLAGMASK (DCM_STDDCE) /* mask of valid bits in config flags */
-
-#ifdef DCMSTATS
- struct dcmstats sc_stats; /* metrics gathering */
-#endif
-};
-
-cdev_decl(dcm);
-
-int dcmintr(void *);
-void dcmpint(struct dcm_softc *, int, int);
-void dcmrint(struct dcm_softc *);
-void dcmreadbuf(struct dcm_softc *, int);
-void dcmxint(struct dcm_softc *, int);
-void dcmmint(struct dcm_softc *, int, int);
-
-int dcmparam(struct tty *, struct termios *);
-void dcmstart(struct tty *);
-int dcmstop(struct tty *, int);
-int dcmmctl(dev_t, int, int);
-void dcmsetischeme(int, int);
-void dcminit(struct dcmdevice *, int, int);
-
-int dcmselftest(struct dcm_softc *);
-
-int dcm_console_scan(int, caddr_t, void *);
-cons_decl(dcm);
-
-int dcmmatch(struct device *, void *, void *);
-void dcmattach(struct device *, struct device *, void *);
-
-struct cfattach dcm_ca = {
- sizeof(struct dcm_softc), dcmmatch, dcmattach
-};
-
-struct cfdriver dcm_cd = {
- NULL, "dcm", DV_TTY
-};
-
-int
-dcmmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- switch (da->da_id) {
- case DIO_DEVICE_ID_DCM:
- case DIO_DEVICE_ID_DCMREM:
- return (1);
- }
-
- return (0);
-}
-
-void
-dcmattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct dcm_softc *sc = (struct dcm_softc *)self;
- struct dio_attach_args *da = aux;
- struct dcmdevice *dcm;
- int brd = self->dv_unit;
- int scode = da->da_scode;
- int i, mbits, code, ipl;
-
- sc->sc_flags = 0;
-
- if (scode == conscode) {
- dcm = (struct dcmdevice *)conaddr;
- sc->sc_flags |= DCM_ISCONSOLE;
-
- /*
- * We didn't know which unit this would be during
- * the console probe, so we have to fixup cn_dev here.
- * Note that we always assume port 1 on the board.
- */
- cn_tab->cn_dev = makedev(dcmmajor, (brd << 2) | DCMCONSPORT);
- } else {
- dcm = (struct dcmdevice *)iomap(dio_scodetopa(da->da_scode),
- da->da_size);
- if (dcm == NULL) {
- printf("\n%s: can't map registers\n",
- sc->sc_dev.dv_xname);
- return;
- }
- }
-
- sc->sc_dcm = dcm;
-
- ipl = DIO_IPL(dcm);
- printf(" ipl %d", ipl);
-
- /*
- * XXX someone _should_ fix this; the self test screws
- * autoconfig messages.
- */
- if ((sc->sc_flags & DCM_ISCONSOLE) && dcmselftest(sc)) {
- printf("\n%s: self-test failed\n", sc->sc_dev.dv_xname);
- return;
- }
-
- /* Extract configuration info from flags. */
- sc->sc_softCAR = self->dv_cfdata->cf_flags & DCM_SOFTCAR;
- sc->sc_flags |= self->dv_cfdata->cf_flags & DCM_FLAGMASK;
-
- /* Mark our unit as configured. */
- sc->sc_flags |= DCM_ACTIVE;
-
- /* Establish the interrupt handler. */
- sc->sc_isr.isr_func = dcmintr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_ipl = ipl;
- sc->sc_isr.isr_priority = IPL_TTY;
- dio_intr_establish(&sc->sc_isr, self->dv_xname);
-
- if (dcmistype == DIS_TIMER)
- dcmsetischeme(brd, DIS_RESET|DIS_TIMER);
- else
- dcmsetischeme(brd, DIS_RESET|DIS_PERCHAR);
-
- /* load pointers to modem control */
- sc->sc_modem[0] = &dcm->dcm_modem0;
- sc->sc_modem[1] = &dcm->dcm_modem1;
- sc->sc_modem[2] = &dcm->dcm_modem2;
- sc->sc_modem[3] = &dcm->dcm_modem3;
-
- /* set DCD (modem) and CTS (flow control) on all ports */
- if (sc->sc_flags & DCM_STDDCE)
- mbits = hp2dce_in(MI_CD|MI_CTS);
- else
- mbits = MI_CD|MI_CTS;
-
- for (i = 0; i < NDCMPORT; i++)
- sc->sc_modem[i]->mdmmsk = mbits;
-
- /*
- * Get current state of mdmin register on all ports, so that
- * deltas will work properly.
- */
- for (i = 0; i < NDCMPORT; i++) {
- code = sc->sc_modem[i]->mdmin;
- if (sc->sc_flags & DCM_STDDCE)
- code = hp2dce_in(code);
- sc->sc_mcndlast[i] = code;
- }
-
- dcm->dcm_ic = IC_IE; /* turn all interrupts on */
-
- /*
- * Need to reset baud rate, etc. of next print so reset dcmconsinit.
- * Also make sure console is always "hardwired"
- */
- if (sc->sc_flags & DCM_ISCONSOLE) {
- dcmconsinit = 0;
- sc->sc_softCAR |= (1 << DCMCONSPORT);
- printf(": console on port %d\n", DCMCONSPORT);
- } else
- printf("\n");
-
-#ifdef KGDB
- if (major(kgdb_dev) == dcmmajor &&
- DCMBOARD(DCMUNIT(kgdb_dev)) == brd) {
- if (dcmconsole == DCMUNIT(kgdb_dev)) /* XXX fixme */
- kgdb_dev = NODEV; /* can't debug over console port */
-#ifndef KGDB_CHEAT
- /*
- * The following could potentially be replaced
- * by the corresponding code in dcmcnprobe.
- */
- else {
- dcminit(dcm, DCMPORT(DCMUNIT(kgdb_dev)),
- kgdb_rate);
- if (kgdb_debug_init) {
- printf("%s port %d: ", sc->sc_dev.dv_xname,
- DCMPORT(DCMUNIT(kgdb_dev)));
- kgdb_connect(1);
- } else
- printf("%s port %d: kgdb enabled\n",
- sc->sc_dev.dv_xname,
- DCMPORT(DCMUNIT(kgdb_dev)));
- }
- /* end could be replaced */
-#endif /* KGDB_CHEAT */
- }
-#endif /* KGDB */
-}
-
-/* ARGSUSED */
-int
-dcmopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct dcm_softc *sc;
- struct tty *tp;
- int unit, brd, port;
- int error = 0, mbits, s;
-
- unit = DCMUNIT(dev);
- brd = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- if (brd >= dcm_cd.cd_ndevs || port >= NDCMPORT ||
- (sc = dcm_cd.cd_devs[brd]) == NULL)
- return (ENXIO);
-
- if ((sc->sc_flags & DCM_ACTIVE) == 0)
- return (ENXIO);
-
- s = spltty();
- if (sc->sc_tty[port] == NULL) {
- tp = sc->sc_tty[port] = ttymalloc(0);
- } else
- tp = sc->sc_tty[port];
- splx(s);
-
- tp->t_oproc = dcmstart;
- tp->t_param = dcmparam;
- tp->t_dev = dev;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
- /*
- * Sanity clause: reset the card on first open.
- * The card might be left in an inconsistent state
- * if the card memory is read inadvertently.
- */
- dcminit(sc->sc_dcm, port, dcmdefaultrate);
-
- tp->t_state |= TS_WOPEN;
- 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;
-
- s = spltty();
-
- (void) dcmparam(tp, &tp->t_termios);
- ttsetwater(tp);
- } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0)
- return (EBUSY);
- else
- s = spltty();
-
- /* Set modem control state. */
- mbits = MO_ON;
- if (sc->sc_flags & DCM_STDDCE)
- mbits |= MO_SR; /* pin 23, could be used as RTS */
-
- (void) dcmmctl(dev, mbits, DMSET); /* enable port */
-
- /* Set soft-carrier if so configured. */
- if ((sc->sc_softCAR & (1 << port)) || DCMCUA(dev) ||
- (dcmmctl(dev, MO_OFF, DMGET) & MI_CD))
- tp->t_state |= TS_CARR_ON;
-
- if (DCMCUA(dev)) {
- if (tp->t_state & TS_ISOPEN) {
- /* Ah, but someone already is dialed in... */
- splx(s);
- return (EBUSY);
- }
- sc->sc_cua = 1; /* We go into CUA mode */
- }
-
-#ifdef DEBUG
- if (dcmdebug & DDB_MODEM)
- printf("%s: dcmopen port %d softcarr %c\n",
- sc->sc_dev.dv_xname, port,
- (tp->t_state & TS_CARR_ON) ? '1' : '0');
-#endif
-
- /* Wait for carrier if necessary. */
- if (flag & O_NONBLOCK) {
- if (!DCMCUA(dev) && sc->sc_cua) {
- /* Opening TTY non-blocking... but the CUA is busy */
- splx(s);
- return (EBUSY);
- }
- } else {
- while (sc->sc_cua ||
- ((tp->t_cflag & CLOCAL) == 0 &&
- (tp->t_state & TS_CARR_ON) == 0)) {
- tp->t_state |= TS_WOPEN;
- error = ttysleep(tp, (caddr_t)&tp->t_rawq,
- TTIPRI | PCATCH, ttopen, 0);
- if (!DCMCUA(dev) && sc->sc_cua && error == EINTR)
- continue;
- if (error) {
- if (DCMCUA(dev))
- sc->sc_cua = 0;
- splx(s);
- return (error);
- }
- if (!DCMCUA(dev) && sc->sc_cua)
- continue;
- }
- }
- splx(s);
-
-#ifdef DEBUG
- if (dcmdebug & DDB_OPENCLOSE)
- printf("%s port %d: dcmopen: st %x fl %x\n",
- sc->sc_dev.dv_xname, port, tp->t_state, tp->t_flags);
-#endif
- if (error == 0)
- error = (*linesw[tp->t_line].l_open)(dev, tp, p);
-
- return (error);
-}
-
-/*ARGSUSED*/
-int
-dcmclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int s, unit, board, port;
- struct dcm_softc *sc;
- struct tty *tp;
-
- unit = DCMUNIT(dev);
- board = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- sc = dcm_cd.cd_devs[board];
- tp = sc->sc_tty[port];
-
- (*linesw[tp->t_line].l_close)(tp, flag, p);
-
- s = spltty();
-
- if (tp->t_cflag & HUPCL || tp->t_state & TS_WOPEN ||
- (tp->t_state & TS_ISOPEN) == 0)
- (void) dcmmctl(dev, MO_OFF, DMSET);
-#ifdef DEBUG
- if (dcmdebug & DDB_OPENCLOSE)
- printf("%s port %d: dcmclose: st %x fl %x\n",
- sc->sc_dev.dv_xname, port, tp->t_state, tp->t_flags);
-#endif
- sc->sc_cua = 0;
- splx(s);
- ttyclose(tp);
-#if 0
- ttyfree(tp);
- sc->sc_tty[port] == NULL;
-#endif
- return (0);
-}
-
-int
-dcmread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit, board, port;
- struct dcm_softc *sc;
- struct tty *tp;
-
- unit = DCMUNIT(dev);
- board = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- sc = dcm_cd.cd_devs[board];
- tp = sc->sc_tty[port];
-
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-dcmwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit, board, port;
- struct dcm_softc *sc;
- struct tty *tp;
-
- unit = DCMUNIT(dev);
- board = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- sc = dcm_cd.cd_devs[board];
- tp = sc->sc_tty[port];
-
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-struct tty *
-dcmtty(dev)
- dev_t dev;
-{
- int unit, board, port;
- struct dcm_softc *sc;
-
- unit = DCMUNIT(dev);
- board = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- sc = dcm_cd.cd_devs[board];
-
- return (sc->sc_tty[port]);
-}
-
-int
-dcmintr(arg)
- void *arg;
-{
- struct dcm_softc *sc = arg;
- struct dcmdevice *dcm = sc->sc_dcm;
- struct dcmischeme *dis = &sc->sc_scheme;
- int brd = sc->sc_dev.dv_unit;
- int code, i;
- int pcnd[4], mcode, mcnd[4];
-
- /*
- * Do all guarded accesses right off to minimize
- * block out of hardware.
- */
- SEM_LOCK(dcm);
- if ((dcm->dcm_ic & IC_IR) == 0) {
- SEM_UNLOCK(dcm);
- return (0);
- }
-
- for (i = 0; i < 4; i++) {
- pcnd[i] = dcm->dcm_icrtab[i].dcm_data;
- dcm->dcm_icrtab[i].dcm_data = 0;
- code = sc->sc_modem[i]->mdmin;
- if (sc->sc_flags & DCM_STDDCE)
- code = hp2dce_in(code);
- mcnd[i] = code;
- }
- code = dcm->dcm_iir & IIR_MASK;
- dcm->dcm_iir = 0; /* XXX doc claims read clears interrupt?! */
- mcode = dcm->dcm_modemintr;
- dcm->dcm_modemintr = 0;
- SEM_UNLOCK(dcm);
-
-#ifdef DEBUG
- if (dcmdebug & DDB_INTR) {
- printf("%s: dcmintr: iir %x pc %x/%x/%x/%x ",
- sc->sc_dev.dv_xname, code, pcnd[0], pcnd[1],
- pcnd[2], pcnd[3]);
- printf("miir %x mc %x/%x/%x/%x\n",
- mcode, mcnd[0], mcnd[1], mcnd[2], mcnd[3]);
- }
-#endif
- if (code & IIR_TIMEO)
- dcmrint(sc);
- if (code & IIR_PORT0)
- dcmpint(sc, 0, pcnd[0]);
- if (code & IIR_PORT1)
- dcmpint(sc, 1, pcnd[1]);
- if (code & IIR_PORT2)
- dcmpint(sc, 2, pcnd[2]);
- if (code & IIR_PORT3)
- dcmpint(sc, 3, pcnd[3]);
- if (code & IIR_MODM) {
- if (mcode == 0 || mcode & 0x1) /* mcode==0 -> 98642 board */
- dcmmint(sc, 0, mcnd[0]);
- if (mcode & 0x2)
- dcmmint(sc, 1, mcnd[1]);
- if (mcode & 0x4)
- dcmmint(sc, 2, mcnd[2]);
- if (mcode & 0x8)
- dcmmint(sc, 3, mcnd[3]);
- }
-
- /*
- * Chalk up a receiver interrupt if the timer running or one of
- * the ports reports a special character interrupt.
- */
- if ((code & IIR_TIMEO) ||
- ((pcnd[0]|pcnd[1]|pcnd[2]|pcnd[3]) & IT_SPEC))
- dis->dis_intr++;
- /*
- * See if it is time to check/change the interrupt rate.
- */
- if (dcmistype < 0 &&
- (i = time_second - dis->dis_time) >= dcminterval) {
- /*
- * If currently per-character and averaged over 70 interrupts
- * per-second (66 is threshold of 600 baud) in last interval,
- * switch to timer mode.
- *
- * XXX decay counts ala load average to avoid spikes?
- */
- if (dis->dis_perchar && dis->dis_intr > 70 * i)
- dcmsetischeme(brd, DIS_TIMER);
- /*
- * If currently using timer and had more interrupts than
- * received characters in the last interval, switch back
- * to per-character. Note that after changing to per-char
- * we must process any characters already in the queue
- * since they may have arrived before the bitmap was setup.
- *
- * XXX decay counts?
- */
- else if (!dis->dis_perchar && dis->dis_intr > dis->dis_char) {
- dcmsetischeme(brd, DIS_PERCHAR);
- dcmrint(sc);
- }
- dis->dis_intr = dis->dis_char = 0;
- dis->dis_time = time_second;
- }
- return (1);
-}
-
-/*
- * Port interrupt. Can be two things:
- * First, it might be a special character (exception interrupt);
- * Second, it may be a buffer empty (transmit interrupt);
- */
-void
-dcmpint(sc, port, code)
- struct dcm_softc *sc;
- int port, code;
-{
-
- if (code & IT_SPEC)
- dcmreadbuf(sc, port);
- if (code & IT_TX)
- dcmxint(sc, port);
-}
-
-void
-dcmrint(sc)
- struct dcm_softc *sc;
-{
- int port;
-
- for (port = 0; port < NDCMPORT; port++)
- dcmreadbuf(sc, port);
-}
-
-void
-dcmreadbuf(sc, port)
- struct dcm_softc *sc;
- int port;
-{
- struct dcmdevice *dcm = sc->sc_dcm;
- struct dcmpreg *pp = dcm_preg(dcm, port);
- struct dcmrfifo *fifo;
- struct tty *tp;
- int c, stat;
- u_int head;
- int nch = 0;
-#ifdef DCMSTATS
- struct dcmstats *dsp = &sc->sc_stats;
-
- dsp->rints++;
-#endif
- tp = sc->sc_tty[port];
- if (tp == NULL)
- return;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
-#ifdef KGDB
- if ((makedev(dcmmajor, minor(tp->t_dev)) == kgdb_dev) &&
- (head = pp->r_head & RX_MASK) != (pp->r_tail & RX_MASK) &&
- dcm->dcm_rfifos[3-port][head>>1].data_char == FRAME_START) {
- pp->r_head = (head + 2) & RX_MASK;
- kgdb_connect(0); /* trap into kgdb */
- return;
- }
-#endif /* KGDB */
- pp->r_head = pp->r_tail & RX_MASK;
- return;
- }
-
- head = pp->r_head & RX_MASK;
- fifo = &dcm->dcm_rfifos[3-port][head>>1];
- /*
- * XXX upper bound on how many chars we will take in one swallow?
- */
- while (head != (pp->r_tail & RX_MASK)) {
- /*
- * Get character/status and update head pointer as fast
- * as possible to make room for more characters.
- */
- c = fifo->data_char;
- stat = fifo->data_stat;
- head = (head + 2) & RX_MASK;
- pp->r_head = head;
- fifo = head ? fifo+1 : &dcm->dcm_rfifos[3-port][0];
- nch++;
-
-#ifdef DEBUG
- if (dcmdebug & DDB_INPUT)
- printf("%s port %d: dcmreadbuf: c%x('%c') s%x f%x h%x t%x\n",
- sc->sc_dev.dv_xname, port,
- c&0xFF, c, stat&0xFF,
- tp->t_flags, head, pp->r_tail);
-#endif
- /*
- * Check for and handle errors
- */
- if (stat & RD_MASK) {
-#ifdef DEBUG
- if (dcmdebug & (DDB_INPUT|DDB_SIOERR))
- printf("%s port %d: dcmreadbuf: err: c%x('%c') s%x\n",
- sc->sc_dev.dv_xname, port,
- stat, c&0xFF, c);
-#endif
- if (stat & (RD_BD | RD_FE))
- c |= TTY_FE;
- else if (stat & RD_PE)
- c |= TTY_PE;
- else if (stat & RD_OVF)
- log(LOG_WARNING,
- "%s port %d: silo overflow\n",
- sc->sc_dev.dv_xname, port);
- else if (stat & RD_OE)
- log(LOG_WARNING,
- "%s port %d: uart overflow\n",
- sc->sc_dev.dv_xname, port);
- }
- (*linesw[tp->t_line].l_rint)(c, tp);
- }
- sc->sc_scheme.dis_char += nch;
-
-#ifdef DCMSTATS
- dsp->rchars += nch;
- if (nch <= DCMRBSIZE)
- dsp->rsilo[nch]++;
- else
- dsp->rsilo[DCMRBSIZE+1]++;
-#endif
-}
-
-void
-dcmxint(sc, port)
- struct dcm_softc *sc;
- int port;
-{
- struct tty *tp;
-
- tp = sc->sc_tty[port];
- if (tp == NULL || (tp->t_state & TS_ISOPEN) == 0)
- return;
-
- tp->t_state &= ~TS_BUSY;
- if (tp->t_state & TS_FLUSH)
- tp->t_state &= ~TS_FLUSH;
- (*linesw[tp->t_line].l_start)(tp);
-}
-
-void
-dcmmint(sc, port, mcnd)
- struct dcm_softc *sc;
- int port, mcnd;
-{
- int delta;
- struct tty *tp;
- struct dcmdevice *dcm = sc->sc_dcm;
-
- tp = sc->sc_tty[port];
- if (tp == NULL || (tp->t_state & TS_ISOPEN) == 0)
- return;
-
-#ifdef DEBUG
- if (dcmdebug & DDB_MODEM)
- printf("%s port %d: dcmmint: mcnd %x mcndlast %x\n",
- sc->sc_dev.dv_xname, port, mcnd, sc->sc_mcndlast[port]);
-#endif
- delta = mcnd ^ sc->sc_mcndlast[port];
- sc->sc_mcndlast[port] = mcnd;
- if ((delta & MI_CTS) && (tp->t_state & TS_ISOPEN) &&
- (tp->t_flags & CCTS_OFLOW)) {
- if (mcnd & MI_CTS) {
- tp->t_state &= ~TS_TTSTOP;
- ttstart(tp);
- } else
- tp->t_state |= TS_TTSTOP; /* inline dcmstop */
- }
- if (delta & MI_CD) {
- if (mcnd & MI_CD)
- (void)(*linesw[tp->t_line].l_modem)(tp, 1);
- else if ((sc->sc_softCAR & (1 << port)) == 0 &&
- (*linesw[tp->t_line].l_modem)(tp, 0) == 0) {
- sc->sc_modem[port]->mdmout = MO_OFF;
- SEM_LOCK(dcm);
- dcm->dcm_modemchng |= (1 << port);
- dcm->dcm_cr |= CR_MODM;
- SEM_UNLOCK(dcm);
- DELAY(10); /* time to change lines */
- }
- }
-}
-
-int
-dcmioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct dcm_softc *sc;
- struct tty *tp;
- struct dcmdevice *dcm;
- int board, port, unit = DCMUNIT(dev);
- int error, s;
-
- port = DCMPORT(unit);
- board = DCMBOARD(unit);
-
- sc = dcm_cd.cd_devs[board];
- dcm = sc->sc_dcm;
- tp = sc->sc_tty[port];
-
-#ifdef DEBUG
- if (dcmdebug & DDB_IOCTL)
- printf("%s port %d: dcmioctl: cmd %lx data %x flag %x\n",
- sc->sc_dev.dv_xname, port, cmd, *data, flag);
-#endif
- 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:
- /*
- * Wait for transmitter buffer to empty
- */
- s = spltty();
- while (dcm->dcm_thead[port].ptr != dcm->dcm_ttail[port].ptr)
- DELAY(DCM_USPERCH(tp->t_ospeed));
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_BRK;
- dcm->dcm_cr |= (1 << port); /* start break */
- SEM_UNLOCK(dcm);
- splx(s);
- break;
-
- case TIOCCBRK:
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_BRK;
- dcm->dcm_cr |= (1 << port); /* end break */
- SEM_UNLOCK(dcm);
- break;
-
- case TIOCSDTR:
- (void) dcmmctl(dev, MO_ON, DMBIS);
- break;
-
- case TIOCCDTR:
- (void) dcmmctl(dev, MO_ON, DMBIC);
- break;
-
- case TIOCMSET:
- (void) dcmmctl(dev, *(int *)data, DMSET);
- break;
-
- case TIOCMBIS:
- (void) dcmmctl(dev, *(int *)data, DMBIS);
- break;
-
- case TIOCMBIC:
- (void) dcmmctl(dev, *(int *)data, DMBIC);
- break;
-
- case TIOCMGET:
- *(int *)data = dcmmctl(dev, 0, DMGET);
- break;
-
- case TIOCGFLAGS: {
- int bits = 0;
-
- if ((sc->sc_softCAR & (1 << port)))
- bits |= TIOCFLAG_SOFTCAR;
-
- if (tp->t_cflag & CLOCAL)
- bits |= TIOCFLAG_CLOCAL;
-
- *(int *)data = bits;
- break;
- }
-
- case TIOCSFLAGS: {
- int userbits;
-
- error = suser(p, 0);
- if (error)
- return (EPERM);
-
- userbits = *(int *)data;
-
- if ((userbits & TIOCFLAG_SOFTCAR) ||
- ((sc->sc_flags & DCM_ISCONSOLE) &&
- (port == DCMCONSPORT)))
- sc->sc_softCAR |= (1 << port);
-
- if (userbits & TIOCFLAG_CLOCAL)
- tp->t_cflag |= CLOCAL;
-
- break;
- }
-
- default:
- return (ENOTTY);
- }
- return (0);
-}
-
-int
-dcmparam(tp, t)
- struct tty *tp;
- struct termios *t;
-{
- struct dcm_softc *sc;
- struct dcmdevice *dcm;
- int unit, board, port, mode, cflag = t->c_cflag;
- int ospeed = ttspeedtab(t->c_ospeed, dcmspeedtab);
-
- unit = DCMUNIT(tp->t_dev);
- board = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- sc = dcm_cd.cd_devs[board];
- dcm = sc->sc_dcm;
-
- /* check requested parameters */
- if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed))
- return (EINVAL);
- /* and copy to tty */
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = cflag;
- if (ospeed == 0) {
- (void) dcmmctl(DCMUNIT(tp->t_dev), MO_OFF, DMSET);
- return (0);
- }
-
- mode = 0;
- switch (cflag&CSIZE) {
- case CS5:
- mode = LC_5BITS; break;
- case CS6:
- mode = LC_6BITS; break;
- case CS7:
- mode = LC_7BITS; break;
- case CS8:
- mode = LC_8BITS; break;
- }
- if (cflag&PARENB) {
- if (cflag&PARODD)
- mode |= LC_PODD;
- else
- mode |= LC_PEVEN;
- }
- if (cflag&CSTOPB)
- mode |= LC_2STOP;
- else
- mode |= LC_1STOP;
-#ifdef DEBUG
- if (dcmdebug & DDB_PARAM)
- printf("%s port %d: dcmparam: cflag %x mode %x speed %d uperch %d\n",
- sc->sc_dev.dv_xname, port, cflag, mode, tp->t_ospeed,
- DCM_USPERCH(tp->t_ospeed));
-#endif
-
- /*
- * Wait for transmitter buffer to empty.
- */
- while (dcm->dcm_thead[port].ptr != dcm->dcm_ttail[port].ptr)
- DELAY(DCM_USPERCH(tp->t_ospeed));
- /*
- * Make changes known to hardware.
- */
- dcm->dcm_data[port].dcm_baud = ospeed;
- dcm->dcm_data[port].dcm_conf = mode;
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_CON;
- dcm->dcm_cr |= (1 << port);
- SEM_UNLOCK(dcm);
- /*
- * Delay for config change to take place. Weighted by baud.
- * XXX why do we do this?
- */
- DELAY(16 * DCM_USPERCH(tp->t_ospeed));
- return (0);
-}
-
-void
-dcmstart(tp)
- struct tty *tp;
-{
- struct dcm_softc *sc;
- struct dcmdevice *dcm;
- struct dcmpreg *pp;
- struct dcmtfifo *fifo;
- char *bp;
- u_int head, tail, next;
- int unit, board, port, nch;
- char buf[16];
- int s;
-#ifdef DCMSTATS
- struct dcmstats *dsp = &sc->sc_stats;
- int tch = 0;
-#endif
-
- unit = DCMUNIT(tp->t_dev);
- board = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- sc = dcm_cd.cd_devs[board];
- dcm = sc->sc_dcm;
-
- s = spltty();
-#ifdef DCMSTATS
- dsp->xints++;
-#endif
-#ifdef DEBUG
- if (dcmdebug & DDB_OUTPUT)
- printf("%s port %d: dcmstart: state %x flags %x outcc %d\n",
- sc->sc_dev.dv_xname, port, tp->t_state, tp->t_flags,
- tp->t_outq.c_cc);
-#endif
- if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
- goto out;
- ttwakeupwr(tp);
- if (tp->t_outq.c_cc == 0) {
-#ifdef DCMSTATS
- dsp->xempty++;
-#endif
- goto out;
- }
-
- pp = dcm_preg(dcm, port);
- tail = pp->t_tail & TX_MASK;
- next = (tail + 1) & TX_MASK;
- head = pp->t_head & TX_MASK;
- if (head == next)
- goto out;
- fifo = &dcm->dcm_tfifos[3-port][tail];
-again:
- nch = q_to_b(&tp->t_outq, buf, (head - next) & TX_MASK);
-#ifdef DCMSTATS
- tch += nch;
-#endif
-#ifdef DEBUG
- if (dcmdebug & DDB_OUTPUT)
- printf("\thead %x tail %x nch %d\n", head, tail, nch);
-#endif
- /*
- * Loop transmitting all the characters we can.
- */
- for (bp = buf; --nch >= 0; bp++) {
- fifo->data_char = *bp;
- pp->t_tail = next;
- /*
- * If this is the first character,
- * get the hardware moving right now.
- */
- if (bp == buf) {
- tp->t_state |= TS_BUSY;
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_TX;
- dcm->dcm_cr |= (1 << port);
- SEM_UNLOCK(dcm);
- }
- tail = next;
- fifo = tail ? fifo+1 : &dcm->dcm_tfifos[3-port][0];
- next = (next + 1) & TX_MASK;
- }
- /*
- * Head changed while we were loading the buffer,
- * go back and load some more if we can.
- */
- if (tp->t_outq.c_cc && head != (pp->t_head & TX_MASK)) {
-#ifdef DCMSTATS
- dsp->xrestarts++;
-#endif
- head = pp->t_head & TX_MASK;
- goto again;
- }
-
- /*
- * Kick it one last time in case it finished while we were
- * loading the last bunch.
- */
- if (bp > &buf[1]) {
- tp->t_state |= TS_BUSY;
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_TX;
- dcm->dcm_cr |= (1 << port);
- SEM_UNLOCK(dcm);
- }
-#ifdef DEBUG
- if (dcmdebug & DDB_INTR)
- printf("%s port %d: dcmstart: head %x tail %x outqcc %d\n",
- sc->sc_dev.dv_xname, port, head, tail, tp->t_outq.c_cc);
-#endif
-out:
-#ifdef DCMSTATS
- dsp->xchars += tch;
- if (tch <= DCMXBSIZE)
- dsp->xsilo[tch]++;
- else
- dsp->xsilo[DCMXBSIZE+1]++;
-#endif
- splx(s);
-}
-
-/*
- * Stop output on a line.
- */
-int
-dcmstop(tp, flag)
- struct tty *tp;
- int flag;
-{
- int s;
-
- s = spltty();
- if (tp->t_state & TS_BUSY) {
- /* XXX is there some way to safely stop transmission? */
- if ((tp->t_state&TS_TTSTOP) == 0)
- tp->t_state |= TS_FLUSH;
- }
- splx(s);
- return (0);
-}
-
-/*
- * Modem control
- */
-int
-dcmmctl(dev, bits, how)
- dev_t dev;
- int bits, how;
-{
- struct dcm_softc *sc;
- struct dcmdevice *dcm;
- int s, unit, brd, port, hit = 0;
-
- unit = DCMUNIT(dev);
- brd = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- sc = dcm_cd.cd_devs[brd];
- dcm = sc->sc_dcm;
-
-#ifdef DEBUG
- if (dcmdebug & DDB_MODEM)
- printf("%s port %d: dcmmctl: bits 0x%x how %x\n",
- sc->sc_dev.dv_xname, port, bits, how);
-#endif
-
- s = spltty();
-
- switch (how) {
- case DMSET:
- sc->sc_modem[port]->mdmout = bits;
- hit++;
- break;
-
- case DMBIS:
- sc->sc_modem[port]->mdmout |= bits;
- hit++;
- break;
-
- case DMBIC:
- sc->sc_modem[port]->mdmout &= ~bits;
- hit++;
- break;
-
- case DMGET:
- bits = sc->sc_modem[port]->mdmin;
- if (sc->sc_flags & DCM_STDDCE)
- bits = hp2dce_in(bits);
- break;
- }
- if (hit) {
- SEM_LOCK(dcm);
- dcm->dcm_modemchng |= 1<<(unit & 3);
- dcm->dcm_cr |= CR_MODM;
- SEM_UNLOCK(dcm);
- DELAY(10); /* delay until done */
- splx(s);
- }
- return (bits);
-}
-
-/*
- * Set board to either interrupt per-character or at a fixed interval.
- */
-void
-dcmsetischeme(brd, flags)
- int brd, flags;
-{
- struct dcm_softc *sc = dcm_cd.cd_devs[brd];
- struct dcmdevice *dcm = sc->sc_dcm;
- struct dcmischeme *dis = &sc->sc_scheme;
- int i;
- u_char mask;
- int perchar = flags & DIS_PERCHAR;
-
-#ifdef DEBUG
- if (dcmdebug & DDB_INTSCHM)
- printf("%s: dcmsetischeme(%d): cur %d, ints %d, chars %d\n",
- sc->sc_dev.dv_xname, perchar, dis->dis_perchar,
- dis->dis_intr, dis->dis_char);
- if ((flags & DIS_RESET) == 0 && perchar == dis->dis_perchar) {
- printf("%s: dcmsetischeme: redundant request %d\n",
- sc->sc_dev.dv_xname, perchar);
- return;
- }
-#endif
- /*
- * If perchar is non-zero, we enable interrupts on all characters
- * otherwise we disable perchar interrupts and use periodic
- * polling interrupts.
- */
- dis->dis_perchar = perchar;
- mask = perchar ? 0xf : 0x0;
- for (i = 0; i < 256; i++)
- dcm->dcm_bmap[i].data_data = mask;
- /*
- * Don't slow down tandem mode, interrupt on flow control
- * chars for any port on the board.
- */
- if (!perchar) {
- struct tty *tp;
- int c;
-
- for (i = 0; i < NDCMPORT; i++) {
- tp = sc->sc_tty[i];
-
- if ((c = tp->t_cc[VSTART]) != _POSIX_VDISABLE)
- dcm->dcm_bmap[c].data_data |= (1 << i);
- if ((c = tp->t_cc[VSTOP]) != _POSIX_VDISABLE)
- dcm->dcm_bmap[c].data_data |= (1 << i);
- }
- }
- /*
- * Board starts with timer disabled so if first call is to
- * set perchar mode then we don't want to toggle the timer.
- */
- if (flags == (DIS_RESET|DIS_PERCHAR))
- return;
- /*
- * Toggle card 16.7ms interrupts (we first make sure that card
- * has cleared the bit so it will see the toggle).
- */
- while (dcm->dcm_cr & CR_TIMER)
- ;
- SEM_LOCK(dcm);
- dcm->dcm_cr |= CR_TIMER;
- SEM_UNLOCK(dcm);
-}
-
-void
-dcminit(dcm, port, rate)
- struct dcmdevice *dcm;
- int port, rate;
-{
- int s, mode;
-
- mode = LC_8BITS | LC_1STOP;
-
- s = splhigh();
-
- /*
- * Wait for transmitter buffer to empty.
- */
- while (dcm->dcm_thead[port].ptr != dcm->dcm_ttail[port].ptr)
- DELAY(DCM_USPERCH(rate));
-
- /*
- * Make changes known to hardware.
- */
- dcm->dcm_data[port].dcm_baud = ttspeedtab(rate, dcmspeedtab);
- dcm->dcm_data[port].dcm_conf = mode;
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_CON;
- dcm->dcm_cr |= (1 << port);
- SEM_UNLOCK(dcm);
-
- /*
- * Delay for config change to take place. Weighted by baud.
- * XXX why do we do this?
- */
- DELAY(16 * DCM_USPERCH(rate));
- splx(s);
-}
-
-/*
- * Empirically derived self-test magic
- */
-int
-dcmselftest(sc)
- struct dcm_softc *sc;
-{
- struct dcmdevice *dcm = sc->sc_dcm;
- int timo = 0;
- int s, rv;
-
- rv = 1;
-
- s = splhigh();
- dcm->dcm_rsid = DCMRS;
- DELAY(50000); /* 5000 is not long enough */
- dcm->dcm_rsid = 0;
- dcm->dcm_ic = IC_IE;
- dcm->dcm_cr = CR_SELFT;
- while ((dcm->dcm_ic & IC_IR) == 0) {
- if (++timo == 20000)
- goto out;
- DELAY(1);
- }
- DELAY(50000); /* XXX why is this needed ???? */
- while ((dcm->dcm_iir & IIR_SELFT) == 0) {
- if (++timo == 400000)
- goto out;
- DELAY(1);
- }
- DELAY(50000); /* XXX why is this needed ???? */
- if (dcm->dcm_stcon != ST_OK) {
-#if 0
- if (hd->hp_args->hw_sc != conscode)
- printf("dcm%d: self test failed: %x\n",
- brd, dcm->dcm_stcon);
-#endif
- goto out;
- }
- dcm->dcm_ic = IC_ID;
- rv = 0;
-
- out:
- splx(s);
- return (rv);
-}
-
-/*
- * Following are all routines needed for DCM to act as console
- */
-
-int
-dcm_console_scan(scode, va, arg)
- int scode;
- caddr_t va;
- void *arg;
-{
- struct dcmdevice *dcm = (struct dcmdevice *)va;
- struct consdev *cp = arg;
- u_int pri;
-
- switch (dcm->dcm_rsid) {
- case DCMID:
- pri = CN_LOWPRI;
- break;
-
- case DCMID|DCMCON:
- pri = CN_HIGHPRI;
- break;
-
- default:
- return (0);
- }
-
-#ifdef CONSCODE
- /*
- * Raise our priority, if appropriate.
- */
- if (scode == CONSCODE)
- pri = CN_FORCED;
-#endif
-
- /* Only raise priority. */
- if (pri > cp->cn_pri)
- cp->cn_pri = pri;
-
- /*
- * If our priority is higher than the currently-remembered
- * console, stash our priority, for the benefit of dcmcninit().
- */
- if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) {
- cn_tab = cp;
- conscode = scode;
- return (DIO_SIZE(scode, va));
- }
- return (0);
-}
-
-void
-dcmcnprobe(cp)
- struct consdev *cp;
-{
-
- /* locate the major number */
- for (dcmmajor = 0; dcmmajor < nchrdev; dcmmajor++)
- if (cdevsw[dcmmajor].d_open == dcmopen)
- break;
-
- /* initialize required fields */
- cp->cn_dev = makedev(dcmmajor, 0); /* XXX */
-
- console_scan(dcm_console_scan, cp);
-
-#ifdef KGDB_CHEAT
- /* XXX this needs to be fixed. */
- /*
- * This doesn't currently work, at least not with ite consoles;
- * the console hasn't been initialized yet.
- */
- if (major(kgdb_dev) == dcmmajor &&
- DCMBOARD(DCMUNIT(kgdb_dev)) == DCMBOARD(unit)) {
- dcminit(dcm_cn, DCMPORT(DCMUNIT(kgdb_dev)), kgdb_rate);
- if (kgdb_debug_init) {
- /*
- * We assume that console is ready for us...
- * this assumes that a dca or ite console
- * has been selected already and will init
- * on the first putc.
- */
- printf("dcm%d: ", DCMUNIT(kgdb_dev));
- kgdb_connect(1);
- }
- }
-#endif
-}
-
-/* ARGSUSED */
-void
-dcmcninit(cp)
- struct consdev *cp;
-{
-
- /*
- * We are not interested by the second console pass.
- */
- if (consolepass != 0)
- return;
-
- dcm_cn = (struct dcmdevice *)conaddr;
- dcminit(dcm_cn, DCMCONSPORT, dcmdefaultrate);
- dcmconsinit = 1;
-}
-
-/* ARGSUSED */
-int
-dcmcngetc(dev)
- dev_t dev;
-{
- struct dcmrfifo *fifo;
- struct dcmpreg *pp;
- u_int head;
- int s, c, stat;
-
- pp = dcm_preg(dcm_cn, DCMCONSPORT);
-
- s = splhigh();
- head = pp->r_head & RX_MASK;
- fifo = &dcm_cn->dcm_rfifos[3-DCMCONSPORT][head>>1];
- while (head == (pp->r_tail & RX_MASK))
- ;
- /*
- * If board interrupts are enabled, just let our received char
- * interrupt through in case some other port on the board was
- * busy. Otherwise we must clear the interrupt.
- */
- SEM_LOCK(dcm_cn);
- if ((dcm_cn->dcm_ic & IC_IE) == 0)
- stat = dcm_cn->dcm_iir;
- SEM_UNLOCK(dcm_cn);
- c = fifo->data_char;
- stat = fifo->data_stat;
- pp->r_head = (head + 2) & RX_MASK;
- splx(s);
- return (c);
-}
-
-/*
- * Console kernel output character routine.
- */
-/* ARGSUSED */
-void
-dcmcnputc(dev, c)
- dev_t dev;
- int c;
-{
- struct dcmpreg *pp;
- unsigned tail;
- int s, stat;
-
- pp = dcm_preg(dcm_cn, DCMCONSPORT);
-
- s = splhigh();
-#ifdef KGDB
- if (dev != kgdb_dev)
-#endif
- if (dcmconsinit == 0) {
- dcminit(dcm_cn, DCMCONSPORT, dcmdefaultrate);
- dcmconsinit = 1;
- }
- tail = pp->t_tail & TX_MASK;
- while (tail != (pp->t_head & TX_MASK))
- ;
- dcm_cn->dcm_tfifos[3-DCMCONSPORT][tail].data_char = c;
- pp->t_tail = tail = (tail + 1) & TX_MASK;
- SEM_LOCK(dcm_cn);
- dcm_cn->dcm_cmdtab[DCMCONSPORT].dcm_data |= CT_TX;
- dcm_cn->dcm_cr |= (1 << DCMCONSPORT);
- SEM_UNLOCK(dcm_cn);
- while (tail != (pp->t_head & TX_MASK))
- ;
- /*
- * If board interrupts are enabled, just let our completion
- * interrupt through in case some other port on the board
- * was busy. Otherwise we must clear the interrupt.
- */
- if ((dcm_cn->dcm_ic & IC_IE) == 0) {
- SEM_LOCK(dcm_cn);
- stat = dcm_cn->dcm_iir;
- SEM_UNLOCK(dcm_cn);
- }
- splx(s);
-}
diff --git a/sys/arch/hp300/dev/dcmreg.h b/sys/arch/hp300/dev/dcmreg.h
deleted file mode 100644
index 2b7e49deba1..00000000000
--- a/sys/arch/hp300/dev/dcmreg.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/* $OpenBSD: dcmreg.h,v 1.5 2007/05/25 21:27:15 krw Exp $ */
-/* $NetBSD: dcmreg.h,v 1.5 1996/02/24 00:55:05 thorpej 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.
- *
- * from: Utah $Hdr: dcmreg.h 1.7 92/01/21$
- *
- * @(#)dcmreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-struct dcmdevice { /* host address, only odd bytes addressed */
- u_char dcm_pad0;
- vu_char dcm_rsid; /* Reset / ID 0001 */
- u_char dcm_pad1;
- vu_char dcm_ic; /* Interrupt control register 0003 */
- u_char dcm_pad2;
- vu_char dcm_sem; /* Semaphore register 0005 */
- u_char dcm_pad3[0x7ffa]; /* Unaddressable 0006-7fff */
- u_char dcm_pad4;
- vu_char dcm_iir; /* Interrupt ident register 8001 */
- u_char dcm_pad5;
- vu_char dcm_cr; /* Command register 8003 */
- u_char dcm_pad6[0x3fc]; /* Card scratch 8004-83ff */
- struct dcmrfifo {
- u_char ptr_pad1;
- vu_char data_char;
- u_char ptr_pad2;
- vu_char data_stat;
- } dcm_rfifos[4][0x80]; /* Receive queues 8400 */
- struct {
- u_char ptr_pad1;
- vu_char data_data;
- } dcm_bmap[0x100]; /* Bitmap table 8c00 */
- struct {
- u_char ptr_pad;
- vu_char ptr;
- } dcm_rhead[4]; /* Fifo head - receive 8e00 */
- struct {
- u_char ptr_pad;
- vu_char ptr;
- } dcm_rtail[4]; /* Fifo tail - receive 8e08 */
- struct {
- u_char ptr_pad;
- vu_char ptr;
- } dcm_thead[4]; /* Fifo head - transmit 8e10 */
- struct {
- u_char ptr_pad;
- vu_char ptr;
- } dcm_ttail[4]; /* Fifo tail - transmit 8e18 */
- struct {
- u_char pad1;
- vu_char dcm_conf;
- u_char pad2;
- vu_char dcm_baud;
- } dcm_data[4]; /* Configuration registers 8e20 */
- struct modemreg {
- u_char pad0;
- vu_char mdmin; /* Modem in 8e31 */
- u_char pad1;
- vu_char mdmout; /* Modem out 8e33 */
- u_char pad2;
- vu_char mdmmsk; /* Modem mask 8e35 */
- } dcm_modem0;
- struct {
- u_char pad1;
- vu_char dcm_data;
- } dcm_cmdtab[4]; /* Command tables 8e36 */
- struct {
- u_char pad1;
- vu_char dcm_data;
- } dcm_icrtab[4]; /* Interrupt data 8e3e */
- u_char dcm_pad10;
- vu_char dcm_stcon; /* Self test condition 8e47 */
- struct modemreg dcm_modem1; /* 638 Modem port1 8e48 */
- struct modemreg dcm_modem2; /* 638 Modem port2 8e4e */
- struct modemreg dcm_modem3; /* 638 Modem port3 8e54 */
- u_char dcm_pad11;
- vu_char dcm_modemchng; /* 638 Modem change mask 8e5b */
- u_char dcm_pad12;
- vu_char dcm_modemintr; /* 638 Modem interrupt mask 8e5d */
- u_char dcm_pad13[0x82]; /* Undef Shared Ram 8e5e-8edf */
- struct dcmtfifo {
- u_char ptr_pad1;
- vu_char data_char;
- } dcm_tfifos[4][0x10]; /* Transmit queues 8ee0 */
-};
-
-/*
- * Overlay structure for port specific queue "registers".
- * Starts at offset 0x8E00+(port*2).
- */
-struct dcmpreg {
- u_char pad0; /* +00 */
- vu_char r_head; /* +01 */
- u_char pad1[7]; /* +02 */
- vu_char r_tail; /* +09 */
- u_char pad2[7]; /* +0A */
- vu_char t_head; /* +11 */
- u_char pad3[7]; /* +12 */
- vu_char t_tail; /* +19 */
-};
-#define dcm_preg(d, p) ((struct dcmpreg *)((u_int)(d)+0x8e00+(p)*2))
-
-/* interface reset/id */
-#define DCMCON 0x80 /* REMOTE/LOCAL switch, read */
-#define DCMID 0x5 /* hardwired card id, read */
-#define DCMRS 0x80 /* software reset, write */
-
-/* interrupt control */
-#define DCMIPL(x) ((((x) >> 4) & 3) + 3) /* interrupt level, read */
-#define IC_IR 0x40 /* interrupt request, read */
-#define IC_IE 0x80 /* interrupt enable, write */
-#define IC_ID 0x00 /* interrupt disable, write */
-
-
-/* Semaphore control */
-#define SEM_BSY 0x80 /* read */
-#define SEM_CLR 0xFF /* write */
-#define SEM_LOCK(dcm) while ((dcm)->dcm_sem & SEM_BSY)
-#define SEM_UNLOCK(dcm) (dcm)->dcm_sem = SEM_CLR
-
-/* command register */
-#define CR_PORT0 0x1
-#define CR_PORT1 0x2
-#define CR_PORT2 0x4
-#define CR_PORT3 0x8
-#define CR_MODM 0x10 /* change modem output lines */
-#define CR_TIMER 0x20 /* 16ms interrupt timer toggle */
-#define CR_SELFT 0x40 /* run self test */
-#define CR_MASK 0x7f
-
-/* interrupt ident register */
-#define IIR_PORT0 0x1
-#define IIR_PORT1 0x2
-#define IIR_PORT2 0x4
-#define IIR_PORT3 0x8
-#define IIR_SELFT 0x10 /* self test completed */
-#define IIR_MODM 0x20 /* change in modem input lines */
-#define IIR_TIMEO 0x40 /* Time out */
-#define IIR_MASK 0x7f
-
-/* self test cond reg */
-#define ST_OK 0xe0
-
-/* Line configuration register */
-#define LC_PNO 0x00
-#define LC_PODD 0x01
-#define LC_PEVEN 0x02
-#define LC_PMSK 0x03
-
-#define LC_1STOP 0x00
-#define LC_1HSTOP 0x04
-#define LC_2STOP 0x08
-#define LC_STOPMSK 0x0b
-
-#define LC_8BITS 0x30
-#define LC_7BITS 0x20
-#define LC_6BITS 0x10
-#define LC_5BITS 0x00
-#define LC_BITMSK 0x30
-
-/* baud reg */
-#define BR_0 0x00
-#define BR_50 0x01
-#define BR_75 0x02
-#define BR_110 0x03
-#define BR_134 0x04
-#define BR_150 0x05
-#define BR_300 0x06
-#define BR_600 0x07
-#define BR_900 0x08
-#define BR_1200 0x09
-#define BR_1800 0x0a
-#define BR_2400 0x0b
-#define BR_3600 0x0c
-#define BR_4800 0x0d
-#define BR_7200 0x0e
-#define BR_9600 0x0f
-#define BR_19200 0x10
-#define BR_38400 0x11
-
-/* modem input register */
-#define MI_CTS 0x08
-#define MI_DM 0x04
-#define MI_CD 0x02
-#define MI_RI 0x01
-
-/* modem output register */
-#define MO_SR 0x04
-#define MO_DTR 0x02
-#define MO_RTS 0x01
-#define MO_ON ((MO_DTR) | (MO_RTS))
-#define MO_OFF 0x00
-
-/* cmd-tab values, write */
-#define CT_CON 0x1 /* configuration change */
-#define CT_TX 0x2 /* transmit buffer not empty */
-#define CT_BRK 0x4 /* toggle BREAK */
-
-/* icr-tab values, read */
-#define IT_TX 0x1 /* transmit buffer empty */
-#define IT_SPEC 0x2 /* special character received */
-
-/* data errors */
-#define RD_OVF 0x08
-#define RD_BD 0x10
-#define RD_PE 0x20
-#define RD_OE 0x40
-#define RD_FE 0x80
-#define RD_MASK 0xf8
-
-/* Transmit/Receive masks */
-#define TX_MASK 0x0f
-#define RX_MASK 0xff
-
-/*
- * DCM console caveat: only port 1 is affected by the remote switch, and
- * thus the only supported console port on a given DCM card.
- */
-#define DCMCONSPORT 1
diff --git a/sys/arch/hp300/dev/devlist2h.awk b/sys/arch/hp300/dev/devlist2h.awk
deleted file mode 100644
index 0354a5fe0d1..00000000000
--- a/sys/arch/hp300/dev/devlist2h.awk
+++ /dev/null
@@ -1,167 +0,0 @@
-#! /usr/bin/awk -f
-#
-# $OpenBSD: devlist2h.awk,v 1.2 1997/02/03 04:47:16 downsj Exp $
-# $NetBSD: devlist2h.awk,v 1.2 1997/01/30 09:18:36 thorpej Exp $
-#
-# Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
-# Copyright (c) 1995, 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.
-# 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.
-#
-BEGIN {
- ndevices = 0
- fbid = 0
- dfile="diodevs_data.h"
- hfile="diodevs.h"
-}
-NR == 1 {
- VERSION = $0
- gsub("\\$", "", VERSION)
-
- printf("/*\n") > dfile
- printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
- > dfile
- printf(" *\n") > dfile
- printf(" * generated from:\n") > dfile
- printf(" *\t%s\n", VERSION) > dfile
- printf(" */\n") > dfile
-
- printf("/*\n") > hfile
- printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
- > hfile
- printf(" *\n") > hfile
- printf(" * generated from:\n") > hfile
- printf(" *\t%s\n", VERSION) > hfile
- printf(" */\n") > hfile
-
- next
-}
-$1 == "device" {
- ndevices++
-
- devices[ndevices, 1] = $2 # nickname
- devices[ndevices, 2] = $3 # dio primary id
- devices[ndevices, 3] = "0" # dio secondary id
- devices[ndevices, 4] = $4 # number of select codes
- # used by device
-
- # if this is the framebuffer entry, save the primary id
- if ($2 == "FRAMEBUFFER") {
- fbid = $3;
- }
-
- # emit device primary id
- printf("\n#define\tDIO_DEVICE_ID_%s\t%s\n", devices[ndevices, 1], \
- devices[ndevices, 2]) > hfile
-
- # emit description
- printf("#define\tDIO_DEVICE_DESC_%s\t\"", devices[ndevices, 1]) \
- > hfile
-
- f = 5;
-
- while (f <= NF) {
- printf("%s", $f) > hfile
- if (f < NF)
- printf(" ") > hfile
- f++;
- }
- printf("\"\n") > hfile
-
- next
-}
-$1 == "framebuffer" {
- ndevices++
-
- devices[ndevices, 1] = $2 # nickname
- devices[ndevices, 2] = fbid # dio primary id
- devices[ndevices, 3] = $3 # dio secondary id
- devices[ndevices, 4] = $4 # number of select codes
- # used by device
-
- # emit device secondary id
- printf("\n#define\tDIO_DEVICE_SECID_%s\t%s\n", devices[ndevices, 1], \
- devices[ndevices, 3]) > hfile
-
- # emit description
- printf("#define\tDIO_DEVICE_DESC_%s\t\"", devices[ndevices, 1]) \
- > hfile
-
- f = 5;
-
- while (f <= NF) {
- printf("%s", $f) > hfile
- if (f < NF)
- printf(" ") > hfile
- f++;
- }
- printf("\"\n") > hfile
-
- next
-}
-{
- if ($0 == "")
- blanklines++
- if (blanklines != 2 && blanklines != 3)
- print $0 > hfile
- if (blanklines < 2)
- print $0 > dfile
-}
-END {
- # emit device count
-
- printf("\n") > dfile
- printf("#define DIO_NDEVICES\t%d\n", ndevices) > dfile
-
- # emit select code size table
-
- printf("\n") > dfile
-
- printf("struct dio_devdata dio_devdatas[] = {\n") > dfile
- for (i = 1; i <= ndevices; i++) {
- printf("\t{ %s,\t%s,\t%s },\n", devices[i, 2],
- devices[i, 3], devices[i, 4]) > dfile
- }
-
- printf("};\n") > dfile
-
- # emit description table
-
- printf("\n") > dfile
- printf("#ifdef DIOVERBOSE\n") > dfile
-
- printf("struct dio_devdesc dio_devdescs[] = {\n") > dfile
-
- for (i = 1; i <= ndevices; i++) {
- printf("\t{ %s,\t%s,\tDIO_DEVICE_DESC_%s },\n",
- devices[i, 2], devices[i, 3], devices[i, 1]) > dfile
- }
-
- printf("};\n") > dfile
-
- printf("#endif /* DIOVERBOSE */\n") > dfile
-}
diff --git a/sys/arch/hp300/dev/dio.c b/sys/arch/hp300/dev/dio.c
deleted file mode 100644
index b419537945f..00000000000
--- a/sys/arch/hp300/dev/dio.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/* $OpenBSD: dio.c,v 1.16 2011/08/18 20:02:57 miod Exp $ */
-/* $NetBSD: dio.c,v 1.7 1997/05/05 21:00:32 thorpej 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 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.
- */
-
-/*
- * Autoconfiguration and mapping support for the DIO bus.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-
-#include <hp300/dev/dmavar.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/diodevs_data.h>
-
-extern caddr_t internalhpib;
-
-int dio_scodesize(struct dio_attach_args *);
-char *dio_devinfo(struct dio_attach_args *, char *, size_t);
-
-int diomatch(struct device *, void *, void *);
-void dioattach(struct device *, struct device *, void *);
-int dioprint(void *, const char *);
-int diosubmatch(struct device *, void *, void *);
-
-struct cfattach dio_ca = {
- sizeof(struct device), diomatch, dioattach
-};
-
-struct cfdriver dio_cd = {
- NULL, "dio", DV_DULL
-};
-
-int
-diomatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- static int dio_matched = 0;
-
- /* Allow only one instance. */
- if (dio_matched)
- return (0);
-
- dio_matched = 1;
- return (1);
-}
-
-void
-dioattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct dio_attach_args da;
- caddr_t pa, va;
- int scode, sctmp, scmax, didmap, scodesize;
-
- scmax = DIO_SCMAX(machineid);
- printf(": ");
- dmainit();
-
- for (scode = 0; scode < scmax; ) {
- if ((sctmp = dio_inhole(scode)) != 0) {
- scode = sctmp;
- continue;
- }
-
- didmap = 0;
-
- /*
- * Temporarily map the space corresponding to
- * the current select code unless:
- * - this is the internal hpib select code,
- * - this is the console select code, and
- * the console driver actually has a mapping
- * of the beginning of the select code space
- * (sti@dio doesn't).
- */
- pa = dio_scodetopa(scode);
- if (scode == conscode && conaddr != 0)
- va = conaddr;
- else if ((scode == 7) && internalhpib)
- va = internalhpib = (caddr_t)IIOV(pa);
- else {
- va = iomap(pa, NBPG);
- if (va == NULL) {
- printf("%s: can't map scode %d\n",
- self->dv_xname, scode);
- scode++;
- continue;
- }
- didmap = 1;
- }
-
- /* Check for hardware. */
- if (badaddr(va)) {
- if (didmap)
- iounmap(va, NBPG);
- scode++;
- continue;
- }
-
- /* Fill out attach args. */
- bzero(&da, sizeof(da));
- da.da_scode = scode;
- if (scode == 7 && internalhpib)
- da.da_id = DIO_DEVICE_ID_IHPIB;
- else {
- da.da_id = DIO_ID(va);
- /*
- * If we probe an unknown device, we do not necessarily
- * know how many scodes it will span.
- * Extra scodes will usually report an id of zero,
- * which would match ihpib!
- * Check for this, warn the user, and skip that scode.
- */
- if (da.da_id == 0) {
- if (didmap)
- iounmap(va, NBPG);
- printf("%s: warning: select code %d is likely "
- "a span of a previous unsupported device\n",
- self->dv_xname, scode);
- scode++;
- continue;
- }
- }
-
- if (DIO_ISFRAMEBUFFER(da.da_id))
- da.da_secid = DIO_SECID(va);
-
- da.da_size = DIO_SIZE(scode, va);
- scodesize = dio_scodesize(&da);
- if (DIO_ISDIO(scode))
- da.da_size *= scodesize;
-
- /* No longer need the device to be mapped. */
- if (didmap)
- iounmap(va, NBPG);
-
- /* Attach matching device. */
- config_found_sm(self, &da, dioprint, diosubmatch);
- scode += scodesize;
- }
-}
-
-int
-diosubmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct cfdata *cf = match;
- struct dio_attach_args *da = aux;
-
- if (cf->diocf_scode != DIO_UNKNOWN_SCODE &&
- cf->diocf_scode != da->da_scode)
- return (0);
-
- return ((*cf->cf_attach->ca_match)(parent, cf, aux));
-}
-
-int
-dioprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct dio_attach_args *da = aux;
- char buf[128];
-
- if (pnp)
- printf("%s at %s", dio_devinfo(da, buf, sizeof(buf)), pnp);
- printf(" scode %d", da->da_scode);
- return (UNCONF);
-}
-
-/*
- * Convert a select code to a system physical address.
- */
-void *
-dio_scodetopa(scode)
- int scode;
-{
- u_long rval;
-
- if (scode == 7 && internalhpib)
- rval = DIO_IHPIBADDR;
- else if (DIO_ISDIO(scode))
- rval = DIO_BASE + (scode * DIO_DEVSIZE);
- else if (DIO_ISDIOII(scode))
- rval = DIOII_BASE + ((scode - DIOII_SCBASE) * DIOII_DEVSIZE);
- else
- rval = 0;
-
- return ((void *)rval);
-}
-
-/*
- * Return the select code size for this device, defaulting to 1
- * if we don't know what kind of device we have.
- */
-int
-dio_scodesize(da)
- struct dio_attach_args *da;
-{
- int i;
-
- /*
- * Deal with lame internal HP-IB controllers which don't have
- * consistent/reliable device ids.
- */
- if (da->da_scode == 7 && internalhpib)
- return (1);
-
- /*
- * Find the dio_devdata matching the primary id.
- * If we're a framebuffer, we also check the secondary id.
- */
- for (i = 0; i < DIO_NDEVICES; i++) {
- if (da->da_id == dio_devdatas[i].dd_id) {
- if (DIO_ISFRAMEBUFFER(da->da_id)) {
- if (da->da_secid == dio_devdatas[i].dd_secid) {
- goto foundit;
- }
- } else {
- foundit:
- return (dio_devdatas[i].dd_nscode);
- }
- }
- }
-
- /*
- * Device is unknown. Print a warning and assume a default.
- */
- printf("WARNING: select code size unknown for id = 0x%x secid = 0x%x\n",
- da->da_id, da->da_secid);
- return (1);
-}
-
-/*
- * Return a reasonable description of a DIO device.
- */
-char *
-dio_devinfo(da, buf, buflen)
- struct dio_attach_args *da;
- char *buf;
- size_t buflen;
-{
-#ifdef DIOVERBOSE
- int i;
-#endif
-
- bzero(buf, buflen);
-
- /*
- * Deal with lame internal HP-IB controllers which don't have
- * consistent/reliable device ids.
- */
- if (da->da_scode == 7 && internalhpib) {
- snprintf(buf, buflen, DIO_DEVICE_DESC_IHPIB);
- return (buf);
- }
-
-#ifdef DIOVERBOSE
- /*
- * Find the description matching our primary id.
- * If we're a framebuffer, we also check the secondary id.
- */
- for (i = 0; i < DIO_NDEVICES; i++) {
- if (da->da_id == dio_devdescs[i].dd_id) {
- if (DIO_ISFRAMEBUFFER(da->da_id)) {
- if (da->da_secid == dio_devdescs[i].dd_secid) {
- goto foundit;
- }
- } else {
- foundit:
- snprintf(buf, buflen, "%s",
- dio_devdescs[i].dd_desc);
- return (buf);
- }
- }
- }
-#endif /* DIOVERBOSE */
-
- /*
- * Device is unknown. Construct something reasonable.
- */
- snprintf(buf, buflen, "device id = 0x%x secid = 0x%x",
- da->da_id, da->da_secid);
- return (buf);
-}
-
-/*
- * Establish an interrupt handler for a DIO device.
- */
-void
-dio_intr_establish(struct isr *isr, const char *name)
-{
- intr_establish(isr, name);
-
- if (isr->isr_priority == IPL_BIO)
- dmacomputeipl();
-}
-
-/*
- * Remove an interrupt handler for a DIO device.
- */
-void
-dio_intr_disestablish(struct isr *isr)
-{
- intr_disestablish(isr);
-
- if (isr->isr_priority == IPL_BIO)
- dmacomputeipl();
-}
-
-/*
- * Return the next select code if the given select code lies within a hole,
- * zero otherwise.
- */
-int
-dio_inhole(int scode)
-{
- /* unconditionnaly skip the DIO-II hole */
- if (scode >= 32 && scode < DIOII_SCBASE)
- return DIOII_SCBASE;
-
- return 0;
-}
diff --git a/sys/arch/hp300/dev/diodevs b/sys/arch/hp300/dev/diodevs
deleted file mode 100644
index def0f9d106b..00000000000
--- a/sys/arch/hp300/dev/diodevs
+++ /dev/null
@@ -1,101 +0,0 @@
-$OpenBSD: diodevs,v 1.10 2011/08/18 20:02:57 miod Exp $
-/* $NetBSD: diodevs,v 1.7 2003/11/23 01:57:35 tsutsui Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 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.
- */
-
-/*
- * List of known DIO devices
- */
-
-/* Devices we have drivers for. */
-
-device DCA0 0x02 1 98644A serial
-device DCA0REM 0x82 1 98644A serial
-device DCA1 0x42 1 98644A serial
-device DCA1REM 0xc2 1 98644A serial
-
-device DCM 0x05 1 98642A serial MUX
-device DCMREM 0x85 1 98642A serial MUX
-
-device LAN 0x15 1 98643A LAN
-device LANREM 0x95 1 98643A LAN
-
-device FHPIB 0x08 1 98625A/98625B HP-IB
-device NHPIB 0x01 1 98624A HP-IB
-device IHPIB 0x00 1 internal HP-IB
-
-device SCSI0 0x07 1 98265A SCSI
-device SCSI1 0x27 1 98265A SCSI
-device SCSI2 0x47 1 98265A SCSI
-device SCSI3 0x67 1 98265A SCSI
-
-/* Framebuffer devices; same primary ID, different secondary IDs. */
-
-device FRAMEBUFFER 0x39 1 bitmapped display
-
-framebuffer GATORBOX 0x01 1 98700/98710 (\"gatorbox\") display
-framebuffer TOPCAT 0x02 1 98544/98545/98547 (\"topcat\") display
-framebuffer RENAISSANCE 0x04 2 98720/98721 (\"renaissance\") display
-framebuffer LRCATSEYE 0x05 1 low-res catseye display
-framebuffer HRCCATSEYE 0x06 1 high-res color catseye display
-framebuffer HRMCATSEYE 0x07 1 high-res mono catseye display
-framebuffer DAVINCI 0x08 2 98730/98731 (\"davinci\") display
-framebuffer XXXCATSEYE 0x09 1 catseye display
-framebuffer TIGERSHARK 0x0c 3 TurboVRX (\"tigershark\") display
-framebuffer HYPERION 0x0e 1 A1096A (\"hyperion\") display
-framebuffer FB3X2_A 0x10 4 362/382 internal display #1
-framebuffer FB3X2_B 0x11 4 362/382 internal display #2
-
-/* Unsupported framebuffers. */
-
-framebuffer XGENESIS 0x0b 1 x-genesis display
-framebuffer YGENESIS 0x0d 1 y-genesis display
-
-/* Devices not yet supported. Descriptions are lacking. */
-
-device MISC0 0x03 1 98622A
-device MISC1 0x04 1 98623A
-device PARALLEL 0x06 1 internal parallel
-device MISC2 0x09 1 98287A keyboard
-device MISC3 0x0a 1 HP98635A floating point accelerator
-device MISC4 0x0b 1 timer
-device MISC5 0x12 1 98640A
-device AUDIO 0x13 1 digital audio
-device MISC6 0x16 1 98659A
-device MISC7 0x19 1 237 display
-device MISC8 0x1a 4 quad-wide card
-device MISC9 0x1b 1 98253A
-device MISC10 0x1c 1 98627A
-device MISC11 0x1d 1 98633A
-device MISC12 0x1e 1 98259A
-device MISC13 0x1f 1 8741
-device VME 0x31 2 98577A VME adapter
-device DCL 0x34 1 98628A serial
-device DCLREM 0xb4 1 98628A serial
diff --git a/sys/arch/hp300/dev/diodevs.h b/sys/arch/hp300/dev/diodevs.h
deleted file mode 100644
index b0a6a730ef1..00000000000
--- a/sys/arch/hp300/dev/diodevs.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
- *
- * generated from:
- * OpenBSD: diodevs,v 1.8 2008/05/01 14:29:01 miod Exp
- */
-/* $NetBSD: diodevs,v 1.7 2003/11/23 01:57:35 tsutsui Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 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 DIO_DEVICE_ID_DCA0 0x02
-#define DIO_DEVICE_DESC_DCA0 "98644A serial"
-
-#define DIO_DEVICE_ID_DCA0REM 0x82
-#define DIO_DEVICE_DESC_DCA0REM "98644A serial"
-
-#define DIO_DEVICE_ID_DCA1 0x42
-#define DIO_DEVICE_DESC_DCA1 "98644A serial"
-
-#define DIO_DEVICE_ID_DCA1REM 0xc2
-#define DIO_DEVICE_DESC_DCA1REM "98644A serial"
-
-
-#define DIO_DEVICE_ID_DCM 0x05
-#define DIO_DEVICE_DESC_DCM "98642A serial MUX"
-
-#define DIO_DEVICE_ID_DCMREM 0x85
-#define DIO_DEVICE_DESC_DCMREM "98642A serial MUX"
-
-
-#define DIO_DEVICE_ID_LAN 0x15
-#define DIO_DEVICE_DESC_LAN "98643A LAN"
-
-#define DIO_DEVICE_ID_LANREM 0x95
-#define DIO_DEVICE_DESC_LANREM "98643A LAN"
-
-
-#define DIO_DEVICE_ID_FHPIB 0x08
-#define DIO_DEVICE_DESC_FHPIB "98625A/98625B HP-IB"
-
-#define DIO_DEVICE_ID_NHPIB 0x01
-#define DIO_DEVICE_DESC_NHPIB "98624A HP-IB"
-
-#define DIO_DEVICE_ID_IHPIB 0x00
-#define DIO_DEVICE_DESC_IHPIB "internal HP-IB"
-
-
-#define DIO_DEVICE_ID_SCSI0 0x07
-#define DIO_DEVICE_DESC_SCSI0 "98265A SCSI"
-
-#define DIO_DEVICE_ID_SCSI1 0x27
-#define DIO_DEVICE_DESC_SCSI1 "98265A SCSI"
-
-#define DIO_DEVICE_ID_SCSI2 0x47
-#define DIO_DEVICE_DESC_SCSI2 "98265A SCSI"
-
-#define DIO_DEVICE_ID_SCSI3 0x67
-#define DIO_DEVICE_DESC_SCSI3 "98265A SCSI"
-
-/* Framebuffer devices; same primary ID, different secondary IDs. */
-
-
-#define DIO_DEVICE_ID_FRAMEBUFFER 0x39
-#define DIO_DEVICE_DESC_FRAMEBUFFER "bitmapped display"
-
-
-#define DIO_DEVICE_SECID_GATORBOX 0x01
-#define DIO_DEVICE_DESC_GATORBOX "98700/98710 (\"gatorbox\") display"
-
-#define DIO_DEVICE_SECID_TOPCAT 0x02
-#define DIO_DEVICE_DESC_TOPCAT "98544/98545/98547 (\"topcat\") display"
-
-#define DIO_DEVICE_SECID_RENAISSANCE 0x04
-#define DIO_DEVICE_DESC_RENAISSANCE "98720/98721 (\"renaissance\") display"
-
-#define DIO_DEVICE_SECID_LRCATSEYE 0x05
-#define DIO_DEVICE_DESC_LRCATSEYE "low-res catseye display"
-
-#define DIO_DEVICE_SECID_HRCCATSEYE 0x06
-#define DIO_DEVICE_DESC_HRCCATSEYE "high-res color catseye display"
-
-#define DIO_DEVICE_SECID_HRMCATSEYE 0x07
-#define DIO_DEVICE_DESC_HRMCATSEYE "high-res mono catseye display"
-
-#define DIO_DEVICE_SECID_DAVINCI 0x08
-#define DIO_DEVICE_DESC_DAVINCI "98730/98731 (\"davinci\") display"
-
-#define DIO_DEVICE_SECID_XXXCATSEYE 0x09
-#define DIO_DEVICE_DESC_XXXCATSEYE "catseye display"
-
-#define DIO_DEVICE_SECID_HYPERION 0x0e
-#define DIO_DEVICE_DESC_HYPERION "A1096A (\"hyperion\") display"
-
-/* Unsupported framebuffers. */
-
-
-#define DIO_DEVICE_SECID_XGENESIS 0x0b
-#define DIO_DEVICE_DESC_XGENESIS "x-genesis display"
-
-#define DIO_DEVICE_SECID_TIGERSHARK 0x0c
-#define DIO_DEVICE_DESC_TIGERSHARK "TurboVRX (\"tigershark\") display"
-
-#define DIO_DEVICE_SECID_YGENESIS 0x0d
-#define DIO_DEVICE_DESC_YGENESIS "y-genesis display"
-
-#define DIO_DEVICE_SECID_FB3X2_A 0x10
-#define DIO_DEVICE_DESC_FB3X2_A "362/382 internal display #1"
-
-#define DIO_DEVICE_SECID_FB3X2_B 0x11
-#define DIO_DEVICE_DESC_FB3X2_B "362/382 internal display #2"
-
-/* Devices not yet supported. Descriptions are lacking. */
-
-
-#define DIO_DEVICE_ID_MISC0 0x03
-#define DIO_DEVICE_DESC_MISC0 "98622A"
-
-#define DIO_DEVICE_ID_MISC1 0x04
-#define DIO_DEVICE_DESC_MISC1 "98623A"
-
-#define DIO_DEVICE_ID_PARALLEL 0x06
-#define DIO_DEVICE_DESC_PARALLEL "internal parallel"
-
-#define DIO_DEVICE_ID_MISC2 0x09
-#define DIO_DEVICE_DESC_MISC2 "98287A keyboard"
-
-#define DIO_DEVICE_ID_MISC3 0x0a
-#define DIO_DEVICE_DESC_MISC3 "HP98635A floating point accelerator"
-
-#define DIO_DEVICE_ID_MISC4 0x0b
-#define DIO_DEVICE_DESC_MISC4 "timer"
-
-#define DIO_DEVICE_ID_MISC5 0x12
-#define DIO_DEVICE_DESC_MISC5 "98640A"
-
-#define DIO_DEVICE_ID_AUDIO 0x13
-#define DIO_DEVICE_DESC_AUDIO "digital audio"
-
-#define DIO_DEVICE_ID_MISC6 0x16
-#define DIO_DEVICE_DESC_MISC6 "98659A"
-
-#define DIO_DEVICE_ID_MISC7 0x19
-#define DIO_DEVICE_DESC_MISC7 "237 display"
-
-#define DIO_DEVICE_ID_MISC8 0x1a
-#define DIO_DEVICE_DESC_MISC8 "quad-wide card"
-
-#define DIO_DEVICE_ID_MISC9 0x1b
-#define DIO_DEVICE_DESC_MISC9 "98253A"
-
-#define DIO_DEVICE_ID_MISC10 0x1c
-#define DIO_DEVICE_DESC_MISC10 "98627A"
-
-#define DIO_DEVICE_ID_MISC11 0x1d
-#define DIO_DEVICE_DESC_MISC11 "98633A"
-
-#define DIO_DEVICE_ID_MISC12 0x1e
-#define DIO_DEVICE_DESC_MISC12 "98259A"
-
-#define DIO_DEVICE_ID_MISC13 0x1f
-#define DIO_DEVICE_DESC_MISC13 "8741"
-
-#define DIO_DEVICE_ID_VME 0x31
-#define DIO_DEVICE_DESC_VME "98577A VME adapter"
-
-#define DIO_DEVICE_ID_DCL 0x34
-#define DIO_DEVICE_DESC_DCL "98628A serial"
-
-#define DIO_DEVICE_ID_DCLREM 0xb4
-#define DIO_DEVICE_DESC_DCLREM "98628A serial"
diff --git a/sys/arch/hp300/dev/diodevs_data.h b/sys/arch/hp300/dev/diodevs_data.h
deleted file mode 100644
index fc1bae0bd2f..00000000000
--- a/sys/arch/hp300/dev/diodevs_data.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
- *
- * generated from:
- * OpenBSD: diodevs,v 1.8 2008/05/01 14:29:01 miod Exp
- */
-/* $NetBSD: diodevs,v 1.7 2003/11/23 01:57:35 tsutsui Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 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 DIO_NDEVICES 49
-
-struct dio_devdata dio_devdatas[] = {
- { 0x02, 0, 1 },
- { 0x82, 0, 1 },
- { 0x42, 0, 1 },
- { 0xc2, 0, 1 },
- { 0x05, 0, 1 },
- { 0x85, 0, 1 },
- { 0x15, 0, 1 },
- { 0x95, 0, 1 },
- { 0x08, 0, 1 },
- { 0x01, 0, 1 },
- { 0x00, 0, 1 },
- { 0x07, 0, 1 },
- { 0x27, 0, 1 },
- { 0x47, 0, 1 },
- { 0x67, 0, 1 },
- { 0x39, 0, 1 },
- { 0x39, 0x01, 1 },
- { 0x39, 0x02, 1 },
- { 0x39, 0x04, 2 },
- { 0x39, 0x05, 1 },
- { 0x39, 0x06, 1 },
- { 0x39, 0x07, 1 },
- { 0x39, 0x08, 2 },
- { 0x39, 0x09, 1 },
- { 0x39, 0x0e, 1 },
- { 0x39, 0x0b, 1 },
- { 0x39, 0x0c, 3 },
- { 0x39, 0x0d, 1 },
- { 0x39, 0x10, 4 },
- { 0x39, 0x11, 4 },
- { 0x03, 0, 1 },
- { 0x04, 0, 1 },
- { 0x06, 0, 1 },
- { 0x09, 0, 1 },
- { 0x0a, 0, 1 },
- { 0x0b, 0, 1 },
- { 0x12, 0, 1 },
- { 0x13, 0, 1 },
- { 0x16, 0, 1 },
- { 0x19, 0, 1 },
- { 0x1a, 0, 4 },
- { 0x1b, 0, 1 },
- { 0x1c, 0, 1 },
- { 0x1d, 0, 1 },
- { 0x1e, 0, 1 },
- { 0x1f, 0, 1 },
- { 0x31, 0, 2 },
- { 0x34, 0, 1 },
- { 0xb4, 0, 1 },
-};
-
-#ifdef DIOVERBOSE
-struct dio_devdesc dio_devdescs[] = {
- { 0x02, 0, DIO_DEVICE_DESC_DCA0 },
- { 0x82, 0, DIO_DEVICE_DESC_DCA0REM },
- { 0x42, 0, DIO_DEVICE_DESC_DCA1 },
- { 0xc2, 0, DIO_DEVICE_DESC_DCA1REM },
- { 0x05, 0, DIO_DEVICE_DESC_DCM },
- { 0x85, 0, DIO_DEVICE_DESC_DCMREM },
- { 0x15, 0, DIO_DEVICE_DESC_LAN },
- { 0x95, 0, DIO_DEVICE_DESC_LANREM },
- { 0x08, 0, DIO_DEVICE_DESC_FHPIB },
- { 0x01, 0, DIO_DEVICE_DESC_NHPIB },
- { 0x00, 0, DIO_DEVICE_DESC_IHPIB },
- { 0x07, 0, DIO_DEVICE_DESC_SCSI0 },
- { 0x27, 0, DIO_DEVICE_DESC_SCSI1 },
- { 0x47, 0, DIO_DEVICE_DESC_SCSI2 },
- { 0x67, 0, DIO_DEVICE_DESC_SCSI3 },
- { 0x39, 0, DIO_DEVICE_DESC_FRAMEBUFFER },
- { 0x39, 0x01, DIO_DEVICE_DESC_GATORBOX },
- { 0x39, 0x02, DIO_DEVICE_DESC_TOPCAT },
- { 0x39, 0x04, DIO_DEVICE_DESC_RENAISSANCE },
- { 0x39, 0x05, DIO_DEVICE_DESC_LRCATSEYE },
- { 0x39, 0x06, DIO_DEVICE_DESC_HRCCATSEYE },
- { 0x39, 0x07, DIO_DEVICE_DESC_HRMCATSEYE },
- { 0x39, 0x08, DIO_DEVICE_DESC_DAVINCI },
- { 0x39, 0x09, DIO_DEVICE_DESC_XXXCATSEYE },
- { 0x39, 0x0e, DIO_DEVICE_DESC_HYPERION },
- { 0x39, 0x0b, DIO_DEVICE_DESC_XGENESIS },
- { 0x39, 0x0c, DIO_DEVICE_DESC_TIGERSHARK },
- { 0x39, 0x0d, DIO_DEVICE_DESC_YGENESIS },
- { 0x39, 0x10, DIO_DEVICE_DESC_FB3X2_A },
- { 0x39, 0x11, DIO_DEVICE_DESC_FB3X2_B },
- { 0x03, 0, DIO_DEVICE_DESC_MISC0 },
- { 0x04, 0, DIO_DEVICE_DESC_MISC1 },
- { 0x06, 0, DIO_DEVICE_DESC_PARALLEL },
- { 0x09, 0, DIO_DEVICE_DESC_MISC2 },
- { 0x0a, 0, DIO_DEVICE_DESC_MISC3 },
- { 0x0b, 0, DIO_DEVICE_DESC_MISC4 },
- { 0x12, 0, DIO_DEVICE_DESC_MISC5 },
- { 0x13, 0, DIO_DEVICE_DESC_AUDIO },
- { 0x16, 0, DIO_DEVICE_DESC_MISC6 },
- { 0x19, 0, DIO_DEVICE_DESC_MISC7 },
- { 0x1a, 0, DIO_DEVICE_DESC_MISC8 },
- { 0x1b, 0, DIO_DEVICE_DESC_MISC9 },
- { 0x1c, 0, DIO_DEVICE_DESC_MISC10 },
- { 0x1d, 0, DIO_DEVICE_DESC_MISC11 },
- { 0x1e, 0, DIO_DEVICE_DESC_MISC12 },
- { 0x1f, 0, DIO_DEVICE_DESC_MISC13 },
- { 0x31, 0, DIO_DEVICE_DESC_VME },
- { 0x34, 0, DIO_DEVICE_DESC_DCL },
- { 0xb4, 0, DIO_DEVICE_DESC_DCLREM },
-};
-#endif /* DIOVERBOSE */
diff --git a/sys/arch/hp300/dev/diofb.c b/sys/arch/hp300/dev/diofb.c
deleted file mode 100644
index f452fc6c6bc..00000000000
--- a/sys/arch/hp300/dev/diofb.c
+++ /dev/null
@@ -1,546 +0,0 @@
-/* $OpenBSD: diofb.c,v 1.20 2013/10/21 10:36:11 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-
-extern int rasops_alloc_cattr(void *, int, int, int, long *);
-
-int diofb_alloc_attr(void *, int, int, int, long *);
-int diofb_copycols(void *, int, int, int, int);
-int diofb_erasecols(void *, int, int, int, long);
-int diofb_copyrows(void *, int, int, int);
-int diofb_eraserows(void *, int, int, long);
-int diofb_do_cursor(struct rasops_info *);
-
-/*
- * Frame buffer geometry initialization
- */
-
-int
-diofb_fbinquire(struct diofb *fb, int scode, struct diofbreg *fbr)
-{
- int fboff, regsize;
-
- if (ISIIOVA(fbr))
- fb->regaddr = (caddr_t)IIOP(fbr);
- else
- fb->regaddr = dio_scodetopa(scode);
-
- if (fb->fbwidth == 0 || fb->fbheight == 0) {
- fb->fbwidth = (fbr->fbwmsb << 8) | fbr->fbwlsb;
- fb->fbheight = (fbr->fbhmsb << 8) | fbr->fbhlsb;
- }
- fb->fbsize = fb->fbwidth * fb->fbheight;
-
- fb->regkva = (caddr_t)fbr;
- fboff = (fbr->fbomsb << 8) | fbr->fbolsb;
- fb->fbaddr = (caddr_t) (*((u_char *)fbr + fboff) << 16);
-
- if (fb->regaddr >= (caddr_t)DIOII_BASE) {
- /*
- * For DIO-II space the fbaddr just computed is
- * the offset from the select code base (regaddr)
- * of the framebuffer. Hence it is also implicitly
- * the size of the set.
- */
- regsize = (int)fb->fbaddr;
- fb->fbaddr += (int)fb->regaddr;
- fb->fbkva = (caddr_t)fbr + regsize;
- } else {
- /*
- * For internal or DIO-I space we need to map the separate
- * framebuffer.
- */
- fb->fbkva = iomap(fb->fbaddr, fb->fbsize);
- if (fb->fbkva == NULL)
- return (ENOMEM);
- }
- if (fb->dwidth == 0 || fb->dheight == 0) {
- fb->dwidth = (fbr->dwmsb << 8) | fbr->dwlsb;
- fb->dheight = (fbr->dhmsb << 8) | fbr->dhlsb;
- }
-
- /*
- * Some displays, such as the DaVinci, appear to return a display
- * height larger than the frame buffer height.
- */
- if (fb->dwidth > fb->fbwidth)
- fb->dwidth = fb->fbwidth;
- if (fb->dheight > fb->fbheight)
- fb->dheight = fb->fbheight;
-
- /*
- * Some monochrome displays, such as the HP332 internal video
- * appear to return a display width of 1024 instead of 512.
- */
- if (fbr->num_planes == 1 && fb->dheight == 400)
- if (fb->dwidth == 1024)
- fb->dwidth = 512;
-
- fb->planes = fbr->num_planes;
- if (fb->planes > 8)
- fb->planes = 8;
- fb->planemask = (1 << fb->planes) - 1;
-
- fb->mapmode = WSDISPLAYIO_MODE_DUMBFB;
-
- return (0);
-}
-
-/*
- * Frame buffer rasops and colormap setup
- */
-
-void
-diofb_fbsetup(struct diofb *fb)
-{
- struct rasops_info *ri = &fb->ri;
-
- /*
- * Pretend we are an 8bpp frame buffer, unless ri_depth is already
- * initialized, since this is how it is supposed to be addressed.
- * (Hyperion forces 1bpp because it is really 1bpp addressed).
- */
- if (ri->ri_depth == 0)
- ri->ri_depth = 8;
- ri->ri_stride = (fb->fbwidth * ri->ri_depth) / 8;
-
- ri->ri_flg = RI_CENTER | RI_FULLCLEAR;
- /* We don't really support colors on less than 4bpp frame buffers */
- if (fb->planes < 4)
- ri->ri_flg |= RI_FORCEMONO;
- ri->ri_bits = fb->fbkva;
- ri->ri_width = fb->dwidth;
- ri->ri_height = fb->dheight;
- ri->ri_hw = fb;
-
- /*
- * Ask for an unholy big display, rasops will trim this to more
- * reasonable values.
- */
- rasops_init(ri, 160, 160);
-
- diofb_resetcmap(fb);
-
- /*
- * For low depth frame buffers, since we have faked a 8bpp frame buffer
- * to rasops, we actually have to remove capabilities.
- */
- if (fb->planes == 4) {
- ri->ri_ops.alloc_attr = diofb_alloc_attr;
- ri->ri_caps &= ~WSSCREEN_HILIT;
- }
-
- ri->ri_ops.copycols = diofb_copycols;
- ri->ri_ops.erasecols = diofb_erasecols;
- if (ri->ri_depth != 1) {
- ri->ri_ops.copyrows = diofb_copyrows;
- ri->ri_ops.eraserows = diofb_eraserows;
- ri->ri_do_cursor = diofb_do_cursor;
- }
-
- /* Clear entire display, including non visible areas */
- (*fb->bmv)(fb, 0, 0, 0, 0, fb->fbwidth, fb->fbheight, RR_CLEAR, 0xff);
-
- strlcpy(fb->wsd.name, "std", sizeof(fb->wsd.name));
- fb->wsd.ncols = ri->ri_cols;
- fb->wsd.nrows = ri->ri_rows;
- fb->wsd.textops = &ri->ri_ops;
- fb->wsd.fontwidth = ri->ri_font->fontwidth;
- fb->wsd.fontheight = ri->ri_font->fontheight;
- fb->wsd.capabilities = ri->ri_caps;
-}
-
-/*
- * Setup default emulation mode colormap
- */
-void
-diofb_resetcmap(struct diofb *fb)
-{
- const u_char *color;
- u_int i;
-
- /* start with the rasops colormap */
- color = (const u_char *)rasops_cmap;
- for (i = 0; i < 256; i++) {
- fb->cmap.r[i] = *color++;
- fb->cmap.g[i] = *color++;
- fb->cmap.b[i] = *color++;
- }
-
- /*
- * Tweak colormap
- *
- * Due to the way rasops cursor work, we need to provide
- * copies of the 8 or 16 basic colors at extra locations
- * in 4bpp and 6bpp mode. This is because missing planes
- * accept writes but read back as zero.
- *
- * So, in 6bpp mode:
- * 00 gets inverted to ff, read back as 3f
- * 3f gets inverted to c0, read back as 00
- * and in 4bpp mode:
- * 00 gets inverted to ff, read back as 0f
- * 0f gets inverted to f0, read back as 00
- */
-
- switch (fb->planes) {
- case 6:
- /*
- * 00-0f normal colors
- * 30-3f inverted colors
- * c0-cf normal colors
- * f0-ff inverted colors
- */
- bcopy(fb->cmap.r + 0x00, fb->cmap.r + 0xc0, 0x10);
- bcopy(fb->cmap.g + 0x00, fb->cmap.g + 0xc0, 0x10);
- bcopy(fb->cmap.b + 0x00, fb->cmap.b + 0xc0, 0x10);
- bcopy(fb->cmap.r + 0xf0, fb->cmap.r + 0x30, 0x10);
- bcopy(fb->cmap.g + 0xf0, fb->cmap.g + 0x30, 0x10);
- bcopy(fb->cmap.b + 0xf0, fb->cmap.b + 0x30, 0x10);
- break;
- case 4:
- /*
- * 00-07 normal colors
- * 08-0f inverted colors
- * highlighted colors are not available.
- */
- bcopy(fb->cmap.r + 0xf8, fb->cmap.r + 0x08, 0x08);
- bcopy(fb->cmap.g + 0xf8, fb->cmap.g + 0x08, 0x08);
- bcopy(fb->cmap.b + 0xf8, fb->cmap.b + 0x08, 0x08);
- break;
- }
-}
-
-/*
- * Attachment helpers
- */
-
-void
-diofb_cnattach(struct diofb *fb)
-{
- long defattr;
- struct rasops_info *ri;
-
- ri = &fb->ri;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
- wsdisplay_cnattach(&fb->wsd, ri, 0, 0, defattr);
-}
-
-void
-diofb_end_attach(void *sc, struct wsdisplay_accessops *accessops,
- struct diofb *fb, int console, const char *descr)
-{
- struct wsemuldisplaydev_attach_args waa;
-
- printf(": %dx%d", fb->dwidth, fb->dheight);
-
- if (fb->planes == 1)
- printf(" monochrome");
- else
- printf("x%d", fb->planes);
-
- if (descr != NULL)
- printf(" %s", descr);
- printf(" frame buffer\n");
-
- fb->scrlist[0] = &fb->wsd;
- fb->wsl.nscreens = 1;
- fb->wsl.screens = (const struct wsscreen_descr **)fb->scrlist;
-
- waa.console = console;
- waa.scrdata = &fb->wsl;
- waa.accessops = accessops;
- waa.accesscookie = fb;
- waa.defaultscreens = 0;
-
- config_found((struct device *)sc, &waa, wsemuldisplaydevprint);
-}
-
-/*
- * Common wsdisplay emulops for DIO frame buffers
- */
-
-int
-diofb_alloc_attr(void *cookie, int fg, int bg, int flg, long *attr)
-{
- if ((flg & (WSATTR_BLINK | WSATTR_HILIT)) != 0)
- return (EINVAL);
-
- return (rasops_alloc_cattr(cookie, fg, bg, flg, attr));
-}
-
-int
-diofb_copycols(void *cookie, int row, int src, int dst, int n)
-{
- struct rasops_info *ri = cookie;
- struct diofb *fb = ri->ri_hw;
-
- n *= ri->ri_font->fontwidth;
- src *= ri->ri_font->fontwidth;
- dst *= ri->ri_font->fontwidth;
- row *= ri->ri_font->fontheight;
-
- (*fb->bmv)(fb, ri->ri_xorigin + src, ri->ri_yorigin + row,
- ri->ri_xorigin + dst, ri->ri_yorigin + row,
- n, ri->ri_font->fontheight, RR_COPY, 0xff);
-
- return 0;
-}
-
-int
-diofb_copyrows(void *cookie, int src, int dst, int n)
-{
- struct rasops_info *ri = cookie;
- struct diofb *fb = ri->ri_hw;
-
- n *= ri->ri_font->fontheight;
- src *= ri->ri_font->fontheight;
- dst *= ri->ri_font->fontheight;
-
- (*fb->bmv)(fb, ri->ri_xorigin, ri->ri_yorigin + src,
- ri->ri_xorigin, ri->ri_yorigin + dst,
- ri->ri_emuwidth, n, RR_COPY, 0xff);
-
- return 0;
-}
-
-int
-diofb_erasecols(void *cookie, int row, int col, int num, long attr)
-{
- struct rasops_info *ri = cookie;
- struct diofb *fb = ri->ri_hw;
- int fg, bg;
- int snum, scol, srow;
-
- ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
-
- snum = num * ri->ri_font->fontwidth;
- scol = col * ri->ri_font->fontwidth + ri->ri_xorigin;
- srow = row * ri->ri_font->fontheight + ri->ri_yorigin;
-
- /*
- * If this is too tricky for the simple raster ops engine,
- * pass the fun to rasops.
- */
- if ((*fb->bmv)(fb, scol, srow, scol, srow, snum,
- ri->ri_font->fontheight, RR_CLEAR, 0xff ^ bg) != 0)
- rasops_erasecols(cookie, row, col, num, attr);
-
- return 0;
-}
-
-int
-diofb_eraserows(void *cookie, int row, int num, long attr)
-{
- struct rasops_info *ri = cookie;
- struct diofb *fb = ri->ri_hw;
- int fg, bg;
- int srow, snum;
- int rc;
-
- ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
- bg ^= 0xff;
-
- if (num == ri->ri_rows && (ri->ri_flg & RI_FULLCLEAR)) {
- rc = (*fb->bmv)(fb, 0, 0, 0, 0, ri->ri_width, ri->ri_height,
- RR_CLEAR, bg);
- } else {
- srow = row * ri->ri_font->fontheight + ri->ri_yorigin;
- snum = num * ri->ri_font->fontheight;
- rc = (*fb->bmv)(fb, ri->ri_xorigin, srow, ri->ri_xorigin,
- srow, ri->ri_emuwidth, snum, RR_CLEAR, bg);
- }
- if (rc != 0)
- rasops_eraserows(cookie, row, num, attr);
-
- return 0;
-}
-
-int
-diofb_do_cursor(struct rasops_info *ri)
-{
- struct diofb *fb = ri->ri_hw;
- int x, y;
-
- x = ri->ri_ccol * ri->ri_font->fontwidth + ri->ri_xorigin;
- y = ri->ri_crow * ri->ri_font->fontheight + ri->ri_yorigin;
- (*fb->bmv)(fb, x, y, x, y, ri->ri_font->fontwidth,
- ri->ri_font->fontheight, RR_INVERT, 0xff);
-
- return 0;
-}
-
-/*
- * Common wsdisplay accessops for DIO frame buffers
- */
-
-int
-diofb_alloc_screen(void *v, const struct wsscreen_descr *type,
- void **cookiep, int *curxp, int *curyp, long *attrp)
-{
- struct diofb *fb = v;
- struct rasops_info *ri = &fb->ri;
-
- if (fb->nscreens > 0)
- return (ENOMEM);
-
- *cookiep = ri;
- *curxp = *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, attrp);
- fb->nscreens++;
-
- return (0);
-}
-
-void
-diofb_free_screen(void *v, void *cookie)
-{
- struct diofb *fb = v;
-
- fb->nscreens--;
-}
-
-int
-diofb_show_screen(void *v, void *cookie, int waitok,
- void (*cb)(void *, int, int), void *cbarg)
-{
- return (0);
-}
-
-paddr_t
-diofb_mmap(void *v, off_t offset, int prot)
-{
- struct diofb *fb = v;
-
- if ((offset & PAGE_MASK) != 0)
- return (-1);
-
- switch (fb->mapmode) {
- case WSDISPLAYIO_MODE_MAPPED:
- if (offset >= 0 && offset < DIOFB_REGSPACE)
- return ((paddr_t)fb->regaddr + offset);
- offset -= DIOFB_REGSPACE;
- /* FALLTHROUGH */
- case WSDISPLAYIO_MODE_DUMBFB:
- if (offset >= 0 && offset < fb->fbsize)
- return ((paddr_t)fb->fbaddr + offset);
- break;
- }
-
- return (-1);
-}
-
-int
-diofb_getcmap(struct diofb *fb, struct wsdisplay_cmap *cm)
-{
- u_int index = cm->index, count = cm->count;
- u_int colcount = 1 << fb->planes;
- int error;
-
- if (index >= colcount || count > colcount - index)
- return (EINVAL);
-
- if ((error = copyout(fb->cmap.r + index, cm->red, count)) != 0)
- return (error);
- if ((error = copyout(fb->cmap.g + index, cm->green, count)) != 0)
- return (error);
- if ((error = copyout(fb->cmap.b + index, cm->blue, count)) != 0)
- return (error);
-
- return (0);
-}
-
-int
-diofb_load_font(void *v, void *emulcookie, struct wsdisplay_font *font)
-{
- struct diofb *fb = v;
- struct rasops_info *ri = &fb->ri;
-
- return rasops_load_font(ri, emulcookie, font);
-}
-
-int
-diofb_list_font(void *v, struct wsdisplay_font *font)
-{
- struct diofb *fb = v;
- struct rasops_info *ri = &fb->ri;
-
- return rasops_list_font(ri, font);
-}
diff --git a/sys/arch/hp300/dev/diofb_mono.c b/sys/arch/hp300/dev/diofb_mono.c
deleted file mode 100644
index 7b7790e5e44..00000000000
--- a/sys/arch/hp300/dev/diofb_mono.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/* $OpenBSD: diofb_mono.c,v 1.3 2006/08/11 18:33:13 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1991 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Mark Davies of the Department of Computer
- * Science, Victoria University of Wellington, New Zealand.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_hy.c 1.2 93/08/13$
- *
- * @(#)grf_hy.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for real 1bpp frame buffers (i.e. pixels not being
- * byte-addressed)
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-
-#include <dev/rasops/rasops_masks.h>
-#include <hp300/dev/maskbits.h>
-
-int
-diofb_mono_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
- u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop,
- int16_t planemask /* ignored */)
-{
- 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 = fb->fbwidth >> 5;
-
- if (sy < dy) { /* start at last scanline of rectangle */
- psrcLine = ((u_int *)fb->fbkva) + ((sy + cy - 1) * width);
- pdstLine = ((u_int *)fb->fbkva) + ((dy + cy - 1) * width);
- width = -width;
- } else { /* start at first scanline */
- psrcLine = ((u_int *)fb->fbkva) + (sy * width);
- pdstLine = ((u_int *)fb->fbkva) + (dy * width);
- }
-
- /* x direction doesn't matter for < 1 longword */
- if (cx <= 32) {
- int srcBit, dstBit; /* bit offset of src and dst */
-
- pdstLine += (dx >> 5);
- psrcLine += (sx >> 5);
- psrc = psrcLine;
- pdst = pdstLine;
-
- srcBit = sx & 0x1f;
- dstBit = dx & 0x1f;
-
- while (cy--) {
- getandputrop(psrc, srcBit, dstBit, cx, pdst, rop);
- pdst += width;
- psrc += width;
- }
- } else {
- maskbits(dx, cx, startmask, endmask, nlMiddle);
- if (startmask)
- nstart = 32 - (dx & 0x1f);
- else
- nstart = 0;
- if (endmask)
- nend = (dx + cx) & 0x1f;
- else
- nend = 0;
-
- xoffSrc = ((sx & 0x1f) + nstart) & 0x1f;
- srcStartOver = ((sx & 0x1f) + nstart) > 31;
-
- if (sx >= dx) { /* move left to right */
- pdstLine += (dx >> 5);
- psrcLine += (sx >> 5);
-
- while (cy--) {
- psrc = psrcLine;
- pdst = pdstLine;
-
- if (startmask) {
- getandputrop(psrc, (sx & 0x1f),
- (dx & 0x1f), nstart, pdst, rop);
- pdst++;
- if (srcStartOver)
- psrc++;
- }
-
- /* special case for aligned operations */
- if (xoffSrc == 0) {
- nl = nlMiddle;
- while (nl--) {
- if (rop == RR_CLEAR)
- *pdst = 0;
- else
- *pdst = *psrc;
- psrc++;
- pdst++;
- }
- } else {
- nl = nlMiddle + 1;
- while (--nl) {
- if (rop == RR_CLEAR)
- *pdst = 0;
- else
- getunalignedword(psrc,
- xoffSrc, *pdst);
- 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;
- if (rop == RR_CLEAR)
- *pdst = 0;
- else
- getunalignedword(psrc, xoffSrc,
- *pdst);
- }
-
- if (startmask) {
- if (srcStartOver)
- --psrc;
- --pdst;
- getandputrop(psrc, (sx & 0x1f),
- (dx & 0x1f), nstart, pdst, rop);
- }
-
- pdstLine += width;
- psrcLine += width;
- }
- }
- }
-
- return (0);
-}
diff --git a/sys/arch/hp300/dev/diofbreg.h b/sys/arch/hp300/dev/diofbreg.h
deleted file mode 100644
index 3df02c729e6..00000000000
--- a/sys/arch/hp300/dev/diofbreg.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $OpenBSD: diofbreg.h,v 1.4 2011/08/18 20:02:57 miod Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grfreg.h 1.6 92/01/31$
- *
- * @(#)grfreg.h 8.1 (Berkeley) 6/10/93
- */
-
-/* 300 bitmapped display hardware primary id */
-#define GRFHWID 0x39
-
-/* 300 internal bitmapped display address */
-#define GRFIADDR 0x560000
-
-/* 300 hardware secondary ids - XXX duplicates some diodevs.h values */
-#define GID_GATORBOX 0x01
-#define GID_TOPCAT 0x02
-#define GID_RENAISSANCE 0x04
-#define GID_LRCATSEYE 0x05
-#define GID_HRCCATSEYE 0x06
-#define GID_HRMCATSEYE 0x07
-#define GID_DAVINCI 0x08
-#define GID_XXXCATSEYE 0x09
-#define GID_XGENESIS 0x0b
-#define GID_TIGER 0x0c
-#define GID_YGENESIS 0x0d
-#define GID_HYPERION 0x0e
-#define GID_FB3X2_A 0x10
-#define GID_FB3X2_B 0x11
-
-#ifndef _LOCORE
-struct diofbreg {
- u_int8_t :8;
- u_int8_t id; /* id and reset register 0x01 */
- u_int8_t sec_interrupt; /* secondary interrupt register 0x02 */
- u_int8_t interrupt; /* interrupt register 0x03 */
- u_int8_t :8;
- u_int8_t fbwmsb; /* frame buffer width MSB 0x05 */
- u_int8_t :8;
- u_int8_t fbwlsb; /* frame buffer height LSB 0x07 */
- u_int8_t :8;
- u_int8_t fbhmsb; /* frame buffer height MSB 0x09 */
- u_int8_t :8;
- u_int8_t fbhlsb; /* frame buffer height LSB 0x0b */
- u_int8_t :8;
- u_int8_t dwmsb; /* display width MSB 0x0d */
- u_int8_t :8;
- u_int8_t dwlsb; /* display width LSB 0x0f */
- u_int8_t :8;
- u_int8_t dhmsb; /* display height MSB 0x11 */
- u_int8_t :8;
- u_int8_t dhlsb; /* display height LSB 0x13 */
- u_int8_t :8;
- u_int8_t fbid; /* frame buffer id 0x15 */
- u_int8_t pad2[0x45];
- u_int8_t num_planes; /* number of color planes 0x5b */
- u_int8_t :8;
- u_int8_t fbomsb; /* frame buffer offset MSB 0x5d */
- u_int8_t :8;
- u_int8_t fbolsb; /* frame buffer offset LSB 0x5f */
-};
-#endif
diff --git a/sys/arch/hp300/dev/diofbvar.h b/sys/arch/hp300/dev/diofbvar.h
deleted file mode 100644
index 8f1471450b5..00000000000
--- a/sys/arch/hp300/dev/diofbvar.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/* $OpenBSD: diofbvar.h,v 1.11 2013/10/21 10:36:12 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef _KERNEL
-
-struct diocmap {
- u_int8_t r[256], g[256], b[256];
-};
-
-/*
- * Minimal frame buffer state structure.
- */
-struct diofb {
- caddr_t regkva; /* KVA of registers */
- caddr_t fbkva; /* KVA of framebuffer */
-
- caddr_t regaddr; /* control registers physaddr */
- caddr_t fbaddr; /* frame buffer physaddr */
-
- u_int fbsize; /* frame buffer size */
- u_int fbwidth; /* frame buffer width */
- u_int fbheight; /* frame buffer height */
- u_int dwidth; /* displayed part width */
- u_int dheight; /* displayed part height */
-
- u_int planes; /* number of planes */
- u_int planemask; /* and related mask */
-
- /* rasops information */
- struct rasops_info ri;
-
- /* color information */
- struct diocmap cmap;
-
- /* wsdisplay information */
- struct wsscreen_descr wsd;
- struct wsscreen_list wsl;
- struct wsscreen_descr *scrlist[1];
- int nscreens;
- u_int mapmode;
-
- /* blockmove routine */
- int (*bmv)(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
-};
-
-/* Replacement Rules (rops) */
-#define RR_CLEAR 0x0
-#define RR_COPY 0x3
-#define RR_XOR 0x6
-#define RR_INVERT 0xa
-#define RR_COPYINVERTED 0xc
-
-void diofb_cnattach(struct diofb *);
-void diofb_end_attach(void *, struct wsdisplay_accessops *, struct diofb *,
- int, const char *);
-int diofb_fbinquire(struct diofb *, int, struct diofbreg *);
-void diofb_fbsetup(struct diofb *);
-int diofb_getcmap(struct diofb *, struct wsdisplay_cmap *);
-void diofb_resetcmap(struct diofb *);
-
-int diofb_alloc_attr(void *, int, int, int, long *);
-int diofb_alloc_screen(void *, const struct wsscreen_descr *, void **,
- int *, int *, long *);
-void diofb_free_screen(void *, void *);
-paddr_t diofb_mmap(void *, off_t, int);
-int diofb_show_screen(void *, void *, int, void (*)(void *, int, int),
- void *);
-int diofb_load_font(void *, void *, struct wsdisplay_font *);
-int diofb_list_font(void *, struct wsdisplay_font *);
-
-int diofb_mono_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
-
-/* Console support */
-void dvboxcninit(void);
-void gboxcninit(void);
-void hypercninit(void);
-void rboxcninit(void);
-void topcatcninit(void);
-void tvrxcninit(void);
-extern struct diofb diofb_cn; /* struct diofb for console device */
-
-#endif
-
-/*
- * In mapped mode, mmap() will provide the following layout:
- * 0 - (DIOFB_REGSPACE - 1) frame buffer registers
- * DIOFB_REGSPACE onwards frame buffer memory
- */
-#define DIOFB_REGSPACE 0x020000
diff --git a/sys/arch/hp300/dev/dioreg.h b/sys/arch/hp300/dev/dioreg.h
deleted file mode 100644
index f481593d169..00000000000
--- a/sys/arch/hp300/dev/dioreg.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/* $OpenBSD: dioreg.h,v 1.7 2011/08/18 19:55:43 miod Exp $ */
-/* $NetBSD: dioreg.h,v 1.3 1997/01/30 09:18:40 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Portions of this file are 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Register definitions for the DIO and DIO-II bus.
- */
-
-/*
- * DIO/DIO-II device registers, offsets from base of device. All
- * registers are 8-bit.
- */
-#define DIO_IDOFF 0x01 /* primary device id */
-#define DIO_IPLOFF 0x03 /* interrupt level */
-#define DIO_SECIDOFF 0x15 /* secondary device id */
-#define DIOII_SIZEOFF 0x101 /* device size */
-
-/*
- * System physical addresses of some `special' DIO devices.
- */
-#define DIO_IHPIBADDR 0x478000 /* internal HP-IB; select code 7 */
-
-/*
- * DIO ranges from select codes 0-31 at physical addresses given by:
- * 0x600000 + sc * 0x10000
- * DIO cards are addressed in the range 0-31 [0x600000-0x800000) for
- * their control space and the remaining areas, [0x200000-0x400000) and
- * [0x800000-0x1000000), are for additional space required by a card;
- * e.g. a display framebuffer.
- *
- * DIO-II ranges from select codes 132-255 at physical addresses given by:
- * 0x1000000 + (sc - 132) * 0x400000
- * The address range of DIO-II space is thus [0x1000000-0x20000000).
- *
- * DIO/DIO-II space is too large to map in its entirety, instead devices
- * are mapped into kernel virtual address space allocated from a range
- * of EIOMAPSIZE pages (vmparam.h) starting at ``extiobase''.
- */
-#define DIO_BASE 0x00600000 /* start of DIO space */
-#define DIO_END 0x01000000 /* end of DIO space */
-#define DIO_DEVSIZE 0x00010000 /* size of a DIO device */
-
-#define DIOII_BASE 0x01000000 /* start of DIO-II space */
-#define DIOII_END 0x20000000 /* end of DIO-II space */
-#define DIOII_DEVSIZE 0x00400000 /* size of a DIO-II scode */
-#define DIOII_DEVSIZE_UNIT 0x00100000 /* unit of DIO-II size */
-
-/*
- * Find the highest select code for a given machine; HP320 doesn't
- * have DIO-II.
- */
-#if defined(HP320)
-#define DIO_SCMAX(machineid) ((machineid) == HP_320 ? 32 : 256)
-#else
-#define DIO_SCMAX(machineid) 256
-#endif
-
-/*
- * Base of DIO-II select codes.
- */
-#define DIOII_SCBASE 132
-
-/*
- * Macros to determine if device is DIO or DIO-II.
- */
-#define DIO_ISDIO(scode) ((scode) >= 0 && (scode) < 32)
-#define DIO_ISDIOII(scode) ((scode) >= DIOII_SCBASE && (scode) < 256)
-
-/*
- * Macro to determine if device is a framebuffer, given the
- * primary id of the device. We key off this to determine if
- * we should look at secondary id and ignore interrupt level.
- */
-#define DIO_ISFRAMEBUFFER(id) \
- ((id) == DIO_DEVICE_ID_FRAMEBUFFER)
-
-/*
- * Macro to extract primary and secondary device ids, given
- * the base address of the device.
- */
-#define DIO_ID(base) \
- (*((u_int8_t *)((u_long)(base) + DIO_IDOFF)))
-#define DIO_SECID(base) \
- (*((u_int8_t *)((u_long)(base) + DIO_SECIDOFF)))
-
-/*
- * Macro to extract the interrupt level, given the
- * base address of the device.
- */
-#define DIO_IPL(base) \
- ((((*((u_int8_t *)((u_long)(base) + DIO_IPLOFF))) >> 4) & 0x03) + 3)
-
-/*
- * Macro to compute the size of a DIO-II device's address
- * space, given the base address of the device.
- */
-#define DIOII_SIZE(base) \
- ((int)((*((u_int8_t *)((u_long)(base) + DIOII_SIZEOFF)) + 1) \
- * DIOII_DEVSIZE_UNIT))
-
-/*
- * Given a select code and device base address, compute
- * the size of the DIO/DIO-II device.
- */
-#define DIO_SIZE(scode, base) \
- (DIO_ISDIOII((scode)) ? DIOII_SIZE((base)) : DIO_DEVSIZE)
diff --git a/sys/arch/hp300/dev/diovar.h b/sys/arch/hp300/dev/diovar.h
deleted file mode 100644
index 05d8e0900ef..00000000000
--- a/sys/arch/hp300/dev/diovar.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: diovar.h,v 1.8 2010/04/15 20:38:09 miod Exp $ */
-/* $NetBSD: diovar.h,v 1.3 1997/05/05 21:01:33 thorpej 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 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.
- */
-
-/*
- * Autoconfiguration definitions and prototypes for the DIO bus.
- */
-
-/*
- * Arguments used to attach a device to the DIO bus.
- */
-struct dio_attach_args {
- int da_scode; /* select code */
- int da_size; /* size of address space */
- u_int8_t da_id; /* primary device id */
- u_int8_t da_secid; /* secondary device id */
-};
-
-/*
- * This structure is used by the autoconfiguration code to lookup
- * the size of a DIO device (not all use one select code).
- */
-struct dio_devdata {
- u_int8_t dd_id; /* primary device id */
- u_int8_t dd_secid; /* secondary device id */
- int dd_nscode; /* number of select codes */
-};
-
-/*
- * This structure is used by the autoconfiguration code to print
- * a textual description of a device.
- */
-struct dio_devdesc {
- u_int8_t dd_id; /* primary device id */
- u_int8_t dd_secid; /* secondary device id */
- const char *dd_desc; /* description */
-};
-
-#define diocf_scode cf_loc[0]
-
-#define DIO_UNKNOWN_SCODE -1
-
-#ifdef _KERNEL
-void *dio_scodetopa(int);
-void dio_intr_establish(struct isr *, const char *);
-void dio_intr_disestablish(struct isr *);
-
-/*
- * Return the next select code if the given select code lies within a hole,
- * zero otherwise.
- */
-int dio_inhole(int);
-#endif /* _KERNEL */
diff --git a/sys/arch/hp300/dev/dma.c b/sys/arch/hp300/dev/dma.c
deleted file mode 100644
index 33a9551ba68..00000000000
--- a/sys/arch/hp300/dev/dma.c
+++ /dev/null
@@ -1,572 +0,0 @@
-/* $OpenBSD: dma.c,v 1.20 2008/10/15 19:12:19 blambert Exp $ */
-/* $NetBSD: dma.c,v 1.19 1997/05/05 21:02:39 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995, 1996, 1997
- * Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dma.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * DMA driver
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/device.h>
-#include <sys/timeout.h>
-
-#include <machine/frame.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-
-#include <hp300/dev/dmareg.h>
-#include <hp300/dev/dmavar.h>
-
-#include <uvm/uvm_extern.h>
-
-/*
- * The largest single request will be MAXPHYS bytes which will require
- * at most MAXPHYS/NBPG+1 chain elements to describe, i.e. if none of
- * the buffer pages are physically contiguous (MAXPHYS/NBPG) and the
- * buffer is not page aligned (+1).
- */
-#define DMAMAXIO (MAXPHYS/NBPG+1)
-
-struct dma_chain {
- u_int dc_count;
- paddr_t dc_addr;
-};
-
-struct dma_channel {
- struct dmaqueue *dm_job; /* current job */
- struct dmadevice *dm_hwaddr; /* registers if DMA_C */
- struct dmaBdevice *dm_Bhwaddr; /* registers if not DMA_C */
- char dm_flags; /* misc. flags */
- u_short dm_cmd; /* DMA controller command */
- u_int dm_cur; /* current segment */
- u_int dm_last; /* last segment */
- struct dma_chain dm_chain[DMAMAXIO]; /* all segments */
-};
-
-struct dma_softc {
- struct dmareg *sc_dmareg; /* pointer to our hardware */
- struct isr sc_isr;
- struct dma_channel sc_chan[NDMACHAN]; /* 2 channels */
-#ifdef DEBUG
- struct timeout sc_timeout; /* DMA timeout */
-#endif
- TAILQ_HEAD(, dmaqueue) sc_queue; /* job queue */
- char sc_type; /* A, B, or C */
-} dma_softc;
-
-/* types */
-#define DMA_B 0
-#define DMA_C 1
-
-/* flags */
-#define DMAF_PCFLUSH 0x01
-#define DMAF_VCFLUSH 0x02
-#define DMAF_NOINTR 0x04
-
-void dmacflush(struct dma_channel *);
-int dmaintr(void *);
-
-#ifdef DEBUG
-int dmadebug = 0;
-#define DDB_WORD 0x01 /* same as DMAGO_WORD */
-#define DDB_LWORD 0x02 /* same as DMAGO_LWORD */
-#define DDB_FOLLOW 0x04
-#define DDB_IO 0x08
-
-void dmatimeout(void *);
-int dmatimo[NDMACHAN];
-
-long dmahits[NDMACHAN];
-long dmamisses[NDMACHAN];
-long dmabyte[NDMACHAN];
-long dmaword[NDMACHAN];
-long dmalword[NDMACHAN];
-#endif
-
-/*
- * Initialize the DMA engine, called by dioattach()
- */
-void
-dmainit()
-{
- struct dma_softc *sc = &dma_softc;
- struct dmareg *dma;
- struct dma_channel *dc;
- int i;
- char rev;
-
- /* There's just one. */
- sc->sc_dmareg = (struct dmareg *)DMA_BASE;
- dma = sc->sc_dmareg;
-
- /*
- * Determine the DMA type. A DMA_A or DMA_B will fail the
- * following probe.
- *
- * XXX Don't know how to easily differentiate the A and B cards,
- * so we just hope nobody has an A card (A cards will work if
- * splbio works out to ipl 3).
- */
- if (badbaddr((char *)&dma->dma_id[2])) {
- rev = 'B';
-#if !defined(HP320)
- panic("dmainit: DMA card requires hp320 support");
-#endif
- } else
- rev = dma->dma_id[2];
-
- sc->sc_type = (rev == 'B') ? DMA_B : DMA_C;
-
- TAILQ_INIT(&sc->sc_queue);
-
- for (i = 0; i < NDMACHAN; i++) {
- dc = &sc->sc_chan[i];
- dc->dm_job = NULL;
- switch (i) {
- case 0:
- dc->dm_hwaddr = &dma->dma_chan0;
- dc->dm_Bhwaddr = &dma->dma_Bchan0;
- break;
-
- case 1:
- dc->dm_hwaddr = &dma->dma_chan1;
- dc->dm_Bhwaddr = &dma->dma_Bchan1;
- break;
-
- default:
- panic("dmainit: more than 2 channels?");
- /* NOTREACHED */
- }
- }
-
-#ifdef DEBUG
- /* make sure timeout is really not needed */
- timeout_set(&sc->sc_timeout, dmatimeout, sc);
- timeout_add_sec(&sc->sc_timeout, 30);
-#endif
-
- printf("98620%c, 2 channels, %d bit DMA\n",
- rev, (rev == 'B') ? 16 : 32);
-
- /*
- * Defer hooking up our interrupt until the first
- * DMA-using controller has hooked up theirs.
- */
- sc->sc_isr.isr_func = NULL;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_priority = IPL_BIO;
-}
-
-/*
- * Compute the ipl and (re)establish the interrupt handler
- * for the DMA controller.
- */
-void
-dmacomputeipl()
-{
- struct dma_softc *sc = &dma_softc;
-
- if (sc->sc_isr.isr_func != NULL)
- intr_disestablish(&sc->sc_isr);
-
- /*
- * Our interrupt level must be as high as the highest
- * device using DMA (i.e. splbio).
- */
- sc->sc_isr.isr_ipl = PSLTOIPL(hp300_varpsl[IPL_BIO]);
-
- sc->sc_isr.isr_func = dmaintr;
- intr_establish(&sc->sc_isr, "dma");
-}
-
-int
-dmareq(struct dmaqueue *dq)
-{
- struct dma_softc *sc = &dma_softc;
- int i, chan, s;
-
- s = splvm();
-
- chan = dq->dq_chan;
- for (i = NDMACHAN - 1; i >= 0; i--) {
- /*
- * Can we use this channel?
- */
- if ((chan & (1 << i)) == 0)
- continue;
-
- /*
- * We can use it; is it busy?
- */
- if (sc->sc_chan[i].dm_job != NULL)
- continue;
-
- /*
- * Not busy; give the caller this channel.
- */
- sc->sc_chan[i].dm_job = dq;
- dq->dq_chan = i;
- splx(s);
- return (1);
- }
-
- /*
- * Couldn't get a channel now; put this in the queue.
- */
- TAILQ_INSERT_TAIL(&sc->sc_queue, dq, dq_list);
- splx(s);
- return (0);
-}
-
-void
-dmacflush(struct dma_channel *dc)
-{
-#if defined(CACHE_HAVE_PAC) || defined(M68040)
- if (dc->dm_flags & DMAF_PCFLUSH) {
- PCIA();
- dc->dm_flags &= ~DMAF_PCFLUSH;
- }
-#endif
-
-#if defined(CACHE_HAVE_VAC)
- if (dc->dm_flags & DMAF_VCFLUSH) {
- /*
- * 320/350s have VACs that may also need flushing.
- * In our case we only flush the supervisor side
- * because we know that if we are DMAing to user
- * space, the physical pages will also be mapped
- * in kernel space (via vmapbuf) and hence cache-
- * inhibited by the pmap module due to the multiple
- * mapping.
- */
- DCIS();
- dc->dm_flags &= ~DMAF_VCFLUSH;
- }
-#endif
-}
-
-void
-dmafree(struct dmaqueue *dq)
-{
- int unit = dq->dq_chan;
- struct dma_softc *sc = &dma_softc;
- struct dma_channel *dc = &sc->sc_chan[unit];
- struct dmaqueue *dn;
- int chan, s;
-
- s = splvm();
-
-#ifdef DEBUG
- dmatimo[unit] = 0;
-#endif
-
- DMA_CLEAR(dc);
-
- /*
- * XXX we may not always go through the flush code in dmastop()
- */
- dmacflush(dc);
-
- /*
- * Channel is now free. Look for another job to run on this
- * channel.
- */
- dc->dm_job = NULL;
- chan = 1 << unit;
- TAILQ_FOREACH(dn, &sc->sc_queue, dq_list) {
- if (dn->dq_chan & chan) {
- /* Found one... */
- TAILQ_REMOVE(&sc->sc_queue, dn, dq_list);
- dc->dm_job = dn;
- dn->dq_chan = dq->dq_chan;
- splx(s);
-
- /* Start the initiator. */
- (*dn->dq_start)(dn->dq_softc);
- return;
- }
- }
- splx(s);
-}
-
-void
-dmago(int unit, char *addr, u_int count, int flags)
-{
- struct dma_softc *sc = &dma_softc;
- struct dma_channel *dc = &sc->sc_chan[unit];
- paddr_t dmaend = 0;
- u_int seg, tcount;
-
-#ifdef DIAGNOSTIC
- if (count > MAXPHYS)
- panic("dmago: count > MAXPHYS");
-#endif
-
-#if defined(HP320)
- if (sc->sc_type == DMA_B && (flags & DMAGO_LWORD))
- panic("dmago: no can do 32-bit DMA");
-#endif
-
-#ifdef DEBUG
- if (dmadebug & DDB_FOLLOW)
- printf("dmago(%d, %p, %x, %x)\n",
- unit, addr, count, flags);
- if (flags & DMAGO_LWORD)
- dmalword[unit]++;
- else if (flags & DMAGO_WORD)
- dmaword[unit]++;
- else
- dmabyte[unit]++;
-#endif
- /*
- * Build the DMA chain
- */
- for (seg = 0; count > 0; seg++) {
- if (pmap_extract(pmap_kernel(), (vaddr_t)addr,
- &dc->dm_chain[seg].dc_addr) == FALSE)
- panic("dmago: pmap_extract(%x) failed", addr);
-#if defined(M68040)
- /*
- * Push back dirty cache lines
- */
- if (mmutype == MMU_68040)
- DCFP(dc->dm_chain[seg].dc_addr);
-#endif
- if (count < (tcount = PAGE_SIZE - ((int)addr & PAGE_MASK)))
- tcount = count;
- dc->dm_chain[seg].dc_count = tcount;
- addr += tcount;
- count -= tcount;
- if (flags & DMAGO_LWORD)
- tcount >>= 2;
- else if (flags & DMAGO_WORD)
- tcount >>= 1;
-
- /*
- * Try to compact the DMA transfer if the pages are adjacent.
- * Note: this will never happen on the first iteration.
- */
- if (dc->dm_chain[seg].dc_addr == dmaend
-#if defined(HP320)
- /* only 16-bit count on 98620B */
- && (sc->sc_type != DMA_B ||
- dc->dm_chain[seg - 1].dc_count + tcount <= 65536)
-#endif
- ) {
-#ifdef DEBUG
- dmahits[unit]++;
-#endif
- dmaend += dc->dm_chain[seg].dc_count;
- dc->dm_chain[--seg].dc_count += tcount;
- } else {
-#ifdef DEBUG
- dmamisses[unit]++;
-#endif
- dmaend = dc->dm_chain[seg].dc_addr +
- dc->dm_chain[seg].dc_count;
- dc->dm_chain[seg].dc_count = tcount;
- }
- }
- dc->dm_cur = 0;
- dc->dm_last = --seg;
- dc->dm_flags = 0;
- /*
- * Set up the command word based on flags
- */
- dc->dm_cmd = DMA_ENAB | DMA_IPL(sc->sc_isr.isr_ipl) | DMA_START;
- if ((flags & DMAGO_READ) == 0)
- dc->dm_cmd |= DMA_WRT;
- if (flags & DMAGO_LWORD)
- dc->dm_cmd |= DMA_LWORD;
- else if (flags & DMAGO_WORD)
- dc->dm_cmd |= DMA_WORD;
- if (flags & DMAGO_PRI)
- dc->dm_cmd |= DMA_PRI;
-
- if (flags & DMAGO_READ) {
-#if defined(M68040)
- /*
- * On the 68040 we need to flush (push) the data cache before a
- * DMA (already done above) and flush again after DMA completes.
- * In theory we should only need to flush prior to a write DMA
- * and purge after a read DMA but if the entire page is not
- * involved in the DMA we might purge some valid data.
- */
- if (mmutype == MMU_68040)
- dc->dm_flags |= DMAF_PCFLUSH;
-#endif
-
-#if defined(CACHE_HAVE_PAC)
- /*
- * Remember if we need to flush external physical cache when
- * DMA is done. We only do this if we are reading
- * (writing memory).
- */
- if (ectype == EC_PHYS)
- dc->dm_flags |= DMAF_PCFLUSH;
-#endif
-
-#if defined(CACHE_HAVE_VAC)
- if (ectype == EC_VIRT)
- dc->dm_flags |= DMAF_VCFLUSH;
-#endif
- }
-
- /*
- * Remember if we can skip the dma completion interrupt on
- * the last segment in the chain.
- */
- if (flags & DMAGO_NOINT) {
- if (dc->dm_cur == dc->dm_last)
- dc->dm_cmd &= ~DMA_ENAB;
- else
- dc->dm_flags |= DMAF_NOINTR;
- }
-#ifdef DEBUG
- if (dmadebug & DDB_IO) {
- if (((dmadebug&DDB_WORD) && (dc->dm_cmd&DMA_WORD)) ||
- ((dmadebug&DDB_LWORD) && (dc->dm_cmd&DMA_LWORD))) {
- printf("dmago: cmd %x, flags %x\n",
- dc->dm_cmd, dc->dm_flags);
- for (seg = 0; seg <= dc->dm_last; seg++)
- printf(" %d: %d@%p\n", seg,
- dc->dm_chain[seg].dc_count,
- dc->dm_chain[seg].dc_addr);
- }
- }
- dmatimo[unit] = 1;
-#endif
- DMA_ARM(sc, dc);
-}
-
-void
-dmastop(int unit)
-{
- struct dma_softc *sc = &dma_softc;
- struct dma_channel *dc = &sc->sc_chan[unit];
-
-#ifdef DEBUG
- if (dmadebug & DDB_FOLLOW)
- printf("dmastop(%d)\n", unit);
- dmatimo[unit] = 0;
-#endif
- DMA_CLEAR(dc);
-
- dmacflush(dc);
-
- /*
- * We may get this interrupt after a device service routine
- * has freed the dma channel. So, ignore the intr if there's
- * nothing on the queue.
- */
- if (dc->dm_job != NULL)
- (*dc->dm_job->dq_done)(dc->dm_job->dq_softc);
-}
-
-int
-dmaintr(void *arg)
-{
- struct dma_softc *sc = arg;
- struct dma_channel *dc;
- int i, stat;
- int found = 0;
-
-#ifdef DEBUG
- if (dmadebug & DDB_FOLLOW)
- printf("dmaintr\n");
-#endif
- for (i = 0; i < NDMACHAN; i++) {
- dc = &sc->sc_chan[i];
- stat = DMA_STAT(dc);
- if ((stat & DMA_INTR) == 0)
- continue;
- found++;
-#ifdef DEBUG
- if (dmadebug & DDB_IO) {
- if (((dmadebug&DDB_WORD) && (dc->dm_cmd&DMA_WORD)) ||
- ((dmadebug&DDB_LWORD) && (dc->dm_cmd&DMA_LWORD)))
- printf("dmaintr: flags %x unit %d stat %x next %d\n",
- dc->dm_flags, i, stat, dc->dm_cur + 1);
- }
- if (stat & DMA_ARMED)
- printf("dma channel %d: intr when armed\n", i);
-#endif
- /*
- * Load the next segment, or finish up if we're done.
- */
- dc->dm_cur++;
- if (dc->dm_cur <= dc->dm_last) {
-#ifdef DEBUG
- dmatimo[i] = 1;
-#endif
- /*
- * If we're the last segment, disable the
- * completion interrupt, if necessary.
- */
- if (dc->dm_cur == dc->dm_last &&
- (dc->dm_flags & DMAF_NOINTR))
- dc->dm_cmd &= ~DMA_ENAB;
- DMA_CLEAR(dc);
- DMA_ARM(sc, dc);
- } else
- dmastop(i);
- }
- return(found);
-}
-
-#ifdef DEBUG
-void
-dmatimeout(void *arg)
-{
- int i, s;
- struct dma_softc *sc = arg;
-
- for (i = 0; i < NDMACHAN; i++) {
- s = splvm();
- if (dmatimo[i]) {
- if (dmatimo[i] > 1)
- printf("dma channel %d timeout #%d\n",
- i, dmatimo[i]-1);
- dmatimo[i]++;
- }
- splx(s);
- }
- timeout_add_sec(&sc->sc_timeout, 30);
-}
-#endif
diff --git a/sys/arch/hp300/dev/dmareg.h b/sys/arch/hp300/dev/dmareg.h
deleted file mode 100644
index 3a5d68b2a77..00000000000
--- a/sys/arch/hp300/dev/dmareg.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $OpenBSD: dmareg.h,v 1.10 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: dmareg.h,v 1.12 1997/05/05 21:02:40 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dmareg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-/*
- * Hardware layout for the 98620[ABC]:
- * 98620A (old 320s?): byte/word DMA in up to 64K chunks
- * 98620B (320s only): 98620A with programmable IPL
- * 98620C (all others): byte/word/longword DMA in up to 4Gb chunks
- */
-
-struct dmaBdevice {
- v_char *dmaB_addr;
- vu_short dmaB_count;
- vu_short dmaB_cmd;
-#define dmaB_stat dmaB_cmd
-} __packed;
-
-struct dmadevice {
- v_char *dma_addr;
- vu_int dma_count;
- vu_short dma_cmd;
- vu_short dma_stat;
-} __packed;
-
-struct dmareg {
- struct dmaBdevice dma_Bchan0;
- struct dmaBdevice dma_Bchan1;
-/* the rest are 98620C specific */
- v_char dma_id[4];
- vu_char dma_cr;
- char dma_pad1[0xEB];
- struct dmadevice dma_chan0;
- char dma_pad2[0xF4];
- struct dmadevice dma_chan1;
-} __packed;
-
-/* The hp300 has 2 DMA channels. */
-#define NDMACHAN 2
-
-/* addresses */
-#define DMA_BASE IIOV(0x500000)
-
-/* command bits */
-#define DMA_ENAB 0x0001
-#define DMA_WORD 0x0002
-#define DMA_WRT 0x0004
-#define DMA_PRI 0x0008
-#define DMA_IPL(x) (((x) - 3) << 4)
-#define DMA_LWORD 0x0100
-#define DMA_START 0x8000
-
-/* status bits */
-#define DMA_ARMED 0x01
-#define DMA_INTR 0x02
-#define DMA_ACC 0x04
-#define DMA_HALT 0x08
-#define DMA_BERR 0x10
-#define DMA_ALIGN 0x20
-#define DMA_WRAP 0x40
-
-#ifdef _KERNEL
-/*
- * Macros to attempt to hide the HW differences between the 98620B DMA
- * board and the 1TQ4-0401 DMA chip (68020C "board"). The latter
- * includes emulation registers for the former but you need to access
- * the "native-mode" registers directly in order to do 32-bit DMA.
- *
- * DMA_CLEAR: Clear interrupt on DMA board. We just use the
- * emulation registers on the 98620C as that is easiest.
- * DMA_STAT: Read status register. Again, we always read the
- * emulation register. Someday we might want to
- * look at the 98620C status to get the extended bits.
- * DMA_ARM: Load address, count and kick-off DMA.
- */
-#define DMA_CLEAR(dc) do { \
- v_int dmaclr; \
- dmaclr = (int)dc->dm_Bhwaddr->dmaB_addr; \
- } while (0);
-#define DMA_STAT(dc) dc->dm_Bhwaddr->dmaB_stat
-
-#if defined(HP320)
-#define DMA_ARM(sc, dc) \
- if (sc->sc_type == DMA_B) { \
- struct dmaBdevice *dma = dc->dm_Bhwaddr; \
- dma->dmaB_addr = (v_char *)dc->dm_chain[dc->dm_cur].dc_addr; \
- dma->dmaB_count = dc->dm_chain[dc->dm_cur].dc_count - 1; \
- dma->dmaB_cmd = dc->dm_cmd; \
- } else { \
- struct dmadevice *dma = dc->dm_hwaddr; \
- dma->dma_addr = (v_char *)dc->dm_chain[dc->dm_cur].dc_addr; \
- dma->dma_count = dc->dm_chain[dc->dm_cur].dc_count - 1; \
- dma->dma_cmd = dc->dm_cmd; \
- }
-#else
-#define DMA_ARM(sc, dc) \
- { \
- struct dmadevice *dma = dc->dm_hwaddr; \
- dma->dma_addr = (v_char *)dc->dm_chain[dc->dm_cur].dc_addr; \
- dma->dma_count = dc->dm_chain[dc->dm_cur].dc_count - 1; \
- dma->dma_cmd = dc->dm_cmd; \
- }
-#endif
-#endif
diff --git a/sys/arch/hp300/dev/dmavar.h b/sys/arch/hp300/dev/dmavar.h
deleted file mode 100644
index 5c42d90ce4d..00000000000
--- a/sys/arch/hp300/dev/dmavar.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* $OpenBSD: dmavar.h,v 1.7 2005/11/17 23:56:02 miod Exp $ */
-/* $NetBSD: dmavar.h,v 1.9 1997/04/01 03:10:59 scottr Exp $ */
-
-/*
- * Copyright (c) 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dmavar.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/queue.h>
-
-/* dmago flags */
-#define DMAGO_BYTE 0x00 /* do byte (8 bit) transfers */
-#define DMAGO_WORD 0x01 /* do word (16 bit) transfers */
-#define DMAGO_LWORD 0x02 /* do longword (32 bit) transfers */
-#define DMAGO_PRI 0x04 /* do "priority" DMA */
-#define DMAGO_READ 0x08 /* transfer is a read */
-#define DMAGO_NOINT 0x80 /* don't interrupt on completion */
-
-/* dma "controllers" (channels) */
-#define DMA0 0x1
-#define DMA1 0x2
-
-/*
- * A DMA queue entry. Initiator drivers each have one of these,
- * used to queue access to the DMA controller.
- */
-struct dmaqueue {
- TAILQ_ENTRY(dmaqueue) dq_list; /* entry on the queue */
- int dq_chan; /* OR of channels initiator can use */
- void *dq_softc; /* initiator's softc */
-
- /*
- * These functions are called to start the initiator when
- * it has been given the DMA controller, and to stop the
- * initiator when the DMA controller has stopped.
- */
- void (*dq_start)(void *);
- void (*dq_done)(void *);
-};
-
-#ifdef _KERNEL
-void dmainit(void);
-void dmago(int, char *, u_int, int);
-void dmastop(int);
-void dmafree(struct dmaqueue *);
-int dmareq(struct dmaqueue *);
-void dmacomputeipl(void);
-#endif /* _KERNEL */
diff --git a/sys/arch/hp300/dev/dnkbd.c b/sys/arch/hp300/dev/dnkbd.c
deleted file mode 100644
index 5f28644d2e9..00000000000
--- a/sys/arch/hp300/dev/dnkbd.c
+++ /dev/null
@@ -1,1063 +0,0 @@
-/* $OpenBSD: dnkbd.c,v 1.19 2014/01/26 17:48:07 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- * Copyright (c) 1997 Michael Smith. 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 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 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.
- */
-
-/*
- * Driver for the Apollo Domain keyboard and mouse.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/timeout.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <dev/cons.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wskbdvar.h>
-#include <dev/wscons/wsksymdef.h>
-#include <dev/wscons/wsksymvar.h>
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-#include <dev/wscons/wskbdraw.h>
-#endif
-#include "wsmouse.h"
-#if NWSMOUSE > 0
-#include <dev/wscons/wsmousevar.h>
-#endif
-
-#include <hp300/dev/apcireg.h>
-#include <hp300/dev/apcivar.h>
-#include <hp300/dev/dcareg.h>
-#include <hp300/dev/dnkbdmap.h>
-#include <hp300/dev/frodoreg.h>
-#include <hp300/dev/frodovar.h>
-
-#include "hilkbd.h"
-
-/*
- * Keyboard key codes
- */
-
-#define DNKEY_CAPSLOCK 0x7e
-#define DNKEY_REPEAT 0x7f
-#define DNKEY_RELEASE 0x80
-#define DNKEY_CHANNEL 0xff
-
-/*
- * Channels
- */
-
-#define DNCHANNEL_RESET 0x00
-#define DNCHANNEL_KBD 0x01
-#define DNCHANNEL_MOUSE 0x02
-
-/*
- * Keyboard modes
- */
-
-#define DNMODE_COOKED 0x00
-#define DNMODE_RAW 0x01
-
-/*
- * Keyboard commands
- */
-
-#define DNCMD_PREFIX 0xff
-#define DNCMD_COOKED DNMODE_COOKED
-#define DNCMD_RAW DNMODE_RAW
-#define DNCMD_IDENT_1 0x12
-#define DNCMD_IDENT_2 0x21
-
-/*
- * Bell commands
- */
-
-#define DNCMD_BELL 0x21
-#define DNCMD_BELL_ON 0x81
-#define DNCMD_BELL_OFF 0x82
-
-/*
- * Mouse status
- */
-
-#define DNBUTTON_L 0x10
-#define DNBUTTON_R 0x20
-#define DNBUTTON_M 0x40
-
-struct dnkbd_softc {
- struct device sc_dev;
- struct isr sc_isr;
- struct apciregs *sc_regs;
-
- int sc_flags;
-#define SF_ENABLED 0x01 /* keyboard enabled */
-#define SF_CONSOLE 0x02 /* keyboard is console */
-#define SF_POLLING 0x04 /* polling mode */
-#define SF_PLUGGED 0x08 /* keyboard has been seen plugged */
-#define SF_ATTACHED 0x10 /* subdevices have been attached */
-#define SF_MOUSE 0x20 /* mouse enabled */
-#define SF_BELL 0x40 /* bell is active */
-#define SF_BELL_TMO 0x80 /* bell stop timeout is scheduled */
-
- u_int sc_identlen;
-#define MAX_IDENTLEN 32
- char sc_ident[MAX_IDENTLEN];
- kbd_t sc_layout;
-
- enum { STATE_KEYBOARD, STATE_MOUSE, STATE_CHANNEL, STATE_ECHO }
- sc_state, sc_prevstate;
- u_int sc_echolen;
-
- u_int8_t sc_mousepkt[3]; /* mouse packet being constructed */
- u_int sc_mousepos; /* index in above */
-
- struct timeout sc_bellstop_tmo;
-
- struct device *sc_wskbddev;
-#if NWSMOUSE > 0
- struct device *sc_wsmousedev;
-#endif
-
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- int sc_rawkbd;
-#endif
-};
-
-int dnkbd_match(struct device *, void *, void *);
-void dnkbd_attach(struct device *, struct device *, void *);
-
-struct cfdriver dnkbd_cd = {
- NULL, "dnkbd", DV_DULL
-};
-
-struct cfattach dnkbd_ca = {
- sizeof(struct dnkbd_softc), dnkbd_match, dnkbd_attach
-};
-
-int dnkbd_enable(void *, int);
-void dnkbd_set_leds(void *, int);
-int dnkbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
-
-const struct wskbd_accessops dnkbd_accessops = {
- dnkbd_enable,
- dnkbd_set_leds,
- dnkbd_ioctl
-};
-
-#if NWSMOUSE > 0
-int dnmouse_enable(void *);
-int dnmouse_ioctl(void *, u_long, caddr_t, int, struct proc *);
-void dnmouse_disable(void *);
-
-const struct wsmouse_accessops dnmouse_accessops = {
- dnmouse_enable,
- dnmouse_ioctl,
- dnmouse_disable
-};
-#endif
-
-void dnkbd_bell(void *, u_int, u_int, u_int);
-void dnkbd_cngetc(void *, u_int *, int *);
-void dnkbd_cnpollc(void *, int);
-
-const struct wskbd_consops dnkbd_consops = {
- dnkbd_cngetc,
- dnkbd_cnpollc,
- dnkbd_bell
-};
-
-struct wskbd_mapdata dnkbd_keymapdata = {
- dnkbd_keydesctab,
-#ifdef DNKBD_LAYOUT
- DNKBD_LAYOUT
-#else
- KB_US | KB_DEFAULT
-#endif
-};
-
-typedef enum { EVENT_NONE, EVENT_KEYBOARD, EVENT_MOUSE } dnevent;
-
-void dnevent_kbd(struct dnkbd_softc *, int);
-void dnevent_kbd_internal(struct dnkbd_softc *, int);
-void dnevent_mouse(struct dnkbd_softc *, u_int8_t *);
-void dnkbd_attach_subdevices(struct dnkbd_softc *);
-void dnkbd_bellstop(void *);
-void dnkbd_decode(int, u_int *, int *);
-int dnkbd_init(struct apciregs *);
-dnevent dnkbd_input(struct dnkbd_softc *, int);
-int dnkbd_intr(void *);
-int dnkbd_pollin(struct apciregs *, u_int);
-int dnkbd_pollout(struct apciregs *, int);
-int dnkbd_probe(struct dnkbd_softc *);
-int dnkbd_send(struct apciregs *, const u_int8_t *, size_t);
-int dnsubmatch_kbd(struct device *, void *, void *);
-int dnsubmatch_mouse(struct device *, void *, void *);
-
-int
-dnkbd_match(struct device *parent, void *match, void *aux)
-{
- struct frodo_attach_args *fa = aux;
-
- if (strcmp(fa->fa_name, dnkbd_cd.cd_name) != 0)
- return (0);
-
- /* only attach to the first frodo port */
- return (fa->fa_offset == FRODO_APCI_OFFSET(0));
-}
-
-void
-dnkbd_attach(struct device *parent, struct device *self, void *aux)
-{
- struct dnkbd_softc *sc = (struct dnkbd_softc *)self;
- struct frodo_attach_args *fa = aux;
-
- printf(": ");
-
- sc->sc_regs = (struct apciregs *)IIOV(FRODO_BASE + fa->fa_offset);
-
- timeout_set(&sc->sc_bellstop_tmo, dnkbd_bellstop, sc);
-
- /* reset the port */
- apciinit(sc->sc_regs, 1200, CFCR_8BITS | CFCR_PEVEN | CFCR_PENAB);
-
- sc->sc_isr.isr_func = dnkbd_intr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_priority = IPL_TTY;
- frodo_intr_establish(parent, fa->fa_line, &sc->sc_isr, self->dv_xname);
-
- /* probe for keyboard */
- if (dnkbd_probe(sc) != 0) {
- printf("no keyboard\n");
- return;
- }
-
- dnkbd_attach_subdevices(sc);
-}
-
-void
-dnkbd_attach_subdevices(struct dnkbd_softc *sc)
-{
- struct wskbddev_attach_args ka;
-#if NWSMOUSE > 0
- struct wsmousedev_attach_args ma;
-#endif
-#if NHILKBD > 0
- extern int hil_is_console;
-#endif
- extern struct consdev wsdisplay_cons;
-
- /*
- * If both hilkbd and dnkbd are configured, prefer the Domain
- * keyboard as console (if we are here, we know the keyboard is
- * plugged), unless the console keyboard has been claimed already
- * (i.e. late hotplug with hil keyboard plugged first).
- */
- if (cn_tab == &wsdisplay_cons) {
-#if NHILKBD > 0
- if (hil_is_console == -1) {
- ka.console = 1;
- hil_is_console = 0;
- } else
- ka.console = 0;
-#else
- ka.console = 1;
-#endif
- } else
- ka.console = 0;
-
- ka.keymap = &dnkbd_keymapdata;
- ka.accessops = &dnkbd_accessops;
- ka.accesscookie = sc;
-#ifndef DKKBD_LAYOUT
- dnkbd_keymapdata.layout = sc->sc_layout;
-#endif
-
- if (ka.console) {
- sc->sc_flags = SF_PLUGGED | SF_CONSOLE | SF_ENABLED;
- wskbd_cnattach(&dnkbd_consops, sc, &dnkbd_keymapdata);
- } else {
- sc->sc_flags = SF_PLUGGED;
- }
-
- sc->sc_wskbddev = config_found_sm(&sc->sc_dev, &ka, wskbddevprint,
- dnsubmatch_kbd);
-
-#if NWSMOUSE > 0
- ma.accessops = &dnmouse_accessops;
- ma.accesscookie = sc;
-
- sc->sc_wsmousedev = config_found_sm(&sc->sc_dev, &ma, wsmousedevprint,
- dnsubmatch_mouse);
-#endif
-
- SET(sc->sc_flags, SF_ATTACHED);
-}
-
-int
-dnsubmatch_kbd(struct device *parent, void *match, void *aux)
-{
- struct cfdata *cf = match;
- extern struct cfdriver wskbd_cd;
-
- if (strcmp(cf->cf_driver->cd_name, wskbd_cd.cd_name) != 0)
- return (0);
-
- return ((*cf->cf_attach->ca_match)(parent, cf, aux));
-}
-
-#if NWSMOUSE > 0
-int
-dnsubmatch_mouse(struct device *parent, void *match, void *aux)
-{
- struct cfdata *cf = match;
- extern struct cfdriver wsmouse_cd;
-
- if (strcmp(cf->cf_driver->cd_name, wsmouse_cd.cd_name) != 0)
- return (0);
-
- return ((*cf->cf_attach->ca_match)(parent, cf, aux));
-}
-#endif
-
-int
-dnkbd_probe(struct dnkbd_softc *sc)
-{
- int dat, rc, flags;
- u_int8_t cmdbuf[2];
- char rspbuf[MAX_IDENTLEN], *word, *end;
- u_int i;
- int s;
-
- s = spltty();
- flags = sc->sc_flags;
- SET(sc->sc_flags, SF_POLLING);
- sc->sc_state = STATE_CHANNEL;
- splx(s);
-
- /*
- * Switch keyboard to raw mode.
- */
- cmdbuf[0] = DNCMD_RAW;
- rc = dnkbd_send(sc->sc_regs, cmdbuf, 1);
- if (rc != 0)
- goto out;
-
- /*
- * Send the identify command.
- */
- cmdbuf[0] = DNCMD_IDENT_1;
- cmdbuf[1] = DNCMD_IDENT_2;
- rc = dnkbd_send(sc->sc_regs, cmdbuf, 2);
- if (rc != 0)
- goto out;
-
- for (i = 0; ; i++) {
- dat = dnkbd_pollin(sc->sc_regs, 10000);
- if (dat == -1)
- break;
-
- if (i < sizeof(rspbuf))
- rspbuf[i] = dat;
- }
-
- if (i > sizeof(rspbuf) || i == 0) {
- printf("%s: unexpected identify string length %d\n",
- sc->sc_dev.dv_xname, i);
- rc = ENXIO;
- goto out;
- }
-
- /*
- * Make sure the identification string is NULL terminated
- * (overwriting the keyboard mode byte if necessary).
- */
- i--;
- if (rspbuf[i] != 0)
- rspbuf[i] = 0;
-
- /*
- * Now display the identification strings, if they changed.
- */
- if (i != sc->sc_identlen || bcmp(rspbuf, sc->sc_ident, i) != 0) {
- sc->sc_layout = KB_US;
- sc->sc_identlen = i;
- bcopy(rspbuf, sc->sc_ident, i);
-
- if (cold == 0)
- printf("%s: ", sc->sc_dev.dv_xname);
- printf("model ");
- word = rspbuf;
- for (i = 0; i < 3; i++) {
- end = strchr(word, '\r');
- if (end == NULL)
- break;
- *end++ = '\0';
- printf("<%s> ", word);
- /*
- * Parse the layout code if applicable
- */
- if (i == 1 && *word++ == '3') {
- if (*word == '-')
- word++;
- switch (*word) {
-#if 0
- default:
- case ' ':
- sc->sc_layout = KB_US;
- break;
-#endif
- case 'a':
- sc->sc_layout = KB_DE;
- break;
- case 'b':
- sc->sc_layout = KB_FR;
- break;
- case 'c':
- sc->sc_layout = KB_DK;
- break;
- case 'd':
- sc->sc_layout = KB_SV;
- break;
- case 'e':
- sc->sc_layout = KB_UK;
- break;
- case 'f':
- sc->sc_layout = KB_JP;
- break;
- case 'g':
- sc->sc_layout = KB_SG;
- break;
- }
- }
- word = end;
- }
- printf("\n");
- }
-
- /*
- * Ready to work, the default channel is the keyboard.
- */
- sc->sc_state = STATE_KEYBOARD;
-
-out:
- s = spltty();
- sc->sc_flags = flags;
- splx(s);
-
- return (rc);
-}
-
-/*
- * State machine.
- *
- * In raw mode, the keyboard may feed us the following sequences:
- * - on the keyboard channel:
- * + a raw key code, in the range 0x01-0x7e, or'ed with 0x80 if key release.
- * + the key repeat sequence 0x7f.
- * - on the mouse channel:
- * + a 3 byte mouse sequence (buttons state, dx move, dy move).
- * - at any time:
- * + a 2 byte channel sequence (0xff followed by the channel number) telling
- * us which device the following input will come from.
- * + if we get 0xff but an invalid channel number, this is a command echo.
- * Currently we only handle this for bell commands, which size are known.
- * Other commands are issued through dnkbd_send() which ``eats'' the echo.
- *
- * Older keyboards reset the channel to the keyboard (by sending ff 01) after
- * every mouse packet.
- */
-
-dnevent
-dnkbd_input(struct dnkbd_softc *sc, int dat)
-{
- dnevent event = EVENT_NONE;
-
- switch (sc->sc_state) {
- case STATE_KEYBOARD:
- switch (dat) {
- case DNKEY_REPEAT:
- /*
- * We ignore event repeats, as wskbd does its own
- * soft repeat processing.
- */
- break;
- case DNKEY_CHANNEL:
- sc->sc_prevstate = sc->sc_state;
- sc->sc_state = STATE_CHANNEL;
- break;
- default:
- event = EVENT_KEYBOARD;
- break;
- }
- break;
-
- case STATE_MOUSE:
- if (dat == DNKEY_CHANNEL && sc->sc_mousepos == 0) {
- sc->sc_prevstate = sc->sc_state;
- sc->sc_state = STATE_CHANNEL;
- } else {
- sc->sc_mousepkt[sc->sc_mousepos++] = dat;
- if (sc->sc_mousepos == sizeof(sc->sc_mousepkt)) {
- sc->sc_mousepos = 0;
- event = EVENT_MOUSE;
- }
- }
- break;
-
- case STATE_CHANNEL:
- switch (dat) {
- case DNKEY_CHANNEL:
- /*
- * During hotplug, we might get spurious 0xff bytes.
- * Ignore them.
- */
- break;
- case DNCHANNEL_RESET:
- /*
- * Identify the keyboard again. This will switch it to
- * raw mode again. If this fails, we'll consider the
- * keyboard as unplugged (to ignore further events until
- * a successful reset).
- */
- if (dnkbd_probe(sc) == 0) {
- /*
- * We need to attach wskbd and wsmouse children
- * if this is a live first plug.
- */
- if (!ISSET(sc->sc_flags, SF_ATTACHED))
- dnkbd_attach_subdevices(sc);
- SET(sc->sc_flags, SF_PLUGGED);
- } else {
- CLR(sc->sc_flags, SF_PLUGGED);
- }
-
- sc->sc_state = STATE_KEYBOARD;
- break;
- case DNCHANNEL_KBD:
- sc->sc_state = STATE_KEYBOARD;
- break;
- case DNCHANNEL_MOUSE:
- sc->sc_state = STATE_MOUSE;
- sc->sc_mousepos = 0; /* just in case */
- break;
- case DNCMD_BELL:
- /*
- * We are getting a bell command echoed to us.
- * Ignore it.
- */
- sc->sc_state = STATE_ECHO;
- sc->sc_echolen = 1; /* one byte to follow */
- break;
- default:
- printf("%s: unexpected channel byte %02x\n",
- sc->sc_dev.dv_xname, dat);
- break;
- }
- break;
-
- case STATE_ECHO:
- if (--sc->sc_echolen == 0) {
- /* get back to the state we were in before the echo */
- sc->sc_state = sc->sc_prevstate;
- }
- break;
- }
-
- return (event);
-}
-
-/*
- * Event breakers.
- */
-
-void
-dnkbd_decode(int keycode, u_int *type, int *key)
-{
- *type = (keycode & DNKEY_RELEASE) ?
- WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN;
- *key = (keycode & ~DNKEY_RELEASE);
-}
-
-void
-dnevent_kbd(struct dnkbd_softc *sc, int dat)
-{
- if (!ISSET(sc->sc_flags, SF_PLUGGED))
- return;
-
- if (sc->sc_wskbddev == NULL)
- return;
-
- if (!ISSET(sc->sc_flags, SF_ENABLED))
- return;
-
- /*
- * Even in raw mode, the caps lock key is treated specially:
- * first key press causes event 0x7e, release causes no event;
- * then a new key press causes nothing, and release causes
- * event 0xfe. Moreover, while kept down, it does not produce
- * repeat events.
- *
- * So the best we can do is fake the missed events, but this
- * will not allow the capslock key to be remapped as a control
- * key since it will not be possible to chord it with anything.
- */
- dnevent_kbd_internal(sc, dat);
- if ((dat & ~DNKEY_RELEASE) == DNKEY_CAPSLOCK)
- dnevent_kbd_internal(sc, dat ^ DNKEY_RELEASE);
-}
-
-void
-dnevent_kbd_internal(struct dnkbd_softc *sc, int dat)
-{
- u_int type;
- int key;
- int s;
-
- dnkbd_decode(dat, &type, &key);
-
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- if (sc->sc_rawkbd) {
- u_char cbuf[2];
- int c, j = 0;
-
- c = dnkbd_raw[key];
- if (c != RAWKEY_Null) {
- /* fake extended scancode if necessary */
- if (c & 0x80)
- cbuf[j++] = 0xe0;
- cbuf[j] = c & 0x7f;
- if (type == WSCONS_EVENT_KEY_UP)
- cbuf[j] |= 0x80;
- j++;
-
- s = spltty();
- wskbd_rawinput(sc->sc_wskbddev, cbuf, j);
- splx(s);
- }
- } else
-#endif
- {
- s = spltty();
- wskbd_input(sc->sc_wskbddev, type, key);
- splx(s);
- }
-}
-
-#if NWSMOUSE > 0
-void
-dnevent_mouse(struct dnkbd_softc *sc, u_int8_t *dat)
-{
- if (!ISSET(sc->sc_flags, SF_PLUGGED))
- return;
-
- if (sc->sc_wsmousedev == NULL)
- return;
-
- if (!ISSET(sc->sc_flags, SF_MOUSE))
- return;
-
- /*
- * First byte is button status. It has the 0x80 bit always set, and
- * the next 3 bits are *cleared* when the mouse buttons are pressed.
- */
-#ifdef DEBUG
- if (!ISSET(*dat, 0x80)) {
- printf("%s: incorrect mouse packet %02x %02x %02x\n",
- sc->sc_dev.dv_xname, dat[0], dat[1], dat[2]);
- return;
- }
-#endif
-
- wsmouse_input(sc->sc_wsmousedev,
- (~dat[0] & (DNBUTTON_L | DNBUTTON_M | DNBUTTON_R)) >> 4,
- (int8_t)dat[1], (int8_t)dat[2], 0, 0, WSMOUSE_INPUT_DELTA);
-}
-#endif
-
-/*
- * Low-level communication routines.
- */
-
-int
-dnkbd_pollin(struct apciregs *apci, u_int tries)
-{
- u_int cnt;
-
- for (cnt = tries; cnt != 0; cnt--) {
- if (apci->ap_lsr & LSR_RXRDY)
- break;
- DELAY(10);
- }
-
- if (cnt == 0)
- return (-1);
- else
- return ((int)apci->ap_data);
-}
-
-int
-dnkbd_pollout(struct apciregs *apci, int dat)
-{
- u_int cnt;
-
- for (cnt = 10000; cnt != 0; cnt--) {
- if (apci->ap_lsr & LSR_TXRDY)
- break;
- DELAY(10);
- }
- if (cnt == 0)
- return (EBUSY);
- else {
- apci->ap_data = dat;
- return (0);
- }
-}
-
-int
-dnkbd_send(struct apciregs *apci, const u_int8_t *cmdbuf, size_t cmdlen)
-{
- int cnt, rc, dat;
- u_int cmdpos;
-
- /* drain rxfifo */
- for (cnt = 10; cnt != 0; cnt--) {
- if (dnkbd_pollin(apci, 10) == -1)
- break;
- }
- if (cnt == 0)
- return (EBUSY);
-
- /* send command escape */
- if ((rc = dnkbd_pollout(apci, DNCMD_PREFIX)) != 0)
- return (rc);
-
- /* send command buffer */
- for (cmdpos = 0; cmdpos < cmdlen; cmdpos++) {
- if ((rc = dnkbd_pollout(apci, cmdbuf[cmdpos])) != 0)
- return (rc);
- }
-
- /* wait for command echo */
- do {
- dat = dnkbd_pollin(apci, 10000);
- if (dat == -1)
- return (EIO);
- } while (dat != DNCMD_PREFIX);
-
- for (cmdpos = 0; cmdpos < cmdlen; cmdpos++) {
- dat = dnkbd_pollin(apci, 10000);
- if (dat != cmdbuf[cmdpos])
- return (EIO);
- }
-
- return (0);
-}
-
-int
-dnkbd_intr(void *v)
-{
- struct dnkbd_softc *sc = v;
- struct apciregs *apci = sc->sc_regs;
- u_int8_t iir, lsr, c;
- int claimed = 0;
-
- for (;;) {
- iir = apci->ap_iir;
-
- switch (iir & IIR_IMASK) {
- case IIR_RLS:
- /*
- * Line status change. This should never happen,
- * so silently ack the interrupt.
- */
- c = apci->ap_lsr;
- break;
-
- case IIR_RXRDY:
- case IIR_RXTOUT:
- /*
- * Data available. We process it byte by byte,
- * unless we are doing polling work...
- */
- if (ISSET(sc->sc_flags, SF_POLLING)) {
- return (1);
- }
-
- for (;;) {
- c = apci->ap_data;
- switch (dnkbd_input(sc, c)) {
- case EVENT_KEYBOARD:
- dnevent_kbd(sc, c);
- break;
-#if NWSMOUSE > 0
- case EVENT_MOUSE:
- dnevent_mouse(sc, sc->sc_mousepkt);
- break;
-#endif
- default: /* appease gcc */
- break;
- }
- lsr = apci->ap_lsr & LSR_RCV_MASK;
- if (lsr == 0)
- break;
- else if (lsr != LSR_RXRDY) {
- /* ignore error */
- break;
- }
- }
- break;
-
- case IIR_TXRDY:
- /*
- * Transmit available. Since we do all our commands
- * in polling mode, we do not need to do anything here.
- */
- break;
-
- default:
- if (iir & IIR_NOPEND)
- return (claimed);
- /* FALLTHROUGH */
-
- case IIR_MLSC:
- /*
- * Modem status change. This should never happen,
- * so silently ack the interrupt.
- */
- c = apci->ap_msr;
- break;
- }
-
- claimed = 1;
- }
-}
-
-/*
- * Wskbd callbacks
- */
-
-int
-dnkbd_enable(void *v, int on)
-{
- struct dnkbd_softc *sc = v;
-
- if (on) {
- if (ISSET(sc->sc_flags, SF_ENABLED))
- return (EBUSY);
- SET(sc->sc_flags, SF_ENABLED);
- } else {
- if (ISSET(sc->sc_flags, SF_CONSOLE))
- return (EBUSY);
- CLR(sc->sc_flags, SF_ENABLED);
- }
-
- return (0);
-}
-
-void
-dnkbd_set_leds(void *v, int leds)
-{
- /*
- * Not supported. There is only one LED on this keyboard, and
- * is hardware tied to the caps lock key.
- */
-}
-
-int
-dnkbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- struct dnkbd_softc *sc = v;
-#endif
-
- switch (cmd) {
- case WSKBDIO_GTYPE:
- *(int *)data = WSKBD_TYPE_DOMAIN;
- return (0);
- case WSKBDIO_SETLEDS:
- return (ENXIO);
- case WSKBDIO_GETLEDS:
- *(int *)data = 0;
- return (0);
- case WSKBDIO_COMPLEXBELL:
-#define d ((struct wskbd_bell_data *)data)
- dnkbd_bell(v, d->period, d->pitch, d->volume);
-#undef d
- return (0);
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- case WSKBDIO_SETMODE:
- sc->sc_rawkbd = *(int *)data == WSKBD_RAW;
- return (0);
-#endif
- }
-
- return (-1);
-}
-
-#if NWSMOUSE > 0
-/*
- * Wsmouse callbacks
- */
-
-int
-dnmouse_enable(void *v)
-{
- struct dnkbd_softc *sc = v;
-
- if (ISSET(sc->sc_flags, SF_MOUSE))
- return (EBUSY);
- SET(sc->sc_flags, SF_MOUSE);
-
- return (0);
-}
-
-int
-dnmouse_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
-#if 0
- struct dnkbd_softc *sc = v;
-#endif
-
- switch (cmd) {
- case WSMOUSEIO_GTYPE:
- *(int *)data = WSMOUSE_TYPE_DOMAIN;
- return (0);
- }
-
- return (-1);
-}
-
-void
-dnmouse_disable(void *v)
-{
- struct dnkbd_softc *sc = v;
-
- CLR(sc->sc_flags, SF_MOUSE);
-}
-#endif
-
-/*
- * Console support
- */
-
-void
-dnkbd_cngetc(void *v, u_int *type, int *data)
-{
- static int lastdat = 0;
- struct dnkbd_softc *sc = v;
- int s;
- int dat;
-
- /* Take care of caps lock */
- if ((lastdat & ~DNKEY_RELEASE) == DNKEY_CAPSLOCK) {
- dat = lastdat ^ DNKEY_RELEASE;
- lastdat = 0;
- } else {
- for (;;) {
- s = splhigh();
- dat = dnkbd_pollin(sc->sc_regs, 10000);
- if (dat != -1) {
- if (dnkbd_input(sc, dat) == EVENT_KEYBOARD) {
- splx(s);
- break;
- }
- }
- splx(s);
- }
- lastdat = dat;
- }
-
- dnkbd_decode(dat, type, data);
-}
-
-void
-dnkbd_cnpollc(void *v, int on)
-{
- struct dnkbd_softc *sc = v;
-
- if (on)
- SET(sc->sc_flags, SF_POLLING);
- else
- CLR(sc->sc_flags, SF_POLLING);
-}
-
-/*
- * Bell routines.
- */
-void
-dnkbd_bell(void *v, u_int period, u_int pitch, u_int volume)
-{
- struct dnkbd_softc *sc = v;
- int s;
-
- s = spltty();
-
- if (pitch == 0 || period == 0 || volume == 0) {
- if (ISSET(sc->sc_flags, SF_BELL_TMO)) {
- timeout_del(&sc->sc_bellstop_tmo);
- dnkbd_bellstop(v);
- }
- } else {
-
- if (!ISSET(sc->sc_flags, SF_BELL)) {
- dnkbd_pollout(sc->sc_regs, DNCMD_PREFIX);
- dnkbd_pollout(sc->sc_regs, DNCMD_BELL);
- dnkbd_pollout(sc->sc_regs, DNCMD_BELL_ON);
- SET(sc->sc_flags, SF_BELL);
- }
-
- if (ISSET(sc->sc_flags, SF_BELL_TMO))
- timeout_del(&sc->sc_bellstop_tmo);
- timeout_add_msec(&sc->sc_bellstop_tmo, period);
- SET(sc->sc_flags, SF_BELL_TMO);
- }
-
- splx(s);
-}
-
-void
-dnkbd_bellstop(void *v)
-{
- struct dnkbd_softc *sc = v;
- int s;
-
- s = spltty();
-
- dnkbd_pollout(sc->sc_regs, DNCMD_PREFIX);
- dnkbd_pollout(sc->sc_regs, DNCMD_BELL);
- dnkbd_pollout(sc->sc_regs, DNCMD_BELL_OFF);
- CLR(sc->sc_flags, SF_BELL);
- CLR(sc->sc_flags, SF_BELL_TMO);
-
- splx(s);
-}
diff --git a/sys/arch/hp300/dev/dnkbdmap.c b/sys/arch/hp300/dev/dnkbdmap.c
deleted file mode 100644
index 27409e57cc4..00000000000
--- a/sys/arch/hp300/dev/dnkbdmap.c
+++ /dev/null
@@ -1,508 +0,0 @@
-/* $OpenBSD: dnkbdmap.c,v 1.2 2005/05/06 22:22:53 miod Exp $ */
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-
-#include <dev/wscons/wsksymdef.h>
-#include <dev/wscons/wsksymvar.h>
-
-#include <hp300/dev/dnkbdmap.h>
-
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-#include <dev/wscons/wskbdraw.h>
-
-/*
- * Translate Domain keycodes to US keyboard XT scancodes, for proper
- * X11-over-wsmux operation.
- */
-const u_int8_t dnkbd_raw[0x80] = {
- RAWKEY_Null,
- RAWKEY_Null, /* 01 Ins Mark */
- RAWKEY_Null, /* 02 Line Del */
- RAWKEY_Null, /* 03 Char Del */
- RAWKEY_f10, /* 04 f0 */
- RAWKEY_f1,
- RAWKEY_f2,
- RAWKEY_f3,
- RAWKEY_f4,
- RAWKEY_f5,
- RAWKEY_f6,
- RAWKEY_f7,
- RAWKEY_f8,
- RAWKEY_f9,
- RAWKEY_Null, /* 0e Again */
- RAWKEY_Null, /* 0f Read */
- RAWKEY_Null, /* 10 Save Edit */
- RAWKEY_Null, /* 11 Abort Exit */
- RAWKEY_Hold_Screen, /* 12 Help Hold */
- RAWKEY_Null, /* 13 Cut Copy */
- RAWKEY_Null, /* 14 Undo Paste */
- RAWKEY_Null, /* 15 Move Grow */
- RAWKEY_Escape,
- RAWKEY_Escape,
- RAWKEY_1,
- RAWKEY_2,
- RAWKEY_3,
- RAWKEY_4,
- RAWKEY_5,
- RAWKEY_6,
- RAWKEY_7,
- RAWKEY_8,
- RAWKEY_9,
- RAWKEY_0,
- RAWKEY_minus,
- RAWKEY_equal,
- RAWKEY_grave,
- RAWKEY_BackSpace,
- RAWKEY_Null,
- RAWKEY_Null, /* 27 Left Edge */
- RAWKEY_Null, /* 28 Shell Cmd */
- RAWKEY_Null, /* 29 Right Edge */
- RAWKEY_Null,
- RAWKEY_Null,
- RAWKEY_Tab,
- RAWKEY_q,
- RAWKEY_w,
- RAWKEY_e,
- RAWKEY_r,
- RAWKEY_t,
- RAWKEY_y,
- RAWKEY_u,
- RAWKEY_i,
- RAWKEY_o,
- RAWKEY_p,
- RAWKEY_bracketleft,
- RAWKEY_bracketright,
- RAWKEY_Null,
- RAWKEY_Delete,
- RAWKEY_Null,
- RAWKEY_KP_Home,
- RAWKEY_KP_Up,
- RAWKEY_KP_Prior,
- RAWKEY_KP_Add,
- RAWKEY_Null, /* 40 Left Box */
- RAWKEY_Up,
- RAWKEY_Null, /* 42 Right Box */
- RAWKEY_Control_L,
- RAWKEY_Null,
- RAWKEY_Null,
- RAWKEY_a,
- RAWKEY_s,
- RAWKEY_d,
- RAWKEY_f,
- RAWKEY_g,
- RAWKEY_h,
- RAWKEY_j,
- RAWKEY_k,
- RAWKEY_l,
- RAWKEY_semicolon,
- RAWKEY_apostrophe,
- RAWKEY_Null,
- RAWKEY_Return,
- RAWKEY_backslash,
- RAWKEY_Null,
- RAWKEY_KP_Left,
- RAWKEY_KP_Begin,
- RAWKEY_KP_Right,
- RAWKEY_KP_Subtract,
- RAWKEY_Left,
- RAWKEY_Null, /* 5a Next Wndw */
- RAWKEY_Right,
- RAWKEY_Null,
- RAWKEY_Null, /* 5d Rept */
- RAWKEY_Shift_L,
- RAWKEY_Null,
- RAWKEY_z,
- RAWKEY_x,
- RAWKEY_c,
- RAWKEY_v,
- RAWKEY_b,
- RAWKEY_n,
- RAWKEY_m,
- RAWKEY_comma,
- RAWKEY_period,
- RAWKEY_slash,
- RAWKEY_Shift_R,
- RAWKEY_Null,
- RAWKEY_Null, /* 6c Pop */
- RAWKEY_Null,
- RAWKEY_KP_End,
- RAWKEY_KP_Down,
- RAWKEY_KP_Next,
- RAWKEY_Null,
- RAWKEY_Null, /* 72 Top Box */
- RAWKEY_Down,
- RAWKEY_Null, /* 74 Bottom Box */
- RAWKEY_Alt_L,
- RAWKEY_space,
- RAWKEY_Alt_R,
- RAWKEY_Null,
- RAWKEY_KP_Insert,
- RAWKEY_Null,
- RAWKEY_KP_Delete,
- RAWKEY_KP_Enter,
- RAWKEY_Null,
- RAWKEY_Caps_Lock,
- RAWKEY_Null
-};
-#endif
-
-#define KC(n) KS_KEYCODE(n)
-
-/*
- * US English
- */
-
-static const keysym_t dnkbd_keydesc_us[] = {
-/* pos command normal shifted */
- /* 01 Ins Mark */
- /* 02 Line Del */
- /* 03 Char Del */
- KC(0x04), KS_f10,
- KC(0x05), KS_f1,
- KC(0x06), KS_f2,
- KC(0x07), KS_f3,
- KC(0x08), KS_f4,
- KC(0x09), KS_f5,
- KC(0x0a), KS_f6,
- KC(0x0b), KS_f7,
- KC(0x0c), KS_f8,
- KC(0x0d), KS_f9,
- /* 0e Again */
- /* 0f Read */
- /* 10 Save Edit */
- /* 11 Abort Exit */
- KC(0x12), KS_Hold_Screen,
- /* 13 Cut Copy */
- /* 14 Undo Paste */
- /* 15 Move Grow */
- KC(0x17), KS_Cmd_Debugger, KS_Escape,
- KC(0x18), KS_1, KS_exclam,
- KC(0x19), KS_2, KS_at,
- KC(0x1a), KS_3, KS_numbersign,
- KC(0x1b), KS_4, KS_dollar,
- KC(0x1c), KS_5, KS_percent,
- KC(0x1d), KS_6, KS_asciicircum,
- KC(0x1e), KS_7, KS_ampersand,
- KC(0x1f), KS_8, KS_asterisk,
- KC(0x20), KS_9, KS_parenleft,
- KC(0x21), KS_0, KS_parenright,
- KC(0x22), KS_minus, KS_underscore,
- KC(0x23), KS_equal, KS_plus,
- KC(0x24), KS_grave, KS_asciitilde,
- KC(0x25), KS_Cmd_ResetEmul, KS_Delete, /* backspace */
- KC(0x27), KS_Home,
- /* 28 Shell Cmd */
- KC(0x29), KS_End,
- KC(0x2c), KS_Tab,
- KC(0x2d), KS_q,
- KC(0x2e), KS_w,
- KC(0x2f), KS_e,
- KC(0x30), KS_r,
- KC(0x31), KS_t,
- KC(0x32), KS_y,
- KC(0x33), KS_u,
- KC(0x34), KS_i,
- KC(0x35), KS_o,
- KC(0x36), KS_p,
- KC(0x37), KS_bracketleft, KS_braceleft,
- KC(0x38), KS_bracketright,KS_braceright,
- KC(0x3a), KS_Delete,
- KC(0x3c), KS_KP_7,
- KC(0x3d), KS_KP_8,
- KC(0x3e), KS_KP_9,
- KC(0x3f), KS_KP_Add,
- /* 40 Left Box */
- KC(0x41), KS_Up,
- /* 42 Right Box */
- KC(0x43), KS_Cmd1, KS_Control_L,
- KC(0x46), KS_a,
- KC(0x47), KS_s,
- KC(0x48), KS_d,
- KC(0x49), KS_f,
- KC(0x4a), KS_g,
- KC(0x4b), KS_h,
- KC(0x4c), KS_j,
- KC(0x4d), KS_k,
- KC(0x4e), KS_l,
- KC(0x4f), KS_semicolon, KS_colon,
- KC(0x50), KS_apostrophe, KS_quotedbl,
- KC(0x52), KS_Return,
- KC(0x53), KS_backslash, KS_bar,
- KC(0x55), KS_KP_4,
- KC(0x56), KS_KP_5,
- KC(0x57), KS_KP_6,
- KC(0x58), KS_KP_Subtract,
- KC(0x59), KS_Left,
- /* 5a Next Wndw */
- KC(0x5b), KS_Right,
- /* 5d Rept */
- KC(0x5e), KS_Shift_L,
- KC(0x60), KS_z,
- KC(0x61), KS_x,
- KC(0x62), KS_c,
- KC(0x63), KS_v,
- KC(0x64), KS_b,
- KC(0x65), KS_n,
- KC(0x66), KS_m,
- KC(0x67), KS_comma, KS_less,
- KC(0x68), KS_period, KS_greater,
- KC(0x69), KS_slash, KS_question,
- KC(0x6a), KS_Shift_R,
- /* 6c Pop */
- KC(0x6e), KS_KP_1,
- KC(0x6f), KS_KP_2,
- KC(0x70), KS_KP_3,
- /* 72 Top Box */
- KC(0x73), KS_Down,
- /* 74 Bottom Box */
- KC(0x75), KS_Cmd2, KS_Alt_L,
- KC(0x76), KS_space,
- KC(0x77), KS_Cmd2, KS_Alt_R, KS_Multi_key,
- KC(0x79), KS_KP_0,
- KC(0x7b), KS_KP_Separator,
- KC(0x7c), KS_KP_Enter,
- KC(0x7e), KS_Caps_Lock
-};
-
-/*
- * German
- */
-
-static const keysym_t dnkbd_keydesc_de[] = {
-/* pos normal shifted altgr */
- KC(0x17), KS_dead_circumflex, KS_dead_abovering,
- KC(0x19), KS_2, KS_quotedbl,
- KC(0x1a), KS_3, KS_at, KS_section,
- KC(0x1d), KS_6, KS_ampersand,
- KC(0x1e), KS_7, KS_slash,
- KC(0x1f), KS_8, KS_parenleft,
- KC(0x20), KS_9, KS_parenright,
- KC(0x21), KS_0, KS_equal,
- KC(0x22), KS_dead_tilde, KS_question, KS_ssharp,
- KC(0x23), KS_dead_acute, KS_dead_grave,
- KC(0x32), KS_z,
- KC(0x37), KS_braceright, KS_bracketright,KS_udiaeresis,
- KC(0x38), KS_plus, KS_asterisk,
- KC(0x4f), KS_bar, KS_backslash, KS_odiaeresis,
- KC(0x50), KS_braceleft, KS_bracketleft, KS_adiaeresis,
- KC(0x51), KS_numbersign, KS_apostrophe,
- KC(0x5f), KS_less, KS_greater,
- KC(0x60), KS_y,
- KC(0x67), KS_comma, KS_semicolon,
- KC(0x68), KS_period, KS_colon,
- KC(0x69), KS_minus, KS_underscore,
- KC(0x77), KS_Mode_switch, KS_Multi_key
-};
-
-static const keysym_t dnkbd_keydesc_de_nodead[] = {
- KC(0x17), KS_asciicircum, KS_degree,
- KC(0x22), KS_asciitilde, KS_question, KS_ssharp,
- KC(0x23), KS_apostrophe, KS_grave
-};
-
-/*
- * Norwegian / Danish
- */
-
-static const keysym_t dnkbd_keydesc_dk[] = {
-/* pos normal shifted altgr */
- KC(0x17), KS_underscore,
- KC(0x19), KS_2, KS_quotedbl,
- KC(0x1d), KS_6, KS_ampersand,
- KC(0x1e), KS_7, KS_slash,
- KC(0x1f), KS_8, KS_parenleft,
- KC(0x20), KS_9, KS_parenright,
- KC(0x21), KS_0, KS_equal,
- KC(0x22), KS_plus, KS_question,
- KC(0x23), KS_dead_grave, KS_at,
- KC(0x37), KS_braceright, KS_bracketright,KS_aring,
- KC(0x38), KS_dead_tilde, KS_dead_circumflex,KS_dead_diaeresis,
- KC(0x4f), KS_bar, KS_backslash, KS_oslash,
- KC(0x50), KS_braceleft, KS_bracketleft, KS_ae,
- KC(0x51), KS_dead_acute, KS_asterisk,
- KC(0x5f), KS_less, KS_greater,
- KC(0x67), KS_comma, KS_semicolon,
- KC(0x68), KS_period, KS_colon,
- KC(0x69), KS_minus, KS_underscore,
- KC(0x77), KS_Mode_switch, KS_Multi_key
-};
-
-static const keysym_t dnkbd_keydesc_dk_nodead[] = {
-/* pos normal shifted altgr */
- KC(0x23), KS_grave, KS_at,
- KC(0x38), KS_asciitilde, KS_asciicircum, KS_diaeresis,
- KC(0x51), KS_apostrophe, KS_asterisk,
-};
-
-/*
- * French
- */
-
-static const keysym_t dnkbd_keydesc_fr[] = {
-/* pos normal shifted altgr */
- KC(0x17), KS_bracketleft, KS_degree,
- KC(0x18), KS_ampersand, KS_1,
- KC(0x19), KS_braceleft, KS_2, KS_eacute,
- KC(0x1a), KS_quotedbl, KS_3,
- KC(0x1b), KS_apostrophe, KS_4,
- KC(0x1c), KS_parenleft, KS_5,
- KC(0x1d), KS_bracketright,KS_6, KS_section,
- KC(0x1e), KS_braceright, KS_7, KS_egrave,
- KC(0x1f), KS_exclam, KS_8,
- KC(0x20), KS_backslash, KS_9, KS_ccedilla,
- KC(0x21), KS_at, KS_0, KS_agrave,
- KC(0x22), KS_parenright, KS_degree,
- KC(0x23), KS_minus, KS_underscore,
- KC(0x2d), KS_a,
- KC(0x2e), KS_z,
- KC(0x37), KS_dead_circumflex, KS_asciitilde, KS_dead_diaeresis,
- KC(0x38), KS_dollar, KS_asterisk,
- KC(0x46), KS_q,
- KC(0x4f), KS_m,
- KC(0x50), KS_bar, KS_percent, KS_ugrave,
- KC(0x51), KS_grave, KS_numbersign,
- KC(0x5f), KS_less, KS_greater,
- KC(0x60), KS_w,
- KC(0x66), KS_comma, KS_question,
- KC(0x67), KS_semicolon, KS_period,
- KC(0x68), KS_colon, KS_slash,
- KC(0x69), KS_equal, KS_plus,
- KC(0x77), KS_Mode_switch, KS_Multi_key
-};
-
-/*
- * Japanese (and basis for international layouts)
- *
- * Apparently this layout lacks all japanese keys (Zenkaku/Hankaku,
- * Hiragana/Katakana, Henkan and Muhenkan). Makes one wonder about
- * its usefulness.
- */
-
-static const keysym_t dnkbd_keydesc_jp[] = {
-/* pos cmd normal shifted */
- KC(0x16), KS_Cmd_Debugger, KS_Escape,
- KC(0x17), KS_grave, KS_asciitilde,
- KC(0x24), KS_Cmd_ResetEmul, KS_Delete, /* backspace */
- KC(0x25), KS_Delete,
- /* 2b Rept */
- KC(0x3b), KS_KP_Add,
- KC(0x3f), KS_parenleft, /* KS_KP_parenleft */
- KC(0x51), KS_backslash, KS_bar,
- KC(0x54), KS_KP_Subtract,
- KC(0x58), KS_parenright, /* KS_KP_parenright */
- KC(0x5f), KS_less, KS_greater,
- KC(0x6d), KS_KP_Multiply,
- KC(0x78), KS_KP_Divide,
-};
-
-/*
- * Swiss (relative to the German layout)
- */
-
-static const keysym_t dnkbd_keydesc_sg[] = {
-/* pos normal shifted altgr */
- KC(0x17), KS_at, KS_exclam, KS_section,
- KC(0x18), KS_1, KS_plus,
- KC(0x1a), KS_3, KS_asterisk,
- KC(0x1b), KS_4, KS_backslash, KS_ccedilla,
- KC(0x22), KS_apostrophe, KS_question,
- KC(0x23), KS_dead_circumflex,KS_dead_grave,
- KC(0x37), KS_braceright, KS_dead_tilde, KS_udiaeresis, KS_egrave,
- KC(0x38), KS_dead_diaeresis,KS_dead_acute,
- KC(0x4f), KS_bar, KS_bracketleft, KS_odiaeresis, KS_eacute,
- KC(0x50), KS_braceleft, KS_bracketright,KS_adiaeresis, KS_agrave,
- KC(0x51), KS_dollar, KS_numbersign, KS_sterling
-};
-
-static const keysym_t dnkbd_keydesc_sg_nodead[] = {
-/* pos normal shifted altgr */
- KC(0x23), KS_asciicircum, KS_grave,
- KC(0x37), KS_braceright, KS_asciitilde, KS_udiaeresis, KS_egrave,
- KC(0x38), KS_diaeresis, KS_apostrophe
-};
-
-/*
- * Swedish / Finnish (relative to the Norwegian / Danish layout)
- */
-
-static const keysym_t dnkbd_keydesc_sv[] = {
-/* pos normal shifted altgr */
- KC(0x1b), KS_4, KS_dollar, KS_currency,
- KC(0x23), KS_dead_grave, KS_at, KS_eacute,
- KC(0x38), KS_dead_tilde, KS_dead_circumflex,KS_udiaeresis,
- KC(0x4f), KS_bar, KS_backslash, KS_odiaeresis,
- KC(0x50), KS_braceleft, KS_bracketleft, KS_adiaeresis
-};
-
-static const keysym_t dnkbd_keydesc_sv_nodead[] = {
-/* pos normal shifted altgr */
- KC(0x23), KS_grave, KS_at, KS_eacute,
- KC(0x38), KS_asciitilde, KS_asciicircum, KS_udiaeresis,
- KC(0x51), KS_apostrophe, KS_asterisk,
-};
-
-/*
- * UK English
- */
-
-static const keysym_t dnkbd_keydesc_uk[] = {
-/* pos normal shifted */
- KC(0x17), KS_underscore,
- KC(0x19), KS_2, KS_quotedbl,
- KC(0x1d), KS_6, KS_ampersand,
- KC(0x1e), KS_7, KS_apostrophe,
- KC(0x1f), KS_8, KS_parenleft,
- KC(0x20), KS_9, KS_parenright,
- KC(0x21), KS_0, KS_underscore,
- KC(0x22), KS_minus, KS_equal,
- KC(0x23), KS_asciicircum, KS_asciitilde,
- KC(0x37), KS_at, KS_grave,
- KC(0x38), KS_bracketleft, KS_braceleft,
- KC(0x4f), KS_semicolon, KS_plus,
- KC(0x50), KS_colon, KS_asterisk,
- KC(0x51), KS_bracketright,KS_braceright,
- KC(0x5f), KS_backslash, KS_bar
-};
-
-#define KBD_MAP(name, base, map) \
- { name, base, sizeof(map) / sizeof(keysym_t), map }
-
-const struct wscons_keydesc dnkbd_keydesctab[] = {
- KBD_MAP(KB_US, 0, dnkbd_keydesc_us),
- KBD_MAP(KB_DE, KB_JP, dnkbd_keydesc_de),
- KBD_MAP(KB_DE | KB_NODEAD, KB_DE, dnkbd_keydesc_de_nodead),
- KBD_MAP(KB_DK, KB_JP, dnkbd_keydesc_dk),
- KBD_MAP(KB_DK | KB_NODEAD, KB_DK, dnkbd_keydesc_dk_nodead),
- KBD_MAP(KB_FR, KB_JP, dnkbd_keydesc_fr),
- KBD_MAP(KB_JP, KB_US, dnkbd_keydesc_jp),
- KBD_MAP(KB_SG, KB_DE, dnkbd_keydesc_sg),
- KBD_MAP(KB_SG | KB_NODEAD, KB_SG, dnkbd_keydesc_sg_nodead),
- KBD_MAP(KB_SV, KB_DK, dnkbd_keydesc_sv),
- KBD_MAP(KB_SV | KB_NODEAD, KB_SV, dnkbd_keydesc_sv_nodead),
- KBD_MAP(KB_UK, KB_JP, dnkbd_keydesc_uk),
- { 0, 0, 0, 0 }
-};
diff --git a/sys/arch/hp300/dev/dnkbdmap.h b/sys/arch/hp300/dev/dnkbdmap.h
deleted file mode 100644
index 90ffb046925..00000000000
--- a/sys/arch/hp300/dev/dnkbdmap.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $OpenBSD: dnkbdmap.h,v 1.1 2005/04/22 11:59:11 miod Exp $ */
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-extern const struct wscons_keydesc dnkbd_keydesctab[];
-extern const u_int8_t dnkbd_raw[0x80];
diff --git a/sys/arch/hp300/dev/dvbox.c b/sys/arch/hp300/dev/dvbox.c
deleted file mode 100644
index 44d24c6cd87..00000000000
--- a/sys/arch/hp300/dev/dvbox.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/* $OpenBSD: dvbox.c,v 1.15 2013/10/21 10:36:12 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_dv.c 1.12 93/08/13$
- *
- * @(#)grf_dv.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for the DaVinci, HP98730/98731 Graphics system.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/intiovar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-#include <hp300/dev/dvboxreg.h>
-
-struct dvbox_softc {
- struct device sc_dev;
- struct diofb *sc_fb;
- struct diofb sc_fb_store;
- int sc_scode;
-};
-
-int dvbox_dio_match(struct device *, void *, void *);
-void dvbox_dio_attach(struct device *, struct device *, void *);
-int dvbox_intio_match(struct device *, void *, void *);
-void dvbox_intio_attach(struct device *, struct device *, void *);
-
-struct cfattach dvbox_dio_ca = {
- sizeof(struct dvbox_softc), dvbox_dio_match, dvbox_dio_attach
-};
-
-struct cfattach dvbox_intio_ca = {
- sizeof(struct dvbox_softc), dvbox_intio_match, dvbox_intio_attach
-};
-
-struct cfdriver dvbox_cd = {
- NULL, "dvbox", DV_DULL
-};
-
-int dvbox_reset(struct diofb *, int, struct diofbreg *);
-void dvbox_restore(struct diofb *);
-void dvbox_setcolor(struct diofb *, u_int,
- u_int8_t, u_int8_t, u_int8_t);
-int dvbox_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
-
-int dvbox_ioctl(void *, u_long, caddr_t, int, struct proc *);
-void dvbox_burner(void *, u_int, u_int);
-
-struct wsdisplay_accessops dvbox_accessops = {
- .ioctl = dvbox_ioctl,
- .mmap = diofb_mmap,
- .alloc_screen = diofb_alloc_screen,
- .free_screen = diofb_free_screen,
- .show_screen = diofb_show_screen,
- .load_font = diofb_load_font,
- .list_font = diofb_list_font,
- .burn_screen = dvbox_burner
-};
-
-/*
- * Attachment glue
- */
-
-int
-dvbox_intio_match(struct device *parent, void *match, void *aux)
-{
- struct intio_attach_args *ia = aux;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
-
- if (badaddr((caddr_t)fbr))
- return (0);
-
- if (fbr->id == GRFHWID && fbr->fbid == GID_DAVINCI) {
- ia->ia_addr = (caddr_t)GRFIADDR;
- return (1);
- }
-
- return (0);
-}
-
-void
-dvbox_intio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct dvbox_softc *sc = (struct dvbox_softc *)self;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
- sc->sc_scode = CONSCODE_INTERNAL;
-
- if (sc->sc_scode == conscode) {
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- dvbox_reset(sc->sc_fb, sc->sc_scode, fbr);
- }
-
- diofb_end_attach(sc, &dvbox_accessops, sc->sc_fb,
- sc->sc_scode == conscode, NULL);
-}
-
-int
-dvbox_dio_match(struct device *parent, void *match, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
- da->da_secid == DIO_DEVICE_SECID_DAVINCI)
- return (1);
-
- return (0);
-}
-
-void
-dvbox_dio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct dvbox_softc *sc = (struct dvbox_softc *)self;
- struct dio_attach_args *da = aux;
- struct diofbreg *fbr;
-
- sc->sc_scode = da->da_scode;
- if (sc->sc_scode == conscode) {
- fbr = (struct diofbreg *)conaddr; /* already mapped */
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- fbr = (struct diofbreg *)
- iomap(dio_scodetopa(sc->sc_scode), da->da_size);
- if (fbr == NULL ||
- dvbox_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) {
- printf(": can't map framebuffer\n");
- return;
- }
- }
-
- diofb_end_attach(sc, &dvbox_accessops, sc->sc_fb,
- sc->sc_scode == conscode, NULL);
-}
-
-/*
- * Initialize hardware and display routines.
- */
-int
-dvbox_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
-{
- int rc;
-
- if ((rc = diofb_fbinquire(fb, scode, fbr)) != 0)
- return (rc);
-
- /*
- * Restrict the framebuffer to a monochrome view for now, until
- * I know better how to detect and frob overlay planes, and
- * setup a proper colormap. -- miod
- */
- fb->planes = fb->planemask = 1;
-
- fb->bmv = dvbox_windowmove;
- dvbox_restore(fb);
- diofb_fbsetup(fb);
-
- return (0);
-}
-
-/*
- * Magic initialization code.
- */
-void
-dvbox_restore(struct diofb *fb)
-{
- volatile struct dvboxfb *db = (struct dvboxfb *)fb->regkva;
- u_int i;
-
- db->regs.id = 0x80;
- DELAY(100);
-
- db->regs.interrupt = 0x04;
- db->en_scan = 0x01;
- db->fbwen = ~0;
- db->opwen = ~0;
- db->fold = 0x01; /* 8bpp */
- db->drive = 0x01; /* use FB plane */
- db->rep_rule = DVBOX_DUALROP(RR_COPY);
- db->alt_rr = DVBOX_DUALROP(RR_COPY);
- db->zrr = DVBOX_DUALROP(RR_COPY);
-
- db->fbvenp = 0xFF; /* enable video */
- db->dispen = 0x01; /* enable display */
- db->fbvens = 0x0;
- db->fv_trig = 0x01;
- DELAY(100);
- db->vdrive = 0x0;
- db->zconfig = 0x0;
-
- while (db->wbusy & 0x01)
- DELAY(10);
-
- db->cmapbank = 0;
-
- db->red0 = 0;
- db->red1 = 0;
- db->green0 = 0;
- db->green1 = 0;
- db->blue0 = 0;
- db->blue1 = 0;
-
- db->panxh = 0;
- db->panxl = 0;
- db->panyh = 0;
- db->panyl = 0;
- db->zoom = 0;
- db->cdwidth = 0x50;
- db->chstart = 0x52;
- db->cvwidth = 0x22;
- db->pz_trig = 1;
-
- /*
- * Turn on frame buffer, turn on overlay planes, set replacement
- * rule, enable top overlay plane writes for ite, disable all frame
- * buffer planes, set byte per pixel, and display frame buffer 0.
- * Lastly, turn on the box.
- */
- db->regs.interrupt = 0x04;
- db->drive = 0x10;
- db->rep_rule = DVBOX_DUALROP(RR_COPY);
- db->opwen = 0x01;
- db->fbwen = 0x0;
- db->fold = 0x01;
- db->vdrive = 0x0;
- db->dispen = 0x01;
-
- /*
- * Video enable top overlay plane.
- */
- db->opvenp = 0x01;
- db->opvens = 0x01;
-
- /*
- * Make sure that overlay planes override frame buffer planes.
- */
- db->ovly0p = 0x0;
- db->ovly0s = 0x0;
- db->ovly1p = 0x0;
- db->ovly1s = 0x0;
- db->fv_trig = 0x1;
- DELAY(100);
-
- /*
- * Setup the overlay colormaps. Need to set the 0,1 (black/white)
- * color for both banks.
- */
- db_waitbusy(db);
- for (i = 0; i <= 1; i++) {
- db->cmapbank = i;
- db->rgb[0].red = 0x00;
- db->rgb[0].green = 0x00;
- db->rgb[0].blue = 0x00;
- db->rgb[1].red = 0xff;
- db->rgb[1].green = 0xff;
- db->rgb[1].blue = 0xff;
- }
- db->cmapbank = 0;
- db_waitbusy(db);
-}
-
-int
-dvbox_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
-{
- struct diofb *fb = v;
- struct wsdisplay_fbinfo *wdf;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_DVBOX;
- break;
- case WSDISPLAYIO_SMODE:
- fb->mapmode = *(u_int *)data;
- if (fb->mapmode == WSDISPLAYIO_MODE_EMUL)
- dvbox_restore(fb);
- break;
- case WSDISPLAYIO_GINFO:
- wdf = (void *)data;
- wdf->width = fb->ri.ri_width;
- wdf->height = fb->ri.ri_height;
- wdf->depth = fb->ri.ri_depth;
- wdf->cmsize = 0; /* XXX */
- break;
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = fb->ri.ri_stride;
- break;
- case WSDISPLAYIO_GETCMAP:
- case WSDISPLAYIO_PUTCMAP:
- break; /* XXX until color support is implemented */
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- break;
- default:
- return (-1);
- }
-
- return (0);
-}
-
-void
-dvbox_burner(void *v, u_int on, u_int flags)
-{
- struct diofb *fb = v;
- volatile struct dvboxfb *db = (struct dvboxfb *)fb->regkva;
-
- if (on)
- db->dispen = 0x01;
- else
- db->dispen = 0x00;
-}
-
-int
-dvbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
- u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop,
- int16_t planemask)
-{
- volatile struct dvboxfb *db = (struct dvboxfb *)fb->regkva;
-
- if (planemask != 0xff)
- return (EINVAL);
-
- db_waitbusy(db);
-
- db->rep_rule = DVBOX_DUALROP(rop);
- db->source_y = sy;
- db->source_x = sx;
- db->dest_y = dy;
- db->dest_x = dx;
- db->wheight = cy;
- db->wwidth = cx;
- db->wmove = 1;
-
- db_waitbusy(db);
-
- return (0);
-}
-
-/*
- * DaVinci console support
- */
-
-void
-dvboxcninit()
-{
- dvbox_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
- diofb_cnattach(&diofb_cn);
-}
diff --git a/sys/arch/hp300/dev/dvboxreg.h b/sys/arch/hp300/dev/dvboxreg.h
deleted file mode 100644
index 910b19bb504..00000000000
--- a/sys/arch/hp300/dev/dvboxreg.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/* $OpenBSD: dvboxreg.h,v 1.3 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: grf_dvreg.h,v 1.5 1994/10/26 07:23:50 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_dvreg.h 1.5 92/01/21$
- *
- * @(#)grf_dvreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#define db_waitbusy(regaddr) \
-do { \
- while (((volatile struct dvboxfb *)(regaddr))->wbusy != 0 || \
- ((volatile struct dvboxfb *)(regaddr))->as_busy != 0) \
- DELAY(10); \
-} while (0)
-
-#define DVBOX_DUALROP(rop) ((rop) << 4 | (rop))
-
-struct rgb {
- u_int8_t :8, :8, :8;
- u_int8_t red;
- u_int8_t :8, :8, :8;
- u_int8_t green;
- u_int8_t :8, :8, :8;
- u_int8_t blue;
-};
-
-struct dvboxfb {
- struct diofbreg regs;
- u_int8_t f2[16359];
- u_int8_t wbusy; /* Window move in progress 0x4047 */
- u_int8_t f3[0x405b-0x4047-1];
- u_int8_t as_busy; /* Scan accessing frame buf. 0x405B */
- u_int8_t f4[0x4090-0x405b-1];
- u_int32_t fbwen; /* Frame buffer write enable 0x4090 */
- u_int8_t f5[0x409f-0x4090-4];
- u_int8_t wmove; /* Initiate window move. 0x409F */
- u_int8_t f6[0x40b3-0x409f-1];
- u_int8_t fold; /* Byte/longword per pixel 0x40B3 */
- u_int8_t f7[0x40b7-0x40b3-1];
- u_int8_t opwen; /* Overlay plane write enable 0x40B7 */
- u_int8_t f8[0x40bf-0x40b7-1];
- u_int8_t drive; /* Select FB vs. Overlay. 0x40BF */
-
- u_int8_t f8a[0x40cb-0x40bf-1];
- u_int8_t zconfig; /* Z buffer configuration 0x40CB */
- u_int8_t f8b[0x40cf-0x40cb-1];
- u_int8_t alt_rr; /* Alternate replacement rule 0x40CF */
- u_int8_t f8c[0x40d3-0x40cf-1];
- u_int8_t zrr; /* Z replacement rule 0x40D3 */
-
- u_int8_t f9[0x40d7-0x40d3-1];
- u_int8_t en_scan; /* Enable scan DTACK. 0x40D7 */
- u_int8_t f10[0x40ef-0x40d7-1];
- u_int8_t rep_rule; /* Replacement rule 0x40EF */
- u_int8_t f11[0x40f2-0x40ef-1];
- u_int16_t source_x; /* Window source X origin 0x40F2 */
- u_int8_t f12[0x40f6-0x40f2-2];
- u_int16_t source_y; /* Window source Y origin 0x40F6 */
- u_int8_t f13[0x40fa-0x40f6-2];
- u_int16_t dest_x; /* Window dest X origin 0x40FA */
- u_int8_t f14[0x40fe -0x40fa-2];
- u_int16_t dest_y; /* Window dest Y origin 0x40FE */
- u_int8_t f15[0x4102-0x40fe -2];
- u_int16_t wwidth; /* Window width 0x4102 */
- u_int8_t f16[0x4106-0x4102-2];
- u_int16_t wheight; /* Window height 0x4106 */
- u_int8_t f17[0x6003-0x4106-2];
- u_int8_t cmapbank; /* Bank select (0 or 1) 0x6003 */
- u_int8_t f18[0x6007-0x6003-1];
- u_int8_t dispen; /* Display enable 0x6007 */
-
- u_int8_t f18a[0x600B-0x6007-1];
- u_int8_t fbvenp; /* Frame buffer video enable 0x600B */
- u_int8_t f18b[0x6017-0x600B-1];
- u_int8_t fbvens; /* fbvenp blink counterpart 0x6017 */
-
- u_int8_t f19[0x6023-0x6017-1];
- u_int8_t vdrive; /* Video display mode 0x6023 */
- u_int8_t f20[0x6083-0x6023-1];
- u_int8_t panxh; /* Pan display in X (high) 0x6083 */
- u_int8_t f21[0x6087-0x6083-1];
- u_int8_t panxl; /* Pan display in X (low) 0x6087 */
- u_int8_t f22[0x608b-0x6087-1];
- u_int8_t panyh; /* Pan display in Y (high) 0x608B */
- u_int8_t f23[0x608f-0x608b-1];
- u_int8_t panyl; /* Pan display in Y (low) 0x608F */
- u_int8_t f24[0x6093-0x608f-1];
- u_int8_t zoom; /* Zoom factor 0x6093 */
- u_int8_t f25[0x6097-0x6093-1];
- u_int8_t pz_trig; /* Pan & zoom trigger 0x6097 */
- u_int8_t f26[0x609b-0x6097-1];
- u_int8_t ovly0p; /* Overlay 0 primary map 0x609B */
- u_int8_t f27[0x609f-0x609b-1];
- u_int8_t ovly1p; /* Overlay 1 primary map 0x609F */
- u_int8_t f28[0x60a3-0x609f-1];
- u_int8_t ovly0s; /* Overlay 0 secondary map 0x60A3 */
- u_int8_t f29[0x60a7-0x60a3-1];
- u_int8_t ovly1s; /* Overlay 1 secondary map 0x60A7 */
- u_int8_t f30[0x60ab-0x60a7-1];
- u_int8_t opvenp; /* Overlay video enable 0x60AB */
- u_int8_t f31[0x60af-0x60ab-1];
- u_int8_t opvens; /* Overlay blink enable 0x60AF */
- u_int8_t f32[0x60b3-0x60af-1];
- u_int8_t fv_trig; /* Trigger control registers 0x60B3 */
- u_int8_t f33[0x60b7-0x60b3-1];
- u_int8_t cdwidth; /* Iris cdwidth timing reg. 0x60B7 */
- u_int8_t f34[0x60bb-0x60b7-1];
- u_int8_t chstart; /* Iris chstart timing reg. 0x60BB */
- u_int8_t f35[0x60bf-0x60bb-1];
- u_int8_t cvwidth; /* Iris cvwidth timing reg. 0x60BF */
- u_int8_t f36[0x6100-0x60bf-1];
- struct rgb rgb[8]; /* overlay color map */
- u_int8_t f37[0x6403-0x6100-sizeof(struct rgb)*8];
- u_int8_t red0;
- u_int8_t f38[0x6803-0x6403-1];
- u_int8_t green0;
- u_int8_t f39[0x6c03-0x6803-1];
- u_int8_t blue0;
- u_int8_t f40[0x7403-0x6c03-1];
- u_int8_t red1;
- u_int8_t f41[0x7803-0x7403-1];
- u_int8_t green1;
- u_int8_t f42[0x7c03-0x7803-1];
- u_int8_t blue1;
- u_int8_t f43[0x8012-0x7c03-1];
- u_int16_t status1; /* Master Status register 0x8012 */
- u_int8_t f44[0xC226-0x8012-2];
- u_int16_t trans; /* Transparency 0xC226 */
- u_int8_t f45[0xC23E -0xC226-2];
- u_int16_t pstop; /* Pace value control 0xc23e */
-} __packed;
diff --git a/sys/arch/hp300/dev/fhpib.c b/sys/arch/hp300/dev/fhpib.c
deleted file mode 100644
index c51994d199c..00000000000
--- a/sys/arch/hp300/dev/fhpib.c
+++ /dev/null
@@ -1,673 +0,0 @@
-/* $OpenBSD: fhpib.c,v 1.16 2009/07/23 21:26:20 blambert Exp $ */
-/* $NetBSD: fhpib.c,v 1.18 1997/05/05 21:04:16 thorpej Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fhpib.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * 98625A/B HPIB driver
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/timeout.h>
-
-#include <machine/autoconf.h>
-#include <machine/intr.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-
-#include <hp300/dev/dmavar.h>
-
-#include <hp300/dev/fhpibreg.h>
-#include <hp300/dev/hpibvar.h>
-
-/*
- * Inline version of fhpibwait to be used in places where
- * we don't worry about getting hung.
- */
-#define FHPIBWAIT(hd, m) while (((hd)->hpib_intr & (m)) == 0) DELAY(1)
-
-#ifdef DEBUG
-int fhpibdebugunit = -1;
-int fhpibdebug = 0;
-#define FDB_FAIL 0x01
-#define FDB_DMA 0x02
-#define FDB_WAIT 0x04
-#define FDB_PPOLL 0x08
-
-int dopriodma = 0; /* use high priority DMA */
-int doworddma = 1; /* non-zero if we should attempt word dma */
-int doppollint = 1; /* use ppoll interrupts instead of watchdog */
-int fhpibppolldelay = 50;
-#endif
-
-void fhpibifc(struct fhpibdevice *);
-void fhpibdmadone(void *);
-int fhpibwait(struct fhpibdevice *, int);
-
-void fhpibreset(struct hpibbus_softc *);
-int fhpibsend(struct hpibbus_softc *, int, int, void *, int);
-int fhpibrecv(struct hpibbus_softc *, int, int, void *, int);
-int fhpibppoll(struct hpibbus_softc *);
-void fhpibppwatch(void *);
-void fhpibgo(struct hpibbus_softc *, int, int, void *, int, int, int);
-void fhpibdone(struct hpibbus_softc *);
-int fhpibintr(void *);
-
-/*
- * Our controller ops structure.
- */
-struct hpib_controller fhpib_controller = {
- fhpibreset,
- fhpibsend,
- fhpibrecv,
- fhpibppoll,
- fhpibppwatch,
- fhpibgo,
- fhpibdone,
- fhpibintr
-};
-
-struct fhpib_softc {
- struct device sc_dev; /* generic device glue */
- struct isr sc_isr;
- struct fhpibdevice *sc_regs; /* device registers */
- struct timeout sc_dma_to; /* DMA done timeout */
-#ifdef DEBUG
- struct timeout sc_watch_to; /* fhpibppwatch timeout */
-#endif
- int sc_cmd;
- struct hpibbus_softc *sc_hpibbus; /* XXX */
-};
-
-int fhpibmatch(struct device *, void *, void *);
-void fhpibattach(struct device *, struct device *, void *);
-
-struct cfattach fhpib_ca = {
- sizeof(struct fhpib_softc), fhpibmatch, fhpibattach
-};
-
-struct cfdriver fhpib_cd = {
- NULL, "fhpib", DV_DULL
-};
-
-int
-fhpibmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id == DIO_DEVICE_ID_FHPIB)
- return (1);
-
- return (0);
-}
-
-void
-fhpibattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct fhpib_softc *sc = (struct fhpib_softc *)self;
- struct dio_attach_args *da = aux;
- struct hpibdev_attach_args ha;
- int ipl;
-
- sc->sc_regs = (struct fhpibdevice *)iomap(dio_scodetopa(da->da_scode),
- da->da_size);
- if (sc->sc_regs == NULL) {
- printf("\n%s: can't map registers\n", self->dv_xname);
- return;
- }
-
- ipl = DIO_IPL(sc->sc_regs);
- printf(" ipl %d: %s\n", ipl, DIO_DEVICE_DESC_FHPIB);
-
- /* Initialize timeout structures */
- timeout_set(&sc->sc_dma_to, fhpibdmadone, sc);
-
- /* Establish the interrupt handler. */
- sc->sc_isr.isr_func = fhpibintr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_ipl = ipl;
- sc->sc_isr.isr_priority = IPL_BIO;
- dio_intr_establish(&sc->sc_isr, self->dv_xname);
-
- ha.ha_ops = &fhpib_controller;
- ha.ha_type = HPIBC; /* XXX */
- ha.ha_ba = HPIBC_BA;
- ha.ha_softcpp = &sc->sc_hpibbus; /* XXX */
- (void)config_found(self, &ha, hpibdevprint);
-}
-
-void
-fhpibreset(hs)
- struct hpibbus_softc *hs;
-{
- struct fhpib_softc *sc = (struct fhpib_softc *)hs->sc_dev.dv_parent;
- struct fhpibdevice *hd = sc->sc_regs;
-
- hd->hpib_cid = 0xFF;
- DELAY(100);
- hd->hpib_cmd = CT_8BIT;
- hd->hpib_ar = AR_ARONC;
- fhpibifc(hd);
- hd->hpib_ie = IDS_IE;
- hd->hpib_data = C_DCL;
- DELAY(100000);
- /*
- * See if we can do word dma.
- * If so, we should be able to write and read back the apropos bit.
- */
- hd->hpib_ie |= IDS_WDMA;
- if (hd->hpib_ie & IDS_WDMA) {
- hd->hpib_ie &= ~IDS_WDMA;
- hs->sc_flags |= HPIBF_DMA16;
-#ifdef DEBUG
- if (fhpibdebug & FDB_DMA)
- printf("fhpibtype: %s has word dma\n",
- sc->sc_dev.dv_xname);
-
-#endif
- }
-}
-
-void
-fhpibifc(hd)
- struct fhpibdevice *hd;
-{
- hd->hpib_cmd |= CT_IFC;
- hd->hpib_cmd |= CT_INITFIFO;
- DELAY(100);
- hd->hpib_cmd &= ~CT_IFC;
- hd->hpib_cmd |= CT_REN;
- hd->hpib_stat = ST_ATN;
-}
-
-int
-fhpibsend(hs, slave, sec, ptr, origcnt)
- struct hpibbus_softc *hs;
- int slave, sec, origcnt;
- void *ptr;
-{
- struct fhpib_softc *sc = (struct fhpib_softc *)hs->sc_dev.dv_parent;
- struct fhpibdevice *hd = sc->sc_regs;
- int cnt = origcnt;
- int timo;
- char *addr = ptr;
-
- hd->hpib_stat = 0;
- hd->hpib_imask = IM_IDLE | IM_ROOM;
- if (fhpibwait(hd, IM_IDLE) < 0)
- goto senderr;
- hd->hpib_stat = ST_ATN;
- hd->hpib_data = C_UNL;
- hd->hpib_data = C_TAG + hs->sc_ba;
- hd->hpib_data = C_LAG + slave;
- if (sec < 0) {
- if (sec == -2) /* selected device clear KLUDGE */
- hd->hpib_data = C_SDC;
- } else
- hd->hpib_data = C_SCG + sec;
- if (fhpibwait(hd, IM_IDLE) < 0)
- goto senderr;
- if (cnt) {
- hd->hpib_stat = ST_WRITE;
- while (--cnt) {
- hd->hpib_data = *addr++;
- timo = hpibtimeout;
- while ((hd->hpib_intr & IM_ROOM) == 0) {
- if (--timo <= 0)
- goto senderr;
- DELAY(1);
- }
- }
- hd->hpib_stat = ST_EOI;
- hd->hpib_data = *addr;
- FHPIBWAIT(hd, IM_ROOM);
- hd->hpib_stat = ST_ATN;
- /* XXX: HP-UX claims bug with CS80 transparent messages */
- if (sec == 0x12)
- DELAY(150);
- hd->hpib_data = C_UNL;
- (void) fhpibwait(hd, IM_IDLE);
- }
- hd->hpib_imask = 0;
- return (origcnt);
-
-senderr:
- hd->hpib_imask = 0;
- fhpibifc(hd);
-#ifdef DEBUG
- if (fhpibdebug & FDB_FAIL) {
- printf("%s: fhpibsend failed: slave %d, sec %x, ",
- sc->sc_dev.dv_xname, slave, sec);
- printf("sent %d of %d bytes\n", origcnt-cnt-1, origcnt);
- }
-#endif
- return (origcnt - cnt - 1);
-}
-
-int
-fhpibrecv(hs, slave, sec, ptr, origcnt)
- struct hpibbus_softc *hs;
- int slave, sec, origcnt;
- void *ptr;
-{
- struct fhpib_softc *sc = (struct fhpib_softc *)hs->sc_dev.dv_parent;
- struct fhpibdevice *hd = sc->sc_regs;
- int cnt = origcnt;
- int timo;
- char *addr = ptr;
-
- /*
- * Slave < 0 implies continuation of a previous receive
- * that probably timed out.
- */
- if (slave >= 0) {
- hd->hpib_stat = 0;
- hd->hpib_imask = IM_IDLE | IM_ROOM | IM_BYTE;
- if (fhpibwait(hd, IM_IDLE) < 0)
- goto recverror;
- hd->hpib_stat = ST_ATN;
- hd->hpib_data = C_UNL;
- hd->hpib_data = C_LAG + hs->sc_ba;
- hd->hpib_data = C_TAG + slave;
- if (sec != -1)
- hd->hpib_data = C_SCG + sec;
- if (fhpibwait(hd, IM_IDLE) < 0)
- goto recverror;
- hd->hpib_stat = ST_READ0;
- hd->hpib_data = 0;
- }
- if (cnt) {
- while (--cnt >= 0) {
- timo = hpibtimeout;
- while ((hd->hpib_intr & IM_BYTE) == 0) {
- if (--timo == 0)
- goto recvbyteserror;
- DELAY(1);
- }
- *addr++ = hd->hpib_data;
- }
- FHPIBWAIT(hd, IM_ROOM);
- hd->hpib_stat = ST_ATN;
- hd->hpib_data = (slave == 31) ? C_UNA : C_UNT;
- (void) fhpibwait(hd, IM_IDLE);
- }
- hd->hpib_imask = 0;
- return (origcnt);
-
-recverror:
- fhpibifc(hd);
-recvbyteserror:
- hd->hpib_imask = 0;
-#ifdef DEBUG
- if (fhpibdebug & FDB_FAIL) {
- printf("%s: fhpibrecv failed: slave %d, sec %x, ",
- sc->sc_dev.dv_xname, slave, sec);
- printf("got %d of %d bytes\n", origcnt-cnt-1, origcnt);
- }
-#endif
- return (origcnt - cnt - 1);
-}
-
-void
-fhpibgo(hs, slave, sec, ptr, count, rw, timo)
- struct hpibbus_softc *hs;
- int slave, sec, count, rw, timo;
- void *ptr;
-{
- struct fhpib_softc *sc = (struct fhpib_softc *)hs->sc_dev.dv_parent;
- struct fhpibdevice *hd = sc->sc_regs;
- int i;
- char *addr = ptr;
- int flags = 0;
-
- hs->sc_flags |= HPIBF_IO;
- if (timo)
- hs->sc_flags |= HPIBF_TIMO;
- if (rw == B_READ)
- hs->sc_flags |= HPIBF_READ;
-#ifdef DEBUG
- else if (hs->sc_flags & HPIBF_READ) {
- printf("fhpibgo: HPIBF_READ still set\n");
- hs->sc_flags &= ~HPIBF_READ;
- }
-#endif
- hs->sc_count = count;
- hs->sc_addr = addr;
-#ifdef DEBUG
- /* fhpibtransfer[unit]++; XXX */
-#endif
- if ((hs->sc_flags & HPIBF_DMA16) &&
- ((int)addr & 1) == 0 && count && (count & 1) == 0
-#ifdef DEBUG
- && doworddma
-#endif
- ) {
-#ifdef DEBUG
- /* fhpibworddma[unit]++; XXX */
-#endif
- flags |= DMAGO_WORD;
- hd->hpib_latch = 0;
- }
-#ifdef DEBUG
- if (dopriodma)
- flags |= DMAGO_PRI;
-#endif
- if (hs->sc_flags & HPIBF_READ) {
- sc->sc_cmd = CT_REN | CT_8BIT;
- hs->sc_curcnt = count;
- dmago(hs->sc_dq->dq_chan, addr, count, flags|DMAGO_READ);
- if (fhpibrecv(hs, slave, sec, 0, 0) < 0) {
-#ifdef DEBUG
- printf("fhpibgo: recv failed, retrying...\n");
-#endif
- (void) fhpibrecv(hs, slave, sec, 0, 0);
- }
- i = hd->hpib_cmd;
- hd->hpib_cmd = sc->sc_cmd;
- hd->hpib_ie = IDS_DMA(hs->sc_dq->dq_chan) |
- ((flags & DMAGO_WORD) ? IDS_WDMA : 0);
- return;
- }
- sc->sc_cmd = CT_REN | CT_8BIT | CT_FIFOSEL;
- if (count < hpibdmathresh) {
-#ifdef DEBUG
- /* fhpibnondma[unit]++; XXX */
- if (flags & DMAGO_WORD)
- /* fhpibworddma[unit]--; XXX */ ;
-#endif
- hs->sc_curcnt = count;
- (void) fhpibsend(hs, slave, sec, addr, count);
- fhpibdone(hs);
- return;
- }
- count -= (flags & DMAGO_WORD) ? 2 : 1;
- hs->sc_curcnt = count;
- dmago(hs->sc_dq->dq_chan, addr, count, flags);
- if (fhpibsend(hs, slave, sec, 0, 0) < 0) {
-#ifdef DEBUG
- printf("fhpibgo: send failed, retrying...\n");
-#endif
- (void) fhpibsend(hs, slave, sec, 0, 0);
- }
- i = hd->hpib_cmd;
- hd->hpib_cmd = sc->sc_cmd;
- hd->hpib_ie = IDS_DMA(hs->sc_dq->dq_chan) | IDS_WRITE |
- ((flags & DMAGO_WORD) ? IDS_WDMA : 0);
-}
-
-/*
- * A DMA read can finish but the device can still be waiting (MAG-tape
- * with more data than we're waiting for). This timeout routine
- * takes care of that. Somehow, the thing gets hosed. For now, since
- * this should be a very rare occurrence, we RESET it.
- */
-void
-fhpibdmadone(arg)
- void *arg;
-{
- struct fhpib_softc *sc = arg;
- struct hpibbus_softc *hs = sc->sc_hpibbus;
- int s;
-
- s = splbio();
- if (hs->sc_flags & HPIBF_IO) {
- struct fhpibdevice *hd = sc->sc_regs;
- struct hpibqueue *hq;
-
- hd->hpib_imask = 0;
- hd->hpib_cid = 0xFF;
- DELAY(100);
- hd->hpib_cmd = CT_8BIT;
- hd->hpib_ar = AR_ARONC;
- fhpibifc(hd);
- hd->hpib_ie = IDS_IE;
- hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
- dmafree(hs->sc_dq);
-
- hq = TAILQ_FIRST(&hs->sc_queue);
- (hq->hq_intr)(hq->hq_softc);
- }
- splx(s);
-}
-
-void
-fhpibdone(hs)
- struct hpibbus_softc *hs;
-{
- struct fhpib_softc *sc = (struct fhpib_softc *)hs->sc_dev.dv_parent;
- struct fhpibdevice *hd = sc->sc_regs;
- char *addr;
- int cnt;
-
- cnt = hs->sc_curcnt;
- hs->sc_addr += cnt;
- hs->sc_count -= cnt;
-#ifdef DEBUG
- if ((fhpibdebug & FDB_DMA) && fhpibdebugunit == sc->sc_dev.dv_unit)
- printf("fhpibdone: addr %p cnt %d\n",
- hs->sc_addr, hs->sc_count);
-#endif
- if (hs->sc_flags & HPIBF_READ) {
- hd->hpib_imask = IM_IDLE | IM_BYTE;
- if (hs->sc_flags & HPIBF_TIMO)
- timeout_add_msec(&sc->sc_dma_to, 250);
- } else {
- cnt = hs->sc_count;
- if (cnt) {
- addr = hs->sc_addr;
- hd->hpib_imask = IM_IDLE | IM_ROOM;
- FHPIBWAIT(hd, IM_IDLE);
- hd->hpib_stat = ST_WRITE;
- while (--cnt) {
- hd->hpib_data = *addr++;
- FHPIBWAIT(hd, IM_ROOM);
- }
- hd->hpib_stat = ST_EOI;
- hd->hpib_data = *addr;
- }
- hd->hpib_imask = IM_IDLE;
- }
- hs->sc_flags |= HPIBF_DONE;
- hd->hpib_stat = ST_IENAB;
- hd->hpib_ie = IDS_IE;
-}
-
-int
-fhpibintr(arg)
- void *arg;
-{
- struct fhpib_softc *sc = arg;
- struct hpibbus_softc *hs = sc->sc_hpibbus;
- struct fhpibdevice *hd = sc->sc_regs;
- struct hpibqueue *hq;
- int stat0;
-
- stat0 = hd->hpib_ids;
- if ((stat0 & (IDS_IE|IDS_IR)) != (IDS_IE|IDS_IR)) {
-#ifdef DEBUG
- if ((fhpibdebug & FDB_FAIL) && (stat0 & IDS_IR) &&
- (hs->sc_flags & (HPIBF_IO|HPIBF_DONE)) != HPIBF_IO)
- printf("%s: fhpibintr: bad status %x\n",
- sc->sc_dev.dv_xname, stat0);
- /* fhpibbadint[0]++; XXX */
-#endif
- return(0);
- }
- if ((hs->sc_flags & (HPIBF_IO|HPIBF_DONE)) == HPIBF_IO) {
-#ifdef DEBUG
- /* fhpibbadint[1]++; XXX */
-#endif
- return(0);
- }
-
-#ifdef DEBUG
- if ((fhpibdebug & FDB_DMA) && fhpibdebugunit == sc->sc_dev.dv_unit)
- printf("fhpibintr: flags %x\n", hs->sc_flags);
-#endif
- hq = TAILQ_FIRST(&hs->sc_queue);
- if (hs->sc_flags & HPIBF_IO) {
- if (hs->sc_flags & HPIBF_TIMO)
- timeout_del(&sc->sc_dma_to);
- stat0 = hd->hpib_cmd;
- hd->hpib_cmd = sc->sc_cmd & ~CT_8BIT;
- hd->hpib_stat = 0;
- hd->hpib_cmd = CT_REN | CT_8BIT;
- stat0 = hd->hpib_intr;
- hd->hpib_imask = 0;
- hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
- dmafree(hs->sc_dq);
- (hq->hq_intr)(hq->hq_softc);
- } else if (hs->sc_flags & HPIBF_PPOLL) {
- stat0 = hd->hpib_intr;
-#ifdef DEBUG
- if ((fhpibdebug & FDB_FAIL) &&
- doppollint && (stat0 & IM_PPRESP) == 0)
- printf("%s: fhpibintr: bad intr reg %x\n",
- sc->sc_dev.dv_xname, stat0);
-#endif
- hd->hpib_stat = 0;
- hd->hpib_imask = 0;
-#ifdef DEBUG
- stat0 = fhpibppoll(hs);
- if ((fhpibdebug & FDB_PPOLL) &&
- fhpibdebugunit == sc->sc_dev.dv_unit)
- printf("fhpibintr: got PPOLL status %x\n", stat0);
- if ((stat0 & (0x80 >> hq->hq_slave)) == 0) {
- /*
- * XXX give it another shot (68040)
- */
- /* fhpibppollfail[unit]++; XXX */
- DELAY(fhpibppolldelay);
- stat0 = fhpibppoll(hs);
- if ((stat0 & (0x80 >> hq->hq_slave)) == 0 &&
- (fhpibdebug & FDB_PPOLL) &&
- fhpibdebugunit == sc->sc_dev.dv_unit)
- printf("fhpibintr: PPOLL: unit %d slave %d stat %x\n",
- sc->sc_dev.dv_unit, hq->hq_slave, stat0);
- }
-#endif
- hs->sc_flags &= ~HPIBF_PPOLL;
- (hq->hq_intr)(hq->hq_softc);
- }
- return(1);
-}
-
-int
-fhpibppoll(hs)
- struct hpibbus_softc *hs;
-{
- struct fhpib_softc *sc = (struct fhpib_softc *)hs->sc_dev.dv_parent;
- struct fhpibdevice *hd = sc->sc_regs;
- int ppoll;
-
- hd->hpib_stat = 0;
- hd->hpib_psense = 0;
- hd->hpib_pmask = 0xFF;
- hd->hpib_imask = IM_PPRESP | IM_PABORT;
- DELAY(25);
- hd->hpib_intr = IM_PABORT;
- ppoll = hd->hpib_data;
- if (hd->hpib_intr & IM_PABORT)
- ppoll = 0;
- hd->hpib_imask = 0;
- hd->hpib_pmask = 0;
- hd->hpib_stat = ST_IENAB;
- return(ppoll);
-}
-
-int
-fhpibwait(hd, x)
- struct fhpibdevice *hd;
- int x;
-{
- int timo = hpibtimeout;
-
- while ((hd->hpib_intr & x) == 0 && --timo)
- DELAY(1);
- if (timo == 0) {
-#ifdef DEBUG
- if (fhpibdebug & FDB_FAIL)
- printf("fhpibwait(%p, %x) timeout\n", hd, x);
-#endif
- return(-1);
- }
- return(0);
-}
-
-/*
- * XXX: this will have to change if we ever allow more than one
- * pending operation per HP-IB.
- */
-void
-fhpibppwatch(arg)
- void *arg;
-{
- struct hpibbus_softc *hs = arg;
- struct fhpib_softc *sc = (struct fhpib_softc *)hs->sc_dev.dv_parent;
- struct fhpibdevice *hd = sc->sc_regs;
- int slave;
-
- if ((hs->sc_flags & HPIBF_PPOLL) == 0)
- return;
- slave = (0x80 >> TAILQ_FIRST(&hs->sc_queue)->hq_slave);
-#ifdef DEBUG
- if (!doppollint) {
- if (fhpibppoll(hs) & slave) {
- hd->hpib_stat = ST_IENAB;
- hd->hpib_imask = IM_IDLE | IM_ROOM;
- } else {
- timeout_set(&sc->sc_watch_to, fhpibppwatch, hs);
- timeout_add(&sc->sc_watch_to, 1);
- }
- return;
- }
- if ((fhpibdebug & FDB_PPOLL) && sc->sc_dev.dv_unit == fhpibdebugunit)
- printf("fhpibppwatch: sense request on %s\n",
- sc->sc_dev.dv_xname);
-#endif
- hd->hpib_psense = ~slave;
- hd->hpib_pmask = slave;
- hd->hpib_stat = ST_IENAB;
- hd->hpib_imask = IM_PPRESP | IM_PABORT;
- hd->hpib_ie = IDS_IE;
-}
diff --git a/sys/arch/hp300/dev/fhpibreg.h b/sys/arch/hp300/dev/fhpibreg.h
deleted file mode 100644
index d30661b963d..00000000000
--- a/sys/arch/hp300/dev/fhpibreg.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* $OpenBSD: fhpibreg.h,v 1.3 2003/06/02 23:27:44 millert Exp $ */
-/* $NetBSD: fhpibreg.h,v 1.4 1994/10/26 07:23:45 cgd Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fhpibreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-struct fhpibdevice {
- u_char hpib_pad0;
- vu_char hpib_cid;
- u_char hpib_pad1;
-#define hpib_ie hpib_ids
- vu_char hpib_ids;
- u_char hpib_pad2;
- vu_char hpib_ctrl2;
- u_char hpib_pad3;
- vu_char hpib_latch;
- u_char hpib_pad4[9];
- vu_char hpib_intr;
- u_char hpib_pad5;
- vu_char hpib_imask;
- u_char hpib_pad6;
- vu_char hpib_data;
- u_char hpib_pad7;
- vu_char hpib_stat;
- u_char hpib_pad8;
- vu_char hpib_cmd;
- u_char hpib_pad9;
- vu_char hpib_ar;
- u_char hpib_pad10;
- vu_char hpib_pmask;
- u_char hpib_pad11;
- vu_char hpib_psense;
-};
-
-/* status bits */
-#define ST_READ0 0xC0
-#define ST_READ1 0x80
-#define ST_IENAB 0x80
-#define ST_EOI 0x80
-#define ST_ATN 0x40
-#define ST_WRITE 0x00
-
-/* control bits */
-#define CT_8BIT 0x80
-#define CT_REN 0x20
-#define CT_IFC 0x10
-#define CT_FIFOSEL 0x02
-#define CT_INITFIFO 0x01
-
-#define IM_PABORT 0x40
-#define IM_PPRESP 0x20
-#define IM_ROOM 0x08
-#define IM_BYTE 0x04
-#define IM_IDLE 0x02
-
-#define AR_ARONC 0x80
diff --git a/sys/arch/hp300/dev/frodo.c b/sys/arch/hp300/dev/frodo.c
deleted file mode 100644
index a8589989aea..00000000000
--- a/sys/arch/hp300/dev/frodo.c
+++ /dev/null
@@ -1,484 +0,0 @@
-/* $OpenBSD: frodo.c,v 1.14 2011/08/18 19:54:18 miod Exp $ */
-/* $NetBSD: frodo.c,v 1.5 1999/07/31 21:15:20 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1997, 1998, 1999 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 Michael Smith. 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 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 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.
- */
-
-/*
- * Support for the "Frodo" (a.k.a. "Apollo Utility") chip found
- * in HP Apollo 9000/4xx workstations, as well as HP 9000/382.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-#include <machine/hp300spu.h>
-
-#include <hp300/dev/intiovar.h>
-
-#include <hp300/dev/frodoreg.h>
-#include <hp300/dev/frodovar.h>
-
-#include "isabr.h"
-
-#if NISABR > 0
-#include <uvm/uvm_extern.h>
-
-#include <dev/isa/isareg.h>
-#include <hp300/dev/isabrreg.h>
-#endif
-
-struct frodo_softc {
- struct device sc_dev; /* generic device glue */
- volatile u_int8_t *sc_regs; /* register base */
- struct isr *sc_intr[FRODO_NINTR]; /* interrupt handlers */
- struct isr sc_isr; /* main interrupt handler */
- u_int sc_refcnt; /* number of interrupt refs */
-};
-
-int frodomatch(struct device *, void *, void *);
-void frodoattach(struct device *, struct device *, void *);
-
-int frodoprint(void *, const char *);
-int frodosubmatch(struct device *, void *, void *);
-
-int frodointr(void *);
-void frodo_imask(struct frodo_softc *, u_int16_t, u_int16_t);
-int frodo_isa_exists(void);
-void frodo_state(struct frodo_softc *);
-
-struct cfattach frodo_ca = {
- sizeof(struct frodo_softc), frodomatch, frodoattach
-};
-
-struct cfdriver frodo_cd = {
- NULL, "frodo", DV_DULL
-};
-
-struct frodo_attach_args frodo_subdevs[] = {
- { "dnkbd", NULL, FRODO_APCI_OFFSET(0), FRODO_INTR_APCI0 },
- { "apci", NULL, FRODO_APCI_OFFSET(1), FRODO_INTR_APCI1 },
- { "apci", NULL, FRODO_APCI_OFFSET(2), FRODO_INTR_APCI2 },
- { "apci", NULL, FRODO_APCI_OFFSET(3), FRODO_INTR_APCI3 },
- { NULL, NULL, 0, 0 },
-};
-
-#define FRODO_IPL 5
-
-int
-frodomatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct intio_attach_args *ia = aux;
- caddr_t va;
- static int frodo_matched = 0;
-
- /* only allow one instance */
- if (frodo_matched)
- return (0);
-
- /* only specific workstations can have this */
- switch (machineid) {
- case HP_382:
- case HP_400:
- case HP_425:
- case HP_433:
- break;
-
- default:
- return (0);
- }
-
- /* make sure the hardware is there in any case */
- va = (caddr_t)IIOV(FRODO_BASE);
- if (badaddr(va))
- return (0);
-
- frodo_matched = 1;
- ia->ia_addr = (caddr_t)FRODO_BASE;
- return (1);
-}
-
-void
-frodoattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct frodo_softc *sc = (struct frodo_softc *)self;
- struct intio_attach_args *ia = aux;
- int i;
-
- sc->sc_regs = (volatile u_int8_t *)IIOV(ia->ia_addr);
-
- printf(" ipl %d", FRODO_IPL);
- if ((FRODO_READ(sc, FRODO_IISR) & FRODO_IISR_SERVICE) == 0)
- printf(": service mode enabled");
- printf("\n");
-
- /* Clear all of the interrupt handlers. */
- bzero(sc->sc_intr, sizeof(sc->sc_intr));
-
- /*
- * Disable all of the interrupt lines; we reenable them
- * as subdevices attach.
- */
- frodo_imask(sc, 0, 0xffff);
-
- /* Clear any pending interrupts. */
- FRODO_WRITE(sc, FRODO_PIC_PU, 0xff);
- FRODO_WRITE(sc, FRODO_PIC_PL, 0xff);
-
- /* Set interrupt polarities... */
- FRODO_WRITE(sc, FRODO_PIO_IPR, 0x10);
-
- /* ...and configure 1-5 for edge triggering. */
- FRODO_WRITE(sc, FRODO_PIO_IELR, 0xc1);
-
- /* Initialize IVR high half to zero so we don't need to mask it later */
- FRODO_WRITE(sc, FRODO_PIC_IVR, 0x00);
-
- /* Mask ISA interrupts until an ISA interrupt handler is registered. */
- FRODO_WRITE(sc, FRODO_PIO_ISA_CONTROL, 0x80);
-
- /*
- * We defer hooking up our interrupt handler until
- * a subdevice hooks up theirs.
- */
- sc->sc_refcnt = 0;
-
- /* ... and attach subdevices. */
- for (i = 0; frodo_subdevs[i].fa_name != NULL; i++) {
- /*
- * Skip the first serial port if we're not a 425e;
- * it's mapped to the DCA at select code 9 on all
- * other models.
- */
- if (frodo_subdevs[i].fa_offset == FRODO_APCI_OFFSET(1) &&
- mmuid != MMUID_425_E)
- continue;
- frodo_subdevs[i].fa_tag = ia->ia_tag;
- config_found_sm(self, &frodo_subdevs[i],
- frodoprint, frodosubmatch);
- }
-
-#if NISABR > 0
- /*
- * Only attempt to attach the isa bridge if it exists on this
- * machine.
- */
- if (frodo_isa_exists()) {
- struct frodo_attach_args fa;
-
- fa.fa_name = "isabr";
- fa.fa_tag = ia->ia_tag;
- fa.fa_offset = fa.fa_line = 0;
- config_found_sm(self, &fa, frodoprint, frodosubmatch);
- }
-#endif
-}
-
-int
-frodosubmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct cfdata *cf = match;
- struct frodo_attach_args *fa = aux;
-
- if (cf->frodocf_offset != FRODO_UNKNOWN_OFFSET &&
- cf->frodocf_offset != fa->fa_offset)
- return (0);
-
- return ((*cf->cf_attach->ca_match)(parent, cf, aux));
-}
-
-int
-frodoprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct frodo_attach_args *fa = aux;
-
- if (pnp)
- printf("%s at %s", fa->fa_name, pnp);
- printf(" offset 0x%x", fa->fa_offset);
- return (UNCONF);
-}
-
-int
-frodo_intr_establish(struct device *frdev, int line, struct isr *isr,
- const char *name)
-{
- struct frodo_softc *sc = (struct frodo_softc *)frdev;
- int priority = isr->isr_priority;
-
- if (line <= 0 || line >= FRODO_NINTR) {
- panic("%s: bad interrupt line %d",
- sc->sc_dev.dv_xname, line);
- }
- if (sc->sc_intr[line] != NULL) {
-#ifdef DEBUG
- printf("%s: interrupt line %d already used\n",
- sc->sc_dev.dv_xname, line);
-#endif
- return (EPERM);
- }
-
- /*
- * If this is the first one, establish the frodo
- * interrupt handler. If not, reestablish at a
- * higher priority if necessary.
- */
- if (sc->sc_isr.isr_priority < priority) {
- if (sc->sc_refcnt != 0)
- intr_disestablish(&sc->sc_isr);
- sc->sc_isr.isr_func = frodointr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_ipl = FRODO_IPL;
- sc->sc_isr.isr_priority = priority;
- intr_establish(&sc->sc_isr, sc->sc_dev.dv_xname);
- }
-
- sc->sc_refcnt++;
-
- /* Install the handler. */
- isr->isr_ipl = sc->sc_isr.isr_ipl;
- evcount_attach(&isr->isr_count, name, &isr->isr_ipl);
- sc->sc_intr[line] = isr;
-
- /* Enable the interrupt line. */
- frodo_imask(sc, FRODO_INTR_BIT(line), 0);
-
-#if NISABR > 0
- /* Unmask ISA interrupts if necessary. */
- if (FRODO_INTR_ISA(line))
- FRODO_WRITE(sc, FRODO_PIO_ISA_CONTROL, 0x00);
-#endif
-
- return (0);
-}
-
-void
-frodo_intr_disestablish(frdev, line)
- struct device *frdev;
- int line;
-{
- struct frodo_softc *sc = (struct frodo_softc *)frdev;
- int newpri;
-
-#ifdef DIAGNOSTIC
- if (sc->sc_intr[line] == NULL) {
- printf("%s(%s): no handler for line %d",
- sc->sc_dev.dv_xname, __func__, line);
- return;
- }
-#endif
-
- sc->sc_intr[line] = NULL;
- frodo_imask(sc, 0, FRODO_INTR_BIT(line));
-
-#if NISABR > 0
- /* Mask ISA interrupts if necessary. */
- if (FRODO_INTR_ISA(line)) {
- if (sc->sc_intr[FRODO_INTR_ILOW] == NULL &&
- sc->sc_intr[FRODO_INTR_IMID] == NULL &&
- sc->sc_intr[FRODO_INTR_IHI] == NULL)
- FRODO_WRITE(sc, FRODO_PIO_ISA_CONTROL, 0x80);
- }
-#endif
-
- /* If this was the last, unhook ourselves. */
- if (sc->sc_refcnt-- == 1) {
- intr_disestablish(&sc->sc_isr);
- return;
- }
-
- /* Lower our priority, if appropriate. */
- for (newpri = 0, line = 0; line < FRODO_NINTR; line++)
- if (sc->sc_intr[line] != NULL &&
- sc->sc_intr[line]->isr_priority > newpri)
- newpri = sc->sc_intr[line]->isr_priority;
-
- if (newpri != sc->sc_isr.isr_priority) {
- intr_disestablish(&sc->sc_isr);
- sc->sc_isr.isr_func = frodointr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_ipl = FRODO_IPL;
- sc->sc_isr.isr_priority = newpri;
- intr_establish(&sc->sc_isr, sc->sc_dev.dv_xname);
- }
-}
-
-int
-frodointr(arg)
- void *arg;
-{
- struct frodo_softc *sc = arg;
- struct isr *fisr;
- int pending, line, rc = 0;
-
-#ifdef DEBUG
- frodo_state(sc);
-#endif
-
- /* Any interrupts pending? */
- while ((pending = FRODO_GETPEND(sc)) != 0) {
- rc++;
-
- /*
- * Get pending interrupt; this also clears it for us.
- */
- line = FRODO_READ(sc, FRODO_PIC_ACK) /* & 0x0f */;
-
- fisr = sc->sc_intr[line];
- if (fisr == NULL) {
- printf("%s: unhandled interrupt on line %d\n",
- sc->sc_dev.dv_xname, line);
-#ifdef DEBUG
- /* Disable interrupt source */
- frodo_imask(sc, 0, FRODO_INTR_BIT(line));
-#endif
- } else {
- if ((*fisr->isr_func)(fisr->isr_arg) != 0) {
- fisr->isr_count.ec_count++;
- } else {
- printf("%s: spurious interrupt on line %d\n",
- sc->sc_dev.dv_xname, line);
- }
- }
-
- if (rc > 100)
- panic("frodointr: looping, pending %x line %d fisr %p",
- pending, line, fisr);
-
-#ifdef DEBUG
- frodo_state(sc);
-#endif
- }
-
- return (rc);
-}
-
-void
-frodo_imask(sc, set, clear)
- struct frodo_softc *sc;
- u_int16_t set, clear;
-{
- u_int16_t imask;
-
- imask = FRODO_GETMASK(sc);
-
- imask |= set;
- imask &= ~clear;
-
- FRODO_SETMASK(sc, imask);
-}
-
-#ifdef DEBUG
-void
-frodo_state(struct frodo_softc *sc)
-{
- int i;
-
- printf("%s state:", sc->sc_dev.dv_xname);
- for (i = 0xc0; i < 0x100; i += 4) {
- printf(" %02x", FRODO_READ(sc, i));
- if (i == 0xcc || i == 0xdc || i == 0xec)
- printf(" /");
- }
- printf("\n");
-}
-#endif
-
-#if NISABR > 0
-int
-frodo_isa_exists()
-{
- vaddr_t va;
- int rv;
-
- va = uvm_km_valloc(kernel_map, PAGE_SIZE);
- if (va == NULL)
- return (0);
-
- /*
- * Check that the iomem space answers probes
- */
- pmap_kenter_cache(va, ISABR_IOMEM_BASE, PG_RW | PG_CI);
- pmap_update(pmap_kernel());
- rv = badbaddr((caddr_t)va);
- pmap_kremove(va, PAGE_SIZE);
- pmap_update(pmap_kernel());
-
- /*
- * Check that the ioport space answers probes
- */
- pmap_kenter_cache(va, ISABR_IOPORT_BASE, PG_RW | PG_CI);
- pmap_update(pmap_kernel());
- rv |= badbaddr((caddr_t)va);
- pmap_kremove(va, PAGE_SIZE);
- pmap_update(pmap_kernel());
-
- uvm_km_free(kernel_map, va, PAGE_SIZE);
-
- return (!rv);
-}
-#endif
diff --git a/sys/arch/hp300/dev/frodoreg.h b/sys/arch/hp300/dev/frodoreg.h
deleted file mode 100644
index 07b2280e4c3..00000000000
--- a/sys/arch/hp300/dev/frodoreg.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $OpenBSD: frodoreg.h,v 1.2 2007/01/06 20:17:43 miod Exp $ */
-/* $NetBSD: frodoreg.h,v 1.1 1997/05/12 08:03:49 thorpej Exp $ */
-
-/*
- * Copyright (c) 1997 Michael Smith. 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 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 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.
- */
-
-/* Base address of the Frodo part */
-#define FRODO_BASE (INTIOBASE + 0x1c000)
-
-/*
- * Where we find the 8250-like APCI ports, and how far apart they are.
- */
-#define FRODO_APCIBASE 0x0
-#define FRODO_APCISPACE 0x20
-#define FRODO_APCI_OFFSET(x) (FRODO_APCIBASE + ((x) * FRODO_APCISPACE))
-
-/*
- * Other items in the Frodo part
- */
-
-/* An mc146818-like calendar, but no battery... lame */
-#define FRODO_CALENDAR 0x80
-
-#define FRODO_TIMER 0xa0 /* 8254-like timer */
-#define FRODO_T1_CTR 0xa0 /* counter 1 */
-#define FRODO_T2_CTR 0xa4 /* counter 2 */
-#define FRODO_T3_CTR 0xa8 /* counter 3 */
-#define FRODO_T_CTRL 0xac /* control register */
-#define FRODO_T_PSCALE 0xb0 /* prescaler */
-#define FRODO_T_PCOUNT 0xb4 /* precounter ? */
-#define FRODO_T_OVCOUNT 0xb8 /* overflow counter (0, 1, 2) */
-
-#define FRODO_PIO 0xc0 /* programmable i/o registers start
- here */
-#define FRODO_IISR 0xc0 /* ISA Interrupt Status Register
- (also PIR) */
-#define FRODO_IISR_SERVICE (1<<0) /* service switch "on" if 0 */
-#define FRODO_IISR_ILOW (1<<1) /* IRQ 3,4,5 or 6 on ISA if 0 */
-#define FRODO_IISR_IMID (1<<2) /* IRQ 7,9,10 or 11 on ISA if 0 */
-#define FRODO_IISR_IHI (1<<3) /* IRQ 12,13,14 or 15 on ISA if 0 */
- /* bits 4 and 5 are DN2500 SCSI interrupts */
- /* bit 6 is unused */
-#define FRODO_IISR_IOCHK (1<<7) /* ISA board asserted IOCHK if low */
-
-#define FRODO_PIO_IPR 0xc4 /* input polarity register
- (ints 7->0) */
-
-#define FRODO_PIO_IELR 0xc8 /* input edge/level register */
-#define FRODO_PIO_ISA_CONTROL 0xcc /* ISA interrupts masking */
-
-/* This is probably not used on the 4xx */
-#define FRODO_DIAGCTL 0xd0 /* Diagnostic Control Register */
-
-#define FRODO_PIC_MU 0xe0 /* upper Interrupt Mask register */
-#define FRODO_PIC_ML 0xe4 /* lower Interrupt Mask register */
-#define FRODO_PIC_PU 0xe8 /* upper Interrupt Pending register */
-#define FRODO_PIC_PL 0xec /* lower Interrupt Pending register */
-#define FRODO_PIC_IVR 0xf8 /* Interrupt Vector register */
-#define FRODO_PIC_ACK 0xf8 /* Interrupt Acknowledge */
-
-/* Shorthand for register access. */
-#define FRODO_READ(sc, reg) ((sc)->sc_regs[(reg)])
-#define FRODO_WRITE(sc, reg, val) (sc)->sc_regs[(reg)] = (val)
-
-/* manipulate interrupt registers */
-#define FRODO_GETMASK(sc) \
- ((FRODO_READ((sc), FRODO_PIC_MU) << 8) | \
- FRODO_READ((sc), FRODO_PIC_ML))
-#define FRODO_SETMASK(sc, val) do { \
- FRODO_WRITE((sc), FRODO_PIC_MU, ((val) >> 8) & 0xff); \
- FRODO_WRITE((sc), FRODO_PIC_ML, (val) & 0xff); } while (0)
-
-#define FRODO_GETPEND(sc) \
- ((FRODO_READ((sc), FRODO_PIC_PU) << 8) | \
- FRODO_READ((sc), FRODO_PIC_PL))
-
-/*
- * Interrupt lines. Use FRODO_INTR_BIT() below to get a bit
- * suitable for one of the interrupt mask registers. Yes, line
- * 0 is unused.
- */
-#define FRODO_INTR_ILOW 1
-#define FRODO_INTR_IMID 2
-#define FRODO_INTR_IHI 3
-#define FRODO_INTR_SCSIDMA 4 /* DN2500 only */
-#define FRODO_INTR_SCSI 5 /* DN2500 only */
-#define FRODO_INTR_HORIZ 6
-#define FRODO_INTR_IOCHK 7
-#define FRODO_INTR_CALENDAR 8
-#define FRODO_INTR_TIMER0 9
-#define FRODO_INTR_TIMER1 10
-#define FRODO_INTR_TIMER2 11
-#define FRODO_INTR_APCI0 12
-#define FRODO_INTR_APCI1 13
-#define FRODO_INTR_APCI2 14
-#define FRODO_INTR_APCI3 15
-
-#define FRODO_NINTR 16
-
-#define FRODO_INTR_ISA(l) ((l) != 0 && (l) <= FRODO_INTR_IHI)
-#define FRODO_INTR_BIT(line) (1 << (line))
diff --git a/sys/arch/hp300/dev/frodovar.h b/sys/arch/hp300/dev/frodovar.h
deleted file mode 100644
index 3f78a022f4b..00000000000
--- a/sys/arch/hp300/dev/frodovar.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* $OpenBSD: frodovar.h,v 1.7 2007/01/06 20:17:43 miod Exp $ */
-/* $NetBSD: frodovar.h,v 1.1 1997/05/12 08:03:50 thorpej Exp $ */
-
-/*
- * Copyright (c) 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1997 Michael Smith. 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 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 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.
- */
-
-/*
- * Autoconfiguration definitions and prototypes for the Frodo ASIC in
- * the HP 9000/4xx series.
- */
-
-/*
- * Arguments used to attach Frodo subdevices.
- */
-struct frodo_attach_args {
- const char *fa_name; /* device name */
- bus_space_tag_t fa_tag;
- int fa_offset; /* offset from Frodo base */
- int fa_line; /* Frodo interrupt line */
-};
-
-#define frodocf_offset cf_loc[0]
-#define FRODO_UNKNOWN_OFFSET -1
-
-int frodo_intr_establish(struct device *, int, struct isr *, const char *);
-void frodo_intr_disestablish(struct device *, int);
diff --git a/sys/arch/hp300/dev/gbox.c b/sys/arch/hp300/dev/gbox.c
deleted file mode 100644
index 7ec25558432..00000000000
--- a/sys/arch/hp300/dev/gbox.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/* $OpenBSD: gbox.c,v 1.17 2013/10/21 10:36:12 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_gb.c 1.18 93/08/13$
- *
- * @(#)grf_gb.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for the Gatorbox.
- *
- * Note: In the context of this system, "gator" and "gatorbox" both refer to
- * HP 987x0 graphics systems. "Gator" is not used for high res mono.
- * (as in 9837 Gator systems)
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/intiovar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-#include <hp300/dev/gboxreg.h>
-
-struct gbox_softc {
- struct device sc_dev;
- struct diofb *sc_fb;
- struct diofb sc_fb_store;
- int sc_scode;
-};
-
-int gbox_dio_match(struct device *, void *, void *);
-void gbox_dio_attach(struct device *, struct device *, void *);
-int gbox_intio_match(struct device *, void *, void *);
-void gbox_intio_attach(struct device *, struct device *, void *);
-
-struct cfattach gbox_dio_ca = {
- sizeof(struct gbox_softc), gbox_dio_match, gbox_dio_attach
-};
-
-struct cfattach gbox_intio_ca = {
- sizeof(struct gbox_softc), gbox_intio_match, gbox_intio_attach
-};
-
-struct cfdriver gbox_cd = {
- NULL, "gbox", DV_DULL
-};
-
-int gbox_reset(struct diofb *, int, struct diofbreg *);
-void gbox_restore(struct diofb *);
-int gbox_setcmap(struct diofb *, struct wsdisplay_cmap *);
-void gbox_setcolor(struct diofb *, u_int);
-int gbox_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
-
-int gbox_ioctl(void *, u_long, caddr_t, int, struct proc *);
-void gbox_burner(void *, u_int, u_int);
-
-struct wsdisplay_accessops gbox_accessops = {
- .ioctl = gbox_ioctl,
- .mmap = diofb_mmap,
- .alloc_screen = diofb_alloc_screen,
- .free_screen = diofb_free_screen,
- .show_screen = diofb_show_screen,
- .load_font = diofb_load_font,
- .list_font = diofb_list_font,
- .burn_screen = gbox_burner
-};
-
-/*
- * Attachment glue
- */
-int
-gbox_intio_match(struct device *parent, void *match, void *aux)
-{
- struct intio_attach_args *ia = aux;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
-
- if (badaddr((caddr_t)fbr))
- return (0);
-
- if (fbr->id == GRFHWID && fbr->fbid == GID_GATORBOX) {
- ia->ia_addr = (caddr_t)GRFIADDR;
- return (1);
- }
-
- return (0);
-}
-
-void
-gbox_intio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct gbox_softc *sc = (struct gbox_softc *)self;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
- sc->sc_scode = CONSCODE_INTERNAL;
-
- if (sc->sc_scode == conscode) {
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- gbox_reset(sc->sc_fb, sc->sc_scode, fbr);
- }
-
- diofb_end_attach(sc, &gbox_accessops, sc->sc_fb,
- sc->sc_scode == conscode, NULL);
-}
-
-int
-gbox_dio_match(struct device *parent, void *match, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- /* We can not appear in DIO-II space */
- if (DIO_ISDIOII(da->da_scode))
- return (0);
-
- if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
- da->da_secid == DIO_DEVICE_SECID_GATORBOX)
- return (1);
-
- return (0);
-}
-
-void
-gbox_dio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct gbox_softc *sc = (struct gbox_softc *)self;
- struct dio_attach_args *da = aux;
- struct diofbreg * fbr;
-
- sc->sc_scode = da->da_scode;
- if (sc->sc_scode == conscode) {
- fbr = (struct diofbreg *)conaddr; /* already mapped */
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- fbr = (struct diofbreg *)
- iomap(dio_scodetopa(sc->sc_scode), da->da_size);
- if (fbr == NULL ||
- gbox_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) {
- printf(": can't map framebuffer\n");
- return;
- }
- }
-
- diofb_end_attach(sc, &gbox_accessops, sc->sc_fb,
- sc->sc_scode == conscode, NULL);
-}
-
-/*
- * Initialize hardware and display routines.
- */
-
-const u_int8_t crtc_init_data[] = {
- 0x29, 0x20, 0x23, 0x04, 0x30, 0x0b, 0x30,
- 0x30, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00
-};
-
-int
-gbox_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
-{
- int rc;
- u_int i;
-
- /* XXX don't trust hardware, force defaults */
- fb->fbwidth = 1024;
- fb->fbheight = 1024;
- fb->dwidth = 1024;
- fb->dheight = 768;
- if ((rc = diofb_fbinquire(fb, scode, fbr)) != 0)
- return (rc);
-
- fb->bmv = gbox_windowmove;
- gbox_restore(fb);
-
- /*
- * Find out how many colors are available by determining
- * which planes are installed. That is, write all ones to
- * a frame buffer location, see how many ones are read back.
- */
- if (1 /* fb->planes == 0 */) {
- volatile u_int8_t *fbp;
- u_int8_t save;
-
- fbp = (u_int8_t *)fb->fbkva;
- save = *fbp;
- *fbp = 0xff;
- fb->planemask = *fbp;
- *fbp = save;
-
- for (fb->planes = 1; fb->planemask >= (1 << fb->planes);
- fb->planes++);
- if (fb->planes > 8)
- fb->planes = 8;
- fb->planemask = (1 << fb->planes) - 1;
- }
-
- diofb_fbsetup(fb);
- for (i = 0; i <= fb->planemask; i++)
- gbox_setcolor(fb, i);
-
- return (0);
-}
-
-void
-gbox_restore(struct diofb *fb)
-{
- volatile struct gboxfb *gb = (struct gboxfb *)fb->regkva;
- u_int i;
-
- /*
- * The minimal info here is from the Gatorbox X driver.
- */
- gb->write_protect = 0x0;
- gb->regs.interrupt = 0x4;
- gb->rep_rule = RR_COPY;
- gb->blink1 = 0xff;
- gb->blink2 = 0xff;
-
- /*
- * Program the 6845.
- */
- for (i = 0; i < sizeof(crtc_init_data); i++) {
- gb->crtc_address = i;
- gb->crtc_data = crtc_init_data[i];
- }
-
- tile_mover_waitbusy(gb);
-
- /* Enable display */
- gb->regs.sec_interrupt = 0x01;
-}
-
-int
-gbox_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
-{
- struct diofb *fb = v;
- struct wsdisplay_fbinfo *wdf;
- u_int i;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_GBOX;
- break;
- case WSDISPLAYIO_SMODE:
- fb->mapmode = *(u_int *)data;
- if (fb->mapmode == WSDISPLAYIO_MODE_EMUL) {
- gbox_restore(fb);
- for (i = 0; i <= fb->planemask; i++)
- gbox_setcolor(fb, i);
- }
- break;
- case WSDISPLAYIO_GINFO:
- wdf = (void *)data;
- wdf->width = fb->ri.ri_width;
- wdf->height = fb->ri.ri_height;
- wdf->depth = fb->ri.ri_depth;
- wdf->cmsize = 1 << fb->planes;
- break;
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = fb->ri.ri_stride;
- break;
- case WSDISPLAYIO_GETCMAP:
- return (diofb_getcmap(fb, (struct wsdisplay_cmap *)data));
- case WSDISPLAYIO_PUTCMAP:
- return (gbox_setcmap(fb, (struct wsdisplay_cmap *)data));
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- break;
- default:
- return (-1);
- }
-
- return (0);
-}
-
-void
-gbox_burner(void *v, u_int on, u_int flags)
-{
- struct diofb *fb = v;
- volatile struct gboxfb *gb = (struct gboxfb *)fb->regkva;
-
- if (on)
- gb->regs.sec_interrupt = 0x01;
- else
- gb->regs.sec_interrupt = 0x00;
-}
-
-void
-gbox_setcolor(struct diofb *fb, u_int index)
-{
- volatile struct gboxfb *gb = (struct gboxfb *)fb->regkva;
-
- gb->creg_select = index;
- gb->cmap_red = fb->cmap.r[index];
- gb->cmap_grn = fb->cmap.g[index];
- gb->cmap_blu = fb->cmap.b[index];
- gb->cmap_write = !!index;
- gbcm_waitbusy(gb);
-}
-
-int
-gbox_setcmap(struct diofb *fb, struct wsdisplay_cmap *cm)
-{
- u_int8_t r[256], g[256], b[256];
- u_int index = cm->index, count = cm->count;
- u_int colcount = 1 << fb->planes;
- int error;
-
- 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);
-
- bcopy(r, fb->cmap.r + index, count);
- bcopy(g, fb->cmap.g + index, count);
- bcopy(b, fb->cmap.b + index, count);
-
- while (count-- != 0)
- gbox_setcolor(fb, index++);
-
- return (0);
-}
-
-int
-gbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
- u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop,
- int16_t planemask)
-{
- volatile struct gboxfb *gb = (struct gboxfb *)fb->regkva;
- int src, dest;
-
- if (planemask != 0xff)
- return (EINVAL);
-
- src = (sy * 1024) + sx; /* upper left corner in pixels */
- dest = (dy * 1024) + dx;
-
- tile_mover_waitbusy(gb);
-
- gb->width = -(cx / 4);
- gb->height = -(cy / 4);
- if (src < dest)
- gb->rep_rule = MOVE_DOWN_RIGHT | rop;
- else {
- gb->rep_rule = MOVE_UP_LEFT | rop;
- /*
- * Adjust to top of lower right tile of the block.
- */
- src = src + ((cy - 4) * 1024) + (cx - 4);
- dest= dest + ((cy - 4) * 1024) + (cx - 4);
- }
- *(volatile u_int8_t *)(fb->fbkva + dest) =
- *(volatile u_int8_t *)(fb->fbkva + src);
-
- tile_mover_waitbusy(gb);
-
- return (0);
-}
-
-/*
- * Gatorbox console support
- */
-
-void
-gboxcninit()
-{
- gbox_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
- diofb_cnattach(&diofb_cn);
-}
diff --git a/sys/arch/hp300/dev/gboxreg.h b/sys/arch/hp300/dev/gboxreg.h
deleted file mode 100644
index 64597b6cc85..00000000000
--- a/sys/arch/hp300/dev/gboxreg.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $OpenBSD: gboxreg.h,v 1.2 2005/01/24 21:36:39 miod Exp $ */
-/* $NetBSD: grf_gbreg.h,v 1.4 1994/10/26 07:23:53 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_gbreg.h 1.11 92/01/21$
- *
- * @(#)grf_gbreg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Gatorbox driver regs
- */
-
-#define TILER_ENABLE 0x80
-#define LINE_MOVER_ENABLE 0x80
-#define UP_LEFT 0x00
-#define DOWN_RIGHT 0x40
-#define MOVE_UP_LEFT (TILER_ENABLE | UP_LEFT)
-#define MOVE_DOWN_RIGHT (TILER_ENABLE | DOWN_RIGHT)
-
-#define tile_mover_waitbusy(regaddr) \
-do { \
- while (((struct gboxfb *)(regaddr))->regs.sec_interrupt & 0x10) \
- DELAY(1); \
-} while (0)
-
-#define line_mover_waitbusy(regaddr) \
-do { \
- while ((((struct gboxfb *)(regaddr))->status & 0x80) == 0) \
- DELAY(1); \
-} while (0)
-
-#define gbcm_waitbusy(regaddr) \
-do { \
- while (((struct gboxfb *)(regaddr))->cmap_busy != 0xff) \
- DELAY(1); \
-} while (0)
-
-struct gboxfb {
- struct diofbreg regs;
- u_int8_t f2[0x4000-0x5f-1];
- u_int8_t crtc_address; /* CTR controller address reg 0x4000 */
- u_int8_t status; /* Status register 0x4001 */
- u_int8_t crtc_data; /* CTR controller data reg 0x4002 */
- u_int8_t f3[6];
- u_int8_t line_mover_rep_rule; /* Line move rep rule */
- u_int8_t :8, :8;
- u_int8_t line_mover_width; /* Line move width */
- u_int8_t f4[0xff3];
- u_int8_t width; /* width in tiles 0x5001 */
- u_int8_t :8;
- u_int8_t height; /* height in tiles 0x5003 */
- u_int8_t f5[3];
- u_int8_t rep_rule; /* replacement rule 0x5007 */
- u_int8_t f6[0x6001-0x5007-1];
- u_int8_t blink1; /* blink 1 0x6001 */
- u_int8_t f7[3];
- u_int8_t blink2; /* blink 2 0x6005 */
- u_int8_t f8[3];
- u_int8_t write_protect; /* write protect 0x6009 */
- u_int8_t f9[0x6803-0x6009-1];
- u_int8_t cmap_busy; /* color map busy 0x6803 */
- u_int8_t f10[0x68b9-0x6803-1];
- u_int8_t creg_select; /* color map register select 0x68b8 */
- u_int8_t f11[0x68f1-0x68b9-1];
- u_int8_t cmap_write; /* color map write trigger 0x68f1 */
- u_int8_t f12[0x69b3-0x68f1-1];
- u_int8_t cmap_red; /* red value register 0x69b3 */
- u_int8_t :8;
- u_int8_t cmap_grn; /* green value register 0x69b5 */
- u_int8_t :8;
- u_int8_t cmap_blu; /* blue value register 0x69b6 */
-};
diff --git a/sys/arch/hp300/dev/hd.c b/sys/arch/hp300/dev/hd.c
deleted file mode 100644
index 4bfd3ef7848..00000000000
--- a/sys/arch/hp300/dev/hd.c
+++ /dev/null
@@ -1,1330 +0,0 @@
-/* $OpenBSD: hd.c,v 1.75 2013/11/20 05:19:29 miod Exp $ */
-/* $NetBSD: rd.c,v 1.33 1997/07/10 18:14:08 kleink Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: rd.c 1.44 92/12/26$
- *
- * @(#)rd.c 8.2 (Berkeley) 5/19/94
- */
-
-/*
- * CS80/SS80 disk driver
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/disk.h>
-#include <sys/disklabel.h>
-#include <sys/fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-#include <sys/stat.h>
-#include <sys/syslog.h>
-#include <sys/dkio.h>
-
-#include <ufs/ffs/fs.h> /* for BBSIZE and SBSIZE */
-
-#include <hp300/dev/hpibvar.h>
-
-#include <hp300/dev/hdreg.h>
-#include <hp300/dev/hdvar.h>
-
-#ifdef USELEDS
-#include <hp300/hp300/leds.h>
-#endif
-
-#ifndef HDRETRY
-#define HDRETRY 5
-#endif
-
-#ifndef HDWAITC
-#define HDWAITC 1 /* min time for timeout in seconds */
-#endif
-
-int hderrthresh = HDRETRY - 1; /* when to start reporting errors */
-
-#ifdef DEBUG
-/* error message tables */
-const char *err_reject[16] = {
- NULL,
- NULL,
- "channel parity error", /* 0x2000 */
- NULL,
- NULL,
- "illegal opcode", /* 0x0400 */
- "module addressing", /* 0x0200 */
- "address bounds", /* 0x0100 */
- "parameter bounds", /* 0x0080 */
- "illegal parameter", /* 0x0040 */
- "message sequence", /* 0x0020 */
- NULL,
- "message length", /* 0x0008 */
- NULL,
- NULL,
- NULL
-};
-
-const char *err_fault[16] = {
- NULL,
- "cross unit", /* 0x4000 */
- NULL,
- "controller fault", /* 0x1000 */
- NULL,
- NULL,
- "unit fault", /* 0x0200 */
- NULL,
- "diagnostic result", /* 0x0080 */
- NULL,
- "operator release request", /* 0x0020 */
- "diagnostic release request", /* 0x0010 */
- "internal maintenance release request", /* 0x0008 */
- NULL,
- "power fail", /* 0x0002 */
- "retransmit" /* 0x0001 */
-};
-
-const char *err_access[16] = {
- "illegal parallel operation", /* 0x8000 */
- "uninitialized media", /* 0x4000 */
- "no spares available", /* 0x2000 */
- "not ready", /* 0x1000 */
- "write protect", /* 0x0800 */
- "no data found", /* 0x0400 */
- NULL,
- NULL,
- "unrecoverable data overflow", /* 0x0080 */
- "unrecoverable data", /* 0x0040 */
- NULL,
- "end of file", /* 0x0010 */
- "end of volume", /* 0x0008 */
- NULL,
- NULL,
- NULL
-};
-
-const char *err_info[16] = {
- "operator release request", /* 0x8000 */
- "diagnostic release request", /* 0x4000 */
- "internal maintenance release request", /* 0x2000 */
- "media wear", /* 0x1000 */
- "latency induced", /* 0x0800 */
- NULL,
- NULL,
- "auto sparing invoked", /* 0x0100 */
- NULL,
- "recoverable data overflow", /* 0x0040 */
- "marginal data", /* 0x0020 */
- "recoverable data", /* 0x0010 */
- NULL,
- "maintenance track overflow", /* 0x0004 */
- NULL,
- NULL
-};
-
-#define HDB_FOLLOW 0x01
-#define HDB_STATUS 0x02
-#define HDB_IDENT 0x04
-#define HDB_IO 0x08
-#define HDB_ASYNC 0x10
-#define HDB_ERROR 0x80
-int hddebug = HDB_ERROR | HDB_IDENT;
-#endif
-
-/*
- * Misc. HW description, indexed by sc_type.
- * Nothing really critical here, could do without it.
- */
-const struct hdidentinfo hdidentinfo[] = {
- { HD7946AID, 0, "7945A", NHD7945ABPT,
- NHD7945ATRK, 968, 108416 },
-
- { HD9134DID, 1, "9134D", NHD9134DBPT,
- NHD9134DTRK, 303, 29088 },
-
- { HD9134LID, 1, "9122S", NHD9122SBPT,
- NHD9122STRK, 77, 1232 },
-
- { HD7912PID, 0, "7912P", NHD7912PBPT,
- NHD7912PTRK, 572, 128128 },
-
- { HD7914PID, 0, "7914P", NHD7914PBPT,
- NHD7914PTRK, 1152, 258048 },
-
- { HD7958AID, 0, "7958A", NHD7958ABPT,
- NHD7958ATRK, 1013, 255276 },
-
- { HD7957AID, 0, "7957A", NHD7957ABPT,
- NHD7957ATRK, 1036, 159544 },
-
- { HD7933HID, 0, "7933H", NHD7933HBPT,
- NHD7933HTRK, 1321, 789958 },
-
- { HD9134LID, 1, "9134L", NHD9134LBPT,
- NHD9134LTRK, 973, 77840 },
-
- { HD7936HID, 0, "7936H", NHD7936HBPT,
- NHD7936HTRK, 698, 600978 },
-
- { HD7937HID, 0, "7937H", NHD7937HBPT,
- NHD7937HTRK, 698, 1116102 },
-
- { HD7914CTID, 0, "7914CT", NHD7914PBPT,
- NHD7914PTRK, 1152, 258048 },
-
- { HD7946AID, 0, "7946A", NHD7945ABPT,
- NHD7945ATRK, 968, 108416 },
-
- { HD9134LID, 1, "9122D", NHD9122SBPT,
- NHD9122STRK, 77, 1232 },
-
- { HD7957BID, 0, "7957B", NHD7957BBPT,
- NHD7957BTRK, 1269, 159894 },
-
- { HD7958BID, 0, "7958B", NHD7958BBPT,
- NHD7958BTRK, 786, 297108 },
-
- { HD7959BID, 0, "7959B", NHD7959BBPT,
- NHD7959BTRK, 1572, 594216 },
-
- { HD2200AID, 0, "2200A", NHD2200ABPT,
- NHD2200ATRK, 1449, 654948 },
-
- { HD2203AID, 0, "2203A", NHD2203ABPT,
- NHD2203ATRK, 1449, 1309896 }
-};
-const int numhdidentinfo = sizeof(hdidentinfo) / sizeof(hdidentinfo[0]);
-
-bdev_decl(hd);
-cdev_decl(hd);
-
-int hdident(struct device *, struct hd_softc *,
- struct hpibbus_attach_args *);
-void hdreset(int, int, int);
-void hdustart(struct hd_softc *);
-int hdgetdisklabel(dev_t, struct hd_softc *, struct disklabel *, int);
-void hdrestart(void *);
-struct buf *hdfinish(struct hd_softc *, struct buf *);
-
-void hdstart(void *);
-void hdinterrupt(void *);
-void hdgo(void *);
-int hdstatus(struct hd_softc *);
-int hderror(int);
-#ifdef DEBUG
-void hdprinterr(const char *, short, const char **);
-#endif
-
-int hdmatch(struct device *, void *, void *);
-void hdattach(struct device *, struct device *, void *);
-
-struct cfattach hd_ca = {
- sizeof(struct hd_softc), hdmatch, hdattach
-};
-
-struct cfdriver hd_cd = {
- NULL, "hd", DV_DISK
-};
-
-#define hdlookup(unit) (struct hd_softc *)device_lookup(&hd_cd, (unit))
-
-int
-hdmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct hpibbus_attach_args *ha = aux;
-
- return (hdident(parent, NULL, ha));
-}
-
-void
-hdattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct hd_softc *sc = (struct hd_softc *)self;
- struct hpibbus_attach_args *ha = aux;
-
- if (hdident(parent, sc, ha) == 0) {
- printf("\n%s: didn't respond to describe command!\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- /*
- * Initialize and attach the disk structure.
- */
- sc->sc_dkdev.dk_name = sc->sc_dev.dv_xname;
- disk_attach(&sc->sc_dev, &sc->sc_dkdev);
- bufq_init(&sc->sc_bufq, BUFQ_DEFAULT);
-
- sc->sc_slave = ha->ha_slave;
- sc->sc_punit = ha->ha_punit;
-
- /* Initialize the hpib job queue entry */
- sc->sc_hq.hq_softc = sc;
- sc->sc_hq.hq_slave = sc->sc_slave;
- sc->sc_hq.hq_start = hdstart;
- sc->sc_hq.hq_go = hdgo;
- sc->sc_hq.hq_intr = hdinterrupt;
-
-#ifdef DEBUG
- /* always report errors */
- if (hddebug & HDB_ERROR)
- hderrthresh = 0;
-#endif
-
- /* Initialize timeout structure */
- timeout_set(&sc->sc_timeout, hdrestart, sc);
-}
-
-int
-hdident(parent, sc, ha)
- struct device *parent;
- struct hd_softc *sc;
- struct hpibbus_attach_args *ha;
-{
- struct cs80_describe desc;
- u_char stat, cmd[3];
- char name[7];
- int i, id, n, ctlr, slave;
-
- ctlr = parent->dv_unit;
- slave = ha->ha_slave;
-
- /* Verify that we have a CS80 device. */
- if ((ha->ha_id & 0x200) == 0)
- return (0);
-
- /* Is it one of the disks we support? */
- for (id = 0; id < numhdidentinfo; id++)
- if (ha->ha_id == hdidentinfo[id].ri_hwid &&
- ha->ha_punit <= hdidentinfo[id].ri_maxunum)
- break;
- if (id == numhdidentinfo)
- return (0);
-
- /*
- * Reset device and collect description
- */
- bzero(&desc, sizeof(desc));
- stat = 0;
- hdreset(ctlr, slave, ha->ha_punit);
- cmd[0] = C_SUNIT(ha->ha_punit);
- cmd[1] = C_SVOL(0);
- cmd[2] = C_DESC;
- hpibsend(ctlr, slave, C_CMD, cmd, sizeof(cmd));
- hpibrecv(ctlr, slave, C_EXEC, &desc, sizeof(desc));
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-
- if (desc.d_name == 0 && stat != 0)
- return (0);
-
- /*
- * If we're just probing for the device, that's all the
- * work we need to do.
- */
- if (sc == NULL)
- return (1);
-
- bzero(name, sizeof(name));
- n = desc.d_name;
- for (i = 5; i >= 0; i--) {
- name[i] = (n & 0xf) + '0';
- n >>= 4;
- }
-
-#ifdef DEBUG
- if (hddebug & HDB_IDENT) {
- printf(": stat %d name: %x ('%s')\n", stat, desc.d_name, name);
- printf(" iuw %x, maxxfr %d, ctype %d\n",
- desc.d_iuw, desc.d_cmaxxfr, desc.d_ctype);
- printf(" utype %d, bps %d, blkbuf %d, burst %d, blktime %d\n",
- desc.d_utype, desc.d_sectsize,
- desc.d_blkbuf, desc.d_burstsize, desc.d_blocktime);
- printf(" avxfr %d, ort %d, atp %d, maxint %d, fv %x, rv %x\n",
- desc.d_uavexfr, desc.d_retry, desc.d_access,
- desc.d_maxint, desc.d_fvbyte, desc.d_rvbyte);
- printf(" maxcyl/head/sect %d/%d/%d, maxvsect %d, inter %d\n",
- desc.d_maxcyl, desc.d_maxhead, desc.d_maxsect,
- desc.d_maxvsectl, desc.d_interleave);
- printf("%s:", sc->sc_dev.dv_xname);
- }
-#endif
-
- /*
- * Take care of a couple of anomalies:
- * 1. 7945A and 7946A both return same HW id
- * 2. 9122S and 9134D both return same HW id
- * 3. 9122D and 9134L both return same HW id
- */
- switch (ha->ha_id) {
- case HD7946AID:
- if (bcmp(name, "079450", 6) == 0)
- id = HD7945A;
- else
- id = HD7946A;
- break;
-
- case HD9134LID:
- if (bcmp(name, "091340", 6) == 0)
- id = HD9134L;
- else
- id = HD9122D;
- break;
-
- case HD9134DID:
- if (bcmp(name, "091220", 6) == 0)
- id = HD9122S;
- else
- id = HD9134D;
- break;
- }
-
- sc->sc_type = id;
-
- /*
- * XXX We use DEV_BSIZE instead of the sector size value pulled
- * XXX off the driver because all of this code assumes 512 byte
- * XXX blocks. ICK!
- */
- printf(": %s\n", hdidentinfo[id].ri_desc);
- printf("%s: %luMB, %lu cyl, %lu head, %lu sec, %lu bytes/sec, %lu sec total\n",
- sc->sc_dev.dv_xname,
- hdidentinfo[id].ri_nblocks / (1048576 / DEV_BSIZE),
- hdidentinfo[id].ri_ncyl, hdidentinfo[id].ri_ntpc,
- hdidentinfo[id].ri_nbpt, DEV_BSIZE, hdidentinfo[id].ri_nblocks);
-
- return (1);
-}
-
-void
-hdreset(ctlr, slave, punit)
- int ctlr, slave, punit;
-{
- struct hd_ssmcmd ssmc;
- struct hd_srcmd src;
- struct hd_clearcmd clear;
- u_char stat;
-
- bzero(&clear, sizeof(clear));
- clear.c_unit = C_SUNIT(punit);
- clear.c_cmd = C_CLEAR;
- hpibsend(ctlr, slave, C_TCMD, &clear, sizeof(clear));
- hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-
- bzero(&src, sizeof(src));
- src.c_unit = C_SUNIT(HDCTLR);
- src.c_nop = C_NOP;
- src.c_cmd = C_SREL;
- src.c_param = C_REL;
- hpibsend(ctlr, slave, C_CMD, &src, sizeof(src));
- hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-
- bzero(&ssmc, sizeof(ssmc));
- ssmc.c_unit = C_SUNIT(punit);
- ssmc.c_cmd = C_SSM;
- ssmc.c_refm = REF_MASK;
- ssmc.c_fefm = FEF_MASK;
- ssmc.c_aefm = AEF_MASK;
- ssmc.c_iefm = IEF_MASK;
- hpibsend(ctlr, slave, C_CMD, &ssmc, sizeof(ssmc));
- hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-}
-
-/*
- * Read or construct a disklabel
- */
-int
-hdgetdisklabel(dev, rs, lp, spoofonly)
- dev_t dev;
- struct hd_softc *rs;
- struct disklabel *lp;
- int spoofonly;
-{
- bzero(lp, sizeof(struct disklabel));
-
- /*
- * Create a default disk label based on geometry.
- * This will get overridden if there is a real label on the disk.
- */
- lp->d_secsize = DEV_BSIZE;
- lp->d_ntracks = hdidentinfo[rs->sc_type].ri_ntpc;
- lp->d_nsectors = hdidentinfo[rs->sc_type].ri_nbpt;
- lp->d_ncylinders = hdidentinfo[rs->sc_type].ri_ncyl;
- lp->d_secpercyl = lp->d_nsectors * lp->d_ntracks;
- if (lp->d_secpercyl == 0) {
- lp->d_secpercyl = 100;
- /* as long as it's not 0 - readdisklabel divides by it */
- }
-
- lp->d_type = DTYPE_HPIB;
- strncpy(lp->d_typename, hdidentinfo[rs->sc_type].ri_desc,
- sizeof(lp->d_typename));
- strncpy(lp->d_packname, "fictitious", sizeof lp->d_packname);
-
- DL_SETDSIZE(lp, hdidentinfo[rs->sc_type].ri_nblocks);
- lp->d_flags = 0;
- lp->d_version = 1;
-
- /* XXX - these values for BBSIZE and SBSIZE assume ffs */
- lp->d_bbsize = BBSIZE;
- lp->d_sbsize = SBSIZE;
-
- lp->d_magic = DISKMAGIC;
- lp->d_magic2 = DISKMAGIC;
- lp->d_checksum = dkcksum(lp);
-
- /*
- * Now try to read the disklabel
- */
- return readdisklabel(DISKLABELDEV(dev), hdstrategy, lp, spoofonly);
-}
-
-int
-hdopen(dev, flags, mode, p)
- dev_t dev;
- int flags, mode;
- struct proc *p;
-{
- int unit = DISKUNIT(dev);
- struct hd_softc *rs;
- int mask, part;
- int error;
-
- rs = hdlookup(unit);
- if (rs == NULL)
- return (ENXIO);
-
- /*
- * Fail open if we tried to attach but the disk did not answer.
- */
- if (!ISSET(rs->sc_dkdev.dk_flags, DKF_CONSTRUCTED)) {
- device_unref(&rs->sc_dev);
- return (ENXIO);
- }
-
- if ((error = disk_lock(&rs->sc_dkdev)) != 0) {
- device_unref(&rs->sc_dev);
- return (error);
- }
-
- /*
- * On first open, get label and partition info.
- * We may block reading the label, so be careful
- * to stop any other opens.
- */
- if (rs->sc_dkdev.dk_openmask == 0) {
- rs->sc_flags |= HDF_OPENING;
- error = hdgetdisklabel(dev, rs, rs->sc_dkdev.dk_label, 0);
- rs->sc_flags &= ~HDF_OPENING;
- if (error == EIO)
- goto out;
- }
-
- part = DISKPART(dev);
- mask = 1 << part;
-
- /* Check that the partition exists. */
- if (part != RAW_PART &&
- (part > rs->sc_dkdev.dk_label->d_npartitions ||
- rs->sc_dkdev.dk_label->d_partitions[part].p_fstype == FS_UNUSED)) {
- error = ENXIO;
- goto out;
- }
-
- /* Ensure only one open at a time. */
- switch (mode) {
- case S_IFCHR:
- rs->sc_dkdev.dk_copenmask |= mask;
- break;
- case S_IFBLK:
- rs->sc_dkdev.dk_bopenmask |= mask;
- break;
- }
- rs->sc_dkdev.dk_openmask =
- rs->sc_dkdev.dk_copenmask | rs->sc_dkdev.dk_bopenmask;
-
- error = 0;
-out:
- disk_unlock(&rs->sc_dkdev);
- device_unref(&rs->sc_dev);
- return (error);
-}
-
-int
-hdclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int unit = DISKUNIT(dev);
- struct hd_softc *rs;
- struct disk *dk;
- int mask, s;
-
- rs = hdlookup(unit);
- if (rs == NULL)
- return (ENXIO);
-
- disk_lock_nointr(&rs->sc_dkdev);
-
- mask = 1 << DISKPART(dev);
- dk = &rs->sc_dkdev;
- switch (mode) {
- case S_IFCHR:
- dk->dk_copenmask &= ~mask;
- break;
- case S_IFBLK:
- dk->dk_bopenmask &= ~mask;
- break;
- }
- dk->dk_openmask = dk->dk_copenmask | dk->dk_bopenmask;
-
- /*
- * On last close, we wait for all activity to cease since
- * the label/parition info will become invalid.
- * Note we don't have to about other closes since we know
- * we are the last one.
- */
- if (dk->dk_openmask == 0) {
- rs->sc_flags |= HDF_CLOSING;
- s = splbio();
- while (rs->sc_bp == NULL) {
- rs->sc_flags |= HDF_WANTED;
- tsleep((caddr_t)&rs->sc_bp, PRIBIO, "hdclose", 0);
- }
- splx(s);
- rs->sc_flags &= ~(HDF_CLOSING);
- }
-
- disk_unlock(&rs->sc_dkdev);
- device_unref(&rs->sc_dev);
- return (0);
-}
-
-void
-hdstrategy(bp)
- struct buf *bp;
-{
- int unit = DISKUNIT(bp->b_dev);
- struct hd_softc *rs;
- int s;
-
- rs = hdlookup(unit);
- if (rs == NULL) {
- bp->b_error = ENXIO;
- goto bad;
- }
-
-#ifdef DEBUG
- if (hddebug & HDB_FOLLOW)
- printf("hdstrategy(%x): dev %x, bn %x, bcount %lx, %c\n",
- bp, bp->b_dev, bp->b_blkno, bp->b_bcount,
- (bp->b_flags & B_READ) ? 'R' : 'W');
-#endif
-
- /* Validate the request. */
- if (bounds_check_with_label(bp, rs->sc_dkdev.dk_label) == -1)
- goto done;
-
- bufq_queue(&rs->sc_bufq, bp);
-
- s = splbio();
- if (rs->sc_bp == NULL) {
- rs->sc_bp = bufq_dequeue(&rs->sc_bufq);
- hdustart(rs);
- }
- splx(s);
-
- device_unref(&rs->sc_dev);
- return;
-
- bad:
- bp->b_flags |= B_ERROR;
- bp->b_resid = bp->b_bcount;
- done:
- s = splbio();
- biodone(bp);
- splx(s);
- if (rs != NULL)
- device_unref(&rs->sc_dev);
-}
-
-/*
- * Called via timeout(9) when handling maintenance releases
- */
-void
-hdrestart(arg)
- void *arg;
-{
- int s = splbio();
- hdustart((struct hd_softc *)arg);
- splx(s);
-}
-
-void
-hdustart(rs)
- struct hd_softc *rs;
-{
- struct buf *bp;
-
- bp = rs->sc_bp;
- rs->sc_addr = bp->b_data;
- rs->sc_resid = bp->b_bcount;
- if (hpibreq(rs->sc_dev.dv_parent, &rs->sc_hq))
- hdstart(rs);
-}
-
-struct buf *
-hdfinish(rs, bp)
- struct hd_softc *rs;
- struct buf *bp;
-{
- int s;
-
- rs->sc_errcnt = 0;
- bp->b_resid = 0;
- s = splbio();
- biodone(bp);
- splx(s);
-
- hpibfree(rs->sc_dev.dv_parent, &rs->sc_hq);
- rs->sc_bp = bufq_dequeue(&rs->sc_bufq);
-
- if (rs->sc_bp == NULL && rs->sc_flags & HDF_WANTED) {
- rs->sc_flags &= ~HDF_WANTED;
- wakeup((caddr_t)&rs->sc_bp);
- }
-
- return (rs->sc_bp);
-}
-
-void
-hdstart(arg)
- void *arg;
-{
- struct hd_softc *rs = arg;
- struct disklabel *lp;
- struct buf *bp = rs->sc_bp;
- int ctlr, slave;
- daddr_t bn;
-
- ctlr = rs->sc_dev.dv_parent->dv_unit;
- slave = rs->sc_slave;
-
-again:
-#ifdef DEBUG
- if (hddebug & HDB_FOLLOW)
- printf("hdstart(%s): bp %p, %c\n", rs->sc_dev.dv_xname, bp,
- (bp->b_flags & B_READ) ? 'R' : 'W');
-#endif
- lp = rs->sc_dkdev.dk_label;
- bn = bp->b_blkno +
- DL_GETPOFFSET(&lp->d_partitions[DISKPART(bp->b_dev)]);
-
- rs->sc_flags |= HDF_SEEK;
- rs->sc_ioc.c_unit = C_SUNIT(rs->sc_punit);
- rs->sc_ioc.c_volume = C_SVOL(0);
- rs->sc_ioc.c_saddr = C_SADDR;
- rs->sc_ioc.c_hiaddr = 0;
- rs->sc_ioc.c_addr = HDBTOS(bn);
- rs->sc_ioc.c_nop2 = C_NOP;
- rs->sc_ioc.c_slen = C_SLEN;
- rs->sc_ioc.c_len = rs->sc_resid;
- rs->sc_ioc.c_cmd = bp->b_flags & B_READ ? C_READ : C_WRITE;
-#ifdef DEBUG
- if (hddebug & HDB_IO)
- printf("hdstart: hpibsend(%x, %x, %x, %p, %x)\n",
- ctlr, slave, C_CMD,
- &rs->sc_ioc.c_unit, sizeof(rs->sc_ioc)-2);
-#endif
- if (hpibsend(ctlr, slave, C_CMD, &rs->sc_ioc.c_unit,
- sizeof(rs->sc_ioc)-2) == sizeof(rs->sc_ioc)-2) {
-
- /* Instrumentation. */
- disk_busy(&rs->sc_dkdev);
- rs->sc_dkdev.dk_seek++;
-
-#ifdef DEBUG
- if (hddebug & HDB_IO)
- printf("hdstart: hpibawait(%x)\n", ctlr);
-#endif
- hpibawait(ctlr);
- return;
- }
- /*
- * Experience has shown that the hpibwait in this hpibsend will
- * occasionally timeout. It appears to occur mostly on old 7914
- * drives with full maintenance tracks. We should probably
- * integrate this with the backoff code in hderror.
- */
-#ifdef DEBUG
- if (hddebug & HDB_ERROR)
- printf("%s: hdstart: cmd %x adr %lx blk %d len %d ecnt %ld\n",
- rs->sc_dev.dv_xname, rs->sc_ioc.c_cmd, rs->sc_ioc.c_addr,
- bp->b_blkno, rs->sc_resid, rs->sc_errcnt);
- rs->sc_stats.hdretries++;
-#endif
- rs->sc_flags &= ~HDF_SEEK;
- hdreset(rs->sc_dev.dv_parent->dv_unit, rs->sc_slave, rs->sc_punit);
- if (rs->sc_errcnt++ < HDRETRY)
- goto again;
- printf("%s: hdstart err: err: cmd 0x%x sect %ld blk %d len %d\n",
- rs->sc_dev.dv_xname, rs->sc_ioc.c_cmd, rs->sc_ioc.c_addr,
- bp->b_blkno, rs->sc_resid);
- bp->b_flags |= B_ERROR;
- bp->b_error = EIO;
- bp = hdfinish(rs, bp);
- if (bp) {
- rs->sc_addr = bp->b_data;
- rs->sc_resid = bp->b_bcount;
- if (hpibreq(rs->sc_dev.dv_parent, &rs->sc_hq))
- goto again;
- }
-}
-
-void
-hdgo(arg)
- void *arg;
-{
- struct hd_softc *rs = arg;
- struct buf *bp = rs->sc_bp;
- int rw, ctlr, slave;
-
- ctlr = rs->sc_dev.dv_parent->dv_unit;
- slave = rs->sc_slave;
-
- rw = bp->b_flags & B_READ;
-
- /* Instrumentation. */
- disk_busy(&rs->sc_dkdev);
-
-#ifdef USELEDS
- ledcontrol(0, 0, LED_DISK);
-#endif
- hpibgo(ctlr, slave, C_EXEC, rs->sc_addr, rs->sc_resid, rw, rw != 0);
-}
-
-/* ARGSUSED */
-void
-hdinterrupt(arg)
- void *arg;
-{
- struct hd_softc *rs = arg;
- int unit = rs->sc_dev.dv_unit;
- struct buf *bp = rs->sc_bp;
- u_char stat = 13; /* in case hpibrecv fails */
- int rv, restart, ctlr, slave;
-
- ctlr = rs->sc_dev.dv_parent->dv_unit;
- slave = rs->sc_slave;
-
-#ifdef DEBUG
- if (hddebug & HDB_FOLLOW)
- printf("hdinterrupt(%d): bp %p, %c, flags %x\n", unit, bp,
- (bp->b_flags & B_READ) ? 'R' : 'W', rs->sc_flags);
- if (bp == NULL) {
- printf("%s: bp == NULL\n", rs->sc_dev.dv_xname);
- return;
- }
-#endif
- disk_unbusy(&rs->sc_dkdev, (bp->b_bcount - bp->b_resid),
- (bp->b_flags & B_READ));
-
- if (rs->sc_flags & HDF_SEEK) {
- rs->sc_flags &= ~HDF_SEEK;
- if (hpibustart(ctlr))
- hdgo(rs);
- return;
- }
- if ((rs->sc_flags & HDF_SWAIT) == 0) {
-#ifdef DEBUG
- rs->sc_stats.hdpolltries++;
-#endif
- if (hpibpptest(ctlr, slave) == 0) {
-#ifdef DEBUG
- rs->sc_stats.hdpollwaits++;
-#endif
-
- /* Instrumentation. */
- disk_busy(&rs->sc_dkdev);
- rs->sc_flags |= HDF_SWAIT;
- hpibawait(ctlr);
- return;
- }
- } else
- rs->sc_flags &= ~HDF_SWAIT;
- rv = hpibrecv(ctlr, slave, C_QSTAT, &stat, 1);
- if (rv != 1 || stat) {
-#ifdef DEBUG
- if (hddebug & HDB_ERROR)
- printf("hdinterrupt: recv failed or bad stat %d\n", stat);
-#endif
- restart = hderror(unit);
-#ifdef DEBUG
- rs->sc_stats.hdretries++;
-#endif
- if (rs->sc_errcnt++ < HDRETRY) {
- if (restart)
- hdstart(rs);
- return;
- }
- bp->b_flags |= B_ERROR;
- bp->b_error = EIO;
- }
- if (hdfinish(rs, bp))
- hdustart(rs);
-}
-
-int
-hdstatus(rs)
- struct hd_softc *rs;
-{
- int c, s;
- u_char stat;
- int rv;
-
- c = rs->sc_dev.dv_parent->dv_unit;
- s = rs->sc_slave;
- rs->sc_rsc.c_unit = C_SUNIT(rs->sc_punit);
- rs->sc_rsc.c_sram = C_SRAM;
- rs->sc_rsc.c_ram = C_RAM;
- rs->sc_rsc.c_cmd = C_STATUS;
- bzero((caddr_t)&rs->sc_stat, sizeof(rs->sc_stat));
- rv = hpibsend(c, s, C_CMD, &rs->sc_rsc, sizeof(rs->sc_rsc));
- if (rv != sizeof(rs->sc_rsc)) {
-#ifdef DEBUG
- if (hddebug & HDB_STATUS)
- printf("hdstatus: send C_CMD failed %d != %d\n",
- rv, sizeof(rs->sc_rsc));
-#endif
- return(1);
- }
- rv = hpibrecv(c, s, C_EXEC, &rs->sc_stat, sizeof(rs->sc_stat));
- if (rv != sizeof(rs->sc_stat)) {
-#ifdef DEBUG
- if (hddebug & HDB_STATUS)
- printf("hdstatus: send C_EXEC failed %d != %d\n",
- rv, sizeof(rs->sc_stat));
-#endif
- return(1);
- }
- rv = hpibrecv(c, s, C_QSTAT, &stat, 1);
- if (rv != 1 || stat) {
-#ifdef DEBUG
- if (hddebug & HDB_STATUS)
- printf("hdstatus: recv failed %d or bad stat %d\n",
- rv, stat);
-#endif
- return(1);
- }
- return(0);
-}
-
-/*
- * Deal with errors.
- * Returns 1 if request should be restarted,
- * 0 if we should just quietly give up.
- */
-int
-hderror(unit)
- int unit;
-{
- struct hd_softc *rs = hd_cd.cd_devs[unit];
- struct hd_stat *sp;
- struct buf *bp;
- daddr_t hwbn, pbn;
-
- if (hdstatus(rs)) {
-#ifdef DEBUG
- printf("%s: couldn't get status\n", rs->sc_dev.dv_xname);
-#endif
- hdreset(rs->sc_dev.dv_parent->dv_unit,
- rs->sc_slave, rs->sc_punit);
- return(1);
- }
- sp = &rs->sc_stat;
- if (sp->c_fef & FEF_REXMT)
- return(1);
- if (sp->c_fef & FEF_PF) {
- hdreset(rs->sc_dev.dv_parent->dv_unit,
- rs->sc_slave, rs->sc_punit);
- return(1);
- }
- /*
- * Unit requests release for internal maintenance.
- * We just delay a while and try again later. Use exponentially
- * increasing backoff a la ethernet drivers since we don't really
- * know how long the maintenance will take. With HDWAITC and
- * HDRETRY as defined, the range is 1 to 32 seconds.
- */
- if (sp->c_fef & FEF_IMR) {
- int hdtimo = HDWAITC << rs->sc_errcnt;
-#ifdef DEBUG
- printf("%s: internal maintenance, %d second timeout\n",
- rs->sc_dev.dv_xname, hdtimo);
- rs->sc_stats.hdtimeouts++;
-#endif
- hpibfree(rs->sc_dev.dv_parent, &rs->sc_hq);
- timeout_add_sec(&rs->sc_timeout, hdtimo);
- return(0);
- }
- /*
- * Only report error if we have reached the error reporting
- * threshold. By default, this will only report after the
- * retry limit has been exceeded.
- */
- if (rs->sc_errcnt < hderrthresh)
- return(1);
-
- /*
- * First conjure up the block number at which the error occurred.
- * Note that not all errors report a block number, in that case
- * we just use b_blkno.
- */
- bp = rs->sc_bp;
- pbn = DL_GETPOFFSET(&rs->sc_dkdev.dk_label->d_partitions[DISKPART(bp->b_dev)]);
- if ((sp->c_fef & FEF_CU) || (sp->c_fef & FEF_DR) ||
- (sp->c_ief & IEF_RRMASK)) {
- hwbn = HDBTOS(pbn + bp->b_blkno);
- pbn = bp->b_blkno;
- } else {
- hwbn = sp->c_blk;
- pbn = HDSTOB(hwbn) - pbn;
- }
-
- diskerr(bp, hd_cd.cd_name, "hard error", LOG_PRINTF,
- pbn - bp->b_blkno, rs->sc_dkdev.dk_label);
- printf("\n%s%c: ", rs->sc_dev.dv_xname, 'a' + DISKPART(bp->b_dev));
-
-#ifdef DEBUG
- if (hddebug & HDB_ERROR) {
- /* status info */
- printf("volume: %d, unit: %d\n",
- (sp->c_vu>>4)&0xF, sp->c_vu&0xF);
- hdprinterr("reject", sp->c_ref, err_reject);
- hdprinterr("fault", sp->c_fef, err_fault);
- hdprinterr("access", sp->c_aef, err_access);
- hdprinterr("info", sp->c_ief, err_info);
- printf(" block: %lld, P1-P10: ", (long long)hwbn);
- printf("0x%04x", *(u_int *)&sp->c_raw[0]);
- printf("%04x", *(u_int *)&sp->c_raw[4]);
- printf("%02x\n", *(u_short *)&sp->c_raw[8]);
- /* command */
- printf(" ioc: ");
- printf("0x%x", *(u_int *)&rs->sc_ioc.c_pad);
- printf("0x%x", *(u_short *)&rs->sc_ioc.c_hiaddr);
- printf("0x%x", *(u_int *)&rs->sc_ioc.c_addr);
- printf("0x%x", *(u_short *)&rs->sc_ioc.c_nop2);
- printf("0x%x", *(u_int *)&rs->sc_ioc.c_len);
- printf("0x%x\n", *(u_short *)&rs->sc_ioc.c_cmd);
- } else
-#endif
- {
- printf("v%d u%d, R0x%x F0x%x A0x%x I0x%x",
- (sp->c_vu>>4)&0xF, sp->c_vu&0xF,
- sp->c_ref, sp->c_fef, sp->c_aef, sp->c_ief);
- printf(" P1-P10: 0x%04x%04x%02x\n",
- *(u_int *)&sp->c_raw[0], *(u_int *)&sp->c_raw[4],
- *(u_short *)&sp->c_raw[8]);
- }
- return (1);
-}
-
-int
-hdread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
-
- return (physio(hdstrategy, dev, B_READ, minphys, uio));
-}
-
-int
-hdwrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
-
- return (physio(hdstrategy, dev, B_WRITE, minphys, uio));
-}
-
-int
-hdioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int unit = DISKUNIT(dev);
- struct disklabel *lp;
- struct hd_softc *sc;
- int error = 0;
-
- sc = hdlookup(unit);
- if (sc == NULL)
- return (ENXIO);
-
- switch (cmd) {
- case DIOCRLDINFO:
- lp = malloc(sizeof(*lp), M_TEMP, M_WAITOK);
- hdgetdisklabel(dev, sc, lp, 0);
- *(sc->sc_dkdev.dk_label) = *lp;
- free(lp, M_TEMP);
- return 0;
-
- case DIOCGPDINFO:
- hdgetdisklabel(dev, sc, (struct disklabel *)data, 1);
- goto exit;
-
- case DIOCGDINFO:
- *(struct disklabel *)data = *sc->sc_dkdev.dk_label;
- goto exit;
-
- case DIOCGPART:
- ((struct partinfo *)data)->disklab = sc->sc_dkdev.dk_label;
- ((struct partinfo *)data)->part =
- &sc->sc_dkdev.dk_label->d_partitions[DISKPART(dev)];
- goto exit;
-
- case DIOCWDINFO:
- case DIOCSDINFO:
- if ((flag & FWRITE) == 0) {
- error = EBADF;
- goto exit;
- }
-
- if ((error = disk_lock(&sc->sc_dkdev)) != 0)
- goto exit;
-
- error = setdisklabel(sc->sc_dkdev.dk_label,
- (struct disklabel *)data, /* sc->sc_dkdev.dk_openmask */ 0);
- if (error == 0) {
- if (cmd == DIOCWDINFO)
- error = writedisklabel(DISKLABELDEV(dev),
- hdstrategy, sc->sc_dkdev.dk_label);
- }
-
- disk_unlock(&sc->sc_dkdev);
- goto exit;
-
- default:
- error = EINVAL;
- break;
- }
-
-exit:
- device_unref(&sc->sc_dev);
- return (error);
-}
-
-daddr_t
-hdsize(dev)
- dev_t dev;
-{
- struct hd_softc *rs;
- int unit = DISKUNIT(dev);
- int part, omask;
- daddr_t size;
-
- rs = hdlookup(unit);
- if (rs == NULL)
- return (-1);
-
- part = DISKPART(dev);
- omask = rs->sc_dkdev.dk_openmask & (1 << part);
-
- /*
- * We get called very early on (via swapconf)
- * without the device being open so we may need
- * to handle it here.
- */
- if (omask == 0 && hdopen(dev, FREAD | FWRITE, S_IFBLK, NULL) != 0) {
- size = -1;
- goto out;
- }
-
- if (rs->sc_dkdev.dk_label->d_partitions[part].p_fstype != FS_SWAP)
- size = -1;
- else
- size = DL_GETPSIZE(&rs->sc_dkdev.dk_label->d_partitions[part]) *
- (rs->sc_dkdev.dk_label->d_secsize / DEV_BSIZE);
-
- if (hdclose(dev, FREAD | FWRITE, S_IFBLK, NULL) != 0)
- size = -1;
-
-out:
- device_unref(&rs->sc_dev);
- return (size);
-}
-
-#ifdef DEBUG
-void
-hdprinterr(str, err, tab)
- const char *str;
- short err;
- const char **tab;
-{
- int i;
- int printed;
-
- if (err == 0)
- return;
- printf(" %s error %d field:", str, err);
- printed = 0;
- for (i = 0; i < 16; i++)
- if (err & (0x8000 >> i))
- printf("%s%s", printed++ ? " + " : " ", tab[i]);
- printf("\n");
-}
-#endif
-
-static int hddoingadump; /* simple mutex */
-
-/*
- * Non-interrupt driven, non-dma dump routine.
- */
-int
-hddump(dev, blkno, va, size)
- dev_t dev;
- daddr_t blkno;
- caddr_t va;
- size_t size;
-{
- int sectorsize; /* size of a disk sector */
- daddr_t nsects; /* number of sectors in partition */
- daddr_t sectoff; /* sector offset of partition */
- int totwrt; /* total number of sectors left to write */
- int nwrt; /* current number of sectors to write */
- int unit, part;
- int ctlr, slave;
- struct hd_softc *rs;
- struct disklabel *lp;
- char stat;
-
- /* Check for recursive dump; if so, punt. */
- if (hddoingadump)
- return (EFAULT);
- hddoingadump = 1;
-
- /* Decompose unit and partition. */
- unit = DISKUNIT(dev);
- part = DISKPART(dev);
-
- /* Make sure dump device is ok. */
- rs = hdlookup(unit);
- if (rs == NULL)
- return (ENXIO);
- device_unref(&rs->sc_dev);
-
- ctlr = rs->sc_dev.dv_parent->dv_unit;
- slave = rs->sc_slave;
-
- /*
- * Convert to disk sectors. Request must be a multiple of size.
- */
- lp = rs->sc_dkdev.dk_label;
- sectorsize = lp->d_secsize;
- if ((size % sectorsize) != 0)
- return (EFAULT);
- totwrt = size / sectorsize;
- blkno = dbtob(blkno) / sectorsize; /* blkno in DEV_BSIZE units */
-
- nsects = DL_GETPSIZE(&lp->d_partitions[part]);
- sectoff = DL_GETPOFFSET(&lp->d_partitions[part]);
-
- /* Check transfer bounds against partition size. */
- if ((blkno < 0) || (blkno + totwrt) > nsects)
- return (EINVAL);
-
- /* Offset block number to start of partition. */
- blkno += sectoff;
-
- while (totwrt > 0) {
- nwrt = totwrt; /* XXX */
-#ifndef HD_DUMP_NOT_TRUSTED
- /*
- * Fill out and send HPIB command.
- */
- rs->sc_ioc.c_unit = C_SUNIT(rs->sc_punit);
- rs->sc_ioc.c_volume = C_SVOL(0);
- rs->sc_ioc.c_saddr = C_SADDR;
- rs->sc_ioc.c_hiaddr = 0;
- rs->sc_ioc.c_addr = HDBTOS(blkno);
- rs->sc_ioc.c_nop2 = C_NOP;
- rs->sc_ioc.c_slen = C_SLEN;
- rs->sc_ioc.c_len = nwrt * sectorsize;
- rs->sc_ioc.c_cmd = C_WRITE;
- hpibsend(ctlr, slave, C_CMD, &rs->sc_ioc.c_unit,
- sizeof(rs->sc_ioc)-2);
- if (hpibswait(ctlr, slave))
- return (EIO);
-
- /*
- * Send the data.
- */
- hpibsend(ctlr, slave, C_EXEC, va, nwrt * sectorsize);
- (void) hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, 1);
- if (stat)
- return (EIO);
-#else /* HD_DUMP_NOT_TRUSTED */
- /* Let's just talk about this first... */
- printf("%s: dump addr %p, blk %d\n", sc->sc_dev.dv_xname,
- va, blkno);
- delay(500 * 1000); /* half a second */
-#endif /* HD_DUMP_NOT_TRUSTED */
-
- /* update block count */
- totwrt -= nwrt;
- blkno += nwrt;
- va += sectorsize * nwrt;
- }
- hddoingadump = 0;
- return (0);
-}
diff --git a/sys/arch/hp300/dev/hdreg.h b/sys/arch/hp300/dev/hdreg.h
deleted file mode 100644
index 64c169f7b29..00000000000
--- a/sys/arch/hp300/dev/hdreg.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/* $OpenBSD: hdreg.h,v 1.7 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: rdreg.h,v 1.7 1996/02/09 18:00:37 scottr Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: rdreg.h 1.2 90/10/12$
- *
- * @(#)rdreg.h 8.1 (Berkeley) 6/10/93
- */
-
-struct hd_iocmd {
- char c_pad;
- char c_unit;
- char c_volume;
- char c_saddr;
- short c_hiaddr;
- long c_addr;
- char c_nop2;
- char c_slen;
- long c_len;
- char c_cmd;
- char c_pad2;
-} __packed;
-
-struct hd_rscmd {
- char c_unit;
- char c_sram;
- char c_ram;
- char c_cmd;
-} __packed;
-
-struct hd_stat {
- char c_vu;
- char c_pend;
- short c_ref;
- short c_fef;
- short c_aef;
- short c_ief;
- union {
- char cu_raw[10];
- struct {
- short cu_msw;
- long cu_lsl;
- } cu_sva;
- struct {
- long cu_cyhd;
- short cu_sect;
- } cu_tva;
- } c_pf;
-} __packed;
-#define c_raw c_pf.cu_raw
-#define c_blk c_pf.cu_sva.cu_lsl /* for now */
-#define c_tva c_pf.cu_tva
-
-struct hd_ssmcmd {
- char c_unit;
- char c_cmd;
- short c_refm;
- short c_fefm;
- short c_aefm;
- short c_iefm;
-} __packed;
-
-struct hd_srcmd {
- char c_unit;
- char c_nop;
- char c_cmd;
- char c_param;
-} __packed;
-
-struct hd_clearcmd {
- char c_unit;
- char c_cmd;
-} __packed;
-
-/* HW ids */
-#define HD7946AID 0x220 /* also 7945A */
-#define HD9134DID 0x221 /* also 9122S */
-#define HD9134LID 0x222 /* also 9122D */
-#define HD7912PID 0x209
-#define HD7914CTID 0x20A
-#define HD7914PID 0x20B
-#define HD7958AID 0x22B
-#define HD7957AID 0x22A
-#define HD7933HID 0x212
-#define HD7936HID 0x213 /* just guessing -- as of yet unknown */
-#define HD7937HID 0x214
-#define HD7957BID 0x22C /* another guess based on 7958B */
-#define HD7958BID 0x22D
-#define HD7959BID 0x22E /* another guess based on 7958B */
-#define HD2200AID 0x22F
-#define HD2203AID 0x230 /* yet another guess */
-
-/* SW ids -- indices into hdidentinfo, order is arbitrary */
-#define HD7945A 0
-#define HD9134D 1
-#define HD9122S 2
-#define HD7912P 3
-#define HD7914P 4
-#define HD7958A 5
-#define HD7957A 6
-#define HD7933H 7
-#define HD9134L 8
-#define HD7936H 9
-#define HD7937H 10
-#define HD7914CT 11
-#define HD7946A 12
-#define HD9122D 13
-#define HD7957B 14
-#define HD7958B 15
-#define HD7959B 16
-
-#define NHD7945ABPT 16
-#define NHD7945ATRK 7
-#define NHD9134DBPT 16
-#define NHD9134DTRK 6
-#define NHD9122SBPT 8
-#define NHD9122STRK 2
-#define NHD7912PBPT 32
-#define NHD7912PTRK 7
-#define NHD7914PBPT 32
-#define NHD7914PTRK 7
-#define NHD7933HBPT 46
-#define NHD7933HTRK 13
-#define NHD9134LBPT 16
-#define NHD9134LTRK 5
-
-/*
- * Several HP drives have an odd number of 256 byte sectors per track.
- * This makes it rather difficult to break them into 512 and 1024 byte blocks.
- * So...we just do like HPUX and don't bother to respect hardware track/head
- * boundaries -- we just mold the disk so that we use the entire capacity.
- * HPUX also sometimes doen't abide by cylinder boundaries, we attempt to
- * whenever possible.
- *
- * DISK REAL (256 BPS) HPUX (1024 BPS) BSD (512 BPS)
- * SPT x HD x CYL SPT x HD x CYL SPT x HD x CYL
- * ----- --------------- --------------- --------------
- * 7936: 123 x 7 x 1396 25 x 7 x 1716 123 x 7 x 698
- * 7937: 123 x 13 x 1396 25 x 16 x 1395 123 x 13 x 698
- *
- * 7957A: 63 x 5 x 1013 11 x 7 x 1036 22 x 7 x 1036
- * 7958A: 63 x 8 x 1013 21 x 6 x 1013 36 x 7 x 1013
- *
- * 7957B: 63 x 4 x 1269 9 x 7 x 1269 18 x 7 x 1269
- * 7958B: 63 x 6 x 1572 21 x 9 x 786 42 x 9 x 786
- * 7959B: 63 x 12 x 1572 21 x 9 x 1572 42 x 9 x 1572
- *
- * 2200A: 113 x 8 x 1449 113 x 2 x 1449 113 x 4 x 1449
- * 2203A: 113 x 16 x 1449 113 x 4 x 1449 113 x 8 x 1449
- */
-#define NHD7936HBPT 123
-#define NHD7936HTRK 7
-#define NHD7937HBPT 123
-#define NHD7937HTRK 13
-#define NHD7957ABPT 22
-#define NHD7957ATRK 7
-#define NHD7958ABPT 36
-#define NHD7958ATRK 7
-#define NHD7957BBPT 18
-#define NHD7957BTRK 7
-#define NHD7958BBPT 42
-#define NHD7958BTRK 9
-#define NHD7959BBPT 42
-#define NHD7959BTRK 9
-#define NHD2200ABPT 113
-#define NHD2200ATRK 4
-#define NHD2203ABPT 113
-#define NHD2203ATRK 8
-
-/* controller "unit" number */
-#define HDCTLR 15
-
-/* convert 512 byte count into DEV_BSIZE count */
-#define HDSZ(x) ((x) >> (DEV_BSHIFT-9))
-
-/* convert block number into sector number and back */
-#define HDBTOS(x) ((x) << (DEV_BSHIFT-8))
-#define HDSTOB(x) ((x) >> (DEV_BSHIFT-8))
-
-/* extract cyl/head/sect info from three-vector address */
-#define HDCYL(tva) ((u_long)(tva).cu_cyhd >> 8)
-#define HDHEAD(tva) ((tva).cu_cyhd & 0xFF)
-#define HDSECT(tva) ((tva).cu_sect)
-
-#define REF_MASK 0x0
-#define FEF_MASK 0x0
-#define AEF_MASK 0x0
-#define IEF_MASK 0xF970
-
-#define FEF_CU 0x4000 /* cross-unit */
-#define FEF_DR 0x0080 /* diagnostic result */
-#define FEF_IMR 0x0008 /* internal maintenance release */
-#define FEF_PF 0x0002 /* power fail */
-#define FEF_REXMT 0x0001 /* retransmit */
-#define AEF_UD 0x0040 /* unrecoverable data */
-#define IEF_RRMASK 0xe000 /* request release bits */
-#define IEF_MD 0x0020 /* marginal data */
-#define IEF_RD 0x0010 /* recoverable data */
-
-#define C_READ 0x00
-#define C_RAM 0x00 /* single vector (i.e. sector number) */
-#define C_WRITE 0x02
-#define C_CLEAR 0x08
-#define C_STATUS 0x0d
-#define C_SADDR 0x10
-#define C_SLEN 0x18
-#define C_SUNIT(x) (0x20 | (x))
-#define C_SVOL(x) (0x40 | (x))
-#define C_NOP 0x34
-#define C_DESC 0x35
-#define C_SREL 0x3b
-#define C_SSM 0x3e
-#define C_SRAM 0x48
-#define C_REL 0xc0
-
-#define C_CMD 0x05
-#define C_EXEC 0x0e
-#define C_QSTAT 0x10
-#define C_TCMD 0x12
diff --git a/sys/arch/hp300/dev/hdvar.h b/sys/arch/hp300/dev/hdvar.h
deleted file mode 100644
index 1add006a3c7..00000000000
--- a/sys/arch/hp300/dev/hdvar.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $OpenBSD: hdvar.h,v 1.12 2013/11/20 00:12:37 dlg Exp $ */
-/* $NetBSD: rdvar.h,v 1.6 1997/01/30 09:14:19 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: rdvar.h 1.1 92/12/21$
- *
- * @(#)rdvar.h 8.1 (Berkeley) 6/10/93
- */
-
-struct hdidentinfo {
- short ri_hwid; /* 2 byte HW id */
- short ri_maxunum; /* maximum allowed unit number */
- char *ri_desc; /* drive type description */
- int ri_nbpt; /* DEV_BSIZE blocks per track */
- int ri_ntpc; /* tracks per cylinder */
- int ri_ncyl; /* cylinders per unit */
- int ri_nblocks; /* DEV_BSIZE blocks on disk */
-};
-
-struct hdstats {
- long hdretries;
- long hdtimeouts;
- long hdpolltries;
- long hdpollwaits;
-};
-
-struct hd_softc {
- struct device sc_dev;
- struct disk sc_dkdev;
- int sc_slave; /* HP-IB slave */
- int sc_punit; /* physical unit on slave */
- int sc_flags;
- short sc_type;
- char *sc_addr;
- int sc_resid;
- int sc_errcnt;
- struct hpibqueue sc_hq; /* hpib job queue entry */
- struct hd_iocmd sc_ioc;
- struct hd_rscmd sc_rsc;
- struct hd_stat sc_stat;
- struct bufq sc_bufq; /* buffer queue */
- struct buf *sc_bp;
-#ifdef DEBUG
- struct hdstats sc_stats;
-#endif
- struct timeout sc_timeout;
-};
-
-/* sc_flags values */
-#define HDF_SEEK 0x01
-#define HDF_SWAIT 0x02
-#define HDF_OPENING 0x04
-#define HDF_CLOSING 0x08
-#define HDF_WANTED 0x10
-
-#ifdef _KERNEL
-extern const struct hdidentinfo hdidentinfo[];
-#endif
diff --git a/sys/arch/hp300/dev/hil_intio.c b/sys/arch/hp300/dev/hil_intio.c
deleted file mode 100644
index e818f03cb0a..00000000000
--- a/sys/arch/hp300/dev/hil_intio.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $OpenBSD: hil_intio.c,v 1.8 2007/01/06 20:10:57 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/conf.h>
-
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-
-#include <dev/cons.h>
-
-#include <hp300/dev/intiovar.h>
-
-#include <machine/hil_machdep.h>
-#include <machine/bus.h>
-#include <dev/hil/hilvar.h>
-
-int hil_intio_match(struct device *, void *, void *);
-void hil_intio_attach(struct device *, struct device *, void *);
-
-struct cfattach hil_intio_ca = {
- sizeof(struct hil_softc), hil_intio_match, hil_intio_attach
-};
-
-int
-hil_intio_match(struct device *parent, void *match, void *aux)
-{
- struct intio_attach_args *ia = aux;
-static int hil_matched = 0;
-
- /* Allow only one instance. */
- if (hil_matched != 0)
- return (0);
-
- if (badaddr((caddr_t)IIOV(HILADDR))) /* should not happen! */
- return (0);
-
- ia->ia_addr = (caddr_t)HILADDR;
- return (1);
-}
-
-struct isr hil_isr;
-int hil_is_console = -1; /* undecided */
-
-void
-hil_intio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct hil_softc *sc = (void *)self;
- struct intio_attach_args *ia = aux;
- extern struct consdev wsdisplay_cons;
-
- sc->sc_bst = ia->ia_tag;
- if (bus_space_map(sc->sc_bst, HILADDR,
- HILMAPSIZE, 0, &sc->sc_bsh) != 0) {
- printf(": couldn't map hil controller\n");
- return;
- }
-
- /*
- * Check that the configured console device is a wsdisplay.
- */
- if (cn_tab != &wsdisplay_cons)
- hil_is_console = 0;
-
- hil_isr.isr_func = hil_intr;
- hil_isr.isr_arg = sc;
- hil_isr.isr_ipl = 1;
- hil_isr.isr_priority = IPL_TTY;
-
- printf(" ipl %d", hil_isr.isr_ipl);
-
- hil_attach(sc, &hil_is_console);
- intr_establish(&hil_isr, self->dv_xname);
-
- startuphook_establish(hil_attach_deferred, sc);
-}
diff --git a/sys/arch/hp300/dev/hp98265reg.h b/sys/arch/hp300/dev/hp98265reg.h
deleted file mode 100644
index f8b6dbcf00b..00000000000
--- a/sys/arch/hp300/dev/hp98265reg.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $OpenBSD: hp98265reg.h,v 1.1 2004/08/03 21:46:56 miod Exp $ */
-/* $NetBSD: hp98265reg.h,v 1.1 2003/08/01 01:18:45 tsutsui Exp $ */
-
-/*
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of 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.
- *
- * @(#)scsireg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * HP 98265A SCSI Interface Hardware Description.
- */
-
-#define SPC_OFFSET 32
-#define SPC_SIZE (32 * 2) /* XXX */
-
-#define HPSCSI_ID 0x00
-#define ID_MASK 0x1f
-#define SCSI_ID 0x07
-#define ID_WORD_DMA 0x20
-
-#define HPSCSI_CSR 0x01
-#define CSR_IE 0x80
-#define CSR_IR 0x40
-#define SCSI_IPL(csr) ((((csr) >> 4) & 3) + 3)
-#define CSR_DMA32 0x08
-#define CSR_DMAIN 0x04
-#define CSR_DE1 0x02
-#define CSR_DE0 0x01
-
-#define HPSCSI_WRAP 0x02
-#define WRAP_REQ 0x80
-#define WRAP_ACK 0x40
-#define WRAP_BSY 0x08
-#define WRAP_MSG 0x04
-#define WRAP_CD 0x02
-#define WRAP_IO 0x01
-
-#define HPSCSI_HCONF 0x03
-#define HCONF_TP 0x80
-#define SCSI_SYNC_XFER(hconf) (((hconf) >> 5) & 3)
-#define HCONF_SD 0x10
-#define HCONF_PARITY 0x08
diff --git a/sys/arch/hp300/dev/hpib.c b/sys/arch/hp300/dev/hpib.c
deleted file mode 100644
index 382fa549036..00000000000
--- a/sys/arch/hp300/dev/hpib.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/* $OpenBSD: hpib.c,v 1.14 2009/01/25 14:57:44 miod Exp $ */
-/* $NetBSD: hpib.c,v 1.16 1997/04/27 20:58:57 thorpej Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)hpib.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * HP-IB bus driver
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-
-#include <hp300/dev/dmavar.h>
-
-#include <hp300/dev/hpibvar.h>
-
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-
-int hpibbusmatch(struct device *, void *, void *);
-void hpibbusattach(struct device *, struct device *, void *);
-
-struct cfattach hpibbus_ca = {
- sizeof(struct hpibbus_softc), hpibbusmatch, hpibbusattach
-};
-
-struct cfdriver hpibbus_cd = {
- NULL, "hpibbus", DV_DULL
-};
-
-void hpibbus_attach_children(struct hpibbus_softc *);
-int hpibbussubmatch(struct device *, void *, void *);
-int hpibbusprint(void *, const char *);
-
-void hpibstart(void *);
-void hpibdone(void *);
-
-int hpibtimeout = 100000; /* # of status tests before we give up */
-int hpibidtimeout = 10000; /* # of status tests for hpibid() calls */
-int hpibdmathresh = 3; /* byte count beyond which to attempt dma */
-
-/*
- * HP-IB is essentially an IEEE 488 bus, with an HP command
- * set (CS/80 on `newer' devices, Amigo on before-you-were-born
- * devices) thrown on top. Devices that respond to CS/80 (and
- * probably Amigo, too) are tagged with a 16-bit ID.
- *
- * HP-IB has a 2-level addressing scheme; slave, the analog
- * of a SCSI ID, and punit, the analog of a SCSI LUN. Unfortunately,
- * IDs are on a per-slave basis; punits are often used for disk
- * drives that have an accompanying tape drive on the second punit.
- *
- * In addition, not all HP-IB devices speak CS/80 or Amigo.
- * Examples of such devices are HP-IB plotters, which simply
- * take raw plotter commands over 488. These devices do not
- * have ID tags, and often the host cannot even tell if such
- * a device is attached to the system!
- *
- * We nevertheless probe the whole (slave, punit) tuple space, since
- * drivers for devices with a unique ID know exactly where to attach;
- * and we disallow ``star'' locators for other drivers.
- */
-
-int
-hpibbusmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
-
- return (1);
-}
-
-void
-hpibbusattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct hpibbus_softc *sc = (struct hpibbus_softc *)self;
- struct hpibdev_attach_args *ha = aux;
-
- printf("\n");
-
- /* Get the operations vector for the controller. */
- sc->sc_ops = ha->ha_ops;
- sc->sc_type = ha->ha_type; /* XXX */
- sc->sc_ba = ha->ha_ba;
- *(ha->ha_softcpp) = sc; /* XXX */
-
- hpibreset(self->dv_unit); /* XXX souldn't be here */
-
- /*
- * Initialize the DMA queue entry.
- */
- sc->sc_dq = (struct dmaqueue *)malloc(sizeof(struct dmaqueue),
- M_DEVBUF, M_NOWAIT);
- if (sc->sc_dq == NULL) {
- printf("%s: can't allocate DMA queue entry\n", self->dv_xname);
- return;
- }
- sc->sc_dq->dq_softc = sc;
- sc->sc_dq->dq_start = hpibstart;
- sc->sc_dq->dq_done = hpibdone;
-
- /* Initialize the slave request queue. */
- TAILQ_INIT(&sc->sc_queue);
-
- /* Attach any devices on the bus. */
- hpibbus_attach_children(sc);
-}
-
-void
-hpibbus_attach_children(sc)
- struct hpibbus_softc *sc;
-{
- struct hpibbus_attach_args ha;
- int id, slave, punit;
- int i;
-
- for (slave = 0; slave < HPIB_NSLAVES; slave++) {
- /*
- * Get the ID tag for the device, if any.
- * Plotters won't identify themselves, and
- * get the same value as non-existent devices.
- * However, aging HP-IB drives are slow to respond; try up
- * to three times to get a valid ID.
- */
- for (i = 0; i < 3; i++) {
- id = hpibid(sc->sc_dev.dv_unit, slave);
- if ((id & 0x200) != 0)
- break;
- delay(10000);
- }
-
- for (punit = 0; punit < HPIB_NPUNITS; punit++) {
- /*
- * Search through all configured children for this bus.
- */
- ha.ha_id = id;
- ha.ha_slave = slave;
- ha.ha_punit = punit;
- (void)config_found_sm(&sc->sc_dev, &ha, hpibbusprint,
- hpibbussubmatch);
- }
- }
-}
-
-int
-hpibbussubmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct cfdata *cf = match;
- struct hpibbus_attach_args *ha = aux;
-
- if (cf->hpibbuscf_slave != HPIBBUS_SLAVE_UNK &&
- cf->hpibbuscf_slave != ha->ha_slave)
- return (0);
- if (cf->hpibbuscf_punit != HPIBBUS_PUNIT_UNK &&
- cf->hpibbuscf_punit != ha->ha_punit)
- return (0);
- return ((*cf->cf_attach->ca_match)(parent, match, aux));
-}
-
-int
-hpibbusprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct hpibbus_attach_args *ha = aux;
-
- if (pnp != NULL) {
- if (ha->ha_id == 0 || ha->ha_punit != 0 /* XXX */)
- return (QUIET);
- printf("HP-IB device (id %04X) at %s", ha->ha_id, pnp);
- }
- printf(" slave %d punit %d", ha->ha_slave, ha->ha_punit);
- return (UNCONF);
-}
-
-int
-hpibdevprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
-
- /* only hpibbus's can attach to hpibdev's -- easy. */
- if (pnp != NULL)
- printf("hpibbus at %s", pnp);
- return (UNCONF);
-}
-
-void
-hpibreset(unit)
- int unit;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- (*sc->sc_ops->hpib_reset)(sc);
-}
-
-int
-hpibreq(pdev, hq)
- struct device *pdev;
- struct hpibqueue *hq;
-{
- struct hpibbus_softc *sc = (struct hpibbus_softc *)pdev;
- int s;
-
- s = splhigh(); /* XXXthorpej */
- TAILQ_INSERT_TAIL(&sc->sc_queue, hq, hq_list);
- splx(s);
-
- if (TAILQ_FIRST(&sc->sc_queue) == hq)
- return (1);
-
- return (0);
-}
-
-void
-hpibfree(pdev, hq)
- struct device *pdev;
- struct hpibqueue *hq;
-{
- struct hpibbus_softc *sc = (struct hpibbus_softc *)pdev;
- int s;
-
- s = splhigh(); /* XXXthorpej */
- TAILQ_REMOVE(&sc->sc_queue, hq, hq_list);
- splx(s);
-
- if ((hq = TAILQ_FIRST(&sc->sc_queue)) != NULL)
- (*hq->hq_start)(hq->hq_softc);
-}
-
-int
-hpibid(unit, slave)
- int unit, slave;
-{
- short id;
- int ohpibtimeout;
-
- /*
- * XXX shorten timeout value so autoconfig doesn't
- * take forever on slow CPUs.
- */
- ohpibtimeout = hpibtimeout;
- if (cputype == CPU_68040)
- hpibtimeout = hpibidtimeout * (cpuspeed / 3);
- else
- hpibtimeout = hpibidtimeout * (cpuspeed / 8);
- if (hpibrecv(unit, 31, slave, &id, 2) != 2)
- id = 0;
- hpibtimeout = ohpibtimeout;
- return(id);
-}
-
-int
-hpibsend(unit, slave, sec, addr, cnt)
- int unit, slave, sec, cnt;
- void *addr;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- return ((*sc->sc_ops->hpib_send)(sc, slave, sec, addr, cnt));
-}
-
-int
-hpibrecv(unit, slave, sec, addr, cnt)
- int unit, slave, sec, cnt;
- void *addr;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- return ((*sc->sc_ops->hpib_recv)(sc, slave, sec, addr, cnt));
-}
-
-int
-hpibpptest(unit, slave)
- int unit;
- int slave;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- return ((*sc->sc_ops->hpib_ppoll)(sc) & (0x80 >> slave));
-}
-
-void
-hpibppclear(unit)
- int unit;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- sc->sc_flags &= ~HPIBF_PPOLL;
-}
-
-void
-hpibawait(unit)
- int unit;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- sc->sc_flags |= HPIBF_PPOLL;
- (*sc->sc_ops->hpib_ppwatch)(sc);
-}
-
-int
-hpibswait(unit, slave)
- int unit;
- int slave;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
- int timo = hpibtimeout;
- int mask, (*ppoll)(struct hpibbus_softc *);
-
- ppoll = sc->sc_ops->hpib_ppoll;
- mask = 0x80 >> slave;
- while (((*ppoll)(sc) & mask) == 0) {
- if (--timo == 0) {
- printf("%s: swait timeout\n", sc->sc_dev.dv_xname);
- return(-1);
- }
- }
- return(0);
-}
-
-int
-hpibustart(unit)
- int unit;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- if (sc->sc_type == HPIBA)
- sc->sc_dq->dq_chan = DMA0;
- else
- sc->sc_dq->dq_chan = DMA0 | DMA1;
- if (dmareq(sc->sc_dq))
- return(1);
- return(0);
-}
-
-void
-hpibstart(arg)
- void *arg;
-{
- struct hpibbus_softc *sc = arg;
- struct hpibqueue *hq;
-
- hq = TAILQ_FIRST(&sc->sc_queue);
- (*hq->hq_go)(hq->hq_softc);
-}
-
-void
-hpibgo(unit, slave, sec, vbuf, count, rw, timo)
- int unit, slave, sec;
- void *vbuf;
- int count, rw, timo;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- (*sc->sc_ops->hpib_go)(sc, slave, sec, vbuf, count, rw, timo);
-}
-
-void
-hpibdone(arg)
- void *arg;
-{
- struct hpibbus_softc *sc = arg;
-
- (*sc->sc_ops->hpib_done)(sc);
-}
-
-int
-hpibintr(arg)
- void *arg;
-{
- struct hpibbus_softc *sc = arg;
-
- return ((sc->sc_ops->hpib_intr)(arg));
-}
diff --git a/sys/arch/hp300/dev/hpibvar.h b/sys/arch/hp300/dev/hpibvar.h
deleted file mode 100644
index b8c7e93b097..00000000000
--- a/sys/arch/hp300/dev/hpibvar.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* $OpenBSD: hpibvar.h,v 1.11 2010/09/06 14:44:18 jasper Exp $ */
-/* $NetBSD: hpibvar.h,v 1.10 1997/03/31 07:34:25 scottr Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)hpibvar.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/queue.h>
-
-#define HPIB_IPL(x) ((((x) >> 4) & 0x3) + 3)
-
-#define HPIBA 32
-#define HPIBB 1
-#define HPIBC 8
-#define HPIBA_BA 21
-#define HPIBC_BA 30
-#define HPIBA_IPL 3
-
-#define CSA_BA 0x1F
-
-#define IDS_WDMA 0x04
-#define IDS_WRITE 0x08
-#define IDS_IR 0x40
-#define IDS_IE 0x80
-#define IDS_DMA(x) (1 << (x))
-
-#define C_SDC 0x04 /* Selected device clear */
-#define C_SDC_P 0x04 /* with odd parity */
-#define C_DCL 0x14 /* Universal device clear */
-#define C_DCL_P 0x94 /* with odd parity */
-#define C_LAG 0x20 /* Listener address group commands */
-#define C_UNL 0x3f /* Universal unlisten */
-#define C_UNL_P 0xbf /* with odd parity */
-#define C_TAG 0x40 /* Talker address group commands */
-#define C_UNA 0x5e /* Unaddress (master talk address?) */
-#define C_UNA_P 0x5e /* with odd parity */
-#define C_UNT 0x5f /* Universal untalk */
-#define C_UNT_P 0xdf /* with odd parity */
-#define C_SCG 0x60 /* Secondary group commands */
-
-struct hpibbus_softc;
-
-/*
- * Each of the HP-IB controller drivers fills in this structure, which
- * is used by the indirect driver to call controller-specific functions.
- */
-struct hpib_controller {
- void (*hpib_reset)(struct hpibbus_softc *);
- int (*hpib_send)(struct hpibbus_softc *,
- int, int, void *, int);
- int (*hpib_recv)(struct hpibbus_softc *,
- int, int, void *, int);
- int (*hpib_ppoll)(struct hpibbus_softc *);
- void (*hpib_ppwatch)(void *);
- void (*hpib_go)(struct hpibbus_softc *,
- int, int, void *, int, int, int);
- void (*hpib_done)(struct hpibbus_softc *);
- int (*hpib_intr)(void *);
-};
-
-/*
- * Attach an HP-IB bus to an HP-IB controller.
- */
-struct hpibdev_attach_args {
- struct hpib_controller *ha_ops; /* controller ops vector */
- int ha_type; /* XXX */
- int ha_ba;
- struct hpibbus_softc **ha_softcpp; /* XXX */
-};
-
-/*
- * Attach an HP-IB device to an HP-IB bus.
- */
-struct hpibbus_attach_args {
- u_int16_t ha_id; /* device id */
- int ha_slave; /* HP-IB bus slave */
- int ha_punit; /* physical unit on slave */
-};
-
-/* Locator shorthand */
-#define hpibbuscf_slave cf_loc[0]
-#define hpibbuscf_punit cf_loc[1]
-
-#define HPIBBUS_SLAVE_UNK -1
-#define HPIBBUS_PUNIT_UNK -1
-
-#define HPIB_NSLAVES 8 /* number of slaves on a bus */
-#define HPIB_NPUNITS 2 /* number of punits per slave */
-
-/*
- * An HP-IB job queue entry. Slave drivers have one of these used
- * to queue requests with the controller.
- */
-struct hpibqueue {
- TAILQ_ENTRY(hpibqueue) hq_list; /* entry on queue */
- void *hq_softc; /* slave's softc */
- int hq_slave; /* slave on bus */
-
- /*
- * Callbacks used to start and stop the slave driver.
- */
- void (*hq_start)(void *);
- void (*hq_go)(void *);
- void (*hq_intr)(void *);
-};
-
-struct dmaqueue;
-
-/*
- * Software state per HP-IB bus.
- */
-struct hpibbus_softc {
- struct device sc_dev; /* generic device glue */
- struct hpib_controller *sc_ops; /* controller ops vector */
- volatile int sc_flags; /* misc flags */
- struct dmaqueue *sc_dq;
- TAILQ_HEAD(, hpibqueue) sc_queue;
- int sc_ba;
- int sc_type;
- char *sc_addr;
- int sc_count;
- int sc_curcnt;
-};
-
-/* sc_flags */
-#define HPIBF_IO 0x1
-#define HPIBF_DONE 0x2
-#define HPIBF_PPOLL 0x4
-#define HPIBF_READ 0x8
-#define HPIBF_TIMO 0x10
-#define HPIBF_DMA16 0x8000
-
-/*
- * Description structure for CS/80 devices.
- */
-
-struct cs80_describe {
- u_int d_iuw:16, /* controller: installed unit word */
- d_cmaxxfr:16, /* controller: max transfer rate (Kb) */
- d_ctype:8, /* controller: controller type */
- d_utype:8, /* unit: unit type */
- d_name:24, /* unit: name (6 BCD digits) */
- d_sectsize:16, /* unit: # of bytes per block (sector) */
- d_blkbuf:8, /* unit: # of blocks which can be buffered */
- d_burstsize:8, /* unit: recommended burst size */
- d_blocktime:16, /* unit: block time (u-sec) */
- d_uavexfr:16, /* unit: average transfer rate (Kb) */
- d_retry:16, /* unit: optimal retry time (1/100-sec) */
- d_access:16, /* unit: access time param (1/100-sec) */
- d_maxint:8, /* unit: maximum interleave */
- d_fvbyte:8, /* unit: fixed volume byte */
- d_rvbyte:8, /* unit: removable volume byte */
- d_maxcyl:24, /* volume: maximum cylinder */
- d_maxhead:8, /* volume: maximum head */
- d_maxsect:16, /* volume: maximum sector on track */
- d_maxvsecth:16, /* volume: maximum sector on volume (MSW) */
- d_maxvsectl:32, /* volume: maximum sector on volume (LSWs) */
- d_interleave:8; /* volume: current interleave */
-} __packed;
-
-#ifdef _KERNEL
-extern caddr_t internalhpib;
-extern int hpibtimeout;
-extern int hpibdmathresh;
-
-void hpibreset(int);
-int hpibsend(int, int, int, void *, int);
-int hpibrecv(int, int, int, void *, int);
-int hpibustart(int);
-void hpibstart(void *);
-void hpibgo(int, int, int, void *, int, int, int);
-void hpibdone(void *);
-int hpibpptest(int, int);
-void hpibppclear(int);
-void hpibawait(int);
-int hpibswait(int, int);
-int hpibid(int, int);
-
-int hpibreq(struct device *, struct hpibqueue *);
-void hpibfree(struct device *, struct hpibqueue *);
-
-int hpibintr(void *);
-int hpibdevprint(void *, const char *);
-#endif
diff --git a/sys/arch/hp300/dev/hyper.c b/sys/arch/hp300/dev/hyper.c
deleted file mode 100644
index 70fe53af6d7..00000000000
--- a/sys/arch/hp300/dev/hyper.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* $OpenBSD: hyper.c,v 1.17 2013/10/21 10:36:13 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1991 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Mark Davies of the Department of Computer
- * Science, Victoria University of Wellington, New Zealand.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_hy.c 1.2 93/08/13$
- *
- * @(#)grf_hy.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for HYPERION frame buffer
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/intiovar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-#include <hp300/dev/hyperreg.h>
-
-struct hyper_softc {
- struct device sc_dev;
- struct diofb *sc_fb;
- struct diofb sc_fb_store;
-};
-
-int hyper_match(struct device *, void *, void *);
-void hyper_attach(struct device *, struct device *, void *);
-
-struct cfattach hyper_ca = {
- sizeof(struct hyper_softc), hyper_match, hyper_attach
-};
-
-struct cfdriver hyper_cd = {
- NULL, "hyper", DV_DULL
-};
-
-int hyper_reset(struct diofb *, int, struct diofbreg *);
-
-int hyper_ioctl(void *, u_long, caddr_t, int, struct proc *);
-void hyper_burner(void *, u_int, u_int);
-
-struct wsdisplay_accessops hyper_accessops = {
- .ioctl = hyper_ioctl,
- .mmap = diofb_mmap,
- .alloc_screen = diofb_alloc_screen,
- .free_screen = diofb_free_screen,
- .show_screen = diofb_show_screen,
- .load_font = diofb_load_font,
- .list_font = diofb_list_font,
- .burn_screen = hyper_burner
-};
-
-/*
- * Attachment glue
- */
-
-int
-hyper_match(struct device *parent, void *match, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
- da->da_secid == DIO_DEVICE_SECID_HYPERION)
- return (1);
-
- return (0);
-}
-
-void
-hyper_attach(struct device *parent, struct device *self, void *aux)
-{
- struct hyper_softc *sc = (struct hyper_softc *)self;
- struct dio_attach_args *da = aux;
- struct diofbreg *fbr;
- int scode;
-
- scode = da->da_scode;
- if (scode == conscode) {
- fbr = (struct diofbreg *)conaddr; /* already mapped */
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- fbr = (struct diofbreg *)
- iomap(dio_scodetopa(scode), da->da_size);
- if (fbr == NULL ||
- hyper_reset(sc->sc_fb, scode, fbr) != 0) {
- printf(": can't map framebuffer\n");
- return;
- }
- }
-
- diofb_end_attach(self, &hyper_accessops, sc->sc_fb,
- scode == conscode, NULL);
-}
-
-/*
- * Initialize hardware and display routines.
- */
-int
-hyper_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
-{
- volatile struct hyboxfb *hy = (struct hyboxfb *)fbr;
- int rc;
-
- if ((rc = diofb_fbinquire(fb, scode, fbr)) != 0)
- return (rc);
-
- fb->bmv = diofb_mono_windowmove;
-
- fb->ri.ri_depth = 1; /* do not fake a 8bpp frame buffer */
- diofb_fbsetup(fb);
-
- /* enable display */
- hy->nblank = DISP_VIDEO_ENABLE | DISP_SYNC_ENABLE;
-
- return (0);
-}
-
-int
-hyper_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
-{
- struct diofb *fb = v;
- struct wsdisplay_fbinfo *wdf;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_HYPERION;
- break;
- case WSDISPLAYIO_SMODE:
- fb->mapmode = *(u_int *)data;
- break;
- case WSDISPLAYIO_GINFO:
- wdf = (void *)data;
- wdf->width = fb->ri.ri_width;
- wdf->height = fb->ri.ri_height;
- wdf->depth = fb->ri.ri_depth;
- wdf->cmsize = 0;
- break;
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = fb->ri.ri_stride;
- break;
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- case WSDISPLAYIO_GETCMAP:
- case WSDISPLAYIO_PUTCMAP:
- break;
- default:
- return (-1);
- }
-
- return (0);
-}
-
-void
-hyper_burner(void *v, u_int on, u_int flags)
-{
- struct diofb *fb = v;
- volatile struct hyboxfb *hy = (struct hyboxfb *)fb->regkva;
-
- if (on) {
- hy->nblank = DISP_VIDEO_ENABLE | DISP_SYNC_ENABLE;
- } else {
- if (flags & WSDISPLAY_BURN_VBLANK)
- hy->nblank = 0;
- else
- hy->nblank = DISP_SYNC_ENABLE;
- }
-}
-
-/*
- * Hyperion console support
- */
-
-void
-hypercninit()
-{
- hyper_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
- diofb_cnattach(&diofb_cn);
-}
diff --git a/sys/arch/hp300/dev/hyperreg.h b/sys/arch/hp300/dev/hyperreg.h
deleted file mode 100644
index 55eed690860..00000000000
--- a/sys/arch/hp300/dev/hyperreg.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $OpenBSD: hyperreg.h,v 1.3 2005/01/24 21:36:39 miod Exp $ */
-/* $NetBSD: grf_hyreg.h,v 1.2 1994/10/26 07:23:57 cgd Exp $ */
-
-/*
- * Copyright (c) 1991 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Mark Davies of the Department of Computer
- * Science, Victoria University of Wellington, New Zealand.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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_hyreg.h 1.1 92/01/22$
- *
- * @(#)grf_hyreg.h 8.1 (Berkeley) 6/10/93
- */
-
-struct hyboxfb {
- struct diofbreg regs;
- u_int8_t f2[0x4000-0x5f-1];
- u_int8_t nblank; /* display enable planes 0x4000 */
-};
-
-/* Values for nblank */
-#define DISP_SYNC_ENABLE 0x01
-#define DISP_VIDEO_ENABLE 0x04
diff --git a/sys/arch/hp300/dev/if_le.c b/sys/arch/hp300/dev/if_le.c
deleted file mode 100644
index 80386ad2dd5..00000000000
--- a/sys/arch/hp300/dev/if_le.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* $OpenBSD: if_le.c,v 1.18 2013/09/24 20:10:44 miod Exp $ */
-/* $NetBSD: if_le.c,v 1.43 1997/05/05 21:05:32 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1995 Charles M. Hannum. 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.
- *
- * @(#)if_le.c 8.2 (Berkeley) 11/16/93
- */
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/syslog.h>
-#include <sys/socket.h>
-#include <sys/device.h>
-
-#include <net/if.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#endif
-
-#include <net/if_media.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-
-#include <dev/ic/lancereg.h>
-#include <dev/ic/lancevar.h>
-#include <dev/ic/am7990reg.h>
-#include <dev/ic/am7990var.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/if_lereg.h>
-#include <hp300/dev/if_levar.h>
-
-#ifdef USELEDS
-#include <hp300/hp300/leds.h>
-#endif
-
-int lematch(struct device *, void *, void *);
-void leattach(struct device *, struct device *, void *);
-
-struct cfattach le_ca = {
- sizeof(struct le_softc), lematch, leattach
-};
-
-int leintr(void *);
-
-/* offsets for: ID, REGS, MEM, NVRAM */
-const int lestd[] = { 0, 0x4000, 0x8000, 0xC008 };
-
-void lewrcsr(struct lance_softc *, uint16_t, uint16_t);
-uint16_t lerdcsr(struct lance_softc *, uint16_t);
-
-void
-lewrcsr(struct lance_softc *sc, uint16_t port, uint16_t val)
-{
- struct lereg0 *ler0 = ((struct le_softc *)sc)->sc_r0;
- struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1;
-
- do {
- ler1->ler1_rap = port;
- } while ((ler0->ler0_status & LE_ACK) == 0);
- do {
- ler1->ler1_rdp = val;
- } while ((ler0->ler0_status & LE_ACK) == 0);
-}
-
-uint16_t
-lerdcsr(struct lance_softc *sc, uint16_t port)
-{
- struct lereg0 *ler0 = ((struct le_softc *)sc)->sc_r0;
- struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1;
- uint16_t val;
-
- do {
- ler1->ler1_rap = port;
- } while ((ler0->ler0_status & LE_ACK) == 0);
- do {
- val = ler1->ler1_rdp;
- } while ((ler0->ler0_status & LE_ACK) == 0);
- return (val);
-}
-
-int
-lematch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- if ((da->da_id == DIO_DEVICE_ID_LAN) ||
- (da->da_id == DIO_DEVICE_ID_LANREM))
- 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
-leattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct lereg0 *ler0;
- struct dio_attach_args *da = aux;
- struct le_softc *lesc = (struct le_softc *)self;
- caddr_t addr;
- struct lance_softc *sc = &lesc->sc_am7990.lsc;
- char *cp;
- int i, ipl;
-
- addr = iomap(dio_scodetopa(da->da_scode), da->da_size);
- if (addr == 0) {
- printf("\n%s: can't map LANCE registers\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- ler0 = lesc->sc_r0 = (struct lereg0 *)(lestd[0] + (int)addr);
- ler0->ler0_id = 0xFF;
- DELAY(100);
-
- ipl = DIO_IPL(addr);
- printf(" ipl %d", ipl);
-
- lesc->sc_r1 = (struct lereg1 *)(lestd[1] + (int)addr);
- sc->sc_mem = (void *)(lestd[2] + (int)addr);
- sc->sc_conf3 = LE_C3_BSWP;
- sc->sc_addr = 0;
- sc->sc_memsize = 16384;
-
- /*
- * Read the ethernet address off the board, one nibble at a time.
- */
- cp = (char *)(lestd[3] + (int)addr);
- for (i = 0; i < sizeof(sc->sc_arpcom.ac_enaddr); i++) {
- sc->sc_arpcom.ac_enaddr[i] = (*++cp & 0xF) << 4;
- cp++;
- sc->sc_arpcom.ac_enaddr[i] |= *++cp & 0xF;
- cp++;
- }
-
- 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;
-
- sc->sc_rdcsr = lerdcsr;
- sc->sc_wrcsr = lewrcsr;
- sc->sc_hwreset = NULL;
- sc->sc_hwinit = NULL;
-
- am7990_config(&lesc->sc_am7990);
-
- /* Establish the interrupt handler. */
- lesc->sc_isr.isr_func = leintr;
- lesc->sc_isr.isr_arg = lesc;
- lesc->sc_isr.isr_ipl = ipl;
- lesc->sc_isr.isr_priority = IPL_NET;
- dio_intr_establish(&lesc->sc_isr, self->dv_xname);
- ler0->ler0_status = LE_IE;
-}
-
-int
-leintr(arg)
- void *arg;
-{
- struct le_softc *lesc = (struct le_softc *)arg;
- struct lance_softc *sc = &lesc->sc_am7990.lsc;
-#ifdef USELEDS
- uint16_t isr;
-
- isr = lerdcsr(sc, LE_CSR0);
-
- if ((isr & LE_C0_INTR) == 0)
- return (0);
-
- if (isr & LE_C0_RINT)
- ledcontrol(0, 0, LED_LANRCV);
-
- if (isr & LE_C0_TINT)
- ledcontrol(0, 0, LED_LANXMT);
-#endif /* USELEDS */
-
- return am7990_intr(sc);
-}
diff --git a/sys/arch/hp300/dev/if_lereg.h b/sys/arch/hp300/dev/if_lereg.h
deleted file mode 100644
index 1f4247b7b1f..00000000000
--- a/sys/arch/hp300/dev/if_lereg.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $OpenBSD: if_lereg.h,v 1.4 2003/06/02 23:27:45 millert Exp $ */
-/* $NetBSD: if_lereg.h,v 1.8 1995/12/10 00:49:36 mycroft Exp $ */
-
-/*
- * Copyright (c) 1982, 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.
- *
- * @(#)if_lereg.h 7.1 (Berkeley) 5/8/90
- */
-
-#define LEID 21
-
-/*
- * DIO registers.
- */
-struct lereg0 {
- u_int8_t ler0_pad0;
- volatile u_int8_t ler0_id; /* ID */
- u_int8_t ler0_pad1;
- volatile u_int8_t ler0_status; /* interrupt enable/status */
-};
-
-/*
- * Control and status bits -- lereg0
- */
-#define LE_IE 0x80 /* interrupt enable */
-#define LE_IR 0x40 /* interrupt requested */
-#define LE_LOCK 0x08 /* lock status register */
-#define LE_ACK 0x04 /* ack of lock */
-#define LE_JAB 0x02 /* loss of tx clock (???) */
-#define LE_IPL(x) ((((x) >> 4) & 0x3) + 3)
-
-/*
- * LANCE registers.
- */
-struct lereg1 {
- volatile u_int16_t ler1_rdp; /* data port */
- volatile u_int16_t ler1_rap; /* register select port */
-};
diff --git a/sys/arch/hp300/dev/if_levar.h b/sys/arch/hp300/dev/if_levar.h
deleted file mode 100644
index 8fbed649e56..00000000000
--- a/sys/arch/hp300/dev/if_levar.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $OpenBSD: if_levar.h,v 1.7 2004/09/29 07:35:52 miod Exp $ */
-/* $NetBSD: if_levar.h,v 1.8 1997/04/14 02:30:45 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1995 Charles M. Hannum. 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.
- *
- * @(#)if_le.c 8.2 (Berkeley) 11/16/93
- */
-
-/*
- * Ethernet software status per interface.
- *
- * Each interface is referenced by a network interface structure,
- * arpcom.ac_if, which the routing code uses to locate the interface.
- * This structure contains the output queue for the interface, its address, ...
- */
-struct le_softc {
- struct am7990_softc sc_am7990; /* glue to MI code */
- struct isr sc_isr;
-
- struct lereg0 *sc_r0; /* DIO registers */
- struct lereg1 *sc_r1; /* LANCE registers */
-};
diff --git a/sys/arch/hp300/dev/intio.c b/sys/arch/hp300/dev/intio.c
deleted file mode 100644
index 4ff81012fa5..00000000000
--- a/sys/arch/hp300/dev/intio.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $OpenBSD: intio.c,v 1.7 2008/06/26 05:42:10 ray Exp $ */
-/* $NetBSD: intio.c,v 1.2 1997/01/30 09:18:54 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Autoconfiguration support for hp300 internal i/o space.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-
-#include <hp300/dev/intiovar.h>
-
-int intiomatch(struct device *, void *, void *);
-void intioattach(struct device *, struct device *, void *);
-int intioprint(void *, const char *);
-int intiosearch(struct device *, void *, void *);
-
-struct cfattach intio_ca = {
- sizeof(struct device), intiomatch, intioattach
-};
-
-struct cfdriver intio_cd = {
- NULL, "intio", DV_DULL
-};
-
-int
-intiomatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- static int intio_matched = 0;
-
- /* Allow only one instance. */
- if (intio_matched)
- return (0);
-
- intio_matched = 1;
- return (1);
-}
-
-void
-intioattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
-
- printf("\n");
-
- /* Search for and attach children. */
- config_search(intiosearch, self, NULL);
-}
-
-int
-intioprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct intio_attach_args *ia = aux;
-
- if (ia->ia_addr != 0)
- printf(" addr %p", ia->ia_addr);
- return (UNCONF);
-}
-
-int
-intiosearch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct cfdata *cf = match;
- struct intio_attach_args ia;
- extern struct hp300_bus_space_tag hp300_mem_tag;
-
- bzero(&ia, sizeof(ia));
- ia.ia_tag = &hp300_mem_tag;
-
- if ((*cf->cf_attach->ca_match)(parent, cf, &ia) > 0)
- config_attach(parent, cf, &ia, intioprint);
-
- return (0);
-}
diff --git a/sys/arch/hp300/dev/intiovar.h b/sys/arch/hp300/dev/intiovar.h
deleted file mode 100644
index de3b8108de9..00000000000
--- a/sys/arch/hp300/dev/intiovar.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $OpenBSD: intiovar.h,v 1.4 2008/06/26 05:42:10 ray Exp $ */
-/* $NetBSD: intiovar.h,v 1.2 1997/01/30 09:18:55 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Autoconfiguration definitions and prototypes for the hp300
- * internal i/o space.
- */
-
-/*
- * Arguments used to attach a device to the internal i/o space.
- */
-struct intio_attach_args {
- caddr_t ia_addr; /* physical address */
- bus_space_tag_t ia_tag;
-};
diff --git a/sys/arch/hp300/dev/iotypes.h b/sys/arch/hp300/dev/iotypes.h
deleted file mode 100644
index 7a52a188bb8..00000000000
--- a/sys/arch/hp300/dev/iotypes.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $OpenBSD: iotypes.h,v 1.3 2003/06/02 23:27:45 millert Exp $ */
-/* $NetBSD: iotypes.h,v 1.2 1994/10/26 07:24:24 cgd Exp $ */
-
-/*
- * Copyright (c) 1991 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: iotypes.h 1.1 91/12/12$
- *
- * @(#)iotypes.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _IOTYPES_
-#define _IOTYPES_
-
-/*
- * Where do these really belong?
- */
-typedef volatile char v_char;
-typedef volatile unsigned char vu_char;
-typedef volatile short v_short;
-typedef volatile unsigned short vu_short;
-typedef volatile int v_int;
-typedef volatile unsigned int vu_int;
-#endif
diff --git a/sys/arch/hp300/dev/isa_machdep.h b/sys/arch/hp300/dev/isa_machdep.h
deleted file mode 100644
index f796298a580..00000000000
--- a/sys/arch/hp300/dev/isa_machdep.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $OpenBSD: isa_machdep.h,v 1.1 2007/01/06 20:17:43 miod Exp $ */
-
-/*
- * Copyright (c) 2007 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.
- */
-
-#ifndef _HP300_ISA_MACHDEP_H_
-#define _HP300_ISA_MACHDEP_H_
-
-#include <machine/bus.h>
-
-#define __NO_ISA_INTR_CHECK
-
-typedef void * isa_chipset_tag_t;
-
-void isa_attach_hook(struct device *, struct device *,
- struct isabus_attach_args *);
-void *isa_intr_establish(isa_chipset_tag_t, int, int, int,
- int (*)(void *), void *, char *);
-void isa_intr_disestablish(isa_chipset_tag_t, void *);
-
-#define IST_NONE 0
-#define IST_PULSE 1
-#define IST_EDGE 2
-#define IST_LEVEL 3
-
-#endif /* _HP300_ISA_MACHDEP_H_ */
diff --git a/sys/arch/hp300/dev/isabr.c b/sys/arch/hp300/dev/isabr.c
deleted file mode 100644
index 10459182fb3..00000000000
--- a/sys/arch/hp300/dev/isabr.c
+++ /dev/null
@@ -1,1003 +0,0 @@
-/* $OpenBSD: isabr.c,v 1.2 2007/01/14 17:54:45 miod Exp $ */
-
-/*
- * Copyright (c) 2007 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.
- */
-
-/*
- * HP 9000/4xx model `t' single ISA slot attachment
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/extent.h>
-#include <sys/malloc.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-
-#include <hp300/dev/frodoreg.h>
-#include <hp300/dev/frodovar.h>
-#include <hp300/dev/isabrreg.h>
-
-int isabr_match(struct device *, void *, void *);
-void isabr_attach(struct device *, struct device *, void *);
-int isabr_print(void *, const char *);
-
-struct isabr_softc {
- struct device sc_dev;
- struct extent *sc_io_extent;
- struct extent *sc_mem_extent;
-};
-
-struct cfattach isabr_ca = {
- sizeof(struct isabr_softc), isabr_match, isabr_attach
-};
-
-struct cfdriver isabr_cd = {
- NULL, "isabr", DV_DULL
-};
-
-struct isabr_softc *isabr;
-
-int isabr_bus_space_setup(struct isabr_softc *, struct frodo_attach_args *,
- struct isabus_attach_args *);
-
-int
-isabr_match(struct device *parent, void *match, void *aux)
-{
- struct frodo_attach_args *fa = aux;
- static int isa_matched = 0;
-
- if (isa_matched != 0)
- return (0);
-
- if (strcmp(fa->fa_name, isabr_cd.cd_name) != 0)
- return (0);
-
- /*
- * We assume parent has checked our physical existence for us.
- */
-
- return (isa_matched = 1);
-}
-
-void
-isabr_attach(struct device *parent, struct device *self, void *aux)
-{
- struct isabus_attach_args iba;
- struct isabr_softc *sc = (struct isabr_softc *)self;
- struct frodo_attach_args *faa = (struct frodo_attach_args *)aux;
-
- bzero(&iba, sizeof(iba));
-
- if (isabr_bus_space_setup(sc, faa, &iba) != 0) {
- printf(": can not initialize bus_space\n");
- return;
- }
- printf("\n");
-
- iba.iba_busname = "isa";
- config_found(self, &iba, isabr_print);
-}
-
-int
-isabr_print(void *aux, const char *pnp)
-{
- if (pnp)
- printf("isa at %s", pnp);
- return (UNCONF);
-}
-
-/*
- * ISA support functions
- */
-
-void
-isa_attach_hook(struct device *parent, struct device *self,
- struct isabus_attach_args *iba)
-{
- iba->iba_ic = parent; /* isabr0 */
-}
-
-/*
- * Interrupt handling.
- *
- * We are currently registering ISA interrupt handlers as Frodo interrupt
- * handlers directly. We can because model `t' only have a single slot.
- *
- * Eventually this should be replaced with an isabr interrupt dispatcher,
- * allowing multiple interrupts on the same Frodo line. This would also
- * move the ISA-specific acknowledge out of non-ISA Frodo lines processing.
- * And this would allow a real intr_disestablish function.
- */
-void *
-isa_intr_establish(isa_chipset_tag_t ic, int irq, int type, int level,
- int (*handler)(void *), void *arg, char *name)
-{
- struct isabr_softc *sc = (struct isabr_softc *)ic;
- struct isr *isr;
- int fline;
-
- /*
- * Frodo is configured for edge interrupts.
- */
- if (type != IST_EDGE) {
-#ifdef DIAGNOSTIC
- printf("%s: non-edge interrupt type not supported on hp300\n",
- name);
-#endif
- return (NULL);
- }
-
- switch (irq) {
- case 3:
- case 4:
- case 5:
- case 6:
- fline = FRODO_INTR_ILOW;
- break;
- case 7:
- case 9:
- case 10:
- case 11:
- fline = FRODO_INTR_IMID;
- break;
- case 12:
- case 14:
- case 15:
- fline = FRODO_INTR_IHI;
- break;
- default:
-#ifdef DIAGNOSTIC
- printf("%s: ISA irq %d not available on " MACHINE "\n", name);
-#endif
- return (NULL);
- }
-
- isr = (struct isr *)malloc(sizeof(struct isr), M_DEVBUF, M_NOWAIT);
- if (isr == NULL)
- return (NULL);
-
- isr->isr_func = handler;
- isr->isr_arg = arg;
- isr->isr_priority = level;
-
- if (frodo_intr_establish(sc->sc_dev.dv_parent, fline, isr, name) == 0)
- return (isr);
-
- free(isr, M_DEVBUF);
- return (NULL);
-}
-
-void
-isa_intr_disestablish(isa_chipset_tag_t ic, void *cookie)
-{
-#if 0
- struct isabr_softc *sc = (struct isabr_softc *)ic;
- struct isr *isr = cookie;
-
- /* XXX how to find fline back? */
- frodo_intr_disestablish(sc->dv_parent, fline);
- free(isr, M_DEVBUF);
-#else
- panic("isa_intr_disestablish");
-#endif
-}
-
-/*
- * Implementation of bus_space mapping for the hp300 isa slot.
- *
- * Everything is memory mapped, but the I/O space is scattered for better
- * userland access control granularity, should we ever provide iopl
- * facilities, thus i/o space accesses need their own routines set, while
- * memory space simply reuse the ``canonical'' bus_space routines.
- *
- * For the I/O space, all bus_space_map allocations are extended to a 8 ports
- * granularity, so that they span entire, contiguous pages; the handle value
- * however needs to keep track of the in-page offset if the first port is
- * not aligned to a ``line'' boundary.
- *
- * I.e, a bus_space_map(0x302, 0xe) call will map the 0x300-0x30f area,
- * and return a pointer the 0x302 port. Access routines will then, from
- * this pointer, construct a (0x300, 0x02) tuple, which they can use to
- * access the remainder of the range.
- */
-
-/*
- * ISA I/O space
- */
-
-int hp300_isa_io_map(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
-void hp300_isa_io_unmap(bus_space_handle_t, bus_size_t);
-int hp300_isa_io_subregion(bus_space_handle_t, bus_size_t, bus_size_t,
- bus_space_handle_t *);
-void * hp300_isa_io_vaddr(bus_space_handle_t);
-
-u_int8_t hp300_isa_io_bsr1(bus_space_handle_t, bus_size_t);
-u_int16_t hp300_isa_io_bsr2(bus_space_handle_t, bus_size_t);
-u_int32_t hp300_isa_io_bsr4(bus_space_handle_t, bus_size_t);
-u_int16_t __hp300_isa_io_bsr2(bus_space_handle_t, bus_size_t);
-u_int32_t __hp300_isa_io_bsr4(bus_space_handle_t, bus_size_t);
-void hp300_isa_io_bsrm1(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_isa_io_bsrm2(bus_space_handle_t, bus_size_t, u_int16_t *, size_t);
-void hp300_isa_io_bsrm4(bus_space_handle_t, bus_size_t, u_int32_t *, size_t);
-void hp300_isa_io_bsrrm2(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_isa_io_bsrrm4(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_isa_io_bsrr1(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_isa_io_bsrr2(bus_space_handle_t, bus_size_t, u_int16_t *, size_t);
-void hp300_isa_io_bsrr4(bus_space_handle_t, bus_size_t, u_int32_t *, size_t);
-void hp300_isa_io_bsrrr2(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_isa_io_bsrrr4(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_isa_io_bsw1(bus_space_handle_t, bus_size_t, u_int8_t);
-void hp300_isa_io_bsw2(bus_space_handle_t, bus_size_t, u_int16_t);
-void hp300_isa_io_bsw4(bus_space_handle_t, bus_size_t, u_int32_t);
-void __hp300_isa_io_bsw2(bus_space_handle_t, bus_size_t, u_int16_t);
-void __hp300_isa_io_bsw4(bus_space_handle_t, bus_size_t, u_int32_t);
-void hp300_isa_io_bswm1(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_isa_io_bswm2(bus_space_handle_t, bus_size_t, const u_int16_t *, size_t);
-void hp300_isa_io_bswm4(bus_space_handle_t, bus_size_t, const u_int32_t *, size_t);
-void hp300_isa_io_bswrm2(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_isa_io_bswrm4(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_isa_io_bswr1(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_isa_io_bswr2(bus_space_handle_t, bus_size_t, const u_int16_t *, size_t);
-void hp300_isa_io_bswr4(bus_space_handle_t, bus_size_t, const u_int32_t *, size_t);
-void hp300_isa_io_bswrr2(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_isa_io_bswrr4(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_isa_io_bssm1(bus_space_handle_t, bus_size_t, u_int8_t, size_t);
-void hp300_isa_io_bssm2(bus_space_handle_t, bus_size_t, u_int16_t, size_t);
-void hp300_isa_io_bssm4(bus_space_handle_t, bus_size_t, u_int32_t, size_t);
-void hp300_isa_io_bssr1(bus_space_handle_t, bus_size_t, u_int8_t, size_t);
-void hp300_isa_io_bssr2(bus_space_handle_t, bus_size_t, u_int16_t, size_t);
-void hp300_isa_io_bssr4(bus_space_handle_t, bus_size_t, u_int32_t, size_t);
-
-struct hp300_bus_space_tag hp300_isa_io_tag = {
- hp300_isa_io_map,
- hp300_isa_io_unmap,
- hp300_isa_io_subregion,
- hp300_isa_io_vaddr,
-
- hp300_isa_io_bsr1,
- hp300_isa_io_bsr2,
- hp300_isa_io_bsr4,
-
- hp300_isa_io_bsrm1,
- hp300_isa_io_bsrm2,
- hp300_isa_io_bsrm4,
-
- hp300_isa_io_bsrrm2,
- hp300_isa_io_bsrrm4,
-
- hp300_isa_io_bsrr1,
- hp300_isa_io_bsrr2,
- hp300_isa_io_bsrr4,
-
- hp300_isa_io_bsrrr2,
- hp300_isa_io_bsrrr4,
-
- hp300_isa_io_bsw1,
- hp300_isa_io_bsw2,
- hp300_isa_io_bsw4,
-
- hp300_isa_io_bswm1,
- hp300_isa_io_bswm2,
- hp300_isa_io_bswm4,
-
- hp300_isa_io_bswrm2,
- hp300_isa_io_bswrm4,
-
- hp300_isa_io_bswr1,
- hp300_isa_io_bswr2,
- hp300_isa_io_bswr4,
-
- hp300_isa_io_bswrr2,
- hp300_isa_io_bswrr4,
-
- hp300_isa_io_bssm1,
- hp300_isa_io_bssm2,
- hp300_isa_io_bssm4,
-
- hp300_isa_io_bssr1,
- hp300_isa_io_bssr2,
- hp300_isa_io_bssr4
-};
-
-int
-hp300_isa_io_map(bus_addr_t bpa, bus_size_t size, int flags,
- bus_space_handle_t *bshp)
-{
- int error;
- u_int iobase, iosize, npg;
- vaddr_t va;
- paddr_t pa;
-
-#ifdef DEBUG
- printf("isa_io_map(%04x, %04x)", bpa, size);
-#endif
-
- /*
- * Reserve the range in the allocation extent.
- */
- if (bpa < IO_ISABEGIN || bpa + size > IO_ISAEND + 1) {
-#ifdef DEBUG
- printf(" outside available range\n");
-#endif
- return (ERANGE);
- }
- error = extent_alloc_region(isabr->sc_io_extent, bpa, size,
- EX_MALLOCOK);
- if (error != 0) {
-#ifdef DEBUG
- printf(" overlaps extent\n");
-#endif
- return (error);
- }
-
- /*
- * Round the allocation to a multiple of 8 bytes, to end up
- * with entire pages.
- */
- iobase = bpa & ~(ISABR_IOPORT_LINE - 1);
- iosize = ((bpa + size + (ISABR_IOPORT_LINE - 1)) &
- ~(ISABR_IOPORT_LINE - 1)) - iobase;
-
- /*
- * Compute how many pages will be necessary to map this range.
- */
- npg = iosize / ISABR_IOPORT_LINE;
-#ifdef DEBUG
- printf("->(%04x, %04x)=%d@", iobase, iosize, npg);
-#endif
-
- /*
- * Allocate virtual address space to map this space in.
- */
- va = uvm_km_valloc(kernel_map, ptoa(npg));
- if (va == 0) {
-#ifdef DEBUG
- printf("NULL\n");
-#endif
- extent_free(isabr->sc_io_extent, bpa, size, EX_MALLOCOK);
- return (ENOMEM);
- }
-
- *bshp = (bus_space_handle_t)(va + (bpa - iobase));
-
- pa = ISABR_IOPORT_BASE + ISAADDR(iobase);
-#ifdef DEBUG
- printf("%08x (ret %08x) pa %08x\n", va, *bshp, pa);
-#endif
-
- while (npg != 0) {
- pmap_kenter_cache(va, pa, PG_RW | PG_CI);
- npg--;
- va += PAGE_SIZE;
- pa += PAGE_SIZE;
- }
- pmap_update(pmap_kernel());
-
- return (0);
-}
-
-void
-hp300_isa_io_unmap(bus_space_handle_t bsh, bus_size_t size)
-{
- u_int iobase, iosize, npg;
- vaddr_t va;
- paddr_t pa;
-
-#ifdef DEBUG
- printf("isa_io_unmap(%08x, %04x)", bsh, size);
-#endif
-
- /*
- * Find the pa matching this allocation, and the I/O port base
- * from it.
- */
- va = (vaddr_t)bsh;
- if (pmap_extract(pmap_kernel(), va, &pa) == FALSE) {
-#ifdef DEBUG
- printf("-> no pa\n");
-#endif
- return; /* XXX be vocal? */
- }
-
-#ifdef DEBUG
- printf("-> pa %08x ", pa);
-#endif
- pa -= ISABR_IOPORT_BASE;
- iobase = ISAPORT(pa);
- if (iobase < IO_ISABEGIN || iobase > IO_ISAEND) {
-#ifdef DEBUG
- printf("iobase %08x???\n", iobase);
-#endif
- return; /* XXX be vocal? */
- }
-
- iosize = size + (iobase & (ISABR_IOPORT_LINE - 1)) +
- (ISABR_IOPORT_LINE - 1);
- npg = iosize / ISABR_IOPORT_LINE;
-#ifdef DEBUG
- printf(" range %04x-%04x: %d\n", iobase, size, npg);
-#endif
-
- pmap_kremove(va, ptoa(npg));
- pmap_update(pmap_kernel());
- uvm_km_free(kernel_map, va, ptoa(npg));
-
- (void)extent_free(isabr->sc_io_extent, (u_long)iobase, size,
- EX_MALLOCOK);
-}
-
-/*
- * Round down an I/O space bus_space_handle, so that it points to the
- * beginning of a page.
- * This is gonna be hell when we support ports above 0x400.
- */
-#define REALIGN_IO_HANDLE(h, o) \
-do { \
- u_int tmp; \
- tmp = (h) & (ISABR_IOPORT_LINE - 1); \
- (h) -= tmp; \
- (o) += tmp; \
-} while (0)
-
-/* ARGSUSED */
-int
-hp300_isa_io_subregion(bus_space_handle_t bsh, bus_size_t offset,
- bus_size_t size, bus_space_handle_t *nbshp)
-{
- REALIGN_IO_HANDLE(bsh, offset);
- bsh += ISAADDR(offset);
- *nbshp = bsh;
- return (0);
-}
-
-void *
-hp300_isa_io_vaddr(bus_space_handle_t h)
-{
- return (NULL);
-}
-
-/* bus_space_read_X */
-
-u_int8_t
-hp300_isa_io_bsr1(bus_space_handle_t bsh, bus_size_t offset)
-{
- vaddr_t va;
- u_int8_t rc;
-
- REALIGN_IO_HANDLE(bsh, offset);
- va = (vaddr_t)bsh + ISAADDR(offset);
- rc = *(volatile u_int8_t *)va;
-#ifdef DEBUG
- printf("R%03x(%x):%02x\t", offset, va, rc);
-#endif
- return (rc);
-}
-
-u_int16_t
-__hp300_isa_io_bsr2(bus_space_handle_t bsh, bus_size_t offset)
-{
- u_int16_t rc;
- vaddr_t va;
-
- if (offset & 1) {
- rc = hp300_isa_io_bsr1(bsh, offset + 1) << 8;
- rc |= hp300_isa_io_bsr1(bsh, offset);
- } else {
- REALIGN_IO_HANDLE(bsh, offset);
- va = (vaddr_t)bsh + ISAADDR(offset);
- rc = *(volatile u_int16_t *)va;
- }
-#ifdef DEBUG
- printf("R%03x:%04x\t", offset, rc);
-#endif
- return (rc);
-}
-
-u_int16_t
-hp300_isa_io_bsr2(bus_space_handle_t bsh, bus_size_t offset)
-{
- u_int16_t rc;
-
- rc = __hp300_isa_io_bsr2(bsh, offset);
- return (letoh16(rc));
-}
-
-u_int32_t
-__hp300_isa_io_bsr4(bus_space_handle_t bsh, bus_size_t offset)
-{
- u_int32_t rc;
- vaddr_t va;
-
- if (offset & 3) {
- rc = hp300_isa_io_bsr1(bsh, offset + 3) << 24;
- rc |= hp300_isa_io_bsr1(bsh, offset + 2) << 16;
- rc |= hp300_isa_io_bsr1(bsh, offset + 1) << 8;
- rc |= hp300_isa_io_bsr1(bsh, offset);
- } else {
- REALIGN_IO_HANDLE(bsh, offset);
- va = (vaddr_t)bsh + ISAADDR(offset);
- rc = *(volatile u_int32_t *)va;
- }
-#ifdef DEBUG
- printf("R%03x:%08x\t", offset, rc);
-#endif
- return (rc);
-}
-
-u_int32_t
-hp300_isa_io_bsr4(bus_space_handle_t bsh, bus_size_t offset)
-{
- u_int32_t rc;
-
- rc = __hp300_isa_io_bsr4(bsh, offset);
- return (letoh32(rc));
-}
-
-/* bus_space_read_multi_X */
-
-void
-hp300_isa_io_bsrm1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0)
- *a++ = hp300_isa_io_bsr1(h, offset);
-}
-
-void
-hp300_isa_io_bsrm2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t *a, size_t c)
-{
- while ((int)--c >= 0)
- *a++ = hp300_isa_io_bsr2(h, offset);
-}
-
-void
-hp300_isa_io_bsrm4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t *a, size_t c)
-{
- while ((int)--c >= 0)
- *a++ = hp300_isa_io_bsr4(h, offset);
-}
-
-/* bus_space_read_raw_multi_X */
-
-void
-hp300_isa_io_bsrrm2(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- *(u_int16_t *)a = __hp300_isa_io_bsr2(h, offset);
- a += 2;
- }
-}
-
-void
-hp300_isa_io_bsrrm4(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- *(u_int32_t *)a = __hp300_isa_io_bsr4(h, offset);
- a += 4;
- }
-}
-
-/* bus_space_read_region_X */
-
-void
-hp300_isa_io_bsrr1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0)
- *a++ = hp300_isa_io_bsr1(h, offset++);
-}
-
-void
-hp300_isa_io_bsrr2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- *a++ = hp300_isa_io_bsr2(h, offset);
- offset += 2;
- }
-}
-
-void
-hp300_isa_io_bsrr4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- *a++ = hp300_isa_io_bsr4(h, offset);
- offset += 4;
- }
-}
-
-/* bus_space_read_raw_region_X */
-
-void
-hp300_isa_io_bsrrr2(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- c >>= 1;
- while ((int)--c >= 0) {
- *(u_int16_t *)a = __hp300_isa_io_bsr2(h, offset);
- offset += 2;
- a += 2;
- }
-}
-
-void
-hp300_isa_io_bsrrr4(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- c >>= 2;
- while ((int)--c >= 0) {
- *(u_int32_t *)a = __hp300_isa_io_bsr4(h, offset);
- offset += 4;
- a += 4;
- }
-}
-
-/* bus_space_write_X */
-
-void
-hp300_isa_io_bsw1(bus_space_handle_t h, bus_size_t offset, u_int8_t v)
-{
- vaddr_t va;
-
- REALIGN_IO_HANDLE(h, offset);
- va = (vaddr_t)h + ISAADDR(offset);
- *(volatile u_int8_t *)va = v;
-#ifdef DEBUG
- printf("W%03x:%02x\t", offset, v);
-#endif
-}
-
-void
-__hp300_isa_io_bsw2(bus_space_handle_t h, bus_size_t offset, u_int16_t v)
-{
- vaddr_t va;
-
- if (offset & 1) {
- hp300_isa_io_bsw1(h, offset + 1, v >> 8);
- hp300_isa_io_bsw1(h, offset, v);
- } else {
- REALIGN_IO_HANDLE(h, offset);
- va = (vaddr_t)h + ISAADDR(offset);
- *(volatile u_int16_t *)va = v;
- }
-#ifdef DEBUG
- printf("W%03x:%04x\t", offset, v);
-#endif
-}
-
-void
-hp300_isa_io_bsw2(bus_space_handle_t h, bus_size_t offset, u_int16_t v)
-{
- __hp300_isa_io_bsw2(h, offset, htole16(v));
-}
-
-void
-__hp300_isa_io_bsw4(bus_space_handle_t h, bus_size_t offset, u_int32_t v)
-{
- vaddr_t va;
-
- if (offset & 3) {
- hp300_isa_io_bsw1(h, offset + 3, v >> 24);
- hp300_isa_io_bsw1(h, offset + 2, v >> 16);
- hp300_isa_io_bsw1(h, offset + 1, v >> 8);
- hp300_isa_io_bsw1(h, offset, v);
- } else {
- REALIGN_IO_HANDLE(h, offset);
- va = (vaddr_t)h + ISAADDR(offset);
- *(volatile u_int32_t *)va = v;
- }
-#ifdef DEBUG
- printf("W%03x:%08x\t", offset, v);
-#endif
-}
-
-void
-hp300_isa_io_bsw4(bus_space_handle_t h, bus_size_t offset, u_int32_t v)
-{
- __hp300_isa_io_bsw4(h, offset, htole32(v));
-}
-
-/* bus_space_write_multi_X */
-
-void
-hp300_isa_io_bswm1(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw1(h, offset, *a++);
-}
-
-void
-hp300_isa_io_bswm2(bus_space_handle_t h, bus_size_t offset,
- const u_int16_t *a, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw2(h, offset, *a++);
-}
-
-void
-hp300_isa_io_bswm4(bus_space_handle_t h, bus_size_t offset,
- const u_int32_t *a, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw4(h, offset, *a++);
-}
-
-/* bus_space_write_raw_multi_X */
-
-void
-hp300_isa_io_bswrm2(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- __hp300_isa_io_bsw2(h, offset, *(u_int16_t *)a);
- a += 2;
- }
-}
-
-void
-hp300_isa_io_bswrm4(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- __hp300_isa_io_bsw4(h, offset, *(u_int32_t *)a);
- a += 4;
- }
-}
-
-/* bus_space_write_region_X */
-
-void
-hp300_isa_io_bswr1(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw1(h, offset++, *a++);
-}
-
-void
-hp300_isa_io_bswr2(bus_space_handle_t h, bus_size_t offset,
- const u_int16_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- hp300_isa_io_bsw2(h, offset, *a++);
- offset += 2;
- }
-}
-
-void
-hp300_isa_io_bswr4(bus_space_handle_t h, bus_size_t offset,
- const u_int32_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- hp300_isa_io_bsw4(h, offset, *a++);
- offset += 4;
- }
-}
-
-/* bus_space_write_raw_region_X */
-
-void
-hp300_isa_io_bswrr2(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- c >>= 1;
- while ((int)--c >= 0) {
- __hp300_isa_io_bsw2(h, offset, *(u_int16_t *)a);
- offset += 2;
- a += 2;
- }
-}
-
-void
-hp300_isa_io_bswrr4(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- c >>= 2;
- while ((int)--c >= 0) {
- __hp300_isa_io_bsw4(h, offset, *(u_int32_t *)a);
- offset += 4;
- a += 4;
- }
-}
-
-/* bus_space_set_multi_X */
-
-void
-hp300_isa_io_bssm1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t v, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw1(h, offset, v);
-}
-
-void
-hp300_isa_io_bssm2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t v, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw2(h, offset, v);
-}
-
-void
-hp300_isa_io_bssm4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t v, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw4(h, offset, v);
-}
-
-/* bus_space_set_region_X */
-
-void
-hp300_isa_io_bssr1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t v, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw1(h, offset++, v);
-}
-
-void
-hp300_isa_io_bssr2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t v, size_t c)
-{
- while ((int)--c >= 0) {
- hp300_isa_io_bsw2(h, offset, v);
- offset += 2;
- }
-}
-
-void
-hp300_isa_io_bssr4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t v, size_t c)
-{
- while ((int)--c >= 0) {
- hp300_isa_io_bsw4(h, offset, v);
- offset += 4;
- }
-}
-
-/*
- * ISA memory space
- */
-
-int hp300_isa_mem_map(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
-void hp300_isa_mem_unmap(bus_space_handle_t, bus_size_t);
-
-int
-hp300_isa_mem_map(bus_addr_t bpa, bus_size_t size, int flags,
- bus_space_handle_t *bshp)
-{
- int error;
- bus_addr_t membase;
- bus_size_t rsize;
- vaddr_t va;
- paddr_t pa;
- pt_entry_t template;
-
- /*
- * Reserve the range in the allocation extent.
- */
- if (bpa < IOM_BEGIN || bpa + size > IOM_END)
- return (ERANGE);
- error = extent_alloc_region(isabr->sc_mem_extent, bpa, size,
- EX_MALLOCOK);
- if (error != 0)
- return (error);
-
- /*
- * Allocate virtual address space to map this space in.
- */
- membase = trunc_page(bpa);
- rsize = round_page(bpa + size) - membase;
- va = uvm_km_valloc(kernel_map, rsize);
- if (va == 0) {
- extent_free(isabr->sc_mem_extent, bpa, size, EX_MALLOCOK);
- return (ENOMEM);
- }
-
- *bshp = (bus_space_handle_t)(va + (bpa - membase));
-
- pa = membase + (ISABR_IOMEM_BASE - IOM_BEGIN);
-
- if (flags & BUS_SPACE_MAP_CACHEABLE)
- template = PG_RW;
- else
- template = PG_RW | PG_CI;
-
- while (rsize != 0) {
- pmap_kenter_cache(va, pa, template);
- rsize -= PAGE_SIZE;
- va += PAGE_SIZE;
- pa += PAGE_SIZE;
- }
- pmap_update(pmap_kernel());
-
- return (0);
-}
-
-void
-hp300_isa_mem_unmap(bus_space_handle_t bsh, bus_size_t size)
-{
- vaddr_t va;
- vsize_t rsize;
-
- va = trunc_page((vaddr_t)bsh);
- rsize = round_page((vaddr_t)bsh + size) - va;
-
- pmap_kremove(va, rsize);
- pmap_update(pmap_kernel());
- uvm_km_free(kernel_map, va, rsize);
-
- (void)extent_free(isabr->sc_mem_extent, (u_long)bsh, size, EX_MALLOCOK);
-}
-
-struct hp300_bus_space_tag hp300_isa_mem_tag; /* will be filled in */
-
-/*
- * ISA bus_space initialization.
- * This creates the necessary accounting elements and initializes the
- * memory space bus_space_tag.
- */
-
-int
-isabr_bus_space_setup(struct isabr_softc *sc, struct frodo_attach_args *faa,
- struct isabus_attach_args *iba)
-{
- /*
- * Create the space extents.
- * We only use them to prevent multiple allocations of the same areas.
- */
-
- sc->sc_io_extent = extent_create("isa_io", IO_ISABEGIN,
- IO_ISAEND + 1, M_DEVBUF, NULL, 0, EX_NOWAIT | EX_MALLOCOK);
- if (sc->sc_io_extent == NULL)
- return (ENOMEM);
-
- sc->sc_mem_extent = extent_create("isa_mem", IOM_BEGIN,
- IOM_END, M_DEVBUF, NULL, 0, EX_NOWAIT | EX_MALLOCOK);
- if (sc->sc_mem_extent == NULL) {
- extent_destroy(sc->sc_io_extent);
- return (ENOMEM);
- }
-
- iba->iba_iot = &hp300_isa_io_tag;
- bcopy(faa->fa_tag, &hp300_isa_mem_tag,
- sizeof(struct hp300_bus_space_tag));
- hp300_isa_mem_tag.bs_map = hp300_isa_mem_map;
- hp300_isa_mem_tag.bs_unmap = hp300_isa_mem_unmap;
- iba->iba_memt = &hp300_isa_mem_tag;
-
- isabr = sc;
-
- return (0);
-}
diff --git a/sys/arch/hp300/dev/isabrreg.h b/sys/arch/hp300/dev/isabrreg.h
deleted file mode 100644
index 6881e91a0bf..00000000000
--- a/sys/arch/hp300/dev/isabrreg.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $OpenBSD: isabrreg.h,v 1.1 2007/01/06 20:17:43 miod Exp $ */
-
-/*
- * Copyright (c) 2007 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.
- */
-
-/*
- * Models 4xx ISA slot memory spaces
- */
-
-#define ISABR_IOMEM_BASE (0x30000000 + IOM_BEGIN)
-#define ISABR_IOMEM_END (0x30000000 + IOM_END)
-
-#define ISABR_IOPORT_BASE 0x30000000
-#define ISABR_IOPORT_END 0x30080000
-
-/*
- * Ye mighty logic by which ports are interleaved.
- * The actual scheme is more complex, to allow ports over 0x400 to be mapped
- * in bits 3-11 of the address. But we don't support the multi-slot EISA
- * bridges yet.
- */
-#define ISABR_IOPORT_LINE 0x08
-#define ISAADDR(p) \
- ((((p) & ~(ISABR_IOPORT_LINE - 1)) << 9) | ((p) & (ISABR_IOPORT_LINE - 1)))
-#define ISAPORT(a) \
- ((((a) >> 9) & ~(ISABR_IOPORT_LINE - 1)) | ((a) & (ISABR_IOPORT_LINE - 1)))
diff --git a/sys/arch/hp300/dev/maskbits.h b/sys/arch/hp300/dev/maskbits.h
deleted file mode 100644
index cca65807aff..00000000000
--- a/sys/arch/hp300/dev/maskbits.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $OpenBSD: maskbits.h,v 1.6 2006/08/05 09:58:56 miod Exp $ */
-/* $NetBSD: maskbits.h,v 1.3 1997/03/31 07:37:28 scottr 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 ("bfextu %3{%1:%2},%0" \
- : "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc)))
-
-#define FASTPUTBITS(src, x, w, pdst) \
- asm ("bfins %3,%0{%1:%2}" \
- : "=o" (*(char *)(pdst)) \
- : "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst)))
-
-#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \
-do { \
- unsigned int _tmpdst; \
- if (rop == RR_CLEAR) \
- _tmpdst = 0; \
- else \
- FASTGETBITS(psrc, srcbit, width, _tmpdst); \
- 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/hp300/dev/mb89352.c b/sys/arch/hp300/dev/mb89352.c
deleted file mode 100644
index 43cfdfc5fbc..00000000000
--- a/sys/arch/hp300/dev/mb89352.c
+++ /dev/null
@@ -1,2010 +0,0 @@
-/* $OpenBSD: mb89352.c,v 1.29 2011/09/18 19:23:46 miod Exp $ */
-/* $NetBSD: mb89352.c,v 1.5 2000/03/23 07:01:31 thorpej Exp $ */
-/* NecBSD: mb89352.c,v 1.4 1998/03/14 07:31:20 kmatsuda Exp */
-
-/*-
- * Copyright (c) 1996,97,98,99 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum, Masaru Oki and Kouichi Matsuda.
- *
- * 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 Charles M. Hannum.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * Copyright (c) 1994 Jarle Greipsland
- * 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.
- */
-/*
- * [NetBSD for NEC PC-98 series]
- * Copyright (c) 1996, 1997, 1998
- * NetBSD/pc98 porting staff. All rights reserved.
- * Copyright (c) 1996, 1997, 1998
- * Kouichi Matsuda. All rights reserved.
- */
-
-/*
- * Acknowledgements: Many of the algorithms used in this driver are
- * inspired by the work of Julian Elischer (julian@tfs.com) and
- * Charles Hannum (mycroft@duality.gnu.ai.mit.edu). Thanks a million!
- */
-
-/*
- * A few customizable items:
- */
-
-/* Synchronous data transfers? */
-#define SPC_USE_SYNCHRONOUS 0
-#define SPC_SYNC_REQ_ACK_OFS 8
-
-/* Wide data transfers? */
-#define SPC_USE_WIDE 0
-#define SPC_MAX_WIDTH 0
-
-/* Max attempts made to transmit a message */
-#define SPC_MSG_MAX_ATTEMPT 3 /* Not used now XXX */
-
-/*
- * Some spin loop parameters (essentially how long to wait some places)
- * The problem(?) is that sometimes we expect either to be able to transmit a
- * byte or to get a new one from the SCSI bus pretty soon. In order to avoid
- * returning from the interrupt just to get yanked back for the next byte we
- * may spin in the interrupt routine waiting for this byte to come. How long?
- * This is really (SCSI) device and processor dependent. Tunable, I guess.
- */
-#define SPC_MSGIN_SPIN 1 /* Will spinwait upto ?ms for a new msg byte */
-#define SPC_MSGOUT_SPIN 1
-
-/*
- * Include debug functions? At the end of this file there are a bunch of
- * functions that will print out various information regarding queued SCSI
- * commands, driver state and chip contents. You can call them from the
- * kernel debugger. If you set SPC_DEBUG to 0 they are not included (the
- * kernel uses less memory) but you lose the debugging facilities.
- */
-#if 0
-#define SPC_DEBUG
-#endif
-
-#define SPC_ABORT_TIMEOUT 2000 /* time to wait for abort */
-
-/* threshold length for DMA transfer */
-#define SPC_MIN_DMA_LEN 32
-
-/* End of customizable parameters */
-
-/*
- * MB89352 SCSI Protocol Controller (SPC) routines.
- */
-
-#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/queue.h>
-
-#include <machine/intr.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsi_message.h>
-#include <scsi/scsiconf.h>
-
-#include <hp300/dev/mb89352reg.h>
-#include <hp300/dev/mb89352var.h>
-
-#ifdef SPC_DEBUG
-int spc_debug = 0x00; /* SPC_SHOWSTART|SPC_SHOWMISC|SPC_SHOWTRACE; */
-#endif
-
-void spc_done (struct spc_softc *, struct spc_acb *);
-void spc_dequeue (struct spc_softc *, struct spc_acb *);
-void spc_scsi_cmd (struct scsi_xfer *);
-int spc_poll (struct spc_softc *, struct scsi_xfer *, int);
-void spc_sched_msgout(struct spc_softc *, u_char);
-void spc_setsync(struct spc_softc *, struct spc_tinfo *);
-void spc_select (struct spc_softc *, struct spc_acb *);
-void spc_timeout (void *);
-void spc_scsi_reset (struct spc_softc *);
-void spc_acb_free (void *, void *);
-void *spc_acb_alloc(void *);
-int spc_reselect (struct spc_softc *, int);
-void spc_sense (struct spc_softc *, struct spc_acb *);
-void spc_msgin (struct spc_softc *);
-void spc_abort (struct spc_softc *, struct spc_acb *);
-void spc_msgout (struct spc_softc *);
-int spc_dataout_pio (struct spc_softc *, u_char *, int);
-int spc_datain_pio (struct spc_softc *, u_char *, int);
-void spc_process_intr(void *, u_char);
-#ifdef SPC_DEBUG
-void spc_print_acb (struct spc_acb *);
-void spc_dump_driver (struct spc_softc *);
-void spc_dump89352 (struct spc_softc *);
-void spc_show_scsi_cmd(struct spc_acb *);
-void spc_print_active_acb(void);
-#endif
-
-extern struct cfdriver spc_cd;
-
-struct scsi_adapter spc_switch = {
- spc_scsi_cmd,
- scsi_minphys,
- NULL,
- NULL
-};
-
-/*
- * INITIALIZATION ROUTINES (probe, attach ++)
- */
-
-void
-spc_attach(struct spc_softc *sc)
-{
- struct scsibus_attach_args saa;
-
- SPC_TRACE(("spc_attach "));
- sc->sc_state = SPC_INIT;
-
- sc->sc_freq = 20; /* XXX Assume 20 MHz. */
-
-#if SPC_USE_SYNCHRONOUS
- /*
- * These are the bounds of the sync period, based on the frequency of
- * the chip's clock input and the size and offset of the sync period
- * register.
- *
- * For a 20MHz clock, this gives us 25, or 100nS, or 10MB/s, as a
- * maximum transfer rate, and 112.5, or 450nS, or 2.22MB/s, as a
- * minimum transfer rate.
- */
- sc->sc_minsync = (2 * 250) / sc->sc_freq;
- sc->sc_maxsync = (9 * 250) / sc->sc_freq;
-#endif
-
- spc_init(sc); /* Init chip and driver */
-
- /*
- * Fill in the adapter.
- */
- sc->sc_link.adapter_softc = sc;
- sc->sc_link.adapter_target = sc->sc_initiator;
- sc->sc_link.adapter = &spc_switch;
- sc->sc_link.openings = 2;
- sc->sc_link.pool = &sc->sc_iopool;
-
- bzero(&saa, sizeof(saa));
- saa.saa_sc_link = &sc->sc_link;
-
- /*
- * ask the adapter what subunits are present
- */
- config_found(&sc->sc_dev, &saa, scsiprint);
-}
-
-/*
- * Initialize the MB89352 chip itself.
- */
-void
-spc_reset(struct spc_softc *sc)
-{
- SPC_TRACE(("spc_reset "));
- /*
- * Disable interrupts then reset the FUJITSU chip.
- */
- spc_write(SCTL, SCTL_DISABLE | SCTL_CTRLRST);
- spc_write(SCMD, 0);
- spc_write(TMOD, 0);
- spc_write(PCTL, 0);
- spc_write(TEMP, 0);
- spc_write(TCH, 0);
- spc_write(TCM, 0);
- spc_write(TCL, 0);
- spc_write(INTS, 0);
- spc_write(SCTL, sc->sc_ctlflags |
- SCTL_DISABLE | SCTL_ABRT_ENAB | SCTL_SEL_ENAB | SCTL_RESEL_ENAB);
- spc_write(BDID, sc->sc_initiator);
- delay(400);
- spc_write(SCTL, spc_read(SCTL) & ~SCTL_DISABLE);
-}
-
-
-/*
- * Pull the SCSI RST line for 500us.
- */
-void
-spc_scsi_reset(struct spc_softc *sc)
-{
- SPC_TRACE(("spc_scsi_reset "));
- spc_write(SCMD, spc_read(SCMD) | SCMD_RST);
- delay(500);
- spc_write(SCMD, spc_read(SCMD) & ~SCMD_RST);
- delay(50);
-}
-
-/*
- * Initialize spc SCSI driver.
- */
-void
-spc_init(struct spc_softc *sc)
-{
- struct spc_acb *acb;
- int r;
-
- SPC_TRACE(("spc_init "));
- (*sc->sc_reset)(sc);
- spc_scsi_reset(sc);
- (*sc->sc_reset)(sc);
-
- if (sc->sc_state == SPC_INIT) {
- /* First time through; initialize. */
- TAILQ_INIT(&sc->ready_list);
- TAILQ_INIT(&sc->nexus_list);
- TAILQ_INIT(&sc->free_list);
- mtx_init(&sc->sc_acb_mtx, IPL_BIO);
- scsi_iopool_init(&sc->sc_iopool, sc, spc_acb_alloc,
- spc_acb_free);
- sc->sc_nexus = NULL;
- acb = sc->sc_acb;
- bzero(acb, sizeof(sc->sc_acb));
- for (r = 0; r < sizeof(sc->sc_acb) / sizeof(*acb); r++) {
- TAILQ_INSERT_TAIL(&sc->free_list, acb, chain);
- acb++;
- }
- bzero(&sc->sc_tinfo, sizeof(sc->sc_tinfo));
- } else {
- /* Cancel any active commands. */
- sc->sc_state = SPC_CLEANING;
- if ((acb = sc->sc_nexus) != NULL) {
- acb->xs->error = XS_DRIVER_STUFFUP;
- spc_done(sc, acb);
- }
- while ((acb = TAILQ_FIRST(&sc->nexus_list)) != NULL) {
- acb->xs->error = XS_DRIVER_STUFFUP;
- spc_done(sc, acb);
- }
- }
-
- sc->sc_prevphase = PH_INVALID;
- for (r = 0; r < 8; r++) {
- struct spc_tinfo *ti = &sc->sc_tinfo[r];
-
- ti->flags = 0;
-#if SPC_USE_SYNCHRONOUS
- ti->flags |= DO_SYNC;
- ti->period = sc->sc_minsync;
- ti->offset = SPC_SYNC_REQ_ACK_OFS;
-#else
- ti->period = ti->offset = 0;
-#endif
-#if SPC_USE_WIDE
- ti->flags |= DO_WIDE;
- ti->width = SPC_MAX_WIDTH;
-#else
- ti->width = 0;
-#endif
- }
-
- sc->sc_state = SPC_IDLE;
- spc_write(SCTL, spc_read(SCTL) | SCTL_INTR_ENAB);
-}
-
-void
-spc_acb_free(void *xsc, void *xacb)
-{
- struct spc_softc *sc = xsc;
- struct spc_acb *acb = xacb;
-
- SPC_TRACE(("spc_acb_free "));
-
- acb->flags = 0;
-
- mtx_enter(&sc->sc_acb_mtx);
- TAILQ_INSERT_HEAD(&sc->free_list, acb, chain);
- mtx_leave(&sc->sc_acb_mtx);
-}
-
-void *
-spc_acb_alloc(void *xsc)
-{
- struct spc_softc *sc = xsc;
- struct spc_acb *acb;
-
- SPC_TRACE(("spc_acb_alloc "));
-
- mtx_enter(&sc->sc_acb_mtx);
- acb = TAILQ_FIRST(&sc->free_list);
- if (acb)
- TAILQ_REMOVE(&sc->free_list, acb, chain);
- mtx_leave(&sc->sc_acb_mtx);
-
- return acb;
-}
-
-/*
- * DRIVER FUNCTIONS CALLABLE FROM HIGHER LEVEL DRIVERS
- */
-
-/*
- * Expected sequence:
- * 1) Command inserted into ready list
- * 2) Command selected for execution
- * 3) Command won arbitration and has selected target device
- * 4) Send message out (identify message, eventually also sync.negotiations)
- * 5) Send command
- * 5a) Receive disconnect message, disconnect.
- * 5b) Reselected by target
- * 5c) Receive identify message from target.
- * 6) Send or receive data
- * 7) Receive status
- * 8) Receive message (command complete etc.)
- * 9) If status == SCSI_CHECK construct a synthetic request sense SCSI cmd.
- * Repeat 2-8 (no disconnects please...)
- */
-
-/*
- * Start a SCSI-command
- * This function is called by the higher level SCSI-driver to queue/run
- * SCSI-commands.
- */
-void
-spc_scsi_cmd(struct scsi_xfer *xs)
-{
- struct scsi_link *sc_link = xs->sc_link;
- struct spc_softc *sc = sc_link->adapter_softc;
- struct spc_acb *acb;
- int s, flags;
-
- SPC_TRACE(("spc_scsi_cmd "));
- SPC_CMDS(("[0x%x, %d]->%d ", (int)xs->cmd->opcode, xs->cmdlen,
- sc_link->target));
-
- flags = xs->flags;
- acb = xs->io;
-
- /* Initialize acb */
- acb->xs = xs;
- acb->timeout = xs->timeout;
- timeout_set(&xs->stimeout, spc_timeout, acb);
-
- if (xs->flags & SCSI_RESET) {
- acb->flags |= ACB_RESET;
- acb->scsi_cmd_length = 0;
- acb->data_length = 0;
- } else {
- bcopy(xs->cmd, &acb->scsi_cmd, xs->cmdlen);
- acb->scsi_cmd_length = xs->cmdlen;
- acb->data_addr = xs->data;
- acb->data_length = xs->datalen;
- }
- acb->target_stat = 0;
-
- s = splbio();
-
- TAILQ_INSERT_TAIL(&sc->ready_list, acb, chain);
- /*
- * Start scheduling unless a queue process is in progress.
- */
- if (sc->sc_state == SPC_IDLE)
- spc_sched(sc);
- /*
- * After successful sending, check if we should return just now.
- */
-
- splx(s);
-
- if ((flags & SCSI_POLL) == 0)
- return;
-
- /* Not allowed to use interrupts, use polling instead */
- s = splbio();
- if (spc_poll(sc, xs, acb->timeout)) {
- spc_timeout(acb);
- if (spc_poll(sc, xs, acb->timeout))
- spc_timeout(acb);
- }
- splx(s);
-}
-
-/*
- * Used when interrupt driven I/O isn't allowed, e.g. during boot.
- */
-int
-spc_poll(struct spc_softc *sc, struct scsi_xfer *xs, int count)
-{
- u_char intr;
-
- SPC_TRACE(("spc_poll "));
- while (count) {
- /*
- * If we had interrupts enabled, would we
- * have got an interrupt?
- */
- intr = spc_read(INTS);
- if (intr != 0)
- spc_process_intr(sc, intr);
- if ((xs->flags & ITSDONE) != 0)
- return 0;
- delay(1000);
- count--;
- }
- return 1;
-}
-
-/*
- * LOW LEVEL SCSI UTILITIES
- */
-
-void
-spc_sched_msgout(struct spc_softc *sc, u_char m)
-{
- SPC_TRACE(("spc_sched_msgout "));
- if (sc->sc_msgpriq == 0)
- spc_write(SCMD, SCMD_SET_ATN);
- sc->sc_msgpriq |= m;
-}
-
-/*
- * Set synchronous transfer offset and period.
- */
-void
-spc_setsync(struct spc_softc *sc, struct spc_tinfo *ti)
-{
-#if SPC_USE_SYNCHRONOUS
- SPC_TRACE(("spc_setsync "));
- if (ti->offset != 0)
- spc_write(TMOD,
- ((ti->period * sc->sc_freq) / 250 - 2) << 4 | ti->offset);
- else
- spc_write(TMOD, 0);
-#endif
-}
-
-/*
- * Start a selection. This is used by spc_sched() to select an idle target,
- * and by spc_done() to immediately reselect a target to get sense information.
- */
-void
-spc_select(struct spc_softc *sc, struct spc_acb *acb)
-{
- struct scsi_link *sc_link = acb->xs->sc_link;
- int target = sc_link->target;
- struct spc_tinfo *ti = &sc->sc_tinfo[target];
-
- SPC_TRACE(("spc_select "));
- spc_setsync(sc, ti);
-
-#if 0
- spc_write(SCMD, SCMD_SET_ATN);
-#endif
-
- spc_write(PCTL, 0);
- spc_write(TEMP, (1 << sc->sc_initiator) | (1 << target));
-
- /*
- * Setup BSY timeout (selection timeout).
- * 250ms according to the SCSI specification.
- * T = (X * 256 + 15) * Tclf * 2 (Tclf = 200ns on x68k)
- * To setup 256ms timeout,
- * 128000ns/200ns = X * 256 + 15
- * 640 - 15 = X * 256
- * X = 625 / 256
- * X = 2 + 113 / 256
- * ==> tch = 2, tcm = 113 (correct?)
- */
- /* Time to the information transfer phase start. */
- /* XXX These values should be calculated from sc_freq */
- spc_write(TCH, 2);
- spc_write(TCM, 113);
- spc_write(TCL, 3);
- spc_write(SCMD, SCMD_SELECT);
-
- sc->sc_state = SPC_SELECTING;
-}
-
-int
-spc_reselect(struct spc_softc *sc, int message)
-{
- u_char selid, target, lun;
- struct spc_acb *acb;
- struct scsi_link *sc_link;
- struct spc_tinfo *ti;
-
- SPC_TRACE(("spc_reselect "));
- /*
- * The SCSI chip made a snapshot of the data bus while the reselection
- * was being negotiated. This enables us to determine which target did
- * the reselect.
- */
- selid = sc->sc_selid & ~(1 << sc->sc_initiator);
- if (selid & (selid - 1)) {
- printf("%s: reselect with invalid selid %02x; "
- "sending DEVICE RESET\n", sc->sc_dev.dv_xname, selid);
- SPC_BREAK();
- goto reset;
- }
-
- /*
- * Search wait queue for disconnected cmd
- * The list should be short, so I haven't bothered with
- * any more sophisticated structures than a simple
- * singly linked list.
- */
- target = ffs(selid) - 1;
- lun = message & 0x07;
- TAILQ_FOREACH(acb, &sc->nexus_list, chain) {
- sc_link = acb->xs->sc_link;
- if (sc_link->target == target &&
- sc_link->lun == lun)
- break;
- }
- if (acb == NULL) {
- printf("%s: reselect from target %d lun %d with no nexus; "
- "sending ABORT\n", sc->sc_dev.dv_xname, target, lun);
- SPC_BREAK();
- goto abort;
- }
-
- /* Make this nexus active again. */
- TAILQ_REMOVE(&sc->nexus_list, acb, chain);
- sc->sc_state = SPC_CONNECTED;
- sc->sc_nexus = acb;
- ti = &sc->sc_tinfo[target];
- ti->lubusy |= (1 << lun);
- spc_setsync(sc, ti);
-
- if (acb->flags & ACB_RESET)
- spc_sched_msgout(sc, SEND_DEV_RESET);
- else if (acb->flags & ACB_ABORT)
- spc_sched_msgout(sc, SEND_ABORT);
-
- /* Do an implicit RESTORE POINTERS. */
- sc->sc_dp = acb->data_addr;
- sc->sc_dleft = acb->data_length;
- sc->sc_cp = (u_char *)&acb->scsi_cmd;
- sc->sc_cleft = acb->scsi_cmd_length;
-
- return (0);
-
-reset:
- spc_sched_msgout(sc, SEND_DEV_RESET);
- return (1);
-
-abort:
- spc_sched_msgout(sc, SEND_ABORT);
- return (1);
-}
-
-/*
- * Schedule a SCSI operation. This has now been pulled out of the interrupt
- * handler so that we may call it from spc_scsi_cmd and spc_done. This may
- * save us an unnecessary interrupt just to get things going. Should only be
- * called when state == SPC_IDLE and at bio ipl.
- */
-void
-spc_sched(struct spc_softc *sc)
-{
- struct spc_acb *acb;
- struct scsi_link *sc_link;
- struct spc_tinfo *ti;
-
- splassert(IPL_BIO);
-
- /* missing the hw, just return and wait for our hw */
- if (sc->sc_flags & SPC_INACTIVE)
- return;
- SPC_TRACE(("spc_sched "));
- /*
- * Find first acb in ready queue that is for a target/lunit pair that
- * is not busy.
- */
- TAILQ_FOREACH(acb, &sc->ready_list, chain) {
- sc_link = acb->xs->sc_link;
- ti = &sc->sc_tinfo[sc_link->target];
- if ((ti->lubusy & (1 << sc_link->lun)) == 0) {
- SPC_MISC(("selecting %d:%d ",
- sc_link->target, sc_link->lun));
- TAILQ_REMOVE(&sc->ready_list, acb, chain);
- sc->sc_nexus = acb;
- spc_select(sc, acb);
- return;
- } else
- SPC_MISC(("%d:%d busy\n",
- sc_link->target, sc_link->lun));
- }
- SPC_MISC(("idle "));
- /* Nothing to start; just enable reselections and wait. */
-}
-
-void
-spc_sense(struct spc_softc *sc, struct spc_acb *acb)
-{
- struct scsi_xfer *xs = acb->xs;
- struct scsi_link *sc_link = xs->sc_link;
- struct spc_tinfo *ti = &sc->sc_tinfo[sc_link->target];
- struct scsi_sense *ss = (void *)&acb->scsi_cmd;
-
- SPC_MISC(("requesting sense "));
- /* Next, setup a request sense command block */
- bzero(ss, sizeof(*ss));
- ss->opcode = REQUEST_SENSE;
- ss->byte2 = sc_link->lun << 5;
- ss->length = sizeof(struct scsi_sense_data);
- acb->scsi_cmd_length = sizeof(*ss);
- acb->data_addr = (char *)&xs->sense;
- acb->data_length = sizeof(struct scsi_sense_data);
- acb->flags |= ACB_SENSE;
- ti->senses++;
- if (acb->flags & ACB_NEXUS)
- ti->lubusy &= ~(1 << sc_link->lun);
- if (acb == sc->sc_nexus) {
- spc_select(sc, acb);
- } else {
- spc_dequeue(sc, acb);
- TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
- if (sc->sc_state == SPC_IDLE)
- spc_sched(sc);
- }
-}
-
-/*
- * POST PROCESSING OF SCSI_CMD (usually current)
- */
-void
-spc_done(struct spc_softc *sc, struct spc_acb *acb)
-{
- struct scsi_xfer *xs = acb->xs;
- struct scsi_link *sc_link = xs->sc_link;
- struct spc_tinfo *ti = &sc->sc_tinfo[sc_link->target];
-
- SPC_TRACE(("spc_done "));
-
- timeout_del(&acb->xs->stimeout);
-
- /*
- * Now, if we've come here with no error code, i.e. we've kept the
- * initial XS_NOERROR, and the status code signals that we should
- * check sense, we'll need to set up a request sense cmd block and
- * push the command back into the ready queue *before* any other
- * commands for this target/lunit, else we lose the sense info.
- * We don't support chk sense conditions for the request sense cmd.
- */
- if (xs->error == XS_NOERROR) {
- if (acb->flags & ACB_ABORT) {
- xs->error = XS_DRIVER_STUFFUP;
- } else if (acb->flags & ACB_SENSE) {
- xs->error = XS_SENSE;
- } else {
- switch (acb->target_stat) {
- case SCSI_CHECK:
- /* First, save the return values */
- xs->resid = acb->data_length;
- xs->status = acb->target_stat;
- spc_sense(sc, acb);
- return;
- case SCSI_BUSY:
- xs->error = XS_BUSY;
- break;
- case SCSI_OK:
- xs->resid = acb->data_length;
- break;
- default:
- xs->error = XS_DRIVER_STUFFUP;
-#ifdef SPC_DEBUG
- printf("%s: spc_done: bad stat 0x%x\n",
- sc->sc_dev.dv_xname, acb->target_stat);
-#endif
- break;
- }
- }
- }
-
-#ifdef SPC_DEBUG
- if ((spc_debug & SPC_SHOWMISC) != 0) {
- if (xs->resid != 0)
- printf("resid=%d ", xs->resid);
- if (xs->error == XS_SENSE)
- printf("sense=0x%02x\n", xs->sense.error_code);
- else
- printf("error=%d\n", xs->error);
- }
-#endif
-
- /*
- * Remove the ACB from whatever queue it happens to be on.
- */
- if (acb->flags & ACB_NEXUS)
- ti->lubusy &= ~(1 << sc_link->lun);
- if (acb == sc->sc_nexus) {
- sc->sc_nexus = NULL;
- sc->sc_state = SPC_IDLE;
- spc_sched(sc);
- } else
- spc_dequeue(sc, acb);
-
- ti->cmds++;
- scsi_done(xs);
-}
-
-void
-spc_dequeue(struct spc_softc *sc, struct spc_acb *acb)
-{
- SPC_TRACE(("spc_dequeue "));
- if (acb->flags & ACB_NEXUS)
- TAILQ_REMOVE(&sc->nexus_list, acb, chain);
- else
- TAILQ_REMOVE(&sc->ready_list, acb, chain);
-}
-
-/*
- * INTERRUPT/PROTOCOL ENGINE
- */
-
-/*
- * Precondition:
- * The SCSI bus is already in the MSGI phase and there is a message byte
- * on the bus, along with an asserted REQ signal.
- */
-void
-spc_msgin(struct spc_softc *sc)
-{
- int n;
- u_int8_t msg;
-
- SPC_TRACE(("spc_msgin "));
-
- if (sc->sc_prevphase == PH_MSGIN) {
- /* This is a continuation of the previous message. */
- n = sc->sc_imp - sc->sc_imess;
- goto nextbyte;
- }
-
- /* This is a new MESSAGE IN phase. Clean up our state. */
- sc->sc_flags &= ~SPC_DROP_MSGIN;
-
-nextmsg:
- n = 0;
- sc->sc_imp = &sc->sc_imess[n];
-
-nextbyte:
- /*
- * Read a whole message, but don't ack the last byte. If we reject the
- * message, we have to assert ATN during the message transfer phase
- * itself.
- */
- for (;;) {
- /* If parity error, just dump everything on the floor. */
- if ((spc_read(SERR) & (SERR_SCSI_PAR|SERR_SPC_PAR)) != 0) {
- sc->sc_flags |= SPC_DROP_MSGIN;
- spc_sched_msgout(sc, SEND_PARITY_ERROR);
- }
-
- if ((spc_read(PSNS) & PSNS_ATN) != 0)
- spc_write(SCMD, SCMD_RST_ATN);
- spc_write(PCTL, PCTL_BFINT_ENAB | PH_MSGIN);
-
- while ((spc_read(PSNS) & PSNS_REQ) == 0) {
- if (((spc_read(PSNS) & PH_MASK) != PH_MSGIN &&
- (spc_read(SSTS) & SSTS_INITIATOR) == 0) ||
- spc_read(INTS) != 0)
- /*
- * Target left MESSAGE IN, probably because it
- * a) noticed our ATN signal, or
- * b) ran out of messages.
- */
- goto out;
- DELAY(1);
- }
-
- msg = spc_read(TEMP);
-
- /* Gather incoming message bytes if needed. */
- if ((sc->sc_flags & SPC_DROP_MSGIN) == 0) {
- if (n >= SPC_MAX_MSG_LEN) {
- sc->sc_flags |= SPC_DROP_MSGIN;
- spc_sched_msgout(sc, SEND_REJECT);
- } else {
- *sc->sc_imp++ = msg;
- n++;
- /*
- * This testing is suboptimal, but most
- * messages will be of the one byte variety, so
- * it should not affect performance
- * significantly.
- */
- if (n == 1 && IS1BYTEMSG(sc->sc_imess[0]))
- break;
- if (n == 2 && IS2BYTEMSG(sc->sc_imess[0]))
- break;
- if (n >= 3 && ISEXTMSG(sc->sc_imess[0]) &&
- n == sc->sc_imess[1] + 2)
- break;
- }
- }
-
- /*
- * If we reach this spot we're either:
- * a) in the middle of a multi-byte message, or
- * b) dropping bytes.
- */
-
- /* Ack the last byte read. */
- spc_write(SCMD, SCMD_SET_ACK);
- while ((spc_read(PSNS) & PSNS_REQ) != 0)
- DELAY(1); /* XXX needs timeout */
- spc_write(SCMD, SCMD_RST_ACK);
- }
-
- SPC_MISC(("n=%d imess=0x%02x ", n, sc->sc_imess[0]));
-
- /* We now have a complete message. Parse it. */
- switch (sc->sc_state) {
- struct spc_acb *acb;
- struct scsi_link *sc_link;
- struct spc_tinfo *ti;
-
- case SPC_CONNECTED:
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
- ti = &sc->sc_tinfo[acb->xs->sc_link->target];
-
- switch (sc->sc_imess[0]) {
- case MSG_CMDCOMPLETE:
- if (sc->sc_dleft < 0) {
- sc_link = acb->xs->sc_link;
- printf("%s: %d extra bytes from %d:%d\n",
- sc->sc_dev.dv_xname, -sc->sc_dleft,
- sc_link->target, sc_link->lun);
- sc->sc_dleft = 0;
- }
- acb->xs->resid = acb->data_length = sc->sc_dleft;
- sc->sc_state = SPC_CMDCOMPLETE;
- break;
-
- case MSG_PARITY_ERROR:
- /* Resend the last message. */
- spc_sched_msgout(sc, sc->sc_lastmsg);
- break;
-
- case MSG_MESSAGE_REJECT:
- SPC_MISC(("message rejected %02x ", sc->sc_lastmsg));
- switch (sc->sc_lastmsg) {
-#if SPC_USE_SYNCHRONOUS + SPC_USE_WIDE
- case SEND_IDENTIFY:
- ti->flags &= ~(DO_SYNC | DO_WIDE);
- ti->period = ti->offset = 0;
- spc_setsync(sc, ti);
- ti->width = 0;
- break;
-#endif
-#if SPC_USE_SYNCHRONOUS
- case SEND_SDTR:
- ti->flags &= ~DO_SYNC;
- ti->period = ti->offset = 0;
- spc_setsync(sc, ti);
- break;
-#endif
-#if SPC_USE_WIDE
- case SEND_WDTR:
- ti->flags &= ~DO_WIDE;
- ti->width = 0;
- break;
-#endif
- case SEND_INIT_DET_ERR:
- spc_sched_msgout(sc, SEND_ABORT);
- break;
- }
- break;
-
- case MSG_NOOP:
- break;
-
- case MSG_DISCONNECT:
- ti->dconns++;
- sc->sc_state = SPC_DISCONNECT;
- break;
-
- case MSG_SAVEDATAPOINTER:
- acb->data_addr = sc->sc_dp;
- acb->data_length = sc->sc_dleft;
- break;
-
- case MSG_RESTOREPOINTERS:
- sc->sc_dp = acb->data_addr;
- sc->sc_dleft = acb->data_length;
- sc->sc_cp = (u_char *)&acb->scsi_cmd;
- sc->sc_cleft = acb->scsi_cmd_length;
- break;
-
- case MSG_EXTENDED:
- switch (sc->sc_imess[2]) {
-#if SPC_USE_SYNCHRONOUS
- case MSG_EXT_SDTR:
- if (sc->sc_imess[1] != 3)
- goto reject;
- ti->period = sc->sc_imess[3];
- ti->offset = sc->sc_imess[4];
- ti->flags &= ~DO_SYNC;
- if (ti->offset == 0) {
- } else if (ti->period < sc->sc_minsync ||
- ti->period > sc->sc_maxsync ||
- ti->offset > 8) {
- ti->period = ti->offset = 0;
- spc_sched_msgout(sc, SEND_SDTR);
- } else {
- sc_print_addr(acb->xs->sc_link);
- printf("sync, offset %d, "
- "period %dnsec\n",
- ti->offset, ti->period * 4);
- }
- spc_setsync(sc, ti);
- break;
-#endif
-
-#if SPC_USE_WIDE
- case MSG_EXT_WDTR:
- if (sc->sc_imess[1] != 2)
- goto reject;
- ti->width = sc->sc_imess[3];
- ti->flags &= ~DO_WIDE;
- if (ti->width == 0) {
- } else if (ti->width > SPC_MAX_WIDTH) {
- ti->width = 0;
- spc_sched_msgout(sc, SEND_WDTR);
- } else {
- sc_print_addr(acb->xs->sc_link);
- printf("wide, width %d\n",
- 1 << (3 + ti->width));
- }
- break;
-#endif
-
- default:
- printf("%s: unrecognized MESSAGE EXTENDED 0x%x;"
- " sending REJECT\n",
- sc->sc_dev.dv_xname, sc->sc_imess[2]);
- SPC_BREAK();
- goto reject;
- }
- break;
-
- default:
- printf("%s: unrecognized MESSAGE; sending REJECT\n",
- sc->sc_dev.dv_xname);
- SPC_BREAK();
- reject:
- spc_sched_msgout(sc, SEND_REJECT);
- break;
- }
- break;
-
- case SPC_RESELECTED:
- if (!MSG_ISIDENTIFY(sc->sc_imess[0])) {
- printf("%s: reselect without IDENTIFY; "
- "sending DEVICE RESET\n", sc->sc_dev.dv_xname);
- SPC_BREAK();
- goto reset;
- }
-
- (void) spc_reselect(sc, sc->sc_imess[0]);
- break;
-
- default:
- printf("%s: unexpected MESSAGE IN; sending DEVICE RESET\n",
- sc->sc_dev.dv_xname);
- SPC_BREAK();
- reset:
- spc_sched_msgout(sc, SEND_DEV_RESET);
- break;
-
-#ifdef notdef
- abort:
- spc_sched_msgout(sc, SEND_ABORT);
- break;
-#endif
- }
-
- /* Ack the last message byte. */
- spc_write(SCMD, SCMD_SET_ACK);
- while ((spc_read(PSNS) & PSNS_REQ) != 0)
- DELAY(1); /* XXX needs timeout */
- spc_write(SCMD, SCMD_RST_ACK);
-
- /* Go get the next message, if any. */
- goto nextmsg;
-
-out:
- SPC_MISC(("n=%d imess=0x%02x ", n, sc->sc_imess[0]));
-}
-
-/*
- * Send the highest priority, scheduled message.
- */
-void
-spc_msgout(struct spc_softc *sc)
-{
-#if SPC_USE_SYNCHRONOUS
- struct spc_tinfo *ti;
-#endif
- int n;
-
- SPC_TRACE(("spc_msgout "));
-
- if (sc->sc_prevphase == PH_MSGOUT) {
- if (sc->sc_omp == sc->sc_omess) {
- /*
- * This is a retransmission.
- *
- * We get here if the target stayed in MESSAGE OUT
- * phase. Section 5.1.9.2 of the SCSI 2 spec indicates
- * that all of the previously transmitted messages must
- * be sent again, in the same order. Therefore, we
- * requeue all the previously transmitted messages, and
- * start again from the top. Our simple priority
- * scheme keeps the messages in the right order.
- */
- SPC_MISC(("retransmitting "));
- sc->sc_msgpriq |= sc->sc_msgoutq;
- /*
- * Set ATN. If we're just sending a trivial 1-byte
- * message, we'll clear ATN later on anyway.
- */
- spc_write(SCMD, SCMD_SET_ATN); /* XXX? */
- } else {
- /* This is a continuation of the previous message. */
- n = sc->sc_omp - sc->sc_omess;
- goto nextbyte;
- }
- }
-
- /* No messages transmitted so far. */
- sc->sc_msgoutq = 0;
- sc->sc_lastmsg = 0;
-
-nextmsg:
- /* Pick up highest priority message. */
- sc->sc_currmsg = sc->sc_msgpriq & -sc->sc_msgpriq;
- sc->sc_msgpriq &= ~sc->sc_currmsg;
- sc->sc_msgoutq |= sc->sc_currmsg;
-
- /* Build the outgoing message data. */
- switch (sc->sc_currmsg) {
- case SEND_IDENTIFY:
- SPC_ASSERT(sc->sc_nexus != NULL);
- sc->sc_omess[0] =
- MSG_IDENTIFY(sc->sc_nexus->xs->sc_link->lun, 1);
- n = 1;
- break;
-
-#if SPC_USE_SYNCHRONOUS
- case SEND_SDTR:
- SPC_ASSERT(sc->sc_nexus != NULL);
- ti = &sc->sc_tinfo[sc->sc_nexus->xs->sc_link->target];
- sc->sc_omess[4] = MSG_EXTENDED;
- sc->sc_omess[3] = MSG_EXT_SDTR_LEN;
- sc->sc_omess[2] = MSG_EXT_SDTR;
- sc->sc_omess[1] = ti->period >> 2;
- sc->sc_omess[0] = ti->offset;
- n = 5;
- break;
-#endif
-
-#if SPC_USE_WIDE
- case SEND_WDTR:
- SPC_ASSERT(sc->sc_nexus != NULL);
- ti = &sc->sc_tinfo[sc->sc_nexus->xs->sc_link->target];
- sc->sc_omess[3] = MSG_EXTENDED;
- sc->sc_omess[2] = MSG_EXT_WDTR_LEN;
- sc->sc_omess[1] = MSG_EXT_WDTR;
- sc->sc_omess[0] = ti->width;
- n = 4;
- break;
-#endif
-
- case SEND_DEV_RESET:
- sc->sc_flags |= SPC_ABORTING;
- sc->sc_omess[0] = MSG_BUS_DEV_RESET;
- n = 1;
- break;
-
- case SEND_REJECT:
- sc->sc_omess[0] = MSG_MESSAGE_REJECT;
- n = 1;
- break;
-
- case SEND_PARITY_ERROR:
- sc->sc_omess[0] = MSG_PARITY_ERROR;
- n = 1;
- break;
-
- case SEND_INIT_DET_ERR:
- sc->sc_omess[0] = MSG_INITIATOR_DET_ERR;
- n = 1;
- break;
-
- case SEND_ABORT:
- sc->sc_flags |= SPC_ABORTING;
- sc->sc_omess[0] = MSG_ABORT;
- n = 1;
- break;
-
- default:
- printf("%s: unexpected MESSAGE OUT; sending NOOP\n",
- sc->sc_dev.dv_xname);
- SPC_BREAK();
- sc->sc_omess[0] = MSG_NOOP;
- n = 1;
- break;
- }
- sc->sc_omp = &sc->sc_omess[n];
-
-nextbyte:
- /* Send message bytes. */
- /* send TRANSFER command. */
- spc_write(TCH, n >> 16);
- spc_write(TCM, n >> 8);
- spc_write(TCL, n);
- spc_write(PCTL, sc->sc_phase | PCTL_BFINT_ENAB);
- spc_write(SCMD, SCMD_XFR | SCMD_PROG_XFR);
- for (;;) {
- if ((spc_read(SSTS) & SSTS_BUSY) != 0)
- break;
- if (spc_read(INTS) != 0)
- goto out;
- }
- for (;;) {
-#if 0
- for (;;) {
- if ((spc_read(PSNS) & PSNS_REQ) != 0)
- break;
- /* Wait for REQINIT. XXX Need timeout. */
- }
-#endif
- if (spc_read(INTS) != 0) {
- /*
- * Target left MESSAGE OUT, possibly to reject
- * our message.
- *
- * If this is the last message being sent, then we
- * deassert ATN, since either the target is going to
- * ignore this message, or it's going to ask for a
- * retransmission via MESSAGE PARITY ERROR (in which
- * case we reassert ATN anyway).
- */
-#if 0
- if (sc->sc_msgpriq == 0)
- spc_write(SCMD, SCMD_RST_ATN);
-#endif
- goto out;
- }
-
-#if 0
- /* Clear ATN before last byte if this is the last message. */
- if (n == 1 && sc->sc_msgpriq == 0)
- spc_write(SCMD, SCMD_RST_ATN);
-#endif
-
- while ((spc_read(SSTS) & SSTS_DREG_FULL) != 0)
- DELAY(1);
- /* Send message byte. */
- spc_write(DREG, *--sc->sc_omp);
- --n;
- /* Keep track of the last message we've sent any bytes of. */
- sc->sc_lastmsg = sc->sc_currmsg;
-#if 0
- /* Wait for ACK to be negated. XXX Need timeout. */
- while ((spc_read(PSNS) & ACKI) != 0)
- ;
-#endif
-
- if (n == 0)
- break;
- }
-
- /* We get here only if the entire message has been transmitted. */
- if (sc->sc_msgpriq != 0) {
- /* There are more outgoing messages. */
- goto nextmsg;
- }
-
- /*
- * The last message has been transmitted. We need to remember the last
- * message transmitted (in case the target switches to MESSAGE IN phase
- * and sends a MESSAGE REJECT), and the list of messages transmitted
- * this time around (in case the target stays in MESSAGE OUT phase to
- * request a retransmit).
- */
-
-out:
- /* Disable REQ/ACK protocol. */
- return;
-}
-
-/*
- * spc_dataout_pio: perform a data transfer using the FIFO datapath in the spc
- * Precondition: The SCSI bus should be in the DOUT phase, with REQ asserted
- * and ACK deasserted (i.e. waiting for a data byte).
- *
- * This new revision has been optimized (I tried) to make the common case fast,
- * and the rarer cases (as a result) somewhat more complex.
- */
-int
-spc_dataout_pio(struct spc_softc *sc, u_char *p, int n)
-{
- u_char intstat = 0;
- int out = 0;
-#define DOUTAMOUNT 8 /* Full FIFO */
-
- SPC_TRACE(("spc_dataout_pio "));
- /* send TRANSFER command. */
- spc_write(TCH, n >> 16);
- spc_write(TCM, n >> 8);
- spc_write(TCL, n);
- spc_write(PCTL, sc->sc_phase | PCTL_BFINT_ENAB);
- spc_write(SCMD, SCMD_XFR | SCMD_PROG_XFR); /* XXX */
- for (;;) {
- if ((spc_read(SSTS) & SSTS_BUSY) != 0)
- break;
- if (spc_read(INTS) != 0)
- break;
- }
-
- /*
- * I have tried to make the main loop as tight as possible. This
- * means that some of the code following the loop is a bit more
- * complex than otherwise.
- */
- while (n > 0) {
- int xfer;
-
- for (;;) {
- intstat = spc_read(INTS);
- /* Wait till buffer is empty. */
- if ((spc_read(SSTS) & SSTS_DREG_EMPTY) != 0)
- break;
- /* Break on interrupt. */
- if (intstat != 0)
- goto phasechange;
- DELAY(1);
- }
-
- xfer = min(DOUTAMOUNT, n);
-
- SPC_MISC(("%d> ", xfer));
-
- n -= xfer;
- out += xfer;
-
- while (xfer-- > 0)
- spc_write(DREG, *p++);
- }
-
- if (out == 0) {
- for (;;) {
- if (spc_read(INTS) != 0)
- break;
- DELAY(1);
- }
- SPC_MISC(("extra data "));
- } else {
- /* See the bytes off chip */
- for (;;) {
- /* Wait till buffer is empty. */
- if ((spc_read(SSTS) & SSTS_DREG_EMPTY) != 0)
- break;
- intstat = spc_read(INTS);
- /* Break on interrupt. */
- if (intstat != 0)
- goto phasechange;
- DELAY(1);
- }
- }
-
-phasechange:
- /* Stop the FIFO data path. */
-
- if (intstat != 0) {
- /* Some sort of phase change. */
- int amount;
-
- amount = ((spc_read(TCH) << 16) |
- (spc_read(TCM) << 8) | spc_read(TCL));
- if (amount > 0) {
- out -= amount;
- SPC_MISC(("+%d ", amount));
- }
- }
-
- return out;
-}
-
-/*
- * spc_datain_pio: perform data transfers using the FIFO datapath in the spc
- * Precondition: The SCSI bus should be in the DIN phase, with REQ asserted
- * and ACK deasserted (i.e. at least one byte is ready).
- *
- * For now, uses a pretty dumb algorithm, hangs around until all data has been
- * transferred. This, is OK for fast targets, but not so smart for slow
- * targets which don't disconnect or for huge transfers.
- */
-int
-spc_datain_pio(struct spc_softc *sc, u_char *p, int n)
-{
- int in = 0;
- u_int8_t intstat, sstat;
-#define DINAMOUNT 8 /* Full FIFO */
-
- SPC_TRACE(("spc_datain_pio "));
- /* send TRANSFER command. */
- spc_write(TCH, n >> 16);
- spc_write(TCM, n >> 8);
- spc_write(TCL, n);
- spc_write(PCTL, sc->sc_phase | PCTL_BFINT_ENAB);
- spc_write(SCMD, SCMD_XFR | SCMD_PROG_XFR); /* XXX */
-
- /*
- * We leave this loop if one or more of the following is true:
- * a) phase != PH_DATAIN && FIFOs are empty
- * b) reset has occurred or busfree is detected.
- */
- intstat = 0;
- while (n > 0) {
- int xfer;
-
- sstat = spc_read(SSTS);
- if ((sstat & SSTS_DREG_FULL) != 0) {
- xfer = DINAMOUNT;
- n -= xfer;
- in += xfer;
- while (xfer-- > 0)
- *p++ = spc_read(DREG);
- } else if ((sstat & SSTS_DREG_EMPTY) == 0) {
- n--;
- in++;
- *p++ = spc_read(DREG);
- } else {
- if (intstat != 0)
- goto phasechange;
- intstat = spc_read(INTS);
- }
- }
-
- /*
- * Some SCSI-devices are rude enough to transfer more data than what
- * was requested, e.g. 2048 bytes from a CD-ROM instead of the
- * requested 512. Test for progress, i.e. real transfers. If no real
- * transfers have been performed (n is probably already zero) and the
- * FIFO is not empty, waste some bytes....
- */
- if (in == 0) {
- for (;;) {
- sstat = spc_read(SSTS);
- if ((sstat & SSTS_DREG_EMPTY) == 0) {
- (void) spc_read(DREG);
- } else {
- if (intstat != 0)
- goto phasechange;
- intstat = spc_read(INTS);
- }
- DELAY(1);
- }
- SPC_MISC(("extra data "));
- }
-
-phasechange:
- /* Stop the FIFO data path. */
-
- return in;
-}
-
-/*
- * Catch an interrupt from the adaptor
- */
-int
-spc_intr(void *arg)
-{
- struct spc_softc *sc = arg;
- u_char ints;
-
- SPC_TRACE(("spc_intr "));
-
- /*
- * Disable interrupt.
- */
- spc_write(SCTL, spc_read(SCTL) & ~SCTL_INTR_ENAB);
-
- ints = spc_read(INTS);
- if (ints != 0)
- spc_process_intr(arg, ints);
-
- spc_write(SCTL, spc_read(SCTL) | SCTL_INTR_ENAB);
- return 1;
-}
-
-void
-spc_process_intr(void *arg, u_char ints)
-{
- struct spc_softc *sc = arg;
- struct spc_acb *acb;
- struct scsi_link *sc_link;
- struct spc_tinfo *ti;
- int n;
-
- SPC_TRACE(("spc_process_intr "));
-
- goto start;
-
-loop:
- /*
- * Loop until transfer completion.
- */
- ints = spc_read(INTS);
-start:
- SPC_MISC(("ints = 0x%x ", ints));
-
- /*
- * Check for the end of a DMA operation before doing anything else...
- */
- if ((sc->sc_flags & SPC_DOINGDMA) != 0) {
- (*sc->sc_dma_done)(sc);
- }
-
- /*
- * Then check for abnormal conditions, such as reset.
- */
- if ((ints & INTS_RST) != 0) {
- printf("%s: SCSI bus reset\n", sc->sc_dev.dv_xname);
- goto reset;
- }
-
- /*
- * Check for less serious errors.
- */
- if ((spc_read(SERR) & (SERR_SCSI_PAR|SERR_SPC_PAR))
- != 0) {
- printf("%s: SCSI bus parity error\n", sc->sc_dev.dv_xname);
- if (sc->sc_prevphase == PH_MSGIN) {
- sc->sc_flags |= SPC_DROP_MSGIN;
- spc_sched_msgout(sc, SEND_PARITY_ERROR);
- } else
- spc_sched_msgout(sc, SEND_INIT_DET_ERR);
- }
-
- /*
- * If we're not already busy doing something test for the following
- * conditions:
- * 1) We have been reselected by something
- * 2) We have selected something successfully
- * 3) Our selection process has timed out
- * 4) This is really a bus free interrupt just to get a new command
- * going?
- * 5) Spurious interrupt?
- */
- switch (sc->sc_state) {
- case SPC_IDLE:
- case SPC_SELECTING:
- SPC_MISC(("ints:0x%02x ", ints));
-
- if ((ints & INTS_SEL) != 0) {
- /*
- * We don't currently support target mode.
- */
- printf("%s: target mode selected; going to BUS FREE\n",
- sc->sc_dev.dv_xname);
-
- goto sched;
- } else if ((ints & INTS_RESEL) != 0) {
- SPC_MISC(("reselected "));
-
- /*
- * If we're trying to select a target ourselves,
- * push our command back into the ready list.
- */
- if (sc->sc_state == SPC_SELECTING) {
- SPC_MISC(("backoff selector "));
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
- sc->sc_nexus = NULL;
- TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
- }
-
- /* Save reselection ID. */
- sc->sc_selid = spc_read(TEMP);
-
- sc->sc_state = SPC_RESELECTED;
- } else if ((ints & INTS_CMD_DONE) != 0) {
- SPC_MISC(("selected "));
-
- /*
- * We have selected a target. Things to do:
- * a) Determine what message(s) to send.
- * b) Verify that we're still selecting the target.
- * c) Mark device as busy.
- */
- if (sc->sc_state != SPC_SELECTING) {
- printf("%s: selection out while idle; "
- "resetting\n", sc->sc_dev.dv_xname);
- SPC_BREAK();
- goto reset;
- }
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
- sc_link = acb->xs->sc_link;
- ti = &sc->sc_tinfo[sc_link->target];
-
- sc->sc_msgpriq = SEND_IDENTIFY;
- if (acb->flags & ACB_RESET)
- sc->sc_msgpriq |= SEND_DEV_RESET;
- else if (acb->flags & ACB_ABORT)
- sc->sc_msgpriq |= SEND_ABORT;
- else {
-#if SPC_USE_SYNCHRONOUS
- if ((ti->flags & DO_SYNC) != 0)
- sc->sc_msgpriq |= SEND_SDTR;
-#endif
-#if SPC_USE_WIDE
- if ((ti->flags & DO_WIDE) != 0)
- sc->sc_msgpriq |= SEND_WDTR;
-#endif
- }
-
- acb->flags |= ACB_NEXUS;
- ti->lubusy |= (1 << sc_link->lun);
-
- /* Do an implicit RESTORE POINTERS. */
- sc->sc_dp = acb->data_addr;
- sc->sc_dleft = acb->data_length;
- sc->sc_cp = (u_char *)&acb->scsi_cmd;
- sc->sc_cleft = acb->scsi_cmd_length;
-
- /* On our first connection, schedule a timeout. */
- if ((acb->xs->flags & SCSI_POLL) == 0)
- timeout_add_msec(&acb->xs->stimeout,
- acb->timeout);
- sc->sc_state = SPC_CONNECTED;
- } else if ((ints & INTS_TIMEOUT) != 0) {
- SPC_MISC(("selection timeout "));
-
- if (sc->sc_state != SPC_SELECTING) {
- printf("%s: selection timeout while idle; "
- "resetting\n", sc->sc_dev.dv_xname);
- SPC_BREAK();
- goto reset;
- }
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
-
- delay(250);
-
- acb->xs->error = XS_SELTIMEOUT;
- goto finish;
- } else {
- if (sc->sc_state != SPC_IDLE) {
- printf("%s: BUS FREE while not idle; "
- "state=%d\n",
- sc->sc_dev.dv_xname, sc->sc_state);
- SPC_BREAK();
- goto out;
- }
-
- goto sched;
- }
-
- /*
- * Turn off selection stuff, and prepare to catch bus free
- * interrupts, parity errors, and phase changes.
- */
-
- sc->sc_flags = 0;
- sc->sc_prevphase = PH_INVALID;
- goto dophase;
- }
-
- if ((ints & INTS_DISCON) != 0) {
- /* disable disconnect interrupt */
- spc_write(PCTL, spc_read(PCTL) & ~PCTL_BFINT_ENAB);
- /* XXX reset interrput */
- spc_write(INTS, ints);
-
- switch (sc->sc_state) {
- case SPC_RESELECTED:
- goto sched;
-
- case SPC_CONNECTED:
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
-
-#if SPC_USE_SYNCHRONOUS + SPC_USE_WIDE
- if (sc->sc_prevphase == PH_MSGOUT) {
- /*
- * If the target went to BUS FREE phase during
- * or immediately after sending a SDTR or WDTR
- * message, disable negotiation.
- */
- sc_link = acb->xs->sc_link;
- ti = &sc->sc_tinfo[sc_link->target];
- switch (sc->sc_lastmsg) {
-#if SPC_USE_SYNCHRONOUS
- case SEND_SDTR:
- ti->flags &= ~DO_SYNC;
- ti->period = ti->offset = 0;
- break;
-#endif
-#if SPC_USE_WIDE
- case SEND_WDTR:
- ti->flags &= ~DO_WIDE;
- ti->width = 0;
- break;
-#endif
- }
- }
-#endif
-
- if ((sc->sc_flags & SPC_ABORTING) == 0) {
- /*
- * Section 5.1.1 of the SCSI 2 spec suggests
- * issuing a REQUEST SENSE following an
- * unexpected disconnect. Some devices go into
- * a contingent allegiance condition when
- * disconnecting, and this is necessary to
- * clean up their state.
- */
- printf("%s: unexpected disconnect; "
- "sending REQUEST SENSE\n",
- sc->sc_dev.dv_xname);
- SPC_BREAK();
- spc_sense(sc, acb);
- goto out;
- }
-
- acb->xs->error = XS_DRIVER_STUFFUP;
- goto finish;
-
- case SPC_DISCONNECT:
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
- TAILQ_INSERT_HEAD(&sc->nexus_list, acb, chain);
- sc->sc_nexus = NULL;
- goto sched;
-
- case SPC_CMDCOMPLETE:
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
- goto finish;
- }
- }
- else if ((ints & INTS_CMD_DONE) != 0 &&
- sc->sc_prevphase == PH_MSGIN &&
- sc->sc_state != SPC_CONNECTED)
- goto out;
-
- /*
- * Do not change phase (yet) if we have a pending DMA operation.
- */
- if ((sc->sc_flags & SPC_DOINGDMA) != 0) {
- goto out;
- }
-
-dophase:
-#if 0
- if ((spc_read(PSNS) & PSNS_REQ) == 0) {
- /* Wait for REQINIT. */
- goto out;
- }
-#else
- spc_write(INTS, ints);
- while ((spc_read(PSNS) & PSNS_REQ) == 0)
- DELAY(1); /* need timeout XXX */
-#endif
-
- /*
- * State transition.
- */
- sc->sc_phase = spc_read(PSNS) & PH_MASK;
-#if 0
- spc_write(PCTL, sc->sc_phase);
-#endif
-
- SPC_MISC(("phase=%d\n", sc->sc_phase));
- switch (sc->sc_phase) {
- case PH_MSGOUT:
- if (sc->sc_state != SPC_CONNECTED &&
- sc->sc_state != SPC_RESELECTED)
- break;
- spc_msgout(sc);
- sc->sc_prevphase = PH_MSGOUT;
- goto loop;
-
- case PH_MSGIN:
- if (sc->sc_state != SPC_CONNECTED &&
- sc->sc_state != SPC_RESELECTED)
- break;
- spc_msgin(sc);
- sc->sc_prevphase = PH_MSGIN;
- goto loop;
-
- case PH_CMD:
- if (sc->sc_state != SPC_CONNECTED)
- break;
-#ifdef SPC_DEBUG
- if ((spc_debug & SPC_SHOWMISC) != 0) {
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
- printf("cmd=0x%02x+%d ",
- acb->scsi_cmd.opcode, acb->scsi_cmd_length - 1);
- }
-#endif
- n = spc_dataout_pio(sc, sc->sc_cp, sc->sc_cleft);
- sc->sc_cp += n;
- sc->sc_cleft -= n;
- sc->sc_prevphase = PH_CMD;
- goto loop;
-
- case PH_DATAOUT:
- if (sc->sc_state != SPC_CONNECTED)
- break;
- SPC_MISC(("dataout dleft=%d ", sc->sc_dleft));
- if (sc->sc_dma_start != NULL &&
- sc->sc_dleft > SPC_MIN_DMA_LEN) {
- if ((*sc->sc_dma_start)
- (sc, sc->sc_dp, sc->sc_dleft, 0) == 0) {
- sc->sc_prevphase = PH_DATAOUT;
- goto out;
- }
- }
- n = spc_dataout_pio(sc, sc->sc_dp, sc->sc_dleft);
- sc->sc_dp += n;
- sc->sc_dleft -= n;
- sc->sc_prevphase = PH_DATAOUT;
- goto loop;
-
- case PH_DATAIN:
- if (sc->sc_state != SPC_CONNECTED)
- break;
- SPC_MISC(("datain "));
- if (sc->sc_dma_start != NULL &&
- sc->sc_dleft > SPC_MIN_DMA_LEN) {
- if ((*sc->sc_dma_start)
- (sc, sc->sc_dp, sc->sc_dleft, 1) == 0) {
- sc->sc_prevphase = PH_DATAIN;
- goto out;
- }
- }
- n = spc_datain_pio(sc, sc->sc_dp, sc->sc_dleft);
- sc->sc_dp += n;
- sc->sc_dleft -= n;
- sc->sc_prevphase = PH_DATAIN;
- goto loop;
-
- case PH_STAT:
- if (sc->sc_state != SPC_CONNECTED)
- break;
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
- if ((spc_read(PSNS) & PSNS_ATN) != 0)
- spc_write(SCMD, SCMD_RST_ATN);
- spc_write(PCTL, PCTL_BFINT_ENAB | PH_STAT);
- while ((spc_read(PSNS) & PSNS_REQ) == 0)
- DELAY(1); /* XXX needs timeout */
- acb->target_stat = spc_read(TEMP);
- spc_write(SCMD, SCMD_SET_ACK);
- while ((spc_read(PSNS) & PSNS_REQ) != 0)
- DELAY(1); /* XXX needs timeout */
- spc_write(SCMD, SCMD_RST_ACK);
-
- SPC_MISC(("target_stat=0x%02x ", acb->target_stat));
- sc->sc_prevphase = PH_STAT;
- goto loop;
- }
-
- printf("%s: unexpected bus phase; resetting\n", sc->sc_dev.dv_xname);
- SPC_BREAK();
-reset:
- spc_init(sc);
- return;
-
-finish:
- spc_write(INTS, ints);
- ints = 0;
- spc_done(sc, acb);
- return;
-
-sched:
- sc->sc_state = SPC_IDLE;
- spc_sched(sc);
- goto out;
-
-out:
- if (ints != 0)
- spc_write(INTS, ints);
-}
-
-void
-spc_abort(struct spc_softc *sc, struct spc_acb *acb)
-{
- /* 2 secs for the abort */
- acb->timeout = SPC_ABORT_TIMEOUT;
- acb->flags |= ACB_ABORT;
-
- if (acb == sc->sc_nexus) {
- /*
- * If we're still selecting, the message will be scheduled
- * after selection is complete.
- */
- if (sc->sc_state == SPC_CONNECTED)
- spc_sched_msgout(sc, SEND_ABORT);
- } else {
- spc_dequeue(sc, acb);
- TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
- if (sc->sc_state == SPC_IDLE)
- spc_sched(sc);
- }
-}
-
-void
-spc_timeout(void *arg)
-{
- struct spc_acb *acb = arg;
- struct scsi_xfer *xs = acb->xs;
- struct scsi_link *sc_link = xs->sc_link;
- struct spc_softc *sc = sc_link->adapter_softc;
- int s;
-
- sc_print_addr(sc_link);
-
- s = splbio();
-
- /*
- * We might have missed a DMA completion.
- * If so, fake an interrupt (even if the INTS register is zero - what
- * we want here is to change phase).
- */
- if ((sc->sc_flags & SPC_DOINGDMA) != 0) {
- if ((*sc->sc_dma_done)(sc)) {
- printf("missed DMA completion\n");
- spc_process_intr(sc, spc_read(INTS));
- splx(s);
- return;
- }
- }
-
- printf("timed out");
- if (acb->flags & ACB_ABORT) {
- /* abort timed out */
- printf(" AGAIN\n");
- /* XXX Must reset! */
- } else {
- /* abort the operation that has timed out */
- printf("\n");
- acb->xs->error = XS_TIMEOUT;
- spc_abort(sc, acb);
- }
-
- splx(s);
-}
-
-#ifdef SPC_DEBUG
-/*
- * The following functions are mostly used for debugging purposes, either
- * directly called from the driver or from the kernel debugger.
- */
-
-void
-spc_show_scsi_cmd(struct spc_acb *acb)
-{
- u_char *b = (u_char *)&acb->scsi_cmd;
- struct scsi_link *sc_link = acb->xs->sc_link;
- int i;
-
- sc_print_addr(sc_link);
- if ((acb->xs->flags & SCSI_RESET) == 0) {
- for (i = 0; i < acb->scsi_cmd_length; i++) {
- if (i)
- printf(",");
- printf("%x", b[i]);
- }
- printf("\n");
- } else
- printf("RESET\n");
-}
-
-void
-spc_print_acb(struct spc_acb *acb)
-{
- printf("acb@%p xs=%p flags=%x", acb, acb->xs, acb->flags);
- printf(" dp=%p dleft=%d target_stat=%x\n",
- acb->data_addr, acb->data_length, acb->target_stat);
- spc_show_scsi_cmd(acb);
-}
-
-void
-spc_print_active_acb(void)
-{
- struct spc_acb *acb;
- struct spc_softc *sc = spc_cd.cd_devs[0]; /* XXX */
-
- printf("ready list:\n");
- TAILQ_FOREACH(acb, &sc->ready_list, chain)
- spc_print_acb(acb);
- printf("nexus:\n");
- if (sc->sc_nexus != NULL)
- spc_print_acb(sc->sc_nexus);
- printf("nexus list:\n");
- TAILQ_FOREACH(acb, &sc->nexus_list, chain)
- spc_print_acb(acb);
-}
-
-void
-spc_dump89352(struct spc_softc *sc)
-{
- printf("mb89352: BDID=%x SCTL=%x SCMD=%x TMOD=%x\n",
- spc_read(BDID), spc_read(SCTL), spc_read(SCMD), spc_read(TMOD));
- printf(" INTS=%x PSNS=%x SSTS=%x SERR=%x PCTL=%x\n",
- spc_read(INTS), spc_read(PSNS), spc_read(SSTS), spc_read(SERR),
- spc_read(PCTL));
- printf(" MBC=%x DREG=%x TEMP=%x TCH=%x TCM=%x\n",
- spc_read(MBC),
-#if 0
- spc_read(DREG),
-#else
- 0,
-#endif
- spc_read(TEMP), spc_read(TCH), spc_read(TCM));
- printf(" TCL=%x EXBF=%x\n", spc_read(TCL), spc_read(EXBF));
-}
-
-void
-spc_dump_driver(struct spc_softc *sc)
-{
- struct spc_tinfo *ti;
- int i;
-
- printf("nexus=%p phase=%x prevphase=%x\n",
- sc->sc_nexus, sc->sc_phase, sc->sc_prevphase);
- printf("state=%x msgin=%x msgpriq=%x msgoutq=%x lastmsg=%x "
- "currmsg=%x\n", sc->sc_state, sc->sc_imess[0],
- sc->sc_msgpriq, sc->sc_msgoutq, sc->sc_lastmsg, sc->sc_currmsg);
- for (i = 0; i < 7; i++) {
- ti = &sc->sc_tinfo[i];
- printf("tinfo%d: %d cmds %d disconnects %d timeouts",
- i, ti->cmds, ti->dconns, ti->touts);
- printf(" %d senses flags=%x\n", ti->senses, ti->flags);
- }
-}
-#endif
diff --git a/sys/arch/hp300/dev/mb89352reg.h b/sys/arch/hp300/dev/mb89352reg.h
deleted file mode 100644
index fc45a14682a..00000000000
--- a/sys/arch/hp300/dev/mb89352reg.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/* $OpenBSD: mb89352reg.h,v 1.2 2008/10/17 18:30:20 okan Exp $ */
-/* $NetBSD: mb89352reg.h,v 1.3 2003/08/07 16:31:02 agc Exp $ */
-/* NecBSD: mb89352reg.h,v 1.3 1998/03/14 07:04:34 kmatsuda Exp */
-
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum, Masaru Oki and Kouichi Matsuda.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of 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.
- *
- * @(#)scsireg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*-
- * Copyright (c) 1996,97,98,99 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum, Masaru Oki and Kouichi Matsuda.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of 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.
- *
- * 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.
- *
- * @(#)scsireg.h 8.1 (Berkeley) 6/10/93
- */
-/*
- * [NetBSD for NEC PC-98 series]
- * Copyright (c) 1996, 1997, 1998
- * NetBSD/pc98 porting staff. All rights reserved.
- * Copyright (c) 1996, 1997, 1998
- * Kouichi Matsuda. All rights reserved.
- */
-
-/*
- * FUJITSU MB89352A SCSI Protocol Controller Hardware Description.
- */
-
-/* Definitions, most of them has turned out to be unneccesary, but here they
- * are anyway.
- */
-
-#define BDID 0x00 /* Bus Device ID (R/W) */
-#define SCTL 0x01 /* SPC Control register (R/W) */
-#define SCMD 0x02 /* Command Register (R/W) */
-#define TMOD 0x03 /* Transmit Mode Register (synch models) */
-#define INTS 0x04 /* Interrupt sense (R); Interrupt Reset (W) */
-#define PSNS 0x05 /* Phase Sense (R); SPC Diagnostic Control (W) */
-#define SSTS 0x06 /* SPC status (R/O) */
-#define SERR 0x07 /* SPC error status (R/O) */
-#define PCTL 0x08 /* Phase Control (R/W) */
-#define MBC 0x09 /* Modified Byte Counter (R/O) */
-#define DREG 0x0a /* Data Register (R/W) */
-#define TEMP 0x0b /* Temporary Register (R/W) */
-#define TCH 0x0c /* Transfer Counter High (R/W) */
-#define TCM 0x0d /* Transfer Counter Middle (R/W) */
-#define TCL 0x0e /* Transfer Counter Low (R/W) */
-#define EXBF 0x0f /* External Buffer (synch models) */
-
-/* What all the bits do */
-
-/* SCSI_BDID */
-/* SCSI selection/reselection ID (both target *and* initiator) */
-#define SELID7 0x80
-#define SELID6 0x40
-#define SELID5 0x20
-#define SELID4 0x10
-#define SELID3 0x08
-#define SELID2 0x04
-#define SELID1 0x02
-#define SELID0 0x01
-
-/* SCSI_SCTL */
-#define SCTL_DISABLE 0x80
-#define SCTL_CTRLRST 0x40
-#define SCTL_DIAG 0x20
-#define SCTL_ABRT_ENAB 0x10
-#define SCTL_PARITY_ENAB 0x08
-#define SCTL_SEL_ENAB 0x04
-#define SCTL_RESEL_ENAB 0x02
-#define SCTL_INTR_ENAB 0x01
-
-/* SCSI_SCMD */
-#define SCMD_RST 0x10
-#define SCMD_ICPT_XFR 0x08
-#define SCMD_PROG_XFR 0x04
-#define SCMD_PAD 0x01 /* if initiator */
-#define SCMD_PERR_STOP 0x01 /* if target */
- /* command codes */
-#define SCMD_BUS_REL 0x00
-#define SCMD_SELECT 0x20
-#define SCMD_RST_ATN 0x40
-#define SCMD_SET_ATN 0x60
-#define SCMD_XFR 0x80
-#define SCMD_XFR_PAUSE 0xa0
-#define SCMD_RST_ACK 0xc0
-#define SCMD_SET_ACK 0xe0
-
-/* SCSI_TMOD */
-#define TMOD_SYNC 0x80
-
-/* SCSI_INTS */
-#define INTS_SEL 0x80
-#define INTS_RESEL 0x40
-#define INTS_DISCON 0x20
-#define INTS_CMD_DONE 0x10
-#define INTS_SRV_REQ 0x08
-#define INTS_TIMEOUT 0x04
-#define INTS_HARD_ERR 0x02
-#define INTS_RST 0x01
-
-/* SCSI_PSNS */
-#define PSNS_REQ 0x80
-#define PSNS_ACK 0x40
-#define PSNS_ATN 0x20
-#define PSNS_SEL 0x10
-#define PSNS_BSY 0x08
-
-/* PSNS */
-#define REQI 0x80
-#define ACKI 0x40
-#define ATNI 0x20
-#define SELI 0x10
-#define BSYI 0x08
-#define MSGI 0x04
-#define CDI 0x02
-#define IOI 0x01
-
-/* Important! The 3 most significant bits of this register, in initiator mode,
- * represents the "expected" SCSI bus phase and can be used to trigger phase
- * mismatch and phase change interrupts. But more important: If there is a
- * phase mismatch the chip will not transfer any data! This is actually a nice
- * feature as it gives us a bit more control over what is happening when we are
- * bursting data (in) through the FIFOs and the phase suddenly changes from
- * DATA IN to STATUS or MESSAGE IN. The transfer will stop and wait for the
- * proper phase to be set in this register instead of dumping the bits into the
- * FIFOs.
- */
-#if 0
-#define REQO 0x80
-#define ACKO 0x40
-#define ATNO 0x20
-#define SELO 0x10
-#define BSYO 0x08
-#endif
-/* PCTL */
-#define MSGO 0x04
-#define CDO 0x02
-#define IOO 0x01
-
-/* Information transfer phases */
-#define PH_DATAOUT (0)
-#define PH_DATAIN (IOI)
-#define PH_CMD (CDI)
-#define PH_STAT (CDI | IOI)
-#define PH_MSGOUT (MSGI | CDI)
-#define PH_MSGIN (MSGI | CDI | IOI)
-
-#define PH_MASK (MSGI | CDI | IOI)
-
-#define PH_INVALID 0xff
-
-/* SCSI_SSTS */
-#define SSTS_INITIATOR 0x80
-#define SSTS_TARGET 0x40
-#define SSTS_BUSY 0x20
-#define SSTS_XFR 0x10
-#define SSTS_ACTIVE (SSTS_INITIATOR|SSTS_XFR)
-#define SSTS_RST 0x08
-#define SSTS_TCZERO 0x04
-#define SSTS_DREG_FULL 0x02
-#define SSTS_DREG_EMPTY 0x01
-
-/* SCSI_SERR */
-#define SERR_SCSI_PAR 0x80
-#define SERR_SPC_PAR 0x40
-#define SERR_TC_PAR 0x08
-#define SERR_PHASE_ERR 0x04
-#define SERR_SHORT_XFR 0x02
-#define SERR_OFFSET 0x01
-
-/* SCSI_PCTL */
-#define PCTL_BFINT_ENAB 0x80
diff --git a/sys/arch/hp300/dev/mb89352var.h b/sys/arch/hp300/dev/mb89352var.h
deleted file mode 100644
index 14e9c9ec84a..00000000000
--- a/sys/arch/hp300/dev/mb89352var.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/* $OpenBSD: mb89352var.h,v 1.8 2011/05/30 20:01:29 miod Exp $ */
-/* $NetBSD: mb89352var.h,v 1.6 2003/08/02 12:48:09 tsutsui Exp $ */
-/* NecBSD: mb89352var.h,v 1.4 1998/03/14 07:31:22 kmatsuda Exp */
-
-/*-
- * Copyright (c) 1996,97,98,99 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum, Masaru Oki and Kouichi Matsuda.
- *
- * 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 Charles M. Hannum.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * Copyright (c) 1994 Jarle Greipsland
- * 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.
- */
-/*
- * [NetBSD for NEC PC-98 series]
- * Copyright (c) 1996, 1997, 1998
- * NetBSD/pc98 porting staff. All rights reserved.
- * Copyright (c) 1996, 1997, 1998
- * Kouich Matsuda. All rights reserved.
- */
-
-#ifndef _MB89352VAR_H_
-#define _MB89352VAR_H_
-
-/*
- * ACB. Holds additional information for each SCSI command Comments: We
- * need a separate scsi command block because we may need to overwrite it
- * with a request sense command. Basicly, we refrain from fiddling with
- * the scsi_xfer struct (except do the expected updating of return values).
- * We'll generally update: xs->{flags,resid,error,sense,status} and
- * occasionally xs->retries.
- */
-struct spc_acb {
- struct scsi_generic scsi_cmd;
- int scsi_cmd_length;
- u_char *data_addr; /* Saved data pointer */
- int data_length; /* Residue */
-
- u_char target_stat; /* SCSI status byte */
-
-#ifdef notdef
- struct spc_dma_seg dma[SPC_NSEG]; /* Physical addresses+len */
-#endif
-
- TAILQ_ENTRY(spc_acb) chain;
- struct scsi_xfer *xs; /* SCSI xfer ctrl block from above */
- int flags;
-#define ACB_NEXUS 0x02
-#define ACB_SENSE 0x04
-#define ACB_ABORT 0x40
-#define ACB_RESET 0x80
- int timeout;
-};
-
-/*
- * Some info about each (possible) target on the SCSI bus. This should
- * probably have been a "per target+lunit" structure, but we'll leave it at
- * this for now.
- */
-struct spc_tinfo {
- int cmds; /* #commands processed */
- int dconns; /* #disconnects */
- int touts; /* #timeouts */
- int perrs; /* #parity errors */
- int senses; /* #request sense commands sent */
- ushort lubusy; /* What local units/subr. are busy? */
- u_char flags;
-#define DO_SYNC 0x01 /* (Re)Negotiate synchronous options */
-#define DO_WIDE 0x02 /* (Re)Negotiate wide options */
- u_char period; /* Period suggestion */
- u_char offset; /* Offset suggestion */
- u_char width; /* Width suggestion */
-};
-
-struct spc_softc {
- struct device sc_dev;
-
- volatile u_int8_t *sc_regs;
-
- struct scsi_link sc_link; /* prototype for subdevs */
-
- TAILQ_HEAD(, spc_acb) free_list, ready_list, nexus_list;
- struct spc_acb *sc_nexus; /* current command */
- struct spc_acb sc_acb[8];
- struct spc_tinfo sc_tinfo[8];
- struct mutex sc_acb_mtx;
- struct scsi_iopool sc_iopool;
-
- /* Data about the current nexus (updated for every cmd switch) */
- u_char *sc_dp; /* Current data pointer */
- size_t sc_dleft; /* Data bytes left to transfer */
- u_char *sc_cp; /* Current command pointer */
- size_t sc_cleft; /* Command bytes left to transfer */
-
- /* Adapter state */
- u_char sc_phase; /* Current bus phase */
- u_char sc_prevphase; /* Previous bus phase */
- u_char sc_state; /* State applicable to the adapter */
-#define SPC_INIT 0
-#define SPC_IDLE 1
-#define SPC_SELECTING 2 /* SCSI command is arbiting */
-#define SPC_RESELECTED 3 /* Has been reselected */
-#define SPC_CONNECTED 4 /* Actively using the SCSI bus */
-#define SPC_DISCONNECT 5 /* MSG_DISCONNECT received */
-#define SPC_CMDCOMPLETE 6 /* MSG_CMDCOMPLETE received */
-#define SPC_CLEANING 7
- u_char sc_flags;
-#define SPC_DROP_MSGIN 0x01 /* Discard all msgs (parity err detected) */
-#define SPC_ABORTING 0x02 /* Bailing out */
-#define SPC_DOINGDMA 0x04 /* doing DMA */
-#define SPC_INACTIVE 0x80 /* The FIFO data path is active! */
- u_char sc_selid; /* Reselection ID */
-
- /* Message stuff */
- u_char sc_msgpriq; /* Messages we want to send */
- u_char sc_msgoutq; /* Messages sent during last MESSAGE OUT */
- u_char sc_lastmsg; /* Message last transmitted */
- u_char sc_currmsg; /* Message currently ready to transmit */
-#define SEND_DEV_RESET 0x01
-#define SEND_PARITY_ERROR 0x02
-#define SEND_INIT_DET_ERR 0x04
-#define SEND_REJECT 0x08
-#define SEND_IDENTIFY 0x10
-#define SEND_ABORT 0x20
-#define SEND_SDTR 0x40
-#define SEND_WDTR 0x80
-#define SPC_MAX_MSG_LEN 8
- u_char sc_omess[SPC_MAX_MSG_LEN];
- u_char *sc_omp; /* Outgoing message pointer */
- u_char sc_imess[SPC_MAX_MSG_LEN];
- u_char *sc_imp; /* Incoming message pointer */
-
- /* Hardware stuff */
- int sc_initiator; /* Our scsi id */
- int sc_freq; /* Clock frequency in MHz */
- int sc_minsync; /* Minimum sync period / 4 */
- int sc_maxsync; /* Maximum sync period / 4 */
- int sc_ctlflags;
-
- /* DMA function set from MD code */
- int (*sc_dma_start)(struct spc_softc *, void *, size_t, int);
- int (*sc_dma_done)(struct spc_softc *);
-
- /* Reset hook */
- void (*sc_reset)(struct spc_softc *);
-};
-
-#ifdef SPC_DEBUG
-#define SPC_SHOWACBS 0x01
-#define SPC_SHOWINTS 0x02
-#define SPC_SHOWCMDS 0x04
-#define SPC_SHOWMISC 0x08
-#define SPC_SHOWTRACE 0x10
-#define SPC_SHOWSTART 0x20
-#define SPC_DOBREAK 0x40
-extern int spc_debug; /* SPC_SHOWSTART|SPC_SHOWMISC|SPC_SHOWTRACE; */
-#define SPC_PRINT(b, s) do {if ((spc_debug & (b)) != 0) printf s;} while (0)
-#define SPC_BREAK() do {if ((spc_debug & SPC_DOBREAK) != 0) Debugger();} while (0)
-#define SPC_ASSERT(x) do {if (x) {} else {printf("%s at line %d: assertion failed\n", sc->sc_dev.dv_xname, __LINE__); Debugger();}} while (0)
-#else
-#define SPC_PRINT(b, s)
-#define SPC_BREAK()
-#define SPC_ASSERT(x)
-#endif
-
-#define SPC_ACBS(s) SPC_PRINT(SPC_SHOWACBS, s)
-#define SPC_INTS(s) SPC_PRINT(SPC_SHOWINTS, s)
-#define SPC_CMDS(s) SPC_PRINT(SPC_SHOWCMDS, s)
-#define SPC_MISC(s) SPC_PRINT(SPC_SHOWMISC, s)
-#define SPC_TRACE(s) SPC_PRINT(SPC_SHOWTRACE, s)
-#define SPC_START(s) SPC_PRINT(SPC_SHOWSTART, s)
-
-void spc_attach(struct spc_softc *);
-int spc_intr(void *);
-void spc_init(struct spc_softc *);
-void spc_sched(struct spc_softc *);
-void spc_scsi_cmd(struct scsi_xfer *);
-void spc_reset(struct spc_softc *);
-
-#define SPC_ADDRESS(o) (sc->sc_regs + ((o) << 1) + 1)
-#define spc_read(o) *(volatile u_int8_t *)(SPC_ADDRESS(o))
-#define spc_write(o, v) *(volatile u_int8_t *)(SPC_ADDRESS(o)) = (v)
-
-#endif /* _MB89352VAR_H_ */
diff --git a/sys/arch/hp300/dev/mt.c b/sys/arch/hp300/dev/mt.c
deleted file mode 100644
index edd90b5fefc..00000000000
--- a/sys/arch/hp300/dev/mt.c
+++ /dev/null
@@ -1,981 +0,0 @@
-/* $OpenBSD: mt.c,v 1.26 2013/06/11 16:42:07 deraadt Exp $ */
-/* $NetBSD: mt.c,v 1.8 1997/03/31 07:37:29 scottr Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1992, The University of Utah and
- * the Computer Systems Laboratory at the University of Utah (CSL).
- * All rights reserved.
- *
- * Permission to use, copy, modify and distribute this software is hereby
- * granted provided that (1) source code retains these copyright, permission,
- * and disclaimer notices, and (2) redistributions including binaries
- * reproduce the notices in supporting documentation, and (3) all advertising
- * materials mentioning features or use of this software display the following
- * acknowledgement: ``This product includes software developed by the
- * Computer Systems Laboratory at the University of Utah.''
- *
- * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
- * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
- * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * CSL requests users of this software to return to csl-dist@cs.utah.edu any
- * improvements that they make and grant CSL redistribution rights.
- *
- * Utah $Hdr: mt.c 1.8 95/09/12$
- */
-/* @(#)mt.c 3.9 90/07/10 mt Xinu
- *
- * Magnetic tape driver (7974a, 7978a/b, 7979a, 7980a, 7980xc)
- * Original version contributed by Mt. Xinu.
- * Modified for 4.4BSD by Mark Davies and Andrew Vignaux, Department of
- * Computer Science, Victoria University of Wellington
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/ioctl.h>
-#include <sys/mtio.h>
-#include <sys/file.h>
-#include <sys/proc.h>
-#include <sys/errno.h>
-#include <sys/syslog.h>
-#include <sys/tty.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/conf.h>
-
-#include <hp300/dev/hpibvar.h>
-
-#include <hp300/dev/mtreg.h>
-
-struct mtinfo {
- u_short hwid;
- char *desc;
-} mtinfo[] = {
- { MT7978ID, "7978" },
- { MT7979AID, "7979A" },
- { MT7980ID, "7980" },
- { MT7974AID, "7974A" },
-};
-int nmtinfo = sizeof(mtinfo) / sizeof(mtinfo[0]);
-
-struct mt_softc {
- struct device sc_dev;
- int sc_hpibno; /* logical HPIB this slave it attached to */
- int sc_slave; /* HPIB slave address (0-6) */
- short sc_flags; /* see below */
- u_char sc_lastdsj; /* place for DSJ in mtreaddsj() */
- u_char sc_lastecmd; /* place for End Command in mtreaddsj() */
- short sc_recvtimeo; /* count of hpibsend timeouts to prevent hang */
- short sc_statindex; /* index for next sc_stat when MTF_STATTIMEO */
- struct mt_stat sc_stat;/* status bytes last read from device */
- short sc_density; /* current density of tape (mtio.h format) */
- short sc_type; /* tape drive model (hardware IDs) */
- struct hpibqueue sc_hq; /* HPIB device queue member */
- struct buf sc_tab; /* buf queue */
- struct timeout sc_start_to; /* spl_mtstart timeout */
- struct timeout sc_intr_to; /* spl_mtintr timeout */
-};
-
-#ifdef DEBUG
-int mtdebug = 0;
-#define dlog if (mtdebug) log
-#else
-#define dlog if (0) log
-#endif
-
-#define UNIT(x) (minor(x) & 3)
-
-#define B_CMD B_XXX /* command buf instead of data */
-#define b_cmd b_blkno /* blkno holds cmd when B_CMD */
-
-int mtmatch(struct device *, void *, void *);
-void mtattach(struct device *, struct device *, void *);
-
-struct cfattach mt_ca = {
- sizeof(struct mt_softc), mtmatch, mtattach
-};
-
-struct cfdriver mt_cd = {
- NULL, "mt", DV_TAPE
-};
-
-int mtident(struct mt_softc *, struct hpibbus_attach_args *);
-void mtustart(struct mt_softc *);
-int mtreaddsj(struct mt_softc *, int);
-int mtcommand(dev_t, int, int);
-void spl_mtintr(void *);
-void spl_mtstart(void *);
-
-void mtstart(void *);
-void mtgo(void *);
-void mtintr(void *);
-
-bdev_decl(mt);
-cdev_decl(mt);
-
-int
-mtmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct hpibbus_attach_args *ha = aux;
-
- return (mtident(NULL, ha));
-}
-
-void
-mtattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct mt_softc *sc = (struct mt_softc *)self;
- struct hpibbus_attach_args *ha = aux;
- int unit, hpibno, slave;
-
- if (mtident(sc, ha) == 0) {
- printf("\n%s: impossible!\n", sc->sc_dev.dv_xname);
- return;
- }
-
- unit = self->dv_unit;
- hpibno = parent->dv_unit;
- slave = ha->ha_slave;
-
- sc->sc_tab.b_actb = &sc->sc_tab.b_actf;
-
- sc->sc_hpibno = hpibno;
- sc->sc_slave = slave;
- sc->sc_flags = MTF_EXISTS;
-
- /* Initialize hpib job queue entry. */
- sc->sc_hq.hq_softc = sc;
- sc->sc_hq.hq_slave = sc->sc_slave;
- sc->sc_hq.hq_start = mtstart;
- sc->sc_hq.hq_go = mtgo;
- sc->sc_hq.hq_intr = mtintr;
-
- /* Initialize timeout structures */
- timeout_set(&sc->sc_start_to, spl_mtstart, sc);
- timeout_set(&sc->sc_intr_to, spl_mtintr, sc);
-}
-
-int
-mtident(sc, ha)
- struct mt_softc *sc;
- struct hpibbus_attach_args *ha;
-{
- int i;
-
- for (i = 0; i < nmtinfo; i++) {
- if (ha->ha_id == mtinfo[i].hwid &&
- ha->ha_punit == 0) {
- if (sc != NULL) {
- sc->sc_type = mtinfo[i].hwid;
- printf(": %s tape\n", mtinfo[i].desc);
- }
- return (1);
- }
- }
- return (0);
-}
-
-/*
- * Perform a read of "Device Status Jump" register and update the
- * status if necessary. If status is read, the given "ecmd" is also
- * performed, unless "ecmd" is zero. Returns DSJ value, -1 on failure
- * and -2 on "temporary" failure.
- */
-int
-mtreaddsj(sc, ecmd)
- struct mt_softc *sc;
- int ecmd;
-{
- int retval;
-
- if (sc->sc_flags & MTF_STATTIMEO)
- goto getstats;
- retval = hpibrecv(sc->sc_hpibno,
- (sc->sc_flags & MTF_DSJTIMEO) ? -1 : sc->sc_slave,
- MTT_DSJ, &(sc->sc_lastdsj), 1);
- sc->sc_flags &= ~MTF_DSJTIMEO;
- if (retval != 1) {
- dlog(LOG_DEBUG, "%s can't hpibrecv DSJ",
- sc->sc_dev.dv_xname);
- if (sc->sc_recvtimeo == 0)
- sc->sc_recvtimeo = hz;
- if (--sc->sc_recvtimeo == 0)
- return (-1);
- if (retval == 0)
- sc->sc_flags |= MTF_DSJTIMEO;
- return (-2);
- }
- sc->sc_recvtimeo = 0;
- sc->sc_statindex = 0;
- dlog(LOG_DEBUG, "%s readdsj: 0x%x", sc->sc_dev.dv_xname,
- sc->sc_lastdsj);
- sc->sc_lastecmd = ecmd;
- switch (sc->sc_lastdsj) {
- case 0:
- if (ecmd & MTE_DSJ_FORCE)
- break;
- return (0);
-
- case 2:
- sc->sc_lastecmd = MTE_COMPLETE;
- case 1:
- break;
-
- default:
- log(LOG_ERR, "%s readdsj: DSJ 0x%x\n", sc->sc_dev.dv_xname,
- sc->sc_lastdsj);
- return (-1);
- }
- getstats:
- retval = hpibrecv(sc->sc_hpibno,
- (sc->sc_flags & MTF_STATCONT) ? -1 : sc->sc_slave,
- MTT_STAT, ((char *)&(sc->sc_stat)) + sc->sc_statindex,
- sizeof(sc->sc_stat) - sc->sc_statindex);
- sc->sc_flags &= ~(MTF_STATTIMEO | MTF_STATCONT);
- if (retval != sizeof(sc->sc_stat) - sc->sc_statindex) {
- if (sc->sc_recvtimeo == 0)
- sc->sc_recvtimeo = hz;
- if (--sc->sc_recvtimeo != 0) {
- if (retval >= 0) {
- sc->sc_statindex += retval;
- sc->sc_flags |= MTF_STATCONT;
- }
- sc->sc_flags |= MTF_STATTIMEO;
- return (-2);
- }
- log(LOG_ERR, "%s readdsj: can't read status",
- sc->sc_dev.dv_xname);
- return (-1);
- }
- sc->sc_recvtimeo = 0;
- sc->sc_statindex = 0;
- dlog(LOG_DEBUG, "%s readdsj: status is %x %x %x %x %x %x",
- sc->sc_dev.dv_xname,
- sc->sc_stat1, sc->sc_stat2, sc->sc_stat3,
- sc->sc_stat4, sc->sc_stat5, sc->sc_stat6);
- if (sc->sc_lastecmd)
- (void) hpibsend(sc->sc_hpibno, sc->sc_slave,
- MTL_ECMD, &(sc->sc_lastecmd), 1);
- return ((int) sc->sc_lastdsj);
-}
-
-int
-mtopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int unit = UNIT(dev);
- struct mt_softc *sc;
- int req_den;
- int error;
-
- if (unit >= mt_cd.cd_ndevs ||
- (sc = mt_cd.cd_devs[unit]) == NULL ||
- (sc->sc_flags & MTF_EXISTS) == 0)
- return (ENXIO);
-
- dlog(LOG_DEBUG, "%s open: flags 0x%x", sc->sc_dev.dv_xname,
- sc->sc_flags);
- if (sc->sc_flags & MTF_OPEN)
- return (EBUSY);
- sc->sc_flags |= MTF_OPEN;
- if ((sc->sc_flags & MTF_ALIVE) == 0) {
- error = mtcommand(dev, MTRESET, 0);
- if (error != 0 || (sc->sc_flags & MTF_ALIVE) == 0)
- goto errout;
- if ((sc->sc_stat1 & (SR1_BOT | SR1_ONLINE)) == SR1_ONLINE)
- (void) mtcommand(dev, MTREW, 0);
- }
- for (;;) {
- if ((error = mtcommand(dev, MTNOP, 0)) != 0)
- goto errout;
- if (!(sc->sc_flags & MTF_REW))
- break;
- if (tsleep((caddr_t) &lbolt, PCATCH | (PZERO + 1),
- "mt", 0) != 0) {
- error = EINTR;
- goto errout;
- }
- }
- if ((flag & FWRITE) && (sc->sc_stat1 & SR1_RO)) {
- error = EROFS;
- goto errout;
- }
- if (!(sc->sc_stat1 & SR1_ONLINE)) {
- uprintf("%s: not online\n", sc->sc_dev.dv_xname);
- error = EIO;
- goto errout;
- }
- /*
- * Select density:
- * - find out what density the drive is set to
- * (i.e. the density of the current tape)
- * - if we are going to write
- * - if we're not at the beginning of the tape
- * - complain if we want to change densities
- * - otherwise, select the mtcommand to set the density
- *
- * If the drive doesn't support it then don't change the recorded
- * density.
- *
- * The original MOREbsd code had these additional conditions
- * for the mid-tape change
- *
- * req_den != T_BADBPI &&
- * sc->sc_density != T_6250BPI
- *
- * which suggests that it would be possible to write multiple
- * densities if req_den == T_BAD_BPI or the current tape
- * density was 6250. Testing of our 7980 suggests that the
- * device cannot change densities mid-tape.
- *
- * ajv@comp.vuw.ac.nz
- */
- sc->sc_density = (sc->sc_stat2 & SR2_6250) ? T_6250BPI : (
- (sc->sc_stat3 & SR3_1600) ? T_1600BPI : (
- (sc->sc_stat3 & SR3_800) ? T_800BPI : -1));
- req_den = (dev & T_DENSEL);
-
- if (flag & FWRITE) {
- if (!(sc->sc_stat1 & SR1_BOT)) {
- if (sc->sc_density != req_den) {
- uprintf("%s: can't change density mid-tape\n",
- sc->sc_dev.dv_xname);
- error = EIO;
- goto errout;
- }
- }
- else {
- int mtset_density =
- (req_den == T_800BPI ? MTSET800BPI : (
- req_den == T_1600BPI ? MTSET1600BPI : (
- req_den == T_6250BPI ? MTSET6250BPI : (
- sc->sc_type == MT7980ID
- ? MTSET6250DC
- : MTSET6250BPI))));
- if (mtcommand(dev, mtset_density, 0) == 0)
- sc->sc_density = req_den;
- }
- }
- return (0);
-errout:
- sc->sc_flags &= ~MTF_OPEN;
- return (error);
-}
-
-int
-mtclose(dev, flag, fmt, p)
- dev_t dev;
- int flag, fmt;
- struct proc *p;
-{
- struct mt_softc *sc = mt_cd.cd_devs[UNIT(dev)];
-
- if (sc->sc_flags & MTF_WRT) {
- (void) mtcommand(dev, MTWEOF, 2);
- (void) mtcommand(dev, MTBSF, 0);
- }
- if ((minor(dev) & T_NOREWIND) == 0)
- (void) mtcommand(dev, MTREW, 0);
- sc->sc_flags &= ~MTF_OPEN;
- return (0);
-}
-
-int
-mtcommand(dev, cmd, cnt)
- dev_t dev;
- int cmd;
- int cnt;
-{
- struct buf b;
- int error = 0;
-
- bzero(&b, sizeof(b));
- b.b_cmd = cmd;
- b.b_dev = dev;
- do {
- b.b_flags = B_BUSY | B_CMD | B_RAW;
- mtstrategy(&b);
- biowait(&b);
- if (b.b_flags & B_ERROR) {
- error = (int) (unsigned) b.b_error;
- break;
- }
- } while (--cnt > 0);
-
- return (error);
-}
-
-/*
- * Only thing to check here is for legal record lengths (writes only).
- */
-void
-mtstrategy(bp)
- struct buf *bp;
-{
- struct mt_softc *sc;
- struct buf *dp;
- int unit;
- int s;
-
- unit = UNIT(bp->b_dev);
- sc = mt_cd.cd_devs[unit];
- dlog(LOG_DEBUG, "%s strategy", sc->sc_dev.dv_xname);
- if ((bp->b_flags & (B_CMD | B_READ)) == 0) {
-#define WRITE_BITS_IGNORED 8
-#if 0
- if (bp->b_bcount & ((1 << WRITE_BITS_IGNORED) - 1)) {
- printf("%s: write record must be multiple of %d\n",
- sc->sc_dev.dv_xname, 1 << WRITE_BITS_IGNORED);
- goto error;
- }
-#endif
- s = 16 * 1024;
- if (sc->sc_stat2 & SR2_LONGREC) {
- switch (sc->sc_density) {
- case T_1600BPI:
- s = 32 * 1024;
- break;
-
- case T_6250BPI:
- case T_BADBPI:
- s = 60 * 1024;
- break;
- }
- }
- if (bp->b_bcount > s) {
- printf("%s: write record (%ld) too big: limit (%d)\n",
- sc->sc_dev.dv_xname, bp->b_bcount, s);
-#if 0 /* XXX see above */
- error:
-#endif
- bp->b_flags |= B_ERROR;
- bp->b_error = EIO;
- s = splbio();
- biodone(bp);
- splx(s);
- return;
- }
- }
- dp = &sc->sc_tab;
- bp->b_actf = NULL;
- s = splbio();
- bp->b_actb = dp->b_actb;
- *dp->b_actb = bp;
- dp->b_actb = &bp->b_actf;
- if (dp->b_active == 0) {
- dp->b_active = 1;
- mtustart(sc);
- }
- splx(s);
-}
-
-void
-mtustart(sc)
- struct mt_softc *sc;
-{
-
- dlog(LOG_DEBUG, "%s ustart", sc->sc_dev.dv_xname);
- if (hpibreq(sc->sc_dev.dv_parent, &sc->sc_hq))
- mtstart(sc);
-}
-
-void
-spl_mtintr(arg)
- void *arg;
-{
- struct mt_softc *sc = arg;
- int s = splbio();
-
- hpibppclear(sc->sc_hpibno);
- mtintr(sc);
- splx(s);
-}
-
-void
-spl_mtstart(arg)
- void *arg;
-{
- int s = splbio();
-
- mtstart(arg);
- splx(s);
-}
-
-void
-mtstart(arg)
- void *arg;
-{
- struct mt_softc *sc = arg;
- struct buf *bp, *dp;
- short cmdcount = 1;
- u_char cmdbuf[2];
- int s;
-
- dlog(LOG_DEBUG, "%s start", sc->sc_dev.dv_xname);
- sc->sc_flags &= ~MTF_WRT;
- bp = sc->sc_tab.b_actf;
- if ((sc->sc_flags & MTF_ALIVE) == 0 &&
- ((bp->b_flags & B_CMD) == 0 || bp->b_cmd != MTRESET))
- goto fatalerror;
-
- if (sc->sc_flags & MTF_REW) {
- if (!hpibpptest(sc->sc_hpibno, sc->sc_slave))
- goto stillrew;
- switch (mtreaddsj(sc, MTE_DSJ_FORCE|MTE_COMPLETE|MTE_IDLE)) {
- case 0:
- case 1:
- stillrew:
- if ((sc->sc_stat1 & SR1_BOT) ||
- !(sc->sc_stat1 & SR1_ONLINE)) {
- sc->sc_flags &= ~MTF_REW;
- break;
- }
- case -2:
- /*
- * -2 means "timeout" reading DSJ, which is probably
- * temporary. This is considered OK when doing a NOP,
- * but not otherwise.
- */
- if (sc->sc_flags & (MTF_DSJTIMEO | MTF_STATTIMEO)) {
- timeout_add_msec(&sc->sc_start_to, 1000 >> 5);
- return;
- }
- case 2:
- if (bp->b_cmd != MTNOP || !(bp->b_flags & B_CMD)) {
- bp->b_error = EBUSY;
- goto errdone;
- }
- goto done;
-
- default:
- goto fatalerror;
- }
- }
- if (bp->b_flags & B_CMD) {
- if (sc->sc_flags & MTF_PASTEOT) {
- switch(bp->b_cmd) {
- case MTFSF:
- case MTWEOF:
- case MTFSR:
- bp->b_error = ENOSPC;
- goto errdone;
-
- case MTBSF:
- case MTOFFL:
- case MTBSR:
- case MTREW:
- sc->sc_flags &= ~(MTF_PASTEOT | MTF_ATEOT);
- break;
- }
- }
- switch(bp->b_cmd) {
- case MTFSF:
- if (sc->sc_flags & MTF_HITEOF)
- goto done;
- cmdbuf[0] = MTTC_FSF;
- break;
-
- case MTBSF:
- if (sc->sc_flags & MTF_HITBOF)
- goto done;
- cmdbuf[0] = MTTC_BSF;
- break;
-
- case MTOFFL:
- sc->sc_flags |= MTF_REW;
- cmdbuf[0] = MTTC_REWOFF;
- break;
-
- case MTWEOF:
- cmdbuf[0] = MTTC_WFM;
- break;
-
- case MTBSR:
- cmdbuf[0] = MTTC_BSR;
- break;
-
- case MTFSR:
- cmdbuf[0] = MTTC_FSR;
- break;
-
- case MTREW:
- sc->sc_flags |= MTF_REW;
- cmdbuf[0] = MTTC_REW;
- break;
-
- case MTNOP:
- /*
- * NOP is supposed to set status bits.
- * Force readdsj to do it.
- */
- switch (mtreaddsj(sc,
- MTE_DSJ_FORCE | MTE_COMPLETE | MTE_IDLE)) {
- default:
- goto done;
-
- case -1:
- /*
- * If this fails, perform a device clear
- * to fix any protocol problems and (most
- * likely) get the status.
- */
- bp->b_cmd = MTRESET;
- break;
-
- case -2:
- timeout_add_msec(&sc->sc_start_to, 1000 >> 5);
- return;
- }
-
- case MTRESET:
- /*
- * 1) selected device clear (send with "-2" secondary)
- * 2) set timeout, then wait for "service request"
- * 3) interrupt will read DSJ (and END COMPLETE-IDLE)
- */
- if (hpibsend(sc->sc_hpibno, sc->sc_slave, -2, NULL, 0)){
- log(LOG_ERR, "%s can't reset",
- sc->sc_dev.dv_xname);
- goto fatalerror;
- }
- timeout_add_sec(&sc->sc_intr_to, 4);
- hpibawait(sc->sc_hpibno);
- return;
-
- case MTSET800BPI:
- cmdbuf[0] = MTTC_800;
- break;
-
- case MTSET1600BPI:
- cmdbuf[0] = MTTC_1600;
- break;
-
- case MTSET6250BPI:
- cmdbuf[0] = MTTC_6250;
- break;
-
- case MTSET6250DC:
- cmdbuf[0] = MTTC_DC6250;
- break;
- }
- } else {
- if (sc->sc_flags & MTF_PASTEOT) {
- bp->b_error = ENOSPC;
- goto errdone;
- }
- if (bp->b_flags & B_READ) {
- sc->sc_flags |= MTF_IO;
- cmdbuf[0] = MTTC_READ;
- } else {
- sc->sc_flags |= MTF_WRT | MTF_IO;
- cmdbuf[0] = MTTC_WRITE;
- cmdbuf[1] = (bp->b_bcount + ((1 << WRITE_BITS_IGNORED) - 1)) >> WRITE_BITS_IGNORED;
- cmdcount = 2;
- }
- }
- if (hpibsend(sc->sc_hpibno, sc->sc_slave, MTL_TCMD, cmdbuf, cmdcount)
- == cmdcount) {
- if (sc->sc_flags & MTF_REW)
- goto done;
- hpibawait(sc->sc_hpibno);
- return;
- }
-fatalerror:
- /*
- * If anything fails, the drive is probably hosed, so mark it not
- * "ALIVE" (but it EXISTS and is OPEN or we wouldn't be here, and
- * if, last we heard, it was REWinding, remember that).
- */
- sc->sc_flags &= MTF_EXISTS | MTF_OPEN | MTF_REW;
- bp->b_error = EIO;
-errdone:
- bp->b_flags |= B_ERROR;
-done:
- sc->sc_flags &= ~(MTF_HITEOF | MTF_HITBOF);
- s = splbio();
- biodone(bp);
- splx(s);
- if ((dp = bp->b_actf))
- dp->b_actb = bp->b_actb;
- else
- sc->sc_tab.b_actb = bp->b_actb;
- *bp->b_actb = dp;
- hpibfree(sc->sc_dev.dv_parent, &sc->sc_hq);
- if ((bp = dp) == NULL)
- sc->sc_tab.b_active = 0;
- else
- mtustart(sc);
-}
-
-/*
- * The Utah code had a bug which meant that the driver was unable to read.
- * "rw" was initialized to bp->b_flags & B_READ before "bp" was initialized.
- * -- ajv@comp.vuw.ac.nz
- */
-void
-mtgo(arg)
- void *arg;
-{
- struct mt_softc *sc = arg;
- struct buf *bp;
- int rw;
-
- dlog(LOG_DEBUG, "%s go", sc->sc_dev.dv_xname);
- bp = sc->sc_tab.b_actf;
- rw = bp->b_flags & B_READ;
- hpibgo(sc->sc_hpibno, sc->sc_slave, rw ? MTT_READ : MTL_WRITE,
- bp->b_data, bp->b_bcount, rw, rw != 0);
-}
-
-void
-mtintr(arg)
- void *arg;
-{
- struct mt_softc *sc = arg;
- struct buf *bp, *dp;
- int i;
- u_char cmdbuf[4];
-
- bp = sc->sc_tab.b_actf;
- if (bp == NULL) {
- log(LOG_ERR, "%s intr: bp == NULL", sc->sc_dev.dv_xname);
- return;
- }
-
- dlog(LOG_DEBUG, "%s intr", sc->sc_dev.dv_xname);
-
- /*
- * Some operation completed. Read status bytes and report errors.
- * Clear EOF flags here `cause they're set once on specific conditions
- * below when a command succeeds.
- * A DSJ of 2 always means keep waiting. If the command was READ
- * (and we're in data DMA phase) stop data transfer first.
- */
- sc->sc_flags &= ~(MTF_HITEOF | MTF_HITBOF);
- if ((bp->b_flags & (B_CMD|B_READ)) == B_READ &&
- !(sc->sc_flags & (MTF_IO | MTF_STATTIMEO | MTF_DSJTIMEO))){
- cmdbuf[0] = MTE_STOP;
- (void) hpibsend(sc->sc_hpibno, sc->sc_slave, MTL_ECMD,cmdbuf,1);
- }
- switch (mtreaddsj(sc, 0)) {
- case 0:
- break;
-
- case 1:
- /*
- * If we're in the middle of a READ/WRITE and have yet to
- * start the data transfer, a DSJ of one should terminate it.
- */
- sc->sc_flags &= ~MTF_IO;
- break;
-
- case 2:
- (void) hpibawait(sc->sc_hpibno);
- return;
-
- case -2:
- /*
- * -2 means that the drive failed to respond quickly enough
- * to the request for DSJ. It's probably just "busy" figuring
- * it out and will know in a little bit...
- */
- timeout_add_msec(&sc->sc_intr_to, 1000 >> 5);
- return;
-
- default:
- log(LOG_ERR, "%s intr: can't get drive stat",
- sc->sc_dev.dv_xname);
- goto error;
- }
- if (sc->sc_stat1 & (SR1_ERR | SR1_REJECT)) {
- i = sc->sc_stat4 & SR4_ERCLMASK;
- log(LOG_ERR, "%s: %s error, retry %d, SR2/3 %x/%x, code %d",
- sc->sc_dev.dv_xname, i == SR4_DEVICE ? "device" :
- (i == SR4_PROTOCOL ? "protocol" :
- (i == SR4_SELFTEST ? "selftest" : "unknown")),
- sc->sc_stat4 & SR4_RETRYMASK, sc->sc_stat2,
- sc->sc_stat3, sc->sc_stat5);
-
- if ((bp->b_flags & B_CMD) && bp->b_cmd == MTRESET)
- timeout_del(&sc->sc_intr_to);
- if (sc->sc_stat3 & SR3_POWERUP)
- sc->sc_flags &= MTF_OPEN | MTF_EXISTS;
- goto error;
- }
- /*
- * Report and clear any soft errors.
- */
- if (sc->sc_stat1 & SR1_SOFTERR) {
- log(LOG_WARNING, "%s: soft error, retry %d\n",
- sc->sc_dev.dv_xname, sc->sc_stat4 & SR4_RETRYMASK);
- sc->sc_stat1 &= ~SR1_SOFTERR;
- }
- /*
- * We've initiated a read or write, but haven't actually started to
- * DMA the data yet. At this point, the drive's ready.
- */
- if (sc->sc_flags & MTF_IO) {
- sc->sc_flags &= ~MTF_IO;
- if (hpibustart(sc->sc_hpibno))
- mtgo(sc);
- return;
- }
- /*
- * Check for End Of Tape - we're allowed to hit EOT and then write (or
- * read) one more record. If we get here and have not already hit EOT,
- * return ENOSPC to inform the process that it's hit it. If we get
- * here and HAVE already hit EOT, don't allow any more operations that
- * move the tape forward.
- */
- if (sc->sc_stat1 & SR1_EOT) {
- if (sc->sc_flags & MTF_ATEOT)
- sc->sc_flags |= MTF_PASTEOT;
- else {
- bp->b_flags |= B_ERROR;
- bp->b_error = ENOSPC;
- sc->sc_flags |= MTF_ATEOT;
- }
- }
- /*
- * If a motion command was being executed, check for Tape Marks.
- * If we were doing data, make sure we got the right amount, and
- * check for hitting tape marks on reads.
- */
- if (bp->b_flags & B_CMD) {
- if (sc->sc_stat1 & SR1_EOF) {
- if (bp->b_cmd == MTFSR)
- sc->sc_flags |= MTF_HITEOF;
- if (bp->b_cmd == MTBSR)
- sc->sc_flags |= MTF_HITBOF;
- }
- if (bp->b_cmd == MTRESET) {
- timeout_del(&sc->sc_intr_to);
- sc->sc_flags |= MTF_ALIVE;
- }
- } else {
- i = hpibrecv(sc->sc_hpibno, sc->sc_slave, MTT_BCNT, cmdbuf, 2);
- if (i != 2) {
- log(LOG_ERR, "%s intr: can't get xfer length\n",
- sc->sc_dev.dv_xname);
- goto error;
- }
- i = (int) *((u_short *) cmdbuf);
- if (i <= bp->b_bcount) {
- if (i == 0)
- sc->sc_flags |= MTF_HITEOF;
- bp->b_resid = bp->b_bcount - i;
- dlog(LOG_DEBUG, "%s intr: bcount %ld, resid %d",
- sc->sc_dev.dv_xname, bp->b_bcount, bp->b_resid);
- } else {
- printf("%s: record (%d) larger than wanted (%ld)\n",
- sc->sc_dev.dv_xname, i, bp->b_bcount);
- error:
- sc->sc_flags &= ~MTF_IO;
- bp->b_error = EIO;
- bp->b_flags |= B_ERROR;
- }
- }
- /*
- * The operation is completely done.
- * Let the drive know with an END command.
- */
- cmdbuf[0] = MTE_COMPLETE | MTE_IDLE;
- (void) hpibsend(sc->sc_hpibno, sc->sc_slave, MTL_ECMD, cmdbuf, 1);
- bp->b_flags &= ~B_CMD;
- biodone(bp);
- if ((dp = bp->b_actf))
- dp->b_actb = bp->b_actb;
- else
- sc->sc_tab.b_actb = bp->b_actb;
- *bp->b_actb = dp;
- hpibfree(sc->sc_dev.dv_parent, &sc->sc_hq);
-#if 0
- if (bp /*sc->sc_tab.b_actf*/ == NULL)
-#else
- if (sc->sc_tab.b_actf == NULL)
-#endif
- sc->sc_tab.b_active = 0;
- else
- mtustart(sc);
-}
-
-int
-mtread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- return (physio(mtstrategy, dev, B_READ, minphys, uio));
-}
-
-int
-mtwrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- return (physio(mtstrategy, dev, B_WRITE, minphys, uio));
-}
-
-int
-mtioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct mtop *op;
- int cnt;
-
- switch (cmd) {
- case MTIOCTOP:
- op = (struct mtop *)data;
- switch(op->mt_op) {
- case MTWEOF:
- case MTFSF:
- case MTBSR:
- case MTBSF:
- case MTFSR:
- cnt = op->mt_count;
- break;
-
- case MTOFFL:
- case MTREW:
- case MTNOP:
- cnt = 0;
- break;
-
- default:
- return (EINVAL);
- }
- return (mtcommand(dev, op->mt_op, cnt));
-
- case MTIOCGET:
- break;
-
- default:
- return (EINVAL);
- }
- return (0);
-}
-
-/*ARGSUSED*/
-int
-mtdump(dev, blkno, va, size)
- dev_t dev;
- daddr_t blkno;
- caddr_t va;
- size_t size;
-{
- return (ENODEV);
-}
diff --git a/sys/arch/hp300/dev/mtreg.h b/sys/arch/hp300/dev/mtreg.h
deleted file mode 100644
index 0277ca49056..00000000000
--- a/sys/arch/hp300/dev/mtreg.h
+++ /dev/null
@@ -1,297 +0,0 @@
-/* $OpenBSD: mtreg.h,v 1.4 2005/01/15 21:13:08 miod Exp $ */
-/* $NetBSD: mtreg.h,v 1.1 1995/10/02 00:28:22 thorpej Exp $ */
-
-/*
- * Copyright (c) 1992, The University of Utah and
- * the Computer Systems Laboratory at the University of Utah (CSL).
- * All rights reserved.
- *
- * Permission to use, copy, modify and distribute this software is hereby
- * granted provided that (1) source code retains these copyright, permission,
- * and disclaimer notices, and (2) redistributions including binaries
- * reproduce the notices in supporting documentation, and (3) all advertising
- * materials mentioning features or use of this software display the following
- * acknowledgement: ``This product includes software developed by the
- * Computer Systems Laboratory at the University of Utah.''
- *
- * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
- * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
- * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * CSL requests users of this software to return to csl-dist@cs.utah.edu any
- * improvements that they make and grant CSL redistribution rights.
- *
- * Utah $Hdr: mtreg.h 1.4 95/09/12$
- */
-/* @(#)mtreg.h 3.4 90/07/10 mt Xinu
- *
- * Hewlett-Packard 7974, 7978, 7979 and 7980 HPIB Mag-Tape declarations.
- */
-
-/*
- * Hardware Id's
- */
-
-#define MT7974AID 0x174
-#define MT7978ID 0x178
-#define MT7979AID 0x179
-#define MT7980ID 0x180
-
-/* convert bytes to 1k tape block and back */
-#define CTBTOK(x) ((x) >> 10)
-#define CTKTOB(x) ((x) << 10)
-
-/*
- * Listen Secondary Commands
- */
-
-#define MTL_WRITE 0 /* write execute */
-#define MTL_TCMD 1 /* tape command */
-#define MTL_DIAG 4 /* download diagnostic */
-#define MTL_FUP 6 /* write firmware update */
-#define MTL_ECMD 7 /* end command */
-#define MTL_DCL 16 /* amigo device clear */
-#define MTL_CCRC 17 /* clear CRC */
-#define MTL_XTEST 29 /* run 7979a/7980 extended self test */
-#define MTL_LOOP 30 /* write interface loopback */
-#define MTL_TEST 31 /* run self test */
-
-/*
- * Talk Secondary Commands
- */
-
-#define MTT_READ 0 /* read execute */
-#define MTT_STAT 1 /* read status */
-#define MTT_BCNT 2 /* read byte count */
-#define MTT_DIAG 3 /* read diagnostic results */
-#define MTT_FREV 4 /* read firmware revisions (7980xc) */
-#define MTT_LOG 5 /* read diagnostic log */
-#define MTT_FUP 6 /* read firmware update */
-#define MTT_XSTAT 15 /* read extended status (7979a/7980a) */
-#define MTT_DSJ 16 /* read DSJ (device specified jump) */
-#define MTT_RCRC 17 /* read CRC */
-#define MTT_XTEST 29 /* read 7979a/7980 extended self test */
-#define MTT_LOOP 30 /* read interface loopback */
-#define MTT_TEST 31 /* read self test */
-
-/*
- * Tape commands
- */
-
-#define MTTC_SEL0 0 /* Select Unit 0 (native protocol) */
-#define MTTC_WRITE 5 /* Write Record */
-#define MTTC_WFM 6 /* Write File Mark */
-#define MTTC_WGAP 7 /* Write Gap */
-#define MTTC_READ 8 /* Read record */
-#define MTTC_FSR 9 /* forward space record */
-#define MTTC_BSR 10 /* backward space record */
-#define MTTC_FSF 11 /* forward space file */
-#define MTTC_BSF 12 /* backward space file */
-#define MTTC_REW 13 /* rewind */
-#define MTTC_REWOFF 14 /* rewind and go offline */
-#define MTTC_DC6250 15 /* set data compressed 6250 */
-#define MTTC_6250 16 /* set 6250 bpi */
-#define MTTC_1600 17 /* set 1600 bpi */
-#define MTTC_800 18 /* set 800 bpi */
-#define MTTC_NC6250 19 /* set non-compressed 6250 */
-#define MTTC_STSTP 20 /* start/stop mode only */
-#define MTTC_STRM 21 /* enable streaming */
-#define MTTC_DIRM 22 /* disable immediate report mode */
-#define MTTC_EIRM 23 /* enable immediate report mode */
-#define MTTC_STAT 24 /* request status */
-#define MTTC_RLD 25 /* remote load */
-#define MTTC_RUNLD 26 /* remote unload */
-#define MTTC_RON 28 /* remote online */
-#define MTTC_DDC 30 /* disable data compression */
-#define MTTC_EDC 31 /* enable data compression */
-
-/*
- * End Command Bits (of any interest)
- */
-#define MTE_COMPLETE 0x08 /* "marks the end of the report phase" */
-#define MTE_IDLE 0x04 /* enables parallel poll resp. for online */
-#define MTE_STOP 0x02 /* aborts transfer of "read" data */
-
-#define MTE_DSJ_FORCE 0x100 /* XXX During readDSJ, force a status fetch */
-
-
-struct mt_stat {
- u_char m_stat[6];
-};
-
-/* sc_flags */
-#define MTF_OPEN 0x0001 /* drive is in use (single-access device) */
-#define MTF_EXISTS 0x0002 /* device was found at boot time */
-#define MTF_ALIVE 0x0004 /* drive actually talks to us */
-#define MTF_WRT 0x0008 /* last command was a WRITE */
-#define MTF_IO 0x0010 /* next interrupt should start I/O (DMA) */
-#define MTF_REW 0x0020 /* tape is rewinding - must wait for it */
-#define MTF_HITEOF 0x0040 /* last read or FSR hit EOF (file mark) */
-#define MTF_HITBOF 0x0080 /* last BSR hit EOF (file mark) */
-#define MTF_ATEOT 0x0100 /* tape hit EOT - can allow one forward op */
-#define MTF_PASTEOT 0x0200 /* tape is beyond EOT - force backward motion */
-#define MTF_DSJTIMEO 0x0400 /* timed out hpibrecv()ing DSJ - continue it */
-#define MTF_STATTIMEO 0x0800 /* timed out receiving STATUS - continue it */
-#define MTF_STATCONT 0x1000 /* STATTIMEO is continuable */
-
-/* additional "mtcommand"s */
-#define MTRESET 16 /* reset the thing from scratch */
-#define MTSET800BPI 17 /* density select */
-#define MTSET1600BPI 18
-#define MTSET6250BPI 19
-#define MTSET6250DC 20 /* (data compressed - MT7980ID only) */
-
-/* status bytes */
-#define sc_stat1 sc_stat.m_stat[0]
-#define sc_stat2 sc_stat.m_stat[1]
-#define sc_stat3 sc_stat.m_stat[2]
-#define sc_stat4 sc_stat.m_stat[3]
-#define sc_stat5 sc_stat.m_stat[4]
-#define sc_stat6 sc_stat.m_stat[5]
-
-/*
- * Status Register definitions
- */
-
-#define SR1_EOF 0x80 /* positioned at File Mark */
-#define SR1_BOT 0x40 /* positioned at Beginning of Tape */
-#define SR1_EOT 0x20 /* positioned at End of Tape */
-#define SR1_SOFTERR 0x10 /* Recoverable Error has Occured */
-#define SR1_REJECT 0x08 /* HPIB Cmd rejected - Regs 4 & 5 have info */
-#define SR1_RO 0x04 /* No Write Ring */
-#define SR1_ERR 0x02 /* Unrecoverable Data error - Reg 5 has info */
-#define SR1_ONLINE 0x01 /* Drive Online (must be to do any operation) */
-
-#define SR2_6250 0x80 /* tape is 6250BPI */
-#define SR2_UNKDEN 0x40 /* non-blank tape is of unknown density */
-#define SR2_PARITY 0x20 /* internal bus data parity error detected */
-#define SR2_OVERRUN 0x10 /* data buffer overrun (not possible?) */
-#define SR2_RUNAWAY 0x08 /* during read, no data detected on tape */
-#define SR2_OPEN 0x04 /* tape door is open */
-#define SR2_LONGREC 0x02 /* large record support (32k@1600, 60K@6250,
- otherwise, it's 16K at all densities) */
-#define SR2_IMMED 0x01 /* Immediate Response (for writes) enabled */
-
-#define SR3_1600 0x80 /* tape is 1600BPI */
-#define SR3_800 0x40 /* tape is 800BPI */
-#define SR3_POWERUP 0x20 /* power recently restored or Dev Clr done */
-#define SR3_HPIBPAR 0x10 /* HPIB command parity error detected */
-#define SR3_LOST 0x08 /* position on tape is unknown */
-#define SR3_FMTERR 0x04 /* formatter error - Reg 5 has info */
-#define SR3_SVOERR 0x02 /* motion servo error - Reg 4 has info */
-#define SR3_CTLERR 0x01 /* controller error - Reg 5 has info */
-
-#define SR4_ERCLMASK 0xe0 /* Mask of error classes (for SR1_REJECT) */
-#define SR4_NONE 0x00
-#define SR4_DEVICE 0x40
-#define SR4_PROTOCOL 0x60
-#define SR4_SELFTEST 0xe0
-#define SR4_RETRYMASK 0x1f /* Mask for retry count (for any error) */
-
-/* SR5 holds lots of error codes, referenced above. Complete list:
- * (DEVICE REJECT)
- * 5 Tape is write protected
- * 6 Tape isn't loaded
- * 7 Requested density not supported
- * 9 Tape being read is unreadable
- * 10 Tape being written is unidentifiable
- * 11 Drive offline
- * 16 Changing density while not at BOT
- * 19 Backward motion requested while at BOT
- * 23 Protocol out of sync
- * 24 Unknown tape command
- * 31 Write request too big for drive/density
- * 32 Beyond EOT
- * 33 Self Test Failure
- * 37 Tape positioning failure while removing readaheads
- * 40 Door open
- * (UNRECOVERED DATA/FORMAT ERRORS)
- * 41 Tape velocity out of spec
- * 45 Multiple track data error
- * 47 Write verify failed
- * 48 Noise found while trying to detect data record
- * 49 Data format error
- * 50 Couldn't identify tape after rewind
- * 51 Gap detected before end of data record
- * 52 Data block dropout
- * 53 CRC error
- * 54 Parity error
- * 55 Door open
- * 57 Maximum skew exceeded
- * 58 False data block detected
- * 59 Corrected data error on write
- * 60 Buffer overrun - record size on tape larger than supported
- * 61 Data block timeout (possibly record length too long)
- * 62 Tape mark dropout
- * 63 Tape mark unverified
- * 64 Tape mark timeout (no gap following tape mark)
- * (POSITION or SERVO ERRORS) - these are ALL internal to tape drive
- * 81 Servo unresponsive
- * 82 Servo didn't respond with corect state
- * 83 Servo shutdown
- * 84 Servo detected hardware failure
- * 85 Servo protocol error
- * 86 Runtime Servo error
- * 87 Missing position interrupt
- * 88 No Gap after read or write
- * 89 Motor shutdown for safety reasons
- * 90 Couldn't find tape BOT mark
- * 91 Drive motor running too fast or slow
- * 92 Requested controller state invalid within context
- * 94 Tape positioning failure
- * (FORMATTER ERROR)
- * 101,108 Read formatter unresponsive
- * 102,107 Read formatter hardware error
- * 103 Write detected bad block
- * 104 Erase failure
- * 105 No data detected after write
- * 106 Tracks out of sync on write verify
- * 109 No gap timeout
- * 110 Formatter <--> data buffer byte count mismatch
- * (CONTROLLER ERROR) - these are ALL internal to drive
- * 121 Transaction ID mismatch (device vs. controller)
- * 122 Devoce report has no coorepinding command
- * 123 Invalid device report
- * 124 Repost queue overflow
- * 125 Unknown command from device
- * 126 Command queue overflow
- * 128 Missing End-Of-Record flag in data buffer
- * 129 Data buffer parity error
- * 130 Data buffer underrun during write
- * 131 Byte count mismatch in data buffer queue
- * 132 Bad message type from device
- * 133 Abort between HPIB interface and channel program
- * 134 Unknown HPIB interface exception
- * 137 Illegal access to servo conntroller registers
- * 138 Device program firmware error
- * 139 Hardware utilities firmware error
- * 140 Channel program firmware error
- * 141 Encoder inoperative
- * 150 Tape position synchronization error
- * 151 Tape deblocking error (Xtra Capacity only)
- * 152 Compression/Decompression hardware error (Xtra Capacity only)
- * (PROTOCOL ERROR) - USUALLY indicates deficiency in driver
- * 161 No room in Command Queue
- * 162 Expected "request DSJ"
- * 163 Expected status request
- * 165 Unknown unit select
- * 166 Tape command secondary expected
- * 167 Data byte expected
- * 168 Missing EOI on data byte
- * 170 Write command phase protocol error
- * 172 Read record report phase error
- * 173 Report phase protocol error
- * 174 Cold load sequence error
- * 175 HPIB protocol sequence error
- * 176 END command expected
- * 178 END DATA expected
- * 180 Unknown interface secondary command
- * 181 Misplaced data byte
- * 184 Interface Loopback protocol error
- * 185 Self test protocol error
- * 188 HPIB parity error
- * 189 Operator reset during protocol sequence
- * 190 Device clear received
- */
-
-/* SR6 is count of commands accepted since Immediate Response command failed */
diff --git a/sys/arch/hp300/dev/nhpib.c b/sys/arch/hp300/dev/nhpib.c
deleted file mode 100644
index 896e1a7f75f..00000000000
--- a/sys/arch/hp300/dev/nhpib.c
+++ /dev/null
@@ -1,555 +0,0 @@
-/* $OpenBSD: nhpib.c,v 1.18 2013/08/04 07:21:13 martin Exp $ */
-/* $NetBSD: nhpib.c,v 1.17 1997/05/05 21:06:41 thorpej Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)nhpib.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * Internal/98624 HPIB driver
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/timeout.h>
-
-#include <machine/autoconf.h>
-#include <machine/intr.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-
-#include <hp300/dev/dmavar.h>
-
-#include <hp300/dev/nhpibreg.h>
-#include <hp300/dev/hpibvar.h>
-
-/*
- * ODD parity table for listen and talk addresses and secondary commands.
- * The TI9914A doesn't produce the parity bit.
- */
-static const u_char listnr_par[] = {
- 0040,0241,0242,0043,0244,0045,0046,0247,
- 0250,0051,0052,0253,0054,0255,0256,0057,
- 0260,0061,0062,0263,0064,0265,0266,0067,
- 0070,0271,0272,0073,0274,0075,0076,0277,
-};
-static const u_char talker_par[] = {
- 0100,0301,0302,0103,0304,0105,0106,0307,
- 0310,0111,0112,0313,0114,0315,0316,0117,
- 0320,0121,0122,0323,0124,0325,0326,0127,
- 0130,0331,0332,0133,0334,0135,0136,0337,
-};
-static const u_char sec_par[] = {
- 0340,0141,0142,0343,0144,0345,0346,0147,
- 0150,0351,0352,0153,0354,0155,0156,0357,
- 0160,0361,0362,0163,0364,0165,0166,0367,
- 0370,0171,0172,0373,0174,0375,0376,0177
-};
-
-void nhpibifc(struct nhpibdevice *);
-void nhpibreadtimo(void *);
-int nhpibwait(struct nhpibdevice *, int);
-
-void nhpibreset(struct hpibbus_softc *);
-int nhpibsend(struct hpibbus_softc *, int, int, void *, int);
-int nhpibrecv(struct hpibbus_softc *, int, int, void *, int);
-int nhpibppoll(struct hpibbus_softc *);
-void nhpibppwatch(void *);
-void nhpibgo(struct hpibbus_softc *, int, int, void *, int, int, int);
-void nhpibdone(struct hpibbus_softc *);
-int nhpibintr(void *);
-
-/*
- * Our controller ops structure.
- */
-struct hpib_controller nhpib_controller = {
- nhpibreset,
- nhpibsend,
- nhpibrecv,
- nhpibppoll,
- nhpibppwatch,
- nhpibgo,
- nhpibdone,
- nhpibintr
-};
-
-struct nhpib_softc {
- struct device sc_dev; /* generic device glue */
- struct isr sc_isr;
- struct nhpibdevice *sc_regs; /* device registers */
- struct hpibbus_softc *sc_hpibbus; /* XXX */
- struct timeout sc_read_to; /* nhpibreadtimo timeout */
- struct timeout sc_watch_to; /* nhpibppwatch timeout */
-};
-
-int nhpibmatch(struct device *, void *, void *);
-void nhpibattach(struct device *, struct device *, void *);
-
-struct cfattach nhpib_ca = {
- sizeof(struct nhpib_softc), nhpibmatch, nhpibattach
-};
-
-struct cfdriver nhpib_cd = {
- NULL, "nhpib", DV_DULL
-};
-
-int
-nhpibmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- /*
- * Internal HP-IB doesn't always return a device ID,
- * so we rely on the sysflags.
- */
- if (da->da_scode == 7 && internalhpib)
- return (1);
-
- if (da->da_id == DIO_DEVICE_ID_NHPIB)
- return (1);
-
- return (0);
-}
-
-void
-nhpibattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct nhpib_softc *sc = (struct nhpib_softc *)self;
- struct dio_attach_args *da = aux;
- struct hpibdev_attach_args ha;
- const char *desc;
- int ipl, type = HPIBA;
-
- sc->sc_regs = (struct nhpibdevice *)iomap(dio_scodetopa(da->da_scode),
- da->da_size);
- if (sc->sc_regs == NULL) {
- printf("\n%s: can't map registers\n", self->dv_xname);
- return;
- }
-
- ipl = DIO_IPL(sc->sc_regs);
-
- if (da->da_scode == 7 && internalhpib)
- desc = DIO_DEVICE_DESC_IHPIB;
- else if (da->da_id == DIO_DEVICE_ID_NHPIB) {
- type = HPIBB;
- desc = DIO_DEVICE_DESC_NHPIB;
- } else
- desc = "unknown HP-IB!";
-
- printf(" ipl %d: %s\n", ipl, desc);
-
- /* Establish the interrupt handler. */
- sc->sc_isr.isr_func = nhpibintr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_ipl = ipl;
- sc->sc_isr.isr_priority = IPL_BIO;
- dio_intr_establish(&sc->sc_isr, self->dv_xname);
-
- /* Initialize timeout structures */
- timeout_set(&sc->sc_read_to, nhpibreadtimo, sc);
-
- ha.ha_ops = &nhpib_controller;
- ha.ha_type = type; /* XXX */
- ha.ha_ba = (type == HPIBA) ? HPIBA_BA :
- (sc->sc_regs->hpib_csa & CSA_BA);
- ha.ha_softcpp = &sc->sc_hpibbus; /* XXX */
- (void)config_found(self, &ha, hpibdevprint);
-}
-
-void
-nhpibreset(hs)
- struct hpibbus_softc *hs;
-{
- struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
- struct nhpibdevice *hd = sc->sc_regs;
-
- hd->hpib_acr = AUX_SSWRST;
- hd->hpib_ar = hs->sc_ba;
- hd->hpib_lim = LIS_ERR;
- hd->hpib_mim = 0;
- hd->hpib_acr = AUX_CDAI;
- hd->hpib_acr = AUX_CSHDW;
- hd->hpib_acr = AUX_SSTD1;
- hd->hpib_acr = AUX_SVSTD1;
- hd->hpib_acr = AUX_CPP;
- hd->hpib_acr = AUX_CHDFA;
- hd->hpib_acr = AUX_CHDFE;
- hd->hpib_acr = AUX_RHDF;
- hd->hpib_acr = AUX_CSWRST;
- nhpibifc(hd);
- hd->hpib_ie = IDS_IE;
- hd->hpib_data = C_DCL_P;
- DELAY(100000);
-}
-
-void
-nhpibifc(hd)
- struct nhpibdevice *hd;
-{
- hd->hpib_acr = AUX_TCA;
- hd->hpib_acr = AUX_CSRE;
- hd->hpib_acr = AUX_SSIC;
- DELAY(100);
- hd->hpib_acr = AUX_CSIC;
- hd->hpib_acr = AUX_SSRE;
-}
-
-int
-nhpibsend(hs, slave, sec, ptr, origcnt)
- struct hpibbus_softc *hs;
- int slave, sec, origcnt;
- void *ptr;
-{
- struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
- struct nhpibdevice *hd = sc->sc_regs;
- int cnt = origcnt;
- char *addr = ptr;
-
- hd->hpib_acr = AUX_TCA;
- hd->hpib_data = C_UNL_P;
- if (nhpibwait(hd, MIS_BO))
- goto senderror;
- hd->hpib_data = talker_par[hs->sc_ba];
- hd->hpib_acr = AUX_STON;
- if (nhpibwait(hd, MIS_BO))
- goto senderror;
- hd->hpib_data = listnr_par[slave];
- if (nhpibwait(hd, MIS_BO))
- goto senderror;
- if (sec >= 0 || sec == -2) {
- if (sec == -2) /* selected device clear KLUDGE */
- hd->hpib_data = C_SDC_P;
- else
- hd->hpib_data = sec_par[sec];
- if (nhpibwait(hd, MIS_BO))
- goto senderror;
- }
- hd->hpib_acr = AUX_GTS;
- if (cnt) {
- while (--cnt > 0) {
- hd->hpib_data = *addr++;
- if (nhpibwait(hd, MIS_BO))
- goto senderror;
- }
- hd->hpib_acr = AUX_EOI;
- hd->hpib_data = *addr;
- if (nhpibwait(hd, MIS_BO))
- goto senderror;
- hd->hpib_acr = AUX_TCA;
-#if 0
- /*
- * May be causing 345 disks to hang due to interference
- * with PPOLL mechanism.
- */
- hd->hpib_data = C_UNL_P;
- (void) nhpibwait(hd, MIS_BO);
-#endif
- }
- return(origcnt);
-
-senderror:
- nhpibifc(hd);
- return(origcnt - cnt - 1);
-}
-
-int
-nhpibrecv(hs, slave, sec, ptr, origcnt)
- struct hpibbus_softc *hs;
- int slave, sec, origcnt;
- void *ptr;
-{
- struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
- struct nhpibdevice *hd = sc->sc_regs;
- int cnt = origcnt;
- char *addr = ptr;
-
- /*
- * Slave < 0 implies continuation of a previous receive
- * that probably timed out.
- */
- if (slave >= 0) {
- hd->hpib_acr = AUX_TCA;
- hd->hpib_data = C_UNL_P;
- if (nhpibwait(hd, MIS_BO))
- goto recverror;
- hd->hpib_data = listnr_par[hs->sc_ba];
- hd->hpib_acr = AUX_SLON;
- if (nhpibwait(hd, MIS_BO))
- goto recverror;
- hd->hpib_data = talker_par[slave];
- if (nhpibwait(hd, MIS_BO))
- goto recverror;
- if (sec >= 0) {
- hd->hpib_data = sec_par[sec];
- if (nhpibwait(hd, MIS_BO))
- goto recverror;
- }
- hd->hpib_acr = AUX_RHDF;
- hd->hpib_acr = AUX_GTS;
- }
- if (cnt) {
- while (--cnt >= 0) {
- if (nhpibwait(hd, MIS_BI))
- goto recvbyteserror;
- *addr++ = hd->hpib_data;
- }
- hd->hpib_acr = AUX_TCA;
- hd->hpib_data = (slave == 31) ? C_UNA_P : C_UNT_P;
- (void) nhpibwait(hd, MIS_BO);
- }
- return(origcnt);
-
-recverror:
- nhpibifc(hd);
-recvbyteserror:
- return(origcnt - cnt - 1);
-}
-
-void
-nhpibgo(hs, slave, sec, ptr, count, rw, timo)
- struct hpibbus_softc *hs;
- int slave, sec, count, rw, timo;
- void *ptr;
-{
- struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
- struct nhpibdevice *hd = sc->sc_regs;
- char *addr = ptr;
-
- hs->sc_flags |= HPIBF_IO;
- if (timo)
- hs->sc_flags |= HPIBF_TIMO;
- if (rw == B_READ)
- hs->sc_flags |= HPIBF_READ;
-#ifdef DEBUG
- else if (hs->sc_flags & HPIBF_READ) {
- printf("nhpibgo: HPIBF_READ still set\n");
- hs->sc_flags &= ~HPIBF_READ;
- }
-#endif
- hs->sc_count = count;
- hs->sc_addr = addr;
- if (hs->sc_flags & HPIBF_READ) {
- hs->sc_curcnt = count;
- dmago(hs->sc_dq->dq_chan, addr, count, DMAGO_BYTE|DMAGO_READ);
- nhpibrecv(hs, slave, sec, 0, 0);
- hd->hpib_mim = MIS_END;
- } else {
- hd->hpib_mim = 0;
- if (count < hpibdmathresh) {
- hs->sc_curcnt = count;
- nhpibsend(hs, slave, sec, addr, count);
- nhpibdone(hs);
- return;
- }
- hs->sc_curcnt = --count;
- dmago(hs->sc_dq->dq_chan, addr, count, DMAGO_BYTE);
- nhpibsend(hs, slave, sec, 0, 0);
- }
- hd->hpib_ie = IDS_IE | IDS_DMA(hs->sc_dq->dq_chan);
-}
-
-/*
- * This timeout can only happen if a DMA read finishes DMAing with the read
- * still pending (more data in read transaction than the driver was prepared
- * to accept). At the moment, variable-record tape drives are the only things
- * capabale of doing this. We repeat the necessary code from nhpibintr() -
- * easier and quicker than calling nhpibintr() for this special case.
- */
-void
-nhpibreadtimo(arg)
- void *arg;
-{
- struct nhpib_softc *sc = arg;
- struct hpibbus_softc *hs = sc->sc_hpibbus;
- int s;
-
- s = splbio();
- if (hs->sc_flags & HPIBF_IO) {
- struct nhpibdevice *hd = sc->sc_regs;
- struct hpibqueue *hq;
-
- hd->hpib_mim = 0;
- hd->hpib_acr = AUX_TCA;
- hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
- dmafree(hs->sc_dq);
-
- hq = TAILQ_FIRST(&hs->sc_queue);
- (hq->hq_intr)(hq->hq_softc);
- }
- splx(s);
-}
-
-void
-nhpibdone(hs)
- struct hpibbus_softc *hs;
-{
- struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
- struct nhpibdevice *hd = sc->sc_regs;
- int cnt;
-
- cnt = hs->sc_curcnt;
- hs->sc_addr += cnt;
- hs->sc_count -= cnt;
- hs->sc_flags |= HPIBF_DONE;
- hd->hpib_ie = IDS_IE;
- if (hs->sc_flags & HPIBF_READ) {
- if ((hs->sc_flags & HPIBF_TIMO) &&
- (hd->hpib_ids & IDS_IR) == 0)
- timeout_add_msec(&sc->sc_read_to, 1000 >> 2);
- } else {
- if (hs->sc_count == 1) {
- (void) nhpibwait(hd, MIS_BO);
- hd->hpib_acr = AUX_EOI;
- hd->hpib_data = *hs->sc_addr;
- hd->hpib_mim = MIS_BO;
- }
-#ifdef DEBUG
- else if (hs->sc_count)
- panic("nhpibdone");
-#endif
- }
-}
-
-int
-nhpibintr(arg)
- void *arg;
-{
- struct nhpib_softc *sc = arg;
- struct hpibbus_softc *hs = sc->sc_hpibbus;
- struct nhpibdevice *hd = sc->sc_regs;
- struct hpibqueue *hq;
- int stat0;
- int stat1;
-
- if ((hd->hpib_ids & IDS_IR) == 0)
- return(0);
- stat0 = hd->hpib_mis;
- stat1 = hd->hpib_lis;
-
- hq = TAILQ_FIRST(&hs->sc_queue);
-
- if (hs->sc_flags & HPIBF_IO) {
- hd->hpib_mim = 0;
- if ((hs->sc_flags & HPIBF_DONE) == 0) {
- hs->sc_flags &= ~HPIBF_TIMO;
- dmastop(hs->sc_dq->dq_chan);
- } else if (hs->sc_flags & HPIBF_TIMO)
- timeout_del(&sc->sc_read_to);
- hd->hpib_acr = AUX_TCA;
- hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
-
- dmafree(hs->sc_dq);
- (hq->hq_intr)(hq->hq_softc);
- } else if (hs->sc_flags & HPIBF_PPOLL) {
- hd->hpib_mim = 0;
- stat0 = nhpibppoll(hs);
- if (stat0 & (0x80 >> hq->hq_slave)) {
- hs->sc_flags &= ~HPIBF_PPOLL;
- (hq->hq_intr)(hq->hq_softc);
- }
-#ifdef DEBUG
- else
- printf("%s: PPOLL intr bad status %x\n",
- hs->sc_dev.dv_xname, stat0);
-#endif
- }
- return(1);
-}
-
-int
-nhpibppoll(hs)
- struct hpibbus_softc *hs;
-{
- struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
- struct nhpibdevice *hd = sc->sc_regs;
- int ppoll;
-
- hd->hpib_acr = AUX_SPP;
- DELAY(25);
- ppoll = hd->hpib_cpt;
- hd->hpib_acr = AUX_CPP;
- return(ppoll);
-}
-
-#ifdef DEBUG
-int nhpibreporttimo = 0;
-#endif
-
-int
-nhpibwait(hd, x)
- struct nhpibdevice *hd;
- int x;
-{
- int timo = hpibtimeout;
-
- while ((hd->hpib_mis & x) == 0 && --timo)
- DELAY(1);
- if (timo == 0) {
-#ifdef DEBUG
- if (nhpibreporttimo)
- printf("hpib0: %s timo\n", x==MIS_BO?"OUT":"IN");
-#endif
- return(-1);
- }
- return(0);
-}
-
-void
-nhpibppwatch(arg)
- void *arg;
-{
- struct hpibbus_softc *hs = arg;
- struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
-
- if ((hs->sc_flags & HPIBF_PPOLL) == 0)
- return;
-
-again:
- if (nhpibppoll(hs) & (0x80 >> TAILQ_FIRST(&hs->sc_queue)->hq_slave))
- sc->sc_regs->hpib_mim = MIS_BO;
- else if (cold)
- /* timeouts not working yet */
- goto again;
- else {
- timeout_set(&sc->sc_watch_to, nhpibppwatch, hs);
- timeout_add(&sc->sc_watch_to, 1);
- }
-}
diff --git a/sys/arch/hp300/dev/nhpibreg.h b/sys/arch/hp300/dev/nhpibreg.h
deleted file mode 100644
index 5a580cdea4c..00000000000
--- a/sys/arch/hp300/dev/nhpibreg.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* $OpenBSD: nhpibreg.h,v 1.3 2003/06/02 23:27:45 millert Exp $ */
-/* $NetBSD: nhpibreg.h,v 1.5 1995/01/07 10:30:15 mycroft Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)nhpibreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-struct nhpibdevice {
- u_char hpib_pad0;
- vu_char hpib_cid;
- u_char hpib_pad1;
-#define hpib_ie hpib_ids
- vu_char hpib_ids;
- u_char hpib_pad2;
- vu_char hpib_csa;
- u_char hpib_pad3[11];
-#define hpib_mim hpib_mis
- vu_char hpib_mis;
- u_char hpib_pad4;
-#define hpib_lim hpib_lis
- vu_char hpib_lis;
- u_char hpib_pad5;
- vu_char hpib_is;
- u_char hpib_pad6;
-#define hpib_acr hpib_cls
- vu_char hpib_cls;
- u_char hpib_pad7;
- vu_char hpib_ar;
- u_char hpib_pad8;
- vu_char hpib_sprb;
- u_char hpib_pad9;
-#define hpib_ppr hpib_cpt
- vu_char hpib_cpt;
- u_char hpib_pad10;
- vu_char hpib_data;
-};
-
-/*
- * Bits in hpib_lis (and hpib_lim).
- */
-#define LIS_IFC 0x01
-#define LIS_SRQ 0x02
-#define LIS_MA 0x04
-#define LIS_DCAS 0x08
-#define LIS_APT 0x10
-#define LIS_UCG 0x20
-#define LIS_ERR 0x40
-#define LIS_GET 0x80
-
-#define MIS_END 0x08
-#define MIS_BO 0x10
-#define MIS_BI 0x20
-
-#define IS_TADS 0x02
-#define IS_LADS 0x04
-
-/*
- * ti9914 "Auxiliary Commands" - Some are Set/Clear, others pulse.
- */
-#define AUX_CSWRST 0x00 /* End software reset */
-#define AUX_RHDF 0x02 /* release RFD (ready for data) holdoff */
-#define AUX_CHDFA 0x03 /* Clear holdoff on all data */
-#define AUX_CHDFE 0x04 /* Clear holdoff on EOI data only */
-#define AUX_EOI 0x08 /* Pulse EOI (with data) */
-#define AUX_CLON 0x09 /* Clear listen only */
-#define AUX_CTON 0x0a /* Clear talk only */
-#define AUX_GTS 0x0b /* Go to standby (clears ATN line) */
-#define AUX_TCA 0x0c /* Take control (async) */
-#define AUX_TCS 0x0d /* Take control (sync) */
-#define AUX_CPP 0x0e /* Clear parallel poll */
-#define AUX_CSIC 0x0f /* Clear IFC (interface clear) line */
-#define AUX_CSRE 0x10 /* Clear REN (remote enable) line */
-#define AUX_CDAI 0x13 /* Clear interrupt disable */
-#define AUX_CSTD1 0x15 /* Clear 1200ns T1 delay */
-#define AUX_CSHDW 0x16 /* Clear shadow handshake */
-#define AUX_CVSTD1 0x17 /* Clear 600ns T1 delay */
-
-#define AUX_SSWRST 0x80 /* Start software reset */
-#define AUX_SHDFA 0x83 /* Set holdoff on all data */
-#define AUX_SHDFE 0x84 /* Set holdoff on EOI data only */
-#define AUX_SLON 0x89 /* Set listen only */
-#define AUX_STON 0x8a /* Set talk only */
-#define AUX_SPP 0x8e /* Set parallel poll */
-#define AUX_SSIC 0x8f /* Set IFC line */
-#define AUX_SSRE 0x90 /* Set REN line */
-#define AUX_SDAI 0x93 /* Disable all interrupts */
-#define AUX_SSTD1 0x95 /* Set T1 delay to 1200ns */
-#define AUX_SSHDW 0x96 /* Set shadow handshake */
-#define AUX_SVSTD1 0x97 /* Set T1 delay to 600ns */
diff --git a/sys/arch/hp300/dev/ppi.c b/sys/arch/hp300/dev/ppi.c
deleted file mode 100644
index eed6fcc8117..00000000000
--- a/sys/arch/hp300/dev/ppi.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/* $OpenBSD: ppi.c,v 1.17 2009/07/30 20:32:44 blambert Exp $ */
-/* $NetBSD: ppi.c,v 1.13 1997/04/02 22:37:33 scottr Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ppi.c 8.1 (Berkeley) 6/16/93
- */
-
-/*
- * Printer/Plotter HPIB interface
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/errno.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-#include <sys/timeout.h>
-#include <sys/uio.h>
-
-#include <hp300/dev/hpibvar.h>
-
-#include <hp300/dev/ppiioctl.h>
-
-struct ppi_softc {
- struct device sc_dev;
- int sc_flags;
- struct hpibqueue sc_hq; /* HP-IB job queue entry */
- struct ppiparam sc_param;
-#define sc_burst sc_param.burst
-#define sc_timo sc_param.timo
-#define sc_delay sc_param.delay
- int sc_sec;
- int sc_slave; /* HP-IB slave address */
- struct timeout sc_to; /* ppitimo timeout */
- struct timeout sc_start_to; /* ppistart timeout */
-};
-
-/* sc_flags values */
-#define PPIF_ALIVE 0x01
-#define PPIF_OPEN 0x02
-#define PPIF_UIO 0x04
-#define PPIF_TIMO 0x08
-#define PPIF_DELAY 0x10
-
-int ppimatch(struct device *, void *, void *);
-void ppiattach(struct device *, struct device *, void *);
-
-struct cfattach ppi_ca = {
- sizeof(struct ppi_softc), ppimatch, ppiattach
-};
-
-struct cfdriver ppi_cd = {
- NULL, "ppi", DV_DULL
-};
-
-void ppistart(void *);
-void ppinoop(void *);
-
-void ppitimo(void *);
-int ppirw(dev_t, struct uio *);
-
-cdev_decl(ppi);
-
-#define UNIT(x) minor(x)
-
-#ifdef DEBUG
-int ppidebug = 0x80;
-#define PDB_FOLLOW 0x01
-#define PDB_IO 0x02
-#define PDB_NOCHECK 0x80
-#endif
-
-int
-ppimatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct cfdata *cf = match;
- struct hpibbus_attach_args *ha = aux;
-
- /*
- * The printer/plotter doesn't return an ID tag.
- * The check below prevents us from matching a CS80
- * device by mistake.
- */
- if (ha->ha_id & 0x200)
- return (0);
-
- /*
- * To prevent matching all unused slots on the bus, we
- * don't allow wildcarded locators.
- */
- if (cf->hpibbuscf_slave == HPIBBUS_SLAVE_UNK ||
- cf->hpibbuscf_punit == HPIBBUS_PUNIT_UNK)
- return (0);
-
- return (1);
-}
-
-void
-ppiattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct ppi_softc *sc = (struct ppi_softc *)self;
- struct hpibbus_attach_args *ha = aux;
-
- printf("\n");
-
- sc->sc_slave = ha->ha_slave;
-
- /* Initialize the hpib queue entry. */
- sc->sc_hq.hq_softc = sc;
- sc->sc_hq.hq_slave = sc->sc_slave;
- sc->sc_hq.hq_start = ppistart;
- sc->sc_hq.hq_go = ppinoop;
- sc->sc_hq.hq_intr = ppinoop;
-
- sc->sc_flags = PPIF_ALIVE;
-
- /* Initialize timeout structures */
- timeout_set(&sc->sc_to, ppitimo, sc);
- timeout_set(&sc->sc_start_to, ppistart, sc);
-}
-
-void
-ppinoop(arg)
- void *arg;
-{
- /* Noop! */
-}
-
-int
-ppiopen(dev, flags, fmt, p)
- dev_t dev;
- int flags, fmt;
- struct proc *p;
-{
- int unit = UNIT(dev);
- struct ppi_softc *sc;
-
- if (unit >= ppi_cd.cd_ndevs ||
- (sc = ppi_cd.cd_devs[unit]) == NULL ||
- (sc->sc_flags & PPIF_ALIVE) == 0)
- return (ENXIO);
-
-#ifdef DEBUG
- if (ppidebug & PDB_FOLLOW)
- printf("ppiopen(%x, %x): flags %x\n",
- dev, flags, sc->sc_flags);
-#endif
- if (sc->sc_flags & PPIF_OPEN)
- return (EBUSY);
- sc->sc_flags |= PPIF_OPEN;
- sc->sc_burst = PPI_BURST;
- sc->sc_timo = PPI_TIMO;
- sc->sc_delay = PPI_DELAY;
- sc->sc_sec = -1;
- return(0);
-}
-
-int
-ppiclose(dev, flags, fmt, p)
- dev_t dev;
- int flags, fmt;
- struct proc *p;
-{
- int unit = UNIT(dev);
- struct ppi_softc *sc = ppi_cd.cd_devs[unit];
-
-#ifdef DEBUG
- if (ppidebug & PDB_FOLLOW)
- printf("ppiclose(%x, %x): flags %x\n",
- dev, flags, sc->sc_flags);
-#endif
- sc->sc_flags &= ~PPIF_OPEN;
- return(0);
-}
-
-void
-ppistart(arg)
- void *arg;
-{
- struct ppi_softc *sc = arg;
-
-#ifdef DEBUG
- if (ppidebug & PDB_FOLLOW)
- printf("ppistart(%x)\n", sc->sc_dev.dv_unit);
-#endif
- sc->sc_flags &= ~PPIF_DELAY;
- wakeup(sc);
-}
-
-void
-ppitimo(arg)
- void *arg;
-{
- struct ppi_softc *sc = arg;
-
-#ifdef DEBUG
- if (ppidebug & PDB_FOLLOW)
- printf("ppitimo(%x)\n", sc->sc_dev.dv_unit);
-#endif
- sc->sc_flags &= ~(PPIF_UIO|PPIF_TIMO);
- wakeup(sc);
-}
-
-int
-ppiread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
-
-#ifdef DEBUG
- if (ppidebug & PDB_FOLLOW)
- printf("ppiread(%x, %p)\n", dev, uio);
-#endif
- return (ppirw(dev, uio));
-}
-
-int
-ppiwrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
-
-#ifdef DEBUG
- if (ppidebug & PDB_FOLLOW)
- printf("ppiwrite(%x, %p)\n", dev, uio);
-#endif
- return (ppirw(dev, uio));
-}
-
-int
-ppirw(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
- int unit = UNIT(dev);
- struct ppi_softc *sc = ppi_cd.cd_devs[unit];
- int s, len, cnt;
- char *cp;
- int error = 0, gotdata = 0;
- int buflen, ctlr, slave;
- char *buf;
-
- if (uio->uio_resid == 0)
- return(0);
-
- ctlr = sc->sc_dev.dv_parent->dv_unit;
- slave = sc->sc_slave;
-
-#ifdef DEBUG
- if (ppidebug & (PDB_FOLLOW|PDB_IO))
- printf("ppirw(%x, %p, %c): burst %d, timo %d, resid %x\n",
- dev, uio, uio->uio_rw == UIO_READ ? 'R' : 'W',
- sc->sc_burst, sc->sc_timo, uio->uio_resid);
-#endif
- buflen = min(sc->sc_burst, uio->uio_resid);
- buf = (char *)malloc(buflen, M_DEVBUF, M_WAITOK);
- sc->sc_flags |= PPIF_UIO;
- if (sc->sc_timo > 0) {
- sc->sc_flags |= PPIF_TIMO;
- timeout_add_msec(&sc->sc_to, sc->sc_timo);
- }
- len = cnt = 0;
- while (uio->uio_resid > 0) {
- len = min(buflen, uio->uio_resid);
- cp = buf;
- if (uio->uio_rw == UIO_WRITE) {
- error = uiomove(cp, len, uio);
- if (error)
- break;
- }
-again:
- s = splbio();
- if ((sc->sc_flags & PPIF_UIO) &&
- hpibreq(sc->sc_dev.dv_parent, &sc->sc_hq) == 0)
- tsleep(sc, PRIBIO+1, "ppirw", 0);
- /*
- * Check if we timed out during sleep or uiomove
- */
- if ((sc->sc_flags & PPIF_UIO) == 0) {
-#ifdef DEBUG
- if (ppidebug & PDB_IO)
- printf("ppirw: uiomove/sleep timo, flags %x\n",
- sc->sc_flags);
-#endif
- if (sc->sc_flags & PPIF_TIMO) {
- timeout_del(&sc->sc_to);
- sc->sc_flags &= ~PPIF_TIMO;
- }
- splx(s);
- break;
- }
- /*
- * Perform the operation
- */
- if (uio->uio_rw == UIO_WRITE)
- cnt = hpibsend(ctlr, slave, sc->sc_sec, cp, len);
- else
- cnt = hpibrecv(ctlr, slave, sc->sc_sec, cp, len);
- hpibfree(sc->sc_dev.dv_parent, &sc->sc_hq);
-#ifdef DEBUG
- if (ppidebug & PDB_IO)
- printf("ppirw: %s(%d, %d, %x, %p, %d) -> %d\n",
- uio->uio_rw == UIO_READ ? "recv" : "send",
- ctlr, slave, sc->sc_sec, cp, len, cnt);
-#endif
- if (uio->uio_rw == UIO_READ) {
- if (cnt) {
- error = uiomove(cp, cnt, uio);
- if (error) {
- splx(s);
- break;
- }
- gotdata++;
- }
- /*
- * Didn't get anything this time, but did in the past.
- * Consider us done.
- */
- else if (gotdata) {
- splx(s);
- break;
- }
- }
- /*
- * Operation timeout (or non-blocking), quit now.
- */
- if ((sc->sc_flags & PPIF_UIO) == 0) {
-#ifdef DEBUG
- if (ppidebug & PDB_IO)
- printf("ppirw: timeout/done\n");
-#endif
- splx(s);
- break;
- }
- /*
- * Implement inter-read delay
- */
- if (sc->sc_delay > 0) {
- sc->sc_flags |= PPIF_DELAY;
- timeout_add_msec(&sc->sc_start_to, sc->sc_delay);
- error = tsleep(sc, (PCATCH|PZERO) + 1, "hpib", 0);
- if (error) {
- splx(s);
- break;
- }
- }
- /*
- * Must not call uiomove again til we've used all data
- * that we already grabbed.
- */
- if (uio->uio_rw == UIO_WRITE && cnt != len) {
- cp += cnt;
- len -= cnt;
- cnt = 0;
- splx(s);
- goto again;
- }
- splx(s);
- }
- if (sc->sc_flags & PPIF_TIMO) {
- timeout_del(&sc->sc_to);
- sc->sc_flags &= ~PPIF_TIMO;
- }
- if (sc->sc_flags & PPIF_DELAY) {
- timeout_del(&sc->sc_start_to);
- sc->sc_flags &= ~PPIF_DELAY;
- }
- /*
- * Adjust for those chars that we uiomove'ed but never wrote
- */
- if (uio->uio_rw == UIO_WRITE && cnt != len) {
- uio->uio_resid += (len - cnt);
-#ifdef DEBUG
- if (ppidebug & PDB_IO)
- printf("ppirw: short write, adjust by %d\n",
- len-cnt);
-#endif
- }
- free(buf, M_DEVBUF);
-#ifdef DEBUG
- if (ppidebug & (PDB_FOLLOW|PDB_IO))
- printf("ppirw: return %d, resid %d\n", error, uio->uio_resid);
-#endif
- return (error);
-}
-
-int
-ppiioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct ppi_softc *sc = ppi_cd.cd_devs[UNIT(dev)];
- struct ppiparam *pp, *upp;
- int tmp;
- int error = 0;
-
- switch (cmd) {
- case PPIIOCGPARAM:
- pp = &sc->sc_param;
- upp = (struct ppiparam *)data;
- upp->burst = pp->burst;
- upp->timo = pp->timo;
- upp->delay = pp->delay;
- break;
- case PPIIOCSPARAM:
- pp = &sc->sc_param;
- upp = (struct ppiparam *)data;
- if (upp->burst < PPI_BURST_MIN || upp->burst > PPI_BURST_MAX ||
- upp->delay < PPI_DELAY_MIN || upp->delay > PPI_DELAY_MAX)
- return(EINVAL);
- pp->burst = upp->burst;
- pp->timo = upp->timo;
- pp->delay = upp->delay;
- break;
- case PPIIOCSSEC:
- tmp = *(int *)data;
- if (tmp == -1 || (tmp >= 0 && tmp <= 0x1f))
- sc->sc_sec = tmp;
- else
- error = EINVAL;
- break;
- default:
- return (ENOTTY);
- }
- return (error);
-}
diff --git a/sys/arch/hp300/dev/ppiioctl.h b/sys/arch/hp300/dev/ppiioctl.h
deleted file mode 100644
index 4a0acc8fea9..00000000000
--- a/sys/arch/hp300/dev/ppiioctl.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $OpenBSD: ppiioctl.h,v 1.3 2003/06/02 23:27:45 millert Exp $ */
-/* $NetBSD: ppiioctl.h,v 1.4 1994/10/26 07:24:48 cgd 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.
- *
- * @(#)ppiioctl.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _IOCTL_
-#include <sys/ioctl.h>
-#endif
-
-struct ppiparam {
- int burst; /* chars to send/recv in one call */
- int timo; /* timeout: -1 blocking, 0 non-blocking, >0 msec */
- int delay; /* delay between polls (msec) */
-};
-
-#define PPI_BLOCK -1
-#define PPI_NOBLOCK 0
-
-/* default values */
-#define PPI_BURST 1024
-#define PPI_TIMO PPI_BLOCK
-#define PPI_DELAY 10
-
-/* limits */
-#define PPI_BURST_MIN 1
-#define PPI_BURST_MAX 1024
-#define PPI_DELAY_MIN 0
-#define PPI_DELAY_MAX 30000
-
-#define PPIIOCSPARAM _IOW('P', 0x1, struct ppiparam)
-#define PPIIOCGPARAM _IOR('P', 0x2, struct ppiparam)
-#define PPIIOCSSEC _IOW('P', 0x3, int)
diff --git a/sys/arch/hp300/dev/rbox.c b/sys/arch/hp300/dev/rbox.c
deleted file mode 100644
index 610248573f7..00000000000
--- a/sys/arch/hp300/dev/rbox.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/* $OpenBSD: rbox.c,v 1.16 2013/10/21 10:36:13 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_rb.c 1.15 93/08/13$
- *
- * @(#)grf_rb.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for the Renaissance, HP98720 Graphics system.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/intiovar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-#include <hp300/dev/rboxreg.h>
-
-struct rbox_softc {
- struct device sc_dev;
- struct diofb *sc_fb;
- struct diofb sc_fb_store;
- int sc_scode;
-};
-
-int rbox_dio_match(struct device *, void *, void *);
-void rbox_dio_attach(struct device *, struct device *, void *);
-int rbox_intio_match(struct device *, void *, void *);
-void rbox_intio_attach(struct device *, struct device *, void *);
-
-struct cfattach rbox_dio_ca = {
- sizeof(struct rbox_softc), rbox_dio_match, rbox_dio_attach
-};
-
-struct cfattach rbox_intio_ca = {
- sizeof(struct rbox_softc), rbox_intio_match, rbox_intio_attach
-};
-
-struct cfdriver rbox_cd = {
- NULL, "rbox", DV_DULL
-};
-
-int rbox_reset(struct diofb *, int, struct diofbreg *);
-void rbox_restore(struct diofb *);
-void rbox_setcolor(struct diofb *, u_int,
- u_int8_t, u_int8_t, u_int8_t);
-int rbox_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
-
-int rbox_ioctl(void *, u_long, caddr_t, int, struct proc *);
-void rbox_burner(void *, u_int, u_int);
-
-struct wsdisplay_accessops rbox_accessops = {
- .ioctl = rbox_ioctl,
- .mmap = diofb_mmap,
- .alloc_screen = diofb_alloc_screen,
- .free_screen = diofb_free_screen,
- .show_screen = diofb_show_screen,
- .load_font = diofb_load_font,
- .list_font = diofb_list_font,
- .burn_screen = rbox_burner
-};
-
-/*
- * Attachment glue
- */
-
-int
-rbox_intio_match(struct device *parent, void *match, void *aux)
-{
- struct intio_attach_args *ia = aux;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
-
- if (badaddr((caddr_t)fbr))
- return (0);
-
- if (fbr->id == GRFHWID && fbr->fbid == GID_RENAISSANCE) {
- ia->ia_addr = (caddr_t)GRFIADDR;
- return (1);
- }
-
- return (0);
-}
-
-void
-rbox_intio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct rbox_softc *sc = (struct rbox_softc *)self;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
- sc->sc_scode = CONSCODE_INTERNAL;
-
- if (sc->sc_scode == conscode) {
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- rbox_reset(sc->sc_fb, sc->sc_scode, fbr);
- }
-
- diofb_end_attach(sc, &rbox_accessops, sc->sc_fb,
- sc->sc_scode == conscode, NULL);
-}
-
-int
-rbox_dio_match(struct device *parent, void *match, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
- da->da_secid == DIO_DEVICE_SECID_RENAISSANCE)
- return (1);
-
- return (0);
-}
-
-void
-rbox_dio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct rbox_softc *sc = (struct rbox_softc *)self;
- struct dio_attach_args *da = aux;
- struct diofbreg *fbr;
-
- sc->sc_scode = da->da_scode;
- if (sc->sc_scode == conscode) {
- fbr = (struct diofbreg *)conaddr; /* already mapped */
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- fbr = (struct diofbreg *)
- iomap(dio_scodetopa(sc->sc_scode), da->da_size);
- if (fbr == NULL ||
- rbox_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) {
- printf(": can't map framebuffer\n");
- return;
- }
- }
-
- diofb_end_attach(sc, &rbox_accessops, sc->sc_fb,
- sc->sc_scode == conscode, NULL);
-}
-
-/*
- * Initialize hardware and display routines.
- */
-int
-rbox_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
-{
- int rc;
-
- if ((rc = diofb_fbinquire(fb, scode, fbr)) != 0)
- return (rc);
-
- /*
- * Restrict the framebuffer to a monochrome view for now, until
- * I know better how to detect and frob overlay planes, and
- * setup a proper colormap. -- miod
- */
- fb->planes = fb->planemask = 1;
-
- fb->bmv = rbox_windowmove;
- rbox_restore(fb);
- diofb_fbsetup(fb);
-
- return (0);
-}
-
-void
-rbox_restore(struct diofb *fb)
-{
- volatile struct rboxfb *rb = (struct rboxfb *)fb->regkva;
- u_int i;
-
- rb_waitbusy(rb);
-
- rb->regs.id = GRFHWID; /* trigger reset */
- DELAY(1000);
-
- rb->regs.interrupt = 0x04;
- rb->video_enable = 0x01;
- rb->drive = 0x01;
- rb->vdrive = 0x0;
-
- rb->opwen = 0xFF;
-
- /*
- * Clear color map
- */
- rb_waitbusy(fb->regkva);
- for (i = 0; i < 16; i++) {
- *(fb->regkva + 0x63c3 + i*4) = 0x0;
- *(fb->regkva + 0x6403 + i*4) = 0x0;
- *(fb->regkva + 0x6803 + i*4) = 0x0;
- *(fb->regkva + 0x6c03 + i*4) = 0x0;
- *(fb->regkva + 0x73c3 + i*4) = 0x0;
- *(fb->regkva + 0x7403 + i*4) = 0x0;
- *(fb->regkva + 0x7803 + i*4) = 0x0;
- *(fb->regkva + 0x7c03 + i*4) = 0x0;
- }
-
- rb->rep_rule = RBOX_DUALROP(RR_COPY);
-
- /*
- * I cannot figure out how to make the blink planes stop. So, we
- * must set both colormaps so that when the planes blink, and
- * the secondary colormap is active, we still get text.
- */
- CM1RED(fb)[0x00].value = 0x00;
- CM1GRN(fb)[0x00].value = 0x00;
- CM1BLU(fb)[0x00].value = 0x00;
- CM1RED(fb)[0x01].value = 0xFF;
- CM1GRN(fb)[0x01].value = 0xFF;
- CM1BLU(fb)[0x01].value = 0xFF;
-
- CM2RED(fb)[0x00].value = 0x00;
- CM2GRN(fb)[0x00].value = 0x00;
- CM2BLU(fb)[0x00].value = 0x00;
- CM2RED(fb)[0x01].value = 0xFF;
- CM2GRN(fb)[0x01].value = 0xFF;
- CM2BLU(fb)[0x01].value = 0xFF;
-
- rb->blink = 0x00;
- rb->write_enable = 0x01;
- rb->opwen = 0x00;
-
- /* enable display */
- rb->display_enable = 0x01;
-}
-
-int
-rbox_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
-{
- struct diofb *fb = v;
- struct wsdisplay_fbinfo *wdf;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_RBOX;
- break;
- case WSDISPLAYIO_SMODE:
- fb->mapmode = *(u_int *)data;
- if (fb->mapmode == WSDISPLAYIO_MODE_EMUL)
- rbox_restore(fb);
- break;
- case WSDISPLAYIO_GINFO:
- wdf = (void *)data;
- wdf->width = fb->ri.ri_width;
- wdf->height = fb->ri.ri_height;
- wdf->depth = fb->ri.ri_depth;
- wdf->cmsize = 0; /* XXX */
- break;
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = fb->ri.ri_stride;
- break;
- case WSDISPLAYIO_GETCMAP:
- case WSDISPLAYIO_PUTCMAP:
- break; /* XXX until color support is implemented */
- break;
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- break;
- default:
- return (-1);
- }
-
- return (0);
-}
-
-void
-rbox_burner(void *v, u_int on, u_int flags)
-{
- struct diofb *fb = v;
- volatile struct rboxfb *rb = (struct rboxfb *)fb->regkva;
-
- if (on) {
- rb->display_enable = 0x01;
- } else {
- rb->display_enable = 0x00;
- }
-}
-
-int
-rbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
- u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop,
- int16_t planemask)
-{
- volatile struct rboxfb *rb = (struct rboxfb *)fb->regkva;
-
- if (planemask != 0xff)
- return (EINVAL);
-
- rb_waitbusy(rb);
-
- rb->rep_rule = RBOX_DUALROP(rop);
- rb->source_y = sy;
- rb->source_x = sx;
- rb->dest_y = dy;
- rb->dest_x = dx;
- rb->wheight = cy;
- rb->wwidth = cx;
- rb->wmove = 1;
-
- rb_waitbusy(rb);
-
- return (0);
-}
-
-/*
- * Renaissance console support
- */
-
-void
-rboxcninit()
-{
- rbox_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
- diofb_cnattach(&diofb_cn);
-}
diff --git a/sys/arch/hp300/dev/rboxreg.h b/sys/arch/hp300/dev/rboxreg.h
deleted file mode 100644
index 2e5fd3a7974..00000000000
--- a/sys/arch/hp300/dev/rboxreg.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* $OpenBSD: rboxreg.h,v 1.3 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: grf_rbreg.h,v 1.4 1994/10/26 07:24:03 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_rbreg.h 1.9 92/01/21$
- *
- * @(#)grf_rbreg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Map of the Renaissance frame buffer controller chip in memory ...
- */
-
-#define rb_waitbusy(regaddr) \
-do { \
- while (((volatile struct rboxfb *)(regaddr))->wbusy & 0x01) \
- DELAY(10); \
-} while (0)
-
-#define RBOX_DUALROP(rop) ((rop) << 4 | (rop))
-
-#define CM1RED(fb) ((volatile struct rencm *)((fb)->regkva + 0x6400))
-#define CM1GRN(fb) ((volatile struct rencm *)((fb)->regkva + 0x6800))
-#define CM1BLU(fb) ((volatile struct rencm *)((fb)->regkva + 0x6C00))
-#define CM2RED(fb) ((volatile struct rencm *)((fb)->regkva + 0x7400))
-#define CM2GRN(fb) ((volatile struct rencm *)((fb)->regkva + 0x7800))
-#define CM2BLU(fb) ((volatile struct rencm *)((fb)->regkva + 0x7C00))
-
-struct rencm {
- u_int8_t :8, :8, :8;
- u_int8_t value;
-};
-
-struct rboxfb {
- struct diofbreg regs;
- u_int8_t filler2[16359];
- u_int8_t wbusy; /* window mover is active 0x4047 */
- u_int8_t filler3[0x405b - 0x4048];
- u_int8_t scanbusy; /* scan converteris active 0x405B */
- u_int8_t filler3b[0x4083 - 0x405c];
- u_int8_t video_enable; /* drive vid. refresh bus 0x4083 */
- u_int8_t filler4[3];
- u_int8_t display_enable; /* enable the display 0x4087 */
- u_int8_t filler5[8];
- u_int32_t write_enable; /* write enable register 0x4090 */
- u_int8_t filler6[11];
- u_int8_t wmove; /* start window mover 0x409f */
- u_int8_t filler7[3];
- u_int8_t blink; /* blink register 0x40a3 */
- u_int8_t filler8[15];
- u_int8_t fold; /* fold register 0x40b3 */
- u_int32_t opwen; /* overlay plane write enable 0x40b4 */
- u_int8_t filler9[3];
- u_int8_t tmode; /* Tile mode size 0x40bb */
- u_int8_t filler9a[3];
- u_int8_t drive; /* drive register 0x40bf */
- u_int8_t filler10[3];
- u_int8_t vdrive; /* vdrive register 0x40c3 */
- u_int8_t filler10a[0x40cb-0x40c4];
- u_int8_t zconfig; /* Z-buffer mode 0x40cb */
- u_int8_t filler11a[2];
- u_int16_t tpatt; /* Transparency pattern 0x40ce */
- u_int8_t filler11b[3];
- u_int8_t dmode; /* dither mode 0x40d3 */
- u_int8_t filler11c[3];
- u_int8_t en_scan; /* enable scan board to DTACK 0x40d7 */
- u_int8_t filler11d[0x40ef-0x40d8];
- u_int8_t rep_rule; /* replacement rule 0x40ef */
- u_int8_t filler12[2];
- u_int16_t source_x; /* source x 0x40f2 */
- u_int8_t filler13[2];
- u_int16_t source_y; /* source y 0x40f6 */
- u_int8_t filler14[2];
- u_int16_t dest_x; /* dest x 0x40fa */
- u_int8_t filler15[2];
- u_int16_t dest_y; /* dest y 0x40fe */
- u_int8_t filler16[2];
- u_int16_t wwidth; /* window width 0x4102 */
- u_int8_t filler17[2];
- u_int16_t wheight; /* window height 0x4106 */
- u_int8_t filler18[18];
- u_int16_t patt_x; /* pattern x 0x411a */
- u_int8_t filler19[2];
- u_int16_t patt_y; /* pattern y 0x411e */
- u_int8_t filler20[0x8012 - 0x4120];
- u_int16_t te_status; /* transform engine status 0x8012 */
- u_int8_t filler21[0x1ffff-0x8014];
-} __packed;
diff --git a/sys/arch/hp300/dev/sgc.c b/sys/arch/hp300/dev/sgc.c
deleted file mode 100644
index b0030934fc1..00000000000
--- a/sys/arch/hp300/dev/sgc.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* $OpenBSD: sgc.c,v 1.7 2011/08/18 19:54:18 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*
- * SGC bus attachment and mapping glue.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-
-#include <hp300/dev/sgcreg.h>
-#include <hp300/dev/sgcvar.h>
-
-int sgcmatch(struct device *, void *, void *);
-void sgcattach(struct device *, struct device *, void *);
-int sgcprint(void *, const char *);
-
-struct cfattach sgc_ca = {
- sizeof(struct device), sgcmatch, sgcattach
-};
-
-struct cfdriver sgc_cd = {
- NULL, "sgc", DV_DULL
-};
-
-int
-sgcmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
-static int sgc_matched = 0;
-
- /* Allow only one instance. */
- if (sgc_matched)
- return 0;
-
- /*
- * Leave out machines which can not have an SGC bus.
- */
-
- switch (machineid) {
- case HP_400:
- case HP_425:
- case HP_433:
- return sgc_matched = 1;
- default:
- return 0;
- }
-}
-
-void
-sgcattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct sgc_attach_args saa;
- caddr_t pa, va;
- int slot, rv;
- extern struct hp300_bus_space_tag hp300_mem_tag;
-
- printf("\n");
-
- for (slot = 0; slot < SGC_NSLOTS; slot++) {
- pa = sgc_slottopa(slot);
- va = iomap(pa, PAGE_SIZE);
- if (va == NULL) {
- printf("%s: can't map slot %d\n", self->dv_xname, slot);
- continue;
- }
-
- /* Check for hardware. */
- rv = badaddr(va);
- iounmap(va, PAGE_SIZE);
-
- if (rv != 0)
- continue;
-
- bzero(&saa, sizeof(saa));
- saa.saa_slot = slot;
- saa.saa_iot = &hp300_mem_tag;
-
- /* Attach matching device. */
- config_found(self, &saa, sgcprint);
- }
-}
-
-int
-sgcprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct sgc_attach_args *saa = aux;
-
- if (pnp)
- printf("unknown SGC card at %s", pnp);
- printf(" slot %d", saa->saa_slot);
- return (UNCONF);
-}
-
-/*
- * Convert a slot number to a system physical address.
- * This is needed for bus_space.
- */
-void *
-sgc_slottopa(int slot)
-{
- u_long rval;
-
- if (slot < 0 || slot >= SGC_NSLOTS)
- rval = 0;
- else
- rval = SGC_BASE + (slot * SGC_DEVSIZE);
-
- return ((void *)rval);
-}
diff --git a/sys/arch/hp300/dev/sgcreg.h b/sys/arch/hp300/dev/sgcreg.h
deleted file mode 100644
index 5a7e4c744ee..00000000000
--- a/sys/arch/hp300/dev/sgcreg.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $OpenBSD: sgcreg.h,v 1.1 2005/01/14 22:39:26 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Register definitions for the SGC bus.
- */
-
-/*
- * SGC ranges from slots 0-3 at physical addresses given by:
- * 0x20000000 + slot * 0x04000000
- */
-
-#define SGC_BASE 0x20000000
-#define SGC_END 0x30000000
-#define SGC_DEVSIZE 0x04000000
-
-#define SGC_NSLOTS 4
diff --git a/sys/arch/hp300/dev/sgcvar.h b/sys/arch/hp300/dev/sgcvar.h
deleted file mode 100644
index e61c1a99548..00000000000
--- a/sys/arch/hp300/dev/sgcvar.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $OpenBSD: sgcvar.h,v 1.2 2007/01/06 20:09:12 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*
- * Autoconfiguration definitions and prototypes for the SGC bus.
- */
-
-struct sgc_attach_args {
- int saa_slot; /* slot number */
- bus_space_tag_t saa_iot;
-};
-
-#ifdef _KERNEL
-void *sgc_slottopa(int);
-#endif /* _KERNEL */
-
-/* Macros to switch between SGC slot numbers and kernel conscode */
-#define SGC_SLOT_TO_CONSCODE(slot) (256 + (slot))
-#define CONSCODE_TO_SGC_SLOT(code) ((code) - 256)
diff --git a/sys/arch/hp300/dev/spc.c b/sys/arch/hp300/dev/spc.c
deleted file mode 100644
index c6eb44edfb8..00000000000
--- a/sys/arch/hp300/dev/spc.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/* $OpenBSD: spc.c,v 1.13 2008/07/30 18:08:02 miod Exp $ */
-/* $NetBSD: spc.c,v 1.2 2003/11/17 14:37:59 tsutsui Exp $ */
-
-/*
- * Copyright (c) 2003 Izumi Tsutsui.
- * 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.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsi_message.h>
-#include <scsi/scsiconf.h>
-
-#include <hp300/dev/mb89352reg.h>
-#include <hp300/dev/mb89352var.h>
-
-#include <hp300/dev/hp98265reg.h>
-#include <hp300/dev/dmareg.h>
-#include <hp300/dev/dmavar.h>
-
-#ifdef USELEDS
-#include <hp300/hp300/leds.h>
-#endif
-
-int spc_dio_match(struct device *, void *, void *);
-void spc_dio_attach(struct device *, struct device *, void *);
-int spc_dio_dmastart(struct spc_softc *, void *, size_t, int);
-int spc_dio_dmadone(struct spc_softc *);
-void spc_dio_dmago(void *);
-void spc_dio_dmastop(void *);
-int spc_dio_intr(void *);
-void spc_dio_reset(struct spc_softc *);
-
-#define HPSPC_ADDRESS(o) (dsc->sc_dregs + ((o) << 1) + 1)
-#define hpspc_read(o) *(volatile u_int8_t *)(HPSPC_ADDRESS(o))
-#define hpspc_write(o, v) *(volatile u_int8_t *)(HPSPC_ADDRESS(o)) = (v)
-
-struct spc_dio_softc {
- struct spc_softc sc_spc; /* MI spc softc */
- struct isr sc_isr;
- volatile u_int8_t *sc_dregs; /* Complete registers */
-
- struct dmaqueue sc_dq; /* DMA job queue */
- u_int sc_dflags; /* DMA flags */
-#define SCSI_DMA32 0x01 /* 32-bit DMA should be used */
-#define SCSI_HAVEDMA 0x02 /* controller has DMA channel */
-#define SCSI_DATAIN 0x04 /* DMA direction */
-};
-
-struct cfattach spc_ca = {
- sizeof(struct spc_dio_softc), spc_dio_match, spc_dio_attach
-};
-
-struct cfdriver spc_cd = {
- NULL, "spc", DV_DULL
-};
-
-/* cf_flags */
-#define SPC_NODMA 0x01
-
-int
-spc_dio_match(struct device *parent, void *vcf, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- switch (da->da_id) {
- case DIO_DEVICE_ID_SCSI0:
- case DIO_DEVICE_ID_SCSI1:
- case DIO_DEVICE_ID_SCSI2:
- case DIO_DEVICE_ID_SCSI3:
- return 1;
- }
-
- return 0;
-}
-
-void
-spc_dio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct spc_dio_softc *dsc = (struct spc_dio_softc *)self;
- struct spc_softc *sc = &dsc->sc_spc;
- struct dio_attach_args *da = aux;
- int ipl;
- u_int8_t id, hconf;
-
- dsc->sc_dregs = (u_int8_t *)iomap(dio_scodetopa(da->da_scode),
- da->da_size);
- if (dsc->sc_dregs == NULL) {
- printf(": can't map SCSI registers\n");
- return;
- }
- sc->sc_regs = dsc->sc_dregs + SPC_OFFSET;
-
- ipl = DIO_IPL(sc->sc_regs);
- printf(" ipl %d: 98265A SCSI", ipl);
-
- hpspc_write(HPSCSI_ID, 0xff);
- DELAY(100);
- id = hpspc_read(HPSCSI_ID);
- hconf = hpspc_read(HPSCSI_HCONF);
-
- if ((id & ID_WORD_DMA) == 0) {
- printf(", 32-bit DMA");
- dsc->sc_dflags |= SCSI_DMA32;
- }
- if ((hconf & HCONF_PARITY) == 0)
- printf(", no parity");
-
- printf("\n");
-
- if ((hconf & HCONF_PARITY) != 0)
- sc->sc_ctlflags = SCTL_PARITY_ENAB;
-
- id &= ID_MASK;
- sc->sc_initiator = id;
-
- if ((sc->sc_dev.dv_cfdata->cf_flags & SPC_NODMA) == 0) {
- sc->sc_dma_start = spc_dio_dmastart;
- sc->sc_dma_done = spc_dio_dmadone;
- }
- sc->sc_reset = spc_dio_reset;
-
- dsc->sc_dq.dq_softc = dsc;
- dsc->sc_dq.dq_start = spc_dio_dmago;
- dsc->sc_dq.dq_done = spc_dio_dmastop;
-
- hpspc_write(HPSCSI_CSR, 0x00);
- hpspc_write(HPSCSI_HCONF, 0x00);
-
- dsc->sc_isr.isr_func = spc_dio_intr;
- dsc->sc_isr.isr_arg = dsc;
- dsc->sc_isr.isr_ipl = ipl;
- dsc->sc_isr.isr_priority = IPL_BIO;
- dio_intr_establish(&dsc->sc_isr, self->dv_xname);
-
- spc_attach(sc);
-
- /* Enable SPC interrupts. */
- hpspc_write(HPSCSI_CSR, CSR_IE);
-}
-
-int
-spc_dio_dmastart(struct spc_softc *sc, void *addr, size_t size, int datain)
-{
- struct spc_dio_softc *dsc = (struct spc_dio_softc *)sc;
-
- /*
- * The HP98658 hardware cannot do odd length transfers, the
- * last byte of data will always be 0x00.
- */
- if ((size & 1) != 0)
- return (EINVAL);
-
- dsc->sc_dq.dq_chan = DMA0 | DMA1;
- dsc->sc_dflags |= SCSI_HAVEDMA;
- if (datain)
- dsc->sc_dflags |= SCSI_DATAIN;
- else
- dsc->sc_dflags &= ~SCSI_DATAIN;
-
- if (dmareq(&dsc->sc_dq) != 0)
- /* DMA channel is available, so start DMA immediately */
- spc_dio_dmago((void *)dsc);
- /* else dma start function will be called later from dmafree(). */
-
- return (0);
-}
-
-void
-spc_dio_dmago(void *arg)
-{
- struct spc_dio_softc *dsc = (struct spc_dio_softc *)arg;
- struct spc_softc *sc = &dsc->sc_spc;
- int len, chan;
- u_int32_t dmaflags;
- u_int8_t cmd;
-
- hpspc_write(HPSCSI_HCONF, 0);
- cmd = CSR_IE;
- dmaflags = DMAGO_NOINT;
- chan = dsc->sc_dq.dq_chan;
- if ((dsc->sc_dflags & SCSI_DATAIN) != 0) {
- cmd |= CSR_DMAIN;
- dmaflags |= DMAGO_READ;
- }
- if ((dsc->sc_dflags & SCSI_DMA32) != 0 &&
- ((u_int)sc->sc_dp & 3) == 0 &&
- (sc->sc_dleft & 3) == 0) {
- cmd |= CSR_DMA32;
- dmaflags |= DMAGO_LWORD;
- } else {
- dmaflags |= DMAGO_WORD;
- }
-
- sc->sc_flags |= SPC_DOINGDMA;
- dmago(chan, sc->sc_dp, sc->sc_dleft, dmaflags);
-
- hpspc_write(HPSCSI_CSR, cmd);
- cmd |= (chan == 0) ? CSR_DE0 : CSR_DE1;
- hpspc_write(HPSCSI_CSR, cmd);
-
- cmd = SCMD_XFR;
- len = sc->sc_dleft;
-
- if ((len & (DEV_BSIZE -1)) != 0) {
- cmd |= SCMD_PAD;
-#if 0
- /*
- * XXX - If we don't do this, the last 2 or 4 bytes
- * (depending on word/lword DMA) of a read get trashed.
- * It looks like it is necessary for the DMA to complete
- * before the SPC goes into "pad mode"??? Note: if we
- * also do this on a write, the request never completes.
- */
- if ((dsc->sc_dflags & SCSI_DATAIN) != 0)
- len += 2;
-#endif
- }
-
- spc_write(TCH, len >> 16);
- spc_write(TCM, len >> 8);
- spc_write(TCL, len);
- spc_write(PCTL, sc->sc_phase | PCTL_BFINT_ENAB);
- spc_write(SCMD, cmd);
-}
-
-int
-spc_dio_dmadone(struct spc_softc *sc)
-{
- struct spc_dio_softc *dsc = (struct spc_dio_softc *)sc;
- int resid, trans;
- u_int8_t cmd;
-
- /* Check if the DMA operation is finished. */
- if ((spc_read(SSTS) & SSTS_BUSY) != 0)
- return (0);
-
- sc->sc_flags &= ~SPC_DOINGDMA;
- if ((dsc->sc_dflags & SCSI_HAVEDMA) != 0) {
- dsc->sc_dflags &= ~SCSI_HAVEDMA;
- dmafree(&dsc->sc_dq);
- }
-
- cmd = hpspc_read(HPSCSI_CSR);
- cmd &= ~(CSR_DE1 | CSR_DE0);
- hpspc_write(HPSCSI_CSR, cmd);
-
- resid = spc_read(TCH) << 16 |
- spc_read(TCM) << 8 |
- spc_read(TCL);
- trans = sc->sc_dleft - resid;
- sc->sc_dp += trans;
- sc->sc_dleft -= trans;
-
- return (1);
-}
-
-void
-spc_dio_dmastop(void *arg)
-{
- struct spc_dio_softc *dsc = (struct spc_dio_softc *)arg;
- struct spc_softc *sc = &dsc->sc_spc;
- u_int8_t cmd;
-
- cmd = hpspc_read(HPSCSI_CSR);
- cmd &= ~(CSR_DE1 | CSR_DE0);
- hpspc_write(HPSCSI_CSR, cmd);
-
- dsc->sc_dflags &= ~SCSI_HAVEDMA;
- sc->sc_flags &= ~SPC_DOINGDMA;
-}
-
-int
-spc_dio_intr(void *arg)
-{
- struct spc_dio_softc *dsc = (struct spc_dio_softc *)arg;
-
- /* if we are sharing the ipl level, this interrupt may not be for us. */
- if ((hpspc_read(HPSCSI_CSR) & (CSR_IE | CSR_IR)) != (CSR_IE | CSR_IR))
- return (0);
-
-#ifdef USELEDS
- ledcontrol(0, 0, LED_DISK);
-#endif
-
- return (spc_intr(arg));
-}
-
-void
-spc_dio_reset(struct spc_softc *sc)
-{
- struct spc_dio_softc *dsc = (struct spc_dio_softc *)sc;
-
- spc_reset(sc);
- hpspc_write(HPSCSI_HCONF, 0x00);
-}
diff --git a/sys/arch/hp300/dev/sti_dio.c b/sys/arch/hp300/dev/sti_dio.c
deleted file mode 100644
index c2204b6275c..00000000000
--- a/sys/arch/hp300/dev/sti_dio.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/* $OpenBSD: sti_dio.c,v 1.1 2011/08/18 20:02:57 miod Exp $ */
-
-/*
- * Copyright (c) 2005, 2011, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/wscons/wsconsio.h>
-
-#include <dev/ic/stireg.h>
-#include <dev/ic/stivar.h>
-#include <hp300/dev/sti_machdep.h>
-
-#include <uvm/uvm_extern.h>
-
-void sti_dio_attach(struct device *, struct device *, void *);
-int sti_dio_match(struct device *, void *, void *);
-
-struct cfattach sti_dio_ca = {
- sizeof(struct sti_softc), sti_dio_match, sti_dio_attach
-};
-
-extern struct hp300_bus_space_tag hp300_mem_tag;
-
-int
-sti_dio_match(struct device *parent, void *match, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id != DIO_DEVICE_ID_FRAMEBUFFER ||
- (da->da_secid != DIO_DEVICE_SECID_FB3X2_A &&
- da->da_secid != DIO_DEVICE_SECID_FB3X2_B))
- return (0);
-
- /*
- * If we already probed it successfully as a console device, go ahead,
- * since we will not be able to bus_space_map() again.
- */
- if (da->da_scode == conscode)
- return (1);
-
- return (sti_dio_probe(da->da_scode));
-}
-
-void
-sti_dio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct sti_softc *sc = (void *)self;
- struct dio_attach_args *da = aux;
- bus_addr_t base;
- bus_space_tag_t iot;
- bus_space_handle_t romh;
- u_int romend;
- int i;
-
- /*
- * If we already probed it successfully as a console device, go ahead,
- * since we will not be able to bus_space_map() again.
- */
- if (da->da_scode == conscode) {
- sc->sc_flags |= STI_CONSOLE | STI_ATTACHED;
- sc->sc_rom = &sticn_rom;
- sc->sc_scr = &sticn_scr;
- bcopy(sticn_bases, sc->bases, sizeof(sc->bases));
-
- sti_describe(sc);
- } else {
- base = (bus_addr_t)
- dio_scodetopa(da->da_scode + STI_DIO_SCODE_OFFSET);
- iot = &hp300_mem_tag;
-
- if (bus_space_map(iot, base, PAGE_SIZE, 0, &romh)) {
- printf(": can't map frame buffer");
- return;
- }
-
- /*
- * Compute real PROM size
- */
- romend = sti_rom_size(iot, romh);
-
- bus_space_unmap(iot, romh, PAGE_SIZE);
-
- if (bus_space_map(iot, base, romend, 0, &romh)) {
- printf(": can't map frame buffer");
- return;
- }
-
- sc->bases[0] = romh;
- for (i = 1; i < STI_REGION_MAX; i++)
- sc->bases[i] = base;
-
- if (sti_attach_common(sc, iot, iot, romh,
- STI_CODEBASE_M68K) != 0)
- return;
- }
-
- sti_end_attach(sc);
-}
-
-int
-sti_dio_probe(int scode)
-{
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- int devtype;
- uint span;
-
- iot = &hp300_mem_tag;
-
- /*
- * Sanity checks:
- * these devices provide both a DIO and an STI ROM. We expect the
- * DIO ROM to be a DIO-II ROM (i.e. to be at a DIO-II select code)
- * and report the device as spanning at least four select codes.
- */
-
- if (!DIO_ISDIOII(scode))
- return 0;
-
- if (bus_space_map(iot, (bus_addr_t)dio_scodetopa(scode),
- PAGE_SIZE, 0, &ioh))
- return 0;
- span = bus_space_read_1(iot, ioh, DIOII_SIZEOFF);
- bus_space_unmap(iot, ioh, PAGE_SIZE);
-
- if (span < STI_DIO_SIZE - 1)
- return 0;
-
- if (bus_space_map(iot,
- (bus_addr_t)dio_scodetopa(scode + STI_DIO_SCODE_OFFSET),
- PAGE_SIZE, 0, &ioh))
- return 0;
- devtype = bus_space_read_1(iot, ioh, 3);
- bus_space_unmap(iot, ioh, PAGE_SIZE);
-
- if (devtype != STI_DEVTYPE1 && devtype != STI_DEVTYPE4)
- return 0;
-
- return 1;
-}
diff --git a/sys/arch/hp300/dev/sti_machdep.c b/sys/arch/hp300/dev/sti_machdep.c
deleted file mode 100644
index 7f454f4b481..00000000000
--- a/sys/arch/hp300/dev/sti_machdep.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $OpenBSD: sti_machdep.c,v 1.1 2011/08/18 20:02:57 miod Exp $ */
-
-/*
- * Copyright (c) 2005, 2011, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/sgcvar.h>
-
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/wscons/wsconsio.h>
-
-#include <dev/ic/stireg.h>
-#include <dev/ic/stivar.h>
-#include <hp300/dev/sti_machdep.h>
-
-extern struct hp300_bus_space_tag hp300_mem_tag;
-
-/* Console data */
-struct sti_rom sticn_rom;
-struct sti_screen sticn_scr;
-bus_addr_t sticn_bases[STI_REGION_MAX];
-
-void
-sticninit()
-{
- bus_space_tag_t iot;
- bus_addr_t base;
- int i;
-
- /*
- * We are not interested by the *first* console pass.
- */
- if (consolepass == 0)
- return;
-
- iot = &hp300_mem_tag;
- if (conscode >= SGC_SLOT_TO_CONSCODE(0))
- base = (bus_addr_t)sgc_slottopa(CONSCODE_TO_SGC_SLOT(conscode));
- else
- base =
- (bus_addr_t)dio_scodetopa(conscode + STI_DIO_SCODE_OFFSET);
-
- /* sticn_bases[0] will be fixed in sti_cnattach() */
- for (i = 0; i < STI_REGION_MAX; i++)
- sticn_bases[i] = base;
-
- sti_cnattach(&sticn_rom, &sticn_scr, iot, sticn_bases,
- STI_CODEBASE_M68K);
-
- /*
- * Since the copyright notice could not be displayed before,
- * display it again now.
- */
- printf("%s\n", copyright);
-}
diff --git a/sys/arch/hp300/dev/sti_machdep.h b/sys/arch/hp300/dev/sti_machdep.h
deleted file mode 100644
index c30770fe7cf..00000000000
--- a/sys/arch/hp300/dev/sti_machdep.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $OpenBSD: sti_machdep.h,v 1.2 2013/01/01 17:17:44 miod Exp $ */
-
-/*
- * Copyright (c) 2005, 2011, 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.
- *
- */
-
-#ifndef _STANDALONE
-/* Console data */
-extern struct sti_rom sticn_rom;
-extern struct sti_screen sticn_scr;
-extern bus_addr_t sticn_bases[STI_REGION_MAX];
-
-void sticninit(void);
-int sti_dio_probe(int);
-int sti_sgc_probe(bus_space_tag_t, int);
-#endif
-
-/* DIO attachment defines */
-#define STI_DIO_SCODE_OFFSET 0x02 /* offset to SGC rom, in select codes */
-#define STI_DIO_SIZE 0x10 /* expected total device size
- in DIO-II size units */
diff --git a/sys/arch/hp300/dev/sti_sgc.c b/sys/arch/hp300/dev/sti_sgc.c
deleted file mode 100644
index 2bfbba78dda..00000000000
--- a/sys/arch/hp300/dev/sti_sgc.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* $OpenBSD: sti_sgc.c,v 1.16 2011/08/18 20:02:57 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/sgcreg.h>
-#include <hp300/dev/sgcvar.h>
-
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/wscons/wsconsio.h>
-
-#include <dev/ic/stireg.h>
-#include <dev/ic/stivar.h>
-#include <hp300/dev/sti_machdep.h>
-
-#include <uvm/uvm_extern.h>
-
-void sti_sgc_attach(struct device *, struct device *, void *);
-int sti_sgc_match(struct device *, void *, void *);
-
-struct cfattach sti_sgc_ca = {
- sizeof(struct sti_softc), sti_sgc_match, sti_sgc_attach
-};
-
-int
-sti_sgc_match(struct device *parent, void *match, void *aux)
-{
- struct sgc_attach_args *saa = aux;
-
- /*
- * If we already probed it successfully as a console device, go ahead,
- * since we will not be able to bus_space_map() again.
- */
- if (SGC_SLOT_TO_CONSCODE(saa->saa_slot) == conscode)
- return (1);
-
- return (sti_sgc_probe(saa->saa_iot, saa->saa_slot));
-}
-
-void
-sti_sgc_attach(struct device *parent, struct device *self, void *aux)
-{
- struct sti_softc *sc = (void *)self;
- struct sgc_attach_args *saa = aux;
- bus_addr_t base;
- bus_space_handle_t romh;
- u_int romend;
- int i;
-
- /*
- * If we already probed it successfully as a console device, go ahead,
- * since we will not be able to bus_space_map() again.
- */
- if (SGC_SLOT_TO_CONSCODE(saa->saa_slot) == conscode) {
- sc->sc_flags |= STI_CONSOLE | STI_ATTACHED;
- sc->sc_rom = &sticn_rom;
- sc->sc_scr = &sticn_scr;
- bcopy(sticn_bases, sc->bases, sizeof(sc->bases));
-
- sti_describe(sc);
- } else {
- base = (bus_addr_t)sgc_slottopa(saa->saa_slot);
-
- if (bus_space_map(saa->saa_iot, base, PAGE_SIZE, 0, &romh)) {
- printf(": can't map frame buffer");
- return;
- }
-
- /*
- * Compute real PROM size
- */
- romend = sti_rom_size(saa->saa_iot, romh);
-
- bus_space_unmap(saa->saa_iot, romh, PAGE_SIZE);
-
- if (bus_space_map(saa->saa_iot, base, romend, 0, &romh)) {
- printf(": can't map frame buffer");
- return;
- }
-
- sc->bases[0] = romh;
- for (i = 1; i < STI_REGION_MAX; i++)
- sc->bases[i] = base;
-
- if (sti_attach_common(sc, saa->saa_iot, saa->saa_iot, romh,
- STI_CODEBASE_M68K) != 0)
- return;
- }
-
- sti_end_attach(sc);
-}
-
-int
-sti_sgc_probe(bus_space_tag_t iot, int slot)
-{
- bus_space_handle_t ioh;
- int devtype;
-
- if (bus_space_map(iot, (bus_addr_t)sgc_slottopa(slot),
- PAGE_SIZE, 0, &ioh))
- return (0);
-
- devtype = bus_space_read_1(iot, ioh, 3);
-
- bus_space_unmap(iot, ioh, PAGE_SIZE);
-
- /*
- * This might not be reliable enough. On the other hand, non-STI
- * SGC cards will apparently not initialize in an hp300, to the
- * point of not even answering bus probes (checked with an
- * Harmony/FDDI SGC card).
- */
- if (devtype != STI_DEVTYPE1 && devtype != STI_DEVTYPE4)
- return (0);
-
- return (1);
-}
diff --git a/sys/arch/hp300/dev/topcat.c b/sys/arch/hp300/dev/topcat.c
deleted file mode 100644
index ce23ed7724c..00000000000
--- a/sys/arch/hp300/dev/topcat.c
+++ /dev/null
@@ -1,522 +0,0 @@
-/* $OpenBSD: topcat.c,v 1.18 2013/10/21 10:36:13 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_tc.c 1.20 93/08/13$
- *
- * @(#)grf_tc.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for TOPCAT, CATSEYE and KATHMANDU frame buffers
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/intiovar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-#include <hp300/dev/topcatreg.h>
-
-struct topcat_softc {
- struct device sc_dev;
- struct diofb *sc_fb;
- struct diofb sc_fb_store;
- int sc_scode;
-};
-
-int topcat_dio_match(struct device *, void *, void *);
-void topcat_dio_attach(struct device *, struct device *, void *);
-int topcat_intio_match(struct device *, void *, void *);
-void topcat_intio_attach(struct device *, struct device *, void *);
-
-struct cfattach topcat_dio_ca = {
- sizeof(struct topcat_softc), topcat_dio_match, topcat_dio_attach
-};
-
-struct cfattach topcat_intio_ca = {
- sizeof(struct topcat_softc), topcat_intio_match, topcat_intio_attach
-};
-
-struct cfdriver topcat_cd = {
- NULL, "topcat", DV_DULL
-};
-
-void topcat_end_attach(struct topcat_softc *, u_int8_t);
-int topcat_reset(struct diofb *, int, struct diofbreg *);
-void topcat_restore(struct diofb *);
-int topcat_setcmap(struct diofb *, struct wsdisplay_cmap *);
-void topcat_setcolor(struct diofb *, u_int);
-int topcat_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
-
-int topcat_ioctl(void *, u_long, caddr_t, int, struct proc *);
-void topcat_burner(void *, u_int, u_int);
-
-struct wsdisplay_accessops topcat_accessops = {
- .ioctl = topcat_ioctl,
- .mmap = diofb_mmap,
- .alloc_screen = diofb_alloc_screen,
- .free_screen = diofb_free_screen,
- .show_screen = diofb_show_screen,
- .load_font = diofb_load_font,
- .list_font = diofb_list_font,
- .burn_screen = topcat_burner
-};
-
-/*
- * Attachment glue
- */
-
-int
-topcat_intio_match(struct device *parent, void *match, void *aux)
-{
- struct intio_attach_args *ia = aux;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
-
- if (badaddr((caddr_t)fbr))
- return (0);
-
- if (fbr->id == GRFHWID) {
- switch (fbr->fbid) {
- case GID_TOPCAT:
- case GID_LRCATSEYE:
- case GID_HRCCATSEYE:
- case GID_HRMCATSEYE:
-#if 0
- case GID_XXXCATSEYE:
-#endif
- ia->ia_addr = (caddr_t)GRFIADDR;
- return (1);
- }
- }
-
- return (0);
-}
-
-void
-topcat_intio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct topcat_softc *sc = (struct topcat_softc *)self;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
- sc->sc_scode = CONSCODE_INTERNAL;
-
- if (sc->sc_scode == conscode) {
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- topcat_reset(sc->sc_fb, sc->sc_scode, fbr);
- }
-
- topcat_end_attach(sc, fbr->fbid);
-}
-
-int
-topcat_dio_match(struct device *parent, void *match, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER) {
- switch (da->da_secid) {
- case DIO_DEVICE_SECID_TOPCAT:
- case DIO_DEVICE_SECID_LRCATSEYE:
- case DIO_DEVICE_SECID_HRCCATSEYE:
- case DIO_DEVICE_SECID_HRMCATSEYE:
-#if 0
- case DIO_DEVICE_SECID_XXXCATSEYE:
-#endif
- return (1);
- }
- }
-
- return (0);
-}
-
-void
-topcat_dio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct topcat_softc *sc = (struct topcat_softc *)self;
- struct dio_attach_args *da = aux;
- struct diofbreg *fbr;
-
- sc->sc_scode = da->da_scode;
- if (sc->sc_scode == conscode) {
- fbr = (struct diofbreg *)conaddr; /* already mapped */
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- fbr = (struct diofbreg *)
- iomap(dio_scodetopa(sc->sc_scode), da->da_size);
- if (fbr == NULL ||
- topcat_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) {
- printf(": can't map framebuffer\n");
- return;
- }
- }
-
- topcat_end_attach(sc, fbr->fbid);
-}
-
-void
-topcat_end_attach(struct topcat_softc *sc, u_int8_t id)
-{
- const char *fbname = "unknown";
-
- switch (id) {
- case GID_TOPCAT:
- switch (sc->sc_fb->planes) {
- case 1:
- if (sc->sc_fb->dheight == 400)
- fbname = "HP98542 topcat";
- else
- fbname = "HP98544 topcat";
- break;
- case 4:
- if (sc->sc_fb->dheight == 400)
- fbname = "HP98543 topcat";
- else
- fbname = "HP98545 topcat";
- break;
- case 6:
- fbname = "HP98547 topcat";
- break;
- }
- break;
- case GID_HRCCATSEYE:
- fbname = "HP98550 catseye"; /* also A1416 kathmandu */
- break;
- case GID_LRCATSEYE:
- fbname = "HP98549 catseye";
- break;
- case GID_HRMCATSEYE:
- fbname = "HP98548 catseye";
- break;
- }
-
- diofb_end_attach(sc, &topcat_accessops, sc->sc_fb,
- sc->sc_scode == conscode, fbname);
-}
-
-/*
- * Initialize hardware and display routines.
- */
-int
-topcat_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
-{
- volatile struct tcboxfb *tc = (struct tcboxfb *)fbr;
- int rc;
- u_int i;
-
- if ((rc = diofb_fbinquire(fb, scode, fbr)) != 0)
- return (rc);
-
- /*
- * If we could not get a valid number of planes, determine it
- * by writing to the first frame buffer display location,
- * then reading it back.
- */
- if (fb->planes == 0) {
- volatile u_int8_t *fbp;
- u_int8_t save;
-
- fbp = (u_int8_t *)fb->fbkva;
- tc->fben = ~0;
- tc->wen = ~0;
- tc->ren = ~0;
- tc->prr = RR_COPY;
- save = *fbp;
- *fbp = 0xff;
- fb->planemask = *fbp;
- *fbp = save;
-
- for (fb->planes = 1; fb->planemask >= (1 << fb->planes);
- fb->planes++);
- if (fb->planes > 8)
- fb->planes = 8;
- fb->planemask = (1 << fb->planes) - 1;
- }
-
- fb->bmv = topcat_windowmove;
- topcat_restore(fb);
- diofb_fbsetup(fb);
- for (i = 0; i <= fb->planemask; i++)
- topcat_setcolor(fb, i);
-
- return (0);
-}
-
-void
-topcat_restore(struct diofb *fb)
-{
- volatile struct tcboxfb *tc = (struct tcboxfb *)fb->regkva;
-
- /*
- * Catseye looks a lot like a topcat, but not completely.
- * So, we set some bits to make it work.
- */
- if (tc->regs.fbid != GID_TOPCAT) {
- while ((tc->catseye_status & 1))
- ;
- tc->catseye_status = 0x0;
- tc->vb_select = 0x0;
- tc->tcntrl = 0x0;
- tc->acntrl = 0x0;
- tc->pncntrl = 0x0;
- tc->rug_cmdstat = 0x90;
- }
-
- /*
- * Enable reading/writing of all the planes.
- */
- tc->fben = fb->planemask;
- tc->wen = fb->planemask;
- tc->ren = fb->planemask;
- tc->prr = RR_COPY;
-
- /* Enable display */
- tc->nblank = 0xff;
-}
-
-int
-topcat_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
-{
- struct diofb *fb = v;
- struct wsdisplay_fbinfo *wdf;
- u_int i;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_TOPCAT;
- break;
- case WSDISPLAYIO_SMODE:
- fb->mapmode = *(u_int *)data;
- if (fb->mapmode == WSDISPLAYIO_MODE_EMUL) {
- topcat_restore(fb);
- for (i = 0; i <= fb->planemask; i++)
- topcat_setcolor(fb, i);
- }
- break;
- case WSDISPLAYIO_GINFO:
- wdf = (void *)data;
- wdf->width = fb->ri.ri_width;
- wdf->height = fb->ri.ri_height;
- wdf->depth = fb->ri.ri_depth;
- wdf->cmsize = 1 << fb->planes;
- break;
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = fb->ri.ri_stride;
- break;
- case WSDISPLAYIO_GETCMAP:
- return (diofb_getcmap(fb, (struct wsdisplay_cmap *)data));
- case WSDISPLAYIO_PUTCMAP:
- return (topcat_setcmap(fb, (struct wsdisplay_cmap *)data));
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- break;
- default:
- return (-1);
- }
-
- return (0);
-}
-
-void
-topcat_burner(void *v, u_int on, u_int flags)
-{
- struct diofb *fb = v;
- volatile struct tcboxfb *tc = (struct tcboxfb *)fb->regkva;
-
- if (on) {
- tc->nblank = 0xff;
- } else {
- tc->nblank = 0;
- }
-}
-
-void
-topcat_setcolor(struct diofb *fb, u_int index)
-{
- volatile struct tcboxfb *tc = (struct tcboxfb *)fb->regkva;
-
- /* Monochrome topcat may not have the colormap logic present */
- if (fb->planes <= 1)
- return;
-
- if (tc->regs.fbid != GID_TOPCAT) {
- tccm_waitbusy(tc);
- tc->plane_mask = 0xff;
- tc->cindex = ~index;
- tc->rdata = fb->cmap.r[index];
- tc->gdata = fb->cmap.g[index];
- tc->bdata = fb->cmap.b[index];
- tc->strobe = 0xff;
-
- tccm_waitbusy(tc);
- tc->cindex = 0;
- } else {
- tccm_waitbusy(tc);
- tc->plane_mask = 0xff;
- tc->rdata = fb->cmap.r[index];
- tc->gdata = fb->cmap.g[index];
- tc->bdata = fb->cmap.b[index];
- tc->cindex = ~index;
- tc->strobe = 0xff;
-
- tccm_waitbusy(tc);
- tc->rdata = 0;
- tc->gdata = 0;
- tc->bdata = 0;
- tc->cindex = 0;
- }
-}
-
-int
-topcat_setcmap(struct diofb *fb, struct wsdisplay_cmap *cm)
-{
- u_int8_t r[256], g[256], b[256];
- u_int index = cm->index, count = cm->count;
- u_int colcount = 1 << fb->planes;
- int error;
-
- 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);
-
- bcopy(r, fb->cmap.r + index, count);
- bcopy(g, fb->cmap.g + index, count);
- bcopy(b, fb->cmap.b + index, count);
-
- while (count-- != 0)
- topcat_setcolor(fb, index++);
-
- return (0);
-}
-
-/*
- * Accelerated routines
- */
-
-int
-topcat_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
- u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop,
- int16_t planemask)
-{
- volatile struct tcboxfb *tc = (struct tcboxfb *)fb->regkva;
-
- tc_waitbusy(tc, fb->planemask);
-
- tc->wen = planemask;
- tc->wmrr = rop;
- if (planemask != 0xff) {
- tc->wen = planemask ^ 0xff;
- tc->wmrr = rop ^ 0x0f;
- tc->wen = fb->planemask;
- }
- tc->source_y = sy;
- tc->source_x = sx;
- tc->dest_y = dy;
- tc->dest_x = dx;
- tc->wheight = cy;
- tc->wwidth = cx;
- tc->wmove = fb->planemask;
-
- tc_waitbusy(tc, fb->planemask);
-
- return (0);
-}
-
-/*
- * Topcat/catseye console support
- */
-
-void
-topcatcninit()
-{
- topcat_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
- diofb_cnattach(&diofb_cn);
-}
diff --git a/sys/arch/hp300/dev/topcatreg.h b/sys/arch/hp300/dev/topcatreg.h
deleted file mode 100644
index 76fd18f3887..00000000000
--- a/sys/arch/hp300/dev/topcatreg.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $OpenBSD: topcatreg.h,v 1.3 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: grf_tcreg.h,v 1.6 1994/10/26 07:24:06 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_tcreg.h 1.11 92/01/21$
- *
- * @(#)grf_tcreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#define tccm_waitbusy(regaddr) \
-do { \
- while (((volatile struct tcboxfb *)(regaddr))->cmap_busy & 0x04) \
- DELAY(10); \
-} while (0)
-
-#define tc_waitbusy(regaddr,planes) \
-do { \
- while (((volatile struct tcboxfb *)(regaddr))->busy & planes) \
- DELAY(10); \
-} while (0)
-
-struct tcboxfb {
- struct diofbreg regs;
- u_int8_t f2[0x4040-0x5f-1];
- u_int8_t vblank; /* vertical blanking 0x4040 */
- u_int8_t :8,:8,:8;
- u_int8_t busy; /* window move active 0x4044 */
- u_int8_t :8,:8,:8;
- u_int8_t vtrace_request; /* vert retrace intr request 0x4048 */
- u_int8_t :8,:8,:8;
- u_int8_t move_request; /* window move intr request 0x404C */
- u_int8_t f3[0x4080-0x404c-1];
- u_int8_t nblank; /* display enable planes 0x4080 */
- u_int8_t f4[0x4088-0x4080-1];
- u_int8_t wen; /* write enable plane 0x4088 */
- u_int8_t f5[0x408c-0x4088-1];
- u_int8_t ren; /* read enable plane 0x408c */
- u_int8_t f6[0x4090-0x408c-1];
- u_int8_t fben; /* frame buffer write enable 0x4090 */
- u_int8_t f7[0x409c-0x4090-1];
- u_int8_t wmove; /* start window move 0x409c */
- u_int8_t f8[0x40a0-0x409c-1];
- u_int8_t blink; /* enable blink planes 0x40a0 */
- u_int8_t f9[0x40a8-0x40a0-1];
- u_int8_t altframe; /* enable alternate frame 0x40a8 */
- u_int8_t f10[0x40ac-0x40a8-1];
- u_int8_t curon; /* cursor control register 0x40ac */
- u_int8_t f11[0x40ea-0x40ac-1];
- u_int8_t prr; /* pixel replacement rule 0x40ea */
- u_int8_t f12[0x40ef-0x40ea-1];
- u_int8_t wmrr; /* move replacement rule 0x40ef */
- u_int8_t f13[0x40f2-0x40ef-1];
- u_int16_t source_x; /* source x pixel # 0x40f2 */
- u_int8_t f14[0x40f6-0x40f2-2];
- u_int16_t source_y; /* source y pixel # 0x40f6 */
- u_int8_t f15[0x40fa-0x40f6-2];
- u_int16_t dest_x; /* dest x pixel # 0x40fa */
- u_int8_t f16[0x40fe -0x40fa-2];
- u_int16_t dest_y; /* dest y pixel # 0x40fe */
- u_int8_t f17[0x4102-0x40fe -2];
- u_int16_t wwidth; /* block mover pixel width 0x4102 */
- u_int8_t f18[0x4106-0x4102-2];
- u_int16_t wheight; /* block mover pixel height 0x4106 */
- /* Catseye */
- u_int8_t f19[0x4206-0x4106-2];
- u_int16_t rug_cmdstat; /* RUG Command/Staus 0x4206 */
- u_int8_t f20[0x4510-0x4206-2];
- u_int16_t vb_select; /* Vector/BitBlt Select 0x4510 */
- u_int16_t tcntrl; /* Three Operand Control 0x4512 */
- u_int16_t acntrl; /* BitBlt Mode 0x4514 */
- u_int16_t pncntrl; /* Plane Control 0x4516 */
- u_int8_t f21[0x4800-0x4516-2];
- u_int16_t catseye_status; /* Catseye Status 0x4800 */
- /* End of Catseye */
- u_int8_t f22[0x6002-0x4800-2];
- u_int16_t cmap_busy; /* Color Ram busy 0x6002 */
- u_int8_t f23[0x60b2-0x6002-2];
- u_int16_t rdata; /* color map red data 0x60b2 */
- u_int16_t gdata; /* color map green data 0x60b4 */
- u_int16_t bdata; /* color map blue data 0x60b6 */
- u_int16_t cindex; /* color map index 0x60b8 */
- u_int16_t plane_mask; /* plane mask select 0x60ba */
- u_int8_t f24[0x60f0-0x60ba-2];
- u_int16_t strobe; /* color map trigger 0x60f0 */
-} __packed;
diff --git a/sys/arch/hp300/dev/tvrx.c b/sys/arch/hp300/dev/tvrx.c
deleted file mode 100644
index e441225b104..00000000000
--- a/sys/arch/hp300/dev/tvrx.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/* $OpenBSD: tvrx.c,v 1.4 2013/10/21 10:36:13 miod Exp $ */
-
-/*
- * Copyright (c) 2006, 2011, Miodrag Vallat.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*
- * Graphics routines for the ``TigerShark'' PersonalVRX frame buffer,
- * in its non-STI flavour (DIO-II 98702-66501 interface board; the SGC
- * 98705-66582 board is expected to be supported by the sti(4) driver).
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-
-#include <dev/cons.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-
-/*
- * Hardware registers
- */
-
-#define TVRX_FV_TRIG 0x5003 /* commit mode settings */
-#define TVRX_DISPLAY_ENABLE 0x500f /* enable display */
-#define TVRX_FB_P_ENABLE 0x5017 /* enable primary fb planes */
-#define TVRX_FB_S_ENABLE 0x501b /* enable secondary fb planes */
-#define TVRX_O_P_ENABLE 0x5023 /* enable primary overlay planes */
-#define TVRX_O_S_ENABLE 0x5027 /* enable secondary overlay planes */
-#define TVRX_WBUSY 0x7047 /* window mover busy */
-#define TVRX_ZHERE 0x7053 /* Z buffer available */
-#define TVRX_FB_WEN 0x7093 /* fb planes write enable */
-#define TVRX_WMOVE 0x709f /* trigger window mover */
-#define TVRX_O_WEN 0x70b7 /* overlay planes write enable */
-#define TVRX_DRIVE 0x70bf /* vram access mode */
-#define DRIVE_OVERLAY_ENABLE 0x10 /* drive vram to overlays */
-#define DRIVE_1BPP 0x80 /* force 1bpp packed memory */
-#define DRIVE_PLANE_MASK 0x0f /* overlay planes read mask */
-#define TVRX_REP_RULE 0x70ef /* window mover replacement rule */
-#define TVRX_ROP(rop) ((rop) << 4 | (rop))
-#define TVRX_SRC_X 0x70f2 /* window mover source position */
-#define TVRX_SRC_Y 0x70f6
-#define TVRX_DST_X 0x70fa /* window mover destination position */
-#define TVRX_DST_Y 0x70fe
-#define TVRX_CNT_X 0x7102 /* window mover span */
-#define TVRX_CNT_Y 0x7106
-
-#define TVRX_CMAP_O_P 0x5203 /* primary overlay colormap (16xRGB) */
-#define TVRX_CMAP_O_S 0x5303 /* secondary overlay colormap */
-#define TVRX_CMAP_FB_P_R 0x5403 /* primary fb colormap, 256xR */
-#define TVRX_CMAP_FB_P_G 0x5803 /* primary fb colormap, 256xG */
-#define TVRX_CMAP_FB_P_B 0x5c03 /* primary fb colormap, 256xB */
-#define TVRX_CMAP_FB_S_R 0x6403 /* secondary fb colormap, 256xR */
-#define TVRX_CMAP_FB_S_G 0x6803 /* secondary fb colormap, 256xG */
-#define TVRX_CMAP_FB_S_B 0x6c03 /* secondary fb colormap, 256xB */
-
-#define tvrx_reg(kva,type,offset) \
- (*(volatile type *)((kva) + (offset)))
-
-/* wait for window mover to become idle */
-#define tvrx_waitbusy(fb) \
-do { \
- while (tvrx_reg((fb)->regkva, uint8_t, TVRX_WBUSY) & 0x01) \
- ; \
-} while (0)
-
-
-struct tvrx_softc {
- struct device sc_dev;
- struct diofb *sc_fb;
- struct diofb sc_fb_store;
-
- int sc_scode;
-};
-
-int tvrx_match(struct device *, void *, void *);
-void tvrx_attach(struct device *, struct device *, void *);
-
-struct cfattach tvrx_ca = {
- sizeof(struct tvrx_softc), tvrx_match, tvrx_attach
-};
-
-struct cfdriver tvrx_cd = {
- NULL, "tvrx", DV_DULL
-};
-
-int tvrx_reset(struct diofb *, int, struct diofbreg *);
-void tvrx_restore(struct diofb *);
-int tvrx_setcmap(struct diofb *, struct wsdisplay_cmap *);
-void tvrx_setcolor(struct diofb *, u_int);
-int tvrx_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
-
-int tvrx_ioctl(void *, u_long, caddr_t, int, struct proc *);
-void tvrx_burner(void *, u_int, u_int);
-
-struct wsdisplay_accessops tvrx_accessops = {
- .ioctl = tvrx_ioctl,
- .mmap = diofb_mmap,
- .alloc_screen = diofb_alloc_screen,
- .free_screen = diofb_free_screen,
- .show_screen = diofb_show_screen,
- .load_font = diofb_load_font,
- .list_font = diofb_list_font,
- .burn_screen = tvrx_burner
-};
-
-/*
- * Attachment glue
- */
-
-int
-tvrx_match(struct device *parent, void *match, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id != DIO_DEVICE_ID_FRAMEBUFFER ||
- da->da_secid != DIO_DEVICE_SECID_TIGERSHARK)
- return (0);
-
- return (1);
-}
-
-void
-tvrx_attach(struct device *parent, struct device *self, void *aux)
-{
- struct tvrx_softc *sc = (struct tvrx_softc *)self;
- struct dio_attach_args *da = aux;
- struct diofbreg *fbr;
-
- sc->sc_scode = da->da_scode;
- if (sc->sc_scode == conscode) {
- fbr = (struct diofbreg *)conaddr; /* already mapped */
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- fbr = (struct diofbreg *)
- iomap(dio_scodetopa(sc->sc_scode), da->da_size);
- if (fbr == NULL ||
- tvrx_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) {
- printf(": can't map framebuffer\n");
- return;
- }
- }
-
- diofb_end_attach(sc, &tvrx_accessops, sc->sc_fb,
- sc->sc_scode == conscode, NULL);
-}
-
-/*
- * Initialize hardware and display routines.
- */
-int
-tvrx_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
-{
- int rc;
- u_int i;
-
- if ((rc = diofb_fbinquire(fb, scode, fbr)) != 0)
- return (rc);
-
- /* diofb_fbinquire will return 8 (or maybe 16) planes, but we
- only use the 4 overlay planes */
- fb->planes = 4;
- fb->planemask = (1 << 4) - 1;
-
- fb->bmv = tvrx_windowmove;
- tvrx_restore(fb);
- diofb_fbsetup(fb);
- for (i = 0; i <= fb->planemask; i++)
- tvrx_setcolor(fb, i);
-
- return (0);
-}
-
-void
-tvrx_restore(struct diofb *fb)
-{
- volatile struct diofbreg *fbr = (volatile struct diofbreg *)fb->regkva;
-
- /*
- * Resetting the hardware is slow, disables display output, and
- * does not clear video memory. Give it some time before we setup
- * ourselves.
- */
- fbr->id = GRFHWID;
- DELAY(100000);
-
- /* run the overlay planes unpacked... */
- tvrx_reg(fb->regkva, uint8_t, TVRX_DRIVE) =
- DRIVE_OVERLAY_ENABLE | fb->planemask;
- /* ...and enable the four of them */
- tvrx_reg(fb->regkva, uint8_t, TVRX_O_P_ENABLE) = fb->planemask;
- tvrx_reg(fb->regkva, uint8_t, TVRX_O_S_ENABLE) = fb->planemask;
- tvrx_reg(fb->regkva, uint8_t, TVRX_O_WEN) = fb->planemask;
- /* disable fb planes for safety */
- tvrx_reg(fb->regkva, uint8_t, TVRX_FB_P_ENABLE) = 0;
- tvrx_reg(fb->regkva, uint8_t, TVRX_FB_S_ENABLE) = 0;
-
- tvrx_reg(fb->regkva, uint8_t, TVRX_REP_RULE) = TVRX_ROP(RR_COPY);
- tvrx_reg(fb->regkva, uint8_t, TVRX_DISPLAY_ENABLE) = 0x01;
- tvrx_reg(fb->regkva, uint8_t, TVRX_FV_TRIG) = 0x01;
-}
-
-int
-tvrx_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
-{
- struct diofb *fb = v;
- struct wsdisplay_fbinfo *wdf;
- u_int i;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_TVRX;
- break;
- case WSDISPLAYIO_SMODE:
- fb->mapmode = *(u_int *)data;
- if (fb->mapmode == WSDISPLAYIO_MODE_EMUL) {
- tvrx_restore(fb);
- /* clear display */
- (*fb->bmv)(fb, 0, 0, 0, 0, fb->fbwidth, fb->fbheight,
- RR_CLEAR, fb->planemask);
- /* restore colormap */
- diofb_resetcmap(fb);
- for (i = 0; i <= fb->planemask; i++)
- tvrx_setcolor(fb, i);
- }
- break;
- case WSDISPLAYIO_GINFO:
- wdf = (void *)data;
- wdf->width = fb->ri.ri_width;
- wdf->height = fb->ri.ri_height;
- wdf->depth = fb->ri.ri_depth;
- wdf->cmsize = 1 << fb->planes;
- break;
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = fb->ri.ri_stride;
- break;
- case WSDISPLAYIO_GETCMAP:
- return (diofb_getcmap(fb, (struct wsdisplay_cmap *)data));
- case WSDISPLAYIO_PUTCMAP:
- return (tvrx_setcmap(fb, (struct wsdisplay_cmap *)data));
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- break;
- default:
- return (-1);
- }
-
- return (0);
-}
-
-void
-tvrx_burner(void *v, u_int on, u_int flags)
-{
- struct diofb *fb = v;
-
- tvrx_reg(fb->regkva, uint8_t, TVRX_DISPLAY_ENABLE) = on ? 0x01 : 0x00;
- tvrx_reg(fb->regkva, uint8_t, TVRX_FV_TRIG) = 0x01;
-}
-
-void
-tvrx_setcolor(struct diofb *fb, u_int index)
-{
- u_int index_scaled = index * 3 * 4;
-
- tvrx_reg(fb->regkva, uint8_t, TVRX_CMAP_O_P + index_scaled) =
- tvrx_reg(fb->regkva, uint8_t, TVRX_CMAP_O_S + index_scaled) =
- fb->cmap.r[index];
- tvrx_reg(fb->regkva, uint8_t, TVRX_CMAP_O_P + 4 + index_scaled) =
- tvrx_reg(fb->regkva, uint8_t, TVRX_CMAP_O_S + 4 + index_scaled) =
- fb->cmap.g[index];
- tvrx_reg(fb->regkva, uint8_t, TVRX_CMAP_O_P + 2 * 4 + index_scaled) =
- tvrx_reg(fb->regkva, uint8_t, TVRX_CMAP_O_S + 2 * 4 + index_scaled) =
- fb->cmap.b[index];
-}
-
-int
-tvrx_setcmap(struct diofb *fb, struct wsdisplay_cmap *cm)
-{
- u_int8_t r[256], g[256], b[256];
- u_int index = cm->index, count = cm->count;
- u_int colcount = 1 << fb->planes;
- int error;
-
- 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);
-
- bcopy(r, fb->cmap.r + index, count);
- bcopy(g, fb->cmap.g + index, count);
- bcopy(b, fb->cmap.b + index, count);
-
- while (count-- != 0)
- tvrx_setcolor(fb, index++);
-
- return (0);
-}
-
-int
-tvrx_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy, u_int16_t dx,
- u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop, int16_t planemask)
-{
-#ifdef TVRX_DEBUG
- printf("%s: %dx%d %dx%d %dx%d rx %x planemask %x\n",
- __func__, fb->sx, sy, dx, dy, cx, cy, rop, planemask);
-#endif
-
- planemask &= fb->planemask;
-
- tvrx_reg(fb->regkva, uint16_t, TVRX_SRC_Y) = sy;
- tvrx_reg(fb->regkva, uint16_t, TVRX_SRC_X) = sx;
- tvrx_reg(fb->regkva, uint16_t, TVRX_DST_Y) = dy;
- tvrx_reg(fb->regkva, uint16_t, TVRX_DST_X) = dx;
- tvrx_reg(fb->regkva, uint16_t, TVRX_CNT_Y) = cy;
- tvrx_reg(fb->regkva, uint16_t, TVRX_CNT_X) = cx;
-
- tvrx_reg(fb->regkva, uint8_t, TVRX_REP_RULE) = TVRX_ROP(rop);
- tvrx_reg(fb->regkva, uint8_t, TVRX_O_WEN) = planemask;
- tvrx_reg(fb->regkva, uint8_t, TVRX_WMOVE) = 1;
- tvrx_waitbusy(fb);
-
- if (planemask != fb->planemask) {
- rop ^= 0x0f;
- planemask ^= fb->planemask;
- tvrx_reg(fb->regkva, uint8_t, TVRX_REP_RULE) = TVRX_ROP(rop);
- tvrx_reg(fb->regkva, uint8_t, TVRX_O_WEN) = planemask;
- tvrx_reg(fb->regkva, uint8_t, TVRX_WMOVE) = 1;
- tvrx_waitbusy(fb);
- }
-
- tvrx_reg(fb->regkva, uint8_t, TVRX_O_WEN) = fb->planemask;
- tvrx_reg(fb->regkva, uint8_t, TVRX_REP_RULE) = TVRX_ROP(RR_COPY);
-
- return 0;
-}
-
-/*
- * Console support
- */
-
-void
-tvrxcninit()
-{
- tvrx_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
- diofb_cnattach(&diofb_cn);
-}
diff --git a/sys/arch/hp300/hp300/autoconf.c b/sys/arch/hp300/hp300/autoconf.c
deleted file mode 100644
index e054fb7ab8f..00000000000
--- a/sys/arch/hp300/hp300/autoconf.c
+++ /dev/null
@@ -1,871 +0,0 @@
-/* $OpenBSD: autoconf.c,v 1.49 2010/06/09 15:44:17 miod Exp $ */
-/* $NetBSD: autoconf.c,v 1.45 1999/04/10 17:31:02 kleink Exp $ */
-
-/*
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * 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.
- *
- * from: Utah $Hdr: autoconf.c 1.36 92/12/20$
- *
- * @(#)autoconf.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * Setup the system to run on the current machine.
- *
- * cpu_configure() is called at boot time. Available
- * devices are determined (from possibilities mentioned in ioconf.c),
- * and the drivers are initialized.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <sys/malloc.h>
-#include <sys/extent.h>
-#include <sys/mount.h>
-#include <sys/queue.h>
-#include <sys/reboot.h>
-#include <sys/tty.h>
-
-#include <dev/cons.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/vmparam.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-#include <machine/intr.h>
-#include <machine/pte.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-
-#include <hp300/dev/dmavar.h>
-
-#include <hp300/dev/hpibvar.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#include <uvm/uvm_extern.h>
-
-/*
- * The following several variables are related to
- * the configuration process, and are used in initializing
- * the machine.
- */
-
-struct extent *extio;
-
-extern caddr_t internalhpib;
-extern char *extiobase;
-
-/* The boot device. */
-struct device *bootdv;
-
-/* The device we mount as root. */
-struct device *root_device;
-
-/* How we were booted. */
-u_int bootdev;
-
-/*
- * This information is built during the autoconfig process.
- * A little explanation about the way this works is in order.
- *
- * device_register() links all devices into dev_data_list.
- * If the device is an hpib controller, it is also linked
- * into dev_data_list_hpib. If the device is a scsi controller,
- * it is also linked into dev_data_list_scsi.
- *
- * dev_data_list_hpib and dev_data_list_scsi are sorted
- * by select code, from lowest to highest.
- *
- * After autoconfiguration is complete, we need to determine
- * which device was the boot device. The boot block assigns
- * controller unit numbers in order of select code. Thus,
- * providing the controller is configured in the kernel, we
- * can determine our version of controller unit number from
- * the sorted hpib/scsi list.
- *
- * At this point, we know the controller (device type
- * encoded in bootdev tells us "scsi disk", or "hpib tape",
- * etc.). The next step is to find the device which
- * has the following properties:
- *
- * - A child of the boot controller.
- * - Same slave as encoded in bootdev.
- * - Same physical unit as encoded in bootdev.
- *
- * Later, after we've set the root device in stone, we
- * reverse the process to re-encode bootdev so it can be
- * passed back to the boot block.
- */
-struct dev_data {
- LIST_ENTRY(dev_data) dd_list; /* dev_data_list */
- LIST_ENTRY(dev_data) dd_clist; /* ctlr list */
- struct device *dd_dev; /* device described by this entry */
- int dd_scode; /* select code of device */
- int dd_slave; /* ...or slave */
- int dd_punit; /* and punit... */
-};
-typedef LIST_HEAD(, dev_data) ddlist_t;
-ddlist_t dev_data_list; /* all dev_datas */
-ddlist_t dev_data_list_hpib; /* hpib controller dev_datas */
-ddlist_t dev_data_list_scsi; /* scsi controller dev_datas */
-
-void findbootdev(void);
-void findbootdev_slave(ddlist_t *, int, int, int);
-void setbootdev(void);
-
-static struct dev_data *dev_data_lookup(struct device *);
-static void dev_data_insert(struct dev_data *, ddlist_t *);
-
-static int device_match(struct device *, const char *);
-
-int mainbusmatch(struct device *, void *, void *);
-void mainbusattach(struct device *, struct device *, void *);
-int mainbussearch(struct device *, void *, void *);
-
-struct cfattach mainbus_ca = {
- sizeof(struct device), mainbusmatch, mainbusattach
-};
-
-struct cfdriver mainbus_cd = {
- NULL, "mainbus", DV_DULL
-};
-
-int
-mainbusmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- static int mainbus_matched = 0;
-
- /* Allow only one instance. */
- if (mainbus_matched)
- return (0);
-
- mainbus_matched = 1;
- return (1);
-}
-
-void
-mainbusattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
-
- printf("\n");
-
- /* Search for and attach children. */
- config_search(mainbussearch, self, NULL);
-}
-
-int
-mainbussearch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct cfdata *cf = match;
-
- if ((*cf->cf_attach->ca_match)(parent, cf, NULL) > 0)
- config_attach(parent, cf, NULL, NULL);
- return (0);
-}
-
-/*
- * Determine the device configuration for the running system.
- */
-void
-cpu_configure()
-{
- /* this couldn't be done in intr_init() because this uses malloc() */
- softintr_init();
-
- /*
- * Initialize the dev_data_lists.
- */
- LIST_INIT(&dev_data_list);
- LIST_INIT(&dev_data_list_hpib);
- LIST_INIT(&dev_data_list_scsi);
-
- (void)splhigh();
- if (config_rootfound("mainbus", "mainbus") == NULL)
- panic("no mainbus found");
- (void)spl0();
-
- intr_printlevels();
-
- /*
- * Find boot device.
- */
- if ((bootdev & B_MAGICMASK) != B_DEVMAGIC) {
- printf("WARNING: boot program didn't supply boot device.\n");
- printf("Please update your boot program.\n");
- } else {
- findbootdev();
- if (bootdv == NULL) {
- printf("WARNING: can't find match for bootdev:\n");
- printf(
- "type = %d, ctlr = %d, slave = %d, punit = %d, part = %d\n",
- B_TYPE(bootdev), B_ADAPTOR(bootdev),
- B_CONTROLLER(bootdev), B_UNIT(bootdev),
- B_PARTITION(bootdev));
- bootdev = 0; /* invalidate bootdev */
- } else {
- printf("boot device: %s\n", bootdv->dv_xname);
- }
- }
- cold = 0;
-}
-
-void
-diskconf(void)
-{
- int bootpartition = 0;
-
- /*
- * If bootdev is bogus, ask the user anyhow.
- */
- if (bootdev == 0)
- boothowto |= RB_ASKNAME;
- else
- bootpartition = B_PARTITION(bootdev);
-
- /*
- * If we booted from tape, ask the user.
- */
- if (bootdv != NULL && bootdv->dv_class == DV_TAPE)
- boothowto |= RB_ASKNAME;
-
- setroot(bootdv, bootpartition, RB_USERREQ);
- dumpconf();
-
- /*
- * Set bootdev based on the device we booted from.
- * This is given to the boot program when we reboot.
- */
- setbootdev();
-}
-
-/**********************************************************************
- * Code to find and set the boot device
- **********************************************************************/
-
-static int
-device_match(struct device *dv, const char *template)
-{
- return strcmp(dv->dv_cfdata->cf_driver->cd_name, template);
-}
-
-/*
- * Register a device. We're passed the device and the arguments
- * used to attach it. This is used to find the boot device.
- */
-void
-device_register(dev, aux)
- struct device *dev;
- void *aux;
-{
- struct dev_data *dd;
- static int seen_netdevice = 0;
-
- /*
- * Allocate a dev_data structure and fill it in.
- * This means making some tests twice, but we don't
- * care; this doesn't really have to be fast.
- *
- * Note that we only really care about devices that
- * we can mount as root.
- */
- dd = (struct dev_data *)malloc(sizeof(struct dev_data),
- M_DEVBUF, M_NOWAIT | M_ZERO);
- if (dd == NULL)
- panic("device_register: can't allocate dev_data");
-
- dd->dd_dev = dev;
-
- /*
- * BOOTROM and boot program can really only understand
- * using the lowest select code network interface,
- * so we ignore all but the first.
- */
- if (dev->dv_class == DV_IFNET && seen_netdevice == 0) {
- struct dio_attach_args *da = aux;
-
- seen_netdevice = 1;
- dd->dd_scode = da->da_scode;
- goto linkup;
- }
-
- if (device_match(dev, "fhpib") == 0 ||
- device_match(dev, "nhpib") == 0 ||
- device_match(dev, "spc") == 0) {
- struct dio_attach_args *da = aux;
-
- dd->dd_scode = da->da_scode;
- goto linkup;
- }
-
- if (device_match(dev, "hd") == 0) {
- struct hpibbus_attach_args *ha = aux;
-
- dd->dd_slave = ha->ha_slave;
- dd->dd_punit = ha->ha_punit;
- goto linkup;
- }
-
- if (device_match(dev, "cd") == 0 ||
- device_match(dev, "sd") == 0 ||
- device_match(dev, "st") == 0) {
- struct scsi_attach_args *sa = aux;
-
- dd->dd_slave = sa->sa_sc_link->target;
- dd->dd_punit = sa->sa_sc_link->lun;
- goto linkup;
- }
-
- /*
- * Didn't need the dev_data.
- */
- free(dd, M_DEVBUF);
- return;
-
- linkup:
- LIST_INSERT_HEAD(&dev_data_list, dd, dd_list);
-
- if (device_match(dev, "fhpib") == 0 ||
- device_match(dev, "nhpib") == 0) {
- dev_data_insert(dd, &dev_data_list_hpib);
- return;
- }
-
- if (device_match(dev, "spc") == 0) {
- dev_data_insert(dd, &dev_data_list_scsi);
- return;
- }
-}
-
-void
-findbootdev()
-{
- int type, ctlr, slave, punit;
- int scsiboot, hpibboot, netboot;
- struct dev_data *dd;
-
- bootdv = NULL;
-
- if ((bootdev & B_MAGICMASK) != B_DEVMAGIC)
- return;
-
- type = B_TYPE(bootdev);
- ctlr = B_ADAPTOR(bootdev);
- slave = B_CONTROLLER(bootdev);
- punit = B_UNIT(bootdev);
-
- scsiboot = (type == 4); /* sd major */
- hpibboot = (type == 0 || type == 2); /* ct/hd major */
- netboot = (type == 6); /* le - special */
-
- /*
- * Check for network boot first, since it's a little
- * different. The BOOTROM/boot program can only boot
- * off of the first (lowest select code) ethernet
- * device. device_register() knows this and only
- * registers one DV_IFNET. This is a safe assumption
- * since the code that finds devices on the DIO bus
- * always starts at scode 0 and works its way up.
- */
- if (netboot) {
- LIST_FOREACH(dd, &dev_data_list, dd_list) {
- if (dd->dd_dev->dv_class == DV_IFNET) {
- /*
- * Found it!
- */
- bootdv = dd->dd_dev;
- break;
- }
- }
- return;
- }
-
- /*
- * Check for HP-IB boots next.
- */
- if (hpibboot) {
- findbootdev_slave(&dev_data_list_hpib, ctlr,
- slave, punit);
- if (bootdv == NULL)
- return;
-
-#ifdef DIAGNOSTIC
- /*
- * Sanity check.
- */
- if ((type == 0 &&
- device_match(bootdv, "ct")) ||
- (type == 2 &&
- device_match(bootdv, "hd"))) {
- printf("WARNING: boot device/type mismatch!\n");
- printf("device = %s, type = %d\n",
- bootdv->dv_xname, type);
- bootdv = NULL;
- }
-#endif
- return;
- }
-
- /*
- * Check for SCSI boots last.
- */
- if (scsiboot) {
- findbootdev_slave(&dev_data_list_scsi, ctlr,
- slave, punit);
- if (bootdv == NULL)
- return;
-
-#ifdef DIAGNOSTIC
- /*
- * Sanity check.
- */
- if (device_match(bootdv, "cd") != 0 &&
- device_match(bootdv, "sd") != 0 &&
- device_match(bootdv, "st") != 0) {
- printf("WARNING: boot device/type mismatch!\n");
- printf("device = %s, type = %d\n",
- bootdv->dv_xname, type);
- bootdv = NULL;
- }
-#endif
- return;
- }
-
- /* Oof! */
- printf("WARNING: UNKNOWN BOOT DEVICE TYPE = %d\n", type);
-}
-
-void
-findbootdev_slave(ddlist, ctlr, slave, punit)
- ddlist_t *ddlist;
- int ctlr, slave, punit;
-{
- struct dev_data *cdd, *dd;
-
- /*
- * Find the booted controller.
- */
- for (cdd = LIST_FIRST(ddlist); ctlr != 0 && cdd != LIST_END(ddlist);
- cdd = LIST_NEXT(cdd, dd_clist))
- ctlr--;
- if (cdd == NULL) {
- /*
- * Oof, couldn't find it...
- */
- return;
- }
-
- /*
- * Now find the device with the right slave/punit
- * that's a child of the controller.
- */
- LIST_FOREACH(dd, &dev_data_list, dd_list) {
- /*
- * "sd" / "st" / "cd" -> "scsibus" -> "spc"
- * "hd" -> "hpibbus" -> "fhpib"
- */
- if (dd->dd_dev->dv_parent->dv_parent != cdd->dd_dev)
- continue;
-
- if (dd->dd_slave == slave &&
- dd->dd_punit == punit) {
- /*
- * Found it!
- */
- bootdv = dd->dd_dev;
- break;
- }
- }
-}
-
-void
-setbootdev()
-{
- struct dev_data *cdd, *dd;
- int type, ctlr;
-
- /*
- * Note our magic numbers for type:
- *
- * 0 == ct
- * 2 == hd
- * 4 == scsi
- * 6 == le
- *
- * All are bdevsw major numbers, except for le, which
- * is just special. SCSI needs specific care since the
- * ROM wants to see 4, but depending upon the real device
- * we booted from, we might have a different major value.
- */
-
- /*
- * Start with a clean slate.
- */
- bootdev = 0;
-
- /*
- * If we don't have a saveable root_device, just punt.
- */
- if (root_device == NULL)
- goto out;
-
- dd = dev_data_lookup(root_device);
-
- /*
- * If the root device is network, we're done
- * early.
- */
- if (root_device->dv_class == DV_IFNET) {
- bootdev = MAKEBOOTDEV(6, 0, 0, 0, 0);
- goto out;
- }
-
- /*
- * Determine device type.
- */
- if (device_match(root_device, "hd") == 0)
- type = 2;
- else if (device_match(root_device, "cd") == 0 ||
- device_match(root_device, "sd") == 0 ||
- device_match(root_device, "st") == 0)
- /* force scsi disk regardless of the actual device */
- type = 4;
- else {
- printf("WARNING: strange root device!\n");
- goto out;
- }
-
- /*
- * Get parent's info.
- *
- * "hd" -> "hpibbus" -> "fhpib"
- * "sd" / "cd" / "st" -> "scsibus" -> "spc"
- */
- for (cdd = LIST_FIRST(&dev_data_list_hpib), ctlr = 0;
- cdd != LIST_END(&dev_data_list_hpib);
- cdd = LIST_NEXT(cdd, dd_clist), ctlr++) {
- if (cdd->dd_dev == root_device->dv_parent->dv_parent) {
- /*
- * Found it!
- */
- bootdev = MAKEBOOTDEV(type, ctlr, dd->dd_slave,
- dd->dd_punit, DISKPART(rootdev));
- break;
- }
- }
-
- out:
- /* Don't need this anymore. */
- for (dd = LIST_FIRST(&dev_data_list);
- dd != LIST_END(&dev_data_list); ) {
- cdd = dd;
- dd = LIST_NEXT(dd, dd_list);
- free(cdd, M_DEVBUF);
- }
-}
-
-/*
- * Return the dev_data corresponding to the given device.
- */
-static struct dev_data *
-dev_data_lookup(dev)
- struct device *dev;
-{
- struct dev_data *dd;
-
- LIST_FOREACH(dd, &dev_data_list, dd_list)
- if (dd->dd_dev == dev)
- return (dd);
-
- panic("dev_data_lookup");
-}
-
-/*
- * Insert a dev_data into the provided list, sorted by select code.
- */
-static void
-dev_data_insert(dd, ddlist)
- struct dev_data *dd;
- ddlist_t *ddlist;
-{
- struct dev_data *de;
-
-#ifdef DIAGNOSTIC
- if (dd->dd_scode < 0 || dd->dd_scode > 255) {
- panic("bogus select code for %s", dd->dd_dev->dv_xname);
- }
-#endif
-
- /*
- * Just insert at head if list is empty.
- */
- if (LIST_EMPTY(ddlist)) {
- LIST_INSERT_HEAD(ddlist, dd, dd_clist);
- return;
- }
-
- /*
- * Traverse the list looking for a device who's select code
- * is greater than ours. When we find it, insert ourselves
- * into the list before it.
- */
- for (de = LIST_FIRST(ddlist);
- LIST_NEXT(de, dd_clist) != LIST_END(ddlist);
- de = LIST_NEXT(de, dd_clist)) {
- if (de->dd_scode > dd->dd_scode) {
- LIST_INSERT_BEFORE(de, dd, dd_clist);
- return;
- }
- }
-
- /*
- * Our select code is greater than everyone else's. We go
- * onto the end.
- */
- LIST_INSERT_AFTER(de, dd, dd_clist);
-}
-
-/**********************************************************************
- * Code to find and initialize the console
- **********************************************************************/
-
-/*
- * Scan all select codes, passing the corresponding VA to (*func)().
- * (*func)() is a driver-specific routine that looks for the console
- * hardware.
- */
-void
-console_scan(func, arg)
- int (*func)(int, caddr_t, void *);
- void *arg;
-{
- int size, scode, sctop, sctmp;
- caddr_t pa, va;
-
- /*
- * Scan all select codes. Check each location for some
- * hardware. If there's something there, call (*func)().
- */
- sctop = DIO_SCMAX(machineid);
- for (scode = 0; scode < sctop; scode++) {
- /*
- * Skip over the select code hole and
- * the internal HP-IB controller.
- */
- if ((sctmp = dio_inhole(scode)) != 0) {
- scode = sctmp - 1;
- continue;
- }
- if (scode == 7 && internalhpib)
- continue;
-
- /* Map current PA. */
- pa = dio_scodetopa(scode);
- va = iomap(pa, PAGE_SIZE);
- if (va == NULL)
- continue;
-
- /* Check to see if hardware exists. */
- if (badaddr(va)) {
- iounmap(va, PAGE_SIZE);
- continue;
- }
-
- /*
- * Hardware present, call callback. Driver returns
- * size of region to map if console probe successful
- * and worthwhile.
- */
- size = (*func)(scode, va, arg);
- iounmap(va, PAGE_SIZE);
- if (size != 0 && conscode == scode) {
- /* Free last mapping. */
- if (convasize)
- iounmap(conaddr, convasize);
- convasize = 0;
-
- /* Remap to correct size. */
- va = iomap(pa, size);
- if (va == NULL)
- continue;
-
- /* Save this state for next time. */
- conaddr = va;
- convasize = size;
- }
- }
-}
-
-int consolepass = -1;
-struct consdev *cn_tab;
-
-/*
- * Special version of cninit(). Actually, crippled somewhat.
- * This version lets the drivers assign cn_tab.
- */
-void
-hp300_cninit(void)
-{
- struct consdev *cp;
- extern struct consdev constab[];
-
- if (++consolepass == 0) {
- cn_tab = NULL;
-
- /*
- * Call all of the console probe functions.
- */
- for (cp = constab; cp->cn_probe; cp++)
- (*cp->cn_probe)(cp);
- }
-
- /*
- * No console, we can handle it.
- */
- if (cn_tab == NULL)
- return;
-
- /*
- * Turn on the console.
- *
- * Note that we need to check for cn_init because DIO frame buffers
- * will cause cn_tab to switch to wsdisplaycons, which does not
- * have an cn_init function.
- */
- if (cn_tab->cn_init != NULL) {
- (*cn_tab->cn_init)(cn_tab);
- }
-}
-
-/**********************************************************************
- * Mapping functions
- **********************************************************************/
-
-/*
- * Allocate/deallocate a cache-inhibited range of kernel virtual address
- * space mapping the indicated physical address range [pa - pa+size)
- */
-caddr_t
-iomap(pa, size)
- caddr_t pa;
- int size;
-{
- vaddr_t iova, tva, off;
- paddr_t ppa;
- int error;
-
- if (size <= 0)
- return NULL;
-
- ppa = trunc_page((paddr_t)pa);
- off = (paddr_t)pa & PAGE_MASK;
- size = round_page(off + size);
-
- error = extent_alloc(extio, size, PAGE_SIZE, 0, EX_NOBOUNDARY,
- EX_NOWAIT | EX_MALLOCOK, &iova);
-
- if (error != 0)
- return (NULL);
-
- tva = iova;
- while (size != 0) {
- pmap_kenter_cache(tva, ppa, PG_RW | PG_CI);
- size -= PAGE_SIZE;
- tva += PAGE_SIZE;
- ppa += PAGE_SIZE;
- }
- pmap_update(pmap_kernel());
- return ((void *)(iova + off));
-}
-
-/*
- * Unmap a previously mapped device.
- */
-void
-iounmap(va, size)
- caddr_t va;
- int size;
-{
- vaddr_t kva, off;
- int error;
-
- off = (vaddr_t)va & PAGE_MASK;
- kva = trunc_page((vaddr_t)va);
- size = round_page(off + size);
-
- pmap_kremove(kva, size);
- pmap_update(pmap_kernel());
-
- error = extent_free(extio, kva, size, EX_NOWAIT);
-#ifdef DIAGNOSTIC
- if (error != 0)
- printf("iounmap: extent_free failed\n");
-#endif
-}
-
-struct nam2blk nam2blk[] = {
- { "ct", 0 },
- { "hd", 2 },
- { "sd", 4 },
- { "st", 7 },
- { "rd", 8 },
- { "cd", 9 },
- { "vnd", 6 },
- { NULL, -1 }
-};
diff --git a/sys/arch/hp300/hp300/bus_space.c b/sys/arch/hp300/hp300/bus_space.c
deleted file mode 100644
index 194194d175d..00000000000
--- a/sys/arch/hp300/hp300/bus_space.c
+++ /dev/null
@@ -1,714 +0,0 @@
-/* $OpenBSD: bus_space.c,v 1.8 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: bus_space.c,v 1.6 2002/09/27 15:36:02 provos Exp $ */
-
-/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Implementation of bus_space mapping for the hp300.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/extent.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-
-#include <uvm/uvm_extern.h>
-
-#ifdef DIAGNOSTIC
-extern char *extiobase;
-#endif
-extern struct extent *extio;
-
-/*
- * Memory mapped devices (intio, dio and sgc)
- */
-
-int hp300_mem_map(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
-void hp300_mem_unmap(bus_space_handle_t, bus_size_t);
-int hp300_mem_subregion(bus_space_handle_t, bus_size_t, bus_size_t,
- bus_space_handle_t *);
-void * hp300_mem_vaddr(bus_space_handle_t);
-
-u_int8_t hp300_mem_bsr1(bus_space_handle_t, bus_size_t);
-u_int16_t hp300_mem_bsr2(bus_space_handle_t, bus_size_t);
-u_int32_t hp300_mem_bsr4(bus_space_handle_t, bus_size_t);
-void hp300_mem_bsrm1(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_mem_bsrm2(bus_space_handle_t, bus_size_t, u_int16_t *, size_t);
-void hp300_mem_bsrm4(bus_space_handle_t, bus_size_t, u_int32_t *, size_t);
-void hp300_mem_bsrrm2(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_mem_bsrrm4(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_mem_bsrr1(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_mem_bsrr2(bus_space_handle_t, bus_size_t, u_int16_t *, size_t);
-void hp300_mem_bsrr4(bus_space_handle_t, bus_size_t, u_int32_t *, size_t);
-void hp300_mem_bsrrr2(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_mem_bsrrr4(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_mem_bsw1(bus_space_handle_t, bus_size_t, u_int8_t);
-void hp300_mem_bsw2(bus_space_handle_t, bus_size_t, u_int16_t);
-void hp300_mem_bsw4(bus_space_handle_t, bus_size_t, u_int32_t);
-void hp300_mem_bswm1(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_mem_bswm2(bus_space_handle_t, bus_size_t, const u_int16_t *, size_t);
-void hp300_mem_bswm4(bus_space_handle_t, bus_size_t, const u_int32_t *, size_t);
-void hp300_mem_bswrm2(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_mem_bswrm4(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_mem_bswr1(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_mem_bswr2(bus_space_handle_t, bus_size_t, const u_int16_t *, size_t);
-void hp300_mem_bswr4(bus_space_handle_t, bus_size_t, const u_int32_t *, size_t);
-void hp300_mem_bswrr2(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_mem_bswrr4(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_mem_bssm1(bus_space_handle_t, bus_size_t, u_int8_t, size_t);
-void hp300_mem_bssm2(bus_space_handle_t, bus_size_t, u_int16_t, size_t);
-void hp300_mem_bssm4(bus_space_handle_t, bus_size_t, u_int32_t, size_t);
-void hp300_mem_bssr1(bus_space_handle_t, bus_size_t, u_int8_t, size_t);
-void hp300_mem_bssr2(bus_space_handle_t, bus_size_t, u_int16_t, size_t);
-void hp300_mem_bssr4(bus_space_handle_t, bus_size_t, u_int32_t, size_t);
-
-struct hp300_bus_space_tag hp300_mem_tag = {
- hp300_mem_map,
- hp300_mem_unmap,
- hp300_mem_subregion,
- hp300_mem_vaddr,
-
- hp300_mem_bsr1,
- hp300_mem_bsr2,
- hp300_mem_bsr4,
- hp300_mem_bsrm1,
- hp300_mem_bsrm2,
- hp300_mem_bsrm4,
- hp300_mem_bsrrm2,
- hp300_mem_bsrrm4,
- hp300_mem_bsrr1,
- hp300_mem_bsrr2,
- hp300_mem_bsrr4,
- hp300_mem_bsrrr2,
- hp300_mem_bsrrr4,
- hp300_mem_bsw1,
- hp300_mem_bsw2,
- hp300_mem_bsw4,
- hp300_mem_bswm1,
- hp300_mem_bswm2,
- hp300_mem_bswm4,
- hp300_mem_bswrm2,
- hp300_mem_bswrm4,
- hp300_mem_bswr1,
- hp300_mem_bswr2,
- hp300_mem_bswr4,
- hp300_mem_bswrr2,
- hp300_mem_bswrr4,
- hp300_mem_bssm1,
- hp300_mem_bssm2,
- hp300_mem_bssm4,
- hp300_mem_bssr1,
- hp300_mem_bssr2,
- hp300_mem_bssr4
-};
-
-int
-hp300_mem_map(bus_addr_t bpa, bus_size_t size, int flags,
- bus_space_handle_t *bshp)
-{
- u_long kva;
- pt_entry_t template;
- int error;
-
- /*
- * intio space is direct-mapped in pmap_bootstrap(); just do the
- * translation in this case.
- */
- if (bpa >= INTIOBASE && bpa < INTIOTOP) {
- *bshp = IIOV(bpa);
- return (0);
- }
-
- /*
- * Allocate virtual address space from the extio extent map.
- */
- size = round_page(bpa + size) - trunc_page(bpa);
- error = extent_alloc(extio, size, PAGE_SIZE, 0, EX_NOBOUNDARY,
- EX_NOWAIT | EX_MALLOCOK, &kva);
- if (error)
- return (error);
-
- *bshp = (bus_space_handle_t)kva + (bpa & PAGE_MASK);
- bpa = trunc_page(bpa);
-
- /*
- * Map the range.
- */
- if (flags & BUS_SPACE_MAP_CACHEABLE)
- template = PG_RW;
- else
- template = PG_RW | PG_CI;
- while (size != 0) {
- pmap_kenter_cache(kva, bpa, template);
- size -= PAGE_SIZE;
- kva += PAGE_SIZE;
- bpa += PAGE_SIZE;
- }
- pmap_update(pmap_kernel());
-
- /*
- * All done.
- */
- return (0);
-}
-
-void
-hp300_mem_unmap(bus_space_handle_t bsh, bus_size_t size)
-{
-#ifdef DIAGNOSTIC
- extern int eiomapsize;
-#endif
- int error;
-
- /*
- * intio space is direct-mapped in pmap_bootstrap(); nothing
- * to do.
- */
- if (IIOP(bsh) >= INTIOBASE && IIOP(bsh) < INTIOTOP)
- return;
-
-#ifdef DIAGNOSTIC
- if ((caddr_t)bsh < extiobase ||
- (caddr_t)bsh >= extiobase + ptoa(eiomapsize)) {
- printf("bus_space_unmap: bad bus space handle %x\n", bsh);
- return;
- }
-#endif
-
- size = round_page(bsh + size) - trunc_page(bsh);
- bsh = trunc_page(bsh);
-
- /*
- * Unmap the range.
- */
- pmap_kremove(bsh, size);
- pmap_update(pmap_kernel());
-
- /*
- * Free it from the extio extent map.
- */
- error = extent_free(extio, (u_long)bsh, size, EX_NOWAIT | EX_MALLOCOK);
-#ifdef DIAGNOSTIC
- if (error != 0) {
- printf("bus_space_unmap: kva 0x%lx size 0x%lx: "
- "can't free region (%d)\n", (vaddr_t)bsh, size, error);
- }
-#endif
-}
-
-/* ARGSUSED */
-int
-hp300_mem_subregion(bus_space_handle_t bsh, bus_size_t offset, bus_size_t size,
- bus_space_handle_t *nbshp)
-{
- *nbshp = bsh + offset;
- return (0);
-}
-
-#if 0
-/* ARGSUSED */
-paddr_t
-hp300_mem_mmap(bus_addr_t addr, off_t offset, int prot, int flags)
-{
- return (((paddr_t)addr + offset) >> PAGE_SHIFT);
-}
-#endif
-
-void *
-hp300_mem_vaddr(bus_space_handle_t h)
-{
- return ((void *)h);
-}
-
-u_int8_t
-hp300_mem_bsr1(bus_space_handle_t bsh, bus_size_t offset)
-{
- return (*(volatile u_int8_t *) (bsh + offset));
-}
-
-u_int16_t
-hp300_mem_bsr2(bus_space_handle_t bsh, bus_size_t offset)
-{
- return (*(volatile u_int16_t *) (bsh + offset));
-}
-
-u_int32_t
-hp300_mem_bsr4(bus_space_handle_t bsh, bus_size_t offset)
-{
- return (*(volatile u_int32_t *) (bsh + offset));
-}
-
-void
-hp300_mem_bsrm1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movb %%a0@,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrm2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a0@,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrm4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a0@,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrrm2(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a0@,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrrm4(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a0@,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrr1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movb %%a0@+,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrr2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a0@+,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrr4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a0@+,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrrr2(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a0@+,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c / 2) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrrr4(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a0@+,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c / 4) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsw1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t v)
-{
- (*(volatile u_int8_t *)(h + offset)) = v;
-}
-
-void
-hp300_mem_bsw2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t v)
-{
- (*(volatile u_int16_t *)(h + offset)) = v;
-}
-
-void
-hp300_mem_bsw4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t v)
-{
- (*(volatile u_int32_t *)(h + offset)) = v;
-}
-
-void
-hp300_mem_bswm1(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movb %%a1@+,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswm2(bus_space_handle_t h, bus_size_t offset,
- const u_int16_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a1@+,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswm4(bus_space_handle_t h, bus_size_t offset,
- const u_int32_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a1@+,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswrm2(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a1@+,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswrm4(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a1@+,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswr1(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movb %%a1@+,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswr2(bus_space_handle_t h, bus_size_t offset,
- const u_int16_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a1@+,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswr4(bus_space_handle_t h, bus_size_t offset,
- const u_int32_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a1@+,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswrr2(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a1@+,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c / 2) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswrr4(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a1@+,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c / 4) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bssm1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t v, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%d1 ;"
- " movl %2,%%d0 ;"
- "1: movb %%d1,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" ((u_long)v), "g" (c) :
- "a0","d0","d1");
-}
-
-void
-hp300_mem_bssm2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t v, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%d1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%d1,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" ((u_long)v), "g" (c) :
- "a0","d0","d1");
-}
-
-void
-hp300_mem_bssm4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t v, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%d1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%d1,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" ((u_long)v), "g" (c) :
- "a0","d0","d1");
-}
-
-void
-hp300_mem_bssr1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t v, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%d1 ;"
- " movl %2,%%d0 ;"
- "1: movb %%d1,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" ((u_long)v), "g" (c) :
- "a0","d0","d1");
-}
-
-void
-hp300_mem_bssr2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t v, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%d1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%d1,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" ((u_long)v), "g" (c) :
- "a0","d0","d1");
-}
-
-void
-hp300_mem_bssr4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t v, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%d1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%d1,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" ((u_long)v), "g" (c) :
- "a0","d0","d1");
-}
-
-#if 0
-paddr_t
-bus_space_mmap(bus_space_tag_t t, bus_addr_t addr, off_t offset, int prot,
- int flags)
-{
- return ((paddr_t)addr + offset);
-}
-#endif
diff --git a/sys/arch/hp300/hp300/clock.c b/sys/arch/hp300/hp300/clock.c
deleted file mode 100644
index 559d2e89090..00000000000
--- a/sys/arch/hp300/hp300/clock.c
+++ /dev/null
@@ -1,628 +0,0 @@
-/* $OpenBSD: clock.c,v 1.15 2012/09/08 19:24:28 miod Exp $ */
-/* $NetBSD: clock.c,v 1.20 1997/04/27 20:43:38 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: clock.c 1.18 91/01/21$
- *
- * @(#)clock.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * HPs use the MC6840 PTM with the following arrangement:
- * Timers 1 and 3 are externally driver from a 25MHz source.
- * Output from timer 3 is tied to the input of timer 2.
- * The latter makes it possible to use timers 3 and 2 together to get
- * a 32-bit countdown timer.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/evcount.h>
-#include <sys/timetc.h>
-
-#include <machine/psl.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-
-#include <dev/hil/hilreg.h> /* for BBC */
-#include <hp300/hp300/clockreg.h>
-
-#ifdef GPROF
-#include <sys/gmon.h>
-#endif
-
-int clkstd[1];
-int clkint; /* clock interval, as loaded */
-uint32_t clkcounter; /* for timecounter */
-
-/*
- * Statistics clock interval and variance, in usec. Variance must be a
- * power of two. Since this gives us an even number, not an odd number,
- * we discard one case and compensate. That is, a variance of 1024 would
- * give us offsets in [0..1023]. Instead, we take offsets in [1..1023].
- * This is symmetric about the point 512, or statvar/2, and thus averages
- * to that value (assuming uniform random numbers).
- */
-static int statvar = 1024 / 4; /* {stat,prof}clock variance */
-static int statmin; /* statclock interval - variance/2 */
-static int profmin; /* profclock interval - variance/2 */
-static int timer3min; /* current, from above choices */
-static int statprev; /* previous value in stat timer */
-
-static int month_days[12] = {
- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-u_char bbc_registers[13];
-volatile u_int8_t *bbcaddr = NULL;
-
-void clockintr(struct clockframe *);
-void statintr(struct clockframe *);
-u_int mc6840_counter(struct timecounter *);
-
-void hp300_calibrate_delay(void);
-struct bbc_tm *gmt_to_bbc(long);
-int bbc_to_gmt(u_long *);
-void read_bbc(void);
-u_char read_bbc_reg(int);
-void send_clock_cmd(volatile u_int8_t *, u_int8_t, u_int8_t *,
- u_int8_t, u_int8_t *);
-u_char write_bbc_reg(int, u_int);
-
-static int clock_ipl = IPL_CLOCK;
-static int stat_ipl = IPL_STATCLOCK;
-struct evcount clockcnt;
-struct evcount statcnt;
-
-/*
- * Machine-dependent clock routines.
- *
- * A note on the real-time clock:
- * We actually load the clock with interval-1 instead of interval.
- * This is because the counter decrements to zero after N+1 enabled clock
- * periods where N is the value loaded into the counter.
- *
- * The frequencies of the HP300 clocks must be a multiple of four
- * microseconds (since the clock counts in 4 us units).
- */
-#define COUNTS_PER_SEC (1000000 / CLK_RESOLUTION)
-
-struct timecounter mc6840_tc = {
- mc6840_counter, NULL, ~0, COUNTS_PER_SEC, "mc6840", 100, NULL
-};
-
-/*
- * Calibrate the delay constant, based on Chuck Cranor's
- * mvme68k delay calibration algorithm.
- */
-void
-hp300_calibrate_delay()
-{
- extern int delay_divisor;
- volatile struct clkreg *clk;
- volatile u_char csr;
- int intvl;
-
- clkstd[0] = IIOV(0x5F8000); /* XXX yuck */
- clk = (volatile struct clkreg *)clkstd[0];
-
- /*
- * Calibrate delay() using the 4 usec counter.
- * We adjust delay_divisor until we get the result we want.
- * We assume we've been called at splhigh().
- */
- for (delay_divisor = 140; delay_divisor > 1; delay_divisor--) {
- /* Reset clock chip */
- clk->clk_cr2 = CLK_CR1;
- clk->clk_cr1 = CLK_RESET;
-
- /*
- * Prime the timer. We're looking for
- * 10,000 usec (10ms). See interval comment
- * above.
- */
- intvl = (10000 / CLK_RESOLUTION) - 1;
- asm volatile(" movpw %0,%1@(5)" : : "d" (intvl), "a" (clk));
-
- /* Enable the timer */
- clk->clk_cr2 = CLK_CR1;
- clk->clk_cr1 = CLK_IENAB;
-
- delay(10000);
-
- /* Timer1 interrupt flag high? */
- csr = clk->clk_sr;
- if (csr & CLK_INT1) {
- /*
- * Got it. Clear interrupt and get outta here.
- */
- asm volatile(" movpw %0@(5),%1" : :
- "a" (clk), "d" (intvl));
- break;
- }
-
- /*
- * Nope. Poll for completion of the interval,
- * clear interrupt, and try again.
- */
- do {
- csr = clk->clk_sr;
- } while ((csr & CLK_INT1) == 0);
-
- asm volatile(" movpw %0@(5),%1" : : "a" (clk), "d" (intvl));
- }
-
- /*
- * Make sure the clock interrupt is disabled. Otherwise,
- * we can end up calling hardclock() before proc0 is set up,
- * causing a bad pointer deref.
- */
- clk->clk_cr2 = CLK_CR1;
- clk->clk_cr1 = CLK_RESET;
-
- /*
- * Sanity check the delay_divisor value. If we totally lost,
- * assume a 50MHz CPU;
- */
- if (delay_divisor == 0)
- delay_divisor = 2048 / 50;
-
- /* Calculate CPU speed. */
- cpuspeed = 2048 / delay_divisor;
-}
-
-/*
- * Set up the real-time and statistics clocks. Leave stathz 0 only if
- * no alternative timer is available.
- */
-void
-cpu_initclocks()
-{
- volatile struct clkreg *clk;
- int intvl, statint, profint, minint;
-
- clkstd[0] = IIOV(0x5F8000); /* XXX grot */
- clk = (volatile struct clkreg *)clkstd[0];
-
- if (COUNTS_PER_SEC % hz) {
- printf("cannot get %d Hz clock; using 100 Hz\n", hz);
- hz = 100;
- }
- /*
- * Clock has several counters, so we can always use separate
- * statclock.
- */
- if (stathz == 0) /* XXX should be set in param.c */
- stathz = hz;
- else if (COUNTS_PER_SEC % stathz) {
- printf("cannot get %d Hz statclock; using 100 Hz\n", stathz);
- stathz = 100;
- }
- if (profhz == 0) /* XXX should be set in param.c */
- profhz = stathz * 5;
- else if (profhz < stathz || COUNTS_PER_SEC % profhz) {
- printf("cannot get %d Hz profclock; using %d Hz\n",
- profhz, stathz);
- profhz = stathz;
- }
-
- intvl = COUNTS_PER_SEC / hz;
- statint = COUNTS_PER_SEC / stathz;
- profint = COUNTS_PER_SEC / profhz;
- minint = statint / 2 + 100;
- while (statvar > minint)
- statvar >>= 1;
-
- tick = intvl * CLK_RESOLUTION;
-
- /* adjust interval counts, per note above */
- intvl--;
- statint--;
- profint--;
-
- /* calculate base reload values */
- clkint = intvl;
- statmin = statint - (statvar >> 1);
- profmin = profint - (statvar >> 1);
- timer3min = statmin;
- statprev = statint;
-
- evcount_attach(&statcnt, "stat", &stat_ipl);
- evcount_attach(&clockcnt, "clock", &clock_ipl);
-
- /* finally, load hardware */
- clk->clk_cr2 = CLK_CR1;
- clk->clk_cr1 = CLK_RESET;
- asm volatile(" movpw %0,%1@(5)" : : "d" (intvl), "a" (clk));
- asm volatile(" movpw %0,%1@(9)" : : "d" (0), "a" (clk));
- asm volatile(" movpw %0,%1@(13)" : : "d" (statint), "a" (clk));
- clk->clk_cr2 = CLK_CR1;
- clk->clk_cr1 = CLK_IENAB;
- clk->clk_cr2 = CLK_CR3;
- clk->clk_cr3 = CLK_IENAB;
-
- tc_init(&mc6840_tc);
-}
-
-/*
- * We assume newhz is either stathz or profhz, and that neither will
- * change after being set up above. Could recalculate intervals here
- * but that would be a drag.
- */
-void
-setstatclockrate(newhz)
- int newhz;
-{
-
- if (newhz == stathz)
- timer3min = statmin;
- else
- timer3min = profmin;
-}
-
-/*
- * Timer clock interrupt.
- */
-void
-clockintr(fp)
- struct clockframe *fp;
-{
- clockcnt.ec_count++;
- hardclock(fp);
-}
-
-/*
- * Statistics/profiling clock interrupt. Compute a new interval.
- * Interrupt has already been cleared.
- */
-void
-statintr(fp)
- struct clockframe *fp;
-{
- volatile struct clkreg *clk;
- int newint, r, var;
-
- clk = (volatile struct clkreg *)clkstd[0];
- var = statvar;
- do {
- r = random() & (var - 1);
- } while (r == 0);
- newint = timer3min + r;
-
- /*
- * The timer was automatically reloaded with the previous latch
- * value at the time of the interrupt. Compensate now for the
- * amount of time that has run off since then (minimum of 2-12
- * timer ticks depending on CPU type) plus one tick roundoff.
- * This should keep us closer to the mean.
- */
- asm volatile(" clrl %0; movpw %1@(13),%0" : "=d" (r) : "a" (clk));
- newint -= (statprev - r + 1);
-
- asm volatile(" movpw %0,%1@(13)" : : "d" (newint), "a" (clk));
- statprev = newint;
- statcnt.ec_count++;
- statclock(fp);
-}
-
-u_int
-mc6840_counter(struct timecounter *tc)
-{
- volatile struct clkreg *clk;
- uint32_t ccounter, count;
- static uint32_t lastcount;
- int s;
-
- clk = (volatile struct clkreg *)clkstd[0];
-
- s = splclock();
- ccounter = clkcounter;
- /* XXX reading counter clears interrupt flag?? */
- __asm__ __volatile__
- ("clrl %0; movpw %1@(5),%0" : "=d" (count) : "a" (clk));
- splx(s);
-
- count = ccounter + (clkint - count);
- if ((int32_t)(count - lastcount) < 0) {
- /* XXX wrapped; maybe hardclock() is blocked more than 1/hz */
- count = lastcount + 1;
- }
- lastcount = count;
-
- return count;
-}
-
-/*
- * Initialize the time of day register, based on the time base which is, e.g.
- * from a filesystem.
- */
-void
-inittodr(base)
- time_t base;
-{
- u_long timbuf = base; /* assume no battery clock exists */
- static int bbcinited = 0;
- int badbase = 0, waszero = base == 0;
- struct timespec ts;
-
- if (base < (2012 - 1970) * SECYR) {
- /*
- * If base is 0, assume filesystem time is just unknown
- * instead of preposterous. Don't bark.
- */
- if (base != 0)
- printf("WARNING: preposterous time in file system\n");
- /* not going to use it anyway, if the chip is readable */
- base = (2012 - 1970) * SECYR;
- badbase = 1;
- }
-
- /* XXX */
- if (!bbcinited) {
- if (machineid == HP_425 && mmuid == MMUID_425_E)
- bbcaddr = NULL;
- else {
- if (badbaddr((caddr_t)(BBCADDR + HILP_STAT)))
- printf("WARNING: no battery clock\n");
- else
- bbcaddr = BBCADDR;
- }
- bbcinited = 1;
- }
-
- /*
- * bbc_to_gmt converts and stores the gmt in timbuf.
- * If an error is detected in bbc_to_gmt, or if the filesystem
- * time is more recent than the gmt time in the clock,
- * then use the filesystem time and warn the user.
- */
- if (bbcaddr != NULL) {
- if (!bbc_to_gmt(&timbuf) || timbuf < base) {
- printf("WARNING: bad date in battery clock\n");
- timbuf = base;
- }
- }
-
- if (timbuf != base) {
- int deltat = timbuf - base;
-
- if (deltat < 0)
- deltat = -deltat;
- if (!waszero && deltat >= 2 * SECDAY)
- printf("WARNING: clock %s %d days"
- " -- CHECK AND RESET THE DATE!\n",
- timbuf < base ? "lost" : "gained", deltat / SECDAY);
- }
-
- /* Battery clock does not store usec's, so forget about it. */
- ts.tv_sec = timbuf;
- ts.tv_nsec = 0;
-
- tc_setclock(&ts);
-}
-
-/*
- * Restore the time of day hardware after a time change.
- */
-void
-resettodr()
-{
- int i;
- struct bbc_tm *tmptr;
-
- if (bbcaddr == NULL)
- return;
-
- tmptr = gmt_to_bbc(time_second);
-
- decimal_to_bbc(0, 1, tmptr->tm_sec);
- decimal_to_bbc(2, 3, tmptr->tm_min);
- decimal_to_bbc(4, 5, tmptr->tm_hour);
- decimal_to_bbc(7, 8, tmptr->tm_mday);
- decimal_to_bbc(9, 10, tmptr->tm_mon);
- decimal_to_bbc(11, 12, tmptr->tm_year);
-
- /* Some bogusness to deal with seemingly broken hardware. Nonsense */
- bbc_registers[5] = ((tmptr->tm_hour / 10) & 0x03) + 8;
-
- write_bbc_reg(15, 13); /* reset prescalar */
-
- for (i = 0; i <= NUM_BBC_REGS; i++)
- if (bbc_registers[i] != write_bbc_reg(i, bbc_registers[i])) {
- printf("Cannot set battery backed clock\n");
- break;
- }
-}
-
-struct bbc_tm *
-gmt_to_bbc(tim)
- long tim;
-{
- int i;
- long hms, day;
- static struct bbc_tm rt;
-
- day = tim / SECDAY;
- hms = tim % SECDAY;
-
- /* Hours, minutes, seconds are easy */
- rt.tm_hour = hms / 3600;
- rt.tm_min = (hms % 3600) / 60;
- rt.tm_sec = (hms % 3600) % 60;
-
- /* Number of years in days */
- for (i = STARTOFTIME - 1900; day >= days_in_year(i); i++)
- day -= days_in_year(i);
- rt.tm_year = i;
-
- /* Number of months in days left */
- if (leapyear(rt.tm_year))
- days_in_month(FEBRUARY) = 29;
- for (i = 1; day >= days_in_month(i); i++)
- day -= days_in_month(i);
- days_in_month(FEBRUARY) = 28;
- rt.tm_mon = i;
-
- /* Days are what is left over (+1) from all that. */
- rt.tm_mday = day + 1;
-
- return(&rt);
-}
-
-int
-bbc_to_gmt(timbuf)
- u_long *timbuf;
-{
- int i;
- u_long tmp;
- int year, month, day, hour, min, sec;
-
- read_bbc();
-
- sec = bbc_to_decimal(1, 0);
- min = bbc_to_decimal(3, 2);
-
- /*
- * Hours are different for some reason. Makes no sense really.
- */
- hour = ((bbc_registers[5] & 0x03) * 10) + bbc_registers[4];
- day = bbc_to_decimal(8, 7);
- month = bbc_to_decimal(10, 9);
- year = bbc_to_decimal(12, 11) + 1900;
-
- range_test(hour, 0, 23);
- range_test(day, 1, 31);
- range_test(month, 1, 12);
- range_test(year, STARTOFTIME, 2038); /* 2038 is the end of time. */
-
- tmp = 0;
-
- for (i = STARTOFTIME; i < year; i++)
- tmp += days_in_year(i);
- if (leapyear(year) && month > FEBRUARY)
- tmp++;
-
- for (i = 1; i < month; i++)
- tmp += days_in_month(i);
-
- tmp += (day - 1);
- tmp = ((tmp * 24 + hour) * 60 + min) * 60 + sec;
-
- *timbuf = tmp;
- return(1);
-}
-
-void
-read_bbc()
-{
- int i, read_okay;
-
- read_okay = 0;
- while (!read_okay) {
- read_okay = 1;
- for (i = 0; i <= NUM_BBC_REGS; i++)
- bbc_registers[i] = read_bbc_reg(i);
- for (i = 0; i <= NUM_BBC_REGS; i++)
- if (bbc_registers[i] != read_bbc_reg(i))
- read_okay = 0;
- }
-}
-
-u_char
-read_bbc_reg(reg)
- int reg;
-{
- u_char data = reg;
-
- if (bbcaddr != NULL) {
- send_clock_cmd(bbcaddr, BBC_SET_REG, &data, 1, NULL);
- send_clock_cmd(bbcaddr, BBC_READ_REG, NULL, 0, &data);
- }
- return(data);
-}
-
-u_char
-write_bbc_reg(reg, data)
- int reg;
- u_int data;
-{
- u_char tmp;
-
- tmp = (u_char) ((data << HIL_SSHIFT) | reg);
-
- if (bbcaddr != NULL) {
- send_clock_cmd(bbcaddr, BBC_SET_REG, &tmp, 1, NULL);
- send_clock_cmd(bbcaddr, BBC_WRITE_REG, NULL, 0, NULL);
- send_clock_cmd(bbcaddr, BBC_READ_REG, NULL, 0, &tmp);
- }
- return(tmp);
-}
-
-/*
- * Battery-backed clock command interface.
- * The BBC appears to have an HIL-like command interface, but can not attach
- * as a complete HIL device to an HIL controller driver.
- * The following routine is a simplified command loop.
- */
-void
-send_clock_cmd(volatile u_int8_t *address, u_int8_t cmd, u_int8_t *data,
- u_int8_t dlen, u_int8_t *rdata)
-{
- u_int8_t status;
- int s;
-
- s = splvm();
-
- while ((address[HILP_STAT] & HIL_BUSY) != 0)
- DELAY(1);
- address[HILP_CMD] = cmd;
- while (dlen--) {
- while ((address[HILP_STAT] & HIL_BUSY) != 0)
- DELAY(1);
- address[HILP_DATA] = *data++;
- DELAY(1);
- }
- if (rdata != NULL) {
- do {
- while ((address[HILP_STAT] & HIL_DATA_RDY) == 0)
- DELAY(1);
- status = address[HILP_STAT];
- *rdata = address[HILP_DATA];
- DELAY(1);
- } while (((status >> HIL_SSHIFT) & HIL_SMASK) != HIL_68K);
- }
-
- splx(s);
-}
diff --git a/sys/arch/hp300/hp300/clockreg.h b/sys/arch/hp300/hp300/clockreg.h
deleted file mode 100644
index 9346d67dea0..00000000000
--- a/sys/arch/hp300/hp300/clockreg.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $OpenBSD: clockreg.h,v 1.5 2005/01/14 22:39:27 miod Exp $ */
-/* $NetBSD: clockreg.h,v 1.5 1994/10/26 07:25:26 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: clockreg.h 1.14 91/01/18$
- *
- * @(#)clockreg.h 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * HP300 "real time clock" (MC6840) registers
- */
-
-struct clkreg {
- u_char clk_dummy1;
- u_char clk_cr3;
-#define clk_cr1 clk_cr3
- u_char clk_dummy2;
- u_char clk_cr2;
-#define clk_sr clk_cr2
- u_char clk_dummy3;
- u_char clk_msb1;
- u_char clk_dummy4;
- u_char clk_lsb1;
- u_char clk_dummy5;
- u_char clk_msb2;
- u_char clk_dummy6;
- u_char clk_lsb2;
- u_char clk_dummy7;
- u_char clk_msb3;
- u_char clk_dummy8;
- u_char clk_lsb3;
-};
-
-/* base/offsets for register access (for locore.s) */
-#define CLKBASE IIOPOFF(0x5F8000)
-#define CLKCR1 0x1
-#define CLKCR2 0x3
-#define CLKCR3 CLKCR1
-#define CLKSR CLKCR2
-#define CLKMSB1 0x5
-#define CLKMSB2 0x9
-#define CLKMSB3 0xD
-
-/* output of counter 3 clocks counter 2 */
-
-#define CLK_OENAB 0x80 /* output enable */
-#define CLK_IENAB 0x40 /* interrupt enable */
-#define CLK_8BIT 0x04 /* 8 bit mode */
-#define CLK_RESET 0x01 /* chip reset (CR1 only) */
-#define CLK_CR1 0x01 /* select CR1 (CR2 only) */
-#define CLK_CR3 0x00 /* select CR3 (CR2 only) */
-#define CLK_INT1 0x01 /* interrupt flag for timer 1 (SR only) */
-#define CLK_INT2 0x02 /* interrupt flag for timer 2 (SR only) */
-#define CLK_INT3 0x04 /* interrupt flag for timer 3 (SR only) */
-#define CLK_INTR 0x80 /* composite interrupt flag (SR only) */
-
-#define CLK_RESOLUTION 4 /* 4 usec resolution (250KHz) */
-#define CLK_INTERVAL 2500 /* 10msec interval at 250KHz */
-#ifdef NOTDEF
-#define CLK_INTERVAL 5000 /* 20msec interval at 250KHz */
-#endif
-
-/*
- * HP300 battery-backed clock
- */
-
-#define BBCADDR (u_int8_t *)(IIOV(0x420000))
-
-struct bbc_tm {
- int tm_sec;
- int tm_min;
- int tm_hour;
- int tm_mday;
- int tm_mon;
- int tm_year;
-};
-
-#define FEBRUARY 2
-#define STARTOFTIME 1970
-#define SECDAY 86400L
-#define SECYR (SECDAY * 365)
-
-#define BBC_SET_REG 0xe0
-#define BBC_WRITE_REG 0xc2
-#define BBC_READ_REG 0xc3
-#define NUM_BBC_REGS 12
-
-#define leapyear(year) ((year) % 4 == 0)
-#define range_test(n, l, h) if ((n) < (l) || (n) > (h)) return(0)
-#define days_in_year(a) (leapyear(a) ? 366 : 365)
-#define days_in_month(a) (month_days[(a) - 1])
-#define bbc_to_decimal(a,b) (bbc_registers[a] * 10 + bbc_registers[b])
-#define decimal_to_bbc(a,b,n) { \
- bbc_registers[a] = (n) % 10; \
- bbc_registers[b] = (n) / 10; \
-}
diff --git a/sys/arch/hp300/hp300/conf.c b/sys/arch/hp300/hp300/conf.c
deleted file mode 100644
index 70ead37cdd7..00000000000
--- a/sys/arch/hp300/hp300/conf.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/* $OpenBSD: conf.c,v 1.55 2013/06/03 15:54:47 tedu Exp $ */
-/* $NetBSD: conf.c,v 1.39 1997/05/12 08:17:53 thorpej 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.
- *
- * @(#)conf.c 7.9 (Berkeley) 5/28/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 "cd.h"
-#include "ch.h"
-#include "ct.h"
-bdev_decl(ct);
-#include "mt.h"
-bdev_decl(mt);
-#include "hd.h"
-bdev_decl(hd);
-#include "rd.h"
-#include "sd.h"
-#include "st.h"
-#include "uk.h"
-#include "vnd.h"
-
-struct bdevsw bdevsw[] =
-{
- bdev_tape_init(NCT,ct), /* 0: cs80 cartridge tape */
- bdev_tape_init(NMT,mt), /* 1: magnetic reel tape */
- bdev_disk_init(NHD,hd), /* 2: HPIB disk */
- bdev_swap_init(1,sw), /* 3: swap pseudo-device */
- bdev_disk_init(NSD,sd), /* 4: SCSI disk */
- bdev_notdef(), /* 5: was: concatenated disk driver */
- bdev_disk_init(NVND,vnd), /* 6: vnode disk driver */
- bdev_tape_init(NST,st), /* 7: SCSI tape */
- bdev_disk_init(NRD,rd), /* 8: RAM disk */
- bdev_disk_init(NCD,cd), /* 9: SCSI CD-ROM */
- bdev_lkm_dummy(), /* 10 */
- bdev_lkm_dummy(), /* 11 */
- bdev_lkm_dummy(), /* 12 */
- bdev_lkm_dummy(), /* 13 */
- bdev_lkm_dummy(), /* 14 */
- bdev_lkm_dummy(), /* 15 */
-};
-int nblkdev = nitems(bdevsw);
-
-/* open, close, read, write, ioctl -- XXX should be a generic device */
-#define cdev_ppi_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
- dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \
- 0, (dev_type_poll((*))) enodev, (dev_type_mmap((*))) enodev }
-
-#include "audio.h"
-#include "bio.h"
-#define mmread mmrw
-#define mmwrite mmrw
-cdev_decl(mm);
-#include "pty.h"
-cdev_decl(ct);
-cdev_decl(hd);
-#include "ppi.h"
-cdev_decl(ppi);
-#include "dca.h"
-cdev_decl(dca);
-#include "apci.h"
-cdev_decl(apci);
-#include "dcm.h"
-cdev_decl(dcm);
-cdev_decl(mt);
-cdev_decl(fd);
-#include "bpfilter.h"
-#include "tun.h"
-#include "ksyms.h"
-#include "wsdisplay.h"
-#include "wskbd.h"
-#include "wsmouse.h"
-#include "wsmux.h"
-#include "pf.h"
-#include "systrace.h"
-#include "vscsi.h"
-#include "pppx.h"
-#include "hotplug.h"
-#include "fuse.h"
-
-struct cdevsw cdevsw[] =
-{
- cdev_cn_init(1,cn), /* 0: virtual console */
- cdev_ctty_init(1,ctty), /* 1: controlling terminal */
- cdev_mm_init(1,mm), /* 2: /dev/{null,mem,kmem,...} */
- cdev_notdef(), /* 3 was /dev/drum */
- cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */
- cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */
- cdev_log_init(1,log), /* 6: /dev/klog */
- cdev_tape_init(NCT,ct), /* 7: cs80 cartridge tape */
- cdev_disk_init(NSD,sd), /* 8: SCSI disk */
- cdev_disk_init(NHD,hd), /* 9: HPIB disk */
- cdev_notdef(), /* 10 */
- cdev_ppi_init(NPPI,ppi), /* 11: printer/plotter interface */
- cdev_tty_init(NDCA,dca), /* 12: built-in single-port serial */
- cdev_notdef(), /* 13: was console terminal emulator */
- cdev_notdef(), /* 14: was human interface loop */
- cdev_tty_init(NDCM,dcm), /* 15: 4-port serial */
- cdev_tape_init(NMT,mt), /* 16: magnetic reel tape */
- cdev_notdef(), /* 17: was: concatenated disk */
- cdev_disk_init(NCD,cd), /* 18: SCSI CD-ROM */
- cdev_disk_init(NVND,vnd), /* 19: vnode disk driver */
- cdev_tape_init(NST,st), /* 20: SCSI tape */
- cdev_fd_init(1,filedesc), /* 21: file descriptor pseudo-device */
- cdev_bpf_init(NBPFILTER,bpf), /* 22: Berkeley packet filter */
- cdev_tun_init(NTUN,tun), /* 23: network tunnel */
- cdev_lkm_init(NLKM,lkm), /* 24: loadable module driver */
- cdev_lkm_dummy(), /* 25 */
- cdev_lkm_dummy(), /* 26 */
- cdev_lkm_dummy(), /* 27 */
- cdev_lkm_dummy(), /* 28 */
- cdev_lkm_dummy(), /* 29 */
- cdev_lkm_dummy(), /* 30 */
- cdev_lkm_dummy(), /* 31 */
- cdev_random_init(1,random), /* 32: random generator */
- cdev_pf_init(NPF,pf), /* 33: packet filter */
- cdev_disk_init(NRD,rd), /* 34: RAM disk */
- cdev_tty_init(NAPCI,apci), /* 35: Apollo APCI UARTs */
- cdev_ksyms_init(NKSYMS,ksyms), /* 36: Kernel symbols device */
- cdev_uk_init(NUK,uk), /* 37 */
- cdev_notdef(), /* 38 */
- cdev_ch_init(NCH,ch), /* 39 */
- cdev_wsdisplay_init(NWSDISPLAY,wsdisplay), /* 40: frame buffers */
- cdev_mouse_init(NWSKBD,wskbd), /* 41: keyboards */
- cdev_mouse_init(NWSMOUSE,wsmouse), /* 42: mice */
- cdev_mouse_init(NWSMUX,wsmux), /* 43: ws multiplexor */
- cdev_audio_init(NAUDIO,audio), /* 44: audio */
- cdev_notdef(), /* 45 */
- cdev_notdef(), /* 46 */
- cdev_notdef(), /* 47 */
- cdev_notdef(), /* 48 */
- cdev_bio_init(NBIO,bio), /* 49: ioctl tunnel */
- cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
- cdev_notdef(), /* 51 */
- cdev_ptm_init(NPTY,ptm), /* 52: pseudo-tty ptm device */
- cdev_vscsi_init(NVSCSI,vscsi), /* 53: vscsi */
- cdev_disk_init(1,diskmap), /* 54: disk mapper */
- cdev_pppx_init(NPPPX,pppx), /* 55: pppx */
- cdev_hotplug_init(NHOTPLUG,hotplug), /* 56: devices hot plugging */
- cdev_fuse_init(NFUSE,fuse), /* 57: fuse */
-};
-int nchrdev = nitems(cdevsw);
-
-int mem_no = 2; /* 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(3, 0);
-
-/*
- * Returns true if dev is /dev/mem or /dev/kmem.
- */
-int
-iskmemdev(dev)
- dev_t dev;
-{
-
- return (major(dev) == mem_no && minor(dev) < 2);
-}
-
-/*
- * Returns true if dev is /dev/zero.
- */
-int
-iszerodev(dev)
- dev_t dev;
-{
-
- return (major(dev) == mem_no && minor(dev) == 12);
-}
-
-dev_t
-getnulldev()
-{
- return makedev(mem_no, 2);
-}
-
-int chrtoblktbl[] = {
- /* XXXX This needs to be dynamic for LKMs. */
- /*VCHR*/ /*VBLK*/
- /* 0 */ NODEV,
- /* 1 */ NODEV,
- /* 2 */ NODEV,
- /* 3 */ NODEV,
- /* 4 */ NODEV,
- /* 5 */ NODEV,
- /* 6 */ NODEV,
- /* 7 */ 0, /* ct */
- /* 8 */ 4, /* sd */
- /* 9 */ 2, /* hd */
- /* 10 */ NODEV,
- /* 11 */ NODEV,
- /* 12 */ NODEV,
- /* 13 */ NODEV,
- /* 14 */ NODEV,
- /* 15 */ NODEV,
- /* 16 */ 1, /* mt */
- /* 17 */ NODEV,
- /* 18 */ 9, /* cd */
- /* 19 */ 6, /* vnd */
- /* 20 */ 7, /* st */
- /* 21 */ NODEV,
- /* 22 */ NODEV,
- /* 23 */ NODEV,
- /* 24 */ NODEV,
- /* 25 */ NODEV,
- /* 26 */ NODEV,
- /* 27 */ NODEV,
- /* 28 */ NODEV,
- /* 29 */ NODEV,
- /* 30 */ NODEV,
- /* 31 */ NODEV,
- /* 32 */ NODEV,
- /* 33 */ NODEV,
- /* 34 */ 8, /* rd */
-};
-int nchrtoblktbl = nitems(chrtoblktbl);
-
-/*
- * This entire table could be autoconfig()ed but that would mean that
- * the kernel's idea of the console would be out of sync with that of
- * the standalone boot. I think it best that they both use the same
- * known algorithm unless we see a pressing need otherwise.
- */
-#include <dev/cons.h>
-
-cons_decl(ws);
-
-#define dcacnpollc nullcnpollc
-cons_decl(dca);
-
-#define apcicnpollc nullcnpollc
-cons_decl(apci);
-
-#define dcmcnpollc nullcnpollc
-cons_decl(dcm);
-
-struct consdev constab[] = {
-#if NWSDISPLAY > 0
- cons_init(ws),
-#endif
-#if NDCA > 0
- cons_init(dca),
-#endif
-#if NAPCI > 0
- cons_init(apci),
-#endif
-#if NDCM > 0
- cons_init(dcm),
-#endif
- { 0 },
-};
diff --git a/sys/arch/hp300/hp300/db_memrw.c b/sys/arch/hp300/hp300/db_memrw.c
deleted file mode 100644
index 94946da45a7..00000000000
--- a/sys/arch/hp300/hp300/db_memrw.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/* $OpenBSD: db_memrw.c,v 1.11 2011/11/01 21:20:55 miod Exp $ */
-/* $NetBSD: db_memrw.c,v 1.5 1997/06/10 18:48:47 veego Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Gordon W. Ross and 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 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.
- */
-
-/*
- * Interface to the debugger for virtual memory read/write.
- * This file is shared by DDB and KGDB, and must work even
- * when only KGDB is included (thus no db_printf calls).
- *
- * To write in the text segment, we have to first make
- * the page writable, do the write, then restore the PTE.
- * For writes outside the text segment, and all reads,
- * just do the access -- if it causes a fault, the debugger
- * will recover with a longjmp to an appropriate place.
- *
- * ALERT! If you want to access device registers with a
- * specific size, then the read/write functions have to
- * make sure to do the correct sized pointer access.
- *
- * Modified from sun3 version for hp300 (and probably other m68ks, too)
- * by Jason R. Thorpe <thorpej@NetBSD.ORG>.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/pte.h>
-#include <machine/db_machdep.h>
-#include <machine/cpu.h>
-
-#include <ddb/db_access.h>
-
-static void db_write_text(db_addr_t, size_t, char *);
-
-/*
- * Read bytes from kernel address space for debugger.
- * This used to check for valid PTEs, but now that
- * traps in DDB work correctly, "Just Do It!"
- */
-void
-db_read_bytes(addr, size, data)
- db_addr_t addr;
- size_t size;
- char *data;
-{
- char *src = (char *)addr;
-
- if (size == 4) {
- *((int *)data) = *((int *)src);
- return;
- }
-
- if (size == 2) {
- *((short *)data) = *((short *)src);
- return;
- }
-
- while (size > 0) {
- --size;
- *data++ = *src++;
- }
-}
-
-/*
- * Write bytes somewhere in kernel text.
- * Makes text page writable temporarily.
- * We're probably a little to cache-paranoid.
- */
-static void
-db_write_text(addr, size, data)
- db_addr_t addr;
- size_t size;
- char *data;
-{
- char *dst, *odst;
- pt_entry_t *pte, oldpte, tmppte;
- vaddr_t pgva;
- int limit;
-
- if (size == 0)
- return;
-
- dst = (char *)addr;
-
- do {
- /*
- * Get the VA for the page.
- */
- pgva = trunc_page((vaddr_t)dst);
-
- /*
- * Save this destination address, for TLB
- * flush.
- */
- odst = dst;
-
- /*
- * Compute number of bytes that can be written
- * with this mapping and subtract it from the
- * total size.
- */
- limit = NBPG - ((u_long)dst & PGOFSET);
- if (limit > size)
- limit = size;
- size -= limit;
-
- /*
- * Make the page writable. Note the mapping is
- * cache-inhibited to save hair.
- */
- pte = kvtopte(pgva);
- oldpte = *pte;
-
- if ((oldpte & PG_V) == 0) {
- printf(" address %p not a valid page\n", dst);
- return;
- }
-
- tmppte = (oldpte & ~PG_RO) | PG_RW | PG_CI;
- *pte = tmppte;
- TBIS((vaddr_t)odst);
-
- /*
- * Page is now writable. Do as much access as we
- * can in this page.
- */
- for (; limit > 0; limit--)
- *dst++ = *data++;
-
- /*
- * Restore the old PTE.
- */
- *pte = oldpte;
- TBIS((vaddr_t)odst);
- } while (size != 0);
-
- /*
- * Invalidate the instruction cache so our changes
- * take effect.
- */
- ICIA();
-}
-
-/*
- * Write bytes to kernel address space for debugger.
- */
-extern char kernel_text[], etext[];
-void
-db_write_bytes(addr, size, data)
- db_addr_t addr;
- size_t size;
- char *data;
-{
- char *dst = (char *)addr;
-
- /* If any part is in kernel text, use db_write_text() */
- if ((dst < etext) && ((dst + size) > kernel_text)) {
- db_write_text(addr, size, data);
- return;
- }
-
- if (size == 4) {
- *((int *)dst) = *((int *)data);
- return;
- }
-
- if (size == 2) {
- *((short *)dst) = *((short *)data);
- return;
- }
-
- while (size > 0) {
- --size;
- *dst++ = *data++;
- }
-}
diff --git a/sys/arch/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c
deleted file mode 100644
index ce78c543c23..00000000000
--- a/sys/arch/hp300/hp300/disksubr.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* $OpenBSD: disksubr.c,v 1.51 2011/04/16 03:21:15 krw Exp $ */
-/* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1988, 1993
- * 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.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/disk.h>
-#include <sys/disklabel.h>
-#include <sys/syslog.h>
-
-/*
- * 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;
- int error;
-
- if ((error = initdisklabel(lp)))
- goto done;
-
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
-
- DL_SETBSTART(lp, lp->d_secpercyl);
-
- /* don't read the on-disk label if we are in spoofed-only mode */
- if (spoofonly)
- goto done;
-
- bp->b_blkno = LABELSECTOR;
- bp->b_bcount = lp->d_secsize;
- CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
- SET(bp->b_flags, B_BUSY | B_READ | B_RAW);
- (*strat)(bp);
- if (biowait(bp)) {
- error = bp->b_error;
- goto done;
- }
-
- error = checkdisklabel(bp->b_data + LABELOFFSET, lp,
- DL_GETBSTART(lp), 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.
- */
-int
-writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp)
-{
- struct buf *bp = NULL;
- struct disklabel *dlp;
- int error = 0;
-
- /* get a buffer and initialize it */
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
- bp->b_blkno = LABELSECTOR;
- bp->b_bcount = lp->d_secsize;
- CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
- SET(bp->b_flags, B_BUSY | B_READ | B_RAW);
- (*strat)(bp);
- if ((error = biowait(bp)) != 0)
- goto done;
-
- /* Write it in the regular place. */
- 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);
-}
diff --git a/sys/arch/hp300/hp300/genassym.cf b/sys/arch/hp300/hp300/genassym.cf
deleted file mode 100644
index 250929ceb04..00000000000
--- a/sys/arch/hp300/hp300/genassym.cf
+++ /dev/null
@@ -1,171 +0,0 @@
-# $OpenBSD: genassym.cf,v 1.22 2011/08/18 19:54:18 miod Exp $
-# $NetBSD: genassym.cf,v 1.11 1998/02/16 20:58:29 thorpej Exp $
-
-#
-# Copyright (c) 1982, 1990, 1993
-# The Regents of the University of California. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of the University nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# @(#)genassym.c 8.3 (Berkeley) 1/4/94
-#
-
-include <sys/param.h>
-include <sys/buf.h>
-include <sys/proc.h>
-include <sys/mbuf.h>
-include <sys/msgbuf.h>
-include <sys/syscall.h>
-include <sys/user.h>
-
-include <uvm/uvm_extern.h>
-
-include <machine/hp300spu.h>
-include <machine/cpu.h>
-include <machine/psl.h>
-include <machine/reg.h>
-include <machine/pte.h>
-
-include <hp300/dev/frodoreg.h>
-include <hp300/hp300/clockreg.h>
-
-# values for machineid
-export HP_320
-export HP_330
-export HP_340
-export HP_345
-export HP_350
-export HP_36X
-export HP_370
-export HP_375
-export HP_380
-export HP_382
-export HP_385
-export HP_400
-export HP_425
-export HP_433
-
-# values for mmuid
-export MMUID_345
-export MMUID_375
-export MMUID_382
-export MMUID_385
-export MMUID_425_T
-export MMUID_425_S
-export MMUID_433_T
-export MMUID_433_S
-export MMUID_425_E
-
-export MMUID_SHIFT
-export MMUID_MASK
-
-# values for ectype
-export EC_PHYS
-export EC_NONE
-export EC_VIRT
-
-# general constants
-export UPAGES
-export USPACE
-export PGSHIFT
-export USRSTACK
-export MAXADDR
-
-# proc fields and values
-struct proc
-member P_MD_FLAGS p_md.md_flags
-member P_MD_REGS p_md.md_regs
-
-export SSLEEP
-
-# PSL values
-export PSL_S
-export PSL_IPL7
-export PSL_LOWIPL
-export PSL_USER
-define PSL_TS PSL_T | PSL_S
-define SPL1 PSL_S | PSL_IPL1
-define SPL2 PSL_S | PSL_IPL2
-define SPL3 PSL_S | PSL_IPL3
-define SPL4 PSL_S | PSL_IPL4
-define SPL5 PSL_S | PSL_IPL5
-define SPL6 PSL_S | PSL_IPL6
-
-# magic
-export FC_PURGE
-export INTIOBASE
-export MMUBASE
-export MMUSTAT
-export MMUCMD
-export MMUSSTP
-export MMUUSTP
-export MMUTBINVAL
-export MMU_BERR
-export MMU_ENAB
-export MMU_FAULT
-export MMU_CEN
-export MMU_IEN
-export MMU_FPE
-export CACHE_ON
-export CACHE_OFF
-export CACHE_CLR
-export IC_CLEAR
-export DC_CLEAR
-
-# pte/ste bits
-export PG_V
-export PG_NV
-export PG_RO
-export PG_RW
-export PG_CI
-export PG_PROT
-export PG_FRAME
-export SG_V
-export SG_NV
-export SG_RW
-export SG_FRAME
-export SG_ISHIFT
-
-# pcb fields
-struct pcb
-member pcb_ps
-member pcb_usp
-member pcb_regs
-member PCB_FPCTX pcb_fpregs
-define SIZEOF_PCB sizeof(struct pcb)
-
-# exception frame size
-define FR_SIZE sizeof(struct trapframe)
-
-# system calls
-export SYS_execve
-
-# clock registers
-export CLKSR
-export CLKMSB1
-export CLKMSB3
-
-# frodo physical address
-export FRODO_BASE
diff --git a/sys/arch/hp300/hp300/intr.c b/sys/arch/hp300/hp300/intr.c
deleted file mode 100644
index a533b6a70a5..00000000000
--- a/sys/arch/hp300/hp300/intr.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/* $OpenBSD: intr.c,v 1.26 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: intr.c,v 1.5 1998/02/16 20:58:30 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Adam Glass, Gordon W. Ross, and 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.
- */
-
-/*
- * Link and dispatch interrupts.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/vmmeter.h>
-
-#include <uvm/uvm_extern.h>
-
-#include "ppp.h"
-#include "bridge.h"
-
-#include <machine/cpu.h>
-#include <machine/intr.h>
-
-/*
- * The location and size of the autovectored interrupt portion
- * of the vector table.
- */
-#define ISRLOC 0x18
-
-typedef LIST_HEAD(, isr) isr_list_t;
-isr_list_t isr_list[NISR];
-
-/*
- * Default interrupt priorities.
- * IPL_BIO, IPL_NET and IPL_TTY will be adjusted when devices attach.
- */
-u_short hp300_varpsl[NISR] = {
- PSL_S | PSL_IPL0, /* IPL_NONE */
- PSL_S | PSL_IPL1, /* IPL_SOFT */
- PSL_S | PSL_IPL3, /* IPL_BIO */
- PSL_S | PSL_IPL3, /* IPL_NET */
- PSL_S | PSL_IPL3, /* IPL_TTY */
- PSL_S | PSL_IPL5, /* IPL_VM */
- PSL_S | PSL_IPL6, /* IPL_AUDIO, IPL_CLOCK */
- PSL_S | PSL_IPL7 /* IPL_HIGH */
-};
-
-void intr_computeipl(void);
-
-void
-intr_init()
-{
- int i;
-
- /* Initialize the ISR lists. */
- for (i = 0; i < NISR; ++i)
- LIST_INIT(&isr_list[i]);
-}
-
-/*
- * Scan all of the ISRs, recomputing the interrupt levels for the spl*()
- * calls. This doesn't have to be fast.
- */
-void
-intr_computeipl()
-{
- struct isr *isr;
- int ipl;
-
- /* Start with low values. */
- hp300_varpsl[IPL_BIO] = hp300_varpsl[IPL_NET] =
- hp300_varpsl[IPL_TTY] = PSL_S | PSL_IPL3;
-
- for (ipl = 0; ipl < NISR; ipl++) {
- LIST_FOREACH(isr, &isr_list[ipl], isr_link) {
- /*
- * Bump up the level for a given priority,
- * if necessary.
- */
- switch (isr->isr_priority) {
- case IPL_BIO:
- if (ipl > PSLTOIPL(hp300_varpsl[IPL_BIO]))
- hp300_varpsl[IPL_BIO] = IPLTOPSL(ipl);
- break;
-
- case IPL_NET:
- if (ipl > PSLTOIPL(hp300_varpsl[IPL_NET]))
- hp300_varpsl[IPL_NET] = IPLTOPSL(ipl);
- break;
-
- case IPL_TTY:
- if (ipl > PSLTOIPL(hp300_varpsl[IPL_TTY]))
- hp300_varpsl[IPL_TTY] = IPLTOPSL(ipl);
- break;
-
- case IPL_AUDIO:
- /* audio is always at level 6 */
- break;
-
- default:
- panic("intr_computeipl: bad priority %d",
- isr->isr_priority);
- }
- }
- }
-
- /*
- * Enforce `bio <= net <= tty <= vm'
- */
-
- if (hp300_varpsl[IPL_NET] < hp300_varpsl[IPL_BIO])
- hp300_varpsl[IPL_NET] = hp300_varpsl[IPL_BIO];
-
- if (hp300_varpsl[IPL_TTY] < hp300_varpsl[IPL_NET])
- hp300_varpsl[IPL_TTY] = hp300_varpsl[IPL_NET];
-}
-
-void
-intr_printlevels()
-{
-
-#ifdef DEBUG
- printf("psl: bio = 0x%x, net = 0x%x, tty = 0x%x\n",
- hp300_varpsl[IPL_BIO], hp300_varpsl[IPL_NET],
- hp300_varpsl[IPL_TTY]);
-#endif
-
- printf("interrupt levels: bio = %d, net = %d, tty = %d\n",
- PSLTOIPL(hp300_varpsl[IPL_BIO]), PSLTOIPL(hp300_varpsl[IPL_NET]),
- PSLTOIPL(hp300_varpsl[IPL_TTY]));
-}
-
-/*
- * Establish an interrupt handler.
- * Called by driver attach functions.
- */
-void
-intr_establish(struct isr *isr, const char *name)
-{
- struct isr *curisr;
- isr_list_t *list;
-
-#ifdef DIAGNOSTIC
- if (isr->isr_ipl < 0 || isr->isr_ipl >= NISR)
- panic("intr_establish: bad ipl %d", isr->isr_ipl);
-#endif
-
- evcount_attach(&isr->isr_count, name, &isr->isr_ipl);
-
- /*
- * Some devices are particularly sensitive to interrupt
- * handling latency. The DCA, for example, can lose many
- * characters if its interrupt isn't handled with reasonable
- * speed. For this reason, we sort ISRs by IPL_* priority,
- * inserting higher priority interrupts before lower priority
- * interrupts.
- */
-
- /*
- * Get the appropriate ISR list. If the list is empty, no
- * additional work is necessary; we simply insert ourselves
- * at the head of the list.
- */
- list = &isr_list[isr->isr_ipl];
- if (LIST_EMPTY(list)) {
- LIST_INSERT_HEAD(list, isr, isr_link);
- goto compute;
- }
-
- /*
- * A little extra work is required. We traverse the list
- * and place ourselves after any ISRs with our current (or
- * higher) priority.
- */
- for (curisr = LIST_FIRST(list);
- LIST_NEXT(curisr, isr_link) != LIST_END(list);
- curisr = LIST_NEXT(curisr, isr_link)) {
- if (isr->isr_priority > curisr->isr_priority) {
- LIST_INSERT_BEFORE(curisr, isr, isr_link);
- goto compute;
- }
- }
-
- /*
- * We're the least important entry, it seems. We just go
- * on the end.
- */
- LIST_INSERT_AFTER(curisr, isr, isr_link);
-
- compute:
- /* Compute new interrupt levels. */
- intr_computeipl();
-}
-
-/*
- * Disestablish an interrupt handler.
- */
-void
-intr_disestablish(struct isr *isr)
-{
- evcount_detach(&isr->isr_count);
- LIST_REMOVE(isr, isr_link);
- intr_computeipl();
-}
-
-/*
- * This is the dispatcher called by the low-level
- * assembly language interrupt routine.
- */
-void
-intr_dispatch(evec)
- int evec; /* format | vector offset */
-{
- struct isr *isr;
- isr_list_t *list;
- int handled, rc, ipl, vec;
- static int straycount, unexpected;
-
- vec = (evec & 0xfff) >> 2;
-#ifdef DIAGNOSTIC
- if (vec < ISRLOC || vec >= (ISRLOC + NISR))
- panic("isrdispatch: bad vec 0x%x", vec);
-#endif
- ipl = vec - ISRLOC;
-
- uvmexp.intrs++;
-
- list = &isr_list[ipl];
- if (LIST_EMPTY(list)) {
- if (ipl != IPL_CLOCK) {
- printf("intr_dispatch: ipl %d unexpected\n", ipl);
- if (++unexpected > 10)
- panic("intr_dispatch:"
- " too many unexpected interrupts");
- }
- return;
- }
-
- handled = 0;
- /* Give all the handlers a chance. */
- LIST_FOREACH(isr, list, isr_link) {
- rc = (*isr->isr_func)(isr->isr_arg);
- if (rc > 0)
- isr->isr_count.ec_count++;
- handled |= rc;
- }
-
- if (ipl != IPL_CLOCK) {
- if (handled)
- straycount = 0;
- else if (++straycount > 50)
- panic("intr_dispatch: too many stray interrupts");
- else
- printf("intr_dispatch: stray level %d interrupt\n", ipl);
- }
-}
-
-#ifdef DIAGNOSTIC
-void
-splassert_check(int wantipl, const char *func)
-{
- int oldipl, realwantipl;
-
- __asm __volatile ("movew %%sr,%0" : "=&d" (oldipl));
-
- realwantipl = PSLTOIPL(hp300_varpsl[wantipl]);
- oldipl = PSLTOIPL(oldipl);
-
- if (oldipl < realwantipl) {
- splassert_fail(realwantipl, oldipl, func);
- /*
- * If the splassert_ctl is set to not panic, raise the ipl
- * in a feeble attempt to reduce damage.
- */
- _spl(hp300_varpsl[wantipl]);
- }
-}
-#endif
diff --git a/sys/arch/hp300/hp300/kgdb_machdep.c b/sys/arch/hp300/hp300/kgdb_machdep.c
deleted file mode 100644
index 82dd1a3404d..00000000000
--- a/sys/arch/hp300/hp300/kgdb_machdep.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* $OpenBSD: kgdb_machdep.c,v 1.4 2005/11/13 17:50:44 fgsch Exp $ */
-/* $NetBSD: kgdb_machdep.c,v 1.1 1997/05/05 20:51:05 thorpej Exp $ */
-
-/*
- * Copyright (c) 1990, 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 Laboratories.
- *
- * 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.
- *
- * @(#)kgdb_stub.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Machine-dependent part of the KGDB remote "stub"
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kgdb.h>
-
-#include <machine/db_machdep.h>
-#include <machine/pte.h>
-
-/*
- * Determine if the memory at va..(va+len) is valid.
- */
-int
-kgdb_acc(va, ulen)
- vaddr_t va;
- size_t ulen;
-{
- int len, pgoff;
- pt_entry_t *pte;
-
- len = (int)ulen;
- pgoff = va & PGOFSET;
- va -= pgoff;
- len += pgoff;
-
- while (len > 0) {
- pte = kvtopte(va);
- if ((*pte & PG_V) == 0)
- return (0);
- va += NBPG;
- len -= NBPG;
- }
-
- return (1);
-}
diff --git a/sys/arch/hp300/hp300/leds.c b/sys/arch/hp300/hp300/leds.c
deleted file mode 100644
index 388d8dcee43..00000000000
--- a/sys/arch/hp300/hp300/leds.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $OpenBSD: leds.c,v 1.8 2005/01/08 22:13:24 miod Exp $ */
-/* $NetBSD: leds.c,v 1.1 1997/05/05 20:54:35 thorpej 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.
- *
- * from: Utah $Hdr: machdep.c 1.74 92/12/20$
- *
- * @(#)machdep.c 8.10 (Berkeley) 4/20/94
- */
-
-#include <sys/param.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <hp300/hp300/leds.h>
-
-extern caddr_t ledbase; /* kva of LED page */
-u_int8_t *ledaddr; /* actual address of LEDs */
-static int inledcontrol; /* mutex */
-
-/*
- * Map the LED page and setup the KVA to access it.
- */
-void
-ledinit()
-{
-
- pmap_enter(pmap_kernel(), (vaddr_t)ledbase, (paddr_t)LED_ADDR,
- VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
- pmap_update(pmap_kernel());
- ledaddr = (u_int8_t *) ((long)ledbase | (LED_ADDR & PGOFSET));
-}
-
-/*
- * Do lights:
- * `ons' is a mask of LEDs to turn on,
- * `offs' is a mask of LEDs to turn off,
- * `togs' is a mask of LEDs to toggle.
- * Note we don't use splclock/splx for mutual exclusion.
- * They are expensive and we really don't need to be that precise.
- * Besides we would like to be able to profile this routine.
- */
-void
-ledcontrol(ons, offs, togs)
- int ons, offs, togs;
-{
- static u_int8_t currentleds;
- u_int8_t leds;
-
- if (inledcontrol)
- return;
-
- inledcontrol = 1;
- leds = currentleds;
- if (ons)
- leds |= ons;
- if (offs)
- leds &= ~offs;
- if (togs)
- leds ^= togs;
- currentleds = leds;
- *ledaddr = ~leds;
- inledcontrol = 0;
-}
diff --git a/sys/arch/hp300/hp300/leds.h b/sys/arch/hp300/hp300/leds.h
deleted file mode 100644
index 7efdf727a47..00000000000
--- a/sys/arch/hp300/hp300/leds.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $OpenBSD: leds.h,v 1.3 2003/06/02 23:27:45 millert Exp $ */
-/* $NetBSD: leds.h,v 1.1 1997/05/05 20:54:36 thorpej Exp $ */
-
-/*
- * Copyright (c) 1992 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.
- *
- * from: Utah $Hdr: led.h 1.2 92/08/27$
- *
- * @(#)led.h 8.1 (Berkeley) 6/10/93
- */
-
-#define LED_ADDR 0x1FFFF /* a ROM address--strange but true */
-
-#define LED_LANXMT 0x80 /* for LAN transmit activity */
-#define LED_LANRCV 0x40 /* for LAN receive activity */
-#define LED_DISK 0x20 /* for disk activity */
-#define LED_PULSE 0x10 /* heartbeat */
-
-#if defined(_KERNEL) && !defined(_LOCORE)
-void ledinit(void);
-void ledcontrol(int, int, int);
-#endif
diff --git a/sys/arch/hp300/hp300/locore.s b/sys/arch/hp300/hp300/locore.s
deleted file mode 100644
index 59d442fc97d..00000000000
--- a/sys/arch/hp300/hp300/locore.s
+++ /dev/null
@@ -1,1861 +0,0 @@
-/* $OpenBSD: locore.s,v 1.73 2013/06/30 23:47:07 miod Exp $ */
-/* $NetBSD: locore.s,v 1.91 1998/11/11 06:41:25 thorpej Exp $ */
-
-/*
- * Copyright (c) 1997 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 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) 1994, 1995 Gordon W. Ross
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1980, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: locore.s 1.66 92/12/22$
- *
- * @(#)locore.s 8.6 (Berkeley) 5/27/94
- */
-
-#include "assym.h"
-#include <machine/asm.h>
-#include <machine/trap.h>
-
-#include "audio.h"
-#include "ksyms.h"
-#ifdef USELEDS
-#include <hp300/hp300/leds.h>
-#endif
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diofbreg.h>
-
-#include "sgc.h"
-#if NSGC > 0
-#include <hp300/dev/sgcreg.h>
-#endif
-
-#define SYSFLAG 0xfffffed2
-
-#define MMUADDR(ar) movl _C_LABEL(MMUbase),ar
-#define CLKADDR(ar) movl _C_LABEL(CLKbase),ar
-
-/*
- * This is for kvm_mkdb, and should be the address of the beginning
- * of the kernel text segment (not necessarily the same as kernbase).
- */
- .chip 68020
- .text
-GLOBAL(kernel_text)
-
-/*
- * Clear and skip the first page of text; it will not be mapped.
- */
- .fill NBPG/4,4,0
-
-/*
- * Temporary stack for a variety of purposes.
- * Try and make this the first thing in the data segment so it
- * is page aligned. Note that if we overflow here, we run into
- * our text segment.
- */
- .data
- .space NBPG
-ASLOCAL(tmpstk)
-
-#include <hp300/hp300/vectors.s>
-
-/*
- * Macro to relocate a symbol, used before MMU is enabled.
- */
-#ifdef __STDC__
-#define RELOC(var, ar) \
- moveal #_C_LABEL(var),ar; \
- addl %a5,ar
-#define ASRELOC(var, ar) \
- moveal #_ASM_LABEL(var),ar; \
- addl %a5,ar
-#else
-#define _RELOC(var, ar) \
- movel #var,ar; \
- addl %a5,ar
-#define RELOC(var, ar) _RELOC(_C_LABEL(var), ar)
-#define ASRELOC(var, ar) _RELOC(_ASM_LABEL(var), ar)
-#endif
-
-/*
- * Final bits of grunt work required to reboot the system. The MMU
- * must be disabled when this is invoked.
- */
-#define DOREBOOT \
- /* Reset Vector Base Register to what PROM expects. */ \
- movl #0,%d0; \
- movc %d0,%vbr; \
- /* Jump to REQ_REBOOT */ \
- jmp 0x1A4;
-
-/*
- * Initialization
- *
- * A4 contains the address of the end of the symtab
- * A5 contains physical load point from boot
- * VBR contains zero from ROM. Exceptions will continue to vector
- * through ROM until MMU is turned on at which time they will vector
- * through our table (vectors.s).
- */
-
-BSS(lowram,4)
-BSS(esym,4)
-
-ASENTRY_NOPROFILE(start)
- movw #PSL_HIGHIPL,%sr | no interrupts
- ASRELOC(tmpstk, %a0)
- movl %a0,%sp | give ourselves a temporary stack
- RELOC(esym, %a0)
- movl %a4,%a0@ | store end of symbol table
- RELOC(lowram, %a0)
- movl %a5,%a0@ | store start of physical memory
- movl #CACHE_OFF,%d0
- movc %d0,%cacr | clear and disable on-chip cache(s)
-
- /* check for internal HP-IB in SYSFLAG */
- btst #5,SYSFLAG | internal HP-IB?
- jeq Lhaveihpib | yes, have HP-IB just continue
- RELOC(internalhpib, %a0)
- movl #0,%a0@ | no, clear associated address
-Lhaveihpib:
-
- RELOC(boothowto, %a0) | save reboot flags
- movl %d7,%a0@
- RELOC(bootdev, %a0) | and boot device
- movl %d6,%a0@
-
- /*
- * All data registers are now free. All address registers
- * except a5 are free. a5 is used by the RELOC() macro,
- * and cannot be used until after the MMU is enabled.
- */
-
-/* determine our CPU/MMU combo - check for all regardless of kernel config */
- movl #INTIOBASE+MMUBASE,%a1
- movl #0x200,%d0 | data freeze bit
- movc %d0,%cacr | only exists on 68030
- movc %cacr,%d0 | read it back
- tstl %d0 | zero?
- jeq Lnot68030 | yes, we have 68020/68040
-
- /*
- * 68030 models
- */
-
- RELOC(mmutype, %a0) | no, we have 68030
- movl #MMU_68030,%a0@ | set to reflect 68030 PMMU
- RELOC(cputype, %a0)
- movl #CPU_68030,%a0@ | and 68030 CPU
- RELOC(machineid, %a0)
- movl #0x80,%a1@(MMUCMD) | set magic cookie
- movl %a1@(MMUCMD),%d0 | read it back
- btst #7,%d0 | cookie still on?
- jeq Lnot370 | no, 360 or 375
- movl #0,%a1@(MMUCMD) | clear magic cookie
- movl %a1@(MMUCMD),%d0 | read it back
- btst #7,%d0 | still on?
- jeq Lisa370 | no, must be a 370
- movl #HP_340,%a0@ | yes, must be a 340
- jra Lstart1
-Lnot370:
- movl #HP_36X,%a0@ | type is at least a 360
- movl #0,%a1@(MMUCMD) | clear magic cookie2
- movl %a1@(MMUCMD),%d0 | read it back
- btst #16,%d0 | still on?
- jeq Lisa36x | no, must be a 360 or a 362
- RELOC(mmuid, %a0) | save MMU ID
- lsrl #MMUID_SHIFT,%d0
- andl #MMUID_MASK,%d0
- movl %d0,%a0@
- RELOC(machineid, %a0)
- cmpb #MMUID_345,%d0 | are we a 345?
- beq Lisa345
- cmpb #MMUID_375,%d0 | how about a 375?
- beq Lisa375
- movl #HP_400,%a0@ | must be a 400
- jra Lhaspac
-Lisa345:
- movl #HP_345,%a0@
- jra Lhaspac
-Lisa375:
- movl #HP_375,%a0@
- jra Lhaspac
-Lisa370:
- movl #HP_370,%a0@ | set to 370
-Lhaspac:
- RELOC(ectype, %a0)
- movl #EC_PHYS,%a0@ | also has a physical address cache
- jra Lstart1
-
- /*
- * End of 68030 section
- */
-
-Lnot68030:
- bset #31,%d0 | data cache enable bit
- movc %d0,%cacr | only exists on 68040
- movc %cacr,%d0 | read it back
- tstl %d0 | zero?
- beq Lis68020 | yes, we have 68020
- moveq #CACHE40_OFF,%d0 | now turn it back off
- movc %d0,%cacr | before we access any data
-
- /*
- * 68040 models
- */
-
- RELOC(mmutype, %a0)
- movl #MMU_68040,%a0@ | with a 68040 MMU
- RELOC(cputype, %a0)
- movl #CPU_68040,%a0@ | and a 68040 CPU
- RELOC(fputype, %a0)
- movl #FPU_68040,%a0@ | ...and FPU
- RELOC(ectype, %a0)
- movl #EC_NONE,%a0@ | and no cache (for now XXX)
- RELOC(mmuid, %a0)
- movl %a1@(MMUCMD),%d0 | read MMU register
- lsrl #MMUID_SHIFT,%d0
- andl #MMUID_MASK,%d0
- movl %d0,%a0@ | save MMU ID
- RELOC(machineid, %a0)
- cmpb #MMUID_425_T,%d0 | are we a 425t?
- jeq Lisa425
- cmpb #MMUID_425_S,%d0 | how about 425s?
- jeq Lisa425
- cmpb #MMUID_425_E,%d0 | or maybe a 425e?
- jeq Lisa425
- cmpb #MMUID_433_T,%d0 | or a 433t?
- jeq Lisa433
- cmpb #MMUID_433_S,%d0 | maybe a 433s?
- jeq Lisa433
- cmpb #MMUID_385,%d0 | then a 385?
- jeq Lisa385
- cmpb #MMUID_382,%d0 | last chance...
- jeq Lisa382
- movl #HP_380,%a0@ | guess we're a 380
- jra Lstart1
-Lisa425:
- movl #HP_425,%a0@
- jra Lstart1
-Lisa433:
- movl #HP_433,%a0@
- jra Lstart1
-Lisa385:
- movl #HP_385,%a0@
- jra Lstart1
-Lisa382:
- movl #HP_382,%a0@
- jra Lstart1
-
- /*
- * End of 68040 section
- */
-
- /*
- * 68020 models
- */
-
-Lis68020:
- RELOC(fputype, %a0) | all of the 68020 systems
- movl #FPU_68881,%a0@ | have a 68881 FPU
- movl #1,%a1@(MMUCMD) | a 68020, write HP MMU location
- movl %a1@(MMUCMD),%d0 | read it back
- btst #0,%d0 | non-zero?
- jne Lunsupp | yes, we have HP MMU
- RELOC(mmutype, %a0)
- movl #MMU_68851,%a0@ | no, we have PMMU
- RELOC(machineid, %a0)
- movl #HP_330,%a0@ | and 330 CPU
- jra Lstart1
-
- /*
- * End of 68020 section
- */
-
-Lisa36x:
- /*
- * There is currently no easy way of telling a 362 and a 360
- * apart, except perhaps checking for the 362 frame buffer if
- * it isn't disabled.
- */
- /* FALLTHROUGH */
-
-Lstart1:
- /*
- * Now we need to know how much space the external I/O map has to be.
- * This has to be done before pmap_bootstrap() is invoked, but since
- * we are not running in virtual mode and will cause several bus
- * errors while probing, it is easier to do this before setting up
- * our own vectors table.
- */
- clrl %d3
-
- /*
- * Don't probe the DIO-I space, simply assume the whole 0-31
- * select code range is taken, i.e. 32 boards.
- */
- addl #(DIO_DEVSIZE * 32), %d3
-
- /*
- * Check the ``internal'' frame buffer address. If there is one,
- * assume an extra 2MB of frame buffer memory at 0x200000.
- */
- movl #GRFIADDR, %a0
- ASRELOC(phys_badaddr, %a3)
- jbsr %a3@
- tstl %d0 | success?
- jne dioiicheck | no, skip
- movl #0x200000, %d1 | yes, add the 200000-400000 range
- addl %d1, %d3
-
- /*
- * Probe for DIO-II devices, select codes 132 to 255.
- */
-dioiicheck:
- RELOC(machineid,%a0)
- cmpl #HP_320,%a0@
- jeq eiodone | HP 320 has nothing more
-
- movl #DIOII_SCBASE, %d2 | our select code...
- movl #DIOII_BASE, %a0 | and first address
-dioloop:
- ASRELOC(phys_badaddr, %a3)
- jbsr %a3@ | probe address (read ID)
- movl #DIOII_DEVSIZE, %d1
- tstl %d0 | success?
- jne 1f | no, skip
- addl %d1, %d3 | yes, count it
-1:
- addl %d1, %a0 | next slot address...
- addql #1, %d2 | and slot number
- cmpl #256, %d2
- jne dioloop
-
-#if NSGC > 0
- /*
- * Probe for SGC devices, slots 0 to 3.
- * Only do the probe on machines which might have an SGC bus.
- */
- RELOC(machineid,%a0)
- cmpl #HP_400,%a0@
- jeq sgcprobe
- cmpl #HP_425,%a0@
- jeq sgcprobe
- cmpl #HP_433,%a0@
- jne eiodone
-sgcprobe:
- clrl %d2 | first slot...
- movl #SGC_BASE, %a0 | and first address
-sgcloop:
- ASRELOC(phys_badaddr, %a3)
- jbsr %a3@ | probe address
- movl #SGC_DEVSIZE, %d1
- tstl %d0 | success?
- jne 2f | no, skip
- addl %d1, %d3 | yes, count it
-2:
- addl %d1, %a0 | next slot address...
- addql #1, %d2 | and slot number
- cmpl #SGC_NSLOTS, %d2
- jne sgcloop
-#endif
-
-eiodone:
- moveq #PGSHIFT, %d2
- lsrl %d2, %d3 | convert from bytes to pages
- RELOC(eiomapsize,%a2)
- addql #1, %d3 | add an extra page for device probes
- movl %d3,%a2@
-
- /*
- * Now that we know what CPU we have, initialize the address error
- * and bus error handlers in the vector table:
- *
- * vectab+8 bus error
- * vectab+12 address error
- */
- RELOC(cputype, %a0)
- RELOC(vectab, %a2)
-#if defined(M68040)
- cmpl #CPU_68040,%a0@ | 68040?
- jne 1f | no, skip
- movl #_C_LABEL(buserr40),%a2@(8)
- movl #_C_LABEL(addrerr4060),%a2@(12)
- jra Lstart2
-1:
-#endif
-#if defined(M68020) || defined(M68030)
- cmpl #CPU_68040,%a0@ | 68040?
- jeq 1f | yes, skip
- movl #_C_LABEL(busaddrerr2030),%a2@(8)
- movl #_C_LABEL(busaddrerr2030),%a2@(12)
- jra Lstart2
-1:
-#endif
-Lunsupp:
- /* Config botch; no hope. */
- DOREBOOT
-
-Lstart2:
-/* initialize source/destination control registers for movs */
- moveq #FC_USERD,%d0 | user space
- movc %d0,%sfc | as source
- movc %d0,%dfc | and destination of transfers
-/* initialize memory size (for pmap_bootstrap) */
- movl #MAXADDR,%d1 | last page
- movl %a5,%d0 | lowram value from ROM via boot
- moveq #PGSHIFT,%d2
- subl %d0,%d1 | compute amount of RAM present
- lsrl %d2,%d1 | convert to pages
- addl #3,%d1 | restore the 3 pages lost (2 from
- | the bootloader and the MAXADDR one)
- RELOC(physmem, %a0)
- movl %d1,%a0@ | save as physmem
-
-/* configure kernel and proc0 VA space so we can get going */
-#if defined(DDB) || NKSYMS > 0
- RELOC(esym,%a0) | end of static kernel test/data/syms
- movl %a0@,%d5
- jne Lstart3
-#endif
- movl #_C_LABEL(end),%d5 | end of static kernel text/data
-Lstart3:
- addl #NBPG-1,%d5
- andl #PG_FRAME,%d5 | round to a page
- movl %d5,%a4
- addl %a5,%a4 | convert to PA
- pea %a5@ | firstpa
- pea %a4@ | nextpa
- RELOC(pmap_bootstrap,%a0)
- jbsr %a0@ | pmap_bootstrap(firstpa, nextpa)
- addql #8,%sp
-
-/*
- * While still running physical, override copypage() with the 68040
- * optimized version, copypage040(), if possible.
- * This relies upon the fact that copypage() immediately follows
- * copypage040() in memory.
- */
- RELOC(mmutype, %a0)
- cmpl #MMU_68040,%a0@
- jgt Lmmu_enable
- RELOC(copypage040, %a0)
- RELOC(copypage, %a1)
- movl %a1, %a2
-1:
- movw %a0@+, %a2@+
- cmpl %a0, %a1
- jgt 1b
-
-/*
- * Prepare to enable MMU.
- * Since the kernel is not mapped logical == physical we must insure
- * that when the MMU is turned on, all prefetched addresses (including
- * the PC) are valid. In order to guarantee that, we use the last physical
- * page (which is conveniently mapped == VA) and load it up with enough
- * code to defeat the prefetch, then we execute the jump back to here.
- *
- * Is this all really necessary, or am I paranoid??
- */
-Lmmu_enable:
- RELOC(Sysseg, %a0) | system segment table addr
- movl %a0@,%d1 | read value (a KVA)
- addl %a5,%d1 | convert to PA
- RELOC(mmutype, %a0)
- cmpl #MMU_68040,%a0@ | 68040?
- jne Lmotommu1 | no, skip
- .chip 68040
- movc %d1,%srp
- .chip 68020
- jra Lstploaddone
-Lmotommu1:
- ASRELOC(protorp, %a0)
- movl #0x80000202,%a0@ | nolimit + share global + 4 byte PTEs
- movl %d1,%a0@(4) | + segtable address
- pmove %a0@,%srp | load the supervisor root pointer
- movl #0x80000002,%a0@ | reinit upper half for CRP loads
-
-Lstploaddone:
- lea MAXADDR,%a2 | PA of last RAM page
- ASRELOC(Lhighcode, %a1) | addr of high code
- ASRELOC(Lehighcode, %a3) | end addr
-Lcodecopy:
- movw %a1@+,%a2@+ | copy a word
- cmpl %a3,%a1 | done yet?
- jcs Lcodecopy | no, keep going
- jmp MAXADDR | go for it!
-
- /*
- * BEGIN MMU TRAMPOLINE. This section of code is not
- * executed in-place. It's copied to the last page
- * of RAM (mapped va == pa) and executed there.
- */
-
-Lhighcode:
- /*
- * Set up the vector table, and race to get the MMU
- * enabled.
- */
- movl #_C_LABEL(vectab),%d0 | set Vector Base Register
- movc %d0,%vbr
-
- RELOC(mmutype, %a0)
- cmpl #MMU_68040,%a0@ | 68040?
- jne Lmotommu2 | no, skip
- .chip 68040
- movw #0,INTIOBASE+MMUBASE+MMUCMD+2
- movw #MMU_IEN+MMU_CEN+MMU_FPE,INTIOBASE+MMUBASE+MMUCMD+2
- | enable FPU and caches
- moveq #0,%d0 | ensure TT regs are disabled
- movc %d0,%itt0
- movc %d0,%itt1
- movc %d0,%dtt1
-
- /*
- * Set up transparent translation for supervisor data access.
- * The range 0xc0000000-0xffffffff will not be translated, and
- * thus yields a 1:1 mapping of the physical memory in the top
- * of the address space (as long as we don't have more than
- * 1GB of memory, which will be very unlikely...)
- */
- movl #0xc03fa020,%d0
- movc %d0,%dtt0
-
- cinva %bc
- pflusha
- movl #0x8000,%d0
- movc %d0,%tc
- movl #CACHE40_ON,%d0
- movc %d0,%cacr | turn on both caches
- jmp Lenab1:l | forced to not be pc-relative
- .chip 68020
-Lmotommu2:
- cmpl #MMU_68030,%a0@ | 68030?
- jne Lmotommu2b | no, skip
- .chip 68030
- /*
- * Set up transparent translation for supervisor data access
- * (FC == 5), similar to the 68040 logic above.
- */
- ASRELOC(mmuscratch, %a2)
- movl #0xc03f8150,%a2@ | build our TT0 value
- pmove %a2@,%tt0
- .chip 68020
-Lmotommu2b:
- movl #MMU_IEN+MMU_FPE,INTIOBASE+MMUBASE+MMUCMD
- | enable MMU and i-cache
- ASRELOC(mmuscratch, %a2)
- movl #0x82c0aa00,%a2@ | value to load TC with
- pmove %a2@,%tc | load it
- jmp Lenab1:l | forced to not be pc-relative
-Lehighcode:
-
- /*
- * END MMU TRAMPOLINE. Address register a5 is now free.
- */
-
-/*
- * Should be running mapped from this point on
- */
-Lenab1:
-/* select the software page size now */
- lea _ASM_LABEL(tmpstk),%sp | temporary stack
- jbsr _C_LABEL(uvm_setpagesize) | select software page size
-/* set kernel stack, user SP, and initial pcb */
- movl _C_LABEL(proc0paddr),%a1 | get proc0 pcb addr
- lea %a1@(USPACE-4),%sp | set kernel stack to end of area
- lea _C_LABEL(proc0),%a2 | initialize proc0.p_addr so that
- movl %a1,%a2@(P_ADDR) | we don't deref NULL in trap()
- movl #USRSTACK-4,%a2
- movl %a2,%usp | init user SP
- movl %a1,_C_LABEL(curpcb) | proc0 is running
-
- tstl _C_LABEL(fputype) | Have an FPU?
- jeq Lenab2 | No, skip.
- clrl %a1@(PCB_FPCTX) | ensure null FP context
- movl %a1,%sp@-
- jbsr _C_LABEL(m68881_restore) | restore it (does not kill a1)
- addql #4,%sp
-Lenab2:
-/* flush TLB and turn on caches */
- jbsr _ASM_LABEL(TBIA) | invalidate TLB
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jeq Lnocache0 | yes, cache already on
- movl #CACHE_ON,%d0
- movc %d0,%cacr | clear cache(s)
- tstl _C_LABEL(ectype)
- jeq Lnocache0
- MMUADDR(%a0)
- orl #MMU_CEN,%a0@(MMUCMD) | turn on external cache
-Lnocache0:
-/* Final setup for call to main(). */
- jbsr _C_LABEL(hp300_init)
-
-/*
- * Create a fake exception frame so that cpu_fork() can copy it.
- * main() never returns; we exit to user mode from a forked process
- * later on.
- */
- clrw %sp@- | vector offset/frame type
- clrl %sp@- | PC - filled in by "execve"
- movw #PSL_USER,%sp@- | in user mode
- clrl %sp@- | stack adjust count and padding
- lea %sp@(-64),%sp | construct space for D0-D7/A0-A7
- lea _C_LABEL(proc0),%a0 | save pointer to frame
- movl %sp,%a0@(P_MD_REGS) | in proc0.p_md.md_regs
-
- jra _C_LABEL(main) | main()
- PANIC("main() returned")
- /* NOTREACHED */
-
-/*
- * proc_trampoline: call function in register a2 with a3 as an arg
- * and then rei.
- */
-GLOBAL(proc_trampoline)
- movl %a3,%sp@- | push function arg
- jbsr %a2@ | call function
- addql #4,%sp | pop arg
- movl %sp@(FR_SP),%a0 | grab and load
- movl %a0,%usp | user SP
- moveml %sp@+,#0x7FFF | restore most user regs
- addql #8,%sp | toss SP and stack adjust
- jra _ASM_LABEL(rei) | and return
-
-
-/*
- * Trap/interrupt vector routines
- */
-#include <m68k/m68k/trap_subr.s>
-
- .data
-GLOBAL(m68k_fault_addr)
- .long 0
-
-#if defined(M68040)
-ENTRY_NOPROFILE(addrerr4060)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- movl %sp@(FR_HW+8),%sp@-
- clrl %sp@- | dummy code
- movl #T_ADDRERR,%sp@- | mark address error
- jra _ASM_LABEL(faultstkadj) | and deal with it
-
-ENTRY_NOPROFILE(buserr40)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- movl %sp@(FR_HW+20),%d1 | get fault address
- moveq #0,%d0
- movw %sp@(FR_HW+12),%d0 | get SSW
- btst #11,%d0 | check for mis-aligned
- jeq Lbe1stpg | no skip
- addl #3,%d1 | get into next page
- andl #PG_FRAME,%d1 | and truncate
-Lbe1stpg:
- movl %d1,%sp@- | pass fault address.
- movl %d0,%sp@- | pass SSW as code
- btst #10,%d0 | test ATC
- jeq Lberr40 | it is a bus error
- movl #T_MMUFLT,%sp@- | show that we are an MMU fault
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lberr40:
- tstl _C_LABEL(nofault) | catch bus error?
- jeq Lisberr | no, handle as usual
- movl %sp@(FR_HW+8+20),_C_LABEL(m68k_fault_addr) | save fault addr
- movl _C_LABEL(nofault),%sp@- | yes,
- jbsr _C_LABEL(longjmp) | longjmp(nofault)
- /* NOTREACHED */
-#endif
-
-#if defined(M68020) || defined(M68030)
-ENTRY_NOPROFILE(busaddrerr2030)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- moveq #0,%d0
- movw %sp@(FR_HW+10),%d0 | grab SSW for fault processing
- btst #12,%d0 | RB set?
- jeq LbeX0 | no, test RC
- bset #14,%d0 | yes, must set FB
- movw %d0,%sp@(FR_HW+10) | for hardware too
-LbeX0:
- btst #13,%d0 | RC set?
- jeq LbeX1 | no, skip
- bset #15,%d0 | yes, must set FC
- movw %d0,%sp@(FR_HW+10) | for hardware too
-LbeX1:
- btst #8,%d0 | data fault?
- jeq Lbe0 | no, check for hard cases
- movl %sp@(FR_HW+16),%d1 | fault address is as given in frame
- jra Lbe10 | thats it
-Lbe0:
- btst #4,%sp@(FR_HW+6) | long (type B) stack frame?
- jne Lbe4 | yes, go handle
- movl %sp@(FR_HW+2),%d1 | no, can use save PC
- btst #14,%d0 | FB set?
- jeq Lbe3 | no, try FC
- addql #4,%d1 | yes, adjust address
- jra Lbe10 | done
-Lbe3:
- btst #15,%d0 | FC set?
- jeq Lbe10 | no, done
- addql #2,%d1 | yes, adjust address
- jra Lbe10 | done
-Lbe4:
- movl %sp@(FR_HW+36),%d1 | long format, use stage B address
- btst #15,%d0 | FC set?
- jeq Lbe10 | no, all done
- subql #2,%d1 | yes, adjust address
-Lbe10:
- movl %d1,%sp@- | push fault VA
- movl %d0,%sp@- | and padded SSW
- movw %sp@(FR_HW+8+6),%d0 | get frame format/vector offset
- andw #0x0FFF,%d0 | clear out frame format
- cmpw #12,%d0 | address error vector?
- jeq Lisaerr | yes, go to it
- movl %d1,%a0 | fault address
- movl %sp@,%d0 | function code from ssw
- btst #8,%d0 | data fault?
- jne Lbe10a
- movql #1,%d0 | user program access FC
- | (we dont separate data/program)
- btst #5,%sp@(FR_HW+8) | supervisor mode?
- jeq Lbe10a | if no, done
- movql #5,%d0 | else supervisor program access
-Lbe10a:
- ptestr %d0,%a0@,#7 | do a table search
- pmove %psr,%sp@ | save result
- movb %sp@,%d1
- btst #2,%d1 | invalid (incl. limit viol. and berr)?
- jeq Lmightnotbemerr | no -> wp check
- btst #7,%d1 | is it MMU table berr?
- jne Lisberr1 | yes, needs not be fast.
-Lismerr:
- movl #T_MMUFLT,%sp@- | show that we are an MMU fault
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lmightnotbemerr:
- btst #3,%d1 | write protect bit set?
- jeq Lisberr1 | no: must be bus error
- movl %sp@,%d0 | ssw into low word of d0
- andw #0xc0,%d0 | Write protect is set on page:
- cmpw #0x40,%d0 | was it read cycle?
- jne Lismerr | no, was not WPE, must be MMU fault
- jra Lisberr1 | real bus err needs not be fast.
-Lisaerr:
- movl #T_ADDRERR,%sp@- | mark address error
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lisberr1:
- clrw %sp@ | re-clear pad word
- tstl _C_LABEL(nofault) | catch bus error?
- jeq Lisberr | no, handle as usual
- movl %sp@(FR_HW+8+16),_C_LABEL(m68k_fault_addr) | save fault addr
- movl _C_LABEL(nofault),%sp@- | yes,
- jbsr _C_LABEL(longjmp) | longjmp(nofault)
- /* NOTREACHED */
-#endif /* M68020 || M68030 */
-
-Lisberr: | also used by M68040/60
- movl #T_BUSERR,%sp@- | mark bus error
- jra _ASM_LABEL(faultstkadj) | and deal with it
-
-/*
- * FP exceptions.
- */
-ENTRY_NOPROFILE(fpfline)
-#if defined(M68040)
- cmpl #FPU_68040,_C_LABEL(fputype) | 68040 FPU?
- jne Lfp_unimp | no, skip FPSP
- cmpw #0x202c,%sp@(6) | format type 2?
- jne _C_LABEL(illinst) | no, not an FP emulation
-Ldofp_unimp:
-#ifdef FPSP
- jmp _ASM_LABEL(fpsp_unimp) | yes, go handle it
-#endif
-Lfp_unimp:
-#endif /* M68040 */
-#ifdef FPU_EMULATE
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save registers
- moveq #T_FPEMULI,%d0 | denote as FP emulation trap
- jra _ASM_LABEL(fault) | do it
-#else
- jra _C_LABEL(illinst)
-#endif
-
-ENTRY_NOPROFILE(fpunsupp)
-#if defined(M68040)
- cmpl #FPU_68040,_C_LABEL(fputype) | 68040 FPU?
- jne _C_LABEL(illinst) | no, treat as illinst
-#ifdef FPSP
- jmp _ASM_LABEL(fpsp_unsupp) | yes, go handle it
-#endif
-Lfp_unsupp:
-#endif /* M68040 */
-#ifdef FPU_EMULATE
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save registers
- moveq #T_FPEMULD,%d0 | denote as FP emulation trap
- jra _ASM_LABEL(fault) | do it
-#else
- jra _C_LABEL(illinst)
-#endif
-
-/*
- * Handles all other FP coprocessor exceptions.
- * Note that since some FP exceptions generate mid-instruction frames
- * and may cause signal delivery, we need to test for stack adjustment
- * after the trap call.
- */
-ENTRY_NOPROFILE(fpfault)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | and save
- movl %a0,%sp@(FR_SP) | the user stack pointer
- clrl %sp@- | no VA arg
- movl _C_LABEL(curpcb),%a0 | current pcb
- lea %a0@(PCB_FPCTX),%a0 | address of FP savearea
- fsave %a0@ | save state
-#if defined(M68040) || defined(M68060)
- /* always null state frame on 68040, 68060 */
- cmpl #FPU_68040,_C_LABEL(fputype)
- jge Lfptnull
-#endif
- tstb %a0@ | null state frame?
- jeq Lfptnull | yes, safe
- clrw %d0 | no, need to tweak BIU
- movb %a0@(1),%d0 | get frame size
- bset #3,%a0@(0,%d0:w) | set exc_pend bit of BIU
-Lfptnull:
- fmovem %fpsr,%sp@- | push fpsr as code argument
- frestore %a0@ | restore state
- movl #T_FPERR,%sp@- | push type arg
- jra _ASM_LABEL(faultstkadj) | call trap and deal with stack cleanup
-
-/*
- * Other exceptions only cause four and six word stack frame and require
- * no post-trap stack adjustment.
- */
-
-ENTRY_NOPROFILE(badtrap)
- moveml #0xC0C0,%sp@- | save scratch regs
- movw %sp@(22),%sp@- | push exception vector info
- clrw %sp@-
- movl %sp@(22),%sp@- | and PC
- jbsr _C_LABEL(straytrap) | report
- addql #8,%sp | pop args
- moveml %sp@+,#0x0303 | restore regs
- jra _ASM_LABEL(rei) | all done
-
-ENTRY_NOPROFILE(trap0)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- movl %d0,%sp@- | push syscall number
- jbsr _C_LABEL(syscall) | handle it
- addql #4,%sp | pop syscall arg
- tstl _C_LABEL(astpending)
- jne Lrei2
- tstl _C_LABEL(softpending)
- jeq Ltrap1
- movw #SPL1,%sr
- tstl _C_LABEL(softpending)
- jne Lsir1
-Ltrap1:
- movl %sp@(FR_SP),%a0 | grab and restore
- movl %a0,%usp | user SP
- moveml %sp@+,#0x7FFF | restore most registers
- addql #8,%sp | pop SP and stack adjust
- rte
-
-/*
- * Trap 1 - sigreturn
- */
-ENTRY_NOPROFILE(trap1)
- jra _ASM_LABEL(sigreturn)
-
-/*
- * Trap 2 - trace trap
- */
-ENTRY_NOPROFILE(trap2)
- jra _C_LABEL(trace)
-
-/*
- * Trap 12 is the entry point for the cachectl "syscall"
- * cachectl(command, addr, length)
- * command in d0, addr in a1, length in d1
- */
-ENTRY_NOPROFILE(trap12)
- movl %d1,%sp@- | push length
- movl %a1,%sp@- | push addr
- movl %d0,%sp@- | push command
- movl CURPROC,%sp@- | push proc pointer
- jbsr _C_LABEL(cachectl) | do it
- lea %sp@(16),%sp | pop args
- jra _ASM_LABEL(rei) | all done
-
-/*
- * Trace (single-step) trap. Kernel-mode is special.
- * User mode traps are simply passed on to trap().
- */
-ENTRY_NOPROFILE(trace)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@-
- moveq #T_TRACE,%d0
-
- | Check PSW and see what happened.
- | T=0 S=0 (should not happen)
- | T=1 S=0 trace trap from user mode
- | T=0 S=1 trace trap on a trap instruction
- | T=1 S=1 trace trap from system mode (kernel breakpoint)
-
- movw %sp@(FR_HW),%d1 | get PSW
- notw %d1 | XXX no support for T0 on 680[234]0
- andw #PSL_TS,%d1 | from system mode (T=1, S=1)?
- jeq Lkbrkpt | yes, kernel breakpoint
- jra _ASM_LABEL(fault) | no, user-mode fault
-
-/*
- * Trap 15 is used for:
- * - GDB breakpoints (in user programs)
- * - KGDB breakpoints (in the kernel)
- * - trace traps for SUN binaries (not fully supported yet)
- * User mode traps are simply passed to trap().
- */
-ENTRY_NOPROFILE(trap15)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@-
- moveq #T_TRAP15,%d0
- movw %sp@(FR_HW),%d1 | get PSW
- andw #PSL_S,%d1 | from system mode?
- jne Lkbrkpt | yes, kernel breakpoint
- jra _ASM_LABEL(fault) | no, user-mode fault
-
-Lkbrkpt: | Kernel-mode breakpoint or trace trap. (d0=trap_type)
- | Save the system sp rather than the user sp.
- movw #PSL_HIGHIPL,%sr | lock out interrupts
- lea %sp@(FR_SIZE),%a6 | Save stack pointer
- movl %a6,%sp@(FR_SP) | from before trap
-
- | If we are not on tmpstk switch to it.
- | (so debugger can change the stack pointer)
- movl %a6,%d1
- cmpl #_ASM_LABEL(tmpstk),%d1
- jls Lbrkpt2 | already on tmpstk
- | Copy frame to the temporary stack
- movl %sp,%a0 | a0=src
- lea _ASM_LABEL(tmpstk)-96,%a1 | a1=dst
- movl %a1,%sp | sp=new frame
- moveq #FR_SIZE,%d1
-Lbrkpt1:
- movl %a0@+,%a1@+
- subql #4,%d1
- bgt Lbrkpt1
-
-Lbrkpt2:
- | Call the trap handler for the kernel debugger.
- | Do not call trap() to do it, so that we can
- | set breakpoints in trap() if we want. We know
- | the trap type is either T_TRACE or T_BREAKPOINT.
- | If we have both DDB and KGDB, let KGDB see it first,
- | because KGDB will just return 0 if not connected.
- | Save args in d2, a2
- movl %d0,%d2 | trap type
- movl %sp,%a2 | frame ptr
-#ifdef KGDB
- | Let KGDB handle it (if connected)
- movl %a2,%sp@- | push frame ptr
- movl %d2,%sp@- | push trap type
- jbsr _C_LABEL(kgdb_trap) | handle the trap
- addql #8,%sp | pop args
- cmpl #0,%d0 | did kgdb handle it?
- jne Lbrkpt3 | yes, done
-#endif
-#ifdef DDB
- | Let DDB handle it
- movl %a2,%sp@- | push frame ptr
- movl %d2,%sp@- | push trap type
- jbsr _C_LABEL(kdb_trap) | handle the trap
- addql #8,%sp | pop args
-#if 0 /* not needed on hp300 */
- cmpl #0,%d0 | did ddb handle it?
- jne Lbrkpt3 | yes, done
-#endif
-#endif
- /* Sun 3 drops into PROM here. */
-Lbrkpt3:
- | The stack pointer may have been modified, or
- | data below it modified (by kgdb push call),
- | so push the hardware frame at the current sp
- | before restoring registers and returning.
-
- movl %sp@(FR_SP),%a0 | modified sp
- lea %sp@(FR_SIZE),%a1 | end of our frame
- movl %a1@-,%a0@- | copy 2 longs with
- movl %a1@-,%a0@- | ... predecrement
- movl %a0,%sp@(FR_SP) | sp = h/w frame
- moveml %sp@+,#0x7FFF | restore all but sp
- movl %sp@,%sp | ... and sp
- rte | all done
-
-/*
- * Use common m68k sigreturn.
- */
-#include <m68k/m68k/sigreturn.s>
-
-/*
- * Interrupt handlers.
- * All device interrupts are auto-vectored. The CPU provides
- * the vector 0x18+level. Note we count spurious interrupts, but
- * we don't do anything else with them.
- */
-
-#define INTERRUPT_SAVEREG moveml #0xC0C0,%sp@-
-#define INTERRUPT_RESTOREREG moveml %sp@+,#0x0303
-
-ENTRY_NOPROFILE(spurintr) /* level 0 */
- addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
- jra _ASM_LABEL(rei)
-
-ENTRY_NOPROFILE(intrhand) /* levels 2 through 5 */
- INTERRUPT_SAVEREG
- movw %sp@(22),%sp@- | push exception vector info
- clrw %sp@-
- jbsr _C_LABEL(intr_dispatch) | call dispatch routine
- addql #4,%sp
- INTERRUPT_RESTOREREG
- jra _ASM_LABEL(rei) | all done
-
-ENTRY_NOPROFILE(lev6intr) /* level 6: clock */
- INTERRUPT_SAVEREG
- CLKADDR(%a0)
- movb %a0@(CLKSR),%d0 | read clock status
-Lclkagain:
- btst #0,%d0 | clear timer1 int immediately to
- jeq Lnotim1 | minimize chance of losing another
- movpw %a0@(CLKMSB1),%d1 | due to statintr processing delay
- movl _C_LABEL(clkint),%d1 | clkcounter += clkint
- addl %d1,_C_LABEL(clkcounter)
-Lnotim1:
- btst #2,%d0 | timer3 interrupt?
- jeq Lnotim3 | no, skip statclock
- movpw %a0@(CLKMSB3),%d1 | clear timer3 interrupt
- lea %sp@(16),%a1 | a1 = &clockframe
- movl %d0,%sp@- | save status
- movl %a1,%sp@-
- jbsr _C_LABEL(statintr) | statintr(&frame)
- addql #4,%sp
- movl %sp@+,%d0 | restore pre-statintr status
- CLKADDR(%a0)
-Lnotim3:
- btst #0,%d0 | timer1 interrupt?
- jeq Lrecheck | no, skip hardclock
- lea %sp@(16),%a1 | a1 = &clockframe
- movl %a1,%sp@-
-#ifdef USELEDS
- tstl _C_LABEL(ledaddr) | using LEDs?
- jeq Lnoleds0 | no, skip this code
- movl _ASM_LABEL(heartbeat),%d0 | get tick count
- addql #1,%d0 | increment
- movl _C_LABEL(hz),%d1
- addl #50,%d1 | get the timing a little closer
- cmpl #0,_ASM_LABEL(beatstatus) | time to slow down?
- jeq Lslowthrob | yes, slow down
- lsrl #3,%d1 | no, fast throb
-Lslowthrob:
- lsrl #1,%d1 | slow throb
- cmpl %d0,%d1 | are we there yet?
- jne Lnoleds1 | no, nothing to do
- addl #1,_ASM_LABEL(beatstatus) | incr beat status
- cmpl #3,_ASM_LABEL(beatstatus) | time to reset?
- ble Ltwinkle | no, twinkle the lights
- movl #0,_ASM_LABEL(beatstatus) | reset the status indicator
-Ltwinkle:
- movl #LED_PULSE,%sp@-
- movl #LED_DISK+LED_LANRCV+LED_LANXMT,%sp@-
- clrl %sp@-
- jbsr _C_LABEL(ledcontrol) | toggle pulse, turn all others off
- lea %sp@(12),%sp
- movql #0,%d0
-Lnoleds1:
- movl %d0,_ASM_LABEL(heartbeat)
-Lnoleds0:
-#endif /* USELEDS */
- jbsr _C_LABEL(clockintr) | clockintr(&frame)
- addql #4,%sp
- CLKADDR(%a0)
-Lrecheck:
- addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS | chalk up another interrupt
- movb %a0@(CLKSR),%d0 | see if anything happened
- jmi Lclkagain | while we were in clockintr/statintr
-#if NAUDIO >0
- movw %sp@(22),%sp@- | push exception vector info
- clrw %sp@-
- jbsr _C_LABEL(intr_dispatch) | call dispatch routine
- addql #4,%sp
-#endif
- INTERRUPT_RESTOREREG
- jra _ASM_LABEL(rei) | all done
-
-ENTRY_NOPROFILE(lev7intr) /* level 7: parity errors, reset key */
- clrl %sp@-
- moveml #0xFFFF,%sp@- | save registers
- movl %usp,%a0 | and save
- movl %a0,%sp@(FR_SP) | the user stack pointer
- jbsr _C_LABEL(nmihand) | call handler
- movl %sp@(FR_SP),%a0 | restore
- movl %a0,%usp | user SP
- moveml %sp@+,#0x7FFF | and remaining registers
- addql #8,%sp | pop SP and stack adjust
- jra _ASM_LABEL(rei) | all done
-
-/*
- * Emulation of VAX REI instruction.
- *
- * This code deals with checking for and servicing ASTs
- * (profiling, scheduling) and software interrupts (network, softclock).
- * We check for ASTs first, just like the VAX. To avoid excess overhead
- * the T_ASTFLT handling code will also check for software interrupts so we
- * do not have to do it here. After identifing that we need an AST we
- * drop the IPL to allow device interrupts.
- *
- * This code is complicated by the fact that sendsig may have been called
- * necessitating a stack cleanup.
- */
-
-BSS(softpending,4)
-
-ASENTRY_NOPROFILE(rei)
- tstl _C_LABEL(astpending) | AST pending?
- jeq Lchksir | no, go check for SIR
-Lrei1:
- btst #5,%sp@ | yes, are we returning to user mode?
- jne Lchksir | no, go check for SIR
- movw #PSL_LOWIPL,%sr | lower SPL
- clrl %sp@- | stack adjust
- moveml #0xFFFF,%sp@- | save all registers
- movl %usp,%a1 | including
- movl %a1,%sp@(FR_SP) | the users SP
-Lrei2:
- clrl %sp@- | VA == none
- clrl %sp@- | code == none
- movl #T_ASTFLT,%sp@- | type == async system trap
- jbsr _C_LABEL(trap) | go handle it
- lea %sp@(12),%sp | pop value args
- movl %sp@(FR_SP),%a0 | restore user SP
- movl %a0,%usp | from save area
- movw %sp@(FR_ADJ),%d0 | need to adjust stack?
- jne Laststkadj | yes, go to it
- moveml %sp@+,#0x7FFF | no, restore most user regs
- addql #8,%sp | toss SP and stack adjust
- rte | and do real RTE
-Laststkadj:
- lea %sp@(FR_HW),%a1 | pointer to HW frame
- addql #8,%a1 | source pointer
- movl %a1,%a0 | source
- addw %d0,%a0 | + hole size = dest pointer
- movl %a1@-,%a0@- | copy
- movl %a1@-,%a0@- | 8 bytes
- movl %a0,%sp@(FR_SP) | new SSP
- moveml %sp@+,#0x7FFF | restore user registers
- movl %sp@,%sp | and our SP
- rte | and do real RTE
-Lchksir:
- tstl _C_LABEL(softpending) | SIR pending?
- jeq Ldorte | no, all done
- movl %d0,%sp@- | need a scratch register
- movw %sp@(4),%d0 | get SR
- andw #PSL_IPL7,%d0 | mask all but IPL
- jne Lnosir | came from interrupt, no can do
- movl %sp@+,%d0 | restore scratch register
-Lgotsir:
- movw #SPL1,%sr | prevent others from servicing int
- tstl _C_LABEL(softpending) | too late?
- jeq Ldorte | yes, oh well...
- clrl %sp@- | stack adjust
- moveml #0xFFFF,%sp@- | save all registers
- movl %usp,%a1 | including
- movl %a1,%sp@(FR_SP) | the users SP
-Lsir1:
- clrl %sp@- | VA == none
- clrl %sp@- | code == none
- movl #T_SSIR,%sp@- | type == software interrupt
- jbsr _C_LABEL(trap) | go handle it
- lea %sp@(12),%sp | pop value args
- movl %sp@(FR_SP),%a0 | restore
- movl %a0,%usp | user SP
- moveml %sp@+,#0x7FFF | and all remaining registers
- addql #8,%sp | pop SP and stack adjust
- rte
-Lnosir:
- movl %sp@+,%d0 | restore scratch register
-Ldorte:
- rte | real return
-
-/*
- * Use common m68k signal trampoline.
- */
-#include <m68k/m68k/sigcode.s>
-
-/*
- * Primitives
- */
-
-/*
- * Use common m68k support routines.
- */
-#include <m68k/m68k/support.s>
-
- .data
- .p2align 2
-GLOBAL(curpcb)
- .long 0
-
-ASBSS(nullpcb,SIZEOF_PCB)
-
-ENTRY_NOPROFILE(cpu_idle_cycle)
- stop #PSL_LOWIPL
- rts
-
-/*
- * cpu_switchto(struct proc *oldproc, struct proc *newproc)
- *
- * NOTE: On the mc68851 (318/319/330) we attempt to avoid flushing the
- * entire ATC. The effort involved in selective flushing may not be
- * worth it, maybe we should just flush the whole thing?
- *
- * NOTE 2: With the new VM layout we now no longer know if an inactive
- * user's PTEs have been changed (formerly denoted by the SPTECHG p_flag
- * bit). For now, we just always flush the full ATC.
- */
-ENTRY(cpu_switchto)
- movl %sp@(4), %d0 | oldproc
- beq Lswnofpsave | is NULL, don't save anything
-
- /*
- * Save state of previous process in its pcb.
- */
- movl _C_LABEL(curpcb),%a1
- movw %sr, %a1@(PCB_PS) | save sr before switching context
- moveml #0xFCFC,%a1@(PCB_REGS) | save non-scratch registers
- movl %usp,%a2 | grab USP (a2 has been saved)
- movl %a2,%a1@(PCB_USP) | and save it
-
- tstl _C_LABEL(fputype) | Do we have an FPU?
- jeq Lswnofpsave | No Then don't attempt save.
- lea %a1@(PCB_FPCTX),%a2 | pointer to FP save area
- fsave %a2@ | save FP state
- tstb %a2@ | null state frame?
- jeq Lswnofpsave | yes, all done
- fmovem %fp0-%fp7,%a2@(FPF_REGS) | save FP general registers
- fmovem %fpcr/%fpsr/%fpi,%a2@(FPF_FPCR) | save FP control registers
-
-Lswnofpsave:
- movl %sp@(8), %a0 | newproc
-
- movl %a0, CURPROC
- movb #SONPROC,%a0@(P_STAT)
- movl %a0@(P_ADDR),%a1 | get p_addr
- movl %a1,_C_LABEL(curpcb)
-
- /*
- * Activate process's address space.
- * XXX Should remember the last USTP value loaded, and call this
- * XXX only if it has changed.
- */
- pea %a0@ | push proc
- jbsr _C_LABEL(pmap_activate) | pmap_activate(p)
- addql #4,%sp
- movl _C_LABEL(curpcb),%a1 | restore p_addr
-
- lea _ASM_LABEL(tmpstk),%sp | now goto a tmp stack for NMI
-
- moveml %a1@(PCB_REGS),#0xFCFC | and registers
- movl %a1@(PCB_USP),%a0
- movl %a0,%usp | and USP
-
- tstl _C_LABEL(fputype) | If we don't have an FPU,
- jeq Lnofprest | don't try to restore it.
- lea %a1@(PCB_FPCTX),%a0 | pointer to FP save area
- tstb %a0@ | null state frame?
- jeq Lresfprest | yes, easy
-#if defined(M68040)
-#if defined(M68020) || defined(M68030)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jne Lresnot040 | no, skip
-#endif
- clrl %sp@- | yes...
- frestore %sp@+ | ...magic!
-Lresnot040:
-#endif
- fmovem %a0@(FPF_FPCR),%fpcr/%fpsr/%fpi | restore FP control registers
- fmovem %a0@(FPF_REGS),%fp0-%fp7 | restore FP general registers
-Lresfprest:
- frestore %a0@ | restore state
-
-Lnofprest:
- movw %a1@(PCB_PS),%sr | no, restore PS
- moveq #1,%d0 | return 1 (for alternate returns)
- rts
-
-/*
- * savectx(pcb)
- * Update pcb, saving current processor state.
- */
-ENTRY(savectx)
- movl %sp@(4),%a1
- movw %sr,%a1@(PCB_PS)
- movl %usp,%a0 | grab USP
- movl %a0,%a1@(PCB_USP) | and save it
- moveml #0xFCFC,%a1@(PCB_REGS) | save non-scratch registers
-
- tstl _C_LABEL(fputype) | Do we have FPU?
- jeq Lsvnofpsave | No? Then don't save state.
- lea %a1@(PCB_FPCTX),%a0 | pointer to FP save area
- fsave %a0@ | save FP state
- tstb %a0@ | null state frame?
- jeq Lsvnofpsave | yes, all done
- fmovem %fp0-%fp7,%a0@(FPF_REGS) | save FP general registers
- fmovem %fpcr/%fpsr/%fpi,%a0@(FPF_FPCR) | save FP control registers
-Lsvnofpsave:
- moveq #0,%d0 | return 0
- rts
-
-#if defined(M68040)
-ENTRY(suline)
- movl %sp@(4),%a0 | address to write
- movl _C_LABEL(curpcb),%a1 | current pcb
- movl #Lslerr,%a1@(PCB_ONFAULT) | where to return to on a fault
- movl %sp@(8),%a1 | address of line
- movl %a1@+,%d0 | get lword
- movsl %d0,%a0@+ | put lword
- nop | sync
- movl %a1@+,%d0 | get lword
- movsl %d0,%a0@+ | put lword
- nop | sync
- movl %a1@+,%d0 | get lword
- movsl %d0,%a0@+ | put lword
- nop | sync
- movl %a1@+,%d0 | get lword
- movsl %d0,%a0@+ | put lword
- nop | sync
- moveq #0,%d0 | indicate no fault
- jra Lsldone
-Lslerr:
- moveq #-1,%d0
-Lsldone:
- movl _C_LABEL(curpcb),%a1 | current pcb
- clrl %a1@(PCB_ONFAULT) | clear fault address
- rts
-#endif
-
-/*
- * Invalidate entire TLB.
- */
-ASENTRY_NOPROFILE(TBIA)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jne Lmotommu3 | no, skip
- .chip 68040
- pflusha
- rts
-Lmotommu3:
- .chip 68020
-#endif
- pflusha | flush entire TLB
- tstl _C_LABEL(mmutype)
- jpl Lmc68851a | 68851 implies no d-cache
- movl #DC_CLEAR,%d0
- movc %d0,%cacr | invalidate on-chip d-cache
-Lmc68851a:
- rts
-
-/*
- * Invalidate any TLB entry for given VA (TB Invalidate Single)
- */
-ENTRY(TBIS)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jne Lmotommu4 | no, skip
- .chip 68040
- movl %sp@(4),%a0
- movc %dfc,%d1
- moveq #FC_USERD,%d0 | user space
- movc %d0,%dfc
- pflush %a0@
- moveq #FC_SUPERD,%d0 | super space
- movc %d0,%dfc
- pflush %a0@
- movc %d1,%dfc
- rts
- .chip 68020
-Lmotommu4:
-#endif
- movl %sp@(4),%a0 | get addr to flush
- tstl _C_LABEL(mmutype)
- jpl Lmc68851b | is 68851?
- pflush #0,#0,%a0@ | flush address from both sides
- movl #DC_CLEAR,%d0
- movc %d0,%cacr | invalidate on-chip data cache
- rts
-Lmc68851b:
- pflushs #0,#0,%a0@ | flush address from both sides
- rts
-
-/*
- * Invalidate instruction cache
- */
-ENTRY(ICIA)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040
- jne Lmotommu7 | no, skip
- .chip 68040
- cinva %ic
- rts
- .chip 68020
-Lmotommu7:
-#endif
- movl #IC_CLEAR,%d0
- movc %d0,%cacr | invalidate i-cache
- rts
-
-/*
- * Invalidate data cache.
- * HP external cache allows for invalidation of user/supervisor portions.
- * NOTE: we do not flush 68030 on-chip cache as there are no aliasing
- * problems with DC_WA. The only cases we have to worry about are context
- * switch and TLB changes, both of which are handled "in-line" in resume
- * and TBI*.
- */
-ENTRY(DCIA)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040
- jne Lmotommu8 | no, skip
- .chip 68040
- cpusha %dc
- rts
- .chip 68020
-Lmotommu8:
-#endif
- rts
-
-ENTRY(DCIS)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040
- jne Lmotommu9 | no, skip
- .chip 68040
- cpusha %dc
- rts
- .chip 68020
-Lmotommu9:
-#endif
- rts
-
-ENTRY(DCIU)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040
- jne LmotommuA | no, skip
- .chip 68040
- cpusha %dc
- rts
- .chip 68020
-LmotommuA:
-#endif
- rts
-
-#if defined(M68040) || defined(CACHE_HAVE_PAC)
-ENTRY(PCIA)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040
- jne LmotommuB | no, skip
- .chip 68040
- cpusha %dc
- rts
- .chip 68020
-LmotommuB:
-#endif
-#if defined(CACHE_HAVE_PAC)
- /*
- * On non-68040 machines, PCIA() will only get invoked if
- * ectype == EC_PHYS, thus we do not need to test anything.
- */
- movl #DC_CLEAR,%d0
- movc %d0,%cacr | invalidate on-chip d-cache
- MMUADDR(%a0)
- andl #~MMU_CEN,%a0@(MMUCMD) | disable cache in MMU control reg
- orl #MMU_CEN,%a0@(MMUCMD) | reenable cache in MMU control reg
- rts
-#endif
-#endif
-
-#if defined(M68040)
- .chip 68040
-ENTRY(ICPA)
- cinva %ic
- rts
-ENTRY(DCFA)
- cpusha %dc
- rts
-ENTRY(ICPL)
- movl %sp@(4),%a0 | address
- cinvl %ic,%a0@
- rts
-ENTRY(ICPP)
- movl %sp@(4),%a0 | address
- cinvp %ic,%a0@
- rts
-ENTRY(DCPL)
- movl %sp@(4),%a0 | address
- cinvl %dc,%a0@
- rts
-ENTRY(DCPP)
- movl %sp@(4),%a0 | address
- cinvp %dc,%a0@
- rts
-ENTRY(DCFL)
- movl %sp@(4),%a0 | address
- cpushl %dc,%a0@
- rts
-ENTRY(DCFP)
- movl %sp@(4),%a0 | address
- cpushp %dc,%a0@
- rts
- .chip 68020
-#endif
-
-ENTRY(ecacheon)
- tstl _C_LABEL(ectype)
- jeq Lnocache7
- MMUADDR(%a0)
- orl #MMU_CEN,%a0@(MMUCMD)
-Lnocache7:
- rts
-
-ENTRY(ecacheoff)
- tstl _C_LABEL(ectype)
- jeq Lnocache8
- MMUADDR(%a0)
- andl #~MMU_CEN,%a0@(MMUCMD)
-Lnocache8:
- rts
-
-ENTRY_NOPROFILE(getsfc)
- movc %sfc,%d0
- rts
-
-ENTRY_NOPROFILE(getdfc)
- movc %dfc,%d0
- rts
-
-/*
- * Load a new user segment table pointer.
- */
-ENTRY(loadustp)
- movl %sp@(4),%d0 | new USTP
- moveq #PGSHIFT,%d1
- lsll %d1,%d0 | convert to addr
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jne LmotommuC | no, skip
- .chip 68040
- pflusha
- movc %d0,%urp
- rts
- .chip 68020
-LmotommuC:
-#endif
- pflusha | flush entire TLB
- lea _ASM_LABEL(protorp),%a0 | CRP prototype
- movl %d0,%a0@(4) | stash USTP
- pmove %a0@,%crp | load root pointer
- movl #CACHE_CLR,%d0
- movc %d0,%cacr | invalidate cache(s)
- rts
-
-/*
- * Set processor priority level calls. Most are implemented with
- * inline asm expansions. However, spl0 requires special handling
- * as we need to check for our emulated software interrupts.
- */
-
-ENTRY(spl0)
- moveq #0,%d0
- movw %sr,%d0 | get old SR for return
- movw #PSL_LOWIPL,%sr | restore new SR
- tstl _C_LABEL(softpending) | software interrupt pending?
- jeq Lspldone | no, all done
- subql #4,%sp | make room for RTE frame
- movl %sp@(4),%sp@(2) | position return address
- clrw %sp@(6) | set frame type 0
- movw #PSL_LOWIPL,%sp@ | and new SR
- jra Lgotsir | go handle it
-Lspldone:
- rts
-
-/*
- * _delay(u_int N)
- *
- * Delay for at least (N/256) microseconds.
- * This routine depends on the variable: delay_divisor
- * which should be set based on the CPU clock rate.
- */
-ENTRY_NOPROFILE(_delay)
- | d0 = arg = (usecs << 8)
- movl %sp@(4),%d0
- | d1 = delay_divisor
- movl _C_LABEL(delay_divisor),%d1
- jra L_delay /* Jump into the loop! */
-
- /*
- * Align the branch target of the loop to a half-line (8-byte)
- * boundary to minimize cache effects. This guarantees both
- * that there will be no prefetch stalls due to cache line burst
- * operations and that the loop will run from a single cache
- * half-line.
- */
- .balign 8
-L_delay:
- subl %d1,%d0
- jgt L_delay
- rts
-
-/*
- * Save and restore 68881 state.
- */
-ENTRY(m68881_save)
- movl %sp@(4),%a0 | save area pointer
- fsave %a0@ | save state
- tstb %a0@ | null state frame?
- jeq Lm68881sdone | yes, all done
- fmovem %fp0-%fp7,%a0@(FPF_REGS) | save FP general registers
- fmovem %fpcr/%fpsr/%fpi,%a0@(FPF_FPCR) | save FP control registers
-Lm68881sdone:
- rts
-
-ENTRY(m68881_restore)
- movl %sp@(4),%a0 | save area pointer
- tstb %a0@ | null state frame?
- jeq Lm68881rdone | yes, easy
- fmovem %a0@(FPF_FPCR),%fpcr/%fpsr/%fpi | restore FP control registers
- fmovem %a0@(FPF_REGS),%fp0-%fp7 | restore FP general registers
-Lm68881rdone:
- frestore %a0@ | restore state
- rts
-
-/*
- * Probe a memory address, and see if it causes a bus error.
- * This function is only to be used in physical mode, and before our
- * trap vectors are initialized.
- * Invoke with address to probe in a0.
- * Alters: a3 d0 d1
- */
-#define BUSERR 0xfffffffc
-ASLOCAL(phys_badaddr)
- ASRELOC(_bsave,%a3)
- movl BUSERR,%a3@ | save ROM bus errror handler
- ASRELOC(_ssave,%a3)
- movl %sp,%a3@ | and current stack pointer
- ASRELOC(catchbad,%a3)
- movl %a3,BUSERR | plug in our handler
- movw %a0@,%d1 | access address
- ASRELOC(_bsave,%a3) | no fault!
- movl %a3@,BUSERR
- clrl %d0 | return success
- rts
-ASLOCAL(catchbad)
- ASRELOC(_bsave,%a3) | got a bus error, so restore handler
- movl %a3@,BUSERR
- ASRELOC(_ssave,%a3)
- movl %a3@,%sp | and stack
- moveq #1,%d0 | return fault
- rts
-#undef BUSERR
-
- .data
- .p2align 2
-ASLOCAL(_bsave)
- .long 0
-ASLOCAL(_ssave)
- .long 0
- .text
-
-/*
- * Handle the nitty-gritty of rebooting the machine.
- * Basically we just turn off the MMU and jump to the appropriate ROM routine.
- * Note that we must be running in an address range that is mapped one-to-one
- * logical to physical so that the PC is still valid immediately after the MMU
- * is turned off. We have conveniently mapped the last page of physical
- * memory this way.
- */
-ENTRY_NOPROFILE(doboot)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jeq Lnocache5 | yes, skip
-#endif
- movl #CACHE_OFF,%d0
- movc %d0,%cacr | disable on-chip cache(s)
- tstl _C_LABEL(ectype) | external cache?
- jeq Lnocache5 | no, skip
- MMUADDR(%a0)
- andl #~MMU_CEN,%a0@(MMUCMD) | disable external cache
-Lnocache5:
- lea MAXADDR,%a0 | last page of physical memory
- movl _C_LABEL(boothowto),%a0@+ | store howto
- movl _C_LABEL(bootdev),%a0@+ | and devtype
- lea Lbootcode,%a1 | start of boot code
- lea Lebootcode,%a3 | end of boot code
-Lbootcopy:
- movw %a1@+,%a0@+ | copy a word
- cmpl %a3,%a1 | done yet?
- jcs Lbootcopy | no, keep going
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jne LmotommuE | no, skip
- .chip 68040
- cpusha %bc
-LmotommuE:
- .chip 68020
-#endif
- jmp MAXADDR+8 | jump to last page
-
-Lbootcode:
- lea MAXADDR+0x800,%sp | physical SP in case of NMI
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jne LmotommuF | no, skip
- .chip 68040
- movl #0,%d0
- movc %d0,%cacr | caches off
- movc %d0,%tc
- movl %d2,MAXADDR+NBPG-4 | restore old high page contents
- DOREBOOT
- .chip 68020
-LmotommuF:
-#endif
- movl #0,%a0@ | value for pmove to TC (turn off MMU)
- pmove %a0@,%tc | disable MMU
- DOREBOOT
-Lebootcode:
-
-/*
- * Misc. global variables.
- */
- .data
- .p2align 2
-GLOBAL(machineid)
- .long -1 | default to unknown
-
-GLOBAL(mmuid)
- .long 0 | default to nothing
-
-GLOBAL(mmutype)
- .long 0 | default to unknown
-
-GLOBAL(cputype)
- .long CPU_68020 | default to 68020 CPU
-
-GLOBAL(ectype)
- .long EC_NONE | external cache type, default to none
-
-GLOBAL(fputype)
- .long FPU_68882 | default to 68882 FPU
-
-ASLOCAL(protorp)
- .long 0,0 | prototype root pointer
-
-ASLOCAL(mmuscratch)
- .long 0 | scratch space for 68851/68030 MMU operation
-
-GLOBAL(internalhpib)
- .long 1 | has internal HP-IB, default to yes
-
-GLOBAL(cold)
- .long 1 | cold start flag
-
-GLOBAL(want_resched)
- .long 0
-
-GLOBAL(proc0paddr)
- .long 0 | KVA of proc0 u-area
-
-GLOBAL(intiobase)
- .long 0 | KVA of base of internal IO space
-
-GLOBAL(intiolimit)
- .long 0 | KVA of end of internal IO space
-
-GLOBAL(extiobase)
- .long 0 | KVA of base of external IO space
-
-GLOBAL(eiomapsize)
- .long 0 | size of external IO space in pages
-
-GLOBAL(CLKbase)
- .long 0 | KVA of base of clock registers
-
-GLOBAL(MMUbase)
- .long 0 | KVA of base of HP MMU registers
-
-#ifdef USELEDS
-ASLOCAL(heartbeat)
- .long 0 | clock ticks since last pulse of heartbeat
-
-ASLOCAL(beatstatus)
- .long 0 | for determining a fast or slow throb
-#endif
diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c
deleted file mode 100644
index d4808dfddf6..00000000000
--- a/sys/arch/hp300/hp300/machdep.c
+++ /dev/null
@@ -1,1038 +0,0 @@
-/* $OpenBSD: machdep.c,v 1.141 2014/03/13 03:52:55 dlg Exp $ */
-/* $NetBSD: machdep.c,v 1.121 1999/03/26 23:41:29 mycroft 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.
- *
- * from: Utah $Hdr: machdep.c 1.74 92/12/20$
- *
- * @(#)machdep.c 8.10 (Berkeley) 4/20/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/timeout.h>
-#include <sys/conf.h>
-#include <sys/exec.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/extent.h>
-#include <sys/mbuf.h>
-#include <sys/mount.h>
-#include <sys/msgbuf.h>
-#include <sys/proc.h>
-#include <sys/reboot.h>
-#include <sys/signalvar.h>
-#include <sys/tty.h>
-#include <sys/user.h>
-#include <sys/exec.h>
-#include <sys/core.h>
-#include <sys/kcore.h>
-#include <sys/vnode.h>
-#include <sys/sysctl.h>
-#include <sys/syscallargs.h>
-#include <sys/syslog.h>
-
-#include <machine/db_machdep.h>
-#ifdef DDB
-#include <ddb/db_var.h>
-#endif
-#include <ddb/db_sym.h>
-#include <ddb/db_extern.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-#include <machine/kcore.h>
-#include <machine/reg.h>
-#include <machine/psl.h>
-#include <machine/pte.h>
-
-#include <dev/cons.h>
-
-#include <net/if.h>
-#include <uvm/uvm_extern.h>
-#include <uvm/uvm_swap.h>
-
-#ifdef USELEDS
-#include <hp300/hp300/leds.h>
-#endif
-
-/* the following is used externally (sysctl_hw) */
-char machine[] = MACHINE; /* from <machine/param.h> */
-
-struct vm_map *exec_map = NULL;
-struct vm_map *phys_map = NULL;
-
-extern paddr_t avail_start, avail_end;
-
-int physmem; /* size of physical memory, in pages */
-
-struct uvm_constraint_range dma_constraint = { 0x0, (paddr_t)-1 };
-struct uvm_constraint_range *uvm_md_constraints[] = { NULL };
-
-/*
- * safepri is a safe priority for sleep to set for a spin-wait
- * during autoconfiguration or after a panic.
- */
-int safepri = PSL_LOWIPL;
-
-extern u_int lowram;
-extern short exframesize[];
-
-/*
- * Some storage space must be allocated statically because of the
- * early console initialization.
- */
-char extiospace[EXTENT_FIXED_STORAGE_SIZE(8)];
-extern int eiomapsize;
-
-/* prototypes for local functions */
-void parityenable(void);
-int parityerror(struct frame *);
-int parityerrorfind(void);
-void identifycpu(void);
-void initcpu(void);
-void dumpmem(int *, int, int);
-char *hexstr(int, int);
-
-/* functions called from locore.s */
-void dumpsys(void);
-void hp300_init(void);
-void straytrap(int, u_short);
-void nmihand(struct frame);
-
-/*
- * Select code of console. Set to CONSCODE_INTERNAL if console is on
- * "internal" framebuffer.
- */
-int conscode;
-caddr_t conaddr; /* for drivers in cn_init() */
-int convasize; /* size of mapped console device */
-
-/*
- * Note that the value of delay_divisor is roughly
- * 2048 / cpuspeed (where cpuspeed is in MHz) on 68020
- * and 68030 systems. See clock.c for the delay
- * calibration algorithm.
- */
-int cpuspeed; /* relative cpu speed */
-int delay_divisor; /* delay constant */
-
- /*
- * Early initialization, before main() is called.
- */
-void
-hp300_init()
-{
- /*
- * Tell the VM system about available physical memory. The
- * hp300 only has one segment.
- */
- uvm_page_physload(atop(avail_start), atop(avail_end),
- atop(avail_start), atop(avail_end), 0);
-
- /* Initialize the interrupt handlers. */
- intr_init();
-
- /* Calibrate the delay loop. */
- hp300_calibrate_delay();
-}
-
-/*
- * Console initialization: called early on from main,
- * before vm init or startup. Do enough configuration
- * to choose and initialize a console.
- */
-void
-consinit()
-{
- extern struct extent *extio;
- extern char *extiobase;
-
- /*
- * Initialize some variables for sanity.
- */
- convasize = 0;
- conscode = CONSCODE_INVALID;
-
- /*
- * Initialize the bus extent.
- */
- extio = extent_create("extio",
- (u_long)extiobase, (u_long)extiobase + ptoa(eiomapsize),
- M_DEVBUF, extiospace, sizeof(extiospace), EX_NOWAIT);
-
- /*
- * Initialize the console before we print anything out.
- */
- hp300_cninit();
-
-#ifdef DDB
- ddb_init();
- if (boothowto & RB_KDB)
- Debugger();
-#endif
-}
-
-/*
- * cpu_startup: allocate memory for variable-sized tables,
- * initialize cpu, and do autoconfiguration.
- */
-void
-cpu_startup()
-{
- extern char *etext;
- unsigned i;
- vaddr_t minaddr, maxaddr;
-#ifdef DEBUG
- extern int pmapdebug;
- int opmapdebug = pmapdebug;
-
- pmapdebug = 0;
-#endif
-
- /*
- * Now that VM services are available, give another chance at
- * console devices to initialize, if they could not before.
- */
- hp300_cninit();
-
- /*
- * Initialize error message buffer (at end of core).
- * avail_end was pre-decremented in pmap_bootstrap to compensate.
- */
- for (i = 0; i < atop(MSGBUFSIZE); i++)
- pmap_enter(pmap_kernel(), (vaddr_t)msgbufp + i * NBPG,
- avail_end + i * NBPG, VM_PROT_READ|VM_PROT_WRITE,
- VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
- pmap_update(pmap_kernel());
- initmsgbuf((caddr_t)msgbufp, round_page(MSGBUFSIZE));
-
- /*
- * Good {morning,afternoon,evening,night}.
- */
- printf(version);
- identifycpu();
- printf("real mem = %u (%uMB)\n", ptoa(physmem),
- ptoa(physmem)/1024/1024);
-
- /*
- * 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);
-
- /*
- * Allocate a submap for physio
- */
- phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
- VM_PHYS_SIZE, 0, FALSE, NULL);
-
-#ifdef DEBUG
- pmapdebug = opmapdebug;
-#endif
- printf("avail mem = %lu (%luMB)\n", ptoa(uvmexp.free),
- ptoa(uvmexp.free)/1024/1024);
-
- /*
- * Tell the VM system that page 0 isn't mapped.
- *
- * XXX This is bogus; should just fix KERNBASE and
- * XXX VM_MIN_KERNEL_ADDRESS, but not right now.
- */
- if (uvm_map_protect(kernel_map, 0, NBPG, UVM_PROT_NONE, TRUE))
- panic("can't mark page 0 off-limits");
-
- /*
- * Tell the VM system that writing to kernel text isn't allowed.
- * If we don't, we might end up COW'ing the text segment!
- *
- * XXX Should be trunc_page(&kernel_text) instead
- * XXX of NBPG.
- */
- if (uvm_map_protect(kernel_map, NBPG, round_page((vaddr_t)&etext),
- UVM_PROT_READ|UVM_PROT_EXEC, TRUE))
- panic("can't protect kernel text");
-
- /*
- * Set up CPU-specific registers, cache, etc.
- */
- initcpu();
-
- /*
- * Set up buffers, so they can be used to read disk labels.
- */
- bufinit();
-
- /*
- * Configure the system.
- */
- if (boothowto & RB_CONFIG) {
-#ifdef BOOT_CONFIG
- user_config();
-#else
- printf("kernel does not support -c; continuing..\n");
-#endif
- }
-}
-
-/*
- * Info for CTL_HW
- */
-char cpu_model[120];
-
-/*
- * Text description of models we support, indexed by machineid.
- */
-const char *hp300_models[] = {
- "320", /* HP_320 */
- "318/319/330", /* HP_330 */
- "350", /* HP_350 */
- "360", /* HP_36X */
- "370", /* HP_370 */
- "340", /* HP_340 */
- "345", /* HP_345 */
- "375", /* HP_375 */
- "400", /* HP_400 */
- "380", /* HP_380 */
- "425", /* HP_425 */
- "433", /* HP_433 */
- "385", /* HP_385 */
- "382", /* HP_382 */
-};
-
-/* Map mmuid to single letter designation in 4xx models (e.g. 425s, 425t) */
-char hp300_designations[] = " ttss e";
-
-void
-identifycpu()
-{
- const char *t;
- char mc, *td;
- int len;
-#ifdef FPSP
- extern u_long fpvect_tab, fpvect_end, fpsp_tab;
-#endif
-
- /*
- * Map machineid to model name.
- */
- if (machineid >= sizeof(hp300_models) / sizeof(char *)) {
- printf("\nunknown machineid %d\n", machineid);
- goto lose;
- }
- t = hp300_models[machineid];
-
- /*
- * Look up special designation (425s, 425t, etc) by mmuid.
- */
- if (mmuid < strlen(hp300_designations) &&
- hp300_designations[mmuid] != ' ') {
- td = &hp300_designations[mmuid];
- td[1] = '\0';
- } else
- td = "";
-
- /*
- * ...and the CPU type
- */
- switch (cputype) {
- case CPU_68040:
- mc = '4';
- /* adjust cpuspeed by 3/8 on '040 boxes */
- cpuspeed *= 3;
- cpuspeed /= 8;
- break;
- case CPU_68030:
- mc = '3';
- break;
- case CPU_68020:
- mc = '2';
- break;
- default:
- printf("\nunknown cputype %d\n", cputype);
- goto lose;
- }
- snprintf(cpu_model, sizeof cpu_model,
- "HP 9000/%s%s (%dMHz MC680%c0 CPU", t, td, cpuspeed, mc);
-
- /*
- * ...and the MMU type.
- */
- switch (mmutype) {
- case MMU_68040:
- case MMU_68030:
- strlcat(cpu_model, "+MMU", sizeof cpu_model);
- break;
- case MMU_68851:
- strlcat(cpu_model, ", MC68851 MMU", sizeof cpu_model);
- break;
- default:
- printf("%s\nunknown MMU type %d\n", cpu_model, mmutype);
- panic("startup");
- }
-
- /*
- * ...and the FPU type.
- */
- switch (fputype) {
- case FPU_68040:
- strlcat(cpu_model, "+FPU", sizeof cpu_model);
- break;
- case FPU_68882:
- len = strlen(cpu_model);
- snprintf(cpu_model + len, sizeof cpu_model - len,
- ", %dMHz MC68882 FPU", cpuspeed);
- break;
- case FPU_68881:
- len = strlen(cpu_model);
- snprintf(cpu_model + len, sizeof cpu_model - len,
- ", %dMHz MC68881 FPU", machineid == HP_350 ? 20 : 16);
- break;
- default:
- strlcat(cpu_model, ", unknown FPU", sizeof cpu_model);
- }
-
- /*
- * ...and finally, the cache type.
- */
- if (cputype == CPU_68040)
- strlcat(cpu_model, ", 4k on-chip physical I/D caches",
- sizeof cpu_model);
- else {
- len = strlen(cpu_model);
- switch (ectype) {
- case EC_VIRT:
- snprintf(cpu_model + len, sizeof cpu_model - len,
- ", %dK virtual-address cache",
- machineid == HP_320 ? 16 : 32);
- break;
- case EC_PHYS:
- snprintf(cpu_model + len, sizeof cpu_model - len,
- ", %dK physical-address cache",
- machineid == HP_370 ? 64 : 32);
- break;
- }
- }
-
- printf("%s)\n", cpu_model);
-#ifdef DEBUG
- printf("cpu: delay divisor %d", delay_divisor);
- if (mmuid)
- printf(", mmuid %d", mmuid);
- printf("\n");
-#endif
-
- /*
- * Now that we have told the user what they have,
- * let them know if that machine type isn't configured.
- */
- switch (machineid) {
- case -1: /* keep compilers happy */
-#if !defined(HP320)
- case HP_320:
-#endif
-#if !defined(HP330)
- case HP_330:
-#endif
-#if !defined(HP340)
- case HP_340:
-#endif
-#if !defined(HP345)
- case HP_345:
-#endif
-#if !defined(HP350)
- case HP_350:
-#endif
-#if !defined(HP360) && !defined(HP_362)
- case HP_36X:
-#endif
-#if !defined(HP370)
- case HP_370:
-#endif
-#if !defined(HP375)
- case HP_375:
-#endif
-#if !defined(HP380)
- case HP_380:
-#endif
-#if !defined(HP382)
- case HP_382:
-#endif
-#if !defined(HP385)
- case HP_385:
-#endif
-#if !defined(HP400)
- case HP_400:
-#endif
-#if !defined(HP425)
- case HP_425:
-#endif
-#if !defined(HP433)
- case HP_433:
-#endif
- panic("SPU type not configured for machineid %d", machineid);
- default:
- break;
- }
-
-#ifdef FPSP
- if (cputype == CPU_68040) {
- bcopy(&fpsp_tab, &fpvect_tab,
- (&fpvect_end - &fpvect_tab) * sizeof (fpvect_tab));
- }
-#endif
-
- return;
-lose:
- panic("startup");
-}
-
-/*
- * machine dependent system variables.
- */
-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;
-{
- 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_CPUSPEED:
- return (sysctl_rdint(oldp, oldlenp, newp, cpuspeed));
- case CPU_MACHINEID:
- return (sysctl_rdint(oldp, oldlenp, newp, machineid));
- case CPU_MMUID:
- return (sysctl_rdint(oldp, oldlenp, newp, mmuid));
- default:
- return (EOPNOTSUPP);
- }
- /* NOTREACHED */
-}
-
-int waittime = -1;
-
-void
-boot(howto)
- int howto;
-{
- struct device *mainbus;
-
- /* take a snap shot before clobbering any registers */
- if (curproc && curproc->p_addr)
- savectx(&curproc->p_addr->u_pcb);
-
- /*
- * Prevent mi code from spinning disks off, in case the operator
- * changes his mind and prefers to reboot - we can't power down
- * the machine, and it will not send a spin up command to the
- * disks.
- */
- howto &= ~RB_POWERDOWN;
-
- /* If system is cold, just halt. */
- if (cold) {
- /* (Unless the user explicitly asked for reboot.) */
- if ((howto & RB_USERREQ) == 0)
- howto |= RB_HALT;
- goto haltsys;
- }
-
- boothowto = howto;
- if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
- waittime = 0;
- vfs_shutdown();
- /*
- * If we've been adjusting the clock, the todr
- * will be out of synch; adjust it now unless
- * the system was sitting in ddb.
- */
- if ((howto & RB_TIMEBAD) == 0) {
- resettodr();
- } else {
- printf("WARNING: not updating battery clock\n");
- }
- }
- if_downall();
-
- uvm_shutdown();
- splhigh(); /* Disable interrupts. */
-
- /* If rebooting and a dump is requested do it. */
- if (howto & RB_DUMP)
- dumpsys();
-
-haltsys:
- doshutdownhooks();
- mainbus = device_mainbus();
- if (mainbus != NULL)
- config_suspend(mainbus, DVACT_POWERDOWN);
-
- /* Finally, halt/reboot the system. */
- if (howto & RB_HALT) {
- printf("System halted. Hit any key to reboot.\n\n");
- cnpollc(1);
- while (cngetc() == 0);
- cnpollc(0);
- }
-
- printf("rebooting...\n");
- DELAY(1000000);
- doboot();
- /*NOTREACHED*/
-}
-
-/*
- * These variables are needed by /sbin/savecore
- */
-u_long dumpmag = 0x8fca0101; /* magic number */
-int dumpsize = 0; /* pages */
-long dumplo = 0; /* blocks */
-cpu_kcore_hdr_t cpu_kcore_hdr;
-
-/*
- * This is called by configure to set dumplo and dumpsize.
- * Dumps always skip the first PAGE_SIZE of disk space
- * in case there might be a disk label stored there.
- * If there is extra space, put dump at the end to
- * reduce the chance that swapping trashes it.
- */
-void
-dumpconf(void)
-{
- int nblks; /* size of dump area */
-
- if (dumpdev == NODEV ||
- (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0)
- return;
- if (nblks <= ctod(1))
- return;
-
- /*
- * Since lowram starts two pages after the beginning of memory,
- * we're not dumping exactly all the memory.
- */
- dumpsize = physmem - 2;
-
- /* hp300 only uses a single segment. */
- cpu_kcore_hdr.ram_segs[0].start = lowram;
- cpu_kcore_hdr.ram_segs[0].size = ptoa(dumpsize);
- cpu_kcore_hdr.mmutype = mmutype;
- cpu_kcore_hdr.kernel_pa = lowram;
- cpu_kcore_hdr.sysseg_pa = pmap_kernel()->pm_stpa;
-
- /* Always skip the first block, in case there is a label there. */
- if (dumplo < ctod(1))
- dumplo = ctod(1);
-
- /* Put dump at end of partition, and make it fit. */
- if (dumpsize > dtoc(nblks - dumplo))
- dumpsize = dtoc(nblks - dumplo);
- if (dumplo < nblks - ctod(dumpsize))
- dumplo = nblks - ctod(dumpsize);
-}
-
-/*
- * Dump physical memory onto the dump device. Called by doadump()
- * in locore.s or by boot() here in machdep.c
- */
-void
-dumpsys()
-{
- daddr_t blkno; /* current block to write */
- /* dump routine */
- int (*dump)(dev_t, daddr_t, caddr_t, size_t);
- int pg; /* page being dumped */
- paddr_t maddr; /* PA being dumped */
- int error; /* error code from (*dump)() */
- 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;
-
- /* XXX initialized here because of gcc lossage */
- maddr = lowram;
- pg = 0;
-
- /* Don't put dump messages in msgbuf. */
- msgbufmapped = 0;
-
- /* Make sure dump device is valid. */
- if (dumpdev == NODEV)
- return;
- if (dumpsize == 0) {
- dumpconf();
- if (dumpsize == 0)
- return;
- }
- if (dumplo <= 0) {
- printf("\ndump to dev %u,%u not possible\n", major(dumpdev),
- minor(dumpdev));
- return;
- }
- dump = bdevsw[major(dumpdev)].d_dump;
- blkno = dumplo;
-
- printf("\ndumping to dev %u,%u offset %ld\n", major(dumpdev),
- minor(dumpdev), dumplo);
-
-#ifdef UVM_SWAP_ENCRYPT
- uvm_swap_finicrypt_all();
-#endif
-
- 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));
-
- /*
- * Generate a segment header
- */
- CORE_SETMAGIC(*kseg_p, KCORE_MAGIC, MID_MACHINE, CORE_CPU);
- kseg_p->c_size = dbtob(1) - ALIGN(sizeof(*kseg_p));
-
- /*
- * Add the md header
- */
-
- *chdr_p = cpu_kcore_hdr;
-
- printf("dump ");
- maddr = cpu_kcore_hdr.ram_segs[0].start;
- /* Dump the header. */
- error = (*dump) (dumpdev, blkno++, (caddr_t)dump_hdr, dbtob(1));
- switch (error) {
- case 0:
- break;
-
- case ENXIO:
- printf("device bad\n");
- return;
-
- case EFAULT:
- printf("device not ready\n");
- return;
-
- case EINVAL:
- printf("area improper\n");
- return;
-
- case EIO:
- printf("i/o error\n");
- return;
-
- case EINTR:
- printf("aborted from console\n");
- return;
-
- default:
- printf("error %d\n", error);
- return;
- }
- for (pg = 0; pg < dumpsize; pg++) {
-#define NPGMB (1024*1024/NBPG)
- /* print out how many MBs we have dumped */
- if (pg && (pg % NPGMB) == 0)
- printf("%d ", pg / NPGMB);
-#undef NPGMB
- pmap_enter(pmap_kernel(), (vaddr_t)vmmap, maddr,
- VM_PROT_READ, VM_PROT_READ|PMAP_WIRED);
-
- pmap_update(pmap_kernel());
- error = (*dump)(dumpdev, blkno, vmmap, NBPG);
- switch (error) {
- case 0:
- maddr += NBPG;
- blkno += btodb(NBPG);
- break;
-
- case ENXIO:
- printf("device bad\n");
- return;
-
- case EFAULT:
- printf("device not ready\n");
- return;
-
- case EINVAL:
- printf("area improper\n");
- return;
-
- case EIO:
- printf("i/o error\n");
- return;
-
- case EINTR:
- printf("aborted from console\n");
- return;
-
- default:
- printf("error %d\n", error);
- return;
- }
- }
- printf("succeeded\n");
-}
-
-void
-initcpu()
-{
-
- parityenable();
-#ifdef USELEDS
- ledinit();
-#endif
-}
-
-void
-straytrap(pc, evec)
- int pc;
- u_short evec;
-{
- printf("unexpected trap (vector offset %x) from %x\n",
- evec & 0xFFF, pc);
-}
-
-/* XXX should change the interface, and make one badaddr() function */
-
-int *nofault;
-
-int
-badaddr(addr)
- caddr_t addr;
-{
- int i;
- label_t faultbuf;
-
- nofault = (int *) &faultbuf;
- if (setjmp((label_t *)nofault)) {
- nofault = (int *) 0;
- return(1);
- }
- i = *(volatile short *)addr;
- nofault = (int *) 0;
- return(0);
-}
-
-int
-badbaddr(addr)
- caddr_t addr;
-{
- int i;
- label_t faultbuf;
-
- nofault = (int *) &faultbuf;
- if (setjmp((label_t *)nofault)) {
- nofault = (int *) 0;
- return(1);
- }
- i = *(volatile char *)addr;
- nofault = (int *) 0;
- return(0);
-}
-
-static int innmihand; /* simple mutex */
-
-/*
- * Level 7 interrupts can be caused by HIL keyboards (in cooked mode only,
- * but we run them in raw mode) or parity errors.
- */
-void
-nmihand(frame)
- struct frame frame;
-{
-
- /* Prevent unwanted recursion. */
- if (innmihand)
- return;
- innmihand = 1;
-
- if (parityerror(&frame)) {
- innmihand = 0;
- return;
- }
-
- /* panic?? */
- printf("unexpected level 7 interrupt ignored\n");
-
- innmihand = 0;
-}
-
-/*
- * Parity error section. Contains magic.
- */
-#define PARREG ((volatile short *)IIOV(0x5B0000))
-static int gotparmem = 0;
-#ifdef DEBUG
-int ignorekperr = 0; /* ignore kernel parity errors */
-#endif
-
-/*
- * Enable parity detection
- */
-void
-parityenable()
-{
- label_t faultbuf;
-
- nofault = (int *) &faultbuf;
- if (setjmp((label_t *)nofault)) {
- nofault = (int *) 0;
- printf("No parity memory\n");
- return;
- }
- *PARREG = 1;
- nofault = (int *) 0;
- gotparmem = 1;
- printf("Parity detection enabled\n");
-}
-
-/*
- * Determine if level 7 interrupt was caused by a parity error
- * and deal with it if it was. Returns 1 if it was a parity error.
- */
-int
-parityerror(fp)
- struct frame *fp;
-{
- if (!gotparmem)
- return(0);
- *PARREG = 0;
- DELAY(10);
- *PARREG = 1;
- if (panicstr) {
- printf("parity error after panic ignored\n");
- return (1);
- }
- if (!parityerrorfind())
- printf("WARNING: transient parity error ignored\n");
- else if (USERMODE(fp->f_sr)) {
- log(LOG_ERR, "pid %d was killed: memory parity error\n",
- curproc->p_pid);
- uprintf("sorry, pid %d killed: memory parity error\n",
- curproc->p_pid);
- psignal(curproc, SIGKILL);
-#ifdef DEBUG
- } else if (ignorekperr) {
- printf("WARNING: kernel parity error ignored\n");
-#endif
- } else {
- regdump(&(fp->F_t), 128);
- panic("kernel parity error");
- }
- return (1);
-}
-
-/*
- * Yuck! There has got to be a better way to do this!
- * Searching all of memory with interrupts blocked can lead to disaster.
- */
-int
-parityerrorfind()
-{
- static label_t parcatch;
- static int looking = 0;
- volatile int pg, o, s;
- volatile int *ip;
- int i;
- int found;
-
- /*
- * If looking is true we are searching for a known parity error
- * and it has just occurred. All we do is return to the higher
- * level invocation.
- */
- if (looking)
- longjmp(&parcatch);
- s = splhigh();
- /*
- * If setjmp returns true, the parity error we were searching
- * for has just occurred (longjmp above) at the current pg+o
- */
- if (setjmp(&parcatch)) {
- printf("Parity error at 0x%x\n", ptoa(pg)|o);
- found = 1;
- goto done;
- }
- /*
- * If we get here, a parity error has occurred for the first time
- * and we need to find it. We turn off any external caches and
- * loop thru memory, testing every longword til a fault occurs and
- * we regain control at setjmp above. Note that because of the
- * setjmp, pg and o need to be volatile or their values will be lost.
- */
- looking = 1;
- ecacheoff();
- for (pg = atop(lowram); pg < atop(lowram)+physmem; pg++) {
- pmap_kenter_pa((vaddr_t)vmmap, ptoa(pg), VM_PROT_READ);
- pmap_update(pmap_kernel());
- ip = (int *)vmmap;
- for (o = 0; o < PAGE_SIZE; o += sizeof(int))
- i = *ip++;
- }
- /*
- * Getting here implies no fault was found. Should never happen.
- */
- printf("Couldn't locate parity error\n");
- found = 0;
-done:
- looking = 0;
- ecacheon(); /* pmap_kremove() may cause a cache flush */
- pmap_kremove((vaddr_t)vmmap, PAGE_SIZE);
- pmap_update(pmap_kernel());
- splx(s);
- return(found);
-}
diff --git a/sys/arch/hp300/hp300/mem.c b/sys/arch/hp300/hp300/mem.c
deleted file mode 100644
index c2e8bfa663c..00000000000
--- a/sys/arch/hp300/hp300/mem.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/* $OpenBSD: mem.c,v 1.26 2010/12/26 15:40:59 miod Exp $ */
-/* $NetBSD: mem.c,v 1.25 1999/03/27 00:30:06 mycroft 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/systm.h>
-#include <sys/buf.h>
-#include <sys/conf.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-#include <sys/uio.h>
-
-#include <machine/cpu.h>
-
-#include <uvm/uvm_extern.h>
-
-extern u_int lowram;
-extern char *extiobase;
-extern int eiomapsize;
-static caddr_t devzeropage;
-
-#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 o, v;
- int c;
- struct iovec *iov;
- int error = 0;
- static int physlock;
- vm_prot_t prot;
-
- if (minor(dev) == 0) {
- /* lock against other uses of shared vmmap */
- while (physlock > 0) {
- physlock++;
- error = tsleep((caddr_t)&physlock, PZERO | PCATCH,
- "mmrw", 0);
- if (error)
- return (error);
- }
- physlock = 1;
- }
- 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;
-
- /*
- * Only allow reads in physical RAM.
- */
- if (v >= 0xFFFFFFFC || v < lowram) {
- error = EFAULT;
- goto unlock;
- }
-
- prot = uio->uio_rw == UIO_READ ? VM_PROT_READ :
- VM_PROT_WRITE;
- pmap_enter(pmap_kernel(), (vaddr_t)vmmap,
- trunc_page(v), prot, prot|PMAP_WIRED);
- pmap_update(pmap_kernel());
- o = uio->uio_offset & PGOFSET;
- c = min(uio->uio_resid, (int)(NBPG - o));
- error = uiomove((caddr_t)vmmap + o, c, uio);
- pmap_remove(pmap_kernel(), (vaddr_t)vmmap,
- (vaddr_t)vmmap + NBPG);
- pmap_update(pmap_kernel());
- continue;
-
-/* minor device 1 is kernel memory */
- case 1:
- v = uio->uio_offset;
- c = min(iov->iov_len, MAXPHYS);
-
- if (v > HP300_DIRECT_BASE) {
- /*
- * Direct mapping: only allow access to
- * physical memory.
- */
- if (v >= 0xfffffffc || v < lowram)
- return (EFAULT);
- } else {
- /*
- * Translated mapping: check for permission.
- */
- if (!uvm_kernacc((caddr_t)v, c,
- uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
- return (EFAULT);
- }
-
- /*
- * Don't allow reading intio or dio
- * device space. This could lead to
- * corruption of device registers.
- */
- if (ISIIOVA(v) ||
- ((caddr_t)v >= extiobase &&
- (caddr_t)v < (extiobase + (eiomapsize * NBPG))))
- 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;
- }
- /*
- * On the first call, allocate and zero a page
- * of memory for use with /dev/zero.
- */
- if (devzeropage == NULL) {
- devzeropage = (caddr_t)
- malloc(PAGE_SIZE, M_TEMP,
- M_WAITOK | M_ZERO);
- }
- c = min(iov->iov_len, PAGE_SIZE);
- error = uiomove(devzeropage, 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;
- }
- if (minor(dev) == 0) {
-unlock:
- if (physlock > 1)
- wakeup((caddr_t)&physlock);
- physlock = 0;
- }
- return (error);
-}
-
-paddr_t
-mmmmap(dev, off, prot)
- dev_t dev;
- off_t off;
- int prot;
-{
- /*
- * /dev/mem is the only one that makes sense through this
- * interface. For /dev/kmem any physaddr we return here
- * could be transient and hence incorrect or invalid at
- * a later time. /dev/null just doesn't make any sense
- * and /dev/zero is a hack that is handled via the default
- * pager in mmap().
- */
- if (minor(dev) != 0)
- return (-1);
-
- /*
- * Allow access only in RAM.
- */
- if ((u_int)off < lowram || (u_int)off >= 0xFFFFFFFC)
- return (-1);
- return (off);
-}
-
-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/hp300/hp300/pmap_bootstrap.c b/sys/arch/hp300/hp300/pmap_bootstrap.c
deleted file mode 100644
index 7b6b6c29059..00000000000
--- a/sys/arch/hp300/hp300/pmap_bootstrap.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $OpenBSD: pmap_bootstrap.c,v 1.26 2008/02/13 21:19:54 miod Exp $ */
-/* $NetBSD: pmap_bootstrap.c,v 1.13 1997/06/10 18:56:50 veego Exp $ */
-
-/*
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pmap_bootstrap.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/msgbuf.h>
-
-#include <machine/cpu.h>
-#include <machine/frame.h>
-#include <machine/pte.h>
-#include <machine/vmparam.h>
-
-#include <machine/hp300spu.h>
-#include <hp300/hp300/clockreg.h>
-
-#include <uvm/uvm_extern.h>
-
-caddr_t ledbase; /* SPU LEDs mapping */
-
-extern vaddr_t CLKbase, MMUbase;
-extern char *extiobase;
-extern int eiomapsize;
-
-#define RELOC(v, t) *((t*)((u_int)&(v) + firstpa))
-#define PA2VA(v, t) *((t*)((u_int)&(v)))
-
-#define MACHINE_IIOMAPSIZE IIOMAPSIZE
-#define MACHINE_INTIOBASE INTIOBASE
-#define MACHINE_EIOMAPSIZE RELOC(eiomapsize, int)
-
-#define PMAP_MD_LOCALS /* nothing */
-
-#define PMAP_MD_RELOC1() /* nothing */
-
-#define PMAP_MD_MAPIOSPACE() /* nothing */
-
- /*
- * intiobase, intiolimit: base and end of internal (DIO) IO space.
- * MACHINE_IIOMAPSIZE pages prior to external IO space at end of
- * static kernel page table.
- * extiobase: base of external (DIO-II) IO space.
- * MACHINE_EIOMAPSIZE pages at the end of the static kernel page table.
- * CLKbase, MMUbase: important registers in internal IO space
- * accessed from locore.
- */
-#define PMAP_MD_RELOC2() \
-do { \
- RELOC(intiobase, char *) = (char *)iiobase; \
- RELOC(intiolimit, char *) = (char *)eiobase; \
- RELOC(extiobase, char *) = (char *)eiobase; \
- RELOC(CLKbase, vaddr_t) = iiobase + CLKBASE; \
- RELOC(MMUbase, vaddr_t) = iiobase + MMUBASE; \
-} while (0)
-
-#define PMAP_MD_MEMSIZE() \
-do { \
- RELOC(avail_end, paddr_t) = MAXADDR - PAGE_SIZE - \
- round_page(MSGBUFSIZE); \
-} while (0)
-
- /*
- * Allocate some fixed, special purpose kernel virtual addresses
- */
-#define PMAP_MD_RELOC3() \
-do { \
- RELOC(ledbase, caddr_t) = (caddr_t)va; \
- va += NBPG; \
-} while (0)
-
-#include <m68k/m68k/pmap_bootstrap.c>
-
-void
-pmap_init_md()
-{
- vaddr_t addr;
-
- /*
- * mark as unavailable the regions which we have mapped in
- * pmap_bootstrap().
- */
- addr = (vaddr_t) intiobase;
- if (uvm_map(kernel_map, &addr,
- ptoa(IIOMAPSIZE + eiomapsize),
- NULL, UVM_UNKNOWN_OFFSET, 0,
- UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE,
- UVM_INH_NONE, UVM_ADV_RANDOM,
- UVM_FLAG_FIXED)))
- panic("pmap_init: bogons in the VM system!");
-}
diff --git a/sys/arch/hp300/hp300/sys_machdep.c b/sys/arch/hp300/hp300/sys_machdep.c
deleted file mode 100644
index e22aa956161..00000000000
--- a/sys/arch/hp300/hp300/sys_machdep.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $OpenBSD: sys_machdep.c,v 1.15 2005/08/01 11:54:19 miod Exp $ */
-/* $NetBSD: sys_machdep.c,v 1.17 1997/05/19 10:15:00 veego Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 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.
- *
- * @(#)sys_machdep.c 8.2 (Berkeley) 1/13/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
-#include <sys/time.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/mtio.h>
-#include <sys/buf.h>
-#include <sys/mount.h>
-
-#include <sys/syscallargs.h>
-
-int
-sys_sysarch(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
-#if 0 /* unused */
- struct sys_sysarch_args /* {
- syscallarg(int) op;
- syscallarg(char *) parms;
- } */ *uap = v;
-#endif
-
- return ENOSYS;
-}
diff --git a/sys/arch/hp300/hp300/trap.c b/sys/arch/hp300/hp300/trap.c
deleted file mode 100644
index d543792ab26..00000000000
--- a/sys/arch/hp300/hp300/trap.c
+++ /dev/null
@@ -1,1002 +0,0 @@
-/* $OpenBSD: trap.c,v 1.63 2013/11/02 13:49:22 miod Exp $ */
-/* $NetBSD: trap.c,v 1.57 1998/02/16 20:58:31 thorpej Exp $ */
-
-/*
- * Copyright (c) 1997 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 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.
- *
- * from: Utah $Hdr: trap.c 1.37 92/12/20$
- *
- * @(#)trap.c 8.5 (Berkeley) 1/4/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/acct.h>
-#include <sys/kernel.h>
-#include <sys/signalvar.h>
-#include <sys/resourcevar.h>
-#include <sys/syscall.h>
-#include <sys/syscall_mi.h>
-#include <sys/syslog.h>
-#include <sys/user.h>
-
-#include <m68k/frame.h>
-
-#include <machine/db_machdep.h>
-#include <machine/psl.h>
-#include <machine/trap.h>
-#include <machine/cpu.h>
-#include <machine/reg.h>
-#include <machine/intr.h>
-
-#include <uvm/uvm_extern.h>
-#include <uvm/uvm_pmap.h>
-
-#include <dev/cons.h>
-
-int writeback(struct frame *);
-void trap(int type, u_int code, u_int v, struct frame frame);
-void syscall(register_t code, struct frame frame);
-void wb_userret(struct proc *, struct frame *);
-
-#ifdef DEBUG
-void dumpssw(u_short);
-void dumpwb(int, u_short, u_int, u_int);
-#endif
-
-int astpending;
-
-char *trap_type[] = {
- "Bus error",
- "Address error",
- "Illegal instruction",
- "Zero divide",
- "CHK instruction",
- "TRAPV instruction",
- "Privilege violation",
- "Trace trap",
- "MMU fault",
- "SSIR trap",
- "Format error",
- "68881 exception",
- "Coprocessor violation",
- "Async system trap"
-};
-int trap_types = sizeof trap_type / sizeof trap_type[0];
-
-/*
- * Size of various exception stack frames (minus the standard 8 bytes)
- */
-short exframesize[] = {
- FMT0SIZE, /* type 0 - normal (68020/030/040/060) */
- FMT1SIZE, /* type 1 - throwaway (68020/030/040) */
- FMT2SIZE, /* type 2 - normal 6-word (68020/030/040/060) */
- FMT3SIZE, /* type 3 - FP post-instruction (68040/060) */
- FMT4SIZE, /* type 4 - access error/fp disabled (68060) */
- -1, -1, /* type 5-6 - undefined */
- FMT7SIZE, /* type 7 - access error (68040) */
- 58, /* type 8 - bus fault (68010) */
- FMT9SIZE, /* type 9 - coprocessor mid-instruction (68020/030) */
- FMTASIZE, /* type A - short bus fault (68020/030) */
- FMTBSIZE, /* type B - long bus fault (68020/030) */
- -1, -1, -1, -1 /* type C-F - undefined */
-};
-
-#ifdef M68060
-#define KDFAULT_060(c) (cputype == CPU_68060 && ((c) & FSLW_TM_SV))
-#define WRFAULT_060(c) (cputype == CPU_68060 && ((c) & FSLW_RW_W))
-#else
-#define KDFAULT_060(c) 0
-#define WRFAULT_060(c) 0
-#endif
-
-#ifdef M68040
-#define KDFAULT_040(c) (cputype == CPU_68040 && \
- ((c) & SSW4_TMMASK) == SSW4_TMKD)
-#define WRFAULT_040(c) (cputype == CPU_68040 && \
- ((c) & SSW4_RW) == 0)
-#else
-#define KDFAULT_040(c) 0
-#define WRFAULT_040(c) 0
-#endif
-
-#if defined(M68030) || defined(M68020)
-#define KDFAULT_OTH(c) (cputype <= CPU_68030 && \
- ((c) & (SSW_DF|SSW_FCMASK)) == (SSW_DF|FC_SUPERD))
-#define WRFAULT_OTH(c) (cputype <= CPU_68030 && \
- ((c) & (SSW_DF|SSW_RW)) == SSW_DF)
-#else
-#define KDFAULT_OTH(c) 0
-#define WRFAULT_OTH(c) 0
-#endif
-
-#define KDFAULT(c) (KDFAULT_060(c) || KDFAULT_040(c) || KDFAULT_OTH(c))
-#define WRFAULT(c) (WRFAULT_060(c) || WRFAULT_040(c) || WRFAULT_OTH(c))
-
-#ifdef DEBUG
-int mmudebug = 0;
-int mmupid = -1;
-#define MDB_FOLLOW 1
-#define MDB_WBFOLLOW 2
-#define MDB_WBFAILED 4
-#define MDB_ISPID(p) ((p) == mmupid)
-#endif
-
-#ifdef M68040
-/*
- * Handle writeback completion on 68040.
- */
-void
-wb_userret(struct proc *p, struct frame *fp)
-{
- /*
- * Deal with user mode writebacks (from trap, or from sigreturn).
- * If any writeback fails, go back and attempt signal delivery.
- * unless we have already been here and attempted the writeback
- * (e.g. bad address with user ignoring SIGSEGV). In that case
- * we just return to the user without successfully completing
- * the writebacks. Maybe we should just drop the sucker?
- */
- if (cputype == CPU_68040 && fp->f_format == FMT7) {
- int sig;
- union sigval sv;
-
- if ((sig = writeback(fp)) != 0) {
- sv.sival_ptr = (caddr_t)fp->f_fmt7.f_fa;
- trapsignal(p, sig, T_MMUFLT, SEGV_MAPERR, sv);
-
- userret(p);
- }
- }
-}
-#endif
-
-/*
- * Trap is called from locore to handle most types of processor traps,
- * including events such as simulated software interrupts/AST's.
- * System calls are broken out for efficiency.
- */
-/*ARGSUSED*/
-void
-trap(type, code, v, frame)
- int type;
- unsigned code;
- unsigned v;
- struct frame frame;
-{
- struct proc *p;
- int i, s;
- u_int ucode;
- int typ = 0;
- union sigval sv;
-
- uvmexp.traps++;
- p = curproc;
- ucode = 0;
-
- /* I have verified that this DOES happen! -gwr */
- if (p == NULL)
- p = &proc0;
-#ifdef DIAGNOSTIC
- if (p->p_addr == NULL)
- panic("trap: no pcb");
-#endif
-
- if (USERMODE(frame.f_sr)) {
- type |= T_USER;
- p->p_md.md_regs = frame.f_regs;
- }
- switch (type) {
-
- default:
-dopanic:
- printf("trap type %d, code = 0x%x, v = 0x%x\n", type, code, v);
- printf("%s program counter = 0x%x\n",
- (type & T_USER) ? "user" : "kernel", frame.f_pc);
- /*
- * Let the kernel debugger see the trap frame that
- * caused us to panic. This is a convenience so
- * one can see registers at the point of failure.
- */
- s = splhigh();
-#ifdef KGDB
- /* If connected, step or cont returns 1 */
- if (kgdb_trap(type, &frame))
- goto kgdb_cont;
-#endif
-#ifdef DDB
- (void)kdb_trap(type, (db_regs_t *)&frame);
-#endif
-#ifdef KGDB
- kgdb_cont:
-#endif
- splx(s);
- if (panicstr) {
- printf("trap during panic!\n");
-#ifdef DEBUG
- /* XXX should be a machine-dependent hook */
- printf("(press a key)\n");
- cnpollc(1); (void)cngetc(); cnpollc(0);
-#endif
- }
- regdump(&(frame.F_t), 128);
- type &= ~T_USER;
- if ((u_int)type < trap_types)
- panic(trap_type[type]);
- panic("trap");
-
- case T_BUSERR: /* kernel bus error */
- if (p->p_addr->u_pcb.pcb_onfault == 0)
- goto dopanic;
- /* FALLTHROUGH */
-
- copyfault:
- /*
- * If we have arranged to catch this fault in any of the
- * copy to/from user space routines, set PC to return to
- * indicated location and set flag informing buserror code
- * that it may need to clean up stack frame.
- */
- frame.f_stackadj = exframesize[frame.f_format];
- frame.f_format = frame.f_vector = 0;
- frame.f_pc = (int) p->p_addr->u_pcb.pcb_onfault;
- return;
-
- case T_BUSERR|T_USER: /* bus error */
- typ = BUS_OBJERR;
- ucode = code & ~T_USER;
- i = SIGBUS;
- break;
- case T_ADDRERR|T_USER: /* address error */
- typ = BUS_ADRALN;
- ucode = code & ~T_USER;
- i = SIGBUS;
- break;
-
- case T_COPERR: /* kernel coprocessor violation */
- case T_FMTERR|T_USER: /* do all RTE errors come in as T_USER? */
- case T_FMTERR: /* ...just in case... */
- /*
- * The user has most likely trashed the RTE or FP state info
- * in the stack frame of a signal handler.
- */
- printf("pid %d: kernel %s exception\n", p->p_pid,
- type==T_COPERR ? "coprocessor" : "format");
- sigexit(p, SIGILL);
- /* NOTREACHED */
- break;
-
- case T_COPERR|T_USER: /* user coprocessor violation */
- /* What is a proper response here? */
- typ = FPE_FLTINV;
- ucode = 0;
- i = SIGFPE;
- break;
-
- case T_FPERR|T_USER: /* 68881 exceptions */
- /*
- * We pass along the 68881 status which locore stashed
- * in code for us. Note that there is a possibility that the
- * bit pattern of this will conflict with one of the
- * FPE_* codes defined in signal.h. Fortunately for us, the
- * only such codes we use are all in the range 1-7 and the low
- * 3 bits of the status are defined as 0 so there is
- * no clash.
- */
- typ = FPE_FLTRES;
- ucode = code;
- i = SIGFPE;
- v = frame.f_pc;
- break;
-
-#ifdef M68040
- case T_FPEMULI|T_USER: /* unimplemented FP instruction */
- case T_FPEMULD|T_USER: /* unimplemented FP data type */
- /* XXX need to FSAVE */
- printf("pid %d(%s): unimplemented FP %s at %x (EA %x)\n",
- p->p_pid, p->p_comm,
- frame.f_format == 2 ? "instruction" : "data type",
- frame.f_pc, frame.f_fmt2.f_iaddr);
- /* XXX need to FRESTORE */
- typ = FPE_FLTINV;
- i = SIGFPE;
- v = frame.f_pc;
- break;
-#endif
-
- case T_ILLINST|T_USER: /* illegal instruction fault */
- ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
- typ = ILL_ILLOPC;
- i = SIGILL;
- v = frame.f_pc;
- break;
-
- case T_PRIVINST|T_USER: /* privileged instruction fault */
- ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
- typ = ILL_PRVOPC;
- i = SIGILL;
- v = frame.f_pc;
- break;
-
- case T_ZERODIV|T_USER: /* Divide by zero */
- ucode = frame.f_format; /* XXX was FPE_INTDIV_TRAP */
- typ = FPE_INTDIV;
- i = SIGFPE;
- v = frame.f_pc;
- break;
-
- case T_CHKINST|T_USER: /* CHK instruction trap */
- ucode = frame.f_format; /* XXX was FPE_SUBRNG_TRAP */
- typ = FPE_FLTSUB;
- i = SIGFPE;
- v = frame.f_pc;
- break;
-
- case T_TRAPVINST|T_USER: /* TRAPV instruction trap */
- ucode = frame.f_format; /* XXX was FPE_INTOVF_TRAP */
- typ = ILL_ILLTRP;
- i = SIGILL;
- v = frame.f_pc;
- break;
-
- /*
- * XXX: Trace traps are a nightmare.
- *
- * HP-UX uses trap #1 for breakpoints,
- * OpenBSD/m68k uses trap #2,
- * SUN 3.x uses trap #15,
- * DDB and KGDB uses trap #15 (for kernel breakpoints;
- * handled elsewhere).
- *
- * OpenBSD and HP-UX traps both get mapped by locore.s into T_TRACE.
- * SUN 3.x traps get passed through as T_TRAP15 and are not really
- * supported yet.
- *
- * XXX: We should never get kernel-mode T_TRAP15
- * XXX: because locore.s now gives them special treatment.
- */
- case T_TRAP15: /* kernel breakpoint */
-#ifdef DEBUG
- printf("unexpected kernel trace trap, type = %d\n", type);
- printf("program counter = 0x%x\n", frame.f_pc);
-#endif
- frame.f_sr &= ~PSL_T;
- return;
-
- case T_TRACE|T_USER: /* user trace trap */
- case T_TRACE: /* tracing a trap instruction */
- case T_TRAP15|T_USER: /* SUN user trace trap */
- frame.f_sr &= ~PSL_T;
- i = SIGTRAP;
- typ = TRAP_TRACE;
- break;
-
- case T_ASTFLT: /* system async trap, cannot happen */
- goto dopanic;
-
- case T_ASTFLT|T_USER: /* user async trap */
- astpending = 0;
- /*
- * We check for software interrupts first. This is because
- * they are at a higher level than ASTs, and on a VAX would
- * interrupt the AST. We assume that if we are processing
- * an AST that we must be at IPL0 so we don't bother to
- * check. Note that we ensure that we are at least at SIR
- * IPL while processing the SIR.
- */
- splsoft();
- /* FALLTHROUGH */
-
- case T_SSIR: /* software interrupt */
- case T_SSIR|T_USER:
- {
- int sir, q, mask;
-
- while ((sir = softpending) != 0) {
- atomic_clearbits_int(&softpending, sir);
-
- for (q = SI_NQUEUES - 1, mask = 1 << (SI_NQUEUES - 1);
- mask != 0; q--, mask >>= 1)
- if (mask & sir)
- softintr_dispatch(q);
- }
- }
-
- /*
- * If this was not an AST trap, we are all done.
- */
- if (type != (T_ASTFLT|T_USER)) {
- uvmexp.traps--;
- return;
- }
- spl0();
- if (p->p_flag & P_OWEUPC) {
- ADDUPROF(p);
- }
- if (type == (T_ASTFLT | T_USER) && want_resched) {
- preempt(NULL);
- }
- goto out;
-
- case T_MMUFLT: /* kernel mode page fault */
- case T_MMUFLT|T_USER: /* page fault */
- {
- vaddr_t va;
- struct vmspace *vm = p->p_vmspace;
- struct vm_map *map;
- int rv;
- vm_prot_t ftype, vftype;
- extern struct vm_map *kernel_map;
-
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
- printf("trap: T_MMUFLT pid=%d, code=%x, v=%x, pc=%x, sr=%x\n",
- p->p_pid, code, v, frame.f_pc, frame.f_sr);
-#endif
- /*
- * It is only a kernel address space fault iff:
- * 1. (type & T_USER) == 0 and
- * 2. pcb_onfault not set or
- * 3. pcb_onfault set but supervisor space data fault
- * The last can occur during an exec() copyin where the
- * argument space is lazy-allocated.
- */
- if ((type & T_USER) == 0 &&
- ((p->p_addr->u_pcb.pcb_onfault == 0) || KDFAULT(code)))
- map = kernel_map;
- else
- map = vm ? &vm->vm_map : kernel_map;
-
- if (WRFAULT(code)) {
- vftype = VM_PROT_WRITE;
- ftype = VM_PROT_READ | VM_PROT_WRITE;
- } else
- vftype = ftype = VM_PROT_READ;
-
- va = trunc_page((vaddr_t)v);
-
- if (map == kernel_map && va == 0) {
- printf("trap: bad kernel %s access at 0x%x\n",
- (ftype & VM_PROT_WRITE) ? "read/write" :
- "read", v);
- goto dopanic;
- }
-
- rv = uvm_fault(map, va, 0, ftype);
-#ifdef DEBUG
- if (rv && MDB_ISPID(p->p_pid))
- printf("uvm_fault(%p, 0x%lx, 0, 0x%x) -> 0x%x\n",
- map, va, ftype, rv);
-#endif
- /*
- * If this was a stack access we keep track of the maximum
- * accessed stack size. Also, if vm_fault gets a protection
- * failure it is due to accessing the stack region outside
- * the current limit and we need to reflect that as an access
- * error.
- */
- if ((vm != NULL && (caddr_t)va >= vm->vm_maxsaddr)
- && map != kernel_map) {
- if (rv == 0) {
- uvm_grow(p, va);
- } else if (rv == EACCES)
- rv = EFAULT;
- }
- if (rv == 0) {
- if (type == T_MMUFLT) {
-#ifdef M68040
- if (cputype == CPU_68040)
- (void)writeback(&frame);
-#endif
- return;
- }
- goto out;
- }
- if (type == T_MMUFLT) {
- if (p->p_addr->u_pcb.pcb_onfault)
- goto copyfault;
- printf("uvm_fault(%p, 0x%lx, 0, 0x%x) -> 0x%x\n",
- map, va, ftype, rv);
- printf(" type %x, code [mmu,,ssw]: %x\n",
- type, code);
- goto dopanic;
- }
- frame.f_pad = code & 0xffff;
- ucode = vftype;
- typ = SEGV_MAPERR;
- i = SIGSEGV;
- break;
- }
- }
- sv.sival_ptr = (caddr_t)v;
- trapsignal(p, i, ucode, typ, sv);
-out:
- if ((type & T_USER) == 0)
- return;
- userret(p);
-#ifdef M68040
- wb_userret(p, &frame);
-#endif
-}
-
-#ifdef M68040
-#ifdef DEBUG
-struct writebackstats {
- int calls;
- int cpushes;
- int move16s;
- int wb1s, wb2s, wb3s;
- int wbsize[4];
-} wbstats;
-
-char *f7sz[] = { "longword", "byte", "word", "line" };
-char *f7tt[] = { "normal", "MOVE16", "AFC", "ACK" };
-char *f7tm[] = { "d-push", "u-data", "u-code", "M-data",
- "M-code", "k-data", "k-code", "RES" };
-char wberrstr[] =
- "WARNING: pid %d(%s) writeback [%s] failed, pc=%x fa=%x wba=%x wbd=%x\n";
-#endif
-
-int
-writeback(struct frame *fp)
-{
- struct fmt7 *f = &fp->f_fmt7;
- struct proc *p = curproc;
- int err = 0;
- u_int fa;
- paddr_t pa;
- caddr_t oonfault = p->p_addr->u_pcb.pcb_onfault;
-
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) {
- printf(" pid=%d, fa=%x,", p->p_pid, f->f_fa);
- dumpssw(f->f_ssw);
- }
- wbstats.calls++;
-#endif
- /*
- * Deal with special cases first.
- */
- if ((f->f_ssw & SSW4_TMMASK) == SSW4_TMDCP) {
- /*
- * Dcache push fault.
- * Line-align the address and write out the push data to
- * the indicated physical address.
- */
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) {
- printf(" pushing %s to PA %x, data %x",
- f7sz[(f->f_ssw & SSW4_SZMASK) >> 5],
- f->f_fa, f->f_pd0);
- if ((f->f_ssw & SSW4_SZMASK) == SSW4_SZLN)
- printf("/%x/%x/%x",
- f->f_pd1, f->f_pd2, f->f_pd3);
- printf("\n");
- }
- if (f->f_wb1s & SSW4_WBSV)
- panic("writeback: cache push with WB1S valid");
- wbstats.cpushes++;
-#endif
- /*
- * XXX there are security problems if we attempt to do a
- * cache push after a signal handler has been called.
- */
- pmap_kenter_pa((vaddr_t)vmmap,
- trunc_page((vaddr_t)f->f_fa), VM_PROT_WRITE);
- pmap_update(pmap_kernel());
- fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0x000f];
- bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16);
- pmap_extract(pmap_kernel(), (vaddr_t)fa, &pa);
- DCFL(pa);
- pmap_kremove((vaddr_t)vmmap, PAGE_SIZE);
- pmap_update(pmap_kernel());
- } else if ((f->f_ssw & (SSW4_RW|SSW4_TTMASK)) == SSW4_TTM16) {
- /*
- * MOVE16 fault.
- * Line-align the address and write out the push data to
- * the indicated virtual address.
- */
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
- printf(" MOVE16 to VA %x(%x), data %x/%x/%x/%x\n",
- f->f_fa, f->f_fa & ~0xF, f->f_pd0, f->f_pd1,
- f->f_pd2, f->f_pd3);
- if (f->f_wb1s & SSW4_WBSV)
- panic("writeback: MOVE16 with WB1S valid");
- wbstats.move16s++;
-#endif
- if (KDFAULT(f->f_wb1s))
- bcopy((caddr_t)&f->f_pd0, (caddr_t)(f->f_fa & ~0xF), 16);
- else
- err = suline((caddr_t)(f->f_fa & ~0xF), (caddr_t)&f->f_pd0);
- if (err) {
- fa = f->f_fa & ~0xF;
-#ifdef DEBUG
- if (mmudebug & MDB_WBFAILED)
- printf(wberrstr, p->p_pid, p->p_comm,
- "MOVE16", fp->f_pc, f->f_fa,
- f->f_fa & ~0xF, f->f_pd0);
-#endif
- }
- } else if (f->f_wb1s & SSW4_WBSV) {
- /*
- * Writeback #1.
- * Position the "memory-aligned" data and write it out.
- */
- u_int wb1d = f->f_wb1d;
- int off;
-
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
- dumpwb(1, f->f_wb1s, f->f_wb1a, f->f_wb1d);
- wbstats.wb1s++;
- wbstats.wbsize[(f->f_wb2s&SSW4_SZMASK)>>5]++;
-#endif
- off = (f->f_wb1a & 3) * 8;
- switch (f->f_wb1s & SSW4_SZMASK) {
- case SSW4_SZLW:
- if (off)
- wb1d = (wb1d >> (32 - off)) | (wb1d << off);
- if (KDFAULT(f->f_wb1s))
- *(long *)f->f_wb1a = wb1d;
- else
- err = copyout(&wb1d, (caddr_t)f->f_wb1a,
- sizeof(int));
- break;
- case SSW4_SZB:
- off = 24 - off;
- if (off)
- wb1d >>= off;
- if (KDFAULT(f->f_wb1s))
- *(char *)f->f_wb1a = wb1d;
- else {
- char tmp = wb1d;
-
- err = copyout(&tmp, (caddr_t)f->f_wb1a,
- sizeof(char));
- }
- break;
- case SSW4_SZW:
- off = (off + 16) % 32;
- if (off)
- wb1d = (wb1d >> (32 - off)) | (wb1d << off);
- if (KDFAULT(f->f_wb1s))
- *(short *)f->f_wb1a = wb1d;
- else {
- short tmp = wb1d;
-
- err = copyout(&tmp, (caddr_t)f->f_wb1a,
- sizeof(short));
- }
- break;
- }
- if (err) {
- fa = f->f_wb1a;
-#ifdef DEBUG
- if (mmudebug & MDB_WBFAILED)
- printf(wberrstr, p->p_pid, p->p_comm,
- "#1", fp->f_pc, f->f_fa,
- f->f_wb1a, f->f_wb1d);
-#endif
- }
- }
- /*
- * Deal with the "normal" writebacks.
- *
- * XXX writeback2 is known to reflect a LINE size writeback after
- * a MOVE16 was already dealt with above. Ignore it.
- */
- if (err == 0 && (f->f_wb2s & SSW4_WBSV) &&
- (f->f_wb2s & SSW4_SZMASK) != SSW4_SZLN) {
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
- dumpwb(2, f->f_wb2s, f->f_wb2a, f->f_wb2d);
- wbstats.wb2s++;
- wbstats.wbsize[(f->f_wb2s&SSW4_SZMASK)>>5]++;
-#endif
- switch (f->f_wb2s & SSW4_SZMASK) {
- case SSW4_SZLW:
- if (KDFAULT(f->f_wb2s))
- *(long *)f->f_wb2a = f->f_wb2d;
- else
- err = copyout(&f->f_wb2d, (caddr_t)f->f_wb2a,
- sizeof(int));
- break;
- case SSW4_SZB:
- if (KDFAULT(f->f_wb2s))
- *(char *)f->f_wb2a = f->f_wb2d;
- else {
- char tmp = f->f_wb2d;
-
- err = copyout(&tmp, (caddr_t)f->f_wb2a,
- sizeof(char));
- }
- break;
- case SSW4_SZW:
- if (KDFAULT(f->f_wb2s))
- *(short *)f->f_wb2a = f->f_wb2d;
- else {
- short tmp = f->f_wb2d;
-
- err = copyout(&tmp, (caddr_t)f->f_wb2a,
- sizeof(short));
- }
- break;
- }
- if (err) {
- fa = f->f_wb2a;
-#ifdef DEBUG
- if (mmudebug & MDB_WBFAILED) {
- printf(wberrstr, p->p_pid, p->p_comm,
- "#2", fp->f_pc, f->f_fa,
- f->f_wb2a, f->f_wb2d);
- dumpssw(f->f_ssw);
- dumpwb(2, f->f_wb2s, f->f_wb2a, f->f_wb2d);
- }
-#endif
- }
- }
- if (err == 0 && (f->f_wb3s & SSW4_WBSV)) {
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
- dumpwb(3, f->f_wb3s, f->f_wb3a, f->f_wb3d);
- wbstats.wb3s++;
- wbstats.wbsize[(f->f_wb3s&SSW4_SZMASK)>>5]++;
-#endif
- switch (f->f_wb3s & SSW4_SZMASK) {
- case SSW4_SZLW:
- if (KDFAULT(f->f_wb3s))
- *(long *)f->f_wb3a = f->f_wb3d;
- else
- err = copyout(&f->f_wb3d, (caddr_t)f->f_wb3a,
- sizeof(int));
- break;
- case SSW4_SZB:
- if (KDFAULT(f->f_wb3s))
- *(char *)f->f_wb3a = f->f_wb3d;
- else {
- char tmp = f->f_wb3d;
-
- err = copyout(&tmp, (caddr_t)f->f_wb3a,
- sizeof(char));
- }
- break;
- case SSW4_SZW:
- if (KDFAULT(f->f_wb3s))
- *(short *)f->f_wb3a = f->f_wb3d;
- else {
- short tmp = f->f_wb3d;
-
- err = copyout(&tmp, (caddr_t)f->f_wb3a,
- sizeof(short));
- }
- break;
-#ifdef DEBUG
- case SSW4_SZLN:
- panic("writeback: wb3s indicates LINE write");
-#endif
- }
- if (err) {
- fa = f->f_wb3a;
-#ifdef DEBUG
- if (mmudebug & MDB_WBFAILED)
- printf(wberrstr, p->p_pid, p->p_comm,
- "#3", fp->f_pc, f->f_fa,
- f->f_wb3a, f->f_wb3d);
-#endif
- }
- }
- p->p_addr->u_pcb.pcb_onfault = oonfault;
- /*
- * Any problems are SIGSEGV's
- */
- if (err)
- err = SIGSEGV;
- return(err);
-}
-
-#ifdef DEBUG
-void
-dumpssw(ssw)
- u_short ssw;
-{
- printf(" SSW: %x: ", ssw);
- if (ssw & SSW4_CP)
- printf("CP,");
- if (ssw & SSW4_CU)
- printf("CU,");
- if (ssw & SSW4_CT)
- printf("CT,");
- if (ssw & SSW4_CM)
- printf("CM,");
- if (ssw & SSW4_MA)
- printf("MA,");
- if (ssw & SSW4_ATC)
- printf("ATC,");
- if (ssw & SSW4_LK)
- printf("LK,");
- if (ssw & SSW4_RW)
- printf("RW,");
- printf(" SZ=%s, TT=%s, TM=%s\n",
- f7sz[(ssw & SSW4_SZMASK) >> 5],
- f7tt[(ssw & SSW4_TTMASK) >> 3],
- f7tm[ssw & SSW4_TMMASK]);
-}
-
-void
-dumpwb(num, s, a, d)
- int num;
- u_short s;
- u_int a, d;
-{
- struct proc *p = curproc;
- paddr_t pa;
- int tmp;
-
- printf(" writeback #%d: VA %x, data %x, SZ=%s, TT=%s, TM=%s\n",
- num, a, d, f7sz[(s & SSW4_SZMASK) >> 5],
- f7tt[(s & SSW4_TTMASK) >> 3], f7tm[s & SSW4_TMMASK]);
- printf(" PA ");
- if (pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a, &pa) == FALSE)
- printf("<invalid address>");
- else {
- if (copyin((caddr_t)a, &tmp, sizeof(int)) == 0)
- printf("%lx, current value %lx", pa, tmp);
- else
- printf("%lx, current value inaccessible", pa);
- }
- printf("\n");
-}
-#endif
-#endif
-
-/*
- * Process a system call.
- */
-void
-syscall(code, frame)
- register_t code;
- struct frame frame;
-{
- caddr_t params;
- struct sysent *callp;
- struct proc *p;
- int error, opc, nsys;
- size_t argsize;
- register_t args[8], rval[2];
-
- uvmexp.syscalls++;
- if (!USERMODE(frame.f_sr))
- panic("syscall");
- p = curproc;
- p->p_md.md_regs = frame.f_regs;
- opc = frame.f_pc;
-
- nsys = p->p_emul->e_nsysent;
- callp = p->p_emul->e_sysent;
-
- params = (caddr_t)frame.f_regs[SP] + sizeof(int);
-
- switch (code) {
- case SYS_syscall:
- /*
- * Code is first argument, followed by actual args.
- */
- if ((error = copyin(params, &code, sizeof(register_t))))
- goto bad;
- params += sizeof(int);
- /*
- * XXX sigreturn requires special stack manipulation
- * that is only done if entered via the sigreturn
- * trap. Cannot allow it here so make sure we fail.
- */
- if (code == SYS_sigreturn)
- code = nsys;
- break;
- case SYS___syscall:
- /*
- * Like syscall, but code is a quad, so as to maintain
- * quad alignment for the rest of the arguments.
- */
- if (callp != sysent)
- break;
- if ((error = copyin(params + _QUAD_LOWWORD * sizeof(int),
- &code, sizeof(register_t))))
- goto bad;
- params += sizeof(quad_t);
- break;
- default:
- break;
- }
- if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys; /* illegal */
- else
- callp += code;
- argsize = callp->sy_argsize;
- if (argsize && (error = copyin(params, args, argsize)))
- goto bad;
-
- rval[0] = 0;
- rval[1] = frame.f_regs[D1];
-
- error = mi_syscall(p, code, callp, args, rval);
-
- switch (error) {
- case 0:
- frame.f_regs[D0] = rval[0];
- frame.f_regs[D1] = rval[1];
- frame.f_sr &= ~PSL_C; /* carry bit */
- break;
- case ERESTART:
- /*
- * We always enter through a `trap' instruction, which is 2
- * bytes, so adjust the pc by that amount.
- */
- frame.f_pc = opc - 2;
- break;
- case EJUSTRETURN:
- /* nothing to do */
- break;
- default:
- bad:
- frame.f_regs[D0] = error;
- frame.f_sr |= PSL_C; /* carry bit */
- break;
- }
-
- mi_syscall_return(p, code, error, rval);
-}
diff --git a/sys/arch/hp300/hp300/vectors.s b/sys/arch/hp300/hp300/vectors.s
deleted file mode 100644
index 0131b1d2bf8..00000000000
--- a/sys/arch/hp300/hp300/vectors.s
+++ /dev/null
@@ -1,147 +0,0 @@
-| $OpenBSD: vectors.s,v 1.10 2005/01/14 22:39:28 miod Exp $
-| $NetBSD: vectors.s,v 1.12 1997/07/14 19:18:32 thorpej Exp $
-
-| Copyright (c) 1997 Jason R. Thorpe. All rights reserved.
-| Copyright (c) 1988 University of Utah
-| 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.
-|
-| @(#)vectors.s 8.2 (Berkeley) 1/21/94
-|
-
-#define BADTRAP16 \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap)
-
- /*
- * bus error and address error vectors are initialized
- * in locore.s once we know our CPU type.
- */
-
- .data
-GLOBAL(vectab)
- VECTOR_UNUSED /* 0: NOT USED (reset SSP) */
- VECTOR_UNUSED /* 1: NOT USED (reset PC) */
- VECTOR_UNUSED /* 2: bus error */
- VECTOR_UNUSED /* 3: address error */
- VECTOR(illinst) /* 4: illegal instruction */
- VECTOR(zerodiv) /* 5: zero divide */
- VECTOR(chkinst) /* 6: CHK instruction */
- VECTOR(trapvinst) /* 7: TRAPV instruction */
- VECTOR(privinst) /* 8: privilege violation */
- VECTOR(trace) /* 9: trace */
- VECTOR(illinst) /* 10: line 1010 emulator */
- VECTOR(fpfline) /* 11: line 1111 emulator */
- VECTOR(badtrap) /* 12: unassigned, reserved */
- VECTOR(coperr) /* 13: coprocessor protocol violation */
- VECTOR(fmterr) /* 14: format error */
- VECTOR(badtrap) /* 15: uninitialized interrupt vector */
- VECTOR(badtrap) /* 16: unassigned, reserved */
- VECTOR(badtrap) /* 17: unassigned, reserved */
- VECTOR(badtrap) /* 18: unassigned, reserved */
- VECTOR(badtrap) /* 19: unassigned, reserved */
- VECTOR(badtrap) /* 20: unassigned, reserved */
- VECTOR(badtrap) /* 21: unassigned, reserved */
- VECTOR(badtrap) /* 22: unassigned, reserved */
- VECTOR(badtrap) /* 23: unassigned, reserved */
- VECTOR(spurintr) /* 24: spurious interrupt */
- VECTOR(intrhand) /* 25: level 1 interrupt autovector */
- VECTOR(intrhand) /* 26: level 2 interrupt autovector */
- VECTOR(intrhand) /* 27: level 3 interrupt autovector */
- VECTOR(intrhand) /* 28: level 4 interrupt autovector */
- VECTOR(intrhand) /* 29: level 5 interrupt autovector */
- VECTOR(lev6intr) /* 30: level 6 interrupt autovector */
- VECTOR(lev7intr) /* 31: level 7 interrupt autovector */
- VECTOR(trap0) /* 32: syscalls */
- VECTOR(trap1) /* 33: sigreturn syscall or breakpoint */
- VECTOR(trap2) /* 34: breakpoint or sigreturn syscall */
- VECTOR(illinst) /* 35: TRAP instruction vector */
- VECTOR(illinst) /* 36: TRAP instruction vector */
- VECTOR(illinst) /* 37: TRAP instruction vector */
- VECTOR(illinst) /* 38: TRAP instruction vector */
- VECTOR(illinst) /* 39: TRAP instruction vector */
- VECTOR(illinst) /* 40: TRAP instruction vector */
- VECTOR(illinst) /* 41: TRAP instruction vector */
- VECTOR(illinst) /* 42: TRAP instruction vector */
- VECTOR(illinst) /* 43: TRAP instruction vector */
- VECTOR(trap12) /* 44: TRAP instruction vector */
- VECTOR(illinst) /* 45: TRAP instruction vector */
- VECTOR(illinst) /* 46: TRAP instruction vector */
- VECTOR(trap15) /* 47: TRAP instruction vector */
-
-GLOBAL(fpvect_tab)
- VECTOR(fpfault) /* 48: FPCP branch/set on unordered cond */
- VECTOR(fpfault) /* 49: FPCP inexact result */
- VECTOR(fpfault) /* 50: FPCP divide by zero */
- VECTOR(fpfault) /* 51: FPCP underflow */
- VECTOR(fpfault) /* 52: FPCP operand error */
- VECTOR(fpfault) /* 53: FPCP overflow */
- VECTOR(fpfault) /* 54: FPCP signalling NAN */
-GLOBAL(fpvect_end)
-
- VECTOR(fpunsupp) /* 55: FPCP unimplemented data type */
- VECTOR(badtrap) /* 56: unassigned, reserved */
- VECTOR(badtrap) /* 57: unassigned, reserved */
- VECTOR(badtrap) /* 58: unassigned, reserved */
- VECTOR(badtrap) /* 59: unassigned, reserved */
- VECTOR(badtrap) /* 60: unassigned, reserved */
- VECTOR(badtrap) /* 61: unassigned, reserved */
- VECTOR(badtrap) /* 62: unassigned, reserved */
- VECTOR(badtrap) /* 63: unassigned, reserved */
-
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
-
-#ifdef FPSP
- /*
- * 68040: this chunk of vectors is copied into the fpfault zone
- */
-GLOBAL(fpsp_tab)
- ASVECTOR(fpsp_bsun) /* 48: FPCP branch/set on unordered cond */
- ASVECTOR(inex) /* 49: FPCP inexact result */
- ASVECTOR(dz) /* 50: FPCP divide by zero */
- ASVECTOR(fpsp_unfl) /* 51: FPCP underflow */
- ASVECTOR(fpsp_operr) /* 52: FPCP operand error */
- ASVECTOR(fpsp_ovfl) /* 53: FPCP overflow */
- ASVECTOR(fpsp_snan) /* 54: FPCP signalling NAN */
-#endif /* FPSP */
diff --git a/sys/arch/hp300/hp300/vm_machdep.c b/sys/arch/hp300/hp300/vm_machdep.c
deleted file mode 100644
index d5eec2d9a95..00000000000
--- a/sys/arch/hp300/hp300/vm_machdep.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/* $OpenBSD: vm_machdep.c,v 1.46 2013/01/16 19:04:43 miod Exp $ */
-/* $NetBSD: vm_machdep.c,v 1.60 2001/07/06 05:53:35 chs 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.
- *
- * from: Utah $Hdr: vm_machdep.c 1.21 91/04/06$
- *
- * @(#)vm_machdep.c 8.6 (Berkeley) 1/12/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/malloc.h>
-#include <sys/buf.h>
-#include <sys/vnode.h>
-#include <sys/user.h>
-#include <sys/core.h>
-#include <sys/exec.h>
-#include <sys/ptrace.h>
-
-#include <machine/frame.h>
-#include <machine/cpu.h>
-#include <machine/pte.h>
-#include <machine/reg.h>
-
-#include <uvm/uvm_extern.h>
-
-/*
- * 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 p1 == &proc0, we are creating
- * a kernel thread, and the return path and argument are specified with
- * `func' and `arg'.
- *
- * 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.
- */
-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 = &p2->p_addr->u_pcb;
- struct trapframe *tf;
- struct switchframe *sf;
- extern struct pcb *curpcb;
-
- p2->p_md.md_flags = p1->p_md.md_flags;
-
- /* Copy pcb from proc p1 to p2. */
- if (p1 == curproc) {
- /* Sync the PCB before we copy it. */
- savectx(curpcb);
- }
-#ifdef DIAGNOSTIC
- else if (p1 != &proc0)
- panic("cpu_fork: curproc");
-#endif
- *pcb = p1->p_addr->u_pcb;
-
- /*
- * Copy the trap frame.
- */
- tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) - 1;
- p2->p_md.md_regs = (int *)tf;
- *tf = *(struct trapframe *)p1->p_md.md_regs;
-
- /*
- * If specified, give the child a different stack.
- */
- if (stack != NULL)
- tf->tf_regs[15] = (u_int)stack + stacksize;
-
- sf = (struct switchframe *)tf - 1;
- sf->sf_pc = (u_int)proc_trampoline;
- pcb->pcb_regs[6] = (int)func; /* A2 */
- pcb->pcb_regs[7] = (int)arg; /* A3 */
- pcb->pcb_regs[11] = (int)sf; /* SSP */
- pcb->pcb_ps = PSL_LOWIPL; /* start kthreads at IPL 0 */
-}
-
-/*
- * cpu_exit is called as the last action during exit.
- *
- * Call switch_exit() which will switch to another process thus we never return.
- */
-void
-cpu_exit(p)
- struct proc *p;
-{
- pmap_deactivate(p);
- sched_exit(p);
-}
-
-/*
- * Dump the machine specific header information at the start of a core dump.
- */
-struct md_core {
- struct reg intreg;
- struct fpreg freg;
-};
-int
-cpu_coredump(p, vp, cred, chdr)
- struct proc *p;
- struct vnode *vp;
- struct ucred *cred;
- struct core *chdr;
-{
- struct md_core md_core;
- struct coreseg cseg;
- int error;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_MACHINE, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof(md_core);
-
- /* Save integer registers. */
- error = process_read_regs(p, &md_core.intreg);
- if (error)
- return error;
-
- if (fputype) {
- /* Save floating point registers. */
- error = process_read_fpregs(p, &md_core.freg);
- if (error)
- return error;
- } else {
- /* Make sure these are clear. */
- bzero((caddr_t)&md_core.freg, sizeof(md_core.freg));
- }
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_MACHINE, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&md_core, sizeof(md_core),
- (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE,
- IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- chdr->c_nseg++;
- return 0;
-}
-
-/*
- * 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;
-{
- struct pmap *upmap, *kpmap;
- vaddr_t uva; /* User VA (map from) */
- vaddr_t kva; /* Kernel VA (new to) */
- paddr_t pa; /* physical address */
- vsize_t off;
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vmapbuf");
-
- uva = trunc_page((vaddr_t)(bp->b_saveaddr = bp->b_data));
- off = (vaddr_t)bp->b_data - uva;
- len = round_page(off + len);
- kva = uvm_km_valloc_wait(phys_map, len);
- bp->b_data = (caddr_t)(kva + off);
-
- upmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map);
- kpmap = vm_map_pmap(phys_map);
- do {
- if (pmap_extract(upmap, uva, &pa) == FALSE)
- panic("vmapbuf: null page frame");
- pmap_enter(kpmap, kva, pa, VM_PROT_READ|VM_PROT_WRITE,
- VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
- uva += PAGE_SIZE;
- kva += PAGE_SIZE;
- len -= PAGE_SIZE;
- } while (len);
- pmap_update(pmap_kernel());
-}
-
-/*
- * Unmap a previously-mapped user I/O request.
- */
-void
-vunmapbuf(bp, len)
- struct buf *bp;
- vsize_t len;
-{
- vaddr_t kva;
- vsize_t off;
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vunmapbuf");
-
- kva = trunc_page((vaddr_t)(bp->b_data));
- off = (vaddr_t)bp->b_data - kva;
- len = round_page(off + len);
-
- pmap_remove(vm_map_pmap(phys_map), kva, kva + len);
- pmap_update(pmap_kernel());
- uvm_km_free_wakeup(phys_map, kva, len);
- bp->b_data = bp->b_saveaddr;
- bp->b_saveaddr = 0;
-}
diff --git a/sys/arch/hp300/hp300/wscons_machdep.c b/sys/arch/hp300/hp300/wscons_machdep.c
deleted file mode 100644
index 409a3e3eb4b..00000000000
--- a/sys/arch/hp300/hp300/wscons_machdep.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/* $OpenBSD: wscons_machdep.c,v 1.12 2011/08/18 20:02:58 miod Exp $ */
-
-/*
- * Copyright (c) 2005, 2011, 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) 2002 Michael Shalayeff
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-
-#include <dev/cons.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include "wsdisplay.h"
-#include "wskbd.h"
-#if NWSKBD > 0
-#include <dev/wscons/wskbdvar.h>
-#endif
-
-#include "dvbox.h"
-#include "gbox.h"
-#include "hyper.h"
-#include "rbox.h"
-#include "sti.h"
-#include "topcat.h"
-#include "tvrx.h"
-
-#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NSTI_DIO > 0 || NTOPCAT > 0 || NTVRX > 0
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-struct diofb diofb_cn;
-#endif
-
-#if NSTI > 0
-#include <hp300/dev/sgcreg.h>
-#include <hp300/dev/sgcvar.h>
-#include <dev/ic/stireg.h>
-#include <dev/ic/stivar.h>
-#include <hp300/dev/sti_machdep.h>
-#endif
-
-extern struct hp300_bus_space_tag hp300_mem_tag;
-extern caddr_t internalhpib;
-
-cons_decl(ws);
-
-void (*wsfbcninit)(void) = NULL;
-
-#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NSTI_DIO > 0 || NTOPCAT > 0 || NTVRX > 0
-int dio_fbidentify(int, struct diofbreg *);
-
-/*
- * Identify a DIO frame buffer and set up wsfbcninit accordingly.
- */
-int
-dio_fbidentify(int scode, struct diofbreg *fbr)
-{
- if (fbr->id == GRFHWID)
- switch (fbr->fbid) {
-#if NDVBOX > 0
- case GID_DAVINCI:
- wsfbcninit = dvboxcninit;
- return (1);
-#endif
-#if NGBOX > 0
- case GID_GATORBOX:
- wsfbcninit = gboxcninit;
- return (1);
-#endif
-#if NHYPER > 0
- case GID_HYPERION:
- wsfbcninit = hypercninit;
- return (1);
-#endif
-#if NRBOX > 0
- case GID_RENAISSANCE:
- wsfbcninit = rboxcninit;
- return (1);
-#endif
-#if NSTI_DIO > 0
- case GID_FB3X2_A:
- case GID_FB3X2_B:
- if (scode >= 0 && sti_dio_probe(scode) != 0) {
- wsfbcninit = sticninit;
- return (1);
- }
- break;
-#endif
-#if NTOPCAT > 0
- case GID_TOPCAT:
- case GID_LRCATSEYE:
- case GID_HRCCATSEYE:
- case GID_HRMCATSEYE:
- wsfbcninit = topcatcninit;
- return (1);
-#endif
-#if NTVRX > 0
- case GID_TIGER:
- wsfbcninit = tvrxcninit;
- return (1);
-#endif
- default:
- break;
- }
-
- return (0);
-}
-#endif
-
-/*
- * This routine handles the dirty work of picking the best frame buffer
- * suitable for the console.
- * We try to behave as close as possible to the PROM's logic, by preferring
- * devices for which we have drivers, in that order:
- * - internal video.
- * - lowest select code on DIO bus.
- * - lowest slot on SGC bus.
- */
-void
-wscnprobe(struct consdev *cp)
-{
- int maj, tmpconscode;
- vsize_t mapsize;
- vaddr_t va;
-#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NSTI_DIO > 0 || NTOPCAT > 0 || NTVRX > 0
- paddr_t pa;
- u_int scode, sctop, sctmp;
- struct diofbreg *fbr;
-#endif
-
- for (maj = 0; maj < nchrdev; maj++) {
- if (cdevsw[maj].d_open == wsdisplayopen)
- break;
- }
-
- cp->cn_dev = makedev(maj, 0);
- wsfbcninit = NULL;
-
-#if NDVBOX > 0 || NGBOX > 0 || NRBOX > 0 || NTOPCAT > 0
- /*
- * Look for an ``internal'' frame buffer.
- */
- va = IIOV(GRFIADDR);
- fbr = (struct diofbreg *)va;
- if (!badaddr((caddr_t)va)) {
- if (dio_fbidentify(-1, fbr)) {
- tmpconscode = CONSCODE_INTERNAL;
- mapsize = 0;
- goto found;
- }
- }
-#endif
-
-#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NSTI_DIO > 0 || NTOPCAT > 0 || NTVRX > 0
- /*
- * Scan the DIO bus.
- */
- sctop = DIO_SCMAX(machineid);
- for (scode = 0; scode < sctop; scode++) {
- /*
- * Skip over the select code hole and the internal
- * HP-IB controller.
- */
- if ((sctmp = dio_inhole(scode)) != 0) {
- scode = sctmp - 1;
- continue;
- }
- if (scode == 7 && internalhpib)
- continue;
-
- /* Map current PA. */
- pa = (paddr_t)dio_scodetopa(scode);
- va = (vaddr_t)iomap((caddr_t)pa, PAGE_SIZE);
- if (va == 0)
- continue;
-
- /* Check to see if hardware exists. */
- if (badaddr((caddr_t)va)) {
- iounmap((caddr_t)va, PAGE_SIZE);
- continue;
- }
-
- /* Check hardware. */
- fbr = (struct diofbreg *)va;
- if (dio_fbidentify(scode, fbr)) {
- tmpconscode = scode;
- mapsize = DIO_SIZE(scode, va);
- iounmap((caddr_t)va, PAGE_SIZE);
-
-#if NSTI_DIO > 0
- if (wsfbcninit == sticninit) {
- mapsize = 0;
- va = 0;
- } else
-#endif
- {
- va = (vaddr_t)iomap((caddr_t)pa, mapsize);
- if (va == 0)
- continue;
- }
- goto found;
- } else
- iounmap((caddr_t)va, PAGE_SIZE);
- }
-#endif
-
-#if NSTI_SGC > 0
- /*
- * Scan the SGC bus.
- */
- for (scode = 0; scode < SGC_NSLOTS; scode++) {
- int rv;
-
- /* Map current PA. */
- pa = (paddr_t)sgc_slottopa(scode);
- va = (vaddr_t)iomap((caddr_t)pa, PAGE_SIZE);
- if (va == 0)
- continue;
-
- /* Check to see if hardware exists. */
- rv = badaddr((caddr_t)va);
- iounmap((caddr_t)va, PAGE_SIZE);
- if (rv != 0)
- continue;
-
- /* Check hardware. */
- if (sti_sgc_probe(&hp300_mem_tag, scode) != 0) {
- wsfbcninit = sticninit;
- tmpconscode = SGC_SLOT_TO_CONSCODE(scode);
- mapsize = 0;
- va = 0;
- goto found;
- }
- }
-#endif
-
- return;
-
-found:
- cp->cn_pri = CN_MIDPRI;
-#ifdef CONSCODE
- if (CONSCODE == tmpconscode)
- cp->cn_pri = CN_FORCED;
-#endif
-
- /*
- * If our priority is higher than the currently remembered console,
- * install ourselves, and unmap whichever device might be currently
- * mapped.
- */
- if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) {
- cn_tab = cp;
- /* Free last mapping. */
- if (convasize)
- iounmap(conaddr, convasize);
- conscode = tmpconscode;
- conaddr = (caddr_t)va;
- convasize = mapsize;
- }
-}
-
-void
-wscninit(struct consdev *cp)
-{
- /*
- * Note that this relies on the fact that DIO frame buffers (except
- * for sti@dio) will cause cn_tab to switch to wsdisplaycons, so
- * their cninit function will never get invoked a second time during
- * the second console pass.
- */
- if (wsfbcninit != NULL)
- (*wsfbcninit)();
-}
-
-void
-wscnputc(dev_t dev, int i)
-{
-#if NWSDISPLAY > 0
- wsdisplay_cnputc(dev, i);
-#endif
-}
-
-int
-wscngetc(dev_t dev)
-{
-#if NWSKBD > 0
- return (wskbd_cngetc(dev));
-#else
- return (0);
-#endif
-}
-
-void
-wscnpollc(dev_t dev, int on)
-{
-#if NWSKBD > 0
- wskbd_cnpollc(dev, on);
-#endif
-}
diff --git a/sys/arch/hp300/include/_float.h b/sys/arch/hp300/include/_float.h
deleted file mode 100644
index 32bc0d2538c..00000000000
--- a/sys/arch/hp300/include/_float.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */
-
-#include <m68k/_float.h>
diff --git a/sys/arch/hp300/include/_types.h b/sys/arch/hp300/include/_types.h
deleted file mode 100644
index 1cc7c32cc55..00000000000
--- a/sys/arch/hp300/include/_types.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $OpenBSD: _types.h,v 1.5 2012/11/05 19:39:34 miod Exp $ */
-
-/* public domain */
-
-#ifndef _MACHINE__TYPES_H_
-#define _MACHINE__TYPES_H_
-
-#include <m68k/_types.h>
-
-#endif /* _MACHINE__TYPES_H_ */
diff --git a/sys/arch/hp300/include/asm.h b/sys/arch/hp300/include/asm.h
deleted file mode 100644
index cf9ef23de52..00000000000
--- a/sys/arch/hp300/include/asm.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: asm.h,v 1.2 1997/01/12 15:13:31 downsj Exp $ */
-/* $NetBSD: asm.h,v 1.2 1994/10/26 07:26:18 cgd Exp $ */
-
-#include <m68k/asm.h>
diff --git a/sys/arch/hp300/include/atomic.h b/sys/arch/hp300/include/atomic.h
deleted file mode 100644
index 94c3f687476..00000000000
--- a/sys/arch/hp300/include/atomic.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $OpenBSD: atomic.h,v 1.3 2011/03/23 16:54:34 pirofti Exp $ */
-
-/* Public Domain */
-
-#ifndef _MACHINE_ATOMIC_H_
-#define _MACHINE_ATOMIC_H_
-
-#include <m68k/atomic.h>
-
-#endif /* _MACHINE_ATOMIC_H_ */
diff --git a/sys/arch/hp300/include/autoconf.h b/sys/arch/hp300/include/autoconf.h
deleted file mode 100644
index d5035e671bc..00000000000
--- a/sys/arch/hp300/include/autoconf.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $OpenBSD: autoconf.h,v 1.15 2008/06/26 05:42:10 ray Exp $ */
-/* $NetBSD: autoconf.h,v 1.4 1997/04/01 03:03:56 scottr Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifdef _KERNEL
-extern int conscode; /* select code of console device */
-#define CONSCODE_INTERNAL (-1)
-#define CONSCODE_INVALID (-2)
-extern caddr_t conaddr; /* KVA of console device */
-extern int convasize; /* size of mapping at conaddr */
-extern int consolepass; /* console initialization pass */
-
-void hp300_cninit(void);
-void console_scan(int (*)(int, caddr_t, void *), void *);
-caddr_t iomap(caddr_t, int);
-void iounmap(caddr_t, int);
-#endif /* _KERNEL */
diff --git a/sys/arch/hp300/include/bus.h b/sys/arch/hp300/include/bus.h
deleted file mode 100644
index 4a553b65591..00000000000
--- a/sys/arch/hp300/include/bus.h
+++ /dev/null
@@ -1,281 +0,0 @@
-/* $OpenBSD: bus.h,v 1.7 2011/03/23 16:54:34 pirofti Exp $ */
-/* $NetBSD: bus.h,v 1.9 1998/01/13 18:32:15 scottr 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) 1997 Scott Reynolds. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _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 u_long bus_space_handle_t;
-
-struct hp300_bus_space_tag {
- int (*bs_map)(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
- void (*bs_unmap)(bus_space_handle_t, bus_size_t);
- int (*bs_subregion)(bus_space_handle_t, bus_size_t, bus_size_t,
- bus_space_handle_t *);
- void * (*bs_vaddr)(bus_space_handle_t);
-
- u_int8_t (*bsr1)(bus_space_handle_t, bus_size_t);
- u_int16_t (*bsr2)(bus_space_handle_t, bus_size_t);
- u_int32_t (*bsr4)(bus_space_handle_t, bus_size_t);
- void (*bsrm1)(bus_space_handle_t, bus_size_t,
- u_int8_t *, size_t);
- void (*bsrm2)(bus_space_handle_t, bus_size_t,
- u_int16_t *, size_t);
- void (*bsrm4)(bus_space_handle_t, bus_size_t,
- u_int32_t *, size_t);
- void (*bsrrm2)(bus_space_handle_t, bus_size_t,
- u_int8_t *, size_t);
- void (*bsrrm4)(bus_space_handle_t, bus_size_t,
- u_int8_t *, size_t);
- void (*bsrr1)(bus_space_handle_t, bus_size_t,
- u_int8_t *, size_t);
- void (*bsrr2)(bus_space_handle_t, bus_size_t,
- u_int16_t *, size_t);
- void (*bsrr4)(bus_space_handle_t, bus_size_t,
- u_int32_t *, size_t);
- void (*bsrrr2)(bus_space_handle_t, bus_size_t,
- u_int8_t *, size_t);
- void (*bsrrr4)(bus_space_handle_t, bus_size_t,
- u_int8_t *, size_t);
- void (*bsw1)(bus_space_handle_t, bus_size_t, u_int8_t);
- void (*bsw2)(bus_space_handle_t, bus_size_t,
- u_int16_t);
- void (*bsw4)(bus_space_handle_t, bus_size_t,
- u_int32_t);
- void (*bswm1)(bus_space_handle_t, bus_size_t,
- const u_int8_t *, size_t);
- void (*bswm2)(bus_space_handle_t, bus_size_t,
- const u_int16_t *, size_t);
- void (*bswm4)(bus_space_handle_t, bus_size_t,
- const u_int32_t *, size_t);
- void (*bswrm2)(bus_space_handle_t, bus_size_t,
- const u_int8_t *, size_t);
- void (*bswrm4)(bus_space_handle_t, bus_size_t,
- const u_int8_t *, size_t);
- void (*bswr1)(bus_space_handle_t, bus_size_t,
- const u_int8_t *, size_t);
- void (*bswr2)(bus_space_handle_t, bus_size_t,
- const u_int16_t *, size_t);
- void (*bswr4)(bus_space_handle_t, bus_size_t,
- const u_int32_t *, size_t);
- void (*bswrr2)(bus_space_handle_t, bus_size_t,
- const u_int8_t *, size_t);
- void (*bswrr4)(bus_space_handle_t, bus_size_t,
- const u_int8_t *, size_t);
- void (*bssm1)(bus_space_handle_t, bus_size_t,
- u_int8_t v, size_t);
- void (*bssm2)(bus_space_handle_t, bus_size_t,
- u_int16_t v, size_t);
- void (*bssm4)(bus_space_handle_t, bus_size_t,
- u_int32_t v, size_t);
- void (*bssr1)(bus_space_handle_t, bus_size_t,
- u_int8_t v, size_t);
- void (*bssr2)(bus_space_handle_t, bus_size_t,
- u_int16_t v, size_t);
- void (*bssr4)(bus_space_handle_t, bus_size_t,
- u_int32_t v, size_t);
-};
-
-typedef const struct hp300_bus_space_tag *bus_space_tag_t;
-
-#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,r) ((t)->bs_map(a,s,f,r))
-#define bus_space_unmap(t,h,s) ((t)->bs_unmap(h,s))
-#define bus_space_subregion(t,h,o,s,r) ((t)->bs_subregion(h,o,s,r))
-#define bus_space_vaddr(t,h) ((t)->bs_vaddr(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) (t)->bsr1(h, o)
-#define bus_space_read_2(t,h,o) (t)->bsr2(h, o)
-#define bus_space_read_4(t,h,o) (t)->bsr4(h, o)
-
-/*
- * 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.
- */
-
-#define bus_space_read_multi_1(t, h, o, a, c) (t)->bsrm1(h, o, a, c)
-#define bus_space_read_multi_2(t, h, o, a, c) (t)->bsrm2(h, o, a, c)
-#define bus_space_read_multi_4(t, h, o, a, c) (t)->bsrm4(h, o, a, c)
-#define bus_space_read_raw_multi_2(t, h, o, a, c) (t)->bsrrm2(h, o, a, c)
-#define bus_space_read_raw_multi_4(t, h, o, a, c) (t)->bsrrm4(h, o, a, c)
-
-/*
- * 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.
- */
-
-#define bus_space_read_region_1(t, h, o, a, c) (t)->bsrr1(h,o,a,c)
-#define bus_space_read_region_2(t, h, o, a, c) (t)->bsrr2(h,o,a,c)
-#define bus_space_read_region_4(t, h, o, a, c) (t)->bsrr4(h,o,a,c)
-#define bus_space_read_raw_region_2(t, h, o, a, c) (t)->bsrrr2(h,o,a,c)
-#define bus_space_read_raw_region_4(t, h, o, a, c) (t)->bsrrr4(h,o,a,c)
-
-/*
- * 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) (t)->bsw1(h, o, v)
-#define bus_space_write_2(t, h, o, v) (t)->bsw2(h, o, v)
-#define bus_space_write_4(t, h, o, v) (t)->bsw4(h, o, v)
-
-/*
- * 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.
- */
-
-#define bus_space_write_multi_1(t, h, o, a, c) (t)->bswm1(h, o, a, c)
-#define bus_space_write_multi_2(t, h, o, a, c) (t)->bswm2(h, o, a, c)
-#define bus_space_write_multi_4(t, h, o, a, c) (t)->bswm4(h, o, a, c)
-#define bus_space_write_raw_multi_2(t, h, o, a, c) (t)->bswrm2(h, o, a, c)
-#define bus_space_write_raw_multi_4(t, h, o, a, c) (t)->bswrm4(h, o, a, c)
-
-/*
- * 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'.
- */
-
-#define bus_space_write_region_1(t, h, o, a, c) (t)->bswr1(h, o, a, c)
-#define bus_space_write_region_2(t, h, o, a, c) (t)->bswr2(h, o, a, c)
-#define bus_space_write_region_4(t, h, o, a, c) (t)->bswr4(h, o, a, c)
-#define bus_space_write_raw_region_2(t, h, o, a, c) (t)->bswrr2(h, o, a, c)
-#define bus_space_write_raw_region_4(t, h, o, a, c) (t)->bswrr4(h, o, a, c)
-
-/*
- * 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.
- */
-
-#define bus_space_set_multi_1(t, h, o, val, c) (t)->bssm1(h, o, val, c)
-#define bus_space_set_multi_2(t, h, o, val, c) (t)->bssm2(h, o, val, c)
-#define bus_space_set_multi_4(t, h, o, val, c) (t)->bssm4(h, o, val, c)
-
-/*
- * 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'.
- */
-
-#define bus_space_set_region_1(t, h, o, val, c) (t)->bssr1(h, o, val, c)
-#define bus_space_set_region_2(t, h, o, val, c) (t)->bssr2(h, o, val, c)
-#define bus_space_set_region_4(t, h, o, val, c) (t)->bssr4(h, o, val, c)
-
-/*
- * 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 680x0 does not currently require barriers, but we must
- * provide the flags to MI code.
- */
-#define bus_space_barrier(t, h, o, l, f) \
- ((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f)))
-#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
-#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
-
-#endif /* _MACHINE_BUS_H_ */
diff --git a/sys/arch/hp300/include/cdefs.h b/sys/arch/hp300/include/cdefs.h
deleted file mode 100644
index a06bff6b7c7..00000000000
--- a/sys/arch/hp300/include/cdefs.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $OpenBSD: cdefs.h,v 1.3 2005/11/24 20:46:44 deraadt Exp $ */
-
-#ifndef _MACHINE_CDEFS_H_
-#define _MACHINE_CDEFS_H_
-
-#include <m68k/cdefs.h>
-
-#endif
diff --git a/sys/arch/hp300/include/cpu.h b/sys/arch/hp300/include/cpu.h
deleted file mode 100644
index 5b491cb61dc..00000000000
--- a/sys/arch/hp300/include/cpu.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/* $OpenBSD: cpu.h,v 1.39 2011/03/23 16:54:34 pirofti Exp $ */
-/* $NetBSD: cpu.h,v 1.28 1998/02/13 07:41:51 scottr Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: cpu.h 1.16 91/03/25$
- *
- * @(#)cpu.h 8.4 (Berkeley) 1/5/94
- */
-
-#ifndef _MACHINE_CPU_H_
-#define _MACHINE_CPU_H_
-
-/*
- * Exported definitions unique to hp300/68k cpu support.
- */
-
-/*
- * Get common m68k CPU definitions.
- */
-#include <m68k/cpu.h>
-
-#ifdef _KERNEL
-
-/*
- * Get interrupt glue.
- */
-#include <machine/intr.h>
-
-/*
- * Arguments to hardclock and gatherstats encapsulate the previous
- * machine state in an opaque clockframe. On the hp300, we use
- * what the hardware pushes on an interrupt (frame format 0).
- */
-struct clockframe {
- u_short sr; /* sr at time of interrupt */
- u_long pc; /* pc at time of interrupt */
- u_short vo; /* vector offset (4-word frame) */
-};
-
-#define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0)
-#define CLKF_PC(framep) ((framep)->pc)
-#if 0
-/* We would like to do it this way... */
-#define CLKF_INTR(framep) (((framep)->sr & PSL_M) == 0)
-#else
-/* but until we start using PSL_M, we have to do this instead */
-#define CLKF_INTR(framep) (0) /* XXX */
-#endif
-
-
-/*
- * Preempt the current process if in interrupt from user mode,
- * or after the current trap/syscall if in system mode.
- */
-extern int want_resched; /* resched() was called */
-#define need_resched(ci) { want_resched = 1; aston(); }
-#define clear_resched(ci) want_resched = 0
-
-/*
- * Give a profiling tick to the current process when the user profiling
- * buffer pages are invalid. On the hp300, request an ast to send us
- * through trap, marking the proc as needing a profiling tick.
- */
-#define need_proftick(p) aston()
-
-/*
- * Notify the current process (p) that it has a signal pending,
- * process as soon as possible.
- */
-#define signotify(p) aston()
-
-extern int astpending; /* need to trap before returning to user mode */
-#define aston() (astpending = 1)
-
-#endif /* _KERNEL */
-
-/*
- * CTL_MACHDEP definitions.
- */
-#define CPU_CONSDEV 1 /* dev_t: console terminal device */
-#define CPU_CPUSPEED 2 /* CPU speed in MHz */
-#define CPU_MACHINEID 3 /* machine id (HP_XXX) */
-#define CPU_MMUID 4 /* mmu id (MMUID_*) */
-#define CPU_MAXID 5 /* number of valid machdep ids */
-
-#define CTL_MACHDEP_NAMES { \
- { 0, 0 }, \
- { "console_device", CTLTYPE_STRUCT }, \
- { "cpuspeed", CTLTYPE_INT }, \
- { "machineid", CTLTYPE_INT }, \
- { "mmuid", CTLTYPE_INT }, \
-}
-
-/*
- * The rest of this should probably be moved to <machine/hp300spu.h>,
- * although some of it could probably be put into generic 68k headers.
- */
-
-#ifdef _KERNEL
-extern char *intiobase, *intiolimit;
-extern void (*vectab[])(void);
-
-struct frame;
-struct fpframe;
-struct pcb;
-
-/* locore.s functions */
-void PCIA(void);
-__dead void doboot(void);
-void ecacheon(void);
-void ecacheoff(void);
-
-/* clock.c functions */
-void hp300_calibrate_delay(void);
-
-/* machdep.c functions */
-int badaddr(caddr_t);
-int badbaddr(caddr_t);
-void dumpconf(void);
-
-#endif /* _KERNEL */
-
-/* physical memory sections */
-#define ROMBASE (0x00000000)
-#define INTIOBASE (0x00400000)
-#define INTIOTOP (0x00600000)
-#define MAXADDR (0xFFFFF000)
-
-/*
- * Internal IO space:
- *
- * Ranges from 0x400000 to 0x600000 (IIOMAPSIZE).
- *
- * Internal IO space is mapped in the kernel from ``intiobase'' to
- * ``intiolimit'' (defined in locore.s). Since it is always mapped,
- * conversion between physical and kernel virtual addresses is easy.
- */
-#define ISIIOVA(va) \
- ((char *)(va) >= intiobase && (char *)(va) < intiolimit)
-#define IIOV(pa) ((int)(pa)-INTIOBASE+(int)intiobase)
-#define IIOP(va) ((int)(va)-(int)intiobase+INTIOBASE)
-#define IIOPOFF(pa) ((int)(pa)-INTIOBASE)
-#define IIOMAPSIZE atop(INTIOTOP-INTIOBASE) /* 2mb */
-
-/*
- * HP MMU
- */
-#define MMUBASE IIOPOFF(0x5F4000)
-#define MMUSSTP 0x0
-#define MMUUSTP 0x4
-#define MMUTBINVAL 0x8
-#define MMUSTAT 0xC
-#define MMUCMD MMUSTAT
-
-#define MMU_UMEN 0x0001 /* enable user mapping */
-#define MMU_SMEN 0x0002 /* enable supervisor mapping */
-#define MMU_CEN 0x0004 /* enable data cache */
-#define MMU_BERR 0x0008 /* bus error */
-#define MMU_IEN 0x0020 /* enable instruction cache */
-#define MMU_FPE 0x0040 /* enable 68881 FP coprocessor */
-#define MMU_WPF 0x2000 /* write protect fault */
-#define MMU_PF 0x4000 /* page fault */
-#define MMU_PTF 0x8000 /* page table fault */
-
-#define MMU_FAULT (MMU_PTF|MMU_PF|MMU_WPF|MMU_BERR)
-#define MMU_ENAB (MMU_UMEN|MMU_SMEN|MMU_IEN|MMU_FPE)
-
-#endif /* _MACHINE_CPU_H_ */
diff --git a/sys/arch/hp300/include/db_machdep.h b/sys/arch/hp300/include/db_machdep.h
deleted file mode 100644
index bf3b49e5752..00000000000
--- a/sys/arch/hp300/include/db_machdep.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: db_machdep.h,v 1.2 1997/01/12 15:13:33 downsj Exp $ */
-/* $NetBSD: db_machdep.h,v 1.2 1994/10/26 07:26:21 cgd Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/db_machdep.h>
diff --git a/sys/arch/hp300/include/disklabel.h b/sys/arch/hp300/include/disklabel.h
deleted file mode 100644
index 29c598bccf1..00000000000
--- a/sys/arch/hp300/include/disklabel.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $OpenBSD: disklabel.h,v 1.8 2007/06/20 18:15:45 deraadt 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 2 /* sector containing label */
-#define LABELOFFSET 0 /* offset of label in sector */
-#define MAXPARTITIONS 16 /* number of partitions */
-
-#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/hp300/include/endian.h b/sys/arch/hp300/include/endian.h
deleted file mode 100644
index adaabad0352..00000000000
--- a/sys/arch/hp300/include/endian.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: endian.h,v 1.5 2011/03/15 18:23:38 deraadt Exp $ */
-/* $NetBSD: endian.h,v 1.6 1994/10/26 07:26:22 cgd Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/endian.h>
diff --git a/sys/arch/hp300/include/exec.h b/sys/arch/hp300/include/exec.h
deleted file mode 100644
index efcb5a0d14f..00000000000
--- a/sys/arch/hp300/include/exec.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* $OpenBSD: exec.h,v 1.9 2003/10/09 21:48:45 miod Exp $ */
-/* $NetBSD: exec.h,v 1.10 1995/11/20 01:15:26 thorpej 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.
- */
-
-#include <m68k/exec.h>
diff --git a/sys/arch/hp300/include/fenv.h b/sys/arch/hp300/include/fenv.h
deleted file mode 100644
index e0663cb85a3..00000000000
--- a/sys/arch/hp300/include/fenv.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: fenv.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
-/* public domain */
-#include <m68k/fenv.h>
diff --git a/sys/arch/hp300/include/frame.h b/sys/arch/hp300/include/frame.h
deleted file mode 100644
index fc372d5c7e8..00000000000
--- a/sys/arch/hp300/include/frame.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: frame.h,v 1.2 1997/01/12 15:13:35 downsj Exp $ */
-/* $NetBSD: frame.h,v 1.6 1994/10/26 07:26:26 cgd Exp $ */
-
-#include <m68k/frame.h>
diff --git a/sys/arch/hp300/include/hil_machdep.h b/sys/arch/hp300/include/hil_machdep.h
deleted file mode 100644
index e7bf41150ef..00000000000
--- a/sys/arch/hp300/include/hil_machdep.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $OpenBSD: hil_machdep.h,v 1.1 2005/01/14 22:39:29 miod Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: hilreg.h 1.10 92/01/21$
- *
- * @(#)hilreg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * HP 9000/300-series specific HIL definitions
- */
-
-#define HILP_DATA 1 /* (R/W) data port */
-#define HILP_CMD 3 /* (R/W) status and control port */
-#define HILP_STAT HILP_CMD
-
-#define HILBUFSIZE 40 /* size of interrupt poll buffer */
-
-#define HILADDR 0x428000
-
-#define HILMAPSIZE 4
diff --git a/sys/arch/hp300/include/hp300spu.h b/sys/arch/hp300/include/hp300spu.h
deleted file mode 100644
index 3d6b86bb959..00000000000
--- a/sys/arch/hp300/include/hp300spu.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $OpenBSD: hp300spu.h,v 1.10 2011/08/18 19:54:18 miod Exp $ */
-/* $NetBSD: hp300spu.h,v 1.2 1997/05/01 05:26:48 thorpej 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 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_HP300SPU_H_
-#define _MACHINE_HP300SPU_H_
-
-/*
- * This file describes various constants that describe and/or
- * are unique to the HP 9000/300 or 400 SPUs.
- */
-
-/* values for machineid */
-#define HP_320 0 /* 16MHz 68020+HP MMU+16K external cache */
-#define HP_330 1 /* 16MHz 68020+68851 MMU */
-#define HP_350 2 /* 25MHz 68020+HP MMU+32K external cache */
-#define HP_36X 3 /* 25MHz 68030 */
-#define HP_370 4 /* 33MHz 68030+64K external cache */
-#define HP_340 5 /* 16MHz 68030 */
-#define HP_345 6 /* 50MHz 68030+32K external cache */
-#define HP_375 7 /* 50MHz 68030+32K external cache */
-#define HP_400 8 /* 50MHz 68030+32K external cache */
-#define HP_380 9 /* 25MHz 68040 */
-#define HP_425 10 /* 25MHz 68040 */
-#define HP_433 11 /* 33MHz 68040 */
-#define HP_385 12 /* 33MHz 68040 */
-#define HP_382 13 /* 25MHz 68040 */
-
-/* values for mmuid - used to differentiate similar CPU/cache combos */
-#define MMUID_345 1 /* 345 */
-#define MMUID_375 3 /* 375 */
-#define MMUID_382 11 /* 382 */
-#define MMUID_385 2 /* 385 */
-#define MMUID_425_T 5 /* 425t - 25MHz Trailways */
-#define MMUID_425_S 7 /* 425s - 25MHz Strider */
-#define MMUID_433_T 4 /* 433t - 33MHz Trailways */
-#define MMUID_433_S 6 /* 433s - 33MHz Strider */
-#define MMUID_425_E 9 /* 425e - 25MHz Woody */
-
-#define MMUID_SHIFT 8 /* right shift by this... */
-#define MMUID_MASK 0xff /* ...and mask with this to get mmuid */
-
-#if defined (_KERNEL) && !defined(_LOCORE)
-extern int machineid; /* CPU model */
-extern int cpuspeed; /* CPU speed, in MHz */
-extern int mmuid; /* MMU id */
-#endif /* _KERNEL && ! _LOCORE */
-
-#endif /* _MACHINE_HP300SPU_H_ */
diff --git a/sys/arch/hp300/include/ieee.h b/sys/arch/hp300/include/ieee.h
deleted file mode 100644
index df8030deb2b..00000000000
--- a/sys/arch/hp300/include/ieee.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: ieee.h,v 1.1 2001/09/06 00:07:09 millert Exp $ */
-
-#include <m68k/ieee.h>
diff --git a/sys/arch/hp300/include/ieeefp.h b/sys/arch/hp300/include/ieeefp.h
deleted file mode 100644
index 0f5193f345f..00000000000
--- a/sys/arch/hp300/include/ieeefp.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: ieeefp.h,v 1.2 1997/01/12 15:13:36 downsj Exp $ */
-/* $NetBSD: ieeefp.h,v 1.2 1995/04/16 16:47:08 jtc Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/ieeefp.h>
diff --git a/sys/arch/hp300/include/intr.h b/sys/arch/hp300/include/intr.h
deleted file mode 100644
index 2d5d61e0e7f..00000000000
--- a/sys/arch/hp300/include/intr.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* $OpenBSD: intr.h,v 1.30 2013/05/17 19:38:51 kettenis Exp $ */
-/* $NetBSD: intr.h,v 1.2 1997/07/24 05:43:08 scottr 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 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_INTR_H_
-#define _MACHINE_INTR_H_
-
-#include <machine/psl.h>
-#include <sys/evcount.h>
-#include <sys/queue.h>
-
-#ifdef _KERNEL
-struct isr {
- LIST_ENTRY(isr) isr_link;
- int (*isr_func)(void *);
- void *isr_arg;
- int isr_ipl;
- int isr_priority;
- struct evcount isr_count;
-};
-
-#define NISR 8
-
-/*
- * Interrupt "levels". These are a more abstract representation
- * of interrupt levels, and do not have the same meaning as m68k
- * CPU interrupt levels. They serve two purposes:
- *
- * - properly order ISRs in the list for that CPU ipl
- * - compute CPU PSL values for the spl*() calls.
- */
-#define IPL_NONE 0
-#define IPL_SOFTINT 1
-#define IPL_BIO 2
-#define IPL_NET 3
-#define IPL_TTY 4
-#define IPL_VM 5
-#define IPL_AUDIO 6
-#define IPL_CLOCK 6
-#define IPL_STATCLOCK 6
-#define IPL_SCHED 7
-#define IPL_HIGH 7
-
-#define IPL_MPSAFE 0 /* no "mpsafe" interrupts */
-
-/*
- * This array contains the appropriate PSL_S|PSL_IPL? values
- * to raise interrupt priority to the requested level.
- */
-extern unsigned short hp300_varpsl[NISR];
-#define MD_IPLTOPSL(ipl) hp300_varpsl[ipl]
-
-/* These spl calls are used by machine-independent code. */
-#define splsoft() _splraise(PSL_S | PSL_IPL1)
-#define splsoftclock() splsoft()
-#define splsoftnet() splsoft()
-#define splbio() _splraise(hp300_varpsl[IPL_BIO])
-#define splnet() _splraise(hp300_varpsl[IPL_NET])
-#define spltty() _splraise(hp300_varpsl[IPL_TTY])
-#define splaudio() _splraise(PSL_S | PSL_IPL6)
-#define splclock() _splraise(PSL_S | PSL_IPL6)
-#define splstatclock() _splraise(PSL_S | PSL_IPL6)
-#define splvm() _splraise(PSL_S | PSL_IPL5)
-#define splhigh() _spl(PSL_S | PSL_IPL7)
-#define splsched() splhigh()
-
-/* watch out for side effects */
-#define splx(s) ((s) & PSL_IPL ? _spl((s)) : spl0())
-
-#include <m68k/intr.h> /* soft interrupt support */
-
-/* locore.s */
-int spl0(void);
-
-/* intr.c */
-void intr_init(void);
-void intr_establish(struct isr *, const char *);
-void intr_disestablish(struct isr *);
-void intr_dispatch(int);
-void intr_printlevels(void);
-#endif /* _KERNEL */
-
-#endif /* _MACHINE_INTR_H_ */
diff --git a/sys/arch/hp300/include/kcore.h b/sys/arch/hp300/include/kcore.h
deleted file mode 100644
index 759565a3c72..00000000000
--- a/sys/arch/hp300/include/kcore.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $OpenBSD: kcore.h,v 1.1 1998/04/25 08:28:16 downsj Exp $ */
-/* $NetBSD: kcore.h,v 1.1 1996/05/12 02:47:46 mhitch Exp $ */
-
-#ifndef _MACHINE_KCORE_H_
-#define _MACHINE_KCORE_H_
-
-#include <m68k/kcore.h>
-
-#endif
diff --git a/sys/arch/hp300/include/limits.h b/sys/arch/hp300/include/limits.h
deleted file mode 100644
index 0ee861ad0fe..00000000000
--- a/sys/arch/hp300/include/limits.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $OpenBSD: limits.h,v 1.3 1997/07/24 14:48:48 deraadt Exp $ */
-/* $NetBSD: limits.h,v 1.7 1994/10/26 07:26:27 cgd Exp $ */
-
-#ifndef _MACHINE_LIMITS_H_
-#define _MACHINE_LIMITS_H_
-
-/* Just use the common m68k definition */
-#include <m68k/limits.h>
-
-#endif /* _MACHINE_LIMITS_H_ */
diff --git a/sys/arch/hp300/include/loadfile_machdep.h b/sys/arch/hp300/include/loadfile_machdep.h
deleted file mode 100644
index 5a3c87d1ac8..00000000000
--- a/sys/arch/hp300/include/loadfile_machdep.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $OpenBSD: loadfile_machdep.h,v 1.2 2013/10/17 11:53:59 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 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/hp300/include/lock.h b/sys/arch/hp300/include/lock.h
deleted file mode 100644
index 97101bc5338..00000000000
--- a/sys/arch/hp300/include/lock.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: lock.h,v 1.1 2007/05/01 18:56:27 miod Exp $ */
-/* public domain */
-#include <m68k/lock.h>
diff --git a/sys/arch/hp300/include/mutex.h b/sys/arch/hp300/include/mutex.h
deleted file mode 100644
index 6b77b1fcae8..00000000000
--- a/sys/arch/hp300/include/mutex.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: mutex.h,v 1.1 2007/02/03 20:08:48 miod Exp $ */
-/* public domain */
-#include <m68k/mutex.h>
diff --git a/sys/arch/hp300/include/param.h b/sys/arch/hp300/include/param.h
deleted file mode 100644
index 4b1ffd21653..00000000000
--- a/sys/arch/hp300/include/param.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: param.h,v 1.26 2013/03/23 16:12:22 deraadt 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.
- */
-
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
-
-#define _MACHINE hp300
-#define MACHINE "hp300"
-
-#define PAGE_SHIFT 12
-
-#define KERNBASE 0x00000000 /* start of kernel virtual */
-
-#include <m68k/param.h>
-
-#define MSGBUFSIZE 4096
-
-#if defined(_KERNEL) && !defined(_LOCORE)
-#define delay(us) _delay((us) << 8)
-#define DELAY(us) delay(us)
-
-void _delay(u_int);
-#endif /* _KERNEL && !_LOCORE */
-
-#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/hp300/include/pcb.h b/sys/arch/hp300/include/pcb.h
deleted file mode 100644
index 6ae98b579bb..00000000000
--- a/sys/arch/hp300/include/pcb.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $OpenBSD: pcb.h,v 1.5 2003/10/09 21:48:45 miod Exp $ */
-/* $NetBSD: pcb.h,v 1.8 1995/05/12 12:55:17 mycroft 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.
- *
- * from: Utah $Hdr: pcb.h 1.14 91/03/25$
- *
- * @(#)pcb.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <m68k/pcb.h>
diff --git a/sys/arch/hp300/include/pmap.h b/sys/arch/hp300/include/pmap.h
deleted file mode 100644
index 8ccf6b6bc35..00000000000
--- a/sys/arch/hp300/include/pmap.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $OpenBSD: pmap.h,v 1.16 2006/08/22 21:03:54 miod Exp $ */
-
-#ifndef _MACHINE_PMAP_H_
-#define _MACHINE_PMAP_H_
-
-#include <m68k/pmap_motorola.h>
-
-#if !defined(M68020)
-#define pmap_map_direct(pg) ((vaddr_t)VM_PAGE_TO_PHYS(pg))
-#define pmap_unmap_direct(va) PHYS_TO_VM_PAGE((paddr_t)va)
-#define __HAVE_PMAP_DIRECT
-#define PMAP_STEAL_MEMORY
-#endif
-
-#ifdef _KERNEL
-void pmap_init_md(void);
-#define PMAP_INIT_MD() pmap_init_md()
-#endif
-
-#endif /* _MACHINE_PMAP_H_ */
diff --git a/sys/arch/hp300/include/proc.h b/sys/arch/hp300/include/proc.h
deleted file mode 100644
index ccdd88ff0ee..00000000000
--- a/sys/arch/hp300/include/proc.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* $OpenBSD: proc.h,v 1.6 2003/10/09 21:48:45 miod Exp $ */
-/* $NetBSD: proc.h,v 1.7 1997/03/16 09:41:36 thorpej Exp $ */
-
-/*
- * Copyright (c) 1991, 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.
- *
- * @(#)proc.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <m68k/proc.h>
diff --git a/sys/arch/hp300/include/profile.h b/sys/arch/hp300/include/profile.h
deleted file mode 100644
index 644a9fdfeaa..00000000000
--- a/sys/arch/hp300/include/profile.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: profile.h,v 1.2 1997/01/12 15:13:40 downsj Exp $ */
-/* $NetBSD: profile.h,v 1.2 1994/10/26 07:26:38 cgd Exp $ */
-
-#include <m68k/profile.h>
diff --git a/sys/arch/hp300/include/psl.h b/sys/arch/hp300/include/psl.h
deleted file mode 100644
index 12ece870daa..00000000000
--- a/sys/arch/hp300/include/psl.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: psl.h,v 1.2 1997/01/12 15:13:41 downsj Exp $ */
-/* $NetBSD: psl.h,v 1.5 1994/10/26 07:26:39 cgd Exp $ */
-
-#include <m68k/psl.h>
diff --git a/sys/arch/hp300/include/pte.h b/sys/arch/hp300/include/pte.h
deleted file mode 100644
index 601e0c8ca1e..00000000000
--- a/sys/arch/hp300/include/pte.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* $OpenBSD: pte.h,v 1.5 2002/01/10 21:10:47 miod Exp $ */
-
-#ifndef _MACHINE_PTE_H_
-#define _MACHINE_PTE_H_
-
-#include <m68k/pte_motorola.h>
-
-#define MACHINE_STSIZE M68K_STSIZE
-#define MACHINE_MAX_PTSIZE M68K_MAX_PTSIZE
-#define MACHINE_MAX_KPTSIZE M68K_MAX_KPTSIZE
-#define MACHINE_PTBASE M68K_PTBASE
-#define MACHINE_PTMAXSIZE M68K_PTMAXSIZE
-
-#endif /* _MACHINE_PTE_H_ */
diff --git a/sys/arch/hp300/include/ptrace.h b/sys/arch/hp300/include/ptrace.h
deleted file mode 100644
index d7682944e9e..00000000000
--- a/sys/arch/hp300/include/ptrace.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: ptrace.h,v 1.2 1997/01/12 15:13:42 downsj Exp $ */
-/* $NetBSD: ptrace.h,v 1.2 1994/10/26 07:26:42 cgd Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/ptrace.h>
diff --git a/sys/arch/hp300/include/reg.h b/sys/arch/hp300/include/reg.h
deleted file mode 100644
index 125fddf9825..00000000000
--- a/sys/arch/hp300/include/reg.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $OpenBSD: reg.h,v 1.2 1997/01/12 15:13:42 downsj Exp $ */
-/* $NetBSD: reg.h,v 1.9 1994/10/26 07:26:43 cgd Exp $ */
-
-#ifndef _MACHINE_REG_H_
-#define _MACHINE_REG_H_
-
-#include <m68k/reg.h>
-
-#endif /* _MACHINE_REG_H_ */
diff --git a/sys/arch/hp300/include/reloc.h b/sys/arch/hp300/include/reloc.h
deleted file mode 100644
index e4c43abb13e..00000000000
--- a/sys/arch/hp300/include/reloc.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: reloc.h,v 1.1 2013/02/02 13:34:29 miod Exp $ */
-/* public domain */
-#include <m68k/reloc.h>
diff --git a/sys/arch/hp300/include/setjmp.h b/sys/arch/hp300/include/setjmp.h
deleted file mode 100644
index d3e4e17d501..00000000000
--- a/sys/arch/hp300/include/setjmp.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: setjmp.h,v 1.2 1997/01/12 15:13:43 downsj Exp $ */
-/* $NetBSD: setjmp.h,v 1.1 1994/12/20 10:36:38 cgd Exp $ */
-
-#include <m68k/setjmp.h>
diff --git a/sys/arch/hp300/include/signal.h b/sys/arch/hp300/include/signal.h
deleted file mode 100644
index 3703f702862..00000000000
--- a/sys/arch/hp300/include/signal.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: signal.h,v 1.2 1997/01/12 15:13:43 downsj Exp $ */
-/* $NetBSD: signal.h,v 1.3 1994/10/26 07:26:44 cgd Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/signal.h>
diff --git a/sys/arch/hp300/include/spinlock.h b/sys/arch/hp300/include/spinlock.h
deleted file mode 100644
index ef70517a7dc..00000000000
--- a/sys/arch/hp300/include/spinlock.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: spinlock.h,v 1.1 1999/01/21 02:59:33 millert Exp $ */
-
-#include <m68k/spinlock.h>
diff --git a/sys/arch/hp300/include/stdarg.h b/sys/arch/hp300/include/stdarg.h
deleted file mode 100644
index 89cf018016a..00000000000
--- a/sys/arch/hp300/include/stdarg.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: stdarg.h,v 1.2 1997/01/12 15:13:44 downsj Exp $ */
-/* $NetBSD: stdarg.h,v 1.4 1994/10/26 07:26:45 cgd Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/stdarg.h>
diff --git a/sys/arch/hp300/include/tcb.h b/sys/arch/hp300/include/tcb.h
deleted file mode 100644
index 6b2b8157f85..00000000000
--- a/sys/arch/hp300/include/tcb.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: tcb.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
-/* public domain */
-#include <m68k/tcb.h>
diff --git a/sys/arch/hp300/include/trap.h b/sys/arch/hp300/include/trap.h
deleted file mode 100644
index bd17be38436..00000000000
--- a/sys/arch/hp300/include/trap.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: trap.h,v 1.2 1997/01/12 15:13:44 downsj Exp $ */
-/* $NetBSD: trap.h,v 1.6 1994/10/26 07:26:47 cgd Exp $ */
-
-#include <m68k/trap.h>
diff --git a/sys/arch/hp300/include/varargs.h b/sys/arch/hp300/include/varargs.h
deleted file mode 100644
index c6c7fbecba6..00000000000
--- a/sys/arch/hp300/include/varargs.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: varargs.h,v 1.2 1997/01/12 15:13:45 downsj Exp $ */
-/* $NetBSD: varargs.h,v 1.2 1994/10/26 07:26:50 cgd Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/varargs.h>
diff --git a/sys/arch/hp300/include/vmparam.h b/sys/arch/hp300/include/vmparam.h
deleted file mode 100644
index 0ec70df2e4b..00000000000
--- a/sys/arch/hp300/include/vmparam.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $OpenBSD: vmparam.h,v 1.19 2011/03/23 16:54:34 pirofti Exp $ */
-/* $NetBSD: vmparam.h,v 1.16 1998/08/20 08:33:48 kleink 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.
- *
- * from: Utah $Hdr: vmparam.h 1.16 91/01/18$
- *
- * @(#)vmparam.h 8.2 (Berkeley) 4/19/94
- */
-
-#ifndef _MACHINE_VMPARAM_H_
-#define _MACHINE_VMPARAM_H_
-
-/*
- * Machine dependent constants for HP300
- */
-
-/* address where direct translation starts */
-#define HP300_DIRECT_BASE 0xc0000000
-
-#include <m68k/vmparam.h>
-
-#undef VM_MAX_KERNEL_ADDRESS
-#define VM_MAX_KERNEL_ADDRESS (HP300_DIRECT_BASE - PAGE_SIZE)
-
-/*
- * Constants which control the way the VM system deals with memory segments.
- * The hp300 only has one physical memory segment.
- */
-#define VM_PHYSSEG_MAX 1
-#define VM_PHYSSEG_STRAT VM_PSTRAT_RANDOM
-
-#endif /* _MACHINE_VMPARAM_H_ */
diff --git a/sys/arch/hp300/stand/Makefile b/sys/arch/hp300/stand/Makefile
deleted file mode 100644
index 4a93dba19f4..00000000000
--- a/sys/arch/hp300/stand/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# $OpenBSD: Makefile,v 1.18 2007/11/26 10:01:42 deraadt Exp $
-# $NetBSD: Makefile,v 1.23 1997/02/04 03:51:37 thorpej Exp $
-
-.if ${MACHINE} == "hp300"
-SUBDIR= libsa libsaz libz common mkboot uboot cdboot installboot
-.endif
-
-.include <bsd.subdir.mk>
diff --git a/sys/arch/hp300/stand/Makefile.inc b/sys/arch/hp300/stand/Makefile.inc
deleted file mode 100644
index 6a38f063f22..00000000000
--- a/sys/arch/hp300/stand/Makefile.inc
+++ /dev/null
@@ -1,94 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.13 2013/02/10 20:27:18 miod Exp $
-# $NetBSD: Makefile.inc,v 1.7 1997/05/12 07:43:18 thorpej Exp $
-
-BINDIR= /usr/mdec
-
-# RELOC=FFF00000 allows for boot prog up to FF000 (1044480) bytes long
-RELOC= FFF00000
-
-CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes \
- -fno-stack-protector -msoft-float
-CFLAGS+= -fno-builtin-printf -fno-builtin-putchar \
- -fno-builtin-vprintf
-
-SA_CPPFLAGS+= -DAPCICONSOLE -DDCACONSOLE -DDCMCONSOLE -DITECONSOLE
-SA_CPPFLAGS+= -DHIL_KEYBOARD -DDOMAIN_KEYBOARD
-SA_CPPFLAGS+= -D_STANDALONE -D__hp300__
-SA_CPPFLAGS+= -DCOMPAT_UFS -DNO_LSEEK
-
-# Limit the alloc() heap to below the msgbuf and ROM scratch pages.
-SA_CPPFLAGS+= -DHEAP_LIMIT="0xffffdfff"
-
-### Figure out what to use for libcommon
-COMMONDIR= ${.CURDIR}/../common
-
-.if exists(${COMMONDIR}/${__objdir})
-COMMONOBJDIR= ${COMMONDIR}/${__objdir}
-.else
-COMMONOBJDIR= ${COMMONDIR}
-.endif
-
-LIBCOMMON= ${COMMONOBJDIR}/libcommon.a
-
-### Figure out what to use for libsa
-LIBSADIR= ${.CURDIR}/../libsa
-
-.if exists(${LIBSADIR}/${__objdir})
-LIBSAOBJDIR= ${LIBSADIR}/${__objdir}
-.else
-LIBSAOBJDIR= ${LIBSADIR}
-.endif
-
-LIBSA= ${LIBSAOBJDIR}/libsa.a
-
-### Figure out what to use for libsaz
-LIBSAZDIR= ${.CURDIR}/../libsaz
-
-.if exists(${LIBSAZDIR}/${__objdir})
-LIBSAZOBJDIR= ${LIBSAZDIR}/${__objdir}
-.else
-LIBSAZOBJDIR= ${LIBSAZDIR}
-.endif
-
-LIBSAZ= ${LIBSAZOBJDIR}/libsaz.a
-
-### Figure out what to use for libz
-LIBZDIR= ${.CURDIR}/../libz
-
-.if exists(${LIBZDIR}/${__objdir})
-LIBZOBJDIR= ${LIBZDIR}/${__objdir}
-.else
-LIBZOBJDIR= ${LIBZDIR}
-.endif
-
-LIBZ= ${LIBZOBJDIR}/libz.a
-
-### Figure out what to use for mkboot
-MKBOOTDIR= ${.CURDIR}/../mkboot
-
-.if exists(${MKBOOTDIR}/${__objdir})
-MKBOOTOBJDIR= ${MKBOOTDIR}/${__objdir}
-.else
-MKBOOTOBJDIR= ${MKBOOTDIR}
-.endif
-
-MKBOOT_PROG= ${MKBOOTOBJDIR}/mkboot
-
-### Figure out what to use for stripboot
-STRIPBOOTDIR= ${.CURDIR}/../stripboot
-
-.if exists(${STRIPBOOTDIR}/${__objdir})
-STRIPBOOTOBJDIR= ${STRIPBOOTDIR}/${__objdir}
-.else
-STRIPBOOTOBJDIR= ${STRIPBOOTDIR}
-.endif
-
-STRIPBOOT_PROG= ${STRIPBOOTOBJDIR}/stripboot
-
-# Make sure ${MKBOOT_PROG} is always available
-${MKBOOT_PROG}:
- @cd ${MKBOOTDIR} && make depend && make
-
-# Make sure ${STRIPBOOT_PROG} is always available
-${STRIPBOOT_PROG}:
- @cd ${STRIPBOOTDIR} && make depend && make
diff --git a/sys/arch/hp300/stand/cdboot/Makefile b/sys/arch/hp300/stand/cdboot/Makefile
deleted file mode 100644
index 175025fe33a..00000000000
--- a/sys/arch/hp300/stand/cdboot/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# $OpenBSD: Makefile,v 1.8 2013/02/02 13:34:29 miod Exp $
-
-PROG= cdboot
-OBJCOPY?=objcopy
-SIZE?= size
-
-NOMAN=
-NOPIE=
-
-CPPFLAGS+= ${SA_CPPFLAGS}
-
-.PATH: ${.CURDIR}/../uboot
-
-CFLAGS+=-DOSREV=\"${OSREV}\" -I${.CURDIR}/../include \
- -I${.CURDIR}/../libsa -I${.CURDIR}/../.. -I${.CURDIR}/../../.. \
- -I${.CURDIR}/../../../..
-
-AFLAGS= -x assembler-with-cpp -traditional-cpp -I${.CURDIR}/../include \
- -I${.CURDIR}/../libsa -I${.CURDIR}/../.. -I${.CURDIR}/../../.. \
- -I${.CURDIR}/../../../..
-
-SRCS= srt0.S cdboot.c clock.c conf.c cons.c devopen.c
-
-LIBS= ${LIBCOMMON} ${LIBSA} ${LIBZ}
-
-CLEANFILES+= ${PROG}.bin ${PROG}.lif
-
-cdboot.lif: ${PROG}
- ${OBJCOPY} -S -O binary ${PROG} ${PROG}.bin
- ${MKBOOT_PROG} -l 0x${RELOC} ${PROG}.bin $@
-
-cdboot: ${OBJS} ${LIBS}
- ${LD} -N -Ttext ${RELOC} -e begin --warn-common ${OBJS} ${LIBS} -o $@
- @${SIZE} $@
- @echo $@ total size may not exceed 30000 bytes
-
-install: cdboot.lif ${MKBOOT_PROG}
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 cdboot.lif \
- ${DESTDIR}/usr/mdec
-
-cdboot.o: Makefile
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/hp300/stand/cdboot/cdboot.c b/sys/arch/hp300/stand/cdboot/cdboot.c
deleted file mode 100644
index a92ee017c1b..00000000000
--- a/sys/arch/hp300/stand/cdboot/cdboot.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* $OpenBSD: cdboot.c,v 1.9 2014/02/23 19:22:40 miod Exp $ */
-/* $NetBSD: uboot.c,v 1.3 1997/04/27 21:17:13 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 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.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <machine/exec.h>
-#include <a.out.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-/*
- * Boot program... bits in `howto' determine whether boot stops to
- * ask for system name. Boot device is derived from ROM provided
- * information.
- */
-
-extern u_int opendev;
-extern char *lowram;
-extern int noconsole;
-
-extern const char version[];
-
-/*
- * XXX UFS accepts a /, NFS doesn't.
- */
-char *names[] = {
-#ifdef OSREV
- OSREV "/hp300/bsd.rd",
-#endif
- "bsd.rd", "bsd",
-};
-#define NUMNAMES (sizeof(names) / sizeof(char *))
-
-#if 0
-static int bdev, badapt, bctlr, bunit, bpart;
-#endif
-
-char rnddata[BOOTRANDOM_MAX]; /* XXX dummy */
-
-int
-main(void)
-{
- int currname = 0;
- char *name;
-
- printf("\n>> OpenBSD [%dKB] CDROM BOOT %s HP 9000/%s CPU\n",
- (__LDPGSZ / 1024), version, getmachineid());
-
-#if 0
- bdev = B_TYPE(bootdev);
- badapt = B_ADAPTOR(bootdev);
- bctlr = B_CONTROLLER(bootdev);
- bunit = B_UNIT(bootdev);
- bpart = B_PARTITION(bootdev);
-#endif
-
- for (;;) {
- name = names[currname++];
- if (currname == NUMNAMES)
- currname = 0;
-
- howto = RB_SINGLE;
-
- printf(": %s\n", name);
-
- exec(name, lowram, howto);
- printf("boot: %s\n", strerror(errno));
- }
- return (0);
-}
diff --git a/sys/arch/hp300/stand/cdboot/conf.c b/sys/arch/hp300/stand/cdboot/conf.c
deleted file mode 100644
index ce0ad14d5b3..00000000000
--- a/sys/arch/hp300/stand/cdboot/conf.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* $OpenBSD: conf.c,v 1.7 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: conf.c,v 1.12 1996/10/14 07:29:15 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 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.
- *
- * @(#)conf.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-#include <lib/libsa/cd9660.h>
-
-int debug = 0; /* XXX */
-
-/*
- * Device configuration
- */
-int sdstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int sdopen(struct open_file *, ...);
-int sdclose(struct open_file *);
-#define sdioctl noioctl
-
-#define xxstrategy \
- (int (*)(void *, int, daddr32_t, size_t, void *, size_t *))nullsys
-#define xxopen (int (*)(struct open_file *, ...))nodev
-#define xxclose (int (*)(struct open_file *))nullsys
-
-struct devsw devsw[] = {
- { "??", xxstrategy, xxopen, xxclose, noioctl }, /*0*/
- { "??", xxstrategy, xxopen, xxclose, noioctl }, /*1*/
- { "??", xxstrategy, xxopen, xxclose, noioctl }, /*2*/
- { "??", xxstrategy, xxopen, xxclose, noioctl }, /*3*/
- { "sd", sdstrategy, sdopen, sdclose, sdioctl }, /*4*/
-};
-int ndevs = (sizeof(devsw) / sizeof(devsw[0]));
-
-/*
- * Physical unit/lun detection.
- */
-int punitzero(int, int, int *);
-
-int
-punitzero(int ctlr, int slave, int *punit)
-{
-
- *punit = 0;
- return (0);
-}
-
-#define xxpunit punitzero
-#define sdpunit punitzero
-
-struct punitsw punitsw[] = {
- { xxpunit },
- { xxpunit },
- { xxpunit },
- { xxpunit },
- { sdpunit },
-};
-
-/*
- * Filesystem configuration
- */
-struct fs_ops file_system_cd9660[] = {
- { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
- cd9660_stat },
-};
-
-struct fs_ops file_system[2];
-int nfsys = 1; /* default; changed per device type. */
diff --git a/sys/arch/hp300/stand/cdboot/cons.c b/sys/arch/hp300/stand/cdboot/cons.c
deleted file mode 100644
index fbf12355849..00000000000
--- a/sys/arch/hp300/stand/cdboot/cons.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: cons.c,v 1.4 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: cons.c,v 1.2 1997/05/12 07:44:53 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: cons.c 1.7 92/02/28
- *
- * @(#)cons.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "consdefs.h"
-
-struct consdev *cn_tab;
-int noconsole;
-extern int userom;
-extern int donottwiddle; /* from libsa */
-
-void
-cninit()
-{
- cn_tab = NULL;
- noconsole = 1;
- userom = 1;
- donottwiddle = 1;
-}
-
-int
-cngetc()
-{
- return(0);
-}
-
-void
-cnputc(int c)
-{
- romputchar(c);
-}
-
-void
-putchar(int c)
-{
- cnputc(c);
- if (c == '\n')
- cnputc('\r');
-}
diff --git a/sys/arch/hp300/stand/cdboot/devopen.c b/sys/arch/hp300/stand/cdboot/devopen.c
deleted file mode 100644
index 2584c0cbf1b..00000000000
--- a/sys/arch/hp300/stand/cdboot/devopen.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/* $OpenBSD: devopen.c,v 1.4 2013/01/11 23:22:35 miod Exp $ */
-/* $NetBSD: devopen.c,v 1.7 1996/10/14 07:31:47 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1993 John Brezak
- * 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.
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-int atoi(char *);
-int devlookup(const char*, int);
-int devparse(const char *, int *, int *, int *, int *, int *, char **);
-void usage(void);
-
-u_int opendev;
-
-#define ispart(c) ((c) >= 'a' && (c) <= 'h')
-
-int
-atoi(char *cp)
-{
- int val = 0;
- while(isdigit(*cp))
- val = val * 10 + (*cp++ - '0');
- return(val);
-}
-
-void
-usage()
-{
- printf("Usage: device(adaptor, controller, drive, partition)file\n"
- " <device><unit><partitionletter>:file\n");
-}
-
-int
-devlookup(const char *d, int len)
-{
- struct devsw *dp = devsw;
- int i;
-
- for (i = 0; i < ndevs; i++, dp++) {
- if (dp->dv_name && strncmp(dp->dv_name, d, len) == 0) {
- /*
- * Set the filesystem and startup up according to
- * the device being opened.
- */
- switch (i) {
- case 4: /* sd - only supports cd9660 */
- bcopy(file_system_cd9660, file_system,
- sizeof(struct fs_ops));
- break;
-
- case 0: /* ct - not supported */
- case 2: /* hd - not supported */
- case 6: /* le - not supported */
- default:
- /* Agh! What happened?! */
- goto bad;
- }
- return(i);
- }
- }
-
-bad:
- printf("No such device - Configured devices are:\n");
- for (dp = devsw, i = 0; i < ndevs; i++, dp++)
- if (dp->dv_name)
- printf(" %s", dp->dv_name);
- printf("\n");
- errno = ENODEV;
- return(-1);
-}
-
-/*
- * Parse a device spec in one of two forms.
- *
- * dev(adapt, ctlr, unit, part)file
- * [A-Za-z]*[0-9]*[A-Za-z]:file
- * dev unit part
- */
-int
-devparse(const char *fname, int *dev, int *adapt, int *ctlr, int *unit,
- int *part, char **file)
-{
- int i;
- char *s, *args[4];
-
- /* check for device name */
- for (s = (char *)fname; *s && *s != '/' && *s != ':' && *s != '('; s++)
- /* if (isupper(*s)) *s = tolower(*s) */;
-
- /* first form */
- if (*s == '(') {
- /* make device name lower case */
- for (s = (char *)fname; *s != '('; s++)
- if (isupper(*s)) *s = tolower(*s);
- /* lookup device and get index */
- if ((*dev = devlookup(fname, s - fname)) < 0)
- goto baddev;
-
- /* tokenize device ident */
- args[0] = ++s;
- for (args[0] = s, i = 1; *s && *s != ')'; s++) {
- if (*s == ',')
- args[i++] = ++s;
- }
- switch(i) {
- case 4:
- *adapt = atoi(args[0]);
- *ctlr = atoi(args[1]);
- *unit = atoi(args[2]);
- *part = atoi(args[3]);
- break;
- case 3:
- *ctlr = atoi(args[0]);
- *unit = atoi(args[1]);
- *part = atoi(args[2]);
- break;
- case 2:
- *unit = atoi(args[0]);
- *part = atoi(args[1]);
- break;
- case 1:
- *part = atoi(args[0]);
- break;
- case 0:
- break;
- }
- *file = ++s;
- }
-
- /* second form */
- else if (*s == ':') {
- int temp;
-
- /* isolate device and make its name lower case*/
- for (s = (char *)fname; *s != ':' && !isdigit(*s); s++)
- if (isupper(*s)) *s = tolower(*s);
-
- /* lookup device and get index */
- if ((*dev = devlookup(fname, s - fname)) < 0)
- goto baddev;
-
- /* isolate unit */
- if ((temp = atoi(s)) > 255)
- goto bad;
- *adapt = temp / 8;
- *ctlr = temp % 8;
- for (; isdigit(*s); s++);
-
- /* translate partition */
- if (!ispart(*s))
- goto bad;
-
- *part = *s++ - 'a';
- if (*s != ':')
- goto bad;
- *file = ++s;
- }
-
- /* no device present */
- else
- *file = (char *)fname;
-
- /* return the remaining unparsed part as the file to boot */
- return(0);
-
-bad:
- usage();
-
-baddev:
- return(-1);
-}
-
-
-int
-devopen(struct open_file *f, const char *fname, char **file)
-{
- int error;
- int dev, adapt, ctlr, unit, part;
- struct devsw *dp = &devsw[0];
-
- dev = B_TYPE(bootdev);
- adapt = B_ADAPTOR(bootdev);
- ctlr = B_CONTROLLER(bootdev);
- unit = B_UNIT(bootdev);
- part = B_PARTITION(bootdev);
-
- if ((error = devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file)))
- return(error);
-
- /*
- * Set up filesystem type based on what device we're opening.
- */
- switch (dev) {
- case 4: /* sd - only supports cd9660 */
- bcopy(file_system_cd9660, file_system, sizeof(struct fs_ops));
- break;
-
- case 0: /* ct - not supported */
- case 2: /* hd - not supported */
- case 6: /* le - not supported */
- default:
- /* XXX what else should we do here? */
- printf("WARNING: BOGUS BOOT DEV TYPE 0x%x!\n", dev);
- return (EIO);
- }
-
- dp = &devsw[dev];
-
- if (!dp->dv_open)
- return(ENODEV);
-
- f->f_dev = dp;
-
- if ((error = (*dp->dv_open)(f, adapt, ctlr, part)) == 0) {
- if ((error =
- (*punitsw[dev].p_punit)(adapt, ctlr, &unit)) != 0) {
- goto bad;
- }
- opendev = MAKEBOOTDEV(dev, adapt, ctlr, unit, part);
- return(0);
- }
-
-bad:
- printf("%s(%d,%d,%d,%d): %s\n", devsw[dev].dv_name,
- adapt, ctlr, unit, part, strerror(error));
-
- return(error);
-}
diff --git a/sys/arch/hp300/stand/common/Makefile b/sys/arch/hp300/stand/common/Makefile
deleted file mode 100644
index 2ff68c674c0..00000000000
--- a/sys/arch/hp300/stand/common/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-# $OpenBSD: Makefile,v 1.7 2013/01/01 17:17:44 miod Exp $
-
-LIB= common
-
-NOMAN= noman
-
-CPPFLAGS+= ${SA_CPPFLAGS}
-
-SRCS= apci.c autoconf.c cons.c ct.c dca.c dcm.c dnkbd.c \
- fhpib.c hd.c hil.c hpib.c if_le.c ite.c ite_dv.c ite_gb.c ite_hy.c \
- ite_rb.c ite_sti.c ite_subr.c ite_tc.c ite_tvrx.c kbd.c kbdconf.c \
- machdep.c nhpib.c scsi.c sd.c version.c
-
-CFLAGS+=-I${.CURDIR}/../include \
- -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. -DCD9660_DUMMYLABEL
-
-NOPROFILE=
-NOPIC=
-
-install:
-
-.include <bsd.lib.mk>
diff --git a/sys/arch/hp300/stand/common/apci.c b/sys/arch/hp300/stand/common/apci.c
deleted file mode 100644
index eb3eefbec6d..00000000000
--- a/sys/arch/hp300/stand/common/apci.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $OpenBSD: apci.c,v 1.11 2010/08/16 14:50:16 miod Exp $ */
-/* $NetBSD: apci.c,v 1.2 1997/10/04 17:20:15 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1997, 1999 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) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dca.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef APCICONSOLE
-#include <sys/param.h>
-
-#include <hp300/dev/frodoreg.h> /* for APCI offsets */
-#include <hp300/dev/apcireg.h> /* for register map */
-#include <hp300/dev/dcareg.h> /* for register bits */
-
-#include "samachdep.h"
-#include "consdefs.h"
-
-struct apciregs *apcicnaddr = 0;
-
-void
-apciprobe(struct consdev *cp)
-{
- volatile u_int8_t *frodoregs;
-
- /*
- * Only a 425e can have an APCI console. On all other 4xx models,
- * the "first" serial port is mapped to the DCA at select code 9.
- */
- if (machineid != HP_425 || mmuid != MMUID_425_E)
- return;
-
- /*
- * Check the service switch. On the 425e, this is a physical
- * switch, unlike other frodo-based machines, so we can use it
- * as a serial vs internal video selector, since the PROM can not
- * be configured for serial console.
- */
- frodoregs = (volatile u_int8_t *)IIOV(FRODO_BASE);
- if (badaddr((caddr_t)frodoregs) == 0 &&
- (frodoregs[FRODO_IISR] & FRODO_IISR_SERVICE) == 0)
- cp->cn_pri = CN_HIGHPRI;
- else
- cp->cn_pri = CN_LOWPRI;
-
- apcicnaddr = (struct apciregs *)IIOV(FRODO_BASE + FRODO_APCI_OFFSET(1));
-}
-
-void
-apciinit(struct consdev *cp)
-{
- struct apciregs *apci = (struct apciregs *)apcicnaddr;
-
- apci->ap_cfcr = CFCR_DLAB;
- apci->ap_data = APCIBRD(9600) & 0xff;
- apci->ap_ier = (APCIBRD(9600) >> 8) & 0xff;
- apci->ap_cfcr = CFCR_8BITS;
- apci->ap_fifo =
- FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1;
- apci->ap_mcr = MCR_DTR | MCR_RTS;
-}
-
-/* ARGSUSED */
-int
-apcigetchar(dev_t dev)
-{
-#ifndef SMALL
- struct apciregs *apci = apcicnaddr;
- short stat;
- int c;
-
- if (((stat = apci->ap_lsr) & LSR_RXRDY) == 0)
- return (0);
- c = apci->ap_data;
- return (c);
-#else
- return (0);
-#endif
-}
-
-/* ARGSUSED */
-void
-apciputchar(dev_t dev, int c)
-{
- struct apciregs *apci = apcicnaddr;
- int timo;
- short stat;
-
- /* wait a reasonable time for the transmitter to come ready */
- timo = 50000;
- while (((stat = apci->ap_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
- apci->ap_data = c;
- /* wait for this transmission to complete */
- timo = 1000000;
- while (((stat = apci->ap_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/autoconf.c b/sys/arch/hp300/stand/common/autoconf.c
deleted file mode 100644
index c8c1e17389c..00000000000
--- a/sys/arch/hp300/stand/common/autoconf.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/* $OpenBSD: autoconf.c,v 1.10 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: autoconf.c,v 1.12 1997/01/30 10:32:51 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: autoconf.c 1.16 92/05/29
- *
- * @(#)autoconf.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "consdefs.h"
-#include "rominfo.h"
-#include "device.h"
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/diofbreg.h>
-
-void configure(void);
-void find_devs(void);
-u_long msustobdev(void);
-void printrominfo(void);
-
-/*
- * Mapping of ROM MSUS types to BSD major device numbers
- * WARNING: major numbers must match bdevsw indices in hp300/conf.c.
- */
-char rom2mdev[] = {
- 0, 0, /* 0-1: none */
- 6, /* 2: network device; special */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 3-13: none */
- 4, /* 14: SCSI disk */
- 0, /* 15: none */
- 2, /* 16: CS/80 device on HPIB */
- 2, /* 17: CS/80 device on HPIB */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 18-31: none */
-};
-
-struct hp_hw sc_table[MAXCTLRS];
-int cpuspeed;
-
-extern int internalhpib;
-
-void find_devs(void);
-
-#ifdef PRINTROMINFO
-void
-printrominfo()
-{
- struct rominfo *rp = (struct rominfo *)ROMADDR;
-
- printf("boottype %lx, name %s, lowram %lx, sysflag %x\n",
- rp->boottype, rp->name, rp->lowram, rp->sysflag&0xff);
- printf("rambase %lx, ndrives %x, sysflag2 %x, msus %lx\n",
- rp->rambase, rp->ndrives, rp->sysflag2&0xff, rp->msus);
-}
-#endif
-
-void
-configure()
-{
- switch (machineid) {
- case HP_320:
- case HP_330:
- case HP_340:
- cpuspeed = MHZ_16;
- break;
- case HP_350:
- case HP_36X:
- cpuspeed = MHZ_25;
- break;
- case HP_370:
- cpuspeed = MHZ_33;
- break;
- case HP_380:
- case HP_382:
- case HP_425:
- cpuspeed = MHZ_25 * 2; /* XXX */
- break;
- case HP_385:
- case HP_433:
- cpuspeed = MHZ_33 * 2; /* XXX */
- break;
- case HP_345:
- case HP_375:
- case HP_400:
- default: /* assume the fastest (largest delay value) */
- cpuspeed = MHZ_50;
- break;
- }
- find_devs();
- cninit();
-#ifdef PRINTROMINFO
- printrominfo();
-#endif
- hpibinit();
- scsiinit();
- if ((bootdev & B_MAGICMASK) != B_DEVMAGIC)
- bootdev = msustobdev();
-}
-
-/*
- * Convert HP MSUS to a valid bootdev layout:
- * TYPE comes from MSUS device type as mapped by rom2mdev
- * PARTITION is set to 0 ('a')
- * UNIT comes from MSUS unit (almost always 0)
- * CONTROLLER comes from MSUS primary address
- * ADAPTER comes from SCSI/HPIB driver logical unit number (hw_ctrl)
- */
-u_long
-msustobdev()
-{
- struct rominfo *rp = (struct rominfo *)ROMADDR;
- u_long bdev = 0;
- struct hp_hw *hw;
- int sc, type, ctlr, slave, punit;
-
- sc = (rp->msus >> 8) & 0xFF;
- for (hw = sc_table; hw < &sc_table[MAXCTLRS]; hw++)
- if (hw->hw_sc == sc)
- break;
-
- type = rom2mdev[(rp->msus >> 24) & 0x1F];
- ctlr = hw->hw_ctrl;
- slave = (rp->msus & 0xFF);
- punit = ((rp->msus >> 16) & 0xFF);
-
- bdev = MAKEBOOTDEV(type, ctlr, slave, punit, 0);
-
-#ifdef PRINTROMINFO
- printf("msus %lx -> bdev %lx\n", rp->msus, bdev);
-#endif
- return (bdev);
-}
-
-u_long
-sctoaddr(int sc)
-{
- if (sc == -1)
- return (GRFIADDR);
- if (sc == 7 && internalhpib)
- return (internalhpib);
- if (DIO_ISDIO(sc))
- return (DIO_BASE + sc * DIO_DEVSIZE);
- if (DIO_ISDIOII(sc))
- return (DIOII_BASE + (sc - DIOII_SCBASE) * DIOII_DEVSIZE);
- return 0;
-}
-
-/*
- * Probe all DIO select codes (0 - 32), the internal display address,
- * and DIO-II select codes (132 - 256). SGC frame buffers are probed
- * separately.
- *
- * Note that we only care about displays, LANCEs, SCSIs and HP-IBs.
- */
-void
-find_devs()
-{
- short sc, sctop;
- u_char *id_reg;
- caddr_t addr;
- struct hp_hw *hw;
-
- hw = sc_table;
- sctop = machineid == HP_320 ? 32 : 256; /* DIO_SCMAX(machineid); */
- /* starting at -1 to probe the intio framebuffer, if any */
- for (sc = -1; sc < sctop; sc++) {
- if (sc >= 32 && sc < DIOII_SCBASE)
- continue;
- addr = (caddr_t)sctoaddr(sc);
- if (badaddr(addr))
- continue;
-
- id_reg = (u_char *)addr;
- hw->hw_kva = addr;
- hw->hw_type = 0;
- hw->hw_sc = sc;
- hw->hw_ctrl = 0;
-
- /*
- * Not all internal HP-IBs respond rationally to id requests
- * so we just go by the "internal HPIB" indicator in SYSFLAG.
- */
- if (sc == 7 && internalhpib) {
- hw->hw_type = C_HPIB;
- hw++;
- continue;
- }
-
- switch (id_reg[DIO_IDOFF]) {
- case DIO_DEVICE_ID_DCM:
- case DIO_DEVICE_ID_DCMREM:
- hw->hw_type = D_COMMDCM;
- break;
- case DIO_DEVICE_ID_FHPIB:
- case DIO_DEVICE_ID_NHPIB:
- hw->hw_type = C_HPIB;
- break;
- case DIO_DEVICE_ID_LAN:
- case DIO_DEVICE_ID_LANREM: /* does this even make sense? */
- hw->hw_type = D_LAN;
- break;
- case DIO_DEVICE_ID_FRAMEBUFFER:
- hw->hw_type = D_BITMAP;
- switch(id_reg[DIO_SECIDOFF]) {
- case DIO_DEVICE_SECID_RENAISSANCE:
- case DIO_DEVICE_SECID_DAVINCI:
- sc += 2 - 1; /* occupy 2 select codes */
- break;
- case DIO_DEVICE_SECID_TIGERSHARK:
- sc += 3 - 1; /* occupy 3 select codes */
- break;
- case DIO_DEVICE_SECID_FB3X2_A:
- case DIO_DEVICE_SECID_FB3X2_B:
- sc += 4 - 1; /* occupy 4 select codes */
- break;
- }
- break;
- case DIO_DEVICE_ID_SCSI0:
- case DIO_DEVICE_ID_SCSI1:
- case DIO_DEVICE_ID_SCSI2:
- case DIO_DEVICE_ID_SCSI3:
- hw->hw_type = C_SCSI;
- break;
- default: /* who cares */
- break;
- }
- if (hw->hw_type == 0)
- continue;
- hw++;
- if (hw == sc_table + MAXCTLRS)
- break; /* oflows are so boring */
- }
-}
diff --git a/sys/arch/hp300/stand/common/cons.c b/sys/arch/hp300/stand/common/cons.c
deleted file mode 100644
index 9ee2fd5ba35..00000000000
--- a/sys/arch/hp300/stand/common/cons.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* $OpenBSD: cons.c,v 1.5 2008/01/23 16:37:56 jsing Exp $ */
-/* $NetBSD: cons.c,v 1.2 1997/05/12 07:44:53 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: cons.c 1.7 92/02/28
- *
- * @(#)cons.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "consdefs.h"
-
-struct consdev constab[] = {
-#ifdef ITECONSOLE
- { iteprobe, iteinit, itegetchar, iteputchar },
-#endif
-#ifdef DCACONSOLE
- { dcaprobe, dcainit, dcagetchar, dcaputchar },
-#endif
-#ifdef APCICONSOLE
- { apciprobe, apciinit, apcigetchar, apciputchar },
-#endif
-#ifdef DCMCONSOLE
- { dcmprobe, dcminit, dcmgetchar, dcmputchar },
-#endif
- { 0 },
-};
-
-struct consdev *cn_tab;
-int noconsole;
-
-void
-cninit()
-{
- struct consdev *cp;
-
- cn_tab = NULL;
- noconsole = 1;
- for (cp = constab; cp->cn_probe; cp++) {
- (*cp->cn_probe)(cp);
- if (cp->cn_pri != CN_DEAD &&
- (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri))
- cn_tab = cp;
- }
- if (cn_tab) {
- (*cn_tab->cn_init)(cn_tab);
- noconsole = 0;
- }
-}
-
-int
-cngetc()
-{
-
- /* Note: the dev_t arguments are not used! */
- if (cn_tab)
- return((*cn_tab->cn_getc)(0));
- return(0);
-}
-
-void
-cnputc(c)
- int c;
-{
- /* Note: the dev_t arguments are not used! */
- if (userom)
- romputchar(c);
- else if (cn_tab)
- (*cn_tab->cn_putc)(0, c);
-}
diff --git a/sys/arch/hp300/stand/common/ct.c b/sys/arch/hp300/stand/common/ct.c
deleted file mode 100644
index 8db58fee3b7..00000000000
--- a/sys/arch/hp300/stand/common/ct.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/* $OpenBSD: ct.c,v 1.6 2011/03/13 00:13:52 deraadt Exp $ */
-/* $NetBSD: ct.c,v 1.9 1996/10/14 07:29:57 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ct.c 8.1 (Berkeley) 7/15/93
- */
-
-/*
- * CS80 tape driver
- */
-#include <sys/param.h>
-
-#include <hp300/dev/ctreg.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "hpibvar.h"
-
-struct ct_iocmd ct_ioc;
-struct ct_rscmd ct_rsc;
-struct ct_stat ct_stat;
-struct ct_ssmcmd ct_ssmc;
-
-struct ct_softc {
- int sc_ctlr;
- int sc_unit;
- char sc_retry;
- char sc_alive;
- short sc_punit;
- int sc_blkno;
-} ct_softc[NHPIB][NCT];
-
-#define CTRETRY 5
-#define MTFSF 10
-#define MTREW 11
-
-int ctclose(struct open_file *);
-int cterror(int, int);
-int ctident(int, int);
-int ctinit(int, int);
-int ctopen(struct open_file *, int, int, int);
-int ctpunit(int, int, int *);
-int ctstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-
-char ctio_buf[MAXBSIZE];
-
-struct ctinfo {
- short hwid;
- short punit;
-} ctinfo[] = {
- { CT7946ID, 1 },
- { CT7912PID, 1 },
- { CT7914PID, 1 },
- { CT9144ID, 0 },
- { CT9145ID, 0 }
-};
-int nctinfo = sizeof(ctinfo) / sizeof(ctinfo[0]);
-
-int
-ctinit(int ctlr, int unit)
-{
- struct ct_softc *rs = &ct_softc[ctlr][unit];
- u_char stat;
-
- if (hpibrecv(ctlr, unit, C_QSTAT, &stat, 1) != 1 || stat)
- return (0);
- if (ctident(ctlr, unit) < 0)
- return (0);
- bzero(&ct_ssmc, sizeof(ct_ssmc));
- ct_ssmc.unit = C_SUNIT(rs->sc_punit);
- ct_ssmc.cmd = C_SSM;
- ct_ssmc.fefm = FEF_MASK;
- ct_ssmc.refm = REF_MASK;
- ct_ssmc.aefm = AEF_MASK;
- ct_ssmc.iefm = IEF_MASK;
- hpibsend(ctlr, unit, C_CMD, &ct_ssmc, sizeof(ct_ssmc));
- hpibswait(ctlr, unit);
- hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
- rs->sc_alive = 1;
- return (1);
-}
-
-int
-ctident(int ctlr, int unit)
-{
- struct cs80_describe desc;
- u_char stat, cmd[3];
- char name[7];
- int id, i;
-
- id = hpibid(ctlr, unit);
- if ((id & 0x200) == 0)
- return(-1);
- for (i = 0; i < nctinfo; i++)
- if (id == ctinfo[i].hwid)
- break;
- if (i == nctinfo)
- return(-1);
- ct_softc[ctlr][unit].sc_punit = ctinfo[i].punit;
- id = i;
-
- /*
- * Collect device description.
- * Right now we only need this to differentiate 7945 from 7946.
- * Note that we always issue the describe command to unit 0.
- */
- cmd[0] = C_SUNIT(0);
- cmd[1] = C_SVOL(0);
- cmd[2] = C_DESC;
- hpibsend(ctlr, unit, C_CMD, cmd, sizeof(cmd));
- hpibrecv(ctlr, unit, C_EXEC, &desc, sizeof(desc));
- hpibrecv(ctlr, unit, C_QSTAT, &stat, sizeof(stat));
- bzero(name, sizeof(name));
- if (!stat) {
- int n = desc.d_name;
- for (i = 5; i >= 0; i--) {
- name[i] = (n & 0xf) + '0';
- n >>= 4;
- }
- }
- switch (ctinfo[id].hwid) {
- case CT7946ID:
- if (bcmp(name, "079450", 6) == 0)
- id = -1; /* not really a 7946 */
- break;
- default:
- break;
- }
- return(id);
-}
-
-int
-ctpunit(int ctlr, int slave, int *punit)
-{
- struct ct_softc *rs;
-
- if (ctlr >= NHPIB || hpibalive(ctlr) == 0)
- return(EADAPT);
- if (slave >= NCT)
- return(ECTLR);
- rs = &ct_softc[ctlr][slave];
-
- if (rs->sc_alive == 0)
- return(ENXIO);
-
- *punit = rs->sc_punit;
- return (0);
-}
-
-int
-ctopen(struct open_file *f, int ctlr, int unit, int part)
-{
- struct ct_softc *rs;
- int skip;
- size_t resid;
-
- if (ctlr >= NHPIB || hpibalive(ctlr) == 0)
- return(EADAPT);
- if (unit >= NCT)
- return(ECTLR);
- rs = &ct_softc[ctlr][unit];
- rs->sc_blkno = 0;
- rs->sc_unit = unit;
- rs->sc_ctlr = ctlr;
- if (rs->sc_alive == 0)
- if (ctinit(ctlr, unit) == 0)
- return(ENXIO);
- f->f_devdata = (void *)rs;
- ctstrategy(f->f_devdata, MTREW, 0, 0, ctio_buf, &resid);
- skip = part;
- while (skip--)
- ctstrategy(f->f_devdata, MTFSF, 0, 0, ctio_buf, &resid);
- return(0);
-}
-
-int
-ctclose(struct open_file *f)
-{
- size_t resid;
-
- ctstrategy(f->f_devdata, MTREW, 0, 0, ctio_buf, &resid);
- return (0);
-}
-
-int
-ctstrategy(void *devdata, int func, daddr32_t dblk, size_t size, void *v_buf,
- size_t *rsize)
-{
- struct ct_softc *rs = devdata;
- char *buf = v_buf;
- int ctlr = rs->sc_ctlr;
- int unit = rs->sc_unit;
- char stat;
-
- if (size == 0 && (func == F_READ || func == F_WRITE))
- return(0);
-
- rs->sc_retry = 0;
- bzero(&ct_ioc, sizeof(ct_ioc));
- ct_ioc.unit = C_SUNIT(rs->sc_punit);
- ct_ioc.saddr = C_SADDR;
- ct_ioc.nop2 = C_NOP;
- ct_ioc.slen = C_SLEN;
- ct_ioc.nop3 = C_NOP;
-top:
- if (func == F_READ) {
- ct_ioc.cmd = C_READ;
- ct_ioc.addr = rs->sc_blkno;
- ct_ioc.len = size;
- }
- else if (func == F_WRITE) {
- ct_ioc.cmd = C_WRITE;
- ct_ioc.addr = rs->sc_blkno;
- ct_ioc.len = size;
- }
- else if (func == MTFSF) {
- ct_ioc.cmd = C_READ;
- ct_ioc.addr = rs->sc_blkno;
- ct_ioc.len = size = MAXBSIZE;
- }
- else {
- ct_ioc.cmd = C_READ;
- ct_ioc.addr = 0;
- ct_ioc.len = 0;
- rs->sc_blkno = 0;
- size = 0;
- }
-retry:
- hpibsend(ctlr, unit, C_CMD, &ct_ioc, sizeof(ct_ioc));
- if (func != MTREW) {
- hpibswait(ctlr, unit);
- hpibgo(ctlr, unit, C_EXEC, buf, size,
- func != F_WRITE ? F_READ : F_WRITE);
- hpibswait(ctlr, unit);
- } else {
- while (hpibswait(ctlr, unit) < 0)
- ;
- }
- hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
- if (stat) {
- stat = cterror(ctlr, unit);
- if (stat == 0)
- return (-1);
- if (stat == 2)
- return (0);
- if (++rs->sc_retry > CTRETRY)
- return (-1);
- goto retry;
- }
- rs->sc_blkno += CTBTOK(size);
- if (func == MTFSF)
- goto top;
- *rsize = size;
-
- return(0);
-}
-
-int
-cterror(int ctlr, int unit)
-{
- struct ct_softc *rs = &ct_softc[ctlr][unit];
- char stat;
-
- bzero(&ct_rsc, sizeof(ct_rsc));
- bzero(&ct_stat, sizeof(ct_stat));
- ct_rsc.unit = C_SUNIT(rs->sc_punit);
- ct_rsc.cmd = C_STATUS;
- hpibsend(ctlr, unit, C_CMD, &ct_rsc, sizeof(ct_rsc));
- hpibrecv(ctlr, unit, C_EXEC, &ct_stat, sizeof(ct_stat));
- hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
- if (stat) {
- printf("ct%d: request status fail %d\n", unit, stat);
- return(0);
- }
- if (ct_stat.c_aef & AEF_EOF) {
- /* 9145 drives don't increment block number at EOF */
- if ((ct_stat.c_blk - rs->sc_blkno) == 0)
- rs->sc_blkno++;
- else
- rs->sc_blkno = ct_stat.c_blk;
- return (2);
- }
- printf("ct%d err: vu 0x%x, pend 0x%x, bn%ld", unit,
- ct_stat.c_vu, ct_stat.c_pend, ct_stat.c_blk);
- printf(", R 0x%x F 0x%x A 0x%x I 0x%x\n", ct_stat.c_ref,
- ct_stat.c_fef, ct_stat.c_aef, ct_stat.c_ief);
- return (1);
-}
diff --git a/sys/arch/hp300/stand/common/dca.c b/sys/arch/hp300/stand/common/dca.c
deleted file mode 100644
index b639b411725..00000000000
--- a/sys/arch/hp300/stand/common/dca.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $OpenBSD: dca.c,v 1.8 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: dca.c,v 1.10 1996/10/06 01:42:48 mycroft Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dca.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef DCACONSOLE
-#include <sys/param.h>
-
-#include <hp300/dev/dcareg.h>
-
-#include "samachdep.h"
-#include "consdefs.h"
-
-struct dcadevice *dcacnaddr = NULL;
-
-#define DCACONSCODE 9 /* XXX */
-
-void
-dcaprobe(struct consdev *cp)
-{
- struct dcadevice *dca;
-
- dcacnaddr = (struct dcadevice *)sctoaddr(DCACONSCODE);
- if (badaddr((char *)dcacnaddr))
- return;
-
- dca = dcacnaddr;
- switch (dca->dca_id) {
- case DCAID0:
- case DCAID1:
- cp->cn_pri = CN_LOWPRI;
- break;
- case DCAID0 | DCACON:
- case DCAID1 | DCACON:
- cp->cn_pri = CN_HIGHPRI;
- break;
- default:
- break;
- }
-}
-
-void
-dcainit(struct consdev *cp)
-{
- struct dcadevice *dca = dcacnaddr;
-
- dca->dca_reset = 0xFF;
- DELAY(100);
- dca->dca_ic = 0;
- dca->dca_cfcr = CFCR_DLAB;
- dca->dca_data = DCABRD(9600) & 0xFF;
- dca->dca_ier = DCABRD(9600) >> 8;
- dca->dca_cfcr = CFCR_8BITS;
- dca->dca_fifo =
- FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1;
- dca->dca_mcr = MCR_DTR | MCR_RTS;
-}
-
-/* ARGSUSED */
-int
-dcagetchar(dev_t dev)
-{
-#ifndef SMALL
- struct dcadevice *dca = dcacnaddr;
- short stat;
- int c;
-
- if (((stat = dca->dca_lsr) & LSR_RXRDY) == 0)
- return(0);
- c = dca->dca_data;
- return(c);
-#else
- return(0);
-#endif
-}
-
-/* ARGSUSED */
-void
-dcaputchar(dev_t dev, int c)
-{
- struct dcadevice *dca = dcacnaddr;
- int timo;
- short stat;
-
- /* wait a reasonable time for the transmitter to come ready */
- timo = 50000;
- while (((stat = dca->dca_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
- dca->dca_data = c;
- /* wait for this transmission to complete */
- timo = 1000000;
- while (((stat = dca->dca_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/dcm.c b/sys/arch/hp300/stand/common/dcm.c
deleted file mode 100644
index 157c938c845..00000000000
--- a/sys/arch/hp300/stand/common/dcm.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* $OpenBSD: dcm.c,v 1.6 2008/01/23 16:37:56 jsing Exp $ */
-/* $NetBSD: dcm.c,v 1.2 1997/04/14 05:58:32 scottr Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dcm.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef DCMCONSOLE
-#include <sys/param.h>
-
-#include <hp300/dev/dcmreg.h>
-
-#include "samachdep.h"
-#include "consdefs.h"
-#include "device.h"
-
-struct dcmdevice *dcmcnaddr = NULL;
-
-#define DCMCONUNIT 1 /* XXX */
-
-void
-dcmprobe(struct consdev *cp)
-{
- extern struct hp_hw sc_table[];
- struct hp_hw *hw;
- struct dcmdevice *dcm;
-
- for (hw = sc_table; hw < &sc_table[MAXCTLRS]; hw++)
- if (HW_ISDEV(hw, D_COMMDCM) && !badaddr((caddr_t)hw->hw_kva))
- break;
- if (!HW_ISDEV(hw, D_COMMDCM))
- return;
- dcmcnaddr = (struct dcmdevice *) hw->hw_kva;
-
- dcm = dcmcnaddr;
- switch (dcm->dcm_rsid) {
- case DCMID:
- cp->cn_pri = CN_LOWPRI;
- break;
- case DCMID|DCMCON:
- cp->cn_pri = CN_HIGHPRI;
- break;
- default:
- break;
- }
-}
-
-void
-dcminit(struct consdev *cp)
-{
- struct dcmdevice *dcm = dcmcnaddr;
- int port = DCMCONUNIT;
-
- dcm->dcm_ic = IC_ID;
- while (dcm->dcm_thead[port].ptr != dcm->dcm_ttail[port].ptr)
- ;
- dcm->dcm_data[port].dcm_baud = BR_9600;
- dcm->dcm_data[port].dcm_conf = LC_8BITS | LC_1STOP;
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_CON;
- dcm->dcm_cr |= (1 << port);
- SEM_UNLOCK(dcm);
- DELAY(15000);
-}
-
-/* ARGSUSED */
-int
-dcmgetchar(dev_t dev)
-{
-#ifndef SMALL
- struct dcmdevice *dcm = dcmcnaddr;
- struct dcmrfifo *fifo;
- struct dcmpreg *pp;
- unsigned head;
- int c, stat, port;
-
- port = DCMCONUNIT;
- pp = dcm_preg(dcm, port);
- head = pp->r_head & RX_MASK;
- if (head == (pp->r_tail & RX_MASK))
- return(0);
- fifo = &dcm->dcm_rfifos[3-port][head>>1];
- c = fifo->data_char;
- stat = fifo->data_stat;
- pp->r_head = (head + 2) & RX_MASK;
- SEM_LOCK(dcm);
- stat = dcm->dcm_iir;
- SEM_UNLOCK(dcm);
- return(c);
-#else
- return(0);
-#endif
-}
-
-/* ARGSUSED */
-void
-dcmputchar(dev_t dev, int c)
-{
- struct dcmdevice *dcm = dcmcnaddr;
- struct dcmpreg *pp;
- int timo;
- unsigned tail;
- int port, stat;
-
- port = DCMCONUNIT;
- pp = dcm_preg(dcm, port);
- tail = pp->t_tail & TX_MASK;
- timo = 50000;
- while (tail != (pp->t_head & TX_MASK) && --timo)
- ;
- dcm->dcm_tfifos[3-port][tail].data_char = c;
- pp->t_tail = tail = (tail + 1) & TX_MASK;
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_TX;
- dcm->dcm_cr |= (1 << port);
- SEM_UNLOCK(dcm);
- timo = 1000000;
- while (tail != (pp->t_head & TX_MASK) && --timo)
- ;
- SEM_LOCK(dcm);
- stat = dcm->dcm_iir;
- SEM_UNLOCK(dcm);
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/dnkbd.c b/sys/arch/hp300/stand/common/dnkbd.c
deleted file mode 100644
index 9bfac1b34db..00000000000
--- a/sys/arch/hp300/stand/common/dnkbd.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/* $OpenBSD: dnkbd.c,v 1.5 2011/08/18 19:54:19 miod Exp $ */
-/* $NetBSD: dnkbd.c,v 1.3 1997/05/12 07:47:03 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Michael Smith and 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 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.
- */
-
-/*
- * Apollo Domain keyboard routines for the standalone ITE.
- */
-
-#if defined(ITECONSOLE) && defined(DOMAIN_KEYBOARD)
-
-#include <sys/param.h>
-
-#include <hp300/dev/frodoreg.h> /* for apci offsets */
-#include <hp300/dev/dcareg.h> /* for the register bit definitions */
-#include <hp300/dev/apcireg.h> /* for the apci registers */
-
-#include "samachdep.h"
-#include "kbdvar.h"
-
-#ifndef SMALL
-
-/*
- * The Apollo keyboard is used in `cooked' mode as configured by the
- * firmware; only one table is required.
- *
- * Note that if an entry in this table is set to 0, the key is passed
- * through untranslated. If the entry is 0xff, the key is ignored.
- */
-u_char dnkbd_keymap[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 07 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 17 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 27 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 2f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 37 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 3f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 47 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 4f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 57 */
- 0x00, 0x00, 0x00, '{', 0x00, '}', 0x00, 0x00, /* 5f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 67 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 6f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 77 */
- 0x00, 0x00, 0x00, '[', 0x00, ']', 0x00, 0x00, /* 7f */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 87 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 8f */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 97 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 9f */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* a7 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* af */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* b7 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bf */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* c7 */
- '\\', '|', 0x09, 0x0a, '/', 0xff, 0xff, 0xff, /* cf */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* d7 */
- 0xff, 0xff, 0xff, 0xff, '?', 0xff, 0x08, 0xff, /* df */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* e7 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* ef */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* f7 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* ff */
-};
-
-int dnkbd_ignore; /* for ignoring mouse packets */
-
-int
-dnkbd_getc()
-{
- struct apciregs *apci =
- (struct apciregs *)IIOV(FRODO_BASE + FRODO_APCI_OFFSET(0));
- int c;
-
- /* default to `no key' */
- c = 0;
-
- /* Is data in the UART? */
- if (apci->ap_lsr & LSR_RXRDY) {
- /* Get the character. */
- c = apci->ap_data;
-
- /* Ignoring mouse? */
- if (dnkbd_ignore) {
- dnkbd_ignore--;
- return (0);
- }
-
- /* Is this the start of a mouse packet? */
- if (c == 0xdf) {
- dnkbd_ignore = 3; /* 3 bytes of junk */
- return (0);
- }
-
- /* It's a keyboard event. */
- switch (dnkbd_keymap[c]) {
- case 0x00:
- /* passthrough */
- break;
-
- case 0xff:
- /* ignore */
- c = 0;
- break;
-
- default:
- c = dnkbd_keymap[c];
- break;
- }
- }
-
- return (c);
-}
-#endif /* SMALL */
-
-void
-dnkbd_nmi()
-{
-
- /*
- * XXX Should we do anything? Can we even generate one?
- */
-}
-
-int
-dnkbd_init()
-{
-
- /*
- * 400, 425, and 433 models can have a Domain keyboard.
- */
- switch (machineid) {
- case HP_400:
- case HP_425:
- case HP_433:
- break;
- default:
- return (0);
- }
-
- /*
- * Look for a Frodo utility chip. If we find one, assume there
- * is a Domain keyboard attached.
- */
- if (badaddr((caddr_t)IIOV(FRODO_BASE + FRODO_APCI_OFFSET(0))))
- return (0);
-
- /*
- * XXX Any other initialization? This appears to work ok.
- */
- return (1);
-}
-#endif /* ITECONSOLE && DOMAIN_KEYBOARD */
diff --git a/sys/arch/hp300/stand/common/fhpib.c b/sys/arch/hp300/stand/common/fhpib.c
deleted file mode 100644
index 53aee75511c..00000000000
--- a/sys/arch/hp300/stand/common/fhpib.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* $OpenBSD: fhpib.c,v 1.4 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: fhpib.c,v 1.5 1995/08/05 16:47:42 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fhpib.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * 98625A/B HPIB driver
- */
-
-#include <sys/param.h>
-
-#include <hp300/dev/fhpibreg.h>
-
-#include "samachdep.h"
-#include "hpibvar.h"
-
-int fhpibinit(int);
-void fhpibreset(int);
-int fhpibwait(struct fhpibdevice *, int);
-
-int
-fhpibinit(int unit)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct fhpibdevice *hd = (struct fhpibdevice *)hs->sc_addr;
-
- if (hd->hpib_cid != HPIBC)
- return(0);
- hs->sc_type = HPIBC;
- hs->sc_ba = HPIBC_BA;
- fhpibreset(unit);
- return(1);
-}
-
-void
-fhpibreset(int unit)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct fhpibdevice *hd;
-
- hd = (struct fhpibdevice *)hs->sc_addr;
- hd->hpib_cid = 0xFF;
- DELAY(100);
- hd->hpib_cmd = CT_8BIT;
- hd->hpib_ar = AR_ARONC;
- hd->hpib_cmd |= CT_IFC;
- hd->hpib_cmd |= CT_INITFIFO;
- DELAY(100);
- hd->hpib_cmd &= ~CT_IFC;
- hd->hpib_cmd |= CT_REN;
- hd->hpib_stat = ST_ATN;
- hd->hpib_data = C_DCL;
- DELAY(100000);
-}
-
-int
-fhpibsend(int unit, int slave, int sec, char *buf, int cnt)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct fhpibdevice *hd;
- int origcnt = cnt;
-
- hd = (struct fhpibdevice *)hs->sc_addr;
- hd->hpib_stat = 0;
- hd->hpib_imask = IM_IDLE | IM_ROOM;
- fhpibwait(hd, IM_IDLE);
- hd->hpib_stat = ST_ATN;
- hd->hpib_data = C_UNL;
- hd->hpib_data = C_TAG + hs->sc_ba;
- hd->hpib_data = C_LAG + slave;
- if (sec != -1)
- hd->hpib_data = C_SCG + sec;
- fhpibwait(hd, IM_IDLE);
- hd->hpib_stat = ST_WRITE;
- if (cnt) {
- while (--cnt) {
- hd->hpib_data = *buf++;
- if (fhpibwait(hd, IM_ROOM) < 0)
- break;
- }
- hd->hpib_stat = ST_EOI;
- hd->hpib_data = *buf;
- if (fhpibwait(hd, IM_ROOM) < 0)
- cnt++;
- hd->hpib_stat = ST_ATN;
- /* XXX: HP-UX claims bug with CS80 transparent messages */
- if (sec == 0x12)
- DELAY(150);
- hd->hpib_data = C_UNL;
- fhpibwait(hd, IM_IDLE);
- }
- hd->hpib_imask = 0;
- return(origcnt - cnt);
-}
-
-int
-fhpibrecv(int unit, int slave, int sec, char *buf, int cnt)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct fhpibdevice *hd;
- int origcnt = cnt;
-
- hd = (struct fhpibdevice *)hs->sc_addr;
- hd->hpib_stat = 0;
- hd->hpib_imask = IM_IDLE | IM_ROOM | IM_BYTE;
- fhpibwait(hd, IM_IDLE);
- hd->hpib_stat = ST_ATN;
- hd->hpib_data = C_UNL;
- hd->hpib_data = C_LAG + hs->sc_ba;
- hd->hpib_data = C_TAG + slave;
- if (sec != -1)
- hd->hpib_data = C_SCG + sec;
- fhpibwait(hd, IM_IDLE);
- hd->hpib_stat = ST_READ0;
- hd->hpib_data = 0;
- if (cnt) {
- while (--cnt >= 0) {
- if (fhpibwait(hd, IM_BYTE) < 0)
- break;
- *buf++ = hd->hpib_data;
- }
- cnt++;
- fhpibwait(hd, IM_ROOM);
- hd->hpib_stat = ST_ATN;
- hd->hpib_data = (slave == 31) ? C_UNA : C_UNT;
- fhpibwait(hd, IM_IDLE);
- }
- hd->hpib_imask = 0;
- return(origcnt - cnt);
-}
-
-int
-fhpibppoll(int unit)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct fhpibdevice *hd;
- int ppoll;
-
- hd = (struct fhpibdevice *)hs->sc_addr;
- hd->hpib_stat = 0;
- hd->hpib_psense = 0;
- hd->hpib_pmask = 0xFF;
- hd->hpib_imask = IM_PPRESP | IM_PABORT;
- DELAY(25);
- hd->hpib_intr = IM_PABORT;
- ppoll = hd->hpib_data;
- if (hd->hpib_intr & IM_PABORT)
- ppoll = 0;
- hd->hpib_imask = 0;
- hd->hpib_pmask = 0;
- hd->hpib_stat = ST_IENAB;
- return(ppoll);
-}
-
-int
-fhpibwait(struct fhpibdevice *hd, int x)
-{
- int timo = 100000;
-
- while ((hd->hpib_intr & x) == 0 && --timo)
- ;
- if (timo == 0)
- return(-1);
- return(0);
-}
diff --git a/sys/arch/hp300/stand/common/hd.c b/sys/arch/hp300/stand/common/hd.c
deleted file mode 100644
index 730857f789d..00000000000
--- a/sys/arch/hp300/stand/common/hd.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/* $OpenBSD: hd.c,v 1.9 2013/04/01 12:55:27 miod Exp $ */
-/* $NetBSD: rd.c,v 1.11 1996/12/21 21:34:40 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: rd.c 1.20 92/12/21
- *
- * @(#)rd.c 8.1 (Berkeley) 7/15/93
- */
-
-/*
- * CS80/SS80 disk driver
- */
-#include <sys/param.h>
-#include <sys/disklabel.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-#define DEV_BSHIFT _DEV_BSHIFT
-#include <hp300/dev/hdreg.h>
-#include "hpibvar.h"
-
-struct hd_iocmd hd_ioc;
-struct hd_rscmd hd_rsc;
-struct hd_stat hd_stat;
-struct hd_ssmcmd hd_ssmc;
-
-struct disklabel hdlabel;
-
-struct hdminilabel {
- u_short npart;
- u_long offset[MAXPARTITIONS];
-};
-
-struct hd_softc {
- int sc_ctlr;
- int sc_unit;
- int sc_part;
- char sc_retry;
- char sc_alive;
- short sc_type;
- struct hdminilabel sc_pinfo;
-} hd_softc[NHPIB][NHD];
-
-#define HDRETRY 5
-
-struct hdidentinfo {
- short ri_hwid;
- short ri_maxunum;
- int ri_nblocks;
-} hdidentinfo[] = {
- { HD7946AID, 0, 108416 },
- { HD9134DID, 1, 29088 },
- { HD9134LID, 1, 1232 },
- { HD7912PID, 0, 128128 },
- { HD7914PID, 0, 258048 },
- { HD7958AID, 0, 255276 },
- { HD7957AID, 0, 159544 },
- { HD7933HID, 0, 789958 },
- { HD9134LID, 1, 77840 },
- { HD7936HID, 0, 600978 },
- { HD7937HID, 0, 1116102 },
- { HD7914CTID, 0, 258048 },
- { HD7946AID, 0, 108416 },
- { HD9134LID, 1, 1232 },
- { HD7957BID, 0, 159894 },
- { HD7958BID, 0, 297108 },
- { HD7959BID, 0, 594216 },
- { HD2200AID, 0, 654948 },
- { HD2203AID, 0, 1309896 }
-};
-int numhdidentinfo = sizeof(hdidentinfo) / sizeof(hdidentinfo[0]);
-
-int hdclose(struct open_file *);
-int hderror(int, int, int);
-int hdgetinfo(struct hd_softc *);
-int hdident(int, int);
-int hdinit(int, int);
-int hdopen(struct open_file *, int, int, int);
-void hdreset(int, int);
-int hdstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-
-int
-hdinit(int ctlr, int unit)
-{
- struct hd_softc *rs = &hd_softc[ctlr][unit];
-
- rs->sc_type = hdident(ctlr, unit);
- if (rs->sc_type < 0)
- return (0);
- rs->sc_alive = 1;
- return (1);
-}
-
-void
-hdreset(int ctlr, int unit)
-{
- u_char stat;
-
- hd_ssmc.c_unit = C_SUNIT(0);
- hd_ssmc.c_cmd = C_SSM;
- hd_ssmc.c_refm = REF_MASK;
- hd_ssmc.c_fefm = FEF_MASK;
- hd_ssmc.c_aefm = AEF_MASK;
- hd_ssmc.c_iefm = IEF_MASK;
- hpibsend(ctlr, unit, C_CMD, &hd_ssmc, sizeof(hd_ssmc));
- hpibswait(ctlr, unit);
- hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
-}
-
-int
-hdident(int ctlr, int unit)
-{
- struct cs80_describe desc;
- u_char stat, cmd[3];
- char name[7];
- int id, i;
-
- id = hpibid(ctlr, unit);
- if ((id & 0x200) == 0)
- return(-1);
- for (i = 0; i < numhdidentinfo; i++)
- if (id == hdidentinfo[i].ri_hwid)
- break;
- if (i == numhdidentinfo)
- return(-1);
- id = i;
- hdreset(ctlr, unit);
- cmd[0] = C_SUNIT(0);
- cmd[1] = C_SVOL(0);
- cmd[2] = C_DESC;
- hpibsend(ctlr, unit, C_CMD, cmd, sizeof(cmd));
- hpibrecv(ctlr, unit, C_EXEC, &desc, sizeof(desc));
- hpibrecv(ctlr, unit, C_QSTAT, &stat, sizeof(stat));
- bzero(name, sizeof(name));
- if (!stat) {
- int n = desc.d_name;
- for (i = 5; i >= 0; i--) {
- name[i] = (n & 0xf) + '0';
- n >>= 4;
- }
- }
- /*
- * Take care of a couple of anomalies:
- * 1. 7945A and 7946A both return same HW id
- * 2. 9122S and 9134D both return same HW id
- * 3. 9122D and 9134L both return same HW id
- */
- switch (hdidentinfo[id].ri_hwid) {
- case HD7946AID:
- if (bcmp(name, "079450", 6) == 0)
- id = HD7945A;
- else
- id = HD7946A;
- break;
-
- case HD9134LID:
- if (bcmp(name, "091340", 6) == 0)
- id = HD9134L;
- else
- id = HD9122D;
- break;
-
- case HD9134DID:
- if (bcmp(name, "091220", 6) == 0)
- id = HD9122S;
- else
- id = HD9134D;
- break;
- }
- return(id);
-}
-
-char hdio_buf[MAXBSIZE];
-
-int
-hdgetinfo(struct hd_softc *rs)
-{
- struct hdminilabel *pi = &rs->sc_pinfo;
- struct disklabel *lp = &hdlabel;
- char *msg;
- int err, savepart;
- size_t i;
-
- bzero((caddr_t)lp, sizeof *lp);
- lp->d_secsize = DEV_BSIZE;
-
- /* Disklabel is always from RAW_PART. */
- savepart = rs->sc_part;
- rs->sc_part = RAW_PART;
- err = hdstrategy(rs, F_READ, LABELSECTOR,
- lp->d_secsize ? lp->d_secsize : DEV_BSIZE, hdio_buf, &i);
- rs->sc_part = savepart;
-
- if (err) {
- printf("hdgetinfo: hdstrategy error %d\n", err);
- return(0);
- }
-
- msg = getdisklabel(hdio_buf, lp);
- if (msg) {
- printf("hd(%d,%d,%d): WARNING: %s, ",
- rs->sc_ctlr, rs->sc_unit, rs->sc_part, msg);
- printf("defining `c' partition as entire disk\n");
- pi->npart = 3;
- pi->offset[0] = pi->offset[1] = -1;
- pi->offset[2] = 0;
- } else {
- pi->npart = lp->d_npartitions;
- for (i = 0; i < pi->npart; i++)
- pi->offset[i] = lp->d_partitions[i].p_size == 0 ?
- -1 : lp->d_partitions[i].p_offset;
- }
- return(1);
-}
-
-int
-hdopen(struct open_file *f, int ctlr, int unit, int part)
-{
- struct hd_softc *rs;
-
- if (ctlr >= NHPIB || hpibalive(ctlr) == 0)
- return (EADAPT);
- if (unit >= NHD)
- return (ECTLR);
- rs = &hd_softc[ctlr][unit];
- rs->sc_part = part;
- rs->sc_unit = unit;
- rs->sc_ctlr = ctlr;
- if (rs->sc_alive == 0) {
- if (hdinit(ctlr, unit) == 0)
- return (ENXIO);
- if (hdgetinfo(rs) == 0)
- return (ERDLAB);
- }
- if (part != RAW_PART && /* always allow RAW_PART to be opened */
- (part >= rs->sc_pinfo.npart || rs->sc_pinfo.offset[part] == -1))
- return (EPART);
- f->f_devdata = (void *)rs;
- return (0);
-}
-
-int
-hdclose(struct open_file *f)
-{
- struct hd_softc *rs = f->f_devdata;
-
- /*
- * Mark the disk `not alive' so that the disklabel
- * will be re-loaded at next open.
- */
- bzero(rs, sizeof(struct hd_softc));
- f->f_devdata = NULL;
- return (0);
-}
-
-int
-hdstrategy(void *devdata, int func, daddr32_t dblk, size_t size, void *v_buf,
- size_t *rsize)
-{
- char *buf = v_buf;
- struct hd_softc *rs = devdata;
- int ctlr = rs->sc_ctlr;
- int unit = rs->sc_unit;
- daddr32_t blk;
- char stat;
-
- if (size == 0)
- return(0);
-
- /*
- * Don't do partition translation on the `raw partition'.
- */
- blk = (dblk + ((rs->sc_part == RAW_PART) ? 0 :
- rs->sc_pinfo.offset[rs->sc_part]));
-
- rs->sc_retry = 0;
- hd_ioc.c_unit = C_SUNIT(0);
- hd_ioc.c_volume = C_SVOL(0);
- hd_ioc.c_saddr = C_SADDR;
- hd_ioc.c_hiaddr = 0;
- hd_ioc.c_addr = HDBTOS(blk);
- hd_ioc.c_nop2 = C_NOP;
- hd_ioc.c_slen = C_SLEN;
- hd_ioc.c_len = size;
- hd_ioc.c_cmd = func == F_READ ? C_READ : C_WRITE;
-retry:
- hpibsend(ctlr, unit, C_CMD, &hd_ioc.c_unit, sizeof(hd_ioc)-2);
- hpibswait(ctlr, unit);
- hpibgo(ctlr, unit, C_EXEC, buf, size, func);
- hpibswait(ctlr, unit);
- hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
- if (stat) {
- if (hderror(ctlr, unit, rs->sc_part) == 0)
- return(EIO);
- if (++rs->sc_retry > HDRETRY)
- return(EIO);
- goto retry;
- }
- *rsize = size;
-
- return(0);
-}
-
-int
-hderror(int ctlr, int unit, int part)
-{
- char stat;
-
- hd_rsc.c_unit = C_SUNIT(0);
- hd_rsc.c_sram = C_SRAM;
- hd_rsc.c_ram = C_RAM;
- hd_rsc.c_cmd = C_STATUS;
- hpibsend(ctlr, unit, C_CMD, &hd_rsc, sizeof(hd_rsc));
- hpibrecv(ctlr, unit, C_EXEC, &hd_stat, sizeof(hd_stat));
- hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
- if (stat) {
- printf("hd(%d,%d,0,%d): request status fail %d\n",
- ctlr, unit, part, stat);
- return(0);
- }
- printf("hd(%d,%d,0,%d) err: vu 0x%x",
- ctlr, unit, part, hd_stat.c_vu);
- if ((hd_stat.c_aef & AEF_UD) || (hd_stat.c_ief & (IEF_MD|IEF_RD)))
- printf(", block %ld", hd_stat.c_blk);
- printf(", R0x%x F0x%x A0x%x I0x%x\n",
- hd_stat.c_ref, hd_stat.c_fef, hd_stat.c_aef, hd_stat.c_ief);
- return(1);
-}
diff --git a/sys/arch/hp300/stand/common/hil.c b/sys/arch/hp300/stand/common/hil.c
deleted file mode 100644
index 37c9fad103b..00000000000
--- a/sys/arch/hp300/stand/common/hil.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* $OpenBSD: hil.c,v 1.7 2011/08/18 19:37:26 miod Exp $ */
-/* $NetBSD: hil.c,v 1.2 1997/04/14 19:00:10 thorpej Exp $ */
-
-/*
- * Copyright (c) 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: hil.c 1.1 89/08/22
- *
- * @(#)hil.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * HIL keyboard routines for the standalone ITE.
- */
-
-#if defined(ITECONSOLE) && defined(HIL_KEYBOARD)
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "hilreg.h"
-#include "itevar.h"
-#include "kbdvar.h"
-
-#ifndef SMALL
-
-#define ESC '\033'
-#define DEL '\177'
-
-/*
- * HIL cooked keyboard keymaps.
- * Supports only unshifted, shifted and control keys.
- */
-char hilkbd_keymap[] = {
- 0, '`', '\\', ESC, 0, DEL, 0, 0,
- '\n', '\t', 0, 0, 0, 0, 0, 0,
- 0, '\n', 0, 0, 0, 0, 0, 0,
- 0, '\t', 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, '\b', 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- ESC, '\r', 0, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', 'E', '(', ')', '^',
- '1', '2', '3', '4', '5', '6', '7', '8',
- '9', '0', '-', '=', '[', ']', ';', '\'',
- ',', '.', '/', '\040', 'o', 'p', 'k', 'l',
- 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
- 'a', 's', 'd', 'f', 'g', 'h', 'j', 'm',
- 'z', 'x', 'c', 'v', 'b', 'n', 0, 0
-};
-
-char hilkbd_shiftmap[] = {
- 0, '~', '|', DEL, 0, DEL, 0, 0,
- '\n', '\t', 0, 0, 0, 0, 0, 0,
- 0, '\n', 0, 0, 0, 0, 0, 0,
- 0, '\t', 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, DEL, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- ESC, '\r', 0, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', '`', '|', '\\', '~',
- '!', '@', '#', '$', '%', '^', '&', '*',
- '(', ')', '_', '+', '{', '}', ':', '\"',
- '<', '>', '?', '\040', 'O', 'P', 'K', 'L',
- 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
- 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'M',
- 'Z', 'X', 'C', 'V', 'B', 'N', 0, 0
-};
-
-char hilkbd_ctrlmap[] = {
- 0, '`', '\034', ESC, 0, DEL, 0, 0,
- '\n', '\t', 0, 0, 0, 0, 0, 0,
- 0, '\n', 0, 0, 0, 0, 0, 0,
- 0, '\t', 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, '\b', 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- ESC, '\r', 0, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', 'E', '(', ')', '\036',
- '1', '2', '3', '4', '5', '6', '7', '8',
- '9', '0', '-', '=', '\033', '\035', ';', '\'',
- ',', '.', '/', '\040', '\017', '\020', '\013', '\014',
- '\021', '\027', '\005', '\022', '\024', '\031', '\025', '\011',
- '\001', '\023', '\004', '\006', '\007', '\010', '\012', '\015',
- '\032', '\030', '\003', '\026', '\002', '\016', 0, 0
-};
-
-int
-hilkbd_getc()
-{
- int status, c;
- struct hil_dev *hiladdr = HILADDR;
-
- status = hiladdr->hil_stat;
- if ((status & HIL_DATA_RDY) == 0)
- return(0);
- c = hiladdr->hil_data;
- switch ((status >> HIL_SSHIFT) & HIL_SMASK) {
- case KBD_SHIFT:
- c = hilkbd_shiftmap[c & KBD_CHARMASK];
- break;
- case KBD_CTRL:
- c = hilkbd_ctrlmap[c & KBD_CHARMASK];
- break;
- case KBD_KEY:
- c = hilkbd_keymap[c & KBD_CHARMASK];
- break;
- default:
- c = 0;
- break;
- }
- return(c);
-}
-#endif /* SMALL */
-
-void
-hilkbd_nmi()
-{
- struct hil_dev *hiladdr = HILADDR;
-
- HILWAIT(hiladdr);
- hiladdr->hil_cmd = HIL_CNMT;
- HILWAIT(hiladdr);
- hiladdr->hil_cmd = HIL_CNMT;
- HILWAIT(hiladdr);
- printf("\nboot interrupted\n");
-}
-
-int
-hilkbd_init()
-{
- struct hil_dev *hiladdr = HILADDR;
-
- /*
- * Determine the existence of a HIL keyboard.
- */
- HILWAIT(hiladdr);
- hiladdr->hil_cmd = HIL_READKBDSADR;
- HILDATAWAIT(hiladdr);
- if (hiladdr->hil_data == 0)
- return (0);
-
- HILWAIT(hiladdr);
- hiladdr->hil_cmd = HIL_SETARR;
- HILWAIT(hiladdr);
- hiladdr->hil_data = ar_format(KBD_ARR);
- HILWAIT(hiladdr);
- hiladdr->hil_cmd = HIL_INTON;
-
- return (1);
-}
-#endif /* ITECONSOLE && HIL_KEYBOARD */
diff --git a/sys/arch/hp300/stand/common/hpib.c b/sys/arch/hp300/stand/common/hpib.c
deleted file mode 100644
index 7064ebd16fb..00000000000
--- a/sys/arch/hp300/stand/common/hpib.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* $OpenBSD: hpib.c,v 1.5 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: hpib.c,v 1.2 1997/05/12 07:48:23 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)hpib.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * HPIB driver
- */
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "device.h"
-#include "hpibvar.h"
-
-#include <hp300/dev/dioreg.h>
-
-int internalhpib = IIOV(DIO_IHPIBADDR);
-
-struct hpib_softc hpib_softc[NHPIB];
-
-void
-hpibinit()
-{
- extern struct hp_hw sc_table[];
- struct hp_hw *hw;
- struct hpib_softc *hs;
- int i;
-
- i = 0;
- for (hw = sc_table; i < NHPIB && hw < &sc_table[MAXCTLRS]; hw++) {
- if (!HW_ISHPIB(hw))
- continue;
- hs = &hpib_softc[i];
- hs->sc_addr = hw->hw_kva;
- if (nhpibinit(i) == 0)
- if (fhpibinit(i) == 0)
- continue;
- if (howto & RB_ASKNAME)
- printf("hpib%d at sc%d\n", i, hw->hw_sc);
- hw->hw_ctrl = i;
- hs->sc_alive = 1;
- i++;
- }
-}
-
-int
-hpibalive(int unit)
-{
- if (unit >= NHPIB || hpib_softc[unit].sc_alive == 0)
- return (0);
- return (1);
-}
-
-int
-hpibid(int unit, int slave)
-{
- short id;
- int rv;
-
- if (hpib_softc[unit].sc_type == HPIBC)
- rv = fhpibrecv(unit, 31, slave, (char *)&id, 2);
- else
- rv = nhpibrecv(unit, 31, slave, (char *)&id, 2);
- if (rv != 2)
- return (0);
- return (id);
-}
-
-int
-hpibsend(int unit, int slave, int sec, void *buf, int cnt)
-{
- if (hpib_softc[unit].sc_type == HPIBC)
- return (fhpibsend(unit, slave, sec, (char *)buf, cnt));
- else
- return (nhpibsend(unit, slave, sec, (char *)buf, cnt));
-}
-
-int
-hpibrecv(int unit, int slave, int sec, void *buf, int cnt)
-{
- if (hpib_softc[unit].sc_type == HPIBC)
- return (fhpibrecv(unit, slave, sec, (char *)buf, cnt));
- else
- return (nhpibrecv(unit, slave, sec, (char *)buf, cnt));
-}
-
-int
-hpibswait(int unit, int slave)
-{
- int timo = 1000000;
- int (*poll)(int);
-
- slave = 0x80 >> slave;
- if (hpib_softc[unit].sc_type == HPIBC)
- poll = fhpibppoll;
- else
- poll = nhpibppoll;
- while (((*poll)(unit) & slave) == 0)
- if (--timo == 0)
- break;
- if (timo == 0)
- return (-1);
- return (0);
-}
-
-void
-hpibgo(int unit, int slave, int sec, void *addr, int count, int flag)
-{
- if (hpib_softc[unit].sc_type == HPIBC) {
- if (flag == F_READ)
- fhpibrecv(unit, slave, sec, (char *)addr, count);
- else
- fhpibsend(unit, slave, sec, (char *)addr, count);
- } else {
- if (flag == F_READ)
- nhpibrecv(unit, slave, sec, (char *)addr, count);
- else
- nhpibsend(unit, slave, sec, (char *)addr, count);
- }
-}
diff --git a/sys/arch/hp300/stand/common/if_le.c b/sys/arch/hp300/stand/common/if_le.c
deleted file mode 100644
index 97bbd4a1dd0..00000000000
--- a/sys/arch/hp300/stand/common/if_le.c
+++ /dev/null
@@ -1,601 +0,0 @@
-/* $OpenBSD: if_le.c,v 1.8 2011/08/18 20:02:58 miod Exp $ */;
-/* $NetBSD: if_le.c,v 1.9 1997/01/30 10:32:54 thorpej Exp $ */
-
-/*
- * Copyright (c) 1993 Adam Glass
- * 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 Adam Glass.
- * 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 Adam Glass ``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/types.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-
-#include <lib/libsa/stand.h>
-#include <lib/libsa/netif.h>
-
-#include "samachdep.h"
-#include "device.h"
-#include "if_lereg.h"
-
-#ifndef NLE
-#define NLE 1
-#endif
-
-#ifdef LE_DEBUG
-int le_debug = 0;
-#endif
-
-#define ETHER_MIN_LEN 64
-#define ETHER_MAX_LEN 1518
-#define ETHER_ADDR_LEN 6
-
-int le_probe(struct netif *, void *);
-int le_match(struct netif *, void *);
-void le_init(struct iodesc *, void *);
-int le_get(struct iodesc *, void *, size_t, time_t);
-int le_put(struct iodesc *, void *, size_t);
-void le_end(struct netif *);
-
-struct le_sel {
- int le_id;
- int le_regs;
- int le_mem;
- int le_nvram;
- int le_heat;
- int le_bonus;
-} le0conf[] = {
-/* offsets for: ID REGS MEM NVRAM le_heat le_bonus*/
-{ 0, 0x4000, 0x8000, 0xC008, 1, 10 }
-};
-
-extern struct netif_stats le_stats[];
-
-struct netif_dif le_ifs[] = {
-/* dif_unit dif_nsel dif_stats dif_private */
-{ 0, nitems(le0conf),&le_stats[0], le0conf, },
-};
-
-struct netif_stats le_stats[nitems(le_ifs)];
-
-struct netif_driver le_driver = {
- "le", /* netif_bname */
- le_match, /* netif_match */
- le_probe, /* netif_probe */
- le_init, /* netif_init */
- le_get, /* netif_get */
- le_put, /* netif_put */
- le_end, /* netif_end */
- le_ifs, /* netif_ifs */
- nitems(le_ifs) /* netif_nifs */
-};
-
-struct le_softc {
- struct lereg0 *sc_r0; /* DIO registers */
- struct lereg1 *sc_r1; /* LANCE registers */
- void *sc_mem;
- struct init_block *sc_init;
- struct mds *sc_rd, *sc_td;
- u_char *sc_rbuf, *sc_tbuf;
- int sc_next_rd, sc_next_td;
- u_char sc_addr[ETHER_ADDR_LEN];
-} le_softc[NLE];
-
-static inline void
-lewrcsr(struct le_softc *sc, u_short port, u_short val)
-{
- struct lereg0 *ler0 = sc->sc_r0;
- struct lereg1 *ler1 = sc->sc_r1;
-
- do {
- ler1->ler1_rap = port;
- } while ((ler0->ler0_status & LE_ACK) == 0);
- do {
- ler1->ler1_rdp = val;
- } while ((ler0->ler0_status & LE_ACK) == 0);
-}
-
-static inline u_short
-lerdcsr(struct le_softc *sc, u_short port)
-{
- struct lereg0 *ler0 = sc->sc_r0;
- struct lereg1 *ler1 = sc->sc_r1;
- u_short val;
-
- do {
- ler1->ler1_rap = port;
- } while ((ler0->ler0_status & LE_ACK) == 0);
- do {
- val = ler1->ler1_rdp;
- } while ((ler0->ler0_status & LE_ACK) == 0);
- return (val);
-}
-
-void leinit(void);
-void lememinit(struct le_softc *);
-void le_error(int, char *, u_short);
-int le_poll(struct iodesc *, void *, int);
-void le_reset(int, u_char *);
-
-void
-leinit()
-{
- extern struct hp_hw sc_table[];
- struct hp_hw *hw;
- struct le_softc *sc;
- struct le_sel *sels;
- int i, n;
- char *cp;
-
- i = 0;
-
- for (hw = sc_table; i < NLE && hw < &sc_table[MAXCTLRS]; hw++) {
-#ifdef LE_DEBUG
- if (le_debug)
- printf("found type %x\n", hw->hw_type);
-#endif
-
-#if 0
- if (!HW_ISDEV(hw, D_LAN))
- continue;
-#endif
-
- sels = (struct le_sel *)le_ifs[i].dif_private;
-
- sc = &le_softc[i];
- sc->sc_r0 = (struct lereg0 *)(sels->le_id + (int)hw->hw_kva);
-
- if (sc->sc_r0->ler0_id != LEID)
- continue;
-
- sc->sc_r1 = (struct lereg1 *)(sels->le_regs + (int)hw->hw_kva);
- sc->sc_mem = (struct lereg2 *)(sels->le_mem + (int)hw->hw_kva);
-
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d: DIO=%x regs=%x mem=%x\n",
- i, sc->sc_r0, sc->sc_r1, sc->sc_mem);
-#endif
-
- /*
- * Read the ethernet address off the board, one nibble at a time.
- */
- cp = (char *)(sels->le_nvram + (int)hw->hw_kva);
- for (n = 0; n < sizeof(sc->sc_addr); n++) {
- sc->sc_addr[n] = (*++cp & 0xF) << 4;
- cp++;
- sc->sc_addr[n] |= *++cp & 0xF;
- cp++;
- }
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d at sc%d physical address %s\n",
- i, hw->hw_sc, ether_sprintf(sc->sc_addr));
-#endif
- hw->hw_ctrl = i;
- i++;
- }
-}
-
-int
-le_match(struct netif *nif, void *machdep_hint)
-{
- struct le_sel *sels;
- char *name = machdep_hint;
- int rv = 0;
-
- if (nif->nif_sel < le_ifs[nif->nif_unit].dif_nsel) {
- sels = (struct le_sel *)le_ifs[nif->nif_unit].dif_private;
- rv = sels[nif->nif_sel].le_heat;
- if (name && !strncmp(le_driver.netif_bname, name, 2))
- rv += sels[nif->nif_sel].le_bonus;
- }
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d: sel %d --> %d\n", nif->nif_unit, nif->nif_sel,
- rv);
-#endif
- return rv;
-}
-
-int
-le_probe(struct netif *nif, void *machdep_hint)
-{
-
- /* the set unit is the current unit */
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d.%d: le_probe called\n", nif->nif_unit, nif->nif_sel);
-#endif
- /* XXX reset controller */
- return 0;
-}
-
-void
-le_error(int unit, char *str, u_short stat)
-{
-
- if (stat & LE_BABL)
- panic("le%d: been babbling, found by '%s'", unit, str);
- if (stat & LE_CERR)
- le_stats[unit].collision_error++;
- if (stat & LE_MISS)
- le_stats[unit].missed++;
- if (stat & LE_MERR) {
- panic("le%d: memory error in '%s'", unit, str);
- }
-}
-
-#define LANCE_ADDR(sc, a) \
- ((u_long)(a) - (u_long)sc->sc_mem)
-
-/* LANCE initialization block set up. */
-void
-lememinit(struct le_softc *sc)
-{
- int i;
- void *mem;
- u_long a;
-
- /*
- * At this point we assume that the memory allocated to the Lance is
- * quadword aligned. If it isn't then the initialisation is going
- * fail later on.
- */
- mem = sc->sc_mem;
-
- sc->sc_init = mem;
- sc->sc_init->mode = LE_NORMAL;
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- sc->sc_init->padr[i] = sc->sc_addr[i^1];
- sc->sc_init->ladrf[0] = sc->sc_init->ladrf[1] = 0;
- mem += sizeof(struct init_block);
-
- sc->sc_rd = mem;
- a = LANCE_ADDR(sc, mem);
- sc->sc_init->rdra = a;
- sc->sc_init->rlen = ((a >> 16) & 0xff) | (RLEN << 13);
- mem += NRBUF * sizeof(struct mds);
-
- sc->sc_td = mem;
- a = LANCE_ADDR(sc, mem);
- sc->sc_init->tdra = a;
- sc->sc_init->tlen = ((a >> 16) & 0xff) | (TLEN << 13);
- mem += NTBUF * sizeof(struct mds);
-
- /*
- * Set up receive ring descriptors.
- */
- sc->sc_rbuf = mem;
- for (i = 0; i < NRBUF; i++) {
- a = LANCE_ADDR(sc, mem);
- sc->sc_rd[i].addr = a;
- sc->sc_rd[i].flags = ((a >> 16) & 0xff) | LE_OWN;
- sc->sc_rd[i].bcnt = -BUFSIZE;
- sc->sc_rd[i].mcnt = 0;
- mem += BUFSIZE;
- }
-
- /*
- * Set up transmit ring descriptors.
- */
- sc->sc_tbuf = mem;
- for (i = 0; i < NTBUF; i++) {
- a = LANCE_ADDR(sc, mem);
- sc->sc_td[i].addr = a;
- sc->sc_td[i].flags = ((a >> 16) & 0xff);
- sc->sc_td[i].bcnt = 0xf000;
- sc->sc_td[i].mcnt = 0;
- mem += BUFSIZE;
- }
-}
-
-void
-le_reset(int unit, u_char *myea)
-{
- struct le_softc *sc = &le_softc[unit];
- u_long a;
- int timo = 100000;
-
-#ifdef LE_DEBUG
- if (le_debug) {
- printf("le%d: le_reset called\n", unit);
- printf(" r0=%x, r1=%x, mem=%x, addr=%x:%x:%x:%x:%x:%x\n",
- sc->sc_r0, sc->sc_r1, sc->sc_mem,
- sc->sc_addr[0], sc->sc_addr[1], sc->sc_addr[2],
- sc->sc_addr[3], sc->sc_addr[4], sc->sc_addr[5]);
- }
-#endif
- lewrcsr(sc, 0, LE_STOP);
- for (timo = 1000; timo; timo--);
-
- sc->sc_next_rd = sc->sc_next_td = 0;
-
- /* Set up LANCE init block. */
- lememinit(sc);
-
- if (myea)
- bcopy(sc->sc_addr, myea, ETHER_ADDR_LEN);
-
- /* Turn on byte swapping. */
- lewrcsr(sc, 3, LE_BSWP);
-
- /* Give LANCE the physical address of its init block. */
- a = LANCE_ADDR(sc, sc->sc_init);
- lewrcsr(sc, 1, a);
- lewrcsr(sc, 2, (a >> 16) & 0xff);
-
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d: before init\n", unit);
-#endif
-
- /* Try to initialize the LANCE. */
- lewrcsr(sc, 0, LE_INIT);
-
- /* Wait for initialization to finish. */
- for (timo = 100000; timo; timo--)
- if (lerdcsr(sc, 0) & LE_IDON)
- break;
-
- if (lerdcsr(sc, 0) & LE_IDON) {
- /* Start the LANCE. */
- lewrcsr(sc, 0, LE_INEA | LE_STRT | LE_IDON);
- } else
- printf("le%d: card failed to initialize\n", unit);
-
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d: after init\n", unit);
-#endif
-}
-
-int
-le_poll(struct iodesc *desc, void *pkt, int len)
-{
-#if 0
- struct netif *nif = desc->io_netif;
- int unit = nif->nif_unit;
-#else
- int unit = 0;
-#endif
- struct le_softc *sc = &le_softc[unit];
- int length;
- volatile struct mds *cdm;
- int stat;
-
-#ifdef LE_DEBUG
- if (/*le_debug*/0)
- printf("le%d: le_poll called. next_rd=%d\n", unit, sc->sc_next_rd);
-#endif
- stat = lerdcsr(sc, 0);
- lewrcsr(sc, 0, stat & (LE_BABL | LE_MISS | LE_MERR | LE_RINT));
- cdm = &sc->sc_rd[sc->sc_next_rd];
- if (cdm->flags & LE_OWN)
- return 0;
-#ifdef LE_DEBUG
- if (le_debug) {
- printf("next_rd %d\n", sc->sc_next_rd);
- printf("cdm->flags %x\n", cdm->flags);
- printf("cdm->bcnt %x, cdm->mcnt %x\n", cdm->bcnt, cdm->mcnt);
- printf("cdm->rbuf msg %d buf %d\n", cdm->mcnt, -cdm->bcnt );
- }
-#endif
- if (stat & (LE_BABL | LE_CERR | LE_MISS | LE_MERR))
- le_error(unit, "le_poll", stat);
- if (cdm->flags & (LE_FRAM | LE_OFLO | LE_CRC | LE_RBUFF)) {
- printf("le%d_poll: rmd status 0x%x\n", unit, cdm->flags);
- length = 0;
- goto cleanup;
- }
- if ((cdm->flags & (LE_STP|LE_ENP)) != (LE_STP|LE_ENP))
- panic("le_poll: chained packet");
-
- length = cdm->mcnt;
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le_poll: length %d\n", length);
-#endif
- if (length >= BUFSIZE) {
- length = 0;
- panic("csr0 when bad things happen: %x", stat);
- goto cleanup;
- }
- if (!length)
- goto cleanup;
- length -= 4;
-
- if (length > 0) {
- /*
- * If the length of the packet is greater than the size of the
- * buffer, we have to truncate it, to avoid Bad Things.
- * XXX Is this the right thing to do?
- */
- if (length > len)
- length = len;
-
- bcopy(sc->sc_rbuf + (BUFSIZE * sc->sc_next_rd), pkt, length);
- }
-
-cleanup:
- cdm->mcnt = 0;
- cdm->flags |= LE_OWN;
- if (++sc->sc_next_rd >= NRBUF)
- sc->sc_next_rd = 0;
-#ifdef LE_DEBUG
- if (le_debug)
- printf("new next_rd %d\n", sc->sc_next_rd);
-#endif
-
- return length;
-}
-
-int
-le_put(struct iodesc *desc, void *pkt, size_t len)
-{
-#if 0
- struct netif *nif = desc->io_netif;
- int unit = nif->nif_unit;
-#else
- int unit = 0;
-#endif
- struct le_softc *sc = &le_softc[unit];
- volatile struct mds *cdm;
- int timo, i, stat;
-
- le_put_loop:
- timo = 100000;
-
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d: le_put called. next_td=%d\n", unit, sc->sc_next_td);
-#endif
- stat = lerdcsr(sc, 0);
- lewrcsr(sc, 0, stat & (LE_BABL | LE_MISS | LE_MERR | LE_TINT));
- if (stat & (LE_BABL | LE_CERR | LE_MISS | LE_MERR))
- le_error(unit, "le_put(way before xmit)", stat);
- cdm = &sc->sc_td[sc->sc_next_td];
- i = 0;
-#if 0
- while (cdm->flags & LE_OWN) {
- if ((i % 100) == 0)
- printf("le%d: output buffer busy - flags=%x\n",
- unit, cdm->flags);
- if (i++ > 500) break;
- }
- if (cdm->flags & LE_OWN)
- getchar();
-#else
- while (cdm->flags & LE_OWN);
-#endif
- bcopy(pkt, sc->sc_tbuf + (BUFSIZE * sc->sc_next_td), len);
- if (len < ETHER_MIN_LEN)
- cdm->bcnt = -ETHER_MIN_LEN;
- else
- cdm->bcnt = -len;
- cdm->mcnt = 0;
- cdm->flags |= LE_OWN | LE_STP | LE_ENP;
- stat = lerdcsr(sc, 0);
- if (stat & (LE_BABL | LE_CERR | LE_MISS | LE_MERR))
- le_error(unit, "le_put(before xmit)", stat);
- lewrcsr(sc, 0, LE_TDMD);
- stat = lerdcsr(sc, 0);
- if (stat & (LE_BABL | LE_CERR | LE_MISS | LE_MERR))
- le_error(unit, "le_put(after xmit)", stat);
- do {
- if (--timo == 0) {
- printf("le%d: transmit timeout, stat = 0x%x\n",
- unit, stat);
- if (stat & LE_SERR)
- le_error(unit, "le_put(timeout)", stat);
- if (stat & LE_INIT) {
- printf("le%d: reset and retry packet\n", unit);
- lewrcsr(sc, 0, LE_TINT); /* sanity */
- le_init(desc, NULL);
- goto le_put_loop;
- }
- break;
- }
- stat = lerdcsr(sc, 0);
- } while ((stat & LE_TINT) == 0);
- lewrcsr(sc, 0, LE_TINT);
- if (stat & (LE_BABL |/* LE_CERR |*/ LE_MISS | LE_MERR)) {
- printf("le_put: xmit error, buf %d\n", sc->sc_next_td);
- le_error(unit, "le_put(xmit error)", stat);
- }
- if (++sc->sc_next_td >= NTBUF)
- sc->sc_next_td = 0;
- if (cdm->flags & LE_DEF)
- le_stats[unit].deferred++;
- if (cdm->flags & LE_ONE)
- le_stats[unit].collisions++;
- if (cdm->flags & LE_MORE)
- le_stats[unit].collisions+=2;
- if (cdm->flags & LE_ERR) {
- printf("le%d: transmit error, error = 0x%x\n", unit,
- cdm->mcnt);
- return -1;
- }
-#ifdef LE_DEBUG
- if (le_debug) {
- printf("le%d: le_put() successful: sent %d\n", unit, len);
- printf("le%d: le_put(): flags: %x mcnt: %x\n", unit,
- (unsigned int) cdm->flags,
- (unsigned int) cdm->mcnt);
- }
-#endif
- return len;
-}
-
-
-int
-le_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout)
-{
- time_t t;
- int cc;
-
- t = getsecs();
- cc = 0;
- while (((getsecs() - t) < timeout) && !cc) {
- cc = le_poll(desc, pkt, len);
- }
- return cc;
-}
-
-void
-le_init(struct iodesc *desc, void *machdep_hint)
-{
- struct netif *nif = desc->io_netif;
- int unit = nif->nif_unit;
-
- /* Get machine's common ethernet interface. This is done in leinit() */
- /* machdep_common_ether(myea); */
- leinit();
-
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d: le_init called\n", unit);
-#endif
- unit = 0;
- le_reset(unit, desc->myea);
-}
-
-void
-le_end(struct netif *nif)
-{
- int unit = nif->nif_unit;
-
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d: le_end called\n", unit);
-#endif
-
- lewrcsr(&le_softc[unit], 0, LE_STOP);
-}
diff --git a/sys/arch/hp300/stand/common/ite.c b/sys/arch/hp300/stand/common/ite.c
deleted file mode 100644
index 0b8032a3ce0..00000000000
--- a/sys/arch/hp300/stand/common/ite.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/* $OpenBSD: ite.c,v 1.11 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: ite.c,v 1.12 1997/01/30 10:32:55 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite.c 1.24 93/06/25$
- *
- * @(#)ite.c 8.1 (Berkeley) 7/8/93
- */
-
-/*
- * Standalone Internal Terminal Emulator (CRT and keyboard)
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/sgcreg.h>
-#include <hp300/dev/diofbreg.h>
-#include <dev/ic/stireg.h>
-
-#include "samachdep.h"
-#include "consdefs.h"
-#include "device.h"
-#include "itevar.h"
-#include "kbdvar.h"
-
-void itecheckwrap(struct ite_data *, struct itesw *);
-void iteconfig(void);
-void ite_clrtoeol(struct ite_data *, struct itesw *, int, int);
-
-#define GID_STI 0x100 /* any value which is not a DIO fb, really */
-
-struct itesw itesw[] = {
- { GID_TOPCAT,
- NULL, topcat_init,
- ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_GATORBOX,
- NULL, gbox_init,
- ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, gbox_scroll },
-
- { GID_RENAISSANCE,
- NULL, rbox_init,
- ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_LRCATSEYE,
- NULL, topcat_init,
- ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_HRCCATSEYE,
- NULL, topcat_init,
- ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_HRMCATSEYE,
- NULL, topcat_init,
- ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_DAVINCI,
- NULL, dvbox_init,
- ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_HYPERION,
- NULL, hyper_init,
- ite_dio_clear, ite_dio_putc1bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_TIGER,
- NULL, tvrx_init,
- ite_dio_clear, ite_dio_putc1bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_FB3X2_A,
- sti_dio_probe, sti_iteinit_dio,
- sti_clear, sti_putc, sti_cursor, sti_scroll },
-
- { GID_FB3X2_B,
- sti_dio_probe, sti_iteinit_dio,
- sti_clear, sti_putc, sti_cursor, sti_scroll },
-
- { GID_STI,
- NULL, sti_iteinit_sgc,
- sti_clear, sti_putc, sti_cursor, sti_scroll }
-};
-
-/* these guys need to be in initialized data */
-int itecons = -1;
-struct ite_data ite_data[NITE] = { { 0 } };
-
-/*
- * Locate all bitmapped displays
- */
-void
-iteconfig()
-{
- extern struct hp_hw sc_table[];
- int dtype, fboff, slotno, i;
- u_int8_t *va;
- struct hp_hw *hw;
- struct diofbreg *fb;
- struct ite_data *ip;
-
- i = 0;
- for (hw = sc_table; hw < &sc_table[MAXCTLRS]; hw++) {
- if (!HW_ISDEV(hw, D_BITMAP))
- continue;
- fb = (struct diofbreg *)hw->hw_kva;
- /* XXX: redundent but safe */
- if (badaddr((caddr_t)fb) || fb->id != GRFHWID)
- continue;
- for (dtype = 0; dtype < nitems(itesw); dtype++)
- if (itesw[dtype].ite_hwid == fb->fbid)
- break;
- if (dtype == nitems(itesw))
- continue;
- if (i >= NITE)
- break;
- ip = &ite_data[i];
- ip->scode = hw->hw_sc;
- ip->isw = &itesw[dtype];
- ip->regbase = (caddr_t)fb;
- fboff = (fb->fbomsb << 8) | fb->fbolsb;
- ip->fbbase = (caddr_t) (*((u_char *)ip->regbase+fboff) << 16);
- /* DIO II: FB offset is relative to select code space */
- if (DIO_ISDIOII(ip->scode))
- ip->fbbase += (int)ip->regbase;
- ip->fbwidth = fb->fbwmsb << 8 | fb->fbwlsb;
- ip->fbheight = fb->fbhmsb << 8 | fb->fbhlsb;
- ip->dwidth = fb->dwmsb << 8 | fb->dwlsb;
- ip->dheight = fb->dhmsb << 8 | fb->dhlsb;
- /*
- * XXX some displays (e.g. the davinci) appear
- * to return a display height greater than the
- * returned FB height. Guess we should go back
- * to getting the display dimensions from the
- * fontrom...
- */
- if (ip->dwidth > ip->fbwidth)
- ip->dwidth = ip->fbwidth;
- if (ip->dheight > ip->fbheight)
- ip->dheight = ip->fbheight;
- /* confirm hardware is what we think it is */
- if (itesw[dtype].ite_probe != NULL &&
- (*itesw[dtype].ite_probe)(ip) != 0)
- continue;
- ip->alive = 1;
- i++;
- }
-
- /*
- * Now probe for SGC frame buffers.
- */
- switch (machineid) {
- case HP_400:
- case HP_425:
- case HP_433:
- break;
- default:
- return;
- }
-
- /* SGC frame buffers can only be STI... */
- for (dtype = 0; dtype < nitems(itesw); dtype++)
- if (itesw[dtype].ite_hwid == GID_STI)
- break;
- if (dtype == nitems(itesw))
- return;
-
- for (slotno = 0; slotno < SGC_NSLOTS; slotno++) {
- va = (u_int8_t *)IIOV(SGC_BASE + (slotno * SGC_DEVSIZE));
-
- /* Check to see if hardware exists. */
- if (badaddr(va) != 0)
- continue;
-
- /* Check hardware. */
- if (va[3] == STI_DEVTYPE1) {
- if (i >= NITE)
- break;
- ip = &ite_data[i];
- ip->scode = slotno;
- ip->isw = &itesw[dtype];
- ip->regbase = (caddr_t)GRFIADDR; /* to get CN_MIDPRI */
- /* ...and do not need an ite_probe() check */
- ip->alive = 1;
- i++;
- /* we only support one SGC frame buffer at the moment */
- break;
- }
- }
-}
-
-void
-iteprobe(struct consdev *cp)
-{
- int ite;
- struct ite_data *ip;
- int unit, pri;
-
- iteconfig();
- unit = -1;
- pri = CN_DEAD;
- for (ite = 0; ite < NITE; ite++) {
- ip = &ite_data[ite];
- if (ip->alive == 0)
- continue;
- if ((int)ip->regbase == GRFIADDR) {
- pri = CN_MIDPRI;
- unit = ite;
- } else if (unit < 0) {
- pri = CN_LOWPRI;
- unit = ite;
- }
- }
- cp->cn_dev = unit;
- cp->cn_pri = pri;
-}
-
-void
-iteinit(struct consdev *cp)
-{
- int ite = cp->cn_dev;
- struct ite_data *ip;
-
- ip = &ite_data[ite];
-
- ip->curx = 0;
- ip->cury = 0;
- ip->cursorx = 0;
- ip->cursory = 0;
-
- (*ip->isw->ite_init)(ip);
- (*ip->isw->ite_cursor)(ip, DRAW_CURSOR);
-
- itecons = ite;
- kbdinit();
-}
-
-/* ARGSUSED */
-void
-iteputchar(dev_t dev, int c)
-{
- struct ite_data *ip = &ite_data[itecons];
- struct itesw *sp = ip->isw;
-
- c &= 0x7F;
- switch (c) {
-
- case '\n':
- if (++ip->cury == ip->rows) {
- ip->cury--;
- (*sp->ite_scroll)(ip);
- ite_clrtoeol(ip, sp, ip->cury, 0);
- }
- else
- (*sp->ite_cursor)(ip, MOVE_CURSOR);
- break;
-
- case '\r':
- ip->curx = 0;
- (*sp->ite_cursor)(ip, MOVE_CURSOR);
- break;
-
- case '\b':
- if (--ip->curx < 0)
- ip->curx = 0;
- else
- (*sp->ite_cursor)(ip, MOVE_CURSOR);
- break;
-
- default:
- if (c < ' ' || c == 0177)
- break;
- (*sp->ite_putc)(ip, c, ip->cury, ip->curx);
- (*sp->ite_cursor)(ip, DRAW_CURSOR);
- itecheckwrap(ip, sp);
- break;
- }
-}
-
-void
-itecheckwrap(struct ite_data *ip, struct itesw *sp)
-{
- if (++ip->curx == ip->cols) {
- ip->curx = 0;
- if (++ip->cury == ip->rows) {
- --ip->cury;
- (*sp->ite_scroll)(ip);
- ite_clrtoeol(ip, sp, ip->cury, 0);
- return;
- }
- }
- (*sp->ite_cursor)(ip, MOVE_CURSOR);
-}
-
-void
-ite_clrtoeol(struct ite_data *ip, struct itesw *sp, int y, int x)
-{
- (*sp->ite_clear)(ip, y, x, 1, ip->cols - x);
- (*sp->ite_cursor)(ip, DRAW_CURSOR);
-}
-
-/* ARGSUSED */
-int
-itegetchar(dev_t dev)
-{
-#ifdef SMALL
- return (0);
-#else
- return (kbdgetc());
-#endif
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_dv.c b/sys/arch/hp300/stand/common/ite_dv.c
deleted file mode 100644
index 0dbbfbe5fd3..00000000000
--- a/sys/arch/hp300/stand/common/ite_dv.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/* $OpenBSD: ite_dv.c,v 1.6 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: ite_dv.c,v 1.8 1996/03/03 04:23:35 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_dv.c 1.2 92/01/20$
- *
- * @(#)ite_dv.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "itevar.h"
-#include "grf_dvreg.h"
-
-#define REGBASE ((struct dvboxfb *)(ip->regbase))
-
-void dvbox_windowmove(struct ite_data *, int, int, int, int, int, int, int);
-void dv_reset(struct dvboxfb *);
-
-void
-dvbox_init(struct ite_data *ip)
-{
- int i;
-
- ip->bmv = dvbox_windowmove;
- dv_reset((struct dvboxfb *)ip->regbase);
- DELAY(4000);
-
- /*
- * Turn on frame buffer, turn on overlay planes, set replacement
- * rule, enable top overlay plane writes for ite, disable all frame
- * buffer planes, set byte per pixel, and display frame buffer 0.
- * Lastly, turn on the box.
- */
- REGBASE->interrupt = 0x04;
- REGBASE->drive = 0x10;
- REGBASE->rep_rule = RR_COPY << 4 | RR_COPY;
- REGBASE->opwen = 0x01;
- REGBASE->fbwen = 0x0;
- REGBASE->fold = 0x01;
- REGBASE->vdrive = 0x0;
- REGBASE->dispen = 0x01;
-
- /*
- * Video enable top overlay plane.
- */
- REGBASE->opvenp = 0x01;
- REGBASE->opvens = 0x01;
-
- /*
- * Make sure that overlay planes override frame buffer planes.
- */
- REGBASE->ovly0p = 0x0;
- REGBASE->ovly0s = 0x0;
- REGBASE->ovly1p = 0x0;
- REGBASE->ovly1s = 0x0;
- REGBASE->fv_trig = 0x1;
- DELAY(400);
-
- /*
- * Setup the overlay colormaps. Need to set the 0,1 (black/white)
- * color for both banks.
- */
-
- for (i = 0; i <= 1; i++) {
- REGBASE->cmapbank = i;
- REGBASE->rgb[0].red = 0x00;
- REGBASE->rgb[0].green = 0x00;
- REGBASE->rgb[0].blue = 0x00;
- REGBASE->rgb[1].red = 0xFF;
- REGBASE->rgb[1].green = 0xFF;
- REGBASE->rgb[1].blue = 0xFF;
- }
- REGBASE->cmapbank = 0;
-
- db_waitbusy(ip->regbase);
-
- ite_fontinfo(ip);
- ite_fontinit8bpp(ip);
-
- /*
- * Clear the (visible) framebuffer.
- */
- dvbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
- db_waitbusy(ip->regbase);
-
- /*
- * Stash the inverted cursor.
- */
- dvbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight,
- ip->ftwidth, RR_COPYINVERTED);
- db_waitbusy(ip->regbase);
-}
-
-void
-dvbox_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h,
- int w, int func)
-{
- struct dvboxfb *dp = REGBASE;
- if (h == 0 || w == 0)
- return;
-
- db_waitbusy(ip->regbase);
- dp->rep_rule = func << 4 | func;
- dp->source_y = sy;
- dp->source_x = sx;
- dp->dest_y = dy;
- dp->dest_x = dx;
- dp->wheight = h;
- dp->wwidth = w;
- dp->wmove = 1;
-}
-
-void
-dv_reset(struct dvboxfb *dbp)
-{
- dbp->reset = 0x80;
- DELAY(400);
-
- dbp->interrupt = 0x04;
- dbp->en_scan = 0x01;
- dbp->fbwen = ~0;
- dbp->opwen = ~0;
- dbp->fold = 0x01;
- dbp->drive = 0x01;
- dbp->rep_rule = 0x33;
- dbp->alt_rr = 0x33;
- dbp->zrr = 0x33;
-
- dbp->fbvenp = 0xFF;
- dbp->dispen = 0x01;
- dbp->fbvens = 0x0;
- dbp->fv_trig = 0x01;
- DELAY(400);
- dbp->vdrive = 0x0;
- dbp->zconfig = 0x0;
-
- while (dbp->wbusy & 0x01)
- DELAY(400);
-
- /*
- * Start of missing ROM code.
- */
- dbp->cmapbank = 0;
-
- dbp->red0 = 0;
- dbp->red1 = 0;
- dbp->green0 = 0;
- dbp->green1 = 0;
- dbp->blue0 = 0;
- dbp->blue1 = 0;
-
- dbp->panxh = 0;
- dbp->panxl = 0;
- dbp->panyh = 0;
- dbp->panyl = 0;
- dbp->zoom = 0;
- dbp->cdwidth = 0x50;
- dbp->chstart = 0x52;
- dbp->cvwidth = 0x22;
- dbp->pz_trig = 1;
- /*
- * End of missing ROM code.
- */
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_gb.c b/sys/arch/hp300/stand/common/ite_gb.c
deleted file mode 100644
index 7d55acbfc99..00000000000
--- a/sys/arch/hp300/stand/common/ite_gb.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/* $OpenBSD: ite_gb.c,v 1.5 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: ite_gb.c,v 1.8 1996/03/03 04:23:36 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_gb.c 1.9 92/01/20$
- *
- * @(#)ite_gb.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "itevar.h"
-#include "itereg.h"
-#include "grf_gbreg.h"
-
-#define REGBASE ((struct gboxfb *)(ip->regbase))
-
-void gbox_windowmove(struct ite_data *, int, int, int, int,
- int, int, int);
-
-void
-gbox_init(struct ite_data *ip)
-{
- ip->bmv = gbox_windowmove;
-
- REGBASE->write_protect = 0x0;
- REGBASE->interrupt = 0x4;
- REGBASE->rep_rule = RR_COPY;
- REGBASE->blink1 = 0xff;
- REGBASE->blink2 = 0xff;
- REGBASE->sec_interrupt = 0x01;
-
- /*
- * Set up the color map entries. We use three entries in the
- * color map. The first, is for black, the second is for
- * white, and the very last entry is for the inverted cursor.
- */
- REGBASE->creg_select = 0x00;
- REGBASE->cmap_red = 0x00;
- REGBASE->cmap_grn = 0x00;
- REGBASE->cmap_blu = 0x00;
- REGBASE->cmap_write = 0x00;
- gbcm_waitbusy(ip->regbase);
-
- REGBASE->creg_select = 0x01;
- REGBASE->cmap_red = 0xFF;
- REGBASE->cmap_grn = 0xFF;
- REGBASE->cmap_blu = 0xFF;
- REGBASE->cmap_write = 0x01;
- gbcm_waitbusy(ip->regbase);
-
- REGBASE->creg_select = 0xFF;
- REGBASE->cmap_red = 0xFF;
- REGBASE->cmap_grn = 0xFF;
- REGBASE->cmap_blu = 0xFF;
- REGBASE->cmap_write = 0x01;
- gbcm_waitbusy(ip->regbase);
-
- ite_fontinfo(ip);
- ite_fontinit8bpp(ip);
-
- /*
- * Clear the display. This used to be before the font unpacking
- * but it crashes. Figure it out later.
- */
- gbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
- tile_mover_waitbusy(ip->regbase);
-
- /*
- * Stash the inverted cursor.
- */
- gbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight,
- ip->ftwidth, RR_COPYINVERTED);
-}
-
-void
-gbox_scroll(struct ite_data *ip)
-{
- tile_mover_waitbusy(ip->regbase);
- REGBASE->write_protect = 0x0;
-
- ite_dio_scroll(ip);
-}
-
-void
-gbox_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h,
- int w, int mask)
-{
- int src, dest;
-
- src = (sy * 1024) + sx; /* upper left corner in pixels */
- dest = (dy * 1024) + dx;
-
- tile_mover_waitbusy(ip->regbase);
- REGBASE->width = -(w / 4);
- REGBASE->height = -(h / 4);
- if (src < dest)
- REGBASE->rep_rule = MOVE_DOWN_RIGHT|mask;
- else {
- REGBASE->rep_rule = MOVE_UP_LEFT|mask;
- /*
- * Adjust to top of lower right tile of the block.
- */
- src = src + ((h - 4) * 1024) + (w - 4);
- dest= dest + ((h - 4) * 1024) + (w - 4);
- }
- FBBASE[dest] = FBBASE[src];
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_hy.c b/sys/arch/hp300/stand/common/ite_hy.c
deleted file mode 100644
index cc7865770f5..00000000000
--- a/sys/arch/hp300/stand/common/ite_hy.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* $OpenBSD: ite_hy.c,v 1.7 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: ite_hy.c,v 1.3 1996/03/03 04:23:37 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department 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: ite_hy.c 1.1 92/01/22$
- *
- * @(#)ite_hy.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef ITECONSOLE
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "itevar.h"
-#include "grf_hyreg.h"
-
-#define REGBASE ((struct hyboxfb *)(ip->regbase))
-
-void
-hyper_init(struct ite_data *ip)
-{
- int width;
-
- ip->bmv = ite_dio_windowmove1bpp;
- ite_fontinfo(ip);
- width = ((ip->ftwidth + 7) / 8) * 8;
- ip->cpl = (ip->fbwidth - ip->dwidth) / width;
- ip->cblanky = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight;
-
- REGBASE->nblank = 0x05;
-
- /*
- * Clear the framebuffer on all planes.
- */
- ite_dio_windowmove1bpp(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth,
- RR_CLEAR);
-
- ite_fontinit1bpp(ip);
-
- /*
- * Stash the inverted cursor.
- */
- ite_dio_windowmove1bpp(ip, charY(ip, ' '), charX1bpp(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight, ip->ftwidth,
- RR_COPYINVERTED);
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_rb.c b/sys/arch/hp300/stand/common/ite_rb.c
deleted file mode 100644
index f0d4746c23c..00000000000
--- a/sys/arch/hp300/stand/common/ite_rb.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/* $OpenBSD: ite_rb.c,v 1.5 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: ite_rb.c,v 1.8 1996/03/03 04:23:38 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_rb.c 1.6 92/01/20$
- *
- * @(#)ite_rb.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "itevar.h"
-#include "grf_rbreg.h"
-
-#define REGBASE ((struct rboxfb *)(ip->regbase))
-
-void rbox_windowmove(struct ite_data *, int, int, int, int,
- int, int, int);
-
-void
-rbox_init(struct ite_data *ip)
-{
- int i;
-
- ip->bmv = rbox_windowmove;
-
- rb_waitbusy(ip->regbase);
- DELAY(3000);
-
- REGBASE->interrupt = 0x04;
- REGBASE->display_enable = 0x01;
- REGBASE->video_enable = 0x01;
- REGBASE->drive = 0x01;
- REGBASE->vdrive = 0x0;
-
- ite_fontinfo(ip);
-
- REGBASE->opwen = 0xFF;
-
- /*
- * Clear the framebuffer.
- */
- rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
- rb_waitbusy(ip->regbase);
-
- for(i = 0; i < 16; i++) {
- *(ip->regbase + 0x63c3 + i*4) = 0x0;
- *(ip->regbase + 0x6403 + i*4) = 0x0;
- *(ip->regbase + 0x6803 + i*4) = 0x0;
- *(ip->regbase + 0x6c03 + i*4) = 0x0;
- *(ip->regbase + 0x73c3 + i*4) = 0x0;
- *(ip->regbase + 0x7403 + i*4) = 0x0;
- *(ip->regbase + 0x7803 + i*4) = 0x0;
- *(ip->regbase + 0x7c03 + i*4) = 0x0;
- }
-
- REGBASE->rep_rule = 0x33;
-
- /*
- * I cannot figure out how to make the blink planes stop. So, we
- * must set both colormaps so that when the planes blink, and
- * the secondary colormap is active, we still get text.
- */
- CM1RED[0x00].value = 0x00;
- CM1GRN[0x00].value = 0x00;
- CM1BLU[0x00].value = 0x00;
- CM1RED[0x01].value = 0xFF;
- CM1GRN[0x01].value = 0xFF;
- CM1BLU[0x01].value = 0xFF;
-
- CM2RED[0x00].value = 0x00;
- CM2GRN[0x00].value = 0x00;
- CM2BLU[0x00].value = 0x00;
- CM2RED[0x01].value = 0xFF;
- CM2GRN[0x01].value = 0xFF;
- CM2BLU[0x01].value = 0xFF;
-
- REGBASE->blink = 0x00;
- REGBASE->write_enable = 0x01;
- REGBASE->opwen = 0x00;
-
- ite_fontinit8bpp(ip);
-
- /*
- * Stash the inverted cursor.
- */
- rbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight,
- ip->ftwidth, RR_COPYINVERTED);
-}
-
-void
-rbox_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h,
- int w, int func)
-{
- struct rboxfb *rp = REGBASE;
- if (h == 0 || w == 0)
- return;
-
- rb_waitbusy(ip->regbase);
- rp->rep_rule = func << 4 | func;
- rp->source_y = sy;
- rp->source_x = sx;
- rp->dest_y = dy;
- rp->dest_x = dx;
- rp->wheight = h;
- rp->wwidth = w;
- rp->wmove = 1;
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_sti.c b/sys/arch/hp300/stand/common/ite_sti.c
deleted file mode 100644
index e035fd7b178..00000000000
--- a/sys/arch/hp300/stand/common/ite_sti.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/* $OpenBSD: ite_sti.c,v 1.2 2011/08/18 20:02:58 miod Exp $ */
-/*
- * Copyright (c) 2006, 2011, Miodrag Vallat
- * Copyright (c) 2000-2003 Michael Shalayeff
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifdef ITECONSOLE
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "consdefs.h"
-#include "itevar.h"
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/sgcreg.h>
-#include <hp300/dev/sti_machdep.h>
-#include <dev/ic/stireg.h>
-
-/*
- * sti-specific data not available in the ite_data structure.
- * Since we will only configure one sti display, it is ok to use a global.
- */
-static struct {
- u_int32_t codeptr[STI_CODECNT];
- u_int8_t *code;
- u_int32_t fontbase;
- u_int firstchar, lastchar;
- struct sti_cfg cfg;
- struct sti_ecfg ecfg;
-} sti;
-
-#define parseshort1(addr, ofs) \
- (((addr)[(ofs) + 3] << 8) | ((addr)[(ofs) + 7]))
-#define parseword1(addr, ofs) \
- (((addr)[(ofs) + 3] << 24) | ((addr)[(ofs) + 7] << 16) | \
- ((addr)[(ofs) + 11] << 8) | ((addr)[(ofs) + 15]))
-
-void sti_do_cursor(struct ite_data *);
-void sti_fontinfo(struct ite_data *);
-void sti_init(int);
-void sti_inqcfg(struct sti_inqconfout *);
-void sti_iteinit_common(struct ite_data *);
-
-/* kinda similar to sti_dio_probe() */
-int
-sti_dio_probe(struct ite_data *ip)
-{
- int scode = ip->scode;
- uint8_t *id_reg;
-
- id_reg = (uint8_t *)sctoaddr(scode);
- if (id_reg[DIOII_SIZEOFF] < STI_DIO_SIZE - 1)
- return ENODEV;
-
- id_reg = (uint8_t *)sctoaddr(scode + STI_DIO_SCODE_OFFSET);
- if (id_reg[3] != STI_DEVTYPE1)
- return ENODEV;
-
- return 0;
-}
-
-void
-sti_iteinit_dio(struct ite_data *ip)
-{
- ip->fbbase = (caddr_t)sctoaddr(ip->scode + STI_DIO_SCODE_OFFSET);
- sti_iteinit_common(ip);
-}
-
-void
-sti_iteinit_sgc(struct ite_data *ip)
-{
- ip->fbbase = (caddr_t)IIOV(SGC_BASE + (ip->scode * SGC_DEVSIZE));
- sti_iteinit_common(ip);
-}
-
-/*
- * Initialize the sti device for ite's needs.
- * We don't bother to check for failures since
- * - we are in tight space already
- * - since romputchar() does not work with sti devices, there is no way we
- * can report errors (although we could switch to serial...)
- */
-void
-sti_iteinit_common(struct ite_data *ip)
-{
- int i;
- size_t codesize, memsize;
- u_int8_t *va, *code;
- u_int addr, eaddr, reglist, tmp;
- struct sti_inqconfout cfg;
- struct sti_einqconfout ecfg;
-
- bzero(&sti, sizeof sti);
- va = (u_int8_t *)ip->fbbase;
-
- /*
- * Read the microcode.
- */
-
- for (i = 0; i < STI_CODECNT; i++)
- sti.codeptr[i] =
- parseword1(va, (STI_CODEBASE_M68K << 2) + i * 0x10);
-
- for (i = STI_END; sti.codeptr[i] == 0; i--);
- codesize = sti.codeptr[i] - sti.codeptr[STI_BEGIN];
- codesize = (codesize + 3) / 4;
-
- sti.code = (u_int8_t *)alloc(codesize);
- code = sti.code;
- addr = (u_int)va + sti.codeptr[STI_BEGIN];
- eaddr = addr + codesize * 4;
- for (; addr < eaddr; addr += 4)
- *code++ = *(u_int8_t *)addr;
-
- for (i = STI_CODECNT - 1; i != 0; i--)
- if (sti.codeptr[i] != 0) {
- sti.codeptr[i] -= sti.codeptr[0];
- sti.codeptr[i] /= 4;
- }
-
- sti.codeptr[0] = 0;
- for (i = STI_END; sti.codeptr[i] == 0; i--);
- sti.codeptr[i] = 0;
-
- /*
- * Read the regions list.
- */
-
- reglist = parseword1(va, 0x60);
- for (i = 0; i < STI_REGION_MAX; i++) {
- tmp = parseword1(va, (reglist & ~3) + i * 0x10);
- sti.cfg.regions[i] = (u_int)va + ((tmp >> 18) << 12);
- if (tmp & 0x4000)
- break;
- }
-
- /*
- * Allocate scratch memory for the microcode if it needs it.
- */
-
- sti.cfg.ext_cfg = &sti.ecfg;
- memsize = parseword1(va, 0xa0);
- if (memsize != 0)
- sti.ecfg.addr = alloc(memsize);
-
- /*
- * Initialize the display, and get geometry information.
- */
-
- sti_init(0);
-
- bzero(&cfg, sizeof cfg);
- bzero(&ecfg, sizeof ecfg);
- cfg.ext = &ecfg;
- sti_inqcfg(&cfg);
-
- if (cfg.owidth == cfg.width && cfg.oheight == cfg.height) {
- sti.cfg.oscr_width = cfg.owidth = cfg.fbwidth - cfg.width;
- sti.cfg.oscr_height = cfg.oheight = cfg.fbheight - cfg.height;
- }
-
- ip->dheight = cfg.height;
- ip->dwidth = cfg.width;
- ip->fbheight = cfg.fbheight;
- ip->fbwidth = cfg.fbwidth;
-
- /*
- * Get ready for ite operation!
- */
-
- sti_init(1);
- sti_fontinfo(ip);
- sti_clear(ip, 0, 0, ip->rows, ip->cols); /* necessary? */
-}
-
-void
-sti_putc(struct ite_data *ip, int c, int dy, int dx)
-{
- sti_unpmv_t unpmv;
- struct {
- struct sti_unpmvflags flags;
- struct sti_unpmvin in;
- struct sti_unpmvout out;
- } a;
-
- bzero(&a, sizeof a);
- a.flags.flags = STI_UNPMVF_WAIT;
- a.in.bg_colour = STI_COLOUR_BLACK;
- a.in.fg_colour = STI_COLOUR_WHITE;
- a.in.x = dx * ip->ftwidth;
- a.in.y = dy * ip->ftheight;
- a.in.font_addr = (u_int32_t *)(ip->fbbase + sti.fontbase);
- a.in.index = c;
-
- unpmv = (sti_unpmv_t)(sti.code + sti.codeptr[STI_FONT_UNPMV]);
- (*unpmv)(&a.flags, &a.in, &a.out, &sti.cfg);
-}
-
-void
-sti_cursor(struct ite_data *ip, int flag)
-{
- switch (flag) {
- case MOVE_CURSOR:
- sti_do_cursor(ip);
- /* FALLTHROUGH */
- case DRAW_CURSOR:
- ip->cursorx = ip->curx;
- ip->cursory = ip->cury;
- /* FALLTHROUGH */
- default:
- sti_do_cursor(ip);
- break;
- }
-}
-
-void
-sti_do_cursor(struct ite_data *ip)
-{
- sti_blkmv_t blkmv;
- struct {
- struct sti_blkmvflags flags;
- struct sti_blkmvin in;
- struct sti_blkmvout out;
- } a;
-
- bzero(&a, sizeof a);
- a.flags.flags = STI_BLKMVF_WAIT | STI_BLKMVF_COLR;
- a.in.fg_colour = STI_COLOUR_BLACK;
- a.in.bg_colour = STI_COLOUR_WHITE;
- a.in.dstx = a.in.srcx = ip->cursorx * ip->ftwidth;
- a.in.dsty = a.in.srcy = ip->cursory * ip->ftheight;
- a.in.width = ip->ftwidth;
- a.in.height = ip->ftheight;
-
- blkmv = (sti_blkmv_t)(sti.code + sti.codeptr[STI_BLOCK_MOVE]);
- (*blkmv)(&a.flags, &a.in, &a.out, &sti.cfg);
-}
-
-void
-sti_clear(struct ite_data *ip, int sy, int sx, int h, int w)
-{
- sti_blkmv_t blkmv;
- struct {
- struct sti_blkmvflags flags;
- struct sti_blkmvin in;
- struct sti_blkmvout out;
- } a;
-
- bzero(&a, sizeof a);
- a.flags.flags = STI_BLKMVF_WAIT | STI_BLKMVF_CLR;
- a.in.bg_colour = STI_COLOUR_BLACK;
- a.in.dstx = a.in.srcx = sx * ip->ftwidth;
- a.in.dsty = a.in.srcy = sy * ip->ftheight;
- a.in.width = w * ip->ftwidth;
- a.in.height = h * ip->ftheight;
-
- blkmv = (sti_blkmv_t)(sti.code + sti.codeptr[STI_BLOCK_MOVE]);
- (*blkmv)(&a.flags, &a.in, &a.out, &sti.cfg);
-}
-
-void
-sti_scroll(struct ite_data *ip)
-{
- sti_blkmv_t blkmv;
- struct {
- struct sti_blkmvflags flags;
- struct sti_blkmvin in;
- struct sti_blkmvout out;
- } a;
-
- bzero(&a, sizeof a);
- a.flags.flags = STI_BLKMVF_WAIT;
- a.in.bg_colour = STI_COLOUR_BLACK;
- a.in.fg_colour = STI_COLOUR_WHITE;
- a.in.dstx = a.in.srcx = 0;
- a.in.dsty = 0;
- a.in.srcy = ip->ftheight;
- a.in.width = ip->dwidth;
- a.in.height = (ip->rows - 1) * ip->ftheight;
-
- blkmv = (sti_blkmv_t)(sti.code + sti.codeptr[STI_BLOCK_MOVE]);
- (*blkmv)(&a.flags, &a.in, &a.out, &sti.cfg);
-}
-
-void
-sti_fontinfo(struct ite_data *ip)
-{
- u_int32_t fontbase;
-
- fontbase = sti.fontbase = parseword1((u_int8_t *)ip->fbbase, 0x30) & ~3;
- ip->ftwidth = (u_int8_t)ip->fbbase[fontbase + 0x13];
- ip->ftheight = (u_int8_t)ip->fbbase[fontbase + 0x17];
- ip->rows = ip->dheight / ip->ftheight;
- ip->cols = ip->dwidth / ip->ftwidth;
-}
-
-void
-sti_init(int full)
-{
- sti_init_t init;
- struct {
- struct sti_initflags flags;
- struct sti_initin in;
- struct sti_initout out;
- } a;
-
- bzero(&a, sizeof a);
- a.flags.flags = STI_INITF_WAIT | STI_INITF_CMB | STI_INITF_EBET;
- if (full)
- a.flags.flags |= STI_INITF_TEXT | STI_INITF_PBET |
- STI_INITF_PBETI | STI_INITF_ICMT;
- a.in.text_planes = 1;
-
- init = (sti_init_t)(sti.code + sti.codeptr[STI_INIT_GRAPH]);
- (*init)(&a.flags, &a.in, &a.out, &sti.cfg);
-}
-
-void
-sti_inqcfg(struct sti_inqconfout *ico)
-{
- sti_inqconf_t inqconf;
- struct {
- struct sti_inqconfflags flags;
- struct sti_inqconfin in;
- } a;
-
- bzero(&a, sizeof a);
- a.flags.flags = STI_INQCONFF_WAIT;
-
- inqconf = (sti_inqconf_t)(sti.code + sti.codeptr[STI_INQ_CONF]);
- (*inqconf)(&a.flags, &a.in, ico, &sti.cfg);
-}
-
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_subr.c b/sys/arch/hp300/stand/common/ite_subr.c
deleted file mode 100644
index f34fcda7bc0..00000000000
--- a/sys/arch/hp300/stand/common/ite_subr.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/* $OpenBSD: ite_subr.c,v 1.5 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: ite_subr.c,v 1.8 1996/03/03 04:23:40 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_subr.c 1.2 92/01/20$
- *
- * @(#)ite_subr.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "itevar.h"
-#include "itereg.h"
-
-#define getbyte(ip, offset) \
- *(((u_char *)(ip)->regbase) + (offset))
-
-#define getword(ip, offset) \
- ((getbyte(ip, offset) << 8) | getbyte(ip, (offset) + 2))
-
-u_char ite_readbyte(struct ite_data *, int);
-void ite_writeglyph(struct ite_data *, u_char *, u_char *);
-
-void
-ite_fontinfo(struct ite_data *ip)
-{
- u_long fontaddr = getword(ip, getword(ip, FONTROM) + FONTADDR);
-
- ip->ftheight = getbyte(ip, fontaddr + FONTHEIGHT);
- ip->ftwidth = getbyte(ip, fontaddr + FONTWIDTH);
- ip->rows = ip->dheight / ip->ftheight;
- ip->cols = ip->dwidth / ip->ftwidth;
-
- if (ip->fbwidth > ip->dwidth) {
- /*
- * Stuff goes to right of display.
- */
- ip->fontx = ip->dwidth;
- ip->fonty = 0;
- ip->cpl = (ip->fbwidth - ip->dwidth) / ip->ftwidth;
- ip->cblankx = ip->dwidth;
- ip->cblanky = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight;
- } else {
- /*
- * Stuff goes below the display.
- */
- ip->fontx = 0;
- ip->fonty = ip->dheight;
- ip->cpl = ip->fbwidth / ip->ftwidth;
- ip->cblankx = 0;
- ip->cblanky = ip->fonty + ((128 / ip->cpl) + 1) * ip->ftheight;
- }
-}
-
-void
-ite_fontinit1bpp(struct ite_data *ip)
-{
- u_char *fbmem, *dp;
- int c, l, b;
- int stride, width;
-
- dp = (u_char *)(getword(ip, getword(ip, FONTROM) + FONTADDR) +
- ip->regbase) + FONTDATA;
- stride = ip->fbwidth >> 3;
- width = (ip->ftwidth + 7) / 8;
-
- for (c = 0; c < 128; c++) {
- fbmem = (u_char *)FBBASE +
- (ip->fonty + (c / ip->cpl) * ip->ftheight) * stride;
- fbmem += (ip->fontx >> 3) + (c % ip->cpl) * width;
- for (l = 0; l < ip->ftheight; l++) {
- for (b = 0; b < width; b++) {
- *fbmem++ = *dp;
- dp += 2;
- }
- fbmem -= width;
- fbmem += stride;
- }
- }
-}
-
-void
-ite_fontinit8bpp(struct ite_data *ip)
-{
- int bytewidth = (((ip->ftwidth - 1) / 8) + 1);
- int glyphsize = bytewidth * ip->ftheight;
- u_char fontbuf[500];
- u_char *dp, *fbmem;
- int c, i, romp;
-
- romp = getword(ip, getword(ip, FONTROM) + FONTADDR) + FONTDATA;
- for (c = 0; c < 128; c++) {
- fbmem = (u_char *)(FBBASE +
- (ip->fonty + (c / ip->cpl) * ip->ftheight) * ip->fbwidth +
- (ip->fontx + (c % ip->cpl) * ip->ftwidth));
- dp = fontbuf;
- for (i = 0; i < glyphsize; i++) {
- *dp++ = getbyte(ip, romp);
- romp += 2;
- }
- ite_writeglyph(ip, fbmem, fontbuf);
- }
-}
-
-void
-ite_writeglyph(struct ite_data *ip, u_char *fbmem, u_char *glyphp)
-{
- int bn;
- int l, b;
-
- for (l = 0; l < ip->ftheight; l++) {
- bn = 7;
- for (b = 0; b < ip->ftwidth; b++) {
- if ((1 << bn) & *glyphp)
- *fbmem++ = 1;
- else
- *fbmem++ = 0;
- if (--bn < 0) {
- bn = 7;
- glyphp++;
- }
- }
- if (bn < 7)
- glyphp++;
- fbmem -= ip->ftwidth;
- fbmem += ip->fbwidth;
- }
-}
-
-/*
- * The cursor is just an inverted space.
- */
-#define flip_cursor(ip) \
- (*ip->bmv)(ip, ip->cblanky, ip->cblankx, ip->cursory * ip->ftheight, \
- ip->cursorx * ip->ftwidth, ip->ftheight, ip->ftwidth, RR_XOR)
-
-void
-ite_dio_cursor(struct ite_data *ip, int flag)
-{
- switch (flag) {
- case MOVE_CURSOR:
- flip_cursor(ip);
- /* FALLTHROUGH */
- case DRAW_CURSOR:
- ip->cursorx = ip->curx;
- ip->cursory = ip->cury;
- /* FALLTHROUGH */
- default:
- flip_cursor(ip);
- break;
- }
-}
-
-void
-ite_dio_putc1bpp(struct ite_data *ip, int c, int dy, int dx)
-{
- ite_dio_windowmove1bpp(ip, charY(ip, c), charX1bpp(ip, c),
- dy * ip->ftheight, dx * ip->ftwidth,
- ip->ftheight, ip->ftwidth, RR_COPY);
-}
-
-void
-ite_dio_putc8bpp(struct ite_data *ip, int c, int dy, int dx)
-{
- (*ip->bmv)(ip, charY(ip, c), charX(ip, c),
- dy * ip->ftheight, dx * ip->ftwidth,
- ip->ftheight, ip->ftwidth, RR_COPY);
-}
-
-void
-ite_dio_clear(struct ite_data *ip, int sy, int sx, int h, int w)
-{
- (*ip->bmv)(ip, sy * ip->ftheight, sx * ip->ftwidth,
- sy * ip->ftheight, sx * ip->ftwidth,
- h * ip->ftheight, w * ip->ftwidth, RR_CLEAR);
-}
-
-void
-ite_dio_scroll(struct ite_data *ip)
-{
- flip_cursor(ip);
-
- (*ip->bmv)(ip, ip->ftheight, 0, 0, 0, (ip->rows - 1) * ip->ftheight,
- ip->cols * ip->ftwidth, RR_COPY);
-}
-
-#include "maskbits.h"
-
-/* NOTE:
- * the first element in starttab could be 0xffffffff. making it 0
- * lets us deal with a full first word in the middle loop, rather
- * than having to do the multiple reads and masks that we'd
- * have to do if we thought it was partial.
- */
-int starttab[32] = {
- 0x00000000,
- 0x7FFFFFFF,
- 0x3FFFFFFF,
- 0x1FFFFFFF,
- 0x0FFFFFFF,
- 0x07FFFFFF,
- 0x03FFFFFF,
- 0x01FFFFFF,
- 0x00FFFFFF,
- 0x007FFFFF,
- 0x003FFFFF,
- 0x001FFFFF,
- 0x000FFFFF,
- 0x0007FFFF,
- 0x0003FFFF,
- 0x0001FFFF,
- 0x0000FFFF,
- 0x00007FFF,
- 0x00003FFF,
- 0x00001FFF,
- 0x00000FFF,
- 0x000007FF,
- 0x000003FF,
- 0x000001FF,
- 0x000000FF,
- 0x0000007F,
- 0x0000003F,
- 0x0000001F,
- 0x0000000F,
- 0x00000007,
- 0x00000003,
- 0x00000001
-};
-
-int endtab[32] = {
- 0x00000000,
- 0x80000000,
- 0xC0000000,
- 0xE0000000,
- 0xF0000000,
- 0xF8000000,
- 0xFC000000,
- 0xFE000000,
- 0xFF000000,
- 0xFF800000,
- 0xFFC00000,
- 0xFFE00000,
- 0xFFF00000,
- 0xFFF80000,
- 0xFFFC0000,
- 0xFFFE0000,
- 0xFFFF0000,
- 0xFFFF8000,
- 0xFFFFC000,
- 0xFFFFE000,
- 0xFFFFF000,
- 0xFFFFF800,
- 0xFFFFFC00,
- 0xFFFFFE00,
- 0xFFFFFF00,
- 0xFFFFFF80,
- 0xFFFFFFC0,
- 0xFFFFFFE0,
- 0xFFFFFFF0,
- 0xFFFFFFF8,
- 0xFFFFFFFC,
- 0xFFFFFFFE
-};
-
-void
-ite_dio_windowmove1bpp(struct ite_data *ip, int sy, int sx, int dy, int dx,
- int h, int w, int func)
-{
- int width; /* add to get to same position in next line */
-
- unsigned int *psrcLine, *pdstLine;
- /* pointers to line with current src and dst */
- unsigned int *psrc; /* pointer to current src longword */
- unsigned int *pdst; /* pointer to current dst longword */
-
- /* following used for looping through a line */
- unsigned int startmask, endmask; /* masks for writing ends of dst */
- int nlMiddle; /* whole longwords in dst */
- int nl; /* temp copy of nlMiddle */
- unsigned int tmpSrc; /* place to store full source word */
- int xoffSrc; /* offset (>= 0, < 32) from which to
- fetch whole longwords fetched
- in src */
- int nstart; /* number of ragged bits at start of dst */
- int nend; /* number of ragged bits at end of dst */
- int srcStartOver; /* pulling nstart bits from src
- overflows into the next word? */
-
- if (h == 0 || w == 0)
- return;
-
- width = ip->fbwidth >> 5;
- psrcLine = ((unsigned int *) ip->fbbase) + (sy * width);
- pdstLine = ((unsigned int *) ip->fbbase) + (dy * width);
-
- /* x direction doesn't matter for < 1 longword */
- if (w <= 32) {
- int srcBit, dstBit; /* bit offset of src and dst */
-
- pdstLine += (dx >> 5);
- psrcLine += (sx >> 5);
- psrc = psrcLine;
- pdst = pdstLine;
-
- srcBit = sx & 0x1f;
- dstBit = dx & 0x1f;
-
- while (h--) {
- getandputrop(psrc, srcBit, dstBit, w, pdst, func);
- pdst += width;
- psrc += width;
- }
- } else {
- maskbits(dx, w, startmask, endmask, nlMiddle);
- if (startmask)
- nstart = 32 - (dx & 0x1f);
- else
- nstart = 0;
- if (endmask)
- nend = (dx + w) & 0x1f;
- else
- nend = 0;
-
- xoffSrc = ((sx & 0x1f) + nstart) & 0x1f;
- srcStartOver = ((sx & 0x1f) + nstart) > 31;
-
- pdstLine += (dx >> 5);
- psrcLine += (sx >> 5);
-
- while (h--) {
- psrc = psrcLine;
- pdst = pdstLine;
-
- if (startmask) {
- getandputrop(psrc, (sx & 0x1f), (dx & 0x1f),
- nstart, pdst, func);
- pdst++;
- if (srcStartOver)
- psrc++;
- }
-
- /* special case for aligned operations */
- if (xoffSrc == 0) {
- nl = nlMiddle;
- while (nl--) {
- DoRop (*pdst, func, *psrc++, *pdst);
- pdst++;
- }
- } else {
- nl = nlMiddle + 1;
- while (--nl) {
- getunalignedword (psrc, xoffSrc,
- tmpSrc);
- DoRop (*pdst, func, tmpSrc, *pdst);
- pdst++;
- psrc++;
- }
- }
-
- if (endmask) {
- getandputrop0(psrc, xoffSrc, nend, pdst, func);
- }
-
- pdstLine += width;
- psrcLine += width;
- }
- }
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_tc.c b/sys/arch/hp300/stand/common/ite_tc.c
deleted file mode 100644
index f968282efc3..00000000000
--- a/sys/arch/hp300/stand/common/ite_tc.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $OpenBSD: ite_tc.c,v 1.6 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: ite_tc.c,v 1.8 1996/03/03 04:23:41 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_tc.c 1.11 92/01/20$
- *
- * @(#)ite_tc.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "itevar.h"
-#include "itereg.h"
-
-#include <hp300/dev/diofbreg.h>
-
-#include "grf_tcreg.h"
-
-#define REGBASE ((struct tcboxfb *)(ip->regbase))
-
-void topcat_windowmove(struct ite_data *, int, int, int, int,
- int, int, int);
-
-void
-topcat_init(struct ite_data *ip)
-{
- ip->bmv = topcat_windowmove;
-
- /*
- * Catseye looks a lot like a topcat, but not completely.
- * So, we set some bits to make it work.
- */
- if (REGBASE->fbid != GID_TOPCAT) {
- while ((REGBASE->catseye_status & 1))
- ;
- REGBASE->catseye_status = 0x0;
- REGBASE->vb_select = 0x0;
- REGBASE->tcntrl = 0x0;
- REGBASE->acntrl = 0x0;
- REGBASE->pncntrl = 0x0;
- REGBASE->rug_cmdstat = 0x90;
- }
-
- /*
- * Determine the number of planes by writing to the first frame
- * buffer display location, then reading it back.
- */
- REGBASE->wen = ~0;
- REGBASE->fben = ~0;
- REGBASE->prr = RR_COPY;
- *FBBASE = 0xFF;
- ip->planemask = *FBBASE;
-
- /*
- * Enable reading/writing of all the planes.
- */
- REGBASE->fben = ip->planemask;
- REGBASE->wen = ip->planemask;
- REGBASE->ren = ip->planemask;
- REGBASE->prr = RR_COPY;
-
- ite_fontinfo(ip);
-
- /*
- * Clear the framebuffer on all planes.
- */
- topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
- tc_waitbusy(ip->regbase, ip->planemask);
-
- ite_fontinit8bpp(ip);
-
- /*
- * Stash the inverted cursor.
- */
- topcat_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight,
- ip->ftwidth, RR_COPYINVERTED);
-}
-
-void
-topcat_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h,
- int w, int func)
-{
- struct tcboxfb *rp = REGBASE;
-
- if (h == 0 || w == 0)
- return;
- tc_waitbusy(ip->regbase, ip->planemask);
- rp->wmrr = func;
- rp->source_y = sy;
- rp->source_x = sx;
- rp->dest_y = dy;
- rp->dest_x = dx;
- rp->wheight = h;
- rp->wwidth = w;
- rp->wmove = ip->planemask;
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_tvrx.c b/sys/arch/hp300/stand/common/ite_tvrx.c
deleted file mode 100644
index 9309b093349..00000000000
--- a/sys/arch/hp300/stand/common/ite_tvrx.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: ite_tvrx.c,v 1.2 2006/08/17 06:31:10 miod Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department 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: ite_hy.c 1.1 92/01/22$
- *
- * @(#)ite_hy.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef ITECONSOLE
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "itevar.h"
-
-void
-tvrx_init(struct ite_data *ip)
-{
- int width;
-
- ip->bmv = ite_dio_windowmove1bpp;
- ite_fontinfo(ip);
- width = ((ip->ftwidth + 7) / 8) * 8;
- ip->cpl = (ip->fbwidth - ip->dwidth) / width;
- ip->cblanky = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight;
-
- /*
- * Clear the framebuffer on all planes.
- */
- ite_dio_windowmove1bpp(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth,
- RR_CLEAR);
-
- ite_fontinit1bpp(ip);
-
- /*
- * Stash the inverted cursor.
- */
- ite_dio_windowmove1bpp(ip, charY(ip, ' '), charX1bpp(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight, ip->ftwidth,
- RR_COPYINVERTED);
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/kbd.c b/sys/arch/hp300/stand/common/kbd.c
deleted file mode 100644
index 3eeb328247d..00000000000
--- a/sys/arch/hp300/stand/common/kbd.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $OpenBSD: kbd.c,v 1.3 2008/06/26 05:42:10 ray Exp $ */
-/* $NetBSD: kbd.c,v 1.2 1997/05/12 07:51:32 thorpej Exp $ */
-
-/*-
- * Copyright (c) 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 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.
- */
-
-/*
- * Indirect keyboard driver for standalone ITE.
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "kbdvar.h"
-
-#ifndef SMALL
-
-/*
- * Function switch initialized by keyboard drivers.
- */
-struct kbdsw *selected_kbd;
-
-int
-kbdgetc()
-{
-
- return ((selected_kbd != NULL) ? (*selected_kbd->k_getc)() : 0);
-}
-
-void
-kbdnmi()
-{
-
- if (selected_kbd != NULL)
- (*selected_kbd->k_nmi)();
-
- /*
- * This is the only reasonable thing to do, unfortunately.
- * Simply restarting the boot block by frobbing the stack and
- * jumping to begin: doesn't properly reset variables that
- * are in the data segment.
- */
- printf("\nboot interrupted, resetting...\n");
- DELAY(1000000);
- call_req_reboot();
-}
-
-void
-kbdinit()
-{
- int i;
-
- selected_kbd = NULL;
-
- for (i = 0; kbdsw[i].k_init != NULL; i++) {
- if ((*kbdsw[i].k_init)()) {
- selected_kbd = &kbdsw[i];
- return;
- }
- }
-}
-
-#endif /* SMALL */
-
-#endif /* ITECONSOLE */
diff --git a/sys/arch/hp300/stand/common/kbdconf.c b/sys/arch/hp300/stand/common/kbdconf.c
deleted file mode 100644
index c0f3bdf2fe0..00000000000
--- a/sys/arch/hp300/stand/common/kbdconf.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* $OpenBSD: kbdconf.c,v 1.2 2008/06/26 05:42:10 ray Exp $ */
-/* $NetBSD: kbdconf.c,v 1.1 1997/04/14 19:00:12 thorpej Exp $ */
-
-/*-
- * Copyright (c) 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 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.
- */
-
-/*
- * Keyboard support configuration.
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "kbdvar.h"
-
-#ifndef SMALL
-
-/*
- * Note, these are arranged in order of preference. The first `init'
- * routine to report success gets to play.
- */
-struct kbdsw kbdsw[] = {
-#ifdef HIL_KEYBOARD
- { hilkbd_getc, hilkbd_nmi, hilkbd_init },
-#endif
-#ifdef DOMAIN_KEYBOARD
- { dnkbd_getc, dnkbd_nmi, dnkbd_init },
-#endif
- { NULL, NULL, NULL },
-};
-
-#endif /* SMALL */
-
-#endif /* ITECONSOLE */
diff --git a/sys/arch/hp300/stand/common/machdep.c b/sys/arch/hp300/stand/common/machdep.c
deleted file mode 100644
index 4adf12b9323..00000000000
--- a/sys/arch/hp300/stand/common/machdep.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/* $OpenBSD: machdep.c,v 1.9 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: machdep.c,v 1.4 1997/06/28 07:20:25 thorpej 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.
- *
- * from: Utah $Hdr: machdep.c 1.10 92/06/18
- *
- * @(#)machdep.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-char *
-getmachineid()
-{
- extern int machineid, mmuid;
- char *cp;
-
- switch (machineid) {
- case HP_320:
- cp = "320"; break;
- case HP_330:
- cp = "318/319/330"; break;
- case HP_340:
- cp = "340"; break;
- case HP_345:
- cp = "345"; break;
- case HP_350:
- cp = "350"; break;
- case HP_36X:
- /* bootblocks do not tell 360 apart from 362 at the moment */
- cp = "360/362"; break;
- case HP_370:
- cp = "370"; break;
- case HP_375:
- cp = "375"; break;
- case HP_380:
- cp = "380"; break;
- case HP_382:
- cp = "382"; break;
- case HP_385:
- cp = "385"; break;
- case HP_400:
- cp = "400"; break;
- case HP_425:
- switch (mmuid) {
- case MMUID_425_T:
- cp = "425t"; break;
- case MMUID_425_S:
- cp = "425s"; break;
- case MMUID_425_E:
- cp = "425e"; break;
- default:
- cp = "425"; break;
- }
- break;
- case HP_433:
- switch (mmuid) {
- case MMUID_433_T:
- cp = "433t"; break;
- case MMUID_433_S:
- cp = "433s"; break;
- default:
- cp = "433"; break;
- }
- break;
- default:
- cp = "???"; break;
- }
- return(cp);
-}
-
-int userom;
-
-struct trapframe {
- int dregs[8];
- int aregs[8];
- int whoknows;
- short sr;
- int pc;
- short frame;
-};
-
-int trap(struct trapframe *);
-
-int
-trap(fp)
- struct trapframe *fp;
-{
- static int intrap = 0;
-
- if (intrap)
- return(0);
- intrap = 1;
-
-#if 0
- userom = 1;
-#endif
-
- printf("Got unexpected trap: format=%x vector=%x ps=%x pc=%x\n",
- (fp->frame>>12)&0xF, fp->frame&0xFFF, fp->sr, fp->pc);
- printf("dregs: %x %x %x %x %x %x %x %x\n",
- fp->dregs[0], fp->dregs[1], fp->dregs[2], fp->dregs[3],
- fp->dregs[4], fp->dregs[5], fp->dregs[6], fp->dregs[7]);
- printf("aregs: %x %x %x %x %x %x %x %x\n",
- fp->aregs[0], fp->aregs[1], fp->aregs[2], fp->aregs[3],
- fp->aregs[4], fp->aregs[5], fp->aregs[6], fp->aregs[7]);
- printf("bytes at pc: %x %x %x %x %x %x\n",
- ((char *)fp->pc)[0], ((char *)fp->pc)[1], ((char *)fp->pc)[2],
- ((char *)fp->pc)[3], ((char *)fp->pc)[4], ((char *)fp->pc)[5]);
-
-#if 0
- userom = 0;
-#endif
-
- intrap = 0;
-
- return(0);
-}
-
-#define ROWS 24
-#define COLS 80
-
-void
-romputchar(int c)
-{
- static char buf[COLS];
- static int col = 0, row = 0;
- int i;
-
- switch (c) {
- case '\0':
- break;
- case '\r':
- break; /* ignore */
- case '\n':
- for (i = col; i < COLS-1; i++)
- buf[i] = ' ';
- buf[i] = '\0';
- romout(row, buf);
- col = 0;
- if (++row == ROWS)
- row = 0;
- break;
-
- case '\t':
- do {
- romputchar(' ');
- } while (col & 7);
- break;
-
- default:
- buf[col] = c;
- if (++col == COLS-1)
- romputchar('\n');
- break;
- }
-}
-
-void
-machdep_start(char *entry, int howto, char *loadaddr, char *ssym, char *esym)
-{
- /* Fix what we were passed in from exec() */
-#define round_to_size(x) (((int)(x) + sizeof(int) - 1) & ~(sizeof(int) - 1))
- esym = (char *)round_to_size(esym - (char *)loadaddr);
-#undef round_to_size
-
- __asm __volatile ("movl %0,%%d7" : : "m" (howto));
- __asm __volatile ("movl %0,%%d6" : : "m" (opendev));
- __asm __volatile ("movl %0,%%a5" : : "a" (loadaddr));
- __asm __volatile ("movl %0,%%a4" : : "a" (esym));
- (*((int (*)(void))entry))();
-}
diff --git a/sys/arch/hp300/stand/common/nhpib.c b/sys/arch/hp300/stand/common/nhpib.c
deleted file mode 100644
index 7b7c5884caa..00000000000
--- a/sys/arch/hp300/stand/common/nhpib.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/* $OpenBSD: nhpib.c,v 1.4 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: nhpib.c,v 1.5 1995/08/05 16:47:46 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)nhpib.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Internal/98624 HPIB driver
- */
-
-#include <sys/param.h>
-
-#include <hp300/dev/nhpibreg.h>
-
-#include "samachdep.h"
-#include "hpibvar.h"
-
-int nhpibiwait(struct nhpibdevice *);
-int nhpibowait(struct nhpibdevice *);
-void nhpibreset(int);
-
-int
-nhpibinit(int unit)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct nhpibdevice *hd = (struct nhpibdevice *)hs->sc_addr;
- extern int internalhpib;
-
- if ((int)hd == internalhpib) {
- hs->sc_type = HPIBA;
- hs->sc_ba = HPIBA_BA;
- }
- else if (hd->hpib_cid == HPIBB) {
- hs->sc_type = HPIBB;
- hs->sc_ba = hd->hpib_csa & CSA_BA;
- }
- else
- return(0);
- nhpibreset(unit);
- return(1);
-}
-
-void
-nhpibreset(int unit)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct nhpibdevice *hd;
-
- hd = (struct nhpibdevice *)hs->sc_addr;
- hd->hpib_acr = AUX_SSWRST;
- hd->hpib_ar = hs->sc_ba;
- hd->hpib_lim = 0;
- hd->hpib_mim = 0;
- hd->hpib_acr = AUX_CDAI;
- hd->hpib_acr = AUX_CSHDW;
- hd->hpib_acr = AUX_SSTD1;
- hd->hpib_acr = AUX_SVSTD1;
- hd->hpib_acr = AUX_CPP;
- hd->hpib_acr = AUX_CHDFA;
- hd->hpib_acr = AUX_CHDFE;
- hd->hpib_acr = AUX_RHDF;
- hd->hpib_acr = AUX_CSWRST;
- hd->hpib_acr = AUX_TCA;
- hd->hpib_acr = AUX_CSRE;
- hd->hpib_acr = AUX_SSIC;
- DELAY(100);
- hd->hpib_acr = AUX_CSIC;
- hd->hpib_acr = AUX_SSRE;
- hd->hpib_data = C_DCL;
- DELAY(100000);
-}
-
-int
-nhpibsend(int unit, int slave, int sec, char *buf, int cnt)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct nhpibdevice *hd;
- int origcnt = cnt;
-
- hd = (struct nhpibdevice *)hs->sc_addr;
- hd->hpib_acr = AUX_TCA;
- hd->hpib_data = C_UNL;
- nhpibowait(hd);
- hd->hpib_data = C_TAG + hs->sc_ba;
- hd->hpib_acr = AUX_STON;
- nhpibowait(hd);
- hd->hpib_data = C_LAG + slave;
- nhpibowait(hd);
- if (sec != -1) {
- hd->hpib_data = C_SCG + sec;
- nhpibowait(hd);
- }
- hd->hpib_acr = AUX_GTS;
- if (cnt) {
- while (--cnt) {
- hd->hpib_data = *buf++;
- if (nhpibowait(hd) < 0)
- break;
- }
- hd->hpib_acr = AUX_EOI;
- hd->hpib_data = *buf;
- if (nhpibowait(hd) < 0)
- cnt++;
- hd->hpib_acr = AUX_TCA;
- }
- return(origcnt - cnt);
-}
-
-int
-nhpibrecv(int unit, int slave, int sec, char *buf, int cnt)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct nhpibdevice *hd;
- int origcnt = cnt;
-
- hd = (struct nhpibdevice *)hs->sc_addr;
- hd->hpib_acr = AUX_TCA;
- hd->hpib_data = C_UNL;
- nhpibowait(hd);
- hd->hpib_data = C_LAG + hs->sc_ba;
- hd->hpib_acr = AUX_SLON;
- nhpibowait(hd);
- hd->hpib_data = C_TAG + slave;
- nhpibowait(hd);
- if (sec != -1) {
- hd->hpib_data = C_SCG + sec;
- nhpibowait(hd);
- }
- hd->hpib_acr = AUX_RHDF;
- hd->hpib_acr = AUX_GTS;
- if (cnt) {
- while (--cnt >= 0) {
- if (nhpibiwait(hd) < 0)
- break;
- *buf++ = hd->hpib_data;
- }
- cnt++;
- hd->hpib_acr = AUX_TCA;
- }
- return(origcnt - cnt);
-}
-
-int
-nhpibppoll(int unit)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct nhpibdevice *hd;
- int ppoll;
-
- hd = (struct nhpibdevice *)hs->sc_addr;
- hd->hpib_acr = AUX_SPP;
- DELAY(25);
- ppoll = hd->hpib_cpt;
- hd->hpib_acr = AUX_CPP;
- return(ppoll);
-}
-
-int
-nhpibowait(struct nhpibdevice *hd)
-{
- int timo = 100000;
-
- while ((hd->hpib_mis & MIS_BO) == 0 && --timo)
- ;
- if (timo == 0)
- return(-1);
- return(0);
-}
-
-int
-nhpibiwait(struct nhpibdevice *hd)
-{
- int timo = 100000;
-
- while ((hd->hpib_mis & MIS_BI) == 0 && --timo)
- ;
- if (timo == 0)
- return(-1);
- return(0);
-}
diff --git a/sys/arch/hp300/stand/common/scsi.c b/sys/arch/hp300/stand/common/scsi.c
deleted file mode 100644
index bf283a46b4f..00000000000
--- a/sys/arch/hp300/stand/common/scsi.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/* $OpenBSD: scsi.c,v 1.10 2013/09/23 22:14:44 miod Exp $ */
-/* $NetBSD: scsi.c,v 1.7 1997/01/30 10:32:57 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory and 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: scsi.c 1.3 90/01/27$
- *
- * @(#)scsi.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * SCSI bus driver for standalone programs.
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "device.h"
-#include "scsireg.h"
-#include "scsivar.h"
-
-struct scsi_softc scsi_softc[NSCSI];
-
-int scsi_cmd_wait = 50000; /* use the "real" driver init_wait value */
-int scsi_data_wait = 50000; /* use the "real" driver init_wait value */
-
-void scsiabort(struct scsi_softc *, volatile struct scsidevice *);
-void scsireset(int);
-int scsi_request_sense(int, int, u_char *, u_int);
-
-void
-scsiinit()
-{
- extern struct hp_hw sc_table[];
- struct hp_hw *hw;
- struct scsi_softc *hs;
- int i;
- static int waitset = 0;
-
- i = 0;
- for (hw = sc_table; i < NSCSI && hw < &sc_table[MAXCTLRS]; hw++) {
- if (!HW_ISSCSI(hw))
- continue;
- hs = &scsi_softc[i];
- hs->sc_addr = hw->hw_kva;
- scsireset(i);
- if (howto & RB_ASKNAME)
- printf("scsi%d at sc%d\n", i, hw->hw_sc);
- hw->hw_ctrl = i;
- hs->sc_alive = 1;
- i++;
- }
- /*
- * Adjust the wait values
- */
- if (!waitset) {
- scsi_cmd_wait *= cpuspeed;
- scsi_data_wait *= cpuspeed;
- waitset = 1;
- }
-}
-
-int
-scsialive(int unit)
-{
- if (unit >= NSCSI || scsi_softc[unit].sc_alive == 0)
- return (0);
- return (1);
-}
-
-void
-scsireset(int unit)
-{
- volatile struct scsidevice *hd;
- struct scsi_softc *hs;
- u_int i;
-
- hs = &scsi_softc[unit];
- hd = (struct scsidevice *)hs->sc_addr;
- hd->scsi_id = 0xFF;
- DELAY(100);
- /*
- * Disable interrupts then reset the FUJI chip.
- */
- hd->scsi_csr = 0;
- hd->scsi_sctl = SCTL_DISABLE | SCTL_CTRLRST;
- hd->scsi_scmd = 0;
- hd->scsi_tmod = 0;
- hd->scsi_pctl = 0;
- hd->scsi_temp = 0;
- hd->scsi_tch = 0;
- hd->scsi_tcm = 0;
- hd->scsi_tcl = 0;
- hd->scsi_ints = 0;
-
- /*
- * Configure the FUJI chip with its SCSI address, all
- * interrupts enabled & appropriate parity.
- */
- i = (~hd->scsi_hconf) & 0x7;
- hs->sc_scsi_addr = 1 << i;
- hd->scsi_bdid = i;
- if (hd->scsi_hconf & HCONF_PARITY)
- hd->scsi_sctl = SCTL_DISABLE | SCTL_ABRT_ENAB |
- SCTL_SEL_ENAB | SCTL_RESEL_ENAB |
- SCTL_INTR_ENAB | SCTL_PARITY_ENAB;
- else
- hd->scsi_sctl = SCTL_DISABLE | SCTL_ABRT_ENAB |
- SCTL_SEL_ENAB | SCTL_RESEL_ENAB |
- SCTL_INTR_ENAB;
- hd->scsi_sctl &=~ SCTL_DISABLE;
-}
-
-
-void
-scsiabort(struct scsi_softc *hs, volatile struct scsidevice *hd)
-{
- printf("scsi%d error: scsiabort\n", (int)(hs - scsi_softc));
-
- scsireset(hs - scsi_softc);
- DELAY(1000000);
-}
-
-static int
-issue_select(volatile struct scsidevice *hd, u_char target, u_char our_addr)
-{
- if (hd->scsi_ssts & (SSTS_INITIATOR|SSTS_TARGET|SSTS_BUSY))
- return (1);
-
- if (hd->scsi_ints & INTS_DISCON)
- hd->scsi_ints = INTS_DISCON;
-
- hd->scsi_pctl = 0;
- hd->scsi_temp = (1 << target) | our_addr;
- /* select timeout is hardcoded to 250ms */
- hd->scsi_tch = 2;
- hd->scsi_tcm = 113;
- hd->scsi_tcl = 3;
-
- hd->scsi_scmd = SCMD_SELECT;
- return (0);
-}
-
-static int
-wait_for_select(volatile struct scsidevice *hd)
-{
- int wait;
- u_char ints;
-
- wait = scsi_data_wait;
- while ((ints = hd->scsi_ints) == 0) {
- if (--wait < 0)
- return (1);
- DELAY(1);
- }
- hd->scsi_ints = ints;
- return (!(hd->scsi_ssts & SSTS_INITIATOR));
-}
-
-static int
-ixfer_start(volatile struct scsidevice *hd, int len, u_char phase, int wait)
-{
-
- hd->scsi_tch = len >> 16;
- hd->scsi_tcm = len >> 8;
- hd->scsi_tcl = len;
- hd->scsi_pctl = phase;
- hd->scsi_tmod = 0; /*XXX*/
- hd->scsi_scmd = SCMD_XFR | SCMD_PROG_XFR;
-
- /* wait for xfer to start or svc_req interrupt */
- while ((hd->scsi_ssts & SSTS_BUSY) == 0) {
- if (hd->scsi_ints || --wait < 0)
- return (0);
- DELAY(1);
- }
- return (1);
-}
-
-static int
-ixfer_out(volatile struct scsidevice *hd, int len, u_char *buf)
-{
- int wait = scsi_data_wait;
-
- for (; len > 0; --len) {
- while (hd->scsi_ssts & SSTS_DREG_FULL) {
- if (hd->scsi_ints || --wait < 0)
- return (len);
- DELAY(1);
- }
- hd->scsi_dreg = *buf++;
- }
- return (0);
-}
-
-static int
-ixfer_in(volatile struct scsidevice *hd, int len, u_char *buf)
-{
- int wait = scsi_data_wait;
-
- for (; len > 0; --len) {
- while (hd->scsi_ssts & SSTS_DREG_EMPTY) {
- if (hd->scsi_ints || --wait < 0) {
- while (! (hd->scsi_ssts & SSTS_DREG_EMPTY)) {
- *buf++ = hd->scsi_dreg;
- --len;
- }
- return (len);
- }
- DELAY(1);
- }
- *buf++ = hd->scsi_dreg;
- }
- return (len);
-}
-
-static int
-scsiicmd(struct scsi_softc *hs, int target, u_char *cbuf, int clen, u_char *buf,
- int len, u_char xferphase)
-{
- volatile struct scsidevice *hd = (struct scsidevice *)hs->sc_addr;
- u_char phase, ints;
- int wait;
-
- /* select the SCSI bus (it's an error if bus isn't free) */
- if (issue_select(hd, target, hs->sc_scsi_addr))
- return (-2);
- if (wait_for_select(hd))
- return (-2);
- /*
- * Wait for a phase change (or error) then let the device
- * sequence us through the various SCSI phases.
- */
- hs->sc_stat = -1;
- phase = CMD_PHASE;
- while (1) {
- wait = scsi_cmd_wait;
- switch (phase) {
-
- case CMD_PHASE:
- if (ixfer_start(hd, clen, phase, wait))
- if (ixfer_out(hd, clen, cbuf))
- goto abort;
- phase = xferphase;
- break;
-
- case DATA_IN_PHASE:
- if (len <= 0)
- goto abort;
- wait = scsi_data_wait;
- if (ixfer_start(hd, len, phase, wait) ||
- !(hd->scsi_ssts & SSTS_DREG_EMPTY))
- ixfer_in(hd, len, buf);
- phase = STATUS_PHASE;
- break;
-
- case DATA_OUT_PHASE:
- if (len <= 0)
- goto abort;
- wait = scsi_data_wait;
- if (ixfer_start(hd, len, phase, wait))
- if (ixfer_out(hd, len, buf))
- goto abort;
- phase = STATUS_PHASE;
- break;
-
- case STATUS_PHASE:
- wait = scsi_data_wait;
- if (ixfer_start(hd, sizeof(hs->sc_stat), phase, wait) ||
- !(hd->scsi_ssts & SSTS_DREG_EMPTY))
- ixfer_in(hd, sizeof(hs->sc_stat), &hs->sc_stat);
- phase = MESG_IN_PHASE;
- break;
-
- case MESG_IN_PHASE:
- if (ixfer_start(hd, sizeof(hs->sc_msg), phase, wait) ||
- !(hd->scsi_ssts & SSTS_DREG_EMPTY)) {
- ixfer_in(hd, sizeof(hs->sc_msg),
- (u_char *)&hs->sc_msg);
- hd->scsi_scmd = SCMD_RST_ACK;
- }
- phase = BUS_FREE_PHASE;
- break;
-
- case BUS_FREE_PHASE:
- goto out;
-
- default:
- printf("scsi%d: unexpected scsi phase %d\n",
- (int)(hs - scsi_softc), phase);
- goto abort;
- }
- /* wait for last command to complete */
- while ((ints = hd->scsi_ints) == 0) {
- if (--wait < 0)
- goto abort;
- DELAY(1);
- }
- hd->scsi_ints = ints;
- if (ints & INTS_SRV_REQ)
- phase = hd->scsi_psns & PHASE;
- else if (ints & INTS_DISCON)
- goto out;
- else if ((ints & INTS_CMD_DONE) == 0)
- goto abort;
- }
-abort:
- scsiabort(hs, hd);
-out:
- return (hs->sc_stat);
-}
-
-int
-scsi_test_unit_rdy(int ctlr, int slave)
-{
- struct scsi_softc *hs = &scsi_softc[ctlr];
- static struct scsi_cdb6 cdb = { CMD_TEST_UNIT_READY };
-
- return (scsiicmd(hs, slave, (u_char *)&cdb, sizeof(cdb),
- (u_char *)0, 0, STATUS_PHASE));
-}
-
-int
-scsi_request_sense(int ctlr, int slave, u_char *buf, u_int len)
-{
- struct scsi_softc *hs = &scsi_softc[ctlr];
- static struct scsi_cdb6 cdb = { CMD_REQUEST_SENSE };
-
- cdb.len = len;
- return (scsiicmd(hs, slave, (u_char *)&cdb, sizeof(cdb),
- buf, len, DATA_IN_PHASE));
-}
-
-int
-scsi_read_capacity(int ctlr, int slave, u_char *buf, u_int len)
-{
- struct scsi_softc *hs = &scsi_softc[ctlr];
- static struct scsi_cdb10 cdb = { CMD_READ_CAPACITY };
-
- return (scsiicmd(hs, slave, (u_char *)&cdb, sizeof(cdb),
- buf, len, DATA_IN_PHASE));
-}
-
-int
-scsi_tt_read(int ctlr, int slave, u_char *buf, u_int len, daddr32_t blk,
- u_int nblk)
-{
- struct scsi_softc *hs = &scsi_softc[ctlr];
- struct scsi_cdb10 cdb;
-
- bzero(&cdb, sizeof(cdb));
- cdb.cmd = CMD_READ_EXT;
- cdb.lbah = blk >> 24;
- cdb.lbahm = blk >> 16;
- cdb.lbalm = blk >> 8;
- cdb.lbal = blk;
- cdb.lenh = nblk / (256 * DEV_BSIZE);
- cdb.lenl = nblk / DEV_BSIZE;
- return (scsiicmd(hs, slave, (u_char *)&cdb, sizeof(cdb),
- buf, len, DATA_IN_PHASE));
-}
-
-int
-scsi_tt_write(int ctlr, int slave, u_char *buf, u_int len, daddr32_t blk,
- u_int nblk)
-{
- struct scsi_softc *hs = &scsi_softc[ctlr];
- struct scsi_cdb10 cdb;
-
- bzero(&cdb, sizeof(cdb));
- cdb.cmd = CMD_WRITE_EXT;
- cdb.lbah = blk >> 24;
- cdb.lbahm = blk >> 16;
- cdb.lbalm = blk >> 8;
- cdb.lbal = blk;
- cdb.lenh = nblk / (256 * DEV_BSIZE);
- cdb.lenl = nblk / DEV_BSIZE;
- return (scsiicmd(hs, slave, (u_char *)&cdb, sizeof(cdb),
- buf, len, DATA_OUT_PHASE));
-}
diff --git a/sys/arch/hp300/stand/common/sd.c b/sys/arch/hp300/stand/common/sd.c
deleted file mode 100644
index 9af149b02d7..00000000000
--- a/sys/arch/hp300/stand/common/sd.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/* $OpenBSD: sd.c,v 1.8 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: sd.c,v 1.9 1996/12/21 21:34:41 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory and 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: sd.c 1.9 92/12/21$
- *
- * @(#)sd.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * SCSI CCS disk driver
- */
-
-#include <sys/param.h>
-#include <sys/disklabel.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "scsireg.h"
-
-struct disklabel sdlabel;
-
-struct sdminilabel {
- u_short npart;
- u_long offset[MAXPARTITIONS];
-};
-
-struct sd_softc {
- int sc_ctlr;
- int sc_unit;
- int sc_part;
- char sc_retry;
- char sc_alive;
- short sc_blkshift;
- struct sdminilabel sc_pinfo;
-} sd_softc[NSCSI][NSD];
-
-#define SDRETRY 2
-
-int sdclose(struct open_file *);
-int sdgetinfo(struct sd_softc *);
-int sdinit(int, int);
-int sdopen(struct open_file *, int, int, int);
-void sdreset(int, int);
-int sdstrategy(struct sd_softc *, int, daddr32_t, size_t, void *, size_t *);
-
-int
-sdinit(int ctlr, int unit)
-{
- struct sd_softc *ss = &sd_softc[ctlr][unit];
- u_char stat;
- int capbuf[2];
-
- stat = scsi_test_unit_rdy(ctlr, unit);
- if (stat) {
- /* drive may be doing RTZ - wait a bit */
- if (stat == STS_CHECKCOND) {
- DELAY(1000000);
- stat = scsi_test_unit_rdy(ctlr, unit);
- }
- if (stat) {
- printf("sd(%d,%d,0,0): init failed (stat=%x)\n",
- ctlr, unit, stat);
- return (0);
- }
- }
- /*
- * try to get the drive block size.
- */
- capbuf[0] = 0;
- capbuf[1] = 0;
- stat = scsi_read_capacity(ctlr, unit,
- (u_char *)capbuf, sizeof(capbuf));
- if (stat == 0) {
- if (capbuf[1] > DEV_BSIZE)
- for (; capbuf[1] > DEV_BSIZE; capbuf[1] >>= 1)
- ++ss->sc_blkshift;
- }
- ss->sc_alive = 1;
- return (1);
-}
-
-void
-sdreset(int ctlr, int unit)
-{
-}
-
-char sdio_buf[MAXBSIZE];
-
-int
-sdgetinfo(struct sd_softc *ss)
-{
- struct sdminilabel *pi = &ss->sc_pinfo;
- struct disklabel *lp = &sdlabel;
- char *msg;
- int err, savepart;
- size_t i;
-
- bzero((caddr_t)lp, sizeof *lp);
- lp->d_secsize = (DEV_BSIZE << ss->sc_blkshift);
-
- /* Disklabel is always from RAW_PART. */
- savepart = ss->sc_part;
- ss->sc_part = RAW_PART;
- err = sdstrategy(ss, F_READ, LABELSECTOR,
- lp->d_secsize ? lp->d_secsize : DEV_BSIZE, sdio_buf, &i);
- ss->sc_part = savepart;
-
- if (err) {
- printf("sdgetinfo: sdstrategy error %d\n", err);
- return(0);
- }
-
- msg = getdisklabel(sdio_buf, lp);
- if (msg) {
- printf("sd(%d,%d,%d): WARNING: %s, ",
- ss->sc_ctlr, ss->sc_unit, ss->sc_part, msg);
- printf("defining `c' partition as entire disk\n");
- pi->npart = 3;
-#ifdef CD9660_DUMMYLABEL
- pi->offset[0] = 0;
- lp->d_partitions[0].p_fstype = FS_ISO9660; /* just for kicks */
-#else
- pi->offset[0] = -1;
-#endif
- pi->offset[1] = -1;
- pi->offset[2] = 0;
- } else {
- pi->npart = lp->d_npartitions;
- for (i = 0; i < pi->npart; i++)
- pi->offset[i] = lp->d_partitions[i].p_size == 0 ?
- -1 : lp->d_partitions[i].p_offset;
- }
- return(1);
-}
-
-int
-sdopen(struct open_file *f, int ctlr, int unit, int part)
-{
- struct sd_softc *ss;
-
-#ifdef SD_DEBUG
- if (debug)
- printf("sdopen: ctlr=%d unit=%d part=%d\n",
- ctlr, unit, part);
-#endif
-
- if (ctlr >= NSCSI || scsialive(ctlr) == 0)
- return (EADAPT);
- if (unit >= NSD)
- return (ECTLR);
- ss = &sd_softc[ctlr][unit];
- ss->sc_part = part;
- ss->sc_unit = unit;
- ss->sc_ctlr = ctlr;
- if (ss->sc_alive == 0) {
- if (sdinit(ctlr, unit) == 0)
- return (ENXIO);
- if (sdgetinfo(ss) == 0)
- return (ERDLAB);
- }
- if (part != RAW_PART && /* always allow RAW_PART to be opened */
- (part >= ss->sc_pinfo.npart || ss->sc_pinfo.offset[part] == -1))
- return (EPART);
- f->f_devdata = (void *)ss;
- return (0);
-}
-
-int
-sdclose(struct open_file *f)
-{
- struct sd_softc *ss = f->f_devdata;
-
- /*
- * Mark the disk `not alive' so that the disklabel
- * will be re-loaded at next open.
- */
- bzero(ss, sizeof(sd_softc));
- f->f_devdata = NULL;
-
- return (0);
-}
-
-int
-sdstrategy(struct sd_softc *ss, int func, daddr32_t dblk, size_t size,
- void *v_buf, size_t *rsize)
-{
- char *buf = v_buf;
- int ctlr = ss->sc_ctlr;
- int unit = ss->sc_unit;
- u_int nblk = size >> ss->sc_blkshift;
- daddr32_t blk;
- char stat;
-
- if (size == 0)
- return(0);
-
- /*
- * Don't do partition translation on the `raw partition'.
- */
- blk = (dblk + ((ss->sc_part == RAW_PART) ? 0 :
- ss->sc_pinfo.offset[ss->sc_part])) >> ss->sc_blkshift;
-
- ss->sc_retry = 0;
-
-#ifdef SD_DEBUG
- if (debug)
- printf("sdstrategy(%d,%d): size=%d blk=%d nblk=%d\n",
- ctlr, unit, size, blk, nblk);
-#endif
-
-retry:
- if (func == F_READ)
- stat = scsi_tt_read(ctlr, unit, buf, size, blk, nblk);
- else
- stat = scsi_tt_write(ctlr, unit, buf, size, blk, nblk);
- if (stat) {
- printf("sd(%d,%d,%d): block=%x, error=0x%x\n",
- ctlr, unit, ss->sc_part, blk, stat);
- if (++ss->sc_retry > SDRETRY)
- return(EIO);
- goto retry;
- }
- *rsize = size;
-
- return(0);
-}
diff --git a/sys/arch/hp300/stand/common/version.c b/sys/arch/hp300/stand/common/version.c
deleted file mode 100644
index 84ffcd059cb..00000000000
--- a/sys/arch/hp300/stand/common/version.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* $OpenBSD: version.c,v 1.16 2014/02/23 19:22:40 miod Exp $ */
-
-/*
- * Record major changes in the boot code here, and increment the version
- * number.
- */
-
-/*
- * 2.0 INITIAL REVISION
- * 2.1 APCI support, config changes from NetBSD.
- * 2.2 Grand reorganization.
- * 2.3 Added CD9660 boot support.
- * 2.4 Added/fixed 425e support.
- * 2.5 Added SYS_CDBOOT.
- * 2.6 Fixed RTC reading for 2001.
- * 2.7 Minor syncs with the kernel (recognize more models and use the same
- * logic to pick the console on 425e).
- * 2.8 TurboVRX frame buffer support.
- * 2.9 SGC frame buffers support, bug fixes and code cleanup.
- * 2.10 Blind SGC support on models 362 and 382, turned out to be useless.
- * 2.11 sti@dio frame buffer support (for models 362 and 382), and various
- * cleanups.
- * 2.12 Switch to MI loadfile code.
- * 2.13 Allow kernels with uppercase characters in their names to be loaded
- * from the default boot device without an explicit device or a leading
- * `/'.
- * 2.14 Build with the ELF toolchain.
- * 2.15 Remove SLOWSCSI from scsi code, and increase target selection timeout.
- * 2.16 Loadfile support for .openbsd.randomdata section.
- * 2.17 /etc/random.seed support in uboot (SYS_UBOOT).
- */
-
-const char version[] = "2.17";
diff --git a/sys/arch/hp300/stand/include/consdefs.h b/sys/arch/hp300/stand/include/consdefs.h
deleted file mode 100644
index 2d46d88f7cc..00000000000
--- a/sys/arch/hp300/stand/include/consdefs.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $OpenBSD: consdefs.h,v 1.5 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: consdefs.h,v 1.2 1997/05/12 07:45:41 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <dev/cons.h>
-
-/*
- * Console routine prototypes.
- */
-void cninit(void);
-int cngetc(void);
-void cnputc(int);
-
-#ifdef STICONSOLE
-void stiprobe(struct consdev *);
-void stiinit(struct consdev *);
-int stigetchar(dev_t);
-void stiputchar(dev_t, int);
-#endif
-#ifdef ITECONSOLE
-void iteprobe(struct consdev *);
-void iteinit(struct consdev *);
-int itegetchar(dev_t);
-void iteputchar(dev_t, int);
-#endif
-#ifdef DCACONSOLE
-void dcaprobe(struct consdev *);
-void dcainit(struct consdev *);
-int dcagetchar(dev_t);
-void dcaputchar(dev_t, int);
-#endif
-#ifdef APCICONSOLE
-void apciprobe(struct consdev *);
-void apciinit(struct consdev *);
-int apcigetchar(dev_t);
-void apciputchar(dev_t, int);
-#endif
-#ifdef DCMCONSOLE
-void dcmprobe(struct consdev *);
-void dcminit(struct consdev *);
-int dcmgetchar(dev_t);
-void dcmputchar(dev_t, int);
-#endif
diff --git a/sys/arch/hp300/stand/include/device.h b/sys/arch/hp300/stand/include/device.h
deleted file mode 100644
index 1147efa30c2..00000000000
--- a/sys/arch/hp300/stand/include/device.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $OpenBSD: device.h,v 1.3 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: device.h,v 1.1 1997/01/30 10:31:44 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)device.h 8.1 (Berkeley) 6/10/93
- */
-
-struct hp_hw {
- caddr_t hw_kva; /* kernel virtual address of control space */
- short hw_type; /* type (defined below) */
- short hw_sc; /* select code (if applicable) */
- int hw_ctrl; /* controller number */
-};
-
-#define MAXCTLRS 16 /* Size of HW table (arbitrary) */
-
-/* controller types */
-#define C_MASK 0xF0
-#define C_HPIB 0x10
-#define C_SCSI 0x20
-/* device types (controllers with no slaves) */
-#define D_MASK 0x0F
-#define D_BITMAP 0x01
-#define D_LAN 0x02
-#define D_COMMDCM 0x03
-
-#define HW_ISHPIB(hw) (((hw)->hw_type & C_MASK) == C_HPIB)
-#define HW_ISSCSI(hw) (((hw)->hw_type & C_MASK) == C_SCSI)
-#define HW_ISDEV(hw,d) (((hw)->hw_type & D_MASK) == (d))
diff --git a/sys/arch/hp300/stand/include/grf_dvreg.h b/sys/arch/hp300/stand/include/grf_dvreg.h
deleted file mode 100644
index fe45b6b63cf..00000000000
--- a/sys/arch/hp300/stand/include/grf_dvreg.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/* $OpenBSD: grf_dvreg.h,v 1.1 2005/01/19 17:09:32 miod Exp $ */
-/* $NetBSD: grf_dvreg.h,v 1.5 1994/10/26 07:23:50 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_dvreg.h 1.5 92/01/21$
- *
- * @(#)grf_dvreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-/*
- * Map of the DaVinci frame buffer controller chip in memory ...
- */
-
-#define db_waitbusy(regaddr) \
- while (((struct dvboxfb *)(regaddr))->wbusy || \
- ((struct dvboxfb *)(regaddr))->as_busy) DELAY(100)
-
-struct rgb {
- u_char :8, :8, :8;
- vu_char red;
- u_char :8, :8, :8;
- vu_char green;
- u_char :8, :8, :8;
- vu_char blue;
-};
-
-struct dvboxfb {
- u_char :8;
- vu_char reset; /* reset register 0x01 */
- u_char fb_address; /* frame buffer address 0x02 */
- vu_char interrupt; /* interrupt register 0x03 */
- u_char :8;
- vu_char fbwmsb; /* frame buffer width MSB 0x05 */
- u_char :8;
- vu_char fbwlsb; /* frame buffer width MSB 0x07 */
- u_char :8;
- vu_char fbhmsb; /* frame buffer height MSB 0x09 */
- u_char :8;
- vu_char fbhlsb; /* frame buffer height MSB 0x0b */
- u_char :8;
- vu_char dwmsb; /* display width MSB 0x0d */
- u_char :8;
- vu_char dwlsb; /* display width MSB 0x0f */
- u_char :8;
- vu_char dhmsb; /* display height MSB 0x11 */
- u_char :8;
- vu_char dhlsb; /* display height MSB 0x13 */
- u_char :8;
- vu_char fbid; /* frame buffer id 0x15 */
- u_char f1[0x47];
- vu_char fbomsb; /* frame buffer offset MSB 0x5d */
- u_char :8;
- vu_char fbolsb; /* frame buffer offset LSB 0x5f */
- u_char f2[16359];
- vu_char wbusy; /* Window move in progress 0x4047 */
- u_char f3[0x405b-0x4047-1];
- vu_char as_busy; /* Scan accessing frame buf. 0x405B */
- u_char f4[0x4090-0x405b-1];
- vu_int fbwen; /* Frame buffer write enable 0x4090 */
- u_char f5[0x409f-0x4090-4];
- vu_char wmove; /* Initiate window move. 0x409F */
- u_char f6[0x40b3-0x409f-1];
- vu_char fold; /* Byte/longword per pixel 0x40B3 */
- u_char f7[0x40b7-0x40b3-1];
- vu_char opwen; /* Overlay plane write enable 0x40B7 */
- u_char f8[0x40bf-0x40b7-1];
- vu_char drive; /* Select FB vs. Overlay. 0x40BF */
-
- u_char f8a[0x40cb-0x40bf-1];
- vu_char zconfig; /* Z buffer configuration 0x40CB */
- u_char f8b[0x40cf-0x40cb-1];
- vu_char alt_rr; /* Alternate replacement rule 0x40CF */
- u_char f8c[0x40d3-0x40cf-1];
- vu_char zrr; /* Z replacement rule 0x40D3 */
-
- u_char f9[0x40d7-0x40d3-1];
- vu_char en_scan; /* Enable scan DTACK. 0x40D7 */
- u_char f10[0x40ef-0x40d7-1];
- vu_char rep_rule; /* Replacement rule 0x40EF */
- u_char f11[0x40f2-0x40ef-1];
- vu_short source_x; /* Window source X origin 0x40F2 */
- u_char f12[0x40f6-0x40f2-2];
- vu_short source_y; /* Window source Y origin 0x40F6 */
- u_char f13[0x40fa-0x40f6-2];
- vu_short dest_x; /* Window dest X origin 0x40FA */
- u_char f14[0x40fe -0x40fa-2];
- vu_short dest_y; /* Window dest Y origin 0x40FE */
- u_char f15[0x4102-0x40fe -2];
- vu_short wwidth; /* Window width 0x4102 */
- u_char f16[0x4106-0x4102-2];
- vu_short wheight; /* Window height 0x4106 */
- u_char f17[0x6003-0x4106-2];
- vu_char cmapbank; /* Bank select (0 or 1) 0x6003 */
- u_char f18[0x6007-0x6003-1];
- vu_char dispen; /* Display enable 0x6007 */
-
- u_char f18a[0x600B-0x6007-1];
- vu_char fbvenp; /* Frame buffer video enable 0x600B */
- u_char f18b[0x6017-0x600B-1];
- vu_char fbvens; /* fbvenp blink counterpart 0x6017 */
-
- u_char f19[0x6023-0x6017-1];
- vu_char vdrive; /* Video display mode 0x6023 */
- u_char f20[0x6083-0x6023-1];
- vu_char panxh; /* Pan display in X (high) 0x6083 */
- u_char f21[0x6087-0x6083-1];
- vu_char panxl; /* Pan display in X (low) 0x6087 */
- u_char f22[0x608b-0x6087-1];
- vu_char panyh; /* Pan display in Y (high) 0x608B */
- u_char f23[0x608f-0x608b-1];
- vu_char panyl; /* Pan display in Y (low) 0x608F */
- u_char f24[0x6093-0x608f-1];
- vu_char zoom; /* Zoom factor 0x6093 */
- u_char f25[0x6097-0x6093-1];
- vu_char pz_trig; /* Pan & zoom trigger 0x6097 */
- u_char f26[0x609b-0x6097-1];
- vu_char ovly0p; /* Overlay 0 primary map 0x609B */
- u_char f27[0x609f-0x609b-1];
- vu_char ovly1p; /* Overlay 1 primary map 0x609F */
- u_char f28[0x60a3-0x609f-1];
- vu_char ovly0s; /* Overlay 0 secondary map 0x60A3 */
- u_char f29[0x60a7-0x60a3-1];
- vu_char ovly1s; /* Overlay 1 secondary map 0x60A7 */
- u_char f30[0x60ab-0x60a7-1];
- vu_char opvenp; /* Overlay video enable 0x60AB */
- u_char f31[0x60af-0x60ab-1];
- vu_char opvens; /* Overlay blink enable 0x60AF */
- u_char f32[0x60b3-0x60af-1];
- vu_char fv_trig; /* Trigger control registers 0x60B3 */
- u_char f33[0x60b7-0x60b3-1];
- vu_char cdwidth; /* Iris cdwidth timing reg. 0x60B7 */
- u_char f34[0x60bb-0x60b7-1];
- vu_char chstart; /* Iris chstart timing reg. 0x60BB */
- u_char f35[0x60bf-0x60bb-1];
- vu_char cvwidth; /* Iris cvwidth timing reg. 0x60BF */
- u_char f36[0x6100-0x60bf-1];
- struct rgb rgb[8]; /* overlay color map */
- u_char f37[0x6403-0x6100-sizeof(struct rgb)*8];
- vu_char red0;
- u_char f38[0x6803-0x6403-1];
- vu_char green0;
- u_char f39[0x6c03-0x6803-1];
- vu_char blue0;
- u_char f40[0x7403-0x6c03-1];
- vu_char red1;
- u_char f41[0x7803-0x7403-1];
- vu_char green1;
- u_char f42[0x7c03-0x7803-1];
- vu_char blue1;
- u_char f43[0x8012-0x7c03-1];
- vu_short status1; /* Master Status register 0x8012 */
- u_char f44[0xC226-0x8012-2];
- vu_short trans; /* Transparency 0xC226 */
- u_char f45[0xC23E -0xC226-2];
- vu_short pstop; /* Pace value control 0xc23e */
-};
diff --git a/sys/arch/hp300/stand/include/grf_gbreg.h b/sys/arch/hp300/stand/include/grf_gbreg.h
deleted file mode 100644
index 7778851e58b..00000000000
--- a/sys/arch/hp300/stand/include/grf_gbreg.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $OpenBSD: grf_gbreg.h,v 1.1 2005/01/19 17:09:32 miod Exp $ */
-/* $NetBSD: grf_gbreg.h,v 1.4 1994/10/26 07:23:53 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_gbreg.h 1.11 92/01/21$
- *
- * @(#)grf_gbreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-/*
- * Gatorbox driver regs
- */
-
-#define TILER_ENABLE 0x80
-#define LINE_MOVER_ENABLE 0x80
-#define UP_LEFT 0x00
-#define DOWN_RIGHT 0x40
-#define MOVE_UP_LEFT TILER_ENABLE|UP_LEFT
-#define MOVE_DOWN_RIGHT TILER_ENABLE|DOWN_RIGHT
-
-#define tile_mover_waitbusy(regaddr) \
- while (((struct gboxfb *)(regaddr))->sec_interrupt & 0x10)
-
-#define line_mover_waitbusy(regaddr) \
- while ((((struct gboxfb *)(regaddr))->status & 0x80) == 0)
-
-#define gbcm_waitbusy(regaddr) \
- while (((struct gboxfb *)(regaddr))->cmap_busy != 0xff)
-
-struct gboxfb {
- u_char :8;
- vu_char reset; /* reset register 0x01 */
- vu_char sec_interrupt; /* Secondary interrupt register 0x03 */
- vu_char interrupt; /* interrupt register 0x03 */
- u_char :8;
- vu_char fbwmsb; /* frame buffer width MSB 0x05 */
- u_char :8;
- vu_char fbwlsb; /* frame buffer width MSB 0x07 */
- u_char :8;
- vu_char fbhmsb; /* frame buffer height MSB 0x09 */
- u_char :8;
- vu_char fbhlsb; /* frame buffer height MSB 0x0b */
- u_char :8;
- vu_char dwmsb; /* display width MSB 0x0d */
- u_char :8;
- vu_char dwlsb; /* display width MSB 0x0f */
- u_char :8;
- vu_char dhmsb; /* display height MSB 0x11 */
- u_char :8;
- vu_char dhlsb; /* display height MSB 0x13 */
- u_char :8;
- vu_char fbid; /* Scondary frame buffer id 0x15 */
- u_char f1[0x5d-0x15-1];
- vu_char fbomsb; /* frame buffer offset MSB 0x5d */
- u_char :8;
- vu_char fbolsb; /* frame buffer offset LSB 0x5f */
- u_char f2[0x4000-0x5f-1];
- vu_char crtc_address; /* CTR controller address reg 0x4000 */
- vu_char status; /* Status register 0x4001 */
- vu_char crtc_data; /* CTR controller data reg 0x4002 */
- u_char f3[6];
- vu_char line_mover_rep_rule; /* Line move rep rule */
- u_char :8, :8;
- vu_char line_mover_width; /* Line move width */
- u_char f4[0xff3];
- vu_char width; /* width in tiles 0x5001 */
- u_char :8;
- vu_char height; /* height in tiles 0x5003 */
- u_char f5[3];
- vu_char rep_rule; /* replacement rule 0x5007 */
- u_char f6[0x6001-0x5007-1];
- vu_char blink1; /* blink 1 0x6001 */
- u_char f7[3];
- vu_char blink2; /* blink 2 0x6005 */
- u_char f8[3];
- vu_char write_protect; /* write protect 0x6009 */
- u_char f9[0x6803-0x6009-1];
- vu_char cmap_busy; /* color map busy 0x6803 */
- u_char f10[0x68b9-0x6803-1];
- vu_char creg_select; /* color map register select 0x68b8 */
- u_char f11[0x68f1-0x68b9-1];
- vu_char cmap_write; /* color map write trigger 0x68f1 */
- u_char f12[0x69b3-0x68f1-1];
- vu_char cmap_red; /* red value register 0x69b3 */
- u_char :8;
- vu_char cmap_grn; /* green value register 0x69b5 */
- u_char :8;
- vu_char cmap_blu; /* blue value register 0x69b6 */
-};
diff --git a/sys/arch/hp300/stand/include/grf_hyreg.h b/sys/arch/hp300/stand/include/grf_hyreg.h
deleted file mode 100644
index 6d0ea53d2d0..00000000000
--- a/sys/arch/hp300/stand/include/grf_hyreg.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* $OpenBSD: grf_hyreg.h,v 1.1 2005/01/19 17:09:32 miod Exp $ */
-/* $NetBSD: grf_hyreg.h,v 1.2 1994/10/26 07:23:57 cgd Exp $ */
-
-/*
- * Copyright (c) 1991 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Mark Davies of the Department of Computer
- * Science, Victoria University of Wellington, New Zealand.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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_hyreg.h 1.1 92/01/22$
- *
- * @(#)grf_hyreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-struct hyboxfb {
- u_char :8;
- vu_char reset; /* reset register 0x01 */
- vu_char fb_address; /* frame buffer address 0x02 */
- vu_char interrupt; /* interrupt register 0x03 */
- u_char :8;
- vu_char fbwmsb; /* frame buffer width MSB 0x05 */
- u_char :8;
- vu_char fbwlsb; /* frame buffer width MSB 0x07 */
- u_char :8;
- vu_char fbhmsb; /* frame buffer height MSB 0x09 */
- u_char :8;
- vu_char fbhlsb; /* frame buffer height MSB 0x0b */
- u_char :8;
- vu_char dwmsb; /* display width MSB 0x0d */
- u_char :8;
- vu_char dwlsb; /* display width MSB 0x0f */
- u_char :8;
- vu_char dhmsb; /* display height MSB 0x11 */
- u_char :8;
- vu_char dhlsb; /* display height MSB 0x13 */
- u_char :8;
- vu_char fbid; /* Scondary frame buffer id 0x15 */
- u_char :8;
- vu_char bits; /* square(0)/double-high(1) 0x17 */
- u_char f1[0x5b-0x17-1];
- vu_char num_planes; /* number of color planes 0x5b */
- u_char :8;
- vu_char fbomsb; /* frame buffer offset MSB 0x5d */
- u_char :8;
- vu_char fbolsb; /* frame buffer offset LSB 0x5f */
- u_char f2[0x4000-0x5f-1];
- vu_char nblank; /* display enable planes 0x4000 */
-};
-
diff --git a/sys/arch/hp300/stand/include/grf_rbreg.h b/sys/arch/hp300/stand/include/grf_rbreg.h
deleted file mode 100644
index b868ae7b51a..00000000000
--- a/sys/arch/hp300/stand/include/grf_rbreg.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* $OpenBSD: grf_rbreg.h,v 1.2 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: grf_rbreg.h,v 1.4 1994/10/26 07:24:03 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_rbreg.h 1.9 92/01/21$
- *
- * @(#)grf_rbreg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Map of the Renaissance frame buffer controller chip in memory ...
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-#define rb_waitbusy(regaddr) \
- while (((struct rboxfb *)(regaddr))->wbusy & 0x01) DELAY(100)
-
-#define CM1RED ((struct rencm *)(ip->regbase + 0x6400))
-#define CM1GRN ((struct rencm *)(ip->regbase + 0x6800))
-#define CM1BLU ((struct rencm *)(ip->regbase + 0x6C00))
-#define CM2RED ((struct rencm *)(ip->regbase + 0x7400))
-#define CM2GRN ((struct rencm *)(ip->regbase + 0x7800))
-#define CM2BLU ((struct rencm *)(ip->regbase + 0x7C00))
-
-struct rencm {
- u_char :8, :8, :8;
- vu_char value;
-};
-
-struct rboxfb {
- u_char filler1[1];
- vu_char reset; /* reset register 0x01 */
- vu_char fb_address; /* frame buffer address 0x02 */
- vu_char interrupt; /* interrupt register 0x03 */
- u_char filler1a;
- vu_char fbwmsb; /* frame buffer width MSB 0x05 */
- u_char filler1b;
- vu_char fbwlsb; /* frame buffer width MSB 0x07 */
- u_char filler1c;
- vu_char fbhmsb; /* frame buffer height MSB 0x09 */
- u_char filler1d;
- vu_char fbhlsb; /* frame buffer height MSB 0x0b */
- u_char filler1e;
- vu_char dwmsb; /* display width MSB 0x0d */
- u_char filler1f;
- vu_char dwlsb; /* display width MSB 0x0f */
- u_char filler1g;
- vu_char dhmsb; /* display height MSB 0x11 */
- u_char filler1h;
- vu_char dhlsb; /* display height MSB 0x13 */
- u_char filler1i;
- vu_char fbid; /* frame buffer id 0x15 */
- u_char filler1j[0x47];
- vu_char fbomsb; /* frame buffer offset MSB 0x5d */
- u_char filler1k;
- vu_char fbolsb; /* frame buffer offset LSB 0x5f */
- u_char filler2[16359];
- vu_char wbusy; /* window mover is active 0x4047 */
- u_char filler3[0x405b - 0x4048];
- vu_char scanbusy; /* scan converteris active 0x405B */
- u_char filler3b[0x4083 - 0x405c];
- vu_char video_enable; /* drive vid. refresh bus 0x4083 */
- u_char filler4[3];
- vu_char display_enable; /* enable the display 0x4087 */
- u_char filler5[8];
- vu_int write_enable; /* write enable register 0x4090 */
- u_char filler6[11];
- vu_char wmove; /* start window mover 0x409f */
- u_char filler7[3];
- vu_char blink; /* blink register 0x40a3 */
- u_char filler8[15];
- vu_char fold; /* fold register 0x40b3 */
- vu_int opwen; /* overlay plane write enable 0x40b4 */
- u_char filler9[3];
- vu_char tmode; /* Tile mode size 0x40bb */
- u_char filler9a[3];
- vu_char drive; /* drive register 0x40bf */
- u_char filler10[3];
- vu_char vdrive; /* vdrive register 0x40c3 */
- u_char filler10a[0x40cb-0x40c4];
- vu_char zconfig; /* Z-buffer mode 0x40cb */
- u_char filler11a[2];
- vu_short tpatt; /* Transparency pattern 0x40ce */
- u_char filler11b[3];
- vu_char dmode; /* dither mode 0x40d3 */
- u_char filler11c[3];
- vu_char en_scan; /* enable scan board to DTACK 0x40d7 */
- u_char filler11d[0x40ef-0x40d8];
- vu_char rep_rule; /* replacement rule 0x40ef */
- u_char filler12[2];
- vu_short source_x; /* source x 0x40f2 */
- u_char filler13[2];
- vu_short source_y; /* source y 0x40f6 */
- u_char filler14[2];
- vu_short dest_x; /* dest x 0x40fa */
- u_char filler15[2];
- vu_short dest_y; /* dest y 0x40fe */
- u_char filler16[2];
- vu_short wwidth; /* window width 0x4102 */
- u_char filler17[2];
- vu_short wheight; /* window height 0x4106 */
- u_char filler18[18];
- vu_short patt_x; /* pattern x 0x411a */
- u_char filler19[2];
- vu_short patt_y; /* pattern y 0x411e */
- u_char filler20[0x8012 - 0x4120];
- vu_short te_status; /* transform engine status 0x8012 */
- u_char filler21[0x1ffff-0x8014];
-};
diff --git a/sys/arch/hp300/stand/include/grf_tcreg.h b/sys/arch/hp300/stand/include/grf_tcreg.h
deleted file mode 100644
index b08dedc079e..00000000000
--- a/sys/arch/hp300/stand/include/grf_tcreg.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* $OpenBSD: grf_tcreg.h,v 1.1 2005/01/19 17:09:32 miod Exp $ */
-/* $NetBSD: grf_tcreg.h,v 1.6 1994/10/26 07:24:06 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_tcreg.h 1.11 92/01/21$
- *
- * @(#)grf_tcreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-#define tccm_waitbusy(regaddr) \
- while (((struct tcboxfb *)(regaddr))->cmap_busy & 0x04) DELAY(100)
-
-#define tc_waitbusy(regaddr,planes) \
- while (((struct tcboxfb *)(regaddr))->busy & planes) DELAY(100)
-
-struct tcboxfb {
- u_char :8;
- vu_char reset; /* reset register 0x01 */
- vu_char fb_address; /* frame buffer address 0x02 */
- vu_char interrupt; /* interrupt register 0x03 */
- u_char :8;
- vu_char fbwmsb; /* frame buffer width MSB 0x05 */
- u_char :8;
- vu_char fbwlsb; /* frame buffer width MSB 0x07 */
- u_char :8;
- vu_char fbhmsb; /* frame buffer height MSB 0x09 */
- u_char :8;
- vu_char fbhlsb; /* frame buffer height MSB 0x0b */
- u_char :8;
- vu_char dwmsb; /* display width MSB 0x0d */
- u_char :8;
- vu_char dwlsb; /* display width MSB 0x0f */
- u_char :8;
- vu_char dhmsb; /* display height MSB 0x11 */
- u_char :8;
- vu_char dhlsb; /* display height MSB 0x13 */
- u_char :8;
- vu_char fbid; /* Scondary frame buffer id 0x15 */
- u_char :8;
- vu_char bits; /* square(0)/double-high(1) 0x17 */
- u_char f1[0x5b-0x17-1];
- vu_char num_planes; /* number of color planes 0x5b */
- u_char :8;
- vu_char fbomsb; /* frame buffer offset MSB 0x5d */
- u_char :8;
- vu_char fbolsb; /* frame buffer offset LSB 0x5f */
- u_char f2[0x4040-0x5f-1];
- vu_char vblank; /* vertical blanking 0x4040 */
- u_char :8,:8,:8;
- vu_char busy; /* window move active 0x4044 */
- u_char :8,:8,:8;
- vu_char vtrace_request; /* vert retrace intr request 0x4048 */
- u_char :8,:8,:8;
- vu_char move_request; /* window move intr request 0x404C */
- u_char f3[0x4080-0x404c-1];
- vu_char nblank; /* display enable planes 0x4080 */
- u_char f4[0x4088-0x4080-1];
- vu_char wen; /* write enable plane 0x4088 */
- u_char f5[0x408c-0x4088-1];
- vu_char ren; /* read enable plane 0x408c */
- u_char f6[0x4090-0x408c-1];
- vu_char fben; /* frame buffer write enable 0x4090 */
- u_char f7[0x409c-0x4090-1];
- vu_char wmove; /* start window move 0x409c */
- u_char f8[0x40a0-0x409c-1];
- vu_char blink; /* enable blink planes 0x40a0 */
- u_char f9[0x40a8-0x40a0-1];
- vu_char altframe; /* enable alternate frame 0x40a8 */
- u_char f10[0x40ac-0x40a8-1];
- vu_char curon; /* cursor control register 0x40ac */
- u_char f11[0x40ea-0x40ac-1];
- vu_char prr; /* pixel replacement rule 0x40ea */
- u_char f12[0x40ef-0x40ea-1];
- vu_char wmrr; /* move replacement rule 0x40ef */
- u_char f13[0x40f2-0x40ef-1];
- vu_short source_x; /* source x pixel # 0x40f2 */
- u_char f14[0x40f6-0x40f2-2];
- vu_short source_y; /* source y pixel # 0x40f6 */
- u_char f15[0x40fa-0x40f6-2];
- vu_short dest_x; /* dest x pixel # 0x40fa */
- u_char f16[0x40fe -0x40fa-2];
- vu_short dest_y; /* dest y pixel # 0x40fe */
- u_char f17[0x4102-0x40fe -2];
- vu_short wwidth; /* block mover pixel width 0x4102 */
- u_char f18[0x4106-0x4102-2];
- vu_short wheight; /* block mover pixel height 0x4106 */
- /* Catseye */
- u_char f19[0x4206-0x4106-2];
- vu_short rug_cmdstat; /* RUG Command/Staus 0x4206 */
- u_char f20[0x4510-0x4206-2];
- vu_short vb_select; /* Vector/BitBlt Select 0x4510 */
- vu_short tcntrl; /* Three Operand Control 0x4512 */
- vu_short acntrl; /* BitBlt Mode 0x4514 */
- vu_short pncntrl; /* Plane Control 0x4516 */
- u_char f21[0x4800-0x4516-2];
- vu_short catseye_status; /* Catseye Status 0x4800 */
- /* End of Catseye */
- u_char f22[0x6002-0x4800-2];
- vu_short cmap_busy; /* Color Ram busy 0x6002 */
- u_char f23[0x60b2-0x6002-2];
- vu_short rdata; /* color map red data 0x60b2 */
- vu_short gdata; /* color map green data 0x60b4 */
- vu_short bdata; /* color map blue data 0x60b6 */
- vu_short cindex; /* color map index 0x60b8 */
- vu_short plane_mask; /* plane mask select 0x60ba */
- u_char f24[0x60f0-0x60ba-2];
- vu_short strobe; /* color map trigger 0x60f0 */
-};
diff --git a/sys/arch/hp300/stand/include/hilreg.h b/sys/arch/hp300/stand/include/hilreg.h
deleted file mode 100644
index ef70853fc8d..00000000000
--- a/sys/arch/hp300/stand/include/hilreg.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/* $OpenBSD: hilreg.h,v 1.2 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: hilreg.h,v 1.6 1997/02/02 09:39:21 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: hilreg.h 1.10 92/01/21$
- *
- * @(#)hilreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-struct hil_dev {
- char hil_pad0;
- vu_char hil_data;
- char hil_pad1;
- vu_char hil_cmd;
-#define hil_stat hil_cmd
-};
-
-#define HILADDR ((struct hil_dev *)IIOV(0x428000))
-
-#define READHILDATA(x) ((x)->hil_data)
-#define READHILSTAT(x) ((x)->hil_stat)
-#define READHILCMD(x) ((x)->hil_cmd)
-#define WRITEHILDATA(x, y) ((x)->hil_data = (y))
-#define WRITEHILSTAT(x, y) ((x)->hil_stat = (y))
-#define WRITEHILCMD(x, y) ((x)->hil_cmd = (y))
-
-#define HIL_BUSY 0x02
-#define HIL_DATA_RDY 0x01
-
-#define HILWAIT(hil_dev) while ((READHILSTAT(hil_dev) & HIL_BUSY))
-#define HILDATAWAIT(hil_dev) while (!(READHILSTAT(hil_dev) & HIL_DATA_RDY))
-
-/* HIL status bits */
-#define HIL_POLLDATA 0x10 /* HIL poll data follows */
-#define HIL_COMMAND 0x08 /* Start of original command */
-#define HIL_ERROR 0x080 /* HIL error */
-#define HIL_RECONFIG 0x080 /* HIL has reconfigured */
-#define HIL_STATMASK (HIL_DATA | HIL_COMMAND)
-
-#define HIL_SSHIFT 4 /* Bits to shift status over */
-#define HIL_SMASK 0xF /* Service request status mask */
-#define HIL_DEVMASK 0x07
-
-/* HIL status types */
-#define HIL_STATUS 0x5 /* HIL status in data register */
-#define HIL_DATA 0x6 /* HIL data in data register */
-#define HIL_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */
-#define HIL_CTRL 0x9 /* key + CTRL */
-#define HIL_SHIFT 0xA /* key + SHIFT */
-#define HIL_KEY 0xB /* key only */
-#define HIL_68K 0x4 /* Data from the 68k is ready */
-
-/* HIL commands */
-#define HIL_SETARD 0xA0 /* set auto-repeat delay */
-#define HIL_SETARR 0xA2 /* set auto-repeat rate */
-#define HIL_SETTONE 0xA3 /* set tone generator */
-#define HIL_CNMT 0xB2 /* clear nmi */
-#define HIL_INTON 0x5C /* Turn on interrupts. */
-#define HIL_INTOFF 0x5D /* Turn off interrupts. */
-#define HIL_TRIGGER 0xC5 /* trigger command */
-#define HIL_STARTCMD 0xE0 /* start loop command */
-#define HIL_TIMEOUT 0xFE /* timeout */
-#define HIL_READTIME 0x13 /* Read real time register */
-
-/* Read/write various registers on the 8042. */
-#define HIL_READBUSY 0x02 /* internal "busy" register */
-#define HIL_READKBDLANG 0x12 /* read keyboard language code */
-#define HIL_READKBDSADR 0xF9
-#define HIL_WRITEKBDSADR 0xE9
-#define HIL_READLPSTAT 0xFA
-#define HIL_WRITELPSTAT 0xEA
-#define HIL_READLPCTRL 0xFB
-#define HIL_WRITELPCTRL 0xEB
-
-/* BUSY bits */
-#define BSY_LOOPBUSY 0x04
-
-/* LPCTRL bits */
-#define LPC_AUTOPOLL 0x01 /* enable auto-polling */
-#define LPC_NOERROR 0x02 /* don't report errors */
-#define LPC_NORECONF 0x04 /* don't report reconfigure */
-#define LPC_KBDCOOK 0x10 /* cook all keyboards */
-#define LPC_RECONF 0x80 /* reconfigure the loop */
-
-/* LPSTAT bits */
-#define LPS_DEVMASK 0x07 /* number of loop devices */
-#define LPS_CONFGOOD 0x08 /* reconfiguration worked */
-#define LPS_CONFFAIL 0x80 /* reconfiguration failed */
-
-/* HIL packet headers */
-#define HIL_MOUSEDATA 0x2
-#define HIL_KBDDATA 0x40
-
-#define HIL_MOUSEMOTION 0x02 /* mouse movement event */
-#define HIL_KBDBUTTON 0x40 /* keyboard button event */
-#define HIL_MOUSEBUTTON 0x40 /* mouse button event */
-#define HIL_BUTTONBOX 0x60 /* button box event */
-#define HIL_TABLET 0x02 /* tablet motion event */
-#define HIL_KNOBBOX 0x03 /* knob box motion data */
-
-/* For setting auto repeat on the keyboard */
-#define ar_format(x) ~((x - 10) / 10)
-#define KBD_ARD 400 /* initial delay in msec (10 - 2560) */
-#define KBD_ARR 60 /* rate (10 - 2550 msec, 2551 == off) */
-
-/* Magic */
-#define KBDNMISTAT ((volatile char *)IIOV(0x478005))
-#define KBDNMI 0x04
-
-/* keyboard status */
-#define KBD_CHARMASK 0x7F
-#define KBD_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */
-#define KBD_CTRL 0x9 /* key + CTRL */
-#define KBD_SHIFT 0xA /* key + SHIFT */
-#define KBD_KEY 0xB /* key only */
-
diff --git a/sys/arch/hp300/stand/include/hpibvar.h b/sys/arch/hp300/stand/include/hpibvar.h
deleted file mode 100644
index a083db26667..00000000000
--- a/sys/arch/hp300/stand/include/hpibvar.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* $OpenBSD: hpibvar.h,v 1.4 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: hpibvar.h,v 1.4 1994/10/26 07:27:24 cgd Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)hpibvar.h 8.1 (Berkeley) 6/10/93
- */
-
-#define HPIBA 32
-#define HPIBB 1
-#define HPIBC 8
-#define HPIBA_BA 21
-#define HPIBC_BA 30
-
-#define CSA_BA 0x1F
-
-#define C_DCL 20
-#define C_LAG 32
-#define C_UNL 63
-#define C_TAG 64
-#define C_UNA 94
-#define C_UNT 95
-#define C_SCG 96
-
-struct hpib_softc {
- char sc_alive;
- char sc_type;
- int sc_ba;
- char *sc_addr;
-};
-
-extern struct hpib_softc hpib_softc[];
-
-/*
- * Description structure for CS/80 devices.
- */
-
-struct cs80_describe {
- u_int d_iuw:16, /* controller: installed unit word */
- d_cmaxxfr:16, /* controller: max transfer rate (Kb) */
- d_ctype:8, /* controller: controller type */
- d_utype:8, /* unit: unit type */
- d_name:24, /* unit: name (6 BCD digits) */
- d_sectsize:16, /* unit: # of bytes per block (sector) */
- d_blkbuf:8, /* unit: # of blocks which can be buffered */
- d_burstsize:8, /* unit: recommended burst size */
- d_blocktime:16, /* unit: block time (u-sec) */
- d_uavexfr:16, /* unit: average transfer rate (Kb) */
- d_retry:16, /* unit: optimal retry time (1/100-sec) */
- d_access:16, /* unit: access time param (1/100-sec) */
- d_maxint:8, /* unit: maximum interleave */
- d_fvbyte:8, /* unit: fixed volume byte */
- d_rvbyte:8, /* unit: removable volume byte */
- d_maxcyl:24, /* volume: maximum cylinder */
- d_maxhead:8, /* volume: maximum head */
- d_maxsect:16, /* volume: maximum sector on track */
- d_maxvsecth:16, /* volume: maximum sector on volume (MSW) */
- d_maxvsectl:32, /* volume: maximum sector on volume (LSWs) */
- d_interleave:8; /* volume: current interleave */
-} __packed;
-
-int hpibalive(int);
-void hpibgo(int, int, int, void *, int, int);
-int hpibid(int, int);
-int hpibrecv(int, int, int, void *, int);
-int hpibsend(int, int, int, void *, int);
-int hpibswait(int, int);
-
-int fhpibinit(int);
-int fhpibppoll(int);
-int fhpibrecv(int, int, int, char *, int);
-int fhpibsend(int, int, int, char *, int);
-int nhpibinit(int);
-int nhpibppoll(int);
-int nhpibrecv(int, int, int, char *, int);
-int nhpibsend(int, int, int, char *, int);
diff --git a/sys/arch/hp300/stand/include/if_lereg.h b/sys/arch/hp300/stand/include/if_lereg.h
deleted file mode 100644
index 56341370c0a..00000000000
--- a/sys/arch/hp300/stand/include/if_lereg.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $OpenBSD: if_lereg.h,v 1.3 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: if_lereg.h,v 1.1 1996/01/01 18:10:56 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 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.
- *
- * @(#)if_lereg.h 7.1 (Berkeley) 5/8/90
- */
-
-#define LEID 21
-
-#define NTBUF 2
-#define TLEN 1
-#define NRBUF 8
-#define RLEN 3
-#define BUFSIZE 1518
-
-#define vu_char volatile u_char
-#define vu_short volatile u_short
-
-/*
- * LANCE registers.
- */
-struct lereg0 {
- u_char ler0_pad0;
- vu_char ler0_id; /* ID */
- u_char ler0_pad1;
- vu_char ler0_status; /* interrupt enable/status */
-};
-
-/*
- * Control and status bits -- lereg0
- */
-#define LE_IE 0x80 /* interrupt enable */
-#define LE_IR 0x40 /* interrupt requested */
-#define LE_LOCK 0x08 /* lock status register */
-#define LE_ACK 0x04 /* ack of lock */
-#define LE_JAB 0x02 /* loss of tx clock (???) */
-#define LE_IPL(x) ((((x) >> 4) & 0x3) + 3)
-
-struct lereg1 {
- vu_short ler1_rdp; /* data port */
- vu_short ler1_rap; /* register select port */
-};
-
-/*
- * Control and status bits -- lereg1
- */
-#define LE_SERR 0x8000
-#define LE_BABL 0x4000
-#define LE_CERR 0x2000
-#define LE_MISS 0x1000
-#define LE_MERR 0x0800
-#define LE_RINT 0x0400
-#define LE_TINT 0x0200
-#define LE_IDON 0x0100
-#define LE_INTR 0x0080
-#define LE_INEA 0x0040
-#define LE_RXON 0x0020
-#define LE_TXON 0x0010
-#define LE_TDMD 0x0008
-#define LE_STOP 0x0004
-#define LE_STRT 0x0002
-#define LE_INIT 0x0001
-
-#define LE_BSWP 0x0004
-#define LE_ACON 0x0002
-#define LE_BCON 0x0001
-
-/*
- * Overlayed on 16K dual-port RAM.
- * Current size is 15,284 bytes with 8 x 1518 receive buffers and
- * 2 x 1518 transmit buffers.
- */
-
-/*
- * LANCE initialization block
- */
-struct init_block {
- u_short mode; /* mode register */
- u_char padr[6]; /* ethernet address */
- u_long ladrf[2]; /* logical address filter (multicast) */
- u_short rdra; /* low order pointer to receive ring */
- u_short rlen; /* high order pointer and no. rings */
- u_short tdra; /* low order pointer to transmit ring */
- u_short tlen; /* high order pointer and no rings */
-};
-
-/*
- * Mode bits -- init_block
- */
-#define LE_PROM 0x8000 /* promiscuous */
-#define LE_INTL 0x0040 /* internal loopback */
-#define LE_DRTY 0x0020 /* disable retry */
-#define LE_COLL 0x0010 /* force collision */
-#define LE_DTCR 0x0008 /* disable transmit crc */
-#define LE_LOOP 0x0004 /* loopback */
-#define LE_DTX 0x0002 /* disable transmitter */
-#define LE_DRX 0x0001 /* disable receiver */
-#define LE_NORMAL 0x0000
-
-/*
- * Message descriptor
- */
-struct mds {
- u_short addr;
- u_short flags;
- u_short bcnt;
- u_short mcnt;
-};
-
-/* Message descriptor flags */
-#define LE_OWN 0x8000 /* owner bit, 0=host, 1=LANCE */
-#define LE_ERR 0x4000 /* error */
-#define LE_STP 0x0200 /* start of packet */
-#define LE_ENP 0x0100 /* end of packet */
-
-/* Receive ring status flags */
-#define LE_FRAM 0x2000 /* framing error error */
-#define LE_OFLO 0x1000 /* silo overflow */
-#define LE_CRC 0x0800 /* CRC error */
-#define LE_RBUFF 0x0400 /* buffer error */
-
-/* Transmit ring status flags */
-#define LE_MORE 0x1000 /* more than 1 retry */
-#define LE_ONE 0x0800 /* one retry */
-#define LE_DEF 0x0400 /* deferred transmit */
-
-/* Transmit errors */
-#define LE_TBUFF 0x8000 /* buffer error */
-#define LE_UFLO 0x4000 /* silo underflow */
-#define LE_LCOL 0x1000 /* late collision */
-#define LE_LCAR 0x0800 /* loss of carrier */
-#define LE_RTRY 0x0400 /* tried 16 times */
diff --git a/sys/arch/hp300/stand/include/itereg.h b/sys/arch/hp300/stand/include/itereg.h
deleted file mode 100644
index c4566e0292e..00000000000
--- a/sys/arch/hp300/stand/include/itereg.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $OpenBSD: itereg.h,v 1.2 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: itereg.h,v 1.5 1994/10/26 07:24:39 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: itereg.h 1.3 92/01/21$
- *
- * @(#)itereg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Offsets into the display ROM that is part of the first 4K of each
- * display device.
- */
-#define FONTROM 0x3B /* Offset of font information structure. */
-#define FONTADDR 0x4 /* Offset from FONTROM to font address. */
-#define FONTHEIGHT 0x0 /* Offset from font address to font height. */
-#define FONTWIDTH 0x2 /* Offset from font address to font width. */
-#define FONTDATA 0xA /* Offset from font address to font glyphs. */
-
-#define FBBASE ((volatile u_char *)ip->fbbase)
diff --git a/sys/arch/hp300/stand/include/itevar.h b/sys/arch/hp300/stand/include/itevar.h
deleted file mode 100644
index 12c46c0f330..00000000000
--- a/sys/arch/hp300/stand/include/itevar.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $OpenBSD: itevar.h,v 1.6 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: itevar.h,v 1.1 1996/03/03 04:23:42 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: itevar.h 1.15 92/12/20$
- *
- * @(#)itevar.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Standalone version of hp300 ITE.
- */
-
-struct ite_data;
-
-typedef void (*ite_windowmover)(struct ite_data *, int, int, int, int, int,
- int, int);
-
-struct ite_data {
- int alive;
- int scode; /* DIO select code or SGC slot # */
- struct itesw *isw;
- caddr_t regbase, fbbase;
- short curx, cury;
- short cursorx, cursory;
- short cblankx, cblanky;
- short rows, cols;
- short cpl;
- short dheight, dwidth;
- short fbheight, fbwidth;
- short ftheight, ftwidth;
- short fontx, fonty;
- short planemask;
- ite_windowmover bmv;
-};
-
-struct itesw {
- int ite_hwid;
- int (*ite_probe)(struct ite_data *);
- void (*ite_init)(struct ite_data *);
- void (*ite_clear)(struct ite_data *, int, int, int, int);
- void (*ite_putc)(struct ite_data *, int, int, int);
- void (*ite_cursor)(struct ite_data *, int);
- void (*ite_scroll)(struct ite_data *);
-};
-
-/*
- * X and Y location of character 'c' in the framebuffer, in pixels.
- */
-#define charX(ip,c) \
- (((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx)
-
-#define charX1bpp(ip,c) \
- (((c) % (ip)->cpl) * ((((ip)->ftwidth + 7) / 8) * 8) + (ip)->fontx)
-
-#define charY(ip,c) \
- (((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty)
-
-/* Replacement Rules */
-#define RR_CLEAR 0x0
-#define RR_COPY 0x3
-#define RR_XOR 0x6
-#define RR_COPYINVERTED 0xc
-
-#define DRAW_CURSOR 0x00
-#define ERASE_CURSOR 0x01
-#define MOVE_CURSOR 0x02
-
-extern struct ite_data ite_data[];
-extern struct itesw itesw[];
-extern int nitesw;
-
-/*
- * Prototypes.
- */
-void ite_fontinfo(struct ite_data *);
-void ite_fontinit1bpp(struct ite_data *);
-void ite_fontinit8bpp(struct ite_data *);
-void ite_dio_clear(struct ite_data *, int, int, int, int);
-void ite_dio_cursor(struct ite_data *, int);
-void ite_dio_putc1bpp(struct ite_data *, int, int, int);
-void ite_dio_putc8bpp(struct ite_data *, int, int, int);
-void ite_dio_scroll(struct ite_data *);
-void ite_dio_windowmove1bpp(struct ite_data *, int, int, int, int,
- int, int, int);
-
-/*
- * Framebuffer-specific ITE prototypes.
- */
-void topcat_init(struct ite_data *);
-void gbox_init(struct ite_data *);
-void gbox_scroll(struct ite_data *);
-void rbox_init(struct ite_data *);
-void dvbox_init(struct ite_data *);
-void hyper_init(struct ite_data *);
-void tvrx_init(struct ite_data *);
-
-int sti_dio_probe(struct ite_data *);
-void sti_iteinit_dio(struct ite_data *);
-void sti_iteinit_sgc(struct ite_data *);
-void sti_clear(struct ite_data *, int, int, int, int);
-void sti_putc(struct ite_data *, int, int, int);
-void sti_cursor(struct ite_data *, int);
-void sti_scroll(struct ite_data *);
diff --git a/sys/arch/hp300/stand/include/kbdvar.h b/sys/arch/hp300/stand/include/kbdvar.h
deleted file mode 100644
index a21e7cd5ae0..00000000000
--- a/sys/arch/hp300/stand/include/kbdvar.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $OpenBSD: kbdvar.h,v 1.5 2008/06/26 05:42:10 ray Exp $ */
-/* $NetBSD: kbdvar.h,v 1.1 1997/04/14 19:00:13 thorpej Exp $ */
-
-/*-
- * Copyright (c) 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 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.
- */
-
-/*
- * Structure definitions and prototypes for the indirect keyboard driver
- * for standalone ITE.
- */
-
-struct kbdsw {
- int (*k_getc)(void); /* get character */
- void (*k_nmi)(void); /* handle non-maskable interrupt */
- int (*k_init)(void); /* probe/initialize keyboard */
-};
-
-#ifdef ITECONSOLE
-
-extern struct kbdsw kbdsw[];
-
-int kbdgetc(void);
-void kbdinit(void);
-void kbdnmi(void);
-
-#ifdef HIL_KEYBOARD
-int hilkbd_getc(void);
-int hilkbd_init(void);
-void hilkbd_nmi(void);
-#endif
-
-#ifdef DOMAIN_KEYBOARD
-int dnkbd_getc(void);
-int dnkbd_init(void);
-void dnkbd_nmi(void);
-#endif
-#endif /* ITECONSOLE */
diff --git a/sys/arch/hp300/stand/include/maskbits.h b/sys/arch/hp300/stand/include/maskbits.h
deleted file mode 100644
index 4cd160a7645..00000000000
--- a/sys/arch/hp300/stand/include/maskbits.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* $OpenBSD: maskbits.h,v 1.1 2006/08/05 09:58:57 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.
-
-starttab[n]
- bits[0,n-1] = 0 bits[n,31] = 1
-endtab[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 = starttab[(x) & 0x1f]; \
- endmask = endtab[((x) + (w)) & 0x1f]; \
- if (startmask) \
- nlw = (((w) - (32 - ((x) & 0x1f))) >> 5); \
- else \
- nlw = (w) >> 5; \
-} while (0)
-
-#define FASTGETBITS(psrc, x, w, dst) \
- asm ("bfextu %3{%1:%2},%0" \
- : "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc)))
-
-#define FASTPUTBITS(src, x, w, pdst) \
- asm ("bfins %3,%0{%1:%2}" \
- : "=o" (*(char *)(pdst)) \
- : "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst)))
-
-#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \
-do { \
- unsigned int _tmpsrc, _tmpdst; \
- FASTGETBITS(pdst, dstbit, width, _tmpdst); \
- FASTGETBITS(psrc, srcbit, width, _tmpsrc); \
- DoRop(_tmpdst, rop, _tmpsrc, _tmpdst); \
- FASTPUTBITS(_tmpdst, dstbit, width, pdst); \
-} while (0)
-
-#define getandputrop0(psrc, srcbit, width, pdst, rop) \
- getandputrop(psrc, srcbit, 0, width, pdst, rop)
-
-#define getunalignedword(psrc, x, dst) \
-do { \
- int _tmp; \
- FASTGETBITS(psrc, x, 32, _tmp); \
- dst = _tmp; \
-} while (0)
-
-#define fnCLEAR(src, dst) (0)
-#define fnCOPY(src, dst) (src)
-#define fnXOR(src, dst) ((src) ^ (dst))
-#define fnCOPYINVERTED(src, dst) (~(src))
-
-#define DoRop(result, alu, src, dst) \
-do { \
- switch (alu) { \
- case RR_CLEAR: \
- default: \
- result = fnCLEAR(src, dst); \
- break; \
- case RR_COPY: \
- result = fnCOPY(src, dst); \
- break; \
- case RR_XOR: \
- result = fnXOR(src, dst); \
- break; \
- case RR_COPYINVERTED: \
- result = fnCOPYINVERTED(src, dst); \
- break; \
- } \
-} while (0)
diff --git a/sys/arch/hp300/stand/include/rominfo.h b/sys/arch/hp300/stand/include/rominfo.h
deleted file mode 100644
index c7a824e3a96..00000000000
--- a/sys/arch/hp300/stand/include/rominfo.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $OpenBSD: rominfo.h,v 1.3 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: rominfo.h,v 1.5 1994/10/26 07:27:53 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: rominfo.h 1.2 88/05/24$
- *
- * @(#)rominfo.h 8.1 (Berkeley) 6/10/93
- */
-
-#define ROMADDR 0xFFFFF000
-
-struct jmpvec {
- short op; /* jmp instruction */
- long addr; /* address */
-} __packed;
-
-struct rominfo {
- char p1[0xDC0];
- short boottype; /* ?? (FFFFFDC0) */
- char name[10]; /* HP system name, e.g. SYSHPUX (FFFFFDC2) */
- short p2; /* ?? (FFFFFDCC) */
- long lowram; /* lowest useable RAM location (FFFFFDCE) */
- char p3[0x100]; /* ?? (FFFFFDD2) */
- char sysflag; /* HP system flags (FFFFFED2) */
- char p4; /* ?? (FFFFFED3) */
- long rambase; /* physaddr of lowest RAM (FFFFFED4) */
- char ndrives; /* number of drives (FFFFFED8) */
- char p5; /* ?? (FFFFFED9) */
- char sysflag2; /* more system flags (FFFFFEDA) */
- char p6; /* ?? (FFFFFEDB) */
- long msus; /* ?? (FFFFFEDC) */
- struct jmpvec jvec[48]; /* jump vectors (FFFFFEE0) */
-} __packed;
diff --git a/sys/arch/hp300/stand/include/samachdep.h b/sys/arch/hp300/stand/include/samachdep.h
deleted file mode 100644
index 6463bae7706..00000000000
--- a/sys/arch/hp300/stand/include/samachdep.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* $OpenBSD: samachdep.h,v 1.9 2013/04/01 12:55:27 miod Exp $ */
-/* $NetBSD: samachdep.h,v 1.3 1997/05/12 07:54:45 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)samachdep.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/types.h>
-#include <machine/hp300spu.h>
-
-#define NHPIB 4
-#define NSCSI 2
-#define NHD 8
-#define NCT 8
-#define NSD 8
-
-#define NITE 4
-
-/* from cpu.h */
-#define INTIOBASE (0x00400000)
-#define IIOV(x) (x)
-
-#define MHZ_8 1
-#define MHZ_16 2
-#define MHZ_25 3
-#define MHZ_33 4
-#define MHZ_50 6
-
-extern int cpuspeed, machineid, mmuid;
-extern int howto;
-extern u_int opendev;
-extern u_int bootdev;
-extern int userom;
-
-int badaddr(char *);
-void call_req_reboot(void);
-void exec(char *, void *, int);
-char *getmachineid(void);
-void hpibinit(void);
-void romout(int, char *);
-void romputchar(int);
-void scsiinit(void);
-u_long sctoaddr(int);
-int tgets(char *);
-
-#define DELAY(n) { int N = cpuspeed * (n); while (--N > 0); }
-
-/*
- * Switch we use to set punit in devopen.
- */
-struct punitsw {
- int (*p_punit)(int, int, int *);
-};
-extern struct punitsw punitsw[];
-
-extern struct fs_ops file_system_rawfs[];
-extern struct fs_ops file_system_ufs[];
-extern struct fs_ops file_system_nfs[];
-extern struct fs_ops file_system_cd9660[];
diff --git a/sys/arch/hp300/stand/include/scsireg.h b/sys/arch/hp300/stand/include/scsireg.h
deleted file mode 100644
index 708bcd32c97..00000000000
--- a/sys/arch/hp300/stand/include/scsireg.h
+++ /dev/null
@@ -1,483 +0,0 @@
-/* $OpenBSD: scsireg.h,v 1.4 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: scsireg.h,v 1.4 1994/10/26 07:24:59 cgd Exp $ */
-
-/*
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of 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.
- *
- * @(#)scsireg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * HP 98265A SCSI Interface Hardware Description.
- */
-
-struct scsidevice {
- u_char p0, scsi_id;
-#define ID_MASK 0x1f
-#define SCSI_ID 0x07
-#define ID_WORD_DMA 0x20
- u_char p2, scsi_csr;
-#define CSR_IE 0x80
-#define CSR_IR 0x40
-#define SCSI_IPL(csr) ((((csr)>>4)&3)+3)
-#define CSR_DMA32 0x08
-#define CSR_DMAIN 0x04
-#define CSR_DE1 0x02
-#define CSR_DE0 0x01
- u_char p4, scsi_wrap;
-#define WRAP_REQ 0x80
-#define WRAP_ACK 0x40
-#define WRAP_BSY 0x08
-#define WRAP_MSG 0x04
-#define WRAP_CD 0x02
-#define WRAP_IO 0x01
- u_char p6, scsi_hconf;
-#define HCONF_TP 0x80
-#define SCSI_SYNC_XFER(hconf) (((hconf)>>5)&3)
-#define HCONF_SD 0x10
-#define HCONF_PARITY 0x08
- u_char p8[24];
- u_char p32, scsi_bdid;
- u_char p34, scsi_sctl;
-#define SCTL_DISABLE 0x80
-#define SCTL_CTRLRST 0x40
-#define SCTL_DIAG 0x20
-#define SCTL_ABRT_ENAB 0x10
-#define SCTL_PARITY_ENAB 0x08
-#define SCTL_SEL_ENAB 0x04
-#define SCTL_RESEL_ENAB 0x02
-#define SCTL_INTR_ENAB 0x01
- u_char p36, scsi_scmd;
-#define SCMD_RST 0x10
-#define SCMD_ICPT_XFR 0x08
-#define SCMD_PROG_XFR 0x04
-#define SCMD_PAD 0x01 /* if initiator */
-#define SCMD_PERR_STOP 0x01 /* if target */
- /* command codes */
-#define SCMD_BUS_REL 0x00
-#define SCMD_SELECT 0x20
-#define SCMD_RST_ATN 0x40
-#define SCMD_SET_ATN 0x60
-#define SCMD_XFR 0x80
-#define SCMD_XFR_PAUSE 0xa0
-#define SCMD_RST_ACK 0xc0
-#define SCMD_SET_ACK 0xe0
- u_char p38, scsi_tmod;
-#define TMOD_SYNC 0x80
- u_char p40, scsi_ints;
-#define INTS_SEL 0x80
-#define INTS_RESEL 0x40
-#define INTS_DISCON 0x20
-#define INTS_CMD_DONE 0x10
-#define INTS_SRV_REQ 0x08
-#define INTS_TIMEOUT 0x04
-#define INTS_HARD_ERR 0x02
-#define INTS_RST 0x01
- u_char p42, scsi_psns;
-#define PSNS_REQ 0x80
-#define PSNS_ACK 0x40
-#define PSNS_ATN 0x20
-#define PSNS_SEL 0x10
-#define PSNS_BSY 0x08
- u_char p44, scsi_ssts;
-#define SSTS_INITIATOR 0x80
-#define SSTS_TARGET 0x40
-#define SSTS_BUSY 0x20
-#define SSTS_XFR 0x10
-#define SSTS_ACTIVE (SSTS_INITIATOR|SSTS_XFR)
-#define SSTS_RST 0x08
-#define SSTS_TCZERO 0x04
-#define SSTS_DREG_FULL 0x02
-#define SSTS_DREG_EMPTY 0x01
- u_char p46, scsi_serr;
-#define SERR_SCSI_PAR 0x80
-#define SERR_SPC_PAR 0x40
-#define SERR_TC_PAR 0x08
-#define SERR_PHASE_ERR 0x04
-#define SERR_SHORT_XFR 0x02
-#define SERR_OFFSET 0x01
- u_char p48, scsi_pctl;
-#define PCTL_BFINT_ENAB 0x80
- u_char p50, scsi_mbc;
- u_char p52, scsi_dreg;
- u_char p54, scsi_temp;
- u_char p56, scsi_tch;
- u_char p58, scsi_tcm;
- u_char p60, scsi_tcl;
- u_char p62, scsi_exbf;
-};
-
-/* psns/pctl phase lines as bits */
-#define PHASE_MSG 0x04
-#define PHASE_CD 0x02 /* =1 if 'command' */
-#define PHASE_IO 0x01 /* =1 if data inbound */
-/* Phase lines as values */
-#define PHASE 0x07 /* mask for psns/pctl phase */
-#define DATA_OUT_PHASE 0x00
-#define DATA_IN_PHASE 0x01
-#define CMD_PHASE 0x02
-#define STATUS_PHASE 0x03
-#define BUS_FREE_PHASE 0x04
-#define ARB_SEL_PHASE 0x05 /* Fuji chip combines arbitration with sel. */
-#define MESG_OUT_PHASE 0x06
-#define MESG_IN_PHASE 0x07
-
-/* SCSI Messages */
-
-#define MSG_CMD_COMPLETE 0x00
-#define MSG_EXT_MESSAGE 0x01
-#define MSG_SAVE_DATA_PTR 0x02
-#define MSG_RESTORE_PTR 0x03
-#define MSG_DISCONNECT 0x04
-#define MSG_INIT_DETECT_ERROR 0x05
-#define MSG_ABORT 0x06
-#define MSG_REJECT 0x07
-#define MSG_NOOP 0x08
-#define MSG_PARITY_ERROR 0x09
-#define MSG_BUS_DEVICE_RESET 0x0C
-#define MSG_IDENTIFY 0x80
-#define MSG_IDENTIFY_DR 0xc0 /* (disconnect/reconnect allowed) */
-#define MSG_SYNC_REQ 0x01
-
-/* SCSI Commands */
-
-#define CMD_TEST_UNIT_READY 0x00
-#define CMD_REQUEST_SENSE 0x03
-#define CMD_INQUIRY 0x12
-#define CMD_SEND_DIAGNOSTIC 0x1D
-
-#define CMD_REWIND 0x01
-#define CMD_REZERO 0x01
-#define CMD_FORMAT_UNIT 0x04
-#define CMD_READ_BLOCK_LIMITS 0x05
-#define CMD_REASSIGN_BLOCKS 0x07
-#define CMD_READ 0x08
-#define CMD_WRITE 0x0A
-#define CMD_WRITE_FILEMARK 0x10
-#define CMD_SPACE 0x11
-#define CMD_MODE_SELECT 0x15
-#define CMD_RELEASE_UNIT 0x17
-#define CMD_ERASE 0x19
-#define CMD_MODE_SENSE 0x1A
-#define CMD_LOADUNLOAD 0x1B
-#define CMD_RECEIVE_DIAG 0x1C
-#define CMD_SEND_DIAG 0x1D
-#define CMD_P_A_MEDIA_REMOVAL 0x1E
-#define CMD_READ_CAPACITY 0x25
-#define CMD_READ_EXT 0x28
-#define CMD_WRITE_EXT 0x2A
-#define CMD_READ_DEFECT_DATA 0x37
-#define SD_MANUFAC_DEFECTS 0x14000000
-#define SD_GROWN_DEFECTS 0x0c000000
-#define CMD_READ_BUFFER 0x3B
-#define CMD_WRITE_BUFFER 0x3C
-#define CMD_READ_FULL 0xF0
-#define CMD_MEDIA_TEST 0xF1
-#define CMD_ACCESS_LOG 0xF2
-#define CMD_WRITE_FULL 0xFC
-#define CMD_MANAGE_PRIMARY 0xFD
-#define CMD_EXECUTE_DATA 0xFE
-
-/* SCSI status bits */
-
-#define STS_CHECKCOND 0x02 /* Check Condition (ie., read sense) */
-#define STS_CONDMET 0x04 /* Condition Met (ie., search worked) */
-#define STS_BUSY 0x08
-#define STS_INTERMED 0x10 /* Intermediate status sent */
-#define STS_EXT 0x80 /* Extended status valid */
-
-/* command descriptor blocks */
-
-struct scsi_cdb6 {
- u_char cmd; /* command code */
- u_char lun: 3, /* logical unit on ctlr */
- lbah: 5; /* msb of read/write logical block addr */
- u_char lbam; /* middle byte of l.b.a. */
- u_char lbal; /* lsb of l.b.a. */
- u_char len; /* transfer length */
- u_char xtra;
-};
-
-struct scsi_cdb10 {
- u_char cmd; /* command code */
- u_char lun: 3, /* logical unit on ctlr */
- : 4,
- rel: 1; /* l.b.a. is relative addr if =1 */
- u_char lbah; /* msb of read/write logical block addr */
- u_char lbahm; /* high middle byte of l.b.a. */
- u_char lbalm; /* low middle byte of l.b.a. */
- u_char lbal; /* lsb of l.b.a. */
- u_char reserved;
- u_char lenh; /* msb transfer length */
- u_char lenl; /* lsb transfer length */
- u_char xtra;
-};
-
-/* basic sense data */
-
-struct scsi_sense {
- u_char valid: 1, /* l.b.a. is valid */
- class: 3,
- code: 4;
- u_char vu: 4, /* vendor unique */
- lbah: 4;
- u_char lbam;
- u_char lbal;
-};
-
-struct scsi_xsense {
- u_char valid: 1, /* l.b.a. is valid */
- class: 3,
- code: 4;
- u_char segment;
- u_char filemark: 1,
- eom: 1,
- ili: 1, /* illegal length indicator */
- rsvd: 1,
- key: 4;
- u_char info1;
- u_char info2;
- u_char info3;
- u_char info4;
- u_char len; /* additional sense length */
-};
-
-/* inquiry data */
-struct scsi_inquiry {
- u_char type;
- u_char qual;
- u_char version;
- u_char rsvd;
- u_char len;
- char class[3];
- char vendor_id[8];
- char product_id[16];
- char rev[4];
-};
-
-struct scsi_format_parms { /* physical BFI format */
- u_short reserved;
- u_short list_len;
- struct defect {
- unsigned cyl : 24;
- unsigned head : 8;
- long bytes_from_index;
- } defect[127];
-};
-
-struct scsi_reassign_parms {
- u_short reserved;
- u_short list_len; /* length in bytes of defects only */
- struct new_defect {
- unsigned lba; /* logical block address */
- } new_defect[2];
-};
-
-struct scsi_modesel_hdr {
- u_char rsvd1;
- u_char media_type;
- u_char rsvd2;
- u_char block_desc_len;
- u_int density : 8;
- u_int number_blocks :24;
- u_int rsvd3 : 8;
- u_int block_length :24;
-};
-
-struct scsi_modesense_hdr {
- u_char len;
- u_char media_type;
- u_char wp : 1;
- u_char rsvd1 : 7;
- u_char block_desc_len;
- u_int density : 8;
- u_int number_blocks :24;
- u_int rsvd2 : 8;
- u_int block_length :24;
-};
-
-/*
- * Mode Select / Mode sense "pages"
- */
-
-/*
- * Page One - Error Recovery Parameters
- */
-struct scsi_err_recovery {
- u_char page_savable : 1; /* save parameters */
- u_char reserved : 1;
- u_char page_code : 6; /* = 0x01 */
- u_char page_length; /* = 6 */
- u_char awre : 1; /* auto write realloc enabled */
- u_char arre : 1; /* auto read realloc enabled */
- u_char tb : 1; /* transfer block */
- u_char rc : 1; /* read continuous */
- u_char eec : 1; /* enable early correction */
- u_char per : 1; /* post error */
- u_char dte : 1; /* disable transfer on error */
- u_char dcr : 1; /* disable correction */
- u_char retry_count;
- u_char correction_span;
- u_char head_offset_count;
- u_char strobe_offset_count;
- u_char recovery_time_limit;
-};
-
-/*
- * Page Two - Disconnect / Reconnect Control Parameters
- */
-struct scsi_disco_reco {
- u_char page_savable : 1; /* save parameters */
- u_char rsvd : 1;
- u_char page_code : 6; /* = 0x02 */
- u_char page_length; /* = 10 */
- u_char buffer_full_ratio; /* write, how full before reconnect? */
- u_char buffer_empty_ratio; /* read, how full before reconnect? */
-
- u_short bus_inactivity_limit; /* how much bus time for busy */
- u_short disconnect_time_limit; /* min to remain disconnected */
- u_short connect_time_limit; /* min to remain connected */
- u_short reserved_1;
-};
-
-/*
- * Page Three - Direct Access Device Format Parameters
- */
-struct scsi_format {
- u_char page_savable : 1; /* save parameters */
- u_char rsvd : 1;
- u_char page_code : 6; /* = 0x03 */
- u_char page_length; /* = 22 */
- u_short tracks_per_zone; /* Handling of Defects Fields */
- u_short alt_sect_zone;
- u_short alt_tracks_zone;
- u_short alt_tracks_vol;
- u_short sect_track; /* Track Format Field */
- u_short data_sect; /* Sector Format Fields */
- u_short interleave;
- u_short track_skew_factor;
- u_short cyl_skew_factor;
- u_char ssec : 1; /* Drive Type Field */
- u_char hsec : 1;
- u_char rmb : 1;
- u_char surf : 1;
- u_char ins : 1;
- u_char reserved_1 : 3;
- u_char reserved_2;
- u_char reserved_3;
- u_char reserved_4;
-};
-
-/*
- * Page Four - Rigid Disk Drive Geometry Parameters
- */
-struct scsi_geometry {
- u_char page_savable : 1; /* save parameters */
- u_char rsvd : 1;
- u_char page_code : 6; /* = 0x04 */
- u_char page_length; /* = 18 */
- u_char cyl_ub; /* number of cylinders */
- u_char cyl_mb;
- u_char cyl_lb;
- u_char heads; /* number of heads */
- u_char precomp_cyl_ub; /* cylinder to start precomp */
- u_char precomp_cyl_mb;
- u_char precomp_cyl_lb;
- u_char current_cyl_ub; /* cyl to start reduced current */
- u_char current_cyl_mb;
- u_char current_cyl_lb;
- u_short step_rate; /* drive step rate */
- u_char landing_cyl_ub; /* landing zone cylinder */
- u_char landing_cyl_mb;
- u_char landing_cyl_lb;
- u_char reserved_1;
- u_char reserved_2;
- u_char reserved_3;
-};
-
-/*
- * Page 0x38 - Cache Control Parameters
- */
-struct scsi_cache {
- u_char page_savable : 1; /* save parameters */
- u_char rsvd : 1;
- u_char page_code : 6; /* = 0x38 */
- u_char page_length; /* = 14 */
- u_char rsvd_1 : 1;
- u_char wie : 1; /* write index enable */
- u_char rsvd_2 : 1;
- u_char ce : 1; /* cache enable */
- u_char table_size : 4;
- u_char prefetch_threshold;
- u_char maximum_threshold;
- u_char maximumprefetch_multiplier;
- u_char minimum_threshold;
- u_char minimum_prefetch_multiplier;
- u_char reserved[8];
-};
-
-/*
- * Control for SCSI "format" mode.
- *
- * "Format" mode allows a privileged process to issue direct SCSI
- * commands to a drive (it is intended primarily to allow on-line
- * formatting). SDIOCSFORMAT with a non-zero arg will put the drive
- * into format mode; a zero arg will take it out. When in format
- * mode, only the process that issued the SDIOCFORMAT can read or
- * write the drive.
- *
- * In format mode, process is expected to
- * - do SDIOCSCSICOMMAND to supply cdb for next SCSI op
- * - do read or write as appropriate for cdb
- * - if i/o error, optionally do SDIOCSENSE to get completion
- * status and sense data from last scsi operation.
- */
-
-struct scsi_fmt_cdb {
- int len; /* cdb length (in bytes) */
- u_char cdb[28]; /* cdb to use on next read/write */
-};
-
-struct scsi_fmt_sense {
- u_int status; /* completion status of last op */
- u_char sense[28]; /* sense data (if any) from last op */
-};
-
-#define SDIOCSFORMAT _IOW('S', 0x1, int)
-#define SDIOCGFORMAT _IOR('S', 0x2, int)
-#define SDIOCSCSICOMMAND _IOW('S', 0x3, struct scsi_fmt_cdb)
-#define SDIOCSENSE _IOR('S', 0x4, struct scsi_fmt_sense)
-
-int scsialive(int);
-int scsi_read_capacity(int, int, u_char *, u_int);
-int scsi_test_unit_rdy(int, int);
-int scsi_tt_read(int, int, u_char *, u_int, daddr32_t, u_int);
-int scsi_tt_write(int, int, u_char *, u_int, daddr32_t, u_int);
diff --git a/sys/arch/hp300/stand/include/scsivar.h b/sys/arch/hp300/stand/include/scsivar.h
deleted file mode 100644
index 67ad06bf8db..00000000000
--- a/sys/arch/hp300/stand/include/scsivar.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: scsivar.h,v 1.2 2003/06/02 23:27:46 millert Exp $ */
-/* $NetBSD: scsivar.h,v 1.4 1994/10/26 07:27:58 cgd Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory and 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.
- *
- * @(#)scsivar.h 8.1 (Berkeley) 6/10/93
- */
-
-struct scsi_softc {
- int sc_ba;
- char *sc_addr;
- char sc_alive;
- char sc_scsi_addr;
- char sc_stat;
- char sc_msg[7];
-};
-
-extern struct scsi_softc scsi_softc[];
diff --git a/sys/arch/hp300/stand/include/volhdr.h b/sys/arch/hp300/stand/include/volhdr.h
deleted file mode 100644
index fe63d2ef938..00000000000
--- a/sys/arch/hp300/stand/include/volhdr.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* $OpenBSD: volhdr.h,v 1.2 2003/06/02 23:27:46 millert Exp $ */
-/* $NetBSD: volhdr.h,v 1.4 1994/10/26 07:28:08 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)volhdr.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * vohldr.h: volume header for "LIF" format volumes
- */
-
-struct lifvol {
- short vol_id;
- char vol_label[6];
- int vol_addr;
- short vol_oct;
- short vol_dummy;
- int vol_dirsize;
- short vol_version;
- short vol_zero;
- int vol_huh1;
- int vol_huh2;
- int vol_length;
-};
-
-struct lifdir {
- char dir_name[10];
- short dir_type;
- int dir_addr;
- int dir_length;
- char dir_toc[6];
- short dir_flag;
- int dir_exec;
-};
-
-/* load header for boot rom */
-struct load {
- int address;
- int count;
-};
-
-#define VOL_ID -32768
-#define VOL_OCT 4096
-#define DIR_TYPE -5822
-#define DIR_FLAG 0x8001 /* dont ask me! */
-#define SECTSIZE 256
diff --git a/sys/arch/hp300/stand/installboot/Makefile b/sys/arch/hp300/stand/installboot/Makefile
deleted file mode 100644
index 0e6c328bdcc..00000000000
--- a/sys/arch/hp300/stand/installboot/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2012/08/21 14:46:18 pascal Exp $
-# $NetBSD: Makefile,v 1.1 1997/02/04 03:52:59 thorpej Exp $
-
-NOMAN=
-NOPIE=
-
-beforeinstall:
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
- ${.CURDIR}/installboot.sh ${DESTDIR}${BINDIR}/installboot
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/hp300/stand/installboot/installboot.sh b/sys/arch/hp300/stand/installboot/installboot.sh
deleted file mode 100644
index d3e5e39b3c1..00000000000
--- a/sys/arch/hp300/stand/installboot/installboot.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-# $OpenBSD: installboot.sh,v 1.1 1997/07/14 08:14:42 downsj Exp $
-# $NetBSD: installboot.sh,v 1.2 1994/10/26 07:27:26 cgd Exp $
-
-# compatibility with old installboot program
-#
-# @(#)installboot.sh 8.1 (Berkeley) 6/10/93
-#
-if [ $# != 2 ]
-then
- echo "Usage: installboot bootprog device"
- exit 1
-fi
-if [ ! -f $1 ]
-then
- echo "Usage: installboot bootprog device"
- echo "${1}: bootprog must be a regular file"
- exit 1
-fi
-if [ ! -c $2 ]
-then
- echo "Usage: installboot bootprog device"
- echo "${2}: device must be a char special file"
- exit 1
-fi
-/sbin/disklabel -B -b $1 $2
-exit $?
diff --git a/sys/arch/hp300/stand/libsa/Makefile b/sys/arch/hp300/stand/libsa/Makefile
deleted file mode 100644
index f5ac234fbb7..00000000000
--- a/sys/arch/hp300/stand/libsa/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-# $OpenBSD: Makefile,v 1.18 2014/02/23 19:22:40 miod Exp $
-
-LIB= sa
-
-CPPFLAGS+= ${SA_CPPFLAGS}
-
-CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../include -I${.CURDIR}/../.. \
- -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. \
- -I${.CURDIR}/../../../../lib/libsa
-
-# local source
-SRCS+= devopen.c exec_hp300.c rawfs.c
-
-# stand routines
-.PATH: ${.CURDIR}/../../../../lib/libsa
-SRCS+= alloc.c exit.c getfile.c gets.c globals.c loadfile.c \
- memcmp.c memcpy.c memset.c printf.c snprintf.c strcmp.c \
- strerror.c strlcat.c strlen.c strncmp.c strncpy.c
-
-.PATH: ${.CURDIR}/../../../../lib/libkern
-SRCS+= __main.c
-
-# io routines
-SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
- open.c read.c stat.c write.c
-
-# network routines
-SRCS+= arp.c ether.c in_cksum.c net.c netif.c rpc.c
-
-# network info services
-SRCS+= bootp.c bootparam.c rarp.c
-
-# boot filesystems
-SRCS+= ufs.c nfs.c cd9660.c
-
-NOPROFILE=
-NOPIC=
-
-install:
-
-.include <bsd.lib.mk>
diff --git a/sys/arch/hp300/stand/libsa/devopen.c b/sys/arch/hp300/stand/libsa/devopen.c
deleted file mode 100644
index 5cd06293198..00000000000
--- a/sys/arch/hp300/stand/libsa/devopen.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/* $OpenBSD: devopen.c,v 1.5 2013/01/11 23:22:35 miod Exp $ */
-/* $NetBSD: devopen.c,v 1.7 1996/10/14 07:31:47 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1993 John Brezak
- * 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.
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-int atoi(char *);
-int devlookup(const char *, int);
-int devopen(struct open_file *, const char *, char **);
-int devparse(const char *, int *, int *, int *, int *, int *, char **);
-void usage(void);
-
-u_int opendev;
-
-#define ispart(c) ((c) >= 'a' && (c) <= 'h')
-
-int
-atoi(char *cp)
-{
- int val = 0;
-
- while(isdigit(*cp))
- val = val * 10 + (*cp++ - '0');
- return(val);
-}
-
-void
-usage()
-{
- printf("Usage: device(adaptor, controller, drive, partition)file\n"
- " <device><unit><partitionletter>:file\n");
-}
-
-int
-devlookup(const char *d, int len)
-{
- struct devsw *dp = devsw;
- int i;
-
- for (i = 0; i < ndevs; i++, dp++) {
- if (dp->dv_name && strncmp(dp->dv_name, d, len) == 0) {
- /*
- * Set the filesystem and startup up according to
- * the device being opened.
- */
- switch (i) {
- case 0: /* ct */
- bcopy(file_system_rawfs, file_system,
- sizeof(struct fs_ops));
- break;
-
- case 2: /* hd */
- bcopy(file_system_ufs, file_system,
- sizeof(struct fs_ops));
- break;
-
- case 4: /* sd */
- bcopy(file_system_ufs, file_system,
- sizeof(struct fs_ops));
- bcopy(file_system_cd9660, &file_system[1],
- sizeof(struct fs_ops));
- nfsys = 2;
- break;
-
- case 6: /* le */
- bcopy(file_system_nfs, file_system,
- sizeof(struct fs_ops));
- break;
-
- default:
- /* Agh! What happened?! */
- goto bad;
- }
- return(i);
- }
- }
-
-bad:
- printf("No such device - Configured devices are:\n");
- for (dp = devsw, i = 0; i < ndevs; i++, dp++)
- if (dp->dv_name)
- printf(" %s", dp->dv_name);
- printf("\n");
- errno = ENODEV;
- return(-1);
-}
-
-/*
- * Parse a device spec in one of two forms.
- *
- * dev(adapt, ctlr, unit, part)file
- * [A-Za-z]*[0-9]*[A-Za-z]:file
- * dev unit part
- */
-int
-devparse(const char *fname, int *dev, int *adapt, int *ctlr, int *unit,
- int *part, char **file)
-{
- int i;
- char *s, *args[4];
-
- /* check for device name */
- for (s = (char *)fname; *s && *s != '/' && *s != ':' && *s != '('; s++)
- /* if (isupper(*s)) *s = tolower(*s) */;
-
- /* first form */
- if (*s == '(') {
- /* make device name lower case */
- for (s = (char *)fname; *s != '('; s++)
- if (isupper(*s)) *s = tolower(*s);
- /* lookup device and get index */
- if ((*dev = devlookup(fname, s - fname)) < 0)
- goto baddev;
-
- /* tokenize device ident */
- args[0] = ++s;
- for (args[0] = s, i = 1; *s && *s != ')'; s++) {
- if (*s == ',')
- args[i++] = ++s;
- }
- switch(i) {
- case 4:
- *adapt = atoi(args[0]);
- *ctlr = atoi(args[1]);
- *unit = atoi(args[2]);
- *part = atoi(args[3]);
- break;
- case 3:
- *ctlr = atoi(args[0]);
- *unit = atoi(args[1]);
- *part = atoi(args[2]);
- break;
- case 2:
- *unit = atoi(args[0]);
- *part = atoi(args[1]);
- break;
- case 1:
- *part = atoi(args[0]);
- break;
- case 0:
- break;
- }
- *file = ++s;
- }
-
- /* second form */
- else if (*s == ':') {
- int temp;
-
- /* isolate device and make its name lower case*/
- for (s = (char *)fname; *s != ':' && !isdigit(*s); s++)
- if (isupper(*s)) *s = tolower(*s);
-
- /* lookup device and get index */
- if ((*dev = devlookup(fname, s - fname)) < 0)
- goto baddev;
-
- /* isolate unit */
- if ((temp = atoi(s)) > 255)
- goto bad;
- *adapt = temp / 8;
- *ctlr = temp % 8;
- for (; isdigit(*s); s++);
-
- /* translate partition */
- if (!ispart(*s))
- goto bad;
-
- *part = *s++ - 'a';
- if (*s != ':')
- goto bad;
- *file = ++s;
- }
-
- /* no device present */
- else
- *file = (char *)fname;
-
- /* return the remaining unparsed part as the file to boot */
- return(0);
-
-bad:
- usage();
-
-baddev:
- return(-1);
-}
-
-int
-devopen(struct open_file *f, const char *fname, char **file)
-{
- int error;
- int dev, adapt, ctlr, unit, part;
- struct devsw *dp = &devsw[0];
-
- dev = B_TYPE(bootdev);
- adapt = B_ADAPTOR(bootdev);
- ctlr = B_CONTROLLER(bootdev);
- unit = B_UNIT(bootdev);
- part = B_PARTITION(bootdev);
-
- if ((error = devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file)))
- return(error);
-
- /*
- * Set up filesystem type based on what device we're opening.
- */
- switch (dev) {
- case 0: /* ct */
- bcopy(file_system_rawfs, file_system, sizeof(struct fs_ops));
- break;
-
- case 2: /* hd */
- bcopy(file_system_ufs, file_system, sizeof(struct fs_ops));
- break;
-
- case 4: /* sd */
- bcopy(file_system_ufs, file_system, sizeof(struct fs_ops));
- bcopy(file_system_cd9660, &file_system[1],
- sizeof(struct fs_ops));
- nfsys = 2;
- break;
-
- case 6: /* le */
- bcopy(file_system_nfs, file_system, sizeof(struct fs_ops));
- break;
-
- default:
- /* XXX what else should we do here? */
- printf("WARNING: BOGUS BOOT DEV TYPE 0x%x!\n", dev);
- return (EIO);
- }
-
- dp = &devsw[dev];
-
- if (!dp->dv_open)
- return(ENODEV);
-
- f->f_dev = dp;
-
- if ((error = (*dp->dv_open)(f, adapt, ctlr, part)) == 0) {
- if ((error =
- (*punitsw[dev].p_punit)(adapt, ctlr, &unit)) != 0) {
- goto bad;
- }
- opendev = MAKEBOOTDEV(dev, adapt, ctlr, unit, part);
- return(0);
- }
-
- bad:
- printf("%s(%d,%d,%d,%d): %s\n", devsw[dev].dv_name,
- adapt, ctlr, unit, part, strerror(error));
-
- return(error);
-}
diff --git a/sys/arch/hp300/stand/libsa/exec_hp300.c b/sys/arch/hp300/stand/libsa/exec_hp300.c
deleted file mode 100644
index fc520b85062..00000000000
--- a/sys/arch/hp300/stand/libsa/exec_hp300.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $OpenBSD: exec_hp300.c,v 1.5 2014/02/23 19:22:40 miod Exp $ */
-/* $NetBSD: exec.c,v 1.15 1996/10/13 02:29:01 christos Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 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.
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#include "stand.h"
-#include "samachdep.h"
-
-#include <lib/libsa/loadfile.h>
-
-void
-exec(char *path, void *loadaddr, int howto)
-{
- u_long marks[MARK_MAX];
- int rc;
-
- marks[MARK_START] = (u_long)loadaddr;
- rc = loadfile(path, marks, LOAD_KERNEL | COUNT_KERNEL);
- if (rc != 0)
- return;
-
- printf("Start @ 0x%lx\n", marks[MARK_ENTRY]);
-
- machdep_start((char *)marks[MARK_ENTRY], howto, loadaddr,
- (char *)marks[MARK_SYM], (char *)marks[MARK_END]);
-
- /* exec failed */
- printf("exec: kernel returned!\n");
- errno = ENOEXEC;
-}
diff --git a/sys/arch/hp300/stand/libsa/rawfs.c b/sys/arch/hp300/stand/libsa/rawfs.c
deleted file mode 100644
index 9c27263aee7..00000000000
--- a/sys/arch/hp300/stand/libsa/rawfs.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/* $OpenBSD: rawfs.c,v 1.5 2011/03/13 00:13:52 deraadt Exp $ */
-/* $NetBSD: rawfs.c,v 1.2 1996/10/06 19:07:53 thorpej Exp $ */
-
-/*
- * 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.
- */
-
-/*
- * Raw file system - for stream devices like tapes.
- * No random access, only sequential read allowed.
- * This exists only to allow upper level code to be
- * shielded from the fact that the device must be
- * read only with whole block position and size.
- */
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-#include "rawfs.h"
-
-extern int debug;
-
-/* Our devices are generally willing to do 8K transfers. */
-#define RAWFS_BSIZE 0x2000
-
-/*
- * In-core open file.
- */
-struct rawfs_file {
- daddr32_t fs_nextblk; /* block number to read next */
- int fs_len; /* amount left in f_buf */
- char * fs_ptr; /* read pointer into f_buf */
- char fs_buf[RAWFS_BSIZE];
-};
-
-static int
-rawfs_get_block(struct open_file *);
-
-int
-rawfs_open(char *path, struct open_file *f)
-{
- struct rawfs_file *fs;
-
- /*
- * The actual tape driver has already been opened.
- * Just allocate the I/O buffer, etc.
- */
- fs = alloc(sizeof(struct rawfs_file));
- fs->fs_nextblk = 0;
- fs->fs_len = 0;
- fs->fs_ptr = fs->fs_buf;
-
-#ifdef DEBUG_RAWFS
- printf("rawfs_open: fs=0x%x\n", (u_long)fs);
-#endif
-
- f->f_fsdata = fs;
- return (0);
-}
-
-int
-rawfs_close(struct open_file *f)
-{
- struct rawfs_file *fs;
-
- fs = (struct rawfs_file *) f->f_fsdata;
- f->f_fsdata = (void *)0;
-
-#ifdef DEBUG_RAWFS
- printf("rawfs_close: fs=0x%x\n", (u_long)fs);
-#endif
-
- if (fs != (struct rawfs_file *)0)
- free(fs, sizeof(*fs));
-
- return (0);
-}
-
-int
-rawfs_read(struct open_file *f, void *start, size_t size, size_t *resid)
-{
- struct rawfs_file *fs = (struct rawfs_file *)f->f_fsdata;
- char *addr = start;
- int error = 0;
- size_t csize;
-
-#ifdef DEBUG_RAWFS
- printf("rawfs_read: file=0x%x, start=0x%x, size=%d, resid=0x%x\n",
- (u_long)f, (u_long)start, size, resid);
- printf(" fs=0x%x\n", (u_long)fs);
-#endif
-
- while (size != 0) {
-
- if (fs->fs_len == 0)
- if ((error = rawfs_get_block(f)) != 0)
- break;
-
- if (fs->fs_len <= 0)
- break; /* EOF */
-
- csize = size;
- if (csize > fs->fs_len)
- csize = fs->fs_len;
-
- bcopy(fs->fs_ptr, addr, csize);
- fs->fs_ptr += csize;
- fs->fs_len -= csize;
- addr += csize;
- size -= csize;
- }
- if (resid)
- *resid = size;
- return (error);
-}
-
-int
-rawfs_write(struct open_file *f, void *start, size_t size, size_t *resid)
-{
-#ifdef DEBUG_RAWFS
- printf("rawfs_write: YOU'RE NOT SUPPOSED TO GET HERE!\n");
-#endif
- return (EROFS);
-}
-
-off_t
-rawfs_seek(struct open_file *f, off_t offset, int where)
-{
-#ifdef DEBUG_RAWFS
- printf("rawfs_seek: YOU'RE NOT SUPPOSED TO GET HERE!\n");
-#endif
- return (EFTYPE);
-}
-
-int
-rawfs_stat(struct open_file *f, struct stat *sb)
-{
-#ifdef DEBUG_RAWFS
- printf("rawfs_stat: I'll let you live only because of exec.c\n");
-#endif
- /*
- * Clear out the stat buffer so that the uid check
- * won't fail. See sys/lib/libsa/exec.c
- */
- bzero(sb, sizeof(*sb));
-
- return (EFTYPE);
-}
-
-/*
- * Read a block from the underlying stream device
- * (In our case, a tape drive.)
- */
-static int
-rawfs_get_block(struct open_file *f)
-{
- struct rawfs_file *fs;
- size_t len;
- int error;
-
- fs = (struct rawfs_file *)f->f_fsdata;
- fs->fs_ptr = fs->fs_buf;
-
- twiddle();
-#ifdef DEBUG_RAWFS
- printf("rawfs_get_block: calling strategy\n");
-#endif
- error = f->f_dev->dv_strategy(f->f_devdata, F_READ,
- fs->fs_nextblk, RAWFS_BSIZE, fs->fs_buf, &len);
-#ifdef DEBUG_RAWFS
- printf("rawfs_get_block: strategy returned %d\n", error);
-#endif
-
- if (!error) {
- fs->fs_len = len;
- fs->fs_nextblk += (RAWFS_BSIZE / DEV_BSIZE);
- }
-
- return (error);
-}
diff --git a/sys/arch/hp300/stand/libsa/rawfs.h b/sys/arch/hp300/stand/libsa/rawfs.h
deleted file mode 100644
index d86eac48d34..00000000000
--- a/sys/arch/hp300/stand/libsa/rawfs.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* $OpenBSD: rawfs.h,v 1.3 2006/01/18 14:15:12 deraadt Exp $ */
-/* $NetBSD: rawfs.h,v 1.1 1996/06/26 17:44:36 thorpej Exp $ */
-
-/*
- * Raw file system - for stream devices like tapes.
- * No random access, only sequential read allowed.
- */
-
-int rawfs_open(char *path, struct open_file *f);
-int rawfs_close(struct open_file *f);
-int rawfs_read(struct open_file *f, void *buf,
- size_t size, size_t *resid);
-int rawfs_write(struct open_file *f, void *buf,
- size_t size, size_t *resid);
-off_t rawfs_seek(struct open_file *f, off_t offset, int where);
-int rawfs_stat(struct open_file *f, struct stat *sb);
diff --git a/sys/arch/hp300/stand/libsaz/Makefile b/sys/arch/hp300/stand/libsaz/Makefile
deleted file mode 100644
index 30f2dfaff96..00000000000
--- a/sys/arch/hp300/stand/libsaz/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# $OpenBSD: Makefile,v 1.5 2012/08/21 14:46:18 pascal Exp $
-
-CFLAGS+=-D__INTERNAL_LIBSA_CREAD
-
-NOPIE=
-
-# io routines
-SRCS+= cread.c
-
-.include "${.CURDIR}/../libsa/Makefile"
-.PATH: ${.CURDIR}/../libsa
-
-LIB= saz
diff --git a/sys/arch/hp300/stand/libz/Makefile b/sys/arch/hp300/stand/libz/Makefile
deleted file mode 100644
index 8e1a2abd4c9..00000000000
--- a/sys/arch/hp300/stand/libz/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-# $OpenBSD: Makefile,v 1.6 2013/01/01 17:17:44 miod Exp $
-
-S=${.CURDIR}/../../../..
-ZDST=${.OBJDIR}
-
-NOPIE=
-
-.PATH: ${S}/lib/libz
-
-CPPFLAGS+= ${SA_CPPFLAGS}
-
-CFLAGS+=-I${S}
-
-.include "${S}/lib/libz/Makefile"
diff --git a/sys/arch/hp300/stand/mkboot/Makefile b/sys/arch/hp300/stand/mkboot/Makefile
deleted file mode 100644
index c0f16a9a46b..00000000000
--- a/sys/arch/hp300/stand/mkboot/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# $OpenBSD: Makefile,v 1.4 2013/01/01 17:17:44 miod Exp $
-# $NetBSD: Makefile,v 1.2 1997/05/14 07:57:13 thorpej Exp $
-
-PROG= mkboot
-NOMAN=
-NOPIE=
-
-CFLAGS+= -I${.CURDIR}/../include
-CPPFLAGS=
-
-install:
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/hp300/stand/mkboot/mkboot.c b/sys/arch/hp300/stand/mkboot/mkboot.c
deleted file mode 100644
index 2de22f91fe9..00000000000
--- a/sys/arch/hp300/stand/mkboot/mkboot.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/* $OpenBSD: mkboot.c,v 1.8 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: mkboot.c,v 1.10 2006/06/18 05:53:51 gdamore 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.
- *
- * @(#)mkboot.c 8.1 (Berkeley) 7/15/93
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-
-#include "volhdr.h"
-
-#include <stdio.h>
-#include <ctype.h>
-
-#define LIF_NUMDIR 8
-
-#define LIF_VOLSTART 0
-#define LIF_VOLSIZE sizeof(struct lifvol)
-#define LIF_DIRSTART 512
-#define LIF_DIRSIZE (LIF_NUMDIR * sizeof(struct lifdir))
-#define LIF_FILESTART 8192
-
-#define btolifs(b) (((b) + (SECTSIZE - 1)) / SECTSIZE)
-#define lifstob(s) ((s) * SECTSIZE)
-
-int lpflag;
-int loadpoint;
-struct load ld;
-struct lifvol lifv;
-struct lifdir lifd[LIF_NUMDIR];
-
-void bcddate(char *, char *);
-char *lifname(char *);
-int putfile(char *, int);
-void usage(void);
-
-/*
- * Old Format:
- * sector 0: LIF volume header (40 bytes)
- * sector 1: <unused>
- * sector 2: LIF directory (8 x 32 == 256 bytes)
- * sector 3-: LIF file 0, LIF file 1, etc.
- * where sectors are 256 bytes.
- *
- * New Format:
- * sector 0: LIF volume header (40 bytes)
- * sector 1: <unused>
- * sector 2: LIF directory (8 x 32 == 256 bytes)
- * sector 3: <unused>
- * sector 4-31: disklabel (~300 bytes right now)
- * sector 32-: LIF file 0, LIF file 1, etc.
- */
-int
-main(int argc, char **argv)
-{
- char *n1, *n2, *n3;
- int n, to;
- int count;
-
- --argc;
- ++argv;
- if (argc == 0)
- usage();
- if (!strcmp(argv[0], "-l")) {
- argv++;
- argc--;
- if (argc == 0)
- usage();
- sscanf(argv[0], "0x%x", &loadpoint);
- lpflag++;
- argv++;
- argc--;
- }
- if (!lpflag || argc == 0)
- usage();
- n1 = argv[0];
- argv++;
- argc--;
- if (argc == 0)
- usage();
- if (argc > 1) {
- n2 = argv[0];
- argv++;
- argc--;
- if (argc > 1) {
- n3 = argv[0];
- argv++;
- argc--;
- } else
- n3 = NULL;
- } else
- n2 = n3 = NULL;
-
- to = open(argv[0], O_WRONLY | O_TRUNC | O_CREAT, 0644);
- if (to < 0) {
- perror("open");
- exit(1);
- }
- /* clear possibly unused directory entries */
- bcopy(" ", lifd[1].dir_name, 10);
- lifd[1].dir_type = htobe16(-1);
- lifd[1].dir_addr = htobe32(0);
- lifd[1].dir_length = htobe32(0);
- lifd[1].dir_flag = htobe16(0xFF);
- lifd[1].dir_exec = htobe32(0);
- lifd[7] = lifd[6] = lifd[5] = lifd[4] = lifd[3] = lifd[2] = lifd[1];
- /* record volume info */
- lifv.vol_id = htobe16(VOL_ID);
- bcopy("BOOT44", lifv.vol_label, 6);
- lifv.vol_addr = htobe32(btolifs(LIF_DIRSTART));
- lifv.vol_oct = htobe16(VOL_OCT);
- lifv.vol_dirsize = htobe32(btolifs(LIF_DIRSIZE));
- lifv.vol_version = htobe16(1);
- /* output bootfile one */
- lseek(to, LIF_FILESTART, SEEK_SET);
- count = putfile(n1, to);
- n = btolifs(count);
- strlcpy(lifd[0].dir_name, lifname(n1), sizeof lifd[0].dir_name);
- lifd[0].dir_type = htobe16(DIR_TYPE);
- lifd[0].dir_addr = htobe32(btolifs(LIF_FILESTART));
- lifd[0].dir_length = htobe32(n);
- bcddate(n1, lifd[0].dir_toc);
- lifd[0].dir_flag = htobe16(DIR_FLAG);
- lifd[0].dir_exec = htobe32(loadpoint);
- lifv.vol_length = htobe32(htobe32(lifd[0].dir_addr) +
- htobe32(lifd[0].dir_length));
- /* if there is an optional second boot program, output it */
- if (n2) {
- lseek(to, LIF_FILESTART+lifstob(n), SEEK_SET);
- count = putfile(n2, to);
- n = btolifs(count);
- strlcpy(lifd[1].dir_name, lifname(n2), sizeof lifd[1].dir_name);
- lifd[1].dir_type = htobe16(DIR_TYPE);
- lifd[1].dir_addr = htobe32(lifv.vol_length);
- lifd[1].dir_length = htobe32(n);
- bcddate(n2, lifd[1].dir_toc);
- lifd[1].dir_flag = htobe16(DIR_FLAG);
- lifd[1].dir_exec = htobe32(loadpoint);
- lifv.vol_length = htobe32(htobe32(lifd[1].dir_addr) +
- htobe32(lifd[1].dir_length));
- }
- /* ditto for three */
- if (n3) {
- lseek(to, LIF_FILESTART+lifstob(lifd[0].dir_length+n),
- SEEK_SET);
- count = putfile(n3, to);
- n = btolifs(count);
- strlcpy(lifd[2].dir_name, lifname(n3), sizeof lifd[2].dir_name);
- lifd[2].dir_type = htobe16(DIR_TYPE);
- lifd[2].dir_addr = htobe32(lifv.vol_length);
- lifd[2].dir_length = htobe32(n);
- bcddate(n3, lifd[2].dir_toc);
- lifd[2].dir_flag = htobe16(DIR_FLAG);
- lifd[2].dir_exec = htobe32(loadpoint);
- lifv.vol_length = htobe32(htobe32(lifd[2].dir_addr) +
- htobe32(lifd[2].dir_length));
- }
- /* output volume/directory header info */
- lseek(to, LIF_VOLSTART, SEEK_SET);
- write(to, &lifv, LIF_VOLSIZE);
- lseek(to, LIF_DIRSTART, SEEK_SET);
- write(to, lifd, LIF_DIRSIZE);
- exit(0);
-}
-
-int
-putfile(char *from, int to)
-{
- int fd;
- struct stat statb;
- int nr;
- void *bp;
-
- if ((fd = open(from, 0)) < 0) {
- printf("error: unable to open file %s\n", from);
- exit(1);
- }
- fstat(fd, &statb);
- ld.address = htobe32(loadpoint);
- ld.count = htobe32(statb.st_size);
- bp = malloc(statb.st_size);
- if ((nr = read(fd, bp, statb.st_size)) < 0) {
- printf("error: reading from file %s\n", from);
- exit(1);
- }
- (void)close(fd);
- write(to, &ld, sizeof(ld));
- write(to, bp, statb.st_size);
- free(bp);
- return (statb.st_size + sizeof(ld));
-}
-
-void
-usage(void)
-{
-
- fprintf(stderr,
- "usage: mkboot -l loadpoint prog1 [ prog2 ] outfile\n");
- exit(1);
-}
-
-char *
-lifname(char *str)
-{
- static char lname[10] = "SYS_XXXXX";
- char *cp;
- int i;
-
- if ((cp = strrchr(str, '/')) != NULL)
- str = ++cp;
- for (i = 4; i < 10; i++) {
- if (islower(*str))
- lname[i] = toupper(*str);
- else if (isalnum(*str) || *str == '_')
- lname[i] = *str;
- else
- break;
- str++;
- }
- for ( ; i < 10; i++)
- lname[i] = ' ';
- return(lname);
-}
-
-void
-bcddate(char *name, char *toc)
-{
- struct stat statb;
- struct tm *tm;
-
- stat(name, &statb);
- tm = localtime(&statb.st_ctime);
- *toc = ((tm->tm_mon+1) / 10) << 4;
- *toc++ |= (tm->tm_mon+1) % 10;
- *toc = (tm->tm_mday / 10) << 4;
- *toc++ |= tm->tm_mday % 10;
- *toc = (tm->tm_year / 10) << 4;
- *toc++ |= tm->tm_year % 10;
- *toc = (tm->tm_hour / 10) << 4;
- *toc++ |= tm->tm_hour % 10;
- *toc = (tm->tm_min / 10) << 4;
- *toc++ |= tm->tm_min % 10;
- *toc = (tm->tm_sec / 10) << 4;
- *toc |= tm->tm_sec % 10;
-}
diff --git a/sys/arch/hp300/stand/uboot/Makefile b/sys/arch/hp300/stand/uboot/Makefile
deleted file mode 100644
index 49b0a3d018d..00000000000
--- a/sys/arch/hp300/stand/uboot/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-# $OpenBSD: Makefile,v 1.9 2013/02/02 13:34:29 miod Exp $
-
-PROG= uboot
-OBJCOPY?= objcopy
-SIZE?= size
-
-NOMAN=
-NOPIE=
-
-CPPFLAGS+= ${SA_CPPFLAGS}
-
-CFLAGS+=-I${.CURDIR}/../include \
- -I${.CURDIR}/../libsa -I${.CURDIR}/../.. -I${.CURDIR}/../../.. \
- -I${.CURDIR}/../../../..
-
-AFLAGS= -x assembler-with-cpp -traditional-cpp -I${.CURDIR}/../include \
- -I${.CURDIR}/../libsa -I${.CURDIR}/../.. -I${.CURDIR}/../../.. \
- -I${.CURDIR}/../../../..
-
-SRCS= srt0.S uboot.c tgets.c netio.c clock.c conf.c prf.c
-
-LIBS= ${LIBCOMMON} ${LIBSAZ} ${LIBZ}
-
-CLEANFILES+= ${PROG}.bin ${PROG}.lif
-
-uboot.lif: ${PROG}
- ${OBJCOPY} -S -O binary ${PROG} ${PROG}.bin
- ${MKBOOT_PROG} -l 0x${RELOC} ${PROG}.bin $@
-
-uboot: ${OBJS} ${LIBS}
- ${LD} -N -Ttext ${RELOC} -e begin --warn-common ${OBJS} ${LIBS} \
- `${CC} -print-libgcc-file-name` -o $@
- @${SIZE} $@
- @echo $@ total size should not exceed 1044480 bytes
-
-install: uboot.lif ${MKBOOT_PROG}
- ${INSTALL} -d -m 755 -o ${BINOWN} -g ${BINGRP} \
- ${DESTDIR}/usr/mdec/rbootd
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 uboot.lif \
- ${DESTDIR}/usr/mdec
- rm -f ${DESTDIR}/usr/mdec/hdboot
- ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/hdboot
- rm -f ${DESTDIR}/usr/mdec/boothd
- ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/boothd
- rm -f ${DESTDIR}/usr/mdec/sdboot
- ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/sdboot
- rm -f ${DESTDIR}/usr/mdec/bootsd
- ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/bootsd
- rm -f ${DESTDIR}/usr/mdec/ctboot
- ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/ctboot
- rm -f ${DESTDIR}/usr/mdec/bootct
- ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/bootct
- rm -f ${DESTDIR}/usr/mdec/rbootd/SYS_UBOOT
- ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/rbootd/SYS_UBOOT
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/hp300/stand/uboot/clock.c b/sys/arch/hp300/stand/uboot/clock.c
deleted file mode 100644
index c6f192e76d9..00000000000
--- a/sys/arch/hp300/stand/uboot/clock.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* $OpenBSD: clock.c,v 1.5 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: clock.c,v 1.3 1995/02/20 00:12:09 mycroft Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: clock.c 1.18 91/01/21$
- *
- * @(#)clock.c 8.2 (Berkeley) 1/12/94
- */
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "hilreg.h"
-#include <hp300/hp300/clockreg.h>
-
-extern void send_hil_cmd(struct hil_dev *, u_char, u_char *, u_char, u_char *);
-
-static int month_days[12] = {
- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-
-u_char bbc_registers[13];
-struct hil_dev *bbcaddr = (struct hil_dev *)BBCADDR;
-
-int bbc_to_gmt(u_long *);
-void read_bbc(void);
-u_char read_bbc_reg(int);
-
-time_t
-getsecs()
-{
- static int bbcinited = 0;
- u_long timbuf = 0;
-
- if (!bbc_to_gmt(&timbuf) && !bbcinited)
- printf("WARNING: bad date in battery clock\n");
- bbcinited = 1;
-
- /* Battery clock does not store usec's, so forget about it. */
- return((time_t)timbuf);
-}
-
-int
-bbc_to_gmt(u_long *timbuf)
-{
- int i;
- u_long tmp;
- int year, month, day, hour, min, sec;
-
- read_bbc();
-
- sec = bbc_to_decimal(1, 0);
- min = bbc_to_decimal(3, 2);
-
- /*
- * Hours are different for some reason. Makes no sense really.
- */
- hour = ((bbc_registers[5] & 0x03) * 10) + bbc_registers[4];
- day = bbc_to_decimal(8, 7);
- month = bbc_to_decimal(10, 9);
- year = bbc_to_decimal(12, 11) + 1900;
-
- range_test(hour, 0, 23);
- range_test(day, 1, 31);
- range_test(month, 1, 12);
- range_test(year, STARTOFTIME, 2038); /* 2038 is the end of time. */
-
- tmp = 0;
-
- for (i = STARTOFTIME; i < year; i++)
- tmp += days_in_year(i);
- if (leapyear(year) && month > FEBRUARY)
- tmp++;
-
- for (i = 1; i < month; i++)
- tmp += days_in_month(i);
-
- tmp += (day - 1);
- tmp = ((tmp * 24 + hour) * 60 + min) * 60 + sec;
-
- *timbuf = tmp;
- return(1);
-}
-
-void
-read_bbc()
-{
- int i, read_okay;
-
- read_okay = 0;
- while (!read_okay) {
- read_okay = 1;
- for (i = 0; i <= NUM_BBC_REGS; i++)
- bbc_registers[i] = read_bbc_reg(i);
- for (i = 0; i <= NUM_BBC_REGS; i++)
- if (bbc_registers[i] != read_bbc_reg(i))
- read_okay = 0;
- }
-}
-
-u_char
-read_bbc_reg(int reg)
-{
- u_char data = reg;
-
- if (bbcaddr) {
-#if 0
- send_hil_cmd(bbcaddr, BBC_SET_REG, &data, 1, NULL);
- send_hil_cmd(bbcaddr, BBC_READ_REG, NULL, 0, &data);
-#else
- HILWAIT(bbcaddr);
- bbcaddr->hil_cmd = BBC_SET_REG;
- HILWAIT(bbcaddr);
- bbcaddr->hil_data = data;
- HILWAIT(bbcaddr);
- bbcaddr->hil_cmd = BBC_READ_REG;
- HILDATAWAIT(bbcaddr);
- data = bbcaddr->hil_data;
-#endif
- }
- return(data);
-}
diff --git a/sys/arch/hp300/stand/uboot/conf.c b/sys/arch/hp300/stand/uboot/conf.c
deleted file mode 100644
index f9abd637d67..00000000000
--- a/sys/arch/hp300/stand/uboot/conf.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* $OpenBSD: conf.c,v 1.8 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: conf.c,v 1.12 1996/10/14 07:29:15 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 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.
- *
- * @(#)conf.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-#include <sys/socket.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#include <netinet/in_systm.h>
-
-#include <lib/libsa/nfs.h>
-#include <lib/libsa/cd9660.h>
-#include <lib/libsa/ufs.h>
-#include "rawfs.h"
-
-int debug = 0; /* XXX */
-
-/*
- * Device configuration
- */
-int netstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int netopen(struct open_file *, ...);
-int netclose(struct open_file *);
-#define netioctl noioctl
-
-int ctstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int ctopen(struct open_file *, ...);
-int ctclose(struct open_file *);
-#define ctioctl noioctl
-
-int hdstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int hdopen(struct open_file *, ...);
-int hdclose(struct open_file *);
-#define hdioctl noioctl
-
-int sdstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int sdopen(struct open_file *, ...);
-int sdclose(struct open_file *);
-#define sdioctl noioctl
-
-#define xxstrategy \
- (int (*)(void *, int, daddr32_t, size_t, void *, size_t *))nullsys
-#define xxopen (int (*)(struct open_file *, ...))nodev
-#define xxclose (int (*)(struct open_file *))nullsys
-
-/*
- * Note: "le" isn't a major offset.
- */
-struct devsw devsw[] = {
- { "ct", ctstrategy, ctopen, ctclose, ctioctl }, /*0*/
- { "??", xxstrategy, xxopen, xxclose, noioctl }, /*1*/
- { "hd", hdstrategy, hdopen, hdclose, hdioctl }, /*2*/
- { "??", xxstrategy, xxopen, xxclose, noioctl }, /*3*/
- { "sd", sdstrategy, sdopen, sdclose, sdioctl }, /*4*/
- { "??", xxstrategy, xxopen, xxclose, noioctl }, /*5*/
- { "le", netstrategy, netopen, netclose, netioctl },/*6*/
-};
-int ndevs = (sizeof(devsw) / sizeof(devsw[0]));
-
-extern struct netif_driver le_driver;
-
-struct netif_driver *netif_drivers[] = {
- &le_driver,
-};
-int n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0]));
-
-/*
- * Physical unit/lun detection.
- */
-int punitzero(int, int, int *);
-
-int
-punitzero(int ctlr, int slave, int *punit)
-{
- *punit = 0;
- return (0);
-}
-
-extern int ctpunit(int, int, int *);
-#define xxpunit punitzero
-#define hdpunit punitzero
-#define sdpunit punitzero
-#define lepunit punitzero
-
-struct punitsw punitsw[] = {
- { ctpunit },
- { xxpunit },
- { hdpunit },
- { xxpunit },
- { sdpunit },
- { xxpunit },
- { lepunit },
-};
-
-/*
- * Filesystem configuration
- */
-struct fs_ops file_system_rawfs[] = {
- { rawfs_open, rawfs_close, rawfs_read, rawfs_write, rawfs_seek,
- rawfs_stat },
-};
-
-struct fs_ops file_system_ufs[] = {
- { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
-};
-
-struct fs_ops file_system_nfs[] = {
- { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
-};
-
-struct fs_ops file_system_cd9660[] = {
- { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
- cd9660_stat },
-};
-
-struct fs_ops file_system[2];
-int nfsys = 1; /* default; changed per device type. */
diff --git a/sys/arch/hp300/stand/uboot/netio.c b/sys/arch/hp300/stand/uboot/netio.c
deleted file mode 100644
index afbce4820f2..00000000000
--- a/sys/arch/hp300/stand/uboot/netio.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/* $OpenBSD: netio.c,v 1.5 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: netio.c,v 1.5 1997/01/30 10:32:56 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995, 1996 Jason R. Thorpe
- * 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 <netinet/in_systm.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-#include <lib/libsa/net.h>
-#include <lib/libsa/netif.h>
-#include <lib/libsa/bootparam.h>
-#include <lib/libsa/nfs.h>
-
-extern int nfs_root_node[]; /* XXX - get from nfs_mount() */
-
-/* Why be any different? */
-#define SUN_BOOTPARAMS
-
-#ifndef SUN_BOOTPARAMS
-n_long netmask;
-#endif
-
-int netdev_sock = -1;
-static int open_count;
-
-int netclose(struct open_file *);
-int netmountroot(struct open_file *, char *);
-int netopen(struct open_file *, char *);
-int netstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-
-/*
- * Called by devopen after it sets f->f_dev to our devsw entry.
- * This opens the low-level device and sets f->f_devdata.
- */
-int
-netopen(struct open_file *f, char *devname)
-{
- int error = 0;
-
- /* On first open, do netif open, mount, etc. */
- if (open_count == 0) {
- /* Find network interface. */
- if ((netdev_sock = netif_open(devname)) < 0)
- return (error=ENXIO);
- if ((error = netmountroot(f, devname)) != 0)
- return (error);
- }
- open_count++;
- f->f_devdata = nfs_root_node;
- return (error);
-}
-
-int
-netclose(struct open_file *f)
-{
- /* On last close, do netif close, etc. */
- if (open_count > 0)
- if (--open_count == 0)
- netif_close(netdev_sock);
- f->f_devdata = NULL;
- return (0);
-}
-
-int
-netstrategy(void *devdata, int func, daddr32_t dblk, size_t size, void *v_buf,
- size_t *rsize)
-{
-
- *rsize = size;
- return EIO;
-}
-
-int
-netmountroot(struct open_file *f, char *devname)
-{
-#ifdef DEBUG
- printf("netmountroot: %s\n", devname);
-#endif
-
- /*
- * 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 SUN_BOOTPARAMS
- /* Get boot info using RARP and Sun bootparams. */
-
- /* Get our IP address. (rarp.c) */
- if (rarp_getipaddress(netdev_sock) == -1)
- return (errno);
-
- printf("boot: client IP address: %s\n", inet_ntoa(myip));
-
- /* Get our hostname, server IP address. */
- if (bp_whoami(netdev_sock))
- return (errno);
-
- printf("boot: client name: %s\n", hostname);
-
- /* Get the root pathname. */
- if (bp_getfile(netdev_sock, "root", &rootip, rootpath))
- return (errno);
-
-#else
-
- /* Get boot info using BOOTP way. (RFC951, RFC1048) */
- bootp(netdev_sock);
-
- printf("Using IP address: %s\n", inet_ntoa(myip));
-
- printf("myip: %s (%s)", hostname, inet_ntoa(myip));
- if (mask)
- printf(", mask: %s", intoa(netmask));
- printf("\n");
-
-#endif /* SUN_BOOTPARAMS */
-
- printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath);
-
- /* Get the NFS file handle (mount). */
- return nfs_mount(netdev_sock, rootip, rootpath);
-}
diff --git a/sys/arch/hp300/stand/uboot/prf.c b/sys/arch/hp300/stand/uboot/prf.c
deleted file mode 100644
index 5b565c738a0..00000000000
--- a/sys/arch/hp300/stand/uboot/prf.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $OpenBSD: prf.c,v 1.1 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: prf.c,v 1.5 1994/10/26 07:27:50 cgd Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 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.
- *
- * @(#)prf.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "consdefs.h"
-
-int
-getchar()
-{
- int c;
-
- while((c = cngetc()) == 0)
- ;
- if (c == '\r')
- c = '\n';
- else if (c == ('c'&037)) {
- panic("^C");
- /* NOTREACHED */
- }
- return(c);
-}
-
-void
-putchar(int c)
-{
- cnputc(c);
- if (c == '\n')
- cnputc('\r');
-}
diff --git a/sys/arch/hp300/stand/uboot/srt0.S b/sys/arch/hp300/stand/uboot/srt0.S
deleted file mode 100644
index 9d2104addf5..00000000000
--- a/sys/arch/hp300/stand/uboot/srt0.S
+++ /dev/null
@@ -1,328 +0,0 @@
-/* $OpenBSD: srt0.S,v 1.9 2013/03/21 21:51:00 deraadt Exp $ */
-/* $NetBSD: srt0.S,v 1.4 1997/05/12 07:56:00 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: srt0.c 1.18 92/12/21$
- *
- * @(#)srt0.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Startup code for standalone system
- */
-
-#include <machine/asm.h>
-#include <machine/hp300spu.h>
-
- STACK = 0xfffff000 | below the ROM page
- BOOTTYPE = 0xfffffdc0
- LOWRAM = 0xfffffdce
- SYSFLAG = 0xfffffed2 | system flags
- MSUS = 0xfffffedc | MSUS (?) structure
- VECTORS = 0xfffffee0 | beginning of jump vectors
- NMIRESET = 0xffffff9c | reset vector
- BUSERR = 0xfffffffc
- MAXADDR = 0xfffff000
- PAGE_SIZE =4096
- MMUCMD = 0x005f400c | MMU command/status register
-
- .data
-GLOBAL(bootdev)
- .long 0
-GLOBAL(howto)
- .long 0
-GLOBAL(lowram)
- .long 0
-GLOBAL(machineid)
- .long 0
-GLOBAL(mmuid)
- .long 0
-
- .chip 68020
- .text
-ASENTRY_NOPROFILE(begin)
- movl #STACK,%sp
- moveq #47,%d0 | # of vectors - 1
- movl #VECTORS+2,%a0 | addr part of first vector
-1:
- movl #_ASM_LABEL(__trap),%a0@ | make it direct to __trap
- addql #6,%a0 | move to next vector addr
- dbf %d0,1b | go til done
- movl #NMIRESET,%a0 | NMI keyboard reset addr
- movl #nmi,%a0@ | catch in reset routine
-
-/*
- * Determine our SPU type and look for internal HP-IB
- */
- lea _C_LABEL(machineid),%a0
- movl #0x808,%d0
- movc %d0,%cacr | clear and disable on-chip cache(s)
- movl #0x200,%d0 | data freeze bit
- movc %d0,%cacr | only exists on 68030
- movc %cacr,%d0 | read it back
- tstl %d0 | zero?
- jeq not68030 | yes, we have 68020/68040
-
- /*
- * 68030 models
- */
-
- .chip 68030
- movl #0x808,%d0
- movc %d0,%cacr | clear data freeze bit again
- movl #0x80,MMUCMD | set magic cookie
- movl MMUCMD,%d0 | read it back
- btst #7,%d0 | cookie still on?
- jeq not370 | no, 360 or 375
- movl #HP_370,%a0@ | consider a 370 for now
- movl #0,MMUCMD | clear magic cookie
- movl MMUCMD,%d0 | read it back
- btst #7,%d0 | still on?
- jeq ihpibcheck | no, a 370
- movl #HP_340,%a0@ | yes, must be a 340
- jra ihpibcheck
-
-not370:
- movl #HP_36X,%a0@ | type is at least a 360
- movl #0,MMUCMD | clear magic cookie2
- movl MMUCMD,%d0 | read it back
- btst #16,%d0 | still on?
- jeq ihpibcheck | no, a 360 or a 362
- lsrl #MMUID_SHIFT,%d0 | save MMU ID
- andl #MMUID_MASK,%d0
- movl %d0,_C_LABEL(mmuid) | save mmuid
- cmpb #MMUID_345,%d0 | are we a 345?
- jeq isa345
- cmpb #MMUID_375,%d0 | how about a 375?
- jeq isa375
- movl #HP_400,%a0@ | must be a 400
- jra ihpibcheck
-isa345:
- movl #HP_345,%a0@
- jra ihpibcheck
-isa375:
- movl #HP_375,%a0@
- jra ihpibcheck
- .chip 68020
-
- /*
- * End of 68030 section
- */
-
-not68030:
- bset #31,%d0 | data cache enable bit
- movc %d0,%cacr | only exists on 68040
- movc %cacr,%d0 | read it back
- tstl %d0 | zero?
- beq is68020 | yes, we have 68020
- moveq #0,%d0 | now turn it back off
- movec %d0,%cacr | before we access any data
-
- /*
- * 68040 models
- */
-
- .chip 68040
- movc %d0,%itt0
- movc %d0,%itt1
- movc %d0,%dtt0
- movc %d0,%dtt1
- cinva %bc
- movl MMUCMD,%d0 | get MMU ID
- lsrl #MMUID_SHIFT,%d0
- andl #MMUID_MASK,%d0
- movl %d0,_C_LABEL(mmuid) | save mmuid
- cmpb #MMUID_425_T,%d0 | are we a 425t?
- jeq isa425
- cmpb #MMUID_425_S,%d0 | how about 425s?
- jeq isa425
- cmpb #MMUID_425_E,%d0 | or maybe a 425e?
- jeq isa425
- cmpb #MMUID_433_T,%d0 | or a 433t?
- jeq isa433
- cmpb #MMUID_433_S,%d0 | maybe a 433s?
- jeq isa433
- cmpb #MMUID_385,%d0 | then a 385?
- jeq isa385
- cmpb #MMUID_382,%d0 | last chance...
- jeq isa382
- movl #HP_380,%a0@ | guess we are a 380
- jra ihpibcheck
-isa425:
- movl #HP_425,%a0@
- jra ihpibcheck
-isa433:
- movl #HP_433,%a0@
- jra ihpibcheck
-isa385:
- movl #HP_385,%a0@
- jra ihpibcheck
-isa382:
- movl #HP_382,%a0@
- jra ihpibcheck
- .chip 68020
-
- /*
- * End 68040 section
- */
-
- /*
- * 68020 models
- */
-
-is68020:
- movl #HP_330,%a0@ | consider a 330 for now
- movl #1,MMUCMD | a 68020, write HP MMU location
- movl MMUCMD,%d0 | read it back
- btst #0,%d0 | zero?
- jeq ihpibcheck | yes, a 330
- movl #HP_320,%a0@ | no, consider a 320 for now
- movl #0x80,MMUCMD | set magic cookie
- movl MMUCMD,%d0 | read it back
- btst #7,%d0 | cookie still on?
- jeq ihpibcheck | no, just a 320
- movl #HP_350,%a0@ | yes, a 350
-
- /*
- * End 68020 section
- */
-
-ihpibcheck:
- movl #0,MMUCMD | make sure MMU is off
- btst #5,SYSFLAG | do we have an internal HP-IB?
- jeq boottype | yes, continue
- clrl _C_LABEL(internalhpib) | no, clear the internal address
-/*
- * If this is a reboot, extract howto/bootdev stored by kernel
- */
-boottype:
- cmpw #12,BOOTTYPE | is this a reboot (REQ_REBOOT)?
- jne notreboot | no, skip
- lea MAXADDR,%a0 | find last page
- movl %a0@+,%d7 | and extract howto, bootdev
- movl %a0@+,%d6 | from where doboot() left them
- jra boot1
-/*
- * At this point we do not know which logical device the MSUS select
- * code refers to so we cannot construct bootdev. So we just punt
- * and let configure() construct it.
- */
-notreboot:
- moveq #0,%d6 | make sure bootdev is invalid
- cmpw #18,BOOTTYPE | does the user want to interact?
- jeq askme | yes, go to it
- moveq #0,%d7 | default to RB_AUTOBOOT
- jra boot1
-askme:
- moveq #3,%d7 | default to RB_SINGLE|RB_ASKNAME
-boot1:
- movl %d6,_C_LABEL(bootdev) | save bootdev and howto
- movl %d7,_C_LABEL(howto) | globally so all can access
- movl LOWRAM,%d0 | read lowram value from bootrom
- /*
- * Must preserve the scratch area for the BOOT ROM.
- * Round up to the next 8k boundary.
- */
- addl #((2*PAGE_SIZE)-1),%d0
- andl #-(2*PAGE_SIZE),%d0
- movl %d0,_C_LABEL(lowram) | stash that value
-start:
- movl #_C_LABEL(edata),%a2 | start of BSS
- movl #_C_LABEL(end),%a3 | end
-1:
- clrb %a2@+ | clear BSS
- cmpl %a2,%a3 | done?
- bne 1b | no, keep going
- jsr _C_LABEL(configure) | configure critical devices
- jsr _C_LABEL(main) | lets go
-GLOBAL(_rtt)
- movl #3,_C_LABEL(howto) | restarts get RB_SINGLE|RB_ASKNAME
- jmp start
-
-/*
- * probe a location and see if it causes a bus error
- */
-ENTRY_NOPROFILE(badaddr)
- movl BUSERR,_C_LABEL(_bsave) | save ROM bus error handler address
- movl %sp,_C_LABEL(_ssave) | and current stack pointer
- movl #catchbad,BUSERR | plug in our handler
- movl %sp@(4),%a0 | address to probe
- movw %a0@,%d1 | do it
- movl _C_LABEL(_bsave),BUSERR | if we got here, it did not fault
- clrl %d0 | return that this was not a bad addr
- rts
-
-catchbad:
- movl _C_LABEL(_bsave),BUSERR | got a bus error, so restore
- | old handler
- movl _C_LABEL(_ssave),%sp | manually restore stack
- moveq #1,%d0 | indicate that we got a fault
- rts | return to caller of badaddr()
-
- .data
-GLOBAL(_bsave)
- .long 0
-
-GLOBAL(_ssave)
- .long 0
-
-ASENTRY_NOPROFILE(__trap)
- moveml #0xFFFF,%sp@- | save registers
- movl %sp,%sp@- | push pointer to frame
- jsr _C_LABEL(trap) | call C routine to deal with it
- tstl %d0
- jeq Lstop
- addql #4,%sp
- moveml %sp@+,#0x7FFF
- addql #8,%sp
- rte
-Lstop:
- stop #0x2700 | stop cold
-
-ASENTRY_NOPROFILE(nmi)
- movw #18,BOOTTYPE | mark as system switch
- jsr _C_LABEL(kbdnmi) | clear the interrupt, and
- | reset the system
- stop #0 | SCREEEECH!
-
-ENTRY_NOPROFILE(call_req_reboot)
- jmp 0x1A4 | call ROM reboot function
- rts | XXX: just in case?
-
-ENTRY_NOPROFILE(romout)
- movl %sp@(4),%d0 | line number
- movl %sp@(8),%a0 | string
- jsr 0x150 | do it
- rts
diff --git a/sys/arch/hp300/stand/uboot/tgets.c b/sys/arch/hp300/stand/uboot/tgets.c
deleted file mode 100644
index eb852ecfe4c..00000000000
--- a/sys/arch/hp300/stand/uboot/tgets.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* $OpenBSD: tgets.c,v 1.3 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: tgets.c,v 1.4 1994/10/26 07:28:05 cgd Exp $ */
-
-/*-
- * Copyright (c) 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.
- *
- * @(#)gets.c 8.1 (Berkeley) 6/11/93
- */
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-int tgetchar(void);
-
-int
-tgetchar()
-{
- int c;
-
- if ((c = cngetc()) == 0)
- return(0);
-
- if (c == '\r')
- c = '\n';
- else if (c == ('c'&037)) {
- panic("^C");
- /* NOTREACHED */
- }
- return(c);
-}
-
-int
-tgets(char *buf)
-{
- int c;
- int i;
- char *lp = buf;
-
- for (i = 240000; i > 0; i--) {
- c = tgetchar() & 0177;
- if (c) {
- for (;;) {
- switch (c) {
- case '\n':
- case '\r':
- *lp = '\0';
- putchar('\n');
- return (1);
- case '\b':
- case '\177':
- if (lp > buf) {
- lp--;
- putchar('\b');
- putchar(' ');
- putchar('\b');
- }
- break;
- case '#':
- if (lp > buf)
- --lp;
- break;
- case 'r' & 037:
- {
- char *p;
- putchar('\n');
- for (p = buf; p < lp; ++p)
- putchar(*p);
- }
- break;
- case '@':
- case 'u' & 037:
- case 'w' & 037:
- lp = buf;
- putchar('\n');
- break;
- default:
- *lp++ = c;
- putchar(c);
- }
- c = getchar() & 0177;
- }
- }
- }
- return (0);
-}
diff --git a/sys/arch/hp300/stand/uboot/uboot.c b/sys/arch/hp300/stand/uboot/uboot.c
deleted file mode 100644
index edf1485aaa9..00000000000
--- a/sys/arch/hp300/stand/uboot/uboot.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/* $OpenBSD: uboot.c,v 1.7 2014/02/23 19:22:40 miod Exp $ */
-/* $NetBSD: uboot.c,v 1.3 1997/04/27 21:17:13 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 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.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <sys/stat.h>
-#define _KERNEL
-#include <sys/fcntl.h>
-#undef _KERNERL
-
-#include <machine/exec.h>
-#include <a.out.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-/*
- * Boot program... bits in `howto' determine whether boot stops to
- * ask for system name. Boot device is derived from ROM provided
- * information.
- */
-
-char line[100];
-
-extern u_int opendev;
-extern char *lowram;
-extern int noconsole;
-
-extern const char version[];
-
-extern int devparse(const char *, int *, int *, int *, int *, int *, char **);
-
-/*
- * XXX UFS accepts a /, NFS doesn't.
- */
-char *name;
-char *names[] = {
- "bsd"
-};
-#define NUMNAMES (sizeof(names) / sizeof(char *))
-
-static int bdev, badapt, bctlr, bunit, bpart;
-
-void boot(char *, void *, int);
-void getbootdev(int *);
-int loadrandom(const char *, void *, size_t);
-
-char rnddata[BOOTRANDOM_MAX];
-
-int
-main(void)
-{
- int currname = 0;
-
- printf("\n>> OpenBSD [%dKB] UNIFIED BOOT %s HP 9000/%s CPU\n",
- (__LDPGSZ / 1024), version, getmachineid());
- printf(">> Enter \"reset\" to reset system.\n");
-
- bdev = B_TYPE(bootdev);
- badapt = B_ADAPTOR(bootdev);
- bctlr = B_CONTROLLER(bootdev);
- bunit = B_UNIT(bootdev);
- bpart = B_PARTITION(bootdev);
-
- for (;;) {
- name = names[currname++];
- if (currname == NUMNAMES)
- currname = 0;
-
- if (!noconsole) {
- howto = 0;
- getbootdev(&howto);
- } else
- printf(": %s\n", name);
-
- boot(name, lowram, howto);
- printf("boot: %s\n", strerror(errno));
- }
- return (0);
-}
-
-void
-getbootdev(int *howto)
-{
- char c, *ptr = line;
-
- printf("Boot: [[[%s%d%c:]%s][-acds]] :- ",
- devsw[bdev].dv_name, bctlr + (8 * badapt), 'a' + bpart, name);
-
- if (tgets(line)) {
- if (strcmp(line, "reset") == 0) {
- call_req_reboot(); /* reset machine */
- printf("panic: can't reboot, halting\n");
- asm("stop #0x2700");
- }
- while ((c = *ptr) != '\0') {
- while (c == ' ')
- c = *++ptr;
- if (!c)
- return;
- if (c == '-')
- while ((c = *++ptr) && c != ' ')
- switch (c) {
- case 'a':
- *howto |= RB_ASKNAME;
- continue;
- case 'b':
- *howto |= RB_HALT;
- continue;
- case 'c':
- *howto |= RB_CONFIG;
- continue;
- case 'd':
- *howto |= RB_KDB;
- continue;
- case 's':
- *howto |= RB_SINGLE;
- continue;
- }
- else {
- name = ptr;
- while ((c = *++ptr) && c != ' ');
- if (c)
- *ptr++ = 0;
- }
- }
- } else
- printf("\n");
-}
-
-void
-boot(char *path, void *loadaddr, int howto)
-{
- static int rnd_loaded = 0;
- char rndpath[MAXPATHLEN];
- int dev, adapt, ctlr, unit, part;
- char *fname;
-
- /*
- * Try and load randomness from the boot device if this is a disk.
- */
- if (rnd_loaded == 0) {
- if (devparse(path, &dev, &adapt, &ctlr, &unit, &part,
- &fname) != 0) {
- /*
- * If the device name is bogus, devlookup() has
- * complained loudly. No need to attempt to load a
- * kernel from the same string.
- */
- return;
- }
- if (fname - path < sizeof(rndpath)) {
- memcpy(rndpath, path, fname - path);
- rndpath[fname - path] = '\0';
- strlcat(rndpath, BOOTRANDOM, sizeof rndpath);
- rnd_loaded = loadrandom(rndpath, rnddata,
- sizeof(rnddata));
- }
- }
-
- exec(path, loadaddr, howto);
-}
-
-int
-loadrandom(const char *path, void *buf, size_t buflen)
-{
- struct stat sb;
- int fd;
- int rc = 0;
-
- fd = open(path, O_RDONLY);
- if (fd == -1) {
- if (errno != EPERM)
- printf("cannot open %s: %s\n", path, 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;
-}