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/ral/if_ral_pccard.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 /*      $FreeBSD: releng/6.0/sys/dev/ral/if_ral_pccard.c 147580 2005-06-24 14:36:54Z imp $      */
    2 
    3 /*-
    4  * Copyright (c) 2005
    5  *      Damien Bergamini <damien.bergamini@free.fr>
    6  *
    7  * Permission to use, copy, modify, and distribute this software for any
    8  * purpose with or without fee is hereby granted, provided that the above
    9  * copyright notice and this permission notice appear in all copies.
   10  *
   11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   18  */
   19 
   20 #include <sys/cdefs.h>
   21 __FBSDID("$FreeBSD: releng/6.0/sys/dev/ral/if_ral_pccard.c 147580 2005-06-24 14:36:54Z imp $");
   22 
   23 /*
   24  * CardBus front-end for the Ralink RT2500 driver.
   25  */
   26 
   27 #include <sys/param.h>
   28 #include <sys/sysctl.h>
   29 #include <sys/sockio.h>
   30 #include <sys/mbuf.h>
   31 #include <sys/kernel.h>
   32 #include <sys/socket.h>
   33 #include <sys/systm.h>
   34 #include <sys/malloc.h>
   35 #include <sys/module.h>
   36 #include <sys/bus.h>
   37 #include <sys/endian.h>
   38 
   39 #include <machine/bus.h>
   40 #include <machine/resource.h>
   41 #include <sys/rman.h>
   42 
   43 #include <net/if.h>
   44 #include <net/if_arp.h>
   45 #include <net/ethernet.h>
   46 #include <net/if_dl.h>
   47 #include <net/if_media.h>
   48 #include <net/if_types.h>
   49 
   50 #include <net80211/ieee80211_var.h>
   51 #include <net80211/ieee80211_radiotap.h>
   52 
   53 #include <dev/pccard/pccardvar.h>
   54 #include <dev/pccard/pccard_cis.h>
   55 
   56 #include <dev/ral/if_ralrate.h>
   57 #include <dev/ral/if_ralreg.h>
   58 #include <dev/ral/if_ralvar.h>
   59 
   60 #include "card_if.h"
   61 #include "pccarddevs.h"
   62 
   63 MODULE_DEPEND(ral, pccard, 1, 1, 1);
   64 MODULE_DEPEND(ral, wlan, 1, 1, 1);
   65 
   66 static const struct pccard_product ral_pccard_products[] = {
   67         PCMCIA_CARD(RALINK, RT2560),
   68 
   69         { NULL }
   70 };
   71 
   72 static int ral_pccard_match(device_t);
   73 static int ral_pccard_probe(device_t);
   74 static int ral_pccard_attach(device_t);
   75 
   76 static device_method_t ral_pccard_methods[] = {
   77         /* Device interface */
   78         DEVMETHOD(device_probe,         pccard_compat_probe),
   79         DEVMETHOD(device_attach,        pccard_compat_attach),
   80         DEVMETHOD(device_detach,        ral_detach),
   81         DEVMETHOD(device_shutdown,      ral_shutdown),
   82 
   83         /* Card interface */
   84         DEVMETHOD(card_compat_match,    ral_pccard_match),
   85         DEVMETHOD(card_compat_probe,    ral_pccard_probe),
   86         DEVMETHOD(card_compat_attach,   ral_pccard_attach),
   87 
   88         { 0, 0 }
   89 };
   90 
   91 static driver_t ral_pccard_driver = {
   92         "ral",
   93         ral_pccard_methods,
   94         sizeof (struct ral_softc)
   95 };
   96 
   97 DRIVER_MODULE(ral, pccard, ral_pccard_driver, ral_devclass, 0, 0);
   98 
   99 static int
  100 ral_pccard_match(device_t dev)
  101 {
  102         const struct pccard_product *pp;
  103 
  104         if ((pp = pccard_product_lookup(dev, ral_pccard_products,
  105             sizeof (struct pccard_product), NULL)) != NULL) {
  106                 if (pp->pp_name != NULL)
  107                         device_set_desc(dev, pp->pp_name);
  108                 return 0;
  109         }
  110         return ENXIO;
  111 }
  112 
  113 static int
  114 ral_pccard_probe(device_t dev)
  115 {
  116         int error;
  117 
  118         error = ral_alloc(dev, 0);
  119         if (error != 0)
  120                 return error;
  121 
  122         ral_free(dev);
  123 
  124         return 0;
  125 }
  126 
  127 static int
  128 ral_pccard_attach(device_t dev)
  129 {
  130         int error;
  131 
  132         error = ral_alloc(dev, 0);
  133         if (error != 0)
  134                 return error;
  135 
  136         error = ral_attach(dev);
  137         if (error != 0)
  138                 ral_free(dev);
  139 
  140         return error;
  141 }

Cache object: a88de726481e1a815e6688f9a2c91a12


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