if_an_pci.c (232854) | if_an_pci.c (254263) |
---|---|
1/*- 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 --- 17 unchanged lines hidden (view full) --- 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. 31 */ 32 33#include <sys/cdefs.h> | 1/*- 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 --- 17 unchanged lines hidden (view full) --- 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. 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/dev/an/if_an_pci.c 232854 2012-03-12 08:03:51Z scottl $"); | 34__FBSDID("$FreeBSD: head/sys/dev/an/if_an_pci.c 254263 2013-08-12 23:30:01Z scottl $"); |
35 36/* 37 * This is a PCI shim for the Aironet PC4500/4800 wireless network 38 * driver. Aironet makes PCMCIA, ISA and PCI versions of these devices, 39 * which all have basically the same interface. The ISA and PCI cards 40 * are actually bridge adapters with PCMCIA cards inserted into them, 41 * however they appear as normal PCI or ISA devices to the host. 42 * --- 93 unchanged lines hidden (view full) --- 136 137 return(ENXIO); 138} 139 140static int 141an_attach_pci(dev) 142 device_t dev; 143{ | 35 36/* 37 * This is a PCI shim for the Aironet PC4500/4800 wireless network 38 * driver. Aironet makes PCMCIA, ISA and PCI versions of these devices, 39 * which all have basically the same interface. The ISA and PCI cards 40 * are actually bridge adapters with PCMCIA cards inserted into them, 41 * however they appear as normal PCI or ISA devices to the host. 42 * --- 93 unchanged lines hidden (view full) --- 136 137 return(ENXIO); 138} 139 140static int 141an_attach_pci(dev) 142 device_t dev; 143{ |
144 u_int32_t command; | |
145 struct an_softc *sc; 146 int flags, error = 0; 147 148 sc = device_get_softc(dev); 149 flags = device_get_flags(dev); 150 151 if (pci_get_vendor(dev) == AIRONET_VENDORID && 152 pci_get_device(dev) == AIRONET_DEVICEID_MPI350) { 153 sc->mpi350 = 1; 154 sc->port_rid = PCIR_BAR(0); 155 } else { | 144 struct an_softc *sc; 145 int flags, error = 0; 146 147 sc = device_get_softc(dev); 148 flags = device_get_flags(dev); 149 150 if (pci_get_vendor(dev) == AIRONET_VENDORID && 151 pci_get_device(dev) == AIRONET_DEVICEID_MPI350) { 152 sc->mpi350 = 1; 153 sc->port_rid = PCIR_BAR(0); 154 } else { |
156 /* 157 * Map control/status registers. 158 */ 159 command = pci_read_config(dev, PCIR_COMMAND, 4); 160 command |= PCIM_CMD_PORTEN; 161 pci_write_config(dev, PCIR_COMMAND, command, 4); 162 command = pci_read_config(dev, PCIR_COMMAND, 4); 163 164 if (!(command & PCIM_CMD_PORTEN)) { 165 device_printf(dev, "failed to enable I/O ports!\n"); 166 error = ENXIO; 167 goto fail; 168 } | |
169 sc->port_rid = AN_PCI_LOIO; 170 } 171 error = an_alloc_port(dev, sc->port_rid, 1); 172 173 if (error) { 174 device_printf(dev, "couldn't map ports\n"); 175 goto fail; 176 } --- 105 unchanged lines hidden --- | 155 sc->port_rid = AN_PCI_LOIO; 156 } 157 error = an_alloc_port(dev, sc->port_rid, 1); 158 159 if (error) { 160 device_printf(dev, "couldn't map ports\n"); 161 goto fail; 162 } --- 105 unchanged lines hidden --- |