Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/arch/sparc/stand move these from arch/sparc64/stand...
details: https://anonhg.NetBSD.org/src/rev/411e425e5fdd
branches: netbsd-1-5
changeset: 489242:411e425e5fdd
user: mrg <mrg%NetBSD.org@localhost>
date: Sat Aug 26 00:05:15 2000 +0000
description:
move these from arch/sparc64/stand; approved by thorpej.
diffstat:
sys/arch/sparc/stand/bootblk/Makefile | 67 ++
sys/arch/sparc/stand/bootblk/bootblk.fth | 603 ++++++++++++++++++++
sys/arch/sparc/stand/bootblk/genassym.sh | 169 +++++
sys/arch/sparc/stand/bootblk/genfth.cf | 161 +++++
sys/arch/sparc/stand/ofwboot.net/Makefile | 8 +
sys/arch/sparc/stand/ofwboot/Locore.c | 866 ++++++++++++++++++++++++++++++
sys/arch/sparc/stand/ofwboot/Makefile | 109 +++
sys/arch/sparc/stand/ofwboot/alloc.c | 214 +++++++
sys/arch/sparc/stand/ofwboot/boot.c | 631 +++++++++++++++++++++
sys/arch/sparc/stand/ofwboot/elfXX_exec.c | 206 +++++++
sys/arch/sparc/stand/ofwboot/md5.h | 55 +
sys/arch/sparc/stand/ofwboot/net.c | 195 ++++++
sys/arch/sparc/stand/ofwboot/netif_of.c | 240 ++++++++
sys/arch/sparc/stand/ofwboot/ofdev.c | 528 ++++++++++++++++++
sys/arch/sparc/stand/ofwboot/ofdev.h | 52 +
sys/arch/sparc/stand/ofwboot/openfirm.h | 58 ++
sys/arch/sparc/stand/ofwboot/srt0.s | 210 +++++++
sys/arch/sparc/stand/ofwboot/version | 8 +
18 files changed, 4380 insertions(+), 0 deletions(-)
diffs (truncated from 4453 to 300 lines):
diff -r 5125964384c9 -r 411e425e5fdd sys/arch/sparc/stand/bootblk/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sparc/stand/bootblk/Makefile Sat Aug 26 00:05:15 2000 +0000
@@ -0,0 +1,67 @@
+# $NetBSD: Makefile,v 1.1.2.2 2000/08/26 00:05:22 mrg Exp $
+
+CURDIR= ${.CURDIR}
+S= ${CURDIR}/../../../..
+
+#
+# Override normal settings
+#
+
+PROG= bootblk
+SRCS= bootblk.fth
+OBJS=
+CLEANFILES= assym.fth.h assym.fth.h.tmp machine sparc \
+ bootblk bootblk.text bootblk.text.tmp
+
+NOMAN=
+STRIPFLAG=
+
+# deal with Solaris vs. NetBSD build environments for now ..
+OS!=uname -s
+.if (${OS} == "NetBSD")
+USE_GENASSYM?= no
+SVR4=
+.else
+USE_GENASSYM?= yes
+SVR4=-U__SVR4 -U__svr4__ -D__NetBSD__
+.endif
+
+INCLUDES= -I. -I$S/arch -I$S -nostdinc
+CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_LKM ${SVR4}
+
+#all:: bootblk.text bootblk
+
+#clean::
+# rm assym.fth.h bootblk.text machine bootblk
+
+sparc:
+ ln -s ${.CURDIR}/../../../sparc/include sparc
+
+machine:
+ ln -s ${.CURDIR}/../../../${MACHINE}/include machine
+
+assym.fth.h: ${.CURDIR}/genassym.sh genfth.cf machine
+ sh ${.CURDIR}/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
+ <${.CURDIR}/genfth.cf >assym.fth.h.tmp && \
+ mv -f assym.fth.h.tmp assym.fth.h
+
+bootblk.text: bootblk.fth assym.fth.h
+ awk '/fload/ { print "#include \"" $$2 "\"" }; !/fload/' \
+ ${.CURDIR}/bootblk.fth | /usr/bin/cpp -P >bootblk.text.tmp &&
+ mv -f bootblk.text.tmp bootblk.text
+
+bootblk: bootblk.fth assym.fth.h
+ fgen -o bootblk ${.CURDIR}/bootblk.fth
+
+beforedepend:
+ @touch .depend
+
+#
+# The following are if you grab the fakeboot program from the Sun website
+#
+
+fake: bootblk bootblk.text
+ ../fakeboot/fakeboot -elf32 <bootblk >/bootblk
+ ../fakeboot/fakeboot -elf32 <bootblk.text >/bootblk.text
+
+.include <bsd.prog.mk>
diff -r 5125964384c9 -r 411e425e5fdd sys/arch/sparc/stand/bootblk/bootblk.fth
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sparc/stand/bootblk/bootblk.fth Sat Aug 26 00:05:15 2000 +0000
@@ -0,0 +1,603 @@
+\ $NetBSD: bootblk.fth,v 1.1.2.2 2000/08/26 00:05:22 mrg Exp $
+\
+\ IEEE 1275 Open Firmware Boot Block
+\
+\ Parses disklabel and UFS and loads the file called `ofwboot'
+\
+\
+\ Copyright (c) 1998 Eduardo Horvath.
+\ 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 Eduardo Horvath.
+\ 4. The name of the author may not be used to endorse or promote products
+\ derived from this software withough 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.
+\
+
+offset16
+hex
+headers
+
+false value boot-debug?
+
+\
+\ First some housekeeping: Open /chosen and set up vectors into
+\ client-services
+
+" /chosen" find-package 0= if ." Cannot find /chosen" 0 then
+constant chosen-phandle
+
+" /openprom/client-services" find-package 0= if
+ ." Cannot find client-services" cr abort
+then constant cif-phandle
+
+defer cif-claim ( align size virt -- base )
+defer cif-release ( size virt -- )
+defer cif-open ( cstr -- ihandle|0 )
+defer cif-close ( ihandle -- )
+defer cif-read ( len adr ihandle -- #read )
+defer cif-seek ( low high ihandle -- -1|0|1 )
+\ defer cif-peer ( phandle -- phandle )
+\ defer cif-getprop ( len adr cstr phandle -- )
+
+: find-cif-method ( method,len -- xf )
+ cif-phandle find-method drop
+;
+
+" claim" find-cif-method to cif-claim
+" open" find-cif-method to cif-open
+" close" find-cif-method to cif-close
+" read" find-cif-method to cif-read
+" seek" find-cif-method to cif-seek
+
+: twiddle ( -- ) ." ." ; \ Need to do this right. Just spit out periods for now.
+
+\
+\ Support routines
+\
+
+: strcmp ( s1 l1 s2 l2 -- true:false )
+ rot tuck <> if 3drop false exit then
+ comp 0=
+;
+
+\ Move string into buffer
+
+: strmov ( s1 l1 d -- d l1 )
+ dup 2over swap -rot ( s1 l1 d s1 d l1 )
+ move ( s1 l1 d )
+ rot drop swap
+;
+
+\ Move s1 on the end of s2 and return the result
+
+: strcat ( s1 l1 s2 l2 -- d tot )
+ 2over swap ( s1 l1 s2 l2 l1 s1 )
+ 2over + rot ( s1 l1 s2 l2 s1 d l1 )
+ move rot + ( s1 s2 len )
+ rot drop ( s2 len )
+;
+
+: strchr ( s1 l1 c -- s2 l2 )
+ begin
+ dup 2over 0= if ( s1 l1 c c s1 )
+ 2drop drop exit then
+ c@ = if ( s1 l1 c )
+ drop exit then
+ -rot /c - swap ca1+ ( c l2 s2 )
+ swap rot
+ again
+;
+
+
+: cstr ( ptr -- str len )
+ dup
+ begin dup c@ 0<> while + repeat
+ over -
+;
+
+\
+\ BSD FFS parameters
+\
+
+fload assym.fth.h
+
+sbsize buffer: sb-buf
+-1 value boot-ihandle
+dev_bsize value bsize
+
+: strategy ( addr size start -- nread )
+ bsize * 0 " seek" boot-ihandle $call-method
+ -1 = if
+ ." strategy: Seek failed" cr
+ abort
+ then
+ " read" boot-ihandle $call-method
+;
+
+\
+\ Cylinder group macros
+\
+
+: cgbase ( cg fs -- cgbase ) fs_fpg l@ * ;
+: cgstart ( cg fs -- cgstart )
+ 2dup fs_cgmask l@ not and ( cg fs stuff -- )
+ over fs_cgoffset l@ * -rot ( stuffcg fs -- )
+ cgbase +
+;
+: cgdmin ( cg fs -- 1st-data-block ) dup fs_dblkno l@ -rot cgstart + ;
+: cgimin ( cg fs -- inode-block ) dup fs_iblkno l@ -rot cgstart + ;
+: cgsblock ( cg fs -- super-block ) dup fs_sblkno l@ -rot cgstart + ;
+: cgstod ( cg fs -- cg-block ) dup fs_cblkno l@ -rot cgstart + ;
+
+\
+\ Block and frag position macros
+\
+
+: blkoff ( pos fs -- off ) fs_qbmask x@ and ;
+: fragoff ( pos fs -- off ) fs_qfmask x@ and ;
+: lblktosize ( blk fs -- off ) fs_bshift l@ << ;
+: lblkno ( pos fs -- off ) fs_bshift l@ >> ;
+: numfrags ( pos fs -- off ) fs_fshift l@ >> ;
+: blkroundup ( pos fs -- off ) dup fs_bmask l@ -rot fs_qbmask x@ + and ;
+: fragroundup ( pos fs -- off ) dup fs_fmask l@ -rot fs_qfmask x@ + and ;
+\ : fragroundup ( pos fs -- off ) tuck fs_qfmask x@ + swap fs_fmask l@ and ;
+: fragstoblks ( pos fs -- off ) fs_fragshift l@ >> ;
+: blkstofrags ( blk fs -- frag ) fs_fragshift l@ << ;
+: fragnum ( fsb fs -- off ) fs_frag l@ 1- and ;
+: blknum ( fsb fs -- off ) fs_frag l@ 1- not and ;
+: dblksize ( lbn dino fs -- size )
+ -rot ( fs lbn dino )
+ di_size x@ ( fs lbn di_size )
+ -rot dup 1+ ( di_size fs lbn lbn+1 )
+ 2over fs_bshift l@ ( di_size fs lbn lbn+1 di_size b_shift )
+ rot swap << >= ( di_size fs lbn res1 )
+ swap ndaddr >= or if ( di_size fs )
+ swap drop fs_bsize l@ exit ( size )
+ then tuck blkoff swap fragroundup ( size )
+;
+
+
+: ino-to-cg ( ino fs -- cg ) fs_ipg l@ / ;
+: ino-to-fsbo ( ino fs -- fsb0 ) fs_inopb l@ mod ;
+: ino-to-fsba ( ino fs -- ba ) \ Need to remove the stupid stack diags someday
+ 2dup ( ino fs ino fs )
+ ino-to-cg ( ino fs cg )
+ over ( ino fs cg fs )
+ cgimin ( ino fs inode-blk )
+ -rot ( inode-blk ino fs )
+ tuck ( inode-blk fs ino fs )
+ fs_ipg l@ ( inode-blk fs ino ipg )
+ mod ( inode-blk fs mod )
+ swap ( inode-blk mod fs )
+ dup ( inode-blk mod fs fs )
+ fs_inopb l@ ( inode-blk mod fs inopb )
+ rot ( inode-blk fs inopb mod )
+ swap ( inode-blk fs mod inopb )
+ / ( inode-blk fs div )
+ swap ( inode-blk div fs )
+ blkstofrags ( inode-blk frag )
+ +
+;
+: fsbtodb ( fsb fs -- db ) fs_fsbtodb l@ << ;
+
+\
+\ File stuff
+\
+
+niaddr /w* constant narraysize
+
+struct
+ 8 field >f_ihandle \ device handle
+ 8 field >f_seekp \ seek pointer
+ 8 field >f_fs \ pointer to super block
+ dinode_SIZEOF field >f_di \ copy of on-disk inode
+ 8 field >f_buf \ buffer for data block
+ 4 field >f_buf_size \ size of data block
+ 4 field >f_buf_blkno \ block number of data block
+constant file_SIZEOF
+
+file_SIZEOF buffer: the-file
+sb-buf the-file >f_fs x!
+
+dinode_SIZEOF buffer: cur-inode
+h# 2000 buffer: indir-block
+-1 value indir-addr
Home |
Main Index |
Thread Index |
Old Index