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>
35 __FBSDID("$FreeBSD: src/sys/compat/ndis/subr_usbd.c,v 1.1.2.1 2005/03/31 04:24:36 wpaul Exp $");
38 __KERNEL_RCSID(0, "$NetBSD: subr_usbd.c,v 1.5 2007/12/11 23:32:44 lukem Exp $");
41 #include <sys/param.h>
42 #include <sys/systm.h>
43 #include <sys/unistd.h>
44 #include <sys/types.h>
46 #include <sys/kernel.h>
47 #include <sys/malloc.h>
50 #include <sys/mutex.h>
51 #include <sys/module.h>
59 #include <sys/queue.h>
61 #include <compat/ndis/pe_var.h>
62 #include <compat/ndis/cfg_var.h>
63 #include <compat/ndis/resource_var.h>
64 #include <compat/ndis/ntoskrnl_var.h>
65 #include <compat/ndis/ndis_var.h>
66 #include <compat/ndis/hal_var.h>
67 #include <compat/ndis/usbd_var.h>
69 static driver_object usbd_driver
;
71 __stdcall
static uint32_t usbd_iodispatch(device_object
*, irp
*);
73 __stdcall
static void USBD_GetUSBDIVersion(usbd_version_info
*);
74 __stdcall
static void dummy(void);
79 image_patch_table
*patch
;
82 while (patch
->ipt_func
!= NULL
) {
83 windrv_wrap((funcptr
)patch
->ipt_func
,
84 (funcptr
*)&patch
->ipt_wrap
);
88 /* Create a fake USB driver instance. */
90 windrv_bus_attach(&usbd_driver
, "USB Bus");
92 /* Set up our dipatch routine. */
94 usbd_driver
.dro_dispatch
[IRP_MJ_INTERNAL_DEVICE_CONTROL
] =
95 (driver_dispatch
)usbd_iodispatch
;
103 image_patch_table
*patch
;
105 patch
= usbd_functbl
;
106 while (patch
->ipt_func
!= NULL
) {
107 windrv_unwrap(patch
->ipt_wrap
);
111 free(usbd_driver
.dro_drivername
.us_buf
, M_DEVBUF
);
116 __stdcall
static uint32_t
124 __stdcall
static void
125 USBD_GetUSBDIVersion(usbd_version_info
*ui
)
127 /* Pretend to be Windows XP. */
129 ui
->uvi_usbdi_vers
= USBDI_VERSION
;
130 ui
->uvi_supported_vers
= USB_VER_2_0
;
135 __stdcall
static void
138 printf("USBD dummy called\n");
142 image_patch_table usbd_functbl
[] = {
143 IMPORT_FUNC(USBD_GetUSBDIVersion
),
145 IMPORT_FUNC_MAP(_USBD_ParseConfigurationDescriptorEx@
28,
146 USBD_ParseConfigurationDescriptorEx
),
147 IMPORT_FUNC_MAP(_USBD_CreateConfigurationRequestEx@
8,
148 USBD_CreateConfigurationRequestEx
),
152 * This last entry is a catch-all for any function we haven't
153 * implemented yet. The PE import list patching routine will
154 * use it for any function that doesn't have an explicit match
158 { NULL
, (FUNC
)dummy
, NULL
},