This commit is contained in:
tsutsui 2009-01-12 07:00:59 +00:00
parent befa8bb5df
commit fe0dea612e
21 changed files with 93 additions and 50 deletions

View File

@ -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

View File

@ -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 <stand.h>
#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. */

View File

@ -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 <stand.h>
#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. */

View File

@ -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

View File

@ -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) {}

View File

@ -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 <sys/types.h>
#include <machine/idprom.h>
#include <machine/mon.h>
#include <lib/libsa/stand.h>
#include "libsa.h"

View File

@ -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 *);

View File

@ -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 <stand.h>
#include <net.h>
#include <lib/libkern/libkern.h>
#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

View File

@ -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 <sys/types.h>
#include <machine/mon.h>
#include <lib/libsa/stand.h>
#include "libsa.h"
int
getchar(void)

View File

@ -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);

View File

@ -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 <lib/libsa/stand.h>
#include "libsa.h"
void
putstr(const char *s)

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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 <sys/types.h>
#include <netinet/in.h>
@ -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;
}

View File

@ -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;
}

View File

@ -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];

View File

@ -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;

View File

@ -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 <stand.h>
#include <ufs.h>
#include <dev_disk.h>
#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;
}