code:
#	$OpenBSD: GENERIC,v 1.108 2015/03/30 20:32:59 miod Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
#
# For further information on hardware support for this architecture, see
# the intro(4) man page.  For further information about kernel options
# for this architecture, see the options(4) man page.  For an explanation
# of each device driver in this file see the section 4 man page for the
# device.

machine		sparc
include		"../../../conf/GENERIC"
maxusers	20		# estimated number of users

# Options for variants of the Sun SPARC architecture.
# At least one is required.
option		SUN4		# sun4/100, sun4/200, sun4/300
option		SUN4C		# sun4c - SS1, 1+, 2, ELC, SLC, IPC, IPX, etc.
option		SUN4E		# sun4e - SPARCengine 1E
option		SUN4M		# sun4m - SS10, SS20, Classic, etc.

#option		MMU_3L		# 3-level MMU on sun4/400

#option		KGDB		# support for kernel gdb
#option		KGDBDEV=0xc01	# kgdb device number (dev_t)
#option		KGDBRATE=38400	# baud rate

option		WSEMUL_SUN	# provide sun terminal emulation; required
option		WSEMUL_NO_VT100	# do not provide vt100 terminal emulation
option		WSDISPLAY_COMPAT_RAWKBD # provide raw scancodes; needed for X11

# Generic swap; second partition of root disk or network.
config		bsd	swap generic

# Main bus and CPU .. all systems.
mainbus0 at root
cpu0	at mainbus0

# Bus types found on SPARC systems.
sbus0	at mainbus0				# sun4c and sun4e
obio0	at mainbus0				# sun4 and sun4m
vmes0	at mainbus0				# sun4
vmel0	at mainbus0				# sun4
iommu0	at mainbus0				# sun4m
sbus0	at iommu0				# sun4m

audioamd0 at mainbus0				# sun4c
audioamd0 at obio0				# sun4m
audioamd0 at sbus0				# sun4m
audio*	at audioamd?

audiocs0 at sbus0				# sun4m
audio*	at audiocs?

auxreg*	at mainbus0				# sun4c and sun4e
auxreg*	at obio0				# sun4m

# Power status and control register found on Sun4m systems
power0	at obio0

# Mostek clock found on 4/300, sun4c, and sun4m systems.
# The Mostek clock NVRAM is the "eeprom" on sun4/300 systems.
clock0	at mainbus0				# sun4c and sun4e
clock0	at obio0				# sun4m
clock0	at obio0 addr 0xf2000000		# sun4/300

# Intersil clock found on 4/100 and 4/200 systems.
oclock0	at obio0 addr 0xf3000000		# sun4/100 and sun4/200

# Memory error registers.
memreg0	at mainbus0				# sun4c and sun4e
memreg0	at obio0				# sun4m
memreg0	at obio0 addr 0xf4000000		# sun4

# ECC memory control
eccmemctl0 at mainbus0				# sun4m

# Timer chip found on 4/300, sun4c, and sun4m systems.
timer0	at mainbus0				# sun4c and sun4e
timer0	at obio0				# sun4m
timer0	at obio0 addr 0xef000000		# sun4/300

# EEPROM found on 4/100 and 4/200 systems.  Note that the 4/300
# doesn't use this driver; the `EEPROM' is in the NVRAM on the
# Mostek clock chip on 4/300 systems.
eeprom0	at obio0 addr 0xf2000000		# sun4/100 and sun4/200

# 8 segment led display on sun4/sun4m systems
led0 at mainbus0				# sun4 and sun4e
led0 at obio0					# sun4/600

# Zilog 8530 serial chips.  Each has two-channels.
# zs0 is ttya and ttyb.  zs1 is the keyboard and mouse.
zs0	at mainbus0					# sun4c and sun4e
zs0	at obio0					# sun4m
zs0	at obio0 addr 0xf1000000 level 12		# sun4
zs1	at mainbus0					# sun4c and sun4e
zs1	at obio0					# sun4m
zs1	at obio0 addr 0xf0000000 level 12		# sun4
zs2	at obio0 addr 0xe0000000 level 12		# sun4/300

zstty* at zs?
zskbd* at zs?
wskbd* at zskbd?
zsms*  at zs?
wsmouse* at zsms?

# Magma serial/parallel port devices
magma*	at sbus?					# magma serial cards
mtty*	at magma?
mbpp*	at magma?

# SUNW,spif serial/parallel port devices
spif*	at sbus?					# spif serial cards
stty*	at spif?
sbpp*	at spif?

bpp*	at sbus?					# parallel port

# built-in modem on Tadpole SPARCbook
com*	at obio?

# SUNW,xbox SBus Expansion Subsystem
xbox*	at sbus?					# SBus Expansion box
sbus*	at xbox?

#
# Note the flags on the esp entries below, that work around
# deficiencies in the current driver:
#	bits 0-7:  disable disconnect/reselect for the corresponding target
#	bits 8-15: disable synch negotiation for target [bit-8]
#	Note: targets 4-7 have disconnect/reselect enabled on the premise
#	      that tape devices normally have one of these targets. Tape
#	      devices should be allowed to disconnect for the SCSI bus
#	      to operate acceptably.
#

# sun4/300 SCSI - an NCR53c94 or equivalent behind
# an LSI Logic DMA controller
dma0	at obio0 addr 0xfa001000 level 4		# sun4/300
esp0	at obio0 addr 0xfa000000 level 4 flags 0x00ff000f

# sun4c or sun4m SCSI - an NCR53c94 or equivalent behind
# specialized DMA glue
dma0	at sbus0					# on-board SCSI
esp0	at sbus0 flags 0x00ff000f			# sun4c and sun4e
esp0	at dma0 flags 0x00ff000f			# sun4m

# FSBE/S SCSI - an NCR53c94 or equivalent behind
dma*	at sbus?					# SBus SCSI
esp*	at sbus? flags 0x00ff000f			# two flavours
esp*	at dma? flags 0x00ff000f			# depending on model

#sun4c, sun4e, sun4m
qlw*	at sbus?
#qla*	at sbus?

# sun4m Ethernet - an AMD 7990 LANCE behind
# specialized DMA glue
ledma0	at sbus0					# sun4m on-board
le0	at ledma0					#
ledma*	at sbus0					# Anteres sbus
le*	at ledma?					#

# Additional SBus LANCE devices - glued on by lebuffer
lebuffer0	at sbus0				# sun4m SBus
lebuffer*	at sbus?				# sun4m SBus
le0	at lebuffer0					#
le*	at lebuffer?					#

# sun4/300 and sun4c Ethernet - an AMD 7990 LANCE
le0	at sbus0					# sun4c/sun4e on-board
le*	at sbus?

le0	at obio0 addr 0xf9000000 level 6		# sun4/300

# sun4/100 and sun4/200 Ethernet - an Intel 82586 on-board
# or on a Multibus/VME card.
ie0	at obio0 addr 0xf6000000 level 6		# sun4/100 and sun4/200

ie1	at vmes0 addr 0xffe88000 level 5 vect 0x75
ie2	at vmes0 addr 0xff31ff02 level 5 vect 0x76
ie3	at vmes0 addr 0xff35ff02 level 5 vect 0x77
ie4	at vmes0 addr 0xff2dff02 level 5 vect 0x7c

# HappyMeal ethernet (will not work on sun4c)
hme*	at sbus?

# Quad-ethernet glue device, and sub-devices
qec*	at sbus?
qe*	at qec?
be*	at qec?

# Gigabit ethernet
gem*	at sbus?
ti*	at sbus?

# Xylogics 753 or 7053 VME SMD disk controllers and disks, found
# on sun4 systems.
xdc0	at vmel0 addr 0xffffee80 level 3 vect 0x44
xdc1	at vmel0 addr 0xffffee90 level 3 vect 0x45
xdc2	at vmel0 addr 0xffffeea0 level 3 vect 0x46
xdc3	at vmel0 addr 0xffffeeb0 level 3 vect 0x47
xd*	at xdc?

# Xylogics 451 or 451 VME SMD disk controllers and disks, found
# on sun4 systems.
xyc0	at vmes0 addr 0xffffee40 level 3 vect 0x48
xyc1	at vmes0 addr 0xffffee48 level 3 vect 0x49
xy*	at xyc?

# NCR5380-based "Sun SCSI 3" VME SCSI controller.
# This driver has several flags which may be enabled by OR'ing
# the values and using the "flags" directive.
# Valid flags are:
#
#	0x01		Use DMA (may be polled)
#	0x02		Use DMA completion interrupts
#	0x04		Allow disconnect/reselect
#
# E.g. the following would enable DMA, interrupts, and reselect:
# si0	at vmes0 addr 0xff200000 level 3 vect 0x40 flags 0x07
#
si0	at vmes0 addr 0xff200000 level 3 vect 0x40 flags 0x01

# NCR5380-based "SCSI Weird" on-board SCSI interface found
# on sun4/100 systems.  The flags are the same as the "si"
# controller.  Note, while DMA is enabled by default, only
# polled DMA works at this time, and reselects do not work
# on this particular controller.
sw0	at obio0 addr 0xfa000000 level 3 flags 0x01

# Sun "bwtwo" black and white framebuffer, found on sun4, sun4c, and sun4m
# systems.
bwtwo0	at sbus0				# sun4c on-board
bwtwo*	at sbus?				# sun4c and sun4m
bwtwo0	at obio0 addr 0xfd000000 level 4	# sun4/200
bwtwo0	at obio0 addr 0xfb300000 level 4	# sun4/100 and sun4/300 P4
wsdisplay* at bwtwo?

# Sun "cgtwo" VME color framebuffer.
cgtwo0	at vmes0 addr 0xff400000 level 4 vect 0xa8
wsdisplay* at cgtwo?

# Sun "cgthree" SBus color framebuffer.
cgthree* at sbus?
wsdisplay* at cgthree?

# Sun "cgfour" color framebuffer.
cgfour0	at obio0 addr 0xfb300000 level 4	# sun4/100 and sun4/300 P4
wsdisplay* at cgfour?

# Sun "cgsix" accelerated color framebuffer.
cgsix0	at sbus?
cgsix*	at sbus?
cgsix0	at obio0 addr 0xfb000000 level 4	# sun4/100 and sun4/300 P4
wsdisplay* at cgsix?

# Sun "cgeight" 24-bit framebuffer.
cgeight0 at obio0 addr 0xfb300000 level 4	# sun4/100 and sun4/300 P4
wsdisplay* at cgeight?

# Sun "tcx" accelerated color framebuffer.
tcx*	at sbus?
wsdisplay* at tcx?

# Sun "cgfourteen" accelerated 24-bit framebuffer.
cgfourteen0 at obio0 addr 0x9c000000		# sun4m
cgfourteen1 at obio0 addr 0x90000000		# sun4m
wsdisplay* at cgfourteen?

# Sun "cgtwelve" (GS) accelerated 24-bit framebuffer.
cgtwelve*	at sbus?
wsdisplay* at cgtwelve?

# Sun "leo" (ZX) accelerated 24-bit framebuffer.
zx*	at sbus?
wsdisplay* at zx?

# Vigra VS10 or VS12 framebuffer.
vigra*	at sbus?
wsdisplay* at vigra?

# Weitek P9000 found on Tadpole SPARCbook 3, with external ``Chameleon'' RAMDAC
pninek0	at sbus?
btcham0	at obio?
wsdisplay* at pninek?

# Weitek P9100 found on Tadpole SPARCbook 3GS/3GX/3TX/3XP
pnozz0	at sbus?
wsdisplay* at pnozz?

# Parallax XVideo and PowerVideo
tvtwo* at sbus?
wsdisplay* at tvtwo?

# Fujitsu AG-10e framebuffer.
agten* at sbus?
wsdisplay* at agten?

# Southland Media Systems MGX/MGXPlus framebuffer.
mgx* at sbus?
wsdisplay* at mgx?

# Vitec/Connectware/AP&D RasterFlex framebuffer series.
rfx* at sbus?
wsdisplay* at rfx?

# Microcontroller found on Tadpole SPARCbook
tctrl0	at obio0

# Sun PCMCIA bridge
stp*	at sbus?
pcmcia*	at stp?

# PCMCIA controller found on Tadpole SPARCbook
tslot*	at sbus?
pcmcia*	at tslot?

# PCMCIA devices
wi*	at pcmcia?		# WaveLAN IEEE 802.11DS
#an*	at pcmcia?		# Aironet IEEE 802.11DS
ne*	at pcmcia?		# NE2000-compat ethernet
ep*	at pcmcia?		# PCMCIA based 3C5xx ethernet
#com*	at pcmcia?		# PCMCIA modems/serial ports

# Media Independent Interface (mii) drivers (required by hme, ne, ep)
bmtphy*	at mii?			# Broadcom 10/100 PHYs
gentbi*	at mii?			# Generic 1000BASE-X ten-bit PHY
lxtphy*	at mii?			# Level1 LXT970 PHYs
nsphy*	at mii?			# NS and compatible PHYs
nsphyter* at mii?
qsphy*	at mii?			# Quality Semi QS6612 PHYs
luphy*	at mii?			# Lucent LU6612 PHY
tqphy* at mii?			# TDK 78Q212x PHYs
ukphy*	at mii?

# SCSI bus layer.  SCSI devices attach to the SCSI bus, which attaches
# to the underlying hardware controller.

# These entries find devices on all SCSI busses and assign
# unit numers dynamically.
scsibus* at scsi?
sd*	at scsibus?		# SCSI disks
st*	at scsibus?		# SCSI tapes
cd*	at scsibus?		# SCSI CD-ROMs
ch*	at scsibus?		# SCSI changer devices
safte*	at scsibus?		# SCSI accessed fault-tolerant enclosures
ses*	at scsibus?		# SCSI enclosure services
uk*	at scsibus?		# unknown SCSI devices

# Floppy controller and drive found on SPARCstations.
fdc0	at mainbus0				# sun4c controller
fdc0	at obio0				# sun4m controller
fd*	at fdc0					# the drive itself

# flash memory, sysconfig regs, and VME for Force boards
#scf0	at mainbus0				# FORCE CPU-5V sysconfig
#flash0	at obio0				# FORCE CPU-5V flash-memory
#fga0	at iommu0				# FORCE CPU-5V VME/SBus bridge
#fvme*	at fga0					# FORCE CPU-5V
#daadio*	at fvme? addr 0x0 level 1 vect 0x1f	# Matrix MD-DAADIO board

# Prestoserve NVRAM
#presto*	at sbus?		# SBus board
#presto*	at mainbus?		# SS10/SS20 NVSIMM

pseudo-device	hotplug		1	# devices hot plugging
pseudo-device	wsmux		2	# mouse & keyboard multiplexor

path: sys/arch/sparc/conf/GENERIC


code:
#	$OpenBSD: Makefile.sparc,v 1.84 2015/01/13 01:12:50 deraadt Exp $

# For instructions on building kernels consult the config(8) and options(4)
# manual pages.
#
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
# DEBUG is set to -g by config if debugging is requested (config -g).
# PROF is set to -pg by config if profiling is requested (config -p).

.include <bsd.own.mk>

SIZE?=	size
STRIP?=	strip

# source tree is located via $S relative to the compilation directory
.ifndef S
S!=	cd ../../../..; pwd
.endif

_machdir?=	$S/arch/${_mach}
_archdir?=	$S/arch/${_arch}

INCLUDES=	-nostdinc -I$S -I. -I$S/arch
CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -MD -MP
CWARNFLAGS=	-Werror -Wall -Wimplicit-function-declaration \
		-Wno-main -Wno-uninitialized \
		-Wframe-larger-than=2047

CMACHFLAGS=	-mno-fpu
.if ${IDENT:M-DSUN*} == ${IDENT:M-DSUN4M}
CMACHFLAGS+=	-mcpu=supersparc
.endif
CMACHFLAGS+=	-fno-builtin-printf -fno-builtin-snprintf \
		-fno-builtin-vsnprintf -fno-builtin-log \
		-fno-builtin-log2 -fno-builtin-malloc ${NOPIE_FLAGS}
.if ${IDENT:M-DNO_PROPOLICE}
CMACHFLAGS+=	-fno-stack-protector
.endif

COPTS?=		-O2
CFLAGS=		${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE}
AFLAGS=		-D_LOCORE -x assembler-with-cpp ${CWARNFLAGS} ${CMACHFLAGS}
LDSCRIPT=	${_machdir}/conf/ld.script
LINKFLAGS=	-N -e start -T ${LDSCRIPT} --warn-common -nopie

.if ${IDENT:M-DDDB_STRUCT}
DB_STRUCTINFO=	db_structinfo.h
.else
DB_STRUCTINFO=
.endif

HOSTCC?=	${CC}
HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
HOSTED_CFLAGS=	${CFLAGS}
HOSTED_C=	${HOSTCC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<

NORMAL_C_NOP=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<

%OBJS

%CFILES

%SFILES

# load lines for config "xxx" will be emitted as:
# xxx: ${SYSTEM_DEP} swapxxx.o
#	${SYSTEM_LD_HEAD}
#	${SYSTEM_LD} swapxxx.o
#	${SYSTEM_LD_TAIL}
SYSTEM_HEAD=	locore.o param.o ioconf.o
SYSTEM_OBJ=	${SYSTEM_HEAD} ${OBJS}
SYSTEM_DEP=	Makefile ${SYSTEM_OBJ} ${LDSCRIPT}
SYSTEM_LD_HEAD=	@rm -f $@
SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_HEAD} vers.o $${OBJS}'; \
		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_HEAD} vers.o ${OBJS}
SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@

DEBUG?=
.if ${DEBUG} == "-g"
LINKFLAGS+=	-X
STRIPFLAGS=	-g -x
SYSTEM_LD_TAIL+=; \
		echo mv $@ $@.gdb; rm -f $@.gdb; mv $@ $@.gdb; \
		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
.else
LINKFLAGS+=	-S -x
.endif

%LOAD

# cc's -MD puts the source and output paths in the dependency file;
# since those are temp files here we need to fix it up.  It also
# puts the file in /tmp, so we use -MF to put it in the current
# directory as assym.P and then generate assym.d from it with a
# good target name
assym.h: $S/kern/genassym.sh Makefile \
	 ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf
	cat ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf | \
	    sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} -MF assym.P > assym.h.tmp
	sed '1s/.*/assym.h: \\/' assym.P > assym.d
	sort -u assym.h.tmp > assym.h

param.c: $S/conf/param.c
	rm -f param.c
	cp $S/conf/param.c .

param.o: param.c Makefile
	${NORMAL_C}

mcount.o: $S/lib/libkern/mcount.c Makefile
	${NORMAL_C_NOP}

ioconf.o: ioconf.c
	${NORMAL_C}

vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
	sh $S/conf/newvers.sh
	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c

clean::
	rm -f eddep *bsd *bsd.gdb tags *.[dio] [a-z]*.s \
	    [Ee]rrs linterrs assym.h ${DB_STRUCTINFO}

lint:
	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
	    ${CFILES} ioconf.c param.c | \
	    grep -v 'static function .* unused'

depend:
	@touch $@

tags:
	@echo "see $S/kern/Makefile for tags"

db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.pl
	${CC} ${CFLAGS} ${CPPFLAGS} -MT $@ -gstabs -c $S/ddb/db_structinfo.c
	objdump -g db_structinfo.o | perl $S/ddb/parse_structinfo.pl > $@
	rm -f db_structinfo.o

locore.o: ${_machdir}/${_mach}/locore.s assym.h
bsd_fdintr.o amd7930intr.o: assym.h

# The install target can be redefined by putting a
# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
MACHINE_NAME!=  uname -n
install: install-kernel-${MACHINE_NAME}
.if !target(install-kernel-${MACHINE_NAME}})
install-kernel-${MACHINE_NAME}:
	cmp -s bsd /bsd || ln -f /bsd /obsd
	cp bsd /nbsd
	mv /nbsd /bsd
.endif

# pull in the dependency information
.if !empty(DB_STRUCTINFO) && !exists(${DB_STRUCTINFO})
 ${SYSTEM_OBJ}: ${DB_STRUCTINFO}
.endif
.ifnmake clean
. for o in ${SYSTEM_OBJ} assym.h ${DB_STRUCTINFO}
.  if exists(${o:R}.d)
.   include "${o:R}.d"
.  elif exists($o)
    .PHONY: $o
.  endif
. endfor
.endif

%RULES

license: unknown


code:
#	$OpenBSD: RAMDISK,v 1.80 2015/07/17 22:52:29 tedu Exp $

machine		sparc
maxusers	4

option		TIMEZONE=0
option		DST=0
option		SMALL_KERNEL
option		NO_PROPOLICE
option		BOOT_CONFIG

option		RAMDISK_HOOKS		# 16384+size(bsd) < RELOC(boot,bootxx)
option		MINIROOTSIZE=4000

option		FFS
option		CD9660
option		INET6
option		NFSCLIENT

option		WSEMUL_SUN	# provide sun terminal emulation; required
option		WSEMUL_NO_VT100	# do not provide vt100 terminal emulation

option		SUN4		# sun4/100, sun4/200, sun4/300
option		SUN4C		# sun4c - SS1, 1+, 2, ELC, SLC, IPC, IPX, etc.
option		SUN4E		# sun4e - SPARCengine 1E
option		SUN4M		# sun4m - SS10, SS20, Classic, etc.

config		bsd root on rd0a

mainbus0	at root
cpu0		at mainbus0

sbus0		at mainbus0			# sun4c and sun4e
obio0		at mainbus0			# sun4 and sun4m
vmes0		at mainbus0			# sun4
vmel0		at mainbus0			# sun4
iommu0		at mainbus0			# sun4m
sbus0		at iommu0			# sun4m

auxreg*		at mainbus0			# sun4c and sun4e
auxreg*		at obio0			# sun4m
power0		at obio0			# sun4m

# Mostek clock found on 4/300, sun4c, and sun4m systems.
# The Mostek clock NVRAM is the "eeprom" on sun4/300 systems.
clock0		at mainbus0			# sun4c and sun4e
clock0		at obio0			# sun4m
clock0		at obio0 addr 0xf2000000	# sun4/300
oclock0		at obio0 addr 0xf3000000	# sun4/100 and sun4/200

memreg0		at mainbus0			# sun4c and sun4e
memreg0		at obio0			# sun4m
memreg0		at obio0 addr 0xf4000000	# sun4

eccmemctl0 at mainbus0				# sun4m

timer0		at mainbus0			# sun4c and sun4e
timer0		at obio0			# sun4m
timer0		at obio0 addr 0xef000000	# sun4/300

eeprom0		at obio0 addr 0xf2000000	# sun4/100 and sun4/200

# Zilog 8530 serial chips.  Each has two-channels.
# zs0 is ttya and ttyb.  zs1 is the keyboard and mouse.
zs0		at mainbus0			# sun4c and sun4e
zs0		at obio0			# sun4m
zs0		at obio0 addr 0xf1000000 level 12 # sun4
zs1		at mainbus0			# sun4c and sun4e
zs1		at obio0			# sun4m
zs1		at obio0 addr 0xf0000000 level 12 # sun4
zs2		at obio0 addr 0xe0000000 level 12 # sun4/300

zstty*		at zs?
zskbd*		at zs?
wskbd*		at zskbd?

xbox*		at sbus?			# SBus Expansion box
sbus*		at xbox?

# The flags on the esp entries below work around deficiencies in the driver:
#	bits 0-7:  disable disconnect/reselect for the corresponding target
#	bits 8-15: disable synch negotiation for target [bit-8]
#	Note: targets 4-7 have disconnect/reselect enabled on the premise
#	      that tape devices normally have one of these targets. Tape
#	      devices should be allowed to disconnect for the SCSI bus
#	      to operate acceptably.

# sun4/300 SCSI - an NCR53c94 or equivalent behind
# an LSI Logic DMA controller
dma0		at obio0 addr 0xfa001000 level 4 # sun4/300
esp0		at obio0 addr 0xfa000000 level 4 flags 0x00ff000f

# sun4c or sun4m SCSI - an NCR53c94 or equivalent behind
# specialized DMA glue
dma0		at sbus0			# on-board SCSI
esp0		at sbus0 flags 0x00ff000f	# sun4c and sun4e
esp0		at dma0 flags 0x00ff000f	# sun4m

# FSBE/S SCSI - an NCR53c94 or equivalent behind
dma*		at sbus?			# SBus SCSI
esp*		at sbus? flags 0x00ff000f	# two flavours
esp*		at dma? flags 0x00ff000f	# depending on model

ledma0		at sbus?			# sun4m on-board
le0		at ledma0
ledma*		at sbus?			# Anteres sbus
le*		at ledma?

lebuffer0	at sbus0			# sun4m SBus
lebuffer*	at sbus?			# sun4m SBus
le0		at lebuffer0
le*		at lebuffer?

# sun4/300 and sun4c Ethernet - an AMD 7990 LANCE
le0		at sbus0			# sun4c/sun4e on-board
le*		at sbus?
le0		at obio0 addr 0xf9000000 level 6 # sun4/300

# sun4/100 and sun4/200 Ethernet - an Intel 82586 on-board
# or on a Multibus/VME card.
ie0		at obio0 addr 0xf6000000 level 6 # sun4/100 and sun4/200
ie1		at vmes0 addr 0xffe88000 level 5 vect 0x75
ie2		at vmes0 addr 0xff31ff02 level 5 vect 0x76
ie3		at vmes0 addr 0xff35ff02 level 5 vect 0x77
ie4		at vmes0 addr 0xff2dff02 level 5 vect 0x7c

hme*		at sbus?
qec*		at sbus?
qe*		at qec?
be*		at qec?
gem*		at sbus?

gentbi*		at mii?				# Generic 1000BASE-X ten-bit PHY
nsphy*		at mii?				# NS and compatible PHYs
qsphy*		at mii?				# Quality Semi QS6612 PHYs
luphy*		at mii?				# Lucent LU6612 PHY
ukphy*		at mii?

# Xylogics 753 or 7053 VME SMD disk controllers and disks, found
# on sun4 systems.
xdc0		at vmel0 addr 0xffffee80 level 3 vect 0x44
xdc1		at vmel0 addr 0xffffee90 level 3 vect 0x45
xdc2		at vmel0 addr 0xffffeea0 level 3 vect 0x46
xdc3		at vmel0 addr 0xffffeeb0 level 3 vect 0x47
xd*		at xdc?

# Xylogics 451 or 451 VME SMD disk controllers and disks, found
# on sun4 systems.
xyc0		at vmes0 addr 0xffffee40 level 3 vect 0x48
xyc1		at vmes0 addr 0xffffee48 level 3 vect 0x49
xy*		at xyc?

# NCR5380-based "Sun SCSI 3" VME SCSI controller.
# This driver has several flags which may be enabled by OR'ing
# the values and using the "flags" directive.  Valid flags are:
#	0x01		Use DMA (may be polled)
#	0x02		Use DMA completion interrupts
#	0x04		Allow disconnect/reselect
si0		at vmes0 addr 0xff200000 level 3 vect 0x40 flags 0x01

# NCR5380-based "SCSI Weird" on-board SCSI interface found
# on sun4/100 systems.  The flags are the same as the "si"
# controller.  Note, while DMA is enabled by default, only
# polled DMA works at this time, and reselects do not work
# on this particular controller.
sw0		at obio0 addr 0xfa000000 level 3 flags 0x01

bwtwo0		at sbus0			# sun4c on-board
bwtwo*		at sbus?			# sun4c and sun4m
bwtwo0		at obio0 addr 0xfd000000 level 4 # sun4/200
bwtwo0		at obio0 addr 0xfb300000 level 4 # sun4/100 and sun4/300 P4
wsdisplay*	at bwtwo?
cgtwo0		at vmes0 addr 0xff400000 level 4 vect 0xa8
wsdisplay*	at cgtwo?
cgthree*	at sbus?
wsdisplay*	at cgthree?
cgfour0		at obio0 addr 0xfb300000 level 4 # sun4/100 and sun4/300 P4
wsdisplay*	at cgfour?
cgsix0		at sbus?
cgsix*		at sbus?
cgsix0		at obio0 addr 0xfb000000 level 4 # sun4/100 and sun4/300 P4
wsdisplay*	at cgsix?
cgeight0	at obio0 addr 0xfb300000 level 4 # sun4/100 and sun4/300 P4
wsdisplay*	at cgeight?
tcx*		at sbus?
wsdisplay*	at tcx?
cgfourteen0	at obio0 addr 0x9c000000 flags 0x0001	# sun4m
cgfourteen1	at obio0 addr 0x90000000 flags 0x0001	# sun4m
wsdisplay*	at cgfourteen?
cgtwelve*	at sbus?
wsdisplay*	at cgtwelve?
zx*		at sbus?
wsdisplay*	at zx?
vigra*		at sbus?
wsdisplay*	at vigra?
pninek0		at sbus?
btcham0		at obio?
wsdisplay*	at pninek?
pnozz0		at sbus?
wsdisplay*	at pnozz?
tvtwo*		at sbus?
wsdisplay*	at tvtwo?
agten*		at sbus?
wsdisplay*	at agten?
mgx*		at sbus?
wsdisplay*	at mgx?
rfx*		at sbus?
wsdisplay*	at rfx?

scsibus*	at scsi?
sd*		at scsibus?
#st*		at scsibus?
cd*		at scsibus?

fdc0		at mainbus0			# sun4c controller
fdc0		at obio0			# sun4m controller
fd*		at fdc0

pseudo-device	rd 1
pseudo-device	loop 1
pseudo-device	bpfilter 1
pseudo-device	vlan

path: sys/arch/sparc/conf/RAMDISK


code:
#	$OpenBSD: SUN4,v 1.42 2011/11/08 12:53:58 deraadt Exp $
#	$NetBSD: GENERIC,v 1.28.2.1 1996/07/02 23:55:22 jtc Exp $

# Machine architecture; required by config(8)
machine		sparc

include "../../../conf/GENERIC"

option		SUN4		# sun4/100, sun4/200, sun4/300

#option		MMU_3L		# 3-level MMU on sun4/400

# Options for SPARCstation hardware
option		WSEMUL_SUN	# provide sun terminal emulation; required
option		WSEMUL_NO_VT100	# do not provide vt100 terminal emulation
option		WSDISPLAY_COMPAT_RAWKBD # provide raw scancodes; needed for X11

maxusers	16		# estimated number of users

# Generic swap; second partition of root disk or network.
config		bsd	swap generic

# Main bus and CPU .. all systems.
mainbus0 at root
cpu0	at mainbus0

# Bus types found on SPARC systems.
obio0	at mainbus0				# sun4 and sun4m
vmes0	at mainbus0				# sun4
vmel0	at mainbus0				# sun4

# Mostek clock found on 4/300, sun4c, and sun4m systems.
# The Mostek clock NVRAM is the "eeprom" on sun4/300 systems.
clock0	at obio0 addr 0xf2000000		# sun4/300

# Intersil clock found on 4/100 and 4/200 systems.
oclock0	at obio0 addr 0xf3000000		# sun4/100 and sun4/200

# Memory error registers.
memreg0	at obio0 addr 0xf4000000		# sun4

# Timer chip found on 4/300, sun4c, and sun4m systems.
timer0	at obio0 addr 0xef000000		# sun4/300

# EEPROM found on 4/100 and 4/200 systems.  Note that the 4/300
# doesn't use this driver; the `EEPROM' is in the NVRAM on the
# Mostek clock chip on 4/300 systems.
eeprom0	at obio0 addr 0xf2000000		# sun4/100 and sun4/200

# 8 segment led display on sun4 systems
led0 at mainbus0				# sun4

# Zilog 8530 serial chips.  Each has two-channels.
# zs0 is ttya and ttyb.  zs1 is the keyboard and mouse.
zs0	at obio0 addr 0xf1000000 level 12		# sun4
zs1	at obio0 addr 0xf0000000 level 12		# sun4
zs2	at obio0 addr 0xe0000000 level 12		# sun4/300

zstty* at zs?
zskbd* at zs?
wskbd* at zskbd?
zsms*  at zs?
wsmouse* at zsms?

#
# Note the flags on the esp entries below, that work around
# deficiencies in the current driver:
#	bits 0-7:  disable disconnect/reselect for the corresponding target
#	bits 8-15: disable synch negotiation for target [bit-8]
#	Note: targets 4-7 have disconnect/reselect enabled on the premise
#	      that tape devices normally have one of these targets. Tape
#	      devices should be allowed to disconnect for the SCSI bus
#	      to operate acceptably.
#

# sun4/300 SCSI - an NCR53c94 or equivalent behind
# an LSI Logic DMA controller
dma0	at obio0 addr 0xfa001000 level 4		# sun4/300
esp0	at obio0 addr 0xfa000000 level 4 flags 0x00ff000f

# sun4/300 and sun4c Ethernet - an AMD 7990 LANCE
le0	at obio0 addr 0xf9000000 level 6		# sun4/300

# sun4/100 and sun4/200 Ethernet - an Intel 82586 on-board
# or on a Multibus/VME card.
ie0	at obio0 addr 0xf6000000 level 6		# sun4/100 and sun4/200

ie1	at vmes0 addr 0xffe88000 level 5 vect 0x75
ie2	at vmes0 addr 0xff31ff02 level 5 vect 0x76
ie3	at vmes0 addr 0xff35ff02 level 5 vect 0x77
ie4	at vmes0 addr 0xff2dff02 level 5 vect 0x7c

# Xylogics 753 or 7053 VME SMD disk controllers and disks, found
# on sun4 systems.
xdc0	at vmel0 addr 0xffffee80 level 3 vect 0x44
xdc1	at vmel0 addr 0xffffee90 level 3 vect 0x45
xdc2	at vmel0 addr 0xffffeea0 level 3 vect 0x46
xdc3	at vmel0 addr 0xffffeeb0 level 3 vect 0x47
xd*	at xdc?

# Xylogics 451 or 451 VME SMD disk controllers and disks, found
# on sun4 systems.
xyc0	at vmes0 addr 0xffffee40 level 3 vect 0x48
xyc1	at vmes0 addr 0xffffee48 level 3 vect 0x49
xy*	at xyc?

# NCR5380-based "Sun SCSI 3" VME SCSI controller.
# This driver has several flags which may be enabled by OR'ing
# the values and using the "flags" directive.
# Valid flags are:
#
#	0x01		Use DMA (may be polled)
#	0x02		Use DMA completion interrupts
#	0x04		Allow disconnect/reselect
#
# E.g. the following would enable DMA, interrupts, and reselect:
# si0	at vmes0 addr 0xff200000 level 3 vect 0x40 flags 0x07
#
si0	at vmes0 addr 0xff200000 level 3 vect 0x40 flags 0x01

# NCR5380-based "SCSI Weird" on-board SCSI interface found
# on sun4/100 systems.  The flags are the same as the "si"
# controller.  Note, while DMA is enabled by default, only
# polled DMA works at this time, and reselects do not work
# on this particular controller.
sw0	at obio0 addr 0xfa000000 level 3 flags 0x01

# Sun "bwtwo" black and white framebuffer, found on sun4, sun4c, and sun4m
# systems.
bwtwo0	at obio0 addr 0xfd000000 level 4	# sun4/200
bwtwo0	at obio0 addr 0xfb300000 level 4	# sun4/100 and sun4/300 P4
wsdisplay* at bwtwo?

# Sun "cgtwo" VME color framebuffer.
cgtwo0	at vmes0 addr 0xff400000 level 4 vect 0xa8
wsdisplay* at cgtwo?

# Sun "cgfour" color framebuffer.
cgfour0	at obio0 addr 0xfb300000 level 4	# sun4/100 and sun4/300 P4
wsdisplay* at cgfour?

# Sun "cgsix" accelerated color framebuffer.
cgsix0	at obio0 addr 0xfb000000 level 4	# sun4/100 and sun4/300 P4
wsdisplay* at cgsix?

# Sun "cgeight" 24-bit framebuffer.
cgeight0 at obio0 addr 0xfb300000 level 4	# sun4/100 and sun4/300 P4
wsdisplay* at cgeight?

# SCSI bus layer.  SCSI devices attach to the SCSI bus, which attaches
# to the underlying hardware controller.

# These entries find devices on all SCSI busses and assign
# unit numers dynamically.
scsibus* at scsi?
sd*	at scsibus?		# SCSI disks
st*	at scsibus?		# SCSI tapes
cd*	at scsibus?		# SCSI CD-ROMs
ch*	at scsibus?		# SCSI changer devices
uk*	at scsibus?		# unknown SCSI devices

pseudo-device	wsmux	2	# mouse & keyboard multiplexor


code:
#	$OpenBSD: SUN4C,v 1.70 2015/03/30 20:32:59 miod Exp $
#	$NetBSD: GENERIC,v 1.48 1997/08/23 19:19:01 mjacob Exp $

# Machine architecture; required by config(8)
machine		sparc

include "../../../conf/GENERIC"

option		SUN4C		# sun4c - SS1, 1+, 2, ELC, SLC, IPC, IPX, etc.

#option		KGDB		# support for kernel gdb
#option		KGDBDEV=0xc01	# kgdb device number (dev_t)
#option		KGDBRATE=38400	# baud rate

# Options for SPARCstation hardware
option		WSEMUL_SUN	# provide sun terminal emulation; required
option		WSEMUL_NO_VT100	# do not provide vt100 terminal emulation
option		WSDISPLAY_COMPAT_RAWKBD # provide raw scancodes; needed for X11

maxusers	18		# estimated number of users

# Generic swap; second partition of root disk or network.
config		bsd	swap generic

# Main bus and CPU .. all systems.
mainbus0 at root
cpu0	at mainbus0

# Bus types found on SPARC systems.
sbus0	at mainbus0				# sun4c

audioamd0 at mainbus0				# sun4c
audio*	at audioamd?

auxreg*	at mainbus0				# sun4c

# Mostek clock found on 4/300, sun4c, and sun4m systems.
# The Mostek clock NVRAM is the "eeprom" on sun4/300 systems.
clock0	at mainbus0				# sun4c

# Memory error registers.
memreg0	at mainbus0				# sun4c

# Timer chip found on 4/300, sun4c, and sun4m systems.
timer0	at mainbus0				# sun4c

# Zilog 8530 serial chips.  Each has two-channels.
# zs0 is ttya and ttyb.  zs1 is the keyboard and mouse.
zs0	at mainbus0					# sun4c
zs1	at mainbus0					# sun4c

zstty* at zs?
zskbd* at zs?
wskbd* at zskbd?
zsms*  at zs?
wsmouse* at zsms?

# Magma serial/parallel port devices
magma*	at sbus?					# magma serial cards
mtty*	at magma?
mbpp*	at magma?

# SUNW,spif serial/parallel port devices
spif*	at sbus?					# spif serial cards
stty*	at spif?
sbpp*	at spif?

bpp*	at sbus?					# parallel port

# SUNW,xbox SBus Expansion Subsystem
xbox*	at sbus?					# SBus Expansion box
sbus*	at xbox?

#
# Note the flags on the esp entries below, that work around
# deficiencies in the current driver:
#	bits 0-7:  disable disconnect/reselect for the corresponding target
#	bits 8-15: disable synch negotiation for target [bit-8]
#	Note: targets 4-7 have disconnect/reselect enabled on the premise
#	      that tape devices normally have one of these targets. Tape
#	      devices should be allowed to disconnect for the SCSI bus
#	      to operate acceptably.
#

# sun4c or sun4m SCSI - an NCR53c94 or equivalent behind
# specialized DMA glue
dma0	at sbus0					# on-board SCSI
esp0	at sbus0 flags 0x00ff000f			# sun4c

# FSBE/S SCSI - an NCR53c94 or equivalent behind
dma*	at sbus?					# SBus SCSI
esp*	at sbus? flags 0x00ff000f			# two flavours
esp*	at dma? flags 0x00ff000f			# depending on model

#sun4c, sun4m
qlw*	at sbus?
#qla*	at sbus?

# sun4/300 and sun4c Ethernet - an AMD 7990 LANCE
le0	at sbus0					# sun4c on-board
le*	at sbus?

# Additional SBus LANCE devices - glued on by lebuffer
lebuffer0	at sbus0				# sun4m SBus
lebuffer*	at sbus?				# sun4m SBus
le0	at lebuffer0					#
le*	at lebuffer?					#

# Quad-ethernet glue device, and sub-devices
qec*	at sbus?
qe*	at qec?
be*	at qec?

# Sun "bwtwo" black and white framebuffer, found on sun4, sun4c, and sun4m
# systems.
bwtwo0	at sbus0					# sun4c on-board
bwtwo*	at sbus?					# sun4c and sun4m
wsdisplay* at bwtwo?

# Sun "cgthree" SBus color framebuffer.
cgthree* at sbus?
wsdisplay* at cgthree?

# Sun "cgsix" accelerated color framebuffer.
cgsix0	at sbus?
cgsix*	at sbus?
wsdisplay* at cgsix?

# Sun "cgtwelve" (GS) accelerated 24-bit framebuffer.
cgtwelve*	at sbus?
wsdisplay* at cgtwelve?

# Vigra VS10 or VS12 framebuffer.
vigra*	at sbus?
wsdisplay* at vigra?

# Parallax XVideo and PowerVideo
tvtwo* at sbus?
wsdisplay* at tvtwo?

# Fujitsu AG-10e framebuffer.
agten* at sbus?
wsdisplay* at agten?

# Southland Media Systems MGX/MGXPlus framebuffer.
mgx* at sbus?
wsdisplay* at mgx?

# Vitec/Connectware/AP&D RasterFlex framebuffer series.
rfx* at sbus?
wsdisplay* at rfx?

# Sun PCMCIA bridge
stp*	at sbus?
pcmcia*	at stp?

# PCMCIA devices
wi*	at pcmcia?		# WaveLAN IEEE 802.11DS
#an*	at pcmcia?		# Aironet IEEE 802.11DS
ne*	at pcmcia?		# NE2000-compat ethernet
ep*	at pcmcia?		# PCMCIA based 3C5xx ethernet
#com*	at pcmcia?		# PCMCIA modems/serial ports

# Media Independent Interface (mii) drivers (required by ne and ep)
bmtphy*	at mii?			# Broadcom 10/100 PHYs
lxtphy*	at mii?			# Level1 LXT970 PHYs
nsphy* at mii?			# NS and compatible PHYs
nsphyter* at mii?
tqphy* at mii?			# TDK 78Q212x PHYs
ukphy*	at mii?

# SCSI bus layer.  SCSI devices attach to the SCSI bus, which attaches
# to the underlying hardware controller.

# These entries find devices on all SCSI busses and assign
# unit numers dynamically.
scsibus* at scsi?
sd*	at scsibus?		# SCSI disks
st*	at scsibus?		# SCSI tapes
cd*	at scsibus?		# SCSI CD-ROMs
ch*	at scsibus?		# SCSI changer devices
uk*	at scsibus?		# unknown SCSI devices

# Floppy controller and drive found on SPARCstations.
fdc0	at mainbus0				# sun4c controller
fd*	at fdc0					# the drive itself

pseudo-device	wsmux	2	# mouse & keyboard multiplexor


code:
#	$OpenBSD: SUN4M,v 1.85 2015/03/30 20:32:59 miod Exp $
#	$NetBSD: GENERIC,v 1.28.2.1 1996/07/02 23:55:22 jtc Exp $

# Machine architecture; required by config(8)
machine		sparc

include "../../../conf/GENERIC"

# This is a 4m specific kernel.
# NOTE: Cypress mbus cpus are not pure 4m, and require
#       both SUN4C and SUN4M to be specified as well
option		SUN4M		# sun4m - SS10, SS20, Classic, etc.

#option		KGDB		# support for kernel gdb
#option		KGDBDEV=0xc01	# kgdb device number (dev_t)
#option		KGDBRATE=38400	# baud rate

# Options for SPARCstation hardware
option		WSEMUL_SUN	# provide sun terminal emulation; required
option		WSEMUL_NO_VT100	# do not provide vt100 terminal emulation
option		WSDISPLAY_COMPAT_RAWKBD # provide raw scancodes; needed for X11

maxusers	32		# estimated number of users

# Generic swap; second partition of root disk or network.
config		bsd	swap generic

# Main bus and CPU .. all systems.
mainbus0 at root
cpu0	at mainbus0

# Bus types found on SPARC systems.
obio0	at mainbus0				# sun4 and sun4m
iommu0	at mainbus0				# sun4m
sbus0	at iommu0				# sun4m

audioamd0 at obio0				# sun4m
audioamd0 at sbus0				# sun4m
audio*	at audioamd?

audiocs0 at sbus0				# sun4m
audio*	at audiocs?

auxreg*	at obio0				# sun4m

# Power status and control register found on Sun4m systems
power0	at obio0

# Mostek clock found on 4/300, sun4c, and sun4m systems.
clock0	at obio0				# sun4m

# Memory error registers.
memreg0	at obio0				# sun4m

# ECC memory control
eccmemctl0 at mainbus0				# sun4m

# Timer chip found on 4/300, sun4c, and sun4m systems.
timer0	at obio0				# sun4m

# 8 segment led display on sun4/sun4m systems
led0	at obio0				# sun4m

# Zilog 8530 serial chips.  Each has two-channels.
# zs0 is ttya and ttyb.  zs1 is the keyboard and mouse.
zs0	at obio0					# sun4m
zs1	at obio0					# sun4m

zstty* at zs?
zskbd* at zs?
wskbd* at zskbd?
zsms*  at zs?
wsmouse* at zsms?

# Magma serial/parallel port devices
magma*	at sbus?					# magma serial cards
mtty*	at magma?
mbpp*	at magma?

# SUNW,spif serial/parallel port devices
spif*	at sbus?					# spif serial cards
stty*	at spif?
sbpp*	at spif?

bpp*	at sbus?					# parallel port

# built-in modem on Tadpole SPARCbook
com*	at obio?

# SUNW,xbox SBus Expansion Subsystem
xbox*	at sbus?					# SBus Expansion box
sbus*	at xbox?

#
# Note the flags on the esp entries below, that work around
# deficiencies in the current driver:
#	bits 0-7:  disable disconnect/reselect for the corresponding target
#	bits 8-15: disable synch negotiation for target [bit-8]
#	Note: targets 4-7 have disconnect/reselect enabled on the premise
#	      that tape devices normally have one of these targets. Tape
#	      devices should be allowed to disconnect for the SCSI bus
#	      to operate acceptably.
#

# sun4c or sun4m SCSI - an NCR53c94 or equivalent behind
# specialized DMA glue
dma0	at sbus0					# on-board SCSI
esp0	at dma0 flags 0x00ff000f			# sun4m

# FSBE/S SCSI - an NCR53c94 or equivalent behind
dma*	at sbus?					# SBus SCSI
esp*	at sbus? flags 0x00ff000f			# two flavours
esp*	at dma? flags 0x00ff000f			# depending on model

#sun4c, sun4m
qlw*	at sbus?
#qla*	at sbus?

# sun4m Ethernet - an AMD 7990 LANCE behind
# specialized DMA glue
ledma0	at sbus0					# sun4m on-board
le0	at ledma0					#
ledma*	at sbus0					# Anteres sbus
le*	at ledma?					#

# Additional SBus LANCE devices - glued on by lebuffer
lebuffer0	at sbus0				# sun4m SBus
lebuffer*	at sbus?				# sun4m SBus
le0	at lebuffer0					#
le*	at lebuffer?					#

# Additional SBus LANCE devices - unbuffered
le0	at sbus0
le*	at sbus?

# HappyMeal ethernet
hme*	at sbus?

# Quad-ethernet glue device, and sub-devices
qec*	at sbus?
qe*	at qec?
be*	at qec?

# Gigabit ethernet
gem*	at sbus?

# Sun "bwtwo" black and white framebuffer, found on sun4, sun4c, and sun4m
# systems.
bwtwo*	at sbus?				# sun4c and sun4m
wsdisplay* at bwtwo?

# Sun "cgthree" SBus color framebuffer.
cgthree* at sbus?
wsdisplay* at cgthree?

# Sun "cgsix" accelerated color framebuffer.
cgsix*	at sbus?
wsdisplay* at cgsix?

# Sun "tcx" accelerated color framebuffer.
tcx*	at sbus?
wsdisplay* at tcx?

# Sun "cgfourteen" accelerated 24-bit framebuffer.
cgfourteen0 at obio0 addr 0x9c000000		# sun4m
cgfourteen1 at obio0 addr 0x90000000		# sun4m
wsdisplay* at cgfourteen?

# Sun "cgtwelve" (GS) accelerated 24-bit framebuffer.
cgtwelve*	at sbus?
wsdisplay* at cgtwelve?

# Sun "leo" (ZX) accelerated 24-bit framebuffer.
zx*	at sbus?
wsdisplay* at zx?

# Vigra VS10 or VS12 framebuffer.
vigra*	at sbus?
wsdisplay* at vigra?

# Weitek P9000 found on Tadpole SPARCbook 3, with external ``Chameleon'' RAMDAC
pninek0	at sbus?
btcham0	at obio?
wsdisplay* at pninek?

# Weitek P9100 found on Tadpole SPARCbook 3GS/3GX/3TX/3XP
pnozz0	at sbus?
wsdisplay* at pnozz?

# Parallax XVideo and PowerVideo
tvtwo* at sbus?
wsdisplay* at tvtwo?

# Fujitsu AG-10e framebuffer.
agten* at sbus?
wsdisplay* at agten?

# Southland Media Systems MGX/MGXPlus framebuffer.
mgx* at sbus?
wsdisplay* at mgx?

# Vitec/Connectware/AP&D RasterFlex framebuffer series.
rfx* at sbus?
wsdisplay* at rfx?

# Microcontroller found on Tadpole SPARCbook
tctrl0	at obio0

# Sun PCMCIA bridge
stp*	at sbus?
pcmcia*	at stp?

# PCMCIA controller found on Tadpole SPARCbook
tslot*	at sbus?
pcmcia*	at tslot?

# PCMCIA devices
wi*	at pcmcia?		# WaveLAN IEEE 802.11DS
#an*	at pcmcia?		# Aironet IEEE 802.11DS
ne*	at pcmcia?		# NE2000-compat ethernet
ep*	at pcmcia?		# PCMCIA based 3C5xx ethernet
#com*	at pcmcia?		# PCMCIA modems/serial ports

# Media Independent Interface (mii) drivers (required by hme, ne, ep)
bmtphy*	at mii?			# Broadcom 10/100 PHYs
gentbi*	at mii?			# Generic 1000BASE-X ten-bit PHY
lxtphy*	at mii?			# Level1 LXT970 PHYs
nsphy*	at mii?			# NS and compatible PHYs
nsphyter* at mii?
qsphy*	at mii?			# Quality Semi QS6612 PHYs
luphy*	at mii?			# Lucent LU6612 PHY
tqphy*	at mii?			# TDK 78Q212x PHYs
ukphy*	at mii?

# SCSI bus layer.  SCSI devices attach to the SCSI bus, which attaches
# to the underlying hardware controller.

# These entries find devices on all SCSI busses and assign
# unit numers dynamically.
scsibus* at scsi?
sd*	at scsibus?		# SCSI disks
st*	at scsibus?		# SCSI tapes
cd*	at scsibus?		# SCSI CD-ROMs
ch*	at scsibus?		# SCSI changer devices
uk*	at scsibus?		# unknown SCSI devices

# Floppy controller and drive found on SPARCstations.
fdc0	at obio0		# sun4m controller
fd*	at fdc0			# the drive itself

pseudo-device	wsmux	2	# mouse & keyboard multiplexor


code:
#	$OpenBSD: files.sparc,v 1.102 2015/07/17 22:52:29 tedu Exp $
#	$NetBSD: files.sparc,v 1.44 1997/08/31 21:29:16 pk Exp $

# @(#)files.sparc	8.1 (Berkeley) 7/19/93
# sparc-specific configuration info

# maxpartitions must be first item in files.${ARCH}.newconf
maxpartitions 16

maxusers 2 8 64

device	mainbus {}
attach	mainbus at root

device	obio {[addr = -1], [level = -1]}
attach	obio at mainbus

device	iommu {}
attach	iommu at mainbus
file	arch/sparc/sparc/iommu.c		iommu

device	vme {}
attach	vme at iommu

device	vmel {[addr = -1], [level = -1], [vect = -1]}
attach	vmel at mainbus, vme
device	vmes {[addr = -1], [level = -1], [vect = -1]}
attach	vmes at mainbus, vme
file	arch/sparc/dev/obio.c		(obio | vmel | vmes | vme) & !solbourne

device	auxreg
attach	auxreg at mainbus, obio
file	arch/sparc/sparc/auxreg.c		auxreg needs-flag

device	clock
attach	clock at mainbus, obio

device	oclock
attach	oclock at obio

device	timer
attach	timer at mainbus, obio

device	eeprom
attach	eeprom at obio
file	arch/sparc/sparc/clock.c		!solbourne

device	power
attach	power at obio
file	arch/sparc/dev/power.c			power needs-flag

device	led
attach	led at mainbus, obio
file	arch/sparc/dev/led.c			led needs-flag

device	cpu
attach	cpu at mainbus
file	arch/sparc/sparc/cpu.c

device	memreg
attach	memreg at mainbus, obio
file	arch/sparc/sparc/memreg.c

device	eccmemctl
attach	eccmemctl at mainbus
file	arch/sparc/sparc/memecc.c		eccmemctl

device	zs {[channel = -1]}
attach	zs at mainbus, obio
file	arch/sparc/dev/zs.c			zs needs-flag
file	dev/ic/z8530sc.c			zs

device	fdc {}
attach	fdc at mainbus, obio
device	fd: disk
attach	fd at fdc
file	arch/sparc/dev/fd.c			fdc | fd needs-flag
file	arch/sparc/sparc/bsd_fdintr.s		fdc

device	xbox {}
device	sbus {[slot = -1], [offset = -1]}
attach	sbus at mainbus, iommu, sbus, xbox
file	arch/sparc/dev/sbus.c			sbus

# Sun specific files
include	"dev/sun/files.sun"

#
# Console (zs) related stuff
#

device	zstty: tty
attach	zstty at zs
file	dev/ic/z8530tty.c			zstty needs-flag
file	arch/sparc/dev/zs_kgdb.c		kgdb

device	zskbd: wskbddev, sunkbd
attach	zskbd at zs
file	arch/sparc/dev/z8530kbd.c		zskbd needs-flag

#
# Media Independent Interface (mii)
#
include	"dev/mii/files.mii"

#
# Machine-independent SCSI drivers
#
include	"scsi/files.scsi"

major	{sd = 7}
major	{vnd = 8}
major	{cd = 18}
major	{rd = 17}

device	dma {}
attach	dma at sbus, obio
device	ledma {}
attach	ledma at sbus
file	arch/sparc/dev/dma.c		dma | ledma
device	lebuffer {}
attach	lebuffer at sbus
file	arch/sparc/dev/lebuffer.c	lebuffer

device	qec {}
attach	qec at sbus
file	arch/sparc/dev/qec.c		qec

device	be: ifnet, ether, ifmedia
attach	be at qec
file	arch/sparc/dev/be.c		be

device	qe: ifnet, ether, ifmedia
attach	qe at qec
file	arch/sparc/dev/qe.c		qe

attach	gem at sbus with gem_sbus
file	arch/sparc/dev/if_gem_sbus.c	gem_sbus

attach	ti at sbus with ti_sbus
file	arch/sparc/dev/if_ti_sbus.c	ti_sbus

# HappyMeal (hme) ethernet
device	hme: ifnet, ether, mii, ifmedia
attach	hme at sbus
file	arch/sparc/dev/hme.c		hme

attach	esp at sbus, dma, obio
file	arch/sparc/dev/esp.c		esp

device	audioamd: audio, am7930
attach	audioamd at mainbus, obio, sbus
file	arch/sparc/dev/audioamd.c	audioamd
file	arch/sparc/sparc/amd7930intr.s	audioamd

device	audiocs: audio
attach	audiocs at sbus
file	arch/sparc/dev/cs4231.c		audiocs

# Framebuffers

file	arch/sparc/dev/fb.c

include	"dev/wscons/files.wscons"
include	"dev/rasops/files.rasops"
include	"dev/wsfont/files.wsfont"

define	bt_dac
file	arch/sparc/dev/bt_subr.c	bt_dac

device	agten: wsemuldisplaydev, rasops8
attach	agten at sbus
file	arch/sparc/dev/agten.c		agten

device	bwtwo: wsemuldisplaydev, rasops1
attach	bwtwo at sbus, obio, vmes, vmel
file	arch/sparc/dev/bwtwo.c		bwtwo

device	cgeight: wsemuldisplaydev, rasops1, bt_dac
attach	cgeight at obio
file	arch/sparc/dev/cgeight.c	cgeight

device	cgfour: wsemuldisplaydev, rasops8, bt_dac
attach	cgfour at obio
file	arch/sparc/dev/cgfour.c		cgfour

device	cgfourteen: wsemuldisplaydev, rasops8
attach	cgfourteen at obio
file	arch/sparc/dev/cgfourteen.c	cgfourteen

device	cgsix: wsemuldisplaydev, rasops8, bt_dac
attach	cgsix at sbus, obio
file	arch/sparc/dev/cgsix.c		cgsix

device	cgthree: wsemuldisplaydev, rasops8, bt_dac
attach	cgthree at sbus
file	arch/sparc/dev/cgthree.c	cgthree

device	cgtwelve: wsemuldisplaydev, rasops1
attach	cgtwelve at sbus
file	arch/sparc/dev/cgtwelve.c	cgtwelve

device	cgtwo: wsemuldisplaydev, rasops8
attach	cgtwo at vmes
file	arch/sparc/dev/cgtwo.c		cgtwo

device	mgx: wsemuldisplaydev, rasops8
attach	mgx at sbus
file	arch/sparc/dev/mgx.c		mgx

# Onboard Weitek P9000 found on Tadpole SPARCbook 3, and BT ``Chameleon'' RAMDAC
device	pninek: wsemuldisplaydev, rasops8, bt_dac
attach	pninek at sbus
file	arch/sparc/dev/p9000.c		pninek

device	btcham
attach	btcham at obio
file	arch/sparc/dev/bt445.c		btcham

# Onboard Weitek p9100 found on Tadpole SPARCbook 3GS/3GX/3TX/3XP
device	pnozz: wsemuldisplaydev, rasops8, bt_dac
attach	pnozz at sbus
file	arch/sparc/dev/p9100.c		pnozz

device	rfx: wsemuldisplaydev, rasops8
attach	rfx at sbus
file	arch/sparc/dev/rfx.c		rfx

device	tcx: wsemuldisplaydev, rasops8, bt_dac
attach	tcx at sbus
file	arch/sparc/dev/tcx.c		tcx

device	tvtwo: wsemuldisplaydev, rasops8
attach	tvtwo at sbus
file	arch/sparc/dev/tvtwo.c		tvtwo

device	vigra: wsemuldisplaydev, rasops8
attach	vigra at sbus
file	arch/sparc/dev/vigra.c		vigra

device	zx: wsemuldisplaydev, rasops8
attach	zx at sbus
file	arch/sparc/dev/zx.c		zx

# device definition in sys/conf/files
attach	le at sbus, ledma, lebuffer, obio: le24
file	arch/sparc/dev/if_le.c		le

attach	ie at obio, vmes, vmel
file	arch/sparc/dev/if_ie.c		ie

device	xdc {[drive = -1]}
attach	xdc at vmel
device	xd: disk
attach	xd at xdc
file	arch/sparc/dev/xd.c		xd needs-flag
major	{xd = 10}

device	xyc {[drive = -1]}
attach	xyc at vmes
device	xy: disk
attach	xy at xyc
file	arch/sparc/dev/xy.c		xy needs-flag
major	{xy = 3}

device	si: scsi, ncr5380sbc
attach	si at vmes
device	sw: scsi, ncr5380sbc
attach	sw at obio
file	arch/sparc/dev/si.c		si | sw

attach	qlw at sbus with qlw_sbus
file	arch/sparc/dev/qlw_sbus.c	qlw_sbus

#
# Generic Sparc stuff
#

file	arch/sparc/fpu/fpu.c
file	arch/sparc/fpu/fpu_add.c
file	arch/sparc/fpu/fpu_compare.c
file	arch/sparc/fpu/fpu_div.c
file	arch/sparc/fpu/fpu_explode.c
file	arch/sparc/fpu/fpu_implode.c
file	arch/sparc/fpu/fpu_mul.c
file	arch/sparc/fpu/fpu_sqrt.c
file	arch/sparc/fpu/fpu_subr.c

file	arch/sparc/sparc/autoconf.c		!solbourne
file	arch/sparc/sparc/cache.c
file	arch/sparc/sparc/conf.c
file	arch/sparc/sparc/consinit.c
file	arch/sparc/sparc/disksubr.c
file	arch/sparc/sparc/dvma.c
file	arch/sparc/sparc/emul.c
file	arch/sparc/sparc/in_cksum.c
file	arch/sparc/sparc/intr.c
file	arch/sparc/sparc/kgdb_machdep.c	kgdb
file	arch/sparc/sparc/machdep.c		!solbourne
file	arch/sparc/sparc/mem.c			!solbourne
file	arch/sparc/sparc/mutex.c
file	arch/sparc/sparc/openprom.c		!solbourne
file	arch/sparc/sparc/pmap.c			!solbourne
file	arch/sparc/sparc/process_machdep.c
file	arch/sparc/sparc/sys_machdep.c
file	arch/sparc/sparc/trap.c			!solbourne
file	arch/sparc/sparc/vm_machdep.c

file	arch/sparc/sparc/db_interface.c	ddb | kgdb
file	arch/sparc/sparc/db_trace.c	ddb
file	arch/sparc/sparc/db_disasm.c	ddb

#
# Compatibility modules
#

# Magma Serial/Parallel boards
device	magma {}
attach	magma at sbus
device	mtty
attach	mtty at magma
device	mbpp
attach	mbpp at magma
file	arch/sparc/dev/magma.c		magma | mtty | mbpp needs-flag

device	spif {}
attach	spif at sbus
device	stty
attach	stty at spif
device	sbpp
attach	sbpp at spif
file	arch/sparc/dev/spif.c		spif | stty | sbpp needs-flag

device	bpp {}
attach	bpp at sbus
file	arch/sparc/dev/bpp.c		bpp needs-flag

attach	xbox at sbus
file	arch/sparc/dev/xbox.c		xbox

# sysconfig registers on Force CPU-5V
device	scf {}
attach	scf at mainbus
file	arch/sparc/dev/scf.c		scf needs-flag

# flash memory on Force CPU-5V
device	flash {}
attach	flash at obio
file	arch/sparc/dev/flash.c		flash needs-flag

# VME/SBus bridge on Force CPU-5V
device	fga {}
attach	fga at iommu
device	fvme {[addr = -1], [level = -1], [vect = -1]}
attach	fvme at fga
file	arch/sparc/dev/fga.c		fga needs-flag

device	daadio {}
attach	daadio at fvme
file	arch/sparc/dev/daadio.c		daadio needs-flag

device	tctrl {}
attach	tctrl at obio
file	arch/sparc/dev/tctrl.c		tctrl needs-flag

# Prestoserve NVRAM
device	presto: disk
attach	presto at mainbus, sbus
file	arch/sparc/dev/presto.c		presto needs-flag

# PCMCIA devices

device	tslot: pcmciabus
attach	tslot at sbus
file	arch/sparc/dev/ts102.c		tslot

device	stp: pcmciabus
attach	stp at sbus with stp_sbus
file	dev/sbus/stp4020.c		stp
file	arch/sparc/dev/stp_sbus.c	stp_sbus

include	"dev/pcmcia/files.pcmcia"

# built-in modem on Tadpole SPARCbook
attach	com at obio with com_obio
file	arch/sparc/dev/com_obio.c	com_obio

# machine-dependent libkern component
file	lib/libkern/arch/sparc/saveregs.S

# quad support is necessary for 32 bit architectures
file	lib/libkern/adddi3.c
file	lib/libkern/anddi3.c
file	lib/libkern/ashldi3.c
file	lib/libkern/ashrdi3.c
file	lib/libkern/cmpdi2.c
file	lib/libkern/divdi3.c
file	lib/libkern/iordi3.c
file	lib/libkern/lshldi3.c
file	lib/libkern/lshrdi3.c
file	lib/libkern/moddi3.c
file	lib/libkern/muldi3.c
file	lib/libkern/negdi2.c
file	lib/libkern/notdi2.c
file	lib/libkern/qdivrem.c
file	lib/libkern/subdi3.c
file	lib/libkern/ucmpdi2.c
file	lib/libkern/udivdi3.c
file	lib/libkern/umoddi3.c
file	lib/libkern/xordi3.c

file	lib/libkern/arch/sparc/sdiv.S
file	lib/libkern/arch/sparc/udiv.S
file	lib/libkern/arch/sparc/urem.S
file	lib/libkern/arch/sparc/rem.S


code:
/*	$OpenBSD: ld.script,v 1.3 2014/02/25 21:26:44 miod Exp $	*/

/*
 * Copyright (c) 2013 Mark Kettenis <kettenis@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

OUTPUT_FORMAT("elf32-sparc")
OUTPUT_ARCH(sparc)
ENTRY(start)

PHDRS
{
	text PT_LOAD;
	data PT_LOAD;
	openbsd_randomize 0x65a3dbe6; /* PT_OPENBSD_RANDOMIZE */
}

SECTIONS
{
	. = 0xF8004000;
	.text :
	{
		*(.text)
		PROVIDE(etext = ABSOLUTE(.));
	} :text
	.rodata :
	{
		*(.rodata*)
	}
	. = ALIGN(0x2000);
	.data :
	{
		PROVIDE(__data_start = ABSOLUTE(.));
		*(.data)
	} :data
	.openbsd.randomdata :
	{
		*(.openbsd.randomdata)
	} :data :openbsd_randomize
	PROVIDE(edata = ABSOLUTE(.));
	.bss :
	{
		*(.bss)
		/* . = ALIGN(64 / 8); */
	} :data
	PROVIDE(end = ABSOLUTE(.));
}


code: src/sys/arch/sparc/dev

path: sys/arch/sparc/dev/CVS/Repository


code:
/*	$OpenBSD: agten.c,v 1.14 2015/03/28 19:07:07 miod Exp $	*/
/*
 * Copyright (c) 2002, 2003, Miodrag Vallat.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 */

/*
 * Fujitsu AG-10 framebuffer driver.
 *
 * The AG-10 is mostly made of:
 * - a 3DLabs 300SX Glint chip, with two 6MB independent framebuffer spaces
 * - a Number Nine Imagine 128 chip with its own 4MB framebuffer space
 * - a Weitek P9100 with its own 2MB of framebuffer memory
 * - an IBM PaletteDAC 561 ramdac
 * - an Analog Devices ADSP-21062
 *
 * All of these chips (memory, registers, etc) are mapped in the SBus
 * memory space associated to the board. What is unexpected, however, is
 * that there are also PCI registers mappings for the first three chips!
 *
 * The three graphics chips act as overlays of each other, for the final
 * video output.
 *
 * The PROM initialization will use the I128 framebuffer memory for output,
 * which is ``above'' the P9100. The P9100 seems to only be there to provide
 * a simple RAMDAC interface, but its frame buffer memory is accessible and
 * will appear as an ``underlay'' plane.
 */

/*
 * TODO
 * - initialize the I128 in 32bit mode
 * - use the i128 acceleration features
 */

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/device.h>
#include <sys/ioctl.h>
#include <sys/malloc.h>
#include <sys/mman.h>
#include <sys/tty.h>
#include <sys/conf.h>

#include <uvm/uvm_extern.h>

#include <machine/autoconf.h>
#include <machine/pmap.h>
#include <machine/cpu.h>
#include <machine/conf.h>

#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
#include <dev/rasops/rasops.h>
#include <machine/fbvar.h>

#include <dev/ic/p9000.h>
#include <dev/ic/ibm561reg.h>

struct agten_cmap {
	u_int8_t	cm_red[256];
	u_int8_t	cm_green[256];
	u_int8_t	cm_blue[256];
};

/* per-display variables */
struct agten_softc {
	struct	sunfb sc_sunfb;			/* common base part */

	struct	rom_reg sc_phys;		/* physical address and */
	off_t	sc_physoffset;			/* offset for frame buffer */

	volatile u_int8_t *sc_p9100;
	struct agten_cmap sc_cmap;		/* shadow color map */

	volatile u_int32_t *sc_i128_fb;
};

int	agten_ioctl(void *, u_long, caddr_t, int, struct proc *);
paddr_t	agten_mmap(void *, off_t, int);
void	agten_reset(struct agten_softc *);
void	agten_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t);

static __inline__
void	ibm561_write(struct agten_softc *, u_int32_t, u_int32_t);
int	agten_getcmap(struct agten_cmap *, struct wsdisplay_cmap *);
int	agten_putcmap(struct agten_cmap *, struct wsdisplay_cmap *);
void	agten_loadcmap(struct agten_softc *, u_int, u_int);

struct wsdisplay_accessops agten_accessops = {
	.ioctl = agten_ioctl,
	.mmap = agten_mmap
};

int	agtenmatch(struct device *, void *, void *);
void	agtenattach(struct device *, struct device *, void *);

struct cfattach agten_ca = {
	sizeof(struct agten_softc), agtenmatch, agtenattach
};

struct cfdriver agten_cd = {
	NULL, "agten", DV_DULL
};

int
agtenmatch(struct device *parent, void *vcf, void *aux)
{
	struct confargs *ca = aux;
	struct romaux *ra = &ca->ca_ra;

	if (strcmp(ra->ra_name, "PFU,aga") != 0)
		return (0);

	return (1);
}

void
agtenattach(struct device *parent, struct device *self, void *args)
{
	struct agten_softc *sc = (struct agten_softc *)self;
	struct confargs *ca = args;
	int node, isconsole;
	char *nam;

	node = ca->ca_ra.ra_node;
	nam = getpropstring(node, "model");
	printf(": model %s", nam);

	isconsole = node == fbnode;

	sc->sc_phys = ca->ca_ra.ra_reg[0];

	/*
	 * Map the various beasts of this card we are interested in.
	 */

	sc->sc_physoffset =
	    (off_t)getpropint(node, "i128_fb_physaddr", 0x8000000);
	sc->sc_i128_fb = mapiodev(ca->ca_ra.ra_reg, sc->sc_physoffset,
	    getpropint(node, "i128_fb_size", 0x400000));
	sc->sc_p9100 = mapiodev(ca->ca_ra.ra_reg,
	    getpropint(node, "p9100_reg_physaddr", 0x10a0000),
	    0x4000);

	/*
	 * For some reason the agten does not use the canonical name for
	 * properties, but uses an ffb_ prefix; and the linebytes property is
	 * missing.
	 * The following is a specific version of
	 *   fb_setsize(&sc->sc_sunfb, 8, 1152, 900, node, BUS_SBUS);
	 * using the correct property names.
	 */
#ifdef notyet
	sc->sc_sunfb.sf_depth = 32;
#else
	sc->sc_sunfb.sf_depth = getpropint(node, "ffb_depth", 8);
#endif
	sc->sc_sunfb.sf_width = getpropint(node, "ffb_width", 1152);
	sc->sc_sunfb.sf_height = getpropint(node, "ffb_height", 900);
	sc->sc_sunfb.sf_linebytes =
	    roundup(sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_depth) *
	        sc->sc_sunfb.sf_depth / 8;
	sc->sc_sunfb.sf_fbsize =
	    sc->sc_sunfb.sf_height * sc->sc_sunfb.sf_linebytes;

	printf(", %dx%d, depth %d\n",
	    sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_height,
	    sc->sc_sunfb.sf_depth);

	sc->sc_sunfb.sf_ro.ri_bits = (void *)sc->sc_i128_fb;

	sc->sc_sunfb.sf_ro.ri_hw = sc;
	fbwscons_init(&sc->sc_sunfb, isconsole);
	fbwscons_setcolormap(&sc->sc_sunfb, agten_setcolor);

	if (isconsole)
		fbwscons_console_init(&sc->sc_sunfb, -1);

	fbwscons_attach(&sc->sc_sunfb, &agten_accessops, isconsole);
}

int
agten_ioctl(void *dev, u_long cmd, caddr_t data, int flags, struct proc *p)
{
	struct agten_softc *sc = dev;
	struct wsdisplay_cmap *cm;
	struct wsdisplay_fbinfo *wdf;
	int error;

	switch (cmd) {
	case WSDISPLAYIO_GTYPE:
		*(u_int *)data = WSDISPLAY_TYPE_AGTEN;
		break;
	case WSDISPLAYIO_GINFO:
		wdf = (struct wsdisplay_fbinfo *)data;
		wdf->height = sc->sc_sunfb.sf_height;
		wdf->width = sc->sc_sunfb.sf_width;
		wdf->depth = sc->sc_sunfb.sf_depth;
		wdf->cmsize = (sc->sc_sunfb.sf_depth == 8) ? 256 : 0;
		break;
	case WSDISPLAYIO_LINEBYTES:
		*(u_int *)data = sc->sc_sunfb.sf_linebytes;
		break;

	case WSDISPLAYIO_GETCMAP:
		if (sc->sc_sunfb.sf_depth == 8) {
			cm = (struct wsdisplay_cmap *)data;
			error = agten_getcmap(&sc->sc_cmap, cm);
			if (error)
				return (error);
		}
		break;
	case WSDISPLAYIO_PUTCMAP:
		if (sc->sc_sunfb.sf_depth == 8) {
			cm = (struct wsdisplay_cmap *)data;
			error = agten_putcmap(&sc->sc_cmap, cm);
			if (error)
				return (error);
			agten_loadcmap(sc, 0, 256);
		}
		break;

	case WSDISPLAYIO_SVIDEO:
	case WSDISPLAYIO_GVIDEO:
		break;

	case WSDISPLAYIO_GCURPOS:
	case WSDISPLAYIO_SCURPOS:
	case WSDISPLAYIO_GCURMAX:
	case WSDISPLAYIO_GCURSOR:
	case WSDISPLAYIO_SCURSOR:
	default:
		return (-1);	/* not supported yet */
	}

	return (0);
}

paddr_t
agten_mmap(void *v, off_t offset, int prot)
{
	struct agten_softc *sc = v;

	if (offset & PGOFSET)
		return (-1);

	/* Allow mapping as a dumb framebuffer from offset 0 */
	if (offset >= 0 && offset < sc->sc_sunfb.sf_fbsize) {
		return (REG2PHYS(&sc->sc_phys, sc->sc_physoffset + offset) |
		    PMAP_NC);
	}

	return (-1);
}

void
agten_setcolor(void *v, u_int index, u_int8_t r, u_int8_t g, u_int8_t b)
{
	struct agten_softc *sc = v;

	sc->sc_cmap.cm_red[index] = r;
	sc->sc_cmap.cm_green[index] = g;
	sc->sc_cmap.cm_blue[index] = b;

	agten_loadcmap(sc, index, 1);
}

int
agten_getcmap(struct agten_cmap *cm, struct wsdisplay_cmap *rcm)
{
	u_int index = rcm->index, count = rcm->count;
	int error;

	if (index >= 256 || count > 256 - index)
		return (EINVAL);

	if ((error = copyout(&cm->cm_red[index], rcm->red, count)) != 0)
		return (error);
	if ((error = copyout(&cm->cm_green[index], rcm->green, count)) != 0)
		return (error);
	if ((error = copyout(&cm->cm_blue[index], rcm->blue, count)) != 0)
		return (error);

	return (0);
}

int
agten_putcmap(struct agten_cmap *cm, struct wsdisplay_cmap *rcm)
{
	u_int index = rcm->index, count = rcm->count;
	int error;

	if (index >= 256 || count > 256 - index)
		return (EINVAL);

	if ((error = copyin(rcm->red, &cm->cm_red[index], count)) != 0)
		return (error);
	if ((error = copyin(rcm->green, &cm->cm_green[index], count)) != 0)
		return (error);
	if ((error = copyin(rcm->blue, &cm->cm_blue[index], count)) != 0)
		return (error);

	return (0);
}

static __inline__ void
ibm561_write(struct agten_softc *sc, u_int32_t reg, u_int32_t value)
{
	/*
	 * For some design reason the IBM561 PaletteDac needs to be fed
	 * values shifted left by 16 bits. What happened to simplicity?
	 */
	*(volatile u_int32_t *)(sc->sc_p9100 + P9100_RAMDAC_REGISTER(reg)) =
	    (value) << 16;
}

void
agten_loadcmap(struct agten_softc *sc, u_int start, u_int ncolors)
{
	int i;
	u_int8_t *red, *green, *blue;

	ibm561_write(sc, IBM561_ADDR_LOW,
	    (IBM561_CMAP_TABLE + start) & 0xff);
	ibm561_write(sc, IBM561_ADDR_HIGH,
	    ((IBM561_CMAP_TABLE + start) >> 8) & 0xff);

	red = sc->sc_cmap.cm_red;
	green = sc->sc_cmap.cm_green;
	blue = sc->sc_cmap.cm_blue;
	for (i = start; i < start + ncolors; i++) {
		ibm561_write(sc, IBM561_CMD_CMAP, *red++);
		ibm561_write(sc, IBM561_CMD_CMAP, *green++);
		ibm561_write(sc, IBM561_CMD_CMAP, *blue++);
	}
}


code:
/*	$OpenBSD: audioamd.c,v 1.4 2015/05/11 06:46:21 ratchov Exp $	*/
/*	$NetBSD: audioamd.c,v 1.26 2011/06/04 01:27:57 tsutsui Exp $	*/

/*
 * Copyright (c) 1995 Rolf Grossmann
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *      This product includes software developed by Rolf Grossmann.
 * 4. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/device.h>
#include <sys/proc.h>

#include <machine/autoconf.h>
#include <machine/cpu.h>

#include <sys/audioio.h>
#include <dev/audio_if.h>

#include <dev/ic/am7930reg.h>
#include <dev/ic/am7930var.h>
#include <sparc/dev/audioamdvar.h>

#define AUDIO_ROM_NAME "audio"

#ifdef AUDIO_DEBUG
#define DPRINTF(x)      if (am7930debug) printf x
#define DPRINTFN(n,x)   if (am7930debug>(n)) printf x
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)
#endif	/* AUDIO_DEBUG */

/*
 * Define AUDIO_C_HANDLER to force using non-fast trap routines.
 */
/* #define AUDIO_C_HANDLER */

struct audioamd_softc {
	struct am7930_softc sc_am7930;	/* glue to MI code */

	void	(*sc_rintr)(void*);	/* input completion intr handler */
	void	*sc_rarg;		/* arg for sc_rintr() */
	void	(*sc_pintr)(void*);	/* output completion intr handler */
	void	*sc_parg;		/* arg for sc_pintr() */

	/* sc_au is special in that the hardware interrupt handler uses it */
	struct  auio sc_au;		/* recv and xmit buffers, etc */
#define	sc_hwih sc_au.au_ih		/* hardware interrupt vector */
#define	sc_swih sc_au.au_swih		/* software interrupt cookie */
};

void	audioamd_attach(struct device *, struct device *, void *);
int	audioamd_match(struct device *, void *, void *);

struct cfdriver audioamd_cd = {
	NULL, "audioamd", DV_DULL
};

const struct cfattach audioamd_ca = {
	sizeof(struct audioamd_softc), audioamd_match, audioamd_attach
};

/*
 * Define our interface into the am7930 MI driver.
 */

uint8_t	 audioamd_codec_iread(struct am7930_softc *, int);
uint16_t audioamd_codec_iread16(struct am7930_softc *, int);
uint8_t	 audioamd_codec_dread(struct audioamd_softc *, int);
void	 audioamd_codec_iwrite(struct am7930_softc *, int, uint8_t);
void	 audioamd_codec_iwrite16(struct am7930_softc *, int, uint16_t);
void	 audioamd_codec_dwrite(struct audioamd_softc *, int, uint8_t);
void	 audioamd_onopen(struct am7930_softc *);
void	 audioamd_onclose(struct am7930_softc *);

struct am7930_glue audioamd_glue = {
	audioamd_codec_iread,
	audioamd_codec_iwrite,
	audioamd_codec_iread16,
	audioamd_codec_iwrite16,
	audioamd_onopen,
	audioamd_onclose,
	8
};

/*
 * Define our interface to the higher level audio driver.
 */
int	audioamd_start_output(void *, void *, int, void (*)(void *), void *);
int	audioamd_start_input(void *, void *, int, void (*)(void *), void *);
int	audioamd_getdev(void *, struct audio_device *);

struct audio_hw_if sa_hw_if = {
	am7930_open,
	am7930_close,
	NULL,
	am7930_query_encoding,
	am7930_set_params,
	am7930_round_blocksize,
	am7930_commit_settings,
	NULL,
	NULL,
	audioamd_start_output,
	audioamd_start_input,
	am7930_halt_output,
	am7930_halt_input,
	NULL,
	audioamd_getdev,
	NULL,
	am7930_set_port,
	am7930_get_port,
	am7930_query_devinfo,
	NULL,
	NULL,
	NULL,
	NULL,
	am7930_get_props,
	NULL,
	NULL,
	NULL
};

struct audio_device audioamd_device = {
	"am7930",
	"x",
	"audioamd"
};

/* forward declarations */
int	amd7930_shareintr(void *);
#ifndef AUDIO_C_HANDLER
struct auio *auiop;
#endif	/* AUDIO_C_HANDLER */
int	am7930hwintr(void *);
void	am7930swintr(void *);

int
audioamd_match(struct device *parent, void *vcf, void *aux)
{
	struct confargs *ca = aux;
	struct romaux *ra = &ca->ca_ra;

	if (CPU_ISSUN4)
		return 0;
	return strcmp(AUDIO_ROM_NAME, ra->ra_name) == 0;
}

void
audioamd_attach(struct device *parent, struct device *self, void *aux)
{
	struct audioamd_softc *sc = (struct audioamd_softc *)self;
	struct confargs *ca = aux;
	struct romaux *ra = &ca->ca_ra;
	int pri;

	if (ra->ra_nintr != 1) {
		printf(": expected 1 interrupt, got %d\n", ra->ra_nintr);
		return;
	}
	pri = ra->ra_intr[0].int_pri;
	printf(" pri %d, softpri %d\n", pri, IPL_AUSOFT);
	sc->sc_au.au_sc = sc;
	sc->sc_au.au_amd = (volatile uint8_t *)(ra->ra_vaddr ?
	    ra->ra_vaddr : mapiodev(ra->ra_reg, 0, AM7930_DREG_SIZE));

	/*
	 * Set up glue for MI code early; we use some of it here.
	 */
	sc->sc_am7930.sc_glue = &audioamd_glue;
	am7930_init(&sc->sc_am7930, AUDIOAMD_POLL_MODE);

	/*
	 * Register interrupt handlers.  We'll prefer a fast trap (unless
	 * AUDIO_C_HANDLER is defined), with a sharing callback so that we
	 * can revert into a regular trap vector if necessary.
	 */
#ifndef AUDIO_C_HANDLER
	sc->sc_hwih.ih_vec = pri;
	if (intr_fasttrap(pri, amd7930_trap, amd7930_shareintr, sc) == 0) {
		auiop = &sc->sc_au;
		evcount_attach(&sc->sc_hwih.ih_count, self->dv_xname,
		    &sc->sc_hwih.ih_vec);
	} else {
#ifdef AUDIO_DEBUG
		printf("%s: unable to register fast trap handler\n",
		    self->dv_xname);
#endif
#else
	{
#endif
		sc->sc_hwih.ih_fun = am7930hwintr;
		sc->sc_hwih.ih_arg = &sc->sc_au;
		intr_establish(pri, &sc->sc_hwih, IPL_AUHARD, self->dv_xname);
	}

	sc->sc_swih = softintr_establish(IPL_AUSOFT, am7930swintr, sc);

	audio_attach_mi(&sa_hw_if, sc, self);
}

void
audioamd_onopen(struct am7930_softc *sc)
{
	struct audioamd_softc *ausc = (struct audioamd_softc *)sc;

	/* reset pdma state */
	ausc->sc_rintr = NULL;
	ausc->sc_rarg = 0;
	ausc->sc_pintr = NULL;
	ausc->sc_parg = 0;

	ausc->sc_au.au_rdata = NULL;
	ausc->sc_au.au_pdata = NULL;
}

void
audioamd_onclose(struct am7930_softc *sc)
{
	/* On sparc, just do the chipset-level halt. */
	am7930_halt_input(sc);
	am7930_halt_output(sc);
}

/*
 * called in interrupt code-path, don't lock
 */
int
audioamd_start_output(void *addr, void *p, int cc,
    void (*intr)(void *), void *arg)
{
	struct audioamd_softc *sc = addr;

	DPRINTFN(1, ("sa_start_output: cc=%d %p (%p)\n", cc, intr, arg));

	if (!sc->sc_am7930.sc_locked) {
		audioamd_codec_iwrite(&sc->sc_am7930,
		    AM7930_IREG_INIT, AM7930_INIT_PMS_ACTIVE);
		sc->sc_am7930.sc_locked = 1;
		DPRINTF(("sa_start_output: started intrs.\n"));
	}
	sc->sc_pintr = intr;
	sc->sc_parg = arg;
	sc->sc_au.au_pdata = p;
	sc->sc_au.au_pend = (char *)p + cc - 1;
	return 0;
}

/*
 * called in interrupt code-path, don't lock
 */
int
audioamd_start_input(void *addr, void *p, int cc,
    void (*intr)(void *), void *arg)
{
	struct audioamd_softc *sc = addr;

	DPRINTFN(1, ("sa_start_input: cc=%d %p (%p)\n", cc, intr, arg));

	if (!sc->sc_am7930.sc_locked) {
		audioamd_codec_iwrite(&sc->sc_am7930,
		    AM7930_IREG_INIT, AM7930_INIT_PMS_ACTIVE);
		sc->sc_am7930.sc_locked = 1;
		DPRINTF(("sa_start_input: started intrs.\n"));
	}
	sc->sc_rintr = intr;
	sc->sc_rarg = arg;
	sc->sc_au.au_rdata = p;
	sc->sc_au.au_rend = (char *)p + cc -1;
	return 0;
}

/*
 * Pseudo-DMA support: either C or locore assember.
 */

int
am7930hwintr(void *v)
{
	struct auio *au = v;
	struct audioamd_softc *sc = au->au_sc;
	uint8_t *d, *e;
	int k;

	/* clear interrupt */
	k = audioamd_codec_dread(sc, AM7930_DREG_IR);
	if ((k & (AM7930_IR_DTTHRSH | AM7930_IR_DRTHRSH | AM7930_IR_DSRI |
	    AM7930_IR_DERI | AM7930_IR_BBUFF)) == 0)
		return 0;

	/* receive incoming data */
	d = au->au_rdata;
	e = au->au_rend;
	if (d != NULL && d <= e) {
		*d = audioamd_codec_dread(sc, AM7930_DREG_BBRB);
		au->au_rdata++;
		if (d == e) {
			DPRINTFN(1, ("am7930hwintr: swintr(r) requested"));
			softintr_schedule(au->au_swih);
		}
	}

	/* send outgoing data */
	d = au->au_pdata;
	e = au->au_pend;
	if (d != NULL && d <= e) {
		audioamd_codec_dwrite(sc, AM7930_DREG_BBTB, *d);
		au->au_pdata++;
		if (d == e) {
			DPRINTFN(1, ("am7930hwintr: swintr(p) requested"));
			softintr_schedule(au->au_swih);
		}
	}

	return 1;
}

void
am7930swintr(void *v)
{
	struct audioamd_softc *sc = v;
	struct auio *au;
	int dor, dow;

	DPRINTFN(1, ("audiointr: sc=%p\n", sc););

	au = &sc->sc_au;
	dor = dow = 0;
	mtx_enter(&audio_lock);
	if (au->au_rdata > au->au_rend && sc->sc_rintr != NULL)
		dor = 1;
	if (au->au_pdata > au->au_pend && sc->sc_pintr != NULL)
		dow = 1;
	mtx_leave(&audio_lock);

	if (dor != 0)
		(*sc->sc_rintr)(sc->sc_rarg);
	if (dow != 0)
		(*sc->sc_pintr)(sc->sc_parg);
}

#ifndef AUDIO_C_HANDLER
int
amd7930_shareintr(void *arg)
{
	struct audioamd_softc *sc = arg;

	/*
	 * We are invoked at splhigh(), so there is no need to prevent the chip
	 * from interrupting while we are messing with the handlers. We
	 * however need to properly untie the event counter from the chain,
	 * since it will be reused immediately by intr_establish()...
	 */

	intr_fastuntrap(sc->sc_hwih.ih_vec);
	evcount_detach(&sc->sc_hwih.ih_count);

	sc->sc_hwih.ih_fun = am7930hwintr;
	sc->sc_hwih.ih_arg = &sc->sc_au;
	intr_establish(sc->sc_hwih.ih_vec, &sc->sc_hwih, IPL_AUHARD,
	    sc->sc_am7930.sc_dev.dv_xname);

	return 0;
}
#endif

/* indirect write */
void
audioamd_codec_iwrite(struct am7930_softc *sc, int reg, uint8_t val)
{
	struct audioamd_softc *ausc = (struct audioamd_softc *)sc;

	audioamd_codec_dwrite(ausc, AM7930_DREG_CR, reg);
	audioamd_codec_dwrite(ausc, AM7930_DREG_DR, val);
}

void
audioamd_codec_iwrite16(struct am7930_softc *sc, int reg, uint16_t val)
{
	struct audioamd_softc *ausc = (struct audioamd_softc *)sc;

	audioamd_codec_dwrite(ausc, AM7930_DREG_CR, reg);
	audioamd_codec_dwrite(ausc, AM7930_DREG_DR, val);
	audioamd_codec_dwrite(ausc, AM7930_DREG_DR, val >> 8);
}

/* indirect read */
uint8_t
audioamd_codec_iread(struct am7930_softc *sc, int reg)
{
	struct audioamd_softc *ausc = (struct audioamd_softc *)sc;

	audioamd_codec_dwrite(ausc, AM7930_DREG_CR, reg);
	return audioamd_codec_dread(ausc, AM7930_DREG_DR);
}

uint16_t
audioamd_codec_iread16(struct am7930_softc *sc, int reg)
{
	struct audioamd_softc *ausc = (struct audioamd_softc *)sc;
	uint lo, hi;

	audioamd_codec_dwrite(ausc, AM7930_DREG_CR, reg);
	lo = audioamd_codec_dread(ausc, AM7930_DREG_DR);
	hi = audioamd_codec_dread(ausc, AM7930_DREG_DR);
	return (hi << 8) | lo;
}

/* direct read */
uint8_t
audioamd_codec_dread(struct audioamd_softc *sc, int reg)
{
	return sc->sc_au.au_amd[reg];
}

/* direct write */
void
audioamd_codec_dwrite(struct audioamd_softc *sc, int reg, uint8_t val)
{
	sc->sc_au.au_amd[reg] = val;
}

int
audioamd_getdev(void *addr, struct audio_device *retp)
{
	*retp = audioamd_device;
	return 0;
}


code:
/*	$OpenBSD: audioamdvar.h,v 1.1 2011/09/03 20:04:02 miod Exp $	*/
/*	$NetBSD: audioamdvar.h,v 1.4 2005/12/11 12:19:05 christos Exp $	*/

/*
 * Copyright (c) 1995 Rolf Grossmann
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *      This product includes software developed by Rolf Grossmann.
 * 4. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * pdma state
 */
struct auio {
	volatile uint8_t *au_amd;	/* chip registers */

	uint8_t		*au_rdata;	/* record data */
	uint8_t		*au_rend;	/* end of record data */
	uint8_t		*au_pdata;	/* play data */
	uint8_t		*au_pend;	/* end of play data */

	void		*au_sc;
	struct intrhand	 au_ih;
	void		*au_swih;	/* software interrupt cookie */
};