diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2004-05-03 15:18:22 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2004-05-03 15:18:22 +0000 |
commit | d907b819f70da1dd52effec1d581a95e446ad108 (patch) | |
tree | 2c0fa84730f631c28358df09ce5204acbb501d42 /sys | |
parent | 19b5abc74c55fac31766f7e5c5a906086aa315af (diff) |
Remove OpenBSD/pegaos, this has been announced before but delayed until
the tree was stable. No point in code supporting a company which screws
its employees being in the OpenBSD tree.
Diffstat (limited to 'sys')
107 files changed, 5 insertions, 16718 deletions
diff --git a/sys/Makefile b/sys/Makefile index a32df51494e..c2d6713c7e8 100644 --- a/sys/Makefile +++ b/sys/Makefile @@ -1,9 +1,8 @@ -# $OpenBSD: Makefile,v 1.19 2004/02/07 20:23:05 deraadt Exp $ +# $OpenBSD: Makefile,v 1.20 2004/05/03 15:18:20 drahn Exp $ # $NetBSD: Makefile,v 1.5 1995/09/15 21:05:21 pk Exp $ SUBDIR= arch/alpha arch/hp300 arch/hppa arch/i386 arch/m68k \ arch/mac68k arch/macppc arch/mvme68k arch/mvme88k \ - arch/mvmeppc arch/pegasos arch/sparc arch/sparc64 \ - arch/vax arch/cats arch/amd64 + arch/mvmeppc arch/sparc arch/sparc64 arch/vax arch/cats arch/amd64 .include <bsd.subdir.mk> diff --git a/sys/arch/pegasos/Makefile b/sys/arch/pegasos/Makefile deleted file mode 100644 index 387e5e3f8c0..00000000000 --- a/sys/arch/pegasos/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $OpenBSD: Makefile,v 1.1 2003/10/31 03:54:33 drahn Exp $ - -NOPROG= noprog -NOMAN= noman - -.if ${MACHINE} == "pegasos" -SUBDIR= stand -.endif - -obj: _SUBDIRUSE - -.include <bsd.prog.mk> diff --git a/sys/arch/pegasos/compile/.cvsignore b/sys/arch/pegasos/compile/.cvsignore deleted file mode 100644 index b72af3039e6..00000000000 --- a/sys/arch/pegasos/compile/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -GENERIC -RAMDISK diff --git a/sys/arch/pegasos/conf/GENERIC b/sys/arch/pegasos/conf/GENERIC deleted file mode 100644 index 41d823b63ab..00000000000 --- a/sys/arch/pegasos/conf/GENERIC +++ /dev/null @@ -1,213 +0,0 @@ -# $OpenBSD: GENERIC,v 1.5 2004/02/24 19:52:24 deraadt Exp $g -# -# PPC GENERIC config file -# - -machine pegasos powerpc - -maxusers 32 - -# default type, instructs system to try to determin what proper type is -# actual machine type probed via name of openfirmware root node. -option SYS_TYPE=APPL - -option FIREPOWERBUGS -option PPC_MPC106_BUG -option PCIVERBOSE -option USBVERBOSE -#option MACOBIOVERBOSE -option ALTIVEC -option APERTURE # in-kernel aperture driver for XFree86 -option WSDISPLAY_COMPAT_RAWKBD # can get raw scancodes -option WSDISPLAY_DEFAULTSCREENS=6 -#option PCIAGP -option USER_PCICONF # user-space PCI configuration - -option ADOSFS # AmigaDOS file system - -include "../../../conf/GENERIC" - -config bsd swap generic - -mainbus0 at root -cpu* at mainbus0 -#ofroot0 at mainbus0 -#ofbus* at ofroot? -#ofbus* at ofbus? -#ofcons0 at ofbus? - -mpcpcibr* at mainbus0 # MPC106 PCI Bridge. -pchb* at pci? - -# ISA - -isabr* at pci? # isa bridge -isa* at isabr? -pckbc0 at isa? # PC prog. periph. interface -pckbd0 at pckbc? # PC keyboard (kbd port) -wskbd* at pckbd? console ? -pms0 at pckbc? # PS/2-style mouse (aux port) -wsmouse* at pms? mux 0 -com0 at isa? port 0x2f8 irq 3 - -#### PCI Bus devices. - -pci* at mpcpcibr? -ppb* at pci? dev ? function ? # PCI-PCI bridges -pci* at ppb? bus ? - -vga* at pci? dev ? function ? # PCI VGA graphics - -#vgafb0 at pci? dev ? function ? # PCI VGA graphics - -siop* at pci? dev ? function ? -#adv* at pci? dev ? function ? # AdvanSys 1200[A,B], 9xx[U,UA] SCSI -ahc* at pci? dev ? function ? # Adaptec 294x, aic78x0 SCSI -#bha* at pci? dev ? function ? # BusLogic 9xx SCSI -#ami* at pci? dev ? function ? -#pcscp* at pci? dev ? function ? # AMD Am53c974 PCscsi-PCI SCSI -pciide* at pci? dev ? function ? -iop* at pci? dev ? function ? # I2O processor -ioprbs* at iop? tid ? # I2O arrays -iopsp* at iop? tid ? # I2O SCSI pass-through - -# PCI Networking -hme* at pci? dev ? function ? # HME ethernet -dc* at pci? dev ? function ? # DEC Tulip 21143 clones -xl* at pci? dev ? function ? # 3C9xx ethernet -em* at pci? dev ? function ? # Intel Pro/1000 ethernet -ti* at pci? dev ? function ? # Alteon Tigon 1Gb ethernet -an* at pci? dev ? function ? # Cisco/Aironet -wi* at pci? dev ? function ? # WaveLAN IEEE 802.11DS -fxp* at pci? dev ? function ? -skc* at pci? dev ? function ? # SysKonnect GEnesis 984x -sk* at skc? # each port of above -vr* at pci? dev ? function ? -#de* at pci? dev ? function ? -#ep* at pci? dev ? function ? # 3Com 3c59x -#ne* at pci? dev ? function ? # NE2000-compatible Ethernet - -dcphy* at mii? phy ? # Digital Clone PHYs -exphy* at mii? phy ? # 3Com internal PHYs -inphy* at mii? phy ? # Intel 82555 PHYs -iophy* at mii? phy ? # Intel 82553 PHYs -icsphy* at mii? phy ? # ICS1890 PHYs -lxtphy* at mii? phy ? # Level One LXT-970 PHYs -nsphy* at mii? phy ? # NS83840 PHYs -#nsphyter* at mii? phy ? # NS83843 PHYs -mtdphy* at mii? phy ? # Myson MTD972 PHYs -#qsphy* at mii? phy ? # Quality Semi QS6612 PHYs -sqphy* at mii? phy ? # Seeq 8022[013] PHYs -#tlphy* at mii? phy ? # ThunderLAN PHYs -#tqphy* at mii? phy ? # TDK Semiconductor PHYs -brgphy* at mii? phy ? # Broadcom 10/100/1000 PHYs -bmtphy* at mii? phy ? # Broadcom 10/100 PHYs -eephy* at mii? phy ? # Marvell 88E1000 Gigabit PHYs -ukphy* at mii? phy ? # generic unknown PHYs - -# crypto -lofn* at pci? dev ? function ? # Hifn6500 -hifn* at pci? dev ? function ? # Hifn7751/7811/7951 -ubsec* at pci? dev ? function ? # Broadcom 58xx - -# FireWire Controllers -#fwohci* at pci? dev ? function ? # PCI FireWire adapter -#fwohci* at cardbus? dev ? function ? # CardBus FireWire adapter - -#fw* at fwbus? # IPv4/v6 over FireWire -#fwnode* at fwbus? idhi ? idlo ? - -#fwscsi* at fwnode? # SCSI over FireWire -#scsibus* at fwscsi? - -#option FWOHCI_DEBUG -#option FWNODE_DEBUG -#option P1212_DEBUG -#option SBP2_DEBUG -#option FWSCSI_DEBUG - -bktr0 at pci? dev ? function ? # Bt8[47][89] tv/fmradio/video -radio* at bktr? - -#scsibus* at adv? -scsibus* at ahc? -#scsibus* at ami? -#scsibus* at bha? -#scsibus* at esp? -#scsibus* at mesh? -scsibus* at ioprbs? -scsibus* at iopsp? -#scsibus* at pcscp? -scsibus* at siop? -#scsibus* at fwscsi? - -wd* at pciide? drive ? flags 0x0000 -atapiscsi* at pciide? channel ? flags 0x0000 -scsibus* at atapiscsi? - -# PCI USB Controllers -ohci* at pci? # Open Host Controller -uhci* at pci? # Universal Host Controller - -# USB bus support -#usb* at ohci? flags 0x1 -#usb* at uhci? flags 0x1 -usb* at ohci? -usb* at uhci? -uhub* at usb? -uhub* at uhub? port ? configuration ? interface ? - -uhidev* at uhub? port ? configuration ? interface ? -uhid* at uhidev? reportid ? # USB Generic HID devices -ukbd* at uhidev? reportid ? # USB HID Keyboard devices -ums* at uhidev? reportid ? # USB Mice -wsmouse* at ums? mux 0 -uaudio* at uhub? port ? configuration ? # USB Audio -ulpt* at uhub? port ? configuration ? # USB Printer -uscanner* at uhub? port ? # USB Scanner driver -usscanner* at uhub? port ? # USB SCSI scanners -scsibus* at usscanner? -uyap* at uhub? port ? # Y@P firmware loader -ugen* at uhub? port ? configuration ? # USB Generic driver -umass* at uhub? port ? configuration ? # USB Mass Storage devices -scsibus* at umass? -wi* at uhub? port ? # 802.11 USB -kue* at uhub? port ? # Kawasaki KL5KUSB101B -aue* at uhub? port ? # USB EtherNet -uplcom* at uhub? port ? # I/O DATA USB-RSAQ2 serial -ucom* at uplcom? portno ? - -# CardBus bus support -cardbus* at cardslot? -pcmcia* at cardslot? -cbb* at pci? dev ? function ? -cardslot* at cbb? -wi* at pcmcia? function ? # WaveLAN IEEE 802.11DS -dc* at cardbus? dev ? function ? # 21143, "tulip" clone ethernet -#fxp* at cardbus? dev ? function ? # Intel PRO/100 ethernet -xl* at cardbus? dev ? function ? # 3C575/3C656 ethernet -#rl* at cardbus? dev ? function ? # RealTek 81[23]9 ethernet -wdc* at pcmcia? function ? -wd* at wdc? drive ? flags 0x0000 -atapiscsi* at wdc? - -# PCI sound -autri* at pci? dev ? function ? # Trident 4D WAVE -eap* at pci? dev ? function ? # Ensoniq -auvia* at pci? dev ? function ? # VT82C686 AC97 -midi* at autri? -audio* at autri? -audio* at eap? -audio* at auvia? - -wsdisplay* at vga? console ? -wskbd* at ukbd? console ? mux 1 - -sd* at scsibus? target ? lun ? -st* at scsibus? target ? lun ? -cd* at scsibus? target ? lun ? -ch* at scsibus? target ? lun ? -ss* at scsibus? target ? lun ? -uk* at scsibus? target ? lun ? - -pseudo-device wsmux 2 # mouse & keyboard multiplexor diff --git a/sys/arch/pegasos/conf/Makefile.pegasos b/sys/arch/pegasos/conf/Makefile.pegasos deleted file mode 100644 index c3244d035a7..00000000000 --- a/sys/arch/pegasos/conf/Makefile.pegasos +++ /dev/null @@ -1,198 +0,0 @@ -# $OpenBSD: Makefile.pegasos,v 1.3 2004/01/20 03:32:44 brad Exp $ -# -# Makefile for OpenBSD PowerPC -# -# This makefile is constructed from a machine description: -# config machineid -# Most changes should be made in the machine description -# /sys/arch/pegasos/conf/``machineid'' -# after which you should do -# config machineid -# Machine generic makefile changes should be made in -# /sys/arch/pegasos/conf/Makefile.pegasos -# after which config should be rerun for all machines of that type. -# -# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE -# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING -# -# -DTRACE compile in kernel tracing hooks -# -DQUOTA compile in file system quotas -# -.SUFFIXES: .S .c .o - -# DEBUG is set to -g if debugging. -# PROF is set to -pg if profiling. - -.include <bsd.own.mk> - -MKDEP?= mkdep -STRIP?= strip -SIZE?= size - -# source tree is located via $S relative to the compilation directory -.ifndef S -S!= cd ../../../..; pwd -.endif -PEGASOS= $S/arch/pegasos - -INCLUDES= -I. -I$S/arch -I$S -nostdinc -L${DESTDIR}/usr/include -CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL \ - -D__pegasos__ -CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ - -Wno-uninitialized -Wno-format -Wno-main -CMACHFLAGS= -msoft-float -Wa,-m7400 -fno-builtin-printf -fno-builtin-log -.if ${IDENT:M-DNO_PROPOLICE} -CMACHFLAGS+= -fno-stack-protector -.endif -COPTS?= -O2 -CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE} -AFLAGS= -D_LOCORE -LINKFLAGS= -N -Ttext 500114 -e start --warn-common -STRIPFLAGS= -g -X -x - -HOSTCC?= ${CC} -HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} -HOSTED_CFLAGS= ${CFLAGS} - -### find out what to use for libkern -.include "$S/lib/libkern/Makefile.inc" -.ifndef PROF -LIBKERN= ${KERNLIB} -.else -LIBKERN= ${KERNLIB_PROF} -.endif - -### find out what to use for libcompat -.include "$S/compat/common/Makefile.inc" -.ifndef PROF -LIBCOMPAT= ${COMPATLIB} -.else -LIBCOMPAT= ${COMPATLIB_PROF} -.endif - -# 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. - -USRLAND_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< -USRLAND_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< - -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= ${AS} ${COPTS} ${PARAM} $< -o $@ - - -%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_OBJ= locore.o param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} -SYSTEM_DEP= Makefile ${SYSTEM_OBJ} -SYSTEM_LD_HEAD= rm -f $@ -SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ - ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o -SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ - -DEBUG?= -.if ${DEBUG} == "-g" -LINKFLAGS+= -X -SYSTEM_LD_TAIL+=; \ - echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ - echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ -.else -LINKFLAGS+= -S -.endif - -%LOAD - -assym.h: $S/kern/genassym.sh ${PEGASOS}/pegasos/genassym.cf Makefile - sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} \ - < ${PEGASOS}/pegasos/genassym.cf > assym.h.tmp && \ - mv -f 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_C} - -ioconf.o: ioconf.c - ${NORMAL_C} - -newvers: ${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 *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks genassym genassym.o assym.h - -lint: - @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB ${CFILES} \ - ioconf.c param.c | \ - grep -v 'static function .* unused' - -tags: - @echo "see $S/kern/Makefile for tags" - -links: - egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ - sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink - echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ - sort -u | comm -23 - dontlink | \ - sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks - sh makelinks && rm -f dontlink - -SRCS= ${PEGASOS}/pegasos/locore.S \ - param.c ioconf.c ${CFILES} ${SFILES} -depend:: .depend -.depend: ${SRCS} assym.h param.c - ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${PEGASOS}/pegasos/locore.S - ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} -.if ${SFILES} != "" - ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} -.endif - -# depend on root or device configuration -autoconf.o conf.o: Makefile - -# depend on network or filesystem configuration -uipc_proto.o vfs_conf.o: Makefile - -# depend on maxusers -genassym.o machdep.o: Makefile - -# depend on CPU configuration -locore.o machdep.o: Makefile - - -locore.o: ${PEGASOS}/pegasos/locore.S assym.h - ${NORMAL_S} - -# The install target can be redefined by putting a -# install-kernel-${MACHINE_NAME} target into /etc/mk.conf -MACHINE_NAME!= uname -n -install: install-kernel-${MACHINE_NAME} -.if !target(install-kernel-${MACHINE_NAME}}) -install-kernel-${MACHINE_NAME}: - rm -f /obsd - ln /bsd /obsd - cp bsd /nbsd - mv /nbsd /bsd -.endif - -%RULES diff --git a/sys/arch/pegasos/conf/RAMDISK b/sys/arch/pegasos/conf/RAMDISK deleted file mode 100644 index 52b07d7141b..00000000000 --- a/sys/arch/pegasos/conf/RAMDISK +++ /dev/null @@ -1,194 +0,0 @@ -# $OpenBSD: RAMDISK,v 1.3 2004/01/15 05:25:09 drahn Exp $ -# -# PPC RAMDISK config file -# - -machine pegasos powerpc - -maxusers 32 - -# default type, instructs system to try to determin what proper type is -# actual machine type probed via name of openfirmware root node. -option SYS_TYPE=APPL - -option FIREPOWERBUGS -option PPC_MPC106_BUG -option PCIVERBOSE - -# include "../../../conf/GENERIC" -option TIMEZONE=0 # time zone to adjust RTC time by -option DST=0 # daylight saving time used by RTC -option COMPAT_43 # and 4.3BSD -option FFS # UFS -option NFSCLIENT # Network File System client -option MFS # memory file system -option CD9660 # ISO 9660 + Rock Ridge file system -option MSDOSFS # MS-DOS file system -option INET # IP + ICMP + TCP + UDP -option INET6 # IPv6 (needs INET) -option DDB # kernel debugger - -config bsd root on rd0a swap on rd0b - -mainbus0 at root -cpu* at mainbus0 -ofroot0 at mainbus0 -#ofbus* at ofroot? -#ofbus* at ofbus? -#ofcons0 at ofbus? - -mpcpcibr* at mainbus0 # MPC106 PCI Bridge. -pchb* at pci? # host bridge identifiers - -# ISA - -isabr* at pci? # isa bridge -isa* at isabr? -pckbc0 at isa? # PC keyboard controller -pckbd0 at pckbc? # PC keyboard (kbd port) -pms0 at pckbc? # PS/2-style mouse (aux port -wskbd* at pckbd? console ? mux 1 -#com* at isa? port 0x3f8 irq 4 # standard serial ports -com0 at isa? port 0x2f8 irq 3 - - -#### PCI Bus devices. - -pci* at mpcpcibr? -ppb* at pci? dev ? function ? # PCI-PCI bridges -pci* at ppb? bus ? - -vga* at pci? dev ? function ? # PCI VGA graphics - -siop* at pci? dev ? function ? -#ncr* at pci? dev ? function ? -xl* at pci? dev ? function ? # 3C9xx ethernet -fxp* at pci? dev ? function ? -vr* at pci? dev ? function ? -#de* at pci? dev ? function ? -#vgafb0 at pci? dev ? function ? # PCI VGA graphics -#ep* at pci? dev ? function ? # 3Com 3c59x -#ne* at pci? dev ? function ? # NE2000-compatible Ethernet -#adv* at pci? dev ? function ? # AdvanSys 1200[A,B], 9xx[U,UA] SCSI -#ahc* at pci? dev ? function ? # Adaptec 294x, aic78x0 SCSI -#bha* at pci? dev ? function ? # BusLogic 9xx SCSI -#pcscp* at pci? dev ? function ? # AMD Am53c974 PCscsi-PCI SCSI -pciide* at pci? dev ? function ? - -# how many of these are needed? -#dcphy* at mii? phy ? # Digital Clone PHYs -exphy* at mii? phy ? # 3Com internal PHYs -inphy* at mii? phy ? # Intel 82555 PHYs -iophy* at mii? phy ? # Intel 82553 PHYs -icsphy* at mii? phy ? # Integrated Circuit Systems ICS1890 -#lxtphy* at mii? phy ? # Level One LXT-970 PHYs -#nsphy* at mii? phy ? # NS83840 PHYs -#nsphyter* at mii? phy ? # NS83843 PHYs -#mtdphy* at mii? phy ? # Myson MTD972 PHYs -#qsphy* at mii? phy ? # Quality Semiconductor QS6612 PHYs -#sqphy* at mii? phy ? # Seeq 80220/80221/80223 PHYs -#tlphy* at mii? phy ? # ThunderLAN PHYs -#tqphy* at mii? phy ? # TDK Semiconductor PHYs -#brgphy* at mii? phy ? # Broadcom 10/100/1000 PHYs -#bmtphy* at mii? phy ? # Broadcom 10/100 PHYs -eephy* at mii? phy ? # Marvell 88E1000 Gigabit PHYs -ukphy* at mii? phy ? # generic unknown PHYs - -scsibus* at siop? -#scsibus* at ncr? -#scsibus* at adv? -#scsibus* at ahc? -#scsibus* at bha? -#scsibus* at esp? -#scsibus* at mesh? -#scsibus* at pcscp? - -wd* at pciide? channel ? drive ? flags 0x0000 -#atapiscsi* at wdc? channel ? flags 0x0000 -atapiscsi* at pciide? channel ? flags 0x0000 -scsibus* at atapiscsi? - -# FireWire Controllers -#fwohci* at pci? dev ? function ? # PCI FireWire adapter -#fwohci* at cardbus? dev ? function ? # CardBus FireWire adapter - -#fw* at fwbus? # IPv4/v6 over FireWire -#fwnode* at fwbus? idhi ? idlo ? - -#fwscsi* at fwnode? # SCSI over FireWire -#scsibus* at fwscsi? - -#option FWOHCI_DEBUG -#option FWNODE_DEBUG -#option P1212_DEBUG -#option SBP2_DEBUG -#option FWSCSI_DEBUG - -# PCI USB Controllers -ohci* at pci? # Open Host Controller -uhci* at pci? # Universal Host Controller - -# USB bus support -usb* at ohci? flags 0x1 -usb* at uhci? -uhub* at usb? -uhub* at uhub? port ? configuration ? interface ? - -uhidev* at uhub? port ? configuration ? interface ? -uhid* at uhidev? reportid ? # USB Generic HID devices -ukbd* at uhidev? reportid ? # USB HID Keyboard devices -ums* at uhidev? reportid ? # USB Mice -wsmouse* at ums? mux 0 -#ulpt* at uhub? port ? configuration ? # USB Printer -#uscanner* at uhub? port ? # USB Scanner driver -#usscanner* at uhub? port ? # USB SCSI scanners -#scsibus* at usscanner? -#uyap* at uhub? port ? # Y@P firmware loader -ugen* at uhub? port ? configuration ? # USB Generic driver -umass* at uhub? port ? configuration ? # USB Mass Storage devices -scsibus* at umass? -kue* at uhub? port ? # Kawasaki KL5KUSB101B -aue* at uhub? port ? # USB EtherNet - -# CardBus bus support -#cardbus* at cardslot? -#pcmcia* at cardslot? -#cbb* at pci? dev ? function ? -#cardslot* at cbb? -#wi* at pcmcia? function ? # WaveLAN IEEE 802.11DS -#dc* at cardbus? dev ? function ? # 21143, "tulip" clone ethernet -#fxp* at cardbus? dev ? function ? # Intel PRO/100 ethernet -#xl* at cardbus? dev ? function ? # 3C575/3C656 ethernet -#rl* at cardbus? dev ? function ? # RealTek 81[23]9 ethernet -#wdc* at pcmcia? function ? - -# PCI sound -autri* at pci? dev ? function ? # Trident 4D WAVE -eap* at pci? dev ? function ? # Ensoniq -auvia* at pci? dev ? function ? # VT82C686 AC97 -midi* at autri? -audio* at autri? -audio* at eap? -audio* at auvia? - -# Workstation Console attachments -wsdisplay* at vga? -wskbd* at ukbd? console ? mux 1 - -sd* at scsibus? target ? lun ? -st* at scsibus? target ? lun ? -cd* at scsibus? target ? lun ? -#ch* at scsibus? target ? lun ? -#ss* at scsibus? target ? lun ? -#uk* at scsibus? target ? lun ? - -pseudo-device loop 1 # network loopback -pseudo-device bpfilter 1 # packet filter -pseudo-device rd 1 # ram disk -pseudo-device wsmux 2 # mouse & keyboard multiplexor - -option BOOT_CONFIG # boot-time kernel config - -# RAMDISK stuff -option MINIROOTSIZE=8192 -option RAMDISK_HOOKS diff --git a/sys/arch/pegasos/conf/files.pegasos b/sys/arch/pegasos/conf/files.pegasos deleted file mode 100644 index c30669e9cff..00000000000 --- a/sys/arch/pegasos/conf/files.pegasos +++ /dev/null @@ -1,165 +0,0 @@ -# $OpenBSD: files.pegasos,v 1.2 2003/11/14 11:19:43 miod Exp $ - -# -# pegasos-specific configuration info -# -maxpartitions 16 - -maxusers 2 8 64 - -file arch/pegasos/pegasos/autoconf.c -file arch/pegasos/pegasos/clock.c -file arch/pegasos/pegasos/conf.c -file arch/pegasos/pegasos/disksubr.c disk -file arch/pegasos/pegasos/hfsdisksubr.c disk -file arch/pegasos/pegasos/mbrdisksubr.c disk -file arch/pegasos/pegasos/rdbdisksubr.c disk -file arch/pegasos/pegasos/machdep.c -file arch/pegasos/pegasos/wscons_machdep.c -file arch/pegasos/pegasos/mem.c -file arch/pegasos/pegasos/dma.c -file arch/pegasos/pegasos/ofw_machdep.c -file arch/pegasos/pegasos/openfirm.c -file dev/cons.c -file dev/cninit.c -file arch/pegasos/pegasos/ofwreal.S -file arch/pegasos/pegasos/db_interface.c ddb - -# -# Media Independent Interface (mii) -# -include "../../../dev/mii/files.mii" - -# -# Openfirmware support -# - -define mainbus {} -device mainbus -attach mainbus at root -file arch/pegasos/pegasos/mainbus.c mainbus - -device cpu -attach cpu at mainbus -file arch/pegasos/pegasos/cpu.c - -include "../../../dev/ofw/files.ofw" -file arch/pegasos/pegasos/opendev.c -major { ofdisk = 4 } - - -major {rd = 17} -major {sd = 2} -major {cd = 3} -major {wd = 0} - -include "../../../scsi/files.scsi" - -# -# I2O -# -include "../../../dev/i2o/files.i2o" - -include "dev/pci/files.pci" -file arch/pegasos/pci/pciide_machdep.c pciide - -device mpcpcibr {} : pcibus -attach mpcpcibr at mainbus -file arch/pegasos/pci/mpcpcibus.c mpcpcibr -file arch/pegasos/pci/pci_addr_fixup.c mpcpcibr - -# -# "workstation console" routines -# - -include "dev/wscons/files.wscons" - - -#PCI-Host bridge chipsets -device pchb -attach pchb at pci -file arch/pegasos/pci/pchb.c pchb - - -# -# Machine-independent ATAPI drivers -# - -include "../../../dev/atapiscsi/files.atapiscsi" -include "../../../dev/ata/files.ata" - -# MAC periph - - -#device mc: ifnet, ether -#attach mc at macobio - -# Raster operations -include "dev/rasops/files.rasops" -include "dev/wsfont/files.wsfont" - -# VGA framebuffer -device vgafb: wsemuldisplaydev, rasops8, rasops16, rasops32 -file arch/pegasos/pci/vgafb.c vgafb & vgafb_pci - -# Generic VGA Framebuffer version -attach vgafb at pci with vgafb_pci -file arch/pegasos/pci/vgafb_pci.c vgafb_pci needs-flag - - -# -# CARDBUS -# -include "dev/cardbus/files.cardbus" -file arch/pegasos/pegasos/rbus_machdep.c cardbus - -# -# Machine-independent PCMCIA drivers -# -include "dev/pcmcia/files.pcmcia" - -# -# Machine-independent USB drivers -# -include "dev/usb/files.usb" - -# -# Machine-independent IEEE1394 drivers -# -include "dev/ieee1394/files.ieee1394" - -# Sun HME Ethernet controllers -device hme: ether, ifnet, mii, ifmedia -file dev/ic/hme.c - -attach hme at pci with hme_pci -file dev/pci/if_hme_pci.c hme_pci - - -device isabr {} : isabus -attach isabr at pci -file arch/pegasos/pci/isabr.c isabr - -include "../../../dev/isa/files.isa" - -device isabeep -attach isabeep at pcppi - -include "dev/pckbc/files.pckbc" - -include "../../../dev/isa/files.isapnp" -file arch/pegasos/isa/isapnp_machdep.c isapnp - -# Onboard ISA -file arch/pegasos/isa/isa_clock.c -file dev/clock_subr.c - - -file arch/pegasos/pci/agp_machdep.c pciagp -#file dev/pci/agp_ali.c pciagp -#file dev/pci/agp_amd.c pciagp -#file dev/pci/agp_i810.c pciagp -#file dev/pci/agp_intel.c pciagp -#file dev/pci/agp_sis.c pciagp -file dev/pci/agp_via.c pciagp - diff --git a/sys/arch/pegasos/include/ansi.h b/sys/arch/pegasos/include/ansi.h deleted file mode 100644 index b8b5ce891c4..00000000000 --- a/sys/arch/pegasos/include/ansi.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: ansi.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/ansi.h> diff --git a/sys/arch/pegasos/include/asm.h b/sys/arch/pegasos/include/asm.h deleted file mode 100644 index 5852170617a..00000000000 --- a/sys/arch/pegasos/include/asm.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: asm.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/asm.h> diff --git a/sys/arch/pegasos/include/autoconf.h b/sys/arch/pegasos/include/autoconf.h deleted file mode 100644 index 2aeceb591c9..00000000000 --- a/sys/arch/pegasos/include/autoconf.h +++ /dev/null @@ -1,106 +0,0 @@ -/* $OpenBSD: autoconf.h,v 1.2 2004/01/22 21:28:33 miod Exp $ */ - -/* - * Copyright (c) 1997 Per Fogelstrom - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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. - * - */ -/* - * Machine-dependent structures of autoconfiguration - */ - -#ifndef _MACHINE_AUTOCONF_H_ -#define _MACHINE_AUTOCONF_H_ - -#include <machine/bus.h> - -/* - * System types. - */ -#define OFWMACH 0 /* Openfirmware drivers */ -#define POWER4e 1 /* V.I Power.4e board */ -#define PWRSTK 2 /* Motorola Powerstack series */ -#define APPL 3 /* Apple PowerMac machines (OFW?) */ - -extern int system_type; - -/**/ -struct confargs; - -typedef int (*intr_handler_t)(void *); - -typedef struct bushook { - struct device *bh_dv; - int bh_type; - void (*bh_intr_establish)(struct confargs *, intr_handler_t, void *); - void (*bh_intr_disestablish)(struct confargs *); - int (*bh_matchname)(struct confargs *, char *); -} bushook_t; - -#define BUS_MAIN 1 /* mainbus */ -#define BUS_ISABR 2 /* ISA Bridge Bus */ -#define BUS_PCIBR 3 /* PCI bridge */ -#define BUS_VMEBR 4 /* VME bridge */ - -#define BUS_INTR_ESTABLISH(ca, handler, val) \ - (*(ca)->ca_bus->bh_intr_establish)((ca), (handler), (val)) -#define BUS_INTR_DISESTABLISH(ca) \ - (*(ca)->ca_bus->bh_intr_establish)(ca) -#define BUS_CVTADDR(ca) \ - (*(ca)->ca_bus->bh_cvtaddr)(ca) -#define BUS_MATCHNAME(ca, name) \ - (*(ca)->ca_bus->bh_matchname)((ca), (name)) - -struct confargs { - char *ca_name; /* Device name. */ - bushook_t *ca_bus; /* bus device resides on. */ - /* macobio hooks ?? - XXX reinvestigate usage */ - bus_space_tag_t ca_iot; - bus_space_tag_t ca_memt; /* XXX */ - bus_dma_tag_t ca_dmat; - u_int32_t ca_node; - int ca_nreg; - u_int32_t *ca_reg; - int ca_nintr; - int32_t *ca_intr; - u_int ca_baseaddr; - -}; - -void set_clockintr(void (*)(struct clockframe *)); -void set_iointr(void (*)(void *, int)); -int badaddr(void *, u_int32_t); -void calc_delayconst(void); -void ofrootfound(void); - -typedef int intr_handle_t; -typedef void *(intr_establish_t)(void *, intr_handle_t, - int, int, int (*func)(void *), void *, char *); -typedef void (intr_disestablish_t)(void *, void *); - -intr_establish_t intr_establish; -intr_disestablish_t ntr_disestablish; -extern intr_establish_t *intr_establish_func; -extern intr_disestablish_t *intr_disestablish_func; - -#endif /* _MACHINE_AUTOCONF_H_ */ diff --git a/sys/arch/pegasos/include/bat.h b/sys/arch/pegasos/include/bat.h deleted file mode 100644 index fb2983d84b6..00000000000 --- a/sys/arch/pegasos/include/bat.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: bat.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/bat.h> diff --git a/sys/arch/pegasos/include/bus.h b/sys/arch/pegasos/include/bus.h deleted file mode 100644 index 302ba5ea65e..00000000000 --- a/sys/arch/pegasos/include/bus.h +++ /dev/null @@ -1,653 +0,0 @@ -/* $OpenBSD: bus.h,v 1.2 2004/02/04 20:07:18 drahn Exp $ */ - -/* - * Copyright (c) 1997 Per Fogelstrom. All rights reserved. - * Copyright (c) 1996 Niklas Hallqvist. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christopher G. Demetriou - * for the NetBSD Project. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MACHINE_BUS_H_ -#define _MACHINE_BUS_H_ - -#include <machine/pio.h> - -#ifdef __STDC__ -#define CAT(a,b) a##b -#define CAT3(a,b,c) a##b##c -#else -#define CAT(a,b) a/**/b -#define CAT3(a,b,c) a/**/b/**/c -#endif - -/* - * Bus access types. - */ -typedef u_long bus_addr_t; -typedef u_int32_t bus_size_t; -typedef u_int32_t bus_space_handle_t; -typedef struct ppc_bus_space *bus_space_tag_t; - -struct ppc_bus_space { - u_int32_t bus_base; - u_int32_t bus_size; - u_int8_t bus_reverse; /* Reverse bytes */ - u_int8_t bus_io; /* IO or memory */ -}; -#define POWERPC_BUS_TAG_BASE(x) ((x)->bus_base) - -extern struct ppc_bus_space ppc_isa_io, ppc_isa_mem; - -/* - * Access methods for bus resources - */ -int bus_space_map(bus_space_tag_t t, bus_addr_t addr, - bus_size_t size, int cacheable, bus_space_handle_t *bshp); -void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size); -int bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp); -int bus_space_alloc(bus_space_tag_t tag, bus_addr_t rstart, - bus_addr_t rend, bus_size_t size, bus_size_t alignment, - bus_size_t boundary, int cacheable, bus_addr_t *addrp, - bus_space_handle_t *handlep); -void bus_space_free(bus_space_tag_t tag, bus_space_handle_t handle, - bus_size_t size); - -#define bus_space_read(n,m) \ -static __inline CAT3(u_int,m,_t) \ -CAT(bus_space_read_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ - bus_addr_t ba) \ -{ \ - if(bst->bus_reverse) \ - return CAT3(in,m,rb)((volatile CAT3(u_int,m,_t) *)(bsh + (ba))); \ - else \ - return CAT(in,m)((volatile CAT3(u_int,m,_t) *)(bsh + (ba))); \ -} - -bus_space_read(1,8) -bus_space_read(2,16) -bus_space_read(4,32) - -#define bus_space_read_8 !!! bus_space_read_8 unimplemented !!! - -#define bus_space_write(n,m) \ -static __inline void \ -CAT(bus_space_write_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ - bus_addr_t ba, CAT3(u_int,m,_t) x) \ -{ \ - if(bst->bus_reverse) \ - CAT3(out,m,rb)((volatile CAT3(u_int,m,_t) *)(bsh + (ba)), x); \ - else \ - CAT(out,m)((volatile CAT3(u_int,m,_t) *)(bsh + (ba)), x); \ -} - -bus_space_write(1,8) -bus_space_write(2,16) -bus_space_write(4,32) - -#define bus_space_write_8 !!! bus_space_write_8 unimplemented !!! - -#define bus_space_read_multi(n, m) \ -static __inline void \ -CAT(bus_space_read_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ - bus_size_t ba, CAT3(u_int,m,_t) *buf, bus_size_t cnt) \ -{ \ - while (cnt--) \ - *buf++ = CAT(bus_space_read_,n)(bst, bsh, ba); \ -} - -bus_space_read_multi(1,8) -bus_space_read_multi(2,16) -bus_space_read_multi(4,32) - -#define bus_space_read_multi_8 !!! bus_space_read_multi_8 not implemented !!! - - -#define bus_space_write_multi_8 !!! bus_space_write_multi_8 not implemented !!! - -#define bus_space_write_multi(n, m) \ -static __inline void \ -CAT(bus_space_write_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ - bus_size_t ba, const CAT3(u_int,m,_t) *buf, bus_size_t cnt) \ -{ \ - while (cnt--) \ - CAT(bus_space_write_,n)(bst, bsh, ba, *buf++); \ -} - -bus_space_write_multi(1,8) -bus_space_write_multi(2,16) -bus_space_write_multi(4,32) - -#define bus_space_write_multi_8 !!! bus_space_write_multi_8 not implemented !!! - -/* - * void bus_space_read_region_N(bus_space_tag_t tag, - * bus_space_handle_t bsh, bus_size_t offset, - * u_intN_t *addr, size_t count); - * - * Read `count' 1, 2, 4, or 8 byte quantities from bus space - * described by tag/handle and starting at `offset' and copy into - * buffer provided. - */ -#define __BA(t, h, o) ((void *)((h) + (o))) - -static __inline void -bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, - bus_size_t offset, u_int8_t *addr, size_t count) -{ - volatile u_int8_t *s = __BA(tag, bsh, offset); - - while (count--) - *addr++ = *s++; - __asm __volatile("eieio; sync"); -} - -static __inline void -bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, - bus_size_t offset, u_int16_t *addr, size_t count) -{ - volatile u_int16_t *s = __BA(tag, bsh, offset); - - if (tag->bus_reverse) { - while (count--) - __asm __volatile("lhbrx %0, 0, %1" : - "=r"(*addr++) : "r"(s++)); - } else { - while (count--) - *(addr++) = *(s++); - } - __asm __volatile("eieio; sync"); -} - -static __inline void -bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, - bus_size_t offset, u_int32_t *addr, size_t count) -{ - volatile u_int32_t *s = __BA(tag, bsh, offset); - - if (tag->bus_reverse) { - while (count--) - __asm __volatile("lwbrx %0, 0, %1" : - "=r"(*addr++) : "r"(s++)); - } else { - while (count--) - *(addr++) = *(s++); - } - __asm __volatile("eieio; sync"); -} - -#if 0 /* Cause a link error for bus_space_read_region_8 */ -#define bus_space_read_region_8 !!! unimplemented !!! -#endif - - -/* - * void bus_space_write_region_N(bus_space_tag_t tag, - * bus_space_handle_t bsh, bus_size_t offset, - * const u_intN_t *addr, size_t count); - * - * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided - * to bus space described by tag/handle starting at `offset'. - */ - -static __inline void -bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, - bus_size_t offset, const u_int8_t *addr, size_t count) -{ - volatile u_int8_t *d = __BA(tag, bsh, offset); - - while (count--) - *d++ = *addr++; - __asm __volatile("eieio; sync"); -} - -static __inline void -bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, - bus_size_t offset, const u_int16_t *addr, size_t count) -{ - volatile u_int16_t *d = __BA(tag, bsh, offset); - - if (tag->bus_reverse) { - while (count--) - __asm __volatile("sthbrx %0, 0, %1" :: - "r"(*addr++), "r"(d++)); - } else { - while (count--) - *(d++) = (*addr++); - } - __asm __volatile("eieio; sync"); -} - -static __inline void -bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, - bus_size_t offset, const u_int32_t *addr, size_t count) -{ - volatile u_int32_t *d = __BA(tag, bsh, offset); - - if (tag->bus_reverse) { - while (count--) - __asm __volatile("stwbrx %0, 0, %1" :: - "r"(*addr++), "r"(d++)); - } else { - while (count--) - *(d++) = (*addr++); - } - __asm __volatile("eieio; sync"); -} - -#if 0 -#define bus_space_write_region_8 !!! bus_space_write_region_8 unimplemented !!! -#endif - -/* - * void bus_space_read_raw_region_N(bus_space_tag_t tag, - * bus_space_handle_t bsh, bus_size_t offset, - * u_intN_t *addr, size_t count); - * - * Read `count' bytes from bus space described by tag/handle and starting - * at `offset' and copy into buffer provided w/o bus-host byte swapping. - */ - -static __inline void -bus_space_read_raw_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, - bus_size_t offset, u_int8_t *addr, size_t count) -{ - volatile u_int16_t *s = __BA(tag, bsh, offset); - u_int16_t *laddr = (void *)addr; - - while (count--) - *laddr++ = *s++; - __asm __volatile("eieio; sync"); -} - -static __inline void -bus_space_read_raw_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, - bus_size_t offset, u_int8_t *addr, size_t count) -{ - volatile u_int32_t *s = __BA(tag, bsh, offset); - u_int32_t *laddr = (void *)addr; - - while (count--) - *laddr++ = *s++; - __asm __volatile("eieio; sync"); -} - -#if 0 /* Cause a link error for bus_space_read_raw_region_8 */ -#define bus_space_read_raw_region_8 \ - !!! bus_space_read_raw_region_8 unimplemented !!! -#endif - - -/* - * void bus_space_write_raw_region_N(bus_space_tag_t tag, - * bus_space_handle_t bsh, bus_size_t offset, - * const u_intN_t *addr, size_t count); - * - * Write `count' bytes from the buffer provided to bus space described - * by tag/handle starting at `offset' w/o host-bus byte swapping. - */ - -static __inline void -bus_space_write_raw_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, - bus_size_t offset, const u_int8_t *addr, size_t count) -{ - volatile u_int16_t *d = __BA(tag, bsh, offset); - const u_int16_t *laddr = (void *)addr; - - while (count--) - *d++ = *laddr++; - __asm __volatile("eieio; sync"); -} - -static __inline void -bus_space_write_raw_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, - bus_size_t offset, const u_int8_t *addr, size_t count) -{ - volatile u_int32_t *d = __BA(tag, bsh, offset); - const u_int32_t *laddr = (void *)addr; - - while (count--) - *d++ = *laddr++; - __asm __volatile("eieio; sync"); -} - -#if 0 -#define bus_space_write_raw_region_8 \ - !!! bus_space_write_raw_region_8 unimplemented !!! -#endif - -/* - * void bus_space_set_multi_N(bus_space_tag_t tag, - * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, - * size_t count); - * - * Write the 1, 2, 4, or 8 byte value `val' to bus space described - * by tag/handle/offset `count' times. - */ -static __inline void bus_space_set_multi_1(bus_space_tag_t, - bus_space_handle_t, bus_size_t, u_int8_t, size_t); -static __inline void bus_space_set_multi_2(bus_space_tag_t, - bus_space_handle_t, bus_size_t, u_int16_t, size_t); -static __inline void bus_space_set_multi_4(bus_space_tag_t, - bus_space_handle_t, bus_size_t, u_int32_t, size_t); - -static __inline void -bus_space_set_multi_1(tag, bsh, offset, val, count) - bus_space_tag_t tag; - bus_space_handle_t bsh; - bus_size_t offset; - u_int8_t val; - size_t count; -{ - volatile u_int8_t *d = __BA(tag, bsh, offset); - - while (count--) - *d = val; - __asm__ volatile("eieio; sync"); -} - -static __inline void -bus_space_set_multi_2(tag, bsh, offset, val, count) - bus_space_tag_t tag; - bus_space_handle_t bsh; - bus_size_t offset; - u_int16_t val; - size_t count; -{ - volatile u_int16_t *d = __BA(tag, bsh, offset); - - while (count--) - __asm__ volatile("sthbrx %0, 0, %1" :: - "r"(val), "r"(d)); - __asm__ volatile("eieio; sync"); -} - -static __inline void -bus_space_set_multi_4(tag, bsh, offset, val, count) - bus_space_tag_t tag; - bus_space_handle_t bsh; - bus_size_t offset; - u_int32_t val; - size_t count; -{ - volatile u_int32_t *d = __BA(tag, bsh, offset); - - while (count--) - __asm__ volatile("stwbrx %0, 0, %1" :: - "r"(val), "r"(d)); - __asm__ volatile("eieio; sync"); -} - -#define bus_space_set_multi_8 !!! bus_space_set_multi_8 unimplemented !!! - -/* These are OpenBSD extensions to the general NetBSD bus interface. */ -void -bus_space_read_raw_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_addr_t ba, u_int8_t *dst, bus_size_t size); -void -bus_space_read_raw_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_addr_t ba, u_int8_t *dst, bus_size_t size); -#define bus_space_read_raw_multi_8 \ - !!! bus_space_read_raw_multi_8 not implemented !!! - -void -bus_space_write_raw_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_addr_t ba, const u_int8_t *src, bus_size_t size); -void -bus_space_write_raw_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_addr_t ba, const u_int8_t *src, bus_size_t size); -#define bus_space_write_raw_multi_8 \ - !!! bus_space_write_raw_multi_8 not implemented !!! - -void -bus_space_set_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - u_int8_t val, bus_size_t c); -void -bus_space_set_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - u_int16_t val, bus_size_t c); -void -bus_space_set_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - u_int32_t val, bus_size_t c); -#define bus_space_set_region_8 \ - !!! bus_space_set_region_8 not implemented !!! - -void -bus_space_copy_1(void *v, bus_space_handle_t h1, bus_space_handle_t h2, - bus_size_t o1, bus_size_t o2, bus_size_t c); -void -bus_space_copy_2(void *v, bus_space_handle_t h1, bus_space_handle_t h2, - bus_size_t o1, bus_size_t o2, bus_size_t c); -void -bus_space_copy_4(void *v, bus_space_handle_t h1, bus_space_handle_t h2, - bus_size_t o1, bus_size_t o2, bus_size_t c); -#define bus_space_copy_8 \ - !!! bus_space_write_raw_multi_8 not implemented !!! - -/* - * Bus read/write barrier methods. - * - * void bus_space_barrier(bus_space_tag_t tag, - * bus_space_handle_t bsh, bus_size_t offset, - * bus_size_t len, int flags); - * - * Note: powerpc does not currently implement barriers, but we must - * provide the flags to MI code. - * the processor does have eieio which is effectively the barrier - * operator, however due to how memory is mapped this should? not - * be required. - */ -#define bus_space_barrier(t, h, o, l, f) \ - ((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f))) -#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */ -#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ -/* Compatibility defines */ -#define BUS_BARRIER_READ BUS_SPACE_BARRIER_READ -#define BUS_BARRIER_WRITE BUS_SPACE_BARRIER_WRITE - - -#define BUS_DMA_WAITOK 0x000 /* safe to sleep (pseudo-flag) */ -#define BUS_DMA_NOWAIT 0x001 /* not safe to sleep */ -#define BUS_DMA_ALLOCNOW 0x002 /* perform resource allocation now */ -#define BUS_DMAMEM_NOSYNC 0x004 -#define BUS_DMA_COHERENT 0x008 /* hint: map memory DMA coherent */ -#define BUS_DMA_BUS1 0x010 /* placeholders for bus functions... */ -#define BUS_DMA_BUS2 0x020 -#define BUS_DMA_BUS3 0x040 -#define BUS_DMA_BUS4 0x080 -#define BUS_DMA_READ 0x100 /* mapping is device -> memory only */ -#define BUS_DMA_WRITE 0x200 /* mapping is memory -> device only */ -#define BUS_DMA_STREAMING 0x400 /* hint: sequential, unidirectional */ - - -/* Forwards needed by prototypes below. */ -struct mbuf; -struct proc; -struct uio; - -#define BUS_DMASYNC_POSTREAD 0x01 -#define BUS_DMASYNC_POSTWRITE 0x02 -#define BUS_DMASYNC_PREREAD 0x04 -#define BUS_DMASYNC_PREWRITE 0x08 - -typedef struct powerpc_bus_dma_tag *bus_dma_tag_t; -typedef struct powerpc_bus_dmamap *bus_dmamap_t; - -/* - * bus_dma_segment_t - * - * Describes a single contiguous DMA transaction. Values - * are suitable for programming into DMA registers. - */ -struct powerpc_bus_dma_segment { - bus_addr_t ds_addr; /* DMA address */ - bus_size_t ds_len; /* length of transfer */ -}; -typedef struct powerpc_bus_dma_segment bus_dma_segment_t; - -/* - * bus_dma_tag_t - * - * A machine-dependent opaque type describing the implementation of - * DMA for a given bus. - */ - -struct powerpc_bus_dma_tag { - void *_cookie; /* cookie used in the guts */ - - /* - * DMA mapping methods. - */ - int (*_dmamap_create)(bus_dma_tag_t , bus_size_t, int, - bus_size_t, bus_size_t, int, bus_dmamap_t *); - void (*_dmamap_destroy)(bus_dma_tag_t , bus_dmamap_t); - int (*_dmamap_load)(bus_dma_tag_t , bus_dmamap_t, void *, - bus_size_t, struct proc *, int); - int (*_dmamap_load_mbuf)(bus_dma_tag_t , bus_dmamap_t, - struct mbuf *, int); - int (*_dmamap_load_uio)(bus_dma_tag_t , bus_dmamap_t, - struct uio *, int); - int (*_dmamap_load_raw)(bus_dma_tag_t , bus_dmamap_t, - bus_dma_segment_t *, int, bus_size_t, int); - void (*_dmamap_unload)(bus_dma_tag_t , bus_dmamap_t); - void (*_dmamap_sync)(bus_dma_tag_t , bus_dmamap_t, - bus_addr_t, bus_size_t, int); - - /* - * DMA memory utility functions. - */ - int (*_dmamem_alloc)(bus_dma_tag_t, bus_size_t, bus_size_t, - bus_size_t, bus_dma_segment_t *, int, int *, int); - void (*_dmamem_free)(bus_dma_tag_t, bus_dma_segment_t *, int); - int (*_dmamem_map)(bus_dma_tag_t, bus_dma_segment_t *, - int, size_t, caddr_t *, int); - void (*_dmamem_unmap)(bus_dma_tag_t, caddr_t, size_t); - paddr_t (*_dmamem_mmap)(bus_dma_tag_t, bus_dma_segment_t *, - int, off_t, int, int); -}; - -#define bus_dmamap_create(t, s, n, m, b, f, p) \ - (*(t)->_dmamap_create)((t), (s), (n), (m), (b), (f), (p)) -#define bus_dmamap_destroy(t, p) \ - (*(t)->_dmamap_destroy)((t), (p)) -#define bus_dmamap_load(t, m, b, s, p, f) \ - (*(t)->_dmamap_load)((t), (m), (b), (s), (p), (f)) -#define bus_dmamap_load_mbuf(t, m, b, f) \ - (*(t)->_dmamap_load_mbuf)((t), (m), (b), (f)) -#define bus_dmamap_load_uio(t, m, u, f) \ - (*(t)->_dmamap_load_uio)((t), (m), (u), (f)) -#define bus_dmamap_load_raw(t, m, sg, n, s, f) \ - (*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f)) -#define bus_dmamap_unload(t, p) \ - (*(t)->_dmamap_unload)((t), (p)) -#define bus_dmamap_sync(t, p, a, l, o) \ - (void)((t)->_dmamap_sync ? \ - (*(t)->_dmamap_sync)((t), (p), (a), (l), (o)) : (void)0) - -#define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \ - (*(t)->_dmamem_alloc)((t)->_cookie, (s), (a), (b), (sg), (n), (r), (f)) -#define bus_dmamem_free(t, sg, n) \ - (*(t)->_dmamem_free)((t)->_cookie, (sg), (n)) -#define bus_dmamem_map(t, sg, n, s, k, f) \ - (*(t)->_dmamem_map)((t)->_cookie, (sg), (n), (s), (k), (f)) -#define bus_dmamem_unmap(t, k, s) \ - (*(t)->_dmamem_unmap)((t)->_cookie, (k), (s)) -#define bus_dmamem_mmap(t, sg, n, o, p, f) \ - (*(t)->_dmamem_mmap)((t)->_cookie, (sg), (n), (o), (p), (f)) - -int _dmamap_create(bus_dma_tag_t, bus_size_t, int, - bus_size_t, bus_size_t, int, bus_dmamap_t *); -void _dmamap_destroy(bus_dma_tag_t, bus_dmamap_t); -int _dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *, - bus_size_t, struct proc *, int); -int _dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t, struct mbuf *, int); -int _dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *, int); -int _dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t, - bus_dma_segment_t *, int, bus_size_t, int); -void _dmamap_unload(bus_dma_tag_t, bus_dmamap_t); -void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, bus_size_t, - int); - -int _dmamem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t, - bus_size_t, bus_dma_segment_t *, int, int *, int); -void _dmamem_free(bus_dma_tag_t, bus_dma_segment_t *, int); -int _dmamem_map(bus_dma_tag_t, bus_dma_segment_t *, - int, size_t, caddr_t *, int); -void _dmamem_unmap(bus_dma_tag_t, caddr_t, size_t); -paddr_t _dmamem_mmap(bus_dma_tag_t, bus_dma_segment_t *, int, off_t, int, int); - -/* - * bus_dmamap_t - * - * Describes a DMA mapping. - */ -struct powerpc_bus_dmamap { - /* - * PRIVATE MEMBERS: not for use by machine-independent code. - */ - bus_size_t _dm_size; /* largest DMA transfer mappable */ - int _dm_segcnt; /* number of segs this map can map */ - bus_size_t _dm_maxsegsz; /* largest possible segment */ - bus_size_t _dm_boundary; /* don't cross this */ - int _dm_flags; /* misc. flags */ - - void *_dm_cookie; /* cookie for bus-specific functions */ - - /* - * PUBLIC MEMBERS: these are used by machine-independent code. - */ - bus_size_t dm_mapsize; /* size of the mapping */ - int dm_nsegs; /* # valid segments in mapping */ - bus_dma_segment_t dm_segs[1]; /* segments; variable length */ -}; - -/* XXXXXXX */ -/* ARGH, better than machine/types.h */ -#define __HAVE_NWSCONS - -/* This architecture does not support accessing ISA memory/io space - * via the PCI memory/io descriptors - * drivers must use these instead. - * It is possible for the machine to have two seperate ISA I/O spaces, - * one which the kbd/mouse controller uses, and one for - * the display, And of course neither of these is in the normal PCI - * spaces. - * To allow this flexibility, HAVE seperate MD defines for 'normal' - * isa stuff such as keyboard/mouse and one for display for the primary - * display. It is perfectly legal for these to reference the same object - * or even the same variable. - */ -#define MD_ISA_IOT ppc_isa_iobus_space -#define MD_ISA_MEMT ppc_isa_membus_space -#define MD_DISPLAY_ISA_IOT ppc_display_isa_iobus_space -#define MD_DISPLAY_ISA_MEMT ppc_display_isa_membus_space -extern struct ppc_bus_space *ppc_isa_iobus_space; -extern struct ppc_bus_space *ppc_isa_membus_space; -extern struct ppc_bus_space *ppc_display_isa_iobus_space; -extern struct ppc_bus_space *ppc_display_isa_membus_space; - -#endif /* _MACHINE_BUS_H_ */ diff --git a/sys/arch/pegasos/include/cdefs.h b/sys/arch/pegasos/include/cdefs.h deleted file mode 100644 index defc2d5b8ae..00000000000 --- a/sys/arch/pegasos/include/cdefs.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: cdefs.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/cdefs.h> diff --git a/sys/arch/pegasos/include/conf.h b/sys/arch/pegasos/include/conf.h deleted file mode 100644 index 2e60ef5c849..00000000000 --- a/sys/arch/pegasos/include/conf.h +++ /dev/null @@ -1,37 +0,0 @@ -/* $OpenBSD: conf.h,v 1.2 2004/01/22 21:41:14 miod Exp $ */ -/* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */ - -/* - * Copyright (c) 1996 Christos Zoulas. 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 Christos Zoulas. - * 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/conf.h> - -#define mmread mmrw -#define mmwrite mmrw -cdev_decl(mm); diff --git a/sys/arch/pegasos/include/cpu.h b/sys/arch/pegasos/include/cpu.h deleted file mode 100644 index 2fa73e8ae69..00000000000 --- a/sys/arch/pegasos/include/cpu.h +++ /dev/null @@ -1,50 +0,0 @@ -/* $OpenBSD: cpu.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* $NetBSD: cpu.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */ - -/* - * Copyright (C) 1995, 1996 Wolfgang Solfrank. - * Copyright (C) 1995, 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _MACHINE_CPU_H_ -#define _MACHINE_CPU_H_ - -#include <powerpc/cpu.h> - -/* - * CTL_MACHDEP definitions. - */ -#define CPU_ALLOWAPERTURE 1 /* allow mmap of /dev/xf86 */ -#define CPU_MAXID 2 /* number of valid machdep ids */ - -#define CTL_MACHDEP_NAMES { \ - { 0, 0 }, \ - { "allowaperture", CTLTYPE_INT }, \ -} - -#endif /* _MACHINE_CPU_H_ */ diff --git a/sys/arch/pegasos/include/db_machdep.h b/sys/arch/pegasos/include/db_machdep.h deleted file mode 100644 index 6b52a18cac8..00000000000 --- a/sys/arch/pegasos/include/db_machdep.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: db_machdep.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/db_machdep.h> diff --git a/sys/arch/pegasos/include/disklabel.h b/sys/arch/pegasos/include/disklabel.h deleted file mode 100644 index 6357be2124a..00000000000 --- a/sys/arch/pegasos/include/disklabel.h +++ /dev/null @@ -1,172 +0,0 @@ -/* $OpenBSD: disklabel.h,v 1.2 2003/11/13 23:00:54 drahn Exp $ */ - -/* - * Copyright (c) 1994 Christopher G. Demetriou - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christopher G. Demetriou. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MACHINE_DISKLABEL_H_ -#define _MACHINE_DISKLABEL_H_ - -#include <machine/rdb.h> - -#define LABELSECTOR 1 /* sector containing label */ -#define LABELOFFSET 0 /* offset of label in sector */ -#define MAXPARTITIONS 16 /* number of partitions */ -#define RAW_PART 2 /* raw partition: ie. rsd0c */ - -/* MBR partition table */ -#define DOSBBSECTOR 0 /* MBR sector number */ -#define DOSPARTOFF 446 /* Offset of MBR partition table */ -#define NDOSPART 4 /* # of partitions in MBR */ -#define DOSMAGICOFF 510 /* Offset of magic number */ -#define DOSMAGIC 0xaa55 /* Actual magic number */ -#define MBRMAGIC DOSMAGIC -#define DOSMBR_SIGNATURE MBRMAGIC -#define DOSMBR_SIGNATURE_OFF DOSMAGICOFF -#define DOSACTIVE 0x80 - -struct dos_partition { - unsigned char dp_flag; /* default boot flag */ - unsigned char dp_shd; /* start head, IsN't Always Meaningful */ - unsigned char dp_ssect; /* start sector, INAM */ - unsigned char dp_scyl; /* start cylinder, INAM */ - unsigned char dp_typ; /* partition type */ - unsigned char dp_ehd; /* end head, INAM */ - unsigned char dp_esect; /* end sector, INAM */ - unsigned char dp_ecyl; /* end cylinder, INAM */ - unsigned long dp_start; /* absolute start sector number */ - unsigned long dp_size; /* partition size in sectors */ -}; - -/* Known DOS partition types. */ -#define DOSPTYP_UNUSED 0x00 /* Unused partition */ -#define DOSPTYP_FAT12 0x01 /* 12-bit FAT */ -#define DOSPTYP_FAT16S 0x04 /* 16-bit FAT, less than 32M */ -#define DOSPTYP_EXTEND 0x05 /* Extended; contains sub-partitions */ -#define DOSPTYP_FAT16B 0x06 /* 16-bit FAT, more than 32M */ -#define DOSPTYP_FAT32 0x0b /* 32-bit FAT */ -#define DOSPTYP_FAT32L 0x0c /* 32-bit FAT, LBA-mapped */ -#define DOSPTYP_FAT16C 0x0e /* 16-bit FAT, CHS-mapped */ -#define DOSPTYP_EXTENDL 0x0f /* Extended, LBA-mapped; contains sub-partitions */ -#define DOSPTYP_ONTRACK 0x54 -#define DOSPTYP_LINUX 0x83 /* That other thing */ -#define DOSPTYP_FREEBSD 0xa5 /* FreeBSD partition type */ -#define DOSPTYP_OPENBSD 0xa6 /* OpenBSD partition type */ -#define DOSPTYP_NETBSD 0xa9 /* NetBSD partition type */ - -#include <sys/dkbad.h> - -/* Isolate the relevant bits to get sector and cylinder. */ -#define DPSECT(s) ((s) & 0x3f) -#define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2)) - -static __inline u_int32_t get_le(void *p); - -static __inline u_int32_t -#ifdef __cplusplus -get_le(void *p) -#else -get_le(p) - void *p; -#endif -{ - u_int8_t *_p = (u_int8_t *)p; - int x; - x = _p[0]; - x |= _p[1] << 8; - x |= _p[2] << 16; - x |= _p[3] << 24; - return x; -} - -/* HFS/DPME */ - -/* partition map structure from Inside Macintosh: Devices, SCSI Manager - * pp. 13-14. The partition map always begins on physical block 1. - * - * With the exception of block 0, all blocks on the disk must belong to - * exactly one partition. The partition map itself belongs to a partition - * of type `APPLE_PARTITION_MAP', and is not limited in size by anything - * other than available disk space. The partition map is not necessarily - * the first partition listed. - */ -struct part_map_entry { -#define PART_ENTRY_MAGIC 0x504d - u_int16_t pmSig; /* partition signature */ - u_int16_t pmSigPad; /* (reserved) */ - u_int32_t pmMapBlkCnt; /* number of blocks in partition map */ - u_int32_t pmPyPartStart; /* first physical block of partition */ - u_int32_t pmPartBlkCnt; /* number of blocks in partition */ - char pmPartName[32]; /* partition name */ - char pmPartType[32]; /* partition type */ - u_int32_t pmLgDataStart; /* first logical block of data area */ - u_int32_t pmDataCnt; /* number of blocks in data area */ - u_int32_t pmPartStatus; /* partition status information */ - u_int32_t pmLgBootStart; /* first logical block of boot code */ - u_int32_t pmBootSize; /* size of boot code, in bytes */ - u_int32_t pmBootLoad; /* boot code load address */ - u_int32_t pmBootLoad2; /* (reserved) */ - u_int32_t pmBootEntry; /* boot code entry point */ - u_int32_t pmBootEntry2; /* (reserved) */ - u_int32_t pmBootCksum; /* boot code checksum */ - char pmProcessor[16]; /* processor type (e.g. "68020") */ - u_int8_t pmBootArgs[128]; /* A/UX boot arguments */ - /* we do not index the disk image as an array, - * leave out the on disk padding - */ -#if 0 - u_int8_t pad[248]; /* pad to end of block */ -#endif -}; - -#define PART_TYPE_DRIVER "APPLE_DRIVER" -#define PART_TYPE_DRIVER43 "APPLE_DRIVER43" -#define PART_TYPE_DRIVERATA "APPLE_DRIVER_ATA" -#define PART_TYPE_DRIVERIOKIT "APPLE_DRIVER_IOKIT" -#define PART_TYPE_FWDRIVER "APPLE_FWDRIVER" -#define PART_TYPE_FWB_COMPONENT "FWB DRIVER COMPONENTS" -#define PART_TYPE_FREE "APPLE_FREE" -#define PART_TYPE_MAC "APPLE_HFS" -#define PART_TYPE_OPENBSD "OPENBSD" - - -struct cpu_disklabel { - struct dos_partition dosparts[NDOSPART]; - /* only store first entry and openbsd partition */ - struct part_map_entry macparts[2]; - struct dkbad bad; - int rdblock; - int rd_bsdlbl; - int pbindex[MAXPARTITIONS]; - int pblist[MAXPARTITIONS]; -}; - -#define DKBAD(x) ((x)->bad) - -#endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/pegasos/include/elf_abi.h b/sys/arch/pegasos/include/elf_abi.h deleted file mode 100644 index 9426ab38ddb..00000000000 --- a/sys/arch/pegasos/include/elf_abi.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: elf_abi.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/elf_abi.h> diff --git a/sys/arch/pegasos/include/endian.h b/sys/arch/pegasos/include/endian.h deleted file mode 100644 index 17744119ec9..00000000000 --- a/sys/arch/pegasos/include/endian.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: endian.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/endian.h> diff --git a/sys/arch/pegasos/include/exec.h b/sys/arch/pegasos/include/exec.h deleted file mode 100644 index b7011bdde51..00000000000 --- a/sys/arch/pegasos/include/exec.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: exec.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/exec.h> diff --git a/sys/arch/pegasos/include/float.h b/sys/arch/pegasos/include/float.h deleted file mode 100644 index 7c05877f288..00000000000 --- a/sys/arch/pegasos/include/float.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: float.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/float.h> diff --git a/sys/arch/pegasos/include/fpu.h b/sys/arch/pegasos/include/fpu.h deleted file mode 100644 index ab3b2efb658..00000000000 --- a/sys/arch/pegasos/include/fpu.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: fpu.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/fpu.h> diff --git a/sys/arch/pegasos/include/frame.h b/sys/arch/pegasos/include/frame.h deleted file mode 100644 index a3f29d00e31..00000000000 --- a/sys/arch/pegasos/include/frame.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: frame.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/frame.h> diff --git a/sys/arch/pegasos/include/ieee.h b/sys/arch/pegasos/include/ieee.h deleted file mode 100644 index 201a46ee553..00000000000 --- a/sys/arch/pegasos/include/ieee.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: ieee.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/ieee.h> diff --git a/sys/arch/pegasos/include/ieeefp.h b/sys/arch/pegasos/include/ieeefp.h deleted file mode 100644 index cfe7e9074b7..00000000000 --- a/sys/arch/pegasos/include/ieeefp.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: ieeefp.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/ieeefp.h> diff --git a/sys/arch/pegasos/include/internal_types.h b/sys/arch/pegasos/include/internal_types.h deleted file mode 100644 index 3c1c41257bc..00000000000 --- a/sys/arch/pegasos/include/internal_types.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: internal_types.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* Public domain */ -#include <powerpc/internal_types.h> diff --git a/sys/arch/pegasos/include/intr.h b/sys/arch/pegasos/include/intr.h deleted file mode 100644 index f86d1267ce1..00000000000 --- a/sys/arch/pegasos/include/intr.h +++ /dev/null @@ -1,6 +0,0 @@ -/* $OpenBSD: intr.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/intr.h> -#ifndef _LOCORE -void softtty(void); -#endif diff --git a/sys/arch/pegasos/include/kcore.h b/sys/arch/pegasos/include/kcore.h deleted file mode 100644 index 4921e3a42c5..00000000000 --- a/sys/arch/pegasos/include/kcore.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: kcore.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/kcore.h> diff --git a/sys/arch/pegasos/include/limits.h b/sys/arch/pegasos/include/limits.h deleted file mode 100644 index a4b16aeb4a5..00000000000 --- a/sys/arch/pegasos/include/limits.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: limits.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/limits.h> diff --git a/sys/arch/pegasos/include/loadfile_machdep.h b/sys/arch/pegasos/include/loadfile_machdep.h deleted file mode 100644 index 53fa692f01f..00000000000 --- a/sys/arch/pegasos/include/loadfile_machdep.h +++ /dev/null @@ -1,57 +0,0 @@ -/* $OpenBSD: loadfile_machdep.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* $NetBSD: loadfile_machdep.h,v 1.1 1999/04/29 03:17:12 tsubai Exp $ */ - -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Christos Zoulas. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#define BOOT_ELF -#define ELFSIZE 32 - -#define LOAD_KERNEL (LOAD_ALL & ~LOAD_TEXTA) -#define COUNT_KERNEL (COUNT_ALL & ~COUNT_TEXTA) - -#define LOADADDR(a) (((u_long)(a)) + offset) -#define ALIGNENTRY(a) ((u_long)(a)) -#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c)) -#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c)) -#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c)) -#define WARN(a) (void)(printf a, \ - printf((errno ? ": %s\n" : "\n"), \ - strerror(errno))) -#define PROGRESS(a) (void) printf a -#define ALLOC(a) alloc(a) -#define FREE(a, b) free(a, b) -#define OKMAGIC(a) ((a) == OMAGIC) diff --git a/sys/arch/pegasos/include/param.h b/sys/arch/pegasos/include/param.h deleted file mode 100644 index 3727cce33a9..00000000000 --- a/sys/arch/pegasos/include/param.h +++ /dev/null @@ -1,70 +0,0 @@ -/* $OpenBSD: param.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* $NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */ - -/*- - * Copyright (C) 1995, 1996 Wolfgang Solfrank. - * Copyright (C) 1995, 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef _KERNEL -#ifndef _LOCORE -#include <machine/cpu.h> -#endif /* _LOCORE */ -#endif - -#include <powerpc/param.h> - -/* - * Machine dependent constants for pegasos (32-bit only currently) - */ -#define MACHINE "pegasos" -#define _MACHINE pegasos - -#define KERNBASE 0x0 - -#define MSGBUFSIZE (NBPG*2) - -/* - * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized - * logical pages. - */ -#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((16 * 1024 * 1024) >> PAGE_SHIFT) - -/* PEGASOS - XXX */ -#ifndef _LOCORE -extern u_int32_t ppc_console_addr; -extern u_int32_t ppc_console_serfreq; -#define CONADDR (ppc_console_addr) -/* -#define COM_FREQ (ppc_console_serfreq) -*/ - -#endif - diff --git a/sys/arch/pegasos/include/pcb.h b/sys/arch/pegasos/include/pcb.h deleted file mode 100644 index eb31cf2c6e3..00000000000 --- a/sys/arch/pegasos/include/pcb.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: pcb.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/pcb.h> diff --git a/sys/arch/pegasos/include/pio.h b/sys/arch/pegasos/include/pio.h deleted file mode 100644 index 3c6ad52e74c..00000000000 --- a/sys/arch/pegasos/include/pio.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: pio.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/pio.h> diff --git a/sys/arch/pegasos/include/pmap.h b/sys/arch/pegasos/include/pmap.h deleted file mode 100644 index 6959bbc6278..00000000000 --- a/sys/arch/pegasos/include/pmap.h +++ /dev/null @@ -1,7 +0,0 @@ -/* $OpenBSD: pmap.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/pmap.h> - -#ifndef _LOCORE -paddr_t vtophys(vaddr_t); -#endif /* _LOCORE */ diff --git a/sys/arch/pegasos/include/powerpc.h b/sys/arch/pegasos/include/powerpc.h deleted file mode 100644 index f49f6bfe579..00000000000 --- a/sys/arch/pegasos/include/powerpc.h +++ /dev/null @@ -1,85 +0,0 @@ -/* $OpenBSD: powerpc.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* $NetBSD: powerpc.h,v 1.1 1996/09/30 16:34:30 ws Exp $ */ - -/* - * Copyright (C) 1996 Wolfgang Solfrank. - * Copyright (C) 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _MACHINE_POWERPC_H_ -#define _MACHINE_POWERPC_H_ - -struct mem_region { - vm_offset_t start; - vm_size_t size; -}; - -void mem_regions(struct mem_region **, struct mem_region **); - -/* - * These two functions get used solely in boot() in machdep.c. - * - * Not sure whether boot itself should be implementation dependent instead. XXX - */ -typedef void (exit_f)(void) /*__attribute__((__noreturn__))*/ ; -typedef void (boot_f)(char *bootspec) /* __attribute__((__noreturn__))*/ ; -typedef void (vmon_f)(void); - -/* firmware interface. - * regardless of type of firmware used several items - * are need from firmware to boot up. - * these include: - * memory information - * vmsetup for firmware calls. - * default character print mechanism ??? - * firmware exit (return) - * firmware boot (reset) - * vmon - tell firmware the bsd vm is active. - */ - -typedef void (mem_regions_f)(struct mem_region **memp, - struct mem_region **availp); - -struct firmware { - mem_regions_f *mem_regions; - exit_f *exit; - boot_f *boot; - vmon_f *vmon; - -#ifdef FW_HAS_PUTC - boot_f *putc; -#endif -}; -extern struct firmware *fw; -int ppc_open_pci_bridge(void); -void ppc_close_pci_bridge(int); -void install_extint(void (*handler) (void)); -void ppc_intr_enable(int enable); -int ppc_intr_disable(void); - -#endif /* _MACHINE_POWERPC_H_ */ diff --git a/sys/arch/pegasos/include/proc.h b/sys/arch/pegasos/include/proc.h deleted file mode 100644 index 83943187428..00000000000 --- a/sys/arch/pegasos/include/proc.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: proc.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/proc.h> diff --git a/sys/arch/pegasos/include/profile.h b/sys/arch/pegasos/include/profile.h deleted file mode 100644 index fbaa7729fca..00000000000 --- a/sys/arch/pegasos/include/profile.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: profile.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/profile.h> diff --git a/sys/arch/pegasos/include/psl.h b/sys/arch/pegasos/include/psl.h deleted file mode 100644 index 34c77f97524..00000000000 --- a/sys/arch/pegasos/include/psl.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: psl.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/psl.h> diff --git a/sys/arch/pegasos/include/pte.h b/sys/arch/pegasos/include/pte.h deleted file mode 100644 index cadb0a00aa6..00000000000 --- a/sys/arch/pegasos/include/pte.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: pte.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/pte.h> diff --git a/sys/arch/pegasos/include/ptrace.h b/sys/arch/pegasos/include/ptrace.h deleted file mode 100644 index cd03d3e723d..00000000000 --- a/sys/arch/pegasos/include/ptrace.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: ptrace.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/ptrace.h> diff --git a/sys/arch/pegasos/include/rbus_machdep.h b/sys/arch/pegasos/include/rbus_machdep.h deleted file mode 100644 index edfa21867bf..00000000000 --- a/sys/arch/pegasos/include/rbus_machdep.h +++ /dev/null @@ -1,64 +0,0 @@ -/* $OpenBSD: rbus_machdep.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* $NetBSD: rbus_machdep.h,v 1.2 1999/10/15 06:43:05 haya Exp $ */ - -/* - * Copyright (c) 1999 - * HAYAKAWA Koichi. 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 HAYAKAWA Koichi. - * 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. - */ - - -#if !defined _ARCH_MACPPC_MACPPC_RBUS_MACHDEP_H_ -#define _ARCH_MACPPC_MACPPC_RBUS_MACHDEP_H_ - -struct pci_attach_args; /* XXX */ - -void _bus_space_unmap(bus_space_tag_t, bus_space_handle_t, - bus_size_t, bus_addr_t *); - -#define md_space_map(bt, physaddr, size, flags, bshp) \ - bus_space_map((bt), (physaddr), (size), (flags), (bshp)) - -/* XXX */ -bus_addr_t bus_space_unmap_p(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size); - - -#define md_space_unmap(bt, bsh, size, adrp) \ - do { \ - *adrp = bus_space_unmap_p((bt), (bsh), (size)); \ - if (bt->bus_io) { \ - *adrp = *adrp & 0xffff; \ - } \ - } while (0) - -rbus_tag_t rbus_pccbb_parent_io(struct device *self, - struct pci_attach_args *pa); -rbus_tag_t rbus_pccbb_parent_mem(struct device *self, - struct pci_attach_args *pa); - -#endif /* _ARCH_MACPPC_MACPPC_RBUS_MACHDEP_H_ */ diff --git a/sys/arch/pegasos/include/rdb.h b/sys/arch/pegasos/include/rdb.h deleted file mode 100644 index 214387f7825..00000000000 --- a/sys/arch/pegasos/include/rdb.h +++ /dev/null @@ -1,229 +0,0 @@ -/* $OpenBSD: rdb.h,v 1.1 2003/11/13 23:00:54 drahn Exp $ */ -/* $NetBSD: disklabel.h,v 1.6 1996/04/21 21:13:19 veego Exp $ */ - -/* - * Copyright (c) 1994 Christian E. Hopps - * 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 Christian E. Hopps. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _ADOS_RDB_H -#define _ADOS_RDB_H - -/* - * describes ados Rigid Disk Blocks - * which are used to partition a drive - */ -#define RDBNULL ((u_long)0xffffffff) -#define RDB_MAXBLOCKS 16 - -/* - * Dos types for identifying file systems - * bsd file systems will be 'N','B',x,y where y is the fstype found in - * disklabel.h (for DOST_DOS it will be the version number) - */ -#define DOST_XXXBSD 0x42534400 /* Old type back compat*/ -#define DOST_NBR 0x4e425200 /* 'NBRx' Netbsd root partition */ -#define DOST_NBS 0x4e425300 /* 'NBS0' Netbsd swap partition */ -#define DOST_NBU 0x4e425500 /* 'NBUx' Netbsd user partition */ -#define DOST_DOS 0x444f5300 /* 'DOSx' AmigaDos partition */ -#define DOST_AMIX 0x554e4900 /* 'UNIx' AmigaDos partition */ -#define DOST_MUFS 0x6d754600 /* 'muFx' AmigaDos partition (muFS) */ -#define DOST_EXT2 0x4c4e5800 /* 'LNX0' Linux fs partition (ext2fs) */ -#define DOST_LNXSWP 0x53575000 /* 'LNX0' Linux swap partition */ -#define DOST_OBSD 0x4f425344 /* 'OBSD' OpenBSD partition table */ - -struct adostype { - u_char archtype; /* see ADT_xxx below */ - u_char fstype; /* byte 3 from amiga dostype */ -}; - -/* archtypes */ -#define ADT_UNKNOWN 0 -#define ADT_AMIGADOS 1 -#define ADT_NETBSDROOT 2 -#define ADT_NETBSDSWAP 3 -#define ADT_NETBSDUSER 4 -#define ADT_AMIX 5 -#define ADT_EXT2 6 - -#define ISFSARCH_NETBSD(adt) \ - ((adt).archtype >= ADT_NETBSDROOT && (adt).archtype <= ADT_NETBSDUSER) - - -/* - * you will find rdblock somewhere in [0, RDBMAXBLOCKS) - */ -#define RDB_MAXBLOCKS 16 - -struct rdblock { - u_long id; /* 'RDSK' */ - u_long nsumlong; /* number of longs in check sum */ - u_long chksum; /* simple additive with wrap checksum */ - u_long hostid; /* scsi target of host */ - u_long nbytes; /* size of disk blocks */ - u_long flags; - u_long badbhead; /* linked list of badblocks */ - u_long partbhead; /* linked list of partblocks */ - u_long fsbhead; /* " " of fsblocks */ - u_long driveinit; - u_long resv1[6]; /* RDBNULL */ - u_long ncylinders; /* number of cylinders on drive */ - u_long nsectors; /* number of sectors per track */ - u_long nheads; /* number of tracks per cylinder */ - u_long interleave; - u_long park; /* only used with st506 i.e. not */ - u_long resv2[3]; - u_long wprecomp; /* start cyl for write precomp */ - u_long reducedwrite; /* start cyl for reduced write current */ - u_long steprate; /* driver step rate in ?s */ - u_long resv3[5]; - u_long rdblowb; /* lowblock of range for rdb's */ - u_long rdbhighb; /* high block of range for rdb's */ - u_long lowcyl; /* low cylinder of partition area */ - u_long highcyl; /* upper cylinder of partition area */ - u_long secpercyl; /* number of sectors per cylinder */ - u_long parkseconds; /* zero if no park needed */ - u_long resv4[2]; - char diskvendor[8]; /* inquiry stuff */ - char diskproduct[16]; /* inquiry stuff */ - char diskrevision[4]; /* inquiry stuff */ - char contvendor[8]; /* inquiry stuff */ - char contproduct[16]; /* inquiry stuff */ - char contrevision[4]; /* inquiry stuff */ -#if never_use_secsize - u_long resv5[0]; -#endif -}; - - -#define RDBF_LAST 0x1 /* last drive available */ -#define RDBF_LASTLUN 0x2 /* last LUN available */ -#define RDBF_LASTUNIT 0x4 /* last target available */ -#define RDBF_NORESELECT 0x8 /* do not use reselect */ -#define RDBF_DISKID 0x10 /* disk id is valid ?? */ -#define RDBF_CTRLID 0x20 /* ctrl id is valid ?? */ -#define RDBF_SYNC 0x40 /* drive supports SCSI synchronous mode */ - -struct ados_environ { - u_long tabsize; /* 0: environ table size */ - u_long sizeblock; /* 1: n long words in a block */ - u_long secorg; /* 2: not used must be zero */ - u_long numheads; /* 3: number of surfaces */ - u_long secperblk; /* 4: must be 1 */ - u_long secpertrk; /* 5: blocks per track */ - u_long resvblocks; /* 6: reserved blocks at start */ - u_long prefac; /* 7: must be 0 */ - u_long interleave; /* 8: normally 1 */ - u_long lowcyl; /* 9: low cylinder of partition */ - u_long highcyl; /* 10: upper cylinder of partition */ - u_long numbufs; /* 11: ados: number of buffers */ - u_long membuftype; /* 12: ados: type of bufmem */ - u_long maxtrans; /* 13: maxtrans the ctrlr supports */ - u_long mask; /* 14: mask for valid address */ - u_long bootpri; /* 15: boot priority for autoboot */ - u_long dostype; /* 16: filesystem type */ - u_long baud; /* 17: serial handler baud rate */ - u_long control; /* 18: control word for fs */ - u_long bootblocks; /* 19: blocks containing boot code */ - u_long fsize; /* 20: file system block size */ - u_long frag; /* 21: allowable frags per block */ - u_long cpg; /* 22: cylinders per group */ -}; - -struct partblock { - u_long id; /* 'PART' */ - u_long nsumlong; /* number of longs in check sum */ - u_long chksum; /* simple additive with wrap checksum */ - u_long hostid; /* scsi target of host */ - u_long next; /* next in chain */ - u_long flags; /* see below */ - u_long resv1[3]; - u_char partname[32]; /* (BCPL) part name (may not be unique) */ - u_long resv2[15]; - struct ados_environ e; -#if never_use_secsize - u_long extra[9]; /* 8 for extra added to environ */ -#endif -}; - -#define PBF_BOOTABLE 0x1 /* partition is bootable */ -#define PBF_NOMOUNT 0x2 /* partition should be mounted */ - -struct badblock { - u_long id; /* 'BADB' */ - u_long nsumlong; /* number of longs in check sum */ - u_long chksum; /* simple additive with wrap checksum */ - u_long hostid; /* scsi target of host */ - u_long next; /* next in chain */ - u_long resv; - struct badblockent { - u_long badblock; - u_long goodblock; - } badtab[0]; /* 61 for secsize == 512 */ -}; - -struct fsblock { - u_long id; /* 'FSHD' */ - u_long nsumlong; /* number of longs in check sum */ - u_long chksum; /* simple additive with wrap checksum */ - u_long hostid; /* scsi target of host */ - u_long next; /* next in chain */ - u_long flags; - u_long resv1[2]; - u_long dostype; /* this is a file system for this type */ - u_long version; /* version of this fs */ - u_long patchflags; /* describes which functions to replace */ - u_long type; /* zero */ - u_long task; /* zero */ - u_long lock; /* zero */ - u_long handler; /* zero */ - u_long stacksize; /* to use when loading handler */ - u_long priority; /* to run the fs at. */ - u_long startup; /* zero */ - u_long lsegblocks; /* linked list of lsegblocks of fs code */ - u_long globalvec; /* bcpl vector not used mostly */ -#if never_use_secsize - u_long resv2[44]; -#endif -}; - -struct lsegblock { - u_long id; /* 'LSEG' */ - u_long nsumlong; /* number of longs in check sum */ - u_long chksum; /* simple additive with wrap checksum */ - u_long hostid; /* scsi target of host */ - u_long next; /* next in chain */ - u_long loaddata[0]; /* load segment data, 123 for secsize == 512 */ -}; - -#define RDBLOCK_ID 0x5244534b /* 'RDSK' */ -#define PARTBLOCK_ID 0x50415254 /* 'PART' */ -#define BADBLOCK_ID 0x42414442 /* 'BADB' */ -#define FSBLOCK_ID 0x46534844 /* 'FSHD' */ -#define LSEGBLOCK_ID 0x4c534547 /* 'LSEG' */ - -#endif /* _ADOS_RDB_H */ diff --git a/sys/arch/pegasos/include/reg.h b/sys/arch/pegasos/include/reg.h deleted file mode 100644 index c0611e05c80..00000000000 --- a/sys/arch/pegasos/include/reg.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: reg.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/reg.h> diff --git a/sys/arch/pegasos/include/reloc.h b/sys/arch/pegasos/include/reloc.h deleted file mode 100644 index 34e73915464..00000000000 --- a/sys/arch/pegasos/include/reloc.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: reloc.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/reloc.h> diff --git a/sys/arch/pegasos/include/setjmp.h b/sys/arch/pegasos/include/setjmp.h deleted file mode 100644 index 7df0f3889f1..00000000000 --- a/sys/arch/pegasos/include/setjmp.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: setjmp.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/setjmp.h> diff --git a/sys/arch/pegasos/include/signal.h b/sys/arch/pegasos/include/signal.h deleted file mode 100644 index 31acbdaacfc..00000000000 --- a/sys/arch/pegasos/include/signal.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: signal.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/signal.h> diff --git a/sys/arch/pegasos/include/spinlock.h b/sys/arch/pegasos/include/spinlock.h deleted file mode 100644 index b35acb598c6..00000000000 --- a/sys/arch/pegasos/include/spinlock.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: spinlock.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/spinlock.h> diff --git a/sys/arch/pegasos/include/stdarg.h b/sys/arch/pegasos/include/stdarg.h deleted file mode 100644 index 9ad11136aee..00000000000 --- a/sys/arch/pegasos/include/stdarg.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: stdarg.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/stdarg.h> diff --git a/sys/arch/pegasos/include/trap.h b/sys/arch/pegasos/include/trap.h deleted file mode 100644 index e8f7df2e1df..00000000000 --- a/sys/arch/pegasos/include/trap.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: trap.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/trap.h> diff --git a/sys/arch/pegasos/include/types.h b/sys/arch/pegasos/include/types.h deleted file mode 100644 index 7774cdf6769..00000000000 --- a/sys/arch/pegasos/include/types.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: types.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/types.h> diff --git a/sys/arch/pegasos/include/va-ppc.h b/sys/arch/pegasos/include/va-ppc.h deleted file mode 100644 index 96ed15b600b..00000000000 --- a/sys/arch/pegasos/include/va-ppc.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: va-ppc.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/va-ppc.h> diff --git a/sys/arch/pegasos/include/varargs.h b/sys/arch/pegasos/include/varargs.h deleted file mode 100644 index 45ce1feaeb2..00000000000 --- a/sys/arch/pegasos/include/varargs.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: varargs.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/varargs.h> diff --git a/sys/arch/pegasos/include/vmparam.h b/sys/arch/pegasos/include/vmparam.h deleted file mode 100644 index 283d92070eb..00000000000 --- a/sys/arch/pegasos/include/vmparam.h +++ /dev/null @@ -1,115 +0,0 @@ -/* $OpenBSD: vmparam.h,v 1.2 2004/01/23 21:20:54 millert Exp $ */ -/* $NetBSD: vmparam.h,v 1.1 1996/09/30 16:34:38 ws Exp $ */ - -/*- - * Copyright (C) 1995, 1996 Wolfgang Solfrank. - * Copyright (C) 1995, 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MACHINE_VMPARAM_H -#define MACHINE_VMPARAM_H - -#define USRTEXT PAGE_SIZE -#define USRSTACK VM_MAXUSER_ADDRESS - -#ifndef MAXTSIZ -#define MAXTSIZ (16*1024*1024) /* max text size */ -#endif - -#ifndef DFLDSIZ -#define DFLDSIZ (32*1024*1024) /* default data size */ -#endif - -#ifndef MAXDSIZ -#define MAXDSIZ (1*1024*1024*1024) /* max data size */ -#endif - -#ifndef DFLSSIZ -#define DFLSSIZ (1*1024*1024) /* default stack size */ -#endif - -#ifndef MAXSSIZ -#define MAXSSIZ (32*1024*1024) /* max stack size */ -#endif - -/* - * Size of shared memory map - */ -#ifndef SHMMAXPGS -#define SHMMAXPGS 8192 /* 32mb */ -#endif - -/* - * Size of User Raw I/O map - */ -#define USRIOSIZE 1024 - -/* - * The time for a process to be blocked before being very swappable. - * This is a number of seconds which the system takes as being a non-trivial - * amount of real time. You probably shouldn't change this; - * it is used in subtle ways (fractions and multiples of it are, that is, like - * half of a ``long time'', almost a long time, etc.) - * It is related to human patience and other factors which don't really - * change over time. - */ -#define MAXSLP 20 - -/* - * Would like to have MAX addresses = 0, but this doesn't (currently) work - */ -#define VM_MIN_ADDRESS ((vm_offset_t)0) -#define VM_MAXUSER_ADDRESS ((vm_offset_t)0xfffff000) -#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS -#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)(KERNEL_SR << ADDR_SR_SHIFT)) - -/* ppc_kvm_stolen is so that vm space can be stolen before vm is fully - * initialized. - */ -extern vm_offset_t ppc_kvm_stolen; -#define VM_KERN_ADDRESS_SIZE (SEGMENT_LENGTH - (32 * 1024 * 1024)) -#define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + VM_KERN_ADDRESS_SIZE) - -#define VM_PHYS_SIZE (USRIOSIZE * PAGE_SIZE) - -#define __HAVE_PMAP_PHYSSEG -struct pmap_physseg { - struct pted_pv_head *pvent; - char *attrs; - /* NULL ??? */ -}; - -#define VM_PHYSSEG_MAX 32 /* actually we could have this many segments */ -#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH -#define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */ - -#define VM_NFREELIST 1 -#define VM_FREELIST_DEFAULT 0 - -#endif diff --git a/sys/arch/pegasos/include/wsconsio.h b/sys/arch/pegasos/include/wsconsio.h deleted file mode 100644 index 5f2b4965560..00000000000 --- a/sys/arch/pegasos/include/wsconsio.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: wsconsio.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -#include <powerpc/wsconsio.h> diff --git a/sys/arch/pegasos/isa/isa_clock.c b/sys/arch/pegasos/isa/isa_clock.c deleted file mode 100644 index a1c9c153b7a..00000000000 --- a/sys/arch/pegasos/isa/isa_clock.c +++ /dev/null @@ -1,390 +0,0 @@ -/* $OpenBSD: isa_clock.c,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* $NetBSD: clock.c,v 1.39 1996/05/12 23:11:54 mycroft Exp $ */ - -/*- - * Copyright (c) 1993, 1994 Charles Hannum. - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz and Don Ahn. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)clock.c 7.2 (Berkeley) 5/12/91 - */ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - Copyright 1988, 1989 by Intel Corporation, Santa Clara, California. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appears in all -copies and that both the copyright notice and this permission notice -appear in supporting documentation, and that the name of Intel -not be used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. - -INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, -IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, -NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -/* - * Primitive clock interrupt routines. - */ -#include <sys/types.h> -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/time.h> -#include <sys/kernel.h> -#include <sys/device.h> -#include <sys/timeout.h> - -#include <machine/cpu.h> -#include <machine/intr.h> -#include <machine/pio.h> - -#include <dev/clock_subr.h> -#include <dev/isa/isareg.h> -#include <dev/isa/isavar.h> -#include <dev/ic/mc146818reg.h> -#include <pegasos/isa/nvram.h> -#include <pegasos/isa/timerreg.h> -#include <powerpc/isa/isa_machdep.h> - -#include "pcppi.h" -#if (NPCPPI > 0) -#include <dev/isa/pcppivar.h> - -#define __BROKEN_INDIRECT_CONFIG /* XXX */ -#ifdef __BROKEN_INDIRECT_CONFIG -int sysbeepmatch(struct device *, void *, void *); -#else -int sysbeepmatch(struct device *, struct cfdata *, void *); -#endif -void sysbeepattach(struct device *, struct device *, void *); - -struct cfattach sysbeep_ca = { - sizeof(struct device), sysbeepmatch, sysbeepattach -}; - -struct cfdriver sysbeep_cd = { - NULL, "sysbeep", DV_DULL -}; - -static int ppi_attached; -static pcppi_tag_t ppicookie; -#endif /* PCPPI */ - -void spinwait(int); -void findcpuspeed(void); -int clockintr(void *); -int gettick(void); -void sysbeep(int, int); -int rtcget(mc_todregs *); -void rtcput(mc_todregs *); -int hexdectodec(int); -int dectohexdec(int); -int rtcintr(void *); -void rtcdrain(void *); - -u_int mc146818_read(void *, u_int); -void mc146818_write(void *, u_int, u_int); - -#if defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU) -int pentium_mhz, clock_broken_latch; -#endif - -#define SECMIN ((unsigned)60) /* seconds per minute */ -#define SECHOUR ((unsigned)(60*SECMIN)) /* seconds per hour */ - -u_int -mc146818_read(void *sc, u_int reg) -{ - int s; - u_char v; - - s = splhigh(); - isa_outb(IO_RTC, reg); - DELAY(1); - v = isa_inb(IO_RTC+1); - DELAY(1); - splx(s); - return (v); -} - -void -mc146818_write(void *sc, u_int reg, u_int datum) -{ - int s; - - s = splhigh(); - isa_outb(IO_RTC, reg); - DELAY(1); - isa_outb(IO_RTC+1, datum); - DELAY(1); - splx(s); -} - -int -rtcget(mc_todregs *regs) -{ - if ((mc146818_read(NULL, MC_REGD) & MC_REGD_VRT) == 0) /* XXX softc */ - return (-1); - MC146818_GETTOD(NULL, regs); /* XXX softc */ - return (0); -} - -void -rtcput(mc_todregs *regs) -{ - MC146818_PUTTOD(NULL, regs); /* XXX softc */ -} - -int -hexdectodec(int n) -{ - return (((n >> 4) & 0x0f) * 10 + (n & 0x0f)); -} - -int -dectohexdec(int n) -{ - return ((u_char)(((n / 10) << 4) & 0xf0) | ((n % 10) & 0x0f)); -} - -static int timeset; - -/* - * check whether the CMOS layout is "standard"-like (ie, not PS/2-like), - * to be called at splclock() - */ -int cmoscheck(void); -int -cmoscheck() -{ - int i; - unsigned short cksum = 0; - - for (i = 0x10; i <= 0x2d; i++) - cksum += mc146818_read(NULL, i); /* XXX softc */ - -#if 0 - return (cksum == (mc146818_read(NULL, 0x2e) << 8) - + mc146818_read(NULL, 0x2f)); -#else - return 1; -#endif -} - -/* - * patchable to control century byte handling: - * 1: always update - * -1: never touch - * 0: try to figure out itself - */ -int rtc_update_century = 0; - -/* - * Expand a two-digit year as read from the clock chip - * into full width. - * Being here, deal with the CMOS century byte. - */ -int clock_expandyear(int); -int -clock_expandyear(clockyear) - int clockyear; -{ - int clockcentury; - - clockcentury = (clockyear < 70) ? 20 : 19; - clockyear += 100 * clockcentury; - - if (rtc_update_century < 0) - return (clockyear); - - return (clockyear); -} - -/* - * Initialize the time of day register, based on the time base which is, e.g. - * from a filesystem. - */ -void -inittodr(time_t base) -{ - mc_todregs rtclk; - struct clock_ymdhms dt; - int s; - - /* - * We mostly ignore the suggested time and go for the RTC clock time - * stored in the CMOS RAM. If the time can't be obtained from the - * CMOS, or if the time obtained from the CMOS is 5 or more years - * less than the suggested time, we used the suggested time. (In - * the latter case, it's likely that the CMOS battery has died.) - */ - - if (base < 15*SECYR) { /* if before 1985, something's odd... */ - printf("WARNING: preposterous time in file system\n"); - /* read the system clock anyway */ - base = 17*SECYR + 186*SECDAY + SECDAY/2; - } - - mc146818_write(NULL, MC_REGB, MC_REGB_24HR | MC_REGB_PIE); - - time.tv_usec = 0; - - s = splclock(); - if (rtcget(&rtclk)) { - splx(s); - printf("WARNING: invalid time in clock chip\n"); - goto fstime; - } - splx(s); - - dt.dt_sec = hexdectodec(rtclk[MC_SEC]); - dt.dt_min = hexdectodec(rtclk[MC_MIN]); - dt.dt_hour = hexdectodec(rtclk[MC_HOUR]); - dt.dt_day = hexdectodec(rtclk[MC_DOM]); - dt.dt_mon = hexdectodec(rtclk[MC_MONTH]); - dt.dt_year = clock_expandyear(hexdectodec(rtclk[MC_YEAR])); - - - /* - * If time_t is 32 bits, then the "End of Time" is - * Mon Jan 18 22:14:07 2038 (US/Eastern) - * This code copes with RTC's past the end of time if time_t - * is an int32 or less. Needed because sometimes RTCs screw - * up or are badly set, and that would cause the time to go - * negative in the calculation below, which causes Very Bad - * Mojo. This at least lets the user boot and fix the problem. - * Note the code is self eliminating once time_t goes to 64 bits. - */ - if (sizeof(time_t) <= sizeof(int32_t)) { - if (dt.dt_year >= 2038) { - printf("WARNING: RTC time at or beyond 2038.\n"); - dt.dt_year = 2037; - printf("WARNING: year set back to 2037.\n"); - printf("WARNING: CHECK AND RESET THE DATE!\n"); - } - } - - time.tv_sec = clock_ymdhms_to_secs(&dt) + tz.tz_minuteswest * 60; - if (tz.tz_dsttime) - time.tv_sec -= 3600; - - if (base < time.tv_sec - 5*SECYR) - printf("WARNING: file system time much less than clock time\n"); - else if (base > time.tv_sec + 5*SECYR) { - printf("WARNING: clock time much less than file system time\n"); - printf("WARNING: using file system time\n"); - goto fstime; - } - - timeset = 1; - return; - -fstime: - timeset = 1; - time.tv_sec = base; - printf("WARNING: CHECK AND RESET THE DATE!\n"); -} - -/* - * Reset the clock. - */ -void -resettodr() -{ - mc_todregs rtclk; - struct clock_ymdhms dt; - int diff; - int century; - int s; - - /* - * We might have been called by boot() due to a crash early - * on. Don't reset the clock chip in this case. - */ - if (!timeset) - return; - - s = splclock(); - if (rtcget(&rtclk)) - bzero(&rtclk, sizeof(rtclk)); - splx(s); - - diff = tz.tz_minuteswest * 60; - if (tz.tz_dsttime) - diff -= 3600; - clock_secs_to_ymdhms(time.tv_sec - diff, &dt); - - rtclk[MC_SEC] = dectohexdec(dt.dt_sec); - rtclk[MC_MIN] = dectohexdec(dt.dt_min); - rtclk[MC_HOUR] = dectohexdec(dt.dt_hour); - rtclk[MC_DOW] = dt.dt_wday; - rtclk[MC_YEAR] = dectohexdec(dt.dt_year % 100); - rtclk[MC_MONTH] = dectohexdec(dt.dt_mon); - rtclk[MC_DOM] = dectohexdec(dt.dt_day); - s = splclock(); - rtcput(&rtclk); - if (rtc_update_century > 0) { - century = dectohexdec(dt.dt_year / 100); - mc146818_write(NULL, NVRAM_CENTURY, century); /* XXX softc */ - } - splx(s); -} diff --git a/sys/arch/pegasos/isa/nvram.h b/sys/arch/pegasos/isa/nvram.h deleted file mode 100644 index 00b6b94d017..00000000000 --- a/sys/arch/pegasos/isa/nvram.h +++ /dev/null @@ -1,93 +0,0 @@ -/* $OpenBSD: nvram.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* $NetBSD: nvram.h,v 1.5 1995/05/05 22:08:43 mycroft Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)rtc.h 8.1 (Berkeley) 6/11/93 - */ - -/* - * The following information is found in the non-volatile RAM in the - * MC146818A (or DS1287A or other compatible) RTC on AT-compatible PCs. - */ - -/* NVRAM byte 0: bios diagnostic */ -#define NVRAM_DIAG (MC_NVRAM_START + 0) /* RTC offset 0xe */ - -#define NVRAM_DIAG_BITS "\020\010clock_battery\007ROM_cksum\006config_unit\005memory_size\004fixed_disk\003invalid_time" - -/* NVRAM byte 1: reset code */ -#define NVRAM_RESET (MC_NVRAM_START + 1) /* RTC offset 0xf */ - -#define NVRAM_RESET_RST 0x00 /* normal reset */ -#define NVRAM_RESET_LOAD 0x04 /* load system */ -#define NVRAM_RESET_SOFT 0x0A /* soft reset */ - -/* NVRAM byte 2: diskette drive type in upper/lower nibble */ -#define NVRAM_DISKETTE (MC_NVRAM_START + 2) /* RTC offset 0x10 */ - -#define NVRAM_DISKETTE_NONE 0 /* none present */ -#define NVRAM_DISKETTE_360K 0x10 /* 360K */ -#define NVRAM_DISKETTE_12M 0x20 /* 1.2M */ -#define NVRAM_DISKETTE_720K 0x30 /* 720K */ -#define NVRAM_DISKETTE_144M 0x40 /* 1.44M */ -#define NVRAM_DISKETTE_TYPE5 0x50 /* 2.88M, presumably */ -#define NVRAM_DISKETTE_TYPE6 0x60 /* 2.88M */ - -/* NVRAM byte 6: equipment type */ -#define NVRAM_EQUIPMENT (MC_NVRAM_START + 6) - -#define NVRAM_EQUIPMENT_FLOPPY 0x01 /* floppy installed */ -#define NVRAM_EQUIPMENT_FPU 0x02 /* FPU installed */ -#define NVRAM_EQUIPMENT_KBD 0x04 /* keyboard installed */ -#define NVRAM_EQUIPMENT_DISPLAY 0x08 /* display installed */ -#define NVRAM_EQUIPMENT_EGAVGA 0x00 /* EGA or VGA */ -#define NVRAM_EQUIPMENT_COLOR40 0x10 /* 40 column color */ -#define NVRAM_EQUIPMENT_COLOR80 0x20 /* 80 column color */ -#define NVRAM_EQUIPMENT_MONO80 0x30 /* 80 column mono */ -#define NVRAM_EQUIPMENT_MONITOR 0x30 /* mask for monitor type */ -#define MVRAM_EQUIPMENT_NFDS 0xC0 /* mask for # of floppies */ - -/* NVRAM bytes 7 & 8: base memory size */ -#define NVRAM_BASELO (MC_NVRAM_START + 7) /* low byte; RTC off. 0x15 */ -#define NVRAM_BASEHI (MC_NVRAM_START + 8) /* high byte; RTC off. 0x16 */ - -/* NVRAM bytes 9 & 10: extended memory size */ -#define NVRAM_EXTLO (MC_NVRAM_START + 9) /* low byte; RTC off. 0x17 */ -#define NVRAM_EXTHI (MC_NVRAM_START + 10) /* high byte; RTC off. 0x18 */ - -/* NVRAM bytes 34 and 35: extended memory POSTed size */ -#define NVRAM_PEXTLO (MC_NVRAM_START + 34) /* low byte; RTC off. 0x30 */ -#define NVRAM_PEXTHI (MC_NVRAM_START + 35) /* high byte; RTC off. 0x31 */ - -/* NVRAM byte 36: current century. (please increment in Dec99!) */ -#define NVRAM_CENTURY (MC_NVRAM_START + 36) /* RTC offset 0x32 */ diff --git a/sys/arch/pegasos/isa/timerreg.h b/sys/arch/pegasos/isa/timerreg.h deleted file mode 100644 index bba650c3d6f..00000000000 --- a/sys/arch/pegasos/isa/timerreg.h +++ /dev/null @@ -1,97 +0,0 @@ -/* $OpenBSD: timerreg.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* $NetBSD: timerreg.h,v 1.4 1994/10/27 04:18:17 cgd Exp $ */ - -/*- - * Copyright (c) 1993 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Register definitions for the Intel 8253 Programmable Interval Timer. - * - * This chip has three independent 16-bit down counters that can be - * read on the fly. There are three mode registers and three countdown - * registers. The countdown registers are addressed directly, via the - * first three I/O ports. The three mode registers are accessed via - * the fourth I/O port, with two bits in the mode byte indicating the - * register. (Why are hardware interfaces always so braindead?). - * - * To write a value into the countdown register, the mode register - * is first programmed with a command indicating the which byte of - * the two byte register is to be modified. The three possibilities - * are load msb (TMR_MR_MSB), load lsb (TMR_MR_LSB), or load lsb then - * msb (TMR_MR_BOTH). - * - * To read the current value ("on the fly") from the countdown register, - * you write a "latch" command into the mode register, then read the stable - * value from the corresponding I/O port. For example, you write - * TMR_MR_LATCH into the corresponding mode register. Presumably, - * after doing this, a write operation to the I/O port would result - * in undefined behavior (but hopefully not fry the chip). - * Reading in this manner has no side effects. - * - * The outputs of the three timers are connected as follows: - * - * timer 0 -> irq 0 - * timer 1 -> dma chan 0 (for dram refresh) - * timer 2 -> speaker (via keyboard controller) - * - * Timer 0 is used to call hardclock. - * Timer 2 is used to generate console beeps. - */ - -/* - * Frequency of all three count-down timers; (TIMER_FREQ/freq) is the - * appropriate count to generate a frequency of freq hz. - */ -#ifndef TIMER_FREQ -#define TIMER_FREQ 1193182 -#endif -#define TIMER_DIV(x) ((TIMER_FREQ+(x)/2)/(x)) - -/* - * Macros for specifying values to be written into a mode register. - */ -#define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */ -#define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */ -#define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */ -#define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */ -#define TIMER_SEL0 0x00 /* select counter 0 */ -#define TIMER_SEL1 0x40 /* select counter 1 */ -#define TIMER_SEL2 0x80 /* select counter 2 */ -#define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */ -#define TIMER_ONESHOT 0x02 /* mode 1, one shot */ -#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */ -#define TIMER_SQWAVE 0x06 /* mode 3, square wave */ -#define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */ -#define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */ -#define TIMER_LATCH 0x00 /* latch counter for reading */ -#define TIMER_LSB 0x10 /* r/w counter LSB */ -#define TIMER_MSB 0x20 /* r/w counter MSB */ -#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */ -#define TIMER_BCD 0x01 /* count in BCD */ - diff --git a/sys/arch/pegasos/pci/agp_machdep.c b/sys/arch/pegasos/pci/agp_machdep.c deleted file mode 100644 index 5cead8c19f1..00000000000 --- a/sys/arch/pegasos/pci/agp_machdep.c +++ /dev/null @@ -1,63 +0,0 @@ -/* $OpenBSD: agp_machdep.c,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -/* - * Copyright (c) 2002 Michael Shalayeff - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/device.h> - -#include <dev/pci/pcivar.h> -#include <dev/pci/pcireg.h> -#include <dev/pci/pcidevs.h> -#include <dev/pci/agpvar.h> - -/* -#include <machine/cpufunc.h> -*/ - -const struct agp_product agp_products[] = { -#if 0 - { PCI_VENDOR_ALI, -1, agp_ali_attach }, - { PCI_VENDOR_AMD, -1, agp_amd_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810_GC, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810_DC100_GC, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810E_GC, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82815_FULL_GRAPH, agp_i810_attach }, -/* { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82830MP_IV, agp_i810_attach }, */ - { PCI_VENDOR_INTEL, -1, agp_intel_attach }, - { PCI_VENDOR_SIS, -1, agp_sis_attach }, -#endif - { PCI_VENDOR_VIATECH, -1, agp_via_attach }, - { 0, 0, NULL } -}; - -void -agp_flush_cache(void) -{ - /* - wbinvd(); - */ -} diff --git a/sys/arch/pegasos/pci/isabr.c b/sys/arch/pegasos/pci/isabr.c deleted file mode 100644 index fc02780a89f..00000000000 --- a/sys/arch/pegasos/pci/isabr.c +++ /dev/null @@ -1,572 +0,0 @@ -/* $OpenBSD: isabr.c,v 1.4 2004/02/04 20:07:18 drahn Exp $ */ - -/*- - * Copyright (c) 1995 Per Fogelstrom - * Copyright (c) 1993, 1994 Charles Hannum. - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz and Don Ahn. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)isa.c 7.2 (Berkeley) 5/12/91 - */ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - Copyright 1988, 1989 by Intel Corporation, Santa Clara, California. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appears in all -copies and that both the copyright notice and this permission notice -appear in supporting documentation, and that the name of Intel -not be used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. - -INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, -IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, -NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include <sys/param.h> -#include <sys/proc.h> -#include <sys/user.h> -#include <sys/systm.h> -#include <sys/time.h> -#include <sys/kernel.h> -#include <sys/device.h> -#include <sys/malloc.h> - -#include <machine/pte.h> -#include <machine/cpu.h> -#include <machine/pio.h> -#include <machine/autoconf.h> -#include <machine/powerpc.h> -#include <machine/intr.h> - -#include <dev/pci/pcidevs.h> -#include <dev/pci/pcivar.h> - -#include <dev/isa/isareg.h> -#include <dev/isa/isavar.h> - -#define IRQ_SLAVE 2 - -struct isabr_softc { - struct device sc_dv; - struct ppc_isa_bus ppc_isa_cs; - struct bushook sc_bus; -}; - -/* Definition of the driver for autoconfig. */ -int isabrmatch(struct device *, void *, void *); -void isabrattach(struct device *, struct device *, void *); -int isabrprint(void *, const char *); - -struct cfattach isabr_ca = { - sizeof(struct isabr_softc), isabrmatch, isabrattach -}; -struct cfdriver isabr_cd = { - NULL, "isabr", DV_DULL, NULL, 0 -}; - -void *isabr_intr_establish(void *, int, int, int, int (*)(void *), void *, - char *); -void isabr_intr_disestablish (void *, void*); -void isabr_iointr(void); -void isabr_initicu (void); -static void intr_calculatemasks (void); -static int fakeintr(void *a); - -/* These may be initialize early in _machdep.c for console configuration. */ -struct ppc_bus_space ppc_isa_io; -struct ppc_bus_space ppc_isa_mem; - -/* used by isa_inb() isa_outb() */ -bus_space_handle_t ppc_isa_io_vaddr; - - -#define LEGAL_IRQ(x) ((x) >= 0 && (x) < ICU_LEN && (x) != 2) - -int imen = 0xffffffff; -int intrtype[ICU_LEN], intrmask[ICU_LEN], intrlevel[ICU_LEN]; -struct intrhand *intrhand[ICU_LEN]; - -const struct pci_matchid isabr_devices[] = { - { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8231_ISA } -}; - -int -isabrmatch(struct device *parent, void *cfdata, void *aux) -{ - return (pci_matchbyid((struct pci_attach_args *)aux, isabr_devices, - sizeof(isabr_devices)/sizeof(isabr_devices[0]))); -} - - -void isabr_collect_preconf_intr(void); -void -isabr_collect_preconf_intr() -{ - int i; - for (i = 0; i < ppc_configed_intr_cnt; i++) { - isabr_intr_establish(NULL, ppc_configed_intr[i].ih_irq, - IST_LEVEL, ppc_configed_intr[i].ih_level, - ppc_configed_intr[i].ih_fun, ppc_configed_intr[i].ih_arg, - ppc_configed_intr[i].ih_what); - } -} - - -typedef void (void_f) (void); -extern void_f *pending_int_f; -void isa_do_pending_int(void); - -void -isabrattach(struct device *parent, struct device *self, void *aux) -{ - struct isabr_softc *sc = (struct isabr_softc *)self; - struct isabus_attach_args iba; - struct pci_attach_args *pa = aux; - extern intr_establish_t *intr_establish_func; - extern intr_disestablish_t *intr_disestablish_func; - - pending_int_f = isa_do_pending_int; - intr_establish_func = isabr_intr_establish; - intr_disestablish_func = isabr_intr_disestablish; - install_extint(isabr_iointr); - - printf("\n"); - - /* Initialize interrupt controller */ - isabr_initicu(); - - /* set up interrupt handlers */ - - /*XXX we may remove the bushook part of the softc struct... */ - sc->sc_bus.bh_dv = (struct device *)sc; - sc->sc_bus.bh_type = BUS_ISABR; - - sc->ppc_isa_cs.ic_intr_establish = isabr_intr_establish; - sc->ppc_isa_cs.ic_intr_disestablish = isabr_intr_disestablish; - - iba.iba_busname = "isa"; - ppc_isa_io = *pa->pa_iot; - ppc_isa_io.bus_base = 0xfe000000; - ppc_isa_mem.bus_base = 0xfd000000; - ppc_isa_mem = *pa->pa_memt; - iba.iba_iot = &ppc_isa_io; - iba.iba_memt = &ppc_isa_mem; - iba.iba_ic = &sc->ppc_isa_cs; - - /* XXX magic numbers, _vaddr used in isa_inb()/isa_outb() */ - if (bus_space_map (&ppc_isa_io, 0x0000, 0x2000, 0, &ppc_isa_io_vaddr)) - printf("unable to map io vaddr\n"); - - isabr_collect_preconf_intr(); - - config_found(self, &iba, isabrprint); -} - -int -isabrprint(void *aux, const char *pnp) -{ - struct confargs *ca = aux; - - if (pnp) - printf("%s at %s", ca->ca_name, pnp); - return (UNCONF); -} - - -/* - * Interrupt system driver code - * ============================ - */ -static int -fakeintr(void *a) -{ - return 0; -} - -void isa_setirqstat(int irq, int enabled, int type); - -void -isa_setirqstat(int irq, int enabled, int type) -{ - intrtype[irq] = type; - return; -} -/* - * Recalculate the interrupt masks from scratch. - * We could code special registry and deregistry versions of this function that - * would be faster, but the code would be nastier, and we don't expect this to - * happen very much anyway. - */ -static void -intr_calculatemasks() -{ - int irq, level, levels; - struct intrhand *q; - int irqs; - - /* First, figure out which levels each IRQ uses. */ - for (irq = 0; irq < ICU_LEN; irq++) { - levels = 0; - for (q = intrhand[irq]; q; q = q->ih_next) - levels |= 1 << q->ih_level; - intrlevel[irq] = levels; - } - - /* Then figure out which IRQs use each level. */ - for (level = IPL_NONE; level <= IPL_HIGH; level++) { - irqs = 0; - for (irq = 0; irq < ICU_LEN; irq++) - if (intrlevel[irq] & (1 << level)) - irqs |= 1 << irq; - imask[level] = irqs | SINT_MASK; - } - - /* - * There are tty, network and disk drivers that use free() at interrupt - * time, so imp > (tty | net | bio). - * - * Enforce a hierarchy that gives slow devices a better chance at not - * dropping data. - */ - imask[IPL_NET] |= imask[IPL_BIO]; - imask[IPL_TTY] |= imask[IPL_NET]; - imask[IPL_IMP] |= imask[IPL_TTY]; - imask[IPL_CLOCK] |= imask[IPL_IMP] | SPL_CLOCK; - - /* - * These are pseudo-levels. - */ - imask[IPL_NONE] = 0x00000000; - imask[IPL_HIGH] = 0xffffffff; - - /* And eventually calculate the complete masks. */ - for (irq = 0; irq < ICU_LEN; irq++) { - irqs = 1 << irq; - for (q = intrhand[irq]; q; q = q->ih_next) - irqs |= imask[q->ih_level]; - - intrmask[irq] = irqs | SINT_MASK; - } - - /* Lastly, determine which IRQs are actually in use. */ - { - irqs = 0; - for (irq = 0; irq < ICU_LEN; irq++) - if (intrhand[irq]) - irqs |= 1 << irq; - - if (irqs >= 0x100) /* any IRQs >= 8 in use */ - irqs |= 1 << IRQ_SLAVE; - - imen = ~irqs; - isa_outb(IO_ICU1 + 1, imen); - isa_outb(IO_ICU2 + 1, imen >> 8); - } -} - -void nameinterrupt(int replace, char *newstr); - -/* - * Establish a ISA bus interrupt. - */ -void * -isabr_intr_establish(void *arg_ic, int irq, int type, int level, - int (*ih_fun) (void *), void *ih_arg, char *ih_what) -{ - static struct intrhand fakehand = {NULL, fakeintr}; - static int inthnd_installed = 0; - struct intrhand **p, *q, *ih; - extern int cold; - - if (!inthnd_installed) { - install_extint(isabr_iointr); - inthnd_installed++; - } - - nameinterrupt(irq, ih_what); - - /* no point in sleeping unless someone can free memory. */ - ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); - if (ih == NULL) - panic("isa_intr_establish: can't malloc handler info"); - - if (!LEGAL_IRQ(irq) || type == IST_NONE) - panic("intr_establish: bogus irq or type"); - - switch (intrtype[irq]) { - case IST_EDGE: - case IST_LEVEL: - if (type == intrtype[irq]) - break; - case IST_PULSE: - if (type != IST_NONE) - panic("intr_establish: can't share %s with %s irq %d", - isa_intr_typename(intrtype[irq]), - isa_intr_typename(type), irq); - break; - } - - /* - * Figure out where to put the handler. - * This is O(N^2), but we want to preserve the order, and N is - * generally small. - */ - for (p = &intrhand[irq]; (q = *p) != NULL; p = &q->ih_next) - ; - - /* - * Actually install a fake handler momentarily, since we might be doing - * this with interrupts enabled and don't want the real routine called - * until masking is set up. - */ - fakehand.ih_level = level; - *p = &fakehand; - - intr_calculatemasks(); - - /* - * Poke the real handler in now. - */ - ih->ih_fun = ih_fun; - ih->ih_arg = ih_arg; - ih->ih_count = 0; - ih->ih_next = NULL; - ih->ih_level = level; - ih->ih_irq = irq; - ih->ih_what = ih_what; - *p = ih; - - isa_setirqstat(irq, 1, type); - - return (ih); -} - -void -isabr_intr_disestablish(void *ic, void *arg) -{ - /* Not yet */ -} - -void -isa_do_pending_int() -{ - struct intrhand *ih; - int vector; - int pcpl; - int hwpend; - int emsr; -static int processing; - - if (processing) - return; - - emsr = ppc_intr_disable(); - processing = 1; - - pcpl = splhigh(); /* Turn off all */ - hwpend = ipending & ~pcpl; /* Do now unmasked pendings */ - hwpend &= ((1L << ICU_LEN) - 1); - ipending &= ~hwpend; - imen &= ~hwpend; - while (hwpend) { - vector = ffs(hwpend) - 1; - hwpend &= ~(1L << vector); - ih = intrhand[vector]; - while (ih) { - (*ih->ih_fun)(ih->ih_arg); - ih = ih->ih_next; - } - } - if ((ipending & SINT_CLOCK) & ~pcpl) { - ipending &= ~SINT_CLOCK; - softclock(); - } - if ((ipending & SINT_NET) & ~pcpl) { - extern int netisr; - int pisr = netisr; - netisr = 0; - ipending &= ~SINT_NET; - softnet(pisr); - } - cpl = pcpl; /* Don't use splx... we are here already! */ - - isa_outb(IO_ICU1 + 1, imen); - isa_outb(IO_ICU2 + 1, imen >> 8); - - processing = 0; - ppc_intr_enable(emsr); -} - -/* - * Process an interrupt from the ISA bus. - * When we get here remember we have "delayed" ipl mask - * settings from the spl<foo>() calls. Yes it's faster - * to do it like this because SPL's are done so frequently - * and interrupts are likely to *NOT* happen most of the - * times the spl level is changed. - */ -void -isabr_iointr() -{ - struct intrhand *ih; - int o_imen, r_imen; - u_int8_t isa_vector; - int pcpl; - u_int32_t pci_iack(void); /* XXX */ - - /* what about enabling external interrupt in here? */ - pcpl = splhigh() ; /* Turn off all */ - - isa_vector = pci_iack(); - - isa_vector &= (ICU_LEN - 1); /* XXX Better safe than sorry */ - - if (isa_vector == 7) /* IRQ 7 == spurious */ - goto fastout; - - intrcnt[isa_vector]++; - - o_imen = imen; - r_imen = 1 << isa_vector; - imen |= r_imen; - isa_outb(IO_ICU1 + 1, imen); - isa_outb(IO_ICU2 + 1, imen >> 8); - - if ((pcpl & r_imen) != 0) { - ipending |= r_imen; /* Masked! Mark this as pending */ - } else { - ih = intrhand[isa_vector]; - if (ih == NULL) - printf("isa: spurious interrupt %d\n", isa_vector); - - while (ih) { - (*ih->ih_fun)(ih->ih_arg); - ih = ih->ih_next; - } - imen = o_imen; - } -#ifdef NO_SPECIAL_MASK_MODE - isa_outb(IO_ICU1, 0x20); - isa_outb(IO_ICU2, 0x20); -#else - if (isa_vector > 7) { - isa_outb(IO_ICU2, 0x60 | (isa_vector & 0x07)); - } - isa_outb(IO_ICU1, 0x60 | (isa_vector > 7 ? 2 : isa_vector)); -#endif - isa_outb(IO_ICU1 + 1, imen); - isa_outb(IO_ICU2 + 1, imen >> 8); - -fastout: - ppc_intr_enable(1); - - splx(pcpl); /* Process pendings. */ -} - - -/* - * Initialize the Interrupt controller logic. - */ -void -isabr_initicu() -{ - int i; - - for (i= 0; i < ICU_LEN; i++) { - switch (i) { - case 0: - case 1: - case 2: - case 8: - case 13: - intrtype[i] = IST_EDGE; - break; - default: - intrtype[i] = IST_NONE; - } - } - - isa_outb(IO_ICU1, 0x11); /* program device, four bytes */ - isa_outb(IO_ICU1+1, 0); /* starting at this vector */ - isa_outb(IO_ICU1+1, 1 << IRQ_SLAVE); /* slave on line 2 */ - isa_outb(IO_ICU1+1, 1); /* 8086 mode */ - isa_outb(IO_ICU1+1, 0xff); /* leave interrupts masked */ -#ifndef NO_SPECIAL_MASK_MODE - isa_outb(IO_ICU1, 0x68); /* special mask mode */ -#endif - isa_outb(IO_ICU1, 0x0a); /* Read IRR by default. */ - - isa_outb(IO_ICU2, 0x11); /* program device, four bytes */ - isa_outb(IO_ICU2+1, 8); /* starting at this vector */ - isa_outb(IO_ICU2+1, IRQ_SLAVE); - isa_outb(IO_ICU2+1, 1); /* 8086 mode */ - isa_outb(IO_ICU2+1, 0xff); /* leave interrupts masked */ -#ifndef NO_SPECIAL_MASK_MODE - isa_outb(IO_ICU2, 0x68); /* special mask mode */ -#endif - isa_outb(IO_ICU2, 0x0a); /* Read IRR by default */ -} diff --git a/sys/arch/pegasos/pci/mpc106reg.h b/sys/arch/pegasos/pci/mpc106reg.h deleted file mode 100644 index f1e56e54fb0..00000000000 --- a/sys/arch/pegasos/pci/mpc106reg.h +++ /dev/null @@ -1,84 +0,0 @@ -/* $OpenBSD: mpc106reg.h,v 1.2 2004/01/27 10:04:18 miod Exp $ */ - -/* - * Copyright (c) 1997 Per Fogelstrom - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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. - * - * - * mpc106reg.h: PowerPC to PCI bridge controller - * This code will probably work with the 105 as well. - */ - -#ifndef _MACHINE_MPC106REG_H_ -#define _MACHINE_MPC106REG_H_ - -/* Where we map the PCI memory space - MAP A*/ -#define MPC106_V_PCI_MEM_SPACE 0xc0000000 /* Virtual */ -#define MPC106_P_PCI_MEM_SPACE 0xc0000000 /* Physical */ - -/* Where we map the PCI I/O space - MAP A*/ -#define MPC106_P_ISA_IO_SPACE 0x80000000 -#define MPC106_V_ISA_IO_SPACE 0x80000000 -#define MPC106_V_PCI_IO_SPACE 0x80000000 -#define MPC106_P_PCI_IO_SPACE 0x80000000 - -/* Where we map the config space */ -#define MPC106_PCI_CONF_SPACE (MPC106_V_ISA_IO_SPACE + 0x00800000) - -/* Where we map the PCI memory space - MAP B*/ -#define MPC106_P_PCI_MEM_SPACE_MAP_B 0x80000000 /* Physical */ - -/* Where we map the PCI I/O space - MAP B*/ -#define MPC106_P_PCI_IO_SPACE_MAP_B 0xfe000000 - -/* offsets from base pointer */ -#define MPC106_REGOFFS(x) ((x) | 0x80000000) - -/* Where PCI devices sees CPU memory. */ -#define MPC106_PCI_CPUMEM 0x80000000 - -#define MPC106_PCI_VENDOR 0x00 -#define MPC106_PCI_DEVICE 0x02 -#define MPC106_PCI_CMD 0x04 -#define MPC106_PCI_STAT 0x06 -#define MPC106_PCI_REVID 0x08 - -#define MPC106_PCI_PMGMT 0x70 - -void -mpc_cfg_write_1( struct pcibr_config *cp, u_int32_t reg, u_int8_t val); -void -mpc_cfg_write_2( struct pcibr_config *cp, u_int32_t reg, u_int16_t val); -void -mpc_cfg_write_4( struct pcibr_config *cp, u_int32_t reg, u_int32_t val); - -u_int8_t -mpc_cfg_read_1( struct pcibr_config *cp, u_int32_t reg); - -u_int16_t -mpc_cfg_read_2( struct pcibr_config *cp, u_int32_t reg); - -u_int32_t -mpc_cfg_read_4( struct pcibr_config *cp, u_int32_t reg); - -#endif /* _MACHINE_MPC106REG_H_ */ diff --git a/sys/arch/pegasos/pci/mpcpcibus.c b/sys/arch/pegasos/pci/mpcpcibus.c deleted file mode 100644 index 2cfd1ae7c66..00000000000 --- a/sys/arch/pegasos/pci/mpcpcibus.c +++ /dev/null @@ -1,1018 +0,0 @@ -/* $OpenBSD: mpcpcibus.c,v 1.5 2004/02/04 20:07:18 drahn Exp $ */ - -/* - * Copyright (c) 1997 Per Fogelstrom - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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. - * - */ - -/* - * Generic PCI BUS Bridge driver. - * specialized hooks for different config methods. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/malloc.h> -#include <sys/device.h> -#include <sys/proc.h> -#include <uvm/uvm_extern.h> - -#include <machine/autoconf.h> -#include <machine/pcb.h> -#include <machine/bat.h> -#include <machine/powerpc.h> - -#if 0 -#include <dev/isa/isareg.h> -#include <dev/isa/isavar.h> -#endif - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <dev/pci/pcidevs.h> - -#include <pegasos/pci/pcibrvar.h> -#include <pegasos/pci/mpc106reg.h> - -#include <dev/ofw/openfirm.h> - -int mpcpcibrmatch(struct device *, void *, void *); -void mpcpcibrattach(struct device *, struct device *, void *); - -void mpc_attach_hook(struct device *, struct device *, - struct pcibus_attach_args *); -int mpc_bus_maxdevs(void *, int); -pcitag_t mpc_make_tag(void *, int, int, int); -void mpc_decompose_tag(void *, pcitag_t, int *, int *, int *); -pcireg_t mpc_conf_read(void *, pcitag_t, int); -void mpc_conf_write(void *, pcitag_t, int, pcireg_t); -pcireg_t peg2_conf_read(void *, pcitag_t, int); -void peg2_conf_write(void *, pcitag_t, int, pcireg_t); - -int mpc_intr_map(void *, pcitag_t, int, int, pci_intr_handle_t *); -const char *mpc_intr_string(void *, pci_intr_handle_t); -int mpc_intr_line(void *, pci_intr_handle_t); -void *mpc_intr_establish(void *, pci_intr_handle_t, - int, int (*func)(void *), void *, char *); -void mpc_intr_disestablish(void *, void *); -int mpc_ether_hw_addr(struct ppc_pci_chipset *, u_int8_t *); -u_int32_t mpc_gen_config_reg(void *cpv, pcitag_t tag, int offset); -int of_ether_hw_addr(struct ppc_pci_chipset *, u_int8_t *); -int find_node_intr (int parent, u_int32_t *addr, u_int32_t *intr); -u_int32_t pci_iack(void); - -struct cfattach mpcpcibr_ca = { - sizeof(struct pcibr_softc), mpcpcibrmatch, mpcpcibrattach -}; - -struct cfdriver mpcpcibr_cd = { - NULL, "mpcpcibr", DV_DULL -}; - -static int mpcpcibrprint(void *, const char *pnp); - -struct pcibr_config mpc_config; - -struct powerpc_bus_dma_tag pci_bus_dma_tag = { - NULL, - _dmamap_create, - _dmamap_destroy, - _dmamap_load, - _dmamap_load_mbuf, - _dmamap_load_uio, - _dmamap_load_raw, - _dmamap_unload, - _dmamap_sync, - _dmamem_alloc, - _dmamem_free, - _dmamem_map, - _dmamem_unmap, - _dmamem_mmap -}; - -/* - * Code from "pci/if_de.c" used to calculate crc32 of ether rom data. - */ -#define TULIP_CRC32_POLY 0xEDB88320UL -static __inline__ unsigned -srom_crc32(const unsigned char *databuf, size_t datalen) -{ - u_int idx, bit, data, crc = 0xFFFFFFFFUL; - - for (idx = 0; idx < datalen; idx++) - for (data = *databuf++, bit = 0; bit < 8; bit++, data >>= 1) - crc = (crc >> 1) ^ (((crc ^ data) & 1) ? - TULIP_CRC32_POLY : 0); - return crc; -} - -int -mpcpcibrmatch(struct device *parent, void *match, void *aux) -{ - struct confargs *ca = aux; - int found = 0; - - if (strcmp(ca->ca_name, mpcpcibr_cd.cd_name) != 0) - return (found); - - found = 1; - - return found; -} - -void fix_node_irq(int node, struct pcibus_attach_args *pba); - -int pci_map_a = 0; - -struct ranges_new { - u_int32_t flags; - u_int32_t pad1; - u_int32_t pad2; - u_int32_t base; - u_int32_t pad3; - u_int32_t size; -}; - -extern int pegasos; -struct ppc_bus_space marvell_io; -bus_space_handle_t marvell_ioh; - -void -mpcpcibrattach(struct device *parent, struct device *self, void *aux) -{ - struct pcibr_softc *sc = (struct pcibr_softc *)self; - struct confargs *ca = aux; - struct pcibr_config *lcp; - struct pcibus_attach_args pba; - int node; - int of_node = 0; - u_int32_t addr_offset; - u_int32_t data_offset; - int i; - int rangelen; - u_int32_t range_store[32]; - struct ranges_new *prange = (void *)&range_store; - - /* scan the children of the root of the openfirmware - * tree to locate all nodes with device_type of "pci" - */ - - if (ca->ca_node == 0) { - printf("invalid node on mpcpcibr config\n"); - return; - } - - if ((rangelen = OF_getprop(ca->ca_node, "ranges", range_store, - sizeof(range_store))) <= 0) { - printf("range lookup failed, node %x\n", ca->ca_node); - return; - } - /* translate byte(s) into item count*/ - rangelen /= sizeof(struct ranges_new); - - lcp = sc->sc_pcibr = &sc->pcibr_config; - - { - int found; - unsigned int base = 0; - unsigned int size = 0; - - /* mac configs */ - - sc->sc_membus_space.bus_base = 0; - sc->sc_membus_space.bus_reverse = 1; - sc->sc_membus_space.bus_io = 0; - sc->sc_iobus_space.bus_base = 0; - sc->sc_iobus_space.bus_reverse = 1; - sc->sc_iobus_space.bus_io = 1; - - /* find io(config) base, flag == 0x01000000 */ - found = 0; - for (i = 0; i < rangelen ; i++) - if (prange[i].flags == 0x01000000) - found = i; /* find last? */ - - /* found the io space ranges */ - if (prange[found].flags == 0x01000000) { - sc->sc_iobus_space.bus_base = prange[found].base; - sc->sc_iobus_space.bus_size = prange[found].size; - } - - /* the mem space ranges - * apple openfirmware always puts full - * addresses in config information, - * it is not necessary to have correct bus - * base address, but since 0 is reserved - * and all IO and device memory will be in - * upper 2G of address space, set to - * 0x80000000 - * start with segment 1 not 0, 0 is config. - */ - for (i = 0; i < rangelen ; i++) - { - if (prange[i].flags == 0x02000000) { - if (base != 0) { - if ((base + size) == prange[i].base) { - size += prange[i].size; - } else { - base = prange[i].base; - size = prange[i].size; - } - } else { - base = prange[i].base; - size = prange[i].size; - } - } - } - sc->sc_membus_space.bus_base = base; - sc->sc_membus_space.bus_size = size; - - } - - of_node = ca->ca_node; - lcp->node = ca->ca_node; - lcp->lc_pc.pc_conf_v = lcp; - lcp->lc_pc.pc_attach_hook = mpc_attach_hook; - lcp->lc_pc.pc_bus_maxdevs = mpc_bus_maxdevs; - lcp->lc_pc.pc_make_tag = mpc_make_tag; - lcp->lc_pc.pc_decompose_tag = mpc_decompose_tag; - lcp->lc_pc.pc_conf_read = mpc_conf_read; - lcp->lc_pc.pc_conf_write = mpc_conf_write; - lcp->lc_pc.pc_ether_hw_addr = of_ether_hw_addr; - lcp->lc_iot = &sc->sc_iobus_space; - lcp->lc_memt = &sc->sc_membus_space; - - lcp->lc_pc.pc_intr_v = lcp; - lcp->lc_pc.pc_intr_map = mpc_intr_map; - lcp->lc_pc.pc_intr_string = mpc_intr_string; - lcp->lc_pc.pc_intr_line = mpc_intr_line; - lcp->lc_pc.pc_intr_establish = mpc_intr_establish; - lcp->lc_pc.pc_intr_disestablish = mpc_intr_disestablish; - - addr_offset = 0; - - if (pegasos == 2) { - marvell_io.bus_base = 0xf1000000; - marvell_io.bus_reverse = 1; - marvell_io.bus_io = 1; - - /* PegII */ - if (sc->sc_iobus_space.bus_base == 0xfe000000) { - addr_offset=0x00000c78; - data_offset=0x00000c7c; - } else if (sc->sc_iobus_space.bus_base == 0xf8000000) { - addr_offset=0x00000cf8; - data_offset=0x00000cfc; - lcp->lc_pc.pc_conf_read = peg2_conf_read; - lcp->lc_pc.pc_conf_write = peg2_conf_write; - bus_space_map (&(marvell_io), 0xF000, PAGE_SIZE, 0, - &marvell_ioh); - } - if ( bus_space_map(&(marvell_io), addr_offset, - PAGE_SIZE, 0, &lcp->ioh_cf8) != 0 ) - panic("mpcpcibus: unable to map self"); - - if ( bus_space_map(&(marvell_io), data_offset, - PAGE_SIZE, 0, &lcp->ioh_cfc) != 0 ) - panic("mpcpcibus: unable to map self"); - - { - u_int32_t pci_iack_paddr; - - if ((rangelen = OF_getprop(ca->ca_node, - "8259-interrupt-acknowledge", - &pci_iack_paddr, - sizeof(pci_iack_paddr))) <= 0) { - printf( "getprop 8259-interrupt-acknowledge " - "failed\n"); - } else { - /* Peg 2 XXX */ - bus_space_map(&(marvell_io), pci_iack_paddr, - NBPG, 0, &(sc->pci_iack_ioh)); - } - } - } else { - /* PegI */ - lcp->config_type = 0; - addr_offset=0x00c00cf8; - data_offset=0x00e00cfc; - - -#ifdef DEBUG_FIXUP - printf(" mem base %x sz %x io base %x sz %x\n config addr %x" - " config data %x\n", - sc->sc_membus_space.bus_base, - sc->sc_membus_space.bus_size, - sc->sc_iobus_space.bus_base, - sc->sc_iobus_space.bus_size, - addr_offset, data_offset); -#endif - - if ( bus_space_map(&(sc->sc_iobus_space), addr_offset, - NBPG, 0, &lcp->ioh_cf8) != 0 ) - panic("mpcpcibus: unable to map self"); - - if ( bus_space_map(&(sc->sc_iobus_space), data_offset, - NBPG, 0, &lcp->ioh_cfc) != 0 ) - panic("mpcpcibus: unable to map self"); - - { - u_int32_t pci_iack_paddr; - - if ((rangelen = OF_getprop(ca->ca_node, - "8259-interrupt-acknowledge", - &pci_iack_paddr, - sizeof(pci_iack_paddr))) <= 0) { - printf( "getprop 8259-interrupt-acknowledge " - "failed\n"); - } else { - bus_space_map(&(sc->sc_iobus_space), - pci_iack_paddr, NBPG, 0, - &(sc->pci_iack_ioh)); - } - } - } - - - printf("\n"); - - /* - */ - pci_addr_fixup(sc, &lcp->lc_pc, 32); - - pba.pba_dmat = &pci_bus_dma_tag; - - - pba.pba_busname = "pci"; - pba.pba_iot = &sc->sc_iobus_space; - pba.pba_memt = &sc->sc_membus_space; - pba.pba_pc = &lcp->lc_pc; - pba.pba_bus = 0; - - /* we want to check pci irq settings */ - if (of_node != 0) { - int nn; - - for (node = OF_child(of_node); node; node = nn) - { - char name[32]; - int len; - len = OF_getprop(node, "name", name, sizeof(name)); - name[len] = 0; - fix_node_irq(node, &pba); - - /* iterate section */ - if ((nn = OF_child(node)) != 0) { - continue; - } - while ((nn = OF_peer(node)) == 0) { - node = OF_parent(node); - if (node == of_node) { - nn = 0; /* done */ - break; - } - } - } - } - - config_found(self, &pba, mpcpcibrprint); -} - -#define OFW_PCI_PHYS_HI_BUSMASK 0x00ff0000 -#define OFW_PCI_PHYS_HI_BUSSHIFT 16 -#define OFW_PCI_PHYS_HI_DEVICEMASK 0x0000f800 -#define OFW_PCI_PHYS_HI_DEVICESHIFT 11 -#define OFW_PCI_PHYS_HI_FUNCTIONMASK 0x00000700 -#define OFW_PCI_PHYS_HI_FUNCTIONSHIFT 8 - -#define pcibus(x) \ - (((x) & OFW_PCI_PHYS_HI_BUSMASK) >> OFW_PCI_PHYS_HI_BUSSHIFT) -#define pcidev(x) \ - (((x) & OFW_PCI_PHYS_HI_DEVICEMASK) >> OFW_PCI_PHYS_HI_DEVICESHIFT) -#define pcifunc(x) \ - (((x) & OFW_PCI_PHYS_HI_FUNCTIONMASK) >> OFW_PCI_PHYS_HI_FUNCTIONSHIFT) - -/* - * Find PCI IRQ from OF - */ -int -find_node_intr(int parent, u_int32_t *addr, u_int32_t *intr) -{ - int iparent, len, mlen, n_mlen; - int match, i, step; - u_int32_t map[144], *mp, *mp1; - u_int32_t imask[8], maskedaddr[8]; - - len = OF_getprop(parent, "interrupt-map", map, sizeof(map)); - mlen = OF_getprop(parent, "interrupt-map-mask", imask, sizeof(imask)); - - if ((len == -1) || (mlen == -1)) - goto nomap; - n_mlen = mlen/sizeof(u_int32_t); - for (i = 0; i < n_mlen; i++) - maskedaddr[i] = addr[i] & imask[i]; - - mp = map; - /* calculate step size of interrupt-map - * -- assumes that iparent will be same for all nodes - */ - iparent = mp[n_mlen]; - step = 0; - for (i = (n_mlen)+1; i < len; i++) - if (mp[i] == iparent) { - step = i - (n_mlen); - break; - } - if (step == 0) { - /* unable to determine step size */ - return -1; - } - - while (len > mlen) { - match = bcmp(maskedaddr, mp, mlen); - mp1 = mp + n_mlen; - - if (match == 0) { - /* multiple irqs? */ - if (step == 9) { - /* pci-pci bridge */ - iparent = *mp1; - /* recurse with new 'addr' */ - return find_node_intr(iparent, &mp1[1], intr); - } else - *intr = mp1[1]; - return 1; - } - len -= step * sizeof(u_int32_t); - mp += step; - } -nomap: - return -1; -} - -void -fix_node_irq(int node, struct pcibus_attach_args *pba) -{ - struct { - u_int32_t phys_hi, phys_mid, phys_lo; - u_int32_t size_hi, size_lo; - } addr [8]; - int len; - pcitag_t tag; - u_int32_t irq; - u_int32_t intr; - int parent; - - pci_chipset_tag_t pc = pba->pba_pc; - - len = OF_getprop(node, "assigned-addresses", addr, sizeof(addr)); - if (len < sizeof(addr[0])) - return; - - /* - * if this node has a AAPL,interrupts property, firmware - * has initialized the register correctly. - */ - len = OF_getprop(node, "AAPL,interrupts", &intr, 4); - if (len != 4) { - parent = OF_parent(node); - - /* we want the first interrupt, set size_hi to 1 */ - addr[0].size_hi = 1; - if (find_node_intr(parent, &addr[0].phys_hi, &irq) == -1) - return; - } - /* program the interrupt line register with the value - * found in openfirmware - */ - - tag = pci_make_tag(pc, pcibus(addr[0].phys_hi), - pcidev(addr[0].phys_hi), pcifunc(addr[0].phys_hi)); - - intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG); - intr &= ~PCI_INTERRUPT_LINE_MASK; - intr |= irq & PCI_INTERRUPT_LINE_MASK; - pci_conf_write(pc, tag, PCI_INTERRUPT_REG, intr); -} - -static int -mpcpcibrprint(void *aux, const char *pnp) -{ - struct pcibus_attach_args *pba = aux; - - if (pnp) - printf("%s at %s", pba->pba_busname, pnp); - printf(" bus %d", pba->pba_bus); - return(UNCONF); -} - -/* - * Get PCI physical address from given virtual address. - * XXX Note that cross page boundaries are *not* guaranteed to work! - */ - -paddr_t -vtophys(paddr_t pa) -{ - - vaddr_t va = (vaddr_t) pa; - - if (va < VM_MIN_KERNEL_ADDRESS) - pa = va; - else - pmap_extract(vm_map_pmap(phys_map), va, &pa); - - return (pa | ((pci_map_a == 1) ? MPC106_PCI_CPUMEM : 0 )); -} - - -void -mpc_attach_hook( struct device *parent, struct device *self, - struct pcibus_attach_args *pba) -{ -} - -int -of_ether_hw_addr(struct ppc_pci_chipset *lcpc, u_int8_t *oaddr) -{ - u_int8_t laddr[6]; - struct pcibr_config *lcp = lcpc->pc_conf_v; - int of_node = lcp->node; - int node, nn; - for (node = OF_child(of_node); node; node = nn) { - char name[32]; - int len; - len = OF_getprop(node, "name", name, sizeof(name)); - name[len] = 0; - - len = OF_getprop(node, "local-mac-address", laddr, - sizeof laddr); - if (sizeof(laddr) == len) { - bcopy (laddr, oaddr, sizeof laddr); - return 1; - } - - /* iterate section */ - if ((nn = OF_child(node)) != 0) - continue; - - while ((nn = OF_peer(node)) == 0) { - node = OF_parent(node); - if (node == of_node) { - nn = 0; /* done */ - break; - } - } - } - oaddr[0] = oaddr[1] = oaddr[2] = 0xff; - oaddr[3] = oaddr[4] = oaddr[5] = 0xff; - return 0; -} - -int -mpc_ether_hw_addr(struct ppc_pci_chipset *p, u_int8_t *s) -{ - printf("mpc_ether_hw_addr not supported\n"); - return(0); -} - -int -mpc_bus_maxdevs(void *cpv, int busno) -{ - return(32); -} - -#define BUS_SHIFT 16 -#define DEVICE_SHIFT 11 -#define FNC_SHIFT 8 - -pcitag_t -mpc_make_tag(void *cpv, int bus, int dev, int fnc) -{ - return (bus << BUS_SHIFT) | (dev << DEVICE_SHIFT) | (fnc << FNC_SHIFT); -} - -void -mpc_decompose_tag(void *cpv, pcitag_t tag, int *busp, int *devp, int *fncp) -{ - if (busp != NULL) - *busp = (tag >> BUS_SHIFT) & 0xff; - if (devp != NULL) - *devp = (tag >> DEVICE_SHIFT) & 0x1f; - if (fncp != NULL) - *fncp = (tag >> FNC_SHIFT) & 0x7; -} - -u_int32_t -mpc_gen_config_reg(void *cpv, pcitag_t tag, int offset) -{ - struct pcibr_config *cp = cpv; - unsigned int bus, dev, fcn; - u_int32_t reg; - /* - static int spin = 0; - while (spin > 85); - spin++; - */ - - mpc_decompose_tag(cpv, tag, &bus, &dev, &fcn); - - if (cp->config_type & 1) { - /* Config Mechanism #2 */ - if (bus == 0) { - if (dev < 11) - return 0xffffffff; - /* - * Need to do config type 0 operation - * 1 << (11?+dev) | fcn << 8 | reg - * 11? is because pci spec states - * that 11-15 is reserved. - */ - reg = 1 << (dev) | fcn << 8 | offset; - } else { - if (dev > 15) - return 0xffffffff; - /* - * config type 1 - */ - reg = tag | offset | 1; - - } - } else { - /* config mechanism #2, type 0 - * standard cf8/cfc config - */ - reg = 0x80000000 | tag | offset; - - } - return reg; -} - -int marvell_data[16] = { - 0x00000000, /* 0: is passed on to the device (RO) */ - 0x00000000, /* 4: is passed on to the device (RO) */ - 0x00000000, /* 8: is passed on to the device (RO) */ - 0x00000000, /* c: is passed on to the device (RO) */ - 0x00000000, /* 10: faked 0 BAR */ - 0x00000000, /* 14: faked 0 BAR */ - 0x00000000, /* 18: faked 0 BAR */ - 0x00000000, /* 1c: faked 0 BAR */ - 0x00000000, /* 20: faked 0 BAR */ - 0x00000000, /* 24: faked 0 BAR */ - 0x00000000, /* 28: faked 0 CIS */ - 0x00000000, /* 2c: faked 0 Subsystem */ - 0x00000000, /* 30: faked 0 ROM */ - 0x00000000, /* 34: faked 0 Res */ - 0x00000000, /* 28: faked 0 Res */ - 0x00000109 /* 3c: faked 0 Lat/Gnt/pin/line */ -}; - -pcireg_t -peg2_conf_read(void *cpv, pcitag_t tag, int offset) -{ - struct pcibr_config *cp = cpv; - pcireg_t data; - u_int32_t reg; - int s; - int daddr = 0; - faultbuf env; - void *oldh; - - if (offset & 3 || offset < 0 || offset >= 0x100) - return(~0); - - reg = mpc_gen_config_reg(cpv, tag, offset); - /* if invalid tag, return -1 */ - if (reg == 0xffffffff) - return(~0); - - if (pegasos == 2 && tag == 0) { - if (offset >= 0x40) - return (~0); - - if (offset >= 0x10) - return marvell_data[offset / 4]; - - /* registers < 0x10 allow read */ - } - - if ((cp->config_type & 2) && (offset & 0x04)) - daddr += 4; - - s = ppc_intr_disable(); - - oldh = curpcb->pcb_onfault; - if (setfault(&env)) { - /* we faulted during the read? */ - curpcb->pcb_onfault = oldh; - ppc_intr_enable(s); - return 0xffffffff; - } - - bus_space_write_4(&marvell_io, marvell_ioh, 0x118, 0x00800000); - bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, reg); - bus_space_read_4(cp->lc_iot, cp->ioh_cf8, 0); /* XXX */ - data = bus_space_read_4(cp->lc_iot, cp->ioh_cfc, daddr); - bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, 0); /* disable */ - bus_space_read_4(cp->lc_iot, cp->ioh_cf8, 0); /* XXX */ - bus_space_write_4(&marvell_io, marvell_ioh, 0x11c, 0x00800000); - - curpcb->pcb_onfault = oldh; - - ppc_intr_enable(s); - return(data); -} -void -peg2_conf_write(void *cpv, pcitag_t tag, int offset, pcireg_t data) -{ - struct pcibr_config *cp = cpv; - u_int32_t reg; - int s; - int daddr = 0; - - reg = mpc_gen_config_reg(cpv, tag, offset); - - /* if invalid tag, return ??? */ - if (reg == 0xffffffff) - return; - - if (pegasos == 2 && tag == 0) { - switch (offset) { - case 0x3c: - marvell_data[offset / 4] = data; - return; - } - - if (offset != 4) - return; - } - - if ((cp->config_type & 2) && (offset & 0x04)) - daddr += 4; - - s = splhigh(); - - bus_space_write_4(&marvell_io, marvell_ioh, 0x118, 0x00800000); - bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, reg); - bus_space_read_4(cp->lc_iot, cp->ioh_cf8, 0); /* XXX */ - bus_space_write_4(cp->lc_iot, cp->ioh_cfc, daddr, data); - bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, 0); /* disable */ - bus_space_read_4(cp->lc_iot, cp->ioh_cf8, 0); /* XXX */ - bus_space_write_4(&marvell_io, marvell_ioh, 0x11c, 0x00800000); - - splx(s); -} - -pcireg_t -mpc_conf_read(void *cpv, pcitag_t tag, int offset) -{ - struct pcibr_config *cp = cpv; - pcireg_t data; - u_int32_t reg; - int s; - int daddr = 0; - faultbuf env; - void *oldh; - - if (offset & 3 || offset < 0 || offset >= 0x100) - return(~0); - - reg = mpc_gen_config_reg(cpv, tag, offset); - /* if invalid tag, return -1 */ - if (reg == 0xffffffff) - return(~0); - - if (pegasos == 2 && tag == 0) { - if (offset >= 0x40) - return (~0); - - if (offset >= 0x10) - return marvell_data[offset / 4]; - - /* registers < 0x10 allow read */ - } - - if ((cp->config_type & 2) && (offset & 0x04)) - daddr += 4; - - s = splhigh(); - - oldh = curpcb->pcb_onfault; - if (setfault(&env)) { - /* we faulted during the read? */ - curpcb->pcb_onfault = oldh; - return 0xffffffff; - } - - bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, reg); - bus_space_read_4(cp->lc_iot, cp->ioh_cf8, 0); /* XXX */ - data = bus_space_read_4(cp->lc_iot, cp->ioh_cfc, daddr); - bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, 0); /* disable */ - bus_space_read_4(cp->lc_iot, cp->ioh_cf8, 0); /* XXX */ - - curpcb->pcb_onfault = oldh; - - splx(s); - return(data); -} -void -mpc_conf_write(void *cpv, pcitag_t tag, int offset, pcireg_t data) -{ - struct pcibr_config *cp = cpv; - u_int32_t reg; - int s; - int daddr = 0; - - reg = mpc_gen_config_reg(cpv, tag, offset); - - /* if invalid tag, return ??? */ - if (reg == 0xffffffff) - return; - - if (pegasos == 2 && tag == 0) { - switch (offset) { - case 0x3c: - marvell_data[offset / 4] = data; - return; - } - - if (offset != 4) - return; - } - - if ((cp->config_type & 2) && (offset & 0x04)) - daddr += 4; - - s = splhigh(); - - bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, reg); - bus_space_read_4(cp->lc_iot, cp->ioh_cf8, 0); /* XXX */ - bus_space_write_4(cp->lc_iot, cp->ioh_cfc, daddr, data); - bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, 0); /* disable */ - bus_space_read_4(cp->lc_iot, cp->ioh_cf8, 0); /* XXX */ - - splx(s); -} - - -/*ARGSUSED*/ -int -mpc_intr_map(void *lcv, pcitag_t bustag, int buspin, int line, - pci_intr_handle_t *ihp) -{ - int error = 0; - - *ihp = -1; - if (buspin == 0) - error = 1; /* No IRQ used. */ - else if (buspin > 4) { - printf("mpc_intr_map: bad interrupt pin %d\n", buspin); - error = 1; - } - - if (!error) - *ihp = line; - return error; -} - -const char * -mpc_intr_string(void *lcv, pci_intr_handle_t ih) -{ - static char str[16]; - - snprintf(str, sizeof str, "irq %ld", ih); - return(str); -} - -int -mpc_intr_line(void *lcv, pci_intr_handle_t ih) -{ - return (ih); -} - -void * -mpc_intr_establish(void *lcv, pci_intr_handle_t ih, int level, - int (*func)(void *), void *arg, char *name) -{ - return (*intr_establish_func)(lcv, ih, IST_LEVEL, level, func, arg, - name); -} - -void -mpc_intr_disestablish(void *lcv, void *cookie) -{ - /* XXX We should probably do something clever here.... later */ -} - -/* - * do pci IACK cycle - */ - -u_int32_t -pci_iack() -{ - u_int8_t val; - struct pcibr_softc *sc = (void *)mpcpcibr_cd.cd_devs[0]; - - val = bus_space_read_1(&(sc->sc_iobus_space), sc->pci_iack_ioh, 0); - - return val; -} - -void -mpc_cfg_write_1(struct pcibr_config *cp, u_int32_t reg, u_int8_t val) -{ - int s; - s = splhigh(); - bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, MPC106_REGOFFS(reg)); - bus_space_write_1(cp->lc_iot, cp->ioh_cfc, 0, val); - splx(s); -} - -void -mpc_cfg_write_2(struct pcibr_config *cp, u_int32_t reg, u_int16_t val) -{ - int s; - s = splhigh(); - bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, MPC106_REGOFFS(reg)); - bus_space_write_2(cp->lc_iot, cp->ioh_cfc, 0, val); - splx(s); -} - -void -mpc_cfg_write_4(struct pcibr_config *cp, u_int32_t reg, u_int32_t val) -{ - - int s; - s = splhigh(); - bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, MPC106_REGOFFS(reg)); - bus_space_write_4(cp->lc_iot, cp->ioh_cfc, 0, val); - splx(s); -} - -u_int8_t -mpc_cfg_read_1(struct pcibr_config *cp, u_int32_t reg) -{ - u_int8_t _v_; - - int s; - s = splhigh(); - bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, MPC106_REGOFFS(reg)); - _v_ = bus_space_read_1(cp->lc_iot, cp->ioh_cfc, 0); - splx(s); - return(_v_); -} - -u_int16_t -mpc_cfg_read_2(struct pcibr_config *cp, u_int32_t reg) -{ - u_int16_t _v_; - - int s; - s = splhigh(); - bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, MPC106_REGOFFS(reg)); - _v_ = bus_space_read_2(cp->lc_iot, cp->ioh_cfc, 0); - splx(s); - return(_v_); -} - -u_int32_t -mpc_cfg_read_4(struct pcibr_config *cp, u_int32_t reg) -{ - u_int32_t _v_; - - int s; - s = splhigh(); - bus_space_write_4(cp->lc_iot, cp->ioh_cf8, 0, MPC106_REGOFFS(reg)); - _v_ = bus_space_read_4(cp->lc_iot, cp->ioh_cfc, 0); - splx(s); - return(_v_); -} - -int -pci_intr_line(pci_intr_handle_t ih) -{ - return (ih); -} diff --git a/sys/arch/pegasos/pci/pchb.c b/sys/arch/pegasos/pci/pchb.c deleted file mode 100644 index f3a47d5fa3e..00000000000 --- a/sys/arch/pegasos/pci/pchb.c +++ /dev/null @@ -1,101 +0,0 @@ -/* $OpenBSD: pchb.c,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* $NetBSD: pchb.c,v 1.4 2000/01/25 07:19:11 tsubai 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. - */ - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> - -#include <machine/bus.h> - -#include <dev/pci/pcivar.h> -#include <dev/pci/pcireg.h> -#include <dev/pci/pcidevs.h> - -int pchbmatch(struct device *, void *, void *); -void pchbattach(struct device *, struct device *, void *); - -struct cfattach pchb_ca = { - sizeof(struct device), pchbmatch, pchbattach -}; - -struct cfdriver pchb_cd = { - NULL, "pchb", DV_DULL -}; - -int -pchbmatch(struct device *parent, void *cf, void *aux) -{ - struct pci_attach_args *pa = aux; - - /* - * Match all known PCI host chipsets. - */ - switch (PCI_VENDOR(pa->pa_id)) { - case PCI_VENDOR_MENTOR: - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_MENTOR_PCI0660: - return (1); - } - break; - default: - ; - } - - return (0); -} - -/*ARGSUSED*/ -void -pchbattach(struct device *parent, struct device *self, void *aux) -{ - printf("\n"); - - /* - * All we do is print out a description. Eventually, we - * might want to add code that does something that's - * possibly chipset-specific. - */ - - /* - pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof devinfo); - printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo, - PCI_REVISION(pa->pa_class)); - */ -} diff --git a/sys/arch/pegasos/pci/pci_addr_fixup.c b/sys/arch/pegasos/pci/pci_addr_fixup.c deleted file mode 100644 index 37905ed2669..00000000000 --- a/sys/arch/pegasos/pci/pci_addr_fixup.c +++ /dev/null @@ -1,466 +0,0 @@ -/* $OpenBSD: pci_addr_fixup.c,v 1.4 2003/12/20 22:40:27 miod Exp $ */ -/* $NetBSD: pci_addr_fixup.c,v 1.7 2000/08/03 20:10:45 nathanw Exp $ */ - -/*- - * Copyright (c) 2000 UCHIYAMA Yasushi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/malloc.h> -#include <sys/kernel.h> -#include <sys/device.h> -#include <sys/extent.h> - -#include <uvm/uvm_param.h> -#include <machine/bus.h> - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <dev/pci/pcidevs.h> - -#include <macppc/pci/pcibrvar.h> - -typedef int (*pciaddr_resource_manage_func_t)(struct pcibr_softc *, - pci_chipset_tag_t, pcitag_t, int, struct extent *, int, bus_addr_t *, - bus_size_t); -void pciaddr_resource_manage(struct pcibr_softc *, - pci_chipset_tag_t, pcitag_t, pciaddr_resource_manage_func_t); -void pciaddr_resource_reserve(struct pcibr_softc *, - pci_chipset_tag_t, pcitag_t); -int pciaddr_do_resource_reserve(struct pcibr_softc *, - pci_chipset_tag_t, pcitag_t, int, struct extent *, int, - bus_addr_t *, bus_size_t); -void pciaddr_resource_allocate(struct pcibr_softc *, - pci_chipset_tag_t, pcitag_t); -int pciaddr_do_resource_allocate(struct pcibr_softc *, - pci_chipset_tag_t, pcitag_t, int, struct extent *, int, bus_addr_t *, - bus_size_t); -bus_addr_t pciaddr_ioaddr(u_int32_t); -void pciaddr_print_devid(pci_chipset_tag_t, pcitag_t); - -int pciaddr_device_is_agp(pci_chipset_tag_t, pcitag_t); - -void pci_device_foreach(struct pcibr_softc *sc, pci_chipset_tag_t pc, - int maxbus, - void (*func)(struct pcibr_softc *, pci_chipset_tag_t, pcitag_t)); - -#define PCIADDR_MEM_START 0x0 -#define PCIADDR_MEM_END 0xffffffff -#define PCIADDR_PORT_START 0x0 -#define PCIADDR_PORT_END 0xffff - -int pcibr_flags = 0; -#define PCIBR_VERBOSE 1 -#define PCIBR_ADDR_FIXUP 2 - -#define PCIBIOS_PRINTV(x) if (pcibr_flags & PCIBR_VERBOSE) \ - printf x - -void -pci_addr_fixup(struct pcibr_softc *sc, pci_chipset_tag_t pc, int maxbus) -{ - const char *verbose_header = - "[%s]-----------------------\n" - " device vendor product\n" - " register space address size\n" - "--------------------------------------------\n"; - const char *verbose_footer = - "--------------------------[%3d devices bogus]\n"; - - sc->extent_mem = extent_create("PCI I/O memory space", - sc->sc_membus_space.bus_base, - sc->sc_membus_space.bus_base + sc->sc_membus_space.bus_size, - M_DEVBUF, 0, 0, EX_NOWAIT); - KASSERT(sc->extent_mem); - sc->extent_port = extent_create("PCI I/O port space", - PCIADDR_PORT_START, PCIADDR_PORT_END, - M_DEVBUF, 0, 0, EX_NOWAIT); - KASSERT(sc->extent_port); - - /* - * 1. check & reserve system BIOS setting. - */ - PCIBIOS_PRINTV((verbose_header, "System BIOS Setting")); - pci_device_foreach(sc, pc, maxbus, pciaddr_resource_reserve); - PCIBIOS_PRINTV((verbose_footer, sc->nbogus)); - - { - struct extent_region *rp; - struct extent *ex = sc->extent_mem; - for (rp = LIST_FIRST(&ex->ex_regions); - rp; rp = LIST_NEXT(rp, er_link)) { - } - } - { - struct extent_region *rp; - struct extent *ex = sc->extent_port; - for (rp = LIST_FIRST(&ex->ex_regions); - rp; rp = LIST_NEXT(rp, er_link)) { - } - } - - if (sc->nbogus == 0) - return; /* no need to fixup */ - - /* - * 4. do fixup - */ - PCIBIOS_PRINTV((verbose_header, "PCIBIOS fixup stage")); - sc->nbogus = 0; - pci_device_foreach(sc, pc, maxbus, pciaddr_resource_allocate); - PCIBIOS_PRINTV((verbose_footer, sc->nbogus)); - -} - -void -pciaddr_resource_reserve(struct pcibr_softc *sc, pci_chipset_tag_t pc, - pcitag_t tag) -{ - if (pcibr_flags & PCIBR_VERBOSE) - pciaddr_print_devid(pc, tag); - pciaddr_resource_manage(sc, pc, tag, pciaddr_do_resource_reserve); -} - -void -pciaddr_resource_allocate(struct pcibr_softc *sc, pci_chipset_tag_t pc, - pcitag_t tag) -{ - if (pcibr_flags & PCIBR_VERBOSE) - pciaddr_print_devid(pc, tag); - pciaddr_resource_manage(sc, pc, tag, pciaddr_do_resource_allocate); -} - -void -pciaddr_resource_manage(struct pcibr_softc *sc, pci_chipset_tag_t pc, - pcitag_t tag, pciaddr_resource_manage_func_t func) -{ - struct extent *ex; - pcireg_t val, mask; - bus_addr_t addr; - bus_size_t size; - int error, mapreg, type, reg_start, reg_end, width; - - val = pci_conf_read(pc, tag, PCI_BHLC_REG); - switch (PCI_HDRTYPE_TYPE(val)) { - default: - printf("WARNING: unknown PCI device header.\n"); - sc->nbogus++; - return; - case 0: - reg_start = PCI_MAPREG_START; - reg_end = PCI_MAPREG_END; - break; - case 1: /* PCI-PCI bridge */ - reg_start = PCI_MAPREG_START; - reg_end = PCI_MAPREG_PPB_END; - break; - case 2: /* PCI-CardBus bridge */ - reg_start = PCI_MAPREG_START; - reg_end = PCI_MAPREG_PCB_END; - break; - } - error = 0; - - for (mapreg = reg_start; mapreg < reg_end; mapreg += width) { - /* inquire PCI device bus space requirement */ - val = pci_conf_read(pc, tag, mapreg); - pci_conf_write(pc, tag, mapreg, ~0); - - mask = pci_conf_read(pc, tag, mapreg); - pci_conf_write(pc, tag, mapreg, val); - - type = PCI_MAPREG_TYPE(val); - width = 4; - if (type == PCI_MAPREG_TYPE_MEM) { - if (PCI_MAPREG_MEM_TYPE(val) == - PCI_MAPREG_MEM_TYPE_64BIT) { - /* XXX We could examine the upper 32 bits - * XXX of the BAR here, but we are totally - * XXX unprepared to handle a non-zero value, - * XXX either here or anywhere else in - * XXX i386-land. - * XXX So just arrange to not look at the - * XXX upper 32 bits, lest we misinterpret - * XXX it as a 32-bit BAR set to zero. - */ - width = 8; - } - addr = PCI_MAPREG_MEM_ADDR(val); - size = PCI_MAPREG_MEM_SIZE(mask); - ex = sc->extent_mem; - } else { - /* XXX some devices give 32bit value */ - addr = PCI_MAPREG_IO_ADDR(val) & PCIADDR_PORT_END; - size = PCI_MAPREG_IO_SIZE(mask); - ex = sc->extent_port; - } - - if (!size) /* unused register */ - continue; - - /* reservation/allocation phase */ - - /* - * pegasos host bridge has register for isa space - * which is not in PCI XXX ??? - */ - if (addr != 0xffc00000) - error += (*func) (sc, pc, tag, mapreg, ex, type, - &addr, size); - - PCIBIOS_PRINTV(("\t%02xh %s 0x%08x 0x%08x\n", - mapreg, type ? "port" : "mem ", - (unsigned int)addr, (unsigned int)size)); - } - - /* enable/disable PCI device */ - val = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); - if (error == 0) - val |= (PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE | - PCI_COMMAND_MASTER_ENABLE); - else - val &= ~(PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE | - PCI_COMMAND_MASTER_ENABLE); - pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, val); - - if (error) - sc->nbogus++; - - PCIBIOS_PRINTV(("\t\t[%s]\n", error ? "NG" : "OK")); -} - -int -pciaddr_do_resource_allocate(struct pcibr_softc *sc, pci_chipset_tag_t pc, - pcitag_t tag, int mapreg, struct extent *ex, int type, bus_addr_t *addr, - bus_size_t size) -{ - bus_addr_t start; - int error; - - if (*addr) /* no need to allocate */ - return (0); - - /* XXX Don't allocate if device is AGP device to avoid conflict. */ - if (pciaddr_device_is_agp(pc, tag)) - return (0); - - start = (type == PCI_MAPREG_TYPE_MEM ? sc->sc_membus_space.bus_base - : PCIADDR_PORT_START); - if (start < ex->ex_start || start + size - 1 >= ex->ex_end) { - PCIBIOS_PRINTV(("No available resources. fixup failed\n")); - return (1); - } - error = extent_alloc_subregion(ex, start, ex->ex_end, size, size, 0, 0, - EX_FAST|EX_NOWAIT|EX_MALLOCOK, addr); - if (error) { - PCIBIOS_PRINTV(("No available resources. fixup failed\n")); - return (1); - } - - /* write new address to PCI device configuration header */ - pci_conf_write(pc, tag, mapreg, *addr); - /* check */ - if (pcibr_flags & PCIBR_VERBOSE) { - printf("pci_addr_fixup: "); - pciaddr_print_devid(pc, tag); - } - - if (pciaddr_ioaddr(pci_conf_read(pc, tag, mapreg)) != *addr) { - pci_conf_write(pc, tag, mapreg, 0); /* clear */ - printf("fixup failed. (new address=%#lx)\n", *addr); - return (1); - } - if (pcibr_flags & PCIBR_VERBOSE) - printf("new address 0x%08lx\n", *addr); - - return (0); -} - -int -pciaddr_do_resource_reserve(struct pcibr_softc *sc, pci_chipset_tag_t pc, - pcitag_t tag, int mapreg, struct extent *ex, int type, bus_addr_t *addr, - bus_size_t size) -{ - int error; - - if (*addr == 0) - return (1); - - error = extent_alloc_region(ex, *addr, size, EX_NOWAIT | EX_MALLOCOK); - if (error) { - PCIBIOS_PRINTV(("Resource conflict.\n")); - pci_conf_write(pc, tag, mapreg, 0); /* clear */ - return (1); - } - - return (0); -} - -bus_addr_t -pciaddr_ioaddr(u_int32_t val) -{ - return ((PCI_MAPREG_TYPE(val) == PCI_MAPREG_TYPE_MEM) - ? PCI_MAPREG_MEM_ADDR(val) - : (PCI_MAPREG_IO_ADDR(val) & PCIADDR_PORT_END)); -} - -void -pciaddr_print_devid(pci_chipset_tag_t pc, pcitag_t tag) -{ - int bus, device, function; - pcireg_t id; - - id = pci_conf_read(pc, tag, PCI_ID_REG); - pci_decompose_tag(pc, tag, &bus, &device, &function); - printf("%03d:%02d:%d %04x:%04x\n", bus, device, function, - PCI_VENDOR(id), PCI_PRODUCT(id)); -} - -int -pciaddr_device_is_agp(pci_chipset_tag_t pc, pcitag_t tag) -{ - pcireg_t class, status, rval; - int off; - - /* Check AGP device. */ - class = pci_conf_read(pc, tag, PCI_CLASS_REG); - if (PCI_CLASS(class) == PCI_CLASS_DISPLAY) { - status = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); - if (status & PCI_STATUS_CAPLIST_SUPPORT) { - rval = pci_conf_read(pc, tag, PCI_CAPLISTPTR_REG); - for (off = PCI_CAPLIST_PTR(rval); - off != 0; - off = PCI_CAPLIST_NEXT(rval) ) { - rval = pci_conf_read(pc, tag, off); - if (PCI_CAPLIST_CAP(rval) == PCI_CAP_AGP) - return (1); - } - } - } - return (0); -} - - -struct extent * -pciaddr_search(int mem_port, struct device *parent, bus_addr_t *startp, - bus_size_t size) -{ - struct pcibr_softc *sc; - - /* find the bridge, 'mpcpcibr' */ - - sc = NULL; - while (parent != NULL) { - if (strncmp("mpcpcibr", parent->dv_xname, 8) == 0) { - sc = (void *)parent; - break; - } - parent = parent->dv_parent; - } - - if (sc && !(pcibr_flags & PCIBR_ADDR_FIXUP)) { - struct extent_region *rp; - struct extent *ex = mem_port? sc->extent_mem : sc->extent_port; - - /* Search the PCI I/O memory space extent for free - * space that will accommodate size. Remember that the - * extent stores allocated space and we're searching - * for the gaps. - * - * If we're at the end or the gap between this region - * and the next region big enough, then we're done - */ - *startp = ex->ex_start; - rp = LIST_FIRST(&ex->ex_regions); - - for (rp = LIST_FIRST(&ex->ex_regions); - rp && *startp + size > rp->er_start; - rp = LIST_NEXT(rp, er_link)) { - bus_addr_t new_start; - - new_start = (rp->er_end - 1 + size) & ~(size - 1); - if (new_start > *startp) - *startp = new_start; - } - - return (ex); - } - - return (NULL); -} - - -void -pci_device_foreach(struct pcibr_softc *sc, pci_chipset_tag_t pc, int maxbus, - void (*func)(struct pcibr_softc *, pci_chipset_tag_t, pcitag_t)) -{ - const struct pci_quirkdata *qd; - int bus, device, function, maxdevs, nfuncs; - pcireg_t id, bhlcr; - pcitag_t tag; - - for (bus = 0; bus <= maxbus; bus++) { - maxdevs = pci_bus_maxdevs(pc, bus); - for (device = 0; device < maxdevs; device++) { - tag = pci_make_tag(pc, bus, device, 0); - id = pci_conf_read(pc, tag, PCI_ID_REG); - - /* Invalid vendor ID value? */ - if (PCI_VENDOR(id) == PCI_VENDOR_INVALID) - continue; - /* XXX Not invalid, but we've done this ~forever. */ - if (PCI_VENDOR(id) == 0) - continue; - - qd = pci_lookup_quirkdata(PCI_VENDOR(id), - PCI_PRODUCT(id)); - - bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG); - if (PCI_HDRTYPE_MULTIFN(bhlcr) || - (qd != NULL && - (qd->quirks & PCI_QUIRK_MULTIFUNCTION) != 0)) - nfuncs = 8; - else - nfuncs = 1; - - for (function = 0; function < nfuncs; function++) { - tag = pci_make_tag(pc, bus, device, function); - id = pci_conf_read(pc, tag, PCI_ID_REG); - - /* Invalid vendor ID value? */ - if (PCI_VENDOR(id) == PCI_VENDOR_INVALID) - continue; - /* - * XXX Not invalid, but we've done this - * ~forever. - */ - if (PCI_VENDOR(id) == 0) - continue; - (*func)(sc, pc, tag); - } - } - } -} diff --git a/sys/arch/pegasos/pci/pcibrvar.h b/sys/arch/pegasos/pci/pcibrvar.h deleted file mode 100644 index 063e619f304..00000000000 --- a/sys/arch/pegasos/pci/pcibrvar.h +++ /dev/null @@ -1,75 +0,0 @@ -/* $OpenBSD: pcibrvar.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -/* - * Copyright (c) 1997 Per Fogelstrom - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <dev/pci/pcidevs.h> - -struct pcibr_config { - bus_space_tag_t lc_memt; - bus_space_tag_t lc_iot; - bus_space_handle_t ioh_cf8; - bus_space_handle_t ioh_cfc; - struct ppc_pci_chipset lc_pc; - int config_type; - int bus; - int pci_init_done; - int node; - int handle; -}; - -struct pcibr_softc { - struct device sc_dev; - struct pcibr_config *sc_pcibr; - struct ppc_bus_space sc_membus_space; - struct ppc_bus_space sc_iobus_space; - struct powerpc_bus_dma_tag sc_dmatag; - struct pcibr_config pcibr_config; - struct extent *extent_mem; - struct extent *extent_port; - u_int32_t mem_alloc_start; - u_int32_t port_alloc_start; - bus_space_handle_t pci_iack_ioh; - int nbogus; -}; - -struct pci_reserve_mem { - bus_addr_t start; - bus_size_t size; - char *name; -}; - -void pci_addr_fixup(struct pcibr_softc *, pci_chipset_tag_t, int); - -#define PCIADDR_SEARCH_IO 0 -#define PCIADDR_SEARCH_MEM 1 - -u_int32_t pci_iack(void); - -struct extent * pciaddr_search(int mem_port, struct device *, - bus_addr_t *startp, bus_size_t size); diff --git a/sys/arch/pegasos/pci/pciide_machdep.c b/sys/arch/pegasos/pci/pciide_machdep.c deleted file mode 100644 index cf0fd58c388..00000000000 --- a/sys/arch/pegasos/pci/pciide_machdep.c +++ /dev/null @@ -1,78 +0,0 @@ -/* $OpenBSD: pciide_machdep.c,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* $NetBSD: pciide_machdep.c,v 1.2 1999/02/19 18:01:27 mycroft Exp $ */ - -/* - * Copyright (c) 1998 Christopher G. Demetriou. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christopher G. Demetriou - * for the NetBSD Project. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * PCI IDE controller driver (i386 machine-dependent portion). - * - * Author: Christopher G. Demetriou, March 2, 1998 (derived from NetBSD - * sys/dev/pci/ppb.c, revision 1.16). - * - * See "PCI IDE Controller Specification, Revision 1.0 3/4/94" from the - * PCI SIG. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <dev/pci/pciidereg.h> -#include <dev/pci/pciidevar.h> - -#include <dev/isa/isareg.h> -#include <dev/isa/isavar.h> - -#include <machine/autoconf.h> - -void * -pciide_machdep_compat_intr_establish(struct device *dev, - struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg) -{ - void *cookie; - int irq; - - irq = PCIIDE_COMPAT_IRQ(chan); - - cookie = isabr_intr_establish(NULL, irq, IST_LEVEL, IPL_BIO, func, - arg, dev->dv_xname); - return (cookie); -} - -void -pciide_machdep_compat_intr_disestablish(pci_chipset_tag_t pc, void *cookie) -{ - #if 0 - isabr_intr_disestablish(NULL, cookie); - #endif -} diff --git a/sys/arch/pegasos/pegasos/autoconf.c b/sys/arch/pegasos/pegasos/autoconf.c deleted file mode 100644 index 66fc1d3397e..00000000000 --- a/sys/arch/pegasos/pegasos/autoconf.c +++ /dev/null @@ -1,634 +0,0 @@ -/* $OpenBSD: autoconf.c,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* - * Copyright (c) 1996, 1997 Per Fogelstrom - * Copyright (c) 1995 Theo de Raadt - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah Hdr: autoconf.c 1.31 91/01/21 - * - * from: @(#)autoconf.c 8.1 (Berkeley) 6/10/93 - * $Id: autoconf.c,v 1.1 2003/10/31 03:54:33 drahn Exp $ - */ - -/* - * Setup the system to run on the current machine. - * - * cpu_configure() is called at boot time. Available - * devices are determined (from possibilities mentioned in ioconf.c), - * and the drivers are initialized. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/buf.h> -#include <sys/disklabel.h> -#include <sys/conf.h> -#include <sys/reboot.h> -#include <sys/device.h> -#include <dev/cons.h> -#include <uvm/uvm_extern.h> -#include <machine/autoconf.h> - -struct device *parsedisk(char *, int, int, dev_t *); -void setroot(void); -void swapconf(void); -extern void dumpconf(void); -int findblkmajor(struct device *); -char *findblkname(int); -static struct device * getdisk(char *, int, int, dev_t *); -struct device * getdevunit(char *, int); -static struct devmap * findtype(char **); -void makebootdev(char *cp); -int getpno(char **); -void diskconf(void); - -/* - * The following several variables are related to - * the configuration process, and are used in initializing - * the machine. - */ -int cold = 1; /* if 1, still working on cold-start */ -char bootdev[16]; /* to hold boot dev name */ -struct device *bootdv = NULL; - -/* - * Configure all devices found that we know about. - * This is done at boot time. - */ -void -cpu_configure() -{ - (void)splhigh(); /* To be really sure.. */ - calc_delayconst(); - - if(config_rootfound("mainbus", "mainbus") == 0) - panic("no mainbus found"); - (void)spl0(); - - /* - * We can not know which is our root disk, defer - * until we can checksum blocks to figure it out. - */ - md_diskconf = diskconf; - cold = 0; -} -/* - * Now that we are fully operational, we can checksum the - * disks, and using some heuristics, hopefully are able to - * always determine the correct root disk. - */ -void -diskconf() -{ - /* - * Configure root, swap, and dump area. This is - * currently done by running the same checksum - * algorithm over all known disks, as was done in - * /boot. Then we basically fixup the *dev vars - * from the info we gleaned from this. - dkcsumattach(); - * - XXX - */ - -#if 0 - rootconf(); -#endif - setroot(); - swapconf(); -#if 0 - dumpconf(); -#endif -} - -/* - * Configure swap space and related parameters. - */ -void -swapconf() -{ - struct swdevt *swp; - 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; - swp->sw_nblks = ctod(dtoc(swp->sw_nblks)); - } - } -#if 0 - dumpconf(); -#endif -} - -/* - * Crash dump handling. - */ -u_long dumpmag = 0x8fca0101; /* magic number */ -int dumpsize = 0; /* size of dump in pages */ -long dumplo = -1; /* blocks */ - -/* - * This is called by configure to set dumplo and dumpsize. - * Dumps always skip the first CLBYTES of disk space - * in case there might be a disk label stored there. - * If there is extra space, put dump at the end to - * reduce the chance that swapping trashes it. - */ -#if 0 -void -dumpconf() -{ - int nblks; /* size of dump area */ - int maj; - - if (dumpdev == NODEV) - return; - maj = major(dumpdev); - if (maj < 0 || maj >= nblkdev) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); - if (bdevsw[maj].d_psize == NULL) - return; - nblks = (*bdevsw[maj].d_psize)(dumpdev); - if (nblks <= ctod(1)) - return; - - dumpsize = btoc(IOM_END + ctob(dumpmem_high)); - - /* Always skip the first CLBYTES, in case there is a label there. */ - if (dumplo < ctod(1)) - dumplo = ctod(1); - - /* Put dump at end of partition, and make it fit. */ - if (dumpsize > dtoc(nblks - dumplo)) - dumpsize = dtoc(nblks - dumplo); - if (dumplo < nblks - ctod(dumpsize)) - dumplo = nblks - ctod(dumpsize); -} -#endif - -static struct nam2blk { - char *name; - int maj; -} nam2blk[] = { - { "wd", 0 }, /* 0 = wd */ - { "sd", 2 }, /* 2 = sd */ - { "ofdisk", 4 }, /* 4 = ofdisk */ - { "raid", 19 }, /* 19 = raid */ -}; - -int -findblkmajor(struct device *dv) -{ - char *name = dv->dv_xname; - int i; - - for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i) - if (strncmp(name, nam2blk[i].name, strlen(nam2blk[i].name)) == - 0) - return (nam2blk[i].maj); - return (-1); -} - -char * -findblkname(int maj) -{ - int i; - - for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); i++) - if (nam2blk[i].maj == maj) - return (nam2blk[i].name); - return (NULL); -} - -static struct device * -getdisk(char *str, int len, int defpart, dev_t *devp) -{ - 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-p]", dv->dv_xname); -#ifdef NFSCLIENT - if (dv->dv_class == DV_IFNET) - printf(" %s", dv->dv_xname); -#endif - } - printf("\n"); - } - return (dv); -} - -struct device * -parsedisk(char *str, int len, int defpart, dev_t *devp) -{ - struct device *dv; - char *cp, c; - int majdev, part; - - if (len == 0) - return (NULL); - cp = str + len - 1; - c = *cp; - if (c >= 'a' && (c - 'a') < MAXPARTITIONS) { - 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. - */ -void -setroot() -{ - int majdev, mindev, unit, part, len; - dev_t temp; - struct swdevt *swp; - struct device *dv; - dev_t nrootdev, nswapdev = NODEV; - char buf[128]; - int s; - -#if defined(NFSCLIENT) - extern char *nfsbootdevname; -#endif - - printf("bootpath: '%s'\n", bootpath); - - makebootdev(bootpath); - if(boothowto & RB_DFLTROOT) - return; /* Boot compiled in */ - - /* - * (raid) device auto-configuration could have returned - * the root device's id in rootdev. Check this case. - */ - if (rootdev != NODEV) { - majdev = major(rootdev); - unit = DISKUNIT(rootdev); - part = DISKPART(rootdev); - - len = snprintf(buf, sizeof buf, "%s%d", findblkname(majdev), - unit); - if (len >= sizeof(buf)) - panic("setroot: device name too long"); - - bootdv = getdisk(buf, len, part, &rootdev); - } - - /* Lookup boot device from boot if not set by configuration */ - if(bootdv == NULL) { - bootdv = parsedisk(bootdev, strlen(bootdev), 0, &temp); - } - if(bootdv == NULL) { - printf("boot device: lookup '%s' failed.\n", bootdev); - boothowto |= RB_ASKNAME; /* Don't Panic :-) */ - /* boothowto |= RB_SINGLE; */ - } else - printf("boot device: %s.\n", bootdv->dv_xname); - - if (boothowto & RB_ASKNAME) { - for (;;) { - printf("root device "); - if (bootdv != NULL) - printf("(default %s%c)", - bootdv->dv_xname, - bootdv->dv_class == DV_DISK - ? 'a' : ' '); - printf(": "); - s = splimp(); - cnpollc(TRUE); - len = getsn(buf, sizeof(buf)); - - cnpollc(FALSE); - splx(s); - if (len == 0 && bootdv != NULL) { - strlcpy(buf, bootdv->dv_xname, sizeof buf); - len = strlen(buf); - } - if (len > 0 && buf[len - 1] == '*') { - buf[--len] = '\0'; - dv = getdisk(buf, len, 1, &nrootdev); - if (dv != NULL) { - bootdv = dv; - nswapdev = nrootdev; - goto gotswap; - } - } - dv = getdisk(buf, len, 0, &nrootdev); - if (dv != NULL) { - bootdv = dv; - break; - } - } - /* - * because swap must be on same device as root, for - * network devices this is easy. - */ - if (bootdv->dv_class == DV_IFNET) - goto gotswap; - - for (;;) { - printf("swap device "); - if (bootdv != NULL) - printf("(default %s%c)", - bootdv->dv_xname, - bootdv->dv_class == DV_DISK?'b':' '); - printf(": "); - s = splimp(); - cnpollc(TRUE); - len = getsn(buf, sizeof(buf)); - cnpollc(FALSE); - splx(s); - if (len == 0 && bootdv != NULL) { - switch (bootdv->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; - } - break; - } - dv = getdisk(buf, len, 1, &nswapdev); - if (dv) { - if (dv->dv_class == DV_IFNET) - nswapdev = NODEV; - break; - } - } - -gotswap: - rootdev = nrootdev; - dumpdev = nswapdev; - swdevt[0].sw_dev = nswapdev; - swdevt[1].sw_dev = NODEV; - } - else if(mountroot == NULL) { - /* - * `swap generic': Use the device the ROM told us to use. - */ - if (bootdv == NULL) - panic("boot device not known"); - - majdev = findblkmajor(bootdv); - - if (majdev >= 0) { - /* - * Root and Swap are on disk. - * Boot is always from partition 0. - */ - rootdev = MAKEDISKDEV(majdev, bootdv->dv_unit, 0); - nswapdev = MAKEDISKDEV(majdev, bootdv->dv_unit, 1); - dumpdev = nswapdev; - } else { - /* - * Root and Swap are on net. - */ - nswapdev = dumpdev = NODEV; - } - swdevt[0].sw_dev = nswapdev; - swdevt[1].sw_dev = NODEV; - - } else { - - /* - * `root DEV swap DEV': honour rootdev/swdevt. - * rootdev/swdevt/mountroot already properly set. - */ - return; - } - - switch (bootdv->dv_class) { -#if defined(NFSCLIENT) - case DV_IFNET: - mountroot = nfs_mountroot; - nfsbootdevname = bootdv->dv_xname; - return; -#endif - case DV_DISK: - mountroot = dk_mountroot; - majdev = major(rootdev); - mindev = minor(rootdev); - unit = DISKUNIT(rootdev); - part = DISKPART(rootdev); - printf("root on %s%c\n", bootdv->dv_xname, part + 'a'); - break; - default: - printf("can't figure root, hope your kernel is right\n"); - return; - } - - /* - * XXX: What is this doing? - */ - temp = NODEV; - for (swp = swdevt; swp->sw_dev != NODEV; swp++) { - if (majdev == major(swp->sw_dev) && - unit == 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; -} - -/* - * find a device matching "name" and unit number - */ -struct device * -getdevunit(char *name, int unit) -{ - struct device *dev = alldevs.tqh_first; - char num[10], fullname[16]; - int lunit; - - /* compute length of name and decimal expansion of unit number */ - snprintf(num, sizeof num, "%d", unit); - lunit = strlen(num); - if (strlen(name) + lunit >= sizeof(fullname) - 1) - panic("config_attach: device name too long"); - - strlcpy(fullname, name, sizeof fullname); - strlcat(fullname, num, sizeof fullname); - - while (strcmp(dev->dv_xname, fullname) != 0) - if ((dev = dev->dv_list.tqe_next) == NULL) - return NULL; - - return dev; -} - -struct devmap { - char *att; - char *dev; - int type; -}; -#define T_IFACE 0x10 - -#define T_BUS 0x00 -#define T_SCSI 0x11 -#define T_IDE 0x12 -#define T_DISK 0x21 - -static struct devmap * -findtype(char **s) -{ - static struct devmap devmap[] = { - { "/pci@", NULL, T_BUS }, - { "/pci", NULL, T_BUS }, - { "/AppleKiwi@",NULL, T_BUS }, - { "/AppleKiwi", NULL, T_BUS }, - { "/mac-io@", NULL, T_BUS }, - { "/mac-io", NULL, T_BUS }, - { "/@", NULL, T_BUS }, - { "/scsi@", "sd", T_SCSI }, - { "/ide", "wd", T_IDE }, - { "/ata", "wd", T_IDE }, - { "/disk@", "sd", T_DISK }, - { "/disk", "wd", T_DISK }, - { NULL, NULL } - }; - struct devmap *dp = &devmap[0]; - - while (dp->att) { - if (strncmp (*s, dp->att, strlen(dp->att)) == 0) { - *s += strlen(dp->att); - break; - } - dp++; - } - if (dp->att == NULL) - printf("string [%s] not found\n", *s); - - return(dp); -} - -/* - * Look at the string 'bp' and decode the boot device. - * Boot names look like: '/pci/scsi@c/disk@0,0/bsd' - * '/pci/mac-io/ide@20000/disk@0,0/bsd - * '/pci/mac-io/ide/disk/bsd - */ -void -makebootdev(char *bp) -{ - int unit; - char *dev, *cp; - struct devmap *dp; - - cp = bp; - do { - while(*cp && *cp != '/') - cp++; - - dp = findtype(&cp); - if (!dp->att) { - printf("Warning: boot device unrecognized: %s\n", bp); - return; - } - } while((dp->type & T_IFACE) == 0); - - dev = dp->dev; - while(*cp && *cp != '/') - cp++; - dp = findtype(&cp); - if (!dp->att || dp->type != T_DISK) { - printf("Warning: boot device unrecognized: %s\n", bp); - return; - } - unit = getpno(&cp); - snprintf(bootdev, sizeof bootdev, "%s%d%c", dev, unit, 'a'); -} - -int -getpno(char **cp) -{ - int val = 0; - char *cx = *cp; - - while(*cx && *cx >= '0' && *cx <= '9') { - val = val * 10 + *cx - '0'; - cx++; - } - *cp = cx; - return val; -} diff --git a/sys/arch/pegasos/pegasos/clock.c b/sys/arch/pegasos/pegasos/clock.c deleted file mode 100644 index 80593f386c0..00000000000 --- a/sys/arch/pegasos/pegasos/clock.c +++ /dev/null @@ -1,459 +0,0 @@ -/* $OpenBSD: clock.c,v 1.2 2003/12/18 20:06:15 drahn Exp $ */ -/* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */ - -/* - * Copyright (C) 1995, 1996 Wolfgang Solfrank. - * Copyright (C) 1995, 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> - -#include <machine/autoconf.h> -#include <machine/pio.h> -#include <machine/intr.h> -#include <machine/powerpc.h> -#include <dev/ofw/openfirm.h> - -void resettodr(void); - -/* XXX, called from asm code */ -void decr_intr(struct clockframe *frame); - -/* - * Initially we assume a processor with a bus frequency of 12.5 MHz. - */ -static u_int32_t ticks_per_sec = 3125000; -static u_int32_t ns_per_tick = 320; -static int32_t ticks_per_intr; -static volatile u_int64_t lasttb; - -/* - * BCD to decimal and decimal to BCD. - */ -#define FROMBCD(x) (((x) >> 4) * 10 + ((x) & 0xf)) -#define TOBCD(x) (((x) / 10 * 16) + ((x) % 10)) - -#define SECDAY (24 * 60 * 60) -#define SECYR (SECDAY * 365) -#define LEAPYEAR(y) (((y) & 3) == 0) -#define YEAR0 1900 - -#if 0 -typedef int (clock_read_t)(int *sec, int *min, int *hour, int *day, - int *mon, int *yr); -typedef int (time_read_t)(u_int32_t *sec); -typedef int (time_write_t)(u_int32_t sec); - -clock_read_t *clock_read = NULL; -time_read_t *time_read = NULL; -time_write_t *time_write = NULL; - -static u_int32_t chiptotime(int sec, int min, int hour, int day, int mon, - int year); -#endif - -/* event tracking variables, when the next events of each time should occur */ -u_int64_t nexttimerevent, nextstatevent; - -/* vars for stats */ -int statint; -u_int32_t statvar; -u_int32_t statmin; - -#if 0 -/* - * For now we let the machine run with boot time, not changing the clock - * at inittodr at all. - * - * We might continue to do this due to setting up the real wall clock with - * a user level utility in the future. - */ - -/* ARGSUSED */ -void -inittodr(time_t base) -{ - int sec, min, hour, day, mon, year; - - int badbase = 0, waszero = base == 0; - - if (base < 5 * SECYR) { - /* - * If base is 0, assume filesystem time is just unknown - * instead of preposterous. Don't bark. - */ - if (base != 0) - printf("WARNING: preposterous time in file system\n"); - /* not going to use it anyway, if the chip is readable */ - base = 21*SECYR + 186*SECDAY + SECDAY/2; - badbase = 1; - } - - if (clock_read != NULL ) { - (*clock_read)( &sec, &min, &hour, &day, &mon, &year); - time.tv_sec = chiptotime(sec, min, hour, day, mon, year); - } else if (time_read != NULL) { - u_int32_t cursec; - (*time_read)(&cursec); - time.tv_sec = cursec; - } else { - /* force failure */ - time.tv_sec = 0; - } - - if (time.tv_sec == 0) { - printf("WARNING: unable to get date/time"); - /* - * Believe the time in the file system for lack of - * anything better, resetting the clock. - */ - time.tv_sec = base; - if (!badbase) - resettodr(); - } else { - int deltat; - - time.tv_sec += tz.tz_minuteswest * 60; - if (tz.tz_dsttime) - time.tv_sec -= 3600; - - deltat = time.tv_sec - base; - - if (deltat < 0) - deltat = -deltat; - if (waszero || deltat < 2 * SECDAY) - return; - printf("WARNING: clock %s %d days", - time.tv_sec < base ? "lost" : "gained", deltat / SECDAY); - - if (time.tv_sec < base && deltat > 1000 * SECDAY) { - printf(", using FS time"); - time.tv_sec = base; - } - } - printf(" -- CHECK AND RESET THE DATE!\n"); -} - -/* - * This code is defunct after 2068. - * Will Unix still be here then?? - */ -const short dayyr[12] = - { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; - -static u_int32_t -chiptotime(int sec, int min, int hour, int day, int mon, int year) -{ - int days, yr; - - sec = FROMBCD(sec); - min = FROMBCD(min); - hour = FROMBCD(hour); - day = FROMBCD(day); - mon = FROMBCD(mon); - year = FROMBCD(year) + YEAR0; - - /* simple sanity checks */ - if (year < 1970 || mon < 1 || mon > 12 || day < 1 || day > 31) - return (0); - days = 0; - for (yr = 1970; yr < year; yr++) - days += LEAPYEAR(yr) ? 366 : 365; - days += dayyr[mon - 1] + day - 1; - if (LEAPYEAR(yr) && mon > 2) - days++; - /* now have days since Jan 1, 1970; the rest is easy... */ - return (days * SECDAY + hour * 3600 + min * 60 + sec); -} - - -/* - * Similar to the above - */ -void -resettodr(void) -{ - struct timeval curtime = time; - if (time_write != NULL) { - curtime.tv_sec -= tz.tz_minuteswest * 60; - if (tz.tz_dsttime) { - curtime.tv_sec += 3600; - } - (*time_write)(curtime.tv_sec); - } -} -#endif - -volatile int tickspending, statspending; - -void -decr_intr(struct clockframe *frame) -{ - u_int64_t tb; - u_int64_t nextevent; - int nticks; - int nstats; - int s; - - /* - * Check whether we are initialized. - */ - if (!ticks_per_intr) - return; - - - /* - * Based on the actual time delay since the last decrementer reload, - * we arrange for earlier interrupt next time. - */ - - tb = ppc_mftb(); - for (nticks = 0; nexttimerevent <= tb; nticks++) - nexttimerevent += ticks_per_intr; - - for (nstats = 0; nextstatevent <= tb; nstats++) { - int r; - do { - r = random() & (statvar -1); - } while (r == 0); /* random == 0 not allowed */ - nextstatevent += statmin + r; - } - - /* only count timer ticks for CLK_IRQ */ - intrcnt[PPC_CLK_IRQ] += nticks; - intrcnt[PPC_STAT_IRQ] += nstats; - - if (nexttimerevent < nextstatevent) - nextevent = nexttimerevent; - else - nextevent = nextstatevent; - - /* - * Need to work about the near constant skew this introduces??? - * reloading tb here could cause a missed tick. - */ - ppc_mtdec(nextevent - tb); - - if (cpl & SPL_CLOCK) { - tickspending += nticks; - statspending += nstats; - } else { - do { - nticks += tickspending; - nstats += statspending; - tickspending = 0; - statspending = 0; - - s = splclock(); - - /* - * Reenable interrupts - */ - ppc_intr_enable(1); - - /* - * Do standard timer interrupt stuff. - * Do softclock stuff only on the last iteration. - */ - frame->pri = s | SINT_CLOCK; - if (nticks > 1) - while (--nticks > 1) { - /* sync lasttb with hardclock */ - lasttb += ticks_per_intr; - hardclock(frame); - } - - frame->pri = s; - if (nticks) { - /* sync lasttb with hardclock */ - lasttb += ticks_per_intr; - hardclock(frame); - } - - while (nstats-- > 0) - statclock(frame); - - splx(s); - (void) ppc_intr_disable(); - - /* if a tick has occurred while dealing with these, - * service it now, do not delay until the next tick. - */ - nstats = 0; - nticks = 0; - } while (tickspending != 0 || statspending != 0); - } -} - -void -cpu_initclocks() -{ - int intrstate; - int r; - int minint; - u_int64_t nextevent; - - intrstate = ppc_intr_disable(); - - stathz = 100; - profhz = 1000; /* must be a multiple of stathz */ - - /* init secondary clock to stathz */ - statint = ticks_per_sec / stathz; - statvar = 0x40000000; /* really big power of two */ - /* find largest 2^n which is nearly smaller than statint/2 */ - minint = statint / 2 + 100; - while (statvar > minint) - statvar >>= 1; - - statmin = statint - (statvar >> 1); - - - lasttb = ppc_mftb(); - nexttimerevent = lasttb + ticks_per_intr; - do { - r = random() & (statvar -1); - } while (r == 0); /* random == 0 not allowed */ - nextstatevent = lasttb + statmin + r; - - if (nexttimerevent < nextstatevent) - nextevent = nexttimerevent; - else - nextevent = nextstatevent; - - ppc_mtdec(nextevent-lasttb); - ppc_intr_enable(intrstate); -} - -void -calc_delayconst(void) -{ - int qhandle, phandle; - char name[32]; - int s; - - /* - * Get this info during autoconf? XXX - */ - for (qhandle = OF_peer(0); qhandle; qhandle = phandle) { - if (OF_getprop(qhandle, "device_type", name, sizeof name) >= 0 - && !strcmp(name, "cpu") - && OF_getprop(qhandle, "timebase-frequency", - &ticks_per_sec, sizeof ticks_per_sec) >= 0) { - /* - * Should check for correct CPU here? XXX - */ - s = ppc_intr_disable(); - ns_per_tick = 1000000000 / ticks_per_sec; - ticks_per_intr = ticks_per_sec / hz; - ppc_intr_enable(s); - break; - } - if ((phandle = OF_child(qhandle))) - continue; - while (qhandle) { - if ((phandle = OF_peer(qhandle))) - break; - qhandle = OF_parent(qhandle); - } - } - - if (!phandle) - panic("no cpu node"); -} - -/* - * Fill in *tvp with current time with microsecond resolution. - */ -void -microtime(struct timeval *tvp) -{ - u_int64_t tb; - u_int32_t ticks; - int s; - - s = ppc_intr_disable(); - tb = ppc_mftb(); - ticks = (tb - lasttb) * ns_per_tick; - *tvp = time; - ppc_intr_enable(s); - ticks /= 1000; - tvp->tv_usec += ticks; - while (tvp->tv_usec >= 1000000) { - tvp->tv_usec -= 1000000; - tvp->tv_sec++; - } -} - -/* - * Wait for about n microseconds (us) (at least!). - */ -void -delay(unsigned n) -{ - u_int64_t tb; - u_int32_t tbh, tbl, scratch; - - tb = ppc_mftb(); - tb += (n * 1000 + ns_per_tick - 1) / ns_per_tick; - tbh = tb >> 32; - tbl = (u_int32_t)tb; - asm ("1: mftbu %0; cmplw %0,%1; blt 1b; bgt 2f;" - " mftb %0; cmplw %0,%2; blt 1b; 2:" - :: "r"(scratch), "r"(tbh), "r"(tbl)); -} - -/* - * Nothing to do. - */ -void -setstatclockrate(int newhz) -{ - int minint; - int intrstate; - - intrstate = ppc_intr_disable(); - - statint = ticks_per_sec / newhz; - statvar = 0x40000000; /* really big power of two */ - /* find largest 2^n which is nearly smaller than statint/2 */ - minint = statint / 2 + 100; - while (statvar > minint) - statvar >>= 1; - - statmin = statint - (statvar >> 1); - ppc_intr_enable(intrstate); - - /* - * XXX this allows the next stat timer to occur then it switches - * to the new frequency. Rather than switching instantly. - */ -} diff --git a/sys/arch/pegasos/pegasos/conf.c b/sys/arch/pegasos/pegasos/conf.c deleted file mode 100644 index 4ba95eb33f1..00000000000 --- a/sys/arch/pegasos/pegasos/conf.c +++ /dev/null @@ -1,352 +0,0 @@ -/* $OpenBSD: conf.c,v 1.2 2004/02/10 01:31:21 millert Exp $ */ - -/* - * Copyright (c) 1997 Per Fogelstrom - * Copyright (c) 1997 RTMX Inc, North Carolina - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce 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 under OpenBSD for RTMX Inc, - * North Carolina, USA, by Per Fogelstrom, Opsycon AB, Sweden. - * 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/buf.h> -#include <sys/ioctl.h> -#include <sys/systm.h> -#include <sys/tty.h> -#include <sys/vnode.h> - -#include <machine/conf.h> - -#include "sd.h" -#include "st.h" -#include "cd.h" -#include "ss.h" -#include "uk.h" -#include "rd.h" -#include "wd.h" -bdev_decl(wd); -cdev_decl(wd); - -#include "ofdisk.h" -bdev_decl(ofd); - -#include "vnd.h" -#include "ccd.h" -#include "raid.h" - -struct bdevsw bdevsw[] = { - bdev_disk_init(NWD,wd), /* 0: ST506/ESDI/IDE disk */ - bdev_swap_init(1,sw), /* 1 swap pseudo device */ - bdev_disk_init(NSD,sd), /* 2 SCSI Disk */ - bdev_disk_init(NCD,cd), /* 3 SCSI CD-ROM */ - bdev_disk_init(NOFDISK,ofd), /* 4 Openfirmware disk */ - bdev_notdef(), /* 5 unknown*/ - bdev_notdef(), /* 6 unknown*/ - bdev_notdef(), /* 7 unknown*/ - bdev_lkm_dummy(), /* 8 */ - bdev_lkm_dummy(), /* 9 */ - bdev_lkm_dummy(), /* 10 */ - bdev_lkm_dummy(), /* 11 */ - bdev_lkm_dummy(), /* 12 */ - bdev_lkm_dummy(), /* 13 */ - bdev_disk_init(NVND,vnd), /* 14 vnode disk driver*/ - bdev_notdef(), /* 15 unknown*/ - bdev_disk_init(NCCD,ccd), /* 16 concatenated disk driver*/ - bdev_disk_init(NRD,rd), /* 17 ram disk driver*/ - bdev_notdef(), /* 18 unknown*/ - bdev_disk_init(NRAID,raid), /* 19: RAIDframe disk driver */ -}; -int nblkdev = sizeof bdevsw / sizeof bdevsw[0]; - -#include "pty.h" - -#include "ofcons.h" -cdev_decl(ofc); -cdev_decl(ofd); - -#include "ofrtc.h" -cdev_decl(ofrtc); - -cdev_decl(kbd); -cdev_decl(ms); - -#include "com.h" -cdev_decl(com); - -#include "wsdisplay.h" -#include "wskbd.h" -#include "wsmouse.h" - -#include "iop.h" - -#include "bpfilter.h" - -#include "tun.h" - -#ifdef XFS -#include <xfs/nxfs.h> -cdev_decl(xfs_dev); -#endif - -#ifdef LKM -#define NLKM 1 -#else -#define NLKM 0 -#endif - -#include "ksyms.h" -#include "usb.h" -#include "uhid.h" -#include "ugen.h" -#include "ulpt.h" -#include "urio.h" -#include "ucom.h" -#include "uscanner.h" - -#include "inet.h" - -#include "wsmux.h" - -#ifdef USER_PCICONF -#include "pci.h" -cdev_decl(pci); -#endif - -#include "audio.h" - -#include "pf.h" - -#include "systrace.h" - -#include "radio.h" -#include "bktr.h" - -struct cdevsw cdevsw[] = { - cdev_cn_init(1,cn), /* 0: virtual console */ - cdev_ctty_init(1,ctty), /* 1: controlling terminal */ - cdev_mm_init(1,mm), /* 2: /dev/{null,mem,kmem,...} */ - cdev_swap_init(1,sw), /* 3: /dev/drum (swap pseudo-device) */ - cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */ - cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */ - cdev_log_init(1,log), /* 6: /dev/klog */ - cdev_tty_init(NCOM,com), /* 7: Serial ports */ - cdev_disk_init(NSD,sd), /* 8: SCSI disk */ - cdev_disk_init(NCD,cd), /* 9: SCSI CD-ROM */ - cdev_notdef(), /* 10: SCSI changer */ - cdev_disk_init(NWD,wd), /* 11: ST506/ESDI/IDE disk */ - cdev_notdef(), /* 12 */ - cdev_disk_init(NOFDISK,ofd), /* 13 Openfirmware disk */ - cdev_tty_init(NOFCONS,ofc), /* 14 Openfirmware console */ - cdev_notdef(), /* 15 */ - cdev_notdef(), /* 16 */ - cdev_disk_init(NRD,rd), /* 17 ram disk driver*/ - cdev_disk_init(NCCD,ccd), /* 18 concatenated disk driver */ - cdev_disk_init(NVND,vnd), /* 19: vnode disk */ - cdev_tape_init(NST,st), /* 20: SCSI tape */ - cdev_fd_init(1,filedesc), /* 21: file descriptor pseudo-dev */ - cdev_bpftun_init(NBPFILTER,bpf),/* 22: berkeley packet filter */ - cdev_bpftun_init(NTUN,tun), /* 23: network tunnel */ - cdev_lkm_init(NLKM,lkm), /* 24: loadable module driver */ - cdev_notdef(), /* 25: APM interface */ - cdev_notdef(), /* 26 */ - cdev_notdef(), /* 27 */ - cdev_notdef(), /* 28 */ - cdev_notdef(), /* 29 */ - cdev_notdef(), /* 30 */ - cdev_notdef(), /* 31 */ - cdev_notdef(), /* 32 */ - cdev_lkm_dummy(), /* 33 */ - cdev_lkm_dummy(), /* 34 */ - cdev_lkm_dummy(), /* 35 */ - cdev_lkm_dummy(), /* 36 */ - cdev_lkm_dummy(), /* 37 */ - cdev_lkm_dummy(), /* 38 */ - cdev_pf_init(NPF,pf), /* 39: packet filter */ - cdev_random_init(1,random), /* 40: random data source */ - cdev_uk_init(NUK,uk), /* 41: unknown SCSI */ - cdev_ss_init(NSS,ss), /* 42: SCSI scanner */ - cdev_ksyms_init(NKSYMS,ksyms), /* 43: Kernel symbols device */ - cdev_audio_init(NAUDIO,audio), /* 44: generic audio I/O */ - cdev_notdef(), /* 45 */ - cdev_notdef(), /* 46 */ - cdev_crypto_init(NCRYPTO,crypto), /* 47: /dev/crypto */ - cdev_notdef(), /* 48 */ - cdev_notdef(), /* 49 */ - cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */ -#ifdef XFS - cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */ -#else - cdev_notdef(), /* 51 */ -#endif - cdev_notdef(), /* 52 */ - cdev_notdef(), /* 53 */ - cdev_disk_init(NRAID,raid), /* 54: RAIDframe disk driver */ - cdev_notdef(), /* 55 */ - /* The following slots are reserved for isdn4bsd. */ - cdev_notdef(), /* 56: i4b main device */ - cdev_notdef(), /* 57: i4b control device */ - cdev_notdef(), /* 58: i4b raw b-channel access */ - cdev_notdef(), /* 59: i4b trace device */ - cdev_notdef(), /* 60: i4b phone device */ - /* End of reserved slots for isdn4bsd. */ - cdev_usb_init(NUSB,usb), /* 61: USB controller */ - cdev_usbdev_init(NUHID,uhid), /* 62: USB generic HID */ - cdev_usbdev_init(NUGEN,ugen), /* 63: USB generic driver */ - cdev_ulpt_init(NULPT,ulpt), /* 64: USB printers */ - cdev_urio_init(NURIO,urio), /* 65: USB Diamond Rio 500 */ - cdev_tty_init(NUCOM,ucom), /* 66: USB tty */ - cdev_wsdisplay_init(NWSDISPLAY, /* 67: frame buffers, etc. */ - wsdisplay), - cdev_mouse_init(NWSKBD, wskbd), /* 68: keyboards */ - cdev_mouse_init(NWSMOUSE, /* 69: mice */ - wsmouse), - cdev_mouse_init(NWSMUX, wsmux), /* 70: ws multiplexor */ -#ifdef USER_PCICONF - cdev_pci_init(NPCI,pci), /* 71: PCI user */ -#else - cdev_notdef(), -#endif - cdev_notdef(), /* 72: ALTQ (deprecated) */ - cdev_iop_init(NIOP,iop), /* 73: I2O IOP control interface */ - cdev_usbdev_init(NUSCANNER,uscanner), /* 74: usb scanner */ - cdev_bktr_init(NBKTR,bktr), /* 75: Bt848 video capture device */ - cdev_radio_init(NRADIO, radio), /* 76: generic radio I/O */ - cdev_ptm_init(NPTY,ptm), /* 77: pseudo-tty ptm device */ -}; -int nchrdev = sizeof cdevsw / sizeof cdevsw[0]; - -int mem_no = 2; /* major number of /dev/mem */ - -/* - * Swapdev is a fake device implemented in sw.c. - * It is used only internally to get to swstrategy. - */ -dev_t swapdev = makedev(1, 0); - -/* - * Check whether dev is /dev/mem or /dev/kmem. - */ -int -iskmemdev(dev_t dev) -{ - return major(dev) == mem_no && minor(dev) < 2; -} - -/* - * Check whether dev is /dev/zero. - */ -int -iszerodev(dev_t dev) -{ - return major(dev) == mem_no && minor(dev) == 12; -} - -dev_t -getnulldev() -{ - return makedev(mem_no, 2); -} - -int chrtoblktbl[] = { - /*VCHR*/ /*VBLK*/ - /* 0 */ NODEV, - /* 1 */ NODEV, - /* 2 */ NODEV, - /* 3 */ NODEV, - /* 4 */ NODEV, - /* 5 */ NODEV, - /* 6 */ NODEV, - /* 7 */ NODEV, - /* 8 */ 2, - /* 9 */ NODEV, - /* 10 */ NODEV, - /* 11 */ 0, - /* 12 */ NODEV, - /* 13 */ 4, - /* 14 */ NODEV, - /* 15 */ NODEV, - /* 16 */ NODEV, - /* 17 */ 17, - /* 18 */ NODEV, - /* 19 */ NODEV, - /* 20 */ NODEV, - /* 21 */ NODEV, - /* 22 */ NODEV, - /* 23 */ NODEV, - /* 24 */ NODEV, - /* 25 */ NODEV, - /* 26 */ NODEV, - /* 27 */ NODEV, - /* 28 */ NODEV, - /* 29 */ NODEV, - /* 30 */ NODEV, - /* 31 */ NODEV, - /* 32 */ NODEV, - /* 33 */ NODEV, - /* 34 */ NODEV, - /* 35 */ NODEV, - /* 36 */ NODEV, - /* 37 */ NODEV, - /* 38 */ NODEV, - /* 39 */ NODEV, - /* 40 */ NODEV, - /* 41 */ NODEV, - /* 42 */ NODEV, - /* 43 */ NODEV, - /* 44 */ NODEV, - /* 45 */ NODEV, - /* 46 */ NODEV, - /* 47 */ NODEV, - /* 48 */ NODEV, - /* 49 */ NODEV, - /* 50 */ NODEV, - /* 51 */ NODEV, - /* 52 */ NODEV, - /* 53 */ NODEV, - /* 54 */ 19, -}; -int nchrtoblktbl = sizeof(chrtoblktbl) / sizeof(chrtoblktbl[0]); - -#include <dev/cons.h> -#include "vgafb_pci.h" - -cons_decl(ws); -cons_decl(com); -cons_decl(ofc); - -struct consdev constab[] = { -#if NWSDISPLAY > 0 - cons_init(ws), -#endif -#if NCOM > 0 - cons_init(com), -#endif -#if NOFCONS > 0 - cons_init(ofc), -#endif - { 0 }, -}; diff --git a/sys/arch/pegasos/pegasos/cpu.c b/sys/arch/pegasos/pegasos/cpu.c deleted file mode 100644 index 9c2b4bb62e2..00000000000 --- a/sys/arch/pegasos/pegasos/cpu.c +++ /dev/null @@ -1,383 +0,0 @@ -/* $OpenBSD: cpu.c,v 1.4 2004/02/14 15:09:22 grange Exp $ */ - -/* - * Copyright (c) 1997 Per Fogelstrom - * Copyright (c) 1997 RTMX Inc - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD for RTMX Inc - * North Carolina, USA, by Per Fogelstrom, Opsycon AB, Sweden. - * 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/proc.h> -#include <sys/user.h> -#include <sys/device.h> - -#include <dev/ofw/openfirm.h> - -#include <machine/autoconf.h> - -#define MPC601 1 -#define MPC603 3 -#define MPC604 4 -#define MPC603e 6 -#define MPC603ev 7 -#define MPC750 8 -#define MPC604ev 9 -#define MPC7400 12 -#define IBM750FX 0x7000 -#define MPC7410 0x800c -#define MPC7450 0x8000 -#define MPC7455 0x8001 -#define MPC7454 0x8002 - -/* only valid on 603(e,ev) and G3, G4 */ -#define HID0_DOZE (1 << (31-8)) -#define HID0_NAP (1 << (31-9)) -#define HID0_SLEEP (1 << (31-10)) -#define HID0_DPM (1 << (31-11)) -#define HID0_SGE (1 << (31-24)) -#define HID0_BTIC (1 << (31-26)) -#define HID0_LRSTK (1 << (31-27)) -#define HID0_FOLD (1 << (31-28)) -#define HID0_BHT (1 << (31-29)) - -/* L2CR bit definitions */ -#define L2CR_L2E 0x80000000 /* 0: L2 enable */ -#define L2CR_L2PE 0x40000000 /* 1: L2 data parity enable */ -#define L2CR_L2SIZ 0x30000000 /* 2-3: L2 size */ -#define L2SIZ_RESERVED 0x00000000 -#define L2SIZ_256K 0x10000000 -#define L2SIZ_512K 0x20000000 -#define L2SIZ_1M 0x30000000 -#define L2CR_L2CLK 0x0e000000 /* 4-6: L2 clock ratio */ -#define L2CLK_DIS 0x00000000 /* disable L2 clock */ -#define L2CLK_10 0x02000000 /* core clock / 1 */ -#define L2CLK_15 0x04000000 /* / 1.5 */ -#define L2CLK_20 0x08000000 /* / 2 */ -#define L2CLK_25 0x0a000000 /* / 2.5 */ -#define L2CLK_30 0x0c000000 /* / 3 */ -#define L2CR_L2RAM 0x01800000 /* 7-8: L2 RAM type */ -#define L2RAM_FLOWTHRU_BURST 0x00000000 -#define L2RAM_PIPELINE_BURST 0x01000000 -#define L2RAM_PIPELINE_LATE 0x01800000 -#define L2CR_L2DO 0x00400000 /* 9: L2 data-only. - Setting this bit disables instruction - caching. */ -#define L2CR_L2I 0x00200000 /* 10: L2 global invalidate. */ -#define L2CR_L2CTL 0x00100000 /* 11: L2 RAM control (ZZ enable). - Enables automatic operation of the - L2ZZ (low-power mode) signal. */ -#define L2CR_L2WT 0x00080000 /* 12: L2 write-through. */ -#define L2CR_L2TS 0x00040000 /* 13: L2 test support. */ -#define L2CR_L2OH 0x00030000 /* 14-15: L2 output hold. */ -#define L2CR_L2SL 0x00008000 /* 16: L2 DLL slow. */ -#define L2CR_L2DF 0x00004000 /* 17: L2 differential clock. */ -#define L2CR_L2BYP 0x00002000 /* 18: L2 DLL bypass. */ -#define L2CR_L2IP 0x00000001 /* 31: L2 global invalidate in progress - (read only). */ - -/* L3CR bit definitions */ -#define L3CR_L3E 0x80000000 /* 0: L3 enable */ -#define L3CR_L3SIZ 0x10000000 /* 3: L3 size (0=1MB, 1=2MB) */ - -#ifdef L2CR_CONFIG -u_int l2cr_config = L2CR_CONFIG; -#else -u_int l2cr_config = 0; -#endif - -char cpu_model[80]; -char machine[] = MACHINE; /* cpu architecture */ - -/* Definition of the driver for autoconfig. */ -int cpumatch(struct device *, void *, void *); -void cpuattach(struct device *, struct device *, void *); - -struct cfattach cpu_ca = { - sizeof(struct device), cpumatch, cpuattach -}; - -struct cfdriver cpu_cd = { - NULL, "cpu", DV_DULL, NULL, 0 -}; - -void config_l2cr(int cpu); - -int -cpumatch(parent, cfdata, aux) - struct device *parent; - void *cfdata; - void *aux; -{ - struct confargs *ca = aux; - - /* make sure that we're looking for a CPU. */ - if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) - return (0); - - return (1); -} - -static u_int32_t ppc_curfreq; - - -int -ppc_cpuspeed(int *freq) -{ - *freq = ppc_curfreq; - - return (0); -} - - -void -cpuattach(struct device *parent, struct device *dev, void *aux) -{ - unsigned int cpu, pvr, hid0; - char name[32]; - int qhandle, phandle; - unsigned int clock_freq = 0; - - pvr = ppc_mfpvr(); - cpu = pvr >> 16; - switch (cpu) { - case MPC601: - snprintf(cpu_model, sizeof(cpu_model), "601"); - break; - case MPC603: - snprintf(cpu_model, sizeof(cpu_model), "603"); - break; - case MPC604: - snprintf(cpu_model, sizeof(cpu_model), "604"); - break; - case MPC603e: - snprintf(cpu_model, sizeof(cpu_model), "603e"); - break; - case MPC603ev: - snprintf(cpu_model, sizeof(cpu_model), "603ev"); - break; - case MPC750: - snprintf(cpu_model, sizeof(cpu_model), "750"); - break; - case MPC604ev: - snprintf(cpu_model, sizeof(cpu_model), "604ev"); - break; - case MPC7400: - snprintf(cpu_model, sizeof(cpu_model), "7400"); - break; - case IBM750FX: - snprintf(cpu_model, sizeof(cpu_model), "750FX"); - break; - case MPC7410: - snprintf(cpu_model, sizeof(cpu_model), "7410"); - break; - case MPC7450: - if ((pvr & 0xf) < 3) - snprintf(cpu_model, sizeof(cpu_model), "7450"); - else - snprintf(cpu_model, sizeof(cpu_model), "7451"); - break; - case MPC7454: - snprintf(cpu_model, sizeof(cpu_model), "7454"); - break; - case MPC7455: - snprintf(cpu_model, sizeof(cpu_model), "7455"); - break; - default: - snprintf(cpu_model, sizeof(cpu_model), "Version %x", cpu); - break; - } - snprintf(cpu_model + strlen(cpu_model), - sizeof(cpu_model) - strlen(cpu_model), - " (Revision %x)", pvr & 0xffff); - printf(": %s", cpu_model); - - /* This should only be executed on openfirmware systems... */ - - for (qhandle = OF_peer(0); qhandle; qhandle = phandle) { - if (OF_getprop(qhandle, "device_type", name, sizeof name) >= 0 - && !strcmp(name, "cpu") - && OF_getprop(qhandle, "clock-frequency", - &clock_freq , sizeof clock_freq ) >= 0) - { - break; - } - if ((phandle = OF_child(qhandle))) - continue; - while (qhandle) { - if ((phandle = OF_peer(qhandle))) - break; - qhandle = OF_parent(qhandle); - } - } - - if (clock_freq != 0) { - /* Openfirmware stores clock in Hz, not MHz */ - clock_freq /= 1000000; - printf(": %d MHz", clock_freq); - ppc_curfreq = clock_freq; - cpu_cpuspeed = ppc_cpuspeed; - } - /* power savings mode */ - hid0 = ppc_mfhid0(); - switch (cpu) { - case MPC603: - case MPC603e: - case MPC750: - case MPC7400: - case IBM750FX: - case MPC7410: - /* select DOZE mode */ - hid0 &= ~(HID0_NAP | HID0_SLEEP); - hid0 |= HID0_DOZE | HID0_DPM; - break; - case MPC7450: - case MPC7454: - case MPC7455: - /* select NAP mode */ - hid0 &= ~(HID0_DOZE | HID0_SLEEP); - hid0 |= HID0_NAP | HID0_DPM; - /* try some other flags */ - hid0 |= HID0_SGE | HID0_BTIC; - hid0 |= HID0_LRSTK | HID0_FOLD | HID0_BHT; - /* Disable BTIC on 7450 Rev 2.0 or earlier */ - if (cpu == MPC7450 && (pvr & 0xffff) < 0x0200) - hid0 &= ~HID0_BTIC; - break; - } - ppc_mthid0(hid0); - - /* if processor is G3 or G4, configure l2 cache */ - if ( (cpu == MPC750) || (cpu == MPC7400) || (cpu == IBM750FX) - || (cpu == MPC7410) || (cpu == MPC7450) || (cpu == MPC7454) - || (cpu == MPC7455)) { - /* Pegasos doesn't configure L2 in OF, - * should enable it's size based on OF values, not - * this G3/G4 switch - */ - switch (cpu) { - case MPC750: - l2cr_config = L2CR_L2E|L2SIZ_512K; - break; - case MPC7454: - l2cr_config = L2CR_L2E|L2SIZ_256K; - break; - default: - ; - } - config_l2cr(cpu); - } - printf("\n"); - - -} - - -void -config_l2cr(int cpu) -{ - u_int l2cr, x; - - l2cr = ppc_mfl2cr(); - - /* - * Configure L2 cache if not enabled. - */ - if ((l2cr & L2CR_L2E) == 0 && l2cr_config != 0) { - l2cr = l2cr_config & ~L2CR_L2E; - __asm __volatile ("sync"); - ppc_mtl2cr(l2cr); - __asm __volatile ("sync"); - - /* Wait for L2 clock to be stable (640 L2 clocks). */ - delay(100); - - /* Invalidate all L2 contents. */ - l2cr |= L2CR_L2I; - ppc_mtl2cr(l2cr); - do { - x = ppc_mfl2cr(); - } while (x & L2CR_L2IP); - - /* Enable L2 cache. */ - l2cr &= ~L2CR_L2I; - l2cr |= L2CR_L2E; - ppc_mtl2cr(l2cr); - } - - if (l2cr & L2CR_L2E) { - if (cpu == MPC7450 || cpu == MPC7454 || cpu == MPC7455) { - u_int l3cr; - - printf(": 256KB L2 cache"); - - l3cr = ppc_mfl3cr(); - if (l3cr & L3CR_L3E) - printf(", %cMB L3 cache", - l3cr & L3CR_L3SIZ ? '2' : '1'); - } else if (cpu == IBM750FX) - printf(": 512KB L2 cache"); - else { - switch (l2cr & L2CR_L2SIZ) { - case L2SIZ_256K: - printf(": 256KB"); - break; - case L2SIZ_512K: - printf(": 512KB"); - break; - case L2SIZ_1M: - printf(": 1MB"); - break; - default: - printf(": unknown size"); - } - printf(" backside cache"); - } -#if 0 - switch (l2cr & L2CR_L2RAM) { - case L2RAM_FLOWTHRU_BURST: - printf(" Flow-through synchronous burst SRAM"); - break; - case L2RAM_PIPELINE_BURST: - printf(" Pipelined synchronous burst SRAM"); - break; - case L2RAM_PIPELINE_LATE: - printf(" Pipelined synchronous late-write SRAM"); - break; - default: - printf(" unknown type"); - } - - if (l2cr & L2CR_L2PE) - printf(" with parity"); -#endif - } else - printf(": L2 cache not enabled"); -} diff --git a/sys/arch/pegasos/pegasos/db_interface.c b/sys/arch/pegasos/pegasos/db_interface.c deleted file mode 100644 index bf3aabe5213..00000000000 --- a/sys/arch/pegasos/pegasos/db_interface.c +++ /dev/null @@ -1,44 +0,0 @@ -/* $OpenBSD: db_interface.c,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* $NetBSD: db_interface.c,v 1.12 2001/07/22 11:29:46 wiz Exp $ */ - -#include <sys/param.h> -#include <sys/proc.h> -#include <sys/systm.h> - -#include <dev/cons.h> - -#include <machine/db_machdep.h> -#include <ddb/db_extern.h> - -int ddb_trap_glue(struct trapframe *frame); /* called from locore */ - -void -Debugger() -{ - ddb_trap(); -} - -int -ddb_trap_glue(struct trapframe *frame) -{ - if (!(frame->srr1 & PSL_PR) - && (frame->exc == EXC_TRC - || (frame->exc == EXC_PGM && (frame->srr1 & 0x20000)) - || frame->exc == EXC_BPT)) { - - bcopy(frame->fixreg, DDB_REGS->tf.fixreg, - 32 * sizeof(u_int32_t)); - DDB_REGS->tf.srr0 = frame->srr0; - DDB_REGS->tf.srr1 = frame->srr1; - - cnpollc(TRUE); - db_trap(T_BREAKPOINT, 0); - cnpollc(FALSE); - - bcopy(DDB_REGS->tf.fixreg, frame->fixreg, - 32 * sizeof(u_int32_t)); - - return 1; - } - return 0; -} diff --git a/sys/arch/pegasos/pegasos/disksubr.c b/sys/arch/pegasos/pegasos/disksubr.c deleted file mode 100644 index 4802d37c1ef..00000000000 --- a/sys/arch/pegasos/pegasos/disksubr.c +++ /dev/null @@ -1,450 +0,0 @@ -/* $OpenBSD: disksubr.c,v 1.3 2004/03/17 14:16:04 miod Exp $ */ -/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ - -/* - * Copyright (c) 1996 Theo de Raadt - * Copyright (c) 1982, 1986, 1988 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/buf.h> -#include <sys/device.h> -#include <sys/disklabel.h> -#include <sys/syslog.h> -#include <sys/disk.h> - -#define b_cylin b_resid - -void -dk_establish(struct disk *dk, struct device *dev) -{ -} - -int -try_rdb_label(dev_t dev, void (*strat)(struct buf *), struct buf *bp, - struct disklabel *lp, struct cpu_disklabel *osdep, char **pmsg, - int *bsdpartoff); -int -try_hfs_label(dev_t dev, void (*strat)(struct buf *), struct buf *bp, - struct disklabel *lp, struct cpu_disklabel *osdep, char **pmsg, - int *bsdpartoff); -int -try_mbr_label(dev_t dev, void (*strat)(struct buf *), struct buf *bp, - struct disklabel *lp, struct cpu_disklabel *osdep, char **pmsg, - int *bsdpartoff); - - -/* - * Attempt to read a disk label from a device - * using the indicated strategy routine. - * The label must be partly set up before this: - * secpercyl, secsize and anything required for a block i/o read - * operation in the driver's strategy/start routines - * must be filled in before calling us. - * - * Returns null on success and an error string on failure. - */ -char * -readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) -{ - struct dkbad *bdp = &DKBAD(osdep); - struct buf *bp; - struct disklabel *dlp; - char *msg = NULL; - int partoff, i, found; - - /* minimal requirements for archtypal disk label */ - if (lp->d_secsize < DEV_BSIZE) - lp->d_secsize = DEV_BSIZE; - if (lp->d_secperunit == 0) - lp->d_secperunit = 0x1fffffff; - lp->d_npartitions = RAW_PART + 1; - for (i = 0; i < RAW_PART; i++) { - lp->d_partitions[i].p_size = 0; - lp->d_partitions[i].p_offset = 0; - } - if (lp->d_partitions[i].p_size == 0) - lp->d_partitions[i].p_size = 0x1fffffff; - lp->d_partitions[i].p_offset = 0; - - /* get a buffer and initialize it */ - bp = geteblk((int)lp->d_secsize); - bp->b_dev = dev; - - partoff = -1; - - /* try hfs */ - found = try_hfs_label(dev, strat, bp, lp, osdep, &msg, &partoff); - /* if no hfs or mbr, try rdb */ - if (found == 0) - found = try_rdb_label(dev, strat, bp, lp, osdep, &msg, - &partoff); - /* if no hfs, try mbr */ - if (found == 0) - found = try_mbr_label(dev, strat, bp, lp, osdep, &msg, - &partoff); - /* if no partition found, return */ - if (found == 0 || partoff == -1) { - /* no special partition table found try raw labeled disk. */ - partoff = LABELSECTOR; - } - - /* don't read the on-disk label if we are in spoofed-only mode */ - if (spoofonly) - goto done; - - /* next, dig out disk label */ - bp->b_blkno = partoff; - bp->b_cylin = partoff/lp->d_secpercyl; /* XXX */ - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ; - (*strat)(bp); - - /* if successful, locate disk label within block and validate */ - if (biowait(bp)) { - /* XXX we return the faked label built so far */ - msg = "disk label I/O error"; - goto done; - } - - for (dlp = (struct disklabel *)bp->b_data; - dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - - sizeof(*dlp)); - dlp = (struct disklabel *)((char *)dlp + sizeof(long))) { - if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) { - if (msg == NULL) - msg = "no disk label"; - } else if (dlp->d_npartitions > MAXPARTITIONS || - dkcksum(dlp) != 0) - msg = "disk label corrupted"; - else { - *lp = *dlp; - msg = NULL; - break; - } - } - - if (msg) { -#if defined(CD9660) - if (iso_disklabelspoof(dev, strat, lp) == 0) - msg = NULL; -#endif - goto done; - } - - /* obtain bad sector table if requested and present */ - if (bdp && (lp->d_flags & D_BADSECT)) { - struct dkbad *db; - - i = 0; - do { - /* read a bad sector table */ - bp->b_flags = B_BUSY | B_READ; - bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i; - if (lp->d_secsize > DEV_BSIZE) - bp->b_blkno *= lp->d_secsize / DEV_BSIZE; - else - bp->b_blkno /= DEV_BSIZE / lp->d_secsize; - bp->b_bcount = lp->d_secsize; - bp->b_cylin = lp->d_ncylinders - 1; - (*strat)(bp); - - /* if successful, validate, otherwise try another */ - if (biowait(bp)) { - msg = "bad sector table I/O error"; - } else { - db = (struct dkbad *)(bp->b_data); -#define DKBAD_MAGIC 0x4321 - if (db->bt_mbz == 0 - && db->bt_flag == DKBAD_MAGIC) { - msg = NULL; - *bdp = *db; - break; - } else - msg = "bad sector table corrupted"; - } - } while ((bp->b_flags & B_ERROR) && (i += 2) < 10 && - i < lp->d_nsectors); - } - -done: - bp->b_flags |= B_INVAL; - brelse(bp); - return (msg); -} - -/* - * Check new disk label for sensibility - * before setting it. - */ -int -setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask, - struct cpu_disklabel *osdep) -{ - int i; - struct partition *opp, *npp; - - /* sanity clause */ - if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0 || - (nlp->d_secsize % DEV_BSIZE) != 0) - return(EINVAL); - - /* special case to allow disklabel to be invalidated */ - if (nlp->d_magic == 0xffffffff) { - *olp = *nlp; - return (0); - } - - if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC || - dkcksum(nlp) != 0) - return (EINVAL); - - /* XXX missing check if other dos partitions will be overwritten */ - - while (openmask != 0) { - i = ffs(openmask) - 1; - openmask &= ~(1 << i); - if (nlp->d_npartitions <= i) - return (EBUSY); - opp = &olp->d_partitions[i]; - npp = &nlp->d_partitions[i]; - if (npp->p_offset != opp->p_offset || npp->p_size < opp->p_size) - return (EBUSY); - /* - * Copy internally-set partition information - * if new label doesn't include it. XXX - */ - if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) { - npp->p_fstype = opp->p_fstype; - npp->p_fsize = opp->p_fsize; - npp->p_frag = opp->p_frag; - npp->p_cpg = opp->p_cpg; - } - } - nlp->d_checksum = 0; - nlp->d_checksum = dkcksum(nlp); - *olp = *nlp; - return (0); -} - - -/* - * Write disk label back to device after modification. - * XXX cannot handle OpenBSD partitions in extended partitions! - */ -int -writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, - struct cpu_disklabel *osdep) -{ - struct dos_partition *dp = osdep->dosparts, *dp2; - struct buf *bp; - struct disklabel *dlp; - int error, dospartoff, cyl, i; - int ourpart = -1; - - /* get a buffer and initialize it */ - bp = geteblk((int)lp->d_secsize); - bp->b_dev = dev; - - /* try DPME partition */ - if (osdep->macparts[0].pmSig == PART_ENTRY_MAGIC) { - /* only write if a valid "OpenBSD" partition type exists */ - if (osdep->macparts[1].pmSig == PART_ENTRY_MAGIC) { - bp->b_blkno = osdep->macparts[1].pmPyPartStart; - bp->b_cylin = bp->b_blkno/lp->d_secpercyl; - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_WRITE; - *(struct disklabel *)bp->b_data = *lp; - (*strat)(bp); - error = biowait(bp); - goto done; - } - - /* SHOULD FAIL TO WRITE LABEL IF VALID HFS partition exists - * and no OpenBSD partition exists - */ - error = 1; /* EPERM? */ - goto done; - } - - /* label RDB disk */ - if (osdep->rd_bsdlbl != 0) { - /* we have a location for the BSD label */ - /* Really need to add some validation code here */ - bp->b_blkno = osdep->rd_bsdlbl; - bp->b_cylin = bp->b_blkno/lp->d_secpercyl; - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_WRITE; - *(struct disklabel *)bp->b_data = *lp; - (*strat)(bp); - error = biowait(bp); - goto done; - } - - - /* do dos partitions in the process of getting disklabel? */ - dospartoff = 0; - cyl = LABELSECTOR / lp->d_secpercyl; - if (dp) { - /* read master boot record */ - bp->b_blkno = DOSBBSECTOR; - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ; - bp->b_cylin = DOSBBSECTOR / lp->d_secpercyl; - (*strat)(bp); - - if ((error = biowait(bp)) != 0) - goto done; - - /* XXX how do we check veracity/bounds of this? */ - bcopy(bp->b_data + DOSPARTOFF, dp, - NDOSPART * sizeof(*dp)); - - for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (get_le(&dp2->dp_size) && dp2->dp_typ == - DOSPTYP_OPENBSD) - ourpart = i; - for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (get_le(&dp2->dp_size) && dp2->dp_typ == - DOSPTYP_FREEBSD) - ourpart = i; - for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (get_le(&dp2->dp_size) && dp2->dp_typ == - DOSPTYP_NETBSD) - ourpart = i; - - if (ourpart != -1) { - dp2 = &dp[ourpart]; - - /* - * need sector address for SCSI/IDE, - * cylinder for ESDI/ST506/RLL - */ - dospartoff = get_le(&dp2->dp_start); - cyl = DPCYL(dp2->dp_scyl, dp2->dp_ssect); - } - } - - /* next, dig out disk label */ - bp->b_blkno = dospartoff + LABELSECTOR; - bp->b_cylin = cyl; - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ; - (*strat)(bp); - - /* if successful, locate disk label within block and validate */ - if ((error = biowait(bp)) != 0) - goto done; - for (dlp = (struct disklabel *)bp->b_data; - dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - - sizeof(*dlp)); - dlp = (struct disklabel *)((char *)dlp + sizeof(long))) { - if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC && - dkcksum(dlp) == 0) { - *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE; - (*strat)(bp); - error = biowait(bp); - goto done; - } - } - - /* Write it in the regular place. */ - *(struct disklabel *)bp->b_data = *lp; - bp->b_flags = B_BUSY | B_WRITE; - (*strat)(bp); - error = biowait(bp); - goto done; - -done: - bp->b_flags |= B_INVAL; - brelse(bp); - return (error); -} - -/* - * Determine the size of the transfer, and make sure it is - * within the boundaries of the partition. Adjust transfer - * if needed, and signal errors or early completion. - */ -int -bounds_check_with_label(struct buf *bp, struct disklabel *lp, - struct cpu_disklabel *osdep, int wlabel) -{ -#define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) - struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); - int labelsector = blockpersec(lp->d_partitions[RAW_PART].p_offset, lp) + - LABELSECTOR; - int sz = howmany(bp->b_bcount, DEV_BSIZE); - - /* avoid division by zero */ - if (lp->d_secpercyl == 0) { - bp->b_error = EINVAL; - goto bad; - } - - if (bp->b_blkno + sz > blockpersec(p->p_size, lp)) { - sz = blockpersec(p->p_size, lp) - bp->b_blkno; - if (sz == 0) { - /* If exactly at end of disk, return EOF. */ - bp->b_resid = bp->b_bcount; - goto done; - } - if (sz < 0) { - /* If past end of disk, return EINVAL. */ - bp->b_error = EINVAL; - goto bad; - } - /* Otherwise, truncate request. */ - bp->b_bcount = sz << DEV_BSHIFT; - } - - /* Overwriting disk label? */ - if (bp->b_blkno + blockpersec(p->p_offset, lp) <= labelsector && -#if LABELSECTOR != 0 - bp->b_blkno + blockpersec(p->p_offset, lp) + sz > labelsector && -#endif - (bp->b_flags & B_READ) == 0 && !wlabel) { - bp->b_error = EROFS; - goto bad; - } - - /* calculate cylinder for disksort to order transfers with */ - bp->b_cylin = (bp->b_blkno + blockpersec(p->p_offset, lp)) / - lp->d_secpercyl; - return (1); - -bad: - bp->b_flags |= B_ERROR; -done: - return (0); -} diff --git a/sys/arch/pegasos/pegasos/dma.c b/sys/arch/pegasos/pegasos/dma.c deleted file mode 100644 index 22fc5642fef..00000000000 --- a/sys/arch/pegasos/pegasos/dma.c +++ /dev/null @@ -1,601 +0,0 @@ -/* $OpenBSD: dma.c,v 1.3 2004/02/04 20:07:18 drahn Exp $ */ -/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ - -/*- - * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/proc.h> -#include <sys/user.h> -#include <sys/extent.h> -#include <sys/buf.h> -#include <sys/device.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/file.h> -#include <sys/malloc.h> -#include <sys/mbuf.h> -#include <sys/mount.h> - -#include <uvm/uvm.h> -#include <uvm/uvm_page.h> - -#include <machine/bus.h> -int _dmamem_alloc_range( bus_dma_tag_t t, bus_size_t size, - bus_size_t alignment, bus_size_t boundary, bus_dma_segment_t *segs, - int nsegs, int *rsegs, int flags, vm_offset_t low, vm_offset_t high); -int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t, - struct proc *, int, bus_addr_t *, int *, int); -/* - * Common function for DMA map creation. May be called by bus-specific - * DMA map creation functions. - */ -int -_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments, - bus_size_t maxsegsz, bus_size_t boundary, int flags, bus_dmamap_t *dmamp) -{ - struct powerpc_bus_dmamap *map; - void *mapstore; - size_t mapsize; - - /* - * Allocate and initialize the DMA map. The end of the map - * is a variable-sized array of segments, so we allocate enough - * room for them in one shot. - * - * Note we don't preserve the WAITOK or NOWAIT flags. Preservation - * of ALLOCNOW notifies others that we've reserved these resources, - * and they are not to be freed. - * - * The bus_dmamap_t includes one bus_dma_segment_t, hence - * the (nsegments - 1). - */ - mapsize = sizeof(struct powerpc_bus_dmamap) + - (sizeof(bus_dma_segment_t) * (nsegments - 1)); - if ((mapstore = malloc(mapsize, M_DEVBUF, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL) - return (ENOMEM); - - bzero(mapstore, mapsize); - map = (struct powerpc_bus_dmamap *)mapstore; - map->_dm_size = size; - map->_dm_segcnt = nsegments; - map->_dm_maxsegsz = maxsegsz; - map->_dm_boundary = boundary; - map->_dm_flags = flags & ~(BUS_DMA_WAITOK|BUS_DMA_NOWAIT); - map->dm_nsegs = 0; /* no valid mappings */ - map->dm_mapsize = 0; - - *dmamp = map; - return (0); -} - -/* - * Common function for DMA map destruction. May be called by bus-specific - * DMA map destruction functions. - */ -void -_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map) -{ - - free(map, M_DEVBUF); -} - - -int -_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf, - bus_size_t buflen, struct proc *p, int flags, bus_addr_t *lastaddrp, - int *segp, int first) -{ - bus_size_t sgsize; - bus_addr_t curaddr, lastaddr, baddr, bmask; - vaddr_t vaddr = (vaddr_t)buf; - pmap_t pmap; - int seg; - - lastaddr = *lastaddrp; - bmask = ~(map->_dm_boundary - 1); - - if (p != NULL) - pmap = p->p_vmspace->vm_map.pmap; - else - pmap = pmap_kernel(); - - for (seg = *segp; buflen > 0; ) { - /* - * Get the physical address for this segment. - */ - if (pmap_extract(pmap, vaddr, (paddr_t *)&curaddr) != TRUE) { - panic("dmamap_load_buffer pmap %p vaddr %lx " - "pmap_extract failed", pmap, vaddr); - } - - /* - * Compute the segment size, and adjust counts. - */ - sgsize = PAGE_SIZE - ((u_long)vaddr & PGOFSET); - if (buflen < sgsize) - sgsize = buflen; - - /* - * Make sure we don't cross any boundaries. - */ - if (map->_dm_boundary > 0) { - baddr = (curaddr + map->_dm_boundary) & bmask; - if (sgsize > (baddr - curaddr)) - sgsize = (baddr - curaddr); - } - - /* - * Insert chunk into a segment, coalescing with the - * previous segment if possible. - */ - if (first) { - map->dm_segs[seg].ds_addr = curaddr; - map->dm_segs[seg].ds_len = sgsize; - first = 0; - } else { - if (curaddr == lastaddr && - (map->dm_segs[seg].ds_len + sgsize) <= - map->_dm_maxsegsz && - (map->_dm_boundary == 0 || - (map->dm_segs[seg].ds_addr & bmask) == - (curaddr & bmask))) - map->dm_segs[seg].ds_len += sgsize; - else { - if (++seg >= map->_dm_segcnt) - break; - map->dm_segs[seg].ds_addr = curaddr; - map->dm_segs[seg].ds_len = sgsize; - } - } - - lastaddr = curaddr + sgsize; - vaddr += sgsize; - buflen -= sgsize; - } - - *segp = seg; - *lastaddrp = lastaddr; - - /* - * Did we fit? - */ - if (buflen != 0) - return (EFBIG); /* XX better return value here? */ - - return (0); -} - -/* - * Common function for loading a DMA map with a linear buffer. May - * be called by bus-specific DMA map load functions. - */ -int -_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf, bus_size_t buflen, - struct proc *p, int flags) -{ - bus_addr_t lastaddr; - int seg, error; - - /* - * Make sure that on error condition we return "no valid mappings". - */ - map->dm_mapsize = 0; - map->dm_nsegs = 0; - - if (buflen > map->_dm_size) - return (EINVAL); - - seg = 0; - error = _dmamap_load_buffer(t, map, buf, buflen, p, flags, - &lastaddr, &seg, 1); - if (error == 0) { - map->dm_mapsize = buflen; - map->dm_nsegs = seg + 1; - } - return (error); -} - -/* - * Like _bus_dmamap_load(), but for mbufs. - */ -int -_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0, - int flags) -{ - bus_addr_t lastaddr; - int seg, error, first; - struct mbuf *m; - - /* - * Make sure that on error condition we return "no valid mappings". - */ - map->dm_mapsize = 0; - map->dm_nsegs = 0; - -#ifdef DIAGNOSTIC - if ((m0->m_flags & M_PKTHDR) == 0) - panic("_bus_dmamap_load_mbuf: no packet header"); -#endif - - if (m0->m_pkthdr.len > map->_dm_size) - return (EINVAL); - - first = 1; - seg = 0; - error = 0; - for (m = m0; m != NULL && error == 0; m = m->m_next) { - error = _dmamap_load_buffer(t, map, m->m_data, m->m_len, - NULL, flags, &lastaddr, &seg, first); - first = 0; - } - if (error == 0) { - map->dm_mapsize = m0->m_pkthdr.len; - map->dm_nsegs = seg + 1; - } - return (error); -} - -/* - * Like _bus_dmamap_load(), but for uios. - */ -int -_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio, int flags) -{ - bus_addr_t lastaddr; - int seg, i, error, first; - bus_size_t minlen, resid; - struct proc *p = NULL; - struct iovec *iov; - caddr_t addr; - - /* - * Make sure that on error condition we return "no valid mappings". - */ - map->dm_mapsize = 0; - map->dm_nsegs = 0; - - resid = uio->uio_resid; - iov = uio->uio_iov; - - if (resid > map->_dm_size) - return (EINVAL); - - if (uio->uio_segflg == UIO_USERSPACE) { - p = uio->uio_procp; -#ifdef DIAGNOSTIC - if (p == NULL) - panic("_bus_dmamap_load_uio: USERSPACE but no proc"); -#endif - } - - first = 1; - seg = 0; - error = 0; - for (i = 0; i < uio->uio_iovcnt && resid != 0 && error == 0; i++) { - /* - * Now at the first iovec to load. Load each iovec - * until we have exhausted the residual count. - */ - minlen = resid < iov[i].iov_len ? resid : iov[i].iov_len; - addr = (caddr_t)iov[i].iov_base; - - error = _dmamap_load_buffer(t, map, addr, minlen, - p, flags, &lastaddr, &seg, first); - first = 0; - - resid -= minlen; - } - if (error == 0) { - map->dm_mapsize = uio->uio_resid; - map->dm_nsegs = seg + 1; - } - return (error); -} - -/* - * Like _bus_dmamap_load(), but for raw memory allocated with - * bus_dmamem_alloc(). - */ -int -_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map, bus_dma_segment_t *segs, - int nsegs, bus_size_t size, int flags) -{ - if (nsegs > map->_dm_segcnt || size > map->_dm_size) - return (EINVAL); - - /* - * Make sure we don't cross any boundaries. - */ - if (map->_dm_boundary) { - bus_addr_t bmask = ~(map->_dm_boundary - 1); - int i; - - for (i = 0; i < nsegs; i++) { - if (segs[i].ds_len > map->_dm_maxsegsz) - return (EINVAL); - if ((segs[i].ds_addr & bmask) != - ((segs[i].ds_addr + segs[i].ds_len - 1) & bmask)) - return (EINVAL); - } - } - - bcopy(segs, map->dm_segs, nsegs * sizeof(*segs)); - map->dm_nsegs = nsegs; - map->dm_mapsize = size; - return (0); -} - -/* - * Common function for unloading a DMA map. May be called by - * bus-specific DMA map unload functions. - */ -void -_dmamap_unload(bus_dma_tag_t t, bus_dmamap_t map) -{ - - /* - * No resources to free; just mark the mappings as - * invalid. - */ - map->dm_nsegs = 0; - map->dm_mapsize = 0; -} - -/* - * Common function for DMA map synchronization. May be called - * by bus-specific DMA map synchronization functions. - */ -void -_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset, -bus_size_t len, int op) -{ - vaddr_t p; - int l; - int i; - extern int pegasos; /* XXX */ - - /* - * pegasos 1 (april1) needs to sync before dma from memory to - * disk drives snooping broken? - */ - - /* only flush before DMA to drive */ - if ((pegasos != 0) || (op & BUS_DMASYNC_PREWRITE) == 0) - return; - - for (i = 0; i < map->dm_nsegs; i++) { - /* flush (not invalidate?) the cache */ - - p = map->dm_segs[i].ds_addr; - l = map->dm_segs[i].ds_len; - do { - __asm__ __volatile__ ("dcbst 0,%0" :: "r"(p)); - p += CACHELINESIZE; - } while ((l -= CACHELINESIZE) > 0); - } -} - -/* - * Common function for DMA-safe memory allocation. May be called - * by bus-specific DMA memory allocation functions. - */ -int -_dmamem_alloc(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment, - bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs, - int flags) -{ - return (_dmamem_alloc_range(t, size, alignment, boundary, - segs, nsegs, rsegs, flags, 0, 0xf0000000)); -} - -/* - * Common function for freeing DMA-safe memory. May be called by - * bus-specific DMA memory free functions. - */ -void -_dmamem_free(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs) -{ - struct vm_page *m; - bus_addr_t addr; - struct pglist mlist; - int curseg; - - /* - * Build a list of pages to free back to the VM system. - */ - TAILQ_INIT(&mlist); - for (curseg = 0; curseg < nsegs; curseg++) { - for (addr = segs[curseg].ds_addr; - addr < (segs[curseg].ds_addr + segs[curseg].ds_len); - addr += PAGE_SIZE) { - m = PHYS_TO_VM_PAGE(addr); - TAILQ_INSERT_TAIL(&mlist, m, pageq); - } - } - - uvm_pglistfree(&mlist); -} - -/* - * Common function for mapping DMA-safe memory. May be called by - * bus-specific DMA memory map functions. - */ -int -_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size, - caddr_t *kvap, int flags) -{ - vm_offset_t va; - bus_addr_t addr; - int curseg; - - size = round_page(size); - va = uvm_km_valloc(kernel_map, size); - if (va == 0) - return (ENOMEM); - - *kvap = (caddr_t)va; - - for (curseg = 0; curseg < nsegs; curseg++) { - for (addr = segs[curseg].ds_addr; - addr < (segs[curseg].ds_addr + segs[curseg].ds_len); - addr += PAGE_SIZE, va += PAGE_SIZE, size -= PAGE_SIZE) { - if (size == 0) - panic("_bus_dmamem_map: size botch"); - pmap_enter(pmap_kernel(), va, addr, - VM_PROT_READ | VM_PROT_WRITE, - VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); - } - } - pmap_update(pmap_kernel()); - - return (0); -} - -/* - * Common function for unmapping DMA-safe memory. May be called by - * bus-specific DMA memory unmapping functions. - */ -void -_dmamem_unmap(bus_dma_tag_t t, caddr_t kva, size_t size) -{ - -#ifdef DIAGNOSTIC - if ((u_long)kva & PGOFSET) - panic("_bus_dmamem_unmap"); -#endif - - size = round_page(size); - uvm_km_free(kernel_map, (vm_offset_t)kva, size); -} - -/* - * Common functin for mmap(2)'ing DMA-safe memory. May be called by - * bus-specific DMA mmap(2)'ing functions. - */ -paddr_t -_dmamem_mmap(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, off_t off, - int prot, int flags) -{ - int i; - - for (i = 0; i < nsegs; i++) { -#ifdef DIAGNOSTIC - if (off & PGOFSET) - panic("_bus_dmamem_mmap: offset unaligned"); - if (segs[i].ds_addr & PGOFSET) - panic("_bus_dmamem_mmap: segment unaligned"); - if (segs[i].ds_len & PGOFSET) - panic("_bus_dmamem_mmap: segment size not multiple" - " of page size"); -#endif - if (off >= segs[i].ds_len) { - off -= segs[i].ds_len; - continue; - } - - return (powerpc_btop((caddr_t)segs[i].ds_addr + off)); - } - - /* Page not found. */ - return (-1); -} - -/********************************************************************** - * DMA utility functions - **********************************************************************/ - -/* - * Allocate physical memory from the given physical address range. - * Called by DMA-safe memory allocation methods. - */ -int -_dmamem_alloc_range(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment, - bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs, - int flags, vm_offset_t low, vm_offset_t high) -{ - vm_offset_t curaddr, lastaddr; - struct vm_page *m; - struct pglist mlist; - int curseg, error; - - /* Always round the size. */ - size = round_page(size); - - /* - * Allocate pages from the VM system. - */ - TAILQ_INIT(&mlist); - error = uvm_pglistalloc(size, low, high, - alignment, boundary, &mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0); - if (error) - return (error); - - /* - * Compute the location, size, and number of segments actually - * returned by the VM code. - */ - m = TAILQ_FIRST(&mlist); - curseg = 0; - lastaddr = segs[curseg].ds_addr = VM_PAGE_TO_PHYS(m); - segs[curseg].ds_len = PAGE_SIZE; - m = TAILQ_NEXT(m, pageq); - - for (; m != NULL; m = TAILQ_NEXT(m, pageq)) { - curaddr = VM_PAGE_TO_PHYS(m); -#ifdef DIAGNOSTIC - if (curaddr < low || curaddr >= high) { - printf("vm_page_alloc_memory returned non-sensical" - " address 0x%lx\n", curaddr); - panic("dmamem_alloc_range"); - } -#endif - if (curaddr == (lastaddr + PAGE_SIZE)) - segs[curseg].ds_len += PAGE_SIZE; - else { - curseg++; - segs[curseg].ds_addr = curaddr; - segs[curseg].ds_len = PAGE_SIZE; - } - lastaddr = curaddr; - } - - *rsegs = curseg + 1; - - return (0); -} diff --git a/sys/arch/pegasos/pegasos/genassym.cf b/sys/arch/pegasos/pegasos/genassym.cf deleted file mode 100644 index 6c6a0f119ba..00000000000 --- a/sys/arch/pegasos/pegasos/genassym.cf +++ /dev/null @@ -1,73 +0,0 @@ -# $OpenBSD: genassym.cf,v 1.1 2003/10/31 03:54:33 drahn Exp $ -# -# Copyright (c) 1982, 1990 The Regents of the University of California. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# @(#)genassym.c 7.8 (Berkeley) 5/7/91 -# - -include <sys/param.h> -include <sys/time.h> -include <sys/proc.h> -include <uvm/uvm_extern.h> - -include <machine/pcb.h> -include <machine/pmap.h> - -export FRAMELEN -struct trapframe FRAME_ -member 0 fixreg[0] -member 1 fixreg[1] -member 2 fixreg[2] -member 3 fixreg[3] -member lr -member cr -member ctr -member xer -member srr0 -member srr1 -member dar -member dsisr -member exc - -define SFRAMELEN roundup(sizeof(struct switchframe), 16) - -struct pcb -member PCB_PMR pcb_pmreal -member pcb_sp -member pcb_spl -member PCB_FAULT pcb_onfault - -struct pmap -member PM_SR pm_sr[0] -member PM_USRSR pm_sr[USER_SR] -member PM_KERNELSR pm_sr[KERNEL_SR] - -struct proc -member p_forw -member p_back -member p_addr diff --git a/sys/arch/pegasos/pegasos/hfsdisksubr.c b/sys/arch/pegasos/pegasos/hfsdisksubr.c deleted file mode 100644 index 39e26d85588..00000000000 --- a/sys/arch/pegasos/pegasos/hfsdisksubr.c +++ /dev/null @@ -1,121 +0,0 @@ -/* $OpenBSD: hfsdisksubr.c,v 1.1 2003/11/13 23:00:55 drahn Exp $ */ -/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ - -/* - * Copyright (c) 1996 Theo de Raadt - * Copyright (c) 1982, 1986, 1988 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/buf.h> -#include <sys/device.h> -#include <sys/disklabel.h> -#include <sys/syslog.h> -#include <sys/disk.h> - -#define b_cylin b_resid - -int -try_hfs_label(dev_t dev, void (*strat)(struct buf *), struct buf *bp, - struct disklabel *lp, struct cpu_disklabel *osdep, char **pmsg, - int *bsdpartoff); - -int -try_hfs_label(dev_t dev, void (*strat)(struct buf *), struct buf *bp, - struct disklabel *lp, struct cpu_disklabel *osdep, char **pmsg, - int *bsdpartoff) -{ - int part_cnt, n, i; - struct part_map_entry *part; - int hfspartoff = -1; - char *s; - - bp->b_blkno = 1; - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ; - bp->b_cylin = 1 / lp->d_secpercyl; - (*strat)(bp); - - /* if successful, wander through DPME partition table */ - if (biowait(bp)) { - *pmsg = "DPME partition I/O error"; - return 0; - } - - part = (struct part_map_entry *)bp->b_data; - /* if first partition is not valid, assume not HFS/DPME partitioned */ - if (part->pmSig != PART_ENTRY_MAGIC) { - osdep->macparts[0].pmSig = 0; /* make invalid */ - return 0; - } - osdep->macparts[0] = *part; - part_cnt = part->pmMapBlkCnt; - n = 0; - for (i = 0; i < part_cnt; i++) { - struct partition *pp = &lp->d_partitions[8+n]; - - bp->b_blkno = 1+i; - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ; - bp->b_cylin = 1+i / lp->d_secpercyl; - (*strat)(bp); - - if (biowait(bp)) { - *pmsg = "DPME partition I/O error"; - return 0; - } - part = (struct part_map_entry *)bp->b_data; - /* toupper the string, in case caps are different... */ - for (s = part->pmPartType; *s; s++) - if ((*s >= 'a') && (*s <= 'z')) - *s = (*s - 'a' + 'A'); - - if (0 == strcmp(part->pmPartType, PART_TYPE_OPENBSD)) { - hfspartoff = part->pmPyPartStart; - osdep->macparts[1] = *part; - } - /* currently we ignore all but HFS partitions */ - if (0 == strcmp(part->pmPartType, PART_TYPE_MAC)) { - pp->p_offset = part->pmPyPartStart; - pp->p_size = part->pmPartBlkCnt; - pp->p_fstype = FS_HFS; - n++; -#if 0 - printf("found DPME HFS partition [%s], adding to fake\n", - part->pmPartName); -#endif - } - } - lp->d_npartitions = MAXPARTITIONS; - - *bsdpartoff = hfspartoff; - return 1; -} diff --git a/sys/arch/pegasos/pegasos/locore.S b/sys/arch/pegasos/pegasos/locore.S deleted file mode 100644 index 193c5e51227..00000000000 --- a/sys/arch/pegasos/pegasos/locore.S +++ /dev/null @@ -1,1246 +0,0 @@ -/* $OpenBSD: locore.S,v 1.2 2004/01/15 03:26:36 drahn Exp $ */ -/* $NetBSD: locore.S,v 1.2 1996/10/16 19:33:09 ws Exp $ */ - -/* - * Copyright (C) 1995, 1996 Wolfgang Solfrank. - * Copyright (C) 1995, 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "assym.h" - -#include <sys/syscall.h> - -#include <machine/asm.h> -#include <machine/param.h> -#include <machine/pmap.h> -#include <machine/psl.h> -#include <machine/trap.h> - -/* - * Globals - */ - .globl _C_LABEL(esym),_C_LABEL(proc0paddr) - .type _C_LABEL(esym),@object - .type _C_LABEL(proc0paddr),@object - .data -_C_LABEL(esym): .long 0 /* end of symbol table */ -_C_LABEL(proc0paddr): .long 0 /* proc0 p_addr */ -idle_u: .long 0 /* fake uarea during idle after exit */ - -fwargsave: - .long 0 - .long 0 - .globl _C_LABEL(where) - .type _C_LABEL(where),@object -_C_LABEL(where): .long 0 - -/* - * Startup entry - */ -_ENTRY(_C_LABEL(kernel_text)) -_ENTRY(_ASM_LABEL(start)) -/* arguments to start - * r1 - stack provided by firmware/bootloader - * r3 - unused - * r4 - unused - * r5 - firmware pointer (NULL for PPC1bug) - * r6 - arg list - * r7 - length - */ - .globl start - .type start,@function -start: - lis %r3, fwargsave@ha - stw %r6, fwargsave@l(%r3) - stw %r7, fwargsave@l+4(%r3) - bl ofw_init - li %r0,0 - mtmsr %r0 /* Disable FPU/MMU/exceptions */ - isync - -/* compute end of kernel memory */ - lis %r8,_end@ha - addi %r8,%r8,_end@l - lis %r3, fwargsave@ha - lwz %r6, fwargsave@l(%r3) - lwz %r7, fwargsave@l+4(%r3) -#if defined(DDB) || defined(KERNFS) - cmpwi %r6, 0 - beq 1f - add %r9,%r6,%r7 - lwz %r9, -4(%r9) - cmpwi %r9,0 - beq 1f - lis %r8,_C_LABEL(esym)@ha - stw %r9,_C_LABEL(esym)@l(%r8) - mr %r8, %r9 -1: -#endif - li %r9,PGOFSET - add %r8,%r8,%r9 - andc %r8,%r8,%r9 - lis %r9,idle_u@ha - stw %r8,idle_u@l(%r9) - addi %r8,%r8,USPACE /* space for idle_u */ - lis %r9,_C_LABEL(proc0paddr)@ha - stw %r8,_C_LABEL(proc0paddr)@l(%r9) - addi %r1,%r8,USPACE-FRAMELEN /* stackpointer for proc0 */ - mr %r4,%r1 /* end of mem reserved for kernel */ - li %r0,0 - stwu %r0,-16(%r1) /* end of stack chain */ - - lis %r3,start@ha - addi %r3,%r3,start@l - mr %r5,%r6 /* args string */ - bl _C_LABEL(initppc) - bl _C_LABEL(main) - b _C_LABEL(OF_exit) - -/* - * No processes are runnable, so loop waiting for one. - * Separate label here for accounting purposes. - */ -_C_LABEL(idle): - mfmsr %r3 - /* disable interrupts while manipulating runque */ - andi. %r3,%r3,~PSL_EE@l - mtmsr %r3 - - lis %r8,_C_LABEL(whichqs)@ha - lwz %r9,_C_LABEL(whichqs)@l(%r8) - - or. %r9,%r9,%r9 - bne- _C_LABEL(sw1) /* at least one queue non-empty */ - - ori %r3,%r3,PSL_EE /* reenable ints again */ - mtmsr %r3 - isync - sync - /* low power mode */ - mfmsr %r3 - oris %r3, %r3, PSL_POW@h - mtmsr %r3 - isync - -/* May do some power saving here? */ - - b _C_LABEL(idle) - -/* - * switchexit gets called from cpu_exit to free the user structure - * and kernel stack of the current process. - */ -_ENTRY(_C_LABEL(switchexit)) -/* First switch to the idle pcb/kernel stack */ - lis %r6,idle_u@ha - lwz %r6,idle_u@l(%r6) - lis %r7,_C_LABEL(curpcb)@ha - stw %r6,_C_LABEL(curpcb)@l(%r7) - addi %r1,%r6,USPACE-16 /* 16 bytes are reserved at stack top */ - /* - * Schedule the vmspace and stack to be freed (the proc arg is - * already in r3). - */ - bl _C_LABEL(exit2) - - /* Fall through to cpu_switch to actually select another proc */ - li %r3,0 /* indicate exited process */ - -/* Fall through to cpu_switch to actually select another proc */ - -/* - * void cpu_switch(struct proc *p) - * Find a runnable process and switch to it. - */ -_ENTRY(_C_LABEL(cpu_switch)) - mflr %r0 /* save lr */ - stw %r0,4(%r1) - stwu %r1,-16(%r1) - stw %r31,12(%r1) - stw %r30,8(%r1) - - mr %r30,%r3 - lis %r3,_C_LABEL(curproc)@ha - li %r31,0 - /* Zero to not accumulate cpu time */ - stw %r31,_C_LABEL(curproc)@l(%r3) - lis %r3,_C_LABEL(curpcb)@ha - lwz %r31,_C_LABEL(curpcb)@l(%r3) - - li %r3,0 - bl _C_LABEL(lcsplx) - stw %r3,PCB_SPL(%r31) /* save spl */ - -/* Find a new process */ - mfmsr %r3 - andi. %r3,%r3,~PSL_EE@l /* disable interrupts while - manipulating runque */ - mtmsr %r3 - isync - - lis %r8,_C_LABEL(whichqs)@ha - lwz %r9,_C_LABEL(whichqs)@l(%r8) - - or. %r9,%r9,%r9 - beq- _C_LABEL(idle) /* all queues empty */ -_C_LABEL(sw1): - cntlzw %r10,%r9 - lis %r4,_C_LABEL(qs)@ha - addi %r4,%r4,_C_LABEL(qs)@l - slwi %r3,%r10,3 - add %r3,%r3,%r4 /* select queue */ - - lwz %r31,P_FORW(%r3) /* unlink first proc from queue */ - lwz %r4,P_FORW(%r31) - stw %r4,P_FORW(%r3) - stw %r3,P_BACK(%r4) - - cmpl 0,%r3,%r4 /* queue empty? */ - bne 1f - - lis %r3,0x80000000@ha - srw %r3,%r3,%r10 - andc %r9,%r9,%r3 - stw %r9,_C_LABEL(whichqs)@l(%r8) /* mark it empty */ - -1: - /* just did this resched thing, clear resched */ - li %r3,0 - lis %r4,_C_LABEL(want_resched)@ha - stw %r3,_C_LABEL(want_resched)@l(%r4) - - stw %r3,P_BACK(%r31) /* probably superfluous */ - - lis %r4,_C_LABEL(curproc)@ha - stw %r31,_C_LABEL(curproc)@l(%r4) /* record new process */ - - mfmsr %r3 - ori %r3,%r3,PSL_EE /* Now we can interrupt again */ - mtmsr %r3 - - cmpl 0,%r31,%r30 /* is it the same process? */ - beq switch_return - - or. %r30,%r30,%r30 /* old process was exiting? */ - beq switch_exited - - mfsr %r10,USER_SR /* save USER_SR for copyin/copyout */ - mfcr %r11 /* save cr */ - mr %r12,%r2 /* save r2 */ - stwu %r1,-SFRAMELEN(%r1) /* still running on old stack */ - stmw %r10,8(%r1) - lwz %r3,P_ADDR(%r30) - stw %r1,PCB_SP(%r3) /* save SP */ - -switch_exited: - /* disable interrupts while actually switching */ - mfmsr %r3 - andi. %r3,%r3,~PSL_EE@l - mtmsr %r3 - - lwz %r4,P_ADDR(%r31) - lis %r5,_C_LABEL(curpcb)@ha - stw %r4,_C_LABEL(curpcb)@l(%r5) /* indicate new pcb */ - - lwz %r5,PCB_PMR(%r4) - - /* save real pmap pointer for spill fill */ - lis %r6,_C_LABEL(curpm)@ha - stwu %r5,_C_LABEL(curpm)@l(%r6) - stwcx. %r5,%r0,%r6 /* clear possible reservation */ - - addic. %r5,%r5,64 - li %r6,0 - mfsr %r8,KERNEL_SR /* save kernel SR */ -1: - addis %r6,%r6,-0x10000000@ha /* set new procs segment registers */ - or. %r6,%r6,%r6 /* This is done from the real address pmap */ - lwzu %r7,-4(%r5) /* so we don't have to worry */ - mtsrin %r7,%r6 /* about accessibility */ - bne 1b - mtsr KERNEL_SR,%r8 /* restore kernel SR */ - isync - - lwz %r1,PCB_SP(%r4) /* get new procs SP */ - - ori %r3,%r3,PSL_EE /* interrupts are okay again */ - mtmsr %r3 - - lmw %r10,8(%r1) /* get other regs */ - lwz %r1,0(%r1) /* get saved SP */ - mr %r2,%r12 /* get saved r2 */ - mtcr %r11 /* get saved cr */ - isync - mtsr USER_SR,%r10 /* get saved USER_SR */ - isync - -switch_return: - mr %r30,%r7 /* save proc pointer */ - lwz %r3,PCB_SPL(%r4) - bl _C_LABEL(lcsplx) - - mr %r3,%r30 /* curproc for special fork returns */ - - lwz %r31,12(%r1) - lwz %r30,8(%r1) - addi %r1,%r1,16 - lwz %r0,4(%r1) - mtlr %r0 - blr - - -/* - * Data used during primary/secondary traps/interrupts - */ -#define tempsave 0x2e0 /* primary save area for trap handling */ -#define disisave 0x3e0 /* primary save area for dsi/isi traps */ -#define INTSTK (8*1024) /* 8K interrupt stack */ - .data -intstk: .space INTSTK /* interrupt stack */ - .global _C_LABEL(intr_depth) - .type _C_LABEL(intr_depth),@object -_C_LABEL(intr_depth): - .long -1 /* in-use marker */ -#define SPILLSTK 1024 /* 1K spill stack */ -.lcomm spillstk,SPILLSTK,8 - -/* - * This code gets copied to all the trap vectors - * (except ISI/DSI, ALI, the interrupts, and possibly the debugging traps - * when using IPKDB). - */ - .text - .globl _C_LABEL(trapcode),_C_LABEL(trapsize) - .type _C_LABEL(trapcode),@function - .type _C_LABEL(trapsize),@object -_C_LABEL(trapcode): - mtsprg 1,%r1 /* save SP */ - stmw %r28,tempsave(%r0) /* free r28-r31 */ - mflr %r28 /* save LR */ - mfcr %r29 /* save CR */ - - /* Test whether we already had PR set */ - mfsrr1 %r31 - mtcr %r31 - bc 4,17,1f /* branch if PSL_PR is clear */ - lis %r1,_C_LABEL(curpcb)@ha - lwz %r1,_C_LABEL(curpcb)@l(%r1) - addi %r1,%r1,USPACE /* stack is top of user struct */ -1: - bla s_trap -_C_LABEL(trapsize) = .-_C_LABEL(trapcode) - -/* - * For ALI: has to save DSISR and DAR - */ - .globl _C_LABEL(alitrap),_C_LABEL(alisize) -_C_LABEL(alitrap): - mtsprg 1,%r1 /* save SP */ - stmw %r28,tempsave(0) /* free r28-r31 */ - mfdar %r30 - mfdsisr %r31 - stmw %r30,tempsave+16(0) - mflr %r28 /* save LR */ - mfcr %r29 /* save CR */ - - /* Test whether we already had PR set */ - mfsrr1 %r31 - mtcr %r31 - bc 4,17,1f /* branch if PSL_PR is clear */ - lis %r1,_C_LABEL(curpcb)@ha - lwz %r1,_C_LABEL(curpcb)@l(%r1) - addi %r1,%r1,USPACE /* stack is top of user struct */ -1: - bla s_trap -_C_LABEL(alisize) = .-_C_LABEL(alitrap) - -/* - * Similar to the above for DSI - * Has to handle BAT spills - * and standard pagetable spills - */ - .globl _C_LABEL(dsitrap),_C_LABEL(dsisize) - .type _C_LABEL(dsitrap),@function - .type _C_LABEL(dsisize),@object -_C_LABEL(dsitrap): - stmw %r28,disisave(0) /* free r28-r31 */ - mfcr %r29 /* save CR */ - mfxer %r30 /* save XER */ - mtsprg 2,%r30 /* in SPRG2 */ - mfsrr1 %r31 /* test kernel mode */ -#if 0 - mtcr %r31 - bc 12,17,1f /* branch if PSL_PR is set */ - mfdar %r31 /* get fault address */ - rlwinm %r31,%r31,7,25,28 /* get segment * 8 */ - addis %r31,%r31,_C_LABEL(battable)@ha - lwz %r30,_C_LABEL(battable)@l(31) /* get batu */ - mtcr %r30 - bc 4,30,1f /* branch if supervisor valid is false */ - lwz %r31,_C_LABEL(battable)+4@l(%r31) /* get batl */ -/* We randomly use the highest two bat registers here */ - mftb %r28 - andi. %r28,%r28,1 - bne 2f - mtdbatu 2,%r30 - mtdbatl 2,%r31 - b 3f -2: - mtdbatu 3,%r30 - mtdbatl 3,%r31 -3: - mfsprg %r30,2 /* restore XER */ - mtxer %r30 - mtcr %r29 /* restore CR */ - lmw %r28,disisave(0) /* restore r28-r31 */ - rfi /* return to trapped code */ -1: -#endif - mflr %r28 /* save LR */ - bla s_dsitrap -_C_LABEL(dsisize) = .-_C_LABEL(dsitrap) - -/* - * Similar to the above for ISI - */ - .globl _C_LABEL(isitrap),_C_LABEL(isisize) - .type _C_LABEL(isitrap),@function - .type _C_LABEL(isisize),@object -_C_LABEL(isitrap): - stmw %r28,disisave(0) /* free r28-r31 */ - mflr %r28 /* save LR */ - mfcr %r29 /* save CR */ - mfsrr1 %r31 /* test kernel mode */ -#if 0 - mtcr %r31 - bc 12,17,1f /* branch if PSL_PR is set */ - mfsrr0 %r31 /* get fault address */ - rlwinm %r31,%r31,7,25,28 /* get segment * 8 */ - addis %r31,%r31,_C_LABEL(battable)@ha - lwz %r30,_C_LABEL(battable)@l(31) /* get batu */ - mtcr %r30 - bc 4,30,1f /* branch if supervisor valid is false */ - mtibatu 3,%r30 - lwz %r30,_C_LABEL(battable)+4@l(31) /* get batl */ - mtibatl 3,%r30 - mtcr %r29 /* restore CR */ - lmw %r28,disisave(0) /* restore r28-r31 */ - rfi /* return to trapped code */ -1: -#endif - bla s_isitrap -_C_LABEL(isisize) = .-_C_LABEL(isitrap) - -/* - * This one for the external interrupt handler. - */ - .globl _C_LABEL(extint),_C_LABEL(extsize) - .type _C_LABEL(extint),@function - .type _C_LABEL(extsize),@object -_C_LABEL(extint): - mtsprg 1,%r1 /* save SP */ - stmw %r28,tempsave(0) /* free r28-r31 */ - mflr %r28 /* save LR */ - mfcr %r29 /* save CR */ - mfxer %r30 /* save XER */ - lis %r1,intstk+INTSTK@ha /* get interrupt stack */ - addi %r1,%r1,intstk+INTSTK@l - lwz %r31,0(%r1) /* were we already running on intstk? */ - addic. %r31,%r31,%r1 - stw %r31,0(%r1) - beq 1f - mfsprg %r1,1 /* yes, get old SP */ -1: - ba extintr -_C_LABEL(extsize) = .-_C_LABEL(extint) - -/* - * And this one for the decrementer interrupt handler. - */ - .globl _C_LABEL(decrint),_C_LABEL(decrsize) - .type _C_LABEL(decrint),@function - .type _C_LABEL(decrsize),@object -_C_LABEL(decrint): - mtsprg 1,%r1 /* save SP */ - stmw %r28,tempsave(0) /* free r28-r31 */ - mflr %r28 /* save LR */ - mfcr %r29 /* save CR */ - mfxer %r30 /* save XER */ - lis %r1,intstk+INTSTK@ha /* get interrupt stack */ - addi %r1,%r1,intstk+INTSTK@l - lwz %r31,0(%r1) /* were we already running on intstk? */ - addic. %r31,%r31,%r1 - stw %r31,0(%r1) - beq 1f - mfsprg %r1,1 /* yes, get old SP */ -1: - ba decrintr -_C_LABEL(decrsize) = .-_C_LABEL(decrint) - -/* - * Now the tlb software load for 603 processors: - * (Code essentially from the 603e User Manual, Chapter 5) - */ -#define DMISS 976 -#define DCMP 977 -#define HASH1 978 -#define HASH2 979 -#define IMISS 980 -#define ICMP 981 -#define RPA 982 - -#define bdneq bdnzf 2, -#define tlbli .long 0x7c0007e4+0x800* -#define tlbld .long 0x7c0007a4+0x800* - - .globl _C_LABEL(tlbimiss),_C_LABEL(tlbimsize) - .type _C_LABEL(tlbimiss),@function - .type _C_LABEL(tlbimsize),@object -_C_LABEL(tlbimiss): - mfspr %r2,HASH1 /* get first pointer */ - li %r1,8 - mfctr %r0 /* save counter */ - mfspr %r3,ICMP /* get first compare value */ - addi %r2,%r2,-8 /* predec pointer */ -1: - mtctr %r1 /* load counter */ -2: - lwzu %r1,8(%r2) /* get next pte */ - cmpl 0,%r1,%r3 /* see if found pte */ - bdneq 2b /* loop if not eq */ - bne 3f /* not found */ - lwz %r1,4(%r2) /* load tlb entry lower word */ - andi. %r3,%r1,8 /* check G-bit */ - bne 4f /* if guarded, take ISI */ - mtctr %r0 /* restore counter */ - mfspr %r0,IMISS /* get the miss address for the tlbli */ - mfsrr1 %r3 /* get the saved cr0 bits */ - mtcrf 0x80,%r3 /* and restore */ - ori %r1,%r1,0x100 /* set the reference bit */ - mtspr RPA,%r1 /* set the pte */ - srwi %r1,%r1,8 /* get byte 7 of pte */ - tlbli 0 /* load the itlb */ - stb %r1,6(%r2) /* update page table */ - rfi - -3: /* not found in pteg */ - andi. %r1,%r3,0x40 /* have we already done second hash? */ - bne 5f - mfspr %r2,HASH2 /* get the second pointer */ - ori %r3,%r3,0x40 /* change the compare value */ - li %r1,8 - addi %r2,%r2,-8 /* predec pointer */ - b 1b -4: /* guarded */ - mfsrr1 %r3 - andi. %r2,%r3,0xffff /* clean upper srr1 */ - addis %r2,%r2,0x800 /* set srr<4> to flag prot violation */ - b 6f -5: /* not found anywhere */ - mfsrr1 %r3 - andi. %r2,%r3,0xffff /* clean upper srr1 */ - addis %r2,%r2,0x4000 /* set srr1<1> to flag pte not found */ -6: - mtctr %r0 /* restore counter */ - mtsrr1 %r2 - mfmsr %r0 - xoris %r0,%r0,2 /* flip the msr<tgpr> bit */ - mtcrf 0x80,%r3 /* restore cr0 */ - mtmsr %r0 /* now with native gprs */ - isync - ba EXC_ISI -_C_LABEL(tlbimsize) = .-_C_LABEL(tlbimiss) - - .globl _C_LABEL(tlbdlmiss),_C_LABEL(tlbdlmsize) - .type _C_LABEL(tlbdlmiss),@function - .type _C_LABEL(tlbdlmsize),@object -_C_LABEL(tlbdlmiss): - mfspr %r2,HASH1 /* get first pointer */ - li %r1,8 - mfctr %r0 /* save counter */ - mfspr %r3,DCMP /* get first compare value */ - addi %r2,%r2,-8 /* predec pointer */ -1: - mtctr %r1 /* load counter */ -2: - lwzu %r1,8(%r2) /* get next pte */ - cmpl 0,%r1,%r3 /* see if found pte */ - bdneq 2b /* loop if not eq */ - bne 3f /* not found */ - lwz %r1,4(%r2) /* load tlb entry lower word */ - mtctr %r0 /* restore counter */ - mfspr %r0,DMISS /* get the miss address for the tlbld */ - mfsrr1 %r3 /* get the saved cr0 bits */ - mtcrf 0x80,%r3 /* and restore */ - ori %r1,%r1,0x100 /* set the reference bit */ - mtspr RPA,%r1 /* set the pte */ - srwi %r1,%r1,8 /* get byte 7 of pte */ - tlbld 0 /* load the dtlb */ - stb %r1,6(%r2) /* update page table */ - rfi - -3: /* not found in pteg */ - andi. %r1,%r3,0x40 /* have we already done second hash? */ - bne 5f - mfspr %r2,HASH2 /* get the second pointer */ - ori %r3,%r3,0x40 /* change the compare value */ - li %r1,8 - addi %r2,%r2,-8 /* predec pointer */ - b 1b -5: /* not found anywhere */ - mfsrr1 %r3 - lis %r1,0x4000 /* set dsisr<1> to flag pte not found */ - mtctr %r0 /* restore counter */ - andi. %r2,%r3,0xffff /* clean upper srr1 */ - mtsrr1 %r2 - mtdsisr %r1 /* load the dsisr */ - mfspr %r1,DMISS /* get the miss address */ - mtdar %r1 /* put in dar */ - mfmsr %r0 - xoris %r0,%r0,2 /* flip the msr<tgpr> bit */ - mtcrf 0x80,%r3 /* restore cr0 */ - mtmsr %r0 /* now with native gprs */ - isync - ba EXC_DSI -_C_LABEL(tlbdlmsize) = .-_C_LABEL(tlbdlmiss) - - .globl _C_LABEL(tlbdsmiss),_C_LABEL(tlbdsmsize) - .type _C_LABEL(tlbdsmiss),@function - .type _C_LABEL(tlbdsmsize),@object -_C_LABEL(tlbdsmiss): - mfspr %r2,HASH1 /* get first pointer */ - li %r1,8 - mfctr %r0 /* save counter */ - mfspr %r3,DCMP /* get first compare value */ - addi %r2,%r2,-8 /* predec pointer */ -1: - mtctr %r1 /* load counter */ -2: - lwzu %r1,8(%r2) /* get next pte */ - cmpl 0,%r1,%r3 /* see if found pte */ - bdneq 2b /* loop if not eq */ - bne 3f /* not found */ - lwz %r1,4(%r2) /* load tlb entry lower word */ - andi. %r3,%r1,0x80 /* check the C-bit */ - beq 4f -5: - mtctr %r0 /* restore counter */ - mfspr %r0,DMISS /* get the miss address for the tlbld */ - mfsrr1 %r3 /* get the saved cr0 bits */ - mtcrf 0x80,%r3 /* and restore */ - mtspr RPA,%r1 /* set the pte */ - tlbld 0 /* load the dtlb */ - rfi - -3: /* not found in pteg */ - andi. %r1,%r3,0x40 /* have we already done second hash? */ - bne 5f - mfspr %r2,HASH2 /* get the second pointer */ - ori %r3,%r3,0x40 /* change the compare value */ - li %r1,8 - addi %r2,%r2,-8 /* predec pointer */ - b 1b -4: /* found, but C-bit = 0 */ - rlwinm. %r3,%r1,30,0,1 /* test PP */ - bge- 7f - andi. %r3,%r1,1 - beq+ 8f -9: /* found, but protection violation (PP==00)*/ - mfsrr1 %r3 - lis %r1,0xa00 /* indicate protection violation on store */ - b 1f -7: /* found, PP=1x */ - mfspr %r3,DMISS /* get the miss address */ - mfsrin %r1,%r3 /* get the segment register */ - mfsrr1 %r3 - rlwinm %r3,%r3,18,31,31 /* get PR-bit */ - rlwnm. %r2,%r2,3,1,1 /* get the key */ - bne- 9b /* protection violation */ -8: /* found, set reference/change bits */ - lwz %r1,4(%r2) /* reload tlb entry */ - ori %r1,%r1,0x180 - sth %r1,6(%r2) - b 5b -5: /* not found anywhere */ - mfsrr1 %r3 - lis %r1,0x4200 /* set dsisr<1> to flag pte not found */ - /* dsisr<6> to flag store */ -1: - mtctr %r0 /* restore counter */ - andi. %r2,%r3,0xffff /* clean upper srr1 */ - mtsrr1 %r2 - mtdsisr %r1 /* load the dsisr */ - mfspr %r1,DMISS /* get the miss address */ - mtdar %r1 /* put in dar */ - mfmsr %r0 - xoris %r0,%r0,2 /* flip the msr<tgpr> bit */ - mtcrf 0x80,%r3 /* restore cr0 */ - mtmsr %r0 /* now with native gprs */ - isync - ba EXC_DSI -_C_LABEL(tlbdsmsize) = .-_C_LABEL(tlbdsmiss) - -#ifdef DDB -#define ddbsave 0xde0 /* primary save area for DDB */ -/* - * In case of DDB we want a separate trap catcher for it - */ - .local ddbstk - .comm ddbstk,INTSTK,8 /* ddb stack */ - - .globl _C_LABEL(ddblow),_C_LABEL(ddbsize) -_C_LABEL(ddblow): - mtsprg 1,%r1 /* save SP */ - stmw %r28,ddbsave(0) /* free r28-r31 */ - mflr %r28 /* save LR */ - mfcr %r29 /* save CR */ - lis %r1,ddbstk+INTSTK@ha /* get new SP */ - addi %r1,%r1,ddbstk+INTSTK@l - bla ddbtrap -_C_LABEL(ddbsize) = .-_C_LABEL(ddblow) -#endif /* DDB */ - - -/* - * FRAME_SETUP assumes: - * SPRG1 SP (1) - * savearea r28-r31,DAR,DSISR (DAR & DSISR only for DSI traps) - * 28 LR - * 29 CR - * 1 kernel stack - * LR trap type - * SRR0/1 as at start of trap - */ -#define FRAME_SETUP(savearea) \ -/* Have to enable translation to allow access of kernel stack: */ \ - mfsrr0 %r30; \ - mfsrr1 %r31; \ - stmw %r30,savearea+24(0); \ - mfmsr %r30; \ - ori %r30,%r30,(PSL_DR|PSL_IR); \ - mtmsr %r30; \ - isync; \ - mfsprg %r31,1; \ - stwu %r31,-FRAMELEN(%r1); \ - stw %r0,FRAME_0+8(%r1); \ - stw %r31,FRAME_1+8(%r1); \ - stw %r28,FRAME_LR+8(%r1); \ - stw %r29,FRAME_CR+8(%r1); \ - lmw %r28,savearea(0); \ - stmw %r2,FRAME_2+8(%r1); \ - lmw %r28,savearea+16(0); \ - mfxer %r3; \ - mfctr %r4; \ - mflr %r5; \ - andi. %r5,%r5,0xff00; \ - stw %r3,FRAME_XER+8(%r1); \ - stw %r4,FRAME_CTR+8(%r1); \ - stw %r5,FRAME_EXC+8(%r1); \ - stw %r28,FRAME_DAR+8(%r1); \ - stw %r29,FRAME_DSISR+8(%r1); \ - stw %r30,FRAME_SRR0+8(%r1); \ - stw %r31,FRAME_SRR1+8(%r1) - -#define FRAME_LEAVE(savearea) \ -/* Now restore regs: */ \ - lwz %r2,FRAME_SRR0+8(%r1); \ - lwz %r3,FRAME_SRR1+8(%r1); \ - lwz %r4,FRAME_CTR+8(%r1); \ - lwz %r5,FRAME_XER+8(%r1); \ - lwz %r6,FRAME_LR+8(%r1); \ - lwz %r7,FRAME_CR+8(%r1); \ - stw %r2,savearea(0); \ - stw %r3,savearea+4(0); \ - mtctr %r4; \ - mtxer %r5; \ - mtlr %r6; \ - mtsprg 1,%r7; /* save cr */ \ - lmw %r2,FRAME_2+8(%r1); \ - lwz %r0,FRAME_0+8(%r1); \ - lwz %r1,FRAME_1+8(%r1); \ - mtsprg 2,%r2; /* save r2 & r3 */ \ - mtsprg 3,%r3; \ -/* Disable translation, machine check and recoverability: */ \ - mfmsr %r2; \ - lis %r3,(PSL_DR|PSL_IR|PSL_ME|PSL_RI)@ha; \ - addi %r3,%r3,(PSL_DR|PSL_IR|PSL_ME|PSL_RI)@l; \ - andc %r2,%r2,%r3; \ - mtmsr %r2; \ - isync; \ -/* Decide whether we return to user mode: */ \ - lwz %r3,savearea+4(0); \ - mtcr %r3; \ - bc 4,17,1f; /* branch if PSL_PR is false */ \ -/* Restore user & kernel access SR: */ \ - lis %r2,_C_LABEL(curpm)@ha; /* get real address of pmap */ \ - lwz %r2,_C_LABEL(curpm)@l(2); \ - lwz %r3,PM_USRSR(%r2); \ - mtsr USER_SR,%r3; \ - lwz %r3,PM_KERNELSR(%r2); \ - mtsr KERNEL_SR,%r3; \ -1: mfsprg %r2,1; /* restore cr */ \ - mtcr %r2; \ - lwz %r2,savearea(0); \ - lwz %r3,savearea+4(0); \ - mtsrr0 %r2; \ - mtsrr1 %r3; \ - mfsprg %r2,2; /* restore r2 & r3 */ \ - mfsprg %r3,3 - -/* - * Preamble code for DSI/ISI traps - */ -disitrap: - lmw %r30,disisave(0) - stmw %r30,tempsave(0) - lmw %r30,disisave+8(0) - stmw %r30,tempsave+8(0) - mfdar %r30 - mfdsisr %r31 - stmw %r30,tempsave+16(0) -realtrap: - /* Test whether we already had PR set */ - mfsrr1 %r1 - mtcr %r1 - /* restore SP (might have been overwritten) */ - mfsprg %r1,1 - bc 4,17,s_trap /* branch if PSL_PR is false */ - lis %r1,_C_LABEL(curpcb)@ha - lwz %r1,_C_LABEL(curpcb)@l(%r1) - addi %r1,%r1,USPACE /* stack is top of user struct */ -/* - * Now the common trap catching code. - */ -s_trap: -/* First have to enable KERNEL mapping */ - lis %r31,KERNEL_SEGMENT@ha - addi %r31,%r31,KERNEL_SEGMENT@l - mtsr KERNEL_SR,%r31 - FRAME_SETUP(tempsave) -/* Now we can recover interrupts again: */ - mfmsr %r7 - mfsrr1 %r31 - andi. %r31,%r31,PSL_EE /* restore EE from previous context */ - or %r7,%r7,%r31 - ori %r7,%r7,(PSL_ME|PSL_RI) - mtmsr %r7 - isync -/* Call C trap code: */ -trapagain: - addi %r3,%r1,8 - bl _C_LABEL(trap) -trapexit: -/* Disable interrupts: */ - mfmsr %r3 - andi. %r3,%r3,~PSL_EE@l - mtmsr %r3 -/* Test AST pending: */ - lwz %r5,FRAME_SRR1+8(%r1) - mtcr %r5 - bc 4,17,1f /* branch if PSL_PR is false */ - lis %r3,_C_LABEL(astpending)@ha - lwz %r4,_C_LABEL(astpending)@l(%r3) - andi. %r4,%r4,1 - beq 1f - li %r6,EXC_AST - stw %r6,FRAME_EXC+8(%r1) - b trapagain -1: - FRAME_LEAVE(tempsave) - rfi - -/* - * Child comes here at the end of a fork. - * Mostly similar to the above. - */ - .globl _C_LABEL(fork_trampoline) - .type _C_LABEL(fork_trampoline),@function -_C_LABEL(fork_trampoline): - li %r3,0 - bl _C_LABEL(lcsplx) - mtlr %r31 - mr %r3,%r30 - blrl /* jump indirect to r31 */ - b trapexit - -/* - * DSI second stage fault handler - */ -s_dsitrap: - mfdsisr %r31 /* test if this is spill fault */ - mtcr %r31 - mtsprg 1,%r1 /* save SP */ - bc 4,1,disitrap /* branch if table miss is false */ - lis %r1,spillstk+SPILLSTK@ha - addi %r1,%r1,spillstk+SPILLSTK@l /* get spill stack */ - stwu %r1,-52(%r1) - stw %r0,48(%r1) /* save non-volatile registers */ - stw %r3,44(%r1) - stw %r4,40(%r1) - stw %r5,36(%r1) - stw %r6,32(%r1) - stw %r7,28(%r1) - stw %r8,24(%r1) - stw %r9,20(%r1) - stw %r10,16(%r1) - stw %r11,12(1) - stw %r12,8(1) - mfxer %r30 /* save XER */ - mtsprg 2,%r30 - mflr %r30 /* save trap type */ - mfctr %r31 /* & CTR */ - mfdar %r3 - mfsrr1 %r4 - mfdsisr %r5 - li %r6, 0 -s_pte_spill: - bl _C_LABEL(pte_spill_r) /* try a spill */ - cmpwi 0,%r3,0 - mtctr %r31 /* restore CTR */ - mtlr %r30 /* and trap type */ - mfsprg %r31,2 /* get saved XER */ - mtxer %r31 /* restore XER */ - lwz %r12,8(%r1) /* restore non-volatile registers */ - lwz %r11,12(%r1) - lwz %r10,16(%r1) - lwz %r9,20(%r1) - lwz %r8,24(%r1) - lwz %r7,28(%r1) - lwz %r6,32(%r1) - lwz %r5,36(%r1) - lwz %r4,40(%r1) - lwz %r3,44(%r1) - lwz %r0,48(%r1) - beq disitrap - mfsprg %r1,1 /* restore SP */ - mtcr %r29 /* restore CR */ - mtlr %r28 /* restore LR */ - lmw %r28,disisave(0) /* restore r28-r31 */ - rfi /* return to trapped code */ - -/* - * ISI second stage fault handler - */ -s_isitrap: - mfsrr1 %r31 /* test if this may be a spill fault */ - mtcr %r31 - mtsprg 1,%r1 /* save SP */ - bc 4,%r1,disitrap /* branch if table miss is false */ - lis %r1,spillstk+SPILLSTK@ha - addi %r1,%r1,spillstk+SPILLSTK@l /* get spill stack */ - stwu %r1,-52(%r1) - stw %r0,48(%r1) /* save non-volatile registers */ - stw %r3,44(%r1) - stw %r4,40(%r1) - stw %r5,36(%r1) - stw %r6,32(%r1) - stw %r7,28(%r1) - stw %r8,24(%r1) - stw %r9,20(%r1) - stw %r10,16(%r1) - stw %r11,12(%r1) - stw %r12,8(%r1) - mfxer %r30 /* save XER */ - mtsprg 2,%r30 - mflr %r30 /* save trap type */ - mfctr %r31 /* & ctr */ - mfsrr0 %r3 - mfsrr1 %r4 - li %r5, 0 - li %r6, 1 - b s_pte_spill /* above */ - -/* - * External interrupt second level handler - */ -#define INTRENTER \ -/* Save non-volatile registers: */ \ - stwu %r1,-88(%r1); /* temporarily */ \ - stw %r0,84(%r1); \ - mfsprg %r0,1; /* get original SP */ \ - stw %r0,0(%r1); /* and store it */ \ - stw %r3,80(%r1); \ - stw %r4,76(%r1); \ - stw %r5,72(%r1); \ - stw %r6,68(%r1); \ - stw %r7,64(%r1); \ - stw %r8,60(%r1); \ - stw %r9,56(%r1); \ - stw %r10,52(%r1); \ - stw %r11,48(%r1); \ - stw %r12,44(%r1); \ - stw %r28,40(%r1); /* saved LR */ \ - stw %r29,36(%r1); /* saved CR */ \ - stw %r30,32(%r1); /* saved XER */ \ - lmw %r28,tempsave(0); /* restore r28-r31 */ \ - mfctr %r6; \ - lis %r5,_C_LABEL(intr_depth)@ha; \ - lwz %r5,_C_LABEL(intr_depth)@l(%r5); \ - mfsrr0 %r4; \ - mfsrr1 %r3; \ - stw %r6,28(%r1); \ - stw %r5,20(%r1); \ - stw %r4,12(%r1); \ - stw %r3,8(%r1); \ -/* interrupts are recoverable here, and enable translation */ \ - lis %r3,(KERNEL_SEGMENT|SR_SUKEY|SR_PRKEY)@ha; \ - addi %r3,%r3,(KERNEL_SEGMENT|SR_SUKEY|SR_PRKEY)@l; \ - mtsr KERNEL_SR,%r3; \ - mfmsr %r5; \ - ori %r5,%r5,(PSL_IR|PSL_DR|PSL_RI); \ - mtmsr %r5; \ - isync - - .globl _C_LABEL(extint_call) - .type _C_LABEL(extint_call),@function -extintr: - INTRENTER -_C_LABEL(extint_call): - bl _C_LABEL(extint_call) /* to be filled in later */ -intr_exit: -/* Disable interrupts (should already be disabled) and MMU here: */ - mfmsr %r3 - andi. %r3,%r3,~(PSL_EE|PSL_ME|PSL_RI|PSL_DR|PSL_IR)@l - mtmsr %r3 - isync -/* restore possibly overwritten registers: */ - lwz %r12,44(%r1) - lwz %r11,48(%r1) - lwz %r10,52(%r1) - lwz %r9,56(%r1) - lwz %r8,60(%r1) - lwz %r7,64(%r1) - lwz %r6,8(%r1) - lwz %r5,12(%r1) - lwz %r4,28(%r1) - lwz %r3,32(%r1) - mtsrr1 %r6 - mtsrr0 %r5 - mtctr %r4 - mtxer %r3 -/* Returning to user mode? */ - mtcr %r6 /* saved SRR1 */ - bc 4,17,1f /* branch if PSL_PR is false */ - lis %r3,_C_LABEL(curpm)@ha /* get current pmap real address */ - lwz %r3,_C_LABEL(curpm)@l(%r3) - lwz %r3,PM_KERNELSR(%r3) - mtsr KERNEL_SR,%r3 /* Restore kernel SR */ - lis %r3,_C_LABEL(astpending)@ha /* Test AST pending */ - lwz %r4,_C_LABEL(astpending)@l(%r3) - andi. %r4,%r4,1 - beq 1f -/* Setup for entry to realtrap: */ - lwz %r3,0(%r1) /* get saved SP */ - mtsprg %r1,3 - li %r6,EXC_AST - stmw %r28,tempsave(0) /* establish tempsave again */ - mtlr %r6 - lwz %r28,40(%r1) /* saved LR */ - lwz %r29,36(%r1) /* saved CR */ - lwz %r6,68(%r1) - lwz %r5,72(%r1) - lwz %r4,76(%r1) - lwz %r3,80(%r1) - lwz %r0,84(%r1) - lis %r30,_C_LABEL(intr_depth)@ha /* adjust reentrancy count */ - lwz %r31,_C_LABEL(intr_depth)@l(%r30) - addi %r31,%r31,-1 - stw %r31,_C_LABEL(intr_depth)@l(%r30) - b realtrap -1: -/* Here is the normal exit of extintr: */ - lwz %r5,36(%r1) - lwz %r6,40(%r1) - mtcr %r5 - mtlr %r6 - lwz %r6,68(%r1) - lwz %r5,72(%r1) - lis %r3,_C_LABEL(intr_depth)@ha /* adjust reentrancy count */ - lwz %r4,_C_LABEL(intr_depth)@l(%r3) - addi %r4,%r4,-1 - stw %r4,_C_LABEL(intr_depth)@l(%r3) - lwz %r4,76(%r1) - lwz %r3,80(%r1) - lwz %r0,84(%r1) - lwz %r1,0(%r1) - rfi - -/* - * Decrementer interrupt second level handler - */ -decrintr: - INTRENTER - addi %r3,%r1,8 /* intr frame */ - bl _C_LABEL(decr_intr) - b intr_exit - - -/* - * int setfault() - * - * Similar to setjmp to setup for handling faults on accesses to user memory. - * Any routine using this may only call bcopy, either the form below, - * or the (currently used) C code optimized, so it doesn't use any non-volatile - * registers. - */ - .globl _C_LABEL(setfault) - .type _C_LABEL(setfault),@function -_C_LABEL(setfault): - mflr %r0 - mfcr %r12 - mfmsr %r2 - lis %r4,_C_LABEL(curpcb)@ha - lwz %r4,_C_LABEL(curpcb)@l(%r4) - stw %r3,PCB_FAULT(%r4) - stw %r0,0(%r3) - stw %r2,4(%r3) - stw %r1,8(%r3) - stmw %r12,12(%r3) - li %r3,0 - blr - -/* - * The following code gets copied to the top of the user stack on process - * execution. It does signal trampolining on signal delivery. - * - * On entry r1 points to a struct sigframe at bottom of current stack. - * All other registers are unchanged. - */ - .globl _C_LABEL(sigcode),_C_LABEL(esigcode) - .type _C_LABEL(sigcode),@function - .type _C_LABEL(esigcode),@function -_C_LABEL(sigcode): - addi %r1,%r1,-16 /* reserved space for callee */ - blrl - addi %r3,%r1,16+8 /* compute &sf_sc */ - li %r0,SYS_sigreturn - sc /* sigreturn(scp) */ - li %r0,SYS_exit - sc /* exit(errno) */ -_C_LABEL(esigcode): - - - - .data - .globl _C_LABEL(intrnames) - .type _C_LABEL(intrnames),@object - .globl _C_LABEL(eintrnames) - .type _C_LABEL(eintrnames),@object -_C_LABEL(intrnames): - .string "irq0" "irq1" "irq2" "irq3" - .string "irq4" "irq5" "irq6" "irq7" - .string "irq8" "irq9" "irq10" "irq11" - .string "irq12" "irq13" "irq14" "irq15" - .string "irq16" "irq17" "irq18" "irq19" - .string "irq20" "irq21" "irq22" "irq23" - .string "irq24" "irq25" "irq26" "irq27" - .string "irq28" "irq29" "irq30" "irq31" - .string "irq32" "irq33" "irq34" "irq35" - .string "irq36" "irq37" "irq38" "irq39" - .string "irq40" "irq41" "irq42" "irq43" - .string "irq44" "irq45" "irq46" "irq47" - .string "irq48" "irq49" "irq50" "irq51" - .string "irq52" "irq53" "irq54" "irq55" - .string "irq56" "irq57" "irq58" "irq59" - .string "irq60" "irq61" "irq62" "irq63" - .string "clock" - .string "stat" - .space 512 -_C_LABEL(eintrnames): - .align 4 - .globl _C_LABEL(intrcnt) - .type _C_LABEL(intrcnt),@object - .globl _C_LABEL(eintrcnt) - .type _C_LABEL(eintrcnt),@object -_C_LABEL(intrcnt): - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0,0,0,0 - .long 0 - .long 0 -_C_LABEL(eintrcnt): - -#ifdef DDB -/* - * Deliberate entry to ddbtrap - */ - .globl _C_LABEL(ddb_trap) -_C_LABEL(ddb_trap): - mtsprg %r1,1 - mfmsr %r3 - mtsrr1 %r3 - andi. %r3,%r3,~(PSL_EE|PSL_ME)@l - mtmsr %r3 /* disable interrupts */ - isync - stmw %r28,ddbsave(0) - mflr %r28 - li %r29,EXC_BPT - mtlr %r29 - mfcr %r29 - mtsrr0 %r28 - -/* - * Now the ddb trap catching code. - */ -ddbtrap: - FRAME_SETUP(ddbsave) -/* Call C trap code: */ - addi %r3,%r1,8 - bl _C_LABEL(ddb_trap_glue) - or. %r3,%r3,%r3 - bne ddbleave -/* This wasn't for DDB, so switch to real trap: */ - lwz %r3,FRAME_EXC+8(%r1) /* save exception */ - stw %r3,ddbsave+8(0) - FRAME_LEAVE(ddbsave) - mtsprg %r1,1 /* prepare for entrance to realtrap */ - stmw %r28,tempsave(0) - mflr %r28 - mfcr %r29 - lwz %r31,ddbsave+8(0) - mtlr %r31 - b realtrap -ddbleave: - FRAME_LEAVE(ddbsave) - rfi -#endif /* DDB */ - diff --git a/sys/arch/pegasos/pegasos/machdep.c b/sys/arch/pegasos/pegasos/machdep.c deleted file mode 100644 index cbc638e032f..00000000000 --- a/sys/arch/pegasos/pegasos/machdep.c +++ /dev/null @@ -1,1440 +0,0 @@ -/* $OpenBSD: machdep.c,v 1.5 2004/02/04 20:07:18 drahn Exp $ */ -/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ - -/* - * Copyright (C) 1995, 1996 Wolfgang Solfrank. - * Copyright (C) 1995, 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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/buf.h> -#include <sys/timeout.h> -#include <sys/exec.h> -#include <sys/malloc.h> -#include <sys/mbuf.h> -#include <sys/mount.h> -#include <sys/msgbuf.h> -#include <sys/proc.h> -#include <sys/signalvar.h> -#include <sys/reboot.h> -#include <sys/syscallargs.h> -#include <sys/syslog.h> -#include <sys/extent.h> -#include <sys/systm.h> -#include <sys/user.h> - -#include <uvm/uvm_extern.h> - -#ifdef SYSVMSG -#include <sys/msg.h> -#endif -#include <net/netisr.h> - -#include <dev/cons.h> - -#include <machine/bat.h> -#include <machine/pmap.h> -#include <machine/powerpc.h> -#include <machine/trap.h> -#include <machine/autoconf.h> -#include <machine/bus.h> -#include <machine/pio.h> -#include <machine/intr.h> - -#include <dev/pci/pcivar.h> - -#include <arch/pegasos/pegasos/ofw_machdep.h> -#include <dev/ofw/openfirm.h> - -#if 0 -#if KEYBOARD_RESET -#include <dev/isa/isareg.h> -#include <dev/isa/isavar.h> -#include <dev/ic/i8042reg.h> -#endif -#endif - -#ifdef DDB -#include <machine/db_machdep.h> -#include <ddb/db_access.h> -#include <ddb/db_sym.h> -#include <ddb/db_extern.h> -#endif - -/* - * Global variables used here and there - */ -struct pcb *curpcb; -struct pmap *curpm; -struct proc *fpuproc; - -extern struct user *proc0paddr; -struct pool ppc_vecpl; - -/* - * Declare these as initialized data so we can patch them. - */ -#ifdef NBUF -int nbuf = NBUF; -#else -int nbuf = 0; -#endif - -#ifndef BUFCACHEPERCENT -#define BUFCACHEPERCENT 5 -#endif - -#ifdef BUFPAGES -int bufpages = BUFPAGES; -#else -int bufpages = 0; -#endif -int bufcachepercent = BUFCACHEPERCENT; - -struct bat battable[16]; - -struct vm_map *exec_map = NULL; -struct vm_map *phys_map = NULL; - -int ppc_malloc_ok = 0; - -#ifndef SYS_TYPE -/* XXX Hardwire it for now */ -#define SYS_TYPE POWER4e -#endif - -int system_type = SYS_TYPE; /* XXX Hardwire it for now */ - -char ofw_eth_addr[6]; /* Save address of first network ifc found */ -char *bootpath; -char bootpathbuf[512]; - -struct firmware *fw = NULL; - -#ifdef DDB -void * startsym, *endsym; -#endif - -#ifdef APERTURE -#ifdef INSECURE -int allowaperture = 1; -#else -int allowaperture = 0; -#endif -#endif - -void ofw_dbg(char *str); - -caddr_t allocsys(caddr_t); -void dumpsys(void); -void systype(char *name); -int lcsplx(int ipl); /* called from LCore */ -int power4e_get_eth_addr(void); -void nameinterrupt(int replace, char *newstr); -void ppc_intr_setup(intr_establish_t *establish, - intr_disestablish_t *disestablish); -void *ppc_intr_establish(void *lcv, pci_intr_handle_t ih, int type, - int level, int (*func)(void *), void *arg, char *name); -int bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int cacheable, - bus_space_handle_t *bshp); -bus_addr_t bus_space_unmap_p(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size); -void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size); - - -/* - * Extent maps to manage I/O. Allocate storage for 8 regions in each, - * initially. Later devio_malloc_safe will indicate that it's save to - * use malloc() to dynamically allocate region descriptors. - */ -static long devio_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof (long)]; -struct extent *devio_ex; -static int devio_malloc_safe = 0; - -extern int OF_stdout; - -/* XXX, called from asm */ -void initppc(u_int startkernel, u_int endkernel, char *args); - -int pegasos = 0; - -void -initppc(startkernel, endkernel, args) - u_int startkernel, endkernel; - char *args; -{ - extern void *trapcode; extern int trapsize; - extern void *dsitrap; extern int dsisize; - extern void *isitrap; extern int isisize; - extern void *alitrap; extern int alisize; - extern void *decrint; extern int decrsize; - extern void *tlbimiss; extern int tlbimsize; - extern void *tlbdlmiss; extern int tlbdlmsize; - extern void *tlbdsmiss; extern int tlbdsmsize; -#ifdef DDB - extern void *ddblow; extern int ddbsize; -#endif - extern void consinit(void); - extern void callback(void *); - extern void *msgbuf_addr; - int exc, scratch; - - proc0.p_addr = proc0paddr; - bzero(proc0.p_addr, sizeof *proc0.p_addr); - - curpcb = &proc0paddr->u_pcb; - - curpm = curpcb->pcb_pmreal = curpcb->pcb_pm = pmap_kernel(); - - /* - * Initialize BAT registers to unmapped to not generate - * overlapping mappings below. - */ - ppc_mtibat0u(0); - ppc_mtibat1u(0); - ppc_mtibat2u(0); - ppc_mtibat3u(0); - ppc_mtdbat0u(0); - ppc_mtdbat1u(0); - ppc_mtdbat2u(0); - ppc_mtdbat3u(0); - - /* - * Set up initial BAT table to only map the lowest 256 MB area - */ - battable[0].batl = BATL(0x00000000, BAT_M); - battable[0].batu = BATU(0x00000000); - - /* - * Now setup fixed bat registers - * - * Note that we still run in real mode, and the BAT - * registers were cleared above. - */ - /* IBAT0 used for initial 256 MB segment */ - ppc_mtibat0l(battable[0].batl); - ppc_mtibat0u(battable[0].batu); - - /* DBAT0 used similar */ - ppc_mtdbat0l(battable[0].batl); - ppc_mtdbat0u(battable[0].batu); - - /* - * Set up trap vectors - */ - for (exc = EXC_RSVD; exc <= EXC_LAST; exc += 0x100) { - switch (exc) { - default: - bcopy(&trapcode, (void *)exc, (size_t)&trapsize); - break; - case EXC_EXI: - /* - * This one is (potentially) installed during autoconf - */ - break; - - case EXC_DSI: - bcopy(&dsitrap, (void *)EXC_DSI, (size_t)&dsisize); - break; - case EXC_ISI: - bcopy(&isitrap, (void *)EXC_ISI, (size_t)&isisize); - break; - case EXC_ALI: - bcopy(&alitrap, (void *)EXC_ALI, (size_t)&alisize); - break; - case EXC_DECR: - bcopy(&decrint, (void *)EXC_DECR, (size_t)&decrsize); - break; - case EXC_IMISS: - bcopy(&tlbimiss, (void *)EXC_IMISS, (size_t)&tlbimsize); - break; - case EXC_DLMISS: - bcopy(&tlbdlmiss, (void *)EXC_DLMISS, (size_t)&tlbdlmsize); - break; - case EXC_DSMISS: - bcopy(&tlbdsmiss, (void *)EXC_DSMISS, (size_t)&tlbdsmsize); - break; - case EXC_PGM: - case EXC_TRC: - case EXC_BPT: -#if defined(DDB) - bcopy(&ddblow, (void *)exc, (size_t)&ddbsize); -#endif - break; - } - } - - /* Grr, ALTIVEC_UNAVAIL is a vector not ~0xff aligned: 0x0f20 */ - bcopy(&trapcode, (void *)0xf20, (size_t)&trapsize); - - /* - * since trapsize is > 0x20, we just overwrote the EXC_PERF handler - * since we do not use it, we will "share" it with the EXC_VEC, - * we dont support EXC_VEC either. - * should be a 'ba 0xf20 written' at address 0xf00, but we - * do not generate EXC_PERF exceptions... - */ - - syncicache((void *)EXC_RST, EXC_LAST - EXC_RST + 0x100); - - - uvmexp.pagesize = 4096; - uvm_setpagesize(); - - /* - * Initialize pmap module. - */ - pmap_bootstrap(startkernel, endkernel); - - /* use BATs to map 1GB memory, no pageable BATs now */ - if (physmem > btoc(0x10000000)) { - ppc_mtdbat1l(BATL(0x10000000, BAT_M)); - ppc_mtdbat1u(BATU(0x10000000)); - } - if (physmem > btoc(0x20000000)) { - ppc_mtdbat2l(BATL(0x20000000, BAT_M)); - ppc_mtdbat2u(BATU(0x20000000)); - } - if (physmem > btoc(0x30000000)) { - ppc_mtdbat3l(BATL(0x30000000, BAT_M)); - ppc_mtdbat3u(BATU(0x30000000)); - } -#if 0 - /* now that we know physmem size, map physical memory with BATs */ - if (physmem > btoc(0x10000000)) { - battable[0x1].batl = BATL(0x10000000, BAT_M); - battable[0x1].batu = BATU(0x10000000); - } - if (physmem > btoc(0x20000000)) { - battable[0x2].batl = BATL(0x20000000, BAT_M); - battable[0x2].batu = BATU(0x20000000); - } - if (physmem > btoc(0x30000000)) { - battable[0x3].batl = BATL(0x30000000, BAT_M); - battable[0x3].batu = BATU(0x30000000); - } - if (physmem > btoc(0x40000000)) { - battable[0x4].batl = BATL(0x40000000, BAT_M); - battable[0x4].batu = BATU(0x40000000); - } - if (physmem > btoc(0x50000000)) { - battable[0x5].batl = BATL(0x50000000, BAT_M); - battable[0x5].batu = BATU(0x50000000); - } - if (physmem > btoc(0x60000000)) { - battable[0x6].batl = BATL(0x60000000, BAT_M); - battable[0x6].batu = BATU(0x60000000); - } - if (physmem > btoc(0x70000000)) { - battable[0x7].batl = BATL(0x70000000, BAT_M); - battable[0x7].batu = BATU(0x70000000); - } -#endif - - /* - * Now enable translation (and machine checks/recoverable interrupts). - */ - (fw->vmon)(); - - __asm__ volatile ("eieio; mfmsr %0; ori %0,%0,%1; mtmsr %0; sync;isync" - : "=r"(scratch) : "K"(PSL_IR|PSL_DR|PSL_ME|PSL_RI)); - - /* - * use the memory provided by pmap_bootstrap for message buffer - */ - initmsgbuf(msgbuf_addr, MSGBUFSIZE); - - /* - * Look at arguments passed to us and compute boothowto. - * Default to SINGLE and ASKNAME if no args or - * SINGLE and DFLTROOT if this is a ramdisk kernel. - */ -#ifdef RAMDISK_HOOKS - boothowto = RB_SINGLE | RB_DFLTROOT; -#else - boothowto = RB_AUTOBOOT; -#endif /* RAMDISK_HOOKS */ - - /* - * Parse arg string. - */ - - /* make a copy of the args! */ - strncpy(bootpathbuf, args, 512); - bootpath= &bootpathbuf[0]; - while ( *++bootpath && *bootpath != ' '); - if (*bootpath) { - *bootpath++ = 0; - while (*bootpath) { - switch (*bootpath++) { - case 'a': - boothowto |= RB_ASKNAME; - break; - case 's': - boothowto |= RB_SINGLE; - break; - case 'd': - boothowto |= RB_KDB; - break; - case 'c': - boothowto |= RB_CONFIG; - break; - default: - break; - } - } - } - bootpath= &bootpathbuf[0]; - -#ifdef DDB - ddb_init(); -#endif - - /* - * Set up extents for pci mappings - * Is this too late? - * - * what are good start and end values here?? - * 0x0 - 0x80000000 mcu bus - * MAP A MAP B - * 0x80000000 - 0xbfffffff io 0x80000000 - 0xefffffff mem - * 0xc0000000 - 0xffffffff mem 0xf0000000 - 0xffffffff io - * - * of course bsd uses 0xe and 0xf - * So the BSD PPC memory map will look like this - * 0x0 - 0x80000000 memory (whatever is filled) - * 0x80000000 - 0xdfffffff (pci space, memory or io) - * 0xe0000000 - kernel vm segment - * 0xf0000000 - kernel map segment (user space mapped here) - */ - - devio_ex = extent_create("devio", 0x80000000, 0xffffffff, M_DEVBUF, - (caddr_t)devio_ex_storage, sizeof(devio_ex_storage), - EX_NOCOALESCE|EX_NOWAIT); - - /* - * Now we can set up the console as mapping is enabled. - */ - ofwconsinit(); - /* while using openfirmware, run userconfig */ - if (boothowto & RB_CONFIG) { -#ifdef BOOT_CONFIG - user_config(); -#else - printf("kernel does not support -c; continuing..\n"); -#endif - } - - { - char model[32]; - int node, len; - - node = OF_peer(0); - len = OF_getprop(node, "model", model, sizeof(model)); - model[len] = 0; - - /* - * Different versions of Pegasos: - * Pegasos I, no April (not supported...) - * Pegasos I, April I 0 - * Pegasos I, April II 1 (?) - * Pegasos II 2 - * - * However, OF does not distingush between - * April I and April II therefore we must assume it - * has the April I snoop bug... - */ - - if (strcmp(model, "Pegasos2") == 0) { - pegasos = 2; - } else { - pegasos = 0; /* Assume PegI April I */ - } - - - } - /* - * Replace with real console. - */ - ofwconprobe(); - consinit(); - -#ifdef DDB - if (boothowto & RB_KDB) - Debugger(); -#endif - - /* - * Figure out ethernet address. - */ - (void)power4e_get_eth_addr(); - - pool_init(&ppc_vecpl, sizeof(struct vreg), 16, 0, 0, "ppcvec", NULL); - -} -void ofw_dbg(char *str) -{ - int i = strlen (str); - OF_write(OF_stdout, str, i); -} - - -void -install_extint(void (*handler)(void)) -{ - void extint(void); - void extsize(void); - extern u_long extint_call; - u_long offset = (u_long)handler - (u_long)&extint_call; - int msr; - -#ifdef DIAGNOSTIC - if (offset > 0x1ffffff) - panic("install_extint: too far away"); -#endif - msr = ppc_intr_disable(); - extint_call = (extint_call & 0xfc000003) | offset; - bcopy(&extint, (void *)EXC_EXI, (size_t)&extsize); - syncicache((void *)&extint_call, sizeof extint_call); - syncicache((void *)EXC_EXI, (int)&extsize); - ppc_intr_enable(msr); -} - -/* - * Machine dependent startup code. - */ -void -cpu_startup() -{ - int sz, i; - caddr_t v; - vm_offset_t minaddr, maxaddr; - int base, residual; - v = (caddr_t)proc0paddr + USPACE; - - proc0.p_addr = proc0paddr; - - printf("%s", version); - - printf("real mem = %d (%dK)\n", ctob(physmem), ctob(physmem)/1024); - - /* - * Find out how much space we need, allocate it, - * and then give everything true virtual addresses. - */ - sz = (int)allocsys((caddr_t)0); - if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(sz))) == 0) - panic("startup: no room for tables"); - if (allocsys(v) - v != sz) - 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. - */ - sz = MAXBSIZE * nbuf; - if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(sz), - NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE, - UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, 0))) - panic("cpu_startup: cannot allocate VM for buffers"); - /* - addr = (vaddr_t)buffers; - */ - base = bufpages / nbuf; - residual = bufpages % nbuf; - if (base >= MAXBSIZE) { - /* Don't want to alloc more physical mem than ever needed */ - base = MAXBSIZE; - residual = 0; - } - for (i = 0; i < nbuf; i++) { - vm_size_t curbufsize; - vm_offset_t curbuf; - struct vm_page *pg; - - curbuf = (vm_offset_t)buffers + i * MAXBSIZE; - curbufsize = PAGE_SIZE * (i < residual ? base + 1 : base); - while (curbufsize) { - pg = uvm_pagealloc(NULL, 0, NULL, 0); - if (pg == NULL) - panic("cpu_startup: not enough memory for" - " buffer cache"); - pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg), - VM_PROT_READ|VM_PROT_WRITE); - curbuf += PAGE_SIZE; - curbufsize -= PAGE_SIZE; - } - } - pmap_update(pmap_kernel()); - - /* - * Allocate a submap for exec arguments. This map effectively - * limits the number of processes exec'ing at any time. - */ - minaddr = vm_map_min(kernel_map); - exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, 16 * NCARGS, - VM_MAP_PAGEABLE, FALSE, NULL); - - /* - * Allocate a submap for physio - */ - phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, - VM_PHYS_SIZE, 0, FALSE, NULL); - ppc_malloc_ok = 1; - - printf("avail mem = %ld (%ldK)\n", ptoa(uvmexp.free), - ptoa(uvmexp.free) / 1024); - printf("using %d buffers containing %d bytes of memory\n", nbuf, - bufpages * PAGE_SIZE); - - /* - * Set up the buffers. - */ - bufinit(); - - devio_malloc_safe = 1; -} - -/* - * Allocate space for system data structures. - */ -caddr_t -allocsys(caddr_t v) -{ -#define valloc(name, type, num) \ - v = (caddr_t)(((name) = (type *)v) + (num)) - -#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 - - /* - * Decide on buffer space to use. - */ - if (bufpages == 0) - bufpages = physmem * bufcachepercent / 100; - if (nbuf == 0) { - nbuf = bufpages; - if (nbuf < 16) - nbuf = 16; - } - /* Restrict to at most 35% filled kvm */ - if (nbuf > - (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / MAXBSIZE * 35 / 100) - nbuf = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / - MAXBSIZE * 35 / 100; - - /* More buffer pages than fits into the buffers is senseless. */ - if (bufpages > nbuf * MAXBSIZE / PAGE_SIZE) - bufpages = nbuf * MAXBSIZE / PAGE_SIZE; - - valloc(buf, struct buf, nbuf); - - return v; -} - -/* - * consinit - * Initialize system console. - */ -void -consinit() -{ - static int cons_initted = 0; - - if (cons_initted) - return; - cninit(); - cons_initted = 1; -} - -/* - * Clear registers on exec - */ -void -setregs(struct proc *p, struct exec_package *pack, u_long stack, - register_t *retval) -{ - u_int32_t newstack; - u_int32_t pargs; - u_int32_t args[4]; - - struct trapframe *tf = trapframe(p); - pargs = -roundup(-stack + 8, 16); - newstack = (u_int32_t)(pargs - 32); - - copyin ((void *)(VM_MAX_ADDRESS-0x10), &args, 0x10); - - bzero(tf, sizeof *tf); - tf->fixreg[1] = newstack; - tf->fixreg[3] = retval[0] = args[1]; /* XXX */ - tf->fixreg[4] = retval[1] = args[0]; /* XXX */ - tf->fixreg[5] = args[2]; /* XXX */ - tf->fixreg[6] = args[3]; /* XXX */ - tf->srr0 = pack->ep_entry; - tf->srr1 = PSL_MBO | PSL_USERSET | PSL_FE_DFLT; - p->p_addr->u_pcb.pcb_flags = 0; -} - -/* - * Send a signal to process. - */ -void -sendsig(sig_t catcher, int sig, int mask, u_long code, int type, - union sigval val) -{ - struct proc *p = curproc; - struct trapframe *tf; - struct sigframe *fp, frame; - struct sigacts *psp = p->p_sigacts; - int oldonstack; - - frame.sf_signum = sig; - - tf = trapframe(p); - oldonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK; - - /* - * Allocate stack space for signal handler. - */ - if ((psp->ps_flags & SAS_ALTSTACK) - && !oldonstack - && (psp->ps_sigonstack & sigmask(sig))) { - fp = (struct sigframe *)(psp->ps_sigstk.ss_sp - + psp->ps_sigstk.ss_size); - psp->ps_sigstk.ss_flags |= SS_ONSTACK; - } else - fp = (struct sigframe *)tf->fixreg[1]; - - fp = (struct sigframe *)((int)(fp - 1) & ~0xf); - - /* - * Generate signal context for SYS_sigreturn. - */ - frame.sf_sc.sc_onstack = oldonstack; - frame.sf_sc.sc_mask = mask; - frame.sf_sip = NULL; - bcopy(tf, &frame.sf_sc.sc_frame, sizeof *tf); - if (psp->ps_siginfo & sigmask(sig)) { - frame.sf_sip = &fp->sf_si; - initsiginfo(&frame.sf_si, sig, code, type, val); - } - if (copyout(&frame, fp, sizeof frame) != 0) - sigexit(p, SIGILL); - - - tf->fixreg[1] = (int)fp; - tf->lr = (int)catcher; - tf->fixreg[3] = (int)sig; - tf->fixreg[4] = (psp->ps_siginfo & sigmask(sig)) ? (int)&fp->sf_si : NULL; - tf->fixreg[5] = (int)&fp->sf_sc; - tf->srr0 = p->p_sigcode; - -#if WHEN_WE_ONLY_FLUSH_DATA_WHEN_DOING_PMAP_ENTER - pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map),tf->srr0, &pa); - syncicache(pa, (p->p_emul->e_esigcode - p->p_emul->e_sigcode)); -#endif -} - -/* - * System call to cleanup state after a signal handler returns. - */ -int -sys_sigreturn(struct proc *p, void *v, register_t *retval) -{ - struct sys_sigreturn_args /* { - syscallarg(struct sigcontext *) sigcntxp; - } */ *uap = v; - struct sigcontext sc; - struct trapframe *tf; - int error; - - if ((error = copyin(SCARG(uap, sigcntxp), &sc, sizeof sc))) - return error; - tf = trapframe(p); - if ((sc.sc_frame.srr1 & PSL_USERSTATIC) != (tf->srr1 & PSL_USERSTATIC)) - return EINVAL; - bcopy(&sc.sc_frame, tf, sizeof *tf); - if (sc.sc_onstack & 1) - p->p_sigacts->ps_sigstk.ss_flags |= SS_ONSTACK; - else - p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK; - p->p_sigmask = sc.sc_mask & ~sigcantmask; - return EJUSTRETURN; -} - -/* - * Machine dependent system variables. - * None for now. - */ -int -cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, - size_t newlen, struct proc *p) -{ - /* all sysctl names at this level are terminal */ - if (namelen != 1) - return ENOTDIR; - switch (name[0]) { - case CPU_ALLOWAPERTURE: -#ifdef APERTURE - if (securelevel > 0) - return (sysctl_rdint(oldp, oldlenp, newp, - allowaperture)); - else - return (sysctl_int(oldp, oldlenp, newp, newlen, - &allowaperture)); -#else - return (sysctl_rdint(oldp, oldlenp, newp, 0)); -#endif - default: - return EOPNOTSUPP; - } -} - -void -dumpsys() -{ - printf("dumpsys: TBD\n"); -} - -volatile int cpl, ipending, astpending; -int imask[IPL_NUM]; - -/* - * this is a hack interface to allow zs to work better until - * a true soft interrupt mechanism is created. - */ -void -softtty() -{ -} - -int netisr; - -/* - * Soft networking interrupts. - */ -void -softnet(int isr) -{ -#define DONETISR(flag, func) \ - if (isr & (1 << flag))\ - func(); - -#include <net/netisr_dispatch.h> -} - -int -lcsplx(int ipl) -{ - int oldcpl; - - oldcpl = cpl; - splx(ipl); - return oldcpl; -} - -/* - * Halt or reboot the machine after syncing/dumping according to howto. - */ -void -boot(int howto) -{ - static int syncing; - static char str[256]; - - boothowto = howto; - if (!cold && !(howto & RB_NOSYNC) && !syncing) { - syncing = 1; - vfs_shutdown(); /* sync */ -#if 0 - /* resettodr does not currently do anything, address - * this later - */ - /* - * If we've been adjusting the clock, the todr - * will be out of synch; adjust it now unless - * the system was sitting in ddb. - */ - if ((howto & RB_TIMEBAD) == 0) { - resettodr(); - } else { - printf("WARNING: not updating battery clock\n"); - } -#endif - } - splhigh(); - if (howto & RB_HALT) { - doshutdownhooks(); - if ((howto & RB_POWERDOWN) == RB_POWERDOWN) { - /* XXX */ - printf("WARNING: powerdown failed!\n"); - } - - printf("halted\n\n"); - (fw->exit)(); - } - if (!cold && (howto & RB_DUMP)) - dumpsys(); - doshutdownhooks(); - printf("rebooting\n\n"); - - - (fw->boot)(str); - { - /*UGLY HACK!!! */ - void (*f)(void) = (void *)0xfff00100; - ppc_mtsrr1(PSL_IP); - ppc_mtsrr0(0); - ppc_mtmsr(PSL_IP); - f(); - } - printf("boot failed, spinning\n"); - while(1) /* forever */; -} - -/* - * Get Ethernet address for the onboard ethernet chip. - */ -int -power4e_get_eth_addr() -{ - int qhandle, phandle; - char name[32]; - - for (qhandle = OF_peer(0); qhandle; qhandle = phandle) { - if (OF_getprop(qhandle, "device_type", name, sizeof name) >= 0 - && !strcmp(name, "network") - && OF_getprop(qhandle, "local-mac-address", - &ofw_eth_addr, sizeof ofw_eth_addr) >= 0) { - return(0); - } - if ((phandle = OF_child(qhandle))) - continue; - while (qhandle) { - if ((phandle = OF_peer(qhandle))) - break; - qhandle = OF_parent(qhandle); - } - } - return(-1); -} - -typedef void (void_f) (void); -void_f *pending_int_f = NULL; - -/* call the bus/interrupt controller specific pending interrupt handler - * would be nice if the offlevel interrupt code was handled here - * instead of being in each of the specific handler code - */ -void -do_pending_int() -{ - if (pending_int_f != NULL) { - (*pending_int_f)(); - } -} - -/* - * set system type from string - */ -void -systype(char *name) -{ - /* this table may be order specific if substrings match several - * computers but a longer string matches a specific - */ - int i; - struct systyp { - char *name; - char *systypename; - int type; - } systypes[] = { - { "MOT", "(PWRSTK) MCG powerstack family", PWRSTK }, - { "V-I Power", "(POWER4e) V-I ppc vme boards ", POWER4e}, - { "iMac", "(APPL) Apple iMac ", APPL}, - { "PowerMac", "(APPL) Apple PowerMac ", APPL}, - { "PowerBook", "(APPL) Apple Powerbook ", APPL}, - { NULL,"",0} - }; - for (i = 0; systypes[i].name != NULL; i++) { - if (strncmp( name , systypes[i].name, - strlen (systypes[i].name)) == 0) - { - system_type = systypes[i].type; - printf("recognized system type of %s as %s\n", - name, systypes[i].systypename); - break; - } - } - if (system_type == OFWMACH) { - printf("System type %snot recognized, good luck\n", - name); - } -} - -/* - * one attempt at interrupt stuff.. - * - */ -#include <dev/pci/pcivar.h> - -int ppc_configed_intr_cnt = 0; -struct intrhand ppc_configed_intr[MAX_PRECONF_INTR]; - -void * -ppc_intr_establish(void *lcv, pci_intr_handle_t ih, int type, int level, - int (*func)(void *), void *arg, char *name) -{ - if (ppc_configed_intr_cnt < MAX_PRECONF_INTR) { - ppc_configed_intr[ppc_configed_intr_cnt].ih_fun = func; - ppc_configed_intr[ppc_configed_intr_cnt].ih_arg = arg; - ppc_configed_intr[ppc_configed_intr_cnt].ih_level = level; - ppc_configed_intr[ppc_configed_intr_cnt].ih_irq = ih; - ppc_configed_intr[ppc_configed_intr_cnt].ih_what = name; - ppc_configed_intr_cnt++; - } else { - panic("ppc_intr_establish called before interrupt controller" - " configured: driver %s too many interrupts", name); - } - /* disestablish is going to be tricky to supported for these :-) */ - return (void *)ppc_configed_intr_cnt; -} - -intr_establish_t *intr_establish_func = (intr_establish_t *)ppc_intr_establish; -intr_disestablish_t *intr_disestablish_func; - -void -ppc_intr_setup(intr_establish_t *establish, intr_disestablish_t *disestablish) -{ - intr_establish_func = establish; - intr_disestablish_func = disestablish; -} - -/* BUS functions */ -int -bus_space_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, - int cacheable, bus_space_handle_t *bshp) -{ - int error; - - if (POWERPC_BUS_TAG_BASE(t) == 0) { - /* if bus has base of 0 fail. */ - return 1; - } - bpa |= POWERPC_BUS_TAG_BASE(t); -#if 0 - if ((error = extent_alloc_region(devio_ex, bpa, size, EX_NOWAIT | - (ppc_malloc_ok ? EX_MALLOCOK : 0)))) - { - return error; - } -#endif - if ((error = bus_mem_add_mapping(bpa, size, cacheable, bshp))) { -#if 0 - if (extent_free(devio_ex, bpa, size, EX_NOWAIT | - (ppc_malloc_ok ? EX_MALLOCOK : 0))) - { - printf("bus_space_map: pa 0x%x, size 0x%x\n", - bpa, size); - printf("bus_space_map: can't free region\n"); - } -#endif - } - return 0; -} -bus_addr_t bus_space_unmap_p(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size); -void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size); -bus_addr_t -bus_space_unmap_p(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size) -{ - bus_addr_t paddr; - - pmap_extract(pmap_kernel(), bsh, &paddr); - bus_space_unmap((t), (bsh), (size)); - return paddr ; -} -void -bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size) -{ - bus_addr_t sva; - bus_size_t off, len; - bus_addr_t bpa; - - /* should this verify that the proper size is freed? */ - sva = trunc_page(bsh); - off = bsh - sva; - len = round_page(size+off); - - if (pmap_extract(pmap_kernel(), sva, &bpa) == TRUE) { -#if 0 - if (extent_free(devio_ex, bpa | (bsh & PAGE_MASK), size, - EX_NOWAIT | (ppc_malloc_ok ? EX_MALLOCOK : 0))) - { - printf("bus_space_map: pa 0x%x, size 0x%x\n", - bpa, size); - printf("bus_space_map: can't free region\n"); - } -#endif - } - /* do not free memory which was stolen from the vm system */ - if (ppc_malloc_ok && - ((sva >= VM_MIN_KERNEL_ADDRESS) && (sva < VM_MAX_KERNEL_ADDRESS)) ) - { - uvm_km_free(phys_map, sva, len); - } else { - for (; len > 0; len -= PAGE_SIZE) { - pmap_kremove_pg(sva); - sva += PAGE_SIZE; - } - pmap_update(pmap_kernel()); - } -} - -vm_offset_t ppc_kvm_stolen = VM_KERN_ADDRESS_SIZE; - -int -bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int cacheable, - bus_space_handle_t *bshp) -{ - bus_addr_t vaddr; - bus_addr_t spa, epa; - bus_size_t off; - int len; - - spa = trunc_page(bpa); - epa = bpa + size; - off = bpa - spa; - len = size+off; - -#if 0 - if (epa <= spa) { - panic("bus_mem_add_mapping: overflow"); - } -#endif - if (ppc_malloc_ok == 0) { - bus_size_t alloc_size; - - /* need to steal vm space before kernel vm is initialized */ - alloc_size = round_page(len); - - vaddr = VM_MIN_KERNEL_ADDRESS + ppc_kvm_stolen; - ppc_kvm_stolen += alloc_size; - if (ppc_kvm_stolen > SEGMENT_LENGTH) { - panic("ppc_kvm_stolen, out of space"); - } - } else { - vaddr = uvm_km_valloc_wait(phys_map, len); - if (vaddr == 0) - panic("bus_mem_add_mapping: kvm alloc of 0x%x failed", - len); - } - *bshp = vaddr + off; -#ifdef DEBUG_BUS_MEM_ADD_MAPPING - printf("mapping %x size %x to %x vbase %x\n", - bpa, size, *bshp, spa); -#endif - for (; len > 0; len -= PAGE_SIZE) { - pmap_kenter_cache(vaddr, spa, - VM_PROT_READ | VM_PROT_WRITE, - cacheable ? PMAP_CACHE_WT : PMAP_CACHE_DEFAULT); - spa += PAGE_SIZE; - vaddr += PAGE_SIZE; - } - return 0; -} - -int -bus_space_alloc(bus_space_tag_t tag, bus_addr_t rstart, bus_addr_t rend, - bus_size_t size, bus_size_t alignment, bus_size_t boundary, int cacheable, - bus_addr_t *addrp, bus_space_handle_t *handlep) -{ - - panic("bus_space_alloc: unimplemented"); -} - -void -bus_space_free(bus_space_tag_t tag, bus_space_handle_t handle, bus_size_t size) -{ - - panic("bus_space_free: unimplemented"); -} - -void * -mapiodev(paddr_t pa, psize_t len) -{ - paddr_t spa; - vaddr_t vaddr, va; - int off; - int size; - - spa = trunc_page(pa); - off = pa - spa; - size = round_page(off+len); - if (ppc_malloc_ok == 0) { - /* need to steal vm space before kernel vm is initialized */ - va = VM_MIN_KERNEL_ADDRESS + ppc_kvm_stolen; - ppc_kvm_stolen += size; - if (ppc_kvm_stolen > SEGMENT_LENGTH) { - panic("ppc_kvm_stolen, out of space"); - } - } else { - va = uvm_km_valloc_wait(phys_map, size); - } - - if (va == 0) - return NULL; - - for (vaddr = va; size > 0; size -= PAGE_SIZE) { - pmap_kenter_cache(vaddr, spa, - VM_PROT_READ | VM_PROT_WRITE, PMAP_CACHE_DEFAULT); - spa += PAGE_SIZE; - vaddr += PAGE_SIZE; - } - return (void *) (va+off); -} - -void -unmapiodev(void *kva, psize_t p_size) -{ - vaddr_t vaddr; - int size; - - size = p_size; - - vaddr = trunc_page((vaddr_t)kva); - - uvm_km_free_wakeup(phys_map, vaddr, size); - - for (; size > 0; size -= PAGE_SIZE) { - pmap_remove(pmap_kernel(), vaddr, vaddr+PAGE_SIZE-1); - vaddr += PAGE_SIZE; - } - pmap_update(pmap_kernel()); -} - - - -/* - * probably should be ppc_space_copy - */ - -#define _CONCAT(A,B) A ## B -#define __C(A,B) _CONCAT(A,B) - -#define BUS_SPACE_COPY_N(BYTES,TYPE) \ -void \ -__C(bus_space_copy_,BYTES)(void *v, bus_space_handle_t h1, \ - bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, \ - bus_size_t c) \ -{ \ - TYPE *src, *dst; \ - int i; \ - \ - src = (TYPE *) (h1+o1); \ - dst = (TYPE *) (h2+o2); \ - \ - if (h1 == h2 && o2 > o1) \ - for (i = c-1; i >= 0; i--) \ - dst[i] = src[i]; \ - else \ - for (i = 0; i < c; i++) \ - dst[i] = src[i]; \ -} -BUS_SPACE_COPY_N(1,u_int8_t) -BUS_SPACE_COPY_N(2,u_int16_t) -BUS_SPACE_COPY_N(4,u_int32_t) - -void -bus_space_set_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - u_int8_t val, bus_size_t c) -{ - u_int8_t *dst; - int i; - - dst = (u_int8_t *) (h+o); - - for (i = 0; i < c; i++) - dst[i] = val; -} - -void -bus_space_set_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - u_int16_t val, bus_size_t c) -{ - u_int16_t *dst; - int i; - - dst = (u_int16_t *) (h+o); - if (t->bus_reverse) - val = swap16(val); - - for (i = 0; i < c; i++) - dst[i] = val; -} -void -bus_space_set_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - u_int32_t val, bus_size_t c) -{ - u_int32_t *dst; - int i; - - dst = (u_int32_t *) (h+o); - if (t->bus_reverse) - val = swap32(val); - - for (i = 0; i < c; i++) - dst[i] = val; -} - -#define BUS_SPACE_READ_RAW_MULTI_N(BYTES,SHIFT,TYPE) \ -void \ -__C(bus_space_read_raw_multi_,BYTES)(bus_space_tag_t bst, \ - bus_space_handle_t h, bus_addr_t o, u_int8_t *dst, bus_size_t size) \ -{ \ - TYPE *src; \ - TYPE *rdst = (TYPE *)dst; \ - int i; \ - int count = size >> SHIFT; \ - \ - src = (TYPE *)(h+o); \ - for (i = 0; i < count; i++) { \ - rdst[i] = *src; \ - __asm__("eieio"); \ - } \ -} -BUS_SPACE_READ_RAW_MULTI_N(2,1,u_int16_t) -BUS_SPACE_READ_RAW_MULTI_N(4,2,u_int32_t) - -#define BUS_SPACE_WRITE_RAW_MULTI_N(BYTES,SHIFT,TYPE) \ -void \ -__C(bus_space_write_raw_multi_,BYTES)( bus_space_tag_t bst, \ - bus_space_handle_t h, bus_addr_t o, const u_int8_t *src, \ - bus_size_t size) \ -{ \ - int i; \ - TYPE *dst; \ - TYPE *rsrc = (TYPE *)src; \ - int count = size >> SHIFT; \ - \ - dst = (TYPE *)(h+o); \ - for (i = 0; i < count; i++) { \ - *dst = rsrc[i]; \ - __asm__("eieio"); \ - } \ -} - -BUS_SPACE_WRITE_RAW_MULTI_N(2,1,u_int16_t) -BUS_SPACE_WRITE_RAW_MULTI_N(4,2,u_int32_t) - -int -bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp) -{ - *nbshp = bsh + offset; - return (0); -} - -int -ppc_open_pci_bridge() -{ - char * - pci_bridges[] = { - "/pci", - NULL - }; - int handle; - int i; - - for (i = 0; pci_bridges[i] != NULL; i++) { - handle = OF_open(pci_bridges[i]); - if ( handle != -1) { - return handle; - } - } - return 0; -} -void -ppc_close_pci_bridge(int handle) -{ - OF_close(handle); -} - -/* bcopy(), error on fault */ -int -kcopy(const void *from, void *to, size_t size) -{ - faultbuf env; - void *oldh = curproc->p_addr->u_pcb.pcb_onfault; - - if (setfault(&env)) { - curproc->p_addr->u_pcb.pcb_onfault = oldh; - return EFAULT; - } - bcopy(from, to, size); - curproc->p_addr->u_pcb.pcb_onfault = oldh; - - return 0; -} - -void -nameinterrupt(int replace, char *newstr) -{ -#define NENTRIES 66 - char intrname[NENTRIES][30]; - char *p, *src; - int i; - extern char intrnames[]; - extern char eintrnames[]; - - if (replace >= NENTRIES) { - return; - } - src = intrnames; - - for (i = 0; i < NENTRIES; i++) { - src += strlcpy(intrname[i], src, 30); - src+=1; /* skip the NUL */ - } - - strlcat(intrname[replace], "/", sizeof intrname[replace]); - strlcat(intrname[replace], newstr, sizeof intrname[replace]); - - p = intrnames; - for (i = 0; i < NENTRIES; i++) { - p += strlcpy(p, intrname[i], eintrnames - p); - p += 1; /* skip the NUL */ - } -} diff --git a/sys/arch/pegasos/pegasos/mainbus.c b/sys/arch/pegasos/pegasos/mainbus.c deleted file mode 100644 index 00c9c19e5c3..00000000000 --- a/sys/arch/pegasos/pegasos/mainbus.c +++ /dev/null @@ -1,161 +0,0 @@ -/* $OpenBSD: mainbus.c,v 1.2 2004/02/04 20:07:18 drahn Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> -#include <sys/reboot.h> - -#include <machine/autoconf.h> -#include <dev/ofw/openfirm.h> - -struct mainbus_softc { - struct device sc_dv; - struct bushook sc_bus; -}; - -/* Definition of the mainbus driver. */ -static int mbmatch(struct device *, void *, void *); -static void mbattach(struct device *, struct device *, void *); -static int mbprint(void *, const char *); - -struct cfattach mainbus_ca = { - sizeof(struct mainbus_softc), mbmatch, mbattach -}; -struct cfdriver mainbus_cd = { - NULL, "mainbus", DV_DULL, NULL, 0 -}; - -void mb_intr_establish(struct confargs *, int (*)(void *), void *); -void mb_intr_disestablish(struct confargs *); -caddr_t mb_cvtaddr(struct confargs *); -int mb_matchname(struct confargs *, char *); - -/*ARGSUSED*/ -static int -mbmatch(struct device *parent, void *cfdata, void *aux) -{ - - /* - * That one mainbus is always here. - */ - return(1); -} - -static void -mbattach(struct device *parent, struct device *self, void *aux) -{ - struct mainbus_softc *sc = (struct mainbus_softc *)self; - struct confargs nca; - extern int system_type; - - printf("\n"); - - sc->sc_bus.bh_dv = (struct device *)sc; - sc->sc_bus.bh_type = BUS_MAIN; - sc->sc_bus.bh_intr_establish = mb_intr_establish; - sc->sc_bus.bh_intr_disestablish = mb_intr_disestablish; - sc->sc_bus.bh_matchname = mb_matchname; - - /* - * Try to find and attach all of the CPUs in the machine. - * ( Right now only one CPU so code is simple ) - */ - - nca.ca_name = "cpu"; - nca.ca_bus = &sc->sc_bus; - config_found(self, &nca, mbprint); - - /* Set up Openfirmware.*/ - if (system_type != POWER4e) { /* for now */ - nca.ca_name = "ofroot"; - nca.ca_bus = &sc->sc_bus; - config_found(self, &nca, mbprint); - } - - /* The following machines have a PCI bus */ - if (system_type == APPL) { - char name[32]; - int node; - for (node = OF_child(OF_peer(0)); node; node=OF_peer(node)) { - bzero (name, sizeof(name)); - if (OF_getprop(node, "device_type", name, - sizeof(name)) <= 0) { - if (OF_getprop(node, "name", name, - sizeof(name)) <= 0) - printf ("name not found on node %x\n", - node); - continue; - } - if (strcmp(name, "pci") == 0) { - nca.ca_name = "mpcpcibr"; - nca.ca_node = node; - nca.ca_bus = &sc->sc_bus; - config_found(self, &nca, mbprint); - } - } - } else if (system_type != OFWMACH) { - nca.ca_name = "mpcpcibr"; - nca.ca_bus = &sc->sc_bus; - nca.ca_node = OF_finddevice("/pci"); - config_found(self, &nca, mbprint); - } -} - -static int -mbprint(void *aux, const char *pnp) -{ - if (pnp) - return (QUIET); - return (UNCONF); -} - -void -mb_intr_establish(struct confargs *ca, int (*handler)(void *), void *val) -{ - panic("can never mb_intr_establish"); -} - -void -mb_intr_disestablish(struct confargs *ca) -{ - panic("can never mb_intr_disestablish"); -} - -caddr_t -mb_cvtaddr(struct confargs *ca) -{ - return (NULL); -} - -int -mb_matchname(struct confargs *ca, char *name) -{ - return (strcmp(name, ca->ca_name) == 0); -} diff --git a/sys/arch/pegasos/pegasos/mbrdisksubr.c b/sys/arch/pegasos/pegasos/mbrdisksubr.c deleted file mode 100644 index b33adf2917a..00000000000 --- a/sys/arch/pegasos/pegasos/mbrdisksubr.c +++ /dev/null @@ -1,208 +0,0 @@ -/* $OpenBSD: mbrdisksubr.c,v 1.2 2003/12/20 22:40:15 miod Exp $ */ -/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ - -/* - * Copyright (c) 1996 Theo de Raadt - * Copyright (c) 1982, 1986, 1988 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/buf.h> -#include <sys/device.h> -#include <sys/disklabel.h> -#include <sys/syslog.h> -#include <sys/disk.h> - -#define b_cylin b_resid - -#define BOOT_MAGIC 0xAA55 -#define BOOT_MAGIC_OFF (DOSPARTOFF+NDOSPART*sizeof(struct dos_partition)) - -int -try_mbr_label(dev_t dev, void (*strat)(struct buf *), struct buf *bp, - struct disklabel *lp, struct cpu_disklabel *osdep, char **pmsg, - int *bsdpartoff); -int -try_mbr_label(dev_t dev, void (*strat)(struct buf *), struct buf *bp, - struct disklabel *lp, struct cpu_disklabel *osdep, char **pmsg, - int *bsdpartoff) -{ - struct dos_partition *dp = osdep->dosparts, *dp2; - char *cp; - int cyl, n = 0, i, ourpart = -1; - int dospartoff = -1; - - /* MBR type disklabel */ - /* do dos partitions in the process of getting disklabel? */ - cyl = LABELSECTOR / lp->d_secpercyl; - if (dp) { - daddr_t part_blkno = DOSBBSECTOR; - unsigned long extoff = 0; - int wander = 1, loop = 0; - - /* - * Read dos partition table, follow extended partitions. - * Map the partitions to disklabel entries i-p - */ - while (wander && n < 8 && loop < 8) { - loop++; - wander = 0; - if (part_blkno < extoff) - part_blkno = extoff; - - /* read boot record */ - bp->b_blkno = part_blkno; - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ; - bp->b_cylin = part_blkno / lp->d_secpercyl; - (*strat)(bp); - - /* if successful, wander through dos partition table */ - if (biowait(bp)) { - *pmsg = "dos partition I/O error"; - return 0; - } - bcopy(bp->b_data + DOSPARTOFF, dp, NDOSPART * sizeof(*dp)); - - if (ourpart == -1) { - /* Search for our MBR partition */ - for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; - i++, dp2++) - if (get_le(&dp2->dp_size) && - dp2->dp_typ == DOSPTYP_OPENBSD) - ourpart = i; - for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; - i++, dp2++) - if (get_le(&dp2->dp_size) && - dp2->dp_typ == DOSPTYP_FREEBSD) - ourpart = i; - for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; - i++, dp2++) - if (get_le(&dp2->dp_size) && - dp2->dp_typ == DOSPTYP_NETBSD) - ourpart = i; - if (ourpart == -1) - goto donot; - /* - * This is our MBR partition. need sector address - * for SCSI/IDE, cylinder for ESDI/ST506/RLL - */ - dp2 = &dp[ourpart]; - dospartoff = get_le(&dp2->dp_start) + part_blkno; - cyl = DPCYL(dp2->dp_scyl, dp2->dp_ssect); - - /* XXX build a temporary disklabel */ - lp->d_partitions[0].p_size = get_le(&dp2->dp_size); - lp->d_partitions[0].p_offset = - get_le(&dp2->dp_start) + part_blkno; - if (lp->d_ntracks == 0) - lp->d_ntracks = dp2->dp_ehd + 1; - if (lp->d_nsectors == 0) - lp->d_nsectors = DPSECT(dp2->dp_esect); - if (lp->d_secpercyl == 0) - lp->d_secpercyl = lp->d_ntracks * - lp->d_nsectors; - } -donot: - /* - * In case the disklabel read below fails, we want to - * provide a fake label in i-p. - */ - for (dp2=dp, i=0; i < NDOSPART && n < 8; i++, dp2++) { - struct partition *pp = &lp->d_partitions[8+n]; - - if (dp2->dp_typ == DOSPTYP_OPENBSD) - continue; - if (get_le(&dp2->dp_size) > lp->d_secperunit) - continue; - if (get_le(&dp2->dp_size)) - pp->p_size = get_le(&dp2->dp_size); - if (get_le(&dp2->dp_start)) - pp->p_offset = - get_le(&dp2->dp_start) + part_blkno; - - switch (dp2->dp_typ) { - case DOSPTYP_UNUSED: - for (cp = (char *)dp2; - cp < (char *)(dp2 + 1); cp++) - if (*cp) - break; - /* - * Was it all zeroes? If so, it is - * an unused entry that we don't - * want to show. - */ - if (cp == (char *)(dp2 + 1)) - continue; - lp->d_partitions[8 + n++].p_fstype = - FS_UNUSED; - break; - - case DOSPTYP_LINUX: - pp->p_fstype = FS_EXT2FS; - n++; - break; - - case DOSPTYP_FAT12: - case DOSPTYP_FAT16S: - case DOSPTYP_FAT16B: - case DOSPTYP_FAT16C: - case DOSPTYP_FAT32: - pp->p_fstype = FS_MSDOS; - n++; - break; - case DOSPTYP_EXTEND: - case DOSPTYP_EXTENDL: - part_blkno = get_le(&dp2->dp_start) + extoff; - if (!extoff) { - extoff = get_le(&dp2->dp_start); - part_blkno = 0; - } - wander = 1; - break; - default: - pp->p_fstype = FS_OTHER; - n++; - break; - } - } - } - lp->d_bbsize = 8192; - lp->d_sbsize = 64*1024; /* XXX ? */ - lp->d_npartitions = MAXPARTITIONS; - } - - /* if not partitions found return failure */ - if (n == 0 && dospartoff == -1) - return 0; - *bsdpartoff = dospartoff + LABELSECTOR; - return 1; -} diff --git a/sys/arch/pegasos/pegasos/mem.c b/sys/arch/pegasos/pegasos/mem.c deleted file mode 100644 index e1cbe87cca4..00000000000 --- a/sys/arch/pegasos/pegasos/mem.c +++ /dev/null @@ -1,187 +0,0 @@ -/* $OpenBSD: mem.c,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* $NetBSD: mem.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1982, 1986, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)mem.c 8.3 (Berkeley) 1/12/94 - */ - -/* - * Memory special file - */ - -#include <sys/param.h> -#include <sys/buf.h> -#include <sys/systm.h> -#include <sys/ioccom.h> -#include <sys/uio.h> -#include <sys/malloc.h> -#include <sys/types.h> - -#include <machine/cpu.h> - -#include <uvm/uvm_extern.h> - -#include <machine/conf.h> - -/* open counter for aperture */ -#ifdef APERTURE -static int ap_open_count = 0; -extern int allowaperture; -#endif - -/*ARGSUSED*/ -int -mmopen(dev_t dev, int flag, int mode, struct proc *p) -{ - - switch (minor(dev)) { - case 0: - case 1: - case 2: - case 12: - break; -#ifdef APERTURE - case 4: - if (suser(p, 0) != 0 || !allowaperture) - return (EPERM); - - /* authorize only one simultaneous open() */ - if (ap_open_count > 0) - return(EPERM); - ap_open_count++; - break; -#endif - default: - return (ENXIO); - } - return (0); -} - -/*ARGSUSED*/ -int -mmclose(dev_t dev, int flag, int mode, struct proc *p) -{ -#ifdef APERTURE - if (minor(dev) == 4) - ap_open_count--; -#endif - return 0; -} - -/*ARGSUSED*/ -int -mmrw(dev_t dev, struct uio *uio, int flags) -{ - vm_offset_t v; - vm_size_t c; - struct iovec *iov; - int error = 0; - static caddr_t zeropage; - - while (uio->uio_resid > 0 && error == 0) { - iov = uio->uio_iov; - if (iov->iov_len == 0) { - uio->uio_iov++; - uio->uio_iovcnt--; - if (uio->uio_iovcnt < 0) - panic("mmrw"); - continue; - } - switch (minor(dev)) { - - /* minor device 0 is physical memory */ - case 0: - v = uio->uio_offset; - c = uio->uio_resid; - /* This doesn't allow device mapping! XXX */ - pmap_real_memory(&v, &c); - error = uiomove((caddr_t)v, c, uio); - continue; - - /* minor device 1 is kernel memory */ - case 1: - v = uio->uio_offset; - c = min(iov->iov_len, MAXPHYS); - error = uiomove((caddr_t)v, c, uio); - continue; - - /* minor device 2 is EOF/RATHOLE */ - case 2: - if (uio->uio_rw == UIO_WRITE) - uio->uio_resid = 0; - return 0; - - /* minor device 12 (/dev/zero) is source of nulls on read, - * rathole on write - */ - case 12: - if (uio->uio_rw == UIO_WRITE) { - c = iov->iov_len; - break; - } - if (zeropage == NULL) { - zeropage = (caddr_t)malloc(PAGE_SIZE, M_TEMP, - M_WAITOK); - bzero(zeropage, PAGE_SIZE); - } - c = min(iov->iov_len, PAGE_SIZE); - error = uiomove(zeropage, c, uio); - continue; - - default: - return ENXIO; - } - if (error) - break; - iov->iov_base += c; - iov->iov_len -= c; - uio->uio_offset += c; - uio->uio_resid -= c; - } - return error; -} - -paddr_t -mmmmap(dev_t dev, off_t off, int prot) -{ - return (-1); -} - -/*ARGSUSED*/ -int -mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - return (EOPNOTSUPP); -} diff --git a/sys/arch/pegasos/pegasos/ofw_machdep.c b/sys/arch/pegasos/pegasos/ofw_machdep.c deleted file mode 100644 index 4ae397d2f6b..00000000000 --- a/sys/arch/pegasos/pegasos/ofw_machdep.c +++ /dev/null @@ -1,723 +0,0 @@ - /* $OpenBSD: ofw_machdep.c,v 1.2 2004/02/04 20:07:18 drahn Exp $ */ -/* $NetBSD: ofw_machdep.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ - -/* - * Copyright (C) 1996 Wolfgang Solfrank. - * Copyright (C) 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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/buf.h> -#include <sys/conf.h> -#include <sys/device.h> -#include <sys/disk.h> -#include <sys/disklabel.h> -#include <sys/fcntl.h> -#include <sys/ioctl.h> -#include <sys/malloc.h> -#include <sys/stat.h> -#include <sys/systm.h> - -#include <uvm/uvm_extern.h> - -#include <machine/powerpc.h> -#include <machine/autoconf.h> - -#include <dev/ofw/openfirm.h> - -#include <pegasos/pegasos/ofw_machdep.h> - -#include <ukbd.h> -#include <dev/usb/ukbdvar.h> - -/* XXX, called from asm */ -int save_ofw_mapping(void); -int restore_ofw_mapping(void); -void ofw_remove_mem(struct mem_region *mem, paddr_t base, paddr_t end); - -void OF_exit(void) __attribute__((__noreturn__)); -void OF_boot(char *bootspec); -void ofw_mem_regions(struct mem_region **memp, struct mem_region **availp); -void ofw_vmon(void); - -struct firmware ofw_firmware = { - ofw_mem_regions, - OF_exit, - OF_boot, - ofw_vmon -#ifdef FW_HAS_PUTC - ofwcnputc; -#endif -}; - -#define OFMEM_REGIONS 32 -static struct mem_region OFmem[OFMEM_REGIONS + 1], OFavail[OFMEM_REGIONS + 3]; -static struct mem_region OFclaimed[OFMEM_REGIONS + 1]; - -/* - * This is called during initppc, before the system is really initialized. - * It shall provide the total and the available regions of RAM. - * Both lists must have a zero-size entry as terminator. - * The available regions need not take the kernel into account, but needs - * to provide space for two additional entry beyond the terminating one. - */ - -/* remove a given region from avail memory */ -void -ofw_remove_mem(struct mem_region *mem, paddr_t base, paddr_t end) -{ - struct mem_region *mp; - int i; - int mpend; - int cnt_avail; - - cnt_avail = 0; - for (mp = mem; mp->size; mp++) - cnt_avail++; - - /* remove given region from available */ - for (mp = mem; mp->size; mp++) { - /* - * Check if this region hold all of the region - */ - mpend = mp->start + mp->size; - if (base > mpend) { - continue; - } - if (base <= mp->start) { - if (end <= mp->start) - break; /* region not present -??? */ - - if (end >= mpend) { - /* covers whole region */ - /* shorten */ - for (i = mp - mem; - i < cnt_avail; - i++) { - mem[i] = mem[i+1]; - } - cnt_avail--; - mem[cnt_avail].size = 0; - } else { - mp->start = end; - mp->size = mpend - end; - } - } else { - /* start after the beginning */ - if (end >= mpend) { - /* just truncate */ - mp->size = base - mp->start; - } else { - /* split */ - for (i = cnt_avail; - i > (mp - mem); - i--) { - mem[i] = mem[i - 1]; - } - cnt_avail++; - mp->size = base - mp->start; - mp++; - mp->start = end; - mp->size = mpend - end; - } - } - } -} - -void -ofw_mem_regions(struct mem_region **memp, struct mem_region **availp) -{ - int phandle; - int i; - void * OF_claim(uint32_t, uint32_t, uint32_t); /* XXX */ - u_int32_t end; - void *val; - int b; - - /* - * Get memory. - */ - if ((phandle = OF_finddevice("/memory")) == -1 - || OF_getprop(phandle, "reg", - OFmem, sizeof OFmem[0] * OFMEM_REGIONS) - <= 0 - || OF_getprop(phandle, "available", - OFavail, sizeof OFavail[0] * OFMEM_REGIONS) - <= 0) - panic("no memory?"); - *memp = OFmem; - *availp = OFavail; - - for (i = 0; OFavail[i].size != 0; i++) { - end = OFavail[i].start + OFavail[i].size; - - end &= ~PAGE_MASK; - OFavail[i].start += PAGE_MASK; - OFavail[i].start &= ~PAGE_MASK; - OFavail[i].size = end - OFavail[i].start; - /* XXX - what if this zeros an entry... */ - } - - /* - * Ok, we dont want to use memory which OFW uses but leaves - * in avail (Peg I). - */ - ofw_remove_mem(OFavail, 0, 16 * 1024 * 1024); - /* the last 3 meg too */ - { - struct mem_region *mp; - paddr_t last_avail = 0; - paddr_t a; - for (mp = OFavail; mp->size !=0; mp++) { - a = mp->start + mp->size; - if (last_avail < a) - last_avail = a; - } - if ((last_avail & 3*1024*1024) == 0) - ofw_remove_mem(OFavail, last_avail - 3*1024*1024, - last_avail); - - } - - - - /* claim 'avail' memory from openfirmware */ - b = 0; - for (i = 0; OFavail[i].size != 0; i++) { - val = OF_claim(OFavail[i].start, OFavail[i].size, 0); - if (val == (void *)0xffffffff) { - /* ugh */ - } else { - OFclaimed[b] = OFavail[i]; - b++; - } - } - *availp = OFclaimed; - -} - -typedef void (fwcall_f)(int, int); -extern fwcall_f *fwcall; -fwcall_f fwentry; -extern u_int32_t ofmsr; - -void -ofw_vmon() -{ - fwcall = &fwentry; -} - -int OF_stdout; -int OF_stdin; - -/* code to save and create the necessary mappings for BSD to handle - * the vm-setup for OpenFirmware - */ -static int N_mapping; -static struct { - vm_offset_t va; - int len; - vm_offset_t pa; - int mode; -} ofw_mapping[256]; -int -save_ofw_mapping() -{ - int mmui, mmu; - int chosen; - int stdout, stdin; - if ((chosen = OF_finddevice("/chosen")) == -1) { - return 0; - } - - if (OF_getprop(chosen, "stdin", &stdin, sizeof stdin) != sizeof stdin) { - return 0; - } - OF_stdin = stdin; - if (OF_getprop(chosen, "stdout", &stdout, sizeof stdout) - != sizeof stdout) { - return 0; - } - if (stdout == 0) { - /* If the screen is to be console, but not active, open it */ - stdout = OF_open("screen"); - } - OF_stdout = stdout; - - chosen = OF_finddevice("/chosen"); - - OF_getprop(chosen, "mmu", &mmui, 4); - mmu = OF_instance_to_package(mmui); - bzero(ofw_mapping, sizeof(ofw_mapping)); - - N_mapping = OF_getprop(mmu, "translations", ofw_mapping, - sizeof(ofw_mapping)); - N_mapping /= sizeof(ofw_mapping[0]); - - fw = &ofw_firmware; - fwcall = &fwentry; - return 0; -} - -struct pmap ofw_pmap; -int -restore_ofw_mapping() -{ - int i; - - pmap_pinit(&ofw_pmap); - - ofw_pmap.pm_sr[KERNEL_SR] = KERNEL_SEGMENT; - - for (i = 0; i < N_mapping; i++) { - vm_offset_t pa = ofw_mapping[i].pa; - vm_offset_t va = ofw_mapping[i].va; - int size = ofw_mapping[i].len; - - if (va < 0xf8000000) /* XXX */ - continue; - - while (size > 0) { - pmap_enter(&ofw_pmap, va, pa, VM_PROT_ALL, PMAP_WIRED); - pa += NBPG; - va += NBPG; - size -= NBPG; - } - } - pmap_update(pmap_kernel()); - - return 0; -} - -typedef void (void_f) (void); -extern void_f *pending_int_f; -void ofw_do_pending_int(void); -extern int system_type; - -void ofw_intr_init(void); - -void -ofrootfound() -{ - int node; - struct ofprobe probe; - - if (!(node = OF_peer(0))) - panic("No PROM root"); - probe.phandle = node; - if (!config_rootfound("ofroot", &probe)) - panic("ofroot not configured"); - if (system_type == OFWMACH) { - pending_int_f = ofw_do_pending_int; - ofw_intr_init(); - } -} - -void -ofw_intr_establish() -{ - if (system_type == OFWMACH) { - pending_int_f = ofw_do_pending_int; - ofw_intr_init(); - } -} - -void -ofw_intr_init() -{ - /* - * There are tty, network and disk drivers that use free() at interrupt - * time, so imp > (tty | net | bio). - */ - /* with openfirmware drivers all levels block clock - * (have to block polling) - */ - imask[IPL_IMP] = SPL_CLOCK; - imask[IPL_TTY] = SPL_CLOCK | SINT_TTY; - imask[IPL_NET] = SPL_CLOCK | SINT_NET; - imask[IPL_BIO] = SPL_CLOCK; - imask[IPL_IMP] |= imask[IPL_TTY] | imask[IPL_NET] | imask[IPL_BIO]; - - /* - * Enforce a hierarchy that gives slow devices a better chance at not - * dropping data. - */ - imask[IPL_TTY] |= imask[IPL_NET] | imask[IPL_BIO]; - imask[IPL_NET] |= imask[IPL_BIO]; - - /* - * These are pseudo-levels. - */ - imask[IPL_NONE] = 0x00000000; - imask[IPL_HIGH] = 0xffffffff; - -} - -void -ofw_do_pending_int() -{ - int pcpl; - int s; - - static int processing; - - if(processing) - return; - - processing = 1; - s = ppc_intr_disable(); - - pcpl = splhigh(); /* Turn off all */ - if((ipending & SINT_CLOCK) && ((pcpl & imask[IPL_CLOCK]) == 0)) { - ipending &= ~SINT_CLOCK; - softclock(); - } - if((ipending & SINT_NET) && ((pcpl & imask[IPL_NET]) == 0) ) { - extern int netisr; - int pisr = netisr; - netisr = 0; - ipending &= ~SINT_NET; - softnet(pisr); - } - ipending &= pcpl; - cpl = pcpl; /* Don't use splx... we are here already! */ - ppc_intr_enable(s); - processing = 0; -} - -#if NVGAFB_PCI > 0 -#include <dev/pci/pcivar.h> -#include <arch/macppc/pci/vgafb_pcivar.h> -static pcitag_t ofw_make_tag( void *cpv, int bus, int dev, int fnc); - -/* ARGSUSED */ -static pcitag_t -ofw_make_tag(void *cpv, int bus, int dev, int fnc) -{ - return (bus << 16) | (dev << 11) | (fnc << 8); -} -#endif - -#define OFW_PCI_PHYS_HI_BUSMASK 0x00ff0000 -#define OFW_PCI_PHYS_HI_BUSSHIFT 16 -#define OFW_PCI_PHYS_HI_DEVICEMASK 0x0000f800 -#define OFW_PCI_PHYS_HI_DEVICESHIFT 11 -#define OFW_PCI_PHYS_HI_FUNCTIONMASK 0x00000700 -#define OFW_PCI_PHYS_HI_FUNCTIONSHIFT 8 - -#define pcibus(x) \ - (((x) & OFW_PCI_PHYS_HI_BUSMASK) >> OFW_PCI_PHYS_HI_BUSSHIFT) -#define pcidev(x) \ - (((x) & OFW_PCI_PHYS_HI_DEVICEMASK) >> OFW_PCI_PHYS_HI_DEVICESHIFT) -#define pcifunc(x) \ - (((x) & OFW_PCI_PHYS_HI_FUNCTIONMASK) >> OFW_PCI_PHYS_HI_FUNCTIONSHIFT) - - -struct ppc_bus_space ppc_membus; -int cons_displaytype=0; -bus_space_tag_t cons_membus = &ppc_membus; -bus_space_handle_t cons_display_mem_h; -bus_space_handle_t cons_display_ctl_h; -int cons_height, cons_width, cons_linebytes, cons_depth; -int cons_display_ofh; -u_int32_t cons_addr; -int cons_brightness; -int cons_backlight_available; - -#include "vgafb_pci.h" - -struct usb_kbd_ihandles { - struct usb_kbd_ihandles *next; - int ihandle; -}; - - -u_int32_t ppc_console_addr; -struct ppc_bus_space *ppc_isa_iobus_space; -struct ppc_bus_space *ppc_isa_membus_space; -struct ppc_bus_space *ppc_display_isa_iobus_space; -struct ppc_bus_space *ppc_display_isa_membus_space; -struct ppc_bus_space ppc_agp_isa_iobus_store; -struct ppc_bus_space ppc_agp_isa_membus_store; - -extern int comdefaultrate; -extern int pegasos; -int ppc_agpconsole; - -void -ofwconprobe() -{ - char type[32]; - int stdout_node; - char path[128]; - int len; - char name[32]; - int display; - - ppc_agpconsole = 0; - - stdout_node = OF_instance_to_package(OF_stdout); - - ppc_isa_iobus_space = &ppc_isa_io; - ppc_isa_iobus_space->bus_base = 0xfe000000; - ppc_isa_iobus_space->bus_reverse = 1; - ppc_isa_iobus_space->bus_io = 1; - ppc_isa_iobus_space->bus_size = 0x01000000; - ppc_isa_membus_space = &ppc_isa_mem; - ppc_isa_membus_space->bus_base = 0xfd000000; - ppc_isa_membus_space->bus_size = 0x01000000; - ppc_isa_membus_space->bus_reverse = 1; - - - /* handle different types of console */ - - bzero(type, sizeof(type)); - if (OF_getprop(stdout_node, "device_type", type, sizeof(type)) == -1) { - return; /* XXX */ - } - - len = OF_package_to_path(stdout_node, path, sizeof path); - path[len] = 0; - printf("console path [%s] type [%s]\n", path, type); - - if (strcmp(path, "/failsafe") == 0) { - ppc_console_addr = 0x2f8; - - /* failsafe serial console, at firmware dbg speed */ - comdefaultrate = 115200; - return; - } - if (strcmp(type, "serial") == 0) { - /* XXX */ - ppc_console_addr = 0x2f8; - comdefaultrate = 9600; - return; - } - - len = OF_getprop(stdout_node, "name", name, 20); - name[len] = 0; - printf("console out [%s]\n", name); - - display = OF_finddevice("/display"); - if (display != -1 && display != 0) { - len = OF_package_to_path(display, path, sizeof path); - path[len] = 0; - printf("display path [%s]\n", path); - if (strncmp(path, "/pci@C0000000", 12) == 0) - ppc_agpconsole = 1; - } - - /* - * Initialize the early bus_space values to - * correct values for Pegasos I - */ - if (pegasos == 2 && ppc_agpconsole) { - ppc_display_isa_iobus_space = &ppc_agp_isa_iobus_store; - ppc_display_isa_membus_space = &ppc_agp_isa_membus_store; - - ppc_display_isa_iobus_space->bus_base = 0xf8000000; - ppc_display_isa_iobus_space->bus_reverse = 1; - ppc_display_isa_iobus_space->bus_io = 1; - ppc_display_isa_iobus_space->bus_size = 0x01000000; - ppc_display_isa_membus_space->bus_base = 0xf9000000; - ppc_display_isa_membus_space->bus_size = 0x01000000; - ppc_display_isa_membus_space->bus_reverse = 1; - } else { - ppc_display_isa_iobus_space = &ppc_isa_io; - ppc_display_isa_membus_space = &ppc_isa_mem; - } - if (strcmp(type, "bootconsole") == 0) { - /* pegasos unknown console, */ - /* which is set up already */ - - ppc_console_addr = 0x2f8; - ppc_console_addr = 0; - - /* if we end up with serial console, do firmware dbg speed */ - comdefaultrate = 115200; - return; - } - - /* dunno */ - - return; -} - -#define DEVTREE_UNKNOWN 0 -#define DEVTREE_USB 1 -#define DEVTREE_ADB 2 -#define DEVTREE_HID 3 -int ofw_devtree = DEVTREE_UNKNOWN; - -#define OFW_HAVE_USBKBD 1 -#define OFW_HAVE_ADBKBD 2 -int ofw_have_kbd = 0; - -void ofw_recurse_keyboard(int pnode); -void ofw_find_keyboard(void); - -void -ofw_recurse_keyboard(int pnode) -{ - char name[32]; - int old_devtree; - int len; - int node; - - for (node = OF_child(pnode); node != 0; node = OF_peer(node)) { - - len = OF_getprop(node, "name", name, 20); - if (len == 0) - continue; - name[len] = 0; - if (strcmp(name, "keyboard") == 0) { - /* found a keyboard node, where is it? */ - if (ofw_devtree == DEVTREE_USB) { - ofw_have_kbd |= OFW_HAVE_USBKBD; - } else if (ofw_devtree == DEVTREE_ADB) { - ofw_have_kbd |= OFW_HAVE_ADBKBD; - } else { - /* hid or some other keyboard? igore */ - } - continue; - } - - old_devtree = ofw_devtree; - - if (strcmp(name, "adb") == 0) { - ofw_devtree = DEVTREE_ADB; - } - if (strcmp(name, "usb") == 0) { - ofw_devtree = DEVTREE_USB; - } - - ofw_recurse_keyboard(node); - - ofw_devtree = old_devtree; /* nest? */ - } -} - -void -ofw_find_keyboard() -{ - int stdin_node; - char iname[32]; - int len; - - stdin_node = OF_instance_to_package(OF_stdin); - len = OF_getprop(stdin_node, "name", iname, 20); - iname[len] = 0; - printf("console in [%s] ", iname); - - /* GRR, apple removed the interface once used for keyboard - * detection walk the OFW tree to find keyboards and what type. - */ - - ofw_recurse_keyboard(OF_peer(0)); - - if (ofw_have_kbd == 0) { - printf("no keyboard found, hoping USB will be present\n"); -#if NUKBD > 0 - ukbd_cnattach(); -#endif - } - - if (ofw_have_kbd == (OFW_HAVE_USBKBD|OFW_HAVE_ADBKBD)) { -#if NUKBD > 0 - printf("USB and ADB found, using USB\n"); - ukbd_cnattach(); -#else - ofw_have_kbd = OFW_HAVE_ADBKBD; /* ??? */ -#endif - } - if (ofw_have_kbd == OFW_HAVE_USBKBD) { -#if NUKBD > 0 - printf("USB found\n"); - ukbd_cnattach(); -#endif - } -} - - -#include <dev/cons.h> - -cons_decl(ofw); - -/* - * Console support functions - */ -void -ofwcnprobe(struct consdev *cd) -{ - cd->cn_pri = CN_DEAD; -} - -void -ofwcninit(struct consdev *cd) -{ -} -void -ofwcnputc(dev_t dev, int c) -{ - char ch = c; - - OF_write(OF_stdout, &ch, 1); -} -int -ofwcngetc(dev_t dev) -{ - unsigned char ch = '\0'; - int l; - - while ((l = OF_read(OF_stdin, &ch, 1)) != 1) - if (l != -2 && l != 0) - return -1; - return ch; -} - -void -ofwcnpollc(dev_t dev, int on) -{ -} - -struct consdev consdev_ofw = { - ofwcnprobe, - ofwcninit, - ofwcngetc, - ofwcnputc, - ofwcnpollc, - NULL, -}; - -void -ofwconsinit() -{ - struct consdev *cp; - cp = &consdev_ofw; - cn_tab = cp; -} diff --git a/sys/arch/pegasos/pegasos/ofw_machdep.h b/sys/arch/pegasos/pegasos/ofw_machdep.h deleted file mode 100644 index a66af7e4b44..00000000000 --- a/sys/arch/pegasos/pegasos/ofw_machdep.h +++ /dev/null @@ -1,55 +0,0 @@ -/* $OpenBSD: ofw_machdep.h,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ - -/* - * Copyright (c) 2002, Miodrag Vallat. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* - * Various console variables... - */ -extern int cons_displaytype; -extern bus_space_tag_t cons_membus; -extern bus_space_handle_t cons_display_mem_h; -extern bus_space_handle_t cons_display_ctl_h; -extern int cons_height, cons_width, cons_linebytes, cons_depth; -extern int cons_display_ofh; -extern u_int32_t cons_addr; -extern int cons_backlight_available; - -void ofwconprobe(void); -void ofwconsinit(void); - -/* - * For some reason, setting the brightness under 0x29 from OF switches the - * backlight off, and it won't be switched on again until you set the - * brightness above 0x33. All hail hysteresis! -- miod - */ -#define MIN_BRIGHTNESS 0x34 -#define MAX_BRIGHTNESS 0xff -#define STEP_BRIGHTNESS 8 -#define DEFAULT_BRIGHTNESS 0x80 -extern int cons_brightness; - -void of_setbrightness(int); diff --git a/sys/arch/pegasos/pegasos/ofwreal.S b/sys/arch/pegasos/pegasos/ofwreal.S deleted file mode 100644 index ed7cea57b6d..00000000000 --- a/sys/arch/pegasos/pegasos/ofwreal.S +++ /dev/null @@ -1,449 +0,0 @@ -/* $OpenBSD: ofwreal.S,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* $NetBSD: ofwreal.S,v 1.1 1996/09/30 16:34:51 ws Exp $ */ - -/* - * Copyright (C) 1996 Wolfgang Solfrank. - * Copyright (C) 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This file provides a real-mode client interface on machines, that - * (incorrectly) only implement virtual mode client interface. - * - * It assumes though, that any actual memory in the machine is - * mapped 1:1 even by the virtual mode OpenFirmware. - * Furthermore it assumes that addresses returned by OpenFirmware are not - * accessed by the client. - * - */ -#include <machine/asm.h> -#include <machine/psl.h> -#include <machine/trap.h> -#include <machine/param.h> - -#define CACHELINE 32 /* Note that this value is really hardwired */ - - .data -ofentry: .long 0 /* actual entry to firmware in virtual mode */ - -#define SRSIZE (16*4+4) -#define SPRGSIZE (4*4) -#define SDR1SIZE 4 -#define MSRSIZE 4 -#define SVSIZE (SRSIZE+SPRGSIZE+SDR1SIZE+MSRSIZE) -#define BATSIZE (16*4) - - .global _C_LABEL(fwcall) -_C_LABEL(fwcall): .long 0 - -.lcomm fwsave,SVSIZE,8 -.lcomm fwbatsave,BATSIZE,8 -.lcomm clsave,SVSIZE,8 -.lcomm clbatsave,BATSIZE,8 -.lcomm ofsrsave,16*4,4 /* 16 words of 4 bytes to store OF segment registers */ -.lcomm srsave,16*4,4 /* 16 words of 4 bytes to swap OF segment registers*/ - .globl _C_LABEL(ofmsr) -_C_LABEL(ofmsr): .long 0 /* area to store msr for openfirmware*/ - - .text -_ENTRY(_C_LABEL(ofw_init)) - mflr %r31 /* save return address */ - - mr %r13,%r6 /* save args (only pointer used) */ - lis %r8,ofentry@ha - stw %r5,ofentry@l(%r8) /* save virtual mode firmware entry */ - - lis %r4,fwcall@ha /* call ofw directly until vm setup */ - stw %r5,fwcall@l(%r4) - - mfmsr %r5 - lis %r4,_C_LABEL(ofmsr)@ha /* save msr from openfirmware */ - stw %r5,_C_LABEL(ofmsr)@l(%r4) -#if 0 - lis %r0,(0x80001ffe)@ha - addi %r0,%r0,(0x80001ffe)@l - mtdbatu 0,%r0 - lis %r0,(0x80000022)@ha - addi %r0,%r0,(0x80000022)@l - mtdbatl 0,%r0 -#endif - - lis %r3,fwsave@ha /* save the mmu values of the firmware */ - addi %r3,%r3,fwsave@l - lis %r4,fwbatsave@ha - addi %r4,%r4,fwbatsave@l - bl savemmu - - /* save openfirmware address mappings */ - bl _C_LABEL(save_ofw_mapping) - -#if 0 - /* dont really need the bats from firmware saved, 0 to disable */ - lis %r3,fwbatsave@ha - addi %r3,%r3,fwbatsave@l - li %r4,64 - li %r5,0 -1: subi %r4,%r4,%r4 - stwx %r5,%r4,%r3 - cmpi 4,0,0 - bne 1b -#endif - - mr %r6,%r13 /* restore args pointer */ - mtlr %r31 /* restore return address */ - blr - -/* - * Save everyting related to the mmu to the saveare pointed to by r3. - */ - .type savemmu,@function -savemmu: - - mr %r6,%r4 /* r4 holds pointer to BAT save area */ - - li %r4,0 /* save SRs */ -1: - addis %r4,%r4,-0x10000000@ha - or. %r4,%r4,%r4 - mfsrin %r5,%r4 - stwu %r5,4(%r3) - bne 1b - - mfibatl %r4,0 /* save BATs */ - stw %r4,0(%r6) - mfibatu %r4,0 - stw %r4,4(%r6) - mfibatl %r4,1 - stw %r4,8(%r6) - mfibatu %r4,1 - stw %r4,0xc(%r6) - mfibatl %r4,2 - stw %r4,0x10(%r6) - mfibatu %r4,2 - stw %r4,0x14(%r6) - mfibatl %r4,3 - stw %r4,0x18(%r6) - mfibatu %r4,3 - stw %r4,0x1c(%r6) - mfdbatl %r4,0 - stw %r4,0x20(%r6) - mfdbatu %r4,0 - stw %r4,0x24(%r6) - mfdbatl %r4,1 - stw %r4,0x28(%r6) - mfdbatu %r4,1 - stw %r4,0x2c(%r6) - mfdbatl %r4,2 - stw %r4,0x30(%r6) - mfdbatu %r4,2 - stw %r4,0x34(%r6) - mfdbatl %r4,3 - stw %r4,0x38(%r6) - mfdbatu %r4,3 - stw %r4,0x3c(%r6) - - mfsprg %r4,0 /* save SPRGs */ - stw %r4,4(%r3) - mfsprg %r4,1 - stw %r4,8(%r3) - mfsprg %r4,2 - stw %r4,12(%r3) - mfsprg %r4,3 - stw %r4,16(%r3) - - mfsdr1 %r4 /* save SDR1 */ - stw %r4,20(%r3) - - addi %r4,%r3,24 - - mfmsr %r4 - stw %r4,24(%r3) - - sync - isync - - blr - -/* - * Restore everyting related to the mmu from the savearea pointed to by r3. - * and bats pointed to by r4. - */ - .type restoremmu,@function -restoremmu: - - li %r0,0 - mtmsr %r0 - mr %r6,%r4 /* pointer to sr to restore */ - li %r4,0 /* restore SRs */ -1: - lwzu %r5,4(%r3) - addis %r4,%r4,-0x10000000@ha - or. %r4,%r4,%r4 - mtsrin %r5,%r4 - bne 1b - - mfmsr %r4 - lis %r5,(PSL_IR|PSL_DR)@h /* turn off MMU */ - ori %r5,%r5,(PSL_IR|PSL_DR)@l /* turn off MMU */ - andc %r4,%r4,%r5 /* turn off MMU */ - mtmsr %r4 - isync - - li %r4,0 /* first, invalidate BATs */ - mtibatu 0,%r4 - mtibatu 1,%r4 - mtibatu 2,%r4 - mtibatu 3,%r4 - mtdbatu 0,%r4 - mtdbatu 1,%r4 - mtdbatu 2,%r4 - mtdbatu 3,%r4 - - lwz %r4,0(%r6) - mtibatl 0,%r4 /* restore BATs */ - lwz %r4,4(%r6) - mtibatu 0,%r4 - lwz %r4,8(%r6) - mtibatl 1,%r4 - lwz %r4,12(%r6) - mtibatu 1,%r4 - lwz %r4,16(%r6) - mtibatl 2,%r4 - lwz %r4,20(%r6) - mtibatu 2,%r4 - lwz %r4,24(%r6) - mtibatl 3,%r4 - lwz %r4,28(%r6) - mtibatu 3,%r4 - lwz %r4,32(%r6) - mtdbatl 0,%r4 - lwz %r4,36(%r6) - mtdbatu 0,%r4 - lwz %r4,40(%r6) - mtdbatl 1,%r4 - lwz %r4,44(%r6) - mtdbatu 1,%r4 - lwz %r4,48(%r6) - mtdbatl 2,%r4 - lwz %r4,52(%r6) - mtdbatu 2,%r4 - lwz %r4,56(%r6) - mtdbatl 3,%r4 - lwz %r4,60(%r6) - mtdbatu 3,%r4 - - lwz %r4,4(%r3) - mtsprg 0,4 /* restore SPRGs */ - lwz %r4,8(%r3) - mtsprg 1,4 - lwz %r4,12(%r3) - mtsprg 2,4 - lwz %r4,16(%r3) - mtsprg 3,4 - - sync /* remove everything from tlb */ - lis %r4,0x40000@ha - li %r5,0x1000 -1: - subf. %r4,%r5,%r4 - tlbie %r4 - bne 1b - - sync - tlbsync - sync - - lwz %r4,20(%r3) - sync - mtsdr1 %r4 /* restore SDR1 */ - - - /* tlbia */ - sync - li %r5,0x40 - mtctr %r5 - li %r4,0 - 1: - tlbie %r4 - addi %r4,%r4,0x1000 - bdnz 1b - sync - tlbsync - sync - - lwz %r4,24(%r3) - mtmsr %r4 - isync - - blr - - -_ENTRY(_C_LABEL(fwentry)) - stwu %r1,-16(%r1) - mflr %r4 - stw %r4,20(%r1) - stw %r3,12(%r1) /* save arg */ - - lis %r3,clsave@ha /* save mmu values of client */ - addi %r3,%r3,clsave@l - lis %r4,clbatsave@ha /* save mmu values of client */ - addi %r4,%r4,clbatsave@l - bl savemmu - - lis %r3,fwsave@ha /* restore mmu values of firmware */ - addi %r3,%r3,fwsave@l - lis %r4,fwbatsave@ha - addi %r4,%r4,fwbatsave@l - bl restoremmu - - lis %r3,ofentry@ha - lwz %r3,ofentry@l(%r3) /* get actual firmware entry */ - mtlr %r3 - - mfmsr %r4 - ori %r4,%r4,PSL_IR|PSL_DR /* turn on MMU */ - mtmsr %r4 - isync - - lwz %r3,12(%r1) /* restore arg */ - blrl /* do actual firmware call */ - - stw %r3,12(%r1) /* save return value */ - - lis %r3,fwsave@ha /* save mmu values of firmare */ - addi %r3,%r3,fwsave@l /* (might not be necessary, but... */ - lis %r4,fwbatsave@ha - addi %r4,%r4,fwbatsave@l - bl savemmu - - lis %r3,clsave@ha /* restore mmu values of client */ - addi %r3,%r3,clsave@l - lis %r4,clbatsave@ha /* save mmu values of client */ - addi %r4,%r4,clbatsave@l - bl restoremmu - - lwz %r4,20(%r1) - lwz %r3,12(%r1) /* restore return value */ - - mtlr %r4 - addi %r1,%r1,16 - blr - -/* - * OpenFirmware entry point - */ -_ENTRY(_C_LABEL(openfirmware)) - stwu %r1,-16(%r1) - mflr %r0 /* save return address */ - stw %r0,20(%r1) - - lis %r4,fwcall@ha - lwz %r4,fwcall@l(%r4) - - mtlr %r4 - blrl - - lwz %r0,20(%r1) - mtlr %r0 - lwz %r1,0(%r1) - blr - -/* - * Switch to/from OpenFirmware real mode stack - * - * Note: has to be called as the very first thing in OpenFirmware interface routines. - * E.g.: - * int - * OF_xxx(arg1, arg2) - * type arg1, arg2; - * { - * static struct { - * char *name; - * int nargs; - * int nreturns; - * char *method; - * int arg1; - * int arg2; - * int ret; - * } args = { - * "xxx", - * 2, - * 1, - * }; - * - * ofw_stack(); - * args.arg1 = arg1; - * args.arg2 = arg2; - * if (openfirmware(&args) < 0) - * return -1; - * return args.ret; - * } - */ -.lcomm firmstk,NBPG,16 -.comm _C_LABEL(OF_buf),NBPG,PGOFSET - -_ENTRY(_C_LABEL(ofw_stack)) - mfmsr %r8 /* turn off interrupts */ - andi. %r0,%r8,~(PSL_EE|PSL_RI)@l - mtmsr %r0 - stw %r8,4(%r1) /* abuse return address slot */ - - lwz %r5,0(%r1) /* get length of stack frame */ - subf %r5,%r1,%r5 - - lis %r7,firmstk+NBPG-8@ha - addi %r7,%r7,firmstk+NBPG-8@l - li %r6,0xf - andc %r7,%r7,%r6 - lis %r6,ofw_back@ha - addi %r6,%r6,ofw_back@l - subf %r4,%r5,%r7 /* make room for stack frame on new stack */ - stwu %r1,-16(%r7) - stw %r6,4(%r7) /* setup return pointer */ - - stw %r7,-16(%r4) - - addi %r3,%r1,%r8 - addi %r1,%r4,-16 - subi %r5,%r5,%r8 - subi %r4,%r4,%r8 - - b _C_LABEL(ofbcopy) /* and copy it */ - - .type ofw_back,@function -ofw_back: - lwz %r1,0(%r1) /* get callers original stack pointer */ - - lwz %r0,4(%r1) /* get saved msr from abused slot */ - mtmsr %r0 - - lwz %r1,0(%r1) /* return */ - lwz %r0,4(%r1) - mtlr %r0 - blr diff --git a/sys/arch/pegasos/pegasos/opendev.c b/sys/arch/pegasos/pegasos/opendev.c deleted file mode 100644 index 07ca90e505c..00000000000 --- a/sys/arch/pegasos/pegasos/opendev.c +++ /dev/null @@ -1,318 +0,0 @@ -/* $OpenBSD: opendev.c,v 1.2 2004/01/14 23:27:53 brad Exp $ */ -/* $NetBSD: openfirm.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */ - -/* - * Copyright (C) 1995, 1996 Wolfgang Solfrank. - * Copyright (C) 1995, 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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/stdarg.h> -#include <machine/psl.h> - -#include <dev/ofw/openfirm.h> -#include <lib/libkern/libkern.h> - -extern void ofw_stack(void); -extern void ofbcopy(const void *, void *, size_t); - -int -OF_instance_to_package(int ihandle) -{ - static struct { - char *name; - int nargs; - int nreturns; - int ihandle; - int phandle; - } args = { - "instance-to-package", - 1, - 1, - }; - - ofw_stack(); - args.ihandle = ihandle; - if (openfirmware(&args) == -1) - return -1; - return args.phandle; -} - -int -OF_package_to_path(int phandle, char *buf, int buflen) -{ - static struct { - char *name; - int nargs; - int nreturns; - int phandle; - char *buf; - int buflen; - int length; - } args = { - "package-to-path", - 3, - 1, - }; - - ofw_stack(); - if (buflen > PAGE_SIZE) - return -1; - args.phandle = phandle; - args.buf = OF_buf; - args.buflen = buflen; - if (openfirmware(&args) < 0) - return -1; - if (args.length > 0) - ofbcopy(OF_buf, buf, args.length); - return args.length; -} - - -int -OF_call_method(char *method, int ihandle, int nargs, int nreturns, ...) -{ - va_list ap; - static struct { - char *name; - int nargs; - int nreturns; - char *method; - int ihandle; - int args_n_results[12]; - } args = { - "call-method", - 2, - 1, - }; - int *ip, n; - - if (nargs > 6) - return -1; - args.nargs = nargs + 2; - args.nreturns = nreturns + 1; - args.method = method; - args.ihandle = ihandle; - va_start(ap, nreturns); - for (ip = args.args_n_results + (n = nargs); --n >= 0;) - *--ip = va_arg(ap, int); - ofw_stack(); - if (openfirmware(&args) == -1) { - va_end(ap); - return -1; - } - if (args.args_n_results[nargs]) { - va_end(ap); - return args.args_n_results[nargs]; - } - for (ip = args.args_n_results + nargs + (n = args.nreturns); --n > 0;) - *va_arg(ap, int *) = *--ip; - va_end(ap); - return 0; -} -int -OF_call_method_1(char *method, int ihandle, int nargs, ...) -{ - va_list ap; - static struct { - char *name; - int nargs; - int nreturns; - char *method; - int ihandle; - int args_n_results[8]; - } args = { - "call-method", - 2, - 2, - }; - int *ip, n; - - if (nargs > 6) - return -1; - args.nargs = nargs + 2; - args.method = method; - args.ihandle = ihandle; - va_start(ap, nargs); - for (ip = args.args_n_results + (n = nargs); --n >= 0;) - *--ip = va_arg(ap, int); - va_end(ap); - ofw_stack(); - if (openfirmware(&args) == -1) - return -1; - if (args.args_n_results[nargs]) - return -1; - return args.args_n_results[nargs + 1]; -} - -int -OF_open(char *dname) -{ - static struct { - char *name; - int nargs; - int nreturns; - char *dname; - int handle; - } args = { - "open", - 1, - 1, - }; - int l; - - ofw_stack(); - if ((l = strlen(dname)) >= PAGE_SIZE) - return -1; - ofbcopy(dname, OF_buf, l + 1); - args.dname = OF_buf; - if (openfirmware(&args) == -1) - return -1; - return args.handle; -} - -void -OF_close(int handle) -{ - static struct { - char *name; - int nargs; - int nreturns; - int handle; - } args = { - "close", - 1, - 0, - }; - - ofw_stack(); - args.handle = handle; - openfirmware(&args); -} - -/* - * This assumes that character devices don't read in multiples of PAGE_SIZE. - */ -int -OF_read(int handle, void *addr, int len) -{ - static struct { - char *name; - int nargs; - int nreturns; - int ihandle; - void *addr; - int len; - int actual; - } args = { - "read", - 3, - 1, - }; - int l, act = 0; - - ofw_stack(); - args.ihandle = handle; - args.addr = OF_buf; - for (; len > 0; len -= l, addr += l) { - l = min(PAGE_SIZE, len); - args.len = l; - if (openfirmware(&args) == -1) - return -1; - if (args.actual > 0) { - ofbcopy(OF_buf, addr, args.actual); - act += args.actual; - } - if (args.actual < l) { - if (act) - return act; - else - return args.actual; - } - } - return act; -} - -int -OF_write(int handle, void *addr, int len) -{ - static struct { - char *name; - int nargs; - int nreturns; - int ihandle; - void *addr; - int len; - int actual; - } args = { - "write", - 3, - 1, - }; - int l, act = 0; - - ofw_stack(); - args.ihandle = handle; - args.addr = OF_buf; - for (; len > 0; len -= l, addr += l) { - l = min(PAGE_SIZE, len); - ofbcopy(addr, OF_buf, l); - args.len = l; - if (openfirmware(&args) == -1) - return -1; - l = args.actual; - act += l; - } - return act; -} - -int -OF_seek(int handle, u_quad_t pos) -{ - static struct { - char *name; - int nargs; - int nreturns; - int handle; - int poshi; - int poslo; - int status; - } args = { - "seek", - 3, - 1, - }; - - ofw_stack(); - args.handle = handle; - args.poshi = (int)(pos >> 32); - args.poslo = (int)pos; - if (openfirmware(&args) == -1) - return -1; - return args.status; -} diff --git a/sys/arch/pegasos/pegasos/openfirm.c b/sys/arch/pegasos/pegasos/openfirm.c deleted file mode 100644 index 0a8f0d34deb..00000000000 --- a/sys/arch/pegasos/pegasos/openfirm.c +++ /dev/null @@ -1,295 +0,0 @@ -/* $OpenBSD: openfirm.c,v 1.2 2004/01/14 23:27:53 brad Exp $ */ -/* $NetBSD: openfirm.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */ - -/* - * Copyright (C) 1995, 1996 Wolfgang Solfrank. - * Copyright (C) 1995, 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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/stdarg.h> -#include <machine/psl.h> - -#include <dev/ofw/openfirm.h> - -extern void ofw_stack(void); -extern void ofbcopy(const void *, void *, size_t); - -int -OF_peer(int phandle) -{ - static struct { - char *name; - int nargs; - int nreturns; - int phandle; - int sibling; - } args = { - "peer", - 1, - 1, - }; - - ofw_stack(); - args.phandle = phandle; - if (openfirmware(&args) == -1) - return 0; - return args.sibling; -} - -int -OF_child(int phandle) -{ - static struct { - char *name; - int nargs; - int nreturns; - int phandle; - int child; - } args = { - "child", - 1, - 1, - }; - - ofw_stack(); - args.phandle = phandle; - if (openfirmware(&args) == -1) - return 0; - return args.child; -} - -int -OF_parent(int phandle) -{ - static struct { - char *name; - int nargs; - int nreturns; - int phandle; - int parent; - } args = { - "parent", - 1, - 1, - }; - - ofw_stack(); - args.phandle = phandle; - if (openfirmware(&args) == -1) - return 0; - return args.parent; -} - -int -OF_getprop(int handle, char *prop, void *buf, int buflen) -{ - static struct { - char *name; - int nargs; - int nreturns; - int phandle; - char *prop; - void *buf; - int buflen; - int size; - } args = { - "getprop", - 4, - 1, - }; - - ofw_stack(); - if (buflen > NBPG) - return -1; - args.phandle = handle; - args.prop = prop; - args.buf = OF_buf; - args.buflen = buflen; - if (openfirmware(&args) == -1) - return -1; - if (args.size > 0) - ofbcopy(OF_buf, buf, args.size); - return args.size; -} - -int -OF_interpret(char *cmd, int nreturns, ...) -{ - va_list ap; - int i; - static struct { - char *name; - int nargs; - int nreturns; - char *cmd; - int status; - int results[8]; - } args = { - "interpret", - 1, - 2, - }; - - ofw_stack(); - if (nreturns > 8) - return -1; - if ((i = strlen(cmd)) >= NBPG) - return -1; - ofbcopy(cmd, OF_buf, i + 1); - args.cmd = OF_buf; - args.nargs = 1; - args.nreturns = nreturns + 1; - if (openfirmware(&args) == -1) - return -1; - va_start(ap, nreturns); - for (i = 0; i < nreturns; i++) - *va_arg(ap, int *) = args.results[i]; - va_end(ap); - return args.status; -} - - -int -OF_finddevice(char *name) -{ - static struct { - char *name; - int nargs; - int nreturns; - char *device; - int phandle; - } args = { - "finddevice", - 1, - 1, - }; - - ofw_stack(); - args.device = name; - if (openfirmware(&args) == -1) - return -1; - return args.phandle; -} -static void OF_rboot(char *bootspec); - -static void -OF_rboot(char *bootspec) -{ - static struct { - char *name; - int nargs; - int nreturns; - } args = { - "reset-all", - 0, - 0, - }; - int l; - - if ((l = strlen(bootspec)) >= NBPG) - panic("OF_boot"); - ofw_stack(); - openfirmware(&args); - /* will attempt exit in OF_boot */ -} - - -void -OF_boot(char *bootspec) -{ - OF_rboot(bootspec); - printf ("OF_boot returned!"); /* just in case */ - OF_exit(); - while(1); -} - -void -OF_exit() -{ - static struct { - char *name; - int nargs; - int nreturns; - } args = { - "exit", - 0, - 0, - }; - - ofw_stack(); - openfirmware(&args); - panic ("OF_exit returned!"); /* just in case */ - while (1); -} - -void * OF_claim(void *virt, u_int size, u_int align); -void * -OF_claim(void *virt, u_int size, u_int align) -{ - static struct { - char *name; - int nargs; - int nreturns; - void *virt; - u_int size; - u_int align; - void *baseaddr; - } args = { - "claim", - 3, - 1, - }; - - ofw_stack(); - args.virt = virt; - args.size = size; - args.align = align; - if (openfirmware(&args) == -1) - return (void *)-1; - if (virt != 0) { - return virt; - } - return args.baseaddr; -} - -/* XXX What is the reason to have this instead of bcopy/memcpy? */ -void -ofbcopy(const void *src, void *dst, size_t len) -{ - const char *sp = src; - char *dp = dst; - - if (src == dst) - return; - - while (len-- > 0) - *dp++ = *sp++; -} - diff --git a/sys/arch/pegasos/pegasos/rbus_machdep.c b/sys/arch/pegasos/pegasos/rbus_machdep.c deleted file mode 100644 index 7ec67683570..00000000000 --- a/sys/arch/pegasos/pegasos/rbus_machdep.c +++ /dev/null @@ -1,140 +0,0 @@ -/* $OpenBSD: rbus_machdep.c,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ -/* $NetBSD: rbus_machdep.c,v 1.2 1999/10/15 06:43:06 haya Exp $ */ - -/* - * Copyright (c) 1999 - * HAYAKAWA Koichi. 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 HAYAKAWA Koichi. - * 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/extent.h> - -#include <uvm/uvm_extern.h> - -#include <sys/sysctl.h> - -#include <sys/device.h> - -#include <machine/bus.h> -#include <dev/cardbus/rbus.h> - -#include <dev/pci/pcivar.h> -#include <arch/pegasos/pci/pcibrvar.h> - -void rbus_cardbus_init(pci_chipset_tag_t pc, pcitag_t tag); - -/********************************************************************** - * rbus_tag_t rbus_fakeparent_mem(struct pci_attach_args *pa) - * - * This function makes an rbus tag for memory space. This rbus tag - * shares the all memory region of ex_iomem. - **********************************************************************/ -#define RBUS_MEM_SIZE 0x10000000 - -rbus_tag_t -rbus_pccbb_parent_mem(struct device *self, struct pci_attach_args *pa) -{ - bus_addr_t start; - bus_size_t size; - struct extent *ex; - - rbus_cardbus_init(pa->pa_pc, pa->pa_tag); - - size = RBUS_MEM_SIZE; - if ((ex = pciaddr_search(PCIADDR_SEARCH_MEM, self, &start, size)) == NULL) - { - /* XXX */ - printf("failed\n"); - } - - return rbus_new_root_share(pa->pa_memt, ex, start, size, 0); -} - - -/********************************************************************** - * rbus_tag_t rbus_pccbb_parent_io(struct pci_attach_args *pa) - **********************************************************************/ -#define RBUS_IO_SIZE 0x1000 - -rbus_tag_t -rbus_pccbb_parent_io(struct device *self, struct pci_attach_args *pa) -{ - struct extent *ex; - bus_addr_t start; - bus_size_t size; - - - size = RBUS_IO_SIZE; - if ((ex = pciaddr_search(PCIADDR_SEARCH_IO, self, &start, size)) == NULL) - { - /* XXX */ - printf("failed\n"); - } - - return rbus_new_root_share(pa->pa_iot, ex, start, size, 0); -} - - -/* - * Big ugly hack to enable bridge/fix interrupts - */ -void -rbus_cardbus_init(pci_chipset_tag_t pc, pcitag_t tag) -{ - u_int x; - static int initted = 0; - - if (initted) - return; - initted = 1; - - /* XXX What about other bridges? */ - - x = pci_conf_read(pc, tag, PCI_ID_REG); - if (PCI_VENDOR(x) == PCI_VENDOR_TI && - PCI_PRODUCT(x) == PCI_PRODUCT_TI_PCI1211) { - /* For CardBus card. */ - pci_conf_write(pc, tag, 0x18, 0x10010100); - - /* Route INTA to MFUNC0 */ - x = pci_conf_read(pc, tag, 0x8c); - x |= 0x02; - pci_conf_write(pc, tag, 0x8c, x); - - tag = pci_make_tag(pc, 0, 0, 0); - x = pci_conf_read(pc, tag, PCI_ID_REG); - if (PCI_VENDOR(x) == PCI_VENDOR_MOT && - PCI_PRODUCT(x) == PCI_PRODUCT_MOT_MPC106) { - /* Set subordinate bus number to 1. */ - x = pci_conf_read(pc, tag, 0x40); - x |= 1 << 8; - pci_conf_write(pc, tag, 0x40, x); - } - } -} diff --git a/sys/arch/pegasos/pegasos/rdbdisksubr.c b/sys/arch/pegasos/pegasos/rdbdisksubr.c deleted file mode 100644 index d18e905bbca..00000000000 --- a/sys/arch/pegasos/pegasos/rdbdisksubr.c +++ /dev/null @@ -1,361 +0,0 @@ -/* $OpenBSD: rdbdisksubr.c,v 1.2 2003/12/20 22:40:28 miod Exp $ */ -/* $NetBSD: disksubr.c,v 1.27 1996/10/13 03:06:34 christos Exp $ */ - -/* - * Copyright (c) 1994 Christian E. Hopps - * Copyright (c) 1982, 1986, 1988 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/buf.h> -#include <sys/device.h> -#include <sys/disklabel.h> -#include <sys/syslog.h> -#include <sys/disk.h> - -struct adostype getadostype(u_long dostype); - -u_long rdbchksum(void *bdata); - -#define b_cylin b_resid -int -try_rdb_label(dev_t dev, void (*strat)(struct buf *), struct buf *bp, - struct disklabel *lp, struct cpu_disklabel *osdep, char **pmsg, - int *bsdpartoff); -int -try_rdb_label(dev_t dev, void (*strat)(struct buf *), struct buf *bp, - struct disklabel *lp, struct cpu_disklabel *clp, char **pmsg, - int *bsdpartoff) -{ - int nextb, i; - int rdbpartoff = -1; - struct rdblock *rbp; - struct partblock *pbp; - struct partition *pp = NULL; - struct adostype adt; - int cindex; - - clp->rdblock = RDBNULL; - - /* initialize */ - for (i = 0; i < MAXPARTITIONS; i++) { - clp->pbindex[i] = -1; - clp->pblist[i] = RDBNULL; - } - if (lp->d_partitions[RAW_PART].p_size == 0) - lp->d_partitions[RAW_PART].p_size = 0x1fffffff; - lp->d_partitions[RAW_PART].p_offset = 0; - - lp->d_npartitions = 'i' - 'a'; - - bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART); - - /* Find RDB block */ - - for (nextb = 0; nextb < RDB_MAXBLOCKS; nextb++) { - bp->b_blkno = nextb; - bp->b_cylin = nextb / lp->d_secpercyl; - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ; - strat(bp); - - if (biowait(bp)) { - *pmsg = "RDB search I/O error"; - goto done; - } - rbp = (void *)(bp->b_data); - - if (rbp->id == RDBLOCK_ID) { - if (rdbchksum(rbp) == 0) - break; - else - *pmsg = "bad rdb checksum"; - } - } - if (nextb == RDB_MAXBLOCKS) - goto done; /* no RDB found */ - - clp->rdblock = nextb; - - lp->d_secsize = rbp->nbytes; - lp->d_nsectors = rbp->nsectors; - lp->d_ntracks = rbp->nheads; - /* - * should be rdb->ncylinders however this is a bogus value - * sometimes it seems - */ - if (rbp->highcyl == 0) - lp->d_ncylinders = rbp->ncylinders; - else - lp->d_ncylinders = rbp->highcyl + 1; - /* - * I also don't trust rdb->secpercyl - */ - lp->d_secpercyl = min(rbp->secpercyl, lp->d_nsectors * lp->d_ntracks); - if (lp->d_secpercyl == 0) - lp->d_secpercyl = lp->d_nsectors * lp->d_ntracks; - - cindex = 0; - for (nextb = rbp->partbhead; nextb != RDBNULL; nextb = pbp->next) { - bp->b_blkno = nextb; - bp->b_cylin = nextb / lp->d_secpercyl; - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ; - strat(bp); - - if (biowait(bp)) { - *pmsg = "RDB partition scan I/O error"; - goto done; - } - pbp = (void *)(bp->b_data); - - if (pbp->id != PARTBLOCK_ID) { - *pmsg = "RDB partition block bad id"; - goto done; - } - if (rdbchksum(pbp)) { - *pmsg = "RDB partition block bad cksum"; - goto done; - } - if (pbp->e.tabsize < 11) - *pmsg = "RDB bad partition info (environ < 11)"; - - if (pbp->e.dostype == DOST_OBSD) { - rdbpartoff = pbp->e.lowcyl * pbp->e.secpertrk - * pbp->e.numheads; - clp->rd_bsdlbl = rdbpartoff; - continue; - } - - if (pbp->e.tabsize >= 16) - adt = getadostype(pbp->e.dostype); - else { - adt.archtype = ADT_UNKNOWN; - adt.fstype = FS_UNUSED; - } - - switch (adt.archtype) { - case ADT_NETBSDROOT: - pp = &lp->d_partitions[0]; - if (pp->p_size) { - printf("WARN: more than one root, ignoring\n"); - clp->rdblock = RDBNULL; /* invlidate cpulab */ - continue; - } - break; - case ADT_NETBSDSWAP: - pp = &lp->d_partitions[1]; - if (pp->p_size) { - printf("WARN: more than one swap, ignoring\n"); - clp->rdblock = RDBNULL; /* invlidate cpulab */ - continue; - } - break; - case ADT_NETBSDUSER: - case ADT_AMIGADOS: - case ADT_AMIX: - case ADT_EXT2: - case ADT_UNKNOWN: - pp = &lp->d_partitions[lp->d_npartitions]; - break; - } - - if (lp->d_npartitions <= (pp - lp->d_partitions)) - lp->d_npartitions = (pp - lp->d_partitions) + 1; - -#if 0 - if (lp->d_secpercyl != (pbp->e.secpertrk * pbp->e.numheads)) { - if (pbp->partname[0] < sizeof(pbp->partname)) - pbp->partname[pbp->partname[0] + 1] = 0; - else - pbp->partname[sizeof(pbp->partname) - 1] = 0; - printf("Partition '%s' geometry %ld/%ld differs", - pbp->partname + 1, pbp->e.numheads, - pbp->e.secpertrk); - printf(" from RDB %d/%d\n", lp->d_ntracks, - lp->d_nsectors); - } -#endif -#if 0 - /* - * insert sort in increasing offset order - */ - while ((pp - lp->d_partitions) > RAW_PART + 1) { - daddr_t boff; - - boff = pbp->e.lowcyl * pbp->e.secpertrk - * pbp->e.numheads; - if (boff > (pp - 1)->p_offset) - break; - *pp = *(pp - 1); /* struct copy */ - pp--; - } -#endif - i = (pp - lp->d_partitions); - - pp->p_size = (pbp->e.highcyl - pbp->e.lowcyl + 1) - * pbp->e.secpertrk * pbp->e.numheads; - pp->p_offset = pbp->e.lowcyl * pbp->e.secpertrk - * pbp->e.numheads; - pp->p_fstype = adt.fstype; - if (adt.archtype == ADT_AMIGADOS) { - /* - * Save reserved blocks at begin in cpg and - * adjust size by reserved blocks at end - */ - pp->p_fsize = 512; - pp->p_frag = pbp->e.secperblk; - pp->p_cpg = pbp->e.resvblocks; - pp->p_size -= pbp->e.prefac; - } else if (pbp->e.tabsize > 22 && ISFSARCH_NETBSD(adt)) { - pp->p_fsize = pbp->e.fsize; - pp->p_frag = pbp->e.frag; - pp->p_cpg = pbp->e.cpg; - } else { - pp->p_fsize = 1024; - pp->p_frag = 8; - pp->p_cpg = 0; - } - - /* - * store this partitions block number - */ - clp->pbindex[i] = cindex; - clp->pblist[cindex] = nextb; - cindex++; - } -done: - if (clp->rdblock != RDBNULL && rdbpartoff != -1) - *bsdpartoff = rdbpartoff; - bp->b_dev = dev; - return (clp->rdblock != RDBNULL); -} - -struct adostype -getadostype(u_long dostype) -{ - struct adostype adt; - u_long t3, b1; - - t3 = dostype & 0xffffff00; - b1 = dostype & 0x000000ff; - - adt.fstype = b1; - - switch (t3) { - case DOST_NBR: - adt.archtype = ADT_NETBSDROOT; - return (adt); - case DOST_NBS: - adt.archtype = ADT_NETBSDSWAP; - return (adt); - case DOST_NBU: - adt.archtype = ADT_NETBSDUSER; - return (adt); - case DOST_MUFS: - /* check for 'muFS'? */ - adt.archtype = ADT_AMIGADOS; - adt.fstype = FS_ADOS; - return (adt); - case DOST_DOS: - adt.archtype = ADT_AMIGADOS; - if (b1 > 5) -#if 0 - /* - * XXX at least I, <niklas@appli.se>, have a partition - * that looks like "DOS\023", wherever that came from, - * but ADOS accepts it, so should we. - */ - goto unknown; - else -#else - printf("found dostype: 0x%lx, assuming an ADOS FS " - "although it's unknown\n", dostype); -#endif - adt.fstype = FS_ADOS; - return (adt); - case DOST_AMIX: - adt.archtype = ADT_AMIX; - if (b1 == 2) - adt.fstype = FS_BSDFFS; - else - goto unknown; - return (adt); - case DOST_XXXBSD: -#ifdef DIAGNOSTIC - printf("found dostype: 0x%lx which is deprecated", dostype); -#endif - if (b1 == 'S') { - dostype = DOST_NBS; - dostype |= FS_SWAP; - } else { - if (b1 == 'R') - dostype = DOST_NBR; - else - dostype = DOST_NBU; - dostype |= FS_BSDFFS; - } -#ifdef DIAGNOSTIC - printf(" using: 0x%lx instead\n", dostype); -#endif - return (getadostype(dostype)); - case DOST_EXT2: - adt.archtype = ADT_EXT2; - adt.fstype = FS_EXT2FS; - return(adt); - default: - unknown: -#ifdef DIAGNOSTIC - printf("warning unknown dostype: 0x%lx marking unused\n", - dostype); -#endif - adt.archtype = ADT_UNKNOWN; - adt.fstype = FS_UNUSED; - return (adt); - } -} - -u_long -rdbchksum(bdata) - void *bdata; -{ - u_long *blp, cnt, val; - - blp = bdata; - cnt = blp[1]; - val = 0; - - while (cnt--) - val += *blp++; - return (val); -} diff --git a/sys/arch/pegasos/pegasos/wscons_machdep.c b/sys/arch/pegasos/pegasos/wscons_machdep.c deleted file mode 100644 index 04e57aa11d6..00000000000 --- a/sys/arch/pegasos/pegasos/wscons_machdep.c +++ /dev/null @@ -1,136 +0,0 @@ -/* $OpenBSD: wscons_machdep.c,v 1.2 2004/02/04 20:07:18 drahn Exp $ */ - -/* - * Copyright (c) 2001 Aaron Campbell - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/conf.h> -#include <sys/device.h> -#include <sys/extent.h> - -#include <machine/bus.h> - -#include <dev/cons.h> - -#include "wsdisplay.h" -#include "vga.h" - - -#if NVGA_PCI >0 -#include <dev/pci/pcivar.h> -#include <dev/pci/vga_pcivar.h> -#endif -#if NWSDISPLAY > 0 -#include <dev/wscons/wsdisplayvar.h> -#endif -#include <dev/wscons/wskbdvar.h> - -#include "pckbc.h" -#if (NPCKBC > 0) -#include <dev/isa/isareg.h> -#include <dev/ic/i8042reg.h> -#include <dev/ic/pckbcvar.h> -#endif -#include "pckbd.h" /* for pckbc_machdep_cnattach */ -#include "ukbd.h" /* for pckbc_machdep_cnattach */ -#if (NUKBD > 0) -#include <dev/usb/ukbdvar.h> -#endif - -void wscnprobe(struct consdev *); -void wscninit(struct consdev *); -void wscnputc(dev_t, char); -int wscngetc(dev_t); -void wscnpollc(dev_t, int); - -void -wscnprobe(struct consdev *cp) -{ - int maj; - - /* locate the major number */ - for (maj = 0; maj < nchrdev; maj++) { - if (cdevsw[maj].d_open == wsdisplayopen) - break; - } - - if (maj == nchrdev) { - /* we are not in cdevsw[], give up */ - panic("wsdisplay is not in cdevsw[]"); - } - - cp->cn_dev = makedev(maj, 0); - cp->cn_pri = CN_INTERNAL; -} - -void -wscninit(struct consdev *cp) -{ - static int inited = 0; - - if (inited) - return; - - inited = 1; - - -#if (NVGA_PCI > 0) - if (!vga_pci_cnattach(MD_DISPLAY_ISA_IOT, MD_DISPLAY_ISA_MEMT, - NULL, 1, 0, 0)); -#endif -#if (NPCKBC > 0) - if (!pckbc_cnattach(MD_ISA_IOT, IO_KBD, KBCMDP, PCKBC_KBD_SLOT)) - return; -#endif -#if (NUKBD > 0) - if (!ukbd_cnattach()) - return; -#endif -} - -void -wscnputc(dev_t dev, char i) -{ -#if NWSDISPLAY > 0 - wsdisplay_cnputc(dev, (int)i); -#endif -} - -int -wscngetc(dev_t dev) -{ - return (wskbd_cngetc(dev)); -} - -void -wscnpollc(dev_t dev, int on) -{ -#if NWSDISPLAY > 0 - wskbd_cnpollc(dev, on); -#endif -} diff --git a/sys/arch/pegasos/stand/Locore.c b/sys/arch/pegasos/stand/Locore.c deleted file mode 100644 index 67251a52c97..00000000000 --- a/sys/arch/pegasos/stand/Locore.c +++ /dev/null @@ -1,508 +0,0 @@ -/* $OpenBSD: Locore.c,v 1.2 2003/11/14 20:09:20 drahn Exp $ */ -/* $NetBSD: Locore.c,v 1.1 1997/04/16 20:29:11 thorpej Exp $ */ - -/* - * Copyright (C) 1995, 1996 Wolfgang Solfrank. - * Copyright (C) 1995, 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <lib/libsa/stand.h> -#include <macppc/stand/openfirm.h> - -/* -#include "machine/cpu.h" -*/ - -static int (*openfirmware)(void *); - -static void setup(void); - -asm(" - .text - .globl bat_init -bat_init: - - mfmsr 8 - li 0,0 - mtmsr 0 - isync - - mtibatu 0,0 - mtibatu 1,0 - mtibatu 2,0 - mtibatu 3,0 - mtdbatu 0,0 - mtdbatu 1,0 - mtdbatu 2,0 - mtdbatu 3,0 - - li 9,0x12 /* BATL(0, BAT_M, BAT_PP_RW) */ - mtibatl 0,9 - mtdbatl 0,9 - li 9,0x1ffe /* BATU(0, BAT_BL_256M, BAT_Vs) */ - mtibatu 0,9 - mtdbatu 0,9 - isync - - mtmsr 8 - isync - blr -"); - -__dead void -_start(void *vpd, int res, int (*openfirm)(void *), char *arg, int argl) -{ - extern char etext[]; - - syncicache((void *)RELOC, etext - (char *)RELOC); - bat_init(); - openfirmware = openfirm; /* Save entry to Open Firmware */ -#if 0 - patch_dec_intr(); -#endif - setup(); - main(arg, argl); - exit(); -} - -__dead void -_rtt() -{ - static struct { - char *name; - int nargs; - int nreturns; - } args = { - "exit", - 0, - 0 - }; - - openfirmware(&args); - while (1); /* just in case */ -} - -int -OF_finddevice(char *name) -{ - static struct { - char *name; - int nargs; - int nreturns; - char *device; - int phandle; - } args = { - "finddevice", - 1, - 1, - }; - - args.device = name; - if (openfirmware(&args) == -1) - return -1; - return args.phandle; -} - -int -OF_instance_to_package(int ihandle) -{ - static struct { - char *name; - int nargs; - int nreturns; - int ihandle; - int phandle; - } args = { - "instance-to-package", - 1, - 1, - }; - - args.ihandle = ihandle; - if (openfirmware(&args) == -1) - return -1; - return args.phandle; -} - -int -OF_getprop(int handle, char *prop, void *buf, int buflen) -{ - static struct { - char *name; - int nargs; - int nreturns; - int phandle; - char *prop; - void *buf; - int buflen; - int size; - } args = { - "getprop", - 4, - 1, - }; - - args.phandle = handle; - args.prop = prop; - args.buf = buf; - args.buflen = buflen; - if (openfirmware(&args) == -1) - return -1; - return args.size; -} - -#ifdef __notyet__ /* Has a bug on FirePower */ -int -OF_setprop(int handle, char *prop, void *buf, int len) -{ - static struct { - char *name; - int nargs; - int nreturns; - int phandle; - char *prop; - void *buf; - int len; - int size; - } args = { - "setprop", - 4, - 1, - }; - - args.phandle = handle; - args.prop = prop; - args.buf = buf; - args.len = len; - if (openfirmware(&args) == -1) - return -1; - return args.size; -} -#endif - -int -OF_open(char *dname) -{ - static struct { - char *name; - int nargs; - int nreturns; - char *dname; - int handle; - } args = { - "open", - 1, - 1, - }; - - args.dname = dname; - if (openfirmware(&args) == -1) - return -1; - return args.handle; -} - -void -OF_close(int handle) -{ - static struct { - char *name; - int nargs; - int nreturns; - int handle; - } args = { - "close", - 1, - 0, - }; - - args.handle = handle; - openfirmware(&args); -} - -int -OF_write(int handle, void *addr, int len) -{ - static struct { - char *name; - int nargs; - int nreturns; - int ihandle; - void *addr; - int len; - int actual; - } args = { - "write", - 3, - 1, - }; - - args.ihandle = handle; - args.addr = addr; - args.len = len; - if (openfirmware(&args) == -1) - return -1; - return args.actual; -} - -int -OF_read(int handle, void *addr, int len) -{ - static struct { - char *name; - int nargs; - int nreturns; - int ihandle; - void *addr; - int len; - int actual; - } args = { - "read", - 3, - 1, - }; - - args.ihandle = handle; - args.addr = addr; - args.len = len; - if (openfirmware(&args) == -1) - return -1; - return args.actual; -} - -int -OF_seek(int handle, u_quad_t pos) -{ - static struct { - char *name; - int nargs; - int nreturns; - int handle; - int poshi; - int poslo; - int status; - } args = { - "seek", - 3, - 1, - }; - - args.handle = handle; - args.poshi = (int)(pos >> 32); - args.poslo = (int)pos; - if (openfirmware(&args) == -1) - return -1; - return args.status; -} - -void * -OF_claim(void *virt, u_int size, u_int align) -{ - static struct { - char *name; - int nargs; - int nreturns; - void *virt; - u_int size; - u_int align; - void *baseaddr; - } args = { - "claim", - 3, - 1, - }; - - args.virt = virt; - args.size = size; - args.align = align; - if (openfirmware(&args) == -1) - return (void *)-1; - if (virt != 0) - return virt; - return args.baseaddr; -} - -void -OF_release(void *virt, u_int size) -{ - static struct { - char *name; - int nargs; - int nreturns; - void *virt; - u_int size; - } args = { - "release", - 2, - 0, - }; - - args.virt = virt; - args.size = size; - openfirmware(&args); -} - -int -OF_milliseconds() -{ - static struct { - char *name; - int nargs; - int nreturns; - int ms; - } args = { - "milliseconds", - 0, - 1, - }; - - openfirmware(&args); - return args.ms; -} - -#ifdef __notyet__ -void -OF_chain(void *virt, u_int size, void (*entry)(), void *arg, u_int len) -{ - static struct { - char *name; - int nargs; - int nreturns; - void *virt; - u_int size; - void (*entry)(); - void *arg; - u_int len; - } args = { - "chain", - 5, - 0, - }; - - args.virt = virt; - args.size = size; - args.entry = entry; - args.arg = arg; - args.len = len; - openfirmware(&args); -} -#else -void -OF_chain(void *virt, u_int size, void (*entry)(), void *arg, u_int len) -{ - /* - * This is a REALLY dirty hack till the firmware gets this going - OF_release(virt, size); - */ - entry(0, 0, openfirmware, arg, len); -} -#endif - -int -OF_call_method(char *method, int ihandle, int nargs, int nreturns, ...) -{ - va_list ap; - static struct { - char *name; - int nargs; - int nreturns; - char *method; - int ihandle; - int args_n_results[12]; - } args = { - "call-method", - 2, - 1, - }; - int *ip, n; - - if (nargs > 6) - return -1; - args.nargs = nargs + 2; - args.nreturns = nreturns + 1; - args.method = method; - args.ihandle = ihandle; - va_start(ap, nreturns); - for (ip = args.args_n_results + (n = nargs); --n >= 0;) - *--ip = va_arg(ap, int); - - if (openfirmware(&args) == -1) { - va_end(ap); - return -1; - } - if (args.args_n_results[nargs]) { - va_end(ap); - return args.args_n_results[nargs]; - } - for (ip = args.args_n_results + nargs + (n = args.nreturns); --n > 0;) - *va_arg(ap, int *) = *--ip; - va_end(ap); - return 0; -} - -static int stdin; -static int stdout; - -static void -setup() -{ - int chosen; - - if ((chosen = OF_finddevice("/chosen")) == -1) - _rtt(); - if (OF_getprop(chosen, "stdin", &stdin, sizeof(stdin)) != sizeof(stdin) - || OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) != - sizeof(stdout)) - _rtt(); - if (stdout == 0) { - /* screen should be console, but it is not open */ - stdout = OF_open("screen"); - } -} - -void -putchar(int c) -{ - char ch = c; - - if (c == '\n') - putchar('\r'); - OF_write(stdout, &ch, 1); -} - -int -getchar() -{ - unsigned char ch = '\0'; - int l; - - while ((l = OF_read(stdin, &ch, 1)) != 1) - if (l != -2 && l != 0) - return -1; - return ch; -} diff --git a/sys/arch/pegasos/stand/Makefile b/sys/arch/pegasos/stand/Makefile deleted file mode 100644 index 218fb2d50bb..00000000000 --- a/sys/arch/pegasos/stand/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# $OpenBSD: Makefile,v 1.1 2003/10/31 03:54:34 drahn Exp $ -# $NetBSD: Makefile,v 1.1 1996/09/30 16:34:59 ws Exp $ - -#SUBDIR= ofwboot mbr tbxidata -SUBDIR= ofwboot mbr - -SAREL= -KERNREL= -KERN_AS=library -Z_AS=library -SA_ZLIB=smth -USE_LOADFILE=yes - -.include "Makefile.inc" -.include "$S/lib/libz/Makefile.inc" -.include "$S/lib/libsa/Makefile.inc" -.include "$S/lib/libkern/Makefile.inc" - -all: ${ZLIB} ${SALIB} ${KERNLIB} _SUBDIRUSE - -libdep: - @echo ${.OBJDIR}/${SALIB} $(KERNLIB) ${ZLIB} - - -${PROG}: - -clean:: _SUBDIRUSE - -cleandir: _SUBDIRUSE - -depend:: _SUBDIRUSE - -.include <bsd.obj.mk> -.include <bsd.subdir.mk> diff --git a/sys/arch/pegasos/stand/Makefile.inc b/sys/arch/pegasos/stand/Makefile.inc deleted file mode 100644 index cc927063a5c..00000000000 --- a/sys/arch/pegasos/stand/Makefile.inc +++ /dev/null @@ -1,31 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.2 2003/11/14 20:09:20 drahn Exp $ -# $NetBSD: Makefile.inc,v 1.1 1996/09/30 16:34:59 ws Exp $ - -.if !defined(__stand_makefile_inc) -__stand_makefile_inc=1 - -KERN_AS= library - -S=$(.CURDIR)/../../../$(R) - -.if !make(libdep) && !make(sadep) && !make(salibdir) && !make(kernlibdir) && !make(obj) && !defined(NOMACHINE) -.BEGIN: - @([ -h machine ] || ln -s $(S)/arch/$(MACHINE)/include machine) -.endif - -# -EXTRACFLAGS= -msoft-float -REAL_VIRT?= -v -ENTRY?= _start - -INCLUDES+= -I. -I$(.OBJDIR) -I$(.CURDIR)/.. -I$(S)/arch -I$(S) -INCLUDES+= -I$(S)/lib/libsa -DEFS+= -DSTANDALONE -CFLAGS+= $(INCLUDES) $(DEFS) $(EXTRACFLAGS) -CFLAGS+= -fno-stack-protector -LDFLAGS?= -X -N -Ttext $(RELOC) -e $(ENTRY) - -cleandir: - rm -rf lib machine - -.endif diff --git a/sys/arch/pegasos/stand/alloc.c b/sys/arch/pegasos/stand/alloc.c deleted file mode 100644 index bc693974455..00000000000 --- a/sys/arch/pegasos/stand/alloc.c +++ /dev/null @@ -1,215 +0,0 @@ -/* $OpenBSD: alloc.c,v 1.1 2003/10/31 03:54:34 drahn Exp $ */ -/* $NetBSD: alloc.c,v 1.1 1997/04/16 20:29:16 thorpej Exp $ */ - -/* - * Copyright (c) 1997 Jason R. Thorpe. All rights reserved. - * Copyright (c) 1997 Christopher G. Demetriou. All rights reserved. - * Copyright (c) 1996 - * Matthias Drochner. All rights reserved. - * Copyright (C) 1995, 1996 Wolfgang Solfrank. - * Copyright (C) 1995, 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Dynamic memory allocator suitable for use with OpenFirmware. - * - * Compile options: - * - * ALLOC_TRACE enable tracing of allocations/deallocations - * - * ALLOC_FIRST_FIT use a first-fit allocation algorithm, rather than - * the default best-fit algorithm. - * - * DEBUG enable debugging sanity checks. - */ - -#include <sys/param.h> -#include <sys/queue.h> - -#include <lib/libsa/stand.h> - -#include <openfirm.h> - -/* - * Each block actually has ALIGN(struct ml) + ALIGN(size) bytes allocated - * to it, as follows: - * - * 0 ... (sizeof(struct ml) - 1) - * allocated or unallocated: holds size of user-data part of block. - * - * sizeof(struct ml) ... (ALIGN(sizeof(struct ml)) - 1) - * allocated: unused - * unallocated: depends on packing of struct fl - * - * ALIGN(sizeof(struct ml)) ... (ALIGN(sizeof(struct ml)) + - * ALIGN(data size) - 1) - * allocated: user data - * unallocated: depends on packing of struct fl - * - * 'next' is only used when the block is unallocated (i.e. on the free list). - * However, note that ALIGN(sizeof(struct ml)) + ALIGN(data size) must - * be at least 'sizeof(struct fl)', so that blocks can be used as structures - * when on the free list. - */ - -/* - * Memory lists. - */ -struct ml { - unsigned size; - LIST_ENTRY(ml) list; -}; - -/* XXX - this is from NetBSD */ -#define LIST_HEAD_INITIALIZER(head) { NULL } - -LIST_HEAD(, ml) freelist = LIST_HEAD_INITIALIZER(freelist); -LIST_HEAD(, ml) allocatedlist = LIST_HEAD_INITIALIZER(allocatedlist); - -#define OVERHEAD ALIGN(sizeof (struct ml)) /* shorthand */ - -void * -alloc(unsigned size) -{ - struct ml *f, *bestf; - unsigned bestsize = 0xffffffff; /* greater than any real size */ - char *help; - int failed; - -#ifdef ALLOC_TRACE - printf("alloc(%u)", size); -#endif - - /* - * Account for overhead now, so that we don't get an - * "exact fit" which doesn't have enough space. - */ - size = ALIGN(size) + OVERHEAD; - -#ifdef ALLOC_FIRST_FIT - /* scan freelist */ - for (f = freelist.lh_first; f != NULL && f->size < size; - f = f->list.le_next) - /* noop */ ; - bestf = f; - failed = (bestf == (struct fl *)0); -#else - /* scan freelist */ - f = freelist.lh_first; - while (f != NULL) { - if (f->size >= size) { - if (f->size == size) /* exact match */ - goto found; - - if (f->size < bestsize) { - /* keep best fit */ - bestf = f; - bestsize = f->size; - } - } - f = f->list.le_next; - } - - /* no match in freelist if bestsize unchanged */ - failed = (bestsize == 0xffffffff); -#endif - - if (failed) { /* nothing found */ - /* - * Allocate memory from the OpenFirmware, rounded - * to page size, and record the chunk size. - */ - size = roundup(size, NBPG); - help = OF_claim(0, size, NBPG); - if (help == (char *)-1) - panic("alloc: out of memory"); - - f = (struct ml *)help; - f->size = size; -#ifdef ALLOC_TRACE - printf("=%lx (new chunk size %u)\n", - (u_long)(help + OVERHEAD), f->f_size); -#endif - goto out; - } - - /* we take the best fit */ - f = bestf; - -found: - /* remove from freelist */ - LIST_REMOVE(f, list); - help = (char *)f; -#ifdef ALLOC_TRACE - printf("=%lx (origsize %u)\n", (u_long)(help + OVERHEAD), f->size); -#endif -out: - /* place on allocated list */ - LIST_INSERT_HEAD(&allocatedlist, f, list); - return (help + OVERHEAD); -} - -void -free(void *ptr, unsigned size) -{ - register struct ml *a = (struct ml *)((char *)ptr - OVERHEAD); - -#ifdef ALLOC_TRACE - printf("free(%lx, %u) (origsize %u)\n", (u_long)ptr, size, a->size); -#endif -#ifdef DEBUG - if (size > a->size) - printf("free %u bytes @%lx, should be <=%u\n", - size, (u_long)ptr, a->size); -#endif - - /* Remove from allocated list, place on freelist. */ - LIST_REMOVE(a, list); - LIST_INSERT_HEAD(&freelist, a, list); -} - -void -freeall() -{ -#ifdef __notyet__ /* Firmware bug ?! */ - struct ml *m; - - /* Release chunks on freelist... */ - while ((m = freelist.lh_first) != NULL) { - LIST_REMOVE(m, list); - OF_release(m, m->size); - } - - /* ...and allocated list. */ - while ((m = allocatedlist.lh_first) != NULL) { - LIST_REMOVE(m, list); - OF_release(m, m->size); - } -#endif /* __notyet__ */ -} diff --git a/sys/arch/pegasos/stand/boot.c b/sys/arch/pegasos/stand/boot.c deleted file mode 100644 index cc9bcf270fa..00000000000 --- a/sys/arch/pegasos/stand/boot.c +++ /dev/null @@ -1,240 +0,0 @@ -/* $OpenBSD: boot.c,v 1.1 2003/10/31 03:54:34 drahn Exp $ */ -/* $NetBSD: boot.c,v 1.1 1997/04/16 20:29:17 thorpej Exp $ */ - -/* - * Copyright (c) 1997 Jason R. Thorpe. All rights reserved. - * Copyright (C) 1995, 1996 Wolfgang Solfrank. - * Copyright (C) 1995, 1996 TooLs GmbH. - * All rights reserved. - * - * ELF support derived from NetBSD/alpha's boot loader, written - * by Christopher G. Demetriou. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * First try for the boot code - * - * Input syntax is: - * [promdev[{:|,}partition]]/[filename] [flags] - */ - -#define ELFSIZE 32 /* We use 32-bit ELF. */ - -#include <sys/param.h> -#include <sys/exec.h> -#include <sys/exec_elf.h> -#include <sys/reboot.h> -#include <sys/disklabel.h> - -#include <lib/libkern/libkern.h> -#include <lib/libsa/stand.h> -#include <lib/libsa/loadfile.h> - - -#include <machine/cpu.h> - -#include "ofdev.h" -#include "openfirm.h" - -char bootdev[128]; -char bootfile[128]; -int boothowto; -int debug; - -static void -prom2boot(char *dev) -{ - char *cp, *lp = 0; - - for (cp = dev; *cp; cp++) - if (*cp == ':') - lp = cp; - if (!lp) - lp = cp; - *lp = 0; -} - -static void -parseargs(char *str, int *howtop) -{ - char *cp; - - /* Allow user to drop back to the PROM. */ - if (strcmp(str, "exit") == 0) - _rtt(); - - *howtop = 0; - if (str[0] == '\0') - return; - - cp = str; - while (*cp != 0) { - /* check for - */ - if (*cp == '-') - break; /* start of options found */ - - while (*cp != 0 && *cp != ' ') - cp++; /* character in the middle of the name, skip */ - - while (*cp == ' ') - *cp++ = 0; - } - if (!*cp) - return; - - *cp++ = 0; - while (*cp) { - switch (*cp++) { - case 'a': - *howtop |= RB_ASKNAME; - break; - case 'c': - *howtop |= RB_CONFIG; - break; - case 's': - *howtop |= RB_SINGLE; - break; - case 'd': - *howtop |= RB_KDB; - debug = 1; - break; - } - } -} - -static void -chain(void (*entry)(), char *args, void *ssym, void *esym) -{ - extern char end[]; - int l, machine_tag; - - freeall(); - - /* - * Stash pointer to end of symbol table after the argument - * strings. - */ - l = strlen(args) + 1; - bcopy(&ssym, args + l, sizeof(ssym)); - l += sizeof(ssym); - bcopy(&esym, args + l, sizeof(esym)); - l += sizeof(esym); - -#ifdef __notyet__ - /* - * Tell the kernel we're an OpenFirmware system. - */ - machine_tag = POWERPC_MACHINE_OPENFIRMWARE; - bcopy(&machine_tag, args + l, sizeof(machine_tag)); - l += sizeof(machine_tag); -#endif - - OF_chain((void *)RELOC, end - (char *)RELOC, entry, args, l); - panic("chain"); -} - -int -main() -{ - int chosen; - char bootline[512]; /* Should check size? */ - char *cp; - u_long marks[MARK_MAX]; - u_int32_t entry; - void *ssym, *esym; - int fd; - - printf("\n>> OpenBSD/pegasos Boot\n"); - - /* - * Get the boot arguments from Openfirmware - */ - if ((chosen = OF_finddevice("/chosen")) == -1 || - OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 || - OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) { - printf("Invalid Openfirmware environment\n"); - exit(); - } - prom2boot(bootdev); - parseargs(bootline, &boothowto); - for (;;) { - if (boothowto & RB_ASKNAME) { - printf("Boot (or \"exit\"): "); - gets(bootline); - parseargs(bootline, &boothowto); - } - marks[MARK_START] = 0; - if (loadfile(bootline, marks, LOAD_ALL) >= 0) - break; - if (errno) - printf("open %s: %s\n", opened_name, strerror(errno)); - boothowto |= RB_ASKNAME; - } -#ifdef __notyet__ - OF_setprop(chosen, "bootpath", opened_name, strlen(opened_name) + 1); - cp = bootline; -#else - strlcpy(bootline, opened_name, sizeof bootline); - cp = bootline + strlen(bootline); - *cp++ = ' '; -#endif - *cp = '-'; - if (boothowto & RB_ASKNAME) - *++cp = 'a'; - if (boothowto & RB_CONFIG) - *++cp = 'c'; - if (boothowto & RB_SINGLE) - *++cp = 's'; - if (boothowto & RB_KDB) - *++cp = 'd'; - if (*cp == '-') -#ifdef __notyet__ - *cp = 0; -#else - *--cp = 0; -#endif - else - *++cp = 0; -#ifdef __notyet__ - OF_setprop(chosen, "bootargs", bootline, strlen(bootline) + 1); -#endif - entry = marks[MARK_ENTRY]; - ssym = (void *)marks[MARK_SYM]; - esym = (void *)marks[MARK_END]; -/* - printf("kernel is something like %x-%x\n", - marks[MARK_START], marks[MARK_END]); - OF_claim((void*)(marks[MARK_START] & ~0xfff), - (marks[MARK_END]-marks[MARK_START]+0xfff) & ~0xfff, 0); -*/ - - chain((void *)entry, bootline, ssym, esym); - - _rtt(); - return 0; -} diff --git a/sys/arch/pegasos/stand/cache.c b/sys/arch/pegasos/stand/cache.c deleted file mode 100644 index 127e46759cd..00000000000 --- a/sys/arch/pegasos/stand/cache.c +++ /dev/null @@ -1,20 +0,0 @@ -/* $OpenBSD: cache.c,v 1.1 2003/10/31 03:54:34 drahn Exp $ */ -#define CACHELINESIZE 32 /* For now XXX */ - -void -syncicache(void *from, int len) -{ - int l = len; - void *p = from; - - do { - asm volatile ("dcbf %1,%0" :: "r"(p), "r"(0)); - p += CACHELINESIZE; - } while ((l -= CACHELINESIZE) > 0); - asm volatile ("sync"); - do { - asm volatile ("icbi %1,%0" :: "r"(from), "r"(0)); - from += CACHELINESIZE; - } while ((len -= CACHELINESIZE) > 0); - asm volatile ("isync"); -} diff --git a/sys/arch/pegasos/stand/mbr/Makefile b/sys/arch/pegasos/stand/mbr/Makefile deleted file mode 100644 index d1844822b21..00000000000 --- a/sys/arch/pegasos/stand/mbr/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $OpenBSD: Makefile,v 1.1 2003/10/31 03:54:34 drahn Exp $ - -CLEANFILES= mbr - -all: mbr - -mbr: - dd if=/dev/zero of=mbr bs=512 count=1 - -realinstall: - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 mbr ${DESTDIR}/usr/mdec - - -.include <bsd.prog.mk> diff --git a/sys/arch/pegasos/stand/net.c b/sys/arch/pegasos/stand/net.c deleted file mode 100644 index 664d68c3ea1..00000000000 --- a/sys/arch/pegasos/stand/net.c +++ /dev/null @@ -1,151 +0,0 @@ -/* $OpenBSD: net.c,v 1.1 2003/10/31 03:54:34 drahn Exp $ */ -/* $NetBSD: net.c,v 1.1 1997/04/16 20:29:18 thorpej Exp $ */ - -/* - * Copyright (C) 1995 Wolfgang Solfrank. - * Copyright (C) 1995 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This module implements a "raw device" interface suitable for - * use by the stand-alone I/O library NFS code. This interface - * does not support any "block" access, and exists only for the - * purpose of initializing the network interface, getting boot - * parameters, and performing the NFS mount. - * - * At open time, this does: - * - * find interface - netif_open() - * BOOTP - bootp() - * RPC/mountd - nfs_mount() - * - * The root file handle from mountd is saved in a global - * for use by the NFS open code (NFS/lookup). - * - * Note: this is based in part on sys/arch/sparc/stand/net.c - */ - -#include <sys/param.h> -#include <sys/socket.h> -#include <net/if.h> -#include <netinet/in.h> -#include <netinet/if_ether.h> -#include <netinet/in_systm.h> - -#include <lib/libsa/stand.h> -#include <lib/libsa/net.h> -#include <lib/libsa/netif.h> - -char rootpath[FNAME_SIZE]; - -static int netdev_sock = -1; -static int open_count; - -/* - * Called by devopen after it sets f->f_dev to our devsw entry. - * This opens the low-level device and sets f->f_devdata. - */ -int -net_open(struct of_dev *op) -{ - int error = 0; - - /* - * On first open, do netif open, mount, etc. - */ - if (open_count == 0) { - /* Find network interface. */ - if ((netdev_sock = netif_open(op)) < 0) { - error = errno; - goto bad; - } - if ((error = net_mountroot()) != 0) - goto bad; - } - open_count++; -bad: - if (netdev_sock >= 0 && open_count == 0) { - netif_close(netdev_sock); - netdev_sock = -1; - } - return error; -} - -int -net_close(struct of_dev *op) -{ - /* - * On last close, do netif close, etc. - */ - if (open_count > 0) - if (--open_count == 0) { - netif_close(netdev_sock); - netdev_sock = -1; - } -} - -int -net_mountroot() -{ - -#ifdef DEBUG - printf("net_mountroot\n"); -#endif - - /* - * Get info for NFS boot: our IP address, out hostname, - * server IP address, and our root path on the server. - * We use BOOTP (RFC951, RFC1532) exclusively as mandated - * by PowerPC Reference Platform Specification I.4.2 - */ - - bootp(netdev_sock); - - if (myip.s_addr == 0) - return ETIMEDOUT; - - printf("Using IP address: %s\n", inet_ntoa(myip)); - -#ifdef DEBUG - printf("myip: %s (%s)", hostname, inet_ntoa(myip)); - if (gateip.s_addr) - printf(", gateip: %s", inet_ntoa(gateip)); - if (netmask) - printf(", netmask: %s", intoa(netmask)); - printf("\n"); -#endif - printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath); - - /* - * Get the NFS file handle (mount). - */ - if (nfs_mount(netdev_sock, rootip, rootpath) < 0) - return errno; - return 0; -} diff --git a/sys/arch/pegasos/stand/netif_of.c b/sys/arch/pegasos/stand/netif_of.c deleted file mode 100644 index 865339deb0d..00000000000 --- a/sys/arch/pegasos/stand/netif_of.c +++ /dev/null @@ -1,242 +0,0 @@ -/* $OpenBSD: netif_of.c,v 1.1 2003/10/31 03:54:34 drahn Exp $ */ -/* $NetBSD: netif_of.c,v 1.1 1997/04/16 20:29:19 thorpej Exp $ */ - -/* - * Copyright (C) 1995 Wolfgang Solfrank. - * Copyright (C) 1995 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Open Firmware does most of the job for interfacing to the hardware, - * so it is easiest to just replace the netif module with - * this adaptation to the PROM network interface. - * - * Note: this is based in part on sys/arch/sparc/stand/netif_sun.c - */ - -#include <sys/param.h> -#include <sys/socket.h> - -#if 0 /* XXX thorpej */ -#include <string.h> -#include <time.h> -#endif - -#include <net/if.h> - -#include <netinet/in.h> -#include <netinet/if_ether.h> -#include <netinet/in_systm.h> - -#include <lib/libsa/stand.h> -#include <lib/libsa/net.h> -#include <lib/libsa/netif.h> - -#include "ofdev.h" -#include "openfirm.h" - -static struct netif netif_of; - -struct iodesc sockets[SOPEN_MAX]; - -struct iodesc * -socktodesc(int sock) -{ - if (sock != 0) - return NULL; - return sockets; -} - -int -netif_open(void *machdep_hint) -{ - struct of_dev *op = machdep_hint; - struct iodesc *io; - int fd, error; - char addr[32]; - -#ifdef NETIF_DEBUG - printf("netif_open..."); -#endif - /* find a free socket */ - io = sockets; - if (io->io_netif) { -#ifdef NETIF_DEBUG - printf("device busy\n"); -#endif - errno = ENFILE; - return -1; - } - bzero(io, sizeof *io); - - netif_of.nif_devdata = op; - io->io_netif = &netif_of; - - /* Put our ethernet address in io->myea */ - OF_getprop(OF_instance_to_package(op->handle), - "local-mac-address", io->myea, sizeof io->myea) == -1 && - OF_getprop(OF_instance_to_package(op->handle), - "mac-address", io->myea, sizeof io->myea); - -#ifdef NETIF_DEBUG - printf("OK\n"); -#endif - return 0; -} - -int -netif_close(int fd) -{ - struct iodesc *io; - struct netif *ni; - -#ifdef NETIF_DEBUG - printf("netif_close(%x)...", fd); -#endif - if (fd != 0) { -#ifdef NETIF_DEBUG - printf("EBADF\n"); -#endif - errno = EBADF; - return -1; - } - - io = &sockets[fd]; - ni = io->io_netif; - if (ni != NULL) { - ni->nif_devdata = NULL; - io->io_netif = NULL; - } -#ifdef NETIF_DEBUG - printf("OK\n"); -#endif - return 0; -} - -/* - * Send a packet. The ether header is already there. - * Return the length sent (or -1 on error). - */ -ssize_t -netif_put(struct iodesc *desc, void *pkt, size_t len) -{ - struct of_dev *op; - ssize_t rv; - size_t sendlen; - - op = desc->io_netif->nif_devdata; - -#ifdef NETIF_DEBUG - { - struct ether_header *eh; - - printf("netif_put: desc=0x%x pkt=0x%x len=%d\n", - desc, pkt, len); - eh = pkt; - printf("dst: %s ", ether_sprintf(eh->ether_dhost)); - printf("src: %s ", ether_sprintf(eh->ether_shost)); - printf("type: 0x%x\n", eh->ether_type & 0xFFFF); - } -#endif - - sendlen = len; - if (sendlen < 60) { - sendlen = 60; -#ifdef NETIF_DEBUG - printf("netif_put: length padded to %d\n", sendlen); -#endif - } - - if (op->dmabuf) { - bcopy(pkt, op->dmabuf, sendlen); - pkt = op->dmabuf; - } - rv = OF_write(op->handle, pkt, sendlen); - -#ifdef NETIF_DEBUG - printf("netif_put: xmit returned %d\n", rv); -#endif - - return rv; -} - -/* - * Receive a packet, including the ether header. - * Return the total length received (or -1 on error). - */ -ssize_t -netif_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timo) -{ - struct of_dev *op; - int tick0, tmo_ms; - int len; - - op = desc->io_netif->nif_devdata; - -#ifdef NETIF_DEBUG - printf("netif_get: pkt=0x%x, maxlen=%d, tmo=%d\n", - pkt, maxlen, timo); -#endif - - tmo_ms = timo * 1000; - tick0 = OF_milliseconds(); - - do { - len = OF_read(op->handle, pkt, maxlen); - } while ((len == -2 || len == 0) && - ((OF_milliseconds() - tick0) < tmo_ms)); - -#ifdef NETIF_DEBUG - printf("netif_get: received len=%d\n", len); -#endif - - if (len < 12) - return -1; - -#ifdef NETIF_DEBUG - { - struct ether_header *eh = pkt; - - printf("dst: %s ", ether_sprintf(eh->ether_dhost)); - printf("src: %s ", ether_sprintf(eh->ether_shost)); - printf("type: 0x%x\n", eh->ether_type & 0xFFFF); - } -#endif - - return len; -} - -/* - * Shouldn't really be here, but is used solely for networking, so... - */ -time_t -getsecs() -{ - return OF_milliseconds() / 1000; -} diff --git a/sys/arch/pegasos/stand/ofdev.c b/sys/arch/pegasos/stand/ofdev.c deleted file mode 100644 index 73d0c33ef0e..00000000000 --- a/sys/arch/pegasos/stand/ofdev.c +++ /dev/null @@ -1,484 +0,0 @@ -/* $OpenBSD: ofdev.c,v 1.2 2003/11/14 20:12:04 drahn Exp $ */ -/* $NetBSD: ofdev.c,v 1.1 1997/04/16 20:29:20 thorpej Exp $ */ - -/* - * Copyright (C) 1995, 1996 Wolfgang Solfrank. - * Copyright (C) 1995, 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Device I/O routines using Open Firmware - */ -#include <sys/param.h> -#include <sys/disklabel.h> -#include <netinet/in.h> - -#include <lib/libsa/stand.h> -#include <lib/libsa/ufs.h> -#include <lib/libsa/cd9660.h> -#include <lib/libsa/nfs.h> -#include <offs.h> - -#include "ofdev.h" - -extern char bootdev[]; - -static char * -filename(char *str, char *ppart) -{ - char *cp, *lp; - char savec; - int dhandle; - char devtype[16]; - - lp = str; - devtype[0] = 0; - *ppart = 0; - for (cp = str; *cp; lp = cp) { - /* For each component of the path name... */ - while (*++cp && *cp != '/') - ; - savec = *cp; - *cp = 0; - /* ...look whether there is a device with this name */ - dhandle = OF_finddevice(str); - *cp = savec; - if (dhandle == -1) { - /* - * if not, lp is the delimiter between device and path - */ - - /* if the last component was a block device... */ - if (!strcmp(devtype, "block")) { - /* search for arguments */ - for (cp = lp; - --cp >= str && *cp != '/' && *cp != ':';) - ; - if (cp >= str && *cp == ':') { - /* found arguments */ - for (cp = lp; - *--cp != ':' && *cp != ',';) - ; - if (*++cp >= 'a' && - *cp <= 'a' + MAXPARTITIONS) - *ppart = *cp; - } - } - return lp; - } else if (OF_getprop(dhandle, "device_type", devtype, - sizeof devtype) < 0) - devtype[0] = 0; - } - return 0; -} - -static int -strategy(void *devdata, int rw, daddr_t blk, size_t size, void *buf, - size_t *rsize) -{ - struct of_dev *dev = devdata; - u_quad_t pos; - int n; - - if (rw != F_READ) - return EPERM; - if (dev->type != OFDEV_DISK) - panic("strategy"); - - pos = (u_quad_t)(blk + dev->partoff) * dev->bsize; - - for (;;) { - if (OF_seek(dev->handle, pos) < 0) - break; - n = OF_read(dev->handle, buf, size); - if (n == -2) - continue; - if (n < 0) - break; - *rsize = n; - return 0; - } - return EIO; -} - -static int -devclose(struct open_file *of) -{ - struct of_dev *op = of->f_devdata; - - if (op->type == OFDEV_NET) - net_close(op); - if (op->dmabuf) - OF_call_method("dma-free", op->handle, 2, 0, - op->dmabuf, MAXPHYS); - - OF_close(op->handle); - op->handle = -1; -} - -static struct devsw devsw[1] = { - "OpenFirmware", - strategy, - (int (*)(struct open_file *, ...))nodev, - devclose, - noioctl -}; -int ndevs = sizeof devsw / sizeof devsw[0]; - -static struct fs_ops file_system_ufs = { - ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat -}; -static struct fs_ops file_system_cd9660 = { - cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek, - cd9660_stat -}; -static struct fs_ops file_system_offs = { - offs_open, offs_close, offs_read, offs_write, offs_seek, offs_stat -}; -static struct fs_ops file_system_nfs = { - nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat -}; - -struct fs_ops file_system[3]; -int nfsys; - -static struct of_dev ofdev = { - -1, -}; - -char opened_name[256]; - -static u_long -get_long(p) - const void *p; -{ - const unsigned char *cp = p; - - return cp[0] | (cp[1] << 8) | (cp[2] << 16) | (cp[3] << 24); -} - -int -read_mac_label(struct of_dev *devp, char *buf, struct disklabel *lp) -{ - struct part_map_entry *part; - size_t read; - int part_cnt; - int i; - char *s; - - if ((strategy(devp, F_READ, 1, DEV_BSIZE, buf, &read) != 0) || - (read != DEV_BSIZE)) - return ERDLAB; - - part = (struct part_map_entry *)buf; - - /* if first partition is not valid, assume not HFS/DPME partitioned */ - if (part->pmSig != PART_ENTRY_MAGIC) - return ERDLAB; - - part_cnt = part->pmMapBlkCnt; - - /* first search for "OpenBSD" partition type - * standard bsd disklabel lives inside at offset 0 - * otherwise, we should fake a bsd partition - * with first HFS partition starting at 'i' - * ? will this cause problems with booting bsd.rd from offs - */ - for (i = 0; i < part_cnt; i++) { - /* read the appropriate block */ - if ((strategy(devp, F_READ, 1+i, DEV_BSIZE, buf, &read) != 0) - || (read != DEV_BSIZE)) - return ERDLAB; - - part = (struct part_map_entry *)buf; - /* toupper the string, in case caps are different... */ - for (s = part->pmPartType; *s; s++) - if ((*s >= 'a') && (*s <= 'z')) - *s = (*s - 'a' + 'A'); - - if (0 == strcmp(part->pmPartType, PART_TYPE_OPENBSD)) { - /* FOUND OUR PARTITION!!! */ - printf("found OpenBSD DPME partition\n"); - if(strategy(devp, F_READ, part->pmPyPartStart, - DEV_BSIZE, buf, &read) == 0 - && read == DEV_BSIZE) - { - if (!getdisklabel(buf, lp)) - return 0; - - /* If we have an OpenBSD region - * but no valid parition table, - * we cannot load a kernel from - * it, punt. - * should not have more than one - * OpenBSD of DPME type. - */ - return ERDLAB; - } - } - } - return ERDLAB; -} - -/* - * Search for RDB OpenBSD paritition. - */ -int -read_rdb_label(struct of_dev *devp, char *buf, struct disklabel *lp) -{ - struct rdblock *rdp; - struct partblock *pbp; - struct partition *pp; - size_t read; - int part_cnt; - int nextb; - int rdbpart; - int i; - char *s; - - for (nextb = 0; nextb < RDB_MAXBLOCKS; nextb++) { - if ((strategy(devp, F_READ, nextb, DEV_BSIZE, buf, &read) - != 0) || (read != DEV_BSIZE)) - return ERDLAB; - rdp = (struct rdblock *)buf; - - /* skips checksum */ - if (rdp->id == RDBLOCK_ID) - break; - } - if (nextb == RDB_MAXBLOCKS) - return ERDLAB; - for (nextb = rdp->partbhead; nextb != RDBNULL; nextb = pbp->next) { - if ((strategy(devp, F_READ, nextb, DEV_BSIZE, buf, &read) - != 0) || (read != DEV_BSIZE)) - return ERDLAB; - pbp = (struct partblock *)buf; - if (pbp->id != PARTBLOCK_ID) - return ERDLAB; - /* skips checksum */ - if (pbp->e.dostype == DOST_OBSD) { - rdbpart = pbp->e.lowcyl * pbp->e.secpertrk; - break; - } - } - if (nextb == RDBNULL) - return ERDLAB; - - printf("found OpenBSD RDB partition\n"); - if(strategy(devp, F_READ, rdbpart, DEV_BSIZE, buf, &read) == 0 - && read == DEV_BSIZE) - { - if (!getdisklabel(buf, lp)) - return 0; - - /* If we have an OpenBSD region - * but no valid parition table, - * we cannot load a kernel from - * it, punt. - * should not have more than one - * RDB of OpenBSD type. - */ - return ERDLAB; - } - - return ERDLAB; -} - -/* - * Find a valid disklabel. - */ -static int -search_label(struct of_dev *devp, u_long off, char *buf, struct disklabel *lp, - u_long off0) -{ - size_t read; - struct dos_partition *p; - int i; - u_long poff; - static int recursion; - - if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) || - read != DEV_BSIZE) - return ERDLAB; - - if (buf[510] != 0x55 || buf[511] != 0xaa) - return ERDLAB; - - if (recursion++ <= 1) - off0 += off; - for (p = (struct dos_partition *)(buf + DOSPARTOFF), i = 4; - --i >= 0; p++) { - if (p->dp_typ == DOSPTYP_OPENBSD || - p->dp_typ == DOSPTYP_NETBSD) { - poff = get_long(&p->dp_start) + off0; - if (strategy(devp, F_READ, poff + LABELSECTOR, - DEV_BSIZE, buf, &read) == 0 - && read == DEV_BSIZE) { - if (!getdisklabel(buf, lp)) { - recursion--; - return 0; - } - } - if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) - || read != DEV_BSIZE) { - recursion--; - return ERDLAB; - } - } else if (p->dp_typ == DOSPTYP_EXTEND) { - poff = get_long(&p->dp_start); - if (!search_label(devp, poff, buf, lp, off0)) { - recursion--; - return 0; - } - if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) - || read != DEV_BSIZE) { - recursion--; - return ERDLAB; - } - } - } - recursion--; - return ERDLAB; -} - -int -devopen(struct open_file *of, const char *name, char **file) -{ - char *cp; - char partition; - char fname[256]; - char buf[DEV_BSIZE]; - struct disklabel label; - int handle, part; - size_t read; - int error = 0; - - if (ofdev.handle != -1) - panic("devopen"); - if (of->f_flags != F_READ) - return EPERM; - strlcpy(fname, name, sizeof fname); - cp = filename(fname, &partition); - if (cp) { - strlcpy(buf, cp, sizeof buf); - *cp = 0; - } - if (!cp || !*buf) - strlcpy(buf, DEFAULT_KERNEL, sizeof buf); - if (!*fname) - strlcpy(fname, bootdev, sizeof fname); - strlcpy(opened_name, fname, sizeof opened_name); - if (partition) { - cp = opened_name + strlen(opened_name); - *cp++ = ':'; - *cp++ = partition; - *cp = 0; - } - if (*buf != '/') - strlcat(opened_name, "/", sizeof opened_name); - strlcat(opened_name, buf, sizeof opened_name); - *file = opened_name + strlen(fname) + 1; - if ((handle = OF_finddevice(fname)) == -1) - return ENOENT; - if (OF_getprop(handle, "name", buf, sizeof buf) < 0) - return ENXIO; - if (OF_getprop(handle, "device_type", buf, sizeof buf) < 0) - return ENXIO; - if (!strcmp(buf, "block")) - /* - * For block devices, indicate raw partition - * (:0 in OpenFirmware) - */ - strlcat(fname, ":0", sizeof fname); - if ((handle = OF_open(fname)) == -1) - return ENXIO; - bzero(&ofdev, sizeof ofdev); - ofdev.handle = handle; - ofdev.dmabuf = NULL; - OF_call_method("dma-alloc", handle, 1, 1, MAXPHYS, &ofdev.dmabuf); - if (!strcmp(buf, "block")) { - ofdev.type = OFDEV_DISK; - ofdev.bsize = DEV_BSIZE; - /* First try to find a disklabel without MBR partitions */ - if (strategy(&ofdev, F_READ, - LABELSECTOR, DEV_BSIZE, buf, &read) != 0 || - read != DEV_BSIZE || - getdisklabel(buf, &label)) { - /* Else try MBR partitions */ - - error = read_rdb_label(&ofdev, buf, &label); - if (error == ERDLAB) - error = read_mac_label(&ofdev, buf, &label); - - if (error == ERDLAB) - error = search_label(&ofdev, 0, buf, &label, 0); - - if (error && error != ERDLAB) - goto bad; - } - - if (error == ERDLAB) { - if (partition) - /* - * User specified a partition, - * but there is none - */ - goto bad; - /* No label, just use complete disk */ - ofdev.partoff = 0; - } else { - part = partition ? partition - 'a' : 0; - ofdev.partoff = label.d_partitions[part].p_offset; - } - - of->f_dev = devsw; - of->f_devdata = &ofdev; - bcopy(&file_system_ufs, file_system, sizeof file_system[0]); - bcopy(&file_system_cd9660, file_system + 1, - sizeof file_system[0]); - bcopy(&file_system_offs, file_system + 2, - sizeof file_system[0]); - nfsys = 3; - return 0; - } - if (!strcmp(buf, "network")) { - ofdev.type = OFDEV_NET; - of->f_dev = devsw; - of->f_devdata = &ofdev; - bcopy(&file_system_nfs, file_system, sizeof file_system[0]); - nfsys = 1; - if (error = net_open(&ofdev)) - goto bad; - return 0; - } - error = EFTYPE; -bad: - OF_close(handle); - ofdev.handle = -1; - return error; -} diff --git a/sys/arch/pegasos/stand/ofdev.h b/sys/arch/pegasos/stand/ofdev.h deleted file mode 100644 index f2d966b7267..00000000000 --- a/sys/arch/pegasos/stand/ofdev.h +++ /dev/null @@ -1,53 +0,0 @@ -/* $OpenBSD: ofdev.h,v 1.1 2003/10/31 03:54:34 drahn Exp $ */ -/* $NetBSD: ofdev.h,v 1.1 1997/04/16 20:29:22 thorpej Exp $ */ - -/* - * Copyright (C) 1995, 1996 Wolfgang Solfrank. - * Copyright (C) 1995, 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _STAND_DEV_H_ -#define _STAND_DEV_H_ - -struct of_dev { - int handle; - int type; - u_long partoff; - int bsize; - void *dmabuf; -}; - -/* Known types: */ -#define OFDEV_NET 1 -#define OFDEV_DISK 2 - -#define DEFAULT_KERNEL "/bsd" - -extern char opened_name[]; - -#endif diff --git a/sys/arch/pegasos/stand/offs.c b/sys/arch/pegasos/stand/offs.c deleted file mode 100644 index a7d481c3045..00000000000 --- a/sys/arch/pegasos/stand/offs.c +++ /dev/null @@ -1,115 +0,0 @@ -/* $OpenBSD: offs.c,v 1.1 2003/10/31 03:54:34 drahn Exp $ */ -/* $NetBSD: hfs.c,v 1.1 2000/11/14 11:25:35 tsubai Exp $ */ - -/*- - * Copyright (c) 2000 Tsubai Masanari. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <lib/libkern/libkern.h> -#include <lib/libsa/stand.h> - -#include <openfirm.h> -#include <offs.h> - -static int OF_fd; /* XXX */ - -int -offs_open(char *path, struct open_file *f) -{ - int chosen; - char bootpath[128], *cp; - - if ((chosen = OF_finddevice("/chosen")) == -1) - return ENXIO; - bzero(bootpath, sizeof bootpath); - OF_getprop(chosen, "bootpath", bootpath, sizeof bootpath); - -#ifdef HAVE_STAND_STRRCHR - cp = strrchr(bootpath, ','); -#else - cp = bootpath; - cp += strlen(bootpath); - for (; *cp != ','; cp--) { - if (cp == bootpath) { - cp = NULL; - break; - } - } -#endif - if (cp == NULL) - return ENXIO; - - strlcpy(cp + 1, path, bootpath + sizeof bootpath - (cp + 1)); - OF_fd = OF_open(bootpath); - if (OF_fd == -1) - return ENOENT; - return 0; -} - -int -offs_close(struct open_file *f) -{ - OF_close(OF_fd); - return 0; -} - -int -offs_read(struct open_file *f, void *start, size_t size, size_t *resid) -{ - int len; - - len = OF_read(OF_fd, start, size); - size -= len; - if (resid) - *resid = size; - return 0; -} - -int -offs_write(struct open_file *f, void *start, size_t size, size_t *resid) -{ - printf("offs_write\n"); - return ENXIO; -} - -off_t -offs_seek(struct open_file *f, off_t offset, int where) -{ - switch (where) { - case SEEK_SET: - return OF_seek(OF_fd, offset); - case SEEK_CUR: - case SEEK_END: - default: - return -1; - } -} - -int -offs_stat(struct open_file *f, struct stat *sb) -{ - return 0; -} diff --git a/sys/arch/pegasos/stand/offs.h b/sys/arch/pegasos/stand/offs.h deleted file mode 100644 index 4415f9f7623..00000000000 --- a/sys/arch/pegasos/stand/offs.h +++ /dev/null @@ -1,9 +0,0 @@ -/* $OpenBSD: offs.h,v 1.1 2003/10/31 03:54:34 drahn Exp $ */ -/* $NetBSD: hfs.h,v 1.1 2000/11/14 11:25:35 tsubai Exp $ */ - -int offs_open(char *, struct open_file *); -int offs_close(struct open_file *); -int offs_read(struct open_file *, void *, size_t, size_t *); -int offs_write(struct open_file *, void *, size_t, size_t *); -off_t offs_seek(struct open_file *, off_t, int); -int offs_stat(struct open_file *, struct stat *); diff --git a/sys/arch/pegasos/stand/ofwboot/Makefile b/sys/arch/pegasos/stand/ofwboot/Makefile deleted file mode 100644 index 95474db815e..00000000000 --- a/sys/arch/pegasos/stand/ofwboot/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# $OpenBSD: Makefile,v 1.2 2003/11/14 20:08:18 drahn Exp $ -# $NetBSD: Makefile,v 1.2 1997/04/17 07:46:24 thorpej Exp $ - -S= ${.CURDIR}/../../../.. -R=../ - -PROG= ofwboot -SRCS= Locore.c boot.c ofdev.c net.c netif_of.c alloc.c cache.c offs.c -.PATH: ${S}/arch/pegasos/stand -SRCS+= ofwmagic.S -#CFLAGS+= -DDEBUG -DNETIF_DEBUG -NOMAN= -STRIPFLAG= -BINMODE= 444 -OBJCOPY?= objcopy -SAREL= -BINDIR= /usr/mdec - -NEWVERSWHAT= "OpenFirmware Boot" - -# For now... -RELOC= 0x400120 - -ENTRY= _start - -CPPFLAGS+= -I. -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. -CPPFLAGS+= -DRELOC=${RELOC} -CPPFLAGS+= -DPOWERPC_BOOT_ELF - -LIBS!= cd $(.CURDIR)/$(R); $(MAKE) libdep - -${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} - ${LD} -N -X -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \ - ${OBJS} ${LIBS} - -.include <bsd.prog.mk> diff --git a/sys/arch/pegasos/stand/ofwboot/version b/sys/arch/pegasos/stand/ofwboot/version deleted file mode 100644 index 28c68d3c33f..00000000000 --- a/sys/arch/pegasos/stand/ofwboot/version +++ /dev/null @@ -1,6 +0,0 @@ -$OpenBSD: version,v 1.1 2003/10/31 03:54:34 drahn Exp $ -$NetBSD: version,v 1.3 1997/04/19 01:40:08 thorpej Exp $ - -1.1: Boot program for OpenFirmware; initial revision -1.2: Boot program rearrangement -1.3: Added support for loading ELF kernels diff --git a/sys/arch/pegasos/stand/ofwmagic.S b/sys/arch/pegasos/stand/ofwmagic.S deleted file mode 100644 index de3fe03164a..00000000000 --- a/sys/arch/pegasos/stand/ofwmagic.S +++ /dev/null @@ -1,75 +0,0 @@ -/* $OpenBSD: ofwmagic.S,v 1.1 2003/10/31 03:54:34 drahn Exp $ */ -/* $NetBSD: ofwmagic.S,v 1.1 1997/04/16 21:19:00 thorpej Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 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. - */ - -/* - * Magic note section used by OpenFirmware. - */ - - .section ".note" - - # note header - - # length of name - .long 8 - - # note descriptor size - .long 20 - - # note type (IEEE 1275) - .long 0x1275 - - # name of owner - .asciz "PowerPC" - .balign 4 - - - # note descriptor - - # real mode (-1) or virtual mode (0) - .long 0 - - # real-base - .long -1 - # real-size - .long -1 - - # virt-base - .long -1 - # virt-size - .long -1 diff --git a/sys/arch/pegasos/stand/openfirm.h b/sys/arch/pegasos/stand/openfirm.h deleted file mode 100644 index c096d0e4eea..00000000000 --- a/sys/arch/pegasos/stand/openfirm.h +++ /dev/null @@ -1,56 +0,0 @@ -/* $OpenBSD: openfirm.h,v 1.1 2003/10/31 03:54:34 drahn Exp $ */ -/* $NetBSD: openfirm.h,v 1.1 1997/04/16 20:29:23 thorpej Exp $ */ - -/* - * Copyright (C) 1995, 1996 Wolfgang Solfrank. - * Copyright (C) 1995, 1996 TooLs GmbH. - * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Prototypes for Openfirmware Interface Routines - */ - -#include <sys/cdefs.h> -#include <sys/types.h> - -int OF_finddevice(char *name); -int OF_instance_to_package(int ihandle); -int OF_getprop(int handle, char *prop, void *buf, int buflen); -#ifdef __notyet__ -int OF_setprop(int handle, char *prop, void *buf, int len); -#endif -int OF_open(char *dname); -void OF_close(int handle); -int OF_write(int handle, void *addr, int len); -int OF_read(int handle, void *addr, int len); -int OF_seek(int handle, u_quad_t pos); -void *OF_claim(void *virt, u_int size, u_int align); -void OF_release(void *virt, u_int size); -int OF_milliseconds(void); -void OF_chain(void *addr, u_int size, void (*entry)(), void *parm, u_int parmlen); - diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index 28484d87058..e714047c2c5 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com.c,v 1.95 2003/10/31 04:07:10 drahn Exp $ */ +/* $OpenBSD: com.c,v 1.96 2004/05/03 15:18:21 drahn Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /* @@ -1460,8 +1460,6 @@ comcnprobe(cp) bus_space_tag_t iot = &arc_bus_io; #elif defined(hppa) bus_space_tag_t iot = &hppa_bustag; -#elif defined(__pegasos__) - bus_space_tag_t iot = MD_ISA_IOT; #else bus_space_tag_t iot = 0; #endif diff --git a/sys/dev/pci/pciide.c b/sys/dev/pci/pciide.c index 1e1e9ae5a82..6c39d238137 100644 --- a/sys/dev/pci/pciide.c +++ b/sys/dev/pci/pciide.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pciide.c,v 1.163 2004/03/12 19:10:07 grange Exp $ */ +/* $OpenBSD: pciide.c,v 1.164 2004/05/03 15:18:21 drahn Exp $ */ /* $NetBSD: pciide.c,v 1.127 2001/08/03 01:31:08 tsutsui Exp $ */ /* @@ -916,13 +916,6 @@ pciide_mapregs_native(pa, cp, cmdsizep, ctlsizep, pci_intr) sc->sc_pci_ih = pci_intr_establish(pa->pa_pc, intrhandle, IPL_BIO, pci_intr, sc, sc->sc_wdcdev.sc_dev.dv_xname); -#ifdef __pegasos__ - /* stupid broken board */ - if (intrhandle == 0xe) - pci_intr_establish(pa->pa_pc, - 0xf, IPL_BIO, pci_intr, sc, - sc->sc_wdcdev.sc_dev.dv_xname); -#endif #else sc->sc_pci_ih = pci_intr_establish(pa->pa_pc, intrhandle, IPL_BIO, pci_intr, sc); diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c index a2ede396e7e..48b55c65a2c 100644 --- a/sys/dev/pci/vga_pci.c +++ b/sys/dev/pci/vga_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vga_pci.c,v 1.16 2004/02/04 20:03:28 drahn Exp $ */ +/* $OpenBSD: vga_pci.c,v 1.17 2004/05/03 15:18:21 drahn Exp $ */ /* $NetBSD: vga_pci.c,v 1.3 1998/06/08 06:55:58 thorpej Exp $ */ /*- @@ -285,10 +285,6 @@ vga_pci_mmap(void *v, off_t off, int prot) #endif } #endif -#ifdef __pegasos__ - /* XXX */ - return off; -#endif return -1; } |