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