diff options
author | Steve Murphree <smurph@cvs.openbsd.org> | 1998-08-22 07:02:08 +0000 |
---|---|---|
committer | Steve Murphree <smurph@cvs.openbsd.org> | 1998-08-22 07:02:08 +0000 |
commit | 480d88b604e88817b77c5652aa93f9d7ee4c3619 (patch) | |
tree | 946292a3ee23a2cbd0afd0f2997ac09d3acf9ab6 /sys/arch/mvme88k | |
parent | 14cb3043944970a403f3c8072993e0221950aa40 (diff) |
Part of remove to clean up stand.
Diffstat (limited to 'sys/arch/mvme88k')
79 files changed, 0 insertions, 7416 deletions
diff --git a/sys/arch/mvme88k/stand/openbsd/Makefile b/sys/arch/mvme88k/stand/openbsd/Makefile deleted file mode 100644 index 95be7960a00..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $Id: Makefile,v 1.1 1997/03/03 19:31:01 rahnds Exp $ - -SUBDIR= netboot sboot bootsd bootst libsa bugcrt libbug wrtvid - -.include <bsd.subdir.mk> diff --git a/sys/arch/mvme88k/stand/openbsd/Makefile.inc b/sys/arch/mvme88k/stand/openbsd/Makefile.inc deleted file mode 100644 index d9e7ff83b1b..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $Id: Makefile.inc,v 1.1 1997/03/03 19:31:01 rahnds Exp $ - -MDEC_DIR?=/usr/mdec diff --git a/sys/arch/mvme88k/stand/openbsd/bootsd/Makefile b/sys/arch/mvme88k/stand/openbsd/bootsd/Makefile deleted file mode 100644 index 24000991874..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/bootsd/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# from: @(#)Makefile 8.1 (Berkeley) 6/10/93 -# $Id: Makefile,v 1.1 1997/03/03 19:31:02 rahnds Exp $ - -RELOC=0x3F0000 - -S= ${.CURDIR}/../../../.. -DEFS= -DSTANDALONE -DCOMPAT_NOLABEL # -DROMPRF -INCPATH=-I${.CURDIR} -I${.CURDIR}/../../include -I${S} -I${S}/lib/libsa -CFLAGS= -O2 ${INCPATH} ${DEFS} ${COPTS} -CLEANFILES+=sdboot bootsd bootsd.bug - -#.PATH: ${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH} -#.PATH: ${S}/lib/libsa - -.include "${S}/arch/${MACHINE}/stand/libsa/Makefile.inc" -.include "${S}/arch/${MACHINE}/stand/libbug/Makefile.inc" -.include "${S}/arch/${MACHINE}/stand/bugcrt/Makefile.inc" -.include "${S}/arch/${MACHINE}/stand/wrtvid/Makefile.inc" - -SRCS= boot.c filesystem.c bugdev.c version.c - -LIBS= ${LIBSA} ${LIBBUG} - -OBJS= ${SRCS:N*.h:R:S/$/.o/g} - -BOOTS= bootsd sdboot -ALL= ${BOOTS} - -all: ${ALL} - -devopen.o machdep.o: Makefile - -bootsd.bug: ${OBJS} ${BUGCRT} ${LIBS} - ${LD} -N -T ${RELOC} ${BUGCRT} ${OBJS} ${LIBS} -o $@ - @size bootsd.bug - -bootsd sdboot: bootsd.bug ${WRTVID} - cp bootsd.bug bootsd.bin - strip bootsd.bin - @if [ `size bootsd.bin | awk 'BEGIN {getline} {print $$1+$$2;}'` -gt 7168 ];\ - then\ - echo BOOTBLOCKS ARE TOO BIG;\ - fail;\ - fi - ${WRTVID} bootsd.bin - -install: - install -c -m 555 -g bin -o bin ${BOOTS} ${DESTDIR}${MDEC_DIR} - -.include <bsd.prog.mk> diff --git a/sys/arch/mvme88k/stand/openbsd/bootsd/README b/sys/arch/mvme88k/stand/openbsd/bootsd/README deleted file mode 100644 index f3a503eb63e..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/bootsd/README +++ /dev/null @@ -1,3 +0,0 @@ -In short: stick the the bootblocks into a partition with -something like: - cat sdboot bootsd > /dev/rsd0c diff --git a/sys/arch/mvme88k/stand/openbsd/bootsd/boot.c b/sys/arch/mvme88k/stand/openbsd/bootsd/boot.c deleted file mode 100644 index f6534699929..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/bootsd/boot.c +++ /dev/null @@ -1,302 +0,0 @@ -/* $Id: boot.c,v 1.1 1997/03/03 19:31:02 rahnds Exp $ */ - -/*- - * Copyright (c) 1995 Theo de Raadt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Theo de Raadt for Willowglen Singapore. - * 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. - * - * 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. - * - * from: @(#)boot.c 8.1 (Berkeley) 6/10/93 - */ - -#include <sys/param.h> -#include <sys/types.h> -#include <sys/reboot.h> -#include <a.out.h> -#include <machine/prom.h> -#include "stand.h" - -void copyunix __P((int io, char *addr)); -void parse_args __P((void)); - -int debug; -int netif_debug; -#define RB_NOSYM 0x400 - -/* - * Boot device is derived from ROM provided information. - */ -extern char *version; -u_long esym; -char *strtab; -int strtablen; -#if 0 -struct nlist *nlp, *enlp; -#endif - -struct kernel { - void *entry; - void *symtab; - void *esym; - int bflags; - int bdev; - char *kname; - void *smini; - void *emini; - u_int end_loaded; -} kernel; - -extern struct mvmeprom_args bugargs; - -int -main() -{ - struct exec x; - char *file; - void *addr; - int io, i; - - printf(">> OpenBSD sdboot [%s]\n", version); - - parse_args(); - file = kernel.kname; - - io = open(file, 0); - if (io < 0) { - printf("Can't open %s: %s\n", file, strerror(errno)); - mvmeprom_return(); - } - i = read(io, (char *)&x, sizeof(x)); - if (i != sizeof(x) || N_BADMAG(x)) { - printf("Bad format\n"); - return (0); - } - /* Make load address start of page which containes "start" */ - addr = (void *)(x.a_entry & ~0x0FFF); - lseek(io, 0, SEEK_SET); - - printf("load %s to 0x%x\n", file, addr); - copyunix(io, addr); - return (0); -} - -/*ARGSUSED*/ -void -copyunix(io, addr) - int io; - char *addr; -{ - void (*entry)() = (void (*)())addr; - struct exec x; - int i, cnt; - - i = read(io, (char *)&x, sizeof(x)); - if (i != sizeof(x) || N_BADMAG(x)) { - printf("Bad format\n"); - return; - } - - printf("%x", x.a_text); - if (N_GETMAGIC(x) == ZMAGIC) { - kernel.entry = entry = (void *)x.a_entry; - lseek(io, 0, SEEK_SET); - } - if (read(io, (char *)addr, x.a_text) != x.a_text) - goto shread; - addr += x.a_text; - if (N_GETMAGIC(x) == NMAGIC) - while ((int)addr & CLOFSET) - *addr++ = 0; - printf("+%x", x.a_data); - if (read(io, addr, x.a_data) != x.a_data) - goto shread; - addr += x.a_data; - printf("+%x", x.a_bss); - for (i = 0; i < x.a_bss; i++) - *addr++ = 0; - if (x.a_syms != 0 && !(kernel.bflags & RB_NOSYM)) { - bcopy(&x.a_syms, addr, sizeof(x.a_syms)); - addr += sizeof(x.a_syms); -#if 0 - nlp = (struct nlist *)addr; -#endif - printf("+[%x+", x.a_syms); - if (read(io, addr, x.a_syms) != x.a_syms) - goto shread; - addr += x.a_syms; -#if 0 - enlp = (struct nlist *)(strtab = addr); -#endif - - if (read(io, &strtablen, sizeof(int)) != sizeof(int)) - goto shread; - - bcopy(&strtablen, addr, sizeof(int)); - if (i = strtablen) { - i -= sizeof(int); - addr += sizeof(int); - cnt = read(io, addr, i); - if (cnt != i) - printf("symwarn"); /* goto shread; */ - addr += i; - } - printf("%x]", i); - esym = KERNBASE + - (((int)addr + sizeof(int) - 1) & ~(sizeof(int) - 1)); - kernel.symtab = (void *) x.a_syms; - kernel.esym = addr; - } else { - kernel.symtab = 0; - kernel.esym = 0; - } - -#if 0 - while (nlp < enlp) { - register int strx = nlp->n_un.n_strx; - if (strx > strtablen) - continue; - if (strcmp(strtab+strx, "_esym") == 0) { - *(int*)(nlp->n_value - KERNBASE) = esym; - break; - } - nlp++; - } -#endif - - kernel.bdev = 0; - kernel.end_loaded = (u_int)addr; - kernel.smini = 0; - kernel.emini = 0; - kernel.kname = 0; - - printf("=%x\n", (u_int)addr - (u_int)entry); /* XXX wrong? */ - -#if 0 -printf("entry %x\n",kernel.entry); -printf("symtab %x\n",kernel.symtab); -printf("esym %x\n",kernel.esym); -printf("bflags %x\n",kernel.bflags); -printf("bdev %x\n",kernel.bdev); -printf("kname %x\n",kernel.kname); -printf("smini %x\n",kernel.smini); -printf("emini %x\n",kernel.emini); -printf("end_loaded %x\n",kernel.end_loaded); -#endif - - printf("start at 0x%x\n", (int)entry); - if (((u_long)entry &0xf) == 0x2) { - (entry)(&bugargs, &kernel); - } else { - /* is type fixing anything like price fixing? */ - typedef (* kernel_start) __P((int, int, void *,void *, void *)); - kernel_start addr; - addr = (void *)entry; - (addr)(kernel.bflags, 0, kernel.esym, kernel.smini, kernel.emini); - } - return; - -shread: - printf("short read\n"); -} - -struct flags { - char c; - short bit; -} bf[] = { - { 'a', RB_ASKNAME }, - { 'b', RB_HALT }, - { 'y', RB_NOSYM }, - { 'd', RB_KDB }, - { 'm', RB_MINIROOT }, - { 'r', RB_DFLTROOT }, - { 's', RB_SINGLE }, -}; - -void -parse_args() -{ - char *name = "/netbsd", *ptr; - int i, howto = 0; - char c; - - if (bugargs.arg_start != bugargs.arg_end) { - ptr = bugargs.arg_start; - while (c = *ptr) { - while (c == ' ') - c = *++ptr; - if (c == '\0') - return; - if (c != '-') { - name = ptr; - while ((c = *++ptr) && c != ' ') - ; - if (c) - *ptr++ = 0; - continue; - } - while ((c = *++ptr) && c != ' ') { - for (i = 0; i < sizeof(bf)/sizeof(bf[0]); i++) - if (bf[i].c == c) { - howto |= bf[i].bit; - } - } - } - } - kernel.bflags = howto; - kernel.kname = name; -} diff --git a/sys/arch/mvme88k/stand/openbsd/bootsd/bugdev.c b/sys/arch/mvme88k/stand/openbsd/bootsd/bugdev.c deleted file mode 100644 index ce0935f9512..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/bootsd/bugdev.c +++ /dev/null @@ -1,244 +0,0 @@ -/* $Id: bugdev.c,v 1.1 1997/03/03 19:31:02 rahnds Exp $ */ - -/* - * 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/param.h> -#include <sys/disklabel.h> -#include <machine/prom.h> -#include "stand.h" - -int bugscopen __P((struct open_file *, ...)); -int bugscclose __P((struct open_file *)); -int bugscioctl __P((struct open_file *, u_long, void *)); -int bugscstrategy __P((void *, int, daddr_t, size_t, void *, size_t *)); - -void cputobsdlabel __P((struct disklabel *lp, struct cpu_disklabel *clp)); - -struct devsw devsw[] = { - { "bugsc", bugscstrategy, bugscopen, bugscclose, bugscioctl }, -}; -int ndevs = (sizeof(devsw)/sizeof(devsw[0])); - -extern struct mvmeprom_args bugargs; -int errno; - -struct bugsc_softc { - int fd; /* Prom file descriptor */ - int poff; /* Partition offset */ - int psize; /* Partition size */ - short ctrl; - short dev; -} bugsc_softc[1]; - -int -devopen(f, fname, file) - struct open_file *f; - const char *fname; - char **file; -{ - register struct bugsc_softc *pp = &bugsc_softc[0]; - int error, i, dn = 0, pn = 0; - char *dev, *cp; - static char iobuf[MAXBSIZE]; - struct disklabel sdlabel; - - dev = bugargs.arg_start; - - /* - * Extract partition # from boot device string. - */ - for (cp = dev; *cp; cp++) /* void */; - while (*cp != '/' && cp > dev) { - if (*cp == ':') - pn = *(cp+1) - 'a'; - --cp; - } - - pp->fd = bugscopen(f); - - if (pp->fd < 0) { - printf("Can't open device `%s'\n", dev); - return (ENXIO); - } - error = bugscstrategy(pp, F_READ, LABELSECTOR, DEV_BSIZE, iobuf, &i); - if (error) - return (error); - if (i != DEV_BSIZE) - return (EINVAL); - - cputobsdlabel(&sdlabel, (struct cpu_disklabel *)iobuf); - pp->poff = sdlabel.d_partitions[pn].p_offset; - pp->psize = sdlabel.d_partitions[pn].p_size; - - f->f_dev = devsw; - f->f_devdata = (void *)pp; - *file = (char *)fname; - return (0); -} - -/* silly block scale factor */ -#define BUG_BLOCK_SIZE 256 -#define BUG_SCALE (512/BUG_BLOCK_SIZE) -int -bugscstrategy(devdata, func, dblk, size, buf, rsize) - void *devdata; - int func; - daddr_t dblk; - size_t size; - void *buf; - size_t *rsize; -{ - struct mvmeprom_dskio dio; - register struct bugsc_softc *pp = (struct bugsc_softc *)devdata; - daddr_t blk = dblk + pp->poff; - - twiddle(); - - dio.ctrl_lun = pp->ctrl; - dio.dev_lun = pp->dev; - dio.status = 0; - dio.pbuffer = buf; - dio.blk_num = blk * BUG_SCALE; - dio.blk_cnt = size / BUG_BLOCK_SIZE; /* assumed size in bytes */ - dio.flag = 0; - dio.addr_mod = 0; -#ifdef 0 - printf("bugscstrategy: size=%d blk=%d buf=%x\n", size, blk, buf); - printf("ctrl %d dev %d\n", dio.ctrl_lun, dio.dev_lun); -#endif - mvmeprom_diskrd(&dio); - - *rsize = dio.blk_cnt * BUG_BLOCK_SIZE; -#ifdef 0 -printf("rsize %d status %x\n", *rsize, dio.status); -#endif - - if (dio.status) - return (EIO); - return (0); -} - -int -bugscopen(f) - struct open_file *f; -{ -#ifdef DEBUG - printf("bugscopen:\n"); -#endif - - f->f_devdata = (void *)bugsc_softc; - bugsc_softc[0].ctrl = (short)bugargs.ctrl_lun; - bugsc_softc[0].dev = (short)bugargs.dev_lun; - printf("using mvmebug ctrl %d dev %d\n", - bugsc_softc[0].ctrl, bugsc_softc[0].dev); - return (0); -} - -int -bugscclose(f) - struct open_file *f; -{ - return (EIO); -} - -int -bugscioctl(f, cmd, data) - struct open_file *f; - u_long cmd; - void *data; -{ - return (EIO); -} - -void -cputobsdlabel(lp, clp) - struct disklabel *lp; - struct cpu_disklabel *clp; -{ - int i; - - lp->d_magic = clp->magic1; - lp->d_type = clp->type; - lp->d_subtype = clp->subtype; - bcopy(clp->vid_vd, lp->d_typename, 16); - bcopy(clp->packname, lp->d_packname, 16); - lp->d_secsize = clp->cfg_psm; - lp->d_nsectors = clp->cfg_spt; - lp->d_ncylinders = clp->cfg_trk; /* trk is really num of cyl! */ - lp->d_ntracks = clp->cfg_hds; - - lp->d_secpercyl = clp->secpercyl; - lp->d_secperunit = clp->secperunit; - lp->d_secpercyl = clp->secpercyl; - lp->d_secperunit = clp->secperunit; - lp->d_sparespertrack = clp->sparespertrack; - lp->d_sparespercyl = clp->sparespercyl; - lp->d_acylinders = clp->acylinders; - lp->d_rpm = clp->rpm; - lp->d_interleave = clp->cfg_ilv; - lp->d_trackskew = clp->cfg_sof; - lp->d_cylskew = clp->cylskew; - lp->d_headswitch = clp->headswitch; - - /* this silly table is for winchester drives */ - switch (clp->cfg_ssr) { - case 0: - lp->d_trkseek = 0; - break; - case 1: - lp->d_trkseek = 6; - break; - case 2: - lp->d_trkseek = 10; - break; - case 3: - lp->d_trkseek = 15; - break; - case 4: - lp->d_trkseek = 20; - break; - default: - lp->d_trkseek = 0; - break; - } - lp->d_flags = clp->flags; - for (i = 0; i < NDDATA; i++) - lp->d_drivedata[i] = clp->drivedata[i]; - for (i = 0; i < NSPARE; i++) - lp->d_spare[i] = clp->spare[i]; - lp->d_magic2 = clp->magic2; - lp->d_checksum = clp->checksum; - lp->d_npartitions = clp->partitions; - lp->d_bbsize = clp->bbsize; - lp->d_sbsize = clp->sbsize; - bcopy(clp->vid_4, &(lp->d_partitions[0]), sizeof (struct partition) * 4); - bcopy(clp->cfg_4, &(lp->d_partitions[4]), sizeof (struct partition) * 12); -} diff --git a/sys/arch/mvme88k/stand/openbsd/bootsd/filesystem.c b/sys/arch/mvme88k/stand/openbsd/bootsd/filesystem.c deleted file mode 100644 index 9761fda621e..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/bootsd/filesystem.c +++ /dev/null @@ -1,42 +0,0 @@ -/* $Id: filesystem.c,v 1.1 1997/03/03 19:31:02 rahnds Exp $ */ - -/* - * Copyright (c) 1993 Philip A. Nelson. - * 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 Philip A. Nelson. - * 4. The name of Philip A. Nelson may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY PHILIP NELSON ``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 PHILIP NELSON 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 <stand.h> -#include <ufs.h> - -struct fs_ops file_system[] = { - { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat }, -}; - -int nfsys = sizeof(file_system)/sizeof(struct fs_ops); - diff --git a/sys/arch/mvme88k/stand/openbsd/bootsd/version.c b/sys/arch/mvme88k/stand/openbsd/bootsd/version.c deleted file mode 100644 index 8d5d0c1fd0f..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/bootsd/version.c +++ /dev/null @@ -1,8 +0,0 @@ -/* $Id: version.c,v 1.1 1997/03/03 19:31:02 rahnds Exp $ */ - -/* - * make a random change to this file when you want the bootblock - * revision to increase. like change this x to a y, or something. - */ - -char *version = "$Revision: 1.1 $"; diff --git a/sys/arch/mvme88k/stand/openbsd/bootst/Makefile b/sys/arch/mvme88k/stand/openbsd/bootst/Makefile deleted file mode 100644 index 2730b06af9b..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/bootst/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -# from: @(#)Makefile 8.1 (Berkeley) 6/10/93 -# $Id: Makefile,v 1.1 1997/03/03 19:31:03 rahnds Exp $ - -RELOC=0x3F0000 - -S= ${.CURDIR}/../../../.. -DEFS= -DSTANDALONE -DCOMPAT_NOLABEL # -DROMPRF -INCPATH=-I${.CURDIR} -I${.CURDIR}/../../include -I${S} -I${S}/lib/libsa -CFLAGS= -O2 ${INCPATH} ${DEFS} ${COPTS} -CLEANFILES+=sdboot bootst bootst.bug - -#.PATH: ${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH} -#.PATH: ${S}/lib/libsa - -.include "${S}/arch/${MACHINE}/stand/libsa/Makefile.inc" -.include "${S}/arch/${MACHINE}/stand/libbug/Makefile.inc" -.include "${S}/arch/${MACHINE}/stand/bugcrt/Makefile.inc" -.include "${S}/arch/${MACHINE}/stand/wrtvid/Makefile.inc" - -SRCS= bootst.c - -LIBS= ${LIBSA} ${LIBBUG} - -OBJS= ${SRCS:N*.h:R:S/$/.o/g} - -BOOTS= bootst stboot -ALL= ${BOOTS} - -all: ${ALL} - -bootst.bug: ${OBJS} ${BUGCRT} ${LIBS} - ${LD} -s -N -T ${RELOC} ${BUGCRT} ${OBJS} ${LIBS} -o $@ - @size bootst.bug - -bootst stboot: bootst.bug ${WRTVID} - ${WRTVID} bootst.bug - -install: - install -c -m 555 -g bin -o bin ${BOOTS} ${DESTDIR}${MDEC_DIR} - -.include <bsd.prog.mk> diff --git a/sys/arch/mvme88k/stand/openbsd/bootst/bootst.c b/sys/arch/mvme88k/stand/openbsd/bootst/bootst.c deleted file mode 100644 index d0dd5586a57..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/bootst/bootst.c +++ /dev/null @@ -1,357 +0,0 @@ -#include <sys/types.h> -#include <sys/param.h> -#include <sys/reboot.h> -#include <sys/exec.h> -#include <machine/prom.h> - -#define RB_NOSYM 0x400 - -void parse_args __P((struct mvmeprom_args *pbugargs)); -int load_kern(); -int read_tape_block __P((short ctrl, short dev, short *status, - void *addr, int *cnt, int blk_num, u_char *flags, int verbose)); - -struct kernel { - void *entry; - void *symtab; - void *esym; - int bflags; - int bdev; - char *kname; - void *smini; - void *emini; - u_int end_loaded; -} kernel; - -typedef(*kernel_entry) __P((struct mvmeprom_args *, struct kernel *)); - -int -main(pbugargs) - struct mvmeprom_args *pbugargs; -{ - kernel_entry addr; - - /* - print_bugargs(pbugargs); - print_time(); - print_brdid(); - print_memory(); - */ - parse_args(pbugargs); - if (load_kern(pbugargs) == 1) { - printf("unsuccessful in loading kernel\n"); - } else { - addr = kernel.entry; - - printf("kernel loaded at %x\n", addr); - printf("kernel.entry %x\n", kernel.entry); - printf("kernel.symtab %x\n", kernel.symtab); - printf("kernel.esym %x\n", kernel.esym); - printf("kernel.bflags %x\n", kernel.bflags); - printf("kernel.bdev %x\n", kernel.bdev); - if (kernel.kname) - printf("kernel.kname <%s>\n", kernel.kname); - else - printf("kernel.kname <null>\n"); - printf("kernel.end_loaded %x\n", kernel.end_loaded); - - if (kernel.bflags & RB_MINIROOT) - loadmini(kernel.end_loaded, pbugargs); - - printf("kernel.smini %x\n", kernel.smini); - printf("kernel.emini %x\n", kernel.emini); - printf("kernel.end_loaded %x\n", kernel.end_loaded); - if (kernel.bflags & RB_HALT) - mvmeprom_return(); - if (((u_long)addr &0xf) == 0x2) { - (addr)(pbugargs, &kernel); - } else { - /* is type fixing anything like price fixing? */ - typedef (* kernel_start) __P((int, int, void *,void *, void *)); - kernel_start addr1; - addr1 = (void *)addr; - (addr1)(kernel.bflags, 0, kernel.esym, kernel.smini, kernel.emini - ); - } - - } - return (0); -} - -#define MVMEPROM_SCALE (512/MVMEPROM_BLOCK_SIZE) - -int -read_tape_block(ctrl, dev, status, addr, cnt, blk_num, flags, verbose) - short ctrl; - short dev; - short *status; - void *addr; - int *cnt; - int blk_num; - u_char *flags; - int verbose; -{ - struct mvmeprom_dskio dio; - int ret; - - dio.ctrl_lun = ctrl; - dio.dev_lun = dev; - dio.status = *status; - dio.pbuffer = addr; - dio.blk_num = blk_num; - dio.blk_cnt = *cnt / (512 / MVMEPROM_SCALE); - dio.flag = *flags; - dio.addr_mod = 0; - - if (verbose) - printf("saddr %x eaddr %x", dio.pbuffer, - (int) dio.pbuffer + (dio.blk_cnt * MVMEPROM_BLOCK_SIZE)); - ret = mvmeprom_diskrd(&dio); - - *status = dio.status; - *cnt = (dio.blk_cnt / MVMEPROM_SCALE) * 512; - if (verbose) { - printf("status %x ret %d ", *status, ret); - printf("flags %x blocks read %x cnt %x\n", - *flags, dio.blk_cnt, *cnt); - } - return (ret); -} -#ifdef DEBUG -int verbose = 1; -#else -int verbose = 0; -#endif - -int -load_kern(pbugargs) - struct mvmeprom_args *pbugargs; -{ - int ret; - char *addr; - u_char flags; - short status = 0; - int blk_num; - struct exec *pexec; - int magic; - int *esym; - int *symtab; - int cnt, len; - char buf[512]; - - blk_num = 2; - /* flags = IGNORE_FILENUM; */ - flags = 0; - cnt = 512; -printf("ctrl %x dev %x\n",pbugargs->ctrl_lun, pbugargs->dev_lun); - ret = read_tape_block(pbugargs->ctrl_lun, pbugargs->dev_lun, &status, - buf, &cnt, blk_num, &flags, verbose); - if (ret != 0) { - printf("unable to load kernel 1 status %x\n", status); - return (1); - } - pexec = (struct exec *) buf; - if (N_GETMID(*pexec) != MID_M68K && - N_GETMID(*pexec) != MID_M68K4K) { - printf("invalid mid on kernel\n"); - return (1); - } - - magic = N_GETMAGIC(*pexec); - switch (magic) { - case ZMAGIC: - break; - case NMAGIC: - printf("NMAGIC not yet supported"); - case OMAGIC: - case QMAGIC: - default: - printf("Unknown or unsupported magic type <%x>\n", magic); - return (1); - } - if (magic == ZMAGIC) { - status = 0; - addr = (char *) (pexec->a_entry & ~0x0FFF); - - if ((int) pexec->a_entry != (int) addr + 0x22) { - printf("warning kernel start address not %x, %x\n", - (int) addr + 0x22, pexec->a_entry); - printf("kernel loaded at %x\n", addr); - } - bcopy(&buf, addr, 512); - /* 2nd block of exe */ - addr += 512; - - printf("text 0x%x data 0x%x bss 0x%x\n", - pexec->a_text, pexec->a_data, pexec->a_bss); - - len = (pexec->a_text - 512); /* XXX */ - len += (pexec->a_data); - - printf("loading [ %x + %x ", pexec->a_text, pexec->a_data); - - cnt = len; - flags = IGNORE_FILENUM; - ret = read_tape_block(pbugargs->ctrl_lun, pbugargs->dev_lun, - &status, addr, &cnt, blk_num, &flags, verbose); - if (ret != 0 || cnt != len) { - printf("unable to load kernel 2 status %x\n", status); - return 1; - } - addr += len; - - /* Skip over text and data and zero bss. */ - len = pexec->a_bss; - printf("+ %x", len); -#ifdef DEBUG - printf("bss %x - %x\n", addr, addr + pexec->a_bss); -#endif - bzero(addr, pexec->a_bss); - addr += len; - - if (pexec->a_syms != 0 && !(kernel.bflags & RB_NOSYM)) { - printf(" + [ %x", pexec->a_syms); - addr += 4; /* skip over _end symbol */ - symtab = (void *) pexec->a_syms; - len = pexec->a_syms; - cnt = ((len + (512 - 1)) / 512) * 512; - flags = IGNORE_FILENUM; - ret = read_tape_block(pbugargs->ctrl_lun, - pbugargs->dev_lun, &status, addr, - &cnt, blk_num, &flags, verbose); - if (ret != 0 || cnt != ((len + (512 - 1)) / 512) * 512) { - printf("unable to load kernel 3\n"); - return 1; - } - /* this value should have already been loaded XXX */ - esym = (void *) ((u_int) addr + pexec->a_syms); - if ((int) addr + cnt <= (int) esym) { - printf("missed loading count of symbols\n"); - return 1; - } - addr += cnt; - - - len = *esym; -#if 0 - printf("start load %x end load %x %x\n", addr, - len, addr + len); - printf("esym %x *esym %x\n", esym, len); -#endif - /* dont load tail of already loaded */ - len -= (u_int) addr - (u_int) esym; - - if (len > 0) { - printf(" + %x", *esym); - esym = (void *) (addr + len); - cnt = ((len + (512 - 1)) / 512) * 512; - flags = IGNORE_FILENUM; - ret = read_tape_block(pbugargs->ctrl_lun, - pbugargs->dev_lun, &status, addr, - &cnt, blk_num, &flags, verbose); - if (ret != 0 || cnt != ((len + (512-1)) / 512)*512) { - printf("unable to load kernel 4\n"); - return (1); - } - addr += len; - printf(" ]"); - } else { - printf("+ %x ]", *esym); - } - esym = (int *) (((int) esym) + *esym); - - kernel.symtab = symtab; - kernel.esym = esym; - } else { - kernel.symtab = 0; - kernel.esym = 0; - } - kernel.end_loaded = (int) addr; - flags = IGNORE_FILENUM | END_OF_FILE; - cnt = 8192; - printf("removing pad ["); - ret = read_tape_block(pbugargs->ctrl_lun, pbugargs->dev_lun, - &status, addr, &cnt, blk_num, &flags, verbose); - if (ret != 0) { - printf("unable to load kernel 5\n"); - return (1); - } - printf(" %d ]", cnt); - - printf("]\n"); - } - kernel.entry = (void *) pexec->a_entry; - return (0); -} - -int -loadmini(addr, pbugargs) - u_int addr; - struct mvmeprom_args *pbugargs; -{ - int cnt, ret, blk_num = 3; - short status = 0; - u_char flags; - - /* align addr to some boundary */ -#define ALIGN_F 0x4 - addr = (u_int) ((((int) addr + ALIGN_F - 1) / ALIGN_F) * ALIGN_F); -#undef ALIGN_F - flags = END_OF_FILE; - cnt = 6144 * 512; /* some abserdly large value. (3meg) */ - printf("loading miniroot[ "); - ret = read_tape_block(pbugargs->ctrl_lun, pbugargs->dev_lun, - &status, (void *) addr, &cnt, blk_num, &flags, verbose); - if (ret != 0) { - printf("unable to load miniroot\n"); - return (1); - } - kernel.smini = (void *)addr; - printf("%d ]\n", cnt); - kernel.emini = (void *) ((u_int) addr + cnt); - kernel.end_loaded = (u_int) kernel.emini; - return (0); -} - -void -parse_args(pargs) - struct mvmeprom_args *pargs; -{ - char *ptr = pargs->arg_start; - char c, *name = NULL; - int howto = 0; - - if (pargs->arg_start != pargs->arg_end) { - while (c = *ptr) { - while (c == ' ') - c = *++ptr; - if (!c) - return; - if (c != '-') { - name = ptr; - while ((c = *++ptr) && c != ' '); - if (c) - *ptr++ = 0; - continue; - } - while ((c = *++ptr) && c != ' ') { - if (c == 'a') - howto |= RB_ASKNAME; - else if (c == 'b') - howto |= RB_HALT; - else if (c == 'y') - howto |= RB_NOSYM; - else if (c == 'd') - howto |= RB_KDB; - else if (c == 'm') - howto |= RB_MINIROOT; - else if (c == 'r') - howto |= RB_DFLTROOT; - else if (c == 's') - howto |= RB_SINGLE; - } - } - } - kernel.bflags = howto; - kernel.kname = name; -} diff --git a/sys/arch/mvme88k/stand/openbsd/bugcrt/Makefile b/sys/arch/mvme88k/stand/openbsd/bugcrt/Makefile deleted file mode 100644 index 04c7936ff58..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/bugcrt/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# $Id: Makefile,v 1.1 1997/03/03 19:31:03 rahnds Exp $ - -CFLAGS+=-I${.CURDIR}/../../include -O2 - -.include "${MACHINE_ARCH}/Makefile.inc" - -.PATH: ${.CURDIR}/${MACHINE_ARCH} - -OBJS=bugcrt.o - -CLEANFILES+=a.out - -all: ${OBJS} - -bugcrt.o: bugcrt.c - ${CC} ${CFLAGS} -c ${.ALLSRC} - ${LD} -x -r ${.TARGET} - mv a.out ${.TARGET} - -install: - -lint tags: - -.include <bsd.prog.mk> diff --git a/sys/arch/mvme88k/stand/openbsd/bugcrt/Makefile.inc b/sys/arch/mvme88k/stand/openbsd/bugcrt/Makefile.inc deleted file mode 100644 index f2bae6c888c..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/bugcrt/Makefile.inc +++ /dev/null @@ -1,12 +0,0 @@ -BUG_CRT_DIR=${S}/arch/${MACHINE}/stand/bugcrt - -BUGCRT_DIR!= cd ${BUG_CRT_DIR}; \ - printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx - -BUGCRT=${BUGCRT_DIR}/bugcrt.o - -$(BUGCRT): .NOTMAIN __always_make_bugcrt - @echo making sure the bugcrt is up to date... - @(cd ${BUG_CRT_DIR}; ${MAKE}) - -__always_make_bugcrt: .NOTMAIN diff --git a/sys/arch/mvme88k/stand/openbsd/bugcrt/m88k/Makefile.inc b/sys/arch/mvme88k/stand/openbsd/bugcrt/m88k/Makefile.inc deleted file mode 100644 index e69de29bb2d..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/bugcrt/m88k/Makefile.inc +++ /dev/null diff --git a/sys/arch/mvme88k/stand/openbsd/bugcrt/m88k/bugcrt.c b/sys/arch/mvme88k/stand/openbsd/bugcrt/m88k/bugcrt.c deleted file mode 100644 index 711b4fe2035..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/bugcrt/m88k/bugcrt.c +++ /dev/null @@ -1,39 +0,0 @@ -#include <sys/types.h> -#include <machine/prom.h> - -struct mvmeprom_args bugargs = { 1 }; /* not BSS */ - - asm (".text"); - asm (".long 0x003ffff8"); - asm (".long _start"); -start() -{ - register int dev_lun asm ("r2"); - register int ctrl_lun asm ("r3"); - register int flags asm ("r4"); - register int ctrl_addr asm ("r5"); - register int entry asm ("r6"); - register int conf_blk asm ("r7"); - register char *arg_start asm ("r8"); - register char *arg_end asm ("r9"); - extern int edata, end; - - bugargs.dev_lun = dev_lun; - bugargs.ctrl_lun = ctrl_lun; - bugargs.flags = flags; - bugargs.ctrl_addr = ctrl_addr; - bugargs.entry = entry; - bugargs.conf_blk = conf_blk; - bugargs.arg_start = arg_start; - bugargs.arg_end = arg_end; - *arg_end = 0; - - bzero(&edata, (int)&edata - (int)&end); - main(); - mvmeprom_return(); - /* NOTREACHED */ -} - -__main() -{ -} diff --git a/sys/arch/mvme88k/stand/openbsd/libbug/Makefile b/sys/arch/mvme88k/stand/openbsd/libbug/Makefile deleted file mode 100644 index ba775e5693d..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libbug/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -LIB=bug - -NOPIC= -NOPROFILE= - -CFLAGS+=-I${.CURDIR}/../../include - -SRCS=delay.c diskrd.c diskwr.c getbrdid.c instat.c outln.c outstr.c \ - return.c rtc_rd.c -.PATH: ${.CURDIR}/../../../../lib/libc_sa ${.CURDIR}/${MACHINE_ARCH} - -install: - -.include <bsd.lib.mk> diff --git a/sys/arch/mvme88k/stand/openbsd/libbug/Makefile.inc b/sys/arch/mvme88k/stand/openbsd/libbug/Makefile.inc deleted file mode 100644 index dc1ad6b04c8..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libbug/Makefile.inc +++ /dev/null @@ -1,12 +0,0 @@ -LIB_BUG_DIR=${S}/arch/${MACHINE}/stand/libbug - -LIBBUG_DIR!= cd ${LIB_BUG_DIR}; \ - printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx - -LIBBUG=${LIBBUG_DIR}/libbug.a - -$(LIBBUG): .NOTMAIN __always_make_libbug - @echo making sure the libbug is up to date... - @(cd ${LIB_BUG_DIR}; ${MAKE}) - -__always_make_libbug: .NOTMAIN diff --git a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/delay.c b/sys/arch/mvme88k/stand/openbsd/libbug/m88k/delay.c deleted file mode 100644 index 68b1db12106..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/delay.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * bug routines -- assumes that the necessary sections of memory - * are preserved. - */ -#include <sys/types.h> -#include <machine/prom.h> - -/* BUG - timing routine */ -void -mvmeprom_delay(msec) - int msec; -{ - asm volatile ("or r2,r0,%0": : "r" (msec)); - MVMEPROM_CALL(MVMEPROM_DELAY); -} diff --git a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/diskrd.c b/sys/arch/mvme88k/stand/openbsd/libbug/m88k/diskrd.c deleted file mode 100644 index bc69b365501..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/diskrd.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * bug routines -- assumes that the necessary sections of memory - * are preserved. - */ -#include <sys/types.h> -#include <machine/prom.h> - -/* returns 0: success, nonzero: error */ -int -mvmeprom_diskrd(arg) - struct mvmeprom_dskio *arg; -{ - int ret; - - asm volatile ("or r2,r0,%0": : "r" (arg)); - MVMEPROM_CALL(MVMEPROM_DSKRD); - asm volatile ("or %0,r0,r2" : "=r" (ret)); - return (!(ret & 0x4)); -} diff --git a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/diskwr.c b/sys/arch/mvme88k/stand/openbsd/libbug/m88k/diskwr.c deleted file mode 100644 index 681f521b5b0..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/diskwr.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * bug routines -- assumes that the necessary sections of memory - * are preserved. - */ -#include <sys/types.h> -#include <machine/prom.h> - -/* returns 0: success, nonzero: error */ -int -mvmeprom_diskwr(arg) - struct mvmeprom_dskio *arg; -{ - int ret; - - asm volatile ("or r2,r0,%0": : "r" (arg) ); - MVMEPROM_CALL(MVMEPROM_DSKWR); - asm volatile ("or %0,r0,r2" : "=r" (ret)); - return (!(ret & 0x4)); -} diff --git a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/getbrdid.c b/sys/arch/mvme88k/stand/openbsd/libbug/m88k/getbrdid.c deleted file mode 100644 index eeda9468ab7..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/getbrdid.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * bug routines -- assumes that the necessary sections of memory - * are preserved. - */ -#include <sys/types.h> -#include <machine/prom.h> - -/* BUG - query board routines */ -struct mvmeprom_brdid * -mvmeprom_brdid() -{ - struct mvmeprom_brdid *id; - - MVMEPROM_CALL(MVMEPROM_GETBRDID); - asm volatile ("or %0,r0,r2": "=r" (id):); - return (id); -} diff --git a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/instat.c b/sys/arch/mvme88k/stand/openbsd/libbug/m88k/instat.c deleted file mode 100644 index 0ac97fe7676..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/instat.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * bug routines -- assumes that the necessary sections of memory - * are preserved. - */ -#include <sys/types.h> -#include <machine/prom.h> - -/* returns 0 if no characters ready to read */ -int -mvmeprom_instat() -{ - short ret; - - MVMEPROM_CALL(MVMEPROM_INSTAT); - asm volatile ("or %0,r0,r2" : "=r" (ret)); - return (!(ret & 0x4)); -} diff --git a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/outch.c b/sys/arch/mvme88k/stand/openbsd/libbug/m88k/outch.c deleted file mode 100644 index 78110e0299f..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/outch.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * bug routines -- assumes that the necessary sections of memory - * are preserved. - */ -#include <sys/types.h> -#include <machine/prom.h> - -void -mvmeprom_outchr(a) - char a; -{ - asm volatile ("or r2, r0, %0" : :"r" (a)); - BUG_CALL(_OUTCHR); -} - diff --git a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/outln.c b/sys/arch/mvme88k/stand/openbsd/libbug/m88k/outln.c deleted file mode 100644 index ed0067e42d9..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/outln.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * bug routines -- assumes that the necessary sections of memory - * are preserved. - */ -#include <sys/types.h> -#include <machine/prom.h> - -void -mvmeprom_outln(start, end) - char *start, *end; -{ - asm volatile ("or r2,r0,%0": : "r" (start)); - asm volatile ("or r3,r0,%0": : "r" (end)); - MVMEPROM_CALL(MVMEPROM_OUTSTRCRLF); -} diff --git a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/outstr.c b/sys/arch/mvme88k/stand/openbsd/libbug/m88k/outstr.c deleted file mode 100644 index c9e3c355736..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/outstr.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * bug routines -- assumes that the necessary sections of memory - * are preserved. - */ -#include <sys/types.h> -#include <machine/prom.h> - -void -mvmeprom_outstr(start, end) - char *start, *end; -{ - asm volatile ("or r2,r0,%0": : "r" (start)); - asm volatile ("or r3,r0,%0": : "r" (end)); - MVMEPROM_CALL(MVMEPROM_OUTSTR); -} diff --git a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/prom.h b/sys/arch/mvme88k/stand/openbsd/libbug/m88k/prom.h deleted file mode 100644 index 4048e86eaff..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/prom.h +++ /dev/null @@ -1,3 +0,0 @@ -#define MVMEPROM_CALL(x) \ - asm volatile ( __CONCAT("or r9,r0," __STRING(x)) ); \ - asm volatile ("tb0 0,r0,496"); diff --git a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/return.c b/sys/arch/mvme88k/stand/openbsd/libbug/m88k/return.c deleted file mode 100644 index 00206a16c48..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/return.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * bug routines -- assumes that the necessary sections of memory - * are preserved. - */ -#include <sys/types.h> -#include <machine/prom.h> - -/* BUG - return to bug routine */ -void -mvmeprom_return() -{ - MVMEPROM_CALL(MVMEPROM_EXIT); - /*NOTREACHED*/ -} diff --git a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/rtc_rd.c b/sys/arch/mvme88k/stand/openbsd/libbug/m88k/rtc_rd.c deleted file mode 100644 index 7cff3227678..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libbug/m88k/rtc_rd.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * bug routines -- assumes that the necessary sections of memory - * are preserved. - */ -#include <sys/types.h> -#include <machine/prom.h> - -void -mvmeprom_rtc_rd(ptime) - struct mvmeprom_time *ptime) -{ - asm volatile ("or r2,r0,%0": : "r" (ptime)); - MVMEPROM_CALL(MVMEPROM_RTC_RD); -} diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/Makefile b/sys/arch/mvme88k/stand/openbsd/libsa/Makefile deleted file mode 100644 index 45a1240ed7b..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# $Id: Makefile,v 1.1 1997/03/03 19:31:06 rahnds Exp $ - -LIB=sa - -CLEANFILES+=SRT0.o SRT1.o - -NOPIC=nopic -NOPROFILE=noprofile - -# Logically src/sys -S=${.CURDIR}/../../../.. -DIR_SA=$S/lib/libsa -DIR_KERN=$S/lib/libkern - -SRC_net= nfs.c rpc.c net.c ether.c arp.c in_cksum.c netif.c \ - bootparam.c rarp.c - - -SRC_sa = alloc.c bcopy.c memcpy.c close.c getfile.c open.c \ - printf.c read.c strerror.c ufs.c globals.c lseek.c \ - closeall.c dev.c dkcksum.c nullfs.c fstat.c - -SRC_kern= ashrdi3.c bcmp.c bzero.c strcmp.c strlen.c - -SRC_sun3= exec_sun.c - -SRC_here= clock.c devopen.c dvma.c \ - gets.c panic.c \ - promboot.c promcons.c - -SRCS= ${SRC_net} ${SRC_sa} ${SRC_kern} ${SRC_sun3} ${SRC_here} - -# DBG= -DDEBUG -DNETIF_DEBUG -DNFS_DEBUG -DRPC_DEBUG \ -# -DNET_DEBUG -DRARP_DEBUG -DETHER_DEBUG - -#DEFS= -DCOMPAT_UFS -INCL= -I. -I${S}/lib/libsa -I${S} -COPTS= #-fno-defer-pop -CFLAGS= -O2 ${COPTS} ${DEFS} ${DBG} ${INCL} - -.PATH: ${DIR_SA} ${DIR_KERN} ../../sun3 - -all: libsa.a SRT0.o SRT1.o - -install: - -.include <bsd.lib.mk> diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/Makefile.inc b/sys/arch/mvme88k/stand/openbsd/libsa/Makefile.inc deleted file mode 100644 index c402951fa76..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/Makefile.inc +++ /dev/null @@ -1,12 +0,0 @@ -LIB_SA_DIR=${S}/arch/${MACHINE}/stand/libsa - -LIBSA_DIR!= cd ${LIB_SA_DIR}; \ - printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx - -LIBSA=${LIBSA_DIR}/libsa.a - -$(LIBSA): .NOTMAIN __always_make_libsa - @echo making sure the libsa is up to date... - @(cd ${LIB_SA_DIR}; ${MAKE}) - -__always_make_libsa: .NOTMAIN diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/SRT0.S b/sys/arch/mvme88k/stand/openbsd/libsa/SRT0.S deleted file mode 100644 index 1020a7ad9d5..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/SRT0.S +++ /dev/null @@ -1,130 +0,0 @@ -| $Id: SRT0.S,v 1.1 1997/03/03 19:31:06 rahnds Exp $ - -| Copyright (c) 1995 Theo de Raadt -| -| Redistribution and use in source and binary forms, with or without -| modification, are permitted provided that the following conditions -| are met: -| 1. Redistributions of source code must retain the above copyright -| notice, this list of conditions and the following disclaimer. -| 2. Redistributions in binary form must reproduce the above copyright -| notice, this list of conditions and the following disclaimer in the -| documentation and/or other materials provided with the distribution. -| 3. All advertising materials mentioning features or use of this software -| must display the following acknowledgement: -| This product includes software developed under OpenBSD by -| Theo de Raadt for Willowglen Singapore. -| 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. -| -| Copyright (c) 1995 Gordon W. Ross -| All rights reserved. -| -| Redistribution and use in source and binary forms, with or without -| modification, are permitted provided that the following conditions -| are met: -| 1. Redistributions of source code must retain the above copyright -| notice, this list of conditions and the following disclaimer. -| 2. Redistributions in binary form must reproduce the above copyright -| notice, this list of conditions and the following disclaimer in the -| documentation and/or other materials provided with the distribution. -| 3. The name of the author may not be used to endorse or promote products -| derived from this software without specific prior written permission. -| 4. All advertising materials mentioning features or use of this software -| must display the following acknowledgement: -| This product includes software developed by Gordon Ross -| -| THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -| IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -| OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -| IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -| INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -| NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -| THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -| SRT0.S - Stand-alone Run-Time startup code, part 0 - .file "SRT0.S" - .text - .globl __estack -__estack: - .globl start -start: -| Check to see if the code is located correctly. -| This SHOULD do a PC-relative load into a0, but... -| lea start, a0 | current location (0x4000) -| XXX - GAS version 1.93 gets the above lea wrong! - .word 0x41fa - .word 0xfffe -| Now 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,d2 | Desired end of program - subl a1,d2 | Calculate length, round up. - lsrl #2,d2 -Lcp: movl a0@+, a1@+ - dbra d2, Lcp - -| Force a long jump to the relocated code (not pc-relative) - lea restart:l, a0 - jmp a0@ - -restart: -| now in the relocated code - -| Set up stack (just before relocated text) - lea __estack:l, a0 - movl a0, sp - subl a6, a6 - - movl d0, _devlun - movl d1, _ctrlun - movl a3, _oparg - movl a4, _opargend - -| Call the run-time startup C code, which will: -| initialize, call main, call exit - jsr __start:l - -| If _start returns, fall into abort. - .globl _abort -_abort: - trap #0 - -| If abort returns, fall into reset. - .globl _reset -_reset: - reset - jmp _reset - -| function to get the vector base register - .globl _getvbr -_getvbr: - movc vbr, d0 - rts - -| The end. - - .data - .globl _devlun, _ctrlun, _oparg, _opargend -_devlun: .long 0 -_ctrlun: .long 0 -_oparg: .long 0 -_opargend: .long 0 diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/SRT1.c b/sys/arch/mvme88k/stand/openbsd/libsa/SRT1.c deleted file mode 100644 index 65b5f4ba030..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/SRT1.c +++ /dev/null @@ -1,115 +0,0 @@ -/* $Id: SRT1.c,v 1.1 1997/03/03 19:31:06 rahnds Exp $ */ - -/* - * Copyright (c) 1995 Theo de Raadt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Theo de Raadt for Willowglen Singapore. - * 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. - * - * Copyright (c) 1995 Gordon W. Ross - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * 4. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Gordon Ross - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* SRT1.c - Stand-alone Run-time startup code, part 1 */ - -#include <stdarg.h> -#include <sys/types.h> - -#include "config.h" - -extern int edata[], end[]; -extern int * getvbr(); -extern volatile void abort(); - -volatile void -exit() -{ -#if 0 - mon_exit_to_mon(); -#endif - abort(); -} - -struct brdid brdid; -int cputyp; - -/* - * This is called by SRT0.S - * to do final prep for main - */ -_start() -{ - register int *p; - - /* Clear BSS */ - p = edata; - do *p++ = 0; - while (p < end); - -#if 0 - /* Set the vector for trap 0 used by abort. */ - p = getvbr(); - p[32] = (int)romp->abortEntry; -#endif - - asm("clrl sp@-; trap #15; .short 0x70; movl sp@+, %0" : "&=d" (p)); - bcopy(p, &brdid, sizeof brdid); - cputyp = brdid.model; - - main(0); - exit(); -} - -/* - * Boot programs in C++ ? Not likely! - */ -__main() {} diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/bug.c b/sys/arch/mvme88k/stand/openbsd/libsa/bug.c deleted file mode 100644 index e0ac46017bf..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/bug.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 1995 Theo de Raadt - * 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 Theo de Raadt - * 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. - * - * bug routines -- assumes that the necessary sections of memory - * are preserved. - */ -#include <sys/types.h> -#include <machine/prom.h> - -#define MVMEPROM_CALL(x) \ - asm volatile (__CONCAT("trap #15; .short ", __STRING(x)) ) - -/* returns 0 if no characters ready to read */ -int -mvmeprom_instat() -{ - u_short ret; - - MVMEPROM_CALL(MVMEPROM_INSTAT); - asm volatile ("movew ccr,%0": "=d" (ret)); - return (!(ret & 0x4)); -} - -void -mvmeprom_outstr(start, end) - char *start, *end; -{ - asm volatile ("movl %0, sp@-" : "=a" (start)); - asm volatile ("movl %0, sp@-" : "=a" (end)); - MVMEPROM_CALL(MVMEPROM_OUTSTR); -} - -void -mvmeprom_outln(start, end) - char *start, *end; -{ - asm volatile ("movl %0, sp@-" : "=a" (start)); - asm volatile ("movl %0, sp@-" : "=a" (end)); - MVMEPROM_CALL(MVMEPROM_OUTSTRCRLF); -} - -/* returns 0: success, nonzero: error */ -int -mvmeprom_diskrd(arg) - struct mvmeprom_dskio *arg; -{ - int ret; - - asm volatile ("movel %0, sp@-"::"d" (arg)); - MVMEPROM_CALL(MVMEPROM_DSKRD); - asm volatile ("movew ccr,%0": "=d" (ret)); - return (!(ret & 0x4)); -} - -/* returns 0: success, nonzero: error */ -int -mvmeprom_diskwr(arg) - struct mvmeprom_dskio *arg; -{ - int ret; - - asm volatile ("movel %0, sp@-"::"d" (arg)); - MVMEPROM_CALL(MVMEPROM_DSKWR); - asm volatile ("movew ccr,%0": "=d" (ret)); - return (!(ret & 0x4)); -} - -#ifdef NOTYET -mvmeprom_diskcfig() {} -mvmeprom_diskfmt(){} -mvmeprom_diskctrl(){} -#endif - -/* BUG - timing routine */ -void -mvmeprom_delay(msec) - int msec; -{ - asm volatile ("movel %0,sp@-" : :"d" (msec)); - MVMEPROM_CALL(MVMEPROM_DELAY); -} - -/* BUG - return to bug routine */ -void -mvmeprom_return() -{ - MVMEPROM_CALL(MVMEPROM_EXIT); - /*NOTREACHED*/ -} - -/* BUG - query board routines */ -struct mvmeprom_brdid * -mvmeprom_getbrdid() -{ - struct mvmeprom_brdid *id; - - asm volatile ("clrl sp@-"); - MVMEPROM_CALL(MVMEPROM_GETBRDID); - asm volatile ("movel sp@+,%0": "=d" (id):); - return (id); -} - -void -mvmeprom_rtc_rd(ptime) - struct mvmeprom_time *ptime; -{ - asm volatile ("movel %0,sp@-" : :"a" (ptime)); - MVMEPROM_CALL(MVMEPROM_RTC_RD); -} diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/clock.c b/sys/arch/mvme88k/stand/openbsd/libsa/clock.c deleted file mode 100644 index 683bd48f849..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/clock.c +++ /dev/null @@ -1,79 +0,0 @@ -#include <sys/types.h> - -#include "clockreg.h" -#include "config.h" -#include "clock.h" - -/* - * BCD to decimal and decimal to BCD. - */ -#define FROMBCD(x) (((x) >> 4) * 10 + ((x) & 0xf)) -#define TOBCD(x) (((x) / 10 * 16) + ((x) % 10)) - -#define SECDAY (24 * 60 * 60) -#define SECYR (SECDAY * 365) -#define LEAPYEAR(y) (((y) & 3) == 0) - -/* - * This code is defunct after 2068. - * Will Unix still be here then?? - */ -const short dayyr[12] = -{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; - -static u_long -chiptotime(sec, min, hour, day, mon, year) - register int sec, min, hour, day, mon, year; -{ - register int days, yr; - - sec = FROMBCD(sec); - min = FROMBCD(min); - hour = FROMBCD(hour); - day = FROMBCD(day); - mon = FROMBCD(mon); - year = FROMBCD(year) + YEAR0; - if (year < 70) - year = 70; - - /* simple sanity checks */ - if (year < 70 || mon < 1 || mon > 12 || day < 1 || day > 31) - return (0); - days = 0; - for (yr = 70; yr < year; yr++) - days += LEAPYEAR(yr) ? 366 : 365; - days += dayyr[mon - 1] + day - 1; - if (LEAPYEAR(yr) && mon > 2) - days++; - /* now have days since Jan 1, 1970; the rest is easy... */ - return (days * SECDAY + hour * 3600 + min * 60 + sec); -} - -time_t -getsecs() -{ - extern int cputyp; - register struct clockreg *cl; - int sec, min, hour, day, mon, year; - - if (cputyp == CPU_147) - cl = (struct clockreg *) CLOCK_ADDR_147; - else - cl = (struct clockreg *) CLOCK_ADDR_16x; - - cl->cl_csr |= CLK_READ; /* enable read (stop time) */ - sec = cl->cl_sec; - min = cl->cl_min; - hour = cl->cl_hour; - day = cl->cl_mday; - mon = cl->cl_month; - year = cl->cl_year; - cl->cl_csr &= ~CLK_READ;/* time wears on */ - return (chiptotime(sec, min, hour, day, mon, year)); -} - -int -getticks() -{ - return getsecs() * 100; -} diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/clock.h b/sys/arch/mvme88k/stand/openbsd/libsa/clock.h deleted file mode 100644 index d61bc9b03b8..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/clock.h +++ /dev/null @@ -1,6 +0,0 @@ - -extern int hz; - -time_t getsecs(); -int getticks(); - diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/clockreg.h b/sys/arch/mvme88k/stand/openbsd/libsa/clockreg.h deleted file mode 100644 index 599f681d715..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/clockreg.h +++ /dev/null @@ -1,71 +0,0 @@ -/* $Id: clockreg.h,v 1.1 1997/03/03 19:31:06 rahnds Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * 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, Lawrence Berkeley Laboratory. - * - * 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. - * - * @(#)clockreg.h 8.1 (Berkeley) 6/11/93 - */ - -/* - * Mostek MK48T02 clock. - */ -struct clockreg { - volatile u_char cl_csr; /* control register */ - volatile u_char cl_sec; /* seconds (0..59; BCD) */ - volatile u_char cl_min; /* minutes (0..59; BCD) */ - volatile u_char cl_hour;/* hour (0..23; BCD) */ - volatile u_char cl_wday;/* weekday (1..7) */ - volatile u_char cl_mday;/* day in month (1..31; BCD) */ - volatile u_char cl_month; /* month (1..12; BCD) */ - volatile u_char cl_year;/* year (0..99; BCD) */ -}; -/* bits in cl_csr */ -#define CLK_WRITE 0x80 /* want to write */ -#define CLK_READ 0x40 /* want to read (freeze clock) */ - -/* - * Sun chose the year `68' as their base count, so that - * cl_year==0 means 1968. - */ -#define YEAR0 68 - -#define CLOCK_ADDR_147 (0xfffe07f8) /* PA of clock */ -#define CLOCK_ADDR_16x (0xfffc1ff8) /* PA of clock */ diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/config.h b/sys/arch/mvme88k/stand/openbsd/libsa/config.h deleted file mode 100644 index 8d5bedd9c9c..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/config.h +++ /dev/null @@ -1,66 +0,0 @@ -/* $Id: config.h,v 1.1 1997/03/03 19:31:06 rahnds Exp $ */ - -/* - * Copyright (c) 1995 Theo de Raadt - * 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 Theo de Raadt - * 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. - */ - -/* configuration information for base-line code */ - -#define ETHER_ADDR_147 (0xfffe0778) -#define ETHER_ADDR_16X (0xfffc0000+7980) -#define ERAM_ADDR (0xfffe0774) -#define LANCE_REG_ADDR (0xfffe1800) -#define INTEL_REG_ADDR (0xfff46000) - -#define CPU_147 0x147 -#define CPU_162 0x162 -#define CPU_167 0x167 -#define CPU_172 0x172 -#define CPU_177 0x177 - -struct brdid { - u_long eye_catcher; - u_char rev; - u_char month; - u_char day; - u_char year; - u_short size; - u_short rsv1; - u_short model; - u_short suffix; - u_short options; - u_char family; - u_char cpu; - u_short ctrlun; - u_short devlun; - u_short devtype; - u_short devnum; - u_long bug; -}; diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/dev_disk.c b/sys/arch/mvme88k/stand/openbsd/libsa/dev_disk.c deleted file mode 100644 index e7b1db4a478..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/dev_disk.c +++ /dev/null @@ -1,132 +0,0 @@ -/* $Id: dev_disk.c,v 1.1 1997/03/03 19:31:06 rahnds Exp $ */ - -/* - * 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. - */ - -/* - * 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/saio.h> - -#include "stand.h" - -#include "dvma.h" -#include "promdev.h" - -int -disk_open(f, devname) - struct open_file *f; - char *devname; /* Device part of file name (or NULL). */ -{ - struct saioreq *sip; - int error; - -#ifdef DEBUG_PROM - printf("disk_open: %s\n", devname); -#endif - - if ((error = prom_iopen(&sip)) != 0) - return (error); - - f->f_devdata = sip; - return 0; -} - -int -disk_close(f) - struct open_file *f; -{ - struct saioreq *sip; - - sip = f->f_devdata; - prom_iclose(sip); - f->f_devdata = NULL; - return 0; -} - -int -disk_strategy(devdata, flag, dblk, size, buf, rsize) - void *devdata; - int flag; - daddr_t dblk; - u_int size; - char *buf; - u_int *rsize; -{ - struct saioreq *si; - struct boottab *ops; - char *dmabuf; - int si_flag, xcnt; - - si = devdata; - ops = si->si_boottab; - -#ifdef DEBUG_PROM - printf("disk_strategy: size=%d dblk=%d\n", size, dblk); -#else - twiddle(); -#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_PROM - printf("disk_strategy: xcnt = %x\n", xcnt); -#endif - - if (xcnt <= 0) - return (EIO); - - *rsize = xcnt; - return (0); -} - -int -disk_ioctl() -{ - return EIO; -} - diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/dev_disk.h b/sys/arch/mvme88k/stand/openbsd/libsa/dev_disk.h deleted file mode 100644 index 9f05f74bd82..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/dev_disk.h +++ /dev/null @@ -1,6 +0,0 @@ - -int disk_open __P((struct open_file *, ...)); -int disk_close __P((struct open_file *)); -int disk_strategy __P((void *, int, daddr_t, u_int, char *, u_int *)); -int disk_ioctl(); - diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/devopen.c b/sys/arch/mvme88k/stand/openbsd/libsa/devopen.c deleted file mode 100644 index 92c083983cb..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/devopen.c +++ /dev/null @@ -1,32 +0,0 @@ - -#include <sys/param.h> -#include <stand.h> -#include "promboot.h" - -/* - * Open the device named by the combined device/file name - * given as the "fname" arg, something like: "sd()bsd" - * - * 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; - char *cp, *path, *devname; - int error; - - *file = (char*)fname; - dp = &devsw[0]; - f->f_dev = dp; - error = (*dp->dv_open)(f, prom_bootdev); - - return (error); -} diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/dvma.c b/sys/arch/mvme88k/stand/openbsd/libsa/dvma.c deleted file mode 100644 index 11526106c2a..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/dvma.c +++ /dev/null @@ -1,68 +0,0 @@ - -/* - * The easiest way to deal with the need for DVMA mappings is - * to just map the first four megabytes of RAM into DVMA space. - * That way, dvma_mapin can just compute the DVMA alias address, - * and dvma_mapout does nothing. - */ - -#include <sys/param.h> - -#define DVMA_BASE 0x00000000 -#define DVMA_MASK 0x00ffFFff -#define DVMA_MAPLEN 0x400000 /* 4 MB */ - -void -dvma_init() -{ -#if 0 - int segva, sme; - - for (segva = 0; segva < DVMA_MAPLEN; segva += NBSG) { - sme = get_segmap(segva); - set_segmap((DVMA_BASE | segva), sme); - } -#endif -} - -/* Convert a local address to a DVMA address. */ -char * -dvma_mapin(char *addr, int len) -{ - int va = (int)addr; - - va |= DVMA_BASE; - return ((char *) va); -} - -/* Convert a DVMA address to a local address. */ -char * -dvma_mapout(char *dmabuf, int len) -{ - if (dmabuf < (char*)DVMA_BASE) - panic("dvma_mapout"); - return (dmabuf - DVMA_BASE); -} - -extern char *alloc(int len); -char * -dvma_alloc(int len) -{ - char *mem; - - mem = alloc(len); - if (!mem) - return(mem); - return(dvma_mapin(mem, len)); -} - -extern void free(void *ptr, int len); -void -dvma_free(char *dvma, int len) -{ - char *mem; - - mem = dvma_mapout(dvma, len); - if (mem) - free(mem, len); -} diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/dvma.h b/sys/arch/mvme88k/stand/openbsd/libsa/dvma.h deleted file mode 100644 index 2b8be37cbe0..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/dvma.h +++ /dev/null @@ -1,6 +0,0 @@ - -char * dvma_mapin(char *pkt, int len); -void dvma_mapout(char *dmabuf, int len); - -char * dvma_alloc(int len); - diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/exec_sun.c b/sys/arch/mvme88k/stand/openbsd/libsa/exec_sun.c deleted file mode 100644 index ecca8fd307a..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/exec_sun.c +++ /dev/null @@ -1,212 +0,0 @@ -/* $Id: exec_sun.c,v 1.1 1997/03/03 19:31:07 rahnds Exp $ */ - -/*- - * Copyright (c) 1995 Theo de Raadt - * 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 Theo de Raadt - * 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. - * - * 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 <a.out.h> - -#include "stand.h" - -extern int debug; - -extern u_int bootdev; - -/*ARGSUSED*/ -exec_sun(file, loadaddr, howto) - char *file; - char *loadaddr; - int howto; -{ - register int io; - struct exec x; - int cc, magic; - void (*entry)(); - register char *cp; - register int *ip; - int textlen; - -#ifdef DEBUG - printf("exec_sun: file=%s loadaddr=0x%x\n", file, loadaddr); -#endif - - io = open(file, 0); - if (io < 0) - return(-1); - - /* - * Read in the exec header, and validate it. - */ - if (read(io, (char *)&x, sizeof(x)) != sizeof(x)) - goto shread; - if (N_BADMAG(x)) { - errno = EFTYPE; - goto closeout; - } - - cp = loadaddr; - textlen = x.a_text; - magic = N_GETMAGIC(x); - if (magic == ZMAGIC) { - cp += sizeof(x); - textlen -= sizeof(x); - } - entry = (void (*)())cp; - - /* - * Leave a copy of the exec header before the text. - * The sun3 kernel uses this to verify that the - * symbols were loaded by this boot program. - */ - bcopy(&x, cp - sizeof(x), sizeof(x)); - - /* - * Read in the text segment. - */ - printf("%x", x.a_text); - if (read(io, cp, textlen) != textlen) - goto shread; - cp += textlen; - - /* - * NMAGIC may have a gap between text and data. - */ - if (magic == NMAGIC) { - register int mask = N_PAGSIZ(x) - 1; - while ((int)cp & mask) - *cp++ = 0; - } - - /* - * Read in the data segment. - */ - printf("+%x", x.a_data); - if (read(io, cp, x.a_data) != x.a_data) - goto shread; - cp += x.a_data; - - /* - * Zero out the BSS section. - * (Kernel does not do it itself) - */ - printf("+%x", x.a_bss); - cc = x.a_bss; - while ((int)cp & 3) { - *cp++ = 0; - --cc; - } - ip = (int *)cp; - cp += cc; - while ((char *)ip < cp) - *ip++ = 0; - - /* - * Read in the symbol table and strings. - * (Always set the symtab size word.) - */ - *ip++ = x.a_syms; - cp = (char *)ip; - - if (x.a_syms > 0) { - - /* Symbol table and string table length word. */ - cc = x.a_syms; - printf("+[%x", cc); - cc += sizeof(int); /* strtab length too */ - if (read(io, cp, cc) != cc) - goto shread; - cp += x.a_syms; - ip = (int *)cp; /* points to strtab length */ - cp += sizeof(int); - - /* String table. Length word includes itself. */ - cc = *ip; - printf("+%x]", cc); - cc -= sizeof(int); - if (cc <= 0) - goto shread; - if (read(io, cp, cc) != cc) - goto shread; - cp += cc; - } - printf("=%x\n", cp - loadaddr); - close(io); - - if (debug) { - printf("Debug mode - enter c to continue\n"); - asm(" trap #0"); - } - - printf("Starting program at 0x%x\n", (int)entry); - (*entry)(howto, bootdev, cp, 0, 0); - panic("exec returned"); - -shread: - printf("exec: short read\n"); - errno = EIO; -closeout: - close(io); - return(-1); -} diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/gets.c b/sys/arch/mvme88k/stand/openbsd/libsa/gets.c deleted file mode 100644 index 11a42b29b87..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/gets.c +++ /dev/null @@ -1,141 +0,0 @@ -/* $Id: gets.c,v 1.1 1997/03/03 19:31:07 rahnds Exp $ */ - -/*- - * Copyright (c) 1995 Theo de Raadt - * 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 Theo de Raadt - * 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. - * - * 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; -{ - register int c; - register char *lp; - -top: - lp = buf; - - for (;;) { - c = getchar() & 0177; - - putchar(c); - - 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; - - /* - * This is not very useful in a boot program. - * (It costs you 52 bytes on m68k, gcc -O3). - */ - case 'r'&037: { - register char *p; - putchar('\n'); - for (p = buf; p < lp; ++p) - putchar(*p); - continue; - } - - case '@': - case 'u'&037: - case 'w'&037: - putchar('\n'); - goto top; - - case '\r': - putchar('\n'); - /* fall through */ - case '\n': - *lp = '\0'; - return; - - } /* switch */ - } - /*NOTREACHED*/ -} diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/netif_sun.c b/sys/arch/mvme88k/stand/openbsd/libsa/netif_sun.c deleted file mode 100644 index 20959d34f0b..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/netif_sun.c +++ /dev/null @@ -1,284 +0,0 @@ -/* $Id: netif_sun.c,v 1.1 1997/03/03 19:31:07 rahnds 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. - */ - -/* - * 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 <string.h> -#include <time.h> - -#include <net/if.h> - -#include <netinet/in.h> -#include <netinet/if_ether.h> -#include <netinet/in_systm.h> - -#include <machine/control.h> -#include <machine/idprom.h> -#include <machine/mon.h> -#include <machine/saio.h> - -#include "stand.h" -#include "net.h" -#include "netif.h" - -#include "clock.h" -#include "dvma.h" -#include "promdev.h" - -static struct netif netif_prom; - -#ifdef NETIF_DEBUG -int netif_debug; -#endif - -struct iodesc sockets[SOPEN_MAX]; - -struct iodesc * -socktodesc(sock) - int sock; -{ - if (sock != 0) { - return(NULL); - } - return (sockets); -} - -int -netif_open(machdep_hint) - void *machdep_hint; -{ - struct saioreq *si; - struct iodesc *io; - int fd, error; - - /* find a free socket */ - io = sockets; - if (io->io_netif) { -#ifdef DEBUG - printf("netif_open: device busy\n"); -#endif - return (-1); - } - bzero(io, sizeof(*io)); - - /* - * 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) { -#ifdef DEBUG - printf("netif_open: prom_iopen, error=%d\n", error); -#endif - return (-1); - } - if (si->si_sif == NULL) { -#ifdef DEBUG - printf("netif_open: not a network device\n"); -#endif - prom_iclose(si); - return (-1); - } - - netif_prom.devdata = si; - io->io_netif = &netif_prom; - - /* Put our ethernet address in io->myea */ - sun3_getether(io->myea); - - return(0); -} - -int -netif_close(fd) - int fd; -{ - struct iodesc *io; - struct netif *ni; - - if (fd != 0) { - errno = EBADF; - return(-1); - } - - io = sockets; - ni = io->io_netif; - if (ni != NULL) { - prom_iclose(ni->devdata); - ni->devdata = NULL; - io->io_netif = NULL; - } - return(0); -} - -/* - * 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; - int len; -{ - struct saioreq *si; - struct saif *sif; - char *dmabuf; - int rv, sendlen; - -#ifdef NETIF_DEBUG - if (netif_debug) { - 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 - - si = desc->io_netif->devdata; - sif = si->si_sif; - sendlen = len; - if (sendlen < 60) { - sendlen = 60; -#ifdef NETIF_DEBUG - printf("netif_put: length padded to %d\n", sendlen); -#endif - } - -#ifdef PARANOID - if (sif == NULL) - panic("netif_put: no saif ptr\n"); -#endif - - dmabuf = dvma_mapin(pkt, sendlen); - rv = sif->sif_xmit(si->si_devdata, dmabuf, sendlen); - dvma_mapout(dmabuf, sendlen); - -#ifdef NETIF_DEBUG - if (netif_debug) - printf("netif_put: xmit returned %d\n", rv); -#endif - if (rv == 0) rv = len; - else rv = -1; - - return rv; -} - -/* - * 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; - int maxlen; - time_t timo; -{ - struct saioreq *si; - struct saif *sif; - char *dmabuf; - int tick0, tmo_ticks; - int len; - -#ifdef NETIF_DEBUG - if (netif_debug) - printf("netif_get: pkt=0x%x, maxlen=%d, tmo=%d\n", - pkt, maxlen, timo); -#endif - - si = desc->io_netif->devdata; - sif = si->si_sif; - -#ifdef PARANOID - if (sif == NULL) - panic("netif_get: no saif ptr\n"); -#endif - - tmo_ticks = timo * hz; - tick0 = getticks(); - - dmabuf = dvma_mapin(pkt, maxlen); - do len = sif->sif_poll(si->si_devdata, dmabuf); - while ((len == 0) && ((getticks() - tick0) < tmo_ticks)); - dvma_mapout(dmabuf, maxlen); - -#ifdef NETIF_DEBUG - if (netif_debug) - printf("netif_get: received len=%d\n", len); -#endif - - if (len < 12) - return -1; - -#ifdef NETIF_DEBUG - if (netif_debug) { - 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 len; -} - -static struct idprom sun3_idprom; - -sun3_getether(ea) - u_char *ea; -{ - u_char *src, *dst; - int len, x; - - if (sun3_idprom.idp_format == 0) { - dst = (char*)&sun3_idprom; - src = (char*)IDPROM_BASE; - len = IDPROM_SIZE; - do { - x = get_control_byte(src++); - *dst++ = x; - } while (--len > 0); - } - MACPY(sun3_idprom.idp_etheraddr, ea); -} - diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/panic.c b/sys/arch/mvme88k/stand/openbsd/libsa/panic.c deleted file mode 100644 index f7c83a6d8e7..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/panic.c +++ /dev/null @@ -1,31 +0,0 @@ - -#include <stdarg.h> -#include "stand.h" - -extern volatile void abort(); -extern int _estack[]; - -__dead void -panic(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - printf(fmt, ap); - printf("\n"); - va_end(ap); - stackdump(0); - abort(); -} - -stackdump(dummy) - int dummy; -{ - int *ip; - - printf("stackdump:\n"); - for (ip = &dummy; ip < _estack; ip += 4) { - printf("%x: %x %x %x %x\n", - (int)ip, ip[0], ip[1], ip[2], ip[3]); - } -} diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/promboot.c b/sys/arch/mvme88k/stand/openbsd/libsa/promboot.c deleted file mode 100644 index 13c6206ca7f..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/promboot.c +++ /dev/null @@ -1,93 +0,0 @@ -/* $Id: promboot.c,v 1.1 1997/03/03 19:31:07 rahnds Exp $ */ - -/* - * Copyright (c) 1995 Theo de Raadt - * 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 Theo de Raadt - * 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/param.h> -#include <sys/reboot.h> -#include "stand.h" -#include "promboot.h" - -char prom_bootdev[32]; -char prom_bootfile[32]; -int prom_boothow; -int debug; - -void -prom_get_boot_info() -{ - char c, *src, *dst; - extern int devlun, ctrlun; - extern char *oparg, *opargend; - -#ifdef DEBUG - printf("prom_get_boot_info\n"); -#endif - - /* Get kernel filename */ - src = oparg; - while (src && (*src == ' ' || *src == '\t')) - src++; - - dst = prom_bootfile; - if (src && *src != '-') { - while (src && *src) { - if (*src == ' ' || *src == '\t') - break; - *dst++ = *src++; - } - } - *dst = '\0'; - - /* Get boothowto flags */ - while (src && (*src == ' ' || *src == '\t')) - src++; - 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 = 1; - break; - } - } - } -#ifdef DEBUG - printf("promboot: device=\"%s\" file=\"%s\" how=0x%x\n", - prom_bootdev, prom_bootfile, prom_boothow); -#endif -} diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/promboot.h b/sys/arch/mvme88k/stand/openbsd/libsa/promboot.h deleted file mode 100644 index 86b5aace21c..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/promboot.h +++ /dev/null @@ -1,5 +0,0 @@ - -extern char prom_bootdev[]; -extern char prom_bootfile[]; -extern int prom_boothow; - diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/promcons.c b/sys/arch/mvme88k/stand/openbsd/libsa/promcons.c deleted file mode 100644 index 4fdb3d69e1f..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/promcons.c +++ /dev/null @@ -1,62 +0,0 @@ -/* $Id: promcons.c,v 1.1 1997/03/03 19:31:07 rahnds Exp $ */ - -/* - * Copyright (c) 1995 Theo de Raadt - * 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 Theo de Raadt - * 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 <stdarg.h> -#include <sys/types.h> - -int -getchar() -{ - char c; - - __asm("movb #0,sp@-; trap #15; .short 0x0; movb sp@+, %0" : : "d" (c)); - return (c); -} - -peekchar() -{ - int have = 0; - - __asm("trap #15; .short 0x1; beq 1f; movl #1, %0\n1:" : : "d" (have)); - return (have); -} - -void -putchar(c) - int c; -{ - if (c == '\n') - putchar('\r'); - __asm("movb %0,sp@-; trap #15; .short 0x20" : : "d" (c)); -} - diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/promdev.c b/sys/arch/mvme88k/stand/openbsd/libsa/promdev.c deleted file mode 100644 index a8a9e6aa9dd..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/promdev.c +++ /dev/null @@ -1,193 +0,0 @@ -/* $Id: promdev.c,v 1.1 1997/03/03 19:31:07 rahnds 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/param.h> -#include <machine/mon.h> -#include <machine/pte.h> -#include <machine/saio.h> - -#include <dvma.h> -#include <stand.h> - -struct saioreq prom_si; -static int promdev_inuse; - -static char * -prom_mapin(u_long physaddr, int length, int maptype); - -int -prom_iopen(void **devdatap) -{ - struct bootparam *bp; - struct boottab *ops; - struct devinfo *dip; - struct saioreq *si; - char *p; - int error; - - if (promdev_inuse) - return(EMFILE); - - bp = *romp->bootParam; - ops = bp->bootDevice; - dip = ops->b_devinfo; - -#ifdef DEBUG_PROM - printf("Boot device type: %s\n", ops->b_desc); -#endif - - dvma_init(); - - si = &prom_si; - bzero((caddr_t)si, sizeof(*si)); - si->si_boottab = ops; - si->si_ctlr = bp->ctlrNum; - si->si_unit = bp->unitNum; - si->si_boff = bp->partNum; - - if (si->si_ctlr > dip->d_stdcount) { - printf("Invalid controller number\n"); - return(ENXIO); - } - - if (dip->d_devbytes) { - si->si_devaddr = prom_mapin(dip->d_stdaddrs[si->si_ctlr], - dip->d_devbytes, dip->d_devtype); -#ifdef DEBUG_PROM - printf("prom_iopen: devaddr=0x%x pte=0x%x\n", - si->si_devaddr, get_pte(si->si_devaddr)); -#endif - } - - if (dip->d_dmabytes) { - si->si_dmaaddr = dvma_alloc(dip->d_dmabytes); -#ifdef DEBUG_PROM - printf("prom_iopen: dmaaddr=0x%x\n", si->si_dmaaddr); -#endif - } - - /* OK, call the PROM device open routine. */ - error = (*ops->b_open)(si); - if (error != 0) { - printf("prom_iopen: \"%s\" error=%d\n", - ops->b_desc, error); - return (ENXIO); - } -#ifdef DEBUG_PROM - printf("prom_iopen: succeeded, error=%d\n", error); -#endif - - *devdatap = si; - promdev_inuse++; - return (0); -} - -void -prom_iclose(void *devdata) -{ - struct boottab *ops; - struct devinfo *dip; - struct saioreq *si; - - if (promdev_inuse == 0) - return; - - si = devdata; - ops = si->si_boottab; - dip = ops->b_devinfo; - - (*ops->b_close)(si); - - if (si->si_dmaaddr) { - dvma_free(si->si_dmaaddr, dip->d_dmabytes); - si->si_dmaaddr = NULL; - } - - promdev_inuse = 0; -} - -struct mapinfo { - int maptype; - int pgtype; - int base; -}; - -static struct mapinfo -prom_mapinfo[] = { - { MAP_MAINMEM, PGT_OBMEM, 0 }, - { MAP_OBIO, PGT_OBIO, 0 }, - { MAP_MBMEM, PGT_OBMEM, 0 }, /* XXX - Sun2 Multibus? */ - { MAP_MBIO, PGT_OBIO, 0 }, /* XXX - Sun2 Multibus? */ - { MAP_VME16A16D, PGT_VME_D16, 0xFFFF0000 }, - { MAP_VME16A32D, PGT_VME_D32, 0xFFFF0000 }, - { MAP_VME24A16D, PGT_VME_D16, 0xFF000000 }, - { MAP_VME24A32D, PGT_VME_D32, 0xFF000000 }, - { MAP_VME32A16D, PGT_VME_D16, 0 }, - { MAP_VME32A32D, PGT_VME_D32, 0 }, -}; -static prom_mapinfo_cnt = sizeof(prom_mapinfo) / sizeof(prom_mapinfo[0]); - -/* The virtual address we will use for PROM device mappings. */ -static int prom_devmap = MONSHORTSEG; - -static char * -prom_mapin(physaddr, length, maptype) - u_long physaddr; - int length, maptype; -{ - int i, pa, pte, va; - - if (length > (4*NBPG)) - panic("prom_mapin: length=%d\n", length); - - for (i = 0; i < prom_mapinfo_cnt; i++) - if (prom_mapinfo[i].maptype == maptype) - goto found; - panic("prom_mapin: invalid maptype %d\n", maptype); -found: - - pte = prom_mapinfo[i].pgtype; - pte |= PG_PERM; - pa = prom_mapinfo[i].base; - pa += physaddr; - pte |= PA_PGNUM(pa); - - va = prom_devmap; - do { - set_pte(va, pte); - va += NBPG; - pte += 1; - length -= NBPG; - } while (length > 0); - return ((char*)prom_devmap); -} diff --git a/sys/arch/mvme88k/stand/openbsd/libsa/promdev.h b/sys/arch/mvme88k/stand/openbsd/libsa/promdev.h deleted file mode 100644 index e3ae5ba2d7c..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/libsa/promdev.h +++ /dev/null @@ -1,4 +0,0 @@ - -int prom_iopen(struct saioreq **sipp); -void prom_iclose(struct saioreq *sip); - diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/Makefile b/sys/arch/mvme88k/stand/openbsd/netboot/Makefile deleted file mode 100644 index dd675f294da..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/netboot/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# $Id: Makefile,v 1.2 1997/04/27 20:56:33 millert Exp $ - -RELOC=0x3F0000 - -S= ${.CURDIR}/../../../.. -DEFS= -DSTANDALONE -DSUN_BOOTPARAMS -INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${S} -I${S}/lib/libsa -CFLAGS= -O2 ${INCPATH} ${DEFS} ${COPTS} - -.include "${S}/arch/${MACHINE}/stand/libsa/Makefile.inc" -.PATH: ${S}/arch/${MACHINE}/stand/libsa -SRTOBJ= SRT0.o SRT1.o - -SRCS= boot.c conf.c version.c dev_net.c -SRCS+= if_ie.c if_le.c -OBJS= ${SRTOBJ} ${SRCS:S/.c/.o/g} - -all: netboot.bin - -netboot: ${OBJS} ${LIBSA} - ${LD} -s -N -T ${RELOC} -e start -o $@ ${OBJS} ${LIBSA} - @size $@ - -netboot.bin: netboot - dd ibs=32 skip=1 if=netboot of=$@ - -install: - ${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - netboot.bin ${DESTDIR}${MDEC_DIR}/netboot - -.include <bsd.prog.mk> diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/boot.c b/sys/arch/mvme88k/stand/openbsd/netboot/boot.c deleted file mode 100644 index 4c465af5cd0..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/netboot/boot.c +++ /dev/null @@ -1,119 +0,0 @@ -/* $Id: boot.c,v 1.1 1997/03/03 19:31:08 rahnds Exp $ */ - -/*- - * Copyright (c) 1995 Theo de Raadt - * 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 Theo de Raadt - * 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. - * - * 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 "stand.h" -#include "promboot.h" - -/* - * Boot device is derived from ROM provided information. - */ -#define LOADADDR 0x10000 - -extern char *version; -char defname[32] = "bsd"; -char line[80]; - -#if 0 -u_int bootdev = MAKEBOOTDEV(0, sdmajor, 0, 0, 0); /* disk boot */ -#endif -u_int bootdev = MAKEBOOTDEV(1, 0, 0, 0, 0); /* network boot */ - -main() -{ - char *cp, *file; - int io; - extern int cputyp; - extern char *oparg, *opargend; - int ask = 0; - - printf(">> OpenBSD netboot [%s]\n", version); - printf("model MVME%x\n", cputyp); - - *opargend = '\0'; - prom_get_boot_info(); - file = defname; - - cp = prom_bootfile; - if (cp && *cp) - file = cp; - - for (;;) { - if (ask) { - printf("boot: "); - gets(line); - if (line[0]) { - oparg = line; - prom_get_boot_info(); - } - } - exec_sun(file, (char *)LOADADDR, prom_boothow); - printf("boot: %s\n", strerror(errno)); - ask = 1; - } -} diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/conf.c b/sys/arch/mvme88k/stand/openbsd/netboot/conf.c deleted file mode 100644 index 5527ccf8f63..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/netboot/conf.c +++ /dev/null @@ -1,34 +0,0 @@ -/* $Id: conf.c,v 1.1 1997/03/03 19:31:08 rahnds Exp $ */ - -#include <sys/types.h> -#include <netinet/in.h> -#include <netinet/in_systm.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 = sizeof(file_system) / sizeof(file_system[0]); - -struct devsw devsw[] = { - { "net", net_strategy, net_open, net_close, net_ioctl }, -}; -int ndevs = sizeof(devsw) / sizeof(devsw[0]); - -extern struct netif_driver le_driver; -extern struct netif_driver ie_driver; - -struct netif_driver *netif_drivers[] = { - &le_driver, - &ie_driver, -}; -int n_netif_drivers = sizeof(netif_drivers) / sizeof(netif_drivers[0]); - - -/* XXX */ -int netif_debug; -int debug; -int errno; diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/dev_net.c b/sys/arch/mvme88k/stand/openbsd/netboot/dev_net.c deleted file mode 100644 index f0490b9dd6a..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/netboot/dev_net.c +++ /dev/null @@ -1,211 +0,0 @@ -/* $Id: dev_net.c,v 1.1 1997/03/03 19:31:08 rahnds 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. - */ - -/* - * This module implements a "raw device" interface suitable for - * use by the stand-alone I/O library NFS code. This interface - * does not support any "block" access, and exists only for the - * purpose of initializing the network interface, getting boot - * parameters, and performing the NFS mount. - * - * At open time, this does: - * - * find interface - netif_open() - * RARP for IP address - rarp_getipaddress() - * RPC/bootparams - callrpc(d, RPC_BOOTPARAMS, ...) - * RPC/mountd - nfs_mount(sock, ip, path) - * - * the root file handle from mountd is saved in a global - * for use by the NFS open code (NFS/lookup). - */ - -#include <sys/param.h> -#include <sys/socket.h> -#include <net/if.h> -#include <netinet/in.h> -#include <netinet/if_ether.h> -#include <netinet/in_systm.h> - -#include "stand.h" -#include "net.h" -#include "netif.h" -#include "config.h" -#include "bootparam.h" - -extern int nfs_root_node[]; /* XXX - get from nfs_mount() */ - -struct in_addr myip, rootip, gateip, mask; -char rootpath[FNAME_SIZE]; - -int netdev_sock = -1; -static int open_count; - -/* - * Called by devopen after it sets f->f_dev to our devsw entry. - * This opens the low-level device and sets f->f_devdata. - */ -int -net_open(f, devname) - struct open_file *f; - char *devname; /* Device part of file name (or NULL). */ -{ - int error = 0; - - /* On first open, do netif open, mount, etc. */ - if (open_count == 0) { - /* Find network interface. */ - if ((netdev_sock = netif_open(devname)) < 0) - return (error=ENXIO); - if ((error = net_mountroot(f, devname)) != 0) - return (error); - } - open_count++; - f->f_devdata = nfs_root_node; - return (error); -} - -int -net_close(f) - struct open_file *f; -{ - /* On last close, do netif close, etc. */ - if (open_count > 0) - if (--open_count == 0) - netif_close(netdev_sock); - f->f_devdata = NULL; -} - -int -net_ioctl() -{ - return EIO; -} - -int -net_strategy() -{ - return EIO; -} - -int -net_mountroot(f, devname) - struct open_file *f; - char *devname; /* Device part of file name (or NULL). */ -{ - int error; - -#ifdef DEBUG - printf("net_mountroot: %s\n", devname); -#endif - - /* - * Get info for NFS boot: our IP address, our hostname, - * server IP address, and our root path on the server. - * There are two ways to do this: The old, Sun way, - * and the more modern, BOOTP way. (RFC951, RFC1048) - */ - -#ifdef SUN_BOOTPARAMS - /* Get boot info using RARP and Sun bootparams. */ - - /* Get our IP address. (rarp.c) */ - if (rarp_getipaddress(netdev_sock) == -1) - return (EIO); - printf("boot: client IP address: %s\n", intoa(myip.s_addr)); - - /* Get our hostname, server IP address. */ - if (bp_whoami(netdev_sock)) - return (EIO); - printf("boot: client name: %s\n", hostname); - - /* Get the root pathname. */ - if (bp_getfile(netdev_sock, "root", &rootip, rootpath)) - return (EIO); - -#else - - /* Get boot info using BOOTP way. (RFC951, RFC1048) */ - bootp(netdev_sock); - - printf("Using IP address: %s\n", intoa(myip.s_addr)); - - printf("myip: %s (%s)", hostname, intoa(myip)); - if (gateip) - printf(", gateip: %s", intoa(gateip)); - if (mask) - printf(", mask: %s", intoa(mask)); - printf("\n"); - -#endif - - printf("root addr=%s path=%s\n", intoa(rootip.s_addr), rootpath); - - /* Get the NFS file handle (mount). */ - error = nfs_mount(netdev_sock, rootip, rootpath); - - return (error); -} - -/* - * machdep_common_ether: get ethernet address - */ -void -machdep_common_ether(ether) - u_char *ether; -{ - u_char *ea; - extern int cputyp; - - if (cputyp == CPU_147) { - ea = (u_char *) ETHER_ADDR_147; - - if ((*(int *) ea & 0x2fffff00) == 0x2fffff00) - panic("ERROR: ethernet address not set!\r\n"); - ether[0] = 0x08; - ether[1] = 0x00; - ether[2] = 0x3e; - ether[3] = ea[0]; - ether[4] = ea[1]; - ether[5] = ea[2]; - } else { - ea = (u_char *) ETHER_ADDR_16X; - - if (ea[0] + ea[1] + ea[2] + ea[3] + ea[4] + ea[5] == 0) - panic("ERROR: ethernet address not set!\r\n"); - ether[0] = ea[0]; - ether[1] = ea[1]; - ether[2] = ea[2]; - ether[3] = ea[3]; - ether[4] = ea[4]; - ether[5] = ea[5]; - } -} diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/dev_net.h b/sys/arch/mvme88k/stand/openbsd/netboot/dev_net.h deleted file mode 100644 index 093ba193bfd..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/netboot/dev_net.h +++ /dev/null @@ -1,6 +0,0 @@ - -int net_open __P((struct open_file *, ...)); -int net_close __P((struct open_file *)); -int net_ioctl(); -int net_strategy(); - diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/i82586.h b/sys/arch/mvme88k/stand/openbsd/netboot/i82586.h deleted file mode 100644 index 3275601ee25..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/netboot/i82586.h +++ /dev/null @@ -1,306 +0,0 @@ -/* $Id: i82586.h,v 1.1 1997/03/03 19:31:08 rahnds Exp $ */ - -/*- - * Copyright (c) 1995 Theo de Raadt - * Copyright (c) 1992, University of Vermont and State Agricultural College. - * Copyright (c) 1992, Garrett A. Wollman. - * 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 - * Vermont and State Agricultural College and Garrett A. Wollman. - * 4. Neither the name of the University nor the name of the author - * 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 UNIVERSITY OR 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. - */ - -/* - * Intel 82586 Ethernet chip - * Register, bit, and structure definitions. - * - * Written by GAW with reference to the Clarkson Packet Driver code for this - * chip written by Russ Nelson and others. - */ - -struct ie_en_addr { - u_char data[6]; -}; -/* - * the only actual IE registers. - */ -struct iereg { - u_short ie_porthigh; - u_short ie_portlow; - u_long ie_attention; -}; -#define IE_PORT_NEWSCP 0x00000002 -#define IE_PORT_RESET 0x00000000 - -/* - * This is the master configuration block. It tells the hardware where - * all the rest of the stuff is. - */ -struct ie_scp { - u_char mbz1[3]; /* must be zero */ - u_char scp_sysbus; /* true if 8-bit only */ - u_char mbz2[4]; /* must be zero */ - u_short scp_iscp_low; /* 24-bit physaddr of ISCP */ - u_char mbz3[1]; - u_char scp_iscp_high; /* the rest of the physaddr.. */ -}; -/* - * The tells the hardware where all the rest of the stuff is, too. - * FIXME: some of these should be re-commented after we figure out their - * REAL function. - */ -struct ie_iscp { - u_char mbz1[1]; - u_char iscp_busy; /* zeroed after init */ - u_short iscp_scboffset; /* 16-bit physaddr of next struct */ - u_short iscp_base_low; /* 24-bit physaddr for all 16-bit vars */ - u_char mbz2[1]; - u_char iscp_base_high; /* rest of physaddr ... */ -}; -/* - * This FINALLY tells the hardware what to do and where to put it. - */ -struct ie_scb { - u_short ie_status; /* status word */ - u_short ie_command; /* command word */ - u_short ie_command_list;/* 16-pointer to command block list */ - u_short ie_recv_list; /* 16-pointer to receive frame list */ - u_short ie_err_crc; /* CRC errors */ - u_short ie_err_align; /* Alignment errors */ - u_short ie_err_resource;/* Resource errors */ - u_short ie_err_overrun; /* Overrun errors */ -}; -/* Command values */ -#define IE_RU_COMMAND 0x0070 /* mask for RU command */ -#define IE_RU_NOP 0 /* for completeness */ -#define IE_RU_START 0x0010 /* start receive unit command */ -#define IE_RU_ENABLE 0x0020 /* enable receiver command */ -#define IE_RU_DISABLE 0x0030 /* disable receiver command */ -#define IE_RU_ABORT 0x0040 /* abort current receive operation */ - -#define IE_CU_COMMAND 0x0700 /* mask for CU command */ -#define IE_CU_NOP 0 /* included for completeness */ -#define IE_CU_START 0x0100 /* do-command command */ -#define IE_CU_RESUME 0x0200 /* resume a suspended cmd list */ -#define IE_CU_STOP 0x0300 /* SUSPEND was already taken */ -#define IE_CU_ABORT 0x0400 /* abort current command */ - -#define IE_ACK_COMMAND 0xf000 /* mask for ACK command */ -#define IE_ACK_CX 0x8000 /* ack IE_ST_DONE */ -#define IE_ACK_FR 0x4000 /* ack IE_ST_RECV */ -#define IE_ACK_CNA 0x2000 /* ack IE_ST_ALLDONE */ -#define IE_ACK_RNR 0x1000 /* ack IE_ST_RNR */ - -#define IE_ACTION_COMMAND(x) (((x) & IE_CU_COMMAND) == IE_CU_START) - /* is this command an action command? */ - -/* Status values */ -#define IE_ST_WHENCE 0xf000 /* mask for cause of interrupt */ -#define IE_ST_DONE 0x8000 /* command with I bit completed */ -#define IE_ST_RECV 0x4000 /* frame received */ -#define IE_ST_ALLDONE 0x2000 /* all commands completed */ -#define IE_ST_RNR 0x1000 /* receive not ready */ - -#define IE_CU_STATUS 0x700 /* mask for command unit status */ -#define IE_CU_ACTIVE 0x200 /* command unit is active */ -#define IE_CU_SUSPEND 0x100 /* command unit is suspended */ - -#define IE_RU_STATUS 0x70 /* mask for receiver unit status */ -#define IE_RU_SUSPEND 0x10 /* receiver is suspended */ -#define IE_RU_NOSPACE 0x20 /* receiver has no resources */ -#define IE_RU_READY 0x40 /* receiver is ready */ - -/* - * This is filled in partially by the chip, partially by us. - */ -struct ie_recv_frame_desc { - u_short ie_fd_status; /* status for this frame */ - u_short ie_fd_last; /* end of frame list flag */ - u_short ie_fd_next; /* 16-pointer to next RFD */ - u_short ie_fd_buf_desc; /* 16-pointer to list of buffer desc's */ - struct ie_en_addr dest; /* destination ether */ - struct ie_en_addr src; /* source ether */ - u_short ie_length; /* 802 length/Ether type */ - u_short mbz; /* must be zero */ -}; -#define IE_FD_LAST 0x8000 /* last rfd in list */ -#define IE_FD_SUSP 0x4000 /* suspend RU after receipt */ - -#define IE_FD_COMPLETE 0x8000 /* frame is complete */ -#define IE_FD_BUSY 0x4000 /* frame is busy */ -#define IE_FD_OK 0x2000 /* frame is bad */ -#define IE_FD_RNR 0x0200 /* receiver out of resources here */ - -/* - * linked list of buffers... - */ -struct ie_recv_buf_desc { - u_short ie_rbd_actual; /* status for this buffer */ - u_short ie_rbd_next; /* 16-pointer to next RBD */ - u_short ie_rbd_buffer_low; /* 24-pointer to buffer for this RBD */ - u_short ie_rbd_buffer_high; /* 24-pointer to buffer for this RBD */ - u_short ie_rbd_length; /* length of the buffer */ - u_short mbz; /* must be zero */ -}; -#define IE_RBD_LAST 0x8000 /* last buffer */ -#define IE_RBD_USED 0x4000 /* this buffer has data */ -/* - * All commands share this in common. - */ -struct ie_cmd_common { - u_short ie_cmd_status; /* status of this command */ - u_short ie_cmd_cmd; /* command word */ - u_short ie_cmd_link; /* link to next command */ -}; -#define IE_STAT_COMPL 0x8000 /* command is completed */ -#define IE_STAT_BUSY 0x4000 /* command is running now */ -#define IE_STAT_OK 0x2000 /* command completed successfully */ -#define IE_STAT_ABORT 0x1000 /* command was aborted */ - - -#define IE_CMD_NOP 0x0000 /* NOP */ -#define IE_CMD_IASETUP 0x0001 /* initial address setup */ -#define IE_CMD_CONFIG 0x0002 /* configure command */ -#define IE_CMD_MCAST 0x0003 /* multicast setup command */ -#define IE_CMD_XMIT 0x0004 /* transmit command */ -#define IE_CMD_TDR 0x0005 /* time-domain reflectometer command */ -#define IE_CMD_DUMP 0x0006 /* dump command */ -#define IE_CMD_DIAGNOSE 0x0007 /* diagnostics command */ - -#define IE_CMD_LAST 0x8000 /* this is the last command in the list */ -#define IE_CMD_SUSPEND 0x4000 /* suspend CU after this command */ -#define IE_CMD_INTR 0x2000 /* post an interrupt after completion */ - -/* - * This is the command to transmit a frame. - */ -struct ie_xmit_cmd { - struct ie_cmd_common com; /* common part */ -#define ie_xmit_status com.ie_cmd_status - - u_short ie_xmit_desc; /* 16-pointer to buffer descriptor */ - struct ie_en_addr ie_xmit_addr; /* destination address */ - - u_short ie_xmit_length; /* 802.3 length/Ether type field */ -}; -#define IE_XS_MAXCOLL 0x000f /* number of collisions during transmit */ -#define IE_XS_EXCMAX 0x0020 /* exceeded maximum number of collisions */ -#define IE_XS_SQE 0x0040 /* SQE positive */ -#define IE_XS_DEFERRED 0x0080 /* transmission deferred */ -#define IE_XS_UNDERRUN 0x0100 /* DMA underrun */ -#define IE_XS_LOSTCTS 0x0200 /* Lost CTS */ -#define IE_XS_NOCARRIER 0x0400 /* No Carrier */ - -/* - * This is a buffer descriptor for a frame to be transmitted. - */ - -struct ie_xmit_buf { - u_short ie_xmit_flags; /* see below */ - u_short ie_xmit_next; /* 16-pointer to next desc. */ - u_short ie_xmit_buf_low;/* 24-pointer to the actual buffer */ - u_short ie_xmit_buf_high; /* 24-pointer to the actual buffer */ -}; -#define IE_XMIT_LAST 0x8000 /* this TBD is the last one */ -/* The rest of the `flags' word is actually the length. */ - -/* - * Multicast setup command. - */ - -#define MAXMCAST 250 /* must fit in transmit buffer */ - -struct ie_mcast_cmd { - struct ie_cmd_common com; /* common part */ -#define ie_mcast_status com.ie_cmd_status - - u_short ie_mcast_bytes; /* size (in bytes) of multicast addresses */ - struct ie_en_addr ie_mcast_addrs[MAXMCAST + 1]; /* space for them */ -}; -/* - * Time Domain Reflectometer command. - */ - -struct ie_tdr_cmd { - struct ie_cmd_common com; /* common part */ -#define ie_tdr_status com.ie_cmd_status - - u_short ie_tdr_time; /* error bits and time */ -}; -#define IE_TDR_SUCCESS 0x8000 /* TDR succeeded without error */ -#define IE_TDR_XCVR 0x4000 /* detected a transceiver problem */ -#define IE_TDR_OPEN 0x2000 /* detected an open */ -#define IE_TDR_SHORT 0x1000 /* TDR detected a short */ -#define IE_TDR_TIME 0x07ff /* mask for reflection time */ - -/* - * Initial Address Setup command - */ -struct ie_iasetup_cmd { - struct ie_cmd_common com; -#define ie_iasetup_status com.ie_cmd_status - - struct ie_en_addr ie_address; -}; -/* - * Configuration command - */ -struct ie_config_cmd { - struct ie_cmd_common com; /* common part */ -#define ie_config_status com.ie_cmd_status - - u_char ie_config_count;/* byte count (0x0c) */ - u_char ie_fifo; /* fifo (8) */ - u_char ie_save_bad; /* save bad frames (0x40) */ - u_char ie_addr_len; /* address length (0x2e) (AL-LOC == 1) */ - u_char ie_priority; /* priority and backoff (0x0) */ - u_char ie_ifs; /* inter-frame spacing (0x60) */ - u_char ie_slot_low; /* slot time, LSB (0x0) */ - u_char ie_slot_high; /* slot time, MSN, and retries (0xf2) */ - u_char ie_promisc; /* 1 if promiscuous, else 0 */ - u_char ie_crs_cdt; /* CSMA/CD parameters (0x0) */ - u_char ie_min_len; /* min frame length (0x40) */ - u_char ie_junk; /* stuff for 82596 (0xff) */ -}; - -struct iemem { - volatile struct ie_scp im_scp; - u_char xx1[4]; - volatile struct ie_iscp im_iscp; - - volatile struct ie_scb im_scb; - volatile struct ie_config_cmd im_cc; - volatile struct ie_iasetup_cmd im_ic; - volatile struct ie_recv_frame_desc im_rfd[NRXBUF]; - volatile struct ie_recv_buf_desc im_rbd[NRXBUF]; - volatile struct ie_xmit_cmd im_xc[NTXBUF]; - volatile struct ie_xmit_buf im_xd[NTXBUF]; - volatile u_char im_rxbuf[NRXBUF * IE_RBUF_SIZE]; - volatile u_char im_txbuf[NTXBUF * ETHER_MAX_LEN]; - -}; diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/if_ie.c b/sys/arch/mvme88k/stand/openbsd/netboot/if_ie.c deleted file mode 100644 index 65e143b9339..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/netboot/if_ie.c +++ /dev/null @@ -1,496 +0,0 @@ -/* $Id: if_ie.c,v 1.1 1997/03/03 19:31:09 rahnds Exp $ */ - -/* - * Copyright (c) 1995 Theo de Raadt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Theo de Raadt for Willowglen Singapore. - * 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/param.h> -#include <sys/types.h> - -#include <netinet/in.h> -#include <netinet/in_systm.h> - -#define ETHER_MIN_LEN 64 -#define ETHER_MAX_LEN 1518 - -#define NTXBUF 1 -#define NRXBUF 16 -#define IE_RBUF_SIZE ETHER_MAX_LEN - -#include "stand.h" -#include "netif.h" -#include "config.h" - -#include "i82586.h" -#include "if_iereg.h" - -int ie_debug = 0; - -void ie_stop __P((struct netif *)); -void ie_end __P((struct netif *)); -void ie_error __P((struct netif *, char *, volatile struct iereg *)); -int ie_get __P((struct iodesc *, void *, size_t, time_t)); -void ie_init __P((struct iodesc *, void *)); -int ie_match __P((struct netif *, void *)); -int ie_poll __P((struct iodesc *, void *, int)); -int ie_probe __P((struct netif *, void *)); -int ie_put __P((struct iodesc *, void *, size_t)); -void ie_reset __P((struct netif *, u_char *)); - -struct netif_stats ie_stats; - -struct netif_dif ie0_dif = { - 0, /* unit */ - 1, /* nsel */ - &ie_stats, - 0, - 0, -}; - -struct netif_driver ie_driver = { - "ie", /* netif_bname */ - ie_match, /* match */ - ie_probe, /* probe */ - ie_init, /* init */ - ie_get, /* get */ - ie_put, /* put */ - ie_end, /* end */ - &ie0_dif, /* netif_ifs */ - 1, /* netif_nifs */ -}; - -struct ie_configuration { - u_int phys_addr; - int used; -} ie_config[] = { - { INTEL_REG_ADDR, 0 } -}; - -int nie_config = sizeof(ie_config) / (sizeof(ie_config[0])); - -struct { - struct iereg *sc_reg; /* IE registers */ - struct iemem *sc_mem; /* RAM */ -} ie_softc; - -int -ie_match(nif, machdep_hint) - struct netif *nif; - void *machdep_hint; -{ - char *name; - int i, val = 0; - extern int cputyp; - - if (cputyp == CPU_147) - return (0); - name = machdep_hint; - if (name && !bcmp(ie_driver.netif_bname, name, 2)) - val += 10; - for (i = 0; i < nie_config; i++) { - if (ie_config[i].used) - continue; - if (ie_debug) - printf("ie%d: ie_match --> %d\n", i, val + 1); - ie_config[i].used++; - return (val + 1); - } - if (ie_debug) - printf("ie%d: ie_match --> 0\n", i); - return (0); -} - -int -ie_probe(nif, machdep_hint) - struct netif *nif; - void *machdep_hint; -{ - extern int cputyp; - - /* the set unit is the current unit */ - if (ie_debug) - printf("ie%d: ie_probe called\n", nif->nif_unit); - - if (cputyp != CPU_147) - return (0); - return (1); -} - -void -ie_error(nif, str, ier) - struct netif *nif; - char *str; - volatile struct iereg *ier; -{ - panic("ie%d: unknown error\n", nif->nif_unit); -} - -ieack(ier, iem) - volatile struct iereg *ier; - struct iemem *iem; -{ - /* ack the `interrupt' */ - iem->im_scb.ie_command = iem->im_scb.ie_status & IE_ST_WHENCE; - ier->ie_attention = 1; /* chan attention! */ - while (iem->im_scb.ie_command) - ; -} - -void -ie_reset(nif, myea) - struct netif *nif; - u_char *myea; -{ - volatile struct iereg *ier = ie_softc.sc_reg; - struct iemem *iem = ie_softc.sc_mem; - int timo = 10000, stat, i; - volatile int t; - u_int a; - - if (ie_debug) - printf("ie%d: ie_reset called\n", nif->nif_unit); - - /*printf("ier %x iem %x\n", ier, iem);*/ - - *(u_char *)0xfff4202a = 0x40; - - bzero(iem, sizeof(*iem)); - iem->im_scp.scp_sysbus = 0; - iem->im_scp.scp_iscp_low = (int) &iem->im_iscp & 0xffff; - iem->im_scp.scp_iscp_high = (int) &iem->im_iscp >> 16; - - iem->im_iscp.iscp_scboffset = (int) &iem->im_scb - (int) iem; - iem->im_iscp.iscp_busy = 1; - iem->im_iscp.iscp_base_low = (int) iem & 0xffff; - iem->im_iscp.iscp_base_high = (int) iem >> 16; - - /* - * completely and utterly unlike what i expected, the - * "write" order is: - * 1st: d15-d0 -> high address - * 2nd: d31-d16 -> low address - */ - - /* reset chip */ - a = IE_PORT_RESET; - ier->ie_porthigh = a & 0xffff; - t = 0; - t = 1; - ier->ie_portlow = a >> 16; - for (t = timo; t--;) - ; - - /* set new SCP pointer */ - a = (int) &iem->im_scp | IE_PORT_NEWSCP; - ier->ie_porthigh = a & 0xffff; - t = 0; - t = 1; - ier->ie_portlow = a >> 16; - for (t = timo; t--;) - ; - - ier->ie_attention = 1; /* chan attention! */ - for (t = timo * 10; t--;) - ; - - /* send CONFIGURE command */ - iem->im_scb.ie_command = IE_CU_START; - iem->im_scb.ie_command_list = (int) &iem->im_cc - (int) iem; - iem->im_cc.com.ie_cmd_status = 0; - iem->im_cc.com.ie_cmd_cmd = IE_CMD_CONFIG | IE_CMD_LAST; - iem->im_cc.com.ie_cmd_link = 0xffff; - iem->im_cc.ie_config_count = 0x0c; - iem->im_cc.ie_fifo = 8; - iem->im_cc.ie_save_bad = 0x40; - iem->im_cc.ie_addr_len = 0x2e; - iem->im_cc.ie_priority = 0; - iem->im_cc.ie_ifs = 0x60; - iem->im_cc.ie_slot_low = 0; - iem->im_cc.ie_slot_high = 0xf2; - iem->im_cc.ie_promisc = 0; - iem->im_cc.ie_crs_cdt = 0; - iem->im_cc.ie_min_len = 64; - iem->im_cc.ie_junk = 0xff; - - ier->ie_attention = 1; /* chan attention! */ - for (t = timo * 10; t--;) - ; - - ieack(ier, iem); - - /*printf("ic %x\n", &iem->im_ic);*/ - /* send IASETUP command */ - iem->im_scb.ie_command = IE_CU_START; - iem->im_scb.ie_command_list = (int) &iem->im_ic - (int) iem; - iem->im_ic.com.ie_cmd_status = 0; - iem->im_ic.com.ie_cmd_cmd = IE_CMD_IASETUP | IE_CMD_LAST; - iem->im_ic.com.ie_cmd_link = 0xffff; - bcopy(myea, (void *)&iem->im_ic.ie_address, sizeof iem->im_ic.ie_address); - - ier->ie_attention = 1; /* chan attention! */ - for (t = timo * 10; t--;) - ; - - ieack(ier, iem); - - /* setup buffers */ - - for (i = 0; i < NRXBUF; i++) { - iem->im_rfd[i].ie_fd_next = (int) &iem->im_rfd[(i+1) % NRXBUF] - - (int) iem; - iem->im_rbd[i].ie_rbd_next = (int) &iem->im_rbd[(i+1) % NRXBUF] - - (int) iem; - a = (int) &iem->im_rxbuf[i * IE_RBUF_SIZE]; - iem->im_rbd[i].ie_rbd_buffer_low = a & 0xffff; - iem->im_rbd[i].ie_rbd_buffer_high = a >> 16; - iem->im_rbd[i].ie_rbd_length = IE_RBUF_SIZE; - } - iem->im_rfd[NRXBUF-1].ie_fd_last |= IE_FD_LAST; - iem->im_rbd[NRXBUF-1].ie_rbd_length |= IE_RBD_LAST; - iem->im_rfd[0].ie_fd_buf_desc = (int) &iem->im_rbd[0] - (int) iem; - - /*printf("rfd[0] %x rbd[0] %x buf[0] %x\n", &iem->im_rfd, &iem->im_rbd, - &iem->im_rxbuf);*/ - - /* send receiver start command */ - iem->im_scb.ie_command = IE_RU_START; - iem->im_scb.ie_command_list = 0; - iem->im_scb.ie_recv_list = (int) &iem->im_rfd[0] - (int) iem; - ier->ie_attention = 1; /* chan attention! */ - while (iem->im_scb.ie_command) - ; - - ieack(ier, iem); -} - -int -ie_poll(desc, pkt, len) - struct iodesc *desc; - void *pkt; - int len; -{ - volatile struct iereg *ier = ie_softc.sc_reg; - struct iemem *iem = ie_softc.sc_mem; - u_char *p = pkt; - static int slot; - int length = 0; - u_int a; - u_short status; - - asm(".word 0xf518\n"); - status = iem->im_rfd[slot].ie_fd_status; - if (status & IE_FD_BUSY) - return (0); - - /* printf("slot %d: %x\n", slot, status); */ - if ((status & (IE_FD_COMPLETE | IE_FD_OK)) == (IE_FD_COMPLETE | IE_FD_OK)) { - if (status & IE_FD_OK) { - length = iem->im_rbd[slot].ie_rbd_actual & 0x3fff; - if (length > len) - length = len; - bcopy((void *)&iem->im_rxbuf[slot * IE_RBUF_SIZE], - pkt, length); - - iem->im_rfd[slot].ie_fd_status = 0; - iem->im_rfd[slot].ie_fd_last |= IE_FD_LAST; - iem->im_rfd[(slot+NRXBUF-1)%NRXBUF].ie_fd_last &= - ~IE_FD_LAST; - iem->im_rbd[slot].ie_rbd_actual = 0; - iem->im_rbd[slot].ie_rbd_length |= IE_RBD_LAST; - iem->im_rbd[(slot+NRXBUF-1)%NRXBUF].ie_rbd_length &= - ~IE_RBD_LAST; - /*printf("S%d\n", slot);*/ - - } else { - printf("shit\n"); - } - slot++; - /* should move descriptor onto end of queue... */ - } - if ((iem->im_scb.ie_status & IE_RU_READY) == 0) { - printf("RR\n"); - - for (slot = 0; slot < NRXBUF; slot++) { - iem->im_rbd[slot].ie_rbd_length &= ~IE_RBD_LAST; - iem->im_rfd[slot].ie_fd_last &= ~IE_FD_LAST; - } - iem->im_rbd[NRXBUF-1].ie_rbd_length |= IE_RBD_LAST; - iem->im_rfd[NRXBUF-1].ie_fd_last |= IE_FD_LAST; - - iem->im_rfd[0].ie_fd_buf_desc = (int)&iem->im_rbd[0] - (int)iem; - - iem->im_scb.ie_command = IE_RU_START; - iem->im_scb.ie_command_list = 0; - iem->im_scb.ie_recv_list = (int)&iem->im_rfd[0] - (int)iem; - ier->ie_attention = 1; /* chan attention! */ - while (iem->im_scb.ie_command) - ; - slot = 0; - } - slot = slot % NRXBUF; - return (length); -} - -int -ie_put(desc, pkt, len) - struct iodesc *desc; - void *pkt; - size_t len; -{ - volatile struct iereg *ier = ie_softc.sc_reg; - struct iemem *iem = ie_softc.sc_mem; - u_char *p = pkt; - int timo = 10000, stat, i; - volatile int t; - u_int a; - int xx = 0; - - /* send transmit command */ - - while (iem->im_scb.ie_command) - ; - - /* copy data */ - bcopy(p, (void *)&iem->im_txbuf[xx], len); - - len = MAX(len, ETHER_MIN_LEN); - - /* build transmit descriptor */ - iem->im_xd[xx].ie_xmit_flags = len | IE_XMIT_LAST; - iem->im_xd[xx].ie_xmit_next = 0xffff; - a = (int) &iem->im_txbuf[xx]; - iem->im_xd[xx].ie_xmit_buf_low = a & 0xffff; - iem->im_xd[xx].ie_xmit_buf_high = a >> 16; - - /* transmit command */ - iem->im_xc[xx].com.ie_cmd_status = 0; - iem->im_xc[xx].com.ie_cmd_cmd = IE_CMD_XMIT | IE_CMD_LAST; - iem->im_xc[xx].com.ie_cmd_link = 0xffff; - iem->im_xc[xx].ie_xmit_desc = (int) &iem->im_xd[xx] - (int) iem; - iem->im_xc[xx].ie_xmit_length = len; - bcopy(p, (void *)&iem->im_xc[xx].ie_xmit_addr, - sizeof iem->im_xc[xx].ie_xmit_addr); - - iem->im_scb.ie_command = IE_CU_START; - iem->im_scb.ie_command_list = (int) &iem->im_xc[xx] - (int) iem; - - ier->ie_attention = 1; /* chan attention! */ - - if (ie_debug) { - printf("ie%d: send %d to %x:%x:%x:%x:%x:%x\n", - desc->io_netif->nif_unit, len, - p[0], p[1], p[2], p[3], p[4], p[5]); - } - return (len); -} - -int -ie_get(desc, pkt, len, timeout) - struct iodesc *desc; - void *pkt; - size_t len; - time_t timeout; -{ - time_t t; - int cc; - - t = getsecs(); - cc = 0; - while (((getsecs() - t) < timeout) && !cc) { - cc = ie_poll(desc, pkt, len); - } - return (cc); -} -/* - * init ie device. return 0 on failure, 1 if ok. - */ -void -ie_init(desc, machdep_hint) - struct iodesc *desc; - void *machdep_hint; -{ - struct netif *nif = desc->io_netif; - - if (ie_debug) - printf("ie%d: ie_init called\n", desc->io_netif->nif_unit); - machdep_common_ether(desc->myea); - bzero(&ie_softc, sizeof(ie_softc)); - ie_softc.sc_reg = - (struct iereg *) ie_config[desc->io_netif->nif_unit].phys_addr; - ie_softc.sc_mem = (struct iemem *) 0x1e0000; - ie_reset(desc->io_netif, desc->myea); - printf("device: %s%d attached to %s\n", nif->nif_driver->netif_bname, - nif->nif_unit, ether_sprintf(desc->myea)); -} - -void -ie_stop(nif) - struct netif *nif; -{ - volatile struct iereg *ier = ie_softc.sc_reg; - struct iemem *iem = ie_softc.sc_mem; - int timo = 10000; - volatile int t; - u_int a; - - iem->im_iscp.iscp_busy = 1; - /* reset chip */ - a = IE_PORT_RESET; - ier->ie_porthigh = a & 0xffff; - t = 0; - t = 1; - ier->ie_portlow = a >> 16; - for (t = timo; t--;) - ; - - /* reset chip again */ - a = IE_PORT_RESET; - ier->ie_porthigh = a & 0xffff; - t = 0; - t = 1; - ier->ie_portlow = a >> 16; - for (t = timo; t--;) - ; - - /*printf("status %x busy %x\n", iem->im_scb.ie_status, - iem->im_iscp.iscp_busy);*/ -} - -void -ie_end(nif) - struct netif *nif; -{ - if (ie_debug) - printf("ie%d: ie_end called\n", nif->nif_unit); - - ie_stop(nif); - - /* *(u_char *) 0xfff42002 = 0; */ -} diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/if_iereg.h b/sys/arch/mvme88k/stand/openbsd/netboot/if_iereg.h deleted file mode 100644 index 32aaf377017..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/netboot/if_iereg.h +++ /dev/null @@ -1,163 +0,0 @@ -/* $Id: if_iereg.h,v 1.1 1997/03/03 19:31:09 rahnds Exp $ */ - -/* - * if_sunie.h - * - * sun's ie interface - */ - -/* - * programming notes: - * - * the ie chip operates in a 24 bit address space. - * - * most ie interfaces appear to be divided into two parts: - * - generic 586 stuff - * - board specific - * - * generic: - * the generic stuff of the ie chip is all done with data structures - * that live in the chip's memory address space. the chip expects - * its main data structure (the sys conf ptr -- SCP) to be at a fixed - * address in its 24 bit space: 0xfffff4 - * - * the SCP points to another structure called the ISCP. - * the ISCP points to another structure called the SCB. - * the SCB has a status field, a linked list of "commands", and - * a linked list of "receive buffers". these are data structures that - * live in memory, not registers. - * - * board: - * to get the chip to do anything, you first put a command in the - * command data structure list. then you have to signal "attention" - * to the chip to get it to look at the command. how you - * signal attention depends on what board you have... on PC's - * there is an i/o port number to do this, on sun's there is a - * register bit you toggle. - * - * to get data from the chip you program it to interrupt... - * - * - * sun issues: - * - * there are 3 kinds of sun "ie" interfaces: - * 1 - a VME/multibus card - * 2 - an on-board interface (sun3's, sun-4/100's, and sun-4/200's) - * 3 - another VME board called the 3E - * - * the VME boards lives in vme16 space. only 16 and 8 bit accesses - * are allowed, so functions that copy data must be aware of this. - * - * the chip is an intel chip. this means that the byte order - * on all the "short"s in the chip's data structures is wrong. - * so, constants described in the intel docs are swapped for the sun. - * that means that any buffer pointers you give the chip must be - * swapped to intel format. yuck. - * - * VME/multibus interface: - * for the multibus interface the board ignores the top 4 bits - * of the chip address. the multibus interface seems to have its - * own MMU like page map (without protections or valid bits, etc). - * there are 256 pages of physical memory on the board (each page - * is 1024 bytes). there are 1024 slots in the page map. so, - * a 1024 byte page takes up 10 bits of address for the offset, - * and if there are 1024 slots in the page that is another 10 bits - * of the address. that makes a 20 bit address, and as stated - * earlier the board ignores the top 4 bits, so that accounts - * for all 24 bits of address. - * - * note that the last entry of the page map maps the top of the - * 24 bit address space and that the SCP is supposed to be at - * 0xfffff4 (taking into account allignment). so, - * for multibus, that entry in the page map has to be used for the SCP. - * - * the page map effects BOTH how the ie chip sees the - * memory, and how the host sees it. - * - * the page map is part of the "register" area of the board - * - * on-board interface: - * - * <fill in useful info later> - * - * - * VME3E interface: - * - * <fill in useful info later> - * - */ - -/* - * PART 1: VME/multibus defs - */ -#define IEVME_PAGESIZE 1024 /* bytes */ -#define IEVME_PAGSHIFT 10 /* bits */ -#define IEVME_NPAGES 256 /* number of pages on chip */ -#define IEVME_MAPSZ 1024 /* number of entries in the map */ - -/* - * PTE for the page map - */ -#define IEVME_SBORDR 0x8000 /* sun byte order */ -#define IEVME_IBORDR 0x0000 /* intel byte ordr */ - -#define IEVME_P2MEM 0x2000 /* memory is on P2 */ -#define IEVME_OBMEM 0x0000 /* memory is on board */ - -#define IEVME_PGMASK 0x0fff /* gives the physical page frame number */ - -struct ievme { - u_short pgmap[IEVME_MAPSZ]; - u_short xxx[32]; /* prom */ - u_short status; /* see below for bits */ - u_short xxx2; /* filler */ - u_short pectrl; /* parity control (see below) */ - u_short peaddr; /* low 16 bits of address */ -}; -/* - * status bits - */ -#define IEVME_RESET 0x8000 /* reset board */ -#define IEVME_ONAIR 0x4000 /* go out of loopback 'on-air' */ -#define IEVME_ATTEN 0x2000 /* attention */ -#define IEVME_IENAB 0x1000 /* interrupt enable */ -#define IEVME_PEINT 0x0800 /* parity error interrupt enable */ -#define IEVME_PERR 0x0200 /* parity error flag */ -#define IEVME_INT 0x0100 /* interrupt flag */ -#define IEVME_P2EN 0x0020 /* enable p2 bus */ -#define IEVME_256K 0x0010 /* 256kb rams */ -#define IEVME_HADDR 0x000f /* mask for bits 17-20 of address */ - -/* - * parity control - */ -#define IEVME_PARACK 0x0100 /* parity error ack */ -#define IEVME_PARSRC 0x0080 /* parity error source */ -#define IEVME_PAREND 0x0040 /* which end of the data got the error */ -#define IEVME_PARADR 0x000f /* mask to get bits 17-20 of parity address */ - - -/* - * PART 2: the on-board interface - */ -struct ieob { - u_char obctrl; -}; -#define IEOB_NORSET 0x80 /* don't reset the board */ -#define IEOB_ONAIR 0x40 /* put us on the air */ -#define IEOB_ATTEN 0x20 /* attention! */ -#define IEOB_IENAB 0x10 /* interrupt enable */ -#define IEOB_XXXXX 0x08 /* free bit */ -#define IEOB_XCVRL2 0x04 /* level 2 transceiver? */ -#define IEOB_BUSERR 0x02 /* bus error */ -#define IEOB_INT 0x01 /* interrupt */ - -#define IEOB_ADBASE 0xff000000 /* KVA base addr of 24 bit address space */ - -/* - * PART 3: the 3E board - */ - -/* - * not supported (yet?) - */ diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/if_le.c b/sys/arch/mvme88k/stand/openbsd/netboot/if_le.c deleted file mode 100644 index 40e8074e207..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/netboot/if_le.c +++ /dev/null @@ -1,460 +0,0 @@ -/* $Id: if_le.c,v 1.1 1997/03/03 19:31:09 rahnds Exp $ */ - -/* - * Copyright (c) 1995 Theo de Raadt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Theo de Raadt for Willowglen Singapore. - * 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. - * - * Copyright (c) 1993 Adam Glass - * 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 Adam Glass. - * 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 Adam Glass ``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. - */ - -#include <sys/param.h> -#include <sys/types.h> - -#include <netinet/in.h> -#include <netinet/in_systm.h> - -#include "stand.h" -#include "netif.h" -#include "config.h" - -#include "if_lereg.h" - -int le_debug = 0; - -void le_end __P((struct netif *)); -void le_error __P((struct netif *, char *, volatile struct lereg1 *)); -int le_get __P((struct iodesc *, void *, size_t, time_t)); -void le_init __P((struct iodesc *, void *)); -int le_match __P((struct netif *, void *)); -int le_poll __P((struct iodesc *, void *, int)); -int le_probe __P((struct netif *, void *)); -int le_put __P((struct iodesc *, void *, size_t)); -void le_reset __P((struct netif *, u_char *)); - -struct netif_stats le_stats; - -struct netif_dif le0_dif = { - 0, /* unit */ - 1, /* nsel */ - &le_stats, - 0, - 0, -}; - -struct netif_driver le_driver = { - "le", /* netif_bname */ - le_match, /* match */ - le_probe, /* probe */ - le_init, /* init */ - le_get, /* get */ - le_put, /* put */ - le_end, /* end */ - &le0_dif, /* netif_ifs */ - 1, /* netif_nifs */ -}; - -struct le_configuration { - unsigned int phys_addr; - int used; -} le_config[] = { - { LANCE_REG_ADDR, 0 } -}; - -int nle_config = sizeof(le_config) / (sizeof(le_config[0])); - -struct { - struct lereg1 *sc_r1; /* LANCE registers */ - struct lereg2 *sc_r2; /* RAM */ - int next_rmd; - int next_tmd; -} le_softc; - -int -le_match(nif, machdep_hint) - struct netif *nif; - void *machdep_hint; -{ - char *name; - int i, val = 0; - extern int cputyp; - - if (cputyp != CPU_147) - return (0); - name = machdep_hint; - if (name && !bcmp(le_driver.netif_bname, name, 2)) - val += 10; - for (i = 0; i < nle_config; i++) { - if (le_config[i].used) - continue; - if (le_debug) - printf("le%d: le_match --> %d\n", i, val + 1); - le_config[i].used++; - return val + 1; - } - if (le_debug) - printf("le%d: le_match --> 0\n", i); - return 0; -} - -int -le_probe(nif, machdep_hint) - struct netif *nif; - void *machdep_hint; -{ - extern int cputyp; - - /* the set unit is the current unit */ - if (le_debug) - printf("le%d: le_probe called\n", nif->nif_unit); - - if (cputyp == CPU_147) - return 0; - return 1; -} - -void -le_error(nif, str, ler1) - struct netif *nif; - char *str; - volatile struct lereg1 *ler1; -{ - /* ler1->ler1_rap = LE_CSRO done in caller */ - if (ler1->ler1_rdp & LE_C0_BABL) - panic("le%d: been babbling, found by '%s'\n", nif->nif_unit, str); - if (ler1->ler1_rdp & LE_C0_CERR) { - le_stats.collision_error++; - ler1->ler1_rdp = LE_C0_CERR; - } - if (ler1->ler1_rdp & LE_C0_MISS) { - le_stats.missed++; - ler1->ler1_rdp = LE_C0_MISS; - } - if (ler1->ler1_rdp & LE_C0_MERR) { - printf("le%d: memory error in '%s'\n", nif->nif_unit, str); - panic("memory error"); - } -} - -void -le_reset(nif, myea) - struct netif *nif; - u_char *myea; -{ - struct lereg1 *ler1 = le_softc.sc_r1; - struct lereg2 *ler2 = le_softc.sc_r2; - unsigned int a; - int timo = 100000, stat, i; - - if (le_debug) - printf("le%d: le_reset called\n", nif->nif_unit); - ler1->ler1_rap = LE_CSR0; - ler1->ler1_rdp = LE_C0_STOP; /* do nothing until we are finished */ - - bzero(ler2, sizeof(*ler2)); - - ler2->ler2_mode = LE_MODE_NORMAL; - ler2->ler2_padr[0] = myea[1]; - ler2->ler2_padr[1] = myea[0]; - ler2->ler2_padr[2] = myea[3]; - ler2->ler2_padr[3] = myea[2]; - ler2->ler2_padr[4] = myea[5]; - ler2->ler2_padr[5] = myea[4]; - - - ler2->ler2_ladrf0 = 0; - ler2->ler2_ladrf1 = 0; - - a = (u_int) ler2->ler2_rmd; - ler2->ler2_rlen = LE_RLEN | (a >> 16); - ler2->ler2_rdra = a & LE_ADDR_LOW_MASK; - - a = (u_int) ler2->ler2_tmd; - ler2->ler2_tlen = LE_TLEN | (a >> 16); - ler2->ler2_tdra = a & LE_ADDR_LOW_MASK; - - ler1->ler1_rap = LE_CSR1; - a = (u_int) ler2; - ler1->ler1_rdp = a & LE_ADDR_LOW_MASK; - ler1->ler1_rap = LE_CSR2; - ler1->ler1_rdp = a >> 16; - - for (i = 0; i < LERBUF; i++) { - a = (u_int) & ler2->ler2_rbuf[i]; - ler2->ler2_rmd[i].rmd0 = a & LE_ADDR_LOW_MASK; - ler2->ler2_rmd[i].rmd1_bits = LE_R1_OWN; - ler2->ler2_rmd[i].rmd1_hadr = a >> 16; - ler2->ler2_rmd[i].rmd2 = -LEMTU; - ler2->ler2_rmd[i].rmd3 = 0; - } - for (i = 0; i < LETBUF; i++) { - a = (u_int) & ler2->ler2_tbuf[i]; - ler2->ler2_tmd[i].tmd0 = a & LE_ADDR_LOW_MASK; - ler2->ler2_tmd[i].tmd1_bits = 0; - ler2->ler2_tmd[i].tmd1_hadr = a >> 16; - ler2->ler2_tmd[i].tmd2 = 0; - ler2->ler2_tmd[i].tmd3 = 0; - } - - ler1->ler1_rap = LE_CSR3; - ler1->ler1_rdp = LE_C3_BSWP; - - ler1->ler1_rap = LE_CSR0; - ler1->ler1_rdp = LE_C0_INIT; - do { - if (--timo == 0) { - printf("le%d: init timeout, stat = 0x%x\n", - nif->nif_unit, stat); - break; - } - stat = ler1->ler1_rdp; - } while ((stat & LE_C0_IDON) == 0); - - ler1->ler1_rdp = LE_C0_IDON; - le_softc.next_rmd = 0; - le_softc.next_tmd = 0; - ler1->ler1_rap = LE_CSR0; - ler1->ler1_rdp = LE_C0_STRT; -} - -int -le_poll(desc, pkt, len) - struct iodesc *desc; - void *pkt; - int len; -{ - struct lereg1 *ler1 = le_softc.sc_r1; - struct lereg2 *ler2 = le_softc.sc_r2; - unsigned int a; - int length; - struct lermd *rmd; - - - ler1->ler1_rap = LE_CSR0; - if ((ler1->ler1_rdp & LE_C0_RINT) != 0) - ler1->ler1_rdp = LE_C0_RINT; - rmd = &ler2->ler2_rmd[le_softc.next_rmd]; - if (rmd->rmd1_bits & LE_R1_OWN) { - return (0); - } - if (ler1->ler1_rdp & LE_C0_ERR) - le_error(desc->io_netif, "le_poll", ler1); - if (rmd->rmd1_bits & LE_R1_ERR) { - printf("le%d_poll: rmd status 0x%x\n", desc->io_netif->nif_unit, - rmd->rmd1_bits); - length = 0; - goto cleanup; - } - if ((rmd->rmd1_bits & (LE_R1_STP | LE_R1_ENP)) != (LE_R1_STP | LE_R1_ENP)) - panic("le_poll: chained packet\n"); - - length = rmd->rmd3; - if (length >= LEMTU) { - length = 0; - panic("csr0 when bad things happen: %x\n", ler1->ler1_rdp); - goto cleanup; - } - if (!length) - goto cleanup; - length -= 4; - if (length > 0) { - - /* - * if buffer is smaller than the packet truncate it. - * (is this wise?) - */ - if (length > len) - length = len; - - bcopy((void *)&ler2->ler2_rbuf[le_softc.next_rmd], pkt, length); - } -cleanup: - a = (u_int) & ler2->ler2_rbuf[le_softc.next_rmd]; - rmd->rmd0 = a & LE_ADDR_LOW_MASK; - rmd->rmd1_hadr = a >> 16; - rmd->rmd2 = -LEMTU; - le_softc.next_rmd = - (le_softc.next_rmd == (LERBUF - 1)) ? 0 : (le_softc.next_rmd + 1); - rmd->rmd1_bits = LE_R1_OWN; - return length; -} - -int -le_put(desc, pkt, len) - struct iodesc *desc; - void *pkt; - size_t len; -{ - volatile struct lereg1 *ler1 = le_softc.sc_r1; - volatile struct lereg2 *ler2 = le_softc.sc_r2; - volatile struct letmd *tmd; - int timo = 100000, stat, i; - unsigned int a; - - ler1->ler1_rap = LE_CSR0; - if (ler1->ler1_rdp & LE_C0_ERR) - le_error(desc->io_netif, "le_put(way before xmit)", ler1); - tmd = &ler2->ler2_tmd[le_softc.next_tmd]; - while (tmd->tmd1_bits & LE_T1_OWN) { - printf("le%d: output buffer busy\n", desc->io_netif->nif_unit); - } - bcopy(pkt, (void *)ler2->ler2_tbuf[le_softc.next_tmd], len); - if (len < 64) - tmd->tmd2 = -64; - else - tmd->tmd2 = -len; - tmd->tmd3 = 0; - if (ler1->ler1_rdp & LE_C0_ERR) - le_error(desc->io_netif, "le_put(before xmit)", ler1); - tmd->tmd1_bits = LE_T1_STP | LE_T1_ENP | LE_T1_OWN; - a = (u_int) & ler2->ler2_tbuf[le_softc.next_tmd]; - tmd->tmd0 = a & LE_ADDR_LOW_MASK; - tmd->tmd1_hadr = a >> 16; - ler1->ler1_rdp = LE_C0_TDMD; - if (ler1->ler1_rdp & LE_C0_ERR) - le_error(desc->io_netif, "le_put(after xmit)", ler1); - do { - if (--timo == 0) { - printf("le%d: transmit timeout, stat = 0x%x\n", - desc->io_netif->nif_unit, stat); - if (ler1->ler1_rdp & LE_C0_ERR) - le_error(desc->io_netif, "le_put(timeout)", ler1); - break; - } - stat = ler1->ler1_rdp; - } while ((stat & LE_C0_TINT) == 0); - ler1->ler1_rdp = LE_C0_TINT; - if (ler1->ler1_rdp & LE_C0_ERR) { - if ((ler1->ler1_rdp & (LE_C0_BABL | LE_C0_CERR | LE_C0_MISS | - LE_C0_MERR)) != - LE_C0_CERR) - printf("le_put: xmit error, buf %d\n", le_softc.next_tmd); - le_error(desc->io_netif, "le_put(xmit error)", ler1); - } - le_softc.next_tmd = 0; -/* (le_softc.next_tmd == (LETBUF - 1)) ? 0 : le_softc.next_tmd + 1;*/ - if (tmd->tmd1_bits & LE_T1_DEF) - le_stats.deferred++; - if (tmd->tmd1_bits & LE_T1_ONE) - le_stats.collisions++; - if (tmd->tmd1_bits & LE_T1_MORE) - le_stats.collisions += 2; - if (tmd->tmd1_bits & LE_T1_ERR) { - printf("le%d: transmit error, error = 0x%x\n", desc->io_netif->nif_unit, - tmd->tmd3); - return -1; - } - if (le_debug) { - printf("le%d: le_put() successful: sent %d\n", - desc->io_netif->nif_unit, len); - printf("le%d: le_put(): tmd1_bits: %x tmd3: %x\n", - desc->io_netif->nif_unit, - (unsigned int) tmd->tmd1_bits, - (unsigned int) tmd->tmd3); - } - return len; -} - -int -le_get(desc, pkt, len, timeout) - struct iodesc *desc; - void *pkt; - size_t len; - time_t timeout; -{ - time_t t; - int cc; - - t = getsecs(); - cc = 0; - while (((getsecs() - t) < timeout) && !cc) { - cc = le_poll(desc, pkt, len); - } - return cc; -} -/* - * init le device. return 0 on failure, 1 if ok. - */ -void -le_init(desc, machdep_hint) - struct iodesc *desc; - void *machdep_hint; -{ - u_long eram = 4*1024*1024; - struct netif *nif = desc->io_netif; - - if (le_debug) - printf("le%d: le_init called\n", desc->io_netif->nif_unit); - machdep_common_ether(desc->myea); - bzero(&le_softc, sizeof(le_softc)); - le_softc.sc_r1 = - (struct lereg1 *) le_config[desc->io_netif->nif_unit].phys_addr; - le_softc.sc_r2 = (struct lereg2 *) (eram - (1024 * 1024)); - le_reset(desc->io_netif, desc->myea); - printf("device: %s%d attached to %s\n", nif->nif_driver->netif_bname, - nif->nif_unit, ether_sprintf(desc->myea)); -} - -void -le_end(nif) - struct netif *nif; -{ - struct lereg1 *ler1 = le_softc.sc_r1; - - if (le_debug) - printf("le%d: le_end called\n", nif->nif_unit); - ler1->ler1_rap = LE_CSR0; - ler1->ler1_rdp = LE_C0_STOP; -} diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/if_lereg.h b/sys/arch/mvme88k/stand/openbsd/netboot/if_lereg.h deleted file mode 100644 index e55fc19642e..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/netboot/if_lereg.h +++ /dev/null @@ -1,173 +0,0 @@ -/* $Id: if_lereg.h,v 1.1 1997/03/03 19:31:09 rahnds Exp $ */ - -/*- - * Copyright (c) 1982, 1992, 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. - * - * @(#)if_lereg.h 8.2 (Berkeley) 10/30/93 - */ - -#define LEMTU 1518 -#define LEMINSIZE 60 /* should be 64 if mode DTCR is set */ -#define LERBUF 8 -#define LERBUFLOG2 3 -#define LE_RLEN (LERBUFLOG2 << 13) -#define LETBUF 1 -#define LETBUFLOG2 0 -#define LE_TLEN (LETBUFLOG2 << 13) - -/* Local Area Network Controller for Ethernet (LANCE) registers */ -struct lereg1 { - volatile u_short ler1_rdp; /* register data port */ - volatile u_short ler1_rap; /* register address port */ -}; -/* register addresses */ -#define LE_CSR0 0 /* Control and status register */ -#define LE_CSR1 1 /* low address of init block */ -#define LE_CSR2 2 /* high address of init block */ -#define LE_CSR3 3 /* Bus master and control */ - -/* Control and status register 0 (csr0) */ -#define LE_C0_ERR 0x8000 /* error summary */ -#define LE_C0_BABL 0x4000 /* transmitter timeout error */ -#define LE_C0_CERR 0x2000 /* collision */ -#define LE_C0_MISS 0x1000 /* missed a packet */ -#define LE_C0_MERR 0x0800 /* memory error */ -#define LE_C0_RINT 0x0400 /* receiver interrupt */ -#define LE_C0_TINT 0x0200 /* transmitter interrupt */ -#define LE_C0_IDON 0x0100 /* initalization done */ -#define LE_C0_INTR 0x0080 /* interrupt condition */ -#define LE_C0_INEA 0x0040 /* interrupt enable */ -#define LE_C0_RXON 0x0020 /* receiver on */ -#define LE_C0_TXON 0x0010 /* transmitter on */ -#define LE_C0_TDMD 0x0008 /* transmit demand */ -#define LE_C0_STOP 0x0004 /* disable all external activity */ -#define LE_C0_STRT 0x0002 /* enable external activity */ -#define LE_C0_INIT 0x0001 /* begin initalization */ - -#define LE_C0_BITS \ - "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\ -\12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT" - -/* Control and status register 3 (csr3) */ -#define LE_C3_BSWP 0x4 /* byte swap */ -#define LE_C3_ACON 0x2 /* ALE control, eh? */ -#define LE_C3_BCON 0x1 /* byte control */ -/* - * Current size is 13,758 bytes with 8 x 1518 receive buffers and - * 1 x 1518 transmit buffer. - */ -struct lereg2 { - /* initialization block */ - volatile u_short ler2_mode; /* mode */ - volatile u_char ler2_padr[6]; /* physical address */ -#ifdef new_code - volatile u_short ler2_ladrf[4]; /* logical address filter */ -#else - volatile u_long ler2_ladrf0; /* logical address filter */ - volatile u_long ler2_ladrf1; /* logical address filter */ -#endif - volatile u_short ler2_rdra; /* receive descriptor addr */ - volatile u_short ler2_rlen; /* rda high and ring size */ - volatile u_short ler2_tdra; /* transmit descriptor addr */ - volatile u_short ler2_tlen; /* tda high and ring size */ - /* receive message descriptors. bits/hadr are byte order dependent. */ - struct lermd { - volatile u_short rmd0; /* low address of packet */ - volatile u_char rmd1_bits; /* descriptor bits */ - volatile u_char rmd1_hadr; /* high address of packet */ - volatile short rmd2; /* buffer byte count */ - volatile u_short rmd3; /* message byte count */ - } ler2_rmd[LERBUF]; - /* transmit message descriptors */ - struct letmd { - volatile u_short tmd0; /* low address of packet */ - volatile u_char tmd1_bits; /* descriptor bits */ - volatile u_char tmd1_hadr; /* high address of packet */ - volatile short tmd2; /* buffer byte count */ - volatile u_short tmd3; /* transmit error bits */ - } ler2_tmd[LETBUF]; - volatile char ler2_rbuf[LERBUF][LEMTU]; - volatile char ler2_tbuf[LETBUF][LEMTU]; -}; -/* Initialzation block (mode) */ -#define LE_MODE_PROM 0x8000 /* promiscuous mode */ -/* 0x7f80 reserved, must be zero */ -#define LE_MODE_INTL 0x0040 /* internal loopback */ -#define LE_MODE_DRTY 0x0020 /* disable retry */ -#define LE_MODE_COLL 0x0010 /* force a collision */ -#define LE_MODE_DTCR 0x0008 /* disable transmit CRC */ -#define LE_MODE_LOOP 0x0004 /* loopback mode */ -#define LE_MODE_DTX 0x0002 /* disable transmitter */ -#define LE_MODE_DRX 0x0001 /* disable receiver */ -#define LE_MODE_NORMAL 0 /* none of the above */ - - -/* Receive message descriptor 1 (rmd1_bits) */ -#define LE_R1_OWN 0x80 /* LANCE owns the packet */ -#define LE_R1_ERR 0x40 /* error summary */ -#define LE_R1_FRAM 0x20 /* framing error */ -#define LE_R1_OFLO 0x10 /* overflow error */ -#define LE_R1_CRC 0x08 /* CRC error */ -#define LE_R1_BUFF 0x04 /* buffer error */ -#define LE_R1_STP 0x02 /* start of packet */ -#define LE_R1_ENP 0x01 /* end of packet */ - -#define LE_R1_BITS \ - "\20\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP" - -/* Transmit message descriptor 1 (tmd1_bits) */ -#define LE_T1_OWN 0x80 /* LANCE owns the packet */ -#define LE_T1_ERR 0x40 /* error summary */ -#define LE_T1_MORE 0x10 /* multiple collisions */ -#define LE_T1_ONE 0x08 /* single collision */ -#define LE_T1_DEF 0x04 /* defferred transmit */ -#define LE_T1_STP 0x02 /* start of packet */ -#define LE_T1_ENP 0x01 /* end of packet */ - -#define LE_T1_BITS \ - "\20\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP" - -/* Transmit message descriptor 3 (tmd3) */ -#define LE_T3_BUFF 0x8000 /* buffer error */ -#define LE_T3_UFLO 0x4000 /* underflow error */ -#define LE_T3_LCOL 0x1000 /* late collision */ -#define LE_T3_LCAR 0x0800 /* loss of carrier */ -#define LE_T3_RTRY 0x0400 /* retry error */ -#define LE_T3_TDR_MASK 0x03ff /* time domain reflectometry counter */ - -#define LE_XMD2_ONES 0xf000 - -#define LE_T3_BITS \ - "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY" - - -#define LE_ADDR_LOW_MASK (0xffff) diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/version.c b/sys/arch/mvme88k/stand/openbsd/netboot/version.c deleted file mode 100644 index 8f6fe5e8338..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/netboot/version.c +++ /dev/null @@ -1,9 +0,0 @@ -/* $Id: version.c,v 1.1 1997/03/03 19:31:09 rahnds Exp $ */ - -/* - * NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. - * - * 1.1 - */ - -char *version = "$Revision: 1.1 $"; diff --git a/sys/arch/mvme88k/stand/openbsd/prtvid/Makefile b/sys/arch/mvme88k/stand/openbsd/prtvid/Makefile deleted file mode 100644 index f6a6d3e1e1a..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/prtvid/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -PROG= prtvid -NOMAN= - -install: - -.include <bsd.prog.mk> diff --git a/sys/arch/mvme88k/stand/openbsd/prtvid/prtvid.c b/sys/arch/mvme88k/stand/openbsd/prtvid/prtvid.c deleted file mode 100644 index 32784ff0dfa..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/prtvid/prtvid.c +++ /dev/null @@ -1,132 +0,0 @@ -#include <stdio.h> -#define __DBINTERFACE_PRIVATE -#include <db.h> -#include "vid.h" - -main(argc, argv) - int argc; - char *argv[]; -{ - struct vid *pvid; - struct cfg *pcfg; - - pvid = (struct vid *) malloc(sizeof (struct vid)); - - fread(pvid, sizeof(struct vid), 1, stdin); - - if (BYTE_ORDER != BIG_ENDIAN) - swabvid(pvid); - - printf("vid_id %s %x\n", pvid->vid_id, - (char *)&(pvid->vid_id[4]) - (char *)pvid); - printf("vid_oss %x %x\n", pvid->vid_oss, - (char *)&(pvid->vid_oss) - (char *)pvid); - printf("vid_osl %x %x\n", pvid->vid_osl, - (char *)&(pvid->vid_osl) - (char *)pvid); - printf("vid_osa_u %x %x\n", pvid->vid_osa_u, - (char *)&(pvid->vid_osa_u) - (char *)pvid); - printf("vid_osa_l %x %x\n", pvid->vid_osa_l, - (char *)&(pvid->vid_osa_l) - (char *)pvid); - printf("vid_vd %x\n", - (char *)&(pvid->vid_vd) - (char *)pvid); - printf("vid_cas %x %x\n", pvid->vid_cas, - (char *)&(pvid->vid_cas) - (char *)pvid); - printf("vid_cal %x %x\n", pvid->vid_cal, - (char *)&(pvid->vid_cal) - (char *)pvid); - printf("vid_moto %s %x\n", pvid->vid_mot, - (char *)&(pvid->vid_mot[0]) - (char *)pvid); - - free(pvid); - - pcfg = (struct cfg *) malloc(sizeof(struct cfg)); - - fread(pcfg, sizeof(struct cfg), 1, stdin); - - if (BYTE_ORDER != BIG_ENDIAN) - swabcfg(pcfg); - - printf("cfg_atm %x %x\n", pcfg->cfg_atm, - (char *)&(pcfg->cfg_atm) - (char *)(pcfg)); - printf("cfg_prm %x %x\n", pcfg->cfg_prm, - (char *)&(pcfg->cfg_prm) - (char *)(pcfg)); - printf("cfg_atw %x %x\n", pcfg->cfg_atw, - (char *)&(pcfg->cfg_atw) - (char *)(pcfg)); - printf("cfg_rec %x %x\n",(long)pcfg->cfg_rec, - (char *)&(pcfg->cfg_rec) - (char *)(pcfg)); - printf("cfg_spt %x %x\n", pcfg->cfg_spt, - (char *)&(pcfg->cfg_spt) - (char *)(pcfg)); - printf("cfg_hds %x %x\n", pcfg->cfg_hds, - (char *)&(pcfg->cfg_hds) - (char *)(pcfg)); - printf("cfg_trk %x %x\n", pcfg->cfg_trk, - (char *)&(pcfg->cfg_trk) - (char *)(pcfg)); - printf("cfg_ilv %x %x\n", pcfg->cfg_ilv, - (char *)&(pcfg->cfg_ilv) - (char *)(pcfg)); - printf("cfg_sof %x %x\n", pcfg->cfg_sof, - (char *)&(pcfg->cfg_sof) - (char *)(pcfg)); - printf("cfg_psm %x %x\n", pcfg->cfg_psm, - (char *)&(pcfg->cfg_psm) - (char *)(pcfg)); - printf("cfg_shd %x %x\n", pcfg->cfg_shd, - (char *)&(pcfg->cfg_shd) - (char *)(pcfg)); - printf("cfg_pcom %x %x\n", pcfg->cfg_pcom, - (char *)&(pcfg->cfg_pcom) - (char *)(pcfg)); - printf("cfg_ssr %x %x\n", pcfg->cfg_ssr, - (char *)&(pcfg->cfg_ssr) - (char *)(pcfg)); - printf("cfg_rwcc %x %x\n", pcfg->cfg_rwcc, - (char *)&(pcfg->cfg_rwcc) - (char *)(pcfg)); - printf("cfg_ecc %x %x\n", pcfg->cfg_ecc, - (char *)&(pcfg->cfg_ecc) - (char *)(pcfg)); - printf("cfg_eatm %x %x\n", pcfg->cfg_eatm, - (char *)&(pcfg->cfg_eatm) - (char *)(pcfg)); - printf("cfg_eprm %x %x\n", pcfg->cfg_eprm, - (char *)&(pcfg->cfg_eprm) - (char *)(pcfg)); - printf("cfg_eatw %x %x\n", pcfg->cfg_eatw, - (char *)&(pcfg->cfg_eatw) - (char *)(pcfg)); - printf("cfg_gpb1 %x %x\n", pcfg->cfg_gpb1, - (char *)&(pcfg->cfg_gpb1) - (char *)(pcfg)); - printf("cfg_gpb2 %x %x\n", pcfg->cfg_gpb2, - (char *)&(pcfg->cfg_gpb2) - (char *)(pcfg)); - printf("cfg_gpb3 %x %x\n", pcfg->cfg_gpb3, - (char *)&(pcfg->cfg_gpb3) - (char *)(pcfg)); - printf("cfg_gpb4 %x %x\n", pcfg->cfg_gpb4, - (char *)&(pcfg->cfg_gpb4) - (char *)(pcfg)); - printf("cfg_ssc %x %x\n", pcfg->cfg_ssc, - (char *)&(pcfg->cfg_ssc) - (char *)(pcfg)); - printf("cfg_runit %x %x\n", pcfg->cfg_runit, - (char *)&(pcfg->cfg_runit) - (char *)(pcfg)); - printf("cfg_rsvc1 %x %x\n", pcfg->cfg_rsvc1, - (char *)&(pcfg->cfg_rsvc1) - (char *)(pcfg)); - printf("cfg_rsvc2 %x %x\n", pcfg->cfg_rsvc2, - (char *)&(pcfg->cfg_rsvc2) - (char *)(pcfg)); -} - -swabvid(pvid) - struct vid *pvid; -{ - M_32_SWAP(pvid->vid_oss); - M_16_SWAP(pvid->vid_osl); - M_16_SWAP(pvid->vid_osa_u); - M_16_SWAP(pvid->vid_osa_l); - M_32_SWAP(pvid->vid_cas); -} - -swabcfg(pcfg) - struct cfg *pcfg; -{ - printf("swapping cfg\n"); - - M_16_SWAP(pcfg->cfg_atm); - M_16_SWAP(pcfg->cfg_prm); - M_16_SWAP(pcfg->cfg_atm); - M_16_SWAP(pcfg->cfg_rec); - M_16_SWAP(pcfg->cfg_trk); - M_16_SWAP(pcfg->cfg_psm); - M_16_SWAP(pcfg->cfg_shd); - M_16_SWAP(pcfg->cfg_pcom); - M_16_SWAP(pcfg->cfg_rwcc); - M_16_SWAP(pcfg->cfg_ecc); - M_16_SWAP(pcfg->cfg_eatm); - M_16_SWAP(pcfg->cfg_eprm); - M_16_SWAP(pcfg->cfg_eatw); - M_16_SWAP(pcfg->cfg_rsvc1); - M_16_SWAP(pcfg->cfg_rsvc2); -} diff --git a/sys/arch/mvme88k/stand/openbsd/sboot/Makefile b/sys/arch/mvme88k/stand/openbsd/sboot/Makefile deleted file mode 100644 index 076deb2e306..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/sboot/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# $Id: Makefile,v 1.2 1997/04/27 20:56:34 millert Exp $ - -S= ${.CURDIR}/../../../.. -INCL?= -I${.CURDIR} -I${.CURDIR}/../libsa -I${S}/lib/libsa -I${S} -COPTS?= ${DEFS} ${INCL} - -.include "${S}/arch/${MACHINE}/stand/libsa/Makefile.inc" - -SRCS= sboot.c clock.c etherfun.c if_le.c - -OBJS= ${SRCS:S/.c/.o/g} -CLEANFILES+=XBUG.o XSRT0.o oc_cksum.o sboot.tmp rboot.tmp srec sboot rboot -MDEC_DIR?=/usr/mdec - -all: sboot rboot - -sboot.tmp: XSRT0.o oc_cksum.o ${OBJS} ${LIBSA} - ld -N -s -static -T 0x4000 XSRT0.o ${OBJS} oc_cksum.o -o sboot.tmp ${LIBSA} - -rboot.tmp: XBUG.o XSRT0.o oc_cksum.o ${OBJS} ${LIBSA} - ld -N -s -static -Ttext 0xffa00000 -Tdata 0x4000 XBUG.o XSRT0.o \ - ${OBJS} oc_cksum.o -o rboot.tmp ${LIBSA} - -srec: srec.c - ${CC} ${.CURDIR}/srec.c -o srec - -sboot: sboot.tmp srec - dd ibs=32 skip=1 if=sboot.tmp | ${.OBJDIR}/srec 4 0x4000 sboot > sboot - -rboot: rboot.tmp srec - dd ibs=32 skip=1 if=rboot.tmp | ${.OBJDIR}/srec 4 0x4000 rboot > rboot - -install: - ${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - sboot ${DESTDIR}${MDEC_DIR}/sboot - ${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - rboot ${DESTDIR}${MDEC_DIR}/rboot - -.include <bsd.prog.mk> diff --git a/sys/arch/mvme88k/stand/openbsd/sboot/XBUG.S b/sys/arch/mvme88k/stand/openbsd/sboot/XBUG.S deleted file mode 100644 index 288f1427b21..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/sboot/XBUG.S +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 1995 Theo de Raadt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Theo de Raadt for Willowglen Singapore. - * 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. - */ - -/* - * Theo sez: I wrote a bootrom for the MVME147 *years* ago. To write - * this ROM I copied a few chunks from the old bootrom, like this piece: - * - * "watch this, the moto bastard struck here, shouldn't have hired people - * from intel I tried to tell them... - * "BOOT" - * offset from baseaddr to entry point. - * offset from baseaddr to first word after checksum - * garbage - * checksum made with CS command - * No need to change any of this unless you try to take our names out - * of there. Ie. don't touch." - */ - - .text -bootlabel: .ascii "BOOT" - .long bootstart-0xffa00000 | for rom install - .long bootlabelend - bootlabel - .asciz "VME147 rboot Copyright (c) 1995 Theo de Raadt" - .align 2 -bootstart: jmp bssclr - .word 0x229c | XXX bitching cksum! -bootlabelend: - .word 0 - - | clear bss and the kernel location -bssclr: movl #_edata,a0 - movl #_end - _edata,d0 -1: clrb a0@+ - subql #1,d0 - bpl 1b - - | rip the data segment from ROM into ram.. - movl #_etext,a2 | start of data - movl #0x4000,a1 | shovel address - movl #_edata - _etext,d0 -1: movb a2@+,a1@+ - subql #1,d0 - bpl 1b - - bra start diff --git a/sys/arch/mvme88k/stand/openbsd/sboot/XSRT0.S b/sys/arch/mvme88k/stand/openbsd/sboot/XSRT0.S deleted file mode 100644 index 805528203f2..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/sboot/XSRT0.S +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 1995 Theo de Raadt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Theo de Raadt for Willowglen Singapore. - * 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. - * - * Copyright (c) 1995 Charles D. Cranor - * 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 Charles D. Cranor. - * 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. - */ - - | start at 0x4000, load at 0xa000, stack at 0x9ff0. - .text - .globl start -start: movb #0,_reboot - jra Ldoit -restart: movb #1,_reboot | fall through - -Ldoit: movl #0x00006ff0,sp - jsr _main - - .globl ___main -___main: rts diff --git a/sys/arch/mvme88k/stand/openbsd/sboot/clock.c b/sys/arch/mvme88k/stand/openbsd/sboot/clock.c deleted file mode 100644 index ca2467abb9e..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/sboot/clock.c +++ /dev/null @@ -1,122 +0,0 @@ -/* $Id: clock.c,v 1.1 1997/03/03 19:31:11 rahnds Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * Copyright (c) 1994 Gordon W. Ross - * Copyright (c) 1993 Adam Glass - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * 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, Lawrence Berkeley Laboratory. - * - * 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. - * - * @(#)clock.c 8.1 (Berkeley) 6/11/93 - */ - -/* - * Clock driver. - */ - -#include <sys/cdefs.h> -#include "sboot.h" -#include "clockreg.h" - -static struct clockreg *clockreg = (struct clockreg *) CLOCK_ADDR; - -/* - * BCD to decimal and decimal to BCD. - */ -#define FROMBCD(x) (((x) >> 4) * 10 + ((x) & 0xf)) -#define TOBCD(x) (((x) / 10 * 16) + ((x) % 10)) - -#define SECDAY (24 * 60 * 60) -#define SECYR (SECDAY * 365) -#define LEAPYEAR(y) (((y) & 3) == 0) - -/* - * This code is defunct after 2068. - * Will Unix still be here then?? - */ -const short dayyr[12] = - {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; - -static u_long -chiptotime(sec, min, hour, day, mon, year) - register int sec, min, hour, day, mon, year; -{ - register int days, yr; - - sec = FROMBCD(sec); - min = FROMBCD(min); - hour = FROMBCD(hour); - day = FROMBCD(day); - mon = FROMBCD(mon); - year = FROMBCD(year) + YEAR0; - if (year < 70) - year = 70; - - /* simple sanity checks */ - if (year < 70 || mon < 1 || mon > 12 || day < 1 || day > 31) - return (0); - days = 0; - for (yr = 70; yr < year; yr++) - days += LEAPYEAR(yr) ? 366 : 365; - days += dayyr[mon - 1] + day - 1; - if (LEAPYEAR(yr) && mon > 2) - days++; - /* now have days since Jan 1, 1970; the rest is easy... */ - return (days * SECDAY + hour * 3600 + min * 60 + sec); -} - -/* - * Set up the system's time, given a `reasonable' time value. - */ -u_long -time() -{ - register struct clockreg *cl = clockreg; - int sec, min, hour, day, mon, year; - - cl->cl_csr |= CLK_READ; /* enable read (stop time) */ - sec = cl->cl_sec; - min = cl->cl_min; - hour = cl->cl_hour; - day = cl->cl_mday; - mon = cl->cl_month; - year = cl->cl_year; - cl->cl_csr &= ~CLK_READ;/* time wears on */ - return (chiptotime(sec, min, hour, day, mon, year)); -} diff --git a/sys/arch/mvme88k/stand/openbsd/sboot/clockreg.h b/sys/arch/mvme88k/stand/openbsd/sboot/clockreg.h deleted file mode 100644 index 7fba3d3a9aa..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/sboot/clockreg.h +++ /dev/null @@ -1,69 +0,0 @@ -/* $Id: clockreg.h,v 1.1 1997/03/03 19:31:11 rahnds Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * 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, Lawrence Berkeley Laboratory. - * - * 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. - * - * @(#)clockreg.h 8.1 (Berkeley) 6/11/93 - */ - -/* - * Mostek MK48T02 clock. - */ -struct clockreg { - volatile u_char cl_csr; /* control register */ - volatile u_char cl_sec; /* seconds (0..59; BCD) */ - volatile u_char cl_min; /* minutes (0..59; BCD) */ - volatile u_char cl_hour; /* hour (0..23; BCD) */ - volatile u_char cl_wday; /* weekday (1..7) */ - volatile u_char cl_mday; /* day in month (1..31; BCD) */ - volatile u_char cl_month; /* month (1..12; BCD) */ - volatile u_char cl_year; /* year (0..99; BCD) */ -}; - -/* bits in cl_csr */ -#define CLK_WRITE 0x80 /* want to write */ -#define CLK_READ 0x40 /* want to read (freeze clock) */ - -/* - * Sun chose the year `68' as their base count, so that - * cl_year==0 means 1968. - */ -#define YEAR0 68 diff --git a/sys/arch/mvme88k/stand/openbsd/sboot/etherfun.c b/sys/arch/mvme88k/stand/openbsd/sboot/etherfun.c deleted file mode 100644 index 01987b15f4c..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/sboot/etherfun.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * - * Copyright (c) 1995 Charles D. Cranor and Seth Widoff - * 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 Charles D. Cranor - * and Seth Widoff. - * 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. - */ -/* etherfun.c */ - -#include <sys/cdefs.h> -#include "sboot.h" -#include "etherfun.h" - -/* Construct and send a rev arp packet */ -void -do_rev_arp() -{ - int i; - - for (i = 0; i < 6; i++) - eh->ether_dhost[i] = 0xff; - - bcopy(myea, eh->ether_shost, 6); - eh->ether_type = ETYPE_RARP; - - rarp->ar_hrd = 1; /* hardware type is 1 */ - rarp->ar_pro = PTYPE_IP; - rarp->ar_hln = 6; /* length of hardware address is 6 bytes */ - rarp->ar_pln = 4; /* length of ip address is 4 byte */ - rarp->ar_op = OPCODE_RARP; - bcopy(myea, rarp->arp_sha, sizeof(myea)); - bcopy(myea, rarp->arp_tha, sizeof(myea)); - for (i = 0; i < 4; i++) - rarp->arp_spa[i] = rarp->arp_tpa[i] = 0x00; - - le_put(buf, 76); -} - -/* Receive and disassemble the rev_arp reply */ -int -get_rev_arp() -{ - le_get(buf, sizeof(buf), 6); - if (eh->ether_type == ETYPE_RARP && rarp->ar_op == OPCODE_REPLY) { - bcopy(rarp->arp_tpa, myip, sizeof(rarp->arp_tpa)); - bcopy(rarp->arp_spa, servip, sizeof(rarp->arp_spa)); - bcopy(rarp->arp_sha, servea, sizeof(rarp->arp_sha)); - return (1); - } - return (0); -} - -/* Try to get a reply to a rev arp request */ -int -rev_arp() -{ - int tries = 0; - while (tries < 5) { - do_rev_arp(); - if (get_rev_arp()) - return (1); - tries++; - } - return (0); -} - -/* - * Send a tftp read request or acknowledgement - * mesgtype 0 is a read request, 1 is an - * acknowledgement - */ -void -do_send_tftp(mesgtype) - int mesgtype; -{ - u_long res, iptmp, lcv; - char *tot; - - if (mesgtype == 0) { - tot = tftp_r + (sizeof(MSG) - 1); - myport = (u_short) time(); - if (myport < 1000) - myport += 1000; - servport = FTP_PORT; /* to start */ - } else { - tot = (char *) tftp_a + 4; - } - - bcopy(servea, eh->ether_dhost, sizeof(servea)); - bcopy(myea, eh->ether_shost, sizeof(myea)); - eh->ether_type = ETYPE_IP; - - iph->ip_v = IP_VERSION; - iph->ip_hl = IP_HLEN; - iph->ip_tos = 0; /* type of service is 0 */ - iph->ip_id = 0; /* id field is 0 */ - iph->ip_off = IP_DF; - iph->ip_ttl = 3; /* time to live is 3 seconds/hops */ - iph->ip_p = IPP_UDP; - bcopy(myip, iph->ip_src, sizeof(myip)); - bcopy(servip, iph->ip_dst, sizeof(servip)); - iph->ip_sum = 0; - iph->ip_len = tot - (char *) iph; - res = oc_cksum(iph, sizeof(struct ip), 0); - iph->ip_sum = 0xffff & ~res; - udph->uh_sport = myport; - udph->uh_dport = servport; - udph->uh_sum = 0; - - if (mesgtype) { - tftp_a->op_code = FTPOP_ACKN; - tftp_a->block = (u_short) (mesgtype); - } else { - bcopy(myip, &iptmp, sizeof(iptmp)); - bcopy(MSG, tftp_r, (sizeof(MSG) - 1)); - for (lcv = 9; lcv >= 2; lcv--) { - tftp_r[lcv] = "0123456789ABCDEF"[iptmp & 0xF]; - - iptmp = iptmp >> 4; - } - } - - udph->uh_ulen = tot - (char *) udph; - - le_put(buf, tot - buf); -} - -/* Attempt to tftp a file and read it into memory */ -int -do_get_file() -{ - int fail = 0, oldlen; - char *loadat = (char *) LOAD_ADDR; - last_ack = 0; - - do_send_tftp(READ); - while (1) { - if (le_get(buf, sizeof(buf), 5) == 0) { - /* timeout occured */ - if (last_ack) - do_send_tftp(last_ack); - else - do_send_tftp(READ); - - fail++; - if (fail > 5) { - printf("\n"); - return (1); - } - } else { - printf("%x \r", tftp->info.block * 512); - if ((eh->ether_type != ETYPE_IP) || (iph->ip_p != IPP_UDP)) { - fail++; - continue; - } - if (servport == FTP_PORT) - servport = udph->uh_sport; - if (tftp->info.op_code == FTPOP_ERR) { - printf("TFTP: Download error %d: %s\n", - tftp->info.block, tftp->data); - return (1); - } - if (tftp->info.block != last_ack + 1) { - /* we received the wrong block */ - if (tftp->info.block < last_ack + 1) { - /* nack whatever we received */ - do_send_tftp(tftp->info.block); - } else { - /* nack the last confirmed block */ - do_send_tftp(last_ack); - } - fail++; - } else {/* we got the right block */ - fail = 0; - last_ack++; - oldlen = udph->uh_ulen; - do_send_tftp(last_ack); - /* printf("bcopy %x %x %d\n", &tftp->data, - * loadat, oldlen - 12); */ - bcopy(&tftp->data, loadat, oldlen - 12); - loadat += oldlen - 12; - if (oldlen < (8 + 4 + 512)) { - printf("\n"); - return (0); - } - } - } - } - printf("\n"); - return (0); -} diff --git a/sys/arch/mvme88k/stand/openbsd/sboot/etherfun.h b/sys/arch/mvme88k/stand/openbsd/sboot/etherfun.h deleted file mode 100644 index 64170e05fd9..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/sboot/etherfun.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * - * Copyright (c) 1995 Charles D. Cranor and Seth Widoff - * 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 Charles D. Cranor - * and Seth Widoff. - * 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. - */ -/* etherfun.h */ - -/* constants */ -/* ether header */ -#define ETYPE_RARP 0x8035 /* ethertype is RARP */ -#define ETYPE_IP 0x800 /* ethertype is IP */ - -/* rev arp */ -#define PTYPE_IP 0x800 /* Protocol type is IP */ -#define OPCODE_RARP 3 /* Optype is REVARP request */ -#define OPCODE_REPLY 4 /* Optype is REVARP reply */ - -/* ip header */ -#define IPP_UDP 17 /* IP Protocol is UDP */ -#define IP_VERSION 4 /* IP version number */ -#define IP_HLEN 5 /* IP header length is a fixed 50 bytes */ -#define N 1536 - -/* tftp header */ -#define FTPOP_ACKN 4 /* Opcode is acknowledge */ -#define FTPOP_ERR 5 /* Opcode is Error */ -#define FTP_PORT 69 /* Standard TFTP port number */ -#define MSG "\0\1xxxxxxxx.mvme68k\0octet\0" /* implicit NULL */ - -/* data structures */ - -struct ether_header { - u_char ether_dhost[6]; - u_char ether_shost[6]; - u_short ether_type; -}; - -struct ether_arp { - u_short ar_hrd; /* format of hardware address */ - u_short ar_pro; /* format of protocol address */ - u_char ar_hln; /* length of hardware address */ - u_char ar_pln; /* length of protocol address */ - u_short ar_op; - u_char arp_sha[6]; /* sender hardware address */ - u_char arp_spa[4]; /* sender protocol address */ - u_char arp_tha[6]; /* target hardware address */ - u_char arp_tpa[4]; /* target protocol address */ -}; - -struct ip { - u_char ip_v:4, /* version */ - ip_hl:4; /* header length */ - u_char ip_tos; /* type of service */ - short ip_len; /* total length */ - u_short ip_id; /* identification */ - short ip_off; /* fragment offset field */ -#define IP_DF 0x4000 /* dont fragment flag */ -#define IP_MF 0x2000 /* more fragments flag */ -#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - u_char ip_ttl; /* time to live */ - u_char ip_p; /* protocol */ - u_short ip_sum; /* checksum */ - u_char ip_src[4]; - u_char ip_dst[4]; /* source and dest address */ -}; - -struct udp { - u_short uh_sport; - u_short uh_dport; - short uh_ulen; - u_short uh_sum; -}; - -struct tftph { - u_short op_code; - u_short block; -}; - -struct tftphr { - struct tftph info; - char data[1]; -}; - -/* globals */ -int last_ack; -char buf[N]; -struct ether_header *eh = (struct ether_header *)buf; -struct ether_arp *rarp = (struct ether_arp *) - (buf + sizeof(struct ether_header)); -struct ip *iph = (struct ip *)(buf + sizeof(struct ether_header)); -struct udp *udph = (struct udp *) - (buf + sizeof(struct ether_header) + sizeof(struct ip)); -char *tftp_r = buf + sizeof(struct ether_header) + sizeof(struct ip) + - sizeof(struct udp); -struct tftph *tftp_a = (struct tftph *)(buf + sizeof(struct ether_header) + - sizeof(struct ip) + sizeof(struct udp)); -struct tftphr *tftp = (struct tftphr *)(buf + sizeof(struct ether_header) + - sizeof(struct ip) + sizeof(struct udp)); diff --git a/sys/arch/mvme88k/stand/openbsd/sboot/if_le.c b/sys/arch/mvme88k/stand/openbsd/sboot/if_le.c deleted file mode 100644 index 7fbcf60f69a..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/sboot/if_le.c +++ /dev/null @@ -1,356 +0,0 @@ -/* $Id: if_le.c,v 1.1 1997/03/03 19:31:11 rahnds Exp $ */ - -/* - * Copyright (c) 1995 Theo de Raadt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Theo de Raadt for Willowglen Singapore. - * 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. - * - * Copyright (c) 1993 Adam Glass - * 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 Adam Glass. - * 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 Adam Glass ``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. - */ - -#include <sys/cdefs.h> -#include "sboot.h" -#include "if_lereg.h" - -struct { - struct lereg1 *sc_r1; /* LANCE registers */ - struct lereg2 *sc_r2; /* RAM */ - int next_rmd; - int next_tmd; -} le_softc; - -void -le_error(str, ler1) - char *str; - struct lereg1 *ler1; -{ - /* ler1->ler1_rap = LE_CSRO done in caller */ - if (ler1->ler1_rdp & LE_C0_BABL) { - printf("le0: been babbling, found by '%s'\n", str); - callrom(); - } - if (ler1->ler1_rdp & LE_C0_CERR) { - ler1->ler1_rdp = LE_C0_CERR; - } - if (ler1->ler1_rdp & LE_C0_MISS) { - ler1->ler1_rdp = LE_C0_MISS; - } - if (ler1->ler1_rdp & LE_C0_MERR) { - printf("le0: memory error in '%s'\n", str); - callrom(); - } -} - -void -le_reset(myea) - u_char *myea; -{ - struct lereg1 *ler1 = le_softc.sc_r1; - struct lereg2 *ler2 = le_softc.sc_r2; - unsigned int a; - int timo = 100000, stat, i; - - ler1->ler1_rap = LE_CSR0; - ler1->ler1_rdp = LE_C0_STOP; /* do nothing until we are finished */ - - bzero(ler2, sizeof(*ler2)); - - ler2->ler2_mode = LE_MODE_NORMAL; - ler2->ler2_padr[0] = myea[1]; - ler2->ler2_padr[1] = myea[0]; - ler2->ler2_padr[2] = myea[3]; - ler2->ler2_padr[3] = myea[2]; - ler2->ler2_padr[4] = myea[5]; - ler2->ler2_padr[5] = myea[4]; - - - ler2->ler2_ladrf0 = 0; - ler2->ler2_ladrf1 = 0; - - a = (u_int) ler2->ler2_rmd; - ler2->ler2_rlen = LE_RLEN | (a >> 16); - ler2->ler2_rdra = a & LE_ADDR_LOW_MASK; - - a = (u_int) ler2->ler2_tmd; - ler2->ler2_tlen = LE_TLEN | (a >> 16); - ler2->ler2_tdra = a & LE_ADDR_LOW_MASK; - - ler1->ler1_rap = LE_CSR1; - a = (u_int) ler2; - ler1->ler1_rdp = a & LE_ADDR_LOW_MASK; - ler1->ler1_rap = LE_CSR2; - ler1->ler1_rdp = a >> 16; - - for (i = 0; i < LERBUF; i++) { - a = (u_int) & ler2->ler2_rbuf[i]; - ler2->ler2_rmd[i].rmd0 = a & LE_ADDR_LOW_MASK; - ler2->ler2_rmd[i].rmd1_bits = LE_R1_OWN; - ler2->ler2_rmd[i].rmd1_hadr = a >> 16; - ler2->ler2_rmd[i].rmd2 = -LEMTU; - ler2->ler2_rmd[i].rmd3 = 0; - } - for (i = 0; i < LETBUF; i++) { - a = (u_int) & ler2->ler2_tbuf[i]; - ler2->ler2_tmd[i].tmd0 = a & LE_ADDR_LOW_MASK; - ler2->ler2_tmd[i].tmd1_bits = 0; - ler2->ler2_tmd[i].tmd1_hadr = a >> 16; - ler2->ler2_tmd[i].tmd2 = 0; - ler2->ler2_tmd[i].tmd3 = 0; - } - - ler1->ler1_rap = LE_CSR3; - ler1->ler1_rdp = LE_C3_BSWP; - - ler1->ler1_rap = LE_CSR0; - ler1->ler1_rdp = LE_C0_INIT; - do { - if (--timo == 0) { - printf("le0: init timeout, stat = 0x%x\n", stat); - break; - } - stat = ler1->ler1_rdp; - } while ((stat & LE_C0_IDON) == 0); - - ler1->ler1_rdp = LE_C0_IDON; - le_softc.next_rmd = 0; - le_softc.next_tmd = 0; - ler1->ler1_rap = LE_CSR0; - ler1->ler1_rdp = LE_C0_STRT; -} - -int -le_poll(pkt, len) - void *pkt; - int len; -{ - struct lereg1 *ler1 = le_softc.sc_r1; - struct lereg2 *ler2 = le_softc.sc_r2; - unsigned int a; - int length; - struct lermd *rmd; - - ler1->ler1_rap = LE_CSR0; - if ((ler1->ler1_rdp & LE_C0_RINT) != 0) - ler1->ler1_rdp = LE_C0_RINT; - rmd = &ler2->ler2_rmd[le_softc.next_rmd]; - if (rmd->rmd1_bits & LE_R1_OWN) { - return (0); - } - if (ler1->ler1_rdp & LE_C0_ERR) - le_error("le_poll", ler1); - if (rmd->rmd1_bits & LE_R1_ERR) { - printf("le0_poll: rmd status 0x%x\n", rmd->rmd1_bits); - length = 0; - goto cleanup; - } - if ((rmd->rmd1_bits & (LE_R1_STP | LE_R1_ENP)) != (LE_R1_STP | LE_R1_ENP)) { - printf("le_poll: chained packet\n"); - callrom(); - } - length = rmd->rmd3; - if (length >= LEMTU) { - length = 0; - printf("csr0 when bad things happen: %x\n", ler1->ler1_rdp); - callrom(); - goto cleanup; - } - if (!length) - goto cleanup; - length -= 4; - if (length > 0) - bcopy((char *) &ler2->ler2_rbuf[le_softc.next_rmd], pkt, length); - -cleanup: - a = (u_int) & ler2->ler2_rbuf[le_softc.next_rmd]; - rmd->rmd0 = a & LE_ADDR_LOW_MASK; - rmd->rmd1_hadr = a >> 16; - rmd->rmd2 = -LEMTU; - le_softc.next_rmd = - (le_softc.next_rmd == (LERBUF - 1)) ? 0 : (le_softc.next_rmd + 1); - rmd->rmd1_bits = LE_R1_OWN; - return length; -} - -int -le_put(pkt, len) - u_char *pkt; - size_t len; -{ - struct lereg1 *ler1 = le_softc.sc_r1; - struct lereg2 *ler2 = le_softc.sc_r2; - struct letmd *tmd; - int timo = 100000, stat, i; - unsigned int a; - - ler1->ler1_rap = LE_CSR0; - if (ler1->ler1_rdp & LE_C0_ERR) - le_error("le_put(way before xmit)", ler1); - tmd = &ler2->ler2_tmd[le_softc.next_tmd]; - while (tmd->tmd1_bits & LE_T1_OWN) { - printf("le0: output buffer busy\n"); - } - bcopy(pkt, (char *) ler2->ler2_tbuf[le_softc.next_tmd], len); - if (len < 64) - tmd->tmd2 = -64; - else - tmd->tmd2 = -len; - tmd->tmd3 = 0; - if (ler1->ler1_rdp & LE_C0_ERR) - le_error("le_put(before xmit)", ler1); - tmd->tmd1_bits = LE_T1_STP | LE_T1_ENP | LE_T1_OWN; - a = (u_int) & ler2->ler2_tbuf[le_softc.next_tmd]; - tmd->tmd0 = a & LE_ADDR_LOW_MASK; - tmd->tmd1_hadr = a >> 16; - ler1->ler1_rdp = LE_C0_TDMD; - if (ler1->ler1_rdp & LE_C0_ERR) - le_error("le_put(after xmit)", ler1); - do { - if (--timo == 0) { - printf("le0: transmit timeout, stat = 0x%x\n", - stat); - if (ler1->ler1_rdp & LE_C0_ERR) - le_error("le_put(timeout)", ler1); - break; - } - stat = ler1->ler1_rdp; - } while ((stat & LE_C0_TINT) == 0); - ler1->ler1_rdp = LE_C0_TINT; - if (ler1->ler1_rdp & LE_C0_ERR) { - if ((ler1->ler1_rdp & (LE_C0_BABL | LE_C0_CERR | LE_C0_MISS | LE_C0_MERR)) != - LE_C0_CERR) - printf("le_put: xmit error, buf %d\n", le_softc.next_tmd); - le_error("le_put(xmit error)", ler1); - } - le_softc.next_tmd = 0; -/* (le_softc.next_tmd == (LETBUF - 1)) ? 0 : le_softc.next_tmd + 1;*/ - if (tmd->tmd1_bits & LE_T1_ERR) { - printf("le0: transmit error, error = 0x%x\n", - tmd->tmd3); - return -1; - } - return len; -} - -int -le_get(pkt, len, timeout) - u_char *pkt; - size_t len; - u_long timeout; -{ - int cc; - int now, then; - int stopat = time() + timeout; - then = 0; - - cc = 0; - while ((now = time()) < stopat && !cc) { - cc = le_poll(pkt, len); - if (then != now) { -#ifdef LE_DEBUG - printf("%d \r", stopat - now); -#endif - then = now; - } - if (cc && (pkt[0] != myea[0] || pkt[1] != myea[1] || - pkt[2] != myea[2] || pkt[3] != myea[3] || - pkt[4] != myea[4] || pkt[5] != myea[5])) { - cc = 0; /* ignore broadcast / multicast */ -#ifdef LE_DEBUG - printf("reject (%d sec left)\n", stopat - now); -#endif - } - } -#ifdef LE_DEBUG - printf("\n"); -#endif - return cc; -} - -void -le_init() -{ - caddr_t addr; - int *ea = (int *) LANCE_ADDR; - u_long *eram = (u_long *) ERAM_ADDR; - u_long e = *ea; - if ((e & 0x2fffff00) == 0x2fffff00) { - printf("ERROR: ethernet address not set! Use LSAD.\n"); - callrom(); - } - myea[0] = 0x08; - myea[1] = 0x00; - myea[2] = 0x3e; - e = e >> 8; - myea[5] = e & 0xff; - e = e >> 8; - myea[4] = e & 0xff; - e = e >> 8; - myea[3] = e; - printf("le0: ethernet address: %x:%x:%x:%x:%x:%x\n", - myea[0], myea[1], myea[2], myea[3], myea[4], myea[5]); - bzero(&le_softc, sizeof(le_softc)); - le_softc.sc_r1 = (struct lereg1 *) LANCE_REG_ADDR; - le_softc.sc_r2 = (struct lereg2 *) (*eram - (1024 * 1024)); - le_reset(myea); -} - -void -le_end() -{ - struct lereg1 *ler1 = le_softc.sc_r1; - - ler1->ler1_rap = LE_CSR0; - ler1->ler1_rdp = LE_C0_STOP; -} diff --git a/sys/arch/mvme88k/stand/openbsd/sboot/if_lereg.h b/sys/arch/mvme88k/stand/openbsd/sboot/if_lereg.h deleted file mode 100644 index d45f428bb80..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/sboot/if_lereg.h +++ /dev/null @@ -1,176 +0,0 @@ -/* $Id: if_lereg.h,v 1.1 1997/03/03 19:31:11 rahnds Exp $ */ - -/*- - * Copyright (c) 1982, 1992, 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. - * - * @(#)if_lereg.h 8.2 (Berkeley) 10/30/93 - */ - -#define LEMTU 1518 -#define LEMINSIZE 60 /* should be 64 if mode DTCR is set */ -#define LERBUF 8 -#define LERBUFLOG2 3 -#define LE_RLEN (LERBUFLOG2 << 13) -#define LETBUF 1 -#define LETBUFLOG2 0 -#define LE_TLEN (LETBUFLOG2 << 13) - -/* Local Area Network Controller for Ethernet (LANCE) registers */ -struct lereg1 { - volatile u_short ler1_rdp; /* register data port */ - volatile u_short ler1_rap; /* register address port */ -}; - -/* register addresses */ -#define LE_CSR0 0 /* Control and status register */ -#define LE_CSR1 1 /* low address of init block */ -#define LE_CSR2 2 /* high address of init block */ -#define LE_CSR3 3 /* Bus master and control */ - -/* Control and status register 0 (csr0) */ -#define LE_C0_ERR 0x8000 /* error summary */ -#define LE_C0_BABL 0x4000 /* transmitter timeout error */ -#define LE_C0_CERR 0x2000 /* collision */ -#define LE_C0_MISS 0x1000 /* missed a packet */ -#define LE_C0_MERR 0x0800 /* memory error */ -#define LE_C0_RINT 0x0400 /* receiver interrupt */ -#define LE_C0_TINT 0x0200 /* transmitter interrupt */ -#define LE_C0_IDON 0x0100 /* initalization done */ -#define LE_C0_INTR 0x0080 /* interrupt condition */ -#define LE_C0_INEA 0x0040 /* interrupt enable */ -#define LE_C0_RXON 0x0020 /* receiver on */ -#define LE_C0_TXON 0x0010 /* transmitter on */ -#define LE_C0_TDMD 0x0008 /* transmit demand */ -#define LE_C0_STOP 0x0004 /* disable all external activity */ -#define LE_C0_STRT 0x0002 /* enable external activity */ -#define LE_C0_INIT 0x0001 /* begin initalization */ - -#define LE_C0_BITS \ - "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\ -\12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT" - -/* Control and status register 3 (csr3) */ -#define LE_C3_BSWP 0x4 /* byte swap */ -#define LE_C3_ACON 0x2 /* ALE control, eh? */ -#define LE_C3_BCON 0x1 /* byte control */ -/* - * Current size is 13,758 bytes with 8 x 1518 receive buffers and - * 1 x 1518 transmit buffer. - */ -struct lereg2 { - /* initialization block */ - volatile u_short ler2_mode; /* mode */ - volatile u_char ler2_padr[6]; /* physical address */ -#ifdef new_code - volatile u_short ler2_ladrf[4]; /* logical address filter */ -#else - volatile u_long ler2_ladrf0; /* logical address filter */ - volatile u_long ler2_ladrf1; /* logical address filter */ -#endif - volatile u_short ler2_rdra; /* receive descriptor addr */ - volatile u_short ler2_rlen; /* rda high and ring size */ - volatile u_short ler2_tdra; /* transmit descriptor addr */ - volatile u_short ler2_tlen; /* tda high and ring size */ - /* receive message descriptors. bits/hadr are byte order dependent. */ - struct lermd { - volatile u_short rmd0; /* low address of packet */ - volatile u_char rmd1_bits; /* descriptor bits */ - volatile u_char rmd1_hadr; /* high address of packet */ - volatile short rmd2; /* buffer byte count */ - volatile u_short rmd3; /* message byte count */ - } ler2_rmd[LERBUF]; - /* transmit message descriptors */ - struct letmd { - volatile u_short tmd0; /* low address of packet */ - volatile u_char tmd1_bits; /* descriptor bits */ - volatile u_char tmd1_hadr; /* high address of packet */ - volatile short tmd2; /* buffer byte count */ - volatile u_short tmd3; /* transmit error bits */ - } ler2_tmd[LETBUF]; - volatile char ler2_rbuf[LERBUF][LEMTU]; - volatile char ler2_tbuf[LETBUF][LEMTU]; -}; - -/* Initialzation block (mode) */ -#define LE_MODE_PROM 0x8000 /* promiscuous mode */ -/* 0x7f80 reserved, must be zero */ -#define LE_MODE_INTL 0x0040 /* internal loopback */ -#define LE_MODE_DRTY 0x0020 /* disable retry */ -#define LE_MODE_COLL 0x0010 /* force a collision */ -#define LE_MODE_DTCR 0x0008 /* disable transmit CRC */ -#define LE_MODE_LOOP 0x0004 /* loopback mode */ -#define LE_MODE_DTX 0x0002 /* disable transmitter */ -#define LE_MODE_DRX 0x0001 /* disable receiver */ -#define LE_MODE_NORMAL 0 /* none of the above */ - - -/* Receive message descriptor 1 (rmd1_bits) */ -#define LE_R1_OWN 0x80 /* LANCE owns the packet */ -#define LE_R1_ERR 0x40 /* error summary */ -#define LE_R1_FRAM 0x20 /* framing error */ -#define LE_R1_OFLO 0x10 /* overflow error */ -#define LE_R1_CRC 0x08 /* CRC error */ -#define LE_R1_BUFF 0x04 /* buffer error */ -#define LE_R1_STP 0x02 /* start of packet */ -#define LE_R1_ENP 0x01 /* end of packet */ - -#define LE_R1_BITS \ - "\20\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP" - -/* Transmit message descriptor 1 (tmd1_bits) */ -#define LE_T1_OWN 0x80 /* LANCE owns the packet */ -#define LE_T1_ERR 0x40 /* error summary */ -#define LE_T1_MORE 0x10 /* multiple collisions */ -#define LE_T1_ONE 0x08 /* single collision */ -#define LE_T1_DEF 0x04 /* defferred transmit */ -#define LE_T1_STP 0x02 /* start of packet */ -#define LE_T1_ENP 0x01 /* end of packet */ - -#define LE_T1_BITS \ - "\20\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP" - -/* Transmit message descriptor 3 (tmd3) */ -#define LE_T3_BUFF 0x8000 /* buffer error */ -#define LE_T3_UFLO 0x4000 /* underflow error */ -#define LE_T3_LCOL 0x1000 /* late collision */ -#define LE_T3_LCAR 0x0800 /* loss of carrier */ -#define LE_T3_RTRY 0x0400 /* retry error */ -#define LE_T3_TDR_MASK 0x03ff /* time domain reflectometry counter */ - -#define LE_XMD2_ONES 0xf000 - -#define LE_T3_BITS \ - "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY" - - -#define LE_ADDR_LOW_MASK (0xffff) - diff --git a/sys/arch/mvme88k/stand/openbsd/sboot/oc_cksum.S b/sys/arch/mvme88k/stand/openbsd/sboot/oc_cksum.S deleted file mode 100644 index 8f0ffe61791..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/sboot/oc_cksum.S +++ /dev/null @@ -1,187 +0,0 @@ -| $Id: oc_cksum.S,v 1.1 1997/03/03 19:31:11 rahnds Exp $ - -| Copyright (c) 1988 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. -| -| @(#)oc_cksum.s 7.2 (Berkeley) 11/3/90 -| -| -| oc_cksum: ones complement 16 bit checksum for MC68020. -| -| oc_cksum (buffer, count, strtval) -| -| Do a 16 bit ones complement sum of 'count' bytes from 'buffer'. -| 'strtval' is the starting value of the sum (usually zero). -| -| It simplifies life in in_cksum if strtval can be >= 2^16. -| This routine will work as long as strtval is < 2^31. -| -| Performance -| ----------- -| This routine is intended for MC 68020s but should also work -| for 68030s. It (deliberately) does not worry about the alignment -| of the buffer so will only work on a 68010 if the buffer is -| aligned on an even address. (Also, a routine written to use -| 68010 "loop mode" would almost certainly be faster than this -| code on a 68010). -| -| We do not worry about alignment because this routine is frequently -| called with small counts: 20 bytes for IP header checksums and 40 -| bytes for TCP ack checksums. For these small counts, testing for -| bad alignment adds ~10% to the per-call cost. Since, by the nature -| of the kernel allocator, the data we are called with is almost -| always longword aligned, there is no benefit to this added cost -| and we are better off letting the loop take a big performance hit -| in the rare cases where we are handed an unaligned buffer. -| -| Loop unrolling constants of 2, 4, 8, 16, 32 and 64 times were -| tested on random data on four different types of processors (see -| list below -- 64 was the largest unrolling because anything more -| overflows the 68020 Icache). On all the processors, the -| throughput asymptote was located between 8 and 16 (closer to 8). -| However, 16 was substantially better than 8 for small counts. -| (It is clear why this happens for a count of 40: unroll-8 pays a -| loop branch cost and unroll-16 does not. But the tests also showed -| that 16 was better than 8 for a count of 20. It is not obvious to -| me why.) So, since 16 was good for both large and small counts, -| the loop below is unrolled 16 times. -| -| The processors tested and their average time to checksum 1024 bytes -| of random data were: -| Sun 3/50 (15MHz) 190 us/KB -| Sun 3/180 (16.6MHz) 175 us/KB -| Sun 3/60 (20MHz) 134 us/KB -| Sun 3/280 (25MHz) 95 us/KB -| -| The cost of calling this routine was typically 10% of the per- -| kilobyte cost. E.g., checksumming zero bytes on a 3/60 cost 9us -| and each additional byte cost 125ns. With the high fixed cost, -| it would clearly be a gain to "inline" this routine -- the -| subroutine call adds 400% overhead to an IP header checksum. -| However, in absolute terms, inlining would only gain 10us per -| packet -- a 1% effect for a 1ms ethernet packet. This is not -| enough gain to be worth the effort. - -#include <machine/asm.h> - - .text - - .text; .even; .globl _oc_cksum; _oc_cksum: - movl sp@(4),a0 | get buffer ptr - movl sp@(8),d1 | get byte count - movl sp@(12),d0 | get starting value - movl d2,sp@- | free a reg - - | test for possible 1, 2 or 3 bytes of excess at end - | of buffer. The usual case is no excess (the usual - | case is header checksums) so we give that the faster - | 'not taken' leg of the compare. (We do the excess - | first because we are about the trash the low order - | bits of the count in d1.) - - btst #0,d1 - jne L5 | if one or three bytes excess - btst #1,d1 - jne L7 | if two bytes excess -L1: - movl d1,d2 - lsrl #6,d1 | make cnt into # of 64 byte chunks - andl #0x3c,d2 | then find fractions of a chunk - negl d2 - andb #0xf,cc | clear X - jmp pc@(L3-.-2:b,d2) -L2: - movl a0@+,d2 - addxl d2,d0 - movl a0@+,d2 - addxl d2,d0 - movl a0@+,d2 - addxl d2,d0 - movl a0@+,d2 - addxl d2,d0 - movl a0@+,d2 - addxl d2,d0 - movl a0@+,d2 - addxl d2,d0 - movl a0@+,d2 - addxl d2,d0 - movl a0@+,d2 - addxl d2,d0 - movl a0@+,d2 - addxl d2,d0 - movl a0@+,d2 - addxl d2,d0 - movl a0@+,d2 - addxl d2,d0 - movl a0@+,d2 - addxl d2,d0 - movl a0@+,d2 - addxl d2,d0 - movl a0@+,d2 - addxl d2,d0 - movl a0@+,d2 - addxl d2,d0 - movl a0@+,d2 - addxl d2,d0 -L3: - dbra d1,L2 | (NB- dbra does not affect X) - - movl d0,d1 | fold 32 bit sum to 16 bits - swap d1 | (NB- swap does not affect X) - addxw d1,d0 - jcc L4 - addw #1,d0 -L4: - andl #0xffff,d0 - movl sp@+,d2 - rts - -L5: | deal with 1 or 3 excess bytes at the end of the buffer. - btst #1,d1 - jeq L6 | if 1 excess - - | 3 bytes excess - clrl d2 - movw a0@(-3,d1:l),d2 | add in last full word then drop - addl d2,d0 | through to pick up last byte - -L6: | 1 byte excess - clrl d2 - movb a0@(-1,d1:l),d2 - lsll #8,d2 - addl d2,d0 - jra L1 - -L7: | 2 bytes excess - clrl d2 - movw a0@(-2,d1:l),d2 - addl d2,d0 - jra L1 diff --git a/sys/arch/mvme88k/stand/openbsd/sboot/sboot.c b/sys/arch/mvme88k/stand/openbsd/sboot/sboot.c deleted file mode 100644 index 5b0f06b1a7e..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/sboot/sboot.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 1995 Theo de Raadt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Theo de Raadt for Willowglen Singapore. - * 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. - * - * Copyright (c) 1995 Charles D. Cranor and Seth Widoff - * 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 Charles D. Cranor - * and Seth Widoff. - * 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/cdefs.h> -#include "sboot.h" - -void -main() -{ - char buf[128]; - - buf[0] = '0'; - printf("\nsboot: MVME147 bootstrap program\n"); - while (1) { - printf(">>> "); - gets(buf); - do_cmd(buf); - } - /* not reached */ -} - -/* - * exit to rom - */ -void -callrom() -{ - asm("trap #15; .word 0x0063"); -} - -/* - * do_cmd: do a command - */ -void -do_cmd(buf) - char *buf; -{ - switch (*buf) { - case '\0': - break; - case 'a': - if (rev_arp()) { - printf("My ip address is: %d.%d.%d.%d\n", myip[0], - myip[1], myip[2], myip[3]); - printf("Server ip address is: %d.%d.%d.%d\n", servip[0], - servip[1], servip[2], servip[3]); - } else { - printf("Failed.\n"); - } - break; - case 'q': - printf("exiting to ROM\n"); - callrom(); - break; - case 'f': - if (do_get_file() == 1) { - printf("Download Failed\n"); - } else { - printf("Download was a success!\n"); - } - break; - case 'b': - le_init(); - if (rev_arp()) { - printf("client IP address %d.%d.%d.%d\n", myip[0], - myip[1], myip[2], myip[3]); - printf("server IP address %d.%d.%d.%d\n", servip[0], - servip[1], servip[2], servip[3]); - } else { - printf("REVARP: Failed.\n"); - return; - } - if (do_get_file() == 1) { - printf("Download Failed\n"); - return; - } else { - printf("received secondary boot program.\n"); - } - if (*++buf == '\0') - buf = "bsd"; - go(buf); - break; - case 'h': - case '?': - printf("valid commands\n"); - printf("a - send a RARP\n"); - printf("b - boot the system\n"); - printf("q - exit to ROM\n"); - printf("f - ftp the boot file\n"); - printf("g - execute the boot file\n"); - printf("h - help\n"); - printf("i - init LANCE enet chip\n"); - break; - case 'i': - le_init(); - break; - case 'g': - go(buf); - break; - default: - printf("sboot: %s: Unknown command\n", buf); - } -} - -go(buf) - char *buf; -{ - void (*entry)() = (void (*))LOAD_ADDR; - - printf("jumping to boot program at 0x%x.\n", entry); - - asm("clrl d0; clrl d1"); /* XXX network device */ - asm("movl %0, a3" : : "a" (buf) : "a3"); - asm("movl %0, a4" : : "a" (buf + strlen(buf)) : "a4"); - asm("jmp %0@" : : "a" (entry)); -} diff --git a/sys/arch/mvme88k/stand/openbsd/sboot/sboot.h b/sys/arch/mvme88k/stand/openbsd/sboot/sboot.h deleted file mode 100644 index 146e0b8cce4..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/sboot/sboot.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 1995 Charles D. Cranor and Seth Widoff - * 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 Charles D. Cranor - * and Seth Widoff. - * 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. - */ - -/* - * sboot.h: stuff for MVME147's serial line boot - */ - -typedef unsigned short u_short; -typedef unsigned long u_long; -typedef unsigned char u_char; -typedef unsigned int u_int; -typedef u_long size_t; -typedef char *caddr_t; -extern caddr_t end; - -#define NULL ((char *)0) - -void bcopy __P((const void *, void *, size_t)); /* libc_sa */ -void *memset __P((void *, int, size_t)); /* libc_sa */ -int printf __P((const char *, ...)); /* libc_sa */ - -/* console */ -void puts __P((char *)); -void putchar __P((char)); -char cngetc __P((void)); -void ngets __P((char *, int)); - -/* sboot */ -void callrom __P((void)); -void do_cmd __P((char *)); - -/* le */ -#define LANCE_ADDR 0xfffe0778 -#define ERAM_ADDR 0xfffe0774 -#define LANCE_REG_ADDR 0xfffe1800 -void le_end __P((void)); -void le_init __P((void)); -int le_get __P((u_char *, size_t, u_long)); -int le_put __P((u_char *, size_t)); - -/* etherfun */ -#define READ 0 -#define ACKN 1 -void do_rev_arp __P((void)); -int get_rev_arp __P((void)); -int rev_arp __P((void)); -void do_send_tftp __P((int)); -int do_get_file __P((void)); -void tftp_file __P((char *, u_long)); - -/* clock */ -u_long time __P((void)); - -/* checksum */ -u_long oc_cksum __P((void *, u_long, u_long)); - -#define CONS_ZS_ADDR (0xfffe3002) -#define CLOCK_ADDR (0xfffe07f8) -#define LOAD_ADDR 0x7000 - -unsigned char myea[6]; /* my ether addr */ -unsigned char myip[4]; -unsigned char servip[4]; -unsigned char servea[6]; -u_short myport; -u_short servport; -unsigned char reboot; diff --git a/sys/arch/mvme88k/stand/openbsd/sboot/srec.c b/sys/arch/mvme88k/stand/openbsd/sboot/srec.c deleted file mode 100644 index 164fb4b458c..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/sboot/srec.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Public domain, believed to be by Mike Price. - * - * convert binary file to Srecord format - * XXX srec generates improper checksums for 4-byte dumps - */ -#include <stdio.h> -#include <ctype.h> - -int get32(); -void put32(); -void sput(); -void put(); -int checksum(); - -int mask; -int size; - -main(argc, argv) - int argc; - char *argv[]; -{ - char buf[32]; - int cc; - int base; - int addr; - char *name; - - if (argc != 4) { - fprintf(stderr, "usage: %s {size} {hex_addr} {name}\n", argv[0]); - fprintf(stderr, "Size = 2, 3, or 4 byte address\n"); - exit(1); - } - sscanf(argv[1], "%x", &size); - mask = (1 << (size * 8)) - 1; - if (!mask) - mask = (-1); - sscanf(argv[2], "%x", &base); - name = argv[3]; - - if (size == 2) - printf("S0%02X%04X", 2 + strlen(name) + 1, 0); - if (size == 3) - printf("S0%02X%06X", 3 + strlen(name) + 1, 0); - if (size == 4) - printf("S0%02X%08X", 4 + strlen(name) + 1, 0); - sput(name); - printf("%02X\n", checksum(0, name, strlen(name), size)); - - addr = base; - for (;;) { - cc = get32(buf); - if (cc > 0) { - put32(cc, addr, buf, size, mask); - addr += cc; - } else - break; - } - - buf[0] = base >> 8; - buf[1] = base; - printf("S%d%02X", 11 - size, 2 + 1); - switch (size) { - case 2: - printf("%04X", base & mask); - break; - case 3: - printf("%06X", base & mask); - break; - case 4: - printf("%08X", base & mask); - break; - } - - /* - * kludge -> don't know why you have to add the +1 = works - * for size =3 at least - */ - printf("%02X\n", checksum(base, (char *) 0, 0, size) + 1); - exit (0); -} - -int -get32(buf) - char buf[]; -{ - char *cp = buf; - int i; - int c; - - for (i = 0; i < 32; ++i) { - if ((c = getchar()) != EOF) - *cp++ = c; - else - break; - } - return (cp - buf); -} - -void -put32(len, addr, buf, size, mask) - int len; - int addr; - char buf[]; - int size, mask; -{ - char *cp = buf; - int i; - - if (size == 2) - printf("S1%02X%04X", 2 + len + 1, addr & mask); - if (size == 3) - printf("S2%02X%06X", 3 + len + 1, addr & mask); - if (size == 4) - printf("S3%02X%08X", 4 + len + 1, addr & mask); - for (i = 0; i < len; ++i) - put(*cp++); - printf("%02X\n", checksum(addr, buf, len, size)); -} - -void -sput(s) - char *s; -{ - while (*s != '\0') - put(*s++); -} - -void -put(c) - int c; -{ - printf("%02X", c & 0xff); -} - -int -checksum(addr, buf, len, size) - int addr; - char buf[]; - int len; - int size; -{ - char *cp = buf; - int sum = 0xff - 1 - size - (len & 0xff); - int i; - - if (size == 4) - sum -= (addr >> 24) & 0xff; - if (size >= 3) - sum -= (addr >> 16) & 0xff; - sum -= (addr >> 8) & 0xff; - sum -= addr & 0xff; - for (i = 0; i < len; ++i) { - sum -= *cp++ & 0xff; - } - return (sum & 0xff); -} diff --git a/sys/arch/mvme88k/stand/openbsd/wrtvid/Makefile b/sys/arch/mvme88k/stand/openbsd/wrtvid/Makefile deleted file mode 100644 index 8b6cd97df7d..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/wrtvid/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -PROG= wrtvid -NOMAN= - -install: - -.include <bsd.prog.mk> diff --git a/sys/arch/mvme88k/stand/openbsd/wrtvid/Makefile.inc b/sys/arch/mvme88k/stand/openbsd/wrtvid/Makefile.inc deleted file mode 100644 index a8c47af8bd7..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/wrtvid/Makefile.inc +++ /dev/null @@ -1,12 +0,0 @@ -WRTVID_BASE_DIR=${S}/arch/${MACHINE}/stand/wrtvid - -WRTVID_DIR!= cd ${WRTVID_BASE_DIR}; \ - printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx - -WRTVID=${WRTVID_DIR}/wrtvid - -$(WRTVID): .NOTMAIN __always_make_WRTVID - @echo making sure the wrtvid is up to date... - @(cd ${WRTVID_BASE_DIR}; ${MAKE}) - -__always_make_WRTVID: .NOTMAIN diff --git a/sys/arch/mvme88k/stand/openbsd/wrtvid/wrtvid.c b/sys/arch/mvme88k/stand/openbsd/wrtvid/wrtvid.c deleted file mode 100644 index b2a21ad4f18..00000000000 --- a/sys/arch/mvme88k/stand/openbsd/wrtvid/wrtvid.c +++ /dev/null @@ -1,145 +0,0 @@ -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <stdio.h> -#define __DBINTERFACE_PRIVATE -#include <db.h> -#include <machine/disklabel.h> - -main(argc, argv) - int argc; - char **argv; -{ - struct cpu_disklabel *pcpul; - struct stat stat; - int exe_file; - int tape_vid; - int tape_exe; - unsigned int exe_addr; - unsigned short exe_addr_u; - unsigned short exe_addr_l; - char *filename; - char fileext[256]; - char filebase[256]; - - if (argc == 0) - filename = "a.out"; - else - filename = argv[1]; - - exe_file = open(filename, O_RDONLY,0444); - if (exe_file == -1) { - perror(filename); - exit(2); - } - sprintf(fileext, "%c%cboot", filename[4], filename[5]); - tape_vid = open(fileext, O_WRONLY|O_CREAT|O_TRUNC, 0644); - sprintf(fileext, "boot%c%c", filename[4], filename[5]); - tape_exe = open(fileext, O_WRONLY|O_CREAT|O_TRUNC,0644); - - pcpul = (struct cpu_disklabel *)malloc(sizeof(struct cpu_disklabel)); - bzero(pcpul, sizeof(struct cpu_disklabel)); - - strcpy(pcpul->vid_id, "NBSD"); - - fstat(exe_file, &stat); - /* size in 256 byte blocks round up after a.out header removed */ - - if (filename[5] == 't' ) { - pcpul->vid_oss = 1; - }else { - pcpul->vid_oss = 2; - } - pcpul->vid_osl = (((stat.st_size -0x20) +511) / 512) *2; - - lseek(exe_file, 0x14, SEEK_SET); - read(exe_file, &exe_addr, 4); - - /* check this, it may not work in both endian. */ - { - union { - struct s { - unsigned short s1; - unsigned short s2; - } s; - unsigned long l; - } a; - a.l = exe_addr; - pcpul->vid_osa_u = a.s.s1; - pcpul->vid_osa_l = a.s.s2; - - } - pcpul->vid_cas = 1; - pcpul->vid_cal = 1; - /* do not want to write past end of structure, not null terminated */ - strncpy(pcpul->vid_mot, "MOTOROLA", 8); - - if (BYTE_ORDER != BIG_ENDIAN) - swabvid(pcpul); - - pcpul->cfg_rec = 0x100; - pcpul->cfg_psm = 0x200; - - if (BYTE_ORDER != BIG_ENDIAN) - swabcfg(pcpul); - - write(tape_vid, pcpul, sizeof(struct cpu_disklabel)); - - free(pcpul); - - copy_exe(exe_file, tape_exe); - close(exe_file); - close(tape_vid); - close(tape_exe); - return (0); -} - -#define BUF_SIZ 512 -copy_exe(exe_file, tape_exe) - int exe_file, tape_exe; -{ - char *buf; - int cnt = 0; - - buf = (char *)malloc(BUF_SIZ); - - lseek (exe_file, 0x20, SEEK_SET); - while (BUF_SIZ == (cnt = read(exe_file, buf, BUF_SIZ))) { - write(tape_exe, buf, cnt); - } - bzero(&buf[cnt], BUF_SIZ-cnt); - write(tape_exe, buf, BUF_SIZ); -} - -swabvid(pcpul) - struct cpu_disklabel *pcpul; -{ - M_32_SWAP(pcpul->vid_oss); - M_16_SWAP(pcpul->vid_osl); - /* - M_16_SWAP(pcpul->vid_osa_u); - M_16_SWAP(pcpul->vid_osa_l); - */ - M_32_SWAP(pcpul->vid_cas); -} - -swabcfg(pcpul) - struct cpu_disklabel *pcpul; -{ - M_16_SWAP(pcpul->cfg_atm); - M_16_SWAP(pcpul->cfg_prm); - M_16_SWAP(pcpul->cfg_atm); - M_16_SWAP(pcpul->cfg_rec); - M_16_SWAP(pcpul->cfg_trk); - M_16_SWAP(pcpul->cfg_psm); - M_16_SWAP(pcpul->cfg_shd); - M_16_SWAP(pcpul->cfg_pcom); - M_16_SWAP(pcpul->cfg_rwcc); - M_16_SWAP(pcpul->cfg_ecc); - M_16_SWAP(pcpul->cfg_eatm); - M_16_SWAP(pcpul->cfg_eprm); - M_16_SWAP(pcpul->cfg_eatw); - M_16_SWAP(pcpul->cfg_rsvc1); - M_16_SWAP(pcpul->cfg_rsvc2); -} |