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 <sys/cdefs.h> -__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 <compat/ndis/hal_var.h> #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"); printf("Matching vendor: %x, product: %x, name: %s\n", vendor, product, t->ndis_name);