CVS commit: src/sys/dev/if_ndis
Module Name:src Committed By: maxv Date: Sat Oct 15 08:37:55 UTC 2016 Modified Files: src/sys/dev/if_ndis: if_ndis_pci.c Log Message: There are several leaks in here, just fix one that should have been fixed in rev1.21 To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/if_ndis/if_ndis_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/if_ndis/if_ndis_pci.c diff -u src/sys/dev/if_ndis/if_ndis_pci.c:1.21 src/sys/dev/if_ndis/if_ndis_pci.c:1.22 --- src/sys/dev/if_ndis/if_ndis_pci.c:1.21 Sat Apr 4 15:22:02 2015 +++ src/sys/dev/if_ndis/if_ndis_pci.c Sat Oct 15 08:37:55 2016 @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.21 2015/04/04 15:22:02 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.22 2016/10/15 08:37:55 maxv Exp $"); #ifdef __FreeBSD__ __FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pci.c,v 1.8.2.3 2005/03/31 04:24:36 wpaul Exp $"); #endif @@ -300,7 +300,7 @@ void ndis_attach_pci(device_t parent, de if((sc->ndis_res_altmem = malloc(sizeof(struct ndis_resource), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { sc->error = ENOMEM; - return; + goto out; } sc->ndis_res_altmem->res_base = base; sc->ndis_res_altmem->res_size = size;
CVS commit: src/sys/dev/if_ndis
Module Name:src Committed By: maxv Date: Mon Aug 15 08:40:23 UTC 2016 Modified Files: src/sys/dev/if_ndis: if_ndis_pccard.c Log Message: Uninitialized var, found by brainy. FreeBSD fixed it this way four years ago. I haven't tested this change, but it is rather obvious, as the FreeBSD commit indicates, that sc->ndis_io_rid should be used instead. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/if_ndis/if_ndis_pccard.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/if_ndis/if_ndis_pccard.c diff -u src/sys/dev/if_ndis/if_ndis_pccard.c:1.4 src/sys/dev/if_ndis/if_ndis_pccard.c:1.5 --- src/sys/dev/if_ndis/if_ndis_pccard.c:1.4 Sat Mar 14 15:36:18 2009 +++ src/sys/dev/if_ndis/if_ndis_pccard.c Mon Aug 15 08:40:23 2016 @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ndis_pccard.c,v 1.4 2009/03/14 15:36:18 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ndis_pccard.c,v 1.5 2016/08/15 08:40:23 maxv Exp $"); #ifdef __FreeBSD__ __FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pccard.c,v 1.6.2.3 2005/03/31 04:24:36 wpaul Exp $"); #endif @@ -209,7 +209,7 @@ ndis_attach_pccard(device_t dev) goto fail; } sc->ndis_rescnt++; - resource_list_add(&sc->ndis_rl, SYS_RES_IOPORT, rid, + resource_list_add(&sc->ndis_rl, SYS_RES_IOPORT, sc->ndis_io_rid, rman_get_start(sc->ndis_res_io), rman_get_end(sc->ndis_res_io), rman_get_size(sc->ndis_res_io));
CVS commit: src/sys/dev/if_ndis
Module Name:src Committed By: maxv Date: Mon Aug 15 08:12:32 UTC 2016 Modified Files: src/sys/dev/if_ndis: if_ndis.c Log Message: Uninitialized var, found by brainy To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/if_ndis/if_ndis.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/if_ndis/if_ndis.c diff -u src/sys/dev/if_ndis/if_ndis.c:1.36 src/sys/dev/if_ndis/if_ndis.c:1.37 --- src/sys/dev/if_ndis/if_ndis.c:1.36 Fri Jun 10 13:27:14 2016 +++ src/sys/dev/if_ndis/if_ndis.c Mon Aug 15 08:12:32 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ndis.c,v 1.36 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_ndis.c,v 1.37 2016/08/15 08:12:32 maxv Exp $ */ /*- * Copyright (c) 2003 @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis.c,v 1.69.2.6 2005/03/31 04:24:36 wpaul Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: if_ndis.c,v 1.36 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ndis.c,v 1.37 2016/08/15 08:12:32 maxv Exp $"); #endif @@ -1967,7 +1967,7 @@ ndis_getstate_80211(struct ndis_softc *s break; default: aprint_error_dev(sc->ndis_dev, "unknown nettype %d\n", - arg); +(int)bs->nwbx_nettype); break; } free(bs, M_TEMP);
CVS commit: src/sys/dev/if_ndis
Module Name:src Committed By: christos Date: Sat Apr 4 15:22:02 UTC 2015 Modified Files: src/sys/dev/if_ndis: if_ndis_pci.c Log Message: don't leak rl (but there are other leaks), found by Brainy. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/if_ndis/if_ndis_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/if_ndis/if_ndis_pci.c diff -u src/sys/dev/if_ndis/if_ndis_pci.c:1.20 src/sys/dev/if_ndis/if_ndis_pci.c:1.21 --- src/sys/dev/if_ndis/if_ndis_pci.c:1.20 Mon Sep 1 15:46:55 2014 +++ src/sys/dev/if_ndis/if_ndis_pci.c Sat Apr 4 11:22:02 2015 @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.20 2014/09/01 19:46:55 he Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.21 2015/04/04 15:22:02 christos Exp $"); #ifdef __FreeBSD__ __FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pci.c,v 1.8.2.3 2005/03/31 04:24:36 wpaul Exp $"); #endif @@ -204,6 +204,7 @@ void ndis_attach_pci(device_t parent, de int revision, i; #endif int bar; + size_t rllen; printf("in ndis_attach_pci()\n"); @@ -227,9 +228,9 @@ void ndis_attach_pci(device_t parent, de printf("sc->ndis_mtag = %x\n", (unsigned int)sc->ndis_mtag); - rl = malloc(sizeof(ndis_resource_list) + - (sizeof(cm_partial_resource_desc) * (MAX_RESOURCES-1)), - M_DEVBUF, M_NOWAIT|M_ZERO); + rllen = sizeof(ndis_resource_list) + + sizeof(cm_partial_resource_desc) * (MAX_RESOURCES - 1); + rl = malloc(rllen, M_DEVBUF, M_NOWAIT|M_ZERO); if(rl == NULL) { sc->error = ENOMEM; @@ -272,7 +273,7 @@ void ndis_attach_pci(device_t parent, de malloc(sizeof(struct ndis_resource), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { //printf("error: out of memory\n"); sc->error = ENOMEM; - return; + goto out; } sc->ndis_res_io->res_base = base; sc->ndis_res_io->res_size = size; @@ -293,7 +294,7 @@ void ndis_attach_pci(device_t parent, de sc->ndis_res_altmem != NULL) { printf("too many resources\n"); sc->error = ENXIO; - return; + goto out; } if(sc->ndis_res_mem) { if((sc->ndis_res_altmem = @@ -317,7 +318,7 @@ void ndis_attach_pci(device_t parent, de if((sc->ndis_res_mem = malloc(sizeof(struct ndis_resource), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { sc->error = ENOMEM; - return; + goto out; } sc->ndis_res_mem->res_base = base; sc->ndis_res_mem->res_size = size; @@ -364,6 +365,10 @@ void ndis_attach_pci(device_t parent, de kthread_create(PRI_NONE, 0, NULL, ndis_attach, (void *)sc, NULL, "ndis_attach"); + return; +out: + free(rl, M_DEVBUF); + return; }
CVS commit: src/sys/dev/if_ndis
Module Name:src Committed By: he Date: Mon Sep 1 19:46:55 UTC 2014 Modified Files: src/sys/dev/if_ndis: if_ndis_pci.c Log Message: Remove redundant test for rl == NULL, that's already established right after its allocation, and rl isn't re-assigned later. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/if_ndis/if_ndis_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/if_ndis/if_ndis_pci.c diff -u src/sys/dev/if_ndis/if_ndis_pci.c:1.19 src/sys/dev/if_ndis/if_ndis_pci.c:1.20 --- src/sys/dev/if_ndis/if_ndis_pci.c:1.19 Sat Oct 27 17:18:23 2012 +++ src/sys/dev/if_ndis/if_ndis_pci.c Mon Sep 1 19:46:55 2014 @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.19 2012/10/27 17:18:23 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.20 2014/09/01 19:46:55 he Exp $"); #ifdef __FreeBSD__ __FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pci.c,v 1.8.2.3 2005/03/31 04:24:36 wpaul Exp $"); #endif @@ -358,11 +358,6 @@ void ndis_attach_pci(device_t parent, de printf("pci interrupt: %s\n", pci_intr_string(pa->pa_pc, ih)); - if(rl == NULL) { - sc->error = ENOMEM; - return; - } - /* save resource list in the softc */ sc->ndis_rl = rl; sc->ndis_rescnt = rl->cprl_count;
CVS commit: src/sys/dev/if_ndis
Module Name:src Committed By: dyoung Date: Wed Feb 24 18:16:50 UTC 2010 Modified Files: src/sys/dev/if_ndis: if_ndisvar.h Log Message: Start to tuck Cardbus under the PCI abstraction. Step #1, textual substitution: for all practical purposes, pcitag_t and cardbustag_t are interchangeable, so just use pcitag_t. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/if_ndis/if_ndisvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/if_ndis/if_ndisvar.h diff -u src/sys/dev/if_ndis/if_ndisvar.h:1.5 src/sys/dev/if_ndis/if_ndisvar.h:1.6 --- src/sys/dev/if_ndis/if_ndisvar.h:1.5 Thu Dec 20 21:08:19 2007 +++ src/sys/dev/if_ndis/if_ndisvar.h Wed Feb 24 18:16:50 2010 @@ -175,7 +175,7 @@ /* cardbus specific */ cardbus_devfunc_tndis_res_ct; /* cardbus devfuncs */ - cardbustag_t ndis_res_ctag; /* carbus tag */ + pcitag_t ndis_res_ctag; /* carbus tag */ bus_size_t ndis_res_mapsize; /* size of mapped bus space region */ #endif /* end __NetBSD__ section */ int ndis_rescnt;
CVS commit: src/sys/dev/if_ndis
Module Name:src Committed By: christos Date: Tue Oct 20 19:04:59 UTC 2009 Modified Files: src/sys/dev/if_ndis: if_ndis.c if_ndis_pci.c Log Message: make this compile again. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/if_ndis/if_ndis.c cvs rdiff -u -r1.16 -r1.17 src/sys/dev/if_ndis/if_ndis_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/if_ndis/if_ndis.c diff -u src/sys/dev/if_ndis/if_ndis.c:1.28 src/sys/dev/if_ndis/if_ndis.c:1.29 --- src/sys/dev/if_ndis/if_ndis.c:1.28 Sun Aug 2 16:22:34 2009 +++ src/sys/dev/if_ndis/if_ndis.c Tue Oct 20 15:04:59 2009 @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis.c,v 1.69.2.6 2005/03/31 04:24:36 wpaul Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: if_ndis.c,v 1.28 2009/08/02 20:22:34 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ndis.c,v 1.29 2009/10/20 19:04:59 christos Exp $"); #endif @@ -94,13 +94,12 @@ #include "ndis_driver_data.h" -void ndis_attach (void *); -int ndis_detach (device_t, int); -int ndis_suspend (device_t); -int ndis_resume (device_t); -void ndis_shutdown (device_t); +void ndis_attach(void *); +int ndis_detach(device_t, int); +int ndis_suspend(device_t); +int ndis_resume(device_t); +void ndis_shutdown(device_t); -int ndisdrv_modevent (struct lkm_table *lkmtp, int cmd); /* I moved these to if_ndisvar.h */ /* @@ -143,8 +142,13 @@ static void ndis_setmulti (struct ndis_softc *); static void ndis_map_sclist (void *, bus_dma_segment_t *, int, bus_size_t, int); + +#ifdef _MODULE + static int ndisdrv_loaded = 0; +int ndisdrv_modevent(module_t, int); +MODULE(MODULE_CLASS_DRIVER, ndisdrv_modevent, NULL); /* * This routine should call windrv_load() once for each driver * image. This will do the relocation and dynalinking for the @@ -152,9 +156,7 @@ * saved in our driver database. */ int -ndisdrv_modevent(mod, cmd) - module_t mod; - int cmd; +ndisdrv_modevent(module_t mod, int cmd) { int error = 0; @@ -162,7 +164,7 @@ printf("in ndisdrv_modevent\n"); #endif switch (cmd) { - case MOD_LOAD: + case MODULE_CMD_INIT: ndisdrv_loaded++; if (ndisdrv_loaded > 1) break; @@ -173,7 +175,7 @@ windrv_wrap((funcptr)ndis_linksts_done, &ndis_linksts_done_wrap); break; - case MOD_UNLOAD: + case MODULE_CMD_FINI: ndisdrv_loaded--; if (ndisdrv_loaded > 0) break; @@ -183,16 +185,17 @@ windrv_unwrap(ndis_linksts_wrap); windrv_unwrap(ndis_linksts_done_wrap); break; -/* TODO: Do we need a LKM_E_STAT for NetBSD? */ + case MODULE_CMD_STAT: + error = ENOTTY; + break; default: error = EINVAL; break; } - return (error); + return error; } -#ifdef NDIS_LKM int if_ndis_lkmentry(struct lkm_table *lkmtp, int cmd, int ver); CFDRIVER_DECL(ndis, DV_DULL, NULL); @@ -229,7 +232,7 @@ DISPATCH(lkmtp, cmd, ver, lkm_nofunc, lkm_nofunc, lkm_nofunc); } -#endif /* NIDS_LKM */ +#endif /* _MODULE */ /* * Program the 64-bit multicast hash filter. @@ -889,7 +892,6 @@ #endif sc = device_get_softc(dev); - KASSERT(mtx_initialized(&sc->ndis_mtx)); NDIS_LOCK(sc); @@ -944,9 +946,6 @@ * TODO: Unmap dma for NetBSD */ - - mtx_destroy(&sc->ndis_mtx); - return(0); } Index: src/sys/dev/if_ndis/if_ndis_pci.c diff -u src/sys/dev/if_ndis/if_ndis_pci.c:1.16 src/sys/dev/if_ndis/if_ndis_pci.c:1.17 --- src/sys/dev/if_ndis/if_ndis_pci.c:1.16 Sun Aug 2 16:22:34 2009 +++ src/sys/dev/if_ndis/if_ndis_pci.c Tue Oct 20 15:04:59 2009 @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.16 2009/08/02 20:22:34 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.17 2009/10/20 19:04:59 christos Exp $"); #ifdef __FreeBSD__ __FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pci.c,v 1.8.2.3 2005/03/31 04:24:36 wpaul Exp $"); #endif @@ -67,7 +67,7 @@ #include "ndis_driver_data.h" -#ifndef NDIS_LKM +#ifndef _MODULE #include #endif @@ -101,7 +101,7 @@ extern unsigned char drv_data[]; -#ifndef NDIS_LKM +#ifndef _MODULE //static funcptr ndis_txeof_wrap; //static funcptr ndis_rxeof_wrap; //static funcptr ndis_linksts_wrap; @@ -123,8 +123,7 @@ -extern int -ndis_lkm_handle(struct lkm_table *lkmtp, int cmd); +#ifdef _MODULE extern int ndisdrv_modevent(module_t mod, int cmd); @@ -143,6 +142,7 @@ { ndisdrv_modevent(NULL, MOD_LOAD); } +#endif /*static*/ int ndis_probe_pci(device_t parent, cfdata_t match, void *aux) @@ -165,12 +165,10 @@ t->ndis_vid, t->ndis_did); #endif if((vendor == t->ndis_vid) && (product == t->ndis_did)) { -#ifndef NDIS_LKM - ndis_lkm_handle(NULL, LKM_E_LOAD); - //kthread_create(load_ndisapi, NULL); -#endif /* NDIS_LKM */ +#ifdef _MODULE ndisdrv_modevent(NULL, MOD_LOAD); //kthread_create(load_ndisdrv, NULL); +#endif /* _MODULE */ drv = windrv_lookup(0, "PCI Bus");
CVS commit: src/sys/dev/if_ndis
Module Name:src Committed By: dsl Date: Sun Aug 2 20:22:34 UTC 2009 Modified Files: src/sys/dev/if_ndis: if_ndis.c if_ndis_pci.c Log Message: Patch from PR/39034 - should make this compile! I've not removed the mtx_destroy() since that has to be in there somewhere. Patch may apply to netbsd 5.0 To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/if_ndis/if_ndis.c cvs rdiff -u -r1.15 -r1.16 src/sys/dev/if_ndis/if_ndis_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/if_ndis/if_ndis.c diff -u src/sys/dev/if_ndis/if_ndis.c:1.27 src/sys/dev/if_ndis/if_ndis.c:1.28 --- src/sys/dev/if_ndis/if_ndis.c:1.27 Sat Apr 18 14:58:03 2009 +++ src/sys/dev/if_ndis/if_ndis.c Sun Aug 2 20:22:34 2009 @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis.c,v 1.69.2.6 2005/03/31 04:24:36 wpaul Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: if_ndis.c,v 1.27 2009/04/18 14:58:03 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ndis.c,v 1.28 2009/08/02 20:22:34 dsl Exp $"); #endif @@ -253,7 +253,7 @@ error = ndis_set_info(sc, OID_GEN_CURRENT_PACKET_FILTER, &sc->ndis_filter, &len); if (error) { - aprint_error_dev(sc->ndif_dev, "set filter failed: %d\n", + aprint_error_dev(sc->ndis_dev, "set filter failed: %d\n", error); } return; @@ -550,7 +550,7 @@ } /* Tell the user what version of the API the driver is using. */ - aprint_normal_dev(&sc->ndis_dev, "NDIS API version: %d.%d\n", + aprint_normal_dev(sc->ndis_dev, "NDIS API version: %d.%d\n", sc->ndis_chars->nmc_version_major, sc->ndis_chars->nmc_version_minor); @@ -2129,7 +2129,7 @@ error = ifmedia_ioctl(ifp, ifr, &sc->ifmedia, command); break; case SIOCSIFCAP: - if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) { + if ((error = ether_ioctl(ifp, command, data)) == ENETRESET) { ndis_set_offload(sc); error = 0; } Index: src/sys/dev/if_ndis/if_ndis_pci.c diff -u src/sys/dev/if_ndis/if_ndis_pci.c:1.15 src/sys/dev/if_ndis/if_ndis_pci.c:1.16 --- src/sys/dev/if_ndis/if_ndis_pci.c:1.15 Tue May 12 14:28:22 2009 +++ src/sys/dev/if_ndis/if_ndis_pci.c Sun Aug 2 20:22:34 2009 @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.15 2009/05/12 14:28:22 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.16 2009/08/02 20:22:34 dsl Exp $"); #ifdef __FreeBSD__ __FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pci.c,v 1.8.2.3 2005/03/31 04:24:36 wpaul Exp $"); #endif @@ -369,7 +369,8 @@ sc->ndis_rl = rl; sc->ndis_rescnt = rl->cprl_count; - kthread_create(ndis_attach, (void *)sc); + kthread_create(PRI_NONE, 0, NULL, ndis_attach, (void *)sc, + NULL, "ndis_attach"); }
CVS commit: src/sys/dev/if_ndis
Module Name:src Committed By: cegger Date: Tue May 12 14:28:22 UTC 2009 Modified Files: src/sys/dev/if_ndis: if_ndis_pci.c Log Message: struct device * -> device_t, no functional changes intended. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/if_ndis/if_ndis_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/if_ndis/if_ndis_pci.c diff -u src/sys/dev/if_ndis/if_ndis_pci.c:1.14 src/sys/dev/if_ndis/if_ndis_pci.c:1.15 --- src/sys/dev/if_ndis/if_ndis_pci.c:1.14 Tue May 12 12:17:51 2009 +++ src/sys/dev/if_ndis/if_ndis_pci.c Tue May 12 14:28:22 2009 @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.14 2009/05/12 12:17:51 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.15 2009/05/12 14:28:22 cegger Exp $"); #ifdef __FreeBSD__ __FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pci.c,v 1.8.2.3 2005/03/31 04:24:36 wpaul Exp $"); #endif @@ -85,11 +85,11 @@ { 0, 0, 0, NULL } }; -/*static*/ int ndis_probe_pci(struct device *parent, +/*static*/ int ndis_probe_pci(device_t parent, cfdata_t match, void *aux); -/*static*/ void ndis_attach_pci(struct device *parent, -struct device *self, +/*static*/ void ndis_attach_pci(device_t parent, +device_t self, void *aux); extern void ndis_attach (void *); extern int ndis_shutdown (device_t); @@ -145,7 +145,7 @@ } /*static*/ int -ndis_probe_pci(struct device *parent, cfdata_t match, void *aux) +ndis_probe_pci(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; int vendor = PCI_VENDOR(pa->pa_id); @@ -187,7 +187,7 @@ #define MAX_RESOURCES 7 /*static*/ -void ndis_attach_pci(struct device *parent, struct device *self, void *aux) +void ndis_attach_pci(device_t parent, device_t self, void *aux) { struct ndis_softc *sc = (struct ndis_softc*)self; struct pci_attach_args *pa = aux;
CVS commit: src/sys/dev/if_ndis
Module Name:src Committed By: cegger Date: Tue May 12 12:17:51 UTC 2009 Modified Files: src/sys/dev/if_ndis: if_ndis_pci.c Log Message: struct cfdata * -> cfdata_t, no functional changes intended. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/if_ndis/if_ndis_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/if_ndis/if_ndis_pci.c diff -u src/sys/dev/if_ndis/if_ndis_pci.c:1.13 src/sys/dev/if_ndis/if_ndis_pci.c:1.14 --- src/sys/dev/if_ndis/if_ndis_pci.c:1.13 Fri Mar 27 16:15:24 2009 +++ src/sys/dev/if_ndis/if_ndis_pci.c Tue May 12 12:17:51 2009 @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.13 2009/03/27 16:15:24 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.14 2009/05/12 12:17:51 cegger Exp $"); #ifdef __FreeBSD__ __FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pci.c,v 1.8.2.3 2005/03/31 04:24:36 wpaul Exp $"); #endif @@ -86,7 +86,7 @@ }; /*static*/ int ndis_probe_pci(struct device *parent, -struct cfdata *match, +cfdata_t match, void *aux); /*static*/ void ndis_attach_pci(struct device *parent, struct device *self, @@ -145,7 +145,7 @@ } /*static*/ int -ndis_probe_pci(struct device *parent, struct cfdata *match, void *aux) +ndis_probe_pci(struct device *parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; int vendor = PCI_VENDOR(pa->pa_id);
CVS commit: src/sys/dev/if_ndis
Module Name:src Committed By: dyoung Date: Thu Apr 2 00:39:37 UTC 2009 Modified Files: src/sys/dev/if_ndis: if_ndis.c Log Message: I find myself making a lot of changes in this code to keep it compiling and (let us hope) working in the 21st century, so I have put it through unifdef -D__NetBSD__ -U__FreeBSD__ so that it is less of a chore to read and to maintain. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/dev/if_ndis/if_ndis.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/if_ndis/if_ndis.c diff -u src/sys/dev/if_ndis/if_ndis.c:1.24 src/sys/dev/if_ndis/if_ndis.c:1.25 --- src/sys/dev/if_ndis/if_ndis.c:1.24 Wed Mar 18 17:06:49 2009 +++ src/sys/dev/if_ndis/if_ndis.c Thu Apr 2 00:39:37 2009 @@ -35,12 +35,9 @@ __FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis.c,v 1.69.2.6 2005/03/31 04:24:36 wpaul Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: if_ndis.c,v 1.24 2009/03/18 17:06:49 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ndis.c,v 1.25 2009/04/02 00:39:37 dyoung Exp $"); #endif -#ifdef __FreeBSD__ -#include "opt_bdg.h" -#endif #include #include @@ -51,30 +48,18 @@ #include #include -#ifdef __NetBSD__ #include #include -#endif -#ifdef __FreeBSD__ -#include -#else /* __NetBSD__ */ #include -#endif #include -#if __FreeBSD_version < 502113 #include -#endif #include #include -#ifdef __FreeBSD__ -#include -#else #include -#endif #include #include @@ -82,33 +67,18 @@ #include -#ifdef __FreeBSD__ -#include -#include -#include -#endif #include -#ifdef __FreeBSD__ -#include -#include -#endif #include #include -#ifdef __FreeBSD__ -#include -#else /* __NetBSD__ */ #include -#endif #include #include -#ifdef __NetBSD__ #include -#endif #include #include @@ -116,9 +86,7 @@ #include #include #include -#ifdef __NetBSD__ #include -#endif #include #define NDIS_IMAGE @@ -126,25 +94,13 @@ #include "ndis_driver_data.h" -#ifdef __FreeBSD__ -int ndis_attach (device_t); -#else /* __NetBSD__ */ void ndis_attach (void *); -#endif -#ifdef __FreeBSD__ -int ndis_detach (device_t); -#else /* __NetBSD__ */ int ndis_detach (device_t, int); -#endif int ndis_suspend (device_t); int ndis_resume (device_t); void ndis_shutdown (device_t); -#ifdef __FreeBSD__ -int ndisdrv_modevent (module_t, int, void *); -#else /* __NetBSD__ */ int ndisdrv_modevent (struct lkm_table *lkmtp, int cmd); -#endif /* I moved these to if_ndisvar.h */ /* @@ -164,11 +120,7 @@ static funcptr ndis_linksts_wrap; static funcptr ndis_linksts_done_wrap; -#ifdef __FreeBSD__ -static void ndis_intr (void *); -#else /* __NetBSD__ */ int ndis_intr(void *); -#endif static void ndis_tick (void *); static void ndis_ticktask (void *); static void ndis_start (struct ifnet *); @@ -176,11 +128,7 @@ static int ndis_ioctl (struct ifnet *, u_long, void *); static int ndis_wi_ioctl_get (struct ifnet *, u_long, void *); static int ndis_wi_ioctl_set (struct ifnet *, u_long, void *); -#ifdef __FreeBSD__ -static void ndis_init (void *); -#else /* __NetBSD__ */ static int ndis_init (struct ifnet *); -#endif static void ndis_stop (struct ndis_softc *); static void ndis_watchdog (struct ifnet *); static int ndis_ifmedia_upd (struct ifnet *); @@ -195,12 +143,7 @@ static void ndis_setmulti (struct ndis_softc *); static void ndis_map_sclist (void *, bus_dma_segment_t *, int, bus_size_t, int); -#ifdef __NetBSD__ -static int ndisdrv_loaded = 0; -#endif /* __NetBSD__ */ -#ifdef __FreeBSD__ static int ndisdrv_loaded = 0; -#endif /* * This routine should call windrv_load() once for each driver @@ -209,16 +152,9 @@ * saved in our driver database. */ int -#ifdef __FreeBSD__ -ndisdrv_modevent(mod, cmd, arg) - module_t mod; - int cmd; - void *arg; -#else ndisdrv_modevent(mod, cmd) module_t mod; int cmd; -#endif { int error = 0; @@ -248,14 +184,6 @@ windrv_unwrap(ndis_linksts_done_wrap); break; /* TODO: Do we need a LKM_E_STAT for NetBSD? */ -#ifdef __FreeBSD__ - case MOD_SHUTDOWN: - windrv_unwrap(ndis_rxeof_wrap); - windrv_unwrap(ndis_txeof_wrap); - windrv_unwrap(ndis_linksts_wrap); - windrv_unwrap(ndis_linksts_done_wrap); - break; -#endif /* __FreeBSD__ */ default: error = EINVAL; break; @@ -264,7 +192,6 @@ return (error); } -#ifdef __NetBSD__ #ifdef NDIS_LKM int if_ndis_lkmentry(struct lkm_table *lkmtp, int cmd, int ver); @@ -303,7 +230,6 @@ } #endif /* NIDS_LKM */ -#endif /* __NetBSD__ */ /* * Program the 64-bit multicast hash filter. @@ -312,11 +238,7 @@ ndis_setmulti(struct ndis_softc *sc) { struct ifnet *ifp; -#ifdef __FreeBSD__ - struct ifmultiaddr *ifma; -#else /* __NetBSD__ */ struct ether_multi *ifma; -#endif int len, mclistsz, error; uint8_t *mclist; @@ -337,13 +259,8 @@ return
CVS commit: src/sys/dev/if_ndis
Module Name:src Committed By: dyoung Date: Fri Mar 27 16:15:25 UTC 2009 Modified Files: src/sys/dev/if_ndis: if_ndis_pci.c Log Message: For legibility, unifdef -U__FreeBSD__ -D__NetBSD__. This compiles, but it is not run-tested. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/if_ndis/if_ndis_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/if_ndis/if_ndis_pci.c diff -u src/sys/dev/if_ndis/if_ndis_pci.c:1.12 src/sys/dev/if_ndis/if_ndis_pci.c:1.13 --- src/sys/dev/if_ndis/if_ndis_pci.c:1.12 Sat Mar 14 15:36:18 2009 +++ src/sys/dev/if_ndis/if_ndis_pci.c Fri Mar 27 16:15:24 2009 @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.12 2009/03/14 15:36:18 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.13 2009/03/27 16:15:24 dyoung Exp $"); #ifdef __FreeBSD__ __FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pci.c,v 1.8.2.3 2005/03/31 04:24:36 wpaul Exp $"); #endif @@ -49,16 +49,9 @@ #include #include -#ifdef __FreeBSD__ -#include -#include -#include -#endif -#ifdef __NetBSD__ #include #include -#endif #include @@ -74,20 +67,12 @@ #include "ndis_driver_data.h" -#ifdef __NetBSD__ #ifndef NDIS_LKM #include #endif -#endif /* __NetBSD__ */ #ifdef NDIS_PCI_DEV_TABLE -#ifdef __FreeBSD -MODULE_DEPEND(ndis, pci, 1, 1, 1); -MODULE_DEPEND(ndis, ether, 1, 1, 1); -MODULE_DEPEND(ndis, wlan, 1, 1, 1); -MODULE_DEPEND(ndis, ndisapi, 1, 1, 1); -#endif /* * Various supported device vendors/types and their names. @@ -100,39 +85,19 @@ { 0, 0, 0, NULL } }; -#ifdef __FreeBSD__ -static int ndis_probe_pci (device_t); -static int ndis_attach_pci (device_t); -#else /* __NetBSD__ */ /*static*/ int ndis_probe_pci(struct device *parent, struct cfdata *match, void *aux); /*static*/ void ndis_attach_pci(struct device *parent, struct device *self, void *aux); -#endif -#ifdef __FreeBSD__ -static struct resource_list *ndis_get_resource_list -(device_t, device_t); -extern int ndisdrv_modevent (module_t, int, void *); -#endif -#ifdef __FreeBSD__ -extern int ndis_attach (device_t); -#else /* __NetBSD__ */ extern void ndis_attach (void *); -#endif extern int ndis_shutdown (device_t); -#ifdef __FreeBSD__ -extern int ndis_detach (device_t); -#else /* __NetBSD__ */ extern int ndis_detach (device_t, int); -#endif extern int ndis_suspend (device_t); extern int ndis_resume (device_t); -#ifdef __NetBSD__ extern int ndis_intr(void *); -#endif extern unsigned char drv_data[]; @@ -143,49 +108,6 @@ //static funcptr ndis_linksts_done_wrap; #endif -#ifdef __FreeBSD__ -static device_method_t ndis_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, ndis_probe_pci), - DEVMETHOD(device_attach, ndis_attach_pci), - DEVMETHOD(device_detach, ndis_detach), - DEVMETHOD(device_shutdown, ndis_shutdown), - DEVMETHOD(device_suspend, ndis_suspend), - DEVMETHOD(device_resume, ndis_resume), - - /* Bus interface */ - DEVMETHOD(bus_get_resource_list, ndis_get_resource_list), - - { 0, 0 } -}; - -static driver_t ndis_driver = { -#ifdef NDIS_DEVNAME - NDIS_DEVNAME, -#else - "ndis", -#endif - ndis_methods, - sizeof(struct ndis_softc) -}; - -static devclass_t ndis_devclass; - -#ifdef NDIS_MODNAME -#define NDIS_MODNAME_OVERRIDE_PCI(x) \ - DRIVER_MODULE(x, pci, ndis_driver, ndis_devclass, ndisdrv_modevent, 0) -#define NDIS_MODNAME_OVERRIDE_CARDBUS(x)\ - DRIVER_MODULE(x, cardbus, ndis_driver, ndis_devclass, \ - ndisdrv_modevent, 0) -NDIS_MODNAME_OVERRIDE_PCI(NDIS_MODNAME); -NDIS_MODNAME_OVERRIDE_CARDBUS(NDIS_MODNAME); -#else -DRIVER_MODULE(ndis, pci, ndis_driver, ndis_devclass, ndisdrv_modevent, 0); -DRIVER_MODULE(ndis, cardbus, ndis_driver, ndis_devclass, ndisdrv_modevent, 0); -#endif - -#endif /* __FreeBSD__ */ -#ifdef __NetBSD__ CFATTACH_DECL( #ifdef NDIS_DEVNAME @@ -199,43 +121,7 @@ ndis_detach, NULL); -#endif /* __NetBSD__ */ -#ifdef __FreeBSD__ -/* - * Probe for an NDIS device. Check the PCI vendor and device - * IDs against our list and return a device name if we find a match. - */ -static int -ndis_probe_pci(device_t dev) -{ - struct ndis_pci_type *t; - driver_object *drv; - - t = ndis_devs; - drv = windrv_lookup(0, "PCI Bus"); - - if (drv == NULL) - return(ENXIO); - - while(t->ndis_name != NULL) { - if ((pci_get_vendor(dev) == t->ndis_vid) && - (pci_get_device(dev) == t->ndis_did) && - ((pci_read_config(dev, PCIR_SUBVEND_0, 4) == - t->ndis_subsys) || t->ndis_subsys == 0)) { - device_set_desc(dev, t->ndis_name); - - /* Create PDO for this device instance */ - windrv_create_pdo(drv, dev); - return(0); - } - t++; - } - - return(ENXIO); -} -#endif /* __FreeBSD__ */ -#ifdef __NetBSD__ extern int ndis_lkm_handle(struct lkm_table *lkmtp, int cmd); @@ -296,171 +182,7 @@ return 0; /* dosen't match */ } -#endif /* __NetB