The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/sbus/if_en.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: if_en.c,v 1.18 2002/12/10 13:44:47 pk Exp $    */
    2 
    3 /*
    4  *
    5  * Copyright (c) 1996 Charles D. Cranor and Washington University.
    6  * All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. All advertising materials mentioning features or use of this software
   17  *    must display the following acknowledgement:
   18  *      This product includes software developed by Charles D. Cranor and
   19  *      Washington University.
   20  * 4. The name of the author may not be used to endorse or promote products
   21  *    derived from this software without specific prior written permission.
   22  *
   23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   25  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   26  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   28  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   32  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   33  */
   34 
   35 /*
   36  *
   37  * i f _ e n _ s b u s . c  
   38  *
   39  * author: Chuck Cranor <chuck@ccrc.wustl.edu>
   40  * started: spring, 1996.
   41  *
   42  * SBUS glue for the eni155s card.
   43  */
   44 
   45 #include <sys/cdefs.h>
   46 __KERNEL_RCSID(0, "$NetBSD: if_en.c,v 1.18 2002/12/10 13:44:47 pk Exp $");
   47 
   48 #include <sys/param.h>
   49 #include <sys/systm.h>
   50 #include <sys/device.h>
   51 #include <sys/mbuf.h>
   52 #include <sys/socket.h>
   53 #include <sys/socketvar.h>
   54 
   55 #include <net/if.h>
   56 
   57 #include <machine/bus.h>
   58 #include <machine/intr.h>
   59 #include <machine/cpu.h>
   60 
   61 #include <dev/sbus/sbusvar.h>
   62 
   63 #include <dev/ic/midwayreg.h>
   64 #include <dev/ic/midwayvar.h>
   65 
   66 
   67 /*
   68  * local structures
   69  */
   70 struct en_sbus_softc {
   71         /* bus independent stuff */
   72         struct en_softc esc;            /* includes "device" structure */
   73 
   74         /* sbus glue */
   75         struct sbusdev  sc_sd;          /* sbus device */
   76 };
   77 
   78 
   79 /*
   80  * prototypes
   81  */
   82 static  int en_sbus_match __P((struct device *, struct cfdata *, void *));
   83 static  void en_sbus_attach __P((struct device *, struct device *, void *));
   84 
   85 /*
   86  * SBus autoconfig attachments
   87  */
   88 
   89 CFATTACH_DECL(en_sbus, sizeof(struct en_sbus_softc),
   90     en_sbus_match, en_sbus_attach, NULL, NULL);
   91 
   92 /***********************************************************************/
   93 
   94 /*
   95  * autoconfig stuff
   96  */
   97 
   98 static int
   99 en_sbus_match(parent, cf, aux)
  100         struct device *parent;
  101         struct cfdata *cf;
  102         void *aux;
  103 
  104 {
  105         struct sbus_attach_args *sa = aux;
  106 
  107         if (strcmp("ENI-155s", sa->sa_name) == 0)  {
  108                 if (CPU_ISSUN4M) {
  109 #ifdef DEBUG
  110                         printf("%s: sun4m DMA not supported yet\n",
  111                             sa->sa_name);
  112 #endif
  113                         return (0);
  114                 }
  115                 return (1);
  116         } else {
  117                 return (0);
  118         }
  119 }
  120 
  121 
  122 static void
  123 en_sbus_attach(parent, self, aux)
  124         struct device *parent, *self;
  125         void *aux;
  126 
  127 {
  128         struct sbus_attach_args *sa = aux;
  129         struct en_softc *sc = (void *)self;
  130         struct en_sbus_softc *scs = (void *)self;
  131 
  132         printf("\n");
  133 
  134         if (sbus_bus_map(sa->sa_bustag,
  135                          sa->sa_slot,
  136                          sa->sa_offset,
  137                          4*1024*1024,
  138                          0, &sc->en_base) != 0) {
  139                 printf("%s: cannot map registers\n", self->dv_xname);
  140                 return;
  141         }
  142 
  143         /* Establish interrupt handler */
  144         if (sa->sa_nintr != 0)
  145                 (void)bus_intr_establish(sa->sa_bustag, sa->sa_pri,
  146                                          IPL_NET, en_intr, sc);
  147 
  148         sc->ipl = sa->sa_pri;   /* appropriate? */
  149 
  150         sbus_establish(&scs->sc_sd, &sc->sc_dev);
  151 
  152         /*
  153          * done SBUS specific stuff
  154          */
  155         en_attach(sc);
  156 }

Cache object: cf5d9b915ce4ab5081a203bdf9e27acc


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.