summaryrefslogtreecommitdiff
path: root/sys/dev/tc/if_le.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-10 12:41:32 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-10 12:41:32 +0000
commitb8c4a37a40fbc7dd0a9e13c6a19af16489874aa1 (patch)
tree5d3410536b0b327107d38972cd6de9edee2b705f /sys/dev/tc/if_le.c
parente1e97ed1b9981b214b4a1a85f0d6a2f17c7656b9 (diff)
if_name/if_unit -> if_xname/if_softc
Diffstat (limited to 'sys/dev/tc/if_le.c')
-rw-r--r--sys/dev/tc/if_le.c171
1 files changed, 1 insertions, 170 deletions
diff --git a/sys/dev/tc/if_le.c b/sys/dev/tc/if_le.c
index 51415a94208..67368f06e8d 100644
--- a/sys/dev/tc/if_le.c
+++ b/sys/dev/tc/if_le.c
@@ -1,170 +1 @@
-/* $OpenBSD: if_le.c,v 1.4 1996/05/02 13:51:48 deraadt Exp $ */
-/* $NetBSD: if_le.c,v 1.9 1996/04/22 02:54:10 christos Exp $ */
-
-/*-
- * Copyright (c) 1995 Charles M. Hannum. All rights reserved.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * 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_le.c 8.2 (Berkeley) 11/16/93
- */
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/syslog.h>
-#include <sys/socket.h>
-#include <sys/device.h>
-
-#include <net/if.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#endif
-
-#include <dev/tc/if_levar.h>
-#include <dev/ic/am7990reg.h>
-#define LE_NEED_BUF_CONTIG
-#define LE_NEED_BUF_GAP2
-#define LE_NEED_BUF_GAP16
-#include <dev/ic/am7990var.h>
-#include <dev/tc/tcvar.h>
-
-/* access LANCE registers */
-void lewritereg __P((volatile u_short *regptr, u_short val));
-#define LERDWR(cntl, src, dst) { (dst) = (src); tc_mb(); }
-#define LEWREG(src, dst) lewritereg(&(dst), (src))
-
-#define LE_SOFTC(unit) le_cd.cd_devs[unit]
-#define LE_DELAY(x) DELAY(x)
-
-struct cfdriver le_cd = {
- NULL, "le", DV_IFNET
-};
-
-void
-dec_le_common_attach(sc, eap)
- struct le_softc *sc;
- u_char *eap;
-{
- int i;
-
- sc->sc_conf3 = 0;
- sc->sc_addr = 0;
- sc->sc_memsize = 65536;
-
- /*
- * Get the ethernet address out of rom
- */
- for (i = 0; i < sizeof(sc->sc_arpcom.ac_enaddr); i++) {
- sc->sc_arpcom.ac_enaddr[i] = *eap;
- eap += 4;
- }
-
- sc->sc_arpcom.ac_if.if_name = le_cd.cd_name;
- leconfig(sc);
-}
-
-integrate void
-lehwinit(sc)
- struct le_softc *sc;
-{
-}
-
-integrate void
-lewrcsr(sc, port, val)
- struct le_softc *sc;
- u_int16_t port, val;
-{
- struct lereg1 *ler1 = sc->sc_r1;
-
- LEWREG(port, ler1->ler1_rap);
- LERDWR(port, val, ler1->ler1_rdp);
-}
-
-integrate u_int16_t
-lerdcsr(sc, port)
- struct le_softc *sc;
- u_int16_t port;
-{
- struct lereg1 *ler1 = sc->sc_r1;
- u_int16_t val;
-
- LEWREG(port, ler1->ler1_rap);
- LERDWR(0, ler1->ler1_rdp, val);
- return (val);
-}
-
-/*
- * Write a lance register port, reading it back to ensure success. This seems
- * to be necessary during initialization, since the chip appears to be a bit
- * pokey sometimes.
- */
-void
-lewritereg(regptr, val)
- register volatile u_short *regptr;
- register u_short val;
-{
- register int i = 0;
-
- while (*regptr != val) {
- *regptr = val;
- tc_mb();
- if (++i > 10000) {
- printf("le: Reg did not settle (to x%x): x%x\n", val,
- *regptr);
- return;
- }
- DELAY(100);
- }
-}
-
-/*
- * Routines for accessing the transmit and receive buffers are provided
- * by am7990.c, because of the LE_NEED_BUF_* macros defined above.
- * Unfortunately, CPU addressing of these buffers is done in one of
- * 3 ways:
- * - contiguous (for the 3max and turbochannel option card)
- * - gap2, which means shorts (2 bytes) interspersed with short (2 byte)
- * spaces (for the pmax)
- * - gap16, which means 16bytes interspersed with 16byte spaces
- * for buffers which must begin on a 32byte boundary (for 3min, maxine,
- * and alpha)
- * The buffer offset is the logical byte offset, assuming contiguous storage.
- */
-
-#include <dev/ic/am7990.c>
+/* $OpenBSD: if_le.c,v 1.5 1996/05/10 12:41:28 deraadt Exp $ */