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/podulebus/if_eb.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_eb.c,v 1.12 2008/04/05 20:08:52 cegger Exp $ */
    2 
    3 /*
    4  * Copyright (c) 2000, 2001 Ben Harris
    5  * Copyright (c) 1995 Mark Brinicombe
    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 Mark Brinicombe.
   19  * 4. The name of the company nor the name of the author may be used to
   20  *    endorse or promote products derived from this software without specific
   21  *    prior written permission.
   22  *
   23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
   24  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   25  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   26  * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   27  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   29  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   33  * SUCH DAMAGE.
   34  */
   35 /*
   36  * if_eb.c - EtherB device driver
   37  */
   38 
   39 #include <sys/cdefs.h>
   40 __KERNEL_RCSID(0, "$NetBSD: if_eb.c,v 1.12 2008/04/05 20:08:52 cegger Exp $");
   41 
   42 #include <sys/param.h>
   43 
   44 #include <sys/device.h>
   45 #include <sys/socket.h>
   46 #include <sys/systm.h>
   47 
   48 #include <sys/bus.h>
   49 #include <sys/intr.h>
   50 
   51 #include <net/if.h>
   52 #include <net/if_ether.h>
   53 
   54 #include <dev/podulebus/podulebus.h>
   55 #include <dev/podulebus/podules.h>
   56 
   57 #include <dev/podulebus/if_ebreg.h>
   58 #include <dev/ic/seeq8005var.h>
   59 
   60 /*
   61  * per-line info and status
   62  */
   63 
   64 struct eb_softc {
   65         struct seeq8005_softc   sc_8005;
   66         void    *sc_ih;
   67         struct evcnt sc_intrcnt;
   68 };
   69 
   70 /*
   71  * prototypes
   72  */
   73 
   74 int ebprobe(struct device *, struct cfdata *, void *);
   75 void ebattach(struct device *, struct device *, void *);
   76 
   77 /* driver structure for autoconf */
   78 
   79 CFATTACH_DECL(eb, sizeof(struct eb_softc),
   80     ebprobe, ebattach, NULL, NULL);
   81 
   82 /*
   83  * Probe routine.
   84  */
   85 
   86 /*
   87  * Probe for the ether3 podule.
   88  */
   89 
   90 int
   91 ebprobe(struct device *parent, struct cfdata *cf, void *aux)
   92 {
   93         struct podulebus_attach_args *pa = aux;
   94 
   95         return pa->pa_product == PODULE_ETHERB;
   96 }
   97 
   98 
   99 /*
  100  * Attach podule.
  101  */
  102 
  103 void
  104 ebattach(struct device *parent, struct device *self, void *aux)
  105 {
  106         struct eb_softc *sc = device_private(self);
  107         struct podulebus_attach_args *pa = aux;
  108         u_int8_t myaddr[ETHER_ADDR_LEN];
  109 
  110 /*      dprintf(("Attaching %s...\n", device_xname(&sc->sc_dev)));*/
  111 
  112         /* Set the address of the controller for easy access */
  113         podulebus_shift_tag(pa->pa_mod_t, EB_8004_SHIFT, &sc->sc_8005.sc_iot);
  114         bus_space_map(sc->sc_8005.sc_iot, pa->pa_mod_base + EB_8004_BASE,
  115             /* XXX */ 0, 0, &sc->sc_8005.sc_ioh);
  116 
  117         /*
  118          * Build the address from the machine id.
  119          */
  120         netslot_ea(myaddr);
  121 
  122         printf(":");
  123         seeq8005_attach(&sc->sc_8005, myaddr, NULL, 0, 0);
  124 
  125         /* Claim a podule interrupt */
  126 
  127         evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL,
  128             device_xname(self), "intr");
  129         sc->sc_ih = podulebus_irq_establish(pa->pa_ih, IPL_NET, seeq8005intr,
  130             sc, &sc->sc_intrcnt);
  131 }
  132 
  133 /* End of if_eb.c */

Cache object: e52806dd70a98cf3398c56a9f46f4aad


[ 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.