Deleted Added
full compact
if_an_pci.c (81221) if_an_pci.c (83270)
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

--- 15 unchanged lines hidden (view full) ---

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.
31 *
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

--- 15 unchanged lines hidden (view full) ---

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.
31 *
32 * $FreeBSD: head/sys/dev/an/if_an_pci.c 81221 2001-08-06 23:14:16Z brooks $
32 * $FreeBSD: head/sys/dev/an/if_an_pci.c 83270 2001-09-10 02:36:18Z brooks $
33 */
34
35/*
36 * This is a PCI shim for the Aironet PC4500/4800 wireless network
37 * driver. Aironet makes PCMCIA, ISA and PCI versions of these devices,
38 * which all have basically the same interface. The ISA and PCI cards
39 * are actually bridge adapters with PCMCIA cards inserted into them,
40 * however they appear as normal PCI or ISA devices to the host.

--- 37 unchanged lines hidden (view full) ---

78#include <net/if_dl.h>
79#include <net/if_media.h>
80
81#include <pci/pcireg.h>
82#include <pci/pcivar.h>
83
84#ifndef lint
85static const char rcsid[] =
33 */
34
35/*
36 * This is a PCI shim for the Aironet PC4500/4800 wireless network
37 * driver. Aironet makes PCMCIA, ISA and PCI versions of these devices,
38 * which all have basically the same interface. The ISA and PCI cards
39 * are actually bridge adapters with PCMCIA cards inserted into them,
40 * however they appear as normal PCI or ISA devices to the host.

--- 37 unchanged lines hidden (view full) ---

78#include <net/if_dl.h>
79#include <net/if_media.h>
80
81#include <pci/pcireg.h>
82#include <pci/pcivar.h>
83
84#ifndef lint
85static const char rcsid[] =
86 "$FreeBSD: head/sys/dev/an/if_an_pci.c 81221 2001-08-06 23:14:16Z brooks $";
86 "$FreeBSD: head/sys/dev/an/if_an_pci.c 83270 2001-09-10 02:36:18Z brooks $";
87#endif
88
89#include <dev/an/if_aironet_ieee.h>
90#include <dev/an/if_anreg.h>
91
92struct an_type {
93 u_int16_t an_vid;
94 u_int16_t an_did;

--- 15 unchanged lines hidden (view full) ---

110 { AIRONET_VENDORID, AIRONET_DEVICEID_4xxx, "Aironet PCI4500/PCI4800" },
111 { 0, 0, NULL }
112};
113
114static int an_probe_pci __P((device_t));
115static int an_attach_pci __P((device_t));
116static int an_detach_pci __P((device_t));
117
87#endif
88
89#include <dev/an/if_aironet_ieee.h>
90#include <dev/an/if_anreg.h>
91
92struct an_type {
93 u_int16_t an_vid;
94 u_int16_t an_did;

--- 15 unchanged lines hidden (view full) ---

110 { AIRONET_VENDORID, AIRONET_DEVICEID_4xxx, "Aironet PCI4500/PCI4800" },
111 { 0, 0, NULL }
112};
113
114static int an_probe_pci __P((device_t));
115static int an_attach_pci __P((device_t));
116static int an_detach_pci __P((device_t));
117
118static int an_probe_pci(device_t dev)
118static int
119an_probe_pci(device_t dev)
119{
120 struct an_type *t;
121
122 t = an_devs;
123
120{
121 struct an_type *t;
122
123 t = an_devs;
124
124 while(t->an_name != NULL) {
125 while (t->an_name != NULL) {
125 if (pci_get_vendor(dev) == t->an_vid &&
126 pci_get_device(dev) == t->an_did) {
127 device_set_desc(dev, t->an_name);
128 return(0);
129 }
130 t++;
131 }
132
133 return(ENXIO);
134}
135
126 if (pci_get_vendor(dev) == t->an_vid &&
127 pci_get_device(dev) == t->an_did) {
128 device_set_desc(dev, t->an_name);
129 return(0);
130 }
131 t++;
132 }
133
134 return(ENXIO);
135}
136
136static int an_attach_pci(dev)
137static int
138an_attach_pci(dev)
137 device_t dev;
138{
139 u_int32_t command;
140 struct an_softc *sc;
141 int unit, flags, error = 0;
142
143 sc = device_get_softc(dev);
144 unit = device_get_unit(dev);
145 flags = device_get_flags(dev);
146 bzero(sc, sizeof(struct an_softc));
139 device_t dev;
140{
141 u_int32_t command;
142 struct an_softc *sc;
143 int unit, flags, error = 0;
144
145 sc = device_get_softc(dev);
146 unit = device_get_unit(dev);
147 flags = device_get_flags(dev);
148 bzero(sc, sizeof(struct an_softc));
147
149
148 /*
149 * Map control/status registers.
150 */
151 command = pci_read_config(dev, PCIR_COMMAND, 4);
152 command |= PCIM_CMD_PORTEN;
153 pci_write_config(dev, PCIR_COMMAND, command, 4);
154 command = pci_read_config(dev, PCIR_COMMAND, 4);
155

--- 15 unchanged lines hidden (view full) ---

171 sc->an_bhandle = rman_get_bushandle(sc->port_res);
172
173 /* Allocate interrupt */
174 error = an_alloc_irq(dev, 0, RF_SHAREABLE);
175 if (error) {
176 an_release_resources(dev);
177 goto fail;
178 }
150 /*
151 * Map control/status registers.
152 */
153 command = pci_read_config(dev, PCIR_COMMAND, 4);
154 command |= PCIM_CMD_PORTEN;
155 pci_write_config(dev, PCIR_COMMAND, command, 4);
156 command = pci_read_config(dev, PCIR_COMMAND, 4);
157

--- 15 unchanged lines hidden (view full) ---

173 sc->an_bhandle = rman_get_bushandle(sc->port_res);
174
175 /* Allocate interrupt */
176 error = an_alloc_irq(dev, 0, RF_SHAREABLE);
177 if (error) {
178 an_release_resources(dev);
179 goto fail;
180 }
179
181
180 error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET,
181 an_intr, sc, &sc->irq_handle);
182 if (error) {
183 an_release_resources(dev);
184 goto fail;
185 }
186
187 sc->an_dev = dev;
188 error = an_attach(sc, device_get_unit(dev), flags);
189
190fail:
191 return(error);
192}
193
182 error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET,
183 an_intr, sc, &sc->irq_handle);
184 if (error) {
185 an_release_resources(dev);
186 goto fail;
187 }
188
189 sc->an_dev = dev;
190 error = an_attach(sc, device_get_unit(dev), flags);
191
192fail:
193 return(error);
194}
195
194static int
196static int
195an_detach_pci(device_t dev)
196{
197 struct an_softc *sc = device_get_softc(dev);
198 struct ifnet *ifp = &sc->arpcom.ac_if;
199
200 an_stop(sc);
201 ifmedia_removeall(&sc->an_ifmedia);
202 ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);

--- 24 unchanged lines hidden ---
197an_detach_pci(device_t dev)
198{
199 struct an_softc *sc = device_get_softc(dev);
200 struct ifnet *ifp = &sc->arpcom.ac_if;
201
202 an_stop(sc);
203 ifmedia_removeall(&sc->an_ifmedia);
204 ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);

--- 24 unchanged lines hidden ---