user.
KNOWN NOT WORKING:
* DIO-II devices
* Dynamic executables
NOT EVEN TRIED:
* New config support
+$OpenBSD: Debug.tips,v 1.2 1997/01/12 15:12:08 downsj Exp $
$NetBSD: Debug.tips,v 1.2 1994/10/26 07:22:49 cgd Exp $
NOTE: this description applies to the hp300 system with the old BSD
+$OpenBSD: HPMMU.notes,v 1.2 1997/01/12 15:12:09 downsj Exp $
$NetBSD: HPMMU.notes,v 1.2 1994/10/26 07:22:51 cgd Exp $
Overview:
-$NetBSD: Options,v 1.3 1994/10/26 07:22:52 cgd Exp $
+$OpenBSD: Options,v 1.2 1997/01/12 15:12:10 downsj Exp $
+$NetBSD: Options,v 1.5 1996/10/13 16:52:40 christos Exp $
Here is a list of hp300 specific kernel compilation options and what they
mean:
+$OpenBSD: Pmap.notes,v 1.2 1997/01/12 15:12:10 downsj Exp $
$NetBSD: Pmap.notes,v 1.2 1994/10/26 07:22:54 cgd Exp $
Following are some observations about the the BSD hp300 pmap module that
+$OpenBSD: README,v 1.2 1997/01/12 15:12:11 downsj Exp $
$NetBSD: README,v 1.2 1994/10/26 07:22:55 cgd Exp $
This directory contains random snippets related to various hp300 issues.
+$OpenBSD: TODO.dev,v 1.2 1997/01/12 15:12:11 downsj Exp $
$NetBSD: TODO.dev,v 1.2 1994/10/26 07:22:57 cgd Exp $
[ this is old -- mike ]
+$OpenBSD: TODO.hp300,v 1.2 1997/01/12 15:12:12 downsj Exp $
$NetBSD: TODO.hp300,v 1.2 1994/10/26 07:22:59 cgd Exp $
1. Create and use an interrupt stack.
+# $OpenBSD: Makefile,v 1.2 1997/01/12 15:12:06 downsj Exp $
# $NetBSD: Makefile,v 1.5 1995/08/04 07:40:31 thorpej Exp $
-
# @(#)Makefile 7.3 (Berkeley) 6/9/91
# Makefile for hp300 tags file and boot blocks
-# $NetBSD: DISKLESS,v 1.5 1995/12/29 17:12:50 thorpej Exp $
+# $OpenBSD: DISKLESS,v 1.8 1997/01/12 15:12:13 downsj Exp $
+# $NetBSD: DISKLESS,v 1.11 1996/12/11 09:10:38 thorpej Exp $
#
# Diskless HP 9000/300-series workstation.
#
options FPSP # floating point interface for 68040
options USELEDS # make the lights twinkle
#options PANICBUTTON # two fast <reset>s on HIL dump kernel
+options UK_KEYBOARD # include United Kingdom HIL keymap
+options SE_KEYBOARD # include Swedish HIL keymap
#
# HP-UX binary compatibility.
#
options COMPAT_HPUX # HP-UX binary compatibility
+#options "COMPAT_M68K4K" # compat. with NetBSD/m68k4k binaries
+
# Debugging options
options DDB # Kernel Dynamic Debugger
-# $NetBSD: GENERIC,v 1.9 1996/02/24 00:54:53 thorpej Exp $
+# $OpenBSD: GENERIC,v 1.10 1997/01/12 15:12:13 downsj Exp $
+# $NetBSD: GENERIC,v 1.16 1996/12/11 09:10:40 thorpej Exp $
#
# Generic kernel - one size fits all.
#
options COMPAT_NOLABEL # defaults for unlabeled disks
#options PANICBUTTON # two fast <reset>s on HIL dump kernel
#options CONSCODE="9" # force console at this select code
+options UK_KEYBOARD # include United Kingdom HIL keymap
+options SE_KEYBOARD # include Swedish HIL keymap
#
# HP-UX binary compatibility.
# Debugging options
options DDB # Kernel Dynamic Debugger
-# If the kernel isn't named `GENERIC', uncomment the line below.
-#options GENERIC # Generic swap support
config bsd swap generic
master hpib0 at scode7
-# $NetBSD: Makefile.hp300,v 1.39 1996/05/11 16:12:02 mycroft Exp $
+# $OpenBSD: Makefile.hp300,v 1.10 1997/01/12 15:12:14 downsj Exp $
+# $NetBSD: Makefile.hp300,v 1.45 1996/12/01 06:12:30 jonathan Exp $
-# Makefile for NetBSD
+# Makefile for OpenBSD
#
# This makefile is constructed from a machine description:
# config machineid
# DEBUG is set to -g if debugging.
# PROF is set to -pg if profiling.
-AS?= as
CC?= cc
-CPP?= cpp
LD?= ld
-STRIP?= strip -d
-TOUCH?= touch -f -c
+MKDEP?= mkdep
+STRIP?= strip
+COPTS?= -O2
# source tree is located via $S relative to the compilation directory
S= ../../../..
HP300= ../..
-INCLUDES= -I. -I$S/arch -I$S
-CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Dhp300 -DFPCOPROC
-CFLAGS= ${DEBUG} -O2 -Werror -msoft-float
+INCLUDES= -I. -I$S/arch -I$S -nostdinc
+CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
+ -Dmc68020 -Dhp300 -DFPCOPROC
+CWARNFLAGS= -Werror
+CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE
LINKFLAGS= -n -Ttext 0 -e start
+STRIPFLAGS= -d
+
+HOSTED_CC= ${CC}
+HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
+HOSTED_CFLAGS= ${CFLAGS}
### find out what to use for libkern
.include "$S/lib/libkern/Makefile.inc"
### for the Motorola 68040 Floating Point Software Product
.include "$S/arch/m68k/fpsp/Makefile.inc"
-# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
-# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
-# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
-# is marked as config-dependent.
+# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
+# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-
-DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-
NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
-NORMAL_S_C= ${CC} ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $<
+
+HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
%OBJS
LINKFLAGS+= -X
SYSTEM_LD_TAIL+=; \
echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
- echo ${STRIP} $@; ${STRIP} $@
+ echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
.else
-LINKFLAGS+= -x
+LINKFLAGS+= -S
.endif
%LOAD
${CC} -o $@ genassym.o
genassym.o: ${HP300}/hp300/genassym.c
- ${NORMAL_C_C}
+ ${HOSTED_C}
param.c: $S/conf/param.c
rm -f param.c
cp $S/conf/param.c .
param.o: param.c Makefile
- ${NORMAL_C_C}
+ ${NORMAL_C}
ioconf.o: ioconf.c
${NORMAL_C}
[Ee]rrs linterrs makelinks genassym genassym.o assym.h
lint:
- @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
+ @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \
${HP300}/hp300/Locore.c ${CFILES} ${HP300}/hp300/swapgeneric.c \
ioconf.c param.c | \
grep -v 'static function .* unused'
param.c ioconf.c ${CFILES} ${SFILES}
depend:: .depend
.depend: ${SRCS} assym.h param.c
- mkdep ${AFLAGS} ${CPPFLAGS} ${HP300}/hp300/locore.s
- mkdep -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
+ ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${HP300}/hp300/locore.s
+ ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
-if test -n "${SFILES}"; then \
- mkdep -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
+ ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
fi
- mkdep -a ${CFLAGS} ${CPPFLAGS} ${PARAM} ${HP300}/hp300/genassym.c
+ ${MKDEP} -a ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} \
+ ${HP300}/hp300/genassym.c
# depend on root or device configuration
--- /dev/null
+# $OpenBSD: NEWCONFIG,v 1.1 1997/01/12 15:12:14 downsj Exp $
+# $NetBSD: NEWCONFIG,v 1.1 1996/12/17 08:40:56 thorpej Exp $
+#
+# "Generic" kernel for new-style config.
+#
+
+# Include attributes common to all hp300s
+include "arch/hp300/conf/std.hp300"
+
+# Support for various CPU types
+options HP320
+options HP330 # includes 318, 319
+options HP340
+options HP350
+options HP360
+options HP370
+options HP375 # includes 345, 400t, 400s
+options HP380 # includes 425t, 425s, 433s
+
+# Need to set locally
+maxusers 32
+
+# Standard system options
+options COMPAT_43 # compatibility with 4.3BSD interfaces
+options COMPAT_44 # compatibility with 4.4BSD binaries
+options COMPAT_09 # compatibility with NetBSD 0.9
+options COMPAT_10 # compatibility with NetBSD 1.0
+options COMPAT_11 # compatibility with NetBSD 1.1
+options COMPAT_12 # compatibility with NetBSD 1.2
+options SYSVSHM # System V-style shared memory
+options SYSVSEM # System V-style semaphores
+options SYSVMSG # System V-style message queues
+options KTRACE # system call tracing support
+options "NKMEMCLUSTERS=1024" # # 4K pages in kernel malloc pool
+
+# Filesystem options
+options FIFO # POSIX fifo support (in all filesystems)
+options FFS,QUOTA # fast filesystem with user and group quotas
+options CD9660 # CD-ROM ISO-9660 filesystem
+options NFSSERVER # Network filesystem server
+options NFSCLIENT # Network filesystem client
+options UNION # Union filesystem (req. for FDESC)
+options KERNFS # kernel data-structure filesystem
+options FDESC # user file descriptor filesystem
+options PROCFS # /proc filesystem
+options MFS # Memory-based filesystem
+
+# Networking options
+options INET # Internet protocols
+options GATEWAY # IP forwarding + larger mb_map
+options MROUTING # Multicast routing
+options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
+
+# Options for HP hardware
+options FPSP # floating point interface for 68040
+options USELEDS # make the lights twinkle
+options COMPAT_NOLABEL # defaults for unlabeled disks
+#options PANICBUTTON # two fast <reset>s on HIL dump kernel
+#options CONSCODE="9" # force console at this select code
+options UK_KEYBOARD # include United Kingdom HIL keymap
+options SE_KEYBOARD # include Swedish HIL keymap
+
+# This option enables a different copyin/copyout that uses page
+# mapping for large copies.
+#options MAPPEDCOPY # different copyin/copyout for large copies
+
+#
+# HP-UX binary compatibility.
+# NOTE: THIS IS STILL VERY EXPERIMENTAL. YOUR MILEAGE MAY VARY.
+#
+options COMPAT_HPUX # HP-UX binary compatibility
+
+options COMPAT_M68K4K # compat. with NetBSD/m68k4k binaries
+
+# Debugging options
+options DIAGNOSTIC # Extra kernel sanity checks
+#options DEBUG # Enable misc. kernel debugging code
+options DDB # Kernel Dynamic Debugger
+
+config netbsd swap generic
+
+mainbus0 at root # root "bus"
+
+intio0 at mainbus0 # internal i/o space
+dio0 at mainbus0 # DIO/DIO-II bus
+
+# Davinci framebuffer
+dvbox* at intio?
+dvbox* at dio? scode ?
+
+# Gatorbox framebuffer
+gbox* at intio?
+gbox* at dio? scode ?
+
+# Hyperion framebuffer
+hyper* at dio? scode ?
+
+# Renaissance framebuffer
+rbox* at intio?
+rbox* at dio? scode ?
+
+# Topcat/catseye framebuffers
+topcat* at intio?
+topcat* at dio? scode ?
+
+# Framebuffer abstraction
+grf* at dvbox?
+grf* at gbox?
+grf* at hyper?
+grf* at rbox?
+grf* at topcat?
+
+# Internal Terminal Emulator
+ite* at grf?
+
+dca0 at dio? scode 9 flags 1 # DCA serial interfaces
+dca* at dio? scode ?
+
+dcm* at dio? scode ? flags 0xe # DCM 4- or 8-port serial interfaces
+
+le* at dio? scode ? # LANCE ethernet interfaces
+
+#nhpib0 at dio? scode 7 # slow internal HP-IB
+#nhpib* at dio? scode ?
+
+#fhpib* at dio? scode ? # `fast' HP-IB
+
+#hpibbus* at nhpib?
+#hpibbus* at fhpib?
+
+#rd* at hpibbus? slave ? punit ? # HP-IB disks
+#ct* at hpibbus? slave ? punit ? # HP-IB cartridge tapes
+#mt* at hpibbus? slave ? punit ? # HP-IB 9-track tape
+#ppi0 at hpibbus0 slave 5 punit 0 # HP-IB plotter
+
+#oscsi* at dio? scode ? # Old HP SCSI
+
+#sd* at oscsi? target ? lun ? # SCSI disks
+#st* at oscsi? target ? lun ? # SCSI tapes
+#ac* at oscsi? target ? lun ? # SCSI changers
+
+pseudo-device pty 64 # pseudo ptys
+pseudo-device sl 4 # SLIP network interfaces
+pseudo-device ppp 4 # PPP network interfaces
+pseudo-device bpfilter 16 # Berkeley packet filter
+pseudo-device vnd 4 # vnode pseudo-disks
+pseudo-device ccd 4 # concatenated disk devices
+pseudo-device loop # loopback network interface
--- /dev/null
+# $OpenBSD: files.hp300,v 1.1 1997/01/12 15:12:15 downsj Exp $
+# $NetBSD: files.hp300,v 1.20 1996/12/17 08:40:57 thorpej Exp $
+#
+# hp300-specific configuration info
+
+# maxpartitions must be the first item in files.${ARCH}
+maxpartitions 8
+
+maxusers 2 8 64
+
+# NOTE! The order of these lines is significant! Don't change them
+# unless you absolutely know what you're doing!
+
+# Frame buffer attribute
+define grfdev { }
+
+# Frame buffer devices
+device dvbox: grfdev
+file arch/hp300/dev/grf_dv.c dvbox needs-flag
+
+device gbox: grfdev
+file arch/hp300/dev/grf_gb.c gbox needs-flag
+
+device hyper: grfdev
+file arch/hp300/dev/grf_hy.c hyper needs-flag
+
+device rbox: grfdev
+file arch/hp300/dev/grf_rb.c rbox needs-flag
+
+device topcat: grfdev
+file arch/hp300/dev/grf_tc.c topcat needs-flag
+
+# `grf' framebuffer abstraction
+device grf { }
+attach grf at grfdev
+file arch/hp300/dev/grf.c grf needs-flag
+file arch/hp300/dev/grf_subr.c grf
+
+# Internal Terminal Emulator
+device ite
+attach ite at grf
+file arch/hp300/dev/ite.c ite needs-flag
+file arch/hp300/dev/ite_subr.c ite
+
+#
+# Mainbus
+#
+
+device mainbus { }
+attach mainbus at root
+
+#
+# Internal i/o space
+#
+
+device intio { }
+attach intio at mainbus
+file arch/hp300/dev/intio.c intio
+
+# Internal i/o framebuffer attachments
+attach dvbox at intio with dvbox_intio
+attach gbox at intio with gbox_intio
+attach rbox at intio with rbox_intio
+attach topcat at intio with topcat_intio
+
+#
+# DIO bus
+#
+
+device dio { scode = -1 }
+attach dio at mainbus
+file arch/hp300/dev/dio.c dio
+
+# DIO framebuffer attachments
+attach dvbox at dio with dvbox_dio
+attach gbox at dio with gbox_dio
+attach hyper at dio with hyper_dio
+attach rbox at dio with rbox_dio
+attach topcat at dio with topcat_dio
+
+# DCA serial interface
+device dca: tty
+attach dca at dio
+file arch/hp300/dev/dca.c dca needs-flag
+
+# 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
+file arch/hp300/dev/if_le.c le
+
+# 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 rd: disk
+attach rd at hpibbus
+file arch/hp300/dev/rd.c rd needs-flag
+file arch/hp300/dev/rd_compat.c rd # XXX
+
+device ppi
+attach ppi at hpibbus
+file arch/hp300/dev/ppi.c ppi needs-flag
+
+# Old HP SCSI layer
+device oscsi { target = -1, lun = -1 }
+attach oscsi at dio
+file arch/hp300/dev/scsi.c scsi
+
+# Old HP SCSI devices
+device sd: disk
+attach sd at oscsi
+file arch/hp300/dev/sd.c sd needs-flag
+file arch/hp300/dev/sd_compat.c sd # XXX
+
+device st: tape
+attach st at oscsi
+file arch/hp300/dev/st.c st needs-flag
+
+device ac
+attach ac at oscsi
+file arch/hp300/dev/ac.c ac needs-flag
+
+# Human (Hilarious) Interface Loop
+# XXX should be a real device
+file arch/hp300/dev/hil.c
+file arch/hp300/dev/hil_keymaps.c
+
+#
+# Non-device files
+#
+
+file arch/hp300/hp300/autoconf.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/dkbad.c
+file arch/hp300/hp300/kgdb_glue.c kgdb compile-with "${NORMAL_C} -fno-defer-pop"
+file arch/hp300/hp300/kgdb_stub.c kgdb
+file arch/hp300/hp300/machdep.c
+file arch/hp300/hp300/isr.c
+file arch/hp300/hp300/mem.c
+file arch/hp300/hp300/pmap.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/hp300/disksubr.c
+file arch/hp300/dev/dma.c
+
+file arch/m68k/m68k/copy.s
+
+file dev/cons.c
+file dev/cninit.c
+
+file kludge_for_in_proto.c hy needs-flag
+
+#
+# HP-UX binary compatibility
+#
+include "compat/hpux/files.hpux"
+file arch/hp300/hp300/hpux_machdep.c compat_hpux
-# $NetBSD: files.hp300.oldconf,v 1.26.4.1 1996/06/10 06:51:58 thorpej Exp $
+# $OpenBSD: files.hp300.oldconf,v 1.6 1997/01/12 15:12:15 downsj Exp $
+# $NetBSD: files.hp300.oldconf,v 1.30 1997/01/05 04:41:48 thorpej Exp $
#
arch/hp300/hp300/autoconf.c standard
arch/hp300/hp300/clock.c standard
arch/hp300/hp300/conf.c standard
+arch/hp300/hp300/db_memrw.c optional ddb
arch/hp300/hp300/dkbad.c standard
arch/hp300/hp300/kgdb_glue.c optional kgdb compile-with "${NORMAL_C} -fno-defer-pop"
arch/hp300/hp300/kgdb_stub.c optional kgdb
-arch/hp300/hp300/machdep.c standard config-dependent
+arch/hp300/hp300/machdep.c standard
arch/hp300/hp300/isr.c standard
arch/hp300/hp300/mem.c standard
arch/hp300/hp300/pmap.c standard
arch/hp300/hp300/trap.c standard
arch/hp300/hp300/vm_machdep.c standard
arch/hp300/hp300/disksubr.c standard
+arch/hp300/dev/dio.c standard
arch/hp300/dev/grf_conf.c optional grf
arch/hp300/dev/grf_dv.c optional grf needs-count # XXX? d-d?
arch/hp300/dev/grf_gb.c optional grf needs-count # XXX? d-d?
arch/hp300/dev/ite.c optional ite needs-count # XXX? d-d?
arch/hp300/dev/ite_subr.c optional ite needs-count # XXX? d-d?
arch/m68k/m68k/copy.s standard
-arch/m68k/m68k/db_memrw.c optional ddb
dev/cons.c standard
dev/cninit.c standard
thisisfor_in_proto.c optional hy
--- /dev/null
+# $OpenBSD: std.hp300,v 1.1 1997/01/12 15:12:16 downsj Exp $
+# $NetBSD: std.hp300,v 1.1 1996/12/17 08:40:58 thorpej Exp $
+#
+# Options/devices that all hp300s should have
+#
+
+machine hp300 m68k
+
+# XXX new config glue, for now
+options NEWCONFIG
+
+options SWAPPAGER # swap pager (anonymous and swap space)
+options VNODEPAGER # vnode pager (mapped files)
+options DEVPAGER # device pager (mapped devices)
+
+options EXEC_AOUT # support for exec'ing a.out
+options EXEC_SCRIPT # support for #! scripts
--- /dev/null
+# $OpenBSD: Makefile,v 1.1 1997/01/12 15:12:17 downsj Exp $
+# $NetBSD: Makefile,v 1.1 1996/12/17 08:40:59 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
-/* $NetBSD: ac.c,v 1.4 1996/02/14 02:43:54 thorpej Exp $ */
+/* $OpenBSD: ac.c,v 1.4 1997/01/12 15:12:17 downsj Exp $
+/* $NetBSD: ac.c,v 1.6 1996/10/13 03:14:05 christos Exp $ */
/*
* Copyright (c) 1991 University of Utah.
+/* $OpenBSD: acioctl.h,v 1.2 1997/01/12 15:12:18 downsj Exp $ */
/* $NetBSD: acioctl.h,v 1.2 1994/10/26 07:23:25 cgd Exp $ */
/*
+/* $OpenBSD: acvar.h,v 1.2 1997/01/12 15:12:19 downsj Exp $ */
/* $NetBSD: acvar.h,v 1.2 1994/10/26 07:23:27 cgd Exp $ */
/*
-/* $NetBSD: ct.c,v 1.15 1996/02/14 02:44:02 thorpej Exp $ */
+/* $OpenBSD: ct.c,v 1.5 1997/01/12 15:12:19 downsj Exp $ */
+/* $NetBSD: ct.c,v 1.18 1996/10/14 07:14:11 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
sc->sc_dq.dq_slave = hd->hp_slave;
sc->sc_dq.dq_driver = &ctdriver;
sc->sc_flags |= CTF_ALIVE;
+
+ /* XXX Set device class. */
+ hd->hp_dev.dv_class = DV_TAPE;
}
int
+/* $OpenBSD: ctreg.h,v 1.4 1997/01/12 15:12:20 downsj Exp $ */
/* $NetBSD: ctreg.h,v 1.6 1996/02/09 18:00:35 scottr Exp $ */
/*
-/* $NetBSD: dca.c,v 1.23.4.1 1996/06/06 15:39:09 thorpej Exp $ */
+/* $OpenBSD: dca.c,v 1.6 1997/01/12 15:12:21 downsj Exp $ */
+/* $NetBSD: dca.c,v 1.31 1996/12/17 08:41:00 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996 Jason R. Thorpe. All rights reserved.
* @(#)dca.c 8.2 (Berkeley) 1/12/94
*/
-#include "dca.h"
-#if NDCA > 0
-
/*
* Driver for the 98626/98644/internal serial interface on hp300/hp400,
* based on the National Semiconductor INS8250/NS16550AF/WD16C552 UARTs.
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/syslog.h>
+#include <sys/device.h>
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <dev/cons.h>
+#ifndef NEWCONFIG
#include <hp300/dev/device.h>
+#endif
+
+#include <hp300/dev/dioreg.h>
+#include <hp300/dev/diovar.h>
+#include <hp300/dev/diodevs.h>
#include <hp300/dev/dcareg.h>
#include <hp300/hp300/isr.h>
-int dcamatch();
-void dcaattach();
-struct driver dcadriver = {
- dcamatch, dcaattach, "dca",
-};
-
struct dca_softc {
+ struct device sc_dev; /* generic device glue */
+#ifndef NEWCONFIG
struct hp_device *sc_hd; /* device info */
+#endif
struct dcadevice *sc_dca; /* pointer to hardware */
struct tty *sc_tty; /* our tty instance */
int sc_oflows; /* overflow counter */
#define DCA_HASFIFO 0x0004 /* indicates unit has FIFO */
#define DCA_ISCONSOLE 0x0008 /* indicates unit is console */
-} dca_softc[NDCA];
+};
+
+#ifdef NEWCONFIG
+int dcamatch __P((struct device *, struct cfdata *, void *));
+void dcaattach __P((struct device *, struct device *, void *));
+
+struct cfattach dca_ca = {
+ sizeof(struct dca_softc), dcamatch, dcaattach
+};
+
+struct cfdriver dca_cd = {
+ NULL, "dca", DV_TTY
+};
+#else /* ! NEWCONFIG */
+int dcamatch();
+void dcaattach();
+struct driver dcadriver = {
+ dcamatch, dcaattach, "dca",
+};
+
+#include "dca.h"
+struct dca_softc dca_softc[NDCA];
+#endif /* NEWCONFIG */
void dcastart();
int dcaparam();
int dcaintr __P((void *));
-int ndca = NDCA;
int dcadefaultrate = TTYDEF_SPEED;
int dcamajor;
void dcainit __P((struct dcadevice *, int));
+#ifdef NEWCONFIG
+int
+dcamatch(parent, match, aux)
+ struct device *parent;
+ struct cfdata *match;
+ void *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);
+}
+#else /* ! NEWCONFIG */
int
dcamatch(hd)
register struct hp_device *hd;
return (1);
}
+#endif /* NEWCONFIG */
+#ifdef NEWCONFIG
+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;
+#else /* ! NEWCONFIG */
void
dcaattach(hd)
register struct hp_device *hd;
int unit = hd->hp_unit;
struct dcadevice *dca = (struct dcadevice *)hd->hp_addr;
struct dca_softc *sc = &dca_softc[unit];
+ int scode = hd->hp_args->hw_sc;
+ int ipl = hd->hp_ipl;
+#endif /* NEWCONFIG */
- if (hd->hp_args->hw_sc == conscode) {
+ if (scode == conscode) {
+ dca = (struct dcadevice *)conaddr;
sc->sc_flags |= DCA_ISCONSOLE;
DELAY(100000);
* the console probe, so we have to fixup cn_dev here.
*/
cn_tab->cn_dev = makedev(dcamajor, unit);
+ } else {
+#ifdef NEWCONFIG
+ 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;
+ }
+#endif /* NEWCONFIG */
}
+ sc->sc_dca = dca;
+
+#ifdef NEWCONFIG
+ ipl = DIO_IPL(dca);
+ printf(" ipl %d", ipl);
+#else /* ! NEWCONFIG */
+ /* XXX Set the device class. */
+ hd->hp_dev.dv_class = DV_TTY;
+ bcopy(&hd->hp_dev, &sc->sc_dev, sizeof(struct device));
+#endif /* NEWCONFIG */
+
dca->dca_reset = 0xFF;
DELAY(100);
if ((dca->dca_iir & IIR_FIFO_MASK) == IIR_FIFO_MASK)
sc->sc_flags |= DCA_HASFIFO;
- sc->sc_dca = dca;
-
/* Establish interrupt handler. */
- isrlink(dcaintr, sc, hd->hp_ipl,
+ (void) isrlink(dcaintr, sc, ipl,
(sc->sc_flags & DCA_HASFIFO) ? ISRPRI_TTY : ISRPRI_TTYNOBUF);
sc->sc_flags |= DCA_ACTIVE;
+#ifdef NEWCONFIG
+ if (self->dv_cfdata->cf_flags)
+#else
if (hd->hp_flags)
+#endif
sc->sc_flags |= DCA_SOFTCAR;
/* Enable interrupts. */
* Print prefix of device name,
* let kgdb_connect print the rest.
*/
- printf("%s: ", sc->sc_hd->hp_xname);
+ printf("%s: ", sc->sc_dev.dv_xname);
kgdb_connect(1);
} else
printf("%s: kgdb enabled\n",
- sc->sc_hd->hp_xname);
+ sc->sc_dev.dv_xname);
}
}
#endif
u_char code;
int s, error = 0;
+#ifdef NEWCONFIG
+ if (unit >= dca_cd.cd_ndevs ||
+ (sc = dca_cd.cd_devs[unit]) == NULL)
+ return (ENXIO);
+#else
if (unit >= NDCA)
return (ENXIO);
-
sc = &dca_softc[unit];
+#endif /* NEWCONFIG */
+
if ((sc->sc_flags & DCA_ACTIVE) == 0)
return (ENXIO);
unit = DCAUNIT(dev);
+#ifdef NEWCONFIG
+ sc = dca_cd.cd_devs[unit];
+#else
sc = &dca_softc[unit];
+#endif
+
dca = sc->sc_dca;
tp = sc->sc_tty;
(*linesw[tp->t_line].l_close)(tp, flag);
int flag;
{
int unit = DCAUNIT(dev);
- struct dca_softc *sc = &dca_softc[unit];
- struct tty *tp = sc->sc_tty;
+ struct dca_softc *sc;
+ struct tty *tp;
int error, of;
+
+#ifdef NEWCONFIG
+ sc = dca_cd.cd_devs[unit];
+#else
+ sc = &dca_softc[unit];
+#endif
+ tp = sc->sc_tty;
of = sc->sc_oflows;
error = (*linesw[tp->t_line].l_read)(tp, uio, flag);
/*
* at interrupt time just exacerbates the problem.
*/
if (sc->sc_oflows != of)
- log(LOG_WARNING, "%s: silo overflow\n", sc->sc_hd->hp_xname);
+ log(LOG_WARNING, "%s: silo overflow\n", sc->sc_dev.dv_xname);
return (error);
}
struct uio *uio;
int flag;
{
+#ifdef NEWCONFIG
+ struct dca_softc *sc = dca_cd.cd_devs[DCAUNIT(dev)];
+ struct tty *tp = sc->sc_tty;
+#else
struct tty *tp = dca_softc[DCAUNIT(dev)].sc_tty;
+#endif
return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
}
dcatty(dev)
dev_t dev;
{
+#ifdef NEWCONFIG
+ struct dca_softc *sc = dca_cd.cd_devs[DCAUNIT(dev)];
+#else
+ struct dca_softc *sc = &dca_softc[DCAUNIT(dev)];
+#endif
- return (dca_softc[DCAUNIT(dev)].sc_tty);
+ return (sc->sc_tty);
}
int
void *arg;
{
struct dca_softc *sc = arg;
- int unit = sc->sc_hd->hp_unit;
+ int unit = sc->sc_dev.dv_unit;
register struct dcadevice *dca = sc->sc_dca;
register struct tty *tp = sc->sc_tty;
register u_char code;
if (code & IIR_NOPEND)
return (1);
log(LOG_WARNING, "%s: weird interrupt: 0x%x\n",
- sc->sc_hd->hp_xname, code);
+ sc->sc_dev.dv_xname, code);
/* fall through */
case IIR_MLSC:
dcamint(sc);
struct proc *p;
{
int unit = DCAUNIT(dev);
+#ifdef NEWCONFIG
+ struct dca_softc *sc = dca_cd.cd_devs[unit];
+#else
struct dca_softc *sc = &dca_softc[unit];
+#endif
struct tty *tp = sc->sc_tty;
struct dcadevice *dca = sc->sc_dca;
int error;
register struct termios *t;
{
int unit = DCAUNIT(tp->t_dev);
+#ifdef NEWCONFIG
+ struct dca_softc *sc = dca_cd.cd_devs[unit];
+#else
struct dca_softc *sc = &dca_softc[unit];
+#endif
struct dcadevice *dca = sc->sc_dca;
int cfcr, cflag = t->c_cflag;
int ospeed = ttspeedtab(t->c_ospeed, dcaspeedtab);
register struct tty *tp;
{
int s, c, unit = DCAUNIT(tp->t_dev);
+#ifdef NEWCONFIG
+ struct dca_softc *sc = dca_cd.cd_devs[unit];
+#else
struct dca_softc *sc = &dca_softc[unit];
+#endif
struct dcadevice *dca = sc->sc_dca;
s = spltty();
* Stop output on a line.
*/
/*ARGSUSED*/
-int
+void
dcastop(tp, flag)
register struct tty *tp;
int flag;
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_14;
- dca->dca_mcr |= MCR_IEN;
+ 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);
stat = dca_cn->dca_iir;
splx(s);
}
-#endif /* NDCA > 0 */
+/* $OpenBSD: dcareg.h,v 1.4 1997/01/12 15:12:21 downsj Exp $ */
/* $NetBSD: dcareg.h,v 1.6 1996/02/24 00:55:02 thorpej Exp $ */
/*
-/* $NetBSD: dcm.c,v 1.27.4.1 1996/06/06 15:39:11 thorpej Exp $ */
+/* $OpenBSD: dcm.c,v 1.6 1997/01/12 15:12:22 downsj Exp $ */
+/* $NetBSD: dcm.c,v 1.34 1996/12/17 08:41:01 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996 Jason R. Thorpe. All rights reserved.
* Test console support.
*/
-#include "dcm.h"
-#if NDCM > 0
/*
* 98642/MUX
*/
#include <sys/kernel.h>
#include <sys/syslog.h>
#include <sys/time.h>
+#include <sys/device.h>
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <dev/cons.h>
+#ifndef NEWCONFIG
#include <hp300/dev/device.h>
+#endif
+
+#include <hp300/dev/dioreg.h>
+#include <hp300/dev/diovar.h>
+#include <hp300/dev/diodevs.h>
#include <hp300/dev/dcmreg.h>
#include <hp300/hp300/isr.h>
#define DEFAULT_BAUD_RATE 9600
#endif
-int dcmmatch(), dcmparam();
-void dcmattach(), dcmstart();
-struct driver dcmdriver = {
- dcmmatch, dcmattach, "dcm",
-};
-
struct speedtab dcmspeedtab[] = {
0, BR_0,
50, BR_50,
#define NDCMPORT 4
struct dcm_softc {
+ struct device sc_dev; /* generic device glue */
+#ifndef NEWCONFIG
struct hp_device *sc_hd; /* device info */
+#endif
struct dcmdevice *sc_dcm; /* pointer to hardware */
struct tty *sc_tty[NDCMPORT]; /* our tty instances */
struct modemreg *sc_modem[NDCMPORT]; /* modem control */
#ifdef DCMSTATS
struct dcmstats sc_stats; /* metrics gathering */
#endif
-} dcm_softc[NDCM];
+};
+
+#ifdef NEWCONFIG
+int dcmmatch __P((struct device *, struct cfdata *, void *));
+void dcmattach __P((struct device *, struct device *, void *));
+
+struct cfattach dcm_ca = {
+ sizeof(struct dcm_softc), dcmmatch, dcmattach
+};
+
+struct cfdriver dcm_cd = {
+ NULL, "dcm", DV_TTY
+};
+#else /* ! NEWCONFIG */
+int dcmmatch();
+void dcmattach();
+
+struct driver dcmdriver = {
+ dcmmatch, dcmattach, "dcm",
+};
+
+#include "dcm.h"
+struct dcm_softc dcm_softc[NDCM];
+#endif /* NEWCONFIG */
+
+int dcmparam();
+void dcmstart();
void dcminit __P((struct dcmdevice *, int, int));
int dcmintr __P((void *));
+int dcmselftest __P((struct dcm_softc *));
+
+#ifdef NEWCONFIG
+int
+dcmmatch(parent, match, aux)
+ struct device *parent;
+ struct cfdata *match;
+ void *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);
+}
+#else /* ! NEWCONFIG */
int
dcmmatch(hd)
register struct hp_device *hd;
{
struct dcm_softc *sc = &dcm_softc[hd->hp_unit];
- struct dcmdevice *dcm;
- int i, timo = 0;
- int s, brd, mbits;
+ struct dcmdevice *dcm = (struct dcmdevice *)hd->hp_addr;
- dcm = (struct dcmdevice *)hd->hp_addr;
if ((dcm->dcm_rsid & 0x1f) != DCMID)
return (0);
- brd = hd->hp_unit;
-
sc->sc_hd = hd;
hd->hp_ipl = DCMIPL(dcm->dcm_ic);
-
- /*
- * Empirically derived self-test magic
- */
- s = spltty();
- 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)
- return (0);
- DELAY(50000); /* XXX why is this needed ???? */
- while ((dcm->dcm_iir & IIR_SELFT) == 0)
- if (++timo == 400000)
- return (0);
- DELAY(50000); /* XXX why is this needed ???? */
- if (dcm->dcm_stcon != ST_OK) {
- if (hd->hp_args->hw_sc != conscode)
- printf("dcm%d: self test failed: %x\n",
- brd, dcm->dcm_stcon);
- return (0);
- }
- dcm->dcm_ic = IC_ID;
- splx(s);
-
- return (1);
}
+#endif /* NEWCONFIG */
+#ifdef NEWCONFIG
+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, ipl;
+#else /* ! NEWCONFIG */
void
dcmattach(hd)
register struct hp_device *hd;
{
struct dcm_softc *sc = &dcm_softc[hd->hp_unit];
- struct dcmdevice *dcm;
- int i, timo = 0;
- int s, brd, mbits;
-
- dcm = sc->sc_dcm = (struct dcmdevice *)hd->hp_addr;
-
- brd = hd->hp_unit;
- if (hd->hp_args->hw_sc == conscode) {
+ struct dcmdevice *dcm = (struct dcmdevice *)hd->hp_addr;
+ int brd = hd->hp_unit;
+ int scode = hd->hp_args->hw_sc;
+ int i, mbits, ipl = hd->hp_ipl;
+#endif /* NEWCONFIG */
+
+ if (scode == conscode) {
+ dcm = (struct dcmdevice *)conaddr;
sc->sc_flags |= DCM_ISCONSOLE;
/*
* Note that we always assume port 1 on the board.
*/
cn_tab->cn_dev = makedev(dcmmajor, (brd << 2) | DCMCONSPORT);
+ } else {
+#ifdef NEWCONFIG
+ 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;
+ }
+#endif
+ }
+
+ sc->sc_dcm = dcm;
+
+#ifdef NEWCONFIG
+ ipl = DIO_IPL(dcm);
+ printf(" ipl %d", ipl);
+#else /* ! NEWCONFIG */
+ /* XXX Set the device class. */
+ hd->hp_dev.dv_class = DV_TTY;
+ bcopy(&hd->hp_dev, &sc->sc_dev, sizeof(struct device));
+#endif /* NEWCONFIG */
+
+ if (dcmselftest(sc)) {
+ printf("\n%s: self-test failed\n", sc->sc_dev.dv_xname);
+ return;
}
/* Extract configuration info from flags. */
+#ifdef NEWCONFIG
+ sc->sc_softCAR = self->dv_cfdata->cf_flags & DCM_SOFTCAR;
+ sc->sc_flags = self->dv_cfdata->cf_flags & DCM_FLAGMASK;
+#else
sc->sc_softCAR = (hd->hp_flags & DCM_SOFTCAR);
sc->sc_flags = (hd->hp_flags & DCM_FLAGMASK);
+#endif /* NEWCONFIG */
/* Mark our unit as configured. */
sc->sc_flags |= DCM_ACTIVE;
/* Establish the interrupt handler. */
- isrlink(dcmintr, sc, hd->hp_ipl, ISRPRI_TTY);
+ (void) isrlink(dcmintr, sc, ipl, ISRPRI_TTY);
if (dcmistype == DIS_TIMER)
dcmsetischeme(brd, DIS_RESET|DIS_TIMER);
dcminit(dcm, DCMPORT(DCMUNIT(kgdb_dev)),
kgdb_rate);
if (kgdb_debug_init) {
- printf("%s port %d: ", sc->sc_hd->hp_xname,
+ 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_hd->hp_xname,
+ sc->sc_dev.dv_xname,
DCMPORT(DCMUNIT(kgdb_dev)));
}
/* end could be replaced */
-#endif
+#endif /* KGDB_CHEAT */
}
-#endif
+#endif /* KGDB */
}
/* ARGSUSED */
brd = DCMBOARD(unit);
port = DCMPORT(unit);
+#ifdef NEWCONFIG
+ if (brd >= dcm_cd.cd_ndevs || port >= NDCMPORT ||
+ (sc = dcm_cd.cd_devs[brd]) == NULL)
+ return (ENXIO);
+#else /* ! NEWCONFIG */
if ((brd >= NDCM) || (port >= NDCMPORT))
return (ENXIO);
-
sc = &dcm_softc[brd];
+#endif /* NEWCONFIG */
+
if ((sc->sc_flags & DCM_ACTIVE) == 0)
return (ENXIO);
#ifdef DEBUG
if (dcmdebug & DDB_MODEM)
printf("%s: dcmopen port %d softcarr %c\n",
- sc->sc_hd->hp_xname, port,
+ sc->sc_dev.dv_xname, port,
(tp->t_state & TS_CARR_ON) ? '1' : '0');
#endif
#ifdef DEBUG
if (dcmdebug & DDB_OPENCLOSE)
printf("%s port %d: dcmopen: st %x fl %x\n",
- sc->sc_hd->hp_xname, port, tp->t_state, tp->t_flags);
+ 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);
board = DCMBOARD(unit);
port = DCMPORT(unit);
+#ifdef NEWCONFIG
+ sc = dcm_cd.cd_devs[board];
+#else
sc = &dcm_softc[board];
+#endif
tp = sc->sc_tty[port];
(*linesw[tp->t_line].l_close)(tp, flag);
#ifdef DEBUG
if (dcmdebug & DDB_OPENCLOSE)
printf("%s port %d: dcmclose: st %x fl %x\n",
- sc->sc_hd->hp_xname, port, tp->t_state, tp->t_flags);
+ sc->sc_dev.dv_xname, port, tp->t_state, tp->t_flags);
#endif
splx(s);
ttyclose(tp);
board = DCMBOARD(unit);
port = DCMPORT(unit);
+#ifdef NEWCONFIG
+ sc = dcm_cd.cd_devs[board];
+#else
sc = &dcm_softc[board];
+#endif
tp = sc->sc_tty[port];
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
board = DCMBOARD(unit);
port = DCMPORT(unit);
+#ifdef NEWCONFIG
+ sc = dcm_cd.cd_devs[board];
+#else
sc = &dcm_softc[board];
+#endif
tp = sc->sc_tty[port];
return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
board = DCMBOARD(unit);
port = DCMPORT(unit);
+#ifdef NEWCONFIG
+ sc = dcm_cd.cd_devs[board];
+#else
sc = &dcm_softc[board];
+#endif
return (sc->sc_tty[port]);
}
struct dcm_softc *sc = arg;
struct dcmdevice *dcm = sc->sc_dcm;
struct dcmischeme *dis = &sc->sc_scheme;
- int brd = sc->sc_hd->hp_unit;
+ int brd = sc->sc_dev.dv_unit;
int code, i;
int pcnd[4], mcode, mcnd[4];
#ifdef DEBUG
if (dcmdebug & DDB_INTR) {
printf("%s: dcmintr: iir %x pc %x/%x/%x/%x ",
- sc->sc_hd->hp_xname, code, pcnd[0], pcnd[1],
+ 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]);
#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_hd->hp_xname, port,
+ sc->sc_dev.dv_xname, port,
c&0xFF, c, stat&0xFF,
tp->t_flags, head, pp->r_tail);
#endif
#ifdef DEBUG
if (dcmdebug & (DDB_INPUT|DDB_SIOERR))
printf("%s port %d: dcmreadbuf: err: c%x('%c') s%x\n",
- sc->sc_hd->hp_xname, port,
+ sc->sc_dev.dv_xname, port,
stat, c&0xFF, c);
#endif
if (stat & (RD_BD | RD_FE))
else if (stat & RD_OVF)
log(LOG_WARNING,
"%s port %d: silo overflow\n",
- sc->sc_hd->hp_xname, port);
+ sc->sc_dev.dv_xname, port);
else if (stat & RD_OE)
log(LOG_WARNING,
"%s port %d: uart overflow\n",
- sc->sc_hd->hp_xname, port);
+ sc->sc_dev.dv_xname, port);
}
(*linesw[tp->t_line].l_rint)(c, tp);
}
#ifdef DEBUG
if (dcmdebug & DDB_MODEM)
printf("%s port %d: dcmmint: mcnd %x mcndlast %x\n",
- sc->sc_hd->hp_xname, port, mcnd, sc->sc_mcndlast[port]);
+ sc->sc_dev.dv_xname, port, mcnd, sc->sc_mcndlast[port]);
#endif
delta = mcnd ^ sc->sc_mcndlast[port];
sc->sc_mcndlast[port] = mcnd;
port = DCMPORT(unit);
board = DCMBOARD(unit);
+#ifdef NEWCONFIG
+ sc = dcm_cd.cd_devs[board];
+#else
sc = &dcm_softc[board];
+#endif
dcm = sc->sc_dcm;
tp = sc->sc_tty[port];
#ifdef DEBUG
if (dcmdebug & DDB_IOCTL)
printf("%s port %d: dcmioctl: cmd %x data %x flag %x\n",
- sc->sc_hd->hp_xname, port, cmd, *data, flag);
+ 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)
board = DCMBOARD(unit);
port = DCMPORT(unit);
+#ifdef NEWCONFIG
+ sc = dcm_cd.cd_devs[board];
+#else
sc = &dcm_softc[board];
+#endif
dcm = sc->sc_dcm;
/* check requested parameters */
#ifdef DEBUG
if (dcmdebug & DDB_PARAM)
printf("%s port %d: dcmparam: cflag %x mode %x speed %d uperch %d\n",
- sc->sc_hd->hp_xname, port, cflag, mode, tp->t_ospeed,
+ sc->sc_dev.dv_xname, port, cflag, mode, tp->t_ospeed,
DCM_USPERCH(tp->t_ospeed));
#endif
board = DCMBOARD(unit);
port = DCMPORT(unit);
+#ifdef NEWCONFIG
+ sc = dcm_cd.cd_devs[board];
+#else
sc = &dcm_softc[board];
+#endif
dcm = sc->sc_dcm;
s = spltty();
#ifdef DEBUG
if (dcmdebug & DDB_OUTPUT)
printf("%s port %d: dcmstart: state %x flags %x outcc %d\n",
- sc->sc_hd->hp_xname, port, tp->t_state, tp->t_flags,
+ 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))
#ifdef DEBUG
if (dcmdebug & DDB_INTR)
printf("%s port %d: dcmstart(%d): head %x tail %x outqcc %d\n",
- sc->sc_hd->hp_xname, port, head, tail, tp->t_outq.c_cc);
+ sc->sc_dev.dv_xname, port, head, tail, tp->t_outq.c_cc);
#endif
out:
#ifdef DCMSTATS
/*
* Stop output on a line.
*/
-int
+void
dcmstop(tp, flag)
register struct tty *tp;
int flag;
unit = DCMUNIT(dev);
brd = DCMBOARD(unit);
port = DCMPORT(unit);
+
+#ifdef NEWCONFIG
+ sc = dcm_cd.cd_devs[brd];
+#else
sc = &dcm_softc[brd];
+#endif
dcm = sc->sc_dcm;
#ifdef DEBUG
if (dcmdebug & DDB_MODEM)
printf("%s port %d: dcmmctl: bits 0x%x how %x\n",
- sc->sc_hd->hp_xname, port, bits, how);
+ sc->sc_dev.dv_xname, port, bits, how);
#endif
s = spltty();
dcmsetischeme(brd, flags)
int brd, flags;
{
+#ifdef NEWCONFIG
+ struct dcm_softc *sc = dcm_cd.cd_devs[brd];
+#else
struct dcm_softc *sc = &dcm_softc[brd];
+#endif
struct dcmdevice *dcm = sc->sc_dcm;
struct dcmischeme *dis = &sc->sc_scheme;
int i;
#ifdef DEBUG
if (dcmdebug & DDB_INTSCHM)
printf("%s: dcmsetischeme(%d): cur %d, ints %d, chars %d\n",
- sc->sc_hd->hp_xname, perchar, dis->dis_perchar,
+ 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: redundent request %d\n",
- sc->sc_hd->hp_xname, perchar);
+ sc->sc_dev.dv_xname, perchar);
return;
}
#endif
splx(s);
}
+/*
+ * Empirically derived self-test magic
+ */
+int
+dcmselftest(sc)
+ struct dcm_softc *sc;
+{
+ struct dcmdevice *dcm = sc->sc_dcm;
+ int i, timo = 0;
+ int s, brd, mbits;
+
+ s = spltty();
+ 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)
+ return (1);
+ DELAY(50000); /* XXX why is this needed ???? */
+ while ((dcm->dcm_iir & IIR_SELFT) == 0)
+ if (++timo == 400000)
+ return (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
+ return (1);
+ }
+ dcm->dcm_ic = IC_ID;
+ splx(s);
+
+ return (0);
+}
+
/*
* Following are all routines needed for DCM to act as console
*/
}
splx(s);
}
-#endif /* NDCM > 0 */
+/* $OpenBSD: dcmreg.h,v 1.3 1997/01/12 15:12:23 downsj Exp $ */
/* $NetBSD: dcmreg.h,v 1.5 1996/02/24 00:55:05 thorpej Exp $ */
/*
-/* $NetBSD: device.h,v 1.7 1996/02/14 02:44:14 thorpej Exp $ */
+/* $OpenBSD: device.h,v 1.4 1997/01/12 15:12:24 downsj Exp $ */
+/* $NetBSD: device.h,v 1.9 1996/10/20 23:47:40 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
* @(#)device.h 8.1 (Berkeley) 6/10/93
*/
+#include <sys/device.h>
+
struct driver {
int (*d_match)();
void (*d_attach)();
int hp_ipl;
struct hp_hw *hp_args;
char hp_xname[8];
+ struct device hp_dev;
};
struct hp_device {
int hp_alive;
int hp_ipl;
struct hp_hw *hp_args;
- char hp_xname[8];
+ struct device hp_dev;
};
+/* XXX until the code is cleaed up */
+#define hp_xname hp_dev.dv_xname
+
/* XXX This needs to die. */
struct devqueue {
struct devqueue *dq_forw;
extern struct hp_hw sc_table[];
extern struct hp_ctlr hp_cinit[];
extern struct hp_device hp_dinit[];
-extern caddr_t sctova(), sctopa(), iomap();
+extern caddr_t sctopa(), iomap();
#endif
#endif
--- /dev/null
+#! /usr/bin/awk -f
+#
+# $OpenBSD: devlist2h.awk,v 1.1 1997/01/12 15:12:24 downsj Exp $
+# $NetBSD: devlist2h.awk,v 1.1 1996/12/17 08:41:02 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
+}
--- /dev/null
+/* $OpenBSD: dio.c,v 1.1 1997/01/12 15:12:25 downsj Exp $ */
+/* $NetBSD: dio.c,v 1.1 1996/12/17 08:41:02 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * 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 <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 __P((struct dio_attach_args *));
+char *dio_devinfo __P((struct dio_attach_args *, char *, size_t));
+
+#ifdef NEWCONFIG
+int diomatch __P((struct device *, struct cfdata *, void *));
+void dioattach __P((struct device *, struct device *, void *));
+int dioprint __P((void *, const char *));
+int diosubmatch __P((struct device *, struct cfdata *, 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;
+ struct cfdata *match;
+ void *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, scmax, didmap, scodesize;
+
+ scmax = DIO_SCMAX(machineid);
+ printf("\n");
+
+ for (scode = 0; scode < scmax; ) {
+ if (DIO_INHOLE(scode)) {
+ scode++;
+ 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.
+ */
+ pa = dio_scodetopa(scode);
+ if (scode == conscode)
+ 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", 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;
+ da.da_id = DIO_ID(va);
+
+ 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, cf, aux)
+ struct device *parent;
+ struct cfdata *cf;
+ void *aux;
+{
+ 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);
+}
+#endif /* NEWCONFIG */
+
+/*
+ * 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_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 matchind 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;
+{
+ int i;
+
+ bzero(buf, buflen);
+
+ /*
+ * Deal with lame internal HP-IB controllers which don't have
+ * consistent/reliable device ids.
+ */
+ if (da->da_scode == 7 && internalhpib) {
+ sprintf(buf, 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:
+ sprintf(buf, "%s", dio_devdescs[i].dd_desc);
+ return (buf);
+ }
+ }
+ }
+#endif /* DIOVERBOSE */
+
+ /*
+ * Device is unknown. Construct something reasonable.
+ */
+ sprintf(buf, "device id = 0x%x secid = 0x%x",
+ da->da_id, da->da_secid);
+ return (buf);
+}
--- /dev/null
+$OpenBSD: diodevs,v 1.1 1997/01/12 15:12:25 downsj Exp $
+$NetBSD: diodevs,v 1.1 1996/12/17 08:41:03 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * 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 FHPIB 0x08 1 98625A/98625B HP-IB
+device NHPIB 0x80 1 98624A HP-IB
+device IHPIB 0x00 1 internal HP-IB
+
+device SCSI0 0x07 1 98625A SCSI
+device SCSI1 0x27 1 98625A SCSI
+device SCSI2 0x47 1 98625A SCSI
+device SCSI3 0x67 1 98625A 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 RENASSIANCE 0x04 2 98720/98721 (\"renassiance\") 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 HYPERION 0x0e 1 A1096A (\"hyperion\") display
+
+/* Unsupported framebuffers. */
+
+framebuffer XGENESIS 0x0b 1 x-genesis display
+framebuffer TIGER 0x0c 1 tiger 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 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
--- /dev/null
+/*
+ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
+ *
+ * generated from:
+ * NetBSD: diodevs,v 1.1 1996/12/17 08:41:03 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#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_FHPIB 0x08
+#define DIO_DEVICE_DESC_FHPIB "98625A/98625B HP-IB"
+
+#define DIO_DEVICE_ID_NHPIB 0x80
+#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 "98625A SCSI"
+
+#define DIO_DEVICE_ID_SCSI1 0x27
+#define DIO_DEVICE_DESC_SCSI1 "98625A SCSI"
+
+#define DIO_DEVICE_ID_SCSI2 0x47
+#define DIO_DEVICE_DESC_SCSI2 "98625A SCSI"
+
+#define DIO_DEVICE_ID_SCSI3 0x67
+#define DIO_DEVICE_DESC_SCSI3 "98625A 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_RENASSIANCE 0x04
+#define DIO_DEVICE_DESC_RENASSIANCE "98720/98721 (\"renassiance\") 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_TIGER 0x0c
+#define DIO_DEVICE_DESC_TIGER "tiger display"
+
+#define DIO_DEVICE_SECID_YGENESIS 0x0d
+#define DIO_DEVICE_DESC_YGENESIS "y-genesis display"
+
+/* 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_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"
--- /dev/null
+/*
+ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
+ *
+ * generated from:
+ * NetBSD: diodevs,v 1.1 1996/12/17 08:41:03 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define DIO_NDEVICES 45
+
+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 },
+ { 0x08, 0, 1 },
+ { 0x80, 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, 1 },
+ { 0x39, 0x0d, 1 },
+ { 0x03, 0, 1 },
+ { 0x04, 0, 1 },
+ { 0x06, 0, 1 },
+ { 0x09, 0, 1 },
+ { 0x0a, 0, 1 },
+ { 0x0b, 0, 1 },
+ { 0x12, 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 },
+ { 0x08, 0, DIO_DEVICE_DESC_FHPIB },
+ { 0x80, 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_RENASSIANCE },
+ { 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_TIGER },
+ { 0x39, 0x0d, DIO_DEVICE_DESC_YGENESIS },
+ { 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 },
+ { 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 */
--- /dev/null
+/* $OpenBSD: dioreg.h,v 1.1 1997/01/12 15:12:26 downsj Exp $ */
+/* $NetBSD: dioreg.h,v 1.1 1996/12/17 08:41:04 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * 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-63 at physical addresses given by:
+ * 0x600000 + (sc - 32) * 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 0x600000 /* start of DIO space */
+#define DIO_END 0x1000000 /* end of DIO space */
+#define DIO_DEVSIZE 0x10000 /* 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 device */
+
+/*
+ * Find the highest select code for a given machine; HP320 doesn't
+ * have DIO-II.
+ */
+#define DIO_SCMAX(machineid) ((machineid) == HP_320 ? 32 : 256)
+
+/*
+ * Macro that returns true if a select code lies within
+ * the select code `hole'.
+ */
+#define DIO_INHOLE(scode) ((scode) >= 32 && (scode) < 132)
+
+/*
+ * Macros to determine if device is DIO or DIO-II.
+ */
+#define DIO_ISDIO(scode) ((scode) >= 0 && (scode) < 32)
+#define DIO_ISDIOII(scode) ((scode) >= 132 && (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 decondary 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) \
+ * 0x100000))
+
+/*
+ * 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)
--- /dev/null
+/* $OpenBSD: diovar.h,v 1.1 1997/01/12 15:12:27 downsj Exp $ */
+/* $NetBSD: diovar.h,v 1.1 1996/12/17 08:41:05 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * 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 __P((int));
+#endif /* _KERNEL */
-/* $NetBSD: dma.c,v 1.7 1996/02/14 02:44:17 thorpej Exp $ */
+/* $OpenBSD: dma.c,v 1.4 1997/01/12 15:12:28 downsj Exp $ */
+/* $NetBSD: dma.c,v 1.10 1996/12/09 03:09:51 thorpej Exp $ */
/*
- * Copyright (c) 1995 Jason R. Thorpe.
+ * Copyright (c) 1995, 1996 Jason R. Thorpe. All rights reserved.
* Copyright (c) 1982, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
#include <hp300/hp300/isr.h>
-extern void isrlink();
extern void _insque();
extern void _remque();
extern u_int kvtop();
struct dmareg *sc_dmareg; /* pointer to our hardware */
struct dma_channel sc_chan[NDMACHAN]; /* 2 channels */
char sc_type; /* A, B, or C */
+ int sc_ipl; /* our interrupt level */
+ void *sc_ih; /* interrupt cookie */
} Dma_softc;
/* types */
*
* 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
- * DMAINTLVL is set to 3).
+ * splbio works out to ipl 3).
*/
if (badbaddr((char *)&dma->dma_id[2])) {
rev = 'B';
printf("%s: 98620%c, 2 channels, %d bit\n", sc->sc_xname,
rev, (rev == 'B') ? 16 : 32);
- /* Establish the interrupt handler */
- isrlink(dmaintr, sc, DMAINTLVL, ISRPRI_BIO);
+ /*
+ * Defer hooking up our interrupt until the first
+ * DMA-using controller has hooked up theirs.
+ */
+ sc->sc_ih = NULL;
+}
+
+/*
+ * Compute the ipl and (re)establish the interrupt handler
+ * for the DMA controller.
+ */
+void
+dmacomputeipl()
+{
+ struct dma_softc *sc = &Dma_softc;
+
+ if (sc->sc_ih != NULL)
+ isrunlink(sc->sc_ih);
+
+ /*
+ * Our interrupt level must be as high as the highest
+ * device using DMA (i.e. splbio).
+ */
+ sc->sc_ipl = PSLTOIPL(hp300_bioipl);
+ sc->sc_ih = isrlink(dmaintr, sc, sc->sc_ipl, ISRPRI_BIO);
}
int
/*
* Set up the command word based on flags
*/
- dc->dm_cmd = DMA_ENAB | DMA_IPL(DMAINTLVL) | DMA_START;
+ dc->dm_cmd = DMA_ENAB | DMA_IPL(sc->sc_ipl) | DMA_START;
if ((flags & DMAGO_READ) == 0)
dc->dm_cmd |= DMA_WRT;
if (flags & DMAGO_LWORD)
-/* $NetBSD: dmareg.h,v 1.6 1995/12/02 02:46:49 thorpej Exp $ */
+/* $OpenBSD: dmareg.h,v 1.3 1997/01/12 15:12:28 downsj Exp $ */
+/* $NetBSD: dmareg.h,v 1.7 1996/12/09 06:18:13 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
/* The hp300 has 2 DMA channels. */
#define NDMACHAN 2
-/* intr level must be >= level of any device using dma. i.e., splbio */
-#define DMAINTLVL 5
-
/* addresses */
#define DMA_BASE IIOV(0x500000)
-/* $NetBSD: dmavar.h,v 1.5 1995/03/28 18:16:03 jtc Exp $ */
+/* $OpenBSD: dmavar.h,v 1.2 1997/01/12 15:12:29 downsj Exp $ */
+/* $NetBSD: dmavar.h,v 1.6 1996/12/09 03:09:51 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
#ifdef _KERNEL
extern void dmago(), dmafree();
extern int dmareq();
+extern void dmacomputeipl __P((void));
#endif
-/* $NetBSD: fhpib.c,v 1.11 1996/05/18 23:56:59 thorpej Exp $ */
+/* $OpenBSD: fhpib.c,v 1.5 1997/01/12 15:12:29 downsj Exp $ */
+/* $NetBSD: fhpib.c,v 1.13 1996/10/13 03:14:10 christos Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
+/* $OpenBSD: fhpibreg.h,v 1.2 1997/01/12 15:12:30 downsj Exp $ */
/* $NetBSD: fhpibreg.h,v 1.4 1994/10/26 07:23:45 cgd Exp $ */
/*
-/* $NetBSD: grf.c,v 1.17 1996/02/24 00:55:07 thorpej Exp $ */
+/* $OpenBSD: grf.c,v 1.4 1997/01/12 15:12:31 downsj Exp $ */
+/* $NetBSD: grf.c,v 1.22 1997/01/10 00:07:27 scottr Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Hardware access is through the machine dependent grf switch routines.
*/
-#include "grf.h"
-#if NGRF > 0
-
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/ioctl.h>
#include <sys/malloc.h>
#include <sys/vnode.h>
#include <sys/mman.h>
+#include <sys/conf.h>
+#include <sys/device.h>
#include <machine/autoconf.h>
#include <machine/cpu.h>
#if NITE > 0
#include <hp300/dev/itevar.h>
#else
-#define iteon(u,f)
+#define iteon(u,f) 0 /* normally returns int */
#define iteoff(u,f)
#endif /* NITE > 0 */
+/* prototypes for the devsw entry points */
+cdev_decl(grf);
+
+#ifdef NEWCONFIG
+int grfmatch __P((struct device *, struct cfdata *, void *));
+void grfattach __P((struct device *, struct device *, void *));
+
+struct cfattach grf_ca = {
+ sizeof(struct grf_softc), grfmatch, grfattach
+};
+
+struct cfdriver grf_cd = {
+ NULL, "grf", DV_DULL
+};
+
+int grfprint __P((void *, const char *));
+#else /* ! NEWCONFIG */
+#include "grf.h"
struct grf_softc grf_softc[NGRF];
+#endif /* NEWCONFIG */
/*
* Frambuffer state information, statically allocated for benefit
#define GDB_LOCK 0x08
#endif
+#ifdef NEWCONFIG
+int
+grfmatch(parent, match, aux)
+ struct device *parent;
+ struct cfdata *match;
+ void *aux;
+{
+
+ return (1);
+}
+
+void
+grfattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct grf_softc *sc = (struct grf_softc *)self;
+ struct grfdev_attach_args *ga = aux;
+
+ printf("\n");
+
+ sc->sc_data = ga->ga_data;
+ sc->sc_scode = ga->ga_scode; /* XXX */
+
+ /* Attach an ITE. */
+ (void)config_found(self, aux, grfprint);
+}
+
+int
+grfprint(aux, pnp)
+ void *aux;
+ const char *pnp;
+{
+
+ /* Only ITEs can attach to GRFs, easy... */
+ if (pnp)
+ printf("ite at %s", pnp);
+
+ return (UNCONF);
+}
+#endif /* NEWCONFIG */
+
/*ARGSUSED*/
+int
grfopen(dev, flags, mode, p)
dev_t dev;
int flags, mode;
struct grf_data *gp;
int error = 0;
+#ifdef NEWCONFIG
+ if (unit >= grf_cd.cd_ndevs ||
+ (sc = grf_cd.cd_devs[unit]) == NULL)
+ return (ENXIO);
+#else
if (unit >= NGRF)
return(ENXIO);
-
sc = &grf_softc[unit];
+#endif
+
gp = sc->sc_data;
if ((gp->g_flags & GF_ALIVE) == 0)
}
/*ARGSUSED*/
+int
grfclose(dev, flags, mode, p)
dev_t dev;
int flags, mode;
struct grf_softc *sc;
struct grf_data *gp;
- if (unit >= NGRF)
- return(ENXIO);
-
+#ifdef NEWCONFIG
+ sc = grf_cd.cd_devs[unit];
+#else
sc = &grf_softc[unit];
+#endif
+
gp = sc->sc_data;
if ((gp->g_flags & GF_ALIVE) == 0)
}
/*ARGSUSED*/
+int
grfioctl(dev, cmd, data, flag, p)
dev_t dev;
- int cmd, flag;
+ u_long cmd;
+ int flag;
caddr_t data;
struct proc *p;
{
struct grf_data *gp;
int error, unit = GRFUNIT(dev);
- if (unit >= NGRF)
- return(ENXIO);
-
+#ifdef NEWCONFIG
+ sc = grf_cd.cd_devs[unit];
+#else
sc = &grf_softc[unit];
+#endif
+
gp = sc->sc_data;
if ((gp->g_flags & GF_ALIVE) == 0)
}
/*ARGSUSED*/
-grfselect(dev, rw)
+int
+grfselect(dev, rw, p)
dev_t dev;
int rw;
+ struct proc *p;
{
if (rw == FREAD)
return(0);
}
/*ARGSUSED*/
+int
grfmmap(dev, off, prot)
dev_t dev;
int off, prot;
{
- return(grfaddr(&grf_softc[GRFUNIT(dev)], off));
+#ifdef NEWCONFIG
+ struct grf_softc *sc = grf_cd.cd_devs[GRFUNIT(dev)];
+#else
+ struct grf_softc *sc = &grf_softc[GRFUNIT(dev)];
+#endif
+
+ return (grfaddr(sc, off));
}
int
struct grf_softc *sc;
struct grf_data *gp;
+#ifdef NEWCONFIG
+ sc = grf_cd.cd_devs[unit];
+#else
sc = &grf_softc[unit];
+#endif
gp = sc->sc_data;
/*
struct grf_data *gp;
int error;
+#ifdef NEWCONFIG
+ sc = grf_cd.cd_devs[unit];
+#else
sc = &grf_softc[unit];
+#endif
gp = sc->sc_data;
(void) grfunmap(dev, (caddr_t)0, curproc);
(dev&GRFOVDEV) ? GM_GRFOVOFF : GM_GRFOFF,
(caddr_t)0);
/* XXX: see comment for iteoff above */
- (void) iteon(sc->sc_ite->sc_data, 2);
+ iteon(sc->sc_ite->sc_data, 2);
return(error);
}
#ifdef COMPAT_HPUX
/*ARGSUSED*/
+int
hpuxgrfioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd, flag;
caddr_t data;
struct proc *p;
{
+#ifdef NEWCONFIG
+ struct grf_softc *sc = grf_cd.cd_devs[GRFUNIT(dev)];
+#else
struct grf_softc *sc = &grf_softc[GRFUNIT(dev)];
+#endif
struct grf_data *gp = sc->sc_data;
int error;
return(0);
}
+int
grfunlock(gp)
struct grf_data *gp;
{
* XXX: This may give the wrong result for remote stats of other
* machines where device 10 exists.
*/
+int
grfdevno(dev)
dev_t dev;
{
int unit = GRFUNIT(dev);
- struct grf_softc *sc = &grf_softc[unit];
- struct grf_data *gp = sc->sc_data;
+ struct grf_softc *sc;
+ struct grf_data *gp;
int newdev;
- if (unit >= NGRF || (gp->g_flags&GF_ALIVE) == 0)
- return(bsdtohpuxdev(dev));
+#ifdef NEWCONFIG
+ if (unit >= grf_cd.cd_ndevs ||
+ (sc = grf_cd.cd_devs[unit]) == NULL)
+ return (bsdtohpuxdev(dev));
+#else
+ if (unit >= NGRF)
+ return (bsdtohpuxdev(dev));
+ sc = &grf_softc[unit];
+#endif
+
+ gp = sc->sc_data;
+ if ((gp->g_flags & GF_ALIVE) == 0)
+ return (bsdtohpuxdev(dev));
+
/* magic major number */
newdev = 12 << 24;
/* now construct minor number */
- if (gp->g_display.gd_regaddr != (caddr_t)GRFIADDR) {
- int sc = patosc(gp->g_display.gd_regaddr);
- newdev |= (sc << 16) | 0x200;
- }
+ if (gp->g_display.gd_regaddr != (caddr_t)GRFIADDR)
+ newdev |= (sc->sc_scode << 16) | 0x200;
if (dev & GRFIMDEV)
newdev |= 0x02;
else if (dev & GRFOVDEV)
#endif /* COMPAT_HPUX */
+int
grfmap(dev, addrp, p)
dev_t dev;
caddr_t *addrp;
struct proc *p;
{
+#ifdef NEWCONFIG
+ struct grf_softc *sc = grf_cd.cd_devs[GRFUNIT(dev)];
+#else
struct grf_softc *sc = &grf_softc[GRFUNIT(dev)];
+#endif
struct grf_data *gp = sc->sc_data;
int len, error;
struct vnode vn;
caddr_t addr;
struct proc *p;
{
+#ifdef NEWCONFIG
+ struct grf_softc *sc = grf_cd.cd_devs[GRFUNIT(dev)];
+#else
struct grf_softc *sc = &grf_softc[GRFUNIT(dev)];
+#endif
struct grf_data *gp = sc->sc_data;
vm_size_t size;
int rv;
}
#ifdef COMPAT_HPUX
+int
iommap(dev, addrp)
dev_t dev;
caddr_t *addrp;
return(EINVAL);
}
+int
iounmmap(dev, addr)
dev_t dev;
caddr_t addr;
return(EINVAL);
}
#endif /* COMPAT_HPUX */
-
-#endif /* NGRF > 0 */
-/* $NetBSD: grf_conf.c,v 1.3 1996/02/24 00:55:08 thorpej Exp $ */
+/* $OpenBSD: grf_conf.c,v 1.3 1997/01/12 15:12:31 downsj Exp $ */
+/* $NetBSD: grf_conf.c,v 1.4 1996/12/17 08:41:06 thorpej Exp $ */
+
+/*
+ * XXX This file is old config only!
+ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
#if NGRF > 0
#include <sys/types.h>
+#include <sys/device.h>
#include <hp300/dev/grfioctl.h> /* XXX */
#include <hp300/dev/grfvar.h>
-/* $NetBSD: grf_dv.c,v 1.7 1996/03/03 16:48:56 thorpej Exp $ */
+/* $OpenBSD: grf_dv.c,v 1.3 1997/01/12 15:12:32 downsj Exp $ */
+/* $NetBSD: grf_dv.c,v 1.9 1996/12/17 08:41:07 thorpej Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* @(#)grf_dv.c 8.4 (Berkeley) 1/12/94
*/
-#include "grf.h"
-#if NGRF > 0
-
/*
* Graphics routines for the DaVinci, HP98730/98731 Graphics system.
*/
#include <sys/ioctl.h>
#include <sys/tty.h>
#include <sys/systm.h>
+#include <sys/device.h>
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <dev/cons.h>
+#include <hp300/dev/diovar.h>
+#include <hp300/dev/diodevs.h>
+#include <hp300/dev/intiovar.h>
+
#include <hp300/dev/grfioctl.h>
#include <hp300/dev/grfvar.h>
#include <hp300/dev/grfreg.h>
int dv_mode __P((struct grf_data *, int, caddr_t));
void dv_reset __P((struct dvboxfb *));
+#ifdef NEWCONFIG
+int dvbox_intio_match __P((struct device *, struct cfdata *, void *));
+void dvbox_intio_attach __P((struct device *, struct device *, void *));
+
+int dvbox_dio_match __P((struct device *, struct cfdata *, void *));
+void dvbox_dio_attach __P((struct device *, struct device *, void *));
+
+struct cfattach dvbox_intio_ca = {
+ sizeof(struct grfdev_softc), dvbox_intio_match, dvbox_intio_attach
+};
+
+struct cfattach dvbox_dio_ca = {
+ sizeof(struct grfdev_softc), dvbox_dio_match, dvbox_dio_attach
+};
+
+struct cfdriver dvbox_cd = {
+ NULL, "dvbox", DV_DULL
+};
+#endif /* NEWCONFIG */
+
/* DaVinci grf switch */
struct grfsw dvbox_grfsw = {
- GID_DAVINCI, GRFDAVINCI, "davinci", dv_init, dv_mode
+ GID_DAVINCI, GRFDAVINCI, "dvbox", dv_init, dv_mode
};
#if NITE > 0
};
#endif /* NITE > 0 */
+#ifdef NEWCONFIG
+int
+dvbox_intio_match(parent, match, aux)
+ struct device *parent;
+ struct cfdata *match;
+ void *aux;
+{
+ struct intio_attach_args *ia = aux;
+ struct grfreg *grf;
+
+ grf = (struct grfreg *)IIOV(GRFIADDR);
+ if (badaddr((caddr_t)grf))
+ return (0);
+
+ if (grf->gr_id == DIO_DEVICE_ID_FRAMEBUFFER &&
+ grf->gr_id2 == DIO_DEVICE_SECID_DAVINCI) {
+ ia->ia_addr = (caddr_t)GRFIADDR;
+ return (1);
+ }
+
+ return (0);
+}
+
+void
+dvbox_intio_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct grfdev_softc *sc = (struct grfdev_softc *)self;
+ caddr_t grf;
+
+ grf = (caddr_t)IIOV(GRFIADDR);
+ sc->sc_scode = -1; /* XXX internal i/o */
+
+ grfdev_attach(sc, dv_init, grf, &dvbox_grfsw);
+}
+
+int
+dvbox_dio_match(parent, match, aux)
+ struct device *parent;
+ struct cfdata *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(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct grfdev_softc *sc = (struct grfdev_softc *)self;
+ struct dio_attach_args *da = aux;
+ caddr_t grf;
+
+ sc->sc_scode = da->da_scode;
+ if (sc->sc_scode == conscode)
+ grf = conaddr;
+ else {
+ grf = iomap(dio_scodetopa(sc->sc_scode), da->da_size);
+ if (grf == 0) {
+ printf("%s: can't map framebuffer\n",
+ sc->sc_dev.dv_xname);
+ return;
+ }
+ }
+
+ grfdev_attach(sc, dv_init, grf, &dvbox_grfsw);
+}
+#endif /* NEWCONFIG */
+
/*
* Initialize hardware.
* Must point g_display at a grfinfo structure describing the hardware.
register struct dvboxfb *dbp;
struct grfinfo *gi = &gp->g_display;
int fboff;
- extern caddr_t sctopa(), iomap();
+ extern caddr_t iomap();
/*
* If the console has been initialized, and it was us, there's
if (ISIIOVA(addr))
gi->gd_regaddr = (caddr_t) IIOP(addr);
else
- gi->gd_regaddr = sctopa(scode);
+ gi->gd_regaddr = dio_scodetopa(scode);
gi->gd_regsize = 0x20000;
gi->gd_fbwidth = (dbp->fbwmsb << 8) | dbp->fbwlsb;
gi->gd_fbheight = (dbp->fbhmsb << 8) | dbp->fbhlsb;
dvboxcninit(cp)
struct consdev *cp;
{
- struct ite_data *ip = &ite_cn;
struct grf_data *gp = &grf_cn;
/*
gp->g_flags = GF_ALIVE;
/*
- * Set up required ite data and initialize ite.
+ * Initialize the terminal emulator.
*/
- ip->isw = &dvbox_itesw;
- ip->grf = gp;
- ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
- ip->attrbuf = console_attributes;
- iteinit(ip);
-
- kbd_ite = ip; /* XXX */
+ itecninit(gp, &dvbox_itesw);
}
#endif /* NITE > 0 */
-#endif /* NGRF > 0 */
+/* $OpenBSD: grf_dvreg.h,v 1.2 1997/01/12 15:12:33 downsj Exp $ */
/* $NetBSD: grf_dvreg.h,v 1.5 1994/10/26 07:23:50 cgd Exp $ */
/*
-/* $NetBSD: grf_gb.c,v 1.7 1996/03/03 16:48:58 thorpej Exp $ */
+/* $OpenBSD: grf_gb.c,v 1.3 1997/01/12 15:12:33 downsj Exp $ */
+/* $NetBSD: grf_gb.c,v 1.9 1996/12/17 08:41:08 thorpej Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* @(#)grf_gb.c 8.4 (Berkeley) 1/12/94
*/
-#include "grf.h"
-#if NGRF > 0
-
/*
* Graphics routines for the Gatorbox.
*
#include <sys/ioctl.h>
#include <sys/tty.h>
#include <sys/systm.h>
+#include <sys/device.h>
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <dev/cons.h>
+#include <hp300/dev/diovar.h>
+#include <hp300/dev/diodevs.h>
+#include <hp300/dev/intiovar.h>
+
#include <hp300/dev/grfioctl.h>
#include <hp300/dev/grfvar.h>
#include <hp300/dev/grfreg.h>
int gb_mode __P((struct grf_data *gp, int, caddr_t));
void gb_microcode __P((struct gboxfb *));
+#ifdef NEWCONFIG
+int gbox_intio_match __P((struct device *, struct cfdata *, void *));
+void gbox_intio_attach __P((struct device *, struct device *, void *));
+
+int gbox_dio_match __P((struct device *, struct cfdata *, void *));
+void gbox_dio_attach __P((struct device *, struct device *, void *));
+
+struct cfattach gbox_intio_ca = {
+ sizeof(struct grfdev_softc), gbox_intio_match, gbox_intio_attach
+};
+
+struct cfattach gbox_dio_ca = {
+ sizeof(struct grfdev_softc), gbox_dio_match, gbox_dio_attach
+};
+
+struct cfdriver gbox_cd = {
+ NULL, "gbox", DV_DULL
+};
+#endif /* NEWCONFIG */
+
/* Gatorbox grf switch */
struct grfsw gbox_grfsw = {
GID_GATORBOX, GRFGATOR, "gatorbox", gb_init, gb_mode
};
#endif /* NITE > 0 */
+#ifdef NEWCONFIG
+int
+gbox_intio_match(parent, match, aux)
+ struct device *parent;
+ struct cfdata *match;
+ void *aux;
+{
+ struct intio_attach_args *ia = aux;
+ struct grfreg *grf;
+
+ grf = (struct grfreg *)IIOV(GRFIADDR);
+ if (badaddr((caddr_t)grf))
+ return (0);
+
+ if (grf->gr_id == DIO_DEVICE_ID_FRAMEBUFFER &&
+ grf->gr_id2 == DIO_DEVICE_SECID_GATORBOX) {
+ ia->ia_addr = (caddr_t)GRFIADDR;
+ return (1);
+ }
+
+ return (0);
+}
+
+void
+gbox_intio_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct grfdev_softc *sc = (struct grfdev_softc *)self;
+ caddr_t grf;
+
+ grf = (caddr_t)IIOV(GRFIADDR);
+ sc->sc_scode = -1; /* XXX internal i/o */
+
+ grfdev_attach(sc, gb_init, grf, &gbox_grfsw);
+}
+
+int
+gbox_dio_match(parent, match, aux)
+ struct device *parent;
+ struct cfdata *match;
+ void *aux;
+{
+ struct dio_attach_args *da = aux;
+
+ if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
+ da->da_secid == DIO_DEVICE_SECID_GATORBOX)
+ return (1);
+
+ return (0);
+}
+
+void
+gbox_dio_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct grfdev_softc *sc = (struct grfdev_softc *)self;
+ struct dio_attach_args *da = aux;
+ caddr_t grf;
+
+ sc->sc_scode = da->da_scode;
+ if (sc->sc_scode == conscode)
+ grf = conaddr;
+ else {
+ grf = iomap(dio_scodetopa(sc->sc_scode), da->da_size);
+ if (grf == 0) {
+ printf("%s: can't map framebuffer\n",
+ sc->sc_dev.dv_xname);
+ return;
+ }
+ }
+
+ grfdev_attach(sc, gb_init, grf, &gbox_grfsw);
+}
+#endif /* NEWCONFIG */
+
/*
* Initialize hardware.
* Must point g_display at a grfinfo structure describing the hardware.
struct grfinfo *gi = &gp->g_display;
u_char *fbp, save;
int fboff;
- extern caddr_t sctopa(), iomap();
+ extern caddr_t iomap();
/*
* If the console has been initialized, and it was us, there's
if (ISIIOVA(addr))
gi->gd_regaddr = (caddr_t) IIOP(addr);
else
- gi->gd_regaddr = sctopa(scode);
+ gi->gd_regaddr = dio_scodetopa(scode);
gi->gd_regsize = 0x10000;
gi->gd_fbwidth = 1024; /* XXX */
gi->gd_fbheight = 1024; /* XXX */
gboxcninit(cp)
struct consdev *cp;
{
- struct ite_data *ip = &ite_cn;
struct grf_data *gp = &grf_cn;
/*
gp->g_flags = GF_ALIVE;
/*
- * Set up required ite data and initialize ite.
+ * Initialize the terminal emulator.
*/
- ip->isw = &gbox_itesw;
- ip->grf = gp;
- ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
- ip->attrbuf = console_attributes;
- iteinit(ip);
-
- kbd_ite = ip; /* XXX */
+ itecninit(gp, &gbox_itesw);
}
#endif /* NITE > 0 */
-#endif /* NGRF > 0 */
+/* $OpenBSD: grf_gbreg.h,v 1.2 1997/01/12 15:12:34 downsj Exp $ */
/* $NetBSD: grf_gbreg.h,v 1.4 1994/10/26 07:23:53 cgd Exp $ */
/*
-/* $NetBSD: grf_hy.c,v 1.5 1996/03/03 16:49:00 thorpej Exp $ */
+/* $OpenBSD: grf_hy.c,v 1.3 1997/01/12 15:12:35 downsj Exp $ */
+/* $NetBSD: grf_hy.c,v 1.7 1996/12/17 08:41:09 thorpej Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* @(#)grf_hy.c 8.4 (Berkeley) 1/12/94
*/
-#include "grf.h"
-#if NGRF > 0
-
/*
* Graphics routines for HYPERION frame buffer
*/
#include <sys/tty.h>
#include <sys/systm.h>
#include <sys/uio.h>
+#include <sys/device.h>
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <dev/cons.h>
+#include <hp300/dev/diovar.h>
+#include <hp300/dev/diodevs.h>
+#include <hp300/dev/intiovar.h>
+
#include <hp300/dev/grfioctl.h>
#include <hp300/dev/grfvar.h>
#include <hp300/dev/grfreg.h>
int hy_mode __P((struct grf_data *gp, int, caddr_t));
void hyper_ite_fontinit __P((struct ite_data *));
+#ifdef NEWCONFIG
+int hyper_dio_match __P((struct device *, struct cfdata *, void *));
+void hyper_dio_attach __P((struct device *, struct device *, void *));
+
+struct cfattach hyper_dio_ca = {
+ sizeof(struct grfdev_softc), hyper_dio_match, hyper_dio_attach
+};
+
+struct cfdriver hyper_cd = {
+ NULL, "hyper", DV_DULL
+};
+#endif /* NEWCONFIG */
+
/* Hyperion grf switch */
struct grfsw hyper_grfsw = {
GID_HYPERION, GRFHYPERION, "hyperion", hy_init, hy_mode
};
#endif /* NITE > 0 */
+#ifdef NEWCONFIG
+int
+hyper_dio_match(parent, match, aux)
+ struct device *parent;
+ struct cfdata *match;
+ void *aux;
+{
+ struct dio_attach_args *da = aux;
+
+ if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
+ da->da_secid == DIO_DEVICE_SECID_HYPERION)
+ return (1);
+
+ return (0);
+}
+
+void
+hyper_dio_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct grfdev_softc *sc = (struct grfdev_softc *)self;
+ struct dio_attach_args *da = aux;
+ caddr_t grf;
+
+ sc->sc_scode = da->da_scode;
+ if (sc->sc_scode == conscode)
+ grf = conaddr;
+ else {
+ grf = iomap(dio_scodetopa(sc->sc_scode), da->da_size);
+ if (grf == 0) {
+ printf("%s: can't map framebuffer\n",
+ sc->sc_dev.dv_xname);
+ return;
+ }
+ }
+
+ grfdev_attach(sc, hy_init, grf, &hyper_grfsw);
+}
+#endif /* NEWCONFIG */
+
/*
* Initialize hardware.
* Must fill in the grfinfo structure in g_softc.
register struct hyboxfb *hy = (struct hyboxfb *) addr;
struct grfinfo *gi = &gp->g_display;
int fboff;
- extern caddr_t sctopa(), iomap();
+ extern caddr_t iomap();
/*
* If the console has been initialized, and it was us, there's
if (ISIIOVA(addr))
gi->gd_regaddr = (caddr_t) IIOP(addr);
else
- gi->gd_regaddr = sctopa(scode);
+ gi->gd_regaddr = dio_scodetopa(scode);
gi->gd_regsize = 0x20000;
gi->gd_fbwidth = (hy->fbwmsb << 8) | hy->fbwlsb;
gi->gd_fbheight = (hy->fbhmsb << 8) | hy->fbhlsb;
hypercninit(cp)
struct consdev *cp;
{
- struct ite_data *ip = &ite_cn;
struct grf_data *gp = &grf_cn;
/*
gp->g_flags = GF_ALIVE;
/*
- * Set up required ite data and initialize ite.
+ * Initialize the terminal emulator.
*/
- ip->isw = &hyper_itesw;
- ip->grf = gp;
- ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
- ip->attrbuf = console_attributes;
- iteinit(ip);
-
- kbd_ite = ip; /* XXX */
+ itecninit(gp, &hyper_itesw);
}
#endif /* NITE > 0 */
-#endif /* NGRF > 0 */
+/* $OpenBSD: grf_hyreg.h,v 1.2 1997/01/12 15:12:35 downsj Exp $ */
/* $NetBSD: grf_hyreg.h,v 1.2 1994/10/26 07:23:57 cgd Exp $ */
/*
-/* $NetBSD: grf_machdep.c,v 1.4 1996/02/24 00:55:13 thorpej Exp $ */
+/* $OpenBSD: grf_machdep.c,v 1.4 1997/01/12 15:12:36 downsj Exp $ */
+/* $NetBSD: grf_machdep.c,v 1.7 1996/12/17 08:41:09 thorpej Exp $ */
+
+/*
+ * XXX This file is old config only!
+ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
else
isconsole = 0;
+ sc->sc_scode = scode;
+
printf(": %d x %d ", gp->g_display.gd_dwidth,
gp->g_display.gd_dheight);
if (gp->g_display.gd_colors == 2)
-/* $NetBSD: grf_rb.c,v 1.7 1996/03/03 16:49:02 thorpej Exp $ */
+/* $OpenBSD: grf_rb.c,v 1.3 1997/01/12 15:12:36 downsj Exp $ */
+/* $NetBSD: grf_rb.c,v 1.9 1996/12/17 08:41:10 thorpej Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* @(#)grf_rb.c 8.4 (Berkeley) 1/12/94
*/
-#include "grf.h"
-#if NGRF > 0
-
/*
* Graphics routines for the Renaissance, HP98720 Graphics system.
*/
#include <sys/ioctl.h>
#include <sys/tty.h>
#include <sys/systm.h>
+#include <sys/device.h>
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <dev/cons.h>
+#include <hp300/dev/diovar.h>
+#include <hp300/dev/diodevs.h>
+#include <hp300/dev/intiovar.h>
+
#include <hp300/dev/grfioctl.h>
#include <hp300/dev/grfvar.h>
#include <hp300/dev/grfreg.h>
int rb_init __P((struct grf_data *gp, int, caddr_t));
int rb_mode __P((struct grf_data *gp, int, caddr_t));
+#ifdef NEWCONFIG
+int rbox_intio_match __P((struct device *, struct cfdata *, void *));
+void rbox_intio_attach __P((struct device *, struct device *, void *));
+
+int rbox_dio_match __P((struct device *, struct cfdata *, void *));
+void rbox_dio_attach __P((struct device *, struct device *, void *));
+
+struct cfattach rbox_intio_ca = {
+ sizeof(struct grfdev_softc), rbox_intio_match, rbox_intio_attach
+};
+
+struct cfattach rbox_dio_ca = {
+ sizeof(struct grfdev_softc), rbox_dio_match, rbox_dio_attach
+};
+
+struct cfdriver rbox_cd = {
+ NULL, "rbox", DV_DULL
+};
+#endif /* NEWCONFIG */
+
/* Renaissance grf switch */
struct grfsw rbox_grfsw = {
GID_RENAISSANCE, GRFRBOX, "renaissance", rb_init, rb_mode
};
#endif /* NITE > 0 */
+#ifdef NEWCONFIG
+int
+rbox_intio_match(parent, match, aux)
+ struct device *parent;
+ struct cfdata *match;
+ void *aux;
+{
+ struct intio_attach_args *ia = aux;
+ struct grfreg *grf;
+
+ grf = (struct grfreg *)IIOV(GRFIADDR);
+ if (badaddr((caddr_t)grf))
+ return (0);
+
+ if (grf->gr_id == DIO_DEVICE_ID_FRAMEBUFFER &&
+ grf->gr_id2 == DIO_DEVICE_SECID_RENASSIANCE) {
+ ia->ia_addr = (caddr_t)GRFIADDR;
+ return (1);
+ }
+
+ return (0);
+}
+
+void
+rbox_intio_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct grfdev_softc *sc = (struct grfdev_softc *)self;
+ caddr_t grf;
+
+ grf = (caddr_t)IIOV(GRFIADDR);
+ sc->sc_scode = -1; /* XXX internal i/o */
+
+ grfdev_attach(sc, rb_init, grf, &rbox_grfsw);
+}
+
+int
+rbox_dio_match(parent, match, aux)
+ struct device *parent;
+ struct cfdata *match;
+ void *aux;
+{
+ struct dio_attach_args *da = aux;
+
+ if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
+ da->da_secid == DIO_DEVICE_SECID_RENASSIANCE)
+ return (1);
+
+ return (0);
+}
+
+void
+rbox_dio_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct grfdev_softc *sc = (struct grfdev_softc *)self;
+ struct dio_attach_args *da = aux;
+ caddr_t grf;
+
+ sc->sc_scode = da->da_scode;
+ if (sc->sc_scode == conscode)
+ grf = conaddr;
+ else {
+ grf = iomap(dio_scodetopa(sc->sc_scode), da->da_size);
+ if (grf == 0) {
+ printf("%s: can't map framebuffer\n",
+ sc->sc_dev.dv_xname);
+ return;
+ }
+ }
+
+ grfdev_attach(sc, rb_init, grf, &rbox_grfsw);
+}
+#endif /* NEWCONFIG */
+
/*
* Initialize hardware.
* Must point g_display at a grfinfo structure describing the hardware.
register struct rboxfb *rbp;
struct grfinfo *gi = &gp->g_display;
int fboff;
- extern caddr_t sctopa(), iomap();
+ extern caddr_t iomap();
/*
* If the console has been initialized, and it was us, there's
if (ISIIOVA(addr))
gi->gd_regaddr = (caddr_t) IIOP(addr);
else
- gi->gd_regaddr = sctopa(scode);
+ gi->gd_regaddr = dio_scodetopa(scode);
gi->gd_regsize = 0x20000;
gi->gd_fbwidth = (rbp->fbwmsb << 8) | rbp->fbwlsb;
gi->gd_fbheight = (rbp->fbhmsb << 8) | rbp->fbhlsb;
rboxcninit(cp)
struct consdev *cp;
{
- struct ite_data *ip = &ite_cn;
struct grf_data *gp = &grf_cn;
/*
gp->g_flags = GF_ALIVE;
/*
- * Set up required ite data and initialize ite.
+ * Initialize the terminal emulator.
*/
- ip->isw = &rbox_itesw;
- ip->grf = gp;
- ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
- ip->attrbuf = console_attributes;
- iteinit(ip);
-
- kbd_ite = ip; /* XXX */
+ itecninit(gp, &rbox_itesw);
}
#endif /* NITE > 0 */
-#endif /* NGRF > 0 */
+/* $OpenBSD: grf_rbreg.h,v 1.2 1997/01/12 15:12:37 downsj Exp $ */
/* $NetBSD: grf_rbreg.h,v 1.4 1994/10/26 07:24:03 cgd Exp $ */
/*
--- /dev/null
+/* $OpenBSD: grf_subr.c,v 1.1 1997/01/12 15:12:38 downsj Exp $ */
+/* $NetBSD: grf_subr.c,v 1.1 1996/12/17 08:41:11 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Subroutines common to all framebuffer devices.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <sys/device.h>
+
+#include <machine/autoconf.h>
+#include <machine/cpu.h>
+
+#include <hp300/dev/grfioctl.h>
+#include <hp300/dev/grfvar.h>
+
+int grfdevprint __P((void *, const char *));
+
+void
+grfdev_attach(sc, init, regs, sw)
+ struct grfdev_softc *sc;
+ int (*init) __P((struct grf_data *, int, caddr_t));
+ caddr_t regs;
+ struct grfsw *sw;
+{
+ struct grfdev_attach_args ga;
+ struct grf_data *gp;
+ int isconsole;
+
+ isconsole = (sc->sc_scode == conscode);
+
+ if (isconsole)
+ sc->sc_data = gp = &grf_cn;
+ else {
+ sc->sc_data = gp =
+ (struct grf_data *)malloc(sizeof(struct grf_data),
+ M_DEVBUF, M_NOWAIT);
+ if (sc->sc_data == NULL) {
+ printf("\n%s: can't allocate grf data\n",
+ sc->sc_dev.dv_xname);
+ return;
+ }
+ bzero(sc->sc_data, sizeof(struct grf_data));
+
+ /* Initialize the framebuffer hardware. */
+ if ((*init)(sc->sc_data, sc->sc_scode, regs) == 0) {
+ printf("\n%s: init failed\n",
+ sc->sc_dev.dv_xname);
+ free(sc->sc_data, M_DEVBUF);
+ return;
+ }
+
+ gp->g_sw = sw;
+ gp->g_display.gd_id = gp->g_sw->gd_swid;
+ }
+
+ /* Announce ourselves. */
+ printf(": %d x %d ", gp->g_display.gd_dwidth,
+ gp->g_display.gd_dheight);
+ if (gp->g_display.gd_colors == 2)
+ printf("monochrome");
+ else
+ printf("%d color", gp->g_display.gd_colors);
+ printf(" %s display\n", gp->g_sw->gd_desc);
+
+ /* Attach a grf. */
+ ga.ga_scode = sc->sc_scode; /* XXX */
+ ga.ga_isconsole = isconsole;
+ ga.ga_data = (void *)sc->sc_data;
+ (void)config_found(&sc->sc_dev, &ga, grfdevprint);
+}
+
+int
+grfdevprint(aux, pnp)
+ void *aux;
+ const char *pnp;
+{
+ struct grfdev_attach_args *ga = aux;
+
+ /* Only grf's can attach to grfdev's... easy. */
+ if (pnp)
+ printf("grf at %s", pnp);
+
+ return (UNCONF);
+}
-/* $NetBSD: grf_tc.c,v 1.7 1996/03/03 16:49:04 thorpej Exp $ */
+/* $OpenBSD: grf_tc.c,v 1.3 1997/01/12 15:12:38 downsj Exp $ */
+/* $NetBSD: grf_tc.c,v 1.9 1996/12/17 08:41:12 thorpej Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* @(#)grf_tc.c 8.4 (Berkeley) 1/12/94
*/
-#include "grf.h"
-#if NGRF > 0
-
/*
* Graphics routines for TOPCAT and CATSEYE frame buffers
*/
#include <sys/ioctl.h>
#include <sys/tty.h>
#include <sys/systm.h>
+#include <sys/device.h>
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <dev/cons.h>
+#include <hp300/dev/diovar.h>
+#include <hp300/dev/diodevs.h>
+#include <hp300/dev/intiovar.h>
+
#include <hp300/dev/grfioctl.h>
#include <hp300/dev/grfvar.h>
#include <hp300/dev/grfreg.h>
int tc_init __P((struct grf_data *, int, caddr_t));
int tc_mode __P((struct grf_data *, int, caddr_t));
+#ifdef NEWCONFIG
+void topcat_common_attach __P((struct grfdev_softc *, caddr_t, u_int8_t));
+
+int topcat_intio_match __P((struct device *, struct cfdata *, void *));
+void topcat_intio_attach __P((struct device *, struct device *, void *));
+
+int topcat_dio_match __P((struct device *, struct cfdata *, void *));
+void topcat_dio_attach __P((struct device *, struct device *, void *));
+
+struct cfattach topcat_intio_ca = {
+ sizeof(struct grfdev_softc), topcat_intio_match, topcat_intio_attach
+};
+
+struct cfattach topcat_dio_ca = {
+ sizeof(struct grfdev_softc), topcat_dio_match, topcat_dio_attach
+};
+
+struct cfdriver topcat_cd = {
+ NULL, "topcat", DV_DULL
+};
+#endif /* NEWCONFIG */
+
/* Topcat (bobcat) grf switch */
struct grfsw topcat_grfsw = {
GID_TOPCAT, GRFBOBCAT, "topcat", tc_init, tc_mode
};
#endif /* NITE > 0 */
+#ifdef NEWCONFIG
+int
+topcat_intio_match(parent, match, aux)
+ struct device *parent;
+ struct cfdata *match;
+ void *aux;
+{
+ struct intio_attach_args *ia = aux;
+ struct grfreg *grf;
+
+ grf = (struct grfreg *)IIOV(GRFIADDR);
+
+ if (badaddr((caddr_t)grf))
+ return (0);
+
+ if (grf->gr_id == DIO_DEVICE_ID_FRAMEBUFFER) {
+ switch (grf->gr_id2) {
+ case DIO_DEVICE_SECID_TOPCAT:
+ case DIO_DEVICE_SECID_LRCATSEYE:
+ case DIO_DEVICE_SECID_HRCCATSEYE:
+ case DIO_DEVICE_SECID_HRMCATSEYE:
+#if 0
+ case DIO_DEVICE_SECID_XXXCATSEYE:
+#endif
+ ia->ia_addr = (caddr_t)GRFIADDR;
+ return (1);
+ }
+ }
+
+ return (0);
+}
+
+void
+topcat_intio_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct grfdev_softc *sc = (struct grfdev_softc *)self;
+ struct grfreg *grf;
+
+ grf = (struct grfreg *)IIOV(GRFIADDR);
+ sc->sc_scode = -1; /* XXX internal i/o */
+
+ topcat_common_attach(sc, (caddr_t)grf, grf->gr_id2);
+}
+
+int
+topcat_dio_match(parent, match, aux)
+ struct device *parent;
+ struct cfdata *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(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct grfdev_softc *sc = (struct grfdev_softc *)self;
+ struct dio_attach_args *da = aux;
+ caddr_t grf;
+
+ sc->sc_scode = da->da_scode;
+ if (sc->sc_scode == conscode)
+ grf = conaddr;
+ else {
+ grf = iomap(dio_scodetopa(sc->sc_scode), da->da_size);
+ if (grf == 0) {
+ printf("%s: can't map framebuffer\n",
+ sc->sc_dev.dv_xname);
+ return;
+ }
+ }
+
+ topcat_common_attach(sc, grf, da->da_secid);
+}
+
+void
+topcat_common_attach(sc, grf, secid)
+ struct grfdev_softc *sc;
+ caddr_t grf;
+ u_int8_t secid;
+{
+ struct grfsw *sw;
+
+ switch (secid) {
+ case DIO_DEVICE_SECID_TOPCAT:
+ sw = &topcat_grfsw;
+ break;
+
+ case DIO_DEVICE_SECID_LRCATSEYE:
+ sw = &lrcatseye_grfsw;
+ break;
+
+ case DIO_DEVICE_SECID_HRCCATSEYE:
+ sw = &hrcatseye_grfsw;
+ break;
+
+ case DIO_DEVICE_SECID_HRMCATSEYE:
+ sw = &hrmcatseye_grfsw;
+ break;
+#if 0
+ case DIO_DEVICE_SECID_XXXCATSEYE:
+ sw = XXX?
+ break;
+#endif
+ default:
+ printf("%s: unkown device 0x%x\n",
+ sc->sc_dev.dv_xname, secid);
+ panic("topcat_common_attach");
+ }
+
+ grfdev_attach(sc, tc_init, grf, sw);
+}
+#endif /* NEWCONFIG */
+
/*
* Initialize hardware.
* Must fill in the grfinfo structure in g_softc.
volatile u_char *fbp;
u_char save;
int fboff;
- extern caddr_t sctopa();
/*
* If the console has been initialized, and it was us, there's
if (ISIIOVA(addr))
gi->gd_regaddr = (caddr_t) IIOP(addr);
else
- gi->gd_regaddr = sctopa(scode);
+ gi->gd_regaddr = dio_scodetopa(scode);
gi->gd_regsize = 0x10000;
gi->gd_fbwidth = (tp->fbwmsb << 8) | tp->fbwlsb;
gi->gd_fbheight = (tp->fbhmsb << 8) | tp->fbhlsb;
topcatcninit(cp)
struct consdev *cp;
{
- struct ite_data *ip = &ite_cn;
struct grf_data *gp = &grf_cn;
struct grfreg *grf = (struct grfreg *)conaddr;
gp->g_flags = GF_ALIVE;
/*
- * Set up required ite data and initialize ite.
+ * Initialize the terminal emulator.
*/
- ip->isw = &topcat_itesw;
- ip->grf = gp;
- ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
- ip->attrbuf = console_attributes;
- iteinit(ip);
-
- kbd_ite = ip; /* XXX */
+ itecninit(gp, &topcat_itesw);
}
#endif /* NITE > 0 */
-#endif /* NGRF > 0 */
+/* $OpenBSD: grf_tcreg.h,v 1.2 1997/01/12 15:12:39 downsj Exp $ */
/* $NetBSD: grf_tcreg.h,v 1.6 1994/10/26 07:24:06 cgd Exp $ */
/*
+/* $OpenBSD: grfioctl.h,v 1.2 1997/01/12 15:12:40 downsj Exp $ */
/* $NetBSD: grfioctl.h,v 1.5 1994/10/26 07:24:08 cgd Exp $ */
/*
+/* $OpenBSD: grfreg.h,v 1.2 1997/01/12 15:12:40 downsj Exp $ */
/* $NetBSD: grfreg.h,v 1.2 1994/10/26 07:24:09 cgd Exp $ */
/*
-/* $NetBSD: grfvar.h,v 1.7 1996/02/24 00:55:18 thorpej Exp $ */
+/* $OpenBSD: grfvar.h,v 1.3 1997/01/12 15:12:41 downsj Exp $ */
+/* $NetBSD: grfvar.h,v 1.8 1996/12/17 08:41:12 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
};
struct grf_softc {
+ struct device sc_dev; /* generic device info */
+ int sc_scode; /* select code; for grfdevno() */
struct grf_data *sc_data; /* display state information */
struct ite_softc *sc_ite; /* pointer to ite; may be NULL */
};
+struct grfdev_softc {
+ struct device sc_dev; /* generic device info */
+ struct grf_data *sc_data; /* generic grf data */
+ int sc_scode; /* select code, -1 for intio */
+};
+
+/*
+ * Set up by the hardware driver, and passed all the way down to
+ * the ITE, if appropriate.
+ */
+struct grfdev_attach_args {
+ int ga_scode; /* XXX select code, -1 for intio */
+ int ga_isconsole; /* from hardware; is console? */
+ void *ga_data; /* hardware-dependent data */
+};
+
/* flags */
#define GF_ALIVE 0x01
#define GF_OPEN 0x02
#ifdef _KERNEL
extern struct grf_data grf_cn; /* grf_data for console device */
+#ifndef NEWCONFIG
extern struct grf_softc grf_softc[];
extern struct grfsw *grfsw[];
extern int ngrfsw;
-#endif
+#endif /* ! NEWCONFIG */
+
+#ifdef NEWCONFIG
+void grfdev_attach __P((struct grfdev_softc *,
+ int (*init)(struct grf_data *, int, caddr_t),
+ caddr_t, struct grfsw *));
+#endif /* NEWCONFIG */
+#endif /* _KERNEL */
-/* $NetBSD: hil.c,v 1.22 1996/02/14 02:44:24 thorpej Exp $ */
+/* $OpenBSD: hil.c,v 1.8 1997/01/12 15:12:41 downsj Exp $ */
+/* $NetBSD: hil.c,v 1.29 1996/10/14 07:09:41 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
extern struct emul emul_hpux;
#endif
+/* XXX ITE interface */
+char *kbd_keymap;
+char *kbd_shiftmap;
+char *kbd_ctrlmap;
+char *kbd_ctrlshiftmap;
+char **kbd_stringmap;
+
/* symbolic sleep message strings */
char hilin[] = "hilin";
register struct hil_softc *hilp = &hil_softc[unit];
register int i;
+ /* XXX ITE interface */
+ extern char *us_keymap, *us_shiftmap, *us_ctrlmap,
+ *us_ctrlshiftmap, **us_stringmap;
+
#ifdef DEBUG
if (hildebug & HDB_FOLLOW)
printf("hilsoftinit(%d, %x)\n", unit, hilbase);
hilp->hl_cmdbp = hilp->hl_cmdbuf;
hilp->hl_pollbp = hilp->hl_pollbuf;
hilp->hl_kbddev = 0;
- hilp->hl_kbdlang = KBD_DEFAULT;
hilp->hl_kbdflags = 0;
/*
* Clear all queues and device associations with queues
for (i = 0; i < NHILD; i++)
hilp->hl_device[i].hd_qmask = 0;
hilp->hl_device[HILLOOPDEV].hd_flags = (HIL_ALIVE|HIL_PSEUDO);
+
+ /*
+ * Set up default keyboard language. We always default
+ * to US ASCII - it seems to work OK for non-recognized
+ * keyboards.
+ */
+ hilp->hl_kbdlang = KBD_DEFAULT;
+ kbd_keymap = us_keymap; /* XXX */
+ kbd_shiftmap = us_shiftmap; /* XXX */
+ kbd_ctrlmap = us_ctrlmap; /* XXX */
+ kbd_ctrlshiftmap = us_ctrlshiftmap; /* XXX */
+ kbd_stringmap = us_stringmap; /* XXX */
}
hilinit(unit, hilbase)
}
/*ARGSUSED*/
+int
hilselect(dev, rw, p)
dev_t dev;
int rw;
register struct hiliqueue *qp;
register int mask;
int s, device;
-
+
if (rw == FWRITE)
return (1);
device = HILUNIT(dev);
}
}
-#if (defined(DDB) || defined(DEBUG)) && !defined(PANICBUTTON)
-#define PANICBUTTON
-#endif
-
/*
* Optimized macro to compute:
* eq->head == (eq->tail + 1) % eq->size
int s, len0;
long tenths;
-#ifdef PANICBUTTON
- static int first;
- extern int panicbutton;
-
- cp = hilp->hl_pollbuf;
- if (panicbutton && (*cp & HIL_KBDDATA)) {
- if (*++cp == 0x4E)
- first = 1;
- else if (first && *cp == 0x46 && !panicstr)
- panic("are we having fun yet?");
- else
- first = 0;
- }
-#endif
#ifdef DEBUG
if (hildebug & HDB_EVENTS) {
printf("hilevent: dev %d pollbuf: ", hilp->hl_actdev);
{
}
+/*
+ * The following chunk of code implements HIL console keyboard
+ * support.
+ */
+
+struct hil_dev *hilkbd_cn_device;
+char *kbd_cn_keymap;
+char *kbd_cn_shiftmap;
+char *kbd_cn_ctrlmap;
+
/*
* XXX: read keyboard directly and return code.
* Used by console getchar routine. Could really screw up anybody
* reading from the keyboard in the normal, interrupt driven fashion.
*/
-kbdgetc(unit, statp)
- int unit, *statp;
+int
+kbdgetc(statp)
+ int *statp;
{
- struct hil_softc *hilp = &hil_softc[unit];
- register struct hil_dev *hildevice = hilp->hl_addr;
register int c, stat;
int s;
+ if (hilkbd_cn_device == NULL)
+ return (0);
+
+ /*
+ * XXX needs to be splraise because we could be called
+ * XXX at splhigh, e.g. in DDB.
+ */
s = splhil();
- while (((stat = READHILSTAT(hildevice)) & HIL_DATA_RDY) == 0)
+ while (((stat = READHILSTAT(hilkbd_cn_device)) & HIL_DATA_RDY) == 0)
;
- c = READHILDATA(hildevice);
+ c = READHILDATA(hilkbd_cn_device);
splx(s);
*statp = stat;
- return(c);
+ return (c);
}
+/*
+ * Perform basic initialization of the HIL keyboard, suitable
+ * for early console use.
+ */
+void
+kbdcninit()
+{
+ struct hil_dev *h = HILADDR; /* == VA (see hilreg.h) */
+ struct kbdmap *km;
+ u_char lang;
+
+ /* XXX from hil_keymaps.c */
+ extern char *us_keymap, *us_shiftmap, *us_ctrlmap;
+
+ hilkbd_cn_device = h;
+
+ /* Default to US-ASCII keyboard. */
+ kbd_cn_keymap = us_keymap;
+ kbd_cn_shiftmap = us_shiftmap;
+ kbd_cn_ctrlmap = us_ctrlmap;
+
+ HILWAIT(h);
+ WRITEHILCMD(h, HIL_SETARR);
+ HILWAIT(h);
+ WRITEHILDATA(h, ar_format(KBD_ARR));
+ HILWAIT(h);
+ WRITEHILCMD(h, HIL_READKBDLANG);
+ HILDATAWAIT(h);
+ lang = READHILDATA(h);
+ for (km = kbd_map; km->kbd_code; km++) {
+ if (km->kbd_code == lang) {
+ kbd_cn_keymap = km->kbd_keymap;
+ kbd_cn_shiftmap = km->kbd_shiftmap;
+ kbd_cn_ctrlmap = km->kbd_ctrlmap;
+ }
+ }
+ HILWAIT(h);
+ WRITEHILCMD(h, HIL_INTON);
+}
+
+/* End of HIL console keyboard code. */
+
/*
* Recoginize and clear keyboard generated NMIs.
* Returns 1 if it was ours, 0 otherwise. Note that we cannot use
if (hilp->hl_kbdlang != KBD_SPECIAL) {
struct kbdmap *km;
- for (km = kbd_map; km->kbd_code; km++)
+ for (km = kbd_map; km->kbd_code; km++) {
if (km->kbd_code == db) {
hilp->hl_kbdlang = db;
/* XXX */
kbd_ctrlmap = km->kbd_ctrlmap;
kbd_ctrlshiftmap = km->kbd_ctrlshiftmap;
kbd_stringmap = km->kbd_stringmap;
+ break;
}
+ }
+ if (km->kbd_code == 0) {
+ printf(
+ "hilconfig: unknown keyboard type 0x%x, using default\n",
+ db);
+ }
}
splx(s);
}
+/* $OpenBSD: hil_keymaps.c,v 1.3 1997/01/12 15:12:42 downsj Exp $ */
/* $NetBSD: hil_keymaps.c,v 1.6 1995/12/06 22:13:23 thorpej Exp $ */
/*
+/* $OpenBSD: hilioctl.h,v 1.2 1997/01/12 15:12:43 downsj Exp $ */
/* $NetBSD: hilioctl.h,v 1.6 1994/10/26 07:24:14 cgd Exp $ */
/*
+/* $OpenBSD: hilreg.h,v 1.2 1997/01/12 15:12:44 downsj Exp $ */
/* $NetBSD: hilreg.h,v 1.5 1994/10/26 07:24:15 cgd Exp $ */
/*
+/* $OpenBSD: hilvar.h,v 1.3 1997/01/12 15:12:44 downsj Exp $ */
/* $NetBSD: hilvar.h,v 1.11 1995/12/11 19:41:47 thorpej Exp $ */
/*
-/* $NetBSD: hpib.c,v 1.9 1996/05/17 15:09:39 thorpej Exp $ */
+/* $OpenBSD: hpib.c,v 1.5 1997/01/12 15:12:45 downsj Exp $ */
+/* $NetBSD: hpib.c,v 1.12 1996/12/09 03:16:27 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
hs->sc_sq.dq_forw = hs->sc_sq.dq_back = &hs->sc_sq;
/* Establish the interrupt handler. */
- isrlink(hpibintr, hs, hc->hp_ipl, ISRPRI_BIO);
+ (void) isrlink(hpibintr, hs, hc->hp_ipl, ISRPRI_BIO);
+ dmacomputeipl();
/* Reset the controller, display what we've seen, and we're done. */
hpibreset(hc->hp_unit);
+/* $OpenBSD: hpibvar.h,v 1.4 1997/01/12 15:12:45 downsj Exp $ */
/* $NetBSD: hpibvar.h,v 1.8 1996/02/14 02:44:31 thorpej Exp $ */
/*
-/* $NetBSD: if_le.c,v 1.31 1996/05/09 21:11:47 thorpej Exp $ */
+/* $OpenBSD: if_le.c,v 1.6 1997/01/12 15:12:46 downsj Exp $ */
+/* $NetBSD: if_le.c,v 1.36 1996/12/17 08:41:13 thorpej Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
#include <netinet/if_ether.h>
#endif
+#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/mtpr.h>
#include <hp300/hp300/led.h>
#endif
+#ifndef NEWCONFIG
#include <hp300/dev/device.h>
+#endif
#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 NEWCONFIG
+int lematch __P((struct device *, struct cfdata *, void *));
+void leattach __P((struct device *, struct device *, void *));
+
+struct cfattach le_ca = {
+ sizeof(struct le_softc), lematch, leattach
+};
+#else /* ! NEWCONFIG */
#include "le.h"
struct le_softc le_softc[NLE];
int lematch __P((struct hp_device *));
void leattach __P((struct hp_device *));
-int leintr __P((void *));
struct driver ledriver = {
lematch, leattach, "le",
};
+#endif /* NEWCONFIG */
+
+int leintr __P((void *));
/* offsets for: ID, REGS, MEM, NVRAM */
int lestd[] = { 0, 0x4000, 0x8000, 0xC008 };
return (val);
}
+#ifdef NEWCONFIG
+int
+lematch(parent, match, aux)
+ struct device *parent;
+ struct cfdata *match;
+ void *aux;
+{
+ struct dio_attach_args *da = aux;
+
+ if (da->da_id == DIO_DEVICE_ID_LAN)
+ return (1);
+ return (0);
+}
+#else /* ! NEWCONFIG */
int
lematch(hd)
struct hp_device *hd;
return (1);
}
+#endif /* NEWCONFIG */
/*
* Interface exists: make available by filling in network interface
* record. System will initialize the interface when it is ready
* to accept packets.
*/
+#ifdef NEWCONFIG
+void
+leattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+#else /* ! NEWCONFIG */
void
leattach(hd)
struct hp_device *hd;
+#endif /* NEWCONFIG */
{
register struct lereg0 *ler0;
+#ifdef NEWCONFIG
+ struct dio_attach_args *da = aux;
+ struct le_softc *lesc = (struct le_softc *)self;
+ caddr_t addr;
+#else
struct le_softc *lesc = &le_softc[hd->hp_unit];
+ caddr_t addr = hd->hp_addr;
+#endif /* NEWCONFIG */
struct am7990_softc *sc = &lesc->sc_am7990;
char *cp;
- int i;
+ int i, ipl;
+
+#ifdef NEWCONFIG
+ 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;
+ }
+#endif /* NEWCONFIG */
- ler0 = lesc->sc_r0 = (struct lereg0 *)(lestd[0] + (int)hd->hp_addr);
+ ler0 = lesc->sc_r0 = (struct lereg0 *)(lestd[0] + (int)addr);
ler0->ler0_id = 0xFF;
DELAY(100);
+#ifdef NEWCONFIG
+ ipl = DIO_IPL(addr);
+ printf(" ipl %d", ipl);
+#else /* ! NEWCONFIG */
/* XXXX kluge for now */
- sc->sc_dev.dv_unit = hd->hp_unit;
- sprintf(sc->sc_dev.dv_xname, "%s%d", le_cd.cd_name, hd->hp_unit);
+ hd->hp_dev.dv_class = DV_IFNET;
+ bcopy(&hd->hp_dev, &sc->sc_dev, sizeof(struct device));
+ ipl = hd->hp_ipl;
+#endif /* NEWCONFIG */
- lesc->sc_r1 = (struct lereg1 *)(lestd[1] + (int)hd->hp_addr);
- sc->sc_mem = (void *)(lestd[2] + (int)hd->hp_addr);
+ 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)hd->hp_addr);
+ 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++;
am7990_config(sc);
/* Establish the interrupt handler. */
- isrlink(leintr, sc, hd->hp_ipl, ISRPRI_NET);
+ (void) isrlink(leintr, sc, ipl, ISRPRI_NET);
ler0->ler0_status = LE_IE;
}
+/* $OpenBSD: if_lereg.h,v 1.3 1997/01/12 15:12:46 downsj Exp $ */
/* $NetBSD: if_lereg.h,v 1.8 1995/12/10 00:49:36 mycroft Exp $ */
/*
-/* $NetBSD: if_levar.h,v 1.4 1996/05/07 00:58:00 thorpej Exp $ */
+/* $OpenBSD: if_levar.h,v 1.3 1997/01/12 15:12:47 downsj Exp $ */
+/* $NetBSD: if_levar.h,v 1.5 1996/12/17 08:41:14 thorpej Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
struct le_softc {
struct am7990_softc sc_am7990; /* glue to MI code */
+#ifndef NEWCONFIG
struct hp_device *sc_hd;
+#endif
struct isr sc_isr;
struct lereg0 *sc_r0; /* DIO registers */
struct lereg1 *sc_r1; /* LANCE registers */
--- /dev/null
+/* $OpenBSD: intio.c,v 1.1 1997/01/12 15:12:47 downsj Exp $ */
+/* $NetBSD: intio.c,v 1.1 1996/12/17 08:41:15 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Autoconfiguration support for hp300 internal i/o space.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <hp300/dev/intiovar.h>
+
+int intiomatch __P((struct device *, struct cfdata *, void *));
+void intioattach __P((struct device *, struct device *, void *));
+int intioprint __P((void *, const char *));
+int intiosearch __P((struct device *, struct cfdata *, 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;
+ struct cfdata *match;
+ void *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, cf, aux)
+ struct device *parent;
+ struct cfdata *cf;
+ void *aux;
+{
+ struct intio_attach_args ia;
+
+ bzero(&ia, sizeof(ia));
+ if ((*cf->cf_attach->ca_match)(parent, cf, &ia) > 0)
+ config_attach(parent, cf, &ia, intioprint);
+ return (0);
+}
--- /dev/null
+/* $OpenBSD: intiovar.h,v 1.1 1997/01/12 15:12:48 downsj Exp $ */
+/* $NetBSD: intiovar.h,v 1.1 1996/12/17 08:41:15 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * 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 */
+};
+/* $OpenBSD: iotypes.h,v 1.2 1997/01/12 15:12:48 downsj Exp $ */
/* $NetBSD: iotypes.h,v 1.2 1994/10/26 07:24:24 cgd Exp $ */
/*
-/* $NetBSD: ite.c,v 1.29.4.1 1996/06/06 15:39:12 thorpej Exp $ */
+/* $OpenBSD: ite.c,v 1.6 1997/01/12 15:12:49 downsj Exp $ */
+/* $NetBSD: ite.c,v 1.34 1996/12/17 08:41:16 thorpej Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* This is a very rudimentary. Much more can be abstracted out of
* the hardware dependent routines.
*/
-#include "ite.h"
-#if NITE > 0
-
-#include "grf.h"
-#undef NITE
-#define NITE NGRF
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/tty.h>
#include <sys/systm.h>
#include <sys/malloc.h>
+#include <sys/device.h>
#include <machine/autoconf.h>
*/
int iteburst = 64;
-int nite = NITE;
struct ite_data *kbd_ite = NULL;
-struct ite_softc ite_softc[NITE];
+
+#ifdef NEWCONFIG
+int itematch __P((struct device *, struct cfdata *, void *));
+void iteattach __P((struct device *, struct device *, void *));
+
+struct cfattach ite_ca = {
+ sizeof(struct ite_softc), itematch, iteattach
+};
+
+struct cfdriver ite_cd = {
+ NULL, "ite", DV_TTY
+};
+#else /* ! NEWCONFIG */
+#include "grf.h"
+struct ite_softc ite_softc[NGRF];
+#endif /* NEWCONFIG */
/*
* Terminal emulator state information, statically allocated
* found. Secondary displays alloc the attribute buffer as needed.
* Size is based on a 68x128 display, which is currently our largest.
*/
-u_char console_attributes[0x2200];
+u_char ite_console_attributes[0x2200];
#define ite_erasecursor(ip, sp) { \
if ((ip)->flags & ITE_CURSORON) \
(*(sp)->ite_cursor)((ip), MOVE_CURSOR); \
}
+#ifdef NEWCONFIG
+int
+itematch(parent, match, aux)
+ struct device *parent;
+ struct cfdata *match;
+ void *aux;
+{
+
+ return (1);
+}
+
+void
+iteattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct ite_softc *ite = (struct ite_softc *)self;
+ struct grf_softc *grf = (struct grf_softc *)parent;
+ struct grfdev_attach_args *ga = aux;
+
+ /* Allocate the ite_data. */
+ if (ga->ga_isconsole) {
+ ite->sc_data = &ite_cn;
+ printf(": console");
+
+ /*
+ * We didn't know which unit this would be during
+ * the console probe, so we have to fixup cn_dev here.
+ */
+ cn_tab->cn_dev = makedev(ite_major(), self->dv_unit);
+ } else {
+ ite->sc_data =
+ (struct ite_data *)malloc(sizeof(struct ite_data),
+ M_DEVBUF, M_NOWAIT);
+ if (ite->sc_data == NULL) {
+ printf("\n%s: malloc for ite_data failed\n",
+ ite->sc_dev.dv_xname);
+ return;
+ }
+ bzero(ite->sc_data, sizeof(struct ite_data));
+ }
+
+ /*
+ * Cross-reference the ite and the grf.
+ */
+ ite->sc_grf = grf;
+ grf->sc_ite = ite;
+
+ printf("\n");
+}
+#else /* ! NEWCONFIG */
/*
* Dummy for pseudo-device config.
*/
printf("ite%d at grf%d: attached\n", unit, unit);
}
+#endif /* NEWCONFIG */
/*
* Perform functions necessary to setup device as a terminal emulator.
{
int unit = ITEUNIT(dev);
struct tty *tp;
- struct ite_softc *sc = &ite_softc[unit];
- struct ite_data *ip = sc->sc_data;
+ struct ite_softc *sc;
+ struct ite_data *ip;
int error;
int first = 0;
+#ifdef NEWCONFIG
+ if (unit >= ite_cd.cd_ndevs ||
+ (sc = ite_cd.cd_devs[unit]) == NULL)
+ return (ENXIO);
+#else
+ if (unit >= NGRF)
+ return (ENXIO);
+ sc = &ite_softc[unit];
+#endif
+ ip = sc->sc_data;
+
if (ip->tty == NULL) {
tp = ip->tty = ttymalloc();
tty_attach(tp);
int flag, mode;
struct proc *p;
{
+#ifdef NEWCONFIG
+ struct ite_softc *sc = ite_cd.cd_devs[ITEUNIT(dev)];
+#else
struct ite_softc *sc = &ite_softc[ITEUNIT(dev)];
+#endif
struct ite_data *ip = sc->sc_data;
struct tty *tp = ip->tty;
struct uio *uio;
int flag;
{
+#ifdef NEWCONFIG
+ struct ite_softc *sc = ite_cd.cd_devs[ITEUNIT(dev)];
+#else
struct ite_softc *sc = &ite_softc[ITEUNIT(dev)];
+#endif
struct tty *tp = sc->sc_data->tty;
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
struct uio *uio;
int flag;
{
+#ifdef NEWCONFIG
+ struct ite_softc *sc = ite_cd.cd_devs[ITEUNIT(dev)];
+#else
struct ite_softc *sc = &ite_softc[ITEUNIT(dev)];
+#endif
struct tty *tp = sc->sc_data->tty;
return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
itetty(dev)
dev_t dev;
{
+#ifdef NEWCONFIG
+ struct ite_softc *sc = ite_cd.cd_devs[ITEUNIT(dev)];
+#else
struct ite_softc *sc = &ite_softc[ITEUNIT(dev)];
+#endif
return (sc->sc_data->tty);
}
int flag;
struct proc *p;
{
+#ifdef NEWCONFIG
+ struct ite_softc *sc = ite_cd.cd_devs[ITEUNIT(dev)];
+#else
struct ite_softc *sc = &ite_softc[ITEUNIT(dev)];
+#endif
struct ite_data *ip = sc->sc_data;
struct tty *tp = ip->tty;
int error;
struct ite_softc *sc;
struct ite_data *ip;
+#ifdef NEWCONFIG
+ sc = ite_cd.cd_devs[ITEUNIT(tp->t_dev)];
+#else
sc = &ite_softc[ITEUNIT(tp->t_dev)];
+#endif
ip = sc->sc_data;
/*
* framebuffer drivers.
*/
+void
+itecninit(gp, isw)
+ struct grf_data *gp;
+ struct itesw *isw;
+{
+ extern void kbdcninit __P((void)); /* XXX */
+ struct ite_data *ip = &ite_cn;
+
+ /*
+ * Set up required ite data and initialize ite.
+ */
+ ip->isw = isw;
+ ip->grf = gp;
+ ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
+ ip->attrbuf = ite_console_attributes;
+ iteinit(ip);
+
+ /*
+ * Initialize the console keyboard.
+ */
+ kbdcninit();
+
+ kbd_ite = ip; /* XXX */
+}
+
/*ARGSUSED*/
int
itecngetc(dev)
register int c;
int stat;
- c = kbdgetc(0, &stat); /* XXX always read from keyboard 0 for now */
+ c = kbdgetc(&stat);
switch ((stat >> KBD_SSHIFT) & KBD_SMASK) {
case KBD_SHIFT:
- c = kbd_shiftmap[c & KBD_CHARMASK];
+ c = kbd_cn_shiftmap[c & KBD_CHARMASK];
break;
case KBD_CTRL:
- c = kbd_ctrlmap[c & KBD_CHARMASK];
+ c = kbd_cn_ctrlmap[c & KBD_CHARMASK];
break;
case KBD_KEY:
- c = kbd_keymap[c & KBD_CHARMASK];
+ c = kbd_cn_keymap[c & KBD_CHARMASK];
break;
default:
c = 0;
}
iteputchar(c, ip);
}
-#endif
-/* $NetBSD: ite_subr.c,v 1.6 1996/02/24 00:55:29 thorpej Exp $ */
+/* $OpenBSD: ite_subr.c,v 1.3 1997/01/12 15:12:51 downsj Exp $ */
+/* $NetBSD: ite_subr.c,v 1.7 1996/12/17 08:41:17 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* @(#)ite_subr.c 8.2 (Berkeley) 1/12/94
*/
-#include "ite.h"
-#if NITE > 0
-
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/proc.h>
#include <sys/ioctl.h>
#include <sys/tty.h>
#include <sys/systm.h>
+#include <sys/device.h>
#include <hp300/dev/itevar.h>
#include <hp300/dev/itereg.h>
fbmem += ip->fbwidth;
}
}
-#endif
+/* $OpenBSD: itereg.h,v 1.2 1997/01/12 15:12:52 downsj Exp $ */
/* $NetBSD: itereg.h,v 1.5 1994/10/26 07:24:39 cgd Exp $ */
/*
-/* $NetBSD: itevar.h,v 1.9 1996/02/24 00:55:31 thorpej Exp $ */
+/* $OpenBSD: itevar.h,v 1.5 1997/01/12 15:12:52 downsj Exp $ */
+/* $NetBSD: itevar.h,v 1.12 1997/01/09 01:07:59 scottr Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* @(#)itevar.h 8.1 (Berkeley) 6/10/93
*/
+#ifdef _KERNEL
#define ITEUNIT(dev) minor(dev)
#define getbyte(ip, offset) \
};
struct ite_softc {
+ struct device sc_dev; /* generic device info */
struct ite_data *sc_data; /* terminal state info */
struct grf_softc *sc_grf; /* pointer to framebuffer */
};
+#endif
/* Flags */
#define ITE_ALIVE 0x01 /* hardware exists */
extern struct ite_data *kbd_ite; /* XXX */
extern struct ite_softc ite_softc[];
extern struct itesw itesw[];
-extern u_char console_attributes[];
extern int nitesw;
/* ite.c prototypes */
int iteon __P((struct ite_data *, int));
void iteoff __P((struct ite_data *, int));
void itefilter __P((char, char));
+void itecninit __P((struct grf_data *, struct itesw *));
int ite_major __P((void));
/* ite_subr.c prototypes */
-/* $NetBSD: kbdmap.h,v 1.6 1995/12/06 22:13:26 thorpej Exp $ */
+/* $OpenBSD: kbdmap.h,v 1.3 1997/01/12 15:12:53 downsj Exp $ */
+/* $NetBSD: kbdmap.h,v 1.7 1996/10/05 05:22:11 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
#ifdef _KERNEL
/* XXX: ITE interface */
-char *kbd_keymap;
-char *kbd_shiftmap;
-char *kbd_ctrlmap;
-char *kbd_ctrlshiftmap;
-char **kbd_stringmap;
+extern char *kbd_keymap;
+extern char *kbd_shiftmap;
+extern char *kbd_ctrlmap;
+extern char *kbd_ctrlshiftmap;
+extern char **kbd_stringmap;
+
+/* XXX: itecngetc() interface */
+extern char *kbd_cn_keymap;
+extern char *kbd_cn_shiftmap;
+extern char *kbd_cn_ctrlmap;
extern struct kbdmap kbd_map[];
#endif
+/* $OpenBSD: maskbits.h,v 1.2 1997/01/12 15:12:53 downsj Exp $ */
/* $NetBSD: maskbits.h,v 1.2 1994/10/26 07:24:43 cgd Exp $ */
/*-
-/* $NetBSD: mt.c,v 1.3 1996/02/14 02:44:40 thorpej Exp $ */
+/* $OpenBSD: mt.c,v 1.4 1997/01/12 15:12:54 downsj Exp $ */
+/* $NetBSD: mt.c,v 1.6 1996/10/14 07:14:18 thorpej Exp $ */
/*
* Copyright (c) 1992, The University of Utah and
sc->sc_dq.dq_unit = unit;
sc->sc_dq.dq_slave = slave;
sc->sc_dq.dq_driver = &mtdriver;
+
+ /* XXX Set device class. */
+ hd->hp_dev.dv_class = DV_TAPE;
}
/*
+/* $OpenBSD: mtreg.h,v 1.2 1997/01/12 15:12:55 downsj Exp $ */
/* $NetBSD: mtreg.h,v 1.1 1995/10/02 00:28:22 thorpej Exp $ */
/*
-/* $NetBSD: nhpib.c,v 1.11 1996/05/18 23:57:01 thorpej Exp $ */
+/* $OpenBSD: nhpib.c,v 1.5 1997/01/12 15:12:56 downsj Exp $ */
+/* $NetBSD: nhpib.c,v 1.13 1996/10/13 03:14:19 christos Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
+/* $OpenBSD: nhpibreg.h,v 1.2 1997/01/12 15:12:56 downsj Exp $ */
/* $NetBSD: nhpibreg.h,v 1.5 1995/01/07 10:30:15 mycroft Exp $ */
/*
-/* $NetBSD: ppi.c,v 1.8 1996/02/14 02:44:49 thorpej Exp $ */
+/* $OpenBSD: ppi.c,v 1.4 1997/01/12 15:12:57 downsj Exp $ */
+/* $NetBSD: ppi.c,v 1.10 1996/10/13 03:14:20 christos Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
+/* $OpenBSD: ppiioctl.h,v 1.2 1997/01/12 15:12:58 downsj Exp $ */
/* $NetBSD: ppiioctl.h,v 1.4 1994/10/26 07:24:48 cgd Exp $ */
/*
-/* $NetBSD: rd.c,v 1.20.4.1 1996/06/06 16:22:01 thorpej Exp $ */
+/* $OpenBSD: rd.c,v 1.7 1997/01/12 15:12:58 downsj Exp $ */
+/* $NetBSD: rd.c,v 1.26 1997/01/07 09:29:32 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
if (rddebug & RDB_ERROR)
rderrthresh = 0;
#endif
+
+ /* XXX Set device class. */
+ hd->hp_dev.dv_class = DV_DISK;
}
int
{
register int unit = rdunit(dev);
register struct rd_softc *rs = &rd_softc[unit];
- int error, mask;
+ int error, mask, part;
if (unit >= NRD || (rs->sc_flags & RDF_ALIVE) == 0)
return(ENXIO);
return(error);
}
- mask = 1 << rdpart(dev);
- if (mode == S_IFCHR)
+ part = rdpart(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))
+ return (ENXIO);
+
+ /* Ensure only one open at a time. */
+ switch (mode) {
+ case S_IFCHR:
rs->sc_dkdev.dk_copenmask |= mask;
- else
+ break;
+ case S_IFBLK:
rs->sc_dkdev.dk_bopenmask |= mask;
- rs->sc_dkdev.dk_openmask |= mask;
+ break;
+ }
+ rs->sc_dkdev.dk_openmask =
+ rs->sc_dkdev.dk_copenmask | rs->sc_dkdev.dk_bopenmask;
+
return(0);
}
register struct partition *pinfo;
register daddr_t bn;
register int sz, s;
+ int offset;
#ifdef DEBUG
if (rddebug & RDB_FOLLOW)
bn = bp->b_blkno;
sz = howmany(bp->b_bcount, DEV_BSIZE);
pinfo = &rs->sc_dkdev.dk_label->d_partitions[rdpart(bp->b_dev)];
- if (bn < 0 || bn + sz > pinfo->p_size) {
- sz = pinfo->p_size - bn;
- if (sz == 0) {
- bp->b_resid = bp->b_bcount;
- goto done;
- }
- if (sz < 0) {
- bp->b_error = EINVAL;
- goto bad;
+
+ /* Don't perform partition translation on RAW_PART. */
+ offset = (rdpart(bp->b_dev) == RAW_PART) ? 0 : pinfo->p_offset;
+
+ if (rdpart(bp->b_dev) != RAW_PART) {
+ /*
+ * XXX This block of code belongs in
+ * XXX bounds_check_with_label()
+ */
+
+ if (bn < 0 || bn + sz > pinfo->p_size) {
+ sz = pinfo->p_size - bn;
+ if (sz == 0) {
+ bp->b_resid = bp->b_bcount;
+ goto done;
+ }
+ if (sz < 0) {
+ bp->b_error = EINVAL;
+ goto bad;
+ }
+ bp->b_bcount = dbtob(sz);
}
- bp->b_bcount = dbtob(sz);
- }
- /*
- * Check for write to write protected label
- */
- if (bn + pinfo->p_offset <= LABELSECTOR &&
+ /*
+ * Check for write to write protected label
+ */
+ if (bn + offset <= LABELSECTOR &&
#if LABELSECTOR != 0
- bn + pinfo->p_offset + sz > LABELSECTOR &&
+ bn + offset + sz > LABELSECTOR &&
#endif
- !(bp->b_flags & B_READ) && !(rs->sc_flags & RDF_WLABEL)) {
- bp->b_error = EROFS;
- goto bad;
+ !(bp->b_flags & B_READ) && !(rs->sc_flags & RDF_WLABEL)) {
+ bp->b_error = EROFS;
+ goto bad;
+ }
}
- bp->b_cylin = bn + pinfo->p_offset;
+ bp->b_cylin = bn + offset;
s = splbio();
disksort(dp, bp);
if (dp->b_active == 0) {
}
#endif
+static int rddoingadump; /* simple mutex */
+
/*
* Non-interrupt driven, non-dma dump routine.
*/
int
-rddump(dev)
+rddump(dev, blkno, va, size)
dev_t dev;
+ daddr_t blkno;
+ caddr_t va;
+ size_t size;
{
- int part = rdpart(dev);
- int unit = rdunit(dev);
- register struct rd_softc *rs = &rd_softc[unit];
- register struct hp_device *hp = rs->sc_hd;
- register struct partition *pinfo;
- register daddr_t baddr;
- register int maddr, pages, i;
+ int sectorsize; /* size of a disk sector */
+ int nsects; /* number of sectors in partition */
+ int 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;
+ struct rd_softc *rs;
+ struct hp_device *hp;
+ struct disklabel *lp;
char stat;
- extern int lowram, dumpsize;
-#ifdef DEBUG
- extern int pmapdebug;
- pmapdebug = 0;
-#endif
- /* is drive ok? */
- if (unit >= NRD || (rs->sc_flags & RDF_ALIVE) == 0)
+ /* Check for recursive dump; if so, punt. */
+ if (rddoingadump)
+ return (EFAULT);
+ rddoingadump = 1;
+
+ /* Decompose unit and partition. */
+ unit = rdunit(dev);
+ part = rdpart(dev);
+
+ /* Make sure dump device is ok. */
+ if (unit >= NRD)
+ return (ENXIO);
+ rs = &rd_softc[unit];
+ if ((rs->sc_flags & RDF_ALIVE) == 0)
return (ENXIO);
- pinfo = &rs->sc_dkdev.dk_label->d_partitions[part];
- /* dump parameters in range? */
- if (dumplo < 0 || dumplo >= pinfo->p_size ||
- pinfo->p_fstype != FS_SWAP)
+ hp = rs->sc_hd;
+
+ /*
+ * 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 = lp->d_partitions[part].p_size;
+ sectoff = lp->d_partitions[part].p_offset;
+
+ /* Check transfer bounds against partition size. */
+ if ((blkno < 0) || (blkno + totwrt) > nsects)
return (EINVAL);
- pages = dumpsize;
- if (dumplo + ctod(pages) > pinfo->p_size)
- pages = dtoc(pinfo->p_size - dumplo);
- maddr = lowram;
- baddr = dumplo + pinfo->p_offset;
- /* HPIB idle? */
- if (!hpibreq(&rs->sc_dq)) {
- hpibreset(hp->hp_ctlr);
- rdreset(rs, rs->sc_hd);
- printf("[ drive %d reset ] ", unit);
- }
- for (i = 0; i < pages; i++) {
-#define NPGMB (1024*1024/NBPG)
- /* print out how many Mbs we have dumped */
- if (i && (i % NPGMB) == 0)
- printf("%d ", i / NPGMB);
-#undef NPBMG
+
+ /* Offset block number to start of partition. */
+ blkno += sectoff;
+
+ while (totwrt > 0) {
+ nwrt = totwrt; /* XXX */
+#ifndef RD_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 = RDBTOS(baddr);
+ rs->sc_ioc.c_addr = RDBTOS(blkno);
rs->sc_ioc.c_nop2 = C_NOP;
rs->sc_ioc.c_slen = C_SLEN;
- rs->sc_ioc.c_len = NBPG;
+ rs->sc_ioc.c_len = nwrt * sectorsize;
rs->sc_ioc.c_cmd = C_WRITE;
hpibsend(hp->hp_ctlr, hp->hp_slave, C_CMD,
&rs->sc_ioc.c_unit, sizeof(rs->sc_ioc)-2);
if (hpibswait(hp->hp_ctlr, hp->hp_slave))
return (EIO);
- pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, maddr,
- VM_PROT_READ, TRUE);
- hpibsend(hp->hp_ctlr, hp->hp_slave, C_EXEC, vmmap, NBPG);
+
+ /*
+ * Send the data.
+ */
+ hpibsend(hp->hp_ctlr, hp->hp_slave, C_EXEC, va,
+ nwrt * sectorsize);
(void) hpibswait(hp->hp_ctlr, hp->hp_slave);
hpibrecv(hp->hp_ctlr, hp->hp_slave, C_QSTAT, &stat, 1);
if (stat)
return (EIO);
- maddr += NBPG;
- baddr += ctod(1);
+#else /* RD_DUMP_NOT_TRUSTED */
+ /* Let's just talk about this first... */
+ printf("%s: dump addr %p, blk %d\n", hp->hp_xname,
+ va, blkno);
+ delay(500 * 1000); /* half a second */
+#endif /* RD_DUMP_NOT_TRUSTED */
+
+ /* update block count */
+ totwrt -= nwrt;
+ blkno += nwrt;
+ va += sectorsize * nwrt;
}
+ rddoingadump = 0;
return (0);
}
#endif
+/* $OpenBSD: rd_compat.c,v 1.4 1997/01/12 15:12:59 downsj Exp $ */
/* $NetBSD: rd_compat.c,v 1.5 1996/01/07 22:02:14 thorpej Exp $ */
/*
+/* $OpenBSD: rdreg.h,v 1.4 1997/01/12 15:13:00 downsj Exp $ */
/* $NetBSD: rdreg.h,v 1.7 1996/02/09 18:00:37 scottr Exp $ */
/*
-/* $NetBSD: rdvar.h,v 1.4.4.1 1996/06/06 16:22:03 thorpej Exp $ */
+/* $OpenBSD: rdvar.h,v 1.5 1997/01/12 15:13:00 downsj Exp $ */
+/* $NetBSD: rdvar.h,v 1.5 1996/06/06 16:17:42 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
-/* $NetBSD: scsi.c,v 1.10 1996/05/18 23:57:03 thorpej Exp $ */
+/* $OpenBSD: scsi.c,v 1.5 1997/01/12 15:13:01 downsj Exp $ */
+/* $NetBSD: scsi.c,v 1.13 1996/12/09 03:16:26 thorpej Exp $ */
/*
* Copyright (c) 1990, 1993
#define SCSI_DATA_WAIT 10000 /* wait per data in/out step */
#define SCSI_INIT_WAIT 50000 /* wait per step (both) during init */
-extern void isrlink();
extern void _insque();
extern void _remque();
hs->sc_sq.dq_forw = hs->sc_sq.dq_back = &hs->sc_sq;
/* Establish the interrupt handler. */
- isrlink(scsiintr, hs, hc->hp_ipl, ISRPRI_BIO);
+ (void) isrlink(scsiintr, hs, hc->hp_ipl, ISRPRI_BIO);
+ dmacomputeipl();
/* Reset the controller. */
scsireset(hc->hp_unit);
+/* $OpenBSD: scsireg.h,v 1.2 1997/01/12 15:13:02 downsj Exp $ */
/* $NetBSD: scsireg.h,v 1.4 1994/10/26 07:24:59 cgd Exp $ */
/*
+/* $OpenBSD: scsivar.h,v 1.3 1997/01/12 15:13:02 downsj Exp $ */
/* $NetBSD: scsivar.h,v 1.5 1995/12/02 18:22:14 thorpej Exp $ */
/*
-/* $NetBSD: sd.c,v 1.22.4.1 1996/06/06 16:22:04 thorpej Exp $ */
+/* $OpenBSD: sd.c,v 1.6 1997/01/12 15:13:03 downsj Exp $ */
+/* $NetBSD: sd.c,v 1.28 1997/01/07 09:29:30 thorpej Exp $ */
/*
* Copyright (c) 1990, 1993
disk_attach(&sc->sc_dkdev);
sc->sc_flags |= SDF_ALIVE;
+
+ /* XXX Set device class. */
+ hd->hp_dev.dv_class = DV_DISK;
}
void
{
register int unit = sdunit(dev);
register struct sd_softc *sc = &sd_softc[unit];
- int error, mask;
+ int error, mask, part;
if (unit >= NSD || (sc->sc_flags & SDF_ALIVE) == 0)
return(ENXIO);
return(error);
}
- mask = 1 << sdpart(dev);
- if (mode == S_IFCHR)
+ part = sdpart(dev);
+ mask = 1 << part;
+
+ /* Check that the partition exists. */
+ if (part != RAW_PART &&
+ (part >= sc->sc_dkdev.dk_label->d_npartitions ||
+ sc->sc_dkdev.dk_label->d_partitions[part].p_fstype == FS_UNUSED))
+ return (ENXIO);
+
+ /* Ensure only one open at a time. */
+ switch (mode) {
+ case S_IFCHR:
sc->sc_dkdev.dk_copenmask |= mask;
- else
+ break;
+ case S_IFBLK:
sc->sc_dkdev.dk_bopenmask |= mask;
- sc->sc_dkdev.dk_openmask |= mask;
+ break;
+ }
+ sc->sc_dkdev.dk_openmask =
+ sc->sc_dkdev.dk_copenmask | sc->sc_dkdev.dk_bopenmask;
+
return(0);
}
register struct partition *pinfo;
register daddr_t bn;
register int sz, s;
+ int offset;
if (sc->sc_format_pid >= 0) {
if (sc->sc_format_pid != curproc->p_pid) { /* XXX */
bn = bp->b_blkno;
sz = howmany(bp->b_bcount, DEV_BSIZE);
pinfo = &sc->sc_dkdev.dk_label->d_partitions[sdpart(bp->b_dev)];
- if (bn < 0 || bn + sz > pinfo->p_size) {
- sz = pinfo->p_size - bn;
- if (sz == 0) {
- bp->b_resid = bp->b_bcount;
- goto done;
- }
- if (sz < 0) {
- bp->b_error = EINVAL;
- goto bad;
+
+ /* Don't perform partition translation on RAW_PART. */
+ offset = (sdpart(bp->b_dev) == RAW_PART) ? 0 : pinfo->p_offset;
+
+ if (sdpart(bp->b_dev) != RAW_PART) {
+ /*
+ * XXX This block of code belongs in
+ * XXX bounds_check_with_label()
+ */
+
+ if (bn < 0 || bn + sz > pinfo->p_size) {
+ sz = pinfo->p_size - bn;
+ if (sz == 0) {
+ bp->b_resid = bp->b_bcount;
+ goto done;
+ }
+ if (sz < 0) {
+ bp->b_error = EINVAL;
+ goto bad;
+ }
+ bp->b_bcount = dbtob(sz);
}
- bp->b_bcount = dbtob(sz);
- }
- /*
- * Check for write to write protected label
- */
- if (bn + pinfo->p_offset <= LABELSECTOR &&
+ /*
+ * Check for write to write protected label
+ */
+ if (bn + offset <= LABELSECTOR &&
#if LABELSECTOR != 0
- bn + pinfo->p_offset + sz > LABELSECTOR &&
+ bn + offset + sz > LABELSECTOR &&
#endif
- !(bp->b_flags & B_READ) && !(sc->sc_flags & SDF_WLABEL)) {
- bp->b_error = EROFS;
- goto bad;
+ !(bp->b_flags & B_READ) &&
+ !(sc->sc_flags & SDF_WLABEL)) {
+ bp->b_error = EROFS;
+ goto bad;
+ }
}
/*
* Non-aligned or partial-block transfers handled specially.
sdlblkstrat(bp, sc->sc_blksize);
goto done;
}
- bp->b_cylin = (bn + pinfo->p_offset) >> sc->sc_bshift;
+ bp->b_cylin = (bn + offset) >> sc->sc_bshift;
}
s = splbio();
disksort(dp, bp);
return (psize);
}
+static int sddoingadump; /* simple mutex */
+
/*
* Non-interrupt driven, non-dma dump routine.
*/
int
-sddump(dev)
+sddump(dev, blkno, va, size)
dev_t dev;
+ daddr_t blkno;
+ caddr_t va;
+ size_t size;
{
- int part = sdpart(dev);
- int unit = sdunit(dev);
- register struct sd_softc *sc = &sd_softc[unit];
- register struct hp_device *hp = sc->sc_hd;
- register struct partition *pinfo;
- register daddr_t baddr;
- register int maddr;
- register int pages, i;
- int stat;
- extern int lowram, dumpsize;
-
- /* is drive ok? */
- if (unit >= NSD || (sc->sc_flags & SDF_ALIVE) == 0)
+ int sectorsize; /* size of a disk sector */
+ int nsects; /* number of sectors in partition */
+ int 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;
+ struct sd_softc *sc;
+ struct hp_device *hp;
+ struct disklabel *lp;
+ daddr_t baddr;
+ char stat;
+
+ /* Check for recursive dump; if so, punt. */
+ if (sddoingadump)
+ return (EFAULT);
+ sddoingadump = 1;
+
+ /* Decompose unit and partition. */
+ unit = sdunit(dev);
+ part = sdpart(dev);
+
+ /* Make sure device is ok. */
+ if (unit >= NSD)
+ return (ENXIO);
+ sc = &sd_softc[unit];
+ if ((sc->sc_flags & SDF_ALIVE) == 0)
return (ENXIO);
- pinfo = &sc->sc_dkdev.dk_label->d_partitions[part];
- /* dump parameters in range? */
- if (dumplo < 0 || dumplo >= pinfo->p_size ||
- pinfo->p_fstype != FS_SWAP)
+ hp = sc->sc_hd;
+
+ /*
+ * Convert to disk sectors. Request must be a multiple of size.
+ */
+ lp = sc->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 = lp->d_partitions[part].p_size;
+ sectoff = lp->d_partitions[part].p_offset;
+
+ /* Check transfer bounds against partition size. */
+ if ((blkno < 0) || (blkno + totwrt) > nsects)
return (EINVAL);
- pages = dumpsize;
- if (dumplo + ctod(pages) > pinfo->p_size)
- pages = dtoc(pinfo->p_size - dumplo);
- maddr = lowram;
- baddr = dumplo + pinfo->p_offset;
- /* scsi bus idle? */
- if (!scsireq(&sc->sc_dq)) {
- scsireset(hp->hp_ctlr);
- sdreset(sc, sc->sc_hd);
- printf("[ drive %d reset ] ", unit);
- }
- for (i = 0; i < pages; i++) {
-#define NPGMB (1024*1024/NBPG)
- /* print out how many Mbs we have dumped */
- if (i && (i % NPGMB) == 0)
- printf("%d ", i / NPGMB);
-#undef NPBMG
- pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, maddr,
- VM_PROT_READ, TRUE);
+
+ /* Offset block number to start of partition. */
+ blkno += sectoff;
+
+ while (totwrt > 0) {
+ nwrt = totwrt; /* XXX */
+#ifndef SD_DUMP_NOT_TRUSTED
+ /*
+ * Send the data. Note the `0' argument for bshift;
+ * we've done the necessary conversion above.
+ */
stat = scsi_tt_write(hp->hp_ctlr, hp->hp_slave, sc->sc_punit,
- vmmap, NBPG, baddr, sc->sc_bshift);
+ va, nwrt * sectorsize, blkno, 0);
if (stat) {
- printf("sddump: scsi write error 0x%x\n", stat);
+ printf("\nsddump: scsi write error 0x%x\n", stat);
return (EIO);
}
- maddr += NBPG;
- baddr += ctod(1);
+#else /* SD_DUMP_NOT_TRUSTED */
+ /* Lets just talk about it first. */
+ printf("%s: dump addr %p, blk %d\n", hp->hp_xname,
+ va, blkno);
+ delay(500 * 1000); /* half a second */
+#endif /* SD_DUMP_NOT_TRUSTED */
+
+ /* update block count */
+ totwrt -= nwrt;
+ blkno += nwrt;
+ va += sectorsize * nwrt;
}
+ sddoingadump = 0;
return (0);
}
#endif
+/* $OpenBSD: sd_compat.c,v 1.3 1997/01/12 15:13:04 downsj Exp $ */
/* $NetBSD: sd_compat.c,v 1.4 1996/01/07 22:02:20 thorpej Exp $ */
/*
-/* $NetBSD: sdvar.h,v 1.4.4.1 1996/06/06 16:22:06 thorpej Exp $ */
+/* $OpenBSD: sdvar.h,v 1.5 1997/01/12 15:13:04 downsj Exp $ */
+/* $NetBSD: sdvar.h,v 1.5 1996/06/06 16:17:45 thorpej Exp $ */
/*
* Copyright (c) 1990, 1993
-/* $NetBSD: st.c,v 1.14.4.1 1996/06/10 06:45:33 thorpej Exp $ */
+/* $OpenBSD: st.c,v 1.5 1997/01/12 15:13:05 downsj Exp $ */
+/* $NetBSD: st.c,v 1.18 1996/10/14 07:14:21 thorpej Exp $ */
/*
* Copyright (c) 1990 University of Utah.
sc->sc_dq.dq_driver = &stdriver;
sc->sc_blkno = 0;
sc->sc_flags = STF_ALIVE;
+
+ /* XXX Set device class. */
+ hd->hp_dev.dv_class = DV_TAPE;
}
int
+/* $OpenBSD: stvar.h,v 1.2 1997/01/12 15:13:06 downsj Exp $ */
/* $NetBSD: stvar.h,v 1.4 1994/10/26 07:25:14 cgd Exp $ */
/*
-/* $NetBSD: Locore.c,v 1.12 1996/02/02 18:05:55 mycroft Exp $ */
+/* $OpenBSD: Locore.c,v 1.4 1997/01/12 15:13:09 downsj Exp $ */
+/* $NetBSD: Locore.c,v 1.16 1996/11/06 20:19:29 cgd Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
/*ARGSUSED*/
skpc(mask, size, cp) int mask; int size; char *cp; { return (0); }
-/*ARGSUSED*/
-locc(mask, size, cp) int mask; char *cp; unsigned size; { return (0); }
-
/*ARGSUSED*/
ffs(v) long v; { return (0); }
-/* $NetBSD: autoconf.c,v 1.20 1996/05/18 01:39:57 thorpej Exp $ */
+/* $OpenBSD: autoconf.c,v 1.7 1997/01/12 15:13:10 downsj Exp $ */
+/* $NetBSD: autoconf.c,v 1.29 1996/12/17 08:41:19 thorpej Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* 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:
*/
/*
- * Setup the system to run on the current machine.
- *
- * Configure() is called at boot time. Available
- * devices are determined (from possibilities mentioned in ioconf.c),
- * and the drivers are initialized.
+ * Setup the system to run on the current machine.
+ *
+ * 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/map.h>
+#include <sys/malloc.h>
+#include <sys/buf.h>
+#include <sys/disklabel.h>
+#include <sys/device.h>
+#include <sys/conf.h>
+#include <sys/dmap.h>
+#include <sys/reboot.h>
+#include <sys/device.h>
+#include <sys/queue.h>
+
+#include <dev/cons.h>
+
+#include <machine/autoconf.h>
+#include <machine/vmparam.h>
+#include <machine/cpu.h>
+#include <machine/pte.h>
+
+#include <hp300/hp300/isr.h>
+
+#include <hp300/dev/dioreg.h>
+#include <hp300/dev/diovar.h>
+#include <hp300/dev/diodevs.h>
+
+#include <hp300/dev/device.h>
+#include <hp300/dev/grfreg.h>
+#include <hp300/dev/hilreg.h>
+
+/*
+ * The following several variables are related to
+ * the configuration process, and are used in initializing
+ * the machine.
+ */
+int cold; /* if 1, still working on cold-start */
+
+/* XXX must be allocated statically because of early console init */
+struct map extiomap[EIOMAPSIZE/16];
+
+extern caddr_t internalhpib;
+extern char *extiobase;
+
+/* The boot device. */
+struct device *booted_device;
+
+/* 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 */
+
+#if 1 /* XXX for now */
+struct scsi_link {
+ int target;
+ int lun;
+};
+
+struct scsibus_attach_args {
+ struct scsi_link *sa_scsi_link;
+};
+
+struct hpib_attach_args {
+ int ha_slave;
+ int ha_punit;
+};
+#endif /* XXX */
+
+#ifndef NEWCONFIG /* XXX */
+struct hp_hw sc_table[MAXCTLRS];
+
+#ifdef DEBUG
+int acdebug = 0;
+#endif
+
+struct devicelist alldevs;
+struct evcntlist allevents;
+
+struct dio_attach_args hp300_dio_attach_args;
+struct scsi_link hp300_scsi_link;
+struct scsibus_attach_args hp300_scsibus_attach_args;
+struct hpib_attach_args hp300_hpib_attach_args;
+#endif /* ! NEWCONFIG */
+
+void setroot __P((void));
+void swapconf __P((void));
+void findbootdev __P((void));
+void findbootdev_slave __P((ddlist_t *, int, int, int));
+void setbootdev __P((void));
+
+static struct dev_data *dev_data_lookup __P((struct device *));
+static void dev_data_insert __P((struct dev_data *, ddlist_t *));
+
+static struct device *parsedisk __P((char *str, int len, int defpart,
+ dev_t *devp));
+static struct device *getdisk __P((char *str, int len, int defpart,
+ dev_t *devp));
+static int findblkmajor __P((struct device *dv));
+static char *findblkname __P((int));
+static int getstr __P((char *cp, int size));
+
+#ifdef NEWCONFIG
+int mainbusmatch __P((struct device *, struct cfdata *, void *));
+void mainbusattach __P((struct device *, struct device *, void *));
+int mainbussearch __P((struct device *, struct cfdata *, 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;
+ struct cfdata *match;
+ void *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, cf, aux)
+ struct device *parent;
+ struct cfdata *cf;
+ void *aux;
+{
+
+ if ((*cf->cf_attach->ca_match)(parent, cf, NULL) > 0)
+ config_attach(parent, cf, NULL, NULL);
+ return (0);
+}
+#endif /* NEWCONFIG */
+
+/*
+ * Determine the device configuration for the running system.
+ */
+void
+configure()
+{
+ register struct hp_hw *hw;
+ int found;
+
+ /*
+ * Initialize the dev_data_lists.
+ */
+ LIST_INIT(&dev_data_list);
+ LIST_INIT(&dev_data_list_hpib);
+ LIST_INIT(&dev_data_list_scsi);
+
+ /* Initialize the interrupt system. */
+ isrinit();
+
+ /*
+ * XXX Enable interrupts. We have to do this now so that the
+ * XXX HIL configures.
+ */
+ (void)spl0();
+
+ /*
+ * XXX: these should be consolidated into some kind of table
+ */
+ hilsoftinit(0, HILADDR);
+ hilinit(0, HILADDR);
+ dmainit();
+
+#ifdef NEWCONFIG
+ (void)splhigh();
+ if (config_rootfound("mainbus", "mainbus") == NULL)
+ panic("no mainbus found");
+ (void)spl0();
+#else
+ /*
+ * Find out what hardware is attached to the machine.
+ */
+ find_devs();
+
+ /*
+ * Look over each hardware device actually found and attempt
+ * to match it with an ioconf.c table entry.
+ */
+ for (hw = sc_table; hw->hw_type; hw++) {
+ if (HW_ISCTLR(hw))
+ found = find_controller(hw);
+ else
+ found = find_device(hw);
+
+ if (!found) {
+ extern char *dio_devinfo __P((struct dio_attach_args *,
+ char *, size_t));
+ int sc = hw->hw_sc;
+ char descbuf[80];
+
+ bzero(&hp300_dio_attach_args,
+ sizeof(hp300_dio_attach_args));
+ hp300_dio_attach_args.da_scode = sc;
+ hp300_dio_attach_args.da_id = hw->hw_id;
+ hp300_dio_attach_args.da_secid = hw->hw_secid;
+ printf("%s", dio_devinfo(&hp300_dio_attach_args,
+ descbuf, sizeof(descbuf)));
+ if (sc >= 0 && sc < 256)
+ printf(" at scode %d", sc);
+ else
+ printf(" csr at 0x%lx", (u_long)hw->hw_pa);
+ printf(" not configured\n");
+ }
+ }
+#endif /* NEWCONFIG */
+
+ isrprintlevels();
+
+ /*
+ * 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 (booted_device == 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", booted_device->dv_xname);
+ }
+ }
+
+ setroot();
+ swapconf();
+
+ /*
+ * Set bootdev based on how we mounted root.
+ * This is given to the boot program when we reboot.
+ */
+ setbootdev();
+
+ cold = 0;
+}
+
+/**********************************************************************
+ * Code to find and set the boot device
+ **********************************************************************/
+
+/*
+ * 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;
+
+ /*
+ * 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);
+ if (dd == NULL)
+ panic("device_register: can't allocate dev_data");
+ bzero(dd, sizeof(struct 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 (bcmp(dev->dv_xname, "hpib", 4) == 0 ||
+ bcmp(dev->dv_xname, "scsi", 4) == 0) {
+ struct dio_attach_args *da = aux;
+
+ dd->dd_scode = da->da_scode;
+ goto linkup;
+ }
+
+ if (bcmp(dev->dv_xname, "rd", 2) == 0) {
+ struct hpib_attach_args *ha = aux;
+
+ dd->dd_slave = ha->ha_slave;
+ dd->dd_punit = ha->ha_punit;
+ goto linkup;
+ }
+
+ if (bcmp(dev->dv_xname, "sd", 2) == 0) {
+ struct scsibus_attach_args *sa = aux;
+
+ dd->dd_slave = sa->sa_scsi_link->target;
+ dd->dd_punit = sa->sa_scsi_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 (bcmp(dev->dv_xname, "hpib", 4) == 0) {
+ dev_data_insert(dd, &dev_data_list_hpib);
+ return;
+ }
+
+ if (bcmp(dev->dv_xname, "scsi", 4) == 0) {
+ dev_data_insert(dd, &dev_data_list_scsi);
+ return;
+ }
+}
+
+/*
+ * Configure swap space and related parameters.
+ */
+void
+swapconf()
+{
+ struct swdevt *swp;
+ int nblks, maj;
+
+ for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
+ maj = major(swp->sw_dev);
+ if (maj > nblkdev)
+ break;
+ if (bdevsw[maj].d_psize) {
+ nblks = (*bdevsw[maj].d_psize)(swp->sw_dev);
+ if (nblks != -1 &&
+ (swp->sw_nblks == 0 || swp->sw_nblks > nblks))
+ swp->sw_nblks = nblks;
+ swp->sw_nblks = ctod(dtoc(swp->sw_nblks));
+ }
+ }
+ dumpconf();
+}
+
+struct nam2blk {
+ char *name;
+ int maj;
+} nam2blk[] = {
+ { "ct", 0 },
+ { "rd", 2 },
+ { "sd", 4 },
+};
+
+static int
+findblkmajor(dv)
+ struct device *dv;
+{
+ char *name = dv->dv_xname;
+ register int i;
+
+ for (i = 0; i < sizeof(nam2blk) / sizeof(nam2blk[0]); ++i)
+ if (strncmp(name, nam2blk[i].name, strlen(nam2blk[0].name))
+ == 0)
+ return (nam2blk[i].maj);
+ return (-1);
+}
+
+static char *
+findblkname(maj)
+ int maj;
+{
+ register int i;
+
+ for (i = 0; i < sizeof(nam2blk) / sizeof(nam2blk[0]); ++i)
+ if (maj == nam2blk[i].maj)
+ return (nam2blk[i].name);
+ return (NULL);
+}
+
+static struct device *
+getdisk(str, len, defpart, devp)
+ char *str;
+ int len, defpart;
+ dev_t *devp;
+{
+ register struct device *dv;
+
+ if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
+ printf("use one of:");
+ for (dv = alldevs.tqh_first; dv != NULL;
+ dv = dv->dv_list.tqe_next) {
+ if (dv->dv_class == DV_DISK)
+ printf(" %s[a-h]", dv->dv_xname);
+#ifdef NFSCLIENT
+ if (dv->dv_class == DV_IFNET)
+ printf(" %s", dv->dv_xname);
+#endif
+ }
+ printf(" halt\n");
+ }
+ return (dv);
+}
+
+static struct device *
+parsedisk(str, len, defpart, devp)
+ char *str;
+ int len, defpart;
+ dev_t *devp;
+{
+ register struct device *dv;
+ register char *cp, c;
+ int majdev, part;
+
+ if (len == 0)
+ return (NULL);
+
+ if (len == 4 && !strcmp(str, "halt"))
+ boot(RB_HALT);
+
+ cp = str + len - 1;
+ c = *cp;
+ if (c >= 'a' && c <= ('a' + MAXPARTITIONS - 1)) {
+ part = c - 'a';
+ *cp = '\0';
+ } else
+ part = defpart;
+
+ for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ if (dv->dv_class == DV_DISK &&
+ strcmp(str, dv->dv_xname) == 0) {
+ majdev = findblkmajor(dv);
+ if (majdev < 0)
+ panic("parsedisk");
+ *devp = MAKEDISKDEV(majdev, dv->dv_unit, part);
+ break;
+ }
+#ifdef NFSCLIENT
+ if (dv->dv_class == DV_IFNET &&
+ strcmp(str, dv->dv_xname) == 0) {
+ *devp = NODEV;
+ break;
+ }
+#endif
+ }
+
+ *cp = c;
+ return (dv);
+}
+
+/*
+ * Attempt to find the device from which we were booted.
+ * If we can do so, and not instructed not to do so,
+ * change rootdev to correspond to the load device.
+ *
+ * XXX Actually, swap and root must be on the same type of device,
+ * (ie. DV_DISK or DV_IFNET) because of how (*mountroot) is written.
+ * That should be fixed.
+ */
+void
+setroot()
+{
+ struct swdevt *swp;
+ struct device *dv;
+ register int len;
+ dev_t nrootdev, nswapdev = NODEV;
+ char buf[128], *rootdevname;
+ extern int (*mountroot) __P((void));
+ dev_t temp;
+ struct device *bootdv, *rootdv, *swapdv;
+ int bootpartition = 0;
+#ifdef NFSCLIENT
+ extern char *nfsbootdevname;
+ extern int nfs_mountroot __P((void));
+#endif
+#ifdef FFS
+ extern int ffs_mountroot __P((void));
+#endif
+
+ bootdv = booted_device;
+
+ /*
+ * If 'swap generic' and we couldn't determine root device,
+ * ask the user.
+ */
+ if (mountroot == NULL && bootdv == NULL)
+ boothowto |= RB_ASKNAME;
+
+ /*
+ * 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;
+
+ if (boothowto & RB_ASKNAME) {
+ for (;;) {
+ printf("root device");
+ if (bootdv != NULL) {
+ printf(" (default %s", bootdv->dv_xname);
+ if (bootdv->dv_class == DV_DISK)
+ printf("%c", bootpartition + 'a');
+ printf(")");
+ }
+ printf(": ");
+ len = getstr(buf, sizeof(buf));
+ if (len == 0 && bootdv != NULL) {
+ strcpy(buf, bootdv->dv_xname);
+ len = strlen(buf);
+ }
+ if (len > 0 && buf[len - 1] == '*') {
+ buf[--len] = '\0';
+ dv = getdisk(buf, len, 1, &nrootdev);
+ if (dv != NULL) {
+ rootdv = dv;
+ nswapdev = nrootdev;
+ goto gotswap;
+ }
+ }
+ dv = getdisk(buf, len, bootpartition, &nrootdev);
+ if (dv != NULL) {
+ rootdv = dv;
+ break;
+ }
+ }
+
+ /*
+ * Because swap must be on the same device type as root,
+ * for network devices this is easy.
+ */
+ if (rootdv->dv_class == DV_IFNET) {
+ swapdv = NULL;
+ goto gotswap;
+ }
+ for (;;) {
+ printf("swap device");
+ printf(" (default %s", rootdv->dv_xname);
+ if (rootdv->dv_class == DV_DISK)
+ printf("b");
+ printf(")");
+ printf(": ");
+ len = getstr(buf, sizeof(buf));
+ if (len == 0) {
+ switch (rootdv->dv_class) {
+ case DV_IFNET:
+ nswapdev = NODEV;
+ break;
+ case DV_DISK:
+ nswapdev = MAKEDISKDEV(major(nrootdev),
+ DISKUNIT(nrootdev), 1);
+ break;
+ case DV_TAPE:
+ case DV_TTY:
+ case DV_DULL:
+ case DV_CPU:
+ break;
+ }
+ swapdv = rootdv;
+ break;
+ }
+ dv = getdisk(buf, len, 1, &nswapdev);
+ if (dv) {
+ if (dv->dv_class == DV_IFNET)
+ nswapdev = NODEV;
+ swapdv = dv;
+ break;
+ }
+ }
+ gotswap:
+ rootdev = nrootdev;
+ dumpdev = nswapdev;
+ swdevt[0].sw_dev = nswapdev;
+ swdevt[1].sw_dev = NODEV;
+ } else if (mountroot == NULL) {
+ int majdev;
+
+ /*
+ * "swap generic"
+ */
+ majdev = findblkmajor(bootdv);
+ if (majdev >= 0) {
+ /*
+ * Root and swap are on a disk.
+ */
+ rootdv = swapdv = bootdv;
+ rootdev = MAKEDISKDEV(majdev, bootdv->dv_unit,
+ bootpartition);
+ nswapdev = dumpdev =
+ MAKEDISKDEV(majdev, bootdv->dv_unit, 1);
+ } else {
+ /*
+ * Root and swap are on a net.
+ */
+ rootdv = swapdv = bootdv;
+ nswapdev = dumpdev = NODEV;
+ }
+ swdevt[0].sw_dev = nswapdev;
+ swdevt[1].sw_dev = NODEV;
+ } else {
+ /*
+ * `root DEV swap DEV': honor rootdev/swdevt.
+ * rootdev/swdevt/mountroot already properly set.
+ */
+
+#ifdef NFSCLIENT
+ if (mountroot == nfs_mountroot) {
+ struct dev_data *dd;
+ /*
+ * `root on nfs'. Find the first network
+ * interface.
+ */
+ for (dd = dev_data_list.lh_first;
+ dd != NULL; dd = dd->dd_list.le_next) {
+ if (dd->dd_dev->dv_class == DV_IFNET) {
+ /* Got it! */
+ break;
+ }
+ }
+ if (dd == NULL) {
+ printf("no network interface for NFS root");
+ panic("setroot");
+ }
+ root_device = dd->dd_dev;
+ return;
+ }
+#endif
+ rootdevname = findblkname(major(rootdev));
+ if (rootdevname == NULL) {
+ printf("unknown root device major 0x%x\n", rootdev);
+ panic("setroot");
+ }
+ bzero(buf, sizeof(buf));
+ sprintf(buf, "%s%d", rootdevname, DISKUNIT(rootdev));
+
+ for (dv = alldevs.tqh_first; dv != NULL;
+ dv = dv->dv_list.tqe_next) {
+ if (strcmp(buf, dv->dv_xname) == 0) {
+ root_device = dv;
+ break;
+ }
+ }
+ if (dv == NULL) {
+ printf("device %s (0x%x) not configured\n",
+ buf, rootdev);
+ panic("setroot");
+ }
+
+ return;
+ }
+
+ root_device = rootdv;
+
+ switch (rootdv->dv_class) {
+#ifdef NFSCLIENT
+ case DV_IFNET:
+ mountroot = nfs_mountroot;
+ nfsbootdevname = rootdv->dv_xname;
+ return;
+#endif
+#ifdef FFS
+ case DV_DISK:
+ mountroot = ffs_mountroot;
+ printf("root on %s%c", rootdv->dv_xname,
+ DISKPART(rootdev) + 'a');
+ if (nswapdev != NODEV)
+ printf(" swap on %s%c", swapdv->dv_xname,
+ DISKPART(nswapdev) + 'a');
+ printf("\n");
+ break;
+#endif
+ default:
+ printf("can't figure root, hope your kernel is right\n");
+ return;
+ }
+
+ /*
+ * Make the swap partition on the root drive the primary swap.
+ */
+ temp = NODEV;
+ for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
+ if (major(rootdev) == major(swp->sw_dev) &&
+ DISKUNIT(rootdev) == DISKUNIT(swp->sw_dev)) {
+ temp = swdevt[0].sw_dev;
+ swdevt[0].sw_dev = swp->sw_dev;
+ swp->sw_dev = temp;
+ break;
+ }
+ }
+ if (swp->sw_dev == NODEV)
+ return;
+
+ /*
+ * If dumpdev was the same as the old primary swap device, move
+ * it to the new primary swap device.
+ */
+ if (temp == dumpdev)
+ dumpdev = swdevt[0].sw_dev;
+
+}
+
+static int
+getstr(cp, size)
+ register char *cp;
+ register int size;
+{
+ register char *lp;
+ register int c;
+ register int len;
+
+ lp = cp;
+ len = 0;
+ for (;;) {
+ c = cngetc();
+ switch (c) {
+ case '\n':
+ case '\r':
+ printf("\n");
+ *lp++ = '\0';
+ return (len);
+ case '\b':
+ case '\177':
+ case '#':
+ if (len) {
+ --len;
+ --lp;
+ printf("\b \b");
+ }
+ continue;
+ case '@':
+ case 'u'&037:
+ len = 0;
+ lp = cp;
+ printf("\n");
+ continue;
+ default:
+ if (len + 1 >= size || c < ' ') {
+ printf("\007");
+ continue;
+ }
+ printf("%c", c);
+ ++len;
+ *lp++ = c;
+ }
+ }
+}
+
+void
+findbootdev()
+{
+ int type, ctlr, slave, punit;
+ int scsiboot, hpibboot, netboot;
+ struct dev_data *dd;
+
+ booted_device = 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/rd 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) {
+ for (dd = dev_data_list.lh_first; dd != NULL;
+ dd = dd->dd_list.le_next) {
+ if (dd->dd_dev->dv_class == DV_IFNET) {
+ /*
+ * Found it!
+ */
+ booted_device = dd->dd_dev;
+ break;
+ }
+ }
+ return;
+ }
+
+ /*
+ * Check for HP-IB boots next.
+ */
+ if (hpibboot) {
+ findbootdev_slave(&dev_data_list_hpib, ctlr,
+ slave, punit);
+ if (booted_device == NULL)
+ return;
+
+ /*
+ * Sanity check.
+ */
+ if ((type == 0 && bcmp(booted_device->dv_xname, "ct", 2)) ||
+ (type == 2 && bcmp(booted_device->dv_xname, "rd", 2))) {
+ printf("WARNING: boot device/type mismatch!\n");
+ printf("device = %s, type = %d\n",
+ booted_device->dv_xname, type);
+ booted_device = NULL;
+ }
+ return;
+ }
+
+ /*
+ * Check for SCSI boots last.
+ */
+ if (scsiboot) {
+ findbootdev_slave(&dev_data_list_scsi, ctlr,
+ slave, punit);
+ if (booted_device == NULL)
+ return;
+
+ /*
+ * Sanity check.
+ */
+ if ((type == 4 && bcmp(booted_device->dv_xname, "sd", 2))) {
+ printf("WARNING: boot device/type mismatch!\n");
+ printf("device = %s, type = %d\n",
+ booted_device->dv_xname, type);
+ booted_device = NULL;
+ }
+ 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 = ddlist->lh_first; ctlr != 0 && cdd != NULL;
+ cdd = cdd->dd_clist.le_next)
+ 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.
+ */
+ for (dd = dev_data_list.lh_first; dd != NULL;
+ dd = dd->dd_list.le_next) {
+ if (dd->dd_dev->dv_parent == cdd->dd_dev &&
+ dd->dd_slave == slave &&
+ dd->dd_punit == punit) {
+ /*
+ * Found it!
+ */
+ booted_device = dd->dd_dev;
+ break;
+ }
+ }
+}
+
+void
+setbootdev()
+{
+ struct dev_data *cdd, *dd;
+ int type, ctlr;
+
+ /*
+ * Note our magic numbers for type:
+ *
+ * 0 == ct
+ * 2 == rd
+ * 4 == sd
+ * 6 == le
+ *
+ * Allare bdevsw major numbers, except for le, which
+ * is just special.
+ *
+ * We can't mount root on a tape, so we ignore those.
+ */
+
+ /*
+ * Start with a clean slate.
+ */
+ bootdev = 0;
+
+ 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 (bcmp(root_device->dv_xname, "rd", 2) == 0)
+ type = 2;
+ else if (bcmp(root_device->dv_xname, "sd", 2) == 0)
+ type = 4;
+ else {
+ printf("WARNING: strange root device!\n");
+ goto out;
+ }
+
+ /*
+ * Get parent's info.
+ */
+ cdd = dev_data_lookup(root_device->dv_parent);
+ switch (type) {
+ case 2:
+ for (cdd = dev_data_list_hpib.lh_first, ctlr = 0;
+ cdd != NULL; cdd = cdd->dd_clist.le_next, ctlr++) {
+ if (cdd->dd_dev == root_device->dv_parent) {
+ /*
+ * Found it!
+ */
+ bootdev = MAKEBOOTDEV(type,
+ ctlr, dd->dd_slave, dd->dd_punit,
+ DISKPART(rootdev));
+ break;
+ }
+ }
+ break;
+
+ case 4:
+ for (cdd = dev_data_list_scsi.lh_first, ctlr = 0;
+ cdd != NULL; cdd = cdd->dd_clist.le_next, ctlr++) {
+ if (cdd->dd_dev == root_device->dv_parent) {
+ /*
+ * Found it!
+ */
+ bootdev = MAKEBOOTDEV(type,
+ ctlr, dd->dd_slave, dd->dd_punit,
+ DISKPART(rootdev));
+ break;
+ }
+ }
+ break;
+ }
+
+ out:
+ /* Don't need this anymore. */
+ for (dd = dev_data_list.lh_first; dd != NULL; ) {
+ cdd = dd;
+ dd = dd->dd_list.le_next;
+ 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;
+
+ for (dd = dev_data_list.lh_first; dd != NULL; dd = dd->dd_list.le_next)
+ 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;
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/map.h>
-#include <sys/buf.h>
-#include <sys/dkstat.h>
-#include <sys/conf.h>
-#include <sys/dmap.h>
-#include <sys/reboot.h>
-#include <sys/device.h>
+#ifdef DIAGNOSTIC
+ if (dd->dd_scode < 0 || dd->dd_scode > 255) {
+ printf("bogus select code for %s\n", dd->dd_dev->dv_xname);
+ panic("dev_data_insert");
+ }
+#endif
-#include <dev/cons.h>
+ de = ddlist->lh_first;
-#include <machine/autoconf.h>
-#include <machine/vmparam.h>
-#include <machine/cpu.h>
-#include <machine/pte.h>
+ /*
+ * Just insert at head if list is empty.
+ */
+ if (de == NULL) {
+ LIST_INSERT_HEAD(ddlist, dd, dd_clist);
+ return;
+ }
-#include <hp300/hp300/isr.h>
+ /*
+ * 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->dd_clist.le_next != NULL; de = de->dd_clist.le_next) {
+ if (de->dd_scode > dd->dd_scode) {
+ LIST_INSERT_BEFORE(de, dd, dd_clist);
+ return;
+ }
+ }
-#include <hp300/dev/device.h>
-#include <hp300/dev/grfreg.h>
-#include <hp300/dev/hilreg.h>
+ /*
+ * 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
+ **********************************************************************/
/*
- * The following several variables are related to
- * the configuration process, and are used in initializing
- * the machine.
+ * Scan all select codes, passing the corresponding VA to (*func)().
+ * (*func)() is a driver-specific routine that looks for the console
+ * hardware.
*/
-int cold; /* if 1, still working on cold-start */
-struct hp_hw sc_table[MAXCTLRS];
+void
+console_scan(func, arg)
+ int (*func) __P((int, caddr_t, void *));
+ void *arg;
+{
+ int size, scode, sctop;
+ caddr_t pa, va;
-/* XXX must be allocated statically because of early console init */
-struct map extiomap[EIOMAPSIZE/16];
+ /*
+ * 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) {
+ /*
+ * Abort mission if console has been forced.
+ */
+ if (conforced)
+ return;
-extern caddr_t internalhpib;
-extern char *extiobase;
+ /*
+ * Skip over the select code hole and
+ * the internal HP-IB controller.
+ */
+ if (((scode >= 32) && (scode < 132)) ||
+ ((scode == 7) && internalhpib))
+ continue;
-#ifdef DEBUG
-int acdebug = 0;
-#endif
+ /* Map current PA. */
+ pa = dio_scodetopa(scode);
+ va = iomap(pa, NBPG);
+ if (va == 0)
+ continue;
-#ifndef NEWCONFIG /* XXX */
-struct devicelist alldevs;
-struct evcntlist allevents;
-#endif
+ /* Check to see if hardware exists. */
+ if (badaddr(va)) {
+ iounmap(va, NBPG);
+ continue;
+ }
+
+ /*
+ * Hardware present, call callback. Driver returns
+ * size of region to map if console probe successful
+ * and worthwhile.
+ */
+ size = (*func)(scode, va, arg);
+ iounmap(va, NBPG);
+ if (size) {
+ /* Free last mapping. */
+ if (convasize)
+ iounmap(conaddr, convasize);
+ convasize = 0;
+
+ /* Remap to correct size. */
+ va = iomap(pa, size);
+ if (va == 0)
+ continue;
+
+ /* Save this state for next time. */
+ conscode = scode;
+ conaddr = va;
+ convasize = size;
+ }
+ }
+}
/*
- * Determine mass storage and memory configuration for a machine.
+ * Special version of cninit(). Actually, crippled somewhat.
+ * This version lets the drivers assign cn_tab.
*/
-configure()
+void
+hp300_cninit()
{
- register struct hp_hw *hw;
- int found;
+ struct consdev *cp;
+ extern struct consdev constab[];
+
+ cn_tab = NULL;
/*
- * Find out what hardware is attached to the machine.
- * XXX goes away with new config.
+ * Call all of the console probe functions.
*/
- find_devs();
+ for (cp = constab; cp->cn_probe; cp++)
+ (*cp->cn_probe)(cp);
/*
- * XXX: these should be consolidated into some kind of table
+ * No console, we can handle it.
*/
- hilsoftinit(0, HILADDR);
- hilinit(0, HILADDR);
- isrinit();
- dmainit();
+ if (cn_tab == NULL)
+ return;
/*
- * Look over each hardware device actually found and attempt
- * to match it with an ioconf.c table entry.
+ * Turn on the console.
*/
- for (hw = sc_table; hw->hw_type; hw++) {
- if (HW_ISCTLR(hw))
- found = find_controller(hw);
- else
- found = find_device(hw);
+ (*cn_tab->cn_init)(cn_tab);
+}
- if (!found) {
- int sc = patosc(hw->hw_pa);
+/**********************************************************************
+ * Mapping functions
+ **********************************************************************/
- printf("unconfigured card id %x ", hw->hw_id);
- if (sc < 256)
- printf("at sc%d\n", sc);
- else
- printf("csr at %x\n", sc);
- }
- }
+/*
+ * 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;
+{
+ int ix, npf;
+ caddr_t kva;
-#if GENERIC
- if ((boothowto & RB_ASKNAME) == 0)
- setroot();
- setconf();
-#else
- setroot();
+#ifdef DEBUG
+ if (((int)pa & PGOFSET) || (size & PGOFSET))
+ panic("iomap: unaligned");
#endif
- swapconf();
- cold = 0;
+ npf = btoc(size);
+ ix = rmalloc(extiomap, npf);
+ if (ix == 0)
+ return(0);
+ kva = extiobase + ctob(ix-1);
+ physaccess(kva, pa, size, PG_RW|PG_CI);
+ return(kva);
+}
+
+/*
+ * Unmap a previously mapped device.
+ */
+void
+iounmap(kva, size)
+ caddr_t kva;
+ int size;
+{
+ int ix;
+
+#ifdef DEBUG
+ if (((int)kva & PGOFSET) || (size & PGOFSET))
+ panic("iounmap: unaligned");
+ if (kva < extiobase || kva >= extiobase + ctob(EIOMAPSIZE))
+ panic("iounmap: bad address");
+#endif
+ physunaccess(kva, size);
+ ix = btoc(kva - extiobase) + 1;
+ rmfree(extiomap, btoc(size), ix);
+}
+
+/**********************************************************************
+ * Old-style device configuration code
+ **********************************************************************/
+
+#ifndef NEWCONFIG
+
+/*
+ * Duplicate of the same in subr_autoconf.c
+ */
+void
+config_init()
+{
+
+ TAILQ_INIT(&alldevs);
+ TAILQ_INIT(&allevents);
}
#define dr_type(d, s) \
if ((*hc->hp_driver->d_match)(hc)) {
hc->hp_alive = 1;
- /* Set up external name. */
- bzero(hc->hp_xname, sizeof(hc->hp_xname));
- sprintf(hc->hp_xname, "%s%d", hc->hp_driver->d_name,
+ /*
+ * Fill in fake device structure.
+ */
+ bzero(&hc->hp_dev, sizeof(hc->hp_dev));
+ hc->hp_dev.dv_unit = hc->hp_unit;
+ sprintf(hc->hp_dev.dv_xname, "%s%d", hc->hp_driver->d_name,
hc->hp_unit);
+ hc->hp_dev.dv_class = DV_DULL; /* all controllers are dull */
+ TAILQ_INSERT_TAIL(&alldevs, &hc->hp_dev, dv_list);
/* Print what we've found. */
printf("%s at ", hc->hp_xname);
- sc = patosc(hw->hw_pa);
- if (sc < 256)
- printf("scode%d", sc);
+ sc = hw->hw_sc;
+ if (sc >= 0 && sc < 256)
+ printf("scode %d", sc);
else
- printf("addr 0x%x,", sc);
+ printf("addr 0x%lx,", (u_long)hw->hw_pa);
printf(" ipl %d", hc->hp_ipl);
if (hc->hp_flags)
printf(" flags 0x%x", hc->hp_flags);
* newline for us.
*/
(*hc->hp_driver->d_attach)(hc);
+
+ /*
+ * Register device. Do this after attach because
+ * we need dv_class.
+ */
+ hp300_dio_attach_args.da_scode = sc;
+ device_register(&hc->hp_dev, &hp300_dio_attach_args);
+
find_slaves(hc); /* XXX do this in attach? */
} else
hc->hp_addr = oaddr;
if ((*hd->hp_driver->d_match)(hd)) {
hd->hp_alive = 1;
- /* Set up external name. */
- bzero(hd->hp_xname, sizeof(hd->hp_xname));
- sprintf(hd->hp_xname, "%s%d", hd->hp_driver->d_name,
+ /*
+ * Fill in fake device structure.
+ */
+ bzero(&hd->hp_dev, sizeof(sizeof hd->hp_dev));
+ hd->hp_dev.dv_unit = hd->hp_unit;
+ sprintf(hd->hp_dev.dv_xname, "%s%d", hd->hp_driver->d_name,
hd->hp_unit);
+ /*
+ * Default to dull, driver attach will override if
+ * necessary.
+ */
+ hd->hp_dev.dv_class = DV_DULL;
+ TAILQ_INSERT_TAIL(&alldevs, &hd->hp_dev, dv_list);
/* Print what we've found. */
printf("%s at ", hd->hp_xname);
- sc = patosc(hw->hw_pa);
- if (sc < 256)
- printf("scode%d", sc);
+ sc = hw->hw_sc;
+ if (sc >= 0 && sc < 256)
+ printf("scode %d", sc);
else
- printf("addr 0x%x", sc);
+ printf("addr 0x%lx", (u_long)hw->hw_pa);
if (hd->hp_ipl)
printf(" ipl %d", hd->hp_ipl);
if (hd->hp_flags)
* newline for us.
*/
(*hd->hp_driver->d_attach)(hd);
+
+ /*
+ * Register device. Do this after attach because we
+ * need dv_class.
+ */
+ hp300_dio_attach_args.da_scode = sc;
+ device_register(&hd->hp_dev, &hp300_dio_attach_args);
} else
hd->hp_addr = oaddr;
return(1);
if (acdebug)
printf("found\n");
#endif
- /* Set up external name. */
- bzero(hd->hp_xname, sizeof(hd->hp_xname));
- sprintf(hd->hp_xname, "%s%d",
+ /*
+ * Fill in fake device strcuture.
+ */
+ bzero(&hd->hp_dev, sizeof(hd->hp_dev));
+ hd->hp_dev.dv_unit = hd->hp_unit;
+ sprintf(hd->hp_dev.dv_xname, "%s%d",
hd->hp_driver->d_name,
hd->hp_unit);
+ /*
+ * Default to dull, driver attach will
+ * override if necessary.
+ */
+ hd->hp_dev.dv_class = DV_DULL;
+ hd->hp_dev.dv_parent = &hc->hp_dev;
+ TAILQ_INSERT_TAIL(&alldevs, &hd->hp_dev,
+ dv_list);
- /* Print what we've found. */
- printf("%s at %s slave %d",
+ /*
+ * Print what we've found. Note that
+ * for `slave' devices, the flags are
+ * overloaded with the phys. unit
+ * locator. They aren't used for anything
+ * else, so we always treat them as
+ * such. This is a hack to make things
+ * a little more clear to folks configuring
+ * kernels and reading boot messages.
+ */
+ printf("%s at %s slave %d punit %d",
hd->hp_xname, hc->hp_xname,
- hd->hp_slave);
- if (hd->hp_flags)
- printf(" flags 0x%x", hd->hp_flags);
+ hd->hp_slave, hd->hp_flags);
hd->hp_alive = 1;
- if (hd->hp_dk && dkn < DK_NDRIVE)
- hd->hp_dk = dkn++;
- else
- hd->hp_dk = -1;
rescan = 1;
/*
* It will print the newline for us.
*/
(*hd->hp_driver->d_attach)(hd);
+
+ /*
+ * Register device. Do this after attach
+ * because we need dv_class.
+ */
+ if (dr_type(hc->hp_driver, "scsi")) {
+ hp300_scsi_link.target = hd->hp_slave;
+ hp300_scsi_link.lun = hd->hp_flags;
+ hp300_scsibus_attach_args.sa_scsi_link=
+ &hp300_scsi_link;
+ device_register(&hd->hp_dev,
+ &hp300_scsibus_attach_args);
+ } else {
+ hp300_hpib_attach_args.ha_slave =
+ hd->hp_slave;
+ hp300_hpib_attach_args.ha_punit =
+ hd->hp_flags;
+ device_register(&hd->hp_dev,
+ &hp300_hpib_attach_args);
+ }
} else {
#ifdef DEBUG
if (acdebug)
#undef LASTSLAVE
}
-caddr_t
-sctopa(sc)
- register int sc;
-{
- register caddr_t addr;
-
- if (sc == 7 && internalhpib)
- addr = internalhpib;
- else if (sc < 32)
- addr = (caddr_t) (DIOBASE + sc * DIOCSIZE);
- else if (sc >= 132)
- addr = (caddr_t) (DIOIIBASE + (sc - 132) * DIOIICSIZE);
- else
- addr = 0;
- return(addr);
-}
-
-patosc(addr)
- register caddr_t addr;
-{
- if (addr == (caddr_t)0x478000)
- return(7);
- if (addr >= (caddr_t)DIOBASE && addr < (caddr_t)DIOTOP)
- return(((unsigned)addr - DIOBASE) / DIOCSIZE);
- if (addr >= (caddr_t)DIOIIBASE && addr < (caddr_t)DIOIITOP)
- return(((unsigned)addr - DIOIIBASE) / DIOIICSIZE + 132);
- return((int)addr);
-}
-
-caddr_t
-sctova(sc)
- register int sc;
-{
- register struct hp_hw *hw;
-
- for (hw = sc_table; hw->hw_type; hw++)
- if (sc == hw->hw_sc)
- return(hw->hw_kva);
- return((caddr_t)sc);
-}
-
-vatosc(addr)
- register caddr_t addr;
-{
- register struct hp_hw *hw;
-
- for (hw = sc_table; hw->hw_type; hw++)
- if (addr == hw->hw_kva)
- return(hw->hw_sc);
- return((int)addr);
-}
-
same_hw_device(hw, hd)
struct hp_hw *hw;
struct hp_device *hd;
char notmappedmsg[] = "WARNING: no space to map IO card, ignored\n";
-/*
- * Scan all select codes, passing the corresponding VA to (*func)().
- * (*func)() is a driver-specific routine that looks for the console
- * hardware.
- */
-void
-console_scan(func, arg)
- int (*func) __P((int, caddr_t, void *));
- void *arg;
-{
- int size, scode, sctop;
- caddr_t pa, va;
-
- /*
- * Scan all select codes. Check each location for some
- * hardware. If there's something there, call (*func)().
- */
- sctop = (machineid == HP_320) ? 32 : 256;
- for (scode = 0; scode < sctop; ++scode) {
- /*
- * Abort mission if console has been forced.
- */
- if (conforced)
- return;
-
- /*
- * Skip over the select code hole and
- * the internal HP-IB controller.
- */
- if (((scode >= 32) && (scode < 132)) ||
- ((scode == 7) && internalhpib))
- continue;
-
- /* Map current PA. */
- pa = sctopa(scode);
- va = iomap(pa, NBPG);
- if (va == 0)
- continue;
-
- /* Check to see if hardware exists. */
- if (badaddr(va)) {
- iounmap(va, NBPG);
- continue;
- }
-
- /*
- * Hardware present, call callback. Driver returns
- * size of region to map if console probe successful
- * and worthwhile.
- */
- size = (*func)(scode, va, arg);
- iounmap(va, NBPG);
- if (size) {
- /* Free last mapping. */
- if (convasize)
- iounmap(conaddr, convasize);
- convasize = 0;
-
- /* Remap to correct size. */
- va = iomap(pa, size);
- if (va == 0)
- continue;
-
- /* Save this state for next time. */
- conscode = scode;
- conaddr = va;
- convasize = size;
- }
- }
-}
-
-/*
- * Special version of cninit(). Actually, crippled somewhat.
- * This version lets the drivers assign cn_tab.
- */
-void
-hp300_cninit()
-{
- struct consdev *cp;
- extern struct consdev constab[];
-
- cn_tab = NULL;
-
- /*
- * Call all of the console probe functions.
- */
- for (cp = constab; cp->cn_probe; cp++)
- (*cp->cn_probe)(cp);
-
- /*
- * No console, we can handle it.
- */
- if (cn_tab == NULL)
- return;
-
- /*
- * Turn on the console.
- */
- (*cn_tab->cn_init)(cn_tab);
-}
-
/*
* Scan the IO space looking for devices.
*/
/*
* Probe all select codes + internal display addr
*/
- sctop = machineid == HP_320 ? 32 : 256;
+ sctop = DIO_SCMAX(machineid);
for (sc = -1; sc < sctop; sc++) {
/*
* Invalid select codes
*/
- if (sc >= 32 && sc < 132)
+ if ((sc >= 32 && sc < 132) || sc > 187) /* XXX */
continue;
if (sc == -1) {
addr = (caddr_t) IIOV(hw->hw_pa);
didmap = 0;
} else if (sc == 7 && internalhpib) {
- hw->hw_pa = (caddr_t) 0x478000;
+ hw->hw_pa = (caddr_t)DIO_IHPIBADDR;
addr = internalhpib = (caddr_t) IIOV(hw->hw_pa);
didmap = 0;
} else if (sc == conscode) {
* If this is the console, it's already been
* mapped, and the address is known.
*/
- hw->hw_pa = sctopa(sc);
+ hw->hw_pa = dio_scodetopa(sc);
addr = conaddr;
didmap = 0;
} else {
- hw->hw_pa = sctopa(sc);
+ hw->hw_pa = dio_scodetopa(sc);
addr = iomap(hw->hw_pa, NBPG);
if (addr == 0) {
printf(notmappedmsg);
iounmap(addr, NBPG);
continue;
}
- id_reg = (u_char *) addr;
- if (sc >= 132)
- hw->hw_size = (id_reg[0x101] + 1) * 0x100000;
- else
- hw->hw_size = DIOCSIZE;
+
+ hw->hw_size = DIO_SIZE(sc, addr);
hw->hw_kva = addr;
- hw->hw_id = id_reg[1];
+ hw->hw_id = DIO_ID(addr);
+ if (DIO_ISFRAMEBUFFER(hw->hw_id))
+ hw->hw_secid = DIO_SECID(addr);
hw->hw_sc = sc;
+
/*
* Internal HP-IB on some machines (345/375) doesn't return
* consistant id info so we use the info gleaned from the
hw++;
}
}
-
-/*
- * 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;
-{
- int ix, npf;
- caddr_t kva;
-
-#ifdef DEBUG
- if (((int)pa & PGOFSET) || (size & PGOFSET))
- panic("iomap: unaligned");
-#endif
- npf = btoc(size);
- ix = rmalloc(extiomap, npf);
- if (ix == 0)
- return(0);
- kva = extiobase + ctob(ix-1);
- physaccess(kva, pa, size, PG_RW|PG_CI);
- return(kva);
-}
-
-void
-iounmap(kva, size)
- caddr_t kva;
- int size;
-{
- int ix;
-
-#ifdef DEBUG
- if (((int)kva & PGOFSET) || (size & PGOFSET))
- panic("iounmap: unaligned");
- if (kva < extiobase || kva >= extiobase + ctob(EIOMAPSIZE))
- panic("iounmap: bad address");
-#endif
- physunaccess(kva, size);
- ix = btoc(kva - extiobase) + 1;
- rmfree(extiomap, btoc(size), ix);
-}
-
-/*
- * Configure swap space and related parameters.
- */
-swapconf()
-{
- register struct swdevt *swp;
- register int nblks;
-
- for (swp = swdevt; swp->sw_dev != NODEV; swp++)
- if (bdevsw[major(swp->sw_dev)].d_psize) {
- nblks =
- (*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev);
- if (nblks != -1 &&
- (swp->sw_nblks == 0 || swp->sw_nblks > nblks))
- swp->sw_nblks = nblks;
- }
- dumpconf();
-}
-
-#define DOSWAP /* Change swdevt and dumpdev too */
-u_long bootdev; /* should be dev_t, but not until 32 bits */
-
-static char devname[][2] = {
- 0,0, /* 0 = ct */
- 0,0, /* 1 = xx */
- 'r','d', /* 2 = rd */
- 0,0, /* 3 = sw */
- 's','d', /* 4 = rd */
-};
-
-#define PARTITIONMASK 0x7
-#define PARTITIONSHIFT 3
-
-/*
- * Attempt to find the device from which we were booted.
- * If we can do so, and not instructed not to do so,
- * change rootdev to correspond to the load device.
- */
-setroot()
-{
- register struct hp_ctlr *hc;
- register struct hp_device *hd;
- int majdev, mindev, unit, part, controller, adaptor;
- dev_t temp, orootdev;
- struct swdevt *swp;
-
- if (boothowto & RB_DFLTROOT || (bootdev == 0) ||
- (bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
- return;
- majdev = B_TYPE(bootdev);
- if (majdev >= sizeof(devname) / sizeof(devname[0]))
- return;
- adaptor = B_ADAPTOR(bootdev);
- controller = B_CONTROLLER(bootdev);
- part = B_PARTITION(bootdev);
- unit = B_UNIT(bootdev);
- /*
- * First, find the controller type which supports this device.
- */
- for (hd = hp_dinit; hd->hp_driver; hd++)
- if (hd->hp_driver->d_name[0] == devname[majdev][0] &&
- hd->hp_driver->d_name[1] == devname[majdev][1])
- break;
- if (hd->hp_driver == 0)
- return;
- /*
- * Next, find the "controller" (bus adaptor) of that type
- * corresponding to the adaptor number.
- */
- for (hc = hp_cinit; hc->hp_driver; hc++)
- if (hc->hp_alive && hc->hp_unit == adaptor &&
- hc->hp_driver == hd->hp_cdriver)
- break;
- if (hc->hp_driver == 0)
- return;
- /*
- * Finally, find the "device" (controller or slave) in question
- * attached to that "controller".
- */
- for (hd = hp_dinit; hd->hp_driver; hd++)
- if (hd->hp_alive && hd->hp_slave == controller &&
- hd->hp_cdriver == hc->hp_driver &&
- hd->hp_ctlr == hc->hp_unit)
- break;
- if (hd->hp_driver == 0)
- return;
- /*
- * XXX note that we are missing one level, the unit, here.
- * Most HP drives come with one controller per disk. There
- * are some older drives (e.g. 7946) which have two units
- * on the same controller but those are typically a disk as
- * unit 0 and a tape as unit 1. This would have to be
- * rethought if you ever wanted to boot from other than unit 0.
- */
- if (unit != 0)
- printf("WARNING: using device at unit 0 of controller\n");
-
- mindev = hd->hp_unit;
- /*
- * Form a new rootdev
- */
- mindev = (mindev << PARTITIONSHIFT) + part;
- orootdev = rootdev;
- rootdev = makedev(majdev, mindev);
- /*
- * If the original rootdev is the same as the one
- * just calculated, don't need to adjust the swap configuration.
- */
- if (rootdev == orootdev)
- return;
-
- printf("Changing root device to %c%c%d%c\n",
- devname[majdev][0], devname[majdev][1],
- mindev >> PARTITIONSHIFT, part + 'a');
-
-#ifdef DOSWAP
- mindev &= ~PARTITIONMASK;
- for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
- if (majdev == major(swp->sw_dev) &&
- mindev == (minor(swp->sw_dev) & ~PARTITIONMASK)) {
- temp = swdevt[0].sw_dev;
- swdevt[0].sw_dev = swp->sw_dev;
- swp->sw_dev = temp;
- break;
- }
- }
- if (swp->sw_dev == NODEV)
- return;
-
- /*
- * If dumpdev was the same as the old primary swap
- * device, move it to the new primary swap device.
- */
- if (temp == dumpdev)
- dumpdev = swdevt[0].sw_dev;
-#endif
-}
-
-#ifndef NEWCONFIG /* XXX */
-void
-config_init()
-{
-
- TAILQ_INIT(&alldevs);
- TAILQ_INIT(&allevents);
-}
-#endif
+#endif /* ! NEWCONFIG */
-/* $NetBSD: clock.c,v 1.14 1996/05/18 23:30:12 thorpej Exp $ */
+/* $OpenBSD: clock.c,v 1.3 1997/01/12 15:13:11 downsj Exp $ */
+/* $NetBSD: clock.c,v 1.18 1996/10/13 03:14:27 christos Exp $ */
/*
* Copyright (c) 1988 University of Utah.
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;
/* XXX */
if (!bbcinited) {
- if (badbaddr(&BBCADDR->hil_stat))
+ if (badbaddr((caddr_t)&BBCADDR->hil_stat))
printf("WARNING: no battery clock\n");
else
bbcaddr = BBCADDR;
+/* $OpenBSD: clockioctl.h,v 1.2 1997/01/12 15:13:12 downsj Exp $ */
/* $NetBSD: clockioctl.h,v 1.5 1994/10/26 07:25:25 cgd Exp $ */
/*
+/* $OpenBSD: clockreg.h,v 1.2 1997/01/12 15:13:13 downsj Exp $ */
/* $NetBSD: clockreg.h,v 1.5 1994/10/26 07:25:26 cgd Exp $ */
/*
-/* $NetBSD: conf.c,v 1.31 1996/03/14 21:26:28 christos Exp $ */
+/* $OpenBSD: conf.c,v 1.9 1997/01/12 15:13:13 downsj Exp $ */
+/* $NetBSD: conf.c,v 1.34 1996/12/17 08:41:20 thorpej Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
#include <sys/conf.h>
#include <sys/vnode.h>
-int ttselect __P((dev_t, int, struct proc *));
-
-#ifndef LKM
-#define lkmenodev enodev
-#else
-int lkmenodev();
-#endif
-
#include "ct.h"
bdev_decl(ct);
#include "mt.h"
cdev_decl(bpf);
#include "tun.h"
cdev_decl(tun);
-#ifdef LKM
-#define NLKM 1
-#else
-#define NLKM 0
-#endif
-cdev_decl(lkm);
cdev_decl(random);
struct cdevsw cdevsw[] =
return (makedev(blkmaj, minor(dev)));
}
+/*
+ * Convert a character device number to a block device number.
+ */
+dev_t
+blktochr(dev)
+ dev_t dev;
+{
+ int blkmaj = major(dev);
+ int i;
+
+ if (blkmaj >= nblkdev)
+ return (NODEV);
+ for (i = 0; i < sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0]); i++)
+ if (blkmaj == chrtoblktbl[i])
+ return (makedev(i, minor(dev)));
+ return (NODEV);
+}
+
/*
* 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
#define topcatcnpollc nullcnpollc
cons_decl(topcat);
-#define dcacnpollc nullcnpollc
+#define dcacnpollc nullcnpollc
cons_decl(dca);
-#define dcmcnpollc nullcnpollc
+#define dcmcnpollc nullcnpollc
cons_decl(dcm);
+#ifdef NEWCONFIG
+#include "dvbox.h"
+#include "gbox.h"
+#include "hyper.h"
+#include "rbox.h"
+#include "topcat.h"
+#else /* ! NEWCONFIG */
+#if NGRF > 0
+#define NDVBOX 1
+#define NGBOX 1
+#define NHYPER 1
+#define NRBOX 1
+#define NTOPCAT 1
+#endif /* NGRF > 0 */
+#endif /* NEWCONFIG */
+
struct consdev constab[] = {
#if NITE > 0
-#if NGRF > 0 /* XXX */
+#if NDVBOX > 0
cons_init(dvbox),
+#endif
+#if NGBOX > 0
cons_init(gbox),
+#endif
+#if NHYPER > 0
cons_init(hyper),
+#endif
+#if NRBOX > 0
cons_init(rbox),
- cons_init(topcat),
#endif
+#if NTOPCAT > 0
+ cons_init(topcat),
#endif
+#endif /* NITE > 0 */
#if NDCA > 0
cons_init(dca),
#endif
--- /dev/null
+/* $OpenBSD: db_memrw.c,v 1.1 1997/01/12 15:13:14 downsj Exp $ */
+/* $NetBSD: db_memrw.c,v 1.2 1996/12/09 17:38:27 thorpej 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * 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 <vm/vm.h>
+
+#include <machine/pte.h>
+#include <machine/db_machdep.h>
+#include <machine/cpu.h>
+
+#include <ddb/db_access.h>
+
+static void db_write_text __P((vm_offset_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)
+ vm_offset_t addr;
+ register size_t size;
+ register char *data;
+{
+ register 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)
+ vm_offset_t addr;
+ register size_t size;
+ register char *data;
+{
+ register char *dst, *odst;
+ pt_entry_t *pte, oldpte, tmppte;
+ vm_offset_t pgva;
+ int limit;
+
+ if (size == 0)
+ return;
+
+ dst = (char *)addr;
+
+ do {
+ /*
+ * Get the VA for the page.
+ */
+ pgva = hp300_trunc_page((u_long)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;
+
+#ifdef M68K_MMU_HP
+ /*
+ * Flush the supervisor side of the VAC to
+ * prevent a cache hit on the old, read-only PTE.
+ * XXX Is this really necessary, or am I just
+ * paranoid?
+ */
+ if (ectype == EC_VIRT)
+ DCIS();
+#endif
+
+ /*
+ * 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((vm_offset_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((vm_offset_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)
+ vm_offset_t addr;
+ register size_t size;
+ register char *data;
+{
+ register 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++;
+ }
+}
+/* $OpenBSD: disksubr.c,v 1.3 1997/01/12 15:13:14 downsj Exp $ */
/* $NetBSD: disksubr.c,v 1.8 1996/02/02 19:50:26 scottr Exp $ */
/*
#define b_cylinder b_resid
+void
+dk_establish(dk, dev)
+ struct disk *dk;
+ struct device *dev;
+{
+}
+
/*
* Attempt to read a disk label from a device using the indicated stategy
* routine. The label must be partly set up before this: secpercyl and
+/* $OpenBSD: dkbad.c,v 1.2 1997/01/12 15:13:15 downsj Exp $ */
/* $NetBSD: dkbad.c,v 1.4 1994/10/26 07:25:33 cgd Exp $ */
/*
-/* $NetBSD: genassym.c,v 1.19 1996/05/17 15:20:55 thorpej Exp $ */
+/* $OpenBSD: genassym.c,v 1.5 1997/01/12 15:13:16 downsj Exp $ */
+/* $NetBSD: genassym.c,v 1.21 1996/10/05 07:11:44 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
main()
{
- /* CPU types */
+ /* CPU options */
#ifdef M68020
def("M68020", 1);
#endif
def("M68040", 1);
#endif
- /* MMU types */
+ /* MMU options */
#ifdef M68K_MMU_MOTOROLA
def("M68K_MMU_MOTOROLA", 1);
#endif
#ifdef M68K_MMU_HP
def("M68K_MMU_HP", 1);
#endif
+
+ /* MMU types */
def("MMU_68040", MMU_68040);
def("MMU_68030", MMU_68030);
def("MMU_HP", MMU_HP);
def("MMU_68851", MMU_68851);
+ /* CPU types */
+ def("CPU_68020", CPU_68020);
+ def("CPU_68030", CPU_68030);
+ def("CPU_68040", CPU_68040);
+
/* values for machineid */
def("HP_320", HP_320);
def("HP_330", HP_330);
off("FR_SP", struct frame, f_regs[15]);
off("FR_HW", struct frame, f_sr);
off("FR_ADJ", struct frame, f_stackadj);
+ def("FR_SIZE", sizeof(struct trapframe));
/* system calls */
def("SYS_exit", SYS_exit);
-/* $NetBSD: hpux_machdep.c,v 1.2 1996/02/14 02:56:45 thorpej Exp $ */
+/* $OpenBSD: hpux_machdep.c,v 1.3 1997/01/12 15:13:16 downsj Exp $ */
+/* $NetBSD: hpux_machdep.c,v 1.5 1996/10/14 06:51:50 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996 Jason R. Thorpe. All rights reserved.
#include <sys/buf.h>
#include <sys/wait.h>
#include <sys/file.h>
+#include <sys/exec.h>
#include <sys/namei.h>
#include <sys/vnode.h>
#include <sys/ioctl.h>
-/* $NetBSD: isr.c,v 1.1 1996/02/14 02:56:48 thorpej Exp $ */
+/* $OpenBSD: isr.c,v 1.2 1997/01/12 15:13:17 downsj Exp $ */
+/* $NetBSD: isr.c,v 1.5 1996/12/09 17:38:25 thorpej Exp $ */
-/*
- * Copyright (c) 1995, 1996 Jason R. Thorpe.
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
- * Portions:
- * Copyright (c) 1994 Gordon W. Ross.
- * Copyright (c) 1993 Adam Glass.
- * 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
* 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 acknowledgements:
- * This product includes software developed by Adam Glass.
- * This product includes software developed for the NetBSD Project
- * by Jason R. Thorpe.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/*
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/vmmeter.h>
-#include <machine/cpu.h>
#include <net/netisr.h>
+#include <machine/cpu.h>
+
#include <hp300/hp300/isr.h>
typedef LIST_HEAD(, isr) isr_list_t;
isr_list_t isr_list[NISR];
+u_short hp300_bioipl, hp300_netipl, hp300_ttyipl, hp300_impipl;
+
extern int intrcnt[]; /* from locore.s */
+void isrcomputeipl __P((void));
+
void
isrinit()
{
for (i = 0; i < NISR; ++i) {
LIST_INIT(&isr_list[i]);
}
+
+ /* Default interrupt priorities. */
+ hp300_bioipl = hp300_netipl = hp300_ttyipl = hp300_impipl =
+ (PSL_S|PSL_IPL3);
+}
+
+/*
+ * Scan all of the ISRs, recomputing the interrupt levels for the spl*()
+ * calls. This doesn't have to be fast.
+ */
+void
+isrcomputeipl()
+{
+ struct isr *isr;
+ int ipl;
+
+ /* Start with low values. */
+ hp300_bioipl = hp300_netipl = hp300_ttyipl = hp300_impipl =
+ (PSL_S|PSL_IPL3);
+
+ for (ipl = 0; ipl < NISR; ipl++) {
+ for (isr = isr_list[ipl].lh_first; isr != NULL;
+ isr = isr->isr_link.le_next) {
+ /*
+ * Bump up the level for a given priority,
+ * if necessary.
+ */
+ switch (isr->isr_priority) {
+ case ISRPRI_BIO:
+ if (ipl > PSLTOIPL(hp300_bioipl))
+ hp300_bioipl = IPLTOPSL(ipl);
+ break;
+
+ case ISRPRI_NET:
+ if (ipl > PSLTOIPL(hp300_netipl))
+ hp300_netipl = IPLTOPSL(ipl);
+ break;
+
+ case ISRPRI_TTY:
+ case ISRPRI_TTYNOBUF:
+ if (ipl > PSLTOIPL(hp300_ttyipl))
+ hp300_ttyipl = IPLTOPSL(ipl);
+ break;
+
+ default:
+ printf("priority = %d\n", isr->isr_priority);
+ panic("isrcomputeipl: bad priority");
+ }
+ }
+ }
+
+ /*
+ * Enforce `bio <= net <= tty <= imp'
+ */
+
+ if (hp300_netipl < hp300_bioipl)
+ hp300_netipl = hp300_bioipl;
+
+ if (hp300_ttyipl < hp300_netipl)
+ hp300_ttyipl = hp300_netipl;
+
+ if (hp300_impipl < hp300_ttyipl)
+ hp300_impipl = hp300_ttyipl;
+}
+
+void
+isrprintlevels()
+{
+
+#ifdef DEBUG
+ printf("psl: bio = 0x%x, net = 0x%x, tty = 0x%x, imp = 0x%x\n",
+ hp300_bioipl, hp300_netipl, hp300_ttyipl, hp300_impipl);
+#endif
+
+ printf("interrupt levels: bio = %d, net = %d, tty = %d\n",
+ PSLTOIPL(hp300_bioipl), PSLTOIPL(hp300_netipl),
+ PSLTOIPL(hp300_ttyipl));
}
/*
* Establish an interrupt handler.
* Called by driver attach functions.
*/
-void
+void *
isrlink(func, arg, ipl, priority)
int (*func) __P((void *));
void *arg;
list = &isr_list[ipl];
if (list->lh_first == NULL) {
LIST_INSERT_HEAD(list, newisr, isr_link);
- return;
+ goto compute;
}
/*
curisr = curisr->isr_link.le_next) {
if (newisr->isr_priority > curisr->isr_priority) {
LIST_INSERT_BEFORE(curisr, newisr, isr_link);
- return;
+ goto compute;
}
}
* on the end.
*/
LIST_INSERT_AFTER(curisr, newisr, isr_link);
+
+ compute:
+ /* Compute new interrupt levels. */
+ isrcomputeipl();
+ return (newisr);
+}
+
+/*
+ * Disestablish an interrupt handler.
+ */
+void
+isrunlink(arg)
+ void *arg;
+{
+ struct isr *isr = arg;
+
+ LIST_REMOVE(isr, isr_link);
+ free(isr, M_DEVBUF);
+ isrcomputeipl();
}
/*
-/* $NetBSD: isr.h,v 1.6 1996/02/28 01:03:53 thorpej Exp $ */
+/* $OpenBSD: isr.h,v 1.3 1997/01/12 15:13:18 downsj Exp $ */
+/* $NetBSD: isr.h,v 1.7 1996/12/09 03:04:47 thorpej Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
/*
* ISR priorities. These are not the same as interrupt levels.
+ * These serve 2 purposes:
+ * - properly order ISRs in the list
+ * - compute levels for spl*() calls.
*/
#define ISRPRI_BIO 0
#define ISRPRI_NET 1
#define ISRPRI_TTY 2
#define ISRPRI_TTYNOBUF 3
+/*
+ * Convert PSL values to IPLs and vice-versa.
+ */
+#define PSLTOIPL(x) (((x) >> 8) & 0xf)
+#define IPLTOPSL(x) ((((x) & 0xf) << 8) | PSL_S)
+
void isrinit __P((void));
-void isrlink __P((int (*)(void *), void *, int, int));
+void *isrlink __P((int (*)(void *), void *, int, int));
+void isrunlink __P((void *));
void isrdispatch __P((int));
+void isrprintlevels __P((void));
+/* $OpenBSD: kgdb_glue.c,v 1.2 1997/01/12 15:13:18 downsj Exp $ */
/* $NetBSD: kgdb_glue.c,v 1.2 1994/10/26 07:25:39 cgd Exp $ */
/*
+/* $OpenBSD: kgdb_proto.h,v 1.2 1997/01/12 15:13:19 downsj Exp $ */
/* $NetBSD: kgdb_proto.h,v 1.2 1994/10/26 07:25:40 cgd Exp $ */
/*-
-/* $NetBSD: kgdb_stub.c,v 1.3 1995/04/12 08:30:40 mycroft Exp $ */
+/* $OpenBSD: kgdb_stub.c,v 1.2 1997/01/12 15:13:20 downsj Exp $ */
+/* $NetBSD: kgdb_stub.c,v 1.6 1996/10/13 03:14:30 christos Exp $ */
/*
* Copyright (c) 1990, 1993
*/
#ifdef KGDB
#ifndef lint
-static char rcsid[] = "$NetBSD: kgdb_stub.c,v 1.3 1995/04/12 08:30:40 mycroft Exp $";
+static char rcsid[] = "$NetBSD: kgdb_stub.c,v 1.6 1996/10/13 03:14:30 christos Exp $";
#endif
#include <sys/param.h>
switch (type) {
case T_BUSERR:
- sigval = SIGBUS;
- break;
case T_ADDRERR:
sigval = SIGBUS;
break;
case T_ILLINST:
+ case T_PRIVINST:
sigval = SIGILL;
break;
case T_ZERODIV:
- sigval = SIGFPE;
- break;
case T_CHKINST:
- sigval = SIGFPE;
- break;
case T_TRAPVINST:
sigval = SIGFPE;
break;
- case T_PRIVINST:
- sigval = SIGILL;
- break;
case T_TRACE:
sigval = SIGTRAP;
break;
sigval = SIGILL;
break;
case T_FPERR:
- sigval = SIGFPE;
- break;
case T_COPERR:
sigval = SIGFPE;
break;
-/* $NetBSD: led.h,v 1.3 1995/03/28 18:16:24 jtc Exp $ */
+/* $OpenBSD: led.h,v 1.2 1997/01/12 15:13:20 downsj Exp $ */
+/* $NetBSD: led.h,v 1.4 1996/10/05 09:18:22 thorpej Exp $ */
/*
* Copyright (c) 1992 University of Utah.
#ifdef _KERNEL
extern char *ledaddr;
extern int inledcontrol;
+
+void ledcontrol __P((int, int, int));
#endif
-/* $NetBSD: locore.s,v 1.53 1996/05/17 16:32:28 thorpej Exp $ */
+/* $OpenBSD: locore.s,v 1.7 1997/01/12 15:13:22 downsj Exp $ */
+/* $NetBSD: locore.s,v 1.62 1996/11/06 20:19:30 cgd Exp $ */
/*
+ * 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.
.globl _kernel_text
_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 is the data segment so it
#include <hp300/hp300/vectors.s>
.text
-/*
- * This is where we wind up if the kernel jumps to location 0.
- * (i.e. a bogus PC) This is known to immediately follow the vector
- * table and is hence at 0x400 (see reset vector in vectors.s).
- */
- .globl _panic
- pea Ljmp0panic
- jbsr _panic
- /* NOTREACHED */
-Ljmp0panic:
- .asciz "kernel jump to zero"
- .even
/*
* Do a dump.
.globl _trap, _nofault, _longjmp
_buserr:
+ /*
+ * XXX TODO: look at the mac68k _buserr and generalize
+ * XXX the saving of the fault address so this routine
+ * XXX can be shared.
+ */
tstl _nofault | device probe?
jeq Lberr | no, handle as usual
movl _nofault,sp@- | yes,
tstl _mmutype | HP MMU?
jeq Lbehpmmu | yes, skip
movl d1,a0 | fault address
- ptestr #1,a0@,#7 | do a table search
+ 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,a1@ | 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
- btst #7,sp@ | bus error bit set?
- jeq Lismerr | no, must be MMU fault
- clrw sp@ | yes, re-clear pad word
- jra Lisberr | and process as normal bus error
+ 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?
+ jeq Lismerr | no, must be fast
+ jra Lisberr1 | real bus err needs not be fast
+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?
+ jeq Lisberr1 | yes, was not WPE, must be bus err
+ jra Lismerr | no, must be mem err
Lbehpmmu:
#endif
#if defined(M68K_MMU_HP)
Lisaerr:
movl #T_ADDRERR,sp@- | mark address error
jra Ltrapnstkadj | and deal with it
+Lisberr1:
+ clrw sp@ | re-clear pad word
Lisberr:
movl #T_BUSERR,sp@- | mark bus error
Ltrapnstkadj:
movl _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 #MMU_68040,_mmutype
+ jle Lfptnull
+#endif
tstb a0@ | null state frame?
jeq Lfptnull | yes, safe
clrw d0 | no, need to tweak BIU
lea sp@(12),sp | pop args
jra rei | all done
+/*
+ * Trace (single-step) trap. Kernel-mode is special.
+ * User mode traps are simply passed on to trap().
+ */
+_trace:
+ clrl sp@- | stack adjust count
+ moveml #0xFFFF,sp@-
+ moveq #T_TRACE,d0
+ movw sp@(FR_HW),d1 | get PSW
+ andw #PSL_S,d1 | from system mode?
+ jne kbrkpt | yes, kernel breakpoint
+ jra fault | no, user-mode fault
+
/*
* Trap 15 is used for:
- * - KGDB traps
+ * - GDB breakpoints (in user programs)
+ * - KGDB breakpoints (in the kernel)
* - trace traps for SUN binaries (not fully supported yet)
- * We just pass it on and let trap() sort it all out
+ * User mode traps are simply passed to trap().
*/
_trap15:
- clrl sp@-
+ clrl sp@- | stack adjust count
moveml #0xFFFF,sp@-
-#ifdef KGDB
moveq #T_TRAP15,d0
movw sp@(FR_HW),d1 | get PSW
- andw #PSL_S,d1 | from user mode?
- jeq fault | yes, just a regular fault
- movl d0,sp@-
- .globl _kgdb_trap_glue
- jbsr _kgdb_trap_glue | returns if no debugger
- addl #4,sp
-#endif
- moveq #T_TRAP15,d0
- jra fault
+ andw #PSL_S,d1 | from system mode?
+ jne kbrkpt | yes, kernel breakpoint
+ jra fault | no, user-mode fault
-/*
- * Hit a breakpoint (trap 1 or 2) instruction.
- * Push the code and treat as a normal fault.
- */
-_trace:
- clrl sp@-
- moveml #0xFFFF,sp@-
+kbrkpt: | 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 were are not on tmpstk switch to it.
+ | (so debugger can change the stack pointer)
+ movl a6,d1
+ cmpl #tmpstk,d1
+ jls Lbrkpt2 | already on tmpstk
+ | Copy frame to the temporary stack
+ movl sp,a0 | a0=src
+ lea 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
- moveq #T_TRACE,d0
- movw sp@(FR_HW),d1 | get SSW
- andw #PSL_S,d1 | from user mode?
- jeq fault | no, regular fault
- movl d0,sp@-
- jbsr _kgdb_trap_glue | returns if no debugger
- addl #4,sp
+ | Let KGDB handle it (if connected)
+ movl a2,sp@- | push frame ptr
+ movl d2,sp@- | push trap type
+ jbsr _kgdb_trap | handle the trap
+ addql #8,sp | pop args
+ cmpl #0,d0 | did kgdb handle it?
+ jne Lbrkpt3 | yes, done
#endif
- moveq #T_TRACE,d0
- jra fault
+#ifdef DDB
+ | Let DDB handle it
+ movl a2,sp@- | push frame ptr
+ movl d2,sp@- | push trap type
+ jbsr _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>
Ldorte:
rte | real return
-#define RELOC(var, ar) \
- lea var,ar; \
+/*
+ * Macro to relocate a symbol, used before MMU is enabled.
+ */
+#define RELOC(var, ar) \
+ lea var,ar; \
addl a5,ar
/*
movl #CACHE_OFF,d0
movc d0,cacr | clear and disable on-chip cache(s)
+/* check for internal HP-IB in SYSFLAG */
+ btst #5,0xfffffed2 | internal HP-IB?
+ 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
jeq Lnot68030 | yes, we have 68020/68040
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
movec d0,cacr | before we access any data
RELOC(_mmutype, a0)
movl #MMU_68040,a0@ | with a 68040 MMU
+ RELOC(_cputype, a0)
+ movl #CPU_68040,a0@ | and a 68040 CPU
RELOC(_ectype, a0)
movl #EC_NONE,a0@ | and no cache (for now XXX)
RELOC(_machineid, a0)
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 #_vectab,d0 | set Vector Base Register
+ movc d0,vbr
+
RELOC(_mmutype, a0)
tstl a0@ | HP MMU?
jeq Lhpmmu3 | yes, skip
Lmotommu2:
movl #MMU_IEN+MMU_FPE,INTIOBASE+MMUBASE+MMUCMD
| enable 68881 and i-cache
+ RELOC(_prototc, a2)
movl #0x82c0aa00,a2@ | value to load TC with
pmove a2@,tc | load it
jmp Lenab1
jmp Lenab1 | jmp to mapped code
Lehighcode:
+ /*
+ * END MMU TRAMPOLINE. Address register a5 is now free.
+ */
+
/*
* Should be running mapped from this point on
*/
Lenab1:
-/* check for internal HP-IB in SYSFLAG */
- btst #5,0xfffffed2 | internal HP-IB?
- jeq Lfinish | yes, have HP-IB just continue
- clrl _internalhpib | no, clear associated address
-Lfinish:
/* select the software page size now */
lea tmpstk,sp | temporary stack
jbsr _vm_set_page_size | select software page size
/* set kernel stack, user SP, and initial pcb */
movl _proc0paddr,a1 | get proc0 pcb addr
lea a1@(USPACE-4),sp | set kernel stack to end of area
+ lea _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,_curpcb | proc0 is running
MMUADDR(a0)
orl #MMU_CEN,a0@(MMUCMD) | turn on external cache
Lnocache0:
-/* final setup for C code */
- movl #_vectab,d0 | set Vector Base Register
- movc d0,vbr
- jbsr _isrinit | be ready for stray ints
- jbsr _hp300_calibrate_delay | calibrate delay
- movw #PSL_LOWIPL,sr | lower SPL
- movl d7,_boothowto | save reboot flags
- movl d6,_bootdev | and boot device
+/* Final setup for call to main(). */
+ jbsr _isrinit | initialize interrupt handlers
+ jbsr _hp300_calibrate_delay | calibrate delay() loop
/*
* Create a fake exception frame so that cpu_fork() can copy it.
jra _main | main()
+ pea Lmainreturned | Yow! Main returned!
+ jbsr _panic
+ /* NOTREACHED */
+Lmainreturned:
+ .asciz "main() returned"
+ .even
+
.globl _proc_trampoline
_proc_trampoline:
movl a3,sp@-
/*
* The following primitives manipulate the run queues. _whichqs tells which
* of the 32 queues _qs have processes in them. Setrunqueue puts processes
- * into queues, Remrq removes them from queues. The running process is on
- * no queue, other processes are on a queue related to p->p_priority, divided
- * by 4 actually to shrink the 0-127 range of priorities into the 32 available
- * queues.
+ * into queues, remrunqueue removes them from queues. The running process is
+ * on no queue, other processes are on a queue related to p->p_priority,
+ * divided by 4 actually to shrink the 0-127 range of priorities into the 32
+ * available queues.
*/
.globl _whichqs,_qs,_cnt,_panic
#endif
jmp MAXADDR+8 | jump to last page
+#define DOREBOOT \
+ /* Reset Vector Base Register to what PROM expects. */ \
+ movl #0,d0; \
+ movc d0,vbr; \
+ /* Jump to REQ_REBOOT */ \
+ jmp 0x1A4;
+
Lbootcode:
lea MAXADDR+0x800,sp | physical SP in case of NMI
#if defined(M68040)
movc d0,cacr | caches off
.long 0x4e7b0003 | movc d0,tc
movl d2,MAXADDR+NBPG-4 | restore old high page contents
- jmp 0x1A4 | goto REQ_REBOOT
+ DOREBOOT
LmotommuF:
#endif
#if defined(M68K_MMU_MOTOROLA)
jeq LhpmmuB | yes, skip
movl #0,a0@ | value for pmove to TC (turn off MMU)
pmove a0@,tc | disable MMU
- jmp 0x1A4 | goto REQ_REBOOT
+ DOREBOOT
LhpmmuB:
#endif
#if defined(M68K_MMU_HP)
MMUADDR(a0)
movl #0xFFFF0000,a0@(MMUCMD) | totally disable MMU
movl d2,MAXADDR+NBPG-4 | restore old high page contents
- jmp 0x1A4 | goto REQ_REBOOT
+ DOREBOOT
#endif
Lebootcode:
+#undef DOREBOOT
+
.data
- .globl _machineid
+ .globl _machineid,_mmutype,_cputype,_ectype,_protorp,_prototc
_machineid:
- .long 0 | default to 320
- .globl _mmutype,_protorp
+ .long HP_320 | default to 320
_mmutype:
- .long 0 | default to HP MMU
+ .long MMU_HP | default to HP MMU
+_cputype:
+ .long CPU_68020 | default to 68020 CPU
+_ectype:
+ .long EC_NONE | external cache type, default to none
_protorp:
.long 0,0 | prototype root pointer
- .globl _ectype
-_ectype:
- .long 0 | external cache type, default to none
+_prototc:
+ .long 0 | prototype translation control
.globl _internalhpib
_internalhpib:
.long 1 | has internal HP-IB, default to yes
_want_resched:
.long 0
.globl _intiobase, _intiolimit, _extiobase, _CLKbase, _MMUbase
- .globl _proc0paddr
+ .globl _proc0paddr, _pagezero
_proc0paddr:
.long 0 | KVA of proc0 u-area
_intiobase:
.long 0 | KVA of base of clock registers
_MMUbase:
.long 0 | KVA of base of HP MMU registers
+_pagezero:
+ .long 0 | PA of first page of kernel text
#ifdef USELEDS
heartbeat:
.long 0 | clock ticks since last pulse of heartbeat
-/* $NetBSD: machdep.c,v 1.66 1996/05/18 23:30:09 thorpej Exp $ */
+/* $OpenBSD: machdep.c,v 1.9 1997/01/12 15:13:23 downsj Exp $ */
+/* $NetBSD: machdep.c,v 1.77 1996/12/11 16:49:23 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
extern struct emul emul_hpux;
#endif
+/* prototypes for local functions */
+caddr_t allocsys __P((caddr_t));
+void parityenable __P((void));
+int parityerror __P((struct frame *));
+int parityerrorfind __P((void));
+void identifycpu __P((void));
+void initcpu __P((void));
+void ledinit __P((void));
+void dumpmem __P((int *, int, int));
+char *hexstr __P((int, int));
+
+/* functions called from locore.s */
+void dumpsys __P((void));
+void straytrap __P((int, u_short));
+void nmihand __P((struct frame));
+
/*
* Select code of console. Set to -1 if console is on
* "internal" framebuffer.
void
cpu_startup()
{
+ extern char *etext;
register unsigned i;
- register caddr_t v, firstaddr;
- int base, residual;
+ register caddr_t v;
+ int base, residual, sz;
vm_offset_t minaddr, maxaddr;
vm_size_t size;
-#ifdef BUFFERS_UNMANAGED
- vm_offset_t bufmemp;
- caddr_t buffermem;
- int ix;
-#endif
#ifdef DEBUG
extern int pmapdebug;
int opmapdebug = pmapdebug;
*/
printf(version);
identifycpu();
- printf("real mem = %d\n", ctob(physmem));
+ printf("real mem = %d\n", ctob(physmem));
/*
- * Allocate space for system data structures.
- * The first available real memory address is in "firstaddr".
- * The first available kernel virtual address is in "v".
- * As pages of kernel virtual memory are allocated, "v" is incremented.
- * As pages of memory are allocated and cleared,
- * "firstaddr" is incremented.
- * An index into the kernel page table corresponding to the
- * virtual memory address maintained in "v" is kept in "mapaddr".
+ * Find out how much space we need, allocate it,
+ * and the give everything true virtual addresses.
*/
- /*
- * Make two passes. The first pass calculates how much memory is
- * needed and allocates it. The second pass assigns virtual
- * addresses to the various data structures.
- */
- firstaddr = 0;
-again:
- v = (caddr_t)firstaddr;
+ size = (vm_size_t)allocsys((caddr_t)0);
+ if ((v = (caddr_t)kmem_alloc(kernel_map, round_page(size))) == 0)
+ panic("startup: no room for tables");
+ if ((allocsys(v) - v) != size)
+ panic("startup: talbe size inconsistency");
-#define valloc(name, type, num) \
- (name) = (type *)v; v = (caddr_t)((name)+(num))
-#define valloclim(name, type, num, lim) \
- (name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
-#ifdef REAL_CLISTS
- valloc(cfree, struct cblock, nclist);
-#endif
- valloc(callout, struct callout, ncallout);
- valloc(swapmap, struct map, nswapmap = maxproc * 2);
-#ifdef SYSVSHM
- valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
-#endif
-#ifdef SYSVSEM
- valloc(sema, struct semid_ds, seminfo.semmni);
- valloc(sem, struct sem, seminfo.semmns);
- /* This is pretty disgusting! */
- valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
-#endif
-#ifdef SYSVMSG
- valloc(msgpool, char, msginfo.msgmax);
- valloc(msgmaps, struct msgmap, msginfo.msgseg);
- valloc(msghdrs, struct msg, msginfo.msgtql);
- valloc(msqids, struct msqid_ds, msginfo.msgmni);
-#endif
-
- /*
- * Determine how many buffers to allocate.
- * Since HPs tend to be long on memory and short on disk speed,
- * we allocate more buffer space than the BSD standard of
- * use 10% of memory for the first 2 Meg, 5% of remaining.
- * We just allocate a flat 10%. Insure a minimum of 16 buffers.
- * We allocate 1/2 as many swap buffer headers as file i/o buffers.
- */
- if (bufpages == 0)
- bufpages = physmem / 10 / CLSIZE;
- if (nbuf == 0) {
- nbuf = bufpages;
- if (nbuf < 16)
- nbuf = 16;
- }
- if (nswbuf == 0) {
- nswbuf = (nbuf / 2) &~ 1; /* force even */
- if (nswbuf > 256)
- nswbuf = 256; /* sanity */
- }
- valloc(swbuf, struct buf, nswbuf);
- valloc(buf, struct buf, nbuf);
- /*
- * End of first pass, size has been calculated so allocate memory
- */
- if (firstaddr == 0) {
- size = (vm_size_t)(v - firstaddr);
- firstaddr = (caddr_t) kmem_alloc(kernel_map, round_page(size));
- if (firstaddr == 0)
- panic("startup: no room for tables");
-#ifdef BUFFERS_UNMANAGED
- buffermem = (caddr_t) kmem_alloc(kernel_map, bufpages*CLBYTES);
- if (buffermem == 0)
- panic("startup: no room for buffers");
-#endif
- goto again;
- }
- /*
- * End of second pass, addresses have been assigned
- */
- if ((vm_size_t)(v - firstaddr) != size)
- panic("startup: table size inconsistency");
/*
* Now allocate buffers proper. They are different than the above
* in that they usually occupy more virtual memory than physical.
panic("startup: cannot allocate buffers");
base = bufpages / nbuf;
residual = bufpages % nbuf;
-#ifdef BUFFERS_UNMANAGED
- bufmemp = (vm_offset_t) buffermem;
-#endif
for (i = 0; i < nbuf; i++) {
vm_size_t curbufsize;
vm_offset_t curbuf;
*/
curbuf = (vm_offset_t)buffers + i * MAXBSIZE;
curbufsize = CLBYTES * (i < residual ? base+1 : base);
-#ifdef BUFFERS_UNMANAGED
- /*
- * Move the physical pages over from buffermem.
- */
- for (ix = 0; ix < curbufsize/CLBYTES; ix++) {
- vm_offset_t pa;
-
- pa = pmap_extract(pmap_kernel(), bufmemp);
- if (pa == 0)
- panic("startup: unmapped buffer");
- pmap_remove(pmap_kernel(), bufmemp, bufmemp+CLBYTES);
- pmap_enter(pmap_kernel(),
- (vm_offset_t)(curbuf + ix * CLBYTES),
- pa, VM_PROT_READ|VM_PROT_WRITE, TRUE);
- bufmemp += CLBYTES;
- }
-#else
vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE);
vm_map_simplify(buffer_map, curbuf);
-#endif
}
-#ifdef BUFFERS_UNMANAGED
-#if 0
- /*
- * We would like to free the (now empty) original address range
- * but too many bad things will happen if we try.
- */
- kmem_free(kernel_map, (vm_offset_t)buffermem, bufpages*CLBYTES);
-#endif
-#endif
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
printf("avail mem = %d\n", ptoa(cnt.v_free_count));
printf("using %d buffers containing %d bytes of memory\n",
nbuf, bufpages * CLBYTES);
+
+ /*
+ * 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 (vm_map_protect(kernel_map, 0, NBPG, VM_PROT_NONE, TRUE)
+ != KERN_SUCCESS)
+ 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 hp300_trunc_page(&kernel_text) instead
+ * XXX of NBPG.
+ */
+ if (vm_map_protect(kernel_map, NBPG, hp300_round_page(&etext),
+ VM_PROT_READ|VM_PROT_EXECUTE, TRUE) != KERN_SUCCESS)
+ panic("can't protect kernel text");
+
/*
* Set up CPU-specific registers, cache, etc.
*/
configure();
}
+/*
+ * Allocate space for system data structures. We are given
+ * a starting virtual address and we return a final virtual
+ * address; along the way we set each data structure pointer.
+ *
+ * We call allocsys() with 0 to find out how much space we want,
+ * allocate that much and fill it with zeroes, and the call
+ * allocsys() again with the correct base virtual address.
+ */
+caddr_t
+allocsys(v)
+ register caddr_t v;
+{
+
+#define valloc(name, type, num) \
+ (name) = (type *)v; v = (caddr_t)((name)+(num))
+#define valloclim(name, type, num, lim) \
+ (name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
+
+#ifdef REAL_CLISTS
+ valloc(cfree, struct cblock, nclist);
+#endif
+ valloc(callout, struct callout, ncallout);
+ valloc(swapmap, struct map, nswapmap = maxproc * 2);
+#ifdef SYSVSHM
+ valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
+#endif
+#ifdef SYSVSEM
+ valloc(sema, struct semid_ds, seminfo.semmni);
+ valloc(sem, struct sem, seminfo.semmns);
+ /* This is pretty disgusting! */
+ valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
+#endif
+#ifdef SYSVMSG
+ valloc(msgpool, char, msginfo.msgmax);
+ valloc(msgmaps, struct msgmap, msginfo.msgseg);
+ valloc(msghdrs, struct msg, msginfo.msgtql);
+ valloc(msqids, struct msqid_ds, msginfo.msgmni);
+#endif
+
+ /*
+ * Determine how many buffers to allocate. Since HPs tend
+ * to be long on memory and short on disk speed, we allocate
+ * more buffer space than the BSD standard of 10% of memory
+ * for the first 2 Meg, 5% of the remaining. We just allocate
+ * a flag 10%. Insure a minimum of 16 buffers. We allocate
+ * 1/2 as many swap buffer headers as file i/o buffers.
+ */
+ if (bufpages == 0)
+ bufpages = physmem / 10 / CLSIZE;
+ if (nbuf == 0) {
+ nbuf = bufpages;
+ if (nbuf < 16)
+ nbuf = 16;
+ }
+ if (nswbuf == 0) {
+ nswbuf = (nbuf / 2) &~ 1; /* force even */
+ if (nswbuf > 256)
+ nswbuf = 256; /* sanity */
+ }
+ valloc(swbuf, struct buf, nswbuf);
+ valloc(buf, struct buf, nbuf);
+ return (v);
+}
+
/*
* Set registers on exec.
* XXX Should clear registers except sp, pc,
char cpu_model[120];
extern char version[];
+void
identifycpu()
{
char *t, *mc;
/*
* machine dependent system variables.
*/
+int
cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int *name;
u_int namelen;
/*
* Map the LED page and setup the KVA to access it.
*/
+void
ledinit()
{
extern caddr_t ledbase;
* 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)
register int ons, offs, togs;
{
}
/*
- * Doadump comes here after turning off memory management and
- * getting on the dump stack, either when called above, or by
- * the auto-restart code.
+ * 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) __P((dev_t, daddr_t, caddr_t, size_t));
+ int pg; /* page being dumped */
+ vm_offset_t maddr; /* PA being dumped */
+ int error; /* error code from (*dump)() */
+
+ /* Don't put dump messages in msgbuf. */
msgbufmapped = 0;
+
+ /* Make sure dump device is valid. */
if (dumpdev == NODEV)
return;
if (dumpsize == 0) {
if (dumpsize == 0)
return;
}
- printf("\ndumping to dev %x, offset %d\n", dumpdev, dumplo);
+ if (dumplo < 0)
+ return;
+ dump = bdevsw[major(dumpdev)].d_dump;
+ blkno = dumplo;
+
+ printf("\ndumping to dev 0x%x, offset %d\n", dumpdev, dumplo);
printf("dump ");
- switch ((*bdevsw[major(dumpdev)].d_dump)(dumpdev)) {
+ maddr = lowram;
+ 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(), (vm_offset_t)vmmap, maddr,
+ VM_PROT_READ, TRUE);
- case ENXIO:
- printf("device bad\n");
- break;
+ error = (*dump)(dumpdev, blkno, vmmap, NBPG);
+ switch (error) {
+ case 0:
+ maddr += NBPG;
+ blkno += btodb(NBPG);
+ break;
- case EFAULT:
- printf("device not ready\n");
- break;
+ case ENXIO:
+ printf("device bad\n");
+ return;
- case EINVAL:
- printf("area improper\n");
- break;
+ case EFAULT:
+ printf("device not ready\n");
+ return;
- case EIO:
- printf("i/o error\n");
- break;
+ case EINVAL:
+ printf("area improper\n");
+ return;
- case EINTR:
- printf("aborted from console\n");
- break;
+ case EIO:
+ printf("i/o error\n");
+ return;
- default:
- printf("succeeded\n");
- break;
+ case EINTR:
+ printf("aborted from console\n");
+ return;
+
+ default:
+ printf("error %d\n", error);
+ return;
+ }
}
+ printf("succeeded\n");
}
+void
initcpu()
{
#ifdef MAPPEDCOPY
#endif
}
+void
straytrap(pc, evec)
int pc;
u_short evec;
evec & 0xFFF, pc);
}
+/* XXX should change the interface, and make one badaddr() function */
+
int *nofault;
+int
badaddr(addr)
register caddr_t addr;
{
register int i;
label_t faultbuf;
-#ifdef lint
- i = *addr; if (i) return(0);
-#endif
nofault = (int *) &faultbuf;
if (setjmp((label_t *)nofault)) {
nofault = (int *) 0;
return(0);
}
+int
badbaddr(addr)
register caddr_t addr;
{
register int i;
label_t faultbuf;
-#ifdef lint
- i = *addr; if (i) return(0);
-#endif
nofault = (int *) &faultbuf;
if (setjmp((label_t *)nofault)) {
nofault = (int *) 0;
return(0);
}
-#if (defined(DDB) || defined(DEBUG)) && !defined(PANICBUTTON)
-#define PANICBUTTON
-#endif
-
#ifdef PANICBUTTON
+/*
+ * Declare these so they can be patched.
+ */
int panicbutton = 1; /* non-zero if panic buttons are enabled */
-int crashandburn = 0;
-int candbdelay = 50; /* give em half a second */
+int candbdiv = 2; /* give em half a second (hz / candbdiv) */
+
+void candbtimer __P((void *));
+
+int crashandburn;
void
candbtimer(arg)
crashandburn = 0;
}
-#endif
+#endif /* PANICBUTTON */
+
+static int innmihand; /* simple mutex */
/*
* Level 7 interrupts can be caused by the keyboard or parity errors.
*/
+void
nmihand(frame)
struct frame frame;
{
+
+ /* Prevent unwanted recursion. */
+ if (innmihand)
+ return;
+ innmihand = 1;
+
+ /* Check for keyboard <CRTL>+<SHIFT>+<RESET>. */
if (kbdnmi()) {
-#ifdef PANICBUTTON
- static int innmihand = 0;
+ printf("Got a keyboard NMI");
/*
- * Attempt to reduce the window of vulnerability for recursive
- * NMIs (e.g. someone holding down the keyboard reset button).
+ * We can:
+ *
+ * - enter DDB
+ *
+ * - Start the crashandburn sequence
+ *
+ * - Ignore it.
*/
- if (innmihand == 0) {
- innmihand = 1;
- printf("Got a keyboard NMI\n");
- innmihand = 0;
- }
#ifdef DDB
+ printf(": entering debugger\n");
Debugger();
#else
+#ifdef PANICBUTTON
if (panicbutton) {
if (crashandburn) {
crashandburn = 0;
- panic(panicstr ?
- "forced crash, nosync" : "forced crash");
+ printf(": CRASH AND BURN!\n");
+ panic("forced crash");
+ } else {
+ /* Start the crashandburn sequence */
+ printf("\n");
+ crashandburn = 1;
+ timeout(candbtimer, NULL, hz / candbdiv);
}
- crashandburn++;
- timeout(candbtimer, (void *)0, candbdelay);
- }
-#endif /* DDB */
+ } else
#endif /* PANICBUTTON */
- return;
+ printf(": ignoring\n");
+#endif /* DDB */
+
+ goto nmihand_out; /* no more work to do */
}
+
if (parityerror(&frame))
return;
/* panic?? */
printf("unexpected level 7 interrupt ignored\n");
+
+ nmihand_out:
+ innmihand = 0;
}
/*
/*
* Enable parity detection
*/
+void
parityenable()
{
label_t faultbuf;
nofault = (int *) &faultbuf;
if (setjmp((label_t *)nofault)) {
nofault = (int *) 0;
-#ifdef DEBUG
printf("No parity memory\n");
-#endif
return;
}
*PARREG = 1;
nofault = (int *) 0;
gotparmem = 1;
-#ifdef DEBUG
printf("Parity detection enabled\n");
-#endif
}
/*
* 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;
{
printf("parity error after panic ignored\n");
return(1);
}
- if (!findparerror())
+ if (!parityerrorfind())
printf("WARNING: transient parity error ignored\n");
else if (USERMODE(fp->f_sr)) {
printf("pid %d: parity error\n", curproc->p_pid);
* Yuk! There has got to be a better way to do this!
* Searching all of memory with interrupts blocked can lead to disaster.
*/
-findparerror()
+int
+parityerrorfind()
{
static label_t parcatch;
static int looking = 0;
return(found);
}
+void
regdump(fp, sbytes)
struct frame *fp; /* must not be register */
int sbytes;
static int doingdump = 0;
register int i;
int s;
- extern char *hexstr();
if (doingdump)
return;
#define KSADDR ((int *)((u_int)curproc->p_addr + USPACE - NBPG))
+void
dumpmem(ptr, sz, ustack)
register int *ptr;
int sz, ustack;
{
register int i, val;
- extern char *hexstr();
for (i = 0; i < sz; i++) {
if ((i & 7) == 0)
epp->ep_daddr + execp->a_data, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
- return exec_aout_setup_stack(p, epp);
+ return exec_setup_stack(p, epp);
}
#endif /* COMPAT_M68K4K */
+/* $OpenBSD: mem.c,v 1.2 1997/01/12 15:13:24 downsj Exp $ */
/* $NetBSD: mem.c,v 1.13 1995/04/10 13:10:51 mycroft Exp $ */
/*
-/* $NetBSD: pmap.c,v 1.24 1995/12/11 17:09:14 thorpej Exp $ */
+/* $OpenBSD: pmap.c,v 1.3 1997/01/12 15:13:25 downsj Exp $ */
+/* $NetBSD: pmap.c,v 1.27 1996/10/13 03:14:32 christos Exp $ */
/*
* Copyright (c) 1991, 1993
*
* Supports:
* 68020 with HP MMU models 320, 350
- * 68020 with 68551 MMU models 318, 319, 330 (all untested)
+ * 68020 with 68551 MMU models 318, 319, 330
* 68030 with on-chip MMU models 340, 360, 370, 345, 375, 400
* 68040 with on-chip MMU models 380, 425, 433
*
-/* $NetBSD: pmap_bootstrap.c,v 1.9 1995/12/11 17:09:16 thorpej Exp $ */
+/* $OpenBSD: pmap_bootstrap.c,v 1.3 1997/01/12 15:13:26 downsj Exp $ */
+/* $NetBSD: pmap_bootstrap.c,v 1.10 1996/10/14 08:05:37 thorpej Exp $ */
/*
* Copyright (c) 1991, 1993
extern st_entry_t *Sysseg;
extern pt_entry_t *Sysptmap, *Sysmap;
extern vm_offset_t CLKbase, MMUbase;
+extern vm_offset_t pagezero;
extern int maxmem, physmem;
extern vm_offset_t avail_start, avail_end, virtual_avail, virtual_end;
while (pte < epte) {
*pte++ = PG_NV;
}
- /*
- * Initialize the last to point to point to the page
+ /*
+ * Initialize the last to point to the page
* table page allocated earlier.
*/
*pte = lkptpa | PG_RW | PG_CI | PG_V;
epte = &pte[nptpages * NPTEPG];
while (pte < epte)
*pte++ = PG_NV;
+
/*
- * Validate PTEs for kernel text (RO)
+ * Save the physical address of `page zero'. This is
+ * a page of memory at the beginning of kernel text
+ * not mapped at VA 0. But, we might want to use it
+ * for something later.
*/
- pte = &((u_int *)kptpa)[hp300_btop(KERNBASE)];
+ RELOC(pagezero, vm_offset_t) = firstpa;
+
+ /*
+ * Validate PTEs for kernel text (RO). The first page
+ * of kernel text remains invalid; see locore.s
+ */
+ pte = &((u_int *)kptpa)[hp300_btop(KERNBASE + NBPG)];
epte = &pte[hp300_btop(hp300_trunc_page(&etext))];
-#if defined(KGDB) || defined(DDB)
- protopte = firstpa | PG_RW | PG_V; /* XXX RW for now */
-#else
- protopte = firstpa | PG_RO | PG_V;
-#endif
+ protopte = (firstpa + NBPG) | PG_RO | PG_V;
while (pte < epte) {
*pte++ = protopte;
protopte += NBPG;
-/* $NetBSD: swapgeneric.c,v 1.12 1995/09/24 02:18:11 thorpej Exp $ */
+/* $OpenBSD: swapgeneric.c,v 1.2 1997/01/12 15:13:27 downsj Exp $ */
+/* $NetBSD: swapgeneric.c,v 1.15 1996/10/14 07:20:27 thorpej Exp $ */
-/*
- * Copyright (c) 1982, 1986 Regents of the University of California.
- * All rights reserved.
+/*-
+ * 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
* 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.
+ * 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.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)swapgeneric.c 7.5 (Berkeley) 5/7/91
+ * @(#)swapgeneric.c 8.2 (Berkeley) 3/21/94
+ */
+
+/*
+ * fake swapgeneric.c -- should do this differently.
*/
#include <sys/param.h>
#include <sys/conf.h>
-#include <sys/buf.h>
-#include <sys/disklabel.h>
-#include <sys/systm.h>
-#include <sys/reboot.h>
-#include <hp300/dev/device.h>
-
-#include "sd.h"
-#include "rd.h"
-#include "le.h"
-
-/*
- * Generic configuration; all in one
- */
+int (*mountroot) __P((void *)) = NULL; /* tells autoconf.c that we are "generic" */
dev_t rootdev = NODEV;
-dev_t argdev = NODEV;
dev_t dumpdev = NODEV;
-int nswap;
-struct swdevt swdevt[] = {
- { -1, 1, 0 },
- { NODEV, 0, 0 },
-};
-int dmmin, dmmax, dmtext;
-
-#if NRD > 0
-extern struct driver rddriver;
-#endif
-#if NSD > 0
-extern struct driver sddriver;
-#endif
-#if NLE > 0
-extern struct driver ledriver;
-#endif
-
-extern struct hp_ctlr hp_cinit[];
-extern struct hp_device hp_dinit[];
-
-extern u_long bootdev;
-static int no_mountroot __P((void));
-
-#ifdef FFS
-extern int ffs_mountroot();
-#else
-#define ffs_mountroot no_mountroot
-#endif /* FFS */
-
-#ifdef NFSCLIENT
-extern char *nfsbootdevname; /* from nfs_boot.c */
-extern int nfs_mountroot(); /* nfs_vfsops.c */
-static char nfsbootdevname_buf[128];
-#else
-static char *nfsbootdevname;
-#define nfs_mountroot no_mountroot
-#endif /* NFSCLIENT */
-
-/* XXX: should eventually ask for root fs type. */
-
-struct genericconf {
- caddr_t gc_driver;
- char *gc_name;
- dev_t gc_root;
- int (*gc_mountroot)();
-} genericconf[] = {
-#if NRD > 0
- { (caddr_t)&rddriver, "rd", makedev(2, 0), ffs_mountroot },
-#endif
-#if NSD > 0
- { (caddr_t)&sddriver, "sd", makedev(4, 0), ffs_mountroot },
-#endif
-#if NLE > 0
- { (caddr_t)&ledriver, "le", NODEV, nfs_mountroot },
-#endif
- { 0 },
+struct swdevt swdevt[] = {
+ { NODEV, 0, 0 }, /* to be filled in */
+ { NODEV, 0, 0 }
};
-
-int (*mountroot)() = ffs_mountroot;
-
-setconf()
-{
- register struct hp_ctlr *hc;
- register struct hp_device *hd;
- register struct genericconf *gc;
- register char *cp;
- int unit, swaponroot = 0;
-
- if (rootdev != NODEV)
- goto doswap;
- unit = 0;
- if (boothowto & RB_ASKNAME) {
- char name[128];
-retry:
- printf("root device? ");
- gets(name);
- for (gc = genericconf; gc->gc_driver; gc++)
- if (gc->gc_name[0] == name[0] &&
- gc->gc_name[1] == name[1])
- goto gotit;
- printf("use one of:");
- for (gc = genericconf; gc->gc_driver; gc++)
- printf(" %s?", gc->gc_name);
- printf("\n");
- goto retry;
-gotit:
- cp = &name[1];
- if (*++cp < '0' || *cp > '9') {
- printf("bad/missing unit number\n");
- goto retry;
- }
- while (*cp >= '0' && *cp <= '9')
- unit = 10 * unit + *cp++ - '0';
- if (*cp == '*')
- swaponroot++;
-
-#ifdef NFSCLIENT
- if (gc->gc_root == NODEV) {
- /*
- * Tell nfs_mountroot if it's a network interface.
- */
- bzero(nfsbootdevname_buf, sizeof(nfsbootdevname_buf));
- sprintf(nfsbootdevname_buf, "%s%d", gc->gc_name, unit);
- nfsbootdevname = nfsbootdevname_buf;
- }
-#endif /* NFSCLIENT */
- goto found;
- }
- for (gc = genericconf; gc->gc_driver; gc++) {
- if (bootdev == 0 && gc->gc_root != NODEV)
- continue;
- for (hd = hp_dinit; hd->hp_driver; hd++) {
- if (hd->hp_alive == 0)
- continue;
- if (hd->hp_unit == 0 && hd->hp_driver ==
- (struct driver *)gc->gc_driver) {
- printf("root on %s0\n", hd->hp_driver->d_name);
- goto found;
- }
- }
- }
- printf("No suitable root, halting.\n");
- asm("stop #0x2700");
-found:
- if (gc->gc_root != NODEV)
- gc->gc_root = makedev(major(gc->gc_root), unit*8);
- mountroot = gc->gc_mountroot; /* XXX: should ask for fs type. */
- rootdev = gc->gc_root;
-doswap:
- if (rootdev == NODEV)
- swdevt[0].sw_dev = argdev = dumpdev = NODEV;
- else {
- /*
- * Primary swap is always in the `b' partition.
- */
- swdevt[0].sw_dev = argdev = dumpdev =
- MAKEDISKDEV(major(rootdev), DISKUNIT(rootdev), 1);
- /* swap size and dumplo set during autoconfigure */
- if (swaponroot)
- rootdev = dumpdev;
- }
-}
-
-gets(cp)
- char *cp;
-{
- register char *lp;
- register c;
-
- lp = cp;
- for (;;) {
- cnputc(c = cngetc());
- switch (c) {
- case '\n':
- case '\r':
- *lp++ = '\0';
- return;
- case '\b':
- case '\177':
- if (lp > cp) {
- lp--;
- cnputc(' ');
- cnputc('\b');
- }
- continue;
- case '#':
- lp--;
- if (lp < cp)
- lp = cp;
- continue;
- case '@':
- case 'u'&037:
- lp = cp;
- cnputc('\n');
- continue;
- default:
- *lp++ = c;
- }
- }
-}
-
-static int
-no_mountroot()
-{
-
- printf("root/swap configuration error, halting.\n");
- asm("stop #0x2700");
- /* NOTREACHED */
-}
+/* $OpenBSD: sys_machdep.c,v 1.3 1997/01/12 15:13:27 downsj Exp $ */
/* $NetBSD: sys_machdep.c,v 1.13 1995/12/11 17:09:17 thorpej Exp $ */
/*
-/* $NetBSD: trap.c,v 1.40 1995/12/11 17:09:18 thorpej Exp $ */
+/* $OpenBSD: trap.c,v 1.4 1997/01/12 15:13:28 downsj Exp $ */
+/* $NetBSD: trap.c,v 1.47 1996/10/14 20:06:31 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#ifdef COMPAT_HPUX
#include <compat/hpux/hpux.h>
+extern struct emul emul_hpux;
#endif
+#ifdef COMPAT_SUNOS
+#include <compat/sunos/sunos_syscall.h>
+extern struct emul emul_sunos;
+#endif
+
+int writeback __P((struct frame *fp, int docachepush));
+void trap __P((int type, u_int code, u_int v, struct frame frame));
+void syscall __P((register_t code, struct frame frame));
+
+#ifdef DEBUG
+void dumpssw __P((u_short));
+void dumpwb __P((int, u_short, u_int, u_int));
+#endif
+
+static inline void userret __P((struct proc *p, struct frame *fp,
+ u_quad_t oticks, u_int faultaddr, int fromtrap));
+
char *trap_type[] = {
"Bus error",
"Address error",
* Size of various exception stack frames (minus the standard 8 bytes)
*/
short exframesize[] = {
- FMT0SIZE, /* type 0 - normal (68020/030/040) */
+ FMT0SIZE, /* type 0 - normal (68020/030/040/060) */
FMT1SIZE, /* type 1 - throwaway (68020/030/040) */
- FMT2SIZE, /* type 2 - normal 6-word (68020/030/040) */
- FMT3SIZE, /* type 3 - FP post-instruction (68040) */
- -1, -1, -1, /* type 4-6 - undefined */
+ 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) */
-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(c) (mmutype == MMU_68040 ? \
- ((c) & SSW4_TMMASK) == SSW4_TMKD : \
- ((c) & (SSW_DF|FC_SUPERD)) == (SSW_DF|FC_SUPERD))
-#define WRFAULT(c) (mmutype == MMU_68040 ? \
- ((c) & SSW4_RW) == 0 : \
- ((c) & (SSW_DF|SSW_RW)) == SSW_DF)
+#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(c) (((c) & (SSW_DF|SSW_FCMASK)) == (SSW_DF|FC_SUPERD))
-#define WRFAULT(c) (((c) & (SSW_DF|SSW_RW)) == SSW_DF)
+#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
+#define MDB_ISPID(p) ((p) == mmupid)
#endif
/*
* we just return to the user without sucessfully completing
* the writebacks. Maybe we should just drop the sucker?
*/
- if (mmutype == MMU_68040 && fp->f_format == FMT7) {
+ if (cputype == CPU_68040 && fp->f_format == FMT7) {
if (beenhere) {
#ifdef DEBUG
if (mmudebug & MDB_WBFAILED)
* System calls are broken out for efficiency.
*/
/*ARGSUSED*/
+void
trap(type, code, v, frame)
int type;
unsigned code;
struct frame frame;
{
extern char fubail[], subail[];
-#ifdef DDB
- extern char trap0[], trap1[], trap2[], trap12[], trap15[], illinst[];
-#endif
register struct proc *p;
- register int i;
+ register int i, s;
u_int ucode;
u_quad_t sticks;
-#ifdef COMPAT_HPUX
- extern struct emul emul_hpux;
-#endif
cnt.v_trap++;
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;
sticks = p->p_sticks;
switch (type) {
default:
-dopanic:
- printf("trap type %d, code = %x, v = %x\n", type, code, v);
+ 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
- if (kdb_trap(type, &frame))
- return;
+ (void) kdb_trap(type, &frame);
+#endif
+ kgdb_cont:
+ splx(s);
+ if (panicstr) {
+ printf("trap during panic!\n");
+#ifdef DEBUG
+ /* XXX should be a machine-dependent hook */
+ printf("(press a key)\n"); (void)cngetc();
#endif
+ }
regdump(&frame, 128);
type &= ~T_USER;
- if ((unsigned)type < trap_types)
+ 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)
+ 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.
*/
-copyfault:
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;
* XXX: Trace traps are a nightmare.
*
* HP-UX uses trap #1 for breakpoints,
- * HPBSD uses trap #2,
+ * NetBSD/m68k uses trap #2,
* SUN 3.x uses trap #15,
- * KGDB uses trap #15 (for kernel breakpoints; handled elsewhere).
+ * DDB and KGDB uses trap #15 (for kernel breakpoints;
+ * handled elsewhere).
*
- * HPBSD and HP-UX traps both get mapped by locore.s into T_TRACE.
+ * NetBSD 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_TRACE or T_TRAP15
+ * XXX: because locore.s now gives them special treatment.
*/
case T_TRACE: /* kernel trace trap */
- case T_TRAP15: /* SUN trace trap */
-#ifdef DDB
- if (type == T_TRAP15 ||
- ((caddr_t)frame.f_pc != trap0 &&
- (caddr_t)frame.f_pc != trap1 &&
- (caddr_t)frame.f_pc != trap2 &&
- (caddr_t)frame.f_pc != trap12 &&
- (caddr_t)frame.f_pc != trap15 &&
- (caddr_t)frame.f_pc != illinst)) {
- if (kdb_trap(type, &frame))
- return;
- }
+ 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;
- i = SIGTRAP;
- break;
+ return;
case T_TRACE|T_USER: /* user trace trap */
case T_TRAP15|T_USER: /* SUN user trace trap */
+#ifdef COMPAT_SUNOS
+ /*
+ * XXX This comment/code is not consistent XXX
+ * SunOS seems to use Trap #2 for some obscure
+ * fpu operations. So far, just ignore it, but
+ * DONT trap on it..
+ */
+ if (p->p_emul == &emul_sunos)
+ goto out;
+#endif
frame.f_sr &= ~PSL_T;
i = SIGTRAP;
break;
* The last can occur during an exec() copyin where the
* argument space is lazy-allocated.
*/
- if (type == T_MMUFLT &&
- (!p->p_addr->u_pcb.pcb_onfault || KDFAULT(code)))
+ if ((type & T_USER) == 0 &&
+ ((p->p_addr->u_pcb.pcb_onfault == 0) || KDFAULT(code)))
map = kernel_map;
else
- map = &vm->vm_map;
+ map = vm ? &vm->vm_map : kernel_map;
+
if (WRFAULT(code))
ftype = VM_PROT_READ | VM_PROT_WRITE;
else
ftype = VM_PROT_READ;
+
va = trunc_page((vm_offset_t)v);
-#ifdef DEBUG
+
if (map == kernel_map && va == 0) {
- printf("trap: bad kernel access at %x\n", v);
+ printf("trap: bad kernel %s access at 0x%x\n",
+ (ftype & VM_PROT_WRITE) ? "read/write" :
+ "read", v);
goto dopanic;
}
-#endif
+
#ifdef COMPAT_HPUX
if (ISHPMMADDR(va)) {
vm_offset_t bva;
* the current limit and we need to reflect that as an access
* error.
*/
- if ((caddr_t)va >= vm->vm_maxsaddr && map != kernel_map) {
+ if ((vm != NULL && (caddr_t)va >= vm->vm_maxsaddr)
+ && map != kernel_map) {
if (rv == KERN_SUCCESS) {
unsigned nss;
if (rv == KERN_SUCCESS) {
if (type == T_MMUFLT) {
#ifdef M68040
- if (mmutype == MMU_68040)
+ if (cputype == CPU_68040)
(void) writeback(&frame, 1);
#endif
return;
"WARNING: pid %d(%s) writeback [%s] failed, pc=%x fa=%x wba=%x wbd=%x\n";
#endif
+int
writeback(fp, docachepush)
struct frame *fp;
int docachepush;
}
#ifdef DEBUG
+void
dumpssw(ssw)
register u_short ssw;
{
f7tm[ssw & SSW4_TMMASK]);
}
+void
dumpwb(num, s, a, d)
int num;
u_short s;
/*
* Process a system call.
*/
+void
syscall(code, frame)
register_t code;
struct frame frame;
size_t argsize;
register_t args[8], rval[2];
u_quad_t sticks;
-#ifdef COMPAT_SUNOS
- extern struct emul emul_sunos;
-#endif
cnt.v_syscall++;
if (!USERMODE(frame.f_sr))
-| $NetBSD: vectors.s,v 1.9 1996/05/18 00:52:53 thorpej Exp $
+| $OpenBSD: vectors.s,v 1.4 1997/01/12 15:13:29 downsj Exp $
+| $NetBSD: vectors.s,v 1.10 1996/10/14 22:11:18 thorpej Exp $
| Copyright (c) 1988 University of Utah
| Copyright (c) 1990, 1993
.globl _vectab
_vectab:
- .long 0x4ef80400 /* 0: jmp 0x400:w (unused reset SSP) */
+ .long 0 /* 0: NOT USED (reset SSP) */
.long 0 /* 1: NOT USED (reset PC) */
.long _buserr /* 2: bus error */
.long _addrerr /* 3: address error */
+/* $OpenBSD: vm_machdep.c,v 1.6 1997/01/12 15:13:29 downsj Exp $ */
/* $NetBSD: vm_machdep.c,v 1.30 1996/05/09 21:26:08 scottr Exp $ */
/*
+/* $OpenBSD: ansi.h,v 1.2 1997/01/12 15:13:30 downsj Exp $ */
/* $NetBSD: ansi.h,v 1.4 1994/10/26 07:26:16 cgd Exp $ */
/* Just use the common m68k definition */
+/* $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>
+/* $OpenBSD: autoconf.h,v 1.2 1997/01/12 15:13:31 downsj Exp $ */
/* $NetBSD: autoconf.h,v 1.3 1996/03/03 16:49:17 thorpej Exp $ */
/*-
+/* $OpenBSD: cdefs.h,v 1.2 1997/01/12 15:13:32 downsj Exp $ */
/* $NetBSD: cdefs.h,v 1.1 1995/01/19 01:41:56 jtc Exp $ */
#ifndef _MACHINE_CDEFS_H_
-/* $NetBSD: cpu.h,v 1.19 1996/05/17 15:37:07 thorpej Exp $ */
+/* $OpenBSD: cpu.h,v 1.5 1997/01/12 15:13:33 downsj Exp $ */
+/* $NetBSD: cpu.h,v 1.21 1996/10/07 06:29:30 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Exported definitions unique to hp300/68k cpu support.
*/
+/*
+ * Get common m68k CPU definitions.
+ */
+#include <m68k/cpu.h>
+
/*
* definitions of cpu-dependent requirements
* referenced in generic code
#define HP_380 7 /* 25Mhz 68040 */
#define HP_433 8 /* 33Mhz 68040 */
-/* values for mmutype (assigned for quick testing) */
-#define MMU_68040 -2 /* 68040 on-chip MMU */
-#define MMU_68030 -1 /* 68030 on-chip subset of 68851 */
-#define MMU_HP 0 /* HP proprietary */
-#define MMU_68851 1 /* Motorola 68851 */
-
-/* values for ectype */
-#define EC_PHYS -1 /* external physical address cache */
-#define EC_NONE 0 /* no external cache */
-#define EC_VIRT 1 /* external virtual address cache */
-
#ifdef _KERNEL
extern int machineid; /* CPU model */
-extern int mmutype; /* MMU on this host */
-extern int ectype; /* External cache type */
extern int cpuspeed; /* CPU speed, in MHz */
extern char *intiobase, *intiolimit;
extern void (*vectab[]) __P((void));
+struct frame;
+
+/* locore.s functions */
void doboot __P((void))
__attribute__((__noreturn__));
+void ecacheon __P((void));
+void ecacheoff __P((void));
+
+/* machdep.c functions */
+int badaddr __P((caddr_t));
+int badbaddr __P((caddr_t));
+void regdump __P((struct frame *, int));
/* what is this supposed to do? i.e. how is it different than startrtclock? */
#define enablertclock()
#define MMU_FAULT (MMU_PTF|MMU_PF|MMU_WPF|MMU_BERR)
#define MMU_ENAB (MMU_UMEN|MMU_SMEN|MMU_IEN|MMU_FPE)
-/*
- * 68851 and 68030 MMU
- */
-#define PMMU_LVLMASK 0x0007
-#define PMMU_INV 0x0400
-#define PMMU_WP 0x0800
-#define PMMU_ALV 0x1000
-#define PMMU_SO 0x2000
-#define PMMU_LV 0x4000
-#define PMMU_BE 0x8000
-#define PMMU_FAULT (PMMU_WP|PMMU_INV)
-
-/*
- * 68040 MMU
- */
-#define MMU4_RES 0x001
-#define MMU4_TTR 0x002
-#define MMU4_WP 0x004
-#define MMU4_MOD 0x010
-#define MMU4_CMMASK 0x060
-#define MMU4_SUP 0x080
-#define MMU4_U0 0x100
-#define MMU4_U1 0x200
-#define MMU4_GLB 0x400
-#define MMU4_BE 0x800
-
-/* 680X0 function codes */
-#define FC_USERD 1 /* user data space */
-#define FC_USERP 2 /* user program space */
-#define FC_PURGE 3 /* HPMMU: clear TLB entries */
-#define FC_SUPERD 5 /* supervisor data space */
-#define FC_SUPERP 6 /* supervisor program space */
-#define FC_CPU 7 /* CPU space */
-
-/* fields in the 68020 cache control register */
-#define IC_ENABLE 0x0001 /* enable instruction cache */
-#define IC_FREEZE 0x0002 /* freeze instruction cache */
-#define IC_CE 0x0004 /* clear instruction cache entry */
-#define IC_CLR 0x0008 /* clear entire instruction cache */
-
-/* additional fields in the 68030 cache control register */
-#define IC_BE 0x0010 /* instruction burst enable */
-#define DC_ENABLE 0x0100 /* data cache enable */
-#define DC_FREEZE 0x0200 /* data cache freeze */
-#define DC_CE 0x0400 /* clear data cache entry */
-#define DC_CLR 0x0800 /* clear entire data cache */
-#define DC_BE 0x1000 /* data burst enable */
-#define DC_WA 0x2000 /* write allocate */
-
-#define CACHE_ON (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
-#define CACHE_OFF (DC_CLR|IC_CLR)
-#define CACHE_CLR (CACHE_ON)
-#define IC_CLEAR (DC_WA|DC_BE|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
-#define DC_CLEAR (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_ENABLE)
-
-/* 68040 cache control register */
-#define IC4_ENABLE 0x8000 /* instruction cache enable bit */
-#define DC4_ENABLE 0x80000000 /* data cache enable bit */
-
-#define CACHE4_ON (IC4_ENABLE|DC4_ENABLE)
-#define CACHE4_OFF (0)
-
#endif /* _HP300_CPU_H_ */
+/* $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 */
+/* $OpenBSD: disklabel.h,v 1.2 1997/01/12 15:13:34 downsj Exp $ */
/* $NetBSD: disklabel.h,v 1.1 1994/10/14 18:26:39 cgd Exp $ */
/*
+/* $OpenBSD: exec.h,v 1.7 1997/01/12 15:13:34 downsj Exp $ */
/* $NetBSD: exec.h,v 1.10 1995/11/20 01:15:26 thorpej Exp $ */
/*
+/* $OpenBSD: float.h,v 1.2 1997/01/12 15:13:35 downsj Exp $ */
/* $NetBSD: float.h,v 1.7 1995/06/20 20:45:34 jtc Exp $ */
#ifndef _MACHINE_FLOAT_H_
+/* $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>
+/* $OpenBSD: hpux_machdep.h,v 1.3 1997/01/12 15:13:36 downsj Exp $ */
/* $NetBSD: hpux_machdep.h,v 1.3 1996/02/28 01:05:57 thorpej Exp $ */
/*-
+/* $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 */
+/* $OpenBSD: limits.h,v 1.2 1997/01/12 15:13:37 downsj Exp $ */
/* $NetBSD: limits.h,v 1.7 1994/10/26 07:26:27 cgd Exp $ */
/* Just use the common m68k definition */
+/* $OpenBSD: mtpr.h,v 1.2 1997/01/12 15:13:37 downsj Exp $ */
/* $NetBSD: mtpr.h,v 1.4 1994/10/26 07:26:29 cgd Exp $ */
/*
-/* $NetBSD: param.h,v 1.26 1996/05/17 15:38:08 thorpej Exp $ */
+/* $OpenBSD: param.h,v 1.5 1997/01/12 15:13:38 downsj Exp $ */
+/* $NetBSD: param.h,v 1.27 1996/12/09 03:04:48 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
#define spl6() _spl(PSL_S|PSL_IPL6)
#define spl7() _spl(PSL_S|PSL_IPL7)
+#if defined(_KERNEL) && !defined(_LOCORE)
+/*
+ * These four globals contain the appropriate PSL_S|PSL_IPL? values
+ * to raise interrupt priority to the requested level.
+ */
+extern unsigned short hp300_bioipl;
+extern unsigned short hp300_netipl;
+extern unsigned short hp300_ttyipl;
+extern unsigned short hp300_impipl;
+#endif /* _KERNEL && !_LOCORE */
+
#define splsoftclock() spl1()
#define splsoftnet() spl1()
-#define splbio() spl5()
-#define splnet() spl5()
-#define spltty() spl5()
-#define splimp() spl5()
+#define splbio() _spl(hp300_bioipl)
+#define splnet() _spl(hp300_netipl)
+#define spltty() _spl(hp300_ttyipl)
+#define splimp() _spl(hp300_impipl)
#define splclock() spl6()
#define splstatclock() spl6()
#define splvm() spl6()
+/* $OpenBSD: pcb.h,v 1.2 1997/01/12 15:13:38 downsj Exp $ */
/* $NetBSD: pcb.h,v 1.8 1995/05/12 12:55:17 mycroft Exp $ */
/*
+/* $OpenBSD: pmap.h,v 1.3 1997/01/12 15:13:39 downsj Exp $ */
/* $NetBSD: pmap.h,v 1.10 1995/12/11 17:09:23 thorpej Exp $ */
/*
+/* $OpenBSD: proc.h,v 1.2 1997/01/12 15:13:40 downsj Exp $ */
/* $NetBSD: proc.h,v 1.6 1994/10/26 07:26:35 cgd Exp $ */
/*
+/* $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>
+/* $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>
+/* $OpenBSD: pte.h,v 1.2 1997/01/12 15:13:41 downsj Exp $ */
/* $NetBSD: pte.h,v 1.4 1994/10/26 07:26:40 cgd Exp $ */
/*
+/* $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 */
+/* $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_
+/* $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>
+/* $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 */
+/* $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 */
+/* $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>
-/* $NetBSD: types.h,v 1.5 1995/06/26 05:13:46 cgd Exp $ */
+/* $OpenBSD: types.h,v 1.2 1997/01/12 15:13:45 downsj Exp $ */
+/* $NetBSD: types.h,v 1.8 1996/12/17 08:11:50 thorpej Exp $ */
#ifndef _MACHINE_TYPES_H_
#define _MACHINE_TYPES_H_
#include <m68k/types.h>
-#define __BDEVSW_DUMP_OLD_TYPE
-
#endif
+/* $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 */
-/* $NetBSD: vmparam.h,v 1.7 1994/10/26 07:26:52 cgd Exp $ */
+/* $OpenBSD: vmparam.h,v 1.2 1997/01/12 15:13:46 downsj Exp $ */
+/* $NetBSD: vmparam.h,v 1.9 1996/10/20 23:23:28 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.