From b1f0134f292ecfbb3edb75d1fd8c80d0247cfb1a Mon Sep 17 00:00:00 2001 From: millert Date: Mon, 10 Apr 2000 13:55:01 +0000 Subject: [PATCH] Aironet PCI shim; all the real meat is in sys/ic/an.c. Based on the FreeBSD if_an_pci.c but really the only things that remain the same are the informative comments at the top. I retained Bill Paul's Copyright since it seems silly to add my own copyright to what is simply boilerplate. --- sys/arch/i386/conf/GENERIC | 3 +- sys/dev/pci/files.pci | 7 +- sys/dev/pci/if_an_pci.c | 160 +++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+), 2 deletions(-) create mode 100644 sys/dev/pci/if_an_pci.c diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index d1d635cbfa4..546e1399588 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.175 2000/04/08 05:50:49 aaron Exp $ +# $OpenBSD: GENERIC,v 1.176 2000/04/10 13:55:01 millert Exp $ # $NetBSD: GENERIC,v 1.48 1996/05/20 18:17:23 mrg Exp $ # # GENERIC -- everything that's currently supported @@ -284,6 +284,7 @@ wx* at pci? dev ? function ? # Intel Pro/1000 ethernet # Wireless network cards wi* at pcmcia? function ? # WaveLAN IEEE 802.11DS #awi* at pcmcia? function ? # Bay Networks IEEE 802.11FH +an* at pci? dev ? function ? # Aironet IEEE 802.11DS an* at pcmcia? function ? # Aironet IEEE 802.11DS #cnw* at pcmcia? function ? # Xircom Netwave ray* at pcmcia? function ? # Raylink Aviator2.4/Pro 802.11FH diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci index a60e99daeef..720f5844cb6 100644 --- a/sys/dev/pci/files.pci +++ b/sys/dev/pci/files.pci @@ -1,4 +1,4 @@ -# $OpenBSD: files.pci,v 1.68 2000/04/08 05:50:51 aaron Exp $ +# $OpenBSD: files.pci,v 1.69 2000/04/10 13:55:01 millert Exp $ # $NetBSD: files.pci,v 1.20 1996/09/24 17:47:15 christos Exp $ # # Config file and device description for machine-independent PCI code. @@ -245,3 +245,8 @@ device puc { port = -1 } attach puc at pci file dev/pci/puc.c puc file dev/pci/pucdata.c puc + +# Aironet 4500/4800 802.11 DS WLAN +# device declaration in sys/conf/files +attach an at pci with an_pci +file dev/pci/if_an_pci.c an_pci diff --git a/sys/dev/pci/if_an_pci.c b/sys/dev/pci/if_an_pci.c new file mode 100644 index 00000000000..0d41060c631 --- /dev/null +++ b/sys/dev/pci/if_an_pci.c @@ -0,0 +1,160 @@ +/* $OpenBSD: if_an_pci.c,v 1.1 2000/04/10 13:55:01 millert Exp $ */ + +/* + * Copyright (c) 1997, 1998, 1999 + * Bill Paul . All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Bill Paul. + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/sys/dev/an/if_an_pci.c,v 1.1 2000/01/14 20:40:56 wpaul Exp $ + */ + +/* + * This is a PCI shim for the Aironet PC4500/4800 wireless network + * driver. Aironet makes PCMCIA, ISA and PCI versions of these devices, + * which all have basically the same interface. The ISA and PCI cards + * are actually bridge adapters with PCMCIA cards inserted into them, + * however they appear as normal PCI or ISA devices to the host. + * + * All we do here is handle the PCI match and attach and set up an + * interrupt handler entry point. The PCI version of the card uses + * a PLX 9050 PCI to "dumb bus" bridge chip, which provides us with + * multiple PCI address space mappings. The primary mapping at PCI + * register 0x14 is for the PLX chip itself, *NOT* the Aironet card. + * The I/O address of the Aironet is actually at register 0x18, which + * is the local bus mapping register for bus space 0. There are also + * registers for additional register spaces at registers 0x1C and + * 0x20, but these are unused in the Aironet devices. To find out + * more, you need a datasheet for the 9050 from PLX, but you have + * to go through their sales office to get it. Bleh. + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#define AN_PCI_PLX_LOIO 0x14 /* PLX chip iobase */ +#define AN_PCI_LOIO 0x18 /* Aironet iobase */ + +int an_pci_match __P((struct device *, void *, void *)); +void an_pci_attach __P((struct device *, struct device *, void *)); + +struct cfattach an_pci_ca = { + sizeof (struct an_softc), an_pci_match, an_pci_attach +}; + +int +an_pci_match(parent, match, aux) + struct device *parent; + void *match; + void *aux; +{ + struct pci_attach_args *pa = aux; + + if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_AIRONET && + (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_AIRONET_PC4500 || + PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_AIRONET_PC4800)) + return(1); + + return(0); +} + +void +an_pci_attach(parent, self, aux) + struct device *parent; + struct device *self; + void *aux; +{ + struct an_softc *sc = (struct an_softc *)self; + struct pci_attach_args *pa = aux; + pci_intr_handle_t ih; + bus_addr_t iobase; + bus_size_t iosize; + bus_space_handle_t ioh; + bus_space_tag_t iot = pa->pa_iot; + pci_chipset_tag_t pc = pa->pa_pc; + pcireg_t csr; + const char *intrstr; + + /* Map the I/O ports (note that non-standard location). */ + if (pci_io_find(pc, pa->pa_tag, AN_PCI_LOIO, &iobase, &iosize)) { + printf(": can't find I/O base\n"); + return; + } + if (bus_space_map(iot, iobase, iosize, 0, &ioh)) { + printf(": can't map I/O space\n"); + return; + } + + sc->an_btag = iot; + sc->an_bhandle = ioh; + + /* Enable the card. */ + csr = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG); + pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, + csr | PCI_COMMAND_MASTER_ENABLE); + + /* Map and establish the interrupt. */ + if (pci_intr_map(pc, pa->pa_intrtag, pa->pa_intrpin, + pa->pa_intrline, &ih)) { + printf("\n%s: couldn't map interrupt\n", sc->sc_dev.dv_xname); + return; + } + intrstr = pci_intr_string(pc, ih); + sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, an_intr, sc, + sc->sc_dev.dv_xname); + if (sc->sc_ih == NULL) { + printf("\n%s: couldn't establish interrupt", + sc->sc_dev.dv_xname); + if (intrstr != NULL) + printf(" at %s", intrstr); + printf("\n"); + return; + } + printf(": %s", intrstr); + + an_attach(sc); +} -- 2.20.1