kern_ndis.c (189004) | kern_ndis.c (189488) |
---|---|
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/compat/ndis/kern_ndis.c 189004 2009-02-24 18:09:31Z rdivacky $"); | 34__FBSDID("$FreeBSD: head/sys/compat/ndis/kern_ndis.c 189488 2009-03-07 07:26:22Z weongyo $"); |
35 36#include <sys/param.h> 37#include <sys/systm.h> 38#include <sys/unistd.h> 39#include <sys/types.h> 40#include <sys/errno.h> 41#include <sys/callout.h> 42#include <sys/socket.h> --- 17 unchanged lines hidden (view full) --- 60#include <net/if_arp.h> 61#include <net/ethernet.h> 62#include <net/if_dl.h> 63#include <net/if_media.h> 64 65#include <net80211/ieee80211_var.h> 66#include <net80211/ieee80211_ioctl.h> 67 | 35 36#include <sys/param.h> 37#include <sys/systm.h> 38#include <sys/unistd.h> 39#include <sys/types.h> 40#include <sys/errno.h> 41#include <sys/callout.h> 42#include <sys/socket.h> --- 17 unchanged lines hidden (view full) --- 60#include <net/if_arp.h> 61#include <net/ethernet.h> 62#include <net/if_dl.h> 63#include <net/if_media.h> 64 65#include <net80211/ieee80211_var.h> 66#include <net80211/ieee80211_ioctl.h> 67 |
68#include <legacy/dev/usb/usb.h> 69#include <legacy/dev/usb/usbdi.h> | 68#include 69#include <dev/usb/usb_core.h> |
70 71#include <compat/ndis/pe_var.h> 72#include <compat/ndis/cfg_var.h> 73#include <compat/ndis/resource_var.h> 74#include <compat/ndis/ntoskrnl_var.h> 75#include <compat/ndis/ndis_var.h> 76#include <compat/ndis/hal_var.h> 77#include <compat/ndis/usbd_var.h> --- 239 unchanged lines hidden (view full) --- 317 /* See if we already have a sysctl with this name */ 318 319 oidp = NULL; 320#if __FreeBSD_version < 502113 321 TAILQ_FOREACH(e, &sc->ndis_ctx, link) { 322#else 323 TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) { 324#endif | 70 71#include <compat/ndis/pe_var.h> 72#include <compat/ndis/cfg_var.h> 73#include <compat/ndis/resource_var.h> 74#include <compat/ndis/ntoskrnl_var.h> 75#include <compat/ndis/ndis_var.h> 76#include <compat/ndis/hal_var.h> 77#include <compat/ndis/usbd_var.h> --- 239 unchanged lines hidden (view full) --- 317 /* See if we already have a sysctl with this name */ 318 319 oidp = NULL; 320#if __FreeBSD_version < 502113 321 TAILQ_FOREACH(e, &sc->ndis_ctx, link) { 322#else 323 TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) { 324#endif |
325 oidp = e->entry; | 325 oidp = e->entry; |
326 if (strcasecmp(oidp->oid_name, vals->nc_cfgkey) == 0) 327 break; 328 oidp = NULL; 329 } 330 331 if (oidp != NULL) { 332 vals++; 333 continue; --- 232 unchanged lines hidden (view full) --- 566 ndis_miniport_block *block; 567 device_t dev; 568 struct resource_list *brl; 569 struct resource_list_entry *brle; 570#if __FreeBSD_version < 600022 571 struct resource_list brl_rev; 572 struct resource_list_entry *n; 573#endif | 326 if (strcasecmp(oidp->oid_name, vals->nc_cfgkey) == 0) 327 break; 328 oidp = NULL; 329 } 330 331 if (oidp != NULL) { 332 vals++; 333 continue; --- 232 unchanged lines hidden (view full) --- 566 ndis_miniport_block *block; 567 device_t dev; 568 struct resource_list *brl; 569 struct resource_list_entry *brle; 570#if __FreeBSD_version < 600022 571 struct resource_list brl_rev; 572 struct resource_list_entry *n; 573#endif |
574 int error = 0; | 574 int error = 0; |
575 576 sc = arg; 577 block = sc->ndis_block; 578 dev = sc->ndis_dev; 579 580#if __FreeBSD_version < 600022 581 SLIST_INIT(&brl_rev); 582#endif --- 643 unchanged lines hidden (view full) --- 1226} 1227 1228int 1229ndis_init_nic(arg) 1230 void *arg; 1231{ 1232 struct ndis_softc *sc; 1233 ndis_miniport_block *block; | 575 576 sc = arg; 577 block = sc->ndis_block; 578 dev = sc->ndis_dev; 579 580#if __FreeBSD_version < 600022 581 SLIST_INIT(&brl_rev); 582#endif --- 643 unchanged lines hidden (view full) --- 1226} 1227 1228int 1229ndis_init_nic(arg) 1230 void *arg; 1231{ 1232 struct ndis_softc *sc; 1233 ndis_miniport_block *block; |
1234 ndis_init_handler initfunc; | 1234 ndis_init_handler initfunc; |
1235 ndis_status status, openstatus = 0; 1236 ndis_medium mediumarray[NdisMediumMax]; 1237 uint32_t chosenmedium, i; 1238 1239 if (arg == NULL) 1240 return(EINVAL); 1241 1242 sc = arg; 1243 NDIS_LOCK(sc); 1244 block = sc->ndis_block; 1245 initfunc = sc->ndis_chars->nmc_init_func; 1246 NDIS_UNLOCK(sc); 1247 1248 sc->ndis_block->nmb_timerlist = NULL; 1249 1250 for (i = 0; i < NdisMediumMax; i++) 1251 mediumarray[i] = i; 1252 | 1235 ndis_status status, openstatus = 0; 1236 ndis_medium mediumarray[NdisMediumMax]; 1237 uint32_t chosenmedium, i; 1238 1239 if (arg == NULL) 1240 return(EINVAL); 1241 1242 sc = arg; 1243 NDIS_LOCK(sc); 1244 block = sc->ndis_block; 1245 initfunc = sc->ndis_chars->nmc_init_func; 1246 NDIS_UNLOCK(sc); 1247 1248 sc->ndis_block->nmb_timerlist = NULL; 1249 1250 for (i = 0; i < NdisMediumMax; i++) 1251 mediumarray[i] = i; 1252 |
1253 status = MSCALL6(initfunc, &openstatus, &chosenmedium, 1254 mediumarray, NdisMediumMax, block, block); | 1253 status = MSCALL6(initfunc, &openstatus, &chosenmedium, 1254 mediumarray, NdisMediumMax, block, block); |
1255 1256 /* 1257 * If the init fails, blow away the other exported routines 1258 * we obtained from the driver so we can't call them later. 1259 * If the init failed, none of these will work. 1260 */ 1261 if (status != NDIS_STATUS_SUCCESS) { 1262 NDIS_LOCK(sc); --- 130 unchanged lines hidden (view full) --- 1393 device_object *fdo; 1394 ndis_miniport_block *block; 1395 struct ndis_softc *sc; 1396 uint32_t status; 1397 int error; 1398 1399 sc = device_get_softc(pdo->do_devext); 1400 | 1255 1256 /* 1257 * If the init fails, blow away the other exported routines 1258 * we obtained from the driver so we can't call them later. 1259 * If the init failed, none of these will work. 1260 */ 1261 if (status != NDIS_STATUS_SUCCESS) { 1262 NDIS_LOCK(sc); --- 130 unchanged lines hidden (view full) --- 1393 device_object *fdo; 1394 ndis_miniport_block *block; 1395 struct ndis_softc *sc; 1396 uint32_t status; 1397 int error; 1398 1399 sc = device_get_softc(pdo->do_devext); 1400 |
1401 if (sc->ndis_iftype == PCMCIABus || sc->ndis_iftype == PCIBus) { | 1401 if (sc->ndis_iftype == PCMCIABus || sc->ndis_iftype == PCIBus) { |
1402 error = bus_setup_intr(sc->ndis_dev, sc->ndis_irq, 1403 INTR_TYPE_NET | INTR_MPSAFE, 1404 NULL, ntoskrnl_intr, NULL, &sc->ndis_intrhand); 1405 if (error) 1406 return(NDIS_STATUS_FAILURE); 1407 } 1408 1409 status = IoCreateDevice(drv, sizeof(ndis_miniport_block), NULL, --- 16 unchanged lines hidden (view full) --- 1426 InitializeListHead(&block->nmb_parmlist); 1427 InitializeListHead(&block->nmb_returnlist); 1428 block->nmb_returnitem = IoAllocateWorkItem(fdo); 1429 1430 /* 1431 * Stash pointers to the miniport block and miniport 1432 * characteristics info in the if_ndis softc so the 1433 * UNIX wrapper driver can get to them later. | 1402 error = bus_setup_intr(sc->ndis_dev, sc->ndis_irq, 1403 INTR_TYPE_NET | INTR_MPSAFE, 1404 NULL, ntoskrnl_intr, NULL, &sc->ndis_intrhand); 1405 if (error) 1406 return(NDIS_STATUS_FAILURE); 1407 } 1408 1409 status = IoCreateDevice(drv, sizeof(ndis_miniport_block), NULL, --- 16 unchanged lines hidden (view full) --- 1426 InitializeListHead(&block->nmb_parmlist); 1427 InitializeListHead(&block->nmb_returnlist); 1428 block->nmb_returnitem = IoAllocateWorkItem(fdo); 1429 1430 /* 1431 * Stash pointers to the miniport block and miniport 1432 * characteristics info in the if_ndis softc so the 1433 * UNIX wrapper driver can get to them later. |
1434 */ | 1434 */ |
1435 sc->ndis_block = block; 1436 sc->ndis_chars = IoGetDriverObjectExtension(drv, (void *)1); 1437 1438 /* 1439 * If the driver has a MiniportTransferData() function, 1440 * we should allocate a private RX packet pool. 1441 */ 1442 --- 60 unchanged lines hidden --- | 1435 sc->ndis_block = block; 1436 sc->ndis_chars = IoGetDriverObjectExtension(drv, (void *)1); 1437 1438 /* 1439 * If the driver has a MiniportTransferData() function, 1440 * we should allocate a private RX packet pool. 1441 */ 1442 --- 60 unchanged lines hidden --- |