summaryrefslogtreecommitdiff
path: root/sys/arch/mvme68k/stand/libsa
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-18 10:53:06 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-18 10:53:06 +0000
commit77b048c5ca1ef345d036f981ff0b954c647efd7a (patch)
tree2bcdfea52775579a3cbc8ddbcaaf14b04d590352 /sys/arch/mvme68k/stand/libsa
parent49235ceee0c25492d4ca35194d7c72838a9ec284 (diff)
old files
Diffstat (limited to 'sys/arch/mvme68k/stand/libsa')
-rw-r--r--sys/arch/mvme68k/stand/libsa/exec.c177
-rw-r--r--sys/arch/mvme68k/stand/libsa/if_lereg.h176
-rw-r--r--sys/arch/mvme68k/stand/libsa/machdep.c154
-rw-r--r--sys/arch/mvme68k/stand/libsa/netif.c531
-rw-r--r--sys/arch/mvme68k/stand/libsa/netif.h22
5 files changed, 0 insertions, 1060 deletions
diff --git a/sys/arch/mvme68k/stand/libsa/exec.c b/sys/arch/mvme68k/stand/libsa/exec.c
deleted file mode 100644
index 343f4d1a0c0..00000000000
--- a/sys/arch/mvme68k/stand/libsa/exec.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/* $NetBSD: exec.c,v 1.1.1.1.2.1 1995/10/12 22:47:56 chuck Exp $ */
-
-/*-
- * 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 <a.out.h>
-
-#include "stand.h"
-
-extern int debug;
-
-/*ARGSUSED*/
-int
-exec_mvme(file, loadaddr, boothowto)
- char *file;
- char *loadaddr;
- int boothowto;
-{
- register int io;
- struct exec x;
- int cc, magic;
- void (*entry)();
- register char *cp;
- register int *ip;
-
-#ifdef DEBUG
- printf("exec: file=%s loadaddr=0x%x\n", file, loadaddr);
-#endif
-
- io = open(file, 0);
- if (io < 0)
- return(-1);
-
- /*
- * Read in the exec header, and validate it.
- */
- if (read(io, (char *)&x, sizeof(x)) != sizeof(x))
- goto shread;
- if (N_BADMAG(x)) {
- errno = EFTYPE;
- goto closeout;
- }
-
- cp = loadaddr;
- magic = N_GETMAGIC(x);
- if (magic == ZMAGIC)
- cp += sizeof(x);
- entry = (void (*)())x.a_entry;
-
- /*
- * Leave a copy of the exec header before the text.
- * The kernel may use this to verify that the
- * symbols were loaded by this boot program.
- */
- bcopy(&x, cp - sizeof(x), sizeof(x));
-
- /*
- * Read in the text segment.
- */
- printf("%d", x.a_text);
- if (read(io, cp, x.a_text) != x.a_text)
- goto shread;
- cp += x.a_text;
-
- /*
- * NMAGIC may have a gap between text and data.
- */
- if (magic == NMAGIC) {
- register int mask = N_PAGSIZ(x) - 1;
- while ((int)cp & mask)
- *cp++ = 0;
- }
-
- /*
- * Read in the data segment.
- */
- printf("+%d", x.a_data);
- if (read(io, cp, x.a_data) != x.a_data)
- goto shread;
- cp += x.a_data;
-
- /*
- * Zero out the BSS section.
- * (Kernel doesn't care, but do it anyway.)
- */
- printf("+%d", x.a_bss);
- cc = x.a_bss;
- while ((int)cp & 3) {
- *cp++ = 0;
- --cc;
- }
- ip = (int*)cp;
- cp += cc;
- while ((char*)ip < cp)
- *ip++ = 0;
-
- /*
- * Read in the symbol table and strings.
- * (Always set the symtab size word.)
- */
- *ip++ = x.a_syms;
- cp = (char*) ip;
-
- if (x.a_syms > 0) {
-
- /* Symbol table and string table length word. */
- cc = x.a_syms;
- printf("+[%d", cc);
- cc += sizeof(int); /* strtab length too */
- if (read(io, cp, cc) != cc)
- goto shread;
- cp += x.a_syms;
- ip = (int*)cp; /* points to strtab length */
- cp += sizeof(int);
-
- /* String table. Length word includes itself. */
- cc = *ip;
- printf("+%d]", cc);
- cc -= sizeof(int);
- if (cc <= 0)
- goto shread;
- if (read(io, cp, cc) != cc)
- goto shread;
- cp += cc;
- }
- printf("=0x%x\n", cp - loadaddr);
- close(io);
-
- if (debug) {
- printf("Debug mode - enter c to continue\n");
- asm(" trap #0");
- }
-
- printf("Start @ 0x%x ...\n", (int)entry);
- (*entry)(boothowto);
- panic("exec returned");
-
-shread:
- printf("exec: short read\n");
- errno = EIO;
-closeout:
- close(io);
- return(-1);
-}
diff --git a/sys/arch/mvme68k/stand/libsa/if_lereg.h b/sys/arch/mvme68k/stand/libsa/if_lereg.h
deleted file mode 100644
index 3aee758cabc..00000000000
--- a/sys/arch/mvme68k/stand/libsa/if_lereg.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/* $NetBSD: if_lereg.h,v 1.1.1.1 1995/07/25 23:12:23 chuck 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/mvme68k/stand/libsa/machdep.c b/sys/arch/mvme68k/stand/libsa/machdep.c
deleted file mode 100644
index c47d2ecc43e..00000000000
--- a/sys/arch/mvme68k/stand/libsa/machdep.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/* $NetBSD: machdep.c,v 1.1.1.1 1995/07/25 23:12:22 chuck Exp $ */
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/exec.h>
-
-#include <sys/reboot.h>
-
-#include "config.h"
-
-/*
- * get_boothowto: boothowto for kernel
- */
-
-static int get_boothowto(cmd_flags)
-
-char *cmd_flags;
-
-{
- int result = 0;
-
- if (cmd_flags == NULL) return(0);
-
- while (*cmd_flags) {
- switch (*cmd_flags) {
- case 's': result |= RB_SINGLE; break;
- case 'a': result |= RB_ASKNAME; break;
- default: break;
- }
- cmd_flags++;
- }
-
- return(result);
-}
-
-/*
- * cmd_parse: parse command line
- * expected format: "b[oot] [kernel_name] [-flags]"
- */
-
-char *cmd_parse(cmd_buf, howto)
-char *cmd_buf;
-int *howto;
-{
- char *cmd_kernel, *cmd_flags;
- u_char *cp;
- *howto = 0;
-
- cp = cmd_buf+1; /* skip 'b' */
- while (*cp && *cp != ' ') cp++; /* skip to end or space */
- while (*cp == ' ') cp++; /* skip spaces */
- if (*cp == '\0') return(NULL); /* no args */
- if (*cp == '-') { /* only flags? */
- *howto = get_boothowto(cp);
- return(NULL);
- }
- cmd_kernel = cp; /* got kernel name */
- while (*cp && *cp != ' ') cp++; /* skip to end or space */
- if (*cp == ' ') *cp++ = 0; /* null terminate kernel */
- while (*cp == ' ') cp++; /* skip spaces */
- if (*cp == '\0') return(cmd_kernel); /* no flags */
- if (*cp != '-') return(cmd_kernel); /* garbage flags */
- cmd_flags = cp; /* save flags */
-
- while (*cp && *cp != ' ') cp++; /* skip to end or space */
- if (*cp == ' ') *cp++ = 0; /* null terminate flags */
-
- *howto = get_boothowto(cmd_flags);
-
- return(cmd_kernel);
-}
-
-
-/*
- * machdep_common_ether: get ethernet address
- */
-
-void machdep_common_ether(ether)
- unsigned char *ether;
-{
- caddr_t addr;
- int *ea = (int *) ETHER_ADDR;
- int e = *ea;
- if (( e & 0x2fffff00 ) == 0x2fffff00)
- panic("ERROR: ethernet address not set!\r\n");
- ether[0] = 0x08;
- ether[1] = 0x00;
- ether[2] = 0x3e;
- e = e >> 8;
- ether[5] = e & 0xff;
- e = e >> 8;
- ether[4] = e & 0xff;
- e = e >> 8;
- ether[3] = e;
-}
-
-/*
- * console i/o
- */
-
-/*
- * hardware
- */
-
-struct zs_hw {
- volatile u_char ctl;
- volatile u_char data;
-};
-
-struct zs_hw *zs = (struct zs_hw *)CONS_ZS_ADDR;
-
-/*
- * putchar: put char to console
- */
-
-void putchar(char c)
-{
- if (c == '\n') putchar('\r');
- zs->ctl = 0;
- while ((zs->ctl & 0x04) == 0) {
- zs->ctl = 0;
- }
- zs->ctl = 8;
- zs->ctl = c;
-}
-
-/*
- * getchar: get char from console
- */
-
-int
-getchar()
-{
- int i;
- while (1) {
- zs->ctl = 0;
- if ((zs->ctl & 0x1) != 0) break;
- for (i = 100 ; i > 0 ; i--)
- ;
- }
- zs->ctl = 8;
- return(zs->ctl);
-}
-
-/*
- * peekchar
- */
-
-peekchar()
-{
- zs->ctl = 0;
- return(zs->ctl & 0x1);
-}
-
diff --git a/sys/arch/mvme68k/stand/libsa/netif.c b/sys/arch/mvme68k/stand/libsa/netif.c
deleted file mode 100644
index e2838521a67..00000000000
--- a/sys/arch/mvme68k/stand/libsa/netif.c
+++ /dev/null
@@ -1,531 +0,0 @@
-/* $NetBSD: netif.c,v 1.1.1.1.2.1 1995/10/12 22:47:57 chuck 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.
- */
-
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <string.h>
-#include <time.h>
-
-#include <net/if.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#include <netinet/in_systm.h>
-
-#include "stand.h"
-#include "net.h"
-#include "netif.h"
-#include "config.h"
-
-static struct netif netif_prom;
-void machdep_common_ether __P((u_char *));
-
-#ifdef NETIF_DEBUG
-int netif_debug;
-#endif
-
-struct iodesc sockets[SOPEN_MAX];
-
-struct iodesc *
-socktodesc(sock)
- int sock;
-{
- if (sock != 0) {
- return(NULL);
- }
- return (sockets);
-}
-
-int
-netif_open(machdep_hint)
- void *machdep_hint;
-{
- struct saioreq *si;
- struct iodesc *io;
- int error;
-
- /* find a free socket */
- io = sockets;
- if (io->io_netif) {
-#ifdef DEBUG
- printf("netif_open: device busy\n");
-#endif
- return (-1);
- }
- bzero(io, sizeof(*io));
-
- if ((netif_prom.devdata = le_init(io)) == NULL) {
- printf("le_init failed\n");
- return(-1);
- }
-
- io->io_netif = &netif_prom;
-
- return(0);
-}
-
-int
-netif_close(fd)
- int fd;
-{
- struct iodesc *io;
- struct netif *ni;
-
- if (fd != 0) {
- errno = EBADF;
- return(-1);
- }
-
- io = sockets;
- ni = io->io_netif;
- if (ni != NULL) {
- le_end(ni);
- ni->devdata = NULL;
- io->io_netif = NULL;
- }
- return(0);
-}
-
-/*
- * Send a packet. The ether header is already there.
- * Return the length sent (or -1 on error).
- */
-int
-netif_put(desc, pkt, len)
- struct iodesc *desc;
- void *pkt;
- size_t len;
-{
-
-#ifdef NETIF_DEBUG
- if (netif_debug) {
- struct ether_header *eh;
-
- printf("netif_put: desc=0x%x pkt=0x%x len=%d\n",
- desc, pkt, len);
- eh = pkt;
- printf("dst: %s ", ether_sprintf(eh->ether_dhost));
- printf("src: %s ", ether_sprintf(eh->ether_shost));
- printf("type: 0x%x\n", eh->ether_type & 0xFFFF);
- }
-#endif
-
- return(le_put(desc, pkt, len));
-}
-
-/*
- * Receive a packet, including the ether header.
- * Return the total length received (or -1 on error).
- */
-int
-netif_get(desc, pkt, maxlen, timo)
- struct iodesc *desc;
- void *pkt;
- size_t maxlen;
- time_t timo;
-{
- struct saioreq *si;
- struct saif *sif;
- char *dmabuf;
- int tick0, tmo_ticks;
- int len;
-
-#ifdef NETIF_DEBUG
- if (netif_debug)
- printf("netif_get: pkt=0x%x, maxlen=%d, tmo=%d\n",
- pkt, maxlen, timo);
-#endif
-
- len = le_get(desc, pkt, maxlen, timo);
-
-#ifdef NETIF_DEBUG
- if (netif_debug) {
- struct ether_header *eh = pkt;
-
- printf("dst: %s ", ether_sprintf(eh->ether_dhost));
- printf("src: %s ", ether_sprintf(eh->ether_shost));
- printf("type: 0x%x\n", eh->ether_type & 0xFFFF);
- }
-#endif
-
- return len;
-}
-
-/* the rest of this file imported from le_poll.c */
-
-/*
- * 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 "if_lereg.h"
-
-struct {
- struct lereg1 *sc_r1; /* LANCE registers */
- struct lereg2 *sc_r2; /* RAM */
- int next_rmd;
- int next_tmd;
-} le_softc;
-
-int le_debug = 0;
-
-/*
- * init le device. return 0 on failure, 1 if ok.
- */
-
-void *
-le_init(io)
- struct iodesc *io;
-{
- u_long *eram = (u_long *) ERAM_ADDR;
-
- if (le_debug)
- printf("le: le_init called\n");
- machdep_common_ether(io->myea);
- bzero(&le_softc, sizeof(le_softc));
- le_softc.sc_r1 = (struct lereg1 *) LANCE_REG_ADDR;
- le_softc.sc_r2 = (struct lereg2 *) (*eram - (1024*1024));
- le_reset(io->io_netif, io->myea);
-
- return(&le_softc);
-}
-
-/*
- * close device
- * XXX le_softc
- */
-
-void le_end(nif)
-
- struct netif *nif;
-{
- struct lereg1 *ler1 = le_softc.sc_r1;
-
- if (le_debug)
- printf("le: le_end called\n");
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_STOP;
-}
-
-
-/*
- * reset device
- * XXX le_softc
- */
-
-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: le_reset called\n");
- 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: init timeout, stat = 0x%x\n", stat);
- break;
- }
- stat = ler1->ler1_rdp;
- } while ((stat & LE_C0_IDON) == 0);
-
- ler1->ler1_rdp = LE_C0_IDON;
- le_softc.next_rmd = 0;
- le_softc.next_tmd = 0;
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_STRT;
-}
-
-/*
- * le_error
- * XXX le_softc
- */
-
-void le_error(nif, str, vler1)
- struct netif *nif;
- char *str;
- volatile void *vler1;
-{
- volatile struct lereg1 *ler1 = vler1;
- /* ler1->ler1_rap = LE_CSRO done in caller */
- if (ler1->ler1_rdp & LE_C0_BABL)
- panic("le: been babbling, found by '%s'\n", str);
- if (ler1->ler1_rdp & LE_C0_CERR) {
- ler1->ler1_rdp = LE_C0_CERR;
- }
- if (ler1->ler1_rdp & LE_C0_MISS) {
- ler1->ler1_rdp = LE_C0_MISS;
- }
- if (ler1->ler1_rdp & LE_C0_MERR) {
- printf("le: memory error in '%s'\n", str);
- panic("memory error");
- }
-}
-
-/*
- * put a packet
- * XXX le_softc
- */
-
-int le_put(desc, pkt, len)
- struct iodesc *desc;
- void *pkt;
- int 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: output buffer busy\n");
- }
- bcopy(pkt, 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: transmit timeout, stat = 0x%x\n", 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_ERR) {
- printf("le: transmit error, error = 0x%x\n", tmd->tmd3);
- return -1;
- }
- if (le_debug) {
- printf("le: le_put() successful: sent %d\n", len);
- printf("le: le_put(): tmd1_bits: %x tmd3: %x\n",
- (unsigned int) tmd->tmd1_bits,
- (unsigned int) tmd->tmd3);
- }
- return len;
-}
-
-
-/*
- * le_get
- */
-
-int le_get(desc, pkt, len, timeout)
- struct iodesc *desc;
- void *pkt;
- int 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;
-}
-
-
-/*
- * le_poll
- * XXX softc
- */
-
-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_poll: rmd status 0x%x\n", rmd->rmd1_bits);
- length = 0;
- goto cleanup;
- }
- if ((rmd->rmd1_bits & (LE_R1_STP|LE_R1_ENP)) != (LE_R1_STP|LE_R1_ENP))
- 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;
-}
diff --git a/sys/arch/mvme68k/stand/libsa/netif.h b/sys/arch/mvme68k/stand/libsa/netif.h
deleted file mode 100644
index 680eed00f63..00000000000
--- a/sys/arch/mvme68k/stand/libsa/netif.h
+++ /dev/null
@@ -1,22 +0,0 @@
-
-#include "iodesc.h"
-
-struct netif {
- void *devdata;
-};
-
-ssize_t netif_get __P((struct iodesc *, void *, size_t, time_t));
-ssize_t netif_put __P((struct iodesc *, void *, size_t));
-
-int netif_open __P((void *));
-int netif_close __P((int));
-
-struct iodesc *socktodesc __P((int));
-
-void le_end __P((struct netif *));
-void le_error __P((struct netif *, char *, volatile void *));
-int le_get __P((struct iodesc *, void *, int, time_t));
-void *le_init __P((struct iodesc *));
-int le_poll __P((struct iodesc *, void *, int));
-int le_put __P((struct iodesc *, void *, int));
-void le_reset __P((struct netif *, u_char *));