NetBSD/sys/dev/tc/if_le_tc.c

116 lines
3.2 KiB
C
Raw Normal View History

2006-03-31 21:39:33 +04:00
/* $NetBSD: if_le_tc.c,v 1.20 2006/03/31 17:39:33 thorpej Exp $ */
/*
* 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.
*/
2001-11-13 09:26:09 +03:00
#include <sys/cdefs.h>
2006-03-31 21:39:33 +04:00
__KERNEL_RCSID(0, "$NetBSD: if_le_tc.c,v 1.20 2006/03/31 17:39:33 thorpej Exp $");
2001-11-13 09:26:09 +03:00
1998-07-05 04:51:04 +04:00
#include "opt_inet.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>
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>
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_inarp.h>
#endif
1998-07-21 21:36:01 +04:00
#include <dev/ic/lancereg.h>
#include <dev/ic/lancevar.h>
#include <dev/ic/am7990reg.h>
#include <dev/ic/am7990var.h>
#include <dev/tc/if_levar.h>
#include <dev/tc/tcvar.h>
2006-03-31 21:39:33 +04:00
static int le_tc_match(struct device *, struct cfdata *, void *);
static void le_tc_attach(struct device *, struct device *, void *);
2002-10-01 05:05:50 +04:00
CFATTACH_DECL(le_tc, sizeof(struct le_softc),
2002-10-02 20:51:16 +04:00
le_tc_match, le_tc_attach, NULL, NULL);
#define LE_OFFSET_RAM 0x0
#define LE_OFFSET_LANCE 0x100000
#define LE_OFFSET_ROM 0x1c0000
2006-03-31 21:39:33 +04:00
static int
le_tc_match(struct device *parent, struct cfdata *match, void *aux)
{
struct tc_attach_args *d = aux;
if (strncmp("PMAD-AA ", d->ta_modname, TC_ROM_LLEN) != 0)
return (0);
return (1);
}
2006-03-31 21:39:33 +04:00
static void
le_tc_attach(struct device *parent, struct device *self, void *aux)
{
2006-03-30 20:09:28 +04:00
struct le_softc *lesc = device_private(self);
2000-03-30 16:41:09 +04:00
struct lance_softc *sc = &lesc->sc_am7990.lsc;
struct tc_attach_args *d = aux;
/*
* It's on the turbochannel proper, or a kn02
* baseboard implementation of a TC option card.
*/
lesc->sc_r1 = (struct lereg1 *)
TC_DENSE_TO_SPARSE(TC_PHYS_TO_UNCACHED(d->ta_addr + LE_OFFSET_LANCE));
sc->sc_mem = (void *)(d->ta_addr + LE_OFFSET_RAM);
1998-07-21 21:36:01 +04:00
sc->sc_copytodesc = lance_copytobuf_contig;
sc->sc_copyfromdesc = lance_copyfrombuf_contig;
sc->sc_copytobuf = lance_copytobuf_contig;
sc->sc_copyfrombuf = lance_copyfrombuf_contig;
sc->sc_zerobuf = lance_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.
*/
1998-07-21 21:36:01 +04:00
dec_le_common_attach(&lesc->sc_am7990,
(u_char *)(d->ta_addr + LE_OFFSET_ROM + 2));
tc_intr_establish(parent, d->ta_cookie, TC_IPL_NET, am7990_intr, sc);
}