diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2011-07-10 17:31:41 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2011-07-10 17:31:41 +0000 |
commit | 4b4398f7cac49cc24a8071c877c9bfeddaa86a36 (patch) | |
tree | aede89070ebde721cfecdde2e4fbe858b3f7b424 /sys/arch/vax | |
parent | 98cab522c33b3d0a41891075418698f4106598b8 (diff) |
Move the vax/boot code to vax/stand. A cvs 'mv' with de-tagging has been
done behind the scenes to retain history. Having all the bootblocks in the
same architecture sub-directory satisfies several principles.
ok miod
Diffstat (limited to 'sys/arch/vax')
29 files changed, 7 insertions, 5154 deletions
diff --git a/sys/arch/vax/Makefile b/sys/arch/vax/Makefile index c11f28f43d7..d83db4a115e 100644 --- a/sys/arch/vax/Makefile +++ b/sys/arch/vax/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.5 2010/11/12 17:11:44 deraadt Exp $ +# $OpenBSD: Makefile,v 1.6 2011/07/10 17:31:38 deraadt Exp $ S= ${.CURDIR}/../.. KFILE= GENERIC @@ -10,7 +10,7 @@ TAGS= ${.CURDIR}/tags NOPROG= NOMAN= -SUBDIR= boot +SUBDIR= stand # config the fattest kernel we can find into a temporary dir # to create a Makefile. Then use make to pull some variables diff --git a/sys/arch/vax/boot/Makefile b/sys/arch/vax/boot/Makefile deleted file mode 100644 index d3fd0817120..00000000000 --- a/sys/arch/vax/boot/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $OpenBSD: Makefile,v 1.12 2000/05/25 21:55:09 deraadt Exp $ -# $NetBSD: Makefile,v 1.21 1999/03/06 16:36:04 ragge Exp $ -# - -.if ${MACHINE} == "vax" -SUBDIR= boot xxboot -.endif - -.include <bsd.subdir.mk> diff --git a/sys/arch/vax/boot/Makefile.inc b/sys/arch/vax/boot/Makefile.inc deleted file mode 100644 index 068de9c7b4d..00000000000 --- a/sys/arch/vax/boot/Makefile.inc +++ /dev/null @@ -1,13 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.4 2002/12/02 09:00:26 miod Exp $ -# $NetBSD: Makefile.inc,v 1.6 2002/02/24 01:04:23 matt Exp $ - -RELOC=0x39F000 -.PATH: ${.CURDIR}/../../vax ${.CURDIR}/../common - -CFLAGS+= -fno-stack-protector -CPPFLAGS+=-I. -I${.CURDIR}/../../../../ -I${.CURDIR}/../../ -I${.CURDIR}/../common -I${.CURDIR}/../../include -CPPFLAGS+=-DRELOC=${RELOC} - -# Private handling of assembler files. -.s.o: - ${CC} -x assembler-with-cpp ${CPPFLAGS} -E ${.IMPSRC} | as -o ${.TARGET} diff --git a/sys/arch/vax/boot/boot/Makefile b/sys/arch/vax/boot/boot/Makefile deleted file mode 100644 index 0463c1dfe6e..00000000000 --- a/sys/arch/vax/boot/boot/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# $OpenBSD: Makefile,v 1.9 2011/07/06 18:32:59 miod Exp $ -# $NetBSD: Makefile,v 1.27 2002/04/07 07:00:25 matt Exp $ - -S!= cd ${.CURDIR}/../../../../; pwd -NOMAN= # defined - -.include <bsd.own.mk> - -PROG= boot -DEVS= ra.c mfm.c if_qe.c if_le.c if_ze.c if_de.c -SRCS= srt0.S boot.c devopen.c conf.c autoconf.c netio.c rom.c romread.S \ - urem.s udiv.s consio.c consio2.S str.S ${DEVS} findcpu.c - -CLEANFILES+=${PROG} ${PROG}.sym ${PROG}.mop -CPPFLAGS+=-DSUPPORT_BOOTPARAMS -DSUPPORT_DHCP -D_STANDALONE \ - -DNO_MID_CHECK -#CPPFLAGS+=-DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG -DDEV_DEBUG \ -# -DRPC_DEBUG -DRARP_DEBUG -DPARANOID - -BINDIR=/usr/mdec - -SA_ZLIB= yes -USE_LOADFILE= yes -SAREL= -.include "${S}/lib/libsa/Makefile.inc" -LIBSA= ${SALIB} - -Z_AS= library -CFLAGS+=-I${S}/lib/libsa -.include "${S}/lib/libz/Makefile.inc" -LIBZ= ${ZLIB} - -.PATH: ${S}/lib/libkern/arch/vax ${S}/lib/libkern -SRCS+= moddi3.c negdi2.c - -.if ${MACHINE} == "vax" -.PHONY: machine-links -beforedepend: machine-links -machine-links: - @rm -f machine && ln -s ${S}/arch/${MACHINE}/include machine - @rm -f ${MACHINE_ARCH} && ln -s ${S}/arch/${MACHINE_ARCH}/include ${MACHINE_ARCH} -.NOPATH: machine ${MACHINE_ARCH} -CLEANFILES+= machine ${MACHINE_ARCH} -CPPFLAGS+= -I${.OBJDIR} -.endif - -START=nisse - -${PROG}: machine-links ${OBJS} ${LIBSA} ${LIBZ} - ${LD} -N -Ttext ${RELOC} -e ${START} -o ${PROG}.sym -Llib/sa -L. ${OBJS} \ - ${LIBSA} ${LIBZ} ${LIBSA} - /usr/sbin/mopa.out ${PROG}.sym ${PROG}.mop - /bin/cp ${PROG}.sym ${PROG} - /usr/bin/strip ${PROG} - /usr/bin/size ${PROG} - -clean:: - rm -f a.out [Ee]rrs mklog core *.core ${PROG} ${OBJS} ${LOBJS} \ - ${CLEANFILES} - -#install: -# ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \ -# ${PROG} ${DESTDIR}${MDEC_DIR}/${PROG} - -.include <bsd.prog.mk> diff --git a/sys/arch/vax/boot/boot/autoconf.c b/sys/arch/vax/boot/boot/autoconf.c deleted file mode 100644 index 356b0038f35..00000000000 --- a/sys/arch/vax/boot/boot/autoconf.c +++ /dev/null @@ -1,280 +0,0 @@ -/* $OpenBSD: autoconf.c,v 1.13 2008/08/18 23:20:43 miod Exp $ */ -/* $NetBSD: autoconf.c,v 1.19 2002/06/01 15:33:22 ragge Exp $ */ -/* - * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden. - * 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 at Ludd, University of Lule}. - * 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. - */ - - /* All bugs are subject to removal without further notice */ - - - -#include <sys/param.h> - -#include <lib/libsa/stand.h> - -#include <machine/mtpr.h> -#include <machine/sid.h> -#include <machine/intr.h> -#include <machine/rpb.h> -#include <machine/scb.h> -#include <arch/vax/mbus/mbusreg.h> -#include <arch/vax/mbus/fwioreg.h> -#include "vaxstand.h" - -void autoconf(void); -void findcpu(void); -void consinit(void); -void scbinit(void); -void clkstart(void); -int getsecs(void); -void scb_stray(void *); -void scb_silent(void *); -void longjmp(int *); -void rtimer(void *); - -long *bootregs; - -/* - * Do some initial setup. Also create a fake RPB for net-booted machines - * that don't have an in-prom VMB. - */ - -void -autoconf(void) -{ - int copyrpb = 1; - int fromnet = (bootregs[12] != -1); - - findcpu(); /* Configures CPU variables */ - scbinit(); /* Setup interrupts */ - consinit(); /* Allow us to print out things */ - clkstart(); /* Fix interval clock etc */ - -#ifdef DEV_DEBUG - printf("Register contents:\n"); - for (copyrpb = 0; copyrpb < 13; copyrpb++) - printf("r%d: %lx\n", copyrpb, bootregs[copyrpb]); -#endif - switch (vax_boardtype) { - - case VAX_BTYP_780: - case VAX_BTYP_790: - case VAX_BTYP_8000: - case VAX_BTYP_9CC: - case VAX_BTYP_9RR: - case VAX_BTYP_1202: - if (fromnet == 0) - break; - copyrpb = 0; - bootrpb.devtyp = bootregs[0]; - bootrpb.adpphy = bootregs[1]; - bootrpb.csrphy = bootregs[2]; - bootrpb.unit = bootregs[3]; - bootrpb.rpb_bootr5 = bootregs[5]; - bootrpb.pfncnt = 0; - break; - - case VAX_BTYP_46: - case VAX_BTYP_48: - {int *map, i; - - /* Map all 16MB of I/O space to low 16MB of memory */ - map = (int *)0x700000; /* XXX */ - *(int *)0x20080008 = (int)map; /* XXX */ - for (i = 0; i < 0x8000; i++) - map[i] = 0x80000000 | i; - }break; - - break; - } - - if (copyrpb) { - struct rpb *prpb = (struct rpb *)bootregs[11]; - bcopy((caddr_t)prpb, &bootrpb, sizeof(struct rpb)); - if (prpb->iovec) { - bootrpb.iovec = (int)alloc(prpb->iovecsz); - bcopy((caddr_t)prpb->iovec, (caddr_t)bootrpb.iovec, - prpb->iovecsz); - } - } -} - -/* - * Clock handling routines, needed to do timing in standalone programs. - */ - -volatile int tickcnt; - -int -getsecs(void) -{ - return tickcnt/100; -} - -struct ivec_dsp **scb; -struct ivec_dsp *scb_vec; -extern struct ivec_dsp idsptch; -extern int jbuf[10]; -extern int mcheck_silent; - -static void -mcheck(void *arg) -{ - int off, *mfp = (int *)&arg; - - if (!mcheck_silent) { - off = (mfp[7]/4 + 8); - printf("Machine check, pc=%x, psl=%x\n", mfp[off], mfp[off+1]); - } - longjmp(jbuf); -} - -/* - * Init the SCB and set up a handler for all vectors in the lower space, - * to detect unwanted interrupts. - */ -void -scbinit(void) -{ - int i; - - /* - * Allocate space. We need one page for the SCB, and 128*20 == 2.5k - * for the vectors. The SCB must be on a page boundary. - */ - i = (int)alloc(VAX_NBPG + 128*sizeof(scb_vec[0])) + VAX_PGOFSET; - i &= ~VAX_PGOFSET; - - mtpr(i, PR_SCBB); - scb = (void *)i; - scb_vec = (struct ivec_dsp *)(i + VAX_NBPG); - - for (i = 0; i < 128; i++) { - scb[i] = &scb_vec[i]; - (int)scb[i] |= SCB_ISTACK; /* Only interrupt stack */ - scb_vec[i] = idsptch; - scb_vec[i].hoppaddr = scb_stray; - scb_vec[i].pushlarg = (void *) (i * 4); - scb_vec[i].ev = NULL; - } - scb_vec[4/4].hoppaddr = mcheck; - if (vax_boardtype == VAX_BTYP_60) - scb_vec[0x60/4].hoppaddr = scb_silent; -} - -void -clkstart(void) -{ - scb_vec[0xc0/4].hoppaddr = rtimer; - if (vax_boardtype != VAX_BTYP_VXT) - mtpr(-10000, PR_NICR); /* Load in count register */ - mtpr(0x800000d1, PR_ICCS); /* Start clock and enable interrupt */ - - if (vax_boardtype == VAX_BTYP_60) { - extern int ka60_ioslot; - - /* enable M-Bus clock in IOCSR */ - *(unsigned int *)(MBUS_SLOT_BASE(ka60_ioslot) + - FWIO_IOCSR_OFFSET) |= FWIO_IOCSR_CLKIEN; - } - - mtpr(20, PR_IPL); -} - -extern int sluttid, senast, skip; - -void -rtimer(void *arg) -{ - mtpr(31, PR_IPL); - tickcnt++; - mtpr(0xc1, PR_ICCS); - if (skip) - return; - if ((vax_boardtype == VAX_BTYP_46) || - (vax_boardtype == VAX_BTYP_48) || - (vax_boardtype == VAX_BTYP_49)) { - int nu = sluttid - getsecs(); - if (senast != nu) { - mtpr(20, PR_IPL); - longjmp(jbuf); - } - } -} - -#ifdef __ELF__ -#define IDSPTCH "idsptch" -#define EIDSPTCH "eidsptch" -#define CMN_IDSPTCH "cmn_idsptch" -#else -#define IDSPTCH "_idsptch" -#define EIDSPTCH "_eidsptch" -#define CMN_IDSPTCH "_cmn_idsptch" -#endif - -asm(" - .text - .align 2 - .globl " IDSPTCH ", " EIDSPTCH " -" IDSPTCH ": - pushr $0x3f - .word 0x9f16 - .long " CMN_IDSPTCH " - .long 0 - .long 0 - .long 0 -" EIDSPTCH ": - -" CMN_IDSPTCH ": - movl (sp)+,r0 - pushl 4(r0) - calls $1,*(r0) - popr $0x3f - rei -"); - -/* - * Stray interrupt handler. - * This function must _not_ save any registers (in the reg save mask). - */ -void -scb_stray(void *arg) -{ - static int vector, ipl; - - ipl = mfpr(PR_IPL); - vector = (int) arg; - printf("stray interrupt: vector 0x%x, ipl %d\n", vector, ipl); -} - -void -scb_silent(void *arg) -{ - /* nothing */ -} diff --git a/sys/arch/vax/boot/boot/boot.c b/sys/arch/vax/boot/boot/boot.c deleted file mode 100644 index 597185c079e..00000000000 --- a/sys/arch/vax/boot/boot/boot.c +++ /dev/null @@ -1,258 +0,0 @@ -/* $OpenBSD: boot.c,v 1.20 2011/07/06 18:32:59 miod Exp $ */ -/* $NetBSD: boot.c,v 1.18 2002/05/31 15:58:26 ragge Exp $ */ -/*- - * Copyright (c) 1982, 1986 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. 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 7.15 (Berkeley) 5/4/91 - */ - -#include <sys/param.h> -#include <sys/reboot.h> - -#include <lib/libkern/libkern.h> -#include <lib/libsa/stand.h> -#include <lib/libsa/loadfile.h> - -#include "machine/rpb.h" -#include "machine/sid.h" - -#include "vaxstand.h" - -/* - * Boot program... arguments passed in r10 and r11 determine - * whether boot stops to ask for system name and which device - * boot comes from. - */ - -char line[100]; -int bootdev, debug; -extern unsigned opendev; - -void usage(char *), boot(char *), halt(char *); -void Xmain(void); -void autoconf(void); -int getsecs(void); -int setjmp(int *); -int testkey(void); - -const struct vals { - char *namn; - void (*func)(char *); - char *info; -} val[] = { - {"?", usage, "Show this help menu"}, - {"help", usage, "Same as '?'"}, - {"boot", boot, "Load and execute file"}, - {"halt", halt, "Halts the system"}, - {0, 0}, -}; - -int jbuf[10]; -int sluttid, senast, skip, askname; -int mcheck_silent; -struct rpb bootrpb; - -void -Xmain(void) -{ - int io; - int j, nu; - char transition = '\010'; - u_long marks[MARK_MAX]; - - io = 0; - skip = 1; - autoconf(); - - /* - * Some VAXstation 4000 PROMs slowly erase the whole screen with \010 - * if running with glass console - at least VS4000/60 and VS4000/VLC; - * this is probably the LCG PROM at fault. Use a different transition - * pattern, it's not as nice but it does not take 3(!) seconds to - * display... - */ - if (((vax_boardtype == VAX_BTYP_46 && - (vax_siedata & 0xff) == VAX_VTYP_46) || - (vax_boardtype == VAX_BTYP_48 && - ((vax_siedata >> 8) & 0xff) == VAX_STYP_48)) && - (vax_confdata & 0x100) == 0) - transition = ' '; - - askname = bootrpb.rpb_bootr5 & RB_ASKNAME; - printf("\n\r>> OpenBSD/vax boot [%s] <<\n", "1.16"); - printf(">> Press enter to autoboot now, or any other key to abort: "); - sluttid = getsecs() + 5; - senast = 0; - skip = 0; - setjmp(jbuf); - for (;;) { - nu = sluttid - getsecs(); - if (senast != nu) - printf("%c%d", transition, nu); - if (nu <= 0) - break; - senast = nu; - if ((j = (testkey() & 0177))) { - skip = 1; - if (j != 10 && j != 13) { - printf("\nPress '?' for help"); - askname = 1; - } - break; - } - } - skip = 1; - printf("\n"); - - if (setjmp(jbuf)) - askname = 1; - - /* First try to autoboot */ - if (askname == 0) { - int err; - - errno = 0; - printf("> boot bsd\n"); - marks[MARK_START] = 0; - err = loadfile("bsd", marks, - LOAD_KERNEL|COUNT_KERNEL); - if (err == 0) { - machdep_start((char *)marks[MARK_ENTRY], - marks[MARK_NSYM], - (void *)marks[MARK_START], - (void *)marks[MARK_SYM], - (void *)marks[MARK_END]); - } - printf("bsd: boot failed: %s\n", strerror(errno)); - } - - /* If any key pressed, or autoboot failed, go to conversational boot */ - for (;;) { - const struct vals *v = &val[0]; - char *c, *d; - - printf("> "); - gets(line); - - c = line; - while (*c == ' ') - c++; - - if (c[0] == 0) - continue; - - if ((d = strchr(c, ' '))) - *d++ = 0; - - while (v->namn) { - if (strcmp(v->namn, c) == 0) - break; - v++; - } - if (v->namn) - (*v->func)(d); - else - printf("Unknown command: %s\n", c); - } -} - -void -halt(char *hej) -{ - asm("halt"); -} - -void -boot(char *arg) -{ - char *fn = "bsd"; - int howto, err; - u_long marks[MARK_MAX]; - - if (arg) { - while (*arg == ' ') - arg++; - - if (*arg != '-') { - fn = arg; - if ((arg = strchr(arg, ' '))) { - *arg++ = 0; - while (*arg == ' ') - arg++; - } else - goto load; - } - if (*arg != '-') { -fail: printf("usage: boot [filename] [-acsd]\n"); - return; - } - - howto = 0; - - while (*++arg) { - if (*arg == 'a') - howto |= RB_ASKNAME; - else if (*arg == 'c') - howto |= RB_CONFIG; - else if (*arg == 'd') - howto |= RB_KDB; - else if (*arg == 's') - howto |= RB_SINGLE; - else - goto fail; - } - bootrpb.rpb_bootr5 = howto; - } -load: - marks[MARK_START] = 0; - err = loadfile(fn, marks, LOAD_KERNEL|COUNT_KERNEL); - if (err == 0) { - machdep_start((char *)marks[MARK_ENTRY], - marks[MARK_NSYM], - (void *)marks[MARK_START], - (void *)marks[MARK_SYM], - (void *)marks[MARK_END]); - } - printf("Boot failed: %s\n", strerror(errno)); -} - -void -usage(char *hej) -{ - const struct vals *v = &val[0]; - int i; - - printf("Commands:\n"); - while (v->namn) { - printf("%s ", v->namn); - for (i = 1 + strlen(v->namn); (i & 7) != 0; i++) - printf(" "); - printf("%s\n", v->info); - v++; - } -} diff --git a/sys/arch/vax/boot/boot/conf.c b/sys/arch/vax/boot/boot/conf.c deleted file mode 100644 index ea8ad1df942..00000000000 --- a/sys/arch/vax/boot/boot/conf.c +++ /dev/null @@ -1,100 +0,0 @@ -/* $OpenBSD: conf.c,v 1.6 2011/07/06 18:32:59 miod Exp $ */ -/* $NetBSD: conf.c,v 1.10 2000/06/15 19:53:23 ragge Exp $ */ -/* - * Copyright (c) 1994 Ludd, University of Lule}, Sweden. - * 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 at Ludd, University of Lule}. - * 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. - */ - - /* All bugs are subject to removal without further notice */ - -#include "sys/param.h" - -#include <netinet/in.h> - -#include "../../include/rpb.h" - -#include "lib/libkern/libkern.h" - -#include "lib/libsa/stand.h" -#include "lib/libsa/ufs.h" -#include "lib/libsa/nfs.h" -#include "lib/libsa/cd9660.h" - -#include "vaxstand.h" - -static int nostrategy(void *, int, daddr32_t, size_t, void *, size_t *); - -struct devsw devsw[]={ - SADEV("qe",nostrategy, qeopen, qeclose, noioctl), /* DEQNA */ - SADEV("ra",rastrategy, raopen, nullsys, noioctl), - SADEV("mt",rastrategy, raopen, nullsys, noioctl), - SADEV("rom",romstrategy, romopen, nullsys, noioctl), - SADEV("hd",mfmstrategy, mfmopen, nullsys, noioctl), - SADEV("sd",romstrategy, romopen, nullsys, noioctl), - SADEV("sd",romstrategy, romopen, nullsys, noioctl), /* SDN */ - SADEV("sd",romstrategy, romopen, nullsys, noioctl), /* SDS */ - SADEV("st",nullsys, nullsys, nullsys, noioctl), - SADEV("le",nostrategy, leopen, leclose, noioctl), /* LANCE */ - SADEV("ze",nostrategy, zeopen, zeclose, noioctl), /* SGEC */ - SADEV("de",nostrategy, deopen, declose, noioctl), /* DEUNA */ -}; - -int cnvtab[] = { - BDEV_QE, - BDEV_UDA, - BDEV_TK, - -1, - BDEV_RD, - BDEV_SD, - BDEV_SDN, - BDEV_SDS, - BDEV_ST, - BDEV_LE, - BDEV_ZE, - BDEV_DE, -}; - -int ndevs = (sizeof(devsw)/sizeof(devsw[0])); - -struct fs_ops file_system[] = { - { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat }, - { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat }, - { cd9660_open, cd9660_close, cd9660_read, cd9660_write, - cd9660_seek, cd9660_stat }, -}; - -int nfsys = (sizeof(file_system) / sizeof(struct fs_ops)); - -int -nostrategy(void *f, int func, daddr32_t dblk, - size_t size, void *buf, size_t *rsize) -{ - *rsize = size; - bzero(buf, size); - return 0; -} diff --git a/sys/arch/vax/boot/boot/consio.c b/sys/arch/vax/boot/boot/consio.c deleted file mode 100644 index 09ccee06755..00000000000 --- a/sys/arch/vax/boot/boot/consio.c +++ /dev/null @@ -1,428 +0,0 @@ -/* $OpenBSD: consio.c,v 1.10 2008/08/18 23:20:44 miod Exp $ */ -/* $NetBSD: consio.c,v 1.13 2002/05/24 21:40:59 ragge Exp $ */ -/* - * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden. - * 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 at Ludd, University of Lule}. - * 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. - */ - - /* All bugs are subject to removal without further notice */ - -#include <sys/param.h> - -#include "../vax/gencons.h" - -#include "mtpr.h" -#include "sid.h" -#include "rpb.h" -#include "ka630.h" - -#include "data.h" - -#include <machine/cvax.h> -#include <arch/vax/mbus/mbusreg.h> - -void setup(void); - -static void (*put_fp)(int) = NULL; -static int (*get_fp)(void) = NULL; -static int (*test_fp)(void) = NULL; - -/* - * I/O using mtpr/mfpr - */ - -void pr_putchar(int c); -int pr_getchar(void); -int pr_testchar(void); - -/* - * I/O using ROM routines - */ - -void rom_putchar(int c); -int rom_getchar(void); -int rom_testchar(void); - -int rom_putc; /* ROM-address of put-routine */ -int rom_getc; /* ROM-address of get-routine */ - -/* - * I/O using the KA630 ROM console routines - */ - -/* Pointer to KA630 console page, initialized by ka630_consinit */ -unsigned char *ka630_conspage; -void ka630_consinit(void); - -void ka630_rom_putchar(int c); -int ka630_rom_getchar(void); -int ka630_rom_testchar(void); - -/* - * I/O using the KA53 ROM console routines - */ - -unsigned char *ka53_conspage; -void ka53_consinit(void); - -void ka53_rom_putchar(int c); -int ka53_rom_getchar(void); -int ka53_rom_testchar(void); - -/* - * I/O using the VXT2000 serial ports - */ - -void vxt_putchar(int c); -int vxt_getchar(void); -int vxt_testchar(void); - -/* - * I/O using the KA60 ROM console routines - */ - -unsigned char *ka60_conspage; -void ka60_consinit(void); - -void ka60_rom_putchar(int c); -int ka60_rom_getchar(void); -int ka60_rom_testchar(void); - -void putchar(int); -int getchar(void); -int testkey(void); -void consinit(void); -void _rtt(void); - -void -putchar(int c) -{ - (*put_fp)(c); - if (c == 10) - (*put_fp)(13); /* CR/LF */ -} - -int -getchar(void) -{ - int c; - - do - c = (*get_fp)() & 0177; - while (c == 17 || c == 19); /* ignore XON/XOFF */ - if (c < 96 && c > 64) - c += 32; /* force lowercase */ - return c; -} - -int -testkey(void) -{ - return (*test_fp)(); -} - -/* - * setup() is called out of the startup files (start.s, srt0.s) and - * initializes data which are globally used and is called before main(). - */ -void -consinit(void) -{ - put_fp = pr_putchar; /* Default */ - get_fp = pr_getchar; - test_fp = pr_testchar; - - /* - * According to the vax_boardtype (vax_cputype is not specific - * enough to do that) we decide which method/routines to use - * for console I/O. - * mtpr/mfpr are restricted to serial consoles, ROM-based routines - * support both serial and graphical consoles. - * We default to mtpr routines; so that we don't crash if - * it isn't a supported system. - */ - switch (vax_boardtype) { - - case VAX_BTYP_43: - case VAX_BTYP_410: - case VAX_BTYP_420: - put_fp = rom_putchar; - get_fp = rom_getchar; - test_fp = rom_testchar; - rom_putc = 0x20040058; /* 537133144 */ - rom_getc = 0x20040044; /* 537133124 */ - break; - - case VAX_BTYP_VXT: - put_fp = rom_putchar; - get_fp = vxt_getchar; - test_fp = vxt_testchar; - rom_putc = 0x20040058; /* 537133144 */ - rom_getc = 0x20040044; /* 537133124 */ - break; - - case VAX_BTYP_630: - ka630_consinit(); - break; - - case VAX_BTYP_46: - case VAX_BTYP_48: - case VAX_BTYP_49: - put_fp = rom_putchar; - get_fp = rom_getchar; - test_fp = rom_testchar; - rom_putc = 0x20040068; - rom_getc = 0x20040054; - break; - - case VAX_BTYP_1303: - ka53_consinit(); - break; - - case VAX_BTYP_60: - ka60_consinit(); - break; - -#ifdef notdef - case VAX_BTYP_630: - case VAX_BTYP_650: - case VAX_BTYP_9CC: - put_fp = pr_putchar; - get_fp = pr_getchar; - break -#endif - } - return; -} - -/* - * putchar() using MTPR - */ -void -pr_putchar(int c) -{ - int timeout = 1<<15; /* don't hang the machine! */ - - /* - * On KA88 we may get C-S/C-Q from the console. - * Must obey it. - */ - while (mfpr(PR_RXCS) & GC_DON) { - if ((mfpr(PR_RXDB) & 0x7f) == 19) { - while (1) { - while ((mfpr(PR_RXCS) & GC_DON) == 0) - ; - if ((mfpr(PR_RXDB) & 0x7f) == 17) - break; - } - } - } - - while ((mfpr(PR_TXCS) & GC_RDY) == 0) /* Wait until xmit ready */ - if (--timeout < 0) - break; - mtpr(c, PR_TXDB); /* xmit character */ -} - -/* - * getchar() using MFPR - */ -int -pr_getchar(void) -{ - while ((mfpr(PR_RXCS) & GC_DON) == 0) - ; /* wait for char */ - return (mfpr(PR_RXDB)); /* now get it */ -} - -int -pr_testchar(void) -{ - if (mfpr(PR_RXCS) & GC_DON) - return mfpr(PR_RXDB); - else - return 0; -} - -/* - * void ka630_consinit (void) ==> initialize KA630 ROM console I/O - */ -void ka630_consinit(void) -{ - short *NVR; - int i; - - /* Find the console page */ - NVR = (short *) KA630_NVR_ADRS; - - i = *NVR++ & 0xFF; - i |= (*NVR++ & 0xFF) << 8; - i |= (*NVR++ & 0xFF) << 16; - i |= (*NVR++ & 0xFF) << 24; - - ka630_conspage = (char *) i; - - /* Go to last row to minimize confusion */ - ka630_conspage[KA630_ROW] = ka630_conspage[KA630_MAXROW]; - ka630_conspage[KA630_COL] = ka630_conspage[KA630_MINCOL]; - - /* Use KA630 ROM console I/O routines */ - put_fp = ka630_rom_putchar; - get_fp = ka630_rom_getchar; - test_fp = ka630_rom_testchar; -} - - -/* - * void ka53_consinit (void) ==> initialize KA53 ROM console I/O - */ -void ka53_consinit(void) -{ - ka53_conspage = (char *) 0x2014044b; - - put_fp = ka53_rom_putchar; - get_fp = ka53_rom_getchar; - test_fp = ka53_rom_testchar; -} - -/* - * VXT2000 console routines. - * - * While we can use the rom putchar routine, the rom getchar routine - * will happily return the last key pressed, even if it is not pressed - * anymore. - * - * To guard against this, we monitor the keyboard serial port and will - * only invoke the rom function (which will do the keyboard layout - * translation for us) if there is indeed a new keyboard event (we still - * need to guard against dead keys, hence the while() condition in - * vxt_getchar). This still unfortunately causes phantom characters to - * appear when playing with the shift keys, but nothing backspace can't - * erase, so this will be a minor annoyance. - * - * If console is on the serial port, we do not use the prom routines at - * all. - */ -static volatile int *vxtregs = (int *)0x200A0000; - -#define CH_SRA 0x01 -#define CH_CRA 0x02 -#define CH_DATA 0x03 -#define CH_SRC 0x11 -#define CH_CRC 0x12 -#define CH_DATC 0x13 - -#define CR_RX_ENA 0x01 -#define CR_TX_ENA 0x04 -#define SR_RX_RDY 0x01 -#define SR_TX_RDY 0x04 - -int -vxt_getchar(void) -{ - if (vax_confdata & 2) { - vxtregs[CH_CRC] = CR_RX_ENA; - while ((vxtregs[CH_SRC] & SR_RX_RDY) == 0 || - rom_testchar() == 0) - ; - return rom_getchar(); - } else { - vxtregs[CH_CRA] = CR_RX_ENA; - while ((vxtregs[CH_SRA] & SR_RX_RDY) == 0) - ; - return vxtregs[CH_DATA]; - } -} - -int -vxt_testchar(void) -{ - if (vax_confdata & 2) { - vxtregs[CH_CRC] = CR_RX_ENA; - if ((vxtregs[CH_SRC] & SR_RX_RDY) == 0) - return 0; - return rom_testchar(); - } else { - vxtregs[CH_CRA] = CR_RX_ENA; - if ((vxtregs[CH_SRA] & SR_RX_RDY) == 0) - return 0; - return vxtregs[CH_DATA]; - } -} - -int ka60_ioslot = -1; - -/* - * void ka60_consinit (void) ==> initialize KA60 ROM console I/O - */ -void ka60_consinit(void) -{ - extern int jbuf[10]; - extern int mcheck_silent; - extern int setjmp(int *); - - int mid, fbicaddr; - uint32_t modtype, fbicrange; - - for (mid = 0; mid < MBUS_SLOT_MAX; mid++) { - fbicaddr = MBUS_SLOT_BASE(mid) + FBIC_BASE; - - if (setjmp(jbuf)) { - /* this slot is empty */ - continue; - } - mcheck_silent = 1; - modtype = *(uint32_t *)(fbicaddr + FBIC_MODTYPE); - mcheck_silent = 0; - - if ((modtype & MODTYPE_CLASS_MASK) >> MODTYPE_CLASS_SHIFT != - CLASS_IO) - continue; - - ka60_ioslot = mid; - - fbicrange = *(uint32_t *)(fbicaddr + FBIC_RANGE); - if (fbicrange == - ((HOST_TO_MBUS(CVAX_SSC) & RANGE_MATCH) | RANGE_ENABLE)) - break; - } - mcheck_silent = 0; - - if (ka60_ioslot < 0) { - /* - * This shouldn't happen. Try mid #5 (enclosure slot #4) as a - * supposedly sane default. - */ - ka60_ioslot = 5; - } - - ka60_conspage = (char *) *(unsigned int *)0x20140514; - put_fp = ka60_rom_putchar; - get_fp = ka60_rom_getchar; - test_fp = ka60_rom_testchar; -} diff --git a/sys/arch/vax/boot/boot/consio2.S b/sys/arch/vax/boot/boot/consio2.S deleted file mode 100644 index 77e42e11a8a..00000000000 --- a/sys/arch/vax/boot/boot/consio2.S +++ /dev/null @@ -1,160 +0,0 @@ -/* $OpenBSD: consio2.S,v 1.2 2008/08/12 17:23:21 miod Exp $ */ -/* $NetBSD: consio2.S,v 1.1 2002/02/24 01:04:24 matt Exp $ */ -/* - * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden. - * 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 at Ludd, University of Lule}. - * 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 <machine/asm.h> - -/* - * int rom_putchar (int c) ==> putchar() using ROM-routines - */ -ENTRY(rom_putchar, R2) - movl 4(ap), r2 # move argument to R2 - jsb *_C_LABEL(rom_putc) # write it - ret # that is all - - -/* - * int rom_getchar (void) ==> getchar() using ROM-routines - */ -ENTRY(rom_getchar, R1) -loop: # do { - jsb *_C_LABEL(rom_getc) # call the getc-routine - tstl r0 # check if char ready - beql loop # } while (R0 == 0) - movl r1, r0 # R1 holds char - ret # we are done - -ENTRY(rom_testchar, 0) - mnegl $1,r0 - jsb *_C_LABEL(rom_getc) - tstl r0 - beql 1f - movl r1,r0 -1: ret - -ENTRY(_rtt, 0) - halt - - -/* - * int ka630_rom_getchar (void) ==> getchar() using ROM-routines on KA630 - */ -ENTRY(ka630_rom_getchar, R11|R1) - movl _C_LABEL(ka630_conspage),r11 # load location of console page -1: # do { - jsb *0x1C(r11) # call the getc-routine (KA630_GETC) - blbc r0,1b # } while (R0 == 0) - movl r1,r0 # R1 holds char - ret # we are done - -ENTRY(ka630_rom_testchar, R3|R1) - movl _C_LABEL(ka630_conspage),r3 - jsb *0x1C(r3) - blbc r0,1f - movl r1,r0 -1: ret - -/* - * int ka630_rom_putchar (int c) ==> putchar() using ROM-routines on KA630 - */ -ENTRY(ka630_rom_putchar, R11|R1) - movl _C_LABEL(ka630_conspage),r11 - # load location of console page -1: # do { - jsb *0x20(r11) # is rom ready? (KA630_PUTC_POLL) - blbc r0,1b # } while (R0 == 0) - movl 4(ap),r1 # R1 holds char - jsb *0x24(r11) # output character (KA630_PUTC) - ret # we are done - -/* - * int ka53_rom_getchar (void) ==> getchar() using ROM-routines on KA53 - */ -ENTRY(ka53_rom_getchar, R11|R1) - movl _C_LABEL(ka53_conspage),r11 - # load location of console page -1: # do { - jsb *0x64(r11) # test for char - blbc r0,1b # } while (R0 == 0) - jsb *0x6c(r11) # get the char - ret # we are done - -ENTRY(ka53_rom_testchar, R3|R1) - movl _C_LABEL(ka53_conspage),r3 - jsb *0x64(r3) - blbc r0,1f - jsb *0x6c(r3) # get the char -1: ret - -/* - * int ka53_rom_putchar (int c) ==> putchar() using ROM-routines on KA53 - */ -ENTRY(ka53_rom_putchar, R11|R1) - movl _C_LABEL(ka53_conspage),r11 - # load location of console page -1: # do { - jsb *0x20(r11) # is rom ready? - blbc r0,1b # } whi le (R0 == 0) - movl 4(ap),r1 # R1 holds char - jsb *0x24(r11) # output character - ret # we are done - -/* - * int ka60_rom_getchar (void) ==> getchar() using ROM-routines on KA60 - */ -ENTRY(ka60_rom_getchar, R11|R10|R9|R8|R7|R6|R5|R4|R3|R2|R1) -1: - movl _C_LABEL(ka60_conspage),r0 - # load location of console page - # do { - jsb *0xfc(r0) # get the char, if any - blbc r0,1b # } while (R0 == 0) - movl r1,r0 - ret # we are done - -ENTRY(ka60_rom_testchar, R11|R10|R9|R8|R7|R6|R5|R4|R3|R2|R1) - movl _C_LABEL(ka60_conspage),r0 - jsb *0xfc(r0) - blbc r0,1f - movl r1,r0 -1: ret - -/* - * int ka60_rom_putchar (int c) ==> putchar() using ROM-routines on KA60 - */ -ENTRY(ka60_rom_putchar, R11|R10|R9|R8|R7|R6|R5|R4|R3|R2|R1) -1: - movl _C_LABEL(ka60_conspage),r0 - # load location of console page - movl 4(ap),r1 # R1 holds char - jsb *0x114(r0) # output character - blbc r0, 1b # failed? retry - ret # we are done diff --git a/sys/arch/vax/boot/boot/data.h b/sys/arch/vax/boot/boot/data.h deleted file mode 100644 index e91bfaf789d..00000000000 --- a/sys/arch/vax/boot/boot/data.h +++ /dev/null @@ -1,73 +0,0 @@ -/* $OpenBSD: data.h,v 1.2 2002/06/11 09:36:23 hugh Exp $ */ -/* $NetBSD: data.h,v 1.3 2001/07/26 15:05:09 wiz Exp $ */ -/* - * Copyright (c) 1995 Ludd, University of Lule}, Sweden. - * All rights reserved. - * - * This code is derived from software contributed to Ludd by - * Bertram Barth. - * - * 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 at Ludd, University of - * Lule}, Sweden and its contributors. - * 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. - */ - - /* All bugs are subject to removal without further notice */ - - - -/* - * rpb->iovec gives pointer to this structure. - * - * bqo->unit_init() is used to initialize the controller, - * bqo->qio() is used to read from boot-device - */ - -struct bqo { - long qio; /* 4 QIO entry */ - long map; /* 4 Mapping entry */ - long select; /* 4 Selection entry */ - long drivrname; /* 4 Offset to driver name */ - short version; /* 2 Version number of VMB */ - short vercheck; /* 2 Check field */ - /* offset: 20 */ - long reselect; /* 4 Reselection entry */ - long move; /* 4 Move driver entry */ - long unit_init; /* 4 Unit initialization entry */ - long auxdrname; /* 4 Offset to auxiliary driver name */ - long umr_dis; /* 4 UNIBUS Map Registers to disable */ - /* offset: 40 */ - long ucode; /* 4 Absolute address of booting microcode */ - long unit_disc; /* 4 Unit disconnecting entry */ - long devname; /* 4 Offset to boot device name */ - long umr_tmpl; /* 4 UNIBUS map register template */ - /* offset: 60 */ - /* - * the rest is unknown / unnecessary ... - */ - long xxx[6]; /* 24 -- total: 84 bytes */ -}; - -extern struct bqo *bqo; diff --git a/sys/arch/vax/boot/boot/devopen.c b/sys/arch/vax/boot/boot/devopen.c deleted file mode 100644 index 4a3bbe7b784..00000000000 --- a/sys/arch/vax/boot/boot/devopen.c +++ /dev/null @@ -1,182 +0,0 @@ -/* $OpenBSD: devopen.c,v 1.5 2011/07/06 18:32:59 miod Exp $ */ -/* $NetBSD: devopen.c,v 1.10 2002/05/24 21:40:59 ragge Exp $ */ -/* - * Copyright (c) 1997 Ludd, University of Lule}, Sweden. - * 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 at Ludd, University of - * Lule}, Sweden and its contributors. - * 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 <lib/libsa/stand.h> - -#include "machine/rpb.h" -#include "machine/sid.h" -#include "machine/pte.h" - -#include "vaxstand.h" - -int atoi(char *); -int nexaddr, csrbase; - -int -devopen(f, fname, file) - struct open_file *f; - const char *fname; - char **file; -{ - int dev, unit, ctlr, part, adapt, i, a[4], x; - int *mapregs; - struct devsw *dp; - extern int cnvtab[]; - char *s, *c; - - part = 0; - - /* - * Adaptor and controller are normally zero (or uninteresting), - * but we need to do some conversion here anyway (if it's a - * manual boot, but that's checked by the device driver). - * Set them to -1 to tell if it's a set number or default. - */ - dev = bootrpb.devtyp; - unit = bootrpb.unit; - adapt = ctlr = -1; - - if (dev == BDEV_KDB) - dev = BDEV_UDA; /* use the same driver */ - - for (i = 0, dp = 0; i < ndevs; i++) - if (cnvtab[i] == dev) - dp = devsw + i; - - if ((s = index((char *)fname, '('))) { - *s++ = 0; - - for (i = 0, dp = devsw; i < ndevs; i++, dp++) - if (dp->dv_name && strcmp(dp->dv_name, fname) == 0) - break; - - if (i == ndevs) { - printf("No such device - Configured devices are:\n"); - for (dp = devsw, i = 0; i < ndevs; i++, dp++) - if (dp->dv_name && (i == 0 || - strcmp(dp->dv_name, (dp[-1]).dv_name) != 0)) - printf(" %s", dp->dv_name); - printf("\n"); - return EINVAL; - } - - dev = cnvtab[i]; - if ((c = index(s, ')')) == 0) - goto usage; - *c++ = 0; - - /* - * If the user has specified sd(), we need to pick the - * correct BDEV_SDx value, depending on the machine type. - */ - if (dev == BDEV_SD) { - switch (vax_boardtype) { - case VAX_BTYP_46: - case VAX_BTYP_48: - case VAX_BTYP_49: - case VAX_BTYP_1303: - dev = BDEV_SDN; /* asc(4) */ - break; - case VAX_BTYP_60: - dev = BDEV_SDS; /* sii(4) */ - break; - } - } - - x = 0; - if (*s) do { - a[x++] = atoi(s); - while (*s >= '0' && *s <= '9') - s++; - - if (*s != ',' && *s != 0) - goto usage; - } while (*s++); - - if (x) - part = a[x - 1]; - if (x > 1) - unit = a[x - 2]; - if (x > 2) - ctlr = a[x - 3]; - if (x > 3) - adapt = a[0]; - *file = c; - } else { - *file = (char *)fname; - c = (char *)fname; - } - - if (!dp->dv_open) { - printf("Can't open device type %d\n", dev); - return ENXIO; - } - f->f_dev = dp; - bootrpb.unit = unit; - bootrpb.devtyp = dev; - - nexaddr = bootrpb.adpphy; - switch (vax_boardtype) { - case VAX_BTYP_610: - nexaddr = 0; /* No map regs */ - csrbase = 0x20000000; - break; - - case VAX_BTYP_VXT: - nexaddr = 0; - csrbase = bootrpb.csrphy; - break; - default: - nexaddr = 0; /* No map regs */ - csrbase = 0x20000000; - /* Always map in the lowest 4M on qbus-based machines */ - mapregs = (void *)0x20088000; - if (bootrpb.adpphy == 0x20087800) - for (i = 0; i < 8192; i++) - mapregs[i] = PG_V | i; - break; - } - -#ifdef DEV_DEBUG - printf("rpb.type %d rpb.unit %d rpb.csr %lx rpb.adp %lx\n", - bootrpb.devtyp, bootrpb.unit, bootrpb.csrphy, bootrpb.adpphy); - printf("adapter %d ctlr %d unit %d part %d\n", adapt, ctlr, unit, part); - printf("nexaddr %x csrbase %x\n", nexaddr, csrbase); -#endif - - return (*dp->dv_open)(f, adapt, ctlr, unit, part); - -usage: - printf("usage: dev(adapter,controller,unit,partition)file -asd\n"); - return EINVAL; -} diff --git a/sys/arch/vax/boot/boot/if_de.c b/sys/arch/vax/boot/boot/if_de.c deleted file mode 100644 index 3dd71bb6aa2..00000000000 --- a/sys/arch/vax/boot/boot/if_de.c +++ /dev/null @@ -1,295 +0,0 @@ -/* $OpenBSD: if_de.c,v 1.3 2011/07/06 18:32:59 miod Exp $ */ -/* $NetBSD: if_de.c,v 1.2 2002/05/24 21:41:40 ragge Exp $ */ - -/* - * Copyright (c) 2000 Ludd, University of Lule}, Sweden. 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 at Ludd, University of - * Lule}, Sweden and its contributors. - * 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. - * - * Standalone routine for the DEUNA Ethernet controller. - */ - -#include <sys/param.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/queue.h> - -#include <net/if.h> - -#include <netinet/in.h> -#include <netinet/in_systm.h> -#include <netinet/if_ether.h> - -#include <lib/libsa/netif.h> -#include <lib/libsa/stand.h> - -#include <arch/vax/if/if_dereg.h> - -#define DE_PCSR0 0 -#define DE_PCSR1 2 -#define DE_PCSR2 4 -#define DE_PCSR3 6 - -#include "arch/vax/include/sid.h" -#include "arch/vax/include/rpb.h" -#include "arch/vax/include/pte.h" - -#include "vaxstand.h" - -static int de_get(struct iodesc *, void *, size_t, time_t); -static int de_put(struct iodesc *, void *, size_t); -static void dewait(char *); - -struct netif_driver de_driver = { - 0, 0, 0, 0, de_get, de_put, -}; - -#define NRCV 8 /* allocate 8 receive descriptors */ -#define NXMT 4 /* and 4 transmit - must be >1 */ - -struct de_cdata { - /* the following structures are always mapped in */ - struct de_pcbb dc_pcbb; /* port control block */ - struct de_ring dc_xrent[NXMT]; /* transmit ring entries */ - struct de_ring dc_rrent[NRCV]; /* receive ring entries */ - struct de_udbbuf dc_udbbuf; /* UNIBUS data buffer */ - char dc_rbuf[NRCV][ETHER_MAX_LEN]; - char dc_xbuf[NXMT][ETHER_MAX_LEN]; - /* end mapped area */ -}; - -static volatile struct de_cdata *dc, *pdc; -static volatile char *addr; -static int crx, ctx; -#define DE_WCSR(csr, val) *(volatile u_short *)(addr + (csr)) = (val) -#define DE_WLOW(val) *(volatile u_char *)(addr + DE_PCSR0) = (val) -#define DE_WHIGH(val) *(volatile u_char *)(addr + DE_PCSR0 + 1) = (val) -#define DE_RCSR(csr) *(volatile u_short *)(addr + (csr)) -#define LOWORD(x) ((u_int)(x) & 0xffff) -#define HIWORD(x) (((u_int)(x) >> 16) & 0x3) -#define dereg(x) ((x) & 017777) - -int -deopen(struct open_file *f, int adapt, int ctlr, int unit, int part) -{ - int i, cdata, *map, npgs; - char eaddr[6]; - - /* point to the device in memory */ - if (askname == 0) /* Override if autoboot */ - addr = (char *)bootrpb.csrphy; - else { - addr = (char *)csrbase + dereg(0174510); - bootrpb.csrphy = (int)addr; - } -#ifdef DEV_DEBUG - printf("deopen: csrbase %x addr %p nexaddr %x\n", - csrbase, addr, nexaddr); -#endif - /* reset the device and wait for completion */ - DE_WCSR(DE_PCSR0, 0); - {volatile int j = 100; while (--j);} - DE_WCSR(DE_PCSR0, PCSR0_RSET); - dewait("reset"); - - /* Map in the control structures and buffers */ - dc = alloc(sizeof(struct de_cdata)); - (int)pdc = (int)dc & VAX_PGOFSET; - map = (int *)nexaddr + 512; - npgs = (sizeof(struct de_cdata) >> VAX_PGSHIFT) + 1; - cdata = (int)dc >> VAX_PGSHIFT; - for (i = 0; i < npgs; i++) { - map[i] = PG_V | (cdata + i); - } - - bzero((char *)dc, sizeof(struct de_cdata)); - - /* Tell the DEUNA about our PCB */ - DE_WCSR(DE_PCSR2, LOWORD(pdc)); - DE_WCSR(DE_PCSR3, HIWORD(pdc)); - DE_WLOW(CMD_GETPCBB); - dewait("pcbb"); - - /* Get our address */ - dc->dc_pcbb.pcbb0 = FC_RDPHYAD; - DE_WLOW(CMD_GETCMD); - dewait("read physaddr"); - bcopy((char *)&dc->dc_pcbb.pcbb2, eaddr, 6); - - /* Create and link the descriptors */ - for (i=0; i < NRCV; i++) { - volatile struct de_ring *rp = &dc->dc_rrent[i]; - - rp->r_lenerr = 0; - rp->r_segbl = LOWORD(&pdc->dc_rbuf[i][0]); - rp->r_segbh = HIWORD(&pdc->dc_rbuf[i][0]); - rp->r_flags = RFLG_OWN; - rp->r_slen = ETHER_MAX_LEN; - } - for (i=0; i < NXMT; i++) { - volatile struct de_ring *rp = &dc->dc_xrent[i]; - - rp->r_segbl = LOWORD(&pdc->dc_xbuf[i][0]); - rp->r_segbh = HIWORD(&pdc->dc_xbuf[i][0]); - rp->r_tdrerr = 0; - rp->r_flags = 0; - } - crx = ctx = 0; - - /* set the transmit and receive ring header addresses */ - dc->dc_pcbb.pcbb0 = FC_WTRING; - dc->dc_pcbb.pcbb2 = LOWORD(&pdc->dc_udbbuf); - dc->dc_pcbb.pcbb4 = HIWORD(&pdc->dc_udbbuf); - - dc->dc_udbbuf.b_tdrbl = LOWORD(&pdc->dc_xrent[0]); - dc->dc_udbbuf.b_tdrbh = HIWORD(&pdc->dc_xrent[0]); - dc->dc_udbbuf.b_telen = sizeof (struct de_ring) / sizeof(u_int16_t); - dc->dc_udbbuf.b_trlen = NXMT; - dc->dc_udbbuf.b_rdrbl = LOWORD(&pdc->dc_rrent[0]); - dc->dc_udbbuf.b_rdrbh = HIWORD(&pdc->dc_rrent[0]); - dc->dc_udbbuf.b_relen = sizeof (struct de_ring) / sizeof(u_int16_t); - dc->dc_udbbuf.b_rrlen = NRCV; - - DE_WLOW(CMD_GETCMD); - dewait("wtring"); - - dc->dc_pcbb.pcbb0 = FC_WTMODE; - dc->dc_pcbb.pcbb2 = MOD_DRDC|MOD_TPAD|MOD_HDX; - DE_WLOW(CMD_GETCMD); - dewait("wtmode"); - - DE_WLOW(CMD_START); - dewait("start"); - - DE_WLOW(CMD_PDMD); - dewait("initpoll"); - /* Should be running by now */ - - net_devinit(f, &de_driver, eaddr); - - return 0; -} - -int -de_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timeout) -{ - volatile int to = 100000 * timeout; - int len, csr0; - - if ((csr0 = DE_RCSR(DE_PCSR0)) & PCSR0_INTR) - DE_WHIGH(csr0 >> 8); -retry: - if (to-- == 0) - return 0; - - if (dc->dc_rrent[crx].r_flags & RFLG_OWN) - goto retry; - - if (dc->dc_rrent[crx].r_flags & RFLG_ERRS) - len = 0; - else - len = dc->dc_rrent[crx].r_lenerr & RERR_MLEN; - - if (len > maxlen) - len = maxlen; - if (len) - bcopy((char *)&dc->dc_rbuf[crx][0], pkt, len); - - dc->dc_rrent[crx].r_flags = RFLG_OWN; - dc->dc_rrent[crx].r_lenerr = 0; -#ifdef DEV_DEBUG - printf("Got packet: len %d idx %d maxlen %ld\n", len, crx, maxlen); -#endif - if (++crx == NRCV) - crx = 0; - - if (len == 0) - goto retry; - return len; -} - - -int -de_put(struct iodesc *desc, void *pkt, size_t len) -{ - volatile int to = 100000; - int csr0; - - if ((csr0 = DE_RCSR(DE_PCSR0)) & PCSR0_INTR) - DE_WHIGH(csr0 >> 8); -#ifdef DEV_DEBUG - printf("de_put: len %ld\n", len); -#endif -retry: - if (to-- == 0) - return -1; - - if (dc->dc_xrent[ctx].r_flags & RFLG_OWN) - goto retry; - - bcopy(pkt, (char *)&dc->dc_xbuf[ctx][0], len); - - dc->dc_xrent[ctx].r_slen = len; - dc->dc_xrent[ctx].r_tdrerr = 0; - dc->dc_xrent[ctx].r_flags = XFLG_OWN|XFLG_STP|XFLG_ENP; - - DE_WLOW(CMD_PDMD); - dewait("start"); - - if (++ctx == NXMT) - ctx = 0; - return len; -} - -int -declose(struct open_file *f) -{ - DE_WCSR(DE_PCSR0, PCSR0_RSET); - dewait("close"); - return 0; -} - -void -dewait(char *fn) -{ - int csr0; - -#ifdef DEV_DEBUG - printf("dewait: %s...", fn); -#endif - while ((DE_RCSR(DE_PCSR0) & PCSR0_INTR) == 0) - ; - csr0 = DE_RCSR(DE_PCSR0); - DE_WHIGH(csr0 >> 8); -#ifdef DEV_DEBUG - if (csr0 & PCSR0_PCEI) - printf("failed! CSR0 %x", csr0); - else - printf("done"); - printf(", PCSR1 %x\n", DE_RCSR(DE_PCSR1)); -#endif -} diff --git a/sys/arch/vax/boot/boot/if_le.c b/sys/arch/vax/boot/boot/if_le.c deleted file mode 100644 index e7860d97762..00000000000 --- a/sys/arch/vax/boot/boot/if_le.c +++ /dev/null @@ -1,407 +0,0 @@ -/* $OpenBSD: if_le.c,v 1.6 2008/08/18 23:20:44 miod Exp $ */ -/* $NetBSD: if_le.c,v 1.6 2000/05/20 13:30:03 ragge Exp $ */ -/* - * Copyright (c) 1997, 1999 Ludd, University of Lule}, Sweden. - * 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 at Ludd, University of - * Lule}, Sweden and its contributors. - * 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. - */ - -/* - * Standalone routine for MicroVAX LANCE chip. - */ - -#include <sys/param.h> -#include <sys/types.h> -#include <sys/queue.h> -#include <sys/socket.h> - -#include <net/if.h> - -#include <netinet/in.h> -#include <netinet/in_systm.h> -#include <netinet/if_ether.h> - -#include <machine/sid.h> -#include <machine/rpb.h> - -#include <lib/libsa/netif.h> -#include <lib/libsa/stand.h> - -#include <arch/vax/mbus/mbusreg.h> -#include <arch/vax/mbus/fwioreg.h> - -#include <dev/ic/am7990reg.h> - -#include "vaxstand.h" - -/* - * Buffer sizes. - */ -#define TLEN 1 -#define NTBUF (1 << TLEN) -#define RLEN 3 -#define NRBUF (1 << RLEN) -#define BUFSIZE 1518 - -#define ETHER_MIN_LEN 64 /* minimum frame length, including CRC */ - -#define QW_ALLOC(x) (((int)alloc((x) + 7) + 7) & ~7) - -static int le_get(struct iodesc *, void *, size_t, time_t); -static int le_put(struct iodesc *, void *, size_t); -static void copyout(void *from, int dest, int len); -static void copyin(int src, void *to, int len); - -struct netif_driver le_driver = { - 0, 0, 0, 0, le_get, le_put, -}; - -/* - * Init block & buffer descriptors according to DEC system - * specification documentation. - */ -struct initblock { - short ib_mode; - char ib_padr[6]; /* Ethernet address */ - int ib_ladrf1; - int ib_ladrf2; - int ib_rdr; /* Receive address */ - int ib_tdr; /* Transmit address */ -} *initblock = NULL; - -struct nireg { - volatile u_short ni_rdp; /* data port */ - volatile short ni_pad0; - volatile short ni_rap; /* register select port */ -} *nireg; - - -volatile struct buffdesc { - int bd_adrflg; - short bd_bcnt; - short bd_mcnt; -} *rdesc, *tdesc; - -static int addoff; -static int lebufaddr; - -/* Flags in the address field */ -#define BR_OWN 0x80000000 -#define BR_ERR 0x40000000 -#define BR_FRAM 0x20000000 -#define BR_OFLO 0x10000000 -#define BR_CRC 0x08000000 -#define BR_BUFF 0x04000000 -#define BR_STP 0x02000000 -#define BR_ENP 0x01000000 - -#define BT_OWN 0x80000000 -#define BT_ERR 0x40000000 -#define BT_MORE 0x10000000 -#define BT_ONE 0x08000000 -#define BT_DEF 0x04000000 -#define BT_STP 0x02000000 -#define BT_ENP 0x01000000 - -int next_rdesc, next_tdesc; - -#define LEWRCSR(port, val) { \ - nireg->ni_rap = (port); \ - nireg->ni_rdp = (val); \ -} - -#define LERDCSR(port) \ - (nireg->ni_rap = port, nireg->ni_rdp) - -int -leopen(struct open_file *f, int adapt, int ctlr, int unit, int part) -{ - int i, *ea; - volatile int to = 100000; - u_char eaddr[6]; - - next_rdesc = next_tdesc = 0; - - if (vax_boardtype == VAX_BTYP_650 && - ((vax_siedata >> 8) & 0xff) == VAX_SIE_KA640) { - lebufaddr = 0x20120000; - ea = (void *)0x20084200; - nireg = (void *)0x20084400; - } else if (vax_boardtype == VAX_BTYP_60) { - extern int ka60_ioslot; - lebufaddr = MBUS_SLOT_BASE(ka60_ioslot) + FWIO_LANCE_BUF_OFFSET; - ea = (int *)(MBUS_SLOT_BASE(ka60_ioslot) + FWIO_ESAR_OFFSET); - for (i = 0; i < 6; i++) { - eaddr[i] = *(u_char *)((int)ea + 2); - ea++; - } - ea = NULL; - nireg = (void *)(MBUS_SLOT_BASE(ka60_ioslot) + - FWIO_LANCE_REG_OFFSET); - } else { - *(int *)0x20080014 = 0; /* Be sure we do DMA in low 16MB */ - ea = (void *)0x20090000; /* XXX Ethernet address */ - nireg = (void *)0x200e0000; - } - if (askname == 0) /* Override if autoboot */ - nireg = (void *)bootrpb.csrphy; - else /* Tell kernel from where we booted */ - bootrpb.csrphy = (int)nireg; - - if (vax_boardtype == VAX_BTYP_43) - addoff = 0x28000000; - else - addoff = 0; -igen: - LEWRCSR(LE_CSR0, LE_C0_STOP); - while (to--) - ; - - if (ea != NULL) { - for (i = 0; i < 6; i++) - eaddr[i] = ea[i] & 0377; - } - - if (initblock == NULL) { - (void *)initblock = - (char *)QW_ALLOC(sizeof(struct initblock)) + addoff; - initblock->ib_mode = LE_MODE_NORMAL; - bcopy(eaddr, initblock->ib_padr, 6); - initblock->ib_ladrf1 = 0; - initblock->ib_ladrf2 = 0; - - (int)rdesc = QW_ALLOC(sizeof(struct buffdesc) * NRBUF) + addoff; - initblock->ib_rdr = (RLEN << 29) | (int)rdesc; - if (lebufaddr) - initblock->ib_rdr -= (int)initblock; - (int)tdesc = QW_ALLOC(sizeof(struct buffdesc) * NTBUF) + addoff; - initblock->ib_tdr = (TLEN << 29) | (int)tdesc; - if (lebufaddr) - initblock->ib_tdr -= (int)initblock; - if (lebufaddr) - copyout(initblock, 0, sizeof(struct initblock)); - - for (i = 0; i < NRBUF; i++) { - rdesc[i].bd_adrflg = QW_ALLOC(BUFSIZE) | BR_OWN; - if (lebufaddr) - rdesc[i].bd_adrflg -= (int)initblock; - rdesc[i].bd_bcnt = -BUFSIZE; - rdesc[i].bd_mcnt = 0; - } - if (lebufaddr) - copyout((void *)rdesc, (int)rdesc - (int)initblock, - sizeof(struct buffdesc) * NRBUF); - - for (i = 0; i < NTBUF; i++) { - tdesc[i].bd_adrflg = QW_ALLOC(BUFSIZE); - if (lebufaddr) - tdesc[i].bd_adrflg -= (int)initblock; - tdesc[i].bd_bcnt = 0xf000; - tdesc[i].bd_mcnt = 0; - } - if (lebufaddr) - copyout((void *)tdesc, (int)tdesc - (int)initblock, - sizeof(struct buffdesc) * NTBUF); - } - - if (lebufaddr) { - LEWRCSR(LE_CSR1, 0); - LEWRCSR(LE_CSR2, 0); - } else { - LEWRCSR(LE_CSR1, (int)initblock & 0xffff); - LEWRCSR(LE_CSR2, ((int)initblock >> 16) & 0xff); - } - - LEWRCSR(LE_CSR0, LE_C0_INIT); - - to = 100000; - while (to--) { - if (LERDCSR(LE_CSR0) & LE_C0_IDON) - break; - if (LERDCSR(LE_CSR0) & LE_C0_ERR) { - printf("lance init error: csr0 %x\n", LERDCSR(LE_CSR0)); - goto igen; - } - } - - LEWRCSR(LE_CSR0, LE_C0_INEA | LE_C0_STRT | LE_C0_IDON); - - net_devinit(f, &le_driver, eaddr); - return 0; -} - -int -le_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timeout) -{ - int csr, len; - volatile int to = 100000 * timeout; - -retry: - if (to-- == 0) - return 0; - - csr = LERDCSR(LE_CSR0); - LEWRCSR(LE_CSR0, csr & (LE_C0_BABL|LE_C0_MISS|LE_C0_MERR|LE_C0_RINT)); - - if (lebufaddr) - copyin((int)&rdesc[next_rdesc] - (int)initblock, - (void *)&rdesc[next_rdesc], sizeof(struct buffdesc)); - if (rdesc[next_rdesc].bd_adrflg & BR_OWN) - goto retry; - - if (rdesc[next_rdesc].bd_adrflg & BR_ERR) - len = 0; - else { - if ((len = rdesc[next_rdesc].bd_mcnt - 4) > maxlen) - len = maxlen; - - if (lebufaddr) - copyin((rdesc[next_rdesc].bd_adrflg&0xffffff), - pkt, len); - else - bcopy((char *)(rdesc[next_rdesc].bd_adrflg&0xffffff) + - addoff, pkt, len); - } - - rdesc[next_rdesc].bd_mcnt = 0; - rdesc[next_rdesc].bd_adrflg |= BR_OWN; - if (lebufaddr) - copyout((void *)&rdesc[next_rdesc], (int)&rdesc[next_rdesc] - - (int)initblock, sizeof(struct buffdesc)); - if (++next_rdesc >= NRBUF) - next_rdesc = 0; - - - if (len == 0) - goto retry; - return len; -} - -int -le_put(struct iodesc *desc, void *pkt, size_t len) -{ - volatile int to = 100000; - int csr; - -retry: - if (--to == 0) - return -1; - - csr = LERDCSR(LE_CSR0); - LEWRCSR(LE_CSR0, csr & (LE_C0_MISS|LE_C0_CERR|LE_C0_TINT)); - - if (lebufaddr) - copyin((int)&tdesc[next_tdesc] - (int)initblock, - (void *)&tdesc[next_tdesc], sizeof(struct buffdesc)); - if (tdesc[next_tdesc].bd_adrflg & BT_OWN) - goto retry; - - if (lebufaddr) - copyout(pkt, (tdesc[next_tdesc].bd_adrflg & 0xffffff), len); - else - bcopy(pkt, (char *)(tdesc[next_tdesc].bd_adrflg & 0xffffff) + - addoff, len); - tdesc[next_tdesc].bd_bcnt = - (len < ETHER_MIN_LEN ? -ETHER_MIN_LEN : -len); - tdesc[next_tdesc].bd_mcnt = 0; - tdesc[next_tdesc].bd_adrflg |= BT_OWN | BT_STP | BT_ENP; - if (lebufaddr) - copyout((void *)&tdesc[next_tdesc], (int)&tdesc[next_tdesc] - - (int)initblock, sizeof(struct buffdesc)); - - LEWRCSR(LE_CSR0, LE_C0_TDMD); - - to = 100000; - while (((LERDCSR(LE_CSR0) & LE_C0_TINT) == 0) && --to) - ; - - LEWRCSR(LE_CSR0, LE_C0_TINT); - if (++next_tdesc >= NTBUF) - next_tdesc = 0; - - if (to) - return len; - - return -1; -} - -int -leclose(struct open_file *f) -{ - LEWRCSR(LE_CSR0, LE_C0_STOP); - - return 0; -} - -void -copyout(void *f, int dest, int len) -{ - if (vax_boardtype == VAX_BTYP_60) { - u_char *from = f; - u_char *toaddr = (u_char *)lebufaddr + dest; - - while (len-- > 0) - *toaddr++ = *from++; - } else { - short *from = f; - short *toaddr; - - toaddr = (short *)lebufaddr + dest; - - while (len > 0) { - *toaddr = *from++; - toaddr += 2; - len -= 2; - } - } -} - -void -copyin(int src, void *f, int len) -{ - if (vax_boardtype == VAX_BTYP_60) { - u_char *to = f; - u_char *fromaddr; - - fromaddr = (u_char *)lebufaddr + src; - - while (len-- > 0) - *to++ = *fromaddr++; - } else { - short *to = f; - short *fromaddr; - - fromaddr = (short *)lebufaddr + src; - - while (len > 0) { - *to++ = *fromaddr; - fromaddr += 2; - len -= 2; - } - } -} diff --git a/sys/arch/vax/boot/boot/if_qe.c b/sys/arch/vax/boot/boot/if_qe.c deleted file mode 100644 index 36a6b30d376..00000000000 --- a/sys/arch/vax/boot/boot/if_qe.c +++ /dev/null @@ -1,259 +0,0 @@ -/* $OpenBSD: if_qe.c,v 1.3 2002/06/11 09:36:23 hugh Exp $ */ -/* $NetBSD: if_qe.c,v 1.3 2000/05/20 13:30:03 ragge Exp $ */ - -/* - * Copyright (c) 1998 Roar Thronæs. 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 Roar Thronæs. - * 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. - * - * Standalone routine for the DEQNA. - */ - -#include <sys/param.h> -#include <sys/types.h> - -#include <netinet/in.h> -#include <netinet/in_systm.h> - -#include <lib/libsa/netif.h> -#include <lib/libsa/stand.h> - -#include <arch/vax/if/if_qereg.h> - -#include "../include/rpb.h" - -#include "vaxstand.h" - -static int qe_get(struct iodesc *desc, void *pkt, size_t, time_t timeout); -static int qe_put(struct iodesc *desc, void *pkt, size_t); -static void qe_init(u_char *eaddr); - -struct netif_driver qe_driver = { - 0, 0, 0, 0, qe_get, qe_put, -}; - -#define NRCV 1 /* Receive descriptors */ -#define NXMT 1 /* Transmit descriptors */ - -#define QE_INTS (QE_RCV_INT | QE_XMIT_INT) -#define MAXPACKETSIZE 0x800 /* Because of (buggy) DEQNA */ - -static struct qe_softc { - struct qe_ring rring[NRCV+2]; /* Receive ring descriptors */ - struct qe_ring tring[NXMT+2]; /* Xmit ring descriptors */ - u_char setup_pkt[16][8]; /* Setup packet */ - char qein[2048], qeout[2048];/* Packet buffers */ -} qe_softc; - -static struct qe_softc *sc = &qe_softc; -static int addr; - -#define QE_WCSR(csr, val) \ - (*((volatile u_short *)(addr + (csr))) = (val)) -#define QE_RCSR(csr) \ - *((volatile u_short *)(addr + (csr))) -#define DELAY(x) {volatile int i = x;while (--i);} -#define LOWORD(x) ((int)(x) & 0xffff) -#define HIWORD(x) (((int)(x) >> 16) & 0x3f) -#define qereg(x) ((x) & 017777) - -int -qeopen(struct open_file *f, int adapt, int ctlr, int unit, int part) { - u_char eaddr[6]; - - if (askname == 0) - addr = bootrpb.csrphy; /* Autoboot; use RPB instead */ - else { - addr = 0x20000000; - if (unit == 0) - addr += qereg(0774440); /* XQA0 */ - else if (unit == 1) - addr += qereg(0174460); /* XQB0 */ - else - return ECTLR; - } - - qe_init(eaddr); - - net_devinit(f, &qe_driver, eaddr); - return 0; -} - -void -qe_init(u_char *eaddr) -{ - int i,j; - - QE_WCSR(QE_CSR_CSR, QE_RESET); - QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) & ~QE_RESET); - - for (i = 0; i < 6; i++) { - sc->setup_pkt[i][1] = QE_RCSR(i * 2); - sc->setup_pkt[i+8][1] = QE_RCSR(i * 2); - sc->setup_pkt[i][2] = 0xff; - sc->setup_pkt[i+8][2] = QE_RCSR(i * 2); - for (j=3; j < 8; j++) { - sc->setup_pkt[i][j] = QE_RCSR(i * 2); - sc->setup_pkt[i+8][j] = QE_RCSR(i * 2); - } - eaddr[i] = QE_RCSR(i * 2); - } - - bzero((caddr_t)sc->rring, sizeof(struct qe_ring)); - sc->rring->qe_buf_len = -64; - sc->rring->qe_addr_lo = (short)((int)sc->setup_pkt); - sc->rring->qe_addr_hi = (short)((int)sc->setup_pkt >> 16); - - bzero((caddr_t)sc->tring, sizeof(struct qe_ring)); - sc->tring->qe_buf_len = -64; - sc->tring->qe_addr_lo = (short)((int)sc->setup_pkt); - sc->tring->qe_addr_hi = (short)((int)sc->setup_pkt >> 16); - - sc->rring[0].qe_flag = sc->rring[0].qe_status1 = QE_NOTYET; - sc->rring->qe_addr_hi |= QE_VALID; - - sc->tring[0].qe_flag = sc->tring[0].qe_status1 = QE_NOTYET; - sc->tring->qe_addr_hi |= QE_VALID | QE_SETUP | QE_EOMSG; - - QE_WCSR(QE_CSR_CSR, QE_XMIT_INT | QE_RCV_INT); - - QE_WCSR(QE_CSR_RCLL, LOWORD(sc->rring)); - QE_WCSR(QE_CSR_RCLH, HIWORD(sc->rring)); - QE_WCSR(QE_CSR_XMTL, LOWORD(sc->tring)); - QE_WCSR(QE_CSR_XMTH, HIWORD(sc->tring)); - - while ((QE_RCSR(QE_CSR_CSR) & QE_INTS) != QE_INTS) - ; - QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) | QE_INTS); - QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) & ~(QE_INT_ENABLE|QE_ELOOP)); - QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) | QE_ILOOP); - - sc->rring[0].qe_addr_lo = (short)((int)sc->qein & 0xffff); - sc->rring[0].qe_addr_hi = (short)((int)sc->qein >> 16); - sc->rring[0].qe_buf_len=-MAXPACKETSIZE/2; - sc->rring[0].qe_addr_hi |= QE_VALID; - sc->rring[0].qe_flag=sc->rring[0].qe_status1=QE_NOTYET; - sc->rring[0].qe_status2=1; - - sc->rring[1].qe_addr_lo = 0; - sc->rring[1].qe_addr_hi = 0; - sc->rring[1].qe_flag=sc->rring[1].qe_status1=QE_NOTYET; - sc->rring[1].qe_status2=1; - - sc->tring[0].qe_addr_lo = (short)((int)sc->qeout & 0xffff); - sc->tring[0].qe_addr_hi = (short)((int)sc->qeout >> 16); - sc->tring[0].qe_buf_len=0; - sc->tring[0].qe_flag=sc->tring[0].qe_status1=QE_NOTYET; - sc->tring[0].qe_addr_hi |= QE_EOMSG|QE_VALID; - - sc->tring[1].qe_flag=sc->tring[1].qe_status1=QE_NOTYET; - sc->tring[1].qe_addr_lo = 0; - sc->tring[1].qe_addr_hi = 0; - - QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) | QE_RCV_ENABLE); - QE_WCSR(QE_CSR_RCLL, LOWORD(sc->rring)); - QE_WCSR(QE_CSR_RCLH, HIWORD(sc->rring)); -} - -int -qe_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timeout) { - int len, j; - -retry: - for(j = 0x10000;j && (QE_RCSR(QE_CSR_CSR) & QE_RCV_INT) == 0; j--) - ; - - if ((QE_RCSR(QE_CSR_CSR) & QE_RCV_INT) == 0) - goto fail; - - QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) & ~(QE_RCV_ENABLE|QE_XMIT_INT)); - - len= ((sc->rring[0].qe_status1 & QE_RBL_HI) | - (sc->rring[0].qe_status2 & QE_RBL_LO)) + 60; - - if (sc->rring[0].qe_status1 & 0xc000) - goto fail; - - if (len == 0) - goto retry; - - bcopy((void*)sc->qein,pkt,len); - - -end: - sc->rring[0].qe_status2 = sc->rring[1].qe_status2 = 1; - sc->rring[0].qe_flag=sc->rring[0].qe_status1=QE_NOTYET; - sc->rring[1].qe_flag=sc->rring[1].qe_status1=QE_NOTYET; - QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) | QE_RCV_ENABLE); - - QE_WCSR(QE_CSR_RCLL, LOWORD(sc->rring)); - QE_WCSR(QE_CSR_RCLH, HIWORD(sc->rring)); - return len; - -fail: len = -1; - goto end; -} - -int -qe_put(struct iodesc *desc, void *pkt, size_t len) { - int j; - - bcopy(pkt, (char *)sc->qeout, len); - sc->tring[0].qe_buf_len=-len/2; - sc->tring[0].qe_flag=sc->tring[0].qe_status1=QE_NOTYET; - sc->tring[1].qe_flag=sc->tring[1].qe_status1=QE_NOTYET; - - QE_WCSR(QE_CSR_XMTL, LOWORD(sc->tring)); - QE_WCSR(QE_CSR_XMTH, HIWORD(sc->tring)); - - for(j = 0; (j < 0x10000) && ((QE_RCSR(QE_CSR_CSR) & QE_XMIT_INT) == 0); j++) - ; - - if ((QE_RCSR(QE_CSR_CSR) & QE_XMIT_INT) == 0) { - char eaddr[6]; - - qe_init(eaddr); - return -1; - } - QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) & ~QE_RCV_INT); - - if (sc->tring[0].qe_status1 & 0xc000) { - char eaddr[6]; - - qe_init(eaddr); - return -1; - } - return len; -} - -int -qeclose(struct open_file *nif) -{ - QE_WCSR(QE_CSR_CSR, QE_RESET); - QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) & ~QE_RESET); - - return 0; -} diff --git a/sys/arch/vax/boot/boot/if_ze.c b/sys/arch/vax/boot/boot/if_ze.c deleted file mode 100644 index e0c6624e5a4..00000000000 --- a/sys/arch/vax/boot/boot/if_ze.c +++ /dev/null @@ -1,303 +0,0 @@ -/* $OpenBSD: if_ze.c,v 1.5 2006/08/24 22:10:36 miod Exp $ */ -/* $NetBSD: if_ze.c,v 1.12 2002/05/27 16:54:18 ragge Exp $ */ -/* - * Copyright (c) 1998 James R. Maynard III. 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 James R. Maynard III. - * 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. - * - * Standalone routine for the SGEC Ethernet controller. - */ - -#include <sys/param.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/queue.h> - -#include <net/if.h> - -#include <netinet/in.h> -#include <netinet/in_systm.h> -#include <netinet/if_ether.h> - -#include <lib/libsa/netif.h> -#include <lib/libsa/stand.h> -#include <lib/libsa/net.h> - -#include <arch/vax/if/sgecreg.h> - -#include "arch/vax/include/sid.h" -#include "arch/vax/include/rpb.h" - -#include "vaxstand.h" - -static int ze_get(struct iodesc *, void *, size_t, time_t); -static int ze_put(struct iodesc *, void *, size_t); - -#define ETHER_MIN_LEN 64 -#define ETHER_MAX_LEN 1518 - -struct netif_driver ze_driver = { - 0, 0, 0, 0, ze_get, ze_put, -}; - -#define NRCV 8 /* allocate 8 receive descriptors */ -#define NXMT 4 /* and 4 transmit - must be >1 */ -#define SETUP_FRAME_LEN 128 /* length of the setup frame */ - -/* allocate a buffer on an octaword boundary */ -#define OW_ALLOC(x) ((void *)((int)((int)alloc((x) + 15) + 15) & ~15)) - -static volatile struct zedevice *addr; - -struct ze_tdes *ze_tdes_list; /* transmit desc list */ -struct ze_rdes *ze_rdes_list; /* and receive desc list */ -u_char ze_myaddr[ETHER_ADDR_LEN]; /* my Ethernet address */ - -int -zeopen(struct open_file *f, int adapt, int ctlr, int unit, int part) -{ - u_long nicsr0_work, *nisa_rom; - struct ze_tdes *ze_setup_tdes_list; - int i; - - /* point to the device in memory */ - if (askname == 0) /* Override if autoboot */ - addr = (struct zedevice *)bootrpb.csrphy; - else - addr = (struct zedevice *)0x20008000; - - /* reset the device and wait for completion */ - addr->ze_nicsr6 = ZE_NICSR6_MBO | ZE_NICSR6_RE; - while ((addr->ze_nicsr5 & ZE_NICSR5_ID) == 0) - ; - if (addr->ze_nicsr5 & ZE_NICSR5_SF) { - printf("SGEC self-test failed...\n"); - return 1; - } - - /* Get our Ethernet address */ - if (vax_boardtype == VAX_BTYP_49) { - nisa_rom = (u_long *)0x27800000; - for (i=0; i<ETHER_ADDR_LEN; i++) - ze_myaddr[i] = nisa_rom[i] & 0377; - } else if (vax_boardtype == VAX_BTYP_VXT) { - nisa_rom = (u_long *)0x200c4000; - for (i=0; i<ETHER_ADDR_LEN; i++) - ze_myaddr[i] = nisa_rom[i] & 0xff; - } else { - nisa_rom = (u_long *)0x20084000; - for (i=0; i<ETHER_ADDR_LEN; i++) - if (vax_boardtype == VAX_BTYP_660) - ze_myaddr[i] = (nisa_rom[i] & 0xff000000) >> 24; - else - ze_myaddr[i] = (nisa_rom[i] & 0x0000ff00) >> 8; - } - printf("SGEC: Ethernet address %s", ether_sprintf(ze_myaddr)); - - /* initialize SGEC operating mode */ - /* disable interrupts here */ - nicsr0_work = ZE_NICSR0_IPL14 | ZE_NICSR0_SA | ZE_NICSR0_MBO | - (ZE_NICSR0_IV_MASK & 0x0108); - do { - addr->ze_nicsr0 = nicsr0_work; - } while (addr->ze_nicsr0 != nicsr0_work); - if (addr->ze_nicsr5 & ZE_NICSR5_ME) - addr->ze_nicsr5 |= ZE_NICSR5_ME; - /* reenable interrupts here */ - - /* Allocate space for descriptor lists and buffers, - then initialize them. Set up both lists as a ring. */ - ze_rdes_list = OW_ALLOC((NRCV+1) * sizeof(struct ze_rdes)); - ze_tdes_list = OW_ALLOC((NXMT+1) * sizeof(struct ze_tdes)); - for (i=0; i < NRCV; i++) { - bzero(ze_rdes_list+i,sizeof(struct ze_rdes)); - ze_rdes_list[i].ze_framelen = ZE_FRAMELEN_OW; - ze_rdes_list[i].ze_bufsize = ETHER_MAX_LEN; - ze_rdes_list[i].ze_bufaddr = alloc(ETHER_MAX_LEN); - } - bzero(ze_rdes_list+NRCV,sizeof(struct ze_rdes)); - ze_rdes_list[NRCV].ze_framelen = ZE_FRAMELEN_OW; - ze_rdes_list[NRCV].ze_rdes1 = ZE_RDES1_CA; - ze_rdes_list[NRCV].ze_bufaddr = (u_char *)ze_rdes_list; - for (i=0; i < NXMT; i++) { - bzero(ze_tdes_list+i,sizeof(struct ze_tdes)); - ze_tdes_list[i].ze_tdes1 = ZE_TDES1_FS | ZE_TDES1_LS; - ze_tdes_list[i].ze_bufsize = ETHER_MAX_LEN; - ze_tdes_list[i].ze_bufaddr = alloc(ETHER_MAX_LEN); - } - bzero(ze_tdes_list+NXMT,sizeof(struct ze_tdes)); - ze_tdes_list[NXMT].ze_tdes1 = ZE_TDES1_CA; - ze_tdes_list[NXMT].ze_tdr = ZE_TDR_OW; - ze_tdes_list[NXMT].ze_bufaddr = (u_char *)ze_tdes_list; - - printf("."); /* XXX VXT */ - - /* Build setup frame. We set the SGEC to do a - perfect filter on our own address. */ - ze_setup_tdes_list = OW_ALLOC(2*sizeof(struct ze_tdes)); - bzero(ze_setup_tdes_list+0,2*sizeof(struct ze_tdes)); - ze_setup_tdes_list[0].ze_tdr = ZE_TDR_OW; - ze_setup_tdes_list[0].ze_tdes1 = ZE_TDES1_DT_SETUP; - ze_setup_tdes_list[0].ze_bufsize = SETUP_FRAME_LEN; - ze_setup_tdes_list[0].ze_bufaddr = alloc(SETUP_FRAME_LEN); - bzero(ze_setup_tdes_list[0].ze_bufaddr,SETUP_FRAME_LEN); - for (i=0; i < 16; i++) - bcopy(ze_myaddr,ze_setup_tdes_list[0].ze_bufaddr+(8*i), - ETHER_ADDR_LEN); - ze_setup_tdes_list[1].ze_tdes1 = ZE_TDES1_CA; - ze_setup_tdes_list[1].ze_bufaddr = (u_char *)ze_setup_tdes_list; - - printf("."); /* XXX VXT */ - - /* Start the transmitter and initialize almost everything else. */ - addr->ze_nicsr4 = ze_setup_tdes_list; - addr->ze_nicsr6 = ZE_NICSR6_MBO | ZE_NICSR6_SE | ZE_NICSR6_ST | - ZE_NICSR6_DC | ZE_NICSR6_BL_4; - while ((addr->ze_nicsr5 & ZE_NICSR5_TS) != ZE_NICSR5_TS_SUSP) - ; /* wait for the frame to be processed */ - - printf("."); /* XXX VXT */ - - /* Setup frame is done processing, initialize the receiver and - point the transmitter to the real tdes list. */ - addr->ze_nicsr4 = ze_tdes_list; - addr->ze_nicsr3 = ze_rdes_list; - addr->ze_nicsr6 |= ZE_NICSR6_SR; - - /* And away-y-y we go! */ - - printf("\n"); - net_devinit(f, &ze_driver, ze_myaddr); - return 0; -} - -int -ze_get(desc, pkt, maxlen, timeout) - struct iodesc *desc; - void *pkt; - size_t maxlen; - time_t timeout; -{ - int timeout_ctr=100000*timeout, len, rdes; - - while (timeout_ctr-- > 0) { - - /* If there's not a packet waiting for us, just decrement the - timeout counter. */ - if (!(addr->ze_nicsr5 & ZE_NICSR5_RI)) - continue; - - /* Look through the receive descriptor list for the packet. */ - for (rdes=0; rdes<NRCV; rdes++) { - if (ze_rdes_list[rdes].ze_framelen & ZE_FRAMELEN_OW) - continue; - - /* If the packet has an error, ignore it. */ - if (ze_rdes_list[rdes].ze_rdes0 & ZE_RDES0_ES) - len = 0; - - /* Copy the packet, up to the length supplied by the caller, to - the caller's buffer. */ - else { - if ((len = (ze_rdes_list[rdes].ze_framelen & - (~ ZE_FRAMELEN_OW))) > maxlen) - len = maxlen; - bcopy((void *)ze_rdes_list[rdes].ze_bufaddr, - pkt,len); - } - - /* Give ownership of this descriptor back to the SGEC. */ - ze_rdes_list[rdes].ze_framelen = ZE_FRAMELEN_OW; - - /* If we actually got a good packet, reset the error flags and - tell the SGEC to look for more before returning. */ - if (len > 0) { - addr->ze_nicsr5=ZE_NICSR5_RU | ZE_NICSR5_RI | - ZE_NICSR5_IS; - addr->ze_nicsr2=ZE_NICSR2_RXPD; - return len; - } - } - } - - /* If we're going to return an error indication, at least reset the - error flags and tell the SGEC to keep receiving first. */ - addr->ze_nicsr5=ZE_NICSR5_RU | ZE_NICSR5_RI | ZE_NICSR5_IS; - addr->ze_nicsr2=ZE_NICSR2_RXPD; - return 0; -} - -int -ze_put(desc, pkt, len) - struct iodesc *desc; - void *pkt; - size_t len; -{ - int timeout=100000; - - /* The SGEC maintains its position in the transmit descriptor list - for the next frame to transmit. Unfortunately, there's no way to tell - from software just where that is. We're forced to reset the position - whenever we send a frame, which requires waiting for the previous - frame to be sent. Argh. */ - while ((addr->ze_nicsr5 & ZE_NICSR5_TS) == ZE_NICSR5_TS_RUN) - ; - - /* Copy the packet to the buffer we allocated. */ - bcopy(pkt, (void *)ze_tdes_list[0].ze_bufaddr, len); - - /* Set the packet length in the descriptor, increasing it to the - minimum size if needed. */ - ze_tdes_list[0].ze_bufsize = len; - if (len < ETHER_MIN_LEN) - ze_tdes_list[0].ze_bufsize = ETHER_MIN_LEN; - - /* Give ownership of the descriptor to the SGEC and tell it to start - transmitting. */ - ze_tdes_list[0].ze_tdr = ZE_TDR_OW; - addr->ze_nicsr4 = ze_tdes_list; - addr->ze_nicsr1 = ZE_NICSR1_TXPD; - - /* Wait for the frame to be sent, but not too long. */ - timeout = 100000; - while (((addr->ze_nicsr5 & ZE_NICSR5_TI) == 0) && (--timeout>0)) - ; - - /* Reset the transmitter interrupt pending flag. */ - addr->ze_nicsr5 |= ZE_NICSR5_TI; - - /* Return good if we didn't timeout, or error if we did. */ - if (timeout>0) return len; - return -1; -} - -int -zeclose(struct open_file *f) -{ - addr->ze_nicsr6 = ZE_NICSR6_RE; - - return 0; -} diff --git a/sys/arch/vax/boot/boot/mfm.c b/sys/arch/vax/boot/boot/mfm.c deleted file mode 100644 index 5a3eb017a1f..00000000000 --- a/sys/arch/vax/boot/boot/mfm.c +++ /dev/null @@ -1,650 +0,0 @@ -/* $OpenBSD: mfm.c,v 1.5 2011/03/13 00:13:53 deraadt Exp $ */ -/* $NetBSD: mfm.c,v 1.4 2001/07/26 22:55:13 wiz Exp $ */ -/* - * Copyright (c) 1996 Ludd, University of Lule}, Sweden. - * All rights reserved. - * - * This code is derived from software contributed to Ludd by - * Bertram Barth. - * - * 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 at Ludd, University of - * Lule}, Sweden and its contributors. - * 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. - */ - -/* - * ToDo: - * - * - insert appropriate delays for diskette-drive where needed - * - allow more than one sector per diskette-read - * - check for and handle bad sectors - * - ??? - */ - -#include "sys/param.h" -#include "sys/reboot.h" -#include "sys/disklabel.h" - -#include "lib/libsa/stand.h" -#include "lib/libsa/ufs.h" - -#include "../include/pte.h" -#include "../include/sid.h" -#include "../include/mtpr.h" -#include "../include/reg.h" -#include "../include/rpb.h" - -#include "ka410.h" -#include "../vsa/hdc9224.h" - -#include "data.h" -#include "vaxstand.h" - -#define MAX_WAIT (1000*1000) /* # of loop-instructions in seconds */ - -struct mfm_softc { - int part; - int unit; -}; - -static struct disklabel mfmlabel; -static struct mfm_softc mfm_softc; -static char io_buf[DEV_BSIZE]; - -/* - * These should probably be somewhere else, but ka410 is the only - * one with mfm disks anyway... - */ -volatile unsigned char *ka410_intreq = (void*)0x2008000f; -volatile unsigned char *ka410_intclr = (void*)0x2008000f; -volatile unsigned char *ka410_intmsk = (void*)0x2008000c; - -static volatile struct hdc9224_DKCreg *dkc = (void *) 0x200c0000; -static volatile struct hdc9224_UDCreg sreg; /* input */ -static volatile struct hdc9224_UDCreg creg; /* output */ - -static void sreg_read(void); -static void creg_write(void); -static int mfm_rxprepare(void); -static int mfm_command(int cmd); -static int mfm_rxselect(int unit); -static int mfm_rdselect(int unit); -static int mfm_rxstrategy(void *f, int func, daddr32_t dblk, size_t size, void *buf, size_t *rsize); -static int mfm_rdstrategy(void *f, int func, daddr32_t dblk, size_t size, void *buf, size_t *rsize); -/* - * we have to wait 0.7 usec between two accesses to any of the - * dkc-registers, on a VS2000 with 1 MIPS, this is roughly one - * instruction. Thus the loop-overhead will be enough... - */ -static void -sreg_read(void) -{ - int i; - char *p; - - dkc->dkc_cmd = 0x40; /* set internal counter to zero */ - p = (void *) &sreg; - for (i = 0; i < 10; i++) - *p++ = dkc->dkc_reg; /* dkc_reg auto-increments */ -} - -static void -creg_write(void) -{ - int i; - char *p; - - dkc->dkc_cmd = 0x40; /* set internal counter to zero */ - p = (void *) &creg; - for (i = 0; i < 10; i++) - dkc->dkc_reg = *p++; /* dkc_reg auto-increments */ -} - -/* - * floppies are handled in a quite strange way by this controller... - * - * before reading/writing a sector from/to floppy, we use the SEEK/READ_ID - * command to place the head at the desired location. Then we wait some - * time before issuing the real command in order to let the drive become - * ready... - */ -int -mfm_rxprepare(void) -{ - int error; - - error = mfm_command(DKC_CMD_SEEKREADID | 0x04); /* step=1, verify=0 */ - if (error) { - printf("error while stepping to position %d/%d/%x. Retry...\n", - creg.udc_dsect, creg.udc_dhead, creg.udc_dcyl); - error = mfm_command(DKC_CMD_SEEKREADID | 0x04); - } - return error; -} - -int -mfm_rxselect(int unit) -{ - int error; - - /* - * bring "creg" in some known-to-work state and - * select the drive with the DRIVE SELECT command. - */ - creg.udc_dma7 = 0; - creg.udc_dma15 = 0; - creg.udc_dma23 = 0; - creg.udc_dsect = 1; /* sectors are numbered 1..15 !!! */ - creg.udc_dhead = 0; - creg.udc_dcyl = 0; - creg.udc_scnt = 0; - - creg.udc_rtcnt = UDC_RC_RX33READ; - creg.udc_mode = UDC_MD_RX33; - creg.udc_term = UDC_TC_FDD; - - /* - * this is ... - */ - error = mfm_command(DKC_CMD_DRSEL_RX33 | unit); - - if ((error != 0) || ((sreg.udc_dstat & UDC_DS_READY) == 0)) { - printf("\nfloppy-drive not ready (new floppy inserted?)\n\n"); - - creg.udc_rtcnt &= ~UDC_RC_INVRDY; /* clear INVRDY-flag */ - error = mfm_command(DKC_CMD_DRSEL_RX33 | unit); - if ((error != 0) || ((sreg.udc_dstat & UDC_DS_READY) == 0)) { - printf("diskette not ready(1): %x/%x\n", - error, sreg.udc_dstat); - printf("floppy-drive offline?\n"); - return (-1); - } - if (sreg.udc_dstat & UDC_DS_TRK00) - error = mfm_command(DKC_CMD_STEPIN_FDD); - else - error = mfm_command(DKC_CMD_STEPOUT_FDD); - - /* - * now ready should be 0, cause INVRDY is not set - * (retrying a command makes this fail...) - */ - if ((error != 0) || ((sreg.udc_dstat & UDC_DS_READY) == 1)) { - printf("diskette not ready(2): %x/%x\n", - error, sreg.udc_dstat); - } - creg.udc_rtcnt |= UDC_RC_INVRDY; - error = mfm_command(DKC_CMD_DRSEL_RX33 | unit); - - if ((error != 0) || ((sreg.udc_dstat & UDC_DS_READY) == 0)) { - printf("diskette not ready(3): %x/%x\n", - error, sreg.udc_dstat); - printf("no floppy inserted or floppy-door open\n"); - return (-1); - } - printf("floppy-drive reselected.\n"); - } - return (error); -} - -int -mfm_rdselect(int unit) -{ - int error; - - /* - * bring "creg" in some known-to-work state and - * select the drive with the DRIVE SELECT command. - */ - creg.udc_dma7 = 0; - creg.udc_dma15 = 0; - creg.udc_dma23 = 0; - creg.udc_dsect = 0; /* sectors are numbered 0..16 */ - creg.udc_dhead = 0; - creg.udc_dcyl = 0; - creg.udc_scnt = 0; - - creg.udc_rtcnt = UDC_RC_HDD_READ; - creg.udc_mode = UDC_MD_HDD; - creg.udc_term = UDC_TC_HDD; - - error = mfm_command(DKC_CMD_DRSEL_HDD | unit); - - return (error); -} - -static int mfm_retry = 0; - -int -mfm_command(int cmd) -{ - int termcode, ready, i; - - creg_write(); /* write command-registers */ - *ka410_intclr = INTR_DC; - dkc->dkc_cmd = cmd; /* issue command */ - for (i = 0; i < MAX_WAIT; i++) { - if (*ka410_intreq & INTR_DC) /* wait for interrupt */ - break; - } - if ((*ka410_intreq & INTR_DC) == 0) - printf("timeout in mfm_command...\n"); - - sreg_read(); /* read status-registers */ - - if (dkc->dkc_stat == (DKC_ST_DONE | DKC_TC_SUCCESS)) - return (0); - - if (sreg.udc_cstat & UDC_CS_ECCERR) { - printf( -"\nspurious(?) ECC/CRC error at s%d/t%d/c%d [s%d/t%d/c%d(%d)]\n", - sreg.udc_csect, sreg.udc_chead, sreg.udc_ccyl, - creg.udc_dsect, creg.udc_dhead, creg.udc_dcyl,creg.udc_scnt); - if (sreg.udc_csect != creg.udc_dsect + creg.udc_scnt - 1) { - printf("DMA: %x %x %x [%x]\n", - sreg.udc_dma23, sreg.udc_dma15, - sreg.udc_dma7, 512 * (sreg.udc_csect - - creg.udc_dsect)); - creg.udc_scnt = creg.udc_scnt - - (sreg.udc_csect - creg.udc_dsect) - 1; - creg.udc_dsect = sreg.udc_csect + 1; - creg.udc_dma23 = sreg.udc_dma23; - creg.udc_dma15 = sreg.udc_dma15 + 2; - creg.udc_dma7 = 0; - printf("Retry starting from s%d/t%d/c%d (%d). ", - creg.udc_dsect, creg.udc_dhead, creg.udc_dcyl, - creg.udc_scnt); - } - goto retry; - } - termcode = (dkc->dkc_stat & DKC_ST_TERMCOD) >> 3; - ready = sreg.udc_dstat & UDC_DS_READY; - - printf("cmd:0x%x: termcode=0x%x, status=0x%x, cstat=0x%x, dstat=0x%x\n", - cmd, termcode, dkc->dkc_stat, sreg.udc_cstat, sreg.udc_dstat); - - if (dkc->dkc_stat & DKC_ST_BADSECT) - printf("bad sector found: s%d/t%d/c%d\n", creg.udc_dsect, - creg.udc_dhead, creg.udc_dcyl); -retry: - if ((mfm_retry == 0) && (sreg.udc_cstat & UDC_CS_RETREQ)) { - mfm_retry = 1; - printf("Retrying... "); - mfm_command(cmd); - printf("Retry done.\n"); - mfm_retry = 0; - } - return ((dkc->dkc_stat & DKC_ST_TERMCOD) >> 3); -} - -/* - * on-disk geometry block - */ -#define _aP __attribute__ ((packed)) /* force byte-alignment */ - -volatile struct mfm_xbn { - char mbz[10];/* 10 bytes of zero */ - long xbn_count _aP; /* number of XBNs */ - long dbn_count _aP; /* number of DBNs */ - long lbn_count _aP; /* number of LBNs (Logical-Block-Numbers) */ - long rbn_count _aP; /* number of RBNs (Replacement-Block-Numbers) */ - short nspt; /* number of sectors per track */ - short ntracks;/* number of tracks */ - short ncylinders; /* number of cylinders */ - short precomp;/* first cylinder for write precompensation */ - short reduced;/* first cylinder for reduced write current */ - short seek_rate; /* seek rate or zero for buffered - * seeks */ - short crc_eec;/* 0 if CRC is being used or 1 if ECC is - * being used */ - short rct; /* "replacement control table" (RCT) */ - short rct_ncopies; /* number of copies of the RCT */ - long media_id _aP; /* media identifier */ - short interleave; /* sector-to-sector interleave */ - short headskew; /* head-to-head skew */ - short cylskew;/* cylinder-to-cylinder skew */ - short gap0_size; /* size of GAP 0 in the MFM format */ - short gap1_size; /* size of GAP 1 in the MFM format */ - short gap2_size; /* size of GAP 2 in the MFM format */ - short gap3_size; /* size of GAP 3 in the MFM format */ - short sync_value; /* sync value used to start a track - * when formatting */ - char reserved[32]; /* reserved for use by the RQDX1/2/3 - * formatter */ - short serial_number; /* serial number */ - char fill[412]; /* Filler bytes to the end of the - * block */ - short checksum; /* checksum over the XBN */ -} mfm_xbn; - -#ifdef verbose -display_xbn(struct mfm_xbn *p) -{ - printf("**DiskData** XBNs: %d, DBNs: %d, LBNs: %d, RBNs: %d\n", - p->xbn_count, p->dbn_count, p->lbn_count, p->rbn_count); - printf("sect/track: %d, tracks: %d, cyl: %d, precomp/reduced: %d/%d\n", - p->nspt, p->ntracks, p->ncylinders, p->precomp, p->reduced); - printf("seek-rate: %d, crc/eec: %s, RCT: %d, RCT-copies: %d\n", - p->seek_rate, p->crc_eec ? "EEC" : "CRC", p->rct, p->rct_ncopies); - printf("media-ID: 0x%x, interleave: %d, headskew: %d, cylskew: %d\n", - &p->media_id, p->interleave, p->headskew, p->cylskew); - printf("gap0: %d, gap1: %d, gap2: %d, gap3: %d, sync-value: %d\n", - p->gap0_size, p->gap1_size, p->gap2_size, p->gap3_size, - p->sync_value); - printf("serial: %d, checksum: %d, size: %d, reserved: %32c\n", - p->serial_number, p->checksum, sizeof(*p), p->reserved); -} -#endif - -int -mfmopen(struct open_file *f, int adapt, int ctlr, int unit, int part) -{ - char *msg; - struct disklabel *lp = &mfmlabel; - struct mfm_softc *msc = &mfm_softc; - int err; - size_t i; - - bzero(lp, sizeof(struct disklabel)); - msc->unit = unit; - msc->part = part; - - err = mfmstrategy(msc, F_READ, LABELSECTOR, DEV_BSIZE, io_buf, &i); - if (err) { - printf("reading disklabel: %s\n", strerror(err)); - return 0; - } - msg = getdisklabel(io_buf + LABELOFFSET, lp); - if (msg) - printf("getdisklabel: %s\n", msg); - - f->f_devdata = (void *) msc; - - { -#ifdef verbose - int k; - unsigned char *ucp; - struct mfm_xbn *xp; -#endif - - /* mfmstrategy(msc, F_READ, -16, 8192, io_buf, &i); */ - mfmstrategy(msc, F_READ, -16, 512, io_buf, &i); -#ifdef verbose - printf("dumping raw disk-block #0:\n"); - ucp = io_buf; - for (k = 0; k < 128; k++) { - if (ucp[k] < 0x10) - printf("0"); - printf("%x ", ucp[k]); - if (k % 8 == 7) - printf(" "); - if (k % 16 == 15) - printf("\n"); - } - printf("\n"); - - xp = (void *) io_buf; - display_xbn(xp); - printf("\n"); -#endif - } - - if (unit == 2) { /* floppy! */ - if (lp->d_ntracks != 2) { -#ifdef verbose - printf("changing number of tracks from %d to %d.\n", - lp->d_ntracks, 2); -#endif - lp->d_ntracks = 2; - } - } else { /* hard-disk */ - unsigned short *usp = (void *) io_buf; -#ifdef verbose - printf("label says: s/t/c = %d/%d/%d\n", - lp->d_nsectors, lp->d_ntracks, lp->d_ncylinders); -#endif - if (lp->d_nsectors != usp[13]) { -#ifdef verbose - printf("changing number of sectors from %d to %d.\n", - lp->d_nsectors, usp[13]); -#endif - lp->d_nsectors = usp[13]; - } - if (lp->d_ntracks != usp[14]) { -#ifdef verbose - printf("changing number of heads/tracks from %d to %d.\n", - lp->d_ntracks, usp[14]); -#endif - lp->d_ntracks = usp[14]; - } - if (lp->d_ncylinders != usp[15]) { -#ifdef verbose - printf("changing number of cylinders from %d to %d.\n", - lp->d_ncylinders, usp[15]); -#endif - lp->d_ncylinders = usp[15]; - } - lp->d_secpercyl = lp->d_nsectors * lp->d_ntracks; - } - - return (0); -} - -int -mfm_rxstrategy(void *f, int func, daddr32_t dblk, size_t size, void *buf, size_t *rsize) -{ - struct mfm_softc *msc = f; - struct disklabel *lp; - int block, sect, head, cyl, scount, res; - - lp = &mfmlabel; - block = (dblk < 0 ? 0 : dblk + lp->d_partitions[msc->part].p_offset); - - mfm_rxselect(msc->unit); - - /* - * if label is empty, assume RX33 - */ - if (lp->d_nsectors == 0) - lp->d_nsectors = 15; - if (lp->d_ntracks == 0) - lp->d_ntracks = 2; - if (lp->d_secpercyl == 0) - lp->d_secpercyl = 30; - - bzero((void *) 0x200D0000, size); - scount = size / 512; - - while (scount) { - /* - * prepare drive/operation parameter - */ - cyl = block / lp->d_secpercyl; - sect = block % lp->d_secpercyl; - head = sect / lp->d_nsectors; - sect = sect % lp->d_nsectors; - - /* - * *rsize = 512; one sector after the other - * ... - */ - *rsize = 512 * min(scount, lp->d_nsectors - sect); - - /* - * now initialize the register values ... - */ - creg.udc_dma7 = 0; - creg.udc_dma15 = 0; - creg.udc_dma23 = 0; - - creg.udc_dsect = sect + 1; /* sectors are numbered 1..15 - * !!! */ - head |= (cyl >> 4) & 0x70; - creg.udc_dhead = head; - creg.udc_dcyl = cyl; - - creg.udc_scnt = *rsize / 512; - - if (func == F_WRITE) { - creg.udc_rtcnt = UDC_RC_RX33WRT; - creg.udc_mode = UDC_MD_RX33; - creg.udc_term = UDC_TC_FDD; - - mfm_rxprepare(); - /* copy from buf */ - bcopy(buf, (void *) 0x200D0000, *rsize); - res = mfm_command(DKC_CMD_WRITE_RX33); - } else { - creg.udc_rtcnt = UDC_RC_RX33READ; - creg.udc_mode = UDC_MD_RX33; - creg.udc_term = UDC_TC_FDD; - - mfm_rxprepare(); - /* clear disk buffer */ - bzero((void *) 0x200D0000, *rsize); - res = mfm_command(DKC_CMD_READ_RX33); - /* copy to buf */ - bcopy((void *) 0x200D0000, buf, *rsize); - } - - scount -= *rsize / 512; - block += *rsize / 512; - (char *)buf += *rsize; - } - - *rsize = size; - return 0; -} - -int -mfm_rdstrategy(void *f, int func, daddr32_t dblk, size_t size, void *buf, size_t *rsize) -{ - struct mfm_softc *msc = f; - struct disklabel *lp; - int block, sect, head, cyl, scount, cmd, res; - - lp = &mfmlabel; - block = (dblk < 0 ? 0 : dblk + lp->d_partitions[msc->part].p_offset); - - /* - * if label is empty, assume RD32 (XXX this must go away!!!) - */ - if (lp->d_nsectors == 0) - lp->d_nsectors = 17; - if (lp->d_ntracks == 0) - lp->d_ntracks = 6; - if (lp->d_secpercyl == 0) - lp->d_secpercyl = 102; - - mfm_rdselect(msc->unit); - - bzero((void *) 0x200D0000, size); - scount = size / 512; - - while (scount) { - /* - * prepare drive/operation parameter - */ - cyl = block / lp->d_secpercyl; - sect = block % lp->d_secpercyl; - head = sect / lp->d_nsectors; - sect = sect % lp->d_nsectors; - - if (dblk < 0) { -#ifdef verbose - printf("using raw diskblock-data!\n"); - printf("block %d, dblk %d ==> cyl %d, head %d, sect %d\n", - block, dblk, cyl, sect, head); -#endif - } else - cyl += 1; /* first cylinder is reserved for - * controller! */ - - *rsize = 512 * min(scount, lp->d_nsectors - sect); - /* - * now re-initialize the register values ... - */ - creg.udc_dma7 = 0; - creg.udc_dma15 = 0; - creg.udc_dma23 = 0; - - creg.udc_dsect = sect; - head |= (cyl >> 4) & 0x70; - creg.udc_dhead = head; - creg.udc_dcyl = cyl; - - creg.udc_scnt = *rsize / 512; - - if (func == F_WRITE) { - creg.udc_rtcnt = UDC_RC_HDD_WRT; - creg.udc_mode = UDC_MD_HDD; - creg.udc_term = UDC_TC_HDD; - cmd = DKC_CMD_WRITE_HDD; - - bcopy(buf, (void *) 0x200D0000, *rsize); - res = mfm_command(cmd); - } else { - creg.udc_rtcnt = UDC_RC_HDD_READ; - creg.udc_mode = UDC_MD_HDD; - creg.udc_term = UDC_TC_HDD; - cmd = DKC_CMD_READ_HDD; - - bzero((void *) 0x200D0000, *rsize); - res = mfm_command(cmd); - bcopy((void *) 0x200D0000, buf, *rsize); - } - - scount -= *rsize / 512; - block += *rsize / 512; - (char *)buf += *rsize; - } - - /* - * unselect the drive ... - */ - mfm_command(DKC_CMD_DRDESELECT); - - *rsize = size; - return 0; -} - -int -mfmstrategy(void *f, int func, daddr32_t dblk, size_t size, void *buf, size_t *rsize) -{ - struct mfm_softc *msc = f; - int res = -1; - - switch (msc->unit) { - case 0: - case 1: - res = mfm_rdstrategy(f, func, dblk, size, buf, rsize); - break; - case 2: - res = mfm_rxstrategy(f, func, dblk, size, buf, rsize); - break; - default: - printf("invalid unit %d in mfmstrategy()\n", msc->unit); - } - return (res); -} diff --git a/sys/arch/vax/boot/boot/netio.c b/sys/arch/vax/boot/boot/netio.c deleted file mode 100644 index 90245c03140..00000000000 --- a/sys/arch/vax/boot/boot/netio.c +++ /dev/null @@ -1,186 +0,0 @@ -/* $OpenBSD: netio.c,v 1.5 2008/06/26 05:42:13 ray Exp $ */ -/* $NetBSD: netio.c,v 1.6 2000/05/26 20:16:46 ragge Exp $ */ - -/*- - * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * 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 "lib/libsa/stand.h" -#include "lib/libsa/net.h" -#include "lib/libsa/netif.h" -#include "lib/libsa/bootparam.h" -#include "lib/libsa/nfs.h" -#include "lib/libsa/bootp.h" - -#include "vaxstand.h" - -static struct iodesc desc; -static int inited = 0; - -struct iodesc * -socktodesc(sock) -{ - return &desc; -} - -int -net_devinit(struct open_file *f, struct netif_driver *drv, u_char *eaddr) { - static struct netif best_if; - struct iodesc *s; - int r; - - if (inited) - return 0; - /* find a free socket */ - s = &desc; - - bzero(s, sizeof(*s)); - best_if.nif_driver = drv; - s->io_netif = &best_if; - bcopy(eaddr, s->myea, 6); - - /* - * 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 SUPPORT_BOOTP - - /* Get boot info using BOOTP way. (RFC951, RFC1048) */ - printf("Trying BOOTP\n"); - bootp(0); - - if (myip.s_addr) { - printf("Using IP address: %s\n", inet_ntoa(myip)); - - printf("myip: %s (%s)\n", hostname, inet_ntoa(myip)); - } else - -#endif /* SUPPORT_BOOTP */ - { -#ifdef SUPPORT_BOOTPARAMS - /* Get boot info using RARP and Sun bootparams. */ - - printf("Trying BOOTPARAMS\n"); - /* Get our IP address. (rarp.c) */ - if (rarp_getipaddress(0) == -1) - return (errno); - - printf("boot: client IP address: %s\n", inet_ntoa(myip)); - - /* Get our hostname, server IP address. */ - if (bp_whoami(0)) - return (errno); - - printf("boot: client name: %s\n", hostname); - - /* Get the root pathname. */ - if (bp_getfile(0, "root", &rootip, rootpath)) - return (errno); -#endif - } - printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath); - f->f_devdata = s; - - /* Get the NFS file handle (mount). */ - r = nfs_mount(0, rootip, rootpath); - if (r) - return r; - - inited = 1; - return 0; -} - -ssize_t -netif_put(struct iodesc *desc, void *pkt, size_t len) -{ - return (*desc->io_netif->nif_driver->netif_put)(desc, pkt, len); -} - -ssize_t -netif_get(struct iodesc *desc, void *pkt, size_t len, time_t timo) -{ - return (*desc->io_netif->nif_driver->netif_get)(desc, pkt, len, timo); -} diff --git a/sys/arch/vax/boot/boot/ra.c b/sys/arch/vax/boot/boot/ra.c deleted file mode 100644 index dbb0efca4ce..00000000000 --- a/sys/arch/vax/boot/boot/ra.c +++ /dev/null @@ -1,292 +0,0 @@ -/* $OpenBSD: ra.c,v 1.5 2011/07/06 18:32:59 miod Exp $ */ -/* $NetBSD: ra.c,v 1.11 2002/06/04 15:13:55 ragge Exp $ */ -/* - * Copyright (c) 1995 Ludd, University of Lule}, Sweden. - * 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 at Ludd, University of Lule}. - * 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. - */ - - /* All bugs are subject to removal without further notice */ - -#define NRSP 1 /* Kludge */ -#define NCMD 1 /* Kludge */ - -#include "sys/param.h" -#include "sys/disklabel.h" - -#include "lib/libsa/stand.h" - -#include "../include/pte.h" -#include "../include/rpb.h" - -#include "arch/vax/mscp/mscp.h" -#include "arch/vax/mscp/mscpreg.h" - -#include "vaxstand.h" - -static void command(int, int); - -/* - * These routines for RA disk standalone boot is wery simple, - * assuming a lots of thing like that we only working at one ra disk - * a time, no separate routines for uba driver etc.. - * This code is foolish and should need a cleanup. - * But it works :) - */ - -static volatile struct uda { - struct mscp_1ca uda_ca; /* communications area */ - struct mscp uda_rsp; /* response packets */ - struct mscp uda_cmd; /* command packets */ -} uda; - -static struct disklabel ralabel; -static char io_buf[DEV_BSIZE]; -static int dpart, dunit, is_tmscp, curblock; -static volatile u_short *ra_ip, *ra_sa, *ra_sw; -static volatile u_int *mapregs; - -int -raopen(struct open_file *f, int adapt, int ctlr, int unit, int part) -{ - static volatile struct uda *ubauda; - unsigned short johan, johan2; - size_t i; - int err; - char *msg; - -#ifdef DEV_DEBUG - printf("raopen: adapter %d ctlr %d unit %d part %d\n", - adapt, ctlr, unit, part); - printf("raopen: csrbase %x nexaddr %x\n", csrbase, nexaddr); -#endif - bzero(&ralabel, sizeof(struct disklabel)); - bzero((void *)&uda, sizeof(struct uda)); - if (bootrpb.devtyp == BDEV_TK) - is_tmscp = 1; - dunit = unit; - dpart = part; - if (ctlr < 0) - ctlr = 0; - curblock = 0; - /* Assume uda-alike adapter */ - if (askname == 0) { - csrbase = bootrpb.csrphy; - dunit = bootrpb.unit; - nexaddr = bootrpb.adpphy; - } else - csrbase += (ctlr ? 000334 : 012150); - ra_ip = (short *)csrbase; - ra_sa = ra_sw = (short *)csrbase + 1; - if (nexaddr) { /* have map registers */ - mapregs = (int *)nexaddr + 512; - mapregs[494] = PG_V | (((u_int)&uda) >> 9); - mapregs[495] = mapregs[494] + 1; - (char *)ubauda = (char *)0x3dc00 + - (((u_int)(&uda))&0x1ff); - } else - ubauda = &uda; - johan = (((u_int)ubauda) & 0xffff) + 8; - johan2 = (((u_int)ubauda) >> 16) & 077; - *ra_ip = 0; /* Start init */ - bootrpb.csrphy = csrbase; - -#ifdef DEV_DEBUG - printf("start init\n"); -#endif - /* Init of this uda */ - while ((*ra_sa & MP_STEP1) == 0) - ; -#ifdef DEV_DEBUG - printf("MP_STEP1..."); -#endif - *ra_sw = 0x8000; - while ((*ra_sa & MP_STEP2) == 0) - ; -#ifdef DEV_DEBUG - printf("MP_STEP2..."); -#endif - - *ra_sw = johan; - while ((*ra_sa & MP_STEP3) == 0) - ; -#ifdef DEV_DEBUG - printf("MP_STEP3..."); -#endif - - *ra_sw = johan2; - while ((*ra_sa & MP_STEP4) == 0) - ; -#ifdef DEV_DEBUG - printf("MP_STEP4\n"); -#endif - - *ra_sw = 0x0001; - uda.uda_ca.ca_rspdsc = (int)&ubauda->uda_rsp.mscp_cmdref; - uda.uda_ca.ca_cmddsc = (int)&ubauda->uda_cmd.mscp_cmdref; - if (is_tmscp) { - uda.uda_cmd.mscp_un.un_seq.seq_addr = - (long *)&uda.uda_ca.ca_cmddsc; - uda.uda_rsp.mscp_un.un_seq.seq_addr = - (long *)&uda.uda_ca.ca_rspdsc; - uda.uda_cmd.mscp_vcid = 1; - uda.uda_cmd.mscp_un.un_sccc.sccc_ctlrflags = 0; - } - - command(M_OP_SETCTLRC, 0); - uda.uda_cmd.mscp_unit = dunit; - command(M_OP_ONLINE, 0); - - if (is_tmscp) { - if (part) { -#ifdef DEV_DEBUG - printf("Repos of tape..."); -#endif - uda.uda_cmd.mscp_un.un_seq.seq_buffer = part; - command(M_OP_POS, 0); - uda.uda_cmd.mscp_un.un_seq.seq_buffer = 0; -#ifdef DEV_DEBUG - printf("Done!\n"); -#endif - } - return 0; - } -#ifdef DEV_DEBUG - printf("reading disklabel\n"); -#endif - err = rastrategy(0, F_READ, LABELSECTOR, DEV_BSIZE, io_buf, &i); - if(err){ - printf("reading disklabel: %s\n",strerror(err)); - return 0; - } - -#ifdef DEV_DEBUG - printf("getting disklabel\n"); -#endif - msg = getdisklabel(io_buf+LABELOFFSET, &ralabel); - if (msg) - printf("getdisklabel: %s\n", msg); - return(0); -} - -static void -command(int cmd, int arg) -{ - volatile short hej; - int to; - -igen: uda.uda_cmd.mscp_opcode = cmd; - uda.uda_cmd.mscp_modifier = arg; - - uda.uda_cmd.mscp_msglen = MSCP_MSGLEN; - uda.uda_rsp.mscp_msglen = MSCP_MSGLEN; - uda.uda_ca.ca_rspdsc |= MSCP_OWN|MSCP_INT; - uda.uda_ca.ca_cmddsc |= MSCP_OWN|MSCP_INT; -#ifdef DEV_DEBUG - printf("sending cmd %x...", cmd); -#endif - hej = *ra_ip; - to = 10000000; - while (uda.uda_ca.ca_rspdsc < 0) { -// if (uda.uda_ca.ca_cmdint) -// uda.uda_ca.ca_cmdint = 0; - if (--to < 0) { -#ifdef DEV_DEBUG - printf("timing out, retry\n"); -#endif - goto igen; - } - } -#ifdef DEV_DEBUG - printf("sent.\n"); -#endif -} - -int -rastrategy(void *f, int func, daddr32_t dblk, - size_t size, void *buf, size_t *rsize) -{ - u_int pfnum, mapnr, nsize; - -#ifdef DEV_DEBUG - printf("rastrategy: buf %p is_tmscp %d\n", - buf, is_tmscp); -#endif - pfnum = (u_int)buf >> VAX_PGSHIFT; - - for(mapnr = 0, nsize = size; (nsize + VAX_NBPG) > 0; nsize -= VAX_NBPG) - mapregs[mapnr++] = PG_V | pfnum++; - uda.uda_cmd.mscp_seq.seq_buffer = ((u_int)buf) & 0x1ff; - - if (is_tmscp) { - int i; - - /* - * First position tape. Remember where we are. - */ - if (dblk < curblock) { - uda.uda_cmd.mscp_seq.seq_bytecount = curblock - dblk; - command(M_OP_POS, 12); /* 12 == step block backward */ - } else { - uda.uda_cmd.mscp_seq.seq_bytecount = dblk - curblock; - command(M_OP_POS, 4); /* 4 == step block forward */ - } - curblock = size/512 + dblk; - - /* - * Read in the number of blocks we need. - * Why doesn't read of multiple blocks work????? - */ - for (i = 0 ; i < size/512 ; i++) { - uda.uda_cmd.mscp_seq.seq_lbn = 1; - uda.uda_cmd.mscp_seq.seq_bytecount = 512; - uda.uda_cmd.mscp_seq.seq_buffer = - (((u_int)buf) & 0x1ff) + i * 512; - uda.uda_cmd.mscp_unit = dunit; - command(M_OP_READ, 0); - } - } else { - - uda.uda_cmd.mscp_seq.seq_lbn = - dblk + ralabel.d_partitions[dpart].p_offset; - uda.uda_cmd.mscp_seq.seq_bytecount = size; - uda.uda_cmd.mscp_unit = dunit; -#ifdef DEV_DEBUG - printf("rastrategy: blk 0x%lx count %lx unit %x\n", - uda.uda_cmd.mscp_seq.seq_lbn, size, dunit); -#endif -#ifdef notdef - if (func == F_WRITE) - command(M_OP_WRITE, 0); - else -#endif - command(M_OP_READ, 0); - } - - *rsize = size; - return 0; -} diff --git a/sys/arch/vax/boot/boot/rom.c b/sys/arch/vax/boot/boot/rom.c deleted file mode 100644 index 31ebeb7b314..00000000000 --- a/sys/arch/vax/boot/boot/rom.c +++ /dev/null @@ -1,117 +0,0 @@ -/* $OpenBSD: rom.c,v 1.5 2011/03/13 00:13:53 deraadt Exp $ */ -/* $NetBSD: rom.c,v 1.3 2000/07/19 00:58:25 matt Exp $ */ -/* - * Copyright (c) 1996 Ludd, University of Lule}, Sweden. - * All rights reserved. - * - * This code is derived from software contributed to Ludd by - * Bertram Barth. - * - * 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 at Ludd, University of - * Lule}, Sweden and its contributors. - * 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 "sys/disklabel.h" - -#include "lib/libsa/stand.h" -#include "lib/libsa/ufs.h" - -#include "../include/pte.h" -#include "../include/sid.h" -#include "../include/mtpr.h" -#include "../include/reg.h" -#include "../include/rpb.h" - -#include "data.h" -#include "vaxstand.h" - -static struct disklabel romlabel; -static char io_buf[DEV_BSIZE]; -static struct bqo *bqo; -static int dpart, dunit; - -int -romopen(struct open_file *f, int adapt, int ctlr, int unit, int part) -{ - char *msg; - struct disklabel *lp = &romlabel; - size_t i; - int err; - - bqo = (void *)bootrpb.iovec; - - if (bootrpb.unit > 0 && (bootrpb.unit % 100) == 0) { - printf ("changing bootrpb.unit from %d ", bootrpb.unit); - bootrpb.unit /= 100; - printf ("to %d\n", bootrpb.unit); - } - - bzero(lp, sizeof(struct disklabel)); - dunit = unit; - dpart = part; - - err = romstrategy(0, F_READ, LABELSECTOR, DEV_BSIZE, io_buf, &i); - if (err) { - printf("reading disklabel: %s\n",strerror(err)); - return 0; - } - msg = getdisklabel(io_buf+LABELOFFSET, lp); - if (msg) - printf("getdisklabel: %s\n",msg); - return(0); -} - -int romwrite_uvax(int, int, void *, struct rpb *); -int romread_uvax(int, int, void *, struct rpb *); - -int -romstrategy (f, func, dblk, size, buf, rsize) - void *f; - int func; - daddr32_t dblk; - size_t size; - void *buf; - size_t *rsize; -{ - struct disklabel *lp; - int block; - - lp = &romlabel; - block = dblk + lp->d_partitions[dpart].p_offset; - if (dunit >= 0 && dunit < 10) - bootrpb.unit = dunit; - - if (func == F_WRITE) - romwrite_uvax(block, size, buf, &bootrpb); - else - romread_uvax(block, size, buf, &bootrpb); - - *rsize = size; - return 0; -} - diff --git a/sys/arch/vax/boot/boot/vaxstand.h b/sys/arch/vax/boot/boot/vaxstand.h deleted file mode 100644 index c8b41c4bfab..00000000000 --- a/sys/arch/vax/boot/boot/vaxstand.h +++ /dev/null @@ -1,77 +0,0 @@ -/* $OpenBSD: vaxstand.h,v 1.3 2011/07/06 18:32:59 miod Exp $ */ -/* $NetBSD: vaxstand.h,v 1.5 2000/06/15 19:53:23 ragge Exp $ */ -/* - * Copyright (c) 1994 Ludd, University of Lule}, Sweden. - * 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 at Ludd, University of Lule}. - * 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. - */ - -/* Variables used in autoconf */ -extern int askname; -extern struct rpb bootrpb; -extern int csrbase, nexaddr; - -/* devsw type definitions, used in bootxx and conf */ -#define SADEV(name,strategy,open,close,ioctl) \ - { (char *)name, \ - (int(*)(void *, int, daddr32_t, size_t, void *, size_t *))strategy, \ - (int(*)(struct open_file *, ...))open, \ - (int(*)(struct open_file *))close, \ - (int(*)(struct open_file *,u_long, void *))ioctl} - -#define SDELAY(count) {volatile int i; for (i = count; i; i--);} -/* - * Easy-to-use definitions - */ -#ifndef min -#define min(x,y) (x < y ? x : y) -#endif /* min */ - -struct netif_driver; - -char *index(char *, int); -int net_devinit(struct open_file *f, struct netif_driver *drv, u_char *eaddr); - -/* device calls */ -int raopen(struct open_file *, int, int, int, int), - rastrategy(void *, int, daddr32_t, size_t, void *, size_t *); -int romopen(struct open_file *, int, int, int, int), - romstrategy(void *, int, daddr32_t, size_t, void *, size_t *); -int mfmopen(struct open_file *, int, int, int, int), - mfmstrategy(void *, int, daddr32_t, size_t, void *, size_t *); -int sdopen(struct open_file *), - sdstrategy(void *, int, daddr32_t, size_t, void *, size_t *); -int leopen(struct open_file *, int, int, int, int), - leclose(struct open_file *); -int qeopen(struct open_file *, int, int, int, int), - qeclose(struct open_file *); -int zeopen(struct open_file *, int, int, int, int), - zeclose(struct open_file *); -int deopen(struct open_file *, int, int, int, int), - declose(struct open_file *); -int netopen(struct open_file *), netclose(struct open_file *); - diff --git a/sys/arch/vax/boot/boot/version b/sys/arch/vax/boot/boot/version deleted file mode 100644 index fafc63cb8a6..00000000000 --- a/sys/arch/vax/boot/boot/version +++ /dev/null @@ -1,40 +0,0 @@ -$OpenBSD: version,v 1.9 2011/07/06 18:32:59 miod Exp $ -$NetBSD: version,v 1.4 2001/11/09 19:53:15 scw Exp $ - -NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this -file is important - make sure the entries are appended on end, last item -is taken as the current. - -1.0: Initial import. -1.1: Bunch of small fixes to make boot work on most VAXen. -1.2: Use common routines to identify cpu type. - Set up a SCB to be able to handle clock interrupts in the boot program. - Now timer countdown should work on all types of vaxen. -1.3: Unify the ra and tmscp driver. - Standalone driver for the Digital Equipment Unibus Network Adapter - (DEUNA). This allows 11/750 owners to install from a single TU58 - cassette. - Adapt to the RPB changes. Complete change of how network devices are - handled. No more hacks to find bus addresses. -1.5: Standalone device driver for DEBNx (ni) ethernet controllers. -1.6: Add support for VAX 6000 + VAX 8000. Tweak console routines. - Create a fake RPB if either netbooted (on machine without RPB) or - loaded from console storage (without VMB intervention). -1.7: Add support for loading a 2nd stage boot in either a.out or ELF. - Add support for loading a 2nd stage boot directly to its desired - address if possible. - Cleanup use of u_int/size_t. -1.8: Switch to loadfile instead of exec. Now we can load a.out or ELF - kernels. (disabled in OpenBSD) -1.9: Support verbose/quiet boot. -1.10: Remove the 11/750 pcs code and the list of kernels to try to boot - in order. - Work around some PROM bugs in graphics mode which cause \h and \t not - to behave as expected. -1.11: Better VXT2000{,+} support. -1.12: Glass console support on VXT2000{,+}. -1.13: Enable the loadfile code added in revision 1.8. -1.14: Support for VaxStation 3[58][24]0. -1.15: Restore boot sd()... functionality on machines with asc(4) or sii(4) - controllers. -1.16: Remove support for VAX 11/7x0, VAX6000 and VAX8000 diff --git a/sys/arch/vax/boot/common/romread.S b/sys/arch/vax/boot/common/romread.S deleted file mode 100644 index 18772e4cc7c..00000000000 --- a/sys/arch/vax/boot/common/romread.S +++ /dev/null @@ -1,74 +0,0 @@ -/* $OpenBSD: romread.S,v 1.2 2011/07/06 18:32:59 miod Exp $ */ -/* $NetBSD: romread.S,v 1.1 2002/02/24 01:04:25 matt Exp $ */ -/* - * Copyright (c) 1995 Ludd, University of Lule}, Sweden. - * All rights reserved. - * - * This code is derived from software contributed to Ludd by - * Bertram Barth. - * - * 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 at Ludd, University of - * Lule}, Sweden and its contributors. - * 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. - */ - - /* All bugs are subject to removal without further notice */ - - - -#include "../include/asm.h" - -/* - * romread_uvax (int lbn, int size, void *buf, struct rpb *rpb) - */ -ENTRY(romread_uvax, 0xFFE) - movl 16(ap),r11 # restore boot-contents of %r11 (rpb) - movl 52(r11), r7 # load iovec/bqo into %r7 - addl3 (r7), r7, r6 # load qio into %r6 - pushl r11 # base of rpb - pushl $0 # virtual-flag - pushl $33 # read-logical-block - pushl 4(ap) # lbn to start reading - pushl 8(ap) # number of bytes to read - pushl 12(ap) # buffer-address - calls $6, (r6) # call the qio-routine - ret # %r0 holds the result - -/* - * romwrite_uvax (int lbn, int size, void *buf, struct rpb *rpb) - */ -ENTRY(romwrite_uvax, 0xFFE) - movl 16(ap), r11 # restore boot-contents of %r11 (rpb) - movl 52(r11), r7 # load iovec/bqo into %r7 - addl3 (r7), r7, r6 # load qio into %r6 - pushl r11 # base of rpb - pushl $0 # virtual-flag - pushl $32 # write-logical-block - pushl 4(ap) # lbn to start reading - pushl 8(ap) # number of bytes to read - pushl 12(ap) # buffer-address - calls $6, (r6) # call the qio-routine - ret # %r0 holds the result - diff --git a/sys/arch/vax/boot/common/srt0.S b/sys/arch/vax/boot/common/srt0.S deleted file mode 100644 index 093d3324a30..00000000000 --- a/sys/arch/vax/boot/common/srt0.S +++ /dev/null @@ -1,84 +0,0 @@ -/* $OpenBSD: srt0.S,v 1.2 2011/07/06 18:32:59 miod Exp $ */ -/* $NetBSD: srt0.S,v 1.2 2002/03/31 00:11:14 matt Exp $ */ -/* - * Copyright (c) 1994 Ludd, University of Lule}, Sweden. - * 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 at Ludd, University of Lule}. - * 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. - */ - - /* All bugs are subject to removal without further notice */ - -#include "../include/asm.h" - -/* - * Auto-moving startup code for standalone programs. Can be loaded - * (almost) anywhere in memory but moves itself to the position - * it is linked for. Must be started at first position, recommended - * is phys addr 0 (boot loads programs at 0, but starts them at the - * position set in a.out header. - */ - - .globl nisse # pass -e nisse to ld gives OK start addr - .set nisse,0 - -ALTENTRY(start) - nop;nop; - movl $_C_LABEL(start), sp # Probably safe place for stack - pushr $0x1fff # save for later usage - - subl3 $_C_LABEL(start), $_C_LABEL(edata), r0 - movab _C_LABEL(start), r1 # get where we are - movl $_C_LABEL(start), r3 # get where we want to be - cmpl r1,r3 # are we where we want to be? - beql relocated # already relocated, skip copy - movc3 r0,(r1),(r3) # copy - subl3 $_C_LABEL(edata), $_C_LABEL(end), r2 - movc5 $0,(r3),$0,r2,(r3) # Zero bss - - movpsl -(sp) - pushl $relocated - rei -relocated: # now relocation is done !!! - movl sp,_C_LABEL(bootregs) # *bootregs - calls $0, _C_LABEL(Xmain) # Were here! - halt # no return - -ENTRY(machdep_start, 0) - mtpr $0x1f,$0x12 # Block all interrupts - mtpr $0,$0x18 # stop real time interrupt clock - movl 4(ap), r6 - movl 20(ap), r9 # end of symbol table - pushl 8(ap) # number of symbols - pushl 16(ap) # start of symbols - movab _C_LABEL(bootrpb),r10 # get RPB address - pushl r10 # argument for new boot - ashl $9,76(r10),r8 # memory size (COMPAT) - movl $3,r11 # ask boot (COMPAT) - clrl r10 # no boot dev (COMPAT) - - calls $3,(r6) - halt diff --git a/sys/arch/vax/boot/common/str.S b/sys/arch/vax/boot/common/str.S deleted file mode 100644 index 4a0ab80fb63..00000000000 --- a/sys/arch/vax/boot/common/str.S +++ /dev/null @@ -1,151 +0,0 @@ -/* $OpenBSD: str.S,v 1.3 2011/06/06 07:54:33 jasper Exp $ */ -/* $NetBSD: str.S,v 1.1 2002/02/24 01:04:25 matt Exp $ */ -/* - * Copyright (c) 1996 Ludd, University of Lule}, Sweden. - * 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 at Ludd, University of - * Lule}, Sweden and its contributors. - * 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. - */ - -/* - * Small versions of the most common functions not using any - * emulated instructions. - */ - -#include "asm.h" - -/* - * atoi() used in devopen. - */ -ENTRY(atoi, 0) - movl 4(ap),r1 - clrl r0 - -2: movzbl (r1)+,r2 - cmpb r2,$48 - blss 1f - cmpb r2,$57 - bgtr 1f - subl2 $48,r2 - mull2 $10,r0 - addl2 r2,r0 - brb 2b -1: ret - -/* - * index() small and easy. - * doesnt work if we search for null. - */ -ENTRY(index, 0) - movq 4(ap),r0 -1: cmpb (r0), r1 - beql 2f - tstb (r0)+ - bneq 1b - clrl r0 -2: ret - -/* - * cmpc3 is emulated on MVII. - */ -ENTRY(bcmp, 0) - movl 4(ap), r2 - movl 8(ap), r1 - movl 12(ap), r0 -2: cmpb (r2)+, (r1)+ - bneq 1f - decl r0 - bneq 2b -1: ret - -/* - * Is movc3/movc5 emulated on any CPU? I dont think so; use them here. - */ -ENTRY(bzero,0) - movc5 $0,*4(ap),$0,8(ap),*4(ap) - ret - -ENTRY(bcopy,0) - movc3 12(ap), *4(ap), *8(ap) - ret - -ENTRY(strlen, 0) - movl 4(ap), r0 -1: tstb (r0)+ - bneq 1b - decl r0 - subl2 4(ap), r0 - ret - -ENTRY(strcmp, 0) - movl $250, r3 # max string len to compare -5: movl 4(ap), r2 - movl 8(ap), r1 - movl $1, r0 - -2: cmpb (r2),(r1)+ - bneq 1f # something differ - tstb (r2)+ - beql 4f # continue, strings unequal - decl r3 # max string len encountered? - bneq 2b - -4: clrl r0 # We are done, strings equal. - ret - -1: bgtr 3f - mnegl r0, r0 -3: ret - -ENTRY(strncpy, 0) - movl 4(ap), r1 - movl 8(ap), r2 - movl 12(ap), r3 - bleq 2f - -1: movb (r2)+, (r1)+ - beql 2f - decl r3 - bneq 1b -2: ret - -ENTRY(setjmp, 0) - movl 4(ap), r0 - movl 8(fp), (r0) - movl 12(fp), 4(r0) - movl 16(fp), 8(r0) - addl3 fp,$28,12(r0) - clrl r0 - ret - -ENTRY(longjmp, 0) - movl 4(ap), r1 - movl $1, r0 - movl (r1), ap - movl 4(r1), fp - movl 12(r1), sp - jmp *8(r1) diff --git a/sys/arch/vax/boot/common/vaxstand.h b/sys/arch/vax/boot/common/vaxstand.h deleted file mode 100644 index 0db8d099de8..00000000000 --- a/sys/arch/vax/boot/common/vaxstand.h +++ /dev/null @@ -1,56 +0,0 @@ -/* $OpenBSD: vaxstand.h,v 1.3 2011/07/06 18:32:59 miod Exp $ */ -/* $NetBSD: vaxstand.h,v 1.1 1999/03/06 16:36:05 ragge Exp $ */ -/* - * Copyright (c) 1994 Ludd, University of Lule}, Sweden. - * 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 at Ludd, University of Lule}. - * 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. - */ - - /* All bugs are subject to removal without further notice */ - - -#define MAXNUBA 8 /* Unibusadapters */ - -/* Variables used in autoconf */ -extern int *ubaaddr, *mbaaddr, *udaaddr; -extern int cpunumber, howto; -extern dev_t bootdev; - -/* devsw type definitions, used in bootxx and conf */ -#define SADEV(name,strategy,open,close,ioctl) \ - { (char *)name, \ - (int(*)(void *, int, daddr32_t, size_t, void *, size_t *))strategy, \ - (int(*)(struct open_file *, ...))open, \ - (int(*)(struct open_file *))close, \ - (int(*)(struct open_file *,u_long, void *))ioctl} - -#define SDELAY(count) {volatile int i; for (i = count; i; i--);} -/* - * Easy-to-use definitions - */ - -char *index(); diff --git a/sys/arch/vax/boot/xxboot/Makefile b/sys/arch/vax/boot/xxboot/Makefile deleted file mode 100644 index 4b3a10f5b4a..00000000000 --- a/sys/arch/vax/boot/xxboot/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -# $OpenBSD: Makefile,v 1.8 2011/07/06 18:32:59 miod Exp $ -# $NetBSD: Makefile,v 1.12 2002/02/24 01:04:25 matt Exp $ - -S= ${.CURDIR}/../../../../ - -PROG= xxboot -LINKS= ${BINDIR}/xxboot ${BINDIR}/raboot -LINKS+= ${BINDIR}/xxboot ${BINDIR}/hdboot -LINKS+= ${BINDIR}/xxboot ${BINDIR}/sdboot -WARNS?= 1 - -SRCS= start.S bootxx.c romread.S str.S urem.s udiv.s - -INSTALL_STRIP= -CPPFLAGS+=-D_STANDALONE -DLIBSA_NO_FD_CHECKING -DLIBSA_NO_RAW_ACCESS \ - -DLIBSA_NO_TWIDDLE -DLIBSA_SINGLE_DEVICE=rom \ - -DLIBSA_NO_COMPAT_UFS \ - -DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_CLOSE \ - -DLIBSA_NO_FS_WRITE -DLIBSA_NO_FS_SEEK \ - -DNEED_UFS -BINDIR= /usr/mdec -NOMAN= # defined - -CFLAGS= -Os - -SAREL= -SA_AS= library -.include "${S}/lib/libsa/Makefile.inc" -LIBSA= ${SALIB} - -.if ${MACHINE} == "vax" -.PHONY: machine-links -beforedepend: machine-links -machine-links: - @[ -h machine ] || ln -s ${S}/arch/${MACHINE}/include machine - @[ -h ${MACHINE_ARCH} ] || ln -s ${S}/arch/${MACHINE_ARCH}/include ${MACHINE_ARCH} -.NOPATH: machine ${MACHINE_ARCH} -CLEANFILES+= machine ${MACHINE_ARCH} ${PROG}.out -.endif - -${PROG}: ${OBJS} ${LIBSA} - ${LD} -N -Ttext 100000 -o ${PROG}.out ${OBJS} ${LIBSA} - /usr/bin/strip ${PROG}.out - /usr/bin/size ${PROG}.out - /bin/dd if=${PROG}.out of=${PROG} bs=32 skip=1 - -clean:: - rm -f a.out [Ee]rrs mklog core *.core ${PROG} ${OBJS} ${LOBJS} \ - ${CLEANFILES} - -.include <bsd.prog.mk> diff --git a/sys/arch/vax/boot/xxboot/bootxx.c b/sys/arch/vax/boot/xxboot/bootxx.c deleted file mode 100644 index fb13641dae2..00000000000 --- a/sys/arch/vax/boot/xxboot/bootxx.c +++ /dev/null @@ -1,329 +0,0 @@ -/* $OpenBSD: bootxx.c,v 1.12 2011/07/06 18:32:59 miod Exp $ */ -/* $NetBSD: bootxx.c,v 1.16 2002/03/29 05:45:08 matt Exp $ */ - -/*- - * Copyright (c) 1982, 1986 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. 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 7.15 (Berkeley) 5/4/91 - */ - -#include "sys/param.h" -#include "sys/reboot.h" -#include "sys/disklabel.h" -#include "sys/exec.h" -#include "sys/exec_elf.h" - -#include "lib/libsa/stand.h" -#include "lib/libsa/ufs.h" -#include "lib/libsa/cd9660.h" - -#include "machine/pte.h" -#include "machine/sid.h" -#include "machine/mtpr.h" -#include "machine/reg.h" -#include "machine/rpb.h" -#include "../vax/gencons.h" - -#define NRSP 1 /* Kludge */ -#define NCMD 1 /* Kludge */ -#define LIBSA_TOO_OLD - -#include "arch/vax/mscp/mscp.h" -#include "arch/vax/mscp/mscpreg.h" - -#include "../boot/data.h" - -#define RF_PROTECTED_SECTORS 64 /* XXX refer to <.../rf_optnames.h> */ - -void Xmain(void); -void hoppabort(int); -void romread_uvax(int lbn, int size, void *buf, struct rpb *rpb); -int unit_init(int, struct rpb *, int); - -struct open_file file; - -unsigned *bootregs; -struct rpb *rpb; -struct bqo *bqo; -int vax_cputype; -int vax_load_failure; -struct udadevice {u_short udaip;u_short udasa;}; -volatile struct udadevice *csr; -static int moved; - -extern int from; -#define FROMMV 2 -#define FROMVMB 4 - -/* - * The boot blocks are used by MicroVAX II/III, VS2000, - * VS3100, VS4000, and only when booting from disk. - */ -void -Xmain(void) -{ - union { - struct exec aout; - Elf32_Ehdr elf; - } hdr; - int io; - u_long entry; - - vax_cputype = (mfpr(PR_SID) >> 24) & 0xFF; - moved = 0; - /* - */ - rpb = (void *)0xf0000; /* Safe address right now */ - bqo = (void *)0xf1000; - if (from == FROMMV) { - /* - * now relocate rpb/bqo (which are used by ROM-routines) - */ - bcopy ((void *)bootregs[11], rpb, sizeof(struct rpb)); - bcopy ((void*)rpb->iovec, bqo, rpb->iovecsz); -#if 0 - if (rpb->devtyp == BDEV_SDN) - rpb->devtyp = BDEV_SD; /* XXX until driver fixed */ -#endif - } else { - bzero(rpb, sizeof(struct rpb)); - rpb->devtyp = bootregs[0]; - rpb->unit = bootregs[3]; - rpb->rpb_bootr5 = bootregs[5]; - rpb->csrphy = bootregs[2]; - rpb->adpphy = bootregs[1]; /* BI node on 8200 */ - } - rpb->rpb_base = rpb; - rpb->iovec = (int)bqo; - - io = open("/boot.vax", 0); - if (io < 0) - io = open("/boot", 0); - if (io < 0) - asm("movl $0xbeef1, r0; halt"); - - read(io, (void *)&hdr.aout, sizeof(hdr.aout)); - if (N_GETMAGIC(hdr.aout) == OMAGIC && N_GETMID(hdr.aout) == MID_VAX) { - vax_load_failure++; - entry = hdr.aout.a_entry; - if (entry < sizeof(hdr.aout)) - entry = sizeof(hdr.aout); - read(io, (void *) entry, hdr.aout.a_text + hdr.aout.a_data); - memset((void *) (entry + hdr.aout.a_text + hdr.aout.a_data), - 0, hdr.aout.a_bss); - } else if (memcmp(hdr.elf.e_ident, ELFMAG, SELFMAG) == 0) { - Elf32_Phdr ph; - size_t off = sizeof(hdr.elf); - vax_load_failure += 2; - read(io, (caddr_t)(&hdr.elf) + sizeof(hdr.aout), - sizeof(hdr.elf) - sizeof(hdr.aout)); - if (hdr.elf.e_machine != EM_VAX || hdr.elf.e_type != ET_EXEC - || hdr.elf.e_phnum != 1) - goto die; - vax_load_failure++; - entry = hdr.elf.e_entry; - if (hdr.elf.e_phoff != sizeof(hdr.elf)) - goto die; - vax_load_failure++; - read(io, &ph, sizeof(ph)); - off += sizeof(ph); - if (ph.p_type != PT_LOAD) - goto die; - vax_load_failure++; - while (off < ph.p_offset) { - u_int32_t tmp; - read(io, &tmp, sizeof(tmp)); - off += sizeof(tmp); - } - read(io, (void *) ph.p_paddr, ph.p_filesz); - memset((void *) (ph.p_paddr + ph.p_filesz), 0, - ph.p_memsz - ph.p_filesz); - } else { - goto die; - } - hoppabort(entry); -die: - asm("movl $0xbeef2, r0; halt"); -} - -/* - * Write an extremely limited version of a (us)tar filesystem, suitable - * for loading secondary-stage boot loader. - * - Can only load file "boot". - * - Must be the first file on tape. - */ -struct fs_ops file_system[] = { -#ifdef NEED_UFS - { ufs_open, 0, ufs_read, 0, 0, ufs_stat }, -#endif -#ifdef NEED_CD9660 - { cd9660_open, 0, cd9660_read, 0, 0, cd9660_stat }, -#endif -#ifdef NEED_USTARFS - { ustarfs_open, 0, ustarfs_read, 0, 0, ustarfs_stat }, -#endif -}; - -int nfsys = (sizeof(file_system) / sizeof(struct fs_ops)); - -#ifdef LIBSA_TOO_OLD -#include "../boot/vaxstand.h" - -struct rom_softc { - int part; - int unit; -} rom_softc; - -int romstrategy(void *, int, daddr32_t, size_t, void *, size_t *); -int romopen(struct open_file *, int, int, int, int); -struct devsw devsw[] = { - SADEV("rom", romstrategy, romopen, nullsys, noioctl), -}; -int ndevs = (sizeof(devsw)/sizeof(devsw[0])); - -int -romopen(struct open_file *f, int adapt, int ctlr, int unit, int part) -{ - rom_softc.unit = unit; - rom_softc.part = part; - - f->f_devdata = (void *)&rom_softc; - - return 0; -} - -#endif - -int -devopen(struct open_file *f, const char *fname, char **file) -{ - -#ifdef LIBSA_TOO_OLD - f->f_dev = &devsw[0]; -#endif - *file = (char *)fname; - - /* - * Reinit the VMB boot device. - */ - if (bqo->unit_init && (moved++ == 0)) { - int initfn; - - initfn = rpb->iovec + bqo->unit_init; - if (rpb->devtyp == BDEV_UDA || rpb->devtyp == BDEV_TK) { - /* - * This reset do not seem to be done in the - * ROM routines, so we have to do it manually. - */ - csr = (struct udadevice *)rpb->csrphy; - csr->udaip = 0; - while ((csr->udasa & MP_STEP1) == 0) - ; - } - /* - * AP (R12) have a pointer to the VMB argument list, - * wanted by bqo->unit_init. - */ - unit_init(initfn, rpb, bootregs[12]); - } - return 0; -} - -extern struct disklabel romlabel; - -int -romstrategy(sc, func, dblk, size, buf, rsize) - void *sc; - int func; - daddr32_t dblk; - size_t size; - void *buf; - size_t *rsize; -{ - int block = dblk; - int nsize = size; - - if (romlabel.d_magic == DISKMAGIC && romlabel.d_magic2 == DISKMAGIC) { - if (romlabel.d_npartitions > 1) { - block += romlabel.d_partitions[0].p_offset; - if (romlabel.d_partitions[0].p_fstype == FS_RAID) { - block += RF_PROTECTED_SECTORS; - } - } - } - - romread_uvax(block, size, buf, rpb); - - if (rsize) - *rsize = nsize; - return 0; -} - -extern char end[]; -static char *top = (char*)end; - -void * -alloc(unsigned int size) -{ - void *ut = top; - top += size; - return ut; -} - -void -free(void *ptr, unsigned int size) -{ -} - -#ifdef USE_PRINTF -void -putchar(int ch) -{ - /* - * On KA88 we may get C-S/C-Q from the console. - * Must obey it. - */ - while (mfpr(PR_RXCS) & GC_DON) { - if ((mfpr(PR_RXDB) & 0x7f) == 19) { - while (1) { - while ((mfpr(PR_RXCS) & GC_DON) == 0) - ; - if ((mfpr(PR_RXDB) & 0x7f) == 17) - break; - } - } - } - - while ((mfpr(PR_TXCS) & GC_RDY) == 0) - ; - mtpr(0, PR_TXCS); - mtpr(ch & 0377, PR_TXDB); - if (ch == 10) - putchar(13); -} -#endif diff --git a/sys/arch/vax/boot/xxboot/start.S b/sys/arch/vax/boot/xxboot/start.S deleted file mode 100644 index df019026dc9..00000000000 --- a/sys/arch/vax/boot/xxboot/start.S +++ /dev/null @@ -1,201 +0,0 @@ -/* $OpenBSD: start.S,v 1.3 2011/07/06 18:32:59 miod Exp $ */ -/* $NetBSD: start.S,v 1.1 2002/02/24 01:04:26 matt Exp $ */ -/* - * Copyright (c) 1995 Ludd, University of Lule}, Sweden. - * All rights reserved. - * - * This code is derived from software contributed to Ludd by - * Bertram Barth. - * - * 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 at Ludd, University of - * Lule}, Sweden and its contributors. - * 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. - */ - - /* All bugs are subject to removal without further notice */ - - -#define _LOCORE - -#include "sys/disklabel.h" - -#include "../include/mtpr.h" -#include "../include/asm.h" - -_C_LABEL(_start): -_C_LABEL(start): - .globl _C_LABEL(start) # this is the symbolic name for the start - .globl _C_LABEL(_start) # of code to be relocated. We can use this - # to get the actual/real address (pc-rel) - # or to get the relocated address (abs). - -.org 0x00 # uVAX booted from TK50 starts here - brb from_0x00 # continue behind dispatch-block - -.org 0x02 # information used by uVAX-ROM - .byte 0xff # offset in words to identification area - .byte 1 # this byte must be 1 - .word 0 # logical block number (word swapped) - .word 0 # of the secondary image - -.org 0x08 # - brb from_0x08 # skip ... - -.org 0x0C # 11/750 & 8200 starts here - halt # not supported - - -from_0x00: # uVAX from TK50 - brw start_uvax # all uVAXen continue there - -from_0x08: # Any machine from VMB - movzbl $4,_C_LABEL(from) # Booted from full VMB - brw start_vmb - -# the complete area reserved for label -# must be empty (i.e. filled with zeroes). -# disklabel(8) checks that before installing -# the bootblocks over existing label. - -.org LABELOFFSET - .globl _C_LABEL(romlabel) -_C_LABEL(romlabel): - .long 0 - -.org LABELOFFSET + d_end_ -start_vmb: - /* - * Read in block 1-15. - */ - movl 52(r11), r7 # load iovec/bqo into %r7 - addl3 (r7), r7, r6 # load qio into %r6 - pushl r11 # base of rpb - pushl $0 # virtual-flag - pushl $33 # read-logical-block - pushl $1 # lbn to start reading - pushl $7680 # number of bytes to read - pushab start_uvax # buffer-address - calls $6, (r6) # call the qio-routine - brw start_uvax - -/* - * Parameter block for uVAX boot. - */ -#define VOLINFO 0 /* 1=single-sided 81=double-sided volumes */ -#define SISIZE 16 /* size in blocks of secondary image */ -#define SILOAD 0 /* load offset (usually 0) from the default */ -#define SIOFF 0x260 /* byte offset into secondary image */ - -.org 0x1fe - .byte 0x18 # must be 0x18 - .byte 0x00 # must be 0x00 (MBZ) - .byte 0x00 # any value - .byte 0xFF - (0x18 + 0x00 + 0x00) - /* 4th byte holds 1s' complement of sum of previous 3 bytes */ - - .byte 0x00 # must be 0x00 (MBZ) - .byte VOLINFO - .byte 0x00 # any value - .byte 0x00 # any value - - .long SISIZE # size in blocks of secondary image - .long SILOAD # load offset (usually 0) - .long SIOFF # byte offset into secondary image - .long (SISIZE + SILOAD + SIOFF) # sum of previous 3 - - - .align 2 - .globl _C_LABEL(from) -_C_LABEL(from): - .long 0 - -/* uVAX main entry is at the start of the second disk block. This is - * needed for multi-arch CD booting where multiple architecture need - * to shove stuff in boot block 0. - */ - .org 0x260 # uVAX booted from disk starts here - -start_uvax: - movzbl $2,_C_LABEL(from) # Booted from subset-VMB - brb start_all - -/* - * start_all: stack already at RELOC, we save registers, move ourself - * to RELOC and loads boot. - */ -start_all: - movl $_C_LABEL(start), sp # move stack to a better - pushr $0x1fff # save all regs, used later. - - subl3 $_C_LABEL(start), $_C_LABEL(edata), r0 - # get size of text+data (w/o bss) - moval _C_LABEL(start), r1 # get actual base-address of code - subl3 $_C_LABEL(start), $_C_LABEL(end), r2 - # get complete size (incl. bss) - movl $_C_LABEL(start), r3 # get relocated base-address of code - movc5 r0, (r1), $0, r2, (r3) # copy code to new location - - movpsl -(sp) - movl $relocated, -(sp) # return-address on top of stack - rei # can be replaced with new address -relocated: # now relocation is done !!! - movl sp, _C_LABEL(bootregs) - calls $0, _C_LABEL(Xmain) # call Xmain (gcc workaround)which is - halt # not intended to return ... - -/* - * hoppabort() is called when jumping to the newly loaded program. - */ -ENTRY(hoppabort, 0) - movl 4(ap),r6 - movl _C_LABEL(rpb),r11 - mnegl $1,ap # Hack to figure out boot device. - movpsl -(sp) - pushab 2(r6) - mnegl $1,_C_LABEL(vax_load_failure) - rei -# calls $0,(r6) - halt - -ENTRY(unit_init, R6|R7|R8|R9|R10|R11) - mfpr $17,r7 # Wanted bu KDB - movl 4(ap),r0 # init routine address - movl 8(ap),r9 # RPB in %r9 - movl 12(ap),r1 # VMB argument list - callg (r1),(r0) - ret - -# A bunch of functions unwanted in boot blocks. -ENTRY(getchar, 0) - halt - -#ifndef USE_PRINTF -ENTRY(putchar, 0) - ret - -#endif - -ENTRY(panic, 0) - halt diff --git a/sys/arch/vax/vax/autoconf.c b/sys/arch/vax/vax/autoconf.c index 6258be40385..dadd4b0700c 100644 --- a/sys/arch/vax/vax/autoconf.c +++ b/sys/arch/vax/vax/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.34 2011/07/06 20:42:05 miod Exp $ */ +/* $OpenBSD: autoconf.c,v 1.35 2011/07/10 17:31:40 deraadt Exp $ */ /* $NetBSD: autoconf.c,v 1.45 1999/10/23 14:56:05 ragge Exp $ */ /* @@ -70,7 +70,7 @@ struct device *bootdv; int booted_partition; /* defaults to 0 (aka 'a' partition) */ void -cpu_configure() +cpu_configure(void) { softintr_init(); @@ -101,9 +101,7 @@ int mainbus_match(struct device *, struct cfdata *, void *); void mainbus_attach(struct device *, struct device *, void *); int -mainbus_print(aux, hej) - void *aux; - const char *hej; +mainbus_print(void *aux, const char *hej) { struct mainbus_attach_args *maa = aux; @@ -117,10 +115,7 @@ mainbus_print(aux, hej) } int -mainbus_match(parent, cf, aux) - struct device *parent; - struct cfdata *cf; - void *aux; +mainbus_match(struct device *parent, struct cfdata *cf, void *aux) { if (cf->cf_unit == 0 && strcmp(cf->cf_driver->cd_name, "mainbus") == 0) @@ -130,9 +125,7 @@ mainbus_match(parent, cf, aux) } void -mainbus_attach(parent, self, hej) - struct device *parent, *self; - void *hej; +mainbus_attach(struct device *parent, struct device *self, void *hej) { struct mainbus_attach_args maa; |