1997-07-22 07:44:29 +04:00
|
|
|
/* $NetBSD: if_le_tc.c,v 1.7 1997/07/22 03:44:31 jonathan Exp $ */
|
1996-04-18 04:50:11 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1996 Carnegie-Mellon University.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Author: Chris G. Demetriou
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify and distribute this software and
|
|
|
|
* its documentation is hereby granted, provided that both the copyright
|
|
|
|
* notice and this permission notice appear in all copies of the
|
|
|
|
* software, derivative works or modified versions, and any portions
|
|
|
|
* thereof, and that both notices appear in supporting documentation.
|
|
|
|
*
|
|
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
|
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
|
|
|
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
* Carnegie Mellon requests users of this software to return to
|
|
|
|
*
|
|
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
|
|
* School of Computer Science
|
|
|
|
* Carnegie Mellon University
|
|
|
|
* Pittsburgh PA 15213-3890
|
|
|
|
*
|
|
|
|
* any improvements or extensions that they make and grant Carnegie the
|
|
|
|
* rights to redistribute these changes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* LANCE on TurboChannel.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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>
|
1997-03-16 00:06:09 +03:00
|
|
|
#include <net/if_ether.h>
|
1997-03-17 06:17:34 +03:00
|
|
|
#include <net/if_media.h>
|
1996-04-18 04:50:11 +04:00
|
|
|
|
|
|
|
#ifdef INET
|
|
|
|
#include <netinet/in.h>
|
1997-03-15 21:09:08 +03:00
|
|
|
#include <netinet/if_inarp.h>
|
1996-04-18 04:50:11 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <dev/ic/am7990reg.h>
|
|
|
|
#include <dev/ic/am7990var.h>
|
|
|
|
|
1996-05-07 06:24:54 +04:00
|
|
|
#include <dev/tc/if_levar.h>
|
1996-04-18 04:50:11 +04:00
|
|
|
#include <dev/tc/tcvar.h>
|
|
|
|
|
1996-12-05 04:25:23 +03:00
|
|
|
int le_tc_match __P((struct device *, struct cfdata *, void *));
|
1996-04-18 04:50:11 +04:00
|
|
|
void le_tc_attach __P((struct device *, struct device *, void *));
|
|
|
|
|
|
|
|
struct cfattach le_tc_ca = {
|
|
|
|
sizeof(struct le_softc), le_tc_match, le_tc_attach
|
|
|
|
};
|
|
|
|
|
|
|
|
#define LE_OFFSET_RAM 0x0
|
|
|
|
#define LE_OFFSET_LANCE 0x100000
|
|
|
|
#define LE_OFFSET_ROM 0x1c0000
|
|
|
|
|
|
|
|
int
|
|
|
|
le_tc_match(parent, match, aux)
|
|
|
|
struct device *parent;
|
1996-12-05 04:25:23 +03:00
|
|
|
struct cfdata *match;
|
|
|
|
void *aux;
|
1996-04-18 04:50:11 +04:00
|
|
|
{
|
|
|
|
struct tc_attach_args *d = aux;
|
|
|
|
|
|
|
|
if (strncmp("PMAD-AA ", d->ta_modname, TC_ROM_LLEN) &&
|
|
|
|
strncmp("PMAD-BA ", d->ta_modname, TC_ROM_LLEN))
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
le_tc_attach(parent, self, aux)
|
|
|
|
struct device *parent, *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
1996-05-07 06:24:54 +04:00
|
|
|
register struct le_softc *lesc = (void *)self;
|
|
|
|
register struct am7990_softc *sc = &lesc->sc_am7990;
|
1996-04-18 04:50:11 +04:00
|
|
|
struct tc_attach_args *d = aux;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* It's on the turbochannel proper, or a kn02
|
|
|
|
* baseboard implementation of a TC option card.
|
|
|
|
*/
|
1996-05-07 06:24:54 +04:00
|
|
|
lesc->sc_r1 = (struct lereg1 *)(d->ta_addr + LE_OFFSET_LANCE);
|
1996-04-18 04:50:11 +04:00
|
|
|
sc->sc_mem = (void *)(d->ta_addr + LE_OFFSET_RAM);
|
|
|
|
|
|
|
|
sc->sc_copytodesc = am7990_copytobuf_contig;
|
|
|
|
sc->sc_copyfromdesc = am7990_copyfrombuf_contig;
|
|
|
|
sc->sc_copytobuf = am7990_copytobuf_contig;
|
|
|
|
sc->sc_copyfrombuf = am7990_copyfrombuf_contig;
|
|
|
|
sc->sc_zerobuf = am7990_zerobuf_contig;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TC lance boards have onboard SRAM buffers. DMA
|
|
|
|
* between the onbard RAM and main memory is not possible,
|
|
|
|
* so DMA setup is not required.
|
|
|
|
*/
|
|
|
|
|
|
|
|
dec_le_common_attach(sc, (u_char *)(d->ta_addr + LE_OFFSET_ROM + 2));
|
|
|
|
|
1996-05-07 06:24:54 +04:00
|
|
|
tc_intr_establish(parent, d->ta_cookie, TC_IPL_NET, am7990_intr, sc);
|
1996-04-18 04:50:11 +04:00
|
|
|
}
|