summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/compat/ndis/kern_ndis.c4
-rw-r--r--sys/compat/ndis/kern_windrv.c25
-rw-r--r--sys/compat/ndis/ntoskrnl_var.h2
-rw-r--r--sys/compat/ndis/subr_usbd.c156
-rw-r--r--sys/compat/ndis/usbd_var.h56
-rw-r--r--sys/conf/files.amd641
-rw-r--r--sys/conf/files.i3861
-rw-r--r--sys/dev/if_ndis/if_ndis.c43
-rw-r--r--sys/dev/if_ndis/if_ndis_pccard.c6
-rw-r--r--sys/dev/if_ndis/if_ndis_pci.c4
-rw-r--r--sys/dev/if_ndis/if_ndis_usb.c176
-rw-r--r--sys/modules/ndis/Makefile2
12 files changed, 451 insertions, 25 deletions
diff --git a/sys/compat/ndis/kern_ndis.c b/sys/compat/ndis/kern_ndis.c
index 66c3017..b6027f5 100644
--- a/sys/compat/ndis/kern_ndis.c
+++ b/sys/compat/ndis/kern_ndis.c
@@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$");
#include <compat/ndis/ndis_var.h>
#include <compat/ndis/hal_var.h>
#include <compat/ndis/cfg_var.h>
+#include <compat/ndis/usbd_var.h>
#include <dev/if_ndis/if_ndisvar.h>
#define NDIS_DUMMY_PATH "\\\\some\\bogus\\path"
@@ -150,6 +151,7 @@ ndis_modevent(module_t mod, int cmd, void *arg)
hal_libinit();
ndis_libinit();
ntoskrnl_libinit();
+ usbd_libinit();
patch = kernndis_functbl;
while (patch->ipt_func != NULL) {
@@ -176,6 +178,7 @@ ndis_modevent(module_t mod, int cmd, void *arg)
hal_libfini();
ndis_libfini();
ntoskrnl_libfini();
+ usbd_libfini();
windrv_libfini();
patch = kernndis_functbl;
@@ -196,6 +199,7 @@ ndis_modevent(module_t mod, int cmd, void *arg)
hal_libfini();
ndis_libfini();
ntoskrnl_libfini();
+ usbd_libfini();
windrv_libfini();
patch = kernndis_functbl;
diff --git a/sys/compat/ndis/kern_windrv.c b/sys/compat/ndis/kern_windrv.c
index 6fa3575..c1bb1c6 100644
--- a/sys/compat/ndis/kern_windrv.c
+++ b/sys/compat/ndis/kern_windrv.c
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include <compat/ndis/ntoskrnl_var.h>
#include <compat/ndis/ndis_var.h>
#include <compat/ndis/hal_var.h>
+#include <compat/ndis/usbd_var.h>
struct windrv_type {
uint16_t windrv_vid; /* for PCI or USB */
@@ -130,20 +131,36 @@ windrv_libfini(void)
*/
driver_object *
-windrv_lookup(img)
+windrv_lookup(img, name)
vm_offset_t img;
+ char *name;
{
struct drvdb_ent *d;
+ unicode_string us;
+
+ /* Damn unicode. */
+
+ if (name != NULL) {
+ us.us_len = strlen(name) * 2;
+ us.us_maxlen = strlen(name) * 2;
+ us.us_buf = NULL;
+ ndis_ascii_to_unicode(name, &us.us_buf);
+ }
mtx_lock(&drvdb_mtx);
STAILQ_FOREACH(d, &drvdb_head, link) {
- if (d->windrv_object->dro_driverstart == (void *)img) {
+ if (d->windrv_object->dro_driverstart == (void *)img ||
+ bcmp((char *)d->windrv_object->dro_drivername.us_buf,
+ (char *)us.us_buf, us.us_len) == 0) {
mtx_unlock(&drvdb_mtx);
return(d->windrv_object);
}
}
mtx_unlock(&drvdb_mtx);
+ if (name != NULL)
+ ExFreePool(us.us_buf);
+
return(NULL);
}
@@ -244,12 +261,10 @@ windrv_load(mod, img, len)
}
/* Dynamically link USBD.SYS -- optional */
-#ifdef notyet
if (pe_get_import_descriptor(img, &imp_desc, "USBD") == 0) {
- if (pe_patch_imports(img, "USBD", ntoskrnl_functbl))
+ if (pe_patch_imports(img, "USBD", usbd_functbl))
return(ENOEXEC);
}
-#endif
/* Next step: find the driver entry point. */
diff --git a/sys/compat/ndis/ntoskrnl_var.h b/sys/compat/ndis/ntoskrnl_var.h
index 8e2771c..d8432b2 100644
--- a/sys/compat/ndis/ntoskrnl_var.h
+++ b/sys/compat/ndis/ntoskrnl_var.h
@@ -1127,7 +1127,7 @@ typedef void (*funcptr)(void);
__BEGIN_DECLS
extern int windrv_libinit(void);
extern int windrv_libfini(void);
-extern driver_object *windrv_lookup(vm_offset_t);
+extern driver_object *windrv_lookup(vm_offset_t, char *);
extern int windrv_load(module_t, vm_offset_t, int);
extern int windrv_unload(module_t, vm_offset_t, int);
extern int windrv_create_pdo(driver_object *, device_t);
diff --git a/sys/compat/ndis/subr_usbd.c b/sys/compat/ndis/subr_usbd.c
new file mode 100644
index 0000000..a9b30e4
--- /dev/null
+++ b/sys/compat/ndis/subr_usbd.c
@@ -0,0 +1,156 @@
+/*-
+ * Copyright (c) 2005
+ * Bill Paul <wpaul@windriver.com>. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Bill Paul.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/unistd.h>
+#include <sys/types.h>
+
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/module.h>
+#include <sys/conf.h>
+#include <sys/mbuf.h>
+#include <sys/bus.h>
+
+#include <sys/queue.h>
+
+#include <compat/ndis/pe_var.h>
+#include <compat/ndis/cfg_var.h>
+#include <compat/ndis/resource_var.h>
+#include <compat/ndis/ntoskrnl_var.h>
+#include <compat/ndis/ndis_var.h>
+#include <compat/ndis/hal_var.h>
+#include <compat/ndis/usbd_var.h>
+
+static driver_object usbd_driver;
+
+__stdcall static uint32_t usbd_iodispatch(device_object *, irp *);
+
+__stdcall static void USBD_GetUSBDIVersion(usbd_version_info *);
+__stdcall static void dummy(void);
+
+int
+usbd_libinit(void)
+{
+ image_patch_table *patch;
+
+ patch = usbd_functbl;
+ while (patch->ipt_func != NULL) {
+ windrv_wrap((funcptr)patch->ipt_func,
+ (funcptr *)&patch->ipt_wrap);
+ patch++;
+ }
+
+ /* Create a fake USB driver instance. */
+
+ windrv_bus_attach(&usbd_driver, "USB Bus");
+
+ /* Set up our dipatch routine. */
+
+ usbd_driver.dro_dispatch[IRP_MJ_INTERNAL_DEVICE_CONTROL] =
+ (driver_dispatch)usbd_iodispatch;
+
+ return(0);
+}
+
+int
+usbd_libfini(void)
+{
+ image_patch_table *patch;
+
+ patch = usbd_functbl;
+ while (patch->ipt_func != NULL) {
+ windrv_unwrap(patch->ipt_wrap);
+ patch++;
+ }
+
+ free(usbd_driver.dro_drivername.us_buf, M_DEVBUF);
+
+ return(0);
+}
+
+__stdcall static uint32_t
+usbd_iodispatch(dobj, ip)
+ device_object *dobj;
+ irp *ip;
+{
+ return(0);
+}
+
+__stdcall static void
+USBD_GetUSBDIVersion(ui)
+ usbd_version_info *ui;
+{
+ /* Pretend to be Windows XP. */
+
+ ui->uvi_usbdi_vers = USBDI_VERSION;
+ ui->uvi_supported_vers = USB_VER_2_0;
+
+ return;
+}
+
+__stdcall static void
+dummy(void)
+{
+ printf("USBD dummy called\n");
+ return;
+}
+
+image_patch_table usbd_functbl[] = {
+ IMPORT_FUNC(USBD_GetUSBDIVersion),
+#ifdef notyet
+ IMPORT_FUNC_MAP(_USBD_ParseConfigurationDescriptorEx@28,
+ USBD_ParseConfigurationDescriptorEx),
+ IMPORT_FUNC_MAP(_USBD_CreateConfigurationRequestEx@8,
+ USBD_CreateConfigurationRequestEx),
+#endif
+
+ /*
+ * This last entry is a catch-all for any function we haven't
+ * implemented yet. The PE import list patching routine will
+ * use it for any function that doesn't have an explicit match
+ * in this table.
+ */
+
+ { NULL, (FUNC)dummy, NULL },
+
+ /* End of list. */
+
+ { NULL, NULL, NULL }
+};
+
diff --git a/sys/compat/ndis/usbd_var.h b/sys/compat/ndis/usbd_var.h
new file mode 100644
index 0000000..8c9f2b3
--- /dev/null
+++ b/sys/compat/ndis/usbd_var.h
@@ -0,0 +1,56 @@
+/*-
+ * Copyright (c) 2003
+ * Bill Paul <wpaul@windriver.com>. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Bill Paul.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _USBD_VAR_H_
+#define _USBD_VAR_H_
+
+#define USBDI_VERSION 0x00000500
+#define USB_VER_1_1 0x00000110
+#define USB_VER_2_0 0x00000200
+
+struct usbd_version_info {
+ uint32_t uvi_usbdi_vers;
+ uint32_t uvi_supported_vers;
+};
+
+typedef struct usbd_version_info usbd_version_info;
+
+extern image_patch_table usbd_functbl[];
+
+__BEGIN_DECLS
+extern int usbd_libinit(void);
+extern int usbd_libfini(void);
+__END_DECLS
+
+#endif /* _USBD_VAR_H_ */
diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64
index 0d68398..58296b7 100644
--- a/sys/conf/files.amd64
+++ b/sys/conf/files.amd64
@@ -209,4 +209,5 @@ compat/ndis/subr_hal.c optional ndisapi pci
compat/ndis/subr_ndis.c optional ndisapi pci
compat/ndis/subr_ntoskrnl.c optional ndisapi pci
compat/ndis/subr_pe.c optional ndisapi pci
+compat/ndis/subr_usbd.c optional ndisapi pci
compat/ndis/winx64_wrap.S optional ndisapi pci
diff --git a/sys/conf/files.i386 b/sys/conf/files.i386
index 0060fcd..18680fe 100644
--- a/sys/conf/files.i386
+++ b/sys/conf/files.i386
@@ -85,6 +85,7 @@ compat/ndis/subr_hal.c optional ndisapi pci
compat/ndis/subr_ndis.c optional ndisapi pci
compat/ndis/subr_ntoskrnl.c optional ndisapi pci
compat/ndis/subr_pe.c optional ndisapi pci
+compat/ndis/subr_usbd.c optional ndisapi pci
compat/pecoff/imgact_pecoff.c optional pecoff_support
compat/svr4/imgact_svr4.c optional compat_svr4
compat/svr4/svr4_fcntl.c optional compat_svr4
diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c
index 836a844..2207e18 100644
--- a/sys/dev/if_ndis/if_ndis.c
+++ b/sys/dev/if_ndis/if_ndis.c
@@ -428,6 +428,7 @@ ndis_attach(dev)
u_char eaddr[ETHER_ADDR_LEN];
struct ndis_softc *sc;
driver_object *drv;
+ driver_object *pdrv;
device_object *pdo;
struct ifnet *ifp = NULL;
void *img;
@@ -439,17 +440,22 @@ ndis_attach(dev)
mtx_init(&sc->ndis_mtx, "ndis softc lock",
MTX_NETWORK_LOCK, MTX_DEF);
- /*
+ /*
* Hook interrupt early, since calling the driver's
- * init routine may trigger an interrupt.
+ * init routine may trigger an interrupt. Note that
+ * we don't need to do any explicit interrupt setup
+ * for USB.
*/
- error = bus_setup_intr(dev, sc->ndis_irq, INTR_TYPE_NET | INTR_MPSAFE,
- ndis_intr, sc, &sc->ndis_intrhand);
+ if (sc->ndis_iftype == PCMCIABus || sc->ndis_iftype == PCIBus) {
+ error = bus_setup_intr(dev, sc->ndis_irq,
+ INTR_TYPE_NET | INTR_MPSAFE,
+ ndis_intr, sc, &sc->ndis_intrhand);
- if (error) {
- device_printf(dev, "couldn't set up irq\n");
- goto fail;
+ if (error) {
+ device_printf(dev, "couldn't set up irq\n");
+ goto fail;
+ }
}
if (sc->ndis_iftype == PCMCIABus) {
@@ -470,6 +476,16 @@ ndis_attach(dev)
/* Create sysctl registry nodes */
ndis_create_sysctls(sc);
+ /* Find the PDO for this device instance. */
+
+ if (sc->ndis_iftype == PCIBus)
+ pdrv = windrv_lookup(NULL, "PCI Bus");
+ else if (sc->ndis_iftype == PCMCIABus)
+ pdrv = windrv_lookup(NULL, "PCCARD Bus");
+ else
+ pdrv = windrv_lookup(NULL, "USB Bus");
+ pdo = windrv_find_pdo(pdrv, dev);
+
/*
* Create a new functional device object for this
* device. This is what creates the miniport block
@@ -477,8 +493,7 @@ ndis_attach(dev)
*/
img = drv_data;
- drv = windrv_lookup((vm_offset_t)img);
- pdo = windrv_find_pdo(drv, dev);
+ drv = windrv_lookup((vm_offset_t)img, NULL);
if (NdisAddDevice(drv, pdo) != STATUS_SUCCESS) {
device_printf(dev, "failed to create FDO!\n");
error = ENXIO;
@@ -491,7 +506,8 @@ ndis_attach(dev)
sc->ndis_chars->nmc_version_minor);
/* Do resource conversion. */
- ndis_convert_res(sc);
+ if (sc->ndis_iftype == PCMCIABus || sc->ndis_iftype == PCIBus)
+ ndis_convert_res(sc);
/* Install our RX and TX interrupt handlers. */
sc->ndis_block->nmb_senddone_func = ndis_txeof_wrap;
@@ -857,7 +873,12 @@ ndis_detach(dev)
/* Destroy the PDO for this device. */
- drv = windrv_lookup((vm_offset_t)drv_data);
+ if (sc->ndis_iftype == PCIBus)
+ drv = windrv_lookup(NULL, "PCI Bus");
+ else if (sc->ndis_iftype == PCMCIABus)
+ drv = windrv_lookup(NULL, "PCCARD Bus");
+ else
+ drv = windrv_lookup(NULL, "USB Bus");
if (drv == NULL)
panic("couldn't find driver object");
windrv_destroy_pdo(drv, dev);
diff --git a/sys/dev/if_ndis/if_ndis_pccard.c b/sys/dev/if_ndis/if_ndis_pccard.c
index c3c42eb..38c4ac6 100644
--- a/sys/dev/if_ndis/if_ndis_pccard.c
+++ b/sys/dev/if_ndis/if_ndis_pccard.c
@@ -150,10 +150,8 @@ ndis_probe_pccard(dev)
const char *prodstr, *vendstr;
int error;
driver_object *drv;
- vm_offset_t img;
-
- img = (vm_offset_t)drv_data;
- drv = windrv_lookup(img);
+
+ drv = windrv_lookup(NULL, "PCCARD Bus");
if (drv == NULL)
return(ENXIO);
diff --git a/sys/dev/if_ndis/if_ndis_pci.c b/sys/dev/if_ndis/if_ndis_pci.c
index f24ec70..4cb1a58 100644
--- a/sys/dev/if_ndis/if_ndis_pci.c
+++ b/sys/dev/if_ndis/if_ndis_pci.c
@@ -145,11 +145,9 @@ ndis_probe_pci(dev)
{
struct ndis_pci_type *t;
driver_object *drv;
- vm_offset_t img;
t = ndis_devs;
- img = (vm_offset_t)drv_data;
- drv = windrv_lookup(img);
+ drv = windrv_lookup(NULL, "PCI Bus");
if (drv == NULL)
return(ENXIO);
diff --git a/sys/dev/if_ndis/if_ndis_usb.c b/sys/dev/if_ndis/if_ndis_usb.c
new file mode 100644
index 0000000..942ae1a
--- /dev/null
+++ b/sys/dev/if_ndis/if_ndis_usb.c
@@ -0,0 +1,176 @@
+/*-
+ * Copyright (c) 2005
+ * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Bill Paul.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/sockio.h>
+#include <sys/mbuf.h>
+#include <sys/malloc.h>
+#include <sys/kernel.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+
+#include <net/if.h>
+#include <net/if_arp.h>
+#include <net/ethernet.h>
+#include <net/if_dl.h>
+#include <net/if_media.h>
+
+#include <net/bpf.h>
+
+#include <sys/bus.h>
+#include <machine/bus.h>
+#include <dev/usb/usb.h>
+#include <dev/usb/usbdi.h>
+#include <dev/usb/usbdi_util.h>
+#include <dev/usb/usbdivar.h>
+#include <dev/usb/usbdevs.h>
+#include <dev/usb/usb_ethersubr.h>
+
+#include <net80211/ieee80211_var.h>
+
+#include <compat/ndis/pe_var.h>
+#include <compat/ndis/resource_var.h>
+#include <compat/ndis/ntoskrnl_var.h>
+#include <compat/ndis/ndis_var.h>
+#include <compat/ndis/cfg_var.h>
+#include <dev/if_ndis/if_ndisvar.h>
+
+MODULE_DEPEND(ndis, usb, 1, 1, 1);
+MODULE_DEPEND(ndis, ether, 1, 1, 1);
+MODULE_DEPEND(ndis, wlan, 1, 1, 1);
+MODULE_DEPEND(ndis, ndisapi, 1, 1, 1);
+
+#include "ndis_driver_data.h"
+
+#ifdef NDIS_USB_DEV_TABLE
+
+Static int ndisusb_match (device_ptr_t);
+Static int ndisusb_attach (device_ptr_t);
+Static struct resource_list *ndis_get_resource_list
+ (device_t, device_t);
+
+extern int ndisdrv_modevent (module_t, int, void *);
+extern int ndis_attach (device_t);
+extern int ndis_shutdown (device_t);
+extern int ndis_detach (device_t);
+extern int ndis_suspend (device_t);
+extern int ndis_resume (device_t);
+
+extern unsigned char drv_data[];
+
+Static device_method_t ndis_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, ndisusb_match),
+ DEVMETHOD(device_attach, ndisusb_attach),
+ DEVMETHOD(device_detach, ndis_detach),
+ DEVMETHOD(device_shutdown, ndis_shutdown),
+
+ /* bus interface */
+ DEVMETHOD(bus_print_child, bus_generic_print_child),
+ DEVMETHOD(bus_driver_added, bus_generic_driver_added),
+ 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_USB(x)
+ DRIVER_MODULE(x, usb, ndis_driver, ndis_devclass, ndisdrv_modevent, 0)
+NDIS_MODNAME_OVERRIDE_USB(NDIS_MODNAME);
+#else
+DRIVER_MODULE(ndis, uhub, ndis_driver, ndis_devclass, ndisdrv_modevent, 0);
+#endif
+
+USB_MATCH(ndisusb)
+{
+ USB_MATCH_START(ndisusb, uaa);
+ driver_object *drv;
+
+ drv = windrv_lookup(NULL, "USB Bus");
+ if (drv == NULL)
+ return(UMATCH_NONE);
+
+ if (0) {
+ /* Create PDO for this device instance */
+ windrv_create_pdo(drv, self);
+ return(0);
+ }
+
+ if (uaa->iface != NULL)
+ return(UMATCH_NONE);
+
+ return(UMATCH_NONE);
+}
+
+USB_ATTACH(ndisusb)
+{
+ USB_ATTACH_START(ndisusb, dummy, uaa);
+ struct ndis_softc *sc;
+
+ sc = (struct ndis_softc *)dummy;
+
+ sc->ndis_dev = self;
+
+ if (ndis_attach(self) != 0)
+ USB_ATTACH_ERROR_RETURN;
+
+ USB_ATTACH_SUCCESS_RETURN;
+}
+
+static struct resource_list *
+ndis_get_resource_list(dev, child)
+ device_t dev;
+ device_t child;
+{
+ struct ndis_softc *sc;
+
+ sc = device_get_softc(dev);
+ return (BUS_GET_RESOURCE_LIST(device_get_parent(sc->ndis_dev), dev));
+}
+
+#endif /* NDIS_USB_DEV_TABLE */
diff --git a/sys/modules/ndis/Makefile b/sys/modules/ndis/Makefile
index 4c622dd..f51ddc9 100644
--- a/sys/modules/ndis/Makefile
+++ b/sys/modules/ndis/Makefile
@@ -4,7 +4,7 @@
KMOD= ndis
SRCS= subr_pe.c subr_ndis.c subr_hal.c subr_ntoskrnl.c kern_ndis.c
-SRCS+= kern_windrv.c
+SRCS+= kern_windrv.c subr_usbd.c
SRCS+= opt_bdg.h device_if.h bus_if.h pci_if.h vnode_if.h
.if ${MACHINE_ARCH} == "amd64"
OpenPOWER on IntegriCloud