diff options
Diffstat (limited to 'sys/arch/mvme68k/stand/bootxx/bootxx.c')
-rw-r--r-- | sys/arch/mvme68k/stand/bootxx/bootxx.c | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/sys/arch/mvme68k/stand/bootxx/bootxx.c b/sys/arch/mvme68k/stand/bootxx/bootxx.c index 54a6472e58b..57a963b4291 100644 --- a/sys/arch/mvme68k/stand/bootxx/bootxx.c +++ b/sys/arch/mvme68k/stand/bootxx/bootxx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bootxx.c,v 1.6 2002/04/16 15:37:04 miod Exp $ */ +/* $OpenBSD: bootxx.c,v 1.7 2003/08/20 00:24:43 deraadt Exp $ */ /* $NetBSD: bootxx.c,v 1.5 1995/10/13 21:44:57 gwr Exp $ */ /* @@ -48,6 +48,7 @@ #include "stand.h" #include "libsa.h" +#include "libbug.h" /* * Boot device is derived from ROM provided information. @@ -70,37 +71,8 @@ daddr_t block_table[MAXBLOCKNUM] = { 0 }; extern char *version; - -main() -{ - struct open_file f; - char *addr; - int n, error; - - printf("Boot: bug device: ctrl=%d, dev=%d\n", - bugargs.ctrl_lun, bugargs.dev_lun); - printf("\nbootxx: first level bootstrap program [%s]\n\n", version); - - f.f_flags = F_RAW; - if (devopen(&f, 0, &addr)) { - printf("bootxx: open failed\n"); - _rtt(); - } - - addr = (char *)LOADADDR; - error = copyboot(&f, addr); - f.f_dev->dv_close(&f); - if (!error) { - bugexec((void (*)())addr + 8); - } - /* copyboot had a problem... */ - _rtt(); -} - -int -copyboot(fp, addr) - struct open_file *fp; - char *addr; +static int +copyboot(struct open_file *fp, char *addr) { int n, i, blknum; struct exec *x; @@ -122,8 +94,7 @@ copyboot(fp, addr) printf("bootxx: read block # %d = %d\n", i, blknum); #endif if ((fp->f_dev->dv_strategy)(fp->f_devdata, F_READ, - blknum, block_size, addr, &n)) - { + blknum, block_size, addr, &n)) { printf("bootxx: read failed\n"); return -1; } @@ -141,3 +112,29 @@ copyboot(fp, addr) return 0; } + +main(int argc, char *argv[]) +{ + struct open_file f; + char *addr; + int n, error; + + printf("Boot: bug device: ctrl=%d, dev=%d\n", + bugargs.ctrl_lun, bugargs.dev_lun); + printf("\nbootxx: first level bootstrap program [%s]\n\n", version); + + f.f_flags = F_RAW; + if (devopen(&f, 0, &addr)) { + printf("bootxx: open failed\n"); + _rtt(); + } + + addr = (char *)LOADADDR; + error = copyboot(&f, addr); + f.f_dev->dv_close(&f); + if (!error) { + bugexec((void (*)(void))addr + 8); + } + /* copyboot had a problem... */ + _rtt(); +} |