root/dev/tc/if_le_tc.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. le_tc_match
  2. le_tc_attach

    1 /*      $OpenBSD: if_le_tc.c,v 1.8 2007/06/17 21:20:47 jasper Exp $     */
    2 /*      $NetBSD: if_le_tc.c,v 1.12 2001/11/13 06:26:10 lukem Exp $      */
    3 
    4 /*
    5  * Copyright (c) 1996 Carnegie-Mellon University.
    6  * All rights reserved.
    7  *
    8  * Author: Chris G. Demetriou
    9  *
   10  * Permission to use, copy, modify and distribute this software and
   11  * its documentation is hereby granted, provided that both the copyright
   12  * notice and this permission notice appear in all copies of the
   13  * software, derivative works or modified versions, and any portions
   14  * thereof, and that both notices appear in supporting documentation.
   15  *
   16  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   17  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
   18  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   19  *
   20  * Carnegie Mellon requests users of this software to return to
   21  *
   22  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   23  *  School of Computer Science
   24  *  Carnegie Mellon University
   25  *  Pittsburgh PA 15213-3890
   26  *
   27  * any improvements or extensions that they make and grant Carnegie the
   28  * rights to redistribute these changes.
   29  */
   30 
   31 /*
   32  * LANCE on TurboChannel.
   33  */
   34 
   35 #include <sys/param.h>
   36 #include <sys/systm.h>
   37 #include <sys/mbuf.h>
   38 #include <sys/syslog.h>
   39 #include <sys/socket.h>
   40 #include <sys/device.h>
   41 
   42 #include <net/if.h>
   43 #include <net/if_media.h>
   44 
   45 #ifdef INET
   46 #include <netinet/in.h>
   47 #include <netinet/if_ether.h>
   48 #endif
   49 
   50 #include <dev/ic/am7990reg.h>
   51 #include <dev/ic/am7990var.h>
   52 
   53 #include <dev/tc/if_levar.h>
   54 #include <dev/tc/tcvar.h>
   55 
   56 int     le_tc_match(struct device *, void *, void *);
   57 void    le_tc_attach(struct device *, struct device *, void *);
   58 
   59 struct cfattach le_tc_ca = {
   60         sizeof(struct le_softc), le_tc_match, le_tc_attach
   61 };
   62 
   63 #define LE_OFFSET_RAM           0x0
   64 #define LE_OFFSET_LANCE         0x100000
   65 #define LE_OFFSET_ROM           0x1c0000
   66 
   67 int
   68 le_tc_match(struct device *parent, void *match, void *aux)
   69 {
   70         struct tc_attach_args *d = aux;
   71 
   72         if (strncmp("PMAD-AA ", d->ta_modname, TC_ROM_LLEN) != 0)
   73                 return (0);
   74 
   75         return (1);
   76 }
   77 
   78 void
   79 le_tc_attach(struct device *parent, struct device *self, void *aux)
   80 {
   81         struct le_softc *lesc = (void *)self;
   82         struct am7990_softc *sc = &lesc->sc_am7990;
   83         struct tc_attach_args *d = aux;
   84 
   85         /*
   86          * It's on the turbochannel proper, or a kn02
   87          * baseboard implementation of a TC option card.
   88          */
   89         lesc->sc_r1 = (struct lereg1 *)
   90            TC_DENSE_TO_SPARSE(TC_PHYS_TO_UNCACHED(d->ta_addr + LE_OFFSET_LANCE)); 
   91         sc->sc_mem = (void *)(d->ta_addr + LE_OFFSET_RAM);
   92 
   93         sc->sc_copytodesc = am7990_copytobuf_contig;
   94         sc->sc_copyfromdesc = am7990_copyfrombuf_contig;
   95         sc->sc_copytobuf = am7990_copytobuf_contig;
   96         sc->sc_copyfrombuf = am7990_copyfrombuf_contig;
   97         sc->sc_zerobuf = am7990_zerobuf_contig;
   98 
   99         /*
  100          * TC lance boards have onboard SRAM buffers.  DMA
  101          * between the onbard RAM and main memory is not possible,
  102          * so  DMA setup is not required.
  103          */
  104 
  105         dec_le_common_attach(&lesc->sc_am7990,
  106                              (u_char *)(d->ta_addr + LE_OFFSET_ROM + 2));
  107 
  108         tc_intr_establish(parent, d->ta_cookie, TC_IPL_NET, am7990_intr, sc);
  109 }

/* [<][>][^][v][top][bottom][index][help] */