diff options
Diffstat (limited to 'sys/arch/socppc')
101 files changed, 0 insertions, 12419 deletions
diff --git a/sys/arch/socppc/Makefile b/sys/arch/socppc/Makefile deleted file mode 100644 index 684cb8c0451..00000000000 --- a/sys/arch/socppc/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# $OpenBSD: Makefile,v 1.11 2017/01/22 03:27:31 tb Exp $ - -.include <bsd.own.mk> # for KEEPKERNELS - -S= ${.CURDIR}/../.. -KFILE= GENERIC -.if exists(conf/GENERIC.MP) -KFILE= GENERIC.MP -.endif -TDIRS= ${_arch} include -TAGS= ${.CURDIR}/tags - -NOPROG= -NOMAN= -NOOBJ= -SUBDIR= stand -.if !defined(KEEPKERNELS) || !(make(clean) || make(cleandir)) -SUBDIR+=compile -.endif - -# config the fattest kernel we can find into a temporary dir -# to create a Makefile. Then use make to pull some variables -# out and push them into the sub-shell to expand the paths, -# and finally run ctags. -tags:: - TDIR=`mktemp -d /tmp/_tagXXXXXXXXXX` || exit 1; \ - eval "S=${S}" && \ - config -s ${S} -b $${TDIR} ${.CURDIR}/conf/${KFILE} && \ - eval "_arch=\"`make -V _arch -f $${TDIR}/Makefile`\"" && \ - eval "_mach=\"`make -V _mach -f $${TDIR}/Makefile`\"" && \ - eval "_machdir=\$S/arch/$${_mach}" && \ - eval "_archdir=\$S/arch/$${_arch}" && \ - eval "HFILES=\"`find $S \( -path $S/arch -o -path $S/stand -o -path $S/lib/libsa -o -path $S/lib/libkern/arch \) -prune -o -name '*.h'; find $${_machdir} $${_archdir} $S/lib/libkern/arch/$${_arch} \( -name boot -o -name stand \) -prune -o -name '*.h'`\"" && \ - eval "SFILES=\"`make -V SFILES -f $${TDIR}/Makefile`\"" && \ - eval "CFILES=\"`make -V CFILES -f $${TDIR}/Makefile`\"" && \ - eval "AFILES=\"`make -V AFILES -f $${TDIR}/Makefile`\"" && \ - ctags -wd -f ${TAGS} $${CFILES} $${HFILES} && \ - egrep "^[_A-Z]*ENTRY[_A-Z]*\(.*\)" $${SFILES} $${AFILES} | \ - sed "s;\\([^:]*\\):\\([^(]*\\)(\\([^, )]*\\)\\(.*\\);\\3 \\1 /^\\2(\\3\\4$$/;" \ - >> ${TAGS} && \ - sort -o ${TAGS} ${TAGS} && \ - rm -rf $${TDIR} - -links: - -for i in conf ${TDIRS}; do \ - (cd $$i && rm -f tags; ln -s tags tags); done - -obj: _SUBDIRUSE - -.include <bsd.prog.mk> diff --git a/sys/arch/socppc/compile/GENERIC/Makefile b/sys/arch/socppc/compile/GENERIC/Makefile deleted file mode 100644 index 01b5f23410c..00000000000 --- a/sys/arch/socppc/compile/GENERIC/Makefile +++ /dev/null @@ -1 +0,0 @@ -.include "../Makefile.inc" diff --git a/sys/arch/socppc/compile/Makefile b/sys/arch/socppc/compile/Makefile deleted file mode 100644 index 83dd5c4899f..00000000000 --- a/sys/arch/socppc/compile/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $OpenBSD: Makefile,v 1.2 2016/10/15 13:45:08 deraadt Exp $ - -.if make(obj) || make(clean) || make(cleandir) -SUBDIR!=find . -type d -maxdepth 1 \! \( -name . -o -name CVS \) | cut -b3- -.endif - -.include <bsd.subdir.mk> diff --git a/sys/arch/socppc/compile/Makefile.inc b/sys/arch/socppc/compile/Makefile.inc deleted file mode 100644 index 9e9e38f1ed1..00000000000 --- a/sys/arch/socppc/compile/Makefile.inc +++ /dev/null @@ -1,19 +0,0 @@ -SYSDIR != cd ${.CURDIR}/../../../..; pwd -CONFDIR != cd ${.CURDIR}/../../conf; pwd - -.if ${.CURDIR} == ${.OBJDIR} -.PHONY: config -config: - @echo make obj required first >&2 - @false -.else -.PHONY: config clean -config: - config ${.CURDIR:M*.PROF:C/.*/-p/} -b ${.OBJDIR} \ - -s ${SYSDIR} ${CONFDIR}/${.CURDIR:T:S/.PROF$//} -.endif - -cleandir clean: - -.include <bsd.obj.mk> - diff --git a/sys/arch/socppc/compile/RAMDISK/Makefile b/sys/arch/socppc/compile/RAMDISK/Makefile deleted file mode 100644 index 01b5f23410c..00000000000 --- a/sys/arch/socppc/compile/RAMDISK/Makefile +++ /dev/null @@ -1 +0,0 @@ -.include "../Makefile.inc" diff --git a/sys/arch/socppc/conf/GENERIC b/sys/arch/socppc/conf/GENERIC deleted file mode 100644 index e95b04a0340..00000000000 --- a/sys/arch/socppc/conf/GENERIC +++ /dev/null @@ -1,112 +0,0 @@ -# $OpenBSD: GENERIC,v 1.30 2014/12/11 19:44:17 tedu Exp $ -# -# For further information on compiling OpenBSD kernels, see the config(8) -# man page. -# -# For further information on hardware support for this architecture, see -# the intro(4) man page. For further information about kernel options -# for this architecture, see the options(4) man page. For an explanation -# of each device driver in this file see the section 4 man page for the -# device. - -machine socppc powerpc -include "../../../conf/GENERIC" -maxusers 32 # estimated number of users - -option PCIVERBOSE -option USBVERBOSE - -option USER_PCICONF # user-space PCI configuration -option APERTURE - -config bsd swap generic - -mainbus0 at root -cpu0 at mainbus0 -obio0 at mainbus0 - -# On-board CF -wdc0 at mainbus0 -wdc1 at mainbus0 -wd* at wdc? flags 0x0000 - -# On-board IPIC -ipic0 at obio? - -# On-board I2C -sociic0 at obio? -sociic1 at obio? -iic* at sociic? -ricohrtc0 at iic? addr 0x32 # Ricoh RTC -fintek0 at iic? flags 0x0001 # temp/fan controller - -# On-board DUART -com0 at obio? -com1 at obio? - -# On-board PCI -socpcic* at mainbus? -socpcic* at obio? -pci* at socpcic? - -pciide* at pci? -wd* at pciide? flags 0x0000 - -vge* at pci? - -# On-board USB -ehci0 at obio? -usb* at ehci? - -# USB devices -uhub* at usb? # USB Hubs -uhub* at uhub? # USB Hubs -ulpt* at uhub? # USB Printers -umass* at uhub? # USB Mass Storage devices -uhidev* at uhub? # Human Interface Devices -ums* at uhidev? # USB mouse -wsmouse* at ums? mux 0 -ukbd* at uhidev? # USB keyboard -wskbd* at ukbd? mux 1 -uhid* at uhidev? # USB generic HID support -upd* at uhidev? # USB Power Devices sensors -axe* at uhub? # ASIX Electronics AX88172 USB Ethernet -axen* at uhub? # ASIX Electronics AX88179 USB Ethernet -mos* at uhub? # MOSCHIP CS730/7830 10/100 Ethernet -smsc* at uhub? # SMSC LAN95xx Ethernet -uath* at uhub? # Atheros AR5005UR/AR5005UX -athn* at uhub? # Atheros AR9002U -ural* at uhub? # Ralink RT2500USB -rum* at uhub? # Ralink RT2501USB/RT2601USB -run* at uhub? # Ralink RT2700U/RT2800U/RT3000U -rsu* at uhub? # Realtek RTL8188SU/RTL8191SU/RTL8192SU -urtwn* at uhub? # Realtek RTL8188CU/RTL8192CU -zyd* at uhub? # Zydas ZD1211 -ugen* at uhub? # USB Generic driver -uthum* at uhidev? # TEMPerHUM sensor -ugold* at uhidev? # gold TEMPer sensor -utwitch* at uhidev? # YUREX BBU sensor - -udl* at uhub? -wsdisplay* at udl? - -scsibus* at scsi? -sd* at scsibus? - -# On-board TSEC -tsec0 at obio? -tsec1 at obio? - -rgephy* at mii? # Realtek 8169S/8110S PHY -eephy* at mii? # Marvell 88E1000 series PHY -rlphy* at mii? # Realtek 8139 internal PHYs -ciphy* at mii? # Cicada CS8201 10/100/1000 copper PHY -gentbi* at mii? # Generic 1000BASE-X ten-bit PHY -ukphy* at mii? # Generic unknown PHY - -# PCI -athn* at pci? # Atheros AR9k (802.11a/g/n) -hifn* at pci? # Hi/fn 7751 crypto card - -pseudo-device hotplug 1 # devices hot plugging -pseudo-device wsmux 2 # mouse & keyboard multiplexor diff --git a/sys/arch/socppc/conf/Makefile.socppc b/sys/arch/socppc/conf/Makefile.socppc deleted file mode 100644 index eab2c0302e7..00000000000 --- a/sys/arch/socppc/conf/Makefile.socppc +++ /dev/null @@ -1,150 +0,0 @@ -# $OpenBSD: Makefile.socppc,v 1.60 2019/04/14 14:07:07 deraadt Exp $ - -# For instructions on building kernels consult the config(8) and options(4) -# manual pages. -# -# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE -# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING -# DEBUG is set to -g by config if debugging is requested (config -g). -# PROF is set to -pg by config if profiling is requested (config -p). - -.include <bsd.own.mk> - -SIZE?= size -STRIP?= ctfstrip - -# source tree is located via $S relative to the compilation directory -.ifndef S -S!= cd ../../../..; pwd -.endif - -_machdir?= $S/arch/${_mach} -_archdir?= $S/arch/${_arch} - -INCLUDES= -nostdinc -I$S -I${.OBJDIR} -I$S/arch -CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP -CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \ - -Wno-main -Wno-uninitialized -Wno-pointer-sign \ - -Wframe-larger-than=2047 - -CMACHFLAGS= -msoft-float -Wa,-many -CMACHFLAGS+= -fno-builtin-printf -fno-builtin-snprintf \ - -fno-builtin-vsnprintf -fno-builtin-log \ - -fno-builtin-log2 -fno-builtin-malloc ${NOPIE_FLAGS} -.if ${IDENT:M-DNO_PROPOLICE} -CMACHFLAGS+= -fno-stack-protector -.endif -.if ${IDENT:M-DSMALL_KERNEL} -COPTS?= -Oz -.endif - -DEBUG?= -g -COPTS?= -O2 -CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE} -AFLAGS= -D_LOCORE ${CMACHFLAGS} -LINKFLAGS= -N -Ttext 200000 -e start --warn-common -nopie - -HOSTCC?= ${CC} -HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} -HOSTED_CFLAGS= ${CFLAGS} -HOSTED_C= ${HOSTCC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< - -NORMAL_C_NOP= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< -NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< -NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< - -%OBJS - -%CFILES - -%SFILES - -# load lines for config "xxx" will be emitted as: -# xxx: ${SYSTEM_DEP} swapxxx.o -# ${SYSTEM_LD_HEAD} -# ${SYSTEM_LD} swapxxx.o -# ${SYSTEM_LD_TAIL} -SYSTEM_HEAD= locore.o param.o ioconf.o -SYSTEM_OBJ= ${SYSTEM_HEAD} ${OBJS} -SYSTEM_DEP= Makefile ${SYSTEM_OBJ} -SYSTEM_LD_HEAD= @rm -f $@ -SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_HEAD} vers.o $${OBJS}'; \ - umask 007; \ - ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_HEAD} vers.o ${OBJS} -SYSTEM_LD_TAIL= @${SIZE} $@ - -.if ${DEBUG} == "-g" -STRIPFLAGS= -S -SYSTEM_LD_TAIL+=; umask 007; \ - echo mv $@ $@.gdb; rm -f $@.gdb; mv $@ $@.gdb; \ - echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ - ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb -.else -LINKFLAGS+= -S -.endif - -%LOAD - -# cc's -MD puts the source and output paths in the dependency file; -# since those are temp files here we need to fix it up. It also -# puts the file in /tmp, so we use -MF to put it in the current -# directory as assym.P and then generate assym.d from it with a -# good target name -assym.h: $S/kern/genassym.sh Makefile \ - ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf - cat ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf | \ - sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} -MF assym.P > assym.h.tmp - sed '1s/.*/assym.h: \\/' assym.P > assym.d - sort -u assym.h.tmp > assym.h - -param.c: $S/conf/param.c - rm -f param.c - cp $S/conf/param.c . - -param.o: param.c Makefile - ${NORMAL_C} - -mcount.o: $S/lib/libkern/mcount.c Makefile - ${NORMAL_C_NOP} - -ioconf.o: ioconf.c - ${NORMAL_C} - -vers.o: ${SYSTEM_DEP:Ngap.o} - sh $S/conf/newvers.sh - ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c - -clean: - rm -f *bsd *bsd.gdb *.[dio] [a-z]*.s assym.* param.c - -cleandir: clean - rm -f Makefile *.h ioconf.c options machine ${_mach} vers.c - -depend obj: - -locore.o: ${_machdir}/${_mach}/locore.S assym.h -mutex.o: assym.h - -# The install target can be redefined by putting a -# install-kernel-${MACHINE_NAME} target into /etc/mk.conf -MACHINE_NAME!= uname -n -install: install-kernel-${MACHINE_NAME} -.if !target(install-kernel-${MACHINE_NAME}}) -install-kernel-${MACHINE_NAME}: - [[ ! -f /bsd ]] || cmp -s bsd /bsd || ln -f /bsd /obsd - umask 077; cp bsd /nbsd - mv /nbsd /bsd -.endif - -# pull in the dependency information -.ifnmake clean -. for o in ${SYSTEM_OBJ:Ngap.o} assym.h -. if exists(${o:R}.d) -. include "${o:R}.d" -. elif exists($o) - .PHONY: $o -. endif -. endfor -.endif - -%RULES diff --git a/sys/arch/socppc/conf/RAMDISK b/sys/arch/socppc/conf/RAMDISK deleted file mode 100644 index 74ecaadfca6..00000000000 --- a/sys/arch/socppc/conf/RAMDISK +++ /dev/null @@ -1,79 +0,0 @@ -# $OpenBSD: RAMDISK,v 1.11 2015/07/17 22:52:29 tedu Exp $ - -machine socppc powerpc -maxusers 4 - -option TIMEZONE=0 -option DST=0 -option SMALL_KERNEL -option NO_PROPOLICE -option BOOT_CONFIG - -option MINIROOTSIZE=8192 -option RAMDISK_HOOKS - -option PCIVERBOSE -option USBVERBOSE - -option FFS -option FFS2 -option NFSCLIENT -option CD9660 -option UDF -option MSDOSFS -option INET6 - -config bsd root on rd0a swap on rd0b - -mainbus0 at root -cpu0 at mainbus0 -obio0 at mainbus0 -ipic0 at obio? - -wdc0 at mainbus0 # On-board CF -wdc1 at mainbus0 -wd* at wdc? flags 0x0000 - -sociic0 at obio? -sociic1 at obio? -iic* at sociic? -ricohrtc0 at iic? addr 0x32 # Ricoh RTC -fintek0 at iic? flags 0x0001 # temp/fan controller - -com0 at obio? -com1 at obio? - -socpcic* at mainbus? -socpcic* at obio? -tsec0 at obio? -tsec1 at obio? - -pci* at socpcic? -pciide* at pci? -wd* at pciide? flags 0x0000 - -ehci0 at obio? -usb* at ehci? - -uhub* at usb? -uhub* at uhub? -umass* at uhub? -ural* at uhub? # Ralink RT2500USB -rum* at uhub? # Ralink RT2501USB/RT2601USB -zyd* at uhub? # Zydas ZD1211 - -scsibus* at scsi? -sd* at scsibus? - -vge* at pci? -athn* at pci? # Atheros AR9k (802.11a/g/n) - -rgephy* at mii? # Realtek 8169S/8110S PHY -eephy* at mii? # Marvell 88E1000 series PHY -ciphy* at mii? # Cicada CS8201 10/100/1000 copper PHY -gentbi* at mii? # Generic 1000BASE-X ten-bit PHY -ukphy* at mii? # Generic unknown PHY - -pseudo-device loop 1 -pseudo-device bpfilter 1 -pseudo-device rd 1 diff --git a/sys/arch/socppc/conf/files.socppc b/sys/arch/socppc/conf/files.socppc deleted file mode 100644 index 4aa95261b02..00000000000 --- a/sys/arch/socppc/conf/files.socppc +++ /dev/null @@ -1,109 +0,0 @@ -# $OpenBSD: files.socppc,v 1.16 2016/03/05 17:41:55 mpi Exp $ - -# -# macppc-specific configuration info -# -maxpartitions 16 - -maxusers 2 8 64 - -file arch/socppc/socppc/autoconf.c -file arch/socppc/socppc/clock.c -file arch/socppc/socppc/conf.c -file arch/socppc/socppc/disksubr.c disk -file arch/socppc/socppc/machdep.c -file arch/socppc/socppc/mem.c -file dev/cninit.c -file dev/ofw/fdt.c -file arch/socppc/socppc/n1200_dts.S - - -define mainbus {} -device mainbus -attach mainbus at root -file arch/socppc/socppc/mainbus.c mainbus - -device cpu -attach cpu at mainbus -file arch/socppc/socppc/cpu.c - -# MPC8349E on-board devices -device obio {[addr = 0], [ivec = -1], [phy = -1]} -attach obio at mainbus -file arch/socppc/dev/obio.c - -# On-board IPIC -device ipic -attach ipic at obio -file arch/socppc/dev/ipic.c - -# On-board I2C -device sociic: i2cbus -attach sociic at obio -file arch/socppc/dev/sociic.c - -# On-board DUART -attach com at obio with com_obio -file arch/socppc/dev/com_obio.c - -# On-board CF -attach wdc at mainbus with wdc_mainbus -file arch/socppc/dev/wdc_mainbus.c - -# -# Media Independent Interface (mii) -# -include "../../../dev/mii/files.mii" - -# On-board TSEC -device tsec: ether, ifnet, mii, ifmedia -attach tsec at obio -file arch/socppc/dev/if_tsec.c - -major {rd = 17} -major {wd = 0} -major {sd = 2} -major {cd = 3} - -include "../../../scsi/files.scsi" - -include "dev/pci/files.pci" -file arch/socppc/dev/pciide_machdep.c pciide - -# On-board PCI -device socpcic: pcibus -attach socpcic at mainbus with socpcic_mainbus -attach socpcic at obio with socpcic_obio -file arch/socppc/dev/socpcic.c - -# -# Machine-independent ATAPI drivers -# - -include "../../../dev/atapiscsi/files.atapiscsi" -include "../../../dev/ata/files.ata" - -# WSCONS bits for wskbd.h -# -include "dev/wscons/files.wscons" -include "dev/wsfont/files.wsfont" -include "dev/rasops/files.rasops" - -# -# Machine-independent HID support -# -include "dev/hid/files.hid" - -# -# Machine-independent USB drivers -# -include "dev/usb/files.usb" - -# On-board USB -attach ehci at obio with ehci_obio -file arch/socppc/dev/ehci_obio.c ehci - -# -# Machine-independent I2C drivers -# -include "dev/i2c/files.i2c" diff --git a/sys/arch/socppc/dev/com_obio.c b/sys/arch/socppc/dev/com_obio.c deleted file mode 100644 index 9cf656754be..00000000000 --- a/sys/arch/socppc/dev/com_obio.c +++ /dev/null @@ -1,89 +0,0 @@ -/* $OpenBSD: com_obio.c,v 1.3 2009/09/06 20:09:34 kettenis Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> -#include <sys/tty.h> - -#include <machine/autoconf.h> - -#include <dev/ofw/openfirm.h> - -#include <dev/ic/comreg.h> -#include <dev/ic/comvar.h> - -int com_obio_match(struct device *, void *, void *); -void com_obio_attach(struct device *, struct device *, void *); - -struct cfattach com_obio_ca = { - sizeof(struct com_softc), com_obio_match, com_obio_attach -}; - -struct cfdriver com_obio_cd = { - NULL, "com", DV_DULL -}; - -int -com_obio_match(struct device *parent, void *cfdata, void *aux) -{ - struct obio_attach_args *oa = aux; - char buf[32]; - - if (OF_getprop(oa->oa_node, "device_type", buf, sizeof(buf)) <= 0 || - strcmp(buf, "serial") != 0) - return (0); - - if (OF_getprop(oa->oa_node, "compatible", buf, sizeof(buf)) <= 0 || - strcmp(buf, "ns16550") != 0) - return (0); - - return (1); -} - -void -com_obio_attach(struct device *parent, struct device *self, void *aux) -{ - struct com_softc *sc = (void *)self; - struct obio_attach_args *oa = aux; - int freq; - - if (OF_getprop(oa->oa_node, "clock-frequency", &freq, - sizeof(freq))!= sizeof(freq)) { - printf(": unknown clock frequency\n"); - return; - } - - sc->sc_iot = oa->oa_iot; - sc->sc_iobase = oa->oa_offset; - sc->sc_frequency = freq; - - if (sc->sc_iobase != comconsaddr) { - if (bus_space_map(sc->sc_iot, sc->sc_iobase, - COM_NPORTS, 0, &sc->sc_ioh)) { - printf(": can't map registers\n"); - return; - } - } else - sc->sc_ioh = comconsioh; - - com_attach_subr(sc); - - intr_establish(oa->oa_ivec, IST_LEVEL, IPL_TTY, comintr, - sc, sc->sc_dev.dv_xname); -} diff --git a/sys/arch/socppc/dev/ehci_obio.c b/sys/arch/socppc/dev/ehci_obio.c deleted file mode 100644 index c8ff01859a7..00000000000 --- a/sys/arch/socppc/dev/ehci_obio.c +++ /dev/null @@ -1,135 +0,0 @@ -/* $OpenBSD: ehci_obio.c,v 1.5 2015/01/24 20:59:42 kettenis Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> -#include <sys/rwlock.h> -#include <sys/timeout.h> - -#include <machine/autoconf.h> - -#include <dev/ofw/openfirm.h> - -#include <dev/usb/usb.h> -#include <dev/usb/usbdi.h> -#include <dev/usb/usbdivar.h> -#include <dev/usb/usb_mem.h> - -#include <dev/usb/ehcireg.h> -#include <dev/usb/ehcivar.h> - -#include <dev/pci/pcidevs.h> - -#define USB_EHCI_OFFSET 0x00100 -#define USB_SNOOP1 0x00400 - USB_EHCI_OFFSET -#define USB_SNOOP_2GB 0x1e000000 -#define USB_CONTROL 0x00500 - USB_EHCI_OFFSET -#define USB_CONTROL_USB_EN 0x04000000 - -int ehci_obio_match(struct device *, void *, void *); -void ehci_obio_attach(struct device *, struct device *, void *); - -struct cfattach ehci_obio_ca = { - sizeof(struct ehci_softc), ehci_obio_match, ehci_obio_attach -}; - -struct cfdriver ehci_obio_cd = { - NULL, "ehci", DV_DULL -}; - -struct powerpc_bus_dma_tag ehci_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_alloc_range, - _dmamem_free, - _dmamem_map, - _dmamem_unmap, - _dmamem_mmap -}; - -int -ehci_obio_match(struct device *parent, void *cfdata, void *aux) -{ - struct obio_attach_args *oa = aux; - char buf[32]; - - if (OF_getprop(oa->oa_node, "compatible", buf, sizeof(buf)) <= 0 || - strcmp(buf, "fsl-usb2-mph") != 0) - return (0); - - return (1); -} - -void -ehci_obio_attach(struct device *parent, struct device *self, void *aux) -{ - struct ehci_softc *sc = (void *)self; - struct obio_attach_args *oa = aux; - usbd_status r; - int s; - - sc->iot = oa->oa_iot; - sc->sc_size = 1028; - if (bus_space_map(sc->iot, oa->oa_offset + USB_EHCI_OFFSET, - sc->sc_size, 0, &sc->ioh)) { - printf(": can't map registers\n"); - return; - } - - sc->sc_id_vendor = PCI_VENDOR_FREESCALE; - strlcpy(sc->sc_vendor, "Freescale", sizeof sc->sc_vendor); - - sc->sc_bus.dmatag = &ehci_bus_dma_tag; - - bus_space_write_4(sc->iot, sc->ioh, USB_CONTROL, USB_CONTROL_USB_EN); - bus_space_write_4(sc->iot, sc->ioh, USB_SNOOP1, USB_SNOOP_2GB); - - s = splhardusb(); - sc->sc_offs = EREAD1(sc, EHCI_CAPLENGTH); - EOWRITE2(sc, EHCI_USBINTR, 0); - - intr_establish(oa->oa_ivec, IST_LEVEL, IPL_USB, ehci_intr, sc, - sc->sc_bus.bdev.dv_xname); - - r = ehci_init(sc); - if (r != USBD_NORMAL_COMPLETION) { - printf(": init failed, error=%d\n", r); - goto unmap_ret; - } - splx(s); - - printf("\n"); - - /* Attach usb device. */ - config_found(self, &sc->sc_bus, usbctlprint); - - return; - -unmap_ret: - bus_space_unmap(sc->iot, sc->ioh, sc->sc_size); - splx(s); -} diff --git a/sys/arch/socppc/dev/if_tsec.c b/sys/arch/socppc/dev/if_tsec.c deleted file mode 100644 index 832345ade8d..00000000000 --- a/sys/arch/socppc/dev/if_tsec.c +++ /dev/null @@ -1,1335 +0,0 @@ -/* $OpenBSD: if_tsec.c,v 1.44 2017/01/22 10:17:37 dlg Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * Driver for the TSEC interface on the MPC8349E processors. - */ - -#include "bpfilter.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> -#include <sys/kernel.h> -#include <sys/malloc.h> -#include <sys/mbuf.h> -#include <sys/queue.h> -#include <sys/socket.h> -#include <sys/sockio.h> -#include <sys/timeout.h> - -#include <machine/autoconf.h> -#include <machine/bus.h> - -#include <net/if.h> -#include <net/if_media.h> - -#include <dev/ofw/openfirm.h> - -#include <dev/mii/mii.h> -#include <dev/mii/miivar.h> - -#if NBPFILTER > 0 -#include <net/bpf.h> -#endif - -#include <netinet/in.h> -#include <netinet/if_ether.h> - -extern void myetheraddr(u_char *); - -/* - * TSEC registers. - */ - -#define TSEC_IEVENT 0x010 -#define TSEC_IEVENT_BABR 0x80000000 -#define TSEC_IEVENT_RXC 0x40000000 -#define TSEC_IEVENT_BSY 0x20000000 -#define TSEC_IEVENT_EBERR 0x10000000 -#define TSEC_IEVENT_MSRO 0x04000000 -#define TSEC_IEVENT_GTSC 0x02000000 -#define TSEC_IEVENT_BABT 0x01000000 -#define TSEC_IEVENT_TXC 0x00800000 -#define TSEC_IEVENT_TXE 0x00400000 -#define TSEC_IEVENT_TXB 0x00200000 -#define TSEC_IEVENT_TXF 0x00100000 -#define TSEC_IEVENT_LC 0x00040000 -#define TSEC_IEVENT_CRL 0x00020000 -#define TSEC_IEVENT_DXA TSEC_IEVENT_CRL -#define TSEC_IEVENT_XFUN 0x00010000 -#define TSEC_IEVENT_RXB 0x00008000 -#define TSEC_IEVENT_MMRD 0x00000400 -#define TSEC_IEVENT_MMWR 0x00000200 -#define TSEC_IEVENT_GRSC 0x00000100 -#define TSEC_IEVENT_RXF 0x00000080 -#define TSEC_IEVENT_FMT "\020" "\040BABR" "\037RXC" "\036BSY" \ - "\035EBERR" "\033MSRO" "\032GTSC" "\031BABT" "\030TXC" "\027TXE" \ - "\026TXB" "\025TXF" "\023LC" "\022CRL/XDA" "\021XFUN" "\020RXB" \ - "\013MMRD" "\012MMRW" "\011GRSC" "\010RXF" -#define TSEC_IMASK 0x014 -#define TSEC_IMASK_BREN 0x80000000 -#define TSEC_IMASK_RXCEN 0x40000000 -#define TSEC_IMASK_BSYEN 0x20000000 -#define TSEC_IMASK_EBERREN 0x10000000 -#define TSEC_IMASK_MSROEN 0x04000000 -#define TSEC_IMASK_GTSCEN 0x02000000 -#define TSEC_IMASK_BTEN 0x01000000 -#define TSEC_IMASK_TXCEN 0x00800000 -#define TSEC_IMASK_TXEEN 0x00400000 -#define TSEC_IMASK_TXBEN 0x00200000 -#define TSEC_IMASK_TXFEN 0x00100000 -#define TSEC_IMASK_LCEN 0x00040000 -#define TSEC_IMASK_CRLEN 0x00020000 -#define TSEC_IMASK_DXAEN TSEC_IMASK_CRLEN -#define TSEC_IMASK_XFUNEN 0x00010000 -#define TSEC_IMASK_RXBEN 0x00008000 -#define TSEC_IMASK_MMRD 0x00000400 -#define TSEC_IMASK_MMWR 0x00000200 -#define TSEC_IMASK_GRSCEN 0x00000100 -#define TSEC_IMASK_RXFEN 0x00000080 -#define TSEC_EDIS 0x018 -#define TSEC_ECNTRL 0x020 -#define TSEC_ECNTRL_R100M 0x00000008 /* RGMII 100 mode */ -#define TSEC_MINFLR 0x024 -#define TSEC_PTV 0x028 -#define TSEC_DMACTRL 0x02c -#define TSEC_DMACTRL_TDSEN 0x00000080 -#define TSEC_DMACTRL_TBDSEN 0x00000040 -#define TSEC_DMACTRL_GRS 0x00000010 /* Graceful receive stop */ -#define TSEC_DMACTRL_GTS 0x00000008 /* Graceful transmit stop */ -#define TSEC_DMACTRL_WWR 0x00000002 -#define TSEC_DMACTRL_WOP 0x00000001 -#define TSEC_TBIPA 0x030 - -#define TSEC_TCTRL 0x100 -#define TSEC_TSTAT 0x104 -#define TSEC_TSTAT_THLT 0x80000000 -#define TSEC_TBPTR 0x184 -#define TSEC_TBASE 0x204 - -#define TSEC_RCTRL 0x300 -#define TSEC_RCTRL_PROM 0x00000008 -#define TSEC_RSTAT 0x304 -#define TSEC_RSTAT_QHLT 0x00800000 -#define TSEC_MRBLR 0x340 -#define TSEC_RBPTR 0x384 -#define TSEC_RBASE 0x404 - -#define TSEC_MACCFG1 0x500 -#define TSEC_MACCFG1_TXEN 0x00000001 -#define TSEC_MACCFG1_RXEN 0x00000004 -#define TSEC_MACCFG1_RESET 0x80000000 -#define TSEC_MACCFG2 0x504 -#define TSEC_MACCFG2_IF_MODE 0x00000300 /* I/F mode */ -#define TSEC_MACCFG2_IF_MII 0x00000100 /* I/F mode */ -#define TSEC_MACCFG2_IF_GMII 0x00000200 /* I/F mode */ -#define TSEC_MACCFG2_PAD 0x00000004 -#define TSEC_MACCFG2_CRC 0x00000002 -#define TSEC_MACCFG2_FDX 0x00000001 /* Full duplex */ -#define TSEC_MIIMCFG 0x520 -#define TSEC_MIIMCFG_RESET 0x80000000 /* Reset */ -#define TSEC_MIIMCOM 0x524 -#define TSEC_MIIMCOM_READ 0x00000001 /* Read cycle */ -#define TSEC_MIIMCOM_SCAN 0x00000002 /* Scan cycle */ -#define TSEC_MIIMADD 0x528 -#define TSEC_MIIMCON 0x52c -#define TSEC_MIIMSTAT 0x530 -#define TSEC_MIIMIND 0x534 -#define TSEC_MIIMIND_BUSY 0x00000001 /* Busy */ -#define TSEC_MIIMIND_SCAN 0x00000002 /* Scan in progress */ -#define TSEC_MIIMIND_NOTVALID 0x00000004 /* Not valid */ -#define TSEC_MACSTNADDR1 0x540 -#define TSEC_MACSTNADDR2 0x544 -#define TSEC_IADDR0 0x800 -#define TSEC_IADDR1 0x804 -#define TSEC_IADDR2 0x818 -#define TSEC_IADDR3 0x81c -#define TSEC_IADDR4 0x810 -#define TSEC_IADDR5 0x814 -#define TSEC_IADDR6 0x818 -#define TSEC_IADDR7 0x81c -#define TSEC_GADDR0 0x880 -#define TSEC_GADDR1 0x884 -#define TSEC_GADDR2 0x888 -#define TSEC_GADDR3 0x88c -#define TSEC_GADDR4 0x890 -#define TSEC_GADDR5 0x894 -#define TSEC_GADDR6 0x898 -#define TSEC_GADDR7 0x89c - -#define TSEC_ATTR 0xbf8 -#define TSEC_ATTR_RDSEN 0x00000080 -#define TSEC_ATTR_RBDSEN 0x00000040 - -/* - * TSEC descriptors. - */ - -struct tsec_desc { - uint16_t td_status; - uint16_t td_len; - uint32_t td_addr; -}; - -/* Tx status bits. */ -#define TSEC_TX_TXTRUNC 0x0001 /* TX truncation */ -#define TSEC_TX_UN 0x0002 /* Underrun */ -#define TSEC_TX_RC 0x003c /* Retry count */ -#define TSEC_TX_RL 0x0040 /* Retransmission limit */ -#define TSEC_TX_HFE 0x0080 /* Huge frame enable/late collision */ -#define TSEC_TX_LC TSEC_TX_HFE -#define TSEC_TX_TO1 0x0100 /* Transmit software ownership bit */ -#define TSEC_TX_DEF 0x0200 /* Defer indication */ -#define TSEC_TX_TC 0x0400 /* Tx CRC */ -#define TSEC_TX_L 0x0800 /* Last in frame */ -#define TSEC_TX_I 0x1000 /* Interrupt */ -#define TSEC_TX_W 0x2000 /* Wrap */ -#define TSEC_TX_PAD 0x4000 /* PAD/CRC */ -#define TSEC_TX_R 0x8000 /* Ready */ - -/* Rx status bits */ -#define TSEC_RX_TR 0x0001 /* Truncation */ -#define TSEC_RX_OV 0x0002 /* Overrun */ -#define TSEC_RX_CR 0x0004 /* Rx CRC error */ -#define TSEC_RX_SH 0x0008 /* Short frame */ -#define TSEC_RX_NO 0x0010 /* Rx non-octet aligned frame */ -#define TSEC_RX_LG 0x0020 /* Rx framelength violation */ -#define TSEC_RX_MC 0x0040 /* Multicast */ -#define TSEC_RX_BC 0x0080 /* Broadcast */ -#define TSEC_RX_M 0x0100 /* Miss */ -#define TSEC_RX_F 0x0400 /* First in frame */ -#define TSEC_RX_L 0x0800 /* Last in frame */ -#define TSEC_RX_I TSEC_TX_I -#define TSEC_RX_W TSEC_TX_W -#define TSEC_RX_RO1 0x4000 /* Receive software ownership bit */ -#define TSEC_RX_E 0x8000 /* Empty */ - -struct tsec_buf { - bus_dmamap_t tb_map; - struct mbuf *tb_m; -}; - -#define TSEC_NTXDESC 256 -#define TSEC_NTXSEGS 16 - -#define TSEC_NRXDESC 256 - -struct tsec_dmamem { - bus_dmamap_t tdm_map; - bus_dma_segment_t tdm_seg; - size_t tdm_size; - caddr_t tdm_kva; -}; -#define TSEC_DMA_MAP(_tdm) ((_tdm)->tdm_map) -#define TSEC_DMA_LEN(_tdm) ((_tdm)->tdm_size) -#define TSEC_DMA_DVA(_tdm) ((_tdm)->tdm_map->dm_segs[0].ds_addr) -#define TSEC_DMA_KVA(_tdm) ((void *)(_tdm)->tdm_kva) - -struct tsec_softc { - struct device sc_dev; - bus_space_tag_t sc_iot; - bus_space_handle_t sc_ioh; - bus_space_handle_t sc_mii_ioh; - bus_dma_tag_t sc_dmat; - - struct arpcom sc_ac; -#define sc_lladdr sc_ac.ac_enaddr - struct mii_data sc_mii; -#define sc_media sc_mii.mii_media - int sc_link; - - struct tsec_dmamem *sc_txring; - struct tsec_buf *sc_txbuf; - struct tsec_desc *sc_txdesc; - int sc_tx_prod; - int sc_tx_cnt; - int sc_tx_cons; - - struct tsec_dmamem *sc_rxring; - struct tsec_buf *sc_rxbuf; - struct tsec_desc *sc_rxdesc; - int sc_rx_prod; - struct if_rxring sc_rx_ring; - int sc_rx_cons; - - struct timeout sc_tick; -}; - -#define DEVNAME(_s) ((_s)->sc_dev.dv_xname) - -int tsec_match(struct device *, void *, void *); -void tsec_attach(struct device *, struct device *, void *); - -struct cfattach tsec_ca = { - sizeof(struct tsec_softc), tsec_match, tsec_attach -}; - -struct cfdriver tsec_cd = { - NULL, "tsec", DV_IFNET -}; - -int tsec_find_phy(int, int); - -uint32_t tsec_read(struct tsec_softc *, bus_addr_t); -void tsec_write(struct tsec_softc *, bus_addr_t, uint32_t); -uint32_t tsec_mii_read(struct tsec_softc *, bus_addr_t); -void tsec_mii_write(struct tsec_softc *, bus_addr_t, uint32_t); - -int tsec_ioctl(struct ifnet *, u_long, caddr_t); -void tsec_start(struct ifnet *); -void tsec_watchdog(struct ifnet *); - -int tsec_media_change(struct ifnet *); -void tsec_media_status(struct ifnet *, struct ifmediareq *); - -int tsec_mii_readreg(struct device *, int, int); -void tsec_mii_writereg(struct device *, int, int, int); -void tsec_mii_statchg(struct device *); - -void tsec_lladdr_write(struct tsec_softc *); - -void tsec_tick(void *); - -int tsec_txintr(void *); -int tsec_rxintr(void *); -int tsec_errintr(void *); - -void tsec_tx_proc(struct tsec_softc *); -void tsec_rx_proc(struct tsec_softc *); - -void tsec_up(struct tsec_softc *); -void tsec_down(struct tsec_softc *); -void tsec_iff(struct tsec_softc *); -int tsec_encap(struct tsec_softc *, struct mbuf *, int *); - -void tsec_reset(struct tsec_softc *); -void tsec_stop_dma(struct tsec_softc *); - -struct tsec_dmamem * - tsec_dmamem_alloc(struct tsec_softc *, bus_size_t, bus_size_t); -void tsec_dmamem_free(struct tsec_softc *, struct tsec_dmamem *); -struct mbuf *tsec_alloc_mbuf(struct tsec_softc *, bus_dmamap_t); -void tsec_fill_rx_ring(struct tsec_softc *); - -/* - * The MPC8349E processor has two TSECs but only one external - * management interface to control external PHYs. The registers - * controlling the management interface are part of TSEC1. So to - * control a PHY attached to TSEC2, one needs to access TSEC1's - * registers. To deal with this, the first TSEC that attaches maps - * the register space for both TSEC1 and TSEC2 and stores the bus - * space tag and bus space handle in these global variables. We use - * these to create subregions for each individual interface and the - * management interface. - */ -bus_space_tag_t tsec_iot; -bus_space_handle_t tsec_ioh; - -int -tsec_match(struct device *parent, void *cfdata, void *aux) -{ - struct obio_attach_args *oa = aux; - char buf[32]; - - if (OF_getprop(oa->oa_node, "device_type", buf, sizeof(buf)) <= 0 || - strcmp(buf, "network") != 0) - return (0); - - if (OF_getprop(oa->oa_node, "compatible", buf, sizeof(buf)) <= 0 || - strcmp(buf, "gianfar") != 0) - return (0); - - return (1); -} - -void -tsec_attach(struct device *parent, struct device *self, void *aux) -{ - struct tsec_softc *sc = (void *)self; - struct obio_attach_args *oa = aux; - struct ifnet *ifp; - int phy, n; - - if (OF_getprop(oa->oa_node, "phy-handle", &phy, - sizeof(phy)) == sizeof(phy)) { - int node, reg; - - node = tsec_find_phy(OF_peer(0), phy); - if (node == -1 || OF_getprop(node, "reg", ®, - sizeof(reg)) != sizeof(reg)) { - printf(": can't find PHY\n"); - return; - } - - oa->oa_phy = reg; - } - - /* Map registers for TSEC1 & TSEC2 if they're not mapped yet. */ - if (oa->oa_iot != tsec_iot) { - tsec_iot = oa->oa_iot; - if (bus_space_map(tsec_iot, oa->oa_offset & 0xffffc000, - 8192, 0, &tsec_ioh)) { - printf(": can't map registers\n"); - return; - } - } - - sc->sc_iot = tsec_iot; - sc->sc_dmat = oa->oa_dmat; - - /* Ethernet Controller registers. */ - bus_space_subregion(tsec_iot, tsec_ioh, oa->oa_offset & 0x3fff, - 3072, &sc->sc_ioh); - - /* MII Management registers. */ - bus_space_subregion(tsec_iot, tsec_ioh, 0, 3072, &sc->sc_mii_ioh); - - myetheraddr(sc->sc_lladdr); - printf(": address %s\n", ether_sprintf(sc->sc_lladdr)); - - timeout_set(&sc->sc_tick, tsec_tick, sc); - - ifp = &sc->sc_ac.ac_if; - ifp->if_softc = sc; - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_ioctl = tsec_ioctl; - ifp->if_start = tsec_start; - ifp->if_watchdog = tsec_watchdog; - IFQ_SET_MAXLEN(&ifp->if_snd, TSEC_NTXDESC - 1); - bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); - - ifp->if_capabilities = IFCAP_VLAN_MTU; - - sc->sc_mii.mii_ifp = ifp; - sc->sc_mii.mii_readreg = tsec_mii_readreg; - sc->sc_mii.mii_writereg = tsec_mii_writereg; - sc->sc_mii.mii_statchg = tsec_mii_statchg; - - ifmedia_init(&sc->sc_media, 0, tsec_media_change, tsec_media_status); - - tsec_reset(sc); - - /* Reset management. */ - tsec_write(sc, TSEC_MIIMCFG, TSEC_MIIMCFG_RESET); - tsec_write(sc, TSEC_MIIMCFG, 0x00000003); - for (n = 0; n < 100; n++) { - if ((tsec_read(sc, TSEC_MIIMIND) & TSEC_MIIMIND_BUSY) == 0) - break; - } - - mii_attach(self, &sc->sc_mii, 0xffffffff, oa->oa_phy, - MII_OFFSET_ANY, 0); - if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) { - printf("%s: no PHY found!\n", sc->sc_dev.dv_xname); - ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_MANUAL, 0, NULL); - ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_MANUAL); - } else - ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_AUTO); - - if_attach(ifp); - ether_ifattach(ifp); - - intr_establish(oa->oa_ivec, IST_LEVEL, IPL_NET, tsec_txintr, sc, - sc->sc_dev.dv_xname); - intr_establish(oa->oa_ivec + 1, IST_LEVEL, IPL_NET, tsec_rxintr, sc, - sc->sc_dev.dv_xname); - intr_establish(oa->oa_ivec + 2, IST_LEVEL, IPL_NET, tsec_errintr, sc, - sc->sc_dev.dv_xname); -} - -int -tsec_find_phy(int node, int phy) -{ - int child, handle; - - if (OF_getprop(node, "linux,phandle", &handle, - sizeof(handle)) == sizeof(handle) && phy == handle) - return (node); - - for (child = OF_child(node); child != 0; child = OF_peer(child)) { - node = tsec_find_phy(child, phy); - if (node != -1) - return node; - } - - return (-1); -} - -uint32_t -tsec_read(struct tsec_softc *sc, bus_addr_t addr) -{ - return (letoh32(bus_space_read_4(sc->sc_iot, sc->sc_ioh, addr))); -} - -void -tsec_write(struct tsec_softc *sc, bus_addr_t addr, uint32_t data) -{ - bus_space_write_4(sc->sc_iot, sc->sc_ioh, addr, htole32(data)); -} - -uint32_t -tsec_mii_read(struct tsec_softc *sc, bus_addr_t addr) -{ - return (letoh32(bus_space_read_4(sc->sc_iot, sc->sc_mii_ioh, addr))); -} - -void -tsec_mii_write(struct tsec_softc *sc, bus_addr_t addr, uint32_t data) -{ - bus_space_write_4(sc->sc_iot, sc->sc_mii_ioh, addr, htole32(data)); -} - -void -tsec_lladdr_write(struct tsec_softc *sc) -{ - uint32_t addr1, addr2; - - addr1 = sc->sc_lladdr[5] << 24 | sc->sc_lladdr[4] << 16 | - sc->sc_lladdr[3] << 8 | sc->sc_lladdr[2]; - addr2 = sc->sc_lladdr[1] << 24 | sc->sc_lladdr[0] << 16; - tsec_write(sc, TSEC_MACSTNADDR1, addr1); - tsec_write(sc, TSEC_MACSTNADDR2, addr2); -} - -void -tsec_start(struct ifnet *ifp) -{ - struct tsec_softc *sc = ifp->if_softc; - struct mbuf *m; - int error, idx; - - if (!(ifp->if_flags & IFF_RUNNING)) - return; - if (ifq_is_oactive(&ifp->if_snd)) - return; - if (IFQ_IS_EMPTY(&ifp->if_snd)) - return; - if (!sc->sc_link) - return; - - idx = sc->sc_tx_prod; - while ((sc->sc_txdesc[idx].td_status & TSEC_TX_TO1) == 0) { - m = ifq_deq_begin(&ifp->if_snd); - if (m == NULL) - break; - - error = tsec_encap(sc, m, &idx); - if (error == ENOBUFS) { - ifq_deq_rollback(&ifp->if_snd, m); - ifq_set_oactive(&ifp->if_snd); - break; - } - if (error == EFBIG) { - ifq_deq_commit(&ifp->if_snd, m); - m_freem(m); /* give up: drop it */ - ifp->if_oerrors++; - continue; - } - - /* Now we are committed to transmit the packet. */ - ifq_deq_commit(&ifp->if_snd, m); - -#if NBPFILTER > 0 - if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); -#endif - } - - if (sc->sc_tx_prod != idx) { - sc->sc_tx_prod = idx; - - /* Set a timeout in case the chip goes out to lunch. */ - ifp->if_timer = 5; - } -} - -int -tsec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) -{ - struct tsec_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)addr; - int error = 0, s; - - s = splnet(); - - switch (cmd) { - case SIOCSIFADDR: - ifp->if_flags |= IFF_UP; - /* FALLTHROUGH */ - case SIOCSIFFLAGS: - if (ifp->if_flags & IFF_UP) { - if (ifp->if_flags & IFF_RUNNING) - error = ENETRESET; - else - tsec_up(sc); - } else { - if (ifp->if_flags & IFF_RUNNING) - tsec_down(sc); - } - break; - - case SIOCGIFMEDIA: - case SIOCSIFMEDIA: - error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); - break; - - case SIOCGIFRXR: - error = if_rxr_ioctl((struct if_rxrinfo *)ifr->ifr_data, - NULL, MCLBYTES, &sc->sc_rx_ring); - break; - - default: - error = ether_ioctl(ifp, &sc->sc_ac, cmd, addr); - break; - } - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - tsec_iff(sc); - error = 0; - } - - splx(s); - return (error); -} - -void -tsec_watchdog(struct ifnet *ifp) -{ - printf("%s\n", __func__); -} - -int -tsec_media_change(struct ifnet *ifp) -{ - struct tsec_softc *sc = ifp->if_softc; - - if (LIST_FIRST(&sc->sc_mii.mii_phys)) - mii_mediachg(&sc->sc_mii); - - return (0); -} - -void -tsec_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) -{ - struct tsec_softc *sc = ifp->if_softc; - - if (LIST_FIRST(&sc->sc_mii.mii_phys)) { - mii_pollstat(&sc->sc_mii); - ifmr->ifm_active = sc->sc_mii.mii_media_active; - ifmr->ifm_status = sc->sc_mii.mii_media_status; - } -} - -int -tsec_mii_readreg(struct device *self, int phy, int reg) -{ - struct tsec_softc *sc = (void *)self; - uint32_t v; - int n; - - tsec_mii_write(sc, TSEC_MIIMADD, (phy << 8) | reg); - tsec_mii_write(sc, TSEC_MIIMCOM, 0); - tsec_mii_write(sc, TSEC_MIIMCOM, TSEC_MIIMCOM_READ); - for (n = 0; n < 100; n++) { - v = tsec_mii_read(sc, TSEC_MIIMIND); - if ((v & (TSEC_MIIMIND_NOTVALID | TSEC_MIIMIND_BUSY)) == 0) - return (tsec_mii_read(sc, TSEC_MIIMSTAT)); - delay(10); - } - - printf("%s: mii_read timeout\n", sc->sc_dev.dv_xname); - return (0); -} - -void -tsec_mii_writereg(struct device *self, int phy, int reg, int val) -{ - struct tsec_softc *sc = (void *)self; - uint32_t v; - int n; - - tsec_mii_write(sc, TSEC_MIIMADD, (phy << 8) | reg); - tsec_mii_write(sc, TSEC_MIIMCON, val); - for (n = 0; n < 100; n++) { - v = tsec_mii_read(sc, TSEC_MIIMIND); - if ((v & TSEC_MIIMIND_BUSY) == 0) - return; - delay(10); - } - - printf("%s: mii_write timeout\n", sc->sc_dev.dv_xname); -} - -void -tsec_mii_statchg(struct device *self) -{ - struct tsec_softc *sc = (void *)self; - uint32_t maccfg2, ecntrl; - - ecntrl = tsec_read(sc, TSEC_ECNTRL); - maccfg2 = tsec_read(sc, TSEC_MACCFG2); - maccfg2 &= ~TSEC_MACCFG2_IF_MODE; - - switch (IFM_SUBTYPE(sc->sc_mii.mii_media_active)) { - case IFM_1000_SX: - case IFM_1000_LX: - case IFM_1000_CX: - case IFM_1000_T: - maccfg2 |= TSEC_MACCFG2_IF_GMII; - sc->sc_link = 1; - break; - case IFM_100_TX: - ecntrl |= TSEC_ECNTRL_R100M; - maccfg2 |= TSEC_MACCFG2_IF_MII; - sc->sc_link = 1; - break; - case IFM_10_T: - ecntrl &= ~TSEC_ECNTRL_R100M; - maccfg2 |= TSEC_MACCFG2_IF_MII; - sc->sc_link = 1; - break; - default: - sc->sc_link = 0; - return; - } - - if ((sc->sc_mii.mii_media_active & IFM_GMASK) == IFM_FDX) - maccfg2 |= TSEC_MACCFG2_FDX; - else - maccfg2 &= ~TSEC_MACCFG2_FDX; - - tsec_write(sc, TSEC_MACCFG2, maccfg2); - tsec_write(sc, TSEC_ECNTRL, ecntrl); -} - -void -tsec_tick(void *arg) -{ - struct tsec_softc *sc = arg; - int s; - - s = splnet(); - mii_tick(&sc->sc_mii); - splx(s); - - timeout_add_sec(&sc->sc_tick, 1); -} - -int -tsec_txintr(void *arg) -{ - struct tsec_softc *sc = arg; - uint32_t ievent; - - ievent = tsec_read(sc, TSEC_IEVENT); - if ((ievent & (TSEC_IEVENT_TXC | TSEC_IEVENT_TXE | - TSEC_IEVENT_TXB | TSEC_IEVENT_TXF)) == 0) - printf("%s: tx %b\n", DEVNAME(sc), ievent, TSEC_IEVENT_FMT); - ievent &= (TSEC_IEVENT_TXC | TSEC_IEVENT_TXE | - TSEC_IEVENT_TXB | TSEC_IEVENT_TXF); - tsec_write(sc, TSEC_IEVENT, ievent); - - tsec_tx_proc(sc); - - return (1); -} - -int -tsec_rxintr(void *arg) -{ - struct tsec_softc *sc = arg; - uint32_t ievent; - - ievent = tsec_read(sc, TSEC_IEVENT); - if ((ievent & (TSEC_IEVENT_RXB | TSEC_IEVENT_RXF)) == 0) - printf("%s: rx %b\n", DEVNAME(sc), ievent, TSEC_IEVENT_FMT); - ievent &= (TSEC_IEVENT_RXB | TSEC_IEVENT_RXF); - tsec_write(sc, TSEC_IEVENT, ievent); - - tsec_rx_proc(sc); - - return (1); -} - -int -tsec_errintr(void *arg) -{ - struct tsec_softc *sc = arg; - struct ifnet *ifp = &sc->sc_ac.ac_if; - uint32_t ievent; - - ievent = tsec_read(sc, TSEC_IEVENT); - if ((ievent & TSEC_IEVENT_BSY) == 0) - printf("%s: err %b\n", DEVNAME(sc), ievent, TSEC_IEVENT_FMT); - ievent &= TSEC_IEVENT_BSY; - tsec_write(sc, TSEC_IEVENT, ievent); - - if (ievent & TSEC_IEVENT_BSY) { - /* - * We ran out of buffers and dropped one (or more) - * packets. We must clear RSTAT[QHLT] after - * processing the ring to get things started again. - */ - tsec_rx_proc(sc); - tsec_write(sc, TSEC_RSTAT, TSEC_RSTAT_QHLT); - ifp->if_ierrors++; - } - - return (1); -} - -void -tsec_tx_proc(struct tsec_softc *sc) -{ - struct ifnet *ifp = &sc->sc_ac.ac_if; - struct tsec_desc *txd; - struct tsec_buf *txb; - int idx; - - bus_dmamap_sync(sc->sc_dmat, TSEC_DMA_MAP(sc->sc_txring), 0, - TSEC_DMA_LEN(sc->sc_txring), - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - - while (sc->sc_tx_cnt > 0) { - idx = sc->sc_tx_cons; - KASSERT(idx < TSEC_NTXDESC); - - txd = &sc->sc_txdesc[idx]; - if (txd->td_status & TSEC_TX_R) - break; - - txb = &sc->sc_txbuf[idx]; - if (txb->tb_m) { - bus_dmamap_sync(sc->sc_dmat, txb->tb_map, 0, - txb->tb_map->dm_mapsize, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dmat, txb->tb_map); - - m_freem(txb->tb_m); - txb->tb_m = NULL; - } - - ifq_clr_oactive(&ifp->if_snd); - - sc->sc_tx_cnt--; - - if (txd->td_status & TSEC_TX_W) - sc->sc_tx_cons = 0; - else - sc->sc_tx_cons++; - - __asm volatile("eieio" ::: "memory"); - txd->td_status &= TSEC_TX_W; - } - - if (sc->sc_tx_cnt == 0) - ifp->if_timer = 0; -} - -void -tsec_rx_proc(struct tsec_softc *sc) -{ - struct ifnet *ifp = &sc->sc_ac.ac_if; - struct tsec_desc *rxd; - struct tsec_buf *rxb; - struct mbuf_list ml = MBUF_LIST_INITIALIZER(); - struct mbuf *m; - int idx, len; - - if ((ifp->if_flags & IFF_RUNNING) == 0) - return; - - bus_dmamap_sync(sc->sc_dmat, TSEC_DMA_MAP(sc->sc_rxring), 0, - TSEC_DMA_LEN(sc->sc_rxring), - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - - while (if_rxr_inuse(&sc->sc_rx_ring) > 0) { - idx = sc->sc_rx_cons; - KASSERT(idx < TSEC_NRXDESC); - - rxd = &sc->sc_rxdesc[idx]; - if (rxd->td_status & TSEC_RX_E) - break; - - len = rxd->td_len; - rxb = &sc->sc_rxbuf[idx]; - KASSERT(rxb->tb_m); - - bus_dmamap_sync(sc->sc_dmat, rxb->tb_map, 0, - len, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->sc_dmat, rxb->tb_map); - - /* Strip off CRC. */ - len -= ETHER_CRC_LEN; - KASSERT(len > 0); - - m = rxb->tb_m; - rxb->tb_m = NULL; - m->m_pkthdr.len = m->m_len = len; - - ml_enqueue(&ml, m); - - if_rxr_put(&sc->sc_rx_ring, 1); - if (rxd->td_status & TSEC_RX_W) - sc->sc_rx_cons = 0; - else - sc->sc_rx_cons++; - } - - tsec_fill_rx_ring(sc); - - bus_dmamap_sync(sc->sc_dmat, TSEC_DMA_MAP(sc->sc_rxring), 0, - TSEC_DMA_LEN(sc->sc_rxring), - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - - if_input(ifp, &ml); -} - -void -tsec_up(struct tsec_softc *sc) -{ - struct ifnet *ifp = &sc->sc_ac.ac_if; - struct tsec_desc *txd, *rxd; - struct tsec_buf *txb, *rxb; - uint32_t maccfg1, maccfg2, ecntrl, dmactrl, attr; - int i; - - /* Allocate Tx descriptor ring. */ - sc->sc_txring = tsec_dmamem_alloc(sc, - TSEC_NTXDESC * sizeof(struct tsec_desc), 8); - sc->sc_txdesc = TSEC_DMA_KVA(sc->sc_txring); - - sc->sc_txbuf = malloc(sizeof(struct tsec_buf) * TSEC_NTXDESC, - M_DEVBUF, M_WAITOK); - for (i = 0; i < TSEC_NTXDESC; i++) { - txb = &sc->sc_txbuf[i]; - bus_dmamap_create(sc->sc_dmat, MCLBYTES, TSEC_NTXSEGS, - MCLBYTES, 0, BUS_DMA_WAITOK, &txb->tb_map); - txb->tb_m = NULL; - } - - /* Set wrap bit on last descriptor. */ - txd = &sc->sc_txdesc[TSEC_NTXDESC - 1]; - txd->td_status = TSEC_TX_W; - bus_dmamap_sync(sc->sc_dmat, TSEC_DMA_MAP(sc->sc_txring), - (TSEC_NTXDESC - 1) * sizeof(*txd), sizeof(*txd), - BUS_DMASYNC_PREWRITE); - - sc->sc_tx_prod = sc->sc_tx_cons = 0; - sc->sc_tx_cnt = 0; - - tsec_write(sc, TSEC_TBASE, TSEC_DMA_DVA(sc->sc_txring)); - - /* Allocate Rx descriptor ring. */ - sc->sc_rxring = tsec_dmamem_alloc(sc, - TSEC_NRXDESC * sizeof(struct tsec_desc), 8); - sc->sc_rxdesc = TSEC_DMA_KVA(sc->sc_rxring); - - sc->sc_rxbuf = malloc(sizeof(struct tsec_buf) * TSEC_NRXDESC, - M_DEVBUF, M_WAITOK); - - for (i = 0; i < TSEC_NRXDESC; i++) { - rxb = &sc->sc_rxbuf[i]; - bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, - MCLBYTES, 0, BUS_DMA_WAITOK, &rxb->tb_map); - rxb->tb_m = NULL; - } - - /* Set wrap bit on last descriptor. */ - rxd = &sc->sc_rxdesc[TSEC_NRXDESC - 1]; - rxd->td_status |= TSEC_RX_W; - bus_dmamap_sync(sc->sc_dmat, TSEC_DMA_MAP(sc->sc_rxring), - 0, TSEC_DMA_LEN(sc->sc_rxring), BUS_DMASYNC_PREWRITE); - - sc->sc_rx_prod = sc->sc_rx_cons = 0; - - if_rxr_init(&sc->sc_rx_ring, 2, TSEC_NRXDESC); - tsec_fill_rx_ring(sc); - - tsec_write(sc, TSEC_MRBLR, MCLBYTES); - - tsec_write(sc, TSEC_RBASE, TSEC_DMA_DVA(sc->sc_rxring)); - - tsec_lladdr_write(sc); - - tsec_write(sc, TSEC_IADDR0, 0); - tsec_write(sc, TSEC_IADDR1, 0); - tsec_write(sc, TSEC_IADDR2, 0); - tsec_write(sc, TSEC_IADDR3, 0); - tsec_write(sc, TSEC_IADDR4, 0); - tsec_write(sc, TSEC_IADDR5, 0); - tsec_write(sc, TSEC_IADDR6, 0); - tsec_write(sc, TSEC_IADDR7, 0); - tsec_write(sc, TSEC_GADDR0, 0); - tsec_write(sc, TSEC_GADDR1, 0); - tsec_write(sc, TSEC_GADDR2, 0); - tsec_write(sc, TSEC_GADDR3, 0); - tsec_write(sc, TSEC_GADDR4, 0); - tsec_write(sc, TSEC_GADDR5, 0); - tsec_write(sc, TSEC_GADDR6, 0); - tsec_write(sc, TSEC_GADDR7, 0); - - maccfg1 = tsec_read(sc, TSEC_MACCFG1); - maccfg1 |= TSEC_MACCFG1_TXEN; - maccfg1 |= TSEC_MACCFG1_RXEN; - tsec_write(sc, TSEC_MACCFG1, maccfg1); - - /* - * Default to full-duplex MII mode, which is the mode most - * likely used by a directly connected integrated switch. For - * a real PHY the mode will be set later, based on the - * parameters negotiaded by the PHY. - */ - maccfg2 = tsec_read(sc, TSEC_MACCFG2); - maccfg2 &= ~TSEC_MACCFG2_IF_MODE; - maccfg2 |= TSEC_MACCFG2_IF_MII | TSEC_MACCFG2_FDX; - tsec_write(sc, TSEC_MACCFG2, maccfg2 | TSEC_MACCFG2_PAD); - - ecntrl = tsec_read(sc, TSEC_ECNTRL); - tsec_write(sc, TSEC_ECNTRL, ecntrl | TSEC_ECNTRL_R100M); - - dmactrl = tsec_read(sc, TSEC_DMACTRL); - dmactrl |= TSEC_DMACTRL_TDSEN; - dmactrl |= TSEC_DMACTRL_TBDSEN; - dmactrl |= TSEC_DMACTRL_WWR; - dmactrl |= TSEC_DMACTRL_WOP; - dmactrl &= ~(TSEC_DMACTRL_GTS | TSEC_DMACTRL_GRS); - tsec_write(sc, TSEC_DMACTRL, dmactrl); - - attr = tsec_read(sc, TSEC_ATTR); - attr |= TSEC_ATTR_RDSEN; - attr |= TSEC_ATTR_RBDSEN; - tsec_write(sc, TSEC_ATTR, attr); - - tsec_write(sc, TSEC_TSTAT, TSEC_TSTAT_THLT); - tsec_write(sc, TSEC_RSTAT, TSEC_RSTAT_QHLT); - - /* Configure media. */ - if (LIST_FIRST(&sc->sc_mii.mii_phys)) - mii_mediachg(&sc->sc_mii); - - /* Program promiscuous mode and multicast filters. */ - tsec_iff(sc); - - ifp->if_flags |= IFF_RUNNING; - ifq_clr_oactive(&ifp->if_snd); - - tsec_write(sc, TSEC_IMASK, TSEC_IMASK_TXEEN | - TSEC_IMASK_TXBEN | TSEC_IMASK_TXFEN | - TSEC_IMASK_RXBEN | TSEC_IMASK_RXFEN | TSEC_IMASK_BSYEN); - - timeout_add_sec(&sc->sc_tick, 1); -} - -void -tsec_down(struct tsec_softc *sc) -{ - struct ifnet *ifp = &sc->sc_ac.ac_if; - struct tsec_buf *txb, *rxb; - uint32_t maccfg1; - int i; - - timeout_del(&sc->sc_tick); - - ifp->if_flags &= ~IFF_RUNNING; - ifq_clr_oactive(&ifp->if_snd); - ifp->if_timer = 0; - - tsec_stop_dma(sc); - - maccfg1 = tsec_read(sc, TSEC_MACCFG1); - maccfg1 &= ~TSEC_MACCFG1_TXEN; - maccfg1 &= ~TSEC_MACCFG1_RXEN; - tsec_write(sc, TSEC_MACCFG1, maccfg1); - - for (i = 0; i < TSEC_NTXDESC; i++) { - txb = &sc->sc_txbuf[i]; - if (txb->tb_m) { - bus_dmamap_sync(sc->sc_dmat, txb->tb_map, 0, - txb->tb_map->dm_mapsize, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dmat, txb->tb_map); - m_freem(txb->tb_m); - } - bus_dmamap_destroy(sc->sc_dmat, txb->tb_map); - } - - tsec_dmamem_free(sc, sc->sc_txring); - free(sc->sc_txbuf, M_DEVBUF, 0); - - for (i = 0; i < TSEC_NRXDESC; i++) { - rxb = &sc->sc_rxbuf[i]; - if (rxb->tb_m) { - bus_dmamap_sync(sc->sc_dmat, rxb->tb_map, 0, - rxb->tb_map->dm_mapsize, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->sc_dmat, rxb->tb_map); - m_freem(rxb->tb_m); - } - bus_dmamap_destroy(sc->sc_dmat, rxb->tb_map); - } - - tsec_dmamem_free(sc, sc->sc_rxring); - free(sc->sc_rxbuf, M_DEVBUF, 0); -} - -void -tsec_iff(struct tsec_softc *sc) -{ - struct arpcom *ac = &sc->sc_ac; - struct ifnet *ifp = &sc->sc_ac.ac_if; - struct ether_multi *enm; - struct ether_multistep step; - uint32_t crc, hash[8]; - uint32_t rctrl; - int i; - - rctrl = tsec_read(sc, TSEC_RCTRL); - rctrl &= ~TSEC_RCTRL_PROM; - ifp->if_flags &= ~IFF_ALLMULTI; - - if (ifp->if_flags & IFF_PROMISC || ac->ac_multirangecnt > 0) { - ifp->if_flags |= IFF_ALLMULTI; - rctrl |= TSEC_RCTRL_PROM; - bzero(hash, sizeof(hash)); - } else { - ETHER_FIRST_MULTI(step, ac, enm); - while (enm != NULL) { - crc = ether_crc32_be(enm->enm_addrlo, - ETHER_ADDR_LEN); - - crc >>= 24; - hash[crc / 32] |= 1 << (31 - (crc % 32)); - - ETHER_NEXT_MULTI(step, enm); - } - } - - for (i = 0; i < nitems(hash); i++) - tsec_write(sc, TSEC_GADDR0 + i * 4, hash[i]); - - tsec_write(sc, TSEC_RCTRL, rctrl); -} - -int -tsec_encap(struct tsec_softc *sc, struct mbuf *m, int *idx) -{ - struct tsec_desc *txd; - bus_dmamap_t map; - int cur, frag, i; - uint16_t status; - - cur = frag = *idx; - map = sc->sc_txbuf[cur].tb_map; - - if (bus_dmamap_load_mbuf(sc->sc_dmat, map, m, BUS_DMA_NOWAIT)) { - if (m_defrag(m, M_DONTWAIT)) - return (EFBIG); - if (bus_dmamap_load_mbuf(sc->sc_dmat, map, m, BUS_DMA_NOWAIT)) - return (EFBIG); - } - - if (map->dm_nsegs > (TSEC_NTXDESC - sc->sc_tx_cnt - 2)) { - bus_dmamap_unload(sc->sc_dmat, map); - return (ENOBUFS); - } - - /* Sync the DMA map. */ - bus_dmamap_sync(sc->sc_dmat, map, 0, map->dm_mapsize, - BUS_DMASYNC_PREWRITE); - - txd = &sc->sc_txdesc[frag]; - for (i = 0; i < map->dm_nsegs; i++) { - status = txd->td_status & TSEC_TX_W; - status |= TSEC_TX_TO1; - if (i == (map->dm_nsegs - 1)) - status |= TSEC_TX_L; - txd->td_len = map->dm_segs[i].ds_len; - txd->td_addr = map->dm_segs[i].ds_addr; - __asm volatile("eieio" ::: "memory"); - txd->td_status = status | TSEC_TX_R | TSEC_TX_I | TSEC_TX_TC; - - bus_dmamap_sync(sc->sc_dmat, TSEC_DMA_MAP(sc->sc_txring), - frag * sizeof(*txd), sizeof(*txd), BUS_DMASYNC_PREWRITE); - - cur = frag; - if (status & TSEC_TX_W) { - txd = &sc->sc_txdesc[0]; - frag = 0; - } else { - txd++; - frag++; - } - KASSERT(frag != sc->sc_tx_cons); - - tsec_write(sc, TSEC_TSTAT, TSEC_TSTAT_THLT); - } - - KASSERT(sc->sc_txbuf[cur].tb_m == NULL); - sc->sc_txbuf[*idx].tb_map = sc->sc_txbuf[cur].tb_map; - sc->sc_txbuf[cur].tb_map = map; - sc->sc_txbuf[cur].tb_m = m; - - sc->sc_tx_cnt += map->dm_nsegs; - *idx = frag; - - return (0); -} - -void -tsec_reset(struct tsec_softc *sc) -{ - tsec_stop_dma(sc); - - /* Set, then clear MACCFG1[Soft_Reset]. */ - tsec_write(sc, TSEC_MACCFG1, TSEC_MACCFG1_RESET); - tsec_write(sc, TSEC_MACCFG1, 0); - - /* Clear IEVENT. */ - tsec_write(sc, TSEC_IEVENT, 0xffffffff); -} - -void -tsec_stop_dma(struct tsec_softc *sc) -{ - uint32_t dmactrl, ievent; - int n; - - /* Stop DMA. */ - dmactrl = tsec_read(sc, TSEC_DMACTRL); - dmactrl |= TSEC_DMACTRL_GTS; - tsec_write(sc, TSEC_DMACTRL, dmactrl); - - for (n = 0; n < 100; n++) { - ievent = tsec_read(sc, TSEC_IEVENT); - if (ievent & TSEC_IEVENT_GTSC) - break; - } - KASSERT(n != 100); - - dmactrl = tsec_read(sc, TSEC_DMACTRL); - dmactrl |= TSEC_DMACTRL_GRS; - tsec_write(sc, TSEC_DMACTRL, dmactrl); - - for (n = 0; n < 100; n++) { - ievent = tsec_read(sc, TSEC_IEVENT); - if (ievent & TSEC_IEVENT_GRSC) - break; - } - KASSERT(n != 100); -} - -struct tsec_dmamem * -tsec_dmamem_alloc(struct tsec_softc *sc, bus_size_t size, bus_size_t align) -{ - struct tsec_dmamem *tdm; - int nsegs; - - tdm = malloc(sizeof(*tdm), M_DEVBUF, M_WAITOK | M_ZERO); - tdm->tdm_size = size; - - if (bus_dmamap_create(sc->sc_dmat, size, 1, size, 0, - BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW, &tdm->tdm_map) != 0) - goto tdmfree; - - if (bus_dmamem_alloc(sc->sc_dmat, size, align, 0, &tdm->tdm_seg, 1, - &nsegs, BUS_DMA_WAITOK) != 0) - goto destroy; - - if (bus_dmamem_map(sc->sc_dmat, &tdm->tdm_seg, nsegs, size, - &tdm->tdm_kva, BUS_DMA_WAITOK) != 0) - goto free; - - if (bus_dmamap_load(sc->sc_dmat, tdm->tdm_map, tdm->tdm_kva, size, - NULL, BUS_DMA_WAITOK) != 0) - goto unmap; - - bzero(tdm->tdm_kva, size); - - return (tdm); - -unmap: - bus_dmamem_unmap(sc->sc_dmat, tdm->tdm_kva, size); -free: - bus_dmamem_free(sc->sc_dmat, &tdm->tdm_seg, 1); -destroy: - bus_dmamap_destroy(sc->sc_dmat, tdm->tdm_map); -tdmfree: - free(tdm, M_DEVBUF, 0); - - return (NULL); -} - -void -tsec_dmamem_free(struct tsec_softc *sc, struct tsec_dmamem *tdm) -{ - bus_dmamem_unmap(sc->sc_dmat, tdm->tdm_kva, tdm->tdm_size); - bus_dmamem_free(sc->sc_dmat, &tdm->tdm_seg, 1); - bus_dmamap_destroy(sc->sc_dmat, tdm->tdm_map); - free(tdm, M_DEVBUF, 0); -} - -struct mbuf * -tsec_alloc_mbuf(struct tsec_softc *sc, bus_dmamap_t map) -{ - struct mbuf *m = NULL; - - m = MCLGETI(NULL, M_DONTWAIT, NULL, MCLBYTES); - if (!m) - return (NULL); - m->m_len = m->m_pkthdr.len = MCLBYTES; - - if (bus_dmamap_load_mbuf(sc->sc_dmat, map, m, BUS_DMA_NOWAIT) != 0) { - printf("%s: could not load mbuf DMA map", DEVNAME(sc)); - m_freem(m); - return (NULL); - } - - bus_dmamap_sync(sc->sc_dmat, map, 0, - m->m_pkthdr.len, BUS_DMASYNC_PREREAD); - - return (m); -} - -void -tsec_fill_rx_ring(struct tsec_softc *sc) -{ - struct tsec_desc *rxd; - struct tsec_buf *rxb; - u_int slots; - - for (slots = if_rxr_get(&sc->sc_rx_ring, TSEC_NRXDESC); - slots > 0; slots--) { - rxb = &sc->sc_rxbuf[sc->sc_rx_prod]; - rxb->tb_m = tsec_alloc_mbuf(sc, rxb->tb_map); - if (rxb->tb_m == NULL) - break; - - rxd = &sc->sc_rxdesc[sc->sc_rx_prod]; - rxd->td_len = 0; - rxd->td_addr = rxb->tb_map->dm_segs[0].ds_addr; - __asm volatile("eieio" ::: "memory"); - rxd->td_status |= TSEC_RX_E | TSEC_RX_I; - - if (rxd->td_status & TSEC_RX_W) - sc->sc_rx_prod = 0; - else - sc->sc_rx_prod++; - } - if_rxr_put(&sc->sc_rx_ring, slots); -} diff --git a/sys/arch/socppc/dev/ipic.c b/sys/arch/socppc/dev/ipic.c deleted file mode 100644 index 669bd3289c5..00000000000 --- a/sys/arch/socppc/dev/ipic.c +++ /dev/null @@ -1,410 +0,0 @@ -/* $OpenBSD: ipic.c,v 1.18 2015/06/24 11:58:06 mpi Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> -#include <sys/malloc.h> - -#include <machine/autoconf.h> -#include <machine/intr.h> - -#include <dev/ofw/openfirm.h> - -#define IPIC_SICFR 0x00 -#define IPIC_SIVCR 0x04 -#define IPIC_SIPNR_H 0x08 -#define IPIC_SIPNR_L 0x0c -#define IPIC_SIPRR_A 0x10 -#define IPIC_SIPRR_D 0x1c -#define IPIC_SIMSR_H 0x20 -#define IPIC_SIMSR_L 0x24 -#define IPIC_SICNR 0x28 -#define IPIC_SEPNR 0x2c -#define IPIC_SMPRR_A 0x30 -#define IPIC_SMPRR_B 0x34 -#define IPIC_SEMSR 0x38 -#define IPIC_SECNR 0x3c -#define IPIC_SERSR 0x40 -#define IPIC_SERMR 0x44 -#define IPIC_SERCR 0x48 -#define IPIC_SIFCR_H 0x50 -#define IPIC_SIFCR_L 0x54 -#define IPIC_SEFCR 0x58 -#define IPIC_SERFR 0x5c -#define IPIC_SCVCR 0x60 -#define IPIC_SMVCR 0x64 - -#define IPIC_NVEC 128 - -#define IPIC_EXTERNAL(ivec) ((ivec) >= 17 && (ivec) <= 23) - -struct ipic_softc { - struct device sc_dev; - bus_space_tag_t sc_iot; - bus_space_handle_t sc_ioh; - - uint32_t sc_simsr_h[IPL_NUM]; - uint32_t sc_simsr_l[IPL_NUM]; - uint32_t sc_semsr[IPL_NUM]; -}; - -uint32_t ipic_imask; -struct intrq ipic_handler[IPIC_NVEC]; -struct ipic_softc *ipic_sc; -int ipic_preinit_done; /* defaults to 0 - not initialized */ - -int ipic_match(struct device *, void *, void *); -void ipic_attach(struct device *, struct device *, void *); - -struct cfattach ipic_ca = { - sizeof(struct ipic_softc), ipic_match, ipic_attach -}; - -struct cfdriver ipic_cd = { - NULL, "ipic", DV_DULL -}; - -void ipic_preinit(void); -uint32_t ipic_read(struct ipic_softc *, bus_addr_t); -void ipic_write(struct ipic_softc *, bus_addr_t, uint32_t); -uint32_t ipic_simsr_h(int); -uint32_t ipic_simsr_l(int); -uint32_t ipic_semsr(int); -void ipic_calc_masks(void); - -void ext_intr(void); - -ppc_splraise_t ipic_splraise; -ppc_spllower_t ipic_spllower; -ppc_splx_t ipic_splx; - -void ipic_setipl(int); - -void -ipic_preinit(void) -{ - int i; - struct intrq *iq; - - for (i = 0; i < IPIC_NVEC; i++) { - iq = &ipic_handler[i]; - TAILQ_INIT(&iq->iq_list); - } - ipic_preinit_done = 1; -} - -int -ipic_match(struct device *parent, void *cfdata, void *aux) -{ - struct obio_attach_args *oa = aux; - char buf[32]; - - if (OF_getprop(oa->oa_node, "device_type", buf, sizeof(buf)) <= 0 || - strcmp(buf, "ipic") != 0) - return (0); - - return (1); -} - -void -ipic_attach(struct device *parent, struct device *self, void *aux) -{ - struct ipic_softc *sc = (void *)self; - struct obio_attach_args *oa = aux; - int ivec; - struct intrq *iq; - - sc->sc_iot = oa->oa_iot; - if (bus_space_map(sc->sc_iot, oa->oa_offset, 128, 0, &sc->sc_ioh)) { - printf(": can't map registers\n"); - return; - } - - ipic_sc = sc; - - /* if ipic_preinit has not happened, do it here */ - if (ipic_preinit_done == 0) - ipic_preinit(); - - /* - * Deal with pre-established interrupts. - */ - for (ivec = 0; ivec < IPIC_NVEC; ivec++) { - iq = &ipic_handler[ivec]; - if (!TAILQ_EMPTY(&iq->iq_list)) { - int level = TAILQ_FIRST(&iq->iq_list)->ih_level; - - sc->sc_simsr_h[level] |= ipic_simsr_h(ivec); - sc->sc_simsr_l[level] |= ipic_simsr_l(ivec); - sc->sc_semsr[level] |= ipic_semsr(ivec); - ipic_calc_masks(); - } - } - - ppc_smask_init(); - ppc_intr_func.raise = ipic_splraise; - ppc_intr_func.lower = ipic_spllower; - ppc_intr_func.x = ipic_splx; - - printf("\n"); -} - -uint32_t -ipic_read(struct ipic_softc *sc, bus_addr_t addr) -{ - return (letoh32(bus_space_read_4(sc->sc_iot, sc->sc_ioh, addr))); -} - -void -ipic_write(struct ipic_softc *sc, bus_addr_t addr, uint32_t data) -{ - bus_space_write_4(sc->sc_iot, sc->sc_ioh, addr, htole32(data)); -} - -uint32_t -ipic_simsr_h(int ivec) -{ - switch (ivec) { - case 9: - return 0x00000080; - case 10: - return 0x00000040; - case 32: - return 0x80000000; - case 33: - return 0x40000000; - case 34: - return 0x20000000; - case 35: - return 0x10000000; - case 36: - return 0x08000000; - case 37: - return 0x04000000; - case 39: - return 0x01000000; - } - - return 0; -} - -uint32_t -ipic_simsr_l(int ivec) -{ - return 0; -} - -uint32_t -ipic_semsr(int ivec) -{ - switch (ivec) { - case 17: - return 0x40000000; - case 18: - return 0x20000000; - case 19: - return 0x10000000; - case 20: - return 0x08000000; - case 21: - return 0x04000000; - case 22: - return 0x02000000; - case 23: - return 0x01000000; - case 48: - return 0x80000000; - } - - return 0; -} - -void -ipic_calc_masks(void) -{ - struct ipic_softc *sc = ipic_sc; - - sc->sc_simsr_h[IPL_NET] |= sc->sc_simsr_h[IPL_BIO]; - sc->sc_simsr_h[IPL_TTY] |= sc->sc_simsr_h[IPL_NET]; - sc->sc_simsr_h[IPL_VM] |= sc->sc_simsr_h[IPL_TTY]; - sc->sc_simsr_h[IPL_CLOCK] |= sc->sc_simsr_h[IPL_VM]; - sc->sc_simsr_h[IPL_HIGH] |= sc->sc_simsr_h[IPL_CLOCK]; - - sc->sc_simsr_l[IPL_NET] |= sc->sc_simsr_l[IPL_BIO]; - sc->sc_simsr_l[IPL_TTY] |= sc->sc_simsr_l[IPL_NET]; - sc->sc_simsr_l[IPL_VM] |= sc->sc_simsr_l[IPL_TTY]; - sc->sc_simsr_l[IPL_CLOCK] |= sc->sc_simsr_l[IPL_VM]; - sc->sc_simsr_l[IPL_HIGH] |= sc->sc_simsr_l[IPL_CLOCK]; - - sc->sc_semsr[IPL_NET] |= sc->sc_semsr[IPL_BIO]; - sc->sc_semsr[IPL_TTY] |= sc->sc_semsr[IPL_NET]; - sc->sc_semsr[IPL_VM] |= sc->sc_semsr[IPL_TTY]; - sc->sc_semsr[IPL_CLOCK] |= sc->sc_semsr[IPL_VM]; - sc->sc_semsr[IPL_HIGH] |= sc->sc_semsr[IPL_CLOCK]; -} - -void * -intr_establish(int ivec, int type, int level, - int (*ih_fun)(void *), void *ih_arg, const char *name) -{ - struct ipic_softc *sc = ipic_sc; - struct intrhand *ih; - struct intrq *iq; - int s, flags; - - if (ipic_preinit_done == 0) - ipic_preinit(); - - ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); - if (ih == NULL) - panic("%s: malloc failed", __func__); - iq = &ipic_handler[ivec]; - - if (ivec < 0 || ivec >= IPIC_NVEC) - panic("%s: invalid vector %d", __func__, ivec); - - if (sc) { - sc->sc_simsr_h[level] |= ipic_simsr_h(ivec); - sc->sc_simsr_l[level] |= ipic_simsr_l(ivec); - sc->sc_semsr[level] |= ipic_semsr(ivec); - ipic_calc_masks(); - } - - flags = level & IPL_MPSAFE; - level &= ~IPL_MPSAFE; - - KASSERT(level <= IPL_TTY || level >= IPL_CLOCK || flags & IPL_MPSAFE); - - ih->ih_fun = ih_fun; - ih->ih_arg = ih_arg; - ih->ih_level = level; - ih->ih_flags = flags; - ih->ih_irq = ivec; - - evcount_attach(&ih->ih_count, name, &ih->ih_irq); - - /* - * Append handler to end of list - */ - s = ppc_intr_disable(); - TAILQ_INSERT_TAIL(&iq->iq_list, ih, ih_list); - - /* Unmask the interrupt. */ - if (sc) - ipic_setipl(curcpu()->ci_cpl); - ppc_intr_enable(s); - - return (ih); -} - -void -ext_intr(void) -{ - struct cpu_info *ci = curcpu(); - struct ipic_softc *sc = ipic_sc; - struct intrhand *ih; - struct intrq *iq; - int pcpl; - int ivec; - - pcpl = ci->ci_cpl; - ivec = ipic_read(sc, IPIC_SIVCR) & 0x7f; - - iq = &ipic_handler[ivec]; - TAILQ_FOREACH(ih, &iq->iq_list, ih_list) { - if (ih->ih_level <= pcpl) { - panic("irq handler called at wrong level %d %d", - ih->ih_level, pcpl); - continue; - } - - ipic_splraise(ih->ih_level); - ppc_intr_enable(1); - - KERNEL_LOCK(); - if ((*ih->ih_fun)(ih->ih_arg)) - ih->ih_count.ec_count++; - KERNEL_UNLOCK(); - - ppc_intr_disable(); - } - - splx(pcpl); -} - -int -ipic_splraise(int newcpl) -{ - struct cpu_info *ci = curcpu(); - int ocpl = ci->ci_cpl; - int s; - - if (ocpl > newcpl) - newcpl = ocpl; - - s = ppc_intr_disable(); - ipic_setipl(newcpl); - ppc_intr_enable(s); - - return (ocpl); -} - -int -ipic_spllower(int newcpl) -{ - struct cpu_info *ci = curcpu(); - int ocpl = ci->ci_cpl; - - ipic_splx(newcpl); - - return (ocpl); -} - -void -ipic_splx(int newcpl) -{ - struct cpu_info *ci = curcpu(); - int intr, s; - - intr = ppc_intr_disable(); - ipic_setipl(newcpl); - if (newcpl < IPL_SOFTTTY && (ci->ci_ipending & ppc_smask[newcpl])) { - s = splsofttty(); - dosoftint(newcpl); - ipic_setipl(s); /* no-overhead splx */ - } - ppc_intr_enable(intr); -} - -/* Must be called with interrupt disable. */ -void -ipic_setipl(int ipl) -{ - struct cpu_info *ci = curcpu(); - struct ipic_softc *sc = ipic_sc; - uint32_t mask; - - ci->ci_cpl = ipl; - mask = sc->sc_simsr_h[IPL_HIGH] & ~sc->sc_simsr_h[ipl]; - ipic_write(sc, IPIC_SIMSR_H, mask); - mask = sc->sc_simsr_l[IPL_HIGH] & ~sc->sc_simsr_l[ipl]; - ipic_write(sc, IPIC_SIMSR_L, mask); - mask = sc->sc_semsr[IPL_HIGH] & ~sc->sc_semsr[ipl]; - ipic_write(sc, IPIC_SEMSR, mask); -} diff --git a/sys/arch/socppc/dev/obio.c b/sys/arch/socppc/dev/obio.c deleted file mode 100644 index 77b517208d0..00000000000 --- a/sys/arch/socppc/dev/obio.c +++ /dev/null @@ -1,101 +0,0 @@ -/* $OpenBSD: obio.c,v 1.6 2014/05/09 18:16:15 miod Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> - -#include <machine/autoconf.h> - -#include <dev/ofw/openfirm.h> - -int obio_match(struct device *, void *, void *); -void obio_attach(struct device *, struct device *, void *); - -struct cfattach obio_ca = { - sizeof(struct device), obio_match, obio_attach -}; - -struct cfdriver obio_cd = { - NULL, "obio", DV_DULL -}; - -int obio_print(void *, const char *); - -int -obio_match(struct device *parent, void *cfdata, void *aux) -{ - struct mainbus_attach_args *ma = aux; - char buf[32]; - - if (OF_getprop(ma->ma_node, "device_type", buf, sizeof(buf)) <= 0) - return (0); - - if (strcmp(buf, "soc") == 0) - return (1); - - return (0); -} - -void -obio_attach(struct device *parent, struct device *self, void *aux) -{ - struct mainbus_attach_args *ma = aux; - struct obio_attach_args oa; - char name[32]; - int node; - - printf("\n"); - - for (node = OF_child(ma->ma_node); node != 0; node = OF_peer(node)) { - int reg, ivec; - - if (OF_getprop(node, "name", name, sizeof(name)) <= 0) - continue; - - if (OF_getprop(node, "reg", ®, sizeof(reg)) <= 0) - reg = 0; - - if (OF_getprop(node, "interrupts", &ivec, sizeof(ivec)) <= 0) - ivec = -1; - - bzero(&oa, sizeof oa); - oa.oa_iot = ma->ma_iot; - oa.oa_dmat = ma->ma_dmat; - oa.oa_name = name; - oa.oa_node = node; - oa.oa_offset = reg; - oa.oa_ivec = ivec; - config_found(self, &oa, obio_print); - } -} - -int -obio_print(void *aux, const char *name) -{ - struct obio_attach_args *oa = aux; - - if (name) - printf("\"%s\" at %s", oa->oa_name, name); - if (oa->oa_offset) - printf(" offset 0x%05lx", oa->oa_offset); - if (oa->oa_ivec != -1) - printf(" ivec %d", oa->oa_ivec); - - return (UNCONF); -} diff --git a/sys/arch/socppc/dev/pciide_machdep.c b/sys/arch/socppc/dev/pciide_machdep.c deleted file mode 100644 index b9b3ab8a9c9..00000000000 --- a/sys/arch/socppc/dev/pciide_machdep.c +++ /dev/null @@ -1,40 +0,0 @@ -/* $OpenBSD: pciide_machdep.c,v 1.1 2008/05/10 12:02:20 kettenis Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <dev/pci/pciidereg.h> -#include <dev/pci/pciidevar.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) -{ - return (NULL); -} - -void -pciide_machdep_compat_intr_disestablish(pci_chipset_tag_t pc, void *cookie) -{ -} diff --git a/sys/arch/socppc/dev/sociic.c b/sys/arch/socppc/dev/sociic.c deleted file mode 100644 index 36d41c2dadd..00000000000 --- a/sys/arch/socppc/dev/sociic.c +++ /dev/null @@ -1,299 +0,0 @@ -/* $OpenBSD: sociic.c,v 1.2 2009/09/06 20:09:34 kettenis Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * Driver for the I2C interface on the MPC8349E processors. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> -#include <sys/rwlock.h> - -#include <machine/autoconf.h> -#include <machine/bus.h> - -#include <dev/ofw/openfirm.h> - -#include <dev/i2c/i2cvar.h> - -#define I2C_ADR 0x00 /* Address Register */ -#define I2C_FDR 0x04 /* Fequency Divider Register */ -#define I2C_CR 0x08 /* Control Register */ -#define I2C_CR_MEN 0x80 -#define I2C_CR_MIEN 0x40 -#define I2C_CR_MSTA 0x20 -#define I2C_CR_MTX 0x10 -#define I2C_CR_TXAK 0x08 -#define I2C_CR_RSTA 0x04 -#define I2C_CR_BCST 0x01 -#define I2C_SR 0x0c /* Status Register */ -#define I2C_SR_MCF 0x80 -#define I2C_SR_MAAS 0x40 -#define I2C_SR_MBB 0x20 -#define I2C_SR_MAL 0x10 -#define I2C_SR_BCSTM 0x08 -#define I2C_SR_SRW 0x04 -#define I2C_SR_MIF 0x02 -#define I2C_SR_RXAK 0x01 -#define I2C_DR 0x10 /* Data Register */ -#define I2C_DFSRR 0x14 /* Digital Filter Sampling Rate Register */ - -struct sociic_softc { - struct device sc_dev; - bus_space_tag_t sc_iot; - bus_space_handle_t sc_ioh; - - struct i2c_controller sc_i2c; - struct rwlock sc_lock; -}; - -int sociic_match(struct device *, void *, void *); -void sociic_attach(struct device *, struct device *, void *); - -struct cfattach sociic_ca = { - sizeof(struct sociic_softc), sociic_match, sociic_attach -}; - -struct cfdriver sociic_cd = { - NULL, "sociic", DV_DULL -}; - -void sociic_write(struct sociic_softc *, bus_addr_t, uint8_t); -uint8_t sociic_read(struct sociic_softc *, bus_addr_t); -int sociic_wait(struct sociic_softc *, int); -int sociic_wait_bus(struct sociic_softc *); -int sociic_i2c_acquire_bus(void *, int); -void sociic_i2c_release_bus(void *, int); -int sociic_i2c_exec(void *, i2c_op_t, i2c_addr_t, - const void *, size_t, void *, size_t, int); - -int -sociic_match(struct device *parent, void *cfdata, void *aux) -{ - struct obio_attach_args *oa = aux; - char buf[32]; - - if (OF_getprop(oa->oa_node, "compatible", buf, sizeof(buf)) <= 0 || - strcmp(buf, "fsl-i2c") != 0) - return (0); - - return (1); -} - -void -sociic_attach(struct device *parent, struct device *self, void *aux) -{ - struct sociic_softc *sc = (void *)self; - struct obio_attach_args *oa = aux; - struct i2cbus_attach_args iba; - - sc->sc_iot = oa->oa_iot; - if (bus_space_map(sc->sc_iot, oa->oa_offset, 24, 0, &sc->sc_ioh)) { - printf(": can't map registers\n"); - return; - } - - printf("\n"); - - rw_init(&sc->sc_lock, "iiclk"); - sc->sc_i2c.ic_cookie = sc; - sc->sc_i2c.ic_acquire_bus = sociic_i2c_acquire_bus; - sc->sc_i2c.ic_release_bus = sociic_i2c_release_bus; - sc->sc_i2c.ic_exec = sociic_i2c_exec; - - bzero(&iba, sizeof iba); - iba.iba_name = "iic"; - iba.iba_tag = &sc->sc_i2c; - config_found(&sc->sc_dev, &iba, iicbus_print); -} - -void -sociic_write(struct sociic_softc *sc, bus_addr_t addr, uint8_t data) -{ - bus_space_write_1(sc->sc_iot, sc->sc_ioh, addr, data); -} - -uint8_t -sociic_read(struct sociic_softc *sc, bus_addr_t addr) -{ - return (bus_space_read_1(sc->sc_iot, sc->sc_ioh, addr)); -} - -int -sociic_wait(struct sociic_softc *sc, int flags) -{ - uint8_t sr; - int i; - - for (i = 0; i < 1000; i++) { - sr = sociic_read(sc, I2C_SR); - if (sr & I2C_SR_MIF) { - sociic_write(sc, I2C_SR, 0); - - if (sr & I2C_SR_MAL) - return (EIO); - - if ((sr & I2C_SR_MCF) == 0) - return (EIO); - - if ((flags & I2C_F_READ) == 0 && (sr & I2C_SR_RXAK)) - return (EIO); - - return (0); - } - delay(100); - } - - return (ETIMEDOUT); -} - -int -sociic_wait_bus(struct sociic_softc *sc) -{ - uint8_t sr; - int i; - - for (i = 0; i < 1000; i++) { - sr = sociic_read(sc, I2C_SR); - if ((sr & I2C_SR_MBB) == 0) - return (0); - delay(1000); - } - - return (ETIMEDOUT); -} - -int -sociic_i2c_acquire_bus(void *arg, int flags) -{ - struct sociic_softc *sc = arg; - - if (cold || (flags & I2C_F_POLL)) - return (0); - - return (rw_enter(&sc->sc_lock, RW_WRITE | RW_INTR)); -} - -void -sociic_i2c_release_bus(void *arg, int flags) -{ - struct sociic_softc *sc = arg; - - if (cold || (flags & I2C_F_POLL)) - return; - - rw_exit(&sc->sc_lock); -} - -int -sociic_i2c_exec(void *arg, i2c_op_t op, i2c_addr_t addr, - const void *vcmdbuf, size_t cmdlen, void *vbuf, size_t buflen, int flags) -{ - struct sociic_softc *sc = arg; - const uint8_t *cmdbuf = vcmdbuf; - uint8_t *buf = vbuf; - int err = 0; - size_t len; - uint8_t val; - - /* Clear the bus. */ - sociic_write(sc, I2C_SR, 0); - sociic_write(sc, I2C_CR, I2C_CR_MEN); - err = sociic_wait_bus(sc); - if (err) - return (err); - - if (cmdlen > 0) { - sociic_write(sc, I2C_CR, I2C_CR_MEN|I2C_CR_MSTA|I2C_CR_MTX); - sociic_write(sc, I2C_DR, addr << 1); - err = sociic_wait(sc, I2C_F_WRITE); - if (err) - goto out; - - len = cmdlen; - while (len--) { - sociic_write(sc, I2C_DR, *cmdbuf++); - err = sociic_wait(sc, I2C_F_WRITE); - if (err) - goto out; - } - } - - if (I2C_OP_READ_P(op) && buflen > 0) { - /* RESTART if we did write a command above. */ - val = I2C_CR_MEN|I2C_CR_MSTA|I2C_CR_MTX; - if (cmdlen > 0) - val |= I2C_CR_RSTA; - sociic_write(sc, I2C_CR, val); - sociic_write(sc, I2C_DR, (addr << 1) | 1); - err = sociic_wait(sc, I2C_F_WRITE); - if (err) - goto out; - - /* NACK if we're only sending one byte. */ - val = I2C_CR_MEN|I2C_CR_MSTA; - if (buflen == 1) - val |= I2C_CR_TXAK; - sociic_write(sc, I2C_CR, val); - - /* Dummy read. */ - sociic_read(sc, I2C_DR); - - len = buflen; - while (len--) { - err = sociic_wait(sc, I2C_F_READ); - if (err) - goto out; - - /* NACK on last byte. */ - if (len == 1) - sociic_write(sc, I2C_CR, - I2C_CR_MEN|I2C_CR_MSTA|I2C_CR_TXAK); - /* STOP after last byte. */ - if (len == 0) - sociic_write(sc, I2C_CR, - I2C_CR_MEN|I2C_CR_TXAK); - *buf++ = sociic_read(sc, I2C_DR); - } - } - - if (I2C_OP_WRITE_P(op) && cmdlen == 0 && buflen > 0) { - /* START if we didn't write a command. */ - sociic_write(sc, I2C_CR, I2C_CR_MEN|I2C_CR_MSTA|I2C_CR_MTX); - sociic_write(sc, I2C_DR, addr << 1); - err = sociic_wait(sc, I2C_F_WRITE); - if (err) - goto out; - } - - if (I2C_OP_WRITE_P(op) && buflen > 0) { - len = buflen; - while (len--) { - sociic_write(sc, I2C_DR, *buf++); - err = sociic_wait(sc, I2C_F_WRITE); - if (err) - goto out; - } - } - -out: - /* STOP if we're still holding the bus. */ - sociic_write(sc, I2C_CR, I2C_CR_MEN); - return (err); -} diff --git a/sys/arch/socppc/dev/socpcic.c b/sys/arch/socppc/dev/socpcic.c deleted file mode 100644 index ad319baa25e..00000000000 --- a/sys/arch/socppc/dev/socpcic.c +++ /dev/null @@ -1,441 +0,0 @@ -/* $OpenBSD: socpcic.c,v 1.10 2016/01/21 08:03:08 jsg Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> - -#include <machine/autoconf.h> -#include <machine/bus.h> - -#include <dev/ofw/openfirm.h> -#include <dev/ofw/ofw_pci.h> - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <dev/pci/pcidevs.h> - -struct socpcic_softc { - struct device sc_dev; - - int sc_node; - - bus_space_tag_t sc_iot; - bus_space_handle_t sc_cfg_ioh; - struct ppc_bus_space sc_mem_bus_space; - struct ppc_bus_space sc_io_bus_space; - bus_dma_tag_t sc_dmat; - struct ppc_pci_chipset sc_pc; - - /* Interrupt mapping. */ - int sc_map_mask[4]; - int *sc_map; - int sc_map_len; - - /* Addres space. */ - uint32_t *sc_ranges; - int sc_ranges_len; -}; - -int socpcic_mainbus_match(struct device *, void *, void *); -void socpcic_mainbus_attach(struct device *, struct device *, void *); -int socpcic_obio_match(struct device *, void *, void *); -void socpcic_obio_attach(struct device *, struct device *, void *); - -struct cfattach socpcic_mainbus_ca = { - sizeof(struct socpcic_softc), - socpcic_mainbus_match, socpcic_mainbus_attach -}; - -struct cfattach socpcic_obio_ca = { - sizeof(struct socpcic_softc), - socpcic_obio_match, socpcic_obio_attach -}; - -struct cfdriver socpcic_cd = { - NULL, "socpcic", DV_DULL -}; - -void socpcic_attach(struct socpcic_softc *sc); -void socpcic_attach_hook(struct device *, struct device *, - struct pcibus_attach_args *); -int socpcic_bus_maxdevs(void *, int); -pcitag_t socpcic_make_tag(void *, int, int, int); -void socpcic_decompose_tag(void *, pcitag_t, int *, int *, int *); -int socpcic_conf_size(void *, pcitag_t); -pcireg_t socpcic_conf_read(void *, pcitag_t, int); -void socpcic_conf_write(void *, pcitag_t, int, pcireg_t); -int socpcic_intr_map(void *, pcitag_t, int, int, pci_intr_handle_t *); -const char *socpcic_intr_string(void *, pci_intr_handle_t); -int socpcic_intr_line(void *, pci_intr_handle_t); -void *socpcic_intr_establish(void *, pci_intr_handle_t, int, - int (*)(void *), void *, const char *); -void socpcic_intr_disestablish(void *, void *); -int socpcic_ether_hw_addr(struct ppc_pci_chipset *, u_int8_t *); - -int socpcic_print(void *, const char *); - -int -socpcic_mainbus_match(struct device *parent, void *cfdata, void *aux) -{ - struct mainbus_attach_args *ma = aux; - char buf[32]; - - if (OF_getprop(ma->ma_node, "device_type", buf, sizeof(buf)) <= 0 || - strcmp(buf, "pci") != 0) - return (0); - - if (OF_getprop(ma->ma_node, "compatible", buf, sizeof(buf)) <= 0 || - strcmp(buf, "fsl,mpc8349-pci") != 0) - return (0); - - return (1); -} - -void -socpcic_mainbus_attach(struct device *parent, struct device *self, void *aux) -{ - struct socpcic_softc *sc = (void *)self; - struct mainbus_attach_args *ma = aux; - int reg[4]; - - if (OF_getprop(ma->ma_node, "reg", ®, sizeof(reg)) < sizeof(reg)) { - printf(": missing registers\n"); - return; - } - - sc->sc_iot = ma->ma_iot; - if (bus_space_map(sc->sc_iot, reg[2], 16, 0, &sc->sc_cfg_ioh)) { - printf(": can't map configuration registers\n"); - return; - } - - sc->sc_node = ma->ma_node; - sc->sc_dmat = ma->ma_dmat; - socpcic_attach(sc); -} - -int -socpcic_obio_match(struct device *parent, void *cfdata, void *aux) -{ - struct obio_attach_args *oa = aux; - char buf[32]; - - if (OF_getprop(oa->oa_node, "device_type", buf, sizeof(buf)) <= 0 || - strcmp(buf, "pci") != 0) - return (0); - - if (OF_getprop(oa->oa_node, "compatible", buf, sizeof(buf)) <= 0 || - strcmp(buf, "83xx") != 0) - return (0); - - return (1); -} - -void -socpcic_obio_attach(struct device *parent, struct device *self, void *aux) -{ - struct socpcic_softc *sc = (void *)self; - struct obio_attach_args *oa = aux; - - if (oa->oa_offset == 0x8500) - oa->oa_offset = 0x8300; - - sc->sc_iot = oa->oa_iot; - if (bus_space_map(sc->sc_iot, oa->oa_offset, 16, 0, &sc->sc_cfg_ioh)) { - printf(": can't map configuration registers\n"); - return; - } - - sc->sc_node = oa->oa_node; - sc->sc_dmat = oa->oa_dmat; - socpcic_attach(sc); -} - -void -socpcic_attach(struct socpcic_softc *sc) -{ - struct pcibus_attach_args pba; - struct extent *io_ex; - struct extent *mem_ex; - bus_addr_t io_base, mem_base; - bus_size_t io_size, mem_size; - uint32_t *ranges; - int len; - - if (OF_getprop(sc->sc_node, "interrupt-map-mask", sc->sc_map_mask, - sizeof(sc->sc_map_mask)) != sizeof(sc->sc_map_mask)) { - printf(": missing interrupt-map-mask\n"); - return; - } - - sc->sc_map_len = OF_getproplen(sc->sc_node, "interrupt-map"); - if (sc->sc_map_len > 0) { - sc->sc_map = malloc(sc->sc_map_len, M_DEVBUF, M_NOWAIT); - if (sc->sc_map == NULL) - panic("out of memory"); - - len = OF_getprop(sc->sc_node, "interrupt-map", - sc->sc_map, sc->sc_map_len); - KASSERT(len == sc->sc_map_len); - } - - sc->sc_ranges_len = OF_getproplen(sc->sc_node, "ranges"); - if (sc->sc_ranges_len <= 0) { - printf(": missing ranges\n"); - return; - } - - sc->sc_ranges = malloc(sc->sc_ranges_len, M_DEVBUF, M_NOWAIT); - if (sc->sc_ranges == NULL) - panic("out of memory"); - - len = OF_getprop(sc->sc_node, "ranges", sc->sc_ranges, - sc->sc_ranges_len); - KASSERT(len == sc->sc_ranges_len); - - ranges = sc->sc_ranges; - while (len >= 6 * sizeof(uint32_t)) { - switch (ranges[0] & OFW_PCI_PHYS_HI_SPACEMASK) { - case OFW_PCI_PHYS_HI_SPACE_IO: - KASSERT(ranges[1] == 0); - KASSERT(ranges[4] == 0); - sc->sc_io_bus_space.bus_base = ranges[3]; - sc->sc_io_bus_space.bus_size = ranges[5]; - sc->sc_io_bus_space.bus_io = 1; - io_base = ranges[2]; - io_size = ranges[5]; - break; - case OFW_PCI_PHYS_HI_SPACE_MEM32: - KASSERT(ranges[1] == 0); - KASSERT(ranges[4] == 0); - sc->sc_mem_bus_space.bus_base = ranges[3]; - sc->sc_mem_bus_space.bus_size = ranges[5]; - sc->sc_mem_bus_space.bus_io = 0; - mem_base = ranges[2]; - mem_size = ranges[5]; - break; - } - len -= 6 * sizeof(uint32_t); - ranges += 6; - } - - sc->sc_pc.pc_conf_v = sc; - sc->sc_pc.pc_attach_hook = socpcic_attach_hook; - sc->sc_pc.pc_bus_maxdevs = socpcic_bus_maxdevs; - sc->sc_pc.pc_make_tag = socpcic_make_tag; - sc->sc_pc.pc_decompose_tag = socpcic_decompose_tag; - sc->sc_pc.pc_conf_size = socpcic_conf_size; - sc->sc_pc.pc_conf_read = socpcic_conf_read; - sc->sc_pc.pc_conf_write = socpcic_conf_write; - - sc->sc_pc.pc_intr_v = sc; - sc->sc_pc.pc_intr_map = socpcic_intr_map; - sc->sc_pc.pc_intr_string = socpcic_intr_string; - sc->sc_pc.pc_intr_line = socpcic_intr_line; - sc->sc_pc.pc_intr_establish = socpcic_intr_establish; - sc->sc_pc.pc_intr_disestablish = socpcic_intr_disestablish; - sc->sc_pc.pc_ether_hw_addr = socpcic_ether_hw_addr; - - io_ex = extent_create("pciio", 0, 0xffffffff, M_DEVBUF, NULL, 0, - EX_NOWAIT | EX_FILLED); - if (io_ex != NULL && io_size) - extent_free(io_ex, io_base, io_size, EX_NOWAIT); - mem_ex = extent_create("pcimem", 0, 0xffffffff, M_DEVBUF, NULL, 0, - EX_NOWAIT | EX_FILLED); - if (mem_ex != NULL) - extent_free(mem_ex, mem_base, mem_size, EX_NOWAIT); - - bzero(&pba, sizeof(pba)); - pba.pba_busname = "pci"; - pba.pba_iot = &sc->sc_io_bus_space; - pba.pba_memt = &sc->sc_mem_bus_space; - pba.pba_dmat = sc->sc_dmat; - pba.pba_ioex = io_ex; - pba.pba_memex = mem_ex; - pba.pba_pc = &sc->sc_pc; - pba.pba_domain = pci_ndomains++; - pba.pba_bus = 0; - - printf("\n"); - - config_found((struct device *)sc, &pba, socpcic_print); -} - -void -socpcic_attach_hook(struct device *parent, struct device *self, - struct pcibus_attach_args *pba) -{ -} - -int -socpcic_bus_maxdevs(void *cpv, int bus) -{ - return (32); -} - -pcitag_t -socpcic_make_tag(void *cpv, int bus, int dev, int fun) -{ - return ((bus << 16) | (dev << 11) | (fun << 8)); -} - -void -socpcic_decompose_tag(void *cpv, pcitag_t tag, int *busp, int *devp, int *funp) -{ - if (busp) - *busp = (tag >> 16) & 0xff; - if (devp) - *devp = (tag >> 11) & 0x1f; - if (funp) - *funp = (tag >> 8) & 0x7; -} - -int -socpcic_conf_size(void *cpv, pcitag_t tag) -{ - return PCI_CONFIG_SPACE_SIZE; -} - -pcireg_t -socpcic_conf_read(void *cpv, pcitag_t tag, int offset) -{ - struct socpcic_softc *sc = cpv; - int bus, dev, fun; - pcireg_t addr, data; - - socpcic_decompose_tag(sc, tag, &bus, &dev, &fun); - if (bus == 0) { - if (dev > 0 && dev < 11) - return (0xffffffff); - if (dev == 31) - tag = (10 << 11) | (fun << 8); - } - - addr = 0x80000000 | tag | offset; - bus_space_write_4(sc->sc_iot, sc->sc_cfg_ioh, 0, addr); - bus_space_read_4(sc->sc_iot, sc->sc_cfg_ioh, 0); - data = bus_space_read_4(sc->sc_iot, sc->sc_cfg_ioh, 4); - bus_space_write_4(sc->sc_iot, sc->sc_cfg_ioh, 0, 0); - bus_space_read_4(sc->sc_iot, sc->sc_cfg_ioh, 0); - - return (data); -} - -void -socpcic_conf_write(void *cpv, pcitag_t tag, int offset, pcireg_t data) -{ - struct socpcic_softc *sc = cpv; - int bus, dev, fun; - pcireg_t addr; - - socpcic_decompose_tag(sc, tag, &bus, &dev, &fun); - if (bus == 0) { - if (dev > 0 && dev < 11) - return; - if (dev == 31) - tag = (10 << 11) | (fun << 8); - } - - addr = 0x80000000 | tag | offset; - bus_space_write_4(sc->sc_iot, sc->sc_cfg_ioh, 0, addr); - bus_space_read_4(sc->sc_iot, sc->sc_cfg_ioh, 0); - bus_space_write_4(sc->sc_iot, sc->sc_cfg_ioh, 4, data); - bus_space_write_4(sc->sc_iot, sc->sc_cfg_ioh, 0, 0); - bus_space_read_4(sc->sc_iot, sc->sc_cfg_ioh, 0); -} - -int -socpcic_intr_map(void *cpv, pcitag_t tag, int pin, int line, - pci_intr_handle_t *ihp) -{ - struct socpcic_softc *sc = cpv; - int bus, dev, func; - int reg[4]; - int *map; - int len; - - pci_decompose_tag(&sc->sc_pc, tag, &bus, &dev, &func); - - reg[0] = (dev << 11) | (func << 8); - reg[1] = reg[2] = 0; - reg[3] = pin; - - map = sc->sc_map; - len = sc->sc_map_len; - while (len >= 7 * sizeof(int)) { - if ((reg[0] & sc->sc_map_mask[0]) == map[0] && - (reg[1] & sc->sc_map_mask[1]) == map[1] && - (reg[2] & sc->sc_map_mask[2]) == map[2] && - (reg[3] & sc->sc_map_mask[3]) == map[3]) { - *ihp = map[5]; - return (0); - } - len -= 7 * sizeof(int); - map += 7; - } - - return (1); -} - -const char * -socpcic_intr_string(void *cpv, pci_intr_handle_t ih) -{ - static char str[16]; - - snprintf(str, sizeof str, "ivec %ld", ih); - return (str); -} - -int -socpcic_intr_line(void *cpv, pci_intr_handle_t ih) -{ - return (ih); -} - -void * -socpcic_intr_establish(void *cpv, pci_intr_handle_t ih, int level, - int (*func)(void *), void *arg, const char *name) -{ - return (intr_establish(ih, IST_LEVEL, level, func, arg, name)); -} - -void -socpcic_intr_disestablish(void *lcv, void *cookie) -{ -} - -int -socpcic_ether_hw_addr(struct ppc_pci_chipset *lcpc, u_int8_t *oaddr) -{ - oaddr[0] = oaddr[1] = oaddr[2] = 0xff; - oaddr[3] = oaddr[4] = oaddr[5] = 0xff; - - return (0); -} - -int -socpcic_print(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); -} diff --git a/sys/arch/socppc/dev/wdc_mainbus.c b/sys/arch/socppc/dev/wdc_mainbus.c deleted file mode 100644 index dfe3470ed37..00000000000 --- a/sys/arch/socppc/dev/wdc_mainbus.c +++ /dev/null @@ -1,178 +0,0 @@ -/* $OpenBSD: wdc_mainbus.c,v 1.2 2011/05/09 22:33:54 matthew Exp $ */ - -/* - * Copyright (c) 2009 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * Driver for Compact Flash interface on the local bus of a PowerQUICC - * MPC8343E processor as found on the RouterBOARD 600. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> -#include <sys/malloc.h> - -#include <machine/autoconf.h> - -#include <dev/ofw/openfirm.h> - -#include <dev/ata/atavar.h> -#include <dev/ic/wdcvar.h> - -struct wdc_mainbus_softc { - struct wdc_softc sc_wdcdev; - struct channel_softc *sc_chanptr; - struct channel_softc sc_channel; - - void *sc_ih; -}; - -int wdc_mainbus_match(struct device *, void *, void *); -void wdc_mainbus_attach(struct device *, struct device *, void *); - -struct cfattach wdc_mainbus_ca = { - sizeof(struct wdc_mainbus_softc), wdc_mainbus_match, wdc_mainbus_attach -}; - -/* - * The CF slots on the RouterBOARD 600 are wired up in a completely - * retarded way. Instead of using the obvious address lines it uses - * LAD[11:15], which means we need to waste more than 0.5 MB of - * address space to map 10 8-bit registers. - */ -#define WDC_MAINBUS_REG_NPORTS WDC_NREG -#define WDC_MAINBUS_REG_SIZE (WDC_MAINBUS_REG_NPORTS << 16) -#define WDC_MAINBUS_REG_OFFSET (8 << 17) -#define WDC_MAINBUS_AUXREG_NPORTS 2 -#define WDC_MAINBUS_AUXREG_SIZE (WDC_MAINBUS_AUXREG_NPORTS << 16) -#define WDC_MAINBUS_AUXREG_OFFSET (6 << 16) - -u_int8_t wdc_mainbus_read_reg(struct channel_softc *chp, enum wdc_regs reg); -void wdc_mainbus_write_reg(struct channel_softc *chp, enum wdc_regs reg, - u_int8_t val); - -struct channel_softc_vtbl wdc_mainbus_vtbl = { - wdc_mainbus_read_reg, - wdc_mainbus_write_reg, - wdc_default_lba48_write_reg, - wdc_default_read_raw_multi_2, - wdc_default_write_raw_multi_2, - wdc_default_read_raw_multi_4, - wdc_default_write_raw_multi_4 -}; - -int -wdc_mainbus_match(struct device *parent, void *cfdata, void *aux) -{ - struct mainbus_attach_args *ma = aux; - char buf[32]; - - if (OF_getprop(ma->ma_node, "device_type", buf, sizeof(buf)) <= 0 || - strcmp(buf, "rb,cf") != 0) - return (0); - - return (1); -} - -void -wdc_mainbus_attach(struct device *parent, struct device *self, void *aux) -{ - struct wdc_mainbus_softc *sc = (void *)self; - struct mainbus_attach_args *ma = aux; - struct channel_softc *chp = &sc->sc_channel; - int reg[2]; - int ivec; - - if (OF_getprop(ma->ma_node, "reg", ®, sizeof(reg)) < sizeof(reg)) { - printf(": missing registers\n"); - return; - } - - if (OF_getprop(ma->ma_node, "interrupts", &ivec, sizeof(ivec)) <= 0) { - printf(": missing interrupts\n"); - return; - } - - chp->cmd_iot = chp->ctl_iot = ma->ma_iot; - chp->_vtbl = &wdc_mainbus_vtbl; - - if (bus_space_map(chp->cmd_iot, reg[0] + WDC_MAINBUS_REG_OFFSET, - WDC_MAINBUS_REG_SIZE, 0, &chp->cmd_ioh)) { - printf(": can't map registers\n"); - return; - } - if (bus_space_map(chp->ctl_iot, reg[0] + WDC_MAINBUS_AUXREG_OFFSET, - WDC_MAINBUS_AUXREG_SIZE, 0, &chp->ctl_ioh)) { - printf(": can't map registers\n"); - return; - } - - sc->sc_ih = intr_establish(ivec, IST_LEVEL, IPL_BIO, wdcintr, - chp, self->dv_xname); - - sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_PREATA; - sc->sc_wdcdev.PIO_cap = 0; - sc->sc_chanptr = chp; - sc->sc_wdcdev.channels = &sc->sc_chanptr; - sc->sc_wdcdev.nchannels = 1; - chp->channel = 0; - chp->wdc = &sc->sc_wdcdev; - - chp->ch_queue = wdc_alloc_queue(); - if (chp->ch_queue == NULL) { - printf("%s: cannot allocate channel queue\n", - self->dv_xname); - /* XXX disestablish interrupt */ - return; - } - - printf("\n"); - - wdcattach(chp); - wdc_print_current_modes(chp); -} - -u_int8_t -wdc_mainbus_read_reg(struct channel_softc *chp, enum wdc_regs reg) -{ - uint8_t val; - - if (reg & _WDC_AUX) { - val = bus_space_read_1(chp->ctl_iot, chp->ctl_ioh, - (reg & _WDC_REGMASK) << 16); - if (val == 0xf9 && reg == wdr_altsts) - val = 0x7f; - } else { - val = bus_space_read_1(chp->cmd_iot, chp->cmd_ioh, - (reg & _WDC_REGMASK) << 16); - if (val == 0xf9 && reg == wdr_status) - val = 0x7f; - } - return val; -} - -void -wdc_mainbus_write_reg(struct channel_softc *chp, enum wdc_regs reg, - u_int8_t val) -{ - if (reg & _WDC_AUX) - bus_space_write_1(chp->ctl_iot, chp->ctl_ioh, - (reg & _WDC_REGMASK) << 16, val); - else - bus_space_write_1(chp->cmd_iot, chp->cmd_ioh, - (reg & _WDC_REGMASK) << 16, val); -} diff --git a/sys/arch/socppc/include/_float.h b/sys/arch/socppc/include/_float.h deleted file mode 100644 index 738251a5922..00000000000 --- a/sys/arch/socppc/include/_float.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */ - -#include <powerpc/_float.h> diff --git a/sys/arch/socppc/include/_types.h b/sys/arch/socppc/include/_types.h deleted file mode 100644 index f6f4ea673a5..00000000000 --- a/sys/arch/socppc/include/_types.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: _types.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/_types.h> diff --git a/sys/arch/socppc/include/asm.h b/sys/arch/socppc/include/asm.h deleted file mode 100644 index 35852110f54..00000000000 --- a/sys/arch/socppc/include/asm.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: asm.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/asm.h> diff --git a/sys/arch/socppc/include/atomic.h b/sys/arch/socppc/include/atomic.h deleted file mode 100644 index 1dbd296cee4..00000000000 --- a/sys/arch/socppc/include/atomic.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: atomic.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/atomic.h> diff --git a/sys/arch/socppc/include/autoconf.h b/sys/arch/socppc/include/autoconf.h deleted file mode 100644 index 174661e6498..00000000000 --- a/sys/arch/socppc/include/autoconf.h +++ /dev/null @@ -1,45 +0,0 @@ -/* $OpenBSD: autoconf.h,v 1.5 2013/04/23 19:35:52 deraadt Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _MACHINE_AUTOCONF_H_ -#define _MACHINE_AUTOCONF_H_ - -#include <machine/bus.h> - -struct mainbus_attach_args { - bus_space_tag_t ma_iot; - bus_dma_tag_t ma_dmat; - char *ma_name; - int ma_node; -}; - -struct obio_attach_args { - bus_space_tag_t oa_iot; - bus_dma_tag_t oa_dmat; - bus_addr_t oa_offset; - int oa_ivec; - int oa_phy; - char *oa_name; - int oa_node; -}; - -#define cf_offset cf_loc[0] -#define cf_ivec cf_loc[1] -#define cf_phy cf_loc[2] - -#endif /* _MACHINE_AUTOCONF_H_ */ diff --git a/sys/arch/socppc/include/bus.h b/sys/arch/socppc/include/bus.h deleted file mode 100644 index dcfc46f23f0..00000000000 --- a/sys/arch/socppc/include/bus.h +++ /dev/null @@ -1,617 +0,0 @@ -/* $OpenBSD: bus.h,v 1.12 2017/05/08 00:27:45 dlg 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_long bus_size_t; -typedef u_long 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_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 flags, 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 flags, 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); -paddr_t bus_space_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int); - -#define BUS_SPACE_MAP_CACHEABLE 0x01 -#define BUS_SPACE_MAP_LINEAR 0x02 -#define BUS_SPACE_MAP_PREFETCHABLE 0x04 - -/* - * void *bus_space_vaddr(bus_space_tag_t, bus_space_handle_t); - * - * Get the kernel virtual address for the mapped bus space. - * Only allowed for regions mapped with BUS_SPACE_MAP_LINEAR. - */ -#define bus_space_vaddr(t, h) ((void *)(h)) - -#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) \ -{ \ - return CAT3(in,m,rb)((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) \ -{ \ - CAT3(out,m,rb)((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); - - while (count--) - __asm volatile("lhbrx %0, 0, %1" : - "=r"(*addr++) : "r"(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); - - while (count--) - __asm volatile("lwbrx %0, 0, %1" : - "=r"(*addr++) : "r"(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); - - while (count--) - __asm volatile("sthbrx %0, 0, %1" :: - "r"(*addr++), "r"(d++)); - __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); - - while (count--) - __asm volatile("stwbrx %0, 0, %1" :: - "r"(*addr++), "r"(d++)); - __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; - - count = count >> 1; - - 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; - - count = count >> 2; - - 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; - - count = count >> 1; - - 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; - - count = count >> 2; - - 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(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(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(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 bst, 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 bst, 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 bst, 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_copy_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 */ - -#define BUS_DMA_WAITOK 0x0000 /* safe to sleep (pseudo-flag) */ -#define BUS_DMA_NOWAIT 0x0001 /* not safe to sleep */ -#define BUS_DMA_ALLOCNOW 0x0002 /* perform resource allocation now */ -#define BUS_DMA_COHERENT 0x0008 /* hint: map memory DMA coherent */ -#define BUS_DMA_BUS1 0x0010 /* placeholders for bus functions... */ -#define BUS_DMA_BUS2 0x0020 -#define BUS_DMA_BUS3 0x0040 -#define BUS_DMA_BUS4 0x0080 -#define BUS_DMA_READ 0x0100 /* mapping is device -> memory only */ -#define BUS_DMA_WRITE 0x0200 /* mapping is memory -> device only */ -#define BUS_DMA_STREAMING 0x0400 /* hint: sequential, unidirectional */ -#define BUS_DMA_ZERO 0x0800 /* zero memory in dmamem_alloc */ -#define BUS_DMA_NOCACHE 0x1000 /* map memory uncached */ -#define BUS_DMA_64BIT 0x2000 /* device handles 64bit dva */ - - -/* 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); - int (*_dmamem_alloc_range)(bus_dma_tag_t, bus_size_t, bus_size_t, - bus_size_t, bus_dma_segment_t *, int, int *, int, - bus_addr_t, bus_addr_t); - 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_alloc_range(t, s, a, b, sg, n, r, f, l, h) \ - (*(t)->_dmamem_alloc_range)((t), (s), (a), (b), (sg), \ - (n), (r), (f), (l), (h)) -#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); -int _dmamem_alloc_range( bus_dma_tag_t, bus_size_t, bus_size_t, - bus_size_t, bus_dma_segment_t *, int, int *, int, - bus_addr_t, bus_addr_t); -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 */ -}; - -#endif /* _MACHINE_BUS_H_ */ diff --git a/sys/arch/socppc/include/cdefs.h b/sys/arch/socppc/include/cdefs.h deleted file mode 100644 index 8362c75969c..00000000000 --- a/sys/arch/socppc/include/cdefs.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: cdefs.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/cdefs.h> diff --git a/sys/arch/socppc/include/conf.h b/sys/arch/socppc/include/conf.h deleted file mode 100644 index 2797e30ad4c..00000000000 --- a/sys/arch/socppc/include/conf.h +++ /dev/null @@ -1,37 +0,0 @@ -/* $OpenBSD: conf.h,v 1.1 2008/05/10 12:02:21 kettenis 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/socppc/include/cpu.h b/sys/arch/socppc/include/cpu.h deleted file mode 100644 index a338e8ceeb5..00000000000 --- a/sys/arch/socppc/include/cpu.h +++ /dev/null @@ -1,56 +0,0 @@ -/* $OpenBSD: cpu.h,v 1.2 2013/03/17 15:10:33 kettenis 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_ - -/* - * CTL_MACHDEP definitions. - */ -#define CPU_ALLOWAPERTURE 1 /* allow mmap of /dev/xf86 */ -#define CPU_ALTIVEC 2 /* altivec is present */ -#define CPU_MAXID 3 /* number of valid machdep ids */ - -#define CTL_MACHDEP_NAMES { \ - { 0, 0 }, \ - { "allowaperture", CTLTYPE_INT }, \ - { "altivec", CTLTYPE_INT }, \ -} - -#ifdef _KERNEL - -#include <powerpc/cpu.h> - -#endif /* _KERNEL */ -#endif /* _MACHINE_CPU_H_ */ diff --git a/sys/arch/socppc/include/db_machdep.h b/sys/arch/socppc/include/db_machdep.h deleted file mode 100644 index df6783f5cc6..00000000000 --- a/sys/arch/socppc/include/db_machdep.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: db_machdep.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/db_machdep.h> diff --git a/sys/arch/socppc/include/disklabel.h b/sys/arch/socppc/include/disklabel.h deleted file mode 100644 index d959c7ccb8c..00000000000 --- a/sys/arch/socppc/include/disklabel.h +++ /dev/null @@ -1,40 +0,0 @@ -/* $OpenBSD: disklabel.h,v 1.3 2015/09/30 14:57:03 krw Exp $ */ - -/* - * Copyright (c) 1994 Christopher G. Demetriou - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christopher G. Demetriou. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MACHINE_DISKLABEL_H_ -#define _MACHINE_DISKLABEL_H_ - -#define LABELSECTOR 1 /* sector containing label */ -#define LABELOFFSET 0 /* offset of label in sector */ -#define MAXPARTITIONS 16 /* number of partitions */ - -#endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/socppc/include/endian.h b/sys/arch/socppc/include/endian.h deleted file mode 100644 index 1a72bba14a8..00000000000 --- a/sys/arch/socppc/include/endian.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: endian.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/endian.h> diff --git a/sys/arch/socppc/include/exec.h b/sys/arch/socppc/include/exec.h deleted file mode 100644 index 01c0c5722a1..00000000000 --- a/sys/arch/socppc/include/exec.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: exec.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/exec.h> diff --git a/sys/arch/socppc/include/fenv.h b/sys/arch/socppc/include/fenv.h deleted file mode 100644 index fbd537bc189..00000000000 --- a/sys/arch/socppc/include/fenv.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: fenv.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */ -/* public domain */ -#include <powerpc/fenv.h> diff --git a/sys/arch/socppc/include/fpu.h b/sys/arch/socppc/include/fpu.h deleted file mode 100644 index 83e3b628f83..00000000000 --- a/sys/arch/socppc/include/fpu.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: fpu.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/fpu.h> diff --git a/sys/arch/socppc/include/frame.h b/sys/arch/socppc/include/frame.h deleted file mode 100644 index ba860b82dd9..00000000000 --- a/sys/arch/socppc/include/frame.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: frame.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/frame.h> diff --git a/sys/arch/socppc/include/ieee.h b/sys/arch/socppc/include/ieee.h deleted file mode 100644 index dc0cf138db4..00000000000 --- a/sys/arch/socppc/include/ieee.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: ieee.h,v 1.1 2008/05/10 22:07:00 kettenis Exp $ */ - -#include <powerpc/ieee.h> diff --git a/sys/arch/socppc/include/ieeefp.h b/sys/arch/socppc/include/ieeefp.h deleted file mode 100644 index d489bd294fa..00000000000 --- a/sys/arch/socppc/include/ieeefp.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: ieeefp.h,v 1.1 2008/05/10 22:07:00 kettenis Exp $ */ - -#include <powerpc/ieeefp.h> diff --git a/sys/arch/socppc/include/intr.h b/sys/arch/socppc/include/intr.h deleted file mode 100644 index 81d1d57b556..00000000000 --- a/sys/arch/socppc/include/intr.h +++ /dev/null @@ -1,9 +0,0 @@ -/* $OpenBSD: intr.h,v 1.2 2014/04/01 20:42:39 mpi Exp $ */ - -#include <powerpc/intr.h> - -#ifndef _LOCORE - -void *intr_establish(int, int, int, int (*)(void *), void *, const char *); - -#endif diff --git a/sys/arch/socppc/include/kcore.h b/sys/arch/socppc/include/kcore.h deleted file mode 100644 index a17c8d07656..00000000000 --- a/sys/arch/socppc/include/kcore.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: kcore.h,v 1.1 2008/05/16 18:12:45 kettenis Exp $ */ - -#include <powerpc/kcore.h> diff --git a/sys/arch/socppc/include/limits.h b/sys/arch/socppc/include/limits.h deleted file mode 100644 index d6468bd2aa1..00000000000 --- a/sys/arch/socppc/include/limits.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: limits.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/limits.h> diff --git a/sys/arch/socppc/include/loadfile_machdep.h b/sys/arch/socppc/include/loadfile_machdep.h deleted file mode 100644 index 5c4f7204aee..00000000000 --- a/sys/arch/socppc/include/loadfile_machdep.h +++ /dev/null @@ -1,49 +0,0 @@ -/* $OpenBSD: loadfile_machdep.h,v 1.4 2015/07/17 20:44:39 miod 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. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#define BOOT_ELF -#define ELFSIZE 32 - -#define LOAD_KERNEL LOAD_ALL -#define COUNT_KERNEL COUNT_ALL - -#define LOADADDR(a) (((u_long)(a)) + offset) -#define ALIGNENTRY(a) ((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) diff --git a/sys/arch/socppc/include/lock.h b/sys/arch/socppc/include/lock.h deleted file mode 100644 index 0ec5a702b00..00000000000 --- a/sys/arch/socppc/include/lock.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: lock.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/lock.h> diff --git a/sys/arch/socppc/include/mutex.h b/sys/arch/socppc/include/mutex.h deleted file mode 100644 index 6564781e0c5..00000000000 --- a/sys/arch/socppc/include/mutex.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: mutex.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/mutex.h> diff --git a/sys/arch/socppc/include/param.h b/sys/arch/socppc/include/param.h deleted file mode 100644 index 830d9212430..00000000000 --- a/sys/arch/socppc/include/param.h +++ /dev/null @@ -1,54 +0,0 @@ -/* $OpenBSD: param.h,v 1.2 2013/03/23 16:12:27 deraadt 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_PARAM_H_ -#define _MACHINE_PARAM_H_ - -#ifdef _KERNEL -#ifndef _LOCORE -#include <machine/cpu.h> -#endif /* _LOCORE */ -#endif - -#include <powerpc/param.h> - -#define MACHINE "socppc" -#define _MACHINE socppc - -#define KERNBASE 0x200000 - -#ifndef MSGBUFSIZE -#define MSGBUFSIZE (2 * PAGE_SIZE) -#endif - -#endif /* _MACHINE_PARAM_H_ */ diff --git a/sys/arch/socppc/include/pcb.h b/sys/arch/socppc/include/pcb.h deleted file mode 100644 index 0fde40255c1..00000000000 --- a/sys/arch/socppc/include/pcb.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: pcb.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/pcb.h> diff --git a/sys/arch/socppc/include/pci_machdep.h b/sys/arch/socppc/include/pci_machdep.h deleted file mode 100644 index 0553eb73b6c..00000000000 --- a/sys/arch/socppc/include/pci_machdep.h +++ /dev/null @@ -1,105 +0,0 @@ -/* $OpenBSD: pci_machdep.h,v 1.3 2016/05/04 14:30:01 kettenis Exp $ */ - -/* - * Copyright (c) 1996 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. - */ - -/* - * Machine-specific definitions for PCI autoconfiguration. - */ - -/* - * Types provided to machine-independent PCI code - */ -typedef struct ppc_pci_chipset *pci_chipset_tag_t; -typedef u_long pcitag_t; -typedef u_long pci_intr_handle_t; - -/* - * ppc-specific PCI structure and type definitions. - * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. - */ -struct ppc_pci_chipset { - void *pc_conf_v; - void (*pc_attach_hook)(struct device *, - struct device *, struct pcibus_attach_args *); - int (*pc_bus_maxdevs)(void *, int); - pcitag_t (*pc_make_tag)(void *, int, int, int); - void (*pc_decompose_tag)(void *, pcitag_t, int *, - int *, int *); - int (*pc_conf_size)(void *, pcitag_t); - pcireg_t (*pc_conf_read)(void *, pcitag_t, int); - void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t); - - void *pc_intr_v; - int (*pc_intr_map)(void *, pcitag_t, int, int, - pci_intr_handle_t *); - const char *(*pc_intr_string)(void *, pci_intr_handle_t); - int (*pc_intr_line)(void *, pci_intr_handle_t); - void *(*pc_intr_establish)(void *, pci_intr_handle_t, - int, int (*)(void *), void *, const char *); - void (*pc_intr_disestablish)(void *, void *); - int (*pc_ether_hw_addr)(struct ppc_pci_chipset *, u_int8_t *); -}; - -/* - * Functions provided to machine-independent PCI code. - */ -#define pci_attach_hook(p, s, pba) \ - (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba)) -#define pci_bus_maxdevs(c, b) \ - (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b)) -#define pci_make_tag(c, b, d, f) \ - (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f)) -#define pci_decompose_tag(c, t, bp, dp, fp) \ - (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp)) -#define pci_conf_size(c, t) \ - (*(c)->pc_conf_size)((c)->pc_conf_v, (t)) -#define pci_conf_read(c, t, r) \ - (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r)) -#define pci_conf_write(c, t, r, v) \ - (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v)) -#define pci_intr_map(pa, ihp) \ - (*((pa)->pa_pc)->pc_intr_map)((pa)->pa_pc->pc_intr_v, \ - (pa)->pa_intrtag, (pa)->pa_intrpin, (pa)->pa_intrline, (ihp)) -#define pci_intr_map_msi(pa, ihp) (-1) -#define pci_intr_map_msix(pa, vec, ihp) (-1) -#define pci_intr_string(c, ih) \ - (*(c)->pc_intr_string)((c)->pc_intr_v, (ih)) -#define pci_intr_line(c, ih) \ - (*(c)->pc_intr_line)((c)->pc_intr_v, (ih)) -#define pci_intr_establish(c, ih, l, h, a, nm) \ - (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a), (nm)) -#define pci_intr_disestablish(c, iv) \ - (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv)) -#define pci_ether_hw_addr(c, s) \ - (*(c)->pc_ether_hw_addr)((c), (s)) -#define pci_probe_device_hook(c, a) (0) - -#define pci_min_powerstate(c, t) (PCI_PMCSR_STATE_D3) -#define pci_set_powerstate_md(c, t, s, p) - -#define pci_dev_postattach(a, b) diff --git a/sys/arch/socppc/include/pio.h b/sys/arch/socppc/include/pio.h deleted file mode 100644 index 6be1eecbd9c..00000000000 --- a/sys/arch/socppc/include/pio.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: pio.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/pio.h> diff --git a/sys/arch/socppc/include/pmap.h b/sys/arch/socppc/include/pmap.h deleted file mode 100644 index b310d018415..00000000000 --- a/sys/arch/socppc/include/pmap.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: pmap.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/pmap.h> diff --git a/sys/arch/socppc/include/proc.h b/sys/arch/socppc/include/proc.h deleted file mode 100644 index 1b78bbf4d75..00000000000 --- a/sys/arch/socppc/include/proc.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: proc.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/proc.h> diff --git a/sys/arch/socppc/include/profile.h b/sys/arch/socppc/include/profile.h deleted file mode 100644 index 2b0b17415c6..00000000000 --- a/sys/arch/socppc/include/profile.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: profile.h,v 1.1 2008/05/10 22:07:00 kettenis Exp $ */ - -#include <powerpc/profile.h> diff --git a/sys/arch/socppc/include/psl.h b/sys/arch/socppc/include/psl.h deleted file mode 100644 index 2efac1c8750..00000000000 --- a/sys/arch/socppc/include/psl.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: psl.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/psl.h> diff --git a/sys/arch/socppc/include/pte.h b/sys/arch/socppc/include/pte.h deleted file mode 100644 index cca262bf6e7..00000000000 --- a/sys/arch/socppc/include/pte.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: pte.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/pte.h> diff --git a/sys/arch/socppc/include/ptrace.h b/sys/arch/socppc/include/ptrace.h deleted file mode 100644 index 1c82569d472..00000000000 --- a/sys/arch/socppc/include/ptrace.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: ptrace.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/ptrace.h> diff --git a/sys/arch/socppc/include/reg.h b/sys/arch/socppc/include/reg.h deleted file mode 100644 index 26ed5eaa4e2..00000000000 --- a/sys/arch/socppc/include/reg.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: reg.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/reg.h> diff --git a/sys/arch/socppc/include/reloc.h b/sys/arch/socppc/include/reloc.h deleted file mode 100644 index 2794f995c86..00000000000 --- a/sys/arch/socppc/include/reloc.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: reloc.h,v 1.1 2008/05/12 09:23:04 kettenis Exp $ */ - -#include <powerpc/reloc.h> diff --git a/sys/arch/socppc/include/setjmp.h b/sys/arch/socppc/include/setjmp.h deleted file mode 100644 index 6daee51c6e6..00000000000 --- a/sys/arch/socppc/include/setjmp.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: setjmp.h,v 1.1 2008/05/10 21:25:53 kettenis Exp $ */ - -#include <powerpc/setjmp.h> diff --git a/sys/arch/socppc/include/signal.h b/sys/arch/socppc/include/signal.h deleted file mode 100644 index 7ab86d1b3fe..00000000000 --- a/sys/arch/socppc/include/signal.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: signal.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/signal.h> diff --git a/sys/arch/socppc/include/spinlock.h b/sys/arch/socppc/include/spinlock.h deleted file mode 100644 index 22bbf5008eb..00000000000 --- a/sys/arch/socppc/include/spinlock.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: spinlock.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/spinlock.h> diff --git a/sys/arch/socppc/include/stdarg.h b/sys/arch/socppc/include/stdarg.h deleted file mode 100644 index 54c152dfe9d..00000000000 --- a/sys/arch/socppc/include/stdarg.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: stdarg.h,v 1.1 2008/05/12 09:06:20 kettenis Exp $ */ - -#include <powerpc/stdarg.h> diff --git a/sys/arch/socppc/include/tcb.h b/sys/arch/socppc/include/tcb.h deleted file mode 100644 index 63b21a0fc39..00000000000 --- a/sys/arch/socppc/include/tcb.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: tcb.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */ -/* public domain */ -#include <powerpc/tcb.h> diff --git a/sys/arch/socppc/include/trap.h b/sys/arch/socppc/include/trap.h deleted file mode 100644 index 80a0f96d872..00000000000 --- a/sys/arch/socppc/include/trap.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: trap.h,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */ - -#include <powerpc/trap.h> diff --git a/sys/arch/socppc/include/varargs.h b/sys/arch/socppc/include/varargs.h deleted file mode 100644 index f86b289a402..00000000000 --- a/sys/arch/socppc/include/varargs.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: varargs.h,v 1.1 2008/05/12 09:06:20 kettenis Exp $ */ - -#include <powerpc/varargs.h> diff --git a/sys/arch/socppc/include/vmparam.h b/sys/arch/socppc/include/vmparam.h deleted file mode 100644 index 824c4cdec06..00000000000 --- a/sys/arch/socppc/include/vmparam.h +++ /dev/null @@ -1,99 +0,0 @@ -/* $OpenBSD: vmparam.h,v 1.13 2015/11/01 20:10:00 miod 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 USRSTACK VM_MAXUSER_ADDRESS - -#ifndef MAXTSIZ -#define MAXTSIZ (64*1024*1024) /* max text size */ -#endif - -#ifndef DFLDSIZ -#define DFLDSIZ (64*1024*1024) /* default data size */ -#endif - -#ifndef MAXDSIZ -#define MAXDSIZ (2UL*1024*1024*1024) /* max data size */ -#endif - -#ifndef BRKSIZ -#define BRKSIZ MAXDSIZ /* heap gap size */ -#endif - -#ifndef DFLSSIZ -#define DFLSSIZ (2*1024*1024) /* default stack size */ -#endif - -#ifndef MAXSSIZ -#define MAXSSIZ (32*1024*1024) /* max stack size */ -#endif - -#define STACKGAP_RANDOM 256*1024 - -/* - * Size of shared memory map - */ -#ifndef SHMMAXPGS -#define SHMMAXPGS 8192 /* 32mb */ -#endif - -/* - * Size of User Raw I/O map - */ -#define USRIOSIZE 1024 - -/* - * Would like to have MAX addresses = 0, but this doesn't (currently) work - */ -#define VM_MIN_ADDRESS ((vaddr_t)PAGE_SIZE) -#define VM_MAXUSER_ADDRESS ((vaddr_t)0xfffff000) -#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS -#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)(PPC_KERNEL_SR << ADDR_SR_SHIFT)) - -/* ppc_kvm_stolen is so that vm space can be stolen before vm is fully - * initialized. - */ -extern vaddr_t ppc_kvm_stolen; -#define VM_KERN_ADDRESS_SIZE (PPC_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 VM_PHYSSEG_MAX 1 -#define VM_PHYSSEG_NOADD -#define VM_PHYSSEG_STRAT VM_PSTRAT_RANDOM - -#endif diff --git a/sys/arch/socppc/socppc/autoconf.c b/sys/arch/socppc/socppc/autoconf.c deleted file mode 100644 index e17968b7de8..00000000000 --- a/sys/arch/socppc/socppc/autoconf.c +++ /dev/null @@ -1,74 +0,0 @@ -/* $OpenBSD: autoconf.c,v 1.7 2018/01/27 22:55:23 naddy Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/reboot.h> - -#include <uvm/uvm_extern.h> - -void dumpconf(void); - -int cold = 1; - -void -cpu_configure(void) -{ - splhigh(); - - softintr_init(); - - if (config_rootfound("mainbus", "mainbus") == 0) - panic("no mainbus found"); - - /* Configuration is finished, turn on interrupts. */ - spl0(); - cold = 0; -} - -void -device_register(struct device *dev, void *aux) -{ -} - -void -diskconf(void) -{ - struct device *dv; - dev_t tmpdev; - int len; - char *p; - - if ((p = strchr(bootpath, ':')) != NULL) - len = p - bootpath; - else - len = strlen(bootpath); - - dv = parsedisk(bootpath, len, 0, &tmpdev); - setroot(dv, 0, RB_USERREQ); - dumpconf(); -} - -struct nam2blk nam2blk[] = { - { "wd", 0 }, - { "sd", 2 }, - { "cd", 3 }, - { "vnd", 14 }, - { "rd", 17 }, - { NULL, -1 } -}; diff --git a/sys/arch/socppc/socppc/clock.c b/sys/arch/socppc/socppc/clock.c deleted file mode 100644 index 58ddf4ff8a3..00000000000 --- a/sys/arch/socppc/socppc/clock.c +++ /dev/null @@ -1,338 +0,0 @@ -/* $OpenBSD: clock.c,v 1.13 2015/06/13 07:16:37 jsg 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 <sys/timetc.h> - -#include <machine/autoconf.h> - -#include <dev/clock_subr.h> - -void decr_intr(struct clockframe *frame); -u_int tb_get_timecount(struct timecounter *); - -/* - * Initially we assume a processor with a bus frequency of 266 MHz. - */ -static u_int32_t ticks_per_sec = 66666666; -static u_int32_t ns_per_tick = 15; -static int32_t ticks_per_intr; - -static struct timecounter tb_timecounter = { - tb_get_timecount, NULL, 0x7fffffff, 0, "tb", 0, NULL -}; - -/* Global TOD clock handle. */ -todr_chip_handle_t todr_handle; - -/* vars for stats */ -int statint; -u_int32_t statvar; -u_int32_t statmin; - -static struct evcount clk_count; -static struct evcount stat_count; -static int clk_irq = PPC_CLK_IRQ; -static int stat_irq = PPC_STAT_IRQ; - -/* - * Set up the system's time, given a `reasonable' time value. - */ -void -inittodr(time_t base) -{ - int badbase = 0, waszero = base == 0; - char *bad = NULL; - struct timeval tv; - struct timespec ts; - - tv.tv_sec = tv.tv_usec = 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 (todr_handle != NULL) - todr_gettime(todr_handle, &tv); - - if (tv.tv_sec == 0) { - /* - * Believe the time in the file system for lack of - * anything better, resetting the clock. - */ - bad = "WARNING: unable to get date/time"; - tv.tv_sec = base; - tv.tv_usec = 0; - if (!badbase) - resettodr(); - } else { - time_t deltat; - - tv.tv_sec += tz.tz_minuteswest * 60; - if (tz.tz_dsttime) - tv.tv_sec -= 3600; - - deltat = tv.tv_sec - base; - - if (deltat < 0) - deltat = -deltat; - if (!(waszero || deltat < 2 * SECDAY)) { - printf("WARNING: clock %s %lld days", - tv.tv_sec < base ? "lost" : "gained", - (long long)(deltat / SECDAY)); - bad = ""; - - if (tv.tv_sec < base && deltat > 1000 * SECDAY) { - printf(", using FS time"); - tv.tv_sec = base; - } - } - } - - ts.tv_sec = tv.tv_sec; - ts.tv_nsec = tv.tv_usec * 1000; - tc_setclock(&ts); - - if (bad) { - printf("%s", bad); - printf(" -- CHECK AND RESET THE DATE!\n"); - } -} - -/* - * Similar to the above - */ -void -resettodr(void) -{ - struct timeval tv; - - if (time_second == 1) - return; - - microtime(&tv); - - if (todr_handle != NULL && todr_settime(todr_handle, &tv) != 0) - printf("Cannot set time in time-of-day clock\n"); -} - -void -decr_intr(struct clockframe *frame) -{ - u_int64_t tb; - u_int64_t nextevent; - struct cpu_info *ci = curcpu(); - 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(); - while (ci->ci_nexttimerevent <= tb) - ci->ci_nexttimerevent += ticks_per_intr; - - ci->ci_prevtb = ci->ci_nexttimerevent - ticks_per_intr; - - for (nstats = 0; ci->ci_nextstatevent <= tb; nstats++) { - int r; - do { - r = random() & (statvar -1); - } while (r == 0); /* random == 0 not allowed */ - ci->ci_nextstatevent += statmin + r; - } - - /* only count timer ticks for CLK_IRQ */ - stat_count.ec_count += nstats; - - if (ci->ci_nexttimerevent < ci->ci_nextstatevent) - nextevent = ci->ci_nexttimerevent; - else - nextevent = ci->ci_nextstatevent; - - /* - * Need to work about the near constant skew this introduces??? - * reloading tb here could cause a missed tick. - */ - ppc_mtdec(nextevent - tb); - - if (ci->ci_cpl >= IPL_CLOCK) { - ci->ci_statspending += nstats; - } else { - nstats += ci->ci_statspending; - ci->ci_statspending = 0; - - s = splclock(); - - /* - * Reenable interrupts - */ - ppc_intr_enable(1); - - /* - * Do standard timer interrupt stuff. - */ - while (ci->ci_lasttb < ci->ci_prevtb) { - /* sync lasttb with hardclock */ - ci->ci_lasttb += ticks_per_intr; - clk_count.ec_count++; - hardclock(frame); - } - - while (nstats-- > 0) - statclock(frame); - - splx(s); - (void) ppc_intr_disable(); - - /* if a tick has occurred while dealing with these, - * dont service it now, delay until the next tick. - */ - } -} - -void cpu_startclock(void); - -void -cpu_initclocks(void) -{ - int intrstate; - int minint; - - 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); - - evcount_attach(&clk_count, "clock", &clk_irq); - evcount_attach(&stat_count, "stat", &stat_irq); - - ticks_per_intr = ticks_per_sec / hz; - cpu_startclock(); - - tb_timecounter.tc_frequency = ticks_per_sec; - tc_init(&tb_timecounter); - ppc_intr_enable(intrstate); -} - -void -cpu_startclock() -{ - struct cpu_info *ci = curcpu(); - u_int64_t nextevent; - - ci->ci_lasttb = ppc_mftb(); - - /* - * no point in having random on the first tick, - * it just complicates the code. - */ - ci->ci_nexttimerevent = ci->ci_lasttb + ticks_per_intr; - nextevent = ci->ci_nextstatevent = ci->ci_nexttimerevent; - - ci->ci_statspending = 0; - - ppc_mtdec(nextevent - ci->ci_lasttb); -} - -void -delay(unsigned n) -{ - u_int64_t tb; - - tb = ppc_mftb(); - tb += (n * 1000 + ns_per_tick - 1) / ns_per_tick; - while (tb > ppc_mftb()) - ; -} - -/* - * 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. - */ -} - -u_int -tb_get_timecount(struct timecounter *tc) -{ - return ppc_mftbl(); -} diff --git a/sys/arch/socppc/socppc/conf.c b/sys/arch/socppc/socppc/conf.c deleted file mode 100644 index ead905c5646..00000000000 --- a/sys/arch/socppc/socppc/conf.c +++ /dev/null @@ -1,277 +0,0 @@ -/* $OpenBSD: conf.c,v 1.28 2016/09/04 10:51:24 naddy 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/systm.h> -#include <sys/tty.h> - -#include <machine/conf.h> - -#include "sd.h" -#include "st.h" -#include "cd.h" -#include "rd.h" -#include "wd.h" -bdev_decl(wd); -cdev_decl(wd); - -#include "vnd.h" -#include "video.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_notdef(), /* 4 unknown*/ - bdev_notdef(), /* 5 was: SCSI tape */ - bdev_notdef(), /* 6 unknown*/ - bdev_notdef(), /* 7 unknown*/ - bdev_notdef(), /* 8 */ - bdev_notdef(), /* 9 */ - bdev_notdef(), /* 10 */ - bdev_notdef(), /* 11 */ - bdev_notdef(), /* 12 */ - bdev_notdef(), /* 13 */ - bdev_disk_init(NVND,vnd), /* 14 vnode disk driver*/ - bdev_notdef(), /* 15 unknown*/ - bdev_notdef(), /* 16 was: concatenated disk driver */ - bdev_disk_init(NRD,rd), /* 17 ram disk driver*/ - bdev_notdef(), /* 18 unknown*/ - bdev_notdef(), /* 19 was: RAIDframe disk driver */ -}; -int nblkdev = nitems(bdevsw); - -#include "pty.h" - -#include "com.h" -cdev_decl(com); - -#include "wsdisplay.h" -#include "wskbd.h" -#include "wsmouse.h" - -#include "bpfilter.h" - -#include "tun.h" - -#include "wsmux.h" - -#ifdef USER_PCICONF -#include "pci.h" -cdev_decl(pci); -#endif - -#include "pf.h" - -#include "ksyms.h" -#include "usb.h" -#include "uhid.h" -#include "ugen.h" -#include "ulpt.h" -#include "ucom.h" - -#include "vscsi.h" -#include "pppx.h" -#include "hotplug.h" -#include "fuse.h" -#include "switch.h" - -struct cdevsw cdevsw[] = { - cdev_cn_init(1,cn), /* 0: virtual console */ - cdev_ctty_init(1,ctty), /* 1: controlling terminal */ - cdev_mm_init(1,mm), /* 2: /dev/{null,mem,kmem,...} */ - cdev_notdef(), /* 3 was /dev/drum */ - cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */ - cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */ - cdev_log_init(1,log), /* 6: /dev/klog */ - cdev_notdef(), /* 7 */ - cdev_disk_init(NSD,sd), /* 8: SCSI disk */ - cdev_disk_init(NCD,cd), /* 9: SCSI CD-ROM */ - cdev_notdef(), /* 10 */ - cdev_disk_init(NWD,wd), /* 11: ST506/ESDI/IDE disk */ - cdev_notdef(), /* 12 */ - cdev_notdef(), /* 13 */ - cdev_notdef(), /* 14 */ - cdev_notdef(), /* 15 */ - cdev_notdef(), /* 16 */ - cdev_disk_init(NRD,rd), /* 17 ram disk driver*/ - cdev_notdef(), /* 18 was: 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_bpf_init(NBPFILTER,bpf), /* 22: berkeley packet filter */ - cdev_tun_init(NTUN,tun), /* 23: network tunnel */ - cdev_notdef(), /* 24 was LKM */ - cdev_notdef(), /* 25 */ - cdev_tty_init(NCOM,com), /* 26: serial port */ - cdev_notdef(), /* 27 */ - cdev_notdef(), /* 28 */ - cdev_notdef(), /* 29 */ - cdev_notdef(), /* 30 */ - cdev_notdef(), /* 31 */ - cdev_notdef(), /* 32 */ - cdev_notdef(), /* 33 */ - cdev_notdef(), /* 34 */ - cdev_notdef(), /* 35 */ - cdev_notdef(), /* 36 */ - cdev_notdef(), /* 37 */ - cdev_notdef(), /* 38 */ - cdev_pf_init(NPF,pf), /* 39: packet filter */ - cdev_random_init(1,random), /* 40: random data source */ - cdev_notdef(), /* 41 */ - cdev_notdef(), /* 42 */ - cdev_ksyms_init(NKSYMS,ksyms), /* 43: Kernel symbols device */ - cdev_video_init(NVIDEO,video), /* 44: generic video I/O */ - cdev_notdef(), /* 45 */ - cdev_notdef(), /* 46 */ - cdev_notdef(), /* 47: was: /dev/crypto */ - cdev_notdef(), /* 48 */ - cdev_notdef(), /* 49 */ - cdev_notdef(), /* 50 */ - cdev_notdef(), /* 51 */ - cdev_notdef(), /* 52 */ - cdev_notdef(), /* 53 */ - cdev_notdef(), /* 54 was: RAIDframe disk driver */ - cdev_notdef(), /* 55 */ - cdev_notdef(), /* 56 */ - cdev_notdef(), /* 57 */ - cdev_notdef(), /* 58 */ - cdev_notdef(), /* 59 */ - cdev_notdef(), /* 60 */ - 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_notdef(), /* 65 */ - 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 */ - cdev_notdef(), /* 73 */ - cdev_notdef(), /* 74: was USB scanners */ - cdev_notdef(), /* 75 */ - cdev_notdef(), /* 76 */ - cdev_ptm_init(NPTY,ptm), /* 77: pseudo-tty ptm device */ - cdev_vscsi_init(NVSCSI,vscsi), /* 78: vscsi */ - cdev_notdef(), /* 79 */ - cdev_notdef(), /* 80 */ - cdev_notdef(), - cdev_disk_init(1,diskmap), /* 82: disk mapper */ - cdev_pppx_init(NPPPX,pppx), /* 83: pppx */ - cdev_hotplug_init(NHOTPLUG,hotplug), /* 84: devices hot plugging */ - cdev_fuse_init(NFUSE,fuse), /* 85: fuse */ - cdev_tun_init(NTUN,tap), /* 86: Ethernet network tunnel */ - cdev_switch_init(NSWITCH,switch), /* 87: switch(4) control interface */ -}; -int nchrdev = nitems(cdevsw); - -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, /* sd */ - /* 9 */ 3, /* cd */ - /* 10 */ NODEV, - /* 11 */ 0, /* wd */ - /* 12 */ NODEV, - /* 13 */ NODEV, - /* 14 */ NODEV, - /* 15 */ NODEV, - /* 16 */ NODEV, - /* 17 */ 17, /* rd */ - /* 18 */ NODEV, - /* 19 */ 14, /* vnd */ -}; -int nchrtoblktbl = nitems(chrtoblktbl); - -#include <dev/cons.h> - -#define comcnpollc nullcnpollc -cons_decl(com); - -struct consdev constab[] = { -#if NCOM > 0 - cons_init(com), -#endif - { 0 }, -}; diff --git a/sys/arch/socppc/socppc/cpu.c b/sys/arch/socppc/socppc/cpu.c deleted file mode 100644 index 66422f3c00b..00000000000 --- a/sys/arch/socppc/socppc/cpu.c +++ /dev/null @@ -1,96 +0,0 @@ -/* $OpenBSD: cpu.c,v 1.9 2015/03/31 15:51:05 mpi Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> -#include <dev/rndvar.h> - -#include <machine/autoconf.h> -#include <powerpc/hid.h> - -#include <dev/ofw/openfirm.h> - - -struct cpu_info cpu_info[PPC_MAXPROCS] = { { NULL } }; /* XXX */ - -char cpu_model[] = "8347"; -char machine[] = MACHINE; /* cpu architecture */ - -int cpu_match(struct device *, void *, void *); -void cpu_attach(struct device *, struct device *, void *); - -struct cfattach cpu_ca = { - sizeof(struct device), cpu_match, cpu_attach -}; - -struct cfdriver cpu_cd = { - NULL, "cpu", DV_DULL -}; - -int -cpu_match(struct device *parent, void *cfdata, void *aux) -{ - struct mainbus_attach_args *ma = aux; - char buf[32]; - - if (OF_getprop(ma->ma_node, "device_type", buf, sizeof(buf)) <= 0) - return (0); - - if (strcmp(buf, "cpu") == 0) - return (1); - - return (0); -} - -void -cpu_attach(struct device *parent, struct device *self, void *aux) -{ - struct cpu_info *ci; - u_int32_t hid0; - - ci = &cpu_info[0]; - ci->ci_cpuid = 0; - ci->ci_intrdepth = -1; - ci->ci_dev = self; - - printf(": %s\n", cpu_model); - - /* Enable data cache. */ - hid0 = ppc_mfhid0(); - if ((hid0 & HID0_DCE) == 0) { - __asm volatile ( - "sync; mtspr 1008,%0; mtspr 1008,%1" - :: "r" (hid0 | HID0_DCFI), "r" (hid0 | HID0_DCE)); - } - - /* Enable instruction cache. */ - hid0 = ppc_mfhid0(); - if ((hid0 & HID0_ICE) == 0) { - __asm volatile ( - "isync; mtspr 1008,%0; mtspr 1008,%1" - :: "r" (hid0 | HID0_ICFI), "r" (hid0 | HID0_ICE)); - } - - /* Select DOZE mode. */ - hid0 = ppc_mfhid0(); - hid0 &= ~(HID0_NAP | HID0_DOZE | HID0_SLEEP); - hid0 |= HID0_DOZE | HID0_DPM; - ppc_mthid0(hid0); - ppc_cpuidle = 1; -} diff --git a/sys/arch/socppc/socppc/disksubr.c b/sys/arch/socppc/socppc/disksubr.c deleted file mode 100644 index 326274d0524..00000000000 --- a/sys/arch/socppc/socppc/disksubr.c +++ /dev/null @@ -1,133 +0,0 @@ -/* $OpenBSD: disksubr.c,v 1.21 2017/02/28 10:49:37 natano 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. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/buf.h> -#include <sys/disklabel.h> -#include <sys/disk.h> - -/* - * Attempt to read a disk label from a device - * using the indicated strategy routine. - * The label must be partly set up before this: - * secpercyl, 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. - * - * If dos partition table requested, attempt to load it and - * find disklabel inside a DOS partition. - * - * We would like to check if each MBR has a valid DOSMBR_SIGNATURE, but - * we cannot because it doesn't always exist. So.. we assume the - * MBR is valid. - */ -int -readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, int spoofonly) -{ - struct buf *bp = NULL; - int error; - - if ((error = initdisklabel(lp))) - goto done; - - /* get a buffer and initialize it */ - bp = geteblk(lp->d_secsize); - bp->b_dev = dev; - - error = readdoslabel(bp, strat, lp, NULL, spoofonly); - if (error == 0) - goto done; - -#if defined(CD9660) - error = iso_disklabelspoof(dev, strat, lp); - if (error == 0) - goto done; -#endif -#if defined(UDF) - error = udf_disklabelspoof(dev, strat, lp); - if (error == 0) - goto done; -#endif - -done: - if (bp) { - bp->b_flags |= B_INVAL; - brelse(bp); - } - disk_change = 1; - return (error); -} - -/* - * Write disk label back to device after modification. - */ -int -writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) -{ - daddr_t partoff = -1; - int error = EIO; - int offset; - struct disklabel *dlp; - struct buf *bp = NULL; - - /* get a buffer and initialize it */ - bp = geteblk(lp->d_secsize); - bp->b_dev = dev; - - if (readdoslabel(bp, strat, lp, &partoff, 1) != 0) - goto done; - - /* Read it in, slap the new label in, and write it back out */ - error = readdisksector(bp, strat, lp, DL_BLKTOSEC(lp, partoff + - DOS_LABELSECTOR)); - if (error) - goto done; - offset = DL_BLKOFFSET(lp, partoff + DOS_LABELSECTOR); - - dlp = (struct disklabel *)(bp->b_data + offset); - *dlp = *lp; - CLR(bp->b_flags, B_READ | B_WRITE | B_DONE); - SET(bp->b_flags, B_BUSY | B_WRITE | B_RAW); - (*strat)(bp); - error = biowait(bp); - -done: - if (bp) { - bp->b_flags |= B_INVAL; - brelse(bp); - } - disk_change = 1; - return (error); -} diff --git a/sys/arch/socppc/socppc/genassym.cf b/sys/arch/socppc/socppc/genassym.cf deleted file mode 100644 index ef444ab5917..00000000000 --- a/sys/arch/socppc/socppc/genassym.cf +++ /dev/null @@ -1,99 +0,0 @@ -# $OpenBSD: genassym.cf,v 1.6 2018/01/22 10:04:46 mpi 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 <sys/mutex.h> -include <uvm/uvm_extern.h> - -include <machine/pcb.h> -include <machine/pmap.h> -include <machine/cpu.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_FAULT pcb_onfault - -struct pmap -member PM_SR pm_sr[0] -member PM_USRSR pm_sr[PPC_USER_SR] -member PM_KERNELSR pm_sr[PPC_KERNEL_SR] - -struct proc -member p_addr -member p_stat -member p_cpu -member P_MD_ASTPENDING p_md.md_astpending - -struct sigframe -member sf_sc - -struct fpsig - -export SONPROC - -struct cpu_info -member ci_curproc -member ci_curpcb -member ci_curpm -member ci_want_resched -member ci_cpl -member ci_flags -export CI_FLAGS_SLEEPING -member ci_intrdepth -member ci_intstk -member ci_tempsave -member ci_ddbsave -member ci_disisave -ifdef DIAGNOSTIC -member ci_mutex_level -endif diff --git a/sys/arch/socppc/socppc/locore.S b/sys/arch/socppc/socppc/locore.S deleted file mode 100644 index eb70347517c..00000000000 --- a/sys/arch/socppc/socppc/locore.S +++ /dev/null @@ -1,1380 +0,0 @@ -/* $OpenBSD: locore.S,v 1.22 2016/05/23 20:11:49 deraadt 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> - -#define GET_CPUINFO(r) mfsprg r,0 - -#define INTSTK (8*1024) /* 8K interrupt stack */ -#define SPILLSTK (1*1024) -#define DDBSTK (7*1024) - -/* - * 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 */ - - .globl _C_LABEL(fwargsave) - .type _C_LABEL(fwargsave),@object -_C_LABEL(fwargsave): .long 0 - - .globl _C_LABEL(fwfdtsave) - .type _C_LABEL(fwfdtsave),@object -_C_LABEL(fwfdtsave): .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: - /* make sure address translation is disabled */ - mfmsr %r9 - li %r8,PSL_DR|PSL_IR - andc %r9,%r9,%r8 - sync - mtmsr %r9 - isync - - lis %r8, fwargsave@ha - stw %r29, fwargsave@l(%r8) - - lis %r8, fwfdtsave@ha - stw %r3, fwfdtsave@l(%r8) - -/* compute end of kernel memory */ - lis %r8,_end@ha - addi %r8,%r8,_end@l - cmpwi %r4,0 - beq 1f - li %r6,0 -1: -#if defined(DDB) - cmpwi %r6, 0 - beq 2f - add %r9,%r6,%r7 - lwz %r9, -4(%r9) - cmpwi %r9,0 - beq 2f - lis %r8,_C_LABEL(esym)@ha - stw %r9,_C_LABEL(esym)@l(%r8) - mr %r8, %r9 -2: -#endif - li %r9,PGOFSET - add %r8,%r8,%r9 - andc %r8,%r8,%r9 - lis %r9,_C_LABEL(cpu_info)@ha - addi %r9,%r9,_C_LABEL(cpu_info)@l - mtsprg 0,%r9 - addi %r8,%r8,INTSTK - stw %r8,CI_INTSTK(%r9) - li %r0,-1 - stw %r0,CI_INTRDEPTH(%r9) - addi %r8,%r8,SPILLSTK+DDBSTK /* leave room for spillstk and ddbstk */ - 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) - -#ifdef MULTIPROCESSOR -_ENTRY(_C_LABEL(cpu_spinup_trampoline)) - lis %r3,_C_LABEL(cpu_hatch_stack)@ha - lwz %r1,_C_LABEL(cpu_hatch_stack)@l(%r3) - - b _C_LABEL(cpu_hatch) - /* NOTREACHED */ -#endif - -_ENTRY(_C_LABEL(prom_printf)) - lis %r11, fwargsave@ha - lwz %r11, fwargsave@l(%r11) - lwz %r11, 88(%r11) - lwz %r11, 20(%r11) - mtctr %r11 - bctr - -/* - * void cpu_switchto(struct proc *old, struct proc *new) - * Switch from "old" proc to "new". - */ -_ENTRY(_C_LABEL(cpu_switchto_asm)) - mflr %r0 /* save lr */ - stw %r0,4(%r1) - stwu %r1,-16(%r1) - stw %r31,12(%r1) - stw %r30,8(%r1) - -/* - * r3 - old proc - * r4 - new proc - * r5 - cpuinfo - */ - GET_CPUINFO(%r5) - - li %r31,SONPROC - stb %r31,P_STAT(%r4) - - or. %r3,%r3,%r3 /* old process was exiting? */ - beq switch_exited - - mfsr %r10,PPC_USER_SR /* save PPC_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 %r31,P_ADDR(%r3) - stw %r1,PCB_SP(%r31) /* save SP */ - -switch_exited: - /* disable interrupts while actually switching */ - mfmsr %r30 - andi. %r30,%r30,~PSL_EE@l - mtmsr %r30 - isync - - stw %r4,CI_CURPROC(%r5) /* record new process */ - -#ifdef MULTIPROCESSOR - stw %r5,P_CPU(%r4) -#endif - - lwz %r31,P_ADDR(%r4) - stw %r31,CI_CURPCB(%r5) /* indicate new pcb */ - - lwz %r6,PCB_PMR(%r31) - - /* save real pmap pointer for spill fill */ - stwu %r6,CI_CURPM(%r5) - stwcx. %r6,%r0,%r5 /* clear possible reservation */ - - addic. %r6,%r6,64 - li %r5,0 - - lwz %r1,PCB_SP(%r31) /* get new procs SP */ - - ori %r30,%r30,PSL_EE /* interrupts are okay again */ - mtmsr %r30 - - 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 PPC_USER_SR,%r10 /* get saved PPC_USER_SR */ - isync - - lwz %r31,12(%r1) - lwz %r30,8(%r1) - addi %r1,%r1,16 - lwz %r0,4(%r1) - mtlr %r0 - blr - -_ENTRY(_C_LABEL(cpu_idle_enter)) - lis %r4, _C_LABEL(ppc_cpuidle)@ha - lwz %r4, _C_LABEL(ppc_cpuidle)@l(%r4) - cmpwi %r4, 0 - beq 1f - /* must disable external interrupts during idle queue checking */ - mfmsr %r3 - andi. %r3,%r3,~PSL_EE@l - mtmsr %r3 - isync -1: - blr - -_ENTRY(_C_LABEL(cpu_idle_cycle)) - lis %r4, _C_LABEL(ppc_cpuidle)@ha - lwz %r4, _C_LABEL(ppc_cpuidle)@l(%r4) - cmpwi %r4, 0 - beq idledone - - /* - * Interrupts were disabled in cpu_idle_enter, but must be - * enabled for sleeping, but before that indicate that we - * are entering sleep mode. - */ - GET_CPUINFO(%r4) - lwz %r6,CI_FLAGS(%r4) - ori %r6,%r6,CI_FLAGS_SLEEPING@l - stw %r6,CI_FLAGS(%r4) - - /* enable interrupts, required before setting POW */ - mfmsr %r3 - ori %r5,%r3,PSL_EE@l - mtmsr %r5 - oris %r5, %r5, PSL_POW@h - sync - /* low power mode */ - mtmsr %r5 - sync - isync - - /* - * restore interrupts to disabled, so CI_FLAGS is only modified - * with interrupts disabled. - */ - mtmsr %r3 - isync - - /* clear CI_FLAGS_SLEEPING since sleeping is over */ - andi. %r6,%r6,~CI_FLAGS_SLEEPING@l - stw %r6,CI_FLAGS(%r4) -idledone: - blr - -_ENTRY(_C_LABEL(cpu_idle_leave)) - lis %r4, _C_LABEL(ppc_cpuidle)@ha - lwz %r4, _C_LABEL(ppc_cpuidle)@l(%r4) - cmpwi %r4, 0 - beq 1f - /* enable interrupts disabled in cpu_idle_enter. */ - mfmsr %r3 - ori %r3,%r3,PSL_EE@l - mtmsr %r3 -1: - blr - -/* - * This code gets copied to all the trap vectors - * except ISI/DSI, ALI, and the interrupts - */ - .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 */ -nop32_1s: - mfmsr %r1 - clrldi %r1,%r1,1 - mtmsrd %r1 -nop32_1e: - GET_CPUINFO(%r1) - stmw %r28,CI_TEMPSAVE(%r1) /* free r28-r31 */ - mflr %r28 /* save LR */ - mfcr %r29 /* save CR */ - mfsprg %r1,1 /* restore SP */ - - /* Test whether we already had PR set */ - mfsrr1 %r31 - mtcr %r31 - bc 4,17,1f /* branch if PSL_PR is clear */ - GET_CPUINFO(%r1) - lwz %r1,CI_CURPCB(%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 */ -nop32_2s: - mfmsr %r1 - clrldi %r1,%r1,1 - mtmsrd %r1 -nop32_2e: - GET_CPUINFO(%r1) - stmw %r28,CI_TEMPSAVE(%r1) /* free r28-r31 */ - mfdar %r30 - mfdsisr %r31 - stmw %r30,CI_TEMPSAVE+16(%r1) - mflr %r28 /* save LR */ - mfcr %r29 /* save CR */ - mfsprg %r1,1 /* restore SP */ - - /* Test whether we already had PR set */ - mfsrr1 %r31 - mtcr %r31 - bc 4,17,1f /* branch if PSL_PR is clear */ - GET_CPUINFO(%r1) - lwz %r1,CI_CURPCB(%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): - mtsprg 1,%r1 - GET_CPUINFO(%r1) - stmw %r28,CI_DISISAVE(%r1) /* free r28-r31 */ -nop32_3s: - mfmsr %r28 - clrldi %r28,%r28,1 - mtmsrd %r28 -nop32_3e: - mfsprg %r1,1 - mfcr %r29 /* save CR */ - mfxer %r30 /* save XER */ - mtsprg 2,%r30 /* in SPRG2 */ - mfsrr1 %r31 /* test kernel mode */ -nopbat_1s: - 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(%r31) /* 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 */ - mtsprg 1,%r1 - GET_CPUINFO(%r1) - lmw %r28,CI_DISISAVE(%r1) /* restore r28-r31 */ - mfsprg 1,%r1 - rfi /* return to trapped code */ -1: -nopbat_1e: - 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): - mtsprg 1,%r1 /* save SP */ -nop32_4s: - mfmsr %r1 - clrldi %r1,%r1,1 - mtmsrd %r1 -nop32_4e: - GET_CPUINFO(%r1) - stmw %r28,CI_DISISAVE(%r1) /* free r28-r31 */ - mflr %r28 /* save LR */ - mfcr %r29 /* save CR */ - mfsrr1 %r31 /* test kernel mode */ - mfsprg %r1,1 /* restore SP */ - 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 */ -nop32_5s: - mfmsr %r1 - clrldi %r1,%r1,1 - mtmsrd %r1 -nop32_5e: - GET_CPUINFO(%r1) - stmw %r28,CI_TEMPSAVE(%r1) /* free r28-r31 */ - mflr %r28 /* save LR */ - mfcr %r29 /* save CR */ - mfxer %r30 /* save XER */ - lwz %r31,CI_INTRDEPTH(%r1) /* were we already running on intstk? */ - addic. %r31,%r31,1 - stw %r31,CI_INTRDEPTH(%r1) - lwz %r1,CI_INTSTK(%r1) /* get interrupt stack */ - 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 */ -nop32_6s: - mfmsr %r1 - clrldi %r1,%r1,1 - mtmsrd %r1 -nop32_6e: - GET_CPUINFO(%r1) - stmw %r28,CI_TEMPSAVE(%r1) /* free r28-r31 */ - mflr %r28 /* save LR */ - mfcr %r29 /* save CR */ - mfxer %r30 /* save XER */ - lwz %r31,CI_INTRDEPTH(%r1) /* were we already running on intstk? */ - addic. %r31,%r31,1 - stw %r31,CI_INTRDEPTH(%r1) - lwz %r1,CI_INTSTK(%r1) /* get interrupt stack */ - 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. %r1,%r1,%r3,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 -/* - * In case of DDB we want a separate trap catcher for it - */ - .globl _C_LABEL(ddblow),_C_LABEL(ddbsize) -_C_LABEL(ddblow): - mtsprg 1,%r1 /* save SP */ -nop32_7s: - mfmsr %r1 - clrldi %r1,%r1,1 - mtmsrd %r1 -nop32_7e: - GET_CPUINFO(%r1) - stmw %r28,CI_DDBSAVE(%r1) /* free r28-r31 */ - mflr %r28 /* save LR */ - mfcr %r29 /* save CR */ - GET_CPUINFO(%r30) - lwz %r30,CI_INTSTK(%r30) /* get interrupt stack */ - addi %r1,%r30,8192 /* 7k for ddb */ - bla ddbtrap -_C_LABEL(ddbsize) = .-_C_LABEL(ddblow) -#endif /* DDB */ - -/* - * If this interrupt occured between the runqueue check and the setting - * of the POW bit, do no enter to sleep. We do that in order to process - * the result of this interrupt directly and not when coming back from - * sleep, when the next clock tick or interrupt will fire. - */ -#define CPU_IDLE_CHECK(sr1,sr2,sr3,rSRR0,flag) \ - GET_CPUINFO(sr1); \ - lwz sr2,CI_FLAGS(sr1); \ - andi. sr3,sr2,flag@l; \ - beq 1f; \ - andi. sr2,sr2,~flag@l; \ - stw sr2,CI_FLAGS(sr1); \ - lis rSRR0,_C_LABEL(idledone)@ha; \ - addi rSRR0,rSRR0,_C_LABEL(idledone)@l; \ -1: - -/* - * 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) FRAME_SETUP_FLAG(savearea, CI_FLAGS_SLEEPING) - -#define FRAME_SETUP_FLAG(savearea, flag) \ -/* Have to enable translation to allow access of kernel stack: */ \ - GET_CPUINFO(%r31); \ - mfsrr0 %r30; \ - stw %r30,savearea+24(%r31); \ - mfsrr1 %r30; \ - stw %r30,savearea+28(%r31); \ - /* load all kernel segment registers. */ \ - lis %r31,_C_LABEL(kernel_pmap_)@ha; \ - addi %r31,%r31,_C_LABEL(kernel_pmap_)@l; \ - lwz %r30,0(%r31); mtsr 0,%r30; \ - lwz %r30,4(%r31); mtsr 1,%r30; \ - lwz %r30,8(%r31); mtsr 2,%r30; \ - lwz %r30,12(%r31); mtsr 3,%r30; \ - lwz %r30,16(%r31); mtsr 4,%r30; \ - lwz %r30,20(%r31); mtsr 5,%r30; \ - lwz %r30,24(%r31); mtsr 6,%r30; \ - lwz %r30,28(%r31); mtsr 7,%r30; \ - lwz %r30,32(%r31); mtsr 8,%r30; \ - lwz %r30,36(%r31); mtsr 9,%r30; \ - lwz %r30,40(%r31); mtsr 10,%r30; \ - lwz %r30,44(%r31); mtsr 11,%r30; \ - lwz %r30,48(%r31); mtsr 12,%r30; \ -/* lwz %r30,52(%r31); mtsr 13,%r30; - dont load user SR - XXX? */ \ - lwz %r30,56(%r31); mtsr 14,%r30; \ - lwz %r30,60(%r31); mtsr 15,%r30; \ - 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 %r2,FRAME_2+8(%r1); \ - stw %r28,FRAME_LR+8(%r1); \ - stw %r29,FRAME_CR+8(%r1); \ - GET_CPUINFO(%r2); \ - lmw %r28,savearea(%r2); \ - stmw %r3,FRAME_3+8(%r1); \ - lmw %r28,savearea+16(%r2); \ - 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); \ - CPU_IDLE_CHECK(%r5,%r6,%r0,%r30,flag) \ - 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); \ - GET_CPUINFO(%r7); \ - stw %r2,savearea(%r7); \ - stw %r3,savearea+4(%r7); \ - lwz %r7,FRAME_CR+8(%r1); \ - 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: */ \ - GET_CPUINFO(%r2); \ - lwz %r3,savearea+4(%r2); \ - mtcr %r3; \ - bc 4,17,1f; /* branch if PSL_PR is false */ \ -/* Restore user & kernel access SR: */ \ - lwz %r2,CI_CURPM(%r2); /* get real address of pmap */ \ - lwz %r3,0(%r2); mtsr 0,%r3; \ - lwz %r3,4(%r2); mtsr 1,%r3; \ - lwz %r3,8(%r2); mtsr 2,%r3; \ - lwz %r3,12(%r2); mtsr 3,%r3; \ - lwz %r3,16(%r2); mtsr 4,%r3; \ - lwz %r3,20(%r2); mtsr 5,%r3; \ - lwz %r3,24(%r2); mtsr 6,%r3; \ - lwz %r3,28(%r2); mtsr 7,%r3; \ - lwz %r3,32(%r2); mtsr 8,%r3; \ - lwz %r3,36(%r2); mtsr 9,%r3; \ - lwz %r3,40(%r2); mtsr 10,%r3; \ - lwz %r3,44(%r2); mtsr 11,%r3; \ - lwz %r3,48(%r2); mtsr 12,%r3; \ - lwz %r3,52(%r2); mtsr 13,%r3; \ - lwz %r3,56(%r2); mtsr 14,%r3; \ - lwz %r3,60(%r2); mtsr 15,%r3; \ -1: mfsprg %r2,1; /* restore cr */ \ - mtcr %r2; \ - GET_CPUINFO(%r2); \ - lwz %r3,savearea(%r2); \ - mtsrr0 %r3; \ - lwz %r3,savearea+4(%r2); \ - mtsrr1 %r3; \ - mfsprg %r2,2; /* restore r2 & r3 */ \ - mfsprg %r3,3 - -/* - * Preamble code for DSI/ISI traps - */ -disitrap: - GET_CPUINFO(%r1) - lmw %r30,CI_DISISAVE(%r1) - stmw %r30,CI_TEMPSAVE(%r1) - lmw %r30,CI_DISISAVE+8(%r1) - stmw %r30,CI_TEMPSAVE+8(%r1) - mfdar %r30 - mfdsisr %r31 - stmw %r30,CI_TEMPSAVE+16(%r1) -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 */ - GET_CPUINFO(%r1) - lwz %r1,CI_CURPCB(%r1) - addi %r1,%r1,USPACE /* stack is top of user struct */ -/* - * Now the common trap catching code. - */ - .globl s_trap -s_trap: - FRAME_SETUP(CI_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) - - .globl trapexit -trapexit: -/* Disable interrupts: */ - mfmsr %r3 - andi. %r3,%r3,~PSL_EE@l - mtmsr %r3 - isync -/* Test AST pending: */ - lwz %r5,FRAME_SRR1+8(%r1) - mtcr %r5 - bc 4,17,1f /* branch if PSL_PR is false */ - GET_CPUINFO(%r3) - lwz %r4,CI_CURPROC(%r3) - lwz %r4,P_MD_ASTPENDING(%r4) - andi. %r4,%r4,1 - beq 1f - li %r6,EXC_AST - stw %r6,FRAME_EXC+8(%r1) - b trapagain -1: - FRAME_LEAVE(CI_TEMPSAVE) -rfi1: 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): -#ifdef MULTIPROCESSOR - bl _C_LABEL(proc_trampoline_mp) -#endif - 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 */ - GET_CPUINFO(%r30) - lwz %r30,CI_INTSTK(%r30) /* get interrupt stack */ - addi %r1,%r30,1024 - 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 */ - mfdar %r7 - mfsrr1 %r4 - mfdsisr %r5 - li %r6, 0 -s_pte_spill: - andi. %r0,%r4,PSL_PR - li %r3,0 - bne 1f - mr %r3,%r7 - bl _C_LABEL(pte_spill_r) /* try a spill */ -1: - 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 - mtcr %r29 /* restore CR */ - mtlr %r28 /* restore LR */ - GET_CPUINFO(%r1) - lmw %r28,CI_DISISAVE(%r1) /* restore r28-r31 */ - mfsprg %r1,1 /* restore SP */ -rfi2: 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,1,disitrap /* branch if table miss is false */ - GET_CPUINFO(%r30) - lwz %r30,CI_INTSTK(%r30) /* get interrupt stack */ - addi %r1,%r30,1024 - 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 %r7 - 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 */ \ - GET_CPUINFO(%r4); \ - lmw %r28,CI_TEMPSAVE(%r4); /* restore r28-r31 */ \ - mfctr %r6; \ - lwz %r5,CI_INTRDEPTH(%r4); \ - mfsrr0 %r4; \ - mfsrr1 %r3; \ - stw %r6,28(%r1); \ - stw %r5,20(%r1); \ - stw %r4,12(%r1); \ - stw %r3,8(%r1); \ -/* load all kernel segment registers. */ \ - lis 3,_C_LABEL(kernel_pmap_)@ha; \ - addi 3,3,_C_LABEL(kernel_pmap_)@l; \ - lwz %r5,0(%r3); mtsr 0,%r5; \ - lwz %r5,4(%r3); mtsr 1,%r5; \ - lwz %r5,8(%r3); mtsr 2,%r5; \ - lwz %r5,12(%r3); mtsr 3,%r5; \ - lwz %r5,16(%r3); mtsr 4,%r5; \ - lwz %r5,20(%r3); mtsr 5,%r5; \ - lwz %r5,24(%r3); mtsr 6,%r5; \ - lwz %r5,28(%r3); mtsr 7,%r5; \ - lwz %r5,32(%r3); mtsr 8,%r5; \ - lwz %r5,36(%r3); mtsr 9,%r5; \ - lwz %r5,40(%r3); mtsr 10,%r5; \ - lwz %r5,44(%r3); mtsr 11,%r5; \ - lwz %r5,48(%r3); mtsr 12,%r5; \ -/* lwz %r5,52(%r3); mtsr 13,%r5; - dont load user SR - XXX? */ \ - lwz %r5,56(%r3); mtsr 14,%r5; \ - lwz %r5,60(%r3); mtsr 15,%r5; \ -/* interrupts are recoverable here, and enable translation */ \ - 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(ext_intr) /* 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 - - GET_CPUINFO(%r5) - lwz %r4,CI_INTRDEPTH(%r5) - addi %r4,%r4,-1 /* adjust reentrancy count */ - stw %r4,CI_INTRDEPTH(%r5) - -/* Returning to user mode? */ - mtcr %r6 /* saved SRR1 */ - bc 4,17,1f /* branch if PSL_PR is false */ - lwz %r3,CI_CURPM(%r5) /* get current pmap real address */ - /* reload all segment registers. */ - lwz %r4,0(3); mtsr 0,%r4; - lwz %r4,4(3); mtsr 1,%r4; - lwz %r4,8(3); mtsr 2,%r4; - lwz %r4,12(3); mtsr 3,%r4; - lwz %r4,16(3); mtsr 4,%r4; - lwz %r4,20(3); mtsr 5,%r4; - lwz %r4,24(3); mtsr 6,%r4; - lwz %r4,28(3); mtsr 7,%r4; - lwz %r4,32(3); mtsr 8,%r4; - lwz %r4,36(3); mtsr 9,%r4; - lwz %r4,40(3); mtsr 10,%r4; - lwz %r4,44(3); mtsr 11,%r4; - lwz %r4,48(3); mtsr 12,%r4; - lwz %r4,52(3); mtsr 13,%r4; - lwz %r4,56(3); mtsr 14,%r4; - lwz %r4,60(3); mtsr 15,%r4; - lwz %r4,CI_CURPROC(%r5) - lwz %r4,P_MD_ASTPENDING(%r4) /* Test AST pending */ - andi. %r4,%r4,1 - beq 1f -/* Setup for entry to realtrap: */ - lwz %r3,0(%r1) /* get saved SP */ - mtsprg 1,%r3 - li %r6,EXC_AST - stmw %r28,CI_TEMPSAVE(%r5) /* 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) - 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) - lwz %r4,76(%r1) - lwz %r3,80(%r1) - lwz %r0,84(%r1) - lwz %r1,0(%r1) -rfi3: rfi - -/* - * Decrementer interrupt second level handler - */ - .globl decrintr -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 - GET_CPUINFO(%r4) - lwz %r4,CI_CURPCB(%r4) - stw %r3,PCB_FAULT(%r4) - stw %r0,0(%r3) - stw %r1,4(%r3) - stmw %r12,8(%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. - */ - .section .rodata - .globl _C_LABEL(sigcode),_C_LABEL(esigcode) - .type _C_LABEL(sigcode),@function - .type _C_LABEL(esigcode),@function -_C_LABEL(sigcode): - addi %r1,%r1,-((16+FPSIG_SIZEOF+15)& ~0xf) /* reserved space for callee */ - addi %r6,%r1,8 - stfd %f0,0(%r6) - stfd %f1,8(%r6) - stfd %f2,16(%r6) - stfd %f3,24(%r6) - stfd %f4,32(%r6) - stfd %f5,40(%r6) - stfd %f6,48(%r6) - stfd %f7,56(%r6) - stfd %f8,64(%r6) - stfd %f9,72(%r6) - stfd %f10,80(%r6) - stfd %f11,88(%r6) - stfd %f12,96(%r6) - stfd %f13,104(%r6) - mffs %f0 - stfd %f0,112(%r6) - lfd %f0,0(%r6) /* restore the clobbered register */ - blrl - addi %r6,%r1,8 - lfd %f0,112(%r6) - mtfsf 0xff,%f0 - lfd %f0,0(%r6) - lfd %f1,8(%r6) - lfd %f2,16(%r6) - lfd %f3,24(%r6) - lfd %f4,32(%r6) - lfd %f5,40(%r6) - lfd %f6,48(%r6) - lfd %f7,56(%r6) - lfd %f8,64(%r6) - lfd %f9,72(%r6) - lfd %f10,80(%r6) - lfd %f11,88(%r6) - lfd %f12,96(%r6) - lfd %f13,104(%r6) - addi %r3,%r1,((16+FPSIG_SIZEOF+15)&~0xf)+SF_SC /* compute &sf_sc */ - li %r0,SYS_sigreturn - sc /* sigreturn(scp) */ - .globl _C_LABEL(sigcoderet) -_C_LABEL(sigcoderet): - li %r0,SYS_exit - sc /* exit(errno) */ -_C_LABEL(esigcode): - - .globl _C_LABEL(sigfill) -_C_LABEL(sigfill): - .long 0 # illegal -_C_LABEL(esigfill): - .align 4 - .globl _C_LABEL(sigfillsiz) -_C_LABEL(sigfillsiz): - .long _C_LABEL(esigfill) - _C_LABEL(sigfill) - - .text - -#ifdef DDB -/* - * Deliberate entry to ddbtrap - */ - .globl _C_LABEL(ddb_trap) -_C_LABEL(ddb_trap): - mtsprg 1,%r1 - mfmsr %r3 - mtsrr1 %r3 - andi. %r3,%r3,~(PSL_EE|PSL_ME)@l - mtmsr %r3 /* disable interrupts */ - isync - GET_CPUINFO(%r3) - stmw %r28,CI_DDBSAVE(%r3) - - mflr %r28 - li %r29,EXC_BPT - mtlr %r29 - mfcr %r29 - mtsrr0 %r28 - -/* - * Now the ddb trap catching code. - */ -ddbtrap: - /* - * Do not let FRAME_SETUP() change the return address of, and - * corrupt, this frame. - */ - FRAME_SETUP_FLAG(CI_DDBSAVE, 0) -/* Call C trap code: */ - addi %r3,%r1,8 - bl _C_LABEL(db_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 */ - GET_CPUINFO(%r4) - stw %r3,CI_DDBSAVE+8(%r4) - FRAME_LEAVE(CI_DDBSAVE) - mtsprg 1,%r1 /* prepare for entrance to realtrap */ - GET_CPUINFO(%r1) - stmw %r28,CI_TEMPSAVE(%r1) - mflr %r28 - mfcr %r29 - lwz %r31,CI_DDBSAVE+8(%r1) - mtlr %r31 - b realtrap -ddbleave: - FRAME_LEAVE(CI_DDBSAVE) -rfi4: rfi -#endif /* DDB */ - - .globl _C_LABEL(rfi_inst) -_C_LABEL(rfi_inst): - rfi - .globl _C_LABEL(rfid_inst) -_C_LABEL(rfid_inst): - rfid - .globl _C_LABEL(nop_inst) - _C_LABEL(nop_inst): - nop - - .globl _C_LABEL(rfi_start) -_C_LABEL(rfi_start): - .long rfi1, rfi1 + 4 - .long rfi2, rfi2 + 4 - .long rfi3, rfi3 + 4 -#ifdef DDB - .long rfi4, rfi4 + 4 -#endif - .long 0, 0 - - - .globl _C_LABEL(nopbat_start) -_C_LABEL(nopbat_start): - .long nopbat_1s, nopbat_1e - .long 0, 0 - - .globl _C_LABEL(nop32_start) -_C_LABEL(nop32_start): - .long nop32_1s, nop32_1e - .long nop32_2s, nop32_2e - .long nop32_3s, nop32_3e - .long nop32_4s, nop32_4e - .long nop32_5s, nop32_5e - .long nop32_6s, nop32_6e -#ifdef DDB - .long nop32_7s, nop32_7e -#endif - .long 0, 0 diff --git a/sys/arch/socppc/socppc/machdep.c b/sys/arch/socppc/socppc/machdep.c deleted file mode 100644 index c5e39b94d31..00000000000 --- a/sys/arch/socppc/socppc/machdep.c +++ /dev/null @@ -1,771 +0,0 @@ -/* $OpenBSD: machdep.c,v 1.77 2019/04/01 07:00:52 tedu 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/conf.h> -#include <sys/exec.h> -#include <sys/extent.h> -#include <sys/malloc.h> -#include <sys/mount.h> -#include <sys/msgbuf.h> -#include <sys/proc.h> -#include <sys/reboot.h> -#include <sys/signalvar.h> -#include <sys/syscallargs.h> -#include <sys/sysctl.h> -#include <sys/tty.h> -#include <sys/user.h> - -#include <net/if.h> -#include <uvm/uvm_extern.h> - -#include <machine/bus.h> -#include <machine/pio.h> -#include <powerpc/powerpc.h> -#include <machine/trap.h> - -#include <dev/cons.h> - -#include <dev/ic/comvar.h> - -#include <dev/ofw/fdt.h> - -#ifdef DDB -#include <machine/db_machdep.h> -#include <ddb/db_extern.h> -#endif - -/* - * Global variables used here and there - */ -extern struct user *proc0paddr; - -struct uvm_constraint_range dma_constraint = { 0x0, (paddr_t)-1 }; -struct uvm_constraint_range *uvm_md_constraints[] = { NULL }; - -struct vm_map *exec_map = NULL; -struct vm_map *phys_map = NULL; - -/* - * safepri is a safe priority for sleep to set for a spin-wait - * during autoconfiguration or after a panic. - */ -int safepri = 0; - -int ppc_malloc_ok = 0; - -char *bootpath; -char bootpathbuf[512]; - -struct bd_info { - unsigned long bi_memstart; - unsigned long bi_memsize; - unsigned long bi_flashstart; - unsigned long bi_flashsize; - unsigned long bi_flashoffset; - unsigned long bi_sramstart; - unsigned long bi_sramsize; - unsigned long bi_immr_base; - unsigned long bi_bootflags; - unsigned long bi_ip_addr; - unsigned char bi_enetaddr[6]; - unsigned long bi_ethspeed; -} bootinfo; - -extern struct bd_info **fwargsave; -extern struct fdt_head *fwfdtsave; - -#ifdef APERTURE -int allowaperture = 0; -#endif - -void dumpsys(void); -int lcsplx(int ipl); -void myetheraddr(u_char *); - -/* - * Extent maps to manage I/O. Allocate storage for 8 regions in each, - * initially. Later devio_malloc_safe will indicate that it's safe 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; - -void initppc(u_int, u_int, char *); - -void prom_printf(const char *, ...); - -extern struct ppc_bus_space mainbus_bus_space; - -void -initppc(u_int startkernel, u_int endkernel, char *args) -{ - extern void *trapcode; extern int trapsize; - extern void *extint; extern int extsize; - 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 *msgbuf_addr; - int exc; - void *node; - - extern char __bss_start[], __end[]; - bzero(__bss_start, __end - __bss_start); - - /* Make a copy of the args! */ - strlcpy(bootpathbuf, args ? args : "wd0a", sizeof bootpathbuf); - - if (fwfdtsave && fwfdtsave->fh_magic == FDT_MAGIC) { - /* - * Save the FDT firmware blob passed by the bootloader - * before we zero all memory. - * - */ - void *fdt = (void *)endkernel; - memcpy(fdt, fwfdtsave, fwfdtsave->fh_size); - endkernel += fwfdtsave->fh_size; - - fdt_init(fdt); - - /* - * XXX Create a fake bootinfo structure if we were - * loaded by RouterBOOT. - */ - node = fdt_find_node("/memory"); - if (node) { - char *reg; - - if (fdt_node_property(node, "reg", ®)) { - bootinfo.bi_memstart = *(u_int32_t *)reg; - bootinfo.bi_memsize = *((u_int32_t *)reg + 1); - } - } - node = fdt_find_node("/soc8343"); - if (node) { - char *reg; - - if (fdt_node_property(node, "reg", ®)) - bootinfo.bi_immr_base = *(u_int32_t *)reg; - } - node = fdt_find_node("/soc8343/ethernet"); - if (node) { - char *addr; - - if (fdt_node_property(node, "mac-address", &addr)) - memcpy(bootinfo.bi_enetaddr, addr, 6); - } - } else { - /* - * We were loaded by an old U-Boot that didn't provide - * a flattened device tree. It should have provided a - * valid bootinfo structure which we'll use to build - * such a device tree ourselves. - * - * XXX We don't build a flattened device tree yet. - */ - memcpy(&bootinfo, *fwargsave, sizeof bootinfo); - - extern uint8_t dt_blob_start[]; - fdt_init(&dt_blob_start); - } - - proc0.p_cpu = &cpu_info[0]; - 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(); - - cpu_bootstrap(); - - /* - * Initialize pmap module. - */ - pmap_bootstrap(startkernel, endkernel); - - /* - * 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: - bcopy(&extint, (void *)EXC_EXI, (size_t)&extsize); - 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; - } - } - - syncicache((void *)EXC_RST, EXC_LAST - EXC_RST + 0x100); - - - /* - * Now enable translation (and machine checks/recoverable interrupts). - */ - pmap_enable_mmu(); - - /* - * use the memory provided by pmap_bootstrap for message buffer - */ - initmsgbuf(msgbuf_addr, MSGBUFSIZE); - - /* - * Look at arguments passed to us and compute boothowto. - */ - boothowto = RB_AUTOBOOT; - - /* - * Parse arg string. - */ - 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 - - /* - * Adjust base of internal memory mapped registers. - */ - mainbus_bus_space.bus_base = bootinfo.bi_immr_base; - - devio_ex = extent_create("devio", 0x80000000, 0xffffffff, M_DEVBUF, - (caddr_t)devio_ex_storage, sizeof(devio_ex_storage), - EX_NOCOALESCE|EX_NOWAIT); - - /* - * Initialize console. - */ - extern int comconsrate; - comconsfreq = 266666666; - comconsrate = 115200; - comconsaddr = 0x00004500; - comconsiot = &mainbus_bus_space; - - node = fdt_find_node("/chosen"); - if (node) { - char *console; - - fdt_node_property(node, "linux,stdout-path", &console); - node = fdt_find_node(console); - if (node) { - char *freq; - char *reg; - - if (fdt_node_property(node, "clock-frequency", &freq)) - comconsfreq = *(u_int32_t *)freq; - if (fdt_node_property(node, "reg", ®)) - comconsaddr = *(u_int32_t *)reg; - } - } - - consinit(); - -#ifdef DDB - if (boothowto & RB_KDB) - db_enter(); -#endif - - if (boothowto & RB_CONFIG) { -#ifdef BOOT_CONFIG - user_config(); -#else - printf("kernel does not support -c; continuing..\n"); -#endif - } -} - -void -dumpsys(void) -{ -} - -int cpu_imask[IPL_NUM]; - -int -lcsplx(int ipl) -{ - return spllower(ipl); -} - -/* - * Machine dependent startup code. - */ -void -cpu_startup() -{ - vaddr_t minaddr, maxaddr; - - proc0.p_addr = proc0paddr; - - printf("%s", version); - - printf("real mem = %lu (%luMB)\n", ptoa(physmem), - ptoa(physmem)/1024/1024); - - /* - * Allocate a submap for exec arguments. This map effectively - * limits the number of processes exec'ing at any time. - */ - minaddr = vm_map_min(kernel_map); - exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, 16 * NCARGS, - VM_MAP_PAGEABLE, FALSE, NULL); - - /* - * Allocate a submap for physio - */ - phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, - VM_PHYS_SIZE, 0, FALSE, NULL); - ppc_malloc_ok = 1; - - printf("avail mem = %lu (%luMB)\n", ptoa(uvmexp.free), - ptoa(uvmexp.free) / 1024 / 1024); - - /* - * Set up the buffers. - */ - bufinit(); - - devio_malloc_safe = 1; -} - -/* - * 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 *)p->p_p->ps_strings, &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, sigset_t mask, const siginfo_t *ksip) -{ - struct proc *p = curproc; - struct trapframe *tf; - struct sigframe *fp, frame; - struct sigacts *psp = p->p_p->ps_sigacts; - - bzero(&frame, sizeof(frame)); - frame.sf_signum = sig; - - tf = trapframe(p); - - /* - * Allocate stack space for signal handler. - */ - if ((p->p_sigstk.ss_flags & SS_DISABLE) == 0 && - !sigonstack(tf->fixreg[1]) && - (psp->ps_sigonstack & sigmask(sig))) - fp = (struct sigframe *) - trunc_page((vaddr_t)p->p_sigstk.ss_sp + p->p_sigstk.ss_size); - else - fp = (struct sigframe *)tf->fixreg[1]; - - fp = (struct sigframe *)((int)(fp - 1) & ~0xf); - - /* - * Generate signal context for SYS_sigreturn. - */ - 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; - frame.sf_si = *ksip; - } - frame.sf_sc.sc_cookie = (long)&fp->sf_sc ^ p->p_p->ps_sigcookie; - 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 : 0; - tf->fixreg[5] = (int)&fp->sf_sc; - tf->srr0 = p->p_p->ps_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_p->ps_emul->e_esigcode - - p->p_p->ps_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 ksc, *scp = SCARG(uap, sigcntxp); - struct trapframe *tf; - int error; - - if (PROC_PC(p) != p->p_p->ps_sigcoderet) { - sigexit(p, SIGILL); - return (EPERM); - } - - if ((error = copyin(scp, &ksc, sizeof ksc))) - return error; - - if (ksc.sc_cookie != ((long)scp ^ p->p_p->ps_sigcookie)) { - sigexit(p, SIGILL); - return (EFAULT); - } - - /* Prevent reuse of the sigcontext cookie */ - ksc.sc_cookie = 0; - (void)copyout(&ksc.sc_cookie, (caddr_t)scp + - offsetof(struct sigcontext, sc_cookie), sizeof (ksc.sc_cookie)); - - tf = trapframe(p); - if ((ksc.sc_frame.srr1 & PSL_USERSTATIC) != (tf->srr1 & PSL_USERSTATIC)) - return EINVAL; - bcopy(&ksc.sc_frame, tf, sizeof *tf); - p->p_sigmask = ksc.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_int_lower(oldp, oldlenp, newp, newlen, - &allowaperture)); - else - return (sysctl_int(oldp, oldlenp, newp, newlen, - &allowaperture)); -#else - return (sysctl_rdint(oldp, oldlenp, newp, 0)); -#endif - case CPU_ALTIVEC: - return (sysctl_rdint(oldp, oldlenp, newp, 0)); - default: - return EOPNOTSUPP; - } -} - -u_long dumpmag = 0x04959fca; /* 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. - */ -void dumpconf(void); - -void -dumpconf(void) -{ - int nblks; /* size of dump area */ - int i; - - if (dumpdev == NODEV || - (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) - return; - if (nblks <= ctod(1)) - return; - - /* Always skip the first block, in case there is a label there. */ - if (dumplo < ctod(1)) - dumplo = ctod(1); - - for (i = 0; i < ndumpmem; i++) - dumpsize = max(dumpsize, dumpmem[i].end); - - /* Put dump at end of partition, and make it fit. */ - if (dumpsize > dtoc(nblks - dumplo - 1)) - dumpsize = dtoc(nblks - dumplo - 1); - if (dumplo < nblks - ctod(dumpsize) - 1) - dumplo = nblks - ctod(dumpsize) - 1; - -} - -#define BYTES_PER_DUMP (PAGE_SIZE) /* must be a multiple of pagesize */ -static vaddr_t dumpspace; - -int -reserve_dumppages(caddr_t p) -{ - dumpspace = (vaddr_t)p; - return BYTES_PER_DUMP; -} - -/* - * Halt or reboot the machine after syncing/dumping according to howto. - */ -__dead void -boot(int howto) -{ - static int syncing; - - if ((howto & RB_RESET) != 0) - goto doreset; - - if (cold) { - if ((howto & RB_USERREQ) == 0) - howto |= RB_HALT; - goto haltsys; - } - - boothowto = howto; - if ((howto & RB_NOSYNC) == 0 && !syncing) { - syncing = 1; - vfs_shutdown(curproc); - - if ((howto & RB_TIMEBAD) == 0) { - resettodr(); - } else { - printf("WARNING: not updating battery clock\n"); - } - } - if_downall(); - - uvm_shutdown(); - splhigh(); - cold = 1; - - if ((howto & RB_DUMP) != 0) - dumpsys(); - -haltsys: - config_suspend_all(DVACT_POWERDOWN); - - if ((howto & RB_HALT) != 0) { - if ((howto & RB_POWERDOWN) != 0) { - ; - } - - printf("halted\n\n"); - for (;;) - continue; - /* NOTREACHED */ - } -doreset: - printf("rebooting\n\n"); - - { - volatile int32_t *reset; - int32_t v; - - reset = mapiodev(0xe0000900, 0x100); - reset[6] = 0x52535445; - v = reset[6]; - reset[7] = 0x00000002; - } - - printf("boot failed, spinning\n"); - for (;;) - continue; - /* NOTREACHED */ -} - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -void -signotify(struct proc *p) -{ - aston(p); -} - -/* 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; -} - -struct mem_region uboot_mem[2], uboot_avail[4]; - -void -ppc_mem_regions(struct mem_region **memp, struct mem_region **availp) -{ - uboot_mem[0].start = bootinfo.bi_memstart; - uboot_mem[0].size = bootinfo.bi_memsize; - - /* Reserve memory used for exception vectors. */ - uboot_avail[0] = uboot_mem[0]; - if (uboot_mem[0].start < EXC_LAST + 0x100) { - uboot_avail[0].size -= (EXC_LAST + 0x100 - uboot_mem[0].start); - uboot_avail[0].start = EXC_LAST + 0x100; - } - - *memp = uboot_mem; - *availp = uboot_avail; -} - -void -myetheraddr(u_char *cp) -{ - bcopy(bootinfo.bi_enetaddr, cp, sizeof bootinfo.bi_enetaddr); - bootinfo.bi_enetaddr[5]++; -} - -/* prototype for locore function */ -void cpu_switchto_asm(struct proc *oldproc, struct proc *newproc); - -void cpu_switchto(struct proc *oldproc, struct proc *newproc) -{ - cpu_switchto_asm(oldproc, newproc); -} diff --git a/sys/arch/socppc/socppc/mainbus.c b/sys/arch/socppc/socppc/mainbus.c deleted file mode 100644 index 805128a1b19..00000000000 --- a/sys/arch/socppc/socppc/mainbus.c +++ /dev/null @@ -1,118 +0,0 @@ -/* $OpenBSD: mainbus.c,v 1.6 2015/01/24 20:59:42 kettenis Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> - -#include <machine/autoconf.h> - -#include <dev/ofw/openfirm.h> - -int mainbus_match(struct device *, void *, void *); -void mainbus_attach(struct device *, struct device *, void *); - -struct cfattach mainbus_ca = { - sizeof(struct device), mainbus_match, mainbus_attach -}; - -struct cfdriver mainbus_cd = { - NULL, "mainbus", DV_DULL -}; - -struct ppc_bus_space mainbus_bus_space = { 0xff400000, 0x00100000, 0 }; - -struct powerpc_bus_dma_tag mainbus_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_alloc_range, - _dmamem_free, - _dmamem_map, - _dmamem_unmap, - _dmamem_mmap -}; - -int mainbus_print(void *, const char *); - -int -mainbus_match(struct device *parent, void *cfdata, void *aux) -{ - return (1); -} - -void -mainbus_attach(struct device *parent, struct device *self, void *aux) -{ - struct mainbus_attach_args ma; - char name[32]; - int node; - - printf("\n"); - - ncpusfound = 0; - node = OF_finddevice("/cpus"); - if (node != -1) { - for (node = OF_child(node); node != 0; node = OF_peer(node)) { - if (OF_getprop(node, "name", name, sizeof(name)) <= 0) - continue; - - bzero(&ma, sizeof(ma)); - ma.ma_name = name; - ma.ma_node = node; - config_found(self, &ma, mainbus_print); - ncpusfound++; - } - } - - for (node = OF_child(OF_peer(0)); node != 0; node = OF_peer(node)) { - if (OF_getprop(node, "name", name, sizeof(name)) <= 0) - continue; - - if (strcmp(name, "aliases") == 0 || - strcmp(name, "chosen") == 0 || - strcmp(name, "cpus") == 0 || - strcmp(name, "memory") == 0) - continue; - - bzero(&ma, sizeof(ma)); - ma.ma_iot = &mainbus_bus_space; - ma.ma_dmat = &mainbus_bus_dma_tag; - ma.ma_name = name; - ma.ma_node = node; - config_found(self, &ma, mainbus_print); - } -} - -int -mainbus_print(void *aux, const char *name) -{ - struct mainbus_attach_args *ma = aux; - - if (name) - printf("\"%s\" at %s", ma->ma_name, name); - - return (UNCONF); -} diff --git a/sys/arch/socppc/socppc/mem.c b/sys/arch/socppc/socppc/mem.c deleted file mode 100644 index 90abc1d6a0c..00000000000 --- a/sys/arch/socppc/socppc/mem.c +++ /dev/null @@ -1,184 +0,0 @@ -/* $OpenBSD: mem.c,v 1.9 2018/02/19 08:59:52 mpi 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/filio.h> -#include <sys/systm.h> -#include <sys/ioccom.h> -#include <sys/uio.h> -#include <sys/malloc.h> - -#include <machine/cpu.h> - -#include <uvm/uvm_extern.h> - -#include <machine/conf.h> - -int -mmopen(dev_t dev, int flag, int mode, struct proc *p) -{ - extern int allowkmem; - - switch (minor(dev)) { - case 0: - case 1: - if (securelevel <= 0 || allowkmem) - break; - return (EPERM); - case 2: - case 12: - break; -#ifdef xAPERTURE - case 4: - if (suser(p) != 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); -} - -int -mmclose(dev_t dev, int flag, int mode, struct proc *p) -{ -#ifdef xAPERTURE - if (minor(dev) == 4) - ap_open_count = 0; -#endif - return 0; -} - -int -mmrw(dev_t dev, struct uio *uio, int flags) -{ - vaddr_t v; - vsize_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 = ulmin(iov->iov_len, MAXPHYS); - error = uiomove((caddr_t)v, c, uio); - continue; - - /* minor device 2 is /dev/null */ - case 2: - if (uio->uio_rw == UIO_WRITE) - uio->uio_resid = 0; - return 0; - - /* minor device 12 is /dev/zero */ - case 12: - if (uio->uio_rw == UIO_WRITE) { - c = iov->iov_len; - break; - } - if (zeropage == NULL) - zeropage = malloc(PAGE_SIZE, M_TEMP, - M_WAITOK | M_ZERO); - c = ulmin(iov->iov_len, PAGE_SIZE); - error = uiomove(zeropage, c, uio); - continue; - - default: - return ENXIO; - } - if (error) - break; - iov->iov_base += 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); -} - -int -mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) -{ - switch (cmd) { - case FIONBIO: - case FIOASYNC: - /* handled by fd layer */ - return 0; - } - - return (EOPNOTSUPP); -} diff --git a/sys/arch/socppc/socppc/n1200.dts b/sys/arch/socppc/socppc/n1200.dts deleted file mode 100644 index e0f0c07466f..00000000000 --- a/sys/arch/socppc/socppc/n1200.dts +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) Mark Kettenis <kettenis@openbsd.org> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/dts-v1/; - -/ { - model = "Thecus N1200"; - #address-cells = <1>; - #size-cells = <1>; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - PowerPC,8347@0 { - device_type = "cpu"; - reg = <0x0>; - d-cache-line-size = <32>; - i-cache-line-size = <32>; - d-cache-size = <32768>; - i-cache-size = <32768>; - timebase-frequency = <66666666>; - bus-frequency = <0>; // XXX - clock-frequency = <266666666>; - }; - }; - - memory { - device_type = "memory"; - reg = <0x00000000 0x08000000>; // 128MB at 0 - }; - - soc8347@e0000000 { - #address-cells = <1>; - #size-cells = <1>; - device_type = "soc"; - compatible = "simple-bus"; - ranges = <0x0 0xe0000000 0x00100000>; - reg = <0xe0000000 0x00000200>; - bus-frequency = <0>; - - wdt@200 { - device_type = "watchdog"; - compatible = "mpc83xx_wdt"; - reg = <0x200 0x100>; - }; - - i2c@3000 { - #address-cells = <1>; - #size-cells = <0>; - cell-index = <0>; - compatible = "fsl-i2c"; - reg = <0x3000 0x100>; - interrupts = <14 0x8>; - interrupt-parent = <&ipic>; - dfsrr; - - rtc@32 { - compatible = "ricoh,rs5c372a"; - reg = <0x32>; - }; - - fan@2e { - compatible = "fintek,f75375"; - reg = <0x2e>; - }; - }; - - i2c@3100 { - #address-cells = <1>; - #size-cells = <0>; - cell-index = <1>; - compatible = "fsl-i2c"; - reg = <0x3100 0x100>; - interrupts = <15 0x8>; - interrupt-parent = <&ipic>; - dfsrr; - }; - - usb@22000 { - compatible = "fsl-usb2-mph"; - reg = <0x22000 0x1000>; - #address-cells = <1>; - #size-cells = <0>; - interrupt-parent = <&ipic>; - interrupts = <39 0x8>; - phy_type = "ulpi"; - port0; - port1; - }; - - ethernet@24000 { - #address-cells = <1>; - #size-cells = <1>; - cell-index = <0>; - device_type = "network"; - model = "TSEC"; - compatible = "gianfar"; - reg = <0x24000 0x1000>; - ranges = <0x0 0x24000 0x1000>; - local-mac-address = [ 00 00 00 00 00 00 ]; - interrupts = <32 0x8 33 0x8 34 0x8>; - interrupt-parent = <&ipic>; - phy-handle = <&phy0>; - - mdio@520 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "fsl,gianfar-mdio"; - reg = <0x520 0x20>; - - phy0: ethernet-phy@11 { - reg = <0x11>; - device_type = "ethernet-phy"; - }; - - phy1: ethernet-phy@5 { - reg = <0x5>; - device_type = "ethernet-phy"; - }; - }; - }; - - ethernet@25000 { - #address-cells = <1>; - #size-cells = <1>; - cell-index = <1>; - device_type = "network"; - model = "TSEC"; - compatible = "gianfar"; - reg = <0x25000 0x1000>; - ranges = <0x0 0x25000 0x1000>; - local-mac-address = [ 00 00 00 00 00 00 ]; - interrupts = <35 0x8 36 0x8 37 0x8>; - interrupt-parent = <&ipic>; - phy-handle = <&phy1>; - }; - - serial0: serial@4500 { - cell-index = <0>; - device_type = "serial"; - compatible = "ns16550"; - reg = <0x4500 0x100>; - clock-frequency = <266666666>; - interrupts = <9 0x8>; - interrupt-parent = <&ipic>; - }; - - ipic: pic@700 { - interrupt-controller; - #address-cells = <0>; - #interrupt-cells = <2>; - reg = <0x700 0x100>; - device_type = "ipic"; - }; - }; - - pci@e0008500 { - cell-index = <1>; - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; - interrupt-map = <0x8000 0x0 0x0 0x1 &ipic 20 0x8>; - interrupt-parent = <&ipic>; - interrupts = <66 0x8>; - bus-range = <0 0>; - ranges = <0x02000000 0x0 0x80000000 0x80000000 0x0 0x20000000 - 0x01000000 0x0 0x00000000 0xe2000000 0x0 0x00100000>; - clock-frequency = <66666666>; - #interrupt-cells = <1>; - #size-cells = <2>; - #address-cells = <3>; - reg = <0xe0008500 0x100 - 0xe0008300 0x8>; - compatible = "fsl,mpc8349-pci"; - device_type = "pci"; - }; - - chosen { - linux,stdout-path = &serial0; - }; -}; diff --git a/sys/arch/socppc/socppc/n1200_dts.S b/sys/arch/socppc/socppc/n1200_dts.S deleted file mode 100644 index 351614be9c0..00000000000 --- a/sys/arch/socppc/socppc/n1200_dts.S +++ /dev/null @@ -1,1052 +0,0 @@ -/* autogenerated by dtc, do not edit */ - - .globl dt_blob_start -dt_blob_start: -_dt_blob_start: - .globl dt_header -dt_header: -_dt_header: - /* magic */ - .byte 0xd0; .byte 0x0d; .byte 0xfe; .byte 0xed - /* totalsize */ - .byte ((_dt_blob_abs_end - _dt_blob_start) >> 24) & 0xff - .byte ((_dt_blob_abs_end - _dt_blob_start) >> 16) & 0xff - .byte ((_dt_blob_abs_end - _dt_blob_start) >> 8) & 0xff - .byte (_dt_blob_abs_end - _dt_blob_start) & 0xff - /* off_dt_struct */ - .byte ((_dt_struct_start - _dt_blob_start) >> 24) & 0xff - .byte ((_dt_struct_start - _dt_blob_start) >> 16) & 0xff - .byte ((_dt_struct_start - _dt_blob_start) >> 8) & 0xff - .byte (_dt_struct_start - _dt_blob_start) & 0xff - /* off_dt_strings */ - .byte ((_dt_strings_start - _dt_blob_start) >> 24) & 0xff - .byte ((_dt_strings_start - _dt_blob_start) >> 16) & 0xff - .byte ((_dt_strings_start - _dt_blob_start) >> 8) & 0xff - .byte (_dt_strings_start - _dt_blob_start) & 0xff - /* off_mem_rsvmap */ - .byte ((_dt_reserve_map - _dt_blob_start) >> 24) & 0xff - .byte ((_dt_reserve_map - _dt_blob_start) >> 16) & 0xff - .byte ((_dt_reserve_map - _dt_blob_start) >> 8) & 0xff - .byte (_dt_reserve_map - _dt_blob_start) & 0xff - /* version */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x10 - /* last_comp_version */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x10 - /* boot_cpuid_phys */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - /* size_dt_strings */ - .byte ((_dt_strings_end - _dt_strings_start) >> 24) & 0xff - .byte ((_dt_strings_end - _dt_strings_start) >> 16) & 0xff - .byte ((_dt_strings_end - _dt_strings_start) >> 8) & 0xff - .byte (_dt_strings_end - _dt_strings_start) & 0xff - .balign 8 - .globl dt_reserve_map -dt_reserve_map: -_dt_reserve_map: -/* Memory reserve map from source file */ - .long 0, 0 - .long 0, 0 - .globl dt_struct_start -dt_struct_start: -_dt_struct_start: - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x0d - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x54; .byte 0x68; .byte 0x65; .byte 0x63 - .byte 0x75; .byte 0x73; .byte 0x20; .byte 0x4e - .byte 0x31; .byte 0x32; .byte 0x30; .byte 0x30 - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x06 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x15 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "cpus" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x06 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x15 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "PowerPC,8347@0" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x21 - .byte 0x63; .byte 0x70; .byte 0x75; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x31 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x20 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x43 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x20 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x55 - .byte 0x00; .byte 0x00; .byte 0x80; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x62 - .byte 0x00; .byte 0x00; .byte 0x80; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x6f - .byte 0x03; .byte 0xf9; .byte 0x40; .byte 0xaa - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x82 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x90 - .byte 0x0f; .byte 0xe5; .byte 0x02; .byte 0xaa - .balign 4 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "memory" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x07 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x21 - .byte 0x6d; .byte 0x65; .byte 0x6d; .byte 0x6f - .byte 0x72 - .byte 0x79 - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x08; .byte 0x00; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "soc8347@e0000000" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x06 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x15 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x21 - .byte 0x73; .byte 0x6f; .byte 0x63; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x0b - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xa0 - .byte 0x73; .byte 0x69; .byte 0x6d; .byte 0x70 - .byte 0x6c; .byte 0x65; .byte 0x2d; .byte 0x62 - .byte 0x75 - .byte 0x73 - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x0c - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xab - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0xe0; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x10; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0xe0; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x02; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x82 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "wdt@200" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x09 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x21 - .byte 0x77; .byte 0x61; .byte 0x74; .byte 0x63 - .byte 0x68; .byte 0x64; .byte 0x6f; .byte 0x67 - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x0c - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xa0 - .byte 0x6d; .byte 0x70; .byte 0x63; .byte 0x38 - .byte 0x33; .byte 0x78; .byte 0x78; .byte 0x5f - .byte 0x77; .byte 0x64; .byte 0x74; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0x00; .byte 0x00; .byte 0x02; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x00 - .balign 4 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "i2c@3000" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x06 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x15 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xb2 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xa0 - .byte 0x66; .byte 0x73; .byte 0x6c; .byte 0x2d - .byte 0x69; .byte 0x32; .byte 0x63; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0x00; .byte 0x00; .byte 0x30; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xbd - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x0e - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xc8 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xd9 - .balign 4 - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "rtc@32" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x0f - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xa0 - .byte 0x72; .byte 0x69; .byte 0x63; .byte 0x6f - .byte 0x68; .byte 0x2c; .byte 0x72; .byte 0x73 - .byte 0x35; .byte 0x63; .byte 0x33; .byte 0x37 - .byte 0x32 - .byte 0x61 - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x32 - .balign 4 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "fan@2e" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x0e - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xa0 - .byte 0x66; .byte 0x69; .byte 0x6e; .byte 0x74 - .byte 0x65; .byte 0x6b; .byte 0x2c; .byte 0x66 - .byte 0x37; .byte 0x35; .byte 0x33; .byte 0x37 - .byte 0x35 - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2e - .balign 4 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "i2c@3100" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x06 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x15 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xb2 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xa0 - .byte 0x66; .byte 0x73; .byte 0x6c; .byte 0x2d - .byte 0x69; .byte 0x32; .byte 0x63; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0x00; .byte 0x00; .byte 0x31; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xbd - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x0f - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xc8 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xd9 - .balign 4 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "usb@22000" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x0d - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xa0 - .byte 0x66; .byte 0x73; .byte 0x6c; .byte 0x2d - .byte 0x75; .byte 0x73; .byte 0x62; .byte 0x32 - .byte 0x2d; .byte 0x6d; .byte 0x70; .byte 0x68 - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0x00; .byte 0x02; .byte 0x20; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x10; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x06 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x15 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xc8 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xbd - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x27 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x05 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xdf - .byte 0x75; .byte 0x6c; .byte 0x70; .byte 0x69 - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xe8 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xee - .balign 4 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "ethernet@24000" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x06 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x15 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xb2 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x21 - .byte 0x6e; .byte 0x65; .byte 0x74; .byte 0x77 - .byte 0x6f; .byte 0x72; .byte 0x6b; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x05 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x54; .byte 0x53; .byte 0x45; .byte 0x43 - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xa0 - .byte 0x67; .byte 0x69; .byte 0x61; .byte 0x6e - .byte 0x66; .byte 0x61; .byte 0x72; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0x00; .byte 0x02; .byte 0x40; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x10; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x0c - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xab - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x02; .byte 0x40; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x10; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x06 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xf4 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x0 - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x18 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xbd - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x20 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x21 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x22 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xc8 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x06 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - .balign 4 - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "mdio@520" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x06 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x15 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x11 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xa0 - .byte 0x66; .byte 0x73; .byte 0x6c; .byte 0x2c - .byte 0x67; .byte 0x69; .byte 0x61; .byte 0x6e - .byte 0x66; .byte 0x61; .byte 0x72; .byte 0x2d - .byte 0x6d; .byte 0x64; .byte 0x69; .byte 0x6f - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0x00; .byte 0x00; .byte 0x05; .byte 0x20 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x20 - .balign 4 - .globl phy0 -phy0: - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "ethernet-phy@11" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x11 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x0d - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x21 - .byte 0x65; .byte 0x74; .byte 0x68; .byte 0x65 - .byte 0x72; .byte 0x6e; .byte 0x65; .byte 0x74 - .byte 0x2d; .byte 0x70; .byte 0x68; .byte 0x79 - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x11 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - .balign 4 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - .globl phy0_end -phy0_end: - .globl phy1 -phy1: - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "ethernet-phy@5" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x05 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x0d - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x21 - .byte 0x65; .byte 0x74; .byte 0x68; .byte 0x65 - .byte 0x72; .byte 0x6e; .byte 0x65; .byte 0x74 - .byte 0x2d; .byte 0x70; .byte 0x68; .byte 0x79 - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x11 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .balign 4 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - .globl phy1_end -phy1_end: - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "ethernet@25000" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x06 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x15 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xb2 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x21 - .byte 0x6e; .byte 0x65; .byte 0x74; .byte 0x77 - .byte 0x6f; .byte 0x72; .byte 0x6b; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x05 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x54; .byte 0x53; .byte 0x45; .byte 0x43 - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xa0 - .byte 0x67; .byte 0x69; .byte 0x61; .byte 0x6e - .byte 0x66; .byte 0x61; .byte 0x72; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0x00; .byte 0x02; .byte 0x50; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x10; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x0c - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xab - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x02; .byte 0x50; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x10; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x06 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xf4 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x0 - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x18 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xbd - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x23 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x24 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x25 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xc8 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x06 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .balign 4 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - .globl serial0 -serial0: - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "serial@4500" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xb2 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x07 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x21 - .byte 0x73; .byte 0x65; .byte 0x72; .byte 0x69 - .byte 0x61 - .byte 0x6c - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xa0 - .byte 0x6e; .byte 0x73; .byte 0x31; .byte 0x36 - .byte 0x35; .byte 0x35; .byte 0x30; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0x00; .byte 0x00; .byte 0x45; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x90 - .byte 0x0f; .byte 0xe5; .byte 0x02; .byte 0xaa - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xbd - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x09 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xc8 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - .globl serial0_end -serial0_end: - .globl ipic -ipic: - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "pic@700" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x1f - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x06 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x34 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0x00; .byte 0x00; .byte 0x07; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x05 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x21 - .byte 0x69; .byte 0x70; .byte 0x69; .byte 0x63 - .byte 0x0 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x11 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - .globl ipic_end -ipic_end: - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "pci@e0008500" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xb2 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x10 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x45 - .byte 0x00; .byte 0x00; .byte 0xf8; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x07 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x1c - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x58 - .byte 0x00; .byte 0x00; .byte 0x80; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x14 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xc8 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xbd - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x42 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x66 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x30 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xab - .byte 0x02; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x80; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x80; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x20; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x01; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0xe2; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x00 - .byte 0x00; .byte 0x10; .byte 0x00; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x90 - .byte 0x03; .byte 0xf9; .byte 0x40; .byte 0xaa - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x34 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x15 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x06 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x10 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x2d - .byte 0xe0; .byte 0x00; .byte 0x85; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x00 - .byte 0xe0; .byte 0x00; .byte 0x83; .byte 0x00 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x08 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x10 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0xa0 - .byte 0x66; .byte 0x73; .byte 0x6c; .byte 0x2c - .byte 0x6d; .byte 0x70; .byte 0x63; .byte 0x38 - .byte 0x33; .byte 0x34; .byte 0x39; .byte 0x2d - .byte 0x70; .byte 0x63; .byte 0x69; .byte 0x00 - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x04 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x21 - .byte 0x70; .byte 0x63; .byte 0x69; .byte 0x00 - .balign 4 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - /* FDT_BEGIN_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x01 - .string "chosen" - .balign 4 - /* FDT_PROP */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x03 - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x1e - .byte 0x00; .byte 0x00; .byte 0x01; .byte 0x70 - .byte 0x2f; .byte 0x73; .byte 0x6f; .byte 0x63 - .byte 0x38; .byte 0x33; .byte 0x34; .byte 0x37 - .byte 0x40; .byte 0x65; .byte 0x30; .byte 0x30 - .byte 0x30; .byte 0x30; .byte 0x30; .byte 0x30 - .byte 0x30; .byte 0x2f; .byte 0x73; .byte 0x65 - .byte 0x72; .byte 0x69; .byte 0x61; .byte 0x6c - .byte 0x40; .byte 0x34; .byte 0x35; .byte 0x30 - .byte 0x30 - .byte 0x0 - .balign 4 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - /* FDT_END_NODE */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x02 - /* FDT_END */ - .byte 0x00; .byte 0x00; .byte 0x00; .byte 0x09 - .globl dt_struct_end -dt_struct_end: -_dt_struct_end: - .globl dt_strings_start -dt_strings_start: -_dt_strings_start: - .string "model" - .string "#address-cells" - .string "#size-cells" - .string "device_type" - .string "reg" - .string "d-cache-line-size" - .string "i-cache-line-size" - .string "d-cache-size" - .string "i-cache-size" - .string "timebase-frequency" - .string "bus-frequency" - .string "clock-frequency" - .string "compatible" - .string "ranges" - .string "cell-index" - .string "interrupts" - .string "interrupt-parent" - .string "dfsrr" - .string "phy_type" - .string "port0" - .string "port1" - .string "local-mac-address" - .string "phy-handle" - .string "linux,phandle" - .string "interrupt-controller" - .string "#interrupt-cells" - .string "interrupt-map-mask" - .string "interrupt-map" - .string "bus-range" - .string "linux,stdout-path" - .globl dt_strings_end -dt_strings_end: -_dt_strings_end: - .globl dt_blob_end -dt_blob_end: -_dt_blob_end: - .globl dt_blob_abs_end -dt_blob_abs_end: -_dt_blob_abs_end: diff --git a/sys/arch/socppc/stand/Makefile b/sys/arch/socppc/stand/Makefile deleted file mode 100644 index 0e65f68daf7..00000000000 --- a/sys/arch/socppc/stand/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $OpenBSD: Makefile,v 1.4 2010/02/15 13:44:57 kettenis Exp $ - -SUBDIR= mkboot mbr boot - -.include <bsd.subdir.mk> diff --git a/sys/arch/socppc/stand/Makefile.inc b/sys/arch/socppc/stand/Makefile.inc deleted file mode 100644 index 94b5969b0cc..00000000000 --- a/sys/arch/socppc/stand/Makefile.inc +++ /dev/null @@ -1,10 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.3 2008/06/09 15:01:56 deraadt Exp $ - -.if exists(${STANDIR}/mkboot/mkboot) -MKBOOT=${STANDIR}/mkboot/mkboot -.else -MKBOOT=${STANDIR}/mkboot/${__objdir}/mkboot -.endif - -BINDIR=/usr/mdec -MANSUBDIR=socppc diff --git a/sys/arch/socppc/stand/boot/Makefile b/sys/arch/socppc/stand/boot/Makefile deleted file mode 100644 index ea8c0af367a..00000000000 --- a/sys/arch/socppc/stand/boot/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -# $OpenBSD: Makefile,v 1.18 2016/11/06 16:42:00 tb Exp $ - -.include "${.CURDIR}/../Makefile.inc" - -MAN= boot.8 - -.if ${MACHINE} == "socppc" -PROG= boot -S= ${.CURDIR}/../../../.. - -.PATH: ${S}/stand/boot -.PATH: ${S}/lib/libsa - -CPPFLAGS+= -D_STANDALONE -CPPFLAGS+= -nostdinc -I../.. -I. -I${.CURDIR} -I${S} -CPPFLAGS+= -DCONADDR=0xe0004500UL -DCONSPEED=115200 -CPPFLAGS+= -DNS16550_FREQ=266000000 -DMACHINE_CMD=cmd_machine - -COPTS+= -ffreestanding -fno-stack-protector -ffixed-r29 -msoft-float -COPTS+= -fno-pie - -SRCS= start.S -SRCS+= boot.c cmd.c vars.c -SRCS+= conf.c devopen.c exec.c machdep.c dev_socppc.c time.c -SRCS+= clock.c ns16550.c wd.c wdc.c pciide.c wdc_obio.c fdt.c -SRCS+= ctime.c strtol.c cmd_socppc.c - -.PATH: ${S}/lib/libkern/arch/powerpc ${S}/lib/libkern -SRCS+= getchar.c putchar.c strlcpy.c strlen.c ashrdi3.c moddi3.c - -### find out what to use for libz -Z_AS= library -.include "${S}/lib/libz/Makefile.inc" -LIBZ= ${ZLIB} - -### find out what to use for libsa -SA_AS= library -SAREL= -SA_ZLIB= yes -USE_LOADFILE= yes -.include "${S}/lib/libsa/Makefile.inc" -LIBSA= ${SALIB} - -STANDIR= ${.CURDIR}/.. - -RELOC= 0x100000 -LDFLAGS= -Ttext ${RELOC} -nopie -znorelro -OBJCOPY?= objcopy - -${PROG}: ${OBJS} ${LIBSA} ${LIBZ} - ${LD} ${LDFLAGS} -o ${PROG}.elf ${OBJS} ${LIBSA} ${LIBZ} - ${OBJCOPY} -O binary ${PROG}.elf ${PROG}.bin - ${MKBOOT} -e ${RELOC} -l ${RELOC} ${PROG}.bin ${PROG} - -realinstall: - ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \ - -m ${BINMODE} ${PROG} ${DESTDIR}${BINDIR}/${PROG} - ${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} -o ${BINOWN} -g ${BINGRP} \ - -m ${BINMODE} ${PROG}.elf ${DESTDIR}${BINDIR}/${PROG}.elf - -.if !make(clean) && !make(cleandir) && !make(includes) && !make(obj) -.BEGIN: - @([ -h machine ] || ln -s ${.CURDIR}/../../../${MACHINE}/include machine) - @([ -h powerpc ] || ln -s ${.CURDIR}/../../../powerpc/include powerpc) -.NOPATH: machine powerpc -CLEANFILES+= machine powerpc -.endif - -.else -NOPROG= -.endif - -.include <bsd.prog.mk> diff --git a/sys/arch/socppc/stand/boot/boot.8 b/sys/arch/socppc/stand/boot/boot.8 deleted file mode 100644 index 5d286b402ff..00000000000 --- a/sys/arch/socppc/stand/boot/boot.8 +++ /dev/null @@ -1,285 +0,0 @@ -.\" $OpenBSD: boot.8,v 1.9 2019/01/02 21:20:41 anton Exp $ -.\" -.\" Copyright (c) 1997-2001 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. -.\" -.\" -.Dd $Mdocdate: January 2 2019 $ -.Dt BOOT 8 socppc -.Os -.Sh NAME -.Nm boot , -.Nm boot.conf -.Nd socppc-specific bootstrap -.Sh DESCRIPTION -The main purpose of this program is to load the system kernel. -.Pp -This program is loaded by the -firmware -and provides a convenient way to load the kernel. -This program acts as an enhanced boot monitor for socppc systems, providing -a common interface for the kernel to start from. -.Pp -Basic operations include: -.Pp -.Bl -bullet -compact -.It -Loading kernels from hard disk. -.It -Loading kernels compressed by -.Xr gzip 1 . -.It -Providing an interactive command line. -.El -.Pp -The sequence of its operation is as follows: initialization, -parsing the configuration file, then an interactive command line. -While at the command line you have 5 seconds to type any commands, if needed. -If time expires, the kernel will be loaded according to -the current variable settings (see the -.Ic set -command). -Each time a kernel load fails, the timeout is increased by one second. -The sequence of -.Nm -operations is as follows: -.Bl -enum -.It -If the file -.Pa /etc/boot.conf -.\" XXX BEWARE! wd0 only, so text change... -.\" exists on the filesystem -.\" .Nm -.\" was loaded from, open and parse it. -exists on the filesystem in slice -.Sq a -on the first disk drive -.Pq wd0 , -open and parse it. -Lines beginning with the -.Sq # -character, -as well as whitespace at the beginning of lines, -are ignored. -The file may contain any commands -.Nm -accepts at the interactive prompt. -Though default settings usually suffice, they can be changed here. -.\" XXX CHECK_SKIP_CONF is not defined... -.\" .Pp -.\" .Pa boot.conf -.\" processing can be skipped by holding down either Control key as -.\" .Nm -.\" starts. -.It -The header line -.Pp -.Dl >> OpenBSD/socppc BOOT [x.xx] -.Pp -is displayed to the active console, where -.Ar x.xx -is the version number of the -.Nm -program, followed by the -.Pp -.Dl boot> -.Pp -prompt, which means you are in interactive mode and may enter commands. -If you do not, -.Nm -will proceed to load the kernel with the current parameters after the -timeout period has expired. -.El -.Pp -By default, -.Nm -attempts to load the kernel executable -.Pa /bsd . -If it fails to find the kernel and no alternative kernel image has -been specified, the system will be unable to boot. -.Sh COMMANDS -The following commands are accepted at the -.Nm -prompt: -.Bl -tag -width shorten -.It Ic boot Oo Oo Ar device : Oc Ns Ar image Oc Op Fl acds -Boots the specified kernel image -with any options given. -If -.Ar device -or -.Ar image -are omitted, values from -.Nm -variables will be used. -.Pp -The only bootable devices, at the moment, are IDE devices connected to -the internal controller; -they are detected as -.Sq wd -devices. -Therefore, to boot kernel -.Pa /bsd -from slice -.Sq a -on the first hard drive, -specify -.Dq boot wd0a:/bsd . -.Bl -tag -width _a_ -.It Fl a -Causes the kernel to ask for the -.Nm root -device to use. -.It Fl c -Causes the kernel to go into -.Xr boot_config 8 -before performing -.Xr autoconf 4 -procedures. -.It Fl d -Causes the kernel to drop into -.Xr ddb 4 -at the earliest convenient point. -.It Fl s -Causes the kernel to boot single-user. -.El -.It Ic echo Op Ar args -Displays -.Ar args -on the console device. -.It Ic help -Prints a list of available commands. -.It Ic ls Op Ar directory -Prints contents of the specified -.Ar directory -in long format including: attributes and file type, owner, group, -size, filename. -.It Ic reboot -Reboots the machine by initiating a warm boot procedure. -.It Ic set Op Ar varname Op Ar value -If invoked without arguments, prints a list of variables and their values. -If only -.Ar varname -is specified, displays contents of that variable. -If -.Ar varname -and -.Ar value -are both specified, sets that variable to the given value. -Variables include: -.Pp -.Bl -tag -compact -width boothow -.It Ic addr -Address at which to load the kernel. -.It Ic debug -Debug flag if -.Nm -was compiled with DEBUG defined. -.It Ic device -Boot device name (e.g., -.Li wd0a , -.Li wd1a ) . -.It Ic howto -Options to pass to the loaded kernel. -.It Ic image -File name containing the kernel image. -.It Ic timeout -Number of seconds boot will wait for human intervention before -booting the default kernel image. -.\" .It Nm tty -.\" Active console device name (e.g., -.\" .Li com0 ) . -.\" Currently, only the first serial port -.\" .Pq Li com0 -.\" is supported for console on socppc. -.El -.\" XXX ignored, so don't document it. -.\" .It stty Op Ar device Op Ar speed -.\" Displays or sets the -.\" .Ar speed -.\" for a console -.\" .Ar device . -.\" If changing the baudrate for the currently active console, -.\" .Nm -.\" offers you five seconds of grace time before committing the change -.\" to allow you to change your terminal's speed to match. -.\" If changing speed -.\" .Em not -.\" for the active console, the baudrate is set for the -.\" .Em next -.\" time you switch to a serial console. -.\" .Pp -.\" The default baudrate is 9600bps. -.It Ic time -Displays system time and date. -.El -.Sh FILES -.Bl -tag -width /etc/boot.conf -compact -.It Pa /usr/mdec/boot -system bootstrap -.It Pa /etc/boot.conf -system bootstrap's startup file -.It Pa /bsd -kernel image -.It Pa /bsd.rd -kernel image for installation/recovery -.El -.Sh EXAMPLES -Boot the default kernel: -.Pp -.Dl boot> boot -.Pp -Remove the 5 second pause at boot-time permanently, causing -.Nm -to load the kernel immediately without prompting: -.Pp -.Dl # echo \&"boot\&" > /etc/boot.conf -.Pp -Boot the kernel named -.Pa /bsd -from the second hard disk in -.Dq User Kernel Configuration -mode (see -.Xr boot_config 8 ) . -This mechanism allows for the explicit enabling and disabling of devices -during the current boot sequence, as well as the modification -of device parameters. -Once booted, such changes can be made permanent by using -.Xr config 8 Ns 's -.Fl e -option. -.Pp -.Dl boot> boot wd1a:/bsd -c -.Sh SEE ALSO -.Xr gzip 1 , -.Xr autoconf 4 , -.Xr ddb 4 , -.Xr boot_config 8 , -.Xr fdisk 8 , -.Xr reboot 8 -.Sh HISTORY -This program was written by Michael Shalayeff for -.Ox 2.1 -on the i386 platform, and was later ported to the socppc platform for -.Ox 4.4 . diff --git a/sys/arch/socppc/stand/boot/clock.c b/sys/arch/socppc/stand/boot/clock.c deleted file mode 100644 index e3a43be295e..00000000000 --- a/sys/arch/socppc/stand/boot/clock.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $OpenBSD: clock.c,v 1.2 2008/06/26 05:42:13 ray Exp $ */ -/* $NetBSD: clock.c,v 1.1 2003/06/25 17:24:22 cdi Exp $ */ - -/*- - * Copyright (c) 2003 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Manuel Bouyer. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/types.h> - -#include "libsa.h" - -#define DELAY_CALIBRATE 1000 - -void -delay(int ms) -{ - /* - * XXX need *real* clock calibration. - */ - volatile register int N = ms * DELAY_CALIBRATE; - for (; --N;) - ; -} diff --git a/sys/arch/socppc/stand/boot/cmd_socppc.c b/sys/arch/socppc/stand/boot/cmd_socppc.c deleted file mode 100644 index 3060f6e68bc..00000000000 --- a/sys/arch/socppc/stand/boot/cmd_socppc.c +++ /dev/null @@ -1,40 +0,0 @@ -/* $OpenBSD: cmd_socppc.c,v 1.1 2009/09/11 17:45:01 dms Exp $ */ - -/* - * Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/param.h> -#include "fdt.h" -#include "stand/boot/cmd.h" - -int Xfdt(void); -int Xbats(void); - -const struct cmd_table cmd_machine[] = { - { "fdt", CMDT_CMD, Xfdt }, - { NULL, 0 } -}; - -int -Xfdt(void) -{ - extern int fdtaddrsave; - if (fdtaddrsave) - fdt_print_tree(); - else - printf("FDT blob not available\n"); - return 0; -} diff --git a/sys/arch/socppc/stand/boot/conf.c b/sys/arch/socppc/stand/boot/conf.c deleted file mode 100644 index e4d2ee06fda..00000000000 --- a/sys/arch/socppc/stand/boot/conf.c +++ /dev/null @@ -1,69 +0,0 @@ -/* $OpenBSD: conf.c,v 1.10 2019/04/10 04:19:32 deraadt Exp $ */ -/* $NetBSD: conf.c,v 1.4 2005/12/11 12:17:06 christos Exp $ */ - -/* - * Copyright (c) 1982, 1986, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)conf.c 8.1 (Berkeley) 6/10/93 - */ - -#include <sys/param.h> - -#include <dev/cons.h> - -#include "libsa.h" -#include <lib/libsa/ufs.h> - -const char version[] = "1.4"; -int debug = 0; - -/* - * Device configuration - */ -struct devsw devsw[] = { - { "wd", wdstrategy, wdopen, wdclose, noioctl }, -}; -int ndevs = nitems(devsw); - -/* - * Filesystem configuration - */ -struct fs_ops file_system[] = { - { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, - ufs_stat, ufs_readdir } -}; -int nfsys = nitems(file_system); - -/* - * Console configuration - */ -struct consdev constab[] = { - { com_probe, com_init, com_getc, com_putc }, - { NULL } -}; -struct consdev *cn_tab; diff --git a/sys/arch/socppc/stand/boot/dev_socppc.c b/sys/arch/socppc/stand/boot/dev_socppc.c deleted file mode 100644 index 7cf9401c51e..00000000000 --- a/sys/arch/socppc/stand/boot/dev_socppc.c +++ /dev/null @@ -1,67 +0,0 @@ -/* $OpenBSD: dev_socppc.c,v 1.4 2014/07/13 09:26:08 jasper Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/param.h> -#include <dev/cons.h> - -#include "libsa.h" - -const char cdevs[][4] = { - "cn", "", "", "", "", "", "", "", - "", "", "", "", "com" -}; -const int ncdevs = nitems(cdevs); - -void -devboot(dev_t dev, char *p) -{ - strlcpy(p, "wd0a", 5); -} - -int -cnspeed(dev_t dev, int sp) -{ - return CONSPEED; -} - -char ttyname_buf[8]; - -char * -ttyname(int fd) -{ - snprintf(ttyname_buf, sizeof ttyname_buf, "%s%d", - cdevs[major(cn_tab->cn_dev)], minor(cn_tab->cn_dev)); - - return ttyname_buf; -} - -dev_t -ttydev(char *name) -{ - int i, unit = -1; - char *no = name + strlen(name) - 1; - - while (no >= name && *no >= '0' && *no <= '9') - unit = (unit < 0 ? 0 : (unit * 10)) + *no-- - '0'; - if (no < name || unit < 0) - return NODEV; - for (i = 0; i < ncdevs; i++) - if (strncmp(name, cdevs[i], no - name + 1) == 0) - return (makedev(i, unit)); - return NODEV; -} diff --git a/sys/arch/socppc/stand/boot/devopen.c b/sys/arch/socppc/stand/boot/devopen.c deleted file mode 100644 index 801f390ec73..00000000000 --- a/sys/arch/socppc/stand/boot/devopen.c +++ /dev/null @@ -1,122 +0,0 @@ -/* $OpenBSD: devopen.c,v 1.2 2008/06/26 05:42:13 ray Exp $ */ -/* $NetBSD: devopen.c,v 1.1 2003/06/25 17:24:22 cdi Exp $ */ - -/*- - * Copyright (c) 2003 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Rolf Grossmann. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "libsa.h" - -#define MAXDEVNAME 16 - -/* - * Parse a device spec. - * - * [A-Za-z]*[0-9]*[A-Za-z]:file - * dev uint part - */ -int -devparse(const char *fname, int *dev, int *unit, int *part, const char **file) -{ - const char *s; - - *unit = 0; /* default to wd0a */ - *part = 0; - *dev = 0; - - s = strchr(fname, ':'); - if (s != NULL) { - int devlen; - int i, u, p; - struct devsw *dp; - char devname[MAXDEVNAME]; - - devlen = s - fname; - if (devlen > MAXDEVNAME) - return (EINVAL); - - /* extract device name */ - for (i = 0; isalpha(fname[i]) && (i < devlen); i++) - devname[i] = fname[i]; - devname[i] = 0; - - if (!isdigit(fname[i])) - return (EUNIT); - - /* device number */ - for (u = 0; isdigit(fname[i]) && (i < devlen); i++) - u = u * 10 + (fname[i] - '0'); - - if (!isalpha(fname[i])) - return (EPART); - - /* partition number */ - if (i < devlen) - p = fname[i++] - 'a'; - - if (i != devlen) - return (ENXIO); - - /* check device name */ - for (dp = devsw, i = 0; i < ndevs; dp++, i++) { - if (dp->dv_name && !strcmp(devname, dp->dv_name)) - break; - } - - if (i >= ndevs) - return (ENXIO); - - *unit = u; - *part = p; - *dev = i; - fname = ++s; - } - - *file = fname; - - return (0); -} - -int -devopen(struct open_file *f, const char *fname, char **file) -{ - struct devsw *dp; - int dev, unit, part, error; - - error = devparse(fname, &dev, &unit, &part, (const char **)file); - if (error) - return (error); - - dp = &devsw[dev]; - if ((void *)dp->dv_open == (void *)nodev) - return (ENXIO); - - f->f_dev = dp; - - return (*dp->dv_open)(f, unit, part); -} diff --git a/sys/arch/socppc/stand/boot/exec.c b/sys/arch/socppc/stand/boot/exec.c deleted file mode 100644 index 5f41774587a..00000000000 --- a/sys/arch/socppc/stand/boot/exec.c +++ /dev/null @@ -1,74 +0,0 @@ -/* $OpenBSD: exec.c,v 1.4 2019/04/10 04:17:37 deraadt Exp $ */ - -/* - * Copyright (c) 2006 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/param.h> - -#include <lib/libsa/stand.h> -#include <lib/libsa/loadfile.h> - -#include <sys/reboot.h> -#include <stand/boot/cmd.h> - -typedef void (*startfuncp)(int, int, u_int32_t, char *, int) __dead; - -void -run_loadfile(uint64_t *marks, int howto) -{ - char args[512]; /* Should check size? */ - u_int32_t entry; - char *cp; - void *ssym, *esym; - int l; - - snprintf(args, sizeof(args), "%s:%s -", cmd.bootdev, cmd.image); - cp = args + strlen(args); - - *cp++ = ' '; - *cp = '-'; - if (howto & RB_ASKNAME) - *++cp = 'a'; - if (howto & RB_CONFIG) - *++cp = 'c'; - if (howto & RB_SINGLE) - *++cp = 's'; - if (howto & RB_KDB) - *++cp = 'd'; - if (*cp == '-') - *--cp = 0; - else - *++cp = 0; - - entry = marks[MARK_ENTRY]; - ssym = (void *)marks[MARK_SYM]; - esym = (void *)marks[MARK_END]; - - /* - * 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); - extern int fdtaddrsave; - - (*(startfuncp)(marks[MARK_ENTRY]))(fdtaddrsave, 0, entry, args, l); - - /* NOTREACHED */ -} diff --git a/sys/arch/socppc/stand/boot/fdt.c b/sys/arch/socppc/stand/boot/fdt.c deleted file mode 100644 index f788e3d5094..00000000000 --- a/sys/arch/socppc/stand/boot/fdt.c +++ /dev/null @@ -1,415 +0,0 @@ -/* $OpenBSD: fdt.c,v 1.7 2017/09/08 05:36:52 deraadt Exp $ */ - -/* - * Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -#include <sys/param.h> - -#include "fdt.h" -#include "libsa.h" - - -unsigned int fdt_check_head(void *); -char *fdt_get_str(u_int32_t); -void *skip_property(u_int32_t *); -void *skip_props(u_int32_t *); -void *skip_node_name(u_int32_t *); -void *fdt_parent_node_recurse(void *, void *); -void *fdt_find_node_recurse(void *, char *); -void fdt_print_node_recurse(void *, int); - -static int tree_inited = 0; -static struct fdt tree; - -unsigned int -fdt_check_head(void *fdt) -{ - struct fdt_head *fh; - u_int32_t *ptr; - - fh = fdt; - ptr = (u_int32_t *)fdt; - - if (fh->fh_magic != FDT_MAGIC) - return 0; - - if (fh->fh_version > FDT_CODE_VERSION) - return 0; - - if (*(ptr + (fh->fh_struct_off / 4)) != FDT_NODE_BEGIN) - return 0; - - /* check for end signature on version 17 blob */ - if ((fh->fh_version >= 17) & (*(ptr + fh->fh_struct_size) != FDT_END)) - return 0; - - return fh->fh_version; -} - -/* - * Initializes internal structures of module. - * Has to be called once, preferably in machdep.c. - */ -int -fdt_init(void *fdt) -{ - int version; - - bzero(&tree, sizeof(struct fdt)); - tree_inited = 0; - - if (!fdt) - return 0; - - if (!(version = fdt_check_head(fdt))) - return 0; - - tree.header = (struct fdt_head *)fdt; - tree.tree = (char *)fdt + tree.header->fh_struct_off; - tree.strings = (char *)fdt + tree.header->fh_strings_off; - tree.memory = (char *)fdt + tree.header->fh_reserve_off; - tree.version = version; - - if (version < 3) { - if ((tree.strings < tree.tree) && (tree.tree < tree.memory)) - tree.strings_size = tree.tree - tree.strings; - else if ((tree.strings < tree.memory) && (tree.memory < - tree.tree)) - tree.strings_size = tree.memory - tree.strings; - else if ((tree.strings < tree.tree) && (tree.memory < - tree.strings)) - tree.strings_size = tree.tree - tree.strings; - else if ((tree.strings < tree.memory) && (tree.tree < - tree.strings)) - tree.strings_size = tree.memory - tree.strings; - else - tree.strings_size = tree.header->fh_size - - (int)tree.strings; - } else - tree.strings_size = tree.header->fh_strings_size; - - tree.strings_size = tree.header->fh_strings_size; - tree_inited = 1; - - return version; -} - -/* - * Retrieve string pointer from srtings table. - */ -char * -fdt_get_str(u_int32_t num) -{ - if (num > tree.strings_size) - return NULL; - return (tree.strings) ? (tree.strings + num) : NULL; -} - -/* - * Utility functions for skipping parts of tree. - */ -void * -skip_property(u_int32_t *ptr) -{ - u_int32_t size; - - size = *(ptr + 1); - /* move forward by magic + size + nameid + rounded up property size */ - ptr += 3 + roundup(size, sizeof(u_int32_t)) / sizeof(u_int32_t); - - return ptr; -} - -void * -skip_props(u_int32_t *ptr) -{ - while (*ptr == FDT_PROPERTY) { - ptr = skip_property(ptr); - } - return ptr; -} - -void * -skip_node_name(u_int32_t *ptr) -{ - /* skip name, aligned to 4 bytes, this is NULL term., so must add 1 */ - return ptr + roundup(strlen((char *)ptr) + 1, - sizeof(u_int32_t)) / sizeof(u_int32_t); -} - -/* - * Retrieves node property, the returned pointer is inside the fdt tree, - * so we should not modify content pointed by it directly. - */ -int -fdt_node_property(void *node, char *name, char **out) -{ - u_int32_t *ptr; - u_int32_t nameid; - char *tmp; - - if (!tree_inited) - return 0; - - ptr = (u_int32_t *)node; - - if (*ptr != FDT_NODE_BEGIN) - return 0; - - ptr = skip_node_name(ptr + 1); - - while (*ptr == FDT_PROPERTY) { - nameid = *(ptr + 2); /* id of name in strings table */ - tmp = fdt_get_str(nameid); - if (!strcmp(name, tmp)) { - *out = (char *)(ptr + 3); /* beginning of the value */ - return *(ptr + 1); /* size of value */ - } - ptr = skip_property(ptr); - } - return 0; -} - -/* - * Retrieves next node, skipping all the children nodes of the pointed node - * if passed 0 wil return first node of the tree (root) - */ -void * -fdt_next_node(void *node) -{ - u_int32_t *ptr; - - if (!tree_inited) - return NULL; - - ptr = node; - - if (!node) { - ptr = tree.tree; - return (*ptr == FDT_NODE_BEGIN) ? ptr : NULL; - } - - if (*ptr != FDT_NODE_BEGIN) - return NULL; - - ptr++; - - ptr = skip_node_name(ptr); - ptr = skip_props(ptr); - - /* skip children */ - while (*ptr == FDT_NODE_BEGIN) - ptr = fdt_next_node(ptr); - - return (*ptr == FDT_NODE_END) ? (ptr + 1) : NULL; -} - -/* - * Retrieves next node, skipping all the children nodes of the pointed node - */ -void * -fdt_child_node(void *node) -{ - u_int32_t *ptr; - - if (!tree_inited) - return NULL; - - ptr = node; - - if (*ptr != FDT_NODE_BEGIN) - return NULL; - - ptr++; - - ptr = skip_node_name(ptr); - ptr = skip_props(ptr); - /* check if there is a child node */ - return (*ptr == FDT_NODE_BEGIN) ? (ptr) : NULL; -} - -/* - * Retrieves node name. - */ -char * -fdt_node_name(void *node) -{ - u_int32_t *ptr; - - if (!tree_inited) - return NULL; - - ptr = node; - - if (*ptr != FDT_NODE_BEGIN) - return NULL; - - return (char *)(ptr + 1); -} - -void * -fdt_find_node(char *name) -{ - void *node = fdt_next_node(0); - const char *p = name; - - if (!tree_inited) - return NULL; - - if (*p != '/') - return NULL; - - while (*p) { - void *child; - const char *q; - - while (*p == '/') - p++; - if (*p == 0) - return node; - q = strchr(p, '/'); - if (q == NULL) - q = p + strlen(p); - - for (child = fdt_child_node(node); child; - child = fdt_next_node(child)) { - if (strncmp(p, fdt_node_name(child), q - p) == 0) { - node = child; - break; - } - } - - p = q; - } - - return node; -} - -void * -fdt_parent_node_recurse(void *pnode, void *child) -{ - void *node = fdt_child_node(pnode); - void *tmp; - - while (node && (node != child)) { - if ((tmp = fdt_parent_node_recurse(node, child))) - return tmp; - node = fdt_next_node(node); - } - return (node) ? pnode : NULL; -} - -void * -fdt_parent_node(void *node) -{ - void *pnode = fdt_next_node(0); - - if (!tree_inited) - return NULL; - - return fdt_parent_node_recurse(pnode, node); -} - -/* - * Debug methods for printing whole tree, particular odes and properies - */ -void * -fdt_print_property(void *node, int level) -{ - u_int32_t *ptr; - char *tmp, *value; - int cnt; - u_int32_t nameid, size; - - ptr = (u_int32_t *)node; - - if (!tree_inited) - return NULL; - - if (*ptr != FDT_PROPERTY) - return ptr; /* should never happen */ - - /* extract property name_id and size */ - size = *++ptr; - nameid = *++ptr; - - for (cnt = 0; cnt < level; cnt++) - printf("\t"); - - tmp = fdt_get_str(nameid); - printf("\t%s : ", tmp ? tmp : "NO_NAME"); - - ptr++; - value = (char *)ptr; - - if (!strcmp(tmp, "device_type") || !strcmp(tmp, "compatible") || - !strcmp(tmp, "model") || !strcmp(tmp, "bootargs") || - !strcmp(tmp, "linux,stdout-path")) { - printf("%s", value); - } else if (!strcmp(tmp, "clock-frequency") || - !strcmp(tmp, "timebase-frequency")) { - printf("%d", *((unsigned int *)value)); - } else { - for (cnt = 0; cnt < size; cnt++) { - if ((cnt % sizeof(u_int32_t)) == 0) - printf(" "); - printf("%x", value[cnt]); - } - } - ptr += roundup(size, sizeof(u_int32_t)) / sizeof(u_int32_t); - printf("\n"); - - return ptr; -} - -void -fdt_print_node(void *node, int level) -{ - u_int32_t *ptr; - int cnt; - - ptr = (u_int32_t *)node; - - if (*ptr != FDT_NODE_BEGIN) - return; - - ptr++; - - for (cnt = 0; cnt < level; cnt++) - printf("\t"); - printf("%s :\n", fdt_node_name(node)); - ptr = skip_node_name(ptr); - - while (*ptr == FDT_PROPERTY) - ptr = fdt_print_property(ptr, level); -} - -void -fdt_print_node_recurse(void *node, int level) -{ - void *child; - - fdt_print_node(node, level); - for (child = fdt_child_node(node); child; child = fdt_next_node(child)) - fdt_print_node_recurse(child, level + 1); -} - -void -fdt_print_tree(void) -{ - fdt_print_node_recurse(fdt_next_node(0), 0); -} diff --git a/sys/arch/socppc/stand/boot/fdt.h b/sys/arch/socppc/stand/boot/fdt.h deleted file mode 100644 index 88927157997..00000000000 --- a/sys/arch/socppc/stand/boot/fdt.h +++ /dev/null @@ -1,59 +0,0 @@ -/* $OpenBSD: fdt.h,v 1.3 2009/10/01 20:21:05 dms Exp $ */ - -/* - * Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -struct fdt_head { - u_int32_t fh_magic; - u_int32_t fh_size; - u_int32_t fh_struct_off; - u_int32_t fh_strings_off; - u_int32_t fh_reserve_off; - u_int32_t fh_version; - u_int32_t fh_comp_ver; /* last compatible version */ - u_int32_t fh_boot_cpu_id; /* fh_version >=2 */ - u_int32_t fh_strings_size; /* fh_version >=3 */ - u_int32_t fh_struct_size; /* fh_version >=17 */ -}; - -struct fdt { - struct fdt_head *header; - void * tree; - void * strings; - void * memory; - int version; - int strings_size; -}; - -#define FDT_MAGIC 0xd00dfeed -#define FDT_NODE_BEGIN 0x01 -#define FDT_NODE_END 0x02 -#define FDT_PROPERTY 0x03 -#define FDT_NOP 0x04 -#define FDT_END 0x09 - -#define FDT_CODE_VERSION 0x11 - -int fdt_init(void *); -void *fdt_next_node(void *); -void *fdt_child_node(void *); -char *fdt_node_name(void *); -void *fdt_find_node(char *); -int fdt_node_property(void *, char *, char **); -void *fdt_parent_node(void *); -void *fdt_print_property(void *, int); -void fdt_print_node(void *, int); -void fdt_print_tree(void); diff --git a/sys/arch/socppc/stand/boot/libsa.h b/sys/arch/socppc/stand/boot/libsa.h deleted file mode 100644 index e283b7d71a7..00000000000 --- a/sys/arch/socppc/stand/boot/libsa.h +++ /dev/null @@ -1,42 +0,0 @@ -/* $OpenBSD: libsa.h,v 1.2 2011/03/13 00:13:53 deraadt Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <lib/libsa/stand.h> - -#define DEFAULT_KERNEL_ADDRESS 0 - -#ifdef DEBUG -#define DPRINTF(x) printf x; -#else -#define DPRINTF(x) -#endif - -/* - * com - */ -void com_probe(struct consdev *); -void com_init(struct consdev *); -int com_getc(dev_t); -void com_putc(dev_t, int); - -/* - * wd - */ -int wdstrategy(void *, int, daddr32_t, size_t, void *, size_t *); -int wdopen(struct open_file *, ...); -int wdclose(struct open_file *); diff --git a/sys/arch/socppc/stand/boot/machdep.c b/sys/arch/socppc/stand/boot/machdep.c deleted file mode 100644 index 71980f8a73c..00000000000 --- a/sys/arch/socppc/stand/boot/machdep.c +++ /dev/null @@ -1,155 +0,0 @@ -/* $OpenBSD: machdep.c,v 1.7 2016/10/09 11:25:40 tom Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/types.h> - -#include "libsa.h" -#include "wdvar.h" -#include "fdt.h" - -/* - * RouterBOOT firmware puts its FDT at an address that is low enough - * to conflict with bsd.rd. So we need to relocate the FDT. As long - * as we have at least 32MB of memory, the 16MB boundary should be - * fine, and leave us plenty of room for future kernel growth. - */ -#define FDTADDRSTART 0x01000000 - -#define RPR 0xe0000918 -#define RPR_RSTE 0x52535445 -#define RCR 0xe000091c -#define RCR_SWSR 0x00000001 -#define RCR_SWHR 0x00000002 - -/* defines from pciide.c and wdc_obio.c */ -int pciide_init (struct wdc_channel*, u_int); -int wdc_obio_init (struct wdc_channel*, u_int); - -void -machdep(void) -{ - void *node; - char *tmp; - int len; - - extern int consfreq; - extern uint8_t *consaddr; - - /* set default values */ - consfreq = NS16550_FREQ; - consaddr = (uint8_t *)CONADDR; - - /* lookup FTD for informations about console */ - node = fdt_find_node("/chosen"); - if (node) { - char *console; - fdt_node_property(node, "linux,stdout-path", &console); - node = fdt_find_node(console); - if (node) { - len = fdt_node_property(node, "clock-frequency", &tmp); - if (len == 4) - consfreq = *(int *)tmp; - - len = fdt_node_property(node, "reg", &tmp); - if (len == 8) - consaddr = (uint8_t *)*(int *)tmp; - } - if (node = fdt_parent_node(node)) { - fdt_node_property(node, "device_type", &tmp); - if (strncmp(tmp, "soc", 3) == 0) { - /* we are on a soc */ - len = fdt_node_property(node, "reg", &tmp); - if (len == 8) - consaddr += *(int *)tmp; - } - } - } - - cninit(); -{ - extern int (*controller_init)(struct wdc_channel *chp, u_int chan); - extern u_int32_t pciide_base_addr; - extern u_int32_t wdc_base_addr[]; - int *addr; - int chnum; - - /* Thecus defaults */ - controller_init = pciide_init; - pciide_base_addr = 0xe2000000; - - /* lookup the FDT, may have some CF there */ - chnum = 0; - wdc_base_addr[0] = 0; - wdc_base_addr[1] = 0; - node = fdt_find_node("/"); - for (node = fdt_child_node(node); node; node = fdt_next_node(node)) { - len = fdt_node_property(node, "device_type", &tmp); - if (len && (strcmp(tmp, "rb,cf") == 0) && (chnum < 2)) { - len = fdt_node_property(node, "reg", (char **)&addr); - if (len == 8) { - wdc_base_addr[chnum] = *addr; - chnum++; - } - } - } - if (chnum) - controller_init = wdc_obio_init; -} - -} - -int -main(void) -{ - extern char __bss_start[], _end[]; - extern int fdtaddrsave; - - bzero(__bss_start, _end - __bss_start); - - /* initialize FDT if the blob is available */ - if (fdtaddrsave) { - if (fdt_init((void *)fdtaddrsave) == 0) - fdtaddrsave = 0; /* no usable blob there */ - } - - /* relocate FDT */ - if (fdtaddrsave && fdtaddrsave < FDTADDRSTART) { - struct fdt_head *fh = (void *)fdtaddrsave; - - bcopy((void *)fdtaddrsave, (void *)FDTADDRSTART, fh->fh_size); - fdtaddrsave = FDTADDRSTART; - } - - boot(0); - return 0; -} - -void -_rtt(void) -{ - uint32_t v; - - *((volatile uint32_t *)(RPR)) = RPR_RSTE; - __asm volatile("eieio"); - *((volatile uint32_t *)(RCR)) = RCR_SWHR; - - printf("RESET FAILED\n"); - for (;;) - continue; - /* NOTREACHED */ -} diff --git a/sys/arch/socppc/stand/boot/ns16550.c b/sys/arch/socppc/stand/boot/ns16550.c deleted file mode 100644 index 5345cccb878..00000000000 --- a/sys/arch/socppc/stand/boot/ns16550.c +++ /dev/null @@ -1,136 +0,0 @@ -/* $OpenBSD: ns16550.c,v 1.2 2009/09/07 21:16:57 dms Exp $ */ -/* $NetBSD: ns16550.c,v 1.3 2005/12/24 20:07:03 perry Exp $ */ - -/* - * Copyright (c) 2002 Wasabi Systems, Inc. - * All rights reserved. - * - * Written by Jason R. Thorpe for Wasabi Systems, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed for the NetBSD Project by - * Wasabi Systems, Inc. - * 4. The name of Wasabi Systems, Inc. may not be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This file provides console I/O routines for boards that use - * 16550-compatible UARTs. - */ - -#include <sys/types.h> - -#include <dev/cons.h> -#include <dev/ic/comreg.h> - -#include "libsa.h" - -uint8_t *consaddr; -uint32_t consspeed; -uint32_t consfreq; - -#define INB(x) *((volatile uint8_t *) (consaddr + (x))) -#define OUTB(x, v) *((volatile uint8_t *) (consaddr + (x))) = (v) -#define ISSET(t,f) ((t) & (f)) - -static int -comspeed(int speed) -{ -#define divrnd(n, q) (((n)*2/(q)+1)/2) /* divide and round off */ - - int x, err; - - if (speed <= 0) - return (-1); - x = divrnd((consfreq / 16), speed); - if (x <= 0) - return (-1); - err = divrnd((((quad_t)consfreq) / 16) * 1000, speed * x) - 1000; - if (err < 0) - err = -err; - if (err > COM_TOLERANCE) - return (-1); - return (x); -#undef divrnd -} - -void -com_probe(struct consdev *cn) -{ - cn->cn_pri = CN_LOWPRI; - cn->cn_dev = makedev(12, 0); -} - -void -com_init(struct consdev *cn) -{ - int rate; - - OUTB(com_cfcr, LCR_DLAB); - rate = comspeed(CONSPEED); - OUTB(com_dlbl, rate); - OUTB(com_dlbh, rate >> 8); - OUTB(com_cfcr, LCR_8BITS); - OUTB(com_mcr, MCR_DTR | MCR_RTS); - OUTB(com_fifo, - FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1); - OUTB(com_ier, 0); -} - -int -com_getc(dev_t dev) -{ - uint8_t stat; - - if (dev & 0x80) - return ISSET(stat = INB(com_lsr), LSR_RXRDY); - - while (!ISSET(stat = INB(com_lsr), LSR_RXRDY)) - /* spin */ ; - return (INB(com_data)); -} - -void -com_putc(dev_t dev, int c) -{ - uint8_t stat; - int timo; - - /* Wait for any pending transmission to finish. */ - timo = 50000; - while (!ISSET(stat = INB(com_lsr), LSR_TXRDY) && --timo) - /* spin */ ; - - OUTB(com_data, c); - - /* Wait for this transmission to complete. */ - timo = 1500000; - while (!ISSET(stat = INB(com_lsr), LSR_TXRDY) && --timo) - /* spin */ ; - - /* Clear any interrupts generated by this transmission. */ - (void) INB(com_iir); -} diff --git a/sys/arch/socppc/stand/boot/pciide.c b/sys/arch/socppc/stand/boot/pciide.c deleted file mode 100644 index 7b3ffb7dda6..00000000000 --- a/sys/arch/socppc/stand/boot/pciide.c +++ /dev/null @@ -1,103 +0,0 @@ -/* $OpenBSD: pciide.c,v 1.3 2009/09/07 21:16:57 dms Exp $ */ -/* $NetBSD: pciide.c,v 1.5 2005/12/11 12:17:06 christos Exp $ */ - -/*- - * Copyright (c) 2003 The NetBSD Foundation, Inc. - * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/types.h> - -#include "libsa.h" -#include "wdvar.h" - -u_int8_t pciide_read_cmdreg(struct wdc_channel *, u_int8_t); -void pciide_write_cmdreg(struct wdc_channel *, u_int8_t, u_int8_t); -u_int8_t pciide_read_ctlreg(struct wdc_channel *, u_int8_t); -void pciide_write_ctlreg(struct wdc_channel *, u_int8_t, u_int8_t); - -u_int32_t pciide_base_addr = 0; - -int -pciide_init(struct wdc_channel *chp, u_int chan) -{ - u_int32_t cmdreg, ctlreg; - int i; - - /* - * two channels per chip, one drive per channel - */ - if (chan >= PCIIDE_NUM_CHANNELS || pciide_base_addr == 0) - return (ENXIO); - chp->ndrives = 1; - - DPRINTF(("[pciide] channel: %d\n", chan)); - - /* - * XXX map? - */ - cmdreg = pciide_base_addr + chan * 0x10; - ctlreg = pciide_base_addr+0x8 + chan * 0x10; - - /* set up cmd regsiters */ - chp->c_cmdbase = (u_int8_t *)cmdreg; - chp->c_data = (u_int16_t *)(cmdreg + wd_data); - for (i = 0; i < WDC_NPORTS; i++) - chp->c_cmdreg[i] = chp->c_cmdbase + i; - /* set up shadow registers */ - chp->c_cmdreg[wd_status] = chp->c_cmdreg[wd_command]; - chp->c_cmdreg[wd_features] = chp->c_cmdreg[wd_precomp]; - /* set up ctl registers */ - chp->c_ctlbase = (u_int8_t *)ctlreg; - - chp->read_cmdreg = pciide_read_cmdreg; - chp->write_cmdreg = pciide_write_cmdreg; - chp->read_ctlreg = pciide_read_ctlreg; - chp->write_ctlreg = pciide_write_ctlreg; - return (0); -} - -u_int8_t -pciide_read_cmdreg(struct wdc_channel *chp, u_int8_t reg) -{ - return *chp->c_cmdreg[reg]; -} - -void -pciide_write_cmdreg(struct wdc_channel *chp, u_int8_t reg, u_int8_t val) -{ - *chp->c_cmdreg[reg] = val; -} - -u_int8_t -pciide_read_ctlreg(struct wdc_channel *chp, u_int8_t reg) -{ - return chp->c_ctlbase[reg]; -} - -void -pciide_write_ctlreg(struct wdc_channel *chp, u_int8_t reg, u_int8_t val) -{ - chp->c_ctlbase[reg] = val; -} diff --git a/sys/arch/socppc/stand/boot/start.S b/sys/arch/socppc/stand/boot/start.S deleted file mode 100644 index 94b44424ae3..00000000000 --- a/sys/arch/socppc/stand/boot/start.S +++ /dev/null @@ -1,21 +0,0 @@ -#include <machine/asm.h> - -#define STACKSIZE 8192 - - .globl _C_LABEL(fdtaddrsave) - .type _C_LABEL(fdtaddrsave),@object - .data -_C_LABEL(fdtaddrsave): .long 0 - -ENTRY(_start) - lis %r1, fdtaddrsave@ha - stw %r3, fdtaddrsave@l(%r1) - - lis %r1, stack@ha - addi %r1, %r1, stack@l - addi %r1, %r1, STACKSIZE - - b _C_LABEL(main) - - .data -.lcomm stack,STACKSIZE,8 diff --git a/sys/arch/socppc/stand/boot/time.c b/sys/arch/socppc/stand/boot/time.c deleted file mode 100644 index 18c702193cc..00000000000 --- a/sys/arch/socppc/stand/boot/time.c +++ /dev/null @@ -1,13 +0,0 @@ -/* $OpenBSD: time.c,v 1.3 2015/01/20 04:41:01 krw Exp $ */ -#include <sys/types.h> - -#include "libsa.h" - -time_t -getsecs(void) -{ - uint32_t count; - - __asm volatile ("mftb %0" : "=r" (count)); - return (count / 66666666); -} diff --git a/sys/arch/socppc/stand/boot/wd.c b/sys/arch/socppc/stand/boot/wd.c deleted file mode 100644 index 1a5369aafda..00000000000 --- a/sys/arch/socppc/stand/boot/wd.c +++ /dev/null @@ -1,311 +0,0 @@ -/* $OpenBSD: wd.c,v 1.10 2017/09/08 05:36:52 deraadt Exp $ */ -/* $NetBSD: wd.c,v 1.5 2005/12/11 12:17:06 christos Exp $ */ - -/*- - * Copyright (c) 2003 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Manuel Bouyer. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/stdint.h> - -#include "libsa.h" -#include "wdvar.h" - -void wdprobe(void); -int wd_get_params(struct wd_softc *wd); -int wdgetdisklabel(struct wd_softc *wd); -void wdgetdefaultlabel(struct wd_softc *wd, struct disklabel *lp); - -struct wd_softc wd_devs[NUNITS]; -int wd_ndevs = -1; - -void -wdprobe(void) -{ - struct wd_softc *wd = wd_devs; - u_int chan, drive, unit = 0; - - for (chan = 0; chan < PCIIDE_NUM_CHANNELS; chan++) { - if (wdc_init(wd, chan) != 0) - continue; - for (drive = 0; drive < wd->sc_channel.ndrives; drive++) { - wd->sc_unit = unit; - wd->sc_drive = drive; - - if (wd_get_params(wd) != 0) - continue; - - DPRINTF(("wd%d: channel %d drive %d\n", - unit, chan, drive)); - unit++; - wd++; - } - } - - wd_ndevs = unit; -} - -/* - * Get drive parameters through 'device identify' command. - */ -int -wd_get_params(wd) - struct wd_softc *wd; -{ - int error; - unsigned char buf[DEV_BSIZE]; - - if ((error = wdc_exec_identify(wd, buf)) != 0) - return (error); - -#if BYTE_ORDER == BIG_ENDIAN - /* - * All the fields in the params structure are 16-bit integers - * except for the ID strings which are char strings. The - * 16-bit integers are currently in memory in little-endian, - * regardless of architecture. So, they need to be swapped on - * big-endian architectures before they are accessed through - * the ataparams structure. - * - * The swaps below avoid touching the char strings. - */ - swap16_multi((u_int16_t *)buf, 10); - swap16_multi((u_int16_t *)buf + 20, 3); - swap16_multi((u_int16_t *)buf + 47, DEV_BSIZE / 2 - 47); -#endif - - wd->sc_params = *(struct ataparams *)buf; - - /* 48-bit LBA addressing */ - if ((wd->sc_params.atap_cmd2_en & ATAPI_CMD2_48AD) != 0) { - DPRINTF(("Drive supports LBA48.\n")); -#if defined(_ENABLE_LBA48) - wd->sc_flags |= WDF_LBA48; -#endif - } - - /* Prior to ATA-4, LBA was optional. */ - if ((wd->sc_params.atap_capabilities1 & WDC_CAP_LBA) != 0) { - DPRINTF(("Drive supports LBA.\n")); - wd->sc_flags |= WDF_LBA; - } - - return (0); -} - -/* - * Initialize disk label to the default value. - */ -void -wdgetdefaultlabel(wd, lp) - struct wd_softc *wd; - struct disklabel *lp; -{ - memset(lp, 0, sizeof(struct disklabel)); - - lp->d_secsize = DEV_BSIZE; - lp->d_ntracks = wd->sc_params.atap_heads; - lp->d_nsectors = wd->sc_params.atap_sectors; - lp->d_ncylinders = wd->sc_params.atap_cylinders; - lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors; - - if (strcmp(wd->sc_params.atap_model, "ST506") == 0) - lp->d_type = DTYPE_ST506; - else - lp->d_type = DTYPE_ESDI; - - strncpy(lp->d_typename, wd->sc_params.atap_model, 16); - strncpy(lp->d_packname, "fictitious", 16); - if (wd->sc_capacity > UINT32_MAX) - DL_SETDSIZE(lp, UINT32_MAX); - else - DL_SETDSIZE(lp, wd->sc_capacity); - lp->d_flags = 0; - - DL_SETPOFFSET(&lp->d_partitions[RAW_PART], 0); - DL_SETPSIZE(&lp->d_partitions[RAW_PART], DL_GETDSIZE(lp)); - lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED; - lp->d_npartitions = MAXPARTITIONS; - - lp->d_magic = DISKMAGIC; - lp->d_magic2 = DISKMAGIC; - lp->d_checksum = dkcksum(lp); -} - -/* - * Read disk label from the device. - */ -int -wdgetdisklabel(wd) - struct wd_softc *wd; -{ - char *msg; - int sector; - size_t rsize; - struct disklabel *lp; - unsigned char buf[DEV_BSIZE]; - u_int16_t sig; - - wdgetdefaultlabel(wd, &wd->sc_label); - - /* - * Find OpenBSD Partition in DOS partition table. - */ - sector = 0; - if (wdstrategy(wd, F_READ, DOSBBSECTOR, DEV_BSIZE, buf, &rsize)) - return EOFFSET; - - sig = letoh16(*(u_int16_t *)&buf[DOSMBR_SIGNATURE_OFF]); - if (sig == DOSMBR_SIGNATURE) { - int i; - struct dos_partition *dp = (struct dos_partition *)buf; - - /* - * Lookup OpenBSD slice. If there is none, go ahead - * and try to read the disklabel off sector #0. - */ - - memcpy(dp, &buf[DOSPARTOFF], NDOSPART * sizeof(*dp)); - for (i = 0; i < NDOSPART; i++) { - if (dp[i].dp_typ == DOSPTYP_OPENBSD) { - sector = letoh32(dp[i].dp_start); - break; - } - } - } - - if (wdstrategy(wd, F_READ, sector + DOS_LABELSECTOR, DEV_BSIZE, - buf, &rsize)) - return EOFFSET; - - if ((msg = getdisklabel(buf + LABELOFFSET, &wd->sc_label))) - printf("wd%d: getdisklabel: %s\n", wd->sc_unit, msg); - - lp = &wd->sc_label; - - /* check partition */ - if ((wd->sc_part >= lp->d_npartitions) || - (lp->d_partitions[wd->sc_part].p_fstype == FS_UNUSED)) { - DPRINTF(("illegal partition\n")); - return (EPART); - } - - DPRINTF(("label info: d_secsize %d, d_nsectors %d, d_ncylinders %d," - "d_ntracks %d, d_secpercyl %d\n", - wd->sc_label.d_secsize, - wd->sc_label.d_nsectors, - wd->sc_label.d_ncylinders, - wd->sc_label.d_ntracks, - wd->sc_label.d_secpercyl)); - - return (0); -} - -/* - * Open device (read drive parameters and disklabel) - */ -int -wdopen(struct open_file *f, ...) -{ - int error; - va_list ap; - u_int unit, part, drive; - struct wd_softc *wd; - - va_start(ap, f); - unit = va_arg(ap, u_int); - part = va_arg(ap, u_int); - va_end(ap); - - DPRINTF(("wdopen: wd%d%c\n", unit, 'a' + part)); - - if (unit < 0 || unit >= NUNITS) - return (ENXIO); - - if (wd_ndevs == -1) - wdprobe(); - - if (unit >= wd_ndevs) - return (ENXIO); - - wd = &wd_devs[unit]; - wd->sc_part = part; - - if ((error = wdgetdisklabel(wd)) != 0) - return (error); - - f->f_devdata = wd; - return (0); -} - -/* - * Close device. - */ -int -wdclose(struct open_file *f) -{ - return 0; -} - -/* - * Read some data. - */ -int -wdstrategy(f, rw, dblk, size, buf, rsize) - void *f; - int rw; - daddr32_t dblk; - size_t size; - void *buf; - size_t *rsize; -{ - int i, nsect; - daddr32_t blkno; - struct wd_softc *wd = f; - - if (size == 0) - return (0); - - if (rw != F_READ) - return EOPNOTSUPP; - - nsect = howmany(size, wd->sc_label.d_secsize); - blkno = dblk + wd->sc_label.d_partitions[wd->sc_part].p_offset; - - for (i = 0; i < nsect; i++, blkno++) { - int error; - - if ((error = wdc_exec_read(wd, WDCC_READ, blkno, buf)) != 0) - return (error); - - buf += wd->sc_label.d_secsize; - } - - *rsize = size; - return (0); -} diff --git a/sys/arch/socppc/stand/boot/wdc.c b/sys/arch/socppc/stand/boot/wdc.c deleted file mode 100644 index e584d55ce84..00000000000 --- a/sys/arch/socppc/stand/boot/wdc.c +++ /dev/null @@ -1,379 +0,0 @@ -/* $OpenBSD: wdc.c,v 1.5 2013/03/24 18:43:47 deraadt Exp $ */ -/* $NetBSD: wdc.c,v 1.7 2005/12/11 12:17:06 christos Exp $ */ - -/*- - * Copyright (c) 2003 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Manuel Bouyer. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> - -#include "libsa.h" -#include "wdvar.h" - -#define WDCDELAY 100 -#define WDCNDELAY_RST 31000 * 10 - -static int wdcprobe(struct wdc_channel *chp); -static int wdc_wait_for_ready(struct wdc_channel *chp); -static int wdc_read_block(struct wd_softc *sc, struct wdc_command *wd_c); -static int __wdcwait_reset(struct wdc_channel *chp, int drv_mask); - -int (*controller_init)(struct wdc_channel *, u_int) = 0; - -/* - * Reset the controller. - */ -static int -__wdcwait_reset(chp, drv_mask) - struct wdc_channel *chp; - int drv_mask; -{ - int timeout; - u_int8_t st0, st1; - - /* wait for BSY to deassert */ - for (timeout = 0; timeout < WDCNDELAY_RST; timeout++) { - WDC_WRITE_REG(chp, wd_sdh, WDSD_IBM); /* master */ - delay(10); - st0 = WDC_READ_REG(chp, wd_status); - WDC_WRITE_REG(chp, wd_sdh, WDSD_IBM | 0x10); /* slave */ - delay(10); - st1 = WDC_READ_REG(chp, wd_status); - - if ((drv_mask & 0x01) == 0) { - /* no master */ - if ((drv_mask & 0x02) != 0 && (st1 & WDCS_BSY) == 0) { - /* No master, slave is ready, it's done */ - goto end; - } - } else if ((drv_mask & 0x02) == 0) { - /* no slave */ - if ((drv_mask & 0x01) != 0 && (st0 & WDCS_BSY) == 0) { - /* No slave, master is ready, it's done */ - goto end; - } - } else { - /* Wait for both master and slave to be ready */ - if ((st0 & WDCS_BSY) == 0 && (st1 & WDCS_BSY) == 0) { - goto end; - } - } - - delay(WDCDELAY); - } - - /* Reset timed out. Maybe it's because drv_mask was not right */ - if (st0 & WDCS_BSY) - drv_mask &= ~0x01; - if (st1 & WDCS_BSY) - drv_mask &= ~0x02; - -end: - return (drv_mask); -} - -/* Test to see controller with at last one attached drive is there. - * Returns a bit for each possible drive found (0x01 for drive 0, - * 0x02 for drive 1). - * Logic: - * - If a status register is at 0xff, assume there is no drive here - * (ISA has pull-up resistors). Similarly if the status register has - * the value we last wrote to the bus (for IDE interfaces without pullups). - * If no drive at all -> return. - * - reset the controller, wait for it to complete (may take up to 31s !). - * If timeout -> return. - */ -static int -wdcprobe(chp) - struct wdc_channel *chp; -{ - u_int8_t st0, st1, sc, sn, cl, ch; - u_int8_t ret_value = 0x03; - u_int8_t drive; - int found; - - /* - * Sanity check to see if the wdc channel responds at all. - */ - WDC_WRITE_REG(chp, wd_sdh, WDSD_IBM); - delay(10); - st0 = WDC_READ_REG(chp, wd_status); - WDC_WRITE_REG(chp, wd_sdh, WDSD_IBM | 0x10); - delay(10); - st1 = WDC_READ_REG(chp, wd_status); - - if (st0 == 0xff || st0 == WDSD_IBM) - ret_value &= ~0x01; - if (st1 == 0xff || st1 == (WDSD_IBM | 0x10)) - ret_value &= ~0x02; - if (ret_value == 0) - return (ENXIO); - - /* assert SRST, wait for reset to complete */ - WDC_WRITE_REG(chp, wd_sdh, WDSD_IBM); - delay(10); - WDC_WRITE_CTLREG(chp, wd_aux_ctlr, WDCTL_RST | WDCTL_IDS); - delay(1000); - WDC_WRITE_CTLREG(chp, wd_aux_ctlr, WDCTL_IDS); - delay(1000); - (void) WDC_READ_REG(chp, wd_error); - WDC_WRITE_CTLREG(chp, wd_aux_ctlr, WDCTL_4BIT); - delay(10); - - ret_value = __wdcwait_reset(chp, ret_value); - - /* if reset failed, there's nothing here */ - if (ret_value == 0) - return (ENXIO); - - /* - * Test presence of drives. First test register signatures looking for - * ATAPI devices. If it's not an ATAPI and reset said there may be - * something here assume it's ATA or OLD. Ghost will be killed later in - * attach routine. - */ - found = 0; - for (drive = 0; drive < 2; drive++) { - if ((ret_value & (0x01 << drive)) == 0) - continue; - return (0); - } - return (ENXIO); -} - -/* - * Initialize the device. - */ -int -wdc_init(sc, unit) - struct wd_softc *sc; - u_int unit; -{ - if (!controller_init) - return (ENXIO); - if ((*controller_init)(&sc->sc_channel, unit) != 0) - return (ENXIO); - if (wdcprobe(&sc->sc_channel) != 0) - return (ENXIO); - return (0); -} - -/* - * Wait until the device is ready. - */ -int -wdc_wait_for_ready(chp) - struct wdc_channel *chp; -{ - u_int timeout; - for (timeout = WDC_TIMEOUT; timeout > 0; --timeout) { - if ((WDC_READ_REG(chp, wd_status) & (WDCS_BSY | WDCS_DRDY)) - == WDCS_DRDY) - return (0); - } - return (ENXIO); -} - -/* - * Read one block off the device. - */ -int -wdc_read_block(sc, wd_c) - struct wd_softc *sc; - struct wdc_command *wd_c; -{ - int i; - struct wdc_channel *chp = &sc->sc_channel; - u_int16_t *ptr = (u_int16_t*)wd_c->data; - - if (ptr == NULL) - return (0); - - for (i = wd_c->bcount; i > 0; i -= sizeof(u_int16_t)) - *ptr++ = WDC_READ_DATA(chp); - - return (0); -} - -/* - * Send a command to the device (CHS and LBA addressing). - */ -int -wdccommand(wd, wd_c) - struct wd_softc *wd; - struct wdc_command *wd_c; -{ - u_int8_t err; - struct wdc_channel *chp = &wd->sc_channel; - -#if 0 - DPRINTF(("wdccommand(%d, %d, %d, %d, %d, %d, %d)\n", - wd_c->drive, wd_c->r_command, wd_c->r_cyl, - wd_c->r_head, wd_c->r_sector, wd_c->bcount, - wd_c->r_precomp)); -#endif - - WDC_WRITE_REG(chp, wd_precomp, wd_c->r_precomp); - WDC_WRITE_REG(chp, wd_seccnt, wd_c->r_count); - WDC_WRITE_REG(chp, wd_sector, wd_c->r_sector); - WDC_WRITE_REG(chp, wd_cyl_lo, wd_c->r_cyl); - WDC_WRITE_REG(chp, wd_cyl_hi, wd_c->r_cyl >> 8); - WDC_WRITE_REG(chp, wd_sdh, - WDSD_IBM | (wd_c->drive << 4) | wd_c->r_head); - WDC_WRITE_REG(chp, wd_command, wd_c->r_command); - - if (wdc_wait_for_ready(chp) != 0) - return (ENXIO); - - if (WDC_READ_REG(chp, wd_status) & WDCS_ERR) { - DPRINTF(("wd%d: error %x\n", wd->sc_unit, - WDC_READ_REG(chp, wd_error))); - return (ENXIO); - } - - return (0); -} - -/* - * Send a command to the device (LBA48 addressing). - */ -int -wdccommandext(wd, wd_c) - struct wd_softc *wd; - struct wdc_command *wd_c; -{ - u_int8_t err; - struct wdc_channel *chp = &wd->sc_channel; - - /* Select drive, head, and addressing mode. */ - WDC_WRITE_REG(chp, wd_sdh, (wd_c->drive << 4) | WDSD_LBA); - - /* previous */ - WDC_WRITE_REG(chp, wd_features, 0); - WDC_WRITE_REG(chp, wd_seccnt, wd_c->r_count >> 8); - WDC_WRITE_REG(chp, wd_lba_hi, wd_c->r_blkno >> 40); - WDC_WRITE_REG(chp, wd_lba_mi, wd_c->r_blkno >> 32); - WDC_WRITE_REG(chp, wd_lba_lo, wd_c->r_blkno >> 24); - - /* current */ - WDC_WRITE_REG(chp, wd_features, 0); - WDC_WRITE_REG(chp, wd_seccnt, wd_c->r_count); - WDC_WRITE_REG(chp, wd_lba_hi, wd_c->r_blkno >> 16); - WDC_WRITE_REG(chp, wd_lba_mi, wd_c->r_blkno >> 8); - WDC_WRITE_REG(chp, wd_lba_lo, wd_c->r_blkno); - - /* Send command. */ - WDC_WRITE_REG(chp, wd_command, wd_c->r_command); - - if (wdc_wait_for_ready(chp) != 0) - return (ENXIO); - - if (WDC_READ_REG(chp, wd_status) & WDCS_ERR) { - DPRINTF(("wd%d: error %x\n", wd->sc_unit, - WDC_READ_REG(chp, wd_error))); - return (ENXIO); - } - - return (0); -} - -/* - * Issue 'device identify' command. - */ -int -wdc_exec_identify(wd, data) - struct wd_softc *wd; - void *data; -{ - int error; - struct wdc_command wd_c; - - memset(&wd_c, 0, sizeof(wd_c)); - - wd_c.drive = wd->sc_drive; - wd_c.r_command = WDCC_IDENTIFY; - wd_c.bcount = DEV_BSIZE; - wd_c.data = data; - - if ((error = wdccommand(wd, &wd_c)) != 0) - return (error); - - return wdc_read_block(wd, &wd_c); -} - -/* - * Issue 'read' command. - */ -int -wdc_exec_read(wd, cmd, blkno, data) - struct wd_softc *wd; - u_int8_t cmd; - daddr32_t blkno; - void *data; -{ - int error; - struct wdc_command wd_c; - - memset(&wd_c, 0, sizeof(wd_c)); - - if (wd->sc_flags & WDF_LBA48) { - /* LBA48 */ - wd_c.r_blkno = blkno; - } else if (wd->sc_flags & WDF_LBA) { - /* LBA */ - wd_c.r_sector = (blkno >> 0) & 0xff; - wd_c.r_cyl = (blkno >> 8) & 0xffff; - wd_c.r_head = (blkno >> 24) & 0x0f; - wd_c.r_head |= WDSD_LBA; - } else { - /* LHS */ - wd_c.r_sector = blkno % wd->sc_label.d_nsectors; - wd_c.r_sector++; /* Sectors begin with 1, not 0. */ - blkno /= wd->sc_label.d_nsectors; - wd_c.r_head = blkno % wd->sc_label.d_ntracks; - blkno /= wd->sc_label.d_ntracks; - wd_c.r_cyl = blkno; - wd_c.r_head |= WDSD_CHS; - } - - wd_c.data = data; - wd_c.r_count = 1; - wd_c.drive = wd->sc_drive; - wd_c.r_command = cmd; - wd_c.bcount = wd->sc_label.d_secsize; - - if (wd->sc_flags & WDF_LBA48) - error = wdccommandext(wd, &wd_c); - else - error = wdccommand(wd, &wd_c); - - if (error != 0) - return (error); - - return wdc_read_block(wd, &wd_c); -} diff --git a/sys/arch/socppc/stand/boot/wdc_obio.c b/sys/arch/socppc/stand/boot/wdc_obio.c deleted file mode 100644 index 480e83731ab..00000000000 --- a/sys/arch/socppc/stand/boot/wdc_obio.c +++ /dev/null @@ -1,99 +0,0 @@ -/* $OpenBSD: wdc_obio.c,v 1.1 2009/09/07 21:16:57 dms Exp $ */ - -/* - * Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/types.h> - -#include "libsa.h" -#include "wdvar.h" - -#define WDC_OBIO_REG_OFFSET (8 << 17) -#define WDC_OBIO_AUXREG_OFFSET (6 << 16) - -u_int8_t wdc_read_cmdreg(struct wdc_channel *, u_int8_t); -void wdc_write_cmdreg(struct wdc_channel *, u_int8_t, u_int8_t); -u_int8_t wdc_read_ctlreg(struct wdc_channel *, u_int8_t); -void wdc_write_ctlreg(struct wdc_channel *, u_int8_t, u_int8_t); - -u_int32_t wdc_base_addr[2]; - -int -wdc_obio_init(struct wdc_channel *chp, u_int chan) -{ - u_int32_t cmdreg, ctlreg; - int i; - - /* - * two channels per chip, one drive per channel - */ - if (chan >= 2 || !wdc_base_addr[chan]) - return (ENXIO); - chp->ndrives = 1; - - cmdreg = wdc_base_addr[chan] + WDC_OBIO_REG_OFFSET; - ctlreg = wdc_base_addr[chan] + WDC_OBIO_AUXREG_OFFSET; - - /* set up cmd regsiters */ - chp->c_cmdbase = (u_int8_t *)cmdreg; - chp->c_data = (u_int16_t *)(cmdreg + wd_data); - for (i = 0; i < WDC_NPORTS; i++) - chp->c_cmdreg[i] = chp->c_cmdbase + (i<<16); - /* set up shadow registers */ - chp->c_cmdreg[wd_status] = chp->c_cmdreg[wd_command]; - chp->c_cmdreg[wd_features] = chp->c_cmdreg[wd_precomp]; - /* set up ctl registers */ - chp->c_ctlbase = (u_int8_t *)ctlreg; - - chp->read_cmdreg = wdc_read_cmdreg; - chp->write_cmdreg = wdc_write_cmdreg; - chp->read_ctlreg = wdc_read_ctlreg; - chp->write_ctlreg = wdc_write_ctlreg; - - return (0); -} - -u_int8_t -wdc_read_cmdreg(struct wdc_channel *chp, u_int8_t reg) -{ - u_int8_t val; - val = *chp->c_cmdreg[reg]; - if (val == 0xf9 && reg == wd_status) - val = 0x7f; - return val; -} - -void -wdc_write_cmdreg(struct wdc_channel *chp, u_int8_t reg, u_int8_t val) -{ - *chp->c_cmdreg[reg] = val; -} - -u_int8_t -wdc_read_ctlreg(struct wdc_channel *chp, u_int8_t reg) -{ - u_int8_t val; - val = chp->c_ctlbase[reg]; - if (val == 0xf9 && reg == wd_aux_altsts) - val = 0x7f; - return val; -} - -void -wdc_write_ctlreg(struct wdc_channel *chp, u_int8_t reg, u_int8_t val) -{ - chp->c_ctlbase[reg] = val; -} diff --git a/sys/arch/socppc/stand/boot/wdvar.h b/sys/arch/socppc/stand/boot/wdvar.h deleted file mode 100644 index aa7b997df71..00000000000 --- a/sys/arch/socppc/stand/boot/wdvar.h +++ /dev/null @@ -1,138 +0,0 @@ -/* $OpenBSD: wdvar.h,v 1.3 2011/03/13 00:13:53 deraadt Exp $ */ -/* $NetBSD: wdvar.h,v 1.6 2005/12/11 12:17:06 christos Exp $ */ - -/*- - * Copyright (c) 2003 The NetBSD Foundation, Inc. - * Copyright (c) 2001 Dynarc AB, Sweden. All rights reserved. - * - * This code is derived from software written by Anders Magnusson, - * ragge@ludd.luth.se - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STAND_WDVAR_H -#define _STAND_WDVAR_H - -#include <sys/disklabel.h> - -#include <dev/ic/wdcreg.h> -#include <dev/ata/atareg.h> -#include <dev/pci/pciidereg.h> - -/* - * WD1003 / ATA Disk Controller register definitions. - */ - -/* offsets of registers in the 'regular' register region */ -#define wd_data 0 /* data register (R/W - 16 bits) */ -#define wd_error 1 /* error register (R) */ -#define wd_precomp 1 /* write precompensation (W) */ -#define wd_seccnt 2 /* sector count (R/W) */ -#define wd_ireason 2 /* interrupt reason (R/W) (for atapi) */ -#define wd_sector 3 /* first sector number (R/W) */ -#define wd_cyl_lo 4 /* cylinder address, low byte (R/W) */ -#define wd_cyl_hi 5 /* cylinder address, high byte (R/W) */ -#define wd_sdh 6 /* sector size/drive/head (R/W) */ -#define wd_command 7 /* command register (W) */ -#define wd_lba_lo 3 /* lba address, low byte (RW) */ -#define wd_lba_mi 4 /* lba address, middle byte (RW) */ -#define wd_lba_hi 5 /* lba address, high byte (RW) */ - -/* "shadow" registers; these may or may not overlap regular registers */ -#define wd_status 8 /* immediate status (R) */ -#define wd_features 9 /* features (W) */ - -/* offsets of registers in the auxiliary register region */ -#define wd_aux_altsts 0 /* alternate fixed disk status (R) */ -#define wd_aux_ctlr 0 /* fixed disk controller control (W) */ -#define WDCTL_4BIT 0x08 /* use four head bits (wd1003) */ -#define WDCTL_RST 0x04 /* reset the controller */ -#define WDCTL_IDS 0x02 /* disable controller interrupts */ - -#define WDC_TIMEOUT 2000000 -#define PCIIDE_CHANNEL_NDEV 2 -#define NUNITS (PCIIDE_CHANNEL_NDEV * PCIIDE_NUM_CHANNELS) -#define WDC_NPORTS 8 /* XXX */ -#define WDC_NSHADOWREG 2 /* XXX */ - -struct wdc_channel { - volatile u_int8_t *c_cmdbase; - volatile u_int8_t *c_ctlbase; - volatile u_int8_t *c_cmdreg[WDC_NPORTS + WDC_NSHADOWREG]; - volatile u_int16_t *c_data; - - u_int8_t ndrives; - - u_int8_t (*read_cmdreg)(struct wdc_channel *chp, u_int8_t reg); - void (*write_cmdreg)(struct wdc_channel *chp, u_int8_t reg, u_int8_t val); - u_int8_t (*read_ctlreg)(struct wdc_channel *chp, u_int8_t reg); - void (*write_ctlreg)(struct wdc_channel *chp, u_int8_t reg, u_int8_t val); -}; - -#define WDC_READ_REG(chp, reg) (chp)->read_cmdreg(chp, reg) -#define WDC_WRITE_REG(chp, reg, val) (chp)->write_cmdreg(chp, reg, val) -#define WDC_READ_CTLREG(chp, reg) (chp)->read_ctlreg(chp, reg) -#define WDC_WRITE_CTLREG(chp, reg, val) (chp)->write_ctlreg(chp, reg, val) -#define WDC_READ_DATA(chp) *(chp)->c_data - -struct wd_softc { -#define WDF_LBA 0x0001 -#define WDF_LBA48 0x0002 - u_int16_t sc_flags; - - u_int sc_part; - u_int sc_unit; - - u_int64_t sc_capacity; - - struct ataparams sc_params; - struct disklabel sc_label; - struct wdc_channel sc_channel; - u_int sc_drive; -}; - -struct wdc_command { - u_int8_t drive; /* drive id */ - - u_int8_t r_command; /* Parameters to upload to registers */ - u_int8_t r_head; - u_int16_t r_cyl; - u_int8_t r_sector; - u_int8_t r_count; - u_int8_t r_precomp; - - u_int16_t bcount; - void *data; - - u_int64_t r_blkno; -}; - -int wdc_init (struct wd_softc*, u_int); -int wdccommand (struct wd_softc*, struct wdc_command*); -int wdccommandext (struct wd_softc*, struct wdc_command*); -int wdc_exec_read (struct wd_softc*, u_int8_t, daddr32_t, void*); -int wdc_exec_identify (struct wd_softc*, void*); - - -#endif /* _STAND_WDVAR_H */ diff --git a/sys/arch/socppc/stand/mbr/Makefile b/sys/arch/socppc/stand/mbr/Makefile deleted file mode 100644 index 07bc52c4b7c..00000000000 --- a/sys/arch/socppc/stand/mbr/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# $OpenBSD: Makefile,v 1.4 2016/07/30 03:25:49 guenther Exp $ - -.include <bsd.own.mk> - -NOMAN= -#MAN= mbr.8 - -.if ${MACHINE} == "socppc" -PROG= mbr -SRCS= mbr.S -AFLAGS+=-I${.OBJDIR} -I${.CURDIR}/../../.. #-Wa,a -LDFLAGS+=-N -e start -Ttext 0 -nopie -znorelro -OBJCOPY?=objcopy - -INSTALL_STRIP= -S= ${.CURDIR}/../../../.. - -${PROG}: $(OBJS) $(DPADD) - $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LDADD) - @size $(PROG) - @if [ -x ${.OBJDIR}/${PROG} ]; then \ - ${OBJCOPY} -O binary ${PROG} ${.OBJDIR}/.tmp;\ - mv -f ${.OBJDIR}/.tmp ${.OBJDIR}/${PROG}; \ - ls -l ${.OBJDIR}/${PROG}; \ - fi - -.else -NOPROG= -.endif - -.include <bsd.prog.mk> diff --git a/sys/arch/socppc/stand/mbr/mbr.S b/sys/arch/socppc/stand/mbr/mbr.S deleted file mode 100644 index b71472d8840..00000000000 --- a/sys/arch/socppc/stand/mbr/mbr.S +++ /dev/null @@ -1,34 +0,0 @@ -#include <machine/asm.h> - -ENTRY(start) - nop - -/* space for mbr_dsn */ - . = _C_LABEL(start) + 0x1b4 - .long 0 - -/* mbr_bootsel_magic */ - . = _C_LABEL(start) + 0x1b8 - .word 0 - -/* - * MBR partition table - */ - . = _C_LABEL(start) + 0x1be -_pbr_part0: - .byte 0x80, 0, 0, 0, 0x27, 0, 0, 0 - .byte 0x3f, 0, 0, 0, 0, 0x02, 0, 0 -_pbr_part1: - .byte 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0 -_pbr_part2: - .byte 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0 -_pbr_part3: - .byte 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0 - - . = _C_LABEL(start) + 0x1fe -magic: - .word 0x55aa -mbr_end: diff --git a/sys/arch/socppc/stand/mkboot/Makefile b/sys/arch/socppc/stand/mkboot/Makefile deleted file mode 100644 index 9fc8ddefe30..00000000000 --- a/sys/arch/socppc/stand/mkboot/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# $OpenBSD: Makefile,v 1.4 2012/09/02 17:22:53 pascal Exp $ - -.include "${.CURDIR}/../Makefile.inc" - -MAN= mkboot.8 - -.if ${MACHINE} == "socppc" -PROG= mkboot -DPADD= ${LIBZ} -LDADD= -lz -.else -NOPROG= -.endif - -.include <bsd.prog.mk> diff --git a/sys/arch/socppc/stand/mkboot/mkboot.8 b/sys/arch/socppc/stand/mkboot/mkboot.8 deleted file mode 100644 index 08dd6664950..00000000000 --- a/sys/arch/socppc/stand/mkboot/mkboot.8 +++ /dev/null @@ -1,46 +0,0 @@ -.\" $OpenBSD: mkboot.8,v 1.3 2009/01/31 21:10:09 grange Exp $ -.\" -.\" Copyright (c) 2008 Mark Kettenis <kettenis@openbsd.org> -.\" -.\" Permission to use, copy, modify, and distribute this software for any -.\" purpose with or without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.\" -.Dd $Mdocdate: January 31 2009 $ -.Dt MKBOOT 8 socppc -.Os -.Sh NAME -.Nm mkboot -.Nd create U-Boot files -.Sh SYNOPSIS -.Nm mkboot -.Op Fl e Ar entry -.Op Fl l Ar loadaddr -.Ar infile outfile -.Sh DESCRIPTION -The -.Nm -utility creates images suitable for loading using the U-Boot bootloader. -.Pp -The options are as follows: -.Bl -tag -width Ds -.It Fl e Ar entry -Sets the entry point to -.Ar entry . -.It Fl l Ar loadaddr -Sets the load address to -.Ar loadaddr . -.El -.Sh HISTORY -A -.Nm -utility first appeared in -.Ox 4.4 . diff --git a/sys/arch/socppc/stand/mkboot/mkboot.c b/sys/arch/socppc/stand/mkboot/mkboot.c deleted file mode 100644 index 55bf01935c4..00000000000 --- a/sys/arch/socppc/stand/mkboot/mkboot.c +++ /dev/null @@ -1,145 +0,0 @@ -/* $OpenBSD: mkboot.c,v 1.2 2009/01/31 21:10:09 grange Exp $ */ - -/* - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/types.h> -#include <err.h> -#include <fcntl.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> -#include <unistd.h> -#include <zlib.h> - -#define IH_OS_OPENBSD 1 /* OpenBSD */ - -#define IH_CPU_PPC 7 /* PowerPC */ - -#define IH_TYPE_STANDALONE 1 /* Standalone */ - -#define IH_COMP_NONE 0 /* No compression */ - -#define IH_MAGIC 0x27051956 /* Image Magic Number */ -#define IH_NMLEN 32 /* Image Name Length */ - -struct image_header { - uint32_t ih_magic; - uint32_t ih_hcrc; - uint32_t ih_time; - uint32_t ih_size; - uint32_t ih_load; - uint32_t ih_ep; - uint32_t ih_dcrc; - uint8_t ih_os; - uint8_t ih_arch; - uint8_t ih_type; - uint8_t ih_comp; - uint8_t ih_name[IH_NMLEN]; -}; - -extern char *__progname; - -void usage(void); - -int -main(int argc, char *argv[]) -{ - struct image_header ih; - const char *iname, *oname; - int ifd, ofd; - u_long crc; - ssize_t nbytes; - char buf[BUFSIZ]; - int c, ep, load; - - ep = load = 0; - while ((c = getopt(argc, argv, "e:l:")) != -1) { - switch (c) { - case 'e': - sscanf(optarg, "0x%x", &ep); - break; - case 'l': - sscanf(optarg, "0x%x", &load); - break; - default: - usage(); - } - } - if (argc - optind != 2) - usage(); - - iname = argv[optind++]; - oname = argv[optind++]; - - /* Initialize U-Boot header. */ - bzero(&ih, sizeof ih); - ih.ih_magic = IH_MAGIC; - ih.ih_time = time(NULL); - ih.ih_load = load; - ih.ih_ep = ep; - ih.ih_os = IH_OS_OPENBSD; - ih.ih_arch = IH_CPU_PPC; - ih.ih_type = IH_TYPE_STANDALONE; - ih.ih_comp = IH_COMP_NONE; - strlcpy(ih.ih_name, "boot", sizeof ih.ih_name); - - ifd = open(iname, O_RDONLY); - if (ifd < 0) - err(1, "%s", iname); - - ofd = open(oname, O_RDWR | O_TRUNC | O_CREAT, 0644); - if (ofd < 0) - err(1, "%s", oname); - - /* Write initial header. */ - if (write(ofd, &ih, sizeof ih) != sizeof ih) - err(1, "%s", oname); - - /* Copy data, calculating the data CRC as we go. */ - crc = crc32(0L, Z_NULL, 0); - while ((nbytes = read(ifd, buf, sizeof buf)) != 0) { - if (nbytes == -1) - err(1, "%s", iname); - if (write(ofd, buf, nbytes) != nbytes) - err(1, "%s", oname); - crc = crc32(crc, buf, nbytes); - ih.ih_size += nbytes; - } - ih.ih_dcrc = htonl(crc); - - /* Calculate header CRC. */ - crc = crc32(0, (void *)&ih, sizeof ih); - ih.ih_hcrc = htonl(crc); - - /* Write finalized header. */ - if (lseek(ofd, 0, SEEK_SET) != 0) - err(1, "%s", oname); - if (write(ofd, &ih, sizeof ih) != sizeof ih) - err(1, "%s", oname); - - return(0); -} - -void -usage(void) -{ - (void)fprintf(stderr, - "usage: %s [-e entry] [-l loadaddr] infile outfile\n", __progname); - exit(1); -} |