diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2011-07-06 18:33:01 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2011-07-06 18:33:01 +0000 |
commit | e35630aff7d674584b0cb6f89406b4ac328b0bd9 (patch) | |
tree | 613ca093237b8f0d16d97a30f67a318149476ea0 /sys/arch/vax/stand/boot | |
parent | 01287004f09da4a00b880d67b72083dcb78aa3db (diff) |
Remove support for non-microVAX, non-VAXstation, non-VXT hardware in the
VAX port. This means, 11/7xx, VAX6000 and VAX8x00 systems, as well as SBI,
CMI, BI, XMI and MASSBUS drivers.
Most of these files were not being compiled or kept in compilable state over
the years anyway.
Diffstat (limited to 'sys/arch/vax/stand/boot')
-rw-r--r-- | sys/arch/vax/stand/boot/Makefile | 4 | ||||
-rw-r--r-- | sys/arch/vax/stand/boot/boot.c | 109 | ||||
-rw-r--r-- | sys/arch/vax/stand/boot/conf.c | 10 | ||||
-rw-r--r-- | sys/arch/vax/stand/boot/ctu.c | 178 | ||||
-rw-r--r-- | sys/arch/vax/stand/boot/devopen.c | 44 | ||||
-rw-r--r-- | sys/arch/vax/stand/boot/hp.c | 154 | ||||
-rw-r--r-- | sys/arch/vax/stand/boot/if_de.c | 9 | ||||
-rw-r--r-- | sys/arch/vax/stand/boot/if_ni.c | 534 | ||||
-rw-r--r-- | sys/arch/vax/stand/boot/ra.c | 91 | ||||
-rw-r--r-- | sys/arch/vax/stand/boot/tmscp.c | 204 | ||||
-rw-r--r-- | sys/arch/vax/stand/boot/vaxstand.h | 10 | ||||
-rw-r--r-- | sys/arch/vax/stand/boot/version | 3 |
12 files changed, 45 insertions, 1305 deletions
diff --git a/sys/arch/vax/stand/boot/Makefile b/sys/arch/vax/stand/boot/Makefile index 59bb87a89e6..0463c1dfe6e 100644 --- a/sys/arch/vax/stand/boot/Makefile +++ b/sys/arch/vax/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.8 2008/03/30 19:54:05 miod Exp $ +# $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 @@ -7,7 +7,7 @@ NOMAN= # defined .include <bsd.own.mk> PROG= boot -DEVS= hp.c ctu.c ra.c mfm.c if_qe.c if_le.c if_ze.c if_de.c if_ni.c +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 diff --git a/sys/arch/vax/stand/boot/boot.c b/sys/arch/vax/stand/boot/boot.c index 62c5ad59e16..597185c079e 100644 --- a/sys/arch/vax/stand/boot/boot.c +++ b/sys/arch/vax/stand/boot/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.19 2008/08/26 18:36:21 miod Exp $ */ +/* $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. @@ -38,8 +38,6 @@ #include <lib/libsa/stand.h> #include <lib/libsa/loadfile.h> -#define V750UCODE(x) ((x>>8)&255) - #include "machine/rpb.h" #include "machine/sid.h" @@ -61,9 +59,6 @@ void autoconf(void); int getsecs(void); int setjmp(int *); int testkey(void); -#if 0 -void loadpcs(void); -#endif const struct vals { char *namn; @@ -109,7 +104,7 @@ Xmain(void) transition = ' '; askname = bootrpb.rpb_bootr5 & RB_ASKNAME; - printf("\n\r>> OpenBSD/vax boot [%s] <<\n", "1.15"); + 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; @@ -196,7 +191,7 @@ void boot(char *arg) { char *fn = "bsd"; - int howto, fl, err; + int howto, err; u_long marks[MARK_MAX]; if (arg) { @@ -246,104 +241,6 @@ load: printf("Boot failed: %s\n", strerror(errno)); } -#if 0 - -/* 750 Patchable Control Store magic */ - -#include "../include/mtpr.h" -#include "../include/cpu.h" -#include "../include/sid.h" -#define PCS_BITCNT 0x2000 /* number of patchbits */ -#define PCS_MICRONUM 0x400 /* number of ucode locs */ -#define PCS_PATCHADDR 0xf00000 /* start addr of patchbits */ -#define PCS_PCSADDR (PCS_PATCHADDR+0x8000) /* start addr of pcs */ -#define PCS_PATCHBIT (PCS_PATCHADDR+0xc000) /* patchbits enable reg */ -#define PCS_ENABLE 0xfff00000 /* enable bits for pcs */ - -#define extzv(one, two, three,four) \ -({ \ - asm __volatile (" extzv %0,%3,(%1),(%2)+" \ - : \ - : "g"(one),"g"(two),"g"(three),"g"(four)); \ -}) - - -void -loadpcs(void) -{ - static int pcsdone = 0; - int mid = mfpr(PR_SID); - int i, j, *ip, *jp; - char pcs[100]; - char *cp; - - if ((mid >> 24) != VAX_750 || ((mid >> 8) & 255) < 95 || pcsdone) - return; - printf("Updating 11/750 microcode: "); - for (cp = line; *cp; cp++) - if (*cp == ')' || *cp == ':') - break; - if (*cp) { - bcopy(line, pcs, 99); - pcs[99] = 0; - i = cp - line + 1; - } else - i = 0; - strncpy(pcs + i, "pcs750.bin", sizeof(pcs) - i - 1); - pcs[sizeof(pcs)-1] = '\0'; - i = open(pcs, 0); - if (i < 0) { - printf("bad luck - missing pcs750.bin :-(\n"); - return; - } - /* - * We ask for more than we need to be sure we get only what we expect. - * After read: - * locs 0 - 1023 packed patchbits - * 1024 - 11264 packed microcode - */ - if (read(i, (char *)0, 23*512) != 22*512) { - printf("Error reading %s\n", pcs); - close(i); - return; - } - close(i); - - /* - * Enable patchbit loading and load the bits one at a time. - */ - *((int *)PCS_PATCHBIT) = 1; - ip = (int *)PCS_PATCHADDR; - jp = (int *)0; - for (i=0; i < PCS_BITCNT; i++) { - extzv(i,jp,ip,1); - } - *((int *)PCS_PATCHBIT) = 0; - - /* - * Load PCS microcode 20 bits at a time. - */ - ip = (int *)PCS_PCSADDR; - jp = (int *)1024; - for (i=j=0; j < PCS_MICRONUM * 4; i+=20, j++) { - extzv(i,jp,ip,20); - } - - /* - * Enable PCS. - */ - i = *jp; /* get 1st 20 bits of microcode again */ - i &= 0xfffff; - i |= PCS_ENABLE; /* reload these bits with PCS enable set */ - *((int *)PCS_PCSADDR) = i; - - mid = mfpr(PR_SID); - printf("new rev level=%d\n", V750UCODE(mid)); - pcsdone = 1; -} - -#endif - void usage(char *hej) { diff --git a/sys/arch/vax/stand/boot/conf.c b/sys/arch/vax/stand/boot/conf.c index ec6a3777ddb..ea8ad1df942 100644 --- a/sys/arch/vax/stand/boot/conf.c +++ b/sys/arch/vax/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.5 2011/03/13 00:13:53 deraadt Exp $ */ +/* $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. @@ -50,9 +50,7 @@ static int nostrategy(void *, int, daddr32_t, size_t, void *, size_t *); struct devsw devsw[]={ - SADEV("hp",hpstrategy, hpopen, nullsys, noioctl), SADEV("qe",nostrategy, qeopen, qeclose, noioctl), /* DEQNA */ - SADEV("ctu",ctustrategy, ctuopen, nullsys, noioctl), SADEV("ra",rastrategy, raopen, nullsys, noioctl), SADEV("mt",rastrategy, raopen, nullsys, noioctl), SADEV("rom",romstrategy, romopen, nullsys, noioctl), @@ -63,15 +61,11 @@ struct devsw devsw[]={ SADEV("st",nullsys, nullsys, nullsys, noioctl), SADEV("le",nostrategy, leopen, leclose, noioctl), /* LANCE */ SADEV("ze",nostrategy, zeopen, zeclose, noioctl), /* SGEC */ - SADEV("rl",romstrategy, romopen, nullsys, noioctl), SADEV("de",nostrategy, deopen, declose, noioctl), /* DEUNA */ - SADEV("ni",nostrategy, niopen, nullsys, noioctl), /* DEBNA */ }; int cnvtab[] = { - BDEV_HP, BDEV_QE, - BDEV_CNSL, BDEV_UDA, BDEV_TK, -1, @@ -82,9 +76,7 @@ int cnvtab[] = { BDEV_ST, BDEV_LE, BDEV_ZE, - BDEV_RL, BDEV_DE, - BDEV_NI, }; int ndevs = (sizeof(devsw)/sizeof(devsw[0])); diff --git a/sys/arch/vax/stand/boot/ctu.c b/sys/arch/vax/stand/boot/ctu.c deleted file mode 100644 index 70654e2e905..00000000000 --- a/sys/arch/vax/stand/boot/ctu.c +++ /dev/null @@ -1,178 +0,0 @@ -/* $OpenBSD: ctu.c,v 1.5 2011/03/13 00:13:53 deraadt Exp $ */ -/* $NetBSD: ctu.c,v 1.3 2000/05/20 13:30:03 ragge 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. - */ - -/* - * Standalone device driver for 11/750 Console TU58. - * It can only handle reads, and doesn't calculate checksum. - */ - -#include <sys/param.h> - -#include <lib/libsa/stand.h> - -#include <machine/mtpr.h> -#include <machine/rsp.h> - -#include "vaxstand.h" - -static short ctu_cksum(unsigned short *, int); - -enum tu_state { - SC_INIT, - SC_READY, - SC_SEND_CMD, - SC_GET_RESP, -}; - -volatile struct tu_softc { - enum tu_state sc_state; - char sc_rsp[15]; /* Should be struct rsb; but don't work */ - u_char *sc_xfptr; /* Current char to xfer */ - int sc_nbytes; /* Number of bytes to xfer */ - int sc_xbytes; /* Number of xfer'd bytes */ - int sc_bbytes; /* Number of xfer'd bytes this block */ -} tu_sc; - -void ctutintr(void); -void cturintr(void); - -int -ctuopen(struct open_file *f, int adapt, int ctlr, int unit, int part) -{ - - tu_sc.sc_state = SC_INIT; - - mtpr(RSP_TYP_INIT, PR_CSTD); - cturintr(); - tu_sc.sc_state = SC_READY; - return 0; - -} - -int -ctustrategy(void *f, int func, daddr32_t dblk, size_t size, void *buf, size_t *rsize) -{ - struct rsp *rsp = (struct rsp *)tu_sc.sc_rsp; - - tu_sc.sc_xfptr = buf; - tu_sc.sc_nbytes = size; - tu_sc.sc_xbytes = tu_sc.sc_bbytes = 0; - - rsp->rsp_typ = RSP_TYP_COMMAND; - rsp->rsp_sz = 012; - rsp->rsp_op = RSP_OP_READ; - rsp->rsp_mod = 0; - rsp->rsp_drv = 0; - rsp->rsp_sw = rsp->rsp_xx1 = rsp->rsp_xx2 = 0; - rsp->rsp_cnt = tu_sc.sc_nbytes; - rsp->rsp_blk = dblk; - rsp->rsp_sum = ctu_cksum((u_short *)rsp, 6); - tu_sc.sc_state = SC_SEND_CMD; - while (tu_sc.sc_state != SC_GET_RESP) - ctutintr(); - while (tu_sc.sc_state != SC_READY) - cturintr(); - *rsize = size; - return 0; -} - -void -cturintr(void) -{ - int status; - - while ((mfpr(PR_CSRS) & 0x80) == 0) - ; - - status = mfpr(PR_CSRD); - - switch (tu_sc.sc_state) { - - case SC_INIT: - break; - - case SC_GET_RESP: - if (tu_sc.sc_xbytes == tu_sc.sc_nbytes) { - tu_sc.sc_bbytes++; - if (tu_sc.sc_bbytes == 146) - tu_sc.sc_state = SC_READY; - break; - } - tu_sc.sc_bbytes++; - if (tu_sc.sc_bbytes < 3) /* Data header */ - break; - if (tu_sc.sc_bbytes == 132) { /* Finished */ - tu_sc.sc_bbytes = 0; - break; - } - if (tu_sc.sc_bbytes == 131) /* First checksum */ - break; - tu_sc.sc_xfptr[tu_sc.sc_xbytes++] = status; - break; - case SC_READY: - case SC_SEND_CMD: - break; - } - -} - -void -ctutintr(void) -{ - int c; - - while ((mfpr(PR_CSTS) & 0x80) == 0) - ; - - c = tu_sc.sc_rsp[tu_sc.sc_xbytes++] & 0xff; - mtpr(c, PR_CSTD); - if (tu_sc.sc_xbytes > 13) { - tu_sc.sc_state = SC_GET_RESP; - tu_sc.sc_xbytes = 0; - } -} - -short -ctu_cksum(unsigned short *buf, int words) -{ - int i, cksum; - - for (i = cksum = 0; i < words; i++) - cksum += buf[i]; - -hej: if (cksum > 65535) { - cksum = (cksum & 65535) + (cksum >> 16); - goto hej; - } - return cksum; -} diff --git a/sys/arch/vax/stand/boot/devopen.c b/sys/arch/vax/stand/boot/devopen.c index 879aec9465e..4a3bbe7b784 100644 --- a/sys/arch/vax/stand/boot/devopen.c +++ b/sys/arch/vax/stand/boot/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.4 2008/08/26 18:36:21 miod Exp $ */ +/* $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. @@ -36,10 +36,6 @@ #include "machine/rpb.h" #include "machine/sid.h" #include "machine/pte.h" -#define VAX780 1 -#include "machine/ka750.h" - -#include <arch/vax/bi/bireg.h> #include "vaxstand.h" @@ -151,44 +147,6 @@ devopen(f, fname, file) nexaddr = bootrpb.adpphy; switch (vax_boardtype) { - case VAX_BTYP_750: - csrbase = (nexaddr == 0xf30000 ? 0xffe000 : 0xfbe000); - if (adapt < 0) - break; - nexaddr = (NEX750 + NEXSIZE * adapt); - csrbase = (adapt == 8 ? 0xffe000 : 0xfbe000); - break; - case VAX_BTYP_780: - case VAX_BTYP_790: - csrbase = 0x2007e000 + 0x40000 * ((nexaddr & 0x1e000) >> 13); - if (adapt < 0) - break; - nexaddr = ((int)NEX780 + NEXSIZE * adapt); - csrbase = 0x2007e000 + 0x40000 * adapt; - break; - case VAX_BTYP_9CC: /* 6000/200 */ - case VAX_BTYP_9RR: /* 6000/400 */ - case VAX_BTYP_1202: /* 6000/500 */ - csrbase = 0; - if (ctlr < 0) - ctlr = bootrpb.adpphy & 15; - if (adapt < 0) - adapt = (bootrpb.adpphy >> 4) & 15; - nexaddr = BI_BASE(adapt, ctlr); - break; - - case VAX_BTYP_8000: - case VAX_BTYP_8800: - case VAX_BTYP_8PS: - csrbase = 0; /* _may_ be a KDB */ - nexaddr = bootrpb.csrphy; - if (ctlr < 0) - break; - if (adapt < 0) - nexaddr = (nexaddr & 0xff000000) + BI_NODE(ctlr); - else - nexaddr = BI_BASE(adapt, ctlr); - break; case VAX_BTYP_610: nexaddr = 0; /* No map regs */ csrbase = 0x20000000; diff --git a/sys/arch/vax/stand/boot/hp.c b/sys/arch/vax/stand/boot/hp.c deleted file mode 100644 index c7f084a6f99..00000000000 --- a/sys/arch/vax/stand/boot/hp.c +++ /dev/null @@ -1,154 +0,0 @@ -/* $OpenBSD: hp.c,v 1.3 2011/03/13 00:13:53 deraadt Exp $ */ -/* $NetBSD: hp.c,v 1.5 2000/07/19 00:58:25 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 "sys/param.h" -#include "sys/disklabel.h" - -#include "lib/libsa/stand.h" - -#include "../include/pte.h" -#include "../include/rpb.h" -#include "../include/sid.h" -#define VAX780 1 -struct proc; -#include "../include/ka750.h" - -#include "../mba/mbareg.h" -#include "../mba/hpreg.h" - -#include "vaxstand.h" - -/* - * These routines for HP disk standalone boot is wery simple, - * assuming a lots of thing like that we only working at one hp disk - * a time, no separate routines for mba driver etc.. - * But it works :) - */ - -static struct disklabel hplabel; -static char io_buf[DEV_BSIZE]; -static int dpart; -static int adpadr, unitadr; - -#define MBA_WCSR(reg, val) \ - ((void)(*(volatile u_int32_t *)((adpadr) + (reg)) = (val))); -#define MBA_RCSR(reg) \ - (*(volatile u_int32_t *)((adpadr) + (reg))) -#define HP_WCSR(reg, val) \ - ((void)(*(volatile u_int32_t *)((unitadr) + (reg)) = (val))); -#define HP_RCSR(reg) \ - (*(volatile u_int32_t *)((unitadr) + (reg))) - -int -hpopen(struct open_file *f, int adapt, int ctlr, int unit, int part) -{ - char *msg; - int err; - size_t i; - - if (askname == 0) { /* Take info from RPB */ - adpadr = bootrpb.adpphy; - unitadr = adpadr + MUREG(bootrpb.unit, 0); - } else { - adpadr = nexaddr; - unitadr = adpadr + MUREG(unit, 0); - bootrpb.adpphy = adpadr; - bootrpb.unit = unit; - } - bzero(&hplabel, sizeof(struct disklabel)); - - hplabel.d_secpercyl = 32; - hplabel.d_nsectors = 32; - - /* Set volume valid and 16 bit format; only done once */ - MBA_WCSR(MBA_CR, MBACR_INIT); - HP_WCSR(HP_CS1, HPCS_PA); - HP_WCSR(HP_OF, HPOF_FMT); - - err = hpstrategy(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, &hplabel); - if (msg) - printf("getdisklabel: %s\n", msg); - return 0; -} - -int -hpstrategy(void *f, int func, daddr32_t dblk, - size_t size, void *buf, size_t *rsize) -{ - unsigned int pfnum, mapnr, nsize, bn, cn, sn, tn; - - pfnum = (u_int)buf >> VAX_PGSHIFT; - - for(mapnr = 0, nsize = size; (nsize + VAX_NBPG) > 0; - nsize -= VAX_NBPG, mapnr++, pfnum++) - MBA_WCSR(MAPREG(mapnr), PG_V | pfnum); - - MBA_WCSR(MBA_VAR, ((u_int)buf & VAX_PGOFSET)); - MBA_WCSR(MBA_BC, (~size) + 1); - bn = dblk + hplabel.d_partitions[dpart].p_offset; - - if (bn) { - cn = bn / hplabel.d_secpercyl; - sn = bn % hplabel.d_secpercyl; - tn = sn / hplabel.d_nsectors; - sn = sn % hplabel.d_nsectors; - } else - cn = sn = tn = 0; - - HP_WCSR(HP_DC, cn); - HP_WCSR(HP_DA, (tn << 8) | sn); -#ifdef notdef - if (func == F_WRITE) - HP_WCSR(HP_CS1, HPCS_WRITE); - else -#endif - HP_WCSR(HP_CS1, HPCS_READ); - - while (MBA_RCSR(MBA_SR) & MBASR_DTBUSY) - ; - - if (MBA_RCSR(MBA_SR) & MBACR_ABORT) - return 1; - - *rsize = size; - return 0; -} diff --git a/sys/arch/vax/stand/boot/if_de.c b/sys/arch/vax/stand/boot/if_de.c index c4c61acfbc1..3dd71bb6aa2 100644 --- a/sys/arch/vax/stand/boot/if_de.c +++ b/sys/arch/vax/stand/boot/if_de.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_de.c,v 1.2 2005/12/10 11:45:43 miod Exp $ */ +/* $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 $ */ /* @@ -47,7 +47,12 @@ #include <lib/libsa/netif.h> #include <lib/libsa/stand.h> -#include <arch/vax/qbus/if_dereg.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" diff --git a/sys/arch/vax/stand/boot/if_ni.c b/sys/arch/vax/stand/boot/if_ni.c deleted file mode 100644 index 76f3477eb65..00000000000 --- a/sys/arch/vax/stand/boot/if_ni.c +++ /dev/null @@ -1,534 +0,0 @@ -/* $OpenBSD: if_ni.c,v 1.1 2002/06/11 09:36:23 hugh Exp $ */ -/* $NetBSD: if_ni.c,v 1.2 2000/07/10 10:40:38 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 DEBNA Ethernet controller. - */ - -#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 <../include/sid.h> -#include <../include/rpb.h> -#include <../include/pte.h> -#include <../include/macros.h> -#include <../include/mtpr.h> -#include <../include/scb.h> - -#include <lib/libkern/libkern.h> - -#include <lib/libsa/netif.h> -#include <lib/libsa/stand.h> -#include <lib/libsa/net.h> - -#include <arch/vax/bi/bireg.h> - -#include "vaxstand.h" - -#undef NIDEBUG -/* - * Tunable buffer parameters. Good idea to have them as power of 8; then - * they will fit into a logical VAX page. - */ -#define NMSGBUF 8 /* Message queue entries */ -#define NTXBUF 16 /* Transmit queue entries */ -#define NTXFRAGS 1 /* Number of transmit buffer fragments */ -#define NRXBUF 24 /* Receive queue entries */ -#define NBDESCS (NTXBUF + NRXBUF) -#define NQUEUES 3 /* RX + TX + MSG */ -#define PKTHDR 18 /* Length of (control) packet header */ -#define RXADD 18 /* Additional length of receive datagram */ -#define TXADD 18 /* "" transmit "" */ -#define MSGADD 134 /* "" message "" */ - -#include <arch/vax/bi/if_nireg.h> - - -#define SPTSIZ 16384 /* 8MB */ -#define roundpg(x) (((int)x + VAX_PGOFSET) & ~VAX_PGOFSET) -#define ALLOC(x) \ - allocbase;xbzero((caddr_t)allocbase,x);allocbase+=roundpg(x); -#define nipqb (&gvppqb->nc_pqb) -#define gvp gvppqb -#define NI_WREG(csr, val) *(volatile long *)(niaddr + (csr)) = (val) -#define NI_RREG(csr) *(volatile long *)(niaddr + (csr)) -#define DELAY(x) {volatile int i = x * 3;while (--i);} -#define WAITREG(csr,val) while (NI_RREG(csr) & val); - -static int ni_get(struct iodesc *, void *, size_t, time_t); -static int ni_put(struct iodesc *, void *, size_t); - -static int *syspte, allocbase, niaddr; -static struct ni_gvppqb *gvppqb; -static struct ni_fqb *fqb; -static struct ni_bbd *bbd; -static char enaddr[6]; -static int beenhere = 0; - -struct netif_driver ni_driver = { - 0, 0, 0, 0, ni_get, ni_put, -}; - -static void -xbzero(char *a, int s) -{ - while (s--) - *a++ = 0; -} - -static int -failtest(int reg, int mask, int test, char *str) -{ - int i = 100; - - do { - DELAY(100000); - } while (((NI_RREG(reg) & mask) != test) && --i); - - if (i == 0) { - printf("ni: %s\n", str); - return 1; - } - return 0; -} - -static int -INSQTI(void *e, void *h) -{ - int ret; - - while ((ret = insqti(e, h)) == ILCK_FAILED) - ; - return ret; -} - -static void * -REMQHI(void *h) -{ - void *ret; - - while ((ret = remqhi(h)) == (void *)ILCK_FAILED) - ; - return ret; -} - -static void -puton(void *pkt, void *q, int args) -{ - INSQTI(pkt, q); - - WAITREG(NI_PCR, PCR_OWN); - NI_WREG(NI_PCR, args); - WAITREG(NI_PCR, PCR_OWN); -} - -static void -remput(void *fq, void *pq, int args) -{ - struct ni_dg *data; - int res; - - while ((data = REMQHI(fq)) == 0) - ; - - res = INSQTI(data, pq); - if (res == Q_EMPTY) { - WAITREG(NI_PCR, PCR_OWN); - NI_WREG(NI_PCR, args); - } -} - -static void -insput(void *elem, void *q, int args) -{ - int res; - - res = INSQTI(elem, q); - if (res == Q_EMPTY) { - WAITREG(NI_PCR, PCR_OWN); - NI_WREG(NI_PCR, args); - } -} - -int -niopen(struct open_file *f, int adapt, int ctlr, int unit, int part) -{ - struct ni_dg *data; - struct ni_msg *msg; - struct ni_ptdb *ptdb; - int i, va, res; - - if (beenhere++ && askname == 0) - return 0; - - niaddr = nexaddr & ~(BI_NODESIZE - 1); - bootrpb.csrphy = niaddr; - if (adapt >= 0) - bootrpb.adpphy = adapt; - /* - * We need a bunch of memory, take it from our load - * address plus 1M. - */ - allocbase = RELOC + 1024 * 1024; - /* - * First create a SPT for the first 8MB of physmem. - */ - syspte = (int *)ALLOC(SPTSIZ*4); - for (i = 0; i < SPTSIZ; i++) - syspte[i] = PG_V|PG_RW|i; - - - gvppqb = (struct ni_gvppqb *)ALLOC(sizeof(struct ni_gvppqb)); - fqb = (struct ni_fqb *)ALLOC(sizeof(struct ni_fqb)); - bbd = (struct ni_bbd *)ALLOC(sizeof(struct ni_bbd) * NBDESCS); - - /* Init the PQB struct */ - nipqb->np_spt = nipqb->np_gpt = (int)syspte; - nipqb->np_sptlen = nipqb->np_gptlen = SPTSIZ; - nipqb->np_vpqb = (u_int32_t)gvp; - nipqb->np_bvplvl = 1; - nipqb->np_vfqb = (u_int32_t)fqb; - nipqb->np_vbdt = (u_int32_t)bbd; - nipqb->np_nbdr = NBDESCS; - - /* Free queue block */ - nipqb->np_freeq = NQUEUES; - fqb->nf_mlen = PKTHDR+MSGADD; - fqb->nf_dlen = PKTHDR+TXADD; - fqb->nf_rlen = PKTHDR+RXADD; -#ifdef NIDEBUG - printf("niopen: syspte %p gvp %p fqb %p bbd %p\n", - syspte, gvppqb, fqb, bbd); -#endif - - NI_WREG(BIREG_VAXBICSR, NI_RREG(BIREG_VAXBICSR) | BICSR_NRST); - DELAY(500000); - i = 20; - while ((NI_RREG(BIREG_VAXBICSR) & BICSR_BROKE) && --i) - DELAY(500000); -#ifdef NIDEBUG - if (i == 0) { - printf("ni: BROKE bit set after reset\n"); - return 1; - } -#endif - /* Check state */ - if (failtest(NI_PSR, PSR_STATE, PSR_UNDEF, "not undefined state")) - return 1; - - /* Clear owner bits */ - NI_WREG(NI_PSR, NI_RREG(NI_PSR) & ~PSR_OWN); - NI_WREG(NI_PCR, NI_RREG(NI_PCR) & ~PCR_OWN); - - /* kick off init */ - NI_WREG(NI_PCR, (int)gvppqb | PCR_INIT | PCR_OWN); - while (NI_RREG(NI_PCR) & PCR_OWN) - DELAY(100000); - - /* Check state */ - if (failtest(NI_PSR, PSR_INITED, PSR_INITED, "failed initialize")) - return 1; - - NI_WREG(NI_PSR, NI_RREG(NI_PSR) & ~PSR_OWN); - WAITREG(NI_PCR, PCR_OWN); - NI_WREG(NI_PCR, PCR_OWN|PCR_ENABLE); - WAITREG(NI_PCR, PCR_OWN); - WAITREG(NI_PSR, PSR_OWN); - - /* Check state */ - if (failtest(NI_PSR, PSR_STATE, PSR_ENABLED, "failed enable")) - return 1; - - NI_WREG(NI_PSR, NI_RREG(NI_PSR) & ~PSR_OWN); - -#ifdef NIDEBUG - printf("Set up message free queue\n"); -#endif - - /* Set up message free queue */ - va = ALLOC(NMSGBUF * 512); - for (i = 0; i < NMSGBUF; i++) { - msg = (void *)(va + i * 512); - - res = INSQTI(msg, &fqb->nf_mforw); - } - WAITREG(NI_PCR, PCR_OWN); - NI_WREG(NI_PCR, PCR_FREEQNE|PCR_MFREEQ|PCR_OWN); - WAITREG(NI_PCR, PCR_OWN); - -#ifdef NIDEBUG - printf("Set up xmit queue\n"); -#endif - - /* Set up xmit queue */ - va = ALLOC(NTXBUF * 512); - for (i = 0; i < NTXBUF; i++) { - struct ni_dg *data; - - data = (void *)(va + i * 512); - data->nd_status = 0; - data->nd_len = TXADD; - data->nd_ptdbidx = 1; - data->nd_opcode = BVP_DGRAM; - data->bufs[0]._offset = 0; - data->bufs[0]._key = 1; - data->nd_cmdref = allocbase; - bbd[i].nb_key = 1; - bbd[i].nb_status = 0; - bbd[i].nb_pte = (int)&syspte[allocbase>>9]; - allocbase += 2048; - data->bufs[0]._index = i; - - res = INSQTI(data, &fqb->nf_dforw); - } - WAITREG(NI_PCR, PCR_OWN); - NI_WREG(NI_PCR, PCR_FREEQNE|PCR_DFREEQ|PCR_OWN); - WAITREG(NI_PCR, PCR_OWN); - -#ifdef NIDEBUG - printf("recv buffers\n"); -#endif - - /* recv buffers */ - va = ALLOC(NRXBUF * 512); - for (i = 0; i < NRXBUF; i++) { - struct ni_dg *data; - struct ni_bbd *bd; - int idx; - - data = (void *)(va + i * 512); - data->nd_cmdref = allocbase; - data->nd_len = RXADD; - data->nd_opcode = BVP_DGRAMRX; - data->nd_ptdbidx = 2; - data->bufs[0]._key = 1; - - idx = NTXBUF + i; - bd = &bbd[idx]; - bd->nb_pte = (int)&syspte[allocbase>>9]; - allocbase += 2048; - bd->nb_len = 2048; - bd->nb_status = NIBD_VALID; - bd->nb_key = 1; - data->bufs[0]._offset = 0; - data->bufs[0]._len = bd->nb_len; - data->bufs[0]._index = idx; - - res = INSQTI(data, &fqb->nf_rforw); - } - WAITREG(NI_PCR, PCR_OWN); - NI_WREG(NI_PCR, PCR_FREEQNE|PCR_RFREEQ|PCR_OWN); - WAITREG(NI_PCR, PCR_OWN); - -#ifdef NIDEBUG - printf("Set initial parameters\n"); -#endif - - /* Set initial parameters */ - msg = REMQHI(&fqb->nf_mforw); - - msg->nm_opcode = BVP_MSG; - msg->nm_status = 0; - msg->nm_len = sizeof(struct ni_param) + 6; - msg->nm_opcode2 = NI_WPARAM; - ((struct ni_param *)&msg->nm_text[0])->np_flags = NP_PAD; - - puton(msg, &gvp->nc_forw0, PCR_CMDQNE|PCR_CMDQ0|PCR_OWN); - - - while ((data = REMQHI(&gvp->nc_forwr)) == 0) - ; - - msg = (struct ni_msg *)data; -#ifdef NIDEBUG - if (msg->nm_opcode2 != NI_WPARAM) { - printf("ni: wrong response code %d\n", msg->nm_opcode2); - insput(data, &fqb->nf_mforw, PCR_FREEQNE|PCR_MFREEQ|PCR_OWN); - } -#endif - bcopy(((struct ni_param *)&msg->nm_text[0])->np_dpa, - enaddr, ETHER_ADDR_LEN); - insput(data, &fqb->nf_mforw, PCR_FREEQNE|PCR_MFREEQ|PCR_OWN); - -#ifdef NIDEBUG - printf("Clear counters\n"); -#endif - - /* Clear counters */ - msg = REMQHI(&fqb->nf_mforw); - msg->nm_opcode = BVP_MSG; - msg->nm_status = 0; - msg->nm_len = sizeof(struct ni_param) + 6; - msg->nm_opcode2 = NI_RCCNTR; - - puton(msg, &gvp->nc_forw0, PCR_CMDQNE|PCR_CMDQ0|PCR_OWN); - remput(&gvp->nc_forwr, &fqb->nf_mforw, PCR_FREEQNE|PCR_MFREEQ|PCR_OWN); - -#ifdef NIDEBUG - printf("Enable transmit logic\n"); -#endif - - /* Enable transmit logic */ - msg = REMQHI(&fqb->nf_mforw); - - msg->nm_opcode = BVP_MSG; - msg->nm_status = 0; - msg->nm_len = 18; - msg->nm_opcode2 = NI_STPTDB; - ptdb = (struct ni_ptdb *)&msg->nm_text[0]; - bzero(ptdb, sizeof(struct ni_ptdb)); - ptdb->np_index = 1; - ptdb->np_fque = 1; - - puton(msg, &gvp->nc_forw0, PCR_CMDQNE|PCR_CMDQ0|PCR_OWN); - remput(&gvp->nc_forwr, &fqb->nf_mforw, PCR_FREEQNE|PCR_MFREEQ|PCR_OWN); - -#ifdef NIDEBUG - printf("ni: hardware address %s\n", ether_sprintf(enaddr)); - printf("Setting receive parameters\n"); -#endif - msg = REMQHI(&fqb->nf_mforw); - ptdb = (struct ni_ptdb *)&msg->nm_text[0]; - bzero(ptdb, sizeof(struct ni_ptdb)); - msg->nm_opcode = BVP_MSG; - msg->nm_len = 18; - ptdb->np_index = 2; - ptdb->np_fque = 2; - msg->nm_opcode2 = NI_STPTDB; - ptdb->np_type = ETHERTYPE_IP; - ptdb->np_flags = PTDB_UNKN|PTDB_BDC; - memset(ptdb->np_mcast[0], 0xff, ETHER_ADDR_LEN); - ptdb->np_adrlen = 1; - msg->nm_len += 8; - insput(msg, &gvp->nc_forw0, PCR_CMDQNE|PCR_CMDQ0|PCR_OWN); - remput(&gvp->nc_forwr, &fqb->nf_mforw, PCR_FREEQNE|PCR_MFREEQ|PCR_OWN); - -#ifdef NIDEBUG - printf("finished\n"); -#endif - - net_devinit(f, &ni_driver, enaddr); - return 0; -} - -int -ni_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timeout) -{ - struct ni_dg *data; - struct ni_bbd *bd; - int nsec = getsecs() + timeout; - int len, idx; - -loop: while ((data = REMQHI(&gvp->nc_forwr)) == 0 && (nsec > getsecs())) - ; - - if (nsec <= getsecs()) - return 0; - - switch (data->nd_opcode) { - case BVP_DGRAMRX: - idx = data->bufs[0]._index; - bd = &bbd[idx]; - len = data->bufs[0]._len; - if (len > maxlen) - len = maxlen; - bcopy((caddr_t)data->nd_cmdref, pkt, len); - bd->nb_pte = (int)&syspte[data->nd_cmdref>>9]; - data->bufs[0]._len = bd->nb_len = 2048; - data->bufs[0]._offset = 0; - data->bufs[0]._key = 1; - bd->nb_status = NIBD_VALID; - bd->nb_key = 1; - data->nd_len = RXADD; - data->nd_status = 0; - insput(data, &fqb->nf_rforw, - PCR_FREEQNE|PCR_RFREEQ|PCR_OWN); - return len; - - case BVP_DGRAM: - insput(data, &fqb->nf_dforw, PCR_FREEQNE|PCR_DFREEQ|PCR_OWN); - break; - default: - insput(data, &fqb->nf_mforw, PCR_FREEQNE|PCR_MFREEQ|PCR_OWN); - break; - } - - NI_WREG(NI_PSR, NI_RREG(NI_PSR) & ~(PSR_OWN|PSR_RSQ)); - goto loop; -} - -int -ni_put(struct iodesc *desc, void *pkt, size_t len) -{ - struct ni_dg *data; - struct ni_bbd *bdp; - - data = REMQHI(&fqb->nf_dforw); -#ifdef NIDEBUG - if (data == 0) { - printf("ni_put: driver problem, data == 0\n"); - return -1; - } -#endif - bdp = &bbd[(data->bufs[0]._index & 0x7fff)]; - bdp->nb_status = NIBD_VALID; - bdp->nb_len = (len < 64 ? 64 : len); - bcopy(pkt, (caddr_t)data->nd_cmdref, len); - data->bufs[0]._offset = 0; - data->bufs[0]._len = bdp->nb_len; - data->nd_opcode = BVP_DGRAM; - data->nd_pad3 = 1; - data->nd_ptdbidx = 1; - data->nd_len = 18; - insput(data, &gvp->nc_forw0, PCR_CMDQNE|PCR_CMDQ0|PCR_OWN); - return len; -} - -int -niclose(struct open_file *f) -{ - if (beenhere) { - WAITREG(NI_PCR, PCR_OWN); - NI_WREG(NI_PCR, PCR_OWN|PCR_SHUTDOWN); - WAITREG(NI_PCR, PCR_OWN); - } - return 0; -} diff --git a/sys/arch/vax/stand/boot/ra.c b/sys/arch/vax/stand/boot/ra.c index c7242cf4f07..dbb0efca4ce 100644 --- a/sys/arch/vax/stand/boot/ra.c +++ b/sys/arch/vax/stand/boot/ra.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ra.c,v 1.4 2011/03/13 00:13:53 deraadt Exp $ */ +/* $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. @@ -46,9 +46,6 @@ #include "arch/vax/mscp/mscp.h" #include "arch/vax/mscp/mscpreg.h" -#include "arch/vax/bi/bireg.h" -#include "arch/vax/bi/kdbreg.h" - #include "vaxstand.h" static void command(int, int); @@ -69,7 +66,7 @@ static volatile struct uda { static struct disklabel ralabel; static char io_buf[DEV_BSIZE]; -static int dpart, dunit, remap, is_tmscp, curblock; +static int dpart, dunit, is_tmscp, curblock; static volatile u_short *ra_ip, *ra_sa, *ra_sw; static volatile u_int *mapregs; @@ -95,56 +92,28 @@ raopen(struct open_file *f, int adapt, int ctlr, int unit, int part) dpart = part; if (ctlr < 0) ctlr = 0; - remap = csrbase && nexaddr; curblock = 0; - if (csrbase) { /* On a 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; - } else { - paddr_t kdaddr; - volatile int *w; - volatile int i = 10000; - - if (askname == 0) { - nexaddr = bootrpb.csrphy; - dunit = bootrpb.unit; - } else { - nexaddr = (bootrpb.csrphy & ~(BI_NODESIZE - 1)) + KDB_IP; - bootrpb.csrphy = nexaddr; - } - - kdaddr = nexaddr & ~(BI_NODESIZE - 1); - ra_ip = (short *)(kdaddr + KDB_IP); - ra_sa = (short *)(kdaddr + KDB_SA); - ra_sw = (short *)(kdaddr + KDB_SW); - johan = ((u_int)&uda.uda_ca.ca_rspdsc) & 0xffff; - johan2 = (((u_int)&uda.uda_ca.ca_rspdsc) & 0xffff0000) >> 16; - w = (int *)(kdaddr + BIREG_VAXBICSR); - *w = *w | BICSR_NRST; - while (i--) /* Need delay??? */ - ; - w = (int *)(kdaddr + BIREG_BER); - *w = ~(BIBER_MBZ|BIBER_NMR|BIBER_UPEN);/* ??? */ + /* 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"); @@ -264,18 +233,14 @@ rastrategy(void *f, int func, daddr32_t dblk, u_int pfnum, mapnr, nsize; #ifdef DEV_DEBUG - printf("rastrategy: buf %p remap %d is_tmscp %d\n", - buf, remap, is_tmscp); + printf("rastrategy: buf %p is_tmscp %d\n", + buf, is_tmscp); #endif - if (remap) { - pfnum = (u_int)buf >> VAX_PGSHIFT; + 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; - } else - uda.uda_cmd.mscp_seq.seq_buffer = ((u_int)buf); + 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; diff --git a/sys/arch/vax/stand/boot/tmscp.c b/sys/arch/vax/stand/boot/tmscp.c deleted file mode 100644 index 4c72cad1711..00000000000 --- a/sys/arch/vax/stand/boot/tmscp.c +++ /dev/null @@ -1,204 +0,0 @@ -/* $OpenBSD: tmscp.c,v 1.4 2011/03/13 00:13:53 deraadt Exp $ */ -/* $NetBSD: tmscp.c,v 1.3 1999/06/30 18:19:26 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 0 /* Kludge */ -#define NCMD 0 /* Kludge */ - -#include "sys/param.h" -#include "sys/disklabel.h" - -#include "lib/libsa/stand.h" - -#include "../include/pte.h" -#include "arch/vax/mscp/mscp.h" -#include "arch/vax/mscp/mscpreg.h" - -#include "vaxstand.h" - -static command(int,int); - -/* - * These routines for TMSCP tape standalone boot is very simple, - * assuming a lots of thing like that we only working at one tape at - * a time, no separate routines for uba driver etc.. - * This code is directly copied from ra disk driver. - */ - -struct ra_softc { - int udaddr; - int ubaddr; - int unit; -}; - -static volatile struct uda { - struct mscp_1ca uda_ca; /* communications area */ - struct mscp uda_rsp; /* response packets */ - struct mscp uda_cmd; /* command packets */ -} uda; - -struct udadevice { - short udaip; - short udasa; -}; - -static volatile struct uda *ubauda; -static volatile struct udadevice *udacsr; -static struct ra_softc ra_softc; -static int curblock; - - -tmscpopen(f, adapt, ctlr, unit, part) - struct open_file *f; - int ctlr, unit, part; -{ - char *msg; - extern u_int tmsaddr; - volatile struct ra_softc *ra=&ra_softc; - volatile u_int *nisse; - unsigned short johan; - int i,err; - - curblock = 0; - if(adapt>nuba) return(EADAPT); - if(ctlr>nuda) return(ECTLR); - ra->udaddr=uioaddr[adapt]+tmsaddr; - ra->ubaddr=(int)ubaaddr[adapt]; - ra->unit=unit; - udacsr=(void*)ra->udaddr; - nisse=((u_int *)ubaaddr[adapt]) + 512; - nisse[494]=PG_V|(((u_int)&uda)>>9); - nisse[495]=nisse[494]+1; - ubauda=(void*)0x3dc00+(((u_int)(&uda))&0x1ff); - - /* - * Init of this tmscp ctlr. - */ - udacsr->udaip=0; /* Start init */ - while((udacsr->udasa&MP_STEP1) == 0); - udacsr->udasa=0x8000; - while((udacsr->udasa&MP_STEP2) == 0); - johan=(((u_int)ubauda)&0xffff)+8; - udacsr->udasa=johan; - while((udacsr->udasa&MP_STEP3) == 0); - udacsr->udasa=3; - while((udacsr->udasa&MP_STEP4) == 0); - udacsr->udasa=0x0001; - - uda.uda_ca.ca_rspdsc=(int)&ubauda->uda_rsp.mscp_cmdref; - uda.uda_ca.ca_cmddsc=(int)&ubauda->uda_cmd.mscp_cmdref; - 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=ra->unit; - command(M_OP_ONLINE, 0); - - if (part) { - 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; - } - - f->f_devdata=(void *)ra; - return(0); -} - -static -command(cmd, arg) -{ - volatile int hej; - - 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; - hej = udacsr->udaip; - while (uda.uda_ca.ca_rspdsc < 0) { - if (uda.uda_ca.ca_cmdint) - uda.uda_ca.ca_cmdint = 0; - } - -} - -tmscpstrategy(ra, func, dblk, size, buf, rsize) - struct ra_softc *ra; - int func; - daddr32_t dblk; - char *buf; - u_int size, *rsize; -{ - u_int i,j,pfnum, mapnr, nsize, bn, cn, sn, tn; - volatile struct udadevice *udadev=(void*)ra->udaddr; - volatile u_int *ptmapp = (u_int *)ra->ubaddr + 512; - volatile int hej; - - pfnum=(u_int)buf>>VAX_PGSHIFT; - - for(mapnr=0, nsize=size;(nsize+VAX_NBPG)>0;nsize-=VAX_NBPG) - ptmapp[mapnr++]=PG_V|pfnum++; - - /* - * 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 = ra->unit; - command(M_OP_READ, 0); - } - - *rsize=size; - return 0; -} diff --git a/sys/arch/vax/stand/boot/vaxstand.h b/sys/arch/vax/stand/boot/vaxstand.h index 867d7ba9ebf..c8b41c4bfab 100644 --- a/sys/arch/vax/stand/boot/vaxstand.h +++ b/sys/arch/vax/stand/boot/vaxstand.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vaxstand.h,v 1.2 2011/03/13 00:13:53 deraadt Exp $ */ +/* $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. @@ -59,12 +59,6 @@ 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 hpopen(struct open_file *, int, int, int, int), - hpstrategy(void *, int, daddr32_t, size_t, void *, size_t *); -int ctuopen(struct open_file *, int, int, int, int), - ctustrategy(void *, int, daddr32_t, size_t, void *, size_t *); -int tmscpopen(struct open_file *, int, int, int, int), - tmscpstrategy(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), @@ -79,7 +73,5 @@ 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 niopen(struct open_file *, int, int, int, int), - niclose(struct open_file *); int netopen(struct open_file *), netclose(struct open_file *); diff --git a/sys/arch/vax/stand/boot/version b/sys/arch/vax/stand/boot/version index 8bc0f4ed6b7..fafc63cb8a6 100644 --- a/sys/arch/vax/stand/boot/version +++ b/sys/arch/vax/stand/boot/version @@ -1,4 +1,4 @@ -$OpenBSD: version,v 1.8 2008/08/26 18:36:21 miod Exp $ +$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 @@ -37,3 +37,4 @@ is taken as the current. 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 |