summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k/stand/openbsd/netboot
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/mvme88k/stand/openbsd/netboot')
-rw-r--r--sys/arch/mvme88k/stand/openbsd/netboot/Makefile31
-rw-r--r--sys/arch/mvme88k/stand/openbsd/netboot/boot.c119
-rw-r--r--sys/arch/mvme88k/stand/openbsd/netboot/conf.c34
-rw-r--r--sys/arch/mvme88k/stand/openbsd/netboot/dev_net.c211
-rw-r--r--sys/arch/mvme88k/stand/openbsd/netboot/dev_net.h6
-rw-r--r--sys/arch/mvme88k/stand/openbsd/netboot/i82586.h306
-rw-r--r--sys/arch/mvme88k/stand/openbsd/netboot/if_ie.c496
-rw-r--r--sys/arch/mvme88k/stand/openbsd/netboot/if_iereg.h163
-rw-r--r--sys/arch/mvme88k/stand/openbsd/netboot/if_le.c460
-rw-r--r--sys/arch/mvme88k/stand/openbsd/netboot/if_lereg.h173
-rw-r--r--sys/arch/mvme88k/stand/openbsd/netboot/netbootbin0 -> 18124 bytes
-rw-r--r--sys/arch/mvme88k/stand/openbsd/netboot/netboot.binbin0 -> 18092 bytes
-rw-r--r--sys/arch/mvme88k/stand/openbsd/netboot/version.c9
13 files changed, 2008 insertions, 0 deletions
diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/Makefile b/sys/arch/mvme88k/stand/openbsd/netboot/Makefile
new file mode 100644
index 00000000000..97900f2351c
--- /dev/null
+++ b/sys/arch/mvme88k/stand/openbsd/netboot/Makefile
@@ -0,0 +1,31 @@
+# $Id: Makefile,v 1.1 1997/03/03 19:31:08 rahnds Exp $
+
+RELOC=0x3F0000
+
+S= ${.CURDIR}/../../../..
+DEFS= -DSTANDALONE -DSUN_BOOTPARAMS
+INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${S} -I${S}/lib/libsa
+CFLAGS= -O2 ${INCPATH} ${DEFS} ${COPTS}
+
+.include "${S}/arch/${MACHINE}/stand/libsa/Makefile.inc"
+.PATH: ${S}/arch/${MACHINE}/stand/libsa
+SRTOBJ= SRT0.o SRT1.o
+
+SRCS= boot.c conf.c version.c dev_net.c
+SRCS+= if_ie.c if_le.c
+OBJS= ${SRTOBJ} ${SRCS:S/.c/.o/g}
+
+all: netboot.bin
+
+netboot: ${OBJS} ${LIBSA}
+ ${LD} -s -N -T ${RELOC} -e start -o $@ ${OBJS} ${LIBSA}
+ @size $@
+
+netboot.bin: netboot
+ dd ibs=32 skip=1 if=netboot of=$@
+
+install:
+ install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ netboot.bin ${DESTDIR}${MDEC_DIR}/netboot
+
+.include <bsd.prog.mk>
diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/boot.c b/sys/arch/mvme88k/stand/openbsd/netboot/boot.c
new file mode 100644
index 00000000000..4c465af5cd0
--- /dev/null
+++ b/sys/arch/mvme88k/stand/openbsd/netboot/boot.c
@@ -0,0 +1,119 @@
+/* $Id: boot.c,v 1.1 1997/03/03 19:31:08 rahnds Exp $ */
+
+/*-
+ * Copyright (c) 1995 Theo de Raadt
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Theo de Raadt
+ * 4. The name of the Author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Copyright (c) 1982, 1986, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)boot.c 8.1 (Berkeley) 6/10/93
+ */
+
+#include <sys/param.h>
+#include <sys/reboot.h>
+
+#include "stand.h"
+#include "promboot.h"
+
+/*
+ * Boot device is derived from ROM provided information.
+ */
+#define LOADADDR 0x10000
+
+extern char *version;
+char defname[32] = "bsd";
+char line[80];
+
+#if 0
+u_int bootdev = MAKEBOOTDEV(0, sdmajor, 0, 0, 0); /* disk boot */
+#endif
+u_int bootdev = MAKEBOOTDEV(1, 0, 0, 0, 0); /* network boot */
+
+main()
+{
+ char *cp, *file;
+ int io;
+ extern int cputyp;
+ extern char *oparg, *opargend;
+ int ask = 0;
+
+ printf(">> OpenBSD netboot [%s]\n", version);
+ printf("model MVME%x\n", cputyp);
+
+ *opargend = '\0';
+ prom_get_boot_info();
+ file = defname;
+
+ cp = prom_bootfile;
+ if (cp && *cp)
+ file = cp;
+
+ for (;;) {
+ if (ask) {
+ printf("boot: ");
+ gets(line);
+ if (line[0]) {
+ oparg = line;
+ prom_get_boot_info();
+ }
+ }
+ exec_sun(file, (char *)LOADADDR, prom_boothow);
+ printf("boot: %s\n", strerror(errno));
+ ask = 1;
+ }
+}
diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/conf.c b/sys/arch/mvme88k/stand/openbsd/netboot/conf.c
new file mode 100644
index 00000000000..5527ccf8f63
--- /dev/null
+++ b/sys/arch/mvme88k/stand/openbsd/netboot/conf.c
@@ -0,0 +1,34 @@
+/* $Id: conf.c,v 1.1 1997/03/03 19:31:08 rahnds Exp $ */
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+
+#include <stand.h>
+#include <nfs.h>
+#include <dev_net.h>
+
+struct fs_ops file_system[] = {
+ { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
+};
+int nfsys = sizeof(file_system) / sizeof(file_system[0]);
+
+struct devsw devsw[] = {
+ { "net", net_strategy, net_open, net_close, net_ioctl },
+};
+int ndevs = sizeof(devsw) / sizeof(devsw[0]);
+
+extern struct netif_driver le_driver;
+extern struct netif_driver ie_driver;
+
+struct netif_driver *netif_drivers[] = {
+ &le_driver,
+ &ie_driver,
+};
+int n_netif_drivers = sizeof(netif_drivers) / sizeof(netif_drivers[0]);
+
+
+/* XXX */
+int netif_debug;
+int debug;
+int errno;
diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/dev_net.c b/sys/arch/mvme88k/stand/openbsd/netboot/dev_net.c
new file mode 100644
index 00000000000..f0490b9dd6a
--- /dev/null
+++ b/sys/arch/mvme88k/stand/openbsd/netboot/dev_net.c
@@ -0,0 +1,211 @@
+/* $Id: dev_net.c,v 1.1 1997/03/03 19:31:08 rahnds Exp $ */
+
+/*
+ * Copyright (c) 1995 Gordon W. Ross
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ * 4. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Gordon W. Ross
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This module implements a "raw device" interface suitable for
+ * use by the stand-alone I/O library NFS code. This interface
+ * does not support any "block" access, and exists only for the
+ * purpose of initializing the network interface, getting boot
+ * parameters, and performing the NFS mount.
+ *
+ * At open time, this does:
+ *
+ * find interface - netif_open()
+ * RARP for IP address - rarp_getipaddress()
+ * RPC/bootparams - callrpc(d, RPC_BOOTPARAMS, ...)
+ * RPC/mountd - nfs_mount(sock, ip, path)
+ *
+ * the root file handle from mountd is saved in a global
+ * for use by the NFS open code (NFS/lookup).
+ */
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+#include <netinet/in_systm.h>
+
+#include "stand.h"
+#include "net.h"
+#include "netif.h"
+#include "config.h"
+#include "bootparam.h"
+
+extern int nfs_root_node[]; /* XXX - get from nfs_mount() */
+
+struct in_addr myip, rootip, gateip, mask;
+char rootpath[FNAME_SIZE];
+
+int netdev_sock = -1;
+static int open_count;
+
+/*
+ * Called by devopen after it sets f->f_dev to our devsw entry.
+ * This opens the low-level device and sets f->f_devdata.
+ */
+int
+net_open(f, devname)
+ struct open_file *f;
+ char *devname; /* Device part of file name (or NULL). */
+{
+ int error = 0;
+
+ /* On first open, do netif open, mount, etc. */
+ if (open_count == 0) {
+ /* Find network interface. */
+ if ((netdev_sock = netif_open(devname)) < 0)
+ return (error=ENXIO);
+ if ((error = net_mountroot(f, devname)) != 0)
+ return (error);
+ }
+ open_count++;
+ f->f_devdata = nfs_root_node;
+ return (error);
+}
+
+int
+net_close(f)
+ struct open_file *f;
+{
+ /* On last close, do netif close, etc. */
+ if (open_count > 0)
+ if (--open_count == 0)
+ netif_close(netdev_sock);
+ f->f_devdata = NULL;
+}
+
+int
+net_ioctl()
+{
+ return EIO;
+}
+
+int
+net_strategy()
+{
+ return EIO;
+}
+
+int
+net_mountroot(f, devname)
+ struct open_file *f;
+ char *devname; /* Device part of file name (or NULL). */
+{
+ int error;
+
+#ifdef DEBUG
+ printf("net_mountroot: %s\n", devname);
+#endif
+
+ /*
+ * Get info for NFS boot: our IP address, our hostname,
+ * server IP address, and our root path on the server.
+ * There are two ways to do this: The old, Sun way,
+ * and the more modern, BOOTP way. (RFC951, RFC1048)
+ */
+
+#ifdef SUN_BOOTPARAMS
+ /* Get boot info using RARP and Sun bootparams. */
+
+ /* Get our IP address. (rarp.c) */
+ if (rarp_getipaddress(netdev_sock) == -1)
+ return (EIO);
+ printf("boot: client IP address: %s\n", intoa(myip.s_addr));
+
+ /* Get our hostname, server IP address. */
+ if (bp_whoami(netdev_sock))
+ return (EIO);
+ printf("boot: client name: %s\n", hostname);
+
+ /* Get the root pathname. */
+ if (bp_getfile(netdev_sock, "root", &rootip, rootpath))
+ return (EIO);
+
+#else
+
+ /* Get boot info using BOOTP way. (RFC951, RFC1048) */
+ bootp(netdev_sock);
+
+ printf("Using IP address: %s\n", intoa(myip.s_addr));
+
+ printf("myip: %s (%s)", hostname, intoa(myip));
+ if (gateip)
+ printf(", gateip: %s", intoa(gateip));
+ if (mask)
+ printf(", mask: %s", intoa(mask));
+ printf("\n");
+
+#endif
+
+ printf("root addr=%s path=%s\n", intoa(rootip.s_addr), rootpath);
+
+ /* Get the NFS file handle (mount). */
+ error = nfs_mount(netdev_sock, rootip, rootpath);
+
+ return (error);
+}
+
+/*
+ * machdep_common_ether: get ethernet address
+ */
+void
+machdep_common_ether(ether)
+ u_char *ether;
+{
+ u_char *ea;
+ extern int cputyp;
+
+ if (cputyp == CPU_147) {
+ ea = (u_char *) ETHER_ADDR_147;
+
+ if ((*(int *) ea & 0x2fffff00) == 0x2fffff00)
+ panic("ERROR: ethernet address not set!\r\n");
+ ether[0] = 0x08;
+ ether[1] = 0x00;
+ ether[2] = 0x3e;
+ ether[3] = ea[0];
+ ether[4] = ea[1];
+ ether[5] = ea[2];
+ } else {
+ ea = (u_char *) ETHER_ADDR_16X;
+
+ if (ea[0] + ea[1] + ea[2] + ea[3] + ea[4] + ea[5] == 0)
+ panic("ERROR: ethernet address not set!\r\n");
+ ether[0] = ea[0];
+ ether[1] = ea[1];
+ ether[2] = ea[2];
+ ether[3] = ea[3];
+ ether[4] = ea[4];
+ ether[5] = ea[5];
+ }
+}
diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/dev_net.h b/sys/arch/mvme88k/stand/openbsd/netboot/dev_net.h
new file mode 100644
index 00000000000..093ba193bfd
--- /dev/null
+++ b/sys/arch/mvme88k/stand/openbsd/netboot/dev_net.h
@@ -0,0 +1,6 @@
+
+int net_open __P((struct open_file *, ...));
+int net_close __P((struct open_file *));
+int net_ioctl();
+int net_strategy();
+
diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/i82586.h b/sys/arch/mvme88k/stand/openbsd/netboot/i82586.h
new file mode 100644
index 00000000000..3275601ee25
--- /dev/null
+++ b/sys/arch/mvme88k/stand/openbsd/netboot/i82586.h
@@ -0,0 +1,306 @@
+/* $Id: i82586.h,v 1.1 1997/03/03 19:31:08 rahnds Exp $ */
+
+/*-
+ * Copyright (c) 1995 Theo de Raadt
+ * Copyright (c) 1992, University of Vermont and State Agricultural College.
+ * Copyright (c) 1992, Garrett A. Wollman.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * Vermont and State Agricultural College and Garrett A. Wollman.
+ * 4. Neither the name of the University nor the name of the author
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR AUTHOR BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Intel 82586 Ethernet chip
+ * Register, bit, and structure definitions.
+ *
+ * Written by GAW with reference to the Clarkson Packet Driver code for this
+ * chip written by Russ Nelson and others.
+ */
+
+struct ie_en_addr {
+ u_char data[6];
+};
+/*
+ * the only actual IE registers.
+ */
+struct iereg {
+ u_short ie_porthigh;
+ u_short ie_portlow;
+ u_long ie_attention;
+};
+#define IE_PORT_NEWSCP 0x00000002
+#define IE_PORT_RESET 0x00000000
+
+/*
+ * This is the master configuration block. It tells the hardware where
+ * all the rest of the stuff is.
+ */
+struct ie_scp {
+ u_char mbz1[3]; /* must be zero */
+ u_char scp_sysbus; /* true if 8-bit only */
+ u_char mbz2[4]; /* must be zero */
+ u_short scp_iscp_low; /* 24-bit physaddr of ISCP */
+ u_char mbz3[1];
+ u_char scp_iscp_high; /* the rest of the physaddr.. */
+};
+/*
+ * The tells the hardware where all the rest of the stuff is, too.
+ * FIXME: some of these should be re-commented after we figure out their
+ * REAL function.
+ */
+struct ie_iscp {
+ u_char mbz1[1];
+ u_char iscp_busy; /* zeroed after init */
+ u_short iscp_scboffset; /* 16-bit physaddr of next struct */
+ u_short iscp_base_low; /* 24-bit physaddr for all 16-bit vars */
+ u_char mbz2[1];
+ u_char iscp_base_high; /* rest of physaddr ... */
+};
+/*
+ * This FINALLY tells the hardware what to do and where to put it.
+ */
+struct ie_scb {
+ u_short ie_status; /* status word */
+ u_short ie_command; /* command word */
+ u_short ie_command_list;/* 16-pointer to command block list */
+ u_short ie_recv_list; /* 16-pointer to receive frame list */
+ u_short ie_err_crc; /* CRC errors */
+ u_short ie_err_align; /* Alignment errors */
+ u_short ie_err_resource;/* Resource errors */
+ u_short ie_err_overrun; /* Overrun errors */
+};
+/* Command values */
+#define IE_RU_COMMAND 0x0070 /* mask for RU command */
+#define IE_RU_NOP 0 /* for completeness */
+#define IE_RU_START 0x0010 /* start receive unit command */
+#define IE_RU_ENABLE 0x0020 /* enable receiver command */
+#define IE_RU_DISABLE 0x0030 /* disable receiver command */
+#define IE_RU_ABORT 0x0040 /* abort current receive operation */
+
+#define IE_CU_COMMAND 0x0700 /* mask for CU command */
+#define IE_CU_NOP 0 /* included for completeness */
+#define IE_CU_START 0x0100 /* do-command command */
+#define IE_CU_RESUME 0x0200 /* resume a suspended cmd list */
+#define IE_CU_STOP 0x0300 /* SUSPEND was already taken */
+#define IE_CU_ABORT 0x0400 /* abort current command */
+
+#define IE_ACK_COMMAND 0xf000 /* mask for ACK command */
+#define IE_ACK_CX 0x8000 /* ack IE_ST_DONE */
+#define IE_ACK_FR 0x4000 /* ack IE_ST_RECV */
+#define IE_ACK_CNA 0x2000 /* ack IE_ST_ALLDONE */
+#define IE_ACK_RNR 0x1000 /* ack IE_ST_RNR */
+
+#define IE_ACTION_COMMAND(x) (((x) & IE_CU_COMMAND) == IE_CU_START)
+ /* is this command an action command? */
+
+/* Status values */
+#define IE_ST_WHENCE 0xf000 /* mask for cause of interrupt */
+#define IE_ST_DONE 0x8000 /* command with I bit completed */
+#define IE_ST_RECV 0x4000 /* frame received */
+#define IE_ST_ALLDONE 0x2000 /* all commands completed */
+#define IE_ST_RNR 0x1000 /* receive not ready */
+
+#define IE_CU_STATUS 0x700 /* mask for command unit status */
+#define IE_CU_ACTIVE 0x200 /* command unit is active */
+#define IE_CU_SUSPEND 0x100 /* command unit is suspended */
+
+#define IE_RU_STATUS 0x70 /* mask for receiver unit status */
+#define IE_RU_SUSPEND 0x10 /* receiver is suspended */
+#define IE_RU_NOSPACE 0x20 /* receiver has no resources */
+#define IE_RU_READY 0x40 /* receiver is ready */
+
+/*
+ * This is filled in partially by the chip, partially by us.
+ */
+struct ie_recv_frame_desc {
+ u_short ie_fd_status; /* status for this frame */
+ u_short ie_fd_last; /* end of frame list flag */
+ u_short ie_fd_next; /* 16-pointer to next RFD */
+ u_short ie_fd_buf_desc; /* 16-pointer to list of buffer desc's */
+ struct ie_en_addr dest; /* destination ether */
+ struct ie_en_addr src; /* source ether */
+ u_short ie_length; /* 802 length/Ether type */
+ u_short mbz; /* must be zero */
+};
+#define IE_FD_LAST 0x8000 /* last rfd in list */
+#define IE_FD_SUSP 0x4000 /* suspend RU after receipt */
+
+#define IE_FD_COMPLETE 0x8000 /* frame is complete */
+#define IE_FD_BUSY 0x4000 /* frame is busy */
+#define IE_FD_OK 0x2000 /* frame is bad */
+#define IE_FD_RNR 0x0200 /* receiver out of resources here */
+
+/*
+ * linked list of buffers...
+ */
+struct ie_recv_buf_desc {
+ u_short ie_rbd_actual; /* status for this buffer */
+ u_short ie_rbd_next; /* 16-pointer to next RBD */
+ u_short ie_rbd_buffer_low; /* 24-pointer to buffer for this RBD */
+ u_short ie_rbd_buffer_high; /* 24-pointer to buffer for this RBD */
+ u_short ie_rbd_length; /* length of the buffer */
+ u_short mbz; /* must be zero */
+};
+#define IE_RBD_LAST 0x8000 /* last buffer */
+#define IE_RBD_USED 0x4000 /* this buffer has data */
+/*
+ * All commands share this in common.
+ */
+struct ie_cmd_common {
+ u_short ie_cmd_status; /* status of this command */
+ u_short ie_cmd_cmd; /* command word */
+ u_short ie_cmd_link; /* link to next command */
+};
+#define IE_STAT_COMPL 0x8000 /* command is completed */
+#define IE_STAT_BUSY 0x4000 /* command is running now */
+#define IE_STAT_OK 0x2000 /* command completed successfully */
+#define IE_STAT_ABORT 0x1000 /* command was aborted */
+
+
+#define IE_CMD_NOP 0x0000 /* NOP */
+#define IE_CMD_IASETUP 0x0001 /* initial address setup */
+#define IE_CMD_CONFIG 0x0002 /* configure command */
+#define IE_CMD_MCAST 0x0003 /* multicast setup command */
+#define IE_CMD_XMIT 0x0004 /* transmit command */
+#define IE_CMD_TDR 0x0005 /* time-domain reflectometer command */
+#define IE_CMD_DUMP 0x0006 /* dump command */
+#define IE_CMD_DIAGNOSE 0x0007 /* diagnostics command */
+
+#define IE_CMD_LAST 0x8000 /* this is the last command in the list */
+#define IE_CMD_SUSPEND 0x4000 /* suspend CU after this command */
+#define IE_CMD_INTR 0x2000 /* post an interrupt after completion */
+
+/*
+ * This is the command to transmit a frame.
+ */
+struct ie_xmit_cmd {
+ struct ie_cmd_common com; /* common part */
+#define ie_xmit_status com.ie_cmd_status
+
+ u_short ie_xmit_desc; /* 16-pointer to buffer descriptor */
+ struct ie_en_addr ie_xmit_addr; /* destination address */
+
+ u_short ie_xmit_length; /* 802.3 length/Ether type field */
+};
+#define IE_XS_MAXCOLL 0x000f /* number of collisions during transmit */
+#define IE_XS_EXCMAX 0x0020 /* exceeded maximum number of collisions */
+#define IE_XS_SQE 0x0040 /* SQE positive */
+#define IE_XS_DEFERRED 0x0080 /* transmission deferred */
+#define IE_XS_UNDERRUN 0x0100 /* DMA underrun */
+#define IE_XS_LOSTCTS 0x0200 /* Lost CTS */
+#define IE_XS_NOCARRIER 0x0400 /* No Carrier */
+
+/*
+ * This is a buffer descriptor for a frame to be transmitted.
+ */
+
+struct ie_xmit_buf {
+ u_short ie_xmit_flags; /* see below */
+ u_short ie_xmit_next; /* 16-pointer to next desc. */
+ u_short ie_xmit_buf_low;/* 24-pointer to the actual buffer */
+ u_short ie_xmit_buf_high; /* 24-pointer to the actual buffer */
+};
+#define IE_XMIT_LAST 0x8000 /* this TBD is the last one */
+/* The rest of the `flags' word is actually the length. */
+
+/*
+ * Multicast setup command.
+ */
+
+#define MAXMCAST 250 /* must fit in transmit buffer */
+
+struct ie_mcast_cmd {
+ struct ie_cmd_common com; /* common part */
+#define ie_mcast_status com.ie_cmd_status
+
+ u_short ie_mcast_bytes; /* size (in bytes) of multicast addresses */
+ struct ie_en_addr ie_mcast_addrs[MAXMCAST + 1]; /* space for them */
+};
+/*
+ * Time Domain Reflectometer command.
+ */
+
+struct ie_tdr_cmd {
+ struct ie_cmd_common com; /* common part */
+#define ie_tdr_status com.ie_cmd_status
+
+ u_short ie_tdr_time; /* error bits and time */
+};
+#define IE_TDR_SUCCESS 0x8000 /* TDR succeeded without error */
+#define IE_TDR_XCVR 0x4000 /* detected a transceiver problem */
+#define IE_TDR_OPEN 0x2000 /* detected an open */
+#define IE_TDR_SHORT 0x1000 /* TDR detected a short */
+#define IE_TDR_TIME 0x07ff /* mask for reflection time */
+
+/*
+ * Initial Address Setup command
+ */
+struct ie_iasetup_cmd {
+ struct ie_cmd_common com;
+#define ie_iasetup_status com.ie_cmd_status
+
+ struct ie_en_addr ie_address;
+};
+/*
+ * Configuration command
+ */
+struct ie_config_cmd {
+ struct ie_cmd_common com; /* common part */
+#define ie_config_status com.ie_cmd_status
+
+ u_char ie_config_count;/* byte count (0x0c) */
+ u_char ie_fifo; /* fifo (8) */
+ u_char ie_save_bad; /* save bad frames (0x40) */
+ u_char ie_addr_len; /* address length (0x2e) (AL-LOC == 1) */
+ u_char ie_priority; /* priority and backoff (0x0) */
+ u_char ie_ifs; /* inter-frame spacing (0x60) */
+ u_char ie_slot_low; /* slot time, LSB (0x0) */
+ u_char ie_slot_high; /* slot time, MSN, and retries (0xf2) */
+ u_char ie_promisc; /* 1 if promiscuous, else 0 */
+ u_char ie_crs_cdt; /* CSMA/CD parameters (0x0) */
+ u_char ie_min_len; /* min frame length (0x40) */
+ u_char ie_junk; /* stuff for 82596 (0xff) */
+};
+
+struct iemem {
+ volatile struct ie_scp im_scp;
+ u_char xx1[4];
+ volatile struct ie_iscp im_iscp;
+
+ volatile struct ie_scb im_scb;
+ volatile struct ie_config_cmd im_cc;
+ volatile struct ie_iasetup_cmd im_ic;
+ volatile struct ie_recv_frame_desc im_rfd[NRXBUF];
+ volatile struct ie_recv_buf_desc im_rbd[NRXBUF];
+ volatile struct ie_xmit_cmd im_xc[NTXBUF];
+ volatile struct ie_xmit_buf im_xd[NTXBUF];
+ volatile u_char im_rxbuf[NRXBUF * IE_RBUF_SIZE];
+ volatile u_char im_txbuf[NTXBUF * ETHER_MAX_LEN];
+
+};
diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/if_ie.c b/sys/arch/mvme88k/stand/openbsd/netboot/if_ie.c
new file mode 100644
index 00000000000..65e143b9339
--- /dev/null
+++ b/sys/arch/mvme88k/stand/openbsd/netboot/if_ie.c
@@ -0,0 +1,496 @@
+/* $Id: if_ie.c,v 1.1 1997/03/03 19:31:09 rahnds Exp $ */
+
+/*
+ * Copyright (c) 1995 Theo de Raadt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <sys/types.h>
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+
+#define ETHER_MIN_LEN 64
+#define ETHER_MAX_LEN 1518
+
+#define NTXBUF 1
+#define NRXBUF 16
+#define IE_RBUF_SIZE ETHER_MAX_LEN
+
+#include "stand.h"
+#include "netif.h"
+#include "config.h"
+
+#include "i82586.h"
+#include "if_iereg.h"
+
+int ie_debug = 0;
+
+void ie_stop __P((struct netif *));
+void ie_end __P((struct netif *));
+void ie_error __P((struct netif *, char *, volatile struct iereg *));
+int ie_get __P((struct iodesc *, void *, size_t, time_t));
+void ie_init __P((struct iodesc *, void *));
+int ie_match __P((struct netif *, void *));
+int ie_poll __P((struct iodesc *, void *, int));
+int ie_probe __P((struct netif *, void *));
+int ie_put __P((struct iodesc *, void *, size_t));
+void ie_reset __P((struct netif *, u_char *));
+
+struct netif_stats ie_stats;
+
+struct netif_dif ie0_dif = {
+ 0, /* unit */
+ 1, /* nsel */
+ &ie_stats,
+ 0,
+ 0,
+};
+
+struct netif_driver ie_driver = {
+ "ie", /* netif_bname */
+ ie_match, /* match */
+ ie_probe, /* probe */
+ ie_init, /* init */
+ ie_get, /* get */
+ ie_put, /* put */
+ ie_end, /* end */
+ &ie0_dif, /* netif_ifs */
+ 1, /* netif_nifs */
+};
+
+struct ie_configuration {
+ u_int phys_addr;
+ int used;
+} ie_config[] = {
+ { INTEL_REG_ADDR, 0 }
+};
+
+int nie_config = sizeof(ie_config) / (sizeof(ie_config[0]));
+
+struct {
+ struct iereg *sc_reg; /* IE registers */
+ struct iemem *sc_mem; /* RAM */
+} ie_softc;
+
+int
+ie_match(nif, machdep_hint)
+ struct netif *nif;
+ void *machdep_hint;
+{
+ char *name;
+ int i, val = 0;
+ extern int cputyp;
+
+ if (cputyp == CPU_147)
+ return (0);
+ name = machdep_hint;
+ if (name && !bcmp(ie_driver.netif_bname, name, 2))
+ val += 10;
+ for (i = 0; i < nie_config; i++) {
+ if (ie_config[i].used)
+ continue;
+ if (ie_debug)
+ printf("ie%d: ie_match --> %d\n", i, val + 1);
+ ie_config[i].used++;
+ return (val + 1);
+ }
+ if (ie_debug)
+ printf("ie%d: ie_match --> 0\n", i);
+ return (0);
+}
+
+int
+ie_probe(nif, machdep_hint)
+ struct netif *nif;
+ void *machdep_hint;
+{
+ extern int cputyp;
+
+ /* the set unit is the current unit */
+ if (ie_debug)
+ printf("ie%d: ie_probe called\n", nif->nif_unit);
+
+ if (cputyp != CPU_147)
+ return (0);
+ return (1);
+}
+
+void
+ie_error(nif, str, ier)
+ struct netif *nif;
+ char *str;
+ volatile struct iereg *ier;
+{
+ panic("ie%d: unknown error\n", nif->nif_unit);
+}
+
+ieack(ier, iem)
+ volatile struct iereg *ier;
+ struct iemem *iem;
+{
+ /* ack the `interrupt' */
+ iem->im_scb.ie_command = iem->im_scb.ie_status & IE_ST_WHENCE;
+ ier->ie_attention = 1; /* chan attention! */
+ while (iem->im_scb.ie_command)
+ ;
+}
+
+void
+ie_reset(nif, myea)
+ struct netif *nif;
+ u_char *myea;
+{
+ volatile struct iereg *ier = ie_softc.sc_reg;
+ struct iemem *iem = ie_softc.sc_mem;
+ int timo = 10000, stat, i;
+ volatile int t;
+ u_int a;
+
+ if (ie_debug)
+ printf("ie%d: ie_reset called\n", nif->nif_unit);
+
+ /*printf("ier %x iem %x\n", ier, iem);*/
+
+ *(u_char *)0xfff4202a = 0x40;
+
+ bzero(iem, sizeof(*iem));
+ iem->im_scp.scp_sysbus = 0;
+ iem->im_scp.scp_iscp_low = (int) &iem->im_iscp & 0xffff;
+ iem->im_scp.scp_iscp_high = (int) &iem->im_iscp >> 16;
+
+ iem->im_iscp.iscp_scboffset = (int) &iem->im_scb - (int) iem;
+ iem->im_iscp.iscp_busy = 1;
+ iem->im_iscp.iscp_base_low = (int) iem & 0xffff;
+ iem->im_iscp.iscp_base_high = (int) iem >> 16;
+
+ /*
+ * completely and utterly unlike what i expected, the
+ * "write" order is:
+ * 1st: d15-d0 -> high address
+ * 2nd: d31-d16 -> low address
+ */
+
+ /* reset chip */
+ a = IE_PORT_RESET;
+ ier->ie_porthigh = a & 0xffff;
+ t = 0;
+ t = 1;
+ ier->ie_portlow = a >> 16;
+ for (t = timo; t--;)
+ ;
+
+ /* set new SCP pointer */
+ a = (int) &iem->im_scp | IE_PORT_NEWSCP;
+ ier->ie_porthigh = a & 0xffff;
+ t = 0;
+ t = 1;
+ ier->ie_portlow = a >> 16;
+ for (t = timo; t--;)
+ ;
+
+ ier->ie_attention = 1; /* chan attention! */
+ for (t = timo * 10; t--;)
+ ;
+
+ /* send CONFIGURE command */
+ iem->im_scb.ie_command = IE_CU_START;
+ iem->im_scb.ie_command_list = (int) &iem->im_cc - (int) iem;
+ iem->im_cc.com.ie_cmd_status = 0;
+ iem->im_cc.com.ie_cmd_cmd = IE_CMD_CONFIG | IE_CMD_LAST;
+ iem->im_cc.com.ie_cmd_link = 0xffff;
+ iem->im_cc.ie_config_count = 0x0c;
+ iem->im_cc.ie_fifo = 8;
+ iem->im_cc.ie_save_bad = 0x40;
+ iem->im_cc.ie_addr_len = 0x2e;
+ iem->im_cc.ie_priority = 0;
+ iem->im_cc.ie_ifs = 0x60;
+ iem->im_cc.ie_slot_low = 0;
+ iem->im_cc.ie_slot_high = 0xf2;
+ iem->im_cc.ie_promisc = 0;
+ iem->im_cc.ie_crs_cdt = 0;
+ iem->im_cc.ie_min_len = 64;
+ iem->im_cc.ie_junk = 0xff;
+
+ ier->ie_attention = 1; /* chan attention! */
+ for (t = timo * 10; t--;)
+ ;
+
+ ieack(ier, iem);
+
+ /*printf("ic %x\n", &iem->im_ic);*/
+ /* send IASETUP command */
+ iem->im_scb.ie_command = IE_CU_START;
+ iem->im_scb.ie_command_list = (int) &iem->im_ic - (int) iem;
+ iem->im_ic.com.ie_cmd_status = 0;
+ iem->im_ic.com.ie_cmd_cmd = IE_CMD_IASETUP | IE_CMD_LAST;
+ iem->im_ic.com.ie_cmd_link = 0xffff;
+ bcopy(myea, (void *)&iem->im_ic.ie_address, sizeof iem->im_ic.ie_address);
+
+ ier->ie_attention = 1; /* chan attention! */
+ for (t = timo * 10; t--;)
+ ;
+
+ ieack(ier, iem);
+
+ /* setup buffers */
+
+ for (i = 0; i < NRXBUF; i++) {
+ iem->im_rfd[i].ie_fd_next = (int) &iem->im_rfd[(i+1) % NRXBUF] -
+ (int) iem;
+ iem->im_rbd[i].ie_rbd_next = (int) &iem->im_rbd[(i+1) % NRXBUF] -
+ (int) iem;
+ a = (int) &iem->im_rxbuf[i * IE_RBUF_SIZE];
+ iem->im_rbd[i].ie_rbd_buffer_low = a & 0xffff;
+ iem->im_rbd[i].ie_rbd_buffer_high = a >> 16;
+ iem->im_rbd[i].ie_rbd_length = IE_RBUF_SIZE;
+ }
+ iem->im_rfd[NRXBUF-1].ie_fd_last |= IE_FD_LAST;
+ iem->im_rbd[NRXBUF-1].ie_rbd_length |= IE_RBD_LAST;
+ iem->im_rfd[0].ie_fd_buf_desc = (int) &iem->im_rbd[0] - (int) iem;
+
+ /*printf("rfd[0] %x rbd[0] %x buf[0] %x\n", &iem->im_rfd, &iem->im_rbd,
+ &iem->im_rxbuf);*/
+
+ /* send receiver start command */
+ iem->im_scb.ie_command = IE_RU_START;
+ iem->im_scb.ie_command_list = 0;
+ iem->im_scb.ie_recv_list = (int) &iem->im_rfd[0] - (int) iem;
+ ier->ie_attention = 1; /* chan attention! */
+ while (iem->im_scb.ie_command)
+ ;
+
+ ieack(ier, iem);
+}
+
+int
+ie_poll(desc, pkt, len)
+ struct iodesc *desc;
+ void *pkt;
+ int len;
+{
+ volatile struct iereg *ier = ie_softc.sc_reg;
+ struct iemem *iem = ie_softc.sc_mem;
+ u_char *p = pkt;
+ static int slot;
+ int length = 0;
+ u_int a;
+ u_short status;
+
+ asm(".word 0xf518\n");
+ status = iem->im_rfd[slot].ie_fd_status;
+ if (status & IE_FD_BUSY)
+ return (0);
+
+ /* printf("slot %d: %x\n", slot, status); */
+ if ((status & (IE_FD_COMPLETE | IE_FD_OK)) == (IE_FD_COMPLETE | IE_FD_OK)) {
+ if (status & IE_FD_OK) {
+ length = iem->im_rbd[slot].ie_rbd_actual & 0x3fff;
+ if (length > len)
+ length = len;
+ bcopy((void *)&iem->im_rxbuf[slot * IE_RBUF_SIZE],
+ pkt, length);
+
+ iem->im_rfd[slot].ie_fd_status = 0;
+ iem->im_rfd[slot].ie_fd_last |= IE_FD_LAST;
+ iem->im_rfd[(slot+NRXBUF-1)%NRXBUF].ie_fd_last &=
+ ~IE_FD_LAST;
+ iem->im_rbd[slot].ie_rbd_actual = 0;
+ iem->im_rbd[slot].ie_rbd_length |= IE_RBD_LAST;
+ iem->im_rbd[(slot+NRXBUF-1)%NRXBUF].ie_rbd_length &=
+ ~IE_RBD_LAST;
+ /*printf("S%d\n", slot);*/
+
+ } else {
+ printf("shit\n");
+ }
+ slot++;
+ /* should move descriptor onto end of queue... */
+ }
+ if ((iem->im_scb.ie_status & IE_RU_READY) == 0) {
+ printf("RR\n");
+
+ for (slot = 0; slot < NRXBUF; slot++) {
+ iem->im_rbd[slot].ie_rbd_length &= ~IE_RBD_LAST;
+ iem->im_rfd[slot].ie_fd_last &= ~IE_FD_LAST;
+ }
+ iem->im_rbd[NRXBUF-1].ie_rbd_length |= IE_RBD_LAST;
+ iem->im_rfd[NRXBUF-1].ie_fd_last |= IE_FD_LAST;
+
+ iem->im_rfd[0].ie_fd_buf_desc = (int)&iem->im_rbd[0] - (int)iem;
+
+ iem->im_scb.ie_command = IE_RU_START;
+ iem->im_scb.ie_command_list = 0;
+ iem->im_scb.ie_recv_list = (int)&iem->im_rfd[0] - (int)iem;
+ ier->ie_attention = 1; /* chan attention! */
+ while (iem->im_scb.ie_command)
+ ;
+ slot = 0;
+ }
+ slot = slot % NRXBUF;
+ return (length);
+}
+
+int
+ie_put(desc, pkt, len)
+ struct iodesc *desc;
+ void *pkt;
+ size_t len;
+{
+ volatile struct iereg *ier = ie_softc.sc_reg;
+ struct iemem *iem = ie_softc.sc_mem;
+ u_char *p = pkt;
+ int timo = 10000, stat, i;
+ volatile int t;
+ u_int a;
+ int xx = 0;
+
+ /* send transmit command */
+
+ while (iem->im_scb.ie_command)
+ ;
+
+ /* copy data */
+ bcopy(p, (void *)&iem->im_txbuf[xx], len);
+
+ len = MAX(len, ETHER_MIN_LEN);
+
+ /* build transmit descriptor */
+ iem->im_xd[xx].ie_xmit_flags = len | IE_XMIT_LAST;
+ iem->im_xd[xx].ie_xmit_next = 0xffff;
+ a = (int) &iem->im_txbuf[xx];
+ iem->im_xd[xx].ie_xmit_buf_low = a & 0xffff;
+ iem->im_xd[xx].ie_xmit_buf_high = a >> 16;
+
+ /* transmit command */
+ iem->im_xc[xx].com.ie_cmd_status = 0;
+ iem->im_xc[xx].com.ie_cmd_cmd = IE_CMD_XMIT | IE_CMD_LAST;
+ iem->im_xc[xx].com.ie_cmd_link = 0xffff;
+ iem->im_xc[xx].ie_xmit_desc = (int) &iem->im_xd[xx] - (int) iem;
+ iem->im_xc[xx].ie_xmit_length = len;
+ bcopy(p, (void *)&iem->im_xc[xx].ie_xmit_addr,
+ sizeof iem->im_xc[xx].ie_xmit_addr);
+
+ iem->im_scb.ie_command = IE_CU_START;
+ iem->im_scb.ie_command_list = (int) &iem->im_xc[xx] - (int) iem;
+
+ ier->ie_attention = 1; /* chan attention! */
+
+ if (ie_debug) {
+ printf("ie%d: send %d to %x:%x:%x:%x:%x:%x\n",
+ desc->io_netif->nif_unit, len,
+ p[0], p[1], p[2], p[3], p[4], p[5]);
+ }
+ return (len);
+}
+
+int
+ie_get(desc, pkt, len, timeout)
+ struct iodesc *desc;
+ void *pkt;
+ size_t len;
+ time_t timeout;
+{
+ time_t t;
+ int cc;
+
+ t = getsecs();
+ cc = 0;
+ while (((getsecs() - t) < timeout) && !cc) {
+ cc = ie_poll(desc, pkt, len);
+ }
+ return (cc);
+}
+/*
+ * init ie device. return 0 on failure, 1 if ok.
+ */
+void
+ie_init(desc, machdep_hint)
+ struct iodesc *desc;
+ void *machdep_hint;
+{
+ struct netif *nif = desc->io_netif;
+
+ if (ie_debug)
+ printf("ie%d: ie_init called\n", desc->io_netif->nif_unit);
+ machdep_common_ether(desc->myea);
+ bzero(&ie_softc, sizeof(ie_softc));
+ ie_softc.sc_reg =
+ (struct iereg *) ie_config[desc->io_netif->nif_unit].phys_addr;
+ ie_softc.sc_mem = (struct iemem *) 0x1e0000;
+ ie_reset(desc->io_netif, desc->myea);
+ printf("device: %s%d attached to %s\n", nif->nif_driver->netif_bname,
+ nif->nif_unit, ether_sprintf(desc->myea));
+}
+
+void
+ie_stop(nif)
+ struct netif *nif;
+{
+ volatile struct iereg *ier = ie_softc.sc_reg;
+ struct iemem *iem = ie_softc.sc_mem;
+ int timo = 10000;
+ volatile int t;
+ u_int a;
+
+ iem->im_iscp.iscp_busy = 1;
+ /* reset chip */
+ a = IE_PORT_RESET;
+ ier->ie_porthigh = a & 0xffff;
+ t = 0;
+ t = 1;
+ ier->ie_portlow = a >> 16;
+ for (t = timo; t--;)
+ ;
+
+ /* reset chip again */
+ a = IE_PORT_RESET;
+ ier->ie_porthigh = a & 0xffff;
+ t = 0;
+ t = 1;
+ ier->ie_portlow = a >> 16;
+ for (t = timo; t--;)
+ ;
+
+ /*printf("status %x busy %x\n", iem->im_scb.ie_status,
+ iem->im_iscp.iscp_busy);*/
+}
+
+void
+ie_end(nif)
+ struct netif *nif;
+{
+ if (ie_debug)
+ printf("ie%d: ie_end called\n", nif->nif_unit);
+
+ ie_stop(nif);
+
+ /* *(u_char *) 0xfff42002 = 0; */
+}
diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/if_iereg.h b/sys/arch/mvme88k/stand/openbsd/netboot/if_iereg.h
new file mode 100644
index 00000000000..32aaf377017
--- /dev/null
+++ b/sys/arch/mvme88k/stand/openbsd/netboot/if_iereg.h
@@ -0,0 +1,163 @@
+/* $Id: if_iereg.h,v 1.1 1997/03/03 19:31:09 rahnds Exp $ */
+
+/*
+ * if_sunie.h
+ *
+ * sun's ie interface
+ */
+
+/*
+ * programming notes:
+ *
+ * the ie chip operates in a 24 bit address space.
+ *
+ * most ie interfaces appear to be divided into two parts:
+ * - generic 586 stuff
+ * - board specific
+ *
+ * generic:
+ * the generic stuff of the ie chip is all done with data structures
+ * that live in the chip's memory address space. the chip expects
+ * its main data structure (the sys conf ptr -- SCP) to be at a fixed
+ * address in its 24 bit space: 0xfffff4
+ *
+ * the SCP points to another structure called the ISCP.
+ * the ISCP points to another structure called the SCB.
+ * the SCB has a status field, a linked list of "commands", and
+ * a linked list of "receive buffers". these are data structures that
+ * live in memory, not registers.
+ *
+ * board:
+ * to get the chip to do anything, you first put a command in the
+ * command data structure list. then you have to signal "attention"
+ * to the chip to get it to look at the command. how you
+ * signal attention depends on what board you have... on PC's
+ * there is an i/o port number to do this, on sun's there is a
+ * register bit you toggle.
+ *
+ * to get data from the chip you program it to interrupt...
+ *
+ *
+ * sun issues:
+ *
+ * there are 3 kinds of sun "ie" interfaces:
+ * 1 - a VME/multibus card
+ * 2 - an on-board interface (sun3's, sun-4/100's, and sun-4/200's)
+ * 3 - another VME board called the 3E
+ *
+ * the VME boards lives in vme16 space. only 16 and 8 bit accesses
+ * are allowed, so functions that copy data must be aware of this.
+ *
+ * the chip is an intel chip. this means that the byte order
+ * on all the "short"s in the chip's data structures is wrong.
+ * so, constants described in the intel docs are swapped for the sun.
+ * that means that any buffer pointers you give the chip must be
+ * swapped to intel format. yuck.
+ *
+ * VME/multibus interface:
+ * for the multibus interface the board ignores the top 4 bits
+ * of the chip address. the multibus interface seems to have its
+ * own MMU like page map (without protections or valid bits, etc).
+ * there are 256 pages of physical memory on the board (each page
+ * is 1024 bytes). there are 1024 slots in the page map. so,
+ * a 1024 byte page takes up 10 bits of address for the offset,
+ * and if there are 1024 slots in the page that is another 10 bits
+ * of the address. that makes a 20 bit address, and as stated
+ * earlier the board ignores the top 4 bits, so that accounts
+ * for all 24 bits of address.
+ *
+ * note that the last entry of the page map maps the top of the
+ * 24 bit address space and that the SCP is supposed to be at
+ * 0xfffff4 (taking into account allignment). so,
+ * for multibus, that entry in the page map has to be used for the SCP.
+ *
+ * the page map effects BOTH how the ie chip sees the
+ * memory, and how the host sees it.
+ *
+ * the page map is part of the "register" area of the board
+ *
+ * on-board interface:
+ *
+ * <fill in useful info later>
+ *
+ *
+ * VME3E interface:
+ *
+ * <fill in useful info later>
+ *
+ */
+
+/*
+ * PART 1: VME/multibus defs
+ */
+#define IEVME_PAGESIZE 1024 /* bytes */
+#define IEVME_PAGSHIFT 10 /* bits */
+#define IEVME_NPAGES 256 /* number of pages on chip */
+#define IEVME_MAPSZ 1024 /* number of entries in the map */
+
+/*
+ * PTE for the page map
+ */
+#define IEVME_SBORDR 0x8000 /* sun byte order */
+#define IEVME_IBORDR 0x0000 /* intel byte ordr */
+
+#define IEVME_P2MEM 0x2000 /* memory is on P2 */
+#define IEVME_OBMEM 0x0000 /* memory is on board */
+
+#define IEVME_PGMASK 0x0fff /* gives the physical page frame number */
+
+struct ievme {
+ u_short pgmap[IEVME_MAPSZ];
+ u_short xxx[32]; /* prom */
+ u_short status; /* see below for bits */
+ u_short xxx2; /* filler */
+ u_short pectrl; /* parity control (see below) */
+ u_short peaddr; /* low 16 bits of address */
+};
+/*
+ * status bits
+ */
+#define IEVME_RESET 0x8000 /* reset board */
+#define IEVME_ONAIR 0x4000 /* go out of loopback 'on-air' */
+#define IEVME_ATTEN 0x2000 /* attention */
+#define IEVME_IENAB 0x1000 /* interrupt enable */
+#define IEVME_PEINT 0x0800 /* parity error interrupt enable */
+#define IEVME_PERR 0x0200 /* parity error flag */
+#define IEVME_INT 0x0100 /* interrupt flag */
+#define IEVME_P2EN 0x0020 /* enable p2 bus */
+#define IEVME_256K 0x0010 /* 256kb rams */
+#define IEVME_HADDR 0x000f /* mask for bits 17-20 of address */
+
+/*
+ * parity control
+ */
+#define IEVME_PARACK 0x0100 /* parity error ack */
+#define IEVME_PARSRC 0x0080 /* parity error source */
+#define IEVME_PAREND 0x0040 /* which end of the data got the error */
+#define IEVME_PARADR 0x000f /* mask to get bits 17-20 of parity address */
+
+
+/*
+ * PART 2: the on-board interface
+ */
+struct ieob {
+ u_char obctrl;
+};
+#define IEOB_NORSET 0x80 /* don't reset the board */
+#define IEOB_ONAIR 0x40 /* put us on the air */
+#define IEOB_ATTEN 0x20 /* attention! */
+#define IEOB_IENAB 0x10 /* interrupt enable */
+#define IEOB_XXXXX 0x08 /* free bit */
+#define IEOB_XCVRL2 0x04 /* level 2 transceiver? */
+#define IEOB_BUSERR 0x02 /* bus error */
+#define IEOB_INT 0x01 /* interrupt */
+
+#define IEOB_ADBASE 0xff000000 /* KVA base addr of 24 bit address space */
+
+/*
+ * PART 3: the 3E board
+ */
+
+/*
+ * not supported (yet?)
+ */
diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/if_le.c b/sys/arch/mvme88k/stand/openbsd/netboot/if_le.c
new file mode 100644
index 00000000000..40e8074e207
--- /dev/null
+++ b/sys/arch/mvme88k/stand/openbsd/netboot/if_le.c
@@ -0,0 +1,460 @@
+/* $Id: if_le.c,v 1.1 1997/03/03 19:31:09 rahnds Exp $ */
+
+/*
+ * Copyright (c) 1995 Theo de Raadt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Copyright (c) 1993 Adam Glass
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Adam Glass.
+ * 4. The name of the Author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <sys/types.h>
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+
+#include "stand.h"
+#include "netif.h"
+#include "config.h"
+
+#include "if_lereg.h"
+
+int le_debug = 0;
+
+void le_end __P((struct netif *));
+void le_error __P((struct netif *, char *, volatile struct lereg1 *));
+int le_get __P((struct iodesc *, void *, size_t, time_t));
+void le_init __P((struct iodesc *, void *));
+int le_match __P((struct netif *, void *));
+int le_poll __P((struct iodesc *, void *, int));
+int le_probe __P((struct netif *, void *));
+int le_put __P((struct iodesc *, void *, size_t));
+void le_reset __P((struct netif *, u_char *));
+
+struct netif_stats le_stats;
+
+struct netif_dif le0_dif = {
+ 0, /* unit */
+ 1, /* nsel */
+ &le_stats,
+ 0,
+ 0,
+};
+
+struct netif_driver le_driver = {
+ "le", /* netif_bname */
+ le_match, /* match */
+ le_probe, /* probe */
+ le_init, /* init */
+ le_get, /* get */
+ le_put, /* put */
+ le_end, /* end */
+ &le0_dif, /* netif_ifs */
+ 1, /* netif_nifs */
+};
+
+struct le_configuration {
+ unsigned int phys_addr;
+ int used;
+} le_config[] = {
+ { LANCE_REG_ADDR, 0 }
+};
+
+int nle_config = sizeof(le_config) / (sizeof(le_config[0]));
+
+struct {
+ struct lereg1 *sc_r1; /* LANCE registers */
+ struct lereg2 *sc_r2; /* RAM */
+ int next_rmd;
+ int next_tmd;
+} le_softc;
+
+int
+le_match(nif, machdep_hint)
+ struct netif *nif;
+ void *machdep_hint;
+{
+ char *name;
+ int i, val = 0;
+ extern int cputyp;
+
+ if (cputyp != CPU_147)
+ return (0);
+ name = machdep_hint;
+ if (name && !bcmp(le_driver.netif_bname, name, 2))
+ val += 10;
+ for (i = 0; i < nle_config; i++) {
+ if (le_config[i].used)
+ continue;
+ if (le_debug)
+ printf("le%d: le_match --> %d\n", i, val + 1);
+ le_config[i].used++;
+ return val + 1;
+ }
+ if (le_debug)
+ printf("le%d: le_match --> 0\n", i);
+ return 0;
+}
+
+int
+le_probe(nif, machdep_hint)
+ struct netif *nif;
+ void *machdep_hint;
+{
+ extern int cputyp;
+
+ /* the set unit is the current unit */
+ if (le_debug)
+ printf("le%d: le_probe called\n", nif->nif_unit);
+
+ if (cputyp == CPU_147)
+ return 0;
+ return 1;
+}
+
+void
+le_error(nif, str, ler1)
+ struct netif *nif;
+ char *str;
+ volatile struct lereg1 *ler1;
+{
+ /* ler1->ler1_rap = LE_CSRO done in caller */
+ if (ler1->ler1_rdp & LE_C0_BABL)
+ panic("le%d: been babbling, found by '%s'\n", nif->nif_unit, str);
+ if (ler1->ler1_rdp & LE_C0_CERR) {
+ le_stats.collision_error++;
+ ler1->ler1_rdp = LE_C0_CERR;
+ }
+ if (ler1->ler1_rdp & LE_C0_MISS) {
+ le_stats.missed++;
+ ler1->ler1_rdp = LE_C0_MISS;
+ }
+ if (ler1->ler1_rdp & LE_C0_MERR) {
+ printf("le%d: memory error in '%s'\n", nif->nif_unit, str);
+ panic("memory error");
+ }
+}
+
+void
+le_reset(nif, myea)
+ struct netif *nif;
+ u_char *myea;
+{
+ struct lereg1 *ler1 = le_softc.sc_r1;
+ struct lereg2 *ler2 = le_softc.sc_r2;
+ unsigned int a;
+ int timo = 100000, stat, i;
+
+ if (le_debug)
+ printf("le%d: le_reset called\n", nif->nif_unit);
+ ler1->ler1_rap = LE_CSR0;
+ ler1->ler1_rdp = LE_C0_STOP; /* do nothing until we are finished */
+
+ bzero(ler2, sizeof(*ler2));
+
+ ler2->ler2_mode = LE_MODE_NORMAL;
+ ler2->ler2_padr[0] = myea[1];
+ ler2->ler2_padr[1] = myea[0];
+ ler2->ler2_padr[2] = myea[3];
+ ler2->ler2_padr[3] = myea[2];
+ ler2->ler2_padr[4] = myea[5];
+ ler2->ler2_padr[5] = myea[4];
+
+
+ ler2->ler2_ladrf0 = 0;
+ ler2->ler2_ladrf1 = 0;
+
+ a = (u_int) ler2->ler2_rmd;
+ ler2->ler2_rlen = LE_RLEN | (a >> 16);
+ ler2->ler2_rdra = a & LE_ADDR_LOW_MASK;
+
+ a = (u_int) ler2->ler2_tmd;
+ ler2->ler2_tlen = LE_TLEN | (a >> 16);
+ ler2->ler2_tdra = a & LE_ADDR_LOW_MASK;
+
+ ler1->ler1_rap = LE_CSR1;
+ a = (u_int) ler2;
+ ler1->ler1_rdp = a & LE_ADDR_LOW_MASK;
+ ler1->ler1_rap = LE_CSR2;
+ ler1->ler1_rdp = a >> 16;
+
+ for (i = 0; i < LERBUF; i++) {
+ a = (u_int) & ler2->ler2_rbuf[i];
+ ler2->ler2_rmd[i].rmd0 = a & LE_ADDR_LOW_MASK;
+ ler2->ler2_rmd[i].rmd1_bits = LE_R1_OWN;
+ ler2->ler2_rmd[i].rmd1_hadr = a >> 16;
+ ler2->ler2_rmd[i].rmd2 = -LEMTU;
+ ler2->ler2_rmd[i].rmd3 = 0;
+ }
+ for (i = 0; i < LETBUF; i++) {
+ a = (u_int) & ler2->ler2_tbuf[i];
+ ler2->ler2_tmd[i].tmd0 = a & LE_ADDR_LOW_MASK;
+ ler2->ler2_tmd[i].tmd1_bits = 0;
+ ler2->ler2_tmd[i].tmd1_hadr = a >> 16;
+ ler2->ler2_tmd[i].tmd2 = 0;
+ ler2->ler2_tmd[i].tmd3 = 0;
+ }
+
+ ler1->ler1_rap = LE_CSR3;
+ ler1->ler1_rdp = LE_C3_BSWP;
+
+ ler1->ler1_rap = LE_CSR0;
+ ler1->ler1_rdp = LE_C0_INIT;
+ do {
+ if (--timo == 0) {
+ printf("le%d: init timeout, stat = 0x%x\n",
+ nif->nif_unit, stat);
+ break;
+ }
+ stat = ler1->ler1_rdp;
+ } while ((stat & LE_C0_IDON) == 0);
+
+ ler1->ler1_rdp = LE_C0_IDON;
+ le_softc.next_rmd = 0;
+ le_softc.next_tmd = 0;
+ ler1->ler1_rap = LE_CSR0;
+ ler1->ler1_rdp = LE_C0_STRT;
+}
+
+int
+le_poll(desc, pkt, len)
+ struct iodesc *desc;
+ void *pkt;
+ int len;
+{
+ struct lereg1 *ler1 = le_softc.sc_r1;
+ struct lereg2 *ler2 = le_softc.sc_r2;
+ unsigned int a;
+ int length;
+ struct lermd *rmd;
+
+
+ ler1->ler1_rap = LE_CSR0;
+ if ((ler1->ler1_rdp & LE_C0_RINT) != 0)
+ ler1->ler1_rdp = LE_C0_RINT;
+ rmd = &ler2->ler2_rmd[le_softc.next_rmd];
+ if (rmd->rmd1_bits & LE_R1_OWN) {
+ return (0);
+ }
+ if (ler1->ler1_rdp & LE_C0_ERR)
+ le_error(desc->io_netif, "le_poll", ler1);
+ if (rmd->rmd1_bits & LE_R1_ERR) {
+ printf("le%d_poll: rmd status 0x%x\n", desc->io_netif->nif_unit,
+ rmd->rmd1_bits);
+ length = 0;
+ goto cleanup;
+ }
+ if ((rmd->rmd1_bits & (LE_R1_STP | LE_R1_ENP)) != (LE_R1_STP | LE_R1_ENP))
+ panic("le_poll: chained packet\n");
+
+ length = rmd->rmd3;
+ if (length >= LEMTU) {
+ length = 0;
+ panic("csr0 when bad things happen: %x\n", ler1->ler1_rdp);
+ goto cleanup;
+ }
+ if (!length)
+ goto cleanup;
+ length -= 4;
+ if (length > 0) {
+
+ /*
+ * if buffer is smaller than the packet truncate it.
+ * (is this wise?)
+ */
+ if (length > len)
+ length = len;
+
+ bcopy((void *)&ler2->ler2_rbuf[le_softc.next_rmd], pkt, length);
+ }
+cleanup:
+ a = (u_int) & ler2->ler2_rbuf[le_softc.next_rmd];
+ rmd->rmd0 = a & LE_ADDR_LOW_MASK;
+ rmd->rmd1_hadr = a >> 16;
+ rmd->rmd2 = -LEMTU;
+ le_softc.next_rmd =
+ (le_softc.next_rmd == (LERBUF - 1)) ? 0 : (le_softc.next_rmd + 1);
+ rmd->rmd1_bits = LE_R1_OWN;
+ return length;
+}
+
+int
+le_put(desc, pkt, len)
+ struct iodesc *desc;
+ void *pkt;
+ size_t len;
+{
+ volatile struct lereg1 *ler1 = le_softc.sc_r1;
+ volatile struct lereg2 *ler2 = le_softc.sc_r2;
+ volatile struct letmd *tmd;
+ int timo = 100000, stat, i;
+ unsigned int a;
+
+ ler1->ler1_rap = LE_CSR0;
+ if (ler1->ler1_rdp & LE_C0_ERR)
+ le_error(desc->io_netif, "le_put(way before xmit)", ler1);
+ tmd = &ler2->ler2_tmd[le_softc.next_tmd];
+ while (tmd->tmd1_bits & LE_T1_OWN) {
+ printf("le%d: output buffer busy\n", desc->io_netif->nif_unit);
+ }
+ bcopy(pkt, (void *)ler2->ler2_tbuf[le_softc.next_tmd], len);
+ if (len < 64)
+ tmd->tmd2 = -64;
+ else
+ tmd->tmd2 = -len;
+ tmd->tmd3 = 0;
+ if (ler1->ler1_rdp & LE_C0_ERR)
+ le_error(desc->io_netif, "le_put(before xmit)", ler1);
+ tmd->tmd1_bits = LE_T1_STP | LE_T1_ENP | LE_T1_OWN;
+ a = (u_int) & ler2->ler2_tbuf[le_softc.next_tmd];
+ tmd->tmd0 = a & LE_ADDR_LOW_MASK;
+ tmd->tmd1_hadr = a >> 16;
+ ler1->ler1_rdp = LE_C0_TDMD;
+ if (ler1->ler1_rdp & LE_C0_ERR)
+ le_error(desc->io_netif, "le_put(after xmit)", ler1);
+ do {
+ if (--timo == 0) {
+ printf("le%d: transmit timeout, stat = 0x%x\n",
+ desc->io_netif->nif_unit, stat);
+ if (ler1->ler1_rdp & LE_C0_ERR)
+ le_error(desc->io_netif, "le_put(timeout)", ler1);
+ break;
+ }
+ stat = ler1->ler1_rdp;
+ } while ((stat & LE_C0_TINT) == 0);
+ ler1->ler1_rdp = LE_C0_TINT;
+ if (ler1->ler1_rdp & LE_C0_ERR) {
+ if ((ler1->ler1_rdp & (LE_C0_BABL | LE_C0_CERR | LE_C0_MISS |
+ LE_C0_MERR)) !=
+ LE_C0_CERR)
+ printf("le_put: xmit error, buf %d\n", le_softc.next_tmd);
+ le_error(desc->io_netif, "le_put(xmit error)", ler1);
+ }
+ le_softc.next_tmd = 0;
+/* (le_softc.next_tmd == (LETBUF - 1)) ? 0 : le_softc.next_tmd + 1;*/
+ if (tmd->tmd1_bits & LE_T1_DEF)
+ le_stats.deferred++;
+ if (tmd->tmd1_bits & LE_T1_ONE)
+ le_stats.collisions++;
+ if (tmd->tmd1_bits & LE_T1_MORE)
+ le_stats.collisions += 2;
+ if (tmd->tmd1_bits & LE_T1_ERR) {
+ printf("le%d: transmit error, error = 0x%x\n", desc->io_netif->nif_unit,
+ tmd->tmd3);
+ return -1;
+ }
+ if (le_debug) {
+ printf("le%d: le_put() successful: sent %d\n",
+ desc->io_netif->nif_unit, len);
+ printf("le%d: le_put(): tmd1_bits: %x tmd3: %x\n",
+ desc->io_netif->nif_unit,
+ (unsigned int) tmd->tmd1_bits,
+ (unsigned int) tmd->tmd3);
+ }
+ return len;
+}
+
+int
+le_get(desc, pkt, len, timeout)
+ struct iodesc *desc;
+ void *pkt;
+ size_t len;
+ time_t timeout;
+{
+ time_t t;
+ int cc;
+
+ t = getsecs();
+ cc = 0;
+ while (((getsecs() - t) < timeout) && !cc) {
+ cc = le_poll(desc, pkt, len);
+ }
+ return cc;
+}
+/*
+ * init le device. return 0 on failure, 1 if ok.
+ */
+void
+le_init(desc, machdep_hint)
+ struct iodesc *desc;
+ void *machdep_hint;
+{
+ u_long eram = 4*1024*1024;
+ struct netif *nif = desc->io_netif;
+
+ if (le_debug)
+ printf("le%d: le_init called\n", desc->io_netif->nif_unit);
+ machdep_common_ether(desc->myea);
+ bzero(&le_softc, sizeof(le_softc));
+ le_softc.sc_r1 =
+ (struct lereg1 *) le_config[desc->io_netif->nif_unit].phys_addr;
+ le_softc.sc_r2 = (struct lereg2 *) (eram - (1024 * 1024));
+ le_reset(desc->io_netif, desc->myea);
+ printf("device: %s%d attached to %s\n", nif->nif_driver->netif_bname,
+ nif->nif_unit, ether_sprintf(desc->myea));
+}
+
+void
+le_end(nif)
+ struct netif *nif;
+{
+ struct lereg1 *ler1 = le_softc.sc_r1;
+
+ if (le_debug)
+ printf("le%d: le_end called\n", nif->nif_unit);
+ ler1->ler1_rap = LE_CSR0;
+ ler1->ler1_rdp = LE_C0_STOP;
+}
diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/if_lereg.h b/sys/arch/mvme88k/stand/openbsd/netboot/if_lereg.h
new file mode 100644
index 00000000000..e55fc19642e
--- /dev/null
+++ b/sys/arch/mvme88k/stand/openbsd/netboot/if_lereg.h
@@ -0,0 +1,173 @@
+/* $Id: if_lereg.h,v 1.1 1997/03/03 19:31:09 rahnds Exp $ */
+
+/*-
+ * Copyright (c) 1982, 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)if_lereg.h 8.2 (Berkeley) 10/30/93
+ */
+
+#define LEMTU 1518
+#define LEMINSIZE 60 /* should be 64 if mode DTCR is set */
+#define LERBUF 8
+#define LERBUFLOG2 3
+#define LE_RLEN (LERBUFLOG2 << 13)
+#define LETBUF 1
+#define LETBUFLOG2 0
+#define LE_TLEN (LETBUFLOG2 << 13)
+
+/* Local Area Network Controller for Ethernet (LANCE) registers */
+struct lereg1 {
+ volatile u_short ler1_rdp; /* register data port */
+ volatile u_short ler1_rap; /* register address port */
+};
+/* register addresses */
+#define LE_CSR0 0 /* Control and status register */
+#define LE_CSR1 1 /* low address of init block */
+#define LE_CSR2 2 /* high address of init block */
+#define LE_CSR3 3 /* Bus master and control */
+
+/* Control and status register 0 (csr0) */
+#define LE_C0_ERR 0x8000 /* error summary */
+#define LE_C0_BABL 0x4000 /* transmitter timeout error */
+#define LE_C0_CERR 0x2000 /* collision */
+#define LE_C0_MISS 0x1000 /* missed a packet */
+#define LE_C0_MERR 0x0800 /* memory error */
+#define LE_C0_RINT 0x0400 /* receiver interrupt */
+#define LE_C0_TINT 0x0200 /* transmitter interrupt */
+#define LE_C0_IDON 0x0100 /* initalization done */
+#define LE_C0_INTR 0x0080 /* interrupt condition */
+#define LE_C0_INEA 0x0040 /* interrupt enable */
+#define LE_C0_RXON 0x0020 /* receiver on */
+#define LE_C0_TXON 0x0010 /* transmitter on */
+#define LE_C0_TDMD 0x0008 /* transmit demand */
+#define LE_C0_STOP 0x0004 /* disable all external activity */
+#define LE_C0_STRT 0x0002 /* enable external activity */
+#define LE_C0_INIT 0x0001 /* begin initalization */
+
+#define LE_C0_BITS \
+ "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\
+\12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT"
+
+/* Control and status register 3 (csr3) */
+#define LE_C3_BSWP 0x4 /* byte swap */
+#define LE_C3_ACON 0x2 /* ALE control, eh? */
+#define LE_C3_BCON 0x1 /* byte control */
+/*
+ * Current size is 13,758 bytes with 8 x 1518 receive buffers and
+ * 1 x 1518 transmit buffer.
+ */
+struct lereg2 {
+ /* initialization block */
+ volatile u_short ler2_mode; /* mode */
+ volatile u_char ler2_padr[6]; /* physical address */
+#ifdef new_code
+ volatile u_short ler2_ladrf[4]; /* logical address filter */
+#else
+ volatile u_long ler2_ladrf0; /* logical address filter */
+ volatile u_long ler2_ladrf1; /* logical address filter */
+#endif
+ volatile u_short ler2_rdra; /* receive descriptor addr */
+ volatile u_short ler2_rlen; /* rda high and ring size */
+ volatile u_short ler2_tdra; /* transmit descriptor addr */
+ volatile u_short ler2_tlen; /* tda high and ring size */
+ /* receive message descriptors. bits/hadr are byte order dependent. */
+ struct lermd {
+ volatile u_short rmd0; /* low address of packet */
+ volatile u_char rmd1_bits; /* descriptor bits */
+ volatile u_char rmd1_hadr; /* high address of packet */
+ volatile short rmd2; /* buffer byte count */
+ volatile u_short rmd3; /* message byte count */
+ } ler2_rmd[LERBUF];
+ /* transmit message descriptors */
+ struct letmd {
+ volatile u_short tmd0; /* low address of packet */
+ volatile u_char tmd1_bits; /* descriptor bits */
+ volatile u_char tmd1_hadr; /* high address of packet */
+ volatile short tmd2; /* buffer byte count */
+ volatile u_short tmd3; /* transmit error bits */
+ } ler2_tmd[LETBUF];
+ volatile char ler2_rbuf[LERBUF][LEMTU];
+ volatile char ler2_tbuf[LETBUF][LEMTU];
+};
+/* Initialzation block (mode) */
+#define LE_MODE_PROM 0x8000 /* promiscuous mode */
+/* 0x7f80 reserved, must be zero */
+#define LE_MODE_INTL 0x0040 /* internal loopback */
+#define LE_MODE_DRTY 0x0020 /* disable retry */
+#define LE_MODE_COLL 0x0010 /* force a collision */
+#define LE_MODE_DTCR 0x0008 /* disable transmit CRC */
+#define LE_MODE_LOOP 0x0004 /* loopback mode */
+#define LE_MODE_DTX 0x0002 /* disable transmitter */
+#define LE_MODE_DRX 0x0001 /* disable receiver */
+#define LE_MODE_NORMAL 0 /* none of the above */
+
+
+/* Receive message descriptor 1 (rmd1_bits) */
+#define LE_R1_OWN 0x80 /* LANCE owns the packet */
+#define LE_R1_ERR 0x40 /* error summary */
+#define LE_R1_FRAM 0x20 /* framing error */
+#define LE_R1_OFLO 0x10 /* overflow error */
+#define LE_R1_CRC 0x08 /* CRC error */
+#define LE_R1_BUFF 0x04 /* buffer error */
+#define LE_R1_STP 0x02 /* start of packet */
+#define LE_R1_ENP 0x01 /* end of packet */
+
+#define LE_R1_BITS \
+ "\20\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP"
+
+/* Transmit message descriptor 1 (tmd1_bits) */
+#define LE_T1_OWN 0x80 /* LANCE owns the packet */
+#define LE_T1_ERR 0x40 /* error summary */
+#define LE_T1_MORE 0x10 /* multiple collisions */
+#define LE_T1_ONE 0x08 /* single collision */
+#define LE_T1_DEF 0x04 /* defferred transmit */
+#define LE_T1_STP 0x02 /* start of packet */
+#define LE_T1_ENP 0x01 /* end of packet */
+
+#define LE_T1_BITS \
+ "\20\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP"
+
+/* Transmit message descriptor 3 (tmd3) */
+#define LE_T3_BUFF 0x8000 /* buffer error */
+#define LE_T3_UFLO 0x4000 /* underflow error */
+#define LE_T3_LCOL 0x1000 /* late collision */
+#define LE_T3_LCAR 0x0800 /* loss of carrier */
+#define LE_T3_RTRY 0x0400 /* retry error */
+#define LE_T3_TDR_MASK 0x03ff /* time domain reflectometry counter */
+
+#define LE_XMD2_ONES 0xf000
+
+#define LE_T3_BITS \
+ "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY"
+
+
+#define LE_ADDR_LOW_MASK (0xffff)
diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/netboot b/sys/arch/mvme88k/stand/openbsd/netboot/netboot
new file mode 100644
index 00000000000..a2fe675457c
--- /dev/null
+++ b/sys/arch/mvme88k/stand/openbsd/netboot/netboot
Binary files differ
diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/netboot.bin b/sys/arch/mvme88k/stand/openbsd/netboot/netboot.bin
new file mode 100644
index 00000000000..2c1b35d8fa7
--- /dev/null
+++ b/sys/arch/mvme88k/stand/openbsd/netboot/netboot.bin
Binary files differ
diff --git a/sys/arch/mvme88k/stand/openbsd/netboot/version.c b/sys/arch/mvme88k/stand/openbsd/netboot/version.c
new file mode 100644
index 00000000000..8f6fe5e8338
--- /dev/null
+++ b/sys/arch/mvme88k/stand/openbsd/netboot/version.c
@@ -0,0 +1,9 @@
+/* $Id: version.c,v 1.1 1997/03/03 19:31:09 rahnds Exp $ */
+
+/*
+ * NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.
+ *
+ * 1.1
+ */
+
+char *version = "$Revision: 1.1 $";