summaryrefslogtreecommitdiff
path: root/sys/arch/vax/stand
diff options
context:
space:
mode:
authorMats O Jansson <maja@cvs.openbsd.org>1998-02-03 11:48:31 +0000
committerMats O Jansson <maja@cvs.openbsd.org>1998-02-03 11:48:31 +0000
commit9ed632e46e42580a8096adcdc71262d39072b0ac (patch)
treea8aeb1e0336bde2f3cf386977a3cea5fffad8e05 /sys/arch/vax/stand
parentb9eff3dc2da109a570cf5e41a8c720473110e9cc (diff)
Sync with NetBSD 970827. Forgot this one last time. -moj
Diffstat (limited to 'sys/arch/vax/stand')
-rw-r--r--sys/arch/vax/stand/Makefile42
-rw-r--r--sys/arch/vax/stand/autoconf.c30
-rw-r--r--sys/arch/vax/stand/boot.c9
-rw-r--r--sys/arch/vax/stand/bootxx.c107
-rw-r--r--sys/arch/vax/stand/conf.c58
-rw-r--r--sys/arch/vax/stand/consio.c43
-rw-r--r--sys/arch/vax/stand/copy.c6
-rw-r--r--sys/arch/vax/stand/devopen.c303
-rw-r--r--sys/arch/vax/stand/if_le.c283
-rw-r--r--sys/arch/vax/stand/mfm.c22
-rw-r--r--sys/arch/vax/stand/netio.c245
-rw-r--r--sys/arch/vax/stand/srt0.s19
-rw-r--r--sys/arch/vax/stand/start.s15
-rw-r--r--sys/arch/vax/stand/str.s66
-rw-r--r--sys/arch/vax/stand/tmscp.c5
-rw-r--r--sys/arch/vax/stand/vaxstand.h14
16 files changed, 944 insertions, 323 deletions
diff --git a/sys/arch/vax/stand/Makefile b/sys/arch/vax/stand/Makefile
index b9a0cb46e9f..7ca18d3c5d0 100644
--- a/sys/arch/vax/stand/Makefile
+++ b/sys/arch/vax/stand/Makefile
@@ -1,28 +1,32 @@
-# $OpenBSD: Makefile,v 1.7 1997/01/15 23:24:15 maja Exp $
-# $NetBSD: Makefile,v 1.11 1996/10/18 06:10:18 thorpej Exp $
+# $OpenBSD: Makefile,v 1.8 1998/02/03 11:48:23 maja Exp $
+# $NetBSD: Makefile,v 1.14 1997/06/29 21:30:09 ragge Exp $
#
-INCPATH=-I. -I../../.. -I../.. -I../../../lib/libsa
+INCPATH=-I. -I../../../../.. -I../../../.. -I../../.. -I../.. -I../../../lib/libsa
CC= cc
AS= as
+BINOWN= bin
+BINGRP= bin
S= ../../..
RELOC= 100000
XXRPB= 0F4240
-CFLAGS+=-O ${INCPATH} -DSTANDALONE -DRELOC=0x${RELOC} \
- -D_VAX_INLINE_ -DXXRPB=0x$(XXRPB)
+CFLAGS+=-O ${INCPATH} -DSTANDALONE -DRELOC=0x${RELOC} -DXXRPB=0x$(XXRPB)
DEVS= autoconf.o hp.o ra.o tmscp.o ctu.o mfm.o rom.o romread.o \
- scsi_low.o scsi_hi.o sd.o
+ scsi_low.o scsi_hi.o sd.o netio.o if_le.o
.include "$S/lib/libsa/Makefile.inc"
-LIBSA= ${SALIB}
+LIBS= -L. -Llib/sa -lsvax -lsa -lsvax
+
SVAX= consio.o urem.o udiv.o str.o
all: ${LIBSA} xxboot boot copy edlabel
+includes:
+
libsvax.a: ${SVAX}
ar crv $@ $?
ranlib $@
@@ -46,29 +50,31 @@ srt0.o: srt0.s
#
-xxboot: start.o bootxx.o romread.o libsvax.a
- ld -N -Ttext ${RELOC} -o a.out start.o bootxx.o romread.o \
- ${LIBSA} libsvax.a
+xxboot: start.o bootxx.o romread.o libsvax.a ${SALIB}
+ ld -N -Ttext ${RELOC} -o a.out start.o bootxx.o romread.o ${LIBS}
@strip a.out
@size a.out
@dd if=a.out of=xxboot bs=32 skip=1
@rm -f a.out
-boot: boot.o srt0.o devopen.o conf.o ${DEVS} libsvax.a
+boot: boot.o srt0.o devopen.o conf.o ${DEVS} libsvax.a ${SALIB} vers.o
+ @date '+_vers: .globl _vers; .asciz ">> NetBSD/vax boot [%y%m%d %H:%M] <<"' | as -o vers.o
ld -N -Ttext ${RELOC} -e nisse -o $@ srt0.o devopen.o boot.o \
- conf.o ${DEVS} ${LIBSA} libsvax.a
+ conf.o ${DEVS} ${LIBS} vers.o
@strip boot
@size boot
-edlabel: edlabel.o srt0.o devopen.o conf.o ${DEVS} libsvax.a
+edlabel: edlabel.o srt0.o devopen.o conf.o ${DEVS} libsvax.a vers.o
+ @date '+_vers: .globl _vers; .asciz ">> NetBSD/vax boot [%y%m%d %H:%M] <<"' | as -o vers.o
ld -N -Ttext ${RELOC} -e nisse -o $@ srt0.o devopen.o edlabel.o\
- conf.o ${DEVS} ${LIBSA} libsvax.a
+ conf.o ${DEVS} ${LIBS} vers.o
@strip edlabel
@size edlabel
-copy: copy.o srt0.o devopen.o conf.o ${DEVS} libsvax.a
+copy: copy.o srt0.o devopen.o conf.o ${DEVS} libsvax.a vers.o
+ @date '+_vers: .globl _vers; .asciz ">> NetBSD/vax boot [%y%m%d %H:%M] <<"' | as -o vers.o
ld -N -Ttext ${RELOC} -e nisse -o $@ srt0.o devopen.o copy.o \
- conf.o ${DEVS} ${LIBSA} libsvax.a
+ conf.o ${DEVS} ${LIBS} vers.o
@strip copy
@size copy
@@ -111,11 +117,11 @@ install: boot xxboot
rm -f ${DESTDIR}/usr/mdec/hpboot
ln ${DESTDIR}/usr/mdec/xxboot ${DESTDIR}/usr/mdec/hpboot
-clean::
+clean:
rm -f start.o romread.o bootxx.o init.o xxboot boot racopy \
libsvax.a udiv.o urem.o consio.o ${DEVS} edlabel edlabel.o
rm -f conf.o boot.o rom.o racopy.o srt0.o devopen.o rootcopy.o \
- copy copy.o init.o
+ copy copy.o init.o str.o
.include <bsd.prog.mk>
diff --git a/sys/arch/vax/stand/autoconf.c b/sys/arch/vax/stand/autoconf.c
index 206617755d5..a1c38fee174 100644
--- a/sys/arch/vax/stand/autoconf.c
+++ b/sys/arch/vax/stand/autoconf.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: autoconf.c,v 1.4 1997/05/29 00:04:18 niklas Exp $ */
-/* $NetBSD: autoconf.c,v 1.6 1996/08/02 11:21:46 ragge Exp $ */
+/* $OpenBSD: autoconf.c,v 1.5 1998/02/03 11:48:24 maja Exp $ */
+/* $NetBSD: autoconf.c,v 1.9 1997/04/10 21:25:18 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -72,14 +72,17 @@ static int uda630[]={qbdev(0772150),qbdev(0760334)};
autoconf()
{
+ extern int memsz;
switch (vax_cputype) {
default:
printf("CPU type %d not supported by boot\n",vax_cputype);
- asm("halt");
+ printf("trying anyway...\n");
+ break;
case VAX_8600:
+ memsz = 0;
nmba = 8;
nuba = 8;
nuda = 1;
@@ -91,6 +94,7 @@ autoconf()
break;
case VAX_780:
+ memsz = 0;
nmba = 4;
nuba = 4;
nuda = 1;
@@ -102,6 +106,7 @@ autoconf()
break;
case VAX_750:
+ memsz = 0;
nmba = 3;
nuba = 2;
nuda = 1;
@@ -123,9 +128,28 @@ autoconf()
break;
case VAX_8200:
+ memsz = 0;
nbi = 1;
biaddr = bi8200;
bioaddr = bio8200;
+
+ case VAX_TYP_SOC:
+ case VAX_TYP_RIGEL:
+ break;
+
}
}
+/*
+ * Return seconds since sometime...
+ * Some VAXen doesn't have TODR, return a fake value...
+ */
+getsecs()
+{
+ static int fakesecs;
+ int todr = mfpr(PR_TODR);
+
+ if (todr)
+ return todr/100;
+ return ++fakesecs;
+}
diff --git a/sys/arch/vax/stand/boot.c b/sys/arch/vax/stand/boot.c
index 7fd54220f49..57b9b936981 100644
--- a/sys/arch/vax/stand/boot.c
+++ b/sys/arch/vax/stand/boot.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: boot.c,v 1.3 1997/01/15 23:24:16 maja Exp $ */
-/* $NetBSD: boot.c,v 1.5 1996/08/02 11:21:49 ragge Exp $ */
+/* $OpenBSD: boot.c,v 1.4 1998/02/03 11:48:24 maja Exp $ */
+/* $NetBSD: boot.c,v 1.7 1997/06/08 17:49:16 ragge Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
* All rights reserved.
@@ -50,7 +50,7 @@
*/
char line[100];
-volatile u_int devtype, bootdev;
+volatile int devtype, bootdev;
extern unsigned opendev;
extern unsigned *bootregs;
@@ -59,6 +59,7 @@ Xmain()
register howto asm("r11");
register bdev asm("r10");
int io, retry, type;
+ extern char vers[];
io=0;
bootdev=bdev;
@@ -74,7 +75,7 @@ Xmain()
for (retry = 0;;) {
if (io >= 0)
- printf("\nNboot\n");
+ printf("\n%s\n", vers);
if (howto & RB_ASKNAME) {
printf(": ");
gets(line);
diff --git a/sys/arch/vax/stand/bootxx.c b/sys/arch/vax/stand/bootxx.c
index 5bc1bc3d29e..3532677e884 100644
--- a/sys/arch/vax/stand/bootxx.c
+++ b/sys/arch/vax/stand/bootxx.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: bootxx.c,v 1.5 1997/05/29 00:04:19 niklas Exp $ */
-/* $NetBSD: bootxx.c,v 1.7 1996/08/02 11:21:53 ragge Exp $ */
+/* $OpenBSD: bootxx.c,v 1.6 1998/02/03 11:48:25 maja Exp $ */
+/* $NetBSD: bootxx.c,v 1.11 1997/06/08 17:49:17 ragge Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
* All rights reserved.
@@ -74,11 +74,15 @@ int command(int, int);
*/
volatile u_int devtype, bootdev;
-unsigned opendev, boothowto, bootset;
+unsigned opendev, boothowto, bootset, memsz;
extern unsigned *bootregs;
extern struct rpb *rpb;
+/*
+ * The boot block are used by 11/750, 8200, MicroVAX II/III, VS2000,
+ * VS3100/??, VS4000 and VAX6000/???, and only when booting from disk.
+ */
Xmain()
{
int io;
@@ -88,10 +92,11 @@ Xmain()
switch (vax_cputype) {
- case VAX_78032:
- case VAX_650:
- bootdev = rpb->devtyp;
-
+ case VAX_TYP_UV2:
+ case VAX_TYP_CVAX:
+ case VAX_TYP_RIGEL:
+ case VAX_TYP_NVAX:
+ case VAX_TYP_SOC:
/*
* now relocate rpb/bqo (which are used by ROM-routines)
*/
@@ -102,11 +107,14 @@ Xmain()
bcopy ((void*)rpb->iovec, bqo, rpb->iovecsz);
rpb->iovec = (int)bqo;
bootregs[11] = (int)rpb;
+ bootdev = rpb->devtyp;
+ memsz = rpb->pfncnt << 9;
break;
case VAX_8200:
case VAX_750:
bootdev = bootregs[10];
+ memsz = 0;
break;
default:
@@ -118,7 +126,7 @@ Xmain()
bootset = getbootdev();
- printf("\nhowto 0x%x, bdev 0x%x, booting...\n", boothowto, bootdev);
+ printf("\nhowto 0x%x, bdev 0x%x, booting...", boothowto, bootdev);
io = open(hej, 0);
if (io >= 0 && io < SOPEN_MAX) {
@@ -140,7 +148,7 @@ copyunix(aio)
printf("Bad format\n");
return;
}
- printf("%d", x.a_text);
+
if (N_GETMAGIC(x) == ZMAGIC && lseek(io, N_TXTADDR(x), SEEK_SET) == -1)
goto shread;
if (read(io, (char *) 0x10000, x.a_text) != x.a_text)
@@ -149,17 +157,17 @@ copyunix(aio)
if (N_GETMAGIC(x) == ZMAGIC || N_GETMAGIC(x) == NMAGIC)
while ((int) addr & CLOFSET)
*addr++ = 0;
- printf("+%d", x.a_data);
+
if (read(io, addr + 0x10000, x.a_data) != x.a_data)
goto shread;
addr += x.a_data;
bcopy((void *) 0x10000, 0, (int) addr);
- printf("+%d", x.a_bss);
+
for (i = 0; i < x.a_bss; i++)
*addr++ = 0;
for (i = 0; i < 128 * 512; i++) /* slop */
*addr++ = 0;
- printf(" start 0x%x\n", x.a_entry);
+ printf("done. (%d+%d)\n", x.a_text + x.a_data, x.a_bss);
hoppabort(x.a_entry, boothowto, bootset);
(*((int (*) ()) x.a_entry)) ();
return;
@@ -170,58 +178,62 @@ shread:
getbootdev()
{
- int i, major, adaptor, controller, unit, partition;
+ int i, adaptor, controller, unit, partition, retval;
+ adaptor = controller = unit = partition = 0;
switch (vax_cputype) {
- case VAX_78032:
- case VAX_650:
+ case VAX_TYP_UV2:
+ case VAX_TYP_CVAX:
adaptor = 0;
controller = ((rpb->csrphy & 017777) == 0xDC)?1:0;
unit = rpb->unit; /* DUC, DUD? */
break;
- case VAX_8200:
- case VAX_750:
+ case VAX_TYP_RIGEL:
+ unit = rpb->unit;
+ if (unit > 99)
+ unit /= 100; /* DKB300 is target 3 */
+ break;
+
+
+ case VAX_TYP_8SS:
+ case VAX_TYP_750:
controller = 0; /* XXX Actually massbuss can be on 3 ctlr's */
unit = bootregs[3];
break;
}
- partition = 0;
-
- switch (bootdev) {
- case BDEV_MBA: /* massbuss boot */
- major = 0; /* hp / ... */
+ switch (B_TYPE(bootdev)) {
+ case BDEV_HP: /* massbuss boot */
adaptor = (bootregs[1] & 0x6000) >> 17;
break;
case BDEV_UDA: /* UDA50 boot */
- major = 9; /* ra / mscp */
if (vax_cputype == VAX_750)
adaptor = (bootregs[1] & 0x40000 ? 0 : 1);
break;
- case BDEV_TK50: /* TK50 boot */
- major = 15; /* tms / tmscp */
- break;
-
- case 36: /* VS2000/KA410 ST506 disk */
- case 37: /* VS2000/KA410 SCSI tape */
- case 42: /* VS3100/76 SCSI-floppy(?) */
- major = 17; /* 17 is assigned to the ROM-drivers */
+ case BDEV_TK: /* TK50 boot */
+ case BDEV_CNSL: /* Console storage boot */
+ case BDEV_RD: /* RD/RX on HDC9224 (MV2000) */
+ controller = 0; /* They are always on ctlr 0 */
break;
- case BDEV_CONSOLE:
- major = 8;
+ case BDEV_ST: /* SCSI-tape on NCR5380 (MV2000) */
+ case BDEV_SD: /* SCSI-disk on NCR5380 (3100/76) */
+ /*
+ * No standalone routines for SCSI support yet.
+ * Use rom-routines instead!
+ */
break;
default:
printf("Unsupported boot device %d, trying anyway.\n", bootdev);
boothowto |= (RB_SINGLE | RB_ASKNAME);
}
- return MAKEBOOTDEV(major, adaptor, controller, unit, partition);
+ return MAKEBOOTDEV(bootdev, adaptor, controller, unit, partition);
}
struct devsw devsw[] = {
@@ -261,10 +273,10 @@ devopen(f, fname, file)
/*
* On uVAX we need to init [T]MSCP ctlr to be able to use it.
*/
- if (vax_cputype == VAX_78032 || vax_cputype == VAX_650) {
+ if (vax_cputype == VAX_TYP_UV2 || vax_cputype == VAX_TYP_CVAX) {
switch (bootdev) {
case BDEV_UDA: /* MSCP */
- case BDEV_TK50: /* TMSCP */
+ case BDEV_TK: /* TMSCP */
csr = (struct udadevice *)rpb->csrphy;
csr->udaip = 0; /* Start init */
@@ -281,7 +293,7 @@ devopen(f, fname, file)
(int) &uda.uda_rsp.mscp_cmdref;
uda.uda_ca.ca_cmddsc =
(int) &uda.uda_cmd.mscp_cmdref;
- if (bootdev == BDEV_TK50)
+ if (bootdev == BDEV_TK)
uda.uda_cmd.mscp_vcid = 1;
command(M_OP_SETCTLRC, 0);
uda.uda_cmd.mscp_unit = rpb->unit;
@@ -295,7 +307,7 @@ devopen(f, fname, file)
* Actually disklabel is only needed when using hp disks,
* but it doesn't hurt to always get it.
*/
- if ((bootdev != BDEV_TK50) && (bootdev != BDEV_CONSOLE)) {
+ if ((bootdev != BDEV_TK) && (bootdev != BDEV_CNSL)) {
msg = getdisklabel((void *)LABELOFFSET + RELOC, &lp);
if (msg)
printf("getdisklabel: %s\n", msg);
@@ -333,9 +345,12 @@ romstrategy(sc, func, dblk, size, buf, rsize)
int nsize = size;
switch (vax_cputype) {
-
- case VAX_650:
- case VAX_78032:
+ /*
+ * case VAX_TYP_UV2:
+ * case VAX_TYP_CVAX:
+ * case VAX_TYP_RIGEL:
+ */
+ default:
switch (bootdev) {
case BDEV_UDA: /* MSCP */
@@ -346,7 +361,7 @@ romstrategy(sc, func, dblk, size, buf, rsize)
command(M_OP_READ, 0);
break;
- case BDEV_TK50: /* TMSCP */
+ case BDEV_TK: /* TMSCP */
if (dblk < curblock) {
uda.uda_cmd.mscp_seq.seq_bytecount =
curblock - dblk;
@@ -366,8 +381,10 @@ romstrategy(sc, func, dblk, size, buf, rsize)
command(M_OP_READ, 0);
}
break;
- case 36:
- case 37:
+ case BDEV_RD:
+ case BDEV_ST:
+ case BDEV_SD:
+
default:
romread_uvax(block, size, buf, bootregs);
break;
@@ -377,7 +394,7 @@ romstrategy(sc, func, dblk, size, buf, rsize)
case VAX_8200:
case VAX_750:
- if (bootdev != BDEV_MBA) {
+ if (bootdev != BDEV_HP) {
while (size > 0) {
while ((read750(block, bootregs) & 0x01) == 0)
printf("Retrying read bn# %d\n", block);
diff --git a/sys/arch/vax/stand/conf.c b/sys/arch/vax/stand/conf.c
index 348fb27bfab..952d3060a70 100644
--- a/sys/arch/vax/stand/conf.c
+++ b/sys/arch/vax/stand/conf.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: conf.c,v 1.4 1997/05/29 00:04:19 niklas Exp $ */
-/* $NetBSD: conf.c,v 1.6 1996/08/02 11:21:56 ragge Exp $ */
+/* $OpenBSD: conf.c,v 1.5 1998/02/03 11:48:25 maja Exp $ */
+/* $NetBSD: conf.c,v 1.8 1997/04/10 21:25:21 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -34,8 +34,13 @@
#include "sys/param.h"
+#include <netinet/in.h>
+
+#include <machine/rpb.h>
+
#include "lib/libsa/stand.h"
#include "lib/libsa/ufs.h"
+#include "lib/libsa/nfs.h"
#include "vaxstand.h"
@@ -46,30 +51,32 @@ int tmscpopen(), tmscpstrategy();
int romopen(), romstrategy();
int mfmopen(), mfmstrategy();
int sdopen(), sdstrategy();
-
+int netopen(), netstrategy(), netclose();
struct devsw devsw[]={
SADEV("hp",hpstrategy, hpopen, nullsys, noioctl),
- SADEV(0 ,nullsys, nodev, nullsys, noioctl), /* ht */
- SADEV(0 ,nullsys, nodev, nullsys, noioctl), /* up */
- SADEV(0 ,nullsys, nodev, nullsys, noioctl), /* hk */
- SADEV( 0 ,nullsys, nodev, nullsys, noioctl),
- SADEV(0 ,nullsys, nodev, nullsys, noioctl), /* tm */
- SADEV(0 ,nullsys, nodev, nullsys, noioctl), /* ts */
- SADEV(0 ,nullsys, nodev, nullsys, noioctl), /* mt */
+ SADEV("qe",netstrategy, netopen, netclose, noioctl), /* DEQNA */
SADEV("ctu",ctustrategy, ctuopen, nullsys, noioctl),
SADEV("ra",rastrategy, raopen, nullsys, noioctl),
- SADEV(0 ,nullsys, nodev, nullsys, noioctl), /* ut */
- SADEV(0 ,nullsys, nodev, nullsys, noioctl), /* id */
- SADEV(0 ,nullsys, nodev, nullsys, noioctl), /* rx */
- SADEV(0 ,nullsys, nodev, nullsys, noioctl), /* uu */
- SADEV(0 ,nullsys, nodev, nullsys, noioctl), /* rl */
SADEV("mt",tmscpstrategy, tmscpopen, nullsys, noioctl),
- SADEV(0 ,nullsys, nodev, nullsys, noioctl), /* crx */
- SADEV("rom",romstrategy, romopen, nullsys, noioctl), /* 17 */
- SADEV("mfm",mfmstrategy, mfmopen, nullsys, noioctl), /* 18 */
- SADEV("sd",sdstrategy, sdopen, nullsys, noioctl), /* 18 */
+ SADEV("rom",romstrategy, romopen, nullsys, noioctl),
+ SADEV("rd",mfmstrategy, mfmopen, nullsys, noioctl),
+ SADEV("sd",sdstrategy, sdopen, nullsys, noioctl),
SADEV("st",sdstrategy, sdopen, nullsys, noioctl),
+ SADEV("le",netstrategy, netopen, netclose, noioctl), /* LANCE */
+};
+
+int cnvtab[] = {
+ BDEV_HP,
+ BDEV_QE,
+ BDEV_CNSL,
+ BDEV_UDA,
+ BDEV_TK,
+ -1,
+ BDEV_RD,
+ BDEV_SD,
+ BDEV_ST,
+ BDEV_LE,
};
int ndevs = (sizeof(devsw)/sizeof(devsw[0]));
@@ -78,5 +85,18 @@ struct fs_ops file_system[] = {
{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat }
};
+struct fs_ops nfs_system[] = {
+ { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
+};
+
int nfsys = (sizeof(file_system) / sizeof(struct fs_ops));
+extern struct netif_driver qe_driver;
+extern struct netif_driver le_driver;
+
+struct netif_driver *netif_drivers[] = {
+/* &qe_driver, */
+ &le_driver,
+};
+int n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0]));
+
diff --git a/sys/arch/vax/stand/consio.c b/sys/arch/vax/stand/consio.c
index 5dac79c8827..c9791416bfa 100644
--- a/sys/arch/vax/stand/consio.c
+++ b/sys/arch/vax/stand/consio.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: consio.c,v 1.3 1997/05/29 00:04:19 niklas Exp $ */
-/* $NetBSD: consio.c,v 1.4 1996/08/02 11:22:00 ragge Exp $ */
+/* $OpenBSD: consio.c,v 1.4 1998/02/03 11:48:26 maja Exp $ */
+/* $NetBSD: consio.c,v 1.8 1997/06/08 17:49:18 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -96,15 +96,19 @@ setup()
{
vax_cputype = (mfpr(PR_SID) >> 24) & 0xFF;
- put_fp = pr_putchar;
+ put_fp = pr_putchar; /* Default */
get_fp = pr_getchar;
/*
* according to vax_cputype we initialize vax_boardtype.
*/
switch (vax_cputype) {
- case VAX_650:
- case VAX_78032:
+ case VAX_TYP_UV2:
+ case VAX_TYP_CVAX:
+ case VAX_TYP_RIGEL:
+ case VAX_TYP_MARIAH:
+ case VAX_TYP_NVAX:
+ case VAX_TYP_SOC:
is_mvax = 1;
vax_boardtype = (vax_cputype << 24) |
((*(int*)0x20040004 >> 24) & 0377);
@@ -117,12 +121,12 @@ setup()
* 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, thus we use that
- * as fallthrough/default.
+ * 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) { /* ROM-based is default !!! */
+ switch (vax_boardtype) {
- case VAX_BTYP_650:
case VAX_BTYP_660:
case VAX_BTYP_670:
case VAX_BTYP_690:
@@ -137,16 +141,23 @@ setup()
case VAX_BTYP_46:
case VAX_BTYP_49:
case VAX_BTYP_410:
+ case VAX_BTYP_420:
+ case VAX_BTYP_440:
put_fp = rom_putchar;
get_fp = rom_getchar;
rom_putc = 0x20040058; /* 537133144 */
rom_getc = 0x20040044; /* 537133124 */
break;
-
- default:
- break;
+#ifdef notdef
+ case VAX_BTYP_630:
+ case VAX_BTYP_650:
+ case VAX_BTYP_9CC:
+ case VAX_BTYP_60:
+ put_fp = pr_putchar;
+ get_fp = pr_getchar;
+ break
+#endif
}
-
return;
}
@@ -200,4 +211,8 @@ asm("
ret # we're done
");
-
+_rtt()
+{
+ printf("rtt\n");
+bo: goto bo;
+}
diff --git a/sys/arch/vax/stand/copy.c b/sys/arch/vax/stand/copy.c
index 73fe2fb0de0..74058b56c1e 100644
--- a/sys/arch/vax/stand/copy.c
+++ b/sys/arch/vax/stand/copy.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: copy.c,v 1.3 1997/05/29 00:04:20 niklas Exp $ */
-/* $NetBSD: copy.c,v 1.3 1996/08/02 11:22:03 ragge Exp $ */
+/* $OpenBSD: copy.c,v 1.4 1998/02/03 11:48:26 maja Exp $ */
+/* $NetBSD: copy.c,v 1.4 1997/02/12 18:00:42 ragge Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
* All rights reserved.
@@ -110,7 +110,7 @@ again:
printf("Specify the device to read from as xx(N,?), where\n");
printf("xx is the device-name, ? is file/partition number\n");
printf("and N is the unit-number, e.g.\n");
- printf("\"tms(0,1)\" for the first TMSCP-tape (TK50),\n");
+ printf("\"mt(0,1)\" for the first TMSCP-tape (TK50),\n");
printf("\"ra(2,0)\" for the third MSCP-disk/floppy (RX33/RX50)\n");
printf("\n");
printf("device to read from ? ");
diff --git a/sys/arch/vax/stand/devopen.c b/sys/arch/vax/stand/devopen.c
index 87f24f11e55..a34e7895207 100644
--- a/sys/arch/vax/stand/devopen.c
+++ b/sys/arch/vax/stand/devopen.c
@@ -1,190 +1,55 @@
-/* $OpenBSD: devopen.c,v 1.4 1997/05/29 00:04:21 niklas Exp $ */
-/* $NetBSD: devopen.c,v 1.6 1996/08/02 16:18:39 ragge Exp $ */
-/*-
- * Copyright (c) 1993 John Brezak
- * 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.
- *
- * 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.
+/* $OpenBSD: devopen.c,v 1.5 1998/02/03 11:48:26 maja Exp $ */
+/* $NetBSD: devopen.c,v 1.8 1997/06/08 17:49:19 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 <sys/param.h>
#include <sys/reboot.h>
#include "lib/libsa/stand.h"
-/* #include "samachdep.h" */
+#include "samachdep.h"
+#include "vaxstand.h"
-u_int opendev;
-
-#define ispart(c) ((c) >= 'a' && (c) <= 'h')
+unsigned int opendev;
int
-atoi(cp)
- char *cp;
-{
- int val = 0;
- while(isdigit(*cp))
- val = val * 10 + (*cp++ - '0');
- return(val);
-}
-
-usage()
-{
- printf("\
- Usage: device(adaptor, controller, drive, partition)file\n\
- <device><unit><partitonletter>:file\n\
- ");
-}
-
-devlookup(d,len)
- char *d;
- int len;
-{
- struct devsw *dp = devsw;
- int i;
-
- for (i = 0; i < ndevs; i++, dp++)
- if (dp->dv_name && strncmp(dp->dv_name, d, len) == 0)
- return(i);
-
- printf("No such device - Configured devices are:\n");
- for (dp = devsw, i = 0; i < ndevs; i++, dp++)
- if (dp->dv_name)
- printf(" %s", dp->dv_name);
- printf("\n");
- errno = ENODEV;
- return(-1);
-}
-
-/*
- * Parse a device spec in one of two forms.
- *
- * dev(adapt, ctlr, unit, part)file
- * [A-Za-z]*[0-9]*[A-Za-z]:file
- * dev unit part
- */
-devparse(fname, dev, adapt, ctlr, unit, part, file)
- char *fname;
- int *dev, *adapt, *ctlr, *unit, *part;
- char **file;
-{
- int *argp, i;
- char *s, *args[4];
-
- /* get device name and make lower case */
- for(s = fname; *s && *s != '/' && *s != ':' && *s != '('; s++)
- if(isupper(*s))
- *s = tolower(*s);
-
- /* first form */
- if(*s == '('){
- /* lookup device and get index */
- if ((*dev = devlookup(fname, s - fname)) < 0)
- goto baddev;
-
- /* tokenize device ident */
- args[0] = ++s;
- for (args[0] = s, i = 1; *s && *s != ')'; s++)
- if (*s == ',')
- args[i++] = ++s;
-
-
- switch(i) {
- case 4:
- *adapt = atoi(args[0]);
- *ctlr = atoi(args[1]);
- *unit = atoi(args[2]);
- *part = atoi(args[3]);
- break;
- case 3:
- *ctlr = atoi(args[0]);
- *unit = atoi(args[1]);
- *part = atoi(args[2]);
- break;
- case 2:
- *unit = atoi(args[0]);
- *part = atoi(args[1]);
- break;
- case 1:
- *part = atoi(args[0]);
- break;
- case 0:
- break;
- }
- *file = ++s;
-
- /* second form */
- } else if (*s == ':') {
-
- /* isolate device */
- for(s = fname; *s != ':' && !isdigit(*s); s++)
- ;
-
- /* lookup device and get index */
- if ((*dev = devlookup(fname, s - fname)) < 0)
- goto baddev;
-
- /* isolate unit */
- if ((*unit = atoi(s)) > sizeof(char))
- goto bad;
- for (; isdigit(*s); s++)
- ;
-
- /* translate partition */
- if(!ispart(*s))
- goto bad;
-
- *part = *s++ - 'a';
- if(*s != ':')
- goto bad;
- *file = ++s;
-
- /* no device present */
- } else
- *file = fname;
-
- /* return the remaining unparsed part as the file to boot */
- return(0);
-
-bad:
- usage();
-
- baddev:
- return(-1);
-}
-
-extern int bootdev;
-
devopen(f, fname, file)
struct open_file *f;
const char *fname;
char **file;
{
- int n, error;
- int dev, ctlr, unit, part;
- int adapt;
- struct devsw *dp = &devsw[0];
+ int dev, ctlr, unit, part, adapt, i, a[4], x;
+ struct devsw *dp;
+ extern struct fs_ops nfs_system[];
+ extern int cnvtab[];
+ char *s, *c;
dev = B_TYPE(bootdev);
ctlr = B_CONTROLLER(bootdev);
@@ -192,23 +57,89 @@ devopen(f, fname, file)
part = B_PARTITION(bootdev);
adapt = B_ADAPTOR(bootdev);
- if (error = devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file))
- return(error);
+ for (i = 0, dp = 0; i < ndevs; i++)
+ if (cnvtab[i] == dev)
+ dp = devsw + i;
+
+ x = 0;
+ if ((s = index(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)
+ printf(" %s", dp->dv_name);
+ printf("\n");
+ return -1;
+ }
+ dev = cnvtab[i];
+ if ((c = index(s, ')')) == 0)
+ goto usage;
+
+ *c++ = 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;
+
+#ifdef notyet
+ if ((u = index(s, ' '))) {
+ *u++ = 0;
+
+ if (*u != '-')
+ goto usage;
+
+ while (*++u) {
+ if (*u == 'a')
+ bdev |= RB_ASKNAME;
+ else if (*u == 'd')
+ bdev |= RB_DEBUG;
+ else if (*u == 's')
+ bdev |= RB_SINGLE;
+ else
+ goto usage;
+ }
- dp = &devsw[dev];
+ }
+#endif
if (!dp->dv_open)
return(ENODEV);
+ f->f_dev = dp;
opendev = MAKEBOOTDEV(dev, adapt, ctlr, unit, part);
-
- f->f_dev = dp;
-
- if ((error = (*dp->dv_open)(f, adapt, ctlr, unit, part)) == 0)
- return(0);
-
- printf("%s(%d,%d,%d,%d): %s\n", devsw[dev].dv_name,
- adapt, ctlr, unit, part, strerror(error));
-
- return(error);
+
+ if (dev > 95) { /* MOP boot over network, root & swap over NFS */
+ bcopy(nfs_system, file_system, sizeof(struct fs_ops));
+ i = (*dp->dv_open)(f, dp->dv_name);
+ } else
+ i = (*dp->dv_open)(f, adapt, ctlr, unit, part);
+
+ return i;
+
+usage:
+ printf("usage: dev(adapter,controller,unit,partition)file -asd\n");
+ return -1;
}
diff --git a/sys/arch/vax/stand/if_le.c b/sys/arch/vax/stand/if_le.c
new file mode 100644
index 00000000000..7a223edfa54
--- /dev/null
+++ b/sys/arch/vax/stand/if_le.c
@@ -0,0 +1,283 @@
+/* $OpenBSD: if_le.c,v 1.1 1998/02/03 11:48:27 maja Exp $ */
+/* $NetBSD: if_le.c,v 1.2 1997/03/22 12:47:31 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.
+ */
+
+/*
+ * Standalone routine for MicroVAX LANCE chip.
+ */
+
+#include <sys/param.h>
+#include <sys/types.h>
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+
+#include <lib/libsa/netif.h>
+
+#include <dev/ic/am7990reg.h>
+
+#define ETHER_MIN_LEN 64
+#define ETHER_MAX_LEN 1518
+#define ETHER_ADDR_LEN 6
+
+/*
+ * The following are incorrect. Why doesn't DEC follow its own specs???
+ */
+#define TLEN 1
+#define NTBUF (1 << TLEN)
+#define RLEN 3
+#define NRBUF (1 << RLEN)
+#define BUFSIZE 1518
+
+#define QW_ALLOC(x) ((alloc((x) + 7) + 7) & ~7)
+
+int le_probe(), le_match(), le_get(), le_put();
+void le_init();
+
+struct netif_stats le_stats;
+
+struct netif_dif le_ifs[] = {
+/* dif_unit dif_nsel dif_stats dif_private */
+{ 0, 1, &le_stats, },
+};
+
+struct netif_stats le_stats;
+
+struct netif_driver le_driver = {
+ "le", le_match, le_probe, le_init, le_get, le_put, 0, le_ifs, 1,
+};
+
+/*
+ * 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 short ni_rdp; /* data port */
+ volatile short ni_pad0;
+ volatile short ni_rap; /* register select port */
+} *nireg = (struct nireg *)0x200e0000;
+
+
+volatile struct buffdesc {
+ int bd_adrflg;
+ short bd_bcnt;
+ short bd_mcnt;
+} *rdesc, *tdesc;
+
+/* 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
+le_match(nif, machdep_hint)
+ struct netif *nif;
+ void *machdep_hint;
+{
+ return strcmp(machdep_hint, "le") == 0;
+}
+
+le_probe(nif, machdep_hint)
+ struct netif *nif;
+ void *machdep_hint;
+{
+ return 0;
+}
+
+void
+le_init(desc, machdep_hint)
+ struct iodesc *desc;
+ void *machdep_hint;
+{
+ int stat, i, *ea;
+ volatile int to = 100000;
+
+ *(int *)0x20080014 = 0; /* Be sure we do DMA in low 16MB */
+ next_rdesc = next_tdesc = 0;
+
+ LEWRCSR(LE_CSR0, LE_C0_STOP);
+ while (to--)
+ ;
+
+ if (initblock == NULL) {
+ ea = (void *)0x20090000; /* XXX ethernetadressen */
+ for (i = 0; i < 6; i++)
+ desc->myea[i] = ea[i] & 0377;
+
+ initblock = (void *)alloc(sizeof(struct initblock));
+ initblock->ib_mode = LE_MODE_NORMAL;
+ bcopy(desc->myea, initblock->ib_padr, 6);
+ initblock->ib_ladrf1 = 0;
+ initblock->ib_ladrf2 = 0;
+
+ (int)rdesc = QW_ALLOC(sizeof(struct buffdesc) * NRBUF);
+ initblock->ib_rdr = (RLEN << 29) | (int)rdesc;
+ (int)tdesc = QW_ALLOC(sizeof(struct buffdesc) * NTBUF);
+ initblock->ib_tdr = (TLEN << 29) | (int)tdesc;
+
+ for (i = 0; i < NRBUF; i++) {
+ rdesc[i].bd_adrflg = alloc(BUFSIZE) | BR_OWN;
+ rdesc[i].bd_bcnt = -BUFSIZE;
+ rdesc[i].bd_mcnt = 0;
+ }
+
+ for (i = 0; i < NTBUF; i++) {
+ tdesc[i].bd_adrflg = alloc(BUFSIZE);
+ tdesc[i].bd_bcnt = 0xf000;
+ tdesc[i].bd_mcnt = 0;
+ }
+ }
+
+ 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;
+
+ LEWRCSR(LE_CSR0, LE_C0_INEA | LE_C0_STRT | LE_C0_IDON);
+}
+
+int
+le_get(desc, pkt, maxlen, timeout)
+ struct iodesc *desc;
+ void *pkt;
+ int 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 (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;
+
+ bcopy((void *)(rdesc[next_rdesc].bd_adrflg&0xffffff),pkt,len);
+ }
+
+ rdesc[next_rdesc].bd_mcnt = 0;
+ rdesc[next_rdesc].bd_adrflg |= BR_OWN;
+ if (++next_rdesc >= NRBUF)
+ next_rdesc = 0;
+
+ if (len == 0)
+ goto retry;
+ return len;
+}
+
+int
+le_put(desc, pkt, len)
+ struct iodesc *desc;
+ void *pkt;
+ int 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 (tdesc[next_tdesc].bd_adrflg & BT_OWN)
+ goto retry;
+
+ bcopy(pkt, (void *)(tdesc[next_tdesc].bd_adrflg & 0xffffff), 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;
+
+ 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;
+}
diff --git a/sys/arch/vax/stand/mfm.c b/sys/arch/vax/stand/mfm.c
index 09ddbee59ba..65f05f1c0b6 100644
--- a/sys/arch/vax/stand/mfm.c
+++ b/sys/arch/vax/stand/mfm.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: mfm.c,v 1.2 1997/05/29 00:04:23 niklas Exp $ */
-/* $NetBSD: mfm.c,v 1.1 1996/08/02 11:22:16 ragge Exp $ */
+/* $OpenBSD: mfm.c,v 1.3 1998/02/03 11:48:27 maja Exp $ */
+/* $NetBSD: mfm.c,v 1.2 1997/03/15 13:04:28 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -334,6 +334,7 @@ volatile struct mfm_xbn {
short checksum; /* checksum over the XBN */
} mfm_xbn;
+#ifdef verbose
display_xbn(p)
struct mfm_xbn *p;
{
@@ -351,6 +352,7 @@ display_xbn(p)
printf("serial: %d, checksum: %d, size: %d, reserved: %32c\n",
p->serial_number, p->checksum, sizeof(*p), p->reserved);
}
+#endif
mfmopen(f, adapt, ctlr, unit, part)
struct open_file *f;
@@ -383,6 +385,7 @@ mfmopen(f, adapt, ctlr, unit, part)
/* 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++) {
@@ -399,33 +402,42 @@ mfmopen(f, adapt, ctlr, unit, part)
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;
@@ -561,9 +573,11 @@ mfm_rdstrategy(msc, func, dblk, size, buf, rsize)
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! */
diff --git a/sys/arch/vax/stand/netio.c b/sys/arch/vax/stand/netio.c
new file mode 100644
index 00000000000..99c58e02615
--- /dev/null
+++ b/sys/arch/vax/stand/netio.c
@@ -0,0 +1,245 @@
+/* $OpenBSD: netio.c,v 1.1 1998/02/03 11:48:28 maja Exp $ */
+/* $NetBSD: netio.c,v 1.1 1997/03/15 13:04:29 ragge Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Jason R. Thorpe
+ * Copyright (c) 1995 Gordon W. Ross
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ * 4. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Gordon W. Ross
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This module implements a "raw device" interface suitable for
+ * use by the stand-alone I/O library NFS code. This interface
+ * does not support any "block" access, and exists only for the
+ * purpose of initializing the network interface, getting boot
+ * parameters, and performing the NFS mount.
+ *
+ * At open time, this does:
+ *
+ * find interface - netif_open()
+ * RARP for IP address - rarp_getipaddress()
+ * RPC/bootparams - callrpc(d, RPC_BOOTPARAMS, ...)
+ * RPC/mountd - nfs_mount(sock, ip, path)
+ *
+ * the root file handle from mountd is saved in a global
+ * for use by the NFS open code (NFS/lookup).
+ */
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+#include <netinet/in_systm.h>
+
+#include "stand.h"
+#include "samachdep.h"
+#include "net.h"
+#include "netif.h"
+#include "bootparam.h"
+#include "nfs.h"
+
+extern int nfs_root_node[]; /* XXX - get from nfs_mount() */
+
+struct in_addr myip, rootip, gateip;
+n_long netmask;
+char rootpath[FNAME_SIZE];
+
+int netdev_sock = -1;
+static int open_count;
+
+int netio_ask = 0; /* default to bootparam, can override */
+
+static char input_line[100];
+
+/* Why be any different? */
+#define SUN_BOOTPARAMS
+
+/*
+ * Called by devopen after it sets f->f_dev to our devsw entry.
+ * This opens the low-level device and sets f->f_devdata.
+ */
+int
+netopen(f, devname)
+ struct open_file *f;
+ char *devname; /* Device part of file name (or NULL). */
+{
+ int error = 0;
+
+ /* On first open, do netif open, mount, etc. */
+ if (open_count == 0) {
+ /* Find network interface. */
+ if ((netdev_sock = netif_open(devname)) < 0)
+ return (error=ENXIO);
+ if ((error = netmountroot(f, devname)) != 0)
+ return (error);
+ }
+ open_count++;
+ f->f_devdata = nfs_root_node;
+ return (error);
+}
+
+int
+netclose(f)
+ struct open_file *f;
+{
+ /* On last close, do netif close, etc. */
+ if (open_count > 0)
+ if (--open_count == 0)
+ netif_close(netdev_sock);
+ f->f_devdata = NULL;
+}
+
+int
+netstrategy(devdata, func, dblk, size, v_buf, rsize)
+ void *devdata;
+ int func;
+ daddr_t dblk;
+ size_t size;
+ void *v_buf;
+ size_t *rsize;
+{
+
+ *rsize = size;
+ return EIO;
+}
+
+int
+netmountroot(f, devname)
+ struct open_file *f;
+ char *devname; /* Device part of file name (or NULL). */
+{
+ int error;
+ struct iodesc *d;
+
+ if (netio_ask) {
+ get_my_ip:
+ printf("My IP address? ");
+ bzero(input_line, sizeof(input_line));
+ gets(input_line);
+ if ((myip.s_addr = inet_addr(input_line)) ==
+ htonl(INADDR_NONE)) {
+ printf("invalid IP address: %s\n", input_line);
+ goto get_my_ip;
+ }
+
+ get_my_netmask:
+ printf("My netmask? ");
+ bzero(input_line, sizeof(input_line));
+ gets(input_line);
+ if ((netmask = inet_addr(input_line)) ==
+ htonl(INADDR_NONE)) {
+ printf("invalid netmask: %s\n", input_line);
+ goto get_my_netmask;
+ }
+
+ get_my_gateway:
+ printf("My gateway? ");
+ bzero(input_line, sizeof(input_line));
+ gets(input_line);
+ if ((gateip.s_addr = inet_addr(input_line)) ==
+ htonl(INADDR_NONE)) {
+ printf("invalid IP address: %s\n", input_line);
+ goto get_my_gateway;
+ }
+
+ get_server_ip:
+ printf("Server IP address? ");
+ bzero(input_line, sizeof(input_line));
+ gets(input_line);
+ if ((rootip.s_addr = inet_addr(input_line)) ==
+ htonl(INADDR_NONE)) {
+ printf("invalid IP address: %s\n", input_line);
+ goto get_server_ip;
+ }
+
+ get_server_path:
+ printf("Server path? ");
+ bzero(rootpath, sizeof(rootpath));
+ gets(rootpath);
+ if (rootpath[0] == '\0' || rootpath[0] == '\n')
+ goto get_server_path;
+
+ if ((d = socktodesc(netdev_sock)) == NULL)
+ return (EMFILE);
+
+ d->myip = myip;
+
+ goto do_nfs_mount;
+ }
+
+ /*
+ * Get info for NFS boot: our IP address, our hostname,
+ * server IP address, and our root path on the server.
+ * There are two ways to do this: The old, Sun way,
+ * and the more modern, BOOTP way. (RFC951, RFC1048)
+ */
+
+#ifdef SUN_BOOTPARAMS
+ /* Get boot info using RARP and Sun bootparams. */
+
+ /* Get our IP address. (rarp.c) */
+ if (rarp_getipaddress(netdev_sock) == -1)
+ return (errno);
+
+ printf("boot: client IP address: %s\n", inet_ntoa(myip));
+
+ /* Get our hostname, server IP address. */
+ if (bp_whoami(netdev_sock))
+ return (errno);
+
+ printf("boot: client name: %s\n", hostname);
+
+ /* Get the root pathname. */
+ if (bp_getfile(netdev_sock, "root", &rootip, rootpath))
+ return (errno);
+
+#else
+
+ /* Get boot info using BOOTP way. (RFC951, RFC1048) */
+ bootp(netdev_sock);
+
+ printf("Using IP address: %s\n", inet_ntoa(myip));
+
+ printf("myip: %s (%s)", hostname, inet_ntoa(myip));
+ if (gateip)
+ printf(", gateip: %s", inet_ntoa(gateip));
+ if (mask)
+ printf(", mask: %s", intoa(netmask));
+ printf("\n");
+
+#endif /* SUN_BOOTPARAMS */
+
+ printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath);
+
+ do_nfs_mount:
+ /* Get the NFS file handle (mount). */
+ error = nfs_mount(netdev_sock, rootip, rootpath);
+
+ return (error);
+}
diff --git a/sys/arch/vax/stand/srt0.s b/sys/arch/vax/stand/srt0.s
index 39b8608070b..c29f36a3a8d 100644
--- a/sys/arch/vax/stand/srt0.s
+++ b/sys/arch/vax/stand/srt0.s
@@ -1,5 +1,5 @@
-/* $OpenBSD: srt0.s,v 1.4 1997/05/29 00:04:27 niklas Exp $ */
-/* $NetBSD: srt0.s,v 1.6 1996/08/02 11:22:44 ragge Exp $ */
+/* $OpenBSD: srt0.s,v 1.5 1998/02/03 11:48:28 maja Exp $ */
+/* $NetBSD: srt0.s,v 1.9 1997/03/22 12:47:32 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -46,7 +46,15 @@ nisse: .set nisse,0 # pass -e nisse to ld gives OK start addr
_start: .globl _start
nop;nop; # If we get called by calls, or something
- movl $_start, sp # Probably safe place for stack
+
+ movl r8, _memsz # If we come from disk, save memsize
+ cmpl ap, $-1 # Check if we are net-booted. XXX - kludge
+ beql 2f # jump if not
+ ashl $9,76(r11),_memsz # got memsize from rpb
+ movzbl 102(r11), r10 # Get bootdev from rpb.
+ movzwl 48(r11), r11 # Get howto
+
+2: movl $_start, sp # Probably safe place for stack
subl2 $52, sp # do not overwrite saved boot-registers
subl3 $_start, $_edata, r0
@@ -54,7 +62,6 @@ _start: .globl _start
subl3 $_start, $_end, r2
movl $_start, r3
movc5 r0, (r1), $0, r2, (r3)
-
jsb 1f
1: movl $relocated, (sp) # return-address on top of stack
rsb # can be replaced with new address
@@ -71,4 +78,8 @@ _hoppabort: .word 0x0
movl 8(ap), r11
movl 0xc(ap), r10
movl 16(ap), r9
+ movl _memsz,r8
calls $0,(r6)
+
+ .globl _memsz
+_memsz: .long 0x0
diff --git a/sys/arch/vax/stand/start.s b/sys/arch/vax/stand/start.s
index 6a21d6ef1e8..61f75d87ba4 100644
--- a/sys/arch/vax/stand/start.s
+++ b/sys/arch/vax/stand/start.s
@@ -1,5 +1,5 @@
-/* $OpenBSD: start.s,v 1.5 1997/05/29 00:04:27 niklas Exp $ */
-/* $NetBSD: start.s,v 1.8 1996/08/02 11:22:47 ragge Exp $ */
+/* $OpenBSD: start.s,v 1.6 1998/02/03 11:48:29 maja Exp $ */
+/* $NetBSD: start.s,v 1.10 1997/03/22 12:47:32 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -181,8 +181,11 @@ relocated: # now relocation is done !!!
* hoppabort() is called when jumping to the newly loaded program.
*/
ENTRY(hoppabort, 0)
- movl 4(ap),r6
- movl 8(ap),r11
- movl 0xc(ap),r10
- calls $0,(r6)
+ movl 4(ap),r6
+ movl 8(ap),r11
+ movl 0xc(ap),r10
+ movl _memsz, r8
+ mnegl $1, ap # Hack to figure out boot device.
+ jmp 2(r6)
+# calls $0,(r6)
halt
diff --git a/sys/arch/vax/stand/str.s b/sys/arch/vax/stand/str.s
index 7be8bd73fc8..c2d4e083723 100644
--- a/sys/arch/vax/stand/str.s
+++ b/sys/arch/vax/stand/str.s
@@ -1,5 +1,5 @@
-/* $OpenBSD: str.s,v 1.2 1997/05/29 00:04:28 niklas Exp $ */
-/* $NetBSD: str.s,v 1.2 1996/08/02 16:18:40 ragge Exp $ */
+/* $OpenBSD: str.s,v 1.3 1998/02/03 11:48:29 maja Exp $ */
+/* $NetBSD: str.s,v 1.3 1997/03/15 13:04:30 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -32,12 +32,72 @@
*/
/*
- * Small versions of the most common string functions not using any
+ * Small versions of the most common functions not using any
* emulated instructions.
*/
#include "../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);
+ movl 4(ap), r0
+ movl 8(ap), r1
+ movc5 $0,(r0),$0,r1,(r0)
+ ret
+
+ENTRY(bcopy,0);
+ movl 4(ap), r0
+ movl 8(ap), r1
+ movl 12(ap), r2
+ movc3 r2, (r0), (r1)
+ ret
+
ENTRY(strlen, 0);
movl 4(ap), r0
1: tstb (r0)+
diff --git a/sys/arch/vax/stand/tmscp.c b/sys/arch/vax/stand/tmscp.c
index c96ad184d65..90ca7e9fa48 100644
--- a/sys/arch/vax/stand/tmscp.c
+++ b/sys/arch/vax/stand/tmscp.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: tmscp.c,v 1.4 1997/05/29 00:04:28 niklas Exp $ */
-/* $NetBSD: tmscp.c,v 1.3 1996/08/02 11:22:53 ragge Exp $ */
+/* $OpenBSD: tmscp.c,v 1.5 1998/02/03 11:48:30 maja Exp $ */
+/* $NetBSD: tmscp.c,v 1.4 1997/03/15 13:04:31 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -73,7 +73,6 @@ static volatile struct uda {
static volatile struct uda *ubauda;
static volatile struct udadevice *udacsr;
static struct ra_softc ra_softc;
-static char io_buf[MAXBSIZE];
tmscpopen(f, adapt, ctlr, unit, part)
struct open_file *f;
diff --git a/sys/arch/vax/stand/vaxstand.h b/sys/arch/vax/stand/vaxstand.h
index ddc4122f76a..8424c18413a 100644
--- a/sys/arch/vax/stand/vaxstand.h
+++ b/sys/arch/vax/stand/vaxstand.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: vaxstand.h,v 1.4 1997/05/29 00:04:29 niklas Exp $ */
-/* $NetBSD: vaxstand.h,v 1.5 1996/08/02 11:22:56 ragge Exp $ */
+/* $OpenBSD: vaxstand.h,v 1.5 1998/02/03 11:48:30 maja Exp $ */
+/* $NetBSD: vaxstand.h,v 1.6 1997/03/15 13:04:31 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -55,12 +55,4 @@ extern int cpunumber;
*/
#define min(x,y) (x < y ? x : y)
-/*
- * Device numbers gotten from boot prom.
- */
-#define BDEV_MBA 0
-#define BDEV_RK06 1
-#define BDEV_RL02 2
-#define BDEV_UDA 17
-#define BDEV_TK50 18
-#define BDEV_CONSOLE 64
+char *index();