Deleted Added
full compact
if_ndis.c (123537) if_ndis.c (123620)
1/*
2 * Copyright (c) 2003
3 * Bill Paul <wpaul@windriver.com>. 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) 2003
3 * Bill Paul <wpaul@windriver.com>. 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/if_ndis/if_ndis.c 123537 2003-12-14 22:47:01Z wpaul $");
34__FBSDID("$FreeBSD: head/sys/dev/if_ndis/if_ndis.c 123620 2003-12-18 03:51:21Z wpaul $");
35
36#include "opt_bdg.h"
37
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/sockio.h>
41#include <sys/mbuf.h>
42#include <sys/malloc.h>

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

80/*
81 * Various supported device vendors/types and their names.
82 * These are defined in the ndis_driver_data.h file.
83 */
84static struct ndis_type ndis_devs[] = {
85#ifdef NDIS_DEV_TABLE
86 NDIS_DEV_TABLE
87#endif
35
36#include "opt_bdg.h"
37
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/sockio.h>
41#include <sys/mbuf.h>
42#include <sys/malloc.h>

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

80/*
81 * Various supported device vendors/types and their names.
82 * These are defined in the ndis_driver_data.h file.
83 */
84static struct ndis_type ndis_devs[] = {
85#ifdef NDIS_DEV_TABLE
86 NDIS_DEV_TABLE
87#endif
88 { 0, 0, NULL }
88 { 0, 0, 0, NULL }
89};
90
91#define __stdcall __attribute__((__stdcall__))
92
93static int ndis_probe (device_t);
94static int ndis_attach (device_t);
95static int ndis_detach (device_t);
96

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

173 device_t dev;
174{
175 struct ndis_type *t;
176
177 t = ndis_devs;
178
179 while(t->ndis_name != NULL) {
180 if ((pci_get_vendor(dev) == t->ndis_vid) &&
89};
90
91#define __stdcall __attribute__((__stdcall__))
92
93static int ndis_probe (device_t);
94static int ndis_attach (device_t);
95static int ndis_detach (device_t);
96

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

173 device_t dev;
174{
175 struct ndis_type *t;
176
177 t = ndis_devs;
178
179 while(t->ndis_name != NULL) {
180 if ((pci_get_vendor(dev) == t->ndis_vid) &&
181 (pci_get_device(dev) == t->ndis_did)) {
181 (pci_get_device(dev) == t->ndis_did) &&
182 (pci_read_config(dev, PCIR_SUBVEND_0, 4) ==
183 t->ndis_subsys)) {
182 device_set_desc(dev, t->ndis_name);
183 return(0);
184 }
185 t++;
186 }
187
188 return(ENXIO);
189}

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

196ndis_attach(dev)
197 device_t dev;
198{
199 u_char eaddr[ETHER_ADDR_LEN];
200 struct ndis_softc *sc;
201 struct ifnet *ifp;
202 int unit, error = 0, rid, len;
203 void *img;
184 device_set_desc(dev, t->ndis_name);
185 return(0);
186 }
187 t++;
188 }
189
190 return(ENXIO);
191}

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

198ndis_attach(dev)
199 device_t dev;
200{
201 u_char eaddr[ETHER_ADDR_LEN];
202 struct ndis_softc *sc;
203 struct ifnet *ifp;
204 int unit, error = 0, rid, len;
205 void *img;
206 struct ndis_type *t;
207 int devidx = 0, defidx = 0;
204
208
209
205 sc = device_get_softc(dev);
206 unit = device_get_unit(dev);
207
208 mtx_init(&sc->ndis_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
209 MTX_DEF | MTX_RECURSE);
210
211 /*
212 * Map control/status registers.

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

292 if (error)
293 goto fail;
294
295 img = drv_data;
296 sc->ndis_dev = dev;
297 sc->ndis_regvals = ndis_regvals;
298 sc->ndis_iftype = PCIBus;
299
210 sc = device_get_softc(dev);
211 unit = device_get_unit(dev);
212
213 mtx_init(&sc->ndis_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
214 MTX_DEF | MTX_RECURSE);
215
216 /*
217 * Map control/status registers.

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

297 if (error)
298 goto fail;
299
300 img = drv_data;
301 sc->ndis_dev = dev;
302 sc->ndis_regvals = ndis_regvals;
303 sc->ndis_iftype = PCIBus;
304
305 /* Figure out exactly which device we matched. */
306
307 t = ndis_devs;
308
309 while(t->ndis_name != NULL) {
310 if ((pci_get_vendor(dev) == t->ndis_vid) &&
311 (pci_get_device(dev) == t->ndis_did)) {
312 if (t->ndis_subsys == 0)
313 defidx = devidx;
314 else {
315 if (t->ndis_subsys ==
316 pci_read_config(dev, PCIR_SUBVEND_0, 4))
317 break;
318 }
319 }
320 t++;
321 devidx++;
322 }
323
324 if (ndis_devs[devidx].ndis_name == NULL)
325 sc->ndis_devidx = defidx;
326 else
327 sc->ndis_devidx = devidx;
328
300 sysctl_ctx_init(&sc->ndis_ctx);
301
302 /* Create sysctl registry nodes */
303 ndis_create_sysctls(sc);
304
305 /* Set up driver image in memory. */
306 ndis_load_driver((vm_offset_t)img, sc);
307

--- 659 unchanged lines hidden ---
329 sysctl_ctx_init(&sc->ndis_ctx);
330
331 /* Create sysctl registry nodes */
332 ndis_create_sysctls(sc);
333
334 /* Set up driver image in memory. */
335 ndis_load_driver((vm_offset_t)img, sc);
336

--- 659 unchanged lines hidden ---