3 * Bill Paul <wpaul@windriver.com>. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by Bill Paul.
16 * 4. Neither the name of the author nor the names of any co-contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
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.
33 #include <sys/cdefs.h>
34 __FBSDID("$FreeBSD$");
36 #include <sys/param.h>
37 #include <sys/systm.h>
38 #include <sys/unistd.h>
39 #include <sys/types.h>
41 #include <sys/kernel.h>
42 #include <sys/malloc.h>
44 #include <sys/mutex.h>
45 #include <sys/module.h>
50 #include <sys/queue.h>
52 #include <compat/ndis/pe_var.h>
53 #include <compat/ndis/cfg_var.h>
54 #include <compat/ndis/resource_var.h>
55 #include <compat/ndis/ntoskrnl_var.h>
56 #include <compat/ndis/ndis_var.h>
57 #include <compat/ndis/hal_var.h>
58 #include <compat/ndis/usbd_var.h>
60 static driver_object usbd_driver;
62 static uint32_t usbd_iodispatch(device_object *, irp *);
64 static void USBD_GetUSBDIVersion(usbd_version_info *);
65 static void dummy(void);
70 image_patch_table *patch;
73 while (patch->ipt_func != NULL) {
74 windrv_wrap((funcptr)patch->ipt_func,
75 (funcptr *)&patch->ipt_wrap,
76 patch->ipt_argcnt, patch->ipt_ftype);
80 /* Create a fake USB driver instance. */
82 windrv_bus_attach(&usbd_driver, "USB Bus");
84 /* Set up our dipatch routine. */
86 usbd_driver.dro_dispatch[IRP_MJ_INTERNAL_DEVICE_CONTROL] =
87 (driver_dispatch)usbd_iodispatch;
95 image_patch_table *patch;
98 while (patch->ipt_func != NULL) {
99 windrv_unwrap(patch->ipt_wrap);
103 free(usbd_driver.dro_drivername.us_buf, M_DEVBUF);
109 usbd_iodispatch(dobj, ip)
117 USBD_GetUSBDIVersion(ui)
118 usbd_version_info *ui;
120 /* Pretend to be Windows XP. */
122 ui->uvi_usbdi_vers = USBDI_VERSION;
123 ui->uvi_supported_vers = USB_VER_2_0;
131 printf("USBD dummy called\n");
135 image_patch_table usbd_functbl[] = {
136 IMPORT_SFUNC(USBD_GetUSBDIVersion, 0),
137 IMPORT_SFUNC(usbd_iodispatch, 2),
139 IMPORT_FUNC_MAP(_USBD_ParseConfigurationDescriptorEx@28,
140 USBD_ParseConfigurationDescriptorEx),
141 IMPORT_FUNC_MAP(_USBD_CreateConfigurationRequestEx@8,
142 USBD_CreateConfigurationRequestEx),
146 * This last entry is a catch-all for any function we haven't
147 * implemented yet. The PE import list patching routine will
148 * use it for any function that doesn't have an explicit match
152 { NULL, (FUNC)dummy, NULL, 0, WINDRV_WRAP_STDCALL },