From fe0dea612e457be963bca490591f36ff4121ec18 Mon Sep 17 00:00:00 2001 From: tsutsui Date: Mon, 12 Jan 2009 07:00:59 +0000 Subject: [PATCH] WARNSfy. --- sys/arch/sun68k/stand/Makefile.inc | 3 ++- sys/arch/sun68k/stand/bootxx/bootxx.c | 13 ++++++++----- sys/arch/sun68k/stand/bootyy/bootyy.c | 13 ++++++++----- sys/arch/sun68k/stand/libsa/Makefile | 3 ++- sys/arch/sun68k/stand/libsa/SRT1.c | 10 ++-------- sys/arch/sun68k/stand/libsa/idprom.c | 3 ++- sys/arch/sun68k/stand/libsa/libsa.h | 15 ++++++++++++++- sys/arch/sun68k/stand/libsa/netif_sun.c | 10 ++++++++-- sys/arch/sun68k/stand/libsa/promcons.c | 5 ++++- sys/arch/sun68k/stand/libsa/promdev.c | 4 ++-- sys/arch/sun68k/stand/libsa/putstr.c | 3 ++- sys/arch/sun68k/stand/libsa/saio.h | 16 +++++++++------- sys/arch/sun68k/stand/libsa/sun2.c | 5 +++-- sys/arch/sun68k/stand/libsa/sun3.c | 3 ++- sys/arch/sun68k/stand/libsa/sun3x.c | 3 ++- sys/arch/sun68k/stand/libsa/xxboot.c | 4 ++-- sys/arch/sun68k/stand/netboot/conf.c | 9 +++++++-- sys/arch/sun68k/stand/tapeboot/boot.c | 6 ++++-- sys/arch/sun68k/stand/tapeboot/dev_tape.c | 3 +-- sys/arch/sun68k/stand/tapeboot/rawfs.c | 5 +++-- sys/arch/sun68k/stand/ufsboot/conf.c | 7 ++++++- 21 files changed, 93 insertions(+), 50 deletions(-) diff --git a/sys/arch/sun68k/stand/Makefile.inc b/sys/arch/sun68k/stand/Makefile.inc index ec04297603cb..7a40f5847e52 100644 --- a/sys/arch/sun68k/stand/Makefile.inc +++ b/sys/arch/sun68k/stand/Makefile.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.13 2006/09/17 06:15:40 tsutsui Exp $ +# $NetBSD: Makefile.inc,v 1.14 2009/01/12 07:00:59 tsutsui Exp $ # Must have S=/usr/src/sys (or equivalent) # But note: this is w.r.t. a subdirectory @@ -19,6 +19,7 @@ INCL?= -I. -I${.CURDIR} -I${.CURDIR}/../libsa -I${S}/lib/libsa -I${S} CPUFLAGS= -mc68000 -Wa,-mc68010 COPTS= -Os -fno-defer-pop -ffreestanding CFLAGS= -msoft-float +CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith CPPFLAGS= ${DEFS} ${DEBUG} ${INCL} SRTOBJ= ${LIBSA}/SRT0.o ${LIBSA}/SRT1.o diff --git a/sys/arch/sun68k/stand/bootxx/bootxx.c b/sys/arch/sun68k/stand/bootxx/bootxx.c index acf1668bb8c6..b49fbacb8e6a 100644 --- a/sys/arch/sun68k/stand/bootxx/bootxx.c +++ b/sys/arch/sun68k/stand/bootxx/bootxx.c @@ -1,4 +1,4 @@ -/* $NetBSD: bootxx.c,v 1.11 2008/04/28 20:23:38 martin Exp $ */ +/* $NetBSD: bootxx.c,v 1.12 2009/01/12 07:00:59 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -46,6 +46,8 @@ #include #include "libsa.h" +int copyboot(struct open_file *, char *); + /* * This is the address where we load the second-stage boot loader. */ @@ -70,7 +72,7 @@ main(void) struct open_file f; void *entry; char *addr; - int n, error; + int error; #ifdef DEBUG printf("bootxx: open...\n"); @@ -78,7 +80,7 @@ main(void) f.f_flags = F_RAW; if (devopen(&f, 0, &addr)) { putstr("bootxx: devopen failed\n"); - return; + return 1; } addr = (char*)LOADADDR; @@ -92,13 +94,14 @@ main(void) chain_to(entry); } /* copyboot had a problem... */ - return; + return 0; } int copyboot(struct open_file *fp, char *addr) { - int n, i, blknum; + size_t n; + int i, blknum; char *buf; /* Need to use a buffer that can be mapped into DVMA space. */ diff --git a/sys/arch/sun68k/stand/bootyy/bootyy.c b/sys/arch/sun68k/stand/bootyy/bootyy.c index 8547b6503e0f..3011612d6559 100644 --- a/sys/arch/sun68k/stand/bootyy/bootyy.c +++ b/sys/arch/sun68k/stand/bootyy/bootyy.c @@ -1,4 +1,4 @@ -/* $NetBSD: bootyy.c,v 1.4 2008/04/28 20:23:38 martin Exp $ */ +/* $NetBSD: bootyy.c,v 1.5 2009/01/12 07:00:59 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -47,6 +47,8 @@ #include #include "libsa.h" +int copyboot(struct open_file *, char *); + /* This determines the largest boot program we can load. */ #define MAXBLOCKNUM 64 @@ -79,7 +81,7 @@ main(void) struct open_file f; void *entry; char *addr; - int n, error; + int error; #ifdef DEBUG printf("bootyy: open...\n"); @@ -87,7 +89,7 @@ main(void) f.f_flags = F_RAW; if (devopen(&f, 0, &addr)) { printf("bootyy: devopen failed\n"); - return; + return 1; } addr = (char *)KERN_LOADADDR; @@ -101,13 +103,14 @@ main(void) chain_to(entry); } /* copyboot had a problem... */ - return; + return 0; } int copyboot(struct open_file *fp, char *addr) { - int n, i, blknum; + size_t n; + int i, blknum; char *buf; /* Need to use a buffer that can be mapped into DVMA space. */ diff --git a/sys/arch/sun68k/stand/libsa/Makefile b/sys/arch/sun68k/stand/libsa/Makefile index c545997805c6..b834fd1d1492 100644 --- a/sys/arch/sun68k/stand/libsa/Makefile +++ b/sys/arch/sun68k/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.24 2006/09/17 06:15:40 tsutsui Exp $ +# $NetBSD: Makefile,v 1.25 2009/01/12 07:00:59 tsutsui Exp $ LIB=sa @@ -36,6 +36,7 @@ DEFS= -Dsun3 -D_STANDALONE -D__daddr_t=int32_t INCL= -I. -I${.CURDIR} -I${S}/lib/libsa -I${S} -I${.CURDIR}/../../.. AFLAGS= -Wa,-mc68020 -Wa,-mc68851 CFLAGS= -mc68000 -Wa,-mc68010 -Wa,-m68851 -msoft-float +CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith COPTS= -Os -fno-defer-pop -ffreestanding CPPFLAGS= ${DEFS} ${DEBUG} ${INCL} CLEANFILES= SRT0.o SRT1.o vers.c diff --git a/sys/arch/sun68k/stand/libsa/SRT1.c b/sys/arch/sun68k/stand/libsa/SRT1.c index ca5945531c09..bb6e51e506c0 100644 --- a/sys/arch/sun68k/stand/libsa/SRT1.c +++ b/sys/arch/sun68k/stand/libsa/SRT1.c @@ -1,4 +1,4 @@ -/* $NetBSD: SRT1.c,v 1.7 2008/04/28 20:23:39 martin Exp $ */ +/* $NetBSD: SRT1.c,v 1.8 2009/01/12 07:00:59 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -95,7 +95,7 @@ _start(void) else sun3_init(); - main(0); + main(); exit(0); } @@ -117,9 +117,3 @@ chain_to(void *func) ICIA(); exit(0); } - -/* - * Boot programs in C++ ? Not likely! - */ -void -__main(void) {} diff --git a/sys/arch/sun68k/stand/libsa/idprom.c b/sys/arch/sun68k/stand/libsa/idprom.c index bc01dcf1cf3d..465d6a84e33c 100644 --- a/sys/arch/sun68k/stand/libsa/idprom.c +++ b/sys/arch/sun68k/stand/libsa/idprom.c @@ -1,4 +1,4 @@ -/* $NetBSD: idprom.c,v 1.5 2008/04/28 20:23:39 martin Exp $ */ +/* $NetBSD: idprom.c,v 1.6 2009/01/12 07:00:59 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -36,6 +36,7 @@ #include #include #include +#include #include "libsa.h" diff --git a/sys/arch/sun68k/stand/libsa/libsa.h b/sys/arch/sun68k/stand/libsa/libsa.h index d24087b0425d..7ebdf64badcf 100644 --- a/sys/arch/sun68k/stand/libsa/libsa.h +++ b/sys/arch/sun68k/stand/libsa/libsa.h @@ -1,4 +1,4 @@ -/* $NetBSD: libsa.h,v 1.5 2005/12/11 12:19:29 christos Exp $ */ +/* $NetBSD: libsa.h,v 1.6 2009/01/12 07:00:59 tsutsui Exp $ */ /* * This file defines the API for libsa.a @@ -23,6 +23,9 @@ void _start(void); void breakpoint(void); void chain_to(void *); +int main(void); +void exit(int); + /* clock.c */ extern int hz; long getsecs(void); @@ -37,6 +40,13 @@ extern int debug; extern char prom_bootdev[]; extern char *prom_bootfile; extern int prom_boothow; +void prom_get_boot_info(void); + +/* promcons.c */ +int peekchar(void); + +/* putstr.c */ +void putstr(const char *); /* sun2.c */ void sun2_getidprom(u_char *); @@ -49,3 +59,6 @@ void sun3_getidprom(u_char *); /* vers.c */ extern const char bootprog_rev[]; extern const char bootprog_name[]; + +/* xxboot.c */ +void xxboot_main(const char *); diff --git a/sys/arch/sun68k/stand/libsa/netif_sun.c b/sys/arch/sun68k/stand/libsa/netif_sun.c index a1e240a045ba..c0d5b441cb00 100644 --- a/sys/arch/sun68k/stand/libsa/netif_sun.c +++ b/sys/arch/sun68k/stand/libsa/netif_sun.c @@ -1,4 +1,4 @@ -/* $NetBSD: netif_sun.c,v 1.6 2008/04/28 20:23:39 martin Exp $ */ +/* $NetBSD: netif_sun.c,v 1.7 2009/01/12 07:00:59 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -50,6 +50,8 @@ #include #include +#include + #include "libsa.h" #include "dvma.h" #include "saio.h" @@ -72,6 +74,11 @@ struct devdata { u_char dd_myea[6]; } netif_devdata; +struct devdata * netif_init(void *); +void netif_fini(struct devdata *); +int netif_attach(struct netif *, struct iodesc *, void *); +void netif_detach(struct netif *); + void netif_getether(struct saif *, u_char *); @@ -271,7 +278,6 @@ netif_put(struct iodesc *desc, void *pkt, size_t len) struct devdata *dd; struct saioreq *si; struct saif *sif; - char *dmabuf; int rv, slen; #ifdef NETIF_DEBUG diff --git a/sys/arch/sun68k/stand/libsa/promcons.c b/sys/arch/sun68k/stand/libsa/promcons.c index 7bb6e88bfce0..acc098cc8f95 100644 --- a/sys/arch/sun68k/stand/libsa/promcons.c +++ b/sys/arch/sun68k/stand/libsa/promcons.c @@ -1,8 +1,11 @@ -/* $NetBSD: promcons.c,v 1.3 2005/12/11 12:19:29 christos Exp $ */ +/* $NetBSD: promcons.c,v 1.4 2009/01/12 07:00:59 tsutsui Exp $ */ #include #include +#include + +#include "libsa.h" int getchar(void) diff --git a/sys/arch/sun68k/stand/libsa/promdev.c b/sys/arch/sun68k/stand/libsa/promdev.c index e2299aebb3f0..aa002625e3b4 100644 --- a/sys/arch/sun68k/stand/libsa/promdev.c +++ b/sys/arch/sun68k/stand/libsa/promdev.c @@ -1,4 +1,4 @@ -/* $NetBSD: promdev.c,v 1.4 2005/12/11 12:19:29 christos Exp $ */ +/* $NetBSD: promdev.c,v 1.5 2009/01/12 07:00:59 tsutsui Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross @@ -55,7 +55,7 @@ prom_iopen(struct saioreq *si) { struct boottab *ops; struct devinfo *dip; - int i, ctlr, error; + int ctlr, error; if (promdev_inuse) return(EMFILE); diff --git a/sys/arch/sun68k/stand/libsa/putstr.c b/sys/arch/sun68k/stand/libsa/putstr.c index 5932737d198b..ec0d3e47e123 100644 --- a/sys/arch/sun68k/stand/libsa/putstr.c +++ b/sys/arch/sun68k/stand/libsa/putstr.c @@ -1,4 +1,4 @@ -/* $NetBSD: putstr.c,v 1.1 2002/05/15 04:07:43 lukem Exp $ */ +/* $NetBSD: putstr.c,v 1.2 2009/01/12 07:00:59 tsutsui Exp $ */ /* * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved. @@ -31,6 +31,7 @@ */ #include +#include "libsa.h" void putstr(const char *s) diff --git a/sys/arch/sun68k/stand/libsa/saio.h b/sys/arch/sun68k/stand/libsa/saio.h index 500cbd6ea029..478a1fab9f9a 100644 --- a/sys/arch/sun68k/stand/libsa/saio.h +++ b/sys/arch/sun68k/stand/libsa/saio.h @@ -1,4 +1,4 @@ -/* $NetBSD: saio.h,v 1.2 2008/04/28 20:23:39 martin Exp $ */ +/* $NetBSD: saio.h,v 1.3 2009/01/12 07:00:59 tsutsui Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -59,14 +59,16 @@ * * When using this interface, only one device can be open at once. */ +struct saioreq; struct boottab { char b_dev[2]; /* The name of the device */ - int (*b_probe)(); /* probe() --> -1 or found controller + int (*b_probe)(void); /* probe() --> -1 or found controller number */ - int (*b_boot)(); /* boot(bp) --> -1 or start address */ - int (*b_open)(); /* open(iobp) --> -1 or 0 */ - int (*b_close)(); /* close(iobp) --> -1 or 0 */ - int (*b_strategy)(); /* strategy(iobp,rw) --> -1 or 0 */ + int (*b_boot)(char *); /* boot(bp) --> -1 or start address */ + int (*b_open)(struct saioreq *); /* open(iobp) --> -1 or 0 */ + int (*b_close)(struct saioreq *); /* close(iobp) --> -1 or 0 */ + int (*b_strategy)(struct saioreq *, int); /* strategy(iobp,rw) + -->-1 or 0 */ char *b_desc; /* Printable string describing dev */ struct devinfo *b_devinfo; /* Information to configure device */ } __attribute__((packed)); @@ -151,7 +153,7 @@ struct saif { * It appears that all V3.X PROMs support this... */ /* Copy our ethernet address to the passed array. */ - int (*sif_macaddr)(char *ea); + int (*sif_macaddr)(u_char *ea); }; #ifdef _STANDALONE diff --git a/sys/arch/sun68k/stand/libsa/sun2.c b/sys/arch/sun68k/stand/libsa/sun2.c index 9a53760f6177..1da1ae408dc5 100644 --- a/sys/arch/sun68k/stand/libsa/sun2.c +++ b/sys/arch/sun68k/stand/libsa/sun2.c @@ -1,4 +1,4 @@ -/* $NetBSD: sun2.c,v 1.9 2008/04/28 20:23:39 martin Exp $ */ +/* $NetBSD: sun2.c,v 1.10 2009/01/12 07:00:59 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -70,6 +70,7 @@ u_int get_pte(vaddr_t); void set_pte(vaddr_t, u_int); +void dvma2_init(void); char * dvma2_alloc(int); void dvma2_free(char *, int); char * dvma2_mapin(char *, int); @@ -437,7 +438,7 @@ sun2_map_mem_run(void *entry) } /* Tell our caller where in virtual space to enter. */ - return ((void *)entry) - MEM_CHUNK0_LOAD_VIRT; + return ((char *)entry) - MEM_CHUNK0_LOAD_VIRT; } void diff --git a/sys/arch/sun68k/stand/libsa/sun3.c b/sys/arch/sun68k/stand/libsa/sun3.c index 6942e6428b04..086072a8f954 100644 --- a/sys/arch/sun68k/stand/libsa/sun3.c +++ b/sys/arch/sun68k/stand/libsa/sun3.c @@ -1,4 +1,4 @@ -/* $NetBSD: sun3.c,v 1.7 2008/04/28 20:23:39 martin Exp $ */ +/* $NetBSD: sun3.c,v 1.8 2009/01/12 07:00:59 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -65,6 +65,7 @@ u_int get_pte(vaddr_t); void set_pte(vaddr_t, u_int); +void dvma3_init(void); char * dvma3_alloc(int); void dvma3_free(char *, int); char * dvma3_mapin(char *, int); diff --git a/sys/arch/sun68k/stand/libsa/sun3x.c b/sys/arch/sun68k/stand/libsa/sun3x.c index add89646eac5..667625b8daec 100644 --- a/sys/arch/sun68k/stand/libsa/sun3x.c +++ b/sys/arch/sun68k/stand/libsa/sun3x.c @@ -1,4 +1,4 @@ -/* $NetBSD: sun3x.c,v 1.10 2008/04/28 20:23:39 martin Exp $ */ +/* $NetBSD: sun3x.c,v 1.11 2009/01/12 07:00:59 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -73,6 +73,7 @@ void set_iommupte(vaddr_t, paddr_t); u_int get_pte(vaddr_t); void set_pte(vaddr_t, paddr_t); +void dvma3x_init(void); char * dvma3x_alloc(int); void dvma3x_free(char *, int); char * dvma3x_mapin(char *, int); diff --git a/sys/arch/sun68k/stand/libsa/xxboot.c b/sys/arch/sun68k/stand/libsa/xxboot.c index 1d72f08b5db7..76d3e73aa714 100644 --- a/sys/arch/sun68k/stand/libsa/xxboot.c +++ b/sys/arch/sun68k/stand/libsa/xxboot.c @@ -1,4 +1,4 @@ -/* $NetBSD: xxboot.c,v 1.5 2005/12/11 12:19:29 christos Exp $ */ +/* $NetBSD: xxboot.c,v 1.6 2009/01/12 07:01:00 tsutsui Exp $ */ /*- * Copyright (c) 1982, 1986, 1990, 1993 @@ -151,6 +151,6 @@ gotit: printf("relocating program..."); entry = sun2_map_mem_run(entry); } - printf("starting program at 0x%x\n", entry); + printf("starting program at 0x%x\n", (u_int)entry); chain_to(entry); } diff --git a/sys/arch/sun68k/stand/netboot/conf.c b/sys/arch/sun68k/stand/netboot/conf.c index 4b9e05c68e8b..91b794ee831d 100644 --- a/sys/arch/sun68k/stand/netboot/conf.c +++ b/sys/arch/sun68k/stand/netboot/conf.c @@ -1,4 +1,4 @@ -/* $NetBSD: conf.c,v 1.3 2005/12/11 12:19:29 christos Exp $ */ +/* $NetBSD: conf.c,v 1.4 2009/01/12 07:01:00 tsutsui Exp $ */ #include #include @@ -6,6 +6,7 @@ #include "stand.h" #include "nfs.h" #include "dev_net.h" +#include "libsa.h" struct fs_ops file_system[] = { FS_OPS(nfs), @@ -18,6 +19,10 @@ struct devsw devsw[] = { int ndevs = 1; int -main() { +main(void) +{ + xxboot_main("netboot"); + + return 0; } diff --git a/sys/arch/sun68k/stand/tapeboot/boot.c b/sys/arch/sun68k/stand/tapeboot/boot.c index a159ca6ca4a5..d6d79006d23e 100644 --- a/sys/arch/sun68k/stand/tapeboot/boot.c +++ b/sys/arch/sun68k/stand/tapeboot/boot.c @@ -1,4 +1,4 @@ -/* $NetBSD: boot.c,v 1.5 2005/12/11 12:19:29 christos Exp $ */ +/* $NetBSD: boot.c,v 1.6 2009/01/12 07:01:00 tsutsui Exp $ */ /*- * Copyright (c) 1982, 1986, 1990, 1993 @@ -120,6 +120,8 @@ main(void) printf("relocating program..."); entry = sun2_map_mem_run(entry); } - printf("Starting program at 0x%x\n", entry); + printf("Starting program at 0x%x\n", (u_int)entry); chain_to(entry); + + return 0; } diff --git a/sys/arch/sun68k/stand/tapeboot/dev_tape.c b/sys/arch/sun68k/stand/tapeboot/dev_tape.c index e0f14c8594c0..43b4ede24aff 100644 --- a/sys/arch/sun68k/stand/tapeboot/dev_tape.c +++ b/sys/arch/sun68k/stand/tapeboot/dev_tape.c @@ -1,4 +1,4 @@ -/* $NetBSD: dev_tape.c,v 1.4 2008/04/28 20:23:39 martin Exp $ */ +/* $NetBSD: dev_tape.c,v 1.5 2009/01/12 07:01:00 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -63,7 +63,6 @@ int devopen(struct open_file *f, const char *fname, char **file) { struct devsw *dp; - int error; *file = (char *)fname; dp = &devsw[0]; diff --git a/sys/arch/sun68k/stand/tapeboot/rawfs.c b/sys/arch/sun68k/stand/tapeboot/rawfs.c index b31b40537d54..b81ccc4b413d 100644 --- a/sys/arch/sun68k/stand/tapeboot/rawfs.c +++ b/sys/arch/sun68k/stand/tapeboot/rawfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: rawfs.c,v 1.6 2006/01/25 18:28:28 christos Exp $ */ +/* $NetBSD: rawfs.c,v 1.7 2009/01/12 07:01:00 tsutsui Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross @@ -204,7 +204,8 @@ static int rawfs_get_block(struct open_file *f) { struct file *fs; - int error, len; + size_t len; + int error; fs = (struct file *)f->f_fsdata; fs->fs_ptr = fs->fs_buf; diff --git a/sys/arch/sun68k/stand/ufsboot/conf.c b/sys/arch/sun68k/stand/ufsboot/conf.c index a9d885040d76..ce3411092ca1 100644 --- a/sys/arch/sun68k/stand/ufsboot/conf.c +++ b/sys/arch/sun68k/stand/ufsboot/conf.c @@ -1,9 +1,11 @@ -/* $NetBSD: conf.c,v 1.4 2005/12/11 12:19:29 christos Exp $ */ +/* $NetBSD: conf.c,v 1.5 2009/01/12 07:01:00 tsutsui Exp $ */ #include #include #include +#include "libsa.h" + struct fs_ops file_system[] = { FS_OPS(ufs), }; @@ -17,5 +19,8 @@ int ndevs = 1; int main(void) { + xxboot_main("ufsboot"); + + return 0; }