diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-05-16 22:51:31 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-05-16 22:51:31 +0000 |
commit | 196add41e6dfb1dd4688aa01eb694ae821ec3d98 (patch) | |
tree | 79edd11552e9efb29c6e0c0c6eaa8f8f147b060b /sys/arch | |
parent | 5bc4eed6cde3662c36ca879d061c79ca9d3997a8 (diff) |
Cleanup of mvme88k standalone code, with rewritten startup code with
fewer assembly statements and much less magic, a few display artefacts
removed, and private definitions moved out of the main prom.h.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/mvme88k/include/prom.h | 27 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/bootxx/Makefile | 8 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/bugcrt/Makefile.inc | 8 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/bugcrt/crt.c | 139 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/libbug/libbug.h | 23 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/libbug/putchar.c | 18 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/libbug/return.c | 10 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/libsa/Makefile | 14 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/libsa/Makefile.inc | 3 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/libsa/SRT0.S | 84 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/libsa/SRT1.c | 118 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/libsa/exec_mvme.c | 19 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/netboot/Makefile | 9 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/netboot/boot.c | 13 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/tftpboot/Makefile | 9 |
15 files changed, 114 insertions, 388 deletions
diff --git a/sys/arch/mvme88k/include/prom.h b/sys/arch/mvme88k/include/prom.h index a392d5cd117..deb2e1486b7 100644 --- a/sys/arch/mvme88k/include/prom.h +++ b/sys/arch/mvme88k/include/prom.h @@ -1,4 +1,4 @@ -/* $OpenBSD: prom.h,v 1.15 2005/12/11 21:45:31 miod Exp $ */ +/* $OpenBSD: prom.h,v 1.16 2006/05/16 22:51:28 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -168,35 +168,10 @@ struct mvmeprom_dskio { }; #define MVMEPROM_BLOCK_SIZE 256 -struct mvmeprom_args { - u_int dev_lun; - u_int ctrl_lun; - u_int flags; - u_int ctrl_addr; - u_int entry; - u_int conf_blk; - char *arg_start; - char *arg_end; - char *nbarg_start; - char *nbarg_end; - u_int cputyp; -}; - extern unsigned long bugvec[2], sysbugvec[2]; /* BUG trap vector copies */ #endif /* _LOCORE */ -#define MVMEPROM_REG_DEVLUN "r2" -#define MVMEPROM_REG_CTRLLUN "r3" -#define MVMEPROM_REG_FLAGS "r4" -#define MVMEPROM_REG_CTRLADDR "r5" -#define MVMEPROM_REG_ENTRY "r6" -#define MVMEPROM_REG_CONFBLK "r7" -#define MVMEPROM_REG_ARGSTART "r8" -#define MVMEPROM_REG_ARGEND "r9" -#define MVMEPROM_REG_NBARGSTART "r10" -#define MVMEPROM_REG_NBARGEND "r11" - #ifndef RB_NOSYM #define RB_NOSYM 0x4000 #endif diff --git a/sys/arch/mvme88k/stand/bootxx/Makefile b/sys/arch/mvme88k/stand/bootxx/Makefile index 234439b4656..ffad25ccd1d 100644 --- a/sys/arch/mvme88k/stand/bootxx/Makefile +++ b/sys/arch/mvme88k/stand/bootxx/Makefile @@ -1,8 +1,8 @@ # from: @(#)Makefile 8.1 (Berkeley) 6/10/93 -# $OpenBSD: Makefile,v 1.10 2005/09/11 13:36:00 deraadt Exp $ +# $OpenBSD: Makefile,v 1.11 2006/05/16 22:51:30 miod Exp $ S= ${.CURDIR}/../../../.. -DEFS=-DSTAGE2_RELOC=${STAGE2_RELOC} +DEFS=-DSTAGE2_RELOC=${STAGE2_RELOC} INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \ -I${.CURDIR}/../../include -I${S} -I${S}/lib/libsa CFLAGS+=${INCPATH} ${DEFS} ${COPTS} @@ -20,12 +20,12 @@ LIBS= ${LIBSA} ${LIBBUG} ${LIBZ} OBJS= ${SRCS:N*.h:R:S/$/.o/g} BOOTS= bootxx -ALL= ${BOOTS} +ALL= ${BOOTS} all: ${ALL} bootxx: ${OBJS} ${STAGE1} ${LIBS} - ${LD} -N -T ${STAGE1_RELOC} ${STAGE1} -o $@ \ + ${LD} -S -N -T ${STAGE1_RELOC} ${STAGE1} -o $@ \ ${OBJS} ${LIBS} `cc -print-libgcc-file-name` install: diff --git a/sys/arch/mvme88k/stand/bugcrt/Makefile.inc b/sys/arch/mvme88k/stand/bugcrt/Makefile.inc index 52a7b8cc7b1..82bf2374757 100644 --- a/sys/arch/mvme88k/stand/bugcrt/Makefile.inc +++ b/sys/arch/mvme88k/stand/bugcrt/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.4 2001/01/13 05:19:01 smurph Exp $ +# $OpenBSD: Makefile.inc,v 1.5 2006/05/16 22:51:30 miod Exp $ BUG_CRT_DIR=${S}/arch/mvme88k/stand/bugcrt @@ -10,15 +10,15 @@ STAGE2=${BUGCRT_DIR}/stage2crt.o SINGLE=${BUGCRT_DIR}/singlecrt.o $(STAGE1): .NOTMAIN __always_make_bugcrt - @echo making sure the stage1crt.o is up to date... + @echo making sure stage1crt.o is up to date... @(cd ${BUG_CRT_DIR}; ${MAKE} stage1crt.o) $(STAGE2): .NOTMAIN __always_make_bugcrt - @echo making sure the stage2crt.o is up to date... + @echo making sure stage2crt.o is up to date... @(cd ${BUG_CRT_DIR}; ${MAKE} stage2crt.o) $(SINGLE): .NOTMAIN __always_make_bugcrt - @echo making sure the singlecrt.o is up to date... + @echo making sure singlecrt.o is up to date... @(cd ${BUG_CRT_DIR}; ${MAKE} singlecrt.o) __always_make_bugcrt: .NOTMAIN diff --git a/sys/arch/mvme88k/stand/bugcrt/crt.c b/sys/arch/mvme88k/stand/bugcrt/crt.c index 73f0ad09837..150be1abed2 100644 --- a/sys/arch/mvme88k/stand/bugcrt/crt.c +++ b/sys/arch/mvme88k/stand/bugcrt/crt.c @@ -1,91 +1,62 @@ -/* $OpenBSD: crt.c,v 1.5 2003/10/02 13:24:39 miod Exp $ */ +/* $OpenBSD: crt.c,v 1.6 2006/05/16 22:51:30 miod Exp $ */ #include <sys/types.h> #include <machine/prom.h> -struct mvmeprom_args bugargs = { 1 }; /* not BSS */ +#include "stand.h" +#include "libbug.h" -asm (".text"); -/* pseudo reset vector */ -asm (STACK_ASM_OP); /* initial sp value */ -asm (".long _start"); /* initial ip value */ +struct mvmeprom_args bugargs; + +__asm__ (".text"); +__asm__ (STACK_ASM_OP); /* initial sp value */ +__asm__ (".long _start"); /* initial ip value */ + +extern void main(void); void -start() +start(u_int dev_lun, u_int ctrl_lun, u_int flags, u_int ctrl_addr, u_int entry, + u_int conf_blk, char *arg_start, char *arg_end) { - extern int edata, end; - struct mvmeprom_brdid *id, *mvmeprom_brdid(); + extern u_int edata, end; + char *nbarg_start; + char *nbarg_end; + u_int dummy; - /* - * This code enables the SFU1 and is used for single stage - * bootstraps or the first stage of a two stage bootstrap. - * Do not use r10 to enable the SFU1. This wipes out - * the netboot args. Not cool at all... r25 seems free. + /* + * Save r10 and r11 first. We can't put declare them as arguments + * since the normal calling convention would put them on the stack. */ - asm("| enable SFU1"); - asm(" ldcr r25,cr1" ::: "r25"); - asm(" clr r25,r25,1<3>"); /* bit 3 is SFU1D */ - asm(" stcr r25,cr1"); - - __asm__ __volatile__ ("or %0, r0, " MVMEPROM_REG_DEVLUN : - "=r" (bugargs.dev_lun)); - __asm__ __volatile__ ("or %0, r0, " MVMEPROM_REG_CTRLLUN : - "=r" (bugargs.ctrl_lun)); - __asm__ __volatile__ ("or %0, r0, " MVMEPROM_REG_FLAGS : - "=r" (bugargs.flags)); - __asm__ __volatile__ ("or %0, r0, " MVMEPROM_REG_CTRLADDR : - "=r" (bugargs.ctrl_addr)); - __asm__ __volatile__ ("or %0, r0, " MVMEPROM_REG_ENTRY : - "=r" (bugargs.entry)); - __asm__ __volatile__ ("or %0, r0, " MVMEPROM_REG_CONFBLK : - "=r" (bugargs.conf_blk)); - __asm__ __volatile__ ("or %0, r0, " MVMEPROM_REG_ARGSTART : - "=r" (bugargs.arg_start)); - __asm__ __volatile__ ("or %0, r0, " MVMEPROM_REG_ARGEND : - "=r" (bugargs.arg_end)); - __asm__ __volatile__ ("or %0, r0, " MVMEPROM_REG_NBARGSTART : - "=r" (bugargs.nbarg_start)); - __asm__ __volatile__ ("or %0, r0, " MVMEPROM_REG_NBARGEND : - "=r" (bugargs.nbarg_end)); - *bugargs.arg_end = 0; + __asm__ __volatile__ ("or %0, r0, r10" : "=r" (nbarg_start) : : + "r10", "r11"); + __asm__ __volatile__ ("or %0, r0, r11" : "=r" (nbarg_end) : : + "r10", "r11"); - id = mvmeprom_brdid(); - bugargs.cputyp = id->model; - -#ifdef notyet /* STAGE1 */ - /* - * Initialize PSR and CMMU to a known, stable state. - * This has to be done early for MVME197. - * Per EB162 mc88110 engineering bulletin. + /* + * This code enables the SFU1 and is used for single stage + * bootstraps or the first stage of a two stage bootstrap. + * Do not use lower registers to enable the SFU1. This wipes out + * the args. Not cool at all... r25 seems free. */ - if (bugargs.cputyp == 0x197) { - asm("| init MVME197"); - asm("| 1. PSR"); - asm("or.u r2,r0,0xA200"); - asm("or r2,r2,0x03E2"); - asm("stcr r2,cr1"); - asm("| 2. ICTL"); - asm("or r2,r0,r0"); - asm("or r2,r2,0x8000"); - asm("or r2,r2,0x0040"); - asm("stcr r2,cr26"); - asm("| 3. DCTL"); - asm("or r2,r0,r0"); - asm("or r2,r2,0x2000"); - asm("or r2,r2,0x0040"); - asm("stcr r2,cr41"); - asm("| 4. init cache"); - asm("or r2,r0,0x01"); - asm("stcr r2,cr25"); - asm("stcr r2,cr40"); - } -#endif + __asm__ __volatile__ ("ldcr %0, cr1" : "=r" (dummy)); + __asm__ __volatile__ ("clr %0, %0, 1<3>; stcr %0, cr1" : "+r" (dummy)); memset(&edata, 0, ((int)&end - (int)&edata)); - asm ("| main()"); + bugargs.dev_lun = dev_lun; + bugargs.ctrl_lun = ctrl_lun; + bugargs.flags = flags; + bugargs.ctrl_addr = ctrl_addr; + bugargs.entry = entry; + bugargs.conf_blk = conf_blk; + bugargs.arg_start = arg_start; + bugargs.arg_end = arg_end; + bugargs.nbarg_start = nbarg_start; + bugargs.nbarg_end = nbarg_end; + *bugargs.arg_end = '\0'; + main(); - mvmeprom_return(); + _rtt(); /* NOTREACHED */ } @@ -95,27 +66,13 @@ __main() } void -bugexec(void (*addr)(void)) +bugexec(void (*addr)()) { - __asm__ __volatile__ ("or " MVMEPROM_REG_DEVLUN ", r0, %0" :: - "r" (bugargs.dev_lun)); - __asm__ __volatile__ ("or " MVMEPROM_REG_CTRLLUN ", r0, %0" :: - "r" (bugargs.ctrl_lun)); - __asm__ __volatile__ ("or " MVMEPROM_REG_FLAGS ", r0, %0" :: - "r" (bugargs.flags)); - __asm__ __volatile__ ("or " MVMEPROM_REG_CTRLADDR ", r0, %0" :: - "r" (bugargs.ctrl_addr)); - __asm__ __volatile__ ("or " MVMEPROM_REG_ENTRY ", r0, %0" :: - "r" (bugargs.entry)); - __asm__ __volatile__ ("or " MVMEPROM_REG_CONFBLK ", r0, %0" :: - "r" (bugargs.conf_blk)); - __asm__ __volatile__ ("or " MVMEPROM_REG_ARGSTART ", r0, %0" :: - "r" (bugargs.arg_start)); - __asm__ __volatile__ ("or " MVMEPROM_REG_ARGEND ", r0, %0" :: - "r" (bugargs.arg_end)); + (*addr)(bugargs.dev_lun, bugargs.ctrl_lun, bugargs.flags, + bugargs.ctrl_addr, bugargs.entry, bugargs.conf_blk, + bugargs.arg_start, bugargs.arg_end); - (*addr)(); - printf("bugexec: 0x%x returned!\n", addr); + printf("bugexec: %p returned!\n", addr); _rtt(); } diff --git a/sys/arch/mvme88k/stand/libbug/libbug.h b/sys/arch/mvme88k/stand/libbug/libbug.h index f5325292ce7..005ae94b617 100644 --- a/sys/arch/mvme88k/stand/libbug/libbug.h +++ b/sys/arch/mvme88k/stand/libbug/libbug.h @@ -1,23 +1,36 @@ -/* $OpenBSD: libbug.h,v 1.3 2002/03/14 03:15:57 millert Exp $ */ +/* $OpenBSD: libbug.h,v 1.4 2006/05/16 22:51:30 miod Exp $ */ /* * prototypes and such. note that get/put char are in stand.h */ - void mvmeprom_delay(int); int mvmeprom_diskrd(struct mvmeprom_dskio *); int mvmeprom_diskwr(struct mvmeprom_dskio *); -struct mvmeprom_brdid *mvmeprom_getbrdid(void); -int peekchar(void); +struct mvmeprom_brdid *mvmeprom_getbrdid(void); +int mvmeprom_netfopen(struct mvmeprom_netfopen *); +int mvmeprom_netfread(struct mvmeprom_netfread *); void mvmeprom_outln(char *, char *); void mvmeprom_outstr(char *, char *); void mvmeprom_rtc_rd(struct mvmeprom_time *); /* - * bugcrt stuff + * bugcrt stuff */ +struct mvmeprom_args { + u_int dev_lun; + u_int ctrl_lun; + u_int flags; + u_int ctrl_addr; + u_int entry; + u_int conf_blk; + char *arg_start; + char *arg_end; + char *nbarg_start; + char *nbarg_end; +}; + extern struct mvmeprom_args bugargs; void bugexec(void (*)()); diff --git a/sys/arch/mvme88k/stand/libbug/putchar.c b/sys/arch/mvme88k/stand/libbug/putchar.c index a097e36f5b4..1968152875e 100644 --- a/sys/arch/mvme88k/stand/libbug/putchar.c +++ b/sys/arch/mvme88k/stand/libbug/putchar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: putchar.c,v 1.3 2003/09/07 21:35:35 miod Exp $ */ +/* $OpenBSD: putchar.c,v 1.4 2006/05/16 22:51:30 miod Exp $ */ /* * putchar: easier to do this with outstr than to add more macros to @@ -13,14 +13,12 @@ void putchar(c) - -int c; - + int c; { - char ca; - ca = (char)c & 0xFF; - if (ca == '\n') - putchar('\r'); - asm volatile ("or r2,r0,%0" : : "r" (ca)); - MVMEPROM_CALL(MVMEPROM_OUTCHR); + char ca; + ca = (char)c & 0xFF; + if (ca == '\n') + putchar('\r'); + asm volatile ("or r2,r0,%0" : : "r" (ca)); + MVMEPROM_CALL(MVMEPROM_OUTCHR); } diff --git a/sys/arch/mvme88k/stand/libbug/return.c b/sys/arch/mvme88k/stand/libbug/return.c index ff218a3a5f7..113dd3e2186 100644 --- a/sys/arch/mvme88k/stand/libbug/return.c +++ b/sys/arch/mvme88k/stand/libbug/return.c @@ -1,4 +1,4 @@ -/* $OpenBSD: return.c,v 1.3 2003/09/07 21:35:35 miod Exp $ */ +/* $OpenBSD: return.c,v 1.4 2006/05/16 22:51:30 miod Exp $ */ /* * bug routines -- assumes that the necessary sections of memory @@ -10,14 +10,6 @@ #include "prom.h" /* BUG - return to bug routine */ -void -mvmeprom_return() -{ - MVMEPROM_CALL(MVMEPROM_EXIT); - /*NOTREACHED*/ -} - -/* BUG - return to bug routine */ __dead void _rtt() { diff --git a/sys/arch/mvme88k/stand/libsa/Makefile b/sys/arch/mvme88k/stand/libsa/Makefile index 80e996d6860..c470a83e124 100644 --- a/sys/arch/mvme88k/stand/libsa/Makefile +++ b/sys/arch/mvme88k/stand/libsa/Makefile @@ -1,9 +1,7 @@ -# $OpenBSD: Makefile,v 1.6 2004/01/26 19:48:34 miod Exp $ +# $OpenBSD: Makefile,v 1.7 2006/05/16 22:51:30 miod Exp $ LIB=sa -CLEANFILES+=SRT0.o SRT1.o - NOPIC=nopic NOPROFILE=noprofile @@ -13,7 +11,7 @@ DIR_SA=$S/lib/libsa DIR_KERN=$S/lib/libkern SRC_net= arp.c ether.c in_cksum.c net.c netif.c rpc.c nfs.c \ - rarp.c bootparam.c + rarp.c bootparam.c SRC_sa= alloc.c memcpy.c exit.c getfile.c gets.c globals.c \ printf.c strerror.c memset.c memcmp.c strncpy.c strcmp.c strlen.c \ @@ -34,14 +32,14 @@ SRCS= ${SRC_net} ${SRC_sa} ${SRC_mvme} ${SRC_here} ${SRC_kern} # -DNET_DEBUG -DRARP_DEBUG -DETHER_DEBUG #DEFS= -DCOMPAT_UFS -DEFS= -D__INTERNAL_LIBSA_CREAD -#-DNETIF_DEBUG +DEFS= -D__INTERNAL_LIBSA_CREAD +#DEFS+=-DNETIF_DEBUG INCL= -I${.CURDIR} -I${.CURDIR}/../libbug -I${S}/lib/libsa -I${S} CFLAGS+= ${XCFLAGS} ${COPTS} ${DEFS} ${DBG} ${INCL} -.PATH: ${DIR_SA} ${DIR_KERN} +.PATH: ${DIR_SA} ${DIR_KERN} -all: libsa.a SRT0.o SRT1.o +all: libsa.a install: diff --git a/sys/arch/mvme88k/stand/libsa/Makefile.inc b/sys/arch/mvme88k/stand/libsa/Makefile.inc index ff00fc33b62..9b6b6a2521f 100644 --- a/sys/arch/mvme88k/stand/libsa/Makefile.inc +++ b/sys/arch/mvme88k/stand/libsa/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.2 1998/08/22 08:07:51 smurph Exp $ +# $OpenBSD: Makefile.inc,v 1.3 2006/05/16 22:51:30 miod Exp $ LIB_SA_DIR=${S}/arch/mvme88k/stand/libsa @@ -6,7 +6,6 @@ LIBSA_DIR!= cd ${LIB_SA_DIR}; \ printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx LIBSA=${LIBSA_DIR}/libsa.a -SRTOBJ?= ${LIBSA_DIR}/SRT0.o $(LIBSA): .NOTMAIN __always_make_libsa @echo making sure the libsa is up to date... diff --git a/sys/arch/mvme88k/stand/libsa/SRT0.S b/sys/arch/mvme88k/stand/libsa/SRT0.S deleted file mode 100644 index d591ca34c2b..00000000000 --- a/sys/arch/mvme88k/stand/libsa/SRT0.S +++ /dev/null @@ -1,84 +0,0 @@ -; $OpenBSD: SRT0.S,v 1.4 2003/06/04 16:36:15 deraadt Exp $ - -; Copyright (c) 1996 Nivas Madhur -; Copyright (c) 1995 Theo de Raadt -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions -; are met: -; 1. Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; 2. Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in the -; documentation and/or other materials provided with the distribution. -; -; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS -; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -; SUCH DAMAGE. -; -; Copyright (c) 1995 Gordon W. Ross -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions -; are met: -; 1. Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; 2. Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in the -; documentation and/or other materials provided with the distribution. -; 3. The name of the author may not be used to endorse or promote products -; derived from this software without specific prior written permission. -; 4. All advertising materials mentioning features or use of this software -; must display the following acknowledgement: -; This product includes software developed by Gordon Ross -; -; 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. - -; SRT0.S - Stand-alone Run-Time startup code, part 0 - .file "SRT0.S" - .text - .globl _stack -_stack: - .globl _start -_start: - .word __estack - .word _start - - align 8 - or.u r10, r0, hi16(_devlun) - st r2, r0, lo16(_devlun) - or.u r10, r0, hi16(_ctrlun) - st r3, r0, lo16(_ctrlun) - or.u r10, r0, hi16(_oparg) - st r8, r0, lo16(_oparg) - or.u r10, r0, hi16(_opargend) - st r9, r0, lo16(_opargend) -; enable SFU1 - 88k disables SFU1 on a reset - ldcr r10, cr1 - xor r10, r10, 0x8 - stcr r10, cr1 - -; Call the run-time startup C code, which will: -; call main & call exit - exit passes control back to -; to the Bug. - bsr __start - -; The end. diff --git a/sys/arch/mvme88k/stand/libsa/SRT1.c b/sys/arch/mvme88k/stand/libsa/SRT1.c deleted file mode 100644 index 7cc0e82b0d3..00000000000 --- a/sys/arch/mvme88k/stand/libsa/SRT1.c +++ /dev/null @@ -1,118 +0,0 @@ -/* $OpenBSD: SRT1.c,v 1.4 2003/06/04 16:36:15 deraadt Exp $ */ - -/* - * Copyright (c) 1996 Nivas Madhur - * Copyright (c) 1995 Theo de Raadt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Copyright (c) 1995 Gordon W. Ross - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * 4. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Gordon Ross - * - * 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. - */ - -/* SRT1.c - Stand-alone Run-time startup code, part 1 */ - -#include <stdarg.h> -#include <sys/types.h> - -#include "config.h" - -extern char *edata, *end; - -int devlun = 0; -int ctrlun = 0; -int oparg = 0; -int opargend = 0; - -getvbr() -{ - asm volatile ("ldcr r2, cr7"); -} - -void -exit() -{ - /* - * Return to the Bug - */ - - asm volatile ("or r9, r0, 0x63; tb0 0, r0, 496"); - /* NOTREACHED */ - for(;;); /* keep compiler happy */ -} - -struct brdid brdid; -int cputyp; - -/* - * This is called by SRT0.S - * to do final prep for main - */ -_start() -{ - struct brdid *p; - - /* Clear BSS */ - - bzero(edata, end - edata); - - asm volatile("or r9, r0, 0x70\n - tb0 0, r0, 496\n - st r2, %0" : "=m" (p)); - - bcopy(p, &brdid, sizeof brdid); - cputyp = brdid.model; - - main(0); - exit(); -} - -/* - * Boot programs in C++ ? Not likely! - */ -__main() -{} diff --git a/sys/arch/mvme88k/stand/libsa/exec_mvme.c b/sys/arch/mvme88k/stand/libsa/exec_mvme.c index 9357cfc4c24..c67ae2c321b 100644 --- a/sys/arch/mvme88k/stand/libsa/exec_mvme.c +++ b/sys/arch/mvme88k/stand/libsa/exec_mvme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_mvme.c,v 1.11 2004/11/11 21:44:42 miod Exp $ */ +/* $OpenBSD: exec_mvme.c,v 1.12 2006/05/16 22:51:30 miod Exp $ */ /*- @@ -59,12 +59,12 @@ exec_mvme(file, flag) int flag; { char *loadaddr; - register int io; + int io; struct exec x; int cc, magic; void (*entry)(); - register char *cp; - register int *ip; + char *cp; + int *ip; int bootdev; #ifdef DEBUG @@ -87,11 +87,11 @@ exec_mvme(file, flag) } /* - * note: on the mvme ports, the kernel is linked in such a way that - * its entry point is the first item in .text, and thus a_entry can + * note: on the mvme ports, the kernel is linked in such a way that + * its entry point is the first item in .text, and thus a_entry can * be used to determine both the load address and the entry point. * (also note that we make use of the fact that the kernel will live - * in a VA == PA range of memory ... otherwise we would take + * in a VA == PA range of memory ... otherwise we would take * loadaddr as a parameter and let the kernel relocate itself!) * * note that ZMAGIC files included the a.out header in the text area @@ -184,12 +184,13 @@ exec_mvme(file, flag) goto shread; cp += cc; } - printf("=0x%x\n", cp - loadaddr); + printf("=0x%lx\n", cp - loadaddr); close(io); printf("Start @ 0x%x\n", (int)entry); printf("Controller Address 0x%x\n", bugargs.ctrl_addr); - if (flag & RB_HALT) mvmeprom_return(); + if (flag & RB_HALT) + _rtt(); bootdev = (bugargs.ctrl_lun << 8) | (bugargs.dev_lun & 0xFF); diff --git a/sys/arch/mvme88k/stand/netboot/Makefile b/sys/arch/mvme88k/stand/netboot/Makefile index f1329bb8ad2..eb267a3757c 100644 --- a/sys/arch/mvme88k/stand/netboot/Makefile +++ b/sys/arch/mvme88k/stand/netboot/Makefile @@ -1,10 +1,10 @@ -# $OpenBSD: Makefile,v 1.13 2005/09/11 13:36:00 deraadt Exp $ +# $OpenBSD: Makefile,v 1.14 2006/05/16 22:51:30 miod Exp $ SIZE?= size STRIP?= strip S= ${.CURDIR}/../../../.. -DEFS= -DSUN_BOOTPARAMS +DEFS= -DSUN_BOOTPARAMS #-DNETIF_DEBUG INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \ -I${S} -I${S}/lib/libsa @@ -17,12 +17,11 @@ CLEANFILES+=netboot netboot.bin .include "${S}/arch/mvme88k/stand/libz/Makefile.inc" SRCS= boot.c conf.c version.c devopen.c dev_net.c -SRCS+= if_ie.c +SRCS+= if_ie.c #SRCS+= if_le.c OBJS= ${SRCS:S/.c/.o/g} LIBS= ${LIBSA} ${LIBBUG} ${LIBZ} -LDFLAGS+= -s -N -T ${STAGE2_RELOC} -#LDFLAGS+= -nostdlib -s -N -Ttext ${RELOC} +LDFLAGS+= -s -N -T ${STAGE2_RELOC} all: netboot.bin diff --git a/sys/arch/mvme88k/stand/netboot/boot.c b/sys/arch/mvme88k/stand/netboot/boot.c index 8b694a3a19c..f9a6067173f 100644 --- a/sys/arch/mvme88k/stand/netboot/boot.c +++ b/sys/arch/mvme88k/stand/netboot/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.6 2003/06/04 04:11:37 deraadt Exp $ */ +/* $OpenBSD: boot.c,v 1.7 2006/05/16 22:51:30 miod Exp $ */ /*- * Copyright (c) 1995 Theo de Raadt @@ -62,15 +62,10 @@ #include "stand.h" #include "libsa.h" - -/* - * Boot device is derived from ROM provided information. - */ -#define LOADADDR 0x10000 - extern char *version; char line[80]; +int main() { char *cp, *file; @@ -92,7 +87,7 @@ main() if (line[0]) { bugargs.arg_start = line; cp = line; - while (cp < (line + sizeof(line) - 1) && *cp) + while (cp < (line + sizeof(line) - 1) && *cp) cp++; bugargs.arg_end = cp; ret =parse_args(&file, &howto); @@ -106,4 +101,6 @@ main() printf("boot: %s: %s\n", file, strerror(errno)); ask = 1; } + _rtt(); + return (0); } diff --git a/sys/arch/mvme88k/stand/tftpboot/Makefile b/sys/arch/mvme88k/stand/tftpboot/Makefile index bba1949c4b8..a47ca7b9c14 100644 --- a/sys/arch/mvme88k/stand/tftpboot/Makefile +++ b/sys/arch/mvme88k/stand/tftpboot/Makefile @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile,v 1.2 2005/09/11 13:36:00 deraadt Exp $ +# $OpenBSD: Makefile,v 1.3 2006/05/16 22:51:30 miod Exp $ SIZE?= size STRIP?= strip S= ${.CURDIR}/../../../.. -DEFS= -DSUN_BOOTPARAMS -#-DNETIF_DEBUG +DEFS= +#DEFS+=-DNETIF_DEBUG INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \ -I${S} -I${S}/lib/libsa CFLAGS+=${DEFS} ${INCPATH} ${COPTS} @@ -19,8 +19,7 @@ CLEANFILES+=tftpboot tftpboot.bin SRCS= boot.c conf.c version.c tftpfs.c netdev.c OBJS= ${SRCS:S/.c/.o/g} LIBS= ${LIBSA} ${LIBBUG} ${LIBZ} -LDFLAGS+= -s -N -T ${STAGE2_RELOC} -#LDFLAGS+= -nostdlib -s -N -Ttext ${RELOC} +LDFLAGS+= -s -N -T ${STAGE2_RELOC} all: tftpboot.bin |