Remove in favor of sun68k/stand.
This commit is contained in:
parent
4e25c99464
commit
4de762cb8f
|
@ -1,56 +0,0 @@
|
|||
# $NetBSD: Makefile.inc,v 1.20 2002/02/09 09:36:01 lukem Exp $
|
||||
|
||||
# Must have S=/usr/src/sys (or equivalent)
|
||||
# But note: this is w.r.t. a subdirectory
|
||||
S= ${.CURDIR}/../../../..
|
||||
|
||||
.if defined(SA_PROG)
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
LIBSA!=cd ${.CURDIR}/../libsa && ${PRINTOBJDIR}
|
||||
|
||||
MDEC_DIR?=/usr/mdec
|
||||
|
||||
RELOC?= 240000
|
||||
DEFS?= -Dsun3 -D_STANDALONE
|
||||
INCL?= -I. -I${.CURDIR} -I${.CURDIR}/../libsa -I${S}/lib/libsa -I${S}
|
||||
|
||||
CFLAGS= -Os -msoft-float -fno-defer-pop -Wno-main
|
||||
CPPFLAGS= ${DEFS} ${INCL}
|
||||
|
||||
SRTOBJ= ${LIBSA}/SRT0.o ${LIBSA}/SRT1.o
|
||||
SRTLIB= ${LIBSA}/libsa.a
|
||||
|
||||
CLEANFILES+= ${SA_PROG} ${SA_PROG}.bin
|
||||
|
||||
# Make a copy of the executable with its ELF headers removed.
|
||||
${SA_PROG}.bin : ${SA_PROG}
|
||||
${OBJCOPY} --output-target=binary ${SA_PROG} $@
|
||||
|
||||
${SA_PROG} : ${OBJS} ${DPADD} ${SRTLIB}
|
||||
${LD} -N -Ttext ${RELOC} -e start -o $@ \
|
||||
${SRTOBJ} ${OBJS} ${LDADD} ${SRTLIB}
|
||||
@${SIZE} $@
|
||||
|
||||
.if !target(proginstall)
|
||||
realall: ${SA_PROG} ${SA_PROG}.bin
|
||||
proginstall: ${SA_PROG}.bin
|
||||
${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
||||
${SA_PROG}.bin ${DESTDIR}${MDEC_DIR}/${SA_PROG}
|
||||
.endif
|
||||
|
||||
.endif # defined(SA_PROG)
|
||||
|
||||
CLEANFILES+= machine m68k
|
||||
.BEGIN: machine m68k
|
||||
.NOPATH: machine m68k
|
||||
realall realdepend: machine m68k
|
||||
|
||||
machine :
|
||||
-rm -f $@
|
||||
ln -s ${S}/arch/sun3/include $@
|
||||
|
||||
m68k :
|
||||
-rm -f $@
|
||||
ln -s ${S}/arch/m68k/include $@
|
|
@ -1,38 +0,0 @@
|
|||
/* $NetBSD: README,v 1.3 1995/11/17 23:23:45 gwr Exp $ */
|
||||
|
||||
The sun bootblocks are split into two parts: a small 1st-level program that
|
||||
gets written right after the superblock in a partition (and is hence limited
|
||||
in size to SBSIZE - DEV_BSIZE bytes), and a 2nd-level program that resides
|
||||
in the filesystem proper.
|
||||
|
||||
The 1st-level program is loaded into memory by the PROM. It loads the second
|
||||
stage program from a set of filesystem block numbers that are hard-coded
|
||||
into it by the `installboot' program. The prototype code for the 1st-level
|
||||
bootblocks are in `bootxx'.
|
||||
|
||||
The 2nd-level program (`ufsboot') is normally installed in the root FS
|
||||
as `/ufsboot'. It uses the device drivers in the PROM and the stand-alone
|
||||
filesystem code in `libsa.a' to locate and load the kernel.
|
||||
|
||||
Use the following command to install the 1st-level bootblocks in the
|
||||
root filesystem (on `sd0a') using the file `/boot' as the second level
|
||||
boot program:
|
||||
|
||||
mount /dev/sd0a /mnt
|
||||
cd /usr/mdec
|
||||
cp -p ufsboot /mnt/ufsboot
|
||||
sync ; sleep 1 ; sync
|
||||
./installboot -v /mnt/ufsboot bootxx /dev/rsd0a
|
||||
|
||||
The above only works with securelevel <= 0 (see init.8 manual).
|
||||
|
||||
Status:
|
||||
|
||||
netboot works.
|
||||
|
||||
bootxx, installboot are tested and working. It would be nice if
|
||||
installboot would find the inumber for the 2nd stage boot program
|
||||
without having the filesystem mounted so this command can work
|
||||
with securelevel==1 (the default). Doing this requies adding
|
||||
code to read and do a directory lookup in the root...
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
# $NetBSD: Makefile,v 1.11 2002/02/09 09:36:02 lukem Exp $
|
||||
|
||||
SA_PROG= bootxx
|
||||
SRCS= bootxx.c conf.c
|
||||
|
||||
# Do not strip or remove a.out header for this one.
|
||||
proginstall: ${SA_PROG}
|
||||
${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
||||
${SA_PROG} ${DESTDIR}${MDEC_DIR}/${SA_PROG}
|
||||
|
||||
PROG= ${SA_PROG}
|
||||
NOMAN= # defined
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
|
@ -1,142 +0,0 @@
|
|||
/* $NetBSD: bootxx.c,v 1.10 2001/02/22 07:11:10 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Paul Kranenburg.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is a generic "first-stage" boot program.
|
||||
*
|
||||
* Note that this program has absolutely no filesystem knowledge!
|
||||
*
|
||||
* Instead, this uses a table of disk block numbers that are
|
||||
* filled in by the installboot program such that this program
|
||||
* can load the "second-stage" boot program.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <machine/mon.h>
|
||||
|
||||
#include <stand.h>
|
||||
#include "libsa.h"
|
||||
|
||||
/*
|
||||
* This is the address where we load the second-stage boot loader.
|
||||
*/
|
||||
#define LOADADDR 0x4000
|
||||
|
||||
/* This determines the largest boot program we can load. */
|
||||
#define MAXBLOCKNUM 64
|
||||
|
||||
/*
|
||||
* These three names are known by installboot.
|
||||
* The block_table contains starting block numbers,
|
||||
* in terms of 512-byte blocks. Each non-zero value
|
||||
* will result in a read of block_size bytes.
|
||||
*/
|
||||
int block_size = 512; /* default */
|
||||
int block_count = MAXBLOCKNUM; /* length of table */
|
||||
daddr_t block_table[MAXBLOCKNUM] = { 0 };
|
||||
|
||||
|
||||
void
|
||||
main()
|
||||
{
|
||||
struct open_file f;
|
||||
void *entry;
|
||||
char *addr;
|
||||
int n, error;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("bootxx: open...\n");
|
||||
#endif
|
||||
f.f_flags = F_RAW;
|
||||
if (devopen(&f, 0, &addr)) {
|
||||
printf("bootxx: devopen failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
addr = (char*)LOADADDR;
|
||||
error = copyboot(&f, addr);
|
||||
f.f_dev->dv_close(&f);
|
||||
if (!error) {
|
||||
#ifdef DEBUG
|
||||
printf("bootxx: start 0x%x\n", (long)addr);
|
||||
#endif
|
||||
entry = addr;
|
||||
chain_to(entry);
|
||||
}
|
||||
/* copyboot had a problem... */
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
copyboot(fp, addr)
|
||||
struct open_file *fp;
|
||||
char *addr;
|
||||
{
|
||||
int n, i, blknum;
|
||||
char *buf;
|
||||
|
||||
/* Need to use a buffer that can be mapped into DVMA space. */
|
||||
buf = alloc(block_size);
|
||||
if (!buf)
|
||||
panic("bootxx: alloc failed");
|
||||
|
||||
for (i = 0; i < block_count; i++) {
|
||||
|
||||
if ((blknum = block_table[i]) == 0)
|
||||
break;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("bootxx: block # %d = %d\n", i, blknum);
|
||||
#endif
|
||||
if ((fp->f_dev->dv_strategy)(fp->f_devdata, F_READ,
|
||||
blknum, block_size, buf, &n))
|
||||
{
|
||||
printf("bootxx: read failed\n");
|
||||
return -1;
|
||||
}
|
||||
if (n != block_size) {
|
||||
printf("bootxx: short read\n");
|
||||
return -1;
|
||||
}
|
||||
bcopy(buf, addr, block_size);
|
||||
addr += block_size;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
/* $NetBSD: conf.c,v 1.2 1995/10/13 21:45:00 gwr Exp $ */
|
||||
|
||||
#include <stand.h>
|
||||
#include <dev_disk.h>
|
||||
|
||||
struct devsw devsw[] = {
|
||||
{ "disk", disk_strategy, disk_open, disk_close, disk_ioctl },
|
||||
};
|
||||
int ndevs = 1;
|
||||
|
||||
int debug;
|
|
@ -1,21 +0,0 @@
|
|||
# $NetBSD: Makefile,v 1.16 2001/12/12 12:24:25 lukem Exp $
|
||||
|
||||
NOMAN= # defined
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
PROG= installboot
|
||||
BINDIR=/usr/mdec
|
||||
S= ${.CURDIR}/../../../..
|
||||
LIBSA=${S}/lib/libsa
|
||||
CPPFLAGS+= -I${LIBSA} -I.
|
||||
WARNS?= 1
|
||||
|
||||
# Need this to work in the miniroot
|
||||
LDSTATIC?= -static
|
||||
|
||||
.PATH.c: ${LIBSA}
|
||||
|
||||
SRCS= installboot.c byteorder.c loadfile.c loadfile_aout.c loadfile_elf32.c
|
||||
|
||||
.include <bsd.prog.mk>
|
|
@ -1,336 +0,0 @@
|
|||
/* $NetBSD: installboot.c,v 1.8 2001/02/22 07:11:10 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Paul Kranenburg.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ufs/ufs/dinode.h>
|
||||
#include <ufs/ufs/dir.h>
|
||||
#include <ufs/ffs/fs.h>
|
||||
#include <err.h>
|
||||
#include <fcntl.h>
|
||||
#include <nlist.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "loadfile.h"
|
||||
|
||||
int verbose, nowrite, hflag;
|
||||
char *boot, *proto, *dev;
|
||||
|
||||
struct nlist nl[] = {
|
||||
#define X_BLOCK_SIZE 0
|
||||
{ "block_size" },
|
||||
#define X_BLOCK_COUNT 1
|
||||
{ "block_count" },
|
||||
#define X_BLOCK_TABLE 2
|
||||
{ "block_table" },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
int *block_size_p; /* block size var. in prototype image */
|
||||
int *block_count_p; /* block count var. in prototype image */
|
||||
daddr_t *block_table; /* block number array in prototype image */
|
||||
int maxblocknum; /* size of this array */
|
||||
|
||||
|
||||
char *loadprotoblocks __P((char *, size_t *));
|
||||
int loadblocknums __P((char *, int));
|
||||
static void devread __P((int, void *, daddr_t, size_t, char *));
|
||||
static void usage __P((void));
|
||||
int main __P((int, char *[]));
|
||||
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: installboot [-n] [-v] [-h] <boot> <proto> <device>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int c;
|
||||
int devfd;
|
||||
char *protostore;
|
||||
size_t protosize;
|
||||
|
||||
while ((c = getopt(argc, argv, "vnh")) != -1) {
|
||||
switch (c) {
|
||||
case 'h':
|
||||
/* Don't strip a.out header */
|
||||
hflag = 1;
|
||||
break;
|
||||
case 'n':
|
||||
/* Do not actually write the bootblock to disk */
|
||||
nowrite = 1;
|
||||
break;
|
||||
case 'v':
|
||||
/* Chat */
|
||||
verbose = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (argc - optind < 3) {
|
||||
usage();
|
||||
}
|
||||
|
||||
boot = argv[optind];
|
||||
proto = argv[optind + 1];
|
||||
dev = argv[optind + 2];
|
||||
|
||||
if (verbose) {
|
||||
printf("boot: %s\n", boot);
|
||||
printf("proto: %s\n", proto);
|
||||
printf("device: %s\n", dev);
|
||||
}
|
||||
|
||||
/* Load proto blocks into core */
|
||||
if ((protostore = loadprotoblocks(proto, &protosize)) == NULL)
|
||||
exit(1);
|
||||
|
||||
if (protosize & (DEV_BSIZE - 1))
|
||||
err(1, "proto bootblock bad size=%lu", (u_long)protosize);
|
||||
|
||||
/* Open and check raw disk device */
|
||||
if ((devfd = open(dev, O_RDONLY, 0)) < 0)
|
||||
err(1, "open: %s", dev);
|
||||
|
||||
/* Extract and load block numbers */
|
||||
if (loadblocknums(boot, devfd) != 0)
|
||||
exit(1);
|
||||
|
||||
(void)close(devfd);
|
||||
|
||||
if (nowrite)
|
||||
return 0;
|
||||
|
||||
/* Write patched proto bootblocks into the superblock */
|
||||
if (protosize > SBSIZE - DEV_BSIZE)
|
||||
errx(1, "proto bootblocks too big");
|
||||
|
||||
if ((devfd = open(dev, O_RDWR)) < 0)
|
||||
err(1, "open: %s", dev);
|
||||
|
||||
if (lseek(devfd, DEV_BSIZE, SEEK_SET) != DEV_BSIZE)
|
||||
err(1, "lseek bootstrap");
|
||||
|
||||
/* Sync filesystems (to clean in-memory superblock?) */
|
||||
sync();
|
||||
|
||||
if (write(devfd, protostore, protosize) != protosize)
|
||||
err(1, "write bootstrap");
|
||||
(void)close(devfd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
loadprotoblocks(fname, size)
|
||||
char *fname;
|
||||
size_t *size;
|
||||
{
|
||||
int fd;
|
||||
u_long marks[MARK_MAX], offs;
|
||||
char *bp;
|
||||
|
||||
fd = -1;
|
||||
|
||||
/* Locate block number array in proto file */
|
||||
if (nlist(fname, nl) != 0) {
|
||||
warnx("nlist: %s: symbols not found", fname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
marks[MARK_START] = 0;
|
||||
if ((fd = loadfile(fname, marks, COUNT_TEXT|COUNT_DATA)) == -1)
|
||||
return NULL;
|
||||
(void)close(fd);
|
||||
|
||||
*size = roundup(marks[MARK_END] - marks[MARK_START], DEV_BSIZE);
|
||||
bp = malloc(*size);
|
||||
|
||||
offs = marks[MARK_START];
|
||||
marks[MARK_START] = (u_long)bp - offs;
|
||||
|
||||
if ((fd = loadfile(fname, marks, LOAD_TEXT|LOAD_DATA)) == -1)
|
||||
return NULL;
|
||||
(void)close(fd);
|
||||
|
||||
/* Calculate the symbols' locations within the proto file */
|
||||
block_size_p = (int *) (bp + (nl[X_BLOCK_SIZE ].n_value - offs));
|
||||
block_count_p = (int *) (bp + (nl[X_BLOCK_COUNT].n_value - offs));
|
||||
block_table = (daddr_t *) (bp + (nl[X_BLOCK_TABLE].n_value - offs));
|
||||
maxblocknum = *block_count_p;
|
||||
|
||||
if (verbose) {
|
||||
printf("%s: entry point %#lx\n", fname, marks[MARK_ENTRY]);
|
||||
printf("proto bootblock size %d\n", *size);
|
||||
printf("room for %d filesystem blocks at %#lx\n",
|
||||
maxblocknum, nl[X_BLOCK_TABLE].n_value);
|
||||
}
|
||||
|
||||
return bp;
|
||||
}
|
||||
|
||||
static void
|
||||
devread(fd, buf, blk, size, msg)
|
||||
int fd;
|
||||
void *buf;
|
||||
daddr_t blk;
|
||||
size_t size;
|
||||
char *msg;
|
||||
{
|
||||
if (lseek(fd, dbtob(blk), SEEK_SET) != dbtob(blk))
|
||||
err(1, "%s: devread: lseek", msg);
|
||||
|
||||
if (read(fd, buf, size) != size)
|
||||
err(1, "%s: devread: read", msg);
|
||||
}
|
||||
|
||||
static char sblock[SBSIZE];
|
||||
|
||||
int
|
||||
loadblocknums(boot, devfd)
|
||||
char *boot;
|
||||
int devfd;
|
||||
{
|
||||
int i, fd;
|
||||
struct stat statbuf;
|
||||
struct statfs statfsbuf;
|
||||
struct fs *fs;
|
||||
char *buf;
|
||||
daddr_t blk, *ap;
|
||||
struct dinode *ip;
|
||||
int ndb;
|
||||
|
||||
/*
|
||||
* Open 2nd-level boot program and record the block numbers
|
||||
* it occupies on the filesystem represented by `devfd'.
|
||||
*/
|
||||
|
||||
/* Make sure the (probably new) boot file is on disk. */
|
||||
sync(); sleep(1);
|
||||
|
||||
if ((fd = open(boot, O_RDONLY)) < 0)
|
||||
err(1, "open: %s", boot);
|
||||
|
||||
if (fstatfs(fd, &statfsbuf) != 0)
|
||||
err(1, "statfs: %s", boot);
|
||||
|
||||
if (strncmp(statfsbuf.f_fstypename, "ffs", MFSNAMELEN) &&
|
||||
strncmp(statfsbuf.f_fstypename, "ufs", MFSNAMELEN) ) {
|
||||
errx(1, "%s: must be on an FFS filesystem", boot);
|
||||
}
|
||||
|
||||
if (fsync(fd) != 0)
|
||||
err(1, "fsync: %s", boot);
|
||||
|
||||
if (fstat(fd, &statbuf) != 0)
|
||||
err(1, "fstat: %s", boot);
|
||||
|
||||
close(fd);
|
||||
|
||||
/* Read superblock */
|
||||
devread(devfd, sblock, SBLOCK, SBSIZE, "superblock");
|
||||
fs = (struct fs *)sblock;
|
||||
|
||||
/* Sanity-check super-block. */
|
||||
if (fs->fs_magic != FS_MAGIC)
|
||||
errx(1, "Bad magic number in superblock");
|
||||
if (fs->fs_inopb <= 0)
|
||||
err(1, "Bad inopb=%d in superblock", fs->fs_inopb);
|
||||
|
||||
/* Read inode */
|
||||
if ((buf = malloc(fs->fs_bsize)) == NULL)
|
||||
errx(1, "No memory for filesystem block");
|
||||
|
||||
blk = fsbtodb(fs, ino_to_fsba(fs, statbuf.st_ino));
|
||||
devread(devfd, buf, blk, fs->fs_bsize, "inode");
|
||||
ip = (struct dinode *)(buf) + ino_to_fsbo(fs, statbuf.st_ino);
|
||||
|
||||
/*
|
||||
* Have the inode. Figure out how many blocks we need.
|
||||
*/
|
||||
ndb = howmany(ip->di_size, fs->fs_bsize);
|
||||
if (ndb > maxblocknum)
|
||||
errx(1, "Too many blocks");
|
||||
*block_count_p = ndb;
|
||||
*block_size_p = fs->fs_bsize;
|
||||
if (verbose)
|
||||
printf("Will load %d blocks of size %d each.\n",
|
||||
ndb, fs->fs_bsize);
|
||||
|
||||
/*
|
||||
* Get the block numbers; we don't handle fragments
|
||||
*/
|
||||
ap = ip->di_db;
|
||||
for (i = 0; i < NDADDR && *ap && ndb; i++, ap++, ndb--) {
|
||||
blk = fsbtodb(fs, *ap);
|
||||
if (verbose)
|
||||
printf("%d: %d\n", i, blk);
|
||||
block_table[i] = blk;
|
||||
}
|
||||
if (ndb == 0)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Just one level of indirections; there isn't much room
|
||||
* for more in the 1st-level bootblocks anyway.
|
||||
*/
|
||||
blk = fsbtodb(fs, ip->di_ib[0]);
|
||||
devread(devfd, buf, blk, fs->fs_bsize, "indirect block");
|
||||
ap = (daddr_t *)buf;
|
||||
for (; i < NINDIR(fs) && *ap && ndb; i++, ap++, ndb--) {
|
||||
blk = fsbtodb(fs, *ap);
|
||||
if (verbose)
|
||||
printf("%d: %d\n", i, blk);
|
||||
block_table[i] = blk;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
# $NetBSD: Makefile,v 1.38 2002/05/05 20:38:48 jdolecek Exp $
|
||||
|
||||
LIB=sa
|
||||
|
||||
#
|
||||
# We're not actually building a profiled version,
|
||||
# but this way the separate object files get built
|
||||
#
|
||||
|
||||
POBJS=SRT0.o SRT1.o
|
||||
|
||||
NOLINT=# defined
|
||||
NOPIC=# defined
|
||||
NOPROFILE=# defined
|
||||
|
||||
# Logically src/sys
|
||||
S=${.CURDIR}/../../../..
|
||||
DIR_SA=${S}/lib/libsa
|
||||
DIR_KERN=${S}/lib/libkern
|
||||
|
||||
.PATH: ${DIR_SA} ${DIR_KERN}
|
||||
|
||||
# DEBUG= -DDEBUG -DNETIF_DEBUG -DNFS_DEBUG -DRPC_DEBUG \
|
||||
# -DNET_DEBUG -DRARP_DEBUG -DETHER_DEBUG -DDEBUG_PROM
|
||||
|
||||
DEFS= -Dsun3 -D_STANDALONE
|
||||
INCL= -I. -I${.CURDIR} -I${S}/lib/libsa -I${S}
|
||||
CFLAGS= -Os -msoft-float -fno-defer-pop
|
||||
CPPFLAGS= ${DEFS} ${DEBUG} ${INCL}
|
||||
CLEANFILES= SRT0.o SRT1.o vers.c
|
||||
|
||||
SRC_net= net.c ether.c arp.c in_cksum.c rarp.c
|
||||
|
||||
SRC_sa = alloc.c bcmp.c bcopy.c bzero.c close.c files.c getfile.c loadfile.c \
|
||||
loadfile_aout.c loadfile_elf32.c lseek.c memcmp.c memcpy.c \
|
||||
memset.c open.c printf.c read.c sprintf.c strerror.c subr_prf.c \
|
||||
twiddle.c
|
||||
|
||||
SRC_kern= ashldi3.c ashrdi3.c inet_addr.c intoa.c strcmp.c strlen.c strncmp.c
|
||||
|
||||
SRC_here= clock.c dev_disk.c devopen.c \
|
||||
gets.c idprom.c netif_sun.c panic.c \
|
||||
promboot.c promcons.c promdev.c \
|
||||
sun3.c sun3x.c vers.c xxboot.c
|
||||
|
||||
SRCS= ${SRC_net} ${SRC_sa} ${SRC_kern} ${SRC_here}
|
||||
|
||||
.PATH: ${S}/arch/sun3/sun3
|
||||
SRCS+= ctrlsp.S
|
||||
|
||||
# only needed during build
|
||||
libinstall::
|
||||
|
||||
.include <bsd.own.mk>
|
||||
.undef DESTDIR
|
||||
.include <bsd.lib.mk>
|
||||
|
||||
# Nuke these...
|
||||
LOBJS=
|
||||
POBJS=
|
||||
SOBJS=
|
||||
|
||||
# Customized rules...
|
||||
|
||||
vers.c: ${.CURDIR}/version
|
||||
sh ${S}/conf/newvers_stand.sh -MD ${.CURDIR}/version "sun3"
|
|
@ -1,149 +0,0 @@
|
|||
| $NetBSD: SRT0.S,v 1.6 2001/05/10 16:50:22 fredette Exp $
|
||||
|
||||
| Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
| All rights reserved.
|
||||
|
|
||||
| This code is derived from software contributed to The NetBSD Foundation
|
||||
| by Gordon W. Ross.
|
||||
|
|
||||
| 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 the NetBSD
|
||||
| Foundation, Inc. and its contributors.
|
||||
| 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
| contributors may be used to endorse or promote products derived
|
||||
| from this software without specific prior written permission.
|
||||
|
|
||||
| THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
| ``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 FOUNDATION OR CONTRIBUTORS
|
||||
| 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.
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
| SRT0.S - Stand-alone Run-Time startup code, part 0
|
||||
.file "SRT0.S"
|
||||
.data
|
||||
|
||||
| Flush the CPU cache using MC68020 values just to be safe.
|
||||
| This will cause the MC68030 to run with the data cache
|
||||
| disabled, but that is OK for boot programs.
|
||||
.set IC_CLEAR,0x9
|
||||
.set PSL_HIGHIPL,0x2700
|
||||
|
||||
.text
|
||||
|
||||
ASENTRY_NOPROFILE(start)
|
||||
| Disable interrupts (just in case...)
|
||||
movw #PSL_HIGHIPL,%sr
|
||||
|
||||
| Check to see if the code is located correctly.
|
||||
| Get current location via PC-relative load, then...
|
||||
lea %pc@(start:w),%a0 | current location (0x4000)
|
||||
| ...force a long (not PC-relative) load to a1 and compare.
|
||||
lea start:l,%a1 | desired location (LINKADDR)
|
||||
cmpl %a0,%a1
|
||||
beqs restart
|
||||
|
||||
| Relocate the code and data to where they belong.
|
||||
movl #_edata,%d0 | Desired end of program
|
||||
subl %a1,%d0 | Calculate length, round up.
|
||||
lsrl #2,%d0
|
||||
Lcp:
|
||||
movl %a0@+,%a1@+
|
||||
dbra %d0,Lcp
|
||||
|
||||
| Clear the I-cache in case the copied code was cached.
|
||||
movl #IC_CLEAR,%d0
|
||||
movc %d0,%cacr
|
||||
| Force a long jump to the relocated code (not pc-relative)
|
||||
lea restart:l,%a0
|
||||
jmp %a0@
|
||||
|
||||
| Define the location of our stack (just before relocated text).
|
||||
| Leave room the exit jmpbuf at the end of our stack.
|
||||
.set estack,start-60
|
||||
|
||||
restart:
|
||||
| Now in the relocated code, using the monitor stack.
|
||||
| Save this context so we can return with it.
|
||||
pea estack
|
||||
jbsr _C_LABEL(setjmp)
|
||||
addqw #4,%sp
|
||||
tstl %d0
|
||||
bne Ldone | here via longjmp
|
||||
|
||||
| Switch to our own stack.
|
||||
lea estack,%a0
|
||||
movl %a0,%sp
|
||||
subl %a6,%a6
|
||||
|
||||
| Clear out BSS...
|
||||
lea _edata,%a0
|
||||
lea _end,%a1
|
||||
Lclrbss:
|
||||
clrl %a0@+
|
||||
cmpl %a1,%a0
|
||||
ble Lclrbss
|
||||
|
||||
| Call the run-time startup C code, which will:
|
||||
| initialize, call main, call exit.
|
||||
jbsr _C_LABEL(_start)
|
||||
|
||||
| Switch back to the monitor stack, then either
|
||||
| "chain" to the next program or return.
|
||||
ENTRY(exit)
|
||||
pea estack
|
||||
jbsr _C_LABEL(longjmp) | to next line
|
||||
Ldone:
|
||||
movl _C_LABEL(chain_to_func),%a0
|
||||
tstl %a0
|
||||
beq Lret
|
||||
jmp %a0@
|
||||
Lret:
|
||||
rts
|
||||
|
||||
| function to clear the I-cache
|
||||
ENTRY(ICIA)
|
||||
movl #IC_CLEAR,%d0
|
||||
movc %d0,%cacr
|
||||
rts
|
||||
|
||||
| function to get the vector base register
|
||||
ENTRY(getvbr)
|
||||
movc %vbr,%a0
|
||||
rts
|
||||
|
||||
| Kernel version of setjmp/longjmp (label_t is 16 words)
|
||||
|
||||
ENTRY(setjmp)
|
||||
movl %sp@(4),%a0 | savearea pointer
|
||||
moveml #0xFCFC,%a0@ | save d2-d7/a2-a7
|
||||
movl %sp@,%a0@(48) | and return address
|
||||
movl #0,%d0 | return 0
|
||||
rts
|
||||
|
||||
ENTRY(longjmp)
|
||||
movl %sp@(4),%a0 | savearea pointer
|
||||
moveml %a0@+,#0xFCFC | restore d2-d7/a2-a7
|
||||
| Note: just changed sp!
|
||||
movl %a0@,%sp@ | and return address
|
||||
movl #1,%d0 | return 1
|
||||
rts
|
||||
|
||||
| The end.
|
|
@ -1,126 +0,0 @@
|
|||
/* $NetBSD: SRT1.c,v 1.7 1998/02/05 04:57:05 gwr Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Gordon W. Ross.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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 <sys/types.h>
|
||||
#include <machine/mon.h>
|
||||
|
||||
#include "libsa.h"
|
||||
#include "dvma.h"
|
||||
|
||||
int _is3x = 0;
|
||||
struct sunromvec *_romvec = 0;
|
||||
void *chain_to_func = 0;
|
||||
|
||||
/*
|
||||
* These are the function pointers for sun3 vs sun3x stuff.
|
||||
*/
|
||||
char * (*dev_mapin_p) __P((int, u_long, int));
|
||||
char * (*dvma_alloc_p) __P((int len));
|
||||
void (*dvma_free_p) __P((char *dvma, int len));
|
||||
char * (*dvma_mapin_p) __P((char *pkt, int len));
|
||||
void (*dvma_mapout_p) __P((char *dmabuf, int len));
|
||||
|
||||
/*
|
||||
* This is called by SRT0.S
|
||||
* to do final prep for main
|
||||
*/
|
||||
void
|
||||
_start()
|
||||
{
|
||||
void **vbr;
|
||||
int x;
|
||||
|
||||
/*
|
||||
* Determine sun3 vs sun3x by looking where the
|
||||
* vector base register points. The PROM always
|
||||
* points that somewhere into [MONSTART..MONEND]
|
||||
* which is a different range on each.
|
||||
*/
|
||||
|
||||
vbr = getvbr();
|
||||
x = (int)vbr & 0xFFF00000;
|
||||
if (x == SUN3X_MONSTART)
|
||||
_is3x = 1;
|
||||
|
||||
/* Find the PROM vector. */
|
||||
if (_is3x)
|
||||
x = SUN3X_PROM_BASE;
|
||||
else
|
||||
x = SUN3_PROM_BASE;
|
||||
_romvec = ((struct sunromvec *) x);
|
||||
|
||||
/* Setup trap 14 for use as a breakpoint. */
|
||||
vbr[32+14] = _romvec->abortEntry;
|
||||
|
||||
/* Initialize sun3 vs sun3x function pointers. */
|
||||
if (_is3x)
|
||||
sun3x_init();
|
||||
else
|
||||
sun3_init();
|
||||
|
||||
main(0);
|
||||
exit();
|
||||
}
|
||||
|
||||
void
|
||||
breakpoint()
|
||||
{
|
||||
__asm __volatile ("trap #14");
|
||||
}
|
||||
|
||||
void
|
||||
chain_to(func)
|
||||
void *func;
|
||||
{
|
||||
|
||||
/*
|
||||
* If set, this pointer is jumped-to by exit
|
||||
* after carefully restoring the PROM stack.
|
||||
*/
|
||||
chain_to_func = func;
|
||||
ICIA();
|
||||
exit();
|
||||
}
|
||||
|
||||
/*
|
||||
* Boot programs in C++ ? Not likely!
|
||||
*/
|
||||
void
|
||||
__main() {}
|
|
@ -1,27 +0,0 @@
|
|||
/* $NetBSD: clock.c,v 1.4 1998/02/05 04:57:06 gwr Exp $ */
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/mon.h>
|
||||
|
||||
#include "libsa.h"
|
||||
|
||||
int hz = 1000;
|
||||
|
||||
long
|
||||
getsecs()
|
||||
{
|
||||
long ticks;
|
||||
|
||||
ticks = getticks();
|
||||
return ((ticks / hz));
|
||||
}
|
||||
|
||||
long
|
||||
getticks()
|
||||
{
|
||||
long ticks;
|
||||
|
||||
ticks = *romVectorPtr->nmiClock;
|
||||
return (ticks);
|
||||
}
|
|
@ -1,182 +0,0 @@
|
|||
/* $NetBSD: dev_disk.c,v 1.8 2001/02/22 07:11:10 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Paul Kranenburg.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This module implements a "raw device" interface suitable for
|
||||
* use by the stand-alone I/O library UFS file-system code, and
|
||||
* possibly for direct access (i.e. boot from tape).
|
||||
*
|
||||
* The implementation is deceptively simple because it uses the
|
||||
* drivers provided by the Sun PROM monitor. Note that only the
|
||||
* PROM driver used to load the boot program is available here.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/mon.h>
|
||||
#include <machine/stdarg.h>
|
||||
#include <stand.h>
|
||||
|
||||
#include "libsa.h"
|
||||
#include "dvma.h"
|
||||
#include "saio.h"
|
||||
#include "dev_disk.h"
|
||||
|
||||
#define RETRY_COUNT 5
|
||||
|
||||
int disk_opencount;
|
||||
struct saioreq disk_ioreq;
|
||||
|
||||
int
|
||||
disk_open(struct open_file *f, ...)
|
||||
{
|
||||
struct bootparam *bp;
|
||||
struct saioreq *si;
|
||||
int error;
|
||||
|
||||
#ifdef DEBUG_PROM
|
||||
char *devname; /* Device part of file name (or NULL). */
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, f);
|
||||
devname = va_arg(ap, char *);
|
||||
if (debug)
|
||||
printf("disk_open: %s\n", devname);
|
||||
va_end(ap);
|
||||
#endif
|
||||
|
||||
si = &disk_ioreq;
|
||||
if (disk_opencount == 0) {
|
||||
/*
|
||||
* Setup our part of the saioreq.
|
||||
* (determines what gets opened)
|
||||
*/
|
||||
bp = *romVectorPtr->bootParam;
|
||||
si->si_boottab = bp->bootDevice;
|
||||
si->si_ctlr = bp->ctlrNum;
|
||||
si->si_unit = bp->unitNum;
|
||||
si->si_boff = bp->partNum;
|
||||
if ((error = prom_iopen(si)) != 0)
|
||||
return (error);
|
||||
}
|
||||
disk_opencount++;
|
||||
|
||||
f->f_devdata = si;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
disk_close(f)
|
||||
struct open_file *f;
|
||||
{
|
||||
struct saioreq *si;
|
||||
|
||||
#ifdef DEBUG_PROM
|
||||
if (debug)
|
||||
printf("disk_close: ocnt=%d\n", disk_opencount);
|
||||
#endif
|
||||
|
||||
si = f->f_devdata;
|
||||
f->f_devdata = NULL;
|
||||
if (disk_opencount <= 0)
|
||||
return 0;
|
||||
if (--disk_opencount == 0)
|
||||
prom_iclose(si);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
disk_strategy(devdata, flag, dblk, size, buf, rsize)
|
||||
void *devdata;
|
||||
int flag;
|
||||
daddr_t dblk;
|
||||
size_t size;
|
||||
void *buf;
|
||||
size_t *rsize;
|
||||
{
|
||||
struct saioreq *si;
|
||||
struct boottab *ops;
|
||||
char *dmabuf;
|
||||
int retry, si_flag, xcnt;
|
||||
|
||||
si = devdata;
|
||||
ops = si->si_boottab;
|
||||
|
||||
#ifdef DEBUG_PROM
|
||||
if (debug > 1)
|
||||
printf("disk_strategy: size=%d dblk=%d\n", size, dblk);
|
||||
#endif
|
||||
|
||||
dmabuf = dvma_mapin(buf, size);
|
||||
si_flag = (flag == F_READ) ? SAIO_F_READ : SAIO_F_WRITE;
|
||||
|
||||
/*
|
||||
* The PROM strategy will occasionally return -1 and expect
|
||||
* us to try again. From mouse@Collatz.McRCIM.McGill.EDU
|
||||
*/
|
||||
retry = RETRY_COUNT;
|
||||
do {
|
||||
si->si_bn = dblk;
|
||||
si->si_ma = dmabuf;
|
||||
si->si_cc = size;
|
||||
xcnt = (*ops->b_strategy)(si, si_flag);
|
||||
} while ((xcnt <= 0) && (--retry > 0));
|
||||
|
||||
dvma_mapout(dmabuf, size);
|
||||
|
||||
#ifdef DEBUG_PROM
|
||||
if (debug > 1)
|
||||
printf("disk_strategy: xcnt = %x retries=%d\n",
|
||||
xcnt, RETRY_COUNT - retry);
|
||||
#endif
|
||||
|
||||
if (xcnt <= 0)
|
||||
return (EIO);
|
||||
|
||||
*rsize = xcnt;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
disk_ioctl(f, cmd, data)
|
||||
struct open_file *f;
|
||||
u_long cmd;
|
||||
void *data;
|
||||
{
|
||||
return EIO;
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
/* $NetBSD: dev_disk.h,v 1.4 2001/02/22 07:11:10 chs Exp $ */
|
||||
|
||||
|
||||
int disk_open __P((struct open_file *, ...));
|
||||
int disk_close __P((struct open_file *));
|
||||
int disk_strategy __P((void *, int, daddr_t, size_t, void *, size_t *));
|
||||
int disk_ioctl __P((struct open_file *, u_long, void *));
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
/* $NetBSD: devopen.c,v 1.4 1998/02/05 04:57:08 gwr Exp $ */
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/mon.h>
|
||||
|
||||
#include <stand.h>
|
||||
#include "libsa.h"
|
||||
|
||||
/*
|
||||
* Open the device named by the combined device/file name
|
||||
* given as the "fname" arg, something like: "sd()netbsd"
|
||||
*
|
||||
* However, Sun PROMs don't really let you choose which
|
||||
* device you will talk to. You can only open the device
|
||||
* that was used to load the boot program. Therefore, we
|
||||
* do not accept a "device" part in the "fname" string.
|
||||
* Pass the PROM device name to open in case it needs it.
|
||||
*/
|
||||
int
|
||||
devopen(f, fname, file)
|
||||
struct open_file *f;
|
||||
const char *fname;
|
||||
char **file;
|
||||
{
|
||||
struct devsw *dp;
|
||||
int error;
|
||||
|
||||
*file = (char*)fname;
|
||||
dp = &devsw[0];
|
||||
f->f_dev = dp;
|
||||
error = (*dp->dv_open)(f, prom_bootdev);
|
||||
|
||||
return (error);
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
/* $NetBSD: dvma.h,v 1.4 1998/02/05 04:57:10 gwr Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Gordon W. Ross.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
extern char * (*dvma_alloc_p) __P((int len));
|
||||
#define dvma_alloc (*dvma_alloc_p)
|
||||
|
||||
extern void (*dvma_free_p) __P((char *dvma, int len));
|
||||
#define dvma_free (*dvma_free_p)
|
||||
|
||||
extern char * (*dvma_mapin_p) __P((char *pkt, int len));
|
||||
#define dvma_mapin (*dvma_mapin_p)
|
||||
|
||||
extern void (*dvma_mapout_p) __P((char *dmabuf, int len));
|
||||
#define dvma_mapout (*dvma_mapout_p)
|
||||
|
||||
/*
|
||||
* This stuff is not really DVMA-related,
|
||||
* but is mapping related. Oh well...
|
||||
*/
|
||||
extern char * (*dev_mapin_p) __P((int t, u_long a, int l));
|
||||
#define dev_mapin (*dev_mapin_p)
|
||||
|
||||
/*
|
||||
* Called from SRT1.c to set the pointers declared above.
|
||||
*/
|
||||
void sun3_init __P((void));
|
||||
void sun3x_init __P((void));
|
|
@ -1,116 +0,0 @@
|
|||
/* $NetBSD: gets.c,v 1.2 2001/09/05 13:35:30 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
|
||||
*
|
||||
* @(#)gets.c 8.1 (Berkeley) 6/11/93
|
||||
*/
|
||||
|
||||
#include "stand.h"
|
||||
|
||||
/*
|
||||
* This implementation assumes that getchar() does echo, because
|
||||
* on some machines, it is hard to keep echo from being done.
|
||||
* Those that need it can do echo in their getchar() function.
|
||||
*
|
||||
* Yes, the code below will echo CR, DEL, and other control chars,
|
||||
* but sending CR or DEL here is harmless. All the other editing
|
||||
* characters will be followed by a newline, so it doesn't matter.
|
||||
* (Most terminals will not show them anyway.)
|
||||
*/
|
||||
|
||||
void
|
||||
gets(buf)
|
||||
char *buf;
|
||||
{
|
||||
int c;
|
||||
char *lp;
|
||||
|
||||
top:
|
||||
lp = buf;
|
||||
|
||||
for (;;) {
|
||||
c = getchar() & 0177;
|
||||
|
||||
#ifdef GETS_MUST_ECHO /* Preserved in case someone wants it... */
|
||||
putchar(c);
|
||||
#endif
|
||||
|
||||
switch (c) {
|
||||
|
||||
default:
|
||||
*lp++ = c;
|
||||
continue;
|
||||
|
||||
case '\177':
|
||||
putchar('\b');
|
||||
/* fall through */
|
||||
case '\b':
|
||||
putchar(' ');
|
||||
putchar('\b');
|
||||
/* fall through */
|
||||
case '#':
|
||||
if (lp > buf)
|
||||
lp--;
|
||||
continue;
|
||||
|
||||
#ifdef GETS_REPRINT
|
||||
/*
|
||||
* This is not very useful in a boot program.
|
||||
* (It costs you 52 bytes on m68k, gcc -O3).
|
||||
*/
|
||||
case 'r'&037: {
|
||||
char *p;
|
||||
putchar('\n');
|
||||
for (p = buf; p < lp; ++p)
|
||||
putchar(*p);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
case '@':
|
||||
case 'u'&037:
|
||||
case 'w'&037:
|
||||
putchar('\n');
|
||||
goto top;
|
||||
|
||||
case '\r':
|
||||
putchar('\n');
|
||||
/* fall through */
|
||||
case '\n':
|
||||
*lp = '\0';
|
||||
return;
|
||||
|
||||
} /* switch */
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
|
@ -1,159 +0,0 @@
|
|||
/* $NetBSD: idprom.c,v 1.3 1999/03/04 08:06:59 gwr Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Adam Glass and Gordon W. Ross.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine ID PROM - system type and serial number
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/idprom.h>
|
||||
#include <machine/mon.h>
|
||||
|
||||
#include "libsa.h"
|
||||
|
||||
/*
|
||||
* This driver provides a soft copy of the IDPROM.
|
||||
* It is copied from the device early in startup.
|
||||
* Allow these to be patched (helps with poor old
|
||||
* Sun3/80 boxes with dead NVRAM).
|
||||
*/
|
||||
u_char cpu_machine_id = 0;
|
||||
struct idprom identity_prom = { 0 };
|
||||
|
||||
int idprom_cksum __P((u_char *));
|
||||
void idprom_init3 __P((void));
|
||||
void idprom_init3x __P((void));
|
||||
|
||||
int
|
||||
idprom_cksum(p)
|
||||
u_char *p;
|
||||
{
|
||||
int len, x;
|
||||
|
||||
len = IDPROM_CKSUM_SIZE;
|
||||
x = 0; /* xor of data */
|
||||
do x ^= *p++;
|
||||
while (--len > 0);
|
||||
return (x);
|
||||
}
|
||||
|
||||
/* Copy the ethernet address into the passed space. */
|
||||
void
|
||||
idprom_etheraddr(eaddrp)
|
||||
u_char *eaddrp;
|
||||
{
|
||||
|
||||
idprom_init();
|
||||
bcopy(identity_prom.idp_etheraddr, eaddrp, 6);
|
||||
}
|
||||
|
||||
/* Fetch a copy of the idprom. */
|
||||
void
|
||||
idprom_init()
|
||||
{
|
||||
|
||||
if (identity_prom.idp_format == 1)
|
||||
return;
|
||||
|
||||
/* Copy the IDPROM contents and do the checksum. */
|
||||
if (_is3x)
|
||||
idprom_init3x();
|
||||
else
|
||||
idprom_init3();
|
||||
|
||||
if (identity_prom.idp_format != 1)
|
||||
panic("idprom: bad version\n");
|
||||
cpu_machine_id = identity_prom.idp_machtype;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sun3 version:
|
||||
* Just copy it from control space.
|
||||
*/
|
||||
void
|
||||
idprom_init3()
|
||||
{
|
||||
|
||||
/* Copy the IDPROM contents and do the checksum. */
|
||||
sun3_getidprom((u_char *) &identity_prom);
|
||||
if (idprom_cksum((u_char *) &identity_prom))
|
||||
printf("idprom: bad checksum\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Sun3X version:
|
||||
* Rather than do all the map-in/probe work to find the idprom,
|
||||
* we can cheat! We _know_ the monitor already made a copy of
|
||||
* the IDPROM in its data page. All we have to do is find it.
|
||||
*
|
||||
* Yeah, this is sorta gross... Only used on old PROMs that
|
||||
* do not have a sif_macaddr function (rev < 3.0). The area
|
||||
* to search was determined from some "insider" info. about
|
||||
* the layout of the PROM data area.
|
||||
*/
|
||||
void
|
||||
idprom_init3x()
|
||||
{
|
||||
u_char *p;
|
||||
|
||||
printf("idprom: Sun3X search for soft copy...\n");
|
||||
|
||||
for (p = (u_char *)(SUN3X_MONDATA + 0x0400);
|
||||
p < (u_char *)(SUN3X_MONDATA + 0x1c00); p++)
|
||||
{
|
||||
/* first check for some constants */
|
||||
if (p[0] != 0x01) /* format */
|
||||
continue;
|
||||
if (p[2] != 0x08) /* ether[0] */
|
||||
continue;
|
||||
if (p[3] != 0x00) /* ether[1] */
|
||||
continue;
|
||||
if (p[4] != 0x20) /* ether[2] */
|
||||
continue;
|
||||
if ((p[1] & 0xfc) != IDM_ARCH_SUN3X)
|
||||
continue;
|
||||
/* Looks plausible. Try the checksum. */
|
||||
if (idprom_cksum(p) == 0)
|
||||
goto found;
|
||||
}
|
||||
panic("idprom: not found in monitor data\n");
|
||||
|
||||
found:
|
||||
printf("idprom: copy found at 0x%x\n", (int)p);
|
||||
bcopy(p, &identity_prom, sizeof(struct idprom));
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/* $NetBSD: libsa.h,v 1.7 2001/02/22 07:11:10 chs Exp $ */
|
||||
|
||||
/*
|
||||
* This file defines the API for libsa.a
|
||||
* as used by the various boot programs.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Standard Sun3 PROM load address.
|
||||
* i.e. this is where the PROM loads
|
||||
* programs, like it or not!
|
||||
*/
|
||||
#define KERN_LOADADDR 0x4000
|
||||
|
||||
/* SRT0.S */
|
||||
void exit __P((void));
|
||||
void ICIA __P((void));
|
||||
void ** getvbr __P((void));
|
||||
|
||||
/* SRT1.c */
|
||||
extern int _is3x;
|
||||
void _start __P((void));
|
||||
void breakpoint __P((void));
|
||||
void chain_to __P((void *func));
|
||||
|
||||
/* clock.c */
|
||||
extern int hz;
|
||||
long getsecs __P((void));
|
||||
long getticks __P((void));
|
||||
|
||||
/* exec_sun.c */
|
||||
int exec_sun __P((char *file, char *loadaddr));
|
||||
int load_sun __P((int io, char *loadaddr, char **entry));
|
||||
|
||||
/* promboot.c */
|
||||
extern int debug;
|
||||
extern char prom_bootdev[];
|
||||
extern char *prom_bootfile;
|
||||
extern int prom_boothow;
|
||||
|
||||
/* sun3.c */
|
||||
void sun3_getidprom __P((u_char *ea));
|
||||
|
||||
/* vers.c */
|
||||
extern const char bootprog_rev[];
|
||||
extern const char bootprog_name[];
|
|
@ -1,17 +0,0 @@
|
|||
/* $NetBSD: netif.h,v 1.4 1998/01/05 07:03:26 perry Exp $ */
|
||||
|
||||
|
||||
#include "iodesc.h"
|
||||
|
||||
struct netif {
|
||||
void *nif_devdata;
|
||||
};
|
||||
|
||||
ssize_t netif_get __P((struct iodesc *, void *, size_t, time_t));
|
||||
ssize_t netif_put __P((struct iodesc *, void *, size_t));
|
||||
|
||||
int netif_open __P((void *));
|
||||
int netif_close __P((int));
|
||||
|
||||
struct iodesc *socktodesc __P((int));
|
||||
|
|
@ -1,474 +0,0 @@
|
|||
/* $NetBSD: netif_sun.c,v 1.13 1999/03/04 08:13:42 gwr Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Gordon W. Ross.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The Sun PROM has a fairly general set of network drivers,
|
||||
* so it is easiest to just replace the netif module with
|
||||
* this adaptation to the PROM network interface.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_ether.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
|
||||
#include <machine/idprom.h>
|
||||
#include <machine/mon.h>
|
||||
|
||||
#include <stand.h>
|
||||
#include <net.h>
|
||||
|
||||
#include "libsa.h"
|
||||
#include "dvma.h"
|
||||
#include "saio.h"
|
||||
#include "netif.h"
|
||||
|
||||
#define PKT_BUF_SIZE 2048
|
||||
|
||||
int errno;
|
||||
|
||||
struct iodesc sockets[SOPEN_MAX];
|
||||
|
||||
struct netif prom_netif;
|
||||
struct devdata {
|
||||
struct saioreq dd_si;
|
||||
int rbuf_len;
|
||||
char *rbuf;
|
||||
int tbuf_len;
|
||||
char *tbuf;
|
||||
u_short dd_opens;
|
||||
u_char dd_myea[6];
|
||||
} netif_devdata;
|
||||
|
||||
void netif_getether(struct saif *, u_char *);
|
||||
|
||||
|
||||
/*
|
||||
* Open the PROM device.
|
||||
* Return netif ptr on success.
|
||||
*/
|
||||
struct devdata *
|
||||
netif_init(aux)
|
||||
void *aux;
|
||||
{
|
||||
struct devdata *dd = &netif_devdata;
|
||||
struct saioreq *si;
|
||||
struct bootparam *bp;
|
||||
int error;
|
||||
|
||||
/*
|
||||
* Setup our part of the saioreq.
|
||||
* (determines what gets opened)
|
||||
*/
|
||||
si = &dd->dd_si;
|
||||
bzero((caddr_t)si, sizeof(*si));
|
||||
bp = *romVectorPtr->bootParam;
|
||||
si->si_boottab = bp->bootDevice;
|
||||
si->si_ctlr = bp->ctlrNum;
|
||||
si->si_unit = bp->unitNum;
|
||||
si->si_boff = bp->partNum;
|
||||
|
||||
#ifdef NETIF_DEBUG
|
||||
if (debug)
|
||||
printf("netif_init: calling prom_iopen\n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Note: Sun PROMs will do RARP on open, but does not tell
|
||||
* you the IP address it gets, so it is just noise to us...
|
||||
*/
|
||||
if ((error = prom_iopen(si)) != 0) {
|
||||
printf("netif_init: prom_iopen, error=%d\n", error);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (si->si_sif == NULL) {
|
||||
printf("netif_init: not a network device\n");
|
||||
prom_iclose(si);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Allocate the transmit/receive buffers. */
|
||||
if (dd->rbuf == NULL) {
|
||||
dd->rbuf_len = PKT_BUF_SIZE;
|
||||
dd->rbuf = dvma_alloc(dd->rbuf_len);
|
||||
}
|
||||
if (dd->tbuf == NULL) {
|
||||
dd->tbuf_len = PKT_BUF_SIZE;
|
||||
dd->tbuf = dvma_alloc(dd->tbuf_len);
|
||||
}
|
||||
if ((dd->rbuf == NULL) ||
|
||||
(dd->tbuf == NULL))
|
||||
panic("netif_init: malloc failed\n");
|
||||
|
||||
#ifdef NETIF_DEBUG
|
||||
if (debug)
|
||||
printf("netif_init: rbuf=0x%x, tbuf=0x%x\n",
|
||||
dd->rbuf, dd->tbuf);
|
||||
#endif
|
||||
|
||||
/* Record our ethernet address. */
|
||||
netif_getether(si->si_sif, dd->dd_myea);
|
||||
|
||||
dd->dd_opens = 0;
|
||||
|
||||
return(dd);
|
||||
}
|
||||
|
||||
void
|
||||
netif_fini(dd)
|
||||
struct devdata *dd;
|
||||
{
|
||||
struct saioreq *si;
|
||||
|
||||
si = &dd->dd_si;
|
||||
|
||||
#ifdef NETIF_DEBUG
|
||||
if (debug)
|
||||
printf("netif_fini: calling prom_iclose\n");
|
||||
#endif
|
||||
|
||||
prom_iclose(si);
|
||||
/* Dellocate the transmit/receive buffers. */
|
||||
if (dd->rbuf) {
|
||||
dvma_free(dd->rbuf, dd->rbuf_len);
|
||||
dd->rbuf = NULL;
|
||||
}
|
||||
if (dd->tbuf) {
|
||||
dvma_free(dd->tbuf, dd->tbuf_len);
|
||||
dd->tbuf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
netif_attach(nif, s, aux)
|
||||
struct netif *nif;
|
||||
struct iodesc *s;
|
||||
void *aux;
|
||||
{
|
||||
struct devdata *dd;
|
||||
|
||||
dd = nif->nif_devdata;
|
||||
if (dd == NULL) {
|
||||
dd = netif_init(aux);
|
||||
if (dd == NULL)
|
||||
return (ENXIO);
|
||||
nif->nif_devdata = dd;
|
||||
}
|
||||
dd->dd_opens++;
|
||||
MACPY(dd->dd_myea, s->myea);
|
||||
s->io_netif = nif;
|
||||
return(0);
|
||||
}
|
||||
|
||||
void
|
||||
netif_detach(nif)
|
||||
struct netif *nif;
|
||||
{
|
||||
struct devdata *dd;
|
||||
|
||||
dd = nif->nif_devdata;
|
||||
if (dd == NULL)
|
||||
return;
|
||||
dd->dd_opens--;
|
||||
if (dd->dd_opens > 0)
|
||||
return;
|
||||
netif_fini(dd);
|
||||
nif->nif_devdata = NULL;
|
||||
}
|
||||
|
||||
int
|
||||
netif_open(aux)
|
||||
void *aux;
|
||||
{
|
||||
struct netif *nif;
|
||||
struct iodesc *s;
|
||||
int fd, error;
|
||||
|
||||
/* find a free socket */
|
||||
for (fd = 0, s = sockets; fd < SOPEN_MAX; fd++, s++)
|
||||
if (s->io_netif == NULL)
|
||||
goto found;
|
||||
errno = EMFILE;
|
||||
return (-1);
|
||||
|
||||
found:
|
||||
bzero(s, sizeof(*s));
|
||||
nif = &prom_netif;
|
||||
error = netif_attach(nif, s);
|
||||
if (error != 0) {
|
||||
errno = error;
|
||||
return (-1);
|
||||
}
|
||||
return (fd);
|
||||
}
|
||||
|
||||
int
|
||||
netif_close(fd)
|
||||
int fd;
|
||||
{
|
||||
struct iodesc *s;
|
||||
struct netif *nif;
|
||||
|
||||
if (fd < 0 || fd >= SOPEN_MAX) {
|
||||
errno = EBADF;
|
||||
return(-1);
|
||||
}
|
||||
s = &sockets[fd];
|
||||
nif = s->io_netif;
|
||||
/* Already closed? */
|
||||
if (nif == NULL)
|
||||
return(0);
|
||||
netif_detach(nif);
|
||||
s->io_netif = NULL;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
struct iodesc *
|
||||
socktodesc(fd)
|
||||
int fd;
|
||||
{
|
||||
if (fd < 0 || fd >= SOPEN_MAX) {
|
||||
errno = EBADF;
|
||||
return (NULL);
|
||||
}
|
||||
return (&sockets[fd]);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Send a packet. The ether header is already there.
|
||||
* Return the length sent (or -1 on error).
|
||||
*/
|
||||
int
|
||||
netif_put(desc, pkt, len)
|
||||
struct iodesc *desc;
|
||||
void *pkt;
|
||||
size_t len;
|
||||
{
|
||||
struct netif *nif;
|
||||
struct devdata *dd;
|
||||
struct saioreq *si;
|
||||
struct saif *sif;
|
||||
char *dmabuf;
|
||||
int rv, slen;
|
||||
|
||||
#ifdef NETIF_DEBUG
|
||||
if (debug > 1) {
|
||||
struct ether_header *eh;
|
||||
|
||||
printf("netif_put: desc=0x%x pkt=0x%x len=%d\n",
|
||||
desc, pkt, len);
|
||||
eh = pkt;
|
||||
printf("dst: %s ", ether_sprintf(eh->ether_dhost));
|
||||
printf("src: %s ", ether_sprintf(eh->ether_shost));
|
||||
printf("type: 0x%x\n", eh->ether_type & 0xFFFF);
|
||||
}
|
||||
#endif
|
||||
|
||||
nif = desc->io_netif;
|
||||
dd = nif->nif_devdata;
|
||||
si = &dd->dd_si;
|
||||
sif = si->si_sif;
|
||||
slen = len;
|
||||
|
||||
#ifdef PARANOID
|
||||
if (sif == NULL)
|
||||
panic("netif_put: no saif ptr\n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copy into our transmit buffer because the PROM
|
||||
* network driver might continue using the packet
|
||||
* after the sif_xmit call returns. We never send
|
||||
* very much data anyway, so the copy is fine.
|
||||
*/
|
||||
if (slen > dd->tbuf_len)
|
||||
panic("netif_put: slen=%d\n", slen);
|
||||
bcopy(pkt, dd->tbuf, slen);
|
||||
|
||||
if (slen < 60) {
|
||||
slen = 60;
|
||||
}
|
||||
|
||||
rv = (*sif->sif_xmit)(si->si_devdata, dd->tbuf, slen);
|
||||
|
||||
#ifdef NETIF_DEBUG
|
||||
if (debug > 1)
|
||||
printf("netif_put: xmit returned %d\n", rv);
|
||||
#endif
|
||||
/*
|
||||
* Just ignore the return value. If the PROM transmit
|
||||
* function fails, it will make some noise, such as:
|
||||
* le: No Carrier
|
||||
*/
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
* Receive a packet, including the ether header.
|
||||
* Return the total length received (or -1 on error).
|
||||
*/
|
||||
int
|
||||
netif_get(desc, pkt, maxlen, timo)
|
||||
struct iodesc *desc;
|
||||
void *pkt;
|
||||
size_t maxlen;
|
||||
time_t timo; /* seconds */
|
||||
{
|
||||
struct netif *nif;
|
||||
struct devdata *dd;
|
||||
struct saioreq *si;
|
||||
struct saif *sif;
|
||||
int tick0, tmo_ticks;
|
||||
int rlen = 0;
|
||||
|
||||
#ifdef NETIF_DEBUG
|
||||
if (debug > 1)
|
||||
printf("netif_get: pkt=0x%x, maxlen=%d, tmo=%d\n",
|
||||
pkt, maxlen, timo);
|
||||
#endif
|
||||
|
||||
nif = desc->io_netif;
|
||||
dd = nif->nif_devdata;
|
||||
si = &dd->dd_si;
|
||||
sif = si->si_sif;
|
||||
|
||||
tmo_ticks = timo * hz;
|
||||
|
||||
/* Have to receive into our own buffer and copy. */
|
||||
do {
|
||||
tick0 = getticks();
|
||||
do {
|
||||
rlen = (*sif->sif_poll)(si->si_devdata, dd->rbuf);
|
||||
if (rlen != 0)
|
||||
goto break2;
|
||||
} while (getticks() == tick0);
|
||||
} while (--tmo_ticks > 0);
|
||||
|
||||
#if 0
|
||||
/* No packet arrived. Better reset the interface. */
|
||||
printf("netif_get: timeout; resetting\n");
|
||||
(*sif->sif_reset)(si->si_devdata, si);
|
||||
#endif
|
||||
|
||||
break2:
|
||||
|
||||
#ifdef NETIF_DEBUG
|
||||
if (debug > 1)
|
||||
printf("netif_get: received rlen=%d\n", rlen);
|
||||
#endif
|
||||
|
||||
/* Need at least a valid Ethernet header. */
|
||||
if (rlen < 12)
|
||||
return -1;
|
||||
|
||||
/* If we went beyond our buffer, were dead! */
|
||||
if (rlen > dd->rbuf_len)
|
||||
panic("netif_get: rlen=%d\n", rlen);
|
||||
|
||||
/* The caller's buffer may be smaller... */
|
||||
if (rlen > maxlen)
|
||||
rlen = maxlen;
|
||||
|
||||
bcopy(dd->rbuf, pkt, rlen);
|
||||
|
||||
#ifdef NETIF_DEBUG
|
||||
if (debug > 1) {
|
||||
struct ether_header *eh = pkt;
|
||||
|
||||
printf("dst: %s ", ether_sprintf(eh->ether_dhost));
|
||||
printf("src: %s ", ether_sprintf(eh->ether_shost));
|
||||
printf("type: 0x%x\n", eh->ether_type & 0xFFFF);
|
||||
}
|
||||
#endif
|
||||
|
||||
return rlen;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy our Ethernet address into the passed array.
|
||||
*/
|
||||
void
|
||||
netif_getether(sif, ea)
|
||||
struct saif *sif;
|
||||
u_char *ea;
|
||||
{
|
||||
char *rev;
|
||||
|
||||
if (_is3x == 0) {
|
||||
/*
|
||||
* Sun3: These usually have old PROMs
|
||||
* without the sif_macaddr function, but
|
||||
* reading the IDPROM on these machines is
|
||||
* very easy, so just always do that.
|
||||
*/
|
||||
idprom_etheraddr(ea);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sun3X: Want to use sif->sif_macaddr(), but
|
||||
* it's only in PROM revisions 3.0 and later,
|
||||
* so we have to check the PROM rev first.
|
||||
* Note that old PROMs prefix the rev string
|
||||
* with "Rev " (i.e. "Rev 2.6").
|
||||
*/
|
||||
rev = romVectorPtr->monId;
|
||||
if (!strncmp(rev, "Rev ", 4))
|
||||
rev += 4;
|
||||
if (!strncmp(rev, "3.", 2)) {
|
||||
/* Great! We can call the PROM. */
|
||||
(*sif->sif_macaddr)(ea);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sun3X with PROM rev < 3.0.
|
||||
* Finding the IDPROM is a pain, but
|
||||
* we have no choice. Warn the user.
|
||||
*/
|
||||
printf("netboot: Old PROM Rev (%s)\n", rev);
|
||||
idprom_etheraddr(ea);
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
/* $NetBSD: panic.c,v 1.6 2001/02/22 07:11:10 chs Exp $ */
|
||||
|
||||
|
||||
#include <machine/stdarg.h>
|
||||
#include <stand.h>
|
||||
#include "libsa.h"
|
||||
|
||||
__dead void
|
||||
panic(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vprintf(fmt, ap);
|
||||
printf("\n");
|
||||
va_end(ap);
|
||||
breakpoint();
|
||||
exit();
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
/* $NetBSD: promboot.c,v 1.6 1998/02/05 04:57:13 gwr Exp $ */
|
||||
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/reboot.h>
|
||||
|
||||
#include <machine/mon.h>
|
||||
|
||||
#include "stand.h"
|
||||
#include "libsa.h"
|
||||
|
||||
int debug = 0;
|
||||
int prom_boothow;
|
||||
char * prom_bootfile;
|
||||
char prom_bootdev[32];
|
||||
|
||||
/*
|
||||
* Get useful info from the PROM bootparams struct, i.e.:
|
||||
* arg[0] = sd(0,0,0)netbsd
|
||||
* arg[1] = -sa
|
||||
*/
|
||||
|
||||
void
|
||||
prom_get_boot_info()
|
||||
{
|
||||
struct bootparam *bp;
|
||||
char c, *src, *dst;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("prom_get_boot_info\n");
|
||||
#endif
|
||||
|
||||
bp = *romVectorPtr->bootParam;
|
||||
|
||||
/* Get device and file names. */
|
||||
src = bp->argPtr[0];
|
||||
dst = prom_bootdev;
|
||||
*dst++ = *src++;
|
||||
*dst++ = *src++;
|
||||
if (*src == '(') {
|
||||
while (*src) {
|
||||
c = *src++;
|
||||
*dst++ = c;
|
||||
if (c == ')')
|
||||
break;
|
||||
}
|
||||
*dst = '\0';
|
||||
}
|
||||
prom_bootfile = src;
|
||||
|
||||
/* Get boothowto flags. */
|
||||
src = bp->argPtr[1];
|
||||
if (src && (*src == '-')) {
|
||||
while (*src) {
|
||||
switch (*src++) {
|
||||
case 'a':
|
||||
prom_boothow |= RB_ASKNAME;
|
||||
break;
|
||||
case 's':
|
||||
prom_boothow |= RB_SINGLE;
|
||||
break;
|
||||
case 'd':
|
||||
prom_boothow |= RB_KDB;
|
||||
debug++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
printf("Debug level %d - enter c to continue...", debug);
|
||||
/* This will print "\nAbort at ...\n" */
|
||||
breakpoint();
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/* $NetBSD: promcons.c,v 1.5 1998/02/05 04:57:14 gwr Exp $ */
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/mon.h>
|
||||
|
||||
int
|
||||
getchar()
|
||||
{
|
||||
return ( (*romVectorPtr->getChar)() );
|
||||
}
|
||||
|
||||
int
|
||||
peekchar()
|
||||
{
|
||||
return ( (*romVectorPtr->mayGet)() );
|
||||
}
|
||||
|
||||
void
|
||||
putchar(c)
|
||||
int c;
|
||||
{
|
||||
if (c == '\n')
|
||||
(*romVectorPtr->putChar)('\r');
|
||||
(*romVectorPtr->putChar)(c);
|
||||
}
|
||||
|
|
@ -1,153 +0,0 @@
|
|||
/* $NetBSD: promdev.c,v 1.11 1998/02/05 04:57:15 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Gordon W. Ross
|
||||
* Copyright (c) 1993 Paul Kranenburg
|
||||
* 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 Paul Kranenburg.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without 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.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/mon.h>
|
||||
|
||||
#include <stand.h>
|
||||
|
||||
#include "libsa.h"
|
||||
#include "dvma.h"
|
||||
#include "saio.h"
|
||||
|
||||
int promdev_inuse;
|
||||
|
||||
/*
|
||||
* Note: caller sets the fields:
|
||||
* si->si_boottab
|
||||
* si->si_ctlr
|
||||
* si->si_unit
|
||||
* si->si_boff
|
||||
*/
|
||||
|
||||
int
|
||||
prom_iopen(si)
|
||||
struct saioreq *si;
|
||||
{
|
||||
struct boottab *ops;
|
||||
struct devinfo *dip;
|
||||
int i, ctlr, error;
|
||||
|
||||
if (promdev_inuse)
|
||||
return(EMFILE);
|
||||
|
||||
ops = si->si_boottab;
|
||||
dip = ops->b_devinfo;
|
||||
ctlr = si->si_ctlr;
|
||||
|
||||
#ifdef DEBUG_PROM
|
||||
if (debug) {
|
||||
printf("Boot device type: %s\n", ops->b_desc);
|
||||
printf("d_devbytes=%d\n", dip->d_devbytes);
|
||||
printf("d_dmabytes=%d\n", dip->d_dmabytes);
|
||||
printf("d_localbytes=%d\n", dip->d_localbytes);
|
||||
printf("d_devtype=%d\n", dip->d_devtype);
|
||||
printf("d_maxiobytes=%d\n", dip->d_maxiobytes);
|
||||
printf("d_stdcount=%d\n", dip->d_stdcount);
|
||||
for (i = 0; i < dip->d_stdcount; i++)
|
||||
printf("d_stdaddrs[i]=0x%x\n",
|
||||
i, dip->d_stdaddrs[0]);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dip->d_devbytes && dip->d_stdcount) {
|
||||
if (ctlr >= dip->d_stdcount) {
|
||||
printf("Invalid controller number\n");
|
||||
return(ENXIO);
|
||||
}
|
||||
si->si_devaddr = dev_mapin(dip->d_devtype,
|
||||
dip->d_stdaddrs[ctlr], dip->d_devbytes);
|
||||
#ifdef DEBUG_PROM
|
||||
if (debug)
|
||||
printf("prom_iopen: devaddr=0x%x\n", si->si_devaddr);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (dip->d_dmabytes) {
|
||||
si->si_dmaaddr = dvma_alloc(dip->d_dmabytes);
|
||||
#ifdef DEBUG_PROM
|
||||
if (debug)
|
||||
printf("prom_iopen: dmaaddr=0x%x\n", si->si_dmaaddr);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (dip->d_localbytes) {
|
||||
si->si_devdata = alloc(dip->d_localbytes);
|
||||
#ifdef DEBUG_PROM
|
||||
if (debug)
|
||||
printf("prom_iopen: devdata=0x%x\n", si->si_devdata);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* OK, call the PROM device open routine. */
|
||||
#ifdef DEBUG_PROM
|
||||
if (debug)
|
||||
printf("prom_iopen: calling prom open...\n");
|
||||
#endif
|
||||
error = (*ops->b_open)(si);
|
||||
if (error != 0) {
|
||||
printf("prom_iopen: \"%s\" error=%d\n",
|
||||
ops->b_desc, error);
|
||||
return (ENXIO);
|
||||
}
|
||||
#ifdef DEBUG_PROM
|
||||
if (debug)
|
||||
printf("prom_iopen: prom open returned %d\n", error);
|
||||
#endif
|
||||
|
||||
promdev_inuse++;
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
prom_iclose(si)
|
||||
struct saioreq *si;
|
||||
{
|
||||
struct boottab *ops;
|
||||
struct devinfo *dip;
|
||||
|
||||
if (promdev_inuse == 0)
|
||||
return;
|
||||
|
||||
ops = si->si_boottab;
|
||||
dip = ops->b_devinfo;
|
||||
|
||||
#ifdef DEBUG_PROM
|
||||
if (debug)
|
||||
printf("prom_iclose: calling prom close...\n");
|
||||
#endif
|
||||
(*ops->b_close)(si);
|
||||
|
||||
promdev_inuse = 0;
|
||||
}
|
||||
|
|
@ -1,168 +0,0 @@
|
|||
/* $NetBSD: saio.h,v 1.6 2001/02/22 07:11:11 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Gordon W. Ross.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file derived from kernel/mach/sun3.md/machMon.h from the
|
||||
* sprite distribution.
|
||||
*
|
||||
* In particular, this file came out of the Walnut Creek cdrom collection
|
||||
* which contained no warnings about any possible copyright infringement.
|
||||
*/
|
||||
|
||||
/*
|
||||
* machMon.h --
|
||||
*
|
||||
* Structures, constants and defines for access to the sun monitor.
|
||||
* These were translated from the sun monitor header files:
|
||||
* mon/sunromvec.h
|
||||
* stand/saio.h
|
||||
*
|
||||
* Copyright (C) 1985 Regents of the University of California
|
||||
* All rights reserved.
|
||||
*
|
||||
* Header: /sprite/src/boot/sunprom/sun3.md/RCS/machMon.h,v \
|
||||
* 1.1 90/09/17 10:57:28 rab Exp Locker: rab $ SPRITE (Berkeley)
|
||||
*/
|
||||
|
||||
/*
|
||||
* The table entry that describes a device. It exists in the PROM; a
|
||||
* pointer to it is passed in MachMonBootParam. It can be used to locate
|
||||
* PROM subroutines for opening, reading, and writing the device.
|
||||
*
|
||||
* When using this interface, only one device can be open at once.
|
||||
*/
|
||||
struct boottab {
|
||||
char b_dev[2]; /* The name of the device */
|
||||
int (*b_probe)(); /* 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 */
|
||||
char *b_desc; /* Printable string describing dev */
|
||||
struct devinfo *b_devinfo; /* Information to configure device */
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* This table gives information about the resources needed by a device.
|
||||
*/
|
||||
struct devinfo {
|
||||
unsigned int d_devbytes; /* Bytes occupied by device in IO space. */
|
||||
unsigned int d_dmabytes; /* Bytes needed by device in DMA memory. */
|
||||
unsigned int d_localbytes; /* Bytes needed by device for local info. */
|
||||
unsigned int d_stdcount; /* How many standard addresses. */
|
||||
unsigned long *d_stdaddrs; /* The vector of standard addresses. */
|
||||
unsigned int d_devtype; /* What map space device is in. */
|
||||
unsigned int d_maxiobytes; /* Size to break big I/O's into. */
|
||||
};
|
||||
|
||||
/*
|
||||
* These are the "page map entry types" specified in the
|
||||
* d_devtype field of struct devinfo.
|
||||
*/
|
||||
#define MAP_MAINMEM 0
|
||||
#define MAP_OBIO 1
|
||||
#define MAP_MBMEM 2
|
||||
#define MAP_MBIO 3
|
||||
#define MAP_VME16A16D 4
|
||||
#define MAP_VME16A32D 5
|
||||
#define MAP_VME24A16D 6
|
||||
#define MAP_VME24A32D 7
|
||||
#define MAP_VME32A16D 8
|
||||
#define MAP_VME32A32D 9
|
||||
#define MAP__NTYPES 10
|
||||
|
||||
/*
|
||||
* A "stand alone I/O request", (from SunOS saio.h)
|
||||
* This is passed as the main argument to the PROM I/O routines
|
||||
* in the MachMonBootDevice structure.
|
||||
*/
|
||||
struct saioreq {
|
||||
char si_flgs;
|
||||
char si_pad1;
|
||||
struct boottab *si_boottab; /* Points to boottab entry if any */
|
||||
char *si_devdata; /* Device-specific data pointer */
|
||||
int si_ctlr; /* Controller number or address */
|
||||
int si_unit; /* Unit number within controller */
|
||||
long si_boff; /* Partition number within unit */
|
||||
long si_cyloff;
|
||||
long si_offset;
|
||||
long si_bn; /* Block number to R/W */
|
||||
char *si_ma; /* Memory address to R/W */
|
||||
int si_cc; /* Character count to R/W */
|
||||
struct saif *si_sif; /* net if. pointer (set by b_open) */
|
||||
char *si_devaddr; /* Points to mapped in device */
|
||||
char *si_dmaaddr; /* Points to allocated DMA space */
|
||||
} __attribute__((packed));
|
||||
|
||||
#define SAIO_F_READ 0x01
|
||||
#define SAIO_F_WRITE 0x02
|
||||
#define SAIO_F_ALLOC 0x04
|
||||
#define SAIO_F_FILE 0x08
|
||||
#define SAIO_F_EOF 0x10 /* EOF on device */
|
||||
#define SAIO_F_AJAR 0x20 /* Descriptor "ajar" (stopped but not closed) */
|
||||
|
||||
/*
|
||||
* Ethernet interface descriptor (from SunOS saio.h)
|
||||
* First, set: saiop->si_devaddr, saiop->si_dmaaddr, etc.
|
||||
* Then: saiop->si_boottab->b_open() will set:
|
||||
* saiop->si_sif;
|
||||
* saiop->si_devdata;
|
||||
* The latter is the first arg to the following functions.
|
||||
* Note that the buffer must be in DVMA space...
|
||||
*/
|
||||
struct saif {
|
||||
/* Transmit packet, returns zero on success. */
|
||||
int (*sif_xmit)(void *devdata, char *buf, int len);
|
||||
/* Receive packet, return zero if none arrived. */
|
||||
int (*sif_poll)(void *devdata, char *buf);
|
||||
/* Reset interface, set addresses, etc. */
|
||||
int (*sif_reset)(void *devdata, struct saioreq *sip);
|
||||
/*
|
||||
* Later proms have more stuff here, but what versions?
|
||||
* It appears that all V3.X PROMs support this...
|
||||
*/
|
||||
/* Copy our ethernet address to the passed array. */
|
||||
int (*sif_macaddr)(char *ea);
|
||||
};
|
||||
|
||||
#ifdef _STANDALONE
|
||||
/* libsa:promdev.c */
|
||||
int prom_iopen (struct saioreq *sip);
|
||||
void prom_iclose(struct saioreq *sip);
|
||||
#endif /* _STANDALONE */
|
|
@ -1,297 +0,0 @@
|
|||
/* $NetBSD: sun3.c,v 1.4 2001/09/05 13:34:54 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Gordon W. Ross.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Standalone functions specific to the Sun3.
|
||||
*/
|
||||
|
||||
#define _SUN3_ XXX
|
||||
|
||||
/* Need to avoid conflicts on these: */
|
||||
#define get_pte sun3_get_pte
|
||||
#define set_pte sun3_set_pte
|
||||
#define get_segmap sun3_get_segmap
|
||||
#define set_segmap sun3_set_segmap
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <machine/idprom.h>
|
||||
#include <machine/mon.h>
|
||||
#include <machine/pte.h>
|
||||
|
||||
#include <arch/sun3/sun3/control.h>
|
||||
#include <arch/sun3/sun3/vme.h>
|
||||
|
||||
#include <stand.h>
|
||||
|
||||
#include "libsa.h"
|
||||
#include "dvma.h"
|
||||
#include "saio.h" /* enum MAPTYPES */
|
||||
|
||||
#define OBIO_MASK 0xFFFFFF
|
||||
|
||||
char * dvma3_alloc __P((int len));
|
||||
void dvma3_free __P((char *dvma, int len));
|
||||
char * dvma3_mapin __P((char *pkt, int len));
|
||||
void dvma3_mapout __P((char *dmabuf, int len));
|
||||
char * dev3_mapin __P((int type, u_long addr, int len));
|
||||
|
||||
struct mapinfo {
|
||||
int maptype;
|
||||
int pgtype;
|
||||
u_int base;
|
||||
u_int mask;
|
||||
};
|
||||
|
||||
struct mapinfo
|
||||
sun3_mapinfo[MAP__NTYPES] = {
|
||||
/* On-board memory, I/O */
|
||||
{ MAP_MAINMEM, PGT_OBMEM, 0, ~0 },
|
||||
{ MAP_OBIO, PGT_OBIO, 0, OBIO_MASK },
|
||||
/* Multibus adapter (A24,A16) */
|
||||
{ MAP_MBMEM, PGT_VME_D16, VME24_BASE, VME24_MASK },
|
||||
{ MAP_MBIO, PGT_VME_D16, VME16_BASE, VME16_MASK },
|
||||
/* VME A16 */
|
||||
{ MAP_VME16A16D, PGT_VME_D16, VME16_BASE, VME16_MASK },
|
||||
{ MAP_VME16A32D, PGT_VME_D32, VME16_BASE, VME16_MASK },
|
||||
/* VME A24 */
|
||||
{ MAP_VME24A16D, PGT_VME_D16, VME24_BASE, VME24_MASK },
|
||||
{ MAP_VME24A32D, PGT_VME_D32, VME24_BASE, VME24_MASK },
|
||||
/* VME A32 */
|
||||
{ MAP_VME32A16D, PGT_VME_D16, VME32_BASE, VME32_MASK },
|
||||
{ MAP_VME32A32D, PGT_VME_D32, VME32_BASE, VME32_MASK },
|
||||
};
|
||||
|
||||
/* The virtual address we will use for PROM device mappings. */
|
||||
int sun3_devmap = SUN3_MONSHORTSEG;
|
||||
|
||||
char *
|
||||
dev3_mapin(maptype, physaddr, length)
|
||||
int maptype;
|
||||
u_long physaddr;
|
||||
int length;
|
||||
{
|
||||
u_int i, pa, pte, pgva, va;
|
||||
|
||||
if ((sun3_devmap + length) > SUN3_MONSHORTPAGE)
|
||||
panic("dev3_mapin: length=%d\n", length);
|
||||
|
||||
for (i = 0; i < MAP__NTYPES; i++)
|
||||
if (sun3_mapinfo[i].maptype == maptype)
|
||||
goto found;
|
||||
panic("dev3_mapin: bad maptype");
|
||||
found:
|
||||
|
||||
if (physaddr & ~(sun3_mapinfo[i].mask))
|
||||
panic("dev3_mapin: bad address");
|
||||
pa = sun3_mapinfo[i].base += physaddr;
|
||||
|
||||
pte = PA_PGNUM(pa) | PG_PERM |
|
||||
sun3_mapinfo[i].pgtype;
|
||||
|
||||
va = pgva = sun3_devmap;
|
||||
do {
|
||||
set_pte(pgva, pte);
|
||||
pgva += NBPG;
|
||||
pte += 1;
|
||||
length -= NBPG;
|
||||
} while (length > 0);
|
||||
sun3_devmap = pgva;
|
||||
va += (physaddr & PGOFSET);
|
||||
|
||||
#ifdef DEBUG_PROM
|
||||
if (debug)
|
||||
printf("dev3_mapin: va=0x%x pte=0x%x\n",
|
||||
va, get_pte(va));
|
||||
#endif
|
||||
return ((char*)va);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* DVMA support
|
||||
*/
|
||||
|
||||
/*
|
||||
* The easiest way to deal with the need for DVMA mappings is to
|
||||
* create a DVMA alias mapping of the entire address range used by
|
||||
* the boot program. That way, dvma_mapin can just compute the
|
||||
* DVMA alias address, and dvma_mapout does nothing.
|
||||
*
|
||||
* Note that this assumes that standalone programs will do I/O
|
||||
* operations only within range (SA_MIN_VA .. SA_MAX_VA) checked.
|
||||
*/
|
||||
|
||||
#define DVMA_BASE 0xFFf00000
|
||||
#define DVMA_MAPLEN 0xE0000 /* 1 MB - 128K (save MONSHORTSEG) */
|
||||
|
||||
#define SA_MIN_VA 0x200000
|
||||
#define SA_MAX_VA (SA_MIN_VA + DVMA_MAPLEN)
|
||||
|
||||
/* This points to the end of the free DVMA space. */
|
||||
u_int dvma3_end = DVMA_BASE + DVMA_MAPLEN;
|
||||
|
||||
void
|
||||
dvma3_init()
|
||||
{
|
||||
int segva, dmava, sme;
|
||||
|
||||
segva = SA_MIN_VA;
|
||||
dmava = DVMA_BASE;
|
||||
|
||||
while (segva < SA_MAX_VA) {
|
||||
sme = get_segmap(segva);
|
||||
set_segmap(dmava, sme);
|
||||
segva += NBSG;
|
||||
dmava += NBSG;
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert a local address to a DVMA address. */
|
||||
char *
|
||||
dvma3_mapin(char *addr, int len)
|
||||
{
|
||||
int va = (int)addr;
|
||||
|
||||
/* Make sure the address is in the DVMA map. */
|
||||
if ((va < SA_MIN_VA) || (va >= SA_MAX_VA))
|
||||
panic("dvma3_mapin");
|
||||
|
||||
va -= SA_MIN_VA;
|
||||
va += DVMA_BASE;
|
||||
|
||||
return ((char *) va);
|
||||
}
|
||||
|
||||
/* Destroy a DVMA address alias. */
|
||||
void
|
||||
dvma3_mapout(char *addr, int len)
|
||||
{
|
||||
int va = (int)addr;
|
||||
|
||||
/* Make sure the address is in the DVMA map. */
|
||||
if ((va < DVMA_BASE) || (va >= (DVMA_BASE + DVMA_MAPLEN)))
|
||||
panic("dvma3_mapout");
|
||||
}
|
||||
|
||||
char *
|
||||
dvma3_alloc(int len)
|
||||
{
|
||||
len = m68k_round_page(len);
|
||||
dvma3_end -= len;
|
||||
return((char*)dvma3_end);
|
||||
}
|
||||
|
||||
void
|
||||
dvma3_free(char *dvma, int len)
|
||||
{
|
||||
/* not worth the trouble */
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* Control space stuff...
|
||||
*/
|
||||
|
||||
u_int
|
||||
get_pte(va)
|
||||
vaddr_t va;
|
||||
{
|
||||
va = CONTROL_ADDR_BUILD(PGMAP_BASE, va);
|
||||
return (get_control_word(va));
|
||||
}
|
||||
|
||||
void
|
||||
set_pte(va, pte)
|
||||
vaddr_t va;
|
||||
u_int pte;
|
||||
{
|
||||
va = CONTROL_ADDR_BUILD(PGMAP_BASE, va);
|
||||
set_control_word(va, pte);
|
||||
}
|
||||
|
||||
int
|
||||
get_segmap(va)
|
||||
vaddr_t va;
|
||||
{
|
||||
va = CONTROL_ADDR_BUILD(SEGMAP_BASE, va);
|
||||
return (get_control_byte(va));
|
||||
}
|
||||
|
||||
void
|
||||
set_segmap(va, sme)
|
||||
vaddr_t va;
|
||||
int sme;
|
||||
{
|
||||
va = CONTROL_ADDR_BUILD(SEGMAP_BASE, va);
|
||||
set_control_byte(va, sme);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the IDPROM contents into the passed buffer.
|
||||
* The caller (idprom.c) will do the checksum.
|
||||
*/
|
||||
void
|
||||
sun3_getidprom(u_char *dst)
|
||||
{
|
||||
vaddr_t src; /* control space address */
|
||||
int len, x;
|
||||
|
||||
src = IDPROM_BASE;
|
||||
len = sizeof(struct idprom);
|
||||
do {
|
||||
x = get_control_byte(src++);
|
||||
*dst++ = x;
|
||||
} while (--len > 0);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* Init our function pointers, etc.
|
||||
*/
|
||||
|
||||
void
|
||||
sun3_init()
|
||||
{
|
||||
|
||||
/* Set the function pointers. */
|
||||
dev_mapin_p = dev3_mapin;
|
||||
dvma_alloc_p = dvma3_alloc;
|
||||
dvma_free_p = dvma3_free;
|
||||
dvma_mapin_p = dvma3_mapin;
|
||||
dvma_mapout_p = dvma3_mapout;
|
||||
|
||||
/* Prepare DVMA segment. */
|
||||
dvma3_init();
|
||||
}
|
|
@ -1,330 +0,0 @@
|
|||
/* $NetBSD: sun3x.c,v 1.5 2001/09/11 07:30:51 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jeremy Cooper and Gordon Ross
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Standalone functions specific to the Sun3X.
|
||||
*/
|
||||
|
||||
#define _SUN3X_ XXX
|
||||
|
||||
/* Avoid conflicts on these: */
|
||||
#define get_pte sun3x_get_pte
|
||||
#define set_pte sun3x_set_pte
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <machine/mon.h>
|
||||
#include <machine/pte.h>
|
||||
|
||||
#include <stand.h>
|
||||
|
||||
#include "libsa.h"
|
||||
#include "dvma.h"
|
||||
#include "saio.h" /* enum MAPTYPES */
|
||||
|
||||
#include <arch/sun3/sun3x/iommu.h>
|
||||
#include <arch/sun3/sun3x/vme.h>
|
||||
|
||||
/* Names, names... */
|
||||
#define MON_LOMEM_BASE 0
|
||||
#define MON_LOMEM_SIZE 0x400000
|
||||
#define MON_LOMEM_END (MON_LOMEM_BASE+MON_LOMEM_SIZE)
|
||||
#define MON_KDB_BASE SUN3X_MON_KDB_BASE
|
||||
#define MON_KDB_SIZE SUN3X_MON_KDB_SIZE
|
||||
#define MON_KDB_END (MON_KDB_BASE+MON_KDB_SIZE)
|
||||
#define MON_DVMA_BASE SUN3X_MON_DVMA_BASE
|
||||
#define MON_DVMA_SIZE SUN3X_MON_DVMA_SIZE
|
||||
|
||||
void mmu_atc_flush (u_int va);
|
||||
void set_iommupte(u_int va, u_int pa);
|
||||
|
||||
char * dvma3x_alloc __P((int len));
|
||||
void dvma3x_free __P((char *dvma, int len));
|
||||
char * dvma3x_mapin __P((char *pkt, int len));
|
||||
void dvma3x_mapout __P((char *dmabuf, int len));
|
||||
char * dev3x_mapin __P((int type, u_long addr, int len));
|
||||
|
||||
struct mapinfo {
|
||||
int maptype;
|
||||
u_int base;
|
||||
u_int mask;
|
||||
};
|
||||
|
||||
struct mapinfo
|
||||
sun3x_mapinfo[MAP__NTYPES] = {
|
||||
/* On-board memory, I/O */
|
||||
{ MAP_MAINMEM, 0, ~0 },
|
||||
{ MAP_OBIO, 0, ~0 },
|
||||
/* Multibus adapter (A24,A16) */
|
||||
{ MAP_MBMEM, VME24D16_BASE, VME24_MASK },
|
||||
{ MAP_MBIO, VME16D16_BASE, VME16_MASK },
|
||||
/* VME A16 */
|
||||
{ MAP_VME16A16D, VME16D16_BASE, VME16_MASK },
|
||||
{ MAP_VME16A32D, VME16D32_BASE, VME16_MASK },
|
||||
/* VME A24 */
|
||||
{ MAP_VME24A16D, VME24D16_BASE, VME24_MASK },
|
||||
{ MAP_VME24A32D, VME24D32_BASE, VME24_MASK },
|
||||
/* VME A32 */
|
||||
{ MAP_VME32A16D, VME32D16_BASE, VME32_MASK },
|
||||
{ MAP_VME32A32D, VME32D32_BASE, VME32_MASK },
|
||||
};
|
||||
|
||||
/* The virtual address we will use for PROM device mappings. */
|
||||
u_int sun3x_devmap = MON_KDB_BASE;
|
||||
|
||||
char *
|
||||
dev3x_mapin(maptype, physaddr, length)
|
||||
int maptype;
|
||||
u_long physaddr;
|
||||
int length;
|
||||
{
|
||||
u_int i, pa, pte, pgva, va;
|
||||
|
||||
if ((sun3x_devmap + length) > (MON_KDB_BASE + MON_KDB_SIZE))
|
||||
panic("dev3x_mapin: length=%d\n", length);
|
||||
|
||||
for (i = 0; i < MAP__NTYPES; i++)
|
||||
if (sun3x_mapinfo[i].maptype == maptype)
|
||||
goto found;
|
||||
panic("dev3x_mapin: bad maptype");
|
||||
found:
|
||||
|
||||
if (physaddr & ~(sun3x_mapinfo[i].mask))
|
||||
panic("dev3x_mapin: bad address");
|
||||
pa = sun3x_mapinfo[i].base + physaddr;
|
||||
|
||||
pte = pa | MMU_DT_PAGE | MMU_SHORT_PTE_CI;
|
||||
|
||||
va = pgva = sun3x_devmap;
|
||||
do {
|
||||
set_pte(pgva, pte);
|
||||
pgva += NBPG;
|
||||
pte += NBPG;
|
||||
length -= NBPG;
|
||||
} while (length > 0);
|
||||
sun3x_devmap = pgva;
|
||||
va += (physaddr & PGOFSET);
|
||||
|
||||
#ifdef DEBUG_PROM
|
||||
if (debug)
|
||||
printf("dev3x_mapin: va=0x%x pte=0x%x\n",
|
||||
va, get_pte(va));
|
||||
#endif
|
||||
return ((char*)va);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* DVMA support
|
||||
*/
|
||||
|
||||
#define SA_MIN_VA 0x200000
|
||||
#define SA_MAX_VA (SA_MIN_VA + MON_DVMA_SIZE - (8 * NBPG))
|
||||
|
||||
#define MON_DVMA_MAPLEN (MON_DVMA_SIZE - NBPG)
|
||||
|
||||
/* This points to the end of the free DVMA space. */
|
||||
u_int dvma3x_end = MON_DVMA_BASE + MON_DVMA_MAPLEN;
|
||||
|
||||
void
|
||||
dvma3x_init()
|
||||
{
|
||||
u_int va, pa;
|
||||
|
||||
pa = SA_MIN_VA;
|
||||
va = MON_DVMA_BASE;
|
||||
|
||||
while (pa < SA_MAX_VA) {
|
||||
set_pte(va, pa | MMU_DT_PAGE | MMU_SHORT_PTE_CI);
|
||||
set_iommupte(va, pa | IOMMU_PDE_DT_VALID | IOMMU_PDE_CI);
|
||||
va += NBPG;
|
||||
pa += NBPG;
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert a local address to a DVMA address. */
|
||||
char *
|
||||
dvma3x_mapin(char *addr, int len)
|
||||
{
|
||||
int va = (int)addr;
|
||||
|
||||
/* Make sure the address is in the DVMA map. */
|
||||
if ((va < SA_MIN_VA) || (va >= SA_MAX_VA))
|
||||
panic("dvma3x_mapin");
|
||||
|
||||
va -= SA_MIN_VA;
|
||||
va += MON_DVMA_BASE;
|
||||
|
||||
return ((char *) va);
|
||||
}
|
||||
|
||||
/* Convert a DVMA address to a local address. */
|
||||
void
|
||||
dvma3x_mapout(char *addr, int len)
|
||||
{
|
||||
int va = (int)addr;
|
||||
|
||||
/* Make sure the address is in the DVMA map. */
|
||||
if ((va < MON_DVMA_BASE) ||
|
||||
(va >= (MON_DVMA_BASE + MON_DVMA_MAPLEN)))
|
||||
panic("dvma3x_mapout");
|
||||
}
|
||||
|
||||
char *
|
||||
dvma3x_alloc(int len)
|
||||
{
|
||||
len = m68k_round_page(len);
|
||||
dvma3x_end -= len;
|
||||
return((char*)dvma3x_end);
|
||||
}
|
||||
|
||||
void
|
||||
dvma3x_free(char *dvma, int len)
|
||||
{
|
||||
/* not worth the trouble */
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* MMU (and I/O MMU) support
|
||||
*/
|
||||
|
||||
u_int
|
||||
get_pte(va)
|
||||
vaddr_t va; /* virt. address */
|
||||
{
|
||||
u_int pn;
|
||||
mmu_short_pte_t *tbl;
|
||||
|
||||
if (va >= MON_LOMEM_BASE && va < MON_LOMEM_END) {
|
||||
tbl = (mmu_short_pte_t *) *romVectorPtr->lomemptaddr;
|
||||
} else if (va >= MON_KDB_BASE && va < MON_KDB_END) {
|
||||
va -= MON_KDB_BASE;
|
||||
tbl = (mmu_short_pte_t *) *romVectorPtr->monptaddr;
|
||||
} else if (va >= MON_DVMA_BASE) {
|
||||
va -= MON_DVMA_BASE;
|
||||
tbl = (mmu_short_pte_t *) *romVectorPtr->shadowpteaddr;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Calculate the page number within the selected table. */
|
||||
pn = (va >> MMU_PAGE_SHIFT);
|
||||
/* Extract the PTE from the table. */
|
||||
return tbl[pn].attr.raw;
|
||||
}
|
||||
|
||||
void
|
||||
set_pte(va, pa)
|
||||
vaddr_t va; /* virt. address */
|
||||
u_int pa; /* phys. address */
|
||||
{
|
||||
u_int pn;
|
||||
mmu_short_pte_t *tbl;
|
||||
|
||||
if (va >= MON_LOMEM_BASE && va < (MON_LOMEM_BASE + MON_LOMEM_SIZE)) {
|
||||
/*
|
||||
* Main memory range.
|
||||
*/
|
||||
tbl = (mmu_short_pte_t *) *romVectorPtr->lomemptaddr;
|
||||
} else if (va >= MON_KDB_BASE && va < (MON_KDB_BASE + MON_KDB_SIZE)) {
|
||||
/*
|
||||
* Kernel Debugger range.
|
||||
*/
|
||||
va -= MON_KDB_BASE;
|
||||
tbl = (mmu_short_pte_t *) *romVectorPtr->monptaddr;
|
||||
} else if (va >= MON_DVMA_BASE) {
|
||||
/*
|
||||
* DVMA range.
|
||||
*/
|
||||
va -= MON_DVMA_BASE;
|
||||
tbl = (mmu_short_pte_t *) *romVectorPtr->shadowpteaddr;
|
||||
} else {
|
||||
/* invalid range */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Calculate the page number within the selected table. */
|
||||
pn = (va >> MMU_PAGE_SHIFT);
|
||||
/* Enter the PTE into the table. */
|
||||
tbl[pn].attr.raw = pa;
|
||||
/* Flush the ATC of any cached entries for the va. */
|
||||
mmu_atc_flush(va);
|
||||
}
|
||||
|
||||
void
|
||||
mmu_atc_flush(va)
|
||||
u_int va;
|
||||
{
|
||||
|
||||
__asm __volatile ("pflush #0,#0,%0@" : : "a" (va));
|
||||
}
|
||||
|
||||
void
|
||||
set_iommupte(va, pa)
|
||||
u_int va; /* virt. address */
|
||||
u_int pa; /* phys. address */
|
||||
{
|
||||
iommu_pde_t *iommu_va;
|
||||
int pn;
|
||||
|
||||
iommu_va = (iommu_pde_t *) *romVectorPtr->dvmaptaddr;
|
||||
|
||||
/* Adjust the virtual address into an offset within the DVMA map. */
|
||||
va -= MON_DVMA_BASE;
|
||||
|
||||
/* Convert the slave address into a page index. */
|
||||
pn = IOMMU_BTOP(va);
|
||||
|
||||
iommu_va[pn].addr.raw = pa;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* Init our function pointers, etc.
|
||||
*/
|
||||
|
||||
void
|
||||
sun3x_init()
|
||||
{
|
||||
|
||||
/* Set the function pointers. */
|
||||
dev_mapin_p = dev3x_mapin;
|
||||
dvma_alloc_p = dvma3x_alloc;
|
||||
dvma_free_p = dvma3x_free;
|
||||
dvma_mapin_p = dvma3x_mapin;
|
||||
dvma_mapout_p = dvma3x_mapout;
|
||||
|
||||
dvma3x_init();
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
$NetBSD: version,v 1.4 2001/11/09 19:53:15 scw Exp $
|
||||
|
||||
NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this
|
||||
file is important - make sure the entries are appended on end, last item
|
||||
is taken as the current.
|
||||
|
||||
1.1: Initial commit.
|
||||
1.2: Changed dvdma.c and netif_sun.c in libsa.
|
||||
1.5: Merge arch/sun3x into arch/sun3.
|
||||
1.6: Both netboot and ufsboot now look for any of:
|
||||
{ "netbsd", "netbsd.old", "netbsd.$arch" } where arch=sun3 or
|
||||
arch=sun3x based on the running machine type. Boot media can
|
||||
support both sun3 and sun3x by providing two kernels.
|
||||
1.7: Common boot programs run on both Sun 3 and 3X
|
||||
machines, with different default kernel names
|
||||
on each so shared root images are possible.
|
||||
1.8: Changed to use MI sys/conf/newvers_stand.sh & vers.c.
|
||||
1.9: Convert to ELF and use MI loadfile().
|
||||
1.10: loadfile() update: ELF symbols no longer need backward seeks.
|
||||
1.11: loadfile() update to avoid backwards seeks for ELF Program Headers.
|
|
@ -1,152 +0,0 @@
|
|||
/* $NetBSD: xxboot.c,v 1.4 2001/03/26 11:54:50 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
|
||||
*
|
||||
* @(#)boot.c 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <machine/mon.h>
|
||||
|
||||
#include <stand.h>
|
||||
#include <loadfile.h>
|
||||
#include "libsa.h"
|
||||
|
||||
/*
|
||||
* Note that extname is edited based on the running machine type
|
||||
* (sun3 vs sun3x). EXTNAMEX is the position of the 'x'.
|
||||
*/
|
||||
char extname[] = "netbsd.sun3x";
|
||||
#define EXTNAMEX (sizeof(extname)-2)
|
||||
|
||||
/*
|
||||
* If the PROM did not give us a specific kernel name to use,
|
||||
* and did not specify the -a flag (ask), then try the names
|
||||
* in the following list.
|
||||
*/
|
||||
char *kernelnames[] = {
|
||||
"netbsd",
|
||||
"netbsd.old",
|
||||
extname,
|
||||
NULL
|
||||
};
|
||||
char line[80];
|
||||
|
||||
void
|
||||
xxboot_main(const char *boot_type)
|
||||
{
|
||||
struct open_file f;
|
||||
char **npp;
|
||||
char *file;
|
||||
void *entry;
|
||||
int fd;
|
||||
u_long marks[MARK_MAX];
|
||||
|
||||
memset(marks, 0, sizeof(marks));
|
||||
printf(">> %s %s [%s]\n", bootprog_name, boot_type, bootprog_rev);
|
||||
prom_get_boot_info();
|
||||
|
||||
/*
|
||||
* Hold the raw device open so it will not be
|
||||
* closed and reopened on every attempt to
|
||||
* load files that did not exist.
|
||||
*/
|
||||
f.f_flags = F_RAW;
|
||||
if (devopen(&f, 0, &file)) {
|
||||
printf("%s: devopen failed\n", boot_type);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Edit the "extended" kernel name based on
|
||||
* the type of machine we are running on.
|
||||
*/
|
||||
if (_is3x == 0)
|
||||
extname[EXTNAMEX] = 0;
|
||||
|
||||
/* If we got the "-a" flag, ask for the name. */
|
||||
if (prom_boothow & RB_ASKNAME)
|
||||
goto just_ask;
|
||||
|
||||
/*
|
||||
* If the PROM gave us a file name,
|
||||
* it means the user asked for that
|
||||
* kernel name explicitly.
|
||||
*/
|
||||
file = prom_bootfile;
|
||||
if (file && *file) {
|
||||
fd = loadfile(file, marks, LOAD_KERNEL);
|
||||
if (fd == -1) {
|
||||
goto err;
|
||||
} else {
|
||||
goto gotit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Try the default kernel names.
|
||||
*/
|
||||
for (npp = kernelnames; *npp; npp++) {
|
||||
file = *npp;
|
||||
printf("%s: trying %s\n", boot_type, file);
|
||||
fd = loadfile(file, marks, LOAD_KERNEL);
|
||||
if (fd != -1)
|
||||
goto gotit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Ask what kernel name to load.
|
||||
*/
|
||||
for (;;) {
|
||||
|
||||
just_ask:
|
||||
file = kernelnames[0];
|
||||
printf("filename? [%s]: ", file);
|
||||
gets(line);
|
||||
if (line[0])
|
||||
file = line;
|
||||
|
||||
fd = loadfile(file, marks, LOAD_KERNEL);
|
||||
if (fd != -1)
|
||||
break;
|
||||
|
||||
err:
|
||||
printf("%s: %s: loadfile() failed.\n", boot_type, file);
|
||||
}
|
||||
|
||||
gotit:
|
||||
entry = (void *)marks[MARK_ENTRY];
|
||||
printf("Starting program at 0x%x\n", entry);
|
||||
chain_to(entry);
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
# $NetBSD: Makefile,v 1.15 2001/12/12 01:49:53 tv Exp $
|
||||
|
||||
SA_PROG= netboot
|
||||
|
||||
# Regular local source
|
||||
SRCS= conf.c
|
||||
|
||||
# Build these locally
|
||||
SRCS+= dev_net.c bootparam.c globals.c nfs.c rpc.c udp.c
|
||||
|
||||
PROG= ${SA_PROG}
|
||||
NOMAN= # defined
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
.PATH: ${S}/lib/libsa
|
||||
DEFS+= -DSUN_BOOTPARAMS
|
|
@ -1,23 +0,0 @@
|
|||
/* $NetBSD: conf.c,v 1.4 2000/07/16 21:56:14 jdolecek Exp $ */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "stand.h"
|
||||
#include "nfs.h"
|
||||
#include "dev_net.h"
|
||||
|
||||
struct fs_ops file_system[] = {
|
||||
{ nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
|
||||
};
|
||||
int nfsys = 1;
|
||||
|
||||
struct devsw devsw[] = {
|
||||
{ "net", net_strategy, net_open, net_close, net_ioctl },
|
||||
};
|
||||
int ndevs = 1;
|
||||
|
||||
void
|
||||
main() {
|
||||
xxboot_main("netboot");
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
# $NetBSD: Makefile,v 1.8 2001/12/12 01:49:53 tv Exp $
|
||||
|
||||
SA_PROG= tapeboot
|
||||
SRCS= boot.c conf.c rawfs.c dev_tape.c
|
||||
|
||||
PROG= ${SA_PROG}
|
||||
NOMAN= # defined
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
/* $NetBSD: boot.c,v 1.6 2001/02/22 07:11:11 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
|
||||
*
|
||||
* @(#)boot.c 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <machine/mon.h>
|
||||
|
||||
#include <stand.h>
|
||||
#include <loadfile.h>
|
||||
#include "libsa.h"
|
||||
|
||||
/*
|
||||
* Default the name (really tape segment number).
|
||||
* The defaults assume the following tape layout:
|
||||
* segment 0: tapeboot
|
||||
* segment 1: netbsd.sun3 (RAMDISK3)
|
||||
* segment 2: netbsd.sun3x (RAMDISK3X)
|
||||
* segment 3: miniroot image
|
||||
* Therefore, the default name is "1" or "2"
|
||||
* for sun3 and sun3x respectively.
|
||||
*/
|
||||
|
||||
char defname[32] = "1";
|
||||
char line[80];
|
||||
|
||||
void
|
||||
main()
|
||||
{
|
||||
char *cp, *file;
|
||||
void *entry;
|
||||
u_long marks[MARK_MAX];
|
||||
int fd;
|
||||
|
||||
printf(">> %s tapeboot [%s]\n", bootprog_name, bootprog_rev);
|
||||
prom_get_boot_info();
|
||||
|
||||
/*
|
||||
* Can not hold open the tape device as is done
|
||||
* in the other boot programs because it does
|
||||
* its position-to-segment on open.
|
||||
*/
|
||||
|
||||
/* If running on a Sun3X, use segment 2. */
|
||||
if (_is3x)
|
||||
defname[0] = '2';
|
||||
file = defname;
|
||||
|
||||
cp = prom_bootfile;
|
||||
if (cp && *cp)
|
||||
file = cp;
|
||||
|
||||
for (;;) {
|
||||
if (prom_boothow & RB_ASKNAME) {
|
||||
printf("tapeboot: segment? [%s]: ", defname);
|
||||
gets(line);
|
||||
if (line[0])
|
||||
file = line;
|
||||
else
|
||||
file = defname;
|
||||
} else
|
||||
printf("tapeboot: loading segment %s\n", file);
|
||||
|
||||
marks[MARK_START] = KERN_LOADADDR;
|
||||
if ((fd = loadfile(file, marks, LOAD_KERNEL)) != -1) {
|
||||
break;
|
||||
}
|
||||
printf("tapeboot: segment %s: %s\n", file, strerror(errno));
|
||||
prom_boothow |= RB_ASKNAME;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
entry = (void *)marks[MARK_ENTRY];
|
||||
printf("Starting program at 0x%x\n", entry);
|
||||
chain_to(entry);
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/* $NetBSD: conf.c,v 1.2 1995/10/17 22:58:17 gwr Exp $ */
|
||||
|
||||
#include <stand.h>
|
||||
#include <rawfs.h>
|
||||
#include <dev_tape.h>
|
||||
|
||||
struct fs_ops file_system[] = {
|
||||
{
|
||||
rawfs_open, rawfs_close, rawfs_read,
|
||||
rawfs_write, rawfs_seek, rawfs_stat,
|
||||
},
|
||||
};
|
||||
int nfsys = 1;
|
||||
|
||||
struct devsw devsw[] = {
|
||||
{ "tape", tape_strategy, tape_open, tape_close, tape_ioctl },
|
||||
};
|
||||
int ndevs = 1;
|
||||
|
||||
int debug;
|
|
@ -1,205 +0,0 @@
|
|||
/* $NetBSD: dev_tape.c,v 1.8 2001/02/22 07:11:11 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Paul Kranenburg.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This module implements a "raw device" interface suitable for
|
||||
* use by the stand-alone I/O library UFS file-system code, and
|
||||
* possibly for direct access (i.e. boot from tape).
|
||||
*
|
||||
* The implementation is deceptively simple because it uses the
|
||||
* drivers provided by the Sun PROM monitor. Note that only the
|
||||
* PROM driver used to load the boot program is available here.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/mon.h>
|
||||
#include <machine/stdarg.h>
|
||||
#include <stand.h>
|
||||
|
||||
#include "libsa.h"
|
||||
#include "dvma.h"
|
||||
#include "saio.h"
|
||||
#include "dev_tape.h"
|
||||
|
||||
extern int debug;
|
||||
|
||||
struct saioreq tape_ioreq;
|
||||
|
||||
/*
|
||||
* This is a special version of devopen() for tape boot.
|
||||
* In this version, the file name is a numeric string of
|
||||
* one digit, which is passed to the device open so it
|
||||
* can open the appropriate tape segment.
|
||||
*/
|
||||
int
|
||||
devopen(f, fname, file)
|
||||
struct open_file *f;
|
||||
const char *fname; /* normally "1" */
|
||||
char **file;
|
||||
{
|
||||
struct devsw *dp;
|
||||
int error;
|
||||
|
||||
*file = (char*)fname;
|
||||
dp = &devsw[0];
|
||||
f->f_dev = dp;
|
||||
|
||||
/* The following will call tape_open() */
|
||||
return (dp->dv_open(f, fname));
|
||||
}
|
||||
|
||||
int
|
||||
tape_open(struct open_file *f, ...)
|
||||
{
|
||||
struct bootparam *bp;
|
||||
struct saioreq *si;
|
||||
int error, part;
|
||||
char *fname; /* partition number, i.e. "1" */
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, f);
|
||||
fname = va_arg(ap, char *);
|
||||
#ifdef DEBUG
|
||||
printf("tape_open: part=%s\n", fname);
|
||||
#endif
|
||||
va_end(ap);
|
||||
|
||||
/*
|
||||
* Set the tape segment number to the one indicated
|
||||
* by the single digit fname passed in above.
|
||||
*/
|
||||
if ((fname[0] < '0') && (fname[0] > '9')) {
|
||||
return ENOENT;
|
||||
}
|
||||
part = fname[0] - '0';
|
||||
|
||||
/*
|
||||
* Setup our part of the saioreq.
|
||||
* (determines what gets opened)
|
||||
*/
|
||||
si = &tape_ioreq;
|
||||
bzero((caddr_t)si, sizeof(*si));
|
||||
|
||||
bp = *romVectorPtr->bootParam;
|
||||
si->si_boottab = bp->bootDevice;
|
||||
si->si_ctlr = bp->ctlrNum;
|
||||
si->si_unit = bp->unitNum;
|
||||
si->si_boff = part; /* default = bp->partNum + 1; */
|
||||
|
||||
error = prom_iopen(si);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("tape_open: prom_iopen returned 0x%x\n", error);
|
||||
#endif
|
||||
|
||||
if (!error)
|
||||
f->f_devdata = si;
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
tape_close(f)
|
||||
struct open_file *f;
|
||||
{
|
||||
struct saioreq *si;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("tape_close: calling prom_iclose\n");
|
||||
#endif
|
||||
|
||||
si = f->f_devdata;
|
||||
prom_iclose(si);
|
||||
f->f_devdata = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
tape_strategy(devdata, flag, dblk, size, buf, rsize)
|
||||
void *devdata;
|
||||
int flag;
|
||||
daddr_t dblk;
|
||||
size_t size;
|
||||
void *buf;
|
||||
size_t *rsize;
|
||||
{
|
||||
struct saioreq *si;
|
||||
struct boottab *ops;
|
||||
char *dmabuf;
|
||||
int si_flag, xcnt;
|
||||
|
||||
si = devdata;
|
||||
ops = si->si_boottab;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug > 1)
|
||||
printf("tape_strategy: size=%d dblk=%d\n", size, dblk);
|
||||
#endif
|
||||
|
||||
dmabuf = dvma_mapin(buf, size);
|
||||
|
||||
si->si_bn = dblk;
|
||||
si->si_ma = dmabuf;
|
||||
si->si_cc = size;
|
||||
|
||||
si_flag = (flag == F_READ) ? SAIO_F_READ : SAIO_F_WRITE;
|
||||
xcnt = (*ops->b_strategy)(si, si_flag);
|
||||
dvma_mapout(dmabuf, size);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug > 1)
|
||||
printf("tape_strategy: xcnt = %x\n", xcnt);
|
||||
#endif
|
||||
|
||||
/* At end of tape, xcnt == 0 (not an error) */
|
||||
if (xcnt < 0)
|
||||
return (EIO);
|
||||
|
||||
*rsize = xcnt;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
tape_ioctl(f, cmd, data)
|
||||
struct open_file *f;
|
||||
u_long cmd;
|
||||
void *data;
|
||||
{
|
||||
return EIO;
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
/* $NetBSD: dev_tape.h,v 1.4 2001/02/22 07:11:11 chs Exp $ */
|
||||
|
||||
|
||||
int tape_open __P((struct open_file *, ...));
|
||||
int tape_close __P((struct open_file *));
|
||||
int tape_strategy __P((void *, int, daddr_t, size_t, void *, size_t *));
|
||||
int tape_ioctl __P((struct open_file *, u_long, void *));
|
||||
|
|
@ -1,207 +0,0 @@
|
|||
/* $NetBSD: rawfs.c,v 1.3 2001/02/22 07:11:11 chs Exp $ */
|
||||
|
||||
/*
|
||||
* 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 W. 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Raw file system - for stream devices like tapes.
|
||||
* No random access, only sequential read allowed.
|
||||
* This exists only to allow upper level code to be
|
||||
* shielded from the fact that the device must be
|
||||
* read only with whole block position and size.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <stand.h>
|
||||
|
||||
#include "rawfs.h"
|
||||
|
||||
extern int debug;
|
||||
|
||||
/* Our devices are generally willing to do 8K transfers. */
|
||||
#define RAWFS_BSIZE 0x2000
|
||||
|
||||
/*
|
||||
* In-core open file.
|
||||
*/
|
||||
struct file {
|
||||
daddr_t fs_nextblk; /* block number to read next */
|
||||
int fs_len; /* amount left in f_buf */
|
||||
char * fs_ptr; /* read pointer into f_buf */
|
||||
char fs_buf[RAWFS_BSIZE];
|
||||
};
|
||||
|
||||
static int rawfs_get_block __P((struct open_file *));
|
||||
|
||||
int
|
||||
rawfs_open(path, f)
|
||||
char *path;
|
||||
struct open_file *f;
|
||||
{
|
||||
struct file *fs;
|
||||
|
||||
/*
|
||||
* The actual PROM driver has already been opened.
|
||||
* Just allocate the I/O buffer, etc.
|
||||
*/
|
||||
fs = alloc(sizeof(struct file));
|
||||
fs->fs_nextblk = 0;
|
||||
fs->fs_len = 0;
|
||||
fs->fs_ptr = fs->fs_buf;
|
||||
|
||||
#ifdef DEBUG_RAWFS
|
||||
printf("rawfs_open: fs=0x%x\n", fs);
|
||||
#endif
|
||||
|
||||
f->f_fsdata = fs;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
rawfs_close(f)
|
||||
struct open_file *f;
|
||||
{
|
||||
struct file *fs;
|
||||
|
||||
fs = (struct file *) f->f_fsdata;
|
||||
f->f_fsdata = NULL;
|
||||
|
||||
#ifdef DEBUG_RAWFS
|
||||
if (debug) {
|
||||
printf("rawfs_close: breakpoint...", fs->fs_buf);
|
||||
__asm (" trap #0");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fs != NULL)
|
||||
free(fs, sizeof(*fs));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
rawfs_read(f, start, size, resid)
|
||||
struct open_file *f;
|
||||
void *start;
|
||||
u_int size;
|
||||
u_int *resid;
|
||||
{
|
||||
struct file *fs = (struct file *)f->f_fsdata;
|
||||
char *addr = start;
|
||||
int error = 0;
|
||||
size_t csize;
|
||||
|
||||
while (size != 0) {
|
||||
|
||||
if (fs->fs_len == 0)
|
||||
if ((error = rawfs_get_block(f)) != 0)
|
||||
break;
|
||||
|
||||
if (fs->fs_len <= 0)
|
||||
break; /* EOF */
|
||||
|
||||
csize = size;
|
||||
if (csize > fs->fs_len)
|
||||
csize = fs->fs_len;
|
||||
|
||||
bcopy(fs->fs_ptr, addr, csize);
|
||||
fs->fs_ptr += csize;
|
||||
fs->fs_len -= csize;
|
||||
addr += csize;
|
||||
size -= csize;
|
||||
}
|
||||
if (resid)
|
||||
*resid = size;
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
rawfs_write(f, start, size, resid)
|
||||
struct open_file *f;
|
||||
void *start;
|
||||
size_t size;
|
||||
size_t *resid; /* out */
|
||||
{
|
||||
#ifdef DEBUG_RAWFS
|
||||
panic("rawfs_write");
|
||||
#endif
|
||||
return (EROFS);
|
||||
}
|
||||
|
||||
off_t
|
||||
rawfs_seek(f, offset, where)
|
||||
struct open_file *f;
|
||||
off_t offset;
|
||||
int where;
|
||||
{
|
||||
#ifdef DEBUG_RAWFS
|
||||
panic("rawfs_seek");
|
||||
#endif
|
||||
return (EFTYPE);
|
||||
}
|
||||
|
||||
int
|
||||
rawfs_stat(f, sb)
|
||||
struct open_file *f;
|
||||
struct stat *sb;
|
||||
{
|
||||
#ifdef DEBUG_RAWFS
|
||||
panic("rawfs_stat");
|
||||
#endif
|
||||
return (EFTYPE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Read a block from the underlying stream device
|
||||
* (In our case, a tape drive.)
|
||||
*/
|
||||
static int
|
||||
rawfs_get_block(f)
|
||||
struct open_file *f;
|
||||
{
|
||||
struct file *fs;
|
||||
int error, len;
|
||||
|
||||
fs = (struct file *)f->f_fsdata;
|
||||
fs->fs_ptr = fs->fs_buf;
|
||||
|
||||
twiddle();
|
||||
error = f->f_dev->dv_strategy(f->f_devdata, F_READ,
|
||||
fs->fs_nextblk, RAWFS_BSIZE, fs->fs_buf, &len);
|
||||
|
||||
if (!error) {
|
||||
fs->fs_len = len;
|
||||
fs->fs_nextblk += (RAWFS_BSIZE / DEV_BSIZE);
|
||||
}
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
/* $NetBSD: rawfs.h,v 1.1 1995/10/17 22:58:29 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Raw file system - for stream devices like tapes.
|
||||
* No random access, only sequential read allowed.
|
||||
*/
|
||||
|
||||
int rawfs_open __P((char *path, struct open_file *f));
|
||||
int rawfs_close __P((struct open_file *f));
|
||||
int rawfs_read __P((struct open_file *f, void *buf,
|
||||
u_int size, u_int *resid));
|
||||
int rawfs_write __P((struct open_file *f, void *buf,
|
||||
u_int size, u_int *resid));
|
||||
off_t rawfs_seek __P((struct open_file *f, off_t offset, int where));
|
||||
int rawfs_stat __P((struct open_file *f, struct stat *sb));
|
|
@ -1,16 +0,0 @@
|
|||
# $NetBSD: Makefile,v 1.11 2001/12/12 01:49:53 tv Exp $
|
||||
|
||||
SA_PROG= ufsboot
|
||||
|
||||
# Regular local source
|
||||
SRCS= conf.c
|
||||
|
||||
# Build these locally
|
||||
SRCS+= ufs.c
|
||||
|
||||
PROG= ${SA_PROG}
|
||||
NOMAN= # defined
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
.PATH: ${S}/lib/libsa
|
||||
DEFS+= -DCOMPAT_UFS
|
|
@ -1,20 +0,0 @@
|
|||
/* $NetBSD: conf.c,v 1.2 2000/07/16 21:56:15 jdolecek Exp $ */
|
||||
|
||||
#include <stand.h>
|
||||
#include <ufs.h>
|
||||
#include <dev_disk.h>
|
||||
|
||||
struct fs_ops file_system[] = {
|
||||
{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
|
||||
};
|
||||
int nfsys = 1;
|
||||
|
||||
struct devsw devsw[] = {
|
||||
{ "disk", disk_strategy, disk_open, disk_close, disk_ioctl },
|
||||
};
|
||||
int ndevs = 1;
|
||||
|
||||
void
|
||||
main() {
|
||||
xxboot_main("ufsboot");
|
||||
}
|
Loading…
Reference in New Issue