10SN/A/*- 2157SN/A * Copyright (c) 1997, 1998, 1999 30SN/A * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 40SN/A * 50SN/A * Redistribution and use in source and binary forms, with or without 60SN/A * modification, are permitted provided that the following conditions 7157SN/A * are met: 80SN/A * 1. Redistributions of source code must retain the above copyright 9157SN/A * notice, this list of conditions and the following disclaimer. 100SN/A * 2. Redistributions in binary form must reproduce the above copyright 110SN/A * notice, this list of conditions and the following disclaimer in the 120SN/A * documentation and/or other materials provided with the distribution. 130SN/A * 3. All advertising materials mentioning features or use of this software 140SN/A * must display the following acknowledgement: 150SN/A * This product includes software developed by Bill Paul. 160SN/A * 4. Neither the name of the author nor the names of any co-contributors 170SN/A * may be used to endorse or promote products derived from this software 180SN/A * without specific prior written permission. 190SN/A * 200SN/A * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 21157SN/A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22157SN/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23157SN/A * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 240SN/A * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 250SN/A * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 260SN/A * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 270SN/A * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 280SN/A * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 290SN/A * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 300SN/A * THE POSSIBILITY OF SUCH DAMAGE. 310SN/A */ 320SN/A/* 330SN/A * Aironet 4500/4800 802.11 PCMCIA/ISA/PCI driver for FreeBSD. 340SN/A * 350SN/A * Written by Bill Paul <wpaul@ctr.columbia.edu> 360SN/A * Electrical Engineering Department 370SN/A * Columbia University, New York City 380SN/A */ 390SN/A 400SN/A#include <sys/cdefs.h> 410SN/A__FBSDID("$FreeBSD$"); 420SN/A 430SN/A#include "opt_inet.h" 440SN/A 450SN/A#ifdef INET 460SN/A#define ANCACHE 470SN/A#endif 480SN/A 490SN/A#include <sys/param.h> 500SN/A#include <sys/systm.h> 510SN/A#include <sys/sockio.h> 520SN/A#include <sys/mbuf.h> 530SN/A#include <sys/kernel.h> 540SN/A#include <sys/socket.h> 550SN/A 560SN/A#include <sys/module.h> 570SN/A#include <sys/bus.h> 580SN/A#include <machine/bus.h> 590SN/A#include <sys/rman.h> 600SN/A#include <machine/resource.h> 610SN/A 620SN/A#include <net/if.h> 630SN/A#include <net/if_arp.h> 640SN/A#include <net/ethernet.h> 650SN/A#include <net/if_dl.h> 660SN/A#include <net/if_types.h> 670SN/A#include <net/if_media.h> 680SN/A 690SN/A#include <isa/isavar.h> 700SN/A#include <isa/pnpvar.h> 710SN/A 720SN/A#include <dev/an/if_aironet_ieee.h> 730SN/A#include <dev/an/if_anreg.h> 740SN/A 750SN/Astatic struct isa_pnp_id an_ids[] = { 760SN/A { 0x0100ec06, "Aironet ISA4500/ISA4800" }, 770SN/A { 0, NULL } 780SN/A}; 790SN/A 800SN/Astatic int an_probe_isa(device_t); 810SN/Astatic int an_attach_isa(device_t); 820SN/A 830SN/Astatic int 840SN/Aan_probe_isa(device_t dev) 850SN/A{ 860SN/A int error = 0; 870SN/A 880SN/A error = ISA_PNP_PROBE(device_get_parent(dev), dev, an_ids); 890SN/A if (error == ENXIO) 900SN/A return(error); 910SN/A 920SN/A error = an_probe(dev); 930SN/A an_release_resources(dev); 940SN/A if (error == 0) 950SN/A return (ENXIO); 960SN/A 970SN/A error = an_alloc_irq(dev, 0, 0); 980SN/A an_release_resources(dev); 990SN/A if (!error) 1000SN/A device_set_desc(dev, "Aironet ISA4500/ISA4800"); 1010SN/A return (error); 1020SN/A} 1030SN/A 1040SN/Astatic int 1050SN/Aan_attach_isa(device_t dev) 1060SN/A{ 1070SN/A struct an_softc *sc = device_get_softc(dev); 1080SN/A int flags = device_get_flags(dev); 1090SN/A int error; 1100SN/A 1110SN/A an_alloc_port(dev, sc->port_rid, 1); 1120SN/A an_alloc_irq(dev, sc->irq_rid, 0); 1130SN/A 1140SN/A sc->an_dev = dev; 1150SN/A 1160SN/A error = an_attach(sc, flags); 1170SN/A if (error) { 1180SN/A an_release_resources(dev); 1190SN/A return (error); 1200SN/A } 1210SN/A 1220SN/A error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET, 1230SN/A NULL, an_intr, sc, &sc->irq_handle); 1240SN/A if (error) { 1250SN/A an_release_resources(dev); 1260SN/A return (error); 1270SN/A } 1280SN/A return (0); 1290SN/A} 1300SN/A 1310SN/Astatic device_method_t an_isa_methods[] = { 1320SN/A /* Device interface */ 1330SN/A DEVMETHOD(device_probe, an_probe_isa), 1340SN/A DEVMETHOD(device_attach, an_attach_isa), 1350SN/A DEVMETHOD(device_detach, an_detach), 1360SN/A DEVMETHOD(device_shutdown, an_shutdown), 1370SN/A { 0, 0 } 1380SN/A}; 1390SN/A 1400SN/Astatic driver_t an_isa_driver = { 1410SN/A "an", 1420SN/A an_isa_methods, 1430SN/A sizeof(struct an_softc) 1440SN/A}; 1450SN/A 1460SN/Astatic devclass_t an_isa_devclass; 1470SN/A 1480SN/ADRIVER_MODULE(an, isa, an_isa_driver, an_isa_devclass, 0, 0); 1490SN/AMODULE_DEPEND(an, isa, 1, 1, 1); 1500SN/AMODULE_DEPEND(an, wlan, 1, 1, 1); 1510SN/A