2 * Copyright (c) 2013 Justin Hibbits
4 * Copyright (c) 1997, 1998, 1999
5 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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.
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.
36 * Lucent WaveLAN/IEEE 802.11 MacIO attachment for FreeBSD.
38 * Based on the PCMCIA driver
39 * Written by Bill Paul <wpaul@ctr.columbia.edu>
40 * Electrical Engineering Department
41 * Columbia University, New York City
44 #include <sys/cdefs.h>
45 __FBSDID("$FreeBSD$");
47 #include <sys/param.h>
48 #include <sys/kernel.h>
49 #include <sys/socket.h>
50 #include <sys/systm.h>
51 #include <sys/module.h>
54 #include <machine/bus.h>
55 #include <machine/resource.h>
58 #include <dev/ofw/ofw_bus.h>
59 #include <dev/ofw/openfirm.h>
60 #include <machine/ofw_machdep.h>
63 #include <net/if_arp.h>
64 #include <net/ethernet.h>
65 #include <net/if_dl.h>
66 #include <net/if_media.h>
67 #include <net/if_types.h>
69 #include <net80211/ieee80211_var.h>
70 #include <net80211/ieee80211_radiotap.h>
72 #include <dev/wi/if_wavelan_ieee.h>
73 #include <dev/wi/if_wireg.h>
74 #include <dev/wi/if_wivar.h>
76 static int wi_macio_probe(device_t);
77 static int wi_macio_attach(device_t);
79 static device_method_t wi_macio_methods[] = {
80 /* Device interface */
81 DEVMETHOD(device_probe, wi_macio_probe),
82 DEVMETHOD(device_attach, wi_macio_attach),
83 DEVMETHOD(device_detach, wi_detach),
84 DEVMETHOD(device_shutdown, wi_shutdown),
89 static driver_t wi_macio_driver = {
92 sizeof(struct wi_softc)
95 DRIVER_MODULE(wi, macio, wi_macio_driver, wi_devclass, 0, 0);
96 MODULE_DEPEND(wi, wlan, 1, 1, 1);
99 wi_macio_probe(device_t dev)
101 const char *name, *compat;
103 /* Make sure we're a network driver */
104 name = ofw_bus_get_name(dev);
108 if (strcmp(name, "radio") != 0) {
111 compat = ofw_bus_get_compat(dev);
112 if (strcmp(compat, "wireless") != 0) {
116 device_set_desc(dev, "Apple Airport");
121 wi_macio_attach(device_t dev)
126 sc = device_get_softc(dev);
130 error = wi_alloc(dev, 0);
132 /* Make sure interrupts are disabled. */
133 CSR_WRITE_2(sc, WI_INT_EN, 0);
134 CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
136 error = wi_attach(dev);