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/wi/if_wi_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 /*-
    2  * SPDX-License-Identifier: BSD-4-Clause
    3  *
    4  * Copyright (c) 1997, 1998, 1999
    5  *      Bill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. All advertising materials mentioning features or use of this software
   16  *    must display the following acknowledgement:
   17  *      This product includes software developed by Bill Paul.
   18  * 4. Neither the name of the author nor the names of any co-contributors
   19  *    may be used to endorse or promote products derived from this software
   20  *    without specific prior written permission.
   21  *
   22  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
   23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   25  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
   26  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
   32  * THE POSSIBILITY OF SUCH DAMAGE.
   33  */
   34 
   35 /*
   36  * Lucent WaveLAN/IEEE 802.11 PCMCIA driver for FreeBSD.
   37  *
   38  * Written by Bill Paul <wpaul@ctr.columbia.edu>
   39  * Electrical Engineering Department
   40  * Columbia University, New York City
   41  */
   42 
   43 #include <sys/cdefs.h>
   44 __FBSDID("$FreeBSD$");
   45 
   46 #include <sys/param.h>
   47 #include <sys/kernel.h>
   48 #include <sys/malloc.h>
   49 #include <sys/socket.h>
   50 #include <sys/systm.h>
   51 #include <sys/mbuf.h>
   52 #include <sys/module.h>
   53 #include <sys/bus.h>
   54 
   55 #include <machine/bus.h>
   56 #include <machine/resource.h>
   57 #include <sys/rman.h>
   58 
   59 #include <net/if.h>
   60 #include <net/if_arp.h>
   61 #include <net/ethernet.h>
   62 #include <net/if_dl.h>
   63 #include <net/if_media.h>
   64 #include <net/if_types.h>
   65 
   66 #include <net80211/ieee80211_var.h>
   67 #include <net80211/ieee80211_radiotap.h>
   68 
   69 #include <dev/pccard/pccardvar.h>
   70 #include <dev/pccard/pccard_cis.h>
   71 
   72 #include <dev/wi/if_wavelan_ieee.h>
   73 #include <dev/wi/if_wireg.h>
   74 #include <dev/wi/if_wivar.h>
   75 
   76 #include "card_if.h"
   77 #include "pccarddevs.h"
   78 
   79 static int wi_pccard_probe(device_t);
   80 static int wi_pccard_attach(device_t);
   81 
   82 static device_method_t wi_pccard_methods[] = {
   83         /* Device interface */
   84         DEVMETHOD(device_probe,         wi_pccard_probe),
   85         DEVMETHOD(device_attach,        wi_pccard_attach),
   86         DEVMETHOD(device_detach,        wi_detach),
   87         DEVMETHOD(device_shutdown,      wi_shutdown),
   88         { 0, 0 }
   89 };
   90 
   91 static driver_t wi_pccard_driver = {
   92         "wi",
   93         wi_pccard_methods,
   94         sizeof(struct wi_softc)
   95 };
   96 
   97 DRIVER_MODULE(wi, pccard, wi_pccard_driver, wi_devclass, 0, 0);
   98 MODULE_DEPEND(wi, wlan, 1, 1, 1);
   99 
  100 static const struct pccard_product wi_pccard_products[] = {
  101         PCMCIA_CARD(3COM, 3CRWE737A),
  102         PCMCIA_CARD(3COM, 3CRWE777A),
  103         PCMCIA_CARD(ACTIONTEC, PRISM),
  104         PCMCIA_CARD(ADAPTEC2, ANW8030),
  105         PCMCIA_CARD(ADDTRON, AWP100),
  106         PCMCIA_CARD(AIRVAST, WN_100B),
  107         PCMCIA_CARD(AIRVAST, WN_100),
  108         PCMCIA_CARD(ALLIEDTELESIS, WR211PCM),
  109         PCMCIA_CARD(ARTEM, ONAIR),
  110         PCMCIA_CARD(ASUS, WL100),
  111         PCMCIA_CARD(BAY, EMOBILITY_11B),
  112         PCMCIA_CARD(BROMAX, IWN),
  113         PCMCIA_CARD(BROMAX, IWN3),
  114         PCMCIA_CARD(BROMAX, WCF11),
  115         PCMCIA_CARD(BUFFALO, WLI_CF_S11G),
  116         PCMCIA_CARD(BUFFALO, WLI_PCM_S11),
  117         PCMCIA_CARD(COMPAQ, NC5004),
  118         PCMCIA_CARD(CONTEC, FX_DS110_PCC),
  119         PCMCIA_CARD(COREGA, WIRELESS_LAN_PCC_11),
  120         PCMCIA_CARD(COREGA, WIRELESS_LAN_PCCA_11),
  121         PCMCIA_CARD(COREGA, WIRELESS_LAN_PCCB_11),
  122         PCMCIA_CARD(COREGA, WIRELESS_LAN_PCCL_11),
  123         PCMCIA_CARD(DLINK, DWL650H),
  124         PCMCIA_CARD(ELSA, XI300_IEEE),
  125         PCMCIA_CARD(ELSA, XI325_IEEE),
  126         PCMCIA_CARD(ELSA, APDL325_IEEE),
  127         PCMCIA_CARD(ELSA, XI330_IEEE),
  128         PCMCIA_CARD(ELSA, XI800_IEEE),
  129         PCMCIA_CARD(ELSA, WIFI_FLASH),
  130         PCMCIA_CARD(EMTAC, WLAN),
  131         PCMCIA_CARD(ERICSSON, WIRELESSLAN),
  132         PCMCIA_CARD(GEMTEK, WLAN),
  133         PCMCIA_CARD(HWN, AIRWAY80211),
  134         PCMCIA_CARD(INTEL, PRO_WLAN_2011),
  135         PCMCIA_CARD(INTERSIL, ISL37100P),
  136         PCMCIA_CARD(INTERSIL, ISL37110P),
  137         PCMCIA_CARD(INTERSIL, ISL37300P),
  138         PCMCIA_CARD(INTERSIL2, PRISM2),
  139         PCMCIA_CARD(IODATA2, WCF12),
  140         PCMCIA_CARD(IODATA2, WNB11PCM),
  141         PCMCIA_CARD(FUJITSU, WL110),
  142         PCMCIA_CARD(LUCENT, WAVELAN_IEEE),
  143         PCMCIA_CARD(MICROSOFT, MN_520),
  144         PCMCIA_CARD(NOKIA, C020_WLAN),
  145         PCMCIA_CARD(NOKIA, C110_WLAN),
  146         PCMCIA_CARD(PLANEX, GWNS11H),
  147         PCMCIA_CARD(PROXIM, HARMONY),
  148         PCMCIA_CARD(PROXIM, RANGELANDS_8430),
  149         PCMCIA_CARD(SAMSUNG, SWL_2000N),
  150         PCMCIA_CARD(SIEMENS, SS1021),
  151         PCMCIA_CARD(SIEMENS, SS1021A),
  152         PCMCIA_CARD(SIMPLETECH, SPECTRUM24_ALT),
  153         PCMCIA_CARD(SOCKET, LP_WLAN_CF),
  154         PCMCIA_CARD(TDK, LAK_CD011WL),
  155         { NULL }
  156 };
  157 PCCARD_PNP_INFO(wi_pccard_products);
  158 
  159 static int
  160 wi_pccard_probe(device_t dev)
  161 {
  162         const struct pccard_product *pp;
  163         u_int32_t fcn = PCCARD_FUNCTION_UNSPEC;
  164         int error;
  165 
  166         /* Make sure we're a network driver */
  167         error = pccard_get_function(dev, &fcn);
  168         if (error != 0)
  169                 return error;
  170         if (fcn != PCCARD_FUNCTION_NETWORK)
  171                 return ENXIO;
  172 
  173         pp = pccard_product_lookup(dev, wi_pccard_products,
  174             sizeof(wi_pccard_products[0]), NULL);
  175         if (pp != NULL) {
  176                 if (pp->pp_name != NULL)
  177                         device_set_desc(dev, pp->pp_name);
  178                 return 0;
  179         }
  180         return ENXIO;
  181 }
  182 
  183 static int
  184 wi_pccard_attach(device_t dev)
  185 {
  186         struct wi_softc *sc;
  187         int error;
  188 
  189         sc = device_get_softc(dev);
  190         sc->wi_gone = 0;
  191         sc->wi_bus_type = WI_BUS_PCCARD;
  192 
  193         error = wi_alloc(dev, 0);
  194         if (error == 0) {
  195                 /* Make sure interrupts are disabled. */
  196                 CSR_WRITE_2(sc, WI_INT_EN, 0);
  197                 CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
  198 
  199                 error = wi_attach(dev);
  200                 if (error != 0)
  201                         wi_free(dev);
  202                 gone_in_dev(dev, 13, "pccard removed, wi doesn't support modern crypto");
  203         }
  204         return error;
  205 }

Cache object: d0ec513e2374cca4e299bd0b160bb919


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