summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-08-18 19:09:53 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-08-18 19:09:53 +0000
commit6b0d83b161631a1d2b11af80ce91dad16accf085 (patch)
tree01ad19edb3b090f4587924d4ab2464a5b479bdfa /sys/arch/sparc64
parent036e26731898f22d8376c0b258fe98b4e619193c (diff)
A very minimal skeleton. Based on code in NetBSD and sparc.
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/conf/Makefile.sparc64165
-rw-r--r--sys/arch/sparc64/conf/TEST50
-rw-r--r--sys/arch/sparc64/conf/files.sparc64118
3 files changed, 333 insertions, 0 deletions
diff --git a/sys/arch/sparc64/conf/Makefile.sparc64 b/sys/arch/sparc64/conf/Makefile.sparc64
new file mode 100644
index 00000000000..74995f4332d
--- /dev/null
+++ b/sys/arch/sparc64/conf/Makefile.sparc64
@@ -0,0 +1,165 @@
+# Makefile for OpenBSD
+
+.include <bsd.own.mk>
+
+AS?= as
+CC?= cc
+CPP?= cpp
+LD?= ld
+MKDEP?= mkdep
+STRIP?= strip
+TOUCH?= touch
+
+# source tree is located via $S relative to the compilation directory
+.ifndef S
+S!= cd ../../../..; pwd
+.endif
+SPARC64= $S/arch/sparc64
+
+INCLUDES= -nostdinc -I. -I$S/arch -I$S
+CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Dsparc64
+
+CDIAGFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
+ -Wno-uninitialized -Wno-format -Wno-main
+
+CMACHFLAGS= -Wa,-Av9a, -mno-fpu
+
+CFLAGS= ${DEBUG} -O2 ${CDIAGFLAGS} ${CMACHFLAGS} ${COPTS}
+AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a
+LINKFLAGS= -N -p -Ttext 01000000 -Tdata 01800000 -e start
+STRIPFLAGS= -d
+TOUCHFLAGS= -f -c
+
+HOSTCC= ${CC}
+HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
+HOSTED_CFLAGS= ${CFLAGS}
+
+### find out what to use for libkern
+.include "$S/lib/libkern/Makefile.inc"
+.ifndef PROF
+LIBKERN= ${KERNLIB}
+.else
+LIBKERN= ${KERNLIB_PROF}
+.endif
+
+### find out what to use for libcompat
+.include "$S/compat/common/Makefile.inc"
+.ifndef PROF
+LIBCOMPAT= ${COMPATLIB}
+.else
+LIBCOMPAT= ${COMPATLIB_PROF}
+.endif
+
+# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
+# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
+# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
+# is marked as config-dependent.
+
+NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
+NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
+
+DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
+DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
+
+NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
+NORMAL_S_C= ${CC} ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $<
+
+HOSTED_C= ${HOSTCC} ${HOSTED_CFLAGS} ${HOSTED_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_OBJ= locore.o \
+ param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
+SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
+SYSTEM_LD_HEAD= @rm -f $@
+SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
+ ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
+SYSTEM_LD_TAIL= @size $@; chmod 755 $@
+
+DEBUG?=
+.if ${DEBUG} == "-g"
+LINKFLAGS+= -X
+SYSTEM_LD_TAIL+=; \
+ echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
+ echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
+.else
+LINKFLAGS+= -x
+.endif
+
+%LOAD
+
+assym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
+ sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} \
+ ${PARAM} < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
+ mv -f assym.h.tmp assym.h
+
+param.c: $S/conf/param.c
+ rm -f param.c
+ cp $S/conf/param.c .
+
+param.o: param.c Makefile
+ ${NORMAL_C_C}
+
+ioconf.o: ioconf.c
+ ${NORMAL_C}
+
+newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
+ sh $S/conf/newvers.sh
+ ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
+
+
+clean::
+ rm -f eddep *bsd *bsd.gdb tags *.[io] [a-z]*.s \
+ [Ee]rrs linterrs makelinks genassym genassym.o assym.h
+
+lint:
+ @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
+ ${CFILES} ${SPARC64}/sparc64/swapgeneric.c ioconf.c param.c | \
+ grep -v 'static function .* unused'
+
+tags:
+ @echo "see $S/kern/Makefile for tags"
+
+links:
+ egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
+ sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
+ echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
+ sort -u | comm -23 - dontlink | \
+ sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
+ sh makelinks && rm -f dontlink
+
+SRCS= ${SPARC64}/sparc64/locore.s \
+ param.c ioconf.c ${CFILES} ${SFILES}
+depend: .depend
+.depend: ${SRCS} assym.h param.c
+ ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
+ ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
+.if !empty(SFILES)
+ ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
+.endif
+
+locore.o: ${SPARC64}/sparc64/locore.s assym.h
+ ${NORMAL_S}
+
+# The install target can be redefined by putting a
+# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
+MACHINE_NAME!= uname -n
+install: install-kernel-${MACHINE_NAME}
+.if !target(install-kernel-${MACHINE_NAME}})
+install-kernel-${MACHINE_NAME}:
+ rm -f /obsd
+ ln /bsd /obsd
+ cp bsd /nbsd
+ mv /nbsd /bsd
+.endif
+
+%RULES
diff --git a/sys/arch/sparc64/conf/TEST b/sys/arch/sparc64/conf/TEST
new file mode 100644
index 00000000000..680e67c3d36
--- /dev/null
+++ b/sys/arch/sparc64/conf/TEST
@@ -0,0 +1,50 @@
+# $NetBSD: GENERIC32,v 1.18 2001/07/20 00:07:12 eeh Exp $
+
+machine sparc64
+
+option DIAGNOSTIC
+option KMEMSTATS
+
+option SUN4U
+option _LP64
+
+# XXX - remove this later.
+option DEBUG
+option DDB_SAFE_CONSOLE
+# XXX - remove this later.
+
+maxusers 64
+
+config bsd swap generic
+
+# Main bus and CPU .. all systems.
+mainbus0 at root
+cpu0 at mainbus0
+
+# Bus types found on SPARC systems.
+
+sbus0 at mainbus0 # Ultra 1
+
+#### Standard system devices -- all required for a given architecture
+
+## PROM console driver -- if all else fails
+pcons0 at mainbus0 # PROM console
+
+## Mostek clock found on 4/300, sun4c, sun4m and sun4u systems.
+## The Mostek clock NVRAM is the "eeprom" on sun4/300 systems.
+clock* at sbus? slot ? offset ?
+
+## Timer chip found on 4/300, sun4c, sun4m and (some) sun4u systems.
+timer* at mainbus0 # sun4c
+
+#### Serial port configuration
+
+## Zilog 8530 serial chips. Each has two-channels.
+## zs0 is ttya and ttyb. zs1 is the keyboard and mouse.
+zs* at sbus? slot ? offset ?
+zstty* at zs? channel ? # ttya
+kbd0 at zstty?
+ms0 at zstty?
+
+#pseudo-device md 1
+
diff --git a/sys/arch/sparc64/conf/files.sparc64 b/sys/arch/sparc64/conf/files.sparc64
new file mode 100644
index 00000000000..bfddcbdb7ae
--- /dev/null
+++ b/sys/arch/sparc64/conf/files.sparc64
@@ -0,0 +1,118 @@
+# $NetBSD: files.sparc64,v 1.50 2001/08/10 20:53:50 eeh Exp $
+
+# maxpartitions must be first item in files.${ARCH}
+maxpartitions 8
+
+maxusers 2 8 1024
+
+define mainbus {}
+device mainbus: pcibus, mainbus
+attach mainbus at root
+
+device pcons
+attach pcons at mainbus
+file arch/sparc64/dev/pcons.c pcons needs-flag
+
+include "dev/sun/files.sun"
+
+device sbus { slot = -1, offset = -1 }
+attach sbus at mainbus
+file arch/sparc64/dev/sbus.c sbus
+
+# IOMMU is for both
+file arch/sparc64/dev/iommu.c sbus | psycho
+
+device clock: mk48txx
+attach clock at mainbus, sbus with clock_sbus
+
+device timer
+attach timer at mainbus, sbus
+
+device eeprom
+attach eeprom at sbus
+file arch/sparc64/sparc64/clock.c
+file dev/clock_subr.c
+
+device cpu
+attach cpu at mainbus
+file arch/sparc64/sparc64/cpu.c
+
+#
+# Console related stuff
+#
+
+device zs {channel = -1}
+attach zs at mainbus, sbus
+file arch/sparc64/dev/zs.c zs needs-flag
+file dev/ic/z8530sc.c zs
+
+define zstty {}
+device zstty: tty
+attach zstty at zs
+file dev/ic/z8530tty.c zstty needs-flag
+
+device kbd
+attach kbd at zs with kbd_zs
+attach kbd at zstty
+file dev/sun/kbd_zs.c kbd_zs
+file dev/sun/kbd.c kbd needs-flag
+file dev/sun/kbd_tables.c kbd
+file arch/sparc64/dev/kd.c kbd
+file dev/sun/sunkbd.c kbd needs-flag
+
+device ms
+attach ms at zs with ms_zs
+attach ms at zstty
+file dev/sun/ms_zs.c ms_zs
+file dev/sun/ms.c ms needs-flag
+file dev/sun/sunms.c ms needs-flag
+
+file dev/cons.c
+file arch/sparc64/dev/consinit.c
+
+file arch/sparc/fpu/fpu.c
+file arch/sparc/fpu/fpu_add.c
+file arch/sparc/fpu/fpu_compare.c
+file arch/sparc/fpu/fpu_div.c
+file arch/sparc/fpu/fpu_explode.c
+file arch/sparc/fpu/fpu_implode.c
+file arch/sparc/fpu/fpu_mul.c
+file arch/sparc/fpu/fpu_sqrt.c
+file arch/sparc/fpu/fpu_subr.c
+
+# N.B.: optimizer breaks pmap.c and/or cache.c somehow -- have not
+# identified the exact problem yet. NOOPT_C suffices for now.
+file arch/sparc64/sparc64/autoconf.c
+file arch/sparc64/sparc64/cache.c
+file arch/sparc64/sparc64/conf.c
+file arch/sparc64/sparc64/emul.c
+file arch/sparc64/sparc64/in_cksum.S
+file arch/sparc64/sparc64/in4_cksum.c inet
+file arch/sparc64/sparc64/intr.c
+file arch/sparc64/sparc64/kgdb_machdep.c kgdb
+# sparc/sparc/locore.s is handled specially in the makefile,
+# because it must come first in the "ld" command line.
+file arch/sparc64/sparc64/locore2.c
+file arch/sparc64/sparc64/machdep.c
+file arch/sparc64/sparc64/process_machdep.c
+file arch/sparc64/sparc64/procfs_machdep.c procfs
+file arch/sparc64/sparc64/mem.c
+file arch/sparc64/sparc64/openprom.c
+file arch/sparc64/sparc64/openfirm.c
+file arch/sparc64/sparc64/ofw_machdep.c
+file arch/sparc64/sparc64/pmap.c
+# the following overrides the generic "sys_process.c"
+# commented out by deraadt
+#file arch/sparc64/sparc64/sys_process.c
+file arch/sparc64/sparc64/sys_machdep.c
+file arch/sparc64/sparc64/trap.c
+file arch/sparc64/sparc64/vm_machdep.c
+file arch/sparc64/sparc64/disksubr.c
+
+file arch/sparc64/sparc64/db_interface.c ddb | kgdb
+file arch/sparc64/sparc64/db_trace.c ddb
+file arch/sparc64/sparc64/db_disasm.c ddb
+#file ddb/db_aout.c ddb_aout
+#file ddb/db_elf.c ddb
+
+file arch/sparc64/dev/md_root.c memory_disk_hooks